From: Cris Di Sclafani Date: Wed, 5 May 2021 10:31:00 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.26 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=3eef85710625ac0a29d1f8b8fba8f67cdb89e793;p=motion2.git Built motion from commit (unavailable).|2.5.26 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 66a8e2d..58d7fa8 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.26", "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": "2021-05-05T09:17:44.411Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.26", "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": "2021-05-05T10:23:00.838Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 3a545b2..9b20ee9 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.26", "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": "2021-05-05T09:17:44.411Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.26", "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": "2021-05-05T10:23:00.838Z", "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 aa713a8..5bf4a2e 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 _0xd08f=['contactManager','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','getDataValue','action'];(function(_0x490181,_0x240ea9){var _0x29bc1f=function(_0x3d95e9){while(--_0x3d95e9){_0x490181['push'](_0x490181['shift']());}};_0x29bc1f(++_0x240ea9);}(_0xd08f,0xa6));var _0xfd08=function(_0x2f6b21,_0x2f8725){_0x2f6b21=_0x2f6b21-0x0;var _0x5c74b0=_0xd08f[_0x2f6b21];return _0x5c74b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3a4617){return this[_0xfd08('0x0')](_0xfd08('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xfd08('0x2'),'integration',_0xfd08('0x3'),_0xfd08('0x4'),'urlForward',_0xfd08('0x5'),'bot',_0xfd08('0x6')]],'msg':_0xfd08('0x7')}},'comment':_0xfd08('0x7')},'data1':{'type':Sequelize[_0xfd08('0x8')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xfd08('0x9')},'data3':{'type':Sequelize[_0xfd08('0x8')](0x1000),'comment':_0xfd08('0xa')},'data4':{'type':Sequelize[_0xfd08('0x8')](0x1000)},'data5':{'type':Sequelize[_0xfd08('0x8')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xfd08('0xb')]}}; \ No newline at end of file +var _0xc240=['urlForward','browser','bot','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]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xc240,0xf5));var _0x0c24=function(_0x53944a,_0xa563c6){_0x53944a=_0x53944a-0x0;var _0x58c12a=_0xc240[_0x53944a];return _0x58c12a;};'use strict';var Sequelize=require(_0x0c24('0x0'));module[_0x0c24('0x1')]={'name':{'type':Sequelize[_0x0c24('0x2')],'get':function(_0xd7edf9){return this[_0x0c24('0x3')](_0x0c24('0x4'));}},'action':{'type':Sequelize[_0x0c24('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0c24('0x6'),_0x0c24('0x7'),_0x0c24('0x8'),_0x0c24('0x9'),_0x0c24('0xa'),_0x0c24('0xb'),_0x0c24('0xc'),'script']],'msg':_0x0c24('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x0c24('0x5')](0x1000),'comment':_0x0c24('0xe')},'data2':{'type':Sequelize[_0x0c24('0x5')](0x1000),'comment':_0x0c24('0xf')},'data3':{'type':Sequelize[_0x0c24('0x5')](0x1000),'comment':_0x0c24('0x10')},'data4':{'type':Sequelize[_0x0c24('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x0c24('0x5')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 07fda13..4ce8830 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 _0xb10b=['update','destroy','then','stack','name','send','body','Action','params','catch','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0xb10b,0x12a));var _0xbb10=function(_0x56b04e,_0x471ebc){_0x56b04e=_0x56b04e-0x0;var _0x4149b9=_0xb10b[_0x56b04e];return _0x4149b9;};'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 fs_extra=require(_0xbb10('0xb'));var _=require('lodash');var squel=require(_0xbb10('0xc'));var crypto=require(_0xbb10('0xd'));var jsforce=require(_0xbb10('0xe'));var deskjs=require(_0xbb10('0xf'));var toCsv=require(_0xbb10('0x10'));var querystring=require(_0xbb10('0x11'));var Papa=require(_0xbb10('0x12'));var Redis=require(_0xbb10('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb10('0x14'));var hardwareService=require(_0xbb10('0x15'));var logger=require(_0xbb10('0x16'))('api');var utils=require(_0xbb10('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbb10('0x18'));var db=require(_0xbb10('0x19'))['db'];function respondWithStatusCode(_0x285009,_0x193a27){_0x193a27=_0x193a27||0xcc;return function(_0x442548){if(_0x442548){return _0x285009[_0xbb10('0x1a')](_0x193a27);}return _0x285009['status'](_0x193a27)[_0xbb10('0x1b')]();};}function respondWithResult(_0x42d7e4,_0x45b9d6){_0x45b9d6=_0x45b9d6||0xc8;return function(_0x17fd46){if(_0x17fd46){return _0x42d7e4[_0xbb10('0x1c')](_0x45b9d6)[_0xbb10('0x1d')](_0x17fd46);}};}function respondWithFilteredResult(_0x24a57b,_0x36b5e8){return function(_0x3e26f4){if(_0x3e26f4){var _0x2b184e=_0x3e26f4[_0xbb10('0x1e')],_0x4a2bfc=_0x36b5e8[_0xbb10('0x1f')],_0x2eca0f=_0x36b5e8[_0xbb10('0x1f')]+_0x36b5e8[_0xbb10('0x20')],_0x1145f1;if(_0x2eca0f>=_0x2b184e){_0x2eca0f=_0x2b184e;_0x1145f1=0xc8;}else{_0x1145f1=0xce;}_0x24a57b[_0xbb10('0x1c')](_0x1145f1);return _0x24a57b[_0xbb10('0x21')](_0xbb10('0x22'),_0x4a2bfc+'-'+_0x2eca0f+'/'+_0x2b184e)[_0xbb10('0x1d')](_0x3e26f4);}return null;};}function patchUpdates(_0x48b6e9){return function(_0x5ff0cf){try{jsonpatch[_0xbb10('0x23')](_0x5ff0cf,_0x48b6e9,!![]);}catch(_0x388fab){return BPromise[_0xbb10('0x24')](_0x388fab);}return _0x5ff0cf[_0xbb10('0x25')]();};}function saveUpdates(_0x44e563,_0x4deb49){return function(_0x12f888){if(_0x12f888){return _0x12f888[_0xbb10('0x26')](_0x44e563)['then'](function(_0x4c4b0d){return _0x4c4b0d;});}return null;};}function removeEntity(_0x8e2b97,_0x311abe){return function(_0x2e911d){if(_0x2e911d){return _0x2e911d[_0xbb10('0x27')]()[_0xbb10('0x28')](function(){_0x8e2b97[_0xbb10('0x1c')](0xcc)[_0xbb10('0x1b')]();});}};}function handleEntityNotFound(_0x436104,_0x7f2377){return function(_0x395404){if(!_0x395404){_0x436104[_0xbb10('0x1a')](0x194);}return _0x395404;};}function handleError(_0x26ad93,_0x537898){_0x537898=_0x537898||0x1f4;return function(_0x4fedac){logger['error'](_0x4fedac[_0xbb10('0x29')]);if(_0x4fedac[_0xbb10('0x2a')]){delete _0x4fedac[_0xbb10('0x2a')];}_0x26ad93['status'](_0x537898)[_0xbb10('0x2b')](_0x4fedac);};}exports[_0xbb10('0x26')]=function(_0x6ed43b,_0x1d5e95){if(_0x6ed43b[_0xbb10('0x2c')]['id']){delete _0x6ed43b[_0xbb10('0x2c')]['id'];}return db[_0xbb10('0x2d')]['find']({'where':{'id':_0x6ed43b[_0xbb10('0x2e')]['id']}})[_0xbb10('0x28')](handleEntityNotFound(_0x1d5e95,null))[_0xbb10('0x28')](saveUpdates(_0x6ed43b[_0xbb10('0x2c')],null))[_0xbb10('0x28')](respondWithResult(_0x1d5e95,null))[_0xbb10('0x2f')](handleError(_0x1d5e95,null));};exports['destroy']=function(_0x221624,_0x4ee02e){return db[_0xbb10('0x2d')]['find']({'where':{'id':_0x221624[_0xbb10('0x2e')]['id']}})[_0xbb10('0x28')](handleEntityNotFound(_0x4ee02e,null))[_0xbb10('0x28')](removeEntity(_0x4ee02e,null))['catch'](handleError(_0x4ee02e,null));}; \ No newline at end of file +var _0x1a85=['name','send','body','Action','find','params','destroy','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','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','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x34eb0d,_0x43448b){var _0x309bb3=function(_0x3f10c5){while(--_0x3f10c5){_0x34eb0d['push'](_0x34eb0d['shift']());}};_0x309bb3(++_0x43448b);}(_0x1a85,0x178));var _0x51a8=function(_0x57d843,_0x2a95e0){_0x57d843=_0x57d843-0x0;var _0x42ba2d=_0x1a85[_0x57d843];return _0x42ba2d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x51a8('0x0'));var zipdir=require(_0x51a8('0x1'));var jsonpatch=require(_0x51a8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x51a8('0x3'));var Mustache=require(_0x51a8('0x4'));var util=require(_0x51a8('0x5'));var path=require('path');var sox=require(_0x51a8('0x6'));var csv=require('to-csv');var ejs=require(_0x51a8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51a8('0x8'));var squel=require(_0x51a8('0x9'));var crypto=require('crypto');var jsforce=require(_0x51a8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x51a8('0xb'));var Papa=require(_0x51a8('0xc'));var Redis=require(_0x51a8('0xd'));var authService=require(_0x51a8('0xe'));var qs=require(_0x51a8('0xf'));var as=require(_0x51a8('0x10'));var hardwareService=require(_0x51a8('0x11'));var logger=require(_0x51a8('0x12'))(_0x51a8('0x13'));var utils=require(_0x51a8('0x14'));var config=require(_0x51a8('0x15'));var licenseUtil=require(_0x51a8('0x16'));var db=require(_0x51a8('0x17'))['db'];function respondWithStatusCode(_0x1827e6,_0x43c042){_0x43c042=_0x43c042||0xcc;return function(_0x2e1629){if(_0x2e1629){return _0x1827e6[_0x51a8('0x18')](_0x43c042);}return _0x1827e6['status'](_0x43c042)[_0x51a8('0x19')]();};}function respondWithResult(_0x7a4c36,_0xaec066){_0xaec066=_0xaec066||0xc8;return function(_0x50d992){if(_0x50d992){return _0x7a4c36[_0x51a8('0x1a')](_0xaec066)['json'](_0x50d992);}};}function respondWithFilteredResult(_0x10584b,_0x2b8d37){return function(_0x39cd45){if(_0x39cd45){var _0x2b0521=_0x39cd45['count'],_0x3fbd02=_0x2b8d37[_0x51a8('0x1b')],_0x3e0603=_0x2b8d37[_0x51a8('0x1b')]+_0x2b8d37[_0x51a8('0x1c')],_0x1f49ee;if(_0x3e0603>=_0x2b0521){_0x3e0603=_0x2b0521;_0x1f49ee=0xc8;}else{_0x1f49ee=0xce;}_0x10584b[_0x51a8('0x1a')](_0x1f49ee);return _0x10584b[_0x51a8('0x1d')](_0x51a8('0x1e'),_0x3fbd02+'-'+_0x3e0603+'/'+_0x2b0521)['json'](_0x39cd45);}return null;};}function patchUpdates(_0x1df8c2){return function(_0x3b7e7e){try{jsonpatch[_0x51a8('0x1f')](_0x3b7e7e,_0x1df8c2,!![]);}catch(_0x2f2681){return BPromise[_0x51a8('0x20')](_0x2f2681);}return _0x3b7e7e[_0x51a8('0x21')]();};}function saveUpdates(_0x28aea0,_0x3bf5b6){return function(_0x5ac1c0){if(_0x5ac1c0){return _0x5ac1c0[_0x51a8('0x22')](_0x28aea0)['then'](function(_0xfe0ddb){return _0xfe0ddb;});}return null;};}function removeEntity(_0x12c029,_0x8bda40){return function(_0x3759d6){if(_0x3759d6){return _0x3759d6['destroy']()[_0x51a8('0x23')](function(){_0x12c029['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d26a,_0x52e503){return function(_0x384d25){if(!_0x384d25){_0x23d26a[_0x51a8('0x18')](0x194);}return _0x384d25;};}function handleError(_0x20ef8b,_0x18e2f3){_0x18e2f3=_0x18e2f3||0x1f4;return function(_0x157554){logger[_0x51a8('0x24')](_0x157554[_0x51a8('0x25')]);if(_0x157554[_0x51a8('0x26')]){delete _0x157554['name'];}_0x20ef8b[_0x51a8('0x1a')](_0x18e2f3)[_0x51a8('0x27')](_0x157554);};}exports[_0x51a8('0x22')]=function(_0x3da187,_0x1c150d){if(_0x3da187[_0x51a8('0x28')]['id']){delete _0x3da187[_0x51a8('0x28')]['id'];}return db[_0x51a8('0x29')][_0x51a8('0x2a')]({'where':{'id':_0x3da187[_0x51a8('0x2b')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x1c150d,null))[_0x51a8('0x23')](saveUpdates(_0x3da187['body'],null))[_0x51a8('0x23')](respondWithResult(_0x1c150d,null))['catch'](handleError(_0x1c150d,null));};exports[_0x51a8('0x2c')]=function(_0x3bc19a,_0x143f46){return db[_0x51a8('0x29')][_0x51a8('0x2a')]({'where':{'id':_0x3bc19a['params']['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x143f46,null))['then'](removeEntity(_0x143f46,null))[_0x51a8('0x2d')](handleError(_0x143f46,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index afa4e64..ab18d56 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 _0x5091=['path','rimraf','../../config/environment','./action.attributes','define','Action','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2a7ca1,_0xa2c666){var _0xcc751a=function(_0x1d7b75){while(--_0x1d7b75){_0x2a7ca1['push'](_0x2a7ca1['shift']());}};_0xcc751a(++_0xa2c666);}(_0x5091,0xba));var _0x1509=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5091[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1509('0x0'));var util=require(_0x1509('0x1'));var logger=require(_0x1509('0x2'))(_0x1509('0x3'));var moment=require('moment');var BPromise=require(_0x1509('0x4'));var rp=require(_0x1509('0x5'));var fs=require('fs');var path=require(_0x1509('0x6'));var rimraf=require(_0x1509('0x7'));var config=require(_0x1509('0x8'));var attributes=require(_0x1509('0x9'));module['exports']=function(_0x2e01c7,_0x2aa093){return _0x2e01c7[_0x1509('0xa')](_0x1509('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92bf=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','Action','tools_actions'];(function(_0x252434,_0x1d7ba2){var _0x12e6dc=function(_0x4e9a9e){while(--_0x4e9a9e){_0x252434['push'](_0x252434['shift']());}};_0x12e6dc(++_0x1d7ba2);}(_0x92bf,0x168));var _0xf92b=function(_0x195ab0,_0x273e02){_0x195ab0=_0x195ab0-0x0;var _0x59414a=_0x92bf[_0x195ab0];return _0x59414a;};'use strict';var _=require(_0xf92b('0x0'));var util=require(_0xf92b('0x1'));var logger=require(_0xf92b('0x2'))('api');var moment=require(_0xf92b('0x3'));var BPromise=require(_0xf92b('0x4'));var rp=require(_0xf92b('0x5'));var fs=require('fs');var path=require(_0xf92b('0x6'));var rimraf=require(_0xf92b('0x7'));var config=require(_0xf92b('0x8'));var attributes=require(_0xf92b('0x9'));module['exports']=function(_0x3fce31,_0x118322){return _0x3fce31['define'](_0xf92b('0xa'),attributes,{'tableName':_0xf92b('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 1303c1d..ff6e81f 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x367c90,_0xcfc3d6){var _0x226dd2=function(_0x2890dc){while(--_0x2890dc){_0x367c90['push'](_0x367c90['shift']());}};_0x226dd2(++_0xcfc3d6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ed8cf01..2309409 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 _0x1b20=['./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x1b20,0x1c8));var _0x01b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b20[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x01b2('0x0'));var util=require(_0x01b2('0x1'));var path=require(_0x01b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x3')]();var fs_extra=require(_0x01b2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x01b2('0x5'));var controller=require(_0x01b2('0x6'));router[_0x01b2('0x7')](_0x01b2('0x8'),auth[_0x01b2('0x9')](),controller[_0x01b2('0xa')]);router[_0x01b2('0xb')](_0x01b2('0x8'),auth[_0x01b2('0x9')](),controller[_0x01b2('0xc')]);module[_0x01b2('0xd')]=router; \ No newline at end of file +var _0x8ec1=['/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./action.controller','put','isAuthenticated','update','delete'];(function(_0x58c86a,_0x602654){var _0x2bb374=function(_0x1302a9){while(--_0x1302a9){_0x58c86a['push'](_0x58c86a['shift']());}};_0x2bb374(++_0x602654);}(_0x8ec1,0x1e3));var _0x18ec=function(_0x18c8b5,_0x2a15d3){_0x18c8b5=_0x18c8b5-0x0;var _0x358984=_0x8ec1[_0x18c8b5];return _0x358984;};'use strict';var multer=require('multer');var util=require(_0x18ec('0x0'));var path=require(_0x18ec('0x1'));var timeout=require(_0x18ec('0x2'));var express=require(_0x18ec('0x3'));var router=express[_0x18ec('0x4')]();var fs_extra=require(_0x18ec('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x18ec('0x6'));var controller=require(_0x18ec('0x7'));router[_0x18ec('0x8')]('/:id',auth[_0x18ec('0x9')](),controller[_0x18ec('0xa')]);router[_0x18ec('0xb')](_0x18ec('0xc'),auth[_0x18ec('0x9')](),controller[_0x18ec('0xd')]);module[_0x18ec('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2d7f232..471b8e6 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 _0xfd07=['sequelize','STRING','TEXT'];(function(_0x2d1288,_0x56e75a){var _0x251df4=function(_0x23f413){while(--_0x23f413){_0x2d1288['push'](_0x2d1288['shift']());}};_0x251df4(++_0x56e75a);}(_0xfd07,0xed));var _0x7fd0=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0xfd07[_0x40822a];return _0x357420;};'use strict';var Sequelize=require(_0x7fd0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7fd0('0x1')]},'parent':{'type':Sequelize[_0x7fd0('0x1')]},'table':{'type':Sequelize[_0x7fd0('0x1')]},'conditions':{'type':Sequelize[_0x7fd0('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1395=['STRING','TEXT','sequelize','exports'];(function(_0x4d1930,_0x2526a1){var _0x135543=function(_0x36a69d){while(--_0x36a69d){_0x4d1930['push'](_0x4d1930['shift']());}};_0x135543(++_0x2526a1);}(_0x1395,0x1a2));var _0x5139=function(_0x2360c9,_0x95106f){_0x2360c9=_0x2360c9-0x0;var _0x373e70=_0x1395[_0x2360c9];return _0x373e70;};'use strict';var Sequelize=require(_0x5139('0x0'));module[_0x5139('0x1')]={'name':{'type':Sequelize[_0x5139('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5139('0x2')]},'parent':{'type':Sequelize[_0x5139('0x2')]},'table':{'type':Sequelize[_0x5139('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5139('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 21bb013..00079f0 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 _0x11bc=['format','groupBy','group','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s)','HOUR(%s)','IS\x20NULL','findAll','DESC','clone','output','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','fork','join','../../components/export/','savename','countTable','COUNT(*)','run','eml-format','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','end','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','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)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace'];(function(_0x3cbe3a,_0x78bfce){var _0x24ffc1=function(_0x103ae4){while(--_0x103ae4){_0x3cbe3a['push'](_0x3cbe3a['shift']());}};_0x24ffc1(++_0x78bfce);}(_0x11bc,0xd0));var _0xc11b=function(_0x301196,_0x134320){_0x301196=_0x301196-0x0;var _0x1085d3=_0x11bc[_0x301196];return _0x1085d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc11b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc11b('0x1'));var moment=require(_0xc11b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc11b('0x3'));var util=require(_0xc11b('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc11b('0x5'));var ejs=require(_0xc11b('0x6'));var fs=require('fs');var fs_extra=require(_0xc11b('0x7'));var _=require(_0xc11b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc11b('0x9'));var deskjs=require(_0xc11b('0xa'));var toCsv=require(_0xc11b('0x5'));var querystring=require(_0xc11b('0xb'));var Papa=require(_0xc11b('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc11b('0xd'));var as=require(_0xc11b('0xe'));var hardwareService=require(_0xc11b('0xf'));var logger=require(_0xc11b('0x10'))(_0xc11b('0x11'));var utils=require(_0xc11b('0x12'));var config=require(_0xc11b('0x13'));var licenseUtil=require(_0xc11b('0x14'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc11b('0x15'))[_0xc11b('0x16')];function respondWithStatusCode(_0x287dfc,_0x43a4ab){_0x43a4ab=_0x43a4ab||0xcc;return function(_0x134944){if(_0x134944){return _0x287dfc[_0xc11b('0x17')](_0x43a4ab);}return _0x287dfc[_0xc11b('0x18')](_0x43a4ab)['end']();};}function respondWithResult(_0x3e428b,_0x989793){_0x989793=_0x989793||0xc8;return function(_0x1bc893){if(_0x1bc893){return _0x3e428b['status'](_0x989793)[_0xc11b('0x19')](_0x1bc893);}};}function respondWithFilteredResult(_0x4698db,_0x337bca){return function(_0x345a31){if(_0x345a31){var _0x25742e=_0x345a31[_0xc11b('0x1a')],_0x3f9cb8=_0x337bca[_0xc11b('0x1b')],_0x5c4cf5=_0x337bca['offset']+_0x337bca['limit'],_0x1c4966;if(_0x5c4cf5>=_0x25742e){_0x5c4cf5=_0x25742e;_0x1c4966=0xc8;}else{_0x1c4966=0xce;}_0x4698db[_0xc11b('0x18')](_0x1c4966);return _0x4698db['set'](_0xc11b('0x1c'),_0x3f9cb8+'-'+_0x5c4cf5+'/'+_0x25742e)[_0xc11b('0x19')](_0x345a31);}return null;};}function patchUpdates(_0x10fc10){return function(_0x565706){try{jsonpatch[_0xc11b('0x1d')](_0x565706,_0x10fc10,!![]);}catch(_0x1f8a2e){return BPromise[_0xc11b('0x1e')](_0x1f8a2e);}return _0x565706[_0xc11b('0x1f')]();};}function saveUpdates(_0x5805d9,_0x2a3ef5){return function(_0x245014){if(_0x245014){return _0x245014[_0xc11b('0x20')](_0x5805d9)[_0xc11b('0x21')](function(_0x50d3bb){return _0x50d3bb;});}return null;};}function removeEntity(_0x459b1a,_0x2db456){return function(_0x2fc989){if(_0x2fc989){return _0x2fc989[_0xc11b('0x22')]()['then'](function(){var _0x52f50a=_0x2fc989['get']({'plain':!![]});var _0x5c1d9b=_0xc11b('0x23');return db[_0xc11b('0x24')][_0xc11b('0x22')]({'where':{'type':_0x5c1d9b,'resourceId':_0x52f50a['id']}})['then'](function(){return _0x2fc989;});})['then'](function(){_0x459b1a[_0xc11b('0x18')](0xcc)[_0xc11b('0x25')]();});}};}function handleEntityNotFound(_0x496d2c,_0xc2d9de){return function(_0x55ba52){if(!_0x55ba52){_0x496d2c[_0xc11b('0x17')](0x194);}return _0x55ba52;};}function handleError(_0x59da2b,_0x578b19){_0x578b19=_0x578b19||0x1f4;return function(_0x4f556a){logger['error'](_0x4f556a['stack']);if(_0x4f556a[_0xc11b('0x26')]){delete _0x4f556a[_0xc11b('0x26')];}_0x59da2b[_0xc11b('0x18')](_0x578b19)[_0xc11b('0x27')](_0x4f556a);};}exports[_0xc11b('0x28')]=function(_0x461d8a,_0x283b78){var _0x19f24f={},_0x53ba28={},_0x1d9a87={'count':0x0,'rows':[]};var _0x39e295=_[_0xc11b('0x29')](db[_0xc11b('0x2a')][_0xc11b('0x2b')],function(_0x571df9){return{'name':_0x571df9[_0xc11b('0x2c')],'type':_0x571df9[_0xc11b('0x2d')]['key']};});_0x53ba28['model']=_[_0xc11b('0x29')](_0x39e295,_0xc11b('0x26'));_0x53ba28['query']=_[_0xc11b('0x2e')](_0x461d8a['query']);_0x53ba28[_0xc11b('0x2f')]=_[_0xc11b('0x30')](_0x53ba28[_0xc11b('0x31')],_0x53ba28[_0xc11b('0x32')]);_0x19f24f['attributes']=_[_0xc11b('0x30')](_0x53ba28['model'],qs[_0xc11b('0x33')](_0x461d8a[_0xc11b('0x32')]['fields']));_0x19f24f[_0xc11b('0x34')]=_0x19f24f[_0xc11b('0x34')][_0xc11b('0x35')]?_0x19f24f['attributes']:_0x53ba28[_0xc11b('0x31')];if(!_0x461d8a[_0xc11b('0x32')][_0xc11b('0x36')]('nolimit')){_0x19f24f[_0xc11b('0x37')]=qs[_0xc11b('0x37')](_0x461d8a[_0xc11b('0x32')][_0xc11b('0x37')]);_0x19f24f[_0xc11b('0x1b')]=qs[_0xc11b('0x1b')](_0x461d8a[_0xc11b('0x32')][_0xc11b('0x1b')]);}_0x19f24f[_0xc11b('0x38')]=qs[_0xc11b('0x39')](_0x461d8a['query'][_0xc11b('0x39')]);_0x19f24f['where']=qs[_0xc11b('0x2f')](_[_0xc11b('0x3a')](_0x461d8a[_0xc11b('0x32')],_0x53ba28['filters']),_0x39e295);if(_0x461d8a[_0xc11b('0x32')]['filter']){_0x19f24f[_0xc11b('0x3b')]=_[_0xc11b('0x3c')](_0x19f24f[_0xc11b('0x3b')],{'$or':_[_0xc11b('0x29')](_0x39e295,function(_0xac5361){if(_0xac5361[_0xc11b('0x2d')]!==_0xc11b('0x3d')){var _0x554012={};_0x554012[_0xac5361['name']]={'$like':'%'+_0x461d8a[_0xc11b('0x32')][_0xc11b('0x3e')]+'%'};return _0x554012;}})});}_0x19f24f=_[_0xc11b('0x3c')]({},_0x19f24f,_0x461d8a[_0xc11b('0x3f')]);var _0x376eb1={'where':_0x19f24f[_0xc11b('0x3b')]};return db[_0xc11b('0x2a')][_0xc11b('0x1a')](_0x376eb1)[_0xc11b('0x21')](function(_0x4ca3f6){_0x1d9a87[_0xc11b('0x1a')]=_0x4ca3f6;if(_0x461d8a[_0xc11b('0x32')][_0xc11b('0x40')]){_0x19f24f['include']=[{'all':!![]}];}return db[_0xc11b('0x2a')]['findAll'](_0x19f24f);})[_0xc11b('0x21')](function(_0x4df5f6){_0x1d9a87[_0xc11b('0x41')]=_0x4df5f6;return _0x1d9a87;})[_0xc11b('0x21')](respondWithFilteredResult(_0x283b78,_0x19f24f))[_0xc11b('0x42')](handleError(_0x283b78,null));};exports[_0xc11b('0x43')]=function(_0x3e749a,_0xc8d90c){var _0x5b5b8d={'raw':![],'where':{'id':_0x3e749a[_0xc11b('0x44')]['id']}},_0x300686={};_0x300686[_0xc11b('0x31')]=_[_0xc11b('0x2e')](db['AnalyticCustomReport']['rawAttributes']);_0x300686[_0xc11b('0x32')]=_[_0xc11b('0x2e')](_0x3e749a[_0xc11b('0x32')]);_0x300686[_0xc11b('0x2f')]=_[_0xc11b('0x30')](_0x300686['model'],_0x300686[_0xc11b('0x32')]);_0x5b5b8d[_0xc11b('0x34')]=_['intersection'](_0x300686['model'],qs['fields'](_0x3e749a['query'][_0xc11b('0x33')]));_0x5b5b8d[_0xc11b('0x34')]=_0x5b5b8d[_0xc11b('0x34')][_0xc11b('0x35')]?_0x5b5b8d['attributes']:_0x300686['model'];if(_0x3e749a[_0xc11b('0x32')][_0xc11b('0x40')]){_0x5b5b8d[_0xc11b('0x45')]=[{'all':!![]}];}_0x5b5b8d=_['merge']({},_0x5b5b8d,_0x3e749a['options']);return db[_0xc11b('0x2a')]['find'](_0x5b5b8d)[_0xc11b('0x21')](handleEntityNotFound(_0xc8d90c,null))[_0xc11b('0x21')](respondWithResult(_0xc8d90c,null))[_0xc11b('0x42')](handleError(_0xc8d90c,null));};exports[_0xc11b('0x46')]=function(_0x917041,_0x18bba7){return db[_0xc11b('0x2a')][_0xc11b('0x46')](_0x917041[_0xc11b('0x47')],{})['then'](function(_0x135fd9){var _0x3fbc57=_0x917041[_0xc11b('0x48')][_0xc11b('0x49')]({'plain':!![]});if(!_0x3fbc57)throw new Error(_0xc11b('0x4a'));if(_0x3fbc57[_0xc11b('0x4b')]===_0xc11b('0x48')){var _0x1e88f3=_0x135fd9['get']({'plain':!![]});var _0x28e1e3='Reports';return db[_0xc11b('0x4c')][_0xc11b('0x4d')]({'where':{'name':_0x28e1e3,'userProfileId':_0x3fbc57['userProfileId']},'raw':!![]})['then'](function(_0x28b9ad){if(_0x28b9ad&&_0x28b9ad[_0xc11b('0x4e')]===0x0){return db['UserProfileResource'][_0xc11b('0x46')]({'name':_0x1e88f3[_0xc11b('0x26')],'resourceId':_0x1e88f3['id'],'type':_0xc11b('0x23'),'sectionId':_0x28b9ad['id']},{})[_0xc11b('0x21')](function(){return _0x135fd9;});}else{return _0x135fd9;}})['catch'](function(_0x32f8f2){logger[_0xc11b('0x4f')](_0xc11b('0x50'),_0x32f8f2);throw _0x32f8f2;});}return _0x135fd9;})[_0xc11b('0x21')](respondWithResult(_0x18bba7,0xc9))[_0xc11b('0x42')](handleError(_0x18bba7,null));};exports[_0xc11b('0x20')]=function(_0x22197a,_0x235783){if(_0x22197a[_0xc11b('0x47')]['id']){delete _0x22197a[_0xc11b('0x47')]['id'];}return db[_0xc11b('0x2a')][_0xc11b('0x4d')]({'where':{'id':_0x22197a['params']['id']}})[_0xc11b('0x21')](handleEntityNotFound(_0x235783,null))['then'](saveUpdates(_0x22197a['body'],null))[_0xc11b('0x21')](respondWithResult(_0x235783,null))['catch'](handleError(_0x235783,null));};exports[_0xc11b('0x22')]=function(_0x5f3315,_0x18a31b){return db[_0xc11b('0x2a')]['find']({'where':{'id':_0x5f3315[_0xc11b('0x44')]['id']}})['then'](handleEntityNotFound(_0x18a31b,null))[_0xc11b('0x21')](removeEntity(_0x18a31b,null))[_0xc11b('0x42')](handleError(_0x18a31b,null));};exports[_0xc11b('0x51')]=function(_0x36a5d6,_0xbcfa22){var _0x558cc1=0xa;var _0xb68312=['join','left_join',_0xc11b('0x52'),_0xc11b('0x53')];var _0x5bfa82={'SUM':_0xc11b('0x54'),'COUNT':_0xc11b('0x55'),'COUNT DISTINCT':_0xc11b('0x56'),'MAX':_0xc11b('0x57'),'MIN':_0xc11b('0x58'),'AVG':_0xc11b('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc11b('0x5a'),'GROUP_CONCAT DESC':_0xc11b('0x5b')};var _0x44b63b={'SEC_TO_TIME':_0xc11b('0x5c'),'DATE':_0xc11b('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xc11b('0x5e'),'UNIX_TIMESTAMP':_0xc11b('0x5f')};var _0x34912b=function(_0x46e19c){return!_[_0xc11b('0x60')](['IS\x20NULL',_0xc11b('0x61'),_0xc11b('0x62'),_0xc11b('0x63')],_0x46e19c);};var _0x256e9d=function(_0x5ba247){if(!_0x5ba247||!_0x5ba247[_0xc11b('0x64')][_0xc11b('0x35')]){return'';}for(var _0x47b84e='(',_0x19312b=0x0;_0x19312b<_0x5ba247[_0xc11b('0x64')][_0xc11b('0x35')];_0x19312b+=0x1){_0x19312b>0x0&&(_0x47b84e+='\x20'+_0x5ba247[_0xc11b('0x65')]+'\x20');_0x47b84e+=_0x5ba247[_0xc11b('0x64')][_0x19312b]['group']?_0x256e9d(_0x5ba247[_0xc11b('0x64')][_0x19312b]['group']):_0x5ba247[_0xc11b('0x64')][_0x19312b][_0xc11b('0x66')]+'\x20'+_0x5ba247[_0xc11b('0x64')][_0x19312b][_0xc11b('0x67')]+(_0x34912b(_0x5ba247[_0xc11b('0x64')][_0x19312b][_0xc11b('0x67')])?'\x20'+_0x5ba247[_0xc11b('0x64')][_0x19312b][_0xc11b('0x68')]:'');}return _0x47b84e+')';};var _0x123bee={'where':{'id':_0x36a5d6[_0xc11b('0x44')]['id']}},_0x37ffa4,_0xaa68de,_0x92b977,_0x326810,_0x9de29b;_0x123bee=_[_0xc11b('0x3c')]({},_0x123bee,_0x36a5d6[_0xc11b('0x3f')]);return db['AnalyticCustomReport'][_0xc11b('0x4d')](_0x123bee)[_0xc11b('0x21')](function(_0x323cfd){if(_0x323cfd){_0x37ffa4=_0x323cfd;return _0x323cfd[_0xc11b('0x69')]();}return null;})[_0xc11b('0x21')](function(_0x364c8e){if(_0x364c8e){if(!_0x364c8e[_0xc11b('0x35')]){throw new db[(_0xc11b('0x6a'))][(_0xc11b('0x6b'))](_0xc11b('0x6c'),0x193);}_0xaa68de=_0x364c8e;return db[_0xc11b('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xc11b('0x21')](function(_0x290321){if(_0x290321){_0x92b977=_[_0xc11b('0x6e')](_0x290321,'id');var _0x422010;var _0x2297c3=squel[_0xc11b('0x6f')]();_0x2297c3[_0xc11b('0x70')](_0x37ffa4[_0xc11b('0x71')]);for(var _0x3a275c=0x0;_0x3a275c<_0xaa68de['length'];_0x3a275c+=0x1){_0x422010=_0xaa68de[_0x3a275c][_0xc11b('0x72')]?_0x92b977[_0xaa68de[_0x3a275c][_0xc11b('0x72')]][_0xc11b('0x73')]:_0xaa68de[_0x3a275c]['field'];_0x422010=_0xaa68de[_0x3a275c][_0xc11b('0x74')]?_[_0xc11b('0x75')](_0x5bfa82[_0xaa68de[_0x3a275c][_0xc11b('0x74')]],'%s',_0x422010):_0x422010;_0x422010=_0xaa68de[_0x3a275c]['format']?_[_0xc11b('0x75')](_0x44b63b[_0xaa68de[_0x3a275c][_0xc11b('0x76')]],'%s',_0x422010):_0x422010;if(_0xaa68de[_0x3a275c][_0xc11b('0x77')]){_0x2297c3[_0xc11b('0x78')](_0x422010);}_0xaa68de[_0x3a275c][_0xc11b('0x79')]&&_0x2297c3['order'](_0x422010,_0xaa68de[_0x3a275c]['orderBy']==='DESC'?![]:!![]);_0x2297c3[_0xc11b('0x66')](_0x422010,_0xaa68de[_0x3a275c][_0xc11b('0x7a')]||_0x422010);}if(_0x37ffa4[_0xc11b('0x7b')]){_0x37ffa4[_0xc11b('0x7b')]=JSON[_0xc11b('0x7c')](_0x37ffa4[_0xc11b('0x7b')]);for(var _0x4c5ea8=0x0;_0x4c5ea8<_0x37ffa4['joins'][_0xc11b('0x35')];_0x4c5ea8+=0x1){if(_0x37ffa4[_0xc11b('0x7b')][_0x4c5ea8][_0xc11b('0x2d')]&&_[_0xc11b('0x60')](_0xb68312,_0x37ffa4[_0xc11b('0x7b')][_0x4c5ea8][_0xc11b('0x2d')])&&_0x37ffa4[_0xc11b('0x7b')][_0x4c5ea8][_0xc11b('0x7d')]&&_0x37ffa4[_0xc11b('0x7b')][_0x4c5ea8]['foreignTable']&&_0x37ffa4[_0xc11b('0x7b')][_0x4c5ea8][_0xc11b('0x7e')]){_0x2297c3[_0x37ffa4['joins'][_0x4c5ea8]['type']](_0x37ffa4[_0xc11b('0x7b')][_0x4c5ea8][_0xc11b('0x7f')],null,util[_0xc11b('0x76')](_0xc11b('0x80'),_0x37ffa4[_0xc11b('0x71')],_0x37ffa4[_0xc11b('0x7b')][_0x4c5ea8]['parentKey'],_0x37ffa4['joins'][_0x4c5ea8][_0xc11b('0x7f')],_0x37ffa4[_0xc11b('0x7b')][_0x4c5ea8][_0xc11b('0x7e')]));}}}if(_0x37ffa4[_0xc11b('0x81')]){_0x37ffa4['conditions']=JSON[_0xc11b('0x7c')](_0x37ffa4[_0xc11b('0x81')]);_0x2297c3[_0xc11b('0x3b')](_0x256e9d(_0x37ffa4[_0xc11b('0x81')][_0xc11b('0x78')]));}_0x9de29b=_0x2297c3['clone']();_0x2297c3[_0xc11b('0x37')](_0x558cc1);_0x2297c3[_0xc11b('0x1b')](0x0);logger[_0xc11b('0x82')](_0xc11b('0x83'),_0x2297c3['toString']());return dbH[_0xc11b('0x84')]['query'](_0x2297c3[_0xc11b('0x85')](),{'type':dbH[_0xc11b('0x84')][_0xc11b('0x86')][_0xc11b('0x87')]});}})[_0xc11b('0x21')](respondWithResult(_0xbcfa22,null))[_0xc11b('0x42')](handleError(_0xbcfa22,null));};function runReport(_0x1f9dec,_0x55f9ed,_0x314940){var _0x1e0b69=_0x55f9ed[_0xc11b('0x26')];var _0x44c0e3=0xa;var _0x4ab1bb=['join',_0xc11b('0x88'),_0xc11b('0x52'),_0xc11b('0x53')];var _0x3f45b0={'SUM':'SUM(%s)','COUNT':_0xc11b('0x55'),'COUNT DISTINCT':_0xc11b('0x56'),'MAX':_0xc11b('0x57'),'MIN':_0xc11b('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc11b('0x89'),'GROUP_CONCAT ASC':_0xc11b('0x5a'),'GROUP_CONCAT DESC':_0xc11b('0x5b')};var _0x2219ba={'SEC_TO_TIME':_0xc11b('0x5c'),'DATE':_0xc11b('0x5d'),'HOUR':_0xc11b('0x8a'),'ROUND':_0xc11b('0x5e'),'UNIX_TIMESTAMP':_0xc11b('0x5f')};var _0x43f968=function(_0x525f9e){return!_[_0xc11b('0x60')]([_0xc11b('0x8b'),_0xc11b('0x61'),_0xc11b('0x62'),_0xc11b('0x63')],_0x525f9e);};var _0x33dd0a=function(_0x237c61){if(!_0x237c61||!_0x237c61['rules'][_0xc11b('0x35')]){return'';}for(var _0x2ffa34='(',_0x1b3ca3=0x0;_0x1b3ca3<_0x237c61[_0xc11b('0x64')]['length'];_0x1b3ca3+=0x1){_0x1b3ca3>0x0&&(_0x2ffa34+='\x20'+_0x237c61['operator']+'\x20');_0x2ffa34+=_0x237c61['rules'][_0x1b3ca3]['group']?_0x33dd0a(_0x237c61[_0xc11b('0x64')][_0x1b3ca3][_0xc11b('0x78')]):_0x237c61['rules'][_0x1b3ca3]['field']+'\x20'+_0x237c61[_0xc11b('0x64')][_0x1b3ca3][_0xc11b('0x67')]+(_0x43f968(_0x237c61['rules'][_0x1b3ca3]['condition'])?'\x20'+_0x237c61[_0xc11b('0x64')][_0x1b3ca3][_0xc11b('0x68')]:'');}return _0x2ffa34+')';};var _0x138261={'where':{'id':_0x1f9dec['id']}},_0x4c0010,_0x43aa5a,_0x256708,_0x18d117,_0x17a27a;_0x138261=_[_0xc11b('0x3c')]({},_0x138261,_0x314940);return db[_0xc11b('0x2a')][_0xc11b('0x4d')](_0x138261)[_0xc11b('0x21')](function(_0x15c504){if(_0x15c504){_0x4c0010=_0x15c504;return _0x15c504[_0xc11b('0x69')]();}return null;})[_0xc11b('0x21')](function(_0x88a25c){if(_0x88a25c){if(!_0x88a25c[_0xc11b('0x35')]){throw new db[(_0xc11b('0x6a'))][(_0xc11b('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x43aa5a=_0x88a25c;return db[_0xc11b('0x6d')][_0xc11b('0x8c')]({'raw':!![]});}return null;})['then'](function(_0x51f2e9){if(_0x51f2e9){_0x256708=_[_0xc11b('0x6e')](_0x51f2e9,'id');var _0x4de081;var _0x44277c=squel[_0xc11b('0x6f')]();_0x44277c[_0xc11b('0x70')](_0x4c0010[_0xc11b('0x71')]);for(var _0x133f00=0x0;_0x133f00<_0x43aa5a[_0xc11b('0x35')];_0x133f00+=0x1){_0x4de081=_0x43aa5a[_0x133f00][_0xc11b('0x72')]?_0x256708[_0x43aa5a[_0x133f00][_0xc11b('0x72')]][_0xc11b('0x73')]:_0x43aa5a[_0x133f00]['field'];_0x4de081=_0x43aa5a[_0x133f00][_0xc11b('0x74')]?_[_0xc11b('0x75')](_0x3f45b0[_0x43aa5a[_0x133f00][_0xc11b('0x74')]],'%s',_0x4de081):_0x4de081;_0x4de081=_0x43aa5a[_0x133f00][_0xc11b('0x76')]?_[_0xc11b('0x75')](_0x2219ba[_0x43aa5a[_0x133f00][_0xc11b('0x76')]],'%s',_0x4de081):_0x4de081;if(_0x43aa5a[_0x133f00][_0xc11b('0x77')]){_0x44277c['group'](_0x4de081);}_0x43aa5a[_0x133f00][_0xc11b('0x79')]&&_0x44277c['order'](_0x4de081,_0x43aa5a[_0x133f00][_0xc11b('0x79')]===_0xc11b('0x8d')?![]:!![]);_0x44277c[_0xc11b('0x66')](_0x4de081,_0x43aa5a[_0x133f00][_0xc11b('0x7a')]||_0x4de081);}if(_0x4c0010[_0xc11b('0x7b')]){_0x4c0010[_0xc11b('0x7b')]=JSON[_0xc11b('0x7c')](_0x4c0010[_0xc11b('0x7b')]);for(var _0x115a6c=0x0;_0x115a6c<_0x4c0010['joins']['length'];_0x115a6c+=0x1){if(_0x4c0010['joins'][_0x115a6c][_0xc11b('0x2d')]&&_[_0xc11b('0x60')](_0x4ab1bb,_0x4c0010[_0xc11b('0x7b')][_0x115a6c]['type'])&&_0x4c0010[_0xc11b('0x7b')][_0x115a6c][_0xc11b('0x7d')]&&_0x4c0010[_0xc11b('0x7b')][_0x115a6c][_0xc11b('0x7f')]&&_0x4c0010['joins'][_0x115a6c][_0xc11b('0x7e')]){_0x44277c[_0x4c0010['joins'][_0x115a6c][_0xc11b('0x2d')]](_0x4c0010[_0xc11b('0x7b')][_0x115a6c][_0xc11b('0x7f')],null,util[_0xc11b('0x76')](_0xc11b('0x80'),_0x4c0010[_0xc11b('0x71')],_0x4c0010[_0xc11b('0x7b')][_0x115a6c][_0xc11b('0x7d')],_0x4c0010[_0xc11b('0x7b')][_0x115a6c][_0xc11b('0x7f')],_0x4c0010['joins'][_0x115a6c]['foreignKey']));}}}if(_0x4c0010['conditions']){_0x4c0010[_0xc11b('0x81')]=JSON[_0xc11b('0x7c')](_0x4c0010['conditions']);_0x44277c[_0xc11b('0x3b')](_0x33dd0a(_0x4c0010[_0xc11b('0x81')][_0xc11b('0x78')]));}_0x17a27a=_0x44277c[_0xc11b('0x8e')]();_0x44277c['limit'](_0x44c0e3);_0x44277c[_0xc11b('0x1b')](0x0);return;}})[_0xc11b('0x21')](function(){if(_0x55f9ed[_0xc11b('0x8f')]==='web'){return null;}var _0x418d77=_[_0xc11b('0x3c')](_0x55f9ed,{'name':_0x55f9ed[_0xc11b('0x90')]||_0x55f9ed[_0xc11b('0x26')]||_0x4c0010['name'],'basename':_0x1e0b69,'savename':util[_0xc11b('0x76')](_0xc11b('0x91'),_0x55f9ed[_0xc11b('0x26')]||_0x4c0010['name'],require(_0xc11b('0x92'))['generate'](0x4),_0x55f9ed[_0xc11b('0x8f')]||_0xc11b('0x93')),'reportId':_0x4c0010['id'],'reportType':_0xc11b('0x94')});return db[_0xc11b('0x95')][_0xc11b('0x46')](_0x418d77,{'raw':!![]});})[_0xc11b('0x21')](function(_0x2e4a42){if(_0x4c0010[_0xc11b('0x71')]===_0xc11b('0x96')){_0x17a27a['where'](_0x4c0010['table']+_0xc11b('0x97'),_0x55f9ed['startDate'],_0x55f9ed[_0xc11b('0x98')]);}else{_0x17a27a[_0xc11b('0x3b')](_0x4c0010[_0xc11b('0x71')]+_0xc11b('0x99'),_0x55f9ed[_0xc11b('0x9a')],_0x55f9ed['endDate']);}if(_0x2e4a42){logger[_0xc11b('0x9b')]('Run\x20Query:',_0x17a27a[_0xc11b('0x85')]());require('child_process')[_0xc11b('0x9c')](path[_0xc11b('0x9d')](__dirname,_0xc11b('0x9e'),_0x2e4a42['output']),[_0x2e4a42['id'],_0x17a27a[_0xc11b('0x85')](),path['join'](__dirname,'../../files/reports',_0x2e4a42[_0xc11b('0x9f')]),_0x1e0b69]);return _0x2e4a42;}else{var _0x377329=squel[_0xc11b('0x6f')]();_0x377329[_0xc11b('0x70')]('('+_0x17a27a['toString']()+')',_0xc11b('0xa0'));_0x377329[_0xc11b('0x66')](_0xc11b('0xa1'),'count');_0x17a27a[_0xc11b('0x37')](_0x55f9ed[_0xc11b('0x37')]||_0x44c0e3);_0x17a27a[_0xc11b('0x1b')](_0x55f9ed['offset']||0x0);return dbH[_0xc11b('0x84')]['query'](_0x377329[_0xc11b('0x85')](),{'type':dbH[_0xc11b('0x84')][_0xc11b('0x86')][_0xc11b('0x87')]})[_0xc11b('0x21')](function(_0x4213d0){if(!_0x4213d0[_0xc11b('0x35')]){_0x18d117=0x0;}else{_0x18d117=_0x4213d0[0x0][_0xc11b('0x1a')]||0x0;}return dbH['sequelize'][_0xc11b('0x32')](_0x17a27a[_0xc11b('0x85')](),{'type':dbH['sequelize'][_0xc11b('0x86')][_0xc11b('0x87')]});})[_0xc11b('0x21')](function(_0x291250){return{'rows':_0x291250||[],'count':_0x18d117};});}});}exports[_0xc11b('0xa2')]=function(_0x59ee8a,_0x38590e){return runReport(_0x59ee8a[_0xc11b('0x44')],_0x59ee8a[_0xc11b('0x32')],_0x59ee8a[_0xc11b('0x3f')])[_0xc11b('0x21')](respondWithResult(_0x38590e,null))[_0xc11b('0x42')](handleError(_0x38590e,null));};exports['runReport']=runReport;exports[_0xc11b('0x32')]=function(_0x2e1dc8,_0x5828fe){var _0x2a1584=0xa;var _0x3d6b09=[_0xc11b('0x9d'),_0xc11b('0x88'),_0xc11b('0x52'),_0xc11b('0x53')];var _0x56f9e9={'SUM':'SUM(%s)','COUNT':_0xc11b('0x55'),'COUNT DISTINCT':_0xc11b('0x56'),'MAX':_0xc11b('0x57'),'MIN':_0xc11b('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc11b('0x89'),'GROUP_CONCAT ASC':_0xc11b('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x27f52b={'SEC_TO_TIME':_0xc11b('0x5c'),'DATE':_0xc11b('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xc11b('0x5e'),'UNIX_TIMESTAMP':_0xc11b('0x5f')};var _0x136cd5=function(_0x53ed62){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xc11b('0x62'),_0xc11b('0x63')],_0x53ed62);};var _0x5f0117=function(_0x2902f4){if(!_0x2902f4||!_0x2902f4[_0xc11b('0x64')][_0xc11b('0x35')]){return'';}for(var _0x538989='(',_0xcd6bee=0x0;_0xcd6bee<_0x2902f4['rules'][_0xc11b('0x35')];_0xcd6bee+=0x1){_0xcd6bee>0x0&&(_0x538989+='\x20'+_0x2902f4[_0xc11b('0x65')]+'\x20');_0x538989+=_0x2902f4[_0xc11b('0x64')][_0xcd6bee][_0xc11b('0x78')]?_0x5f0117(_0x2902f4[_0xc11b('0x64')][_0xcd6bee][_0xc11b('0x78')]):_0x2902f4[_0xc11b('0x64')][_0xcd6bee][_0xc11b('0x66')]+'\x20'+_0x2902f4[_0xc11b('0x64')][_0xcd6bee][_0xc11b('0x67')]+(_0x136cd5(_0x2902f4[_0xc11b('0x64')][_0xcd6bee]['condition'])?'\x20'+_0x2902f4[_0xc11b('0x64')][_0xcd6bee][_0xc11b('0x68')]:'');}return _0x538989+')';};var _0x1773cf={'where':{'id':_0x2e1dc8[_0xc11b('0x44')]['id']}},_0x5468f2,_0x2b248d,_0x314011,_0x5cabe8,_0x5b1e63;_0x1773cf=_[_0xc11b('0x3c')]({},_0x1773cf,_0x2e1dc8[_0xc11b('0x3f')]);return db['AnalyticCustomReport'][_0xc11b('0x4d')](_0x1773cf)[_0xc11b('0x21')](function(_0x22703c){if(_0x22703c){_0x5468f2=_0x22703c;return _0x22703c[_0xc11b('0x69')]();}return null;})[_0xc11b('0x21')](function(_0x24c20d){if(_0x24c20d){if(!_0x24c20d[_0xc11b('0x35')]){throw new db[(_0xc11b('0x6a'))][(_0xc11b('0x6b'))](_0xc11b('0x6c'),0x193);}_0x2b248d=_0x24c20d;return db[_0xc11b('0x6d')][_0xc11b('0x8c')]({'raw':!![]});}return null;})[_0xc11b('0x21')](function(_0x26277e){if(_0x26277e){_0x314011=_[_0xc11b('0x6e')](_0x26277e,'id');var _0x33669e;var _0x2b5ec6=squel[_0xc11b('0x6f')]();_0x2b5ec6[_0xc11b('0x70')](_0x5468f2['table']);for(var _0x59a99d=0x0;_0x59a99d<_0x2b248d[_0xc11b('0x35')];_0x59a99d+=0x1){_0x33669e=_0x2b248d[_0x59a99d][_0xc11b('0x72')]?_0x314011[_0x2b248d[_0x59a99d][_0xc11b('0x72')]]['metric']:_0x2b248d[_0x59a99d][_0xc11b('0x66')];_0x33669e=_0x2b248d[_0x59a99d][_0xc11b('0x74')]?_[_0xc11b('0x75')](_0x56f9e9[_0x2b248d[_0x59a99d][_0xc11b('0x74')]],'%s',_0x33669e):_0x33669e;_0x33669e=_0x2b248d[_0x59a99d][_0xc11b('0x76')]?_[_0xc11b('0x75')](_0x27f52b[_0x2b248d[_0x59a99d][_0xc11b('0x76')]],'%s',_0x33669e):_0x33669e;if(_0x2b248d[_0x59a99d][_0xc11b('0x77')]){_0x2b5ec6[_0xc11b('0x78')](_0x33669e);}_0x2b248d[_0x59a99d]['orderBy']&&_0x2b5ec6[_0xc11b('0x38')](_0x33669e,_0x2b248d[_0x59a99d]['orderBy']==='DESC'?![]:!![]);_0x2b5ec6[_0xc11b('0x66')](_0x33669e,_0x2b248d[_0x59a99d][_0xc11b('0x7a')]||_0x33669e);}if(_0x5468f2[_0xc11b('0x7b')]){_0x5468f2[_0xc11b('0x7b')]=JSON['parse'](_0x5468f2[_0xc11b('0x7b')]);for(var _0x172cdb=0x0;_0x172cdb<_0x5468f2[_0xc11b('0x7b')][_0xc11b('0x35')];_0x172cdb+=0x1){if(_0x5468f2[_0xc11b('0x7b')][_0x172cdb][_0xc11b('0x2d')]&&_['includes'](_0x3d6b09,_0x5468f2[_0xc11b('0x7b')][_0x172cdb][_0xc11b('0x2d')])&&_0x5468f2[_0xc11b('0x7b')][_0x172cdb][_0xc11b('0x7d')]&&_0x5468f2[_0xc11b('0x7b')][_0x172cdb][_0xc11b('0x7f')]&&_0x5468f2[_0xc11b('0x7b')][_0x172cdb]['foreignKey']){_0x2b5ec6[_0x5468f2[_0xc11b('0x7b')][_0x172cdb][_0xc11b('0x2d')]](_0x5468f2[_0xc11b('0x7b')][_0x172cdb][_0xc11b('0x7f')],null,util[_0xc11b('0x76')]('%s.%s\x20=\x20%s.%s',_0x5468f2[_0xc11b('0x71')],_0x5468f2['joins'][_0x172cdb]['parentKey'],_0x5468f2[_0xc11b('0x7b')][_0x172cdb][_0xc11b('0x7f')],_0x5468f2[_0xc11b('0x7b')][_0x172cdb][_0xc11b('0x7e')]));}}}if(_0x5468f2[_0xc11b('0x81')]){_0x5468f2[_0xc11b('0x81')]=JSON['parse'](_0x5468f2['conditions']);_0x2b5ec6[_0xc11b('0x3b')](_0x5f0117(_0x5468f2[_0xc11b('0x81')][_0xc11b('0x78')]));}_0x5b1e63=_0x2b5ec6['clone']();_0x2b5ec6['limit'](_0x2a1584);_0x2b5ec6[_0xc11b('0x1b')](0x0);logger[_0xc11b('0x82')]('Limited\x20Query:',_0x2b5ec6['toString']());return dbH[_0xc11b('0x84')][_0xc11b('0x32')](_0x2b5ec6['toString'](),{'type':dbH[_0xc11b('0x84')][_0xc11b('0x86')][_0xc11b('0x87')]});}})['then'](function(){return{'sql':_0x5b1e63[_0xc11b('0x85')]()};})[_0xc11b('0x21')](respondWithResult(_0x5828fe,null))['catch'](handleError(_0x5828fe,null));}; \ No newline at end of file +var _0xc24e=['Content-Range','apply','reject','save','then','get','CustomReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticCustomReport','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','Sequelize','ValidationErrorItem','findAll','keyBy','select','from','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20NULL','operator','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','function','output','web','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','MAX(%s)','IS\x20NOT\x20NULL','value','getFields','Limited\x20Query:','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit'];(function(_0x24074f,_0x3e1904){var _0x10aff6=function(_0x4dbbaa){while(--_0x4dbbaa){_0x24074f['push'](_0x24074f['shift']());}};_0x10aff6(++_0x3e1904);}(_0xc24e,0x1e0));var _0xec24=function(_0x380d6e,_0x1d1ad7){_0x380d6e=_0x380d6e-0x0;var _0x22117a=_0xc24e[_0x380d6e];return _0x22117a;};'use strict';var pdf=require(_0xec24('0x0'));var emlformat=require(_0xec24('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xec24('0x2'));var jsonpatch=require(_0xec24('0x3'));var rp=require(_0xec24('0x4'));var moment=require(_0xec24('0x5'));var BPromise=require(_0xec24('0x6'));var Mustache=require(_0xec24('0x7'));var util=require(_0xec24('0x8'));var path=require('path');var sox=require(_0xec24('0x9'));var csv=require(_0xec24('0xa'));var ejs=require(_0xec24('0xb'));var fs=require('fs');var fs_extra=require(_0xec24('0xc'));var _=require('lodash');var squel=require(_0xec24('0xd'));var crypto=require(_0xec24('0xe'));var jsforce=require(_0xec24('0xf'));var deskjs=require(_0xec24('0x10'));var toCsv=require(_0xec24('0xa'));var querystring=require(_0xec24('0x11'));var Papa=require('papaparse');var Redis=require(_0xec24('0x12'));var authService=require(_0xec24('0x13'));var qs=require(_0xec24('0x14'));var as=require(_0xec24('0x15'));var hardwareService=require(_0xec24('0x16'));var logger=require(_0xec24('0x17'))(_0xec24('0x18'));var utils=require(_0xec24('0x19'));var config=require(_0xec24('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xec24('0x1b'))[_0xec24('0x1c')];function respondWithStatusCode(_0x13b164,_0x190e79){_0x190e79=_0x190e79||0xcc;return function(_0x5b899b){if(_0x5b899b){return _0x13b164[_0xec24('0x1d')](_0x190e79);}return _0x13b164[_0xec24('0x1e')](_0x190e79)[_0xec24('0x1f')]();};}function respondWithResult(_0x929ea3,_0x47b011){_0x47b011=_0x47b011||0xc8;return function(_0x4d0350){if(_0x4d0350){return _0x929ea3['status'](_0x47b011)[_0xec24('0x20')](_0x4d0350);}};}function respondWithFilteredResult(_0x5cb223,_0x82a20c){return function(_0x11fb4d){if(_0x11fb4d){var _0x237dea=_0x11fb4d[_0xec24('0x21')],_0x386873=_0x82a20c['offset'],_0x3e286c=_0x82a20c[_0xec24('0x22')]+_0x82a20c[_0xec24('0x23')],_0x1edeb2;if(_0x3e286c>=_0x237dea){_0x3e286c=_0x237dea;_0x1edeb2=0xc8;}else{_0x1edeb2=0xce;}_0x5cb223[_0xec24('0x1e')](_0x1edeb2);return _0x5cb223['set'](_0xec24('0x24'),_0x386873+'-'+_0x3e286c+'/'+_0x237dea)[_0xec24('0x20')](_0x11fb4d);}return null;};}function patchUpdates(_0x5c3e2e){return function(_0x26d14e){try{jsonpatch[_0xec24('0x25')](_0x26d14e,_0x5c3e2e,!![]);}catch(_0x18da93){return BPromise[_0xec24('0x26')](_0x18da93);}return _0x26d14e[_0xec24('0x27')]();};}function saveUpdates(_0x33b66e,_0x3ea9fb){return function(_0x86c880){if(_0x86c880){return _0x86c880['update'](_0x33b66e)[_0xec24('0x28')](function(_0x48b25a){return _0x48b25a;});}return null;};}function removeEntity(_0x5cbee1,_0x11c4f9){return function(_0x306b5f){if(_0x306b5f){return _0x306b5f['destroy']()[_0xec24('0x28')](function(){var _0x54b578=_0x306b5f[_0xec24('0x29')]({'plain':!![]});var _0x58da9f=_0xec24('0x2a');return db[_0xec24('0x2b')][_0xec24('0x2c')]({'where':{'type':_0x58da9f,'resourceId':_0x54b578['id']}})[_0xec24('0x28')](function(){return _0x306b5f;});})[_0xec24('0x28')](function(){_0x5cbee1[_0xec24('0x1e')](0xcc)[_0xec24('0x1f')]();});}};}function handleEntityNotFound(_0x4c391c,_0x5e43a8){return function(_0x30ff1e){if(!_0x30ff1e){_0x4c391c[_0xec24('0x1d')](0x194);}return _0x30ff1e;};}function handleError(_0x544e82,_0x1eb5e3){_0x1eb5e3=_0x1eb5e3||0x1f4;return function(_0xec9069){logger[_0xec24('0x2d')](_0xec9069[_0xec24('0x2e')]);if(_0xec9069[_0xec24('0x2f')]){delete _0xec9069[_0xec24('0x2f')];}_0x544e82[_0xec24('0x1e')](_0x1eb5e3)[_0xec24('0x30')](_0xec9069);};}exports[_0xec24('0x31')]=function(_0x219cd3,_0x339ee4){var _0x17a5be={},_0x2e8fc8={},_0x3c93cf={'count':0x0,'rows':[]};var _0x4c18b2=_[_0xec24('0x32')](db[_0xec24('0x33')]['rawAttributes'],function(_0x29d85f){return{'name':_0x29d85f['fieldName'],'type':_0x29d85f['type']['key']};});_0x2e8fc8[_0xec24('0x34')]=_[_0xec24('0x32')](_0x4c18b2,'name');_0x2e8fc8[_0xec24('0x35')]=_[_0xec24('0x36')](_0x219cd3[_0xec24('0x35')]);_0x2e8fc8[_0xec24('0x37')]=_[_0xec24('0x38')](_0x2e8fc8[_0xec24('0x34')],_0x2e8fc8['query']);_0x17a5be[_0xec24('0x39')]=_[_0xec24('0x38')](_0x2e8fc8[_0xec24('0x34')],qs[_0xec24('0x3a')](_0x219cd3['query'][_0xec24('0x3a')]));_0x17a5be[_0xec24('0x39')]=_0x17a5be[_0xec24('0x39')][_0xec24('0x3b')]?_0x17a5be[_0xec24('0x39')]:_0x2e8fc8[_0xec24('0x34')];if(!_0x219cd3[_0xec24('0x35')][_0xec24('0x3c')](_0xec24('0x3d'))){_0x17a5be['limit']=qs[_0xec24('0x23')](_0x219cd3[_0xec24('0x35')][_0xec24('0x23')]);_0x17a5be[_0xec24('0x22')]=qs[_0xec24('0x22')](_0x219cd3[_0xec24('0x35')]['offset']);}_0x17a5be[_0xec24('0x3e')]=qs[_0xec24('0x3f')](_0x219cd3['query'][_0xec24('0x3f')]);_0x17a5be[_0xec24('0x40')]=qs[_0xec24('0x37')](_[_0xec24('0x41')](_0x219cd3[_0xec24('0x35')],_0x2e8fc8[_0xec24('0x37')]),_0x4c18b2);if(_0x219cd3[_0xec24('0x35')][_0xec24('0x42')]){_0x17a5be[_0xec24('0x40')]=_['merge'](_0x17a5be[_0xec24('0x40')],{'$or':_[_0xec24('0x32')](_0x4c18b2,function(_0x51b871){if(_0x51b871[_0xec24('0x43')]!==_0xec24('0x44')){var _0x4b39a4={};_0x4b39a4[_0x51b871['name']]={'$like':'%'+_0x219cd3[_0xec24('0x35')]['filter']+'%'};return _0x4b39a4;}})});}_0x17a5be=_['merge']({},_0x17a5be,_0x219cd3['options']);var _0x1a6050={'where':_0x17a5be['where']};return db[_0xec24('0x33')][_0xec24('0x21')](_0x1a6050)[_0xec24('0x28')](function(_0x4441d9){_0x3c93cf[_0xec24('0x21')]=_0x4441d9;if(_0x219cd3[_0xec24('0x35')][_0xec24('0x45')]){_0x17a5be[_0xec24('0x46')]=[{'all':!![]}];}return db[_0xec24('0x33')]['findAll'](_0x17a5be);})['then'](function(_0x312edc){_0x3c93cf['rows']=_0x312edc;return _0x3c93cf;})['then'](respondWithFilteredResult(_0x339ee4,_0x17a5be))[_0xec24('0x47')](handleError(_0x339ee4,null));};exports[_0xec24('0x48')]=function(_0x1d7667,_0x3d8764){var _0x4307d8={'raw':![],'where':{'id':_0x1d7667[_0xec24('0x49')]['id']}},_0x5ad14e={};_0x5ad14e[_0xec24('0x34')]=_[_0xec24('0x36')](db[_0xec24('0x33')][_0xec24('0x4a')]);_0x5ad14e[_0xec24('0x35')]=_[_0xec24('0x36')](_0x1d7667['query']);_0x5ad14e[_0xec24('0x37')]=_[_0xec24('0x38')](_0x5ad14e[_0xec24('0x34')],_0x5ad14e[_0xec24('0x35')]);_0x4307d8['attributes']=_[_0xec24('0x38')](_0x5ad14e['model'],qs[_0xec24('0x3a')](_0x1d7667['query'][_0xec24('0x3a')]));_0x4307d8[_0xec24('0x39')]=_0x4307d8[_0xec24('0x39')]['length']?_0x4307d8[_0xec24('0x39')]:_0x5ad14e[_0xec24('0x34')];if(_0x1d7667[_0xec24('0x35')]['includeAll']){_0x4307d8[_0xec24('0x46')]=[{'all':!![]}];}_0x4307d8=_[_0xec24('0x4b')]({},_0x4307d8,_0x1d7667[_0xec24('0x4c')]);return db['AnalyticCustomReport'][_0xec24('0x4d')](_0x4307d8)['then'](handleEntityNotFound(_0x3d8764,null))[_0xec24('0x28')](respondWithResult(_0x3d8764,null))[_0xec24('0x47')](handleError(_0x3d8764,null));};exports[_0xec24('0x4e')]=function(_0xa94db7,_0x19d3a1){return db[_0xec24('0x33')][_0xec24('0x4e')](_0xa94db7[_0xec24('0x4f')],{})['then'](function(_0x822543){var _0x12385e=_0xa94db7[_0xec24('0x50')][_0xec24('0x29')]({'plain':!![]});if(!_0x12385e)throw new Error(_0xec24('0x51'));if(_0x12385e[_0xec24('0x52')]==='user'){var _0xd59ba1=_0x822543[_0xec24('0x29')]({'plain':!![]});var _0x299f7c=_0xec24('0x53');return db[_0xec24('0x54')][_0xec24('0x4d')]({'where':{'name':_0x299f7c,'userProfileId':_0x12385e[_0xec24('0x55')]},'raw':!![]})['then'](function(_0x2fbcd5){if(_0x2fbcd5&&_0x2fbcd5[_0xec24('0x56')]===0x0){return db[_0xec24('0x2b')]['create']({'name':_0xd59ba1['name'],'resourceId':_0xd59ba1['id'],'type':_0xec24('0x2a'),'sectionId':_0x2fbcd5['id']},{})[_0xec24('0x28')](function(){return _0x822543;});}else{return _0x822543;}})[_0xec24('0x47')](function(_0x52776b){logger['error'](_0xec24('0x57'),_0x52776b);throw _0x52776b;});}return _0x822543;})[_0xec24('0x28')](respondWithResult(_0x19d3a1,0xc9))[_0xec24('0x47')](handleError(_0x19d3a1,null));};exports[_0xec24('0x58')]=function(_0x37c01d,_0x21ff8c){if(_0x37c01d['body']['id']){delete _0x37c01d[_0xec24('0x4f')]['id'];}return db[_0xec24('0x33')][_0xec24('0x4d')]({'where':{'id':_0x37c01d[_0xec24('0x49')]['id']}})['then'](handleEntityNotFound(_0x21ff8c,null))[_0xec24('0x28')](saveUpdates(_0x37c01d[_0xec24('0x4f')],null))['then'](respondWithResult(_0x21ff8c,null))[_0xec24('0x47')](handleError(_0x21ff8c,null));};exports[_0xec24('0x2c')]=function(_0x5c7199,_0x5ce6df){return db['AnalyticCustomReport'][_0xec24('0x4d')]({'where':{'id':_0x5c7199['params']['id']}})[_0xec24('0x28')](handleEntityNotFound(_0x5ce6df,null))['then'](removeEntity(_0x5ce6df,null))['catch'](handleError(_0x5ce6df,null));};exports['preview']=function(_0x1a44ff,_0x32e5ed){var _0x1aac23=0xa;var _0xf7ac1a=[_0xec24('0x59'),'left_join',_0xec24('0x5a'),_0xec24('0x5b')];var _0x48363c={'SUM':_0xec24('0x5c'),'COUNT':_0xec24('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xec24('0x5e'),'AVG':_0xec24('0x5f'),'GROUP_CONCAT':_0xec24('0x60'),'GROUP_CONCAT ASC':_0xec24('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x409c98={'SEC_TO_TIME':_0xec24('0x62'),'DATE':'DATE(%s)','HOUR':_0xec24('0x63'),'ROUND':_0xec24('0x64'),'UNIX_TIMESTAMP':_0xec24('0x65')};var _0x481956=function(_0x4a4f6e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xec24('0x66'),_0xec24('0x67')],_0x4a4f6e);};var _0x4af1ee=function(_0x5aa7d0){if(!_0x5aa7d0||!_0x5aa7d0[_0xec24('0x68')][_0xec24('0x3b')]){return'';}for(var _0x4d5d5d='(',_0x58173b=0x0;_0x58173b<_0x5aa7d0[_0xec24('0x68')][_0xec24('0x3b')];_0x58173b+=0x1){_0x58173b>0x0&&(_0x4d5d5d+='\x20'+_0x5aa7d0['operator']+'\x20');_0x4d5d5d+=_0x5aa7d0[_0xec24('0x68')][_0x58173b]['group']?_0x4af1ee(_0x5aa7d0[_0xec24('0x68')][_0x58173b][_0xec24('0x69')]):_0x5aa7d0['rules'][_0x58173b][_0xec24('0x6a')]+'\x20'+_0x5aa7d0[_0xec24('0x68')][_0x58173b][_0xec24('0x6b')]+(_0x481956(_0x5aa7d0[_0xec24('0x68')][_0x58173b]['condition'])?'\x20'+_0x5aa7d0[_0xec24('0x68')][_0x58173b]['value']:'');}return _0x4d5d5d+')';};var _0x7b141f={'where':{'id':_0x1a44ff[_0xec24('0x49')]['id']}},_0x54bb27,_0x26b7b0,_0x219915,_0x47814b,_0x2e51b8;_0x7b141f=_['merge']({},_0x7b141f,_0x1a44ff[_0xec24('0x4c')]);return db[_0xec24('0x33')][_0xec24('0x4d')](_0x7b141f)[_0xec24('0x28')](function(_0x2c8fd0){if(_0x2c8fd0){_0x54bb27=_0x2c8fd0;return _0x2c8fd0['getFields']();}return null;})[_0xec24('0x28')](function(_0x1c2388){if(_0x1c2388){if(!_0x1c2388[_0xec24('0x3b')]){throw new db[(_0xec24('0x6c'))][(_0xec24('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x26b7b0=_0x1c2388;return db['AnalyticMetric'][_0xec24('0x6e')]({'raw':!![]});}return null;})[_0xec24('0x28')](function(_0x273f14){if(_0x273f14){_0x219915=_[_0xec24('0x6f')](_0x273f14,'id');var _0x489eb2;var _0x3ad86f=squel[_0xec24('0x70')]();_0x3ad86f[_0xec24('0x71')](_0x54bb27[_0xec24('0x72')]);for(var _0x47f83e=0x0;_0x47f83e<_0x26b7b0['length'];_0x47f83e+=0x1){_0x489eb2=_0x26b7b0[_0x47f83e][_0xec24('0x73')]?_0x219915[_0x26b7b0[_0x47f83e][_0xec24('0x73')]][_0xec24('0x74')]:_0x26b7b0[_0x47f83e][_0xec24('0x6a')];_0x489eb2=_0x26b7b0[_0x47f83e]['function']?_[_0xec24('0x75')](_0x48363c[_0x26b7b0[_0x47f83e]['function']],'%s',_0x489eb2):_0x489eb2;_0x489eb2=_0x26b7b0[_0x47f83e][_0xec24('0x76')]?_[_0xec24('0x75')](_0x409c98[_0x26b7b0[_0x47f83e]['format']],'%s',_0x489eb2):_0x489eb2;if(_0x26b7b0[_0x47f83e][_0xec24('0x77')]){_0x3ad86f[_0xec24('0x69')](_0x489eb2);}_0x26b7b0[_0x47f83e][_0xec24('0x78')]&&_0x3ad86f[_0xec24('0x3e')](_0x489eb2,_0x26b7b0[_0x47f83e][_0xec24('0x78')]===_0xec24('0x79')?![]:!![]);_0x3ad86f[_0xec24('0x6a')](_0x489eb2,_0x26b7b0[_0x47f83e][_0xec24('0x7a')]||_0x489eb2);}if(_0x54bb27[_0xec24('0x7b')]){_0x54bb27[_0xec24('0x7b')]=JSON[_0xec24('0x7c')](_0x54bb27[_0xec24('0x7b')]);for(var _0x1307c8=0x0;_0x1307c8<_0x54bb27[_0xec24('0x7b')][_0xec24('0x3b')];_0x1307c8+=0x1){if(_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x43')]&&_[_0xec24('0x7d')](_0xf7ac1a,_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x43')])&&_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x7e')]&&_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x7f')]&&_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x80')]){_0x3ad86f[_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x43')]](_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x7f')],null,util[_0xec24('0x76')](_0xec24('0x81'),_0x54bb27[_0xec24('0x72')],_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x7e')],_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x7f')],_0x54bb27[_0xec24('0x7b')][_0x1307c8][_0xec24('0x80')]));}}}if(_0x54bb27[_0xec24('0x82')]){_0x54bb27[_0xec24('0x82')]=JSON[_0xec24('0x7c')](_0x54bb27['conditions']);_0x3ad86f[_0xec24('0x40')](_0x4af1ee(_0x54bb27['conditions']['group']));}_0x2e51b8=_0x3ad86f[_0xec24('0x83')]();_0x3ad86f['limit'](_0x1aac23);_0x3ad86f[_0xec24('0x22')](0x0);logger[_0xec24('0x84')]('Limited\x20Query:',_0x3ad86f[_0xec24('0x85')]());return dbH[_0xec24('0x86')][_0xec24('0x35')](_0x3ad86f['toString'](),{'type':dbH[_0xec24('0x86')][_0xec24('0x87')][_0xec24('0x88')]});}})[_0xec24('0x28')](respondWithResult(_0x32e5ed,null))[_0xec24('0x47')](handleError(_0x32e5ed,null));};function runReport(_0x1dbf89,_0x5608fe,_0x38e88d){var _0x1bb616=_0x5608fe[_0xec24('0x2f')];var _0x38f770=0xa;var _0x55f348=[_0xec24('0x59'),_0xec24('0x89'),_0xec24('0x5a'),'cross_join'];var _0x590c5d={'SUM':_0xec24('0x5c'),'COUNT':_0xec24('0x5d'),'COUNT DISTINCT':_0xec24('0x8a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xec24('0x5f'),'GROUP_CONCAT':_0xec24('0x60'),'GROUP_CONCAT ASC':_0xec24('0x61'),'GROUP_CONCAT DESC':_0xec24('0x8b')};var _0x58a399={'SEC_TO_TIME':_0xec24('0x62'),'DATE':_0xec24('0x8c'),'HOUR':_0xec24('0x63'),'ROUND':_0xec24('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2bd50d=function(_0x377048){return!_[_0xec24('0x7d')]([_0xec24('0x8d'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xec24('0x67')],_0x377048);};var _0x253060=function(_0x3b4324){if(!_0x3b4324||!_0x3b4324[_0xec24('0x68')]['length']){return'';}for(var _0x49dbf7='(',_0x2308a9=0x0;_0x2308a9<_0x3b4324['rules'][_0xec24('0x3b')];_0x2308a9+=0x1){_0x2308a9>0x0&&(_0x49dbf7+='\x20'+_0x3b4324[_0xec24('0x8e')]+'\x20');_0x49dbf7+=_0x3b4324[_0xec24('0x68')][_0x2308a9][_0xec24('0x69')]?_0x253060(_0x3b4324['rules'][_0x2308a9][_0xec24('0x69')]):_0x3b4324[_0xec24('0x68')][_0x2308a9][_0xec24('0x6a')]+'\x20'+_0x3b4324['rules'][_0x2308a9]['condition']+(_0x2bd50d(_0x3b4324[_0xec24('0x68')][_0x2308a9]['condition'])?'\x20'+_0x3b4324['rules'][_0x2308a9]['value']:'');}return _0x49dbf7+')';};var _0x10484f={'where':{'id':_0x1dbf89['id']}},_0x356a90,_0x55cc30,_0x55e185,_0x529068,_0x1838c7;_0x10484f=_[_0xec24('0x4b')]({},_0x10484f,_0x38e88d);return db['AnalyticCustomReport'][_0xec24('0x4d')](_0x10484f)[_0xec24('0x28')](function(_0x2d3b4e){if(_0x2d3b4e){_0x356a90=_0x2d3b4e;return _0x2d3b4e['getFields']();}return null;})[_0xec24('0x28')](function(_0x365c37){if(_0x365c37){if(!_0x365c37[_0xec24('0x3b')]){throw new db[(_0xec24('0x6c'))][(_0xec24('0x6d'))](_0xec24('0x8f'),0x193);}_0x55cc30=_0x365c37;return db[_0xec24('0x90')][_0xec24('0x6e')]({'raw':!![]});}return null;})['then'](function(_0x2fc1e7){if(_0x2fc1e7){_0x55e185=_['keyBy'](_0x2fc1e7,'id');var _0x4c97b8;var _0x182167=squel[_0xec24('0x70')]();_0x182167['from'](_0x356a90[_0xec24('0x72')]);for(var _0x569814=0x0;_0x569814<_0x55cc30[_0xec24('0x3b')];_0x569814+=0x1){_0x4c97b8=_0x55cc30[_0x569814][_0xec24('0x73')]?_0x55e185[_0x55cc30[_0x569814][_0xec24('0x73')]][_0xec24('0x74')]:_0x55cc30[_0x569814][_0xec24('0x6a')];_0x4c97b8=_0x55cc30[_0x569814][_0xec24('0x91')]?_['replace'](_0x590c5d[_0x55cc30[_0x569814][_0xec24('0x91')]],'%s',_0x4c97b8):_0x4c97b8;_0x4c97b8=_0x55cc30[_0x569814][_0xec24('0x76')]?_[_0xec24('0x75')](_0x58a399[_0x55cc30[_0x569814][_0xec24('0x76')]],'%s',_0x4c97b8):_0x4c97b8;if(_0x55cc30[_0x569814][_0xec24('0x77')]){_0x182167[_0xec24('0x69')](_0x4c97b8);}_0x55cc30[_0x569814][_0xec24('0x78')]&&_0x182167[_0xec24('0x3e')](_0x4c97b8,_0x55cc30[_0x569814]['orderBy']===_0xec24('0x79')?![]:!![]);_0x182167[_0xec24('0x6a')](_0x4c97b8,_0x55cc30[_0x569814]['alias']||_0x4c97b8);}if(_0x356a90[_0xec24('0x7b')]){_0x356a90['joins']=JSON[_0xec24('0x7c')](_0x356a90[_0xec24('0x7b')]);for(var _0x2eb308=0x0;_0x2eb308<_0x356a90[_0xec24('0x7b')][_0xec24('0x3b')];_0x2eb308+=0x1){if(_0x356a90['joins'][_0x2eb308]['type']&&_[_0xec24('0x7d')](_0x55f348,_0x356a90['joins'][_0x2eb308][_0xec24('0x43')])&&_0x356a90[_0xec24('0x7b')][_0x2eb308][_0xec24('0x7e')]&&_0x356a90[_0xec24('0x7b')][_0x2eb308][_0xec24('0x7f')]&&_0x356a90['joins'][_0x2eb308]['foreignKey']){_0x182167[_0x356a90[_0xec24('0x7b')][_0x2eb308][_0xec24('0x43')]](_0x356a90[_0xec24('0x7b')][_0x2eb308][_0xec24('0x7f')],null,util['format'](_0xec24('0x81'),_0x356a90[_0xec24('0x72')],_0x356a90['joins'][_0x2eb308][_0xec24('0x7e')],_0x356a90[_0xec24('0x7b')][_0x2eb308][_0xec24('0x7f')],_0x356a90[_0xec24('0x7b')][_0x2eb308][_0xec24('0x80')]));}}}if(_0x356a90[_0xec24('0x82')]){_0x356a90[_0xec24('0x82')]=JSON[_0xec24('0x7c')](_0x356a90[_0xec24('0x82')]);_0x182167[_0xec24('0x40')](_0x253060(_0x356a90[_0xec24('0x82')][_0xec24('0x69')]));}_0x1838c7=_0x182167['clone']();_0x182167[_0xec24('0x23')](_0x38f770);_0x182167[_0xec24('0x22')](0x0);return;}})['then'](function(){if(_0x5608fe[_0xec24('0x92')]===_0xec24('0x93')){return null;}var _0x4df109=_[_0xec24('0x4b')](_0x5608fe,{'name':_0x5608fe['fullPath']||_0x5608fe[_0xec24('0x2f')]||_0x356a90[_0xec24('0x2f')],'basename':_0x1bb616,'savename':util[_0xec24('0x76')](_0xec24('0x94'),_0x5608fe[_0xec24('0x2f')]||_0x356a90['name'],require(_0xec24('0x95'))['generate'](0x4),_0x5608fe[_0xec24('0x92')]||_0xec24('0x96')),'reportId':_0x356a90['id'],'reportType':_0xec24('0x97')});return db['AnalyticExtractedReport']['create'](_0x4df109,{'raw':!![]});})['then'](function(_0x4f1173){if(_0x356a90[_0xec24('0x72')]===_0xec24('0x98')){_0x1838c7[_0xec24('0x40')](_0x356a90[_0xec24('0x72')]+_0xec24('0x99'),_0x5608fe[_0xec24('0x9a')],_0x5608fe[_0xec24('0x9b')]);}else{_0x1838c7[_0xec24('0x40')](_0x356a90[_0xec24('0x72')]+_0xec24('0x9c'),_0x5608fe[_0xec24('0x9a')],_0x5608fe[_0xec24('0x9b')]);}if(_0x4f1173){logger[_0xec24('0x9d')](_0xec24('0x9e'),_0x1838c7[_0xec24('0x85')]());require(_0xec24('0x9f'))[_0xec24('0xa0')](path[_0xec24('0x59')](__dirname,_0xec24('0xa1'),_0x4f1173[_0xec24('0x92')]),[_0x4f1173['id'],_0x1838c7[_0xec24('0x85')](),path[_0xec24('0x59')](__dirname,_0xec24('0xa2'),_0x4f1173[_0xec24('0xa3')]),_0x1bb616]);return _0x4f1173;}else{var _0x5c8a29=squel[_0xec24('0x70')]();_0x5c8a29[_0xec24('0x71')]('('+_0x1838c7[_0xec24('0x85')]()+')',_0xec24('0xa4'));_0x5c8a29['field'](_0xec24('0xa5'),_0xec24('0x21'));_0x1838c7[_0xec24('0x23')](_0x5608fe[_0xec24('0x23')]||_0x38f770);_0x1838c7['offset'](_0x5608fe[_0xec24('0x22')]||0x0);return dbH['sequelize']['query'](_0x5c8a29[_0xec24('0x85')](),{'type':dbH[_0xec24('0x86')]['QueryTypes'][_0xec24('0x88')]})[_0xec24('0x28')](function(_0x5335b4){if(!_0x5335b4['length']){_0x529068=0x0;}else{_0x529068=_0x5335b4[0x0][_0xec24('0x21')]||0x0;}return dbH[_0xec24('0x86')][_0xec24('0x35')](_0x1838c7[_0xec24('0x85')](),{'type':dbH[_0xec24('0x86')][_0xec24('0x87')][_0xec24('0x88')]});})[_0xec24('0x28')](function(_0xfe5430){return{'rows':_0xfe5430||[],'count':_0x529068};});}});}exports[_0xec24('0xa6')]=function(_0x57bdaf,_0x4cbe3f){return runReport(_0x57bdaf['params'],_0x57bdaf[_0xec24('0x35')],_0x57bdaf[_0xec24('0x4c')])[_0xec24('0x28')](respondWithResult(_0x4cbe3f,null))['catch'](handleError(_0x4cbe3f,null));};exports['runReport']=runReport;exports['query']=function(_0x52aa2a,_0x2b4276){var _0x15865b=0xa;var _0xf469c=[_0xec24('0x59'),_0xec24('0x89'),_0xec24('0x5a'),_0xec24('0x5b')];var _0x238878={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xec24('0xa7'),'MIN':'MIN(%s)','AVG':_0xec24('0x5f'),'GROUP_CONCAT':_0xec24('0x60'),'GROUP_CONCAT ASC':_0xec24('0x61'),'GROUP_CONCAT DESC':_0xec24('0x8b')};var _0x438c82={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xec24('0x8c'),'HOUR':_0xec24('0x63'),'ROUND':_0xec24('0x64'),'UNIX_TIMESTAMP':_0xec24('0x65')};var _0x498d73=function(_0x16092f){return!_[_0xec24('0x7d')]([_0xec24('0x8d'),_0xec24('0xa8'),'IS\x20EMPTY',_0xec24('0x67')],_0x16092f);};var _0x79f53e=function(_0x194ef3){if(!_0x194ef3||!_0x194ef3[_0xec24('0x68')]['length']){return'';}for(var _0x29dddd='(',_0x1660ee=0x0;_0x1660ee<_0x194ef3[_0xec24('0x68')][_0xec24('0x3b')];_0x1660ee+=0x1){_0x1660ee>0x0&&(_0x29dddd+='\x20'+_0x194ef3[_0xec24('0x8e')]+'\x20');_0x29dddd+=_0x194ef3[_0xec24('0x68')][_0x1660ee]['group']?_0x79f53e(_0x194ef3[_0xec24('0x68')][_0x1660ee][_0xec24('0x69')]):_0x194ef3[_0xec24('0x68')][_0x1660ee][_0xec24('0x6a')]+'\x20'+_0x194ef3['rules'][_0x1660ee]['condition']+(_0x498d73(_0x194ef3[_0xec24('0x68')][_0x1660ee][_0xec24('0x6b')])?'\x20'+_0x194ef3[_0xec24('0x68')][_0x1660ee][_0xec24('0xa9')]:'');}return _0x29dddd+')';};var _0xfa5e={'where':{'id':_0x52aa2a[_0xec24('0x49')]['id']}},_0x46b974,_0x20faa9,_0x3d5c0e,_0x16946e,_0xd1e50a;_0xfa5e=_[_0xec24('0x4b')]({},_0xfa5e,_0x52aa2a['options']);return db[_0xec24('0x33')][_0xec24('0x4d')](_0xfa5e)['then'](function(_0xf2d877){if(_0xf2d877){_0x46b974=_0xf2d877;return _0xf2d877[_0xec24('0xaa')]();}return null;})[_0xec24('0x28')](function(_0x2fb886){if(_0x2fb886){if(!_0x2fb886['length']){throw new db[(_0xec24('0x6c'))]['ValidationErrorItem'](_0xec24('0x8f'),0x193);}_0x20faa9=_0x2fb886;return db['AnalyticMetric'][_0xec24('0x6e')]({'raw':!![]});}return null;})['then'](function(_0x324d2e){if(_0x324d2e){_0x3d5c0e=_['keyBy'](_0x324d2e,'id');var _0x4edb9f;var _0x356733=squel[_0xec24('0x70')]();_0x356733[_0xec24('0x71')](_0x46b974[_0xec24('0x72')]);for(var _0x55b4f6=0x0;_0x55b4f6<_0x20faa9[_0xec24('0x3b')];_0x55b4f6+=0x1){_0x4edb9f=_0x20faa9[_0x55b4f6][_0xec24('0x73')]?_0x3d5c0e[_0x20faa9[_0x55b4f6][_0xec24('0x73')]][_0xec24('0x74')]:_0x20faa9[_0x55b4f6][_0xec24('0x6a')];_0x4edb9f=_0x20faa9[_0x55b4f6][_0xec24('0x91')]?_['replace'](_0x238878[_0x20faa9[_0x55b4f6][_0xec24('0x91')]],'%s',_0x4edb9f):_0x4edb9f;_0x4edb9f=_0x20faa9[_0x55b4f6]['format']?_[_0xec24('0x75')](_0x438c82[_0x20faa9[_0x55b4f6]['format']],'%s',_0x4edb9f):_0x4edb9f;if(_0x20faa9[_0x55b4f6][_0xec24('0x77')]){_0x356733[_0xec24('0x69')](_0x4edb9f);}_0x20faa9[_0x55b4f6][_0xec24('0x78')]&&_0x356733[_0xec24('0x3e')](_0x4edb9f,_0x20faa9[_0x55b4f6][_0xec24('0x78')]===_0xec24('0x79')?![]:!![]);_0x356733[_0xec24('0x6a')](_0x4edb9f,_0x20faa9[_0x55b4f6]['alias']||_0x4edb9f);}if(_0x46b974[_0xec24('0x7b')]){_0x46b974['joins']=JSON[_0xec24('0x7c')](_0x46b974[_0xec24('0x7b')]);for(var _0x440182=0x0;_0x440182<_0x46b974['joins'][_0xec24('0x3b')];_0x440182+=0x1){if(_0x46b974[_0xec24('0x7b')][_0x440182][_0xec24('0x43')]&&_[_0xec24('0x7d')](_0xf469c,_0x46b974[_0xec24('0x7b')][_0x440182][_0xec24('0x43')])&&_0x46b974[_0xec24('0x7b')][_0x440182][_0xec24('0x7e')]&&_0x46b974[_0xec24('0x7b')][_0x440182][_0xec24('0x7f')]&&_0x46b974['joins'][_0x440182][_0xec24('0x80')]){_0x356733[_0x46b974[_0xec24('0x7b')][_0x440182][_0xec24('0x43')]](_0x46b974['joins'][_0x440182][_0xec24('0x7f')],null,util[_0xec24('0x76')]('%s.%s\x20=\x20%s.%s',_0x46b974['table'],_0x46b974[_0xec24('0x7b')][_0x440182]['parentKey'],_0x46b974[_0xec24('0x7b')][_0x440182]['foreignTable'],_0x46b974[_0xec24('0x7b')][_0x440182][_0xec24('0x80')]));}}}if(_0x46b974['conditions']){_0x46b974[_0xec24('0x82')]=JSON[_0xec24('0x7c')](_0x46b974[_0xec24('0x82')]);_0x356733[_0xec24('0x40')](_0x79f53e(_0x46b974['conditions'][_0xec24('0x69')]));}_0xd1e50a=_0x356733[_0xec24('0x83')]();_0x356733[_0xec24('0x23')](_0x15865b);_0x356733[_0xec24('0x22')](0x0);logger['debug'](_0xec24('0xab'),_0x356733['toString']());return dbH[_0xec24('0x86')][_0xec24('0x35')](_0x356733[_0xec24('0x85')](),{'type':dbH[_0xec24('0x86')][_0xec24('0x87')][_0xec24('0x88')]});}})['then'](function(){return{'sql':_0xd1e50a[_0xec24('0x85')]()};})[_0xec24('0x28')](respondWithResult(_0x2b4276,null))[_0xec24('0x47')](handleError(_0x2b4276,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 6b6ac68..acec0e7 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 _0xb722=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','lodash','util','api'];(function(_0x13b71c,_0x30d59d){var _0x1e3a4a=function(_0x44d6ba){while(--_0x44d6ba){_0x13b71c['push'](_0x13b71c['shift']());}};_0x1e3a4a(++_0x30d59d);}(_0xb722,0x1a1));var _0x2b72=function(_0x39cfeb,_0x224ead){_0x39cfeb=_0x39cfeb-0x0;var _0x410a64=_0xb722[_0x39cfeb];return _0x410a64;};'use strict';var _=require(_0x2b72('0x0'));var util=require(_0x2b72('0x1'));var logger=require('../../config/logger')(_0x2b72('0x2'));var moment=require(_0x2b72('0x3'));var BPromise=require(_0x2b72('0x4'));var rp=require(_0x2b72('0x5'));var fs=require('fs');var path=require(_0x2b72('0x6'));var rimraf=require(_0x2b72('0x7'));var config=require(_0x2b72('0x8'));var attributes=require(_0x2b72('0x9'));module['exports']=function(_0x303551,_0x366546){return _0x303551['define'](_0x2b72('0xa'),attributes,{'tableName':_0x2b72('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcac9=['request-promise','rimraf','../../config/environment','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5535c5,_0x219011){var _0x1352ec=function(_0x5d80f9){while(--_0x5d80f9){_0x5535c5['push'](_0x5535c5['shift']());}};_0x1352ec(++_0x219011);}(_0xcac9,0x162));var _0x9cac=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xcac9[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x9cac('0x0'));var util=require(_0x9cac('0x1'));var logger=require(_0x9cac('0x2'))(_0x9cac('0x3'));var moment=require(_0x9cac('0x4'));var BPromise=require(_0x9cac('0x5'));var rp=require(_0x9cac('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cac('0x7'));var config=require(_0x9cac('0x8'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x10e3f6,_0x2756b8){return _0x10e3f6[_0x9cac('0x9')](_0x9cac('0xa'),attributes,{'tableName':_0x9cac('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 252471c..657c71e 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 _0x0a67=['code','message','result','catch','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x0a67,0x76));var _0x70a6=function(_0x5c90ee,_0x4aec43){_0x5c90ee=_0x5c90ee-0x0;var _0x36671d=_0x0a67[_0x5c90ee];return _0x36671d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x70a6('0x0'));var rs=require(_0x70a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70a6('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70a6('0x3'));var config=require(_0x70a6('0x4'));var jayson=require(_0x70a6('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d5e03,_0x37d738,_0x12c100){return new BPromise(function(_0x5e281f,_0x1468ca){return client[_0x70a6('0x6')](_0x1d5e03,_0x12c100)[_0x70a6('0x7')](function(_0x2528c2){logger[_0x70a6('0x8')](_0x70a6('0x9'),_0x37d738,_0x70a6('0xa'));logger[_0x70a6('0xb')](_0x70a6('0xc'),_0x37d738,'request\x20sent',JSON[_0x70a6('0xd')](_0x2528c2));if(_0x2528c2['error']){if(_0x2528c2[_0x70a6('0xe')][_0x70a6('0xf')]===0x1f4){logger[_0x70a6('0xe')](_0x70a6('0x9'),_0x37d738,_0x2528c2[_0x70a6('0xe')]['message']);return _0x1468ca(_0x2528c2['error'][_0x70a6('0x10')]);}logger[_0x70a6('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x37d738,_0x2528c2[_0x70a6('0xe')]['message']);return _0x5e281f(_0x2528c2[_0x70a6('0xe')][_0x70a6('0x10')]);}else{logger[_0x70a6('0x8')](_0x70a6('0x9'),_0x37d738,_0x70a6('0xa'));_0x5e281f(_0x2528c2[_0x70a6('0x11')][_0x70a6('0x10')]);}})[_0x70a6('0x12')](function(_0x2f00a8){logger[_0x70a6('0xe')](_0x70a6('0x9'),_0x37d738,_0x2f00a8);_0x1468ca(_0x2f00a8);});});} \ No newline at end of file +var _0xc290=['../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring'];(function(_0x2b1ed2,_0x3135af){var _0x19e098=function(_0x32456a){while(--_0x32456a){_0x2b1ed2['push'](_0x2b1ed2['shift']());}};_0x19e098(++_0x3135af);}(_0xc290,0x18c));var _0x0c29=function(_0x2bbdc4,_0x2cb88e){_0x2bbdc4=_0x2bbdc4-0x0;var _0x482d0c=_0xc290[_0x2bbdc4];return _0x482d0c;};'use strict';var _=require(_0x0c29('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0c29('0x1'));var rs=require(_0x0c29('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0c29('0x3'))(_0x0c29('0x4'));var config=require('../../config/environment');var jayson=require(_0x0c29('0x5'));var client=jayson['client'][_0x0c29('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4323cf,_0x1ad5dc,_0x222f42){return new BPromise(function(_0x3d4c50,_0x310566){return client[_0x0c29('0x7')](_0x4323cf,_0x222f42)[_0x0c29('0x8')](function(_0x5e43b4){logger[_0x0c29('0x9')](_0x0c29('0xa'),_0x1ad5dc,'request\x20sent');logger['debug'](_0x0c29('0xb'),_0x1ad5dc,_0x0c29('0xc'),JSON[_0x0c29('0xd')](_0x5e43b4));if(_0x5e43b4['error']){if(_0x5e43b4[_0x0c29('0xe')][_0x0c29('0xf')]===0x1f4){logger['error'](_0x0c29('0xa'),_0x1ad5dc,_0x5e43b4[_0x0c29('0xe')][_0x0c29('0x10')]);return _0x310566(_0x5e43b4[_0x0c29('0xe')][_0x0c29('0x10')]);}logger[_0x0c29('0xe')](_0x0c29('0xa'),_0x1ad5dc,_0x5e43b4[_0x0c29('0xe')][_0x0c29('0x10')]);return _0x3d4c50(_0x5e43b4['error'][_0x0c29('0x10')]);}else{logger['info'](_0x0c29('0xa'),_0x1ad5dc,_0x0c29('0xc'));_0x3d4c50(_0x5e43b4[_0x0c29('0x11')]['message']);}})[_0x0c29('0x12')](function(_0x3ceed1){logger['error'](_0x0c29('0xa'),_0x1ad5dc,_0x3ceed1);_0x310566(_0x3ceed1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b18059e..8387240 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 _0xdf62=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','run','/:id/query','query','post','create','put','/:id','update','destroy'];(function(_0x44206a,_0x3ead85){var _0x483f11=function(_0x239516){while(--_0x239516){_0x44206a['push'](_0x44206a['shift']());}};_0x483f11(++_0x3ead85);}(_0xdf62,0x151));var _0x2df6=function(_0x39a952,_0x17df77){_0x39a952=_0x39a952-0x0;var _0x249b08=_0xdf62[_0x39a952];return _0x249b08;};'use strict';var multer=require(_0x2df6('0x0'));var util=require(_0x2df6('0x1'));var path=require(_0x2df6('0x2'));var timeout=require(_0x2df6('0x3'));var express=require(_0x2df6('0x4'));var router=express[_0x2df6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2df6('0x6'));var config=require(_0x2df6('0x7'));var controller=require(_0x2df6('0x8'));router[_0x2df6('0x9')]('/',auth[_0x2df6('0xa')](),controller[_0x2df6('0xb')]);router[_0x2df6('0x9')]('/:id',auth[_0x2df6('0xa')](),controller['show']);router[_0x2df6('0x9')](_0x2df6('0xc'),auth[_0x2df6('0xa')](),controller[_0x2df6('0xd')]);router['get']('/:id/run',auth[_0x2df6('0xa')](),controller[_0x2df6('0xe')]);router[_0x2df6('0x9')](_0x2df6('0xf'),auth['isAuthenticated'](),controller[_0x2df6('0x10')]);router[_0x2df6('0x11')]('/',auth['isAuthenticated'](),controller[_0x2df6('0x12')]);router[_0x2df6('0x13')](_0x2df6('0x14'),auth[_0x2df6('0xa')](),controller[_0x2df6('0x15')]);router['delete'](_0x2df6('0x14'),auth[_0x2df6('0xa')](),controller[_0x2df6('0x16')]);module[_0x2df6('0x17')]=router; \ No newline at end of file +var _0x3024=['../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','preview','/:id/run','run','/:id/query','post','create','delete','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x3024,0x64));var _0x4302=function(_0x106219,_0x538109){_0x106219=_0x106219-0x0;var _0x5c6b78=_0x3024[_0x106219];return _0x5c6b78;};'use strict';var multer=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var path=require('path');var timeout=require(_0x4302('0x2'));var express=require(_0x4302('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4302('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4302('0x5'));var controller=require(_0x4302('0x6'));router['get']('/',auth[_0x4302('0x7')](),controller[_0x4302('0x8')]);router['get'](_0x4302('0x9'),auth[_0x4302('0x7')](),controller[_0x4302('0xa')]);router[_0x4302('0xb')](_0x4302('0xc'),auth[_0x4302('0x7')](),controller[_0x4302('0xd')]);router['get'](_0x4302('0xe'),auth[_0x4302('0x7')](),controller[_0x4302('0xf')]);router['get'](_0x4302('0x10'),auth[_0x4302('0x7')](),controller['query']);router[_0x4302('0x11')]('/',auth[_0x4302('0x7')](),controller[_0x4302('0x12')]);router['put'](_0x4302('0x9'),auth[_0x4302('0x7')](),controller['update']);router[_0x4302('0x13')](_0x4302('0x9'),auth[_0x4302('0x7')](),controller['destroy']);module[_0x4302('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c6e3856..7809994 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 _0xb2fb=['sequelize','exports','STRING','TEXT'];(function(_0x21b626,_0x48ad36){var _0x37c1de=function(_0x5226db){while(--_0x5226db){_0x21b626['push'](_0x21b626['shift']());}};_0x37c1de(++_0x48ad36);}(_0xb2fb,0x18c));var _0xbb2f=function(_0x33f794,_0x3018dd){_0x33f794=_0x33f794-0x0;var _0x3491a3=_0xb2fb[_0x33f794];return _0x3491a3;};'use strict';var Sequelize=require(_0xbb2f('0x0'));module[_0xbb2f('0x1')]={'name':{'type':Sequelize[_0xbb2f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbb2f('0x2')]},'parent':{'type':Sequelize[_0xbb2f('0x2')]},'table':{'type':Sequelize[_0xbb2f('0x2')]},'conditions':{'type':Sequelize[_0xbb2f('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6323=['STRING'];(function(_0x159c3a,_0x24253f){var _0x437e12=function(_0x3dfdfe){while(--_0x3dfdfe){_0x159c3a['push'](_0x159c3a['shift']());}};_0x437e12(++_0x24253f);}(_0x6323,0xf2));var _0x3632=function(_0x382c8b,_0x252d26){_0x382c8b=_0x382c8b-0x0;var _0x4df03f=_0x6323[_0x382c8b];return _0x4df03f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3632('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x3632('0x0')]},'parent':{'type':Sequelize[_0x3632('0x0')]},'table':{'type':Sequelize[_0x3632('0x0')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 73c2ad8..63131bc 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 _0x1e82=['../../mysqldb','dbH','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','run','runReport','SUM(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x253e1f,_0xd247f0){var _0x1adb58=function(_0x523236){while(--_0x523236){_0x253e1f['push'](_0x253e1f['shift']());}};_0x1adb58(++_0xd247f0);}(_0x1e82,0x8b));var _0x21e8=function(_0x4a4e61,_0x17e2de){_0x4a4e61=_0x4a4e61-0x0;var _0x3b8859=_0x1e82[_0x4a4e61];return _0x3b8859;};'use strict';var pdf=require(_0x21e8('0x0'));var emlformat=require(_0x21e8('0x1'));var rimraf=require(_0x21e8('0x2'));var zipdir=require(_0x21e8('0x3'));var jsonpatch=require(_0x21e8('0x4'));var rp=require(_0x21e8('0x5'));var moment=require('moment');var BPromise=require(_0x21e8('0x6'));var Mustache=require(_0x21e8('0x7'));var util=require('util');var path=require(_0x21e8('0x8'));var sox=require('sox');var csv=require(_0x21e8('0x9'));var ejs=require(_0x21e8('0xa'));var fs=require('fs');var fs_extra=require(_0x21e8('0xb'));var _=require(_0x21e8('0xc'));var squel=require('squel');var crypto=require(_0x21e8('0xd'));var jsforce=require(_0x21e8('0xe'));var deskjs=require(_0x21e8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x21e8('0x10'));var Papa=require(_0x21e8('0x11'));var Redis=require(_0x21e8('0x12'));var authService=require(_0x21e8('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21e8('0x14'));var logger=require('../../config/logger')(_0x21e8('0x15'));var utils=require(_0x21e8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x21e8('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x21e8('0x18'))[_0x21e8('0x19')];function respondWithStatusCode(_0x16a877,_0x4eb523){_0x4eb523=_0x4eb523||0xcc;return function(_0x217605){if(_0x217605){return _0x16a877['sendStatus'](_0x4eb523);}return _0x16a877[_0x21e8('0x1a')](_0x4eb523)[_0x21e8('0x1b')]();};}function respondWithResult(_0x158da6,_0x4e3e29){_0x4e3e29=_0x4e3e29||0xc8;return function(_0x4ee658){if(_0x4ee658){return _0x158da6[_0x21e8('0x1a')](_0x4e3e29)[_0x21e8('0x1c')](_0x4ee658);}};}function respondWithFilteredResult(_0x2b6ad6,_0x18915a){return function(_0x1697d4){if(_0x1697d4){var _0x13da4f=_0x1697d4['count'],_0x29d932=_0x18915a[_0x21e8('0x1d')],_0x2f66f1=_0x18915a['offset']+_0x18915a['limit'],_0x1a8a5a;if(_0x2f66f1>=_0x13da4f){_0x2f66f1=_0x13da4f;_0x1a8a5a=0xc8;}else{_0x1a8a5a=0xce;}_0x2b6ad6[_0x21e8('0x1a')](_0x1a8a5a);return _0x2b6ad6[_0x21e8('0x1e')](_0x21e8('0x1f'),_0x29d932+'-'+_0x2f66f1+'/'+_0x13da4f)[_0x21e8('0x1c')](_0x1697d4);}return null;};}function patchUpdates(_0x5ca78c){return function(_0x45243f){try{jsonpatch[_0x21e8('0x20')](_0x45243f,_0x5ca78c,!![]);}catch(_0x25b678){return BPromise[_0x21e8('0x21')](_0x25b678);}return _0x45243f[_0x21e8('0x22')]();};}function saveUpdates(_0x12a935,_0x3426d1){return function(_0x31501c){if(_0x31501c){return _0x31501c['update'](_0x12a935)[_0x21e8('0x23')](function(_0x34937f){return _0x34937f;});}return null;};}function removeEntity(_0x48b116,_0x1df978){return function(_0x402f0f){if(_0x402f0f){return _0x402f0f[_0x21e8('0x24')]()[_0x21e8('0x23')](function(){var _0x2a4a59=_0x402f0f[_0x21e8('0x25')]({'plain':!![]});var _0x1e5819=_0x21e8('0x26');return db['UserProfileResource'][_0x21e8('0x24')]({'where':{'type':_0x1e5819,'resourceId':_0x2a4a59['id']}})['then'](function(){return _0x402f0f;});})[_0x21e8('0x23')](function(){_0x48b116[_0x21e8('0x1a')](0xcc)[_0x21e8('0x1b')]();});}};}function handleEntityNotFound(_0x559509,_0x1bdd15){return function(_0x526e32){if(!_0x526e32){_0x559509[_0x21e8('0x27')](0x194);}return _0x526e32;};}function handleError(_0x1876da,_0x6de0b2){_0x6de0b2=_0x6de0b2||0x1f4;return function(_0x4e7b45){logger[_0x21e8('0x28')](_0x4e7b45[_0x21e8('0x29')]);if(_0x4e7b45[_0x21e8('0x2a')]){delete _0x4e7b45['name'];}_0x1876da[_0x21e8('0x1a')](_0x6de0b2)[_0x21e8('0x2b')](_0x4e7b45);};}exports[_0x21e8('0x2c')]=function(_0x62da08,_0x1c58e2){var _0x304f00={},_0x2116f2={},_0x3339b6={'count':0x0,'rows':[]};var _0x20d095=_[_0x21e8('0x2d')](db[_0x21e8('0x2e')][_0x21e8('0x2f')],function(_0x484f5b){return{'name':_0x484f5b[_0x21e8('0x30')],'type':_0x484f5b[_0x21e8('0x31')]['key']};});_0x2116f2['model']=_['map'](_0x20d095,_0x21e8('0x2a'));_0x2116f2['query']=_[_0x21e8('0x32')](_0x62da08[_0x21e8('0x33')]);_0x2116f2[_0x21e8('0x34')]=_[_0x21e8('0x35')](_0x2116f2['model'],_0x2116f2['query']);_0x304f00[_0x21e8('0x36')]=_['intersection'](_0x2116f2[_0x21e8('0x37')],qs[_0x21e8('0x38')](_0x62da08[_0x21e8('0x33')][_0x21e8('0x38')]));_0x304f00['attributes']=_0x304f00[_0x21e8('0x36')][_0x21e8('0x39')]?_0x304f00[_0x21e8('0x36')]:_0x2116f2[_0x21e8('0x37')];if(!_0x62da08[_0x21e8('0x33')]['hasOwnProperty'](_0x21e8('0x3a'))){_0x304f00[_0x21e8('0x3b')]=qs[_0x21e8('0x3b')](_0x62da08[_0x21e8('0x33')][_0x21e8('0x3b')]);_0x304f00[_0x21e8('0x1d')]=qs[_0x21e8('0x1d')](_0x62da08[_0x21e8('0x33')][_0x21e8('0x1d')]);}_0x304f00[_0x21e8('0x3c')]=qs[_0x21e8('0x3d')](_0x62da08[_0x21e8('0x33')][_0x21e8('0x3d')]);_0x304f00[_0x21e8('0x3e')]=qs[_0x21e8('0x34')](_['pick'](_0x62da08[_0x21e8('0x33')],_0x2116f2[_0x21e8('0x34')]),_0x20d095);if(_0x62da08[_0x21e8('0x33')][_0x21e8('0x3f')]){_0x304f00[_0x21e8('0x3e')]=_[_0x21e8('0x40')](_0x304f00[_0x21e8('0x3e')],{'$or':_[_0x21e8('0x2d')](_0x20d095,function(_0x801fcc){if(_0x801fcc[_0x21e8('0x31')]!=='VIRTUAL'){var _0x297dbd={};_0x297dbd[_0x801fcc['name']]={'$like':'%'+_0x62da08[_0x21e8('0x33')][_0x21e8('0x3f')]+'%'};return _0x297dbd;}})});}_0x304f00=_['merge']({},_0x304f00,_0x62da08[_0x21e8('0x41')]);var _0x2f7dc5={'where':_0x304f00[_0x21e8('0x3e')]};return db[_0x21e8('0x2e')][_0x21e8('0x42')](_0x2f7dc5)['then'](function(_0x4dc953){_0x3339b6[_0x21e8('0x42')]=_0x4dc953;if(_0x62da08[_0x21e8('0x33')][_0x21e8('0x43')]){_0x304f00[_0x21e8('0x44')]=[{'all':!![]}];}return db[_0x21e8('0x2e')][_0x21e8('0x45')](_0x304f00);})[_0x21e8('0x23')](function(_0x4d47a3){_0x3339b6[_0x21e8('0x46')]=_0x4d47a3;return _0x3339b6;})['then'](respondWithFilteredResult(_0x1c58e2,_0x304f00))[_0x21e8('0x47')](handleError(_0x1c58e2,null));};exports[_0x21e8('0x48')]=function(_0x1aee55,_0x1132f9){var _0x415fc8={'raw':!![],'where':{'id':_0x1aee55[_0x21e8('0x49')]['id']}},_0x218845={};_0x218845[_0x21e8('0x37')]=_[_0x21e8('0x32')](db[_0x21e8('0x2e')]['rawAttributes']);_0x218845[_0x21e8('0x33')]=_[_0x21e8('0x32')](_0x1aee55[_0x21e8('0x33')]);_0x218845['filters']=_[_0x21e8('0x35')](_0x218845[_0x21e8('0x37')],_0x218845[_0x21e8('0x33')]);_0x415fc8['attributes']=_['intersection'](_0x218845[_0x21e8('0x37')],qs['fields'](_0x1aee55['query']['fields']));_0x415fc8[_0x21e8('0x36')]=_0x415fc8[_0x21e8('0x36')][_0x21e8('0x39')]?_0x415fc8[_0x21e8('0x36')]:_0x218845[_0x21e8('0x37')];if(_0x1aee55[_0x21e8('0x33')][_0x21e8('0x43')]){_0x415fc8[_0x21e8('0x44')]=[{'all':!![]}];}_0x415fc8=_[_0x21e8('0x40')]({},_0x415fc8,_0x1aee55['options']);return db[_0x21e8('0x2e')][_0x21e8('0x4a')](_0x415fc8)[_0x21e8('0x23')](handleEntityNotFound(_0x1132f9,null))[_0x21e8('0x23')](respondWithResult(_0x1132f9,null))['catch'](handleError(_0x1132f9,null));};exports[_0x21e8('0x4b')]=function(_0x5dbe75,_0x39e4bf){return db[_0x21e8('0x2e')]['create'](_0x5dbe75[_0x21e8('0x4c')],{})[_0x21e8('0x23')](function(_0x1833ff){var _0x4ee241=_0x5dbe75['user'][_0x21e8('0x25')]({'plain':!![]});if(!_0x4ee241)throw new Error(_0x21e8('0x4d'));if(_0x4ee241[_0x21e8('0x4e')]===_0x21e8('0x4f')){var _0x51dd44=_0x1833ff['get']({'plain':!![]});var _0x540be9=_0x21e8('0x50');return db[_0x21e8('0x51')]['find']({'where':{'name':_0x540be9,'userProfileId':_0x4ee241[_0x21e8('0x52')]},'raw':!![]})[_0x21e8('0x23')](function(_0x44e757){if(_0x44e757&&_0x44e757[_0x21e8('0x53')]===0x0){return db[_0x21e8('0x54')][_0x21e8('0x4b')]({'name':_0x51dd44['name'],'resourceId':_0x51dd44['id'],'type':_0x21e8('0x26'),'sectionId':_0x44e757['id']},{})[_0x21e8('0x23')](function(){return _0x1833ff;});}else{return _0x1833ff;}})[_0x21e8('0x47')](function(_0x317389){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x317389);throw _0x317389;});}return _0x1833ff;})[_0x21e8('0x23')](respondWithResult(_0x39e4bf,0xc9))['catch'](handleError(_0x39e4bf,null));};exports[_0x21e8('0x55')]=function(_0x2ba157,_0x446577){if(_0x2ba157[_0x21e8('0x4c')]['id']){delete _0x2ba157[_0x21e8('0x4c')]['id'];}return db[_0x21e8('0x2e')]['find']({'where':{'id':_0x2ba157['params']['id']}})['then'](handleEntityNotFound(_0x446577,null))['then'](saveUpdates(_0x2ba157[_0x21e8('0x4c')],null))[_0x21e8('0x23')](respondWithResult(_0x446577,null))[_0x21e8('0x47')](handleError(_0x446577,null));};exports[_0x21e8('0x24')]=function(_0x2f7561,_0x56d2e3){return db['AnalyticDefaultReport'][_0x21e8('0x4a')]({'where':{'id':_0x2f7561[_0x21e8('0x49')]['id']}})[_0x21e8('0x23')](handleEntityNotFound(_0x56d2e3,null))[_0x21e8('0x23')](removeEntity(_0x56d2e3,null))['catch'](handleError(_0x56d2e3,null));};exports[_0x21e8('0x56')]=function(_0x27a8e7,_0x124404){var _0x11d27e=0xa;var _0x316802=[_0x21e8('0x57'),'left_join',_0x21e8('0x58'),_0x21e8('0x59')];var _0x3b7119={'SUM':'SUM(%s)','COUNT':_0x21e8('0x5a'),'COUNT DISTINCT':_0x21e8('0x5b'),'MAX':'MAX(%s)','MIN':_0x21e8('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x21e8('0x5d'),'GROUP_CONCAT DESC':_0x21e8('0x5e')};var _0x1c591f={'SEC_TO_TIME':_0x21e8('0x5f'),'DATE':_0x21e8('0x60'),'HOUR':_0x21e8('0x61'),'ROUND':_0x21e8('0x62'),'UNIX_TIMESTAMP':_0x21e8('0x63')};var _0x43c211=function(_0x3371cf){return!_['includes']([_0x21e8('0x64'),_0x21e8('0x65'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x3371cf);};var _0x22bd50=function(_0x13df1c){if(!_0x13df1c||!_0x13df1c[_0x21e8('0x66')][_0x21e8('0x39')]){return'';}for(var _0x104f68='(',_0x10e95a=0x0;_0x10e95a<_0x13df1c[_0x21e8('0x66')][_0x21e8('0x39')];_0x10e95a+=0x1){_0x10e95a>0x0&&(_0x104f68+='\x20'+_0x13df1c['operator']+'\x20');_0x104f68+=_0x13df1c[_0x21e8('0x66')][_0x10e95a][_0x21e8('0x67')]?_0x22bd50(_0x13df1c[_0x21e8('0x66')][_0x10e95a][_0x21e8('0x67')]):_0x13df1c[_0x21e8('0x66')][_0x10e95a][_0x21e8('0x68')]+'\x20'+_0x13df1c[_0x21e8('0x66')][_0x10e95a]['condition']+(_0x43c211(_0x13df1c[_0x21e8('0x66')][_0x10e95a][_0x21e8('0x69')])?'\x20'+_0x13df1c[_0x21e8('0x66')][_0x10e95a][_0x21e8('0x6a')]:'');}return _0x104f68+')';};var _0x4d5dce={'where':{'id':_0x27a8e7[_0x21e8('0x49')]['id']}},_0x4e90b6,_0xd16287,_0x1ca3d6,_0x152cad,_0x38aac9;_0x4d5dce=_[_0x21e8('0x40')]({},_0x4d5dce,_0x27a8e7[_0x21e8('0x41')]);return db[_0x21e8('0x2e')]['find'](_0x4d5dce)[_0x21e8('0x23')](function(_0x2cc4f0){if(_0x2cc4f0){_0x4e90b6=_0x2cc4f0;return _0x2cc4f0['getFields']();}return null;})[_0x21e8('0x23')](function(_0x24c3ab){if(_0x24c3ab){if(!_0x24c3ab['length']){throw new db[(_0x21e8('0x6b'))][(_0x21e8('0x6c'))](_0x21e8('0x6d'),0x193);}_0xd16287=_0x24c3ab;return db[_0x21e8('0x6e')][_0x21e8('0x45')]({'raw':!![]});}return null;})[_0x21e8('0x23')](function(_0x394a79){if(_0x394a79){_0x1ca3d6=_[_0x21e8('0x6f')](_0x394a79,'id');var _0x2c6733;var _0x824bba=squel[_0x21e8('0x70')]();_0x824bba[_0x21e8('0x71')](_0x4e90b6[_0x21e8('0x72')]);for(var _0x30730a=0x0;_0x30730a<_0xd16287['length'];_0x30730a+=0x1){_0x2c6733=_0xd16287[_0x30730a][_0x21e8('0x73')]?_0x1ca3d6[_0xd16287[_0x30730a][_0x21e8('0x73')]]['metric']:_0xd16287[_0x30730a][_0x21e8('0x68')];_0x2c6733=_0xd16287[_0x30730a][_0x21e8('0x74')]?_['replace'](_0x3b7119[_0xd16287[_0x30730a][_0x21e8('0x74')]],'%s',_0x2c6733):_0x2c6733;_0x2c6733=_0xd16287[_0x30730a][_0x21e8('0x75')]?_[_0x21e8('0x76')](_0x1c591f[_0xd16287[_0x30730a]['format']],'%s',_0x2c6733):_0x2c6733;if(_0xd16287[_0x30730a][_0x21e8('0x77')]){_0x824bba[_0x21e8('0x67')](_0x2c6733);}_0xd16287[_0x30730a][_0x21e8('0x78')]&&_0x824bba[_0x21e8('0x3c')](_0x2c6733,_0xd16287[_0x30730a]['orderBy']===_0x21e8('0x79')?![]:!![]);_0x824bba[_0x21e8('0x68')](_0x2c6733,_0xd16287[_0x30730a][_0x21e8('0x7a')]||_0x2c6733);}if(_0x4e90b6['joins']){_0x4e90b6[_0x21e8('0x7b')]=JSON[_0x21e8('0x7c')](_0x4e90b6[_0x21e8('0x7b')]);for(var _0x18741f=0x0;_0x18741f<_0x4e90b6[_0x21e8('0x7b')]['length'];_0x18741f+=0x1){if(_0x4e90b6[_0x21e8('0x7b')][_0x18741f][_0x21e8('0x31')]&&_['includes'](_0x316802,_0x4e90b6['joins'][_0x18741f][_0x21e8('0x31')])&&_0x4e90b6[_0x21e8('0x7b')][_0x18741f][_0x21e8('0x7d')]&&_0x4e90b6[_0x21e8('0x7b')][_0x18741f][_0x21e8('0x7e')]&&_0x4e90b6['joins'][_0x18741f][_0x21e8('0x7f')]){_0x824bba[_0x4e90b6[_0x21e8('0x7b')][_0x18741f]['type']](_0x4e90b6[_0x21e8('0x7b')][_0x18741f][_0x21e8('0x7e')],null,util[_0x21e8('0x75')](_0x21e8('0x80'),_0x4e90b6['table'],_0x4e90b6[_0x21e8('0x7b')][_0x18741f][_0x21e8('0x7d')],_0x4e90b6[_0x21e8('0x7b')][_0x18741f][_0x21e8('0x7e')],_0x4e90b6[_0x21e8('0x7b')][_0x18741f]['foreignKey']));}}}if(_0x4e90b6['conditions']){_0x4e90b6[_0x21e8('0x81')]=JSON[_0x21e8('0x7c')](_0x4e90b6[_0x21e8('0x81')]);_0x824bba[_0x21e8('0x3e')](_0x22bd50(_0x4e90b6['conditions']['group']));}_0x38aac9=_0x824bba[_0x21e8('0x82')]();_0x824bba[_0x21e8('0x3b')](_0x11d27e);_0x824bba[_0x21e8('0x1d')](0x0);logger[_0x21e8('0x83')](_0x21e8('0x84'),_0x824bba[_0x21e8('0x85')]());return dbH['sequelize']['query'](_0x824bba[_0x21e8('0x85')](),{'type':dbH[_0x21e8('0x86')][_0x21e8('0x87')][_0x21e8('0x88')]});}})[_0x21e8('0x23')](respondWithResult(_0x124404,null))[_0x21e8('0x47')](handleError(_0x124404,null));};function runReport(_0x4967f1,_0x491596,_0x2bbe16){var _0x441c88=_0x491596[_0x21e8('0x2a')];var _0x1ffd4f=0xa;var _0x1fa20e=[_0x21e8('0x57'),_0x21e8('0x89'),_0x21e8('0x58'),'cross_join'];var _0x1144ae={'SUM':'SUM(%s)','COUNT':_0x21e8('0x5a'),'COUNT DISTINCT':_0x21e8('0x5b'),'MAX':_0x21e8('0x8a'),'MIN':_0x21e8('0x5c'),'AVG':_0x21e8('0x8b'),'GROUP_CONCAT':_0x21e8('0x8c'),'GROUP_CONCAT ASC':_0x21e8('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2251ca={'SEC_TO_TIME':_0x21e8('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x21e8('0x62'),'UNIX_TIMESTAMP':_0x21e8('0x63')};var _0x184177=function(_0x547880){return!_[_0x21e8('0x8d')]([_0x21e8('0x64'),'IS\x20NOT\x20NULL',_0x21e8('0x8e'),_0x21e8('0x8f')],_0x547880);};var _0x33012e=function(_0x53b4df){if(!_0x53b4df||!_0x53b4df[_0x21e8('0x66')][_0x21e8('0x39')]){return'';}for(var _0x525fa0='(',_0x426cdd=0x0;_0x426cdd<_0x53b4df[_0x21e8('0x66')][_0x21e8('0x39')];_0x426cdd+=0x1){_0x426cdd>0x0&&(_0x525fa0+='\x20'+_0x53b4df['operator']+'\x20');_0x525fa0+=_0x53b4df[_0x21e8('0x66')][_0x426cdd]['group']?_0x33012e(_0x53b4df['rules'][_0x426cdd][_0x21e8('0x67')]):_0x53b4df[_0x21e8('0x66')][_0x426cdd]['field']+'\x20'+_0x53b4df[_0x21e8('0x66')][_0x426cdd]['condition']+(_0x184177(_0x53b4df['rules'][_0x426cdd][_0x21e8('0x69')])?'\x20'+_0x53b4df['rules'][_0x426cdd][_0x21e8('0x6a')]:'');}return _0x525fa0+')';};var _0x2f52f5={'where':{'id':_0x4967f1['id']}},_0x5c066c,_0x742181,_0xd747e9,_0x4effce,_0x3710af;_0x2f52f5=_['merge']({},_0x2f52f5,_0x2bbe16);return db[_0x21e8('0x2e')][_0x21e8('0x4a')](_0x2f52f5)[_0x21e8('0x23')](function(_0x5fc83f){if(_0x5fc83f){_0x5c066c=_0x5fc83f;return _0x5fc83f['getFields']();}return null;})[_0x21e8('0x23')](function(_0x41d81f){if(_0x41d81f){if(!_0x41d81f['length']){throw new db['Sequelize'][(_0x21e8('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x742181=_0x41d81f;return db[_0x21e8('0x6e')][_0x21e8('0x45')]({'raw':!![]});}return null;})[_0x21e8('0x23')](function(_0x3e50fb){if(_0x3e50fb){_0xd747e9=_[_0x21e8('0x6f')](_0x3e50fb,'id');var _0x3133a7;var _0x1f643d=squel[_0x21e8('0x70')]();_0x1f643d['from'](_0x5c066c[_0x21e8('0x72')]);for(var _0x1f0838=0x0;_0x1f0838<_0x742181[_0x21e8('0x39')];_0x1f0838+=0x1){_0x3133a7=_0x742181[_0x1f0838][_0x21e8('0x73')]?_0xd747e9[_0x742181[_0x1f0838][_0x21e8('0x73')]]['metric']:_0x742181[_0x1f0838][_0x21e8('0x68')];_0x3133a7=_0x742181[_0x1f0838][_0x21e8('0x74')]?_[_0x21e8('0x76')](_0x1144ae[_0x742181[_0x1f0838]['function']],'%s',_0x3133a7):_0x3133a7;_0x3133a7=_0x742181[_0x1f0838]['format']?_['replace'](_0x2251ca[_0x742181[_0x1f0838][_0x21e8('0x75')]],'%s',_0x3133a7):_0x3133a7;if(_0x742181[_0x1f0838][_0x21e8('0x77')]){_0x1f643d['group'](_0x3133a7);}_0x742181[_0x1f0838][_0x21e8('0x78')]&&_0x1f643d[_0x21e8('0x3c')](_0x3133a7,_0x742181[_0x1f0838][_0x21e8('0x78')]===_0x21e8('0x79')?![]:!![]);_0x1f643d['field'](_0x3133a7,_0x742181[_0x1f0838]['alias']||_0x3133a7);}if(_0x5c066c[_0x21e8('0x7b')]){_0x5c066c[_0x21e8('0x7b')]=JSON[_0x21e8('0x7c')](_0x5c066c[_0x21e8('0x7b')]);for(var _0x506867=0x0;_0x506867<_0x5c066c['joins'][_0x21e8('0x39')];_0x506867+=0x1){if(_0x5c066c[_0x21e8('0x7b')][_0x506867][_0x21e8('0x31')]&&_['includes'](_0x1fa20e,_0x5c066c['joins'][_0x506867]['type'])&&_0x5c066c[_0x21e8('0x7b')][_0x506867][_0x21e8('0x7d')]&&_0x5c066c[_0x21e8('0x7b')][_0x506867][_0x21e8('0x7e')]&&_0x5c066c[_0x21e8('0x7b')][_0x506867][_0x21e8('0x7f')]){_0x1f643d[_0x5c066c[_0x21e8('0x7b')][_0x506867][_0x21e8('0x31')]](_0x5c066c[_0x21e8('0x7b')][_0x506867][_0x21e8('0x7e')],null,util['format'](_0x21e8('0x80'),_0x5c066c[_0x21e8('0x72')],_0x5c066c[_0x21e8('0x7b')][_0x506867][_0x21e8('0x7d')],_0x5c066c[_0x21e8('0x7b')][_0x506867][_0x21e8('0x7e')],_0x5c066c['joins'][_0x506867][_0x21e8('0x7f')]));}}}if(_0x5c066c[_0x21e8('0x81')]){_0x5c066c[_0x21e8('0x81')]=JSON[_0x21e8('0x7c')](_0x5c066c['conditions']);_0x1f643d[_0x21e8('0x3e')](_0x33012e(_0x5c066c[_0x21e8('0x81')][_0x21e8('0x67')]));}_0x3710af=_0x1f643d[_0x21e8('0x82')]();_0x1f643d['limit'](_0x1ffd4f);_0x1f643d[_0x21e8('0x1d')](0x0);return;}})[_0x21e8('0x23')](function(){if(_0x491596['output']==='web'){return null;}var _0x215ba1=_['merge'](_0x491596,{'name':_0x491596[_0x21e8('0x90')]||_0x491596[_0x21e8('0x2a')]||_0x5c066c['name'],'basename':_0x441c88,'savename':util[_0x21e8('0x75')](_0x21e8('0x91'),_0x491596['name']||_0x5c066c[_0x21e8('0x2a')],require('randomstring')[_0x21e8('0x92')](0x4),_0x491596[_0x21e8('0x93')]||_0x21e8('0x94')),'reportId':_0x5c066c['id'],'reportType':'default'});return db[_0x21e8('0x95')][_0x21e8('0x4b')](_0x215ba1,{'raw':!![]});})[_0x21e8('0x23')](function(_0x5bcf61){if(_0x5c066c[_0x21e8('0x72')]==='cdr'){_0x3710af[_0x21e8('0x3e')](_0x5c066c[_0x21e8('0x72')]+_0x21e8('0x96'),_0x491596['startDate'],_0x491596[_0x21e8('0x97')]);}else{_0x3710af[_0x21e8('0x3e')](_0x5c066c[_0x21e8('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x491596[_0x21e8('0x98')],_0x491596['endDate']);}if(_0x5bcf61){logger[_0x21e8('0x99')](_0x21e8('0x9a'),_0x3710af['toString']());require(_0x21e8('0x9b'))['fork'](path['join'](__dirname,_0x21e8('0x9c'),_0x5bcf61[_0x21e8('0x93')]),[_0x5bcf61['id'],_0x3710af[_0x21e8('0x85')](),path[_0x21e8('0x57')](__dirname,_0x21e8('0x9d'),_0x5bcf61[_0x21e8('0x9e')]),_0x441c88]);return _0x5bcf61;}else{var _0x3e6545=squel['select']();_0x3e6545['from']('('+_0x3710af['toString']()+')',_0x21e8('0x9f'));_0x3e6545[_0x21e8('0x68')]('COUNT(*)',_0x21e8('0x42'));_0x3710af['limit'](_0x491596[_0x21e8('0x3b')]||_0x1ffd4f);_0x3710af[_0x21e8('0x1d')](_0x491596[_0x21e8('0x1d')]||0x0);return dbH[_0x21e8('0x86')][_0x21e8('0x33')](_0x3e6545[_0x21e8('0x85')](),{'type':dbH[_0x21e8('0x86')][_0x21e8('0x87')]['SELECT']})[_0x21e8('0x23')](function(_0x247191){if(!_0x247191['length']){_0x4effce=0x0;}else{_0x4effce=_0x247191[0x0][_0x21e8('0x42')]||0x0;}return dbH[_0x21e8('0x86')]['query'](_0x3710af[_0x21e8('0x85')](),{'type':dbH[_0x21e8('0x86')]['QueryTypes'][_0x21e8('0x88')]});})[_0x21e8('0x23')](function(_0x243461){return{'rows':_0x243461||[],'count':_0x4effce};});}});}exports[_0x21e8('0xa0')]=function(_0x121781,_0xd09f76){return runReport(_0x121781[_0x21e8('0x49')],_0x121781[_0x21e8('0x33')],_0x121781['options'])[_0x21e8('0x23')](respondWithResult(_0xd09f76,null))[_0x21e8('0x47')](handleError(_0xd09f76,null));};exports[_0x21e8('0xa1')]=runReport;exports[_0x21e8('0x33')]=function(_0x5c359a,_0x18cefe){var _0xf8e541=0xa;var _0x3afd16=['join',_0x21e8('0x89'),'right_join',_0x21e8('0x59')];var _0x4aa9ef={'SUM':_0x21e8('0xa2'),'COUNT':_0x21e8('0x5a'),'COUNT DISTINCT':_0x21e8('0x5b'),'MAX':'MAX(%s)','MIN':_0x21e8('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x21e8('0x8c'),'GROUP_CONCAT ASC':_0x21e8('0x5d'),'GROUP_CONCAT DESC':_0x21e8('0x5e')};var _0x325a0d={'SEC_TO_TIME':_0x21e8('0x5f'),'DATE':_0x21e8('0x60'),'HOUR':_0x21e8('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x21e8('0x63')};var _0x242e04=function(_0x372938){return!_[_0x21e8('0x8d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x21e8('0x8e'),_0x21e8('0x8f')],_0x372938);};var _0x130caa=function(_0x498699){if(!_0x498699||!_0x498699[_0x21e8('0x66')][_0x21e8('0x39')]){return'';}for(var _0x4bd433='(',_0x2326fc=0x0;_0x2326fc<_0x498699[_0x21e8('0x66')][_0x21e8('0x39')];_0x2326fc+=0x1){_0x2326fc>0x0&&(_0x4bd433+='\x20'+_0x498699['operator']+'\x20');_0x4bd433+=_0x498699['rules'][_0x2326fc]['group']?_0x130caa(_0x498699[_0x21e8('0x66')][_0x2326fc][_0x21e8('0x67')]):_0x498699['rules'][_0x2326fc]['field']+'\x20'+_0x498699['rules'][_0x2326fc][_0x21e8('0x69')]+(_0x242e04(_0x498699[_0x21e8('0x66')][_0x2326fc][_0x21e8('0x69')])?'\x20'+_0x498699['rules'][_0x2326fc]['value']:'');}return _0x4bd433+')';};var _0x2c499e={'where':{'id':_0x5c359a['params']['id']}},_0x3f44d0,_0x48eb3e,_0x497e66,_0x1111a0,_0xbf6538;_0x2c499e=_[_0x21e8('0x40')]({},_0x2c499e,_0x5c359a[_0x21e8('0x41')]);return db[_0x21e8('0x2e')][_0x21e8('0x4a')](_0x2c499e)[_0x21e8('0x23')](function(_0x46a18b){if(_0x46a18b){_0x3f44d0=_0x46a18b;return _0x46a18b['getFields']();}return null;})[_0x21e8('0x23')](function(_0x12421){if(_0x12421){if(!_0x12421[_0x21e8('0x39')]){throw new db[(_0x21e8('0x6b'))][(_0x21e8('0x6c'))](_0x21e8('0x6d'),0x193);}_0x48eb3e=_0x12421;return db[_0x21e8('0x6e')][_0x21e8('0x45')]({'raw':!![]});}return null;})[_0x21e8('0x23')](function(_0x1a36da){if(_0x1a36da){_0x497e66=_[_0x21e8('0x6f')](_0x1a36da,'id');var _0x303298;var _0x1c4821=squel[_0x21e8('0x70')]();_0x1c4821[_0x21e8('0x71')](_0x3f44d0[_0x21e8('0x72')]);for(var _0x51f4a7=0x0;_0x51f4a7<_0x48eb3e['length'];_0x51f4a7+=0x1){_0x303298=_0x48eb3e[_0x51f4a7]['MetricId']?_0x497e66[_0x48eb3e[_0x51f4a7][_0x21e8('0x73')]]['metric']:_0x48eb3e[_0x51f4a7][_0x21e8('0x68')];_0x303298=_0x48eb3e[_0x51f4a7]['function']?_['replace'](_0x4aa9ef[_0x48eb3e[_0x51f4a7][_0x21e8('0x74')]],'%s',_0x303298):_0x303298;_0x303298=_0x48eb3e[_0x51f4a7]['format']?_[_0x21e8('0x76')](_0x325a0d[_0x48eb3e[_0x51f4a7]['format']],'%s',_0x303298):_0x303298;if(_0x48eb3e[_0x51f4a7][_0x21e8('0x77')]){_0x1c4821[_0x21e8('0x67')](_0x303298);}_0x48eb3e[_0x51f4a7][_0x21e8('0x78')]&&_0x1c4821[_0x21e8('0x3c')](_0x303298,_0x48eb3e[_0x51f4a7][_0x21e8('0x78')]===_0x21e8('0x79')?![]:!![]);_0x1c4821[_0x21e8('0x68')](_0x303298,_0x48eb3e[_0x51f4a7][_0x21e8('0x7a')]||_0x303298);}if(_0x3f44d0[_0x21e8('0x7b')]){_0x3f44d0[_0x21e8('0x7b')]=JSON[_0x21e8('0x7c')](_0x3f44d0[_0x21e8('0x7b')]);for(var _0x5727c0=0x0;_0x5727c0<_0x3f44d0[_0x21e8('0x7b')][_0x21e8('0x39')];_0x5727c0+=0x1){if(_0x3f44d0[_0x21e8('0x7b')][_0x5727c0][_0x21e8('0x31')]&&_[_0x21e8('0x8d')](_0x3afd16,_0x3f44d0[_0x21e8('0x7b')][_0x5727c0][_0x21e8('0x31')])&&_0x3f44d0[_0x21e8('0x7b')][_0x5727c0][_0x21e8('0x7d')]&&_0x3f44d0[_0x21e8('0x7b')][_0x5727c0][_0x21e8('0x7e')]&&_0x3f44d0['joins'][_0x5727c0][_0x21e8('0x7f')]){_0x1c4821[_0x3f44d0[_0x21e8('0x7b')][_0x5727c0][_0x21e8('0x31')]](_0x3f44d0[_0x21e8('0x7b')][_0x5727c0]['foreignTable'],null,util[_0x21e8('0x75')](_0x21e8('0x80'),_0x3f44d0['table'],_0x3f44d0[_0x21e8('0x7b')][_0x5727c0]['parentKey'],_0x3f44d0['joins'][_0x5727c0][_0x21e8('0x7e')],_0x3f44d0[_0x21e8('0x7b')][_0x5727c0][_0x21e8('0x7f')]));}}}if(_0x3f44d0['conditions']){_0x3f44d0['conditions']=JSON[_0x21e8('0x7c')](_0x3f44d0['conditions']);_0x1c4821[_0x21e8('0x3e')](_0x130caa(_0x3f44d0[_0x21e8('0x81')][_0x21e8('0x67')]));}_0xbf6538=_0x1c4821[_0x21e8('0x82')]();_0x1c4821['limit'](_0xf8e541);_0x1c4821[_0x21e8('0x1d')](0x0);logger[_0x21e8('0x83')]('Limited\x20Query:',_0x1c4821[_0x21e8('0x85')]());return dbH[_0x21e8('0x86')][_0x21e8('0x33')](_0x1c4821['toString'](),{'type':dbH[_0x21e8('0x86')]['QueryTypes'][_0x21e8('0x88')]});}})[_0x21e8('0x23')](function(){return{'sql':_0xbf6538[_0x21e8('0x85')]()};})['then'](respondWithResult(_0x18cefe,null))[_0x21e8('0x47')](handleError(_0x18cefe,null));}; \ No newline at end of file +var _0x96fd=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','AnalyticDefaultReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','join','SUM(%s)','MIN(%s)','HOUR(%s)','IS\x20NULL','IS\x20EMPTY','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','metric','parentKey','%s.%s\x20=\x20%s.%s','output','web','%s-%s.%s','randomstring','generate','csv','cdr','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x4cc8f9,_0xb142f8){var _0x515637=function(_0x342441){while(--_0x342441){_0x4cc8f9['push'](_0x4cc8f9['shift']());}};_0x515637(++_0xb142f8);}(_0x96fd,0x1e9));var _0xd96f=function(_0x4a7a41,_0x48821c){_0x4a7a41=_0x4a7a41-0x0;var _0x356dfa=_0x96fd[_0x4a7a41];return _0x356dfa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd96f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd96f('0x1'));var jsonpatch=require(_0xd96f('0x2'));var rp=require('request-promise');var moment=require(_0xd96f('0x3'));var BPromise=require(_0xd96f('0x4'));var Mustache=require(_0xd96f('0x5'));var util=require(_0xd96f('0x6'));var path=require('path');var sox=require(_0xd96f('0x7'));var csv=require(_0xd96f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd96f('0x9'));var _=require(_0xd96f('0xa'));var squel=require(_0xd96f('0xb'));var crypto=require(_0xd96f('0xc'));var jsforce=require(_0xd96f('0xd'));var deskjs=require(_0xd96f('0xe'));var toCsv=require(_0xd96f('0x8'));var querystring=require(_0xd96f('0xf'));var Papa=require(_0xd96f('0x10'));var Redis=require(_0xd96f('0x11'));var authService=require(_0xd96f('0x12'));var qs=require(_0xd96f('0x13'));var as=require(_0xd96f('0x14'));var hardwareService=require(_0xd96f('0x15'));var logger=require(_0xd96f('0x16'))(_0xd96f('0x17'));var utils=require(_0xd96f('0x18'));var config=require(_0xd96f('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xd96f('0x1a'))[_0xd96f('0x1b')];function respondWithStatusCode(_0x4ced55,_0x5870cd){_0x5870cd=_0x5870cd||0xcc;return function(_0x27118a){if(_0x27118a){return _0x4ced55[_0xd96f('0x1c')](_0x5870cd);}return _0x4ced55[_0xd96f('0x1d')](_0x5870cd)[_0xd96f('0x1e')]();};}function respondWithResult(_0x1c770a,_0x370c03){_0x370c03=_0x370c03||0xc8;return function(_0x1b33c8){if(_0x1b33c8){return _0x1c770a[_0xd96f('0x1d')](_0x370c03)[_0xd96f('0x1f')](_0x1b33c8);}};}function respondWithFilteredResult(_0x28884d,_0x5e5e65){return function(_0x1f6f36){if(_0x1f6f36){var _0x569e1=_0x1f6f36[_0xd96f('0x20')],_0x47d17c=_0x5e5e65[_0xd96f('0x21')],_0x19b141=_0x5e5e65[_0xd96f('0x21')]+_0x5e5e65[_0xd96f('0x22')],_0x3420d6;if(_0x19b141>=_0x569e1){_0x19b141=_0x569e1;_0x3420d6=0xc8;}else{_0x3420d6=0xce;}_0x28884d['status'](_0x3420d6);return _0x28884d[_0xd96f('0x23')](_0xd96f('0x24'),_0x47d17c+'-'+_0x19b141+'/'+_0x569e1)[_0xd96f('0x1f')](_0x1f6f36);}return null;};}function patchUpdates(_0x519ad4){return function(_0x33215f){try{jsonpatch[_0xd96f('0x25')](_0x33215f,_0x519ad4,!![]);}catch(_0x16f4af){return BPromise[_0xd96f('0x26')](_0x16f4af);}return _0x33215f[_0xd96f('0x27')]();};}function saveUpdates(_0x422e34,_0x318f36){return function(_0x57c396){if(_0x57c396){return _0x57c396[_0xd96f('0x28')](_0x422e34)[_0xd96f('0x29')](function(_0x4de2ef){return _0x4de2ef;});}return null;};}function removeEntity(_0x3ea026,_0x480610){return function(_0x39e7b2){if(_0x39e7b2){return _0x39e7b2['destroy']()['then'](function(){var _0x33a00c=_0x39e7b2['get']({'plain':!![]});var _0x565f74=_0xd96f('0x2a');return db[_0xd96f('0x2b')][_0xd96f('0x2c')]({'where':{'type':_0x565f74,'resourceId':_0x33a00c['id']}})[_0xd96f('0x29')](function(){return _0x39e7b2;});})[_0xd96f('0x29')](function(){_0x3ea026[_0xd96f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d6996,_0x24d81a){return function(_0x42117d){if(!_0x42117d){_0x1d6996[_0xd96f('0x1c')](0x194);}return _0x42117d;};}function handleError(_0xd4d095,_0x3725cd){_0x3725cd=_0x3725cd||0x1f4;return function(_0x2dd76b){logger[_0xd96f('0x2d')](_0x2dd76b[_0xd96f('0x2e')]);if(_0x2dd76b[_0xd96f('0x2f')]){delete _0x2dd76b[_0xd96f('0x2f')];}_0xd4d095[_0xd96f('0x1d')](_0x3725cd)[_0xd96f('0x30')](_0x2dd76b);};}exports[_0xd96f('0x31')]=function(_0x42487d,_0x3c84a7){var _0x157190={},_0x160b0a={},_0x22ef06={'count':0x0,'rows':[]};var _0x1738dd=_['map'](db[_0xd96f('0x32')][_0xd96f('0x33')],function(_0x146cee){return{'name':_0x146cee['fieldName'],'type':_0x146cee[_0xd96f('0x34')][_0xd96f('0x35')]};});_0x160b0a[_0xd96f('0x36')]=_['map'](_0x1738dd,_0xd96f('0x2f'));_0x160b0a['query']=_[_0xd96f('0x37')](_0x42487d['query']);_0x160b0a[_0xd96f('0x38')]=_[_0xd96f('0x39')](_0x160b0a[_0xd96f('0x36')],_0x160b0a[_0xd96f('0x3a')]);_0x157190[_0xd96f('0x3b')]=_[_0xd96f('0x39')](_0x160b0a[_0xd96f('0x36')],qs['fields'](_0x42487d['query'][_0xd96f('0x3c')]));_0x157190['attributes']=_0x157190['attributes']['length']?_0x157190[_0xd96f('0x3b')]:_0x160b0a[_0xd96f('0x36')];if(!_0x42487d[_0xd96f('0x3a')][_0xd96f('0x3d')]('nolimit')){_0x157190[_0xd96f('0x22')]=qs[_0xd96f('0x22')](_0x42487d[_0xd96f('0x3a')][_0xd96f('0x22')]);_0x157190[_0xd96f('0x21')]=qs[_0xd96f('0x21')](_0x42487d[_0xd96f('0x3a')][_0xd96f('0x21')]);}_0x157190[_0xd96f('0x3e')]=qs[_0xd96f('0x3f')](_0x42487d[_0xd96f('0x3a')][_0xd96f('0x3f')]);_0x157190['where']=qs[_0xd96f('0x38')](_[_0xd96f('0x40')](_0x42487d[_0xd96f('0x3a')],_0x160b0a[_0xd96f('0x38')]),_0x1738dd);if(_0x42487d['query'][_0xd96f('0x41')]){_0x157190[_0xd96f('0x42')]=_[_0xd96f('0x43')](_0x157190[_0xd96f('0x42')],{'$or':_['map'](_0x1738dd,function(_0x5b84dc){if(_0x5b84dc[_0xd96f('0x34')]!==_0xd96f('0x44')){var _0xfaf6f1={};_0xfaf6f1[_0x5b84dc[_0xd96f('0x2f')]]={'$like':'%'+_0x42487d['query'][_0xd96f('0x41')]+'%'};return _0xfaf6f1;}})});}_0x157190=_[_0xd96f('0x43')]({},_0x157190,_0x42487d['options']);var _0x1f23ab={'where':_0x157190[_0xd96f('0x42')]};return db[_0xd96f('0x32')][_0xd96f('0x20')](_0x1f23ab)['then'](function(_0x458d09){_0x22ef06['count']=_0x458d09;if(_0x42487d[_0xd96f('0x3a')][_0xd96f('0x45')]){_0x157190[_0xd96f('0x46')]=[{'all':!![]}];}return db[_0xd96f('0x32')]['findAll'](_0x157190);})[_0xd96f('0x29')](function(_0x252290){_0x22ef06[_0xd96f('0x47')]=_0x252290;return _0x22ef06;})[_0xd96f('0x29')](respondWithFilteredResult(_0x3c84a7,_0x157190))[_0xd96f('0x48')](handleError(_0x3c84a7,null));};exports[_0xd96f('0x49')]=function(_0x92819e,_0x187c18){var _0x2e3ce4={'raw':!![],'where':{'id':_0x92819e[_0xd96f('0x4a')]['id']}},_0x1a0b3c={};_0x1a0b3c[_0xd96f('0x36')]=_[_0xd96f('0x37')](db[_0xd96f('0x32')][_0xd96f('0x33')]);_0x1a0b3c[_0xd96f('0x3a')]=_[_0xd96f('0x37')](_0x92819e[_0xd96f('0x3a')]);_0x1a0b3c['filters']=_['intersection'](_0x1a0b3c[_0xd96f('0x36')],_0x1a0b3c['query']);_0x2e3ce4['attributes']=_[_0xd96f('0x39')](_0x1a0b3c['model'],qs[_0xd96f('0x3c')](_0x92819e[_0xd96f('0x3a')][_0xd96f('0x3c')]));_0x2e3ce4['attributes']=_0x2e3ce4[_0xd96f('0x3b')][_0xd96f('0x4b')]?_0x2e3ce4[_0xd96f('0x3b')]:_0x1a0b3c['model'];if(_0x92819e[_0xd96f('0x3a')][_0xd96f('0x45')]){_0x2e3ce4[_0xd96f('0x46')]=[{'all':!![]}];}_0x2e3ce4=_[_0xd96f('0x43')]({},_0x2e3ce4,_0x92819e[_0xd96f('0x4c')]);return db[_0xd96f('0x32')][_0xd96f('0x4d')](_0x2e3ce4)[_0xd96f('0x29')](handleEntityNotFound(_0x187c18,null))[_0xd96f('0x29')](respondWithResult(_0x187c18,null))[_0xd96f('0x48')](handleError(_0x187c18,null));};exports[_0xd96f('0x4e')]=function(_0x1f9ec5,_0x4e18e2){return db[_0xd96f('0x32')][_0xd96f('0x4e')](_0x1f9ec5[_0xd96f('0x4f')],{})['then'](function(_0x238f1f){var _0x599e5e=_0x1f9ec5[_0xd96f('0x50')][_0xd96f('0x51')]({'plain':!![]});if(!_0x599e5e)throw new Error(_0xd96f('0x52'));if(_0x599e5e[_0xd96f('0x53')]===_0xd96f('0x50')){var _0x38ec76=_0x238f1f[_0xd96f('0x51')]({'plain':!![]});var _0x19daf9=_0xd96f('0x54');return db[_0xd96f('0x55')][_0xd96f('0x4d')]({'where':{'name':_0x19daf9,'userProfileId':_0x599e5e[_0xd96f('0x56')]},'raw':!![]})[_0xd96f('0x29')](function(_0x37b86a){if(_0x37b86a&&_0x37b86a[_0xd96f('0x57')]===0x0){return db['UserProfileResource'][_0xd96f('0x4e')]({'name':_0x38ec76[_0xd96f('0x2f')],'resourceId':_0x38ec76['id'],'type':_0xd96f('0x2a'),'sectionId':_0x37b86a['id']},{})[_0xd96f('0x29')](function(){return _0x238f1f;});}else{return _0x238f1f;}})['catch'](function(_0x2efc45){logger['error'](_0xd96f('0x58'),_0x2efc45);throw _0x2efc45;});}return _0x238f1f;})[_0xd96f('0x29')](respondWithResult(_0x4e18e2,0xc9))[_0xd96f('0x48')](handleError(_0x4e18e2,null));};exports['update']=function(_0x2aee03,_0x27ec7e){if(_0x2aee03[_0xd96f('0x4f')]['id']){delete _0x2aee03[_0xd96f('0x4f')]['id'];}return db['AnalyticDefaultReport'][_0xd96f('0x4d')]({'where':{'id':_0x2aee03[_0xd96f('0x4a')]['id']}})[_0xd96f('0x29')](handleEntityNotFound(_0x27ec7e,null))[_0xd96f('0x29')](saveUpdates(_0x2aee03[_0xd96f('0x4f')],null))[_0xd96f('0x29')](respondWithResult(_0x27ec7e,null))[_0xd96f('0x48')](handleError(_0x27ec7e,null));};exports['destroy']=function(_0x2e4d7f,_0x4caa77){return db[_0xd96f('0x32')]['find']({'where':{'id':_0x2e4d7f[_0xd96f('0x4a')]['id']}})[_0xd96f('0x29')](handleEntityNotFound(_0x4caa77,null))[_0xd96f('0x29')](removeEntity(_0x4caa77,null))[_0xd96f('0x48')](handleError(_0x4caa77,null));};exports[_0xd96f('0x59')]=function(_0x1a526b,_0x3385c5){var _0x40d594=0xa;var _0x52b854=['join',_0xd96f('0x5a'),_0xd96f('0x5b'),_0xd96f('0x5c')];var _0x446ccc={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd96f('0x5d'),'MAX':_0xd96f('0x5e'),'MIN':'MIN(%s)','AVG':_0xd96f('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd96f('0x60'),'GROUP_CONCAT DESC':_0xd96f('0x61')};var _0x559cfd={'SEC_TO_TIME':_0xd96f('0x62'),'DATE':_0xd96f('0x63'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd96f('0x64')};var _0x3430e2=function(_0x267a6d){return!_[_0xd96f('0x65')](['IS\x20NULL',_0xd96f('0x66'),'IS\x20EMPTY',_0xd96f('0x67')],_0x267a6d);};var _0x2f1f67=function(_0x165540){if(!_0x165540||!_0x165540['rules'][_0xd96f('0x4b')]){return'';}for(var _0xf01dc8='(',_0x3dfce7=0x0;_0x3dfce7<_0x165540[_0xd96f('0x68')][_0xd96f('0x4b')];_0x3dfce7+=0x1){_0x3dfce7>0x0&&(_0xf01dc8+='\x20'+_0x165540[_0xd96f('0x69')]+'\x20');_0xf01dc8+=_0x165540[_0xd96f('0x68')][_0x3dfce7][_0xd96f('0x6a')]?_0x2f1f67(_0x165540[_0xd96f('0x68')][_0x3dfce7][_0xd96f('0x6a')]):_0x165540[_0xd96f('0x68')][_0x3dfce7][_0xd96f('0x6b')]+'\x20'+_0x165540[_0xd96f('0x68')][_0x3dfce7][_0xd96f('0x6c')]+(_0x3430e2(_0x165540[_0xd96f('0x68')][_0x3dfce7][_0xd96f('0x6c')])?'\x20'+_0x165540[_0xd96f('0x68')][_0x3dfce7]['value']:'');}return _0xf01dc8+')';};var _0x5ebf3b={'where':{'id':_0x1a526b['params']['id']}},_0x16d16a,_0x433743,_0x21bcfd,_0x2c6d56,_0x392d8a;_0x5ebf3b=_[_0xd96f('0x43')]({},_0x5ebf3b,_0x1a526b['options']);return db['AnalyticDefaultReport'][_0xd96f('0x4d')](_0x5ebf3b)[_0xd96f('0x29')](function(_0x459562){if(_0x459562){_0x16d16a=_0x459562;return _0x459562[_0xd96f('0x6d')]();}return null;})['then'](function(_0x322df0){if(_0x322df0){if(!_0x322df0['length']){throw new db['Sequelize'][(_0xd96f('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x433743=_0x322df0;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd96f('0x29')](function(_0x407d78){if(_0x407d78){_0x21bcfd=_['keyBy'](_0x407d78,'id');var _0x1e98de;var _0xf5dc13=squel[_0xd96f('0x6f')]();_0xf5dc13[_0xd96f('0x70')](_0x16d16a[_0xd96f('0x71')]);for(var _0x2bf711=0x0;_0x2bf711<_0x433743[_0xd96f('0x4b')];_0x2bf711+=0x1){_0x1e98de=_0x433743[_0x2bf711][_0xd96f('0x72')]?_0x21bcfd[_0x433743[_0x2bf711][_0xd96f('0x72')]]['metric']:_0x433743[_0x2bf711]['field'];_0x1e98de=_0x433743[_0x2bf711][_0xd96f('0x73')]?_[_0xd96f('0x74')](_0x446ccc[_0x433743[_0x2bf711][_0xd96f('0x73')]],'%s',_0x1e98de):_0x1e98de;_0x1e98de=_0x433743[_0x2bf711][_0xd96f('0x75')]?_[_0xd96f('0x74')](_0x559cfd[_0x433743[_0x2bf711][_0xd96f('0x75')]],'%s',_0x1e98de):_0x1e98de;if(_0x433743[_0x2bf711][_0xd96f('0x76')]){_0xf5dc13[_0xd96f('0x6a')](_0x1e98de);}_0x433743[_0x2bf711][_0xd96f('0x77')]&&_0xf5dc13[_0xd96f('0x3e')](_0x1e98de,_0x433743[_0x2bf711][_0xd96f('0x77')]===_0xd96f('0x78')?![]:!![]);_0xf5dc13[_0xd96f('0x6b')](_0x1e98de,_0x433743[_0x2bf711][_0xd96f('0x79')]||_0x1e98de);}if(_0x16d16a['joins']){_0x16d16a[_0xd96f('0x7a')]=JSON[_0xd96f('0x7b')](_0x16d16a[_0xd96f('0x7a')]);for(var _0x421283=0x0;_0x421283<_0x16d16a[_0xd96f('0x7a')][_0xd96f('0x4b')];_0x421283+=0x1){if(_0x16d16a['joins'][_0x421283][_0xd96f('0x34')]&&_['includes'](_0x52b854,_0x16d16a[_0xd96f('0x7a')][_0x421283][_0xd96f('0x34')])&&_0x16d16a[_0xd96f('0x7a')][_0x421283]['parentKey']&&_0x16d16a[_0xd96f('0x7a')][_0x421283]['foreignTable']&&_0x16d16a[_0xd96f('0x7a')][_0x421283][_0xd96f('0x7c')]){_0xf5dc13[_0x16d16a['joins'][_0x421283]['type']](_0x16d16a[_0xd96f('0x7a')][_0x421283]['foreignTable'],null,util[_0xd96f('0x75')]('%s.%s\x20=\x20%s.%s',_0x16d16a[_0xd96f('0x71')],_0x16d16a[_0xd96f('0x7a')][_0x421283]['parentKey'],_0x16d16a[_0xd96f('0x7a')][_0x421283][_0xd96f('0x7d')],_0x16d16a[_0xd96f('0x7a')][_0x421283][_0xd96f('0x7c')]));}}}if(_0x16d16a[_0xd96f('0x7e')]){_0x16d16a['conditions']=JSON[_0xd96f('0x7b')](_0x16d16a[_0xd96f('0x7e')]);_0xf5dc13[_0xd96f('0x42')](_0x2f1f67(_0x16d16a['conditions']['group']));}_0x392d8a=_0xf5dc13[_0xd96f('0x7f')]();_0xf5dc13['limit'](_0x40d594);_0xf5dc13[_0xd96f('0x21')](0x0);logger['debug'](_0xd96f('0x80'),_0xf5dc13['toString']());return dbH[_0xd96f('0x81')][_0xd96f('0x3a')](_0xf5dc13[_0xd96f('0x82')](),{'type':dbH[_0xd96f('0x81')][_0xd96f('0x83')]['SELECT']});}})[_0xd96f('0x29')](respondWithResult(_0x3385c5,null))[_0xd96f('0x48')](handleError(_0x3385c5,null));};function runReport(_0x11ffab,_0x3228e1,_0x384847){var _0x284e67=_0x3228e1[_0xd96f('0x2f')];var _0x18f860=0xa;var _0x1b9e6d=[_0xd96f('0x84'),_0xd96f('0x5a'),_0xd96f('0x5b'),_0xd96f('0x5c')];var _0x19dcef={'SUM':_0xd96f('0x85'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd96f('0x5d'),'MAX':_0xd96f('0x5e'),'MIN':_0xd96f('0x86'),'AVG':_0xd96f('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd96f('0x60'),'GROUP_CONCAT DESC':_0xd96f('0x61')};var _0x4817fa={'SEC_TO_TIME':_0xd96f('0x62'),'DATE':'DATE(%s)','HOUR':_0xd96f('0x87'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd96f('0x64')};var _0x40b148=function(_0xf449e4){return!_[_0xd96f('0x65')]([_0xd96f('0x88'),_0xd96f('0x66'),_0xd96f('0x89'),_0xd96f('0x67')],_0xf449e4);};var _0x418324=function(_0x156dbd){if(!_0x156dbd||!_0x156dbd['rules'][_0xd96f('0x4b')]){return'';}for(var _0x516ca1='(',_0x5f4b95=0x0;_0x5f4b95<_0x156dbd[_0xd96f('0x68')][_0xd96f('0x4b')];_0x5f4b95+=0x1){_0x5f4b95>0x0&&(_0x516ca1+='\x20'+_0x156dbd[_0xd96f('0x69')]+'\x20');_0x516ca1+=_0x156dbd[_0xd96f('0x68')][_0x5f4b95][_0xd96f('0x6a')]?_0x418324(_0x156dbd['rules'][_0x5f4b95]['group']):_0x156dbd[_0xd96f('0x68')][_0x5f4b95][_0xd96f('0x6b')]+'\x20'+_0x156dbd['rules'][_0x5f4b95]['condition']+(_0x40b148(_0x156dbd[_0xd96f('0x68')][_0x5f4b95]['condition'])?'\x20'+_0x156dbd[_0xd96f('0x68')][_0x5f4b95][_0xd96f('0x8a')]:'');}return _0x516ca1+')';};var _0x22e92b={'where':{'id':_0x11ffab['id']}},_0x3dfac2,_0x6ae1a1,_0x193a81,_0x5578be,_0x8ce2cc;_0x22e92b=_[_0xd96f('0x43')]({},_0x22e92b,_0x384847);return db['AnalyticDefaultReport'][_0xd96f('0x4d')](_0x22e92b)['then'](function(_0x1c99bc){if(_0x1c99bc){_0x3dfac2=_0x1c99bc;return _0x1c99bc[_0xd96f('0x6d')]();}return null;})[_0xd96f('0x29')](function(_0x183ca7){if(_0x183ca7){if(!_0x183ca7['length']){throw new db[(_0xd96f('0x8b'))][(_0xd96f('0x6e'))](_0xd96f('0x8c'),0x193);}_0x6ae1a1=_0x183ca7;return db[_0xd96f('0x8d')][_0xd96f('0x8e')]({'raw':!![]});}return null;})['then'](function(_0x21df28){if(_0x21df28){_0x193a81=_[_0xd96f('0x8f')](_0x21df28,'id');var _0x43a57d;var _0xdb859=squel[_0xd96f('0x6f')]();_0xdb859[_0xd96f('0x70')](_0x3dfac2[_0xd96f('0x71')]);for(var _0x1b85cb=0x0;_0x1b85cb<_0x6ae1a1[_0xd96f('0x4b')];_0x1b85cb+=0x1){_0x43a57d=_0x6ae1a1[_0x1b85cb]['MetricId']?_0x193a81[_0x6ae1a1[_0x1b85cb]['MetricId']][_0xd96f('0x90')]:_0x6ae1a1[_0x1b85cb][_0xd96f('0x6b')];_0x43a57d=_0x6ae1a1[_0x1b85cb]['function']?_[_0xd96f('0x74')](_0x19dcef[_0x6ae1a1[_0x1b85cb]['function']],'%s',_0x43a57d):_0x43a57d;_0x43a57d=_0x6ae1a1[_0x1b85cb]['format']?_[_0xd96f('0x74')](_0x4817fa[_0x6ae1a1[_0x1b85cb][_0xd96f('0x75')]],'%s',_0x43a57d):_0x43a57d;if(_0x6ae1a1[_0x1b85cb]['groupBy']){_0xdb859[_0xd96f('0x6a')](_0x43a57d);}_0x6ae1a1[_0x1b85cb][_0xd96f('0x77')]&&_0xdb859['order'](_0x43a57d,_0x6ae1a1[_0x1b85cb][_0xd96f('0x77')]===_0xd96f('0x78')?![]:!![]);_0xdb859[_0xd96f('0x6b')](_0x43a57d,_0x6ae1a1[_0x1b85cb][_0xd96f('0x79')]||_0x43a57d);}if(_0x3dfac2[_0xd96f('0x7a')]){_0x3dfac2[_0xd96f('0x7a')]=JSON[_0xd96f('0x7b')](_0x3dfac2[_0xd96f('0x7a')]);for(var _0x441d54=0x0;_0x441d54<_0x3dfac2[_0xd96f('0x7a')][_0xd96f('0x4b')];_0x441d54+=0x1){if(_0x3dfac2['joins'][_0x441d54][_0xd96f('0x34')]&&_['includes'](_0x1b9e6d,_0x3dfac2['joins'][_0x441d54][_0xd96f('0x34')])&&_0x3dfac2[_0xd96f('0x7a')][_0x441d54][_0xd96f('0x91')]&&_0x3dfac2[_0xd96f('0x7a')][_0x441d54][_0xd96f('0x7d')]&&_0x3dfac2['joins'][_0x441d54][_0xd96f('0x7c')]){_0xdb859[_0x3dfac2[_0xd96f('0x7a')][_0x441d54][_0xd96f('0x34')]](_0x3dfac2[_0xd96f('0x7a')][_0x441d54][_0xd96f('0x7d')],null,util[_0xd96f('0x75')](_0xd96f('0x92'),_0x3dfac2[_0xd96f('0x71')],_0x3dfac2['joins'][_0x441d54][_0xd96f('0x91')],_0x3dfac2[_0xd96f('0x7a')][_0x441d54]['foreignTable'],_0x3dfac2[_0xd96f('0x7a')][_0x441d54]['foreignKey']));}}}if(_0x3dfac2[_0xd96f('0x7e')]){_0x3dfac2[_0xd96f('0x7e')]=JSON[_0xd96f('0x7b')](_0x3dfac2[_0xd96f('0x7e')]);_0xdb859[_0xd96f('0x42')](_0x418324(_0x3dfac2['conditions']['group']));}_0x8ce2cc=_0xdb859[_0xd96f('0x7f')]();_0xdb859[_0xd96f('0x22')](_0x18f860);_0xdb859['offset'](0x0);return;}})[_0xd96f('0x29')](function(){if(_0x3228e1[_0xd96f('0x93')]===_0xd96f('0x94')){return null;}var _0x1962ed=_[_0xd96f('0x43')](_0x3228e1,{'name':_0x3228e1['fullPath']||_0x3228e1[_0xd96f('0x2f')]||_0x3dfac2[_0xd96f('0x2f')],'basename':_0x284e67,'savename':util[_0xd96f('0x75')](_0xd96f('0x95'),_0x3228e1[_0xd96f('0x2f')]||_0x3dfac2[_0xd96f('0x2f')],require(_0xd96f('0x96'))[_0xd96f('0x97')](0x4),_0x3228e1[_0xd96f('0x93')]||_0xd96f('0x98')),'reportId':_0x3dfac2['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0xd96f('0x4e')](_0x1962ed,{'raw':!![]});})[_0xd96f('0x29')](function(_0x14b578){if(_0x3dfac2[_0xd96f('0x71')]===_0xd96f('0x99')){_0x8ce2cc[_0xd96f('0x42')](_0x3dfac2[_0xd96f('0x71')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3228e1['startDate'],_0x3228e1[_0xd96f('0x9a')]);}else{_0x8ce2cc[_0xd96f('0x42')](_0x3dfac2[_0xd96f('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3228e1['startDate'],_0x3228e1[_0xd96f('0x9a')]);}if(_0x14b578){logger[_0xd96f('0x9b')](_0xd96f('0x9c'),_0x8ce2cc[_0xd96f('0x82')]());require(_0xd96f('0x9d'))['fork'](path[_0xd96f('0x84')](__dirname,_0xd96f('0x9e'),_0x14b578[_0xd96f('0x93')]),[_0x14b578['id'],_0x8ce2cc[_0xd96f('0x82')](),path['join'](__dirname,_0xd96f('0x9f'),_0x14b578[_0xd96f('0xa0')]),_0x284e67]);return _0x14b578;}else{var _0x78c647=squel[_0xd96f('0x6f')]();_0x78c647['from']('('+_0x8ce2cc[_0xd96f('0x82')]()+')',_0xd96f('0xa1'));_0x78c647[_0xd96f('0x6b')](_0xd96f('0xa2'),'count');_0x8ce2cc[_0xd96f('0x22')](_0x3228e1['limit']||_0x18f860);_0x8ce2cc['offset'](_0x3228e1[_0xd96f('0x21')]||0x0);return dbH['sequelize'][_0xd96f('0x3a')](_0x78c647[_0xd96f('0x82')](),{'type':dbH[_0xd96f('0x81')]['QueryTypes'][_0xd96f('0xa3')]})[_0xd96f('0x29')](function(_0x2687e3){if(!_0x2687e3['length']){_0x5578be=0x0;}else{_0x5578be=_0x2687e3[0x0][_0xd96f('0x20')]||0x0;}return dbH['sequelize'][_0xd96f('0x3a')](_0x8ce2cc[_0xd96f('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0xd96f('0xa3')]});})['then'](function(_0x83d500){return{'rows':_0x83d500||[],'count':_0x5578be};});}});}exports[_0xd96f('0xa4')]=function(_0x5459ac,_0x5a3e63){return runReport(_0x5459ac[_0xd96f('0x4a')],_0x5459ac[_0xd96f('0x3a')],_0x5459ac[_0xd96f('0x4c')])[_0xd96f('0x29')](respondWithResult(_0x5a3e63,null))[_0xd96f('0x48')](handleError(_0x5a3e63,null));};exports[_0xd96f('0xa5')]=runReport;exports[_0xd96f('0x3a')]=function(_0x520954,_0xabc139){var _0x3ec497=0xa;var _0x29d3d2=[_0xd96f('0x84'),_0xd96f('0x5a'),_0xd96f('0x5b'),_0xd96f('0x5c')];var _0x2c85fd={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd96f('0x5d'),'MAX':_0xd96f('0x5e'),'MIN':_0xd96f('0x86'),'AVG':_0xd96f('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd96f('0x61')};var _0x32481b={'SEC_TO_TIME':_0xd96f('0x62'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x441488=function(_0x10a413){return!_[_0xd96f('0x65')](['IS\x20NULL',_0xd96f('0x66'),_0xd96f('0x89'),_0xd96f('0x67')],_0x10a413);};var _0x1f61cf=function(_0x5d6a41){if(!_0x5d6a41||!_0x5d6a41[_0xd96f('0x68')]['length']){return'';}for(var _0x648f36='(',_0x484d2b=0x0;_0x484d2b<_0x5d6a41[_0xd96f('0x68')]['length'];_0x484d2b+=0x1){_0x484d2b>0x0&&(_0x648f36+='\x20'+_0x5d6a41[_0xd96f('0x69')]+'\x20');_0x648f36+=_0x5d6a41[_0xd96f('0x68')][_0x484d2b][_0xd96f('0x6a')]?_0x1f61cf(_0x5d6a41[_0xd96f('0x68')][_0x484d2b]['group']):_0x5d6a41[_0xd96f('0x68')][_0x484d2b][_0xd96f('0x6b')]+'\x20'+_0x5d6a41[_0xd96f('0x68')][_0x484d2b]['condition']+(_0x441488(_0x5d6a41[_0xd96f('0x68')][_0x484d2b][_0xd96f('0x6c')])?'\x20'+_0x5d6a41[_0xd96f('0x68')][_0x484d2b][_0xd96f('0x8a')]:'');}return _0x648f36+')';};var _0x5a7c52={'where':{'id':_0x520954[_0xd96f('0x4a')]['id']}},_0x266729,_0x5acf05,_0x28cfeb,_0xe0eb48,_0x258d5f;_0x5a7c52=_[_0xd96f('0x43')]({},_0x5a7c52,_0x520954[_0xd96f('0x4c')]);return db['AnalyticDefaultReport'][_0xd96f('0x4d')](_0x5a7c52)[_0xd96f('0x29')](function(_0x41c915){if(_0x41c915){_0x266729=_0x41c915;return _0x41c915[_0xd96f('0x6d')]();}return null;})[_0xd96f('0x29')](function(_0x41aae0){if(_0x41aae0){if(!_0x41aae0[_0xd96f('0x4b')]){throw new db['Sequelize'][(_0xd96f('0x6e'))](_0xd96f('0x8c'),0x193);}_0x5acf05=_0x41aae0;return db['AnalyticMetric'][_0xd96f('0x8e')]({'raw':!![]});}return null;})[_0xd96f('0x29')](function(_0x19d3fa){if(_0x19d3fa){_0x28cfeb=_[_0xd96f('0x8f')](_0x19d3fa,'id');var _0x30e2b6;var _0x9647c2=squel[_0xd96f('0x6f')]();_0x9647c2[_0xd96f('0x70')](_0x266729[_0xd96f('0x71')]);for(var _0x3917c9=0x0;_0x3917c9<_0x5acf05[_0xd96f('0x4b')];_0x3917c9+=0x1){_0x30e2b6=_0x5acf05[_0x3917c9][_0xd96f('0x72')]?_0x28cfeb[_0x5acf05[_0x3917c9][_0xd96f('0x72')]][_0xd96f('0x90')]:_0x5acf05[_0x3917c9][_0xd96f('0x6b')];_0x30e2b6=_0x5acf05[_0x3917c9][_0xd96f('0x73')]?_[_0xd96f('0x74')](_0x2c85fd[_0x5acf05[_0x3917c9][_0xd96f('0x73')]],'%s',_0x30e2b6):_0x30e2b6;_0x30e2b6=_0x5acf05[_0x3917c9][_0xd96f('0x75')]?_['replace'](_0x32481b[_0x5acf05[_0x3917c9]['format']],'%s',_0x30e2b6):_0x30e2b6;if(_0x5acf05[_0x3917c9][_0xd96f('0x76')]){_0x9647c2[_0xd96f('0x6a')](_0x30e2b6);}_0x5acf05[_0x3917c9][_0xd96f('0x77')]&&_0x9647c2[_0xd96f('0x3e')](_0x30e2b6,_0x5acf05[_0x3917c9][_0xd96f('0x77')]===_0xd96f('0x78')?![]:!![]);_0x9647c2['field'](_0x30e2b6,_0x5acf05[_0x3917c9]['alias']||_0x30e2b6);}if(_0x266729[_0xd96f('0x7a')]){_0x266729[_0xd96f('0x7a')]=JSON[_0xd96f('0x7b')](_0x266729[_0xd96f('0x7a')]);for(var _0x5206e9=0x0;_0x5206e9<_0x266729[_0xd96f('0x7a')]['length'];_0x5206e9+=0x1){if(_0x266729[_0xd96f('0x7a')][_0x5206e9]['type']&&_[_0xd96f('0x65')](_0x29d3d2,_0x266729[_0xd96f('0x7a')][_0x5206e9][_0xd96f('0x34')])&&_0x266729[_0xd96f('0x7a')][_0x5206e9][_0xd96f('0x91')]&&_0x266729[_0xd96f('0x7a')][_0x5206e9]['foreignTable']&&_0x266729[_0xd96f('0x7a')][_0x5206e9]['foreignKey']){_0x9647c2[_0x266729['joins'][_0x5206e9]['type']](_0x266729[_0xd96f('0x7a')][_0x5206e9]['foreignTable'],null,util[_0xd96f('0x75')](_0xd96f('0x92'),_0x266729['table'],_0x266729[_0xd96f('0x7a')][_0x5206e9][_0xd96f('0x91')],_0x266729['joins'][_0x5206e9][_0xd96f('0x7d')],_0x266729[_0xd96f('0x7a')][_0x5206e9][_0xd96f('0x7c')]));}}}if(_0x266729[_0xd96f('0x7e')]){_0x266729[_0xd96f('0x7e')]=JSON['parse'](_0x266729['conditions']);_0x9647c2['where'](_0x1f61cf(_0x266729['conditions'][_0xd96f('0x6a')]));}_0x258d5f=_0x9647c2['clone']();_0x9647c2[_0xd96f('0x22')](_0x3ec497);_0x9647c2[_0xd96f('0x21')](0x0);logger['debug'](_0xd96f('0x80'),_0x9647c2[_0xd96f('0x82')]());return dbH['sequelize'][_0xd96f('0x3a')](_0x9647c2[_0xd96f('0x82')](),{'type':dbH['sequelize'][_0xd96f('0x83')]['SELECT']});}})[_0xd96f('0x29')](function(){return{'sql':_0x258d5f[_0xd96f('0x82')]()};})[_0xd96f('0x29')](respondWithResult(_0xabc139,null))[_0xd96f('0x48')](handleError(_0xabc139,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2dc0317..5bfaf71 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 _0xc626=['request-promise','path','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird'];(function(_0x377b48,_0x5acbcf){var _0x3e4070=function(_0x1bb856){while(--_0x1bb856){_0x377b48['push'](_0x377b48['shift']());}};_0x3e4070(++_0x5acbcf);}(_0xc626,0x145));var _0x6c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc626[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c62('0x0'));var util=require(_0x6c62('0x1'));var logger=require(_0x6c62('0x2'))(_0x6c62('0x3'));var moment=require('moment');var BPromise=require(_0x6c62('0x4'));var rp=require(_0x6c62('0x5'));var fs=require('fs');var path=require(_0x6c62('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c62('0x7'));module[_0x6c62('0x8')]=function(_0x59898f,_0x2c2c56){return _0x59898f['define'](_0x6c62('0x9'),attributes,{'tableName':_0x6c62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf49=['moment','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf49,0x19f));var _0x9df4=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0xdf49[_0x4cd21c];return _0x5d8e5e;};'use strict';var _=require(_0x9df4('0x0'));var util=require(_0x9df4('0x1'));var logger=require(_0x9df4('0x2'))('api');var moment=require(_0x9df4('0x3'));var BPromise=require('bluebird');var rp=require(_0x9df4('0x4'));var fs=require('fs');var path=require(_0x9df4('0x5'));var rimraf=require('rimraf');var config=require(_0x9df4('0x6'));var attributes=require(_0x9df4('0x7'));module[_0x9df4('0x8')]=function(_0x3a7fb7,_0x1c9ee2){return _0x3a7fb7['define'](_0x9df4('0x9'),attributes,{'tableName':_0x9df4('0xa'),'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 be64562..eb8c341 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 _0x37b4=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result'];(function(_0x6d7e5d,_0x15e965){var _0x83492f=function(_0x440db8){while(--_0x440db8){_0x6d7e5d['push'](_0x6d7e5d['shift']());}};_0x83492f(++_0x15e965);}(_0x37b4,0xef));var _0x437b=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x37b4[_0x34933a];return _0x36abb4;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var moment=require(_0x437b('0x1'));var BPromise=require(_0x437b('0x2'));var rs=require(_0x437b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x437b('0x4'))['db'];var utils=require(_0x437b('0x5'));var logger=require(_0x437b('0x6'))(_0x437b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x437b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7dea,_0x4aada7,_0x226e3c){return new BPromise(function(_0x5df980,_0x432b63){return client['request'](_0x3c7dea,_0x226e3c)['then'](function(_0x44bf1d){logger[_0x437b('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'),JSON[_0x437b('0xb')](_0x44bf1d));if(_0x44bf1d[_0x437b('0xc')]){if(_0x44bf1d[_0x437b('0xc')]['code']===0x1f4){logger[_0x437b('0xc')](_0x437b('0xd'),_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x432b63(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}logger[_0x437b('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x5df980(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}else{logger[_0x437b('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));_0x5df980(_0x44bf1d[_0x437b('0xf')][_0x437b('0xe')]);}})[_0x437b('0x10')](function(_0x1d31af){logger[_0x437b('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4aada7,_0x1d31af);_0x432b63(_0x1d31af);});});} \ No newline at end of file +var _0x76d2=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info'];(function(_0x4fe90d,_0x7fad4a){var _0x3f6cdd=function(_0x552780){while(--_0x552780){_0x4fe90d['push'](_0x4fe90d['shift']());}};_0x3f6cdd(++_0x7fad4a);}(_0x76d2,0xf8));var _0x276d=function(_0x25cd72,_0x5617d7){_0x25cd72=_0x25cd72-0x0;var _0x1ed44e=_0x76d2[_0x25cd72];return _0x1ed44e;};'use strict';var _=require(_0x276d('0x0'));var util=require(_0x276d('0x1'));var moment=require(_0x276d('0x2'));var BPromise=require('bluebird');var rs=require(_0x276d('0x3'));var fs=require('fs');var Redis=require(_0x276d('0x4'));var db=require(_0x276d('0x5'))['db'];var utils=require(_0x276d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x276d('0x7'));var jayson=require(_0x276d('0x8'));var client=jayson[_0x276d('0x9')][_0x276d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x138f9f,_0x2f084f,_0x357d9a){return new BPromise(function(_0x233a6c,_0x1b576a){return client['request'](_0x138f9f,_0x357d9a)['then'](function(_0x3efafa){logger[_0x276d('0xb')](_0x276d('0xc'),_0x2f084f,_0x276d('0xd'));logger[_0x276d('0xe')](_0x276d('0xf'),_0x2f084f,'request\x20sent',JSON['stringify'](_0x3efafa));if(_0x3efafa[_0x276d('0x10')]){if(_0x3efafa[_0x276d('0x10')][_0x276d('0x11')]===0x1f4){logger[_0x276d('0x10')](_0x276d('0xc'),_0x2f084f,_0x3efafa[_0x276d('0x10')]['message']);return _0x1b576a(_0x3efafa['error'][_0x276d('0x12')]);}logger[_0x276d('0x10')](_0x276d('0xc'),_0x2f084f,_0x3efafa[_0x276d('0x10')][_0x276d('0x12')]);return _0x233a6c(_0x3efafa[_0x276d('0x10')][_0x276d('0x12')]);}else{logger[_0x276d('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2f084f,_0x276d('0xd'));_0x233a6c(_0x3efafa[_0x276d('0x13')]['message']);}})['catch'](function(_0x1dd3cf){logger[_0x276d('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2f084f,_0x1dd3cf);_0x1b576a(_0x1dd3cf);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 779e09b..6463241 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 _0xe8f4=['fs-extra','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show','/:id/preview','run','/:id/query','query','post','create','/:id','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x35f969,_0x2c03bd){var _0x373c46=function(_0x480568){while(--_0x480568){_0x35f969['push'](_0x35f969['shift']());}};_0x373c46(++_0x2c03bd);}(_0xe8f4,0x140));var _0x4e8f=function(_0x5ad4c0,_0x391c94){_0x5ad4c0=_0x5ad4c0-0x0;var _0x3bc47a=_0xe8f4[_0x5ad4c0];return _0x3bc47a;};'use strict';var multer=require(_0x4e8f('0x0'));var util=require(_0x4e8f('0x1'));var path=require('path');var timeout=require(_0x4e8f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4e8f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e8f('0x4'));var controller=require(_0x4e8f('0x5'));router[_0x4e8f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x4e8f('0x7')](),controller[_0x4e8f('0x8')]);router[_0x4e8f('0x6')](_0x4e8f('0x9'),auth[_0x4e8f('0x7')](),controller['preview']);router[_0x4e8f('0x6')]('/:id/run',auth[_0x4e8f('0x7')](),controller[_0x4e8f('0xa')]);router[_0x4e8f('0x6')](_0x4e8f('0xb'),auth[_0x4e8f('0x7')](),controller[_0x4e8f('0xc')]);router[_0x4e8f('0xd')]('/',auth[_0x4e8f('0x7')](),controller[_0x4e8f('0xe')]);router['put'](_0x4e8f('0xf'),auth[_0x4e8f('0x7')](),controller['update']);router[_0x4e8f('0x10')](_0x4e8f('0xf'),auth[_0x4e8f('0x7')](),controller[_0x4e8f('0x11')]);module[_0x4e8f('0x12')]=router; \ No newline at end of file +var _0xeaf8=['run','/:id/query','query','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run'];(function(_0x21006e,_0x4368d6){var _0x178e6e=function(_0x5f26cc){while(--_0x5f26cc){_0x21006e['push'](_0x21006e['shift']());}};_0x178e6e(++_0x4368d6);}(_0xeaf8,0x1b2));var _0x8eaf=function(_0x151d43,_0x3e8d17){_0x151d43=_0x151d43-0x0;var _0x4a5e15=_0xeaf8[_0x151d43];return _0x4a5e15;};'use strict';var multer=require(_0x8eaf('0x0'));var util=require(_0x8eaf('0x1'));var path=require(_0x8eaf('0x2'));var timeout=require(_0x8eaf('0x3'));var express=require(_0x8eaf('0x4'));var router=express[_0x8eaf('0x5')]();var fs_extra=require(_0x8eaf('0x6'));var auth=require(_0x8eaf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8eaf('0x8'));var controller=require(_0x8eaf('0x9'));router[_0x8eaf('0xa')]('/',auth[_0x8eaf('0xb')](),controller[_0x8eaf('0xc')]);router['get'](_0x8eaf('0xd'),auth[_0x8eaf('0xb')](),controller['show']);router[_0x8eaf('0xa')]('/:id/preview',auth[_0x8eaf('0xb')](),controller[_0x8eaf('0xe')]);router[_0x8eaf('0xa')](_0x8eaf('0xf'),auth['isAuthenticated'](),controller[_0x8eaf('0x10')]);router[_0x8eaf('0xa')](_0x8eaf('0x11'),auth['isAuthenticated'](),controller[_0x8eaf('0x12')]);router[_0x8eaf('0x13')]('/',auth[_0x8eaf('0xb')](),controller[_0x8eaf('0x14')]);router[_0x8eaf('0x15')](_0x8eaf('0xd'),auth[_0x8eaf('0xb')](),controller['update']);router[_0x8eaf('0x16')](_0x8eaf('0xd'),auth[_0x8eaf('0xb')](),controller[_0x8eaf('0x17')]);module[_0x8eaf('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 234a83c..c159319 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 _0x0057=['exports','STRING','xlsx','csv','DATE','ENUM','manual','UNSIGNED','sequelize','moment'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x0057,0x1ac));var _0x7005=function(_0xf98857,_0x4ebd5c){_0xf98857=_0xf98857-0x0;var _0x107d11=_0x0057[_0xf98857];return _0x107d11;};'use strict';var Sequelize=require(_0x7005('0x0'));var moment=require(_0x7005('0x1'));module[_0x7005('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x7005('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0x7005('0x4')),'allowNull':![],'defaultValue':_0x7005('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x7005('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x7005('0x7')](_0x7005('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x7005('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x7005('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2abb=['DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x5ccfc9,_0xbd6526){var _0x1abbda=function(_0x4a157c){while(--_0x4a157c){_0x5ccfc9['push'](_0x5ccfc9['shift']());}};_0x1abbda(++_0xbd6526);}(_0x2abb,0x18b));var _0xb2ab=function(_0x447523,_0x449505){_0x447523=_0x447523-0x0;var _0x4ef576=_0x2abb[_0x447523];return _0x4ef576;};'use strict';var Sequelize=require(_0xb2ab('0x0'));var moment=require(_0xb2ab('0x1'));module[_0xb2ab('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xb2ab('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xb2ab('0x4')](_0xb2ab('0x5'),_0xb2ab('0x6'),_0xb2ab('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xb2ab('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xb2ab('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xb2ab('0x9')},'type':{'type':Sequelize['ENUM'](_0xb2ab('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0xb2ab('0xa')},'reportId':{'type':Sequelize[_0xb2ab('0xb')](0xb)[_0xb2ab('0xc')]},'reportType':{'type':Sequelize[_0xb2ab('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 16a82b1..10089dc 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 _0x62f0=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','map','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','params','download','output','existsSync','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','sendStatus','%s.%s','basename','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x62f0,0x168));var _0x062f=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x62f0[_0x912d27];return _0x31b918;};'use strict';var pdf=require(_0x062f('0x0'));var emlformat=require(_0x062f('0x1'));var rimraf=require(_0x062f('0x2'));var zipdir=require(_0x062f('0x3'));var jsonpatch=require(_0x062f('0x4'));var rp=require(_0x062f('0x5'));var moment=require(_0x062f('0x6'));var BPromise=require(_0x062f('0x7'));var Mustache=require('mustache');var util=require(_0x062f('0x8'));var path=require('path');var sox=require(_0x062f('0x9'));var csv=require('to-csv');var ejs=require(_0x062f('0xa'));var fs=require('fs');var fs_extra=require(_0x062f('0xb'));var _=require('lodash');var squel=require(_0x062f('0xc'));var crypto=require(_0x062f('0xd'));var jsforce=require(_0x062f('0xe'));var deskjs=require(_0x062f('0xf'));var toCsv=require(_0x062f('0x10'));var querystring=require(_0x062f('0x11'));var Papa=require(_0x062f('0x12'));var Redis=require(_0x062f('0x13'));var authService=require(_0x062f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x062f('0x15'));var hardwareService=require(_0x062f('0x16'));var logger=require(_0x062f('0x17'))(_0x062f('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x062f('0x19'));var db=require(_0x062f('0x1a'))['db'];function respondWithStatusCode(_0x1890a6,_0xceb704){_0xceb704=_0xceb704||0xcc;return function(_0x15d922){if(_0x15d922){return _0x1890a6['sendStatus'](_0xceb704);}return _0x1890a6[_0x062f('0x1b')](_0xceb704)['end']();};}function respondWithResult(_0x2d2036,_0x4267ac){_0x4267ac=_0x4267ac||0xc8;return function(_0x22905d){if(_0x22905d){return _0x2d2036[_0x062f('0x1b')](_0x4267ac)['json'](_0x22905d);}};}function respondWithFilteredResult(_0x3f34db,_0x1b8eff){return function(_0xad1096){if(_0xad1096){var _0x276f55=_0xad1096[_0x062f('0x1c')],_0x285157=_0x1b8eff[_0x062f('0x1d')],_0x1d1cca=_0x1b8eff[_0x062f('0x1d')]+_0x1b8eff[_0x062f('0x1e')],_0x5dc132;if(_0x1d1cca>=_0x276f55){_0x1d1cca=_0x276f55;_0x5dc132=0xc8;}else{_0x5dc132=0xce;}_0x3f34db[_0x062f('0x1b')](_0x5dc132);return _0x3f34db[_0x062f('0x1f')](_0x062f('0x20'),_0x285157+'-'+_0x1d1cca+'/'+_0x276f55)[_0x062f('0x21')](_0xad1096);}return null;};}function patchUpdates(_0x12ded1){return function(_0x4094a9){try{jsonpatch['apply'](_0x4094a9,_0x12ded1,!![]);}catch(_0x836826){return BPromise[_0x062f('0x22')](_0x836826);}return _0x4094a9[_0x062f('0x23')]();};}function saveUpdates(_0x17ab3b,_0x4c268d){return function(_0x469169){if(_0x469169){return _0x469169[_0x062f('0x24')](_0x17ab3b)[_0x062f('0x25')](function(_0x54e9fa){return _0x54e9fa;});}return null;};}function removeEntity(_0x4d212e,_0xe98f18){return function(_0x206255){if(_0x206255){return _0x206255[_0x062f('0x26')]()['then'](function(){var _0x3f24b3=_0x206255[_0x062f('0x27')]({'plain':!![]});var _0x103361='ExtractedReports';return db[_0x062f('0x28')][_0x062f('0x26')]({'where':{'type':_0x103361,'resourceId':_0x3f24b3['id']}})['then'](function(){return _0x206255;});})['then'](function(){_0x4d212e[_0x062f('0x1b')](0xcc)[_0x062f('0x29')]();});}};}function handleEntityNotFound(_0x14728f,_0x19af94){return function(_0x5fb094){if(!_0x5fb094){_0x14728f['sendStatus'](0x194);}return _0x5fb094;};}function handleError(_0x162786,_0x3025f6){_0x3025f6=_0x3025f6||0x1f4;return function(_0x5f2707){logger['error'](_0x5f2707[_0x062f('0x2a')]);if(_0x5f2707[_0x062f('0x2b')]){delete _0x5f2707[_0x062f('0x2b')];}_0x162786[_0x062f('0x1b')](_0x3025f6)[_0x062f('0x2c')](_0x5f2707);};}exports['index']=function(_0x468527,_0x15c3c1){var _0x15e807={},_0x50d40f={},_0x3337bf={'count':0x0,'rows':[]};var _0xfeecef=_[_0x062f('0x2d')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x4f42e1){return{'name':_0x4f42e1['fieldName'],'type':_0x4f42e1[_0x062f('0x2e')]['key']};});_0x50d40f[_0x062f('0x2f')]=_[_0x062f('0x2d')](_0xfeecef,_0x062f('0x2b'));_0x50d40f[_0x062f('0x30')]=_[_0x062f('0x31')](_0x468527['query']);_0x50d40f[_0x062f('0x32')]=_[_0x062f('0x33')](_0x50d40f[_0x062f('0x2f')],_0x50d40f[_0x062f('0x30')]);_0x15e807[_0x062f('0x34')]=_[_0x062f('0x33')](_0x50d40f[_0x062f('0x2f')],qs[_0x062f('0x35')](_0x468527['query'][_0x062f('0x35')]));_0x15e807[_0x062f('0x34')]=_0x15e807[_0x062f('0x34')][_0x062f('0x36')]?_0x15e807[_0x062f('0x34')]:_0x50d40f[_0x062f('0x2f')];if(!_0x468527[_0x062f('0x30')][_0x062f('0x37')]('nolimit')){_0x15e807[_0x062f('0x1e')]=qs[_0x062f('0x1e')](_0x468527[_0x062f('0x30')][_0x062f('0x1e')]);_0x15e807[_0x062f('0x1d')]=qs['offset'](_0x468527[_0x062f('0x30')][_0x062f('0x1d')]);}_0x15e807['order']=qs[_0x062f('0x38')](_0x468527['query'][_0x062f('0x38')]);_0x15e807[_0x062f('0x39')]=qs['filters'](_[_0x062f('0x3a')](_0x468527[_0x062f('0x30')],_0x50d40f['filters']),_0xfeecef);if(_0x468527[_0x062f('0x30')]['filter']){_0x15e807[_0x062f('0x39')]=_[_0x062f('0x3b')](_0x15e807[_0x062f('0x39')],{'$or':_['map'](_0xfeecef,function(_0x8d7c0f){if(_0x8d7c0f[_0x062f('0x2e')]!==_0x062f('0x3c')){var _0x137fc5={};_0x137fc5[_0x8d7c0f['name']]={'$like':'%'+_0x468527[_0x062f('0x30')]['filter']+'%'};return _0x137fc5;}})});}_0x15e807=_[_0x062f('0x3b')]({},_0x15e807,_0x468527[_0x062f('0x3d')]);var _0x4e34f6={'where':_0x15e807[_0x062f('0x39')]};return db[_0x062f('0x3e')][_0x062f('0x1c')](_0x4e34f6)[_0x062f('0x25')](function(_0xc75da9){_0x3337bf[_0x062f('0x1c')]=_0xc75da9;if(_0x468527[_0x062f('0x30')][_0x062f('0x3f')]){_0x15e807['include']=[{'all':!![]}];}return db[_0x062f('0x3e')][_0x062f('0x40')](_0x15e807);})[_0x062f('0x25')](function(_0x5981a7){_0x3337bf[_0x062f('0x41')]=_0x5981a7;return _0x3337bf;})[_0x062f('0x25')](respondWithFilteredResult(_0x15c3c1,_0x15e807))[_0x062f('0x42')](handleError(_0x15c3c1,null));};exports[_0x062f('0x43')]=function(_0x57aca2,_0x1b75b1){var _0x3f0942={'raw':!![],'where':{'id':_0x57aca2['params']['id']}},_0x4b9557={};_0x4b9557[_0x062f('0x2f')]=_[_0x062f('0x31')](db[_0x062f('0x3e')][_0x062f('0x44')]);_0x4b9557[_0x062f('0x30')]=_[_0x062f('0x31')](_0x57aca2[_0x062f('0x30')]);_0x4b9557[_0x062f('0x32')]=_['intersection'](_0x4b9557[_0x062f('0x2f')],_0x4b9557[_0x062f('0x30')]);_0x3f0942[_0x062f('0x34')]=_[_0x062f('0x33')](_0x4b9557[_0x062f('0x2f')],qs[_0x062f('0x35')](_0x57aca2['query'][_0x062f('0x35')]));_0x3f0942[_0x062f('0x34')]=_0x3f0942[_0x062f('0x34')][_0x062f('0x36')]?_0x3f0942[_0x062f('0x34')]:_0x4b9557[_0x062f('0x2f')];if(_0x57aca2[_0x062f('0x30')][_0x062f('0x3f')]){_0x3f0942[_0x062f('0x45')]=[{'all':!![]}];}_0x3f0942=_[_0x062f('0x3b')]({},_0x3f0942,_0x57aca2['options']);return db['AnalyticExtractedReport'][_0x062f('0x46')](_0x3f0942)[_0x062f('0x25')](handleEntityNotFound(_0x1b75b1,null))['then'](respondWithResult(_0x1b75b1,null))[_0x062f('0x42')](handleError(_0x1b75b1,null));};exports['create']=function(_0x3e815c,_0x4c3d7f){return db[_0x062f('0x3e')][_0x062f('0x47')](_0x3e815c[_0x062f('0x48')],{})[_0x062f('0x25')](function(_0x1623aa){var _0x567fcf=_0x3e815c[_0x062f('0x49')][_0x062f('0x27')]({'plain':!![]});if(!_0x567fcf)throw new Error(_0x062f('0x4a'));if(_0x567fcf[_0x062f('0x4b')]==='user'){var _0xc39c42=_0x1623aa[_0x062f('0x27')]({'plain':!![]});var _0x214e00=_0x062f('0x4c');return db[_0x062f('0x4d')][_0x062f('0x46')]({'where':{'name':_0x214e00,'userProfileId':_0x567fcf[_0x062f('0x4e')]},'raw':!![]})['then'](function(_0x1195dd){if(_0x1195dd&&_0x1195dd[_0x062f('0x4f')]===0x0){return db[_0x062f('0x28')][_0x062f('0x47')]({'name':_0xc39c42['name'],'resourceId':_0xc39c42['id'],'type':_0x1195dd[_0x062f('0x2b')],'sectionId':_0x1195dd['id']},{})[_0x062f('0x25')](function(){return _0x1623aa;});}else{return _0x1623aa;}})[_0x062f('0x42')](function(_0x1630cb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1630cb);throw _0x1630cb;});}return _0x1623aa;})['then'](respondWithResult(_0x4c3d7f,0xc9))[_0x062f('0x42')](handleError(_0x4c3d7f,null));};exports['update']=function(_0x2601f4,_0x195df1){if(_0x2601f4['body']['id']){delete _0x2601f4['body']['id'];}return db[_0x062f('0x3e')][_0x062f('0x46')]({'where':{'id':_0x2601f4[_0x062f('0x50')]['id']}})['then'](handleEntityNotFound(_0x195df1,null))[_0x062f('0x25')](saveUpdates(_0x2601f4[_0x062f('0x48')],null))[_0x062f('0x25')](respondWithResult(_0x195df1,null))[_0x062f('0x42')](handleError(_0x195df1,null));};exports[_0x062f('0x26')]=function(_0x556e48,_0x34cdce){return db[_0x062f('0x3e')][_0x062f('0x46')]({'where':{'id':_0x556e48[_0x062f('0x50')]['id']}})['then'](handleEntityNotFound(_0x34cdce,null))[_0x062f('0x25')](removeEntity(_0x34cdce,null))[_0x062f('0x42')](handleError(_0x34cdce,null));};exports[_0x062f('0x51')]=function(_0x1d3fd6,_0x282ee6,_0x385c48){return db[_0x062f('0x3e')][_0x062f('0x46')]({'where':{'id':_0x1d3fd6['params']['id']},'attributes':['name','basename','savename',_0x062f('0x52')],'raw':!![]})[_0x062f('0x25')](handleEntityNotFound(_0x282ee6,null))['then'](function(_0x5c3589){if(_0x5c3589){if(!fs[_0x062f('0x53')](path['join'](config[_0x062f('0x54')],_0x062f('0x55'),_0x5c3589[_0x062f('0x56')]))){throw new db[(_0x062f('0x57'))][(_0x062f('0x58'))](_0x062f('0x59'));}if(_0x1d3fd6['query']['exists']){return _0x282ee6[_0x062f('0x5a')](0xc8);}return _0x282ee6[_0x062f('0x51')](path['join'](config[_0x062f('0x54')],_0x062f('0x55'),_0x5c3589[_0x062f('0x56')]),util['format'](_0x062f('0x5b'),_0x5c3589[_0x062f('0x5c')]||_0x5c3589[_0x062f('0x2b')],_0x5c3589[_0x062f('0x52')][_0x062f('0x5d')]()));}})['catch'](handleError(_0x282ee6,null));}; \ No newline at end of file +var _0x4663=['limit','set','apply','reject','save','update','then','ExtractedReports','UserProfileResource','destroy','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x4900e4,_0x125f32){var _0x3ed7f5=function(_0x3083c2){while(--_0x3083c2){_0x4900e4['push'](_0x4900e4['shift']());}};_0x3ed7f5(++_0x125f32);}(_0x4663,0x1c3));var _0x3466=function(_0x315b87,_0x27b3fe){_0x315b87=_0x315b87-0x0;var _0x5447cf=_0x4663[_0x315b87];return _0x5447cf;};'use strict';var pdf=require(_0x3466('0x0'));var emlformat=require(_0x3466('0x1'));var rimraf=require(_0x3466('0x2'));var zipdir=require(_0x3466('0x3'));var jsonpatch=require(_0x3466('0x4'));var rp=require(_0x3466('0x5'));var moment=require(_0x3466('0x6'));var BPromise=require(_0x3466('0x7'));var Mustache=require(_0x3466('0x8'));var util=require(_0x3466('0x9'));var path=require('path');var sox=require(_0x3466('0xa'));var csv=require(_0x3466('0xb'));var ejs=require(_0x3466('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3466('0xd'));var squel=require(_0x3466('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3466('0xf'));var Papa=require(_0x3466('0x10'));var Redis=require(_0x3466('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3466('0x12'));var as=require(_0x3466('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3466('0x14'))('api');var utils=require(_0x3466('0x15'));var config=require(_0x3466('0x16'));var licenseUtil=require(_0x3466('0x17'));var db=require(_0x3466('0x18'))['db'];function respondWithStatusCode(_0x2e337a,_0x24e1cd){_0x24e1cd=_0x24e1cd||0xcc;return function(_0x481be5){if(_0x481be5){return _0x2e337a[_0x3466('0x19')](_0x24e1cd);}return _0x2e337a[_0x3466('0x1a')](_0x24e1cd)['end']();};}function respondWithResult(_0x1e7a9f,_0x51ff25){_0x51ff25=_0x51ff25||0xc8;return function(_0xf8934c){if(_0xf8934c){return _0x1e7a9f[_0x3466('0x1a')](_0x51ff25)[_0x3466('0x1b')](_0xf8934c);}};}function respondWithFilteredResult(_0x9fb976,_0x415e05){return function(_0x1e3764){if(_0x1e3764){var _0x31b92e=_0x1e3764['count'],_0xbce97f=_0x415e05[_0x3466('0x1c')],_0x3fbcfe=_0x415e05[_0x3466('0x1c')]+_0x415e05[_0x3466('0x1d')],_0x227fed;if(_0x3fbcfe>=_0x31b92e){_0x3fbcfe=_0x31b92e;_0x227fed=0xc8;}else{_0x227fed=0xce;}_0x9fb976['status'](_0x227fed);return _0x9fb976[_0x3466('0x1e')]('Content-Range',_0xbce97f+'-'+_0x3fbcfe+'/'+_0x31b92e)[_0x3466('0x1b')](_0x1e3764);}return null;};}function patchUpdates(_0x36509f){return function(_0x4ee231){try{jsonpatch[_0x3466('0x1f')](_0x4ee231,_0x36509f,!![]);}catch(_0x5e3a93){return BPromise[_0x3466('0x20')](_0x5e3a93);}return _0x4ee231[_0x3466('0x21')]();};}function saveUpdates(_0x31a198,_0x2074f7){return function(_0x1c4b14){if(_0x1c4b14){return _0x1c4b14[_0x3466('0x22')](_0x31a198)[_0x3466('0x23')](function(_0x38ae04){return _0x38ae04;});}return null;};}function removeEntity(_0x7cb757,_0x162c83){return function(_0x54a8ce){if(_0x54a8ce){return _0x54a8ce['destroy']()[_0x3466('0x23')](function(){var _0x4bb0d4=_0x54a8ce['get']({'plain':!![]});var _0x5c92a9=_0x3466('0x24');return db[_0x3466('0x25')][_0x3466('0x26')]({'where':{'type':_0x5c92a9,'resourceId':_0x4bb0d4['id']}})[_0x3466('0x23')](function(){return _0x54a8ce;});})['then'](function(){_0x7cb757[_0x3466('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x577b22,_0xc262cb){return function(_0xad9256){if(!_0xad9256){_0x577b22[_0x3466('0x19')](0x194);}return _0xad9256;};}function handleError(_0x4b57df,_0x4551e9){_0x4551e9=_0x4551e9||0x1f4;return function(_0x2764dc){logger['error'](_0x2764dc[_0x3466('0x27')]);if(_0x2764dc[_0x3466('0x28')]){delete _0x2764dc[_0x3466('0x28')];}_0x4b57df['status'](_0x4551e9)['send'](_0x2764dc);};}exports[_0x3466('0x29')]=function(_0x3a6550,_0x5d41d5){var _0x54e8d5={},_0x105a11={},_0x2ff695={'count':0x0,'rows':[]};var _0x13a3e0=_[_0x3466('0x2a')](db[_0x3466('0x2b')][_0x3466('0x2c')],function(_0x20cd2b){return{'name':_0x20cd2b[_0x3466('0x2d')],'type':_0x20cd2b['type'][_0x3466('0x2e')]};});_0x105a11[_0x3466('0x2f')]=_[_0x3466('0x2a')](_0x13a3e0,'name');_0x105a11[_0x3466('0x30')]=_[_0x3466('0x31')](_0x3a6550[_0x3466('0x30')]);_0x105a11[_0x3466('0x32')]=_[_0x3466('0x33')](_0x105a11[_0x3466('0x2f')],_0x105a11['query']);_0x54e8d5[_0x3466('0x34')]=_[_0x3466('0x33')](_0x105a11['model'],qs[_0x3466('0x35')](_0x3a6550[_0x3466('0x30')][_0x3466('0x35')]));_0x54e8d5[_0x3466('0x34')]=_0x54e8d5[_0x3466('0x34')][_0x3466('0x36')]?_0x54e8d5['attributes']:_0x105a11[_0x3466('0x2f')];if(!_0x3a6550['query'][_0x3466('0x37')](_0x3466('0x38'))){_0x54e8d5[_0x3466('0x1d')]=qs['limit'](_0x3a6550[_0x3466('0x30')]['limit']);_0x54e8d5[_0x3466('0x1c')]=qs[_0x3466('0x1c')](_0x3a6550['query'][_0x3466('0x1c')]);}_0x54e8d5[_0x3466('0x39')]=qs[_0x3466('0x3a')](_0x3a6550[_0x3466('0x30')][_0x3466('0x3a')]);_0x54e8d5['where']=qs[_0x3466('0x32')](_[_0x3466('0x3b')](_0x3a6550[_0x3466('0x30')],_0x105a11[_0x3466('0x32')]),_0x13a3e0);if(_0x3a6550[_0x3466('0x30')][_0x3466('0x3c')]){_0x54e8d5[_0x3466('0x3d')]=_['merge'](_0x54e8d5[_0x3466('0x3d')],{'$or':_[_0x3466('0x2a')](_0x13a3e0,function(_0x5ace2d){if(_0x5ace2d[_0x3466('0x3e')]!==_0x3466('0x3f')){var _0x1e15cc={};_0x1e15cc[_0x5ace2d[_0x3466('0x28')]]={'$like':'%'+_0x3a6550[_0x3466('0x30')][_0x3466('0x3c')]+'%'};return _0x1e15cc;}})});}_0x54e8d5=_[_0x3466('0x40')]({},_0x54e8d5,_0x3a6550[_0x3466('0x41')]);var _0x57cb2d={'where':_0x54e8d5['where']};return db[_0x3466('0x2b')]['count'](_0x57cb2d)[_0x3466('0x23')](function(_0x1a9c53){_0x2ff695['count']=_0x1a9c53;if(_0x3a6550[_0x3466('0x30')][_0x3466('0x42')]){_0x54e8d5[_0x3466('0x43')]=[{'all':!![]}];}return db[_0x3466('0x2b')]['findAll'](_0x54e8d5);})[_0x3466('0x23')](function(_0x177341){_0x2ff695[_0x3466('0x44')]=_0x177341;return _0x2ff695;})[_0x3466('0x23')](respondWithFilteredResult(_0x5d41d5,_0x54e8d5))[_0x3466('0x45')](handleError(_0x5d41d5,null));};exports[_0x3466('0x46')]=function(_0x548eb3,_0x412555){var _0x5ca181={'raw':!![],'where':{'id':_0x548eb3['params']['id']}},_0x5755e0={};_0x5755e0[_0x3466('0x2f')]=_['keys'](db[_0x3466('0x2b')][_0x3466('0x2c')]);_0x5755e0[_0x3466('0x30')]=_[_0x3466('0x31')](_0x548eb3[_0x3466('0x30')]);_0x5755e0[_0x3466('0x32')]=_[_0x3466('0x33')](_0x5755e0['model'],_0x5755e0['query']);_0x5ca181[_0x3466('0x34')]=_[_0x3466('0x33')](_0x5755e0[_0x3466('0x2f')],qs['fields'](_0x548eb3[_0x3466('0x30')]['fields']));_0x5ca181['attributes']=_0x5ca181[_0x3466('0x34')][_0x3466('0x36')]?_0x5ca181['attributes']:_0x5755e0['model'];if(_0x548eb3['query'][_0x3466('0x42')]){_0x5ca181[_0x3466('0x43')]=[{'all':!![]}];}_0x5ca181=_[_0x3466('0x40')]({},_0x5ca181,_0x548eb3[_0x3466('0x41')]);return db[_0x3466('0x2b')][_0x3466('0x47')](_0x5ca181)[_0x3466('0x23')](handleEntityNotFound(_0x412555,null))['then'](respondWithResult(_0x412555,null))['catch'](handleError(_0x412555,null));};exports[_0x3466('0x48')]=function(_0x14d1c6,_0x31cb7e){return db[_0x3466('0x2b')][_0x3466('0x48')](_0x14d1c6[_0x3466('0x49')],{})[_0x3466('0x23')](function(_0x34af57){var _0x2042c5=_0x14d1c6[_0x3466('0x4a')][_0x3466('0x4b')]({'plain':!![]});if(!_0x2042c5)throw new Error(_0x3466('0x4c'));if(_0x2042c5[_0x3466('0x4d')]===_0x3466('0x4a')){var _0xe6394=_0x34af57[_0x3466('0x4b')]({'plain':!![]});var _0x4b7c6d=_0x3466('0x24');return db['UserProfileSection'][_0x3466('0x47')]({'where':{'name':_0x4b7c6d,'userProfileId':_0x2042c5['userProfileId']},'raw':!![]})['then'](function(_0x55e862){if(_0x55e862&&_0x55e862[_0x3466('0x4e')]===0x0){return db[_0x3466('0x25')][_0x3466('0x48')]({'name':_0xe6394[_0x3466('0x28')],'resourceId':_0xe6394['id'],'type':_0x55e862[_0x3466('0x28')],'sectionId':_0x55e862['id']},{})[_0x3466('0x23')](function(){return _0x34af57;});}else{return _0x34af57;}})[_0x3466('0x45')](function(_0x307908){logger[_0x3466('0x4f')](_0x3466('0x50'),_0x307908);throw _0x307908;});}return _0x34af57;})[_0x3466('0x23')](respondWithResult(_0x31cb7e,0xc9))[_0x3466('0x45')](handleError(_0x31cb7e,null));};exports[_0x3466('0x22')]=function(_0x49eb0f,_0x19f479){if(_0x49eb0f[_0x3466('0x49')]['id']){delete _0x49eb0f[_0x3466('0x49')]['id'];}return db[_0x3466('0x2b')][_0x3466('0x47')]({'where':{'id':_0x49eb0f[_0x3466('0x51')]['id']}})['then'](handleEntityNotFound(_0x19f479,null))['then'](saveUpdates(_0x49eb0f[_0x3466('0x49')],null))[_0x3466('0x23')](respondWithResult(_0x19f479,null))['catch'](handleError(_0x19f479,null));};exports[_0x3466('0x26')]=function(_0x334b02,_0x5ac761){return db[_0x3466('0x2b')][_0x3466('0x47')]({'where':{'id':_0x334b02[_0x3466('0x51')]['id']}})[_0x3466('0x23')](handleEntityNotFound(_0x5ac761,null))['then'](removeEntity(_0x5ac761,null))[_0x3466('0x45')](handleError(_0x5ac761,null));};exports[_0x3466('0x52')]=function(_0x318896,_0x2f04be,_0x2bee42){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x318896[_0x3466('0x51')]['id']},'attributes':[_0x3466('0x28'),_0x3466('0x53'),_0x3466('0x54'),_0x3466('0x55')],'raw':!![]})[_0x3466('0x23')](handleEntityNotFound(_0x2f04be,null))[_0x3466('0x23')](function(_0x2592b0){if(_0x2592b0){if(!fs[_0x3466('0x56')](path[_0x3466('0x57')](config[_0x3466('0x58')],_0x3466('0x59'),_0x2592b0[_0x3466('0x54')]))){throw new db[(_0x3466('0x5a'))][(_0x3466('0x5b'))](_0x3466('0x5c'));}if(_0x318896[_0x3466('0x30')]['exists']){return _0x2f04be['sendStatus'](0xc8);}return _0x2f04be[_0x3466('0x52')](path['join'](config[_0x3466('0x58')],'server/files/reports',_0x2592b0[_0x3466('0x54')]),util[_0x3466('0x5d')](_0x3466('0x5e'),_0x2592b0['basename']||_0x2592b0['name'],_0x2592b0[_0x3466('0x55')][_0x3466('0x5f')]()));}})['catch'](handleError(_0x2f04be,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0b60c88..adf12e2 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 _0xd098=['define','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd098,0x10c));var _0x8d09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd098[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8d09('0x0'));var util=require(_0x8d09('0x1'));var logger=require(_0x8d09('0x2'))(_0x8d09('0x3'));var moment=require(_0x8d09('0x4'));var BPromise=require(_0x8d09('0x5'));var rp=require(_0x8d09('0x6'));var fs=require('fs');var path=require(_0x8d09('0x7'));var rimraf=require(_0x8d09('0x8'));var config=require(_0x8d09('0x9'));var attributes=require(_0x8d09('0xa'));module[_0x8d09('0xb')]=function(_0x461cda,_0x20d9f1){return _0x461cda[_0x8d09('0xc')](_0x8d09('0xd'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7976=['rimraf','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x52f3ee,_0x37231e){var _0x1aaf10=function(_0xdf38d5){while(--_0xdf38d5){_0x52f3ee['push'](_0x52f3ee['shift']());}};_0x1aaf10(++_0x37231e);}(_0x7976,0x1a7));var _0x6797=function(_0x1139db,_0x5aa864){_0x1139db=_0x1139db-0x0;var _0x1c1917=_0x7976[_0x1139db];return _0x1c1917;};'use strict';var _=require(_0x6797('0x0'));var util=require(_0x6797('0x1'));var logger=require(_0x6797('0x2'))(_0x6797('0x3'));var moment=require(_0x6797('0x4'));var BPromise=require(_0x6797('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6797('0x6'));var rimraf=require(_0x6797('0x7'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x321a33,_0x27b99f){return _0x321a33[_0x6797('0x8')](_0x6797('0x9'),attributes,{'tableName':'analytics_extracted_reports','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 6d3b52f..964f51c 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 _0x74ba=['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','message','lodash','util','moment'];(function(_0x132886,_0x1b56cb){var _0x333c46=function(_0x28aa59){while(--_0x28aa59){_0x132886['push'](_0x132886['shift']());}};_0x333c46(++_0x1b56cb);}(_0x74ba,0x115));var _0xa74b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x74ba[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xa74b('0x0'));var util=require(_0xa74b('0x1'));var moment=require(_0xa74b('0x2'));var BPromise=require(_0xa74b('0x3'));var rs=require(_0xa74b('0x4'));var fs=require('fs');var Redis=require(_0xa74b('0x5'));var db=require(_0xa74b('0x6'))['db'];var utils=require(_0xa74b('0x7'));var logger=require(_0xa74b('0x8'))(_0xa74b('0x9'));var config=require(_0xa74b('0xa'));var jayson=require(_0xa74b('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d49a4,_0x4849e8,_0x4197e2){return new BPromise(function(_0x1bbfd6,_0x14548c){return client[_0xa74b('0xc')](_0x3d49a4,_0x4197e2)['then'](function(_0x4cde51){logger[_0xa74b('0xd')](_0xa74b('0xe'),_0x4849e8,_0xa74b('0xf'));logger['debug'](_0xa74b('0x10'),_0x4849e8,_0xa74b('0xf'),JSON[_0xa74b('0x11')](_0x4cde51));if(_0x4cde51[_0xa74b('0x12')]){if(_0x4cde51[_0xa74b('0x12')]['code']===0x1f4){logger[_0xa74b('0x12')](_0xa74b('0xe'),_0x4849e8,_0x4cde51['error'][_0xa74b('0x13')]);return _0x14548c(_0x4cde51['error'][_0xa74b('0x13')]);}logger[_0xa74b('0x12')](_0xa74b('0xe'),_0x4849e8,_0x4cde51[_0xa74b('0x12')]['message']);return _0x1bbfd6(_0x4cde51[_0xa74b('0x12')][_0xa74b('0x13')]);}else{logger[_0xa74b('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4849e8,'request\x20sent');_0x1bbfd6(_0x4cde51['result']['message']);}})['catch'](function(_0x1b7ad7){logger['error'](_0xa74b('0xe'),_0x4849e8,_0x1b7ad7);_0x14548c(_0x1b7ad7);});});} \ No newline at end of file +var _0x7215=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3a7e64,_0x11f743){var _0x1eb337=function(_0xf1d570){while(--_0xf1d570){_0x3a7e64['push'](_0x3a7e64['shift']());}};_0x1eb337(++_0x11f743);}(_0x7215,0xde));var _0x5721=function(_0x414810,_0x5e924d){_0x414810=_0x414810-0x0;var _0x2d4df5=_0x7215[_0x414810];return _0x2d4df5;};'use strict';var _=require(_0x5721('0x0'));var util=require(_0x5721('0x1'));var moment=require(_0x5721('0x2'));var BPromise=require('bluebird');var rs=require(_0x5721('0x3'));var fs=require('fs');var Redis=require(_0x5721('0x4'));var db=require(_0x5721('0x5'))['db'];var utils=require(_0x5721('0x6'));var logger=require(_0x5721('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5721('0x8')][_0x5721('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534b10,_0x159801,_0x1f2d5e){return new BPromise(function(_0x5af87b,_0x18d35f){return client[_0x5721('0xa')](_0x534b10,_0x1f2d5e)[_0x5721('0xb')](function(_0x41d3e5){logger[_0x5721('0xc')](_0x5721('0xd'),_0x159801,_0x5721('0xe'));logger['debug'](_0x5721('0xf'),_0x159801,'request\x20sent',JSON['stringify'](_0x41d3e5));if(_0x41d3e5['error']){if(_0x41d3e5[_0x5721('0x10')][_0x5721('0x11')]===0x1f4){logger[_0x5721('0x10')](_0x5721('0xd'),_0x159801,_0x41d3e5[_0x5721('0x10')][_0x5721('0x12')]);return _0x18d35f(_0x41d3e5[_0x5721('0x10')]['message']);}logger[_0x5721('0x10')](_0x5721('0xd'),_0x159801,_0x41d3e5[_0x5721('0x10')][_0x5721('0x12')]);return _0x5af87b(_0x41d3e5['error'][_0x5721('0x12')]);}else{logger[_0x5721('0xc')](_0x5721('0xd'),_0x159801,'request\x20sent');_0x5af87b(_0x41d3e5['result'][_0x5721('0x12')]);}})[_0x5721('0x13')](function(_0x47e7c0){logger[_0x5721('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x159801,_0x47e7c0);_0x18d35f(_0x47e7c0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0fb103e..9fa5009 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 _0x0e1e=['update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','/:id/download','isAuthenticated','post','create','put'];(function(_0x8e23b8,_0x3c520d){var _0x14bd74=function(_0xa4f16e){while(--_0xa4f16e){_0x8e23b8['push'](_0x8e23b8['shift']());}};_0x14bd74(++_0x3c520d);}(_0x0e1e,0x8f));var _0xe0e1=function(_0x200095,_0x41e7ef){_0x200095=_0x200095-0x0;var _0x4a4644=_0x0e1e[_0x200095];return _0x4a4644;};'use strict';var multer=require('multer');var util=require(_0xe0e1('0x0'));var path=require(_0xe0e1('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0e1('0x2'));var router=express[_0xe0e1('0x3')]();var fs_extra=require(_0xe0e1('0x4'));var auth=require(_0xe0e1('0x5'));var interaction=require(_0xe0e1('0x6'));var config=require(_0xe0e1('0x7'));var controller=require(_0xe0e1('0x8'));router[_0xe0e1('0x9')]('/',auth['isAuthenticated'](),controller[_0xe0e1('0xa')]);router[_0xe0e1('0x9')](_0xe0e1('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe0e1('0xc'),auth[_0xe0e1('0xd')](),controller['download']);router[_0xe0e1('0xe')]('/',auth['isAuthenticated'](),controller[_0xe0e1('0xf')]);router[_0xe0e1('0x10')](_0xe0e1('0xb'),auth[_0xe0e1('0xd')](),controller[_0xe0e1('0x11')]);router[_0xe0e1('0x12')](_0xe0e1('0xb'),auth[_0xe0e1('0xd')](),controller[_0xe0e1('0x13')]);module['exports']=router; \ No newline at end of file +var _0xaa7d=['get','index','/:id','show','/:id/download','isAuthenticated','create','update','destroy','util','connect-timeout','express','fs-extra','../../config/environment','./analyticExtractedReport.controller'];(function(_0x55ab6a,_0x1c1aef){var _0x2bbccf=function(_0x3a2ce0){while(--_0x3a2ce0){_0x55ab6a['push'](_0x55ab6a['shift']());}};_0x2bbccf(++_0x1c1aef);}(_0xaa7d,0x1cb));var _0xdaa7=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xaa7d[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require('multer');var util=require(_0xdaa7('0x0'));var path=require('path');var timeout=require(_0xdaa7('0x1'));var express=require(_0xdaa7('0x2'));var router=express['Router']();var fs_extra=require(_0xdaa7('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdaa7('0x4'));var controller=require(_0xdaa7('0x5'));router[_0xdaa7('0x6')]('/',auth['isAuthenticated'](),controller[_0xdaa7('0x7')]);router[_0xdaa7('0x6')](_0xdaa7('0x8'),auth['isAuthenticated'](),controller[_0xdaa7('0x9')]);router[_0xdaa7('0x6')](_0xdaa7('0xa'),auth[_0xdaa7('0xb')](),controller['download']);router['post']('/',auth[_0xdaa7('0xb')](),controller[_0xdaa7('0xc')]);router['put'](_0xdaa7('0x8'),auth[_0xdaa7('0xb')](),controller[_0xdaa7('0xd')]);router['delete'](_0xdaa7('0x8'),auth['isAuthenticated'](),controller[_0xdaa7('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index af02b7a..38251d0 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 _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x4adc70,_0x1d2741){var _0xa8509f=function(_0x566379){while(--_0x566379){_0x4adc70['push'](_0x4adc70['shift']());}};_0xa8509f(++_0x1d2741);}(_0x7a54,0x106));var _0x47a5=function(_0x1ffe5f,_0x1c8bfd){_0x1ffe5f=_0x1ffe5f-0x0;var _0x3c4bb5=_0x7a54[_0x1ffe5f];return _0x3c4bb5;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x5ccd89,_0x2bdfa3){var _0x5f35f7=function(_0x3876fc){while(--_0x3876fc){_0x5ccd89['push'](_0x5ccd89['shift']());}};_0x5f35f7(++_0x2bdfa3);}(_0x1261,0x144));var _0x1126=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x1261[_0x27604f];return _0x40d189;};'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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 18dba18..7bf1aa1 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 _0xa187=['query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','create','bulkCreate','find','destroy','params','bulkDestroy','ids','addFields','sequelize','transaction','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa187,0xbf));var _0x7a18=function(_0x4da196,_0x357dc9){_0x4da196=_0x4da196-0x0;var _0x375df3=_0xa187[_0x4da196];return _0x375df3;};'use strict';var pdf=require(_0x7a18('0x0'));var emlformat=require(_0x7a18('0x1'));var rimraf=require(_0x7a18('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a18('0x3'));var rp=require(_0x7a18('0x4'));var moment=require('moment');var BPromise=require(_0x7a18('0x5'));var Mustache=require('mustache');var util=require(_0x7a18('0x6'));var path=require(_0x7a18('0x7'));var sox=require(_0x7a18('0x8'));var csv=require('to-csv');var ejs=require(_0x7a18('0x9'));var fs=require('fs');var fs_extra=require(_0x7a18('0xa'));var _=require(_0x7a18('0xb'));var squel=require('squel');var crypto=require(_0x7a18('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7a18('0xd'));var toCsv=require(_0x7a18('0xe'));var querystring=require(_0x7a18('0xf'));var Papa=require('papaparse');var Redis=require(_0x7a18('0x10'));var authService=require(_0x7a18('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7a18('0x12'));var hardwareService=require(_0x7a18('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7a18('0x14'));var config=require(_0x7a18('0x15'));var licenseUtil=require(_0x7a18('0x16'));var db=require(_0x7a18('0x17'))['db'];function respondWithStatusCode(_0xb6972c,_0x569e1f){_0x569e1f=_0x569e1f||0xcc;return function(_0x782c16){if(_0x782c16){return _0xb6972c[_0x7a18('0x18')](_0x569e1f);}return _0xb6972c['status'](_0x569e1f)['end']();};}function respondWithResult(_0x14bfda,_0x3f25d0){_0x3f25d0=_0x3f25d0||0xc8;return function(_0x3aa338){if(_0x3aa338){return _0x14bfda[_0x7a18('0x19')](_0x3f25d0)[_0x7a18('0x1a')](_0x3aa338);}};}function respondWithFilteredResult(_0x5d3f0f,_0x3e63b9){return function(_0xb24695){if(_0xb24695){var _0x5a69ed=_0xb24695['count'],_0xb1401c=_0x3e63b9[_0x7a18('0x1b')],_0x520964=_0x3e63b9[_0x7a18('0x1b')]+_0x3e63b9[_0x7a18('0x1c')],_0x93f011;if(_0x520964>=_0x5a69ed){_0x520964=_0x5a69ed;_0x93f011=0xc8;}else{_0x93f011=0xce;}_0x5d3f0f[_0x7a18('0x19')](_0x93f011);return _0x5d3f0f[_0x7a18('0x1d')](_0x7a18('0x1e'),_0xb1401c+'-'+_0x520964+'/'+_0x5a69ed)[_0x7a18('0x1a')](_0xb24695);}return null;};}function patchUpdates(_0x377ec7){return function(_0x582d31){try{jsonpatch[_0x7a18('0x1f')](_0x582d31,_0x377ec7,!![]);}catch(_0x445b89){return BPromise['reject'](_0x445b89);}return _0x582d31[_0x7a18('0x20')]();};}function saveUpdates(_0x191603,_0x3ec4fa){return function(_0x567884){if(_0x567884){return _0x567884[_0x7a18('0x21')](_0x191603)[_0x7a18('0x22')](function(_0x149af3){return _0x149af3;});}return null;};}function removeEntity(_0x4e2d20,_0x325f5d){return function(_0x531975){if(_0x531975){return _0x531975['destroy']()['then'](function(){_0x4e2d20['status'](0xcc)[_0x7a18('0x23')]();});}};}function handleEntityNotFound(_0xc2a6e4,_0x1dcfed){return function(_0x29a454){if(!_0x29a454){_0xc2a6e4[_0x7a18('0x18')](0x194);}return _0x29a454;};}function handleError(_0x21e636,_0x3cdf3d){_0x3cdf3d=_0x3cdf3d||0x1f4;return function(_0x4f0aa0){logger[_0x7a18('0x24')](_0x4f0aa0[_0x7a18('0x25')]);if(_0x4f0aa0[_0x7a18('0x26')]){delete _0x4f0aa0[_0x7a18('0x26')];}_0x21e636[_0x7a18('0x19')](_0x3cdf3d)[_0x7a18('0x27')](_0x4f0aa0);};}exports['index']=function(_0xe9b2ef,_0x23968a){var _0x4a40e2={},_0x682404={},_0x2df885={'count':0x0,'rows':[]};var _0x238f6d=_[_0x7a18('0x28')](db[_0x7a18('0x29')][_0x7a18('0x2a')],function(_0x18237b){return{'name':_0x18237b[_0x7a18('0x2b')],'type':_0x18237b[_0x7a18('0x2c')]['key']};});_0x682404['model']=_[_0x7a18('0x28')](_0x238f6d,_0x7a18('0x26'));_0x682404['query']=_[_0x7a18('0x2d')](_0xe9b2ef[_0x7a18('0x2e')]);_0x682404[_0x7a18('0x2f')]=_['intersection'](_0x682404[_0x7a18('0x30')],_0x682404['query']);_0x4a40e2['attributes']=_[_0x7a18('0x31')](_0x682404[_0x7a18('0x30')],qs[_0x7a18('0x32')](_0xe9b2ef[_0x7a18('0x2e')][_0x7a18('0x32')]));_0x4a40e2[_0x7a18('0x33')]=_0x4a40e2[_0x7a18('0x33')][_0x7a18('0x34')]?_0x4a40e2[_0x7a18('0x33')]:_0x682404['model'];if(!_0xe9b2ef[_0x7a18('0x2e')][_0x7a18('0x35')](_0x7a18('0x36'))){_0x4a40e2['limit']=qs[_0x7a18('0x1c')](_0xe9b2ef[_0x7a18('0x2e')][_0x7a18('0x1c')]);_0x4a40e2[_0x7a18('0x1b')]=qs[_0x7a18('0x1b')](_0xe9b2ef[_0x7a18('0x2e')][_0x7a18('0x1b')]);}_0x4a40e2[_0x7a18('0x37')]=qs['sort'](_0xe9b2ef['query'][_0x7a18('0x38')]);_0x4a40e2[_0x7a18('0x39')]=qs[_0x7a18('0x2f')](_[_0x7a18('0x3a')](_0xe9b2ef[_0x7a18('0x2e')],_0x682404[_0x7a18('0x2f')]),_0x238f6d);if(_0xe9b2ef[_0x7a18('0x2e')]['filter']){_0x4a40e2[_0x7a18('0x39')]=_['merge'](_0x4a40e2[_0x7a18('0x39')],{'$or':_[_0x7a18('0x28')](_0x238f6d,function(_0x5d0a55){if(_0x5d0a55['type']!==_0x7a18('0x3b')){var _0x487c4c={};_0x487c4c[_0x5d0a55[_0x7a18('0x26')]]={'$like':'%'+_0xe9b2ef[_0x7a18('0x2e')][_0x7a18('0x3c')]+'%'};return _0x487c4c;}})});}_0x4a40e2=_[_0x7a18('0x3d')]({},_0x4a40e2,_0xe9b2ef[_0x7a18('0x3e')]);var _0xe97c95={'where':_0x4a40e2[_0x7a18('0x39')]};return db[_0x7a18('0x29')][_0x7a18('0x3f')](_0xe97c95)[_0x7a18('0x22')](function(_0x5abd07){_0x2df885[_0x7a18('0x3f')]=_0x5abd07;if(_0xe9b2ef['query'][_0x7a18('0x40')]){_0x4a40e2[_0x7a18('0x41')]=[{'all':!![]}];}return db[_0x7a18('0x29')][_0x7a18('0x42')](_0x4a40e2);})['then'](function(_0x289c31){_0x2df885[_0x7a18('0x43')]=_0x289c31;return _0x2df885;})['then'](respondWithFilteredResult(_0x23968a,_0x4a40e2))[_0x7a18('0x44')](handleError(_0x23968a,null));};exports['show']=function(_0x15d56c,_0x84a773){var _0x2a7e7e={'raw':![],'where':{'id':_0x15d56c['params']['id']}},_0x309b5a={};_0x309b5a[_0x7a18('0x30')]=_[_0x7a18('0x2d')](db[_0x7a18('0x29')][_0x7a18('0x2a')]);_0x309b5a[_0x7a18('0x2e')]=_[_0x7a18('0x2d')](_0x15d56c[_0x7a18('0x2e')]);_0x309b5a[_0x7a18('0x2f')]=_[_0x7a18('0x31')](_0x309b5a['model'],_0x309b5a['query']);_0x2a7e7e[_0x7a18('0x33')]=_[_0x7a18('0x31')](_0x309b5a[_0x7a18('0x30')],qs[_0x7a18('0x32')](_0x15d56c['query'][_0x7a18('0x32')]));_0x2a7e7e[_0x7a18('0x33')]=_0x2a7e7e[_0x7a18('0x33')][_0x7a18('0x34')]?_0x2a7e7e[_0x7a18('0x33')]:_0x309b5a[_0x7a18('0x30')];if(_0x15d56c['query'][_0x7a18('0x40')]){_0x2a7e7e[_0x7a18('0x41')]=[{'all':!![]}];}_0x2a7e7e=_[_0x7a18('0x3d')]({},_0x2a7e7e,_0x15d56c['options']);return db[_0x7a18('0x29')]['find'](_0x2a7e7e)[_0x7a18('0x22')](handleEntityNotFound(_0x84a773,null))[_0x7a18('0x22')](respondWithResult(_0x84a773,null))['catch'](handleError(_0x84a773,null));};exports['create']=function(_0x11160e,_0x1a9e38){return db[_0x7a18('0x29')][_0x7a18('0x45')](_0x11160e['body'],{})['then'](respondWithResult(_0x1a9e38,0xc9))['catch'](handleError(_0x1a9e38,null));};exports[_0x7a18('0x46')]=function(_0x264e82,_0x28bde7){return db['AnalyticFieldReport'][_0x7a18('0x46')](_0x264e82['body'],{'raw':![],'individualHooks':!![]})[_0x7a18('0x22')](respondWithResult(_0x28bde7,0xc9))['catch'](handleError(_0x28bde7,null));};exports[_0x7a18('0x21')]=function(_0x5ee266,_0x56e712){if(_0x5ee266['body']['id']){delete _0x5ee266['body']['id'];}return db['AnalyticFieldReport'][_0x7a18('0x47')]({'where':{'id':_0x5ee266['params']['id']}})['then'](handleEntityNotFound(_0x56e712,null))[_0x7a18('0x22')](saveUpdates(_0x5ee266['body'],null))[_0x7a18('0x22')](respondWithResult(_0x56e712,null))[_0x7a18('0x44')](handleError(_0x56e712,null));};exports[_0x7a18('0x48')]=function(_0x1bd17e,_0x2cde85){return db[_0x7a18('0x29')]['find']({'where':{'id':_0x1bd17e[_0x7a18('0x49')]['id']}})[_0x7a18('0x22')](handleEntityNotFound(_0x2cde85,null))[_0x7a18('0x22')](removeEntity(_0x2cde85,null))['catch'](handleError(_0x2cde85,null));};exports[_0x7a18('0x4a')]=function(_0x37cdd8,_0x37e2b9){return db[_0x7a18('0x29')]['destroy']({'where':{'id':_0x37cdd8['query'][_0x7a18('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x7a18('0x22')](respondWithResult(_0x37e2b9,0xcc))[_0x7a18('0x44')](handleError(_0x37e2b9,null));};exports[_0x7a18('0x4c')]=function(_0x14c888,_0x2ff822,_0x5140b6){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x14c888['params']['id']}})[_0x7a18('0x22')](handleEntityNotFound(_0x2ff822,null))[_0x7a18('0x22')](function(_0x231c5d){if(_0x231c5d){return db[_0x7a18('0x4d')][_0x7a18('0x4e')](function(_0x3431a6){return db[_0x7a18('0x29')][_0x7a18('0x48')]({'where':{'CustomReportId':_0x14c888[_0x7a18('0x49')]['id']},'transaction':_0x3431a6})[_0x7a18('0x22')](function(_0x428af7){var _0x3bf216=_[_0x7a18('0x28')](_0x14c888['body'],function(_0xacbc0d){delete _0xacbc0d['id'];_0xacbc0d['CustomReportId']=_0x14c888[_0x7a18('0x49')]['id'];return _0xacbc0d;});return db['AnalyticFieldReport']['bulkCreate'](_0x3bf216,{'transaction':_0x3431a6});});})[_0x7a18('0x22')](function(){return db[_0x7a18('0x29')]['findAll']({'where':{'CustomReportId':_0x14c888[_0x7a18('0x49')]['id']}});});}})[_0x7a18('0x22')](respondWithResult(_0x2ff822,null))[_0x7a18('0x44')](handleError(_0x2ff822,null));}; \ No newline at end of file +var _0x3a84=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','create','body','bulkCreate','find','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x2eced5,_0x263a47){var _0x5a3be2=function(_0x56092c){while(--_0x56092c){_0x2eced5['push'](_0x2eced5['shift']());}};_0x5a3be2(++_0x263a47);}(_0x3a84,0x1d5));var _0x43a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a84[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x43a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43a8('0x1'));var jsonpatch=require(_0x43a8('0x2'));var rp=require('request-promise');var moment=require(_0x43a8('0x3'));var BPromise=require(_0x43a8('0x4'));var Mustache=require('mustache');var util=require(_0x43a8('0x5'));var path=require('path');var sox=require(_0x43a8('0x6'));var csv=require(_0x43a8('0x7'));var ejs=require(_0x43a8('0x8'));var fs=require('fs');var fs_extra=require(_0x43a8('0x9'));var _=require(_0x43a8('0xa'));var squel=require(_0x43a8('0xb'));var crypto=require(_0x43a8('0xc'));var jsforce=require(_0x43a8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x43a8('0x7'));var querystring=require(_0x43a8('0xe'));var Papa=require(_0x43a8('0xf'));var Redis=require(_0x43a8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x43a8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43a8('0x12'));var logger=require(_0x43a8('0x13'))(_0x43a8('0x14'));var utils=require(_0x43a8('0x15'));var config=require(_0x43a8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57985b,_0x4225a1){_0x4225a1=_0x4225a1||0xcc;return function(_0x2220ac){if(_0x2220ac){return _0x57985b[_0x43a8('0x17')](_0x4225a1);}return _0x57985b[_0x43a8('0x18')](_0x4225a1)[_0x43a8('0x19')]();};}function respondWithResult(_0x491e1d,_0x1db22a){_0x1db22a=_0x1db22a||0xc8;return function(_0x2bb2c4){if(_0x2bb2c4){return _0x491e1d[_0x43a8('0x18')](_0x1db22a)[_0x43a8('0x1a')](_0x2bb2c4);}};}function respondWithFilteredResult(_0x25a320,_0x40986d){return function(_0x54d18e){if(_0x54d18e){var _0x1f018f=_0x54d18e[_0x43a8('0x1b')],_0x1a2d4f=_0x40986d[_0x43a8('0x1c')],_0x4a6dba=_0x40986d['offset']+_0x40986d[_0x43a8('0x1d')],_0x4274d8;if(_0x4a6dba>=_0x1f018f){_0x4a6dba=_0x1f018f;_0x4274d8=0xc8;}else{_0x4274d8=0xce;}_0x25a320[_0x43a8('0x18')](_0x4274d8);return _0x25a320[_0x43a8('0x1e')](_0x43a8('0x1f'),_0x1a2d4f+'-'+_0x4a6dba+'/'+_0x1f018f)[_0x43a8('0x1a')](_0x54d18e);}return null;};}function patchUpdates(_0x573783){return function(_0x51d112){try{jsonpatch[_0x43a8('0x20')](_0x51d112,_0x573783,!![]);}catch(_0x11b6c3){return BPromise[_0x43a8('0x21')](_0x11b6c3);}return _0x51d112[_0x43a8('0x22')]();};}function saveUpdates(_0x19b052,_0x1e4870){return function(_0xee595d){if(_0xee595d){return _0xee595d[_0x43a8('0x23')](_0x19b052)['then'](function(_0x48b003){return _0x48b003;});}return null;};}function removeEntity(_0x598abc,_0x1830f2){return function(_0x381ef8){if(_0x381ef8){return _0x381ef8[_0x43a8('0x24')]()[_0x43a8('0x25')](function(){_0x598abc['status'](0xcc)[_0x43a8('0x19')]();});}};}function handleEntityNotFound(_0x3bcbd,_0x4855fc){return function(_0x3fecec){if(!_0x3fecec){_0x3bcbd[_0x43a8('0x17')](0x194);}return _0x3fecec;};}function handleError(_0x3f6f0f,_0x331997){_0x331997=_0x331997||0x1f4;return function(_0x156508){logger[_0x43a8('0x26')](_0x156508[_0x43a8('0x27')]);if(_0x156508[_0x43a8('0x28')]){delete _0x156508[_0x43a8('0x28')];}_0x3f6f0f[_0x43a8('0x18')](_0x331997)[_0x43a8('0x29')](_0x156508);};}exports[_0x43a8('0x2a')]=function(_0x1608e0,_0x67f5c4){var _0x191eb8={},_0xb978bb={},_0x317e4a={'count':0x0,'rows':[]};var _0x2043a1=_[_0x43a8('0x2b')](db[_0x43a8('0x2c')][_0x43a8('0x2d')],function(_0x18de98){return{'name':_0x18de98[_0x43a8('0x2e')],'type':_0x18de98[_0x43a8('0x2f')]['key']};});_0xb978bb['model']=_[_0x43a8('0x2b')](_0x2043a1,_0x43a8('0x28'));_0xb978bb[_0x43a8('0x30')]=_[_0x43a8('0x31')](_0x1608e0[_0x43a8('0x30')]);_0xb978bb[_0x43a8('0x32')]=_[_0x43a8('0x33')](_0xb978bb['model'],_0xb978bb['query']);_0x191eb8[_0x43a8('0x34')]=_[_0x43a8('0x33')](_0xb978bb[_0x43a8('0x35')],qs['fields'](_0x1608e0[_0x43a8('0x30')]['fields']));_0x191eb8['attributes']=_0x191eb8['attributes'][_0x43a8('0x36')]?_0x191eb8[_0x43a8('0x34')]:_0xb978bb['model'];if(!_0x1608e0['query'][_0x43a8('0x37')](_0x43a8('0x38'))){_0x191eb8[_0x43a8('0x1d')]=qs[_0x43a8('0x1d')](_0x1608e0[_0x43a8('0x30')][_0x43a8('0x1d')]);_0x191eb8[_0x43a8('0x1c')]=qs['offset'](_0x1608e0['query'][_0x43a8('0x1c')]);}_0x191eb8[_0x43a8('0x39')]=qs[_0x43a8('0x3a')](_0x1608e0[_0x43a8('0x30')][_0x43a8('0x3a')]);_0x191eb8[_0x43a8('0x3b')]=qs[_0x43a8('0x32')](_[_0x43a8('0x3c')](_0x1608e0[_0x43a8('0x30')],_0xb978bb[_0x43a8('0x32')]),_0x2043a1);if(_0x1608e0[_0x43a8('0x30')][_0x43a8('0x3d')]){_0x191eb8[_0x43a8('0x3b')]=_[_0x43a8('0x3e')](_0x191eb8[_0x43a8('0x3b')],{'$or':_['map'](_0x2043a1,function(_0x320324){if(_0x320324[_0x43a8('0x2f')]!==_0x43a8('0x3f')){var _0x1a12b7={};_0x1a12b7[_0x320324[_0x43a8('0x28')]]={'$like':'%'+_0x1608e0[_0x43a8('0x30')][_0x43a8('0x3d')]+'%'};return _0x1a12b7;}})});}_0x191eb8=_[_0x43a8('0x3e')]({},_0x191eb8,_0x1608e0[_0x43a8('0x40')]);var _0x4db050={'where':_0x191eb8['where']};return db[_0x43a8('0x2c')][_0x43a8('0x1b')](_0x4db050)['then'](function(_0x483e90){_0x317e4a[_0x43a8('0x1b')]=_0x483e90;if(_0x1608e0[_0x43a8('0x30')][_0x43a8('0x41')]){_0x191eb8['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x43a8('0x42')](_0x191eb8);})['then'](function(_0x4650d4){_0x317e4a[_0x43a8('0x43')]=_0x4650d4;return _0x317e4a;})['then'](respondWithFilteredResult(_0x67f5c4,_0x191eb8))[_0x43a8('0x44')](handleError(_0x67f5c4,null));};exports[_0x43a8('0x45')]=function(_0xc8ffa7,_0x4d262c){var _0xb964b2={'raw':![],'where':{'id':_0xc8ffa7[_0x43a8('0x46')]['id']}},_0x403593={};_0x403593['model']=_[_0x43a8('0x31')](db[_0x43a8('0x2c')][_0x43a8('0x2d')]);_0x403593[_0x43a8('0x30')]=_[_0x43a8('0x31')](_0xc8ffa7[_0x43a8('0x30')]);_0x403593['filters']=_[_0x43a8('0x33')](_0x403593['model'],_0x403593[_0x43a8('0x30')]);_0xb964b2['attributes']=_['intersection'](_0x403593[_0x43a8('0x35')],qs['fields'](_0xc8ffa7[_0x43a8('0x30')][_0x43a8('0x47')]));_0xb964b2['attributes']=_0xb964b2[_0x43a8('0x34')][_0x43a8('0x36')]?_0xb964b2[_0x43a8('0x34')]:_0x403593[_0x43a8('0x35')];if(_0xc8ffa7[_0x43a8('0x30')][_0x43a8('0x41')]){_0xb964b2['include']=[{'all':!![]}];}_0xb964b2=_[_0x43a8('0x3e')]({},_0xb964b2,_0xc8ffa7[_0x43a8('0x40')]);return db[_0x43a8('0x2c')]['find'](_0xb964b2)['then'](handleEntityNotFound(_0x4d262c,null))[_0x43a8('0x25')](respondWithResult(_0x4d262c,null))['catch'](handleError(_0x4d262c,null));};exports[_0x43a8('0x48')]=function(_0x1b5021,_0x37ee58){return db['AnalyticFieldReport'][_0x43a8('0x48')](_0x1b5021[_0x43a8('0x49')],{})[_0x43a8('0x25')](respondWithResult(_0x37ee58,0xc9))[_0x43a8('0x44')](handleError(_0x37ee58,null));};exports[_0x43a8('0x4a')]=function(_0xbbfb71,_0xb39319){return db[_0x43a8('0x2c')][_0x43a8('0x4a')](_0xbbfb71['body'],{'raw':![],'individualHooks':!![]})[_0x43a8('0x25')](respondWithResult(_0xb39319,0xc9))['catch'](handleError(_0xb39319,null));};exports['update']=function(_0x366a13,_0x115742){if(_0x366a13['body']['id']){delete _0x366a13['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x366a13[_0x43a8('0x46')]['id']}})[_0x43a8('0x25')](handleEntityNotFound(_0x115742,null))[_0x43a8('0x25')](saveUpdates(_0x366a13[_0x43a8('0x49')],null))['then'](respondWithResult(_0x115742,null))[_0x43a8('0x44')](handleError(_0x115742,null));};exports['destroy']=function(_0x56a78a,_0x4b84e){return db['AnalyticFieldReport'][_0x43a8('0x4b')]({'where':{'id':_0x56a78a['params']['id']}})[_0x43a8('0x25')](handleEntityNotFound(_0x4b84e,null))[_0x43a8('0x25')](removeEntity(_0x4b84e,null))[_0x43a8('0x44')](handleError(_0x4b84e,null));};exports['bulkDestroy']=function(_0x2db6e8,_0x123dbc){return db[_0x43a8('0x2c')]['destroy']({'where':{'id':_0x2db6e8[_0x43a8('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x43a8('0x25')](respondWithResult(_0x123dbc,0xcc))[_0x43a8('0x44')](handleError(_0x123dbc,null));};exports[_0x43a8('0x4c')]=function(_0x3a1c39,_0x407c2e,_0x6feced){return db[_0x43a8('0x4d')][_0x43a8('0x4e')]({'where':{'id':_0x3a1c39[_0x43a8('0x46')]['id']}})[_0x43a8('0x25')](handleEntityNotFound(_0x407c2e,null))['then'](function(_0x5d8f23){if(_0x5d8f23){return db['sequelize'][_0x43a8('0x4f')](function(_0x2af81a){return db[_0x43a8('0x2c')]['destroy']({'where':{'CustomReportId':_0x3a1c39[_0x43a8('0x46')]['id']},'transaction':_0x2af81a})[_0x43a8('0x25')](function(_0x3ff07d){var _0x53dbda=_[_0x43a8('0x2b')](_0x3a1c39[_0x43a8('0x49')],function(_0x5060ba){delete _0x5060ba['id'];_0x5060ba[_0x43a8('0x50')]=_0x3a1c39['params']['id'];return _0x5060ba;});return db['AnalyticFieldReport']['bulkCreate'](_0x53dbda,{'transaction':_0x2af81a});});})['then'](function(){return db[_0x43a8('0x2c')][_0x43a8('0x42')]({'where':{'CustomReportId':_0x3a1c39[_0x43a8('0x46')]['id']}});});}})[_0x43a8('0x25')](respondWithResult(_0x407c2e,null))[_0x43a8('0x44')](handleError(_0x407c2e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 1bca73a..23eaafc 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 _0xef59=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment'];(function(_0xe23e58,_0x59f052){var _0x172d18=function(_0x31e164){while(--_0x31e164){_0xe23e58['push'](_0xe23e58['shift']());}};_0x172d18(++_0x59f052);}(_0xef59,0x190));var _0x9ef5=function(_0x27b2b1,_0x23466d){_0x27b2b1=_0x27b2b1-0x0;var _0x44640e=_0xef59[_0x27b2b1];return _0x44640e;};'use strict';var _=require(_0x9ef5('0x0'));var util=require(_0x9ef5('0x1'));var logger=require(_0x9ef5('0x2'))(_0x9ef5('0x3'));var moment=require(_0x9ef5('0x4'));var BPromise=require(_0x9ef5('0x5'));var rp=require(_0x9ef5('0x6'));var fs=require('fs');var path=require(_0x9ef5('0x7'));var rimraf=require(_0x9ef5('0x8'));var config=require(_0x9ef5('0x9'));var attributes=require(_0x9ef5('0xa'));module[_0x9ef5('0xb')]=function(_0x214d18,_0x43f18b){return _0x214d18[_0x9ef5('0xc')](_0x9ef5('0xd'),attributes,{'tableName':_0x9ef5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcde6=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcde6,0x160));var _0x6cde=function(_0x43bd4f,_0x3cffc5){_0x43bd4f=_0x43bd4f-0x0;var _0x2fd24f=_0xcde6[_0x43bd4f];return _0x2fd24f;};'use strict';var _=require(_0x6cde('0x0'));var util=require(_0x6cde('0x1'));var logger=require(_0x6cde('0x2'))(_0x6cde('0x3'));var moment=require(_0x6cde('0x4'));var BPromise=require(_0x6cde('0x5'));var rp=require(_0x6cde('0x6'));var fs=require('fs');var path=require(_0x6cde('0x7'));var rimraf=require(_0x6cde('0x8'));var config=require(_0x6cde('0x9'));var attributes=require(_0x6cde('0xa'));module[_0x6cde('0xb')]=function(_0x4e0a17,_0x3ce307){return _0x4e0a17[_0x6cde('0xc')](_0x6cde('0xd'),attributes,{'tableName':_0x6cde('0xe'),'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 0c940ea..b48cb06 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 _0x61f8=['request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x571ce8,_0x453d89){var _0x4cfa1d=function(_0xda7419){while(--_0xda7419){_0x571ce8['push'](_0x571ce8['shift']());}};_0x4cfa1d(++_0x453d89);}(_0x61f8,0x78));var _0x861f=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x61f8[_0x1a9e78];return _0x113e06;};'use strict';var _=require(_0x861f('0x0'));var util=require('util');var moment=require(_0x861f('0x1'));var BPromise=require(_0x861f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x861f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x861f('0x4'))('rpc');var config=require(_0x861f('0x5'));var jayson=require(_0x861f('0x6'));var client=jayson[_0x861f('0x7')][_0x861f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a427c,_0x564c68,_0x4caa40){return new BPromise(function(_0x352b2f,_0x3d3aeb){return client[_0x861f('0x9')](_0x1a427c,_0x4caa40)[_0x861f('0xa')](function(_0xdd1c89){logger[_0x861f('0xb')](_0x861f('0xc'),_0x564c68,_0x861f('0xd'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x564c68,_0x861f('0xd'),JSON['stringify'](_0xdd1c89));if(_0xdd1c89['error']){if(_0xdd1c89[_0x861f('0xe')][_0x861f('0xf')]===0x1f4){logger['error'](_0x861f('0xc'),_0x564c68,_0xdd1c89['error'][_0x861f('0x10')]);return _0x3d3aeb(_0xdd1c89[_0x861f('0xe')][_0x861f('0x10')]);}logger[_0x861f('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x564c68,_0xdd1c89[_0x861f('0xe')]['message']);return _0x352b2f(_0xdd1c89['error'][_0x861f('0x10')]);}else{logger['info'](_0x861f('0xc'),_0x564c68,_0x861f('0xd'));_0x352b2f(_0xdd1c89[_0x861f('0x11')][_0x861f('0x10')]);}})[_0x861f('0x12')](function(_0x46affd){logger[_0x861f('0xe')](_0x861f('0xc'),_0x564c68,_0x46affd);_0x3d3aeb(_0x46affd);});});} \ No newline at end of file +var _0x5252=['client','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3db577,_0x514b87){var _0x3cce5f=function(_0x333d1c){while(--_0x333d1c){_0x3db577['push'](_0x3db577['shift']());}};_0x3cce5f(++_0x514b87);}(_0x5252,0x187));var _0x2525=function(_0x5cf071,_0x5cf4d3){_0x5cf071=_0x5cf071-0x0;var _0x228ec6=_0x5252[_0x5cf071];return _0x228ec6;};'use strict';var _=require(_0x2525('0x0'));var util=require(_0x2525('0x1'));var moment=require('moment');var BPromise=require(_0x2525('0x2'));var rs=require(_0x2525('0x3'));var fs=require('fs');var Redis=require(_0x2525('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2525('0x5'));var logger=require(_0x2525('0x6'))('rpc');var config=require(_0x2525('0x7'));var jayson=require(_0x2525('0x8'));var client=jayson[_0x2525('0x9')][_0x2525('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3baee3,_0x2b9510,_0x2d7fcc){return new BPromise(function(_0x451562,_0x2369f7){return client[_0x2525('0xb')](_0x3baee3,_0x2d7fcc)['then'](function(_0x2ba8c8){logger['info'](_0x2525('0xc'),_0x2b9510,_0x2525('0xd'));logger['debug'](_0x2525('0xe'),_0x2b9510,'request\x20sent',JSON[_0x2525('0xf')](_0x2ba8c8));if(_0x2ba8c8['error']){if(_0x2ba8c8[_0x2525('0x10')][_0x2525('0x11')]===0x1f4){logger[_0x2525('0x10')](_0x2525('0xc'),_0x2b9510,_0x2ba8c8[_0x2525('0x10')][_0x2525('0x12')]);return _0x2369f7(_0x2ba8c8[_0x2525('0x10')][_0x2525('0x12')]);}logger['error'](_0x2525('0xc'),_0x2b9510,_0x2ba8c8[_0x2525('0x10')]['message']);return _0x451562(_0x2ba8c8['error']['message']);}else{logger[_0x2525('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2b9510,'request\x20sent');_0x451562(_0x2ba8c8['result'][_0x2525('0x12')]);}})['catch'](function(_0x5a6a19){logger[_0x2525('0x10')](_0x2525('0xc'),_0x2b9510,_0x5a6a19);_0x2369f7(_0x5a6a19);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4e19ae8..6c98535 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 _0x5a9b=['index','get','/:id','create','post','/create_many','/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','connect-timeout','Router','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a9b,0x1bd));var _0xb5a9=function(_0x337784,_0x2c3a17){_0x337784=_0x337784-0x0;var _0x9cea81=_0x5a9b[_0x337784];return _0x9cea81;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb5a9('0x0'));var express=require('express');var router=express[_0xb5a9('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router['get']('/',auth[_0xb5a9('0x2')](),controller[_0xb5a9('0x3')]);router[_0xb5a9('0x4')](_0xb5a9('0x5'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb5a9('0x2')](),controller[_0xb5a9('0x6')]);router[_0xb5a9('0x7')](_0xb5a9('0x8'),auth[_0xb5a9('0x2')](),controller['bulkCreate']);router[_0xb5a9('0x7')](_0xb5a9('0x9'),auth['isAuthenticated'](),controller[_0xb5a9('0xa')]);router[_0xb5a9('0xb')](_0xb5a9('0x5'),auth[_0xb5a9('0x2')](),controller[_0xb5a9('0xc')]);router[_0xb5a9('0xd')]('/destroy_many',auth[_0xb5a9('0x2')](),controller[_0xb5a9('0xe')]);router[_0xb5a9('0xd')](_0xb5a9('0x5'),auth[_0xb5a9('0x2')](),controller[_0xb5a9('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9917=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','addFields','put','update','/destroy_many','delete','destroy','exports','multer'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x9917,0x67));var _0x7991=function(_0x4e7436,_0x1d0f7c){_0x4e7436=_0x4e7436-0x0;var _0x2288ee=_0x9917[_0x4e7436];return _0x2288ee;};'use strict';var multer=require(_0x7991('0x0'));var util=require(_0x7991('0x1'));var path=require(_0x7991('0x2'));var timeout=require(_0x7991('0x3'));var express=require(_0x7991('0x4'));var router=express[_0x7991('0x5')]();var fs_extra=require(_0x7991('0x6'));var auth=require(_0x7991('0x7'));var interaction=require(_0x7991('0x8'));var config=require('../../config/environment');var controller=require(_0x7991('0x9'));router[_0x7991('0xa')]('/',auth[_0x7991('0xb')](),controller[_0x7991('0xc')]);router[_0x7991('0xa')](_0x7991('0xd'),auth[_0x7991('0xb')](),controller[_0x7991('0xe')]);router[_0x7991('0xf')]('/',auth[_0x7991('0xb')](),controller[_0x7991('0x10')]);router[_0x7991('0xf')](_0x7991('0x11'),auth[_0x7991('0xb')](),controller[_0x7991('0x12')]);router[_0x7991('0xf')]('/:id/create_many',auth[_0x7991('0xb')](),controller[_0x7991('0x13')]);router[_0x7991('0x14')](_0x7991('0xd'),auth[_0x7991('0xb')](),controller[_0x7991('0x15')]);router['delete'](_0x7991('0x16'),auth['isAuthenticated'](),controller['bulkDestroy']);router[_0x7991('0x17')](_0x7991('0xd'),auth['isAuthenticated'](),controller[_0x7991('0x18')]);module[_0x7991('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 4b24978..190c8a7 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 _0x0e6b=['sequelize','STRING','TEXT'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x0e6b,0x17d));var _0xb0e6=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x0e6b[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require(_0xb0e6('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0e6('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xb0e6('0x1')]},'metric':{'type':Sequelize[_0xb0e6('0x2')]},'description':{'type':Sequelize[_0xb0e6('0x1')]}}; \ No newline at end of file +var _0xcd78=['exports','name','STRING','TEXT','sequelize'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xcd78,0xa9));var _0x8cd7=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xcd78[_0x5f5cce];return _0x705ecf;};'use strict';var Sequelize=require(_0x8cd7('0x0'));module[_0x8cd7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8cd7('0x2')},'table':{'type':Sequelize[_0x8cd7('0x3')]},'metric':{'type':Sequelize[_0x8cd7('0x4')]},'description':{'type':Sequelize[_0x8cd7('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 198cdd2..b2c2009 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 _0xc4aa=['findAll','rows','catch','show','params','length','includeAll','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','Metrics','UserProfileResource','error','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options'];(function(_0x19f73b,_0x167e09){var _0x5da215=function(_0x45be02){while(--_0x45be02){_0x19f73b['push'](_0x19f73b['shift']());}};_0x5da215(++_0x167e09);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'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 fs_extra=require(_0xac4a('0xb'));var _=require(_0xac4a('0xc'));var squel=require(_0xac4a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac4a('0xe'));var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xf'));var Papa=require('papaparse');var Redis=require(_0xac4a('0x10'));var authService=require(_0xac4a('0x11'));var qs=require(_0xac4a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac4a('0x13'));var logger=require('../../config/logger')(_0xac4a('0x14'));var utils=require('../../config/utils');var config=require(_0xac4a('0x15'));var licenseUtil=require(_0xac4a('0x16'));var db=require(_0xac4a('0x17'))['db'];function respondWithStatusCode(_0x5e16aa,_0x21a79){_0x21a79=_0x21a79||0xcc;return function(_0x68424a){if(_0x68424a){return _0x5e16aa[_0xac4a('0x18')](_0x21a79);}return _0x5e16aa[_0xac4a('0x19')](_0x21a79)[_0xac4a('0x1a')]();};}function respondWithResult(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xc8;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x19')](_0x34bc01)[_0xac4a('0x1b')](_0x33c287);}};}function respondWithFilteredResult(_0x11e101,_0x26dbb8){return function(_0x4a2119){if(_0x4a2119){var _0x402fff=_0x4a2119[_0xac4a('0x1c')],_0x34d797=_0x26dbb8[_0xac4a('0x1d')],_0x23eb66=_0x26dbb8[_0xac4a('0x1d')]+_0x26dbb8[_0xac4a('0x1e')],_0x144553;if(_0x23eb66>=_0x402fff){_0x23eb66=_0x402fff;_0x144553=0xc8;}else{_0x144553=0xce;}_0x11e101['status'](_0x144553);return _0x11e101['set'](_0xac4a('0x1f'),_0x34d797+'-'+_0x23eb66+'/'+_0x402fff)[_0xac4a('0x1b')](_0x4a2119);}return null;};}function patchUpdates(_0x39b691){return function(_0x4d837c){try{jsonpatch[_0xac4a('0x20')](_0x4d837c,_0x39b691,!![]);}catch(_0x15c223){return BPromise[_0xac4a('0x21')](_0x15c223);}return _0x4d837c[_0xac4a('0x22')]();};}function saveUpdates(_0x123694,_0x3e829c){return function(_0xe38996){if(_0xe38996){return _0xe38996[_0xac4a('0x23')](_0x123694)['then'](function(_0x3d8f0a){return _0x3d8f0a;});}return null;};}function removeEntity(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x24')]()[_0xac4a('0x25')](function(){var _0x947d8e=_0x3d7ce0['get']({'plain':!![]});var _0x1b7998=_0xac4a('0x26');return db[_0xac4a('0x27')][_0xac4a('0x24')]({'where':{'type':_0x1b7998,'resourceId':_0x947d8e['id']}})[_0xac4a('0x25')](function(){return _0x3d7ce0;});})[_0xac4a('0x25')](function(){_0x3204ad[_0xac4a('0x19')](0xcc)[_0xac4a('0x1a')]();});}};}function handleEntityNotFound(_0x3e2c69,_0x3bc318){return function(_0x1d0539){if(!_0x1d0539){_0x3e2c69[_0xac4a('0x18')](0x194);}return _0x1d0539;};}function handleError(_0x14832b,_0x472c57){_0x472c57=_0x472c57||0x1f4;return function(_0x1c13dc){logger[_0xac4a('0x28')](_0x1c13dc['stack']);if(_0x1c13dc[_0xac4a('0x29')]){delete _0x1c13dc[_0xac4a('0x29')];}_0x14832b[_0xac4a('0x19')](_0x472c57)[_0xac4a('0x2a')](_0x1c13dc);};}exports[_0xac4a('0x2b')]=function(_0x4a5a9e,_0x47f49c){var _0xdb7e={},_0x7a948b={},_0x1f12d5={'count':0x0,'rows':[]};var _0x546b65=_['map'](db[_0xac4a('0x2c')][_0xac4a('0x2d')],function(_0x228629){return{'name':_0x228629[_0xac4a('0x2e')],'type':_0x228629[_0xac4a('0x2f')]['key']};});_0x7a948b[_0xac4a('0x30')]=_['map'](_0x546b65,_0xac4a('0x29'));_0x7a948b['query']=_[_0xac4a('0x31')](_0x4a5a9e[_0xac4a('0x32')]);_0x7a948b[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x7a948b[_0xac4a('0x30')],_0x7a948b[_0xac4a('0x32')]);_0xdb7e[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x7a948b[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x4a5a9e[_0xac4a('0x32')][_0xac4a('0x36')]));_0xdb7e[_0xac4a('0x35')]=_0xdb7e[_0xac4a('0x35')]['length']?_0xdb7e[_0xac4a('0x35')]:_0x7a948b[_0xac4a('0x30')];if(!_0x4a5a9e['query'][_0xac4a('0x37')](_0xac4a('0x38'))){_0xdb7e['limit']=qs['limit'](_0x4a5a9e[_0xac4a('0x32')][_0xac4a('0x1e')]);_0xdb7e[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x4a5a9e['query'][_0xac4a('0x1d')]);}_0xdb7e[_0xac4a('0x39')]=qs['sort'](_0x4a5a9e[_0xac4a('0x32')][_0xac4a('0x3a')]);_0xdb7e[_0xac4a('0x3b')]=qs['filters'](_[_0xac4a('0x3c')](_0x4a5a9e[_0xac4a('0x32')],_0x7a948b[_0xac4a('0x33')]),_0x546b65);if(_0x4a5a9e['query'][_0xac4a('0x3d')]){_0xdb7e[_0xac4a('0x3b')]=_['merge'](_0xdb7e['where'],{'$or':_[_0xac4a('0x3e')](_0x546b65,function(_0x5e0926){if(_0x5e0926['type']!=='VIRTUAL'){var _0x4fee3a={};_0x4fee3a[_0x5e0926[_0xac4a('0x29')]]={'$like':'%'+_0x4a5a9e[_0xac4a('0x32')][_0xac4a('0x3d')]+'%'};return _0x4fee3a;}})});}_0xdb7e=_[_0xac4a('0x3f')]({},_0xdb7e,_0x4a5a9e[_0xac4a('0x40')]);var _0x415f31={'where':_0xdb7e[_0xac4a('0x3b')]};return db[_0xac4a('0x2c')][_0xac4a('0x1c')](_0x415f31)[_0xac4a('0x25')](function(_0x14f7d5){_0x1f12d5[_0xac4a('0x1c')]=_0x14f7d5;if(_0x4a5a9e['query']['includeAll']){_0xdb7e['include']=[{'all':!![]}];}return db[_0xac4a('0x2c')][_0xac4a('0x41')](_0xdb7e);})[_0xac4a('0x25')](function(_0x118be0){_0x1f12d5[_0xac4a('0x42')]=_0x118be0;return _0x1f12d5;})[_0xac4a('0x25')](respondWithFilteredResult(_0x47f49c,_0xdb7e))[_0xac4a('0x43')](handleError(_0x47f49c,null));};exports[_0xac4a('0x44')]=function(_0x3e9973,_0x3edb19){var _0x561cb7={'raw':!![],'where':{'id':_0x3e9973[_0xac4a('0x45')]['id']}},_0x3f31d1={};_0x3f31d1[_0xac4a('0x30')]=_[_0xac4a('0x31')](db[_0xac4a('0x2c')]['rawAttributes']);_0x3f31d1[_0xac4a('0x32')]=_[_0xac4a('0x31')](_0x3e9973['query']);_0x3f31d1[_0xac4a('0x33')]=_['intersection'](_0x3f31d1[_0xac4a('0x30')],_0x3f31d1[_0xac4a('0x32')]);_0x561cb7[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x3f31d1[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x3e9973[_0xac4a('0x32')][_0xac4a('0x36')]));_0x561cb7[_0xac4a('0x35')]=_0x561cb7[_0xac4a('0x35')][_0xac4a('0x46')]?_0x561cb7[_0xac4a('0x35')]:_0x3f31d1['model'];if(_0x3e9973[_0xac4a('0x32')][_0xac4a('0x47')]){_0x561cb7[_0xac4a('0x48')]=[{'all':!![]}];}_0x561cb7=_['merge']({},_0x561cb7,_0x3e9973[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x561cb7)[_0xac4a('0x25')](handleEntityNotFound(_0x3edb19,null))['then'](respondWithResult(_0x3edb19,null))[_0xac4a('0x43')](handleError(_0x3edb19,null));};exports[_0xac4a('0x49')]=function(_0x136a65,_0x5e3581){return db['AnalyticMetric'][_0xac4a('0x49')](_0x136a65['body'],{})[_0xac4a('0x25')](function(_0x566258){var _0x3d2aaf=_0x136a65['user'][_0xac4a('0x4a')]({'plain':!![]});if(!_0x3d2aaf)throw new Error(_0xac4a('0x4b'));if(_0x3d2aaf[_0xac4a('0x4c')]===_0xac4a('0x4d')){var _0x54782f=_0x566258[_0xac4a('0x4a')]({'plain':!![]});var _0x2af87f=_0xac4a('0x26');return db[_0xac4a('0x4e')][_0xac4a('0x4f')]({'where':{'name':_0x2af87f,'userProfileId':_0x3d2aaf[_0xac4a('0x50')]},'raw':!![]})[_0xac4a('0x25')](function(_0x4e6e19){if(_0x4e6e19&&_0x4e6e19[_0xac4a('0x51')]===0x0){return db[_0xac4a('0x27')]['create']({'name':_0x54782f[_0xac4a('0x29')],'resourceId':_0x54782f['id'],'type':_0x4e6e19[_0xac4a('0x29')],'sectionId':_0x4e6e19['id']},{})[_0xac4a('0x25')](function(){return _0x566258;});}else{return _0x566258;}})[_0xac4a('0x43')](function(_0x4bb2fb){logger[_0xac4a('0x28')](_0xac4a('0x52'),_0x4bb2fb);throw _0x4bb2fb;});}return _0x566258;})[_0xac4a('0x25')](respondWithResult(_0x5e3581,0xc9))[_0xac4a('0x43')](handleError(_0x5e3581,null));};exports[_0xac4a('0x23')]=function(_0x49fbc3,_0x179373){if(_0x49fbc3['body']['id']){delete _0x49fbc3[_0xac4a('0x53')]['id'];}return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x49fbc3['params']['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x179373,null))[_0xac4a('0x25')](saveUpdates(_0x49fbc3['body'],null))[_0xac4a('0x25')](respondWithResult(_0x179373,null))[_0xac4a('0x43')](handleError(_0x179373,null));};exports[_0xac4a('0x24')]=function(_0x103d05,_0x48900f){return db[_0xac4a('0x2c')][_0xac4a('0x4f')]({'where':{'id':_0x103d05[_0xac4a('0x45')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x48900f,null))[_0xac4a('0x25')](removeEntity(_0x48900f,null))[_0xac4a('0x43')](handleError(_0x48900f,null));}; \ No newline at end of file +var _0x5f2f=['destroy','get','sendStatus','error','stack','name','index','map','AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','role','Metrics','UserProfileSection','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','then'];(function(_0x5deb7e,_0x6de88c){var _0x13c9af=function(_0x456477){while(--_0x456477){_0x5deb7e['push'](_0x5deb7e['shift']());}};_0x13c9af(++_0x6de88c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x189642,_0x8d7e88){_0x189642=_0x189642-0x0;var _0x5330af=_0x5f2f[_0x189642];return _0x5330af;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xc'));var _=require(_0xf5f2('0xd'));var squel=require('squel');var crypto=require(_0xf5f2('0xe'));var jsforce=require(_0xf5f2('0xf'));var deskjs=require(_0xf5f2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf5f2('0x11'));var Papa=require(_0xf5f2('0x12'));var Redis=require(_0xf5f2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf5f2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f2('0x15'))(_0xf5f2('0x16'));var utils=require('../../config/utils');var config=require(_0xf5f2('0x17'));var licenseUtil=require(_0xf5f2('0x18'));var db=require(_0xf5f2('0x19'))['db'];function respondWithStatusCode(_0x3f2997,_0x59bb6c){_0x59bb6c=_0x59bb6c||0xcc;return function(_0x3e5956){if(_0x3e5956){return _0x3f2997['sendStatus'](_0x59bb6c);}return _0x3f2997[_0xf5f2('0x1a')](_0x59bb6c)[_0xf5f2('0x1b')]();};}function respondWithResult(_0x269909,_0x1c1a5c){_0x1c1a5c=_0x1c1a5c||0xc8;return function(_0x422b55){if(_0x422b55){return _0x269909['status'](_0x1c1a5c)[_0xf5f2('0x1c')](_0x422b55);}};}function respondWithFilteredResult(_0x286197,_0x17d656){return function(_0x1b6dd2){if(_0x1b6dd2){var _0x23e23a=_0x1b6dd2[_0xf5f2('0x1d')],_0x3a9dbb=_0x17d656[_0xf5f2('0x1e')],_0xdb61b3=_0x17d656[_0xf5f2('0x1e')]+_0x17d656[_0xf5f2('0x1f')],_0x395a5a;if(_0xdb61b3>=_0x23e23a){_0xdb61b3=_0x23e23a;_0x395a5a=0xc8;}else{_0x395a5a=0xce;}_0x286197[_0xf5f2('0x1a')](_0x395a5a);return _0x286197[_0xf5f2('0x20')](_0xf5f2('0x21'),_0x3a9dbb+'-'+_0xdb61b3+'/'+_0x23e23a)[_0xf5f2('0x1c')](_0x1b6dd2);}return null;};}function patchUpdates(_0x1bf655){return function(_0x56acc5){try{jsonpatch[_0xf5f2('0x22')](_0x56acc5,_0x1bf655,!![]);}catch(_0x47101e){return BPromise['reject'](_0x47101e);}return _0x56acc5['save']();};}function saveUpdates(_0x2d2805,_0x388e6c){return function(_0x4ae323){if(_0x4ae323){return _0x4ae323[_0xf5f2('0x23')](_0x2d2805)[_0xf5f2('0x24')](function(_0x39e44a){return _0x39e44a;});}return null;};}function removeEntity(_0x39c024,_0x36f1cb){return function(_0x4c691a){if(_0x4c691a){return _0x4c691a[_0xf5f2('0x25')]()[_0xf5f2('0x24')](function(){var _0x4e8bda=_0x4c691a[_0xf5f2('0x26')]({'plain':!![]});var _0x287ad5='Metrics';return db['UserProfileResource'][_0xf5f2('0x25')]({'where':{'type':_0x287ad5,'resourceId':_0x4e8bda['id']}})[_0xf5f2('0x24')](function(){return _0x4c691a;});})[_0xf5f2('0x24')](function(){_0x39c024[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x1b')]();});}};}function handleEntityNotFound(_0x788a8d,_0x13a3be){return function(_0x281ec8){if(!_0x281ec8){_0x788a8d[_0xf5f2('0x27')](0x194);}return _0x281ec8;};}function handleError(_0x4ab014,_0xaa2602){_0xaa2602=_0xaa2602||0x1f4;return function(_0x102449){logger[_0xf5f2('0x28')](_0x102449[_0xf5f2('0x29')]);if(_0x102449[_0xf5f2('0x2a')]){delete _0x102449[_0xf5f2('0x2a')];}_0x4ab014['status'](_0xaa2602)['send'](_0x102449);};}exports[_0xf5f2('0x2b')]=function(_0x14c829,_0x11c771){var _0x5027ab={},_0x5a2c7e={},_0x29571b={'count':0x0,'rows':[]};var _0x50b8a2=_[_0xf5f2('0x2c')](db[_0xf5f2('0x2d')][_0xf5f2('0x2e')],function(_0x54c0c8){return{'name':_0x54c0c8['fieldName'],'type':_0x54c0c8[_0xf5f2('0x2f')]['key']};});_0x5a2c7e[_0xf5f2('0x30')]=_['map'](_0x50b8a2,_0xf5f2('0x2a'));_0x5a2c7e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](_0x14c829[_0xf5f2('0x31')]);_0x5a2c7e[_0xf5f2('0x33')]=_[_0xf5f2('0x34')](_0x5a2c7e[_0xf5f2('0x30')],_0x5a2c7e[_0xf5f2('0x31')]);_0x5027ab['attributes']=_[_0xf5f2('0x34')](_0x5a2c7e[_0xf5f2('0x30')],qs[_0xf5f2('0x35')](_0x14c829[_0xf5f2('0x31')][_0xf5f2('0x35')]));_0x5027ab[_0xf5f2('0x36')]=_0x5027ab[_0xf5f2('0x36')]['length']?_0x5027ab[_0xf5f2('0x36')]:_0x5a2c7e[_0xf5f2('0x30')];if(!_0x14c829['query'][_0xf5f2('0x37')]('nolimit')){_0x5027ab[_0xf5f2('0x1f')]=qs[_0xf5f2('0x1f')](_0x14c829[_0xf5f2('0x31')][_0xf5f2('0x1f')]);_0x5027ab['offset']=qs['offset'](_0x14c829[_0xf5f2('0x31')][_0xf5f2('0x1e')]);}_0x5027ab[_0xf5f2('0x38')]=qs['sort'](_0x14c829[_0xf5f2('0x31')]['sort']);_0x5027ab[_0xf5f2('0x39')]=qs['filters'](_[_0xf5f2('0x3a')](_0x14c829[_0xf5f2('0x31')],_0x5a2c7e['filters']),_0x50b8a2);if(_0x14c829[_0xf5f2('0x31')][_0xf5f2('0x3b')]){_0x5027ab[_0xf5f2('0x39')]=_[_0xf5f2('0x3c')](_0x5027ab['where'],{'$or':_['map'](_0x50b8a2,function(_0x3d328f){if(_0x3d328f[_0xf5f2('0x2f')]!==_0xf5f2('0x3d')){var _0x2d4400={};_0x2d4400[_0x3d328f[_0xf5f2('0x2a')]]={'$like':'%'+_0x14c829[_0xf5f2('0x31')][_0xf5f2('0x3b')]+'%'};return _0x2d4400;}})});}_0x5027ab=_['merge']({},_0x5027ab,_0x14c829[_0xf5f2('0x3e')]);var _0x3b4ea6={'where':_0x5027ab['where']};return db[_0xf5f2('0x2d')][_0xf5f2('0x1d')](_0x3b4ea6)[_0xf5f2('0x24')](function(_0x85b6d0){_0x29571b[_0xf5f2('0x1d')]=_0x85b6d0;if(_0x14c829[_0xf5f2('0x31')][_0xf5f2('0x3f')]){_0x5027ab[_0xf5f2('0x40')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xf5f2('0x41')](_0x5027ab);})[_0xf5f2('0x24')](function(_0x17a78e){_0x29571b['rows']=_0x17a78e;return _0x29571b;})['then'](respondWithFilteredResult(_0x11c771,_0x5027ab))['catch'](handleError(_0x11c771,null));};exports[_0xf5f2('0x42')]=function(_0x2ad13c,_0x4c8d8e){var _0x106272={'raw':!![],'where':{'id':_0x2ad13c[_0xf5f2('0x43')]['id']}},_0xeed03d={};_0xeed03d[_0xf5f2('0x30')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2d')][_0xf5f2('0x2e')]);_0xeed03d[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](_0x2ad13c[_0xf5f2('0x31')]);_0xeed03d[_0xf5f2('0x33')]=_[_0xf5f2('0x34')](_0xeed03d[_0xf5f2('0x30')],_0xeed03d[_0xf5f2('0x31')]);_0x106272['attributes']=_[_0xf5f2('0x34')](_0xeed03d['model'],qs[_0xf5f2('0x35')](_0x2ad13c[_0xf5f2('0x31')][_0xf5f2('0x35')]));_0x106272[_0xf5f2('0x36')]=_0x106272[_0xf5f2('0x36')][_0xf5f2('0x44')]?_0x106272['attributes']:_0xeed03d[_0xf5f2('0x30')];if(_0x2ad13c[_0xf5f2('0x31')][_0xf5f2('0x3f')]){_0x106272[_0xf5f2('0x40')]=[{'all':!![]}];}_0x106272=_[_0xf5f2('0x3c')]({},_0x106272,_0x2ad13c[_0xf5f2('0x3e')]);return db[_0xf5f2('0x2d')][_0xf5f2('0x45')](_0x106272)['then'](handleEntityNotFound(_0x4c8d8e,null))[_0xf5f2('0x24')](respondWithResult(_0x4c8d8e,null))[_0xf5f2('0x46')](handleError(_0x4c8d8e,null));};exports[_0xf5f2('0x47')]=function(_0x492eea,_0x1177ba){return db[_0xf5f2('0x2d')][_0xf5f2('0x47')](_0x492eea['body'],{})['then'](function(_0x7bb942){var _0x27c472=_0x492eea['user'][_0xf5f2('0x26')]({'plain':!![]});if(!_0x27c472)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27c472[_0xf5f2('0x48')]==='user'){var _0x2cbd9d=_0x7bb942['get']({'plain':!![]});var _0x2d9017=_0xf5f2('0x49');return db[_0xf5f2('0x4a')][_0xf5f2('0x45')]({'where':{'name':_0x2d9017,'userProfileId':_0x27c472['userProfileId']},'raw':!![]})[_0xf5f2('0x24')](function(_0x2b782f){if(_0x2b782f&&_0x2b782f['autoAssociation']===0x0){return db['UserProfileResource'][_0xf5f2('0x47')]({'name':_0x2cbd9d[_0xf5f2('0x2a')],'resourceId':_0x2cbd9d['id'],'type':_0x2b782f['name'],'sectionId':_0x2b782f['id']},{})[_0xf5f2('0x24')](function(){return _0x7bb942;});}else{return _0x7bb942;}})[_0xf5f2('0x46')](function(_0x29c9b6){logger[_0xf5f2('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29c9b6);throw _0x29c9b6;});}return _0x7bb942;})['then'](respondWithResult(_0x1177ba,0xc9))[_0xf5f2('0x46')](handleError(_0x1177ba,null));};exports[_0xf5f2('0x23')]=function(_0x4b62fc,_0x40eef){if(_0x4b62fc[_0xf5f2('0x4b')]['id']){delete _0x4b62fc[_0xf5f2('0x4b')]['id'];}return db[_0xf5f2('0x2d')][_0xf5f2('0x45')]({'where':{'id':_0x4b62fc[_0xf5f2('0x43')]['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x40eef,null))['then'](saveUpdates(_0x4b62fc['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x40eef,null))[_0xf5f2('0x46')](handleError(_0x40eef,null));};exports[_0xf5f2('0x25')]=function(_0x46a905,_0x21b0d3){return db['AnalyticMetric'][_0xf5f2('0x45')]({'where':{'id':_0x46a905[_0xf5f2('0x43')]['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x21b0d3,null))['then'](removeEntity(_0x21b0d3,null))[_0xf5f2('0x46')](handleError(_0x21b0d3,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 790ba2b..60c8e21 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 _0xd6c7=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x2a8cb7,_0x314d29){var _0x183a1f=function(_0x7f65bc){while(--_0x7f65bc){_0x2a8cb7['push'](_0x2a8cb7['shift']());}};_0x183a1f(++_0x314d29);}(_0xd6c7,0x7c));var _0x7d6c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd6c7[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7d6c('0x0'));var util=require(_0x7d6c('0x1'));var logger=require(_0x7d6c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7d6c('0x3'));var rp=require(_0x7d6c('0x4'));var fs=require('fs');var path=require(_0x7d6c('0x5'));var rimraf=require(_0x7d6c('0x6'));var config=require(_0x7d6c('0x7'));var attributes=require(_0x7d6c('0x8'));module[_0x7d6c('0x9')]=function(_0x4337de,_0x73cf35){return _0x4337de[_0x7d6c('0xa')](_0x7d6c('0xb'),attributes,{'tableName':_0x7d6c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ba5=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','util'];(function(_0x5a3742,_0x50d173){var _0x2b2a75=function(_0x244911){while(--_0x244911){_0x5a3742['push'](_0x5a3742['shift']());}};_0x2b2a75(++_0x50d173);}(_0x9ba5,0x6b));var _0x59ba=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9ba5[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x59ba('0x0'));var logger=require(_0x59ba('0x1'))(_0x59ba('0x2'));var moment=require(_0x59ba('0x3'));var BPromise=require('bluebird');var rp=require(_0x59ba('0x4'));var fs=require('fs');var path=require(_0x59ba('0x5'));var rimraf=require(_0x59ba('0x6'));var config=require(_0x59ba('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x59ba('0x8')]=function(_0x11ca43,_0x3a6aed){return _0x11ca43[_0x59ba('0x9')](_0x59ba('0xa'),attributes,{'tableName':_0x59ba('0xb'),'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 34e6c83..b465379 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 _0x8569=['debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x2862c3,_0x1a8900){var _0x3f3584=function(_0x4156c2){while(--_0x4156c2){_0x2862c3['push'](_0x2862c3['shift']());}};_0x3f3584(++_0x1a8900);}(_0x8569,0x1f4));var _0x9856=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x8569[_0x225f50];return _0x19d003;};'use strict';var _=require(_0x9856('0x0'));var util=require('util');var moment=require(_0x9856('0x1'));var BPromise=require(_0x9856('0x2'));var rs=require(_0x9856('0x3'));var fs=require('fs');var Redis=require(_0x9856('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9856('0x5'));var config=require('../../config/environment');var jayson=require(_0x9856('0x6'));var client=jayson['client'][_0x9856('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x465513,_0x3fd6fc,_0x1efdac){return new BPromise(function(_0x26fa62,_0x4e95c5){return client[_0x9856('0x8')](_0x465513,_0x1efdac)[_0x9856('0x9')](function(_0x222fdb){logger[_0x9856('0xa')](_0x9856('0xb'),_0x3fd6fc,_0x9856('0xc'));logger[_0x9856('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x3fd6fc,_0x9856('0xc'),JSON[_0x9856('0xe')](_0x222fdb));if(_0x222fdb[_0x9856('0xf')]){if(_0x222fdb[_0x9856('0xf')]['code']===0x1f4){logger[_0x9856('0xf')](_0x9856('0xb'),_0x3fd6fc,_0x222fdb['error']['message']);return _0x4e95c5(_0x222fdb[_0x9856('0xf')][_0x9856('0x10')]);}logger['error'](_0x9856('0xb'),_0x3fd6fc,_0x222fdb[_0x9856('0xf')][_0x9856('0x10')]);return _0x26fa62(_0x222fdb[_0x9856('0xf')][_0x9856('0x10')]);}else{logger['info'](_0x9856('0xb'),_0x3fd6fc,_0x9856('0xc'));_0x26fa62(_0x222fdb[_0x9856('0x11')][_0x9856('0x10')]);}})[_0x9856('0x12')](function(_0x2539cb){logger[_0x9856('0xf')](_0x9856('0xb'),_0x3fd6fc,_0x2539cb);_0x4e95c5(_0x2539cb);});});} \ No newline at end of file +var _0xa8b1=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dc870,_0x400022){var _0x24c28f=function(_0x5a2da8){while(--_0x5a2da8){_0x3dc870['push'](_0x3dc870['shift']());}};_0x24c28f(++_0x400022);}(_0xa8b1,0x120));var _0x1a8b=function(_0x5442f3,_0x80c070){_0x5442f3=_0x5442f3-0x0;var _0x568177=_0xa8b1[_0x5442f3];return _0x568177;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1a8b('0x0'));var rs=require(_0x1a8b('0x1'));var fs=require('fs');var Redis=require(_0x1a8b('0x2'));var db=require(_0x1a8b('0x3'))['db'];var utils=require(_0x1a8b('0x4'));var logger=require('../../config/logger')(_0x1a8b('0x5'));var config=require(_0x1a8b('0x6'));var jayson=require(_0x1a8b('0x7'));var client=jayson[_0x1a8b('0x8')][_0x1a8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x486f82,_0x15ac26,_0x449bab){return new BPromise(function(_0x1e9199,_0x4451e8){return client[_0x1a8b('0xa')](_0x486f82,_0x449bab)[_0x1a8b('0xb')](function(_0x57f8d5){logger[_0x1a8b('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x15ac26,_0x1a8b('0xd'));logger[_0x1a8b('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x15ac26,'request\x20sent',JSON[_0x1a8b('0xf')](_0x57f8d5));if(_0x57f8d5[_0x1a8b('0x10')]){if(_0x57f8d5[_0x1a8b('0x10')][_0x1a8b('0x11')]===0x1f4){logger[_0x1a8b('0x10')](_0x1a8b('0x12'),_0x15ac26,_0x57f8d5[_0x1a8b('0x10')][_0x1a8b('0x13')]);return _0x4451e8(_0x57f8d5[_0x1a8b('0x10')]['message']);}logger[_0x1a8b('0x10')](_0x1a8b('0x12'),_0x15ac26,_0x57f8d5['error']['message']);return _0x1e9199(_0x57f8d5[_0x1a8b('0x10')][_0x1a8b('0x13')]);}else{logger[_0x1a8b('0xc')](_0x1a8b('0x12'),_0x15ac26,'request\x20sent');_0x1e9199(_0x57f8d5['result'][_0x1a8b('0x13')]);}})[_0x1a8b('0x14')](function(_0x24136a){logger[_0x1a8b('0x10')](_0x1a8b('0x12'),_0x15ac26,_0x24136a);_0x4451e8(_0x24136a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 10b0ec9..5a258dd 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 _0x087b=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x8cec93,_0x3c023d){var _0xa5ec0a=function(_0x19fbd6){while(--_0x19fbd6){_0x8cec93['push'](_0x8cec93['shift']());}};_0xa5ec0a(++_0x3c023d);}(_0x087b,0x11a));var _0xb087=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x087b[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0xd')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0xf')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);module[_0xb087('0x13')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x2586c7,_0x277605){var _0x11dae8=function(_0x3d1faa){while(--_0x3d1faa){_0x2586c7['push'](_0x2586c7['shift']());}};_0x11dae8(++_0x277605);}(_0x5eb8,0xb0));var _0x85eb=function(_0x506002,_0x17ad62){_0x506002=_0x506002-0x0;var _0x5a020c=_0x5eb8[_0x506002];return _0x5a020c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('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 7334ee8..461cd31 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 _0x9ba0=['sequelize'];(function(_0x422ac3,_0x48bbd4){var _0x53c0d4=function(_0x4b50f6){while(--_0x4b50f6){_0x422ac3['push'](_0x422ac3['shift']());}};_0x53c0d4(++_0x48bbd4);}(_0x9ba0,0x95));var _0x09ba=function(_0x5afba1,_0x2afea8){_0x5afba1=_0x5afba1-0x0;var _0xe5d8b=_0x9ba0[_0x5afba1];return _0xe5d8b;};'use strict';var Sequelize=require(_0x09ba('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xdf85=['exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdf85,0xea));var _0x5df8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xdf85[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require('sequelize');module[_0x5df8('0x0')]={'tree':{'type':Sequelize[_0x5df8('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 d0dffbf..8fab7cb 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 _0x433d=['status','json','count','offset','limit','reject','save','update','then','end','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','map','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','catch','length','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0x433d,0x140));var _0xd433=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x433d[_0x188703];return _0x1a0c81;};'use strict';var pdf=require(_0xd433('0x0'));var emlformat=require(_0xd433('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd433('0x2'));var jsonpatch=require(_0xd433('0x3'));var rp=require(_0xd433('0x4'));var moment=require(_0xd433('0x5'));var BPromise=require(_0xd433('0x6'));var Mustache=require(_0xd433('0x7'));var util=require(_0xd433('0x8'));var path=require(_0xd433('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd433('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd433('0xb'));var squel=require(_0xd433('0xc'));var crypto=require('crypto');var jsforce=require(_0xd433('0xd'));var deskjs=require(_0xd433('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd433('0xf'));var Redis=require(_0xd433('0x10'));var authService=require(_0xd433('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd433('0x12'));var logger=require(_0xd433('0x13'))(_0xd433('0x14'));var utils=require(_0xd433('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd433('0x16'));var db=require(_0xd433('0x17'))['db'];function respondWithStatusCode(_0x34326d,_0x946fff){_0x946fff=_0x946fff||0xcc;return function(_0x4c208f){if(_0x4c208f){return _0x34326d[_0xd433('0x18')](_0x946fff);}return _0x34326d[_0xd433('0x19')](_0x946fff)['end']();};}function respondWithResult(_0x1fd8aa,_0x481347){_0x481347=_0x481347||0xc8;return function(_0x4a3f9b){if(_0x4a3f9b){return _0x1fd8aa[_0xd433('0x19')](_0x481347)[_0xd433('0x1a')](_0x4a3f9b);}};}function respondWithFilteredResult(_0x21f30f,_0x4fde6d){return function(_0x5bd6b3){if(_0x5bd6b3){var _0x2dca3f=_0x5bd6b3[_0xd433('0x1b')],_0x2dd6a4=_0x4fde6d['offset'],_0x1534fe=_0x4fde6d[_0xd433('0x1c')]+_0x4fde6d[_0xd433('0x1d')],_0x4c021f;if(_0x1534fe>=_0x2dca3f){_0x1534fe=_0x2dca3f;_0x4c021f=0xc8;}else{_0x4c021f=0xce;}_0x21f30f[_0xd433('0x19')](_0x4c021f);return _0x21f30f['set']('Content-Range',_0x2dd6a4+'-'+_0x1534fe+'/'+_0x2dca3f)[_0xd433('0x1a')](_0x5bd6b3);}return null;};}function patchUpdates(_0x35bca6){return function(_0x51ec79){try{jsonpatch['apply'](_0x51ec79,_0x35bca6,!![]);}catch(_0x7a0508){return BPromise[_0xd433('0x1e')](_0x7a0508);}return _0x51ec79[_0xd433('0x1f')]();};}function saveUpdates(_0x35e9fa,_0x38f1a2){return function(_0x4bf7c7){if(_0x4bf7c7){return _0x4bf7c7[_0xd433('0x20')](_0x35e9fa)['then'](function(_0x558200){return _0x558200;});}return null;};}function removeEntity(_0x3b12f7,_0x1bcd7f){return function(_0x882af0){if(_0x882af0){return _0x882af0['destroy']()[_0xd433('0x21')](function(){_0x3b12f7[_0xd433('0x19')](0xcc)[_0xd433('0x22')]();});}};}function handleEntityNotFound(_0x5dd20c,_0x33221a){return function(_0x305dc0){if(!_0x305dc0){_0x5dd20c['sendStatus'](0x194);}return _0x305dc0;};}function handleError(_0xa09dd,_0xc52518){_0xc52518=_0xc52518||0x1f4;return function(_0x9f28d0){logger[_0xd433('0x23')](_0x9f28d0[_0xd433('0x24')]);if(_0x9f28d0[_0xd433('0x25')]){delete _0x9f28d0[_0xd433('0x25')];}_0xa09dd[_0xd433('0x19')](_0xc52518)[_0xd433('0x26')](_0x9f28d0);};}exports['index']=function(_0x52a883,_0x1a7b15){var _0x3a6bcc={},_0x131553={},_0x5737df={'count':0x0,'rows':[]};var _0x5d01b6=_['map'](db[_0xd433('0x27')][_0xd433('0x28')],function(_0x23c16c){return{'name':_0x23c16c[_0xd433('0x29')],'type':_0x23c16c[_0xd433('0x2a')][_0xd433('0x2b')]};});_0x131553['model']=_[_0xd433('0x2c')](_0x5d01b6,_0xd433('0x25'));_0x131553[_0xd433('0x2d')]=_[_0xd433('0x2e')](_0x52a883[_0xd433('0x2d')]);_0x131553['filters']=_['intersection'](_0x131553[_0xd433('0x2f')],_0x131553[_0xd433('0x2d')]);_0x3a6bcc['attributes']=_[_0xd433('0x30')](_0x131553['model'],qs[_0xd433('0x31')](_0x52a883[_0xd433('0x2d')]['fields']));_0x3a6bcc[_0xd433('0x32')]=_0x3a6bcc[_0xd433('0x32')]['length']?_0x3a6bcc[_0xd433('0x32')]:_0x131553['model'];if(!_0x52a883[_0xd433('0x2d')][_0xd433('0x33')](_0xd433('0x34'))){_0x3a6bcc[_0xd433('0x1d')]=qs[_0xd433('0x1d')](_0x52a883[_0xd433('0x2d')][_0xd433('0x1d')]);_0x3a6bcc[_0xd433('0x1c')]=qs[_0xd433('0x1c')](_0x52a883['query'][_0xd433('0x1c')]);}_0x3a6bcc[_0xd433('0x35')]=qs['sort'](_0x52a883['query'][_0xd433('0x36')]);_0x3a6bcc['where']=qs[_0xd433('0x37')](_['pick'](_0x52a883[_0xd433('0x2d')],_0x131553[_0xd433('0x37')]),_0x5d01b6);if(_0x52a883['query'][_0xd433('0x38')]){_0x3a6bcc[_0xd433('0x39')]=_['merge'](_0x3a6bcc['where'],{'$or':_[_0xd433('0x2c')](_0x5d01b6,function(_0x363358){if(_0x363358[_0xd433('0x2a')]!==_0xd433('0x3a')){var _0x56ef7e={};_0x56ef7e[_0x363358['name']]={'$like':'%'+_0x52a883[_0xd433('0x2d')][_0xd433('0x38')]+'%'};return _0x56ef7e;}})});}_0x3a6bcc=_[_0xd433('0x3b')]({},_0x3a6bcc,_0x52a883[_0xd433('0x3c')]);var _0x53bc82={'where':_0x3a6bcc[_0xd433('0x39')]};return db[_0xd433('0x27')][_0xd433('0x1b')](_0x53bc82)[_0xd433('0x21')](function(_0x2f9da5){_0x5737df[_0xd433('0x1b')]=_0x2f9da5;if(_0x52a883[_0xd433('0x2d')][_0xd433('0x3d')]){_0x3a6bcc[_0xd433('0x3e')]=[{'all':!![]}];}return db[_0xd433('0x27')]['findAll'](_0x3a6bcc);})[_0xd433('0x21')](function(_0x156522){_0x5737df['rows']=_0x156522;return _0x5737df;})['then'](respondWithFilteredResult(_0x1a7b15,_0x3a6bcc))[_0xd433('0x3f')](handleError(_0x1a7b15,null));};exports['show']=function(_0x11deb5,_0xc80f26){var _0x22bea8={'raw':!![],'where':{'id':_0x11deb5['params']['id']}},_0x58f762={};_0x58f762[_0xd433('0x2f')]=_[_0xd433('0x2e')](db[_0xd433('0x27')]['rawAttributes']);_0x58f762[_0xd433('0x2d')]=_[_0xd433('0x2e')](_0x11deb5[_0xd433('0x2d')]);_0x58f762[_0xd433('0x37')]=_[_0xd433('0x30')](_0x58f762[_0xd433('0x2f')],_0x58f762['query']);_0x22bea8[_0xd433('0x32')]=_['intersection'](_0x58f762[_0xd433('0x2f')],qs[_0xd433('0x31')](_0x11deb5[_0xd433('0x2d')][_0xd433('0x31')]));_0x22bea8[_0xd433('0x32')]=_0x22bea8[_0xd433('0x32')][_0xd433('0x40')]?_0x22bea8[_0xd433('0x32')]:_0x58f762[_0xd433('0x2f')];if(_0x11deb5[_0xd433('0x2d')][_0xd433('0x3d')]){_0x22bea8['include']=[{'all':!![]}];}_0x22bea8=_['merge']({},_0x22bea8,_0x11deb5[_0xd433('0x3c')]);return db['AnalyticTreeReport'][_0xd433('0x41')](_0x22bea8)[_0xd433('0x21')](handleEntityNotFound(_0xc80f26,null))[_0xd433('0x21')](respondWithResult(_0xc80f26,null))[_0xd433('0x3f')](handleError(_0xc80f26,null));};exports[_0xd433('0x42')]=function(_0x1da346,_0x556a3b){return db[_0xd433('0x27')][_0xd433('0x42')](_0x1da346['body'],{})['then'](respondWithResult(_0x556a3b,0xc9))[_0xd433('0x3f')](handleError(_0x556a3b,null));};exports['update']=function(_0x34741d,_0x5c3059){if(_0x34741d[_0xd433('0x43')]['id']){delete _0x34741d[_0xd433('0x43')]['id'];}return db[_0xd433('0x27')]['find']({'where':{'id':_0x34741d[_0xd433('0x44')]['id']}})[_0xd433('0x21')](handleEntityNotFound(_0x5c3059,null))[_0xd433('0x21')](saveUpdates(_0x34741d[_0xd433('0x43')],null))[_0xd433('0x21')](respondWithResult(_0x5c3059,null))[_0xd433('0x3f')](handleError(_0x5c3059,null));};exports['destroy']=function(_0x1e1d99,_0x277841){return db[_0xd433('0x27')][_0xd433('0x41')]({'where':{'id':_0x1e1d99[_0xd433('0x44')]['id']}})[_0xd433('0x21')](handleEntityNotFound(_0x277841,null))[_0xd433('0x21')](removeEntity(_0x277841,null))[_0xd433('0x3f')](handleError(_0x277841,null));}; \ No newline at end of file +var _0xccbb=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','length','query','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','AnalyticTreeReport','count','includeAll','include','rows','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4e39b1,_0x18db82){var _0x158776=function(_0x51e956){while(--_0x51e956){_0x4e39b1['push'](_0x4e39b1['shift']());}};_0x158776(++_0x18db82);}(_0xccbb,0xc5));var _0xbccb=function(_0x388538,_0x2358fd){_0x388538=_0x388538-0x0;var _0x327b91=_0xccbb[_0x388538];return _0x327b91;};'use strict';var pdf=require(_0xbccb('0x0'));var emlformat=require(_0xbccb('0x1'));var rimraf=require(_0xbccb('0x2'));var zipdir=require(_0xbccb('0x3'));var jsonpatch=require(_0xbccb('0x4'));var rp=require(_0xbccb('0x5'));var moment=require(_0xbccb('0x6'));var BPromise=require(_0xbccb('0x7'));var Mustache=require(_0xbccb('0x8'));var util=require('util');var path=require(_0xbccb('0x9'));var sox=require(_0xbccb('0xa'));var csv=require(_0xbccb('0xb'));var ejs=require(_0xbccb('0xc'));var fs=require('fs');var fs_extra=require(_0xbccb('0xd'));var _=require('lodash');var squel=require(_0xbccb('0xe'));var crypto=require(_0xbccb('0xf'));var jsforce=require(_0xbccb('0x10'));var deskjs=require(_0xbccb('0x11'));var toCsv=require(_0xbccb('0xb'));var querystring=require(_0xbccb('0x12'));var Papa=require(_0xbccb('0x13'));var Redis=require('ioredis');var authService=require(_0xbccb('0x14'));var qs=require(_0xbccb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbccb('0x16'));var logger=require(_0xbccb('0x17'))(_0xbccb('0x18'));var utils=require('../../config/utils');var config=require(_0xbccb('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x195cc0,_0x2ee283){_0x2ee283=_0x2ee283||0xcc;return function(_0x34c4b7){if(_0x34c4b7){return _0x195cc0[_0xbccb('0x1a')](_0x2ee283);}return _0x195cc0[_0xbccb('0x1b')](_0x2ee283)['end']();};}function respondWithResult(_0x510465,_0x1c6489){_0x1c6489=_0x1c6489||0xc8;return function(_0x3178a2){if(_0x3178a2){return _0x510465['status'](_0x1c6489)['json'](_0x3178a2);}};}function respondWithFilteredResult(_0x52ba5b,_0x1af2da){return function(_0x584648){if(_0x584648){var _0x3585f7=_0x584648['count'],_0x2ccfd2=_0x1af2da[_0xbccb('0x1c')],_0x146436=_0x1af2da['offset']+_0x1af2da['limit'],_0x2271c4;if(_0x146436>=_0x3585f7){_0x146436=_0x3585f7;_0x2271c4=0xc8;}else{_0x2271c4=0xce;}_0x52ba5b['status'](_0x2271c4);return _0x52ba5b[_0xbccb('0x1d')](_0xbccb('0x1e'),_0x2ccfd2+'-'+_0x146436+'/'+_0x3585f7)['json'](_0x584648);}return null;};}function patchUpdates(_0x4af78a){return function(_0x15fe81){try{jsonpatch[_0xbccb('0x1f')](_0x15fe81,_0x4af78a,!![]);}catch(_0x6d66c9){return BPromise[_0xbccb('0x20')](_0x6d66c9);}return _0x15fe81[_0xbccb('0x21')]();};}function saveUpdates(_0x33f60b,_0x567643){return function(_0x34cb3a){if(_0x34cb3a){return _0x34cb3a[_0xbccb('0x22')](_0x33f60b)[_0xbccb('0x23')](function(_0x2c01a5){return _0x2c01a5;});}return null;};}function removeEntity(_0x1825b5,_0x50dae9){return function(_0x38a943){if(_0x38a943){return _0x38a943[_0xbccb('0x24')]()['then'](function(){_0x1825b5[_0xbccb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ffe1,_0x7b0e94){return function(_0x4af700){if(!_0x4af700){_0x45ffe1[_0xbccb('0x1a')](0x194);}return _0x4af700;};}function handleError(_0x374b9a,_0x50a987){_0x50a987=_0x50a987||0x1f4;return function(_0x461319){logger['error'](_0x461319[_0xbccb('0x25')]);if(_0x461319[_0xbccb('0x26')]){delete _0x461319[_0xbccb('0x26')];}_0x374b9a[_0xbccb('0x1b')](_0x50a987)[_0xbccb('0x27')](_0x461319);};}exports[_0xbccb('0x28')]=function(_0x4befbc,_0x344f28){var _0x1ea298={},_0xfbd3dd={},_0x51bdb6={'count':0x0,'rows':[]};var _0x59e7be=_[_0xbccb('0x29')](db['AnalyticTreeReport'][_0xbccb('0x2a')],function(_0xe07f73){return{'name':_0xe07f73[_0xbccb('0x2b')],'type':_0xe07f73['type'][_0xbccb('0x2c')]};});_0xfbd3dd[_0xbccb('0x2d')]=_[_0xbccb('0x29')](_0x59e7be,_0xbccb('0x26'));_0xfbd3dd['query']=_[_0xbccb('0x2e')](_0x4befbc['query']);_0xfbd3dd[_0xbccb('0x2f')]=_[_0xbccb('0x30')](_0xfbd3dd[_0xbccb('0x2d')],_0xfbd3dd['query']);_0x1ea298[_0xbccb('0x31')]=_[_0xbccb('0x30')](_0xfbd3dd[_0xbccb('0x2d')],qs[_0xbccb('0x32')](_0x4befbc['query'][_0xbccb('0x32')]));_0x1ea298[_0xbccb('0x31')]=_0x1ea298[_0xbccb('0x31')][_0xbccb('0x33')]?_0x1ea298[_0xbccb('0x31')]:_0xfbd3dd['model'];if(!_0x4befbc[_0xbccb('0x34')]['hasOwnProperty'](_0xbccb('0x35'))){_0x1ea298[_0xbccb('0x36')]=qs['limit'](_0x4befbc[_0xbccb('0x34')]['limit']);_0x1ea298[_0xbccb('0x1c')]=qs['offset'](_0x4befbc[_0xbccb('0x34')][_0xbccb('0x1c')]);}_0x1ea298[_0xbccb('0x37')]=qs[_0xbccb('0x38')](_0x4befbc[_0xbccb('0x34')]['sort']);_0x1ea298[_0xbccb('0x39')]=qs[_0xbccb('0x2f')](_[_0xbccb('0x3a')](_0x4befbc[_0xbccb('0x34')],_0xfbd3dd['filters']),_0x59e7be);if(_0x4befbc[_0xbccb('0x34')]['filter']){_0x1ea298[_0xbccb('0x39')]=_[_0xbccb('0x3b')](_0x1ea298[_0xbccb('0x39')],{'$or':_[_0xbccb('0x29')](_0x59e7be,function(_0x1d3a5a){if(_0x1d3a5a['type']!==_0xbccb('0x3c')){var _0x3bea5e={};_0x3bea5e[_0x1d3a5a[_0xbccb('0x26')]]={'$like':'%'+_0x4befbc['query']['filter']+'%'};return _0x3bea5e;}})});}_0x1ea298=_[_0xbccb('0x3b')]({},_0x1ea298,_0x4befbc[_0xbccb('0x3d')]);var _0x424b37={'where':_0x1ea298['where']};return db[_0xbccb('0x3e')]['count'](_0x424b37)[_0xbccb('0x23')](function(_0x52bc2a){_0x51bdb6[_0xbccb('0x3f')]=_0x52bc2a;if(_0x4befbc[_0xbccb('0x34')][_0xbccb('0x40')]){_0x1ea298[_0xbccb('0x41')]=[{'all':!![]}];}return db[_0xbccb('0x3e')]['findAll'](_0x1ea298);})[_0xbccb('0x23')](function(_0x4a2718){_0x51bdb6[_0xbccb('0x42')]=_0x4a2718;return _0x51bdb6;})[_0xbccb('0x23')](respondWithFilteredResult(_0x344f28,_0x1ea298))['catch'](handleError(_0x344f28,null));};exports['show']=function(_0x3c0120,_0x331973){var _0x3fec4a={'raw':!![],'where':{'id':_0x3c0120[_0xbccb('0x43')]['id']}},_0x3ef07e={};_0x3ef07e[_0xbccb('0x2d')]=_[_0xbccb('0x2e')](db[_0xbccb('0x3e')][_0xbccb('0x2a')]);_0x3ef07e[_0xbccb('0x34')]=_[_0xbccb('0x2e')](_0x3c0120[_0xbccb('0x34')]);_0x3ef07e[_0xbccb('0x2f')]=_[_0xbccb('0x30')](_0x3ef07e[_0xbccb('0x2d')],_0x3ef07e[_0xbccb('0x34')]);_0x3fec4a['attributes']=_[_0xbccb('0x30')](_0x3ef07e[_0xbccb('0x2d')],qs['fields'](_0x3c0120[_0xbccb('0x34')][_0xbccb('0x32')]));_0x3fec4a['attributes']=_0x3fec4a['attributes'][_0xbccb('0x33')]?_0x3fec4a[_0xbccb('0x31')]:_0x3ef07e[_0xbccb('0x2d')];if(_0x3c0120[_0xbccb('0x34')]['includeAll']){_0x3fec4a[_0xbccb('0x41')]=[{'all':!![]}];}_0x3fec4a=_[_0xbccb('0x3b')]({},_0x3fec4a,_0x3c0120[_0xbccb('0x3d')]);return db[_0xbccb('0x3e')][_0xbccb('0x44')](_0x3fec4a)[_0xbccb('0x23')](handleEntityNotFound(_0x331973,null))[_0xbccb('0x23')](respondWithResult(_0x331973,null))[_0xbccb('0x45')](handleError(_0x331973,null));};exports[_0xbccb('0x46')]=function(_0x2be6ef,_0x426dbe){return db[_0xbccb('0x3e')]['create'](_0x2be6ef[_0xbccb('0x47')],{})[_0xbccb('0x23')](respondWithResult(_0x426dbe,0xc9))[_0xbccb('0x45')](handleError(_0x426dbe,null));};exports[_0xbccb('0x22')]=function(_0x4b7aa1,_0x55af96){if(_0x4b7aa1[_0xbccb('0x47')]['id']){delete _0x4b7aa1['body']['id'];}return db['AnalyticTreeReport'][_0xbccb('0x44')]({'where':{'id':_0x4b7aa1[_0xbccb('0x43')]['id']}})['then'](handleEntityNotFound(_0x55af96,null))[_0xbccb('0x23')](saveUpdates(_0x4b7aa1[_0xbccb('0x47')],null))['then'](respondWithResult(_0x55af96,null))['catch'](handleError(_0x55af96,null));};exports[_0xbccb('0x24')]=function(_0x502d82,_0x2c9a3a){return db[_0xbccb('0x3e')][_0xbccb('0x44')]({'where':{'id':_0x502d82[_0xbccb('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c9a3a,null))[_0xbccb('0x23')](removeEntity(_0x2c9a3a,null))['catch'](handleError(_0x2c9a3a,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 6be498a..04d63e2 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 _0x2d95=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger'];(function(_0x546ad7,_0x1fd92e){var _0x32461d=function(_0xf5b89b){while(--_0xf5b89b){_0x546ad7['push'](_0x546ad7['shift']());}};_0x32461d(++_0x1fd92e);}(_0x2d95,0xca));var _0x52d9=function(_0x516dc1,_0x410144){_0x516dc1=_0x516dc1-0x0;var _0x47673c=_0x2d95[_0x516dc1];return _0x47673c;};'use strict';var _=require(_0x52d9('0x0'));var util=require('util');var logger=require(_0x52d9('0x1'))('api');var moment=require(_0x52d9('0x2'));var BPromise=require(_0x52d9('0x3'));var rp=require(_0x52d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52d9('0x5'));var config=require(_0x52d9('0x6'));var attributes=require(_0x52d9('0x7'));module[_0x52d9('0x8')]=function(_0x16eb99,_0x2735cc){return _0x16eb99[_0x52d9('0x9')](_0x52d9('0xa'),attributes,{'tableName':_0x52d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed5c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x202e6c,_0x56a6c9){var _0x160ed2=function(_0x36701f){while(--_0x36701f){_0x202e6c['push'](_0x202e6c['shift']());}};_0x160ed2(++_0x56a6c9);}(_0xed5c,0x81));var _0xced5=function(_0x4f12f8,_0x45f24b){_0x4f12f8=_0x4f12f8-0x0;var _0x4d2bc9=_0xed5c[_0x4f12f8];return _0x4d2bc9;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var logger=require(_0xced5('0x2'))(_0xced5('0x3'));var moment=require(_0xced5('0x4'));var BPromise=require(_0xced5('0x5'));var rp=require(_0xced5('0x6'));var fs=require('fs');var path=require(_0xced5('0x7'));var rimraf=require(_0xced5('0x8'));var config=require(_0xced5('0x9'));var attributes=require('./analyticTreeReport.attributes');module[_0xced5('0xa')]=function(_0x20ff58,_0x4b7807){return _0x20ff58['define'](_0xced5('0xb'),attributes,{'tableName':_0xced5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 83ef975..2d93393 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 _0x4be1=['request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','AnalyticTreeReport,\x20%s,\x20%s'];(function(_0x3cb875,_0x2b8c21){var _0x3fde28=function(_0x4a83f9){while(--_0x4a83f9){_0x3cb875['push'](_0x3cb875['shift']());}};_0x3fde28(++_0x2b8c21);}(_0x4be1,0x1e3));var _0x14be=function(_0x1830ce,_0x305798){_0x1830ce=_0x1830ce-0x0;var _0x2bce9f=_0x4be1[_0x1830ce];return _0x2bce9f;};'use strict';var _=require(_0x14be('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x14be('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14be('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x14be('0x3'))(_0x14be('0x4'));var config=require(_0x14be('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x14be('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31690a,_0x1d8694,_0xb23a38){return new BPromise(function(_0x3bc5e7,_0x2813f9){return client[_0x14be('0x7')](_0x31690a,_0xb23a38)[_0x14be('0x8')](function(_0xf644a){logger[_0x14be('0x9')](_0x14be('0xa'),_0x1d8694,_0x14be('0xb'));logger[_0x14be('0xc')](_0x14be('0xd'),_0x1d8694,'request\x20sent',JSON[_0x14be('0xe')](_0xf644a));if(_0xf644a[_0x14be('0xf')]){if(_0xf644a[_0x14be('0xf')][_0x14be('0x10')]===0x1f4){logger[_0x14be('0xf')](_0x14be('0xa'),_0x1d8694,_0xf644a['error']['message']);return _0x2813f9(_0xf644a[_0x14be('0xf')][_0x14be('0x11')]);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x1d8694,_0xf644a[_0x14be('0xf')][_0x14be('0x11')]);return _0x3bc5e7(_0xf644a['error'][_0x14be('0x11')]);}else{logger[_0x14be('0x9')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1d8694,'request\x20sent');_0x3bc5e7(_0xf644a['result'][_0x14be('0x11')]);}})[_0x14be('0x12')](function(_0x1ca160){logger[_0x14be('0xf')](_0x14be('0xa'),_0x1d8694,_0x1ca160);_0x2813f9(_0x1ca160);});});} \ No newline at end of file +var _0x1586=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','info','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1bd91c,_0x285e72){var _0x3bc43c=function(_0x5801c4){while(--_0x5801c4){_0x1bd91c['push'](_0x1bd91c['shift']());}};_0x3bc43c(++_0x285e72);}(_0x1586,0x1dd));var _0x6158=function(_0x5eff86,_0x2cdd22){_0x5eff86=_0x5eff86-0x0;var _0x4b3010=_0x1586[_0x5eff86];return _0x4b3010;};'use strict';var _=require(_0x6158('0x0'));var util=require(_0x6158('0x1'));var moment=require(_0x6158('0x2'));var BPromise=require(_0x6158('0x3'));var rs=require(_0x6158('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6158('0x5'))['db'];var utils=require(_0x6158('0x6'));var logger=require(_0x6158('0x7'))('rpc');var config=require(_0x6158('0x8'));var jayson=require(_0x6158('0x9'));var client=jayson[_0x6158('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4708bb,_0x4e9bd7,_0x176e0b){return new BPromise(function(_0x3f4fe2,_0x4efec3){return client[_0x6158('0xb')](_0x4708bb,_0x176e0b)[_0x6158('0xc')](function(_0x2eb11b){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x4e9bd7,_0x6158('0xd'));logger[_0x6158('0xe')](_0x6158('0xf'),_0x4e9bd7,_0x6158('0xd'),JSON['stringify'](_0x2eb11b));if(_0x2eb11b[_0x6158('0x10')]){if(_0x2eb11b[_0x6158('0x10')][_0x6158('0x11')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4e9bd7,_0x2eb11b[_0x6158('0x10')][_0x6158('0x12')]);return _0x4efec3(_0x2eb11b[_0x6158('0x10')][_0x6158('0x12')]);}logger[_0x6158('0x10')](_0x6158('0x13'),_0x4e9bd7,_0x2eb11b[_0x6158('0x10')][_0x6158('0x12')]);return _0x3f4fe2(_0x2eb11b[_0x6158('0x10')][_0x6158('0x12')]);}else{logger[_0x6158('0x14')](_0x6158('0x13'),_0x4e9bd7,_0x6158('0xd'));_0x3f4fe2(_0x2eb11b['result']['message']);}})['catch'](function(_0x107163){logger[_0x6158('0x10')](_0x6158('0x13'),_0x4e9bd7,_0x107163);_0x4efec3(_0x107163);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 83bcfa1..52dce0a 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 _0xd802=['../../config/environment','isAuthenticated','index','get','show','put','/:id','update','delete','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1326b4,_0x434e53){var _0xa10b8a=function(_0x3c72fb){while(--_0x3c72fb){_0x1326b4['push'](_0x1326b4['shift']());}};_0xa10b8a(++_0x434e53);}(_0xd802,0x7a));var _0x2d80=function(_0x3328bd,_0x34b6cc){_0x3328bd=_0x3328bd-0x0;var _0xf2012a=_0xd802[_0x3328bd];return _0xf2012a;};'use strict';var multer=require('multer');var util=require(_0x2d80('0x0'));var path=require(_0x2d80('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d80('0x2'));var router=express['Router']();var fs_extra=require(_0x2d80('0x3'));var auth=require(_0x2d80('0x4'));var interaction=require(_0x2d80('0x5'));var config=require(_0x2d80('0x6'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x2d80('0x7')](),controller[_0x2d80('0x8')]);router[_0x2d80('0x9')]('/:id',auth[_0x2d80('0x7')](),controller[_0x2d80('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2d80('0xb')](_0x2d80('0xc'),auth[_0x2d80('0x7')](),controller[_0x2d80('0xd')]);router[_0x2d80('0xe')](_0x2d80('0xc'),auth[_0x2d80('0x7')](),controller[_0x2d80('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3edd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x3edd,0x14f));var _0xd3ed=function(_0x456351,_0x53c78e){_0x456351=_0x456351-0x0;var _0x1f3167=_0x3edd[_0x456351];return _0x1f3167;};'use strict';var multer=require(_0xd3ed('0x0'));var util=require(_0xd3ed('0x1'));var path=require(_0xd3ed('0x2'));var timeout=require(_0xd3ed('0x3'));var express=require(_0xd3ed('0x4'));var router=express[_0xd3ed('0x5')]();var fs_extra=require(_0xd3ed('0x6'));var auth=require(_0xd3ed('0x7'));var interaction=require(_0xd3ed('0x8'));var config=require(_0xd3ed('0x9'));var controller=require(_0xd3ed('0xa'));router['get']('/',auth[_0xd3ed('0xb')](),controller[_0xd3ed('0xc')]);router[_0xd3ed('0xd')](_0xd3ed('0xe'),auth[_0xd3ed('0xb')](),controller['show']);router[_0xd3ed('0xf')]('/',auth[_0xd3ed('0xb')](),controller['create']);router[_0xd3ed('0x10')](_0xd3ed('0xe'),auth['isAuthenticated'](),controller[_0xd3ed('0x11')]);router[_0xd3ed('0x12')](_0xd3ed('0xe'),auth['isAuthenticated'](),controller[_0xd3ed('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 3cf2a0a..934d65e 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 _0x3a78=['exports','STRING','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3a78,0x18e));var _0x83a7=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x3a78[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require(_0x83a7('0x0'));module[_0x83a7('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x83a7('0x2')]}}; \ No newline at end of file +var _0x3079=['exports','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3079,0xec));var _0x9307=function(_0xcd9be0,_0x296129){_0xcd9be0=_0xcd9be0-0x0;var _0x556238=_0x3079[_0xcd9be0];return _0x556238;};'use strict';var Sequelize=require('sequelize');module[_0x9307('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9307('0x1')]},'type':{'type':Sequelize[_0x9307('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index cf0c6d6..6a6f2fb 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 _0x8995=['merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','clone','get','omit','updatedAt','body','createdAt','create','update','basename','file','filename','mimetype','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','name','send','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter'];(function(_0xed315e,_0x351648){var _0xfa6e=function(_0x125846){while(--_0x125846){_0xed315e['push'](_0xed315e['shift']());}};_0xfa6e(++_0x351648);}(_0x8995,0x1ce));var _0x5899=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x8995[_0xa2c0a3];return _0x52c618;};'use strict';var pdf=require(_0x5899('0x0'));var emlformat=require(_0x5899('0x1'));var rimraf=require(_0x5899('0x2'));var zipdir=require(_0x5899('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5899('0x4'));var moment=require(_0x5899('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5899('0x6'));var util=require(_0x5899('0x7'));var path=require(_0x5899('0x8'));var sox=require(_0x5899('0x9'));var csv=require('to-csv');var ejs=require(_0x5899('0xa'));var fs=require('fs');var fs_extra=require(_0x5899('0xb'));var _=require(_0x5899('0xc'));var squel=require(_0x5899('0xd'));var crypto=require('crypto');var jsforce=require(_0x5899('0xe'));var deskjs=require(_0x5899('0xf'));var toCsv=require(_0x5899('0x10'));var querystring=require('querystring');var Papa=require(_0x5899('0x11'));var Redis=require(_0x5899('0x12'));var authService=require(_0x5899('0x13'));var qs=require(_0x5899('0x14'));var as=require(_0x5899('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5899('0x16'))('api');var utils=require(_0x5899('0x17'));var config=require(_0x5899('0x18'));var licenseUtil=require(_0x5899('0x19'));var db=require(_0x5899('0x1a'))['db'];function respondWithStatusCode(_0x56dce0,_0x296dc6){_0x296dc6=_0x296dc6||0xcc;return function(_0x224e89){if(_0x224e89){return _0x56dce0[_0x5899('0x1b')](_0x296dc6);}return _0x56dce0[_0x5899('0x1c')](_0x296dc6)[_0x5899('0x1d')]();};}function respondWithResult(_0x276e1a,_0x34c11c){_0x34c11c=_0x34c11c||0xc8;return function(_0x2b1c01){if(_0x2b1c01){return _0x276e1a[_0x5899('0x1c')](_0x34c11c)[_0x5899('0x1e')](_0x2b1c01);}};}function respondWithFilteredResult(_0x31d39d,_0x2158ae){return function(_0x20a4b0){if(_0x20a4b0){var _0x2521e6=_0x20a4b0[_0x5899('0x1f')],_0x2de794=_0x2158ae[_0x5899('0x20')],_0x370566=_0x2158ae[_0x5899('0x20')]+_0x2158ae[_0x5899('0x21')],_0x364e34;if(_0x370566>=_0x2521e6){_0x370566=_0x2521e6;_0x364e34=0xc8;}else{_0x364e34=0xce;}_0x31d39d[_0x5899('0x1c')](_0x364e34);return _0x31d39d[_0x5899('0x22')]('Content-Range',_0x2de794+'-'+_0x370566+'/'+_0x2521e6)[_0x5899('0x1e')](_0x20a4b0);}return null;};}function patchUpdates(_0x59fc7e){return function(_0x21227c){try{jsonpatch[_0x5899('0x23')](_0x21227c,_0x59fc7e,!![]);}catch(_0x512d01){return BPromise[_0x5899('0x24')](_0x512d01);}return _0x21227c[_0x5899('0x25')]();};}function saveUpdates(_0x288739,_0x5680bf){return function(_0x55c85b){if(_0x55c85b){return _0x55c85b['update'](_0x288739)[_0x5899('0x26')](function(_0x57040f){return _0x57040f;});}return null;};}function removeEntity(_0x460972,_0x205629){return function(_0x314e02){if(_0x314e02){return _0x314e02[_0x5899('0x27')]()['then'](function(){_0x460972[_0x5899('0x1c')](0xcc)[_0x5899('0x1d')]();});}};}function handleEntityNotFound(_0x41661c,_0x24d441){return function(_0x1f5bae){if(!_0x1f5bae){_0x41661c[_0x5899('0x1b')](0x194);}return _0x1f5bae;};}function handleError(_0x2984c5,_0x1c42c7){_0x1c42c7=_0x1c42c7||0x1f4;return function(_0x473f60){logger['error'](_0x473f60['stack']);if(_0x473f60[_0x5899('0x28')]){delete _0x473f60['name'];}_0x2984c5[_0x5899('0x1c')](_0x1c42c7)[_0x5899('0x29')](_0x473f60);};}exports['index']=function(_0x1e7823,_0x358854){var _0x12b187={},_0x5330fc={},_0x4580ad={'count':0x0,'rows':[]};var _0x3a39cd=_[_0x5899('0x2a')](db[_0x5899('0x2b')][_0x5899('0x2c')],function(_0x3744d2){return{'name':_0x3744d2[_0x5899('0x2d')],'type':_0x3744d2[_0x5899('0x2e')][_0x5899('0x2f')]};});_0x5330fc[_0x5899('0x30')]=_['map'](_0x3a39cd,'name');_0x5330fc['query']=_['keys'](_0x1e7823[_0x5899('0x31')]);_0x5330fc[_0x5899('0x32')]=_[_0x5899('0x33')](_0x5330fc[_0x5899('0x30')],_0x5330fc[_0x5899('0x31')]);_0x12b187['attributes']=_[_0x5899('0x33')](_0x5330fc[_0x5899('0x30')],qs[_0x5899('0x34')](_0x1e7823[_0x5899('0x31')][_0x5899('0x34')]));_0x12b187[_0x5899('0x35')]=_0x12b187['attributes'][_0x5899('0x36')]?_0x12b187[_0x5899('0x35')]:_0x5330fc[_0x5899('0x30')];if(!_0x1e7823[_0x5899('0x31')][_0x5899('0x37')](_0x5899('0x38'))){_0x12b187[_0x5899('0x21')]=qs[_0x5899('0x21')](_0x1e7823[_0x5899('0x31')][_0x5899('0x21')]);_0x12b187[_0x5899('0x20')]=qs[_0x5899('0x20')](_0x1e7823[_0x5899('0x31')][_0x5899('0x20')]);}_0x12b187['order']=qs[_0x5899('0x39')](_0x1e7823[_0x5899('0x31')][_0x5899('0x39')]);_0x12b187[_0x5899('0x3a')]=qs[_0x5899('0x32')](_['pick'](_0x1e7823['query'],_0x5330fc[_0x5899('0x32')]),_0x3a39cd);if(_0x1e7823[_0x5899('0x31')][_0x5899('0x3b')]){_0x12b187[_0x5899('0x3a')]=_[_0x5899('0x3c')](_0x12b187['where'],{'$or':_[_0x5899('0x2a')](_0x3a39cd,function(_0x5516e7){if(_0x5516e7[_0x5899('0x2e')]!==_0x5899('0x3d')){var _0x3fe35f={};_0x3fe35f[_0x5516e7[_0x5899('0x28')]]={'$like':'%'+_0x1e7823[_0x5899('0x31')][_0x5899('0x3b')]+'%'};return _0x3fe35f;}})});}_0x12b187=_['merge']({},_0x12b187,_0x1e7823[_0x5899('0x3e')]);var _0x2a74ef={'where':_0x12b187[_0x5899('0x3a')]};return db[_0x5899('0x2b')][_0x5899('0x1f')](_0x2a74ef)[_0x5899('0x26')](function(_0x4165df){_0x4580ad[_0x5899('0x1f')]=_0x4165df;if(_0x1e7823['query'][_0x5899('0x3f')]){_0x12b187[_0x5899('0x40')]=[{'all':!![]}];}return db[_0x5899('0x2b')][_0x5899('0x41')](_0x12b187);})['then'](function(_0x461519){_0x4580ad['rows']=_0x461519;return _0x4580ad;})[_0x5899('0x26')](respondWithFilteredResult(_0x358854,_0x12b187))[_0x5899('0x42')](handleError(_0x358854,null));};exports['show']=function(_0x20bc89,_0x3f4653){var _0x1a3024={'raw':!![],'where':{'id':_0x20bc89[_0x5899('0x43')]['id']}},_0x516d99={};_0x516d99['model']=_[_0x5899('0x44')](db[_0x5899('0x2b')][_0x5899('0x2c')]);_0x516d99['query']=_[_0x5899('0x44')](_0x20bc89[_0x5899('0x31')]);_0x516d99[_0x5899('0x32')]=_['intersection'](_0x516d99[_0x5899('0x30')],_0x516d99[_0x5899('0x31')]);_0x1a3024['attributes']=_['intersection'](_0x516d99['model'],qs[_0x5899('0x34')](_0x20bc89[_0x5899('0x31')][_0x5899('0x34')]));_0x1a3024[_0x5899('0x35')]=_0x1a3024['attributes'][_0x5899('0x36')]?_0x1a3024['attributes']:_0x516d99[_0x5899('0x30')];if(_0x20bc89[_0x5899('0x31')][_0x5899('0x3f')]){_0x1a3024['include']=[{'all':!![]}];}_0x1a3024=_[_0x5899('0x3c')]({},_0x1a3024,_0x20bc89[_0x5899('0x3e')]);return db[_0x5899('0x2b')][_0x5899('0x45')](_0x1a3024)[_0x5899('0x26')](handleEntityNotFound(_0x3f4653,null))['then'](respondWithResult(_0x3f4653,null))[_0x5899('0x42')](handleError(_0x3f4653,null));};exports[_0x5899('0x46')]=function(_0x3ee090,_0xf79d3d){var _0xcd1dba={'where':{'id':_0x3ee090[_0x5899('0x43')]['id']}},_0x3478e3={};_0x3478e3[_0x5899('0x30')]=_[_0x5899('0x44')](db[_0x5899('0x2b')][_0x5899('0x2c')]);_0xcd1dba[_0x5899('0x35')]=_[_0x5899('0x33')](_0x3478e3[_0x5899('0x30')],qs[_0x5899('0x34')](_0x3ee090[_0x5899('0x31')][_0x5899('0x34')]));_0xcd1dba[_0x5899('0x35')]=_0xcd1dba[_0x5899('0x35')][_0x5899('0x36')]?_0xcd1dba[_0x5899('0x35')]:_0x3478e3[_0x5899('0x30')];if(_0x3ee090[_0x5899('0x31')]['includeAll']){_0xcd1dba[_0x5899('0x40')]=[{'all':!![]}];}_0xcd1dba=_['merge']({},_0xcd1dba,_0x3ee090[_0x5899('0x3e')]);return db[_0x5899('0x2b')][_0x5899('0x45')](_0xcd1dba)['then'](handleEntityNotFound(_0xf79d3d,null))[_0x5899('0x26')](function(_0x255dbb){if(_0x255dbb){var _0x2166cb=_0x255dbb[_0x5899('0x47')]({'plain':!![]});_0x2166cb=qs[_0x5899('0x48')](_0x2166cb,['id','createdAt',_0x5899('0x49')]);_0x3ee090['body']=_['omit'](_0x3ee090[_0x5899('0x4a')],['id',_0x5899('0x4b'),_0x5899('0x49')]);return db[_0x5899('0x2b')][_0x5899('0x4c')](_[_0x5899('0x3c')](_0x2166cb,_0x3ee090[_0x5899('0x4a')]),{'include':_0x3ee090[_0x5899('0x31')][_0x5899('0x3f')]?[{'all':!![]}]:undefined});}})[_0x5899('0x26')](respondWithResult(_0xf79d3d,0xc9))[_0x5899('0x42')](handleError(_0xf79d3d,null));};exports[_0x5899('0x4d')]=function(_0x214878,_0x111632){if(_0x214878[_0x5899('0x4a')]['id']){delete _0x214878[_0x5899('0x4a')]['id'];}return db[_0x5899('0x2b')][_0x5899('0x45')]({'where':{'id':_0x214878[_0x5899('0x43')]['id']}})['then'](handleEntityNotFound(_0x111632,null))[_0x5899('0x26')](saveUpdates(_0x214878[_0x5899('0x4a')],null))[_0x5899('0x26')](respondWithResult(_0x111632,null))[_0x5899('0x42')](handleError(_0x111632,null));};exports[_0x5899('0x27')]=function(_0x527081,_0x543568){return db[_0x5899('0x2b')][_0x5899('0x45')]({'where':{'id':_0x527081['params']['id']}})['then'](handleEntityNotFound(_0x543568,null))[_0x5899('0x26')](removeEntity(_0x543568,null))['catch'](handleError(_0x543568,null));};exports[_0x5899('0x4c')]=function(_0x3aa1b4,_0x36c0a0,_0x36e51c){_0x3aa1b4[_0x5899('0x4a')][_0x5899('0x28')]=_0x3aa1b4['file']['originalname'];_0x3aa1b4['body'][_0x5899('0x4e')]=_0x3aa1b4[_0x5899('0x4f')][_0x5899('0x50')];_0x3aa1b4[_0x5899('0x4a')][_0x5899('0x2e')]=_0x3aa1b4['file'][_0x5899('0x51')];return db[_0x5899('0x2b')][_0x5899('0x4c')](_0x3aa1b4[_0x5899('0x4a')])[_0x5899('0x26')](respondWithResult(_0x36c0a0,0xc9))[_0x5899('0x42')](handleError(_0x36c0a0,null));};exports['download']=function(_0xb25695,_0x56bc82,_0x27123c){return db[_0x5899('0x2b')]['findOne']({'where':{'id':_0xb25695[_0x5899('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x56bc82,null))[_0x5899('0x26')](function(_0x537847){if(_0x537847){var _0x128a24=_0x537847[_0x5899('0x52')]!==null;var _0x2d1e2f=path[_0x5899('0x53')](config['root'],_0x5899('0x54'));if(_0x128a24){_0x2d1e2f=path[_0x5899('0x53')](_0x2d1e2f,_0x5899('0x55'));}var _0x4f73ef=path[_0x5899('0x53')](_0x2d1e2f,_0x537847['basename']);return _0x56bc82[_0x5899('0x56')](_0x4f73ef);}})['catch'](handleError(_0x56bc82,null));}; \ No newline at end of file +var _0x545e=['fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','apply','reject','update','then','destroy','end','error','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x36b611,_0x1e42e7){var _0x2d6dd8=function(_0x370d48){while(--_0x370d48){_0x36b611['push'](_0x36b611['shift']());}};_0x2d6dd8(++_0x1e42e7);}(_0x545e,0xac));var _0xe545=function(_0x113dd8,_0x398222){_0x113dd8=_0x113dd8-0x0;var _0x58369b=_0x545e[_0x113dd8];return _0x58369b;};'use strict';var pdf=require(_0xe545('0x0'));var emlformat=require(_0xe545('0x1'));var rimraf=require(_0xe545('0x2'));var zipdir=require(_0xe545('0x3'));var jsonpatch=require(_0xe545('0x4'));var rp=require(_0xe545('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe545('0x6'));var util=require(_0xe545('0x7'));var path=require('path');var sox=require(_0xe545('0x8'));var csv=require(_0xe545('0x9'));var ejs=require(_0xe545('0xa'));var fs=require('fs');var fs_extra=require(_0xe545('0xb'));var _=require(_0xe545('0xc'));var squel=require(_0xe545('0xd'));var crypto=require(_0xe545('0xe'));var jsforce=require(_0xe545('0xf'));var deskjs=require(_0xe545('0x10'));var toCsv=require(_0xe545('0x9'));var querystring=require('querystring');var Papa=require(_0xe545('0x11'));var Redis=require(_0xe545('0x12'));var authService=require(_0xe545('0x13'));var qs=require(_0xe545('0x14'));var as=require(_0xe545('0x15'));var hardwareService=require(_0xe545('0x16'));var logger=require(_0xe545('0x17'))(_0xe545('0x18'));var utils=require(_0xe545('0x19'));var config=require(_0xe545('0x1a'));var licenseUtil=require(_0xe545('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x352433,_0x72918a){_0x72918a=_0x72918a||0xcc;return function(_0x1f78ed){if(_0x1f78ed){return _0x352433[_0xe545('0x1c')](_0x72918a);}return _0x352433[_0xe545('0x1d')](_0x72918a)['end']();};}function respondWithResult(_0x1a7dde,_0x4e988e){_0x4e988e=_0x4e988e||0xc8;return function(_0x36a027){if(_0x36a027){return _0x1a7dde['status'](_0x4e988e)[_0xe545('0x1e')](_0x36a027);}};}function respondWithFilteredResult(_0x188fab,_0x52db97){return function(_0x7de029){if(_0x7de029){var _0x14a240=_0x7de029[_0xe545('0x1f')],_0x37f986=_0x52db97['offset'],_0x28ca01=_0x52db97[_0xe545('0x20')]+_0x52db97['limit'],_0x5465be;if(_0x28ca01>=_0x14a240){_0x28ca01=_0x14a240;_0x5465be=0xc8;}else{_0x5465be=0xce;}_0x188fab[_0xe545('0x1d')](_0x5465be);return _0x188fab['set']('Content-Range',_0x37f986+'-'+_0x28ca01+'/'+_0x14a240)['json'](_0x7de029);}return null;};}function patchUpdates(_0x59ade6){return function(_0x2b10f5){try{jsonpatch[_0xe545('0x21')](_0x2b10f5,_0x59ade6,!![]);}catch(_0x29fc9a){return BPromise[_0xe545('0x22')](_0x29fc9a);}return _0x2b10f5['save']();};}function saveUpdates(_0x66bd1c,_0x128c88){return function(_0x1c3195){if(_0x1c3195){return _0x1c3195[_0xe545('0x23')](_0x66bd1c)[_0xe545('0x24')](function(_0x3a04b5){return _0x3a04b5;});}return null;};}function removeEntity(_0x40f70b,_0x569927){return function(_0x3969ae){if(_0x3969ae){return _0x3969ae[_0xe545('0x25')]()['then'](function(){_0x40f70b[_0xe545('0x1d')](0xcc)[_0xe545('0x26')]();});}};}function handleEntityNotFound(_0x42b5d3,_0x25d5c5){return function(_0x3b589f){if(!_0x3b589f){_0x42b5d3[_0xe545('0x1c')](0x194);}return _0x3b589f;};}function handleError(_0x179fb7,_0x131f8b){_0x131f8b=_0x131f8b||0x1f4;return function(_0x31e076){logger[_0xe545('0x27')](_0x31e076['stack']);if(_0x31e076['name']){delete _0x31e076[_0xe545('0x28')];}_0x179fb7[_0xe545('0x1d')](_0x131f8b)[_0xe545('0x29')](_0x31e076);};}exports[_0xe545('0x2a')]=function(_0x36211d,_0x1a5d77){var _0x45ff9d={},_0x58724a={},_0x554299={'count':0x0,'rows':[]};var _0x4940d4=_[_0xe545('0x2b')](db[_0xe545('0x2c')][_0xe545('0x2d')],function(_0x2a4889){return{'name':_0x2a4889[_0xe545('0x2e')],'type':_0x2a4889[_0xe545('0x2f')]['key']};});_0x58724a[_0xe545('0x30')]=_[_0xe545('0x2b')](_0x4940d4,'name');_0x58724a[_0xe545('0x31')]=_[_0xe545('0x32')](_0x36211d[_0xe545('0x31')]);_0x58724a[_0xe545('0x33')]=_[_0xe545('0x34')](_0x58724a[_0xe545('0x30')],_0x58724a['query']);_0x45ff9d[_0xe545('0x35')]=_[_0xe545('0x34')](_0x58724a[_0xe545('0x30')],qs[_0xe545('0x36')](_0x36211d['query'][_0xe545('0x36')]));_0x45ff9d['attributes']=_0x45ff9d[_0xe545('0x35')][_0xe545('0x37')]?_0x45ff9d[_0xe545('0x35')]:_0x58724a[_0xe545('0x30')];if(!_0x36211d[_0xe545('0x31')][_0xe545('0x38')]('nolimit')){_0x45ff9d[_0xe545('0x39')]=qs[_0xe545('0x39')](_0x36211d['query']['limit']);_0x45ff9d[_0xe545('0x20')]=qs[_0xe545('0x20')](_0x36211d[_0xe545('0x31')]['offset']);}_0x45ff9d[_0xe545('0x3a')]=qs[_0xe545('0x3b')](_0x36211d[_0xe545('0x31')]['sort']);_0x45ff9d['where']=qs[_0xe545('0x33')](_[_0xe545('0x3c')](_0x36211d['query'],_0x58724a['filters']),_0x4940d4);if(_0x36211d[_0xe545('0x31')]['filter']){_0x45ff9d[_0xe545('0x3d')]=_[_0xe545('0x3e')](_0x45ff9d[_0xe545('0x3d')],{'$or':_[_0xe545('0x2b')](_0x4940d4,function(_0x1d2792){if(_0x1d2792[_0xe545('0x2f')]!==_0xe545('0x3f')){var _0xe4f2ae={};_0xe4f2ae[_0x1d2792['name']]={'$like':'%'+_0x36211d[_0xe545('0x31')][_0xe545('0x40')]+'%'};return _0xe4f2ae;}})});}_0x45ff9d=_[_0xe545('0x3e')]({},_0x45ff9d,_0x36211d[_0xe545('0x41')]);var _0x45e9cf={'where':_0x45ff9d[_0xe545('0x3d')]};return db[_0xe545('0x2c')][_0xe545('0x1f')](_0x45e9cf)['then'](function(_0x4ec757){_0x554299[_0xe545('0x1f')]=_0x4ec757;if(_0x36211d[_0xe545('0x31')]['includeAll']){_0x45ff9d[_0xe545('0x42')]=[{'all':!![]}];}return db['Attachment'][_0xe545('0x43')](_0x45ff9d);})['then'](function(_0x476b32){_0x554299['rows']=_0x476b32;return _0x554299;})[_0xe545('0x24')](respondWithFilteredResult(_0x1a5d77,_0x45ff9d))[_0xe545('0x44')](handleError(_0x1a5d77,null));};exports[_0xe545('0x45')]=function(_0x2a6a28,_0x425a25){var _0x2e484b={'raw':!![],'where':{'id':_0x2a6a28[_0xe545('0x46')]['id']}},_0xe3b1a7={};_0xe3b1a7['model']=_[_0xe545('0x32')](db[_0xe545('0x2c')][_0xe545('0x2d')]);_0xe3b1a7['query']=_[_0xe545('0x32')](_0x2a6a28[_0xe545('0x31')]);_0xe3b1a7[_0xe545('0x33')]=_[_0xe545('0x34')](_0xe3b1a7[_0xe545('0x30')],_0xe3b1a7['query']);_0x2e484b['attributes']=_['intersection'](_0xe3b1a7['model'],qs['fields'](_0x2a6a28[_0xe545('0x31')][_0xe545('0x36')]));_0x2e484b[_0xe545('0x35')]=_0x2e484b[_0xe545('0x35')][_0xe545('0x37')]?_0x2e484b['attributes']:_0xe3b1a7['model'];if(_0x2a6a28[_0xe545('0x31')][_0xe545('0x47')]){_0x2e484b[_0xe545('0x42')]=[{'all':!![]}];}_0x2e484b=_[_0xe545('0x3e')]({},_0x2e484b,_0x2a6a28[_0xe545('0x41')]);return db[_0xe545('0x2c')][_0xe545('0x48')](_0x2e484b)[_0xe545('0x24')](handleEntityNotFound(_0x425a25,null))['then'](respondWithResult(_0x425a25,null))['catch'](handleError(_0x425a25,null));};exports['clone']=function(_0x4369f5,_0x2bec7b){var _0x3b8e9b={'where':{'id':_0x4369f5[_0xe545('0x46')]['id']}},_0x1c7630={};_0x1c7630[_0xe545('0x30')]=_[_0xe545('0x32')](db[_0xe545('0x2c')][_0xe545('0x2d')]);_0x3b8e9b['attributes']=_[_0xe545('0x34')](_0x1c7630['model'],qs[_0xe545('0x36')](_0x4369f5[_0xe545('0x31')][_0xe545('0x36')]));_0x3b8e9b[_0xe545('0x35')]=_0x3b8e9b['attributes'][_0xe545('0x37')]?_0x3b8e9b[_0xe545('0x35')]:_0x1c7630[_0xe545('0x30')];if(_0x4369f5['query'][_0xe545('0x47')]){_0x3b8e9b[_0xe545('0x42')]=[{'all':!![]}];}_0x3b8e9b=_[_0xe545('0x3e')]({},_0x3b8e9b,_0x4369f5[_0xe545('0x41')]);return db[_0xe545('0x2c')]['find'](_0x3b8e9b)[_0xe545('0x24')](handleEntityNotFound(_0x2bec7b,null))[_0xe545('0x24')](function(_0x412326){if(_0x412326){var _0x312829=_0x412326[_0xe545('0x49')]({'plain':!![]});_0x312829=qs[_0xe545('0x4a')](_0x312829,['id',_0xe545('0x4b'),_0xe545('0x4c')]);_0x4369f5[_0xe545('0x4d')]=_[_0xe545('0x4a')](_0x4369f5[_0xe545('0x4d')],['id',_0xe545('0x4b'),_0xe545('0x4c')]);return db['Attachment'][_0xe545('0x4e')](_[_0xe545('0x3e')](_0x312829,_0x4369f5[_0xe545('0x4d')]),{'include':_0x4369f5['query'][_0xe545('0x47')]?[{'all':!![]}]:undefined});}})[_0xe545('0x24')](respondWithResult(_0x2bec7b,0xc9))[_0xe545('0x44')](handleError(_0x2bec7b,null));};exports[_0xe545('0x23')]=function(_0x13c93b,_0x2493e8){if(_0x13c93b[_0xe545('0x4d')]['id']){delete _0x13c93b[_0xe545('0x4d')]['id'];}return db[_0xe545('0x2c')]['find']({'where':{'id':_0x13c93b[_0xe545('0x46')]['id']}})['then'](handleEntityNotFound(_0x2493e8,null))[_0xe545('0x24')](saveUpdates(_0x13c93b[_0xe545('0x4d')],null))[_0xe545('0x24')](respondWithResult(_0x2493e8,null))[_0xe545('0x44')](handleError(_0x2493e8,null));};exports[_0xe545('0x25')]=function(_0x32ac6e,_0x3e408e){return db[_0xe545('0x2c')][_0xe545('0x48')]({'where':{'id':_0x32ac6e[_0xe545('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e408e,null))[_0xe545('0x24')](removeEntity(_0x3e408e,null))[_0xe545('0x44')](handleError(_0x3e408e,null));};exports[_0xe545('0x4e')]=function(_0x307ae4,_0x1fa7a4,_0xcd7900){_0x307ae4[_0xe545('0x4d')]['name']=_0x307ae4[_0xe545('0x4f')][_0xe545('0x50')];_0x307ae4[_0xe545('0x4d')][_0xe545('0x51')]=_0x307ae4[_0xe545('0x4f')][_0xe545('0x52')];_0x307ae4[_0xe545('0x4d')][_0xe545('0x2f')]=_0x307ae4['file'][_0xe545('0x53')];return db[_0xe545('0x2c')]['create'](_0x307ae4[_0xe545('0x4d')])[_0xe545('0x24')](respondWithResult(_0x1fa7a4,0xc9))[_0xe545('0x44')](handleError(_0x1fa7a4,null));};exports[_0xe545('0x54')]=function(_0x2d1442,_0x371426,_0x1273f6){return db[_0xe545('0x2c')]['findOne']({'where':{'id':_0x2d1442['params']['id']},'raw':!![]})[_0xe545('0x24')](handleEntityNotFound(_0x371426,null))['then'](function(_0x635a26){if(_0x635a26){var _0x268bd0=_0x635a26[_0xe545('0x55')]!==null;var _0x213c92=path[_0xe545('0x56')](config['root'],_0xe545('0x57'));if(_0x268bd0){_0x213c92=path[_0xe545('0x56')](_0x213c92,'offline-chat/');}var _0x49fc15=path[_0xe545('0x56')](_0x213c92,_0x635a26['basename']);return _0x371426['download'](_0x49fc15);}})[_0xe545('0x44')](handleError(_0x371426,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4f9946b..4bdf7c8 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 _0x7cd6=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./attachment.attributes','define','Attachment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x6fdc30,_0xcdec71){_0x6fdc30=_0x6fdc30-0x0;var _0xb7bbf8=_0x7cd6[_0x6fdc30];return _0xb7bbf8;};'use strict';var _=require(_0x67cd('0x0'));var util=require(_0x67cd('0x1'));var logger=require(_0x67cd('0x2'))(_0x67cd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67cd('0x4'));var fs=require('fs');var path=require(_0x67cd('0x5'));var rimraf=require(_0x67cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x67cd('0x7'));module['exports']=function(_0x218c1c,_0x2cec15){return _0x218c1c[_0x67cd('0x8')](_0x67cd('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02f7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Attachment','attachments','lodash'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x02f7,0x1d3));var _0x702f=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x02f7[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0x702f('0x0'));var util=require(_0x702f('0x1'));var logger=require(_0x702f('0x2'))('api');var moment=require(_0x702f('0x3'));var BPromise=require(_0x702f('0x4'));var rp=require(_0x702f('0x5'));var fs=require('fs');var path=require(_0x702f('0x6'));var rimraf=require(_0x702f('0x7'));var config=require(_0x702f('0x8'));var attributes=require('./attachment.attributes');module['exports']=function(_0x449ba1,_0x4ff1d2){return _0x449ba1[_0x702f('0x9')](_0x702f('0xa'),attributes,{'tableName':_0x702f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 3f02948..ab53a91 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 _0x2d08=['lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateAttachment','Attachment','create','body','options','catch'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0x2d08,0x1b0));var _0x82d0=function(_0x2f601c,_0x5a94a2){_0x2f601c=_0x2f601c-0x0;var _0x50a269=_0x2d08[_0x2f601c];return _0x50a269;};'use strict';var _=require(_0x82d0('0x0'));var util=require(_0x82d0('0x1'));var moment=require(_0x82d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x82d0('0x3'));var fs=require('fs');var Redis=require(_0x82d0('0x4'));var db=require(_0x82d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x82d0('0x6'));var config=require(_0x82d0('0x7'));var jayson=require(_0x82d0('0x8'));var client=jayson[_0x82d0('0x9')][_0x82d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x584243,_0x2629cb,_0x1d4627){return new BPromise(function(_0x16da6f,_0x4242c5){return client[_0x82d0('0xb')](_0x584243,_0x1d4627)[_0x82d0('0xc')](function(_0x2764c8){logger[_0x82d0('0xd')](_0x82d0('0xe'),_0x2629cb,_0x82d0('0xf'));logger[_0x82d0('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x2629cb,_0x82d0('0xf'),JSON[_0x82d0('0x11')](_0x2764c8));if(_0x2764c8[_0x82d0('0x12')]){if(_0x2764c8['error']['code']===0x1f4){logger['error'](_0x82d0('0xe'),_0x2629cb,_0x2764c8['error'][_0x82d0('0x13')]);return _0x4242c5(_0x2764c8[_0x82d0('0x12')][_0x82d0('0x13')]);}logger['error'](_0x82d0('0xe'),_0x2629cb,_0x2764c8[_0x82d0('0x12')][_0x82d0('0x13')]);return _0x16da6f(_0x2764c8[_0x82d0('0x12')]['message']);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x2629cb,_0x82d0('0xf'));_0x16da6f(_0x2764c8[_0x82d0('0x14')][_0x82d0('0x13')]);}})['catch'](function(_0x2e53a1){logger[_0x82d0('0x12')](_0x82d0('0xe'),_0x2629cb,_0x2e53a1);_0x4242c5(_0x2e53a1);});});}exports[_0x82d0('0x15')]=function(_0x4b1f83){var _0x4cc168=this;return new Promise(function(_0x577ae9,_0x4b66b8){return db[_0x82d0('0x16')][_0x82d0('0x17')](_0x4b1f83[_0x82d0('0x18')],{'raw':_0x4b1f83[_0x82d0('0x19')]?_0x4b1f83['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x56242e){logger[_0x82d0('0xd')](_0x82d0('0x15'),_0x4b1f83);logger['debug']('CreateAttachment',_0x4b1f83,JSON['stringify'](_0x56242e));_0x577ae9(_0x56242e);})[_0x82d0('0x1a')](function(_0x488770){logger[_0x82d0('0x12')](_0x82d0('0x15'),_0x488770['message'],_0x4b1f83);_0x4b66b8(_0x4cc168[_0x82d0('0x12')](0x1f4,_0x488770[_0x82d0('0x13')]));});});}; \ No newline at end of file +var _0xec1d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','stringify','lodash'];(function(_0x54d164,_0x3be5ba){var _0xf58243=function(_0x58faf5){while(--_0x58faf5){_0x54d164['push'](_0x54d164['shift']());}};_0xf58243(++_0x3be5ba);}(_0xec1d,0x173));var _0xdec1=function(_0x32490a,_0x4bc7e8){_0x32490a=_0x32490a-0x0;var _0x4d737d=_0xec1d[_0x32490a];return _0x4d737d;};'use strict';var _=require(_0xdec1('0x0'));var util=require(_0xdec1('0x1'));var moment=require(_0xdec1('0x2'));var BPromise=require(_0xdec1('0x3'));var rs=require(_0xdec1('0x4'));var fs=require('fs');var Redis=require(_0xdec1('0x5'));var db=require(_0xdec1('0x6'))['db'];var utils=require(_0xdec1('0x7'));var logger=require(_0xdec1('0x8'))(_0xdec1('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdec1('0xa')][_0xdec1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e49db,_0x429ec5,_0x5c7879){return new BPromise(function(_0x3cf00c,_0x452b8d){return client[_0xdec1('0xc')](_0x2e49db,_0x5c7879)[_0xdec1('0xd')](function(_0x1c92f2){logger[_0xdec1('0xe')](_0xdec1('0xf'),_0x429ec5,_0xdec1('0x10'));logger[_0xdec1('0x11')](_0xdec1('0x12'),_0x429ec5,_0xdec1('0x10'),JSON['stringify'](_0x1c92f2));if(_0x1c92f2[_0xdec1('0x13')]){if(_0x1c92f2[_0xdec1('0x13')][_0xdec1('0x14')]===0x1f4){logger[_0xdec1('0x13')](_0xdec1('0xf'),_0x429ec5,_0x1c92f2['error'][_0xdec1('0x15')]);return _0x452b8d(_0x1c92f2[_0xdec1('0x13')][_0xdec1('0x15')]);}logger['error'](_0xdec1('0xf'),_0x429ec5,_0x1c92f2[_0xdec1('0x13')][_0xdec1('0x15')]);return _0x3cf00c(_0x1c92f2['error'][_0xdec1('0x15')]);}else{logger[_0xdec1('0xe')](_0xdec1('0xf'),_0x429ec5,'request\x20sent');_0x3cf00c(_0x1c92f2[_0xdec1('0x16')][_0xdec1('0x15')]);}})[_0xdec1('0x17')](function(_0x1111d0){logger[_0xdec1('0x13')](_0xdec1('0xf'),_0x429ec5,_0x1111d0);_0x452b8d(_0x1111d0);});});}exports['CreateAttachment']=function(_0x2b4cbb){var _0x2f5a9d=this;return new Promise(function(_0x21f5af,_0x18f4f5){return db[_0xdec1('0x18')][_0xdec1('0x19')](_0x2b4cbb[_0xdec1('0x1a')],{'raw':_0x2b4cbb[_0xdec1('0x1b')]?_0x2b4cbb[_0xdec1('0x1b')][_0xdec1('0x1c')]===undefined?!![]:![]:!![]})[_0xdec1('0xd')](function(_0x5e2d16){logger['info'](_0xdec1('0x1d'),_0x2b4cbb);logger[_0xdec1('0x11')](_0xdec1('0x1d'),_0x2b4cbb,JSON[_0xdec1('0x1e')](_0x5e2d16));_0x21f5af(_0x5e2d16);})[_0xdec1('0x17')](function(_0x4d73bd){logger[_0xdec1('0x13')](_0xdec1('0x1d'),_0x4d73bd[_0xdec1('0x15')],_0x2b4cbb);_0x18f4f5(_0x2f5a9d[_0xdec1('0x13')](0x1f4,_0x4d73bd['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 0ff7f5e..d1c567f 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 _0x74f0=['format','now','replace','single','file','create','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','/:id/clone','clone','join','root','server/files/attachments/'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x74f0,0xf3));var _0x074f=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x74f0[_0x41d432];return _0x1650f9;};'use strict';var multer=require('multer');var util=require(_0x074f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x074f('0x1'));var router=express[_0x074f('0x2')]();var fs_extra=require(_0x074f('0x3'));var auth=require(_0x074f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x074f('0x5'));router[_0x074f('0x6')]('/',auth[_0x074f('0x7')](),controller[_0x074f('0x8')]);router[_0x074f('0x6')](_0x074f('0x9'),auth[_0x074f('0x7')](),controller['show']);router[_0x074f('0x6')](_0x074f('0xa'),auth['isAuthenticated'](),controller[_0x074f('0xb')]);router[_0x074f('0xc')](_0x074f('0xd'),auth[_0x074f('0x7')](),controller[_0x074f('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f0952,_0x65f965,_0x41646d){_0x41646d(null,path[_0x074f('0xf')](config[_0x074f('0x10')],_0x074f('0x11')));},'filename':function(_0x2416e0,_0x1d3304,_0x46cea0){_0x46cea0(null,util[_0x074f('0x12')]('%s-%s',Date[_0x074f('0x13')](),_0x1d3304['originalname'][_0x074f('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x074f('0xc')]('/',upload[_0x074f('0x15')](_0x074f('0x16')),controller[_0x074f('0x17')]);router[_0x074f('0x18')](_0x074f('0x9'),auth[_0x074f('0x7')](),controller[_0x074f('0x19')]);router[_0x074f('0x1a')](_0x074f('0x9'),auth['isAuthenticated'](),controller[_0x074f('0x1b')]);module[_0x074f('0x1c')]=router; \ No newline at end of file +var _0x02a7=['download','post','clone','diskStorage','join','root','format','now','originalname','replace','single','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','index','/:id','isAuthenticated'];(function(_0x348777,_0x20fa44){var _0x49c9e4=function(_0x1c13b2){while(--_0x1c13b2){_0x348777['push'](_0x348777['shift']());}};_0x49c9e4(++_0x20fa44);}(_0x02a7,0x1a6));var _0x702a=function(_0x4ddbf6,_0x59e8fe){_0x4ddbf6=_0x4ddbf6-0x0;var _0x5a1750=_0x02a7[_0x4ddbf6];return _0x5a1750;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require(_0x702a('0x1'));var timeout=require(_0x702a('0x2'));var express=require(_0x702a('0x3'));var router=express[_0x702a('0x4')]();var fs_extra=require(_0x702a('0x5'));var auth=require(_0x702a('0x6'));var interaction=require(_0x702a('0x7'));var config=require(_0x702a('0x8'));var controller=require(_0x702a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x702a('0xa')]);router['get'](_0x702a('0xb'),auth[_0x702a('0xc')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x702a('0xd')]);router[_0x702a('0xe')]('/:id/clone',auth[_0x702a('0xc')](),controller[_0x702a('0xf')]);var upload=multer({'storage':multer[_0x702a('0x10')]({'destination':function(_0x25920c,_0x19c575,_0x45f1b3){_0x45f1b3(null,path[_0x702a('0x11')](config[_0x702a('0x12')],'server/files/attachments/'));},'filename':function(_0x40a896,_0x8b70f6,_0x15adfe){_0x15adfe(null,util[_0x702a('0x13')]('%s-%s',Date[_0x702a('0x14')](),_0x8b70f6[_0x702a('0x15')][_0x702a('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x702a('0xe')]('/',upload[_0x702a('0x17')]('file'),controller[_0x702a('0x18')]);router[_0x702a('0x19')](_0x702a('0xb'),auth[_0x702a('0xc')](),controller[_0x702a('0x1a')]);router[_0x702a('0x1b')](_0x702a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x702a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 164a67b..3d96778 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 _0x4f74=['callback','clientID','clientSecret','secret','callbackURL','findOne','blockDuration','then','find','map','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../components/auth/service','signToken','login','authenticate','google','/login','profile','email'];(function(_0x3de2e3,_0x138ce7){var _0x1bce2a=function(_0x39c79f){while(--_0x39c79f){_0x3de2e3['push'](_0x3de2e3['shift']());}};_0x1bce2a(++_0x138ce7);}(_0x4f74,0xd4));var _0x44f7=function(_0x65cd03,_0x2913ee){_0x65cd03=_0x65cd03-0x0;var _0x21c579=_0x4f74[_0x65cd03];return _0x21c579;};'use strict';var _=require(_0x44f7('0x0'));var passport=require(_0x44f7('0x1'));var GoogleStrategy=require(_0x44f7('0x2'))[_0x44f7('0x3')];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require(_0x44f7('0x4'))[_0x44f7('0x5')];var utils=require('../../config/utils');exports[_0x44f7('0x6')]=passport[_0x44f7('0x7')](_0x44f7('0x8'),{'failureRedirect':_0x44f7('0x9'),'scope':[_0x44f7('0xa'),_0x44f7('0xb')],'session':![]});exports[_0x44f7('0xc')]=passport['authenticate'](_0x44f7('0x8'),{'failureRedirect':_0x44f7('0x9'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x44f7('0x8')]?config[_0x44f7('0x8')][_0x44f7('0xd')]:'id','clientSecret':config[_0x44f7('0x8')]?config[_0x44f7('0x8')][_0x44f7('0xe')]:_0x44f7('0xf'),'callbackURL':config[_0x44f7('0x8')]?config[_0x44f7('0x8')][_0x44f7('0x10')]:''},function(_0x5a2dd4,_0x43e937,_0x20ca0e,_0x518c14){var _0x2cdfe7,_0x127a14;return db['Setting'][_0x44f7('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x44f7('0x12')],'raw':!![]})[_0x44f7('0x13')](function(_0x358b0e){_0x2cdfe7=_0x358b0e;return db['User'][_0x44f7('0x14')]({'where':{'email':_[_0x44f7('0x15')](_0x20ca0e['emails'],'value'),'role':{'$or':[_0x44f7('0x16'),_0x44f7('0x17'),_0x44f7('0x18')]}}});})['then'](function(_0x94c125){_0x127a14=_0x94c125;if(_0x127a14){if(_0x127a14[_0x44f7('0x19')]){return _0x518c14(_0x44f7('0x1a'));}else if(_0x2cdfe7[_0x44f7('0x12')]>0x0){if(_0x127a14[_0x44f7('0x1b')]){if(moment(_0x127a14[_0x44f7('0x1c')])['add'](_0x2cdfe7[_0x44f7('0x12')],'minutes')>moment()){return _0x518c14('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x44f7('0x1d')](_0x127a14,0x0,![],null)[_0x44f7('0x13')](function(){return utils[_0x44f7('0x1e')](_0x127a14);})['then'](function(){return _0x518c14(null,_0x127a14);});}}else{return utils['getLicense'](_0x127a14)['then'](function(){return _0x518c14(null,_0x127a14);});}}else{return utils[_0x44f7('0x1e')](_0x127a14)[_0x44f7('0x13')](function(){return _0x518c14(null,_0x127a14);});}}return _0x518c14('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x44f7('0x1f')](function(_0x4b0e30){_0x518c14(_0x4b0e30);});})); \ No newline at end of file +var _0x6c1e=['findOne','allowedLoginAttempts','blockDuration','then','find','emails','user','disabled','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','signToken','../../config/utils','authenticate','/login','profile','email','callback','google','use','clientID','clientSecret','secret'];(function(_0x59a7da,_0x24a045){var _0x579329=function(_0x20ef89){while(--_0x20ef89){_0x59a7da['push'](_0x59a7da['shift']());}};_0x579329(++_0x24a045);}(_0x6c1e,0xee));var _0xe6c1=function(_0x3ff3ad,_0x405fb3){_0x3ff3ad=_0x3ff3ad-0x0;var _0x2ada24=_0x6c1e[_0x3ff3ad];return _0x2ada24;};'use strict';var _=require(_0xe6c1('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xe6c1('0x1'))[_0xe6c1('0x2')];var moment=require(_0xe6c1('0x3'));var db=require(_0xe6c1('0x4'))['db'];var config=require(_0xe6c1('0x5'));var signToken=require('../../components/auth/service')[_0xe6c1('0x6')];var utils=require(_0xe6c1('0x7'));exports['login']=passport[_0xe6c1('0x8')]('google',{'failureRedirect':_0xe6c1('0x9'),'scope':[_0xe6c1('0xa'),_0xe6c1('0xb')],'session':![]});exports[_0xe6c1('0xc')]=passport[_0xe6c1('0x8')](_0xe6c1('0xd'),{'failureRedirect':'/login','session':![]});passport[_0xe6c1('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0xe6c1('0xd')][_0xe6c1('0xf')]:'id','clientSecret':config[_0xe6c1('0xd')]?config[_0xe6c1('0xd')][_0xe6c1('0x10')]:_0xe6c1('0x11'),'callbackURL':config[_0xe6c1('0xd')]?config[_0xe6c1('0xd')]['callbackURL']:''},function(_0x2d01e4,_0x14d7a9,_0x592ed6,_0x1f2328){var _0x4f9acb,_0x83007d;return db['Setting'][_0xe6c1('0x12')]({'where':{'id':0x1},'attributes':[_0xe6c1('0x13'),_0xe6c1('0x14')],'raw':!![]})[_0xe6c1('0x15')](function(_0x4de05a){_0x4f9acb=_0x4de05a;return db['User'][_0xe6c1('0x16')]({'where':{'email':_['map'](_0x592ed6[_0xe6c1('0x17')],'value'),'role':{'$or':['admin',_0xe6c1('0x18'),'agent']}}});})['then'](function(_0x5d651f){_0x83007d=_0x5d651f;if(_0x83007d){if(_0x83007d[_0xe6c1('0x19')]){return _0x1f2328('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x4f9acb['blockDuration']>0x0){if(_0x83007d['blocked']){if(moment(_0x83007d['blockedAt'])[_0xe6c1('0x1a')](_0x4f9acb[_0xe6c1('0x14')],_0xe6c1('0x1b'))>moment()){return _0x1f2328(_0xe6c1('0x1c'));}else{return utils[_0xe6c1('0x1d')](_0x83007d,0x0,![],null)[_0xe6c1('0x15')](function(){return utils['getLicense'](_0x83007d);})[_0xe6c1('0x15')](function(){return _0x1f2328(null,_0x83007d);});}}else{return utils[_0xe6c1('0x1e')](_0x83007d)[_0xe6c1('0x15')](function(){return _0x1f2328(null,_0x83007d);});}}else{return utils['getLicense'](_0x83007d)[_0xe6c1('0x15')](function(){return _0x1f2328(null,_0x83007d);});}}return _0x1f2328(_0xe6c1('0x1c'));})[_0xe6c1('0x1f')](function(_0x5809f1){_0x1f2328(_0x5809f1);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 648bb32..a9216bb 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 _0x9a62=['isMiddleware','login','setTokenCookie','exports','passport','Router','../user/user.controller.js','../../components/auth/service','get','/callback','callback'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x9a62,0x1bc));var _0x29a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a62[_0x40a045];return _0x1a687c;};'use strict';var express=require('express');var passport=require(_0x29a6('0x0'));var router=express[_0x29a6('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x29a6('0x2'));var authService=require(_0x29a6('0x3'));router['get']('/',controller['login']);router[_0x29a6('0x4')](_0x29a6('0x5'),controller[_0x29a6('0x6')],authService[_0x29a6('0x7')],userController[_0x29a6('0x8')],authService[_0x29a6('0x9')]);module[_0x29a6('0xa')]=router; \ No newline at end of file +var _0x4fdc=['isMiddleware','setTokenCookie','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback'];(function(_0x17c6aa,_0x3b3d23){var _0x392119=function(_0x403d77){while(--_0x403d77){_0x17c6aa['push'](_0x17c6aa['shift']());}};_0x392119(++_0x3b3d23);}(_0x4fdc,0x84));var _0xc4fd=function(_0x394294,_0x1c6e3d){_0x394294=_0x394294-0x0;var _0xfa2dd=_0x4fdc[_0x394294];return _0xfa2dd;};'use strict';var express=require('express');var passport=require(_0xc4fd('0x0'));var router=express['Router']();var controller=require(_0xc4fd('0x1'));var userController=require(_0xc4fd('0x2'));var authService=require(_0xc4fd('0x3'));router['get']('/',controller[_0xc4fd('0x4')]);router[_0xc4fd('0x5')](_0xc4fd('0x6'),controller[_0xc4fd('0x7')],authService[_0xc4fd('0x8')],userController[_0xc4fd('0x4')],authService[_0xc4fd('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6e4b4df..2d4f419 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 _0x3d04=['headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','password','salt','role','disabled','blockedAt','loginAttempts','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockDuration','clearBlockUser','add','minutes','catch','getLicense','MailAccount','find','email','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','body','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'];(function(_0x2590f2,_0x39d266){var _0x4477e9=function(_0xa0be65){while(--_0xa0be65){_0x2590f2['push'](_0x2590f2['shift']());}};_0x4477e9(++_0x39d266);}(_0x3d04,0xbe));var _0x43d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d04[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x43d0('0x0'));var passport=require(_0x43d0('0x1'));var LocalStrategy=require(_0x43d0('0x2'))[_0x43d0('0x3')];var jayson=require(_0x43d0('0x4'));var _=require(_0x43d0('0x5'));var rs=require(_0x43d0('0x6'));var moment=require(_0x43d0('0x7'));var db=require('../../mysqldb')['db'];var authService=require(_0x43d0('0x8'));var utils=require(_0x43d0('0x9'));var client=jayson[_0x43d0('0xa')][_0x43d0('0xb')]({'port':0x232b});function localAuthenticate(_0x5e284f,_0x484271,_0x50919e,_0x5efb95){var _0x457550,_0x3344d3;return db[_0x43d0('0xc')][_0x43d0('0xd')]({'where':{'id':0x1},'attributes':[_0x43d0('0xe'),'blockDuration'],'raw':!![]})['then'](function(_0x198aa0){_0x457550=_0x198aa0;return _0x5e284f['findOne']({'attributes':['id','name',_0x43d0('0xf'),_0x43d0('0x10'),_0x43d0('0x11'),_0x43d0('0x12'),'blocked',_0x43d0('0x13'),_0x43d0('0x14')],'where':{'name':_0x484271,'role':{'$or':['admin',_0x43d0('0x15'),_0x43d0('0x16')]}}});})[_0x43d0('0x17')](function(_0x5ed340){if(!_0x5ed340||_0x5ed340&&_0x5ed340[_0x43d0('0x18')]!==_0x484271){throw new Error(_0x43d0('0x19'));}else{_0x3344d3=_0x5ed340;return _0x3344d3;}})[_0x43d0('0x17')](function(){_0x3344d3['authenticate'](_0x50919e,function(_0x257510,_0x357f87){var _0x44e6ec=_0x3344d3[_0x43d0('0x14')]+0x1;if(_0x257510){return _0x5efb95(_0x257510);}else if(!_0x357f87){if(_0x3344d3[_0x43d0('0x12')]){return _0x5efb95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x457550['allowedLoginAttempts']>0x0){if(_0x3344d3[_0x43d0('0x1a')]){if(_0x457550[_0x43d0('0x1b')]>0x0){if(moment(_0x3344d3[_0x43d0('0x13')])['add'](_0x457550[_0x43d0('0x1b')],'minutes')>moment()){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}else{return utils[_0x43d0('0x1c')](_0x3344d3,_0x44e6ec,![],null)[_0x43d0('0x17')](function(){return _0x5efb95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}}else{if(_0x44e6ec>=_0x457550[_0x43d0('0xe')]){return utils['clearBlockUser'](_0x3344d3,0x0,!![],moment())[_0x43d0('0x17')](function(){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});});}else{return utils[_0x43d0('0x1c')](_0x3344d3,_0x44e6ec,![],null)[_0x43d0('0x17')](function(){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});});}}}else{return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}}else{if(_0x3344d3[_0x43d0('0x12')]){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}else if(_0x457550[_0x43d0('0xe')]>0x0){if(_0x3344d3[_0x43d0('0x1a')]){if(_0x457550[_0x43d0('0x1b')]>0x0){if(moment(_0x3344d3[_0x43d0('0x13')])[_0x43d0('0x1d')](_0x457550[_0x43d0('0x1b')],_0x43d0('0x1e'))>moment()){return _0x5efb95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x43d0('0x1c')](_0x3344d3,0x0,![],null)[_0x43d0('0x17')](function(){return utils['getLicense'](_0x3344d3);})[_0x43d0('0x17')](function(){return _0x5efb95(null,_0x3344d3);});}}else{return _0x5efb95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x43d0('0x1c')](_0x3344d3,0x0,![],null)[_0x43d0('0x17')](function(){return utils['getLicense'](_0x3344d3);})[_0x43d0('0x17')](function(){return _0x5efb95(null,_0x3344d3);})[_0x43d0('0x1f')](function(_0x5ac4c0){return _0x5efb95(null,![],_0x5ac4c0);});}}else{if(_0x3344d3[_0x43d0('0x1a')]){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}else{return utils[_0x43d0('0x20')](_0x3344d3)['then'](function(){return _0x5efb95(null,_0x3344d3);});}}}});})[_0x43d0('0x1f')](function(_0x38e89e){return _0x5efb95(null,![],_0x38e89e);});}function sendServiceMail(_0x2c4f3f){return db[_0x43d0('0x21')][_0x43d0('0x22')]({'where':{'service':!![]},'attributes':['id',_0x43d0('0x18'),_0x43d0('0x23')],'include':[{'model':db['MailServerOut'],'as':_0x43d0('0x24')}]})[_0x43d0('0x17')](function(_0x6bc471){if(!_0x6bc471){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x4bfce9={'tls':{'rejectUnauthorized':![]}};if(_0x6bc471['Smtp'][_0x43d0('0x25')]){_0x4bfce9[_0x43d0('0x25')]=_0x6bc471[_0x43d0('0x24')][_0x43d0('0x25')];}else{_0x4bfce9[_0x43d0('0x26')]=_0x6bc471[_0x43d0('0x24')]['host'];_0x4bfce9[_0x43d0('0x27')]=_0x6bc471[_0x43d0('0x24')][_0x43d0('0x27')];_0x4bfce9[_0x43d0('0x28')]=_0x6bc471[_0x43d0('0x24')][_0x43d0('0x28')];}if(_0x6bc471[_0x43d0('0x24')][_0x43d0('0x29')]){_0x4bfce9[_0x43d0('0x2a')]={'user':_0x6bc471[_0x43d0('0x24')][_0x43d0('0x15')],'pass':_0x6bc471['Smtp'][_0x43d0('0x2b')]};}var _0x1f1713={'account':_0x4bfce9,'message':_[_0x43d0('0x2c')]({'from':util[_0x43d0('0x2d')]('\x22%s\x22\x20<%s>',_0x6bc471[_0x43d0('0x18')],_0x6bc471['email']||_0x6bc471[_0x43d0('0x24')][_0x43d0('0x15')])},_0x2c4f3f)};return client['request'](_0x43d0('0x2e'),_0x1f1713);})[_0x43d0('0x17')](function(_0x2aea11){if(_0x2aea11[_0x43d0('0x2f')]){throw new Error(util[_0x43d0('0x2d')](_0x43d0('0x30'),_0x2aea11[_0x43d0('0x2f')][_0x43d0('0x31')]||JSON[_0x43d0('0x32')](_0x2aea11[_0x43d0('0x2f')])));}return!![];});}function handleError(_0x41ff64,_0x498334,_0x3afb3b){return _0x41ff64[_0x43d0('0x33')](_0x498334||0x1f4)[_0x43d0('0x34')]({'message':_0x3afb3b?_0x3afb3b[_0x43d0('0x31')]||_0x3afb3b:''});}exports[_0x43d0('0x35')]=function(_0x201453,_0x314360,_0xf5b750){passport[_0x43d0('0x36')](_0x43d0('0x37'),function(_0x235fb2,_0x1f0092,_0x19843c){var _0x9cfc45=_0x235fb2||_0x19843c;if(_0x9cfc45){return handleError(_0x314360,0x191,_0x9cfc45);}if(!_0x1f0092){return handleError(_0x314360,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x898576={'payload':{'id':_0x1f0092['id'],'role':_0x1f0092[_0x43d0('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x43d0('0x38')](_0x898576)[_0x43d0('0x17')](function(_0x227fc9){_0x314360[_0x43d0('0x39')]({'id':_0x1f0092['id'],'token':_0x227fc9,'statusCall':'','isAlreadyLogged':_0x1f0092[_0x43d0('0x3a')]});});}})(_0x201453,_0x314360,_0xf5b750);};exports[_0x43d0('0x3b')]=function(_0x4ae965,_0x5b536c,_0x45566a){if(!_0x4ae965['body']['email']){return handleError(_0x5b536c,0x1f4,{'message':_0x43d0('0x3c')});}var _0x56947e=rs[_0x43d0('0x3d')]();_0x4ae965['body'][_0x43d0('0x23')]=_0x4ae965['body'][_0x43d0('0x23')][_0x43d0('0x3e')]()[_0x43d0('0x3f')]();var _0x4e817e;return db[_0x43d0('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0x43d0('0xe'),'blockDuration'],'raw':!![]})['then'](function(_0x32fdcd){_0x4e817e=_0x32fdcd;return db[_0x43d0('0x40')]['find']({'where':{'email':_0x4ae965[_0x43d0('0x41')][_0x43d0('0x23')]}});})[_0x43d0('0x17')](function(_0x134586){if(!_0x134586){throw new Error(_0x43d0('0x42'));}if(_0x134586['disabled']){throw new Error(_0x43d0('0x43'));}if(_0x134586[_0x43d0('0x1a')]){if(moment(_0x134586[_0x43d0('0x13')])[_0x43d0('0x1d')](_0x4e817e['blockDuration'],_0x43d0('0x1e'))>moment()){throw new Error(_0x43d0('0x44'));}else{_0x134586[_0x43d0('0x1a')]=![];_0x134586[_0x43d0('0x13')]=null;}}_0x134586[_0x43d0('0x45')]=_0x56947e;_0x134586['resetPasswordExpires']=Date[_0x43d0('0x46')]()+0x36ee80;return _0x134586[_0x43d0('0x47')]();})['then'](function(){return sendServiceMail({'to':_0x4ae965[_0x43d0('0x41')][_0x43d0('0x23')],'subject':_0x43d0('0x48'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x43d0('0x49')+'https://'+_0x4ae965[_0x43d0('0x4a')]['host']+_0x43d0('0x4b')+_0x56947e+'\x0a\x0a'+_0x43d0('0x4c')});})[_0x43d0('0x17')](function(){_0x5b536c[_0x43d0('0x33')](0xc8)[_0x43d0('0x34')]({'message':'Reset\x20Email\x20sent!'});})[_0x43d0('0x1f')](function(_0x4bb2a0){return handleError(_0x5b536c,0x1f4,_0x4bb2a0);});};exports[_0x43d0('0x4d')]=function(_0x3e7392,_0xddcadc,_0x94df19){return db[_0x43d0('0x40')][_0x43d0('0x22')]({'where':{'resetPasswordToken':_0x3e7392[_0x43d0('0x4e')][_0x43d0('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x43d0('0x46')]()}}})[_0x43d0('0x17')](function(_0x27affd){if(!_0x27affd){throw new Error(_0x43d0('0x50'));}return db['Setting'][_0x43d0('0xd')]({'attributes':['id',_0x43d0('0x51'),_0x43d0('0x52'),'passwordHistoryLimit']})[_0x43d0('0x17')](function(_0x5f229e){if(_0x5f229e['securePassword'])authService[_0x43d0('0x53')](_0x3e7392[_0x43d0('0x41')][_0x43d0('0xf')]);if(!_0x5f229e[_0x43d0('0x52')]||!_0x27affd[_0x43d0('0x54')])return _0x27affd;authService['validatePasswordHistory'](_0x3e7392['body'][_0x43d0('0xf')],_0x27affd['previousPasswords'],_0x5f229e[_0x43d0('0x55')]);return _0x27affd;})[_0x43d0('0x17')](function(){_0x27affd['password']=_0x3e7392['body']['password'];_0x27affd[_0x43d0('0x45')]=null;_0x27affd[_0x43d0('0x56')]=null;return _0x27affd[_0x43d0('0x47')]();});})[_0x43d0('0x17')](function(){_0xddcadc[_0x43d0('0x33')](0xc8)[_0x43d0('0x34')]({'message':_0x43d0('0x57')});})[_0x43d0('0x1f')](function(_0x366e44){return handleError(_0xddcadc,0x1f4,_0x366e44);});};passport['use'](new LocalStrategy({'usernameField':_0x43d0('0x18'),'passwordField':_0x43d0('0xf')},function(_0x2561c9,_0x33f91b,_0x44feea){return localAuthenticate(db[_0x43d0('0x40')],_0x2561c9,_0x33f91b,_0x44feea);})); \ No newline at end of file +var _0xb091=['SendMail','error','stringify','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','Email\x20parameter\x20is\x20missing','body','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','password','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','randomstring','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blocked','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure','authentication','auth','merge','format','request'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xb091,0x16e));var _0x1b09=function(_0x2287eb,_0x2b698f){_0x2287eb=_0x2287eb-0x0;var _0x11589e=_0xb091[_0x2287eb];return _0x11589e;};'use strict';var util=require('util');var passport=require(_0x1b09('0x0'));var LocalStrategy=require(_0x1b09('0x1'))[_0x1b09('0x2')];var jayson=require(_0x1b09('0x3'));var _=require('lodash');var rs=require(_0x1b09('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x1b09('0x5'));var utils=require(_0x1b09('0x6'));var client=jayson['client'][_0x1b09('0x7')]({'port':0x232b});function localAuthenticate(_0x5fa348,_0x2bf4f6,_0x5ce726,_0x142c33){var _0x8c26a5,_0x2f359f;return db[_0x1b09('0x8')][_0x1b09('0x9')]({'where':{'id':0x1},'attributes':[_0x1b09('0xa'),_0x1b09('0xb')],'raw':!![]})[_0x1b09('0xc')](function(_0x3249a1){_0x8c26a5=_0x3249a1;return _0x5fa348[_0x1b09('0x9')]({'attributes':['id',_0x1b09('0xd'),'password',_0x1b09('0xe'),_0x1b09('0xf'),'disabled','blocked',_0x1b09('0x10'),_0x1b09('0x11')],'where':{'name':_0x2bf4f6,'role':{'$or':[_0x1b09('0x12'),_0x1b09('0x13'),_0x1b09('0x14')]}}});})[_0x1b09('0xc')](function(_0x1fd3bc){if(!_0x1fd3bc||_0x1fd3bc&&_0x1fd3bc['name']!==_0x2bf4f6){throw new Error(_0x1b09('0x15'));}else{_0x2f359f=_0x1fd3bc;return _0x2f359f;}})['then'](function(){_0x2f359f[_0x1b09('0x16')](_0x5ce726,function(_0x27a731,_0x11ab46){var _0x37673e=_0x2f359f[_0x1b09('0x11')]+0x1;if(_0x27a731){return _0x142c33(_0x27a731);}else if(!_0x11ab46){if(_0x2f359f[_0x1b09('0x17')]){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else if(_0x8c26a5[_0x1b09('0xa')]>0x0){if(_0x2f359f[_0x1b09('0x18')]){if(_0x8c26a5[_0x1b09('0xb')]>0x0){if(moment(_0x2f359f[_0x1b09('0x10')])[_0x1b09('0x19')](_0x8c26a5[_0x1b09('0xb')],'minutes')>moment()){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else{return utils[_0x1b09('0x1a')](_0x2f359f,_0x37673e,![],null)['then'](function(){return _0x142c33(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x142c33(null,![],{'message':_0x1b09('0x15')});}}else{if(_0x37673e>=_0x8c26a5['allowedLoginAttempts']){return utils[_0x1b09('0x1a')](_0x2f359f,0x0,!![],moment())['then'](function(){return _0x142c33(null,![],{'message':_0x1b09('0x15')});});}else{return utils[_0x1b09('0x1a')](_0x2f359f,_0x37673e,![],null)[_0x1b09('0xc')](function(){return _0x142c33(null,![],{'message':_0x1b09('0x15')});});}}}else{return _0x142c33(null,![],{'message':_0x1b09('0x15')});}}else{if(_0x2f359f[_0x1b09('0x17')]){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else if(_0x8c26a5[_0x1b09('0xa')]>0x0){if(_0x2f359f['blocked']){if(_0x8c26a5['blockDuration']>0x0){if(moment(_0x2f359f[_0x1b09('0x10')])[_0x1b09('0x19')](_0x8c26a5['blockDuration'],_0x1b09('0x1b'))>moment()){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else{return utils[_0x1b09('0x1a')](_0x2f359f,0x0,![],null)[_0x1b09('0xc')](function(){return utils['getLicense'](_0x2f359f);})[_0x1b09('0xc')](function(){return _0x142c33(null,_0x2f359f);});}}else{return _0x142c33(null,![],{'message':_0x1b09('0x15')});}}else{return utils['clearBlockUser'](_0x2f359f,0x0,![],null)[_0x1b09('0xc')](function(){return utils[_0x1b09('0x1c')](_0x2f359f);})['then'](function(){return _0x142c33(null,_0x2f359f);})[_0x1b09('0x1d')](function(_0x108d80){return _0x142c33(null,![],_0x108d80);});}}else{if(_0x2f359f[_0x1b09('0x18')]){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else{return utils['getLicense'](_0x2f359f)[_0x1b09('0xc')](function(){return _0x142c33(null,_0x2f359f);});}}}});})[_0x1b09('0x1d')](function(_0x532589){return _0x142c33(null,![],_0x532589);});}function sendServiceMail(_0x2d1ec0){return db[_0x1b09('0x1e')][_0x1b09('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x1b09('0xd'),_0x1b09('0x20')],'include':[{'model':db[_0x1b09('0x21')],'as':_0x1b09('0x22')}]})['then'](function(_0x22e3ee){if(!_0x22e3ee){throw new Error(_0x1b09('0x23'));}var _0x4bf0ad={'tls':{'rejectUnauthorized':![]}};if(_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x24')]){_0x4bf0ad[_0x1b09('0x24')]=_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x24')];}else{_0x4bf0ad['host']=_0x22e3ee[_0x1b09('0x22')]['host'];_0x4bf0ad[_0x1b09('0x25')]=_0x22e3ee['Smtp'][_0x1b09('0x25')];_0x4bf0ad[_0x1b09('0x26')]=_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x26')];}if(_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x27')]){_0x4bf0ad[_0x1b09('0x28')]={'user':_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x13')],'pass':_0x22e3ee[_0x1b09('0x22')]['pass']};}var _0x267b28={'account':_0x4bf0ad,'message':_[_0x1b09('0x29')]({'from':util[_0x1b09('0x2a')]('\x22%s\x22\x20<%s>',_0x22e3ee[_0x1b09('0xd')],_0x22e3ee[_0x1b09('0x20')]||_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x13')])},_0x2d1ec0)};return client[_0x1b09('0x2b')](_0x1b09('0x2c'),_0x267b28);})[_0x1b09('0xc')](function(_0x1fff0b){if(_0x1fff0b['error']){throw new Error(util[_0x1b09('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1fff0b[_0x1b09('0x2d')]['message']||JSON[_0x1b09('0x2e')](_0x1fff0b[_0x1b09('0x2d')])));}return!![];});}function handleError(_0x46e202,_0x2ba156,_0x226cc1){return _0x46e202[_0x1b09('0x2f')](_0x2ba156||0x1f4)[_0x1b09('0x30')]({'message':_0x226cc1?_0x226cc1[_0x1b09('0x31')]||_0x226cc1:''});}exports[_0x1b09('0x32')]=function(_0x68fbfb,_0x1b7b3b,_0x3caa9b){passport[_0x1b09('0x16')]('local',function(_0x588b90,_0x23ce9a,_0xb2ef05){var _0x27a78c=_0x588b90||_0xb2ef05;if(_0x27a78c){return handleError(_0x1b7b3b,0x191,_0x27a78c);}if(!_0x23ce9a){return handleError(_0x1b7b3b,0x194,{'message':_0x1b09('0x33')});}else{var _0x147c2b={'payload':{'id':_0x23ce9a['id'],'role':_0x23ce9a[_0x1b09('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x1b09('0x34')](_0x147c2b)[_0x1b09('0xc')](function(_0x4dd7e2){_0x1b7b3b['json']({'id':_0x23ce9a['id'],'token':_0x4dd7e2,'statusCall':'','isAlreadyLogged':_0x23ce9a[_0x1b09('0x35')]});});}})(_0x68fbfb,_0x1b7b3b,_0x3caa9b);};exports['forgot']=function(_0x966873,_0x31dbfd,_0x1434ef){if(!_0x966873['body'][_0x1b09('0x20')]){return handleError(_0x31dbfd,0x1f4,{'message':_0x1b09('0x36')});}var _0x202b18=rs['generate']();_0x966873[_0x1b09('0x37')][_0x1b09('0x20')]=_0x966873[_0x1b09('0x37')][_0x1b09('0x20')]['trim']()[_0x1b09('0x38')]();var _0x2b2341;return db['Setting'][_0x1b09('0x9')]({'where':{'id':0x1},'attributes':[_0x1b09('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x4b388d){_0x2b2341=_0x4b388d;return db['User'][_0x1b09('0x1f')]({'where':{'email':_0x966873[_0x1b09('0x37')][_0x1b09('0x20')]}});})['then'](function(_0x207af5){if(!_0x207af5){throw new Error(_0x1b09('0x39'));}if(_0x207af5['disabled']){throw new Error(_0x1b09('0x3a'));}if(_0x207af5[_0x1b09('0x18')]){if(moment(_0x207af5[_0x1b09('0x10')])[_0x1b09('0x19')](_0x2b2341[_0x1b09('0xb')],_0x1b09('0x1b'))>moment()){throw new Error(_0x1b09('0x3b'));}else{_0x207af5[_0x1b09('0x18')]=![];_0x207af5[_0x1b09('0x10')]=null;}}_0x207af5[_0x1b09('0x3c')]=_0x202b18;_0x207af5['resetPasswordExpires']=Date[_0x1b09('0x3d')]()+0x36ee80;return _0x207af5[_0x1b09('0x3e')]();})[_0x1b09('0xc')](function(){return sendServiceMail({'to':_0x966873['body'][_0x1b09('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x1b09('0x3f')+_0x1b09('0x40')+'https://'+_0x966873[_0x1b09('0x41')][_0x1b09('0x42')]+_0x1b09('0x43')+_0x202b18+'\x0a\x0a'+_0x1b09('0x44')});})[_0x1b09('0xc')](function(){_0x31dbfd[_0x1b09('0x2f')](0xc8)['send']({'message':_0x1b09('0x45')});})['catch'](function(_0x35d9ee){return handleError(_0x31dbfd,0x1f4,_0x35d9ee);});};exports['reset']=function(_0x50a66c,_0x55376,_0x141b98){return db[_0x1b09('0x46')][_0x1b09('0x1f')]({'where':{'resetPasswordToken':_0x50a66c[_0x1b09('0x47')][_0x1b09('0x48')],'resetPasswordExpires':{'$gt':Date[_0x1b09('0x3d')]()}}})[_0x1b09('0xc')](function(_0x5bb402){if(!_0x5bb402){throw new Error(_0x1b09('0x49'));}return db[_0x1b09('0x8')][_0x1b09('0x9')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x1b09('0x4a')]})['then'](function(_0x2abc94){if(_0x2abc94[_0x1b09('0x4b')])authService['validatePasswordPattern'](_0x50a66c[_0x1b09('0x37')][_0x1b09('0x4c')]);if(!_0x2abc94['enforcePasswordHistory']||!_0x5bb402[_0x1b09('0x4d')])return _0x5bb402;authService[_0x1b09('0x4e')](_0x50a66c[_0x1b09('0x37')][_0x1b09('0x4c')],_0x5bb402[_0x1b09('0x4d')],_0x2abc94['passwordHistoryLimit']);return _0x5bb402;})[_0x1b09('0xc')](function(){_0x5bb402[_0x1b09('0x4c')]=_0x50a66c[_0x1b09('0x37')][_0x1b09('0x4c')];_0x5bb402[_0x1b09('0x3c')]=null;_0x5bb402[_0x1b09('0x4f')]=null;return _0x5bb402[_0x1b09('0x3e')]();});})['then'](function(){_0x55376['status'](0xc8)[_0x1b09('0x30')]({'message':_0x1b09('0x50')});})[_0x1b09('0x1d')](function(_0x533eb5){return handleError(_0x55376,0x1f4,_0x533eb5);});};passport[_0x1b09('0x51')](new LocalStrategy({'usernameField':_0x1b09('0xd'),'passwordField':_0x1b09('0x4c')},function(_0x5cc8f7,_0xbcf954,_0x2dcdb6){return localAuthenticate(db[_0x1b09('0x46')],_0x5cc8f7,_0xbcf954,_0x2dcdb6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d8aa55a..286ad47 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 _0x6e64=['forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x6e64,0x1dc));var _0x46e6=function(_0x577f88,_0x57af6e){_0x577f88=_0x577f88-0x0;var _0x233818=_0x6e64[_0x577f88];return _0x233818;};'use strict';var express=require(_0x46e6('0x0'));var router=express[_0x46e6('0x1')]();var controller=require(_0x46e6('0x2'));router[_0x46e6('0x3')]('/',controller['login']);router[_0x46e6('0x3')]('/forgot',controller[_0x46e6('0x4')]);router[_0x46e6('0x3')](_0x46e6('0x5'),controller[_0x46e6('0x6')]);module[_0x46e6('0x7')]=router; \ No newline at end of file +var _0x045a=['express','Router','./authLocal.controller','/forgot','forgot','post','/reset/:token','reset','exports'];(function(_0x2beb01,_0x3fca21){var _0x594b7e=function(_0xa382a9){while(--_0xa382a9){_0x2beb01['push'](_0x2beb01['shift']());}};_0x594b7e(++_0x3fca21);}(_0x045a,0x19e));var _0xa045=function(_0x279c46,_0x3bcf99){_0x279c46=_0x279c46-0x0;var _0xfd0a84=_0x045a[_0x279c46];return _0xfd0a84;};'use strict';var express=require(_0xa045('0x0'));var router=express[_0xa045('0x1')]();var controller=require(_0xa045('0x2'));router['post']('/',controller['login']);router['post'](_0xa045('0x3'),controller[_0xa045('0x4')]);router[_0xa045('0x5')](_0xa045('0x6'),controller[_0xa045('0x7')]);module[_0xa045('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 6028334..806aa63 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 _0x25fb=['sequelize','STRING'];(function(_0x152ffe,_0x7e95d){var _0x35324c=function(_0x113208){while(--_0x113208){_0x152ffe['push'](_0x152ffe['shift']());}};_0x35324c(++_0x7e95d);}(_0x25fb,0x74));var _0xb25f=function(_0x372476,_0xf4e743){_0x372476=_0x372476-0x0;var _0x598151=_0x25fb[_0x372476];return _0x598151;};'use strict';var Sequelize=require(_0xb25f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb25f('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xb25f('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xddd9=['exports','STRING','INTEGER'];(function(_0x54e856,_0x313d5c){var _0x124873=function(_0x48547e){while(--_0x48547e){_0x54e856['push'](_0x54e856['shift']());}};_0x124873(++_0x313d5c);}(_0xddd9,0x189));var _0x9ddd=function(_0x1b4c5b,_0x23fb09){_0x1b4c5b=_0x1b4c5b-0x0;var _0x1af008=_0xddd9[_0x1b4c5b];return _0x1af008;};'use strict';var Sequelize=require('sequelize');module[_0x9ddd('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9ddd('0x1')]},'description':{'type':Sequelize[_0x9ddd('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9ddd('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index a067865..d0a6066 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 _0x1578=['getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','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/license/util','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','update','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1578,0x1af));var _0x8157=function(_0x3a7883,_0x4d6399){_0x3a7883=_0x3a7883-0x0;var _0x2be3af=_0x1578[_0x3a7883];return _0x2be3af;};'use strict';var pdf=require(_0x8157('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8157('0x1'));var zipdir=require(_0x8157('0x2'));var jsonpatch=require(_0x8157('0x3'));var rp=require(_0x8157('0x4'));var moment=require(_0x8157('0x5'));var BPromise=require(_0x8157('0x6'));var Mustache=require('mustache');var util=require(_0x8157('0x7'));var path=require('path');var sox=require(_0x8157('0x8'));var csv=require(_0x8157('0x9'));var ejs=require(_0x8157('0xa'));var fs=require('fs');var fs_extra=require(_0x8157('0xb'));var _=require(_0x8157('0xc'));var squel=require(_0x8157('0xd'));var crypto=require(_0x8157('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8157('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8157('0x10'));var Papa=require(_0x8157('0x11'));var Redis=require(_0x8157('0x12'));var authService=require(_0x8157('0x13'));var qs=require(_0x8157('0x14'));var as=require(_0x8157('0x15'));var hardwareService=require(_0x8157('0x16'));var logger=require(_0x8157('0x17'))(_0x8157('0x18'));var utils=require(_0x8157('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8157('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403b8c,_0x1a21f2){_0x1a21f2=_0x1a21f2||0xcc;return function(_0x365d05){if(_0x365d05){return _0x403b8c[_0x8157('0x1b')](_0x1a21f2);}return _0x403b8c[_0x8157('0x1c')](_0x1a21f2)['end']();};}function respondWithResult(_0x21392c,_0x366880){_0x366880=_0x366880||0xc8;return function(_0x4a9004){if(_0x4a9004){return _0x21392c[_0x8157('0x1c')](_0x366880)[_0x8157('0x1d')](_0x4a9004);}};}function respondWithFilteredResult(_0x67e5cc,_0xf141a6){return function(_0x4a8613){if(_0x4a8613){var _0x20af22=_0x4a8613[_0x8157('0x1e')],_0x191e36=_0xf141a6[_0x8157('0x1f')],_0x4b44cd=_0xf141a6[_0x8157('0x1f')]+_0xf141a6[_0x8157('0x20')],_0x5a39ef;if(_0x4b44cd>=_0x20af22){_0x4b44cd=_0x20af22;_0x5a39ef=0xc8;}else{_0x5a39ef=0xce;}_0x67e5cc[_0x8157('0x1c')](_0x5a39ef);return _0x67e5cc['set'](_0x8157('0x21'),_0x191e36+'-'+_0x4b44cd+'/'+_0x20af22)[_0x8157('0x1d')](_0x4a8613);}return null;};}function patchUpdates(_0x47988d){return function(_0x29e703){try{jsonpatch['apply'](_0x29e703,_0x47988d,!![]);}catch(_0x2267ef){return BPromise[_0x8157('0x22')](_0x2267ef);}return _0x29e703[_0x8157('0x23')]();};}function saveUpdates(_0x76a36d,_0x363f22){return function(_0x30d4ae){if(_0x30d4ae){return _0x30d4ae['update'](_0x76a36d)[_0x8157('0x24')](function(_0x8f1778){return _0x8f1778;});}return null;};}function removeEntity(_0x2f61ba,_0x2b0318){return function(_0x196139){if(_0x196139){return _0x196139[_0x8157('0x25')]()['then'](function(){_0x2f61ba[_0x8157('0x1c')](0xcc)[_0x8157('0x26')]();});}};}function handleEntityNotFound(_0x4321d2,_0x58f789){return function(_0x358d8c){if(!_0x358d8c){_0x4321d2['sendStatus'](0x194);}return _0x358d8c;};}function handleError(_0xbec6bc,_0x422608){_0x422608=_0x422608||0x1f4;return function(_0x44d4a0){logger[_0x8157('0x27')](_0x44d4a0[_0x8157('0x28')]);if(_0x44d4a0[_0x8157('0x29')]){delete _0x44d4a0[_0x8157('0x29')];}_0xbec6bc[_0x8157('0x1c')](_0x422608)[_0x8157('0x2a')](_0x44d4a0);};}exports[_0x8157('0x2b')]=function(_0x58aa48,_0x37bca8){var _0x2ff12b={},_0x182e06={},_0x41644b={'count':0x0,'rows':[]};var _0x1ea0fa=_[_0x8157('0x2c')](db[_0x8157('0x2d')][_0x8157('0x2e')],function(_0x42833a){return{'name':_0x42833a[_0x8157('0x2f')],'type':_0x42833a[_0x8157('0x30')][_0x8157('0x31')]};});_0x182e06[_0x8157('0x32')]=_[_0x8157('0x2c')](_0x1ea0fa,_0x8157('0x29'));_0x182e06['query']=_[_0x8157('0x33')](_0x58aa48[_0x8157('0x34')]);_0x182e06['filters']=_['intersection'](_0x182e06['model'],_0x182e06[_0x8157('0x34')]);_0x2ff12b[_0x8157('0x35')]=_['intersection'](_0x182e06[_0x8157('0x32')],qs['fields'](_0x58aa48[_0x8157('0x34')][_0x8157('0x36')]));_0x2ff12b['attributes']=_0x2ff12b['attributes'][_0x8157('0x37')]?_0x2ff12b[_0x8157('0x35')]:_0x182e06[_0x8157('0x32')];if(!_0x58aa48[_0x8157('0x34')][_0x8157('0x38')](_0x8157('0x39'))){_0x2ff12b[_0x8157('0x20')]=qs[_0x8157('0x20')](_0x58aa48[_0x8157('0x34')][_0x8157('0x20')]);_0x2ff12b[_0x8157('0x1f')]=qs[_0x8157('0x1f')](_0x58aa48['query'][_0x8157('0x1f')]);}_0x2ff12b[_0x8157('0x3a')]=qs[_0x8157('0x3b')](_0x58aa48[_0x8157('0x34')][_0x8157('0x3b')]);_0x2ff12b[_0x8157('0x3c')]=qs[_0x8157('0x3d')](_[_0x8157('0x3e')](_0x58aa48['query'],_0x182e06[_0x8157('0x3d')]),_0x1ea0fa);if(_0x58aa48[_0x8157('0x34')][_0x8157('0x3f')]){_0x2ff12b[_0x8157('0x3c')]=_[_0x8157('0x40')](_0x2ff12b[_0x8157('0x3c')],{'$or':_['map'](_0x1ea0fa,function(_0x20d85a){if(_0x20d85a[_0x8157('0x30')]!=='VIRTUAL'){var _0xe75340={};_0xe75340[_0x20d85a[_0x8157('0x29')]]={'$like':'%'+_0x58aa48[_0x8157('0x34')][_0x8157('0x3f')]+'%'};return _0xe75340;}})});}_0x2ff12b=_[_0x8157('0x40')]({},_0x2ff12b,_0x58aa48[_0x8157('0x41')]);var _0x590c52={'where':_0x2ff12b[_0x8157('0x3c')]};return db[_0x8157('0x2d')]['count'](_0x590c52)['then'](function(_0xc6dfbf){_0x41644b[_0x8157('0x1e')]=_0xc6dfbf;if(_0x58aa48[_0x8157('0x34')][_0x8157('0x42')]){_0x2ff12b[_0x8157('0x43')]=[{'all':!![]}];}return db[_0x8157('0x2d')][_0x8157('0x44')](_0x2ff12b);})[_0x8157('0x24')](function(_0x15d28e){_0x41644b['rows']=_0x15d28e;return _0x41644b;})['then'](respondWithFilteredResult(_0x37bca8,_0x2ff12b))[_0x8157('0x45')](handleError(_0x37bca8,null));};exports[_0x8157('0x46')]=function(_0x49aa58,_0x3adb60){var _0x47590c={'raw':![],'where':{'id':_0x49aa58[_0x8157('0x47')]['id']}},_0x9667ac={};_0x9667ac[_0x8157('0x32')]=_[_0x8157('0x33')](db[_0x8157('0x2d')]['rawAttributes']);_0x9667ac[_0x8157('0x34')]=_[_0x8157('0x33')](_0x49aa58['query']);_0x9667ac[_0x8157('0x3d')]=_[_0x8157('0x48')](_0x9667ac['model'],_0x9667ac['query']);_0x47590c[_0x8157('0x35')]=_[_0x8157('0x48')](_0x9667ac[_0x8157('0x32')],qs['fields'](_0x49aa58[_0x8157('0x34')][_0x8157('0x36')]));_0x47590c[_0x8157('0x35')]=_0x47590c[_0x8157('0x35')][_0x8157('0x37')]?_0x47590c[_0x8157('0x35')]:_0x9667ac[_0x8157('0x32')];if(_0x49aa58[_0x8157('0x34')][_0x8157('0x42')]){_0x47590c[_0x8157('0x43')]=[{'all':!![]}];}_0x47590c=_[_0x8157('0x40')]({},_0x47590c,_0x49aa58[_0x8157('0x41')]);return db['Automation'][_0x8157('0x49')](_0x47590c)[_0x8157('0x24')](handleEntityNotFound(_0x3adb60,null))[_0x8157('0x24')](respondWithResult(_0x3adb60,null))[_0x8157('0x45')](handleError(_0x3adb60,null));};exports[_0x8157('0x4a')]=function(_0x12956c,_0x79a297){return db[_0x8157('0x2d')][_0x8157('0x4a')](_0x12956c[_0x8157('0x4b')],{})[_0x8157('0x24')](respondWithResult(_0x79a297,0xc9))[_0x8157('0x45')](handleError(_0x79a297,null));};exports[_0x8157('0x4c')]=function(_0x1b7178,_0x313fe6){if(_0x1b7178[_0x8157('0x4b')]['id']){delete _0x1b7178['body']['id'];}return db[_0x8157('0x2d')][_0x8157('0x49')]({'where':{'id':_0x1b7178[_0x8157('0x47')]['id']}})[_0x8157('0x24')](handleEntityNotFound(_0x313fe6,null))['then'](saveUpdates(_0x1b7178[_0x8157('0x4b')],null))[_0x8157('0x24')](respondWithResult(_0x313fe6,null))['catch'](handleError(_0x313fe6,null));};exports[_0x8157('0x25')]=function(_0x143a40,_0x2f9517){return db[_0x8157('0x2d')][_0x8157('0x49')]({'where':{'id':_0x143a40[_0x8157('0x47')]['id']}})[_0x8157('0x24')](handleEntityNotFound(_0x2f9517,null))['then'](removeEntity(_0x2f9517,null))[_0x8157('0x45')](handleError(_0x2f9517,null));};exports[_0x8157('0x4d')]=function(_0x252853,_0x4641e0,_0x44986e){return db['Condition'][_0x8157('0x49')]({'where':{'id':_0x252853[_0x8157('0x47')]['id']}})[_0x8157('0x24')](handleEntityNotFound(_0x4641e0,null))[_0x8157('0x24')](function(_0x3a6dc8){if(_0x3a6dc8){return _0x3a6dc8['addConditions'](_0x252853['body'][_0x8157('0x4e')],_[_0x8157('0x4f')](_0x252853['body'],[_0x8157('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x4641e0,null))[_0x8157('0x45')](handleError(_0x4641e0,null));};exports[_0x8157('0x50')]=function(_0x130e00,_0x4e95e8,_0x384e12){var _0xf65398={};var _0x4892c3={};var _0x58b16f;var _0x2a1f56;return db[_0x8157('0x2d')][_0x8157('0x51')]({'where':{'id':_0x130e00[_0x8157('0x47')]['id']}})[_0x8157('0x24')](handleEntityNotFound(_0x4e95e8,null))[_0x8157('0x24')](function(_0x37f546){if(_0x37f546){_0x58b16f=_0x37f546;_0x4892c3[_0x8157('0x32')]=_['keys'](db[_0x8157('0x52')][_0x8157('0x2e')]);_0x4892c3['query']=_[_0x8157('0x33')](_0x130e00[_0x8157('0x34')]);_0x4892c3['filters']=_[_0x8157('0x48')](_0x4892c3[_0x8157('0x32')],_0x4892c3['query']);_0xf65398['attributes']=_['intersection'](_0x4892c3[_0x8157('0x32')],qs[_0x8157('0x36')](_0x130e00[_0x8157('0x34')][_0x8157('0x36')]));_0xf65398['attributes']=_0xf65398['attributes']['length']?_0xf65398['attributes']:_0x4892c3[_0x8157('0x32')];_0xf65398['order']=qs['sort'](_0x130e00['query'][_0x8157('0x3b')]);_0xf65398[_0x8157('0x3c')]=qs[_0x8157('0x3d')](_[_0x8157('0x3e')](_0x130e00[_0x8157('0x34')],_0x4892c3['filters']));if(_0x130e00[_0x8157('0x34')][_0x8157('0x3f')]){_0xf65398[_0x8157('0x3c')]=_[_0x8157('0x40')](_0xf65398['where'],{'$or':_[_0x8157('0x2c')](_0xf65398[_0x8157('0x35')],function(_0x172ae5){var _0x1eff67={};_0x1eff67[_0x172ae5]={'$like':'%'+_0x130e00[_0x8157('0x34')]['filter']+'%'};return _0x1eff67;})});}_0xf65398=_[_0x8157('0x40')]({},_0xf65398,_0x130e00[_0x8157('0x41')]);return _0x58b16f[_0x8157('0x50')](_0xf65398);}})[_0x8157('0x24')](function(_0x42fbb1){if(_0x42fbb1){_0x2a1f56=_0x42fbb1[_0x8157('0x37')];if(!_0x130e00['query'][_0x8157('0x38')]('nolimit')){_0xf65398['limit']=qs[_0x8157('0x20')](_0x130e00[_0x8157('0x34')][_0x8157('0x20')]);_0xf65398[_0x8157('0x1f')]=qs['offset'](_0x130e00[_0x8157('0x34')][_0x8157('0x1f')]);}return _0x58b16f[_0x8157('0x50')](_0xf65398);}})[_0x8157('0x24')](function(_0x5cd18e){if(_0x5cd18e){return _0x5cd18e?{'count':_0x2a1f56,'rows':_0x5cd18e}:null;}})[_0x8157('0x24')](respondWithResult(_0x4e95e8,null))[_0x8157('0x45')](handleError(_0x4e95e8,null));};exports[_0x8157('0x53')]=function(_0x4377b4,_0x112314,_0x14eab8){return db[_0x8157('0x54')][_0x8157('0x49')]({'where':{'id':_0x4377b4[_0x8157('0x47')]['id']}})['then'](handleEntityNotFound(_0x112314,null))[_0x8157('0x24')](function(_0x42c7df){if(_0x42c7df){return _0x42c7df[_0x8157('0x53')](_0x4377b4['body'][_0x8157('0x4e')],_[_0x8157('0x4f')](_0x4377b4[_0x8157('0x4b')],[_0x8157('0x4e'),'id'])||{});}})[_0x8157('0x24')](respondWithResult(_0x112314,null))[_0x8157('0x45')](handleError(_0x112314,null));};exports[_0x8157('0x55')]=function(_0x21c592,_0x46b68a,_0x5cbe7e){var _0x2528da={};var _0x454680={};var _0x5def02;var _0x3f5ca4;return db[_0x8157('0x2d')][_0x8157('0x51')]({'where':{'id':_0x21c592[_0x8157('0x47')]['id']}})[_0x8157('0x24')](handleEntityNotFound(_0x46b68a,null))[_0x8157('0x24')](function(_0x2d1576){if(_0x2d1576){_0x5def02=_0x2d1576;_0x454680[_0x8157('0x32')]=_[_0x8157('0x33')](db[_0x8157('0x54')][_0x8157('0x2e')]);_0x454680[_0x8157('0x34')]=_[_0x8157('0x33')](_0x21c592[_0x8157('0x34')]);_0x454680[_0x8157('0x3d')]=_[_0x8157('0x48')](_0x454680[_0x8157('0x32')],_0x454680[_0x8157('0x34')]);_0x2528da[_0x8157('0x35')]=_['intersection'](_0x454680[_0x8157('0x32')],qs[_0x8157('0x36')](_0x21c592[_0x8157('0x34')][_0x8157('0x36')]));_0x2528da[_0x8157('0x35')]=_0x2528da[_0x8157('0x35')][_0x8157('0x37')]?_0x2528da['attributes']:_0x454680[_0x8157('0x32')];_0x2528da[_0x8157('0x3a')]=qs[_0x8157('0x3b')](_0x21c592[_0x8157('0x34')]['sort']);_0x2528da[_0x8157('0x3c')]=qs[_0x8157('0x3d')](_[_0x8157('0x3e')](_0x21c592[_0x8157('0x34')],_0x454680[_0x8157('0x3d')]));if(_0x21c592[_0x8157('0x34')]['filter']){_0x2528da[_0x8157('0x3c')]=_[_0x8157('0x40')](_0x2528da[_0x8157('0x3c')],{'$or':_['map'](_0x2528da['attributes'],function(_0x53f09e){var _0xd5d3a0={};_0xd5d3a0[_0x53f09e]={'$like':'%'+_0x21c592[_0x8157('0x34')][_0x8157('0x3f')]+'%'};return _0xd5d3a0;})});}_0x2528da=_[_0x8157('0x40')]({},_0x2528da,_0x21c592['options']);return _0x5def02['getActions'](_0x2528da);}})['then'](function(_0x1f7fa6){if(_0x1f7fa6){_0x3f5ca4=_0x1f7fa6[_0x8157('0x37')];if(!_0x21c592[_0x8157('0x34')][_0x8157('0x38')](_0x8157('0x39'))){_0x2528da[_0x8157('0x20')]=qs['limit'](_0x21c592['query']['limit']);_0x2528da[_0x8157('0x1f')]=qs[_0x8157('0x1f')](_0x21c592[_0x8157('0x34')][_0x8157('0x1f')]);}return _0x5def02[_0x8157('0x55')](_0x2528da);}})['then'](function(_0x1251e2){if(_0x1251e2){return _0x1251e2?{'count':_0x3f5ca4,'rows':_0x1251e2}:null;}})[_0x8157('0x24')](respondWithResult(_0x46b68a,null))['catch'](handleError(_0x46b68a,null));}; \ No newline at end of file +var _0x385c=['destroy','end','sendStatus','error','stack','name','send','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','find','addConditions','Condition','omit','findOne','rawAttributes','getConditions','addActions','Action','ids','getActions','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x385c,0x131));var _0xc385=function(_0x40afc1,_0x5cd1a4){_0x40afc1=_0x40afc1-0x0;var _0x1aace9=_0x385c[_0x40afc1];return _0x1aace9;};'use strict';var pdf=require(_0xc385('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc385('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc385('0x2'));var rp=require(_0xc385('0x3'));var moment=require('moment');var BPromise=require(_0xc385('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc385('0x5'));var sox=require(_0xc385('0x6'));var csv=require('to-csv');var ejs=require(_0xc385('0x7'));var fs=require('fs');var fs_extra=require(_0xc385('0x8'));var _=require(_0xc385('0x9'));var squel=require('squel');var crypto=require(_0xc385('0xa'));var jsforce=require(_0xc385('0xb'));var deskjs=require(_0xc385('0xc'));var toCsv=require(_0xc385('0xd'));var querystring=require('querystring');var Papa=require(_0xc385('0xe'));var Redis=require('ioredis');var authService=require(_0xc385('0xf'));var qs=require(_0xc385('0x10'));var as=require(_0xc385('0x11'));var hardwareService=require(_0xc385('0x12'));var logger=require('../../config/logger')(_0xc385('0x13'));var utils=require(_0xc385('0x14'));var config=require(_0xc385('0x15'));var licenseUtil=require(_0xc385('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426871,_0x5c79d6){_0x5c79d6=_0x5c79d6||0xcc;return function(_0x476235){if(_0x476235){return _0x426871['sendStatus'](_0x5c79d6);}return _0x426871[_0xc385('0x17')](_0x5c79d6)['end']();};}function respondWithResult(_0x3668ef,_0x1b7c3d){_0x1b7c3d=_0x1b7c3d||0xc8;return function(_0x119ce1){if(_0x119ce1){return _0x3668ef[_0xc385('0x17')](_0x1b7c3d)[_0xc385('0x18')](_0x119ce1);}};}function respondWithFilteredResult(_0x1c5523,_0x24abe3){return function(_0x412759){if(_0x412759){var _0x400003=_0x412759[_0xc385('0x19')],_0x10c352=_0x24abe3[_0xc385('0x1a')],_0x4b0862=_0x24abe3['offset']+_0x24abe3[_0xc385('0x1b')],_0x5b5082;if(_0x4b0862>=_0x400003){_0x4b0862=_0x400003;_0x5b5082=0xc8;}else{_0x5b5082=0xce;}_0x1c5523[_0xc385('0x17')](_0x5b5082);return _0x1c5523[_0xc385('0x1c')](_0xc385('0x1d'),_0x10c352+'-'+_0x4b0862+'/'+_0x400003)[_0xc385('0x18')](_0x412759);}return null;};}function patchUpdates(_0x223e7f){return function(_0x1cbed1){try{jsonpatch[_0xc385('0x1e')](_0x1cbed1,_0x223e7f,!![]);}catch(_0x45a6b1){return BPromise[_0xc385('0x1f')](_0x45a6b1);}return _0x1cbed1[_0xc385('0x20')]();};}function saveUpdates(_0x39d1b4,_0x23a5e9){return function(_0x5603fc){if(_0x5603fc){return _0x5603fc[_0xc385('0x21')](_0x39d1b4)[_0xc385('0x22')](function(_0x479aba){return _0x479aba;});}return null;};}function removeEntity(_0x293547,_0x26b31a){return function(_0x1f12e5){if(_0x1f12e5){return _0x1f12e5[_0xc385('0x23')]()['then'](function(){_0x293547[_0xc385('0x17')](0xcc)[_0xc385('0x24')]();});}};}function handleEntityNotFound(_0x11e518,_0x438ba3){return function(_0xc839da){if(!_0xc839da){_0x11e518[_0xc385('0x25')](0x194);}return _0xc839da;};}function handleError(_0x340fcc,_0x2b8abf){_0x2b8abf=_0x2b8abf||0x1f4;return function(_0x3ba23e){logger[_0xc385('0x26')](_0x3ba23e[_0xc385('0x27')]);if(_0x3ba23e[_0xc385('0x28')]){delete _0x3ba23e[_0xc385('0x28')];}_0x340fcc[_0xc385('0x17')](_0x2b8abf)[_0xc385('0x29')](_0x3ba23e);};}exports[_0xc385('0x2a')]=function(_0x3a7d7b,_0x23c379){var _0x3cafbd={},_0xa103af={},_0x4fe5a0={'count':0x0,'rows':[]};var _0x1ffac5=_[_0xc385('0x2b')](db[_0xc385('0x2c')]['rawAttributes'],function(_0xf27427){return{'name':_0xf27427[_0xc385('0x2d')],'type':_0xf27427[_0xc385('0x2e')][_0xc385('0x2f')]};});_0xa103af[_0xc385('0x30')]=_[_0xc385('0x2b')](_0x1ffac5,_0xc385('0x28'));_0xa103af[_0xc385('0x31')]=_[_0xc385('0x32')](_0x3a7d7b[_0xc385('0x31')]);_0xa103af[_0xc385('0x33')]=_[_0xc385('0x34')](_0xa103af[_0xc385('0x30')],_0xa103af[_0xc385('0x31')]);_0x3cafbd[_0xc385('0x35')]=_[_0xc385('0x34')](_0xa103af[_0xc385('0x30')],qs['fields'](_0x3a7d7b[_0xc385('0x31')][_0xc385('0x36')]));_0x3cafbd[_0xc385('0x35')]=_0x3cafbd['attributes'][_0xc385('0x37')]?_0x3cafbd[_0xc385('0x35')]:_0xa103af[_0xc385('0x30')];if(!_0x3a7d7b['query'][_0xc385('0x38')](_0xc385('0x39'))){_0x3cafbd[_0xc385('0x1b')]=qs['limit'](_0x3a7d7b['query']['limit']);_0x3cafbd[_0xc385('0x1a')]=qs[_0xc385('0x1a')](_0x3a7d7b[_0xc385('0x31')][_0xc385('0x1a')]);}_0x3cafbd[_0xc385('0x3a')]=qs['sort'](_0x3a7d7b[_0xc385('0x31')][_0xc385('0x3b')]);_0x3cafbd[_0xc385('0x3c')]=qs['filters'](_[_0xc385('0x3d')](_0x3a7d7b['query'],_0xa103af[_0xc385('0x33')]),_0x1ffac5);if(_0x3a7d7b[_0xc385('0x31')][_0xc385('0x3e')]){_0x3cafbd[_0xc385('0x3c')]=_[_0xc385('0x3f')](_0x3cafbd[_0xc385('0x3c')],{'$or':_['map'](_0x1ffac5,function(_0x365c47){if(_0x365c47[_0xc385('0x2e')]!==_0xc385('0x40')){var _0x1c3dc6={};_0x1c3dc6[_0x365c47[_0xc385('0x28')]]={'$like':'%'+_0x3a7d7b['query'][_0xc385('0x3e')]+'%'};return _0x1c3dc6;}})});}_0x3cafbd=_[_0xc385('0x3f')]({},_0x3cafbd,_0x3a7d7b[_0xc385('0x41')]);var _0x2d51c3={'where':_0x3cafbd[_0xc385('0x3c')]};return db[_0xc385('0x2c')][_0xc385('0x19')](_0x2d51c3)[_0xc385('0x22')](function(_0x39a23b){_0x4fe5a0[_0xc385('0x19')]=_0x39a23b;if(_0x3a7d7b[_0xc385('0x31')][_0xc385('0x42')]){_0x3cafbd[_0xc385('0x43')]=[{'all':!![]}];}return db[_0xc385('0x2c')][_0xc385('0x44')](_0x3cafbd);})[_0xc385('0x22')](function(_0x30f14d){_0x4fe5a0[_0xc385('0x45')]=_0x30f14d;return _0x4fe5a0;})[_0xc385('0x22')](respondWithFilteredResult(_0x23c379,_0x3cafbd))[_0xc385('0x46')](handleError(_0x23c379,null));};exports[_0xc385('0x47')]=function(_0x446adc,_0x369a90){var _0x570505={'raw':![],'where':{'id':_0x446adc[_0xc385('0x48')]['id']}},_0x42e74e={};_0x42e74e[_0xc385('0x30')]=_[_0xc385('0x32')](db[_0xc385('0x2c')]['rawAttributes']);_0x42e74e[_0xc385('0x31')]=_[_0xc385('0x32')](_0x446adc[_0xc385('0x31')]);_0x42e74e[_0xc385('0x33')]=_[_0xc385('0x34')](_0x42e74e[_0xc385('0x30')],_0x42e74e['query']);_0x570505[_0xc385('0x35')]=_[_0xc385('0x34')](_0x42e74e[_0xc385('0x30')],qs[_0xc385('0x36')](_0x446adc[_0xc385('0x31')]['fields']));_0x570505[_0xc385('0x35')]=_0x570505[_0xc385('0x35')][_0xc385('0x37')]?_0x570505[_0xc385('0x35')]:_0x42e74e['model'];if(_0x446adc[_0xc385('0x31')]['includeAll']){_0x570505[_0xc385('0x43')]=[{'all':!![]}];}_0x570505=_[_0xc385('0x3f')]({},_0x570505,_0x446adc[_0xc385('0x41')]);return db[_0xc385('0x2c')]['find'](_0x570505)[_0xc385('0x22')](handleEntityNotFound(_0x369a90,null))[_0xc385('0x22')](respondWithResult(_0x369a90,null))[_0xc385('0x46')](handleError(_0x369a90,null));};exports['create']=function(_0x49aa17,_0x26b3fe){return db[_0xc385('0x2c')]['create'](_0x49aa17['body'],{})['then'](respondWithResult(_0x26b3fe,0xc9))[_0xc385('0x46')](handleError(_0x26b3fe,null));};exports[_0xc385('0x21')]=function(_0x36ee40,_0x5a70cb){if(_0x36ee40[_0xc385('0x49')]['id']){delete _0x36ee40[_0xc385('0x49')]['id'];}return db[_0xc385('0x2c')][_0xc385('0x4a')]({'where':{'id':_0x36ee40['params']['id']}})['then'](handleEntityNotFound(_0x5a70cb,null))[_0xc385('0x22')](saveUpdates(_0x36ee40[_0xc385('0x49')],null))[_0xc385('0x22')](respondWithResult(_0x5a70cb,null))['catch'](handleError(_0x5a70cb,null));};exports[_0xc385('0x23')]=function(_0xdcb25d,_0x55246d){return db[_0xc385('0x2c')][_0xc385('0x4a')]({'where':{'id':_0xdcb25d[_0xc385('0x48')]['id']}})[_0xc385('0x22')](handleEntityNotFound(_0x55246d,null))[_0xc385('0x22')](removeEntity(_0x55246d,null))[_0xc385('0x46')](handleError(_0x55246d,null));};exports[_0xc385('0x4b')]=function(_0x2df587,_0x47dbef,_0xb3a5f3){return db[_0xc385('0x4c')][_0xc385('0x4a')]({'where':{'id':_0x2df587[_0xc385('0x48')]['id']}})['then'](handleEntityNotFound(_0x47dbef,null))['then'](function(_0x126c3d){if(_0x126c3d){return _0x126c3d[_0xc385('0x4b')](_0x2df587[_0xc385('0x49')]['ids'],_[_0xc385('0x4d')](_0x2df587[_0xc385('0x49')],['ids','id'])||{});}})[_0xc385('0x22')](respondWithResult(_0x47dbef,null))[_0xc385('0x46')](handleError(_0x47dbef,null));};exports['getConditions']=function(_0x245a5a,_0x403b7f,_0x1a51b9){var _0x3fc7f9={};var _0x29467c={};var _0x3a364;var _0x4c3f81;return db[_0xc385('0x2c')][_0xc385('0x4e')]({'where':{'id':_0x245a5a[_0xc385('0x48')]['id']}})[_0xc385('0x22')](handleEntityNotFound(_0x403b7f,null))[_0xc385('0x22')](function(_0xf60254){if(_0xf60254){_0x3a364=_0xf60254;_0x29467c['model']=_[_0xc385('0x32')](db[_0xc385('0x4c')][_0xc385('0x4f')]);_0x29467c[_0xc385('0x31')]=_[_0xc385('0x32')](_0x245a5a[_0xc385('0x31')]);_0x29467c[_0xc385('0x33')]=_[_0xc385('0x34')](_0x29467c['model'],_0x29467c[_0xc385('0x31')]);_0x3fc7f9[_0xc385('0x35')]=_[_0xc385('0x34')](_0x29467c[_0xc385('0x30')],qs[_0xc385('0x36')](_0x245a5a[_0xc385('0x31')][_0xc385('0x36')]));_0x3fc7f9['attributes']=_0x3fc7f9[_0xc385('0x35')][_0xc385('0x37')]?_0x3fc7f9['attributes']:_0x29467c[_0xc385('0x30')];_0x3fc7f9[_0xc385('0x3a')]=qs[_0xc385('0x3b')](_0x245a5a[_0xc385('0x31')][_0xc385('0x3b')]);_0x3fc7f9['where']=qs[_0xc385('0x33')](_['pick'](_0x245a5a[_0xc385('0x31')],_0x29467c[_0xc385('0x33')]));if(_0x245a5a['query']['filter']){_0x3fc7f9[_0xc385('0x3c')]=_[_0xc385('0x3f')](_0x3fc7f9[_0xc385('0x3c')],{'$or':_[_0xc385('0x2b')](_0x3fc7f9[_0xc385('0x35')],function(_0x508764){var _0x196079={};_0x196079[_0x508764]={'$like':'%'+_0x245a5a[_0xc385('0x31')][_0xc385('0x3e')]+'%'};return _0x196079;})});}_0x3fc7f9=_[_0xc385('0x3f')]({},_0x3fc7f9,_0x245a5a[_0xc385('0x41')]);return _0x3a364[_0xc385('0x50')](_0x3fc7f9);}})[_0xc385('0x22')](function(_0x2a258a){if(_0x2a258a){_0x4c3f81=_0x2a258a[_0xc385('0x37')];if(!_0x245a5a[_0xc385('0x31')][_0xc385('0x38')](_0xc385('0x39'))){_0x3fc7f9['limit']=qs[_0xc385('0x1b')](_0x245a5a[_0xc385('0x31')][_0xc385('0x1b')]);_0x3fc7f9[_0xc385('0x1a')]=qs[_0xc385('0x1a')](_0x245a5a[_0xc385('0x31')]['offset']);}return _0x3a364[_0xc385('0x50')](_0x3fc7f9);}})[_0xc385('0x22')](function(_0x562694){if(_0x562694){return _0x562694?{'count':_0x4c3f81,'rows':_0x562694}:null;}})[_0xc385('0x22')](respondWithResult(_0x403b7f,null))['catch'](handleError(_0x403b7f,null));};exports[_0xc385('0x51')]=function(_0x1c3c3f,_0x1b23f0,_0x258c97){return db[_0xc385('0x52')][_0xc385('0x4a')]({'where':{'id':_0x1c3c3f['params']['id']}})[_0xc385('0x22')](handleEntityNotFound(_0x1b23f0,null))[_0xc385('0x22')](function(_0x302f6e){if(_0x302f6e){return _0x302f6e[_0xc385('0x51')](_0x1c3c3f[_0xc385('0x49')][_0xc385('0x53')],_[_0xc385('0x4d')](_0x1c3c3f[_0xc385('0x49')],[_0xc385('0x53'),'id'])||{});}})['then'](respondWithResult(_0x1b23f0,null))['catch'](handleError(_0x1b23f0,null));};exports[_0xc385('0x54')]=function(_0xf78855,_0x5bb700,_0x4f4921){var _0x55a9bb={};var _0x445c37={};var _0x494569;var _0x5bda6f;return db['Automation'][_0xc385('0x4e')]({'where':{'id':_0xf78855['params']['id']}})[_0xc385('0x22')](handleEntityNotFound(_0x5bb700,null))[_0xc385('0x22')](function(_0x2ca246){if(_0x2ca246){_0x494569=_0x2ca246;_0x445c37['model']=_[_0xc385('0x32')](db[_0xc385('0x52')]['rawAttributes']);_0x445c37[_0xc385('0x31')]=_[_0xc385('0x32')](_0xf78855[_0xc385('0x31')]);_0x445c37[_0xc385('0x33')]=_[_0xc385('0x34')](_0x445c37[_0xc385('0x30')],_0x445c37[_0xc385('0x31')]);_0x55a9bb['attributes']=_[_0xc385('0x34')](_0x445c37['model'],qs[_0xc385('0x36')](_0xf78855[_0xc385('0x31')][_0xc385('0x36')]));_0x55a9bb[_0xc385('0x35')]=_0x55a9bb[_0xc385('0x35')][_0xc385('0x37')]?_0x55a9bb[_0xc385('0x35')]:_0x445c37['model'];_0x55a9bb['order']=qs[_0xc385('0x3b')](_0xf78855[_0xc385('0x31')]['sort']);_0x55a9bb[_0xc385('0x3c')]=qs['filters'](_['pick'](_0xf78855[_0xc385('0x31')],_0x445c37[_0xc385('0x33')]));if(_0xf78855[_0xc385('0x31')]['filter']){_0x55a9bb[_0xc385('0x3c')]=_[_0xc385('0x3f')](_0x55a9bb[_0xc385('0x3c')],{'$or':_[_0xc385('0x2b')](_0x55a9bb['attributes'],function(_0x143821){var _0x3f6178={};_0x3f6178[_0x143821]={'$like':'%'+_0xf78855[_0xc385('0x31')]['filter']+'%'};return _0x3f6178;})});}_0x55a9bb=_[_0xc385('0x3f')]({},_0x55a9bb,_0xf78855[_0xc385('0x41')]);return _0x494569[_0xc385('0x54')](_0x55a9bb);}})[_0xc385('0x22')](function(_0x46285d){if(_0x46285d){_0x5bda6f=_0x46285d[_0xc385('0x37')];if(!_0xf78855[_0xc385('0x31')][_0xc385('0x38')](_0xc385('0x39'))){_0x55a9bb[_0xc385('0x1b')]=qs['limit'](_0xf78855[_0xc385('0x31')]['limit']);_0x55a9bb['offset']=qs[_0xc385('0x1a')](_0xf78855[_0xc385('0x31')][_0xc385('0x1a')]);}return _0x494569[_0xc385('0x54')](_0x55a9bb);}})[_0xc385('0x22')](function(_0x3c31d2){if(_0x3c31d2){return _0x3c31d2?{'count':_0x5bda6f,'rows':_0x3c31d2}:null;}})[_0xc385('0x22')](respondWithResult(_0x5bb700,null))[_0xc385('0x46')](handleError(_0x5bb700,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index fbc2957..96a8ec2 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 _0x17d6=['api','moment','bluebird','request-promise','path','rimraf','exports','define','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x17d6,0xbc));var _0x617d=function(_0x55c6a2,_0x1fb579){_0x55c6a2=_0x55c6a2-0x0;var _0x22f78=_0x17d6[_0x55c6a2];return _0x22f78;};'use strict';var _=require('lodash');var util=require(_0x617d('0x0'));var logger=require('../../config/logger')(_0x617d('0x1'));var moment=require(_0x617d('0x2'));var BPromise=require(_0x617d('0x3'));var rp=require(_0x617d('0x4'));var fs=require('fs');var path=require(_0x617d('0x5'));var rimraf=require(_0x617d('0x6'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x617d('0x7')]=function(_0x5d2fdb,_0x11c5d8){return _0x5d2fdb[_0x617d('0x8')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9651=['moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','util','api'];(function(_0x309430,_0x2d226a){var _0x554357=function(_0x5b9f34){while(--_0x5b9f34){_0x309430['push'](_0x309430['shift']());}};_0x554357(++_0x2d226a);}(_0x9651,0x166));var _0x1965=function(_0x2cf8cd,_0x38a7d5){_0x2cf8cd=_0x2cf8cd-0x0;var _0x75b750=_0x9651[_0x2cf8cd];return _0x75b750;};'use strict';var _=require('lodash');var util=require(_0x1965('0x0'));var logger=require('../../config/logger')(_0x1965('0x1'));var moment=require(_0x1965('0x2'));var BPromise=require('bluebird');var rp=require(_0x1965('0x3'));var fs=require('fs');var path=require(_0x1965('0x4'));var rimraf=require(_0x1965('0x5'));var config=require(_0x1965('0x6'));var attributes=require(_0x1965('0x7'));module[_0x1965('0x8')]=function(_0x592a41,_0x1bcc80){return _0x592a41[_0x1965('0x9')]('Automation',attributes,{'tableName':'tools_automations','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 60c5c82..9b80194 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 _0x4fcb=['lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3bc0b1,_0x1f1bf8){var _0x11975b=function(_0x3b6bfc){while(--_0x3b6bfc){_0x3bc0b1['push'](_0x3bc0b1['shift']());}};_0x11975b(++_0x1f1bf8);}(_0x4fcb,0x10a));var _0xb4fc=function(_0x3e08bb,_0x339b65){_0x3e08bb=_0x3e08bb-0x0;var _0x292dc7=_0x4fcb[_0x3e08bb];return _0x292dc7;};'use strict';var _=require(_0xb4fc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb4fc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4fc('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb4fc('0x3'))(_0xb4fc('0x4'));var config=require(_0xb4fc('0x5'));var jayson=require(_0xb4fc('0x6'));var client=jayson['client'][_0xb4fc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xed2e3c,_0x54af96,_0x9f12a6){return new BPromise(function(_0x389ac1,_0x131c2b){return client[_0xb4fc('0x8')](_0xed2e3c,_0x9f12a6)['then'](function(_0x3dc7e5){logger[_0xb4fc('0x9')](_0xb4fc('0xa'),_0x54af96,_0xb4fc('0xb'));logger[_0xb4fc('0xc')](_0xb4fc('0xd'),_0x54af96,_0xb4fc('0xb'),JSON['stringify'](_0x3dc7e5));if(_0x3dc7e5[_0xb4fc('0xe')]){if(_0x3dc7e5['error'][_0xb4fc('0xf')]===0x1f4){logger[_0xb4fc('0xe')](_0xb4fc('0xa'),_0x54af96,_0x3dc7e5[_0xb4fc('0xe')][_0xb4fc('0x10')]);return _0x131c2b(_0x3dc7e5[_0xb4fc('0xe')][_0xb4fc('0x10')]);}logger[_0xb4fc('0xe')]('Automation,\x20%s,\x20%s',_0x54af96,_0x3dc7e5[_0xb4fc('0xe')][_0xb4fc('0x10')]);return _0x389ac1(_0x3dc7e5[_0xb4fc('0xe')]['message']);}else{logger['info'](_0xb4fc('0xa'),_0x54af96,'request\x20sent');_0x389ac1(_0x3dc7e5[_0xb4fc('0x11')][_0xb4fc('0x10')]);}})[_0xb4fc('0x12')](function(_0x14dfee){logger[_0xb4fc('0xe')](_0xb4fc('0xa'),_0x54af96,_0x14dfee);_0x131c2b(_0x14dfee);});});} \ No newline at end of file +var _0x1eae=['info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then'];(function(_0x38ef23,_0xd84be6){var _0x501e01=function(_0x334a3c){while(--_0x334a3c){_0x38ef23['push'](_0x38ef23['shift']());}};_0x501e01(++_0xd84be6);}(_0x1eae,0x6f));var _0xe1ea=function(_0x1651a4,_0x95cc6c){_0x1651a4=_0x1651a4-0x0;var _0x3cc2da=_0x1eae[_0x1651a4];return _0x3cc2da;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe1ea('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1ea('0x1'));var db=require(_0xe1ea('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1ea('0x3'))(_0xe1ea('0x4'));var config=require('../../config/environment');var jayson=require(_0xe1ea('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0453,_0x4af4ab,_0x5428bc){return new BPromise(function(_0x13b45b,_0x6dab72){return client[_0xe1ea('0x6')](_0x3d0453,_0x5428bc)[_0xe1ea('0x7')](function(_0x1c013f){logger[_0xe1ea('0x8')](_0xe1ea('0x9'),_0x4af4ab,'request\x20sent');logger[_0xe1ea('0xa')](_0xe1ea('0xb'),_0x4af4ab,_0xe1ea('0xc'),JSON['stringify'](_0x1c013f));if(_0x1c013f[_0xe1ea('0xd')]){if(_0x1c013f['error'][_0xe1ea('0xe')]===0x1f4){logger[_0xe1ea('0xd')](_0xe1ea('0x9'),_0x4af4ab,_0x1c013f[_0xe1ea('0xd')][_0xe1ea('0xf')]);return _0x6dab72(_0x1c013f[_0xe1ea('0xd')][_0xe1ea('0xf')]);}logger[_0xe1ea('0xd')]('Automation,\x20%s,\x20%s',_0x4af4ab,_0x1c013f[_0xe1ea('0xd')][_0xe1ea('0xf')]);return _0x13b45b(_0x1c013f[_0xe1ea('0xd')][_0xe1ea('0xf')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x4af4ab,'request\x20sent');_0x13b45b(_0x1c013f['result'][_0xe1ea('0xf')]);}})[_0xe1ea('0x10')](function(_0x3cb2a6){logger[_0xe1ea('0xd')](_0xe1ea('0x9'),_0x4af4ab,_0x3cb2a6);_0x6dab72(_0x3cb2a6);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index abff468..8cb7d81 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 _0xd6ca=['../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/actions','getActions','post','/:id/conditions','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x55164c,_0x45bf65){var _0xf5c283=function(_0x2b9223){while(--_0x2b9223){_0x55164c['push'](_0x55164c['shift']());}};_0xf5c283(++_0x45bf65);}(_0xd6ca,0x116));var _0xad6c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd6ca[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xad6c('0x0'));var util=require(_0xad6c('0x1'));var path=require(_0xad6c('0x2'));var timeout=require(_0xad6c('0x3'));var express=require(_0xad6c('0x4'));var router=express[_0xad6c('0x5')]();var fs_extra=require(_0xad6c('0x6'));var auth=require(_0xad6c('0x7'));var interaction=require(_0xad6c('0x8'));var config=require('../../config/environment');var controller=require(_0xad6c('0x9'));router[_0xad6c('0xa')]('/',auth[_0xad6c('0xb')](),controller[_0xad6c('0xc')]);router[_0xad6c('0xa')](_0xad6c('0xd'),auth[_0xad6c('0xb')](),controller[_0xad6c('0xe')]);router[_0xad6c('0xa')]('/:id/conditions',auth[_0xad6c('0xb')](),controller['getConditions']);router[_0xad6c('0xa')](_0xad6c('0xf'),auth[_0xad6c('0xb')](),controller[_0xad6c('0x10')]);router[_0xad6c('0x11')]('/',auth[_0xad6c('0xb')](),controller['create']);router[_0xad6c('0x11')](_0xad6c('0x12'),auth[_0xad6c('0xb')](),controller['addConditions']);router[_0xad6c('0x11')](_0xad6c('0xf'),auth[_0xad6c('0xb')](),controller['addActions']);router['put'](_0xad6c('0xd'),auth[_0xad6c('0xb')](),controller[_0xad6c('0x13')]);router[_0xad6c('0x14')](_0xad6c('0xd'),auth[_0xad6c('0xb')](),controller['destroy']);module[_0xad6c('0x15')]=router; \ No newline at end of file +var _0xfa8f=['post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','get','/:id/actions','getActions','create','addConditions'];(function(_0x4f0d71,_0x4151a8){var _0xf3eb1d=function(_0x2f00e5){while(--_0x2f00e5){_0x4f0d71['push'](_0x4f0d71['shift']());}};_0xf3eb1d(++_0x4151a8);}(_0xfa8f,0xa2));var _0xffa8=function(_0x3ca2a6,_0x437b84){_0x3ca2a6=_0x3ca2a6-0x0;var _0x51bc5c=_0xfa8f[_0x3ca2a6];return _0x51bc5c;};'use strict';var multer=require(_0xffa8('0x0'));var util=require('util');var path=require(_0xffa8('0x1'));var timeout=require(_0xffa8('0x2'));var express=require(_0xffa8('0x3'));var router=express[_0xffa8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xffa8('0x5'));var interaction=require(_0xffa8('0x6'));var config=require(_0xffa8('0x7'));var controller=require(_0xffa8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xffa8('0x9')]);router['get'](_0xffa8('0xa'),auth[_0xffa8('0xb')](),controller[_0xffa8('0xc')]);router['get'](_0xffa8('0xd'),auth['isAuthenticated'](),controller[_0xffa8('0xe')]);router[_0xffa8('0xf')](_0xffa8('0x10'),auth[_0xffa8('0xb')](),controller[_0xffa8('0x11')]);router['post']('/',auth[_0xffa8('0xb')](),controller[_0xffa8('0x12')]);router['post'](_0xffa8('0xd'),auth[_0xffa8('0xb')](),controller[_0xffa8('0x13')]);router[_0xffa8('0x14')](_0xffa8('0x10'),auth['isAuthenticated'](),controller['addActions']);router[_0xffa8('0x15')](_0xffa8('0xa'),auth[_0xffa8('0xb')](),controller[_0xffa8('0x16')]);router[_0xffa8('0x17')](_0xffa8('0xa'),auth[_0xffa8('0xb')](),controller[_0xffa8('0x18')]);module[_0xffa8('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index cf53e17..001ab43 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 _0x747a=['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,*,*,*','ENUM','always','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','name','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x720bf4,_0x2f7050){var _0x3ee927=function(_0x5f16e3){while(--_0x5f16e3){_0x720bf4['push'](_0x720bf4['shift']());}};_0x3ee927(++_0x2f7050);}(_0x747a,0x18e));var _0xa747=function(_0x493660,_0x214700){_0x493660=_0x493660-0x0;var _0x26422b=_0x747a[_0x493660];return _0x26422b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa747('0x0'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0xa747('0x1')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xa747('0x2')](0x4)[_0xa747('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa747('0x4')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa747('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa747('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xa747('0x2')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa747('0x6')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa747('0x2')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa747('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa747('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0xa747('0x2')](0x3)[_0xa747('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa747('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa747('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa747('0x2')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xa747('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa747('0x2')](0x5)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa747('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa747('0xd')},'dialTimezone':{'type':Sequelize[_0xa747('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa747('0x5')],'defaultValue':_0xa747('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xa747('0xf')](_0xa747('0x10'),'never','onlyIfOpen'),'defaultValue':_0xa747('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa747('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xa747('0x2')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa747('0x3')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa747('0x2')](0x9)[_0xa747('0x3')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa747('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa747('0x2')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa747('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xa747('0x2')](0x9)[_0xa747('0x3')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa747('0x2')](0x9)[_0xa747('0x3')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa747('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xa747('0x3')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa747('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa747('0x2')](0x5)[_0xa747('0x3')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa747('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa747('0x2')](0x9)[_0xa747('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xa747('0xf')](_0xa747('0x17'),_0xa747('0x18')),'defaultValue':_0xa747('0x17')},'dialPrefix':{'type':Sequelize[_0xa747('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa747('0x2')](0x3)[_0xa747('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa747('0x19')},'dialCutDigit':{'type':Sequelize[_0xa747('0x2')](0x3)[_0xa747('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa747('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa747('0x2')](0x3)[_0xa747('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa747('0x2')](0x5)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa747('0x1b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa747('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xa747('0x2')](0x5)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa747('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa747('0x2')](0x3)[_0xa747('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa747('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0xa747('0x2')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa747('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa747('0x2')](0x5)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa747('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa747('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa747('0x2')](0x5)[_0xa747('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa747('0x21')}}; \ No newline at end of file +var _0x4f38=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\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','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0xf028c5,_0x2e8a41){var _0x2cb9cb=function(_0x29c989){while(--_0x29c989){_0xf028c5['push'](_0xf028c5['shift']());}};_0x2cb9cb(++_0x2e8a41);}(_0x4f38,0x1f2));var _0x84f3=function(_0x42b9b0,_0x13d7df){_0x42b9b0=_0x42b9b0-0x0;var _0x46bd2c=_0x4f38[_0x42b9b0];return _0x46bd2c;};'use strict';var Sequelize=require(_0x84f3('0x0'));module[_0x84f3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x84f3('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x84f3('0x3')),'allowNull':![],'defaultValue':_0x84f3('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x84f3('0x4')],'defaultValue':0x0,'comment':_0x84f3('0x5')},'limitCalls':{'type':Sequelize[_0x84f3('0x6')](0x4)[_0x84f3('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x84f3('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x84f3('0x9')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x84f3('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x84f3('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x84f3('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x84f3('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x84f3('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x84f3('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x84f3('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x84f3('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x84f3('0x6')](0x3)[_0x84f3('0x7')],'defaultValue':0x3,'comment':_0x84f3('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x84f3('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x84f3('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x84f3('0x6')](0x3)[_0x84f3('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x84f3('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x84f3('0x9')],'defaultValue':_0x84f3('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x84f3('0x12')](_0x84f3('0x13'),_0x84f3('0x14'),_0x84f3('0x15')),'defaultValue':_0x84f3('0x13')},'dialAMDActive':{'type':Sequelize[_0x84f3('0x4')],'defaultValue':0x0,'comment':_0x84f3('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0x84f3('0x6')](0x9)[_0x84f3('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x84f3('0x17')},'dialAMDGreeting':{'type':Sequelize[_0x84f3('0x6')](0x9)[_0x84f3('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x84f3('0x6')](0x9)[_0x84f3('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x84f3('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x84f3('0x6')](0x9)[_0x84f3('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x84f3('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x84f3('0x6')](0x9)[_0x84f3('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x84f3('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x84f3('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x84f3('0x6')](0x9)[_0x84f3('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x84f3('0x6')](0x5)[_0x84f3('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x84f3('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x84f3('0x6')](0x9)[_0x84f3('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x84f3('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x84f3('0x12')](_0x84f3('0x1d'),_0x84f3('0x1e')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x84f3('0x9')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x84f3('0x6')](0x3)[_0x84f3('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x84f3('0x1f')},'dialCutDigit':{'type':Sequelize[_0x84f3('0x6')](0x3)[_0x84f3('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x84f3('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x84f3('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x84f3('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x84f3('0x6')](0x5)[_0x84f3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x84f3('0x6')](0x3)[_0x84f3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x84f3('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x84f3('0x6')](0x5)[_0x84f3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x84f3('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x84f3('0x6')](0x3)[_0x84f3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x84f3('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x84f3('0x6')](0x5)[_0x84f3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x84f3('0x25')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x84f3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x84f3('0x6')](0x5)[_0x84f3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x84f3('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x84f3('0x6')](0x3)[_0x84f3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x84f3('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x84f3('0x6')](0x5)[_0x84f3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x84f3('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 0f688b1..6f0bbae 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 _0xb8c0=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Campaign','count','then','includeAll','include','findAll','catch','show','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','role','update','getHoppers','findOne','CmHopper','CampaignId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x21e3af,_0x26127a){var _0x1a6048=function(_0x4ff693){while(--_0x4ff693){_0x21e3af['push'](_0x21e3af['shift']());}};_0x1a6048(++_0x26127a);}(_0xb8c0,0x114));var _0x0b8c=function(_0x247d0b,_0x31c30e){_0x247d0b=_0x247d0b-0x0;var _0x251c4b=_0xb8c0[_0x247d0b];return _0x251c4b;};'use strict';var pdf=require(_0x0b8c('0x0'));var emlformat=require(_0x0b8c('0x1'));var rimraf=require(_0x0b8c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b8c('0x3'));var rp=require('request-promise');var moment=require(_0x0b8c('0x4'));var BPromise=require(_0x0b8c('0x5'));var Mustache=require(_0x0b8c('0x6'));var util=require(_0x0b8c('0x7'));var path=require(_0x0b8c('0x8'));var sox=require(_0x0b8c('0x9'));var csv=require('to-csv');var ejs=require(_0x0b8c('0xa'));var fs=require('fs');var fs_extra=require(_0x0b8c('0xb'));var _=require(_0x0b8c('0xc'));var squel=require(_0x0b8c('0xd'));var crypto=require(_0x0b8c('0xe'));var jsforce=require(_0x0b8c('0xf'));var deskjs=require(_0x0b8c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b8c('0x11'));var Redis=require(_0x0b8c('0x12'));var authService=require(_0x0b8c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0b8c('0x14'));var hardwareService=require(_0x0b8c('0x15'));var logger=require(_0x0b8c('0x16'))(_0x0b8c('0x17'));var utils=require(_0x0b8c('0x18'));var config=require(_0x0b8c('0x19'));var licenseUtil=require(_0x0b8c('0x1a'));var db=require(_0x0b8c('0x1b'))['db'];function respondWithStatusCode(_0x726c1c,_0x2b675c){_0x2b675c=_0x2b675c||0xcc;return function(_0x2262be){if(_0x2262be){return _0x726c1c[_0x0b8c('0x1c')](_0x2b675c);}return _0x726c1c[_0x0b8c('0x1d')](_0x2b675c)[_0x0b8c('0x1e')]();};}function respondWithResult(_0x57ff71,_0x355c4a){_0x355c4a=_0x355c4a||0xc8;return function(_0x78d3){if(_0x78d3){return _0x57ff71[_0x0b8c('0x1d')](_0x355c4a)[_0x0b8c('0x1f')](_0x78d3);}};}function respondWithFilteredResult(_0xf1deb7,_0x1c6b8a){return function(_0x53ed4c){if(_0x53ed4c){var _0x59ddca=_0x53ed4c['count'],_0x5cf5ad=_0x1c6b8a[_0x0b8c('0x20')],_0x493977=_0x1c6b8a[_0x0b8c('0x20')]+_0x1c6b8a[_0x0b8c('0x21')],_0x4b9c87;if(_0x493977>=_0x59ddca){_0x493977=_0x59ddca;_0x4b9c87=0xc8;}else{_0x4b9c87=0xce;}_0xf1deb7[_0x0b8c('0x1d')](_0x4b9c87);return _0xf1deb7[_0x0b8c('0x22')]('Content-Range',_0x5cf5ad+'-'+_0x493977+'/'+_0x59ddca)[_0x0b8c('0x1f')](_0x53ed4c);}return null;};}function patchUpdates(_0x385152){return function(_0x22e44){try{jsonpatch[_0x0b8c('0x23')](_0x22e44,_0x385152,!![]);}catch(_0x14a3cf){return BPromise['reject'](_0x14a3cf);}return _0x22e44['save']();};}function saveUpdates(_0x2c4d95,_0x410cd0){return function(_0x2e098e){if(_0x2e098e){return _0x2e098e['update'](_0x2c4d95)['then'](function(_0x17571b){return _0x17571b;});}return null;};}function removeEntity(_0x1eff47,_0x592462){return function(_0x419687){if(_0x419687){return _0x419687[_0x0b8c('0x24')]()['then'](function(){var _0x12a803=_0x419687['get']({'plain':!![]});var _0x58ae98='IvrCampaigns';return db[_0x0b8c('0x25')][_0x0b8c('0x24')]({'where':{'type':_0x58ae98,'resourceId':_0x12a803['id']}})['then'](function(){return _0x419687;});})['then'](function(){_0x1eff47[_0x0b8c('0x1d')](0xcc)[_0x0b8c('0x1e')]();});}};}function handleEntityNotFound(_0x3734e8,_0x56ebda){return function(_0x5542cf){if(!_0x5542cf){_0x3734e8[_0x0b8c('0x1c')](0x194);}return _0x5542cf;};}function handleError(_0x43d6f7,_0x4b274a){_0x4b274a=_0x4b274a||0x1f4;return function(_0x2d6fd9){logger[_0x0b8c('0x26')](_0x2d6fd9[_0x0b8c('0x27')]);if(_0x2d6fd9[_0x0b8c('0x28')]){delete _0x2d6fd9[_0x0b8c('0x28')];}_0x43d6f7['status'](_0x4b274a)[_0x0b8c('0x29')](_0x2d6fd9);};}exports[_0x0b8c('0x2a')]=function(_0x2c5922,_0x16d96f){var _0x2ec45a={},_0x2be431={},_0x49e369={'count':0x0,'rows':[]};var _0x495a85=_[_0x0b8c('0x2b')](db['Campaign'][_0x0b8c('0x2c')],function(_0x34a897){return{'name':_0x34a897[_0x0b8c('0x2d')],'type':_0x34a897[_0x0b8c('0x2e')][_0x0b8c('0x2f')]};});_0x2be431[_0x0b8c('0x30')]=_[_0x0b8c('0x2b')](_0x495a85,_0x0b8c('0x28'));_0x2be431['query']=_[_0x0b8c('0x31')](_0x2c5922[_0x0b8c('0x32')]);_0x2be431[_0x0b8c('0x33')]=_['intersection'](_0x2be431[_0x0b8c('0x30')],_0x2be431['query']);_0x2ec45a['attributes']=_['intersection'](_0x2be431['model'],qs[_0x0b8c('0x34')](_0x2c5922[_0x0b8c('0x32')]['fields']));_0x2ec45a[_0x0b8c('0x35')]=_0x2ec45a['attributes'][_0x0b8c('0x36')]?_0x2ec45a['attributes']:_0x2be431[_0x0b8c('0x30')];if(!_0x2c5922['query'][_0x0b8c('0x37')](_0x0b8c('0x38'))){_0x2ec45a[_0x0b8c('0x21')]=qs[_0x0b8c('0x21')](_0x2c5922['query']['limit']);_0x2ec45a[_0x0b8c('0x20')]=qs['offset'](_0x2c5922['query'][_0x0b8c('0x20')]);}_0x2ec45a[_0x0b8c('0x39')]=qs[_0x0b8c('0x3a')](_0x2c5922[_0x0b8c('0x32')][_0x0b8c('0x3a')]);_0x2ec45a['where']=qs[_0x0b8c('0x33')](_[_0x0b8c('0x3b')](_0x2c5922['query'],_0x2be431[_0x0b8c('0x33')]),_0x495a85);if(_0x2c5922[_0x0b8c('0x32')][_0x0b8c('0x3c')]){_0x2ec45a[_0x0b8c('0x3d')]=_[_0x0b8c('0x3e')](_0x2ec45a[_0x0b8c('0x3d')],{'$or':_[_0x0b8c('0x2b')](_0x495a85,function(_0x5cba27){if(_0x5cba27[_0x0b8c('0x2e')]!==_0x0b8c('0x3f')){var _0x4389b4={};_0x4389b4[_0x5cba27[_0x0b8c('0x28')]]={'$like':'%'+_0x2c5922[_0x0b8c('0x32')][_0x0b8c('0x3c')]+'%'};return _0x4389b4;}})});}_0x2ec45a=_[_0x0b8c('0x3e')]({},_0x2ec45a,_0x2c5922[_0x0b8c('0x40')]);var _0x4c6ac0={'where':_0x2ec45a[_0x0b8c('0x3d')]};return db[_0x0b8c('0x41')][_0x0b8c('0x42')](_0x4c6ac0)[_0x0b8c('0x43')](function(_0x5cf604){_0x49e369['count']=_0x5cf604;if(_0x2c5922[_0x0b8c('0x32')][_0x0b8c('0x44')]){_0x2ec45a[_0x0b8c('0x45')]=[{'all':!![]}];}return db[_0x0b8c('0x41')][_0x0b8c('0x46')](_0x2ec45a);})['then'](function(_0x23719a){_0x49e369['rows']=_0x23719a;return _0x49e369;})[_0x0b8c('0x43')](respondWithFilteredResult(_0x16d96f,_0x2ec45a))[_0x0b8c('0x47')](handleError(_0x16d96f,null));};exports[_0x0b8c('0x48')]=function(_0xb5b9f9,_0xf5485c){var _0x2a513a={'raw':![],'where':{'id':_0xb5b9f9['params']['id']}},_0x1dddd6={};_0x1dddd6[_0x0b8c('0x30')]=_[_0x0b8c('0x31')](db[_0x0b8c('0x41')][_0x0b8c('0x2c')]);_0x1dddd6[_0x0b8c('0x32')]=_[_0x0b8c('0x31')](_0xb5b9f9[_0x0b8c('0x32')]);_0x1dddd6[_0x0b8c('0x33')]=_[_0x0b8c('0x49')](_0x1dddd6[_0x0b8c('0x30')],_0x1dddd6[_0x0b8c('0x32')]);_0x2a513a[_0x0b8c('0x35')]=_[_0x0b8c('0x49')](_0x1dddd6[_0x0b8c('0x30')],qs[_0x0b8c('0x34')](_0xb5b9f9[_0x0b8c('0x32')]['fields']));_0x2a513a[_0x0b8c('0x35')]=_0x2a513a[_0x0b8c('0x35')][_0x0b8c('0x36')]?_0x2a513a[_0x0b8c('0x35')]:_0x1dddd6[_0x0b8c('0x30')];if(_0xb5b9f9['query']['includeAll']){_0x2a513a[_0x0b8c('0x45')]=[{'all':!![]}];}_0x2a513a=_[_0x0b8c('0x3e')]({},_0x2a513a,_0xb5b9f9[_0x0b8c('0x40')]);return db[_0x0b8c('0x41')][_0x0b8c('0x4a')](_0x2a513a)[_0x0b8c('0x43')](handleEntityNotFound(_0xf5485c,null))[_0x0b8c('0x43')](respondWithResult(_0xf5485c,null))[_0x0b8c('0x47')](handleError(_0xf5485c,null));};exports[_0x0b8c('0x4b')]=function(_0x51212a,_0x395dc5){return db['Campaign'][_0x0b8c('0x4b')](_0x51212a['body'],{})[_0x0b8c('0x43')](function(_0x29c9cb){var _0x107858=_0x51212a[_0x0b8c('0x4c')]['get']({'plain':!![]});if(!_0x107858)throw new Error(_0x0b8c('0x4d'));if(_0x107858['role']===_0x0b8c('0x4c')){var _0x4c08c6=_0x29c9cb[_0x0b8c('0x4e')]({'plain':!![]});var _0xbfda37=_0x0b8c('0x4f');return db[_0x0b8c('0x50')]['find']({'where':{'name':_0xbfda37,'userProfileId':_0x107858[_0x0b8c('0x51')]},'raw':!![]})[_0x0b8c('0x43')](function(_0x2cff2a){if(_0x2cff2a&&_0x2cff2a[_0x0b8c('0x52')]===0x0){return db[_0x0b8c('0x25')]['create']({'name':_0x4c08c6[_0x0b8c('0x28')],'resourceId':_0x4c08c6['id'],'type':_0x2cff2a['name'],'sectionId':_0x2cff2a['id']},{})[_0x0b8c('0x43')](function(){return _0x29c9cb;});}else{return _0x29c9cb;}})['catch'](function(_0x37d578){logger[_0x0b8c('0x26')](_0x0b8c('0x53'),_0x37d578);throw _0x37d578;});}return _0x29c9cb;})['then'](respondWithResult(_0x395dc5,0xc9))[_0x0b8c('0x47')](handleError(_0x395dc5,null));};exports[_0x0b8c('0x54')]=function(_0x573843,_0x5e4675){var _0x498649={'where':{'id':_0x573843[_0x0b8c('0x55')]['id']}},_0x3619ba={};_0x3619ba[_0x0b8c('0x30')]=_[_0x0b8c('0x31')](db[_0x0b8c('0x41')][_0x0b8c('0x2c')]);_0x498649['attributes']=_['intersection'](_0x3619ba[_0x0b8c('0x30')],qs[_0x0b8c('0x34')](_0x573843[_0x0b8c('0x32')]['fields']));_0x498649[_0x0b8c('0x35')]=_0x498649[_0x0b8c('0x35')][_0x0b8c('0x36')]?_0x498649[_0x0b8c('0x35')]:_0x3619ba[_0x0b8c('0x30')];if(_0x573843[_0x0b8c('0x32')][_0x0b8c('0x44')]){_0x498649['include']=[{'all':!![]}];}_0x498649=_['merge']({},_0x498649,_0x573843[_0x0b8c('0x40')]);return db[_0x0b8c('0x41')]['find'](_0x498649)['then'](handleEntityNotFound(_0x5e4675,null))[_0x0b8c('0x43')](function(_0xa80d64){if(_0xa80d64){var _0x37ebbc=_0xa80d64[_0x0b8c('0x4e')]({'plain':!![]});_0x37ebbc=qs[_0x0b8c('0x56')](_0x37ebbc,['id',_0x0b8c('0x57'),_0x0b8c('0x58')]);_0x573843[_0x0b8c('0x59')]=_['omit'](_0x573843[_0x0b8c('0x59')],['id','createdAt',_0x0b8c('0x58')]);return db['Campaign'][_0x0b8c('0x4b')](_[_0x0b8c('0x3e')](_0x37ebbc,_0x573843['body']),{'include':_0x573843[_0x0b8c('0x32')][_0x0b8c('0x44')]?[{'all':!![]}]:undefined})[_0x0b8c('0x43')](function(_0x52367e){var _0x153c08=_0x573843[_0x0b8c('0x4c')]['get']({'plain':!![]});if(!_0x153c08)throw new Error(_0x0b8c('0x4d'));if(_0x153c08[_0x0b8c('0x5a')]===_0x0b8c('0x4c')){var _0x53f8f1=_0x52367e[_0x0b8c('0x4e')]({'plain':!![]});var _0x58ec80=_0x0b8c('0x4f');return db[_0x0b8c('0x50')][_0x0b8c('0x4a')]({'where':{'name':_0x58ec80,'userProfileId':_0x153c08[_0x0b8c('0x51')]},'raw':!![]})[_0x0b8c('0x43')](function(_0x1b6adf){if(_0x1b6adf&&_0x1b6adf[_0x0b8c('0x52')]===0x0){return db['UserProfileResource'][_0x0b8c('0x4b')]({'name':_0x53f8f1[_0x0b8c('0x28')],'resourceId':_0x53f8f1['id'],'type':_0x1b6adf['name'],'sectionId':_0x1b6adf['id']},{})[_0x0b8c('0x43')](function(){return _0x52367e;});}else{return _0x52367e;}})[_0x0b8c('0x47')](function(_0x4b0624){logger[_0x0b8c('0x26')](_0x0b8c('0x53'),_0x4b0624);throw _0x4b0624;});}return _0x52367e;});}})[_0x0b8c('0x43')](respondWithResult(_0x5e4675,0xc9))[_0x0b8c('0x47')](handleError(_0x5e4675,null));};exports[_0x0b8c('0x5b')]=function(_0x295f86,_0x2ffeec){if(_0x295f86[_0x0b8c('0x59')]['id']){delete _0x295f86['body']['id'];}return db[_0x0b8c('0x41')][_0x0b8c('0x4a')]({'where':{'id':_0x295f86[_0x0b8c('0x55')]['id']}})[_0x0b8c('0x43')](handleEntityNotFound(_0x2ffeec,null))['then'](saveUpdates(_0x295f86['body'],null))['then'](respondWithResult(_0x2ffeec,null))[_0x0b8c('0x47')](handleError(_0x2ffeec,null));};exports[_0x0b8c('0x24')]=function(_0x1ee841,_0x55901c){return db[_0x0b8c('0x41')][_0x0b8c('0x4a')]({'where':{'id':_0x1ee841[_0x0b8c('0x55')]['id']}})['then'](handleEntityNotFound(_0x55901c,null))[_0x0b8c('0x43')](removeEntity(_0x55901c,null))[_0x0b8c('0x47')](handleError(_0x55901c,null));};exports[_0x0b8c('0x5c')]=function(_0x30008f,_0x492484,_0xecd8b6){var _0x58876e={'raw':!![],'where':{}};var _0x50ceec={};var _0x34a1ef={'count':0x0,'rows':[]};return db[_0x0b8c('0x41')][_0x0b8c('0x5d')]({'where':{'id':_0x30008f[_0x0b8c('0x55')]['id']}})[_0x0b8c('0x43')](handleEntityNotFound(_0x492484,null))[_0x0b8c('0x43')](function(_0x2fba2b){if(_0x2fba2b){_0x50ceec[_0x0b8c('0x30')]=_[_0x0b8c('0x31')](db[_0x0b8c('0x5e')][_0x0b8c('0x2c')]);_0x50ceec[_0x0b8c('0x32')]=_[_0x0b8c('0x31')](_0x30008f[_0x0b8c('0x32')]);_0x50ceec['filters']=_[_0x0b8c('0x49')](_0x50ceec[_0x0b8c('0x30')],_0x50ceec[_0x0b8c('0x32')]);_0x58876e['attributes']=_[_0x0b8c('0x49')](_0x50ceec['model'],qs[_0x0b8c('0x34')](_0x30008f['query'][_0x0b8c('0x34')]));_0x58876e[_0x0b8c('0x35')]=_0x58876e[_0x0b8c('0x35')][_0x0b8c('0x36')]?_0x58876e['attributes']:_0x50ceec['model'];if(!_0x30008f[_0x0b8c('0x32')][_0x0b8c('0x37')](_0x0b8c('0x38'))){_0x58876e[_0x0b8c('0x21')]=qs[_0x0b8c('0x21')](_0x30008f[_0x0b8c('0x32')][_0x0b8c('0x21')]);_0x58876e[_0x0b8c('0x20')]=qs[_0x0b8c('0x20')](_0x30008f['query']['offset']);}_0x58876e[_0x0b8c('0x39')]=qs[_0x0b8c('0x3a')](_0x30008f[_0x0b8c('0x32')][_0x0b8c('0x3a')]);_0x58876e[_0x0b8c('0x3d')]=qs[_0x0b8c('0x33')](_[_0x0b8c('0x3b')](_0x30008f[_0x0b8c('0x32')],_0x50ceec[_0x0b8c('0x33')]));_0x58876e[_0x0b8c('0x3d')][_0x0b8c('0x5f')]=_0x2fba2b['id'];if(_0x30008f[_0x0b8c('0x32')][_0x0b8c('0x3c')]){_0x58876e[_0x0b8c('0x3d')]=_[_0x0b8c('0x3e')](_0x58876e[_0x0b8c('0x3d')],{'$or':_[_0x0b8c('0x2b')](_0x58876e['attributes'],function(_0x3a885c){var _0x11cabf={};_0x11cabf[_0x3a885c]={'$like':'%'+_0x30008f[_0x0b8c('0x32')][_0x0b8c('0x3c')]+'%'};return _0x11cabf;})});}_0x58876e=_[_0x0b8c('0x3e')]({},_0x58876e,_0x30008f[_0x0b8c('0x40')]);return db[_0x0b8c('0x5e')][_0x0b8c('0x42')]({'where':_0x58876e[_0x0b8c('0x3d')]})['then'](function(_0x3c5557){_0x34a1ef['count']=_0x3c5557;if(_0x30008f[_0x0b8c('0x32')]['includeAll']){_0x58876e['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x58876e);})[_0x0b8c('0x43')](function(_0x1b3bb4){_0x34a1ef[_0x0b8c('0x60')]=_0x1b3bb4;return _0x34a1ef;});}})[_0x0b8c('0x43')](respondWithFilteredResult(_0x492484,_0x58876e))[_0x0b8c('0x47')](handleError(_0x492484,null));};exports['getHopperHistories']=function(_0x3b4afc,_0xd7a4ef,_0x3a0649){var _0x14cfcb={'raw':!![],'where':{}};var _0x460c04={};var _0x5503e0={'count':0x0,'rows':[]};return db[_0x0b8c('0x41')][_0x0b8c('0x5d')]({'where':{'id':_0x3b4afc['params']['id']}})[_0x0b8c('0x43')](handleEntityNotFound(_0xd7a4ef,null))['then'](function(_0x33ce1e){if(_0x33ce1e){_0x460c04[_0x0b8c('0x30')]=_['keys'](db[_0x0b8c('0x61')][_0x0b8c('0x2c')]);_0x460c04[_0x0b8c('0x32')]=_['keys'](_0x3b4afc[_0x0b8c('0x32')]);_0x460c04['filters']=_[_0x0b8c('0x49')](_0x460c04[_0x0b8c('0x30')],_0x460c04['query']);_0x14cfcb[_0x0b8c('0x35')]=_['intersection'](_0x460c04[_0x0b8c('0x30')],qs['fields'](_0x3b4afc[_0x0b8c('0x32')][_0x0b8c('0x34')]));_0x14cfcb[_0x0b8c('0x35')]=_0x14cfcb[_0x0b8c('0x35')][_0x0b8c('0x36')]?_0x14cfcb[_0x0b8c('0x35')]:_0x460c04[_0x0b8c('0x30')];if(!_0x3b4afc[_0x0b8c('0x32')]['hasOwnProperty'](_0x0b8c('0x38'))){_0x14cfcb['limit']=qs['limit'](_0x3b4afc[_0x0b8c('0x32')]['limit']);_0x14cfcb[_0x0b8c('0x20')]=qs[_0x0b8c('0x20')](_0x3b4afc[_0x0b8c('0x32')][_0x0b8c('0x20')]);}_0x14cfcb['order']=qs[_0x0b8c('0x3a')](_0x3b4afc[_0x0b8c('0x32')][_0x0b8c('0x3a')]);_0x14cfcb[_0x0b8c('0x3d')]=qs['filters'](_['pick'](_0x3b4afc[_0x0b8c('0x32')],_0x460c04[_0x0b8c('0x33')]));_0x14cfcb[_0x0b8c('0x3d')][_0x0b8c('0x5f')]=_0x33ce1e['id'];if(_0x3b4afc['query'][_0x0b8c('0x3c')]){_0x14cfcb[_0x0b8c('0x3d')]=_[_0x0b8c('0x3e')](_0x14cfcb[_0x0b8c('0x3d')],{'$or':_[_0x0b8c('0x2b')](_0x14cfcb[_0x0b8c('0x35')],function(_0x4ea3c6){var _0x2b3088={};_0x2b3088[_0x4ea3c6]={'$like':'%'+_0x3b4afc[_0x0b8c('0x32')][_0x0b8c('0x3c')]+'%'};return _0x2b3088;})});}_0x14cfcb=_[_0x0b8c('0x3e')]({},_0x14cfcb,_0x3b4afc['options']);return db['CmHopperHistory'][_0x0b8c('0x42')]({'where':_0x14cfcb['where']})[_0x0b8c('0x43')](function(_0x333cb2){_0x5503e0[_0x0b8c('0x42')]=_0x333cb2;if(_0x3b4afc[_0x0b8c('0x32')][_0x0b8c('0x44')]){_0x14cfcb[_0x0b8c('0x45')]=[{'all':!![]}];}return db[_0x0b8c('0x61')][_0x0b8c('0x46')](_0x14cfcb);})[_0x0b8c('0x43')](function(_0x1d2ac6){_0x5503e0[_0x0b8c('0x60')]=_0x1d2ac6;return _0x5503e0;});}})[_0x0b8c('0x43')](respondWithFilteredResult(_0xd7a4ef,_0x14cfcb))[_0x0b8c('0x47')](handleError(_0xd7a4ef,null));};exports[_0x0b8c('0x62')]=function(_0x182d3e,_0xe79f05,_0x1f56be){var _0x30fa11={'raw':!![],'where':{}};var _0x1c0789={};var _0x379cfb={'count':0x0,'rows':[]};return db[_0x0b8c('0x41')][_0x0b8c('0x5d')]({'where':{'id':_0x182d3e[_0x0b8c('0x55')]['id']}})[_0x0b8c('0x43')](handleEntityNotFound(_0xe79f05,null))['then'](function(_0xd135e5){if(_0xd135e5){_0x1c0789[_0x0b8c('0x30')]=_[_0x0b8c('0x31')](db[_0x0b8c('0x63')]['rawAttributes']);_0x1c0789['query']=_[_0x0b8c('0x31')](_0x182d3e[_0x0b8c('0x32')]);_0x1c0789[_0x0b8c('0x33')]=_['intersection'](_0x1c0789['model'],_0x1c0789['query']);_0x30fa11[_0x0b8c('0x35')]=_[_0x0b8c('0x49')](_0x1c0789['model'],qs[_0x0b8c('0x34')](_0x182d3e[_0x0b8c('0x32')]['fields']));_0x30fa11[_0x0b8c('0x35')]=_0x30fa11[_0x0b8c('0x35')][_0x0b8c('0x36')]?_0x30fa11[_0x0b8c('0x35')]:_0x1c0789['model'];if(!_0x182d3e['query'][_0x0b8c('0x37')](_0x0b8c('0x38'))){_0x30fa11['limit']=qs[_0x0b8c('0x21')](_0x182d3e['query']['limit']);_0x30fa11['offset']=qs[_0x0b8c('0x20')](_0x182d3e[_0x0b8c('0x32')][_0x0b8c('0x20')]);}_0x30fa11['order']=qs['sort'](_0x182d3e[_0x0b8c('0x32')][_0x0b8c('0x3a')]);_0x30fa11[_0x0b8c('0x3d')]=qs['filters'](_[_0x0b8c('0x3b')](_0x182d3e[_0x0b8c('0x32')],_0x1c0789[_0x0b8c('0x33')]));_0x30fa11['where']['CampaignId']=_0xd135e5['id'];if(_0x182d3e[_0x0b8c('0x32')][_0x0b8c('0x3c')]){_0x30fa11[_0x0b8c('0x3d')]=_[_0x0b8c('0x3e')](_0x30fa11[_0x0b8c('0x3d')],{'$or':_['map'](_0x30fa11['attributes'],function(_0x5de6b6){var _0x4cce5f={};_0x4cce5f[_0x5de6b6]={'$like':'%'+_0x182d3e['query']['filter']+'%'};return _0x4cce5f;})});}_0x30fa11=_['merge']({},_0x30fa11,_0x182d3e['options']);return db[_0x0b8c('0x63')][_0x0b8c('0x42')]({'where':_0x30fa11[_0x0b8c('0x3d')]})[_0x0b8c('0x43')](function(_0xe62842){_0x379cfb[_0x0b8c('0x42')]=_0xe62842;if(_0x182d3e['query'][_0x0b8c('0x44')]){_0x30fa11[_0x0b8c('0x45')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x30fa11);})['then'](function(_0x1e87cd){_0x379cfb['rows']=_0x1e87cd;return _0x379cfb;});}})['then'](respondWithFilteredResult(_0xe79f05,_0x30fa11))[_0x0b8c('0x47')](handleError(_0xe79f05,null));};exports['getHopperBlacks']=function(_0x3ab8c1,_0x25b390,_0x52317e){var _0x4ea9c9={'raw':!![],'where':{}};var _0x32a3db={};var _0x2c72f6={'count':0x0,'rows':[]};return db[_0x0b8c('0x41')][_0x0b8c('0x5d')]({'where':{'id':_0x3ab8c1[_0x0b8c('0x55')]['id']}})['then'](handleEntityNotFound(_0x25b390,null))['then'](function(_0x4957d5){if(_0x4957d5){_0x32a3db[_0x0b8c('0x30')]=_[_0x0b8c('0x31')](db[_0x0b8c('0x64')][_0x0b8c('0x2c')]);_0x32a3db[_0x0b8c('0x32')]=_[_0x0b8c('0x31')](_0x3ab8c1[_0x0b8c('0x32')]);_0x32a3db[_0x0b8c('0x33')]=_[_0x0b8c('0x49')](_0x32a3db[_0x0b8c('0x30')],_0x32a3db[_0x0b8c('0x32')]);_0x4ea9c9[_0x0b8c('0x35')]=_[_0x0b8c('0x49')](_0x32a3db['model'],qs[_0x0b8c('0x34')](_0x3ab8c1[_0x0b8c('0x32')][_0x0b8c('0x34')]));_0x4ea9c9[_0x0b8c('0x35')]=_0x4ea9c9[_0x0b8c('0x35')][_0x0b8c('0x36')]?_0x4ea9c9[_0x0b8c('0x35')]:_0x32a3db[_0x0b8c('0x30')];if(!_0x3ab8c1[_0x0b8c('0x32')][_0x0b8c('0x37')](_0x0b8c('0x38'))){_0x4ea9c9[_0x0b8c('0x21')]=qs[_0x0b8c('0x21')](_0x3ab8c1[_0x0b8c('0x32')][_0x0b8c('0x21')]);_0x4ea9c9[_0x0b8c('0x20')]=qs[_0x0b8c('0x20')](_0x3ab8c1[_0x0b8c('0x32')][_0x0b8c('0x20')]);}_0x4ea9c9['order']=qs['sort'](_0x3ab8c1[_0x0b8c('0x32')][_0x0b8c('0x3a')]);_0x4ea9c9['where']=qs[_0x0b8c('0x33')](_[_0x0b8c('0x3b')](_0x3ab8c1[_0x0b8c('0x32')],_0x32a3db[_0x0b8c('0x33')]));_0x4ea9c9['where'][_0x0b8c('0x5f')]=_0x4957d5['id'];if(_0x3ab8c1[_0x0b8c('0x32')][_0x0b8c('0x3c')]){_0x4ea9c9[_0x0b8c('0x3d')]=_[_0x0b8c('0x3e')](_0x4ea9c9[_0x0b8c('0x3d')],{'$or':_[_0x0b8c('0x2b')](_0x4ea9c9['attributes'],function(_0x39a218){var _0x38119a={};_0x38119a[_0x39a218]={'$like':'%'+_0x3ab8c1[_0x0b8c('0x32')][_0x0b8c('0x3c')]+'%'};return _0x38119a;})});}_0x4ea9c9=_['merge']({},_0x4ea9c9,_0x3ab8c1[_0x0b8c('0x40')]);return db[_0x0b8c('0x64')]['count']({'where':_0x4ea9c9[_0x0b8c('0x3d')]})[_0x0b8c('0x43')](function(_0x25ff7f){_0x2c72f6[_0x0b8c('0x42')]=_0x25ff7f;if(_0x3ab8c1[_0x0b8c('0x32')][_0x0b8c('0x44')]){_0x4ea9c9[_0x0b8c('0x45')]=[{'all':!![]}];}return db[_0x0b8c('0x64')][_0x0b8c('0x46')](_0x4ea9c9);})[_0x0b8c('0x43')](function(_0x2a0102){_0x2c72f6['rows']=_0x2a0102;return _0x2c72f6;});}})[_0x0b8c('0x43')](respondWithFilteredResult(_0x25b390,_0x4ea9c9))[_0x0b8c('0x47')](handleError(_0x25b390,null));};exports[_0x0b8c('0x65')]=function(_0x2530e2,_0x2f31da,_0x49c17b){var _0x3f679e={};var _0x1bb05f={};var _0x173066;var _0x4a4c45;return db['Campaign'][_0x0b8c('0x5d')]({'where':{'id':_0x2530e2[_0x0b8c('0x55')]['id']}})[_0x0b8c('0x43')](handleEntityNotFound(_0x2f31da,null))[_0x0b8c('0x43')](function(_0x3e5e07){if(_0x3e5e07){_0x173066=_0x3e5e07;_0x1bb05f[_0x0b8c('0x30')]=_['keys'](db['CmList'][_0x0b8c('0x2c')]);_0x1bb05f[_0x0b8c('0x32')]=_['keys'](_0x2530e2['query']);_0x1bb05f[_0x0b8c('0x33')]=_['intersection'](_0x1bb05f[_0x0b8c('0x30')],_0x1bb05f[_0x0b8c('0x32')]);_0x3f679e[_0x0b8c('0x35')]=_['intersection'](_0x1bb05f[_0x0b8c('0x30')],qs[_0x0b8c('0x34')](_0x2530e2['query'][_0x0b8c('0x34')]));_0x3f679e['attributes']=_0x3f679e[_0x0b8c('0x35')][_0x0b8c('0x36')]?_0x3f679e[_0x0b8c('0x35')]:_0x1bb05f[_0x0b8c('0x30')];_0x3f679e[_0x0b8c('0x39')]=qs[_0x0b8c('0x3a')](_0x2530e2[_0x0b8c('0x32')][_0x0b8c('0x3a')]);_0x3f679e[_0x0b8c('0x3d')]=qs[_0x0b8c('0x33')](_[_0x0b8c('0x3b')](_0x2530e2[_0x0b8c('0x32')],_0x1bb05f['filters']));if(_0x2530e2[_0x0b8c('0x32')][_0x0b8c('0x3c')]){_0x3f679e[_0x0b8c('0x3d')]=_['merge'](_0x3f679e['where'],{'$or':_[_0x0b8c('0x2b')](_0x3f679e[_0x0b8c('0x35')],function(_0x2d8a56){var _0x20409c={};_0x20409c[_0x2d8a56]={'$like':'%'+_0x2530e2['query'][_0x0b8c('0x3c')]+'%'};return _0x20409c;})});}_0x3f679e=_[_0x0b8c('0x3e')]({},_0x3f679e,_0x2530e2[_0x0b8c('0x40')]);return _0x173066['getLists'](_0x3f679e);}})[_0x0b8c('0x43')](function(_0x19bc8d){if(_0x19bc8d){_0x4a4c45=_0x19bc8d['length'];if(!_0x2530e2[_0x0b8c('0x32')][_0x0b8c('0x37')]('nolimit')){_0x3f679e['limit']=qs[_0x0b8c('0x21')](_0x2530e2['query'][_0x0b8c('0x21')]);_0x3f679e[_0x0b8c('0x20')]=qs[_0x0b8c('0x20')](_0x2530e2[_0x0b8c('0x32')]['offset']);}return _0x173066[_0x0b8c('0x65')](_0x3f679e);}})['then'](function(_0x59cb20){if(_0x59cb20){return _0x59cb20?{'count':_0x4a4c45,'rows':_0x59cb20}:null;}})[_0x0b8c('0x43')](respondWithResult(_0x2f31da,null))[_0x0b8c('0x47')](handleError(_0x2f31da,null));};exports[_0x0b8c('0x66')]=function(_0x27189b,_0xaaddbe,_0x1fabe4){var _0x5ec719,_0xf067e2;return db[_0x0b8c('0x41')][_0x0b8c('0x4a')]({'where':{'id':_0x27189b[_0x0b8c('0x55')]['id']}})[_0x0b8c('0x43')](handleEntityNotFound(_0xaaddbe,null))[_0x0b8c('0x43')](function(_0x4d46ba){if(_0x4d46ba){_0xf067e2=_0x4d46ba;return _0x4d46ba[_0x0b8c('0x66')](_0x27189b['body'][_0x0b8c('0x67')],_[_0x0b8c('0x56')](_0x27189b[_0x0b8c('0x59')],[_0x0b8c('0x67'),'id'])||{});}return null;})[_0x0b8c('0x68')](function(_0x479da7){var _0x14e354;_0x5ec719=_0x479da7||[];var _0x500dd3=[];if(_0x479da7){for(var _0x51269b=0x0;_0x51269b<_0x479da7[_0x0b8c('0x36')];_0x51269b+=0x1){var _0x4f68fb=_0x479da7[_0x51269b][_0x0b8c('0x4e')]({'plain':!![]});_0xf067e2[_0x0b8c('0x69')]=_0x27189b['body'][_0x0b8c('0x69')]?_0x27189b[_0x0b8c('0x59')]['dialCheckDuplicateType']:_0xf067e2[_0x0b8c('0x69')];switch(_0xf067e2[_0x0b8c('0x69')]){case _0x0b8c('0x6a'):_0x14e354=squel[_0x0b8c('0x6b')]()[_0x0b8c('0x6c')](_0x0b8c('0x6d'))[_0x0b8c('0x6e')]([_0x0b8c('0x6f'),'scheduledAt',_0x0b8c('0x70'),_0x0b8c('0x71'),_0x0b8c('0x5f'),_0x0b8c('0x57'),_0x0b8c('0x58')],squel[_0x0b8c('0x72')]()[_0x0b8c('0x73')](_0x0b8c('0x6f'),_0x0b8c('0x6f'))[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x75'))[_0x0b8c('0x73')]('id',_0x0b8c('0x70'))[_0x0b8c('0x73')](_0x4f68fb[_0x0b8c('0x76')][_0x0b8c('0x77')](),'ListId')[_0x0b8c('0x73')](_0x27189b['params']['id'][_0x0b8c('0x77')](),_0x0b8c('0x5f'))[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x57'))[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x58'))['from']('cm_contacts')[_0x0b8c('0x3d')]('deletedAt\x20IS\x20NULL')[_0x0b8c('0x3d')]('ListId\x20=\x20?',_0x4f68fb[_0x0b8c('0x76')][_0x0b8c('0x77')]())[_0x0b8c('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x0b8c('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0b8c('0x72')]()['field'](_0x0b8c('0x78'))[_0x0b8c('0x79')](_0x0b8c('0x7a'))[_0x0b8c('0x3d')](_0x0b8c('0x7b'),_0x27189b[_0x0b8c('0x55')]['id'][_0x0b8c('0x77')]()))[_0x0b8c('0x3d')](_0x0b8c('0x7c'),squel[_0x0b8c('0x72')]()[_0x0b8c('0x73')](_0x0b8c('0x7d'))['from'](_0x0b8c('0x6d'))['where'](_0x0b8c('0x7b'),_0x27189b[_0x0b8c('0x55')]['id'][_0x0b8c('0x77')]())))[_0x0b8c('0x77')]();break;case _0x0b8c('0x7e'):_0x14e354=squel[_0x0b8c('0x6b')]()[_0x0b8c('0x6c')]('cm_hopper')['fromQuery']([_0x0b8c('0x6f'),_0x0b8c('0x75'),_0x0b8c('0x70'),_0x0b8c('0x71'),'CampaignId',_0x0b8c('0x57'),'updatedAt'],squel[_0x0b8c('0x72')]()['field'](_0x0b8c('0x6f'),_0x0b8c('0x6f'))[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x75'))[_0x0b8c('0x73')]('id',_0x0b8c('0x70'))[_0x0b8c('0x73')](_0x4f68fb['CmListId'][_0x0b8c('0x77')](),_0x0b8c('0x71'))[_0x0b8c('0x73')](_0x27189b[_0x0b8c('0x55')]['id'][_0x0b8c('0x77')](),_0x0b8c('0x5f'))[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x57'))[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x58'))['from'](_0x0b8c('0x7f'))[_0x0b8c('0x3d')](_0x0b8c('0x80'))[_0x0b8c('0x3d')](_0x0b8c('0x81'),_0x4f68fb[_0x0b8c('0x76')][_0x0b8c('0x77')]())[_0x0b8c('0x3d')](_0x0b8c('0x82'))['where'](_0x0b8c('0x7c'),squel[_0x0b8c('0x72')]()[_0x0b8c('0x73')](_0x0b8c('0x7d'))['from'](_0x0b8c('0x6d'))[_0x0b8c('0x3d')](_0x0b8c('0x7b'),_0x27189b[_0x0b8c('0x55')]['id'][_0x0b8c('0x77')]())))[_0x0b8c('0x77')]();break;default:_0x14e354=squel[_0x0b8c('0x6b')]()['into']('cm_hopper')['fromQuery'](['phone',_0x0b8c('0x75'),'ContactId','ListId',_0x0b8c('0x5f'),_0x0b8c('0x57'),'updatedAt'],squel[_0x0b8c('0x72')]()[_0x0b8c('0x73')](_0x0b8c('0x6f'),_0x0b8c('0x6f'))[_0x0b8c('0x73')]('NOW()','scheduledAt')[_0x0b8c('0x73')]('id',_0x0b8c('0x70'))[_0x0b8c('0x73')](_0x4f68fb['CmListId'][_0x0b8c('0x77')](),_0x0b8c('0x71'))[_0x0b8c('0x73')](_0x27189b[_0x0b8c('0x55')]['id'][_0x0b8c('0x77')](),_0x0b8c('0x5f'))[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x57'))[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x58'))[_0x0b8c('0x79')](_0x0b8c('0x7f'))['where'](_0x0b8c('0x80'))['where'](_0x0b8c('0x81'),_0x4f68fb[_0x0b8c('0x76')]['toString']())[_0x0b8c('0x3d')](_0x0b8c('0x82')))[_0x0b8c('0x77')]();}_0x500dd3[_0x0b8c('0x83')](db[_0x0b8c('0x84')]['query'](_0x14e354));}return BPromise[_0x0b8c('0x85')](_0x500dd3);}})[_0x0b8c('0x43')](function(){return _0x5ec719;})[_0x0b8c('0x43')](respondWithResult(_0xaaddbe,null))[_0x0b8c('0x47')](handleError(_0xaaddbe,null));};exports[_0x0b8c('0x86')]=function(_0x200ba6,_0x5947a1,_0x44948c){return db[_0x0b8c('0x41')][_0x0b8c('0x4a')]({'where':{'id':_0x200ba6[_0x0b8c('0x55')]['id']}})[_0x0b8c('0x43')](handleEntityNotFound(_0x5947a1,null))[_0x0b8c('0x43')](function(_0x1c43e9){if(_0x1c43e9){return _0x1c43e9[_0x0b8c('0x86')](_0x200ba6[_0x0b8c('0x32')][_0x0b8c('0x67')]);}})['then'](function(_0x37b24f){if(_0x37b24f){return db['CmHopper'][_0x0b8c('0x24')]({'where':{'ListId':_0x200ba6[_0x0b8c('0x32')][_0x0b8c('0x67')],'CampaignId':_0x200ba6[_0x0b8c('0x55')]['id']}})[_0x0b8c('0x43')](function(){return _0x37b24f;});}})[_0x0b8c('0x43')](respondWithStatusCode(_0x5947a1,null))[_0x0b8c('0x47')](handleError(_0x5947a1,null));};exports[_0x0b8c('0x87')]=function(_0x37e033,_0x40cce2,_0x3d9c63){var _0x59bb10={};var _0x9929c0={};var _0x13fa7d;var _0x18e24c;return db[_0x0b8c('0x41')][_0x0b8c('0x5d')]({'where':{'id':_0x37e033['params']['id']}})['then'](handleEntityNotFound(_0x40cce2,null))['then'](function(_0x1526df){if(_0x1526df){_0x13fa7d=_0x1526df;_0x9929c0[_0x0b8c('0x30')]=_[_0x0b8c('0x31')](db[_0x0b8c('0x88')][_0x0b8c('0x2c')]);_0x9929c0['query']=_[_0x0b8c('0x31')](_0x37e033['query']);_0x9929c0[_0x0b8c('0x33')]=_[_0x0b8c('0x49')](_0x9929c0[_0x0b8c('0x30')],_0x9929c0[_0x0b8c('0x32')]);_0x59bb10['attributes']=_['intersection'](_0x9929c0[_0x0b8c('0x30')],qs[_0x0b8c('0x34')](_0x37e033['query'][_0x0b8c('0x34')]));_0x59bb10[_0x0b8c('0x35')]=_0x59bb10['attributes'][_0x0b8c('0x36')]?_0x59bb10[_0x0b8c('0x35')]:_0x9929c0[_0x0b8c('0x30')];_0x59bb10[_0x0b8c('0x39')]=qs[_0x0b8c('0x3a')](_0x37e033[_0x0b8c('0x32')][_0x0b8c('0x3a')]);_0x59bb10[_0x0b8c('0x3d')]=qs['filters'](_[_0x0b8c('0x3b')](_0x37e033[_0x0b8c('0x32')],_0x9929c0[_0x0b8c('0x33')]));if(_0x37e033['query'][_0x0b8c('0x3c')]){_0x59bb10['where']=_[_0x0b8c('0x3e')](_0x59bb10[_0x0b8c('0x3d')],{'$or':_['map'](_0x59bb10[_0x0b8c('0x35')],function(_0x2a7afc){var _0x3772eb={};_0x3772eb[_0x2a7afc]={'$like':'%'+_0x37e033[_0x0b8c('0x32')]['filter']+'%'};return _0x3772eb;})});}_0x59bb10=_[_0x0b8c('0x3e')]({},_0x59bb10,_0x37e033[_0x0b8c('0x40')]);return _0x13fa7d['getBlackLists'](_0x59bb10);}})[_0x0b8c('0x43')](function(_0x2ecb18){if(_0x2ecb18){_0x18e24c=_0x2ecb18[_0x0b8c('0x36')];if(!_0x37e033['query'][_0x0b8c('0x37')](_0x0b8c('0x38'))){_0x59bb10['limit']=qs[_0x0b8c('0x21')](_0x37e033['query'][_0x0b8c('0x21')]);_0x59bb10[_0x0b8c('0x20')]=qs['offset'](_0x37e033[_0x0b8c('0x32')][_0x0b8c('0x20')]);}return _0x13fa7d[_0x0b8c('0x87')](_0x59bb10);}})[_0x0b8c('0x43')](function(_0x264798){if(_0x264798){return _0x264798?{'count':_0x18e24c,'rows':_0x264798}:null;}})['then'](respondWithResult(_0x40cce2,null))[_0x0b8c('0x47')](handleError(_0x40cce2,null));};exports[_0x0b8c('0x89')]=function(_0x56554b,_0x391cb4,_0x259d69){var _0x4d0a7e,_0x4d4d08;return db[_0x0b8c('0x41')][_0x0b8c('0x4a')]({'where':{'id':_0x56554b[_0x0b8c('0x55')]['id']}})[_0x0b8c('0x43')](handleEntityNotFound(_0x391cb4,null))[_0x0b8c('0x43')](function(_0x29c2f4){if(_0x29c2f4){_0x4d4d08=_0x29c2f4;return _0x29c2f4[_0x0b8c('0x89')](_0x56554b[_0x0b8c('0x59')][_0x0b8c('0x67')],_[_0x0b8c('0x56')](_0x56554b[_0x0b8c('0x59')],['ids','id'])||{});}return null;})[_0x0b8c('0x68')](function(_0x34f7bb){var _0x25b5b0;_0x4d0a7e=_0x34f7bb||[];var _0x697d48=[];if(_0x34f7bb){for(var _0x497b88=0x0;_0x497b88<_0x34f7bb[_0x0b8c('0x36')];_0x497b88+=0x1){var _0xc74ec=_0x34f7bb[_0x497b88]['get']({'plain':!![]});_0x25b5b0=squel['insert']()['into'](_0x0b8c('0x8a'))[_0x0b8c('0x6e')]([_0x0b8c('0x6f'),_0x0b8c('0x70'),_0x0b8c('0x71'),_0x0b8c('0x5f'),_0x0b8c('0x57'),_0x0b8c('0x58')],squel['select']()[_0x0b8c('0x73')]('phone','phone')['field']('id',_0x0b8c('0x70'))[_0x0b8c('0x73')](_0xc74ec[_0x0b8c('0x76')][_0x0b8c('0x77')](),_0x0b8c('0x71'))[_0x0b8c('0x73')](_0x56554b[_0x0b8c('0x55')]['id'][_0x0b8c('0x77')](),_0x0b8c('0x5f'))[_0x0b8c('0x73')]('NOW()','createdAt')[_0x0b8c('0x73')](_0x0b8c('0x74'),_0x0b8c('0x58'))['from'](_0x0b8c('0x7f'))[_0x0b8c('0x3d')](_0x0b8c('0x80'))[_0x0b8c('0x3d')]('ListId\x20=\x20?',_0xc74ec[_0x0b8c('0x76')][_0x0b8c('0x77')]())[_0x0b8c('0x3d')](_0x0b8c('0x82')))[_0x0b8c('0x77')]();_0x697d48[_0x0b8c('0x83')](db[_0x0b8c('0x84')][_0x0b8c('0x32')](_0x25b5b0));}return BPromise[_0x0b8c('0x85')](_0x697d48);}})[_0x0b8c('0x43')](function(){return _0x4d0a7e;})[_0x0b8c('0x43')](respondWithResult(_0x391cb4,null))[_0x0b8c('0x47')](handleError(_0x391cb4,null));};exports['removeBlackLists']=function(_0x30cfd7,_0xb99941,_0xdfc897){return db['Campaign']['find']({'where':{'id':_0x30cfd7[_0x0b8c('0x55')]['id']}})['then'](handleEntityNotFound(_0xb99941,null))[_0x0b8c('0x43')](function(_0x1d6e3e){if(_0x1d6e3e){return _0x1d6e3e[_0x0b8c('0x8b')](_0x30cfd7[_0x0b8c('0x32')][_0x0b8c('0x67')]);}})[_0x0b8c('0x43')](function(_0x39ccfa){if(_0x39ccfa){return db[_0x0b8c('0x64')][_0x0b8c('0x24')]({'where':{'ListId':_0x30cfd7['query']['ids'],'CampaignId':_0x30cfd7['params']['id']}})[_0x0b8c('0x43')](function(){return _0x39ccfa;});}})[_0x0b8c('0x43')](respondWithStatusCode(_0xb99941,null))[_0x0b8c('0x47')](handleError(_0xb99941,null));}; \ No newline at end of file +var _0xcab1=['push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','apply','save','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','deletedAt\x20IS\x20NULL'];(function(_0x346ceb,_0x146561){var _0x350df7=function(_0x272f1e){while(--_0x272f1e){_0x346ceb['push'](_0x346ceb['shift']());}};_0x350df7(++_0x146561);}(_0xcab1,0x92));var _0x1cab=function(_0x3f0115,_0xcbb466){_0x3f0115=_0x3f0115-0x0;var _0x470e35=_0xcab1[_0x3f0115];return _0x470e35;};'use strict';var pdf=require(_0x1cab('0x0'));var emlformat=require(_0x1cab('0x1'));var rimraf=require(_0x1cab('0x2'));var zipdir=require(_0x1cab('0x3'));var jsonpatch=require(_0x1cab('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1cab('0x5'));var util=require(_0x1cab('0x6'));var path=require(_0x1cab('0x7'));var sox=require(_0x1cab('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cab('0x9'));var _=require(_0x1cab('0xa'));var squel=require(_0x1cab('0xb'));var crypto=require(_0x1cab('0xc'));var jsforce=require(_0x1cab('0xd'));var deskjs=require(_0x1cab('0xe'));var toCsv=require(_0x1cab('0xf'));var querystring=require(_0x1cab('0x10'));var Papa=require(_0x1cab('0x11'));var Redis=require(_0x1cab('0x12'));var authService=require(_0x1cab('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1cab('0x14'));var hardwareService=require(_0x1cab('0x15'));var logger=require(_0x1cab('0x16'))(_0x1cab('0x17'));var utils=require(_0x1cab('0x18'));var config=require(_0x1cab('0x19'));var licenseUtil=require(_0x1cab('0x1a'));var db=require(_0x1cab('0x1b'))['db'];function respondWithStatusCode(_0x52073d,_0x1beb3e){_0x1beb3e=_0x1beb3e||0xcc;return function(_0x2864f4){if(_0x2864f4){return _0x52073d[_0x1cab('0x1c')](_0x1beb3e);}return _0x52073d[_0x1cab('0x1d')](_0x1beb3e)[_0x1cab('0x1e')]();};}function respondWithResult(_0x1ebfe5,_0x3a592a){_0x3a592a=_0x3a592a||0xc8;return function(_0x19d2eb){if(_0x19d2eb){return _0x1ebfe5[_0x1cab('0x1d')](_0x3a592a)[_0x1cab('0x1f')](_0x19d2eb);}};}function respondWithFilteredResult(_0x49ecd8,_0x1b6083){return function(_0x10169f){if(_0x10169f){var _0x4f4532=_0x10169f[_0x1cab('0x20')],_0x115687=_0x1b6083['offset'],_0x2b8dc4=_0x1b6083['offset']+_0x1b6083[_0x1cab('0x21')],_0x4f192b;if(_0x2b8dc4>=_0x4f4532){_0x2b8dc4=_0x4f4532;_0x4f192b=0xc8;}else{_0x4f192b=0xce;}_0x49ecd8[_0x1cab('0x1d')](_0x4f192b);return _0x49ecd8[_0x1cab('0x22')]('Content-Range',_0x115687+'-'+_0x2b8dc4+'/'+_0x4f4532)['json'](_0x10169f);}return null;};}function patchUpdates(_0x2c8c47){return function(_0x311cec){try{jsonpatch[_0x1cab('0x23')](_0x311cec,_0x2c8c47,!![]);}catch(_0x2662be){return BPromise['reject'](_0x2662be);}return _0x311cec[_0x1cab('0x24')]();};}function saveUpdates(_0x364488,_0x399f67){return function(_0xa33694){if(_0xa33694){return _0xa33694['update'](_0x364488)['then'](function(_0x37e708){return _0x37e708;});}return null;};}function removeEntity(_0x48ba9d,_0x5506ba){return function(_0x3f767d){if(_0x3f767d){return _0x3f767d['destroy']()[_0x1cab('0x25')](function(){var _0x1532f4=_0x3f767d[_0x1cab('0x26')]({'plain':!![]});var _0x3bc2dc=_0x1cab('0x27');return db[_0x1cab('0x28')][_0x1cab('0x29')]({'where':{'type':_0x3bc2dc,'resourceId':_0x1532f4['id']}})[_0x1cab('0x25')](function(){return _0x3f767d;});})[_0x1cab('0x25')](function(){_0x48ba9d[_0x1cab('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47cd0d,_0x555419){return function(_0x454c3f){if(!_0x454c3f){_0x47cd0d[_0x1cab('0x1c')](0x194);}return _0x454c3f;};}function handleError(_0x1b3320,_0x2112bb){_0x2112bb=_0x2112bb||0x1f4;return function(_0x1e5eec){logger[_0x1cab('0x2a')](_0x1e5eec[_0x1cab('0x2b')]);if(_0x1e5eec[_0x1cab('0x2c')]){delete _0x1e5eec[_0x1cab('0x2c')];}_0x1b3320[_0x1cab('0x1d')](_0x2112bb)[_0x1cab('0x2d')](_0x1e5eec);};}exports[_0x1cab('0x2e')]=function(_0x5a1060,_0x2c8b9a){var _0x2e90fa={},_0x43b6c2={},_0x44a0e0={'count':0x0,'rows':[]};var _0x352c13=_[_0x1cab('0x2f')](db[_0x1cab('0x30')][_0x1cab('0x31')],function(_0x35ce51){return{'name':_0x35ce51[_0x1cab('0x32')],'type':_0x35ce51[_0x1cab('0x33')][_0x1cab('0x34')]};});_0x43b6c2[_0x1cab('0x35')]=_[_0x1cab('0x2f')](_0x352c13,'name');_0x43b6c2['query']=_['keys'](_0x5a1060[_0x1cab('0x36')]);_0x43b6c2[_0x1cab('0x37')]=_['intersection'](_0x43b6c2['model'],_0x43b6c2[_0x1cab('0x36')]);_0x2e90fa[_0x1cab('0x38')]=_[_0x1cab('0x39')](_0x43b6c2[_0x1cab('0x35')],qs[_0x1cab('0x3a')](_0x5a1060[_0x1cab('0x36')][_0x1cab('0x3a')]));_0x2e90fa['attributes']=_0x2e90fa[_0x1cab('0x38')][_0x1cab('0x3b')]?_0x2e90fa[_0x1cab('0x38')]:_0x43b6c2['model'];if(!_0x5a1060[_0x1cab('0x36')][_0x1cab('0x3c')](_0x1cab('0x3d'))){_0x2e90fa[_0x1cab('0x21')]=qs[_0x1cab('0x21')](_0x5a1060['query'][_0x1cab('0x21')]);_0x2e90fa[_0x1cab('0x3e')]=qs[_0x1cab('0x3e')](_0x5a1060[_0x1cab('0x36')][_0x1cab('0x3e')]);}_0x2e90fa[_0x1cab('0x3f')]=qs['sort'](_0x5a1060[_0x1cab('0x36')][_0x1cab('0x40')]);_0x2e90fa[_0x1cab('0x41')]=qs[_0x1cab('0x37')](_[_0x1cab('0x42')](_0x5a1060[_0x1cab('0x36')],_0x43b6c2['filters']),_0x352c13);if(_0x5a1060[_0x1cab('0x36')][_0x1cab('0x43')]){_0x2e90fa[_0x1cab('0x41')]=_[_0x1cab('0x44')](_0x2e90fa[_0x1cab('0x41')],{'$or':_['map'](_0x352c13,function(_0x2f0a9d){if(_0x2f0a9d[_0x1cab('0x33')]!=='VIRTUAL'){var _0x46fc2c={};_0x46fc2c[_0x2f0a9d[_0x1cab('0x2c')]]={'$like':'%'+_0x5a1060[_0x1cab('0x36')][_0x1cab('0x43')]+'%'};return _0x46fc2c;}})});}_0x2e90fa=_[_0x1cab('0x44')]({},_0x2e90fa,_0x5a1060[_0x1cab('0x45')]);var _0x190041={'where':_0x2e90fa[_0x1cab('0x41')]};return db[_0x1cab('0x30')][_0x1cab('0x20')](_0x190041)['then'](function(_0x51e239){_0x44a0e0[_0x1cab('0x20')]=_0x51e239;if(_0x5a1060['query'][_0x1cab('0x46')]){_0x2e90fa[_0x1cab('0x47')]=[{'all':!![]}];}return db[_0x1cab('0x30')][_0x1cab('0x48')](_0x2e90fa);})[_0x1cab('0x25')](function(_0x19dad0){_0x44a0e0[_0x1cab('0x49')]=_0x19dad0;return _0x44a0e0;})[_0x1cab('0x25')](respondWithFilteredResult(_0x2c8b9a,_0x2e90fa))[_0x1cab('0x4a')](handleError(_0x2c8b9a,null));};exports['show']=function(_0x2745fe,_0x478d21){var _0xee646c={'raw':![],'where':{'id':_0x2745fe['params']['id']}},_0x2aaade={};_0x2aaade[_0x1cab('0x35')]=_[_0x1cab('0x4b')](db['Campaign'][_0x1cab('0x31')]);_0x2aaade[_0x1cab('0x36')]=_['keys'](_0x2745fe[_0x1cab('0x36')]);_0x2aaade[_0x1cab('0x37')]=_[_0x1cab('0x39')](_0x2aaade[_0x1cab('0x35')],_0x2aaade[_0x1cab('0x36')]);_0xee646c[_0x1cab('0x38')]=_[_0x1cab('0x39')](_0x2aaade['model'],qs[_0x1cab('0x3a')](_0x2745fe[_0x1cab('0x36')][_0x1cab('0x3a')]));_0xee646c[_0x1cab('0x38')]=_0xee646c['attributes'][_0x1cab('0x3b')]?_0xee646c[_0x1cab('0x38')]:_0x2aaade['model'];if(_0x2745fe[_0x1cab('0x36')][_0x1cab('0x46')]){_0xee646c[_0x1cab('0x47')]=[{'all':!![]}];}_0xee646c=_['merge']({},_0xee646c,_0x2745fe[_0x1cab('0x45')]);return db[_0x1cab('0x30')][_0x1cab('0x4c')](_0xee646c)['then'](handleEntityNotFound(_0x478d21,null))['then'](respondWithResult(_0x478d21,null))[_0x1cab('0x4a')](handleError(_0x478d21,null));};exports[_0x1cab('0x4d')]=function(_0x28d6bf,_0x1299f5){return db['Campaign'][_0x1cab('0x4d')](_0x28d6bf[_0x1cab('0x4e')],{})[_0x1cab('0x25')](function(_0x3c627e){var _0x3059a5=_0x28d6bf['user'][_0x1cab('0x26')]({'plain':!![]});if(!_0x3059a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3059a5['role']===_0x1cab('0x4f')){var _0x686437=_0x3c627e[_0x1cab('0x26')]({'plain':!![]});var _0x561c46='IvrCampaigns';return db[_0x1cab('0x50')]['find']({'where':{'name':_0x561c46,'userProfileId':_0x3059a5[_0x1cab('0x51')]},'raw':!![]})[_0x1cab('0x25')](function(_0x4b4f9c){if(_0x4b4f9c&&_0x4b4f9c['autoAssociation']===0x0){return db[_0x1cab('0x28')][_0x1cab('0x4d')]({'name':_0x686437[_0x1cab('0x2c')],'resourceId':_0x686437['id'],'type':_0x4b4f9c[_0x1cab('0x2c')],'sectionId':_0x4b4f9c['id']},{})[_0x1cab('0x25')](function(){return _0x3c627e;});}else{return _0x3c627e;}})[_0x1cab('0x4a')](function(_0xe6ef8d){logger[_0x1cab('0x2a')](_0x1cab('0x52'),_0xe6ef8d);throw _0xe6ef8d;});}return _0x3c627e;})['then'](respondWithResult(_0x1299f5,0xc9))[_0x1cab('0x4a')](handleError(_0x1299f5,null));};exports[_0x1cab('0x53')]=function(_0xd628a0,_0x1cf93a){var _0x4881a4={'where':{'id':_0xd628a0[_0x1cab('0x54')]['id']}},_0x3f54ba={};_0x3f54ba[_0x1cab('0x35')]=_['keys'](db[_0x1cab('0x30')]['rawAttributes']);_0x4881a4['attributes']=_[_0x1cab('0x39')](_0x3f54ba[_0x1cab('0x35')],qs['fields'](_0xd628a0[_0x1cab('0x36')][_0x1cab('0x3a')]));_0x4881a4[_0x1cab('0x38')]=_0x4881a4[_0x1cab('0x38')][_0x1cab('0x3b')]?_0x4881a4[_0x1cab('0x38')]:_0x3f54ba[_0x1cab('0x35')];if(_0xd628a0[_0x1cab('0x36')][_0x1cab('0x46')]){_0x4881a4['include']=[{'all':!![]}];}_0x4881a4=_[_0x1cab('0x44')]({},_0x4881a4,_0xd628a0[_0x1cab('0x45')]);return db[_0x1cab('0x30')][_0x1cab('0x4c')](_0x4881a4)[_0x1cab('0x25')](handleEntityNotFound(_0x1cf93a,null))[_0x1cab('0x25')](function(_0x1b4e18){if(_0x1b4e18){var _0x11500d=_0x1b4e18[_0x1cab('0x26')]({'plain':!![]});_0x11500d=qs['omit'](_0x11500d,['id',_0x1cab('0x55'),_0x1cab('0x56')]);_0xd628a0[_0x1cab('0x4e')]=_[_0x1cab('0x57')](_0xd628a0[_0x1cab('0x4e')],['id',_0x1cab('0x55'),'updatedAt']);return db[_0x1cab('0x30')][_0x1cab('0x4d')](_[_0x1cab('0x44')](_0x11500d,_0xd628a0[_0x1cab('0x4e')]),{'include':_0xd628a0['query']['includeAll']?[{'all':!![]}]:undefined})[_0x1cab('0x25')](function(_0x4e713b){var _0x4d4093=_0xd628a0[_0x1cab('0x4f')][_0x1cab('0x26')]({'plain':!![]});if(!_0x4d4093)throw new Error(_0x1cab('0x58'));if(_0x4d4093[_0x1cab('0x59')]===_0x1cab('0x4f')){var _0x429ea8=_0x4e713b[_0x1cab('0x26')]({'plain':!![]});var _0xf1311c=_0x1cab('0x27');return db[_0x1cab('0x50')][_0x1cab('0x4c')]({'where':{'name':_0xf1311c,'userProfileId':_0x4d4093[_0x1cab('0x51')]},'raw':!![]})[_0x1cab('0x25')](function(_0x5ea51b){if(_0x5ea51b&&_0x5ea51b[_0x1cab('0x5a')]===0x0){return db[_0x1cab('0x28')][_0x1cab('0x4d')]({'name':_0x429ea8['name'],'resourceId':_0x429ea8['id'],'type':_0x5ea51b[_0x1cab('0x2c')],'sectionId':_0x5ea51b['id']},{})[_0x1cab('0x25')](function(){return _0x4e713b;});}else{return _0x4e713b;}})[_0x1cab('0x4a')](function(_0x3ae4ea){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ae4ea);throw _0x3ae4ea;});}return _0x4e713b;});}})[_0x1cab('0x25')](respondWithResult(_0x1cf93a,0xc9))[_0x1cab('0x4a')](handleError(_0x1cf93a,null));};exports[_0x1cab('0x5b')]=function(_0xb02d72,_0x1c47cb){if(_0xb02d72['body']['id']){delete _0xb02d72[_0x1cab('0x4e')]['id'];}return db[_0x1cab('0x30')][_0x1cab('0x4c')]({'where':{'id':_0xb02d72[_0x1cab('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c47cb,null))[_0x1cab('0x25')](saveUpdates(_0xb02d72[_0x1cab('0x4e')],null))[_0x1cab('0x25')](respondWithResult(_0x1c47cb,null))[_0x1cab('0x4a')](handleError(_0x1c47cb,null));};exports['destroy']=function(_0xff17df,_0xe39c68){return db[_0x1cab('0x30')][_0x1cab('0x4c')]({'where':{'id':_0xff17df[_0x1cab('0x54')]['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0xe39c68,null))[_0x1cab('0x25')](removeEntity(_0xe39c68,null))['catch'](handleError(_0xe39c68,null));};exports[_0x1cab('0x5c')]=function(_0x55e82b,_0x5b646d,_0xdeda3){var _0x5615c6={'raw':!![],'where':{}};var _0x341d20={};var _0x326092={'count':0x0,'rows':[]};return db[_0x1cab('0x30')][_0x1cab('0x5d')]({'where':{'id':_0x55e82b[_0x1cab('0x54')]['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0x5b646d,null))[_0x1cab('0x25')](function(_0x20ea3e){if(_0x20ea3e){_0x341d20[_0x1cab('0x35')]=_[_0x1cab('0x4b')](db[_0x1cab('0x5e')][_0x1cab('0x31')]);_0x341d20[_0x1cab('0x36')]=_[_0x1cab('0x4b')](_0x55e82b['query']);_0x341d20[_0x1cab('0x37')]=_[_0x1cab('0x39')](_0x341d20[_0x1cab('0x35')],_0x341d20[_0x1cab('0x36')]);_0x5615c6[_0x1cab('0x38')]=_['intersection'](_0x341d20[_0x1cab('0x35')],qs['fields'](_0x55e82b[_0x1cab('0x36')][_0x1cab('0x3a')]));_0x5615c6[_0x1cab('0x38')]=_0x5615c6['attributes'][_0x1cab('0x3b')]?_0x5615c6[_0x1cab('0x38')]:_0x341d20[_0x1cab('0x35')];if(!_0x55e82b['query'][_0x1cab('0x3c')](_0x1cab('0x3d'))){_0x5615c6[_0x1cab('0x21')]=qs[_0x1cab('0x21')](_0x55e82b[_0x1cab('0x36')][_0x1cab('0x21')]);_0x5615c6[_0x1cab('0x3e')]=qs[_0x1cab('0x3e')](_0x55e82b['query'][_0x1cab('0x3e')]);}_0x5615c6[_0x1cab('0x3f')]=qs['sort'](_0x55e82b[_0x1cab('0x36')][_0x1cab('0x40')]);_0x5615c6['where']=qs['filters'](_['pick'](_0x55e82b[_0x1cab('0x36')],_0x341d20[_0x1cab('0x37')]));_0x5615c6[_0x1cab('0x41')][_0x1cab('0x5f')]=_0x20ea3e['id'];if(_0x55e82b[_0x1cab('0x36')][_0x1cab('0x43')]){_0x5615c6[_0x1cab('0x41')]=_[_0x1cab('0x44')](_0x5615c6['where'],{'$or':_['map'](_0x5615c6[_0x1cab('0x38')],function(_0x117a10){var _0x4333c1={};_0x4333c1[_0x117a10]={'$like':'%'+_0x55e82b[_0x1cab('0x36')]['filter']+'%'};return _0x4333c1;})});}_0x5615c6=_[_0x1cab('0x44')]({},_0x5615c6,_0x55e82b[_0x1cab('0x45')]);return db[_0x1cab('0x5e')]['count']({'where':_0x5615c6['where']})[_0x1cab('0x25')](function(_0x35db52){_0x326092[_0x1cab('0x20')]=_0x35db52;if(_0x55e82b[_0x1cab('0x36')][_0x1cab('0x46')]){_0x5615c6[_0x1cab('0x47')]=[{'all':!![]}];}return db[_0x1cab('0x5e')][_0x1cab('0x48')](_0x5615c6);})[_0x1cab('0x25')](function(_0xdffcbd){_0x326092['rows']=_0xdffcbd;return _0x326092;});}})[_0x1cab('0x25')](respondWithFilteredResult(_0x5b646d,_0x5615c6))[_0x1cab('0x4a')](handleError(_0x5b646d,null));};exports[_0x1cab('0x60')]=function(_0x20f848,_0x203f6a,_0xeca1fe){var _0x4a5ea2={'raw':!![],'where':{}};var _0x12bf8c={};var _0x89fc03={'count':0x0,'rows':[]};return db[_0x1cab('0x30')][_0x1cab('0x5d')]({'where':{'id':_0x20f848['params']['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0x203f6a,null))[_0x1cab('0x25')](function(_0x4c94da){if(_0x4c94da){_0x12bf8c['model']=_[_0x1cab('0x4b')](db[_0x1cab('0x61')]['rawAttributes']);_0x12bf8c['query']=_[_0x1cab('0x4b')](_0x20f848['query']);_0x12bf8c[_0x1cab('0x37')]=_[_0x1cab('0x39')](_0x12bf8c[_0x1cab('0x35')],_0x12bf8c[_0x1cab('0x36')]);_0x4a5ea2['attributes']=_[_0x1cab('0x39')](_0x12bf8c[_0x1cab('0x35')],qs[_0x1cab('0x3a')](_0x20f848[_0x1cab('0x36')]['fields']));_0x4a5ea2[_0x1cab('0x38')]=_0x4a5ea2[_0x1cab('0x38')][_0x1cab('0x3b')]?_0x4a5ea2[_0x1cab('0x38')]:_0x12bf8c[_0x1cab('0x35')];if(!_0x20f848[_0x1cab('0x36')][_0x1cab('0x3c')](_0x1cab('0x3d'))){_0x4a5ea2[_0x1cab('0x21')]=qs['limit'](_0x20f848['query']['limit']);_0x4a5ea2[_0x1cab('0x3e')]=qs['offset'](_0x20f848['query']['offset']);}_0x4a5ea2['order']=qs[_0x1cab('0x40')](_0x20f848[_0x1cab('0x36')][_0x1cab('0x40')]);_0x4a5ea2[_0x1cab('0x41')]=qs[_0x1cab('0x37')](_[_0x1cab('0x42')](_0x20f848[_0x1cab('0x36')],_0x12bf8c[_0x1cab('0x37')]));_0x4a5ea2['where'][_0x1cab('0x5f')]=_0x4c94da['id'];if(_0x20f848[_0x1cab('0x36')][_0x1cab('0x43')]){_0x4a5ea2[_0x1cab('0x41')]=_[_0x1cab('0x44')](_0x4a5ea2[_0x1cab('0x41')],{'$or':_[_0x1cab('0x2f')](_0x4a5ea2[_0x1cab('0x38')],function(_0x55f02b){var _0x16aa75={};_0x16aa75[_0x55f02b]={'$like':'%'+_0x20f848[_0x1cab('0x36')]['filter']+'%'};return _0x16aa75;})});}_0x4a5ea2=_[_0x1cab('0x44')]({},_0x4a5ea2,_0x20f848[_0x1cab('0x45')]);return db[_0x1cab('0x61')]['count']({'where':_0x4a5ea2[_0x1cab('0x41')]})[_0x1cab('0x25')](function(_0x7ae183){_0x89fc03[_0x1cab('0x20')]=_0x7ae183;if(_0x20f848[_0x1cab('0x36')][_0x1cab('0x46')]){_0x4a5ea2['include']=[{'all':!![]}];}return db[_0x1cab('0x61')]['findAll'](_0x4a5ea2);})[_0x1cab('0x25')](function(_0x5cdc5a){_0x89fc03['rows']=_0x5cdc5a;return _0x89fc03;});}})[_0x1cab('0x25')](respondWithFilteredResult(_0x203f6a,_0x4a5ea2))[_0x1cab('0x4a')](handleError(_0x203f6a,null));};exports[_0x1cab('0x62')]=function(_0x4fbcd6,_0x3c3158,_0x5d7305){var _0x5aff45={'raw':!![],'where':{}};var _0x2e51a6={};var _0x238bc7={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4fbcd6[_0x1cab('0x54')]['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0x3c3158,null))[_0x1cab('0x25')](function(_0x2c6448){if(_0x2c6448){_0x2e51a6[_0x1cab('0x35')]=_[_0x1cab('0x4b')](db[_0x1cab('0x63')]['rawAttributes']);_0x2e51a6[_0x1cab('0x36')]=_[_0x1cab('0x4b')](_0x4fbcd6[_0x1cab('0x36')]);_0x2e51a6[_0x1cab('0x37')]=_[_0x1cab('0x39')](_0x2e51a6['model'],_0x2e51a6[_0x1cab('0x36')]);_0x5aff45[_0x1cab('0x38')]=_[_0x1cab('0x39')](_0x2e51a6['model'],qs[_0x1cab('0x3a')](_0x4fbcd6[_0x1cab('0x36')]['fields']));_0x5aff45[_0x1cab('0x38')]=_0x5aff45['attributes'][_0x1cab('0x3b')]?_0x5aff45[_0x1cab('0x38')]:_0x2e51a6[_0x1cab('0x35')];if(!_0x4fbcd6[_0x1cab('0x36')][_0x1cab('0x3c')](_0x1cab('0x3d'))){_0x5aff45[_0x1cab('0x21')]=qs[_0x1cab('0x21')](_0x4fbcd6[_0x1cab('0x36')][_0x1cab('0x21')]);_0x5aff45[_0x1cab('0x3e')]=qs['offset'](_0x4fbcd6['query']['offset']);}_0x5aff45[_0x1cab('0x3f')]=qs[_0x1cab('0x40')](_0x4fbcd6[_0x1cab('0x36')][_0x1cab('0x40')]);_0x5aff45[_0x1cab('0x41')]=qs[_0x1cab('0x37')](_[_0x1cab('0x42')](_0x4fbcd6[_0x1cab('0x36')],_0x2e51a6[_0x1cab('0x37')]));_0x5aff45[_0x1cab('0x41')]['CampaignId']=_0x2c6448['id'];if(_0x4fbcd6['query'][_0x1cab('0x43')]){_0x5aff45[_0x1cab('0x41')]=_['merge'](_0x5aff45[_0x1cab('0x41')],{'$or':_[_0x1cab('0x2f')](_0x5aff45[_0x1cab('0x38')],function(_0x30c525){var _0x22d39b={};_0x22d39b[_0x30c525]={'$like':'%'+_0x4fbcd6[_0x1cab('0x36')][_0x1cab('0x43')]+'%'};return _0x22d39b;})});}_0x5aff45=_[_0x1cab('0x44')]({},_0x5aff45,_0x4fbcd6[_0x1cab('0x45')]);return db[_0x1cab('0x63')][_0x1cab('0x20')]({'where':_0x5aff45['where']})[_0x1cab('0x25')](function(_0x8462fc){_0x238bc7[_0x1cab('0x20')]=_0x8462fc;if(_0x4fbcd6[_0x1cab('0x36')][_0x1cab('0x46')]){_0x5aff45[_0x1cab('0x47')]=[{'all':!![]}];}return db[_0x1cab('0x63')][_0x1cab('0x48')](_0x5aff45);})[_0x1cab('0x25')](function(_0x4442b3){_0x238bc7[_0x1cab('0x49')]=_0x4442b3;return _0x238bc7;});}})[_0x1cab('0x25')](respondWithFilteredResult(_0x3c3158,_0x5aff45))[_0x1cab('0x4a')](handleError(_0x3c3158,null));};exports['getHopperBlacks']=function(_0x472039,_0x14a731,_0x28ca01){var _0x3097a1={'raw':!![],'where':{}};var _0x5c7155={};var _0x12b82d={'count':0x0,'rows':[]};return db[_0x1cab('0x30')][_0x1cab('0x5d')]({'where':{'id':_0x472039[_0x1cab('0x54')]['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0x14a731,null))['then'](function(_0x5b6877){if(_0x5b6877){_0x5c7155['model']=_['keys'](db[_0x1cab('0x64')][_0x1cab('0x31')]);_0x5c7155[_0x1cab('0x36')]=_[_0x1cab('0x4b')](_0x472039[_0x1cab('0x36')]);_0x5c7155['filters']=_['intersection'](_0x5c7155[_0x1cab('0x35')],_0x5c7155[_0x1cab('0x36')]);_0x3097a1[_0x1cab('0x38')]=_[_0x1cab('0x39')](_0x5c7155[_0x1cab('0x35')],qs[_0x1cab('0x3a')](_0x472039[_0x1cab('0x36')][_0x1cab('0x3a')]));_0x3097a1[_0x1cab('0x38')]=_0x3097a1['attributes'][_0x1cab('0x3b')]?_0x3097a1[_0x1cab('0x38')]:_0x5c7155[_0x1cab('0x35')];if(!_0x472039[_0x1cab('0x36')][_0x1cab('0x3c')](_0x1cab('0x3d'))){_0x3097a1[_0x1cab('0x21')]=qs[_0x1cab('0x21')](_0x472039[_0x1cab('0x36')][_0x1cab('0x21')]);_0x3097a1[_0x1cab('0x3e')]=qs['offset'](_0x472039[_0x1cab('0x36')][_0x1cab('0x3e')]);}_0x3097a1[_0x1cab('0x3f')]=qs[_0x1cab('0x40')](_0x472039[_0x1cab('0x36')]['sort']);_0x3097a1[_0x1cab('0x41')]=qs[_0x1cab('0x37')](_[_0x1cab('0x42')](_0x472039[_0x1cab('0x36')],_0x5c7155[_0x1cab('0x37')]));_0x3097a1['where'][_0x1cab('0x5f')]=_0x5b6877['id'];if(_0x472039[_0x1cab('0x36')][_0x1cab('0x43')]){_0x3097a1[_0x1cab('0x41')]=_[_0x1cab('0x44')](_0x3097a1[_0x1cab('0x41')],{'$or':_[_0x1cab('0x2f')](_0x3097a1['attributes'],function(_0x264154){var _0x567b4d={};_0x567b4d[_0x264154]={'$like':'%'+_0x472039[_0x1cab('0x36')][_0x1cab('0x43')]+'%'};return _0x567b4d;})});}_0x3097a1=_[_0x1cab('0x44')]({},_0x3097a1,_0x472039[_0x1cab('0x45')]);return db[_0x1cab('0x64')]['count']({'where':_0x3097a1[_0x1cab('0x41')]})[_0x1cab('0x25')](function(_0x3057f5){_0x12b82d[_0x1cab('0x20')]=_0x3057f5;if(_0x472039['query'][_0x1cab('0x46')]){_0x3097a1['include']=[{'all':!![]}];}return db[_0x1cab('0x64')]['findAll'](_0x3097a1);})['then'](function(_0x217b0e){_0x12b82d[_0x1cab('0x49')]=_0x217b0e;return _0x12b82d;});}})[_0x1cab('0x25')](respondWithFilteredResult(_0x14a731,_0x3097a1))['catch'](handleError(_0x14a731,null));};exports['getLists']=function(_0x32538b,_0x243cee,_0x2a0f56){var _0x356005={};var _0x41c2ab={};var _0x40e0d1;var _0x267fd7;return db[_0x1cab('0x30')][_0x1cab('0x5d')]({'where':{'id':_0x32538b[_0x1cab('0x54')]['id']}})['then'](handleEntityNotFound(_0x243cee,null))[_0x1cab('0x25')](function(_0x18399c){if(_0x18399c){_0x40e0d1=_0x18399c;_0x41c2ab[_0x1cab('0x35')]=_[_0x1cab('0x4b')](db[_0x1cab('0x65')][_0x1cab('0x31')]);_0x41c2ab[_0x1cab('0x36')]=_[_0x1cab('0x4b')](_0x32538b[_0x1cab('0x36')]);_0x41c2ab['filters']=_[_0x1cab('0x39')](_0x41c2ab[_0x1cab('0x35')],_0x41c2ab[_0x1cab('0x36')]);_0x356005[_0x1cab('0x38')]=_[_0x1cab('0x39')](_0x41c2ab['model'],qs[_0x1cab('0x3a')](_0x32538b[_0x1cab('0x36')][_0x1cab('0x3a')]));_0x356005['attributes']=_0x356005[_0x1cab('0x38')][_0x1cab('0x3b')]?_0x356005[_0x1cab('0x38')]:_0x41c2ab['model'];_0x356005[_0x1cab('0x3f')]=qs[_0x1cab('0x40')](_0x32538b['query'][_0x1cab('0x40')]);_0x356005['where']=qs['filters'](_[_0x1cab('0x42')](_0x32538b[_0x1cab('0x36')],_0x41c2ab[_0x1cab('0x37')]));if(_0x32538b['query'][_0x1cab('0x43')]){_0x356005[_0x1cab('0x41')]=_['merge'](_0x356005[_0x1cab('0x41')],{'$or':_[_0x1cab('0x2f')](_0x356005[_0x1cab('0x38')],function(_0x37dc3d){var _0x21daa4={};_0x21daa4[_0x37dc3d]={'$like':'%'+_0x32538b[_0x1cab('0x36')]['filter']+'%'};return _0x21daa4;})});}_0x356005=_['merge']({},_0x356005,_0x32538b[_0x1cab('0x45')]);return _0x40e0d1[_0x1cab('0x66')](_0x356005);}})[_0x1cab('0x25')](function(_0x4b793b){if(_0x4b793b){_0x267fd7=_0x4b793b['length'];if(!_0x32538b[_0x1cab('0x36')]['hasOwnProperty'](_0x1cab('0x3d'))){_0x356005[_0x1cab('0x21')]=qs[_0x1cab('0x21')](_0x32538b[_0x1cab('0x36')][_0x1cab('0x21')]);_0x356005['offset']=qs[_0x1cab('0x3e')](_0x32538b[_0x1cab('0x36')][_0x1cab('0x3e')]);}return _0x40e0d1['getLists'](_0x356005);}})['then'](function(_0x577a00){if(_0x577a00){return _0x577a00?{'count':_0x267fd7,'rows':_0x577a00}:null;}})[_0x1cab('0x25')](respondWithResult(_0x243cee,null))[_0x1cab('0x4a')](handleError(_0x243cee,null));};exports[_0x1cab('0x67')]=function(_0x8f4e88,_0x23f1ef,_0x2f3af3){var _0x16df0f,_0x5eeb65;return db[_0x1cab('0x30')][_0x1cab('0x4c')]({'where':{'id':_0x8f4e88['params']['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0x23f1ef,null))[_0x1cab('0x25')](function(_0x334a27){if(_0x334a27){_0x5eeb65=_0x334a27;return _0x334a27[_0x1cab('0x67')](_0x8f4e88[_0x1cab('0x4e')][_0x1cab('0x68')],_[_0x1cab('0x57')](_0x8f4e88[_0x1cab('0x4e')],[_0x1cab('0x68'),'id'])||{});}return null;})[_0x1cab('0x69')](function(_0x27bd3d){var _0x3bda49;_0x16df0f=_0x27bd3d||[];var _0x2b0e85=[];if(_0x27bd3d){for(var _0x295289=0x0;_0x295289<_0x27bd3d[_0x1cab('0x3b')];_0x295289+=0x1){var _0x6bf582=_0x27bd3d[_0x295289]['get']({'plain':!![]});_0x5eeb65[_0x1cab('0x6a')]=_0x8f4e88['body'][_0x1cab('0x6a')]?_0x8f4e88[_0x1cab('0x4e')]['dialCheckDuplicateType']:_0x5eeb65[_0x1cab('0x6a')];switch(_0x5eeb65[_0x1cab('0x6a')]){case _0x1cab('0x6b'):_0x3bda49=squel[_0x1cab('0x6c')]()[_0x1cab('0x6d')](_0x1cab('0x6e'))['fromQuery']([_0x1cab('0x6f'),_0x1cab('0x70'),_0x1cab('0x71'),_0x1cab('0x72'),'CampaignId',_0x1cab('0x55'),_0x1cab('0x56')],squel['select']()[_0x1cab('0x73')](_0x1cab('0x6f'),_0x1cab('0x6f'))[_0x1cab('0x73')](_0x1cab('0x74'),_0x1cab('0x70'))['field']('id','ContactId')[_0x1cab('0x73')](_0x6bf582[_0x1cab('0x75')][_0x1cab('0x76')](),'ListId')[_0x1cab('0x73')](_0x8f4e88['params']['id'][_0x1cab('0x76')](),_0x1cab('0x5f'))['field']('NOW()',_0x1cab('0x55'))[_0x1cab('0x73')](_0x1cab('0x74'),'updatedAt')[_0x1cab('0x77')](_0x1cab('0x78'))['where']('deletedAt\x20IS\x20NULL')[_0x1cab('0x41')](_0x1cab('0x79'),_0x6bf582['CmListId'][_0x1cab('0x76')]())['where'](_0x1cab('0x7a'))[_0x1cab('0x41')](_0x1cab('0x7b'),squel['select']()[_0x1cab('0x73')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')['where'](_0x1cab('0x7c'),_0x8f4e88['params']['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cab('0x7d')]()[_0x1cab('0x73')](_0x1cab('0x7e'))[_0x1cab('0x77')](_0x1cab('0x6e'))[_0x1cab('0x41')](_0x1cab('0x7c'),_0x8f4e88['params']['id']['toString']())))[_0x1cab('0x76')]();break;case _0x1cab('0x7f'):_0x3bda49=squel['insert']()[_0x1cab('0x6d')](_0x1cab('0x6e'))[_0x1cab('0x80')]([_0x1cab('0x6f'),'scheduledAt',_0x1cab('0x71'),_0x1cab('0x72'),_0x1cab('0x5f'),'createdAt',_0x1cab('0x56')],squel[_0x1cab('0x7d')]()['field'](_0x1cab('0x6f'),'phone')[_0x1cab('0x73')](_0x1cab('0x74'),_0x1cab('0x70'))[_0x1cab('0x73')]('id',_0x1cab('0x71'))[_0x1cab('0x73')](_0x6bf582['CmListId'][_0x1cab('0x76')](),_0x1cab('0x72'))[_0x1cab('0x73')](_0x8f4e88[_0x1cab('0x54')]['id'][_0x1cab('0x76')](),_0x1cab('0x5f'))[_0x1cab('0x73')](_0x1cab('0x74'),_0x1cab('0x55'))[_0x1cab('0x73')](_0x1cab('0x74'),_0x1cab('0x56'))[_0x1cab('0x77')](_0x1cab('0x78'))['where'](_0x1cab('0x81'))[_0x1cab('0x41')]('ListId\x20=\x20?',_0x6bf582[_0x1cab('0x75')]['toString']())[_0x1cab('0x41')](_0x1cab('0x7a'))[_0x1cab('0x41')](_0x1cab('0x7b'),squel[_0x1cab('0x7d')]()[_0x1cab('0x73')](_0x1cab('0x7e'))[_0x1cab('0x77')]('cm_hopper')[_0x1cab('0x41')](_0x1cab('0x7c'),_0x8f4e88[_0x1cab('0x54')]['id'][_0x1cab('0x76')]())))[_0x1cab('0x76')]();break;default:_0x3bda49=squel[_0x1cab('0x6c')]()[_0x1cab('0x6d')](_0x1cab('0x6e'))[_0x1cab('0x80')]([_0x1cab('0x6f'),_0x1cab('0x70'),_0x1cab('0x71'),_0x1cab('0x72'),_0x1cab('0x5f'),_0x1cab('0x55'),_0x1cab('0x56')],squel[_0x1cab('0x7d')]()[_0x1cab('0x73')](_0x1cab('0x6f'),_0x1cab('0x6f'))[_0x1cab('0x73')](_0x1cab('0x74'),_0x1cab('0x70'))[_0x1cab('0x73')]('id',_0x1cab('0x71'))[_0x1cab('0x73')](_0x6bf582[_0x1cab('0x75')][_0x1cab('0x76')](),_0x1cab('0x72'))[_0x1cab('0x73')](_0x8f4e88[_0x1cab('0x54')]['id'][_0x1cab('0x76')](),_0x1cab('0x5f'))[_0x1cab('0x73')](_0x1cab('0x74'),_0x1cab('0x55'))[_0x1cab('0x73')]('NOW()',_0x1cab('0x56'))['from'](_0x1cab('0x78'))[_0x1cab('0x41')]('deletedAt\x20IS\x20NULL')[_0x1cab('0x41')](_0x1cab('0x79'),_0x6bf582[_0x1cab('0x75')][_0x1cab('0x76')]())[_0x1cab('0x41')](_0x1cab('0x7a')))[_0x1cab('0x76')]();}_0x2b0e85[_0x1cab('0x82')](db[_0x1cab('0x83')][_0x1cab('0x36')](_0x3bda49));}return BPromise[_0x1cab('0x84')](_0x2b0e85);}})[_0x1cab('0x25')](function(){return _0x16df0f;})[_0x1cab('0x25')](respondWithResult(_0x23f1ef,null))[_0x1cab('0x4a')](handleError(_0x23f1ef,null));};exports['removeLists']=function(_0x5ae576,_0x5ebf84,_0xa3a353){return db['Campaign'][_0x1cab('0x4c')]({'where':{'id':_0x5ae576['params']['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0x5ebf84,null))['then'](function(_0x35982c){if(_0x35982c){return _0x35982c[_0x1cab('0x85')](_0x5ae576[_0x1cab('0x36')]['ids']);}})[_0x1cab('0x25')](function(_0x551962){if(_0x551962){return db[_0x1cab('0x5e')][_0x1cab('0x29')]({'where':{'ListId':_0x5ae576['query'][_0x1cab('0x68')],'CampaignId':_0x5ae576[_0x1cab('0x54')]['id']}})[_0x1cab('0x25')](function(){return _0x551962;});}})['then'](respondWithStatusCode(_0x5ebf84,null))[_0x1cab('0x4a')](handleError(_0x5ebf84,null));};exports[_0x1cab('0x86')]=function(_0x53a404,_0x50bfc4,_0xc2a970){var _0x3f5c8d={};var _0x3bbfaa={};var _0x1c7806;var _0x14a320;return db[_0x1cab('0x30')][_0x1cab('0x5d')]({'where':{'id':_0x53a404['params']['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0x50bfc4,null))[_0x1cab('0x25')](function(_0x16080a){if(_0x16080a){_0x1c7806=_0x16080a;_0x3bbfaa[_0x1cab('0x35')]=_[_0x1cab('0x4b')](db[_0x1cab('0x65')][_0x1cab('0x31')]);_0x3bbfaa[_0x1cab('0x36')]=_[_0x1cab('0x4b')](_0x53a404['query']);_0x3bbfaa[_0x1cab('0x37')]=_[_0x1cab('0x39')](_0x3bbfaa[_0x1cab('0x35')],_0x3bbfaa[_0x1cab('0x36')]);_0x3f5c8d[_0x1cab('0x38')]=_[_0x1cab('0x39')](_0x3bbfaa[_0x1cab('0x35')],qs[_0x1cab('0x3a')](_0x53a404[_0x1cab('0x36')][_0x1cab('0x3a')]));_0x3f5c8d[_0x1cab('0x38')]=_0x3f5c8d[_0x1cab('0x38')][_0x1cab('0x3b')]?_0x3f5c8d[_0x1cab('0x38')]:_0x3bbfaa[_0x1cab('0x35')];_0x3f5c8d[_0x1cab('0x3f')]=qs['sort'](_0x53a404[_0x1cab('0x36')][_0x1cab('0x40')]);_0x3f5c8d[_0x1cab('0x41')]=qs[_0x1cab('0x37')](_['pick'](_0x53a404[_0x1cab('0x36')],_0x3bbfaa[_0x1cab('0x37')]));if(_0x53a404[_0x1cab('0x36')][_0x1cab('0x43')]){_0x3f5c8d[_0x1cab('0x41')]=_['merge'](_0x3f5c8d['where'],{'$or':_[_0x1cab('0x2f')](_0x3f5c8d[_0x1cab('0x38')],function(_0x28ac8e){var _0x27852f={};_0x27852f[_0x28ac8e]={'$like':'%'+_0x53a404[_0x1cab('0x36')][_0x1cab('0x43')]+'%'};return _0x27852f;})});}_0x3f5c8d=_[_0x1cab('0x44')]({},_0x3f5c8d,_0x53a404[_0x1cab('0x45')]);return _0x1c7806['getBlackLists'](_0x3f5c8d);}})[_0x1cab('0x25')](function(_0x27d3){if(_0x27d3){_0x14a320=_0x27d3[_0x1cab('0x3b')];if(!_0x53a404[_0x1cab('0x36')][_0x1cab('0x3c')](_0x1cab('0x3d'))){_0x3f5c8d['limit']=qs[_0x1cab('0x21')](_0x53a404[_0x1cab('0x36')][_0x1cab('0x21')]);_0x3f5c8d['offset']=qs[_0x1cab('0x3e')](_0x53a404[_0x1cab('0x36')]['offset']);}return _0x1c7806[_0x1cab('0x86')](_0x3f5c8d);}})[_0x1cab('0x25')](function(_0x13d64f){if(_0x13d64f){return _0x13d64f?{'count':_0x14a320,'rows':_0x13d64f}:null;}})[_0x1cab('0x25')](respondWithResult(_0x50bfc4,null))[_0x1cab('0x4a')](handleError(_0x50bfc4,null));};exports[_0x1cab('0x87')]=function(_0xd2feff,_0x166d61,_0x8f89b){var _0x5b5539,_0x2dffc7;return db[_0x1cab('0x30')][_0x1cab('0x4c')]({'where':{'id':_0xd2feff['params']['id']}})[_0x1cab('0x25')](handleEntityNotFound(_0x166d61,null))[_0x1cab('0x25')](function(_0x504eb1){if(_0x504eb1){_0x2dffc7=_0x504eb1;return _0x504eb1[_0x1cab('0x87')](_0xd2feff[_0x1cab('0x4e')][_0x1cab('0x68')],_[_0x1cab('0x57')](_0xd2feff[_0x1cab('0x4e')],['ids','id'])||{});}return null;})[_0x1cab('0x69')](function(_0x1818dc){var _0x4bf483;_0x5b5539=_0x1818dc||[];var _0x31a57e=[];if(_0x1818dc){for(var _0x51ba31=0x0;_0x51ba31<_0x1818dc[_0x1cab('0x3b')];_0x51ba31+=0x1){var _0x3aec1a=_0x1818dc[_0x51ba31][_0x1cab('0x26')]({'plain':!![]});_0x4bf483=squel[_0x1cab('0x6c')]()[_0x1cab('0x6d')](_0x1cab('0x88'))['fromQuery'](['phone',_0x1cab('0x71'),_0x1cab('0x72'),'CampaignId','createdAt',_0x1cab('0x56')],squel['select']()[_0x1cab('0x73')](_0x1cab('0x6f'),_0x1cab('0x6f'))[_0x1cab('0x73')]('id',_0x1cab('0x71'))[_0x1cab('0x73')](_0x3aec1a[_0x1cab('0x75')][_0x1cab('0x76')](),_0x1cab('0x72'))[_0x1cab('0x73')](_0xd2feff['params']['id'][_0x1cab('0x76')](),_0x1cab('0x5f'))[_0x1cab('0x73')](_0x1cab('0x74'),'createdAt')[_0x1cab('0x73')](_0x1cab('0x74'),_0x1cab('0x56'))[_0x1cab('0x77')](_0x1cab('0x78'))[_0x1cab('0x41')](_0x1cab('0x81'))['where'](_0x1cab('0x79'),_0x3aec1a[_0x1cab('0x75')][_0x1cab('0x76')]())[_0x1cab('0x41')](_0x1cab('0x7a')))[_0x1cab('0x76')]();_0x31a57e[_0x1cab('0x82')](db[_0x1cab('0x83')]['query'](_0x4bf483));}return BPromise[_0x1cab('0x84')](_0x31a57e);}})[_0x1cab('0x25')](function(){return _0x5b5539;})[_0x1cab('0x25')](respondWithResult(_0x166d61,null))[_0x1cab('0x4a')](handleError(_0x166d61,null));};exports[_0x1cab('0x89')]=function(_0x416144,_0x9c746a,_0x47e487){return db[_0x1cab('0x30')]['find']({'where':{'id':_0x416144[_0x1cab('0x54')]['id']}})['then'](handleEntityNotFound(_0x9c746a,null))['then'](function(_0x44f90f){if(_0x44f90f){return _0x44f90f[_0x1cab('0x89')](_0x416144[_0x1cab('0x36')][_0x1cab('0x68')]);}})['then'](function(_0x417a17){if(_0x417a17){return db[_0x1cab('0x64')]['destroy']({'where':{'ListId':_0x416144['query'][_0x1cab('0x68')],'CampaignId':_0x416144['params']['id']}})[_0x1cab('0x25')](function(){return _0x417a17;});}})[_0x1cab('0x25')](respondWithStatusCode(_0x9c746a,null))[_0x1cab('0x4a')](handleError(_0x9c746a,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 760afea..8a1ecd0 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 _0x9707=['api','moment','bluebird','rimraf','../../config/environment','./campaign.attributes','Campaign','campaigns','lodash','util'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x9707,0x76));var _0x7970=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9707[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7970('0x0'));var util=require(_0x7970('0x1'));var logger=require('../../config/logger')(_0x7970('0x2'));var moment=require(_0x7970('0x3'));var BPromise=require(_0x7970('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7970('0x5'));var config=require(_0x7970('0x6'));var attributes=require(_0x7970('0x7'));module['exports']=function(_0x167da6,_0x5119a9){return _0x167da6['define'](_0x7970('0x8'),attributes,{'tableName':_0x7970('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde19=['rimraf','exports','define','Campaign','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4fe777,_0x40dec8){var _0x2a3437=function(_0x4efe76){while(--_0x4efe76){_0x4fe777['push'](_0x4fe777['shift']());}};_0x2a3437(++_0x40dec8);}(_0xde19,0xb8));var _0x9de1=function(_0x48bb44,_0x15d56f){_0x48bb44=_0x48bb44-0x0;var _0x2c4261=_0xde19[_0x48bb44];return _0x2c4261;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9de1('0x0'))('api');var moment=require(_0x9de1('0x1'));var BPromise=require(_0x9de1('0x2'));var rp=require(_0x9de1('0x3'));var fs=require('fs');var path=require(_0x9de1('0x4'));var rimraf=require(_0x9de1('0x5'));var config=require('../../config/environment');var attributes=require('./campaign.attributes');module[_0x9de1('0x6')]=function(_0x732c57,_0xfdb41d){return _0x732c57[_0x9de1('0x7')](_0x9de1('0x8'),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 ca072bc..ca6ed83 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x331a29,_0x53dbef){var _0x2da9ee=function(_0x4111d3){while(--_0x4111d3){_0x331a29['push'](_0x331a29['shift']());}};_0x2da9ee(++_0x53dbef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x5a8ae5,_0x4cc122){var _0x1e8f73=function(_0x496f86){while(--_0x496f86){_0x5a8ae5['push'](_0x5a8ae5['shift']());}};_0x1e8f73(++_0x4cc122);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 91a4abb..4403da0 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 _0x9169=['index','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','/:id','update','destroy','delete','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x9169,0xb3));var _0x9916=function(_0xd036b9,_0x3aa8e1){_0xd036b9=_0xd036b9-0x0;var _0x532634=_0x9169[_0xd036b9];return _0x532634;};'use strict';var multer=require(_0x9916('0x0'));var util=require('util');var path=require(_0x9916('0x1'));var timeout=require(_0x9916('0x2'));var express=require(_0x9916('0x3'));var router=express['Router']();var fs_extra=require(_0x9916('0x4'));var auth=require(_0x9916('0x5'));var interaction=require(_0x9916('0x6'));var config=require(_0x9916('0x7'));var controller=require(_0x9916('0x8'));router[_0x9916('0x9')]('/',auth[_0x9916('0xa')](),controller[_0x9916('0xb')]);router[_0x9916('0x9')]('/:id',auth[_0x9916('0xa')](),controller['show']);router['get'](_0x9916('0xc'),auth[_0x9916('0xa')](),controller[_0x9916('0xd')]);router[_0x9916('0x9')](_0x9916('0xe'),auth[_0x9916('0xa')](),controller[_0x9916('0xf')]);router['get'](_0x9916('0x10'),auth[_0x9916('0xa')](),controller[_0x9916('0x11')]);router['get'](_0x9916('0x12'),auth[_0x9916('0xa')](),controller[_0x9916('0x13')]);router['get'](_0x9916('0x14'),auth[_0x9916('0xa')](),controller[_0x9916('0x15')]);router[_0x9916('0x9')]('/:id/blacklists',auth[_0x9916('0xa')](),controller[_0x9916('0x16')]);router['post']('/',auth[_0x9916('0xa')](),controller[_0x9916('0x17')]);router[_0x9916('0x18')](_0x9916('0x19'),auth[_0x9916('0xa')](),controller[_0x9916('0x1a')]);router['post'](_0x9916('0x14'),auth[_0x9916('0xa')](),controller[_0x9916('0x1b')]);router[_0x9916('0x18')](_0x9916('0x1c'),auth['isAuthenticated'](),controller[_0x9916('0x1d')]);router[_0x9916('0x1e')](_0x9916('0x1f'),auth[_0x9916('0xa')](),controller[_0x9916('0x20')]);router['delete'](_0x9916('0x1f'),auth[_0x9916('0xa')](),controller[_0x9916('0x21')]);router[_0x9916('0x22')]('/:id/lists',auth[_0x9916('0xa')](),controller[_0x9916('0x23')]);router[_0x9916('0x22')]('/:id/blacklists',auth[_0x9916('0xa')](),controller[_0x9916('0x24')]);module[_0x9916('0x25')]=router; \ No newline at end of file +var _0xa336=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','util','express'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0xa336,0x67));var _0x6a33=function(_0x19a93f,_0x48b6e5){_0x19a93f=_0x19a93f-0x0;var _0x5dea5e=_0xa336[_0x19a93f];return _0x5dea5e;};'use strict';var multer=require('multer');var util=require(_0x6a33('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a33('0x1'));var router=express[_0x6a33('0x2')]();var fs_extra=require(_0x6a33('0x3'));var auth=require(_0x6a33('0x4'));var interaction=require(_0x6a33('0x5'));var config=require(_0x6a33('0x6'));var controller=require(_0x6a33('0x7'));router[_0x6a33('0x8')]('/',auth[_0x6a33('0x9')](),controller[_0x6a33('0xa')]);router[_0x6a33('0x8')](_0x6a33('0xb'),auth[_0x6a33('0x9')](),controller[_0x6a33('0xc')]);router['get'](_0x6a33('0xd'),auth[_0x6a33('0x9')](),controller[_0x6a33('0xe')]);router['get'](_0x6a33('0xf'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x10')]);router['get']('/:id/hopper_finals',auth[_0x6a33('0x9')](),controller[_0x6a33('0x11')]);router['get'](_0x6a33('0x12'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x13')]);router['get'](_0x6a33('0x14'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x15')]);router['get']('/:id/blacklists',auth[_0x6a33('0x9')](),controller['getBlackLists']);router[_0x6a33('0x16')]('/',auth[_0x6a33('0x9')](),controller[_0x6a33('0x17')]);router[_0x6a33('0x16')](_0x6a33('0x18'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x19')]);router[_0x6a33('0x16')](_0x6a33('0x14'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x1a')]);router[_0x6a33('0x16')](_0x6a33('0x1b'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x1c')]);router['put'](_0x6a33('0xb'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x1d')]);router[_0x6a33('0x1e')](_0x6a33('0xb'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x1f')]);router[_0x6a33('0x1e')](_0x6a33('0x14'),auth[_0x6a33('0x9')](),controller[_0x6a33('0x20')]);router[_0x6a33('0x1e')]('/:id/blacklists',auth[_0x6a33('0x9')](),controller[_0x6a33('0x21')]);module[_0x6a33('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c2acdf1..627d5bc 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 _0x10c6=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x10c6,0x1de));var _0x610c=function(_0x159981,_0x28fd7d){_0x159981=_0x159981-0x0;var _0x117e96=_0x10c6[_0x159981];return _0x117e96;};'use strict';var Sequelize=require(_0x610c('0x0'));module[_0x610c('0x1')]={'key':{'type':Sequelize[_0x610c('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x610c('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x610c('0x2')]},'name':{'type':Sequelize[_0x610c('0x4')],'get':function(){return this[_0x610c('0x5')](_0x610c('0x6'));}}}; \ No newline at end of file +var _0x7a7a=['getDataValue','key','exports','STRING'];(function(_0x1645af,_0x2e1da4){var _0x5a6bd1=function(_0x1cb766){while(--_0x1cb766){_0x1645af['push'](_0x1645af['shift']());}};_0x5a6bd1(++_0x2e1da4);}(_0x7a7a,0x116));var _0xa7a7=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x7a7a[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require('sequelize');module[_0xa7a7('0x0')]={'key':{'type':Sequelize[_0xa7a7('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xa7a7('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa7a7('0x2')](_0xa7a7('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 65141c6..6f2141c 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 _0x0ac0=['attributes','length','limit','order','sort','where','pick','filter','merge','type','count','includeAll','include','findAll','rows','catch','show','params','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CannedAnswers','end','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ac0,0x7c));var _0x00ac=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0x0ac0[_0x3ae2b2];return _0x1dbf00;};'use strict';var pdf=require(_0x00ac('0x0'));var emlformat=require(_0x00ac('0x1'));var rimraf=require(_0x00ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00ac('0x3'));var rp=require(_0x00ac('0x4'));var moment=require(_0x00ac('0x5'));var BPromise=require(_0x00ac('0x6'));var Mustache=require(_0x00ac('0x7'));var util=require('util');var path=require('path');var sox=require(_0x00ac('0x8'));var csv=require(_0x00ac('0x9'));var ejs=require(_0x00ac('0xa'));var fs=require('fs');var fs_extra=require(_0x00ac('0xb'));var _=require(_0x00ac('0xc'));var squel=require(_0x00ac('0xd'));var crypto=require(_0x00ac('0xe'));var jsforce=require(_0x00ac('0xf'));var deskjs=require(_0x00ac('0x10'));var toCsv=require(_0x00ac('0x9'));var querystring=require('querystring');var Papa=require(_0x00ac('0x11'));var Redis=require(_0x00ac('0x12'));var authService=require(_0x00ac('0x13'));var qs=require(_0x00ac('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x00ac('0x15'))(_0x00ac('0x16'));var utils=require(_0x00ac('0x17'));var config=require(_0x00ac('0x18'));var licenseUtil=require(_0x00ac('0x19'));var db=require(_0x00ac('0x1a'))['db'];function respondWithStatusCode(_0x40684d,_0x2e71f4){_0x2e71f4=_0x2e71f4||0xcc;return function(_0x53dd8a){if(_0x53dd8a){return _0x40684d['sendStatus'](_0x2e71f4);}return _0x40684d[_0x00ac('0x1b')](_0x2e71f4)['end']();};}function respondWithResult(_0xd54508,_0x5b7f1a){_0x5b7f1a=_0x5b7f1a||0xc8;return function(_0x4c077a){if(_0x4c077a){return _0xd54508['status'](_0x5b7f1a)['json'](_0x4c077a);}};}function respondWithFilteredResult(_0x566f37,_0x43b988){return function(_0x4e0414){if(_0x4e0414){var _0x142f19=_0x4e0414['count'],_0x5c3e8b=_0x43b988[_0x00ac('0x1c')],_0x906f29=_0x43b988[_0x00ac('0x1c')]+_0x43b988['limit'],_0x51bd00;if(_0x906f29>=_0x142f19){_0x906f29=_0x142f19;_0x51bd00=0xc8;}else{_0x51bd00=0xce;}_0x566f37[_0x00ac('0x1b')](_0x51bd00);return _0x566f37[_0x00ac('0x1d')](_0x00ac('0x1e'),_0x5c3e8b+'-'+_0x906f29+'/'+_0x142f19)[_0x00ac('0x1f')](_0x4e0414);}return null;};}function patchUpdates(_0x40a080){return function(_0x4348ba){try{jsonpatch[_0x00ac('0x20')](_0x4348ba,_0x40a080,!![]);}catch(_0x1aee01){return BPromise[_0x00ac('0x21')](_0x1aee01);}return _0x4348ba[_0x00ac('0x22')]();};}function saveUpdates(_0x1d1ba3,_0x172a64){return function(_0x1939de){if(_0x1939de){return _0x1939de[_0x00ac('0x23')](_0x1d1ba3)[_0x00ac('0x24')](function(_0x38ab7f){return _0x38ab7f;});}return null;};}function removeEntity(_0x3492bd,_0x20b531){return function(_0x4ea68d){if(_0x4ea68d){return _0x4ea68d[_0x00ac('0x25')]()[_0x00ac('0x24')](function(){var _0x12faf9=_0x4ea68d[_0x00ac('0x26')]({'plain':!![]});var _0x3c51ee=_0x00ac('0x27');return db['UserProfileResource'][_0x00ac('0x25')]({'where':{'type':_0x3c51ee,'resourceId':_0x12faf9['id']}})[_0x00ac('0x24')](function(){return _0x4ea68d;});})[_0x00ac('0x24')](function(){_0x3492bd[_0x00ac('0x1b')](0xcc)[_0x00ac('0x28')]();});}};}function handleEntityNotFound(_0x1099a2,_0x194f8d){return function(_0xde1fbe){if(!_0xde1fbe){_0x1099a2['sendStatus'](0x194);}return _0xde1fbe;};}function handleError(_0x3320a8,_0xc290af){_0xc290af=_0xc290af||0x1f4;return function(_0xcfb13f){logger[_0x00ac('0x29')](_0xcfb13f[_0x00ac('0x2a')]);if(_0xcfb13f[_0x00ac('0x2b')]){delete _0xcfb13f[_0x00ac('0x2b')];}_0x3320a8['status'](_0xc290af)[_0x00ac('0x2c')](_0xcfb13f);};}exports['index']=function(_0xb1c3f9,_0x35db0a){var _0x3184bb={},_0x51fc08={},_0x3fa69b={'count':0x0,'rows':[]};var _0x56bc7f=_[_0x00ac('0x2d')](db[_0x00ac('0x2e')][_0x00ac('0x2f')],function(_0x20e188){return{'name':_0x20e188[_0x00ac('0x30')],'type':_0x20e188['type'][_0x00ac('0x31')]};});_0x51fc08['model']=_[_0x00ac('0x2d')](_0x56bc7f,_0x00ac('0x2b'));_0x51fc08[_0x00ac('0x32')]=_[_0x00ac('0x33')](_0xb1c3f9['query']);_0x51fc08[_0x00ac('0x34')]=_[_0x00ac('0x35')](_0x51fc08[_0x00ac('0x36')],_0x51fc08[_0x00ac('0x32')]);_0x3184bb['attributes']=_[_0x00ac('0x35')](_0x51fc08[_0x00ac('0x36')],qs['fields'](_0xb1c3f9[_0x00ac('0x32')][_0x00ac('0x37')]));_0x3184bb[_0x00ac('0x38')]=_0x3184bb[_0x00ac('0x38')][_0x00ac('0x39')]?_0x3184bb['attributes']:_0x51fc08[_0x00ac('0x36')];if(!_0xb1c3f9['query']['hasOwnProperty']('nolimit')){_0x3184bb[_0x00ac('0x3a')]=qs[_0x00ac('0x3a')](_0xb1c3f9[_0x00ac('0x32')][_0x00ac('0x3a')]);_0x3184bb['offset']=qs[_0x00ac('0x1c')](_0xb1c3f9[_0x00ac('0x32')][_0x00ac('0x1c')]);}_0x3184bb[_0x00ac('0x3b')]=qs[_0x00ac('0x3c')](_0xb1c3f9[_0x00ac('0x32')]['sort']);_0x3184bb[_0x00ac('0x3d')]=qs[_0x00ac('0x34')](_[_0x00ac('0x3e')](_0xb1c3f9['query'],_0x51fc08[_0x00ac('0x34')]),_0x56bc7f);if(_0xb1c3f9[_0x00ac('0x32')][_0x00ac('0x3f')]){_0x3184bb[_0x00ac('0x3d')]=_[_0x00ac('0x40')](_0x3184bb['where'],{'$or':_[_0x00ac('0x2d')](_0x56bc7f,function(_0x31d400){if(_0x31d400[_0x00ac('0x41')]!=='VIRTUAL'){var _0x2004b7={};_0x2004b7[_0x31d400[_0x00ac('0x2b')]]={'$like':'%'+_0xb1c3f9[_0x00ac('0x32')][_0x00ac('0x3f')]+'%'};return _0x2004b7;}})});}_0x3184bb=_[_0x00ac('0x40')]({},_0x3184bb,_0xb1c3f9['options']);var _0x5dc354={'where':_0x3184bb['where']};return db[_0x00ac('0x2e')][_0x00ac('0x42')](_0x5dc354)['then'](function(_0x261aa9){_0x3fa69b[_0x00ac('0x42')]=_0x261aa9;if(_0xb1c3f9[_0x00ac('0x32')][_0x00ac('0x43')]){_0x3184bb[_0x00ac('0x44')]=[{'all':!![]}];}return db[_0x00ac('0x2e')][_0x00ac('0x45')](_0x3184bb);})[_0x00ac('0x24')](function(_0x3639b3){_0x3fa69b[_0x00ac('0x46')]=_0x3639b3;return _0x3fa69b;})[_0x00ac('0x24')](respondWithFilteredResult(_0x35db0a,_0x3184bb))[_0x00ac('0x47')](handleError(_0x35db0a,null));};exports[_0x00ac('0x48')]=function(_0x21f68c,_0x2f593d){var _0x533fe8={'raw':!![],'where':{'id':_0x21f68c[_0x00ac('0x49')]['id']}},_0xcab6c4={};_0xcab6c4[_0x00ac('0x36')]=_[_0x00ac('0x33')](db[_0x00ac('0x2e')][_0x00ac('0x2f')]);_0xcab6c4[_0x00ac('0x32')]=_[_0x00ac('0x33')](_0x21f68c[_0x00ac('0x32')]);_0xcab6c4[_0x00ac('0x34')]=_[_0x00ac('0x35')](_0xcab6c4[_0x00ac('0x36')],_0xcab6c4['query']);_0x533fe8['attributes']=_['intersection'](_0xcab6c4[_0x00ac('0x36')],qs[_0x00ac('0x37')](_0x21f68c[_0x00ac('0x32')][_0x00ac('0x37')]));_0x533fe8[_0x00ac('0x38')]=_0x533fe8[_0x00ac('0x38')][_0x00ac('0x39')]?_0x533fe8[_0x00ac('0x38')]:_0xcab6c4[_0x00ac('0x36')];if(_0x21f68c[_0x00ac('0x32')]['includeAll']){_0x533fe8['include']=[{'all':!![]}];}_0x533fe8=_['merge']({},_0x533fe8,_0x21f68c[_0x00ac('0x4a')]);return db[_0x00ac('0x2e')]['find'](_0x533fe8)['then'](handleEntityNotFound(_0x2f593d,null))[_0x00ac('0x24')](respondWithResult(_0x2f593d,null))[_0x00ac('0x47')](handleError(_0x2f593d,null));};exports['update']=function(_0x58f2ac,_0x285dc8){if(_0x58f2ac['body']['id']){delete _0x58f2ac[_0x00ac('0x4b')]['id'];}return db[_0x00ac('0x2e')][_0x00ac('0x4c')]({'where':{'id':_0x58f2ac[_0x00ac('0x49')]['id']}})['then'](handleEntityNotFound(_0x285dc8,null))[_0x00ac('0x24')](saveUpdates(_0x58f2ac[_0x00ac('0x4b')],null))[_0x00ac('0x24')](respondWithResult(_0x285dc8,null))[_0x00ac('0x47')](handleError(_0x285dc8,null));};exports[_0x00ac('0x25')]=function(_0x3cb891,_0x46b0c2){return db[_0x00ac('0x2e')][_0x00ac('0x4c')]({'where':{'id':_0x3cb891[_0x00ac('0x49')]['id']}})[_0x00ac('0x24')](handleEntityNotFound(_0x46b0c2,null))[_0x00ac('0x24')](removeEntity(_0x46b0c2,null))['catch'](handleError(_0x46b0c2,null));};exports[_0x00ac('0x4d')]=function(_0x4f87f7,_0x3d6942){var _0x156f67={'key':_0x4f87f7[_0x00ac('0x4b')]['key']};if(_0x4f87f7[_0x00ac('0x4b')][_0x00ac('0x4e')]){_0x156f67[_0x00ac('0x4e')]=_0x4f87f7[_0x00ac('0x4b')][_0x00ac('0x4e')];}else if(_0x4f87f7[_0x00ac('0x4b')][_0x00ac('0x4f')]){_0x156f67[_0x00ac('0x4f')]=_0x4f87f7[_0x00ac('0x4b')][_0x00ac('0x4f')];}else if(_0x4f87f7[_0x00ac('0x4b')][_0x00ac('0x50')]){_0x156f67[_0x00ac('0x50')]=_0x4f87f7[_0x00ac('0x4b')][_0x00ac('0x50')];}else if(_0x4f87f7[_0x00ac('0x4b')][_0x00ac('0x51')]){_0x156f67[_0x00ac('0x51')]=_0x4f87f7[_0x00ac('0x4b')][_0x00ac('0x51')];}return db[_0x00ac('0x2e')]['find']({'where':_0x156f67})[_0x00ac('0x24')](function(_0x30f8ee){if(_0x30f8ee){throw new db[(_0x00ac('0x52'))][(_0x00ac('0x53'))](_0x00ac('0x54'));}return db[_0x00ac('0x2e')][_0x00ac('0x4d')](_0x4f87f7[_0x00ac('0x4b')]);})['then'](function(_0x4cccb2){var _0x3da278=_0x4f87f7[_0x00ac('0x55')][_0x00ac('0x26')]({'plain':!![]});if(!_0x3da278)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3da278['role']==='user'){var _0x5d432f=_0x4cccb2[_0x00ac('0x26')]({'plain':!![]});return db[_0x00ac('0x56')][_0x00ac('0x4c')]({'where':{'name':'CannedAnswers','userProfileId':_0x3da278[_0x00ac('0x57')]},'raw':!![]})[_0x00ac('0x24')](function(_0x4cb5af){if(_0x4cb5af&&_0x4cb5af[_0x00ac('0x58')]===0x0){return db[_0x00ac('0x59')][_0x00ac('0x4d')]({'name':_0x5d432f['name'],'resourceId':_0x5d432f['id'],'type':_0x4cb5af[_0x00ac('0x2b')],'sectionId':_0x4cb5af['id']},{})[_0x00ac('0x24')](function(){return _0x4cccb2;});}else{return _0x4cccb2;}})[_0x00ac('0x47')](function(_0x321967){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x321967);throw _0x321967;});}return _0x4cccb2;})[_0x00ac('0x24')](respondWithResult(_0x3d6942,0xc9))[_0x00ac('0x47')](handleError(_0x3d6942,null));}; \ No newline at end of file +var _0xaf4f=['rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','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','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','limit','status','set','Content-Range','reject','save','update','then','get','CannedAnswers','UserProfileResource','end','name','send','map','CannedAnswer'];(function(_0x36368c,_0x464b85){var _0x1b2107=function(_0x11983a){while(--_0x11983a){_0x36368c['push'](_0x36368c['shift']());}};_0x1b2107(++_0x464b85);}(_0xaf4f,0xde));var _0xfaf4=function(_0x1e9c70,_0x368b6b){_0x1e9c70=_0x1e9c70-0x0;var _0x517ec3=_0xaf4f[_0x1e9c70];return _0x517ec3;};'use strict';var pdf=require(_0xfaf4('0x0'));var emlformat=require(_0xfaf4('0x1'));var rimraf=require(_0xfaf4('0x2'));var zipdir=require(_0xfaf4('0x3'));var jsonpatch=require(_0xfaf4('0x4'));var rp=require('request-promise');var moment=require(_0xfaf4('0x5'));var BPromise=require(_0xfaf4('0x6'));var Mustache=require(_0xfaf4('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfaf4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfaf4('0x9'));var _=require(_0xfaf4('0xa'));var squel=require(_0xfaf4('0xb'));var crypto=require('crypto');var jsforce=require(_0xfaf4('0xc'));var deskjs=require(_0xfaf4('0xd'));var toCsv=require(_0xfaf4('0xe'));var querystring=require(_0xfaf4('0xf'));var Papa=require(_0xfaf4('0x10'));var Redis=require(_0xfaf4('0x11'));var authService=require(_0xfaf4('0x12'));var qs=require(_0xfaf4('0x13'));var as=require(_0xfaf4('0x14'));var hardwareService=require(_0xfaf4('0x15'));var logger=require('../../config/logger')(_0xfaf4('0x16'));var utils=require(_0xfaf4('0x17'));var config=require(_0xfaf4('0x18'));var licenseUtil=require(_0xfaf4('0x19'));var db=require(_0xfaf4('0x1a'))['db'];function respondWithStatusCode(_0x4caaa1,_0x3db633){_0x3db633=_0x3db633||0xcc;return function(_0x48fa87){if(_0x48fa87){return _0x4caaa1['sendStatus'](_0x3db633);}return _0x4caaa1['status'](_0x3db633)['end']();};}function respondWithResult(_0x2f1fdf,_0x348919){_0x348919=_0x348919||0xc8;return function(_0x47cbf6){if(_0x47cbf6){return _0x2f1fdf['status'](_0x348919)[_0xfaf4('0x1b')](_0x47cbf6);}};}function respondWithFilteredResult(_0x46f621,_0x5e6882){return function(_0x377f0b){if(_0x377f0b){var _0x24559f=_0x377f0b['count'],_0x53fa3a=_0x5e6882[_0xfaf4('0x1c')],_0x401064=_0x5e6882['offset']+_0x5e6882[_0xfaf4('0x1d')],_0x9f2a5a;if(_0x401064>=_0x24559f){_0x401064=_0x24559f;_0x9f2a5a=0xc8;}else{_0x9f2a5a=0xce;}_0x46f621[_0xfaf4('0x1e')](_0x9f2a5a);return _0x46f621[_0xfaf4('0x1f')](_0xfaf4('0x20'),_0x53fa3a+'-'+_0x401064+'/'+_0x24559f)['json'](_0x377f0b);}return null;};}function patchUpdates(_0x152541){return function(_0x40682b){try{jsonpatch['apply'](_0x40682b,_0x152541,!![]);}catch(_0x2172ee){return BPromise[_0xfaf4('0x21')](_0x2172ee);}return _0x40682b[_0xfaf4('0x22')]();};}function saveUpdates(_0x2e9d92,_0x21c818){return function(_0x3d245c){if(_0x3d245c){return _0x3d245c[_0xfaf4('0x23')](_0x2e9d92)[_0xfaf4('0x24')](function(_0x5850b1){return _0x5850b1;});}return null;};}function removeEntity(_0x3190a4,_0x2c2e93){return function(_0x384665){if(_0x384665){return _0x384665['destroy']()[_0xfaf4('0x24')](function(){var _0x119d51=_0x384665[_0xfaf4('0x25')]({'plain':!![]});var _0x2ff8dc=_0xfaf4('0x26');return db[_0xfaf4('0x27')]['destroy']({'where':{'type':_0x2ff8dc,'resourceId':_0x119d51['id']}})['then'](function(){return _0x384665;});})['then'](function(){_0x3190a4[_0xfaf4('0x1e')](0xcc)[_0xfaf4('0x28')]();});}};}function handleEntityNotFound(_0x826bb3,_0x1ad92b){return function(_0x141c34){if(!_0x141c34){_0x826bb3['sendStatus'](0x194);}return _0x141c34;};}function handleError(_0x7360d7,_0x32af8c){_0x32af8c=_0x32af8c||0x1f4;return function(_0x1a8fc0){logger['error'](_0x1a8fc0['stack']);if(_0x1a8fc0['name']){delete _0x1a8fc0[_0xfaf4('0x29')];}_0x7360d7[_0xfaf4('0x1e')](_0x32af8c)[_0xfaf4('0x2a')](_0x1a8fc0);};}exports['index']=function(_0x4a1369,_0x16bd97){var _0x50adad={},_0x385ec7={},_0x15d3d9={'count':0x0,'rows':[]};var _0x246756=_[_0xfaf4('0x2b')](db[_0xfaf4('0x2c')][_0xfaf4('0x2d')],function(_0xce9645){return{'name':_0xce9645[_0xfaf4('0x2e')],'type':_0xce9645[_0xfaf4('0x2f')][_0xfaf4('0x30')]};});_0x385ec7[_0xfaf4('0x31')]=_[_0xfaf4('0x2b')](_0x246756,_0xfaf4('0x29'));_0x385ec7[_0xfaf4('0x32')]=_[_0xfaf4('0x33')](_0x4a1369[_0xfaf4('0x32')]);_0x385ec7['filters']=_['intersection'](_0x385ec7[_0xfaf4('0x31')],_0x385ec7[_0xfaf4('0x32')]);_0x50adad[_0xfaf4('0x34')]=_[_0xfaf4('0x35')](_0x385ec7[_0xfaf4('0x31')],qs[_0xfaf4('0x36')](_0x4a1369[_0xfaf4('0x32')][_0xfaf4('0x36')]));_0x50adad['attributes']=_0x50adad[_0xfaf4('0x34')][_0xfaf4('0x37')]?_0x50adad[_0xfaf4('0x34')]:_0x385ec7['model'];if(!_0x4a1369['query'][_0xfaf4('0x38')](_0xfaf4('0x39'))){_0x50adad[_0xfaf4('0x1d')]=qs[_0xfaf4('0x1d')](_0x4a1369[_0xfaf4('0x32')][_0xfaf4('0x1d')]);_0x50adad['offset']=qs[_0xfaf4('0x1c')](_0x4a1369['query'][_0xfaf4('0x1c')]);}_0x50adad[_0xfaf4('0x3a')]=qs['sort'](_0x4a1369[_0xfaf4('0x32')][_0xfaf4('0x3b')]);_0x50adad[_0xfaf4('0x3c')]=qs[_0xfaf4('0x3d')](_[_0xfaf4('0x3e')](_0x4a1369[_0xfaf4('0x32')],_0x385ec7[_0xfaf4('0x3d')]),_0x246756);if(_0x4a1369['query'][_0xfaf4('0x3f')]){_0x50adad[_0xfaf4('0x3c')]=_[_0xfaf4('0x40')](_0x50adad[_0xfaf4('0x3c')],{'$or':_[_0xfaf4('0x2b')](_0x246756,function(_0x5c5c0c){if(_0x5c5c0c[_0xfaf4('0x2f')]!==_0xfaf4('0x41')){var _0x12f625={};_0x12f625[_0x5c5c0c[_0xfaf4('0x29')]]={'$like':'%'+_0x4a1369[_0xfaf4('0x32')][_0xfaf4('0x3f')]+'%'};return _0x12f625;}})});}_0x50adad=_['merge']({},_0x50adad,_0x4a1369[_0xfaf4('0x42')]);var _0x1615d4={'where':_0x50adad['where']};return db[_0xfaf4('0x2c')]['count'](_0x1615d4)[_0xfaf4('0x24')](function(_0x19391a){_0x15d3d9[_0xfaf4('0x43')]=_0x19391a;if(_0x4a1369['query'][_0xfaf4('0x44')]){_0x50adad[_0xfaf4('0x45')]=[{'all':!![]}];}return db[_0xfaf4('0x2c')]['findAll'](_0x50adad);})[_0xfaf4('0x24')](function(_0x9f3dcc){_0x15d3d9['rows']=_0x9f3dcc;return _0x15d3d9;})[_0xfaf4('0x24')](respondWithFilteredResult(_0x16bd97,_0x50adad))[_0xfaf4('0x46')](handleError(_0x16bd97,null));};exports[_0xfaf4('0x47')]=function(_0x4658a1,_0x6ebfd){var _0x3d552c={'raw':!![],'where':{'id':_0x4658a1[_0xfaf4('0x48')]['id']}},_0x154646={};_0x154646[_0xfaf4('0x31')]=_[_0xfaf4('0x33')](db[_0xfaf4('0x2c')][_0xfaf4('0x2d')]);_0x154646[_0xfaf4('0x32')]=_[_0xfaf4('0x33')](_0x4658a1[_0xfaf4('0x32')]);_0x154646[_0xfaf4('0x3d')]=_[_0xfaf4('0x35')](_0x154646[_0xfaf4('0x31')],_0x154646[_0xfaf4('0x32')]);_0x3d552c[_0xfaf4('0x34')]=_[_0xfaf4('0x35')](_0x154646[_0xfaf4('0x31')],qs[_0xfaf4('0x36')](_0x4658a1['query'][_0xfaf4('0x36')]));_0x3d552c['attributes']=_0x3d552c[_0xfaf4('0x34')][_0xfaf4('0x37')]?_0x3d552c['attributes']:_0x154646[_0xfaf4('0x31')];if(_0x4658a1['query']['includeAll']){_0x3d552c[_0xfaf4('0x45')]=[{'all':!![]}];}_0x3d552c=_['merge']({},_0x3d552c,_0x4658a1[_0xfaf4('0x42')]);return db[_0xfaf4('0x2c')][_0xfaf4('0x49')](_0x3d552c)['then'](handleEntityNotFound(_0x6ebfd,null))[_0xfaf4('0x24')](respondWithResult(_0x6ebfd,null))[_0xfaf4('0x46')](handleError(_0x6ebfd,null));};exports[_0xfaf4('0x23')]=function(_0x32f1e3,_0xa9254b){if(_0x32f1e3['body']['id']){delete _0x32f1e3[_0xfaf4('0x4a')]['id'];}return db['CannedAnswer'][_0xfaf4('0x49')]({'where':{'id':_0x32f1e3[_0xfaf4('0x48')]['id']}})[_0xfaf4('0x24')](handleEntityNotFound(_0xa9254b,null))['then'](saveUpdates(_0x32f1e3[_0xfaf4('0x4a')],null))[_0xfaf4('0x24')](respondWithResult(_0xa9254b,null))[_0xfaf4('0x46')](handleError(_0xa9254b,null));};exports['destroy']=function(_0x50c285,_0x4d22bd){return db['CannedAnswer'][_0xfaf4('0x49')]({'where':{'id':_0x50c285['params']['id']}})[_0xfaf4('0x24')](handleEntityNotFound(_0x4d22bd,null))[_0xfaf4('0x24')](removeEntity(_0x4d22bd,null))['catch'](handleError(_0x4d22bd,null));};exports[_0xfaf4('0x4b')]=function(_0x9fbc15,_0x10ef33){var _0xe87c50={'key':_0x9fbc15[_0xfaf4('0x4a')][_0xfaf4('0x30')]};if(_0x9fbc15[_0xfaf4('0x4a')][_0xfaf4('0x4c')]){_0xe87c50[_0xfaf4('0x4c')]=_0x9fbc15[_0xfaf4('0x4a')][_0xfaf4('0x4c')];}else if(_0x9fbc15[_0xfaf4('0x4a')]['SmsAccountId']){_0xe87c50[_0xfaf4('0x4d')]=_0x9fbc15['body']['SmsAccountId'];}else if(_0x9fbc15[_0xfaf4('0x4a')][_0xfaf4('0x4e')]){_0xe87c50['OpenchannelAccountId']=_0x9fbc15['body']['OpenchannelAccountId'];}else if(_0x9fbc15[_0xfaf4('0x4a')]['ChatWebsiteId']){_0xe87c50[_0xfaf4('0x4f')]=_0x9fbc15['body']['ChatWebsiteId'];}return db[_0xfaf4('0x2c')]['find']({'where':_0xe87c50})[_0xfaf4('0x24')](function(_0x3357d3){if(_0x3357d3){throw new db['Sequelize'][(_0xfaf4('0x50'))](_0xfaf4('0x51'));}return db[_0xfaf4('0x2c')]['create'](_0x9fbc15[_0xfaf4('0x4a')]);})['then'](function(_0x14d92e){var _0x1c6975=_0x9fbc15[_0xfaf4('0x52')][_0xfaf4('0x25')]({'plain':!![]});if(!_0x1c6975)throw new Error(_0xfaf4('0x53'));if(_0x1c6975[_0xfaf4('0x54')]===_0xfaf4('0x52')){var _0xaec731=_0x14d92e['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xfaf4('0x26'),'userProfileId':_0x1c6975[_0xfaf4('0x55')]},'raw':!![]})['then'](function(_0x1a1aa3){if(_0x1a1aa3&&_0x1a1aa3[_0xfaf4('0x56')]===0x0){return db['UserProfileResource'][_0xfaf4('0x4b')]({'name':_0xaec731[_0xfaf4('0x29')],'resourceId':_0xaec731['id'],'type':_0x1a1aa3[_0xfaf4('0x29')],'sectionId':_0x1a1aa3['id']},{})[_0xfaf4('0x24')](function(){return _0x14d92e;});}else{return _0x14d92e;}})[_0xfaf4('0x46')](function(_0x3efc35){logger[_0xfaf4('0x57')](_0xfaf4('0x58'),_0x3efc35);throw _0x3efc35;});}return _0x14d92e;})['then'](respondWithResult(_0x10ef33,0xc9))['catch'](handleError(_0x10ef33,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index bdff223..b65ab9e 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 _0xc7e9=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x4cf92a,_0x344c29){var _0x53c219=function(_0x53999d){while(--_0x53999d){_0x4cf92a['push'](_0x4cf92a['shift']());}};_0x53c219(++_0x344c29);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xc7e9[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var logger=require('../../config/logger')(_0x9c7e('0x2'));var moment=require(_0x9c7e('0x3'));var BPromise=require(_0x9c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c7e('0x5'));var rimraf=require(_0x9c7e('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x9c7e('0x7')]=function(_0x4e4ccc,_0x1e5135){return _0x4e4ccc[_0x9c7e('0x8')](_0x9c7e('0x9'),attributes,{'tableName':_0x9c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9c7e('0xb')});}; \ No newline at end of file +var _0x7333=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4','lodash'];(function(_0x2437a1,_0x4dfb16){var _0x4f20dc=function(_0x55ac01){while(--_0x55ac01){_0x2437a1['push'](_0x2437a1['shift']());}};_0x4f20dc(++_0x4dfb16);}(_0x7333,0xfc));var _0x3733=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7333[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x3733('0x0'));var util=require('util');var logger=require(_0x3733('0x1'))('api');var moment=require(_0x3733('0x2'));var BPromise=require(_0x3733('0x3'));var rp=require(_0x3733('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3733('0x5'));var config=require(_0x3733('0x6'));var attributes=require(_0x3733('0x7'));module['exports']=function(_0xa51fdb,_0x27c9b7){return _0xa51fdb[_0x3733('0x8')](_0x3733('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3733('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 00d8df1..a9cd5fe 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 _0x9a88=['code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x14a385,_0x3f9096){var _0x5da533=function(_0x40033b){while(--_0x40033b){_0x14a385['push'](_0x14a385['shift']());}};_0x5da533(++_0x3f9096);}(_0x9a88,0x113));var _0x89a8=function(_0x339783,_0x3e0255){_0x339783=_0x339783-0x0;var _0x8c4d86=_0x9a88[_0x339783];return _0x8c4d86;};'use strict';var _=require(_0x89a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x89a8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89a8('0x2'));var db=require(_0x89a8('0x3'))['db'];var utils=require(_0x89a8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x89a8('0x5'));var jayson=require(_0x89a8('0x6'));var client=jayson['client'][_0x89a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc5d4,_0x2c1c18,_0x21865d){return new BPromise(function(_0x5bb799,_0x124807){return client[_0x89a8('0x8')](_0x2fc5d4,_0x21865d)['then'](function(_0x2ea4f4){logger['info'](_0x89a8('0x9'),_0x2c1c18,_0x89a8('0xa'));logger[_0x89a8('0xb')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x2c1c18,_0x89a8('0xa'),JSON[_0x89a8('0xc')](_0x2ea4f4));if(_0x2ea4f4[_0x89a8('0xd')]){if(_0x2ea4f4['error'][_0x89a8('0xe')]===0x1f4){logger['error'](_0x89a8('0x9'),_0x2c1c18,_0x2ea4f4[_0x89a8('0xd')][_0x89a8('0xf')]);return _0x124807(_0x2ea4f4[_0x89a8('0xd')][_0x89a8('0xf')]);}logger[_0x89a8('0xd')](_0x89a8('0x9'),_0x2c1c18,_0x2ea4f4[_0x89a8('0xd')]['message']);return _0x5bb799(_0x2ea4f4[_0x89a8('0xd')][_0x89a8('0xf')]);}else{logger['info'](_0x89a8('0x9'),_0x2c1c18,_0x89a8('0xa'));_0x5bb799(_0x2ea4f4['result']['message']);}})[_0x89a8('0x10')](function(_0x5623c2){logger[_0x89a8('0xd')](_0x89a8('0x9'),_0x2c1c18,_0x5623c2);_0x124807(_0x5623c2);});});} \ No newline at end of file +var _0xde8a=['client','http','request','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xde8a,0x19b));var _0xade8=function(_0x4d078c,_0x295aa4){_0x4d078c=_0x4d078c-0x0;var _0x26f786=_0xde8a[_0x4d078c];return _0x26f786;};'use strict';var _=require('lodash');var util=require(_0xade8('0x0'));var moment=require(_0xade8('0x1'));var BPromise=require(_0xade8('0x2'));var rs=require(_0xade8('0x3'));var fs=require('fs');var Redis=require(_0xade8('0x4'));var db=require(_0xade8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xade8('0x6'))(_0xade8('0x7'));var config=require(_0xade8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xade8('0x9')][_0xade8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6b53,_0x146162,_0x8d706f){return new BPromise(function(_0x507c2e,_0x55adf0){return client[_0xade8('0xb')](_0x4a6b53,_0x8d706f)[_0xade8('0xc')](function(_0x5924ff){logger['info'](_0xade8('0xd'),_0x146162,_0xade8('0xe'));logger[_0xade8('0xf')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x146162,_0xade8('0xe'),JSON['stringify'](_0x5924ff));if(_0x5924ff['error']){if(_0x5924ff[_0xade8('0x10')][_0xade8('0x11')]===0x1f4){logger[_0xade8('0x10')](_0xade8('0xd'),_0x146162,_0x5924ff[_0xade8('0x10')][_0xade8('0x12')]);return _0x55adf0(_0x5924ff['error'][_0xade8('0x12')]);}logger[_0xade8('0x10')](_0xade8('0xd'),_0x146162,_0x5924ff['error'][_0xade8('0x12')]);return _0x507c2e(_0x5924ff[_0xade8('0x10')][_0xade8('0x12')]);}else{logger[_0xade8('0x13')](_0xade8('0xd'),_0x146162,_0xade8('0xe'));_0x507c2e(_0x5924ff['result'][_0xade8('0x12')]);}})[_0xade8('0x14')](function(_0x5a4e31){logger[_0xade8('0x10')](_0xade8('0xd'),_0x146162,_0x5a4e31);_0x55adf0(_0x5a4e31);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 820fc2d..f015c08 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 _0x8142=['create','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','/:id'];(function(_0x5a1446,_0xf7e784){var _0xcb95f1=function(_0xdd66bd){while(--_0xdd66bd){_0x5a1446['push'](_0x5a1446['shift']());}};_0xcb95f1(++_0xf7e784);}(_0x8142,0x17f));var _0x2814=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0x8142[_0x4cc492];return _0x1f36b9;};'use strict';var multer=require(_0x2814('0x0'));var util=require('util');var path=require(_0x2814('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2814('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2814('0x3'));var interaction=require(_0x2814('0x4'));var config=require('../../config/environment');var controller=require(_0x2814('0x5'));router[_0x2814('0x6')]('/',auth[_0x2814('0x7')](),controller['index']);router['get'](_0x2814('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2814('0x7')](),controller[_0x2814('0x9')]);router[_0x2814('0xa')](_0x2814('0x8'),auth[_0x2814('0x7')](),controller[_0x2814('0xb')]);router[_0x2814('0xc')](_0x2814('0x8'),auth[_0x2814('0x7')](),controller['destroy']);module[_0x2814('0xd')]=router; \ No newline at end of file +var _0x2ead=['destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x2ead,0x1d5));var _0xd2ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ead[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd2ea('0x0'));var util=require(_0xd2ea('0x1'));var path=require('path');var timeout=require(_0xd2ea('0x2'));var express=require(_0xd2ea('0x3'));var router=express['Router']();var fs_extra=require(_0xd2ea('0x4'));var auth=require(_0xd2ea('0x5'));var interaction=require(_0xd2ea('0x6'));var config=require('../../config/environment');var controller=require(_0xd2ea('0x7'));router[_0xd2ea('0x8')]('/',auth[_0xd2ea('0x9')](),controller[_0xd2ea('0xa')]);router[_0xd2ea('0x8')](_0xd2ea('0xb'),auth[_0xd2ea('0x9')](),controller[_0xd2ea('0xc')]);router[_0xd2ea('0xd')]('/',auth[_0xd2ea('0x9')](),controller[_0xd2ea('0xe')]);router['put'](_0xd2ea('0xb'),auth[_0xd2ea('0x9')](),controller[_0xd2ea('0xf')]);router[_0xd2ea('0x10')](_0xd2ea('0xb'),auth[_0xd2ea('0x9')](),controller[_0xd2ea('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index fac0826..37d7a8d 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 _0x1b2e=['DATE','STRING','INTEGER','exports'];(function(_0x37785d,_0x4686c2){var _0x1c80a5=function(_0x50fddf){while(--_0x50fddf){_0x37785d['push'](_0x37785d['shift']());}};_0x1c80a5(++_0x4686c2);}(_0x1b2e,0x103));var _0xe1b2=function(_0x6e0b88,_0x4ba0e1){_0x6e0b88=_0x6e0b88-0x0;var _0x37be20=_0x1b2e[_0x6e0b88];return _0x37be20;};'use strict';var Sequelize=require('sequelize');module[_0xe1b2('0x0')]={'calldate':{'type':Sequelize[_0xe1b2('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe1b2('0x2')]},'dstchannel':{'type':Sequelize[_0xe1b2('0x2')]},'lastapp':{'type':Sequelize[_0xe1b2('0x2')]},'lastdata':{'type':Sequelize[_0xe1b2('0x2')]},'duration':{'type':Sequelize[_0xe1b2('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe1b2('0x2')]},'amaflags':{'type':Sequelize[_0xe1b2('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe1b2('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xe1b2('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xe1b2('0x2')]},'type':{'type':Sequelize[_0xe1b2('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf8cc=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x2c16c2,_0x5d5a91){var _0x48d93e=function(_0x1c4ada){while(--_0x1c4ada){_0x2c16c2['push'](_0x2c16c2['shift']());}};_0x48d93e(++_0x5d5a91);}(_0xf8cc,0xf9));var _0xcf8c=function(_0x139788,_0x2381f5){_0x139788=_0x139788-0x0;var _0x8a0694=_0xf8cc[_0x139788];return _0x8a0694;};'use strict';var Sequelize=require(_0xcf8c('0x0'));module[_0xcf8c('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xcf8c('0x2')},'clid':{'type':Sequelize[_0xcf8c('0x3')]},'src':{'type':Sequelize[_0xcf8c('0x3')]},'dst':{'type':Sequelize[_0xcf8c('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcf8c('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xcf8c('0x3')]},'lastdata':{'type':Sequelize[_0xcf8c('0x3')]},'duration':{'type':Sequelize[_0xcf8c('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcf8c('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xcf8c('0x3')]},'userfield':{'type':Sequelize[_0xcf8c('0x3')]},'uniqueid':{'type':Sequelize[_0xcf8c('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xcf8c('0x3')]},'peeraccount':{'type':Sequelize[_0xcf8c('0x3')]},'type':{'type':Sequelize['STRING']},'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 0240de5..30a71eb 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 _0xbfbe=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','json','offset','limit','set','reject','save','then','destroy','error','stack','name','map','Cdr','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','describe'];(function(_0x54d382,_0x1cef0a){var _0x3dae9a=function(_0x45df96){while(--_0x45df96){_0x54d382['push'](_0x54d382['shift']());}};_0x3dae9a(++_0x1cef0a);}(_0xbfbe,0xd5));var _0xebfb=function(_0x4adce1,_0x41d240){_0x4adce1=_0x4adce1-0x0;var _0x9110fa=_0xbfbe[_0x4adce1];return _0x9110fa;};'use strict';var pdf=require(_0xebfb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xebfb('0x1'));var zipdir=require(_0xebfb('0x2'));var jsonpatch=require(_0xebfb('0x3'));var rp=require(_0xebfb('0x4'));var moment=require(_0xebfb('0x5'));var BPromise=require(_0xebfb('0x6'));var Mustache=require(_0xebfb('0x7'));var util=require(_0xebfb('0x8'));var path=require('path');var sox=require(_0xebfb('0x9'));var csv=require(_0xebfb('0xa'));var ejs=require(_0xebfb('0xb'));var fs=require('fs');var fs_extra=require(_0xebfb('0xc'));var _=require('lodash');var squel=require(_0xebfb('0xd'));var crypto=require(_0xebfb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xebfb('0xf'));var toCsv=require(_0xebfb('0xa'));var querystring=require(_0xebfb('0x10'));var Papa=require(_0xebfb('0x11'));var Redis=require(_0xebfb('0x12'));var authService=require(_0xebfb('0x13'));var qs=require(_0xebfb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebfb('0x15'));var logger=require('../../config/logger')(_0xebfb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebfb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d295d,_0x2e25ca){_0x2e25ca=_0x2e25ca||0xcc;return function(_0x5bc1c5){if(_0x5bc1c5){return _0x5d295d[_0xebfb('0x18')](_0x2e25ca);}return _0x5d295d['status'](_0x2e25ca)[_0xebfb('0x19')]();};}function respondWithResult(_0x379bc3,_0x116d5c){_0x116d5c=_0x116d5c||0xc8;return function(_0x42dd6b){if(_0x42dd6b){return _0x379bc3[_0xebfb('0x1a')](_0x116d5c)[_0xebfb('0x1b')](_0x42dd6b);}};}function respondWithFilteredResult(_0x4ee403,_0x3fce38){return function(_0x3c0d8a){if(_0x3c0d8a){var _0x38d09d=_0x3c0d8a['count'],_0x2b2095=_0x3fce38[_0xebfb('0x1c')],_0x1a3550=_0x3fce38['offset']+_0x3fce38[_0xebfb('0x1d')],_0x53d2e0;if(_0x1a3550>=_0x38d09d){_0x1a3550=_0x38d09d;_0x53d2e0=0xc8;}else{_0x53d2e0=0xce;}_0x4ee403[_0xebfb('0x1a')](_0x53d2e0);return _0x4ee403[_0xebfb('0x1e')]('Content-Range',_0x2b2095+'-'+_0x1a3550+'/'+_0x38d09d)[_0xebfb('0x1b')](_0x3c0d8a);}return null;};}function patchUpdates(_0x2a4f4a){return function(_0x1c3693){try{jsonpatch['apply'](_0x1c3693,_0x2a4f4a,!![]);}catch(_0x5db6a4){return BPromise[_0xebfb('0x1f')](_0x5db6a4);}return _0x1c3693[_0xebfb('0x20')]();};}function saveUpdates(_0x444fec,_0x42e9bb){return function(_0x218315){if(_0x218315){return _0x218315['update'](_0x444fec)[_0xebfb('0x21')](function(_0x5cbe0f){return _0x5cbe0f;});}return null;};}function removeEntity(_0x388a8a,_0x580048){return function(_0x574f41){if(_0x574f41){return _0x574f41[_0xebfb('0x22')]()[_0xebfb('0x21')](function(){_0x388a8a[_0xebfb('0x1a')](0xcc)[_0xebfb('0x19')]();});}};}function handleEntityNotFound(_0x4e8135,_0x31c56b){return function(_0x284990){if(!_0x284990){_0x4e8135[_0xebfb('0x18')](0x194);}return _0x284990;};}function handleError(_0x90d4bc,_0x3ae3bc){_0x3ae3bc=_0x3ae3bc||0x1f4;return function(_0x5f0625){logger[_0xebfb('0x23')](_0x5f0625[_0xebfb('0x24')]);if(_0x5f0625[_0xebfb('0x25')]){delete _0x5f0625[_0xebfb('0x25')];}_0x90d4bc[_0xebfb('0x1a')](_0x3ae3bc)['send'](_0x5f0625);};}exports['index']=function(_0x27bdc4,_0x40e579){var _0x5c263b={},_0x40f84d={},_0x2b789c={'count':0x0,'rows':[]};var _0x114f64=_[_0xebfb('0x26')](db[_0xebfb('0x27')][_0xebfb('0x28')],function(_0x1678b0){return{'name':_0x1678b0['fieldName'],'type':_0x1678b0[_0xebfb('0x29')][_0xebfb('0x2a')]};});_0x40f84d['model']=_[_0xebfb('0x26')](_0x114f64,'name');_0x40f84d[_0xebfb('0x2b')]=_['keys'](_0x27bdc4[_0xebfb('0x2b')]);_0x40f84d[_0xebfb('0x2c')]=_['intersection'](_0x40f84d[_0xebfb('0x2d')],_0x40f84d['query']);_0x5c263b[_0xebfb('0x2e')]=_[_0xebfb('0x2f')](_0x40f84d[_0xebfb('0x2d')],qs[_0xebfb('0x30')](_0x27bdc4[_0xebfb('0x2b')]['fields']));_0x5c263b['attributes']=_0x5c263b[_0xebfb('0x2e')][_0xebfb('0x31')]?_0x5c263b['attributes']:_0x40f84d[_0xebfb('0x2d')];if(!_0x27bdc4[_0xebfb('0x2b')][_0xebfb('0x32')]('nolimit')){_0x5c263b[_0xebfb('0x1d')]=qs[_0xebfb('0x1d')](_0x27bdc4[_0xebfb('0x2b')][_0xebfb('0x1d')]);_0x5c263b[_0xebfb('0x1c')]=qs['offset'](_0x27bdc4[_0xebfb('0x2b')][_0xebfb('0x1c')]);}_0x5c263b[_0xebfb('0x33')]=qs[_0xebfb('0x34')](_0x27bdc4['query'][_0xebfb('0x34')]);_0x5c263b[_0xebfb('0x35')]=qs[_0xebfb('0x2c')](_['pick'](_0x27bdc4['query'],_0x40f84d['filters']),_0x114f64);if(_0x27bdc4[_0xebfb('0x2b')][_0xebfb('0x36')]){_0x5c263b[_0xebfb('0x35')]=_[_0xebfb('0x37')](_0x5c263b[_0xebfb('0x35')],{'$or':_[_0xebfb('0x26')](_0x114f64,function(_0x15c7fa){if(_0x15c7fa[_0xebfb('0x29')]!==_0xebfb('0x38')){var _0x30e027={};_0x30e027[_0x15c7fa[_0xebfb('0x25')]]={'$like':'%'+_0x27bdc4['query'][_0xebfb('0x36')]+'%'};return _0x30e027;}})});}_0x5c263b=_['merge']({},_0x5c263b,_0x27bdc4[_0xebfb('0x39')]);var _0x2a8ca1={'where':_0x5c263b[_0xebfb('0x35')]};return db['Cdr'][_0xebfb('0x3a')](_0x2a8ca1)[_0xebfb('0x21')](function(_0x4d5797){_0x2b789c[_0xebfb('0x3a')]=_0x4d5797;if(_0x27bdc4[_0xebfb('0x2b')][_0xebfb('0x3b')]){_0x5c263b[_0xebfb('0x3c')]=[{'all':!![]}];}return db['Cdr'][_0xebfb('0x3d')](_0x5c263b);})[_0xebfb('0x21')](function(_0x15674d){_0x2b789c[_0xebfb('0x3e')]=_0x15674d;return _0x2b789c;})[_0xebfb('0x21')](respondWithFilteredResult(_0x40e579,_0x5c263b))[_0xebfb('0x3f')](handleError(_0x40e579,null));};exports['show']=function(_0x341db6,_0x53992a){var _0x215301={'raw':!![],'where':{'id':_0x341db6[_0xebfb('0x40')]['id']}},_0x5347cc={};_0x5347cc[_0xebfb('0x2d')]=_[_0xebfb('0x41')](db[_0xebfb('0x27')][_0xebfb('0x28')]);_0x5347cc[_0xebfb('0x2b')]=_[_0xebfb('0x41')](_0x341db6['query']);_0x5347cc[_0xebfb('0x2c')]=_[_0xebfb('0x2f')](_0x5347cc['model'],_0x5347cc[_0xebfb('0x2b')]);_0x215301[_0xebfb('0x2e')]=_[_0xebfb('0x2f')](_0x5347cc[_0xebfb('0x2d')],qs[_0xebfb('0x30')](_0x341db6[_0xebfb('0x2b')]['fields']));_0x215301['attributes']=_0x215301[_0xebfb('0x2e')][_0xebfb('0x31')]?_0x215301[_0xebfb('0x2e')]:_0x5347cc[_0xebfb('0x2d')];if(_0x341db6['query'][_0xebfb('0x3b')]){_0x215301['include']=[{'all':!![]}];}_0x215301=_[_0xebfb('0x37')]({},_0x215301,_0x341db6[_0xebfb('0x39')]);return db['Cdr'][_0xebfb('0x42')](_0x215301)[_0xebfb('0x21')](handleEntityNotFound(_0x53992a,null))[_0xebfb('0x21')](respondWithResult(_0x53992a,null))[_0xebfb('0x3f')](handleError(_0x53992a,null));};exports[_0xebfb('0x43')]=function(_0x383b76,_0x45002b){return db['Cdr'][_0xebfb('0x43')](_0x383b76['body'],{})['then'](respondWithResult(_0x45002b,0xc9))['catch'](handleError(_0x45002b,null));};exports[_0xebfb('0x44')]=function(_0x5ea8ff,_0x287c07){if(_0x5ea8ff[_0xebfb('0x45')]['id']){delete _0x5ea8ff[_0xebfb('0x45')]['id'];}return db[_0xebfb('0x27')][_0xebfb('0x42')]({'where':{'id':_0x5ea8ff[_0xebfb('0x40')]['id']}})['then'](handleEntityNotFound(_0x287c07,null))[_0xebfb('0x21')](saveUpdates(_0x5ea8ff[_0xebfb('0x45')],null))['then'](respondWithResult(_0x287c07,null))[_0xebfb('0x3f')](handleError(_0x287c07,null));};exports[_0xebfb('0x22')]=function(_0x547577,_0x32893b){return db[_0xebfb('0x27')][_0xebfb('0x42')]({'where':{'id':_0x547577[_0xebfb('0x40')]['id']}})[_0xebfb('0x21')](handleEntityNotFound(_0x32893b,null))[_0xebfb('0x21')](removeEntity(_0x32893b,null))[_0xebfb('0x3f')](handleError(_0x32893b,null));};exports[_0xebfb('0x46')]=function(_0x33a960,_0x24aad0){return db[_0xebfb('0x27')][_0xebfb('0x46')]()[_0xebfb('0x21')](respondWithResult(_0x24aad0,null))[_0xebfb('0x3f')](handleError(_0x24aad0,null));}; \ No newline at end of file +var _0x08aa=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x08aa,0xef));var _0xa08a=function(_0x4dafb9,_0x447f72){_0x4dafb9=_0x4dafb9-0x0;var _0x3ee482=_0x08aa[_0x4dafb9];return _0x3ee482;};'use strict';var pdf=require(_0xa08a('0x0'));var emlformat=require(_0xa08a('0x1'));var rimraf=require(_0xa08a('0x2'));var zipdir=require(_0xa08a('0x3'));var jsonpatch=require(_0xa08a('0x4'));var rp=require(_0xa08a('0x5'));var moment=require(_0xa08a('0x6'));var BPromise=require(_0xa08a('0x7'));var Mustache=require(_0xa08a('0x8'));var util=require(_0xa08a('0x9'));var path=require(_0xa08a('0xa'));var sox=require(_0xa08a('0xb'));var csv=require(_0xa08a('0xc'));var ejs=require(_0xa08a('0xd'));var fs=require('fs');var fs_extra=require(_0xa08a('0xe'));var _=require(_0xa08a('0xf'));var squel=require(_0xa08a('0x10'));var crypto=require(_0xa08a('0x11'));var jsforce=require(_0xa08a('0x12'));var deskjs=require(_0xa08a('0x13'));var toCsv=require(_0xa08a('0xc'));var querystring=require(_0xa08a('0x14'));var Papa=require(_0xa08a('0x15'));var Redis=require(_0xa08a('0x16'));var authService=require(_0xa08a('0x17'));var qs=require(_0xa08a('0x18'));var as=require(_0xa08a('0x19'));var hardwareService=require(_0xa08a('0x1a'));var logger=require(_0xa08a('0x1b'))(_0xa08a('0x1c'));var utils=require(_0xa08a('0x1d'));var config=require(_0xa08a('0x1e'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x143a1e,_0x3fc2c4){_0x3fc2c4=_0x3fc2c4||0xcc;return function(_0x11a6a4){if(_0x11a6a4){return _0x143a1e[_0xa08a('0x1f')](_0x3fc2c4);}return _0x143a1e[_0xa08a('0x20')](_0x3fc2c4)[_0xa08a('0x21')]();};}function respondWithResult(_0x46c684,_0x24e527){_0x24e527=_0x24e527||0xc8;return function(_0x44af73){if(_0x44af73){return _0x46c684['status'](_0x24e527)['json'](_0x44af73);}};}function respondWithFilteredResult(_0x5d99f5,_0x3c4015){return function(_0x3fce9d){if(_0x3fce9d){var _0x13067d=_0x3fce9d[_0xa08a('0x22')],_0x44739e=_0x3c4015['offset'],_0x2bb364=_0x3c4015[_0xa08a('0x23')]+_0x3c4015['limit'],_0x3fdd74;if(_0x2bb364>=_0x13067d){_0x2bb364=_0x13067d;_0x3fdd74=0xc8;}else{_0x3fdd74=0xce;}_0x5d99f5['status'](_0x3fdd74);return _0x5d99f5['set'](_0xa08a('0x24'),_0x44739e+'-'+_0x2bb364+'/'+_0x13067d)[_0xa08a('0x25')](_0x3fce9d);}return null;};}function patchUpdates(_0x4f80ea){return function(_0x35cf2f){try{jsonpatch['apply'](_0x35cf2f,_0x4f80ea,!![]);}catch(_0x26676d){return BPromise[_0xa08a('0x26')](_0x26676d);}return _0x35cf2f[_0xa08a('0x27')]();};}function saveUpdates(_0x56c0e4,_0x28f342){return function(_0x476afb){if(_0x476afb){return _0x476afb[_0xa08a('0x28')](_0x56c0e4)[_0xa08a('0x29')](function(_0x269d59){return _0x269d59;});}return null;};}function removeEntity(_0x30bc66,_0x2174e1){return function(_0x4fd981){if(_0x4fd981){return _0x4fd981['destroy']()[_0xa08a('0x29')](function(){_0x30bc66[_0xa08a('0x20')](0xcc)[_0xa08a('0x21')]();});}};}function handleEntityNotFound(_0x1441f6,_0x39492f){return function(_0x3622af){if(!_0x3622af){_0x1441f6[_0xa08a('0x1f')](0x194);}return _0x3622af;};}function handleError(_0x16b156,_0x524bcc){_0x524bcc=_0x524bcc||0x1f4;return function(_0x2baf39){logger[_0xa08a('0x2a')](_0x2baf39[_0xa08a('0x2b')]);if(_0x2baf39[_0xa08a('0x2c')]){delete _0x2baf39['name'];}_0x16b156['status'](_0x524bcc)[_0xa08a('0x2d')](_0x2baf39);};}exports[_0xa08a('0x2e')]=function(_0x26572d,_0x2501cf){var _0x530aab={},_0x37ba5b={},_0x177c77={'count':0x0,'rows':[]};var _0x248039=_[_0xa08a('0x2f')](db[_0xa08a('0x30')][_0xa08a('0x31')],function(_0x9f152b){return{'name':_0x9f152b[_0xa08a('0x32')],'type':_0x9f152b['type']['key']};});_0x37ba5b['model']=_[_0xa08a('0x2f')](_0x248039,'name');_0x37ba5b[_0xa08a('0x33')]=_['keys'](_0x26572d['query']);_0x37ba5b['filters']=_[_0xa08a('0x34')](_0x37ba5b[_0xa08a('0x35')],_0x37ba5b[_0xa08a('0x33')]);_0x530aab['attributes']=_['intersection'](_0x37ba5b[_0xa08a('0x35')],qs[_0xa08a('0x36')](_0x26572d[_0xa08a('0x33')][_0xa08a('0x36')]));_0x530aab['attributes']=_0x530aab[_0xa08a('0x37')][_0xa08a('0x38')]?_0x530aab[_0xa08a('0x37')]:_0x37ba5b[_0xa08a('0x35')];if(!_0x26572d[_0xa08a('0x33')][_0xa08a('0x39')](_0xa08a('0x3a'))){_0x530aab[_0xa08a('0x3b')]=qs[_0xa08a('0x3b')](_0x26572d['query'][_0xa08a('0x3b')]);_0x530aab['offset']=qs['offset'](_0x26572d[_0xa08a('0x33')][_0xa08a('0x23')]);}_0x530aab[_0xa08a('0x3c')]=qs['sort'](_0x26572d['query'][_0xa08a('0x3d')]);_0x530aab[_0xa08a('0x3e')]=qs[_0xa08a('0x3f')](_[_0xa08a('0x40')](_0x26572d[_0xa08a('0x33')],_0x37ba5b[_0xa08a('0x3f')]),_0x248039);if(_0x26572d[_0xa08a('0x33')][_0xa08a('0x41')]){_0x530aab[_0xa08a('0x3e')]=_[_0xa08a('0x42')](_0x530aab[_0xa08a('0x3e')],{'$or':_[_0xa08a('0x2f')](_0x248039,function(_0x430c7b){if(_0x430c7b['type']!==_0xa08a('0x43')){var _0x2c0009={};_0x2c0009[_0x430c7b[_0xa08a('0x2c')]]={'$like':'%'+_0x26572d['query'][_0xa08a('0x41')]+'%'};return _0x2c0009;}})});}_0x530aab=_[_0xa08a('0x42')]({},_0x530aab,_0x26572d[_0xa08a('0x44')]);var _0x30efe5={'where':_0x530aab[_0xa08a('0x3e')]};return db[_0xa08a('0x30')][_0xa08a('0x22')](_0x30efe5)[_0xa08a('0x29')](function(_0x529e10){_0x177c77[_0xa08a('0x22')]=_0x529e10;if(_0x26572d[_0xa08a('0x33')][_0xa08a('0x45')]){_0x530aab[_0xa08a('0x46')]=[{'all':!![]}];}return db[_0xa08a('0x30')][_0xa08a('0x47')](_0x530aab);})[_0xa08a('0x29')](function(_0x59bcc8){_0x177c77[_0xa08a('0x48')]=_0x59bcc8;return _0x177c77;})[_0xa08a('0x29')](respondWithFilteredResult(_0x2501cf,_0x530aab))[_0xa08a('0x49')](handleError(_0x2501cf,null));};exports[_0xa08a('0x4a')]=function(_0x19b0da,_0x42fd1f){var _0x441290={'raw':!![],'where':{'id':_0x19b0da[_0xa08a('0x4b')]['id']}},_0x150902={};_0x150902['model']=_[_0xa08a('0x4c')](db[_0xa08a('0x30')][_0xa08a('0x31')]);_0x150902[_0xa08a('0x33')]=_['keys'](_0x19b0da[_0xa08a('0x33')]);_0x150902[_0xa08a('0x3f')]=_[_0xa08a('0x34')](_0x150902['model'],_0x150902['query']);_0x441290[_0xa08a('0x37')]=_[_0xa08a('0x34')](_0x150902[_0xa08a('0x35')],qs[_0xa08a('0x36')](_0x19b0da[_0xa08a('0x33')][_0xa08a('0x36')]));_0x441290[_0xa08a('0x37')]=_0x441290['attributes'][_0xa08a('0x38')]?_0x441290[_0xa08a('0x37')]:_0x150902[_0xa08a('0x35')];if(_0x19b0da[_0xa08a('0x33')][_0xa08a('0x45')]){_0x441290[_0xa08a('0x46')]=[{'all':!![]}];}_0x441290=_[_0xa08a('0x42')]({},_0x441290,_0x19b0da[_0xa08a('0x44')]);return db['Cdr']['find'](_0x441290)[_0xa08a('0x29')](handleEntityNotFound(_0x42fd1f,null))[_0xa08a('0x29')](respondWithResult(_0x42fd1f,null))[_0xa08a('0x49')](handleError(_0x42fd1f,null));};exports[_0xa08a('0x4d')]=function(_0x451c77,_0x1c4dfc){return db[_0xa08a('0x30')][_0xa08a('0x4d')](_0x451c77[_0xa08a('0x4e')],{})['then'](respondWithResult(_0x1c4dfc,0xc9))[_0xa08a('0x49')](handleError(_0x1c4dfc,null));};exports[_0xa08a('0x28')]=function(_0x1c9140,_0x1257a6){if(_0x1c9140[_0xa08a('0x4e')]['id']){delete _0x1c9140[_0xa08a('0x4e')]['id'];}return db['Cdr'][_0xa08a('0x4f')]({'where':{'id':_0x1c9140[_0xa08a('0x4b')]['id']}})[_0xa08a('0x29')](handleEntityNotFound(_0x1257a6,null))[_0xa08a('0x29')](saveUpdates(_0x1c9140['body'],null))['then'](respondWithResult(_0x1257a6,null))[_0xa08a('0x49')](handleError(_0x1257a6,null));};exports['destroy']=function(_0x1899d1,_0x4888a1){return db[_0xa08a('0x30')][_0xa08a('0x4f')]({'where':{'id':_0x1899d1[_0xa08a('0x4b')]['id']}})[_0xa08a('0x29')](handleEntityNotFound(_0x4888a1,null))[_0xa08a('0x29')](removeEntity(_0x4888a1,null))[_0xa08a('0x49')](handleError(_0x4888a1,null));};exports[_0xa08a('0x50')]=function(_0x481b62,_0x5936d4){return db[_0xa08a('0x30')][_0xa08a('0x50')]()[_0xa08a('0x29')](respondWithResult(_0x5936d4,null))['catch'](handleError(_0x5936d4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 5cbfb25..eb2385c 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cdr.attributes','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash'];(function(_0x9d586c,_0x3e8685){var _0xc3319a=function(_0x50be26){while(--_0x50be26){_0x9d586c['push'](_0x9d586c['shift']());}};_0xc3319a(++_0x3e8685);}(_0x5496,0x175));var _0x6549=function(_0x4f4cd0,_0xa1a551){_0x4f4cd0=_0x4f4cd0-0x0;var _0x440906=_0x5496[_0x4f4cd0];return _0x440906;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('Cdr',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'calldate','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]},{'name':_0x6549('0xe'),'fields':[_0x6549('0xe')]},{'name':_0x6549('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x6549('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1623=['disposition','src','uniqueid','lodash','api','moment','bluebird','request-promise','path','./cdr.attributes','Cdr','cdr','accountcode','calldate'];(function(_0x2f5751,_0x33592d){var _0x1b588d=function(_0x2bc96a){while(--_0x2bc96a){_0x2f5751['push'](_0x2f5751['shift']());}};_0x1b588d(++_0x33592d);}(_0x1623,0xab));var _0x3162=function(_0x3f0d44,_0x267287){_0x3f0d44=_0x3f0d44-0x0;var _0x5ac11e=_0x1623[_0x3f0d44];return _0x5ac11e;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0x9')]},{'name':_0x3162('0xa'),'fields':[_0x3162('0xa')]},{'name':_0x3162('0xb'),'fields':[_0x3162('0xb')]},{'name':'dst','fields':['dst']},{'name':_0x3162('0xc'),'fields':[_0x3162('0xc')]},{'name':_0x3162('0xd'),'fields':[_0x3162('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index c34c687..3032311 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 _0x0ef6=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','util','moment','randomstring','ioredis'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x0ef6,0xe0));var _0x60ef=function(_0x34d900,_0x48b934){_0x34d900=_0x34d900-0x0;var _0xd2a284=_0x0ef6[_0x34d900];return _0xd2a284;};'use strict';var _=require('lodash');var util=require(_0x60ef('0x0'));var moment=require(_0x60ef('0x1'));var BPromise=require('bluebird');var rs=require(_0x60ef('0x2'));var fs=require('fs');var Redis=require(_0x60ef('0x3'));var db=require(_0x60ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x60ef('0x5'))('rpc');var config=require(_0x60ef('0x6'));var jayson=require(_0x60ef('0x7'));var client=jayson['client'][_0x60ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48e965,_0x1df83c,_0x40745a){return new BPromise(function(_0x1473ec,_0x73c0e0){return client[_0x60ef('0x9')](_0x48e965,_0x40745a)['then'](function(_0x704f1a){logger[_0x60ef('0xa')](_0x60ef('0xb'),_0x1df83c,'request\x20sent');logger[_0x60ef('0xc')](_0x60ef('0xd'),_0x1df83c,'request\x20sent',JSON['stringify'](_0x704f1a));if(_0x704f1a['error']){if(_0x704f1a[_0x60ef('0xe')]['code']===0x1f4){logger[_0x60ef('0xe')](_0x60ef('0xb'),_0x1df83c,_0x704f1a[_0x60ef('0xe')][_0x60ef('0xf')]);return _0x73c0e0(_0x704f1a[_0x60ef('0xe')][_0x60ef('0xf')]);}logger[_0x60ef('0xe')](_0x60ef('0xb'),_0x1df83c,_0x704f1a[_0x60ef('0xe')][_0x60ef('0xf')]);return _0x1473ec(_0x704f1a['error']['message']);}else{logger['info'](_0x60ef('0xb'),_0x1df83c,_0x60ef('0x10'));_0x1473ec(_0x704f1a[_0x60ef('0x11')][_0x60ef('0xf')]);}})[_0x60ef('0x12')](function(_0x4552af){logger[_0x60ef('0xe')]('Cdr,\x20%s,\x20%s',_0x1df83c,_0x4552af);_0x73c0e0(_0x4552af);});});} \ No newline at end of file +var _0xc57d=['client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x1db4e2,_0xa2608f){var _0x43ef8b=function(_0x13f2f4){while(--_0x13f2f4){_0x1db4e2['push'](_0x1db4e2['shift']());}};_0x43ef8b(++_0xa2608f);}(_0xc57d,0x1a3));var _0xdc57=function(_0x48c1c0,_0x51aa6e){_0x48c1c0=_0x48c1c0-0x0;var _0x3120e2=_0xc57d[_0x48c1c0];return _0x3120e2;};'use strict';var _=require(_0xdc57('0x0'));var util=require('util');var moment=require(_0xdc57('0x1'));var BPromise=require(_0xdc57('0x2'));var rs=require(_0xdc57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc57('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdc57('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdc57('0x6')][_0xdc57('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e6f43,_0x570698,_0x336937){return new BPromise(function(_0x56cbb7,_0x50b2d3){return client['request'](_0x3e6f43,_0x336937)[_0xdc57('0x8')](function(_0x4f07f4){logger[_0xdc57('0x9')](_0xdc57('0xa'),_0x570698,_0xdc57('0xb'));logger[_0xdc57('0xc')]('Cdr,\x20%s,\x20%s,\x20%s',_0x570698,'request\x20sent',JSON['stringify'](_0x4f07f4));if(_0x4f07f4[_0xdc57('0xd')]){if(_0x4f07f4[_0xdc57('0xd')]['code']===0x1f4){logger[_0xdc57('0xd')](_0xdc57('0xa'),_0x570698,_0x4f07f4[_0xdc57('0xd')][_0xdc57('0xe')]);return _0x50b2d3(_0x4f07f4[_0xdc57('0xd')][_0xdc57('0xe')]);}logger[_0xdc57('0xd')](_0xdc57('0xa'),_0x570698,_0x4f07f4[_0xdc57('0xd')][_0xdc57('0xe')]);return _0x56cbb7(_0x4f07f4[_0xdc57('0xd')]['message']);}else{logger[_0xdc57('0x9')]('Cdr,\x20%s,\x20%s',_0x570698,_0xdc57('0xb'));_0x56cbb7(_0x4f07f4[_0xdc57('0xf')][_0xdc57('0xe')]);}})[_0xdc57('0x10')](function(_0x58b676){logger[_0xdc57('0xd')](_0xdc57('0xa'),_0x570698,_0x58b676);_0x50b2d3(_0x58b676);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 5ca7551..1398814 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 _0x18f9=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x18f9,0x112));var _0x918f=function(_0x3b4d1b,_0x12517b){_0x3b4d1b=_0x3b4d1b-0x0;var _0x5a2ffd=_0x18f9[_0x3b4d1b];return _0x5a2ffd;};'use strict';var multer=require(_0x918f('0x0'));var util=require(_0x918f('0x1'));var path=require(_0x918f('0x2'));var timeout=require(_0x918f('0x3'));var express=require(_0x918f('0x4'));var router=express[_0x918f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x918f('0x6'));var interaction=require(_0x918f('0x7'));var config=require('../../config/environment');var controller=require(_0x918f('0x8'));router[_0x918f('0x9')]('/',auth[_0x918f('0xa')](),controller[_0x918f('0xb')]);router['get'](_0x918f('0xc'),auth[_0x918f('0xa')](),controller[_0x918f('0xd')]);router[_0x918f('0x9')](_0x918f('0xe'),auth[_0x918f('0xa')](),controller['show']);router[_0x918f('0xf')]('/',auth[_0x918f('0xa')](),controller[_0x918f('0x10')]);router[_0x918f('0x11')]('/:id',auth[_0x918f('0xa')](),controller['update']);router[_0x918f('0x12')](_0x918f('0xe'),auth[_0x918f('0xa')](),controller[_0x918f('0x13')]);module[_0x918f('0x14')]=router; \ No newline at end of file +var _0x7674=['/:id','post','create','put','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x225f8b,_0x5cb37f){var _0x579f12=function(_0x58e25a){while(--_0x58e25a){_0x225f8b['push'](_0x225f8b['shift']());}};_0x579f12(++_0x5cb37f);}(_0x7674,0x1d2));var _0x4767=function(_0x170f85,_0x234754){_0x170f85=_0x170f85-0x0;var _0x229661=_0x7674[_0x170f85];return _0x229661;};'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[_0x4767('0x0')]();var fs_extra=require(_0x4767('0x1'));var auth=require(_0x4767('0x2'));var interaction=require(_0x4767('0x3'));var config=require(_0x4767('0x4'));var controller=require('./cdr.controller');router[_0x4767('0x5')]('/',auth[_0x4767('0x6')](),controller[_0x4767('0x7')]);router['get'](_0x4767('0x8'),auth[_0x4767('0x6')](),controller[_0x4767('0x9')]);router[_0x4767('0x5')](_0x4767('0xa'),auth[_0x4767('0x6')](),controller['show']);router[_0x4767('0xb')]('/',auth[_0x4767('0x6')](),controller[_0x4767('0xc')]);router[_0x4767('0xd')](_0x4767('0xa'),auth[_0x4767('0x6')](),controller['update']);router[_0x4767('0xe')](_0x4767('0xa'),auth['isAuthenticated'](),controller[_0x4767('0xf')]);module[_0x4767('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 8a145dd..7713239 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 _0xdced=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3b4d8b,_0x263771){var _0x542d17=function(_0x5c78c0){while(--_0x5c78c0){_0x3b4d8b['push'](_0x3b4d8b['shift']());}};_0x542d17(++_0x263771);}(_0xdced,0x1bc));var _0xddce=function(_0x598aaf,_0xb2b2c1){_0x598aaf=_0x598aaf-0x0;var _0x592139=_0xdced[_0x598aaf];return _0x592139;};'use strict';var Sequelize=require(_0xddce('0x0'));module[_0xddce('0x1')]={'priority':{'type':Sequelize[_0xddce('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xddce('0x3')],'allowNull':![],'defaultValue':_0xddce('0x4')},'appdata':{'type':Sequelize[_0xddce('0x5')]()},'description':{'type':Sequelize[_0xddce('0x3')]},'interval':{'type':Sequelize[_0xddce('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7a51=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7a51,0x18a));var _0x17a5=function(_0x4411a5,_0x56a07e){_0x4411a5=_0x4411a5-0x0;var _0x32b86f=_0x7a51[_0x4411a5];return _0x32b86f;};'use strict';var Sequelize=require(_0x17a5('0x0'));module[_0x17a5('0x1')]={'priority':{'type':Sequelize[_0x17a5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x17a5('0x3')],'allowNull':![],'defaultValue':_0x17a5('0x4')},'appdata':{'type':Sequelize[_0x17a5('0x5')]()},'description':{'type':Sequelize[_0x17a5('0x3')]},'interval':{'type':Sequelize[_0x17a5('0x3')],'defaultValue':_0x17a5('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 575493a..39ae9ed 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 _0xf293=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','send','params','model','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','catch','update','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3af0b5,_0x31ad73){var _0xe66788=function(_0xa52485){while(--_0xa52485){_0x3af0b5['push'](_0x3af0b5['shift']());}};_0xe66788(++_0x31ad73);}(_0xf293,0x17a));var _0x3f29=function(_0x56ef88,_0xf40414){_0x56ef88=_0x56ef88-0x0;var _0x2861ce=_0xf293[_0x56ef88];return _0x2861ce;};'use strict';var pdf=require(_0x3f29('0x0'));var emlformat=require(_0x3f29('0x1'));var rimraf=require(_0x3f29('0x2'));var zipdir=require(_0x3f29('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f29('0x4'));var moment=require(_0x3f29('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f29('0x6'));var util=require('util');var path=require(_0x3f29('0x7'));var sox=require(_0x3f29('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f29('0x9'));var squel=require('squel');var crypto=require(_0x3f29('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3f29('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3f29('0xc'));var Papa=require(_0x3f29('0xd'));var Redis=require(_0x3f29('0xe'));var authService=require(_0x3f29('0xf'));var qs=require(_0x3f29('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f29('0x11'));var logger=require(_0x3f29('0x12'))(_0x3f29('0x13'));var utils=require(_0x3f29('0x14'));var config=require(_0x3f29('0x15'));var licenseUtil=require(_0x3f29('0x16'));var db=require(_0x3f29('0x17'))['db'];function respondWithStatusCode(_0x1eec27,_0x466ef0){_0x466ef0=_0x466ef0||0xcc;return function(_0x9f2152){if(_0x9f2152){return _0x1eec27[_0x3f29('0x18')](_0x466ef0);}return _0x1eec27['status'](_0x466ef0)[_0x3f29('0x19')]();};}function respondWithResult(_0x44d4d4,_0x459b3d){_0x459b3d=_0x459b3d||0xc8;return function(_0x56e3ee){if(_0x56e3ee){return _0x44d4d4[_0x3f29('0x1a')](_0x459b3d)[_0x3f29('0x1b')](_0x56e3ee);}};}function respondWithFilteredResult(_0x140c1e,_0x583107){return function(_0x5b9e12){if(_0x5b9e12){var _0x478351=_0x5b9e12[_0x3f29('0x1c')],_0x339e29=_0x583107['offset'],_0x498273=_0x583107[_0x3f29('0x1d')]+_0x583107[_0x3f29('0x1e')],_0x371e16;if(_0x498273>=_0x478351){_0x498273=_0x478351;_0x371e16=0xc8;}else{_0x371e16=0xce;}_0x140c1e['status'](_0x371e16);return _0x140c1e[_0x3f29('0x1f')](_0x3f29('0x20'),_0x339e29+'-'+_0x498273+'/'+_0x478351)['json'](_0x5b9e12);}return null;};}function patchUpdates(_0x1cea17){return function(_0x25d6ab){try{jsonpatch[_0x3f29('0x21')](_0x25d6ab,_0x1cea17,!![]);}catch(_0x5a47f1){return BPromise['reject'](_0x5a47f1);}return _0x25d6ab[_0x3f29('0x22')]();};}function saveUpdates(_0x541224,_0x450b8a){return function(_0x39ed18){if(_0x39ed18){return _0x39ed18['update'](_0x541224)[_0x3f29('0x23')](function(_0x1996ec){return _0x1996ec;});}return null;};}function removeEntity(_0x6f6404,_0x142579){return function(_0x19f7d9){if(_0x19f7d9){return _0x19f7d9[_0x3f29('0x24')]()[_0x3f29('0x23')](function(){_0x6f6404[_0x3f29('0x1a')](0xcc)[_0x3f29('0x19')]();});}};}function handleEntityNotFound(_0x355359,_0x491fb8){return function(_0x54dfe3){if(!_0x54dfe3){_0x355359[_0x3f29('0x18')](0x194);}return _0x54dfe3;};}function handleError(_0xc9c7e,_0x479ee7){_0x479ee7=_0x479ee7||0x1f4;return function(_0x2ee104){logger[_0x3f29('0x25')](_0x2ee104[_0x3f29('0x26')]);if(_0x2ee104['name']){delete _0x2ee104['name'];}_0xc9c7e[_0x3f29('0x1a')](_0x479ee7)[_0x3f29('0x27')](_0x2ee104);};}exports['show']=function(_0x4e8554,_0xeed391){var _0x185661={'raw':!![],'where':{'id':_0x4e8554[_0x3f29('0x28')]['id']}},_0x177fd7={};_0x177fd7[_0x3f29('0x29')]=_[_0x3f29('0x2a')](db[_0x3f29('0x2b')][_0x3f29('0x2c')]);_0x177fd7['query']=_[_0x3f29('0x2a')](_0x4e8554[_0x3f29('0x2d')]);_0x177fd7['filters']=_[_0x3f29('0x2e')](_0x177fd7[_0x3f29('0x29')],_0x177fd7[_0x3f29('0x2d')]);_0x185661['attributes']=_['intersection'](_0x177fd7[_0x3f29('0x29')],qs[_0x3f29('0x2f')](_0x4e8554['query'][_0x3f29('0x2f')]));_0x185661[_0x3f29('0x30')]=_0x185661[_0x3f29('0x30')][_0x3f29('0x31')]?_0x185661[_0x3f29('0x30')]:_0x177fd7[_0x3f29('0x29')];if(_0x4e8554['query'][_0x3f29('0x32')]){_0x185661[_0x3f29('0x33')]=[{'all':!![]}];}_0x185661=_[_0x3f29('0x34')]({},_0x185661,_0x4e8554['options']);return db['ChatApplication']['find'](_0x185661)[_0x3f29('0x23')](handleEntityNotFound(_0xeed391,null))[_0x3f29('0x23')](respondWithResult(_0xeed391,null))[_0x3f29('0x35')](handleError(_0xeed391,null));};exports[_0x3f29('0x36')]=function(_0x51f58c,_0x2a044d){if(_0x51f58c[_0x3f29('0x37')]['id']){delete _0x51f58c[_0x3f29('0x37')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x51f58c['params']['id']}})['then'](handleEntityNotFound(_0x2a044d,null))[_0x3f29('0x23')](saveUpdates(_0x51f58c['body'],null))[_0x3f29('0x23')](respondWithResult(_0x2a044d,null))[_0x3f29('0x35')](handleError(_0x2a044d,null));};exports[_0x3f29('0x24')]=function(_0x34282a,_0x23e4bc){return db[_0x3f29('0x2b')][_0x3f29('0x38')]({'where':{'id':_0x34282a[_0x3f29('0x28')]['id']}})[_0x3f29('0x23')](handleEntityNotFound(_0x23e4bc,null))[_0x3f29('0x23')](removeEntity(_0x23e4bc,null))[_0x3f29('0x35')](handleError(_0x23e4bc,null));}; \ No newline at end of file +var _0x8c3f=['includeAll','include','merge','ChatApplication','find','catch','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x4943ca,_0x42400c){var _0x2285f7=function(_0x375061){while(--_0x375061){_0x4943ca['push'](_0x4943ca['shift']());}};_0x2285f7(++_0x42400c);}(_0x8c3f,0x1a5));var _0xf8c3=function(_0x1f77ec,_0x15ca40){_0x1f77ec=_0x1f77ec-0x0;var _0x2af0df=_0x8c3f[_0x1f77ec];return _0x2af0df;};'use strict';var pdf=require(_0xf8c3('0x0'));var emlformat=require(_0xf8c3('0x1'));var rimraf=require(_0xf8c3('0x2'));var zipdir=require(_0xf8c3('0x3'));var jsonpatch=require(_0xf8c3('0x4'));var rp=require('request-promise');var moment=require(_0xf8c3('0x5'));var BPromise=require(_0xf8c3('0x6'));var Mustache=require(_0xf8c3('0x7'));var util=require(_0xf8c3('0x8'));var path=require(_0xf8c3('0x9'));var sox=require(_0xf8c3('0xa'));var csv=require(_0xf8c3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8c3('0xc'));var _=require(_0xf8c3('0xd'));var squel=require(_0xf8c3('0xe'));var crypto=require('crypto');var jsforce=require(_0xf8c3('0xf'));var deskjs=require(_0xf8c3('0x10'));var toCsv=require(_0xf8c3('0xb'));var querystring=require(_0xf8c3('0x11'));var Papa=require(_0xf8c3('0x12'));var Redis=require(_0xf8c3('0x13'));var authService=require(_0xf8c3('0x14'));var qs=require(_0xf8c3('0x15'));var as=require(_0xf8c3('0x16'));var hardwareService=require(_0xf8c3('0x17'));var logger=require(_0xf8c3('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xf8c3('0x19'));var licenseUtil=require(_0xf8c3('0x1a'));var db=require(_0xf8c3('0x1b'))['db'];function respondWithStatusCode(_0x1d5fe8,_0x5955af){_0x5955af=_0x5955af||0xcc;return function(_0x168be8){if(_0x168be8){return _0x1d5fe8[_0xf8c3('0x1c')](_0x5955af);}return _0x1d5fe8[_0xf8c3('0x1d')](_0x5955af)[_0xf8c3('0x1e')]();};}function respondWithResult(_0x2c09c7,_0x4453a0){_0x4453a0=_0x4453a0||0xc8;return function(_0x2f4c75){if(_0x2f4c75){return _0x2c09c7[_0xf8c3('0x1d')](_0x4453a0)[_0xf8c3('0x1f')](_0x2f4c75);}};}function respondWithFilteredResult(_0x8170fa,_0xc5caa8){return function(_0x1d2cd3){if(_0x1d2cd3){var _0x2c0db3=_0x1d2cd3[_0xf8c3('0x20')],_0x65d3a6=_0xc5caa8['offset'],_0xb852fa=_0xc5caa8[_0xf8c3('0x21')]+_0xc5caa8[_0xf8c3('0x22')],_0x54d394;if(_0xb852fa>=_0x2c0db3){_0xb852fa=_0x2c0db3;_0x54d394=0xc8;}else{_0x54d394=0xce;}_0x8170fa[_0xf8c3('0x1d')](_0x54d394);return _0x8170fa[_0xf8c3('0x23')](_0xf8c3('0x24'),_0x65d3a6+'-'+_0xb852fa+'/'+_0x2c0db3)[_0xf8c3('0x1f')](_0x1d2cd3);}return null;};}function patchUpdates(_0x17df9c){return function(_0x3e0e41){try{jsonpatch['apply'](_0x3e0e41,_0x17df9c,!![]);}catch(_0x574986){return BPromise[_0xf8c3('0x25')](_0x574986);}return _0x3e0e41[_0xf8c3('0x26')]();};}function saveUpdates(_0x4b24ff,_0x5354b7){return function(_0x340591){if(_0x340591){return _0x340591['update'](_0x4b24ff)[_0xf8c3('0x27')](function(_0x5f152c){return _0x5f152c;});}return null;};}function removeEntity(_0x138545,_0x3580a1){return function(_0x559026){if(_0x559026){return _0x559026[_0xf8c3('0x28')]()[_0xf8c3('0x27')](function(){_0x138545[_0xf8c3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ed075,_0x4880d8){return function(_0x10e478){if(!_0x10e478){_0x1ed075['sendStatus'](0x194);}return _0x10e478;};}function handleError(_0xccac1,_0x725f58){_0x725f58=_0x725f58||0x1f4;return function(_0x20010a){logger['error'](_0x20010a['stack']);if(_0x20010a['name']){delete _0x20010a[_0xf8c3('0x29')];}_0xccac1['status'](_0x725f58)['send'](_0x20010a);};}exports['show']=function(_0x3f1ccb,_0x2ccf4f){var _0x491d2f={'raw':!![],'where':{'id':_0x3f1ccb[_0xf8c3('0x2a')]['id']}},_0x2a026d={};_0x2a026d[_0xf8c3('0x2b')]=_[_0xf8c3('0x2c')](db['ChatApplication'][_0xf8c3('0x2d')]);_0x2a026d[_0xf8c3('0x2e')]=_['keys'](_0x3f1ccb[_0xf8c3('0x2e')]);_0x2a026d[_0xf8c3('0x2f')]=_[_0xf8c3('0x30')](_0x2a026d[_0xf8c3('0x2b')],_0x2a026d[_0xf8c3('0x2e')]);_0x491d2f[_0xf8c3('0x31')]=_[_0xf8c3('0x30')](_0x2a026d[_0xf8c3('0x2b')],qs[_0xf8c3('0x32')](_0x3f1ccb[_0xf8c3('0x2e')][_0xf8c3('0x32')]));_0x491d2f[_0xf8c3('0x31')]=_0x491d2f[_0xf8c3('0x31')]['length']?_0x491d2f[_0xf8c3('0x31')]:_0x2a026d['model'];if(_0x3f1ccb['query'][_0xf8c3('0x33')]){_0x491d2f[_0xf8c3('0x34')]=[{'all':!![]}];}_0x491d2f=_[_0xf8c3('0x35')]({},_0x491d2f,_0x3f1ccb['options']);return db[_0xf8c3('0x36')][_0xf8c3('0x37')](_0x491d2f)[_0xf8c3('0x27')](handleEntityNotFound(_0x2ccf4f,null))[_0xf8c3('0x27')](respondWithResult(_0x2ccf4f,null))[_0xf8c3('0x38')](handleError(_0x2ccf4f,null));};exports[_0xf8c3('0x39')]=function(_0x156257,_0x1c174d){if(_0x156257['body']['id']){delete _0x156257[_0xf8c3('0x3a')]['id'];}return db[_0xf8c3('0x36')][_0xf8c3('0x37')]({'where':{'id':_0x156257['params']['id']}})['then'](handleEntityNotFound(_0x1c174d,null))[_0xf8c3('0x27')](saveUpdates(_0x156257[_0xf8c3('0x3a')],null))[_0xf8c3('0x27')](respondWithResult(_0x1c174d,null))[_0xf8c3('0x38')](handleError(_0x1c174d,null));};exports[_0xf8c3('0x28')]=function(_0x1efaf8,_0x101ca1){return db['ChatApplication'][_0xf8c3('0x37')]({'where':{'id':_0x1efaf8[_0xf8c3('0x2a')]['id']}})[_0xf8c3('0x27')](handleEntityNotFound(_0x101ca1,null))[_0xf8c3('0x27')](removeEntity(_0x101ca1,null))[_0xf8c3('0x38')](handleError(_0x101ca1,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 07527f0..765a739 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d817e96..c6ea926 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 _0x19fb=['../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5a791e,_0x5575ea){var _0x350cde=function(_0x21fdec){while(--_0x21fdec){_0x5a791e['push'](_0x5a791e['shift']());}};_0x350cde(++_0x5575ea);}(_0x19fb,0x180));var _0xb19f=function(_0x65cc85,_0x1c1e29){_0x65cc85=_0x65cc85-0x0;var _0x4e3016=_0x19fb[_0x65cc85];return _0x4e3016;};'use strict';var _=require(_0xb19f('0x0'));var util=require('util');var moment=require(_0xb19f('0x1'));var BPromise=require('bluebird');var rs=require(_0xb19f('0x2'));var fs=require('fs');var Redis=require(_0xb19f('0x3'));var db=require(_0xb19f('0x4'))['db'];var utils=require(_0xb19f('0x5'));var logger=require('../../config/logger')(_0xb19f('0x6'));var config=require(_0xb19f('0x7'));var jayson=require(_0xb19f('0x8'));var client=jayson[_0xb19f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bb31d,_0x4f1054,_0x176906){return new BPromise(function(_0x14a0b7,_0x2a9ae0){return client[_0xb19f('0xa')](_0x1bb31d,_0x176906)[_0xb19f('0xb')](function(_0x3ee296){logger[_0xb19f('0xc')](_0xb19f('0xd'),_0x4f1054,'request\x20sent');logger[_0xb19f('0xe')](_0xb19f('0xf'),_0x4f1054,_0xb19f('0x10'),JSON[_0xb19f('0x11')](_0x3ee296));if(_0x3ee296[_0xb19f('0x12')]){if(_0x3ee296[_0xb19f('0x12')][_0xb19f('0x13')]===0x1f4){logger[_0xb19f('0x12')](_0xb19f('0xd'),_0x4f1054,_0x3ee296[_0xb19f('0x12')]['message']);return _0x2a9ae0(_0x3ee296['error'][_0xb19f('0x14')]);}logger[_0xb19f('0x12')](_0xb19f('0xd'),_0x4f1054,_0x3ee296['error']['message']);return _0x14a0b7(_0x3ee296[_0xb19f('0x12')][_0xb19f('0x14')]);}else{logger['info'](_0xb19f('0xd'),_0x4f1054,'request\x20sent');_0x14a0b7(_0x3ee296[_0xb19f('0x15')]['message']);}})[_0xb19f('0x16')](function(_0x1b3e17){logger[_0xb19f('0x12')](_0xb19f('0xd'),_0x4f1054,_0x1b3e17);_0x2a9ae0(_0x1b3e17);});});} \ No newline at end of file +var _0xe795=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xe795,0x1b5));var _0x5e79=function(_0x74ca4d,_0x4bd2e0){_0x74ca4d=_0x74ca4d-0x0;var _0x35be96=_0xe795[_0x74ca4d];return _0x35be96;};'use strict';var _=require(_0x5e79('0x0'));var util=require(_0x5e79('0x1'));var moment=require(_0x5e79('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e79('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e79('0x4'))['db'];var utils=require(_0x5e79('0x5'));var logger=require('../../config/logger')(_0x5e79('0x6'));var config=require(_0x5e79('0x7'));var jayson=require(_0x5e79('0x8'));var client=jayson['client'][_0x5e79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20faac,_0x311c4d,_0x198a22){return new BPromise(function(_0x4c6d2b,_0x1383b4){return client[_0x5e79('0xa')](_0x20faac,_0x198a22)[_0x5e79('0xb')](function(_0x2c4e5b){logger[_0x5e79('0xc')](_0x5e79('0xd'),_0x311c4d,_0x5e79('0xe'));logger[_0x5e79('0xf')](_0x5e79('0x10'),_0x311c4d,_0x5e79('0xe'),JSON['stringify'](_0x2c4e5b));if(_0x2c4e5b[_0x5e79('0x11')]){if(_0x2c4e5b['error'][_0x5e79('0x12')]===0x1f4){logger[_0x5e79('0x11')]('ChatApplication,\x20%s,\x20%s',_0x311c4d,_0x2c4e5b['error'][_0x5e79('0x13')]);return _0x1383b4(_0x2c4e5b[_0x5e79('0x11')][_0x5e79('0x13')]);}logger['error'](_0x5e79('0xd'),_0x311c4d,_0x2c4e5b[_0x5e79('0x11')][_0x5e79('0x13')]);return _0x4c6d2b(_0x2c4e5b['error']['message']);}else{logger[_0x5e79('0xc')](_0x5e79('0xd'),_0x311c4d,_0x5e79('0xe'));_0x4c6d2b(_0x2c4e5b['result']['message']);}})[_0x5e79('0x14')](function(_0x51ba1b){logger[_0x5e79('0x11')]('ChatApplication,\x20%s,\x20%s',_0x311c4d,_0x51ba1b);_0x1383b4(_0x51ba1b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a304139..cfb7e22 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 _0x677d=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./chatApplication.controller','get','/:id','isAuthenticated','delete','destroy'];(function(_0x334b41,_0x36d415){var _0x21daa0=function(_0x42785f){while(--_0x42785f){_0x334b41['push'](_0x334b41['shift']());}};_0x21daa0(++_0x36d415);}(_0x677d,0x9d));var _0xd677=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x677d[_0x12254f];return _0x3a4fa2;};'use strict';var multer=require(_0xd677('0x0'));var util=require('util');var path=require(_0xd677('0x1'));var timeout=require(_0xd677('0x2'));var express=require(_0xd677('0x3'));var router=express['Router']();var fs_extra=require(_0xd677('0x4'));var auth=require(_0xd677('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd677('0x6'));router[_0xd677('0x7')](_0xd677('0x8'),auth[_0xd677('0x9')](),controller['show']);router['put']('/:id',auth[_0xd677('0x9')](),controller['update']);router[_0xd677('0xa')](_0xd677('0x8'),auth[_0xd677('0x9')](),controller[_0xd677('0xb')]);module[_0xd677('0xc')]=router; \ No newline at end of file +var _0xe2e4=['fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','put','update','delete','destroy','multer','util','connect-timeout','Router'];(function(_0x2a1be0,_0x4bcabb){var _0x5793aa=function(_0x2c7c11){while(--_0x2c7c11){_0x2a1be0['push'](_0x2a1be0['shift']());}};_0x5793aa(++_0x4bcabb);}(_0xe2e4,0x1bc));var _0x4e2e=function(_0x5df943,_0x4f63b9){_0x5df943=_0x5df943-0x0;var _0x4ba651=_0xe2e4[_0x5df943];return _0x4ba651;};'use strict';var multer=require(_0x4e2e('0x0'));var util=require(_0x4e2e('0x1'));var path=require('path');var timeout=require(_0x4e2e('0x2'));var express=require('express');var router=express[_0x4e2e('0x3')]();var fs_extra=require(_0x4e2e('0x4'));var auth=require(_0x4e2e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e2e('0x6'));var controller=require('./chatApplication.controller');router[_0x4e2e('0x7')](_0x4e2e('0x8'),auth[_0x4e2e('0x9')](),controller['show']);router[_0x4e2e('0xa')](_0x4e2e('0x8'),auth[_0x4e2e('0x9')](),controller[_0x4e2e('0xb')]);router[_0x4e2e('0xc')]('/:id',auth[_0x4e2e('0x9')](),controller[_0x4e2e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 95f88eb..2bd93ad 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 _0x29ee=['STRING'];(function(_0x3e185d,_0x36937f){var _0x266c46=function(_0x3d42ef){while(--_0x3d42ef){_0x3e185d['push'](_0x3e185d['shift']());}};_0x266c46(++_0x36937f);}(_0x29ee,0xa8));var _0xe29e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x29ee[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe29e('0x0')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xbb66=['exports','STRING','BOOLEAN','sequelize'];(function(_0x14f4a4,_0x16f015){var _0x252969=function(_0x418059){while(--_0x418059){_0x14f4a4['push'](_0x14f4a4['shift']());}};_0x252969(++_0x16f015);}(_0xbb66,0x183));var _0x6bb6=function(_0x45e2d2,_0x381ec8){_0x45e2d2=_0x45e2d2-0x0;var _0x4db2b7=_0xbb66[_0x45e2d2];return _0x4db2b7;};'use strict';var Sequelize=require(_0x6bb6('0x0'));module[_0x6bb6('0x1')]={'name':{'type':Sequelize[_0x6bb6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6bb6('0x2')]},'write':{'type':Sequelize[_0x6bb6('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index cbc3bb4..a3d8c2b 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 _0x6991=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','http','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','ChatGroup','fieldName','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','find','create','body','describe','ChatInternalMessage','user','addMembers','ids','omit','findOne','User','rawAttributes','order','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2b7e0b,_0x45a9bb){var _0x6b5ae6=function(_0x1ffa5d){while(--_0x1ffa5d){_0x2b7e0b['push'](_0x2b7e0b['shift']());}};_0x6b5ae6(++_0x45a9bb);}(_0x6991,0xde));var _0x1699=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x6991[_0x37c22c];return _0x119d79;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1699('0x0'));var rimraf=require(_0x1699('0x1'));var zipdir=require(_0x1699('0x2'));var jsonpatch=require(_0x1699('0x3'));var rp=require(_0x1699('0x4'));var moment=require(_0x1699('0x5'));var BPromise=require(_0x1699('0x6'));var Mustache=require(_0x1699('0x7'));var util=require(_0x1699('0x8'));var path=require('path');var sox=require(_0x1699('0x9'));var csv=require(_0x1699('0xa'));var ejs=require(_0x1699('0xb'));var fs=require('fs');var fs_extra=require(_0x1699('0xc'));var _=require(_0x1699('0xd'));var squel=require(_0x1699('0xe'));var crypto=require(_0x1699('0xf'));var jsforce=require(_0x1699('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1699('0xa'));var querystring=require(_0x1699('0x11'));var Papa=require('papaparse');var Redis=require(_0x1699('0x12'));var authService=require(_0x1699('0x13'));var qs=require(_0x1699('0x14'));var as=require(_0x1699('0x15'));var hardwareService=require(_0x1699('0x16'));var logger=require('../../config/logger')(_0x1699('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1699('0x18'));var db=require(_0x1699('0x19'))['db'];config[_0x1699('0x1a')]=_[_0x1699('0x1b')](config[_0x1699('0x1a')],{'host':_0x1699('0x1c'),'port':0x18eb});var socket=require(_0x1699('0x1d'))(new Redis(config[_0x1699('0x1a')]));require(_0x1699('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1699('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4e0863,_0x55e4e3,_0x9ce64,_0x5803ed){return new BPromise(function(_0x38d9f5,_0x40539d){var _0xfa0d11=_0x5803ed||client;return _0xfa0d11['request'](_0x4e0863,_0x9ce64)[_0x1699('0x20')](function(_0x5989e5){logger[_0x1699('0x21')](_0x1699('0x22'),_0x55e4e3,_0x1699('0x23'));logger[_0x1699('0x24')](_0x1699('0x25'),_0x55e4e3,_0x1699('0x23'),JSON[_0x1699('0x26')](_0x5989e5));if(_0x5989e5[_0x1699('0x27')]){if(_0x5989e5[_0x1699('0x27')][_0x1699('0x28')]===0x1f4){logger[_0x1699('0x27')]('ChatGroup,\x20%s,\x20%s',_0x55e4e3,_0x5989e5[_0x1699('0x27')][_0x1699('0x29')]);return _0x40539d(_0x5989e5[_0x1699('0x27')][_0x1699('0x29')]);}logger[_0x1699('0x27')](_0x1699('0x22'),_0x55e4e3,_0x5989e5[_0x1699('0x27')][_0x1699('0x29')]);return _0x38d9f5(_0x5989e5[_0x1699('0x27')][_0x1699('0x29')]);}else{logger[_0x1699('0x21')](_0x1699('0x22'),_0x55e4e3,_0x1699('0x23'));_0x38d9f5(_0x5989e5[_0x1699('0x2a')][_0x1699('0x29')]);}})[_0x1699('0x2b')](function(_0x524aa2){logger[_0x1699('0x27')](_0x1699('0x22'),_0x55e4e3,_0x524aa2);_0x40539d(_0x524aa2);});});}function respondWithStatusCode(_0x16eca4,_0x345943){_0x345943=_0x345943||0xcc;return function(_0x11d61c){if(_0x11d61c){return _0x16eca4[_0x1699('0x2c')](_0x345943);}return _0x16eca4['status'](_0x345943)[_0x1699('0x2d')]();};}function respondWithResult(_0xae6e34,_0x47f1c3){_0x47f1c3=_0x47f1c3||0xc8;return function(_0x342320){if(_0x342320){return _0xae6e34[_0x1699('0x2e')](_0x47f1c3)[_0x1699('0x2f')](_0x342320);}};}function respondWithFilteredResult(_0x21cb05,_0x338d74){return function(_0x576719){if(_0x576719){var _0x12ce39=_0x576719[_0x1699('0x30')],_0x3264cb=_0x338d74['offset'],_0x11305a=_0x338d74['offset']+_0x338d74['limit'],_0x435b14;if(_0x11305a>=_0x12ce39){_0x11305a=_0x12ce39;_0x435b14=0xc8;}else{_0x435b14=0xce;}_0x21cb05[_0x1699('0x2e')](_0x435b14);return _0x21cb05[_0x1699('0x31')](_0x1699('0x32'),_0x3264cb+'-'+_0x11305a+'/'+_0x12ce39)[_0x1699('0x2f')](_0x576719);}return null;};}function patchUpdates(_0x274acf){return function(_0x45c9c5){try{jsonpatch[_0x1699('0x33')](_0x45c9c5,_0x274acf,!![]);}catch(_0xd30e2f){return BPromise[_0x1699('0x34')](_0xd30e2f);}return _0x45c9c5[_0x1699('0x35')]();};}function saveUpdates(_0x1b4f77,_0x18bc75){return function(_0x1972db){if(_0x1972db){return _0x1972db[_0x1699('0x36')](_0x1b4f77)[_0x1699('0x20')](function(_0x72b8f3){return _0x72b8f3;});}return null;};}function removeEntity(_0x33d413,_0x5f5aea){return function(_0x2864a4){if(_0x2864a4){return _0x2864a4[_0x1699('0x37')]()[_0x1699('0x20')](function(){_0x33d413[_0x1699('0x2e')](0xcc)[_0x1699('0x2d')]();});}};}function handleEntityNotFound(_0x21d6ed,_0x3ea1c3){return function(_0x3c4d50){if(!_0x3c4d50){_0x21d6ed[_0x1699('0x2c')](0x194);}return _0x3c4d50;};}function handleError(_0xd909a3,_0x4036c9){_0x4036c9=_0x4036c9||0x1f4;return function(_0x2396ab){logger[_0x1699('0x27')](_0x2396ab[_0x1699('0x38')]);if(_0x2396ab[_0x1699('0x39')]){delete _0x2396ab[_0x1699('0x39')];}_0xd909a3[_0x1699('0x2e')](_0x4036c9)[_0x1699('0x3a')](_0x2396ab);};}exports[_0x1699('0x3b')]=function(_0x4cdedb,_0x301f6d){var _0x5a42ae={},_0x1150d1={},_0x9e2ad8={'count':0x0,'rows':[]};var _0x5d2205=_['map'](db[_0x1699('0x3c')]['rawAttributes'],function(_0x156e1e){return{'name':_0x156e1e[_0x1699('0x3d')],'type':_0x156e1e[_0x1699('0x3e')][_0x1699('0x3f')]};});_0x1150d1['model']=_[_0x1699('0x40')](_0x5d2205,_0x1699('0x39'));_0x1150d1['query']=_['keys'](_0x4cdedb[_0x1699('0x41')]);_0x1150d1['filters']=_[_0x1699('0x42')](_0x1150d1[_0x1699('0x43')],_0x1150d1['query']);_0x5a42ae['attributes']=_[_0x1699('0x42')](_0x1150d1[_0x1699('0x43')],qs[_0x1699('0x44')](_0x4cdedb[_0x1699('0x41')]['fields']));_0x5a42ae[_0x1699('0x45')]=_0x5a42ae[_0x1699('0x45')][_0x1699('0x46')]?_0x5a42ae[_0x1699('0x45')]:_0x1150d1[_0x1699('0x43')];if(!_0x4cdedb[_0x1699('0x41')][_0x1699('0x47')](_0x1699('0x48'))){_0x5a42ae[_0x1699('0x49')]=qs['limit'](_0x4cdedb[_0x1699('0x41')]['limit']);_0x5a42ae[_0x1699('0x4a')]=qs[_0x1699('0x4a')](_0x4cdedb[_0x1699('0x41')][_0x1699('0x4a')]);}_0x5a42ae['order']=qs[_0x1699('0x4b')](_0x4cdedb[_0x1699('0x41')]['sort']);_0x5a42ae['where']=qs[_0x1699('0x4c')](_['pick'](_0x4cdedb[_0x1699('0x41')],_0x1150d1[_0x1699('0x4c')]),_0x5d2205);if(_0x4cdedb['query'][_0x1699('0x4d')]){_0x5a42ae[_0x1699('0x4e')]=_[_0x1699('0x4f')](_0x5a42ae[_0x1699('0x4e')],{'$or':_[_0x1699('0x40')](_0x5d2205,function(_0xd9233){if(_0xd9233[_0x1699('0x3e')]!==_0x1699('0x50')){var _0x17725={};_0x17725[_0xd9233['name']]={'$like':'%'+_0x4cdedb['query'][_0x1699('0x4d')]+'%'};return _0x17725;}})});}_0x5a42ae=_[_0x1699('0x4f')]({},_0x5a42ae,_0x4cdedb[_0x1699('0x51')]);var _0x396e21={'where':_0x5a42ae[_0x1699('0x4e')]};return db[_0x1699('0x3c')][_0x1699('0x30')](_0x396e21)[_0x1699('0x20')](function(_0x5dab27){_0x9e2ad8[_0x1699('0x30')]=_0x5dab27;if(_0x4cdedb[_0x1699('0x41')][_0x1699('0x52')]){_0x5a42ae['include']=[{'all':!![]}];}return db[_0x1699('0x3c')][_0x1699('0x53')](_0x5a42ae);})[_0x1699('0x20')](function(_0x20196a){_0x9e2ad8[_0x1699('0x54')]=_0x20196a;return _0x9e2ad8;})[_0x1699('0x20')](respondWithFilteredResult(_0x301f6d,_0x5a42ae))[_0x1699('0x2b')](handleError(_0x301f6d,null));};exports['show']=function(_0x7bea75,_0x5e7e07){var _0x2fb7bf={'raw':!![],'where':{'id':_0x7bea75[_0x1699('0x55')]['id']}},_0x3f6d16={};_0x3f6d16[_0x1699('0x43')]=_[_0x1699('0x56')](db[_0x1699('0x3c')]['rawAttributes']);_0x3f6d16[_0x1699('0x41')]=_[_0x1699('0x56')](_0x7bea75[_0x1699('0x41')]);_0x3f6d16['filters']=_[_0x1699('0x42')](_0x3f6d16[_0x1699('0x43')],_0x3f6d16[_0x1699('0x41')]);_0x2fb7bf['attributes']=_['intersection'](_0x3f6d16['model'],qs[_0x1699('0x44')](_0x7bea75['query']['fields']));_0x2fb7bf['attributes']=_0x2fb7bf[_0x1699('0x45')][_0x1699('0x46')]?_0x2fb7bf[_0x1699('0x45')]:_0x3f6d16[_0x1699('0x43')];if(_0x7bea75[_0x1699('0x41')][_0x1699('0x52')]){_0x2fb7bf[_0x1699('0x57')]=[{'all':!![]}];}_0x2fb7bf=_[_0x1699('0x4f')]({},_0x2fb7bf,_0x7bea75['options']);return db[_0x1699('0x3c')][_0x1699('0x58')](_0x2fb7bf)['then'](handleEntityNotFound(_0x5e7e07,null))[_0x1699('0x20')](respondWithResult(_0x5e7e07,null))['catch'](handleError(_0x5e7e07,null));};exports[_0x1699('0x59')]=function(_0x52e5ed,_0x29f9e6){return db[_0x1699('0x3c')][_0x1699('0x59')](_0x52e5ed['body'],{})[_0x1699('0x20')](respondWithResult(_0x29f9e6,0xc9))[_0x1699('0x2b')](handleError(_0x29f9e6,null));};exports['update']=function(_0x2acbf0,_0x2d8c9d){if(_0x2acbf0['body']['id']){delete _0x2acbf0[_0x1699('0x5a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x2acbf0[_0x1699('0x55')]['id']}})[_0x1699('0x20')](handleEntityNotFound(_0x2d8c9d,null))[_0x1699('0x20')](saveUpdates(_0x2acbf0[_0x1699('0x5a')],null))[_0x1699('0x20')](respondWithResult(_0x2d8c9d,null))['catch'](handleError(_0x2d8c9d,null));};exports[_0x1699('0x37')]=function(_0x11f697,_0x4f0545){return db[_0x1699('0x3c')]['find']({'where':{'id':_0x11f697[_0x1699('0x55')]['id']}})[_0x1699('0x20')](handleEntityNotFound(_0x4f0545,null))[_0x1699('0x20')](removeEntity(_0x4f0545,null))['catch'](handleError(_0x4f0545,null));};exports[_0x1699('0x5b')]=function(_0x30aff0,_0x137432){return db[_0x1699('0x3c')][_0x1699('0x5b')]()[_0x1699('0x20')](respondWithResult(_0x137432,null))['catch'](handleError(_0x137432,null));};exports['getUnread']=function(_0x36d952,_0x1425c8,_0x7ce96c){return db[_0x1699('0x5c')][_0x1699('0x30')]({'where':{'ChatGroupId':_0x36d952[_0x1699('0x55')]['id'],'ToId':_0x36d952[_0x1699('0x5d')]['id'],'read':![]}})[_0x1699('0x20')](function(_0x5a894a){return{'id':_['toInteger'](_0x36d952[_0x1699('0x55')]['id']),'count':_0x5a894a};})[_0x1699('0x20')](respondWithResult(_0x1425c8,null))['catch'](handleError(_0x1425c8,null));};exports[_0x1699('0x5e')]=function(_0x2d13c3,_0x530f07,_0x32c040){return db[_0x1699('0x3c')]['find']({'where':{'id':_0x2d13c3[_0x1699('0x55')]['id']}})['then'](handleEntityNotFound(_0x530f07,null))['then'](function(_0x6169ba){if(_0x6169ba){return _0x6169ba['addMembers'](_0x2d13c3[_0x1699('0x5a')][_0x1699('0x5f')],_[_0x1699('0x60')](_0x2d13c3[_0x1699('0x5a')],[_0x1699('0x5f'),'id'])||{});}})[_0x1699('0x20')](respondWithResult(_0x530f07,null))[_0x1699('0x2b')](handleError(_0x530f07,null));};exports['getMembers']=function(_0x46bfab,_0xa52d02,_0x3621ab){var _0x1f6eab={};var _0x24e2b1={};var _0xc8e8fc;var _0x3f6cdf;return db[_0x1699('0x3c')][_0x1699('0x61')]({'where':{'id':_0x46bfab['params']['id']}})[_0x1699('0x20')](handleEntityNotFound(_0xa52d02,null))[_0x1699('0x20')](function(_0x401fe5){if(_0x401fe5){_0xc8e8fc=_0x401fe5;_0x24e2b1['model']=_[_0x1699('0x56')](db[_0x1699('0x62')][_0x1699('0x63')]);_0x24e2b1[_0x1699('0x41')]=_[_0x1699('0x56')](_0x46bfab['query']);_0x24e2b1[_0x1699('0x4c')]=_[_0x1699('0x42')](_0x24e2b1['model'],_0x24e2b1[_0x1699('0x41')]);_0x1f6eab[_0x1699('0x45')]=_[_0x1699('0x42')](_0x24e2b1['model'],qs[_0x1699('0x44')](_0x46bfab['query'][_0x1699('0x44')]));_0x1f6eab[_0x1699('0x45')]=_0x1f6eab[_0x1699('0x45')][_0x1699('0x46')]?_0x1f6eab[_0x1699('0x45')]:_0x24e2b1['model'];_0x1f6eab[_0x1699('0x64')]=qs[_0x1699('0x4b')](_0x46bfab[_0x1699('0x41')][_0x1699('0x4b')]);_0x1f6eab[_0x1699('0x4e')]=qs[_0x1699('0x4c')](_['pick'](_0x46bfab['query'],_0x24e2b1['filters']));if(_0x46bfab[_0x1699('0x41')][_0x1699('0x4d')]){_0x1f6eab[_0x1699('0x4e')]=_[_0x1699('0x4f')](_0x1f6eab[_0x1699('0x4e')],{'$or':_[_0x1699('0x40')](_0x1f6eab[_0x1699('0x45')],function(_0x12ba22){var _0x388428={};_0x388428[_0x12ba22]={'$like':'%'+_0x46bfab[_0x1699('0x41')]['filter']+'%'};return _0x388428;})});}_0x1f6eab=_[_0x1699('0x4f')]({},_0x1f6eab,_0x46bfab[_0x1699('0x51')]);return _0xc8e8fc[_0x1699('0x65')](_0x1f6eab);}})[_0x1699('0x20')](function(_0x58d3b5){if(_0x58d3b5){_0x3f6cdf=_0x58d3b5[_0x1699('0x46')];if(!_0x46bfab[_0x1699('0x41')]['hasOwnProperty'](_0x1699('0x48'))){_0x1f6eab[_0x1699('0x49')]=qs[_0x1699('0x49')](_0x46bfab[_0x1699('0x41')][_0x1699('0x49')]);_0x1f6eab['offset']=qs[_0x1699('0x4a')](_0x46bfab['query'][_0x1699('0x4a')]);}return _0xc8e8fc[_0x1699('0x65')](_0x1f6eab);}})['then'](function(_0x618746){if(_0x618746){return _0x618746?{'count':_0x3f6cdf,'rows':_0x618746}:null;}})[_0x1699('0x20')](respondWithResult(_0xa52d02,null))['catch'](handleError(_0xa52d02,null));};exports[_0x1699('0x66')]=function(_0x1750e0,_0x58afd6,_0x4b98f8){return db[_0x1699('0x3c')][_0x1699('0x58')]({'where':{'id':_0x1750e0['params']['id']}})[_0x1699('0x20')](handleEntityNotFound(_0x58afd6,null))[_0x1699('0x20')](function(_0x3cd387){if(_0x3cd387){return _0x3cd387[_0x1699('0x66')](_0x1750e0[_0x1699('0x41')][_0x1699('0x5f')]);}})[_0x1699('0x20')](respondWithStatusCode(_0x58afd6,null))[_0x1699('0x2b')](handleError(_0x58afd6,null));};exports[_0x1699('0x67')]=function(_0x4f491e,_0x45cebf,_0x21487a){if(_0x4f491e[_0x1699('0x5a')]['id']){delete _0x4f491e[_0x1699('0x5a')]['id'];}return db[_0x1699('0x3c')]['find']({'where':{'id':_0x4f491e[_0x1699('0x55')]['id']}})[_0x1699('0x20')](handleEntityNotFound(_0x45cebf,null))[_0x1699('0x20')](function(_0xe61942){if(_0xe61942){_0x4f491e[_0x1699('0x5a')][_0x1699('0x68')]=_0xe61942['id'];return db[_0x1699('0x5c')][_0x1699('0x59')](_0x4f491e[_0x1699('0x5a')]);}})[_0x1699('0x20')](respondWithResult(_0x45cebf,null))[_0x1699('0x2b')](handleError(_0x45cebf,null));};exports[_0x1699('0x69')]=function(_0xf51c99,_0x20064e,_0x168de1){var _0x360887={};var _0x24e87d={};var _0x212f7d;var _0x5f32bc;return db['ChatGroup']['findOne']({'where':{'id':_0xf51c99[_0x1699('0x55')]['id']}})[_0x1699('0x20')](handleEntityNotFound(_0x20064e,null))['then'](function(_0x1e7e07){if(_0x1e7e07){_0x212f7d=_0x1e7e07;_0x24e87d[_0x1699('0x43')]=_[_0x1699('0x56')](db[_0x1699('0x5c')][_0x1699('0x63')]);_0x24e87d['query']=_[_0x1699('0x56')](_0xf51c99['query']);_0x24e87d[_0x1699('0x4c')]=_[_0x1699('0x42')](_0x24e87d[_0x1699('0x43')],_0x24e87d['query']);_0x360887['attributes']=_[_0x1699('0x42')](_0x24e87d['model'],qs['fields'](_0xf51c99[_0x1699('0x41')][_0x1699('0x44')]));_0x360887['attributes']=_0x360887['attributes'][_0x1699('0x46')]?_0x360887['attributes']:_0x24e87d[_0x1699('0x43')];_0x360887[_0x1699('0x64')]=qs[_0x1699('0x4b')](_0xf51c99[_0x1699('0x41')]['sort']);_0x360887['where']=qs[_0x1699('0x4c')](_[_0x1699('0x6a')](_0xf51c99[_0x1699('0x41')],_0x24e87d[_0x1699('0x4c')]));if(_0xf51c99[_0x1699('0x41')][_0x1699('0x4d')]){_0x360887[_0x1699('0x4e')]=_['merge'](_0x360887[_0x1699('0x4e')],{'$or':_[_0x1699('0x40')](_0x360887[_0x1699('0x45')],function(_0xd4ebc6){var _0x22c2bb={};_0x22c2bb[_0xd4ebc6]={'$like':'%'+_0xf51c99[_0x1699('0x41')][_0x1699('0x4d')]+'%'};return _0x22c2bb;})});}if(_0xf51c99[_0x1699('0x41')][_0x1699('0x6b')]){var _0x2cd034=_0xf51c99[_0x1699('0x41')][_0x1699('0x6b')][_0x1699('0x6c')](',');var _0x659d9e={};_0x659d9e[_0x2cd034[0x0]]={'$gte':moment(_0x2cd034[0x1])[_0x1699('0x6d')](_0x1699('0x6e'))};_0x360887['where']=_[_0x1699('0x4f')](_0x360887[_0x1699('0x4e')],_0x659d9e);}_0x360887=_['merge']({},_0x360887,_0xf51c99['options']);return _0x212f7d[_0x1699('0x69')](_0x360887);}})['then'](function(_0x2aafe3){if(_0x2aafe3){_0x5f32bc=_0x2aafe3[_0x1699('0x46')];if(!_0xf51c99['query']['hasOwnProperty'](_0x1699('0x48'))){_0x360887['limit']=qs[_0x1699('0x49')](_0xf51c99[_0x1699('0x41')][_0x1699('0x49')]);_0x360887[_0x1699('0x4a')]=qs[_0x1699('0x4a')](_0xf51c99[_0x1699('0x41')][_0x1699('0x4a')]);}return _0x212f7d[_0x1699('0x69')](_0x360887);}})['then'](function(_0x31443f){if(_0x31443f){return _0x31443f?{'count':_0x5f32bc,'rows':_0x31443f}:null;}})[_0x1699('0x20')](respondWithResult(_0x20064e,null))[_0x1699('0x2b')](handleError(_0x20064e,null));}; \ No newline at end of file +var _0xe03a=['ChatGroup,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','json','offset','Content-Range','apply','reject','save','update','status','stack','name','send','index','map','ChatGroup','fieldName','key','query','filters','attributes','intersection','model','fields','length','limit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','count','includeAll','include','rows','show','keys','find','create','body','params','describe','getUnread','user','addMembers','ids','getMembers','findOne','User','rawAttributes','nolimit','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','then','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe03a,0x1e6));var _0xae03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe03a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xae03('0x0'));var emlformat=require(_0xae03('0x1'));var rimraf=require(_0xae03('0x2'));var zipdir=require(_0xae03('0x3'));var jsonpatch=require(_0xae03('0x4'));var rp=require(_0xae03('0x5'));var moment=require(_0xae03('0x6'));var BPromise=require(_0xae03('0x7'));var Mustache=require(_0xae03('0x8'));var util=require(_0xae03('0x9'));var path=require(_0xae03('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae03('0xc'));var squel=require(_0xae03('0xd'));var crypto=require(_0xae03('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xae03('0xf'));var querystring=require(_0xae03('0x10'));var Papa=require('papaparse');var Redis=require(_0xae03('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xae03('0x12'));var as=require(_0xae03('0x13'));var hardwareService=require(_0xae03('0x14'));var logger=require('../../config/logger')(_0xae03('0x15'));var utils=require(_0xae03('0x16'));var config=require(_0xae03('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xae03('0x18'))['db'];config[_0xae03('0x19')]=_[_0xae03('0x1a')](config[_0xae03('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xae03('0x1b'))(new Redis(config[_0xae03('0x19')]));require(_0xae03('0x1c'))[_0xae03('0x1d')](socket);var jayson=require(_0xae03('0x1e'));var client=jayson[_0xae03('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x68787f,_0x116134,_0x2e8440,_0xa266c7){return new BPromise(function(_0x3c1b6b,_0x5b9224){var _0x5a92e8=_0xa266c7||client;return _0x5a92e8['request'](_0x68787f,_0x2e8440)[_0xae03('0x20')](function(_0x476ec1){logger[_0xae03('0x21')](_0xae03('0x22'),_0x116134,_0xae03('0x23'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x116134,_0xae03('0x23'),JSON['stringify'](_0x476ec1));if(_0x476ec1[_0xae03('0x24')]){if(_0x476ec1[_0xae03('0x24')][_0xae03('0x25')]===0x1f4){logger[_0xae03('0x24')](_0xae03('0x22'),_0x116134,_0x476ec1[_0xae03('0x24')][_0xae03('0x26')]);return _0x5b9224(_0x476ec1[_0xae03('0x24')][_0xae03('0x26')]);}logger[_0xae03('0x24')](_0xae03('0x22'),_0x116134,_0x476ec1[_0xae03('0x24')]['message']);return _0x3c1b6b(_0x476ec1[_0xae03('0x24')]['message']);}else{logger['info'](_0xae03('0x22'),_0x116134,'request\x20sent');_0x3c1b6b(_0x476ec1[_0xae03('0x27')][_0xae03('0x26')]);}})[_0xae03('0x28')](function(_0x4c5042){logger[_0xae03('0x24')](_0xae03('0x22'),_0x116134,_0x4c5042);_0x5b9224(_0x4c5042);});});}function respondWithStatusCode(_0x31390e,_0x119bb1){_0x119bb1=_0x119bb1||0xcc;return function(_0x31cce1){if(_0x31cce1){return _0x31390e[_0xae03('0x29')](_0x119bb1);}return _0x31390e['status'](_0x119bb1)[_0xae03('0x2a')]();};}function respondWithResult(_0x1bb577,_0x120284){_0x120284=_0x120284||0xc8;return function(_0xf7846f){if(_0xf7846f){return _0x1bb577['status'](_0x120284)[_0xae03('0x2b')](_0xf7846f);}};}function respondWithFilteredResult(_0xd6e06d,_0x5ef73c){return function(_0x55fe9b){if(_0x55fe9b){var _0x17ab9d=_0x55fe9b['count'],_0x1677e4=_0x5ef73c[_0xae03('0x2c')],_0x33cb00=_0x5ef73c[_0xae03('0x2c')]+_0x5ef73c['limit'],_0x1386ad;if(_0x33cb00>=_0x17ab9d){_0x33cb00=_0x17ab9d;_0x1386ad=0xc8;}else{_0x1386ad=0xce;}_0xd6e06d['status'](_0x1386ad);return _0xd6e06d['set'](_0xae03('0x2d'),_0x1677e4+'-'+_0x33cb00+'/'+_0x17ab9d)[_0xae03('0x2b')](_0x55fe9b);}return null;};}function patchUpdates(_0x545aa3){return function(_0x44eabe){try{jsonpatch[_0xae03('0x2e')](_0x44eabe,_0x545aa3,!![]);}catch(_0x3db619){return BPromise[_0xae03('0x2f')](_0x3db619);}return _0x44eabe[_0xae03('0x30')]();};}function saveUpdates(_0x4c6905,_0x1237ff){return function(_0x2f3cf0){if(_0x2f3cf0){return _0x2f3cf0[_0xae03('0x31')](_0x4c6905)[_0xae03('0x20')](function(_0x54dab4){return _0x54dab4;});}return null;};}function removeEntity(_0x58141c,_0x52f916){return function(_0x4b3ee6){if(_0x4b3ee6){return _0x4b3ee6['destroy']()[_0xae03('0x20')](function(){_0x58141c[_0xae03('0x32')](0xcc)[_0xae03('0x2a')]();});}};}function handleEntityNotFound(_0x53c22d,_0x4f1727){return function(_0x26d5cf){if(!_0x26d5cf){_0x53c22d[_0xae03('0x29')](0x194);}return _0x26d5cf;};}function handleError(_0x2d62f0,_0x5d6ad7){_0x5d6ad7=_0x5d6ad7||0x1f4;return function(_0x4cb058){logger['error'](_0x4cb058[_0xae03('0x33')]);if(_0x4cb058[_0xae03('0x34')]){delete _0x4cb058['name'];}_0x2d62f0['status'](_0x5d6ad7)[_0xae03('0x35')](_0x4cb058);};}exports[_0xae03('0x36')]=function(_0x1d8bfd,_0x345f68){var _0x30fb06={},_0x5ad614={},_0x20272a={'count':0x0,'rows':[]};var _0x2cfcbc=_[_0xae03('0x37')](db[_0xae03('0x38')]['rawAttributes'],function(_0x3a1682){return{'name':_0x3a1682[_0xae03('0x39')],'type':_0x3a1682['type'][_0xae03('0x3a')]};});_0x5ad614['model']=_[_0xae03('0x37')](_0x2cfcbc,_0xae03('0x34'));_0x5ad614[_0xae03('0x3b')]=_['keys'](_0x1d8bfd[_0xae03('0x3b')]);_0x5ad614[_0xae03('0x3c')]=_['intersection'](_0x5ad614['model'],_0x5ad614[_0xae03('0x3b')]);_0x30fb06[_0xae03('0x3d')]=_[_0xae03('0x3e')](_0x5ad614[_0xae03('0x3f')],qs[_0xae03('0x40')](_0x1d8bfd[_0xae03('0x3b')][_0xae03('0x40')]));_0x30fb06[_0xae03('0x3d')]=_0x30fb06['attributes'][_0xae03('0x41')]?_0x30fb06['attributes']:_0x5ad614['model'];if(!_0x1d8bfd['query']['hasOwnProperty']('nolimit')){_0x30fb06['limit']=qs[_0xae03('0x42')](_0x1d8bfd[_0xae03('0x3b')]['limit']);_0x30fb06[_0xae03('0x2c')]=qs[_0xae03('0x2c')](_0x1d8bfd[_0xae03('0x3b')][_0xae03('0x2c')]);}_0x30fb06[_0xae03('0x43')]=qs[_0xae03('0x44')](_0x1d8bfd[_0xae03('0x3b')][_0xae03('0x44')]);_0x30fb06['where']=qs[_0xae03('0x3c')](_[_0xae03('0x45')](_0x1d8bfd[_0xae03('0x3b')],_0x5ad614[_0xae03('0x3c')]),_0x2cfcbc);if(_0x1d8bfd[_0xae03('0x3b')]['filter']){_0x30fb06[_0xae03('0x46')]=_['merge'](_0x30fb06['where'],{'$or':_[_0xae03('0x37')](_0x2cfcbc,function(_0x2ce4f6){if(_0x2ce4f6[_0xae03('0x47')]!==_0xae03('0x48')){var _0x57d7ce={};_0x57d7ce[_0x2ce4f6[_0xae03('0x34')]]={'$like':'%'+_0x1d8bfd[_0xae03('0x3b')][_0xae03('0x49')]+'%'};return _0x57d7ce;}})});}_0x30fb06=_[_0xae03('0x4a')]({},_0x30fb06,_0x1d8bfd[_0xae03('0x4b')]);var _0x37a636={'where':_0x30fb06[_0xae03('0x46')]};return db[_0xae03('0x38')][_0xae03('0x4c')](_0x37a636)[_0xae03('0x20')](function(_0x255ac3){_0x20272a[_0xae03('0x4c')]=_0x255ac3;if(_0x1d8bfd['query'][_0xae03('0x4d')]){_0x30fb06[_0xae03('0x4e')]=[{'all':!![]}];}return db[_0xae03('0x38')]['findAll'](_0x30fb06);})['then'](function(_0x139a25){_0x20272a[_0xae03('0x4f')]=_0x139a25;return _0x20272a;})[_0xae03('0x20')](respondWithFilteredResult(_0x345f68,_0x30fb06))[_0xae03('0x28')](handleError(_0x345f68,null));};exports[_0xae03('0x50')]=function(_0xe55e00,_0x488104){var _0x139a31={'raw':!![],'where':{'id':_0xe55e00['params']['id']}},_0x25b47b={};_0x25b47b[_0xae03('0x3f')]=_[_0xae03('0x51')](db['ChatGroup']['rawAttributes']);_0x25b47b[_0xae03('0x3b')]=_[_0xae03('0x51')](_0xe55e00[_0xae03('0x3b')]);_0x25b47b[_0xae03('0x3c')]=_[_0xae03('0x3e')](_0x25b47b[_0xae03('0x3f')],_0x25b47b[_0xae03('0x3b')]);_0x139a31[_0xae03('0x3d')]=_['intersection'](_0x25b47b[_0xae03('0x3f')],qs['fields'](_0xe55e00[_0xae03('0x3b')][_0xae03('0x40')]));_0x139a31['attributes']=_0x139a31[_0xae03('0x3d')][_0xae03('0x41')]?_0x139a31['attributes']:_0x25b47b[_0xae03('0x3f')];if(_0xe55e00[_0xae03('0x3b')][_0xae03('0x4d')]){_0x139a31[_0xae03('0x4e')]=[{'all':!![]}];}_0x139a31=_[_0xae03('0x4a')]({},_0x139a31,_0xe55e00[_0xae03('0x4b')]);return db[_0xae03('0x38')][_0xae03('0x52')](_0x139a31)['then'](handleEntityNotFound(_0x488104,null))['then'](respondWithResult(_0x488104,null))[_0xae03('0x28')](handleError(_0x488104,null));};exports[_0xae03('0x53')]=function(_0x2a1b95,_0x54cd37){return db[_0xae03('0x38')][_0xae03('0x53')](_0x2a1b95[_0xae03('0x54')],{})[_0xae03('0x20')](respondWithResult(_0x54cd37,0xc9))[_0xae03('0x28')](handleError(_0x54cd37,null));};exports[_0xae03('0x31')]=function(_0xa1b64a,_0x580971){if(_0xa1b64a[_0xae03('0x54')]['id']){delete _0xa1b64a['body']['id'];}return db[_0xae03('0x38')][_0xae03('0x52')]({'where':{'id':_0xa1b64a[_0xae03('0x55')]['id']}})[_0xae03('0x20')](handleEntityNotFound(_0x580971,null))[_0xae03('0x20')](saveUpdates(_0xa1b64a[_0xae03('0x54')],null))['then'](respondWithResult(_0x580971,null))[_0xae03('0x28')](handleError(_0x580971,null));};exports['destroy']=function(_0x1136dd,_0x451a28){return db[_0xae03('0x38')]['find']({'where':{'id':_0x1136dd[_0xae03('0x55')]['id']}})[_0xae03('0x20')](handleEntityNotFound(_0x451a28,null))[_0xae03('0x20')](removeEntity(_0x451a28,null))[_0xae03('0x28')](handleError(_0x451a28,null));};exports[_0xae03('0x56')]=function(_0xffca48,_0x252c3e){return db[_0xae03('0x38')][_0xae03('0x56')]()[_0xae03('0x20')](respondWithResult(_0x252c3e,null))[_0xae03('0x28')](handleError(_0x252c3e,null));};exports[_0xae03('0x57')]=function(_0x10237a,_0x29c8b7,_0x46e936){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x10237a[_0xae03('0x55')]['id'],'ToId':_0x10237a[_0xae03('0x58')]['id'],'read':![]}})[_0xae03('0x20')](function(_0x3f02e4){return{'id':_['toInteger'](_0x10237a[_0xae03('0x55')]['id']),'count':_0x3f02e4};})[_0xae03('0x20')](respondWithResult(_0x29c8b7,null))[_0xae03('0x28')](handleError(_0x29c8b7,null));};exports['addMembers']=function(_0x203f62,_0x273542,_0x3ee4ec){return db[_0xae03('0x38')]['find']({'where':{'id':_0x203f62[_0xae03('0x55')]['id']}})[_0xae03('0x20')](handleEntityNotFound(_0x273542,null))[_0xae03('0x20')](function(_0x5cab81){if(_0x5cab81){return _0x5cab81[_0xae03('0x59')](_0x203f62[_0xae03('0x54')][_0xae03('0x5a')],_['omit'](_0x203f62[_0xae03('0x54')],[_0xae03('0x5a'),'id'])||{});}})[_0xae03('0x20')](respondWithResult(_0x273542,null))[_0xae03('0x28')](handleError(_0x273542,null));};exports[_0xae03('0x5b')]=function(_0x363a65,_0x3f4fb6,_0x567f38){var _0x3579f0={};var _0x13bda6={};var _0x3fcfbf;var _0x5150d3;return db[_0xae03('0x38')][_0xae03('0x5c')]({'where':{'id':_0x363a65[_0xae03('0x55')]['id']}})[_0xae03('0x20')](handleEntityNotFound(_0x3f4fb6,null))[_0xae03('0x20')](function(_0x38b4c8){if(_0x38b4c8){_0x3fcfbf=_0x38b4c8;_0x13bda6[_0xae03('0x3f')]=_[_0xae03('0x51')](db[_0xae03('0x5d')][_0xae03('0x5e')]);_0x13bda6['query']=_[_0xae03('0x51')](_0x363a65[_0xae03('0x3b')]);_0x13bda6['filters']=_[_0xae03('0x3e')](_0x13bda6[_0xae03('0x3f')],_0x13bda6[_0xae03('0x3b')]);_0x3579f0[_0xae03('0x3d')]=_[_0xae03('0x3e')](_0x13bda6[_0xae03('0x3f')],qs[_0xae03('0x40')](_0x363a65['query'][_0xae03('0x40')]));_0x3579f0[_0xae03('0x3d')]=_0x3579f0[_0xae03('0x3d')][_0xae03('0x41')]?_0x3579f0['attributes']:_0x13bda6['model'];_0x3579f0[_0xae03('0x43')]=qs[_0xae03('0x44')](_0x363a65[_0xae03('0x3b')][_0xae03('0x44')]);_0x3579f0[_0xae03('0x46')]=qs[_0xae03('0x3c')](_[_0xae03('0x45')](_0x363a65['query'],_0x13bda6[_0xae03('0x3c')]));if(_0x363a65['query'][_0xae03('0x49')]){_0x3579f0[_0xae03('0x46')]=_[_0xae03('0x4a')](_0x3579f0[_0xae03('0x46')],{'$or':_['map'](_0x3579f0['attributes'],function(_0x3cae22){var _0x1018aa={};_0x1018aa[_0x3cae22]={'$like':'%'+_0x363a65[_0xae03('0x3b')][_0xae03('0x49')]+'%'};return _0x1018aa;})});}_0x3579f0=_[_0xae03('0x4a')]({},_0x3579f0,_0x363a65[_0xae03('0x4b')]);return _0x3fcfbf[_0xae03('0x5b')](_0x3579f0);}})['then'](function(_0x5ee645){if(_0x5ee645){_0x5150d3=_0x5ee645[_0xae03('0x41')];if(!_0x363a65[_0xae03('0x3b')]['hasOwnProperty'](_0xae03('0x5f'))){_0x3579f0[_0xae03('0x42')]=qs['limit'](_0x363a65[_0xae03('0x3b')]['limit']);_0x3579f0[_0xae03('0x2c')]=qs[_0xae03('0x2c')](_0x363a65[_0xae03('0x3b')][_0xae03('0x2c')]);}return _0x3fcfbf[_0xae03('0x5b')](_0x3579f0);}})['then'](function(_0x3fdff8){if(_0x3fdff8){return _0x3fdff8?{'count':_0x5150d3,'rows':_0x3fdff8}:null;}})['then'](respondWithResult(_0x3f4fb6,null))['catch'](handleError(_0x3f4fb6,null));};exports['removeMembers']=function(_0x2ee09e,_0x3f25a0,_0x70a852){return db['ChatGroup'][_0xae03('0x52')]({'where':{'id':_0x2ee09e[_0xae03('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f25a0,null))[_0xae03('0x20')](function(_0x182cfe){if(_0x182cfe){return _0x182cfe['removeMembers'](_0x2ee09e[_0xae03('0x3b')][_0xae03('0x5a')]);}})['then'](respondWithStatusCode(_0x3f25a0,null))[_0xae03('0x28')](handleError(_0x3f25a0,null));};exports['addMessage']=function(_0x3920d5,_0x3c0cb3,_0x5dace8){if(_0x3920d5['body']['id']){delete _0x3920d5[_0xae03('0x54')]['id'];}return db[_0xae03('0x38')][_0xae03('0x52')]({'where':{'id':_0x3920d5[_0xae03('0x55')]['id']}})[_0xae03('0x20')](handleEntityNotFound(_0x3c0cb3,null))[_0xae03('0x20')](function(_0x214dcb){if(_0x214dcb){_0x3920d5['body'][_0xae03('0x60')]=_0x214dcb['id'];return db[_0xae03('0x61')]['create'](_0x3920d5[_0xae03('0x54')]);}})[_0xae03('0x20')](respondWithResult(_0x3c0cb3,null))[_0xae03('0x28')](handleError(_0x3c0cb3,null));};exports[_0xae03('0x62')]=function(_0x4ead40,_0xabd8cd,_0x9ca8d5){var _0x41291e={};var _0x2fdde8={};var _0x8aad5a;var _0x361501;return db['ChatGroup']['findOne']({'where':{'id':_0x4ead40[_0xae03('0x55')]['id']}})[_0xae03('0x20')](handleEntityNotFound(_0xabd8cd,null))[_0xae03('0x20')](function(_0x5dcad6){if(_0x5dcad6){_0x8aad5a=_0x5dcad6;_0x2fdde8[_0xae03('0x3f')]=_[_0xae03('0x51')](db[_0xae03('0x61')][_0xae03('0x5e')]);_0x2fdde8[_0xae03('0x3b')]=_[_0xae03('0x51')](_0x4ead40[_0xae03('0x3b')]);_0x2fdde8[_0xae03('0x3c')]=_[_0xae03('0x3e')](_0x2fdde8['model'],_0x2fdde8[_0xae03('0x3b')]);_0x41291e[_0xae03('0x3d')]=_[_0xae03('0x3e')](_0x2fdde8[_0xae03('0x3f')],qs[_0xae03('0x40')](_0x4ead40[_0xae03('0x3b')]['fields']));_0x41291e['attributes']=_0x41291e[_0xae03('0x3d')][_0xae03('0x41')]?_0x41291e[_0xae03('0x3d')]:_0x2fdde8['model'];_0x41291e[_0xae03('0x43')]=qs[_0xae03('0x44')](_0x4ead40[_0xae03('0x3b')]['sort']);_0x41291e[_0xae03('0x46')]=qs[_0xae03('0x3c')](_[_0xae03('0x45')](_0x4ead40['query'],_0x2fdde8[_0xae03('0x3c')]));if(_0x4ead40[_0xae03('0x3b')][_0xae03('0x49')]){_0x41291e[_0xae03('0x46')]=_['merge'](_0x41291e[_0xae03('0x46')],{'$or':_[_0xae03('0x37')](_0x41291e['attributes'],function(_0x33a82a){var _0xeb5428={};_0xeb5428[_0x33a82a]={'$like':'%'+_0x4ead40['query'][_0xae03('0x49')]+'%'};return _0xeb5428;})});}if(_0x4ead40[_0xae03('0x3b')][_0xae03('0x63')]){var _0x29ff33=_0x4ead40[_0xae03('0x3b')][_0xae03('0x63')][_0xae03('0x64')](',');var _0xbdf507={};_0xbdf507[_0x29ff33[0x0]]={'$gte':moment(_0x29ff33[0x1])[_0xae03('0x65')](_0xae03('0x66'))};_0x41291e[_0xae03('0x46')]=_[_0xae03('0x4a')](_0x41291e[_0xae03('0x46')],_0xbdf507);}_0x41291e=_[_0xae03('0x4a')]({},_0x41291e,_0x4ead40[_0xae03('0x4b')]);return _0x8aad5a[_0xae03('0x62')](_0x41291e);}})['then'](function(_0x25e4ee){if(_0x25e4ee){_0x361501=_0x25e4ee['length'];if(!_0x4ead40[_0xae03('0x3b')][_0xae03('0x67')](_0xae03('0x5f'))){_0x41291e[_0xae03('0x42')]=qs[_0xae03('0x42')](_0x4ead40[_0xae03('0x3b')][_0xae03('0x42')]);_0x41291e[_0xae03('0x2c')]=qs[_0xae03('0x2c')](_0x4ead40[_0xae03('0x3b')][_0xae03('0x2c')]);}return _0x8aad5a[_0xae03('0x62')](_0x41291e);}})[_0xae03('0x20')](function(_0x591c9c){if(_0x591c9c){return _0x591c9c?{'count':_0x361501,'rows':_0x591c9c}:null;}})[_0xae03('0x20')](respondWithResult(_0xabd8cd,null))[_0xae03('0x28')](handleError(_0xabd8cd,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index baf64e7..4eb727b 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0xcbd383,_0x19fef7){var _0x1ca6d1=function(_0x44040b){while(--_0x44040b){_0xcbd383['push'](_0xcbd383['shift']());}};_0x1ca6d1(++_0x19fef7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d9922,_0x5c6f6f){_0x1d9922=_0x1d9922-0x0;var _0x164afb=_0x5f2f[_0x1d9922];return _0x164afb;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1e0396,_0x14b0ce){var _0x13ea7c=function(_0x3ac931){while(--_0x3ac931){_0x1e0396['push'](_0x1e0396['shift']());}};_0x13ea7c(++_0x14b0ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index af52fb6..c8d4e08 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 _0x3613=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatGroup.attributes','exports','define','chat_groups'];(function(_0x3debcc,_0x347944){var _0x40fa7d=function(_0x4d2e1d){while(--_0x4d2e1d){_0x3debcc['push'](_0x3debcc['shift']());}};_0x40fa7d(++_0x347944);}(_0x3613,0x198));var _0x3361=function(_0x184ca1,_0x5b7766){_0x184ca1=_0x184ca1-0x0;var _0x5daf50=_0x3613[_0x184ca1];return _0x5daf50;};'use strict';var _=require(_0x3361('0x0'));var util=require(_0x3361('0x1'));var logger=require(_0x3361('0x2'))(_0x3361('0x3'));var moment=require(_0x3361('0x4'));var BPromise=require(_0x3361('0x5'));var rp=require(_0x3361('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3361('0x7'));var config=require('../../config/environment');var attributes=require(_0x3361('0x8'));module[_0x3361('0x9')]=function(_0xa1bc1b,_0x2e2d6c){return _0xa1bc1b[_0x3361('0xa')]('ChatGroup',attributes,{'tableName':_0x3361('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26cf=['../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','util'];(function(_0x4366e3,_0x53f422){var _0x189d11=function(_0x5d8110){while(--_0x5d8110){_0x4366e3['push'](_0x4366e3['shift']());}};_0x189d11(++_0x53f422);}(_0x26cf,0x135));var _0xf26c=function(_0x2ad19b,_0x4ee5cc){_0x2ad19b=_0x2ad19b-0x0;var _0x472856=_0x26cf[_0x2ad19b];return _0x472856;};'use strict';var _=require('lodash');var util=require(_0xf26c('0x0'));var logger=require(_0xf26c('0x1'))('api');var moment=require(_0xf26c('0x2'));var BPromise=require('bluebird');var rp=require(_0xf26c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf26c('0x4'));var config=require(_0xf26c('0x5'));var attributes=require('./chatGroup.attributes');module[_0xf26c('0x6')]=function(_0x10638a,_0x32d4ef){return _0x10638a[_0xf26c('0x7')](_0xf26c('0x8'),attributes,{'tableName':_0xf26c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index ce86ec8..ab63276 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 _0x5182=['http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x5182,0x1cc));var _0x2518=function(_0x2e52f0,_0x1d741a){_0x2e52f0=_0x2e52f0-0x0;var _0x216aeb=_0x5182[_0x2e52f0];return _0x216aeb;};'use strict';var _=require(_0x2518('0x0'));var util=require(_0x2518('0x1'));var moment=require(_0x2518('0x2'));var BPromise=require(_0x2518('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2518('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2518('0x5'));var logger=require(_0x2518('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2518('0x7'));var client=jayson['client'][_0x2518('0x8')]({'port':0x232a});config[_0x2518('0x9')]=_[_0x2518('0xa')](config[_0x2518('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2518('0xb'))(new Redis(config[_0x2518('0x9')]));require(_0x2518('0xc'))[_0x2518('0xd')](socket);function respondWithRpcPromise(_0x49e48f,_0x4a9016,_0x274373){return new BPromise(function(_0x1b6ae7,_0x23f99d){return client[_0x2518('0xe')](_0x49e48f,_0x274373)[_0x2518('0xf')](function(_0x46b4d3){logger[_0x2518('0x10')](_0x2518('0x11'),_0x4a9016,_0x2518('0x12'));logger['debug'](_0x2518('0x13'),_0x4a9016,_0x2518('0x12'),JSON[_0x2518('0x14')](_0x46b4d3));if(_0x46b4d3[_0x2518('0x15')]){if(_0x46b4d3[_0x2518('0x15')][_0x2518('0x16')]===0x1f4){logger[_0x2518('0x15')](_0x2518('0x11'),_0x4a9016,_0x46b4d3[_0x2518('0x15')][_0x2518('0x17')]);return _0x23f99d(_0x46b4d3[_0x2518('0x15')][_0x2518('0x17')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4a9016,_0x46b4d3['error'][_0x2518('0x17')]);return _0x1b6ae7(_0x46b4d3[_0x2518('0x15')][_0x2518('0x17')]);}else{logger[_0x2518('0x10')](_0x2518('0x11'),_0x4a9016,_0x2518('0x12'));_0x1b6ae7(_0x46b4d3[_0x2518('0x18')]['message']);}})[_0x2518('0x19')](function(_0x1a6b50){logger[_0x2518('0x15')](_0x2518('0x11'),_0x4a9016,_0x1a6b50);_0x23f99d(_0x1a6b50);});});} \ No newline at end of file +var _0x5fb0=['message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x5fb0,0xc3));var _0x05fb=function(_0x33ffad,_0x5eb3dc){_0x33ffad=_0x33ffad-0x0;var _0x4b0dfa=_0x5fb0[_0x33ffad];return _0x4b0dfa;};'use strict';var _=require('lodash');var util=require(_0x05fb('0x0'));var moment=require('moment');var BPromise=require(_0x05fb('0x1'));var rs=require(_0x05fb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05fb('0x3'))['db'];var utils=require(_0x05fb('0x4'));var logger=require(_0x05fb('0x5'))('rpc');var config=require(_0x05fb('0x6'));var jayson=require(_0x05fb('0x7'));var client=jayson[_0x05fb('0x8')][_0x05fb('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x05fb('0xa')],{'host':_0x05fb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05fb('0xa')]));require('./chatGroup.socket')[_0x05fb('0xc')](socket);function respondWithRpcPromise(_0x508b78,_0x138ea4,_0x5dc20f){return new BPromise(function(_0x31c70c,_0x599ffb){return client['request'](_0x508b78,_0x5dc20f)[_0x05fb('0xd')](function(_0xa69bb9){logger[_0x05fb('0xe')](_0x05fb('0xf'),_0x138ea4,_0x05fb('0x10'));logger[_0x05fb('0x11')](_0x05fb('0x12'),_0x138ea4,_0x05fb('0x10'),JSON[_0x05fb('0x13')](_0xa69bb9));if(_0xa69bb9[_0x05fb('0x14')]){if(_0xa69bb9['error']['code']===0x1f4){logger[_0x05fb('0x14')]('ChatGroup,\x20%s,\x20%s',_0x138ea4,_0xa69bb9[_0x05fb('0x14')][_0x05fb('0x15')]);return _0x599ffb(_0xa69bb9[_0x05fb('0x14')][_0x05fb('0x15')]);}logger[_0x05fb('0x14')](_0x05fb('0xf'),_0x138ea4,_0xa69bb9['error']['message']);return _0x31c70c(_0xa69bb9['error'][_0x05fb('0x15')]);}else{logger['info'](_0x05fb('0xf'),_0x138ea4,_0x05fb('0x10'));_0x31c70c(_0xa69bb9[_0x05fb('0x16')][_0x05fb('0x15')]);}})[_0x05fb('0x17')](function(_0x28d692){logger[_0x05fb('0x14')]('ChatGroup,\x20%s,\x20%s',_0x138ea4,_0x28d692);_0x599ffb(_0x28d692);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 63b0337..144639e 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 _0xf066=['./chatGroup.events','remove','update','emit','removeListener','register','chatGroup:'];(function(_0x456fc3,_0x3b0631){var _0x17bfd2=function(_0x6133c){while(--_0x6133c){_0x456fc3['push'](_0x456fc3['shift']());}};_0x17bfd2(++_0x3b0631);}(_0xf066,0x111));var _0x6f06=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0xf066[_0x18b344];return _0x5ef6bb;};'use strict';var ChatGroupEvents=require(_0x6f06('0x0'));var events=['save',_0x6f06('0x1'),_0x6f06('0x2')];function createListener(_0x608946,_0x467aef){return function(_0x48730b){_0x467aef[_0x6f06('0x3')](_0x608946,_0x48730b);};}function removeListener(_0x2a0ce0,_0x1f3a46){return function(){ChatGroupEvents[_0x6f06('0x4')](_0x2a0ce0,_0x1f3a46);};}exports[_0x6f06('0x5')]=function(_0x34e45f){for(var _0xe4e4f6=0x0,_0x131ed4=events['length'];_0xe4e4f6<_0x131ed4;_0xe4e4f6++){var _0x146a78=events[_0xe4e4f6];var _0xb56b7a=createListener(_0x6f06('0x6')+_0x146a78,_0x34e45f);ChatGroupEvents['on'](_0x146a78,_0xb56b7a);}}; \ No newline at end of file +var _0xe6ab=['remove','update','removeListener','register','length','chatGroup:','save'];(function(_0x47777e,_0x50f862){var _0x4ccde6=function(_0x3cd615){while(--_0x3cd615){_0x47777e['push'](_0x47777e['shift']());}};_0x4ccde6(++_0x50f862);}(_0xe6ab,0xd1));var _0xbe6a=function(_0x308eaf,_0x4d4498){_0x308eaf=_0x308eaf-0x0;var _0x1470a5=_0xe6ab[_0x308eaf];return _0x1470a5;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xbe6a('0x0'),_0xbe6a('0x1'),_0xbe6a('0x2')];function createListener(_0x5cfc0e,_0x5a47b3){return function(_0x1e7230){_0x5a47b3['emit'](_0x5cfc0e,_0x1e7230);};}function removeListener(_0x39efac,_0x595928){return function(){ChatGroupEvents[_0xbe6a('0x3')](_0x39efac,_0x595928);};}exports[_0xbe6a('0x4')]=function(_0x1a498e){for(var _0x15fd2b=0x0,_0x2e9542=events[_0xbe6a('0x5')];_0x15fd2b<_0x2e9542;_0x15fd2b++){var _0x55e5a7=events[_0x15fd2b];var _0x4be0a1=createListener(_0xbe6a('0x6')+_0x55e5a7,_0x1a498e);ChatGroupEvents['on'](_0x55e5a7,_0x4be0a1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4c1629d..11e90c8 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 _0xc434=['./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','addMembers','post','addMessage','/:id','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xc434,0x16b));var _0x4c43=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xc434[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0x4c43('0x0'));var util=require(_0x4c43('0x1'));var path=require(_0x4c43('0x2'));var timeout=require(_0x4c43('0x3'));var express=require(_0x4c43('0x4'));var router=express[_0x4c43('0x5')]();var fs_extra=require(_0x4c43('0x6'));var auth=require(_0x4c43('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4c43('0x8'));var controller=require(_0x4c43('0x9'));router[_0x4c43('0xa')]('/',auth[_0x4c43('0xb')](),controller[_0x4c43('0xc')]);router[_0x4c43('0xa')](_0x4c43('0xd'),auth[_0x4c43('0xb')](),controller[_0x4c43('0xe')]);router[_0x4c43('0xa')]('/:id',auth[_0x4c43('0xb')](),controller[_0x4c43('0xf')]);router[_0x4c43('0xa')]('/:id/unread',auth[_0x4c43('0xb')](),controller[_0x4c43('0x10')]);router[_0x4c43('0xa')](_0x4c43('0x11'),auth[_0x4c43('0xb')](),controller[_0x4c43('0x12')]);router[_0x4c43('0xa')](_0x4c43('0x13'),auth['isAuthenticated'](),controller[_0x4c43('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4c43('0x15')]);router['post'](_0x4c43('0x11'),auth[_0x4c43('0xb')](),controller[_0x4c43('0x16')]);router[_0x4c43('0x17')](_0x4c43('0x13'),auth['isAuthenticated'](),controller[_0x4c43('0x18')]);router['put'](_0x4c43('0x19'),auth[_0x4c43('0xb')](),controller[_0x4c43('0x1a')]);router[_0x4c43('0x1b')](_0x4c43('0x19'),auth[_0x4c43('0xb')](),controller[_0x4c43('0x1c')]);router[_0x4c43('0x1b')](_0x4c43('0x11'),auth[_0x4c43('0xb')](),controller[_0x4c43('0x1d')]);module[_0x4c43('0x1e')]=router; \ No newline at end of file +var _0x35c8=['/:id/unread','getUnread','/:id/members','getMessages','post','addMembers','/:id/messages','addMessage','destroy','delete','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','isAuthenticated','get','/describe','/:id','show'];(function(_0x2f7a14,_0x21b7aa){var _0x29fabd=function(_0x27228e){while(--_0x27228e){_0x2f7a14['push'](_0x2f7a14['shift']());}};_0x29fabd(++_0x21b7aa);}(_0x35c8,0xdc));var _0x835c=function(_0x425a3b,_0x1ed217){_0x425a3b=_0x425a3b-0x0;var _0x141c17=_0x35c8[_0x425a3b];return _0x141c17;};'use strict';var multer=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var path=require(_0x835c('0x2'));var timeout=require(_0x835c('0x3'));var express=require(_0x835c('0x4'));var router=express['Router']();var fs_extra=require(_0x835c('0x5'));var auth=require(_0x835c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x835c('0x7'));var controller=require(_0x835c('0x8'));router['get']('/',auth[_0x835c('0x9')](),controller['index']);router[_0x835c('0xa')](_0x835c('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x835c('0xc'),auth['isAuthenticated'](),controller[_0x835c('0xd')]);router[_0x835c('0xa')](_0x835c('0xe'),auth[_0x835c('0x9')](),controller[_0x835c('0xf')]);router['get'](_0x835c('0x10'),auth[_0x835c('0x9')](),controller['getMembers']);router[_0x835c('0xa')]('/:id/messages',auth[_0x835c('0x9')](),controller[_0x835c('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x835c('0x12')](_0x835c('0x10'),auth[_0x835c('0x9')](),controller[_0x835c('0x13')]);router[_0x835c('0x12')](_0x835c('0x14'),auth[_0x835c('0x9')](),controller[_0x835c('0x15')]);router['put'](_0x835c('0xc'),auth[_0x835c('0x9')](),controller['update']);router['delete'](_0x835c('0xc'),auth[_0x835c('0x9')](),controller[_0x835c('0x16')]);router[_0x835c('0x17')](_0x835c('0x10'),auth['isAuthenticated'](),controller[_0x835c('0x18')]);module[_0x835c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b141cbb..fa4b25e 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 _0xbad7=['TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star'];(function(_0x4629da,_0x3c43e1){var _0x57814d=function(_0xabd804){while(--_0xabd804){_0x4629da['push'](_0x4629da['shift']());}};_0x57814d(++_0x3c43e1);}(_0xbad7,0x19c));var _0x7bad=function(_0x1fd0d5,_0x3cb655){_0x1fd0d5=_0x1fd0d5-0x0;var _0x57d242=_0xbad7[_0x1fd0d5];return _0x57d242;};'use strict';var Sequelize=require(_0x7bad('0x0'));module[_0x7bad('0x1')]={'closed':{'type':Sequelize[_0x7bad('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7bad('0x3')]},'ratingType':{'type':Sequelize[_0x7bad('0x4')]('star','thumb'),'defaultValue':_0x7bad('0x5')},'ratingMessage':{'type':Sequelize[_0x7bad('0x6')]},'pathTranscript':{'type':Sequelize[_0x7bad('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7bad('0x7')]},'disposition':{'type':Sequelize[_0x7bad('0x8')]},'secondDisposition':{'type':Sequelize[_0x7bad('0x8')]},'thirdDisposition':{'type':Sequelize[_0x7bad('0x8')]},'note':{'type':Sequelize[_0x7bad('0x8')]},'browserName':{'type':Sequelize[_0x7bad('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x7bad('0x8')]},'osVersion':{'type':Sequelize[_0x7bad('0x8')]},'deviceModel':{'type':Sequelize[_0x7bad('0x8')]},'deviceVendor':{'type':Sequelize[_0x7bad('0x8')]},'deviceType':{'type':Sequelize[_0x7bad('0x8')]},'referer':{'type':Sequelize[_0x7bad('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7bad('0x6')](_0x7bad('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7bad('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7bad('0x8')]},'customerPort':{'type':Sequelize[_0x7bad('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x7bad('0x6')]}}; \ No newline at end of file +var _0x003c=['long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE'];(function(_0x4e2861,_0x199be0){var _0x2265e3=function(_0x469693){while(--_0x469693){_0x4e2861['push'](_0x4e2861['shift']());}};_0x2265e3(++_0x199be0);}(_0x003c,0x86));var _0xc003=function(_0x55a57d,_0x21f20d){_0x55a57d=_0x55a57d-0x0;var _0x2f7686=_0x003c[_0x55a57d];return _0x2f7686;};'use strict';var Sequelize=require(_0xc003('0x0'));module[_0xc003('0x1')]={'closed':{'type':Sequelize[_0xc003('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc003('0x3')]},'ratingType':{'type':Sequelize[_0xc003('0x4')]('star','thumb'),'defaultValue':_0xc003('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xc003('0x6')]},'mailTranscript':{'type':Sequelize[_0xc003('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc003('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc003('0x7')]},'thirdDisposition':{'type':Sequelize[_0xc003('0x7')]},'note':{'type':Sequelize[_0xc003('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xc003('0x7')]},'osName':{'type':Sequelize[_0xc003('0x7')]},'osVersion':{'type':Sequelize[_0xc003('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xc003('0x7')]},'deviceType':{'type':Sequelize[_0xc003('0x7')]},'referer':{'type':Sequelize[_0xc003('0x6')]},'customerIp':{'type':Sequelize[_0xc003('0x7')]},'formData':{'type':Sequelize[_0xc003('0x6')](_0xc003('0x9'))},'read1stAt':{'type':Sequelize[_0xc003('0x8')]},'lastMsgAt':{'type':Sequelize[_0xc003('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xc003('0x4')]('in',_0xc003('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc003('0x7')]},'customerPort':{'type':Sequelize[_0xc003('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xc003('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 8a10738..c0a5741 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 _0x3d54=['`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','agent','sequelize','keyBy','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','toString','ChatInteractionId','all','rows','show','rawAttributes','includeAll','include','merge','options','create','body','update','params','describe','createVidaooSession','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','findOne','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','agentAlias','System','customer','%s%d','Visitor','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','authentication','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','omit','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','pick','includeAgent','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','Attachment','Account','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Owner','closedAt','browserName','osName','customerIp','customerPort','N.A.','tail','existsSync','pipe','createWriteStream','Contact','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','count','offset','limit','apply','reject','save','destroy','stack','name','send','Users','fullname','TagIds','forEach','push','index','map','ChatInteraction','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','select','field','color','from','tools_tags','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','buildExpression','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','\x20=\x20?','read'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x3d54,0xb2));var _0x43d5=function(_0x1f717f,_0x2fc837){_0x1f717f=_0x1f717f-0x0;var _0x20bf18=_0x3d54[_0x1f717f];return _0x20bf18;};'use strict';var pdf=require(_0x43d5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x43d5('0x2'));var rp=require(_0x43d5('0x3'));var moment=require(_0x43d5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x43d5('0x5'));var util=require(_0x43d5('0x6'));var path=require('path');var sox=require(_0x43d5('0x7'));var csv=require('to-csv');var ejs=require(_0x43d5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43d5('0x9'));var squel=require(_0x43d5('0xa'));var crypto=require(_0x43d5('0xb'));var jsforce=require(_0x43d5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x43d5('0xd'));var querystring=require(_0x43d5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x43d5('0xf'));var qs=require(_0x43d5('0x10'));var as=require(_0x43d5('0x11'));var hardwareService=require(_0x43d5('0x12'));var logger=require('../../config/logger')(_0x43d5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x43d5('0x14'))['db'];config[_0x43d5('0x15')]=_[_0x43d5('0x16')](config[_0x43d5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x43d5('0x17'))(new Redis(config[_0x43d5('0x15')]));require(_0x43d5('0x18'))['register'](socket);var jayson=require(_0x43d5('0x19'));var client=jayson[_0x43d5('0x1a')][_0x43d5('0x1b')]({'port':0x232b});var client9004=jayson[_0x43d5('0x1a')]['http']({'port':0x232c});function respondWithRpcPromise(_0x51c7eb,_0x42651c,_0x4fb0d5,_0x450afb){return new BPromise(function(_0x402883,_0x52b457){var _0x2547c7=_0x450afb||client;return _0x2547c7[_0x43d5('0x1c')](_0x51c7eb,_0x4fb0d5)[_0x43d5('0x1d')](function(_0x635938){logger[_0x43d5('0x1e')](_0x43d5('0x1f'),_0x42651c,'request\x20sent');logger[_0x43d5('0x20')](_0x43d5('0x21'),_0x42651c,_0x43d5('0x22'),JSON['stringify'](_0x635938));if(_0x635938[_0x43d5('0x23')]){if(_0x635938[_0x43d5('0x23')][_0x43d5('0x24')]===0x1f4){logger[_0x43d5('0x23')](_0x43d5('0x1f'),_0x42651c,_0x635938['error']['message']);return _0x52b457(_0x635938[_0x43d5('0x23')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x42651c,_0x635938[_0x43d5('0x23')][_0x43d5('0x25')]);return _0x402883(_0x635938[_0x43d5('0x23')]['message']);}else{logger[_0x43d5('0x1e')](_0x43d5('0x1f'),_0x42651c,'request\x20sent');_0x402883(_0x635938[_0x43d5('0x26')][_0x43d5('0x25')]);}})[_0x43d5('0x27')](function(_0x5e6b03){logger['error'](_0x43d5('0x1f'),_0x42651c,_0x5e6b03);_0x52b457(_0x5e6b03);});});}function respondWithStatusCode(_0x450e08,_0x4f4543){_0x4f4543=_0x4f4543||0xcc;return function(_0x4ec022){if(_0x4ec022){return _0x450e08['sendStatus'](_0x4f4543);}return _0x450e08[_0x43d5('0x28')](_0x4f4543)[_0x43d5('0x29')]();};}function respondWithResult(_0xc7b1c5,_0x1a3e8e){_0x1a3e8e=_0x1a3e8e||0xc8;return function(_0x17fdc0){if(_0x17fdc0){return _0xc7b1c5['status'](_0x1a3e8e)[_0x43d5('0x2a')](_0x17fdc0);}};}function respondWithFilteredResult(_0x3445f5,_0x75f748){return function(_0x3dcb85){if(_0x3dcb85){var _0x302a2d=_0x3dcb85[_0x43d5('0x2b')],_0x3c394f=_0x75f748[_0x43d5('0x2c')],_0x545032=_0x75f748[_0x43d5('0x2c')]+_0x75f748[_0x43d5('0x2d')],_0x4d5d04;if(_0x545032>=_0x302a2d){_0x545032=_0x302a2d;_0x4d5d04=0xc8;}else{_0x4d5d04=0xce;}_0x3445f5[_0x43d5('0x28')](_0x4d5d04);return _0x3445f5['set']('Content-Range',_0x3c394f+'-'+_0x545032+'/'+_0x302a2d)[_0x43d5('0x2a')](_0x3dcb85);}return null;};}function patchUpdates(_0x2cc33e){return function(_0x519248){try{jsonpatch[_0x43d5('0x2e')](_0x519248,_0x2cc33e,!![]);}catch(_0xb344ca){return BPromise[_0x43d5('0x2f')](_0xb344ca);}return _0x519248[_0x43d5('0x30')]();};}function saveUpdates(_0x96cdfe,_0x182f63){return function(_0x447944){if(_0x447944){return _0x447944['update'](_0x96cdfe)[_0x43d5('0x1d')](function(_0x10689f){return _0x10689f;});}return null;};}function removeEntity(_0x2faff8,_0x54569b){return function(_0x410b34){if(_0x410b34){return _0x410b34[_0x43d5('0x31')]()[_0x43d5('0x1d')](function(){_0x2faff8[_0x43d5('0x28')](0xcc)[_0x43d5('0x29')]();});}};}function handleEntityNotFound(_0x4c6e27,_0x414fbb){return function(_0x1a05b9){if(!_0x1a05b9){_0x4c6e27['sendStatus'](0x194);}return _0x1a05b9;};}function handleError(_0x732fa6,_0x45248d){_0x45248d=_0x45248d||0x1f4;return function(_0x57031f){logger[_0x43d5('0x23')](_0x57031f[_0x43d5('0x32')]);if(_0x57031f[_0x43d5('0x33')]){delete _0x57031f['name'];}_0x732fa6[_0x43d5('0x28')](_0x45248d)[_0x43d5('0x34')](_0x57031f);};}function getInteractionUsers(_0x58fead,_0x20740b){return new BPromise(function(_0x4b6af0,_0x5dfb26){try{if(_0x20740b[_0x58fead['id']]){_0x58fead[_0x43d5('0x35')]=_['map'](_0x20740b[_0x58fead['id']],function(_0x4e33b1){return{'id':_0x4e33b1['id'],'fullname':_0x4e33b1[_0x43d5('0x36')]};});}}catch(_0x5055a3){_0x5dfb26(_0x5055a3);}_0x4b6af0(_0x58fead);});}function getInteractionTags(_0x50f5d8,_0x547963){return new BPromise(function(_0x3cbcab,_0xe3428b){try{if(_0x50f5d8['TagIds']){_0x50f5d8['Tags']=[];_0x50f5d8[_0x43d5('0x37')]['split'](',')[_0x43d5('0x38')](function(_0xa80775){_0x50f5d8['Tags'][_0x43d5('0x39')](_0x547963[_0xa80775]);});}delete _0x50f5d8[_0x43d5('0x37')];}catch(_0x24df62){_0xe3428b(_0x24df62);}_0x3cbcab(_0x50f5d8);});}function updateChatInteraction(_0x49ad41,_0x4518f2,_0x35cf3b){return new BPromise(function(_0x42c5e8,_0x5e0c37){return getInteractionUsers(_0x49ad41,_0x35cf3b)[_0x43d5('0x1d')](function(_0x1eae85){return getInteractionTags(_0x1eae85,_0x4518f2);})[_0x43d5('0x1d')](function(_0x2dc1d3){_0x42c5e8(_0x2dc1d3);})[_0x43d5('0x27')](function(_0x536735){_0x5e0c37(_0x536735);});});}exports[_0x43d5('0x3a')]=function(_0x325109,_0x4a9d8d){var _0x4f8a07={},_0x4ccfe1={},_0x440921={'count':0x0,'rows':[]};var _0x550580=_[_0x43d5('0x3b')](db[_0x43d5('0x3c')]['rawAttributes'],function(_0x3a4f50){return{'name':_0x3a4f50['fieldName'],'type':_0x3a4f50[_0x43d5('0x3d')][_0x43d5('0x3e')]};});_0x4ccfe1['model']=_['map'](_0x550580,'name');_0x4ccfe1['query']=_[_0x43d5('0x3f')](_0x325109[_0x43d5('0x40')]);_0x4ccfe1[_0x43d5('0x41')]=_[_0x43d5('0x42')](_0x4ccfe1['model'],_0x4ccfe1[_0x43d5('0x40')]);_0x4f8a07['attributes']=_['intersection'](_0x4ccfe1[_0x43d5('0x43')],qs['fields'](_0x325109[_0x43d5('0x40')][_0x43d5('0x44')]));_0x4f8a07[_0x43d5('0x45')]=_0x4f8a07[_0x43d5('0x45')][_0x43d5('0x46')]?_0x4f8a07[_0x43d5('0x45')]:_0x4ccfe1[_0x43d5('0x43')];if(!_0x325109[_0x43d5('0x40')][_0x43d5('0x47')](_0x43d5('0x48'))){_0x4f8a07['limit']=qs[_0x43d5('0x2d')](_0x325109[_0x43d5('0x40')][_0x43d5('0x2d')]);_0x4f8a07[_0x43d5('0x2c')]=qs[_0x43d5('0x2c')](_0x325109['query'][_0x43d5('0x2c')]);}_0x4f8a07['order']=qs['sort'](_0x325109[_0x43d5('0x40')][_0x43d5('0x49')]);_0x4f8a07[_0x43d5('0x4a')]=qs['filters'](_['pick'](_0x325109[_0x43d5('0x40')],_0x4ccfe1[_0x43d5('0x41')]),_0x550580);var _0x917423=[];var _0x323ebd=squel[_0x43d5('0x4b')]()[_0x43d5('0x4c')]('id')[_0x43d5('0x4c')](_0x43d5('0x33'))[_0x43d5('0x4c')](_0x43d5('0x4d'))[_0x43d5('0x4e')](_0x43d5('0x4f'));var _0x568b87=squel[_0x43d5('0x4b')]()[_0x43d5('0x4c')]('u.id')[_0x43d5('0x4c')](_0x43d5('0x50'))[_0x43d5('0x4c')]('ui.ChatInteractionId')[_0x43d5('0x4e')](_0x43d5('0x51'),'ui')[_0x43d5('0x52')](_0x43d5('0x53'),'u',_0x43d5('0x54'));var _0x5b10bc=squel[_0x43d5('0x4b')]()[_0x43d5('0x4e')](_0x43d5('0x55'),'i')[_0x43d5('0x52')](_0x43d5('0x56'),'c',_0x43d5('0x57'))[_0x43d5('0x52')](_0x43d5('0x53'),'o',_0x43d5('0x58'))['left_join'](_0x43d5('0x59'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x43d5('0x52')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x43d5('0x52')](_0x43d5('0x5a'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x43d5('0x52')](_0x43d5('0x4f'),'t',_0x43d5('0x5b'));var _0x14f35b=squel[_0x43d5('0x5c')]();var _0x3374af=[];var _0x492d0e=squel[_0x43d5('0x5c')]();var _0x18b356;if(_0x325109[_0x43d5('0x40')][_0x43d5('0x5d')]){_0x18b356=as[_0x43d5('0x5e')](_0x325109[_0x43d5('0x40')]['search']);var _0x2b9af=_0x18b356[_0x43d5('0x5f')];for(var _0x4247f3=0x0;_0x4247f3<_0x18b356['conditions']['length'];_0x4247f3++){var _0x33816d=_0x18b356[_0x43d5('0x60')][_0x4247f3];var _0x132a28='i';var _0x514504=_[_0x43d5('0x61')](_0x550580,[_0x43d5('0x33'),_0x33816d[_0x43d5('0x4c')]]);if(!_0x514504){switch(_0x33816d['field']){case _0x43d5('0x62'):if(_0x33816d[_0x43d5('0x63')]==0x1){_0x5b10bc[_0x43d5('0x64')]('`'+_0x33816d[_0x43d5('0x4c')]+'`\x20=\x200');}else{_0x5b10bc[_0x43d5('0x64')]('`'+_0x33816d[_0x43d5('0x4c')]+_0x43d5('0x65'));}break;case'Contact':if(_0x33816d['operator']===_0x43d5('0x66')){if(_0x33816d[_0x43d5('0x63')][_0x43d5('0x67')]('\x20')['length']>0x1){_0x14f35b[_0x2b9af](_0x43d5('0x68'),qs[_0x43d5('0x69')](_0x33816d[_0x43d5('0x63')]),null);}else{var _0xe36c15='%'+_0x33816d[_0x43d5('0x63')]+'%';_0x14f35b[_0x2b9af](_0x43d5('0x6a'),_0xe36c15,_0xe36c15,_0xe36c15);}}else{_0x514504=_[_0x43d5('0x61')](_0x550580,[_0x43d5('0x33'),_0x43d5('0x6b')]);_0x33816d[_0x43d5('0x4c')]=_0x43d5('0x6b');_0x21af9c=as['buildExpression'](_0x132a28,_0x514504[_0x43d5('0x3d')],_0x33816d);_0x14f35b[_0x2b9af](_0x21af9c[_0x43d5('0x6c')],_0x21af9c[_0x43d5('0x63')][_0x43d5('0x6d')],_0x21af9c['value']['end']);}break;case'Tag':var _0x47954d=_0x33816d[_0x43d5('0x63')]['split'](',')[_0x43d5('0x3b')](function(_0x320cd8){return Number(_0x320cd8);});_0x47954d[_0x43d5('0x38')](function(_0x469d63){_0x492d0e['or'](_0x43d5('0x6e'),'%,'+_0x469d63+',%');});_0x3374af=_[_0x43d5('0x6f')](_0x3374af,_0x47954d);break;case _0x43d5('0x70'):if(_0x33816d[_0x43d5('0x71')]===_0x43d5('0x66')){_0x14f35b[_0x2b9af]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x33816d['value']+'%',null);}else{_0x514504=_[_0x43d5('0x61')](_0x550580,[_0x43d5('0x33'),_0x43d5('0x72')]);_0x33816d[_0x43d5('0x4c')]=_0x43d5('0x72');_0x21af9c=as[_0x43d5('0x73')](_0x132a28,_0x514504['type'],_0x33816d);_0x14f35b[_0x2b9af](_0x21af9c['text'],_0x21af9c[_0x43d5('0x63')]['start'],_0x21af9c[_0x43d5('0x63')][_0x43d5('0x29')]);}break;case'body':_0x21af9c=as[_0x43d5('0x73')]('me',null,_0x33816d);_0x14f35b[_0x2b9af](_0x21af9c[_0x43d5('0x6c')],_0x21af9c[_0x43d5('0x63')][_0x43d5('0x6d')],_0x21af9c[_0x43d5('0x63')][_0x43d5('0x29')]);break;}}else{var _0x21af9c=as[_0x43d5('0x73')](_0x132a28,_0x514504[_0x43d5('0x3d')],_0x33816d);_0x14f35b[_0x2b9af](_0x21af9c['text'],_0x21af9c[_0x43d5('0x63')]['start'],_0x21af9c[_0x43d5('0x63')][_0x43d5('0x29')]);}}}else{var _0xdca10f=_(_0x325109['query'])['keys']()[_0x43d5('0x3b')](function(_0x2969fa){return _['some'](_0x550580,[_0x43d5('0x33'),_0x2969fa])?_0x2969fa:undefined;})[_0x43d5('0x74')]()[_0x43d5('0x63')]();if(!_[_0x43d5('0x75')](_0xdca10f)){_0xdca10f['forEach'](function(_0x196175){if(_0x196175===_0x43d5('0x76')){_0x5b10bc[_0x43d5('0x4a')](_0x43d5('0x77'),[][_0x43d5('0x78')](_0x325109['query'][_0x196175]));}else if(_0x196175===_0x43d5('0x79')){var _0x2b2ce7=JSON[_0x43d5('0x7a')](_0x325109[_0x43d5('0x40')][_0x196175])[_0x43d5('0x7b')];var _0x734f49=JSON[_0x43d5('0x7a')](_0x325109[_0x43d5('0x40')][_0x196175])[_0x43d5('0x7c')];_0x5b10bc['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b2ce7,_0x734f49);}else{if(_0x325109[_0x43d5('0x40')][_0x196175]==='null'){_0x5b10bc['where']('i.'+_0x196175+'\x20IS\x20NULL');}else{_0x5b10bc['where']('i.'+_0x196175+_0x43d5('0x7d'),_0x325109[_0x43d5('0x40')][_0x196175]);}}});}if(_0x325109[_0x43d5('0x40')][_0x43d5('0x7e')]){if(_0x325109[_0x43d5('0x40')][_0x43d5('0x7e')]==0x1){_0x5b10bc[_0x43d5('0x64')](_0x43d5('0x7f'));}else{_0x5b10bc[_0x43d5('0x64')](_0x43d5('0x80'));}}if(_0x325109['query']['tag']){_0x3374af=_[_0x43d5('0x81')](_0x325109[_0x43d5('0x40')][_0x43d5('0x82')])?_0x325109[_0x43d5('0x40')][_0x43d5('0x82')]:new Array(_0x325109[_0x43d5('0x40')][_0x43d5('0x82')]);_0x3374af[_0x43d5('0x38')](function(_0x3de9f7){_0x492d0e['or'](_0x43d5('0x6e'),'%,'+_0x3de9f7+',%');});}if(_0x325109[_0x43d5('0x40')][_0x43d5('0x83')]){var _0x1c0746=_0x325109[_0x43d5('0x40')][_0x43d5('0x83')]['replace']('\x5c','\x5c\x5c')[_0x43d5('0x84')](/'/g,'\x27\x27');if(qs[_0x43d5('0x85')](_0x1c0746)){_0x14f35b['or'](_0x43d5('0x86'),_0x1c0746+'%');}else{_0x14f35b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1c0746))['or'](_0x43d5('0x87'),_0x1c0746+'%');}}}_0x5b10bc[_0x43d5('0x4a')](_0x14f35b);_0x5b10bc[_0x43d5('0x88')](_0x43d5('0x89'));var _0x1facfb={'type':db[_0x43d5('0x8a')]['QueryTypes'][_0x43d5('0x8b')],'raw':!![]};var _0x3470e7=_0x5b10bc[_0x43d5('0x8c')]();_0x3470e7['field'](_0x43d5('0x89'));_0x3470e7[_0x43d5('0x4c')](_0x43d5('0x8d'),_0x43d5('0x62'));if(_0x4f8a07[_0x43d5('0x8e')]){_0x4f8a07[_0x43d5('0x8e')][_0x43d5('0x38')](function(_0x1f7d05){var _0x18a3a7=_0x1f7d05[0x0]===_0x43d5('0x8f')?_0x1f7d05[0x0]:'i.'+_0x1f7d05[0x0];_0x5b10bc['order'](_0x18a3a7,_0x1f7d05[0x1]===_0x43d5('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x3374af)){_0x5b10bc[_0x43d5('0x64')](_0x492d0e);_0x3470e7['where'](_0x43d5('0x91'),_0x3374af);}BPromise[_0x43d5('0x92')]()[_0x43d5('0x1d')](function(){if(!_0x18b356){if(_0x325109['query'][_0x43d5('0x76')])return;_0x3470e7[_0x43d5('0x4a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5b10bc[_0x43d5('0x4a')](_0x43d5('0x93'));return;}if(_0x325109[_0x43d5('0x94')][_0x43d5('0x95')]!=='agent')return;return _0x325109['user'][_0x43d5('0x96')]({'attributes':['id'],'raw':!![]})[_0x43d5('0x1d')](function(_0x17179c){if(_[_0x43d5('0x75')](_0x17179c)){_0x3470e7[_0x43d5('0x4a')](_0x43d5('0x97'));_0x5b10bc['where'](_0x43d5('0x97'));}else{_0x3470e7[_0x43d5('0x4a')](_0x43d5('0x77'),_['map'](_0x17179c,'id'));_0x5b10bc[_0x43d5('0x4a')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x17179c,'id'));}});})[_0x43d5('0x1d')](function(){if(_0x325109[_0x43d5('0x94')][_0x43d5('0x95')]===_0x43d5('0x98')&&!_0x18b356&&!_0x325109[_0x43d5('0x40')]['ChatWebsiteId'])return[];return db[_0x43d5('0x99')]['query'](_0x3470e7['toString'](),_0x1facfb);})[_0x43d5('0x1d')](function(_0x589880){_0x440921['count']=_0x589880[_0x43d5('0x46')];if(_0x440921[_0x43d5('0x2b')]===0x0)return[];return db[_0x43d5('0x99')][_0x43d5('0x40')](_0x323ebd['toString'](),_0x1facfb)[_0x43d5('0x1d')](function(_0x1a0f81){_0x917423=_[_0x43d5('0x9a')](_0x1a0f81,'id');_0x1facfb=_['merge'](_0x1facfb,{'model':db[_0x43d5('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x325109[_0x43d5('0x40')][_0x43d5('0x44')]){_0x4f8a07[_0x43d5('0x45')][_0x43d5('0x38')](function(_0x540406){_0x5b10bc[_0x43d5('0x4c')]('i.'+_0x540406);});}else{_0x5b10bc[_0x43d5('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x43d5('0x62'));_0x5b10bc[_0x43d5('0x4c')](_0x43d5('0x9b'),_0x43d5('0x9c'));_0x5b10bc[_0x43d5('0x4c')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x5b10bc['field'](_0x43d5('0x9d'),_0x43d5('0x8f'));_0x5b10bc[_0x43d5('0x4c')]('i.*');_0x5b10bc[_0x43d5('0x4c')](_0x43d5('0x9e'),_0x43d5('0x9f'));_0x5b10bc[_0x43d5('0x4c')](_0x43d5('0xa0'),_0x43d5('0xa1'));_0x5b10bc[_0x43d5('0x4c')]('c.email',_0x43d5('0xa2'));_0x5b10bc['field']('c.phone',_0x43d5('0xa3'));_0x5b10bc[_0x43d5('0x4c')](_0x43d5('0xa4'),_0x43d5('0xa5'));_0x5b10bc['field'](_0x43d5('0xa6'),_0x43d5('0xa7'));_0x5b10bc[_0x43d5('0x4c')](_0x43d5('0xa8'),_0x43d5('0xa9'));_0x5b10bc[_0x43d5('0x4c')](_0x43d5('0xaa'),_0x43d5('0xab'));_0x5b10bc[_0x43d5('0x4c')](_0x43d5('0xac'),_0x43d5('0x37'));}if(_0x4f8a07[_0x43d5('0x2d')])_0x5b10bc[_0x43d5('0x2d')](_0x4f8a07[_0x43d5('0x2d')]);if(_0x4f8a07[_0x43d5('0x2c')])_0x5b10bc[_0x43d5('0x2c')](_0x4f8a07[_0x43d5('0x2c')]);return db[_0x43d5('0x99')][_0x43d5('0x40')](_0x5b10bc['toString'](),_0x1facfb);})['then'](function(_0x4fffa4){_0x568b87[_0x43d5('0x4a')](_0x43d5('0xad'),_[_0x43d5('0x3b')](_0x4fffa4,'id'));return db[_0x43d5('0x99')][_0x43d5('0x40')](_0x568b87[_0x43d5('0xae')](),_0x1facfb)[_0x43d5('0x1d')](function(_0x47b45f){var _0x6eaae0=_['groupBy'](_0x47b45f,_0x43d5('0xaf'));var _0x18d627=[];_0x4fffa4[_0x43d5('0x38')](function(_0x4439c2){_0x18d627['push'](updateChatInteraction(_0x4439c2,_0x917423,_0x6eaae0));});return BPromise[_0x43d5('0xb0')](_0x18d627);});});})[_0x43d5('0x1d')](function(_0x28bdc1){_0x440921[_0x43d5('0xb1')]=_0x28bdc1;return _0x440921;})[_0x43d5('0x1d')](respondWithFilteredResult(_0x4a9d8d,_0x4f8a07))[_0x43d5('0x27')](handleError(_0x4a9d8d,null));};exports[_0x43d5('0xb2')]=function(_0x5dc824,_0x2b2856){var _0x40accc={'raw':![],'where':{'id':_0x5dc824['params']['id']}},_0x1916c4={};_0x1916c4[_0x43d5('0x43')]=_['keys'](db[_0x43d5('0x3c')][_0x43d5('0xb3')]);_0x1916c4['query']=_[_0x43d5('0x3f')](_0x5dc824['query']);_0x1916c4[_0x43d5('0x41')]=_[_0x43d5('0x42')](_0x1916c4[_0x43d5('0x43')],_0x1916c4[_0x43d5('0x40')]);_0x40accc[_0x43d5('0x45')]=_[_0x43d5('0x42')](_0x1916c4['model'],qs[_0x43d5('0x44')](_0x5dc824[_0x43d5('0x40')][_0x43d5('0x44')]));_0x40accc[_0x43d5('0x45')]=_0x40accc['attributes'][_0x43d5('0x46')]?_0x40accc[_0x43d5('0x45')]:_0x1916c4[_0x43d5('0x43')];if(_0x5dc824[_0x43d5('0x40')][_0x43d5('0xb4')]){_0x40accc[_0x43d5('0xb5')]=[{'all':!![]}];}_0x40accc=_[_0x43d5('0xb6')]({},_0x40accc,_0x5dc824[_0x43d5('0xb7')]);return db[_0x43d5('0x3c')][_0x43d5('0x61')](_0x40accc)[_0x43d5('0x1d')](handleEntityNotFound(_0x2b2856,null))['then'](respondWithResult(_0x2b2856,null))[_0x43d5('0x27')](handleError(_0x2b2856,null));};exports[_0x43d5('0xb8')]=function(_0x54cbe1,_0x29643d){return db[_0x43d5('0x3c')][_0x43d5('0xb8')](_0x54cbe1[_0x43d5('0xb9')],{})[_0x43d5('0x1d')](respondWithResult(_0x29643d,0xc9))['catch'](handleError(_0x29643d,null));};exports[_0x43d5('0xba')]=function(_0x110676,_0x32c365){if(_0x110676[_0x43d5('0xb9')]['id']){delete _0x110676[_0x43d5('0xb9')]['id'];}return db[_0x43d5('0x3c')]['find']({'where':{'id':_0x110676['params']['id']}})[_0x43d5('0x1d')](handleEntityNotFound(_0x32c365,null))[_0x43d5('0x1d')](saveUpdates(_0x110676[_0x43d5('0xb9')],null))['then'](respondWithResult(_0x32c365,null))['catch'](handleError(_0x32c365,null));};exports[_0x43d5('0x31')]=function(_0x1a9119,_0x328217){return db[_0x43d5('0x3c')][_0x43d5('0x61')]({'where':{'id':_0x1a9119[_0x43d5('0xbb')]['id']}})[_0x43d5('0x1d')](handleEntityNotFound(_0x328217,null))[_0x43d5('0x1d')](removeEntity(_0x328217,null))[_0x43d5('0x27')](handleError(_0x328217,null));};exports[_0x43d5('0xbc')]=function(_0x5dd3f5,_0x3307ce){return db['ChatInteraction'][_0x43d5('0xbc')]()['then'](respondWithResult(_0x3307ce,null))['catch'](handleError(_0x3307ce,null));};exports[_0x43d5('0xbd')]=function(_0x30bb1f,_0x4e25ba){var _0x5befcf=_0x30bb1f[_0x43d5('0xbb')]['id'];var _0x1fe0af;var _0x1dee97;var _0x11e7a4;return db['ChatInteraction']['findOne']({'where':{'id':_0x5befcf}})[_0x43d5('0x1d')](function(_0x30807d){_0x1fe0af=_0x30807d;return db['ChatWebsite']['findOne']({'where':{'id':_0x30807d[_0x43d5('0x76')]},'attributes':['id',_0x43d5('0xbe'),_0x43d5('0xbf')],'raw':!![]});})['then'](function(_0x4da8ec){if(_0x4da8ec&&_0x4da8ec[_0x43d5('0xbe')]&&_0x4da8ec[_0x43d5('0xbf')]){_0x1dee97=_0x4da8ec;var _0x54046c={'rejectUnauthorized':![],'method':_0x43d5('0xc0'),'uri':_0x43d5('0xc1'),'headers':{'X-APIKEY':_0x4da8ec[_0x43d5('0xbe')]},'body':{'name':'MotionCWB:'+_0x5befcf},'redirect':_0x43d5('0xc2'),'json':!![]};return rp(_0x54046c);}else{throw new db[(_0x43d5('0x8a'))][(_0x43d5('0xc3'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x43d5('0x1d')](function(_0x4d8672){_0x11e7a4=_0x4d8672;if(_0x11e7a4['id']){var _0x5cbe58={'body':_0x11e7a4[_0x43d5('0xc4')],'ChatWebsiteId':_0x1dee97['id'],'ChatInteractionId':_0x1fe0af['id'],'direction':_0x43d5('0xc5'),'UserId':_0x30bb1f['user']['id']};return db[_0x43d5('0xc6')][_0x43d5('0xb8')](_0x5cbe58,{});}else{throw new db['Sequelize'][(_0x43d5('0xc3'))](_0x43d5('0xc7'));}})[_0x43d5('0x1d')](function(){return _0x1fe0af[_0x43d5('0xc8')]({'vidaooSessionId':_0x11e7a4['id']});})[_0x43d5('0x1d')](respondWithResult(_0x4e25ba,null))[_0x43d5('0x27')](handleError(_0x4e25ba,null));};exports['customUpdate']=function(_0x385dfa,_0x21c607){if(_0x385dfa[_0x43d5('0xb9')]['id']){delete _0x385dfa['body']['id'];}return db[_0x43d5('0x3c')][_0x43d5('0x61')]({'where':{'id':_0x385dfa[_0x43d5('0xbb')]['id']},'include':[{'model':db[_0x43d5('0xc9')],'as':'Contact'}]})[_0x43d5('0x1d')](handleEntityNotFound(_0x21c607,null))[_0x43d5('0x1d')](saveUpdates(_0x385dfa['body'],null))[_0x43d5('0x1d')](respondWithResult(_0x21c607,null))[_0x43d5('0x27')](handleError(_0x21c607,null));};exports[_0x43d5('0xca')]=function(_0x5578e5,_0x35de51,_0x5cd0fa){if(_0x5578e5[_0x43d5('0xb9')]['id']){delete _0x5578e5['body']['id'];}return db[_0x43d5('0x3c')]['find']({'where':{'id':_0x5578e5['params']['id']}})[_0x43d5('0x1d')](function(_0x33487c){if(!_0x33487c){logger[_0x43d5('0x23')](_0x43d5('0xcb'),_0x43d5('0xca'),0x194,_0x43d5('0xcc'));_0x35de51[_0x43d5('0xcd')](0x194);}else{if(_0x33487c[_0x43d5('0x72')]){throw new db[(_0x43d5('0x8a'))][(_0x43d5('0xc3'))](_0x43d5('0xce'));}}return _0x33487c;})[_0x43d5('0x1d')](function(_0x586c4f){if(_0x586c4f){return _0x586c4f[_0x43d5('0xba')]({'closed':_0x5578e5[_0x43d5('0xb9')][_0x43d5('0xcf')],'disposition':_0x5578e5[_0x43d5('0xb9')]['disposition']})[_0x43d5('0x1d')](function(_0x4d3f5b){return _0x4d3f5b;});}})[_0x43d5('0x1d')](function(_0xcee742){return respondWithRpcPromise(_0x43d5('0xd0'),'abandon',_0x5578e5[_0x43d5('0xb9')],client9004);})[_0x43d5('0x1d')](respondWithResult(_0x35de51,null))[_0x43d5('0x27')](handleError(_0x35de51,null));};exports[_0x43d5('0xd1')]=function(_0x283765,_0x3dfefb,_0x4d7532){_0x283765['body'][_0x43d5('0x33')]=_0x283765[_0x43d5('0xd2')][_0x43d5('0xd3')];_0x283765['body'][_0x43d5('0xd4')]=_0x283765['file'][_0x43d5('0xd5')];_0x283765[_0x43d5('0xb9')][_0x43d5('0x3d')]=_0x283765['file'][_0x43d5('0xd6')];return db['Attachment'][_0x43d5('0xb8')](_0x283765[_0x43d5('0xb9')])[_0x43d5('0x1d')](respondWithResult(_0x3dfefb,0xc9))['catch'](handleError(_0x3dfefb,null));};exports[_0x43d5('0xd7')]=function(_0x332494,_0x290af7,_0x41136e){return db['ChatInteraction'][_0x43d5('0xd8')]({'where':{'id':_0x332494['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x290af7,null))[_0x43d5('0x1d')](function(_0x812cc0){if(_0x812cc0){if(_0x812cc0[_0x43d5('0xcf')]){return _0x290af7[_0x43d5('0x28')](0x193)[_0x43d5('0x2a')]({'status':0x193,'message':_0x43d5('0xd9')});}return db['Attachment'][_0x43d5('0xd8')]({'where':{'id':_0x332494[_0x43d5('0x40')][_0x43d5('0xda')]},'raw':!![]})[_0x43d5('0x1d')](handleEntityNotFound(_0x290af7,null));}})['then'](function(_0xe1fa59){if(_0xe1fa59){var _0x2c8a93=_0xe1fa59[_0x43d5('0xdb')]!==null;var _0x393655=path[_0x43d5('0xdc')](config['root'],_0x43d5('0xdd'));if(_0x2c8a93){_0x393655=path[_0x43d5('0xdc')](_0x393655,'offline-chat/');}var _0x3ad987=path[_0x43d5('0xdc')](_0x393655,_0xe1fa59['basename']);return _0x290af7[_0x43d5('0xde')](_0x3ad987);}})[_0x43d5('0x27')](handleError(_0x290af7,null));};exports[_0x43d5('0xdf')]=function(_0x33d6ad,_0x14d7d0){var _0x12a8ee=null;var _0x3fb2b8=null;var _0x1b5780=null;var _0x349108=null;if(_0x33d6ad['body']['id']){delete _0x33d6ad[_0x43d5('0xb9')]['id'];}if(_0x33d6ad['body'][_0x43d5('0xe0')]){_0x349108=path[_0x43d5('0xdc')](config[_0x43d5('0xe1')],_0x43d5('0xe2'),util[_0x43d5('0xe3')](_0x43d5('0xe4'),Date[_0x43d5('0xe5')]()));_0x33d6ad['body'][_0x43d5('0xe6')]=_0x349108;}return db[_0x43d5('0x3c')][_0x43d5('0x61')]({'where':{'id':_0x33d6ad[_0x43d5('0xbb')]['id']},'include':[{'model':db[_0x43d5('0xc6')],'as':_0x43d5('0xe7'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x14d7d0,null))[_0x43d5('0x1d')](saveUpdates(_0x33d6ad[_0x43d5('0xb9')],null))['then'](function(_0x3d448c){if(_0x3d448c){_0x12a8ee=_0x3d448c;return db['ChatWebsite']['find']({'where':{'id':_0x12a8ee[_0x43d5('0x76')]}});}})[_0x43d5('0x1d')](function(_0x21be07){if(_0x21be07){_0x1b5780=_0x21be07;return db[_0x43d5('0xc9')][_0x43d5('0x61')]({'where':{'id':_0x12a8ee['ContactId']}});}})[_0x43d5('0x1d')](function(_0x4a66be){if(_0x4a66be){_0x3fb2b8=_0x4a66be;if(_0x349108){var _0x40f514=null;for(var _0x4901e9=0x1;_0x4901e9<_0x12a8ee[_0x43d5('0xe7')]['length'];++_0x4901e9){_0x40f514=_0x12a8ee['Messages'][_0x4901e9];var _0x385f2a=_0x40f514[_0x43d5('0x72')]?util['format']('%s%d',_0x1b5780[_0x43d5('0xe8')],_0x40f514[_0x43d5('0x72')]):_0x43d5('0xe9');var _0x26c4a2=_0x33d6ad[_0x43d5('0xb9')][_0x43d5('0xea')]||util[_0x43d5('0xe3')](_0x43d5('0xeb'),_0x43d5('0xec'),_0x40f514[_0x43d5('0x6b')]);switch(_0x1b5780['agentIdentifier']){case'website_alias':_0x385f2a=_0x40f514['UserId']?util[_0x43d5('0xe3')](_0x43d5('0xeb'),_0x1b5780[_0x43d5('0xe8')],_0x40f514[_0x43d5('0x72')]):'System';break;case'agent_alias':_0x385f2a=_0x40f514['UserId']?_0x40f514[_0x43d5('0x70')][_0x43d5('0xed')]||_0x40f514[_0x43d5('0x70')][_0x43d5('0x36')]:_0x43d5('0xe9');break;case _0x43d5('0xee'):_0x385f2a=_0x40f514[_0x43d5('0x72')]?_0x40f514['User'][_0x43d5('0x36')]:_0x43d5('0xe9');break;default:_0x385f2a=_0x40f514[_0x43d5('0x72')]?util[_0x43d5('0xe3')](_0x43d5('0xeb'),_0x1b5780['agentAlias'],_0x40f514[_0x43d5('0x72')]):'System';}var _0x34821d=util[_0x43d5('0xe3')](_0x43d5('0xef'),moment(_0x40f514[_0x43d5('0x79')])[_0x43d5('0xe3')](_0x43d5('0xf0')),_0x40f514[_0x43d5('0xf1')]==='in'?_0x26c4a2:_0x385f2a,_0x40f514[_0x43d5('0xb9')]);if(!_0x40f514[_0x43d5('0xf2')]){fs['appendFileSync'](_0x349108,_0x34821d);}}return db[_0x43d5('0xf3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x43d5('0xf4')],'as':_0x43d5('0xf5'),'raw':!![]}]});}}})[_0x43d5('0x1d')](function(_0x4a7b8a){if(_0x4a7b8a&&_0x4a7b8a['Smtp']&&_0x33d6ad[_0x43d5('0xb9')]){var _0x1ae823={'tls':{'rejectUnauthorized':![]}};if(_0x4a7b8a[_0x43d5('0xf5')][_0x43d5('0xf6')]){_0x1ae823['service']=_0x4a7b8a[_0x43d5('0xf5')][_0x43d5('0xf6')];}else{_0x1ae823[_0x43d5('0xf7')]=_0x4a7b8a[_0x43d5('0xf5')][_0x43d5('0xf7')];_0x1ae823['port']=_0x4a7b8a[_0x43d5('0xf5')][_0x43d5('0xf8')];_0x1ae823['secure']=_0x4a7b8a[_0x43d5('0xf5')]['secure'];}if(_0x4a7b8a[_0x43d5('0xf5')][_0x43d5('0xf9')]){_0x1ae823['auth']={'user':_0x4a7b8a['Smtp'][_0x43d5('0x94')],'pass':_0x4a7b8a[_0x43d5('0xf5')]['pass']};}return respondWithRpcPromise(_0x43d5('0xfa'),'sendMail',{'account':_0x1ae823,'message':{'from':util[_0x43d5('0xe3')](_0x43d5('0xfb'),_0x4a7b8a[_0x43d5('0x33')],_0x4a7b8a[_0x43d5('0xfc')]||_0x4a7b8a[_0x43d5('0xf5')]['user']),'to':_0x33d6ad[_0x43d5('0xb9')][_0x43d5('0xe0')],'subject':_0x43d5('0xfd'),'text':util[_0x43d5('0xe3')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x33d6ad['body']['mailTranscript']),'attachments':[{'path':_0x349108}]}})[_0x43d5('0x1d')](function(){return _0x12a8ee;})[_0x43d5('0x27')](function(_0x5be121){console[_0x43d5('0x23')](_0x5be121);});}else{return _0x12a8ee;}})[_0x43d5('0x1d')](respondWithStatusCode(_0x14d7d0,0xc8))[_0x43d5('0x27')](handleError(_0x14d7d0,null));};exports['addMessage']=function(_0x786411,_0x265632,_0x27cd8c){return db['ChatMessage'][_0x43d5('0x61')]({'where':{'id':_0x786411[_0x43d5('0xbb')]['id']}})['then'](handleEntityNotFound(_0x265632,null))[_0x43d5('0x1d')](function(_0x5822f0){if(_0x5822f0){return _0x5822f0[_0x43d5('0xfe')](_0x786411[_0x43d5('0xb9')]['ids'],_[_0x43d5('0xff')](_0x786411[_0x43d5('0xb9')],[_0x43d5('0x100'),'id'])||{});}})[_0x43d5('0x1d')](respondWithResult(_0x265632,null))[_0x43d5('0x27')](handleError(_0x265632,null));};exports[_0x43d5('0x101')]=function(_0x5cb3f5,_0x13a36e,_0x8f3881){var _0x124106={'raw':![],'where':{}};var _0x41e618={};var _0x5853e6={'count':0x0,'rows':[]};return db[_0x43d5('0x3c')][_0x43d5('0xd8')]({'where':{'id':_0x5cb3f5[_0x43d5('0xbb')]['id']}})[_0x43d5('0x1d')](handleEntityNotFound(_0x13a36e,null))[_0x43d5('0x1d')](function(_0x3ddbcd){if(_0x3ddbcd){_0x41e618[_0x43d5('0x43')]=_[_0x43d5('0x3f')](db[_0x43d5('0xc6')][_0x43d5('0xb3')]);_0x41e618['query']=_['keys'](_0x5cb3f5['query']);_0x41e618['filters']=_[_0x43d5('0x42')](_0x41e618['model'],_0x41e618[_0x43d5('0x40')]);_0x124106[_0x43d5('0x45')]=_[_0x43d5('0x42')](_0x41e618[_0x43d5('0x43')],qs[_0x43d5('0x44')](_0x5cb3f5[_0x43d5('0x40')]['fields']));_0x124106['attributes']=_0x124106[_0x43d5('0x45')][_0x43d5('0x46')]?_0x124106['attributes']:_0x41e618[_0x43d5('0x43')];if(!_0x5cb3f5[_0x43d5('0x40')][_0x43d5('0x47')]('nolimit')){_0x124106[_0x43d5('0x2d')]=qs[_0x43d5('0x2d')](_0x5cb3f5[_0x43d5('0x40')][_0x43d5('0x2d')]);_0x124106[_0x43d5('0x2c')]=qs['offset'](_0x5cb3f5['query'][_0x43d5('0x2c')]);}_0x124106[_0x43d5('0x8e')]=qs[_0x43d5('0x49')](_0x5cb3f5[_0x43d5('0x40')][_0x43d5('0x49')]);_0x124106[_0x43d5('0x4a')]=qs[_0x43d5('0x41')](_['pick'](_0x5cb3f5[_0x43d5('0x40')],_0x41e618[_0x43d5('0x41')]));_0x124106[_0x43d5('0x4a')][_0x43d5('0xaf')]=_0x3ddbcd['id'];if(_0x5cb3f5[_0x43d5('0x40')]['filter']){_0x124106['where']=_[_0x43d5('0xb6')](_0x124106[_0x43d5('0x4a')],{'$or':_['map'](_0x124106[_0x43d5('0x45')],function(_0xce2775){var _0x280885={};_0x280885[_0xce2775]={'$like':'%'+_0x5cb3f5[_0x43d5('0x40')]['filter']+'%'};return _0x280885;})});}if(_0x5cb3f5['query'][_0x43d5('0x7b')]){var _0x4da844=_0x5cb3f5[_0x43d5('0x40')][_0x43d5('0x7b')][_0x43d5('0x67')](',');var _0x1d3ff5={};_0x1d3ff5[_0x4da844[0x0]]={'$gte':moment(_0x4da844[0x1])[_0x43d5('0xe3')](_0x43d5('0x102'))};_0x124106[_0x43d5('0x4a')]=_[_0x43d5('0xb6')](_0x124106[_0x43d5('0x4a')],_0x1d3ff5);}_0x124106=_[_0x43d5('0xb6')]({},_0x124106,_0x5cb3f5[_0x43d5('0xb7')]);return db[_0x43d5('0xc6')][_0x43d5('0x2b')]({'where':_0x124106[_0x43d5('0x4a')]})[_0x43d5('0x1d')](function(_0x38694f){_0x5853e6[_0x43d5('0x2b')]=_0x38694f;if(_0x5cb3f5[_0x43d5('0x40')][_0x43d5('0xb4')]){_0x124106[_0x43d5('0xb5')]=[{'all':!![]}];}return db[_0x43d5('0xc6')][_0x43d5('0x103')](_0x124106);})[_0x43d5('0x1d')](function(_0x3d8ae5){_0x5853e6['rows']=_0x3d8ae5;return _0x5853e6;});}})[_0x43d5('0x1d')](respondWithFilteredResult(_0x13a36e,_0x124106))[_0x43d5('0x27')](handleError(_0x13a36e,null));};exports[_0x43d5('0x104')]=function(_0x2e989a,_0x1f260e,_0x27e54f){var _0xba4778={'where':{}},_0x12c3a0={},_0x35cffc={'count':0x0,'rows':[]};return db[_0x43d5('0x3c')][_0x43d5('0xd8')]({'where':{'id':_0x2e989a['params']['id']}})[_0x43d5('0x1d')](handleEntityNotFound(_0x1f260e,null))['then'](function(_0x2eec6d){if(_0x2eec6d){_0x12c3a0[_0x43d5('0x43')]=_[_0x43d5('0x3f')](db['ChatMessage'][_0x43d5('0xb3')]);_0x12c3a0[_0x43d5('0x40')]=_[_0x43d5('0x3f')](_0x2e989a[_0x43d5('0x40')]);_0x12c3a0[_0x43d5('0x41')]=_['intersection'](_0x12c3a0['model'],_0x12c3a0[_0x43d5('0x40')]);_0xba4778['attributes']=_[_0x43d5('0x42')](_0x12c3a0['model'],qs[_0x43d5('0x44')](_0x2e989a[_0x43d5('0x40')][_0x43d5('0x44')]));_0xba4778[_0x43d5('0x45')]=_0xba4778[_0x43d5('0x45')][_0x43d5('0x46')]?_0xba4778[_0x43d5('0x45')]:_0x12c3a0[_0x43d5('0x43')];if(!_0x2e989a[_0x43d5('0x40')][_0x43d5('0x47')]('nolimit')){_0xba4778[_0x43d5('0x2d')]=qs[_0x43d5('0x2d')](_0x2e989a[_0x43d5('0x40')][_0x43d5('0x2d')]);_0xba4778[_0x43d5('0x2c')]=qs[_0x43d5('0x2c')](_0x2e989a[_0x43d5('0x40')][_0x43d5('0x2c')]);}_0xba4778[_0x43d5('0x8e')]=qs[_0x43d5('0x49')](_0x2e989a[_0x43d5('0x40')][_0x43d5('0x49')]);_0xba4778['where']=qs[_0x43d5('0x41')](_[_0x43d5('0x105')](_0x2e989a[_0x43d5('0x40')],_0x12c3a0[_0x43d5('0x41')]));_0xba4778[_0x43d5('0x4a')][_0x43d5('0xaf')]=_0x2eec6d['id'];if(_0x2e989a['query'][_0x43d5('0x83')]){_0xba4778[_0x43d5('0x4a')]=_[_0x43d5('0xb6')](_0xba4778[_0x43d5('0x4a')],{'$or':_[_0x43d5('0x3b')](_0xba4778[_0x43d5('0x45')],function(_0x197fd4){var _0x335569={};_0x335569[_0x197fd4]={'$like':'%'+_0x2e989a[_0x43d5('0x40')][_0x43d5('0x83')]+'%'};return _0x335569;})});}_0xba4778[_0x43d5('0x4a')]['secret']=![];if(_0x2e989a[_0x43d5('0x40')]['id']){_0xba4778['where']['id']={'$gt':_0x2e989a['query']['id']};}_0xba4778=_[_0x43d5('0xb6')]({},_0xba4778,_0x2e989a['options']);return db[_0x43d5('0xc6')]['count']({'where':_0xba4778['where']})[_0x43d5('0x1d')](function(_0x2655c5){_0x35cffc[_0x43d5('0x2b')]=_0x2655c5;_0xba4778[_0x43d5('0xb5')]=[];if(_0x2e989a['query'][_0x43d5('0x106')]){_0xba4778[_0x43d5('0xb5')][_0x43d5('0x39')]({'model':db[_0x43d5('0x70')],'as':_0x43d5('0x70'),'attributes':['id',_0x43d5('0x36'),_0x43d5('0xed')]});}if(_0x2e989a[_0x43d5('0x40')][_0x43d5('0xb4')]){_0xba4778[_0x43d5('0xb5')]=[{'all':!![]}];}return db[_0x43d5('0xc6')][_0x43d5('0x103')](_0xba4778);})[_0x43d5('0x1d')](function(_0x5dac80){_0x35cffc['rows']=_0x5dac80;return _0x35cffc;});}})[_0x43d5('0x1d')](respondWithFilteredResult(_0x1f260e,_0xba4778))[_0x43d5('0x27')](handleError(_0x1f260e,null));};exports[_0x43d5('0x107')]=function(_0x312a2d,_0xa7555f,_0x59e370){return db[_0x43d5('0x3c')][_0x43d5('0x61')]({'where':{'id':_0x312a2d[_0x43d5('0xbb')]['id']}})[_0x43d5('0x1d')](handleEntityNotFound(_0xa7555f,null))[_0x43d5('0x1d')](function(_0xe6f85a){if(_0xe6f85a){return _0xe6f85a[_0x43d5('0x108')](_0x312a2d[_0x43d5('0xb9')][_0x43d5('0x100')],_[_0x43d5('0xff')](_0x312a2d[_0x43d5('0xb9')],[_0x43d5('0x100'),'id'])||{})[_0x43d5('0x109')](function(){return db[_0x43d5('0x10a')]['findAll']({'attributes':['id',_0x43d5('0x33'),_0x43d5('0x4d')],'where':{'id':_0x312a2d['body']['ids']}});})['then'](function(_0x106bef){socket['emit'](_0x43d5('0x10b'),{'id':Number(_0x312a2d['params']['id']),'tags':_0x106bef||[]});return{'id':Number(_0x312a2d[_0x43d5('0xbb')]['id']),'tags':_0x106bef||[]};});}})[_0x43d5('0x1d')](respondWithResult(_0xa7555f,null))['catch'](handleError(_0xa7555f,null));};exports[_0x43d5('0x10c')]=function(_0x521665,_0x4f1f80,_0x2970c0){return db['ChatInteraction'][_0x43d5('0x61')]({'where':{'id':_0x521665['params']['id']}})[_0x43d5('0x1d')](handleEntityNotFound(_0x4f1f80,null))[_0x43d5('0x1d')](function(_0x330ff3){if(_0x330ff3){return _0x330ff3['removeTags'](_0x521665[_0x43d5('0x40')]['ids']);}})[_0x43d5('0x1d')](respondWithStatusCode(_0x4f1f80,null))[_0x43d5('0x27')](handleError(_0x4f1f80,null));};exports[_0x43d5('0xde')]=function(_0x4ef4a7,_0x248aae){var _0x483022=moment()[_0x43d5('0x10d')]()[_0x43d5('0xae')]();var _0x4339bd=path[_0x43d5('0xdc')](config[_0x43d5('0xe1')],_0x43d5('0x10e'),_0x43d5('0x10f'),'tmp');var _0x32ab72=path['join'](config[_0x43d5('0xe1')],_0x43d5('0x10e'),_0x43d5('0x10f'),_0x43d5('0x110'));var _0x3ee43f=path[_0x43d5('0xdc')](_0x4339bd,_0x483022);var _0x5d83b9=util['format'](_0x43d5('0x111'),_0x4ef4a7[_0x43d5('0xbb')]['id'],_0x483022);var _0x4d2ad5=path[_0x43d5('0xdc')](_0x4339bd,_0x5d83b9);var _0x2a47b0=[];_0x2a47b0[_0x43d5('0x39')]({'model':db[_0x43d5('0x70')],'as':_0x43d5('0x70'),'attributes':['id','fullname'],'raw':!![]});_0x2a47b0[_0x43d5('0x39')]({'model':db[_0x43d5('0xc9')],'as':'Contact','attributes':['id',_0x43d5('0x112'),'lastName'],'raw':!![]});if(_0x4ef4a7[_0x43d5('0x40')]['attachments']){_0x2a47b0[_0x43d5('0x39')]({'model':db['Attachment'],'as':_0x43d5('0x113'),'raw':!![]});}var _0x421076=[{'model':db[_0x43d5('0xc6')],'as':_0x43d5('0xe7'),'attributes':['id',_0x43d5('0xb9'),_0x43d5('0x79'),'direction',_0x43d5('0xf2'),_0x43d5('0x7e')],'include':_0x2a47b0}];_0x421076[_0x43d5('0x39')]({'model':db['ChatWebsite'],'as':_0x43d5('0x114'),'attributes':['id','name']});_0x421076[_0x43d5('0x39')]({'model':db[_0x43d5('0x70')],'as':'Owner','attributes':['id',_0x43d5('0x36')]});return db[_0x43d5('0x3c')]['find']({'where':{'id':_0x4ef4a7[_0x43d5('0xbb')]['id']},'include':_0x421076})['then'](handleEntityNotFound(_0x248aae,null))[_0x43d5('0x1d')](function(_0x5e9c27){if(_0x5e9c27){var _0x442e9d=_0x5e9c27['get']({'plain':!![]});fs[_0x43d5('0x115')](_0x3ee43f);var _0x21d3ab={'format':'A4','border':_0x43d5('0x116'),'header':{'height':'40px','contents':{'first':_0x43d5('0x117')}},'footer':{'height':_0x43d5('0x118'),'contents':{'default':util[_0x43d5('0xe3')](_0x43d5('0x119'),util[_0x43d5('0xe3')](_0x43d5('0x11a'),_0x43d5('0x11b'),_0x442e9d['id']),moment()['format'](_0x43d5('0x11c'))[_0x43d5('0xae')]())}}};var _0x202fa8={'channel':_0x43d5('0x11b'),'account':_0x442e9d['Account'][_0x43d5('0x33')],'agent':_0x442e9d['Owner']?_0x442e9d[_0x43d5('0x11d')][_0x43d5('0x36')]:'N.A.','createdAt':moment(_0x442e9d[_0x43d5('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x43d5('0xae')](),'closedAt':_0x442e9d['closed']?moment(_0x442e9d[_0x43d5('0x11e')])['format'](_0x43d5('0x102'))[_0x43d5('0xae')]():'','disposition':_0x442e9d['disposition'],'chatInfo':{'browser':_0x442e9d[_0x43d5('0x11f')],'os':_0x442e9d[_0x43d5('0x120')],'referer':_0x442e9d['referer'],'customerIp':_0x442e9d[_0x43d5('0x121')],'customerPort':_0x442e9d[_0x43d5('0x122')]?_0x442e9d['customerPort']:_0x43d5('0x123')},'messages':_(_0x442e9d[_0x43d5('0xe7')])[_0x43d5('0x124')]()[_0x43d5('0x83')]({'secret':![]})['map'](function(_0x2ff268){if(_0x2ff268['Attachment']){var _0x4ee1de=path[_0x43d5('0xdc')](_0x32ab72,_0x2ff268[_0x43d5('0x113')][_0x43d5('0xd4')]);if(fs[_0x43d5('0x125')](_0x4ee1de)){fs['createReadStream'](_0x4ee1de)[_0x43d5('0x126')](fs[_0x43d5('0x127')](path[_0x43d5('0xdc')](_0x3ee43f,_0x2ff268['Attachment'][_0x43d5('0xd4')])));}}return{'date':moment(_0x2ff268[_0x43d5('0x79')])[_0x43d5('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2ff268[_0x43d5('0xf1')]==='out'?_0x2ff268[_0x43d5('0x70')]?_0x2ff268[_0x43d5('0x70')]['fullname']:_0x43d5('0xe9'):_0x2ff268['Contact']['firstName']+(_0x2ff268[_0x43d5('0x128')]['lastName']?'\x20'+_0x2ff268[_0x43d5('0x128')]['lastName']:''),'body':_0x2ff268[_0x43d5('0x113')]?_0x2ff268['Attachment'][_0x43d5('0xd4')]:_0x2ff268['body'],'direction':_0x2ff268[_0x43d5('0xf1')]===_0x43d5('0xc5')?'A':'C','secret':_0x2ff268[_0x43d5('0xf2')],'read':_0x2ff268[_0x43d5('0x7e')],'attachment':_0x2ff268[_0x43d5('0x113')]};})[_0x43d5('0x63')]()};return ejs['renderFile'](path[_0x43d5('0xdc')](config['root'],_0x43d5('0x10e'),_0x43d5('0x129'),_0x43d5('0x12a')),{'interaction':_0x202fa8})[_0x43d5('0x1d')](function(_0x5b7d39){return new BPromise(function(_0x175ab7,_0x190061){pdf['create'](_0x5b7d39,_0x21d3ab)[_0x43d5('0x12b')](path[_0x43d5('0xdc')](_0x3ee43f,_0x43d5('0x12c')+_0x442e9d['id']+'-'+_0x483022+_0x43d5('0x12d')),function(_0x667a1b,_0x144647){if(_0x667a1b)return _0x190061(_0x667a1b);_0x175ab7(_0x144647);});});})[_0x43d5('0x1d')](function(){return new BPromise(function(_0x23d054,_0x3efcc0){zipdir(_0x3ee43f,{'saveTo':_0x4d2ad5},function(_0x49c97f,_0x186e06){if(_0x49c97f)return _0x3efcc0(_0x49c97f);return _0x23d054(_0x186e06);});})[_0x43d5('0x1d')](function(){return new BPromise(function(_0x2d9f47,_0x1a51a4){rimraf(_0x3ee43f,function(_0x4bd5a8){if(_0x4bd5a8)_0x1a51a4(_0x4bd5a8);return _0x2d9f47();});});})[_0x43d5('0x1d')](function(){return _0x248aae['download'](_0x4d2ad5,_0x5d83b9,function(_0x311987){if(_0x311987){console[_0x43d5('0x12e')](_0x43d5('0x12f'),_0x311987);}else{fs[_0x43d5('0x130')](_0x4d2ad5);}});});});}else{return _0x248aae[_0x43d5('0xcd')](0xc8);}})[_0x43d5('0x27')](handleError(_0x248aae,null));}; \ No newline at end of file +var _0xc2fc=['server','transcript-%d-%s.zip','firstName','attachments','read','Account','Owner','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','N.A.','browserName','osName','customerIp','customerPort','tail','pipe','createWriteStream','lastName','renderFile','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','redis','defaults','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','count','offset','limit','set','json','reject','end','send','map','fullname','Tags','TagIds','push','index','ChatInteraction','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','field','color','from','tools_tags','select','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','Contact','split','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','forEach','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','i.ChatWebsiteId\x20IS\x20NULL','role','toString','sequelize','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','rows','show','keys','includeAll','create','update','params','destroy','describe','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','transcript-%s.txt','Messages','%s%d','agentAlias','System','customer','format','agentIdentifier','website_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','getMyMessages','includeAgent','addTags','setTags','spread','chatInteractionTags:save','removeTags','unix'];(function(_0x2c0ef3,_0x27de45){var _0x39a109=function(_0x170374){while(--_0x170374){_0x2c0ef3['push'](_0x2c0ef3['shift']());}};_0x39a109(++_0x27de45);}(_0xc2fc,0x13a));var _0xcc2f=function(_0x4c1d69,_0x424709){_0x4c1d69=_0x4c1d69-0x0;var _0x1dcc19=_0xc2fc[_0x4c1d69];return _0x1dcc19;};'use strict';var pdf=require(_0xcc2f('0x0'));var emlformat=require(_0xcc2f('0x1'));var rimraf=require(_0xcc2f('0x2'));var zipdir=require(_0xcc2f('0x3'));var jsonpatch=require(_0xcc2f('0x4'));var rp=require(_0xcc2f('0x5'));var moment=require(_0xcc2f('0x6'));var BPromise=require(_0xcc2f('0x7'));var Mustache=require(_0xcc2f('0x8'));var util=require(_0xcc2f('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xcc2f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc2f('0xb'));var squel=require(_0xcc2f('0xc'));var crypto=require(_0xcc2f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcc2f('0xa'));var querystring=require(_0xcc2f('0xe'));var Papa=require(_0xcc2f('0xf'));var Redis=require(_0xcc2f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcc2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc2f('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc2f('0x13'));var db=require('../../mysqldb')['db'];config[_0xcc2f('0x14')]=_[_0xcc2f('0x15')](config[_0xcc2f('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc2f('0x14')]));require(_0xcc2f('0x16'))[_0xcc2f('0x17')](socket);var jayson=require(_0xcc2f('0x18'));var client=jayson[_0xcc2f('0x19')][_0xcc2f('0x1a')]({'port':0x232b});var client9004=jayson[_0xcc2f('0x19')][_0xcc2f('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0xbc9e63,_0x152362,_0x3c244b,_0x3611d7){return new BPromise(function(_0x556caa,_0x46d303){var _0x4d3319=_0x3611d7||client;return _0x4d3319[_0xcc2f('0x1b')](_0xbc9e63,_0x3c244b)[_0xcc2f('0x1c')](function(_0x2c9ac8){logger[_0xcc2f('0x1d')](_0xcc2f('0x1e'),_0x152362,_0xcc2f('0x1f'));logger[_0xcc2f('0x20')](_0xcc2f('0x21'),_0x152362,_0xcc2f('0x1f'),JSON[_0xcc2f('0x22')](_0x2c9ac8));if(_0x2c9ac8[_0xcc2f('0x23')]){if(_0x2c9ac8[_0xcc2f('0x23')]['code']===0x1f4){logger[_0xcc2f('0x23')](_0xcc2f('0x1e'),_0x152362,_0x2c9ac8[_0xcc2f('0x23')][_0xcc2f('0x24')]);return _0x46d303(_0x2c9ac8['error'][_0xcc2f('0x24')]);}logger[_0xcc2f('0x23')](_0xcc2f('0x1e'),_0x152362,_0x2c9ac8['error'][_0xcc2f('0x24')]);return _0x556caa(_0x2c9ac8[_0xcc2f('0x23')][_0xcc2f('0x24')]);}else{logger[_0xcc2f('0x1d')](_0xcc2f('0x1e'),_0x152362,_0xcc2f('0x1f'));_0x556caa(_0x2c9ac8['result'][_0xcc2f('0x24')]);}})[_0xcc2f('0x25')](function(_0x236059){logger[_0xcc2f('0x23')](_0xcc2f('0x1e'),_0x152362,_0x236059);_0x46d303(_0x236059);});});}function respondWithStatusCode(_0x45e65a,_0x42ed74){_0x42ed74=_0x42ed74||0xcc;return function(_0x164007){if(_0x164007){return _0x45e65a[_0xcc2f('0x26')](_0x42ed74);}return _0x45e65a[_0xcc2f('0x27')](_0x42ed74)['end']();};}function respondWithResult(_0x458726,_0x126e06){_0x126e06=_0x126e06||0xc8;return function(_0x282aba){if(_0x282aba){return _0x458726['status'](_0x126e06)['json'](_0x282aba);}};}function respondWithFilteredResult(_0x4b6c81,_0x37a7a2){return function(_0x2510fd){if(_0x2510fd){var _0x4441c8=_0x2510fd[_0xcc2f('0x28')],_0x32d906=_0x37a7a2[_0xcc2f('0x29')],_0x1a3bfd=_0x37a7a2[_0xcc2f('0x29')]+_0x37a7a2[_0xcc2f('0x2a')],_0x533626;if(_0x1a3bfd>=_0x4441c8){_0x1a3bfd=_0x4441c8;_0x533626=0xc8;}else{_0x533626=0xce;}_0x4b6c81[_0xcc2f('0x27')](_0x533626);return _0x4b6c81[_0xcc2f('0x2b')]('Content-Range',_0x32d906+'-'+_0x1a3bfd+'/'+_0x4441c8)[_0xcc2f('0x2c')](_0x2510fd);}return null;};}function patchUpdates(_0x3c8100){return function(_0x3531c9){try{jsonpatch['apply'](_0x3531c9,_0x3c8100,!![]);}catch(_0x1ec965){return BPromise[_0xcc2f('0x2d')](_0x1ec965);}return _0x3531c9['save']();};}function saveUpdates(_0x15a6b8,_0xf555ac){return function(_0x342caa){if(_0x342caa){return _0x342caa['update'](_0x15a6b8)['then'](function(_0xb47689){return _0xb47689;});}return null;};}function removeEntity(_0x125fe0,_0x8e8d13){return function(_0x2fa670){if(_0x2fa670){return _0x2fa670['destroy']()[_0xcc2f('0x1c')](function(){_0x125fe0[_0xcc2f('0x27')](0xcc)[_0xcc2f('0x2e')]();});}};}function handleEntityNotFound(_0x3efc63,_0x353389){return function(_0x38263a){if(!_0x38263a){_0x3efc63[_0xcc2f('0x26')](0x194);}return _0x38263a;};}function handleError(_0x52e1d3,_0x24ccbe){_0x24ccbe=_0x24ccbe||0x1f4;return function(_0x505d32){logger[_0xcc2f('0x23')](_0x505d32['stack']);if(_0x505d32['name']){delete _0x505d32['name'];}_0x52e1d3[_0xcc2f('0x27')](_0x24ccbe)[_0xcc2f('0x2f')](_0x505d32);};}function getInteractionUsers(_0x4baf78,_0x134c59){return new BPromise(function(_0x25336c,_0x236d72){try{if(_0x134c59[_0x4baf78['id']]){_0x4baf78['Users']=_[_0xcc2f('0x30')](_0x134c59[_0x4baf78['id']],function(_0x48a21f){return{'id':_0x48a21f['id'],'fullname':_0x48a21f[_0xcc2f('0x31')]};});}}catch(_0x5c492d){_0x236d72(_0x5c492d);}_0x25336c(_0x4baf78);});}function getInteractionTags(_0x55d703,_0x3f33e8){return new BPromise(function(_0x18ba35,_0x46b4e3){try{if(_0x55d703['TagIds']){_0x55d703[_0xcc2f('0x32')]=[];_0x55d703[_0xcc2f('0x33')]['split'](',')['forEach'](function(_0x3d5c0f){_0x55d703['Tags'][_0xcc2f('0x34')](_0x3f33e8[_0x3d5c0f]);});}delete _0x55d703[_0xcc2f('0x33')];}catch(_0x43d244){_0x46b4e3(_0x43d244);}_0x18ba35(_0x55d703);});}function updateChatInteraction(_0x1355dd,_0x5aa68a,_0x5e1ddb){return new BPromise(function(_0x37fbac,_0x49e187){return getInteractionUsers(_0x1355dd,_0x5e1ddb)[_0xcc2f('0x1c')](function(_0x3aaa6c){return getInteractionTags(_0x3aaa6c,_0x5aa68a);})[_0xcc2f('0x1c')](function(_0x3278ea){_0x37fbac(_0x3278ea);})['catch'](function(_0x5b5162){_0x49e187(_0x5b5162);});});}exports[_0xcc2f('0x35')]=function(_0x390c94,_0x16e72e){var _0x2c719d={},_0x1d2db4={},_0x489ef3={'count':0x0,'rows':[]};var _0x38955f=_[_0xcc2f('0x30')](db[_0xcc2f('0x36')][_0xcc2f('0x37')],function(_0x41ef3a){return{'name':_0x41ef3a[_0xcc2f('0x38')],'type':_0x41ef3a['type']['key']};});_0x1d2db4[_0xcc2f('0x39')]=_[_0xcc2f('0x30')](_0x38955f,_0xcc2f('0x3a'));_0x1d2db4[_0xcc2f('0x3b')]=_['keys'](_0x390c94[_0xcc2f('0x3b')]);_0x1d2db4[_0xcc2f('0x3c')]=_[_0xcc2f('0x3d')](_0x1d2db4['model'],_0x1d2db4[_0xcc2f('0x3b')]);_0x2c719d[_0xcc2f('0x3e')]=_[_0xcc2f('0x3d')](_0x1d2db4[_0xcc2f('0x39')],qs[_0xcc2f('0x3f')](_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x3f')]));_0x2c719d[_0xcc2f('0x3e')]=_0x2c719d[_0xcc2f('0x3e')][_0xcc2f('0x40')]?_0x2c719d[_0xcc2f('0x3e')]:_0x1d2db4['model'];if(!_0x390c94[_0xcc2f('0x3b')]['hasOwnProperty'](_0xcc2f('0x41'))){_0x2c719d[_0xcc2f('0x2a')]=qs[_0xcc2f('0x2a')](_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x2a')]);_0x2c719d[_0xcc2f('0x29')]=qs['offset'](_0x390c94[_0xcc2f('0x3b')]['offset']);}_0x2c719d[_0xcc2f('0x42')]=qs[_0xcc2f('0x43')](_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x43')]);_0x2c719d[_0xcc2f('0x44')]=qs[_0xcc2f('0x3c')](_['pick'](_0x390c94[_0xcc2f('0x3b')],_0x1d2db4[_0xcc2f('0x3c')]),_0x38955f);var _0x2ab4fa=[];var _0x3324fb=squel['select']()['field']('id')[_0xcc2f('0x45')]('name')[_0xcc2f('0x45')](_0xcc2f('0x46'))[_0xcc2f('0x47')](_0xcc2f('0x48'));var _0x3a2702=squel[_0xcc2f('0x49')]()['field']('u.id')[_0xcc2f('0x45')](_0xcc2f('0x4a'))['field'](_0xcc2f('0x4b'))[_0xcc2f('0x47')]('user_has_chat_interactions','ui')[_0xcc2f('0x4c')](_0xcc2f('0x4d'),'u',_0xcc2f('0x4e'));var _0x42a2e3=squel[_0xcc2f('0x49')]()[_0xcc2f('0x47')]('chat_interactions','i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xcc2f('0x4c')](_0xcc2f('0x4d'),'o','o.id\x20=\x20i.UserId')[_0xcc2f('0x4c')]('chat_websites','a',_0xcc2f('0x4f'))[_0xcc2f('0x4c')]('chat_messages','me',_0xcc2f('0x50'))[_0xcc2f('0x4c')](_0xcc2f('0x51'),'it',_0xcc2f('0x52'))[_0xcc2f('0x4c')](_0xcc2f('0x48'),'t',_0xcc2f('0x53'));var _0x1d805d=squel[_0xcc2f('0x54')]();var _0x525639=[];var _0x23711b=squel[_0xcc2f('0x54')]();var _0x4841bb;if(_0x390c94[_0xcc2f('0x3b')]['search']){_0x4841bb=as[_0xcc2f('0x55')](_0x390c94['query']['search']);var _0x485335=_0x4841bb[_0xcc2f('0x56')];for(var _0x446c2c=0x0;_0x446c2c<_0x4841bb[_0xcc2f('0x57')]['length'];_0x446c2c++){var _0x1afa18=_0x4841bb[_0xcc2f('0x57')][_0x446c2c];var _0x501508='i';var _0x30fe9a=_[_0xcc2f('0x58')](_0x38955f,[_0xcc2f('0x3a'),_0x1afa18[_0xcc2f('0x45')]]);if(!_0x30fe9a){switch(_0x1afa18[_0xcc2f('0x45')]){case'unreadMessages':if(_0x1afa18[_0xcc2f('0x59')]==0x1){_0x42a2e3[_0xcc2f('0x5a')]('`'+_0x1afa18['field']+_0xcc2f('0x5b'));}else{_0x42a2e3[_0xcc2f('0x5a')]('`'+_0x1afa18[_0xcc2f('0x45')]+'`\x20>\x200');}break;case _0xcc2f('0x5c'):if(_0x1afa18['operator']==='$substring'){if(_0x1afa18[_0xcc2f('0x59')][_0xcc2f('0x5d')]('\x20')['length']>0x1){_0x1d805d[_0x485335]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcc2f('0x5e')](_0x1afa18[_0xcc2f('0x59')]),null);}else{var _0x39ec1e='%'+_0x1afa18[_0xcc2f('0x59')]+'%';_0x1d805d[_0x485335]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x39ec1e,_0x39ec1e,_0x39ec1e);}}else{_0x30fe9a=_[_0xcc2f('0x58')](_0x38955f,[_0xcc2f('0x3a'),_0xcc2f('0x5f')]);_0x1afa18[_0xcc2f('0x45')]=_0xcc2f('0x5f');_0x20802a=as[_0xcc2f('0x60')](_0x501508,_0x30fe9a[_0xcc2f('0x61')],_0x1afa18);_0x1d805d[_0x485335](_0x20802a[_0xcc2f('0x62')],_0x20802a[_0xcc2f('0x59')][_0xcc2f('0x63')],_0x20802a[_0xcc2f('0x59')][_0xcc2f('0x2e')]);}break;case _0xcc2f('0x64'):var _0xaa286e=_0x1afa18[_0xcc2f('0x59')]['split'](',')[_0xcc2f('0x30')](function(_0x208ddb){return Number(_0x208ddb);});_0xaa286e[_0xcc2f('0x65')](function(_0x5d8389){_0x23711b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5d8389+',%');});_0x525639=_[_0xcc2f('0x66')](_0x525639,_0xaa286e);break;case _0xcc2f('0x67'):if(_0x1afa18[_0xcc2f('0x68')]==='$substring'){_0x1d805d[_0x485335](_0xcc2f('0x69'),'%'+_0x1afa18[_0xcc2f('0x59')]+'%',null);}else{_0x30fe9a=_[_0xcc2f('0x58')](_0x38955f,['name',_0xcc2f('0x6a')]);_0x1afa18[_0xcc2f('0x45')]=_0xcc2f('0x6a');_0x20802a=as[_0xcc2f('0x60')](_0x501508,_0x30fe9a['type'],_0x1afa18);_0x1d805d[_0x485335](_0x20802a['text'],_0x20802a[_0xcc2f('0x59')]['start'],_0x20802a[_0xcc2f('0x59')]['end']);}break;case _0xcc2f('0x6b'):_0x20802a=as['buildExpression']('me',null,_0x1afa18);_0x1d805d[_0x485335](_0x20802a[_0xcc2f('0x62')],_0x20802a[_0xcc2f('0x59')][_0xcc2f('0x63')],_0x20802a[_0xcc2f('0x59')]['end']);break;}}else{var _0x20802a=as[_0xcc2f('0x60')](_0x501508,_0x30fe9a[_0xcc2f('0x61')],_0x1afa18);_0x1d805d[_0x485335](_0x20802a['text'],_0x20802a['value'][_0xcc2f('0x63')],_0x20802a[_0xcc2f('0x59')][_0xcc2f('0x2e')]);}}}else{var _0x26883a=_(_0x390c94['query'])['keys']()['map'](function(_0x1db86d){return _['some'](_0x38955f,[_0xcc2f('0x3a'),_0x1db86d])?_0x1db86d:undefined;})[_0xcc2f('0x6c')]()[_0xcc2f('0x59')]();if(!_[_0xcc2f('0x6d')](_0x26883a)){_0x26883a[_0xcc2f('0x65')](function(_0x4d764f){if(_0x4d764f===_0xcc2f('0x6e')){_0x42a2e3[_0xcc2f('0x44')](_0xcc2f('0x6f'),[][_0xcc2f('0x70')](_0x390c94['query'][_0x4d764f]));}else if(_0x4d764f===_0xcc2f('0x71')){var _0x26afed=JSON['parse'](_0x390c94[_0xcc2f('0x3b')][_0x4d764f])[_0xcc2f('0x72')];var _0x6149fa=JSON['parse'](_0x390c94[_0xcc2f('0x3b')][_0x4d764f])[_0xcc2f('0x73')];_0x42a2e3[_0xcc2f('0x44')](_0xcc2f('0x74'),_0x26afed,_0x6149fa);}else{if(_0x390c94[_0xcc2f('0x3b')][_0x4d764f]===_0xcc2f('0x75')){_0x42a2e3[_0xcc2f('0x44')]('i.'+_0x4d764f+_0xcc2f('0x76'));}else{_0x42a2e3['where']('i.'+_0x4d764f+'\x20=\x20?',_0x390c94[_0xcc2f('0x3b')][_0x4d764f]);}}});}if(_0x390c94[_0xcc2f('0x3b')]['read']){if(_0x390c94[_0xcc2f('0x3b')]['read']==0x1){_0x42a2e3[_0xcc2f('0x5a')](_0xcc2f('0x77'));}else{_0x42a2e3[_0xcc2f('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x78')]){_0x525639=_[_0xcc2f('0x79')](_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x78')])?_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x78')]:new Array(_0x390c94['query']['tag']);_0x525639['forEach'](function(_0x444b3b){_0x23711b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x444b3b+',%');});}if(_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x7a')]){var _0x540ca4=_0x390c94['query'][_0xcc2f('0x7a')][_0xcc2f('0x7b')]('\x5c','\x5c\x5c')[_0xcc2f('0x7b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x540ca4)){_0x1d805d['or'](_0xcc2f('0x7c'),_0x540ca4+'%');}else{_0x1d805d['or'](_0xcc2f('0x7d'),qs[_0xcc2f('0x5e')](_0x540ca4))['or'](_0xcc2f('0x7e'),_0x540ca4+'%');}}}_0x42a2e3[_0xcc2f('0x44')](_0x1d805d);_0x42a2e3[_0xcc2f('0x7f')](_0xcc2f('0x80'));var _0x1e6504={'type':db[_0xcc2f('0x81')]['QueryTypes']['SELECT'],'raw':!![]};var _0x55171a=_0x42a2e3['clone']();_0x55171a['field']('i.id');_0x55171a[_0xcc2f('0x45')](_0xcc2f('0x82'),_0xcc2f('0x83'));if(_0x2c719d[_0xcc2f('0x42')]){_0x2c719d[_0xcc2f('0x42')][_0xcc2f('0x65')](function(_0x4ca70e){var _0x416cca=_0x4ca70e[0x0]===_0xcc2f('0x84')?_0x4ca70e[0x0]:'i.'+_0x4ca70e[0x0];_0x42a2e3['order'](_0x416cca,_0x4ca70e[0x1]===_0xcc2f('0x85')?![]:!![]);});}if(!_[_0xcc2f('0x6d')](_0x525639)){_0x42a2e3['having'](_0x23711b);_0x55171a[_0xcc2f('0x44')](_0xcc2f('0x86'),_0x525639);}BPromise[_0xcc2f('0x87')]()[_0xcc2f('0x1c')](function(){if(!_0x4841bb){if(_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x6e')])return;_0x55171a[_0xcc2f('0x44')](_0xcc2f('0x88'));_0x42a2e3[_0xcc2f('0x44')](_0xcc2f('0x88'));return;}if(_0x390c94[_0xcc2f('0x89')]['role']!==_0xcc2f('0x8a'))return;return _0x390c94[_0xcc2f('0x89')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xcc2f('0x1c')](function(_0x70ff8b){if(_['isEmpty'](_0x70ff8b)){_0x55171a[_0xcc2f('0x44')](_0xcc2f('0x8b'));_0x42a2e3[_0xcc2f('0x44')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x55171a[_0xcc2f('0x44')](_0xcc2f('0x6f'),_[_0xcc2f('0x30')](_0x70ff8b,'id'));_0x42a2e3['where'](_0xcc2f('0x6f'),_[_0xcc2f('0x30')](_0x70ff8b,'id'));}});})['then'](function(){if(_0x390c94['user'][_0xcc2f('0x8c')]===_0xcc2f('0x8a')&&!_0x4841bb&&!_0x390c94['query']['ChatWebsiteId'])return[];return db['sequelize'][_0xcc2f('0x3b')](_0x55171a[_0xcc2f('0x8d')](),_0x1e6504);})[_0xcc2f('0x1c')](function(_0x2cf8cf){_0x489ef3['count']=_0x2cf8cf['length'];if(_0x489ef3[_0xcc2f('0x28')]===0x0)return[];return db[_0xcc2f('0x8e')][_0xcc2f('0x3b')](_0x3324fb[_0xcc2f('0x8d')](),_0x1e6504)[_0xcc2f('0x1c')](function(_0x436eca){_0x2ab4fa=_['keyBy'](_0x436eca,'id');_0x1e6504=_[_0xcc2f('0x8f')](_0x1e6504,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x390c94[_0xcc2f('0x3b')][_0xcc2f('0x3f')]){_0x2c719d[_0xcc2f('0x3e')][_0xcc2f('0x65')](function(_0x1e6185){_0x42a2e3[_0xcc2f('0x45')]('i.'+_0x1e6185);});}else{_0x42a2e3['field'](_0xcc2f('0x82'),_0xcc2f('0x83'));_0x42a2e3[_0xcc2f('0x45')](_0xcc2f('0x90'),'Account.key');_0x42a2e3[_0xcc2f('0x45')](_0xcc2f('0x91'),_0xcc2f('0x92'));_0x42a2e3[_0xcc2f('0x45')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xcc2f('0x84'));_0x42a2e3[_0xcc2f('0x45')](_0xcc2f('0x93'));_0x42a2e3['field'](_0xcc2f('0x94'),'Contact.firstName');_0x42a2e3['field'](_0xcc2f('0x95'),_0xcc2f('0x96'));_0x42a2e3['field']('c.email',_0xcc2f('0x97'));_0x42a2e3[_0xcc2f('0x45')]('c.phone','Contact.phone');_0x42a2e3['field'](_0xcc2f('0x98'),_0xcc2f('0x99'));_0x42a2e3[_0xcc2f('0x45')]('c.fax',_0xcc2f('0x9a'));_0x42a2e3[_0xcc2f('0x45')]('o.fullname','Owner.fullname');_0x42a2e3[_0xcc2f('0x45')](_0xcc2f('0x9b'),'Owner.internal');_0x42a2e3[_0xcc2f('0x45')](_0xcc2f('0x9c'),_0xcc2f('0x33'));}if(_0x2c719d[_0xcc2f('0x2a')])_0x42a2e3['limit'](_0x2c719d['limit']);if(_0x2c719d['offset'])_0x42a2e3['offset'](_0x2c719d[_0xcc2f('0x29')]);return db[_0xcc2f('0x8e')][_0xcc2f('0x3b')](_0x42a2e3[_0xcc2f('0x8d')](),_0x1e6504);})[_0xcc2f('0x1c')](function(_0x4bd418){_0x3a2702[_0xcc2f('0x44')]('ui.ChatInteractionId\x20IN\x20?',_[_0xcc2f('0x30')](_0x4bd418,'id'));return db['sequelize'][_0xcc2f('0x3b')](_0x3a2702[_0xcc2f('0x8d')](),_0x1e6504)[_0xcc2f('0x1c')](function(_0x490a3c){var _0x4c26cc=_[_0xcc2f('0x9d')](_0x490a3c,'ChatInteractionId');var _0x23daee=[];_0x4bd418[_0xcc2f('0x65')](function(_0x1ea915){_0x23daee[_0xcc2f('0x34')](updateChatInteraction(_0x1ea915,_0x2ab4fa,_0x4c26cc));});return BPromise['all'](_0x23daee);});});})[_0xcc2f('0x1c')](function(_0x347c08){_0x489ef3[_0xcc2f('0x9e')]=_0x347c08;return _0x489ef3;})[_0xcc2f('0x1c')](respondWithFilteredResult(_0x16e72e,_0x2c719d))[_0xcc2f('0x25')](handleError(_0x16e72e,null));};exports[_0xcc2f('0x9f')]=function(_0x766800,_0x122dc2){var _0x13d02a={'raw':![],'where':{'id':_0x766800['params']['id']}},_0x4fcff1={};_0x4fcff1['model']=_[_0xcc2f('0xa0')](db[_0xcc2f('0x36')][_0xcc2f('0x37')]);_0x4fcff1['query']=_[_0xcc2f('0xa0')](_0x766800[_0xcc2f('0x3b')]);_0x4fcff1['filters']=_[_0xcc2f('0x3d')](_0x4fcff1[_0xcc2f('0x39')],_0x4fcff1['query']);_0x13d02a[_0xcc2f('0x3e')]=_[_0xcc2f('0x3d')](_0x4fcff1['model'],qs[_0xcc2f('0x3f')](_0x766800[_0xcc2f('0x3b')][_0xcc2f('0x3f')]));_0x13d02a[_0xcc2f('0x3e')]=_0x13d02a[_0xcc2f('0x3e')][_0xcc2f('0x40')]?_0x13d02a[_0xcc2f('0x3e')]:_0x4fcff1[_0xcc2f('0x39')];if(_0x766800['query'][_0xcc2f('0xa1')]){_0x13d02a['include']=[{'all':!![]}];}_0x13d02a=_[_0xcc2f('0x8f')]({},_0x13d02a,_0x766800['options']);return db['ChatInteraction']['find'](_0x13d02a)[_0xcc2f('0x1c')](handleEntityNotFound(_0x122dc2,null))['then'](respondWithResult(_0x122dc2,null))[_0xcc2f('0x25')](handleError(_0x122dc2,null));};exports[_0xcc2f('0xa2')]=function(_0x453479,_0x48ad04){return db[_0xcc2f('0x36')][_0xcc2f('0xa2')](_0x453479['body'],{})['then'](respondWithResult(_0x48ad04,0xc9))[_0xcc2f('0x25')](handleError(_0x48ad04,null));};exports[_0xcc2f('0xa3')]=function(_0x55adfe,_0x2c997d){if(_0x55adfe['body']['id']){delete _0x55adfe['body']['id'];}return db['ChatInteraction'][_0xcc2f('0x58')]({'where':{'id':_0x55adfe[_0xcc2f('0xa4')]['id']}})['then'](handleEntityNotFound(_0x2c997d,null))['then'](saveUpdates(_0x55adfe[_0xcc2f('0x6b')],null))[_0xcc2f('0x1c')](respondWithResult(_0x2c997d,null))[_0xcc2f('0x25')](handleError(_0x2c997d,null));};exports[_0xcc2f('0xa5')]=function(_0x8b7a6a,_0x169e88){return db['ChatInteraction'][_0xcc2f('0x58')]({'where':{'id':_0x8b7a6a['params']['id']}})[_0xcc2f('0x1c')](handleEntityNotFound(_0x169e88,null))['then'](removeEntity(_0x169e88,null))['catch'](handleError(_0x169e88,null));};exports[_0xcc2f('0xa6')]=function(_0x28c185,_0x7ef87e){return db[_0xcc2f('0x36')][_0xcc2f('0xa6')]()[_0xcc2f('0x1c')](respondWithResult(_0x7ef87e,null))[_0xcc2f('0x25')](handleError(_0x7ef87e,null));};exports['createVidaooSession']=function(_0x1c7a44,_0x55ddd7){var _0x1f3748=_0x1c7a44[_0xcc2f('0xa4')]['id'];var _0xdc1104;var _0x1468b8;var _0x54e1f7;return db['ChatInteraction']['findOne']({'where':{'id':_0x1f3748}})[_0xcc2f('0x1c')](function(_0x1fecb4){_0xdc1104=_0x1fecb4;return db[_0xcc2f('0xa7')][_0xcc2f('0xa8')]({'where':{'id':_0x1fecb4['ChatWebsiteId']},'attributes':['id',_0xcc2f('0xa9'),'vidaooEscalation'],'raw':!![]});})[_0xcc2f('0x1c')](function(_0x492d24){if(_0x492d24&&_0x492d24[_0xcc2f('0xa9')]&&_0x492d24[_0xcc2f('0xaa')]){_0x1468b8=_0x492d24;var _0x4c6330={'rejectUnauthorized':![],'method':_0xcc2f('0xab'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x492d24[_0xcc2f('0xa9')]},'body':{'name':_0xcc2f('0xac')+_0x1f3748},'redirect':_0xcc2f('0xad'),'json':!![]};return rp(_0x4c6330);}else{throw new db['Sequelize']['ValidationError'](_0xcc2f('0xae'));}})[_0xcc2f('0x1c')](function(_0xddaf36){_0x54e1f7=_0xddaf36;if(_0x54e1f7['id']){var _0x4c9e21={'body':_0x54e1f7['join_url'],'ChatWebsiteId':_0x1468b8['id'],'ChatInteractionId':_0xdc1104['id'],'direction':_0xcc2f('0xaf'),'UserId':_0x1c7a44['user']['id']};return db[_0xcc2f('0xb0')]['create'](_0x4c9e21,{});}else{throw new db[(_0xcc2f('0x81'))][(_0xcc2f('0xb1'))](_0xcc2f('0xb2'));}})[_0xcc2f('0x1c')](function(){return _0xdc1104[_0xcc2f('0xb3')]({'vidaooSessionId':_0x54e1f7['id']});})[_0xcc2f('0x1c')](respondWithResult(_0x55ddd7,null))['catch'](handleError(_0x55ddd7,null));};exports[_0xcc2f('0xb4')]=function(_0x366405,_0x5b032e){if(_0x366405['body']['id']){delete _0x366405['body']['id'];}return db[_0xcc2f('0x36')][_0xcc2f('0x58')]({'where':{'id':_0x366405['params']['id']},'include':[{'model':db[_0xcc2f('0xb5')],'as':_0xcc2f('0x5c')}]})['then'](handleEntityNotFound(_0x5b032e,null))[_0xcc2f('0x1c')](saveUpdates(_0x366405[_0xcc2f('0x6b')],null))[_0xcc2f('0x1c')](respondWithResult(_0x5b032e,null))[_0xcc2f('0x25')](handleError(_0x5b032e,null));};exports['abandon']=function(_0x16f5e0,_0x544f5e,_0x39a1a5){if(_0x16f5e0[_0xcc2f('0x6b')]['id']){delete _0x16f5e0[_0xcc2f('0x6b')]['id'];}return db[_0xcc2f('0x36')][_0xcc2f('0x58')]({'where':{'id':_0x16f5e0[_0xcc2f('0xa4')]['id']}})[_0xcc2f('0x1c')](function(_0x3e28f0){if(!_0x3e28f0){logger[_0xcc2f('0x23')](_0xcc2f('0xb6'),_0xcc2f('0xb7'),0x194,_0xcc2f('0xb8'));_0x544f5e[_0xcc2f('0x26')](0x194);}else{if(_0x3e28f0[_0xcc2f('0x6a')]){throw new db['Sequelize'][(_0xcc2f('0xb1'))](_0xcc2f('0xb9'));}}return _0x3e28f0;})['then'](function(_0x98b4b5){if(_0x98b4b5){return _0x98b4b5[_0xcc2f('0xa3')]({'closed':_0x16f5e0[_0xcc2f('0x6b')]['closed'],'disposition':_0x16f5e0[_0xcc2f('0x6b')][_0xcc2f('0xba')]})[_0xcc2f('0x1c')](function(_0x540e59){return _0x540e59;});}})['then'](function(_0x16d31c){return respondWithRpcPromise(_0xcc2f('0xbb'),_0xcc2f('0xb7'),_0x16f5e0[_0xcc2f('0x6b')],client9004);})[_0xcc2f('0x1c')](respondWithResult(_0x544f5e,null))[_0xcc2f('0x25')](handleError(_0x544f5e,null));};exports['attachmentUpload']=function(_0x53d6c9,_0x528e97,_0x5d63c6){_0x53d6c9['body'][_0xcc2f('0x3a')]=_0x53d6c9[_0xcc2f('0xbc')][_0xcc2f('0xbd')];_0x53d6c9['body'][_0xcc2f('0xbe')]=_0x53d6c9[_0xcc2f('0xbc')][_0xcc2f('0xbf')];_0x53d6c9[_0xcc2f('0x6b')][_0xcc2f('0x61')]=_0x53d6c9[_0xcc2f('0xbc')][_0xcc2f('0xc0')];return db[_0xcc2f('0xc1')]['create'](_0x53d6c9[_0xcc2f('0x6b')])[_0xcc2f('0x1c')](respondWithResult(_0x528e97,0xc9))['catch'](handleError(_0x528e97,null));};exports[_0xcc2f('0xc2')]=function(_0x138af6,_0x2161ac,_0x12a80c){return db['ChatInteraction']['findOne']({'where':{'id':_0x138af6[_0xcc2f('0xa4')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2161ac,null))['then'](function(_0x5a502){if(_0x5a502){if(_0x5a502[_0xcc2f('0xc3')]){return _0x2161ac[_0xcc2f('0x27')](0x193)[_0xcc2f('0x2c')]({'status':0x193,'message':_0xcc2f('0xc4')});}return db[_0xcc2f('0xc1')][_0xcc2f('0xa8')]({'where':{'id':_0x138af6[_0xcc2f('0x3b')][_0xcc2f('0xc5')]},'raw':!![]})['then'](handleEntityNotFound(_0x2161ac,null));}})[_0xcc2f('0x1c')](function(_0x503896){if(_0x503896){var _0x6da060=_0x503896[_0xcc2f('0xc6')]!==null;var _0x4173a8=path[_0xcc2f('0xc7')](config[_0xcc2f('0xc8')],'server/files/attachments/');if(_0x6da060){_0x4173a8=path['join'](_0x4173a8,_0xcc2f('0xc9'));}var _0x45d5f8=path[_0xcc2f('0xc7')](_0x4173a8,_0x503896['basename']);return _0x2161ac[_0xcc2f('0xca')](_0x45d5f8);}})[_0xcc2f('0x25')](handleError(_0x2161ac,null));};exports[_0xcc2f('0xcb')]=function(_0x3d1f27,_0xb558a4){var _0x4c96a6=null;var _0x57fe2f=null;var _0x5f1784=null;var _0x1151df=null;if(_0x3d1f27[_0xcc2f('0x6b')]['id']){delete _0x3d1f27[_0xcc2f('0x6b')]['id'];}if(_0x3d1f27[_0xcc2f('0x6b')][_0xcc2f('0xcc')]){_0x1151df=path[_0xcc2f('0xc7')](config['root'],'server/files/chat/upload/',util['format'](_0xcc2f('0xcd'),Date['now']()));_0x3d1f27[_0xcc2f('0x6b')]['pathTranscript']=_0x1151df;}return db[_0xcc2f('0x36')][_0xcc2f('0x58')]({'where':{'id':_0x3d1f27[_0xcc2f('0xa4')]['id']},'include':[{'model':db[_0xcc2f('0xb0')],'as':_0xcc2f('0xce'),'include':[{'model':db[_0xcc2f('0x67')],'as':_0xcc2f('0x67')}]}]})['then'](handleEntityNotFound(_0xb558a4,null))[_0xcc2f('0x1c')](saveUpdates(_0x3d1f27[_0xcc2f('0x6b')],null))[_0xcc2f('0x1c')](function(_0x35ae81){if(_0x35ae81){_0x4c96a6=_0x35ae81;return db[_0xcc2f('0xa7')][_0xcc2f('0x58')]({'where':{'id':_0x4c96a6['ChatWebsiteId']}});}})[_0xcc2f('0x1c')](function(_0x4cbc69){if(_0x4cbc69){_0x5f1784=_0x4cbc69;return db[_0xcc2f('0xb5')][_0xcc2f('0x58')]({'where':{'id':_0x4c96a6['ContactId']}});}})['then'](function(_0x5f5755){if(_0x5f5755){_0x57fe2f=_0x5f5755;if(_0x1151df){var _0xbcea9d=null;for(var _0x3e6930=0x1;_0x3e6930<_0x4c96a6[_0xcc2f('0xce')]['length'];++_0x3e6930){_0xbcea9d=_0x4c96a6[_0xcc2f('0xce')][_0x3e6930];var _0x1a0a1c=_0xbcea9d['UserId']?util['format'](_0xcc2f('0xcf'),_0x5f1784[_0xcc2f('0xd0')],_0xbcea9d[_0xcc2f('0x6a')]):_0xcc2f('0xd1');var _0x551169=_0x3d1f27[_0xcc2f('0x6b')][_0xcc2f('0xd2')]||util[_0xcc2f('0xd3')](_0xcc2f('0xcf'),'Visitor',_0xbcea9d[_0xcc2f('0x5f')]);switch(_0x5f1784[_0xcc2f('0xd4')]){case _0xcc2f('0xd5'):_0x1a0a1c=_0xbcea9d['UserId']?util[_0xcc2f('0xd3')](_0xcc2f('0xcf'),_0x5f1784[_0xcc2f('0xd0')],_0xbcea9d[_0xcc2f('0x6a')]):_0xcc2f('0xd1');break;case'agent_alias':_0x1a0a1c=_0xbcea9d[_0xcc2f('0x6a')]?_0xbcea9d[_0xcc2f('0x67')][_0xcc2f('0xd6')]||_0xbcea9d[_0xcc2f('0x67')][_0xcc2f('0x31')]:_0xcc2f('0xd1');break;case _0xcc2f('0xd7'):_0x1a0a1c=_0xbcea9d[_0xcc2f('0x6a')]?_0xbcea9d['User'][_0xcc2f('0x31')]:_0xcc2f('0xd1');break;default:_0x1a0a1c=_0xbcea9d[_0xcc2f('0x6a')]?util[_0xcc2f('0xd3')](_0xcc2f('0xcf'),_0x5f1784[_0xcc2f('0xd0')],_0xbcea9d['UserId']):'System';}var _0x53275a=util[_0xcc2f('0xd3')]('[%s]\x20%s:\x20%s\x0a',moment(_0xbcea9d['createdAt'])[_0xcc2f('0xd3')](_0xcc2f('0xd8')),_0xbcea9d[_0xcc2f('0xd9')]==='in'?_0x551169:_0x1a0a1c,_0xbcea9d[_0xcc2f('0x6b')]);if(!_0xbcea9d[_0xcc2f('0xda')]){fs[_0xcc2f('0xdb')](_0x1151df,_0x53275a);}}return db[_0xcc2f('0xdc')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xcc2f('0xdd')],'as':_0xcc2f('0xde'),'raw':!![]}]});}}})[_0xcc2f('0x1c')](function(_0x34b41a){if(_0x34b41a&&_0x34b41a[_0xcc2f('0xde')]&&_0x3d1f27[_0xcc2f('0x6b')]){var _0x33606b={'tls':{'rejectUnauthorized':![]}};if(_0x34b41a[_0xcc2f('0xde')][_0xcc2f('0xdf')]){_0x33606b[_0xcc2f('0xdf')]=_0x34b41a['Smtp'][_0xcc2f('0xdf')];}else{_0x33606b[_0xcc2f('0xe0')]=_0x34b41a[_0xcc2f('0xde')][_0xcc2f('0xe0')];_0x33606b[_0xcc2f('0xe1')]=_0x34b41a[_0xcc2f('0xde')]['port'];_0x33606b[_0xcc2f('0xe2')]=_0x34b41a[_0xcc2f('0xde')][_0xcc2f('0xe2')];}if(_0x34b41a['Smtp']['authentication']){_0x33606b[_0xcc2f('0xe3')]={'user':_0x34b41a[_0xcc2f('0xde')][_0xcc2f('0x89')],'pass':_0x34b41a[_0xcc2f('0xde')][_0xcc2f('0xe4')]};}return respondWithRpcPromise(_0xcc2f('0xe5'),_0xcc2f('0xe6'),{'account':_0x33606b,'message':{'from':util['format'](_0xcc2f('0xe7'),_0x34b41a[_0xcc2f('0x3a')],_0x34b41a[_0xcc2f('0xe8')]||_0x34b41a[_0xcc2f('0xde')][_0xcc2f('0x89')]),'to':_0x3d1f27['body'][_0xcc2f('0xcc')],'subject':_0xcc2f('0xe9'),'text':util[_0xcc2f('0xd3')](_0xcc2f('0xea'),_0x3d1f27['body'][_0xcc2f('0xcc')]),'attachments':[{'path':_0x1151df}]}})[_0xcc2f('0x1c')](function(){return _0x4c96a6;})[_0xcc2f('0x25')](function(_0x188ab7){console[_0xcc2f('0x23')](_0x188ab7);});}else{return _0x4c96a6;}})[_0xcc2f('0x1c')](respondWithStatusCode(_0xb558a4,0xc8))[_0xcc2f('0x25')](handleError(_0xb558a4,null));};exports[_0xcc2f('0xeb')]=function(_0x2d8d4f,_0x132e38,_0x1649b5){return db['ChatMessage']['find']({'where':{'id':_0x2d8d4f[_0xcc2f('0xa4')]['id']}})[_0xcc2f('0x1c')](handleEntityNotFound(_0x132e38,null))[_0xcc2f('0x1c')](function(_0x51a469){if(_0x51a469){return _0x51a469['addMessage'](_0x2d8d4f[_0xcc2f('0x6b')][_0xcc2f('0xec')],_[_0xcc2f('0xed')](_0x2d8d4f[_0xcc2f('0x6b')],[_0xcc2f('0xec'),'id'])||{});}})[_0xcc2f('0x1c')](respondWithResult(_0x132e38,null))[_0xcc2f('0x25')](handleError(_0x132e38,null));};exports[_0xcc2f('0xee')]=function(_0x168b9b,_0x3ab8a4,_0x2ac499){var _0x536f2d={'raw':![],'where':{}};var _0x3bbb5d={};var _0x3f68f7={'count':0x0,'rows':[]};return db[_0xcc2f('0x36')][_0xcc2f('0xa8')]({'where':{'id':_0x168b9b['params']['id']}})[_0xcc2f('0x1c')](handleEntityNotFound(_0x3ab8a4,null))[_0xcc2f('0x1c')](function(_0x27b54a){if(_0x27b54a){_0x3bbb5d[_0xcc2f('0x39')]=_[_0xcc2f('0xa0')](db['ChatMessage'][_0xcc2f('0x37')]);_0x3bbb5d[_0xcc2f('0x3b')]=_[_0xcc2f('0xa0')](_0x168b9b['query']);_0x3bbb5d[_0xcc2f('0x3c')]=_[_0xcc2f('0x3d')](_0x3bbb5d[_0xcc2f('0x39')],_0x3bbb5d[_0xcc2f('0x3b')]);_0x536f2d[_0xcc2f('0x3e')]=_[_0xcc2f('0x3d')](_0x3bbb5d[_0xcc2f('0x39')],qs[_0xcc2f('0x3f')](_0x168b9b[_0xcc2f('0x3b')][_0xcc2f('0x3f')]));_0x536f2d[_0xcc2f('0x3e')]=_0x536f2d[_0xcc2f('0x3e')]['length']?_0x536f2d[_0xcc2f('0x3e')]:_0x3bbb5d[_0xcc2f('0x39')];if(!_0x168b9b['query'][_0xcc2f('0xef')](_0xcc2f('0x41'))){_0x536f2d[_0xcc2f('0x2a')]=qs[_0xcc2f('0x2a')](_0x168b9b[_0xcc2f('0x3b')][_0xcc2f('0x2a')]);_0x536f2d[_0xcc2f('0x29')]=qs['offset'](_0x168b9b[_0xcc2f('0x3b')][_0xcc2f('0x29')]);}_0x536f2d[_0xcc2f('0x42')]=qs[_0xcc2f('0x43')](_0x168b9b[_0xcc2f('0x3b')][_0xcc2f('0x43')]);_0x536f2d['where']=qs[_0xcc2f('0x3c')](_[_0xcc2f('0xf0')](_0x168b9b['query'],_0x3bbb5d[_0xcc2f('0x3c')]));_0x536f2d[_0xcc2f('0x44')][_0xcc2f('0xf1')]=_0x27b54a['id'];if(_0x168b9b[_0xcc2f('0x3b')][_0xcc2f('0x7a')]){_0x536f2d[_0xcc2f('0x44')]=_[_0xcc2f('0x8f')](_0x536f2d[_0xcc2f('0x44')],{'$or':_['map'](_0x536f2d[_0xcc2f('0x3e')],function(_0x2b1d32){var _0x5b0a3d={};_0x5b0a3d[_0x2b1d32]={'$like':'%'+_0x168b9b[_0xcc2f('0x3b')][_0xcc2f('0x7a')]+'%'};return _0x5b0a3d;})});}if(_0x168b9b[_0xcc2f('0x3b')][_0xcc2f('0x72')]){var _0x10abe1=_0x168b9b['query'][_0xcc2f('0x72')][_0xcc2f('0x5d')](',');var _0x6ad283={};_0x6ad283[_0x10abe1[0x0]]={'$gte':moment(_0x10abe1[0x1])['format'](_0xcc2f('0xf2'))};_0x536f2d[_0xcc2f('0x44')]=_[_0xcc2f('0x8f')](_0x536f2d[_0xcc2f('0x44')],_0x6ad283);}_0x536f2d=_[_0xcc2f('0x8f')]({},_0x536f2d,_0x168b9b[_0xcc2f('0xf3')]);return db[_0xcc2f('0xb0')]['count']({'where':_0x536f2d['where']})[_0xcc2f('0x1c')](function(_0x29f20c){_0x3f68f7['count']=_0x29f20c;if(_0x168b9b[_0xcc2f('0x3b')]['includeAll']){_0x536f2d[_0xcc2f('0xf4')]=[{'all':!![]}];}return db[_0xcc2f('0xb0')][_0xcc2f('0xf5')](_0x536f2d);})[_0xcc2f('0x1c')](function(_0x275e3f){_0x3f68f7[_0xcc2f('0x9e')]=_0x275e3f;return _0x3f68f7;});}})[_0xcc2f('0x1c')](respondWithFilteredResult(_0x3ab8a4,_0x536f2d))[_0xcc2f('0x25')](handleError(_0x3ab8a4,null));};exports[_0xcc2f('0xf6')]=function(_0x4209c5,_0xf28803,_0x295431){var _0x2d0b66={'where':{}},_0x309464={},_0x1f14e1={'count':0x0,'rows':[]};return db[_0xcc2f('0x36')][_0xcc2f('0xa8')]({'where':{'id':_0x4209c5['params']['id']}})[_0xcc2f('0x1c')](handleEntityNotFound(_0xf28803,null))[_0xcc2f('0x1c')](function(_0x5c6bbd){if(_0x5c6bbd){_0x309464[_0xcc2f('0x39')]=_[_0xcc2f('0xa0')](db[_0xcc2f('0xb0')]['rawAttributes']);_0x309464[_0xcc2f('0x3b')]=_[_0xcc2f('0xa0')](_0x4209c5[_0xcc2f('0x3b')]);_0x309464[_0xcc2f('0x3c')]=_[_0xcc2f('0x3d')](_0x309464[_0xcc2f('0x39')],_0x309464[_0xcc2f('0x3b')]);_0x2d0b66[_0xcc2f('0x3e')]=_[_0xcc2f('0x3d')](_0x309464[_0xcc2f('0x39')],qs[_0xcc2f('0x3f')](_0x4209c5[_0xcc2f('0x3b')][_0xcc2f('0x3f')]));_0x2d0b66[_0xcc2f('0x3e')]=_0x2d0b66['attributes'][_0xcc2f('0x40')]?_0x2d0b66[_0xcc2f('0x3e')]:_0x309464['model'];if(!_0x4209c5[_0xcc2f('0x3b')]['hasOwnProperty'](_0xcc2f('0x41'))){_0x2d0b66[_0xcc2f('0x2a')]=qs['limit'](_0x4209c5['query'][_0xcc2f('0x2a')]);_0x2d0b66[_0xcc2f('0x29')]=qs[_0xcc2f('0x29')](_0x4209c5['query'][_0xcc2f('0x29')]);}_0x2d0b66[_0xcc2f('0x42')]=qs[_0xcc2f('0x43')](_0x4209c5['query'][_0xcc2f('0x43')]);_0x2d0b66['where']=qs[_0xcc2f('0x3c')](_['pick'](_0x4209c5[_0xcc2f('0x3b')],_0x309464[_0xcc2f('0x3c')]));_0x2d0b66[_0xcc2f('0x44')][_0xcc2f('0xf1')]=_0x5c6bbd['id'];if(_0x4209c5[_0xcc2f('0x3b')][_0xcc2f('0x7a')]){_0x2d0b66[_0xcc2f('0x44')]=_[_0xcc2f('0x8f')](_0x2d0b66['where'],{'$or':_['map'](_0x2d0b66['attributes'],function(_0x3a1058){var _0x299533={};_0x299533[_0x3a1058]={'$like':'%'+_0x4209c5[_0xcc2f('0x3b')]['filter']+'%'};return _0x299533;})});}_0x2d0b66['where'][_0xcc2f('0xda')]=![];if(_0x4209c5[_0xcc2f('0x3b')]['id']){_0x2d0b66[_0xcc2f('0x44')]['id']={'$gt':_0x4209c5[_0xcc2f('0x3b')]['id']};}_0x2d0b66=_[_0xcc2f('0x8f')]({},_0x2d0b66,_0x4209c5[_0xcc2f('0xf3')]);return db[_0xcc2f('0xb0')][_0xcc2f('0x28')]({'where':_0x2d0b66[_0xcc2f('0x44')]})[_0xcc2f('0x1c')](function(_0x24aa61){_0x1f14e1[_0xcc2f('0x28')]=_0x24aa61;_0x2d0b66[_0xcc2f('0xf4')]=[];if(_0x4209c5['query'][_0xcc2f('0xf7')]){_0x2d0b66[_0xcc2f('0xf4')]['push']({'model':db[_0xcc2f('0x67')],'as':_0xcc2f('0x67'),'attributes':['id',_0xcc2f('0x31'),_0xcc2f('0xd6')]});}if(_0x4209c5[_0xcc2f('0x3b')][_0xcc2f('0xa1')]){_0x2d0b66[_0xcc2f('0xf4')]=[{'all':!![]}];}return db['ChatMessage'][_0xcc2f('0xf5')](_0x2d0b66);})[_0xcc2f('0x1c')](function(_0x5cf1f7){_0x1f14e1[_0xcc2f('0x9e')]=_0x5cf1f7;return _0x1f14e1;});}})[_0xcc2f('0x1c')](respondWithFilteredResult(_0xf28803,_0x2d0b66))[_0xcc2f('0x25')](handleError(_0xf28803,null));};exports[_0xcc2f('0xf8')]=function(_0x4c2556,_0x1a20c8,_0xfd88cc){return db[_0xcc2f('0x36')]['find']({'where':{'id':_0x4c2556[_0xcc2f('0xa4')]['id']}})['then'](handleEntityNotFound(_0x1a20c8,null))[_0xcc2f('0x1c')](function(_0x55d447){if(_0x55d447){return _0x55d447[_0xcc2f('0xf9')](_0x4c2556['body']['ids'],_[_0xcc2f('0xed')](_0x4c2556[_0xcc2f('0x6b')],['ids','id'])||{})[_0xcc2f('0xfa')](function(){return db[_0xcc2f('0x64')]['findAll']({'attributes':['id','name',_0xcc2f('0x46')],'where':{'id':_0x4c2556[_0xcc2f('0x6b')][_0xcc2f('0xec')]}});})[_0xcc2f('0x1c')](function(_0x250a0f){socket['emit'](_0xcc2f('0xfb'),{'id':Number(_0x4c2556['params']['id']),'tags':_0x250a0f||[]});return{'id':Number(_0x4c2556[_0xcc2f('0xa4')]['id']),'tags':_0x250a0f||[]};});}})['then'](respondWithResult(_0x1a20c8,null))[_0xcc2f('0x25')](handleError(_0x1a20c8,null));};exports['removeTags']=function(_0x10d9f8,_0x2c7673,_0x48dda1){return db['ChatInteraction']['find']({'where':{'id':_0x10d9f8[_0xcc2f('0xa4')]['id']}})[_0xcc2f('0x1c')](handleEntityNotFound(_0x2c7673,null))[_0xcc2f('0x1c')](function(_0x3203c6){if(_0x3203c6){return _0x3203c6[_0xcc2f('0xfc')](_0x10d9f8['query'][_0xcc2f('0xec')]);}})[_0xcc2f('0x1c')](respondWithStatusCode(_0x2c7673,null))['catch'](handleError(_0x2c7673,null));};exports['download']=function(_0x46e2e3,_0x2bac5c){var _0x59f772=moment()[_0xcc2f('0xfd')]()[_0xcc2f('0x8d')]();var _0x5dc4c1=path[_0xcc2f('0xc7')](config[_0xcc2f('0xc8')],_0xcc2f('0xfe'),'files','tmp');var _0x2b3ffa=path[_0xcc2f('0xc7')](config[_0xcc2f('0xc8')],_0xcc2f('0xfe'),'files','attachments');var _0x136747=path[_0xcc2f('0xc7')](_0x5dc4c1,_0x59f772);var _0x303d03=util['format'](_0xcc2f('0xff'),_0x46e2e3[_0xcc2f('0xa4')]['id'],_0x59f772);var _0xa4ccbd=path[_0xcc2f('0xc7')](_0x5dc4c1,_0x303d03);var _0x318e39=[];_0x318e39['push']({'model':db[_0xcc2f('0x67')],'as':_0xcc2f('0x67'),'attributes':['id',_0xcc2f('0x31')],'raw':!![]});_0x318e39[_0xcc2f('0x34')]({'model':db['CmContact'],'as':_0xcc2f('0x5c'),'attributes':['id',_0xcc2f('0x100'),'lastName'],'raw':!![]});if(_0x46e2e3[_0xcc2f('0x3b')][_0xcc2f('0x101')]){_0x318e39[_0xcc2f('0x34')]({'model':db['Attachment'],'as':_0xcc2f('0xc1'),'raw':!![]});}var _0x3751ec=[{'model':db[_0xcc2f('0xb0')],'as':'Messages','attributes':['id',_0xcc2f('0x6b'),_0xcc2f('0x71'),_0xcc2f('0xd9'),'secret',_0xcc2f('0x102')],'include':_0x318e39}];_0x3751ec[_0xcc2f('0x34')]({'model':db[_0xcc2f('0xa7')],'as':_0xcc2f('0x103'),'attributes':['id',_0xcc2f('0x3a')]});_0x3751ec[_0xcc2f('0x34')]({'model':db[_0xcc2f('0x67')],'as':_0xcc2f('0x104'),'attributes':['id',_0xcc2f('0x31')]});return db[_0xcc2f('0x36')][_0xcc2f('0x58')]({'where':{'id':_0x46e2e3[_0xcc2f('0xa4')]['id']},'include':_0x3751ec})['then'](handleEntityNotFound(_0x2bac5c,null))[_0xcc2f('0x1c')](function(_0x24f0f5){if(_0x24f0f5){var _0x32645e=_0x24f0f5['get']({'plain':!![]});fs['mkdirSync'](_0x136747);var _0x231d5b={'format':'A4','border':_0xcc2f('0x105'),'header':{'height':'40px','contents':{'first':_0xcc2f('0x106')}},'footer':{'height':_0xcc2f('0x107'),'contents':{'default':util[_0xcc2f('0xd3')](_0xcc2f('0x108'),util[_0xcc2f('0xd3')](_0xcc2f('0x109'),_0xcc2f('0x10a'),_0x32645e['id']),moment()[_0xcc2f('0xd3')]('YYYY-MM-DD')[_0xcc2f('0x8d')]())}}};var _0x3eb10b={'channel':_0xcc2f('0x10a'),'account':_0x32645e['Account'][_0xcc2f('0x3a')],'agent':_0x32645e['Owner']?_0x32645e[_0xcc2f('0x104')][_0xcc2f('0x31')]:_0xcc2f('0x10b'),'createdAt':moment(_0x32645e['createdAt'])[_0xcc2f('0xd3')](_0xcc2f('0xf2'))[_0xcc2f('0x8d')](),'closedAt':_0x32645e[_0xcc2f('0xc3')]?moment(_0x32645e['closedAt'])[_0xcc2f('0xd3')](_0xcc2f('0xf2'))[_0xcc2f('0x8d')]():'','disposition':_0x32645e['disposition'],'chatInfo':{'browser':_0x32645e[_0xcc2f('0x10c')],'os':_0x32645e[_0xcc2f('0x10d')],'referer':_0x32645e['referer'],'customerIp':_0x32645e[_0xcc2f('0x10e')],'customerPort':_0x32645e[_0xcc2f('0x10f')]?_0x32645e[_0xcc2f('0x10f')]:'N.A.'},'messages':_(_0x32645e[_0xcc2f('0xce')])[_0xcc2f('0x110')]()[_0xcc2f('0x7a')]({'secret':![]})['map'](function(_0x226544){if(_0x226544[_0xcc2f('0xc1')]){var _0x1cd4d9=path[_0xcc2f('0xc7')](_0x2b3ffa,_0x226544[_0xcc2f('0xc1')][_0xcc2f('0xbe')]);if(fs['existsSync'](_0x1cd4d9)){fs['createReadStream'](_0x1cd4d9)[_0xcc2f('0x111')](fs[_0xcc2f('0x112')](path['join'](_0x136747,_0x226544[_0xcc2f('0xc1')][_0xcc2f('0xbe')])));}}return{'date':moment(_0x226544[_0xcc2f('0x71')])[_0xcc2f('0xd3')](_0xcc2f('0xf2'))['toString'](),'sender':_0x226544['direction']===_0xcc2f('0xaf')?_0x226544[_0xcc2f('0x67')]?_0x226544['User'][_0xcc2f('0x31')]:_0xcc2f('0xd1'):_0x226544[_0xcc2f('0x5c')][_0xcc2f('0x100')]+(_0x226544[_0xcc2f('0x5c')][_0xcc2f('0x113')]?'\x20'+_0x226544[_0xcc2f('0x5c')][_0xcc2f('0x113')]:''),'body':_0x226544[_0xcc2f('0xc1')]?_0x226544['Attachment'][_0xcc2f('0xbe')]:_0x226544[_0xcc2f('0x6b')],'direction':_0x226544[_0xcc2f('0xd9')]===_0xcc2f('0xaf')?'A':'C','secret':_0x226544['secret'],'read':_0x226544[_0xcc2f('0x102')],'attachment':_0x226544[_0xcc2f('0xc1')]};})[_0xcc2f('0x59')]()};return ejs[_0xcc2f('0x114')](path[_0xcc2f('0xc7')](config[_0xcc2f('0xc8')],_0xcc2f('0xfe'),_0xcc2f('0x115'),'downloadInteraction.html'),{'interaction':_0x3eb10b})['then'](function(_0x557f5b){return new BPromise(function(_0x20eb10,_0x504a93){pdf[_0xcc2f('0xa2')](_0x557f5b,_0x231d5b)[_0xcc2f('0x116')](path[_0xcc2f('0xc7')](_0x136747,_0xcc2f('0x117')+_0x32645e['id']+'-'+_0x59f772+_0xcc2f('0x118')),function(_0xbebc6,_0x4db3bb){if(_0xbebc6)return _0x504a93(_0xbebc6);_0x20eb10(_0x4db3bb);});});})[_0xcc2f('0x1c')](function(){return new BPromise(function(_0x7d733b,_0x22c466){zipdir(_0x136747,{'saveTo':_0xa4ccbd},function(_0x410e73,_0x5303c7){if(_0x410e73)return _0x22c466(_0x410e73);return _0x7d733b(_0x5303c7);});})[_0xcc2f('0x1c')](function(){return new BPromise(function(_0x15e7b8,_0xe8e367){rimraf(_0x136747,function(_0x34dbd1){if(_0x34dbd1)_0xe8e367(_0x34dbd1);return _0x15e7b8();});});})['then'](function(){return _0x2bac5c[_0xcc2f('0xca')](_0xa4ccbd,_0x303d03,function(_0x2deab8){if(_0x2deab8){console[_0xcc2f('0x119')](_0xcc2f('0x11a'),_0x2deab8);}else{fs[_0xcc2f('0x11b')](_0xa4ccbd);}});});});}else{return _0x2bac5c['sendStatus'](0xc8);}})[_0xcc2f('0x25')](handleError(_0x2bac5c,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index bceeb73..315febd 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 _0x2b59=['setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','remove','getUsers','then'];(function(_0x1af64d,_0x328190){var _0x27a9b5=function(_0x3f72ec){while(--_0x3f72ec){_0x1af64d['push'](_0x1af64d['shift']());}};_0x27a9b5(++_0x328190);}(_0x2b59,0x1de));var _0x92b5=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2b59[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x92b5('0x0'));var ChatInteraction=require(_0x92b5('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x92b5('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x92b5('0x3')](0x0);var events={'afterCreate':_0x92b5('0x4'),'afterUpdate':'update','afterDestroy':_0x92b5('0x5')};function emitEvent(_0x4be42b){return function(_0x58ba3c,_0x214bb9,_0x189766){_0x58ba3c[_0x92b5('0x6')]({'attributes':['id'],'raw':!![]})[_0x92b5('0x7')](function(_0x21ae97){_0x58ba3c[_0x92b5('0x8')]('Users',_0x21ae97[_0x92b5('0x9')](function(_0x1b57b0){return{'id':_0x1b57b0['id']};}));return ChatMessage[_0x92b5('0xa')]({'where':{'ChatInteractionId':_0x58ba3c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4211fb){_0x58ba3c['setDataValue'](_0x92b5('0xb'),_0x4211fb[_0x92b5('0xc')]);ChatInteractionEvents['emit'](_0x4be42b+':'+_0x58ba3c['id'],_0x58ba3c);ChatInteractionEvents[_0x92b5('0xd')](_0x4be42b,_0x58ba3c);_0x189766(null);})[_0x92b5('0xe')](_0x189766(null));};}for(var e in events){if(events[_0x92b5('0xf')](e)){var event=events[e];ChatInteraction[_0x92b5('0x10')](e,emitEvent(event));}}module[_0x92b5('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x1751=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x2ea9fd,_0x45d80b){var _0x27d18e=function(_0x20a0c9){while(--_0x20a0c9){_0x2ea9fd['push'](_0x2ea9fd['shift']());}};_0x27d18e(++_0x45d80b);}(_0x1751,0x76));var _0x1175=function(_0x434720,_0x4c02af){_0x434720=_0x434720-0x0;var _0x3edf1f=_0x1751[_0x434720];return _0x3edf1f;};'use strict';var EventEmitter=require(_0x1175('0x0'));var ChatInteraction=require(_0x1175('0x1'))['db'][_0x1175('0x2')];var ChatMessage=require(_0x1175('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1175('0x3')](0x0);var events={'afterCreate':_0x1175('0x4'),'afterUpdate':_0x1175('0x5'),'afterDestroy':_0x1175('0x6')};function emitEvent(_0x3087ab){return function(_0xfd3308,_0x2950d9,_0x171756){_0xfd3308[_0x1175('0x7')]({'attributes':['id'],'raw':!![]})[_0x1175('0x8')](function(_0x403f1a){_0xfd3308[_0x1175('0x9')](_0x1175('0xa'),_0x403f1a[_0x1175('0xb')](function(_0x224074){return{'id':_0x224074['id']};}));return ChatMessage[_0x1175('0xc')]({'where':{'ChatInteractionId':_0xfd3308['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1175('0x8')](function(_0xbd22d9){_0xfd3308[_0x1175('0x9')](_0x1175('0xd'),_0xbd22d9[_0x1175('0xe')]);ChatInteractionEvents[_0x1175('0xf')](_0x3087ab+':'+_0xfd3308['id'],_0xfd3308);ChatInteractionEvents[_0x1175('0xf')](_0x3087ab,_0xfd3308);_0x171756(null);})[_0x1175('0x10')](_0x171756(null));};}for(var e in events){if(events[_0x1175('0x11')](e)){var event=events[e];ChatInteraction[_0x1175('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5d7f9d7..6669864 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 _0x2510=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','rimraf','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed'];(function(_0x5812d3,_0x1d97b4){var _0x3bbd4a=function(_0x4e19db){while(--_0x4e19db){_0x5812d3['push'](_0x5812d3['shift']());}};_0x3bbd4a(++_0x1d97b4);}(_0x2510,0xc9));var _0x0251=function(_0x5accdf,_0x1add97){_0x5accdf=_0x5accdf-0x0;var _0x332acb=_0x2510[_0x5accdf];return _0x332acb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0251('0x0'))('api');var moment=require('moment');var BPromise=require(_0x0251('0x1'));var rp=require(_0x0251('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0251('0x3'));var config=require('../../config/environment');var attributes=require(_0x0251('0x4'));module['exports']=function(_0x508015,_0x2f9247){return _0x508015[_0x0251('0x5')](_0x0251('0x6'),attributes,{'tableName':_0x0251('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x430739,_0x249868,_0x187f04){if(_0x430739[_0x0251('0x8')](_0x0251('0x9'))){_0x430739[_0x0251('0xa')]=moment()[_0x0251('0xb')](_0x0251('0xc'));}_0x187f04(null,_0x430739);}},'charset':_0x0251('0xd'),'collate':_0x0251('0xe')});}; \ No newline at end of file +var _0xe2cc=['./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x377d61,_0x47a2c1){var _0x5e3d04=function(_0x571101){while(--_0x571101){_0x377d61['push'](_0x377d61['shift']());}};_0x5e3d04(++_0x47a2c1);}(_0xe2cc,0x180));var _0xce2c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe2cc[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var logger=require('../../config/logger')(_0xce2c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xce2c('0x3'));var fs=require('fs');var path=require(_0xce2c('0x4'));var rimraf=require(_0xce2c('0x5'));var config=require(_0xce2c('0x6'));var attributes=require(_0xce2c('0x7'));module[_0xce2c('0x8')]=function(_0x34fd9e,_0x1c3a8c){return _0x34fd9e[_0xce2c('0x9')](_0xce2c('0xa'),attributes,{'tableName':_0xce2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x507f41,_0x4a1a04,_0x81025){if(_0x507f41[_0xce2c('0xc')](_0xce2c('0xd'))){_0x507f41['closedAt']=moment()[_0xce2c('0xe')](_0xce2c('0xf'));}_0x81025(null,_0x507f41);}},'charset':'utf8mb4','collate':_0xce2c('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 9465eac..584bc82 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 _0xb2c1=['./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','where','attributes','stringify','AddTagsToChatInteraction','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x5e04e6,_0x45b102){var _0x2cf637=function(_0x25af20){while(--_0x25af20){_0x5e04e6['push'](_0x5e04e6['shift']());}};_0x2cf637(++_0x45b102);}(_0xb2c1,0x11c));var _0x1b2c=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0xb2c1[_0x2ade6c];return _0x2cb372;};'use strict';var _=require('lodash');var util=require(_0x1b2c('0x0'));var moment=require(_0x1b2c('0x1'));var BPromise=require(_0x1b2c('0x2'));var rs=require(_0x1b2c('0x3'));var fs=require('fs');var Redis=require(_0x1b2c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b2c('0x5'))(_0x1b2c('0x6'));var config=require('../../config/environment');var jayson=require(_0x1b2c('0x7'));var client=jayson[_0x1b2c('0x8')]['http']({'port':0x232a});config[_0x1b2c('0x9')]=_[_0x1b2c('0xa')](config[_0x1b2c('0x9')],{'host':_0x1b2c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b2c('0x9')]));require(_0x1b2c('0xc'))[_0x1b2c('0xd')](socket);function respondWithRpcPromise(_0x290390,_0x5a0c55,_0x197db9){return new BPromise(function(_0x8cfb8e,_0x5427dd){return client[_0x1b2c('0xe')](_0x290390,_0x197db9)['then'](function(_0x27647b){logger[_0x1b2c('0xf')](_0x1b2c('0x10'),_0x5a0c55,_0x1b2c('0x11'));logger['debug'](_0x1b2c('0x12'),_0x5a0c55,_0x1b2c('0x11'),JSON['stringify'](_0x27647b));if(_0x27647b[_0x1b2c('0x13')]){if(_0x27647b['error'][_0x1b2c('0x14')]===0x1f4){logger['error'](_0x1b2c('0x10'),_0x5a0c55,_0x27647b[_0x1b2c('0x13')]['message']);return _0x5427dd(_0x27647b['error'][_0x1b2c('0x15')]);}logger['error'](_0x1b2c('0x10'),_0x5a0c55,_0x27647b[_0x1b2c('0x13')]['message']);return _0x8cfb8e(_0x27647b[_0x1b2c('0x13')][_0x1b2c('0x15')]);}else{logger[_0x1b2c('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x5a0c55,_0x1b2c('0x11'));_0x8cfb8e(_0x27647b[_0x1b2c('0x16')][_0x1b2c('0x15')]);}})[_0x1b2c('0x17')](function(_0x3b8673){logger[_0x1b2c('0x13')](_0x1b2c('0x10'),_0x5a0c55,_0x3b8673);_0x5427dd(_0x3b8673);});});}exports[_0x1b2c('0x18')]=function(_0x452365){var _0x5249a3=this;return new Promise(function(_0x489531,_0x3bd29b){return db[_0x1b2c('0x19')][_0x1b2c('0x1a')](_0x452365['body'],{'raw':_0x452365[_0x1b2c('0x1b')]?_0x452365[_0x1b2c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x452365[_0x1b2c('0x1b')]?_0x452365['options'][_0x1b2c('0x1c')]||null:null,'attributes':_0x452365[_0x1b2c('0x1b')]?_0x452365[_0x1b2c('0x1b')][_0x1b2c('0x1d')]||null:null,'limit':_0x452365[_0x1b2c('0x1b')]?_0x452365[_0x1b2c('0x1b')]['limit']||null:null})['then'](function(_0x559d14){logger['info'](_0x1b2c('0x18'),_0x452365);logger['debug'](_0x1b2c('0x18'),_0x452365,JSON[_0x1b2c('0x1e')](_0x559d14));_0x489531(_0x559d14);})['catch'](function(_0x5e684b){logger['error'](_0x1b2c('0x18'),_0x5e684b[_0x1b2c('0x15')],_0x452365);_0x3bd29b(_0x5249a3[_0x1b2c('0x13')](0x1f4,_0x5e684b[_0x1b2c('0x15')]));});});};exports[_0x1b2c('0x1f')]=function(_0x529f3c){return new Promise(function(_0x535d7f,_0x1a1dff){return db[_0x1b2c('0x19')]['find']({'where':_0x529f3c[_0x1b2c('0x1b')]?_0x529f3c[_0x1b2c('0x1b')]['where']||null:null})['then'](function(_0x3babbe){if(_0x3babbe){return _0x3babbe['addTags'](_0x529f3c[_0x1b2c('0x20')][_0x1b2c('0x21')],_[_0x1b2c('0x22')](_0x529f3c['body'],['ids','id'])||{});}})[_0x1b2c('0x23')](function(_0x24a5a8){logger[_0x1b2c('0xf')]('AddTags',_0x529f3c);logger['debug']('AddTags',_0x529f3c,JSON[_0x1b2c('0x1e')](_0x24a5a8));_0x535d7f(_0x24a5a8);})[_0x1b2c('0x17')](function(_0x4aa3a5){logger['error'](_0x1b2c('0x24'),_0x4aa3a5[_0x1b2c('0x15')],_0x529f3c);_0x1a1dff(_this['error'](0x1f4,_0x4aa3a5[_0x1b2c('0x15')]));});});}; \ No newline at end of file +var _0xa9ec=['request\x20sent','debug','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x23efe7,_0x31b333){var _0x116625=function(_0x2af9cd){while(--_0x2af9cd){_0x23efe7['push'](_0x23efe7['shift']());}};_0x116625(++_0x31b333);}(_0xa9ec,0x10c));var _0xca9e=function(_0x4bf926,_0x3bf9cb){_0x4bf926=_0x4bf926-0x0;var _0x5b6e62=_0xa9ec[_0x4bf926];return _0x5b6e62;};'use strict';var _=require(_0xca9e('0x0'));var util=require(_0xca9e('0x1'));var moment=require(_0xca9e('0x2'));var BPromise=require(_0xca9e('0x3'));var rs=require(_0xca9e('0x4'));var fs=require('fs');var Redis=require(_0xca9e('0x5'));var db=require(_0xca9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xca9e('0x7'));var config=require(_0xca9e('0x8'));var jayson=require(_0xca9e('0x9'));var client=jayson['client'][_0xca9e('0xa')]({'port':0x232a});config[_0xca9e('0xb')]=_['defaults'](config['redis'],{'host':_0xca9e('0xc'),'port':0x18eb});var socket=require(_0xca9e('0xd'))(new Redis(config[_0xca9e('0xb')]));require(_0xca9e('0xe'))[_0xca9e('0xf')](socket);function respondWithRpcPromise(_0x2db667,_0x1c9b5c,_0x244e46){return new BPromise(function(_0x18683f,_0x45ac95){return client['request'](_0x2db667,_0x244e46)[_0xca9e('0x10')](function(_0x19ccb0){logger[_0xca9e('0x11')](_0xca9e('0x12'),_0x1c9b5c,_0xca9e('0x13'));logger[_0xca9e('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1c9b5c,_0xca9e('0x13'),JSON[_0xca9e('0x15')](_0x19ccb0));if(_0x19ccb0[_0xca9e('0x16')]){if(_0x19ccb0[_0xca9e('0x16')][_0xca9e('0x17')]===0x1f4){logger['error'](_0xca9e('0x12'),_0x1c9b5c,_0x19ccb0[_0xca9e('0x16')]['message']);return _0x45ac95(_0x19ccb0[_0xca9e('0x16')][_0xca9e('0x18')]);}logger[_0xca9e('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x1c9b5c,_0x19ccb0[_0xca9e('0x16')][_0xca9e('0x18')]);return _0x18683f(_0x19ccb0[_0xca9e('0x16')][_0xca9e('0x18')]);}else{logger[_0xca9e('0x11')](_0xca9e('0x12'),_0x1c9b5c,'request\x20sent');_0x18683f(_0x19ccb0[_0xca9e('0x19')][_0xca9e('0x18')]);}})[_0xca9e('0x1a')](function(_0x4ea364){logger[_0xca9e('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x1c9b5c,_0x4ea364);_0x45ac95(_0x4ea364);});});}exports[_0xca9e('0x1b')]=function(_0x381937){var _0x46e3e7=this;return new Promise(function(_0x240d99,_0x2a5f73){return db[_0xca9e('0x1c')][_0xca9e('0x1d')](_0x381937[_0xca9e('0x1e')],{'raw':_0x381937[_0xca9e('0x1f')]?_0x381937[_0xca9e('0x1f')][_0xca9e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x381937[_0xca9e('0x1f')]?_0x381937[_0xca9e('0x1f')][_0xca9e('0x21')]||null:null,'attributes':_0x381937[_0xca9e('0x1f')]?_0x381937[_0xca9e('0x1f')]['attributes']||null:null,'limit':_0x381937[_0xca9e('0x1f')]?_0x381937[_0xca9e('0x1f')][_0xca9e('0x22')]||null:null})['then'](function(_0x5795ef){logger[_0xca9e('0x11')](_0xca9e('0x1b'),_0x381937);logger[_0xca9e('0x14')](_0xca9e('0x1b'),_0x381937,JSON['stringify'](_0x5795ef));_0x240d99(_0x5795ef);})[_0xca9e('0x1a')](function(_0x502237){logger['error'](_0xca9e('0x1b'),_0x502237[_0xca9e('0x18')],_0x381937);_0x2a5f73(_0x46e3e7['error'](0x1f4,_0x502237[_0xca9e('0x18')]));});});};exports[_0xca9e('0x23')]=function(_0x2dad05){return new Promise(function(_0x54c672,_0x1b46e9){return db[_0xca9e('0x1c')][_0xca9e('0x24')]({'where':_0x2dad05[_0xca9e('0x1f')]?_0x2dad05[_0xca9e('0x1f')][_0xca9e('0x21')]||null:null})[_0xca9e('0x10')](function(_0x3b2deb){if(_0x3b2deb){return _0x3b2deb[_0xca9e('0x25')](_0x2dad05[_0xca9e('0x1e')][_0xca9e('0x26')],_[_0xca9e('0x27')](_0x2dad05['body'],[_0xca9e('0x26'),'id'])||{});}})['spread'](function(_0x1d20f1){logger['info'](_0xca9e('0x28'),_0x2dad05);logger['debug']('AddTags',_0x2dad05,JSON[_0xca9e('0x15')](_0x1d20f1));_0x54c672(_0x1d20f1);})['catch'](function(_0x7a72ec){logger[_0xca9e('0x16')](_0xca9e('0x28'),_0x7a72ec[_0xca9e('0x18')],_0x2dad05);_0x1b46e9(_this[_0xca9e('0x16')](0x1f4,_0x7a72ec['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2f541fa..81804c3 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 _0xe73d=['remove','update','emit','register','length','chatInteraction:','save'];(function(_0x31e658,_0x2919e0){var _0x34a0b2=function(_0x358f3d){while(--_0x358f3d){_0x31e658['push'](_0x31e658['shift']());}};_0x34a0b2(++_0x2919e0);}(_0xe73d,0x11e));var _0xde73=function(_0x561aa8,_0x36c43b){_0x561aa8=_0x561aa8-0x0;var _0x2150bb=_0xe73d[_0x561aa8];return _0x2150bb;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xde73('0x0'),_0xde73('0x1'),_0xde73('0x2')];function createListener(_0x3c9673,_0x34866a){return function(_0x5d0adc){_0x34866a[_0xde73('0x3')](_0x3c9673,_0x5d0adc);};}function removeListener(_0x777a96,_0x17f836){return function(){ChatInteractionEvents['removeListener'](_0x777a96,_0x17f836);};}exports[_0xde73('0x4')]=function(_0x2e4095){for(var _0x2c7037=0x0,_0x260c43=events[_0xde73('0x5')];_0x2c7037<_0x260c43;_0x2c7037++){var _0x463c1a=events[_0x2c7037];var _0x319701=createListener(_0xde73('0x6')+_0x463c1a,_0x2e4095);ChatInteractionEvents['on'](_0x463c1a,_0x319701);}}; \ No newline at end of file +var _0x14e5=['chatInteraction:','save','update','register','length'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0x14e5,0xe2));var _0x514e=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x14e5[_0x1e4150];return _0x1ce3ee;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x514e('0x0'),'remove',_0x514e('0x1')];function createListener(_0xd680ef,_0x1323f9){return function(_0x12386a){_0x1323f9['emit'](_0xd680ef,_0x12386a);};}function removeListener(_0x23cdfd,_0x2a9309){return function(){ChatInteractionEvents['removeListener'](_0x23cdfd,_0x2a9309);};}exports[_0x514e('0x2')]=function(_0xaf63f8){for(var _0x262eb3=0x0,_0x5da94e=events[_0x514e('0x3')];_0x262eb3<_0x5da94e;_0x262eb3++){var _0x4452a3=events[_0x262eb3];var _0x3064ea=createListener(_0x514e('0x4')+_0x4452a3,_0xaf63f8);ChatInteractionEvents['on'](_0x4452a3,_0x3064ea);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7f14fd6..693e147 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 _0x1232=['isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chat','addTags','put','/:id','update','/:id/custom_update','customUpdate','abandon','close','delete','chatinteraction:destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get'];(function(_0x4f8714,_0x28c6e2){var _0x5b62f6=function(_0x12a1ba){while(--_0x12a1ba){_0x4f8714['push'](_0x4f8714['shift']());}};_0x5b62f6(++_0x28c6e2);}(_0x1232,0x85));var _0x2123=function(_0x3648ab,_0x169675){_0x3648ab=_0x3648ab-0x0;var _0x1c93d5=_0x1232[_0x3648ab];return _0x1c93d5;};'use strict';var multer=require(_0x2123('0x0'));var util=require(_0x2123('0x1'));var path=require(_0x2123('0x2'));var timeout=require(_0x2123('0x3'));var express=require(_0x2123('0x4'));var router=express[_0x2123('0x5')]();var fs_extra=require(_0x2123('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2123('0x7'));var config=require(_0x2123('0x8'));var controller=require(_0x2123('0x9'));router[_0x2123('0xa')]('/',auth[_0x2123('0xb')](),controller[_0x2123('0xc')]);router[_0x2123('0xa')](_0x2123('0xd'),auth[_0x2123('0xb')](),controller[_0x2123('0xe')]);router['get']('/:id',auth[_0x2123('0xf')](),controller['show']);router[_0x2123('0xa')](_0x2123('0x10'),auth[_0x2123('0xf')](),controller[_0x2123('0x11')]);router['get'](_0x2123('0x12'),auth[_0x2123('0xb')](),controller['getMessages']);router[_0x2123('0xa')](_0x2123('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x2123('0x14')]);router['get']('/:id/download',auth[_0x2123('0xb')](),controller[_0x2123('0x15')]);router[_0x2123('0x16')]('/',auth[_0x2123('0xb')](),controller['create']);router[_0x2123('0x16')](_0x2123('0x17'),auth[_0x2123('0xb')](),controller[_0x2123('0x18')]);var upload=multer({'storage':multer[_0x2123('0x19')]({'destination':function(_0x597cf5,_0x4d874,_0x4198e8){_0x4198e8(null,path[_0x2123('0x1a')](config[_0x2123('0x1b')],_0x2123('0x1c')));},'filename':function(_0x377576,_0x7fda3c,_0x427bd9){_0x427bd9(null,util['format'](_0x2123('0x1d'),Date[_0x2123('0x1e')](),_0x7fda3c['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2123('0x16')](_0x2123('0x1f'),upload['single'](_0x2123('0x20')),controller[_0x2123('0x21')]);router[_0x2123('0x16')](_0x2123('0x12'),auth[_0x2123('0xf')](),controller['addMessage']);router[_0x2123('0x16')](_0x2123('0x22'),auth[_0x2123('0xb')](),interaction[_0x2123('0x23')](_0x2123('0x24'),'chatinteraction:addtags'),controller[_0x2123('0x25')]);router[_0x2123('0x26')](_0x2123('0x27'),auth[_0x2123('0xb')](),interaction[_0x2123('0x23')](_0x2123('0x24'),'chatinteraction:update'),controller[_0x2123('0x28')]);router['put'](_0x2123('0x29'),controller[_0x2123('0x2a')]);router[_0x2123('0x26')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x2123('0x2b')]);router[_0x2123('0x26')]('/:id/close',controller[_0x2123('0x2c')]);router[_0x2123('0x2d')](_0x2123('0x27'),auth[_0x2123('0xb')](),interaction[_0x2123('0x23')]('chat',_0x2123('0x2e')),controller['destroy']);router[_0x2123('0x2d')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x2123('0x2f')]=router; \ No newline at end of file +var _0x1b45=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','format','now','replace','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf69619,_0x26eb17){var _0x2445a2=function(_0x4b8e56){while(--_0x4b8e56){_0xf69619['push'](_0xf69619['shift']());}};_0x2445a2(++_0x26eb17);}(_0x1b45,0x130));var _0x51b4=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x1b45[_0x8a7e38];return _0x228609;};'use strict';var multer=require(_0x51b4('0x0'));var util=require(_0x51b4('0x1'));var path=require(_0x51b4('0x2'));var timeout=require(_0x51b4('0x3'));var express=require(_0x51b4('0x4'));var router=express[_0x51b4('0x5')]();var fs_extra=require(_0x51b4('0x6'));var auth=require(_0x51b4('0x7'));var interaction=require(_0x51b4('0x8'));var config=require(_0x51b4('0x9'));var controller=require(_0x51b4('0xa'));router[_0x51b4('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x51b4('0xb')]('/describe',auth[_0x51b4('0xc')](),controller['describe']);router['get'](_0x51b4('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x51b4('0xe')]);router[_0x51b4('0xb')](_0x51b4('0xf'),auth[_0x51b4('0x10')](),controller[_0x51b4('0x11')]);router[_0x51b4('0xb')](_0x51b4('0x12'),auth[_0x51b4('0xc')](),controller[_0x51b4('0x13')]);router[_0x51b4('0xb')]('/:id/my_messages',auth[_0x51b4('0x10')](),controller[_0x51b4('0x14')]);router[_0x51b4('0xb')](_0x51b4('0x15'),auth['isAuthenticated'](),controller[_0x51b4('0x16')]);router[_0x51b4('0x17')]('/',auth['isAuthenticated'](),controller[_0x51b4('0x18')]);router[_0x51b4('0x17')](_0x51b4('0x19'),auth['isAuthenticated'](),controller[_0x51b4('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x20a875,_0x558206,_0x99757f){_0x99757f(null,path['join'](config[_0x51b4('0x1b')],_0x51b4('0x1c')));},'filename':function(_0x189e16,_0x5f4f67,_0x347f1a){_0x347f1a(null,util[_0x51b4('0x1d')]('%s-%s',Date[_0x51b4('0x1e')](),_0x5f4f67['originalname'][_0x51b4('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x51b4('0x17')]('/:id/attachment_upload',upload['single'](_0x51b4('0x20')),controller[_0x51b4('0x21')]);router['post'](_0x51b4('0x12'),auth[_0x51b4('0x10')](),controller[_0x51b4('0x22')]);router[_0x51b4('0x17')](_0x51b4('0x23'),auth[_0x51b4('0xc')](),interaction[_0x51b4('0x24')](_0x51b4('0x25'),_0x51b4('0x26')),controller[_0x51b4('0x27')]);router[_0x51b4('0x28')]('/:id',auth[_0x51b4('0xc')](),interaction['tracked']('chat',_0x51b4('0x29')),controller[_0x51b4('0x2a')]);router[_0x51b4('0x28')](_0x51b4('0x2b'),controller[_0x51b4('0x2c')]);router[_0x51b4('0x28')]('/:id/abandon',auth[_0x51b4('0x10')](),controller[_0x51b4('0x2d')]);router['put'](_0x51b4('0x2e'),controller['close']);router[_0x51b4('0x2f')]('/:id',auth[_0x51b4('0xc')](),interaction[_0x51b4('0x24')](_0x51b4('0x25'),_0x51b4('0x30')),controller[_0x51b4('0x31')]);router[_0x51b4('0x2f')](_0x51b4('0x23'),auth[_0x51b4('0xc')](),controller[_0x51b4('0x32')]);module[_0x51b4('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 79bc309..978238d 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x525134,_0x10ff45){var _0x53d2b7=function(_0x40ebb3){while(--_0x40ebb3){_0x525134['push'](_0x525134['shift']());}};_0x53d2b7(++_0x10ff45);}(_0x57ca,0x108));var _0xa57c=function(_0x2ad6c5,_0x58050f){_0x2ad6c5=_0x2ad6c5-0x0;var _0x507001=_0x57ca[_0x2ad6c5];return _0x507001;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file +var _0x1261=['TEXT','medium','BOOLEAN','INTEGER','exports'];(function(_0x6bfd27,_0x2a3c9a){var _0x417f65=function(_0x42e898){while(--_0x42e898){_0x6bfd27['push'](_0x6bfd27['shift']());}};_0x417f65(++_0x2a3c9a);}(_0x1261,0x144));var _0x1126=function(_0x433e29,_0x14b418){_0x433e29=_0x433e29-0x0;var _0x84abd4=_0x1261[_0x433e29];return _0x84abd4;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'body':{'type':Sequelize[_0x1126('0x1')](_0x1126('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1126('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 05878c2..4da22c8 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 _0xd909=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','then','stack','name','send','index','map','ChatInternalMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','options','find','catch','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','showWebBar','-online','VoiceQueue','Agents','userProfileId','UserProfileResource','resourceId','push','FromId','ToId','read','sort','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x404af5,_0x8a6f75){var _0x5ed1cc=function(_0x4a56f1){while(--_0x4a56f1){_0x404af5['push'](_0x404af5['shift']());}};_0x5ed1cc(++_0x8a6f75);}(_0xd909,0x12c));var _0x9d90=function(_0x5a49d7,_0x5087d1){_0x5a49d7=_0x5a49d7-0x0;var _0x448b14=_0xd909[_0x5a49d7];return _0x448b14;};'use strict';var pdf=require(_0x9d90('0x0'));var emlformat=require(_0x9d90('0x1'));var rimraf=require(_0x9d90('0x2'));var zipdir=require(_0x9d90('0x3'));var jsonpatch=require(_0x9d90('0x4'));var rp=require(_0x9d90('0x5'));var moment=require(_0x9d90('0x6'));var BPromise=require(_0x9d90('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d90('0x8'));var sox=require(_0x9d90('0x9'));var csv=require('to-csv');var ejs=require(_0x9d90('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d90('0xb'));var jsforce=require(_0x9d90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9d90('0xd'));var querystring=require(_0x9d90('0xe'));var Papa=require(_0x9d90('0xf'));var Redis=require(_0x9d90('0x10'));var authService=require(_0x9d90('0x11'));var qs=require(_0x9d90('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d90('0x13'));var logger=require('../../config/logger')(_0x9d90('0x14'));var utils=require(_0x9d90('0x15'));var config=require(_0x9d90('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d90('0x17'))['db'];config[_0x9d90('0x18')]=_[_0x9d90('0x19')](config['redis'],{'host':_0x9d90('0x1a'),'port':0x18eb});var socket=require(_0x9d90('0x1b'))(new Redis(config['redis']));require(_0x9d90('0x1c'))[_0x9d90('0x1d')](socket);function respondWithStatusCode(_0x36400d,_0x27a6dc){_0x27a6dc=_0x27a6dc||0xcc;return function(_0x18640e){if(_0x18640e){return _0x36400d[_0x9d90('0x1e')](_0x27a6dc);}return _0x36400d['status'](_0x27a6dc)[_0x9d90('0x1f')]();};}function respondWithResult(_0x2c42b7,_0x4b49ef){_0x4b49ef=_0x4b49ef||0xc8;return function(_0xb318b5){if(_0xb318b5){return _0x2c42b7[_0x9d90('0x20')](_0x4b49ef)[_0x9d90('0x21')](_0xb318b5);}};}function respondWithFilteredResult(_0xb4d4c3,_0x1d9527){return function(_0x17d0b7){if(_0x17d0b7){var _0x40bd69=_0x17d0b7[_0x9d90('0x22')],_0x3aafe7=_0x1d9527[_0x9d90('0x23')],_0x351608=_0x1d9527[_0x9d90('0x23')]+_0x1d9527[_0x9d90('0x24')],_0x342f16;if(_0x351608>=_0x40bd69){_0x351608=_0x40bd69;_0x342f16=0xc8;}else{_0x342f16=0xce;}_0xb4d4c3['status'](_0x342f16);return _0xb4d4c3[_0x9d90('0x25')]('Content-Range',_0x3aafe7+'-'+_0x351608+'/'+_0x40bd69)[_0x9d90('0x21')](_0x17d0b7);}return null;};}function patchUpdates(_0x2857bf){return function(_0x2d76ab){try{jsonpatch[_0x9d90('0x26')](_0x2d76ab,_0x2857bf,!![]);}catch(_0x5aa93a){return BPromise['reject'](_0x5aa93a);}return _0x2d76ab[_0x9d90('0x27')]();};}function saveUpdates(_0x307793,_0x2cdc25){return function(_0x2724c){if(_0x2724c){return _0x2724c[_0x9d90('0x28')](_0x307793)[_0x9d90('0x29')](function(_0x54bf92){return _0x54bf92;});}return null;};}function removeEntity(_0x4293db,_0x581a60){return function(_0x26b1cf){if(_0x26b1cf){return _0x26b1cf['destroy']()[_0x9d90('0x29')](function(){_0x4293db[_0x9d90('0x20')](0xcc)[_0x9d90('0x1f')]();});}};}function handleEntityNotFound(_0x8847a4,_0x5618ff){return function(_0x5c35a3){if(!_0x5c35a3){_0x8847a4[_0x9d90('0x1e')](0x194);}return _0x5c35a3;};}function handleError(_0x2cf8b0,_0x52ffc4){_0x52ffc4=_0x52ffc4||0x1f4;return function(_0xee341f){logger['error'](_0xee341f[_0x9d90('0x2a')]);if(_0xee341f[_0x9d90('0x2b')]){delete _0xee341f[_0x9d90('0x2b')];}_0x2cf8b0[_0x9d90('0x20')](_0x52ffc4)[_0x9d90('0x2c')](_0xee341f);};}exports[_0x9d90('0x2d')]=function(_0x274695,_0x5aeecc){var _0x2fac4b={},_0x25e8c8={},_0x5a94f9={'count':0x0,'rows':[]};var _0x25f274=_[_0x9d90('0x2e')](db[_0x9d90('0x2f')]['rawAttributes'],function(_0x135e4c){return{'name':_0x135e4c[_0x9d90('0x30')],'type':_0x135e4c['type'][_0x9d90('0x31')]};});_0x25e8c8[_0x9d90('0x32')]=_[_0x9d90('0x2e')](_0x25f274,_0x9d90('0x2b'));_0x25e8c8[_0x9d90('0x33')]=_[_0x9d90('0x34')](_0x274695[_0x9d90('0x33')]);_0x25e8c8[_0x9d90('0x35')]=_[_0x9d90('0x36')](_0x25e8c8[_0x9d90('0x32')],_0x25e8c8[_0x9d90('0x33')]);_0x2fac4b[_0x9d90('0x37')]=_[_0x9d90('0x36')](_0x25e8c8[_0x9d90('0x32')],qs[_0x9d90('0x38')](_0x274695[_0x9d90('0x33')][_0x9d90('0x38')]));_0x2fac4b[_0x9d90('0x37')]=_0x2fac4b['attributes'][_0x9d90('0x39')]?_0x2fac4b[_0x9d90('0x37')]:_0x25e8c8[_0x9d90('0x32')];if(!_0x274695[_0x9d90('0x33')]['hasOwnProperty']('nolimit')){_0x2fac4b['limit']=qs['limit'](_0x274695[_0x9d90('0x33')][_0x9d90('0x24')]);_0x2fac4b[_0x9d90('0x23')]=qs[_0x9d90('0x23')](_0x274695[_0x9d90('0x33')]['offset']);}_0x2fac4b['order']=qs['sort'](_0x274695[_0x9d90('0x33')]['sort']);_0x2fac4b[_0x9d90('0x3a')]=qs['filters'](_[_0x9d90('0x3b')](_0x274695[_0x9d90('0x33')],_0x25e8c8[_0x9d90('0x35')]),_0x25f274);if(_0x274695[_0x9d90('0x33')][_0x9d90('0x3c')]){_0x2fac4b[_0x9d90('0x3a')]=_[_0x9d90('0x3d')](_0x2fac4b[_0x9d90('0x3a')],{'$or':_[_0x9d90('0x2e')](_0x25f274,function(_0x1830ff){if(_0x1830ff[_0x9d90('0x3e')]!==_0x9d90('0x3f')){var _0x3d2fbb={};_0x3d2fbb[_0x1830ff[_0x9d90('0x2b')]]={'$like':'%'+_0x274695[_0x9d90('0x33')][_0x9d90('0x3c')]+'%'};return _0x3d2fbb;}})});}_0x2fac4b=_['merge']({},_0x2fac4b,_0x274695['options']);var _0x12ccd5={'where':_0x2fac4b[_0x9d90('0x3a')]};return db[_0x9d90('0x2f')][_0x9d90('0x22')](_0x12ccd5)[_0x9d90('0x29')](function(_0x5c0c69){_0x5a94f9['count']=_0x5c0c69;if(_0x274695[_0x9d90('0x33')][_0x9d90('0x40')]){_0x2fac4b[_0x9d90('0x41')]=[{'all':!![]}];}return db[_0x9d90('0x2f')][_0x9d90('0x42')](_0x2fac4b);})[_0x9d90('0x29')](function(_0x23f103){_0x5a94f9[_0x9d90('0x43')]=_0x23f103;return _0x5a94f9;})[_0x9d90('0x29')](respondWithFilteredResult(_0x5aeecc,_0x2fac4b))['catch'](handleError(_0x5aeecc,null));};exports['show']=function(_0x3c3c94,_0x46d298){var _0x2ecbfa={'raw':!![],'where':{'id':_0x3c3c94[_0x9d90('0x44')]['id']}},_0x417147={};_0x417147[_0x9d90('0x32')]=_[_0x9d90('0x34')](db[_0x9d90('0x2f')][_0x9d90('0x45')]);_0x417147[_0x9d90('0x33')]=_[_0x9d90('0x34')](_0x3c3c94['query']);_0x417147[_0x9d90('0x35')]=_[_0x9d90('0x36')](_0x417147[_0x9d90('0x32')],_0x417147['query']);_0x2ecbfa[_0x9d90('0x37')]=_[_0x9d90('0x36')](_0x417147[_0x9d90('0x32')],qs['fields'](_0x3c3c94['query'][_0x9d90('0x38')]));_0x2ecbfa[_0x9d90('0x37')]=_0x2ecbfa[_0x9d90('0x37')][_0x9d90('0x39')]?_0x2ecbfa['attributes']:_0x417147['model'];if(_0x3c3c94['query'][_0x9d90('0x40')]){_0x2ecbfa[_0x9d90('0x41')]=[{'all':!![]}];}_0x2ecbfa=_[_0x9d90('0x3d')]({},_0x2ecbfa,_0x3c3c94[_0x9d90('0x46')]);return db[_0x9d90('0x2f')][_0x9d90('0x47')](_0x2ecbfa)['then'](handleEntityNotFound(_0x46d298,null))['then'](respondWithResult(_0x46d298,null))[_0x9d90('0x48')](handleError(_0x46d298,null));};exports['create']=function(_0x4a62f3,_0x581949){return db[_0x9d90('0x2f')][_0x9d90('0x49')](_0x4a62f3[_0x9d90('0x4a')],{})[_0x9d90('0x29')](respondWithResult(_0x581949,0xc9))[_0x9d90('0x48')](handleError(_0x581949,null));};exports[_0x9d90('0x28')]=function(_0x1629b1,_0x132d6a){if(_0x1629b1[_0x9d90('0x4a')]['id']){delete _0x1629b1['body']['id'];}return db['ChatInternalMessage'][_0x9d90('0x47')]({'where':{'id':_0x1629b1[_0x9d90('0x44')]['id']}})['then'](handleEntityNotFound(_0x132d6a,null))['then'](saveUpdates(_0x1629b1[_0x9d90('0x4a')],null))[_0x9d90('0x29')](respondWithResult(_0x132d6a,null))[_0x9d90('0x48')](handleError(_0x132d6a,null));};exports[_0x9d90('0x4b')]=function(_0x1d3d1a,_0x3bd784){return db[_0x9d90('0x2f')][_0x9d90('0x47')]({'where':{'id':_0x1d3d1a[_0x9d90('0x44')]['id']}})[_0x9d90('0x29')](handleEntityNotFound(_0x3bd784,null))[_0x9d90('0x29')](removeEntity(_0x3bd784,null))['catch'](handleError(_0x3bd784,null));};exports[_0x9d90('0x4c')]=function(_0x3ffbd1,_0xad70d5){return db[_0x9d90('0x2f')]['describe']()[_0x9d90('0x29')](respondWithResult(_0xad70d5,null))[_0x9d90('0x48')](handleError(_0xad70d5,null));};function wrapUser(_0x1d5079){return function(_0x8a6243){var _0x36ac27=_0x1d5079[_0x9d90('0x4d')]({'plain':!![]});_0x36ac27[_0x9d90('0x4e')]=[];if(_0x8a6243){_0x36ac27[_0x9d90('0x4f')]=_0x8a6243[_0x9d90('0x50')];_0x36ac27[_0x9d90('0x51')]=_0x8a6243;}else{_0x36ac27['lastMessageAt']=moment(0x0)[_0x9d90('0x52')](_0x9d90('0x53'));_0x36ac27[_0x9d90('0x51')]={};}return _0x36ac27;};}exports[_0x9d90('0x54')]=function(_0x2dd156,_0x528796,_0x23780c){var _0x5d4f30=[];return db[_0x9d90('0x55')][_0x9d90('0x42')]({'where':{'role':[_0x9d90('0x56'),_0x9d90('0x57'),_0x9d90('0x58')]},'attributes':['id',_0x9d90('0x59'),_0x9d90('0x2b'),_0x9d90('0x5a'),_0x9d90('0x5b'),_0x9d90('0x5c'),_0x9d90('0x5d'),'lastLoginAt','allowmessenger',_0x9d90('0x5e')],'order':qs['sort'](_0x9d90('0x5f')),'include':[{'model':db[_0x9d90('0x60')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x9d90('0x29')](function(_0x4bbb27){if(_0x4bbb27){var _0x59c3c6=_0x2dd156[_0x9d90('0x58')][_0x9d90('0x4d')]({'plain':!![]});if(!_0x59c3c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59c3c6['role']===_0x9d90('0x58')){return db['UserProfileSection']['find']({'where':{'name':_0x9d90('0x61'),'userProfileId':_0x59c3c6[_0x9d90('0x62')]},'raw':!![]})[_0x9d90('0x29')](function(_0x2c0509){if(_0x2c0509){if(_0x2c0509['autoAssociation']===0x0){return db[_0x9d90('0x63')][_0x9d90('0x42')]({'where':{'sectionId':_0x2c0509['id']},'raw':!![]})[_0x9d90('0x29')](function(_0x2e6d4e){var _0x2c41ec=[];if(_['isEmpty'](_0x2e6d4e)){_0x2c41ec=_[_0x9d90('0x3c')](_0x4bbb27,function(_0x4540dc){if(_0x4540dc[_0x9d90('0x5a')]!==_0x9d90('0x56')){return _0x4540dc;}});return _0x2c41ec;}else{for(var _0x389922=0x0;_0x389922<_0x4bbb27[_0x9d90('0x39')];_0x389922++){var _0x2af6b3=_0x4bbb27[_0x389922];if(_0x2af6b3[_0x9d90('0x5a')]===_0x9d90('0x56')){var _0x497d29=_[_0x9d90('0x47')](_0x2e6d4e,function(_0x64ec2){return _0x64ec2[_0x9d90('0x64')]===_0x2af6b3['id'];});if(_0x497d29)_0x2c41ec[_0x9d90('0x65')](_0x2af6b3);}else{_0x2c41ec[_0x9d90('0x65')](_0x2af6b3);}}return _0x2c41ec;}});}else{return _0x4bbb27;}}else{var _0x308642=_[_0x9d90('0x3c')](_0x4bbb27,function(_0x19fc00){if(_0x19fc00[_0x9d90('0x5a')]!==_0x9d90('0x56')){return _0x19fc00;}});return _0x308642;}});}else{return _0x4bbb27;}}})[_0x9d90('0x29')](function(_0x46e366){var _0x5f163c=[];if(_0x46e366){_0x5d4f30=_0x46e366;for(var _0x164161=0x0;_0x164161<_0x46e366[_0x9d90('0x39')];_0x164161+=0x1){_0x5d4f30[_0x164161][_0x9d90('0x4e')]=[];_0x5f163c['push'](db['ChatInternalMessage'][_0x9d90('0x47')]({'where':{'FromId':[_0x2dd156[_0x9d90('0x58')]['id'],_0x46e366[_0x164161]['id']],'ToId':[_0x2dd156[_0x9d90('0x58')]['id'],_0x46e366[_0x164161]['id']],'ChatGroupId':null},'attributes':['id',_0x9d90('0x50'),_0x9d90('0x66'),_0x9d90('0x67'),_0x9d90('0x68'),'body'],'order':qs[_0x9d90('0x69')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9d90('0x29')](wrapUser(_0x46e366[_0x164161])));}return BPromise[_0x9d90('0x6a')](_0x5f163c);}return[];})[_0x9d90('0x29')](function(_0x4b89e4){return{'rows':_0x4b89e4,'count':_0x4b89e4[_0x9d90('0x39')]};})[_0x9d90('0x29')](respondWithResult(_0x528796,null))[_0x9d90('0x48')](handleError(_0x528796,null));}; \ No newline at end of file +var _0x4ac6=['-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','ToId','read','-createdAt','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','localhost','redis','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar'];(function(_0x4aacbb,_0x2c2085){var _0x35d0fc=function(_0x35523c){while(--_0x35523c){_0x4aacbb['push'](_0x4aacbb['shift']());}};_0x35d0fc(++_0x2c2085);}(_0x4ac6,0xe7));var _0x64ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ac6[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x64ac('0x0'));var emlformat=require(_0x64ac('0x1'));var rimraf=require(_0x64ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64ac('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x64ac('0x4'));var Mustache=require('mustache');var util=require(_0x64ac('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x64ac('0x6'));var ejs=require(_0x64ac('0x7'));var fs=require('fs');var fs_extra=require(_0x64ac('0x8'));var _=require(_0x64ac('0x9'));var squel=require(_0x64ac('0xa'));var crypto=require(_0x64ac('0xb'));var jsforce=require(_0x64ac('0xc'));var deskjs=require(_0x64ac('0xd'));var toCsv=require(_0x64ac('0x6'));var querystring=require(_0x64ac('0xe'));var Papa=require(_0x64ac('0xf'));var Redis=require(_0x64ac('0x10'));var authService=require(_0x64ac('0x11'));var qs=require(_0x64ac('0x12'));var as=require(_0x64ac('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x64ac('0x14'));var utils=require('../../config/utils');var config=require(_0x64ac('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x64ac('0x16'))['db'];config['redis']=_[_0x64ac('0x17')](config['redis'],{'host':_0x64ac('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x64ac('0x19')]));require('./chatInternalMessage.socket')[_0x64ac('0x1a')](socket);function respondWithStatusCode(_0x55e47b,_0x1523b7){_0x1523b7=_0x1523b7||0xcc;return function(_0x29352d){if(_0x29352d){return _0x55e47b[_0x64ac('0x1b')](_0x1523b7);}return _0x55e47b['status'](_0x1523b7)[_0x64ac('0x1c')]();};}function respondWithResult(_0x37d04b,_0x3159e3){_0x3159e3=_0x3159e3||0xc8;return function(_0x21f734){if(_0x21f734){return _0x37d04b[_0x64ac('0x1d')](_0x3159e3)[_0x64ac('0x1e')](_0x21f734);}};}function respondWithFilteredResult(_0x10cad9,_0x558edb){return function(_0x14b51c){if(_0x14b51c){var _0x378501=_0x14b51c[_0x64ac('0x1f')],_0x1af051=_0x558edb[_0x64ac('0x20')],_0x557b9b=_0x558edb[_0x64ac('0x20')]+_0x558edb[_0x64ac('0x21')],_0x4abace;if(_0x557b9b>=_0x378501){_0x557b9b=_0x378501;_0x4abace=0xc8;}else{_0x4abace=0xce;}_0x10cad9[_0x64ac('0x1d')](_0x4abace);return _0x10cad9['set'](_0x64ac('0x22'),_0x1af051+'-'+_0x557b9b+'/'+_0x378501)[_0x64ac('0x1e')](_0x14b51c);}return null;};}function patchUpdates(_0x1141f0){return function(_0x2d71ee){try{jsonpatch[_0x64ac('0x23')](_0x2d71ee,_0x1141f0,!![]);}catch(_0x17c49e){return BPromise[_0x64ac('0x24')](_0x17c49e);}return _0x2d71ee[_0x64ac('0x25')]();};}function saveUpdates(_0x495fb9,_0x3d86f5){return function(_0x2468a5){if(_0x2468a5){return _0x2468a5['update'](_0x495fb9)['then'](function(_0x4ba2b1){return _0x4ba2b1;});}return null;};}function removeEntity(_0x16b44a,_0x3833df){return function(_0xf8d745){if(_0xf8d745){return _0xf8d745[_0x64ac('0x26')]()[_0x64ac('0x27')](function(){_0x16b44a[_0x64ac('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ea8c,_0x19f4c9){return function(_0x122b88){if(!_0x122b88){_0x26ea8c[_0x64ac('0x1b')](0x194);}return _0x122b88;};}function handleError(_0x3142fb,_0x23310b){_0x23310b=_0x23310b||0x1f4;return function(_0x1960d5){logger[_0x64ac('0x28')](_0x1960d5[_0x64ac('0x29')]);if(_0x1960d5[_0x64ac('0x2a')]){delete _0x1960d5[_0x64ac('0x2a')];}_0x3142fb[_0x64ac('0x1d')](_0x23310b)[_0x64ac('0x2b')](_0x1960d5);};}exports[_0x64ac('0x2c')]=function(_0xfd0f7b,_0x55a5cd){var _0x36de58={},_0x1970be={},_0x329b37={'count':0x0,'rows':[]};var _0x513174=_[_0x64ac('0x2d')](db[_0x64ac('0x2e')][_0x64ac('0x2f')],function(_0x56c245){return{'name':_0x56c245[_0x64ac('0x30')],'type':_0x56c245[_0x64ac('0x31')]['key']};});_0x1970be[_0x64ac('0x32')]=_[_0x64ac('0x2d')](_0x513174,_0x64ac('0x2a'));_0x1970be['query']=_[_0x64ac('0x33')](_0xfd0f7b[_0x64ac('0x34')]);_0x1970be['filters']=_['intersection'](_0x1970be[_0x64ac('0x32')],_0x1970be[_0x64ac('0x34')]);_0x36de58['attributes']=_[_0x64ac('0x35')](_0x1970be['model'],qs[_0x64ac('0x36')](_0xfd0f7b['query'][_0x64ac('0x36')]));_0x36de58[_0x64ac('0x37')]=_0x36de58['attributes'][_0x64ac('0x38')]?_0x36de58['attributes']:_0x1970be['model'];if(!_0xfd0f7b[_0x64ac('0x34')][_0x64ac('0x39')]('nolimit')){_0x36de58[_0x64ac('0x21')]=qs['limit'](_0xfd0f7b[_0x64ac('0x34')]['limit']);_0x36de58[_0x64ac('0x20')]=qs[_0x64ac('0x20')](_0xfd0f7b[_0x64ac('0x34')][_0x64ac('0x20')]);}_0x36de58['order']=qs['sort'](_0xfd0f7b[_0x64ac('0x34')][_0x64ac('0x3a')]);_0x36de58[_0x64ac('0x3b')]=qs['filters'](_[_0x64ac('0x3c')](_0xfd0f7b[_0x64ac('0x34')],_0x1970be[_0x64ac('0x3d')]),_0x513174);if(_0xfd0f7b[_0x64ac('0x34')]['filter']){_0x36de58[_0x64ac('0x3b')]=_['merge'](_0x36de58[_0x64ac('0x3b')],{'$or':_[_0x64ac('0x2d')](_0x513174,function(_0x5f101e){if(_0x5f101e[_0x64ac('0x31')]!==_0x64ac('0x3e')){var _0x50bcd3={};_0x50bcd3[_0x5f101e[_0x64ac('0x2a')]]={'$like':'%'+_0xfd0f7b['query'][_0x64ac('0x3f')]+'%'};return _0x50bcd3;}})});}_0x36de58=_[_0x64ac('0x40')]({},_0x36de58,_0xfd0f7b['options']);var _0x3269ab={'where':_0x36de58[_0x64ac('0x3b')]};return db['ChatInternalMessage'][_0x64ac('0x1f')](_0x3269ab)['then'](function(_0x26d41f){_0x329b37[_0x64ac('0x1f')]=_0x26d41f;if(_0xfd0f7b[_0x64ac('0x34')][_0x64ac('0x41')]){_0x36de58[_0x64ac('0x42')]=[{'all':!![]}];}return db[_0x64ac('0x2e')][_0x64ac('0x43')](_0x36de58);})[_0x64ac('0x27')](function(_0x19b8de){_0x329b37[_0x64ac('0x44')]=_0x19b8de;return _0x329b37;})[_0x64ac('0x27')](respondWithFilteredResult(_0x55a5cd,_0x36de58))[_0x64ac('0x45')](handleError(_0x55a5cd,null));};exports[_0x64ac('0x46')]=function(_0x6474cc,_0x240ef5){var _0x4c3b65={'raw':!![],'where':{'id':_0x6474cc[_0x64ac('0x47')]['id']}},_0x21dbd1={};_0x21dbd1['model']=_[_0x64ac('0x33')](db[_0x64ac('0x2e')][_0x64ac('0x2f')]);_0x21dbd1[_0x64ac('0x34')]=_[_0x64ac('0x33')](_0x6474cc[_0x64ac('0x34')]);_0x21dbd1['filters']=_[_0x64ac('0x35')](_0x21dbd1['model'],_0x21dbd1[_0x64ac('0x34')]);_0x4c3b65[_0x64ac('0x37')]=_[_0x64ac('0x35')](_0x21dbd1[_0x64ac('0x32')],qs[_0x64ac('0x36')](_0x6474cc[_0x64ac('0x34')][_0x64ac('0x36')]));_0x4c3b65['attributes']=_0x4c3b65['attributes'][_0x64ac('0x38')]?_0x4c3b65[_0x64ac('0x37')]:_0x21dbd1[_0x64ac('0x32')];if(_0x6474cc['query']['includeAll']){_0x4c3b65[_0x64ac('0x42')]=[{'all':!![]}];}_0x4c3b65=_[_0x64ac('0x40')]({},_0x4c3b65,_0x6474cc[_0x64ac('0x48')]);return db[_0x64ac('0x2e')][_0x64ac('0x49')](_0x4c3b65)[_0x64ac('0x27')](handleEntityNotFound(_0x240ef5,null))['then'](respondWithResult(_0x240ef5,null))[_0x64ac('0x45')](handleError(_0x240ef5,null));};exports[_0x64ac('0x4a')]=function(_0x446603,_0x205f69){return db['ChatInternalMessage'][_0x64ac('0x4a')](_0x446603[_0x64ac('0x4b')],{})[_0x64ac('0x27')](respondWithResult(_0x205f69,0xc9))[_0x64ac('0x45')](handleError(_0x205f69,null));};exports[_0x64ac('0x4c')]=function(_0xc754cb,_0x3b739d){if(_0xc754cb['body']['id']){delete _0xc754cb[_0x64ac('0x4b')]['id'];}return db[_0x64ac('0x2e')][_0x64ac('0x49')]({'where':{'id':_0xc754cb['params']['id']}})['then'](handleEntityNotFound(_0x3b739d,null))[_0x64ac('0x27')](saveUpdates(_0xc754cb['body'],null))[_0x64ac('0x27')](respondWithResult(_0x3b739d,null))[_0x64ac('0x45')](handleError(_0x3b739d,null));};exports[_0x64ac('0x26')]=function(_0x4d28b5,_0x41ace8){return db[_0x64ac('0x2e')][_0x64ac('0x49')]({'where':{'id':_0x4d28b5['params']['id']}})['then'](handleEntityNotFound(_0x41ace8,null))[_0x64ac('0x27')](removeEntity(_0x41ace8,null))[_0x64ac('0x45')](handleError(_0x41ace8,null));};exports[_0x64ac('0x4d')]=function(_0x35f520,_0x1c19b0){return db[_0x64ac('0x2e')][_0x64ac('0x4d')]()[_0x64ac('0x27')](respondWithResult(_0x1c19b0,null))['catch'](handleError(_0x1c19b0,null));};function wrapUser(_0x165b05){return function(_0x176ae6){var _0x3fffa7=_0x165b05[_0x64ac('0x4e')]({'plain':!![]});_0x3fffa7[_0x64ac('0x4f')]=[];if(_0x176ae6){_0x3fffa7[_0x64ac('0x50')]=_0x176ae6['createdAt'];_0x3fffa7[_0x64ac('0x51')]=_0x176ae6;}else{_0x3fffa7[_0x64ac('0x50')]=moment(0x0)[_0x64ac('0x52')](_0x64ac('0x53'));_0x3fffa7['lastMessage']={};}return _0x3fffa7;};}exports['getUsers']=function(_0x5382b2,_0x12e130,_0x3a11bb){var _0x1a5874=[];return db[_0x64ac('0x54')][_0x64ac('0x43')]({'where':{'role':[_0x64ac('0x55'),_0x64ac('0x56'),_0x64ac('0x57')]},'attributes':['id',_0x64ac('0x58'),'name',_0x64ac('0x59'),_0x64ac('0x5a'),_0x64ac('0x5b'),_0x64ac('0x5c'),_0x64ac('0x5d'),_0x64ac('0x5e'),_0x64ac('0x5f')],'order':qs['sort'](_0x64ac('0x60')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x64ac('0x2a'),_0x64ac('0x31')],'through':{'attributes':[]}}]})[_0x64ac('0x27')](function(_0x1a1292){if(_0x1a1292){var _0x42484e=_0x5382b2['user']['get']({'plain':!![]});if(!_0x42484e)throw new Error(_0x64ac('0x61'));if(_0x42484e[_0x64ac('0x59')]==='user'){return db[_0x64ac('0x62')][_0x64ac('0x49')]({'where':{'name':_0x64ac('0x63'),'userProfileId':_0x42484e[_0x64ac('0x64')]},'raw':!![]})[_0x64ac('0x27')](function(_0x3a26c8){if(_0x3a26c8){if(_0x3a26c8[_0x64ac('0x65')]===0x0){return db[_0x64ac('0x66')][_0x64ac('0x43')]({'where':{'sectionId':_0x3a26c8['id']},'raw':!![]})[_0x64ac('0x27')](function(_0xab037a){var _0x1722b7=[];if(_[_0x64ac('0x67')](_0xab037a)){_0x1722b7=_[_0x64ac('0x3f')](_0x1a1292,function(_0x4b7fb8){if(_0x4b7fb8[_0x64ac('0x59')]!==_0x64ac('0x55')){return _0x4b7fb8;}});return _0x1722b7;}else{for(var _0x5ee320=0x0;_0x5ee320<_0x1a1292[_0x64ac('0x38')];_0x5ee320++){var _0x48b930=_0x1a1292[_0x5ee320];if(_0x48b930[_0x64ac('0x59')]==='agent'){var _0x4f27b0=_[_0x64ac('0x49')](_0xab037a,function(_0x2ce816){return _0x2ce816[_0x64ac('0x68')]===_0x48b930['id'];});if(_0x4f27b0)_0x1722b7[_0x64ac('0x69')](_0x48b930);}else{_0x1722b7[_0x64ac('0x69')](_0x48b930);}}return _0x1722b7;}});}else{return _0x1a1292;}}else{var _0x1d5e0c=_[_0x64ac('0x3f')](_0x1a1292,function(_0xd00543){if(_0xd00543['role']!==_0x64ac('0x55')){return _0xd00543;}});return _0x1d5e0c;}});}else{return _0x1a1292;}}})[_0x64ac('0x27')](function(_0x1e7f21){var _0x22a7b0=[];if(_0x1e7f21){_0x1a5874=_0x1e7f21;for(var _0x3fda4f=0x0;_0x3fda4f<_0x1e7f21[_0x64ac('0x38')];_0x3fda4f+=0x1){_0x1a5874[_0x3fda4f][_0x64ac('0x4f')]=[];_0x22a7b0[_0x64ac('0x69')](db[_0x64ac('0x2e')][_0x64ac('0x49')]({'where':{'FromId':[_0x5382b2['user']['id'],_0x1e7f21[_0x3fda4f]['id']],'ToId':[_0x5382b2[_0x64ac('0x57')]['id'],_0x1e7f21[_0x3fda4f]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x64ac('0x6a'),_0x64ac('0x6b'),_0x64ac('0x4b')],'order':qs['sort'](_0x64ac('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x64ac('0x27')](wrapUser(_0x1e7f21[_0x3fda4f])));}return BPromise['all'](_0x22a7b0);}return[];})[_0x64ac('0x27')](function(_0x325408){return{'rows':_0x325408,'count':_0x325408[_0x64ac('0x38')]};})[_0x64ac('0x27')](respondWithResult(_0x12e130,null))[_0x64ac('0x45')](handleError(_0x12e130,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d834abe..010d2fc 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 _0x4536=['../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x12cd49,_0x47e5e8){var _0x228709=function(_0x43c5d2){while(--_0x43c5d2){_0x12cd49['push'](_0x12cd49['shift']());}};_0x228709(++_0x47e5e8);}(_0x4536,0xe9));var _0x6453=function(_0x273966,_0x455b20){_0x273966=_0x273966-0x0;var _0xe76b9d=_0x4536[_0x273966];return _0xe76b9d;};'use strict';var EventEmitter=require(_0x6453('0x0'));var ChatInternalMessage=require(_0x6453('0x1'))['db'][_0x6453('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6453('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6453('0x4'),'afterDestroy':_0x6453('0x5')};function emitEvent(_0x4ac415){return function(_0x32462,_0x36d2f1,_0x3356ef){ChatInternalMessageEvents['emit'](_0x4ac415+':'+_0x32462['id'],_0x32462);ChatInternalMessageEvents[_0x6453('0x6')](_0x4ac415,_0x32462);_0x3356ef(null);};}for(var e in events){if(events[_0x6453('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6453('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x43f3=['hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','save','remove','emit'];(function(_0x58fc80,_0x511109){var _0x96d7e2=function(_0x3f00e7){while(--_0x3f00e7){_0x58fc80['push'](_0x58fc80['shift']());}};_0x96d7e2(++_0x511109);}(_0x43f3,0xab));var _0x343f=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x43f3[_0xf2628e];return _0x13863a;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x343f('0x0'))['db'][_0x343f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x343f('0x2'),'afterUpdate':'update','afterDestroy':_0x343f('0x3')};function emitEvent(_0x48008f){return function(_0x3339a9,_0x24b4e8,_0x2f3439){ChatInternalMessageEvents['emit'](_0x48008f+':'+_0x3339a9['id'],_0x3339a9);ChatInternalMessageEvents[_0x343f('0x4')](_0x48008f,_0x3339a9);_0x2f3439(null);};}for(var e in events){if(events[_0x343f('0x5')](e)){var event=events[e];ChatInternalMessage[_0x343f('0x6')](e,emitEvent(event));}}module[_0x343f('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f618937..07c70fe 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 _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xd8b0=['define','chat_internal_messages','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d98ab,_0x17fbf9){var _0x444948=function(_0x2206de){while(--_0x2206de){_0x1d98ab['push'](_0x1d98ab['shift']());}};_0x444948(++_0x17fbf9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index d5602a8..a557ba0 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 _0xa77c=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa1e2cc,_0x419ad2){var _0x46cab5=function(_0x5a11f8){while(--_0x5a11f8){_0xa1e2cc['push'](_0xa1e2cc['shift']());}};_0x46cab5(++_0x419ad2);}(_0xa77c,0x1f4));var _0xca77=function(_0x8f5cad,_0x2b832f){_0x8f5cad=_0x8f5cad-0x0;var _0x48510c=_0xa77c[_0x8f5cad];return _0x48510c;};'use strict';var _=require(_0xca77('0x0'));var util=require(_0xca77('0x1'));var moment=require(_0xca77('0x2'));var BPromise=require('bluebird');var rs=require(_0xca77('0x3'));var fs=require('fs');var Redis=require(_0xca77('0x4'));var db=require(_0xca77('0x5'))['db'];var utils=require(_0xca77('0x6'));var logger=require(_0xca77('0x7'))(_0xca77('0x8'));var config=require(_0xca77('0x9'));var jayson=require(_0xca77('0xa'));var client=jayson[_0xca77('0xb')]['http']({'port':0x232a});config['redis']=_[_0xca77('0xc')](config[_0xca77('0xd')],{'host':_0xca77('0xe'),'port':0x18eb});var socket=require(_0xca77('0xf'))(new Redis(config[_0xca77('0xd')]));require(_0xca77('0x10'))[_0xca77('0x11')](socket);function respondWithRpcPromise(_0x39c379,_0x12a37c,_0x1bfc12){return new BPromise(function(_0x4e40fe,_0x18d157){return client['request'](_0x39c379,_0x1bfc12)[_0xca77('0x12')](function(_0x5f4821){logger['info'](_0xca77('0x13'),_0x12a37c,_0xca77('0x14'));logger[_0xca77('0x15')](_0xca77('0x16'),_0x12a37c,_0xca77('0x14'),JSON[_0xca77('0x17')](_0x5f4821));if(_0x5f4821[_0xca77('0x18')]){if(_0x5f4821[_0xca77('0x18')][_0xca77('0x19')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x12a37c,_0x5f4821['error'][_0xca77('0x1a')]);return _0x18d157(_0x5f4821['error'][_0xca77('0x1a')]);}logger[_0xca77('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x12a37c,_0x5f4821[_0xca77('0x18')]['message']);return _0x4e40fe(_0x5f4821[_0xca77('0x18')][_0xca77('0x1a')]);}else{logger[_0xca77('0x1b')](_0xca77('0x13'),_0x12a37c,_0xca77('0x14'));_0x4e40fe(_0x5f4821[_0xca77('0x1c')]['message']);}})['catch'](function(_0x55b582){logger[_0xca77('0x18')](_0xca77('0x13'),_0x12a37c,_0x55b582);_0x18d157(_0x55b582);});});} \ No newline at end of file +var _0xe800=['info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then'];(function(_0x125dea,_0xb160c1){var _0x3f612a=function(_0x307677){while(--_0x307677){_0x125dea['push'](_0x125dea['shift']());}};_0x3f612a(++_0xb160c1);}(_0xe800,0xb1));var _0x0e80=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe800[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x0e80('0x0'));var util=require('util');var moment=require(_0x0e80('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e80('0x2'));var fs=require('fs');var Redis=require(_0x0e80('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e80('0x4'));var logger=require('../../config/logger')(_0x0e80('0x5'));var config=require(_0x0e80('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0e80('0x7')]['http']({'port':0x232a});config[_0x0e80('0x8')]=_[_0x0e80('0x9')](config[_0x0e80('0x8')],{'host':_0x0e80('0xa'),'port':0x18eb});var socket=require(_0x0e80('0xb'))(new Redis(config[_0x0e80('0x8')]));require(_0x0e80('0xc'))[_0x0e80('0xd')](socket);function respondWithRpcPromise(_0x56e4fc,_0x18128e,_0x57512e){return new BPromise(function(_0x579081,_0x4e55e6){return client['request'](_0x56e4fc,_0x57512e)[_0x0e80('0xe')](function(_0x2f5978){logger[_0x0e80('0xf')](_0x0e80('0x10'),_0x18128e,'request\x20sent');logger['debug'](_0x0e80('0x11'),_0x18128e,'request\x20sent',JSON[_0x0e80('0x12')](_0x2f5978));if(_0x2f5978[_0x0e80('0x13')]){if(_0x2f5978[_0x0e80('0x13')][_0x0e80('0x14')]===0x1f4){logger['error'](_0x0e80('0x10'),_0x18128e,_0x2f5978[_0x0e80('0x13')][_0x0e80('0x15')]);return _0x4e55e6(_0x2f5978[_0x0e80('0x13')]['message']);}logger[_0x0e80('0x13')](_0x0e80('0x10'),_0x18128e,_0x2f5978[_0x0e80('0x13')]['message']);return _0x579081(_0x2f5978['error'][_0x0e80('0x15')]);}else{logger[_0x0e80('0xf')](_0x0e80('0x10'),_0x18128e,_0x0e80('0x16'));_0x579081(_0x2f5978['result'][_0x0e80('0x15')]);}})[_0x0e80('0x17')](function(_0x396322){logger[_0x0e80('0x13')](_0x0e80('0x10'),_0x18128e,_0x396322);_0x4e55e6(_0x396322);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f94b812..37c40fb 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 _0x9ade=['save','emit','removeListener','register','length','./chatInternalMessage.events'];(function(_0xb61804,_0x2f947f){var _0x383caa=function(_0x341a94){while(--_0x341a94){_0xb61804['push'](_0xb61804['shift']());}};_0x383caa(++_0x2f947f);}(_0x9ade,0x107));var _0xe9ad=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x9ade[_0x3bb5b4];return _0x586c60;};'use strict';var ChatInternalMessageEvents=require(_0xe9ad('0x0'));var events=[_0xe9ad('0x1'),'remove','update'];function createListener(_0x1984bd,_0x55d83d){return function(_0xeb076b){_0x55d83d[_0xe9ad('0x2')](_0x1984bd,_0xeb076b);};}function removeListener(_0x4d4ee0,_0x52984f){return function(){ChatInternalMessageEvents[_0xe9ad('0x3')](_0x4d4ee0,_0x52984f);};}exports[_0xe9ad('0x4')]=function(_0xdd1549){for(var _0x3e4092=0x0,_0x308564=events[_0xe9ad('0x5')];_0x3e4092<_0x308564;_0x3e4092++){var _0xb4b663=events[_0x3e4092];var _0x1a297b=createListener('chatInternalMessage:'+_0xb4b663,_0xdd1549);ChatInternalMessageEvents['on'](_0xb4b663,_0x1a297b);}}; \ No newline at end of file +var _0xda55=['chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener','length'];(function(_0x484c3c,_0x545ec9){var _0x3c3d8e=function(_0x3cd83b){while(--_0x3cd83b){_0x484c3c['push'](_0x484c3c['shift']());}};_0x3c3d8e(++_0x545ec9);}(_0xda55,0x6d));var _0x5da5=function(_0x29cdcf,_0x421f53){_0x29cdcf=_0x29cdcf-0x0;var _0x1f1c92=_0xda55[_0x29cdcf];return _0x1f1c92;};'use strict';var ChatInternalMessageEvents=require(_0x5da5('0x0'));var events=[_0x5da5('0x1'),'remove','update'];function createListener(_0x13ecbc,_0x240a49){return function(_0x26a443){_0x240a49[_0x5da5('0x2')](_0x13ecbc,_0x26a443);};}function removeListener(_0x1c3afd,_0x5da254){return function(){ChatInternalMessageEvents[_0x5da5('0x3')](_0x1c3afd,_0x5da254);};}exports['register']=function(_0x356a37){for(var _0x58e7b3=0x0,_0x2fd877=events[_0x5da5('0x4')];_0x58e7b3<_0x2fd877;_0x58e7b3++){var _0x71b187=events[_0x58e7b3];var _0x46290d=createListener(_0x5da5('0x5')+_0x71b187,_0x356a37);ChatInternalMessageEvents['on'](_0x71b187,_0x46290d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 300e328..03d56cc 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 _0x07a2=['getUsers','/:id','show','post','create','put','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/users'];(function(_0x902521,_0x3f3f10){var _0x7ef857=function(_0x446e00){while(--_0x446e00){_0x902521['push'](_0x902521['shift']());}};_0x7ef857(++_0x3f3f10);}(_0x07a2,0x1ea));var _0x207a=function(_0x4bdd56,_0x219c46){_0x4bdd56=_0x4bdd56-0x0;var _0x5c1151=_0x07a2[_0x4bdd56];return _0x5c1151;};'use strict';var multer=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var path=require(_0x207a('0x2'));var timeout=require('connect-timeout');var express=require(_0x207a('0x3'));var router=express['Router']();var fs_extra=require(_0x207a('0x4'));var auth=require(_0x207a('0x5'));var interaction=require(_0x207a('0x6'));var config=require(_0x207a('0x7'));var controller=require('./chatInternalMessage.controller');router[_0x207a('0x8')]('/',auth[_0x207a('0x9')](),controller[_0x207a('0xa')]);router[_0x207a('0x8')](_0x207a('0xb'),auth[_0x207a('0x9')](),controller[_0x207a('0xc')]);router[_0x207a('0x8')](_0x207a('0xd'),auth[_0x207a('0x9')](),controller[_0x207a('0xe')]);router[_0x207a('0x8')](_0x207a('0xf'),auth[_0x207a('0x9')](),controller[_0x207a('0x10')]);router[_0x207a('0x11')]('/',auth[_0x207a('0x9')](),controller[_0x207a('0x12')]);router[_0x207a('0x13')](_0x207a('0xf'),controller[_0x207a('0x14')]);router['delete'](_0x207a('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x383c=['../../config/environment','get','index','isAuthenticated','describe','/users','getUsers','/:id','show','post','put','update','delete','destroy','path','express','fs-extra','../../components/auth/service'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x383c,0x164));var _0xc383=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x383c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc383('0x0'));var timeout=require('connect-timeout');var express=require(_0xc383('0x1'));var router=express['Router']();var fs_extra=require(_0xc383('0x2'));var auth=require(_0xc383('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc383('0x4'));var controller=require('./chatInternalMessage.controller');router[_0xc383('0x5')]('/',auth['isAuthenticated'](),controller[_0xc383('0x6')]);router[_0xc383('0x5')]('/describe',auth[_0xc383('0x7')](),controller[_0xc383('0x8')]);router['get'](_0xc383('0x9'),auth[_0xc383('0x7')](),controller[_0xc383('0xa')]);router['get'](_0xc383('0xb'),auth[_0xc383('0x7')](),controller[_0xc383('0xc')]);router[_0xc383('0xd')]('/',auth[_0xc383('0x7')](),controller['create']);router[_0xc383('0xe')](_0xc383('0xb'),controller[_0xc383('0xf')]);router[_0xc383('0x10')](_0xc383('0xb'),auth[_0xc383('0x7')](),controller[_0xc383('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 195c141..d8c7b3c 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 _0xa98d=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x584182,_0x3c4223){var _0x25989f=function(_0x5eb2ea){while(--_0x5eb2ea){_0x584182['push'](_0x584182['shift']());}};_0x25989f(++_0x3c4223);}(_0xa98d,0x136));var _0xda98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa98d[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xda98('0x0'));module[_0xda98('0x1')]={'body':{'type':Sequelize[_0xda98('0x2')](_0xda98('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xda98('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xda98('0x5')]('in','out'),'defaultValue':_0xda98('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xda98('0x7')]},'providerName':{'type':Sequelize[_0xda98('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa91f=['medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x588047,_0xdc062d){var _0x4e5ee5=function(_0x38c713){while(--_0x38c713){_0x588047['push'](_0x588047['shift']());}};_0x4e5ee5(++_0xdc062d);}(_0xa91f,0x187));var _0xfa91=function(_0x1b6c6e,_0x3af27f){_0x1b6c6e=_0x1b6c6e-0x0;var _0x282e84=_0xa91f[_0x1b6c6e];return _0x282e84;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xfa91('0x0')](_0xfa91('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfa91('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfa91('0x3')]('in',_0xfa91('0x4')),'defaultValue':_0xfa91('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfa91('0x5')]},'providerName':{'type':Sequelize[_0xfa91('0x6')]},'providerResponse':{'type':Sequelize[_0xfa91('0x0')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 333f0a1..dd21139 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 _0x66c7=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','index','ChatMessage','type','key','map','keys','model','attributes','intersection','fields','query','length','order','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','show','params','rawAttributes','find','create','body','describe','chat-interactions','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','format','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','parse','interaction','null','RejectMessage','rejectMessage','event','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x2dc700,_0x4b9935){var _0x337023=function(_0x5787e2){while(--_0x5787e2){_0x2dc700['push'](_0x2dc700['shift']());}};_0x337023(++_0x4b9935);}(_0x66c7,0x15c));var _0x766c=function(_0x495d48,_0x52939a){_0x495d48=_0x495d48-0x0;var _0xa49f40=_0x66c7[_0x495d48];return _0xa49f40;};'use strict';var pdf=require(_0x766c('0x0'));var emlformat=require(_0x766c('0x1'));var rimraf=require(_0x766c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x766c('0x3'));var rp=require(_0x766c('0x4'));var moment=require(_0x766c('0x5'));var BPromise=require(_0x766c('0x6'));var Mustache=require(_0x766c('0x7'));var util=require(_0x766c('0x8'));var path=require('path');var sox=require(_0x766c('0x9'));var csv=require(_0x766c('0xa'));var ejs=require(_0x766c('0xb'));var fs=require('fs');var fs_extra=require(_0x766c('0xc'));var _=require(_0x766c('0xd'));var squel=require(_0x766c('0xe'));var crypto=require(_0x766c('0xf'));var jsforce=require(_0x766c('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x766c('0x11'));var Papa=require(_0x766c('0x12'));var Redis=require(_0x766c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x766c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x766c('0x15'));var logger=require(_0x766c('0x16'))(_0x766c('0x17'));var utils=require(_0x766c('0x18'));var config=require(_0x766c('0x19'));var licenseUtil=require(_0x766c('0x1a'));var db=require(_0x766c('0x1b'))['db'];config[_0x766c('0x1c')]=_[_0x766c('0x1d')](config[_0x766c('0x1c')],{'host':_0x766c('0x1e'),'port':0x18eb});var socket=require(_0x766c('0x1f'))(new Redis(config[_0x766c('0x1c')]));require(_0x766c('0x20'))[_0x766c('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x766c('0x22')][_0x766c('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xfadbc1,_0x1150da,_0xe9d7ef,_0x357602){return new BPromise(function(_0x4f6c82,_0x529811){var _0x21dbb7=_0x357602||client;return _0x21dbb7[_0x766c('0x24')](_0xfadbc1,_0xe9d7ef)[_0x766c('0x25')](function(_0x47c887){logger[_0x766c('0x26')](_0x766c('0x27'),_0x1150da,_0x766c('0x28'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1150da,'request\x20sent',JSON[_0x766c('0x29')](_0x47c887));if(_0x47c887['error']){if(_0x47c887[_0x766c('0x2a')][_0x766c('0x2b')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1150da,_0x47c887[_0x766c('0x2a')][_0x766c('0x2c')]);return _0x529811(_0x47c887[_0x766c('0x2a')]['message']);}logger[_0x766c('0x2a')](_0x766c('0x27'),_0x1150da,_0x47c887['error']['message']);return _0x4f6c82(_0x47c887['error'][_0x766c('0x2c')]);}else{logger['info'](_0x766c('0x27'),_0x1150da,_0x766c('0x28'));_0x4f6c82(_0x47c887[_0x766c('0x2d')]['message']);}})[_0x766c('0x2e')](function(_0x444310){logger[_0x766c('0x2a')](_0x766c('0x27'),_0x1150da,_0x444310);_0x529811(_0x444310);});});}function respondWithStatusCode(_0x3db6b4,_0x8ce86b){_0x8ce86b=_0x8ce86b||0xcc;return function(_0x5ad1d6){if(_0x5ad1d6){return _0x3db6b4[_0x766c('0x2f')](_0x8ce86b);}return _0x3db6b4[_0x766c('0x30')](_0x8ce86b)[_0x766c('0x31')]();};}function respondWithResult(_0x3a6757,_0x1631af){_0x1631af=_0x1631af||0xc8;return function(_0x539341){if(_0x539341){return _0x3a6757['status'](_0x1631af)[_0x766c('0x32')](_0x539341);}};}function respondWithFilteredResult(_0x19b6e8,_0x1d5288){return function(_0x549dde){if(_0x549dde){var _0x9f13ba=_0x549dde['count'],_0x463302=_0x1d5288['offset'],_0x47e6ac=_0x1d5288[_0x766c('0x33')]+_0x1d5288[_0x766c('0x34')],_0x23b8a1;if(_0x47e6ac>=_0x9f13ba){_0x47e6ac=_0x9f13ba;_0x23b8a1=0xc8;}else{_0x23b8a1=0xce;}_0x19b6e8[_0x766c('0x30')](_0x23b8a1);return _0x19b6e8['set'](_0x766c('0x35'),_0x463302+'-'+_0x47e6ac+'/'+_0x9f13ba)[_0x766c('0x32')](_0x549dde);}return null;};}function patchUpdates(_0x6fd6e1){return function(_0x25b731){try{jsonpatch[_0x766c('0x36')](_0x25b731,_0x6fd6e1,!![]);}catch(_0x56589e){return BPromise['reject'](_0x56589e);}return _0x25b731[_0x766c('0x37')]();};}function saveUpdates(_0x41b2b9,_0x370698){return function(_0x13b96a){if(_0x13b96a){return _0x13b96a[_0x766c('0x38')](_0x41b2b9)['then'](function(_0x452db1){return _0x452db1;});}return null;};}function removeEntity(_0x40c43a,_0x16c607){return function(_0x570f97){if(_0x570f97){return _0x570f97[_0x766c('0x39')]()['then'](function(){_0x40c43a['status'](0xcc)[_0x766c('0x31')]();});}};}function handleEntityNotFound(_0x4e5eec,_0x26bd0b){return function(_0x182a81){if(!_0x182a81){_0x4e5eec[_0x766c('0x2f')](0x194);}return _0x182a81;};}function handleError(_0x16b1af,_0x50291b){_0x50291b=_0x50291b||0x1f4;return function(_0x59e223){logger[_0x766c('0x2a')](_0x59e223[_0x766c('0x3a')]);if(_0x59e223[_0x766c('0x3b')]){delete _0x59e223[_0x766c('0x3b')];}_0x16b1af[_0x766c('0x30')](_0x50291b)[_0x766c('0x3c')](_0x59e223);};}exports[_0x766c('0x3d')]=function(_0x2f11f9,_0x19e984){var _0xa1c774={},_0x2cdc40={},_0x18deb3={'count':0x0,'rows':[]};var _0x18b9b0=_['map'](db[_0x766c('0x3e')]['rawAttributes'],function(_0x3f9d10){return{'name':_0x3f9d10['fieldName'],'type':_0x3f9d10[_0x766c('0x3f')][_0x766c('0x40')]};});_0x2cdc40['model']=_[_0x766c('0x41')](_0x18b9b0,_0x766c('0x3b'));_0x2cdc40['query']=_[_0x766c('0x42')](_0x2f11f9['query']);_0x2cdc40['filters']=_['intersection'](_0x2cdc40[_0x766c('0x43')],_0x2cdc40['query']);_0xa1c774[_0x766c('0x44')]=_[_0x766c('0x45')](_0x2cdc40[_0x766c('0x43')],qs[_0x766c('0x46')](_0x2f11f9[_0x766c('0x47')][_0x766c('0x46')]));_0xa1c774[_0x766c('0x44')]=_0xa1c774[_0x766c('0x44')][_0x766c('0x48')]?_0xa1c774['attributes']:_0x2cdc40[_0x766c('0x43')];if(!_0x2f11f9[_0x766c('0x47')]['hasOwnProperty']('nolimit')){_0xa1c774['limit']=qs[_0x766c('0x34')](_0x2f11f9[_0x766c('0x47')]['limit']);_0xa1c774[_0x766c('0x33')]=qs[_0x766c('0x33')](_0x2f11f9['query'][_0x766c('0x33')]);}_0xa1c774[_0x766c('0x49')]=qs['sort'](_0x2f11f9[_0x766c('0x47')]['sort']);_0xa1c774[_0x766c('0x4a')]=qs[_0x766c('0x4b')](_[_0x766c('0x4c')](_0x2f11f9[_0x766c('0x47')],_0x2cdc40[_0x766c('0x4b')]),_0x18b9b0);if(_0x2f11f9['query'][_0x766c('0x4d')]){_0xa1c774[_0x766c('0x4a')]=_['merge'](_0xa1c774[_0x766c('0x4a')],{'$or':_[_0x766c('0x41')](_0x18b9b0,function(_0x53dafb){if(_0x53dafb['type']!==_0x766c('0x4e')){var _0x24c91e={};_0x24c91e[_0x53dafb[_0x766c('0x3b')]]={'$like':'%'+_0x2f11f9['query'][_0x766c('0x4d')]+'%'};return _0x24c91e;}})});}_0xa1c774=_[_0x766c('0x4f')]({},_0xa1c774,_0x2f11f9[_0x766c('0x50')]);var _0x539aa9={'where':_0xa1c774[_0x766c('0x4a')]};return db[_0x766c('0x3e')]['count'](_0x539aa9)[_0x766c('0x25')](function(_0x29b103){_0x18deb3[_0x766c('0x51')]=_0x29b103;if(_0x2f11f9['query'][_0x766c('0x52')]){_0xa1c774['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xa1c774);})[_0x766c('0x25')](function(_0xd44586){_0x18deb3['rows']=_0xd44586;return _0x18deb3;})[_0x766c('0x25')](respondWithFilteredResult(_0x19e984,_0xa1c774))[_0x766c('0x2e')](handleError(_0x19e984,null));};exports[_0x766c('0x53')]=function(_0x5f4d5b,_0x373bd9){var _0x50ca0d={'raw':!![],'where':{'id':_0x5f4d5b[_0x766c('0x54')]['id']}},_0x171575={};_0x171575[_0x766c('0x43')]=_[_0x766c('0x42')](db[_0x766c('0x3e')][_0x766c('0x55')]);_0x171575[_0x766c('0x47')]=_[_0x766c('0x42')](_0x5f4d5b[_0x766c('0x47')]);_0x171575['filters']=_[_0x766c('0x45')](_0x171575[_0x766c('0x43')],_0x171575[_0x766c('0x47')]);_0x50ca0d[_0x766c('0x44')]=_[_0x766c('0x45')](_0x171575['model'],qs['fields'](_0x5f4d5b[_0x766c('0x47')]['fields']));_0x50ca0d[_0x766c('0x44')]=_0x50ca0d[_0x766c('0x44')]['length']?_0x50ca0d[_0x766c('0x44')]:_0x171575[_0x766c('0x43')];if(_0x5f4d5b[_0x766c('0x47')][_0x766c('0x52')]){_0x50ca0d['include']=[{'all':!![]}];}_0x50ca0d=_[_0x766c('0x4f')]({},_0x50ca0d,_0x5f4d5b[_0x766c('0x50')]);return db[_0x766c('0x3e')][_0x766c('0x56')](_0x50ca0d)[_0x766c('0x25')](handleEntityNotFound(_0x373bd9,null))[_0x766c('0x25')](respondWithResult(_0x373bd9,null))[_0x766c('0x2e')](handleError(_0x373bd9,null));};exports[_0x766c('0x57')]=function(_0x2eed6c,_0x33a75b){return db[_0x766c('0x3e')]['create'](_0x2eed6c[_0x766c('0x58')],{})[_0x766c('0x25')](respondWithResult(_0x33a75b,0xc9))[_0x766c('0x2e')](handleError(_0x33a75b,null));};exports['update']=function(_0x4d0781,_0xb38efc){if(_0x4d0781[_0x766c('0x58')]['id']){delete _0x4d0781['body']['id'];}return db[_0x766c('0x3e')][_0x766c('0x56')]({'where':{'id':_0x4d0781[_0x766c('0x54')]['id']}})[_0x766c('0x25')](handleEntityNotFound(_0xb38efc,null))[_0x766c('0x25')](saveUpdates(_0x4d0781[_0x766c('0x58')],null))[_0x766c('0x25')](respondWithResult(_0xb38efc,null))['catch'](handleError(_0xb38efc,null));};exports[_0x766c('0x39')]=function(_0x3de2d2,_0x2f7046){return db['ChatMessage'][_0x766c('0x56')]({'where':{'id':_0x3de2d2[_0x766c('0x54')]['id']}})[_0x766c('0x25')](handleEntityNotFound(_0x2f7046,null))[_0x766c('0x25')](removeEntity(_0x2f7046,null))['catch'](handleError(_0x2f7046,null));};exports[_0x766c('0x59')]=function(_0x1d291c,_0x9c5585){return db[_0x766c('0x3e')][_0x766c('0x59')]()['then'](respondWithResult(_0x9c5585,null))[_0x766c('0x2e')](handleError(_0x9c5585,null));};var interaction_log=require(_0x766c('0x16'))(_0x766c('0x5a'));exports['accept']=function(_0xd89b3e,_0x1e70d1,_0x2ac9cb){var _0x2ba6f7={'agent':{},'channel':_0x766c('0x5b')};if(_0xd89b3e[_0x766c('0x58')]['id']){delete _0xd89b3e['body']['id'];}_0xd89b3e[_0x766c('0x58')][_0x766c('0x5c')]=!![];_0xd89b3e['body'][_0x766c('0x5d')]=moment()['format'](_0x766c('0x5e'));_0xd89b3e[_0x766c('0x58')][_0x766c('0x5f')]=_0xd89b3e['body'][_0x766c('0x5f')]||_0xd89b3e[_0x766c('0x60')]['id'];_0x2ba6f7[_0x766c('0x61')]['id']=_0xd89b3e[_0x766c('0x58')][_0x766c('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0xd89b3e['params']['id'],'UserId':null},'include':[{'model':db[_0x766c('0x62')],'as':_0x766c('0x63')}]})[_0x766c('0x25')](handleEntityNotFound(_0x1e70d1,null))[_0x766c('0x25')](saveUpdates(_0xd89b3e[_0x766c('0x58')],null))[_0x766c('0x25')](function(_0x4cb0bd){if(_0x4cb0bd){_0x2ba6f7['message']=_0x4cb0bd[_0x766c('0x64')]({'plain':!![]});return db[_0x766c('0x65')]['find']({'where':{'id':_0x4cb0bd[_0x766c('0x66')]}});}return null;})[_0x766c('0x25')](handleEntityNotFound(_0x1e70d1,null))['then'](function(_0x5410e7){if(_0x5410e7){return _0x5410e7[_0x766c('0x38')]({'UserId':_0xd89b3e[_0x766c('0x58')][_0x766c('0x5f')],'read1stAt':_[_0x766c('0x67')](_0x5410e7['read1stAt'])?moment()[_0x766c('0x68')](_0x766c('0x5e')):undefined});}return null;})[_0x766c('0x25')](function(_0x3a2323){if(_0x3a2323){_0x2ba6f7['interaction']=_0x3a2323['get']({'plain':!![]});interaction_log[_0x766c('0x26')](_0x766c('0x69'),_0xd89b3e['user']['id'],_0xd89b3e[_0x766c('0x60')]['name'],_0xd89b3e[_0x766c('0x60')][_0x766c('0x6a')],_0x2ba6f7['interaction']['id'],_0xd89b3e[_0x766c('0x58')]?JSON[_0x766c('0x29')](_0xd89b3e[_0x766c('0x58')]):'null');return respondWithRpcPromise(_0x766c('0x6b'),'acceptMessage',_0x2ba6f7);}return null;})[_0x766c('0x25')](function(_0x33c075){if(_0x33c075){if(_0xd89b3e[_0x766c('0x58')][_0x766c('0x6c')]){_0x2ba6f7['message'][_0x766c('0x6d')]=util[_0x766c('0x68')](_0x766c('0x6e'),_0xd89b3e['user'][_0x766c('0x3b')]);_0x2ba6f7[_0x766c('0x2c')][_0x766c('0x6f')]=_0x2ba6f7['channel'];_0x2ba6f7['message']['event']=_0x766c('0x70');return respondWithRpcPromise(_0x766c('0x71'),_0x766c('0x71'),{'event':_0x766c('0x72'),'message':_[_0x766c('0x4f')](_0x2ba6f7['message'],JSON[_0x766c('0x73')](_0x2ba6f7[_0x766c('0x74')]['formData']))},client9002)[_0x766c('0x25')](function(){return _0x2ba6f7;});}return _0x2ba6f7;}return null;})[_0x766c('0x25')](respondWithResult(_0x1e70d1,null))[_0x766c('0x2e')](handleError(_0x1e70d1,null));};var interaction_log=require(_0x766c('0x16'))(_0x766c('0x5a'));exports['reject']=function(_0x486e38,_0x5a5f8d,_0x526c7c){var _0x4f975b={'agent':{},'channel':'chat'};if(_0x486e38[_0x766c('0x58')]['id']){delete _0x486e38[_0x766c('0x58')]['id'];}_0x486e38[_0x766c('0x58')]['UserId']=_0x486e38[_0x766c('0x58')][_0x766c('0x5f')]||_0x486e38[_0x766c('0x60')]['id'];_0x4f975b[_0x766c('0x61')]['id']=_0x486e38[_0x766c('0x58')]['UserId'];return db[_0x766c('0x3e')][_0x766c('0x56')]({'where':{'id':_0x486e38[_0x766c('0x54')]['id'],'UserId':null}})[_0x766c('0x25')](handleEntityNotFound(_0x5a5f8d,null))[_0x766c('0x25')](function(_0x4c7f94){if(_0x4c7f94){_0x4f975b[_0x766c('0x2c')]=_0x4c7f94['get']({'plain':!![]});return db[_0x766c('0x65')][_0x766c('0x56')]({'where':{'id':_0x4c7f94[_0x766c('0x66')]}});}return null;})[_0x766c('0x25')](handleEntityNotFound(_0x5a5f8d,null))[_0x766c('0x25')](function(_0x5373ff){if(_0x5373ff){_0x4f975b[_0x766c('0x74')]=_0x5373ff['get']({'plain':!![]});interaction_log[_0x766c('0x26')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x486e38[_0x766c('0x60')]['id'],_0x486e38['user'][_0x766c('0x3b')],_0x486e38[_0x766c('0x60')][_0x766c('0x6a')],_0x4f975b[_0x766c('0x74')]['id'],_0x486e38[_0x766c('0x58')]?JSON[_0x766c('0x29')](_0x486e38['body']):_0x766c('0x75'));return respondWithRpcPromise(_0x766c('0x76'),_0x766c('0x77'),_0x4f975b);}return null;})[_0x766c('0x25')](function(_0x316d99){if(_0x316d99){_0x316d99[_0x766c('0x2c')][_0x766c('0x6d')]=util[_0x766c('0x68')](_0x766c('0x6e'),_0x486e38['user'][_0x766c('0x3b')]);_0x316d99[_0x766c('0x2c')]['channel']=_0x4f975b[_0x766c('0x6f')];_0x316d99[_0x766c('0x2c')][_0x766c('0x78')]='reject';respondWithRpcPromise(_0x766c('0x71'),'EventManager',{'event':_0x766c('0x79'),'message':_0x316d99['message']},client9002);return _0x4f975b;}return null;})[_0x766c('0x25')](respondWithResult(_0x5a5f8d,null))[_0x766c('0x2e')](handleError(_0x5a5f8d,null));}; \ No newline at end of file +var _0x943b=['status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','intersection','includeAll','options','find','create','body','describe','chat-interactions','accept','chat','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','interface','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus'];(function(_0x518153,_0x1c23c3){var _0x5b547c=function(_0x2a56a8){while(--_0x2a56a8){_0x518153['push'](_0x518153['shift']());}};_0x5b547c(++_0x1c23c3);}(_0x943b,0x146));var _0xb943=function(_0xc6fb8f,_0x97c441){_0xc6fb8f=_0xc6fb8f-0x0;var _0x4e2bcd=_0x943b[_0xc6fb8f];return _0x4e2bcd;};'use strict';var pdf=require(_0xb943('0x0'));var emlformat=require(_0xb943('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb943('0x2'));var jsonpatch=require(_0xb943('0x3'));var rp=require(_0xb943('0x4'));var moment=require('moment');var BPromise=require(_0xb943('0x5'));var Mustache=require(_0xb943('0x6'));var util=require('util');var path=require(_0xb943('0x7'));var sox=require(_0xb943('0x8'));var csv=require(_0xb943('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb943('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb943('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb943('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb943('0xd'));var Redis=require(_0xb943('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb943('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb943('0x10'))(_0xb943('0x11'));var utils=require('../../config/utils');var config=require(_0xb943('0x12'));var licenseUtil=require(_0xb943('0x13'));var db=require(_0xb943('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb943('0x15'),'port':0x18eb});var socket=require(_0xb943('0x16'))(new Redis(config[_0xb943('0x17')]));require(_0xb943('0x18'))[_0xb943('0x19')](socket);var jayson=require(_0xb943('0x1a'));var client=jayson[_0xb943('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xb943('0x1b')][_0xb943('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x441b57,_0x36706a,_0x528611,_0x43342c){return new BPromise(function(_0x2ac2f6,_0x56d478){var _0x5877f8=_0x43342c||client;return _0x5877f8[_0xb943('0x1d')](_0x441b57,_0x528611)[_0xb943('0x1e')](function(_0x4b06a3){logger[_0xb943('0x1f')](_0xb943('0x20'),_0x36706a,'request\x20sent');logger[_0xb943('0x21')](_0xb943('0x22'),_0x36706a,'request\x20sent',JSON[_0xb943('0x23')](_0x4b06a3));if(_0x4b06a3[_0xb943('0x24')]){if(_0x4b06a3[_0xb943('0x24')][_0xb943('0x25')]===0x1f4){logger['error'](_0xb943('0x20'),_0x36706a,_0x4b06a3['error'][_0xb943('0x26')]);return _0x56d478(_0x4b06a3[_0xb943('0x24')][_0xb943('0x26')]);}logger[_0xb943('0x24')]('ChatMessage,\x20%s,\x20%s',_0x36706a,_0x4b06a3[_0xb943('0x24')][_0xb943('0x26')]);return _0x2ac2f6(_0x4b06a3[_0xb943('0x24')]['message']);}else{logger[_0xb943('0x1f')](_0xb943('0x20'),_0x36706a,_0xb943('0x27'));_0x2ac2f6(_0x4b06a3[_0xb943('0x28')][_0xb943('0x26')]);}})[_0xb943('0x29')](function(_0x194f6f){logger[_0xb943('0x24')](_0xb943('0x20'),_0x36706a,_0x194f6f);_0x56d478(_0x194f6f);});});}function respondWithStatusCode(_0x50e065,_0x51ca15){_0x51ca15=_0x51ca15||0xcc;return function(_0x49406e){if(_0x49406e){return _0x50e065[_0xb943('0x2a')](_0x51ca15);}return _0x50e065[_0xb943('0x2b')](_0x51ca15)[_0xb943('0x2c')]();};}function respondWithResult(_0x176d69,_0xd5be8a){_0xd5be8a=_0xd5be8a||0xc8;return function(_0x29287){if(_0x29287){return _0x176d69[_0xb943('0x2b')](_0xd5be8a)['json'](_0x29287);}};}function respondWithFilteredResult(_0x5369d9,_0x461715){return function(_0x3bf629){if(_0x3bf629){var _0x3b534f=_0x3bf629[_0xb943('0x2d')],_0x1c91ad=_0x461715['offset'],_0xc117ef=_0x461715[_0xb943('0x2e')]+_0x461715[_0xb943('0x2f')],_0x2ccaca;if(_0xc117ef>=_0x3b534f){_0xc117ef=_0x3b534f;_0x2ccaca=0xc8;}else{_0x2ccaca=0xce;}_0x5369d9['status'](_0x2ccaca);return _0x5369d9['set'](_0xb943('0x30'),_0x1c91ad+'-'+_0xc117ef+'/'+_0x3b534f)[_0xb943('0x31')](_0x3bf629);}return null;};}function patchUpdates(_0x19f29d){return function(_0x15967d){try{jsonpatch[_0xb943('0x32')](_0x15967d,_0x19f29d,!![]);}catch(_0xf6a29b){return BPromise[_0xb943('0x33')](_0xf6a29b);}return _0x15967d[_0xb943('0x34')]();};}function saveUpdates(_0xd7c3ba,_0x5cf263){return function(_0x3606c1){if(_0x3606c1){return _0x3606c1[_0xb943('0x35')](_0xd7c3ba)[_0xb943('0x1e')](function(_0x1f804e){return _0x1f804e;});}return null;};}function removeEntity(_0x141594,_0x5d183e){return function(_0x26b46c){if(_0x26b46c){return _0x26b46c[_0xb943('0x36')]()['then'](function(){_0x141594['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38fe75,_0x1f8d92){return function(_0x4696af){if(!_0x4696af){_0x38fe75['sendStatus'](0x194);}return _0x4696af;};}function handleError(_0x338efb,_0x466619){_0x466619=_0x466619||0x1f4;return function(_0x30f13d){logger['error'](_0x30f13d[_0xb943('0x37')]);if(_0x30f13d['name']){delete _0x30f13d[_0xb943('0x38')];}_0x338efb[_0xb943('0x2b')](_0x466619)[_0xb943('0x39')](_0x30f13d);};}exports['index']=function(_0x36e79f,_0x2601b4){var _0x43f43e={},_0x4943ce={},_0x530b9d={'count':0x0,'rows':[]};var _0x127b3d=_['map'](db[_0xb943('0x3a')][_0xb943('0x3b')],function(_0xbb23af){return{'name':_0xbb23af[_0xb943('0x3c')],'type':_0xbb23af[_0xb943('0x3d')][_0xb943('0x3e')]};});_0x4943ce[_0xb943('0x3f')]=_[_0xb943('0x40')](_0x127b3d,_0xb943('0x38'));_0x4943ce[_0xb943('0x41')]=_[_0xb943('0x42')](_0x36e79f[_0xb943('0x41')]);_0x4943ce[_0xb943('0x43')]=_['intersection'](_0x4943ce['model'],_0x4943ce[_0xb943('0x41')]);_0x43f43e[_0xb943('0x44')]=_['intersection'](_0x4943ce[_0xb943('0x3f')],qs[_0xb943('0x45')](_0x36e79f[_0xb943('0x41')][_0xb943('0x45')]));_0x43f43e[_0xb943('0x44')]=_0x43f43e[_0xb943('0x44')][_0xb943('0x46')]?_0x43f43e[_0xb943('0x44')]:_0x4943ce[_0xb943('0x3f')];if(!_0x36e79f[_0xb943('0x41')][_0xb943('0x47')](_0xb943('0x48'))){_0x43f43e['limit']=qs[_0xb943('0x2f')](_0x36e79f['query'][_0xb943('0x2f')]);_0x43f43e[_0xb943('0x2e')]=qs[_0xb943('0x2e')](_0x36e79f[_0xb943('0x41')][_0xb943('0x2e')]);}_0x43f43e[_0xb943('0x49')]=qs[_0xb943('0x4a')](_0x36e79f['query'][_0xb943('0x4a')]);_0x43f43e[_0xb943('0x4b')]=qs[_0xb943('0x43')](_[_0xb943('0x4c')](_0x36e79f[_0xb943('0x41')],_0x4943ce[_0xb943('0x43')]),_0x127b3d);if(_0x36e79f[_0xb943('0x41')][_0xb943('0x4d')]){_0x43f43e[_0xb943('0x4b')]=_[_0xb943('0x4e')](_0x43f43e[_0xb943('0x4b')],{'$or':_[_0xb943('0x40')](_0x127b3d,function(_0x486815){if(_0x486815[_0xb943('0x3d')]!==_0xb943('0x4f')){var _0x82a227={};_0x82a227[_0x486815['name']]={'$like':'%'+_0x36e79f[_0xb943('0x41')]['filter']+'%'};return _0x82a227;}})});}_0x43f43e=_[_0xb943('0x4e')]({},_0x43f43e,_0x36e79f['options']);var _0x29f651={'where':_0x43f43e['where']};return db[_0xb943('0x3a')]['count'](_0x29f651)[_0xb943('0x1e')](function(_0x1844da){_0x530b9d[_0xb943('0x2d')]=_0x1844da;if(_0x36e79f[_0xb943('0x41')]['includeAll']){_0x43f43e[_0xb943('0x50')]=[{'all':!![]}];}return db[_0xb943('0x3a')][_0xb943('0x51')](_0x43f43e);})[_0xb943('0x1e')](function(_0x4901b5){_0x530b9d[_0xb943('0x52')]=_0x4901b5;return _0x530b9d;})[_0xb943('0x1e')](respondWithFilteredResult(_0x2601b4,_0x43f43e))[_0xb943('0x29')](handleError(_0x2601b4,null));};exports[_0xb943('0x53')]=function(_0x1ea0f7,_0x186868){var _0x5847e2={'raw':!![],'where':{'id':_0x1ea0f7[_0xb943('0x54')]['id']}},_0xbec187={};_0xbec187[_0xb943('0x3f')]=_['keys'](db[_0xb943('0x3a')][_0xb943('0x3b')]);_0xbec187[_0xb943('0x41')]=_[_0xb943('0x42')](_0x1ea0f7[_0xb943('0x41')]);_0xbec187[_0xb943('0x43')]=_['intersection'](_0xbec187[_0xb943('0x3f')],_0xbec187[_0xb943('0x41')]);_0x5847e2['attributes']=_[_0xb943('0x55')](_0xbec187[_0xb943('0x3f')],qs[_0xb943('0x45')](_0x1ea0f7[_0xb943('0x41')][_0xb943('0x45')]));_0x5847e2[_0xb943('0x44')]=_0x5847e2['attributes'][_0xb943('0x46')]?_0x5847e2[_0xb943('0x44')]:_0xbec187[_0xb943('0x3f')];if(_0x1ea0f7[_0xb943('0x41')][_0xb943('0x56')]){_0x5847e2[_0xb943('0x50')]=[{'all':!![]}];}_0x5847e2=_['merge']({},_0x5847e2,_0x1ea0f7[_0xb943('0x57')]);return db[_0xb943('0x3a')][_0xb943('0x58')](_0x5847e2)[_0xb943('0x1e')](handleEntityNotFound(_0x186868,null))[_0xb943('0x1e')](respondWithResult(_0x186868,null))[_0xb943('0x29')](handleError(_0x186868,null));};exports[_0xb943('0x59')]=function(_0x1e15b1,_0x882e1d){return db[_0xb943('0x3a')]['create'](_0x1e15b1[_0xb943('0x5a')],{})[_0xb943('0x1e')](respondWithResult(_0x882e1d,0xc9))[_0xb943('0x29')](handleError(_0x882e1d,null));};exports[_0xb943('0x35')]=function(_0x4f3655,_0x2b1b96){if(_0x4f3655[_0xb943('0x5a')]['id']){delete _0x4f3655[_0xb943('0x5a')]['id'];}return db[_0xb943('0x3a')][_0xb943('0x58')]({'where':{'id':_0x4f3655['params']['id']}})[_0xb943('0x1e')](handleEntityNotFound(_0x2b1b96,null))['then'](saveUpdates(_0x4f3655[_0xb943('0x5a')],null))[_0xb943('0x1e')](respondWithResult(_0x2b1b96,null))[_0xb943('0x29')](handleError(_0x2b1b96,null));};exports['destroy']=function(_0x495497,_0x418649){return db[_0xb943('0x3a')][_0xb943('0x58')]({'where':{'id':_0x495497['params']['id']}})[_0xb943('0x1e')](handleEntityNotFound(_0x418649,null))[_0xb943('0x1e')](removeEntity(_0x418649,null))[_0xb943('0x29')](handleError(_0x418649,null));};exports[_0xb943('0x5b')]=function(_0x13ac19,_0x223952){return db[_0xb943('0x3a')][_0xb943('0x5b')]()[_0xb943('0x1e')](respondWithResult(_0x223952,null))[_0xb943('0x29')](handleError(_0x223952,null));};var interaction_log=require(_0xb943('0x10'))(_0xb943('0x5c'));exports[_0xb943('0x5d')]=function(_0x151d1e,_0xb7da03,_0x21b061){var _0x1a13dc={'agent':{},'channel':_0xb943('0x5e')};if(_0x151d1e[_0xb943('0x5a')]['id']){delete _0x151d1e['body']['id'];}_0x151d1e[_0xb943('0x5a')]['read']=!![];_0x151d1e[_0xb943('0x5a')]['readAt']=moment()['format'](_0xb943('0x5f'));_0x151d1e[_0xb943('0x5a')][_0xb943('0x60')]=_0x151d1e[_0xb943('0x5a')]['UserId']||_0x151d1e[_0xb943('0x61')]['id'];_0x1a13dc['agent']['id']=_0x151d1e['body']['UserId'];return db[_0xb943('0x3a')][_0xb943('0x58')]({'where':{'id':_0x151d1e[_0xb943('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xb943('0x62')}]})[_0xb943('0x1e')](handleEntityNotFound(_0xb7da03,null))[_0xb943('0x1e')](saveUpdates(_0x151d1e[_0xb943('0x5a')],null))[_0xb943('0x1e')](function(_0x5d4fbc){if(_0x5d4fbc){_0x1a13dc['message']=_0x5d4fbc[_0xb943('0x63')]({'plain':!![]});return db[_0xb943('0x64')][_0xb943('0x58')]({'where':{'id':_0x5d4fbc[_0xb943('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xb7da03,null))[_0xb943('0x1e')](function(_0x56d67a){if(_0x56d67a){return _0x56d67a[_0xb943('0x35')]({'UserId':_0x151d1e[_0xb943('0x5a')]['UserId'],'read1stAt':_[_0xb943('0x66')](_0x56d67a[_0xb943('0x67')])?moment()[_0xb943('0x68')](_0xb943('0x5f')):undefined});}return null;})['then'](function(_0x5ed01f){if(_0x5ed01f){_0x1a13dc[_0xb943('0x69')]=_0x5ed01f[_0xb943('0x63')]({'plain':!![]});interaction_log[_0xb943('0x1f')](_0xb943('0x6a'),_0x151d1e[_0xb943('0x61')]['id'],_0x151d1e[_0xb943('0x61')][_0xb943('0x38')],_0x151d1e[_0xb943('0x61')]['role'],_0x1a13dc['interaction']['id'],_0x151d1e[_0xb943('0x5a')]?JSON[_0xb943('0x23')](_0x151d1e[_0xb943('0x5a')]):'null');return respondWithRpcPromise(_0xb943('0x6b'),_0xb943('0x6c'),_0x1a13dc);}return null;})[_0xb943('0x1e')](function(_0x319872){if(_0x319872){if(_0x151d1e['body']['manual']){_0x1a13dc[_0xb943('0x26')]['interface']=util[_0xb943('0x68')](_0xb943('0x6d'),_0x151d1e[_0xb943('0x61')][_0xb943('0x38')]);_0x1a13dc[_0xb943('0x26')][_0xb943('0x6e')]=_0x1a13dc[_0xb943('0x6e')];_0x1a13dc[_0xb943('0x26')][_0xb943('0x6f')]='accept';return respondWithRpcPromise('EventManager',_0xb943('0x70'),{'event':_0xb943('0x71'),'message':_[_0xb943('0x4e')](_0x1a13dc['message'],JSON[_0xb943('0x72')](_0x1a13dc[_0xb943('0x69')][_0xb943('0x73')]))},client9002)[_0xb943('0x1e')](function(){return _0x1a13dc;});}return _0x1a13dc;}return null;})[_0xb943('0x1e')](respondWithResult(_0xb7da03,null))[_0xb943('0x29')](handleError(_0xb7da03,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xb943('0x33')]=function(_0x3ac2d0,_0xdf18a7,_0x154ff3){var _0x3920fd={'agent':{},'channel':_0xb943('0x5e')};if(_0x3ac2d0[_0xb943('0x5a')]['id']){delete _0x3ac2d0[_0xb943('0x5a')]['id'];}_0x3ac2d0[_0xb943('0x5a')][_0xb943('0x60')]=_0x3ac2d0[_0xb943('0x5a')][_0xb943('0x60')]||_0x3ac2d0['user']['id'];_0x3920fd[_0xb943('0x74')]['id']=_0x3ac2d0[_0xb943('0x5a')][_0xb943('0x60')];return db[_0xb943('0x3a')][_0xb943('0x58')]({'where':{'id':_0x3ac2d0[_0xb943('0x54')]['id'],'UserId':null}})[_0xb943('0x1e')](handleEntityNotFound(_0xdf18a7,null))[_0xb943('0x1e')](function(_0x338d1a){if(_0x338d1a){_0x3920fd[_0xb943('0x26')]=_0x338d1a[_0xb943('0x63')]({'plain':!![]});return db[_0xb943('0x64')]['find']({'where':{'id':_0x338d1a[_0xb943('0x65')]}});}return null;})[_0xb943('0x1e')](handleEntityNotFound(_0xdf18a7,null))[_0xb943('0x1e')](function(_0x300030){if(_0x300030){_0x3920fd[_0xb943('0x69')]=_0x300030[_0xb943('0x63')]({'plain':!![]});interaction_log[_0xb943('0x1f')](_0xb943('0x75'),_0x3ac2d0[_0xb943('0x61')]['id'],_0x3ac2d0['user'][_0xb943('0x38')],_0x3ac2d0[_0xb943('0x61')][_0xb943('0x76')],_0x3920fd[_0xb943('0x69')]['id'],_0x3ac2d0[_0xb943('0x5a')]?JSON[_0xb943('0x23')](_0x3ac2d0['body']):_0xb943('0x77'));return respondWithRpcPromise('RejectMessage',_0xb943('0x78'),_0x3920fd);}return null;})[_0xb943('0x1e')](function(_0x211931){if(_0x211931){_0x211931[_0xb943('0x26')][_0xb943('0x79')]=util[_0xb943('0x68')](_0xb943('0x6d'),_0x3ac2d0[_0xb943('0x61')]['name']);_0x211931[_0xb943('0x26')][_0xb943('0x6e')]=_0x3920fd[_0xb943('0x6e')];_0x211931[_0xb943('0x26')]['event']=_0xb943('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0xb943('0x7a'),'message':_0x211931[_0xb943('0x26')]},client9002);return _0x3920fd;}return null;})[_0xb943('0x1e')](respondWithResult(_0xdf18a7,null))[_0xb943('0x29')](handleError(_0xdf18a7,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 82317f5..766b99c 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 _0x31a6=['ChatMessage','setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x54e394,_0x45bce8){var _0x4d7b47=function(_0x383fbf){while(--_0x383fbf){_0x54e394['push'](_0x54e394['shift']());}};_0x4d7b47(++_0x45bce8);}(_0x31a6,0xa6));var _0x631a=function(_0x44f2e2,_0xf5af60){_0x44f2e2=_0x44f2e2-0x0;var _0x13e49a=_0x31a6[_0x44f2e2];return _0x13e49a;};'use strict';var EventEmitter=require(_0x631a('0x0'));var ChatMessage=require(_0x631a('0x1'))['db'][_0x631a('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x631a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x631a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x24166b){return function(_0x5313c5,_0x2ee6f0,_0x548668){ChatMessageEvents[_0x631a('0x5')](_0x24166b+':'+_0x5313c5['id'],_0x5313c5);ChatMessageEvents[_0x631a('0x5')](_0x24166b,_0x5313c5);_0x548668(null);};}for(var e in events){if(events[_0x631a('0x6')](e)){var event=events[e];ChatMessage[_0x631a('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xbdd6=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x218fdc,_0x3b552b){var _0x54f74e=function(_0x515557){while(--_0x515557){_0x218fdc['push'](_0x218fdc['shift']());}};_0x54f74e(++_0x3b552b);}(_0xbdd6,0xeb));var _0x6bdd=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xbdd6[_0x650e11];return _0x1a9b47;};'use strict';var EventEmitter=require(_0x6bdd('0x0'));var ChatMessage=require(_0x6bdd('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6bdd('0x2')](0x0);var events={'afterCreate':_0x6bdd('0x3'),'afterUpdate':_0x6bdd('0x4'),'afterDestroy':_0x6bdd('0x5')};function emitEvent(_0x487ec3){return function(_0x42a43e,_0x55e143,_0x173325){ChatMessageEvents['emit'](_0x487ec3+':'+_0x42a43e['id'],_0x42a43e);ChatMessageEvents[_0x6bdd('0x6')](_0x487ec3,_0x42a43e);_0x173325(null);};}for(var e in events){if(events[_0x6bdd('0x7')](e)){var event=events[e];ChatMessage[_0x6bdd('0x8')](e,emitEvent(event));}}module[_0x6bdd('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e59edc8..560e941 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 _0x2bae=['exports','ChatMessage','chat_messages','fti_chat_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x390dc8,_0x313518){var _0x7857f=function(_0x374ade){while(--_0x374ade){_0x390dc8['push'](_0x390dc8['shift']());}};_0x7857f(++_0x313518);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe2ba('0x0'));var util=require(_0xe2ba('0x1'));var logger=require(_0xe2ba('0x2'))(_0xe2ba('0x3'));var moment=require(_0xe2ba('0x4'));var BPromise=require(_0xe2ba('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ba('0x6'));var rimraf=require('rimraf');var config=require(_0xe2ba('0x7'));var attributes=require('./chatMessage.attributes');module[_0xe2ba('0x8')]=function(_0x129677,_0x21601e){return _0x129677['define'](_0xe2ba('0x9'),attributes,{'tableName':_0xe2ba('0xa'),'paranoid':![],'indexes':[{'name':_0xe2ba('0xb'),'fields':[_0xe2ba('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f31b0,_0xe703bc,_0x23e657){var _0x2fcfd1=_0x129677[_0xe2ba('0xd')];var _0x8fa8f3=_0x5f31b0['get']({'plain':!![]});if(_0x8fa8f3[_0xe2ba('0xe')][_0xe2ba('0xf')]()==='in'||_0x8fa8f3[_0xe2ba('0xe')][_0xe2ba('0xf')]()===_0xe2ba('0x10')&&!_0x8fa8f3[_0xe2ba('0x11')]&&!_[_0xe2ba('0x12')](_0x8fa8f3[_0xe2ba('0x13')])){_0x2fcfd1[_0xe2ba('0x14')][_0xe2ba('0x15')]({'where':{'id':_0x8fa8f3[_0xe2ba('0x16')]}})['then'](function(_0x13c591){if(_0x13c591){_0x13c591[_0xe2ba('0x17')]({'lastMsgAt':_0x8fa8f3[_0xe2ba('0x18')],'lastMsgDirection':_0x8fa8f3[_0xe2ba('0xe')][_0xe2ba('0xf')]()});}})[_0xe2ba('0x19')](function(_0x1d2547){console[_0xe2ba('0x1a')](_0x1d2547);});}_0x23e657();}},'charset':'utf8mb4','collate':_0xe2ba('0x1b')});}; \ No newline at end of file +var _0xce1a=['ChatInteraction','findOne','update','createdAt','catch','error','utf8mb4','lodash','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages','FULLTEXT','models','get','direction','toLowerCase','UserId'];(function(_0x5911aa,_0x32b383){var _0xf7266a=function(_0x22b754){while(--_0x22b754){_0x5911aa['push'](_0x5911aa['shift']());}};_0xf7266a(++_0x32b383);}(_0xce1a,0xbf));var _0xace1=function(_0x6ac782,_0x5afae8){_0x6ac782=_0x6ac782-0x0;var _0x5d7da9=_0xce1a[_0x6ac782];return _0x5d7da9;};'use strict';var _=require(_0xace1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xace1('0x1'));var BPromise=require(_0xace1('0x2'));var rp=require(_0xace1('0x3'));var fs=require('fs');var path=require(_0xace1('0x4'));var rimraf=require(_0xace1('0x5'));var config=require('../../config/environment');var attributes=require(_0xace1('0x6'));module['exports']=function(_0x4becaf,_0x55bc3e){return _0x4becaf[_0xace1('0x7')](_0xace1('0x8'),attributes,{'tableName':_0xace1('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xace1('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a5b7c,_0x3c8579,_0x3d34c){var _0x13f8ac=_0x4becaf[_0xace1('0xb')];var _0x56d3e3=_0x4a5b7c[_0xace1('0xc')]({'plain':!![]});if(_0x56d3e3[_0xace1('0xd')]['toLowerCase']()==='in'||_0x56d3e3[_0xace1('0xd')][_0xace1('0xe')]()==='out'&&!_0x56d3e3['secret']&&!_['isNil'](_0x56d3e3[_0xace1('0xf')])){_0x13f8ac[_0xace1('0x10')][_0xace1('0x11')]({'where':{'id':_0x56d3e3['ChatInteractionId']}})['then'](function(_0x4e8389){if(_0x4e8389){_0x4e8389[_0xace1('0x12')]({'lastMsgAt':_0x56d3e3[_0xace1('0x13')],'lastMsgDirection':_0x56d3e3[_0xace1('0xd')][_0xace1('0xe')]()});}})[_0xace1('0x14')](function(_0x303080){console[_0xace1('0x15')](_0x303080);});}_0x3d34c();}},'charset':_0xace1('0x16'),'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 e79032f..e01dc8f 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 _0x143c=['body','options','debug','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatMessage.socket','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create'];(function(_0x48c9dd,_0x3607d3){var _0x514c16=function(_0x47b28b){while(--_0x47b28b){_0x48c9dd['push'](_0x48c9dd['shift']());}};_0x514c16(++_0x3607d3);}(_0x143c,0x1e4));var _0xc143=function(_0x421e3a,_0xd69d11){_0x421e3a=_0x421e3a-0x0;var _0x3f9abd=_0x143c[_0x421e3a];return _0x3f9abd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc143('0x0'));var BPromise=require('bluebird');var rs=require(_0xc143('0x1'));var fs=require('fs');var Redis=require(_0xc143('0x2'));var db=require(_0xc143('0x3'))['db'];var utils=require(_0xc143('0x4'));var logger=require(_0xc143('0x5'))(_0xc143('0x6'));var config=require(_0xc143('0x7'));var jayson=require(_0xc143('0x8'));var client=jayson['client'][_0xc143('0x9')]({'port':0x232a});config[_0xc143('0xa')]=_[_0xc143('0xb')](config['redis'],{'host':_0xc143('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc143('0xa')]));require(_0xc143('0xd'))['register'](socket);function respondWithRpcPromise(_0x287f24,_0x486d3d,_0x7c25d6){return new BPromise(function(_0x5499e4,_0x429f78){return client[_0xc143('0xe')](_0x287f24,_0x7c25d6)[_0xc143('0xf')](function(_0x40bb7){logger[_0xc143('0x10')]('ChatMessage,\x20%s,\x20%s',_0x486d3d,_0xc143('0x11'));logger['debug'](_0xc143('0x12'),_0x486d3d,_0xc143('0x11'),JSON['stringify'](_0x40bb7));if(_0x40bb7['error']){if(_0x40bb7[_0xc143('0x13')][_0xc143('0x14')]===0x1f4){logger[_0xc143('0x13')](_0xc143('0x15'),_0x486d3d,_0x40bb7[_0xc143('0x13')]['message']);return _0x429f78(_0x40bb7[_0xc143('0x13')][_0xc143('0x16')]);}logger[_0xc143('0x13')](_0xc143('0x15'),_0x486d3d,_0x40bb7[_0xc143('0x13')]['message']);return _0x5499e4(_0x40bb7[_0xc143('0x13')][_0xc143('0x16')]);}else{logger[_0xc143('0x10')](_0xc143('0x15'),_0x486d3d,'request\x20sent');_0x5499e4(_0x40bb7[_0xc143('0x17')][_0xc143('0x16')]);}})[_0xc143('0x18')](function(_0x59d27b){logger[_0xc143('0x13')](_0xc143('0x15'),_0x486d3d,_0x59d27b);_0x429f78(_0x59d27b);});});}exports[_0xc143('0x19')]=function(_0x2b1391){var _0x3918ef=this;return new Promise(function(_0x170785,_0x3e4f52){return db[_0xc143('0x1a')][_0xc143('0x1b')](_0x2b1391[_0xc143('0x1c')],{'raw':_0x2b1391[_0xc143('0x1d')]?_0x2b1391[_0xc143('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xc143('0xf')](function(_0x235582){logger['info'](_0xc143('0x19'),_0x2b1391);logger[_0xc143('0x1e')](_0xc143('0x19'),_0x2b1391,JSON[_0xc143('0x1f')](_0x235582));_0x170785(_0x235582);})[_0xc143('0x18')](function(_0x28fd3a){logger[_0xc143('0x13')]('CreateChatMessage',_0x28fd3a[_0xc143('0x16')],_0x2b1391);_0x3e4f52(_0x3918ef[_0xc143('0x13')](0x1f4,_0x28fd3a[_0xc143('0x16')]));});});}; \ No newline at end of file +var _0x0849=['body','options','CreateChatMessage','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','ChatMessage,\x20%s,\x20%s','debug','error','message','info','request\x20sent','result','catch','create'];(function(_0x339c4a,_0x2915cd){var _0x279fbc=function(_0x21e51c){while(--_0x21e51c){_0x339c4a['push'](_0x339c4a['shift']());}};_0x279fbc(++_0x2915cd);}(_0x0849,0x90));var _0x9084=function(_0x45b46d,_0x7eb450){_0x45b46d=_0x45b46d-0x0;var _0x517062=_0x0849[_0x45b46d];return _0x517062;};'use strict';var _=require('lodash');var util=require(_0x9084('0x0'));var moment=require(_0x9084('0x1'));var BPromise=require(_0x9084('0x2'));var rs=require(_0x9084('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9084('0x4'))['db'];var utils=require(_0x9084('0x5'));var logger=require(_0x9084('0x6'))('rpc');var config=require(_0x9084('0x7'));var jayson=require(_0x9084('0x8'));var client=jayson[_0x9084('0x9')]['http']({'port':0x232a});config[_0x9084('0xa')]=_[_0x9084('0xb')](config['redis'],{'host':_0x9084('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9084('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x46f66a,_0x21e35e,_0x2d291f){return new BPromise(function(_0x268199,_0x49d21d){return client[_0x9084('0xd')](_0x46f66a,_0x2d291f)[_0x9084('0xe')](function(_0x16b0c4){logger['info'](_0x9084('0xf'),_0x21e35e,'request\x20sent');logger[_0x9084('0x10')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x21e35e,'request\x20sent',JSON['stringify'](_0x16b0c4));if(_0x16b0c4[_0x9084('0x11')]){if(_0x16b0c4[_0x9084('0x11')]['code']===0x1f4){logger[_0x9084('0x11')](_0x9084('0xf'),_0x21e35e,_0x16b0c4[_0x9084('0x11')][_0x9084('0x12')]);return _0x49d21d(_0x16b0c4['error']['message']);}logger[_0x9084('0x11')](_0x9084('0xf'),_0x21e35e,_0x16b0c4[_0x9084('0x11')][_0x9084('0x12')]);return _0x268199(_0x16b0c4[_0x9084('0x11')][_0x9084('0x12')]);}else{logger[_0x9084('0x13')]('ChatMessage,\x20%s,\x20%s',_0x21e35e,_0x9084('0x14'));_0x268199(_0x16b0c4[_0x9084('0x15')][_0x9084('0x12')]);}})[_0x9084('0x16')](function(_0x2c19a9){logger['error'](_0x9084('0xf'),_0x21e35e,_0x2c19a9);_0x49d21d(_0x2c19a9);});});}exports['CreateChatMessage']=function(_0x3db676){var _0x2bf3f8=this;return new Promise(function(_0x19b206,_0x2edde0){return db['ChatMessage'][_0x9084('0x17')](_0x3db676[_0x9084('0x18')],{'raw':_0x3db676[_0x9084('0x19')]?_0x3db676[_0x9084('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9084('0xe')](function(_0x3bcfe5){logger[_0x9084('0x13')](_0x9084('0x1a'),_0x3db676);logger[_0x9084('0x10')](_0x9084('0x1a'),_0x3db676,JSON[_0x9084('0x1b')](_0x3bcfe5));_0x19b206(_0x3bcfe5);})[_0x9084('0x16')](function(_0x30a033){logger['error']('CreateChatMessage',_0x30a033['message'],_0x3db676);_0x2edde0(_0x2bf3f8[_0x9084('0x11')](0x1f4,_0x30a033['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d65244c..fd3085b 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 _0x7a54=['remove','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x542cbb,_0x48df50){var _0x5e90aa=function(_0x120090){while(--_0x120090){_0x542cbb['push'](_0x542cbb['shift']());}};_0x5e90aa(++_0x48df50);}(_0x7a54,0x106));var _0x47a5=function(_0x277d4b,_0x3fca5c){_0x277d4b=_0x277d4b-0x0;var _0x2e3a2d=_0x7a54[_0x277d4b];return _0x2e3a2d;};'use strict';var ChatMessageEvents=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(){ChatMessageEvents[_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);ChatMessageEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x2542=['chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x282da5,_0x3e4a0d){var _0x3e9589=function(_0x36e602){while(--_0x36e602){_0x282da5['push'](_0x282da5['shift']());}};_0x3e9589(++_0x3e4a0d);}(_0x2542,0x169));var _0x2254=function(_0x39271e,_0x3006f6){_0x39271e=_0x39271e-0x0;var _0x336183=_0x2542[_0x39271e];return _0x336183;};'use strict';var ChatMessageEvents=require(_0x2254('0x0'));var events=[_0x2254('0x1'),_0x2254('0x2'),_0x2254('0x3')];function createListener(_0x578407,_0x105910){return function(_0x47b1da){_0x105910[_0x2254('0x4')](_0x578407,_0x47b1da);};}function removeListener(_0x3b3dcb,_0x27f5c9){return function(){ChatMessageEvents[_0x2254('0x5')](_0x3b3dcb,_0x27f5c9);};}exports[_0x2254('0x6')]=function(_0x508183){for(var _0x19ad3c=0x0,_0xe8ca50=events[_0x2254('0x7')];_0x19ad3c<_0xe8ca50;_0x19ad3c++){var _0x3c45ec=events[_0x19ad3c];var _0x1637ad=createListener(_0x2254('0x8')+_0x3c45ec,_0x508183);ChatMessageEvents['on'](_0x3c45ec,_0x1637ad);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c5d5b09..fd2a698 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 _0x7d98=['/describe','isAuthenticated','/:id','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7d98,0xe7));var _0x87d9=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0x7d98[_0x3a3b9e];return _0x148103;};'use strict';var multer=require(_0x87d9('0x0'));var util=require('util');var path=require(_0x87d9('0x1'));var timeout=require(_0x87d9('0x2'));var express=require(_0x87d9('0x3'));var router=express[_0x87d9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x87d9('0x5'));var interaction=require(_0x87d9('0x6'));var config=require('../../config/environment');var controller=require(_0x87d9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x87d9('0x8')](_0x87d9('0x9'),auth[_0x87d9('0xa')](),controller['describe']);router[_0x87d9('0x8')](_0x87d9('0xb'),auth[_0x87d9('0xa')](),controller['show']);router[_0x87d9('0xc')]('/',auth[_0x87d9('0xa')](),interaction[_0x87d9('0xd')](_0x87d9('0xe'),_0x87d9('0xf')),controller[_0x87d9('0x10')]);router[_0x87d9('0x11')](_0x87d9('0xb'),controller[_0x87d9('0x12')]);router[_0x87d9('0x11')](_0x87d9('0x13'),auth[_0x87d9('0xa')](),controller[_0x87d9('0x14')]);router[_0x87d9('0x11')](_0x87d9('0x15'),auth[_0x87d9('0xa')](),controller[_0x87d9('0x16')]);router[_0x87d9('0x17')](_0x87d9('0xb'),auth[_0x87d9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2e54=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','/:id/accept','accept','put','/:id/reject','reject','delete'];(function(_0x54954e,_0x57911a){var _0x3bdf88=function(_0x38e89b){while(--_0x38e89b){_0x54954e['push'](_0x54954e['shift']());}};_0x3bdf88(++_0x57911a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x22f0e3,_0x44a0e9){_0x22f0e3=_0x22f0e3-0x0;var _0xd9990e=_0x2e54[_0x22f0e3];return _0xd9990e;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./chatMessage.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0xf')]('/',auth[_0x42e5('0x9')](),interaction[_0x42e5('0x10')](_0x42e5('0x11'),_0x42e5('0x12')),controller[_0x42e5('0x13')]);router['put'](_0x42e5('0xd'),controller[_0x42e5('0x14')]);router['put'](_0x42e5('0x15'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);router[_0x42e5('0x17')](_0x42e5('0x18'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x19')]);router[_0x42e5('0x1a')](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller['destroy']);module[_0x42e5('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9cac74b..e37ed35 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 _0x52f1=['medium','sequelize','exports','TEXT'];(function(_0x4f64c8,_0xe04d80){var _0x241b26=function(_0x2e0ac4){while(--_0x2e0ac4){_0x4f64c8['push'](_0x4f64c8['shift']());}};_0x241b26(++_0xe04d80);}(_0x52f1,0x175));var _0x152f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x52f1[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x152f('0x0'));module[_0x152f('0x1')]={'body':{'type':Sequelize[_0x152f('0x2')](_0x152f('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5e59=['exports','TEXT','medium'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5e59,0xc6));var _0x95e5=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0x5e59[_0x4067ac];return _0x53d74d;};'use strict';var Sequelize=require('sequelize');module[_0x95e5('0x0')]={'body':{'type':Sequelize[_0x95e5('0x1')](_0x95e5('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 459a319..2436fc2 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 _0xc7c6=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','catch','create','body','update','destroy','Attachment','findAll','forEach','join','root','server','files','attachments','offline-chat','existsSync','remove','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/environment','../../config/license/util','status','json','count','limit','set','Content-Range','apply','save','then','end','sendStatus','stack','name','send','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort'];(function(_0x4765cd,_0x2a7c55){var _0x396ab1=function(_0x55f190){while(--_0x55f190){_0x4765cd['push'](_0x4765cd['shift']());}};_0x396ab1(++_0x2a7c55);}(_0xc7c6,0xc9));var _0x6c7c=function(_0x53fad0,_0x569256){_0x53fad0=_0x53fad0-0x0;var _0x3f6005=_0xc7c6[_0x53fad0];return _0x3f6005;};'use strict';var pdf=require(_0x6c7c('0x0'));var emlformat=require(_0x6c7c('0x1'));var rimraf=require(_0x6c7c('0x2'));var zipdir=require(_0x6c7c('0x3'));var jsonpatch=require(_0x6c7c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6c7c('0x5'));var Mustache=require(_0x6c7c('0x6'));var util=require(_0x6c7c('0x7'));var path=require('path');var sox=require(_0x6c7c('0x8'));var csv=require(_0x6c7c('0x9'));var ejs=require(_0x6c7c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c7c('0xb'));var jsforce=require(_0x6c7c('0xc'));var deskjs=require(_0x6c7c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6c7c('0xe'));var Papa=require(_0x6c7c('0xf'));var Redis=require(_0x6c7c('0x10'));var authService=require(_0x6c7c('0x11'));var qs=require(_0x6c7c('0x12'));var as=require(_0x6c7c('0x13'));var hardwareService=require(_0x6c7c('0x14'));var logger=require(_0x6c7c('0x15'))(_0x6c7c('0x16'));var utils=require('../../config/utils');var config=require(_0x6c7c('0x17'));var licenseUtil=require(_0x6c7c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29a6e4,_0x49e258){_0x49e258=_0x49e258||0xcc;return function(_0x1b4054){if(_0x1b4054){return _0x29a6e4['sendStatus'](_0x49e258);}return _0x29a6e4['status'](_0x49e258)['end']();};}function respondWithResult(_0x4ff157,_0x5d36ef){_0x5d36ef=_0x5d36ef||0xc8;return function(_0x541076){if(_0x541076){return _0x4ff157[_0x6c7c('0x19')](_0x5d36ef)[_0x6c7c('0x1a')](_0x541076);}};}function respondWithFilteredResult(_0x335564,_0x19b350){return function(_0x23f911){if(_0x23f911){var _0x240675=_0x23f911[_0x6c7c('0x1b')],_0x3ad92c=_0x19b350['offset'],_0x5652f1=_0x19b350['offset']+_0x19b350[_0x6c7c('0x1c')],_0x287c46;if(_0x5652f1>=_0x240675){_0x5652f1=_0x240675;_0x287c46=0xc8;}else{_0x287c46=0xce;}_0x335564[_0x6c7c('0x19')](_0x287c46);return _0x335564[_0x6c7c('0x1d')](_0x6c7c('0x1e'),_0x3ad92c+'-'+_0x5652f1+'/'+_0x240675)[_0x6c7c('0x1a')](_0x23f911);}return null;};}function patchUpdates(_0x5d201d){return function(_0x47f268){try{jsonpatch[_0x6c7c('0x1f')](_0x47f268,_0x5d201d,!![]);}catch(_0x56e4d4){return BPromise['reject'](_0x56e4d4);}return _0x47f268[_0x6c7c('0x20')]();};}function saveUpdates(_0x825351,_0x28c2cd){return function(_0x4793b2){if(_0x4793b2){return _0x4793b2['update'](_0x825351)[_0x6c7c('0x21')](function(_0x1bfeef){return _0x1bfeef;});}return null;};}function removeEntity(_0x3df266,_0x1d38e8){return function(_0x33f229){if(_0x33f229){return _0x33f229['destroy']()[_0x6c7c('0x21')](function(){_0x3df266[_0x6c7c('0x19')](0xcc)[_0x6c7c('0x22')]();});}};}function handleEntityNotFound(_0x18ac94,_0x4aa273){return function(_0x499e4f){if(!_0x499e4f){_0x18ac94[_0x6c7c('0x23')](0x194);}return _0x499e4f;};}function handleError(_0x482877,_0x4525e9){_0x4525e9=_0x4525e9||0x1f4;return function(_0x187092){logger['error'](_0x187092[_0x6c7c('0x24')]);if(_0x187092[_0x6c7c('0x25')]){delete _0x187092[_0x6c7c('0x25')];}_0x482877[_0x6c7c('0x19')](_0x4525e9)[_0x6c7c('0x26')](_0x187092);};}exports['index']=function(_0x4cb3d1,_0x2e0dcb){var _0x15751b={},_0x31918f={},_0x853fa5={'count':0x0,'rows':[]};var _0x3591e8=_['map'](db[_0x6c7c('0x27')][_0x6c7c('0x28')],function(_0x5a52a9){return{'name':_0x5a52a9[_0x6c7c('0x29')],'type':_0x5a52a9[_0x6c7c('0x2a')][_0x6c7c('0x2b')]};});_0x31918f[_0x6c7c('0x2c')]=_[_0x6c7c('0x2d')](_0x3591e8,_0x6c7c('0x25'));_0x31918f[_0x6c7c('0x2e')]=_[_0x6c7c('0x2f')](_0x4cb3d1[_0x6c7c('0x2e')]);_0x31918f[_0x6c7c('0x30')]=_[_0x6c7c('0x31')](_0x31918f[_0x6c7c('0x2c')],_0x31918f[_0x6c7c('0x2e')]);_0x15751b['attributes']=_[_0x6c7c('0x31')](_0x31918f[_0x6c7c('0x2c')],qs[_0x6c7c('0x32')](_0x4cb3d1[_0x6c7c('0x2e')][_0x6c7c('0x32')]));_0x15751b[_0x6c7c('0x33')]=_0x15751b[_0x6c7c('0x33')]['length']?_0x15751b['attributes']:_0x31918f[_0x6c7c('0x2c')];if(!_0x4cb3d1['query'][_0x6c7c('0x34')](_0x6c7c('0x35'))){_0x15751b[_0x6c7c('0x1c')]=qs[_0x6c7c('0x1c')](_0x4cb3d1[_0x6c7c('0x2e')][_0x6c7c('0x1c')]);_0x15751b[_0x6c7c('0x36')]=qs[_0x6c7c('0x36')](_0x4cb3d1[_0x6c7c('0x2e')]['offset']);}_0x15751b[_0x6c7c('0x37')]=qs[_0x6c7c('0x38')](_0x4cb3d1[_0x6c7c('0x2e')][_0x6c7c('0x38')]);_0x15751b[_0x6c7c('0x39')]=qs['filters'](_[_0x6c7c('0x3a')](_0x4cb3d1[_0x6c7c('0x2e')],_0x31918f[_0x6c7c('0x30')]),_0x3591e8);if(_0x4cb3d1[_0x6c7c('0x2e')][_0x6c7c('0x3b')]){_0x15751b[_0x6c7c('0x39')]=_[_0x6c7c('0x3c')](_0x15751b[_0x6c7c('0x39')],{'$or':_[_0x6c7c('0x2d')](_0x3591e8,function(_0x4c737b){if(_0x4c737b['type']!==_0x6c7c('0x3d')){var _0x1fbc49={};_0x1fbc49[_0x4c737b['name']]={'$like':'%'+_0x4cb3d1[_0x6c7c('0x2e')][_0x6c7c('0x3b')]+'%'};return _0x1fbc49;}})});}_0x15751b=_[_0x6c7c('0x3c')]({},_0x15751b,_0x4cb3d1[_0x6c7c('0x3e')]);var _0x356ef9={'where':_0x15751b[_0x6c7c('0x39')]};return db[_0x6c7c('0x27')][_0x6c7c('0x1b')](_0x356ef9)[_0x6c7c('0x21')](function(_0x3ea196){_0x853fa5['count']=_0x3ea196;if(_0x4cb3d1[_0x6c7c('0x2e')][_0x6c7c('0x3f')]){_0x15751b[_0x6c7c('0x40')]=[{'all':!![]}];}return db[_0x6c7c('0x27')]['findAll'](_0x15751b);})['then'](function(_0x44350d){_0x853fa5[_0x6c7c('0x41')]=_0x44350d;return _0x853fa5;})[_0x6c7c('0x21')](respondWithFilteredResult(_0x2e0dcb,_0x15751b))['catch'](handleError(_0x2e0dcb,null));};exports[_0x6c7c('0x42')]=function(_0x33c6aa,_0x50e6ed){var _0x1a9294={'raw':!![],'where':{'id':_0x33c6aa[_0x6c7c('0x43')]['id']}},_0x262897={};_0x262897['model']=_['keys'](db[_0x6c7c('0x27')][_0x6c7c('0x28')]);_0x262897[_0x6c7c('0x2e')]=_[_0x6c7c('0x2f')](_0x33c6aa[_0x6c7c('0x2e')]);_0x262897['filters']=_[_0x6c7c('0x31')](_0x262897[_0x6c7c('0x2c')],_0x262897[_0x6c7c('0x2e')]);_0x1a9294[_0x6c7c('0x33')]=_[_0x6c7c('0x31')](_0x262897[_0x6c7c('0x2c')],qs[_0x6c7c('0x32')](_0x33c6aa[_0x6c7c('0x2e')][_0x6c7c('0x32')]));_0x1a9294[_0x6c7c('0x33')]=_0x1a9294[_0x6c7c('0x33')][_0x6c7c('0x44')]?_0x1a9294[_0x6c7c('0x33')]:_0x262897[_0x6c7c('0x2c')];if(_0x33c6aa['query'][_0x6c7c('0x3f')]){_0x1a9294[_0x6c7c('0x40')]=[{'all':!![]}];}_0x1a9294=_[_0x6c7c('0x3c')]({},_0x1a9294,_0x33c6aa['options']);return db[_0x6c7c('0x27')]['find'](_0x1a9294)[_0x6c7c('0x21')](handleEntityNotFound(_0x50e6ed,null))[_0x6c7c('0x21')](respondWithResult(_0x50e6ed,null))[_0x6c7c('0x45')](handleError(_0x50e6ed,null));};exports[_0x6c7c('0x46')]=function(_0x12dacd,_0x13ed49){return db['ChatOfflineMessage'][_0x6c7c('0x46')](_0x12dacd[_0x6c7c('0x47')],{})['then'](respondWithResult(_0x13ed49,0xc9))[_0x6c7c('0x45')](handleError(_0x13ed49,null));};exports[_0x6c7c('0x48')]=function(_0x2c2a8e,_0x10ae74){if(_0x2c2a8e[_0x6c7c('0x47')]['id']){delete _0x2c2a8e[_0x6c7c('0x47')]['id'];}return db[_0x6c7c('0x27')]['find']({'where':{'id':_0x2c2a8e[_0x6c7c('0x43')]['id']}})[_0x6c7c('0x21')](handleEntityNotFound(_0x10ae74,null))[_0x6c7c('0x21')](saveUpdates(_0x2c2a8e['body'],null))[_0x6c7c('0x21')](respondWithResult(_0x10ae74,null))[_0x6c7c('0x45')](handleError(_0x10ae74,null));};exports[_0x6c7c('0x49')]=function(_0x14a7f0,_0xa46a22){return db[_0x6c7c('0x4a')][_0x6c7c('0x4b')]({'where':{'ChatOfflineMessageId':_0x14a7f0['params']['id']},'raw':!![]})[_0x6c7c('0x21')](function(_0x336a2d){_0x336a2d[_0x6c7c('0x4c')](function(_0x370745){var _0x255eeb=path[_0x6c7c('0x4d')](config[_0x6c7c('0x4e')],_0x6c7c('0x4f'),_0x6c7c('0x50'),_0x6c7c('0x51'),_0x6c7c('0x52'),_0x370745['basename']);var _0x38877b=fs[_0x6c7c('0x53')](_0x255eeb);if(_0x38877b)fs_extra[_0x6c7c('0x54')](_0x255eeb);});})[_0x6c7c('0x21')](function(){return db[_0x6c7c('0x27')][_0x6c7c('0x55')]({'where':{'id':_0x14a7f0[_0x6c7c('0x43')]['id']},'individualHooks':!![]});})[_0x6c7c('0x21')](handleEntityNotFound(_0xa46a22,null))[_0x6c7c('0x21')](removeEntity(_0xa46a22,null))[_0x6c7c('0x45')](handleError(_0xa46a22,null));};exports['describe']=function(_0x48f8d2,_0x330524){return db[_0x6c7c('0x27')]['describe']()[_0x6c7c('0x21')](respondWithResult(_0x330524,null))['catch'](handleError(_0x330524,null));}; \ No newline at end of file +var _0x3ae4=['intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','forEach','join','root','server','attachments','basename','existsSync','remove','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','apply','save','update','then','stack','name','send','index','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x3ae4,0x75));var _0x43ae=function(_0x499eef,_0x28af8f){_0x499eef=_0x499eef-0x0;var _0x59da91=_0x3ae4[_0x499eef];return _0x59da91;};'use strict';var pdf=require(_0x43ae('0x0'));var emlformat=require(_0x43ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x43ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x43ae('0x3'));var BPromise=require(_0x43ae('0x4'));var Mustache=require(_0x43ae('0x5'));var util=require(_0x43ae('0x6'));var path=require(_0x43ae('0x7'));var sox=require(_0x43ae('0x8'));var csv=require(_0x43ae('0x9'));var ejs=require(_0x43ae('0xa'));var fs=require('fs');var fs_extra=require(_0x43ae('0xb'));var _=require(_0x43ae('0xc'));var squel=require(_0x43ae('0xd'));var crypto=require('crypto');var jsforce=require(_0x43ae('0xe'));var deskjs=require(_0x43ae('0xf'));var toCsv=require(_0x43ae('0x9'));var querystring=require('querystring');var Papa=require(_0x43ae('0x10'));var Redis=require(_0x43ae('0x11'));var authService=require(_0x43ae('0x12'));var qs=require(_0x43ae('0x13'));var as=require(_0x43ae('0x14'));var hardwareService=require(_0x43ae('0x15'));var logger=require(_0x43ae('0x16'))(_0x43ae('0x17'));var utils=require('../../config/utils');var config=require(_0x43ae('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdd5cc7,_0x4e0436){_0x4e0436=_0x4e0436||0xcc;return function(_0x278302){if(_0x278302){return _0xdd5cc7[_0x43ae('0x19')](_0x4e0436);}return _0xdd5cc7[_0x43ae('0x1a')](_0x4e0436)[_0x43ae('0x1b')]();};}function respondWithResult(_0x47bc2e,_0x17f7ec){_0x17f7ec=_0x17f7ec||0xc8;return function(_0x234779){if(_0x234779){return _0x47bc2e[_0x43ae('0x1a')](_0x17f7ec)[_0x43ae('0x1c')](_0x234779);}};}function respondWithFilteredResult(_0x355170,_0x3a909d){return function(_0x2d484f){if(_0x2d484f){var _0x1060a1=_0x2d484f['count'],_0x4679d1=_0x3a909d[_0x43ae('0x1d')],_0x4d189b=_0x3a909d[_0x43ae('0x1d')]+_0x3a909d['limit'],_0x3697c1;if(_0x4d189b>=_0x1060a1){_0x4d189b=_0x1060a1;_0x3697c1=0xc8;}else{_0x3697c1=0xce;}_0x355170[_0x43ae('0x1a')](_0x3697c1);return _0x355170['set']('Content-Range',_0x4679d1+'-'+_0x4d189b+'/'+_0x1060a1)['json'](_0x2d484f);}return null;};}function patchUpdates(_0xb3b202){return function(_0x134b85){try{jsonpatch[_0x43ae('0x1e')](_0x134b85,_0xb3b202,!![]);}catch(_0x3a32d6){return BPromise['reject'](_0x3a32d6);}return _0x134b85[_0x43ae('0x1f')]();};}function saveUpdates(_0x5b93a4,_0x36a7fe){return function(_0xed8edd){if(_0xed8edd){return _0xed8edd[_0x43ae('0x20')](_0x5b93a4)[_0x43ae('0x21')](function(_0xa7fb7b){return _0xa7fb7b;});}return null;};}function removeEntity(_0x30d0b6,_0x53ddc7){return function(_0x26f3d6){if(_0x26f3d6){return _0x26f3d6['destroy']()[_0x43ae('0x21')](function(){_0x30d0b6['status'](0xcc)[_0x43ae('0x1b')]();});}};}function handleEntityNotFound(_0x19d882,_0x181879){return function(_0x126a92){if(!_0x126a92){_0x19d882[_0x43ae('0x19')](0x194);}return _0x126a92;};}function handleError(_0x48dd61,_0x11433b){_0x11433b=_0x11433b||0x1f4;return function(_0x44442b){logger['error'](_0x44442b[_0x43ae('0x22')]);if(_0x44442b[_0x43ae('0x23')]){delete _0x44442b[_0x43ae('0x23')];}_0x48dd61[_0x43ae('0x1a')](_0x11433b)[_0x43ae('0x24')](_0x44442b);};}exports[_0x43ae('0x25')]=function(_0x833105,_0x5a14bc){var _0x15a3dc={},_0x502f41={},_0x526ef4={'count':0x0,'rows':[]};var _0x1c58de=_['map'](db[_0x43ae('0x26')][_0x43ae('0x27')],function(_0xd6c56f){return{'name':_0xd6c56f[_0x43ae('0x28')],'type':_0xd6c56f[_0x43ae('0x29')][_0x43ae('0x2a')]};});_0x502f41[_0x43ae('0x2b')]=_['map'](_0x1c58de,'name');_0x502f41[_0x43ae('0x2c')]=_[_0x43ae('0x2d')](_0x833105[_0x43ae('0x2c')]);_0x502f41[_0x43ae('0x2e')]=_[_0x43ae('0x2f')](_0x502f41['model'],_0x502f41[_0x43ae('0x2c')]);_0x15a3dc[_0x43ae('0x30')]=_[_0x43ae('0x2f')](_0x502f41['model'],qs[_0x43ae('0x31')](_0x833105['query']['fields']));_0x15a3dc[_0x43ae('0x30')]=_0x15a3dc['attributes'][_0x43ae('0x32')]?_0x15a3dc[_0x43ae('0x30')]:_0x502f41[_0x43ae('0x2b')];if(!_0x833105[_0x43ae('0x2c')][_0x43ae('0x33')]('nolimit')){_0x15a3dc[_0x43ae('0x34')]=qs['limit'](_0x833105[_0x43ae('0x2c')][_0x43ae('0x34')]);_0x15a3dc['offset']=qs['offset'](_0x833105[_0x43ae('0x2c')][_0x43ae('0x1d')]);}_0x15a3dc[_0x43ae('0x35')]=qs[_0x43ae('0x36')](_0x833105[_0x43ae('0x2c')][_0x43ae('0x36')]);_0x15a3dc['where']=qs[_0x43ae('0x2e')](_[_0x43ae('0x37')](_0x833105['query'],_0x502f41['filters']),_0x1c58de);if(_0x833105[_0x43ae('0x2c')][_0x43ae('0x38')]){_0x15a3dc['where']=_[_0x43ae('0x39')](_0x15a3dc['where'],{'$or':_[_0x43ae('0x3a')](_0x1c58de,function(_0x50fac2){if(_0x50fac2[_0x43ae('0x29')]!==_0x43ae('0x3b')){var _0x263bcd={};_0x263bcd[_0x50fac2[_0x43ae('0x23')]]={'$like':'%'+_0x833105[_0x43ae('0x2c')]['filter']+'%'};return _0x263bcd;}})});}_0x15a3dc=_[_0x43ae('0x39')]({},_0x15a3dc,_0x833105[_0x43ae('0x3c')]);var _0x164665={'where':_0x15a3dc['where']};return db['ChatOfflineMessage'][_0x43ae('0x3d')](_0x164665)[_0x43ae('0x21')](function(_0x1b6d87){_0x526ef4['count']=_0x1b6d87;if(_0x833105[_0x43ae('0x2c')][_0x43ae('0x3e')]){_0x15a3dc[_0x43ae('0x3f')]=[{'all':!![]}];}return db[_0x43ae('0x26')][_0x43ae('0x40')](_0x15a3dc);})[_0x43ae('0x21')](function(_0x109bb7){_0x526ef4[_0x43ae('0x41')]=_0x109bb7;return _0x526ef4;})[_0x43ae('0x21')](respondWithFilteredResult(_0x5a14bc,_0x15a3dc))[_0x43ae('0x42')](handleError(_0x5a14bc,null));};exports[_0x43ae('0x43')]=function(_0x2e5acd,_0x5aecde){var _0x18ff94={'raw':!![],'where':{'id':_0x2e5acd[_0x43ae('0x44')]['id']}},_0x43d405={};_0x43d405[_0x43ae('0x2b')]=_[_0x43ae('0x2d')](db[_0x43ae('0x26')][_0x43ae('0x27')]);_0x43d405[_0x43ae('0x2c')]=_[_0x43ae('0x2d')](_0x2e5acd[_0x43ae('0x2c')]);_0x43d405[_0x43ae('0x2e')]=_[_0x43ae('0x2f')](_0x43d405['model'],_0x43d405['query']);_0x18ff94[_0x43ae('0x30')]=_[_0x43ae('0x2f')](_0x43d405[_0x43ae('0x2b')],qs[_0x43ae('0x31')](_0x2e5acd[_0x43ae('0x2c')]['fields']));_0x18ff94['attributes']=_0x18ff94[_0x43ae('0x30')][_0x43ae('0x32')]?_0x18ff94[_0x43ae('0x30')]:_0x43d405[_0x43ae('0x2b')];if(_0x2e5acd['query'][_0x43ae('0x3e')]){_0x18ff94[_0x43ae('0x3f')]=[{'all':!![]}];}_0x18ff94=_[_0x43ae('0x39')]({},_0x18ff94,_0x2e5acd['options']);return db[_0x43ae('0x26')]['find'](_0x18ff94)['then'](handleEntityNotFound(_0x5aecde,null))[_0x43ae('0x21')](respondWithResult(_0x5aecde,null))['catch'](handleError(_0x5aecde,null));};exports['create']=function(_0x1cbc6a,_0x4510f4){return db[_0x43ae('0x26')][_0x43ae('0x45')](_0x1cbc6a[_0x43ae('0x46')],{})['then'](respondWithResult(_0x4510f4,0xc9))[_0x43ae('0x42')](handleError(_0x4510f4,null));};exports[_0x43ae('0x20')]=function(_0x83a850,_0x1af30c){if(_0x83a850[_0x43ae('0x46')]['id']){delete _0x83a850[_0x43ae('0x46')]['id'];}return db['ChatOfflineMessage'][_0x43ae('0x47')]({'where':{'id':_0x83a850[_0x43ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x1af30c,null))[_0x43ae('0x21')](saveUpdates(_0x83a850['body'],null))[_0x43ae('0x21')](respondWithResult(_0x1af30c,null))[_0x43ae('0x42')](handleError(_0x1af30c,null));};exports[_0x43ae('0x48')]=function(_0x39a30b,_0x1e562f){return db['Attachment'][_0x43ae('0x40')]({'where':{'ChatOfflineMessageId':_0x39a30b[_0x43ae('0x44')]['id']},'raw':!![]})[_0x43ae('0x21')](function(_0x38cad7){_0x38cad7[_0x43ae('0x49')](function(_0x4c753d){var _0x581e2c=path[_0x43ae('0x4a')](config[_0x43ae('0x4b')],_0x43ae('0x4c'),'files',_0x43ae('0x4d'),'offline-chat',_0x4c753d[_0x43ae('0x4e')]);var _0x48c96c=fs[_0x43ae('0x4f')](_0x581e2c);if(_0x48c96c)fs_extra[_0x43ae('0x50')](_0x581e2c);});})[_0x43ae('0x21')](function(){return db[_0x43ae('0x26')][_0x43ae('0x47')]({'where':{'id':_0x39a30b['params']['id']},'individualHooks':!![]});})[_0x43ae('0x21')](handleEntityNotFound(_0x1e562f,null))[_0x43ae('0x21')](removeEntity(_0x1e562f,null))[_0x43ae('0x42')](handleError(_0x1e562f,null));};exports[_0x43ae('0x51')]=function(_0x3e9e58,_0x2fd29b){return db[_0x43ae('0x26')][_0x43ae('0x51')]()[_0x43ae('0x21')](respondWithResult(_0x2fd29b,null))[_0x43ae('0x42')](handleError(_0x2fd29b,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index dcd427b..9ac7948 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 _0xe14d=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x336a40,_0x158d72){var _0x10b236=function(_0x27a2a4){while(--_0x27a2a4){_0x336a40['push'](_0x336a40['shift']());}};_0x10b236(++_0x158d72);}(_0xe14d,0x1ee));var _0xde14=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe14d[_0x2d7f0e];return _0x110b07;};'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'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('ChatOfflineMessage',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde14('0xb'),'collate':_0xde14('0xc')});}; \ No newline at end of file +var _0x826a=['request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird'];(function(_0x498ca8,_0x42c1de){var _0x1e9e0d=function(_0x1e843c){while(--_0x1e843c){_0x498ca8['push'](_0x498ca8['shift']());}};_0x1e9e0d(++_0x42c1de);}(_0x826a,0x1aa));var _0xa826=function(_0x4f5115,_0x5dd20d){_0x4f5115=_0x4f5115-0x0;var _0x16df95=_0x826a[_0x4f5115];return _0x16df95;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var logger=require('../../config/logger')(_0xa826('0x1'));var moment=require('moment');var BPromise=require(_0xa826('0x2'));var rp=require(_0xa826('0x3'));var fs=require('fs');var path=require(_0xa826('0x4'));var rimraf=require(_0xa826('0x5'));var config=require('../../config/environment');var attributes=require(_0xa826('0x6'));module[_0xa826('0x7')]=function(_0x3929d4,_0x34327b){return _0x3929d4[_0xa826('0x8')](_0xa826('0x9'),attributes,{'tableName':_0xa826('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa826('0xb'),'collate':_0xa826('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 04b1c6a..7c14357 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 _0x547f=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x547f,0xe1));var _0xf547=function(_0x1af00f,_0x2faace){_0x1af00f=_0x1af00f-0x0;var _0x9a54d4=_0x547f[_0x1af00f];return _0x9a54d4;};'use strict';var _=require(_0xf547('0x0'));var util=require(_0xf547('0x1'));var moment=require(_0xf547('0x2'));var BPromise=require(_0xf547('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf547('0x4'));var db=require(_0xf547('0x5'))['db'];var utils=require(_0xf547('0x6'));var logger=require('../../config/logger')(_0xf547('0x7'));var config=require('../../config/environment');var jayson=require(_0xf547('0x8'));var client=jayson[_0xf547('0x9')][_0xf547('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597219,_0x352120,_0x48b1f1){return new BPromise(function(_0x4776b8,_0x275811){return client[_0xf547('0xb')](_0x597219,_0x48b1f1)[_0xf547('0xc')](function(_0x21e38a){logger['info'](_0xf547('0xd'),_0x352120,_0xf547('0xe'));logger[_0xf547('0xf')](_0xf547('0x10'),_0x352120,'request\x20sent',JSON[_0xf547('0x11')](_0x21e38a));if(_0x21e38a[_0xf547('0x12')]){if(_0x21e38a[_0xf547('0x12')][_0xf547('0x13')]===0x1f4){logger[_0xf547('0x12')](_0xf547('0xd'),_0x352120,_0x21e38a[_0xf547('0x12')][_0xf547('0x14')]);return _0x275811(_0x21e38a[_0xf547('0x12')][_0xf547('0x14')]);}logger[_0xf547('0x12')](_0xf547('0xd'),_0x352120,_0x21e38a[_0xf547('0x12')][_0xf547('0x14')]);return _0x4776b8(_0x21e38a[_0xf547('0x12')][_0xf547('0x14')]);}else{logger[_0xf547('0x15')]('ChatOfflineMessage,\x20%s,\x20%s',_0x352120,_0xf547('0xe'));_0x4776b8(_0x21e38a[_0xf547('0x16')]['message']);}})[_0xf547('0x17')](function(_0x3798c8){logger['error'](_0xf547('0xd'),_0x352120,_0x3798c8);_0x275811(_0x3798c8);});});} \ No newline at end of file +var _0x192e=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x192e,0x118));var _0xe192=function(_0x32b81a,_0x58e722){_0x32b81a=_0x32b81a-0x0;var _0x38a52a=_0x192e[_0x32b81a];return _0x38a52a;};'use strict';var _=require(_0xe192('0x0'));var util=require(_0xe192('0x1'));var moment=require('moment');var BPromise=require(_0xe192('0x2'));var rs=require(_0xe192('0x3'));var fs=require('fs');var Redis=require(_0xe192('0x4'));var db=require(_0xe192('0x5'))['db'];var utils=require(_0xe192('0x6'));var logger=require(_0xe192('0x7'))('rpc');var config=require(_0xe192('0x8'));var jayson=require(_0xe192('0x9'));var client=jayson[_0xe192('0xa')][_0xe192('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40c004,_0x1cc425,_0x2c63d9){return new BPromise(function(_0x236834,_0x53019a){return client[_0xe192('0xc')](_0x40c004,_0x2c63d9)[_0xe192('0xd')](function(_0x36d897){logger['info'](_0xe192('0xe'),_0x1cc425,_0xe192('0xf'));logger['debug'](_0xe192('0x10'),_0x1cc425,'request\x20sent',JSON['stringify'](_0x36d897));if(_0x36d897[_0xe192('0x11')]){if(_0x36d897[_0xe192('0x11')][_0xe192('0x12')]===0x1f4){logger[_0xe192('0x11')](_0xe192('0xe'),_0x1cc425,_0x36d897[_0xe192('0x11')][_0xe192('0x13')]);return _0x53019a(_0x36d897[_0xe192('0x11')][_0xe192('0x13')]);}logger['error'](_0xe192('0xe'),_0x1cc425,_0x36d897[_0xe192('0x11')]['message']);return _0x236834(_0x36d897[_0xe192('0x11')]['message']);}else{logger[_0xe192('0x14')](_0xe192('0xe'),_0x1cc425,'request\x20sent');_0x236834(_0x36d897['result'][_0xe192('0x13')]);}})['catch'](function(_0x202dce){logger[_0xe192('0x11')](_0xe192('0xe'),_0x1cc425,_0x202dce);_0x53019a(_0x202dce);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 7d3efb5..e8cbf6b 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 _0xf3c1=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','/:id','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf3c1,0xce));var _0x1f3c=function(_0x12bc89,_0x29d833){_0x12bc89=_0x12bc89-0x0;var _0x519cfc=_0xf3c1[_0x12bc89];return _0x519cfc;};'use strict';var multer=require(_0x1f3c('0x0'));var util=require(_0x1f3c('0x1'));var path=require(_0x1f3c('0x2'));var timeout=require(_0x1f3c('0x3'));var express=require(_0x1f3c('0x4'));var router=express['Router']();var fs_extra=require(_0x1f3c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f3c('0x6'));var config=require(_0x1f3c('0x7'));var controller=require(_0x1f3c('0x8'));router['get']('/',auth[_0x1f3c('0x9')](),controller['index']);router[_0x1f3c('0xa')](_0x1f3c('0xb'),auth[_0x1f3c('0x9')](),controller['describe']);router[_0x1f3c('0xa')](_0x1f3c('0xc'),auth[_0x1f3c('0x9')](),controller[_0x1f3c('0xd')]);router[_0x1f3c('0xe')]('/',auth[_0x1f3c('0x9')](),controller[_0x1f3c('0xf')]);router['put'](_0x1f3c('0xc'),auth['isAuthenticated'](),controller[_0x1f3c('0x10')]);router[_0x1f3c('0x11')](_0x1f3c('0xc'),auth['isAuthenticated'](),controller[_0x1f3c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfa3c=['create','put','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x246470,_0x48a23e){var _0x5e9b23=function(_0x12e0fe){while(--_0x12e0fe){_0x246470['push'](_0x246470['shift']());}};_0x5e9b23(++_0x48a23e);}(_0xfa3c,0xf9));var _0xcfa3=function(_0x182cdd,_0x20c7d1){_0x182cdd=_0x182cdd-0x0;var _0x5c4424=_0xfa3c[_0x182cdd];return _0x5c4424;};'use strict';var multer=require(_0xcfa3('0x0'));var util=require(_0xcfa3('0x1'));var path=require(_0xcfa3('0x2'));var timeout=require('connect-timeout');var express=require(_0xcfa3('0x3'));var router=express[_0xcfa3('0x4')]();var fs_extra=require(_0xcfa3('0x5'));var auth=require(_0xcfa3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcfa3('0x7'));var controller=require(_0xcfa3('0x8'));router[_0xcfa3('0x9')]('/',auth[_0xcfa3('0xa')](),controller[_0xcfa3('0xb')]);router[_0xcfa3('0x9')](_0xcfa3('0xc'),auth['isAuthenticated'](),controller[_0xcfa3('0xd')]);router[_0xcfa3('0x9')](_0xcfa3('0xe'),auth[_0xcfa3('0xa')](),controller[_0xcfa3('0xf')]);router[_0xcfa3('0x10')]('/',auth[_0xcfa3('0xa')](),controller[_0xcfa3('0x11')]);router[_0xcfa3('0x12')](_0xcfa3('0xe'),auth[_0xcfa3('0xa')](),controller['update']);router['delete']('/:id',auth[_0xcfa3('0xa')](),controller['destroy']);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 4cd0adb..9d97d4c 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 _0xf643=['exports','STRING','ENUM','timeout','INTEGER','sequelize'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0xf643,0x113));var _0x3f64=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xf643[_0x46361e];return _0x14e302;};'use strict';var Sequelize=require(_0x3f64('0x0'));module[_0x3f64('0x1')]={'name':{'type':Sequelize[_0x3f64('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3f64('0x3')]('mouseOver',_0x3f64('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3f64('0x5')]}}; \ No newline at end of file +var _0x00df=['STRING','ENUM','mouseOver','timeout','sequelize','exports'];(function(_0x3d74d1,_0x229972){var _0x5cc835=function(_0x41406e){while(--_0x41406e){_0x3d74d1['push'](_0x3d74d1['shift']());}};_0x5cc835(++_0x229972);}(_0x00df,0xee));var _0xf00d=function(_0x17050a,_0x5830d2){_0x17050a=_0x17050a-0x0;var _0x15eca5=_0x00df[_0x17050a];return _0x15eca5;};'use strict';var Sequelize=require(_0xf00d('0x0'));module[_0xf00d('0x1')]={'name':{'type':Sequelize[_0xf00d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf00d('0x3')](_0xf00d('0x4'),_0xf00d('0x5')),'defaultValue':_0xf00d('0x4')},'selector':{'type':Sequelize[_0xf00d('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a42f544..327553c 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 _0xf3f9=['intersection','fields','attributes','find','catch','create','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xf3f9,0xb3));var _0x9f3f=function(_0x402a13,_0x1857d0){_0x402a13=_0x402a13-0x0;var _0x4db9eb=_0xf3f9[_0x402a13];return _0x4db9eb;};'use strict';var pdf=require(_0x9f3f('0x0'));var emlformat=require(_0x9f3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9f3f('0x2'));var jsonpatch=require(_0x9f3f('0x3'));var rp=require(_0x9f3f('0x4'));var moment=require(_0x9f3f('0x5'));var BPromise=require(_0x9f3f('0x6'));var Mustache=require(_0x9f3f('0x7'));var util=require('util');var path=require(_0x9f3f('0x8'));var sox=require(_0x9f3f('0x9'));var csv=require(_0x9f3f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f3f('0xb'));var _=require(_0x9f3f('0xc'));var squel=require(_0x9f3f('0xd'));var crypto=require('crypto');var jsforce=require(_0x9f3f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9f3f('0xa'));var querystring=require(_0x9f3f('0xf'));var Papa=require(_0x9f3f('0x10'));var Redis=require(_0x9f3f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f3f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f3f('0x13'));var logger=require(_0x9f3f('0x14'))(_0x9f3f('0x15'));var utils=require(_0x9f3f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9f3f('0x17'));var db=require(_0x9f3f('0x18'))['db'];function respondWithStatusCode(_0x1f587c,_0x58ece0){_0x58ece0=_0x58ece0||0xcc;return function(_0x3a9e56){if(_0x3a9e56){return _0x1f587c[_0x9f3f('0x19')](_0x58ece0);}return _0x1f587c[_0x9f3f('0x1a')](_0x58ece0)[_0x9f3f('0x1b')]();};}function respondWithResult(_0x526936,_0x3f353f){_0x3f353f=_0x3f353f||0xc8;return function(_0x210181){if(_0x210181){return _0x526936[_0x9f3f('0x1a')](_0x3f353f)['json'](_0x210181);}};}function respondWithFilteredResult(_0x2bda1a,_0x2d5a49){return function(_0x1243ff){if(_0x1243ff){var _0x3e2cd9=_0x1243ff[_0x9f3f('0x1c')],_0x11ca42=_0x2d5a49[_0x9f3f('0x1d')],_0x544bc1=_0x2d5a49[_0x9f3f('0x1d')]+_0x2d5a49[_0x9f3f('0x1e')],_0x3be8fb;if(_0x544bc1>=_0x3e2cd9){_0x544bc1=_0x3e2cd9;_0x3be8fb=0xc8;}else{_0x3be8fb=0xce;}_0x2bda1a['status'](_0x3be8fb);return _0x2bda1a[_0x9f3f('0x1f')](_0x9f3f('0x20'),_0x11ca42+'-'+_0x544bc1+'/'+_0x3e2cd9)[_0x9f3f('0x21')](_0x1243ff);}return null;};}function patchUpdates(_0x33099a){return function(_0x1e3653){try{jsonpatch[_0x9f3f('0x22')](_0x1e3653,_0x33099a,!![]);}catch(_0x463dab){return BPromise[_0x9f3f('0x23')](_0x463dab);}return _0x1e3653[_0x9f3f('0x24')]();};}function saveUpdates(_0x2834c5,_0x2f711c){return function(_0x4b9560){if(_0x4b9560){return _0x4b9560['update'](_0x2834c5)[_0x9f3f('0x25')](function(_0x2ea7cc){return _0x2ea7cc;});}return null;};}function removeEntity(_0x2f9c4f,_0x5badfe){return function(_0x3205de){if(_0x3205de){return _0x3205de[_0x9f3f('0x26')]()['then'](function(){_0x2f9c4f['status'](0xcc)[_0x9f3f('0x1b')]();});}};}function handleEntityNotFound(_0xe623de,_0x358afa){return function(_0x2e1ac8){if(!_0x2e1ac8){_0xe623de[_0x9f3f('0x19')](0x194);}return _0x2e1ac8;};}function handleError(_0x22236a,_0x15ddf6){_0x15ddf6=_0x15ddf6||0x1f4;return function(_0x45e22a){logger[_0x9f3f('0x27')](_0x45e22a['stack']);if(_0x45e22a[_0x9f3f('0x28')]){delete _0x45e22a[_0x9f3f('0x28')];}_0x22236a[_0x9f3f('0x1a')](_0x15ddf6)[_0x9f3f('0x29')](_0x45e22a);};}exports[_0x9f3f('0x2a')]=function(_0x37d18f,_0x1ac1c8){var _0x492cac={'raw':!![],'where':{'id':_0x37d18f[_0x9f3f('0x2b')]['id']}},_0x56a0f6={};_0x56a0f6[_0x9f3f('0x2c')]=_[_0x9f3f('0x2d')](db[_0x9f3f('0x2e')][_0x9f3f('0x2f')]);_0x56a0f6[_0x9f3f('0x30')]=_[_0x9f3f('0x2d')](_0x37d18f[_0x9f3f('0x30')]);_0x56a0f6['filters']=_[_0x9f3f('0x31')](_0x56a0f6[_0x9f3f('0x2c')],_0x56a0f6[_0x9f3f('0x30')]);_0x492cac['attributes']=_[_0x9f3f('0x31')](_0x56a0f6[_0x9f3f('0x2c')],qs[_0x9f3f('0x32')](_0x37d18f[_0x9f3f('0x30')][_0x9f3f('0x32')]));_0x492cac[_0x9f3f('0x33')]=_0x492cac[_0x9f3f('0x33')]['length']?_0x492cac['attributes']:_0x56a0f6[_0x9f3f('0x2c')];if(_0x37d18f['query']['includeAll']){_0x492cac['include']=[{'all':!![]}];}_0x492cac=_['merge']({},_0x492cac,_0x37d18f['options']);return db[_0x9f3f('0x2e')][_0x9f3f('0x34')](_0x492cac)[_0x9f3f('0x25')](handleEntityNotFound(_0x1ac1c8,null))[_0x9f3f('0x25')](respondWithResult(_0x1ac1c8,null))[_0x9f3f('0x35')](handleError(_0x1ac1c8,null));};exports[_0x9f3f('0x36')]=function(_0x49ff60,_0x2f566b){return db[_0x9f3f('0x2e')][_0x9f3f('0x36')](_0x49ff60['body'],{})[_0x9f3f('0x25')](respondWithResult(_0x2f566b,0xc9))[_0x9f3f('0x35')](handleError(_0x2f566b,null));};exports[_0x9f3f('0x37')]=function(_0x2c4bc6,_0x1defdd){if(_0x2c4bc6[_0x9f3f('0x38')]['id']){delete _0x2c4bc6[_0x9f3f('0x38')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x2c4bc6[_0x9f3f('0x2b')]['id']}})[_0x9f3f('0x25')](handleEntityNotFound(_0x1defdd,null))['then'](saveUpdates(_0x2c4bc6[_0x9f3f('0x38')],null))['then'](respondWithResult(_0x1defdd,null))[_0x9f3f('0x35')](handleError(_0x1defdd,null));};exports[_0x9f3f('0x26')]=function(_0x35fe06,_0x369ce8){return db[_0x9f3f('0x2e')]['find']({'where':{'id':_0x35fe06[_0x9f3f('0x2b')]['id']}})[_0x9f3f('0x25')](handleEntityNotFound(_0x369ce8,null))[_0x9f3f('0x25')](removeEntity(_0x369ce8,null))[_0x9f3f('0x35')](handleError(_0x369ce8,null));}; \ No newline at end of file +var _0x24e1=['status','reject','update','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatProactiveAction','find','catch','create','body','then','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit'];(function(_0x3758c7,_0x70214d){var _0x1e135f=function(_0x496731){while(--_0x496731){_0x3758c7['push'](_0x3758c7['shift']());}};_0x1e135f(++_0x70214d);}(_0x24e1,0x89));var _0x124e=function(_0x55f929,_0x497f26){_0x55f929=_0x55f929-0x0;var _0x56e0fb=_0x24e1[_0x55f929];return _0x56e0fb;};'use strict';var pdf=require(_0x124e('0x0'));var emlformat=require(_0x124e('0x1'));var rimraf=require(_0x124e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x124e('0x3'));var rp=require(_0x124e('0x4'));var moment=require(_0x124e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x124e('0x6'));var path=require(_0x124e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x124e('0x8'));var fs=require('fs');var fs_extra=require(_0x124e('0x9'));var _=require('lodash');var squel=require(_0x124e('0xa'));var crypto=require('crypto');var jsforce=require(_0x124e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x124e('0xc'));var authService=require(_0x124e('0xd'));var qs=require(_0x124e('0xe'));var as=require(_0x124e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x124e('0x10'))(_0x124e('0x11'));var utils=require(_0x124e('0x12'));var config=require(_0x124e('0x13'));var licenseUtil=require(_0x124e('0x14'));var db=require(_0x124e('0x15'))['db'];function respondWithStatusCode(_0x2c4f41,_0x1c1a17){_0x1c1a17=_0x1c1a17||0xcc;return function(_0x146068){if(_0x146068){return _0x2c4f41[_0x124e('0x16')](_0x1c1a17);}return _0x2c4f41['status'](_0x1c1a17)[_0x124e('0x17')]();};}function respondWithResult(_0x59e777,_0x2498f9){_0x2498f9=_0x2498f9||0xc8;return function(_0x4d74a0){if(_0x4d74a0){return _0x59e777['status'](_0x2498f9)[_0x124e('0x18')](_0x4d74a0);}};}function respondWithFilteredResult(_0x2faf01,_0x27924d){return function(_0x16f7ad){if(_0x16f7ad){var _0x3080b3=_0x16f7ad[_0x124e('0x19')],_0x21ec64=_0x27924d['offset'],_0x462db4=_0x27924d[_0x124e('0x1a')]+_0x27924d[_0x124e('0x1b')],_0x367793;if(_0x462db4>=_0x3080b3){_0x462db4=_0x3080b3;_0x367793=0xc8;}else{_0x367793=0xce;}_0x2faf01[_0x124e('0x1c')](_0x367793);return _0x2faf01['set']('Content-Range',_0x21ec64+'-'+_0x462db4+'/'+_0x3080b3)[_0x124e('0x18')](_0x16f7ad);}return null;};}function patchUpdates(_0x1e98ed){return function(_0x3933bb){try{jsonpatch['apply'](_0x3933bb,_0x1e98ed,!![]);}catch(_0x1b4954){return BPromise[_0x124e('0x1d')](_0x1b4954);}return _0x3933bb['save']();};}function saveUpdates(_0x57ff35,_0x4594d6){return function(_0x52998f){if(_0x52998f){return _0x52998f[_0x124e('0x1e')](_0x57ff35)['then'](function(_0x3a9afc){return _0x3a9afc;});}return null;};}function removeEntity(_0x458e34,_0x14d03b){return function(_0x4fe656){if(_0x4fe656){return _0x4fe656[_0x124e('0x1f')]()['then'](function(){_0x458e34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bedeb,_0xa8d2e2){return function(_0x282db4){if(!_0x282db4){_0x2bedeb[_0x124e('0x16')](0x194);}return _0x282db4;};}function handleError(_0x195d01,_0x28de02){_0x28de02=_0x28de02||0x1f4;return function(_0x1a8f69){logger['error'](_0x1a8f69[_0x124e('0x20')]);if(_0x1a8f69[_0x124e('0x21')]){delete _0x1a8f69[_0x124e('0x21')];}_0x195d01[_0x124e('0x1c')](_0x28de02)[_0x124e('0x22')](_0x1a8f69);};}exports[_0x124e('0x23')]=function(_0x25c1e1,_0x28f89c){var _0x142cc3={'raw':!![],'where':{'id':_0x25c1e1[_0x124e('0x24')]['id']}},_0x44bb25={};_0x44bb25[_0x124e('0x25')]=_[_0x124e('0x26')](db['ChatProactiveAction'][_0x124e('0x27')]);_0x44bb25[_0x124e('0x28')]=_[_0x124e('0x26')](_0x25c1e1[_0x124e('0x28')]);_0x44bb25[_0x124e('0x29')]=_[_0x124e('0x2a')](_0x44bb25[_0x124e('0x25')],_0x44bb25[_0x124e('0x28')]);_0x142cc3[_0x124e('0x2b')]=_[_0x124e('0x2a')](_0x44bb25[_0x124e('0x25')],qs[_0x124e('0x2c')](_0x25c1e1[_0x124e('0x28')][_0x124e('0x2c')]));_0x142cc3[_0x124e('0x2b')]=_0x142cc3['attributes'][_0x124e('0x2d')]?_0x142cc3[_0x124e('0x2b')]:_0x44bb25[_0x124e('0x25')];if(_0x25c1e1['query']['includeAll']){_0x142cc3[_0x124e('0x2e')]=[{'all':!![]}];}_0x142cc3=_[_0x124e('0x2f')]({},_0x142cc3,_0x25c1e1[_0x124e('0x30')]);return db[_0x124e('0x31')][_0x124e('0x32')](_0x142cc3)['then'](handleEntityNotFound(_0x28f89c,null))['then'](respondWithResult(_0x28f89c,null))[_0x124e('0x33')](handleError(_0x28f89c,null));};exports[_0x124e('0x34')]=function(_0x296459,_0x7bab5c){return db[_0x124e('0x31')][_0x124e('0x34')](_0x296459[_0x124e('0x35')],{})[_0x124e('0x36')](respondWithResult(_0x7bab5c,0xc9))[_0x124e('0x33')](handleError(_0x7bab5c,null));};exports[_0x124e('0x1e')]=function(_0x4e1ce3,_0x4959b2){if(_0x4e1ce3[_0x124e('0x35')]['id']){delete _0x4e1ce3[_0x124e('0x35')]['id'];}return db[_0x124e('0x31')][_0x124e('0x32')]({'where':{'id':_0x4e1ce3[_0x124e('0x24')]['id']}})['then'](handleEntityNotFound(_0x4959b2,null))[_0x124e('0x36')](saveUpdates(_0x4e1ce3[_0x124e('0x35')],null))[_0x124e('0x36')](respondWithResult(_0x4959b2,null))[_0x124e('0x33')](handleError(_0x4959b2,null));};exports[_0x124e('0x1f')]=function(_0x4b347e,_0xb8ebbc){return db['ChatProactiveAction'][_0x124e('0x32')]({'where':{'id':_0x4b347e[_0x124e('0x24')]['id']}})[_0x124e('0x36')](handleEntityNotFound(_0xb8ebbc,null))['then'](removeEntity(_0xb8ebbc,null))[_0x124e('0x33')](handleError(_0xb8ebbc,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 997bc63..109aede 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 _0x92ba=['exports','define','ChatProactiveAction','lodash','util','api','moment','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92ba,0x142));var _0xa92b=function(_0x8610da,_0xbe4d75){_0x8610da=_0x8610da-0x0;var _0x6007=_0x92ba[_0x8610da];return _0x6007;};'use strict';var _=require(_0xa92b('0x0'));var util=require(_0xa92b('0x1'));var logger=require('../../config/logger')(_0xa92b('0x2'));var moment=require(_0xa92b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa92b('0x4'));var rimraf=require(_0xa92b('0x5'));var config=require(_0xa92b('0x6'));var attributes=require(_0xa92b('0x7'));module[_0xa92b('0x8')]=function(_0x4c634b,_0xd21d8){return _0x4c634b[_0xa92b('0x9')](_0xa92b('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x604f=['util','api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x4ad871,_0x4343f3){var _0x20344f=function(_0x4c2777){while(--_0x4c2777){_0x4ad871['push'](_0x4ad871['shift']());}};_0x20344f(++_0x4343f3);}(_0x604f,0xef));var _0xf604=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x604f[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0xf604('0x0'));var util=require(_0xf604('0x1'));var logger=require('../../config/logger')(_0xf604('0x2'));var moment=require(_0xf604('0x3'));var BPromise=require('bluebird');var rp=require(_0xf604('0x4'));var fs=require('fs');var path=require(_0xf604('0x5'));var rimraf=require(_0xf604('0x6'));var config=require(_0xf604('0x7'));var attributes=require(_0xf604('0x8'));module[_0xf604('0x9')]=function(_0x3d5843,_0x573860){return _0x3d5843['define'](_0xf604('0xa'),attributes,{'tableName':_0xf604('0xb'),'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 2aafa8c..0fc1e0d 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 _0xc6e7=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x3d16f0,_0x358932){var _0x87b9f5=function(_0x70f499){while(--_0x70f499){_0x3d16f0['push'](_0x3d16f0['shift']());}};_0x87b9f5(++_0x358932);}(_0xc6e7,0x159));var _0x7c6e=function(_0x148670,_0x482f43){_0x148670=_0x148670-0x0;var _0x145ffe=_0xc6e7[_0x148670];return _0x145ffe;};'use strict';var _=require(_0x7c6e('0x0'));var util=require(_0x7c6e('0x1'));var moment=require(_0x7c6e('0x2'));var BPromise=require(_0x7c6e('0x3'));var rs=require(_0x7c6e('0x4'));var fs=require('fs');var Redis=require(_0x7c6e('0x5'));var db=require(_0x7c6e('0x6'))['db'];var utils=require(_0x7c6e('0x7'));var logger=require(_0x7c6e('0x8'))(_0x7c6e('0x9'));var config=require('../../config/environment');var jayson=require(_0x7c6e('0xa'));var client=jayson[_0x7c6e('0xb')][_0x7c6e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1335d7,_0x2d9b75,_0x4395ce){return new BPromise(function(_0x516995,_0x45d505){return client[_0x7c6e('0xd')](_0x1335d7,_0x4395ce)[_0x7c6e('0xe')](function(_0x1f3b5d){logger['info'](_0x7c6e('0xf'),_0x2d9b75,_0x7c6e('0x10'));logger[_0x7c6e('0x11')](_0x7c6e('0x12'),_0x2d9b75,'request\x20sent',JSON[_0x7c6e('0x13')](_0x1f3b5d));if(_0x1f3b5d[_0x7c6e('0x14')]){if(_0x1f3b5d[_0x7c6e('0x14')][_0x7c6e('0x15')]===0x1f4){logger[_0x7c6e('0x14')](_0x7c6e('0xf'),_0x2d9b75,_0x1f3b5d[_0x7c6e('0x14')]['message']);return _0x45d505(_0x1f3b5d[_0x7c6e('0x14')]['message']);}logger[_0x7c6e('0x14')](_0x7c6e('0xf'),_0x2d9b75,_0x1f3b5d[_0x7c6e('0x14')][_0x7c6e('0x16')]);return _0x516995(_0x1f3b5d['error'][_0x7c6e('0x16')]);}else{logger[_0x7c6e('0x17')](_0x7c6e('0xf'),_0x2d9b75,_0x7c6e('0x10'));_0x516995(_0x1f3b5d[_0x7c6e('0x18')][_0x7c6e('0x16')]);}})[_0x7c6e('0x19')](function(_0x59b0c2){logger[_0x7c6e('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d9b75,_0x59b0c2);_0x45d505(_0x59b0c2);});});} \ No newline at end of file +var _0x89fa=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45ae5d,_0x55e6d8){var _0x241106=function(_0x571e7c){while(--_0x571e7c){_0x45ae5d['push'](_0x45ae5d['shift']());}};_0x241106(++_0x55e6d8);}(_0x89fa,0xda));var _0xa89f=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x89fa[_0x470bfb];return _0x2f5d97;};'use strict';var _=require('lodash');var util=require(_0xa89f('0x0'));var moment=require(_0xa89f('0x1'));var BPromise=require(_0xa89f('0x2'));var rs=require(_0xa89f('0x3'));var fs=require('fs');var Redis=require(_0xa89f('0x4'));var db=require(_0xa89f('0x5'))['db'];var utils=require(_0xa89f('0x6'));var logger=require(_0xa89f('0x7'))(_0xa89f('0x8'));var config=require(_0xa89f('0x9'));var jayson=require(_0xa89f('0xa'));var client=jayson[_0xa89f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48bb71,_0x543bbe,_0x2c1b01){return new BPromise(function(_0x243bd0,_0x238832){return client[_0xa89f('0xc')](_0x48bb71,_0x2c1b01)[_0xa89f('0xd')](function(_0x1139f1){logger[_0xa89f('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x543bbe,_0xa89f('0xf'));logger[_0xa89f('0x10')](_0xa89f('0x11'),_0x543bbe,_0xa89f('0xf'),JSON[_0xa89f('0x12')](_0x1139f1));if(_0x1139f1['error']){if(_0x1139f1[_0xa89f('0x13')][_0xa89f('0x14')]===0x1f4){logger[_0xa89f('0x13')](_0xa89f('0x15'),_0x543bbe,_0x1139f1['error'][_0xa89f('0x16')]);return _0x238832(_0x1139f1[_0xa89f('0x13')][_0xa89f('0x16')]);}logger[_0xa89f('0x13')](_0xa89f('0x15'),_0x543bbe,_0x1139f1['error'][_0xa89f('0x16')]);return _0x243bd0(_0x1139f1['error'][_0xa89f('0x16')]);}else{logger['info'](_0xa89f('0x15'),_0x543bbe,_0xa89f('0xf'));_0x243bd0(_0x1139f1[_0xa89f('0x17')][_0xa89f('0x16')]);}})[_0xa89f('0x18')](function(_0x51e354){logger[_0xa89f('0x13')](_0xa89f('0x15'),_0x543bbe,_0x51e354);_0x238832(_0x51e354);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 7299552..a67a274 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 _0xe12c=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','put','update'];(function(_0x415cf3,_0x96cc13){var _0x1e5855=function(_0x225f18){while(--_0x225f18){_0x415cf3['push'](_0x415cf3['shift']());}};_0x1e5855(++_0x96cc13);}(_0xe12c,0x102));var _0xce12=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xe12c[_0x318840];return _0x223da4;};'use strict';var multer=require(_0xce12('0x0'));var util=require(_0xce12('0x1'));var path=require(_0xce12('0x2'));var timeout=require(_0xce12('0x3'));var express=require(_0xce12('0x4'));var router=express[_0xce12('0x5')]();var fs_extra=require(_0xce12('0x6'));var auth=require(_0xce12('0x7'));var interaction=require(_0xce12('0x8'));var config=require(_0xce12('0x9'));var controller=require('./chatProactiveAction.controller');router['get'](_0xce12('0xa'),auth[_0xce12('0xb')](),controller['show']);router['post']('/',auth[_0xce12('0xb')](),controller['create']);router[_0xce12('0xc')](_0xce12('0xa'),auth[_0xce12('0xb')](),controller[_0xce12('0xd')]);router[_0xce12('0xe')](_0xce12('0xa'),auth[_0xce12('0xb')](),controller[_0xce12('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7ecf=['/:id','isAuthenticated','post','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0xcbb7eb,_0x52108a){var _0x7785f5=function(_0x36f42f){while(--_0x36f42f){_0xcbb7eb['push'](_0xcbb7eb['shift']());}};_0x7785f5(++_0x52108a);}(_0x7ecf,0x19c));var _0xf7ec=function(_0x936a9a,_0x5834f9){_0x936a9a=_0x936a9a-0x0;var _0x5393da=_0x7ecf[_0x936a9a];return _0x5393da;};'use strict';var multer=require(_0xf7ec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf7ec('0x1'));var express=require(_0xf7ec('0x2'));var router=express[_0xf7ec('0x3')]();var fs_extra=require(_0xf7ec('0x4'));var auth=require(_0xf7ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf7ec('0x6'));var controller=require('./chatProactiveAction.controller');router[_0xf7ec('0x7')](_0xf7ec('0x8'),auth[_0xf7ec('0x9')](),controller['show']);router[_0xf7ec('0xa')]('/',auth[_0xf7ec('0x9')](),controller['create']);router[_0xf7ec('0xb')]('/:id',auth[_0xf7ec('0x9')](),controller['update']);router[_0xf7ec('0xc')](_0xf7ec('0x8'),auth[_0xf7ec('0x9')](),controller[_0xf7ec('0xd')]);module[_0xf7ec('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 5a72cfb..3bdb6b8 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 _0xf188=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2cf66a,_0x11eed3){var _0x14e4d9=function(_0x5ccf37){while(--_0x5ccf37){_0x2cf66a['push'](_0x2cf66a['shift']());}};_0x14e4d9(++_0x11eed3);}(_0xf188,0xca));var _0x8f18=function(_0x325f3a,_0x34efe5){_0x325f3a=_0x325f3a-0x0;var _0x27ca90=_0xf188[_0x325f3a];return _0x27ca90;};'use strict';var Sequelize=require(_0x8f18('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f18('0x1')],'unique':_0x8f18('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8f18('0x1')]},'timeout':{'type':Sequelize[_0x8f18('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f18('0x4')](_0x8f18('0x5'),_0x8f18('0x6'),_0x8f18('0x7'))}}; \ No newline at end of file +var _0xfe25=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x4794b5,_0x34efd1){var _0x1ff218=function(_0x1dd96f){while(--_0x1dd96f){_0x4794b5['push'](_0x4794b5['shift']());}};_0x1ff218(++_0x34efd1);}(_0xfe25,0x169));var _0x5fe2=function(_0x54fbe9,_0x1d9171){_0x54fbe9=_0x54fbe9-0x0;var _0x1e5271=_0xfe25[_0x54fbe9];return _0x1e5271;};'use strict';var Sequelize=require(_0x5fe2('0x0'));module[_0x5fe2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5fe2('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5fe2('0x3')](_0x5fe2('0x4'),_0x5fe2('0x5'),_0x5fe2('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f857a1c..fc6da5c 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 _0xa9e0=['request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','then','get','ChatQueues','UserProfileResource','destroy','stack','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','options','ChatQueue','count','includeAll','include','findAll','rows','show','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','describe','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);var jayson=require(_0x0a9e('0x1b'));var client=jayson[_0x0a9e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22dccb,_0x5d0880,_0x1985b6,_0x519dfd){return new BPromise(function(_0x16033c,_0x12066b){var _0x48f32d=_0x519dfd||client;return _0x48f32d[_0x0a9e('0x1d')](_0x22dccb,_0x1985b6)['then'](function(_0x459eb1){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x5d0880,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x459eb1));if(_0x459eb1[_0x0a9e('0x24')]){if(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')]('ChatQueue,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x459eb1['error'][_0x0a9e('0x26')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x16033c(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger['info'](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));_0x16033c(_0x459eb1[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x42ac8f){logger[_0x0a9e('0x24')]('ChatQueue,\x20%s,\x20%s',_0x5d0880,_0x42ac8f);_0x12066b(_0x42ac8f);});});}function respondWithStatusCode(_0x59181e,_0x197ec0){_0x197ec0=_0x197ec0||0xcc;return function(_0x3a8e58){if(_0x3a8e58){return _0x59181e[_0x0a9e('0x29')](_0x197ec0);}return _0x59181e[_0x0a9e('0x2a')](_0x197ec0)['end']();};}function respondWithResult(_0x384319,_0x479bc4){_0x479bc4=_0x479bc4||0xc8;return function(_0x45a1e7){if(_0x45a1e7){return _0x384319['status'](_0x479bc4)[_0x0a9e('0x2b')](_0x45a1e7);}};}function respondWithFilteredResult(_0x34dc65,_0x25fba9){return function(_0x14433c){if(_0x14433c){var _0x140511=_0x14433c['count'],_0x1538a4=_0x25fba9[_0x0a9e('0x2c')],_0x11c3b6=_0x25fba9[_0x0a9e('0x2c')]+_0x25fba9[_0x0a9e('0x2d')],_0x14de77;if(_0x11c3b6>=_0x140511){_0x11c3b6=_0x140511;_0x14de77=0xc8;}else{_0x14de77=0xce;}_0x34dc65[_0x0a9e('0x2a')](_0x14de77);return _0x34dc65['set'](_0x0a9e('0x2e'),_0x1538a4+'-'+_0x11c3b6+'/'+_0x140511)[_0x0a9e('0x2b')](_0x14433c);}return null;};}function patchUpdates(_0x1843b2){return function(_0x824a4f){try{jsonpatch[_0x0a9e('0x2f')](_0x824a4f,_0x1843b2,!![]);}catch(_0x563b45){return BPromise[_0x0a9e('0x30')](_0x563b45);}return _0x824a4f[_0x0a9e('0x31')]();};}function saveUpdates(_0x1dbde2,_0x540530){return function(_0x426950){if(_0x426950){return _0x426950['update'](_0x1dbde2)[_0x0a9e('0x32')](function(_0x3ae878){return _0x3ae878;});}return null;};}function removeEntity(_0x1122db,_0x33bdb7){return function(_0x25ce3a){if(_0x25ce3a){return _0x25ce3a['destroy']()[_0x0a9e('0x32')](function(){var _0x46f0a5=_0x25ce3a[_0x0a9e('0x33')]({'plain':!![]});var _0x2da5c0=_0x0a9e('0x34');return db[_0x0a9e('0x35')][_0x0a9e('0x36')]({'where':{'type':_0x2da5c0,'resourceId':_0x46f0a5['id']}})[_0x0a9e('0x32')](function(){return _0x25ce3a;});})['then'](function(){_0x1122db[_0x0a9e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc7a0,_0x14b13f){return function(_0x2b7e7f){if(!_0x2b7e7f){_0x2cc7a0[_0x0a9e('0x29')](0x194);}return _0x2b7e7f;};}function handleError(_0x567193,_0x191e91){_0x191e91=_0x191e91||0x1f4;return function(_0xd1836d){logger[_0x0a9e('0x24')](_0xd1836d[_0x0a9e('0x37')]);if(_0xd1836d['name']){delete _0xd1836d['name'];}_0x567193[_0x0a9e('0x2a')](_0x191e91)['send'](_0xd1836d);};}exports[_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x39')](db['ChatQueue'][_0x0a9e('0x3a')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3b')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x39')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x3d9717[_0x0a9e('0x3d')]);_0x4f41ae[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x40')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x3d')]['fields']));_0x1ef87a[_0x0a9e('0x40')]=_0x1ef87a[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x1ef87a[_0x0a9e('0x40')]:_0x4f41ae[_0x0a9e('0x3c')];if(!_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x1ef87a[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x1ef87a[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x3d9717[_0x0a9e('0x3d')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3d')],_0x4f41ae[_0x0a9e('0x3f')]),_0x3bfce8);if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x39')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x4a')]!==_0x0a9e('0x4b')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x4c')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4d')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x4f')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x50')]){_0x1ef87a[_0x0a9e('0x51')]=[{'all':!![]}];}return db[_0x0a9e('0x4e')][_0x0a9e('0x52')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x53')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x32')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x28')](handleError(_0x381c37,null));};exports[_0x0a9e('0x54')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':!![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['ChatQueue']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3e')](_0x992c77[_0x0a9e('0x3d')]);_0x34febd[_0x0a9e('0x3f')]=_[_0x0a9e('0x55')](_0x34febd[_0x0a9e('0x3c')],_0x34febd[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x55')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x41')]));_0x19383e[_0x0a9e('0x40')]=_0x19383e[_0x0a9e('0x40')]['length']?_0x19383e[_0x0a9e('0x40')]:_0x34febd[_0x0a9e('0x3c')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x51')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4d')]);return db['ChatQueue'][_0x0a9e('0x56')](_0x19383e)[_0x0a9e('0x32')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x32')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x57')]=function(_0x1bf38a,_0x508b47){return db['ChatQueue'][_0x0a9e('0x57')](_0x1bf38a[_0x0a9e('0x58')],{})['then'](function(_0x145931){var _0x5ce9ac=_0x1bf38a[_0x0a9e('0x59')]['get']({'plain':!![]});if(!_0x5ce9ac)throw new Error(_0x0a9e('0x5a'));if(_0x5ce9ac['role']==='user'){var _0x5df0ad=_0x145931[_0x0a9e('0x33')]({'plain':!![]});var _0x47de4c=_0x0a9e('0x34');return db[_0x0a9e('0x5b')][_0x0a9e('0x56')]({'where':{'name':_0x47de4c,'userProfileId':_0x5ce9ac[_0x0a9e('0x5c')]},'raw':!![]})[_0x0a9e('0x32')](function(_0x272738){if(_0x272738&&_0x272738[_0x0a9e('0x5d')]===0x0){return db[_0x0a9e('0x35')]['create']({'name':_0x5df0ad[_0x0a9e('0x4c')],'resourceId':_0x5df0ad['id'],'type':_0x272738[_0x0a9e('0x4c')],'sectionId':_0x272738['id']},{})[_0x0a9e('0x32')](function(){return _0x145931;});}else{return _0x145931;}})[_0x0a9e('0x28')](function(_0xb83dfd){logger[_0x0a9e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb83dfd);throw _0xb83dfd;});}return _0x145931;})[_0x0a9e('0x32')](respondWithResult(_0x508b47,0xc9))[_0x0a9e('0x28')](handleError(_0x508b47,null));};exports['update']=function(_0x3649cc,_0x5cc8fb){if(_0x3649cc[_0x0a9e('0x58')]['id']){delete _0x3649cc['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x3649cc[_0x0a9e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5cc8fb,null))[_0x0a9e('0x32')](saveUpdates(_0x3649cc[_0x0a9e('0x58')],null))[_0x0a9e('0x32')](respondWithResult(_0x5cc8fb,null))[_0x0a9e('0x28')](handleError(_0x5cc8fb,null));};exports[_0x0a9e('0x36')]=function(_0x26d7db,_0x49eed0){return db[_0x0a9e('0x4e')]['find']({'where':{'id':_0x26d7db[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x49eed0,null))[_0x0a9e('0x32')](removeEntity(_0x49eed0,null))['catch'](handleError(_0x49eed0,null));};exports[_0x0a9e('0x5f')]=function(_0x156f1c,_0x119677){return db[_0x0a9e('0x4e')]['describe']()[_0x0a9e('0x32')](respondWithResult(_0x119677,null))[_0x0a9e('0x28')](handleError(_0x119677,null));};exports['getMembers']=function(_0x797b45,_0x17e88c,_0x88dcbf){var _0x409b29={'raw':!![],'where':{}},_0x401837={},_0x4d4a35;return db[_0x0a9e('0x4e')][_0x0a9e('0x60')]({'where':{'id':_0x797b45[_0x0a9e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x17e88c,null))[_0x0a9e('0x32')](function(_0x4f1e60){if(_0x4f1e60){_0x4d4a35=_0x4f1e60['get']({'plain':!![]});_0x401837[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x61')][_0x0a9e('0x3a')]);_0x401837[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x797b45[_0x0a9e('0x3d')]);_0x401837[_0x0a9e('0x3f')]=_[_0x0a9e('0x55')](_0x401837[_0x0a9e('0x3c')],_0x401837[_0x0a9e('0x3d')]);_0x409b29[_0x0a9e('0x40')]=_[_0x0a9e('0x55')](_0x401837[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x409b29[_0x0a9e('0x40')]=_0x409b29['attributes'][_0x0a9e('0x42')]?_0x409b29[_0x0a9e('0x40')]:_0x401837[_0x0a9e('0x3c')];if(!_0x797b45['query'][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x409b29['limit']=qs[_0x0a9e('0x2d')](_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x409b29[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x797b45['query']['offset']);}_0x409b29['order']=qs[_0x0a9e('0x45')](_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x409b29[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x797b45[_0x0a9e('0x3d')],_0x401837[_0x0a9e('0x3f')]));_0x409b29['where'][_0x0a9e('0x62')]=_0x4f1e60['id'];if(_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x409b29['where']=_[_0x0a9e('0x49')](_0x409b29['where'],{'$or':_[_0x0a9e('0x39')](_0x409b29[_0x0a9e('0x40')],function(_0x4c46c1){var _0x2ed01e={};_0x2ed01e[_0x4c46c1]={'$like':'%'+_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2ed01e;})});}_0x409b29=_[_0x0a9e('0x49')]({},_0x409b29,_0x797b45['options']);return db[_0x0a9e('0x61')][_0x0a9e('0x52')](_0x409b29);}})[_0x0a9e('0x32')](function(_0x278ab4){if(_0x278ab4){return db['User'][_0x0a9e('0x63')]({'where':{'id':_[_0x0a9e('0x39')](_0x278ab4,_0x0a9e('0x64')),'role':_0x0a9e('0x65')},'attributes':['id','name',_0x0a9e('0x66'),_0x0a9e('0x67'),_0x0a9e('0x68')]});}})[_0x0a9e('0x32')](function(_0x332367){if(_0x332367){return{'count':_0x332367[_0x0a9e('0x4f')],'rows':_[_0x0a9e('0x39')](_0x332367[_0x0a9e('0x53')],function(_0x1a7b03){return{'membername':_0x1a7b03[_0x0a9e('0x4c')],'UserId':_0x1a7b03['id'],'queue_name':_0x4d4a35[_0x0a9e('0x4c')],'ChatQueueId':_0x4d4a35['id'],'interface':util[_0x0a9e('0x69')](_0x0a9e('0x6a'),_0x0a9e('0x6b'),_0x1a7b03['name']),'penalty':0x0,'paused':_0x1a7b03[_0x0a9e('0x66')],'createdAt':_0x1a7b03[_0x0a9e('0x68')],'updatedAt':_0x1a7b03[_0x0a9e('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x17e88c,_0x409b29))[_0x0a9e('0x28')](handleError(_0x17e88c,null));};exports[_0x0a9e('0x6c')]=function(_0x8cea96,_0x2b9463,_0x56d650){var _0x541e80={};var _0x7ebea8={};var _0x2bbdb5;var _0x4c54fa;return db[_0x0a9e('0x4e')]['findOne']({'where':{'id':_0x8cea96[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x2b9463,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5=_0x28a942;_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x6d')][_0x0a9e('0x3a')]);_0x7ebea8[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x8cea96['query']);_0x7ebea8[_0x0a9e('0x3f')]=_[_0x0a9e('0x55')](_0x7ebea8[_0x0a9e('0x3c')],_0x7ebea8[_0x0a9e('0x3d')]);_0x541e80['attributes']=_[_0x0a9e('0x55')](_0x7ebea8[_0x0a9e('0x3c')],qs['fields'](_0x8cea96[_0x0a9e('0x3d')]['fields']));_0x541e80[_0x0a9e('0x40')]=_0x541e80[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x541e80[_0x0a9e('0x40')]:_0x7ebea8['model'];_0x541e80['order']=qs[_0x0a9e('0x45')](_0x8cea96[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x541e80['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x8cea96['query'],_0x7ebea8['filters']));if(_0x8cea96[_0x0a9e('0x3d')]['filter']){_0x541e80['where']=_['merge'](_0x541e80[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x39')](_0x541e80[_0x0a9e('0x40')],function(_0x3bfadf){var _0x3c6dd6={};_0x3c6dd6[_0x3bfadf]={'$like':'%'+_0x8cea96[_0x0a9e('0x3d')]['filter']+'%'};return _0x3c6dd6;})});}_0x541e80=_[_0x0a9e('0x49')]({},_0x541e80,_0x8cea96['options']);return _0x2bbdb5[_0x0a9e('0x6c')](_0x541e80);}})[_0x0a9e('0x32')](function(_0x18ad56){if(_0x18ad56){_0x4c54fa=_0x18ad56[_0x0a9e('0x42')];if(!_0x8cea96['query'][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x541e80[_0x0a9e('0x2d')]=qs['limit'](_0x8cea96[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x541e80[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x8cea96[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x2bbdb5[_0x0a9e('0x6c')](_0x541e80);}})[_0x0a9e('0x32')](function(_0x509efe){if(_0x509efe){return _0x509efe?{'count':_0x4c54fa,'rows':_0x509efe}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x2b9463,null))[_0x0a9e('0x28')](handleError(_0x2b9463,null));};exports['addTeams']=function(_0x40e0f0,_0x982340,_0x3a1974){var _0x5a26c8=_0x40e0f0[_0x0a9e('0x58')]['ids'];return db[_0x0a9e('0x6d')][_0x0a9e('0x52')]({'where':{'id':_0x5a26c8},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x6e')],'as':_0x0a9e('0x6f'),'attributes':['id',_0x0a9e('0x4c'),_0x0a9e('0x70'),_0x0a9e('0x71'),_0x0a9e('0x72')],'raw':!![]}]})['then'](function(_0x329d88){if(_0x329d88){var _0x31d25a=_[_0x0a9e('0x73')](_0x329d88,function(_0x30ef6e){var _0x28e60a=_0x30ef6e[_0x0a9e('0x33')]({'plain':!![]});return _0x28e60a[_0x0a9e('0x6f')];});return db[_0x0a9e('0x4e')][_0x0a9e('0x56')]({'where':{'id':_0x40e0f0[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](function(_0x3754e2){return db[_0x0a9e('0x74')]['transaction'](function(_0xc81b64){return _0x3754e2[_0x0a9e('0x75')](_0x5a26c8,{'transaction':_0xc81b64})[_0x0a9e('0x32')](function(){return BPromise[_0x0a9e('0x76')](_0x31d25a,function(_0xb0599a){return db['UserChatQueue'][_0x0a9e('0x77')]({'where':{'UserId':_0xb0599a['id'],'ChatQueueId':_0x40e0f0[_0x0a9e('0x5e')]['id']},'transaction':_0xc81b64});});})['then'](function(){_0x31d25a[_0x0a9e('0x78')](function(_0x5e725e){socket[_0x0a9e('0x79')](_0x0a9e('0x7a'),{'UserId':_0x5e725e['id'],'ChatQueueId':_0x3754e2['id']});});});});});}})[_0x0a9e('0x32')](respondWithStatusCode(_0x982340,null))[_0x0a9e('0x28')](handleError(_0x982340,null));};exports['removeTeams']=function(_0x3ceba6,_0x4cf72d,_0x2ec396){return db[_0x0a9e('0x6d')]['findAll']({'where':{'id':_0x3ceba6[_0x0a9e('0x3d')][_0x0a9e('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4cf72d,null))[_0x0a9e('0x32')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0x39')](_0x6ba2be,'id');var _0x3f2f40=[];var _0x2450a8=[];var _0x17793e=squel[_0x0a9e('0x7c')]();_0x17793e[_0x0a9e('0x7d')]('tq.TeamId')[_0x0a9e('0x7e')]('team_has_chat_queues','tq')[_0x0a9e('0x7f')](_0x0a9e('0x80'),'ut',_0x0a9e('0x81'))[_0x0a9e('0x46')](_0x0a9e('0x82'),_0x3ceba6['params']['id']);for(var _0x436313=0x0;_0x436313<_0x6ba2be[_0x0a9e('0x42')];_0x436313+=0x1){let _0x2791c5=_0x6ba2be[_0x436313];for(var _0x2aa5f2=0x0;_0x2aa5f2<_0x2791c5[_0x0a9e('0x6f')]['length'];_0x2aa5f2+=0x1){let _0x4f074c=_0x2791c5[_0x0a9e('0x6f')][_0x2aa5f2];var _0x583662=_0x17793e[_0x0a9e('0x83')]();_0x583662[_0x0a9e('0x46')](_0x0a9e('0x84'),_0x4f074c['id']);_0x2450a8[_0x0a9e('0x85')](db[_0x0a9e('0x74')][_0x0a9e('0x3d')](_0x583662['toString'](),{'type':db['sequelize'][_0x0a9e('0x86')]['SELECT']})[_0x0a9e('0x32')](function(_0x5c689c){if(_0x5c689c[_0x0a9e('0x42')]===0x1){return _0x4f074c['id'];}else{var _0x564db2=_['every'](_[_0x0a9e('0x39')](_0x5c689c,_0x0a9e('0x87')),function(_0x5e9b0b){return _[_0x0a9e('0x88')](_0x1707dc,_0x5e9b0b);});if(_0x564db2){return _0x4f074c['id'];}}}));}}return BPromise[_0x0a9e('0x89')](_0x2450a8)[_0x0a9e('0x32')](function(_0xa1bc84){_0x3f2f40=_(_0x3f2f40)[_0x0a9e('0x8a')](_0xa1bc84)['compact']()['value']();return db[_0x0a9e('0x4e')][_0x0a9e('0x56')]({'where':{'id':_0x3ceba6[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](function(_0x59303b){return db['sequelize'][_0x0a9e('0x8b')](function(_0xadce3d){return _0x59303b['removeTeams'](_0x3ceba6[_0x0a9e('0x3d')][_0x0a9e('0x7b')],{'transaction':_0xadce3d})[_0x0a9e('0x32')](function(){if(!_[_0x0a9e('0x8c')](_0x3f2f40)){return _0x59303b[_0x0a9e('0x8d')](_0x3f2f40,{'transaction':_0xadce3d});}})[_0x0a9e('0x32')](function(){_0x3f2f40[_0x0a9e('0x78')](function(_0x476993){socket[_0x0a9e('0x79')](_0x0a9e('0x8e'),{'UserId':_0x476993,'ChatQueueId':_0x59303b['id']});});});});});});})['then'](respondWithStatusCode(_0x4cf72d,null))[_0x0a9e('0x28')](handleError(_0x4cf72d,null));};exports[_0x0a9e('0x8f')]=function(_0x2ada60,_0x1c4232,_0x1d0b02){return db['ChatQueue']['find']({'where':{'id':_0x2ada60[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x1c4232,null))[_0x0a9e('0x32')](function(_0x2fea95){if(_0x2fea95){return _0x2fea95[_0x0a9e('0x8f')](_0x2ada60['body'][_0x0a9e('0x7b')],_[_0x0a9e('0x90')](_0x2ada60[_0x0a9e('0x58')],['ids','id'])||{})[_0x0a9e('0x91')](function(_0x59aa7b){for(var _0x2144ca=0x0;_0x2144ca<_0x2ada60['body'][_0x0a9e('0x7b')][_0x0a9e('0x42')];_0x2144ca+=0x1){socket[_0x0a9e('0x79')]('userChatQueue:save',{'UserId':_0x2ada60[_0x0a9e('0x58')]['ids'][_0x2144ca],'ChatQueueId':_0x2ada60[_0x0a9e('0x5e')]['id']});}return _0x59aa7b;});}})[_0x0a9e('0x32')](respondWithResult(_0x1c4232,null))[_0x0a9e('0x28')](handleError(_0x1c4232,null));};exports[_0x0a9e('0x8d')]=function(_0x3a5836,_0x1bee04,_0x4014c7){return db[_0x0a9e('0x4e')][_0x0a9e('0x56')]({'where':{'id':_0x3a5836[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x1bee04,null))[_0x0a9e('0x32')](function(_0x2415fe){if(_0x2415fe){return _0x2415fe[_0x0a9e('0x8d')](_0x3a5836[_0x0a9e('0x3d')][_0x0a9e('0x7b')])['then'](function(){if(_['isArray'](_0x3a5836[_0x0a9e('0x3d')]['ids'])){for(var _0x1d999b=0x0;_0x1d999b<_0x3a5836[_0x0a9e('0x3d')]['ids'][_0x0a9e('0x42')];_0x1d999b+=0x1){socket[_0x0a9e('0x79')](_0x0a9e('0x8e'),{'UserId':Number(_0x3a5836[_0x0a9e('0x3d')]['ids'][_0x1d999b]),'ChatQueueId':Number(_0x3a5836[_0x0a9e('0x5e')]['id'])});}}else{socket[_0x0a9e('0x79')](_0x0a9e('0x8e'),{'UserId':Number(_0x3a5836[_0x0a9e('0x3d')]['ids']),'ChatQueueId':Number(_0x3a5836[_0x0a9e('0x5e')]['id'])});}});}})[_0x0a9e('0x32')](respondWithStatusCode(_0x1bee04,null))[_0x0a9e('0x28')](handleError(_0x1bee04,null));};exports['getAgents']=function(_0x2650eb,_0x270df8,_0x17b29d){var _0x54b107={};var _0x303f75={};var _0x4394bb;var _0x1d9b57;return db[_0x0a9e('0x4e')][_0x0a9e('0x60')]({'where':{'id':_0x2650eb['params']['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x270df8,null))[_0x0a9e('0x32')](function(_0x4795ae){if(_0x4795ae){_0x4394bb=_0x4795ae;_0x303f75[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x6e')]['rawAttributes']);_0x303f75['query']=_['keys'](_0x2650eb[_0x0a9e('0x3d')]);_0x303f75[_0x0a9e('0x3f')]=_['intersection'](_0x303f75[_0x0a9e('0x3c')],_0x303f75[_0x0a9e('0x3d')]);_0x54b107[_0x0a9e('0x40')]=_['intersection'](_0x303f75[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x54b107[_0x0a9e('0x40')]=_0x54b107[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x54b107[_0x0a9e('0x40')]:_0x303f75[_0x0a9e('0x3c')];_0x54b107['order']=qs[_0x0a9e('0x45')](_0x2650eb['query'][_0x0a9e('0x45')]);_0x54b107[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x2650eb[_0x0a9e('0x3d')],_0x303f75[_0x0a9e('0x3f')]));if(_0x2650eb['query'][_0x0a9e('0x48')]){_0x54b107[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x54b107[_0x0a9e('0x46')],{'$or':_['map'](_0x54b107[_0x0a9e('0x40')],function(_0x3c9135){var _0x43beea={};_0x43beea[_0x3c9135]={'$like':'%'+_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x43beea;})});}_0x54b107=_[_0x0a9e('0x49')]({},_0x54b107,_0x2650eb[_0x0a9e('0x4d')]);return _0x4394bb[_0x0a9e('0x92')](_0x54b107);}})[_0x0a9e('0x32')](function(_0x3539b7){if(_0x3539b7){_0x1d9b57=_0x3539b7['length'];if(!_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x54b107[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x54b107[_0x0a9e('0x2c')]=qs['offset'](_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x4394bb[_0x0a9e('0x92')](_0x54b107);}})['then'](function(_0x1402c7){if(_0x1402c7){return _0x1402c7?{'count':_0x1d9b57,'rows':_0x1402c7}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x270df8,null))[_0x0a9e('0x28')](handleError(_0x270df8,null));}; \ No newline at end of file +var _0xa9e0=['request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','then','get','ChatQueues','UserProfileResource','destroy','stack','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','options','ChatQueue','count','includeAll','include','findAll','rows','show','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','describe','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);var jayson=require(_0x0a9e('0x1b'));var client=jayson[_0x0a9e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22dccb,_0x5d0880,_0x1985b6,_0x519dfd){return new BPromise(function(_0x16033c,_0x12066b){var _0x48f32d=_0x519dfd||client;return _0x48f32d[_0x0a9e('0x1d')](_0x22dccb,_0x1985b6)['then'](function(_0x459eb1){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x5d0880,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x459eb1));if(_0x459eb1[_0x0a9e('0x24')]){if(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')]('ChatQueue,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x459eb1['error'][_0x0a9e('0x26')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x16033c(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger['info'](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));_0x16033c(_0x459eb1[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x42ac8f){logger[_0x0a9e('0x24')]('ChatQueue,\x20%s,\x20%s',_0x5d0880,_0x42ac8f);_0x12066b(_0x42ac8f);});});}function respondWithStatusCode(_0x59181e,_0x197ec0){_0x197ec0=_0x197ec0||0xcc;return function(_0x3a8e58){if(_0x3a8e58){return _0x59181e[_0x0a9e('0x29')](_0x197ec0);}return _0x59181e[_0x0a9e('0x2a')](_0x197ec0)['end']();};}function respondWithResult(_0x384319,_0x479bc4){_0x479bc4=_0x479bc4||0xc8;return function(_0x45a1e7){if(_0x45a1e7){return _0x384319['status'](_0x479bc4)[_0x0a9e('0x2b')](_0x45a1e7);}};}function respondWithFilteredResult(_0x34dc65,_0x25fba9){return function(_0x14433c){if(_0x14433c){var _0x140511=_0x14433c['count'],_0x1538a4=_0x25fba9[_0x0a9e('0x2c')],_0x11c3b6=_0x25fba9[_0x0a9e('0x2c')]+_0x25fba9[_0x0a9e('0x2d')],_0x14de77;if(_0x11c3b6>=_0x140511){_0x11c3b6=_0x140511;_0x14de77=0xc8;}else{_0x14de77=0xce;}_0x34dc65[_0x0a9e('0x2a')](_0x14de77);return _0x34dc65['set'](_0x0a9e('0x2e'),_0x1538a4+'-'+_0x11c3b6+'/'+_0x140511)[_0x0a9e('0x2b')](_0x14433c);}return null;};}function patchUpdates(_0x1843b2){return function(_0x824a4f){try{jsonpatch[_0x0a9e('0x2f')](_0x824a4f,_0x1843b2,!![]);}catch(_0x563b45){return BPromise[_0x0a9e('0x30')](_0x563b45);}return _0x824a4f[_0x0a9e('0x31')]();};}function saveUpdates(_0x1dbde2,_0x540530){return function(_0x426950){if(_0x426950){return _0x426950['update'](_0x1dbde2)[_0x0a9e('0x32')](function(_0x3ae878){return _0x3ae878;});}return null;};}function removeEntity(_0x1122db,_0x33bdb7){return function(_0x25ce3a){if(_0x25ce3a){return _0x25ce3a['destroy']()[_0x0a9e('0x32')](function(){var _0x46f0a5=_0x25ce3a[_0x0a9e('0x33')]({'plain':!![]});var _0x2da5c0=_0x0a9e('0x34');return db[_0x0a9e('0x35')][_0x0a9e('0x36')]({'where':{'type':_0x2da5c0,'resourceId':_0x46f0a5['id']}})[_0x0a9e('0x32')](function(){return _0x25ce3a;});})['then'](function(){_0x1122db[_0x0a9e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc7a0,_0x14b13f){return function(_0x2b7e7f){if(!_0x2b7e7f){_0x2cc7a0[_0x0a9e('0x29')](0x194);}return _0x2b7e7f;};}function handleError(_0x567193,_0x191e91){_0x191e91=_0x191e91||0x1f4;return function(_0xd1836d){logger[_0x0a9e('0x24')](_0xd1836d[_0x0a9e('0x37')]);if(_0xd1836d['name']){delete _0xd1836d['name'];}_0x567193[_0x0a9e('0x2a')](_0x191e91)['send'](_0xd1836d);};}exports[_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x39')](db['ChatQueue'][_0x0a9e('0x3a')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3b')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x39')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x3d9717[_0x0a9e('0x3d')]);_0x4f41ae[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x40')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x3d')]['fields']));_0x1ef87a[_0x0a9e('0x40')]=_0x1ef87a[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x1ef87a[_0x0a9e('0x40')]:_0x4f41ae[_0x0a9e('0x3c')];if(!_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x1ef87a[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x1ef87a[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x3d9717[_0x0a9e('0x3d')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3d')],_0x4f41ae[_0x0a9e('0x3f')]),_0x3bfce8);if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x39')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x4a')]!==_0x0a9e('0x4b')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x4c')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4d')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x4f')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x50')]){_0x1ef87a[_0x0a9e('0x51')]=[{'all':!![]}];}return db[_0x0a9e('0x4e')][_0x0a9e('0x52')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x53')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x32')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x28')](handleError(_0x381c37,null));};exports[_0x0a9e('0x54')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':!![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['ChatQueue']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3e')](_0x992c77[_0x0a9e('0x3d')]);_0x34febd[_0x0a9e('0x3f')]=_[_0x0a9e('0x55')](_0x34febd[_0x0a9e('0x3c')],_0x34febd[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x55')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x41')]));_0x19383e[_0x0a9e('0x40')]=_0x19383e[_0x0a9e('0x40')]['length']?_0x19383e[_0x0a9e('0x40')]:_0x34febd[_0x0a9e('0x3c')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x51')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4d')]);return db['ChatQueue'][_0x0a9e('0x56')](_0x19383e)[_0x0a9e('0x32')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x32')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x57')]=function(_0x1bf38a,_0x508b47){return db['ChatQueue'][_0x0a9e('0x57')](_0x1bf38a[_0x0a9e('0x58')],{})['then'](function(_0x145931){var _0x5ce9ac=_0x1bf38a[_0x0a9e('0x59')]['get']({'plain':!![]});if(!_0x5ce9ac)throw new Error(_0x0a9e('0x5a'));if(_0x5ce9ac['role']==='user'){var _0x5df0ad=_0x145931[_0x0a9e('0x33')]({'plain':!![]});var _0x47de4c=_0x0a9e('0x34');return db[_0x0a9e('0x5b')][_0x0a9e('0x56')]({'where':{'name':_0x47de4c,'userProfileId':_0x5ce9ac[_0x0a9e('0x5c')]},'raw':!![]})[_0x0a9e('0x32')](function(_0x272738){if(_0x272738&&_0x272738[_0x0a9e('0x5d')]===0x0){return db[_0x0a9e('0x35')]['create']({'name':_0x5df0ad[_0x0a9e('0x4c')],'resourceId':_0x5df0ad['id'],'type':_0x272738[_0x0a9e('0x4c')],'sectionId':_0x272738['id']},{})[_0x0a9e('0x32')](function(){return _0x145931;});}else{return _0x145931;}})[_0x0a9e('0x28')](function(_0xb83dfd){logger[_0x0a9e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb83dfd);throw _0xb83dfd;});}return _0x145931;})[_0x0a9e('0x32')](respondWithResult(_0x508b47,0xc9))[_0x0a9e('0x28')](handleError(_0x508b47,null));};exports['update']=function(_0x3649cc,_0x5cc8fb){if(_0x3649cc[_0x0a9e('0x58')]['id']){delete _0x3649cc['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x3649cc[_0x0a9e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5cc8fb,null))[_0x0a9e('0x32')](saveUpdates(_0x3649cc[_0x0a9e('0x58')],null))[_0x0a9e('0x32')](respondWithResult(_0x5cc8fb,null))[_0x0a9e('0x28')](handleError(_0x5cc8fb,null));};exports[_0x0a9e('0x36')]=function(_0x26d7db,_0x49eed0){return db[_0x0a9e('0x4e')]['find']({'where':{'id':_0x26d7db[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x49eed0,null))[_0x0a9e('0x32')](removeEntity(_0x49eed0,null))['catch'](handleError(_0x49eed0,null));};exports[_0x0a9e('0x5f')]=function(_0x156f1c,_0x119677){return db[_0x0a9e('0x4e')]['describe']()[_0x0a9e('0x32')](respondWithResult(_0x119677,null))[_0x0a9e('0x28')](handleError(_0x119677,null));};exports['getMembers']=function(_0x797b45,_0x17e88c,_0x88dcbf){var _0x409b29={'raw':!![],'where':{}},_0x401837={},_0x4d4a35;return db[_0x0a9e('0x4e')][_0x0a9e('0x60')]({'where':{'id':_0x797b45[_0x0a9e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x17e88c,null))[_0x0a9e('0x32')](function(_0x4f1e60){if(_0x4f1e60){_0x4d4a35=_0x4f1e60['get']({'plain':!![]});_0x401837[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x61')][_0x0a9e('0x3a')]);_0x401837[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x797b45[_0x0a9e('0x3d')]);_0x401837[_0x0a9e('0x3f')]=_[_0x0a9e('0x55')](_0x401837[_0x0a9e('0x3c')],_0x401837[_0x0a9e('0x3d')]);_0x409b29[_0x0a9e('0x40')]=_[_0x0a9e('0x55')](_0x401837[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x409b29[_0x0a9e('0x40')]=_0x409b29['attributes'][_0x0a9e('0x42')]?_0x409b29[_0x0a9e('0x40')]:_0x401837[_0x0a9e('0x3c')];if(!_0x797b45['query'][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x409b29['limit']=qs[_0x0a9e('0x2d')](_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x409b29[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x797b45['query']['offset']);}_0x409b29['order']=qs[_0x0a9e('0x45')](_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x409b29[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x797b45[_0x0a9e('0x3d')],_0x401837[_0x0a9e('0x3f')]));_0x409b29['where'][_0x0a9e('0x62')]=_0x4f1e60['id'];if(_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x409b29['where']=_[_0x0a9e('0x49')](_0x409b29['where'],{'$or':_[_0x0a9e('0x39')](_0x409b29[_0x0a9e('0x40')],function(_0x4c46c1){var _0x2ed01e={};_0x2ed01e[_0x4c46c1]={'$like':'%'+_0x797b45[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2ed01e;})});}_0x409b29=_[_0x0a9e('0x49')]({},_0x409b29,_0x797b45['options']);return db[_0x0a9e('0x61')][_0x0a9e('0x52')](_0x409b29);}})[_0x0a9e('0x32')](function(_0x278ab4){if(_0x278ab4){return db['User'][_0x0a9e('0x63')]({'where':{'id':_[_0x0a9e('0x39')](_0x278ab4,_0x0a9e('0x64')),'role':_0x0a9e('0x65')},'attributes':['id','name',_0x0a9e('0x66'),_0x0a9e('0x67'),_0x0a9e('0x68')]});}})[_0x0a9e('0x32')](function(_0x332367){if(_0x332367){return{'count':_0x332367[_0x0a9e('0x4f')],'rows':_[_0x0a9e('0x39')](_0x332367[_0x0a9e('0x53')],function(_0x1a7b03){return{'membername':_0x1a7b03[_0x0a9e('0x4c')],'UserId':_0x1a7b03['id'],'queue_name':_0x4d4a35[_0x0a9e('0x4c')],'ChatQueueId':_0x4d4a35['id'],'interface':util[_0x0a9e('0x69')](_0x0a9e('0x6a'),_0x0a9e('0x6b'),_0x1a7b03['name']),'penalty':0x0,'paused':_0x1a7b03[_0x0a9e('0x66')],'createdAt':_0x1a7b03[_0x0a9e('0x68')],'updatedAt':_0x1a7b03[_0x0a9e('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x17e88c,_0x409b29))[_0x0a9e('0x28')](handleError(_0x17e88c,null));};exports[_0x0a9e('0x6c')]=function(_0x8cea96,_0x2b9463,_0x56d650){var _0x541e80={};var _0x7ebea8={};var _0x2bbdb5;var _0x4c54fa;return db[_0x0a9e('0x4e')]['findOne']({'where':{'id':_0x8cea96[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x2b9463,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5=_0x28a942;_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x6d')][_0x0a9e('0x3a')]);_0x7ebea8[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x8cea96['query']);_0x7ebea8[_0x0a9e('0x3f')]=_[_0x0a9e('0x55')](_0x7ebea8[_0x0a9e('0x3c')],_0x7ebea8[_0x0a9e('0x3d')]);_0x541e80['attributes']=_[_0x0a9e('0x55')](_0x7ebea8[_0x0a9e('0x3c')],qs['fields'](_0x8cea96[_0x0a9e('0x3d')]['fields']));_0x541e80[_0x0a9e('0x40')]=_0x541e80[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x541e80[_0x0a9e('0x40')]:_0x7ebea8['model'];_0x541e80['order']=qs[_0x0a9e('0x45')](_0x8cea96[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x541e80['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x8cea96['query'],_0x7ebea8['filters']));if(_0x8cea96[_0x0a9e('0x3d')]['filter']){_0x541e80['where']=_['merge'](_0x541e80[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x39')](_0x541e80[_0x0a9e('0x40')],function(_0x3bfadf){var _0x3c6dd6={};_0x3c6dd6[_0x3bfadf]={'$like':'%'+_0x8cea96[_0x0a9e('0x3d')]['filter']+'%'};return _0x3c6dd6;})});}_0x541e80=_[_0x0a9e('0x49')]({},_0x541e80,_0x8cea96['options']);return _0x2bbdb5[_0x0a9e('0x6c')](_0x541e80);}})[_0x0a9e('0x32')](function(_0x18ad56){if(_0x18ad56){_0x4c54fa=_0x18ad56[_0x0a9e('0x42')];if(!_0x8cea96['query'][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x541e80[_0x0a9e('0x2d')]=qs['limit'](_0x8cea96[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x541e80[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x8cea96[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x2bbdb5[_0x0a9e('0x6c')](_0x541e80);}})[_0x0a9e('0x32')](function(_0x509efe){if(_0x509efe){return _0x509efe?{'count':_0x4c54fa,'rows':_0x509efe}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x2b9463,null))[_0x0a9e('0x28')](handleError(_0x2b9463,null));};exports['addTeams']=function(_0x40e0f0,_0x982340,_0x3a1974){var _0x5a26c8=_0x40e0f0[_0x0a9e('0x58')]['ids'];return db[_0x0a9e('0x6d')][_0x0a9e('0x52')]({'where':{'id':_0x5a26c8},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x6e')],'as':_0x0a9e('0x6f'),'attributes':['id',_0x0a9e('0x4c'),_0x0a9e('0x70'),_0x0a9e('0x71'),_0x0a9e('0x72')],'raw':!![]}]})['then'](function(_0x329d88){if(_0x329d88){var _0x31d25a=_[_0x0a9e('0x73')](_0x329d88,function(_0x30ef6e){var _0x28e60a=_0x30ef6e[_0x0a9e('0x33')]({'plain':!![]});return _0x28e60a[_0x0a9e('0x6f')];});return db[_0x0a9e('0x4e')][_0x0a9e('0x56')]({'where':{'id':_0x40e0f0[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](function(_0x3754e2){return db[_0x0a9e('0x74')]['transaction'](function(_0xc81b64){return _0x3754e2[_0x0a9e('0x75')](_0x5a26c8,{'transaction':_0xc81b64})[_0x0a9e('0x32')](function(){return BPromise[_0x0a9e('0x76')](_0x31d25a,function(_0xb0599a){return db['UserChatQueue'][_0x0a9e('0x77')]({'where':{'UserId':_0xb0599a['id'],'ChatQueueId':_0x40e0f0[_0x0a9e('0x5e')]['id']},'transaction':_0xc81b64});});})['then'](function(){_0x31d25a[_0x0a9e('0x78')](function(_0x5e725e){socket[_0x0a9e('0x79')](_0x0a9e('0x7a'),{'UserId':_0x5e725e['id'],'ChatQueueId':_0x3754e2['id']});});});});});}})[_0x0a9e('0x32')](respondWithStatusCode(_0x982340,null))[_0x0a9e('0x28')](handleError(_0x982340,null));};exports['removeTeams']=function(_0x3ceba6,_0x4cf72d,_0x2ec396){return db[_0x0a9e('0x6d')]['findAll']({'where':{'id':_0x3ceba6[_0x0a9e('0x3d')][_0x0a9e('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4cf72d,null))[_0x0a9e('0x32')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0x39')](_0x6ba2be,'id');var _0x3f2f40=[];var _0x2450a8=[];var _0x17793e=squel[_0x0a9e('0x7c')]();_0x17793e[_0x0a9e('0x7d')]('tq.TeamId')[_0x0a9e('0x7e')]('team_has_chat_queues','tq')[_0x0a9e('0x7f')](_0x0a9e('0x80'),'ut',_0x0a9e('0x81'))[_0x0a9e('0x46')](_0x0a9e('0x82'),_0x3ceba6['params']['id']);for(var _0x436313=0x0;_0x436313<_0x6ba2be[_0x0a9e('0x42')];_0x436313+=0x1){let _0x2791c5=_0x6ba2be[_0x436313];for(var _0x2aa5f2=0x0;_0x2aa5f2<_0x2791c5[_0x0a9e('0x6f')]['length'];_0x2aa5f2+=0x1){let _0x4f074c=_0x2791c5[_0x0a9e('0x6f')][_0x2aa5f2];var _0x583662=_0x17793e[_0x0a9e('0x83')]();_0x583662[_0x0a9e('0x46')](_0x0a9e('0x84'),_0x4f074c['id']);_0x2450a8[_0x0a9e('0x85')](db[_0x0a9e('0x74')][_0x0a9e('0x3d')](_0x583662['toString'](),{'type':db['sequelize'][_0x0a9e('0x86')]['SELECT']})[_0x0a9e('0x32')](function(_0x5c689c){if(_0x5c689c[_0x0a9e('0x42')]===0x1){return _0x4f074c['id'];}else{var _0x564db2=_['every'](_[_0x0a9e('0x39')](_0x5c689c,_0x0a9e('0x87')),function(_0x5e9b0b){return _[_0x0a9e('0x88')](_0x1707dc,_0x5e9b0b);});if(_0x564db2){return _0x4f074c['id'];}}}));}}return BPromise[_0x0a9e('0x89')](_0x2450a8)[_0x0a9e('0x32')](function(_0xa1bc84){_0x3f2f40=_(_0x3f2f40)[_0x0a9e('0x8a')](_0xa1bc84)['compact']()['value']();return db[_0x0a9e('0x4e')][_0x0a9e('0x56')]({'where':{'id':_0x3ceba6[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](function(_0x59303b){return db['sequelize'][_0x0a9e('0x8b')](function(_0xadce3d){return _0x59303b['removeTeams'](_0x3ceba6[_0x0a9e('0x3d')][_0x0a9e('0x7b')],{'transaction':_0xadce3d})[_0x0a9e('0x32')](function(){if(!_[_0x0a9e('0x8c')](_0x3f2f40)){return _0x59303b[_0x0a9e('0x8d')](_0x3f2f40,{'transaction':_0xadce3d});}})[_0x0a9e('0x32')](function(){_0x3f2f40[_0x0a9e('0x78')](function(_0x476993){socket[_0x0a9e('0x79')](_0x0a9e('0x8e'),{'UserId':_0x476993,'ChatQueueId':_0x59303b['id']});});});});});});})['then'](respondWithStatusCode(_0x4cf72d,null))[_0x0a9e('0x28')](handleError(_0x4cf72d,null));};exports[_0x0a9e('0x8f')]=function(_0x2ada60,_0x1c4232,_0x1d0b02){return db['ChatQueue']['find']({'where':{'id':_0x2ada60[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x1c4232,null))[_0x0a9e('0x32')](function(_0x2fea95){if(_0x2fea95){return _0x2fea95[_0x0a9e('0x8f')](_0x2ada60['body'][_0x0a9e('0x7b')],_[_0x0a9e('0x90')](_0x2ada60[_0x0a9e('0x58')],['ids','id'])||{})[_0x0a9e('0x91')](function(_0x59aa7b){for(var _0x2144ca=0x0;_0x2144ca<_0x2ada60['body'][_0x0a9e('0x7b')][_0x0a9e('0x42')];_0x2144ca+=0x1){socket[_0x0a9e('0x79')]('userChatQueue:save',{'UserId':_0x2ada60[_0x0a9e('0x58')]['ids'][_0x2144ca],'ChatQueueId':_0x2ada60[_0x0a9e('0x5e')]['id']});}return _0x59aa7b;});}})[_0x0a9e('0x32')](respondWithResult(_0x1c4232,null))[_0x0a9e('0x28')](handleError(_0x1c4232,null));};exports[_0x0a9e('0x8d')]=function(_0x3a5836,_0x1bee04,_0x4014c7){return db[_0x0a9e('0x4e')][_0x0a9e('0x56')]({'where':{'id':_0x3a5836[_0x0a9e('0x5e')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x1bee04,null))[_0x0a9e('0x32')](function(_0x2415fe){if(_0x2415fe){return _0x2415fe[_0x0a9e('0x8d')](_0x3a5836[_0x0a9e('0x3d')][_0x0a9e('0x7b')])['then'](function(){if(_['isArray'](_0x3a5836[_0x0a9e('0x3d')]['ids'])){for(var _0x1d999b=0x0;_0x1d999b<_0x3a5836[_0x0a9e('0x3d')]['ids'][_0x0a9e('0x42')];_0x1d999b+=0x1){socket[_0x0a9e('0x79')](_0x0a9e('0x8e'),{'UserId':Number(_0x3a5836[_0x0a9e('0x3d')]['ids'][_0x1d999b]),'ChatQueueId':Number(_0x3a5836[_0x0a9e('0x5e')]['id'])});}}else{socket[_0x0a9e('0x79')](_0x0a9e('0x8e'),{'UserId':Number(_0x3a5836[_0x0a9e('0x3d')]['ids']),'ChatQueueId':Number(_0x3a5836[_0x0a9e('0x5e')]['id'])});}});}})[_0x0a9e('0x32')](respondWithStatusCode(_0x1bee04,null))[_0x0a9e('0x28')](handleError(_0x1bee04,null));};exports['getAgents']=function(_0x2650eb,_0x270df8,_0x17b29d){var _0x54b107={};var _0x303f75={};var _0x4394bb;var _0x1d9b57;return db[_0x0a9e('0x4e')][_0x0a9e('0x60')]({'where':{'id':_0x2650eb['params']['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x270df8,null))[_0x0a9e('0x32')](function(_0x4795ae){if(_0x4795ae){_0x4394bb=_0x4795ae;_0x303f75[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x6e')]['rawAttributes']);_0x303f75['query']=_['keys'](_0x2650eb[_0x0a9e('0x3d')]);_0x303f75[_0x0a9e('0x3f')]=_['intersection'](_0x303f75[_0x0a9e('0x3c')],_0x303f75[_0x0a9e('0x3d')]);_0x54b107[_0x0a9e('0x40')]=_['intersection'](_0x303f75[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x54b107[_0x0a9e('0x40')]=_0x54b107[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x54b107[_0x0a9e('0x40')]:_0x303f75[_0x0a9e('0x3c')];_0x54b107['order']=qs[_0x0a9e('0x45')](_0x2650eb['query'][_0x0a9e('0x45')]);_0x54b107[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x2650eb[_0x0a9e('0x3d')],_0x303f75[_0x0a9e('0x3f')]));if(_0x2650eb['query'][_0x0a9e('0x48')]){_0x54b107[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x54b107[_0x0a9e('0x46')],{'$or':_['map'](_0x54b107[_0x0a9e('0x40')],function(_0x3c9135){var _0x43beea={};_0x43beea[_0x3c9135]={'$like':'%'+_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x43beea;})});}_0x54b107=_[_0x0a9e('0x49')]({},_0x54b107,_0x2650eb[_0x0a9e('0x4d')]);return _0x4394bb[_0x0a9e('0x92')](_0x54b107);}})[_0x0a9e('0x32')](function(_0x3539b7){if(_0x3539b7){_0x1d9b57=_0x3539b7['length'];if(!_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x54b107[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x54b107[_0x0a9e('0x2c')]=qs['offset'](_0x2650eb[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x4394bb[_0x0a9e('0x92')](_0x54b107);}})['then'](function(_0x1402c7){if(_0x1402c7){return _0x1402c7?{'count':_0x1d9b57,'rows':_0x1402c7}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x270df8,null))[_0x0a9e('0x28')](handleError(_0x270df8,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8ae43eb..c83ef8c 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x44feaf,_0x573011){var _0x3c4cd7=function(_0x715399){while(--_0x715399){_0x44feaf['push'](_0x44feaf['shift']());}};_0x3c4cd7(++_0x573011);}(_0xb10b,0x12a));var _0xbb10=function(_0x1559a3,_0x1e4f51){_0x1559a3=_0x1559a3-0x0;var _0x3a4b87=_0xb10b[_0x1559a3];return _0x3a4b87;};'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 +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x5a6515,_0x3097e8){var _0x5399d8=function(_0x4c98f9){while(--_0x4c98f9){_0x5a6515['push'](_0x5a6515['shift']());}};_0x5399d8(++_0x3097e8);}(_0xb10b,0x12a));var _0xbb10=function(_0x17598a,_0x522cc6){_0x17598a=_0x17598a-0x0;var _0x4cd046=_0xb10b[_0x17598a];return _0x4cd046;};'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 6a62be0..5246b83 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 _0x6b60=['bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x5c08ad,_0x3a14ae){var _0x29af07=function(_0x47f835){while(--_0x47f835){_0x5c08ad['push'](_0x5c08ad['shift']());}};_0x29af07(++_0x3a14ae);}(_0x6b60,0xf8));var _0x06b6=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6b60[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x06b6('0x0'));var util=require(_0x06b6('0x1'));var logger=require(_0x06b6('0x2'))(_0x06b6('0x3'));var moment=require('moment');var BPromise=require(_0x06b6('0x4'));var rp=require(_0x06b6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06b6('0x6'));var config=require(_0x06b6('0x7'));var attributes=require(_0x06b6('0x8'));module[_0x06b6('0x9')]=function(_0x2e0a6d,_0xba7a84){return _0x2e0a6d['define'](_0x06b6('0xa'),attributes,{'tableName':_0x06b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb287=['./chatQueue.attributes','define','ChatQueue','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xe9371a,_0xad4d77){var _0xa2e4bb=function(_0x18ff6b){while(--_0x18ff6b){_0xe9371a['push'](_0xe9371a['shift']());}};_0xa2e4bb(++_0xad4d77);}(_0xb287,0xdf));var _0x7b28=function(_0x50930b,_0x59e26d){_0x50930b=_0x50930b-0x0;var _0x51328c=_0xb287[_0x50930b];return _0x51328c;};'use strict';var _=require(_0x7b28('0x0'));var util=require(_0x7b28('0x1'));var logger=require('../../config/logger')(_0x7b28('0x2'));var moment=require(_0x7b28('0x3'));var BPromise=require(_0x7b28('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b28('0x5'));var rimraf=require(_0x7b28('0x6'));var config=require(_0x7b28('0x7'));var attributes=require(_0x7b28('0x8'));module['exports']=function(_0x1d002c,_0x44ac14){return _0x1d002c[_0x7b28('0x9')](_0x7b28('0xa'),attributes,{'tableName':'chat_queues','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 70e33f8..b1aa6ea 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 _0x7177=['error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','model','attributes','map','ShowChatQueue','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xa85b24,_0x1f4721){var _0x768bdc=function(_0x542218){while(--_0x542218){_0xa85b24['push'](_0xa85b24['shift']());}};_0x768bdc(++_0x1f4721);}(_0x7177,0x101));var _0x7717=function(_0xc9c8ca,_0xbc7ae3){_0xc9c8ca=_0xc9c8ca-0x0;var _0x59fc76=_0x7177[_0xc9c8ca];return _0x59fc76;};'use strict';var _=require(_0x7717('0x0'));var util=require('util');var moment=require(_0x7717('0x1'));var BPromise=require('bluebird');var rs=require(_0x7717('0x2'));var fs=require('fs');var Redis=require(_0x7717('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7717('0x4'));var logger=require(_0x7717('0x5'))('rpc');var config=require(_0x7717('0x6'));var jayson=require(_0x7717('0x7'));var client=jayson[_0x7717('0x8')][_0x7717('0x9')]({'port':0x232a});config[_0x7717('0xa')]=_[_0x7717('0xb')](config[_0x7717('0xa')],{'host':_0x7717('0xc'),'port':0x18eb});var socket=require(_0x7717('0xd'))(new Redis(config[_0x7717('0xa')]));require(_0x7717('0xe'))['register'](socket);function respondWithRpcPromise(_0x2a835c,_0x32dbfb,_0x5786d9){return new BPromise(function(_0x32e931,_0x4c4ebc){return client[_0x7717('0xf')](_0x2a835c,_0x5786d9)[_0x7717('0x10')](function(_0xcd5d7e){logger[_0x7717('0x11')](_0x7717('0x12'),_0x32dbfb,'request\x20sent');logger[_0x7717('0x13')](_0x7717('0x14'),_0x32dbfb,_0x7717('0x15'),JSON[_0x7717('0x16')](_0xcd5d7e));if(_0xcd5d7e[_0x7717('0x17')]){if(_0xcd5d7e[_0x7717('0x17')][_0x7717('0x18')]===0x1f4){logger['error'](_0x7717('0x12'),_0x32dbfb,_0xcd5d7e[_0x7717('0x17')][_0x7717('0x19')]);return _0x4c4ebc(_0xcd5d7e[_0x7717('0x17')][_0x7717('0x19')]);}logger[_0x7717('0x17')](_0x7717('0x12'),_0x32dbfb,_0xcd5d7e['error']['message']);return _0x32e931(_0xcd5d7e[_0x7717('0x17')]['message']);}else{logger[_0x7717('0x11')]('ChatQueue,\x20%s,\x20%s',_0x32dbfb,_0x7717('0x15'));_0x32e931(_0xcd5d7e[_0x7717('0x1a')][_0x7717('0x19')]);}})['catch'](function(_0x14f86d){logger[_0x7717('0x17')](_0x7717('0x12'),_0x32dbfb,_0x14f86d);_0x4c4ebc(_0x14f86d);});});}exports[_0x7717('0x1b')]=function(_0x7c44aa){var _0x511394=this;return new Promise(function(_0x2c25c5,_0x471dc4){return db[_0x7717('0x1c')][_0x7717('0x1d')]({'raw':_0x7c44aa['options']?_0x7c44aa[_0x7717('0x1e')][_0x7717('0x1f')]===undefined?!![]:![]:!![],'where':_0x7c44aa[_0x7717('0x1e')]?_0x7c44aa['options'][_0x7717('0x20')]||null:null,'attributes':_0x7c44aa[_0x7717('0x1e')]?_0x7c44aa[_0x7717('0x1e')]['attributes']||null:null,'limit':_0x7c44aa[_0x7717('0x1e')]?_0x7c44aa[_0x7717('0x1e')][_0x7717('0x21')]||null:null,'include':_0x7c44aa[_0x7717('0x1e')]?_0x7c44aa[_0x7717('0x1e')][_0x7717('0x22')]?_['map'](_0x7c44aa[_0x7717('0x1e')]['include'],function(_0x431d91){return{'model':db[_0x431d91[_0x7717('0x23')]],'as':_0x431d91['as'],'attributes':_0x431d91[_0x7717('0x24')],'include':_0x431d91[_0x7717('0x22')]?_[_0x7717('0x25')](_0x431d91[_0x7717('0x22')],function(_0x7fa7a7){return{'model':db[_0x7fa7a7['model']],'as':_0x7fa7a7['as'],'attributes':_0x7fa7a7[_0x7717('0x24')],'include':_0x7fa7a7[_0x7717('0x22')]?_[_0x7717('0x25')](_0x7fa7a7[_0x7717('0x22')],function(_0x492c22){return{'model':db[_0x492c22['model']],'as':_0x492c22['as'],'attributes':_0x492c22['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x145986){logger['info'](_0x7717('0x1b'),_0x7c44aa);logger[_0x7717('0x13')](_0x7717('0x1b'),_0x7c44aa,JSON[_0x7717('0x16')](_0x145986));_0x2c25c5(_0x145986);})['catch'](function(_0x47b4dc){logger['error'](_0x7717('0x1b'),_0x47b4dc['message'],_0x7c44aa);_0x471dc4(_0x511394['error'](0x1f4,_0x47b4dc['message']));});});};exports[_0x7717('0x26')]=function(_0x2bf307){var _0x110c82=this;return new Promise(function(_0x4b667d,_0x39451f){return db[_0x7717('0x1c')]['find']({'raw':_0x2bf307[_0x7717('0x1e')]?_0x2bf307['options'][_0x7717('0x1f')]===undefined?!![]:![]:!![],'where':_0x2bf307[_0x7717('0x1e')]?_0x2bf307['options'][_0x7717('0x20')]||null:null,'attributes':_0x2bf307[_0x7717('0x1e')]?_0x2bf307['options'][_0x7717('0x24')]||null:null,'include':_0x2bf307['options']?_0x2bf307[_0x7717('0x1e')][_0x7717('0x22')]?_['map'](_0x2bf307[_0x7717('0x1e')][_0x7717('0x22')],function(_0x59e70a){return{'model':db[_0x59e70a[_0x7717('0x23')]],'as':_0x59e70a['as'],'attributes':_0x59e70a['attributes'],'include':_0x59e70a[_0x7717('0x22')]?_[_0x7717('0x25')](_0x59e70a[_0x7717('0x22')],function(_0x42912e){return{'model':db[_0x42912e[_0x7717('0x23')]],'as':_0x42912e['as'],'attributes':_0x42912e[_0x7717('0x24')],'include':_0x42912e[_0x7717('0x22')]?_['map'](_0x42912e['include'],function(_0x39d0eb){return{'model':db[_0x39d0eb['model']],'as':_0x39d0eb['as'],'attributes':_0x39d0eb[_0x7717('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17c675){logger[_0x7717('0x11')](_0x7717('0x26'),_0x2bf307);logger[_0x7717('0x13')](_0x7717('0x26'),_0x2bf307,JSON['stringify'](_0x17c675));_0x4b667d(_0x17c675);})[_0x7717('0x27')](function(_0x1fe88a){logger[_0x7717('0x17')](_0x7717('0x26'),_0x1fe88a[_0x7717('0x19')],_0x2bf307);_0x39451f(_0x110c82[_0x7717('0x17')](0x1f4,_0x1fe88a[_0x7717('0x19')]));});});}; \ No newline at end of file +var _0xcb9c=['socket.io-emitter','./chatQueue.socket','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','ChatQueue','findAll','options','limit','include','map','model','attributes','stringify','ShowChatQueue','find','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x8ae8c1,_0x16f9d4){var _0x59653f=function(_0x457928){while(--_0x457928){_0x8ae8c1['push'](_0x8ae8c1['shift']());}};_0x59653f(++_0x16f9d4);}(_0xcb9c,0x110));var _0xccb9=function(_0x367abe,_0x59d2de){_0x367abe=_0x367abe-0x0;var _0x4435c7=_0xcb9c[_0x367abe];return _0x4435c7;};'use strict';var _=require(_0xccb9('0x0'));var util=require(_0xccb9('0x1'));var moment=require(_0xccb9('0x2'));var BPromise=require(_0xccb9('0x3'));var rs=require(_0xccb9('0x4'));var fs=require('fs');var Redis=require(_0xccb9('0x5'));var db=require(_0xccb9('0x6'))['db'];var utils=require(_0xccb9('0x7'));var logger=require('../../config/logger')(_0xccb9('0x8'));var config=require(_0xccb9('0x9'));var jayson=require(_0xccb9('0xa'));var client=jayson['client'][_0xccb9('0xb')]({'port':0x232a});config[_0xccb9('0xc')]=_[_0xccb9('0xd')](config['redis'],{'host':_0xccb9('0xe'),'port':0x18eb});var socket=require(_0xccb9('0xf'))(new Redis(config[_0xccb9('0xc')]));require(_0xccb9('0x10'))['register'](socket);function respondWithRpcPromise(_0x384482,_0x16340a,_0x84eaa0){return new BPromise(function(_0x51a37d,_0xfda682){return client['request'](_0x384482,_0x84eaa0)[_0xccb9('0x11')](function(_0x136c12){logger[_0xccb9('0x12')]('ChatQueue,\x20%s,\x20%s',_0x16340a,_0xccb9('0x13'));logger[_0xccb9('0x14')](_0xccb9('0x15'),_0x16340a,_0xccb9('0x13'),JSON['stringify'](_0x136c12));if(_0x136c12[_0xccb9('0x16')]){if(_0x136c12[_0xccb9('0x16')][_0xccb9('0x17')]===0x1f4){logger[_0xccb9('0x16')](_0xccb9('0x18'),_0x16340a,_0x136c12[_0xccb9('0x16')][_0xccb9('0x19')]);return _0xfda682(_0x136c12[_0xccb9('0x16')][_0xccb9('0x19')]);}logger['error'](_0xccb9('0x18'),_0x16340a,_0x136c12[_0xccb9('0x16')][_0xccb9('0x19')]);return _0x51a37d(_0x136c12['error']['message']);}else{logger[_0xccb9('0x12')]('ChatQueue,\x20%s,\x20%s',_0x16340a,_0xccb9('0x13'));_0x51a37d(_0x136c12[_0xccb9('0x1a')]['message']);}})['catch'](function(_0x999a6c){logger['error']('ChatQueue,\x20%s,\x20%s',_0x16340a,_0x999a6c);_0xfda682(_0x999a6c);});});}exports[_0xccb9('0x1b')]=function(_0x144dc7){var _0x18e0f1=this;return new Promise(function(_0x4574c3,_0x28ae56){return db[_0xccb9('0x1c')][_0xccb9('0x1d')]({'raw':_0x144dc7[_0xccb9('0x1e')]?_0x144dc7['options']['raw']===undefined?!![]:![]:!![],'where':_0x144dc7[_0xccb9('0x1e')]?_0x144dc7[_0xccb9('0x1e')]['where']||null:null,'attributes':_0x144dc7[_0xccb9('0x1e')]?_0x144dc7[_0xccb9('0x1e')]['attributes']||null:null,'limit':_0x144dc7[_0xccb9('0x1e')]?_0x144dc7[_0xccb9('0x1e')][_0xccb9('0x1f')]||null:null,'include':_0x144dc7[_0xccb9('0x1e')]?_0x144dc7[_0xccb9('0x1e')][_0xccb9('0x20')]?_[_0xccb9('0x21')](_0x144dc7[_0xccb9('0x1e')][_0xccb9('0x20')],function(_0x2e7b82){return{'model':db[_0x2e7b82['model']],'as':_0x2e7b82['as'],'attributes':_0x2e7b82['attributes'],'include':_0x2e7b82[_0xccb9('0x20')]?_[_0xccb9('0x21')](_0x2e7b82[_0xccb9('0x20')],function(_0x1d1011){return{'model':db[_0x1d1011[_0xccb9('0x22')]],'as':_0x1d1011['as'],'attributes':_0x1d1011['attributes'],'include':_0x1d1011[_0xccb9('0x20')]?_[_0xccb9('0x21')](_0x1d1011[_0xccb9('0x20')],function(_0x3d76bd){return{'model':db[_0x3d76bd['model']],'as':_0x3d76bd['as'],'attributes':_0x3d76bd[_0xccb9('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bd4f1){logger[_0xccb9('0x12')]('GetChatQueue',_0x144dc7);logger[_0xccb9('0x14')](_0xccb9('0x1b'),_0x144dc7,JSON[_0xccb9('0x24')](_0x4bd4f1));_0x4574c3(_0x4bd4f1);})['catch'](function(_0x570647){logger[_0xccb9('0x16')](_0xccb9('0x1b'),_0x570647[_0xccb9('0x19')],_0x144dc7);_0x28ae56(_0x18e0f1[_0xccb9('0x16')](0x1f4,_0x570647[_0xccb9('0x19')]));});});};exports[_0xccb9('0x25')]=function(_0x35301c){var _0xcdd9a5=this;return new Promise(function(_0x574e27,_0x4dd078){return db[_0xccb9('0x1c')][_0xccb9('0x26')]({'raw':_0x35301c[_0xccb9('0x1e')]?_0x35301c['options']['raw']===undefined?!![]:![]:!![],'where':_0x35301c['options']?_0x35301c[_0xccb9('0x1e')][_0xccb9('0x27')]||null:null,'attributes':_0x35301c[_0xccb9('0x1e')]?_0x35301c['options'][_0xccb9('0x23')]||null:null,'include':_0x35301c['options']?_0x35301c[_0xccb9('0x1e')]['include']?_[_0xccb9('0x21')](_0x35301c[_0xccb9('0x1e')][_0xccb9('0x20')],function(_0xe1386){return{'model':db[_0xe1386['model']],'as':_0xe1386['as'],'attributes':_0xe1386[_0xccb9('0x23')],'include':_0xe1386[_0xccb9('0x20')]?_['map'](_0xe1386[_0xccb9('0x20')],function(_0x4c15f9){return{'model':db[_0x4c15f9[_0xccb9('0x22')]],'as':_0x4c15f9['as'],'attributes':_0x4c15f9[_0xccb9('0x23')],'include':_0x4c15f9[_0xccb9('0x20')]?_[_0xccb9('0x21')](_0x4c15f9[_0xccb9('0x20')],function(_0x2626f9){return{'model':db[_0x2626f9[_0xccb9('0x22')]],'as':_0x2626f9['as'],'attributes':_0x2626f9[_0xccb9('0x23')]};}):[]};}):[]};}):[]:[]})[_0xccb9('0x11')](function(_0x2625b9){logger[_0xccb9('0x12')](_0xccb9('0x25'),_0x35301c);logger[_0xccb9('0x14')]('ShowChatQueue',_0x35301c,JSON[_0xccb9('0x24')](_0x2625b9));_0x574e27(_0x2625b9);})[_0xccb9('0x28')](function(_0x3afc2f){logger[_0xccb9('0x16')]('ShowChatQueue',_0x3afc2f['message'],_0x35301c);_0x4dd078(_0xcdd9a5[_0xccb9('0x16')](0x1f4,_0x3afc2f[_0xccb9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c855a4f..53e6fcc 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x139629,_0x24c680){var _0x95528d=function(_0xd2ae14){while(--_0xd2ae14){_0x139629['push'](_0x139629['shift']());}};_0x95528d(++_0x24c680);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x0b0e[_0x2becba];return _0x90b5dd;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x5111d5,_0x1e2909){var _0x41cba8=function(_0x386687){while(--_0x386687){_0x5111d5['push'](_0x5111d5['shift']());}};_0x41cba8(++_0x1e2909);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x0b0e[_0x20cf8a];return _0x54e165;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 26a21fc..f04c907 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 _0x4173=['show','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','delete','/:id','destroy','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x19b5eb,_0x4de080){var _0x4e7202=function(_0x210782){while(--_0x210782){_0x19b5eb['push'](_0x19b5eb['shift']());}};_0x4e7202(++_0x4de080);}(_0x4173,0x101));var _0x3417=function(_0x39bf66,_0x35c96c){_0x39bf66=_0x39bf66-0x0;var _0x431030=_0x4173[_0x39bf66];return _0x431030;};'use strict';var multer=require(_0x3417('0x0'));var util=require(_0x3417('0x1'));var path=require(_0x3417('0x2'));var timeout=require(_0x3417('0x3'));var express=require(_0x3417('0x4'));var router=express[_0x3417('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3417('0x6'));var interaction=require(_0x3417('0x7'));var config=require(_0x3417('0x8'));var controller=require('./chatQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3417('0x9')]);router[_0x3417('0xa')](_0x3417('0xb'),auth[_0x3417('0xc')](),controller['describe']);router[_0x3417('0xa')]('/:id',auth[_0x3417('0xc')](),controller[_0x3417('0xd')]);router[_0x3417('0xa')](_0x3417('0xe'),auth[_0x3417('0xc')](),controller[_0x3417('0xf')]);router[_0x3417('0xa')]('/:id/teams',auth[_0x3417('0xc')](),controller[_0x3417('0x10')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x3417('0x11')]);router['post']('/',auth[_0x3417('0xc')](),controller[_0x3417('0x12')]);router[_0x3417('0x13')](_0x3417('0x14'),auth[_0x3417('0xc')](),controller['addTeams']);router['post']('/:id/users',auth[_0x3417('0xc')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3417('0x15')](_0x3417('0x16'),auth[_0x3417('0xc')](),controller[_0x3417('0x17')]);router['delete'](_0x3417('0x14'),auth[_0x3417('0xc')](),controller[_0x3417('0x18')]);router[_0x3417('0x15')](_0x3417('0x19'),auth[_0x3417('0xc')](),controller['removeAgents']);module[_0x3417('0x1a')]=router; \ No newline at end of file +var _0x8409=['getAgents','create','post','addAgents','/:id','update','delete','destroy','/:id/teams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatQueue.controller','isAuthenticated','get','/describe','describe','/:id/members','getMembers','getTeams','/:id/users'];(function(_0x395c05,_0x236b0f){var _0x5751fa=function(_0x3d355c){while(--_0x3d355c){_0x395c05['push'](_0x395c05['shift']());}};_0x5751fa(++_0x236b0f);}(_0x8409,0x91));var _0x9840=function(_0x2486a4,_0x3e3650){_0x2486a4=_0x2486a4-0x0;var _0x14cf68=_0x8409[_0x2486a4];return _0x14cf68;};'use strict';var multer=require(_0x9840('0x0'));var util=require(_0x9840('0x1'));var path=require(_0x9840('0x2'));var timeout=require(_0x9840('0x3'));var express=require(_0x9840('0x4'));var router=express[_0x9840('0x5')]();var fs_extra=require(_0x9840('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9840('0x7'));var config=require('../../config/environment');var controller=require(_0x9840('0x8'));router['get']('/',auth[_0x9840('0x9')](),controller['index']);router[_0x9840('0xa')](_0x9840('0xb'),auth[_0x9840('0x9')](),controller[_0x9840('0xc')]);router[_0x9840('0xa')]('/:id',auth[_0x9840('0x9')](),controller['show']);router[_0x9840('0xa')](_0x9840('0xd'),auth[_0x9840('0x9')](),controller[_0x9840('0xe')]);router[_0x9840('0xa')]('/:id/teams',auth[_0x9840('0x9')](),controller[_0x9840('0xf')]);router[_0x9840('0xa')](_0x9840('0x10'),auth[_0x9840('0x9')](),controller[_0x9840('0x11')]);router['post']('/',auth[_0x9840('0x9')](),controller[_0x9840('0x12')]);router['post']('/:id/teams',auth[_0x9840('0x9')](),controller['addTeams']);router[_0x9840('0x13')](_0x9840('0x10'),auth[_0x9840('0x9')](),controller[_0x9840('0x14')]);router['put'](_0x9840('0x15'),auth[_0x9840('0x9')](),controller[_0x9840('0x16')]);router[_0x9840('0x17')](_0x9840('0x15'),auth[_0x9840('0x9')](),controller[_0x9840('0x18')]);router[_0x9840('0x17')](_0x9840('0x19'),auth[_0x9840('0x9')](),controller['removeTeams']);router[_0x9840('0x17')]('/:id/users',auth[_0x9840('0x9')](),controller['removeAgents']);module[_0x9840('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 06a0d47..8825113 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 _0x318d=['DATE','moment','sequelize','exports','STRING'];(function(_0x495a4e,_0x573ab0){var _0x4a55cb=function(_0xfde3ee){while(--_0xfde3ee){_0x495a4e['push'](_0x495a4e['shift']());}};_0x4a55cb(++_0x573ab0);}(_0x318d,0x15a));var _0xd318=function(_0x4d9d1e,_0x3c2d20){_0x4d9d1e=_0x4d9d1e-0x0;var _0x1b9d54=_0x318d[_0x4d9d1e];return _0x1b9d54;};'use strict';var moment=require(_0xd318('0x0'));var Sequelize=require(_0xd318('0x1'));module[_0xd318('0x2')]={'uniqueid':{'type':Sequelize[_0xd318('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd318('0x3')]},'joinAt':{'type':Sequelize[_0xd318('0x4')]},'leaveAt':{'type':Sequelize[_0xd318('0x4')]},'acceptAt':{'type':Sequelize[_0xd318('0x4')]},'exitAt':{'type':Sequelize[_0xd318('0x4')]},'reason':{'type':Sequelize[_0xd318('0x3')]}}; \ No newline at end of file +var _0x48de=['STRING','DATE','moment','exports'];(function(_0x38aca6,_0x2a1488){var _0x5e7e8b=function(_0xcde237){while(--_0xcde237){_0x38aca6['push'](_0x38aca6['shift']());}};_0x5e7e8b(++_0x2a1488);}(_0x48de,0x7a));var _0xe48d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x48de[_0x5bd426];return _0x23a7eb;};'use strict';var moment=require(_0xe48d('0x0'));var Sequelize=require('sequelize');module[_0xe48d('0x1')]={'uniqueid':{'type':Sequelize[_0xe48d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe48d('0x2')]},'joinAt':{'type':Sequelize[_0xe48d('0x3')]},'leaveAt':{'type':Sequelize[_0xe48d('0x3')]},'acceptAt':{'type':Sequelize[_0xe48d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe48d('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 728d43e..3cc28c7 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 _0x9386=['catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','count','offset','status','set','json','apply','reject','save','then','destroy','error','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatQueueReport','includeAll','include','rows','show','params','keys','length','find'];(function(_0x5885ac,_0x57e4ee){var _0x2190fe=function(_0x429b0b){while(--_0x429b0b){_0x5885ac['push'](_0x5885ac['shift']());}};_0x2190fe(++_0x57e4ee);}(_0x9386,0x18a));var _0x6938=function(_0x8f6870,_0x4ad16f){_0x8f6870=_0x8f6870-0x0;var _0x44f224=_0x9386[_0x8f6870];return _0x44f224;};'use strict';var pdf=require(_0x6938('0x0'));var emlformat=require(_0x6938('0x1'));var rimraf=require(_0x6938('0x2'));var zipdir=require(_0x6938('0x3'));var jsonpatch=require(_0x6938('0x4'));var rp=require(_0x6938('0x5'));var moment=require(_0x6938('0x6'));var BPromise=require(_0x6938('0x7'));var Mustache=require(_0x6938('0x8'));var util=require(_0x6938('0x9'));var path=require(_0x6938('0xa'));var sox=require(_0x6938('0xb'));var csv=require(_0x6938('0xc'));var ejs=require(_0x6938('0xd'));var fs=require('fs');var fs_extra=require(_0x6938('0xe'));var _=require(_0x6938('0xf'));var squel=require('squel');var crypto=require(_0x6938('0x10'));var jsforce=require(_0x6938('0x11'));var deskjs=require(_0x6938('0x12'));var toCsv=require('to-csv');var querystring=require(_0x6938('0x13'));var Papa=require(_0x6938('0x14'));var Redis=require(_0x6938('0x15'));var authService=require(_0x6938('0x16'));var qs=require(_0x6938('0x17'));var as=require(_0x6938('0x18'));var hardwareService=require(_0x6938('0x19'));var logger=require(_0x6938('0x1a'))(_0x6938('0x1b'));var utils=require('../../config/utils');var config=require(_0x6938('0x1c'));var licenseUtil=require(_0x6938('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f5cc7,_0x72ba8f){_0x72ba8f=_0x72ba8f||0xcc;return function(_0x4c3a20){if(_0x4c3a20){return _0x3f5cc7[_0x6938('0x1e')](_0x72ba8f);}return _0x3f5cc7['status'](_0x72ba8f)[_0x6938('0x1f')]();};}function respondWithResult(_0xcdeb69,_0x179927){_0x179927=_0x179927||0xc8;return function(_0x4d09f1){if(_0x4d09f1){return _0xcdeb69['status'](_0x179927)['json'](_0x4d09f1);}};}function respondWithFilteredResult(_0x3a1e1d,_0x2a4ee0){return function(_0x4b5d3c){if(_0x4b5d3c){var _0x48b26d=_0x4b5d3c[_0x6938('0x20')],_0x4ad069=_0x2a4ee0[_0x6938('0x21')],_0x5f65b9=_0x2a4ee0[_0x6938('0x21')]+_0x2a4ee0['limit'],_0x1b00d1;if(_0x5f65b9>=_0x48b26d){_0x5f65b9=_0x48b26d;_0x1b00d1=0xc8;}else{_0x1b00d1=0xce;}_0x3a1e1d[_0x6938('0x22')](_0x1b00d1);return _0x3a1e1d[_0x6938('0x23')]('Content-Range',_0x4ad069+'-'+_0x5f65b9+'/'+_0x48b26d)[_0x6938('0x24')](_0x4b5d3c);}return null;};}function patchUpdates(_0x56a37a){return function(_0x585c26){try{jsonpatch[_0x6938('0x25')](_0x585c26,_0x56a37a,!![]);}catch(_0x138dd2){return BPromise[_0x6938('0x26')](_0x138dd2);}return _0x585c26[_0x6938('0x27')]();};}function saveUpdates(_0x1381ee,_0x1fa1c9){return function(_0x1d842f){if(_0x1d842f){return _0x1d842f['update'](_0x1381ee)[_0x6938('0x28')](function(_0x376a1a){return _0x376a1a;});}return null;};}function removeEntity(_0x5c7174,_0x2f7675){return function(_0x2456c6){if(_0x2456c6){return _0x2456c6[_0x6938('0x29')]()[_0x6938('0x28')](function(){_0x5c7174[_0x6938('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x517e26,_0x47c06c){return function(_0x10d14a){if(!_0x10d14a){_0x517e26['sendStatus'](0x194);}return _0x10d14a;};}function handleError(_0x65927c,_0x395772){_0x395772=_0x395772||0x1f4;return function(_0x1b4a03){logger[_0x6938('0x2a')](_0x1b4a03['stack']);if(_0x1b4a03['name']){delete _0x1b4a03[_0x6938('0x2b')];}_0x65927c[_0x6938('0x22')](_0x395772)[_0x6938('0x2c')](_0x1b4a03);};}exports['index']=function(_0x1ffc09,_0x4238c5){var _0x80a702={},_0x45965d={},_0x51beab={'count':0x0,'rows':[]};var _0x1de8e3=_[_0x6938('0x2d')](db['ChatQueueReport'][_0x6938('0x2e')],function(_0x4bc9d3){return{'name':_0x4bc9d3[_0x6938('0x2f')],'type':_0x4bc9d3['type'][_0x6938('0x30')]};});_0x45965d[_0x6938('0x31')]=_[_0x6938('0x2d')](_0x1de8e3,_0x6938('0x2b'));_0x45965d[_0x6938('0x32')]=_['keys'](_0x1ffc09['query']);_0x45965d[_0x6938('0x33')]=_[_0x6938('0x34')](_0x45965d['model'],_0x45965d[_0x6938('0x32')]);_0x80a702[_0x6938('0x35')]=_[_0x6938('0x34')](_0x45965d['model'],qs[_0x6938('0x36')](_0x1ffc09[_0x6938('0x32')][_0x6938('0x36')]));_0x80a702[_0x6938('0x35')]=_0x80a702[_0x6938('0x35')]['length']?_0x80a702['attributes']:_0x45965d[_0x6938('0x31')];if(!_0x1ffc09[_0x6938('0x32')]['hasOwnProperty']('nolimit')){_0x80a702[_0x6938('0x37')]=qs[_0x6938('0x37')](_0x1ffc09[_0x6938('0x32')]['limit']);_0x80a702[_0x6938('0x21')]=qs[_0x6938('0x21')](_0x1ffc09[_0x6938('0x32')][_0x6938('0x21')]);}_0x80a702[_0x6938('0x38')]=qs[_0x6938('0x39')](_0x1ffc09[_0x6938('0x32')][_0x6938('0x39')]);_0x80a702[_0x6938('0x3a')]=qs['filters'](_[_0x6938('0x3b')](_0x1ffc09[_0x6938('0x32')],_0x45965d['filters']),_0x1de8e3);if(_0x1ffc09['query'][_0x6938('0x3c')]){_0x80a702['where']=_[_0x6938('0x3d')](_0x80a702['where'],{'$or':_['map'](_0x1de8e3,function(_0x220a88){if(_0x220a88[_0x6938('0x3e')]!==_0x6938('0x3f')){var _0x28abd3={};_0x28abd3[_0x220a88[_0x6938('0x2b')]]={'$like':'%'+_0x1ffc09[_0x6938('0x32')][_0x6938('0x3c')]+'%'};return _0x28abd3;}})});}_0x80a702=_['merge']({},_0x80a702,_0x1ffc09[_0x6938('0x40')]);var _0x2bf542={'where':_0x80a702['where']};return db[_0x6938('0x41')][_0x6938('0x20')](_0x2bf542)[_0x6938('0x28')](function(_0x5803b2){_0x51beab[_0x6938('0x20')]=_0x5803b2;if(_0x1ffc09[_0x6938('0x32')][_0x6938('0x42')]){_0x80a702[_0x6938('0x43')]=[{'all':!![]}];}return db[_0x6938('0x41')]['findAll'](_0x80a702);})[_0x6938('0x28')](function(_0x24ac47){_0x51beab[_0x6938('0x44')]=_0x24ac47;return _0x51beab;})[_0x6938('0x28')](respondWithFilteredResult(_0x4238c5,_0x80a702))['catch'](handleError(_0x4238c5,null));};exports[_0x6938('0x45')]=function(_0x6a2c,_0x494838){var _0x42790d={'raw':!![],'where':{'id':_0x6a2c[_0x6938('0x46')]['id']}},_0x25776c={};_0x25776c[_0x6938('0x31')]=_[_0x6938('0x47')](db[_0x6938('0x41')]['rawAttributes']);_0x25776c[_0x6938('0x32')]=_[_0x6938('0x47')](_0x6a2c[_0x6938('0x32')]);_0x25776c[_0x6938('0x33')]=_[_0x6938('0x34')](_0x25776c['model'],_0x25776c[_0x6938('0x32')]);_0x42790d[_0x6938('0x35')]=_['intersection'](_0x25776c[_0x6938('0x31')],qs[_0x6938('0x36')](_0x6a2c[_0x6938('0x32')][_0x6938('0x36')]));_0x42790d['attributes']=_0x42790d[_0x6938('0x35')][_0x6938('0x48')]?_0x42790d[_0x6938('0x35')]:_0x25776c[_0x6938('0x31')];if(_0x6a2c[_0x6938('0x32')][_0x6938('0x42')]){_0x42790d['include']=[{'all':!![]}];}_0x42790d=_[_0x6938('0x3d')]({},_0x42790d,_0x6a2c['options']);return db['ChatQueueReport'][_0x6938('0x49')](_0x42790d)[_0x6938('0x28')](handleEntityNotFound(_0x494838,null))['then'](respondWithResult(_0x494838,null))[_0x6938('0x4a')](handleError(_0x494838,null));};exports['create']=function(_0x388cd7,_0x22add4){return db['ChatQueueReport'][_0x6938('0x4b')](_0x388cd7[_0x6938('0x4c')],{})[_0x6938('0x28')](respondWithResult(_0x22add4,0xc9))[_0x6938('0x4a')](handleError(_0x22add4,null));};exports['update']=function(_0x5ebc39,_0x38ec95){if(_0x5ebc39[_0x6938('0x4c')]['id']){delete _0x5ebc39['body']['id'];}return db['ChatQueueReport'][_0x6938('0x49')]({'where':{'id':_0x5ebc39[_0x6938('0x46')]['id']}})[_0x6938('0x28')](handleEntityNotFound(_0x38ec95,null))[_0x6938('0x28')](saveUpdates(_0x5ebc39[_0x6938('0x4c')],null))[_0x6938('0x28')](respondWithResult(_0x38ec95,null))[_0x6938('0x4a')](handleError(_0x38ec95,null));};exports[_0x6938('0x29')]=function(_0x56f9de,_0x571cda){return db[_0x6938('0x41')][_0x6938('0x49')]({'where':{'id':_0x56f9de['params']['id']}})['then'](handleEntityNotFound(_0x571cda,null))[_0x6938('0x28')](removeEntity(_0x571cda,null))[_0x6938('0x4a')](handleError(_0x571cda,null));};exports[_0x6938('0x4d')]=function(_0x1e9c00,_0x225101){return db[_0x6938('0x41')][_0x6938('0x4d')]()[_0x6938('0x28')](respondWithResult(_0x225101,null))[_0x6938('0x4a')](handleError(_0x225101,null));}; \ No newline at end of file +var _0x3402=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','apply','update','then','destroy','end','error','stack','name','send','index','ChatQueueReport','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','include','catch','show','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3402,0x1de));var _0x2340=function(_0x3f64ad,_0x7ea303){_0x3f64ad=_0x3f64ad-0x0;var _0x2befe9=_0x3402[_0x3f64ad];return _0x2befe9;};'use strict';var pdf=require(_0x2340('0x0'));var emlformat=require(_0x2340('0x1'));var rimraf=require(_0x2340('0x2'));var zipdir=require(_0x2340('0x3'));var jsonpatch=require(_0x2340('0x4'));var rp=require(_0x2340('0x5'));var moment=require(_0x2340('0x6'));var BPromise=require(_0x2340('0x7'));var Mustache=require('mustache');var util=require(_0x2340('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2340('0x9'));var _=require(_0x2340('0xa'));var squel=require(_0x2340('0xb'));var crypto=require(_0x2340('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2340('0xd'));var toCsv=require(_0x2340('0xe'));var querystring=require(_0x2340('0xf'));var Papa=require(_0x2340('0x10'));var Redis=require('ioredis');var authService=require(_0x2340('0x11'));var qs=require(_0x2340('0x12'));var as=require(_0x2340('0x13'));var hardwareService=require(_0x2340('0x14'));var logger=require('../../config/logger')(_0x2340('0x15'));var utils=require(_0x2340('0x16'));var config=require(_0x2340('0x17'));var licenseUtil=require(_0x2340('0x18'));var db=require(_0x2340('0x19'))['db'];function respondWithStatusCode(_0x4d10dd,_0x4b2a08){_0x4b2a08=_0x4b2a08||0xcc;return function(_0xc9105){if(_0xc9105){return _0x4d10dd[_0x2340('0x1a')](_0x4b2a08);}return _0x4d10dd[_0x2340('0x1b')](_0x4b2a08)['end']();};}function respondWithResult(_0x3b8ed3,_0x300ddc){_0x300ddc=_0x300ddc||0xc8;return function(_0x43c747){if(_0x43c747){return _0x3b8ed3['status'](_0x300ddc)[_0x2340('0x1c')](_0x43c747);}};}function respondWithFilteredResult(_0x2bf94d,_0x7b0875){return function(_0x5151df){if(_0x5151df){var _0x5ece64=_0x5151df['count'],_0x2c8d76=_0x7b0875[_0x2340('0x1d')],_0xe97e60=_0x7b0875[_0x2340('0x1d')]+_0x7b0875[_0x2340('0x1e')],_0x27cc3a;if(_0xe97e60>=_0x5ece64){_0xe97e60=_0x5ece64;_0x27cc3a=0xc8;}else{_0x27cc3a=0xce;}_0x2bf94d['status'](_0x27cc3a);return _0x2bf94d['set']('Content-Range',_0x2c8d76+'-'+_0xe97e60+'/'+_0x5ece64)['json'](_0x5151df);}return null;};}function patchUpdates(_0x442fea){return function(_0x20f5be){try{jsonpatch[_0x2340('0x1f')](_0x20f5be,_0x442fea,!![]);}catch(_0x28c13a){return BPromise['reject'](_0x28c13a);}return _0x20f5be['save']();};}function saveUpdates(_0x188516,_0x4f33fb){return function(_0x1c7e0b){if(_0x1c7e0b){return _0x1c7e0b[_0x2340('0x20')](_0x188516)[_0x2340('0x21')](function(_0x85d791){return _0x85d791;});}return null;};}function removeEntity(_0x5e7004,_0x1c57e3){return function(_0x6132b5){if(_0x6132b5){return _0x6132b5[_0x2340('0x22')]()[_0x2340('0x21')](function(){_0x5e7004['status'](0xcc)[_0x2340('0x23')]();});}};}function handleEntityNotFound(_0x5d8db0,_0x362370){return function(_0x43470b){if(!_0x43470b){_0x5d8db0[_0x2340('0x1a')](0x194);}return _0x43470b;};}function handleError(_0x98bc24,_0xdcb297){_0xdcb297=_0xdcb297||0x1f4;return function(_0x4bebe0){logger[_0x2340('0x24')](_0x4bebe0[_0x2340('0x25')]);if(_0x4bebe0[_0x2340('0x26')]){delete _0x4bebe0['name'];}_0x98bc24[_0x2340('0x1b')](_0xdcb297)[_0x2340('0x27')](_0x4bebe0);};}exports[_0x2340('0x28')]=function(_0x220fcc,_0x354fc4){var _0x415c2a={},_0x52b336={},_0x3ac624={'count':0x0,'rows':[]};var _0x2bbcc3=_['map'](db[_0x2340('0x29')][_0x2340('0x2a')],function(_0x3b8939){return{'name':_0x3b8939['fieldName'],'type':_0x3b8939[_0x2340('0x2b')]['key']};});_0x52b336[_0x2340('0x2c')]=_[_0x2340('0x2d')](_0x2bbcc3,'name');_0x52b336[_0x2340('0x2e')]=_[_0x2340('0x2f')](_0x220fcc[_0x2340('0x2e')]);_0x52b336['filters']=_[_0x2340('0x30')](_0x52b336['model'],_0x52b336[_0x2340('0x2e')]);_0x415c2a[_0x2340('0x31')]=_[_0x2340('0x30')](_0x52b336[_0x2340('0x2c')],qs[_0x2340('0x32')](_0x220fcc[_0x2340('0x2e')][_0x2340('0x32')]));_0x415c2a['attributes']=_0x415c2a[_0x2340('0x31')][_0x2340('0x33')]?_0x415c2a['attributes']:_0x52b336[_0x2340('0x2c')];if(!_0x220fcc[_0x2340('0x2e')][_0x2340('0x34')](_0x2340('0x35'))){_0x415c2a['limit']=qs[_0x2340('0x1e')](_0x220fcc[_0x2340('0x2e')]['limit']);_0x415c2a[_0x2340('0x1d')]=qs[_0x2340('0x1d')](_0x220fcc[_0x2340('0x2e')][_0x2340('0x1d')]);}_0x415c2a[_0x2340('0x36')]=qs[_0x2340('0x37')](_0x220fcc[_0x2340('0x2e')][_0x2340('0x37')]);_0x415c2a['where']=qs[_0x2340('0x38')](_['pick'](_0x220fcc[_0x2340('0x2e')],_0x52b336['filters']),_0x2bbcc3);if(_0x220fcc[_0x2340('0x2e')][_0x2340('0x39')]){_0x415c2a[_0x2340('0x3a')]=_[_0x2340('0x3b')](_0x415c2a[_0x2340('0x3a')],{'$or':_[_0x2340('0x2d')](_0x2bbcc3,function(_0x1219e8){if(_0x1219e8[_0x2340('0x2b')]!==_0x2340('0x3c')){var _0xb8b917={};_0xb8b917[_0x1219e8[_0x2340('0x26')]]={'$like':'%'+_0x220fcc[_0x2340('0x2e')][_0x2340('0x39')]+'%'};return _0xb8b917;}})});}_0x415c2a=_[_0x2340('0x3b')]({},_0x415c2a,_0x220fcc['options']);var _0x12b270={'where':_0x415c2a[_0x2340('0x3a')]};return db[_0x2340('0x29')][_0x2340('0x3d')](_0x12b270)[_0x2340('0x21')](function(_0x222402){_0x3ac624[_0x2340('0x3d')]=_0x222402;if(_0x220fcc[_0x2340('0x2e')]['includeAll']){_0x415c2a[_0x2340('0x3e')]=[{'all':!![]}];}return db[_0x2340('0x29')]['findAll'](_0x415c2a);})['then'](function(_0x107656){_0x3ac624['rows']=_0x107656;return _0x3ac624;})[_0x2340('0x21')](respondWithFilteredResult(_0x354fc4,_0x415c2a))[_0x2340('0x3f')](handleError(_0x354fc4,null));};exports[_0x2340('0x40')]=function(_0x44e560,_0x4cbb4d){var _0x46778b={'raw':!![],'where':{'id':_0x44e560['params']['id']}},_0x349663={};_0x349663['model']=_[_0x2340('0x2f')](db[_0x2340('0x29')][_0x2340('0x2a')]);_0x349663[_0x2340('0x2e')]=_[_0x2340('0x2f')](_0x44e560[_0x2340('0x2e')]);_0x349663[_0x2340('0x38')]=_[_0x2340('0x30')](_0x349663[_0x2340('0x2c')],_0x349663[_0x2340('0x2e')]);_0x46778b['attributes']=_[_0x2340('0x30')](_0x349663[_0x2340('0x2c')],qs[_0x2340('0x32')](_0x44e560['query'][_0x2340('0x32')]));_0x46778b[_0x2340('0x31')]=_0x46778b[_0x2340('0x31')][_0x2340('0x33')]?_0x46778b[_0x2340('0x31')]:_0x349663['model'];if(_0x44e560['query']['includeAll']){_0x46778b[_0x2340('0x3e')]=[{'all':!![]}];}_0x46778b=_[_0x2340('0x3b')]({},_0x46778b,_0x44e560[_0x2340('0x41')]);return db[_0x2340('0x29')][_0x2340('0x42')](_0x46778b)[_0x2340('0x21')](handleEntityNotFound(_0x4cbb4d,null))['then'](respondWithResult(_0x4cbb4d,null))[_0x2340('0x3f')](handleError(_0x4cbb4d,null));};exports['create']=function(_0x31570a,_0x3de10c){return db[_0x2340('0x29')][_0x2340('0x43')](_0x31570a[_0x2340('0x44')],{})['then'](respondWithResult(_0x3de10c,0xc9))[_0x2340('0x3f')](handleError(_0x3de10c,null));};exports[_0x2340('0x20')]=function(_0x1fd17e,_0x10b98c){if(_0x1fd17e['body']['id']){delete _0x1fd17e[_0x2340('0x44')]['id'];}return db[_0x2340('0x29')][_0x2340('0x42')]({'where':{'id':_0x1fd17e['params']['id']}})[_0x2340('0x21')](handleEntityNotFound(_0x10b98c,null))[_0x2340('0x21')](saveUpdates(_0x1fd17e[_0x2340('0x44')],null))[_0x2340('0x21')](respondWithResult(_0x10b98c,null))['catch'](handleError(_0x10b98c,null));};exports[_0x2340('0x22')]=function(_0x1c7ac2,_0x26a785){return db[_0x2340('0x29')]['find']({'where':{'id':_0x1c7ac2[_0x2340('0x45')]['id']}})[_0x2340('0x21')](handleEntityNotFound(_0x26a785,null))[_0x2340('0x21')](removeEntity(_0x26a785,null))[_0x2340('0x3f')](handleError(_0x26a785,null));};exports['describe']=function(_0x13a4f4,_0x1a987f){return db[_0x2340('0x29')][_0x2340('0x46')]()[_0x2340('0x21')](respondWithResult(_0x1a987f,null))[_0x2340('0x3f')](handleError(_0x1a987f,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 49616ab..03300a6 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 _0x5fbb=['report_chat_queue','uniqueid','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','define'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x5fbb,0x70));var _0xb5fb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5fbb[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xb5fb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb5fb('0x1'));var BPromise=require(_0xb5fb('0x2'));var rp=require(_0xb5fb('0x3'));var fs=require('fs');var path=require(_0xb5fb('0x4'));var rimraf=require(_0xb5fb('0x5'));var config=require(_0xb5fb('0x6'));var attributes=require(_0xb5fb('0x7'));module['exports']=function(_0x4456e7,_0x4eb38d){return _0x4456e7[_0xb5fb('0x8')]('ChatQueueReport',attributes,{'tableName':_0xb5fb('0x9'),'paranoid':![],'indexes':[{'name':_0xb5fb('0xa'),'fields':[_0xb5fb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x163c=['rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4fe5c1,_0x596995){var _0x41bd98=function(_0x410755){while(--_0x410755){_0x4fe5c1['push'](_0x4fe5c1['shift']());}};_0x41bd98(++_0x596995);}(_0x163c,0xf8));var _0xc163=function(_0x577f96,_0x4d6f08){_0x577f96=_0x577f96-0x0;var _0x6d6341=_0x163c[_0x577f96];return _0x6d6341;};'use strict';var _=require('lodash');var util=require(_0xc163('0x0'));var logger=require(_0xc163('0x1'))(_0xc163('0x2'));var moment=require(_0xc163('0x3'));var BPromise=require(_0xc163('0x4'));var rp=require(_0xc163('0x5'));var fs=require('fs');var path=require(_0xc163('0x6'));var rimraf=require(_0xc163('0x7'));var config=require(_0xc163('0x8'));var attributes=require(_0xc163('0x9'));module[_0xc163('0xa')]=function(_0x4d489d,_0x27cedf){return _0x4d489d[_0xc163('0xb')](_0xc163('0xc'),attributes,{'tableName':_0xc163('0xd'),'paranoid':![],'indexes':[{'name':_0xc163('0xe'),'fields':[_0xc163('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index acf2022..bd0a957 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 _0x1bc3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','then','UpdateChatQueueReport','update','raw','where','attributes','limit','util','moment'];(function(_0x6b2276,_0x52dde4){var _0x521bf3=function(_0x410a7e){while(--_0x410a7e){_0x6b2276['push'](_0x6b2276['shift']());}};_0x521bf3(++_0x52dde4);}(_0x1bc3,0xa8));var _0x31bc=function(_0x243415,_0x16f040){_0x243415=_0x243415-0x0;var _0x57c2ff=_0x1bc3[_0x243415];return _0x57c2ff;};'use strict';var _=require('lodash');var util=require(_0x31bc('0x0'));var moment=require(_0x31bc('0x1'));var BPromise=require(_0x31bc('0x2'));var rs=require(_0x31bc('0x3'));var fs=require('fs');var Redis=require(_0x31bc('0x4'));var db=require(_0x31bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x31bc('0x6'))(_0x31bc('0x7'));var config=require(_0x31bc('0x8'));var jayson=require(_0x31bc('0x9'));var client=jayson[_0x31bc('0xa')][_0x31bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x191da1,_0x284802,_0x2270c0){return new BPromise(function(_0x475081,_0x5c41af){return client[_0x31bc('0xc')](_0x191da1,_0x2270c0)['then'](function(_0x1f8109){logger[_0x31bc('0xd')](_0x31bc('0xe'),_0x284802,_0x31bc('0xf'));logger[_0x31bc('0x10')](_0x31bc('0x11'),_0x284802,_0x31bc('0xf'),JSON[_0x31bc('0x12')](_0x1f8109));if(_0x1f8109[_0x31bc('0x13')]){if(_0x1f8109[_0x31bc('0x13')]['code']===0x1f4){logger[_0x31bc('0x13')](_0x31bc('0xe'),_0x284802,_0x1f8109[_0x31bc('0x13')][_0x31bc('0x14')]);return _0x5c41af(_0x1f8109['error'][_0x31bc('0x14')]);}logger[_0x31bc('0x13')](_0x31bc('0xe'),_0x284802,_0x1f8109['error'][_0x31bc('0x14')]);return _0x475081(_0x1f8109[_0x31bc('0x13')][_0x31bc('0x14')]);}else{logger[_0x31bc('0xd')](_0x31bc('0xe'),_0x284802,_0x31bc('0xf'));_0x475081(_0x1f8109['result'][_0x31bc('0x14')]);}})[_0x31bc('0x15')](function(_0xead3d4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x284802,_0xead3d4);_0x5c41af(_0xead3d4);});});}exports[_0x31bc('0x16')]=function(_0x561755){var _0x10b0ef=this;return new Promise(function(_0x8532dc,_0x38a074){return db[_0x31bc('0x17')][_0x31bc('0x18')](_0x561755[_0x31bc('0x19')],{'raw':_0x561755[_0x31bc('0x1a')]?_0x561755['options']['raw']===undefined?!![]:![]:!![]})[_0x31bc('0x1b')](function(_0x460c04){logger[_0x31bc('0xd')](_0x31bc('0x16'),_0x561755);logger['debug'](_0x31bc('0x16'),_0x561755,JSON[_0x31bc('0x12')](_0x460c04));_0x8532dc(_0x460c04);})[_0x31bc('0x15')](function(_0x3ac85d){logger[_0x31bc('0x13')](_0x31bc('0x16'),_0x3ac85d[_0x31bc('0x14')],_0x561755);_0x38a074(_0x10b0ef[_0x31bc('0x13')](0x1f4,_0x3ac85d[_0x31bc('0x14')]));});});};exports[_0x31bc('0x1c')]=function(_0x4c1f23){var _0x2ceb53=this;return new Promise(function(_0x37a4e5,_0x8caa5f){return db['ChatQueueReport'][_0x31bc('0x1d')](_0x4c1f23[_0x31bc('0x19')],{'raw':_0x4c1f23[_0x31bc('0x1a')]?_0x4c1f23['options'][_0x31bc('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c1f23[_0x31bc('0x1a')]?_0x4c1f23[_0x31bc('0x1a')][_0x31bc('0x1f')]||null:null,'attributes':_0x4c1f23[_0x31bc('0x1a')]?_0x4c1f23[_0x31bc('0x1a')][_0x31bc('0x20')]||null:null,'limit':_0x4c1f23[_0x31bc('0x1a')]?_0x4c1f23[_0x31bc('0x1a')][_0x31bc('0x21')]||null:null})[_0x31bc('0x1b')](function(_0x47528f){logger[_0x31bc('0xd')](_0x31bc('0x1c'),_0x4c1f23);logger['debug']('UpdateChatQueueReport',_0x4c1f23,JSON['stringify'](_0x47528f));_0x37a4e5(_0x47528f);})[_0x31bc('0x15')](function(_0x3cc9e6){logger[_0x31bc('0x13')](_0x31bc('0x1c'),_0x3cc9e6['message'],_0x4c1f23);_0x8caa5f(_0x2ceb53[_0x31bc('0x13')](0x1f4,_0x3cc9e6['message']));});});}; \ No newline at end of file +var _0xf38a=['options','update','raw','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','body'];(function(_0x668458,_0x393711){var _0x2d203b=function(_0x3ae0d3){while(--_0x3ae0d3){_0x668458['push'](_0x668458['shift']());}};_0x2d203b(++_0x393711);}(_0xf38a,0x193));var _0xaf38=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0xf38a[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0xaf38('0x0'));var util=require(_0xaf38('0x1'));var moment=require(_0xaf38('0x2'));var BPromise=require(_0xaf38('0x3'));var rs=require(_0xaf38('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf38('0x5'))['db'];var utils=require(_0xaf38('0x6'));var logger=require(_0xaf38('0x7'))(_0xaf38('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf38('0x9'));var client=jayson[_0xaf38('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x420ea1,_0x4b670a,_0xc61e26){return new BPromise(function(_0x53a87e,_0x37b166){return client[_0xaf38('0xb')](_0x420ea1,_0xc61e26)[_0xaf38('0xc')](function(_0x498f52){logger[_0xaf38('0xd')](_0xaf38('0xe'),_0x4b670a,_0xaf38('0xf'));logger[_0xaf38('0x10')](_0xaf38('0x11'),_0x4b670a,_0xaf38('0xf'),JSON[_0xaf38('0x12')](_0x498f52));if(_0x498f52[_0xaf38('0x13')]){if(_0x498f52['error'][_0xaf38('0x14')]===0x1f4){logger['error'](_0xaf38('0xe'),_0x4b670a,_0x498f52[_0xaf38('0x13')][_0xaf38('0x15')]);return _0x37b166(_0x498f52[_0xaf38('0x13')][_0xaf38('0x15')]);}logger[_0xaf38('0x13')](_0xaf38('0xe'),_0x4b670a,_0x498f52[_0xaf38('0x13')][_0xaf38('0x15')]);return _0x53a87e(_0x498f52['error'][_0xaf38('0x15')]);}else{logger[_0xaf38('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x4b670a,'request\x20sent');_0x53a87e(_0x498f52['result']['message']);}})[_0xaf38('0x16')](function(_0x56a326){logger[_0xaf38('0x13')](_0xaf38('0xe'),_0x4b670a,_0x56a326);_0x37b166(_0x56a326);});});}exports[_0xaf38('0x17')]=function(_0x1d0466){var _0x22e170=this;return new Promise(function(_0x3123a8,_0xb2bb40){return db[_0xaf38('0x18')]['create'](_0x1d0466[_0xaf38('0x19')],{'raw':_0x1d0466[_0xaf38('0x1a')]?_0x1d0466[_0xaf38('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xaf38('0xc')](function(_0x2a12b8){logger['info'](_0xaf38('0x17'),_0x1d0466);logger[_0xaf38('0x10')](_0xaf38('0x17'),_0x1d0466,JSON[_0xaf38('0x12')](_0x2a12b8));_0x3123a8(_0x2a12b8);})[_0xaf38('0x16')](function(_0x3a0d31){logger[_0xaf38('0x13')]('CreateChatQueueReport',_0x3a0d31[_0xaf38('0x15')],_0x1d0466);_0xb2bb40(_0x22e170[_0xaf38('0x13')](0x1f4,_0x3a0d31['message']));});});};exports['UpdateChatQueueReport']=function(_0x4356b7){var _0x2c308b=this;return new Promise(function(_0x2923f9,_0x4cb86c){return db[_0xaf38('0x18')][_0xaf38('0x1b')](_0x4356b7[_0xaf38('0x19')],{'raw':_0x4356b7['options']?_0x4356b7[_0xaf38('0x1a')][_0xaf38('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4356b7[_0xaf38('0x1a')]?_0x4356b7['options'][_0xaf38('0x1d')]||null:null,'attributes':_0x4356b7[_0xaf38('0x1a')]?_0x4356b7['options'][_0xaf38('0x1e')]||null:null,'limit':_0x4356b7[_0xaf38('0x1a')]?_0x4356b7[_0xaf38('0x1a')][_0xaf38('0x1f')]||null:null})['then'](function(_0x4a9eca){logger['info'](_0xaf38('0x20'),_0x4356b7);logger[_0xaf38('0x10')](_0xaf38('0x20'),_0x4356b7,JSON['stringify'](_0x4a9eca));_0x2923f9(_0x4a9eca);})[_0xaf38('0x16')](function(_0x2a9953){logger[_0xaf38('0x13')]('UpdateChatQueueReport',_0x2a9953['message'],_0x4356b7);_0x4cb86c(_0x2c308b[_0xaf38('0x13')](0x1f4,_0x2a9953[_0xaf38('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 697386d..1d08036 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5f2f,0x73));var _0xf5f2=function(_0x410f92,_0x17db07){_0x410f92=_0x410f92-0x0;var _0x1ef878=_0x5f2f[_0x410f92];return _0x1ef878;};'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 fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x1bbc71,_0x2a9343){var _0x12afb9=function(_0x1029d2){while(--_0x1029d2){_0x1bbc71['push'](_0x1bbc71['shift']());}};_0x12afb9(++_0x2a9343);}(_0x1261,0x144));var _0x1126=function(_0x107e87,_0x20293b){_0x107e87=_0x107e87-0x0;var _0x267b1a=_0x1261[_0x107e87];return _0x267b1a;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index fd81045..66790b5 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 _0x45eb=['agent','queue','DATE','NOW','moment','exports','STRING','account'];(function(_0x5735e4,_0xcf9aa4){var _0x2b1b17=function(_0x4e2df2){while(--_0x4e2df2){_0x5735e4['push'](_0x5735e4['shift']());}};_0x2b1b17(++_0xcf9aa4);}(_0x45eb,0x16c));var _0xb45e=function(_0x423706,_0x8eef51){_0x423706=_0x423706-0x0;var _0x4dd118=_0x45eb[_0x423706];return _0x4dd118;};'use strict';var moment=require(_0xb45e('0x0'));var Sequelize=require('sequelize');module[_0xb45e('0x1')]={'uniqueid':{'type':Sequelize[_0xb45e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb45e('0x3'),_0xb45e('0x4'),_0xb45e('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb45e('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb45e('0x7')]}}; \ No newline at end of file +var _0x33eb=['ENUM','account','queue','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x33eb,0x14d));var _0xb33e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33eb[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require(_0xb33e('0x0'));module[_0xb33e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb33e('0x2')](_0xb33e('0x3'),'agent',_0xb33e('0x4')),'allowNull':![],'defaultValue':_0xb33e('0x4')},'transferredAt':{'type':Sequelize['DATE'],'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 77cb7b4..6e55f3f 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 _0x8c47=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','status','set','apply','save','update','then','destroy','end','error','name','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8c47,0x184));var _0x78c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x8c47[_0x2e4aa2];return _0x5e6092;};'use strict';var pdf=require(_0x78c4('0x0'));var emlformat=require(_0x78c4('0x1'));var rimraf=require(_0x78c4('0x2'));var zipdir=require(_0x78c4('0x3'));var jsonpatch=require(_0x78c4('0x4'));var rp=require('request-promise');var moment=require(_0x78c4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x78c4('0x6'));var util=require(_0x78c4('0x7'));var path=require(_0x78c4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78c4('0x9'));var _=require(_0x78c4('0xa'));var squel=require(_0x78c4('0xb'));var crypto=require(_0x78c4('0xc'));var jsforce=require(_0x78c4('0xd'));var deskjs=require(_0x78c4('0xe'));var toCsv=require(_0x78c4('0xf'));var querystring=require(_0x78c4('0x10'));var Papa=require(_0x78c4('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x78c4('0x12'));var as=require(_0x78c4('0x13'));var hardwareService=require(_0x78c4('0x14'));var logger=require(_0x78c4('0x15'))(_0x78c4('0x16'));var utils=require(_0x78c4('0x17'));var config=require(_0x78c4('0x18'));var licenseUtil=require(_0x78c4('0x19'));var db=require(_0x78c4('0x1a'))['db'];function respondWithStatusCode(_0x35f1be,_0xd3717c){_0xd3717c=_0xd3717c||0xcc;return function(_0x4ffa15){if(_0x4ffa15){return _0x35f1be[_0x78c4('0x1b')](_0xd3717c);}return _0x35f1be['status'](_0xd3717c)['end']();};}function respondWithResult(_0x2c5fd4,_0xe3effa){_0xe3effa=_0xe3effa||0xc8;return function(_0x588104){if(_0x588104){return _0x2c5fd4['status'](_0xe3effa)[_0x78c4('0x1c')](_0x588104);}};}function respondWithFilteredResult(_0x1313b7,_0x225a50){return function(_0x30d3bd){if(_0x30d3bd){var _0xf4f445=_0x30d3bd[_0x78c4('0x1d')],_0x96d415=_0x225a50[_0x78c4('0x1e')],_0x3d1f5c=_0x225a50[_0x78c4('0x1e')]+_0x225a50[_0x78c4('0x1f')],_0x30f915;if(_0x3d1f5c>=_0xf4f445){_0x3d1f5c=_0xf4f445;_0x30f915=0xc8;}else{_0x30f915=0xce;}_0x1313b7[_0x78c4('0x20')](_0x30f915);return _0x1313b7[_0x78c4('0x21')]('Content-Range',_0x96d415+'-'+_0x3d1f5c+'/'+_0xf4f445)[_0x78c4('0x1c')](_0x30d3bd);}return null;};}function patchUpdates(_0x2a7e86){return function(_0x3ab648){try{jsonpatch[_0x78c4('0x22')](_0x3ab648,_0x2a7e86,!![]);}catch(_0x57b2f8){return BPromise['reject'](_0x57b2f8);}return _0x3ab648[_0x78c4('0x23')]();};}function saveUpdates(_0x3d0288,_0x553e30){return function(_0x47cddd){if(_0x47cddd){return _0x47cddd[_0x78c4('0x24')](_0x3d0288)[_0x78c4('0x25')](function(_0x53cdc8){return _0x53cdc8;});}return null;};}function removeEntity(_0x268fb6,_0x119d6d){return function(_0x20532c){if(_0x20532c){return _0x20532c[_0x78c4('0x26')]()[_0x78c4('0x25')](function(){_0x268fb6[_0x78c4('0x20')](0xcc)[_0x78c4('0x27')]();});}};}function handleEntityNotFound(_0x2665e6,_0x280562){return function(_0x41d4a9){if(!_0x41d4a9){_0x2665e6[_0x78c4('0x1b')](0x194);}return _0x41d4a9;};}function handleError(_0x129ebc,_0x1ce66c){_0x1ce66c=_0x1ce66c||0x1f4;return function(_0x48353b){logger[_0x78c4('0x28')](_0x48353b['stack']);if(_0x48353b[_0x78c4('0x29')]){delete _0x48353b['name'];}_0x129ebc[_0x78c4('0x20')](_0x1ce66c)['send'](_0x48353b);};}exports['index']=function(_0x236724,_0xbf7dec){var _0x353257={},_0x1e1af2={},_0x2a18a={'count':0x0,'rows':[]};var _0x797795=_[_0x78c4('0x2a')](db[_0x78c4('0x2b')][_0x78c4('0x2c')],function(_0x27c363){return{'name':_0x27c363[_0x78c4('0x2d')],'type':_0x27c363[_0x78c4('0x2e')][_0x78c4('0x2f')]};});_0x1e1af2[_0x78c4('0x30')]=_[_0x78c4('0x2a')](_0x797795,_0x78c4('0x29'));_0x1e1af2[_0x78c4('0x31')]=_[_0x78c4('0x32')](_0x236724[_0x78c4('0x31')]);_0x1e1af2[_0x78c4('0x33')]=_[_0x78c4('0x34')](_0x1e1af2[_0x78c4('0x30')],_0x1e1af2[_0x78c4('0x31')]);_0x353257[_0x78c4('0x35')]=_['intersection'](_0x1e1af2[_0x78c4('0x30')],qs['fields'](_0x236724['query'][_0x78c4('0x36')]));_0x353257[_0x78c4('0x35')]=_0x353257[_0x78c4('0x35')][_0x78c4('0x37')]?_0x353257[_0x78c4('0x35')]:_0x1e1af2[_0x78c4('0x30')];if(!_0x236724['query']['hasOwnProperty']('nolimit')){_0x353257[_0x78c4('0x1f')]=qs[_0x78c4('0x1f')](_0x236724[_0x78c4('0x31')]['limit']);_0x353257['offset']=qs['offset'](_0x236724[_0x78c4('0x31')][_0x78c4('0x1e')]);}_0x353257[_0x78c4('0x38')]=qs[_0x78c4('0x39')](_0x236724[_0x78c4('0x31')]['sort']);_0x353257[_0x78c4('0x3a')]=qs[_0x78c4('0x33')](_[_0x78c4('0x3b')](_0x236724[_0x78c4('0x31')],_0x1e1af2['filters']),_0x797795);if(_0x236724['query'][_0x78c4('0x3c')]){_0x353257[_0x78c4('0x3a')]=_[_0x78c4('0x3d')](_0x353257[_0x78c4('0x3a')],{'$or':_['map'](_0x797795,function(_0x1ceded){if(_0x1ceded[_0x78c4('0x2e')]!==_0x78c4('0x3e')){var _0x8586d9={};_0x8586d9[_0x1ceded[_0x78c4('0x29')]]={'$like':'%'+_0x236724[_0x78c4('0x31')][_0x78c4('0x3c')]+'%'};return _0x8586d9;}})});}_0x353257=_[_0x78c4('0x3d')]({},_0x353257,_0x236724[_0x78c4('0x3f')]);var _0x145cfe={'where':_0x353257[_0x78c4('0x3a')]};return db['ChatTransferReport'][_0x78c4('0x1d')](_0x145cfe)[_0x78c4('0x25')](function(_0x42a78c){_0x2a18a[_0x78c4('0x1d')]=_0x42a78c;if(_0x236724[_0x78c4('0x31')][_0x78c4('0x40')]){_0x353257[_0x78c4('0x41')]=[{'all':!![]}];}return db[_0x78c4('0x2b')][_0x78c4('0x42')](_0x353257);})[_0x78c4('0x25')](function(_0x313efd){_0x2a18a[_0x78c4('0x43')]=_0x313efd;return _0x2a18a;})[_0x78c4('0x25')](respondWithFilteredResult(_0xbf7dec,_0x353257))[_0x78c4('0x44')](handleError(_0xbf7dec,null));};exports[_0x78c4('0x45')]=function(_0x8cea01,_0x52a491){var _0x499f48={'raw':!![],'where':{'id':_0x8cea01[_0x78c4('0x46')]['id']}},_0x401db2={};_0x401db2[_0x78c4('0x30')]=_[_0x78c4('0x32')](db[_0x78c4('0x2b')][_0x78c4('0x2c')]);_0x401db2[_0x78c4('0x31')]=_[_0x78c4('0x32')](_0x8cea01[_0x78c4('0x31')]);_0x401db2[_0x78c4('0x33')]=_['intersection'](_0x401db2[_0x78c4('0x30')],_0x401db2[_0x78c4('0x31')]);_0x499f48['attributes']=_[_0x78c4('0x34')](_0x401db2[_0x78c4('0x30')],qs[_0x78c4('0x36')](_0x8cea01['query'][_0x78c4('0x36')]));_0x499f48[_0x78c4('0x35')]=_0x499f48[_0x78c4('0x35')][_0x78c4('0x37')]?_0x499f48[_0x78c4('0x35')]:_0x401db2[_0x78c4('0x30')];if(_0x8cea01[_0x78c4('0x31')][_0x78c4('0x40')]){_0x499f48['include']=[{'all':!![]}];}_0x499f48=_[_0x78c4('0x3d')]({},_0x499f48,_0x8cea01[_0x78c4('0x3f')]);return db[_0x78c4('0x2b')][_0x78c4('0x47')](_0x499f48)[_0x78c4('0x25')](handleEntityNotFound(_0x52a491,null))[_0x78c4('0x25')](respondWithResult(_0x52a491,null))[_0x78c4('0x44')](handleError(_0x52a491,null));};exports['create']=function(_0x4c74c0,_0x9e4a0b){return db[_0x78c4('0x2b')][_0x78c4('0x48')](_0x4c74c0['body'],{})['then'](respondWithResult(_0x9e4a0b,0xc9))['catch'](handleError(_0x9e4a0b,null));};exports[_0x78c4('0x24')]=function(_0x4b8460,_0x1e496b){if(_0x4b8460['body']['id']){delete _0x4b8460[_0x78c4('0x49')]['id'];}return db[_0x78c4('0x2b')][_0x78c4('0x47')]({'where':{'id':_0x4b8460[_0x78c4('0x46')]['id']}})[_0x78c4('0x25')](handleEntityNotFound(_0x1e496b,null))['then'](saveUpdates(_0x4b8460['body'],null))['then'](respondWithResult(_0x1e496b,null))['catch'](handleError(_0x1e496b,null));};exports['destroy']=function(_0x55f9e7,_0x57ed9a){return db['ChatTransferReport']['find']({'where':{'id':_0x55f9e7['params']['id']}})[_0x78c4('0x25')](handleEntityNotFound(_0x57ed9a,null))['then'](removeEntity(_0x57ed9a,null))[_0x78c4('0x44')](handleError(_0x57ed9a,null));};exports[_0x78c4('0x4a')]=function(_0xa4a93a,_0x594ead){return db[_0x78c4('0x2b')][_0x78c4('0x4a')]()['then'](respondWithResult(_0x594ead,null))['catch'](handleError(_0x594ead,null));}; \ No newline at end of file +var _0x7dc9=['merge','options','ChatTransferReport','then','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','bluebird','util','path','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','error','name','send','index','map','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','filters','filter','VIRTUAL'];(function(_0x5175b4,_0x5d57b3){var _0x2a710f=function(_0x51320d){while(--_0x51320d){_0x5175b4['push'](_0x5175b4['shift']());}};_0x2a710f(++_0x5d57b3);}(_0x7dc9,0x99));var _0x97dc=function(_0x59e4dc,_0x3f6fbf){_0x59e4dc=_0x59e4dc-0x0;var _0x2ce798=_0x7dc9[_0x59e4dc];return _0x2ce798;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x97dc('0x0'));var rimraf=require(_0x97dc('0x1'));var zipdir=require(_0x97dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x97dc('0x3'));var Mustache=require('mustache');var util=require(_0x97dc('0x4'));var path=require(_0x97dc('0x5'));var sox=require('sox');var csv=require(_0x97dc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97dc('0x7'));var squel=require(_0x97dc('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x97dc('0x9'));var Papa=require(_0x97dc('0xa'));var Redis=require(_0x97dc('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x97dc('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97dc('0xd'));var logger=require(_0x97dc('0xe'))(_0x97dc('0xf'));var utils=require(_0x97dc('0x10'));var config=require(_0x97dc('0x11'));var licenseUtil=require(_0x97dc('0x12'));var db=require(_0x97dc('0x13'))['db'];function respondWithStatusCode(_0x5b96fd,_0x5c4485){_0x5c4485=_0x5c4485||0xcc;return function(_0x2190fa){if(_0x2190fa){return _0x5b96fd['sendStatus'](_0x5c4485);}return _0x5b96fd[_0x97dc('0x14')](_0x5c4485)[_0x97dc('0x15')]();};}function respondWithResult(_0x42e803,_0x55442d){_0x55442d=_0x55442d||0xc8;return function(_0x3a8880){if(_0x3a8880){return _0x42e803[_0x97dc('0x14')](_0x55442d)[_0x97dc('0x16')](_0x3a8880);}};}function respondWithFilteredResult(_0x5803c3,_0x2f0954){return function(_0x1993d6){if(_0x1993d6){var _0x4f215e=_0x1993d6[_0x97dc('0x17')],_0x35f3f5=_0x2f0954['offset'],_0x237ea7=_0x2f0954[_0x97dc('0x18')]+_0x2f0954['limit'],_0x54e02a;if(_0x237ea7>=_0x4f215e){_0x237ea7=_0x4f215e;_0x54e02a=0xc8;}else{_0x54e02a=0xce;}_0x5803c3[_0x97dc('0x14')](_0x54e02a);return _0x5803c3['set'](_0x97dc('0x19'),_0x35f3f5+'-'+_0x237ea7+'/'+_0x4f215e)['json'](_0x1993d6);}return null;};}function patchUpdates(_0x44d77f){return function(_0x43586c){try{jsonpatch[_0x97dc('0x1a')](_0x43586c,_0x44d77f,!![]);}catch(_0x132bc1){return BPromise[_0x97dc('0x1b')](_0x132bc1);}return _0x43586c[_0x97dc('0x1c')]();};}function saveUpdates(_0x24ae8a,_0x221343){return function(_0x2655bb){if(_0x2655bb){return _0x2655bb[_0x97dc('0x1d')](_0x24ae8a)['then'](function(_0x351233){return _0x351233;});}return null;};}function removeEntity(_0xdd48bd,_0x462baa){return function(_0x3019ca){if(_0x3019ca){return _0x3019ca[_0x97dc('0x1e')]()['then'](function(){_0xdd48bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x496787,_0x220772){return function(_0x162e60){if(!_0x162e60){_0x496787['sendStatus'](0x194);}return _0x162e60;};}function handleError(_0x734c8a,_0x3744b3){_0x3744b3=_0x3744b3||0x1f4;return function(_0xf1367d){logger[_0x97dc('0x1f')](_0xf1367d['stack']);if(_0xf1367d[_0x97dc('0x20')]){delete _0xf1367d[_0x97dc('0x20')];}_0x734c8a[_0x97dc('0x14')](_0x3744b3)[_0x97dc('0x21')](_0xf1367d);};}exports[_0x97dc('0x22')]=function(_0x2200df,_0x3ae466){var _0x2e7ade={},_0x4f9d83={},_0x3b1226={'count':0x0,'rows':[]};var _0x394f66=_[_0x97dc('0x23')](db['ChatTransferReport']['rawAttributes'],function(_0x12835e){return{'name':_0x12835e[_0x97dc('0x24')],'type':_0x12835e[_0x97dc('0x25')]['key']};});_0x4f9d83[_0x97dc('0x26')]=_[_0x97dc('0x23')](_0x394f66,_0x97dc('0x20'));_0x4f9d83[_0x97dc('0x27')]=_['keys'](_0x2200df[_0x97dc('0x27')]);_0x4f9d83['filters']=_[_0x97dc('0x28')](_0x4f9d83[_0x97dc('0x26')],_0x4f9d83[_0x97dc('0x27')]);_0x2e7ade[_0x97dc('0x29')]=_[_0x97dc('0x28')](_0x4f9d83['model'],qs['fields'](_0x2200df[_0x97dc('0x27')][_0x97dc('0x2a')]));_0x2e7ade['attributes']=_0x2e7ade[_0x97dc('0x29')][_0x97dc('0x2b')]?_0x2e7ade['attributes']:_0x4f9d83['model'];if(!_0x2200df['query'][_0x97dc('0x2c')]('nolimit')){_0x2e7ade[_0x97dc('0x2d')]=qs[_0x97dc('0x2d')](_0x2200df[_0x97dc('0x27')][_0x97dc('0x2d')]);_0x2e7ade['offset']=qs['offset'](_0x2200df[_0x97dc('0x27')][_0x97dc('0x18')]);}_0x2e7ade[_0x97dc('0x2e')]=qs['sort'](_0x2200df[_0x97dc('0x27')]['sort']);_0x2e7ade[_0x97dc('0x2f')]=qs[_0x97dc('0x30')](_['pick'](_0x2200df[_0x97dc('0x27')],_0x4f9d83[_0x97dc('0x30')]),_0x394f66);if(_0x2200df[_0x97dc('0x27')][_0x97dc('0x31')]){_0x2e7ade[_0x97dc('0x2f')]=_['merge'](_0x2e7ade['where'],{'$or':_[_0x97dc('0x23')](_0x394f66,function(_0x29b5f5){if(_0x29b5f5[_0x97dc('0x25')]!==_0x97dc('0x32')){var _0x380638={};_0x380638[_0x29b5f5['name']]={'$like':'%'+_0x2200df[_0x97dc('0x27')]['filter']+'%'};return _0x380638;}})});}_0x2e7ade=_[_0x97dc('0x33')]({},_0x2e7ade,_0x2200df[_0x97dc('0x34')]);var _0x27db4a={'where':_0x2e7ade[_0x97dc('0x2f')]};return db[_0x97dc('0x35')][_0x97dc('0x17')](_0x27db4a)[_0x97dc('0x36')](function(_0x4d252e){_0x3b1226[_0x97dc('0x17')]=_0x4d252e;if(_0x2200df['query'][_0x97dc('0x37')]){_0x2e7ade[_0x97dc('0x38')]=[{'all':!![]}];}return db[_0x97dc('0x35')][_0x97dc('0x39')](_0x2e7ade);})[_0x97dc('0x36')](function(_0x39eb46){_0x3b1226[_0x97dc('0x3a')]=_0x39eb46;return _0x3b1226;})['then'](respondWithFilteredResult(_0x3ae466,_0x2e7ade))['catch'](handleError(_0x3ae466,null));};exports[_0x97dc('0x3b')]=function(_0x286c23,_0x3866a6){var _0x1f8daf={'raw':!![],'where':{'id':_0x286c23[_0x97dc('0x3c')]['id']}},_0xb8b78c={};_0xb8b78c[_0x97dc('0x26')]=_['keys'](db[_0x97dc('0x35')][_0x97dc('0x3d')]);_0xb8b78c['query']=_[_0x97dc('0x3e')](_0x286c23[_0x97dc('0x27')]);_0xb8b78c[_0x97dc('0x30')]=_[_0x97dc('0x28')](_0xb8b78c['model'],_0xb8b78c[_0x97dc('0x27')]);_0x1f8daf['attributes']=_[_0x97dc('0x28')](_0xb8b78c[_0x97dc('0x26')],qs['fields'](_0x286c23[_0x97dc('0x27')][_0x97dc('0x2a')]));_0x1f8daf['attributes']=_0x1f8daf[_0x97dc('0x29')][_0x97dc('0x2b')]?_0x1f8daf[_0x97dc('0x29')]:_0xb8b78c[_0x97dc('0x26')];if(_0x286c23[_0x97dc('0x27')][_0x97dc('0x37')]){_0x1f8daf[_0x97dc('0x38')]=[{'all':!![]}];}_0x1f8daf=_['merge']({},_0x1f8daf,_0x286c23['options']);return db[_0x97dc('0x35')][_0x97dc('0x3f')](_0x1f8daf)[_0x97dc('0x36')](handleEntityNotFound(_0x3866a6,null))[_0x97dc('0x36')](respondWithResult(_0x3866a6,null))['catch'](handleError(_0x3866a6,null));};exports[_0x97dc('0x40')]=function(_0x375386,_0x184783){return db[_0x97dc('0x35')]['create'](_0x375386[_0x97dc('0x41')],{})[_0x97dc('0x36')](respondWithResult(_0x184783,0xc9))[_0x97dc('0x42')](handleError(_0x184783,null));};exports[_0x97dc('0x1d')]=function(_0x257335,_0x109885){if(_0x257335[_0x97dc('0x41')]['id']){delete _0x257335[_0x97dc('0x41')]['id'];}return db[_0x97dc('0x35')][_0x97dc('0x3f')]({'where':{'id':_0x257335[_0x97dc('0x3c')]['id']}})[_0x97dc('0x36')](handleEntityNotFound(_0x109885,null))[_0x97dc('0x36')](saveUpdates(_0x257335[_0x97dc('0x41')],null))['then'](respondWithResult(_0x109885,null))['catch'](handleError(_0x109885,null));};exports[_0x97dc('0x1e')]=function(_0x5e4b60,_0x5edec4){return db[_0x97dc('0x35')][_0x97dc('0x3f')]({'where':{'id':_0x5e4b60[_0x97dc('0x3c')]['id']}})[_0x97dc('0x36')](handleEntityNotFound(_0x5edec4,null))[_0x97dc('0x36')](removeEntity(_0x5edec4,null))[_0x97dc('0x42')](handleError(_0x5edec4,null));};exports[_0x97dc('0x43')]=function(_0xc10b78,_0x1d3c7d){return db[_0x97dc('0x35')]['describe']()[_0x97dc('0x36')](respondWithResult(_0x1d3c7d,null))[_0x97dc('0x42')](handleError(_0x1d3c7d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4cb6bdd..491b812 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 _0x6cb7=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','uniqueid','util','../../config/logger','api','bluebird','path'];(function(_0x121886,_0x8cd8e5){var _0x20ca01=function(_0x15e144){while(--_0x15e144){_0x121886['push'](_0x121886['shift']());}};_0x20ca01(++_0x8cd8e5);}(_0x6cb7,0x19f));var _0x76cb=function(_0x493bf1,_0x204369){_0x493bf1=_0x493bf1-0x0;var _0x3550d4=_0x6cb7[_0x493bf1];return _0x3550d4;};'use strict';var _=require('lodash');var util=require(_0x76cb('0x0'));var logger=require(_0x76cb('0x1'))(_0x76cb('0x2'));var moment=require('moment');var BPromise=require(_0x76cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76cb('0x4'));var rimraf=require(_0x76cb('0x5'));var config=require(_0x76cb('0x6'));var attributes=require(_0x76cb('0x7'));module[_0x76cb('0x8')]=function(_0x257a1f,_0x8e4b16){return _0x257a1f['define']('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x76cb('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a11=['path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1f5c89,_0x3b8c9d){var _0xadacc2=function(_0x4cf66f){while(--_0x4cf66f){_0x1f5c89['push'](_0x1f5c89['shift']());}};_0xadacc2(++_0x3b8c9d);}(_0x1a11,0x120));var _0x11a1=function(_0x33fc12,_0x16d80e){_0x33fc12=_0x33fc12-0x0;var _0x54355b=_0x1a11[_0x33fc12];return _0x54355b;};'use strict';var _=require(_0x11a1('0x0'));var util=require(_0x11a1('0x1'));var logger=require(_0x11a1('0x2'))('api');var moment=require(_0x11a1('0x3'));var BPromise=require(_0x11a1('0x4'));var rp=require(_0x11a1('0x5'));var fs=require('fs');var path=require(_0x11a1('0x6'));var rimraf=require(_0x11a1('0x7'));var config=require(_0x11a1('0x8'));var attributes=require(_0x11a1('0x9'));module[_0x11a1('0xa')]=function(_0x1333f7,_0x70c9b5){return _0x1333f7[_0x11a1('0xb')](_0x11a1('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x11a1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5afe49a..0b94ff5 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 _0xcdb4=['debug','error','code','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xb18ed1,_0x2706ea){var _0x175e8d=function(_0x21d69c){while(--_0x21d69c){_0xb18ed1['push'](_0xb18ed1['shift']());}};_0x175e8d(++_0x2706ea);}(_0xcdb4,0x1f3));var _0x4cdb=function(_0x322504,_0x46f761){_0x322504=_0x322504-0x0;var _0x12d118=_0xcdb4[_0x322504];return _0x12d118;};'use strict';var _=require(_0x4cdb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4cdb('0x1'));var fs=require('fs');var Redis=require(_0x4cdb('0x2'));var db=require(_0x4cdb('0x3'))['db'];var utils=require(_0x4cdb('0x4'));var logger=require(_0x4cdb('0x5'))(_0x4cdb('0x6'));var config=require(_0x4cdb('0x7'));var jayson=require(_0x4cdb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d0a21,_0x2d50cc,_0x4985c1){return new BPromise(function(_0x3df0f0,_0x4b32ad){return client[_0x4cdb('0x9')](_0x5d0a21,_0x4985c1)[_0x4cdb('0xa')](function(_0x9ba2a8){logger[_0x4cdb('0xb')](_0x4cdb('0xc'),_0x2d50cc,_0x4cdb('0xd'));logger[_0x4cdb('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2d50cc,_0x4cdb('0xd'),JSON['stringify'](_0x9ba2a8));if(_0x9ba2a8[_0x4cdb('0xf')]){if(_0x9ba2a8['error'][_0x4cdb('0x10')]===0x1f4){logger[_0x4cdb('0xf')](_0x4cdb('0xc'),_0x2d50cc,_0x9ba2a8[_0x4cdb('0xf')][_0x4cdb('0x11')]);return _0x4b32ad(_0x9ba2a8[_0x4cdb('0xf')][_0x4cdb('0x11')]);}logger[_0x4cdb('0xf')](_0x4cdb('0xc'),_0x2d50cc,_0x9ba2a8[_0x4cdb('0xf')][_0x4cdb('0x11')]);return _0x3df0f0(_0x9ba2a8[_0x4cdb('0xf')]['message']);}else{logger[_0x4cdb('0xb')](_0x4cdb('0xc'),_0x2d50cc,_0x4cdb('0xd'));_0x3df0f0(_0x9ba2a8['result'][_0x4cdb('0x11')]);}})[_0x4cdb('0x12')](function(_0x2bd40c){logger[_0x4cdb('0xf')](_0x4cdb('0xc'),_0x2d50cc,_0x2bd40c);_0x4b32ad(_0x2bd40c);});});} \ No newline at end of file +var _0x3452=['rpc','../../config/environment','jayson/promise','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c7b4b,_0x39bb66){var _0x593e8e=function(_0x3543af){while(--_0x3543af){_0x5c7b4b['push'](_0x5c7b4b['shift']());}};_0x593e8e(++_0x39bb66);}(_0x3452,0x77));var _0x2345=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3452[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2345('0x0'));var util=require(_0x2345('0x1'));var moment=require('moment');var BPromise=require(_0x2345('0x2'));var rs=require(_0x2345('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2345('0x4'))['db'];var utils=require(_0x2345('0x5'));var logger=require(_0x2345('0x6'))(_0x2345('0x7'));var config=require(_0x2345('0x8'));var jayson=require(_0x2345('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a503e,_0x588f64,_0x37c2c1){return new BPromise(function(_0x516838,_0xab8733){return client['request'](_0x4a503e,_0x37c2c1)['then'](function(_0x16eb38){logger['info'](_0x2345('0xa'),_0x588f64,_0x2345('0xb'));logger[_0x2345('0xc')](_0x2345('0xd'),_0x588f64,_0x2345('0xb'),JSON[_0x2345('0xe')](_0x16eb38));if(_0x16eb38[_0x2345('0xf')]){if(_0x16eb38[_0x2345('0xf')][_0x2345('0x10')]===0x1f4){logger['error'](_0x2345('0xa'),_0x588f64,_0x16eb38[_0x2345('0xf')][_0x2345('0x11')]);return _0xab8733(_0x16eb38[_0x2345('0xf')][_0x2345('0x11')]);}logger[_0x2345('0xf')](_0x2345('0xa'),_0x588f64,_0x16eb38[_0x2345('0xf')]['message']);return _0x516838(_0x16eb38['error'][_0x2345('0x11')]);}else{logger[_0x2345('0x12')](_0x2345('0xa'),_0x588f64,_0x2345('0xb'));_0x516838(_0x16eb38[_0x2345('0x13')][_0x2345('0x11')]);}})[_0x2345('0x14')](function(_0x4ed28b){logger[_0x2345('0xf')](_0x2345('0xa'),_0x588f64,_0x4ed28b);_0xab8733(_0x4ed28b);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 169e38e..27d36da 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 _0x24a1=['get','index','isAuthenticated','describe','/:id','show','post','create','put','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x4d7dd3,_0x146ca7){var _0x124ac8=function(_0x42c6ee){while(--_0x42c6ee){_0x4d7dd3['push'](_0x4d7dd3['shift']());}};_0x124ac8(++_0x146ca7);}(_0x24a1,0x102));var _0x124a=function(_0x340202,_0x3fbd73){_0x340202=_0x340202-0x0;var _0x4dc58c=_0x24a1[_0x340202];return _0x4dc58c;};'use strict';var multer=require(_0x124a('0x0'));var util=require('util');var path=require(_0x124a('0x1'));var timeout=require('connect-timeout');var express=require(_0x124a('0x2'));var router=express[_0x124a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x124a('0x4'));var interaction=require(_0x124a('0x5'));var config=require(_0x124a('0x6'));var controller=require(_0x124a('0x7'));router[_0x124a('0x8')]('/',auth['isAuthenticated'](),controller[_0x124a('0x9')]);router[_0x124a('0x8')]('/describe',auth[_0x124a('0xa')](),controller[_0x124a('0xb')]);router[_0x124a('0x8')](_0x124a('0xc'),auth[_0x124a('0xa')](),controller[_0x124a('0xd')]);router[_0x124a('0xe')]('/',auth[_0x124a('0xa')](),controller[_0x124a('0xf')]);router[_0x124a('0x10')](_0x124a('0xc'),auth[_0x124a('0xa')](),controller[_0x124a('0x11')]);router['delete'](_0x124a('0xc'),auth[_0x124a('0xa')](),controller['destroy']);module[_0x124a('0x12')]=router; \ No newline at end of file +var _0xa5eb=['post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2e7b92,_0x40c9d9){var _0x1f10c7=function(_0x3128d5){while(--_0x3128d5){_0x2e7b92['push'](_0x2e7b92['shift']());}};_0x1f10c7(++_0x40c9d9);}(_0xa5eb,0x1bb));var _0xba5e=function(_0x4172e8,_0x95cc58){_0x4172e8=_0x4172e8-0x0;var _0x17be13=_0xa5eb[_0x4172e8];return _0x17be13;};'use strict';var multer=require('multer');var util=require(_0xba5e('0x0'));var path=require(_0xba5e('0x1'));var timeout=require(_0xba5e('0x2'));var express=require(_0xba5e('0x3'));var router=express[_0xba5e('0x4')]();var fs_extra=require(_0xba5e('0x5'));var auth=require(_0xba5e('0x6'));var interaction=require(_0xba5e('0x7'));var config=require(_0xba5e('0x8'));var controller=require(_0xba5e('0x9'));router[_0xba5e('0xa')]('/',auth[_0xba5e('0xb')](),controller[_0xba5e('0xc')]);router['get'](_0xba5e('0xd'),auth[_0xba5e('0xb')](),controller[_0xba5e('0xe')]);router[_0xba5e('0xa')](_0xba5e('0xf'),auth[_0xba5e('0xb')](),controller[_0xba5e('0x10')]);router[_0xba5e('0x11')]('/',auth[_0xba5e('0xb')](),controller[_0xba5e('0x12')]);router['put'](_0xba5e('0xf'),auth[_0xba5e('0xb')](),controller[_0xba5e('0x13')]);router[_0xba5e('0x14')](_0xba5e('0xf'),auth['isAuthenticated'](),controller[_0xba5e('0x15')]);module[_0xba5e('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 92142a0..446e7e0 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 _0x8ef6=['alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','thumb','star','TEXT','stringify','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x326d35,_0x4f65b3){var _0xd3f8f3=function(_0x1fbbaf){while(--_0x1fbbaf){_0x326d35['push'](_0x326d35['shift']());}};_0xd3f8f3(++_0x4f65b3);}(_0x8ef6,0xf2));var _0x68ef=function(_0x549e26,_0x2e87aa){_0x549e26=_0x549e26-0x0;var _0x496e4b=_0x8ef6[_0x549e26];return _0x496e4b;};'use strict';var Sequelize=require(_0x68ef('0x0'));var rs=require(_0x68ef('0x1'));module[_0x68ef('0x2')]={'name':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'unique':_0x68ef('0x4')},'description':{'type':Sequelize[_0x68ef('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x68ef('0x5')},'mapKeyOffline':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x5')},'key':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':_0x68ef('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x68ef('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':_0x68ef('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x68ef('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x68ef('0x3')]},'animation':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x68ef('0xa')](_0x68ef('0xb'),_0x68ef('0xc')),'defaultValue':_0x68ef('0xb')},'header_online':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x68ef('0xe')},'offline_chat_button':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0xf')},'header_offline':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x10')},'download_transcript':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x13')},'noteTitle':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x68ef('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0xf')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x16')},'ratingType':{'type':Sequelize[_0x68ef('0xa')]('star',_0x68ef('0x17')),'defaultValue':_0x68ef('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x68ef('0x19')],'defaultValue':function(){return JSON[_0x68ef('0x1a')]({'items':[{'type':_0x68ef('0x1b'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x68ef('0x1b'),'props':{'title':_0x68ef('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x68ef('0x5'),'type':_0x68ef('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x68ef('0x1c')](_0x68ef('0x1d'))?JSON[_0x68ef('0x1e')](this[_0x68ef('0x1c')](_0x68ef('0x1d'))):{};},'set':function(_0x13280b){return this['setDataValue'](_0x68ef('0x1d'),JSON['stringify'](_0x13280b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x68ef('0x1b'),'props':{'title':_0x68ef('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x68ef('0x5'),'type':_0x68ef('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x68ef('0x1f'),'helpText':_0x68ef('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x68ef('0x1c')](_0x68ef('0x21'))?JSON[_0x68ef('0x1e')](this[_0x68ef('0x1c')](_0x68ef('0x21'))):{};},'set':function(_0x4579cb){return this['setDataValue'](_0x68ef('0x21'),JSON[_0x68ef('0x1a')](_0x4579cb));}},'token':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x68ef('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x68ef('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x24')},'offlineMessageBody':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x68ef('0x19')],'defaultValue':function(){return _0x68ef('0x25');}},'notificationSound':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x68ef('0x26')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x27')},'verticalAlignment':{'type':Sequelize[_0x68ef('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':_0x68ef('0x28')},'defaultTitle':{'type':Sequelize[_0x68ef('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x68ef('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x68ef('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x68ef('0x29')},'systemAvatar':{'type':Sequelize[_0x68ef('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x68ef('0x8')],'comment':_0x68ef('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![],'comment':_0x68ef('0x2b'),'set':function(_0x41ffe0){if(!_0x41ffe0)this['setDataValue'](_0x68ef('0x2c'),null);this[_0x68ef('0x2d')](_0x68ef('0x2e'),_0x41ffe0);}},'vidaooEscalation':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0x68ef('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x68ef('0x19')]}}; \ No newline at end of file +var _0xac9d=['ENUM','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','star','thumb','TEXT','stringify','input','name','text','email','getDataValue','onlineForm','parse','textarea','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN'];(function(_0x3517e5,_0x2c3608){var _0x15ba05=function(_0x6eccbc){while(--_0x6eccbc){_0x3517e5['push'](_0x3517e5['shift']());}};_0x15ba05(++_0x2c3608);}(_0xac9d,0x14d));var _0xdac9=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xac9d[_0x49d41c];return _0xb64c5f;};'use strict';var Sequelize=require(_0xdac9('0x0'));var rs=require(_0xdac9('0x1'));module[_0xdac9('0x2')]={'name':{'type':Sequelize[_0xdac9('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xdac9('0x3')],'allowNull':![],'unique':_0xdac9('0x4')},'description':{'type':Sequelize[_0xdac9('0x3')]},'mapKey':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xdac9('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x5')},'customerAlias':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdac9('0x3')],'allowNull':![],'defaultValue':_0xdac9('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdac9('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdac9('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xdac9('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdac9('0x3')]},'animation':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdac9('0xa')](_0xdac9('0xb'),_0xdac9('0xc')),'defaultValue':_0xdac9('0xb')},'header_online':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xdac9('0xe')},'header_offline':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdac9('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdac9('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x13')},'noteTitle':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x14')},'placeholderMessage':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x15')},'closingMessage':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xdac9('0x16')},'conditionAgreement':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xdac9('0x17')},'ratingType':{'type':Sequelize[_0xdac9('0xa')](_0xdac9('0x18'),_0xdac9('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xdac9('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdac9('0x1a')],'defaultValue':function(){return JSON[_0xdac9('0x1b')]({'items':[{'type':_0xdac9('0x1c'),'variable':null,'config':{'placeholder':_0xdac9('0x1d'),'type':_0xdac9('0x1e'),'required':!![]},'props':{'title':_0xdac9('0x1d'),'helpText':''}},{'type':_0xdac9('0x1c'),'props':{'title':_0xdac9('0x1f'),'helpText':''},'config':{'required':!![],'placeholder':_0xdac9('0x1f'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdac9('0x20')](_0xdac9('0x21'))?JSON[_0xdac9('0x22')](this[_0xdac9('0x20')]('onlineForm')):{};},'set':function(_0x1e631a){return this['setDataValue'](_0xdac9('0x21'),JSON[_0xdac9('0x1b')](_0x1e631a));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xdac9('0x1b')]({'items':[{'type':'input','props':{'title':_0xdac9('0x1f'),'helpText':''},'config':{'required':!![],'placeholder':_0xdac9('0x1f'),'type':_0xdac9('0x1f')},'variable':null},{'type':_0xdac9('0x23'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xdac9('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xdac9('0x20')]('offlineForm')?JSON['parse'](this[_0xdac9('0x20')](_0xdac9('0x25'))):{};},'set':function(_0x13efba){return this[_0xdac9('0x26')](_0xdac9('0x25'),JSON[_0xdac9('0x1b')](_0x13efba));}},'token':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':function(){return rs[_0xdac9('0x27')]();}},'autoclose':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdac9('0x3')]},'forwardOffline':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdac9('0x3')]},'waitingTitle':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x28')},'waitingMessage':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x29')},'offlineMessageSubject':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x2a')},'offlineMessageBody':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x2b')},'skipUnmanaged':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x16')},'sendUnmanaged':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdac9('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xdac9('0x1a')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':_0xdac9('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xdac9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xdac9('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xdac9('0x3')]},'customerAvatar':{'type':Sequelize[_0xdac9('0x1a')]},'showCustomerAvatar':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdac9('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdac9('0x3')],'allowNull':![],'defaultValue':_0xdac9('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdac9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdac9('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xdac9('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdac9('0x8')],'comment':_0xdac9('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x58fd14){if(!_0x58fd14)this[_0xdac9('0x26')](_0xdac9('0x2f'),null);this[_0xdac9('0x26')](_0xdac9('0x30'),_0x58fd14);}},'vidaooEscalation':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 9e712ab..e939eb0 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 _0xef6d=['customerAvatar','addSystemAvatar','getLogo','join','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','systemAvatar','headers','user-agent','getResult','chat','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','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','ChatApplication','Applications','account','applications','list','orderBy','asc','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','notifyMail','attachments','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','getSnippet','Interval','getProactiveActions','virtual','License','Intervals','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','set','Content-Range','json','apply','update','then','destroy','get','ChatWebsites','stack','name','send','Pause','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','catch','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','map','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar'];(function(_0x580907,_0xbde208){var _0x50ab75=function(_0xfdc075){while(--_0xfdc075){_0x580907['push'](_0x580907['shift']());}};_0x50ab75(++_0xbde208);}(_0xef6d,0xb8));var _0xdef6=function(_0x5691be,_0x2f4faa){_0x5691be=_0x5691be-0x0;var _0x16b373=_0xef6d[_0x5691be];return _0x16b373;};'use strict';var pdf=require(_0xdef6('0x0'));var emlformat=require(_0xdef6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdef6('0x2'));var moment=require(_0xdef6('0x3'));var BPromise=require(_0xdef6('0x4'));var Mustache=require(_0xdef6('0x5'));var util=require(_0xdef6('0x6'));var path=require('path');var sox=require(_0xdef6('0x7'));var csv=require(_0xdef6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdef6('0x9'));var _=require(_0xdef6('0xa'));var squel=require('squel');var crypto=require(_0xdef6('0xb'));var jsforce=require(_0xdef6('0xc'));var deskjs=require(_0xdef6('0xd'));var toCsv=require(_0xdef6('0x8'));var querystring=require(_0xdef6('0xe'));var Papa=require(_0xdef6('0xf'));var Redis=require(_0xdef6('0x10'));var authService=require(_0xdef6('0x11'));var qs=require(_0xdef6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdef6('0x13'));var logger=require(_0xdef6('0x14'))(_0xdef6('0x15'));var utils=require(_0xdef6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdef6('0x17'));var db=require(_0xdef6('0x18'))['db'];config[_0xdef6('0x19')]=_[_0xdef6('0x1a')](config[_0xdef6('0x19')],{'host':_0xdef6('0x1b'),'port':0x18eb});var socket=require(_0xdef6('0x1c'))(new Redis(config[_0xdef6('0x19')]));require(_0xdef6('0x1d'))[_0xdef6('0x1e')](socket);var jayson=require(_0xdef6('0x1f'));var client=jayson[_0xdef6('0x20')][_0xdef6('0x21')]({'port':0x232c});var client9002=jayson[_0xdef6('0x20')]['http']({'port':0x232a});var client9003=jayson[_0xdef6('0x20')][_0xdef6('0x21')]({'port':0x232b});var client9001=jayson['client'][_0xdef6('0x21')]({'port':0x2329});function respondWithRpcPromise(_0xf033e9,_0x5d2cce,_0x335680,_0x43021a){return new BPromise(function(_0x52c94a,_0x515d21){var _0x25a609=_0x43021a||client;return _0x25a609[_0xdef6('0x22')](_0xf033e9,_0x335680)['then'](function(_0x4a3c6c){logger[_0xdef6('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x5d2cce,_0xdef6('0x24'));logger[_0xdef6('0x25')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5d2cce,_0xdef6('0x24'),JSON['stringify'](_0x4a3c6c));if(_0x4a3c6c[_0xdef6('0x26')]){if(_0x4a3c6c[_0xdef6('0x26')][_0xdef6('0x27')]===0x1f4){logger[_0xdef6('0x26')](_0xdef6('0x28'),_0x5d2cce,_0x4a3c6c[_0xdef6('0x26')][_0xdef6('0x29')]);return _0x515d21(_0x4a3c6c[_0xdef6('0x26')][_0xdef6('0x29')]);}logger[_0xdef6('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x5d2cce,_0x4a3c6c[_0xdef6('0x26')][_0xdef6('0x29')]);return _0x52c94a(_0x4a3c6c[_0xdef6('0x26')][_0xdef6('0x29')]);}else{logger[_0xdef6('0x23')](_0xdef6('0x28'),_0x5d2cce,_0xdef6('0x24'));_0x52c94a(_0x4a3c6c[_0xdef6('0x2a')]['message']);}})['catch'](function(_0x141a1c){logger[_0xdef6('0x26')](_0xdef6('0x28'),_0x5d2cce,_0x141a1c);_0x515d21(_0x141a1c);});});}function respondWithStatusCode(_0xa5a342,_0x7928af){_0x7928af=_0x7928af||0xcc;return function(_0x27188d){if(_0x27188d){return _0xa5a342[_0xdef6('0x2b')](_0x7928af);}return _0xa5a342[_0xdef6('0x2c')](_0x7928af)[_0xdef6('0x2d')]();};}function respondWithResult(_0x9438a7,_0x128210){_0x128210=_0x128210||0xc8;return function(_0xe8fbf5){if(_0xe8fbf5){return _0x9438a7[_0xdef6('0x2c')](_0x128210)['json'](_0xe8fbf5);}};}function respondWithFilteredResult(_0x1a337b,_0x374ee6){return function(_0x5c0645){if(_0x5c0645){var _0x2d1915=_0x5c0645[_0xdef6('0x2e')],_0x18b797=_0x374ee6[_0xdef6('0x2f')],_0x29b9ff=_0x374ee6[_0xdef6('0x2f')]+_0x374ee6['limit'],_0x1c4bad;if(_0x29b9ff>=_0x2d1915){_0x29b9ff=_0x2d1915;_0x1c4bad=0xc8;}else{_0x1c4bad=0xce;}_0x1a337b[_0xdef6('0x2c')](_0x1c4bad);return _0x1a337b[_0xdef6('0x30')](_0xdef6('0x31'),_0x18b797+'-'+_0x29b9ff+'/'+_0x2d1915)[_0xdef6('0x32')](_0x5c0645);}return null;};}function patchUpdates(_0x4bd52e){return function(_0x464cab){try{jsonpatch[_0xdef6('0x33')](_0x464cab,_0x4bd52e,!![]);}catch(_0xdb1d1d){return BPromise['reject'](_0xdb1d1d);}return _0x464cab['save']();};}function saveUpdates(_0x2ad20a,_0x361e06){return function(_0x390605){if(_0x390605){return _0x390605[_0xdef6('0x34')](_0x2ad20a)[_0xdef6('0x35')](function(_0x30a45b){return _0x30a45b;});}return null;};}function removeEntity(_0x3bafb8,_0x14a659){return function(_0x20ac39){if(_0x20ac39){return _0x20ac39[_0xdef6('0x36')]()[_0xdef6('0x35')](function(){var _0xa34671=_0x20ac39[_0xdef6('0x37')]({'plain':!![]});var _0x510474=_0xdef6('0x38');return db['UserProfileResource'][_0xdef6('0x36')]({'where':{'type':_0x510474,'resourceId':_0xa34671['id']}})[_0xdef6('0x35')](function(){return _0x20ac39;});})[_0xdef6('0x35')](function(){_0x3bafb8[_0xdef6('0x2c')](0xcc)[_0xdef6('0x2d')]();});}};}function handleEntityNotFound(_0x1c78c4,_0x4fa57d){return function(_0x4f5a88){if(!_0x4f5a88){_0x1c78c4[_0xdef6('0x2b')](0x194);}return _0x4f5a88;};}function handleError(_0x5afe9c,_0x289619){_0x289619=_0x289619||0x1f4;return function(_0x1af065){logger['error'](_0x1af065[_0xdef6('0x39')]);if(_0x1af065[_0xdef6('0x3a')]){delete _0x1af065['name'];}_0x5afe9c[_0xdef6('0x2c')](_0x289619)[_0xdef6('0x3b')](_0x1af065);};}exports['index']=function(_0x40e317,_0x24a1fc){var _0x253f2e={'include':[{'model':db[_0xdef6('0x3c')],'as':'mandatoryDispositionPause'}]},_0x15577f={},_0x273a12={'count':0x0,'rows':[]};var _0x506ba0=_['map'](db[_0xdef6('0x3d')][_0xdef6('0x3e')],function(_0x4a316b){return{'name':_0x4a316b[_0xdef6('0x3f')],'type':_0x4a316b[_0xdef6('0x40')][_0xdef6('0x41')]};});_0x15577f[_0xdef6('0x42')]=_['map'](_0x506ba0,'name');_0x15577f[_0xdef6('0x43')]=_[_0xdef6('0x44')](_0x40e317[_0xdef6('0x43')]);_0x15577f[_0xdef6('0x45')]=_[_0xdef6('0x46')](_0x15577f[_0xdef6('0x42')],_0x15577f[_0xdef6('0x43')]);_0x253f2e[_0xdef6('0x47')]=_[_0xdef6('0x46')](_0x15577f[_0xdef6('0x42')],qs[_0xdef6('0x48')](_0x40e317['query'][_0xdef6('0x48')]));_0x253f2e[_0xdef6('0x47')]=_0x253f2e[_0xdef6('0x47')][_0xdef6('0x49')]?_0x253f2e[_0xdef6('0x47')]:_0x15577f[_0xdef6('0x42')];if(!_0x40e317[_0xdef6('0x43')][_0xdef6('0x4a')](_0xdef6('0x4b'))){_0x253f2e['limit']=qs[_0xdef6('0x4c')](_0x40e317[_0xdef6('0x43')][_0xdef6('0x4c')]);_0x253f2e['offset']=qs['offset'](_0x40e317[_0xdef6('0x43')][_0xdef6('0x2f')]);}_0x253f2e[_0xdef6('0x4d')]=qs[_0xdef6('0x4e')](_0x40e317[_0xdef6('0x43')][_0xdef6('0x4e')]);_0x253f2e[_0xdef6('0x4f')]=qs[_0xdef6('0x45')](_[_0xdef6('0x50')](_0x40e317[_0xdef6('0x43')],_0x15577f['filters']),_0x506ba0);if(_0x40e317[_0xdef6('0x43')]['filter']){_0x253f2e['where']=_['merge'](_0x253f2e[_0xdef6('0x4f')],{'$or':_['map'](_0x506ba0,function(_0x309ff7){if(_0x309ff7[_0xdef6('0x40')]!==_0xdef6('0x51')){var _0x1b9b44={};_0x1b9b44[_0x309ff7['name']]={'$like':'%'+_0x40e317[_0xdef6('0x43')][_0xdef6('0x52')]+'%'};return _0x1b9b44;}})});}_0x253f2e=_[_0xdef6('0x53')]({},_0x253f2e,_0x40e317[_0xdef6('0x54')]);var _0x3f1319={'where':_0x253f2e[_0xdef6('0x4f')]};return db[_0xdef6('0x3d')][_0xdef6('0x2e')](_0x3f1319)[_0xdef6('0x35')](function(_0x37bddf){_0x273a12[_0xdef6('0x2e')]=_0x37bddf;if(_0x40e317[_0xdef6('0x43')][_0xdef6('0x55')]){_0x253f2e[_0xdef6('0x56')]=[{'all':!![]}];}return db['ChatWebsite'][_0xdef6('0x57')](_0x253f2e);})[_0xdef6('0x35')](function(_0x333b5e){_0x273a12['rows']=_0x333b5e;return _0x273a12;})['then'](respondWithFilteredResult(_0x24a1fc,_0x253f2e))['catch'](handleError(_0x24a1fc,null));};exports[_0xdef6('0x58')]=function(_0x756fe5,_0x2ae91d){var _0x5ad7f1={'raw':![],'where':{'id':_0x756fe5[_0xdef6('0x59')]['id']},'include':[{'model':db[_0xdef6('0x3c')],'as':_0xdef6('0x5a')}]},_0x5b701d={};_0x5b701d['model']=_[_0xdef6('0x44')](db[_0xdef6('0x3d')]['rawAttributes']);_0x5b701d[_0xdef6('0x43')]=_[_0xdef6('0x44')](_0x756fe5['query']);_0x5b701d[_0xdef6('0x45')]=_[_0xdef6('0x46')](_0x5b701d[_0xdef6('0x42')],_0x5b701d[_0xdef6('0x43')]);_0x5ad7f1[_0xdef6('0x47')]=_[_0xdef6('0x46')](_0x5b701d[_0xdef6('0x42')],qs[_0xdef6('0x48')](_0x756fe5[_0xdef6('0x43')]['fields']));_0x5ad7f1[_0xdef6('0x47')]=_0x5ad7f1['attributes']['length']?_0x5ad7f1[_0xdef6('0x47')]:_0x5b701d[_0xdef6('0x42')];if(_0x756fe5[_0xdef6('0x43')][_0xdef6('0x55')]){_0x5ad7f1['include']=[{'all':!![]}];}_0x5ad7f1=_[_0xdef6('0x53')]({},_0x5ad7f1,_0x756fe5[_0xdef6('0x54')]);return db[_0xdef6('0x3d')]['find'](_0x5ad7f1)[_0xdef6('0x35')](handleEntityNotFound(_0x2ae91d,null))[_0xdef6('0x35')](respondWithResult(_0x2ae91d,null))[_0xdef6('0x5b')](handleError(_0x2ae91d,null));};exports[_0xdef6('0x5c')]=function(_0x1875e5,_0xa521ca){return db[_0xdef6('0x3d')][_0xdef6('0x5c')](_0x1875e5[_0xdef6('0x5d')],{})[_0xdef6('0x35')](function(_0x1a3c14){var _0x1afcb9=_0x1875e5[_0xdef6('0x5e')][_0xdef6('0x37')]({'plain':!![]});if(!_0x1afcb9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1afcb9[_0xdef6('0x5f')]===_0xdef6('0x5e')){var _0x527235=_0x1a3c14[_0xdef6('0x37')]({'plain':!![]});var _0x4d3a08=_0xdef6('0x38');return db[_0xdef6('0x60')][_0xdef6('0x61')]({'where':{'name':_0x4d3a08,'userProfileId':_0x1afcb9[_0xdef6('0x62')]},'raw':!![]})[_0xdef6('0x35')](function(_0x3997d0){if(_0x3997d0&&_0x3997d0[_0xdef6('0x63')]===0x0){return db['UserProfileResource'][_0xdef6('0x5c')]({'name':_0x527235[_0xdef6('0x3a')],'resourceId':_0x527235['id'],'type':_0x3997d0['name'],'sectionId':_0x3997d0['id']},{})['then'](function(){return _0x1a3c14;});}else{return _0x1a3c14;}})[_0xdef6('0x5b')](function(_0x15ca09){logger[_0xdef6('0x26')](_0xdef6('0x64'),_0x15ca09);throw _0x15ca09;});}return _0x1a3c14;})[_0xdef6('0x35')](respondWithResult(_0xa521ca,0xc9))['catch'](handleError(_0xa521ca,null));};exports[_0xdef6('0x34')]=function(_0x3dfa8c,_0x20b35e){if(_0x3dfa8c[_0xdef6('0x5d')]['id']){delete _0x3dfa8c[_0xdef6('0x5d')]['id'];}return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0x3dfa8c[_0xdef6('0x59')]['id']},'include':[{'model':db[_0xdef6('0x3c')],'as':_0xdef6('0x5a')}]})[_0xdef6('0x35')](handleEntityNotFound(_0x20b35e,null))['then'](saveUpdates(_0x3dfa8c[_0xdef6('0x5d')],null))['then'](respondWithResult(_0x20b35e,null))[_0xdef6('0x5b')](handleError(_0x20b35e,null));};exports[_0xdef6('0x36')]=function(_0x4dc196,_0x1a27d7){return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0x4dc196[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x1a27d7,null))[_0xdef6('0x35')](removeEntity(_0x1a27d7,null))[_0xdef6('0x5b')](handleError(_0x1a27d7,null));};exports[_0xdef6('0x65')]=function(_0x51e4f8,_0x22b17a){return db[_0xdef6('0x3d')]['describe']()[_0xdef6('0x35')](respondWithResult(_0x22b17a,null))['catch'](handleError(_0x22b17a,null));};exports[_0xdef6('0x66')]=function(_0xd75056,_0x7a5489,_0x15b8a0){if(_0xd75056[_0xdef6('0x5d')]['id']){delete _0xd75056['body']['id'];}return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0xd75056['params']['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x7a5489,null))[_0xdef6('0x35')](function(_0x551c79){if(_0x551c79){_0xd75056['body'][_0xdef6('0x67')]=_0x551c79['id'];return db['Disposition'][_0xdef6('0x5c')](_0xd75056['body']);}})['then'](respondWithResult(_0x7a5489,null))[_0xdef6('0x5b')](handleError(_0x7a5489,null));};exports[_0xdef6('0x68')]=function(_0x1548da,_0x5eaef5,_0x57a45f){var _0x408adf={'raw':![],'where':{}};var _0x4a8762={};var _0xc961c2={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1548da['params']['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x5eaef5,null))['then'](function(_0x4daa5b){if(_0x4daa5b){_0x4a8762['model']=_[_0xdef6('0x44')](db[_0xdef6('0x69')][_0xdef6('0x3e')]);_0x4a8762[_0xdef6('0x43')]=_[_0xdef6('0x44')](_0x1548da[_0xdef6('0x43')]);_0x4a8762[_0xdef6('0x45')]=_[_0xdef6('0x46')](_0x4a8762['model'],_0x4a8762[_0xdef6('0x43')]);_0x408adf['attributes']=_[_0xdef6('0x46')](_0x4a8762[_0xdef6('0x42')],qs[_0xdef6('0x48')](_0x1548da[_0xdef6('0x43')][_0xdef6('0x48')]));_0x408adf[_0xdef6('0x47')]=_0x408adf['attributes'][_0xdef6('0x49')]?_0x408adf['attributes']:_0x4a8762[_0xdef6('0x42')];if(!_0x1548da['query'][_0xdef6('0x4a')](_0xdef6('0x4b'))){_0x408adf[_0xdef6('0x4c')]=qs['limit'](_0x1548da[_0xdef6('0x43')][_0xdef6('0x4c')]);_0x408adf[_0xdef6('0x2f')]=qs['offset'](_0x1548da[_0xdef6('0x43')]['offset']);}_0x408adf['order']=qs[_0xdef6('0x4e')](_0x1548da[_0xdef6('0x43')][_0xdef6('0x4e')]);_0x408adf['where']=qs[_0xdef6('0x45')](_[_0xdef6('0x50')](_0x1548da[_0xdef6('0x43')],_0x4a8762[_0xdef6('0x45')]));_0x408adf['where'][_0xdef6('0x67')]=_0x4daa5b['id'];if(_0x1548da[_0xdef6('0x43')]['filter']){_0x408adf['where']=_[_0xdef6('0x53')](_0x408adf['where'],{'$or':_[_0xdef6('0x6a')](_0x408adf[_0xdef6('0x47')],function(_0x5ae906){var _0x15c6ee={};_0x15c6ee[_0x5ae906]={'$like':'%'+_0x1548da[_0xdef6('0x43')][_0xdef6('0x52')]+'%'};return _0x15c6ee;})});}_0x408adf=_['merge']({},_0x408adf,_0x1548da[_0xdef6('0x54')]);return db['Disposition'][_0xdef6('0x2e')]({'where':_0x408adf[_0xdef6('0x4f')]})[_0xdef6('0x35')](function(_0x42f628){_0xc961c2[_0xdef6('0x2e')]=_0x42f628;if(_0x1548da[_0xdef6('0x43')][_0xdef6('0x55')]){_0x408adf[_0xdef6('0x56')]=[{'all':!![]}];}return db[_0xdef6('0x69')][_0xdef6('0x57')](_0x408adf);})['then'](function(_0x3d3882){_0xc961c2[_0xdef6('0x6b')]=_0x3d3882;return _0xc961c2;});}})[_0xdef6('0x35')](respondWithFilteredResult(_0x5eaef5,_0x408adf))[_0xdef6('0x5b')](handleError(_0x5eaef5,null));};exports[_0xdef6('0x6c')]=function(_0x4fc37c,_0x253054,_0xd3170a){return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0x4fc37c['params']['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x253054,null))[_0xdef6('0x35')](function(_0x32855c){if(_0x32855c){return _0x32855c[_0xdef6('0x6c')](_0x4fc37c['query'][_0xdef6('0x6d')]);}})[_0xdef6('0x35')](respondWithStatusCode(_0x253054,null))[_0xdef6('0x5b')](handleError(_0x253054,null));};exports[_0xdef6('0x6e')]=function(_0x53fddb,_0x4bd01a,_0x50e363){if(_0x53fddb['body']['id']){delete _0x53fddb['body']['id'];}return db[_0xdef6('0x3d')]['find']({'where':{'id':_0x53fddb[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x4bd01a,null))[_0xdef6('0x35')](function(_0x50fab2){if(_0x50fab2){_0x53fddb[_0xdef6('0x5d')][_0xdef6('0x67')]=_0x50fab2['id'];return db[_0xdef6('0x6f')]['create'](_0x53fddb['body']);}})['then'](respondWithResult(_0x4bd01a,null))[_0xdef6('0x5b')](handleError(_0x4bd01a,null));};exports[_0xdef6('0x70')]=function(_0x33d25d,_0xdef1bc,_0x2a8c5d){var _0x1e7893={'raw':![],'where':{}};var _0x519acc={};var _0x4f7c12={'count':0x0,'rows':[]};return db[_0xdef6('0x3d')][_0xdef6('0x71')]({'where':{'id':_0x33d25d[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0xdef1bc,null))['then'](function(_0xa4e869){if(_0xa4e869){_0x519acc[_0xdef6('0x42')]=_[_0xdef6('0x44')](db[_0xdef6('0x6f')][_0xdef6('0x3e')]);_0x519acc[_0xdef6('0x43')]=_['keys'](_0x33d25d[_0xdef6('0x43')]);_0x519acc[_0xdef6('0x45')]=_['intersection'](_0x519acc[_0xdef6('0x42')],_0x519acc[_0xdef6('0x43')]);_0x1e7893[_0xdef6('0x47')]=_['intersection'](_0x519acc[_0xdef6('0x42')],qs[_0xdef6('0x48')](_0x33d25d['query']['fields']));_0x1e7893['attributes']=_0x1e7893[_0xdef6('0x47')][_0xdef6('0x49')]?_0x1e7893[_0xdef6('0x47')]:_0x519acc[_0xdef6('0x42')];if(!_0x33d25d['query'][_0xdef6('0x4a')](_0xdef6('0x4b'))){_0x1e7893[_0xdef6('0x4c')]=qs['limit'](_0x33d25d[_0xdef6('0x43')][_0xdef6('0x4c')]);_0x1e7893[_0xdef6('0x2f')]=qs['offset'](_0x33d25d[_0xdef6('0x43')]['offset']);}_0x1e7893[_0xdef6('0x4d')]=qs['sort'](_0x33d25d[_0xdef6('0x43')][_0xdef6('0x4e')]);_0x1e7893['where']=qs['filters'](_['pick'](_0x33d25d[_0xdef6('0x43')],_0x519acc['filters']));_0x1e7893[_0xdef6('0x4f')][_0xdef6('0x67')]=_0xa4e869['id'];if(_0x33d25d[_0xdef6('0x43')][_0xdef6('0x52')]){_0x1e7893['where']=_[_0xdef6('0x53')](_0x1e7893[_0xdef6('0x4f')],{'$or':_[_0xdef6('0x6a')](_0x1e7893[_0xdef6('0x47')],function(_0x38174a){var _0x3769bc={};_0x3769bc[_0x38174a]={'$like':'%'+_0x33d25d['query'][_0xdef6('0x52')]+'%'};return _0x3769bc;})});}_0x1e7893=_[_0xdef6('0x53')]({},_0x1e7893,_0x33d25d[_0xdef6('0x54')]);return db[_0xdef6('0x6f')]['count']({'where':_0x1e7893[_0xdef6('0x4f')]})[_0xdef6('0x35')](function(_0x1c765f){_0x4f7c12[_0xdef6('0x2e')]=_0x1c765f;if(_0x33d25d[_0xdef6('0x43')][_0xdef6('0x55')]){_0x1e7893[_0xdef6('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdef6('0x57')](_0x1e7893);})['then'](function(_0x890221){_0x4f7c12['rows']=_0x890221;return _0x4f7c12;});}})[_0xdef6('0x35')](respondWithFilteredResult(_0xdef1bc,_0x1e7893))[_0xdef6('0x5b')](handleError(_0xdef1bc,null));};exports[_0xdef6('0x72')]=function(_0xc4e351,_0x150142,_0x4353da){return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0xc4e351[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x150142,null))[_0xdef6('0x35')](function(_0xe3f823){if(_0xe3f823){return _0xe3f823[_0xdef6('0x72')](_0xc4e351[_0xdef6('0x43')][_0xdef6('0x6d')]);}})[_0xdef6('0x35')](respondWithStatusCode(_0x150142,null))['catch'](handleError(_0x150142,null));};exports[_0xdef6('0x73')]=function(_0x44d5b9,_0x29dd9d,_0x16bb42){_0x44d5b9[_0xdef6('0x5d')][_0xdef6('0x74')]=_0x44d5b9[_0xdef6('0x75')][_0xdef6('0x76')];return db[_0xdef6('0x3d')]['find']({'where':{'id':_0x44d5b9[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x29dd9d,null))['then'](saveUpdates(_0x44d5b9[_0xdef6('0x5d')],null))[_0xdef6('0x35')](respondWithResult(_0x29dd9d,null))[_0xdef6('0x5b')](handleError(_0x29dd9d,null));};exports[_0xdef6('0x77')]=function(_0xa57a86,_0x292730,_0x3c4ed3){_0xa57a86['body'][_0xdef6('0x78')]=_0xa57a86[_0xdef6('0x75')]['filename'];return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0xa57a86[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x292730,null))[_0xdef6('0x35')](saveUpdates(_0xa57a86[_0xdef6('0x5d')],null))['then'](respondWithResult(_0x292730,null))[_0xdef6('0x5b')](handleError(_0x292730,null));};exports[_0xdef6('0x79')]=function(_0x1bf8f5,_0x3a476d,_0x47f943){_0x1bf8f5[_0xdef6('0x5d')][_0xdef6('0x7a')]=_0x1bf8f5['file']['filename'];return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0x1bf8f5[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x3a476d,null))[_0xdef6('0x35')](saveUpdates(_0x1bf8f5[_0xdef6('0x5d')],null))['then'](respondWithResult(_0x3a476d,null))[_0xdef6('0x5b')](handleError(_0x3a476d,null));};exports[_0xdef6('0x7b')]=function(_0x1a9f8f,_0x321be9,_0x55fb0b){_0x1a9f8f[_0xdef6('0x5d')]['systemAvatar']=_0x1a9f8f[_0xdef6('0x75')][_0xdef6('0x76')];return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0x1a9f8f[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x321be9,null))[_0xdef6('0x35')](saveUpdates(_0x1a9f8f[_0xdef6('0x5d')],null))[_0xdef6('0x35')](respondWithResult(_0x321be9,null))[_0xdef6('0x5b')](handleError(_0x321be9,null));};exports[_0xdef6('0x7c')]=function(_0x452d9f,_0x4c21bb,_0x4f2a1d){var _0x17bbad=path[_0xdef6('0x7d')](config['root'],'server/files/images/logos/default_logo.svg');var _0x377db2={'where':{'id':_0x452d9f[_0xdef6('0x59')]['id']},'attributes':['id',_0xdef6('0x74')],'raw':!![]};var _0x5c5979=![];return require(_0xdef6('0x17'))[_0xdef6('0x7e')]()[_0xdef6('0x35')](function(_0x4f99cc){if(_0x4f99cc){_0x5c5979=_0x4f99cc[_0xdef6('0x7f')];}})['then'](function(){return db[_0xdef6('0x3d')][_0xdef6('0x61')](_0x377db2);})[_0xdef6('0x35')](handleEntityNotFound(_0x4c21bb,null))[_0xdef6('0x35')](function(_0x9eeeef){if(_0x9eeeef){if(!_[_0xdef6('0x80')](_0x9eeeef[_0xdef6('0x74')])){if(fs[_0xdef6('0x81')](path[_0xdef6('0x7d')](config[_0xdef6('0x82')],_0xdef6('0x83'),_0x9eeeef['sitepic']))&&_0x5c5979){_0x17bbad=path['join'](config[_0xdef6('0x82')],_0xdef6('0x83'),_0x9eeeef[_0xdef6('0x74')]);}}return _0x4c21bb[_0xdef6('0x84')](_0x17bbad);}})['catch'](handleError(_0x4c21bb,null));};exports[_0xdef6('0x85')]=function(_0x3c94ff,_0x2e9594,_0x4e89d7){var _0x2f30c6=path['join'](config['root'],_0xdef6('0x86'));var _0x90fe58={'where':{'id':_0x3c94ff[_0xdef6('0x59')]['id']},'attributes':['id',_0xdef6('0x78')],'raw':!![]};return db[_0xdef6('0x3d')][_0xdef6('0x61')](_0x90fe58)[_0xdef6('0x35')](handleEntityNotFound(_0x2e9594,null))['then'](function(_0x1efb23){if(_0x1efb23){if(!_[_0xdef6('0x80')](_0x1efb23[_0xdef6('0x78')])){if(fs[_0xdef6('0x81')](path['join'](config[_0xdef6('0x82')],_0xdef6('0x87'),_0x1efb23[_0xdef6('0x78')]))){_0x2f30c6=path['join'](config[_0xdef6('0x82')],_0xdef6('0x87'),_0x1efb23[_0xdef6('0x78')]);}}return _0x2e9594[_0xdef6('0x84')](_0x2f30c6);}})['catch'](handleError(_0x2e9594,null));};exports[_0xdef6('0x88')]=function(_0x53d665,_0x1a1849,_0x20aa1a){var _0x35825f=path[_0xdef6('0x7d')](config[_0xdef6('0x82')],_0xdef6('0x89'));var _0x47e4cd={'where':{'id':_0x53d665[_0xdef6('0x59')]['id']},'attributes':['id',_0xdef6('0x7a'),'showCustomerAvatar'],'raw':!![]};return db[_0xdef6('0x3d')]['find'](_0x47e4cd)['then'](handleEntityNotFound(_0x1a1849,null))['then'](function(_0xb7eb70){if(_0xb7eb70){if(!_[_0xdef6('0x80')](_0xb7eb70[_0xdef6('0x7a')])){if(fs[_0xdef6('0x81')](path['join'](config[_0xdef6('0x82')],_0xdef6('0x87'),_0xb7eb70['customerAvatar']))&&_0xb7eb70[_0xdef6('0x8a')]){_0x35825f=path[_0xdef6('0x7d')](config[_0xdef6('0x82')],_0xdef6('0x87'),_0xb7eb70['customerAvatar']);}}return _0x1a1849[_0xdef6('0x84')](_0x35825f);}})[_0xdef6('0x5b')](handleError(_0x1a1849,null));};exports['getSystemAvatar']=function(_0x98ab25,_0x57b3b4,_0x1276cd){var _0x52e983=path[_0xdef6('0x7d')](config[_0xdef6('0x82')],'server/files/images/avatars/system_avatar.png');var _0x293757={'where':{'id':_0x98ab25['params']['id']},'attributes':['id',_0xdef6('0x8b')],'raw':!![]};return db[_0xdef6('0x3d')][_0xdef6('0x61')](_0x293757)[_0xdef6('0x35')](handleEntityNotFound(_0x57b3b4,null))['then'](function(_0x4194a5){if(_0x4194a5){if(!_[_0xdef6('0x80')](_0x4194a5['systemAvatar'])){if(fs[_0xdef6('0x81')](path['join'](config['root'],_0xdef6('0x87'),_0x4194a5[_0xdef6('0x8b')]))){_0x52e983=path[_0xdef6('0x7d')](config[_0xdef6('0x82')],'server/files/images/avatars/',_0x4194a5['systemAvatar']);}}return _0x57b3b4[_0xdef6('0x84')](_0x52e983);}})[_0xdef6('0x5b')](handleError(_0x57b3b4,null));};exports['notify']=function(_0x452c9e,_0x4b2319,_0x433f3f){var _0x55a851=require('user-agent-parser');var _0x4f9f2a=new _0x55a851();var _0x4c3e81=_0x4f9f2a['setUA'](_0x452c9e[_0xdef6('0x8c')][_0xdef6('0x8d')])[_0xdef6('0x8e')]();var _0x3eee34={'body':_0x452c9e[_0xdef6('0x5d')],'channel':_0xdef6('0x8f')};var _0xd1b240=[];var _0x20783a=[];var _0x31e98b={};var _0x18ca69=![];return db['CmContact'][_0xdef6('0x65')]()[_0xdef6('0x35')](function(_0x10930a){if(!_0x10930a){throw new db[(_0xdef6('0x90'))]['ValidationError']('no\x20available\x20attributes');}_0xd1b240=_[_0xdef6('0x91')](_[_0xdef6('0x44')](_0x10930a),[_0xdef6('0x92'),_0xdef6('0x93')]);_0x20783a=_[_0xdef6('0x91')](_['keys'](_0x10930a),[_0xdef6('0x92'),_0xdef6('0x93'),_0xdef6('0x94'),_0xdef6('0x95')]);if(_0x452c9e['body']['id']){delete _0x452c9e['body']['id'];}if(_[_0xdef6('0x80')](_0x452c9e[_0xdef6('0x5d')][_0xdef6('0x96')])){throw new db[(_0xdef6('0x90'))][(_0xdef6('0x97'))](_0xdef6('0x98'));}if(_[_0xdef6('0x80')](_0x452c9e[_0xdef6('0x5d')][_0xdef6('0x5d')])||_0x452c9e[_0xdef6('0x5d')][_0xdef6('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0xdef6('0x99'));}if(_['isNil'](_0x452c9e[_0xdef6('0x5d')][_0xdef6('0x9a')])){throw new db[(_0xdef6('0x90'))]['ValidationError'](_0xdef6('0x9b')+_0x20783a);}if(!_[_0xdef6('0x9c')](_0x20783a,_0x452c9e[_0xdef6('0x5d')][_0xdef6('0x9a')])){throw new db['Sequelize'][(_0xdef6('0x97'))](_0xdef6('0x9d')+_0x20783a);}_0x31e98b[_0x452c9e[_0xdef6('0x5d')][_0xdef6('0x9a')]]=_0x452c9e[_0xdef6('0x5d')][_0xdef6('0x96')];})[_0xdef6('0x35')](function(){return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0x452c9e[_0xdef6('0x59')]['id']},'include':[{'model':db[_0xdef6('0x9e')],'as':_0xdef6('0x9f'),'include':[{'model':db[_0xdef6('0xa0')],'as':_0xdef6('0xa1'),'where':_0x31e98b,'limit':0x1,'order':[[_0xdef6('0x93'),'DESC']]}]},{'model':db[_0xdef6('0xa2')],'as':_0xdef6('0xa3')}]});})['then'](handleEntityNotFound(_0x4b2319,null))[_0xdef6('0x35')](function(_0x503f33){if(_0x503f33&&_0x503f33['List']){_0x3eee34[_0xdef6('0xa4')]=_0x503f33;_0x3eee34[_0xdef6('0xa5')]=_0x503f33[_0xdef6('0xa3')];_0x3eee34[_0xdef6('0xa6')]=_0x503f33['List'];_0x3eee34[_0xdef6('0xa5')]=_[_0xdef6('0xa7')](_0x3eee34[_0xdef6('0xa5')],['priority'],[_0xdef6('0xa8')]);if(_0x3eee34['account'][_0xdef6('0xa3')]){delete _0x3eee34[_0xdef6('0xa4')][_0xdef6('0xa3')];}if(_0x3eee34[_0xdef6('0xa4')][_0xdef6('0x9f')]&&_0x3eee34[_0xdef6('0xa4')][_0xdef6('0x9f')]['Contacts'][_0xdef6('0x49')]){return _0x3eee34[_0xdef6('0xa4')][_0xdef6('0x9f')][_0xdef6('0xa1')][0x0];}var _0x256728=_[_0xdef6('0x1a')](_0x452c9e['body'],{'firstName':_0x452c9e[_0xdef6('0x5d')][_0xdef6('0x96')],'ListId':_0x503f33[_0xdef6('0x95')]});_0x256728[_0x452c9e['body'][_0xdef6('0x9a')]]=_0x452c9e[_0xdef6('0x5d')]['from'];return db[_0xdef6('0xa0')][_0xdef6('0x5c')](_0x256728,{'fields':_0xd1b240,'raw':!![]});}})[_0xdef6('0x35')](handleEntityNotFound(_0x4b2319,null))['then'](function(_0x351d1b){_0x3eee34[_0xdef6('0xa9')]=_0x351d1b;var _0x24c208=_0x452c9e[_0xdef6('0x5d')][_0xdef6('0xaa')];if(_0x452c9e[_0xdef6('0x8c')][_0xdef6('0xab')]){_0x24c208=_0x452c9e[_0xdef6('0x8c')][_0xdef6('0xab')];}else if(_0x452c9e[_0xdef6('0x8c')]['x-forwarded-for']){_0x24c208=_[_0xdef6('0xac')](_0x452c9e['headers'][_0xdef6('0xad')]['split'](','));}if(_0x351d1b){var _0x195523={'ContactId':_0x351d1b['id'],'ChatWebsiteId':_0x452c9e[_0xdef6('0x59')]['id'],'from':(_0x351d1b[_0xdef6('0xae')]||'')+'\x20'+(_0x351d1b[_0xdef6('0xaf')]||''),'customerIp':_0x24c208,'customerPort':_0x452c9e[_0xdef6('0x8c')][_0xdef6('0xb0')]?_0x452c9e[_0xdef6('0x8c')][_0xdef6('0xb0')]:null,'referer':_0x452c9e['body']['referer'],'browserName':_0x4c3e81[_0xdef6('0xb1')][_0xdef6('0x3a')]&&_0x4c3e81[_0xdef6('0xb1')][_0xdef6('0xb2')]?util['format'](_0xdef6('0xb3'),_0x4c3e81['browser'][_0xdef6('0x3a')],_0x4c3e81['browser'][_0xdef6('0xb2')]):_0xdef6('0xb4'),'browserVersion':_0x4c3e81[_0xdef6('0xb1')][_0xdef6('0xb2')]||'unknown','osName':util[_0xdef6('0xb5')](_0xdef6('0xb3'),_0x4c3e81['os']['name'],_0x4c3e81['os'][_0xdef6('0xb2')]),'osVersion':_0x4c3e81['os'][_0xdef6('0xb2')],'deviceModel':_0x4c3e81[_0xdef6('0xb6')][_0xdef6('0x42')]&&_0x4c3e81['device'][_0xdef6('0xb7')]?util[_0xdef6('0xb5')](_0xdef6('0xb8'),_0x4c3e81[_0xdef6('0xb6')][_0xdef6('0x42')],_0x4c3e81[_0xdef6('0xb6')][_0xdef6('0xb7')],_0x4c3e81['device'][_0xdef6('0x40')]):null,'deviceVendor':_0x4c3e81['device'][_0xdef6('0xb7')],'deviceType':_0x4c3e81[_0xdef6('0xb6')][_0xdef6('0x40')],'formData':JSON[_0xdef6('0xb9')](_0x452c9e['body'])};var _0x634444={'ChatWebsiteId':_0x452c9e[_0xdef6('0x59')]['id'],'closed':![]};if(_0x452c9e['body'][_0xdef6('0xba')]){_0x634444[_0xdef6('0xba')]=_0x452c9e[_0xdef6('0x5d')]['threadId'];return db[_0xdef6('0xbb')]['find']({'where':_0x634444})['then'](function(_0xdece6e){if(_0xdece6e){return[_0xdece6e,![]];}_0x195523[_0xdef6('0xba')]=_0x452c9e[_0xdef6('0x5d')][_0xdef6('0xba')];_0x195523['externalUrl']=_0x452c9e['body'][_0xdef6('0xbc')];return db[_0xdef6('0xbb')][_0xdef6('0x5c')](_0x195523)[_0xdef6('0x35')](function(_0xeed8e7){return[_0xeed8e7,!![]];});});}_0x634444['ContactId']=_0x351d1b['id'];if(_0x452c9e['body'][_0xdef6('0xbd')]&&_0x452c9e['body'][_0xdef6('0xbd')]['id']){_0x634444['id']=_0x452c9e['body'][_0xdef6('0xbd')]['id'];return db['ChatInteraction'][_0xdef6('0x61')]({'where':_0x634444})['then'](function(_0x4a68fb){if(_0x4a68fb){return[_0x4a68fb,![]];}return db[_0xdef6('0xbb')]['create'](_0x195523)['then'](function(_0x5ac786){return[_0x5ac786,!![]];});});}return db['ChatInteraction'][_0xdef6('0x5c')](_0x195523)[_0xdef6('0x35')](function(_0xfcafe7){return[_0xfcafe7,!![]];});}})[_0xdef6('0xbe')](function(_0x58f3e5,_0x3986bf){if(_0x58f3e5){_0x18ca69=_0x3986bf;if(!_0x3986bf){var _0x3ee315={'from':(_0x3eee34[_0xdef6('0xa9')][_0xdef6('0xae')]||'')+'\x20'+(_0x3eee34['contact'][_0xdef6('0xaf')]||'')};if(_0x452c9e[_0xdef6('0x5d')][_0xdef6('0xba')]&&_0x452c9e[_0xdef6('0x5d')][_0xdef6('0xbf')]&&_0x452c9e['body'][_0xdef6('0xba')]!=_0x452c9e[_0xdef6('0x5d')][_0xdef6('0xbf')]){_0x3ee315['threadId']=_0x452c9e[_0xdef6('0x5d')]['messageId'];}return _0x58f3e5[_0xdef6('0x34')](_0x3ee315);}else{return _0x58f3e5;}}})[_0xdef6('0x35')](function(_0x749522){_0x3eee34[_0xdef6('0xbd')]=_0x749522['get']({'plain':!![]});_0x3eee34[_0xdef6('0xbd')][_0xdef6('0xc0')]=_0x18ca69;if(_0x3eee34[_0xdef6('0xbd')]['created']){if(_0x3eee34[_0xdef6('0xa4')][_0xdef6('0xc1')]){_0x3eee34['applications'][_0xdef6('0xc2')]({'id':0x0,'priority':_0x3eee34[_0xdef6('0xa5')][_0xdef6('0x49')]+0x1,'app':_0xdef6('0xc3'),'appdata':_0xdef6('0xc4'),'interval':'*,*,*,*'});}}return db[_0xdef6('0xc5')][_0xdef6('0x5c')]({'body':_0x452c9e[_0xdef6('0x5d')]['body'],'ChatWebsiteId':_0x452c9e[_0xdef6('0x59')]['id'],'ChatInteractionId':_0x749522['id'],'direction':'in','ContactId':_0x3eee34['contact']['id'],'AttachmentId':_0x452c9e[_0xdef6('0x5d')][_0xdef6('0xc6')]});})[_0xdef6('0x35')](function(_0x542e0e){_0x3eee34[_0xdef6('0x29')]=_0x542e0e;if(_0x3eee34[_0xdef6('0xbd')][_0xdef6('0xc7')]){return db[_0xdef6('0xc8')]['find']({'attributes':['id',_0xdef6('0x3a')],'where':{'id':_0x3eee34[_0xdef6('0xbd')][_0xdef6('0xc7')]}})[_0xdef6('0x35')](function(_0x5d9b56){if(_0x5d9b56){_0x3eee34[_0xdef6('0xa5')][_0xdef6('0xc9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5d9b56['name']+','+(_0x3eee34['account']['waitForTheAssignedAgent']||0xa),'interval':_0xdef6('0xca')});_0x3eee34[_0xdef6('0xcb')]=!![];}return respondWithRpcPromise(_0xdef6('0xcc'),_0xdef6('0xcd'),_0x3eee34);});}return respondWithRpcPromise(_0xdef6('0xcc'),_0xdef6('0xcd'),_0x3eee34);})[_0xdef6('0x35')](function(_0x97a19d){respondWithRpcPromise(_0xdef6('0xce'),'EventManager',{'event':'notify','message':_0x97a19d},client9002);return _0x97a19d;})[_0xdef6('0x35')](respondWithResult(_0x4b2319,null))[_0xdef6('0x5b')](handleError(_0x4b2319,null));};exports[_0xdef6('0xcf')]=function(_0x4f8d26,_0x39552b,_0x516b8a){var _0xc6355d,_0x587396,_0x1a57d7;var _0xc0f63c=[];var _0x5e5ee0=[];var _0x487ac8={};var _0x228c4b=_0x4f8d26[_0xdef6('0xd0')]||[];var _0x532892=[];var _0x1d47d0;return db[_0xdef6('0xa0')]['describe']()[_0xdef6('0x35')](function(_0x95d5f2){if(!_0x95d5f2){throw new db[(_0xdef6('0x90'))][(_0xdef6('0x97'))](_0xdef6('0xd1'));}_0x5e5ee0=_[_0xdef6('0x91')](_[_0xdef6('0x44')](_0x95d5f2),[_0xdef6('0x92'),_0xdef6('0x93')]);_0xc0f63c=_[_0xdef6('0x91')](_[_0xdef6('0x44')](_0x95d5f2),[_0xdef6('0x92'),'updatedAt',_0xdef6('0x94'),'ListId']);if(_0x4f8d26[_0xdef6('0x5d')]['id']){delete _0x4f8d26[_0xdef6('0x5d')]['id'];}if(_[_0xdef6('0x80')](_0x4f8d26[_0xdef6('0x5d')][_0xdef6('0x96')])){throw _0x39552b[_0xdef6('0x2c')](0x1f4)['send'](new db[(_0xdef6('0x90'))][(_0xdef6('0x97'))](_0xdef6('0x98')));}if(_[_0xdef6('0x80')](_0x4f8d26[_0xdef6('0x5d')]['body'])||_0x4f8d26[_0xdef6('0x5d')][_0xdef6('0x5d')]===''){throw _0x39552b[_0xdef6('0x2c')](0x1f4)['send'](new db[(_0xdef6('0x90'))][(_0xdef6('0x97'))](_0xdef6('0x99')));}if(_[_0xdef6('0x80')](_0x4f8d26['body']['mapKeyOffline'])){throw _0x39552b[_0xdef6('0x2c')](0x1f4)[_0xdef6('0x3b')](new db[(_0xdef6('0x90'))]['ValidationError'](_0xdef6('0xd2')+_0xc0f63c));}if(!_[_0xdef6('0x9c')](_0xc0f63c,_0x4f8d26[_0xdef6('0x5d')]['mapKeyOffline'])){throw _0x39552b[_0xdef6('0x2c')](0x1f4)[_0xdef6('0x3b')](new db[(_0xdef6('0x90'))][(_0xdef6('0x97'))](_0xdef6('0xd3')+_0xc0f63c));}_0x487ac8[_0x4f8d26[_0xdef6('0x5d')]['mapKeyOffline']]=_0x4f8d26[_0xdef6('0x5d')]['from'];})[_0xdef6('0x35')](function(){return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0x4f8d26['params']['id']},'include':[{'model':db[_0xdef6('0x9e')],'as':_0xdef6('0x9f')},{'model':db[_0xdef6('0xd4')],'as':_0xdef6('0xd4')}]});})['then'](handleEntityNotFound(_0x39552b,null))[_0xdef6('0x35')](function(_0x371805){if(_0x371805&&_0x371805[_0xdef6('0x9f')]){_0x587396=_0x371805;var _0x5a847d=_['defaults'](_0x4f8d26[_0xdef6('0x5d')],{'firstName':_0x4f8d26[_0xdef6('0x5d')][_0xdef6('0x96')],'phone':_0x4f8d26[_0xdef6('0x5d')][_0xdef6('0x96')],'ListId':_0x371805[_0xdef6('0x95')]});_0x5a847d[_0x4f8d26[_0xdef6('0x5d')]['mapKeyOffline']]=_0x4f8d26[_0xdef6('0x5d')][_0xdef6('0x96')];return db[_0xdef6('0xa0')]['findOrCreate']({'where':_0x487ac8,'defaults':_0x5a847d});}})[_0xdef6('0xbe')](function(_0x2ac033){if(_0x2ac033){_0x1a57d7=_0x2ac033;var _0x41fead=fs[_0xdef6('0xd5')](path[_0xdef6('0x7d')](config['root'],_0xdef6('0xd6')),_0xdef6('0xd7'));var _0x29d693=ejs[_0xdef6('0xd8')](_0x41fead,{'body':_[_0xdef6('0xd9')](_0x4f8d26['body'][_0xdef6('0x5d')]),'bodyTitle':_0x587396[_0xdef6('0xda')]});return db[_0xdef6('0xdb')][_0xdef6('0x5c')]({'body':_0x29d693,'ContactId':_0x2ac033['id'],'ChatWebsiteId':_0x587396['id']});}})['then'](function(_0xb900ba){_0x1d47d0=_0xb900ba;if(!_[_0xdef6('0x80')](_0x4f8d26[_0xdef6('0xd0')])){var _0x3e5826=_0x4f8d26[_0xdef6('0xd0')][_0xdef6('0x6a')](function(_0x47e255){return{'name':_0x47e255[_0xdef6('0xdc')],'basename':_0x47e255[_0xdef6('0x76')],'type':_0x47e255[_0xdef6('0xdd')],'ChatOfflineMessageId':_0xb900ba['id']};});_0x532892=_0x3e5826[_0xdef6('0x6a')](_0x459da2=>{var _0x670944={'filename':_0x459da2['name'],'path':path[_0xdef6('0x7d')](config[_0xdef6('0x82')],_0xdef6('0xde'),_0xdef6('0xd0'),'attachments',_0xdef6('0xdf'),_0x459da2[_0xdef6('0xe0')])};return _0x670944;});if(!_0x587396[_0xdef6('0xe1')]){return db[_0xdef6('0xe2')][_0xdef6('0xe3')](function(_0x35a3ca){return db['Attachment'][_0xdef6('0xe4')](_0x3e5826,{'transaction':_0x35a3ca});});}}})['then'](function(){if(_0x1d47d0){_0xc6355d=_0x1d47d0;return db[_0xdef6('0xd4')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xdef6('0xe5')],'as':_0xdef6('0xe6'),'raw':!![]}]});}})['then'](function(_0x1aafbd){if(_0x1aafbd&&_0x1aafbd[_0xdef6('0xe6')]&&_0x587396[_0xdef6('0xe7')]&&_0x587396[_0xdef6('0xe8')]){var _0x52c56b={'tls':{'rejectUnauthorized':![]}};if(_0x1aafbd[_0xdef6('0xe6')]['service']){_0x52c56b[_0xdef6('0xe9')]=_0x1aafbd[_0xdef6('0xe6')][_0xdef6('0xe9')];}else{_0x52c56b[_0xdef6('0xea')]=_0x1aafbd[_0xdef6('0xe6')][_0xdef6('0xea')];_0x52c56b['port']=_0x1aafbd[_0xdef6('0xe6')][_0xdef6('0xeb')];_0x52c56b[_0xdef6('0xec')]=_0x1aafbd[_0xdef6('0xe6')][_0xdef6('0xec')];}if(_0x1aafbd['Smtp'][_0xdef6('0xed')]){_0x52c56b[_0xdef6('0xee')]={'user':_0x1aafbd[_0xdef6('0xe6')][_0xdef6('0x5e')],'pass':_0x1aafbd[_0xdef6('0xe6')][_0xdef6('0xef')]};}return respondWithRpcPromise('SendMail',_0xdef6('0xf0'),{'account':_0x52c56b,'message':{'from':util['format'](_0xdef6('0xf1'),_0x1aafbd[_0xdef6('0x3a')],_0x1aafbd[_0xdef6('0xf2')]||_0x1aafbd['Smtp'][_0xdef6('0x5e')]),'to':_0x587396['forwardOfflineAddress'],'subject':_0x587396[_0xdef6('0xf3')],'text':_0xc6355d[_0xdef6('0x5d')],'attachments':_0x532892}},client9003)[_0xdef6('0x35')](function(){return _0xc6355d;})[_0xdef6('0x5b')](function(_0x292ee9){console[_0xdef6('0x26')](_0x292ee9);});}})[_0xdef6('0x35')](function(){if(_0x587396&&_0x587396[_0xdef6('0xe1')]&&_0x587396[_0xdef6('0xf4')]){var _0x3f3a38=_0x4f8d26[_0xdef6('0xd0')]['map'](function(_0x1d393e){return{'name':_0x1d393e[_0xdef6('0xdc')],'basename':_0x1d393e[_0xdef6('0x76')],'type':_0x1d393e[_0xdef6('0xdd')],'ChatOfflineMessageId':_0x1d47d0['id']};});var _0x5b4cf4;if(!_[_0xdef6('0x80')](_0x587396['subjectOffline'])){var _0x50d0d9=_['map'](_0x4f8d26[_0xdef6('0x5d')],function(_0x4c6086){return _0x4c6086;});var _0x43eed1=_[_0xdef6('0xf5')](_0x50d0d9)[0x0];var _0x4de475=_[_0xdef6('0xf6')](_0x43eed1,function(_0xae99fe){return _0xae99fe;});_0x5b4cf4=_0x4de475[0x1][_0x587396[_0xdef6('0xf7')]];}var _0x1b035e={'from':_0x1a57d7[_0xdef6('0xf2')],'firstName':_0x1a57d7[_0xdef6('0xae')],'lastName':_0x1a57d7[_0xdef6('0xaf')],'mapKey':'email','message':{'from':_0x1a57d7[_0xdef6('0xf2')],'to':_0x587396[_0xdef6('0xd4')][_0xdef6('0xf2')],'cc':'','subject':_['isNil'](_0x5b4cf4)?_0x587396[_0xdef6('0xf3')]:_0x5b4cf4,'messageId':'','sentAt':new Date(),'attach':_0x3f3a38[_0xdef6('0x49')],'attachments':_0x3f3a38,'originChannel':'Chat','ChatWebsiteId':_0x587396['id'],'ChatOfflineMessageId':_0xc6355d['id'],'originTo':_0x587396['MailAccount'][_0xdef6('0xf2')]},'body':_0xc6355d[_0xdef6('0x5d')]};var _0x592ef4={'account':{'id':_0x587396['MailAccountId']},'body':_0x1b035e,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xdef6('0xf8'),_0x592ef4,client9001)[_0xdef6('0x35')](function(){return _0xc6355d;})[_0xdef6('0x5b')](function(_0x15ed0f){console['error'](_0x15ed0f);});}return;})['then'](function(){if(_0xc6355d){return _0xc6355d;}})[_0xdef6('0x35')](respondWithResult(_0x39552b,null))[_0xdef6('0x5b')](function(_0x550041){console['error'](_0xdef6('0x5b'),_0x550041);for(var _0x581780 of _0x228c4b){var _0x15d573=path['join'](config[_0xdef6('0x82')],_0xdef6('0xde'),'files',_0xdef6('0xf9'),_0xdef6('0xdf'),_0x581780[_0xdef6('0x76')]);fs_extra['remove'](_0x15d573)[_0xdef6('0x5b')](function(_0x473184){console[_0xdef6('0x26')]('Could\x20not\x20remove\x20attachment\x20file',_0x15d573,_0x473184);});}});};exports[_0xdef6('0xfa')]=function(_0x598bb1,_0x561b74,_0x22fd8b){return db[_0xdef6('0xbb')][_0xdef6('0x61')]({'where':{'id':_0x598bb1['params']['id']}})['then'](handleEntityNotFound(_0x561b74,null))['then'](function(_0x3fd32a){if(_0x3fd32a){return _0x3fd32a[_0xdef6('0xfa')](_0x598bb1[_0xdef6('0x5d')][_0xdef6('0x6d')],_[_0xdef6('0xfb')](_0x598bb1['body'],[_0xdef6('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x561b74,null))['catch'](handleError(_0x561b74,null));};exports[_0xdef6('0xfc')]=function(_0x3cd593,_0x2c1e0a,_0x1d3d45){var _0x4fa555={'raw':![],'where':{}};var _0x561f1a={};var _0x5dbfbd={'count':0x0,'rows':[]};return db[_0xdef6('0x3d')][_0xdef6('0x71')]({'where':{'id':_0x3cd593[_0xdef6('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c1e0a,null))['then'](function(_0x3e7e28){if(_0x3e7e28){_0x561f1a[_0xdef6('0x42')]=_[_0xdef6('0x44')](db[_0xdef6('0xbb')]['rawAttributes']);_0x561f1a[_0xdef6('0x43')]=_[_0xdef6('0x44')](_0x3cd593['query']);_0x561f1a[_0xdef6('0x45')]=_['intersection'](_0x561f1a[_0xdef6('0x42')],_0x561f1a[_0xdef6('0x43')]);_0x4fa555[_0xdef6('0x47')]=_['intersection'](_0x561f1a['model'],qs['fields'](_0x3cd593[_0xdef6('0x43')][_0xdef6('0x48')]));_0x4fa555[_0xdef6('0x47')]=_0x4fa555[_0xdef6('0x47')][_0xdef6('0x49')]?_0x4fa555[_0xdef6('0x47')]:_0x561f1a[_0xdef6('0x42')];if(!_0x3cd593[_0xdef6('0x43')][_0xdef6('0x4a')](_0xdef6('0x4b'))){_0x4fa555['limit']=qs['limit'](_0x3cd593[_0xdef6('0x43')][_0xdef6('0x4c')]);_0x4fa555[_0xdef6('0x2f')]=qs[_0xdef6('0x2f')](_0x3cd593['query'][_0xdef6('0x2f')]);}_0x4fa555[_0xdef6('0x4d')]=qs[_0xdef6('0x4e')](_0x3cd593['query'][_0xdef6('0x4e')]);_0x4fa555[_0xdef6('0x4f')]=qs[_0xdef6('0x45')](_[_0xdef6('0x50')](_0x3cd593[_0xdef6('0x43')],_0x561f1a['filters']));_0x4fa555[_0xdef6('0x4f')][_0xdef6('0x67')]=_0x3e7e28['id'];if(_0x3cd593[_0xdef6('0x43')]['filter']){_0x4fa555[_0xdef6('0x4f')]=_[_0xdef6('0x53')](_0x4fa555[_0xdef6('0x4f')],{'$or':_[_0xdef6('0x6a')](_0x4fa555['attributes'],function(_0x1e624e){var _0x4ba45e={};_0x4ba45e[_0x1e624e]={'$like':'%'+_0x3cd593[_0xdef6('0x43')][_0xdef6('0x52')]+'%'};return _0x4ba45e;})});}_0x4fa555=_[_0xdef6('0x53')]({},_0x4fa555,_0x3cd593['options']);return db[_0xdef6('0xbb')][_0xdef6('0x2e')]({'where':_0x4fa555[_0xdef6('0x4f')]})[_0xdef6('0x35')](function(_0x4a3c8a){_0x5dbfbd['count']=_0x4a3c8a;if(_0x3cd593['query'][_0xdef6('0x55')]){_0x4fa555['include']=[{'model':db['CmContact'],'as':_0xdef6('0xfd'),'required':![]},{'model':db[_0xdef6('0xc8')],'as':_0xdef6('0xfe'),'attributes':[_0xdef6('0x3a'),_0xdef6('0xff'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xdef6('0x100'),'attributes':['id','name',_0xdef6('0x101')],'where':_0x3cd593[_0xdef6('0x43')][_0xdef6('0x102')]?{'id':_0x3cd593[_0xdef6('0x43')][_0xdef6('0x102')]}:undefined,'required':_0x3cd593[_0xdef6('0x43')][_0xdef6('0x102')]?!![]:![]}];}return db[_0xdef6('0xbb')][_0xdef6('0x57')](_0x4fa555);})[_0xdef6('0x35')](function(_0x245d86){_0x5dbfbd[_0xdef6('0x6b')]=_0x245d86;return _0x5dbfbd;});}})['then'](respondWithFilteredResult(_0x2c1e0a,_0x4fa555))[_0xdef6('0x5b')](handleError(_0x2c1e0a,null));};function iftimePromise(_0xeca62b,_0x4b4988){return respondWithRpcPromise(_0xdef6('0x103'),'getSnippet',{'command':_0x4b4988[_0xdef6('0x104')]?util['format'](_0xdef6('0x105'),_0xeca62b[_0xdef6('0x106')],_0x4b4988[_0xdef6('0x104')]):util['format'](_0xdef6('0x107'),_0xeca62b[_0xdef6('0x106')])},client9002)[_0xdef6('0x35')](function(_0x5379ba){var _0x392670=_0x5379ba&&_0x5379ba[_0xdef6('0x108')](_0xdef6('0x109'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4b4988['id'],_0xeca62b['id'],_0xeca62b[_0xdef6('0x106')],_0x392670?'ONLINE':_0xdef6('0x10a'),_0x4b4988['timezone']?_0x4b4988['timezone']:_0xdef6('0x10b'));return _0x392670;})[_0xdef6('0x5b')](function(_0x942dd5){logger[_0xdef6('0x26')](_0xdef6('0x10c'),_0x4b4988['id'],_0xeca62b['id'],_0xeca62b[_0xdef6('0x106')],util[_0xdef6('0x10d')](_0x942dd5,{'showHidden':![],'depth':null}),_0x4b4988[_0xdef6('0x104')]?_0x4b4988[_0xdef6('0x104')]:_0xdef6('0x10b'));return![];});}exports[_0xdef6('0x10e')]=function(_0x2514f5,_0x1f994d,_0x3f80f0){var _0x9fdd6b=0x0;var _0x3e4542=0x0;var _0x1a826c=![];var _0x1c6486;var _0x738623;return db[_0xdef6('0x3d')]['find']({'where':{'id':_0x2514f5[_0xdef6('0x59')]['id']},'include':[{'model':db[_0xdef6('0x10f')],'as':_0xdef6('0x10f'),'include':[{'model':db[_0xdef6('0x10f')],'as':'Intervals','attributes':['id',_0xdef6('0x106')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1f994d,null))[_0xdef6('0x35')](function(_0x72057e){if(_0x72057e){_0x1c6486=_0x72057e;return _0x72057e[_0xdef6('0x110')]({'raw':!![]});}})['then'](function(_0x1ed683){if(_0x1c6486){if(_0x1ed683){_0x738623=_0x1ed683;}}return require('../../config/license/util')[_0xdef6('0x7e')]();})['then'](function(_0x4b975b){if(_0x4b975b){_0x3e4542=_0x4b975b[_0xdef6('0x111')];_0x1a826c=_0x4b975b[_0xdef6('0x7f')];}})['then'](function(){return db[_0xdef6('0xbb')][_0xdef6('0x2e')]({'where':{'closed':![]}});})['then'](function(_0x18d540){_0x9fdd6b=_0x18d540;if(_0x3e4542&&_0x18d540>_0x3e4542){return db[_0xdef6('0x112')][_0xdef6('0x71')]({'where':{'id':0x1}})['then'](function(_0x4611f8){if(_0x4611f8){_0x4611f8['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x1c6486[_0xdef6('0x10f')]&&_0x1c6486['Interval'][_0xdef6('0x113')]){var _0x42e8bc=[];for(var _0x2c69de=0x0;_0x2c69de<_0x1c6486[_0xdef6('0x10f')]['Intervals']['length'];_0x2c69de++){var _0x453661=_0x1c6486[_0xdef6('0x10f')][_0xdef6('0x113')][_0x2c69de]['get']({'plain':!![]});_0x42e8bc['push'](iftimePromise(_0x453661,_0x1c6486));}return BPromise[_0xdef6('0x114')](_0x42e8bc)[_0xdef6('0x35')](function(_0x45b0b8){return _[_0xdef6('0x115')](_0x45b0b8);});}else{return!![];}})[_0xdef6('0x35')](function(_0x2b8d6d){var _0x2ab921=fs[_0xdef6('0xd5')](path[_0xdef6('0x7d')](config[_0xdef6('0x82')],_0xdef6('0x116')),'utf8');var _0x36e03b={'remote':_0x1c6486[_0xdef6('0x117')],'query':querystring[_0xdef6('0xb9')](_[_0xdef6('0x53')](_0x1c6486[_0xdef6('0x37')]({'plain':!![]}),{'customerIp':_0x2514f5[_0xdef6('0x8c')][_0xdef6('0xad')]||_0x2514f5[_0xdef6('0x8c')][_0xdef6('0x118')]||_0x2514f5[_0xdef6('0x119')][_0xdef6('0x11a')]||_0x2514f5['ip'],'referer':_0x2514f5['headers']['referer'],'openedInteractions':_0x9fdd6b,'maxInteractions':_0x3e4542,'virtual':_0x1a826c[_0xdef6('0x111')],'online':_0x2b8d6d,'custom':_0x1a826c}))['replace'](/'/g,'\x5c\x27')};_0x1f994d['send'](ejs['render'](Mustache['render'](_0x2ab921,_0x36e03b),{'proactiveActions':_0x738623,'alignment':_0x1c6486[_0xdef6('0x11b')],'verticalAlignment':_0x1c6486[_0xdef6('0x11c')],'div_color':_0x1c6486[_0xdef6('0x101')],'text_color':_0x1c6486['textColor'],'button_color':_0x1c6486[_0xdef6('0x11d')],'background_color':_0x1c6486[_0xdef6('0x11e')]}));})[_0xdef6('0x5b')](handleError(_0x1f994d,null));};exports[_0xdef6('0x11f')]=function(_0xe8eb2,_0x340a35,_0x441aab){return db[_0xdef6('0x3d')][_0xdef6('0x71')]({'where':{'id':_0xe8eb2[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x340a35,null))[_0xdef6('0x35')](function(_0x5a5ec6){if(_0x5a5ec6){return db['sequelize'][_0xdef6('0xe3')](function(_0x2330ca){return db[_0xdef6('0xa2')]['destroy']({'where':{'ChatWebsiteId':_0xe8eb2['params']['id']},'transaction':_0x2330ca})[_0xdef6('0x35')](function(_0x2bd028){var _0x557e44=_['map'](_0xe8eb2['body'],function(_0x38369c){_0x38369c['ChatWebsiteId']=_0xe8eb2['params']['id'];return _0x38369c;});return db[_0xdef6('0xa2')][_0xdef6('0xe4')](_0x557e44,{'transaction':_0x2330ca});});})['then'](function(){return db[_0xdef6('0xa2')][_0xdef6('0x120')]({'where':{'ChatWebsiteId':_0xe8eb2[_0xdef6('0x59')]['id']},'order':'priority'});});}})[_0xdef6('0x35')](respondWithResult(_0x340a35,null))[_0xdef6('0x5b')](handleError(_0x340a35,null));};exports[_0xdef6('0x121')]=function(_0x8fbca9,_0x3dfcc3,_0x434121){var _0x130067={};var _0x24e8db={};var _0x187c67;var _0x364f1e;return db['ChatWebsite'][_0xdef6('0x71')]({'where':{'id':_0x8fbca9[_0xdef6('0x59')]['id']}})['then'](handleEntityNotFound(_0x3dfcc3,null))['then'](function(_0x2c323d){if(_0x2c323d){_0x187c67=_0x2c323d;_0x24e8db[_0xdef6('0x42')]=_['keys'](db[_0xdef6('0xa2')][_0xdef6('0x3e')]);_0x24e8db[_0xdef6('0x43')]=_[_0xdef6('0x44')](_0x8fbca9[_0xdef6('0x43')]);_0x24e8db['filters']=_[_0xdef6('0x46')](_0x24e8db['model'],_0x24e8db[_0xdef6('0x43')]);_0x130067['attributes']=_[_0xdef6('0x46')](_0x24e8db['model'],qs['fields'](_0x8fbca9[_0xdef6('0x43')]['fields']));_0x130067[_0xdef6('0x47')]=_0x130067[_0xdef6('0x47')][_0xdef6('0x49')]?_0x130067['attributes']:_0x24e8db[_0xdef6('0x42')];_0x130067[_0xdef6('0x4d')]=qs[_0xdef6('0x4e')](_0x8fbca9[_0xdef6('0x43')]['sort']);_0x130067[_0xdef6('0x4f')]=qs['filters'](_[_0xdef6('0x50')](_0x8fbca9[_0xdef6('0x43')],_0x24e8db[_0xdef6('0x45')]));if(_0x8fbca9[_0xdef6('0x43')][_0xdef6('0x52')]){_0x130067['where']=_[_0xdef6('0x53')](_0x130067[_0xdef6('0x4f')],{'$or':_[_0xdef6('0x6a')](_0x130067[_0xdef6('0x47')],function(_0x3d39c3){var _0x3cdaf3={};_0x3cdaf3[_0x3d39c3]={'$like':'%'+_0x8fbca9[_0xdef6('0x43')][_0xdef6('0x52')]+'%'};return _0x3cdaf3;})});}_0x130067=_[_0xdef6('0x53')]({},_0x130067,_0x8fbca9[_0xdef6('0x54')]);return _0x187c67[_0xdef6('0x121')](_0x130067);}})['then'](function(_0x35e5a7){if(_0x35e5a7){_0x364f1e=_0x35e5a7['length'];if(!_0x8fbca9[_0xdef6('0x43')][_0xdef6('0x4a')](_0xdef6('0x4b'))){_0x130067['limit']=qs['limit'](_0x8fbca9[_0xdef6('0x43')][_0xdef6('0x4c')]);_0x130067['offset']=qs[_0xdef6('0x2f')](_0x8fbca9['query']['offset']);}return _0x187c67[_0xdef6('0x121')](_0x130067);}})[_0xdef6('0x35')](function(_0xb333c7){if(_0xb333c7){return _0xb333c7?{'count':_0x364f1e,'rows':_0xb333c7}:null;}})[_0xdef6('0x35')](respondWithResult(_0x3dfcc3,null))[_0xdef6('0x5b')](handleError(_0x3dfcc3,null));};exports[_0xdef6('0x122')]=function(_0xee0207,_0x421008,_0x8d1cf8){return db['chatProactiveAction'][_0xdef6('0x61')]({'where':{'id':_0xee0207['params']['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x421008,null))[_0xdef6('0x35')](function(_0x1f4885){if(_0x1f4885){return _0x1f4885[_0xdef6('0x122')](_0xee0207[_0xdef6('0x5d')][_0xdef6('0x6d')],_[_0xdef6('0xfb')](_0xee0207[_0xdef6('0x5d')],['ids','id'])||{});}})[_0xdef6('0x35')](respondWithResult(_0x421008,null))[_0xdef6('0x5b')](handleError(_0x421008,null));};exports[_0xdef6('0x110')]=function(_0x3e91db,_0xd821cc,_0x229a2e){var _0x2f367a={};var _0x1d6fd3={};var _0xeb6b9c;var _0x27e242;return db[_0xdef6('0x3d')][_0xdef6('0x71')]({'where':{'id':_0x3e91db[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0xd821cc,null))[_0xdef6('0x35')](function(_0xed6134){if(_0xed6134){_0xeb6b9c=_0xed6134;_0x1d6fd3['model']=_['keys'](db[_0xdef6('0x123')][_0xdef6('0x3e')]);_0x1d6fd3[_0xdef6('0x43')]=_['keys'](_0x3e91db[_0xdef6('0x43')]);_0x1d6fd3['filters']=_[_0xdef6('0x46')](_0x1d6fd3[_0xdef6('0x42')],_0x1d6fd3[_0xdef6('0x43')]);_0x2f367a['attributes']=_[_0xdef6('0x46')](_0x1d6fd3['model'],qs['fields'](_0x3e91db[_0xdef6('0x43')]['fields']));_0x2f367a[_0xdef6('0x47')]=_0x2f367a[_0xdef6('0x47')][_0xdef6('0x49')]?_0x2f367a['attributes']:_0x1d6fd3[_0xdef6('0x42')];_0x2f367a[_0xdef6('0x4d')]=qs[_0xdef6('0x4e')](_0x3e91db[_0xdef6('0x43')][_0xdef6('0x4e')]);_0x2f367a['where']=qs[_0xdef6('0x45')](_['pick'](_0x3e91db[_0xdef6('0x43')],_0x1d6fd3[_0xdef6('0x45')]));if(_0x3e91db[_0xdef6('0x43')][_0xdef6('0x52')]){_0x2f367a[_0xdef6('0x4f')]=_[_0xdef6('0x53')](_0x2f367a[_0xdef6('0x4f')],{'$or':_['map'](_0x2f367a['attributes'],function(_0x5c507d){var _0x3b9064={};_0x3b9064[_0x5c507d]={'$like':'%'+_0x3e91db[_0xdef6('0x43')][_0xdef6('0x52')]+'%'};return _0x3b9064;})});}_0x2f367a=_[_0xdef6('0x53')]({},_0x2f367a,_0x3e91db[_0xdef6('0x54')]);return _0xeb6b9c['getProactiveActions'](_0x2f367a);}})['then'](function(_0x26b013){if(_0x26b013){_0x27e242=_0x26b013[_0xdef6('0x49')];if(!_0x3e91db[_0xdef6('0x43')][_0xdef6('0x4a')]('nolimit')){_0x2f367a[_0xdef6('0x4c')]=qs[_0xdef6('0x4c')](_0x3e91db['query'][_0xdef6('0x4c')]);_0x2f367a[_0xdef6('0x2f')]=qs[_0xdef6('0x2f')](_0x3e91db[_0xdef6('0x43')]['offset']);}return _0xeb6b9c[_0xdef6('0x110')](_0x2f367a);}})[_0xdef6('0x35')](function(_0x3177d3){if(_0x3177d3){return _0x3177d3?{'count':_0x27e242,'rows':_0x3177d3}:null;}})[_0xdef6('0x35')](respondWithResult(_0xd821cc,null))['catch'](handleError(_0xd821cc,null));};exports[_0xdef6('0x124')]=function(_0x3da9c7,_0x30e863,_0x115c74){var _0x2d7737=_0x3da9c7[_0xdef6('0x43')][_0xdef6('0x125')]==='false'?_0xdef6('0x126'):_0xdef6('0x127');return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'attributes':['id',_0x2d7737],'where':{'id':_0x3da9c7[_0xdef6('0x59')]['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x30e863,null))[_0xdef6('0x35')](function(_0x52d00f){if(_0x52d00f){var _0x2c0ecc=_0x52d00f[_0x2d7737];var _0x4eb200=_0x2c0ecc&&_0x2c0ecc[_0xdef6('0x128')]?_0x2c0ecc['items']:[];_0x30e863['send']({'fromKey':_[_0xdef6('0x80')](_0x2c0ecc[_0xdef6('0x129')])?undefined:_0x2c0ecc[_0xdef6('0x129')],'count':_0x4eb200['length'],'rows':_0x4eb200});}})['catch'](handleError(_0x30e863,null));};exports['getOfflineMessages']=function(_0x5d221d,_0x280605,_0xef9b8f){var _0x4ee1cb={'raw':![],'where':{}};var _0x1d8c20={};var _0x1e4dc3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdef6('0x71')]({'where':{'id':_0x5d221d[_0xdef6('0x59')]['id']}})['then'](handleEntityNotFound(_0x280605,null))[_0xdef6('0x35')](function(_0x201580){if(_0x201580){_0x1d8c20[_0xdef6('0x42')]=_['keys'](db[_0xdef6('0xdb')][_0xdef6('0x3e')]);_0x1d8c20[_0xdef6('0x43')]=_['keys'](_0x5d221d['query']);_0x1d8c20[_0xdef6('0x45')]=_[_0xdef6('0x46')](_0x1d8c20['model'],_0x1d8c20[_0xdef6('0x43')]);_0x4ee1cb['attributes']=_[_0xdef6('0x46')](_0x1d8c20[_0xdef6('0x42')],qs[_0xdef6('0x48')](_0x5d221d[_0xdef6('0x43')][_0xdef6('0x48')]));_0x4ee1cb[_0xdef6('0x47')]=_0x4ee1cb[_0xdef6('0x47')]['length']?_0x4ee1cb[_0xdef6('0x47')]:_0x1d8c20['model'];if(!_0x5d221d[_0xdef6('0x43')][_0xdef6('0x4a')](_0xdef6('0x4b'))){_0x4ee1cb[_0xdef6('0x4c')]=qs['limit'](_0x5d221d[_0xdef6('0x43')][_0xdef6('0x4c')]);_0x4ee1cb[_0xdef6('0x2f')]=qs[_0xdef6('0x2f')](_0x5d221d[_0xdef6('0x43')][_0xdef6('0x2f')]);}_0x4ee1cb[_0xdef6('0x4d')]=qs[_0xdef6('0x4e')](_0x5d221d['query'][_0xdef6('0x4e')]);_0x4ee1cb['where']=qs[_0xdef6('0x45')](_[_0xdef6('0x50')](_0x5d221d['query'],_0x1d8c20[_0xdef6('0x45')]));_0x4ee1cb[_0xdef6('0x4f')][_0xdef6('0x67')]=_0x201580['id'];if(_0x5d221d['query'][_0xdef6('0x52')]){_0x4ee1cb[_0xdef6('0x4f')]=_[_0xdef6('0x53')](_0x4ee1cb[_0xdef6('0x4f')],{'$or':_[_0xdef6('0x6a')](_0x4ee1cb[_0xdef6('0x47')],function(_0x277a41){var _0x418622={};_0x418622[_0x277a41]={'$like':'%'+_0x5d221d[_0xdef6('0x43')][_0xdef6('0x52')]+'%'};return _0x418622;})});}_0x4ee1cb=_[_0xdef6('0x53')]({},_0x4ee1cb,_0x5d221d['options']);return db[_0xdef6('0xdb')]['count']({'where':_0x4ee1cb['where']})[_0xdef6('0x35')](function(_0x47774a){_0x1e4dc3[_0xdef6('0x2e')]=_0x47774a;if(_0x5d221d[_0xdef6('0x43')][_0xdef6('0x55')]){_0x4ee1cb[_0xdef6('0x56')]=[{'all':!![]}];}else{_0x4ee1cb[_0xdef6('0x56')]=[{'model':db[_0xdef6('0xa0')],'as':_0xdef6('0xfd'),'required':![]},{'model':db['Attachment'],'as':_0xdef6('0x12a'),'required':![]}];}return db[_0xdef6('0xdb')][_0xdef6('0x57')](_0x4ee1cb);})[_0xdef6('0x35')](function(_0x56958c){_0x1e4dc3[_0xdef6('0x6b')]=_0x56958c;return _0x1e4dc3;});}})[_0xdef6('0x35')](respondWithFilteredResult(_0x280605,_0x4ee1cb))[_0xdef6('0x5b')](handleError(_0x280605,null));};exports[_0xdef6('0x12b')]=function(_0xc68d24,_0x40da2e,_0x24dd73){return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0xc68d24['params']['id']}})[_0xdef6('0x35')](handleEntityNotFound(_0x40da2e,null))[_0xdef6('0x35')](function(_0x10a310){if(_0x10a310){return _0x10a310[_0xdef6('0x12b')](_0xc68d24[_0xdef6('0x5d')][_0xdef6('0x6d')],_[_0xdef6('0xfb')](_0xc68d24[_0xdef6('0x5d')],[_0xdef6('0x6d'),'id'])||{})[_0xdef6('0xbe')](function(_0x54fe0f){for(var _0x2da485=0x0;_0x2da485<_0xc68d24[_0xdef6('0x5d')][_0xdef6('0x6d')][_0xdef6('0x49')];_0x2da485+=0x1){socket[_0xdef6('0x12c')](_0xdef6('0x12d'),{'UserId':_0xc68d24[_0xdef6('0x5d')][_0xdef6('0x6d')][_0x2da485],'ChatWebsiteId':_0xc68d24[_0xdef6('0x59')]['id']});}return _0x54fe0f;});}})['then'](respondWithResult(_0x40da2e,null))[_0xdef6('0x5b')](handleError(_0x40da2e,null));};exports[_0xdef6('0x12e')]=function(_0x3646f7,_0x3407d3,_0x1cad77){return db[_0xdef6('0x3d')][_0xdef6('0x61')]({'where':{'id':_0x3646f7[_0xdef6('0x59')]['id']}})['then'](handleEntityNotFound(_0x3407d3,null))[_0xdef6('0x35')](function(_0x4c2a08){if(_0x4c2a08){return _0x4c2a08[_0xdef6('0x12e')](_0x3646f7[_0xdef6('0x43')][_0xdef6('0x6d')])[_0xdef6('0x35')](function(){if(_[_0xdef6('0x12f')](_0x3646f7[_0xdef6('0x43')]['ids'])){for(var _0x8d8e78=0x0;_0x8d8e78<_0x3646f7[_0xdef6('0x43')][_0xdef6('0x6d')]['length'];_0x8d8e78+=0x1){socket[_0xdef6('0x12c')](_0xdef6('0x130'),{'UserId':Number(_0x3646f7['query']['ids'][_0x8d8e78]),'ChatWebsiteId':Number(_0x3646f7['params']['id'])});}}else{socket['emit'](_0xdef6('0x130'),{'UserId':Number(_0x3646f7[_0xdef6('0x43')][_0xdef6('0x6d')]),'ChatWebsiteId':Number(_0x3646f7['params']['id'])});}});}})[_0xdef6('0x35')](respondWithStatusCode(_0x3407d3,null))['catch'](handleError(_0x3407d3,null));};exports[_0xdef6('0x131')]=function(_0x5952fd,_0x391020,_0x5ea00c){var _0x327d6a={};var _0x2194e1={};var _0x5898c1;var _0x1a2adc;return db[_0xdef6('0x3d')][_0xdef6('0x71')]({'where':{'id':_0x5952fd[_0xdef6('0x59')]['id']}})['then'](handleEntityNotFound(_0x391020,null))[_0xdef6('0x35')](function(_0x321870){if(_0x321870){_0x5898c1=_0x321870;_0x2194e1['model']=_['keys'](db[_0xdef6('0xc8')][_0xdef6('0x3e')]);_0x2194e1['query']=_[_0xdef6('0x44')](_0x5952fd[_0xdef6('0x43')]);_0x2194e1[_0xdef6('0x45')]=_[_0xdef6('0x46')](_0x2194e1['model'],_0x2194e1[_0xdef6('0x43')]);_0x327d6a[_0xdef6('0x47')]=_[_0xdef6('0x46')](_0x2194e1[_0xdef6('0x42')],qs[_0xdef6('0x48')](_0x5952fd[_0xdef6('0x43')][_0xdef6('0x48')]));_0x327d6a[_0xdef6('0x47')]=_0x327d6a[_0xdef6('0x47')][_0xdef6('0x49')]?_0x327d6a['attributes']:_0x2194e1['model'];_0x327d6a['order']=qs[_0xdef6('0x4e')](_0x5952fd[_0xdef6('0x43')]['sort']);_0x327d6a[_0xdef6('0x4f')]=qs[_0xdef6('0x45')](_[_0xdef6('0x50')](_0x5952fd[_0xdef6('0x43')],_0x2194e1['filters']));if(_0x5952fd[_0xdef6('0x43')][_0xdef6('0x52')]){_0x327d6a['where']=_['merge'](_0x327d6a[_0xdef6('0x4f')],{'$or':_[_0xdef6('0x6a')](_0x327d6a['attributes'],function(_0x22c16e){var _0x1a59c2={};_0x1a59c2[_0x22c16e]={'$like':'%'+_0x5952fd[_0xdef6('0x43')][_0xdef6('0x52')]+'%'};return _0x1a59c2;})});}_0x327d6a=_[_0xdef6('0x53')]({},_0x327d6a,_0x5952fd['options']);return _0x5898c1[_0xdef6('0x131')](_0x327d6a);}})[_0xdef6('0x35')](function(_0x3f6468){if(_0x3f6468){_0x1a2adc=_0x3f6468[_0xdef6('0x49')];if(!_0x5952fd[_0xdef6('0x43')]['hasOwnProperty'](_0xdef6('0x4b'))){_0x327d6a[_0xdef6('0x4c')]=qs['limit'](_0x5952fd[_0xdef6('0x43')][_0xdef6('0x4c')]);_0x327d6a[_0xdef6('0x2f')]=qs[_0xdef6('0x2f')](_0x5952fd['query']['offset']);}return _0x5898c1[_0xdef6('0x131')](_0x327d6a);}})[_0xdef6('0x35')](function(_0x2fd954){if(_0x2fd954){return _0x2fd954?{'count':_0x1a2adc,'rows':_0x2fd954}:null;}})[_0xdef6('0x35')](respondWithResult(_0x391020,null))[_0xdef6('0x5b')](handleError(_0x391020,null));}; \ No newline at end of file +var _0xce98=['nolimit','limit','sort','where','pick','filter','merge','options','ChatWebsite','includeAll','include','findAll','rows','mandatoryDispositionPause','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','addDisposition','params','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','headers','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','applications','list','orderBy','priority','asc','account','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','stringify','threadId','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','EventManager','offline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','files','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','forwardOffline','forwardOfflineAddress','service','Smtp','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','fullname','internal','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','true','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','virtual','License','increment','push','all','remote','x-real-ip','replace','render','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','getOfflineMessages','Attachments','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','get','ChatWebsites','UserProfileResource','destroy','end','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x107045,_0x16c8d8){var _0x4d8930=function(_0x69b6d8){while(--_0x69b6d8){_0x107045['push'](_0x107045['shift']());}};_0x4d8930(++_0x16c8d8);}(_0xce98,0xe1));var _0x8ce9=function(_0x63b961,_0x2f67fa){_0x63b961=_0x63b961-0x0;var _0x1c07b5=_0xce98[_0x63b961];return _0x1c07b5;};'use strict';var pdf=require(_0x8ce9('0x0'));var emlformat=require(_0x8ce9('0x1'));var rimraf=require(_0x8ce9('0x2'));var zipdir=require(_0x8ce9('0x3'));var jsonpatch=require(_0x8ce9('0x4'));var rp=require(_0x8ce9('0x5'));var moment=require('moment');var BPromise=require(_0x8ce9('0x6'));var Mustache=require(_0x8ce9('0x7'));var util=require(_0x8ce9('0x8'));var path=require(_0x8ce9('0x9'));var sox=require(_0x8ce9('0xa'));var csv=require(_0x8ce9('0xb'));var ejs=require(_0x8ce9('0xc'));var fs=require('fs');var fs_extra=require(_0x8ce9('0xd'));var _=require(_0x8ce9('0xe'));var squel=require(_0x8ce9('0xf'));var crypto=require(_0x8ce9('0x10'));var jsforce=require(_0x8ce9('0x11'));var deskjs=require(_0x8ce9('0x12'));var toCsv=require(_0x8ce9('0xb'));var querystring=require(_0x8ce9('0x13'));var Papa=require(_0x8ce9('0x14'));var Redis=require(_0x8ce9('0x15'));var authService=require(_0x8ce9('0x16'));var qs=require(_0x8ce9('0x17'));var as=require(_0x8ce9('0x18'));var hardwareService=require(_0x8ce9('0x19'));var logger=require('../../config/logger')(_0x8ce9('0x1a'));var utils=require('../../config/utils');var config=require(_0x8ce9('0x1b'));var licenseUtil=require(_0x8ce9('0x1c'));var db=require('../../mysqldb')['db'];config[_0x8ce9('0x1d')]=_[_0x8ce9('0x1e')](config[_0x8ce9('0x1d')],{'host':_0x8ce9('0x1f'),'port':0x18eb});var socket=require(_0x8ce9('0x20'))(new Redis(config[_0x8ce9('0x1d')]));require(_0x8ce9('0x21'))[_0x8ce9('0x22')](socket);var jayson=require(_0x8ce9('0x23'));var client=jayson[_0x8ce9('0x24')][_0x8ce9('0x25')]({'port':0x232c});var client9002=jayson[_0x8ce9('0x24')][_0x8ce9('0x25')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson['client'][_0x8ce9('0x25')]({'port':0x2329});function respondWithRpcPromise(_0x5ec723,_0x2e2593,_0x2177bc,_0x3d7937){return new BPromise(function(_0x21b3a8,_0xd180e){var _0x45a153=_0x3d7937||client;return _0x45a153[_0x8ce9('0x26')](_0x5ec723,_0x2177bc)[_0x8ce9('0x27')](function(_0x3607c0){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2e2593,_0x8ce9('0x28'));logger[_0x8ce9('0x29')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2e2593,_0x8ce9('0x28'),JSON['stringify'](_0x3607c0));if(_0x3607c0[_0x8ce9('0x2a')]){if(_0x3607c0[_0x8ce9('0x2a')][_0x8ce9('0x2b')]===0x1f4){logger['error'](_0x8ce9('0x2c'),_0x2e2593,_0x3607c0[_0x8ce9('0x2a')][_0x8ce9('0x2d')]);return _0xd180e(_0x3607c0[_0x8ce9('0x2a')][_0x8ce9('0x2d')]);}logger[_0x8ce9('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x2e2593,_0x3607c0[_0x8ce9('0x2a')][_0x8ce9('0x2d')]);return _0x21b3a8(_0x3607c0[_0x8ce9('0x2a')][_0x8ce9('0x2d')]);}else{logger[_0x8ce9('0x2e')]('ChatWebsite,\x20%s,\x20%s',_0x2e2593,_0x8ce9('0x28'));_0x21b3a8(_0x3607c0[_0x8ce9('0x2f')][_0x8ce9('0x2d')]);}})[_0x8ce9('0x30')](function(_0x1e357e){logger[_0x8ce9('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x2e2593,_0x1e357e);_0xd180e(_0x1e357e);});});}function respondWithStatusCode(_0x202dea,_0x259e40){_0x259e40=_0x259e40||0xcc;return function(_0x3df322){if(_0x3df322){return _0x202dea[_0x8ce9('0x31')](_0x259e40);}return _0x202dea[_0x8ce9('0x32')](_0x259e40)['end']();};}function respondWithResult(_0x36db02,_0x12c290){_0x12c290=_0x12c290||0xc8;return function(_0x2711c8){if(_0x2711c8){return _0x36db02[_0x8ce9('0x32')](_0x12c290)[_0x8ce9('0x33')](_0x2711c8);}};}function respondWithFilteredResult(_0x341a34,_0x28cf63){return function(_0x35f8fc){if(_0x35f8fc){var _0x568fc3=_0x35f8fc[_0x8ce9('0x34')],_0x3cbe09=_0x28cf63[_0x8ce9('0x35')],_0x3bf0d7=_0x28cf63[_0x8ce9('0x35')]+_0x28cf63['limit'],_0x363295;if(_0x3bf0d7>=_0x568fc3){_0x3bf0d7=_0x568fc3;_0x363295=0xc8;}else{_0x363295=0xce;}_0x341a34[_0x8ce9('0x32')](_0x363295);return _0x341a34['set'](_0x8ce9('0x36'),_0x3cbe09+'-'+_0x3bf0d7+'/'+_0x568fc3)[_0x8ce9('0x33')](_0x35f8fc);}return null;};}function patchUpdates(_0x5a155f){return function(_0x361e20){try{jsonpatch[_0x8ce9('0x37')](_0x361e20,_0x5a155f,!![]);}catch(_0x2e6573){return BPromise[_0x8ce9('0x38')](_0x2e6573);}return _0x361e20[_0x8ce9('0x39')]();};}function saveUpdates(_0x4b68a6,_0x3d9479){return function(_0x4f31a9){if(_0x4f31a9){return _0x4f31a9[_0x8ce9('0x3a')](_0x4b68a6)[_0x8ce9('0x27')](function(_0x1e345a){return _0x1e345a;});}return null;};}function removeEntity(_0x789ccd,_0x8f2882){return function(_0x570c05){if(_0x570c05){return _0x570c05['destroy']()[_0x8ce9('0x27')](function(){var _0x2f78cc=_0x570c05[_0x8ce9('0x3b')]({'plain':!![]});var _0x182d11=_0x8ce9('0x3c');return db[_0x8ce9('0x3d')][_0x8ce9('0x3e')]({'where':{'type':_0x182d11,'resourceId':_0x2f78cc['id']}})['then'](function(){return _0x570c05;});})[_0x8ce9('0x27')](function(){_0x789ccd[_0x8ce9('0x32')](0xcc)[_0x8ce9('0x3f')]();});}};}function handleEntityNotFound(_0x25606b,_0x524593){return function(_0x3efb73){if(!_0x3efb73){_0x25606b[_0x8ce9('0x31')](0x194);}return _0x3efb73;};}function handleError(_0x1bcfc2,_0xf3585d){_0xf3585d=_0xf3585d||0x1f4;return function(_0xfc3e23){logger[_0x8ce9('0x2a')](_0xfc3e23['stack']);if(_0xfc3e23[_0x8ce9('0x40')]){delete _0xfc3e23[_0x8ce9('0x40')];}_0x1bcfc2[_0x8ce9('0x32')](_0xf3585d)[_0x8ce9('0x41')](_0xfc3e23);};}exports[_0x8ce9('0x42')]=function(_0x5be9bb,_0x20b6de){var _0x4f970c={'include':[{'model':db[_0x8ce9('0x43')],'as':'mandatoryDispositionPause'}]},_0x20897e={},_0x2dd8dc={'count':0x0,'rows':[]};var _0x123e13=_[_0x8ce9('0x44')](db['ChatWebsite'][_0x8ce9('0x45')],function(_0x2cc1e2){return{'name':_0x2cc1e2[_0x8ce9('0x46')],'type':_0x2cc1e2[_0x8ce9('0x47')][_0x8ce9('0x48')]};});_0x20897e[_0x8ce9('0x49')]=_[_0x8ce9('0x44')](_0x123e13,_0x8ce9('0x40'));_0x20897e[_0x8ce9('0x4a')]=_['keys'](_0x5be9bb['query']);_0x20897e[_0x8ce9('0x4b')]=_[_0x8ce9('0x4c')](_0x20897e[_0x8ce9('0x49')],_0x20897e[_0x8ce9('0x4a')]);_0x4f970c['attributes']=_[_0x8ce9('0x4c')](_0x20897e[_0x8ce9('0x49')],qs['fields'](_0x5be9bb['query'][_0x8ce9('0x4d')]));_0x4f970c['attributes']=_0x4f970c[_0x8ce9('0x4e')]['length']?_0x4f970c[_0x8ce9('0x4e')]:_0x20897e[_0x8ce9('0x49')];if(!_0x5be9bb[_0x8ce9('0x4a')][_0x8ce9('0x4f')](_0x8ce9('0x50'))){_0x4f970c[_0x8ce9('0x51')]=qs[_0x8ce9('0x51')](_0x5be9bb[_0x8ce9('0x4a')][_0x8ce9('0x51')]);_0x4f970c['offset']=qs['offset'](_0x5be9bb['query']['offset']);}_0x4f970c['order']=qs[_0x8ce9('0x52')](_0x5be9bb['query']['sort']);_0x4f970c[_0x8ce9('0x53')]=qs[_0x8ce9('0x4b')](_[_0x8ce9('0x54')](_0x5be9bb[_0x8ce9('0x4a')],_0x20897e[_0x8ce9('0x4b')]),_0x123e13);if(_0x5be9bb[_0x8ce9('0x4a')][_0x8ce9('0x55')]){_0x4f970c[_0x8ce9('0x53')]=_[_0x8ce9('0x56')](_0x4f970c[_0x8ce9('0x53')],{'$or':_[_0x8ce9('0x44')](_0x123e13,function(_0x540be4){if(_0x540be4['type']!=='VIRTUAL'){var _0x20263b={};_0x20263b[_0x540be4[_0x8ce9('0x40')]]={'$like':'%'+_0x5be9bb[_0x8ce9('0x4a')][_0x8ce9('0x55')]+'%'};return _0x20263b;}})});}_0x4f970c=_[_0x8ce9('0x56')]({},_0x4f970c,_0x5be9bb[_0x8ce9('0x57')]);var _0x95207={'where':_0x4f970c[_0x8ce9('0x53')]};return db[_0x8ce9('0x58')][_0x8ce9('0x34')](_0x95207)[_0x8ce9('0x27')](function(_0x188b9f){_0x2dd8dc['count']=_0x188b9f;if(_0x5be9bb[_0x8ce9('0x4a')][_0x8ce9('0x59')]){_0x4f970c[_0x8ce9('0x5a')]=[{'all':!![]}];}return db[_0x8ce9('0x58')][_0x8ce9('0x5b')](_0x4f970c);})['then'](function(_0xaef99d){_0x2dd8dc[_0x8ce9('0x5c')]=_0xaef99d;return _0x2dd8dc;})[_0x8ce9('0x27')](respondWithFilteredResult(_0x20b6de,_0x4f970c))[_0x8ce9('0x30')](handleError(_0x20b6de,null));};exports['show']=function(_0xb8d453,_0x2172ef){var _0x2d4ce1={'raw':![],'where':{'id':_0xb8d453['params']['id']},'include':[{'model':db[_0x8ce9('0x43')],'as':_0x8ce9('0x5d')}]},_0x45d297={};_0x45d297[_0x8ce9('0x49')]=_[_0x8ce9('0x5e')](db[_0x8ce9('0x58')][_0x8ce9('0x45')]);_0x45d297[_0x8ce9('0x4a')]=_[_0x8ce9('0x5e')](_0xb8d453['query']);_0x45d297[_0x8ce9('0x4b')]=_['intersection'](_0x45d297['model'],_0x45d297['query']);_0x2d4ce1['attributes']=_[_0x8ce9('0x4c')](_0x45d297['model'],qs['fields'](_0xb8d453[_0x8ce9('0x4a')]['fields']));_0x2d4ce1[_0x8ce9('0x4e')]=_0x2d4ce1[_0x8ce9('0x4e')][_0x8ce9('0x5f')]?_0x2d4ce1['attributes']:_0x45d297['model'];if(_0xb8d453['query'][_0x8ce9('0x59')]){_0x2d4ce1[_0x8ce9('0x5a')]=[{'all':!![]}];}_0x2d4ce1=_['merge']({},_0x2d4ce1,_0xb8d453[_0x8ce9('0x57')]);return db[_0x8ce9('0x58')][_0x8ce9('0x60')](_0x2d4ce1)[_0x8ce9('0x27')](handleEntityNotFound(_0x2172ef,null))[_0x8ce9('0x27')](respondWithResult(_0x2172ef,null))[_0x8ce9('0x30')](handleError(_0x2172ef,null));};exports[_0x8ce9('0x61')]=function(_0x26ff8a,_0x3119c6){return db[_0x8ce9('0x58')][_0x8ce9('0x61')](_0x26ff8a[_0x8ce9('0x62')],{})[_0x8ce9('0x27')](function(_0xa66d67){var _0x3b80d7=_0x26ff8a[_0x8ce9('0x63')][_0x8ce9('0x3b')]({'plain':!![]});if(!_0x3b80d7)throw new Error(_0x8ce9('0x64'));if(_0x3b80d7[_0x8ce9('0x65')]===_0x8ce9('0x63')){var _0x1e1aa0=_0xa66d67[_0x8ce9('0x3b')]({'plain':!![]});var _0x5da5cb=_0x8ce9('0x3c');return db[_0x8ce9('0x66')][_0x8ce9('0x60')]({'where':{'name':_0x5da5cb,'userProfileId':_0x3b80d7['userProfileId']},'raw':!![]})[_0x8ce9('0x27')](function(_0x542b7e){if(_0x542b7e&&_0x542b7e[_0x8ce9('0x67')]===0x0){return db[_0x8ce9('0x3d')]['create']({'name':_0x1e1aa0[_0x8ce9('0x40')],'resourceId':_0x1e1aa0['id'],'type':_0x542b7e[_0x8ce9('0x40')],'sectionId':_0x542b7e['id']},{})[_0x8ce9('0x27')](function(){return _0xa66d67;});}else{return _0xa66d67;}})[_0x8ce9('0x30')](function(_0x565491){logger[_0x8ce9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x565491);throw _0x565491;});}return _0xa66d67;})[_0x8ce9('0x27')](respondWithResult(_0x3119c6,0xc9))[_0x8ce9('0x30')](handleError(_0x3119c6,null));};exports[_0x8ce9('0x3a')]=function(_0xb9a9ff,_0x5efec3){if(_0xb9a9ff['body']['id']){delete _0xb9a9ff['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0xb9a9ff['params']['id']},'include':[{'model':db[_0x8ce9('0x43')],'as':_0x8ce9('0x5d')}]})[_0x8ce9('0x27')](handleEntityNotFound(_0x5efec3,null))['then'](saveUpdates(_0xb9a9ff[_0x8ce9('0x62')],null))[_0x8ce9('0x27')](respondWithResult(_0x5efec3,null))[_0x8ce9('0x30')](handleError(_0x5efec3,null));};exports[_0x8ce9('0x3e')]=function(_0xc534be,_0x4d353f){return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'where':{'id':_0xc534be['params']['id']}})['then'](handleEntityNotFound(_0x4d353f,null))[_0x8ce9('0x27')](removeEntity(_0x4d353f,null))[_0x8ce9('0x30')](handleError(_0x4d353f,null));};exports[_0x8ce9('0x68')]=function(_0x30b595,_0x814b60){return db[_0x8ce9('0x58')]['describe']()[_0x8ce9('0x27')](respondWithResult(_0x814b60,null))[_0x8ce9('0x30')](handleError(_0x814b60,null));};exports[_0x8ce9('0x69')]=function(_0x372756,_0x55036f,_0x51a046){if(_0x372756[_0x8ce9('0x62')]['id']){delete _0x372756[_0x8ce9('0x62')]['id'];}return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'where':{'id':_0x372756[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x55036f,null))[_0x8ce9('0x27')](function(_0x222632){if(_0x222632){_0x372756['body']['ChatWebsiteId']=_0x222632['id'];return db[_0x8ce9('0x6b')][_0x8ce9('0x61')](_0x372756[_0x8ce9('0x62')]);}})['then'](respondWithResult(_0x55036f,null))[_0x8ce9('0x30')](handleError(_0x55036f,null));};exports[_0x8ce9('0x6c')]=function(_0x527a9d,_0x53d1d2,_0x1cdac5){var _0x66f05d={'raw':![],'where':{}};var _0x1c6f9c={};var _0x1282e2={'count':0x0,'rows':[]};return db[_0x8ce9('0x58')]['findOne']({'where':{'id':_0x527a9d[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x53d1d2,null))[_0x8ce9('0x27')](function(_0x1b8ec4){if(_0x1b8ec4){_0x1c6f9c[_0x8ce9('0x49')]=_['keys'](db[_0x8ce9('0x6b')][_0x8ce9('0x45')]);_0x1c6f9c[_0x8ce9('0x4a')]=_[_0x8ce9('0x5e')](_0x527a9d['query']);_0x1c6f9c[_0x8ce9('0x4b')]=_['intersection'](_0x1c6f9c[_0x8ce9('0x49')],_0x1c6f9c[_0x8ce9('0x4a')]);_0x66f05d[_0x8ce9('0x4e')]=_[_0x8ce9('0x4c')](_0x1c6f9c[_0x8ce9('0x49')],qs[_0x8ce9('0x4d')](_0x527a9d[_0x8ce9('0x4a')][_0x8ce9('0x4d')]));_0x66f05d['attributes']=_0x66f05d[_0x8ce9('0x4e')][_0x8ce9('0x5f')]?_0x66f05d['attributes']:_0x1c6f9c[_0x8ce9('0x49')];if(!_0x527a9d[_0x8ce9('0x4a')][_0x8ce9('0x4f')](_0x8ce9('0x50'))){_0x66f05d[_0x8ce9('0x51')]=qs['limit'](_0x527a9d[_0x8ce9('0x4a')][_0x8ce9('0x51')]);_0x66f05d[_0x8ce9('0x35')]=qs[_0x8ce9('0x35')](_0x527a9d[_0x8ce9('0x4a')]['offset']);}_0x66f05d[_0x8ce9('0x6d')]=qs[_0x8ce9('0x52')](_0x527a9d[_0x8ce9('0x4a')][_0x8ce9('0x52')]);_0x66f05d[_0x8ce9('0x53')]=qs[_0x8ce9('0x4b')](_[_0x8ce9('0x54')](_0x527a9d[_0x8ce9('0x4a')],_0x1c6f9c[_0x8ce9('0x4b')]));_0x66f05d[_0x8ce9('0x53')]['ChatWebsiteId']=_0x1b8ec4['id'];if(_0x527a9d[_0x8ce9('0x4a')][_0x8ce9('0x55')]){_0x66f05d['where']=_['merge'](_0x66f05d[_0x8ce9('0x53')],{'$or':_[_0x8ce9('0x44')](_0x66f05d['attributes'],function(_0x52ac7b){var _0x425a4a={};_0x425a4a[_0x52ac7b]={'$like':'%'+_0x527a9d['query'][_0x8ce9('0x55')]+'%'};return _0x425a4a;})});}_0x66f05d=_['merge']({},_0x66f05d,_0x527a9d[_0x8ce9('0x57')]);return db[_0x8ce9('0x6b')]['count']({'where':_0x66f05d['where']})[_0x8ce9('0x27')](function(_0x5b7cb6){_0x1282e2[_0x8ce9('0x34')]=_0x5b7cb6;if(_0x527a9d[_0x8ce9('0x4a')][_0x8ce9('0x59')]){_0x66f05d['include']=[{'all':!![]}];}return db[_0x8ce9('0x6b')]['findAll'](_0x66f05d);})[_0x8ce9('0x27')](function(_0x4f998e){_0x1282e2[_0x8ce9('0x5c')]=_0x4f998e;return _0x1282e2;});}})['then'](respondWithFilteredResult(_0x53d1d2,_0x66f05d))[_0x8ce9('0x30')](handleError(_0x53d1d2,null));};exports[_0x8ce9('0x6e')]=function(_0x4203a7,_0x3e1c1a,_0x2f4aa2){return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'where':{'id':_0x4203a7[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x3e1c1a,null))['then'](function(_0x18d2fb){if(_0x18d2fb){return _0x18d2fb[_0x8ce9('0x6e')](_0x4203a7[_0x8ce9('0x4a')][_0x8ce9('0x6f')]);}})[_0x8ce9('0x27')](respondWithStatusCode(_0x3e1c1a,null))[_0x8ce9('0x30')](handleError(_0x3e1c1a,null));};exports[_0x8ce9('0x70')]=function(_0x60aa4d,_0x248222,_0x5ba91d){if(_0x60aa4d[_0x8ce9('0x62')]['id']){delete _0x60aa4d['body']['id'];}return db['ChatWebsite'][_0x8ce9('0x60')]({'where':{'id':_0x60aa4d[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x248222,null))[_0x8ce9('0x27')](function(_0x598987){if(_0x598987){_0x60aa4d[_0x8ce9('0x62')][_0x8ce9('0x71')]=_0x598987['id'];return db[_0x8ce9('0x72')][_0x8ce9('0x61')](_0x60aa4d[_0x8ce9('0x62')]);}})[_0x8ce9('0x27')](respondWithResult(_0x248222,null))[_0x8ce9('0x30')](handleError(_0x248222,null));};exports[_0x8ce9('0x73')]=function(_0x5282c2,_0x32792c,_0x51dc41){var _0x32ea07={'raw':![],'where':{}};var _0x1f5e79={};var _0x15d25d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8ce9('0x74')]({'where':{'id':_0x5282c2[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x32792c,null))[_0x8ce9('0x27')](function(_0xa4cb4b){if(_0xa4cb4b){_0x1f5e79[_0x8ce9('0x49')]=_[_0x8ce9('0x5e')](db[_0x8ce9('0x72')]['rawAttributes']);_0x1f5e79[_0x8ce9('0x4a')]=_[_0x8ce9('0x5e')](_0x5282c2[_0x8ce9('0x4a')]);_0x1f5e79[_0x8ce9('0x4b')]=_[_0x8ce9('0x4c')](_0x1f5e79[_0x8ce9('0x49')],_0x1f5e79[_0x8ce9('0x4a')]);_0x32ea07[_0x8ce9('0x4e')]=_[_0x8ce9('0x4c')](_0x1f5e79['model'],qs[_0x8ce9('0x4d')](_0x5282c2['query'][_0x8ce9('0x4d')]));_0x32ea07[_0x8ce9('0x4e')]=_0x32ea07['attributes'][_0x8ce9('0x5f')]?_0x32ea07['attributes']:_0x1f5e79[_0x8ce9('0x49')];if(!_0x5282c2['query'][_0x8ce9('0x4f')](_0x8ce9('0x50'))){_0x32ea07[_0x8ce9('0x51')]=qs[_0x8ce9('0x51')](_0x5282c2['query'][_0x8ce9('0x51')]);_0x32ea07[_0x8ce9('0x35')]=qs[_0x8ce9('0x35')](_0x5282c2[_0x8ce9('0x4a')][_0x8ce9('0x35')]);}_0x32ea07[_0x8ce9('0x6d')]=qs['sort'](_0x5282c2[_0x8ce9('0x4a')][_0x8ce9('0x52')]);_0x32ea07[_0x8ce9('0x53')]=qs['filters'](_['pick'](_0x5282c2[_0x8ce9('0x4a')],_0x1f5e79['filters']));_0x32ea07[_0x8ce9('0x53')]['ChatWebsiteId']=_0xa4cb4b['id'];if(_0x5282c2['query'][_0x8ce9('0x55')]){_0x32ea07[_0x8ce9('0x53')]=_[_0x8ce9('0x56')](_0x32ea07[_0x8ce9('0x53')],{'$or':_['map'](_0x32ea07[_0x8ce9('0x4e')],function(_0x4f482f){var _0x2caba6={};_0x2caba6[_0x4f482f]={'$like':'%'+_0x5282c2['query'][_0x8ce9('0x55')]+'%'};return _0x2caba6;})});}_0x32ea07=_[_0x8ce9('0x56')]({},_0x32ea07,_0x5282c2[_0x8ce9('0x57')]);return db[_0x8ce9('0x72')]['count']({'where':_0x32ea07[_0x8ce9('0x53')]})[_0x8ce9('0x27')](function(_0xf52901){_0x15d25d[_0x8ce9('0x34')]=_0xf52901;if(_0x5282c2['query'][_0x8ce9('0x59')]){_0x32ea07[_0x8ce9('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8ce9('0x5b')](_0x32ea07);})[_0x8ce9('0x27')](function(_0x585acf){_0x15d25d['rows']=_0x585acf;return _0x15d25d;});}})[_0x8ce9('0x27')](respondWithFilteredResult(_0x32792c,_0x32ea07))[_0x8ce9('0x30')](handleError(_0x32792c,null));};exports[_0x8ce9('0x75')]=function(_0x41575d,_0x5022b0,_0x81a278){return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'where':{'id':_0x41575d[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x5022b0,null))[_0x8ce9('0x27')](function(_0x160e57){if(_0x160e57){return _0x160e57[_0x8ce9('0x75')](_0x41575d[_0x8ce9('0x4a')][_0x8ce9('0x6f')]);}})[_0x8ce9('0x27')](respondWithStatusCode(_0x5022b0,null))[_0x8ce9('0x30')](handleError(_0x5022b0,null));};exports[_0x8ce9('0x76')]=function(_0x37bab4,_0x273843,_0x14d166){_0x37bab4[_0x8ce9('0x62')][_0x8ce9('0x77')]=_0x37bab4['file'][_0x8ce9('0x78')];return db[_0x8ce9('0x58')]['find']({'where':{'id':_0x37bab4[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x273843,null))['then'](saveUpdates(_0x37bab4[_0x8ce9('0x62')],null))[_0x8ce9('0x27')](respondWithResult(_0x273843,null))[_0x8ce9('0x30')](handleError(_0x273843,null));};exports['addAvatar']=function(_0x56d692,_0x2ff740,_0x5dedf7){_0x56d692[_0x8ce9('0x62')][_0x8ce9('0x79')]=_0x56d692[_0x8ce9('0x7a')][_0x8ce9('0x78')];return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'where':{'id':_0x56d692['params']['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x2ff740,null))[_0x8ce9('0x27')](saveUpdates(_0x56d692[_0x8ce9('0x62')],null))[_0x8ce9('0x27')](respondWithResult(_0x2ff740,null))[_0x8ce9('0x30')](handleError(_0x2ff740,null));};exports[_0x8ce9('0x7b')]=function(_0x3fdd6f,_0x44d297,_0x233fd7){_0x3fdd6f['body']['customerAvatar']=_0x3fdd6f['file'][_0x8ce9('0x78')];return db['ChatWebsite'][_0x8ce9('0x60')]({'where':{'id':_0x3fdd6f[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x44d297,null))[_0x8ce9('0x27')](saveUpdates(_0x3fdd6f[_0x8ce9('0x62')],null))[_0x8ce9('0x27')](respondWithResult(_0x44d297,null))['catch'](handleError(_0x44d297,null));};exports[_0x8ce9('0x7c')]=function(_0x4b806e,_0xb95c1a,_0x571c22){_0x4b806e[_0x8ce9('0x62')]['systemAvatar']=_0x4b806e[_0x8ce9('0x7a')]['filename'];return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'where':{'id':_0x4b806e[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0xb95c1a,null))[_0x8ce9('0x27')](saveUpdates(_0x4b806e['body'],null))[_0x8ce9('0x27')](respondWithResult(_0xb95c1a,null))['catch'](handleError(_0xb95c1a,null));};exports[_0x8ce9('0x7d')]=function(_0x4163dd,_0x170ec5,_0x4f0418){var _0x13ea77=path[_0x8ce9('0x7e')](config[_0x8ce9('0x7f')],_0x8ce9('0x80'));var _0x3320ef={'where':{'id':_0x4163dd['params']['id']},'attributes':['id',_0x8ce9('0x77')],'raw':!![]};var _0x19f1ce=![];return require(_0x8ce9('0x1c'))['getLicense']()['then'](function(_0x3629c2){if(_0x3629c2){_0x19f1ce=_0x3629c2[_0x8ce9('0x81')];}})[_0x8ce9('0x27')](function(){return db['ChatWebsite']['find'](_0x3320ef);})['then'](handleEntityNotFound(_0x170ec5,null))[_0x8ce9('0x27')](function(_0x4c9a8b){if(_0x4c9a8b){if(!_[_0x8ce9('0x82')](_0x4c9a8b['sitepic'])){if(fs[_0x8ce9('0x83')](path['join'](config[_0x8ce9('0x7f')],_0x8ce9('0x84'),_0x4c9a8b[_0x8ce9('0x77')]))&&_0x19f1ce){_0x13ea77=path[_0x8ce9('0x7e')](config[_0x8ce9('0x7f')],_0x8ce9('0x84'),_0x4c9a8b['sitepic']);}}return _0x170ec5[_0x8ce9('0x85')](_0x13ea77);}})['catch'](handleError(_0x170ec5,null));};exports[_0x8ce9('0x86')]=function(_0xa242c3,_0x4a90e1,_0x2407ce){var _0xce6e93=path[_0x8ce9('0x7e')](config['root'],_0x8ce9('0x87'));var _0x1316d4={'where':{'id':_0xa242c3[_0x8ce9('0x6a')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x8ce9('0x60')](_0x1316d4)[_0x8ce9('0x27')](handleEntityNotFound(_0x4a90e1,null))['then'](function(_0x1c7036){if(_0x1c7036){if(!_[_0x8ce9('0x82')](_0x1c7036['agentAvatar'])){if(fs[_0x8ce9('0x83')](path[_0x8ce9('0x7e')](config['root'],'server/files/images/avatars/',_0x1c7036['agentAvatar']))){_0xce6e93=path[_0x8ce9('0x7e')](config[_0x8ce9('0x7f')],_0x8ce9('0x88'),_0x1c7036[_0x8ce9('0x79')]);}}return _0x4a90e1['download'](_0xce6e93);}})[_0x8ce9('0x30')](handleError(_0x4a90e1,null));};exports['getCustomerAvatar']=function(_0x421ec8,_0x3e1090,_0x9856d2){var _0x804494=path[_0x8ce9('0x7e')](config['root'],_0x8ce9('0x89'));var _0xb0a193={'where':{'id':_0x421ec8[_0x8ce9('0x6a')]['id']},'attributes':['id',_0x8ce9('0x8a'),_0x8ce9('0x8b')],'raw':!![]};return db[_0x8ce9('0x58')][_0x8ce9('0x60')](_0xb0a193)[_0x8ce9('0x27')](handleEntityNotFound(_0x3e1090,null))['then'](function(_0x56a52c){if(_0x56a52c){if(!_[_0x8ce9('0x82')](_0x56a52c[_0x8ce9('0x8a')])){if(fs[_0x8ce9('0x83')](path[_0x8ce9('0x7e')](config[_0x8ce9('0x7f')],'server/files/images/avatars/',_0x56a52c['customerAvatar']))&&_0x56a52c[_0x8ce9('0x8b')]){_0x804494=path[_0x8ce9('0x7e')](config[_0x8ce9('0x7f')],_0x8ce9('0x88'),_0x56a52c[_0x8ce9('0x8a')]);}}return _0x3e1090[_0x8ce9('0x85')](_0x804494);}})[_0x8ce9('0x30')](handleError(_0x3e1090,null));};exports[_0x8ce9('0x8c')]=function(_0x4f89c4,_0x50d32b,_0x47fdde){var _0x1007d1=path['join'](config[_0x8ce9('0x7f')],_0x8ce9('0x8d'));var _0x1ef0f0={'where':{'id':_0x4f89c4[_0x8ce9('0x6a')]['id']},'attributes':['id',_0x8ce9('0x8e')],'raw':!![]};return db['ChatWebsite'][_0x8ce9('0x60')](_0x1ef0f0)[_0x8ce9('0x27')](handleEntityNotFound(_0x50d32b,null))[_0x8ce9('0x27')](function(_0x4b05dc){if(_0x4b05dc){if(!_[_0x8ce9('0x82')](_0x4b05dc[_0x8ce9('0x8e')])){if(fs['existsSync'](path['join'](config[_0x8ce9('0x7f')],_0x8ce9('0x88'),_0x4b05dc[_0x8ce9('0x8e')]))){_0x1007d1=path[_0x8ce9('0x7e')](config[_0x8ce9('0x7f')],_0x8ce9('0x88'),_0x4b05dc[_0x8ce9('0x8e')]);}}return _0x50d32b['download'](_0x1007d1);}})['catch'](handleError(_0x50d32b,null));};exports['notify']=function(_0x1c842f,_0x126834,_0x38760d){var _0xed4d9a=require(_0x8ce9('0x8f'));var _0x4482da=new _0xed4d9a();var _0x8ab7e5=_0x4482da['setUA'](_0x1c842f[_0x8ce9('0x90')]['user-agent'])[_0x8ce9('0x91')]();var _0x54e0e9={'body':_0x1c842f[_0x8ce9('0x62')],'channel':'chat'};var _0x39f6b8=[];var _0x22f015=[];var _0x51c6fb={};var _0x3e67f3=![];return db[_0x8ce9('0x92')]['describe']()[_0x8ce9('0x27')](function(_0x1546c2){if(!_0x1546c2){throw new db[(_0x8ce9('0x93'))][(_0x8ce9('0x94'))](_0x8ce9('0x95'));}_0x39f6b8=_[_0x8ce9('0x96')](_['keys'](_0x1546c2),[_0x8ce9('0x97'),_0x8ce9('0x98')]);_0x22f015=_['difference'](_[_0x8ce9('0x5e')](_0x1546c2),[_0x8ce9('0x97'),_0x8ce9('0x98'),_0x8ce9('0x99'),'ListId']);if(_0x1c842f['body']['id']){delete _0x1c842f[_0x8ce9('0x62')]['id'];}if(_[_0x8ce9('0x82')](_0x1c842f['body'][_0x8ce9('0x9a')])){throw new db[(_0x8ce9('0x93'))][(_0x8ce9('0x94'))](_0x8ce9('0x9b'));}if(_[_0x8ce9('0x82')](_0x1c842f['body'][_0x8ce9('0x62')])||_0x1c842f[_0x8ce9('0x62')]['body']===''){throw new db[(_0x8ce9('0x93'))][(_0x8ce9('0x94'))](_0x8ce9('0x9c'));}if(_[_0x8ce9('0x82')](_0x1c842f['body'][_0x8ce9('0x9d')])){throw new db[(_0x8ce9('0x93'))][(_0x8ce9('0x94'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22f015);}if(!_[_0x8ce9('0x9e')](_0x22f015,_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0x9d')])){throw new db[(_0x8ce9('0x93'))]['ValidationError'](_0x8ce9('0x9f')+_0x22f015);}_0x51c6fb[_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0x9d')]]=_0x1c842f['body']['from'];})[_0x8ce9('0x27')](function(){return db['ChatWebsite'][_0x8ce9('0x60')]({'where':{'id':_0x1c842f[_0x8ce9('0x6a')]['id']},'include':[{'model':db[_0x8ce9('0xa0')],'as':_0x8ce9('0xa1'),'include':[{'model':db[_0x8ce9('0x92')],'as':_0x8ce9('0xa2'),'where':_0x51c6fb,'limit':0x1,'order':[[_0x8ce9('0x98'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x8ce9('0xa3')}]});})['then'](handleEntityNotFound(_0x126834,null))[_0x8ce9('0x27')](function(_0x79cfa5){if(_0x79cfa5&&_0x79cfa5[_0x8ce9('0xa1')]){_0x54e0e9['account']=_0x79cfa5;_0x54e0e9[_0x8ce9('0xa4')]=_0x79cfa5[_0x8ce9('0xa3')];_0x54e0e9[_0x8ce9('0xa5')]=_0x79cfa5[_0x8ce9('0xa1')];_0x54e0e9[_0x8ce9('0xa4')]=_[_0x8ce9('0xa6')](_0x54e0e9['applications'],[_0x8ce9('0xa7')],[_0x8ce9('0xa8')]);if(_0x54e0e9['account']['Applications']){delete _0x54e0e9[_0x8ce9('0xa9')][_0x8ce9('0xa3')];}if(_0x54e0e9['account']['List']&&_0x54e0e9[_0x8ce9('0xa9')][_0x8ce9('0xa1')]['Contacts']['length']){return _0x54e0e9[_0x8ce9('0xa9')][_0x8ce9('0xa1')]['Contacts'][0x0];}var _0x443dba=_['defaults'](_0x1c842f[_0x8ce9('0x62')],{'firstName':_0x1c842f['body'][_0x8ce9('0x9a')],'ListId':_0x79cfa5[_0x8ce9('0xaa')]});_0x443dba[_0x1c842f['body'][_0x8ce9('0x9d')]]=_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0x9a')];return db[_0x8ce9('0x92')][_0x8ce9('0x61')](_0x443dba,{'fields':_0x39f6b8,'raw':!![]});}})['then'](handleEntityNotFound(_0x126834,null))[_0x8ce9('0x27')](function(_0x24684e){_0x54e0e9[_0x8ce9('0xab')]=_0x24684e;var _0x52cab3=_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xac')];if(_0x1c842f['headers'][_0x8ce9('0xad')]){_0x52cab3=_0x1c842f['headers']['cf-connecting-ip'];}else if(_0x1c842f[_0x8ce9('0x90')][_0x8ce9('0xae')]){_0x52cab3=_[_0x8ce9('0xaf')](_0x1c842f[_0x8ce9('0x90')][_0x8ce9('0xae')][_0x8ce9('0xb0')](','));}if(_0x24684e){var _0x5399b7={'ContactId':_0x24684e['id'],'ChatWebsiteId':_0x1c842f['params']['id'],'from':(_0x24684e[_0x8ce9('0xb1')]||'')+'\x20'+(_0x24684e[_0x8ce9('0xb2')]||''),'customerIp':_0x52cab3,'customerPort':_0x1c842f['headers'][_0x8ce9('0xb3')]?_0x1c842f[_0x8ce9('0x90')]['x-real-port']:null,'referer':_0x1c842f['body']['referer'],'browserName':_0x8ab7e5[_0x8ce9('0xb4')][_0x8ce9('0x40')]&&_0x8ab7e5['browser'][_0x8ce9('0xb5')]?util[_0x8ce9('0xb6')](_0x8ce9('0xb7'),_0x8ab7e5[_0x8ce9('0xb4')]['name'],_0x8ab7e5[_0x8ce9('0xb4')][_0x8ce9('0xb5')]):_0x8ce9('0xb8'),'browserVersion':_0x8ab7e5[_0x8ce9('0xb4')]['version']||'unknown','osName':util[_0x8ce9('0xb6')](_0x8ce9('0xb7'),_0x8ab7e5['os']['name'],_0x8ab7e5['os']['version']),'osVersion':_0x8ab7e5['os'][_0x8ce9('0xb5')],'deviceModel':_0x8ab7e5['device'][_0x8ce9('0x49')]&&_0x8ab7e5[_0x8ce9('0xb9')][_0x8ce9('0xba')]?util[_0x8ce9('0xb6')]('%s\x20%s\x20%s',_0x8ab7e5['device']['model'],_0x8ab7e5[_0x8ce9('0xb9')][_0x8ce9('0xba')],_0x8ab7e5['device']['type']):null,'deviceVendor':_0x8ab7e5[_0x8ce9('0xb9')][_0x8ce9('0xba')],'deviceType':_0x8ab7e5[_0x8ce9('0xb9')]['type'],'formData':JSON[_0x8ce9('0xbb')](_0x1c842f[_0x8ce9('0x62')])};var _0x452aa3={'ChatWebsiteId':_0x1c842f['params']['id'],'closed':![]};if(_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xbc')]){_0x452aa3['threadId']=_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xbc')];return db[_0x8ce9('0xbd')][_0x8ce9('0x60')]({'where':_0x452aa3})[_0x8ce9('0x27')](function(_0x24c8a4){if(_0x24c8a4){return[_0x24c8a4,![]];}_0x5399b7[_0x8ce9('0xbc')]=_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xbc')];_0x5399b7['externalUrl']=_0x1c842f[_0x8ce9('0x62')]['externalUrl'];return db[_0x8ce9('0xbd')][_0x8ce9('0x61')](_0x5399b7)[_0x8ce9('0x27')](function(_0x2f9262){return[_0x2f9262,!![]];});});}_0x452aa3[_0x8ce9('0xbe')]=_0x24684e['id'];if(_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xbf')]&&_0x1c842f[_0x8ce9('0x62')]['interaction']['id']){_0x452aa3['id']=_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xbf')]['id'];return db[_0x8ce9('0xbd')][_0x8ce9('0x60')]({'where':_0x452aa3})['then'](function(_0x21d6d1){if(_0x21d6d1){return[_0x21d6d1,![]];}return db[_0x8ce9('0xbd')][_0x8ce9('0x61')](_0x5399b7)[_0x8ce9('0x27')](function(_0x26a60f){return[_0x26a60f,!![]];});});}return db[_0x8ce9('0xbd')]['create'](_0x5399b7)[_0x8ce9('0x27')](function(_0x36a1ea){return[_0x36a1ea,!![]];});}})[_0x8ce9('0xc0')](function(_0x5588f7,_0x153660){if(_0x5588f7){_0x3e67f3=_0x153660;if(!_0x153660){var _0x400910={'from':(_0x54e0e9[_0x8ce9('0xab')][_0x8ce9('0xb1')]||'')+'\x20'+(_0x54e0e9[_0x8ce9('0xab')][_0x8ce9('0xb2')]||'')};if(_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xbc')]&&_0x1c842f['body']['messageId']&&_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xbc')]!=_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xc1')]){_0x400910['threadId']=_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0xc1')];}return _0x5588f7['update'](_0x400910);}else{return _0x5588f7;}}})[_0x8ce9('0x27')](function(_0x4bbdb9){_0x54e0e9['interaction']=_0x4bbdb9[_0x8ce9('0x3b')]({'plain':!![]});_0x54e0e9[_0x8ce9('0xbf')][_0x8ce9('0xc2')]=_0x3e67f3;if(_0x54e0e9[_0x8ce9('0xbf')][_0x8ce9('0xc2')]){if(_0x54e0e9[_0x8ce9('0xa9')][_0x8ce9('0xc3')]){_0x54e0e9[_0x8ce9('0xa4')]['push']({'id':0x0,'priority':_0x54e0e9['applications'][_0x8ce9('0x5f')]+0x1,'app':_0x8ce9('0xc4'),'appdata':_0x8ce9('0xc5'),'interval':_0x8ce9('0xc6')});}}return db[_0x8ce9('0xc7')][_0x8ce9('0x61')]({'body':_0x1c842f[_0x8ce9('0x62')][_0x8ce9('0x62')],'ChatWebsiteId':_0x1c842f[_0x8ce9('0x6a')]['id'],'ChatInteractionId':_0x4bbdb9['id'],'direction':'in','ContactId':_0x54e0e9[_0x8ce9('0xab')]['id'],'AttachmentId':_0x1c842f['body'][_0x8ce9('0xc8')]});})[_0x8ce9('0x27')](function(_0x1e3db8){_0x54e0e9[_0x8ce9('0x2d')]=_0x1e3db8;if(_0x54e0e9[_0x8ce9('0xbf')][_0x8ce9('0xc9')]){return db['User'][_0x8ce9('0x60')]({'attributes':['id',_0x8ce9('0x40')],'where':{'id':_0x54e0e9[_0x8ce9('0xbf')][_0x8ce9('0xc9')]}})[_0x8ce9('0x27')](function(_0x190b70){if(_0x190b70){_0x54e0e9[_0x8ce9('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8ce9('0xca'),'appdata':_0x190b70['name']+','+(_0x54e0e9[_0x8ce9('0xa9')][_0x8ce9('0xcb')]||0xa),'interval':_0x8ce9('0xc6')});_0x54e0e9['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x8ce9('0xcc'),_0x54e0e9);});}return respondWithRpcPromise('Start',_0x8ce9('0xcc'),_0x54e0e9);})[_0x8ce9('0x27')](function(_0x46d976){respondWithRpcPromise(_0x8ce9('0xcd'),_0x8ce9('0xcd'),{'event':'notify','message':_0x46d976},client9002);return _0x46d976;})[_0x8ce9('0x27')](respondWithResult(_0x126834,null))[_0x8ce9('0x30')](handleError(_0x126834,null));};exports[_0x8ce9('0xce')]=function(_0x4ea3a6,_0x335ae9,_0x7e93c4){var _0x3f4c61,_0x24788f,_0x5ccefe;var _0xca981=[];var _0x3e2532=[];var _0xf16be0={};var _0x2b4893=_0x4ea3a6['files']||[];var _0x4fe2f2=[];var _0x2ee562;return db[_0x8ce9('0x92')][_0x8ce9('0x68')]()[_0x8ce9('0x27')](function(_0x53fe43){if(!_0x53fe43){throw new db[(_0x8ce9('0x93'))][(_0x8ce9('0x94'))](_0x8ce9('0x95'));}_0x3e2532=_['difference'](_[_0x8ce9('0x5e')](_0x53fe43),[_0x8ce9('0x97'),'updatedAt']);_0xca981=_['difference'](_[_0x8ce9('0x5e')](_0x53fe43),[_0x8ce9('0x97'),_0x8ce9('0x98'),_0x8ce9('0x99'),_0x8ce9('0xaa')]);if(_0x4ea3a6['body']['id']){delete _0x4ea3a6[_0x8ce9('0x62')]['id'];}if(_['isNil'](_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0x9a')])){throw _0x335ae9[_0x8ce9('0x32')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x8ce9('0x9b')));}if(_[_0x8ce9('0x82')](_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0x62')])||_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0x62')]===''){throw _0x335ae9[_0x8ce9('0x32')](0x1f4)[_0x8ce9('0x41')](new db['Sequelize'][(_0x8ce9('0x94'))](_0x8ce9('0x9c')));}if(_[_0x8ce9('0x82')](_0x4ea3a6[_0x8ce9('0x62')]['mapKeyOffline'])){throw _0x335ae9['status'](0x1f4)[_0x8ce9('0x41')](new db[(_0x8ce9('0x93'))][(_0x8ce9('0x94'))](_0x8ce9('0xcf')+_0xca981));}if(!_['includes'](_0xca981,_0x4ea3a6['body'][_0x8ce9('0xd0')])){throw _0x335ae9[_0x8ce9('0x32')](0x1f4)[_0x8ce9('0x41')](new db[(_0x8ce9('0x93'))]['ValidationError'](_0x8ce9('0xd1')+_0xca981));}_0xf16be0[_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0xd0')]]=_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0x9a')];})[_0x8ce9('0x27')](function(){return db[_0x8ce9('0x58')]['find']({'where':{'id':_0x4ea3a6[_0x8ce9('0x6a')]['id']},'include':[{'model':db[_0x8ce9('0xa0')],'as':_0x8ce9('0xa1')},{'model':db[_0x8ce9('0xd2')],'as':_0x8ce9('0xd2')}]});})[_0x8ce9('0x27')](handleEntityNotFound(_0x335ae9,null))[_0x8ce9('0x27')](function(_0x1d5f98){if(_0x1d5f98&&_0x1d5f98[_0x8ce9('0xa1')]){_0x24788f=_0x1d5f98;var _0x3015c1=_['defaults'](_0x4ea3a6[_0x8ce9('0x62')],{'firstName':_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0x9a')],'phone':_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0x9a')],'ListId':_0x1d5f98[_0x8ce9('0xaa')]});_0x3015c1[_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0xd0')]]=_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0x9a')];return db['CmContact'][_0x8ce9('0xd3')]({'where':_0xf16be0,'defaults':_0x3015c1});}})[_0x8ce9('0xc0')](function(_0x4a49d4){if(_0x4a49d4){_0x5ccefe=_0x4a49d4;var _0x487f4d=fs[_0x8ce9('0xd4')](path[_0x8ce9('0x7e')](config['root'],_0x8ce9('0xd5')),_0x8ce9('0xd6'));var _0x487562=ejs['render'](_0x487f4d,{'body':_[_0x8ce9('0xd7')](_0x4ea3a6[_0x8ce9('0x62')][_0x8ce9('0x62')]),'bodyTitle':_0x24788f[_0x8ce9('0xd8')]});return db[_0x8ce9('0xd9')][_0x8ce9('0x61')]({'body':_0x487562,'ContactId':_0x4a49d4['id'],'ChatWebsiteId':_0x24788f['id']});}})[_0x8ce9('0x27')](function(_0x39db6a){_0x2ee562=_0x39db6a;if(!_[_0x8ce9('0x82')](_0x4ea3a6[_0x8ce9('0xda')])){var _0xa4271e=_0x4ea3a6['files'][_0x8ce9('0x44')](function(_0xa219ff){return{'name':_0xa219ff[_0x8ce9('0xdb')],'basename':_0xa219ff[_0x8ce9('0x78')],'type':_0xa219ff[_0x8ce9('0xdc')],'ChatOfflineMessageId':_0x39db6a['id']};});_0x4fe2f2=_0xa4271e[_0x8ce9('0x44')](_0x5a40c4=>{var _0x337c08={'filename':_0x5a40c4[_0x8ce9('0x40')],'path':path[_0x8ce9('0x7e')](config['root'],_0x8ce9('0xdd'),'files',_0x8ce9('0xde'),_0x8ce9('0xdf'),_0x5a40c4['basename'])};return _0x337c08;});if(!_0x24788f[_0x8ce9('0xe0')]){return db[_0x8ce9('0xe1')][_0x8ce9('0xe2')](function(_0x373ca9){return db[_0x8ce9('0xe3')][_0x8ce9('0xe4')](_0xa4271e,{'transaction':_0x373ca9});});}}})[_0x8ce9('0x27')](function(){if(_0x2ee562){_0x3f4c61=_0x2ee562;return db[_0x8ce9('0xd2')][_0x8ce9('0x74')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0x8ce9('0x27')](function(_0x1e34a2){if(_0x1e34a2&&_0x1e34a2['Smtp']&&_0x24788f[_0x8ce9('0xe5')]&&_0x24788f[_0x8ce9('0xe6')]){var _0x5c4acd={'tls':{'rejectUnauthorized':![]}};if(_0x1e34a2['Smtp']['service']){_0x5c4acd[_0x8ce9('0xe7')]=_0x1e34a2[_0x8ce9('0xe8')]['service'];}else{_0x5c4acd['host']=_0x1e34a2['Smtp'][_0x8ce9('0xe9')];_0x5c4acd[_0x8ce9('0xea')]=_0x1e34a2[_0x8ce9('0xe8')]['port'];_0x5c4acd['secure']=_0x1e34a2['Smtp'][_0x8ce9('0xeb')];}if(_0x1e34a2['Smtp'][_0x8ce9('0xec')]){_0x5c4acd['auth']={'user':_0x1e34a2[_0x8ce9('0xe8')]['user'],'pass':_0x1e34a2[_0x8ce9('0xe8')][_0x8ce9('0xed')]};}return respondWithRpcPromise(_0x8ce9('0xee'),'sendMail',{'account':_0x5c4acd,'message':{'from':util[_0x8ce9('0xb6')](_0x8ce9('0xef'),_0x1e34a2[_0x8ce9('0x40')],_0x1e34a2['email']||_0x1e34a2[_0x8ce9('0xe8')]['user']),'to':_0x24788f[_0x8ce9('0xe6')],'subject':_0x24788f[_0x8ce9('0xf0')],'text':_0x3f4c61[_0x8ce9('0x62')],'attachments':_0x4fe2f2}},client9003)['then'](function(){return _0x3f4c61;})[_0x8ce9('0x30')](function(_0xc7c730){console[_0x8ce9('0x2a')](_0xc7c730);});}})[_0x8ce9('0x27')](function(){if(_0x24788f&&_0x24788f[_0x8ce9('0xe0')]&&_0x24788f[_0x8ce9('0xf1')]){var _0x509605=_0x4ea3a6[_0x8ce9('0xda')][_0x8ce9('0x44')](function(_0x24e994){return{'name':_0x24e994[_0x8ce9('0xdb')],'basename':_0x24e994['filename'],'type':_0x24e994['mimetype'],'ChatOfflineMessageId':_0x2ee562['id']};});var _0x4eb297;if(!_[_0x8ce9('0x82')](_0x24788f[_0x8ce9('0xf2')])){var _0x196bc4=_[_0x8ce9('0x44')](_0x4ea3a6[_0x8ce9('0x62')],function(_0x5212b5){return _0x5212b5;});var _0xa5868b=_[_0x8ce9('0xf3')](_0x196bc4)[0x0];var _0x5da6f1=_[_0x8ce9('0xf4')](_0xa5868b,function(_0x3aaedc){return _0x3aaedc;});_0x4eb297=_0x5da6f1[0x1][_0x24788f[_0x8ce9('0xf2')]];}var _0x2d76a9={'from':_0x5ccefe[_0x8ce9('0xf5')],'firstName':_0x5ccefe['firstName'],'lastName':_0x5ccefe[_0x8ce9('0xb2')],'mapKey':_0x8ce9('0xf5'),'message':{'from':_0x5ccefe['email'],'to':_0x24788f[_0x8ce9('0xd2')][_0x8ce9('0xf5')],'cc':'','subject':_[_0x8ce9('0x82')](_0x4eb297)?_0x24788f[_0x8ce9('0xf0')]:_0x4eb297,'messageId':'','sentAt':new Date(),'attach':_0x509605[_0x8ce9('0x5f')],'attachments':_0x509605,'originChannel':'Chat','ChatWebsiteId':_0x24788f['id'],'ChatOfflineMessageId':_0x3f4c61['id'],'originTo':_0x24788f['MailAccount'][_0x8ce9('0xf5')]},'body':_0x3f4c61['body']};var _0x269083={'account':{'id':_0x24788f[_0x8ce9('0xf1')]},'body':_0x2d76a9,'log':_0x8ce9('0xf6')};return respondWithRpcPromise('NotifyMailAccount',_0x8ce9('0xf7'),_0x269083,client9001)[_0x8ce9('0x27')](function(){return _0x3f4c61;})[_0x8ce9('0x30')](function(_0x246ea0){console['error'](_0x246ea0);});}return;})[_0x8ce9('0x27')](function(){if(_0x3f4c61){return _0x3f4c61;}})[_0x8ce9('0x27')](respondWithResult(_0x335ae9,null))['catch'](function(_0xa1d201){console[_0x8ce9('0x2a')](_0x8ce9('0x30'),_0xa1d201);for(var _0x398c15 of _0x2b4893){var _0x4b51e9=path['join'](config[_0x8ce9('0x7f')],_0x8ce9('0xdd'),_0x8ce9('0xda'),_0x8ce9('0xde'),_0x8ce9('0xdf'),_0x398c15['filename']);fs_extra[_0x8ce9('0xf8')](_0x4b51e9)[_0x8ce9('0x30')](function(_0x55ab48){console[_0x8ce9('0x2a')]('Could\x20not\x20remove\x20attachment\x20file',_0x4b51e9,_0x55ab48);});}});};exports[_0x8ce9('0xf9')]=function(_0x329d4c,_0x3194c,_0x1ff06f){return db['ChatInteraction']['find']({'where':{'id':_0x329d4c[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x3194c,null))[_0x8ce9('0x27')](function(_0x57bf7e){if(_0x57bf7e){return _0x57bf7e[_0x8ce9('0xf9')](_0x329d4c[_0x8ce9('0x62')][_0x8ce9('0x6f')],_[_0x8ce9('0xfa')](_0x329d4c[_0x8ce9('0x62')],[_0x8ce9('0x6f'),'id'])||{});}})[_0x8ce9('0x27')](respondWithResult(_0x3194c,null))['catch'](handleError(_0x3194c,null));};exports[_0x8ce9('0xfb')]=function(_0x39dbfa,_0x49812f,_0x35afa6){var _0x3b7dfe={'raw':![],'where':{}};var _0x49c36e={};var _0x134507={'count':0x0,'rows':[]};return db[_0x8ce9('0x58')]['findOne']({'where':{'id':_0x39dbfa[_0x8ce9('0x6a')]['id']}})['then'](handleEntityNotFound(_0x49812f,null))['then'](function(_0x50641a){if(_0x50641a){_0x49c36e[_0x8ce9('0x49')]=_['keys'](db['ChatInteraction'][_0x8ce9('0x45')]);_0x49c36e[_0x8ce9('0x4a')]=_['keys'](_0x39dbfa['query']);_0x49c36e['filters']=_[_0x8ce9('0x4c')](_0x49c36e[_0x8ce9('0x49')],_0x49c36e['query']);_0x3b7dfe[_0x8ce9('0x4e')]=_[_0x8ce9('0x4c')](_0x49c36e[_0x8ce9('0x49')],qs[_0x8ce9('0x4d')](_0x39dbfa[_0x8ce9('0x4a')]['fields']));_0x3b7dfe[_0x8ce9('0x4e')]=_0x3b7dfe[_0x8ce9('0x4e')][_0x8ce9('0x5f')]?_0x3b7dfe[_0x8ce9('0x4e')]:_0x49c36e[_0x8ce9('0x49')];if(!_0x39dbfa[_0x8ce9('0x4a')]['hasOwnProperty'](_0x8ce9('0x50'))){_0x3b7dfe[_0x8ce9('0x51')]=qs[_0x8ce9('0x51')](_0x39dbfa[_0x8ce9('0x4a')][_0x8ce9('0x51')]);_0x3b7dfe['offset']=qs[_0x8ce9('0x35')](_0x39dbfa['query'][_0x8ce9('0x35')]);}_0x3b7dfe[_0x8ce9('0x6d')]=qs[_0x8ce9('0x52')](_0x39dbfa[_0x8ce9('0x4a')][_0x8ce9('0x52')]);_0x3b7dfe[_0x8ce9('0x53')]=qs[_0x8ce9('0x4b')](_[_0x8ce9('0x54')](_0x39dbfa[_0x8ce9('0x4a')],_0x49c36e[_0x8ce9('0x4b')]));_0x3b7dfe['where'][_0x8ce9('0x71')]=_0x50641a['id'];if(_0x39dbfa[_0x8ce9('0x4a')][_0x8ce9('0x55')]){_0x3b7dfe[_0x8ce9('0x53')]=_[_0x8ce9('0x56')](_0x3b7dfe[_0x8ce9('0x53')],{'$or':_[_0x8ce9('0x44')](_0x3b7dfe[_0x8ce9('0x4e')],function(_0x23e868){var _0x33df0a={};_0x33df0a[_0x23e868]={'$like':'%'+_0x39dbfa[_0x8ce9('0x4a')]['filter']+'%'};return _0x33df0a;})});}_0x3b7dfe=_[_0x8ce9('0x56')]({},_0x3b7dfe,_0x39dbfa['options']);return db['ChatInteraction'][_0x8ce9('0x34')]({'where':_0x3b7dfe[_0x8ce9('0x53')]})[_0x8ce9('0x27')](function(_0x5492fb){_0x134507[_0x8ce9('0x34')]=_0x5492fb;if(_0x39dbfa[_0x8ce9('0x4a')][_0x8ce9('0x59')]){_0x3b7dfe[_0x8ce9('0x5a')]=[{'model':db[_0x8ce9('0x92')],'as':_0x8ce9('0xfc'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8ce9('0x40'),_0x8ce9('0xfd'),_0x8ce9('0xfe')],'required':![]},{'model':db['Tag'],'as':_0x8ce9('0xff'),'attributes':['id','name',_0x8ce9('0x100')],'where':_0x39dbfa[_0x8ce9('0x4a')][_0x8ce9('0x101')]?{'id':_0x39dbfa[_0x8ce9('0x4a')]['tag']}:undefined,'required':_0x39dbfa['query'][_0x8ce9('0x101')]?!![]:![]}];}return db[_0x8ce9('0xbd')][_0x8ce9('0x5b')](_0x3b7dfe);})[_0x8ce9('0x27')](function(_0x5475ac){_0x134507['rows']=_0x5475ac;return _0x134507;});}})[_0x8ce9('0x27')](respondWithFilteredResult(_0x49812f,_0x3b7dfe))['catch'](handleError(_0x49812f,null));};function iftimePromise(_0x53f8e7,_0x4629bf){return respondWithRpcPromise(_0x8ce9('0x102'),_0x8ce9('0x103'),{'command':_0x4629bf['timezone']?util[_0x8ce9('0xb6')](_0x8ce9('0x104'),_0x53f8e7[_0x8ce9('0x105')],_0x4629bf[_0x8ce9('0x106')]):util[_0x8ce9('0xb6')](_0x8ce9('0x107'),_0x53f8e7['interval'])},client9002)[_0x8ce9('0x27')](function(_0x5055b5){var _0x5a7f43=_0x5055b5&&_0x5055b5['indexOf'](_0x8ce9('0x108'))>=0x0?!![]:![];logger[_0x8ce9('0x2e')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4629bf['id'],_0x53f8e7['id'],_0x53f8e7[_0x8ce9('0x105')],_0x5a7f43?_0x8ce9('0x109'):_0x8ce9('0x10a'),_0x4629bf[_0x8ce9('0x106')]?_0x4629bf['timezone']:'No\x20timezone');return _0x5a7f43;})[_0x8ce9('0x30')](function(_0x108228){logger[_0x8ce9('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4629bf['id'],_0x53f8e7['id'],_0x53f8e7[_0x8ce9('0x105')],util['inspect'](_0x108228,{'showHidden':![],'depth':null}),_0x4629bf[_0x8ce9('0x106')]?_0x4629bf[_0x8ce9('0x106')]:_0x8ce9('0x10b'));return![];});}exports[_0x8ce9('0x103')]=function(_0x47b6a0,_0x4031bd,_0x2bb3a8){var _0x1db290=0x0;var _0x166322=0x0;var _0x23cbbc=![];var _0x2f5822;var _0x38aeb8;return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'where':{'id':_0x47b6a0[_0x8ce9('0x6a')]['id']},'include':[{'model':db[_0x8ce9('0x10c')],'as':'Interval','include':[{'model':db['Interval'],'as':_0x8ce9('0x10d'),'attributes':['id',_0x8ce9('0x105')],'raw':!![]}]}]})[_0x8ce9('0x27')](handleEntityNotFound(_0x4031bd,null))[_0x8ce9('0x27')](function(_0x9baf4e){if(_0x9baf4e){_0x2f5822=_0x9baf4e;return _0x9baf4e['getProactiveActions']({'raw':!![]});}})[_0x8ce9('0x27')](function(_0x4f3355){if(_0x2f5822){if(_0x4f3355){_0x38aeb8=_0x4f3355;}}return require(_0x8ce9('0x1c'))['getLicense']();})[_0x8ce9('0x27')](function(_0x36a537){if(_0x36a537){_0x166322=_0x36a537[_0x8ce9('0x10e')];_0x23cbbc=_0x36a537['custom'];}})[_0x8ce9('0x27')](function(){return db[_0x8ce9('0xbd')][_0x8ce9('0x34')]({'where':{'closed':![]}});})[_0x8ce9('0x27')](function(_0x4d0af2){_0x1db290=_0x4d0af2;if(_0x166322&&_0x4d0af2>_0x166322){return db[_0x8ce9('0x10f')][_0x8ce9('0x74')]({'where':{'id':0x1}})['then'](function(_0x57e3c1){if(_0x57e3c1){_0x57e3c1[_0x8ce9('0x110')]('chatLicenseExceeded');}});}})[_0x8ce9('0x27')](function(){if(_0x2f5822['Interval']&&_0x2f5822[_0x8ce9('0x10c')][_0x8ce9('0x10d')]){var _0x39afba=[];for(var _0x4423aa=0x0;_0x4423aa<_0x2f5822[_0x8ce9('0x10c')][_0x8ce9('0x10d')][_0x8ce9('0x5f')];_0x4423aa++){var _0x453a95=_0x2f5822[_0x8ce9('0x10c')][_0x8ce9('0x10d')][_0x4423aa][_0x8ce9('0x3b')]({'plain':!![]});_0x39afba[_0x8ce9('0x111')](iftimePromise(_0x453a95,_0x2f5822));}return BPromise[_0x8ce9('0x112')](_0x39afba)[_0x8ce9('0x27')](function(_0x8578a7){return _['some'](_0x8578a7);});}else{return!![];}})[_0x8ce9('0x27')](function(_0x3cd39a){var _0x594276=fs[_0x8ce9('0xd4')](path[_0x8ce9('0x7e')](config[_0x8ce9('0x7f')],'server/files/chat/iframe.js'),_0x8ce9('0xd6'));var _0x4b1316={'remote':_0x2f5822[_0x8ce9('0x113')],'query':querystring[_0x8ce9('0xbb')](_[_0x8ce9('0x56')](_0x2f5822[_0x8ce9('0x3b')]({'plain':!![]}),{'customerIp':_0x47b6a0[_0x8ce9('0x90')][_0x8ce9('0xae')]||_0x47b6a0[_0x8ce9('0x90')][_0x8ce9('0x114')]||_0x47b6a0['connection']['remoteAddress']||_0x47b6a0['ip'],'referer':_0x47b6a0['headers']['referer'],'openedInteractions':_0x1db290,'maxInteractions':_0x166322,'virtual':_0x23cbbc[_0x8ce9('0x10e')],'online':_0x3cd39a,'custom':_0x23cbbc}))[_0x8ce9('0x115')](/'/g,'\x5c\x27')};_0x4031bd[_0x8ce9('0x41')](ejs[_0x8ce9('0x116')](Mustache[_0x8ce9('0x116')](_0x594276,_0x4b1316),{'proactiveActions':_0x38aeb8,'alignment':_0x2f5822[_0x8ce9('0x117')],'verticalAlignment':_0x2f5822[_0x8ce9('0x118')],'div_color':_0x2f5822['color'],'text_color':_0x2f5822[_0x8ce9('0x119')],'button_color':_0x2f5822[_0x8ce9('0x11a')],'background_color':_0x2f5822[_0x8ce9('0x11b')]}));})['catch'](handleError(_0x4031bd,null));};exports[_0x8ce9('0x11c')]=function(_0x5a8cfb,_0x44accd,_0x5512b9){return db['ChatWebsite']['findOne']({'where':{'id':_0x5a8cfb[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x44accd,null))[_0x8ce9('0x27')](function(_0x46b7a4){if(_0x46b7a4){return db[_0x8ce9('0xe1')][_0x8ce9('0xe2')](function(_0x126bce){return db[_0x8ce9('0x11d')][_0x8ce9('0x3e')]({'where':{'ChatWebsiteId':_0x5a8cfb['params']['id']},'transaction':_0x126bce})['then'](function(_0x298f08){var _0x1fbf52=_[_0x8ce9('0x44')](_0x5a8cfb['body'],function(_0x5fe8b5){_0x5fe8b5[_0x8ce9('0x71')]=_0x5a8cfb[_0x8ce9('0x6a')]['id'];return _0x5fe8b5;});return db[_0x8ce9('0x11d')][_0x8ce9('0xe4')](_0x1fbf52,{'transaction':_0x126bce});});})[_0x8ce9('0x27')](function(){return db[_0x8ce9('0x11d')][_0x8ce9('0x11e')]({'where':{'ChatWebsiteId':_0x5a8cfb[_0x8ce9('0x6a')]['id']},'order':_0x8ce9('0xa7')});});}})['then'](respondWithResult(_0x44accd,null))[_0x8ce9('0x30')](handleError(_0x44accd,null));};exports[_0x8ce9('0x11f')]=function(_0x12d8e1,_0x23edcf,_0x4b873c){var _0x5ad86b={};var _0x37e64c={};var _0x13b858;var _0x2e3695;return db[_0x8ce9('0x58')][_0x8ce9('0x74')]({'where':{'id':_0x12d8e1[_0x8ce9('0x6a')]['id']}})['then'](handleEntityNotFound(_0x23edcf,null))[_0x8ce9('0x27')](function(_0x3a34a4){if(_0x3a34a4){_0x13b858=_0x3a34a4;_0x37e64c['model']=_[_0x8ce9('0x5e')](db[_0x8ce9('0x11d')][_0x8ce9('0x45')]);_0x37e64c['query']=_[_0x8ce9('0x5e')](_0x12d8e1['query']);_0x37e64c[_0x8ce9('0x4b')]=_['intersection'](_0x37e64c[_0x8ce9('0x49')],_0x37e64c[_0x8ce9('0x4a')]);_0x5ad86b[_0x8ce9('0x4e')]=_[_0x8ce9('0x4c')](_0x37e64c[_0x8ce9('0x49')],qs[_0x8ce9('0x4d')](_0x12d8e1[_0x8ce9('0x4a')][_0x8ce9('0x4d')]));_0x5ad86b[_0x8ce9('0x4e')]=_0x5ad86b[_0x8ce9('0x4e')][_0x8ce9('0x5f')]?_0x5ad86b[_0x8ce9('0x4e')]:_0x37e64c[_0x8ce9('0x49')];_0x5ad86b[_0x8ce9('0x6d')]=qs['sort'](_0x12d8e1[_0x8ce9('0x4a')][_0x8ce9('0x52')]);_0x5ad86b[_0x8ce9('0x53')]=qs[_0x8ce9('0x4b')](_[_0x8ce9('0x54')](_0x12d8e1['query'],_0x37e64c[_0x8ce9('0x4b')]));if(_0x12d8e1['query'][_0x8ce9('0x55')]){_0x5ad86b[_0x8ce9('0x53')]=_[_0x8ce9('0x56')](_0x5ad86b['where'],{'$or':_['map'](_0x5ad86b[_0x8ce9('0x4e')],function(_0x3b3dea){var _0x218115={};_0x218115[_0x3b3dea]={'$like':'%'+_0x12d8e1['query'][_0x8ce9('0x55')]+'%'};return _0x218115;})});}_0x5ad86b=_['merge']({},_0x5ad86b,_0x12d8e1[_0x8ce9('0x57')]);return _0x13b858[_0x8ce9('0x11f')](_0x5ad86b);}})['then'](function(_0x57a2f0){if(_0x57a2f0){_0x2e3695=_0x57a2f0[_0x8ce9('0x5f')];if(!_0x12d8e1[_0x8ce9('0x4a')]['hasOwnProperty'](_0x8ce9('0x50'))){_0x5ad86b[_0x8ce9('0x51')]=qs[_0x8ce9('0x51')](_0x12d8e1[_0x8ce9('0x4a')]['limit']);_0x5ad86b[_0x8ce9('0x35')]=qs['offset'](_0x12d8e1['query']['offset']);}return _0x13b858[_0x8ce9('0x11f')](_0x5ad86b);}})[_0x8ce9('0x27')](function(_0x2cb4f2){if(_0x2cb4f2){return _0x2cb4f2?{'count':_0x2e3695,'rows':_0x2cb4f2}:null;}})[_0x8ce9('0x27')](respondWithResult(_0x23edcf,null))[_0x8ce9('0x30')](handleError(_0x23edcf,null));};exports[_0x8ce9('0x120')]=function(_0x5686c4,_0x81394e,_0x24b273){return db[_0x8ce9('0x121')][_0x8ce9('0x60')]({'where':{'id':_0x5686c4['params']['id']}})['then'](handleEntityNotFound(_0x81394e,null))[_0x8ce9('0x27')](function(_0x3df061){if(_0x3df061){return _0x3df061[_0x8ce9('0x120')](_0x5686c4[_0x8ce9('0x62')][_0x8ce9('0x6f')],_[_0x8ce9('0xfa')](_0x5686c4[_0x8ce9('0x62')],[_0x8ce9('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x81394e,null))['catch'](handleError(_0x81394e,null));};exports[_0x8ce9('0x122')]=function(_0x3393dd,_0x3801a9,_0x4c05db){var _0x5a9320={};var _0x289952={};var _0x17a86b;var _0x24c621;return db[_0x8ce9('0x58')][_0x8ce9('0x74')]({'where':{'id':_0x3393dd[_0x8ce9('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3801a9,null))[_0x8ce9('0x27')](function(_0x19082e){if(_0x19082e){_0x17a86b=_0x19082e;_0x289952[_0x8ce9('0x49')]=_['keys'](db['ChatProactiveAction'][_0x8ce9('0x45')]);_0x289952[_0x8ce9('0x4a')]=_['keys'](_0x3393dd['query']);_0x289952[_0x8ce9('0x4b')]=_[_0x8ce9('0x4c')](_0x289952[_0x8ce9('0x49')],_0x289952[_0x8ce9('0x4a')]);_0x5a9320[_0x8ce9('0x4e')]=_[_0x8ce9('0x4c')](_0x289952['model'],qs['fields'](_0x3393dd[_0x8ce9('0x4a')][_0x8ce9('0x4d')]));_0x5a9320['attributes']=_0x5a9320['attributes'][_0x8ce9('0x5f')]?_0x5a9320['attributes']:_0x289952[_0x8ce9('0x49')];_0x5a9320[_0x8ce9('0x6d')]=qs[_0x8ce9('0x52')](_0x3393dd[_0x8ce9('0x4a')][_0x8ce9('0x52')]);_0x5a9320[_0x8ce9('0x53')]=qs[_0x8ce9('0x4b')](_[_0x8ce9('0x54')](_0x3393dd['query'],_0x289952[_0x8ce9('0x4b')]));if(_0x3393dd['query'][_0x8ce9('0x55')]){_0x5a9320[_0x8ce9('0x53')]=_[_0x8ce9('0x56')](_0x5a9320[_0x8ce9('0x53')],{'$or':_[_0x8ce9('0x44')](_0x5a9320[_0x8ce9('0x4e')],function(_0x43cd9f){var _0x2d7c1a={};_0x2d7c1a[_0x43cd9f]={'$like':'%'+_0x3393dd['query']['filter']+'%'};return _0x2d7c1a;})});}_0x5a9320=_[_0x8ce9('0x56')]({},_0x5a9320,_0x3393dd[_0x8ce9('0x57')]);return _0x17a86b[_0x8ce9('0x122')](_0x5a9320);}})[_0x8ce9('0x27')](function(_0x2e4c57){if(_0x2e4c57){_0x24c621=_0x2e4c57[_0x8ce9('0x5f')];if(!_0x3393dd[_0x8ce9('0x4a')][_0x8ce9('0x4f')]('nolimit')){_0x5a9320[_0x8ce9('0x51')]=qs[_0x8ce9('0x51')](_0x3393dd[_0x8ce9('0x4a')]['limit']);_0x5a9320[_0x8ce9('0x35')]=qs[_0x8ce9('0x35')](_0x3393dd[_0x8ce9('0x4a')][_0x8ce9('0x35')]);}return _0x17a86b[_0x8ce9('0x122')](_0x5a9320);}})[_0x8ce9('0x27')](function(_0x489a1e){if(_0x489a1e){return _0x489a1e?{'count':_0x24c621,'rows':_0x489a1e}:null;}})[_0x8ce9('0x27')](respondWithResult(_0x3801a9,null))[_0x8ce9('0x30')](handleError(_0x3801a9,null));};exports[_0x8ce9('0x123')]=function(_0x44d5f6,_0x1e475e,_0x4eceaf){var _0x3104de=_0x44d5f6[_0x8ce9('0x4a')][_0x8ce9('0x124')]===_0x8ce9('0x125')?_0x8ce9('0x126'):_0x8ce9('0x127');return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'attributes':['id',_0x3104de],'where':{'id':_0x44d5f6[_0x8ce9('0x6a')]['id']}})['then'](handleEntityNotFound(_0x1e475e,null))[_0x8ce9('0x27')](function(_0x4d9107){if(_0x4d9107){var _0x59ec40=_0x4d9107[_0x3104de];var _0x435cfb=_0x59ec40&&_0x59ec40[_0x8ce9('0x128')]?_0x59ec40[_0x8ce9('0x128')]:[];_0x1e475e['send']({'fromKey':_[_0x8ce9('0x82')](_0x59ec40['fromKey'])?undefined:_0x59ec40['fromKey'],'count':_0x435cfb[_0x8ce9('0x5f')],'rows':_0x435cfb});}})[_0x8ce9('0x30')](handleError(_0x1e475e,null));};exports[_0x8ce9('0x129')]=function(_0x401e88,_0x41faae,_0x960881){var _0x36a0d3={'raw':![],'where':{}};var _0x1ab495={};var _0x494c0c={'count':0x0,'rows':[]};return db[_0x8ce9('0x58')][_0x8ce9('0x74')]({'where':{'id':_0x401e88[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x41faae,null))['then'](function(_0x1ff1d2){if(_0x1ff1d2){_0x1ab495['model']=_['keys'](db['ChatOfflineMessage'][_0x8ce9('0x45')]);_0x1ab495['query']=_['keys'](_0x401e88[_0x8ce9('0x4a')]);_0x1ab495[_0x8ce9('0x4b')]=_[_0x8ce9('0x4c')](_0x1ab495[_0x8ce9('0x49')],_0x1ab495[_0x8ce9('0x4a')]);_0x36a0d3[_0x8ce9('0x4e')]=_['intersection'](_0x1ab495[_0x8ce9('0x49')],qs['fields'](_0x401e88['query'][_0x8ce9('0x4d')]));_0x36a0d3['attributes']=_0x36a0d3[_0x8ce9('0x4e')][_0x8ce9('0x5f')]?_0x36a0d3[_0x8ce9('0x4e')]:_0x1ab495['model'];if(!_0x401e88[_0x8ce9('0x4a')]['hasOwnProperty'](_0x8ce9('0x50'))){_0x36a0d3[_0x8ce9('0x51')]=qs[_0x8ce9('0x51')](_0x401e88[_0x8ce9('0x4a')]['limit']);_0x36a0d3[_0x8ce9('0x35')]=qs['offset'](_0x401e88[_0x8ce9('0x4a')]['offset']);}_0x36a0d3[_0x8ce9('0x6d')]=qs[_0x8ce9('0x52')](_0x401e88[_0x8ce9('0x4a')][_0x8ce9('0x52')]);_0x36a0d3[_0x8ce9('0x53')]=qs[_0x8ce9('0x4b')](_[_0x8ce9('0x54')](_0x401e88[_0x8ce9('0x4a')],_0x1ab495['filters']));_0x36a0d3[_0x8ce9('0x53')][_0x8ce9('0x71')]=_0x1ff1d2['id'];if(_0x401e88[_0x8ce9('0x4a')]['filter']){_0x36a0d3[_0x8ce9('0x53')]=_[_0x8ce9('0x56')](_0x36a0d3[_0x8ce9('0x53')],{'$or':_[_0x8ce9('0x44')](_0x36a0d3['attributes'],function(_0x100e47){var _0x540e70={};_0x540e70[_0x100e47]={'$like':'%'+_0x401e88[_0x8ce9('0x4a')]['filter']+'%'};return _0x540e70;})});}_0x36a0d3=_[_0x8ce9('0x56')]({},_0x36a0d3,_0x401e88[_0x8ce9('0x57')]);return db[_0x8ce9('0xd9')]['count']({'where':_0x36a0d3['where']})[_0x8ce9('0x27')](function(_0x313e40){_0x494c0c[_0x8ce9('0x34')]=_0x313e40;if(_0x401e88[_0x8ce9('0x4a')]['includeAll']){_0x36a0d3['include']=[{'all':!![]}];}else{_0x36a0d3[_0x8ce9('0x5a')]=[{'model':db[_0x8ce9('0x92')],'as':'Contact','required':![]},{'model':db[_0x8ce9('0xe3')],'as':_0x8ce9('0x12a'),'required':![]}];}return db['ChatOfflineMessage'][_0x8ce9('0x5b')](_0x36a0d3);})[_0x8ce9('0x27')](function(_0x4dab3a){_0x494c0c[_0x8ce9('0x5c')]=_0x4dab3a;return _0x494c0c;});}})['then'](respondWithFilteredResult(_0x41faae,_0x36a0d3))['catch'](handleError(_0x41faae,null));};exports['addAgents']=function(_0xe758d9,_0xb508e5,_0xf5b5a3){return db[_0x8ce9('0x58')]['find']({'where':{'id':_0xe758d9[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0xb508e5,null))[_0x8ce9('0x27')](function(_0x1e9b2d){if(_0x1e9b2d){return _0x1e9b2d['addAgents'](_0xe758d9['body']['ids'],_[_0x8ce9('0xfa')](_0xe758d9[_0x8ce9('0x62')],[_0x8ce9('0x6f'),'id'])||{})['spread'](function(_0x56c009){for(var _0xc768b9=0x0;_0xc768b9<_0xe758d9[_0x8ce9('0x62')][_0x8ce9('0x6f')][_0x8ce9('0x5f')];_0xc768b9+=0x1){socket[_0x8ce9('0x12b')](_0x8ce9('0x12c'),{'UserId':_0xe758d9[_0x8ce9('0x62')][_0x8ce9('0x6f')][_0xc768b9],'ChatWebsiteId':_0xe758d9['params']['id']});}return _0x56c009;});}})[_0x8ce9('0x27')](respondWithResult(_0xb508e5,null))[_0x8ce9('0x30')](handleError(_0xb508e5,null));};exports[_0x8ce9('0x12d')]=function(_0x450739,_0x17b550,_0x3451ab){return db[_0x8ce9('0x58')][_0x8ce9('0x60')]({'where':{'id':_0x450739[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x17b550,null))[_0x8ce9('0x27')](function(_0xb6eed2){if(_0xb6eed2){return _0xb6eed2[_0x8ce9('0x12d')](_0x450739[_0x8ce9('0x4a')][_0x8ce9('0x6f')])[_0x8ce9('0x27')](function(){if(_[_0x8ce9('0x12e')](_0x450739[_0x8ce9('0x4a')][_0x8ce9('0x6f')])){for(var _0x437a00=0x0;_0x437a00<_0x450739['query'][_0x8ce9('0x6f')][_0x8ce9('0x5f')];_0x437a00+=0x1){socket[_0x8ce9('0x12b')](_0x8ce9('0x12f'),{'UserId':Number(_0x450739['query'][_0x8ce9('0x6f')][_0x437a00]),'ChatWebsiteId':Number(_0x450739[_0x8ce9('0x6a')]['id'])});}}else{socket[_0x8ce9('0x12b')]('userChatWebsite:remove',{'UserId':Number(_0x450739['query']['ids']),'ChatWebsiteId':Number(_0x450739['params']['id'])});}});}})[_0x8ce9('0x27')](respondWithStatusCode(_0x17b550,null))['catch'](handleError(_0x17b550,null));};exports[_0x8ce9('0x130')]=function(_0x3438f5,_0x2bf0a9,_0x4775ec){var _0x346e0e={};var _0x104e36={};var _0x151233;var _0x15d683;return db[_0x8ce9('0x58')][_0x8ce9('0x74')]({'where':{'id':_0x3438f5[_0x8ce9('0x6a')]['id']}})[_0x8ce9('0x27')](handleEntityNotFound(_0x2bf0a9,null))['then'](function(_0x3c39cd){if(_0x3c39cd){_0x151233=_0x3c39cd;_0x104e36[_0x8ce9('0x49')]=_['keys'](db['User'][_0x8ce9('0x45')]);_0x104e36['query']=_['keys'](_0x3438f5['query']);_0x104e36[_0x8ce9('0x4b')]=_[_0x8ce9('0x4c')](_0x104e36[_0x8ce9('0x49')],_0x104e36[_0x8ce9('0x4a')]);_0x346e0e['attributes']=_[_0x8ce9('0x4c')](_0x104e36['model'],qs[_0x8ce9('0x4d')](_0x3438f5['query']['fields']));_0x346e0e[_0x8ce9('0x4e')]=_0x346e0e[_0x8ce9('0x4e')][_0x8ce9('0x5f')]?_0x346e0e[_0x8ce9('0x4e')]:_0x104e36[_0x8ce9('0x49')];_0x346e0e[_0x8ce9('0x6d')]=qs[_0x8ce9('0x52')](_0x3438f5[_0x8ce9('0x4a')]['sort']);_0x346e0e[_0x8ce9('0x53')]=qs['filters'](_['pick'](_0x3438f5['query'],_0x104e36[_0x8ce9('0x4b')]));if(_0x3438f5[_0x8ce9('0x4a')]['filter']){_0x346e0e[_0x8ce9('0x53')]=_['merge'](_0x346e0e[_0x8ce9('0x53')],{'$or':_[_0x8ce9('0x44')](_0x346e0e[_0x8ce9('0x4e')],function(_0x572237){var _0x2409c8={};_0x2409c8[_0x572237]={'$like':'%'+_0x3438f5[_0x8ce9('0x4a')][_0x8ce9('0x55')]+'%'};return _0x2409c8;})});}_0x346e0e=_[_0x8ce9('0x56')]({},_0x346e0e,_0x3438f5['options']);return _0x151233[_0x8ce9('0x130')](_0x346e0e);}})[_0x8ce9('0x27')](function(_0x2f4571){if(_0x2f4571){_0x15d683=_0x2f4571[_0x8ce9('0x5f')];if(!_0x3438f5[_0x8ce9('0x4a')][_0x8ce9('0x4f')]('nolimit')){_0x346e0e[_0x8ce9('0x51')]=qs[_0x8ce9('0x51')](_0x3438f5[_0x8ce9('0x4a')][_0x8ce9('0x51')]);_0x346e0e['offset']=qs[_0x8ce9('0x35')](_0x3438f5[_0x8ce9('0x4a')]['offset']);}return _0x151233[_0x8ce9('0x130')](_0x346e0e);}})[_0x8ce9('0x27')](function(_0x10a328){if(_0x10a328){return _0x10a328?{'count':_0x15d683,'rows':_0x10a328}:null;}})[_0x8ce9('0x27')](respondWithResult(_0x2bf0a9,null))[_0x8ce9('0x30')](handleError(_0x2bf0a9,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a86a714..3da126f 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 _0x0eab=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x2bd4e3,_0x4d9b53){var _0x259f7c=function(_0x419754){while(--_0x419754){_0x2bd4e3['push'](_0x2bd4e3['shift']());}};_0x259f7c(++_0x4d9b53);}(_0x0eab,0x1d4));var _0xb0ea=function(_0x3c476e,_0x461a4f){_0x3c476e=_0x3c476e-0x0;var _0x496ada=_0x0eab[_0x3c476e];return _0x496ada;};'use strict';var EventEmitter=require(_0xb0ea('0x0'));var ChatWebsite=require(_0xb0ea('0x1'))['db'][_0xb0ea('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb0ea('0x3')](0x0);var events={'afterCreate':_0xb0ea('0x4'),'afterUpdate':_0xb0ea('0x5'),'afterDestroy':_0xb0ea('0x6')};function emitEvent(_0x298787){return function(_0x24a827,_0x663143,_0x4dff80){ChatWebsiteEvents[_0xb0ea('0x7')](_0x298787+':'+_0x24a827['id'],_0x24a827);ChatWebsiteEvents[_0xb0ea('0x7')](_0x298787,_0x24a827);_0x4dff80(null);};}for(var e in events){if(events[_0xb0ea('0x8')](e)){var event=events[e];ChatWebsite[_0xb0ea('0x9')](e,emitEvent(event));}}module[_0xb0ea('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x44e8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5748f0,_0x396c91){var _0x4461c5=function(_0x1b884b){while(--_0x1b884b){_0x5748f0['push'](_0x5748f0['shift']());}};_0x4461c5(++_0x396c91);}(_0x44e8,0xd7));var _0x844e=function(_0x404287,_0x47fc4d){_0x404287=_0x404287-0x0;var _0x57f8ad=_0x44e8[_0x404287];return _0x57f8ad;};'use strict';var EventEmitter=require(_0x844e('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x844e('0x1')](0x0);var events={'afterCreate':_0x844e('0x2'),'afterUpdate':_0x844e('0x3'),'afterDestroy':_0x844e('0x4')};function emitEvent(_0x49ce1b){return function(_0x3a8b3c,_0x167368,_0x2c8b9e){ChatWebsiteEvents[_0x844e('0x5')](_0x49ce1b+':'+_0x3a8b3c['id'],_0x3a8b3c);ChatWebsiteEvents['emit'](_0x49ce1b,_0x3a8b3c);_0x2c8b9e(null);};}for(var e in events){if(events[_0x844e('0x6')](e)){var event=events[e];ChatWebsite[_0x844e('0x7')](e,emitEvent(event));}}module[_0x844e('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 6d2811e..7f16ee5 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 _0x24cf=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','../../config/logger'];(function(_0x108e34,_0x354a75){var _0x377bf0=function(_0x3d60a6){while(--_0x3d60a6){_0x108e34['push'](_0x108e34['shift']());}};_0x377bf0(++_0x354a75);}(_0x24cf,0x1d5));var _0xf24c=function(_0xfec86a,_0x4e774){_0xfec86a=_0xfec86a-0x0;var _0x516dbd=_0x24cf[_0xfec86a];return _0x516dbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf24c('0x0'))(_0xf24c('0x1'));var moment=require(_0xf24c('0x2'));var BPromise=require(_0xf24c('0x3'));var rp=require(_0xf24c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf24c('0x5'));var config=require(_0xf24c('0x6'));var attributes=require(_0xf24c('0x7'));module[_0xf24c('0x8')]=function(_0x5c4ebc,_0x4983e2){return _0x5c4ebc['define'](_0xf24c('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9aea=['ChatWebsite','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x9aea,0xdd));var _0xa9ae=function(_0x231975,_0x4004cc){_0x231975=_0x231975-0x0;var _0x17f796=_0x9aea[_0x231975];return _0x17f796;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var logger=require(_0xa9ae('0x1'))('api');var moment=require(_0xa9ae('0x2'));var BPromise=require(_0xa9ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9ae('0x4'));var rimraf=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var attributes=require(_0xa9ae('0x7'));module[_0xa9ae('0x8')]=function(_0x56f942,_0x1aa3b9){return _0x56f942[_0xa9ae('0x9')](_0xa9ae('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 049ecde..4ad5ff8 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 _0xacf4=['stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','request','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5721c4,_0x2ffbd4){var _0x597a5f=function(_0x2387a5){while(--_0x2387a5){_0x5721c4['push'](_0x5721c4['shift']());}};_0x597a5f(++_0x2ffbd4);}(_0xacf4,0xe7));var _0x4acf=function(_0x560a6d,_0x42c234){_0x560a6d=_0x560a6d-0x0;var _0x4b29aa=_0xacf4[_0x560a6d];return _0x4b29aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});config[_0x4acf('0xa')]=_[_0x4acf('0xb')](config[_0x4acf('0xa')],{'host':_0x4acf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4acf('0xd'))['register'](socket);function respondWithRpcPromise(_0x425c8d,_0x2c2cb4,_0x3e9ddd){return new BPromise(function(_0x4ff233,_0x290ca7){return client[_0x4acf('0xe')](_0x425c8d,_0x3e9ddd)['then'](function(_0x5f22d9){logger[_0x4acf('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x2c2cb4,'request\x20sent');logger[_0x4acf('0x10')](_0x4acf('0x11'),_0x2c2cb4,_0x4acf('0x12'),JSON[_0x4acf('0x13')](_0x5f22d9));if(_0x5f22d9[_0x4acf('0x14')]){if(_0x5f22d9[_0x4acf('0x14')][_0x4acf('0x15')]===0x1f4){logger[_0x4acf('0x14')](_0x4acf('0x16'),_0x2c2cb4,_0x5f22d9[_0x4acf('0x14')][_0x4acf('0x17')]);return _0x290ca7(_0x5f22d9['error'][_0x4acf('0x17')]);}logger['error'](_0x4acf('0x16'),_0x2c2cb4,_0x5f22d9[_0x4acf('0x14')][_0x4acf('0x17')]);return _0x4ff233(_0x5f22d9['error']['message']);}else{logger[_0x4acf('0xf')](_0x4acf('0x16'),_0x2c2cb4,_0x4acf('0x12'));_0x4ff233(_0x5f22d9['result'][_0x4acf('0x17')]);}})[_0x4acf('0x18')](function(_0x30d289){logger[_0x4acf('0x14')](_0x4acf('0x16'),_0x2c2cb4,_0x30d289);_0x290ca7(_0x30d289);});});} \ No newline at end of file +var _0xfcf0=['ChatWebsite,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x591896,_0x386bac){var _0x5eaa48=function(_0x10ca6a){while(--_0x10ca6a){_0x591896['push'](_0x591896['shift']());}};_0x5eaa48(++_0x386bac);}(_0xfcf0,0x138));var _0x0fcf=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xfcf0[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});config[_0x0fcf('0xc')]=_[_0x0fcf('0xd')](config['redis'],{'host':_0x0fcf('0xe'),'port':0x18eb});var socket=require(_0x0fcf('0xf'))(new Redis(config[_0x0fcf('0xc')]));require('./chatWebsite.socket')[_0x0fcf('0x10')](socket);function respondWithRpcPromise(_0x7ac7bd,_0x239e5d,_0x4b3923){return new BPromise(function(_0x369959,_0x5c29ed){return client[_0x0fcf('0x11')](_0x7ac7bd,_0x4b3923)[_0x0fcf('0x12')](function(_0x201a58){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'));logger[_0x0fcf('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'),JSON[_0x0fcf('0x15')](_0x201a58));if(_0x201a58[_0x0fcf('0x16')]){if(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x17')]===0x1f4){logger['error'](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);return _0x5c29ed(_0x201a58['error'][_0x0fcf('0x19')]);}logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')]['message']);return _0x369959(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);}else{logger[_0x0fcf('0x1a')](_0x0fcf('0x18'),_0x239e5d,_0x0fcf('0x13'));_0x369959(_0x201a58['result'][_0x0fcf('0x19')]);}})[_0x0fcf('0x1b')](function(_0x5dad87){logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x5dad87);_0x5c29ed(_0x5dad87);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 27ced53..9312178 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(_0x51aacb,_0x161cce){var _0x388010=function(_0x4daacd){while(--_0x4daacd){_0x51aacb['push'](_0x51aacb['shift']());}};_0x388010(++_0x161cce);}(_0x7a54,0x106));var _0x47a5=function(_0x15d209,_0x5d90d3){_0x15d209=_0x15d209-0x0;var _0x27897d=_0x7a54[_0x15d209];return _0x27897d;};'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(_0xac3328,_0x23745a){var _0x33aec4=function(_0x476d1a){while(--_0x476d1a){_0xac3328['push'](_0xac3328['shift']());}};_0x33aec4(++_0x23745a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34fc54,_0x26afaf){_0x34fc54=_0x34fc54-0x0;var _0x4554a4=_0x5f2f[_0x34fc54];return _0x4554a4;};'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 1dff8ae..237551f 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 _0xa9e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','format','%s-%s','originalname','file','addLogo','now','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','extname','replace','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeAnswers','removeAgents','multer'];(function(_0xb39895,_0x2d22d4){var _0x286310=function(_0x4eb58e){while(--_0x4eb58e){_0xb39895['push'](_0xb39895['shift']());}};_0x286310(++_0x2d22d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x8')]('/:id/customer_avatar',controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x8')](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['get'](_0x0a9e('0x18'),controller['getSnippet']);router[_0x0a9e('0x8')](_0x0a9e('0x19'),auth['isAuthenticated'](),controller[_0x0a9e('0x1a')]);router['get'](_0x0a9e('0x1b'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x8')](_0x0a9e('0x1d'),controller[_0x0a9e('0x1e')]);router[_0x0a9e('0x8')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x8')](_0x0a9e('0x21'),auth['isAuthenticated'](),controller[_0x0a9e('0x22')]);router[_0x0a9e('0x23')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['post']('/:id/dispositions',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x23')](_0x0a9e('0x26'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x3b45bc,_0x4d00e6,_0x370d86){_0x370d86(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],'server/files/images/logos/'));},'filename':function(_0x59181e,_0x197ec0,_0x3a8e58){_0x3a8e58(null,util[_0x0a9e('0x2b')](_0x0a9e('0x2c'),Date['now'](),_0x197ec0[_0x0a9e('0x2d')]));}})});router['post'](_0x0a9e('0xf'),upload['single'](_0x0a9e('0x2e')),controller[_0x0a9e('0x2f')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x14433c,_0x140511,_0x1538a4){_0x1538a4(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,util[_0x0a9e('0x2b')]('%s-%s',Date[_0x0a9e('0x30')](),_0x468813[_0x0a9e('0x2d')]));}})});router[_0x0a9e('0x23')](_0x0a9e('0x11'),upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x32')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x1dbde2,_0x540530,_0x426950){_0x426950(null,path['join'](config[_0x0a9e('0x2a')],_0x0a9e('0x33')));},'filename':function(_0x1122db,_0x33bdb7,_0x25ce3a){_0x25ce3a(null,util['format'](_0x0a9e('0x2c'),Date[_0x0a9e('0x30')](),_0x33bdb7[_0x0a9e('0x2d')]));}})});router[_0x0a9e('0x23')](_0x0a9e('0x34'),upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44295a,_0x5e7238,_0x2cc7a0){_0x2cc7a0(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],_0x0a9e('0x33')));},'filename':function(_0x567193,_0x191e91,_0xd1836d){_0xd1836d(null,util[_0x0a9e('0x2b')](_0x0a9e('0x2c'),Date['now'](),_0x191e91['originalname']));}})});router[_0x0a9e('0x23')]('/:id/system_avatar',upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x36')]);router[_0x0a9e('0x23')]('/:id/notify',controller[_0x0a9e('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x3cae,_0x533942,_0x1dbf74){const _0x1a180b=path[_0x0a9e('0x29')](config['root'],'server/files',_0x0a9e('0x38'),_0x0a9e('0x39'));fs_extra['ensureDir'](_0x1a180b,function(){_0x1dbf74(null,_0x1a180b);});},'filename':function(_0x2b814e,_0x419125,_0x2e1b3a){const _0x148f55=_0x419125['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x15e37d=path[_0x0a9e('0x3a')](_0x148f55);const _0x53f3ee=Date[_0x0a9e('0x30')]()+'-'+_0x148f55[_0x0a9e('0x3b')](_0x15e37d,'')+_0x15e37d;_0x2e1b3a(null,_0x53f3ee);}})});router[_0x0a9e('0x23')]('/:id/offline',offlineUploadMulter[_0x0a9e('0x3c')](),controller[_0x0a9e('0x3d')]);router[_0x0a9e('0x23')](_0x0a9e('0x16'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x3e')]);router[_0x0a9e('0x23')](_0x0a9e('0x19'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x3f')]);router[_0x0a9e('0x23')](_0x0a9e('0x1b'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x40')]);router[_0x0a9e('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x0a9e('0x41')]);router[_0x0a9e('0x42')](_0x0a9e('0x43'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x44')]);router[_0x0a9e('0x45')](_0x0a9e('0x43'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x46')]);router[_0x0a9e('0x45')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller['removeDispositions']);router[_0x0a9e('0x45')](_0x0a9e('0x26'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x47')]);router[_0x0a9e('0x45')](_0x0a9e('0x21'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x48')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','format','%s-%s','originalname','file','addLogo','now','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','extname','replace','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeAnswers','removeAgents','multer'];(function(_0x179bb4,_0x5d7c33){var _0x407ab4=function(_0x2140ea){while(--_0x2140ea){_0x179bb4['push'](_0x179bb4['shift']());}};_0x407ab4(++_0x5d7c33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x8')]('/:id/customer_avatar',controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x8')](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['get'](_0x0a9e('0x18'),controller['getSnippet']);router[_0x0a9e('0x8')](_0x0a9e('0x19'),auth['isAuthenticated'](),controller[_0x0a9e('0x1a')]);router['get'](_0x0a9e('0x1b'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x8')](_0x0a9e('0x1d'),controller[_0x0a9e('0x1e')]);router[_0x0a9e('0x8')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x8')](_0x0a9e('0x21'),auth['isAuthenticated'](),controller[_0x0a9e('0x22')]);router[_0x0a9e('0x23')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['post']('/:id/dispositions',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x23')](_0x0a9e('0x26'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x3b45bc,_0x4d00e6,_0x370d86){_0x370d86(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],'server/files/images/logos/'));},'filename':function(_0x59181e,_0x197ec0,_0x3a8e58){_0x3a8e58(null,util[_0x0a9e('0x2b')](_0x0a9e('0x2c'),Date['now'](),_0x197ec0[_0x0a9e('0x2d')]));}})});router['post'](_0x0a9e('0xf'),upload['single'](_0x0a9e('0x2e')),controller[_0x0a9e('0x2f')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x14433c,_0x140511,_0x1538a4){_0x1538a4(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,util[_0x0a9e('0x2b')]('%s-%s',Date[_0x0a9e('0x30')](),_0x468813[_0x0a9e('0x2d')]));}})});router[_0x0a9e('0x23')](_0x0a9e('0x11'),upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x32')]);var upload=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x1dbde2,_0x540530,_0x426950){_0x426950(null,path['join'](config[_0x0a9e('0x2a')],_0x0a9e('0x33')));},'filename':function(_0x1122db,_0x33bdb7,_0x25ce3a){_0x25ce3a(null,util['format'](_0x0a9e('0x2c'),Date[_0x0a9e('0x30')](),_0x33bdb7[_0x0a9e('0x2d')]));}})});router[_0x0a9e('0x23')](_0x0a9e('0x34'),upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44295a,_0x5e7238,_0x2cc7a0){_0x2cc7a0(null,path[_0x0a9e('0x29')](config[_0x0a9e('0x2a')],_0x0a9e('0x33')));},'filename':function(_0x567193,_0x191e91,_0xd1836d){_0xd1836d(null,util[_0x0a9e('0x2b')](_0x0a9e('0x2c'),Date['now'](),_0x191e91['originalname']));}})});router[_0x0a9e('0x23')]('/:id/system_avatar',upload[_0x0a9e('0x31')](_0x0a9e('0x2e')),controller[_0x0a9e('0x36')]);router[_0x0a9e('0x23')]('/:id/notify',controller[_0x0a9e('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x0a9e('0x28')]({'destination':function(_0x3cae,_0x533942,_0x1dbf74){const _0x1a180b=path[_0x0a9e('0x29')](config['root'],'server/files',_0x0a9e('0x38'),_0x0a9e('0x39'));fs_extra['ensureDir'](_0x1a180b,function(){_0x1dbf74(null,_0x1a180b);});},'filename':function(_0x2b814e,_0x419125,_0x2e1b3a){const _0x148f55=_0x419125['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x15e37d=path[_0x0a9e('0x3a')](_0x148f55);const _0x53f3ee=Date[_0x0a9e('0x30')]()+'-'+_0x148f55[_0x0a9e('0x3b')](_0x15e37d,'')+_0x15e37d;_0x2e1b3a(null,_0x53f3ee);}})});router[_0x0a9e('0x23')]('/:id/offline',offlineUploadMulter[_0x0a9e('0x3c')](),controller[_0x0a9e('0x3d')]);router[_0x0a9e('0x23')](_0x0a9e('0x16'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x3e')]);router[_0x0a9e('0x23')](_0x0a9e('0x19'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x3f')]);router[_0x0a9e('0x23')](_0x0a9e('0x1b'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x40')]);router[_0x0a9e('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x0a9e('0x41')]);router[_0x0a9e('0x42')](_0x0a9e('0x43'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x44')]);router[_0x0a9e('0x45')](_0x0a9e('0x43'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x46')]);router[_0x0a9e('0x45')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller['removeDispositions']);router[_0x0a9e('0x45')](_0x0a9e('0x26'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x47')]);router[_0x0a9e('0x45')](_0x0a9e('0x21'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x48')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c110ace..c6978b8 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 _0x9fd4=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x28bad6,_0x2c3ed3){var _0x53c6f1=function(_0x1e3c6a){while(--_0x1e3c6a){_0x28bad6['push'](_0x28bad6['shift']());}};_0x53c6f1(++_0x2c3ed3);}(_0x9fd4,0x16c));var _0x49fd=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x9fd4[_0x2b5b44];return _0x32cb66;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x4'),_0x49fd('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x49fd('0x2')]},'data2':{'type':Sequelize[_0x49fd('0x2')]}}; \ No newline at end of file +var _0xc9c3=['STRING','AmazonAWS','Google'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0xc9c3,0x96));var _0x3c9c=function(_0x145569,_0x54da3e){_0x145569=_0x145569-0x0;var _0x1da7ab=_0xc9c3[_0x145569];return _0x1da7ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3c9c('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x3c9c('0x1'),_0x3c9c('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3c9c('0x0')]},'data2':{'type':Sequelize[_0x3c9c('0x0')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 04a3629..9439a57 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 _0x3c6c=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x685cab,_0x1179e6){var _0x4c62de=function(_0x29908a){while(--_0x29908a){_0x685cab['push'](_0x685cab['shift']());}};_0x4c62de(++_0x1179e6);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x2b82cc,_0xeb3e84){_0x2b82cc=_0x2b82cc-0x0;var _0xecc88e=_0x3c6c[_0x2b82cc];return _0xecc88e;};'use strict';var pdf=require(_0xc3c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc3c6('0x1'));var zipdir=require(_0xc3c6('0x2'));var jsonpatch=require(_0xc3c6('0x3'));var rp=require(_0xc3c6('0x4'));var moment=require(_0xc3c6('0x5'));var BPromise=require(_0xc3c6('0x6'));var Mustache=require(_0xc3c6('0x7'));var util=require(_0xc3c6('0x8'));var path=require('path');var sox=require(_0xc3c6('0x9'));var csv=require('to-csv');var ejs=require(_0xc3c6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc3c6('0xb'));var toCsv=require(_0xc3c6('0xc'));var querystring=require('querystring');var Papa=require(_0xc3c6('0xd'));var Redis=require(_0xc3c6('0xe'));var authService=require(_0xc3c6('0xf'));var qs=require(_0xc3c6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3c6('0x11'));var logger=require(_0xc3c6('0x12'))(_0xc3c6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc3c6('0x14'));var db=require(_0xc3c6('0x15'))['db'];function respondWithStatusCode(_0x1d18e3,_0x648a0){_0x648a0=_0x648a0||0xcc;return function(_0x406fea){if(_0x406fea){return _0x1d18e3[_0xc3c6('0x16')](_0x648a0);}return _0x1d18e3[_0xc3c6('0x17')](_0x648a0)[_0xc3c6('0x18')]();};}function respondWithResult(_0x34eeeb,_0x55c1d8){_0x55c1d8=_0x55c1d8||0xc8;return function(_0x5e42b8){if(_0x5e42b8){return _0x34eeeb[_0xc3c6('0x17')](_0x55c1d8)[_0xc3c6('0x19')](_0x5e42b8);}};}function respondWithFilteredResult(_0x25d2bd,_0x283506){return function(_0x42c631){if(_0x42c631){var _0x32c52f=_0x42c631[_0xc3c6('0x1a')],_0x181b3b=_0x283506[_0xc3c6('0x1b')],_0x33920c=_0x283506[_0xc3c6('0x1b')]+_0x283506[_0xc3c6('0x1c')],_0x2d4b3d;if(_0x33920c>=_0x32c52f){_0x33920c=_0x32c52f;_0x2d4b3d=0xc8;}else{_0x2d4b3d=0xce;}_0x25d2bd[_0xc3c6('0x17')](_0x2d4b3d);return _0x25d2bd[_0xc3c6('0x1d')]('Content-Range',_0x181b3b+'-'+_0x33920c+'/'+_0x32c52f)[_0xc3c6('0x19')](_0x42c631);}return null;};}function patchUpdates(_0x5a2456){return function(_0x2150e0){try{jsonpatch[_0xc3c6('0x1e')](_0x2150e0,_0x5a2456,!![]);}catch(_0x3893c4){return BPromise[_0xc3c6('0x1f')](_0x3893c4);}return _0x2150e0[_0xc3c6('0x20')]();};}function saveUpdates(_0x3490a2,_0x22d170){return function(_0x22aa76){if(_0x22aa76){return _0x22aa76[_0xc3c6('0x21')](_0x3490a2)[_0xc3c6('0x22')](function(_0x2a99a0){return _0x2a99a0;});}return null;};}function removeEntity(_0x392d20,_0x3d03b0){return function(_0x3efde4){if(_0x3efde4){return _0x3efde4['destroy']()[_0xc3c6('0x22')](function(){_0x392d20[_0xc3c6('0x17')](0xcc)[_0xc3c6('0x18')]();});}};}function handleEntityNotFound(_0x565a86,_0x3eab18){return function(_0x42438d){if(!_0x42438d){_0x565a86[_0xc3c6('0x16')](0x194);}return _0x42438d;};}function handleError(_0xfc19be,_0x2bc9bf){_0x2bc9bf=_0x2bc9bf||0x1f4;return function(_0x47808f){logger[_0xc3c6('0x23')](_0x47808f['stack']);if(_0x47808f[_0xc3c6('0x24')]){delete _0x47808f[_0xc3c6('0x24')];}_0xfc19be['status'](_0x2bc9bf)[_0xc3c6('0x25')](_0x47808f);};}exports[_0xc3c6('0x26')]=function(_0x1457f7,_0xdad009){var _0x312539={},_0x420723={},_0x2b1ae0={'count':0x0,'rows':[]};var _0x2e4094=_[_0xc3c6('0x27')](db['CloudProvider'][_0xc3c6('0x28')],function(_0x4571f4){return{'name':_0x4571f4[_0xc3c6('0x29')],'type':_0x4571f4[_0xc3c6('0x2a')]['key']};});_0x420723[_0xc3c6('0x2b')]=_[_0xc3c6('0x27')](_0x2e4094,_0xc3c6('0x24'));_0x420723[_0xc3c6('0x2c')]=_[_0xc3c6('0x2d')](_0x1457f7[_0xc3c6('0x2c')]);_0x420723['filters']=_[_0xc3c6('0x2e')](_0x420723[_0xc3c6('0x2b')],_0x420723[_0xc3c6('0x2c')]);_0x312539[_0xc3c6('0x2f')]=_[_0xc3c6('0x2e')](_0x420723['model'],qs[_0xc3c6('0x30')](_0x1457f7[_0xc3c6('0x2c')][_0xc3c6('0x30')]));_0x312539[_0xc3c6('0x2f')]=_0x312539[_0xc3c6('0x2f')][_0xc3c6('0x31')]?_0x312539[_0xc3c6('0x2f')]:_0x420723['model'];if(!_0x1457f7[_0xc3c6('0x2c')]['hasOwnProperty'](_0xc3c6('0x32'))){_0x312539[_0xc3c6('0x1c')]=qs[_0xc3c6('0x1c')](_0x1457f7[_0xc3c6('0x2c')][_0xc3c6('0x1c')]);_0x312539[_0xc3c6('0x1b')]=qs['offset'](_0x1457f7[_0xc3c6('0x2c')][_0xc3c6('0x1b')]);}_0x312539['order']=qs[_0xc3c6('0x33')](_0x1457f7[_0xc3c6('0x2c')][_0xc3c6('0x33')]);_0x312539[_0xc3c6('0x34')]=qs[_0xc3c6('0x35')](_[_0xc3c6('0x36')](_0x1457f7[_0xc3c6('0x2c')],_0x420723['filters']),_0x2e4094);if(_0x1457f7['query'][_0xc3c6('0x37')]){_0x312539[_0xc3c6('0x34')]=_[_0xc3c6('0x38')](_0x312539[_0xc3c6('0x34')],{'$or':_[_0xc3c6('0x27')](_0x2e4094,function(_0x5cbbe3){if(_0x5cbbe3[_0xc3c6('0x2a')]!==_0xc3c6('0x39')){var _0x359ea4={};_0x359ea4[_0x5cbbe3[_0xc3c6('0x24')]]={'$like':'%'+_0x1457f7[_0xc3c6('0x2c')][_0xc3c6('0x37')]+'%'};return _0x359ea4;}})});}_0x312539=_[_0xc3c6('0x38')]({},_0x312539,_0x1457f7[_0xc3c6('0x3a')]);var _0x1cb060={'where':_0x312539['where']};return db[_0xc3c6('0x3b')][_0xc3c6('0x1a')](_0x1cb060)[_0xc3c6('0x22')](function(_0x316605){_0x2b1ae0[_0xc3c6('0x1a')]=_0x316605;if(_0x1457f7[_0xc3c6('0x2c')][_0xc3c6('0x3c')]){_0x312539[_0xc3c6('0x3d')]=[{'all':!![]}];}return db['CloudProvider'][_0xc3c6('0x3e')](_0x312539);})[_0xc3c6('0x22')](function(_0x58cba4){_0x2b1ae0[_0xc3c6('0x3f')]=_0x58cba4;return _0x2b1ae0;})['then'](respondWithFilteredResult(_0xdad009,_0x312539))[_0xc3c6('0x40')](handleError(_0xdad009,null));};exports[_0xc3c6('0x41')]=function(_0x25bb1e,_0x1bc4fa){var _0x205bbd={'raw':!![],'where':{'id':_0x25bb1e[_0xc3c6('0x42')]['id']}},_0x21f736={};_0x21f736[_0xc3c6('0x2b')]=_['keys'](db[_0xc3c6('0x3b')]['rawAttributes']);_0x21f736[_0xc3c6('0x2c')]=_[_0xc3c6('0x2d')](_0x25bb1e[_0xc3c6('0x2c')]);_0x21f736[_0xc3c6('0x35')]=_['intersection'](_0x21f736['model'],_0x21f736[_0xc3c6('0x2c')]);_0x205bbd[_0xc3c6('0x2f')]=_[_0xc3c6('0x2e')](_0x21f736[_0xc3c6('0x2b')],qs['fields'](_0x25bb1e[_0xc3c6('0x2c')][_0xc3c6('0x30')]));_0x205bbd[_0xc3c6('0x2f')]=_0x205bbd[_0xc3c6('0x2f')][_0xc3c6('0x31')]?_0x205bbd[_0xc3c6('0x2f')]:_0x21f736[_0xc3c6('0x2b')];if(_0x25bb1e['query']['includeAll']){_0x205bbd[_0xc3c6('0x3d')]=[{'all':!![]}];}_0x205bbd=_[_0xc3c6('0x38')]({},_0x205bbd,_0x25bb1e['options']);return db[_0xc3c6('0x3b')][_0xc3c6('0x43')](_0x205bbd)['then'](handleEntityNotFound(_0x1bc4fa,null))[_0xc3c6('0x22')](respondWithResult(_0x1bc4fa,null))[_0xc3c6('0x40')](handleError(_0x1bc4fa,null));};exports['create']=function(_0x227db0,_0xb3122b){return db[_0xc3c6('0x3b')][_0xc3c6('0x44')](_0x227db0[_0xc3c6('0x45')],{})[_0xc3c6('0x22')](respondWithResult(_0xb3122b,0xc9))[_0xc3c6('0x40')](handleError(_0xb3122b,null));};exports[_0xc3c6('0x21')]=function(_0x432f43,_0x3d58f7){if(_0x432f43[_0xc3c6('0x45')]['id']){delete _0x432f43[_0xc3c6('0x45')]['id'];}return db[_0xc3c6('0x3b')][_0xc3c6('0x43')]({'where':{'id':_0x432f43['params']['id']}})['then'](handleEntityNotFound(_0x3d58f7,null))[_0xc3c6('0x22')](saveUpdates(_0x432f43[_0xc3c6('0x45')],null))[_0xc3c6('0x22')](respondWithResult(_0x3d58f7,null))[_0xc3c6('0x40')](handleError(_0x3d58f7,null));};exports['destroy']=function(_0x564177,_0x13e4d9){return db[_0xc3c6('0x3b')][_0xc3c6('0x43')]({'where':{'id':_0x564177[_0xc3c6('0x42')]['id']}})[_0xc3c6('0x22')](handleEntityNotFound(_0x13e4d9,null))[_0xc3c6('0x22')](removeEntity(_0x13e4d9,null))[_0xc3c6('0x40')](handleError(_0x13e4d9,null));}; \ No newline at end of file +var _0xfb67=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','json','count','offset','limit','set','Content-Range','apply','update','status','error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','options','includeAll','include','findAll','then','rows','show','params','merge','find','create','body','catch','destroy','html-pdf'];(function(_0x5b0bee,_0x307c2e){var _0x56d9c1=function(_0x3efe75){while(--_0x3efe75){_0x5b0bee['push'](_0x5b0bee['shift']());}};_0x56d9c1(++_0x307c2e);}(_0xfb67,0xdd));var _0x7fb6=function(_0x5b091a,_0x338bdb){_0x5b091a=_0x5b091a-0x0;var _0x34edb6=_0xfb67[_0x5b091a];return _0x34edb6;};'use strict';var pdf=require(_0x7fb6('0x0'));var emlformat=require(_0x7fb6('0x1'));var rimraf=require(_0x7fb6('0x2'));var zipdir=require(_0x7fb6('0x3'));var jsonpatch=require(_0x7fb6('0x4'));var rp=require(_0x7fb6('0x5'));var moment=require(_0x7fb6('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7fb6('0x7'));var util=require(_0x7fb6('0x8'));var path=require(_0x7fb6('0x9'));var sox=require(_0x7fb6('0xa'));var csv=require(_0x7fb6('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fb6('0xc'));var _=require(_0x7fb6('0xd'));var squel=require(_0x7fb6('0xe'));var crypto=require('crypto');var jsforce=require(_0x7fb6('0xf'));var deskjs=require(_0x7fb6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7fb6('0x11'));var Papa=require(_0x7fb6('0x12'));var Redis=require(_0x7fb6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7fb6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fb6('0x15'));var logger=require(_0x7fb6('0x16'))(_0x7fb6('0x17'));var utils=require(_0x7fb6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7fb6('0x19'));var db=require(_0x7fb6('0x1a'))['db'];function respondWithStatusCode(_0x3c594f,_0x549370){_0x549370=_0x549370||0xcc;return function(_0x56606b){if(_0x56606b){return _0x3c594f['sendStatus'](_0x549370);}return _0x3c594f['status'](_0x549370)['end']();};}function respondWithResult(_0x59287e,_0x2e8b7c){_0x2e8b7c=_0x2e8b7c||0xc8;return function(_0x1f73cd){if(_0x1f73cd){return _0x59287e['status'](_0x2e8b7c)[_0x7fb6('0x1b')](_0x1f73cd);}};}function respondWithFilteredResult(_0x3e4441,_0x5046e2){return function(_0xb4c375){if(_0xb4c375){var _0x3bdf2e=_0xb4c375[_0x7fb6('0x1c')],_0x2290e6=_0x5046e2[_0x7fb6('0x1d')],_0x3e89c7=_0x5046e2[_0x7fb6('0x1d')]+_0x5046e2[_0x7fb6('0x1e')],_0x33fb18;if(_0x3e89c7>=_0x3bdf2e){_0x3e89c7=_0x3bdf2e;_0x33fb18=0xc8;}else{_0x33fb18=0xce;}_0x3e4441['status'](_0x33fb18);return _0x3e4441[_0x7fb6('0x1f')](_0x7fb6('0x20'),_0x2290e6+'-'+_0x3e89c7+'/'+_0x3bdf2e)[_0x7fb6('0x1b')](_0xb4c375);}return null;};}function patchUpdates(_0x169389){return function(_0x1cfbaa){try{jsonpatch[_0x7fb6('0x21')](_0x1cfbaa,_0x169389,!![]);}catch(_0x1c26ed){return BPromise['reject'](_0x1c26ed);}return _0x1cfbaa['save']();};}function saveUpdates(_0x1fa63a,_0x2f9ba6){return function(_0x293c9d){if(_0x293c9d){return _0x293c9d[_0x7fb6('0x22')](_0x1fa63a)['then'](function(_0xc44cf5){return _0xc44cf5;});}return null;};}function removeEntity(_0x13ad95,_0x490749){return function(_0x189d11){if(_0x189d11){return _0x189d11['destroy']()['then'](function(){_0x13ad95[_0x7fb6('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51ed55,_0x5040fe){return function(_0x455916){if(!_0x455916){_0x51ed55['sendStatus'](0x194);}return _0x455916;};}function handleError(_0x1f7f92,_0x4a9866){_0x4a9866=_0x4a9866||0x1f4;return function(_0x3566a1){logger[_0x7fb6('0x24')](_0x3566a1[_0x7fb6('0x25')]);if(_0x3566a1[_0x7fb6('0x26')]){delete _0x3566a1[_0x7fb6('0x26')];}_0x1f7f92['status'](_0x4a9866)[_0x7fb6('0x27')](_0x3566a1);};}exports['index']=function(_0x21a045,_0x25ede1){var _0x578453={},_0x4fb049={},_0x57beb1={'count':0x0,'rows':[]};var _0x25216a=_[_0x7fb6('0x28')](db[_0x7fb6('0x29')][_0x7fb6('0x2a')],function(_0x7f3844){return{'name':_0x7f3844[_0x7fb6('0x2b')],'type':_0x7f3844['type'][_0x7fb6('0x2c')]};});_0x4fb049['model']=_[_0x7fb6('0x28')](_0x25216a,_0x7fb6('0x26'));_0x4fb049[_0x7fb6('0x2d')]=_[_0x7fb6('0x2e')](_0x21a045[_0x7fb6('0x2d')]);_0x4fb049[_0x7fb6('0x2f')]=_[_0x7fb6('0x30')](_0x4fb049[_0x7fb6('0x31')],_0x4fb049[_0x7fb6('0x2d')]);_0x578453['attributes']=_[_0x7fb6('0x30')](_0x4fb049[_0x7fb6('0x31')],qs[_0x7fb6('0x32')](_0x21a045[_0x7fb6('0x2d')][_0x7fb6('0x32')]));_0x578453[_0x7fb6('0x33')]=_0x578453[_0x7fb6('0x33')][_0x7fb6('0x34')]?_0x578453[_0x7fb6('0x33')]:_0x4fb049['model'];if(!_0x21a045[_0x7fb6('0x2d')][_0x7fb6('0x35')](_0x7fb6('0x36'))){_0x578453[_0x7fb6('0x1e')]=qs['limit'](_0x21a045['query'][_0x7fb6('0x1e')]);_0x578453[_0x7fb6('0x1d')]=qs[_0x7fb6('0x1d')](_0x21a045[_0x7fb6('0x2d')][_0x7fb6('0x1d')]);}_0x578453['order']=qs[_0x7fb6('0x37')](_0x21a045[_0x7fb6('0x2d')][_0x7fb6('0x37')]);_0x578453[_0x7fb6('0x38')]=qs['filters'](_[_0x7fb6('0x39')](_0x21a045[_0x7fb6('0x2d')],_0x4fb049['filters']),_0x25216a);if(_0x21a045[_0x7fb6('0x2d')]['filter']){_0x578453[_0x7fb6('0x38')]=_['merge'](_0x578453[_0x7fb6('0x38')],{'$or':_['map'](_0x25216a,function(_0x274726){if(_0x274726[_0x7fb6('0x3a')]!==_0x7fb6('0x3b')){var _0x41580b={};_0x41580b[_0x274726[_0x7fb6('0x26')]]={'$like':'%'+_0x21a045[_0x7fb6('0x2d')]['filter']+'%'};return _0x41580b;}})});}_0x578453=_['merge']({},_0x578453,_0x21a045[_0x7fb6('0x3c')]);var _0x36b4cc={'where':_0x578453[_0x7fb6('0x38')]};return db[_0x7fb6('0x29')]['count'](_0x36b4cc)['then'](function(_0x213e6a){_0x57beb1['count']=_0x213e6a;if(_0x21a045[_0x7fb6('0x2d')][_0x7fb6('0x3d')]){_0x578453[_0x7fb6('0x3e')]=[{'all':!![]}];}return db[_0x7fb6('0x29')][_0x7fb6('0x3f')](_0x578453);})[_0x7fb6('0x40')](function(_0xa90e5e){_0x57beb1[_0x7fb6('0x41')]=_0xa90e5e;return _0x57beb1;})['then'](respondWithFilteredResult(_0x25ede1,_0x578453))['catch'](handleError(_0x25ede1,null));};exports[_0x7fb6('0x42')]=function(_0x543de3,_0x39b454){var _0x294483={'raw':!![],'where':{'id':_0x543de3[_0x7fb6('0x43')]['id']}},_0x45561b={};_0x45561b[_0x7fb6('0x31')]=_[_0x7fb6('0x2e')](db[_0x7fb6('0x29')][_0x7fb6('0x2a')]);_0x45561b['query']=_['keys'](_0x543de3[_0x7fb6('0x2d')]);_0x45561b['filters']=_[_0x7fb6('0x30')](_0x45561b['model'],_0x45561b[_0x7fb6('0x2d')]);_0x294483[_0x7fb6('0x33')]=_['intersection'](_0x45561b[_0x7fb6('0x31')],qs[_0x7fb6('0x32')](_0x543de3[_0x7fb6('0x2d')][_0x7fb6('0x32')]));_0x294483[_0x7fb6('0x33')]=_0x294483[_0x7fb6('0x33')][_0x7fb6('0x34')]?_0x294483[_0x7fb6('0x33')]:_0x45561b[_0x7fb6('0x31')];if(_0x543de3['query'][_0x7fb6('0x3d')]){_0x294483['include']=[{'all':!![]}];}_0x294483=_[_0x7fb6('0x44')]({},_0x294483,_0x543de3[_0x7fb6('0x3c')]);return db['CloudProvider'][_0x7fb6('0x45')](_0x294483)[_0x7fb6('0x40')](handleEntityNotFound(_0x39b454,null))[_0x7fb6('0x40')](respondWithResult(_0x39b454,null))['catch'](handleError(_0x39b454,null));};exports[_0x7fb6('0x46')]=function(_0x4e8501,_0x328c1a){return db[_0x7fb6('0x29')][_0x7fb6('0x46')](_0x4e8501[_0x7fb6('0x47')],{})[_0x7fb6('0x40')](respondWithResult(_0x328c1a,0xc9))[_0x7fb6('0x48')](handleError(_0x328c1a,null));};exports[_0x7fb6('0x22')]=function(_0x3a4942,_0x4d589f){if(_0x3a4942[_0x7fb6('0x47')]['id']){delete _0x3a4942['body']['id'];}return db[_0x7fb6('0x29')]['find']({'where':{'id':_0x3a4942[_0x7fb6('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d589f,null))[_0x7fb6('0x40')](saveUpdates(_0x3a4942[_0x7fb6('0x47')],null))['then'](respondWithResult(_0x4d589f,null))[_0x7fb6('0x48')](handleError(_0x4d589f,null));};exports[_0x7fb6('0x49')]=function(_0x42cd71,_0x38eff4){return db[_0x7fb6('0x29')][_0x7fb6('0x45')]({'where':{'id':_0x42cd71[_0x7fb6('0x43')]['id']}})[_0x7fb6('0x40')](handleEntityNotFound(_0x38eff4,null))[_0x7fb6('0x40')](removeEntity(_0x38eff4,null))[_0x7fb6('0x48')](handleError(_0x38eff4,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7186ef0..fa31aa9 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 _0xb072=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x46ddbf,_0x2efab7){var _0xdacb86=function(_0x268ed9){while(--_0x268ed9){_0x46ddbf['push'](_0x46ddbf['shift']());}};_0xdacb86(++_0x2efab7);}(_0xb072,0xd9));var _0x2b07=function(_0x4449b7,_0x15411f){_0x4449b7=_0x4449b7-0x0;var _0x59eb71=_0xb072[_0x4449b7];return _0x59eb71;};'use strict';var _=require(_0x2b07('0x0'));var util=require(_0x2b07('0x1'));var logger=require(_0x2b07('0x2'))(_0x2b07('0x3'));var moment=require(_0x2b07('0x4'));var BPromise=require(_0x2b07('0x5'));var rp=require(_0x2b07('0x6'));var fs=require('fs');var path=require(_0x2b07('0x7'));var rimraf=require(_0x2b07('0x8'));var config=require(_0x2b07('0x9'));var attributes=require(_0x2b07('0xa'));module[_0x2b07('0xb')]=function(_0x5ef5c3,_0x3811d8){return _0x5ef5c3[_0x2b07('0xc')](_0x2b07('0xd'),attributes,{'tableName':_0x2b07('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9752=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9752,0x8d));var _0x2975=function(_0x6f0eb3,_0x2f16d0){_0x6f0eb3=_0x6f0eb3-0x0;var _0x2fa8e8=_0x9752[_0x6f0eb3];return _0x2fa8e8;};'use strict';var _=require(_0x2975('0x0'));var util=require(_0x2975('0x1'));var logger=require('../../config/logger')(_0x2975('0x2'));var moment=require(_0x2975('0x3'));var BPromise=require(_0x2975('0x4'));var rp=require(_0x2975('0x5'));var fs=require('fs');var path=require(_0x2975('0x6'));var rimraf=require(_0x2975('0x7'));var config=require(_0x2975('0x8'));var attributes=require(_0x2975('0x9'));module['exports']=function(_0x37d607,_0x4efff4){return _0x37d607[_0x2975('0xa')](_0x2975('0xb'),attributes,{'tableName':_0x2975('0xc'),'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 4caac3f..bf56e6b 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 _0x008e=['request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','CloudProvider,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info'];(function(_0x7f3667,_0x30c3f1){var _0x2c4c24=function(_0xf070f3){while(--_0xf070f3){_0x7f3667['push'](_0x7f3667['shift']());}};_0x2c4c24(++_0x30c3f1);}(_0x008e,0x1d6));var _0xe008=function(_0x5dd31f,_0x1042c9){_0x5dd31f=_0x5dd31f-0x0;var _0x1a50ee=_0x008e[_0x5dd31f];return _0x1a50ee;};'use strict';var _=require(_0xe008('0x0'));var util=require(_0xe008('0x1'));var moment=require(_0xe008('0x2'));var BPromise=require(_0xe008('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe008('0x4'));var db=require(_0xe008('0x5'))['db'];var utils=require(_0xe008('0x6'));var logger=require(_0xe008('0x7'))(_0xe008('0x8'));var config=require(_0xe008('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe008('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e32e4,_0x3ef136,_0x3753df){return new BPromise(function(_0x96cc2a,_0x282f4d){return client['request'](_0x1e32e4,_0x3753df)[_0xe008('0xb')](function(_0x2ea450){logger[_0xe008('0xc')]('CloudProvider,\x20%s,\x20%s',_0x3ef136,_0xe008('0xd'));logger['debug'](_0xe008('0xe'),_0x3ef136,_0xe008('0xd'),JSON[_0xe008('0xf')](_0x2ea450));if(_0x2ea450['error']){if(_0x2ea450[_0xe008('0x10')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x3ef136,_0x2ea450['error'][_0xe008('0x11')]);return _0x282f4d(_0x2ea450[_0xe008('0x10')][_0xe008('0x11')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x3ef136,_0x2ea450[_0xe008('0x10')][_0xe008('0x11')]);return _0x96cc2a(_0x2ea450['error'][_0xe008('0x11')]);}else{logger['info'](_0xe008('0x12'),_0x3ef136,_0xe008('0xd'));_0x96cc2a(_0x2ea450[_0xe008('0x13')][_0xe008('0x11')]);}})[_0xe008('0x14')](function(_0x339656){logger['error'](_0xe008('0x12'),_0x3ef136,_0x339656);_0x282f4d(_0x339656);});});} \ No newline at end of file +var _0xcc89=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','CloudProvider,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf38130,_0xe0691b){var _0x4f53c8=function(_0x2f352b){while(--_0x2f352b){_0xf38130['push'](_0xf38130['shift']());}};_0x4f53c8(++_0xe0691b);}(_0xcc89,0x118));var _0x9cc8=function(_0x27337e,_0x30a6b0){_0x27337e=_0x27337e-0x0;var _0x13504e=_0xcc89[_0x27337e];return _0x13504e;};'use strict';var _=require(_0x9cc8('0x0'));var util=require(_0x9cc8('0x1'));var moment=require('moment');var BPromise=require(_0x9cc8('0x2'));var rs=require(_0x9cc8('0x3'));var fs=require('fs');var Redis=require(_0x9cc8('0x4'));var db=require(_0x9cc8('0x5'))['db'];var utils=require(_0x9cc8('0x6'));var logger=require(_0x9cc8('0x7'))(_0x9cc8('0x8'));var config=require(_0x9cc8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9cc8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bd51e,_0x2daa54,_0x193d2a){return new BPromise(function(_0x293661,_0x4e7fca){return client[_0x9cc8('0xb')](_0x2bd51e,_0x193d2a)['then'](function(_0x3134c8){logger[_0x9cc8('0xc')]('CloudProvider,\x20%s,\x20%s',_0x2daa54,'request\x20sent');logger[_0x9cc8('0xd')](_0x9cc8('0xe'),_0x2daa54,_0x9cc8('0xf'),JSON[_0x9cc8('0x10')](_0x3134c8));if(_0x3134c8['error']){if(_0x3134c8['error'][_0x9cc8('0x11')]===0x1f4){logger[_0x9cc8('0x12')](_0x9cc8('0x13'),_0x2daa54,_0x3134c8[_0x9cc8('0x12')][_0x9cc8('0x14')]);return _0x4e7fca(_0x3134c8[_0x9cc8('0x12')][_0x9cc8('0x14')]);}logger[_0x9cc8('0x12')](_0x9cc8('0x13'),_0x2daa54,_0x3134c8[_0x9cc8('0x12')][_0x9cc8('0x14')]);return _0x293661(_0x3134c8[_0x9cc8('0x12')][_0x9cc8('0x14')]);}else{logger[_0x9cc8('0xc')](_0x9cc8('0x13'),_0x2daa54,_0x9cc8('0xf'));_0x293661(_0x3134c8[_0x9cc8('0x15')]['message']);}})['catch'](function(_0x2620b1){logger[_0x9cc8('0x12')](_0x9cc8('0x13'),_0x2daa54,_0x2620b1);_0x4e7fca(_0x2620b1);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index ce045f6..a4102d2 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 _0x2a59=['get','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1daf2e,_0x1c2415){var _0x3b1148=function(_0x510527){while(--_0x510527){_0x1daf2e['push'](_0x1daf2e['shift']());}};_0x3b1148(++_0x1c2415);}(_0x2a59,0x129));var _0x92a5=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x2a59[_0xe66cf2];return _0x2d84e7;};'use strict';var multer=require(_0x92a5('0x0'));var util=require(_0x92a5('0x1'));var path=require(_0x92a5('0x2'));var timeout=require(_0x92a5('0x3'));var express=require(_0x92a5('0x4'));var router=express[_0x92a5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x92a5('0x6'));var interaction=require(_0x92a5('0x7'));var config=require(_0x92a5('0x8'));var controller=require('./cloudProvider.controller');router[_0x92a5('0x9')]('/',auth[_0x92a5('0xa')](),controller['index']);router['get'](_0x92a5('0xb'),auth[_0x92a5('0xa')](),controller[_0x92a5('0xc')]);router[_0x92a5('0xd')]('/',auth[_0x92a5('0xa')](),controller['create']);router['put']('/:id',auth[_0x92a5('0xa')](),controller[_0x92a5('0xe')]);router[_0x92a5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x92a5('0x10')]);module[_0x92a5('0x11')]=router; \ No newline at end of file +var _0x7712=['index','/:id','show','post','isAuthenticated','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x7712,0x18f));var _0x2771=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7712[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2771('0x0'));var router=express['Router']();var fs_extra=require(_0x2771('0x1'));var auth=require(_0x2771('0x2'));var interaction=require(_0x2771('0x3'));var config=require(_0x2771('0x4'));var controller=require(_0x2771('0x5'));router[_0x2771('0x6')]('/',auth['isAuthenticated'](),controller[_0x2771('0x7')]);router[_0x2771('0x6')](_0x2771('0x8'),auth['isAuthenticated'](),controller[_0x2771('0x9')]);router[_0x2771('0xa')]('/',auth[_0x2771('0xb')](),controller['create']);router['put']('/:id',auth[_0x2771('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2771('0xc')]);module[_0x2771('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 921038d..57cf9a3 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 _0xf6d7=['name','exports','STRING'];(function(_0x2b2e3c,_0x21f70a){var _0x211070=function(_0x3be2c6){while(--_0x3be2c6){_0x2b2e3c['push'](_0x2b2e3c['shift']());}};_0x211070(++_0x21f70a);}(_0xf6d7,0x121));var _0x7f6d=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xf6d7[_0x4063a4];return _0x17908d;};'use strict';var Sequelize=require('sequelize');module[_0x7f6d('0x0')]={'name':{'type':Sequelize[_0x7f6d('0x1')],'unique':_0x7f6d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x7f6d('0x1')]},'website':{'type':Sequelize[_0x7f6d('0x1')]},'phone':{'type':Sequelize[_0x7f6d('0x1')]},'fax':{'type':Sequelize[_0x7f6d('0x1')]},'type':{'type':Sequelize[_0x7f6d('0x1')]},'street':{'type':Sequelize[_0x7f6d('0x1')]},'postalCode':{'type':Sequelize[_0x7f6d('0x1')]},'city':{'type':Sequelize[_0x7f6d('0x1')]},'country':{'type':Sequelize[_0x7f6d('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7f6d('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x7f6d('0x1')]},'sCountry':{'type':Sequelize[_0x7f6d('0x1')]},'description':{'type':Sequelize[_0x7f6d('0x1')]}}; \ No newline at end of file +var _0x1366=['STRING','name'];(function(_0x279d09,_0x20088c){var _0x3dcdcf=function(_0x5e5474){while(--_0x5e5474){_0x279d09['push'](_0x279d09['shift']());}};_0x3dcdcf(++_0x20088c);}(_0x1366,0xcf));var _0x6136=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1366[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6136('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x6136('0x1')]},'website':{'type':Sequelize[_0x6136('0x1')]},'phone':{'type':Sequelize[_0x6136('0x1')]},'fax':{'type':Sequelize[_0x6136('0x1')]},'type':{'type':Sequelize[_0x6136('0x1')]},'street':{'type':Sequelize[_0x6136('0x1')]},'postalCode':{'type':Sequelize[_0x6136('0x1')]},'city':{'type':Sequelize[_0x6136('0x1')]},'country':{'type':Sequelize[_0x6136('0x1')]},'email':{'type':Sequelize[_0x6136('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6136('0x1')]},'sStreet':{'type':Sequelize[_0x6136('0x1')]},'sPostalCode':{'type':Sequelize[_0x6136('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6136('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 4248f1a..9ba598a 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 _0xd765=['save','update','then','destroy','Companies','UserProfileResource','end','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','findAll','rows','catch','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContact','ids','omit','getContacts','findOne','rawAttributes','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x307cb2,_0x5a17e9){var _0x366529=function(_0x57a02e){while(--_0x57a02e){_0x307cb2['push'](_0x307cb2['shift']());}};_0x366529(++_0x5a17e9);}(_0xd765,0xdf));var _0x5d76=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd765[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x5d76('0x0'));var emlformat=require(_0x5d76('0x1'));var rimraf=require(_0x5d76('0x2'));var zipdir=require(_0x5d76('0x3'));var jsonpatch=require(_0x5d76('0x4'));var rp=require(_0x5d76('0x5'));var moment=require('moment');var BPromise=require(_0x5d76('0x6'));var Mustache=require('mustache');var util=require(_0x5d76('0x7'));var path=require(_0x5d76('0x8'));var sox=require('sox');var csv=require(_0x5d76('0x9'));var ejs=require(_0x5d76('0xa'));var fs=require('fs');var fs_extra=require(_0x5d76('0xb'));var _=require(_0x5d76('0xc'));var squel=require(_0x5d76('0xd'));var crypto=require(_0x5d76('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5d76('0x9'));var querystring=require(_0x5d76('0xf'));var Papa=require(_0x5d76('0x10'));var Redis=require(_0x5d76('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d76('0x12'));var hardwareService=require(_0x5d76('0x13'));var logger=require(_0x5d76('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5d76('0x15'))['db'];function respondWithStatusCode(_0xf64e66,_0x36ae3a){_0x36ae3a=_0x36ae3a||0xcc;return function(_0x5d50b1){if(_0x5d50b1){return _0xf64e66[_0x5d76('0x16')](_0x36ae3a);}return _0xf64e66[_0x5d76('0x17')](_0x36ae3a)['end']();};}function respondWithResult(_0x29172a,_0x205878){_0x205878=_0x205878||0xc8;return function(_0x3bf1fe){if(_0x3bf1fe){return _0x29172a[_0x5d76('0x17')](_0x205878)[_0x5d76('0x18')](_0x3bf1fe);}};}function respondWithFilteredResult(_0x565397,_0x38623a){return function(_0x25d65c){if(_0x25d65c){var _0xfce090=_0x25d65c[_0x5d76('0x19')],_0x4c9853=_0x38623a['offset'],_0x2ee863=_0x38623a[_0x5d76('0x1a')]+_0x38623a[_0x5d76('0x1b')],_0x16a0fe;if(_0x2ee863>=_0xfce090){_0x2ee863=_0xfce090;_0x16a0fe=0xc8;}else{_0x16a0fe=0xce;}_0x565397['status'](_0x16a0fe);return _0x565397[_0x5d76('0x1c')](_0x5d76('0x1d'),_0x4c9853+'-'+_0x2ee863+'/'+_0xfce090)[_0x5d76('0x18')](_0x25d65c);}return null;};}function patchUpdates(_0x367d43){return function(_0x10aeb7){try{jsonpatch[_0x5d76('0x1e')](_0x10aeb7,_0x367d43,!![]);}catch(_0x39f6e4){return BPromise[_0x5d76('0x1f')](_0x39f6e4);}return _0x10aeb7[_0x5d76('0x20')]();};}function saveUpdates(_0x1386aa,_0x55955b){return function(_0x185791){if(_0x185791){return _0x185791[_0x5d76('0x21')](_0x1386aa)[_0x5d76('0x22')](function(_0x151091){return _0x151091;});}return null;};}function removeEntity(_0x4cd502,_0x31daeb){return function(_0x5580f7){if(_0x5580f7){return _0x5580f7[_0x5d76('0x23')]()[_0x5d76('0x22')](function(){var _0x2daa0b=_0x5580f7['get']({'plain':!![]});var _0x16e771=_0x5d76('0x24');return db[_0x5d76('0x25')]['destroy']({'where':{'type':_0x16e771,'resourceId':_0x2daa0b['id']}})[_0x5d76('0x22')](function(){return _0x5580f7;});})['then'](function(){_0x4cd502[_0x5d76('0x17')](0xcc)[_0x5d76('0x26')]();});}};}function handleEntityNotFound(_0x16624a,_0x5e8a3f){return function(_0x254ce7){if(!_0x254ce7){_0x16624a[_0x5d76('0x16')](0x194);}return _0x254ce7;};}function handleError(_0x5433d0,_0x442e89){_0x442e89=_0x442e89||0x1f4;return function(_0x406b37){logger[_0x5d76('0x27')](_0x406b37[_0x5d76('0x28')]);if(_0x406b37[_0x5d76('0x29')]){delete _0x406b37[_0x5d76('0x29')];}_0x5433d0[_0x5d76('0x17')](_0x442e89)['send'](_0x406b37);};}exports[_0x5d76('0x2a')]=function(_0x18f03d,_0x43d358){var _0x1e81c0={},_0x1a893e={},_0x3871e1={'count':0x0,'rows':[]};return db[_0x5d76('0x2b')][_0x5d76('0x2c')]()[_0x5d76('0x22')](function(_0x1a9fb0){_0x1a893e[_0x5d76('0x2d')]=_[_0x5d76('0x2e')](_0x1a9fb0);_0x1a893e[_0x5d76('0x2f')]=_[_0x5d76('0x2e')](_0x18f03d[_0x5d76('0x2f')]);_0x1a893e[_0x5d76('0x30')]=_[_0x5d76('0x31')](_0x1a893e['model'],_0x1a893e[_0x5d76('0x2f')]);_0x1e81c0[_0x5d76('0x32')]=_[_0x5d76('0x31')](_0x1a893e['model'],qs[_0x5d76('0x33')](_0x18f03d['query'][_0x5d76('0x33')]));_0x1e81c0[_0x5d76('0x32')]=_0x1e81c0[_0x5d76('0x32')][_0x5d76('0x34')]?_0x1e81c0[_0x5d76('0x32')]:_0x1a893e[_0x5d76('0x2d')];if(!_0x18f03d['query'][_0x5d76('0x35')](_0x5d76('0x36'))){_0x1e81c0['limit']=qs[_0x5d76('0x1b')](_0x18f03d[_0x5d76('0x2f')][_0x5d76('0x1b')]);_0x1e81c0[_0x5d76('0x1a')]=qs[_0x5d76('0x1a')](_0x18f03d[_0x5d76('0x2f')][_0x5d76('0x1a')]);}_0x1e81c0[_0x5d76('0x37')]=qs[_0x5d76('0x38')](_0x18f03d[_0x5d76('0x2f')][_0x5d76('0x38')]);_0x1e81c0[_0x5d76('0x39')]=qs[_0x5d76('0x30')](_[_0x5d76('0x3a')](_0x18f03d['query'],_0x1a893e[_0x5d76('0x30')]),_0x1a9fb0);if(_0x18f03d['query'][_0x5d76('0x3b')]){_0x1e81c0[_0x5d76('0x39')]=_[_0x5d76('0x3c')](_0x1e81c0[_0x5d76('0x39')],{'$or':_[_0x5d76('0x3d')](_0x1e81c0[_0x5d76('0x32')],function(_0x576fc9){var _0x539282={};_0x539282[_0x576fc9]={'$like':'%'+_0x18f03d[_0x5d76('0x2f')]['filter']+'%'};return _0x539282;})});}_0x1e81c0=_['merge']({},_0x1e81c0,_0x18f03d[_0x5d76('0x3e')]);var _0x528cc4={'where':_0x1e81c0['where']};return db[_0x5d76('0x2b')][_0x5d76('0x19')](_0x528cc4)[_0x5d76('0x22')](function(_0x4c3d06){_0x3871e1[_0x5d76('0x19')]=_0x4c3d06;if(_0x18f03d[_0x5d76('0x2f')][_0x5d76('0x3f')]){_0x1e81c0['include']=[{'all':!![]}];}return db[_0x5d76('0x2b')][_0x5d76('0x40')](_0x1e81c0);})[_0x5d76('0x22')](function(_0x5f16e2){_0x3871e1[_0x5d76('0x41')]=_0x5f16e2;return _0x3871e1;})[_0x5d76('0x22')](respondWithFilteredResult(_0x43d358,_0x1e81c0))[_0x5d76('0x42')](handleError(_0x43d358,null));})['catch'](handleError(_0x43d358,null));};exports[_0x5d76('0x43')]=function(_0x212bcb,_0x36d43e){var _0x1c5a6e={'raw':![],'where':{'id':_0x212bcb[_0x5d76('0x44')]['id']}},_0x115649={};_0x115649[_0x5d76('0x2d')]=_[_0x5d76('0x2e')](db[_0x5d76('0x2b')]['rawAttributes']);_0x115649['query']=_[_0x5d76('0x2e')](_0x212bcb[_0x5d76('0x2f')]);_0x115649[_0x5d76('0x30')]=_[_0x5d76('0x31')](_0x115649['model'],_0x115649[_0x5d76('0x2f')]);_0x1c5a6e[_0x5d76('0x32')]=_[_0x5d76('0x31')](_0x115649[_0x5d76('0x2d')],qs[_0x5d76('0x33')](_0x212bcb[_0x5d76('0x2f')][_0x5d76('0x33')]));_0x1c5a6e['attributes']=_0x1c5a6e[_0x5d76('0x32')][_0x5d76('0x34')]?_0x1c5a6e[_0x5d76('0x32')]:_0x115649[_0x5d76('0x2d')];if(_0x212bcb[_0x5d76('0x2f')]['includeAll']){_0x1c5a6e['include']=[{'all':!![]}];}_0x1c5a6e=_['merge']({},_0x1c5a6e,_0x212bcb[_0x5d76('0x3e')]);return db[_0x5d76('0x2b')][_0x5d76('0x45')](_0x1c5a6e)[_0x5d76('0x22')](handleEntityNotFound(_0x36d43e,null))[_0x5d76('0x22')](respondWithResult(_0x36d43e,null))[_0x5d76('0x42')](handleError(_0x36d43e,null));};exports['create']=function(_0x44aeda,_0x46cc5b){return db[_0x5d76('0x2b')][_0x5d76('0x46')](_0x44aeda['body'],{})['then'](function(_0xccafbf){var _0x7f1351=_0x44aeda['user'][_0x5d76('0x47')]({'plain':!![]});if(!_0x7f1351)throw new Error(_0x5d76('0x48'));if(_0x7f1351[_0x5d76('0x49')]===_0x5d76('0x4a')){var _0x549fec=_0xccafbf[_0x5d76('0x47')]({'plain':!![]});var _0x4c9d86=_0x5d76('0x24');return db[_0x5d76('0x4b')][_0x5d76('0x45')]({'where':{'name':_0x4c9d86,'userProfileId':_0x7f1351[_0x5d76('0x4c')]},'raw':!![]})[_0x5d76('0x22')](function(_0x3e4f1d){if(_0x3e4f1d&&_0x3e4f1d['autoAssociation']===0x0){return db['UserProfileResource'][_0x5d76('0x46')]({'name':_0x549fec[_0x5d76('0x29')],'resourceId':_0x549fec['id'],'type':_0x3e4f1d[_0x5d76('0x29')],'sectionId':_0x3e4f1d['id']},{})[_0x5d76('0x22')](function(){return _0xccafbf;});}else{return _0xccafbf;}})['catch'](function(_0x5bdc3b){logger[_0x5d76('0x27')](_0x5d76('0x4d'),_0x5bdc3b);throw _0x5bdc3b;});}return _0xccafbf;})['then'](respondWithResult(_0x46cc5b,0xc9))[_0x5d76('0x42')](handleError(_0x46cc5b,null));};exports[_0x5d76('0x21')]=function(_0x5e1306,_0x1c8e96){if(_0x5e1306['body']['id']){delete _0x5e1306[_0x5d76('0x4e')]['id'];}return db[_0x5d76('0x2b')][_0x5d76('0x45')]({'where':{'id':_0x5e1306[_0x5d76('0x44')]['id']}})[_0x5d76('0x22')](handleEntityNotFound(_0x1c8e96,null))[_0x5d76('0x22')](saveUpdates(_0x5e1306['body'],null))[_0x5d76('0x22')](respondWithResult(_0x1c8e96,null))[_0x5d76('0x42')](handleError(_0x1c8e96,null));};exports[_0x5d76('0x23')]=function(_0x3778fd,_0x367a4d){return db[_0x5d76('0x2b')]['find']({'where':{'id':_0x3778fd['params']['id']}})['then'](handleEntityNotFound(_0x367a4d,null))[_0x5d76('0x22')](removeEntity(_0x367a4d,null))[_0x5d76('0x42')](handleError(_0x367a4d,null));};exports[_0x5d76('0x2c')]=function(_0x29b1db,_0x54f33b){return db[_0x5d76('0x2b')]['describe']()[_0x5d76('0x22')](respondWithResult(_0x54f33b,null))[_0x5d76('0x42')](handleError(_0x54f33b,null));};exports['addContacts']=function(_0x547c1e,_0x24a996,_0xdfd0af){return db[_0x5d76('0x4f')][_0x5d76('0x45')]({'where':{'id':_0x547c1e[_0x5d76('0x44')]['id']}})[_0x5d76('0x22')](handleEntityNotFound(_0x24a996,null))['then'](function(_0x1d99cd){if(_0x1d99cd){return _0x1d99cd['addContacts'](_0x547c1e[_0x5d76('0x4e')][_0x5d76('0x50')],_[_0x5d76('0x51')](_0x547c1e[_0x5d76('0x4e')],[_0x5d76('0x50'),'id'])||{});}})[_0x5d76('0x22')](respondWithResult(_0x24a996,null))['catch'](handleError(_0x24a996,null));};exports[_0x5d76('0x52')]=function(_0x5c2100,_0x355b28,_0x5b7055){var _0x53fcb8={};var _0x545653={};var _0x50b5eb;var _0x2e4d6d;return db[_0x5d76('0x2b')][_0x5d76('0x53')]({'where':{'id':_0x5c2100['params']['id']}})['then'](handleEntityNotFound(_0x355b28,null))[_0x5d76('0x22')](function(_0x5ce483){if(_0x5ce483){_0x50b5eb=_0x5ce483;_0x545653[_0x5d76('0x2d')]=_[_0x5d76('0x2e')](db[_0x5d76('0x4f')][_0x5d76('0x54')]);_0x545653[_0x5d76('0x2f')]=_[_0x5d76('0x2e')](_0x5c2100[_0x5d76('0x2f')]);_0x545653[_0x5d76('0x30')]=_['intersection'](_0x545653['model'],_0x545653[_0x5d76('0x2f')]);_0x53fcb8[_0x5d76('0x32')]=_[_0x5d76('0x31')](_0x545653[_0x5d76('0x2d')],qs[_0x5d76('0x33')](_0x5c2100[_0x5d76('0x2f')][_0x5d76('0x33')]));_0x53fcb8['attributes']=_0x53fcb8[_0x5d76('0x32')]['length']?_0x53fcb8[_0x5d76('0x32')]:_0x545653[_0x5d76('0x2d')];_0x53fcb8['order']=qs['sort'](_0x5c2100['query'][_0x5d76('0x38')]);_0x53fcb8[_0x5d76('0x39')]=qs[_0x5d76('0x30')](_[_0x5d76('0x3a')](_0x5c2100[_0x5d76('0x2f')],_0x545653[_0x5d76('0x30')]));if(_0x5c2100[_0x5d76('0x2f')]['filter']){_0x53fcb8['where']=_[_0x5d76('0x3c')](_0x53fcb8[_0x5d76('0x39')],{'$or':_[_0x5d76('0x3d')](_0x53fcb8['attributes'],function(_0x4b23ca){var _0x1e5fd3={};_0x1e5fd3[_0x4b23ca]={'$like':'%'+_0x5c2100[_0x5d76('0x2f')][_0x5d76('0x3b')]+'%'};return _0x1e5fd3;})});}_0x53fcb8=_['merge']({},_0x53fcb8,_0x5c2100[_0x5d76('0x3e')]);return _0x50b5eb['getContacts'](_0x53fcb8);}})[_0x5d76('0x22')](function(_0x5315d9){if(_0x5315d9){_0x2e4d6d=_0x5315d9['length'];if(!_0x5c2100[_0x5d76('0x2f')][_0x5d76('0x35')]('nolimit')){_0x53fcb8[_0x5d76('0x1b')]=qs[_0x5d76('0x1b')](_0x5c2100[_0x5d76('0x2f')][_0x5d76('0x1b')]);_0x53fcb8[_0x5d76('0x1a')]=qs[_0x5d76('0x1a')](_0x5c2100[_0x5d76('0x2f')][_0x5d76('0x1a')]);}return _0x50b5eb[_0x5d76('0x52')](_0x53fcb8);}})[_0x5d76('0x22')](function(_0x2b1973){if(_0x2b1973){return _0x2b1973?{'count':_0x2e4d6d,'rows':_0x2b1973}:null;}})[_0x5d76('0x22')](respondWithResult(_0x355b28,null))[_0x5d76('0x42')](handleError(_0x355b28,null));}; \ No newline at end of file +var _0x4541=['rawAttributes','order','getContacts','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','get','UserProfileResource','error','stack','name','index','CmCompany','describe','model','keys','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','map','options','count','includeAll','include','findAll','catch','show','params','find','create','body','user','role','Companies','UserProfileSection','autoAssociation','destroy','addContacts','CmContact','omit','ids','findOne'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4541,0x1ad));var _0x1454=function(_0x1e50af,_0x1b7ea1){_0x1e50af=_0x1e50af-0x0;var _0x551114=_0x4541[_0x1e50af];return _0x551114;};'use strict';var pdf=require(_0x1454('0x0'));var emlformat=require(_0x1454('0x1'));var rimraf=require(_0x1454('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1454('0x3'));var rp=require(_0x1454('0x4'));var moment=require(_0x1454('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1454('0x6'));var sox=require(_0x1454('0x7'));var csv=require(_0x1454('0x8'));var ejs=require(_0x1454('0x9'));var fs=require('fs');var fs_extra=require(_0x1454('0xa'));var _=require(_0x1454('0xb'));var squel=require(_0x1454('0xc'));var crypto=require(_0x1454('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1454('0xe'));var toCsv=require(_0x1454('0x8'));var querystring=require(_0x1454('0xf'));var Papa=require(_0x1454('0x10'));var Redis=require(_0x1454('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1454('0x12'));var as=require(_0x1454('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1454('0x14'))('api');var utils=require(_0x1454('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1454('0x16'));var db=require(_0x1454('0x17'))['db'];function respondWithStatusCode(_0xe6aba3,_0x665f5d){_0x665f5d=_0x665f5d||0xcc;return function(_0x5a9675){if(_0x5a9675){return _0xe6aba3[_0x1454('0x18')](_0x665f5d);}return _0xe6aba3[_0x1454('0x19')](_0x665f5d)[_0x1454('0x1a')]();};}function respondWithResult(_0x2d278a,_0xdfa381){_0xdfa381=_0xdfa381||0xc8;return function(_0x52618e){if(_0x52618e){return _0x2d278a[_0x1454('0x19')](_0xdfa381)[_0x1454('0x1b')](_0x52618e);}};}function respondWithFilteredResult(_0x428233,_0x3428bd){return function(_0x3d2dbe){if(_0x3d2dbe){var _0x1261b3=_0x3d2dbe['count'],_0x3f318d=_0x3428bd[_0x1454('0x1c')],_0x7c3422=_0x3428bd[_0x1454('0x1c')]+_0x3428bd[_0x1454('0x1d')],_0x1a19dc;if(_0x7c3422>=_0x1261b3){_0x7c3422=_0x1261b3;_0x1a19dc=0xc8;}else{_0x1a19dc=0xce;}_0x428233[_0x1454('0x19')](_0x1a19dc);return _0x428233[_0x1454('0x1e')](_0x1454('0x1f'),_0x3f318d+'-'+_0x7c3422+'/'+_0x1261b3)[_0x1454('0x1b')](_0x3d2dbe);}return null;};}function patchUpdates(_0x50b269){return function(_0xc92fe4){try{jsonpatch[_0x1454('0x20')](_0xc92fe4,_0x50b269,!![]);}catch(_0x4185dd){return BPromise[_0x1454('0x21')](_0x4185dd);}return _0xc92fe4['save']();};}function saveUpdates(_0xcf2dbe,_0x3a5cd1){return function(_0x2b14b1){if(_0x2b14b1){return _0x2b14b1[_0x1454('0x22')](_0xcf2dbe)[_0x1454('0x23')](function(_0x35f23f){return _0x35f23f;});}return null;};}function removeEntity(_0x31ec6c,_0x34f99f){return function(_0x157df1){if(_0x157df1){return _0x157df1['destroy']()[_0x1454('0x23')](function(){var _0x507c4c=_0x157df1[_0x1454('0x24')]({'plain':!![]});var _0x4179ba='Companies';return db[_0x1454('0x25')]['destroy']({'where':{'type':_0x4179ba,'resourceId':_0x507c4c['id']}})[_0x1454('0x23')](function(){return _0x157df1;});})['then'](function(){_0x31ec6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49bd9c,_0x18b51c){return function(_0x3a0c58){if(!_0x3a0c58){_0x49bd9c[_0x1454('0x18')](0x194);}return _0x3a0c58;};}function handleError(_0x31f33c,_0x46f5a3){_0x46f5a3=_0x46f5a3||0x1f4;return function(_0x10a9a4){logger[_0x1454('0x26')](_0x10a9a4[_0x1454('0x27')]);if(_0x10a9a4[_0x1454('0x28')]){delete _0x10a9a4[_0x1454('0x28')];}_0x31f33c['status'](_0x46f5a3)['send'](_0x10a9a4);};}exports[_0x1454('0x29')]=function(_0x1cf44e,_0x5b3f59){var _0x4fb7e4={},_0x47c9b7={},_0x4a10f4={'count':0x0,'rows':[]};return db[_0x1454('0x2a')][_0x1454('0x2b')]()[_0x1454('0x23')](function(_0x387c1b){_0x47c9b7[_0x1454('0x2c')]=_[_0x1454('0x2d')](_0x387c1b);_0x47c9b7[_0x1454('0x2e')]=_[_0x1454('0x2d')](_0x1cf44e[_0x1454('0x2e')]);_0x47c9b7['filters']=_['intersection'](_0x47c9b7[_0x1454('0x2c')],_0x47c9b7[_0x1454('0x2e')]);_0x4fb7e4['attributes']=_[_0x1454('0x2f')](_0x47c9b7['model'],qs[_0x1454('0x30')](_0x1cf44e['query'][_0x1454('0x30')]));_0x4fb7e4[_0x1454('0x31')]=_0x4fb7e4[_0x1454('0x31')][_0x1454('0x32')]?_0x4fb7e4['attributes']:_0x47c9b7[_0x1454('0x2c')];if(!_0x1cf44e['query']['hasOwnProperty'](_0x1454('0x33'))){_0x4fb7e4[_0x1454('0x1d')]=qs[_0x1454('0x1d')](_0x1cf44e[_0x1454('0x2e')][_0x1454('0x1d')]);_0x4fb7e4[_0x1454('0x1c')]=qs[_0x1454('0x1c')](_0x1cf44e[_0x1454('0x2e')][_0x1454('0x1c')]);}_0x4fb7e4['order']=qs[_0x1454('0x34')](_0x1cf44e[_0x1454('0x2e')][_0x1454('0x34')]);_0x4fb7e4[_0x1454('0x35')]=qs[_0x1454('0x36')](_[_0x1454('0x37')](_0x1cf44e[_0x1454('0x2e')],_0x47c9b7[_0x1454('0x36')]),_0x387c1b);if(_0x1cf44e[_0x1454('0x2e')][_0x1454('0x38')]){_0x4fb7e4[_0x1454('0x35')]=_[_0x1454('0x39')](_0x4fb7e4[_0x1454('0x35')],{'$or':_[_0x1454('0x3a')](_0x4fb7e4['attributes'],function(_0x4742aa){var _0x401be6={};_0x401be6[_0x4742aa]={'$like':'%'+_0x1cf44e[_0x1454('0x2e')][_0x1454('0x38')]+'%'};return _0x401be6;})});}_0x4fb7e4=_[_0x1454('0x39')]({},_0x4fb7e4,_0x1cf44e[_0x1454('0x3b')]);var _0x471fa3={'where':_0x4fb7e4['where']};return db[_0x1454('0x2a')][_0x1454('0x3c')](_0x471fa3)[_0x1454('0x23')](function(_0x3b39b7){_0x4a10f4[_0x1454('0x3c')]=_0x3b39b7;if(_0x1cf44e[_0x1454('0x2e')][_0x1454('0x3d')]){_0x4fb7e4[_0x1454('0x3e')]=[{'all':!![]}];}return db[_0x1454('0x2a')][_0x1454('0x3f')](_0x4fb7e4);})[_0x1454('0x23')](function(_0x3cc6ff){_0x4a10f4['rows']=_0x3cc6ff;return _0x4a10f4;})[_0x1454('0x23')](respondWithFilteredResult(_0x5b3f59,_0x4fb7e4))[_0x1454('0x40')](handleError(_0x5b3f59,null));})[_0x1454('0x40')](handleError(_0x5b3f59,null));};exports[_0x1454('0x41')]=function(_0x19ef8d,_0x254ea8){var _0xb292b3={'raw':![],'where':{'id':_0x19ef8d[_0x1454('0x42')]['id']}},_0x453916={};_0x453916[_0x1454('0x2c')]=_[_0x1454('0x2d')](db[_0x1454('0x2a')]['rawAttributes']);_0x453916['query']=_[_0x1454('0x2d')](_0x19ef8d['query']);_0x453916[_0x1454('0x36')]=_[_0x1454('0x2f')](_0x453916[_0x1454('0x2c')],_0x453916[_0x1454('0x2e')]);_0xb292b3[_0x1454('0x31')]=_[_0x1454('0x2f')](_0x453916[_0x1454('0x2c')],qs[_0x1454('0x30')](_0x19ef8d[_0x1454('0x2e')]['fields']));_0xb292b3[_0x1454('0x31')]=_0xb292b3['attributes']['length']?_0xb292b3[_0x1454('0x31')]:_0x453916[_0x1454('0x2c')];if(_0x19ef8d[_0x1454('0x2e')][_0x1454('0x3d')]){_0xb292b3['include']=[{'all':!![]}];}_0xb292b3=_[_0x1454('0x39')]({},_0xb292b3,_0x19ef8d[_0x1454('0x3b')]);return db['CmCompany'][_0x1454('0x43')](_0xb292b3)[_0x1454('0x23')](handleEntityNotFound(_0x254ea8,null))[_0x1454('0x23')](respondWithResult(_0x254ea8,null))[_0x1454('0x40')](handleError(_0x254ea8,null));};exports[_0x1454('0x44')]=function(_0xc7fb0f,_0x282e71){return db['CmCompany']['create'](_0xc7fb0f[_0x1454('0x45')],{})[_0x1454('0x23')](function(_0x150f4d){var _0x476548=_0xc7fb0f[_0x1454('0x46')][_0x1454('0x24')]({'plain':!![]});if(!_0x476548)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x476548[_0x1454('0x47')]===_0x1454('0x46')){var _0x830dad=_0x150f4d['get']({'plain':!![]});var _0x148bb9=_0x1454('0x48');return db[_0x1454('0x49')][_0x1454('0x43')]({'where':{'name':_0x148bb9,'userProfileId':_0x476548['userProfileId']},'raw':!![]})[_0x1454('0x23')](function(_0x4af3c1){if(_0x4af3c1&&_0x4af3c1[_0x1454('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x830dad[_0x1454('0x28')],'resourceId':_0x830dad['id'],'type':_0x4af3c1[_0x1454('0x28')],'sectionId':_0x4af3c1['id']},{})[_0x1454('0x23')](function(){return _0x150f4d;});}else{return _0x150f4d;}})[_0x1454('0x40')](function(_0x37fb25){logger[_0x1454('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37fb25);throw _0x37fb25;});}return _0x150f4d;})[_0x1454('0x23')](respondWithResult(_0x282e71,0xc9))[_0x1454('0x40')](handleError(_0x282e71,null));};exports[_0x1454('0x22')]=function(_0x1805ff,_0x41d462){if(_0x1805ff[_0x1454('0x45')]['id']){delete _0x1805ff[_0x1454('0x45')]['id'];}return db[_0x1454('0x2a')][_0x1454('0x43')]({'where':{'id':_0x1805ff[_0x1454('0x42')]['id']}})[_0x1454('0x23')](handleEntityNotFound(_0x41d462,null))[_0x1454('0x23')](saveUpdates(_0x1805ff[_0x1454('0x45')],null))['then'](respondWithResult(_0x41d462,null))[_0x1454('0x40')](handleError(_0x41d462,null));};exports[_0x1454('0x4b')]=function(_0x173cd4,_0x55a425){return db['CmCompany'][_0x1454('0x43')]({'where':{'id':_0x173cd4[_0x1454('0x42')]['id']}})[_0x1454('0x23')](handleEntityNotFound(_0x55a425,null))[_0x1454('0x23')](removeEntity(_0x55a425,null))[_0x1454('0x40')](handleError(_0x55a425,null));};exports[_0x1454('0x2b')]=function(_0xa6040,_0x459a3f){return db['CmCompany'][_0x1454('0x2b')]()[_0x1454('0x23')](respondWithResult(_0x459a3f,null))[_0x1454('0x40')](handleError(_0x459a3f,null));};exports[_0x1454('0x4c')]=function(_0x461554,_0x52858b,_0x434583){return db[_0x1454('0x4d')][_0x1454('0x43')]({'where':{'id':_0x461554[_0x1454('0x42')]['id']}})[_0x1454('0x23')](handleEntityNotFound(_0x52858b,null))[_0x1454('0x23')](function(_0x54307e){if(_0x54307e){return _0x54307e['addContacts'](_0x461554[_0x1454('0x45')]['ids'],_[_0x1454('0x4e')](_0x461554[_0x1454('0x45')],[_0x1454('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x52858b,null))[_0x1454('0x40')](handleError(_0x52858b,null));};exports['getContacts']=function(_0x4a24e6,_0x32d42a,_0x3c151a){var _0xb9eefc={};var _0x2f0148={};var _0x54cbd5;var _0x57bcfd;return db['CmCompany'][_0x1454('0x50')]({'where':{'id':_0x4a24e6[_0x1454('0x42')]['id']}})[_0x1454('0x23')](handleEntityNotFound(_0x32d42a,null))[_0x1454('0x23')](function(_0x22331a){if(_0x22331a){_0x54cbd5=_0x22331a;_0x2f0148['model']=_['keys'](db[_0x1454('0x4d')][_0x1454('0x51')]);_0x2f0148[_0x1454('0x2e')]=_[_0x1454('0x2d')](_0x4a24e6[_0x1454('0x2e')]);_0x2f0148[_0x1454('0x36')]=_[_0x1454('0x2f')](_0x2f0148[_0x1454('0x2c')],_0x2f0148[_0x1454('0x2e')]);_0xb9eefc[_0x1454('0x31')]=_[_0x1454('0x2f')](_0x2f0148['model'],qs[_0x1454('0x30')](_0x4a24e6['query'][_0x1454('0x30')]));_0xb9eefc[_0x1454('0x31')]=_0xb9eefc[_0x1454('0x31')][_0x1454('0x32')]?_0xb9eefc[_0x1454('0x31')]:_0x2f0148[_0x1454('0x2c')];_0xb9eefc[_0x1454('0x52')]=qs[_0x1454('0x34')](_0x4a24e6[_0x1454('0x2e')][_0x1454('0x34')]);_0xb9eefc['where']=qs[_0x1454('0x36')](_[_0x1454('0x37')](_0x4a24e6[_0x1454('0x2e')],_0x2f0148[_0x1454('0x36')]));if(_0x4a24e6['query']['filter']){_0xb9eefc[_0x1454('0x35')]=_['merge'](_0xb9eefc[_0x1454('0x35')],{'$or':_['map'](_0xb9eefc['attributes'],function(_0x11e4cc){var _0x657e6={};_0x657e6[_0x11e4cc]={'$like':'%'+_0x4a24e6[_0x1454('0x2e')][_0x1454('0x38')]+'%'};return _0x657e6;})});}_0xb9eefc=_[_0x1454('0x39')]({},_0xb9eefc,_0x4a24e6['options']);return _0x54cbd5[_0x1454('0x53')](_0xb9eefc);}})[_0x1454('0x23')](function(_0x30953a){if(_0x30953a){_0x57bcfd=_0x30953a[_0x1454('0x32')];if(!_0x4a24e6[_0x1454('0x2e')][_0x1454('0x54')](_0x1454('0x33'))){_0xb9eefc[_0x1454('0x1d')]=qs['limit'](_0x4a24e6[_0x1454('0x2e')][_0x1454('0x1d')]);_0xb9eefc['offset']=qs[_0x1454('0x1c')](_0x4a24e6[_0x1454('0x2e')]['offset']);}return _0x54cbd5[_0x1454('0x53')](_0xb9eefc);}})[_0x1454('0x23')](function(_0x568ba9){if(_0x568ba9){return _0x568ba9?{'count':_0x57bcfd,'rows':_0x568ba9}:null;}})['then'](respondWithResult(_0x32d42a,null))[_0x1454('0x40')](handleError(_0x32d42a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 0cd885c..ce35655 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 _0x64f5=['./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','moment','request-promise','path','../../config/environment'];(function(_0x2a754a,_0x2b3f57){var _0x2b54f7=function(_0x2369b1){while(--_0x2369b1){_0x2a754a['push'](_0x2a754a['shift']());}};_0x2b54f7(++_0x2b3f57);}(_0x64f5,0x17e));var _0x564f=function(_0x9cf809,_0x14d9bb){_0x9cf809=_0x9cf809-0x0;var _0x27b065=_0x64f5[_0x9cf809];return _0x27b065;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x564f('0x1'));var BPromise=require('bluebird');var rp=require(_0x564f('0x2'));var fs=require('fs');var path=require(_0x564f('0x3'));var rimraf=require('rimraf');var config=require(_0x564f('0x4'));var attributes=require(_0x564f('0x5'));module[_0x564f('0x6')]=function(_0x72b009,_0x4bbedf){return _0x72b009['define'](_0x564f('0x7'),attributes,{'tableName':_0x564f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9491=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_companies'];(function(_0x5c580e,_0x3970e2){var _0x430ff4=function(_0x1865c2){while(--_0x1865c2){_0x5c580e['push'](_0x5c580e['shift']());}};_0x430ff4(++_0x3970e2);}(_0x9491,0xb6));var _0x1949=function(_0x2dfc90,_0x46a536){_0x2dfc90=_0x2dfc90-0x0;var _0x4ccb06=_0x9491[_0x2dfc90];return _0x4ccb06;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var logger=require(_0x1949('0x2'))(_0x1949('0x3'));var moment=require(_0x1949('0x4'));var BPromise=require(_0x1949('0x5'));var rp=require(_0x1949('0x6'));var fs=require('fs');var path=require(_0x1949('0x7'));var rimraf=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var attributes=require('./cmCompany.attributes');module[_0x1949('0xa')]=function(_0x5b01b9,_0x14c30e){return _0x5b01b9[_0x1949('0xb')]('CmCompany',attributes,{'tableName':_0x1949('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 1581fbe..8fcba13 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 _0x8ba9=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ba9,0x80));var _0x98ba=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x8ba9[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x98ba('0x0'));var util=require('util');var moment=require(_0x98ba('0x1'));var BPromise=require(_0x98ba('0x2'));var rs=require(_0x98ba('0x3'));var fs=require('fs');var Redis=require(_0x98ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98ba('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x98ba('0x6'));var jayson=require(_0x98ba('0x7'));var client=jayson[_0x98ba('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f37c3,_0x1435a0,_0xcf256c){return new BPromise(function(_0x4953ba,_0x46299e){return client[_0x98ba('0x9')](_0x2f37c3,_0xcf256c)['then'](function(_0x1e7aa0){logger[_0x98ba('0xa')](_0x98ba('0xb'),_0x1435a0,_0x98ba('0xc'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x1435a0,'request\x20sent',JSON['stringify'](_0x1e7aa0));if(_0x1e7aa0['error']){if(_0x1e7aa0[_0x98ba('0xd')][_0x98ba('0xe')]===0x1f4){logger[_0x98ba('0xd')]('CmCompany,\x20%s,\x20%s',_0x1435a0,_0x1e7aa0[_0x98ba('0xd')]['message']);return _0x46299e(_0x1e7aa0[_0x98ba('0xd')]['message']);}logger['error'](_0x98ba('0xb'),_0x1435a0,_0x1e7aa0[_0x98ba('0xd')][_0x98ba('0xf')]);return _0x4953ba(_0x1e7aa0[_0x98ba('0xd')]['message']);}else{logger['info'](_0x98ba('0xb'),_0x1435a0,'request\x20sent');_0x4953ba(_0x1e7aa0[_0x98ba('0x10')][_0x98ba('0xf')]);}})[_0x98ba('0x11')](function(_0x29d89e){logger[_0x98ba('0xd')](_0x98ba('0xb'),_0x1435a0,_0x29d89e);_0x46299e(_0x29d89e);});});} \ No newline at end of file +var _0xa3d3=['../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2a6f07,_0x62162b){var _0x1a421b=function(_0x167513){while(--_0x167513){_0x2a6f07['push'](_0x2a6f07['shift']());}};_0x1a421b(++_0x62162b);}(_0xa3d3,0x70));var _0x3a3d=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xa3d3[_0x20a558];return _0x53d3f7;};'use strict';var _=require('lodash');var util=require(_0x3a3d('0x0'));var moment=require(_0x3a3d('0x1'));var BPromise=require(_0x3a3d('0x2'));var rs=require(_0x3a3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a3d('0x4'))['db'];var utils=require(_0x3a3d('0x5'));var logger=require(_0x3a3d('0x6'))(_0x3a3d('0x7'));var config=require(_0x3a3d('0x8'));var jayson=require(_0x3a3d('0x9'));var client=jayson[_0x3a3d('0xa')][_0x3a3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16e59d,_0x3e1961,_0x13a108){return new BPromise(function(_0x42415e,_0x547e96){return client[_0x3a3d('0xc')](_0x16e59d,_0x13a108)[_0x3a3d('0xd')](function(_0x18bc37){logger[_0x3a3d('0xe')](_0x3a3d('0xf'),_0x3e1961,_0x3a3d('0x10'));logger[_0x3a3d('0x11')](_0x3a3d('0x12'),_0x3e1961,_0x3a3d('0x10'),JSON['stringify'](_0x18bc37));if(_0x18bc37['error']){if(_0x18bc37[_0x3a3d('0x13')][_0x3a3d('0x14')]===0x1f4){logger[_0x3a3d('0x13')]('CmCompany,\x20%s,\x20%s',_0x3e1961,_0x18bc37[_0x3a3d('0x13')][_0x3a3d('0x15')]);return _0x547e96(_0x18bc37['error'][_0x3a3d('0x15')]);}logger['error'](_0x3a3d('0xf'),_0x3e1961,_0x18bc37['error'][_0x3a3d('0x15')]);return _0x42415e(_0x18bc37[_0x3a3d('0x13')]['message']);}else{logger[_0x3a3d('0xe')](_0x3a3d('0xf'),_0x3e1961,_0x3a3d('0x10'));_0x42415e(_0x18bc37[_0x3a3d('0x16')][_0x3a3d('0x15')]);}})[_0x3a3d('0x17')](function(_0x32114f){logger[_0x3a3d('0x13')](_0x3a3d('0xf'),_0x3e1961,_0x32114f);_0x547e96(_0x32114f);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b1bbece..d1fd22c 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 _0xd495=['/describe','describe','/:id','show','create','post','/:id/contacts','addContacts','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated'];(function(_0x51105e,_0x3d1c44){var _0x4b8768=function(_0x5df2e8){while(--_0x5df2e8){_0x51105e['push'](_0x51105e['shift']());}};_0x4b8768(++_0x3d1c44);}(_0xd495,0x16a));var _0x5d49=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xd495[_0x1b70e3];return _0x1452ab;};'use strict';var multer=require(_0x5d49('0x0'));var util=require(_0x5d49('0x1'));var path=require(_0x5d49('0x2'));var timeout=require(_0x5d49('0x3'));var express=require('express');var router=express[_0x5d49('0x4')]();var fs_extra=require(_0x5d49('0x5'));var auth=require(_0x5d49('0x6'));var interaction=require(_0x5d49('0x7'));var config=require(_0x5d49('0x8'));var controller=require(_0x5d49('0x9'));router[_0x5d49('0xa')]('/',auth[_0x5d49('0xb')](),controller['index']);router[_0x5d49('0xa')](_0x5d49('0xc'),auth[_0x5d49('0xb')](),controller[_0x5d49('0xd')]);router['get'](_0x5d49('0xe'),auth['isAuthenticated'](),controller[_0x5d49('0xf')]);router['get']('/:id/contacts',auth[_0x5d49('0xb')](),controller['getContacts']);router['post']('/',auth[_0x5d49('0xb')](),controller[_0x5d49('0x10')]);router[_0x5d49('0x11')](_0x5d49('0x12'),auth[_0x5d49('0xb')](),controller[_0x5d49('0x13')]);router['put'](_0x5d49('0xe'),auth[_0x5d49('0xb')](),controller['update']);router['delete'](_0x5d49('0xe'),auth['isAuthenticated'](),controller[_0x5d49('0x14')]);module[_0x5d49('0x15')]=router; \ No newline at end of file +var _0x0694=['/:id','show','post','create','addContacts','put','delete','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x5e6e79,_0x428766){var _0x296041=function(_0x34e495){while(--_0x34e495){_0x5e6e79['push'](_0x5e6e79['shift']());}};_0x296041(++_0x428766);}(_0x0694,0x10c));var _0x4069=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x0694[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x4069('0x0'));var util=require(_0x4069('0x1'));var path=require(_0x4069('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4069('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4069('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4069('0x5'));var controller=require(_0x4069('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4069('0x7')]);router[_0x4069('0x8')](_0x4069('0x9'),auth[_0x4069('0xa')](),controller[_0x4069('0xb')]);router[_0x4069('0x8')](_0x4069('0xc'),auth[_0x4069('0xa')](),controller[_0x4069('0xd')]);router[_0x4069('0x8')]('/:id/contacts',auth[_0x4069('0xa')](),controller['getContacts']);router[_0x4069('0xe')]('/',auth[_0x4069('0xa')](),controller[_0x4069('0xf')]);router['post']('/:id/contacts',auth[_0x4069('0xa')](),controller[_0x4069('0x10')]);router[_0x4069('0x11')](_0x4069('0xc'),auth[_0x4069('0xa')](),controller['update']);router[_0x4069('0x12')](_0x4069('0xc'),auth[_0x4069('0xa')](),controller['destroy']);module[_0x4069('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 792f46a..d2d4b72 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 _0x1cfd=['STRING','NOW','lodash','sequelize','exports'];(function(_0x3ec876,_0x2875ce){var _0x3766ea=function(_0x1dc501){while(--_0x1dc501){_0x3ec876['push'](_0x3ec876['shift']());}};_0x3766ea(++_0x2875ce);}(_0x1cfd,0xc0));var _0xd1cf=function(_0x4e2adc,_0x35a852){_0x4e2adc=_0x4e2adc-0x0;var _0x4113e2=_0x1cfd[_0x4e2adc];return _0x4113e2;};'use strict';var _=require(_0xd1cf('0x0'));var Sequelize=require(_0xd1cf('0x1'));module[_0xd1cf('0x2')]={'firstName':{'type':Sequelize[_0xd1cf('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd1cf('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xd1cf('0x3')]},'city':{'type':Sequelize[_0xd1cf('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xd1cf('0x3')]},'mobile':{'type':Sequelize[_0xd1cf('0x3')]},'fax':{'type':Sequelize[_0xd1cf('0x3')]},'email':{'type':Sequelize[_0xd1cf('0x3')]},'url':{'type':Sequelize[_0xd1cf('0x3')]},'facebook':{'type':Sequelize[_0xd1cf('0x3')]},'fb_data':{'type':Sequelize[_0xd1cf('0x3')]},'twitter':{'type':Sequelize[_0xd1cf('0x3')]},'skype':{'type':Sequelize[_0xd1cf('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xd1cf('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xd1cf('0x3')]},'telegram':{'type':Sequelize[_0xd1cf('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xd1cf('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xd1cf('0x4')]}}; \ No newline at end of file +var _0xc6df=['UNSIGNED','DATE','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x21d8a1,_0xa1efc1){var _0x660307=function(_0x30dfb6){while(--_0x30dfb6){_0x21d8a1['push'](_0x21d8a1['shift']());}};_0x660307(++_0xa1efc1);}(_0xc6df,0xe2));var _0xfc6d=function(_0x587179,_0x1d554d){_0x587179=_0x587179-0x0;var _0x10024d=_0xc6df[_0x587179];return _0x10024d;};'use strict';var _=require('lodash');var Sequelize=require(_0xfc6d('0x0'));module[_0xfc6d('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xfc6d('0x2')]},'street':{'type':Sequelize[_0xfc6d('0x2')]},'postalCode':{'type':Sequelize[_0xfc6d('0x2')]},'city':{'type':Sequelize[_0xfc6d('0x2')]},'country':{'type':Sequelize[_0xfc6d('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfc6d('0x3')]},'phone':{'type':Sequelize[_0xfc6d('0x2')]},'mobile':{'type':Sequelize[_0xfc6d('0x2')]},'fax':{'type':Sequelize[_0xfc6d('0x2')]},'email':{'type':Sequelize[_0xfc6d('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xfc6d('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xfc6d('0x2')]},'skype':{'type':Sequelize[_0xfc6d('0x2')]},'teams':{'type':Sequelize[_0xfc6d('0x2')]},'viber':{'type':Sequelize[_0xfc6d('0x2')]},'line':{'type':Sequelize[_0xfc6d('0x2')]},'wechat':{'type':Sequelize[_0xfc6d('0x2')]},'telegram':{'type':Sequelize[_0xfc6d('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xfc6d('0x2')]},'priority':{'type':Sequelize[_0xfc6d('0x4')](0x2)[_0xfc6d('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfc6d('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b84d3cc..6234bfd 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 _0x4bc3=['chat','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','starttime','duration','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','Website','Account','closed','closedAt','note','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','sortBy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','CmContact','describe','keys','cf_','push','CmCustomField','findOne','trimStart','all','length','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','field','color','from','tools_tags','select','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','and','uc.UserId\x20=\x20?','datetime','castTo','DATE','buildExpression','text','map','filter','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','clone','having','t.id\x20IN\x20?','resolve','user','role','agent','some','User','c.ListId\x20IS\x20NULL','toString','count','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','find','params','tags','columnName','displayName','findAll','alias','values','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','join','bulkCreate','each','duplicates','$or','spread','show','Tag','Phones','ItemType','sequelize','literal','log','$and','omit','pickBy','format','cf_%d','setFields','phone','getTags','rawAttributes','sort','setTags','items','item_types','undefined','contact\x20phone\x20exists','CmHopperAdditionalPhone','PHONE','ContactItemType','OrderBy','item','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','CmHopperHistory','ContactId','options','include','rows','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','mail'];(function(_0x1b54f5,_0x83ee6a){var _0x3b9975=function(_0x20762a){while(--_0x20762a){_0x1b54f5['push'](_0x1b54f5['shift']());}};_0x3b9975(++_0x83ee6a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x4bc3[_0x176329];return _0x31997c;};'use strict';var pdf=require(_0x34bc('0x0'));var emlformat=require(_0x34bc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x34bc('0x2'));var jsonpatch=require(_0x34bc('0x3'));var rp=require('request-promise');var moment=require(_0x34bc('0x4'));var BPromise=require(_0x34bc('0x5'));var Mustache=require(_0x34bc('0x6'));var util=require(_0x34bc('0x7'));var path=require(_0x34bc('0x8'));var sox=require(_0x34bc('0x9'));var csv=require(_0x34bc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34bc('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x34bc('0xc'));var jsforce=require(_0x34bc('0xd'));var deskjs=require(_0x34bc('0xe'));var toCsv=require(_0x34bc('0xa'));var querystring=require(_0x34bc('0xf'));var Papa=require(_0x34bc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x34bc('0x11'));var as=require(_0x34bc('0x12'));var hardwareService=require(_0x34bc('0x13'));var logger=require('../../config/logger')(_0x34bc('0x14'));var utils=require('../../config/utils');var config=require(_0x34bc('0x15'));var licenseUtil=require(_0x34bc('0x16'));var db=require(_0x34bc('0x17'))['db'];config['redis']=_[_0x34bc('0x18')](config['redis'],{'host':_0x34bc('0x19'),'port':0x18eb});var socket=require(_0x34bc('0x1a'))(new Redis(config[_0x34bc('0x1b')]));require('./cmContact.socket')['register'](socket);function respondWithStatusCode(_0x354868,_0x5e691b){_0x5e691b=_0x5e691b||0xcc;return function(_0x3e93bf){if(_0x3e93bf){return _0x354868[_0x34bc('0x1c')](_0x5e691b);}return _0x354868[_0x34bc('0x1d')](_0x5e691b)[_0x34bc('0x1e')]();};}function respondWithResult(_0x2db2dd,_0x69542f){_0x69542f=_0x69542f||0xc8;return function(_0x5e132d){if(_0x5e132d){return _0x2db2dd['status'](_0x69542f)['json'](_0x5e132d);}};}function respondWithFilteredResult(_0x4205eb,_0x3eaedf){return function(_0x30282b){if(_0x30282b){var _0x239e6c=_0x30282b['count'],_0x567eee=_0x3eaedf[_0x34bc('0x1f')],_0x46aa24=_0x3eaedf[_0x34bc('0x1f')]+_0x3eaedf['limit'],_0x3ca9e8;if(_0x46aa24>=_0x239e6c){_0x46aa24=_0x239e6c;_0x3ca9e8=0xc8;}else{_0x3ca9e8=0xce;}_0x4205eb[_0x34bc('0x1d')](_0x3ca9e8);return _0x4205eb[_0x34bc('0x20')](_0x34bc('0x21'),_0x567eee+'-'+_0x46aa24+'/'+_0x239e6c)[_0x34bc('0x22')](_0x30282b);}return null;};}function patchUpdates(_0x1f993b){return function(_0x42c814){try{jsonpatch['apply'](_0x42c814,_0x1f993b,!![]);}catch(_0x40e128){return BPromise[_0x34bc('0x23')](_0x40e128);}return _0x42c814[_0x34bc('0x24')]();};}function saveUpdates(_0x48eb94,_0x4c4b9a){return function(_0x358d51){if(_0x358d51){return _0x358d51[_0x34bc('0x25')](_0x48eb94)[_0x34bc('0x26')](function(_0x410800){return _0x410800;});}return null;};}function removeEntity(_0x13094a,_0x2e22e3){return function(_0x3f3653){if(_0x3f3653){return _0x3f3653[_0x34bc('0x27')]()[_0x34bc('0x26')](function(){_0x13094a[_0x34bc('0x1d')](0xcc)[_0x34bc('0x1e')]();});}};}function handleEntityNotFound(_0x1edcb0,_0x4fd589){return function(_0x43e527){if(!_0x43e527){_0x1edcb0['sendStatus'](0x194);}return _0x43e527;};}function handleError(_0x4b76c7,_0x3da96b){_0x3da96b=_0x3da96b||0x1f4;return function(_0x5332c8){logger[_0x34bc('0x28')](_0x5332c8[_0x34bc('0x29')]);if(_0x5332c8[_0x34bc('0x2a')]){delete _0x5332c8['name'];}_0x4b76c7[_0x34bc('0x1d')](_0x3da96b)[_0x34bc('0x2b')](_0x5332c8);};}exports[_0x34bc('0x2c')]=function(_0x1a83f7,_0x2bb874){var _0x33bf46={},_0x520fd4={},_0xff07bd={'count':0x0,'rows':[]};return db[_0x34bc('0x2d')][_0x34bc('0x2e')]()[_0x34bc('0x26')](function(_0x2241b4){var _0xd92957=[];for(var _0x5b37de=0x0;_0x5b37de0x1){_0x2db155['or'](_0x34bc('0x6b'),qs[_0x34bc('0x6c')](_0x6b42f7),null);}else{if(qs[_0x34bc('0x6d')](_0x6b42f7)){_0x2db155['or'](_0x34bc('0x6e'),_0x6b42f7+'%');_0x2db155['or'](_0x34bc('0x6f'),_0x6b42f7+'%');_0x2db155['or'](_0x34bc('0x70'),_0x6b42f7+'%');_0x2db155['or'](_0x34bc('0x71'),_0x6b42f7+'%');}else if(qs[_0x34bc('0x72')](_0x6b42f7)){_0x2db155['or'](_0x34bc('0x73'),_0x6b42f7+'%');}else{_0x2db155['or']('c.firstName\x20LIKE\x20?','%'+_0x6b42f7+'%');_0x2db155['or'](_0x34bc('0x74'),'%'+_0x6b42f7+'%');_0x2db155['or'](_0x34bc('0x73'),'%'+_0x6b42f7+'%');}}}}_0x3444ea[_0x34bc('0x43')](_0x2db155);_0x3444ea['group'](_0x34bc('0x75'));var _0x295420={'type':db[_0x34bc('0x76')][_0x34bc('0x77')]['SELECT'],'raw':!![]};var _0x375aff=_0x3444ea[_0x34bc('0x78')]()[_0x34bc('0x45')](_0x34bc('0x75'));if(_0x33bf46[_0x34bc('0x42')]){_0x33bf46[_0x34bc('0x42')][_0x34bc('0x57')](function(_0x3b8f72){_0x3444ea['order']('c.'+_0x3b8f72[0x0],_0x3b8f72[0x1]==='DESC'?![]:!![]);});}if(!_[_0x34bc('0x63')](_0x3c25a3)){_0x3444ea[_0x34bc('0x79')](_0x4f912a);_0x375aff[_0x34bc('0x43')](_0x34bc('0x7a'),_0x3c25a3);}BPromise[_0x34bc('0x7b')]()[_0x34bc('0x26')](function(){if(!_0x2a21b4)return;if(_0x1a83f7[_0x34bc('0x7c')][_0x34bc('0x7d')]!==_0x34bc('0x7e'))return;if(!_[_0x34bc('0x7f')](_0x2a21b4[_0x34bc('0x54')],[_0x34bc('0x45'),_0x34bc('0x80')])){return _0x1a83f7[_0x34bc('0x7c')]['getLists']({'attributes':['id'],'raw':!![]})[_0x34bc('0x26')](function(_0x2dc1df){if(_[_0x34bc('0x63')](_0x2dc1df)){_0x375aff['where'](_0x34bc('0x81'));_0x3444ea[_0x34bc('0x43')](_0x34bc('0x81'));}else{_0x375aff[_0x34bc('0x43')]('c.ListId\x20IN\x20?',_[_0x34bc('0x60')](_0x2dc1df,'id'));_0x3444ea[_0x34bc('0x43')](_0x34bc('0x65'),_[_0x34bc('0x60')](_0x2dc1df,'id'));}});}})[_0x34bc('0x26')](function(){if(_0x1a83f7['user'][_0x34bc('0x7d')]===_0x34bc('0x7e')&&!_0x2a21b4&&!_0x1a83f7[_0x34bc('0x3a')][_0x34bc('0x64')])return[];return db['sequelize'][_0x34bc('0x3a')](_0x375aff[_0x34bc('0x82')](),_0x295420);})[_0x34bc('0x26')](function(_0x2915ec){_0xff07bd[_0x34bc('0x83')]=_0x2915ec[_0x34bc('0x36')];if(_0xff07bd['count']===0x0)return[];return db['sequelize'][_0x34bc('0x3a')](_0x2d98ad[_0x34bc('0x82')](),_0x295420)['then'](function(_0x348002){_0x11ab9c=_[_0x34bc('0x84')](_0x348002,'id');_0x295420=_[_0x34bc('0x85')](_0x295420,{'model':db[_0x34bc('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a83f7['query']['fields']){_0x33bf46[_0x34bc('0x3d')][_0x34bc('0x57')](function(_0x1892b1){_0x3444ea[_0x34bc('0x45')]('c.'+_0x1892b1);});}else{_0x3444ea[_0x34bc('0x45')](_0x34bc('0x75'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x86'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x87'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x88'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x89'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x8a'));_0x3444ea['field'](_0x34bc('0x8b'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x8c'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x8d'));_0x3444ea['field'](_0x34bc('0x8e'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x8f'));_0x3444ea[_0x34bc('0x45')](_0x34bc('0x90'),'TagIds');}if(_0x33bf46[_0x34bc('0x41')])_0x3444ea[_0x34bc('0x41')](_0x33bf46[_0x34bc('0x41')]);if(_0x33bf46[_0x34bc('0x1f')])_0x3444ea[_0x34bc('0x1f')](_0x33bf46[_0x34bc('0x1f')]);return db['sequelize'][_0x34bc('0x3a')](_0x3444ea[_0x34bc('0x82')](),_0x295420);});})['then'](function(_0x345aa1){_0x345aa1[_0x34bc('0x57')](function(_0xd0213e){if(_0xd0213e['TagIds']){_0xd0213e['Tags']=[];_0xd0213e[_0x34bc('0x91')]['split'](',')['forEach'](function(_0x55055d){_0xd0213e[_0x34bc('0x92')][_0x34bc('0x31')](_0x11ab9c[_0x55055d]);});}delete _0xd0213e[_0x34bc('0x91')];});_0xff07bd['rows']=_0x345aa1;return _0xff07bd;})[_0x34bc('0x26')](respondWithFilteredResult(_0x2bb874,_0x33bf46));})[_0x34bc('0x93')](handleError(_0x2bb874,null));};exports[_0x34bc('0x27')]=function(_0xc3bd23,_0x142231){return db[_0x34bc('0x2d')][_0x34bc('0x94')]({'where':{'id':_0xc3bd23[_0x34bc('0x95')]['id']}})[_0x34bc('0x26')](handleEntityNotFound(_0x142231,null))[_0x34bc('0x26')](removeEntity(_0x142231,null))[_0x34bc('0x93')](handleError(_0x142231,null));};exports[_0x34bc('0x2e')]=function(_0x5a37a3,_0x5d9b43){return db[_0x34bc('0x2d')][_0x34bc('0x2e')]()[_0x34bc('0x26')](function(_0x2423a3){delete _0x2423a3[_0x34bc('0x96')];for(var _0x16d942=0x0;_0x16d942=_0x210669){_0x246b67=_0x210669;_0x379a43=0xc8;}else{_0x379a43=0xce;}_0x6bebf4[_0x7c99('0x20')](_0x379a43);return _0x6bebf4[_0x7c99('0x24')](_0x7c99('0x25'),_0x32306b+'-'+_0x246b67+'/'+_0x210669)['json'](_0x7baa0b);}return null;};}function patchUpdates(_0x53ec6b){return function(_0x4878ea){try{jsonpatch['apply'](_0x4878ea,_0x53ec6b,!![]);}catch(_0x598a89){return BPromise[_0x7c99('0x26')](_0x598a89);}return _0x4878ea[_0x7c99('0x27')]();};}function saveUpdates(_0x5e37d0,_0xbe266d){return function(_0x117e0b){if(_0x117e0b){return _0x117e0b[_0x7c99('0x28')](_0x5e37d0)[_0x7c99('0x29')](function(_0x5dceaf){return _0x5dceaf;});}return null;};}function removeEntity(_0x178e99,_0x3d2c44){return function(_0x43474b){if(_0x43474b){return _0x43474b[_0x7c99('0x2a')]()[_0x7c99('0x29')](function(){_0x178e99[_0x7c99('0x20')](0xcc)[_0x7c99('0x21')]();});}};}function handleEntityNotFound(_0xbd1712,_0x80857d){return function(_0xdbe0e8){if(!_0xdbe0e8){_0xbd1712[_0x7c99('0x1f')](0x194);}return _0xdbe0e8;};}function handleError(_0x35be2a,_0x57349a){_0x57349a=_0x57349a||0x1f4;return function(_0x48519c){logger[_0x7c99('0x2b')](_0x48519c['stack']);if(_0x48519c[_0x7c99('0x2c')]){delete _0x48519c[_0x7c99('0x2c')];}_0x35be2a[_0x7c99('0x20')](_0x57349a)[_0x7c99('0x2d')](_0x48519c);};}exports[_0x7c99('0x2e')]=function(_0x395494,_0x98ab97){var _0x4d084e={},_0x5e975e={},_0x58b20f={'count':0x0,'rows':[]};return db[_0x7c99('0x2f')][_0x7c99('0x30')]()[_0x7c99('0x29')](function(_0x1321cf){var _0x361c99=[];for(var _0x1f894a=0x0;_0x1f894a0x1){_0x206931['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7c99('0x6e')](_0x3d48fa),null);}else{if(qs['isNumeric'](_0x3d48fa)){_0x206931['or'](_0x7c99('0x6f'),_0x3d48fa+'%');_0x206931['or'](_0x7c99('0x70'),_0x3d48fa+'%');_0x206931['or'](_0x7c99('0x71'),_0x3d48fa+'%');_0x206931['or'](_0x7c99('0x72'),_0x3d48fa+'%');}else if(qs[_0x7c99('0x73')](_0x3d48fa)){_0x206931['or'](_0x7c99('0x74'),_0x3d48fa+'%');}else{_0x206931['or'](_0x7c99('0x75'),'%'+_0x3d48fa+'%');_0x206931['or']('c.lastName\x20LIKE\x20?','%'+_0x3d48fa+'%');_0x206931['or'](_0x7c99('0x74'),'%'+_0x3d48fa+'%');}}}}_0x3fb326['where'](_0x206931);_0x3fb326[_0x7c99('0x76')](_0x7c99('0x77'));var _0x31b2eb={'type':db['Sequelize'][_0x7c99('0x78')][_0x7c99('0x79')],'raw':!![]};var _0x28982e=_0x3fb326[_0x7c99('0x7a')]()[_0x7c99('0x46')](_0x7c99('0x77'));if(_0x4d084e['order']){_0x4d084e['order']['forEach'](function(_0x168d04){_0x3fb326['order']('c.'+_0x168d04[0x0],_0x168d04[0x1]===_0x7c99('0x7b')?![]:!![]);});}if(!_[_0x7c99('0x7c')](_0x550623)){_0x3fb326[_0x7c99('0x7d')](_0x2c6c11);_0x28982e[_0x7c99('0x66')](_0x7c99('0x7e'),_0x550623);}BPromise[_0x7c99('0x7f')]()[_0x7c99('0x29')](function(){if(!_0x59e246)return;if(_0x395494[_0x7c99('0x80')][_0x7c99('0x81')]!==_0x7c99('0x82'))return;if(!_[_0x7c99('0x83')](_0x59e246[_0x7c99('0x54')],[_0x7c99('0x46'),_0x7c99('0x5d')])){return _0x395494['user'][_0x7c99('0x84')]({'attributes':['id'],'raw':!![]})[_0x7c99('0x29')](function(_0x42ad18){if(_[_0x7c99('0x7c')](_0x42ad18)){_0x28982e[_0x7c99('0x66')](_0x7c99('0x85'));_0x3fb326[_0x7c99('0x66')]('c.ListId\x20IS\x20NULL');}else{_0x28982e[_0x7c99('0x66')](_0x7c99('0x67'),_[_0x7c99('0x59')](_0x42ad18,'id'));_0x3fb326[_0x7c99('0x66')](_0x7c99('0x67'),_[_0x7c99('0x59')](_0x42ad18,'id'));}});}})[_0x7c99('0x29')](function(){if(_0x395494[_0x7c99('0x80')][_0x7c99('0x81')]===_0x7c99('0x82')&&!_0x59e246&&!_0x395494[_0x7c99('0x3a')][_0x7c99('0x86')])return[];return db[_0x7c99('0x87')][_0x7c99('0x3a')](_0x28982e[_0x7c99('0x88')](),_0x31b2eb);})[_0x7c99('0x29')](function(_0x1d388c){_0x58b20f[_0x7c99('0x22')]=_0x1d388c[_0x7c99('0x32')];if(_0x58b20f['count']===0x0)return[];return db[_0x7c99('0x87')][_0x7c99('0x3a')](_0x552fb3['toString'](),_0x31b2eb)[_0x7c99('0x29')](function(_0x1e7620){_0x35c815=_['keyBy'](_0x1e7620,'id');_0x31b2eb=_[_0x7c99('0x89')](_0x31b2eb,{'model':db[_0x7c99('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x395494[_0x7c99('0x3a')][_0x7c99('0x3d')]){_0x4d084e[_0x7c99('0x3e')]['forEach'](function(_0x2acc7c){_0x3fb326[_0x7c99('0x46')]('c.'+_0x2acc7c);});}else{_0x3fb326[_0x7c99('0x46')]('c.id');_0x3fb326['field'](_0x7c99('0x8a'));_0x3fb326[_0x7c99('0x46')](_0x7c99('0x8b'));_0x3fb326['field'](_0x7c99('0x8c'));_0x3fb326['field']('c.mobile');_0x3fb326[_0x7c99('0x46')](_0x7c99('0x8d'));_0x3fb326['field'](_0x7c99('0x8e'));_0x3fb326[_0x7c99('0x46')](_0x7c99('0x8f'));_0x3fb326[_0x7c99('0x46')](_0x7c99('0x90'));_0x3fb326['field'](_0x7c99('0x91'));_0x3fb326[_0x7c99('0x46')](_0x7c99('0x92'));_0x3fb326['field'](_0x7c99('0x93'),_0x7c99('0x94'));}if(_0x4d084e[_0x7c99('0x41')])_0x3fb326[_0x7c99('0x41')](_0x4d084e[_0x7c99('0x41')]);if(_0x4d084e[_0x7c99('0x23')])_0x3fb326[_0x7c99('0x23')](_0x4d084e[_0x7c99('0x23')]);return db[_0x7c99('0x87')][_0x7c99('0x3a')](_0x3fb326[_0x7c99('0x88')](),_0x31b2eb);});})['then'](function(_0xb74d68){_0xb74d68[_0x7c99('0x5a')](function(_0x4ecf30){if(_0x4ecf30[_0x7c99('0x94')]){_0x4ecf30[_0x7c99('0x95')]=[];_0x4ecf30[_0x7c99('0x94')]['split'](',')[_0x7c99('0x5a')](function(_0x48dcf7){_0x4ecf30['Tags'][_0x7c99('0x35')](_0x35c815[_0x48dcf7]);});}delete _0x4ecf30['TagIds'];});_0x58b20f[_0x7c99('0x96')]=_0xb74d68;return _0x58b20f;})['then'](respondWithFilteredResult(_0x98ab97,_0x4d084e));})['catch'](handleError(_0x98ab97,null));};exports[_0x7c99('0x2a')]=function(_0x5549dc,_0x322e17){return db[_0x7c99('0x2f')][_0x7c99('0x55')]({'where':{'id':_0x5549dc['params']['id']}})[_0x7c99('0x29')](handleEntityNotFound(_0x322e17,null))[_0x7c99('0x29')](removeEntity(_0x322e17,null))['catch'](handleError(_0x322e17,null));};exports[_0x7c99('0x30')]=function(_0x341f78,_0x281077){return db['CmContact'][_0x7c99('0x30')]()[_0x7c99('0x29')](function(_0x15a294){delete _0x15a294[_0x7c99('0x97')];for(var _0x523efe=0x0;_0x523efe{}\s\\|]/g,'-');_0x2d858f(null,util[_0x3d3e('0x21')](_0x3d3e('0x22'),path[_0x3d3e('0x23')](_0x522eba[_0x3d3e('0x1f')],path[_0x3d3e('0x24')](_0x522eba[_0x3d3e('0x1f')])),Date[_0x3d3e('0x25')](),path[_0x3d3e('0x24')](_0x522eba[_0x3d3e('0x1f')])));}})});router[_0x3d3e('0x16')](_0x3d3e('0x26'),upload['single'](_0x3d3e('0x27')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a2989,_0x2cf9cb,_0x54edfa){_0x54edfa(null,path[_0x3d3e('0x28')](config[_0x3d3e('0x1d')],_0x3d3e('0x1e')));},'filename':function(_0x4a6b6a,_0x337c83,_0x1e6f49){_0x337c83[_0x3d3e('0x1f')]=_0x337c83['originalname'][_0x3d3e('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e6f49(null,util['format'](_0x3d3e('0x22'),path['basename'](_0x337c83['originalname'],path['extname'](_0x337c83[_0x3d3e('0x1f')])),Date[_0x3d3e('0x25')](),path[_0x3d3e('0x24')](_0x337c83[_0x3d3e('0x1f')])));}})});router[_0x3d3e('0x16')](_0x3d3e('0x29'),upload[_0x3d3e('0x2a')](_0x3d3e('0x27')),controller[_0x3d3e('0x2b')]);router['post'](_0x3d3e('0x2c'),auth['isAuthenticated'](),controller[_0x3d3e('0x2d')]);router[_0x3d3e('0x16')](_0x3d3e('0x2e'),auth[_0x3d3e('0x9')](),controller['importUpdates']);router[_0x3d3e('0x2f')](_0x3d3e('0xc'),auth[_0x3d3e('0x9')](),controller[_0x3d3e('0x30')]);router[_0x3d3e('0x31')]('/:id',auth['isAuthenticated'](),controller[_0x3d3e('0x32')]);module[_0x3d3e('0x33')]=router; \ No newline at end of file +var _0x5a47=['/:id/tags','getTags','getAdditionalPhones','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/journey','getJourney','post','/merge','merge','create','bulkCreate','setTags','/:id/phones','setAdditionalPhones','/:id/duplicateAdditionalPhones','duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','diskStorage','join','server/files/tmp','originalname','format','%s-%s%s','basename','extname','/csv','single','file','root','replace','now','upload','/upload/:id','import','/uploadUpdates/:id','importUpdates','put','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x14b1fc,_0x477c25){var _0x160a4=function(_0x4ce0bc){while(--_0x4ce0bc){_0x14b1fc['push'](_0x14b1fc['shift']());}};_0x160a4(++_0x477c25);}(_0x5a47,0xa5));var _0x75a4=function(_0x6ed0c9,_0x1a98e7){_0x6ed0c9=_0x6ed0c9-0x0;var _0x28880b=_0x5a47[_0x6ed0c9];return _0x28880b;};'use strict';var multer=require(_0x75a4('0x0'));var util=require(_0x75a4('0x1'));var path=require(_0x75a4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x75a4('0x3'));var auth=require(_0x75a4('0x4'));var interaction=require(_0x75a4('0x5'));var config=require(_0x75a4('0x6'));var controller=require(_0x75a4('0x7'));router[_0x75a4('0x8')]('/',auth[_0x75a4('0x9')](),controller[_0x75a4('0xa')]);router[_0x75a4('0x8')](_0x75a4('0xb'),auth[_0x75a4('0x9')](),controller[_0x75a4('0xc')]);router['get'](_0x75a4('0xd'),auth['isAuthenticated'](),controller[_0x75a4('0xe')]);router['get'](_0x75a4('0xf'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x10')]);router[_0x75a4('0x8')]('/:id/phones',auth['isAuthenticated'](),controller[_0x75a4('0x11')]);router[_0x75a4('0x8')](_0x75a4('0x12'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x13')]);router['get'](_0x75a4('0x14'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x15')]);router[_0x75a4('0x8')](_0x75a4('0x16'),auth[_0x75a4('0x9')](),controller['getHopperFinals']);router[_0x75a4('0x8')]('/:id/jscripty_sessions',auth[_0x75a4('0x9')](),controller['getJscriptySessions']);router['get'](_0x75a4('0x17'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x18')]);router[_0x75a4('0x19')](_0x75a4('0x1a'),auth['isAuthenticated'](),controller[_0x75a4('0x1b')]);router[_0x75a4('0x19')]('/',auth[_0x75a4('0x9')](),controller[_0x75a4('0x1c')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x75a4('0x1d')]);router['post'](_0x75a4('0xf'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x1e')]);router[_0x75a4('0x19')](_0x75a4('0x1f'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x20')]);router[_0x75a4('0x19')](_0x75a4('0x21'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x22')]);router[_0x75a4('0x19')](_0x75a4('0x23'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x24')]);var upload=multer({'storage':multer[_0x75a4('0x25')]({'destination':function(_0x578e8d,_0x5022a1,_0x2b4f25){_0x2b4f25(null,path[_0x75a4('0x26')](config['root'],_0x75a4('0x27')));},'filename':function(_0x229695,_0xb598f0,_0x5a8bef){_0xb598f0[_0x75a4('0x28')]=_0xb598f0['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5a8bef(null,util[_0x75a4('0x29')](_0x75a4('0x2a'),path[_0x75a4('0x2b')](_0xb598f0[_0x75a4('0x28')],path[_0x75a4('0x2c')](_0xb598f0[_0x75a4('0x28')])),Date['now'](),path[_0x75a4('0x2c')](_0xb598f0['originalname'])));}})});router[_0x75a4('0x19')](_0x75a4('0x2d'),upload[_0x75a4('0x2e')](_0x75a4('0x2f')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x75a4('0x25')]({'destination':function(_0x3c27dd,_0x2be856,_0x4109d2){_0x4109d2(null,path[_0x75a4('0x26')](config[_0x75a4('0x30')],'server/files/tmp'));},'filename':function(_0x5a4f14,_0x3099cb,_0x4047a7){_0x3099cb['originalname']=_0x3099cb[_0x75a4('0x28')][_0x75a4('0x31')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4047a7(null,util['format'](_0x75a4('0x2a'),path[_0x75a4('0x2b')](_0x3099cb[_0x75a4('0x28')],path[_0x75a4('0x2c')](_0x3099cb['originalname'])),Date[_0x75a4('0x32')](),path[_0x75a4('0x2c')](_0x3099cb[_0x75a4('0x28')])));}})});router['post']('/upload',upload['single'](_0x75a4('0x2f')),controller[_0x75a4('0x33')]);router[_0x75a4('0x19')](_0x75a4('0x34'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x35')]);router[_0x75a4('0x19')](_0x75a4('0x36'),auth['isAuthenticated'](),controller[_0x75a4('0x37')]);router[_0x75a4('0x38')](_0x75a4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x75a4('0x39')](_0x75a4('0xd'),auth[_0x75a4('0x9')](),controller[_0x75a4('0x3a')]);module[_0x75a4('0x3b')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index bf11531..ae89957 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 _0xc2d6=['PHONE','exports','INTEGER','STRING'];(function(_0x2e364c,_0x3a9865){var _0x13f7b4=function(_0x82c20a){while(--_0x82c20a){_0x2e364c['push'](_0x2e364c['shift']());}};_0x13f7b4(++_0x3a9865);}(_0xc2d6,0x171));var _0x6c2d=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xc2d6[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require('sequelize');module[_0x6c2d('0x0')]={'CmContactId':{'type':Sequelize[_0x6c2d('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x6c2d('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x6c2d('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x6c2d('0x2')],'defaultValue':_0x6c2d('0x3')},'OrderBy':{'type':Sequelize[_0x6c2d('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x7163=['sequelize','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7163,0x1ef));var _0x3716=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x7163[_0x3bab09];return _0x164376;};'use strict';var Sequelize=require(_0x3716('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x3716('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3716('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3716('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x3716('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 84fbaf4..1b5fb72 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 _0x6e07=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','get','CmContactHasItems','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query'];(function(_0x5e2ac7,_0x45265d){var _0x4fb946=function(_0x388b38){while(--_0x388b38){_0x5e2ac7['push'](_0x5e2ac7['shift']());}};_0x4fb946(++_0x45265d);}(_0x6e07,0x70));var _0x76e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e07[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x76e0('0x0'));var emlformat=require(_0x76e0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x76e0('0x2'));var jsonpatch=require(_0x76e0('0x3'));var rp=require('request-promise');var moment=require(_0x76e0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76e0('0x5'));var util=require(_0x76e0('0x6'));var path=require('path');var sox=require(_0x76e0('0x7'));var csv=require('to-csv');var ejs=require(_0x76e0('0x8'));var fs=require('fs');var fs_extra=require(_0x76e0('0x9'));var _=require('lodash');var squel=require(_0x76e0('0xa'));var crypto=require(_0x76e0('0xb'));var jsforce=require(_0x76e0('0xc'));var deskjs=require(_0x76e0('0xd'));var toCsv=require(_0x76e0('0xe'));var querystring=require('querystring');var Papa=require(_0x76e0('0xf'));var Redis=require(_0x76e0('0x10'));var authService=require(_0x76e0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76e0('0x12'));var logger=require(_0x76e0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x76e0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52aa1f,_0x4c3895){_0x4c3895=_0x4c3895||0xcc;return function(_0x50dcbf){if(_0x50dcbf){return _0x52aa1f[_0x76e0('0x15')](_0x4c3895);}return _0x52aa1f[_0x76e0('0x16')](_0x4c3895)[_0x76e0('0x17')]();};}function respondWithResult(_0x955370,_0x53f6fc){_0x53f6fc=_0x53f6fc||0xc8;return function(_0x543e37){if(_0x543e37){return _0x955370['status'](_0x53f6fc)[_0x76e0('0x18')](_0x543e37);}};}function respondWithFilteredResult(_0x2b0cd4,_0xacaeb3){return function(_0x5d8c5f){if(_0x5d8c5f){var _0x264160=_0x5d8c5f[_0x76e0('0x19')],_0x13c52a=_0xacaeb3[_0x76e0('0x1a')],_0x56bb27=_0xacaeb3['offset']+_0xacaeb3['limit'],_0xcfba98;if(_0x56bb27>=_0x264160){_0x56bb27=_0x264160;_0xcfba98=0xc8;}else{_0xcfba98=0xce;}_0x2b0cd4['status'](_0xcfba98);return _0x2b0cd4[_0x76e0('0x1b')](_0x76e0('0x1c'),_0x13c52a+'-'+_0x56bb27+'/'+_0x264160)['json'](_0x5d8c5f);}return null;};}function patchUpdates(_0x13165b){return function(_0x2fa3a6){try{jsonpatch[_0x76e0('0x1d')](_0x2fa3a6,_0x13165b,!![]);}catch(_0x76abb0){return BPromise[_0x76e0('0x1e')](_0x76abb0);}return _0x2fa3a6[_0x76e0('0x1f')]();};}function saveUpdates(_0x3906df,_0x23816c){return function(_0x2447a4){if(_0x2447a4){return _0x2447a4[_0x76e0('0x20')](_0x3906df)[_0x76e0('0x21')](function(_0x1efe29){return _0x1efe29;});}return null;};}function removeEntity(_0x19155a,_0x313968){return function(_0x520ae3){if(_0x520ae3){return _0x520ae3[_0x76e0('0x22')]()[_0x76e0('0x21')](function(){var _0x17b3b1=_0x520ae3['get']({'plain':!![]});var _0x28b797='CmContactHasItems';return db[_0x76e0('0x23')][_0x76e0('0x22')]({'where':{'type':_0x28b797,'resourceId':_0x17b3b1['id']}})['then'](function(){return _0x520ae3;});})[_0x76e0('0x21')](function(){_0x19155a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eff1a,_0x51d08d){return function(_0x18d090){if(!_0x18d090){_0x1eff1a['sendStatus'](0x194);}return _0x18d090;};}function handleError(_0x5c521c,_0x3f1328){_0x3f1328=_0x3f1328||0x1f4;return function(_0x5086d6){logger[_0x76e0('0x24')](_0x5086d6[_0x76e0('0x25')]);if(_0x5086d6[_0x76e0('0x26')]){delete _0x5086d6[_0x76e0('0x26')];}_0x5c521c[_0x76e0('0x16')](_0x3f1328)[_0x76e0('0x27')](_0x5086d6);};}exports['index']=function(_0x173583,_0x337ad4){var _0x1d6b63={},_0x594c43={},_0x454179={'count':0x0,'rows':[]};var _0x72ae76=_[_0x76e0('0x28')](db[_0x76e0('0x29')][_0x76e0('0x2a')],function(_0x476fa6){return{'name':_0x476fa6[_0x76e0('0x2b')],'type':_0x476fa6[_0x76e0('0x2c')][_0x76e0('0x2d')]};});_0x594c43[_0x76e0('0x2e')]=_[_0x76e0('0x28')](_0x72ae76,_0x76e0('0x26'));_0x594c43[_0x76e0('0x2f')]=_[_0x76e0('0x30')](_0x173583[_0x76e0('0x2f')]);_0x594c43[_0x76e0('0x31')]=_[_0x76e0('0x32')](_0x594c43[_0x76e0('0x2e')],_0x594c43[_0x76e0('0x2f')]);_0x1d6b63[_0x76e0('0x33')]=_[_0x76e0('0x32')](_0x594c43['model'],qs[_0x76e0('0x34')](_0x173583[_0x76e0('0x2f')][_0x76e0('0x34')]));_0x1d6b63[_0x76e0('0x33')]=_0x1d6b63[_0x76e0('0x33')][_0x76e0('0x35')]?_0x1d6b63[_0x76e0('0x33')]:_0x594c43[_0x76e0('0x2e')];if(!_0x173583[_0x76e0('0x2f')][_0x76e0('0x36')](_0x76e0('0x37'))){_0x1d6b63['limit']=qs[_0x76e0('0x38')](_0x173583[_0x76e0('0x2f')]['limit']);_0x1d6b63[_0x76e0('0x1a')]=qs[_0x76e0('0x1a')](_0x173583[_0x76e0('0x2f')][_0x76e0('0x1a')]);}_0x1d6b63[_0x76e0('0x39')]=qs[_0x76e0('0x3a')](_0x173583['query'][_0x76e0('0x3a')]);_0x1d6b63[_0x76e0('0x3b')]=qs[_0x76e0('0x31')](_[_0x76e0('0x3c')](_0x173583[_0x76e0('0x2f')],_0x594c43[_0x76e0('0x31')]),_0x72ae76);if(_0x173583[_0x76e0('0x2f')][_0x76e0('0x3d')]){_0x1d6b63[_0x76e0('0x3b')]=_['merge'](_0x1d6b63['where'],{'$or':_[_0x76e0('0x28')](_0x72ae76,function(_0xd17fbe){if(_0xd17fbe[_0x76e0('0x2c')]!==_0x76e0('0x3e')){var _0x2ec791={};_0x2ec791[_0xd17fbe[_0x76e0('0x26')]]={'$like':'%'+_0x173583[_0x76e0('0x2f')]['filter']+'%'};return _0x2ec791;}})});}_0x1d6b63=_[_0x76e0('0x3f')]({},_0x1d6b63,_0x173583[_0x76e0('0x40')]);var _0x3f3771={'where':_0x1d6b63[_0x76e0('0x3b')]};return db[_0x76e0('0x29')]['count'](_0x3f3771)['then'](function(_0x2606a5){_0x454179[_0x76e0('0x19')]=_0x2606a5;if(_0x173583['query'][_0x76e0('0x41')]){_0x1d6b63[_0x76e0('0x42')]=[{'all':!![]}];}return db[_0x76e0('0x29')][_0x76e0('0x43')](_0x1d6b63);})[_0x76e0('0x21')](function(_0x1bf4fb){_0x454179['rows']=_0x1bf4fb;return _0x454179;})[_0x76e0('0x21')](respondWithFilteredResult(_0x337ad4,_0x1d6b63))[_0x76e0('0x44')](handleError(_0x337ad4,null));};exports[_0x76e0('0x45')]=function(_0x3b22bb,_0x22ae08){var _0x4e235d={'raw':!![],'where':{'id':_0x3b22bb[_0x76e0('0x46')]['id']}},_0x1ac91c={};_0x1ac91c[_0x76e0('0x2e')]=_[_0x76e0('0x30')](db['CmContactHasItem'][_0x76e0('0x2a')]);_0x1ac91c[_0x76e0('0x2f')]=_['keys'](_0x3b22bb[_0x76e0('0x2f')]);_0x1ac91c['filters']=_[_0x76e0('0x32')](_0x1ac91c[_0x76e0('0x2e')],_0x1ac91c[_0x76e0('0x2f')]);_0x4e235d[_0x76e0('0x33')]=_['intersection'](_0x1ac91c[_0x76e0('0x2e')],qs['fields'](_0x3b22bb['query'][_0x76e0('0x34')]));_0x4e235d[_0x76e0('0x33')]=_0x4e235d[_0x76e0('0x33')][_0x76e0('0x35')]?_0x4e235d[_0x76e0('0x33')]:_0x1ac91c[_0x76e0('0x2e')];if(_0x3b22bb[_0x76e0('0x2f')][_0x76e0('0x41')]){_0x4e235d['include']=[{'all':!![]}];}_0x4e235d=_[_0x76e0('0x3f')]({},_0x4e235d,_0x3b22bb[_0x76e0('0x40')]);return db[_0x76e0('0x29')][_0x76e0('0x47')](_0x4e235d)['then'](handleEntityNotFound(_0x22ae08,null))[_0x76e0('0x21')](respondWithResult(_0x22ae08,null))['catch'](handleError(_0x22ae08,null));};exports[_0x76e0('0x48')]=function(_0x5c4954,_0x47dc68){return db[_0x76e0('0x29')]['create'](_0x5c4954[_0x76e0('0x49')],{})[_0x76e0('0x21')](function(_0x9ad76f){var _0x59447f=_0x5c4954[_0x76e0('0x4a')][_0x76e0('0x4b')]({'plain':!![]});if(!_0x59447f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59447f['role']===_0x76e0('0x4a')){var _0x8350c7=_0x9ad76f[_0x76e0('0x4b')]({'plain':!![]});var _0x318faa=_0x76e0('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x318faa,'userProfileId':_0x59447f[_0x76e0('0x4d')]},'raw':!![]})['then'](function(_0xc5d8b7){if(_0xc5d8b7&&_0xc5d8b7[_0x76e0('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x8350c7[_0x76e0('0x26')],'resourceId':_0x8350c7['id'],'type':_0xc5d8b7[_0x76e0('0x26')],'sectionId':_0xc5d8b7['id']},{})[_0x76e0('0x21')](function(){return _0x9ad76f;});}else{return _0x9ad76f;}})[_0x76e0('0x44')](function(_0xd02ec8){logger[_0x76e0('0x24')](_0x76e0('0x4f'),_0xd02ec8);throw _0xd02ec8;});}return _0x9ad76f;})[_0x76e0('0x21')](respondWithResult(_0x47dc68,0xc9))[_0x76e0('0x44')](handleError(_0x47dc68,null));};exports[_0x76e0('0x20')]=function(_0xaa2e84,_0x10851b){if(_0xaa2e84['body']['id']){delete _0xaa2e84[_0x76e0('0x49')]['id'];}return db[_0x76e0('0x29')]['find']({'where':{'id':_0xaa2e84[_0x76e0('0x46')]['id']}})[_0x76e0('0x21')](handleEntityNotFound(_0x10851b,null))[_0x76e0('0x21')](saveUpdates(_0xaa2e84[_0x76e0('0x49')],null))[_0x76e0('0x21')](respondWithResult(_0x10851b,null))[_0x76e0('0x44')](handleError(_0x10851b,null));};exports['destroy']=function(_0x3e3691,_0x16aeb0){return db[_0x76e0('0x29')][_0x76e0('0x47')]({'where':{'id':_0x3e3691[_0x76e0('0x46')]['id']}})[_0x76e0('0x21')](handleEntityNotFound(_0x16aeb0,null))[_0x76e0('0x21')](removeEntity(_0x16aeb0,null))[_0x76e0('0x44')](handleError(_0x16aeb0,null));}; \ No newline at end of file +var _0x5f16=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','map','CmContactHasItem','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','filters','filter','where','merge','count','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x488ff9,_0x2f551e){var _0x53d1ac=function(_0x40435e){while(--_0x40435e){_0x488ff9['push'](_0x488ff9['shift']());}};_0x53d1ac(++_0x2f551e);}(_0x5f16,0xd7));var _0x65f1=function(_0x4e3778,_0x6de801){_0x4e3778=_0x4e3778-0x0;var _0x4689b1=_0x5f16[_0x4e3778];return _0x4689b1;};'use strict';var pdf=require(_0x65f1('0x0'));var emlformat=require(_0x65f1('0x1'));var rimraf=require(_0x65f1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x65f1('0x4'));var Mustache=require(_0x65f1('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x65f1('0x6'));var ejs=require(_0x65f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65f1('0x8'));var squel=require(_0x65f1('0x9'));var crypto=require(_0x65f1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65f1('0xb'));var toCsv=require(_0x65f1('0x6'));var querystring=require('querystring');var Papa=require(_0x65f1('0xc'));var Redis=require(_0x65f1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x65f1('0xe'));var as=require(_0x65f1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65f1('0x10'))('api');var utils=require(_0x65f1('0x11'));var config=require(_0x65f1('0x12'));var licenseUtil=require(_0x65f1('0x13'));var db=require(_0x65f1('0x14'))['db'];function respondWithStatusCode(_0xc87e96,_0x3d40e8){_0x3d40e8=_0x3d40e8||0xcc;return function(_0xcb0de5){if(_0xcb0de5){return _0xc87e96[_0x65f1('0x15')](_0x3d40e8);}return _0xc87e96[_0x65f1('0x16')](_0x3d40e8)[_0x65f1('0x17')]();};}function respondWithResult(_0x5bfd70,_0x2a49f0){_0x2a49f0=_0x2a49f0||0xc8;return function(_0x300a0b){if(_0x300a0b){return _0x5bfd70['status'](_0x2a49f0)[_0x65f1('0x18')](_0x300a0b);}};}function respondWithFilteredResult(_0x29d3ba,_0x4594f2){return function(_0x2f1f25){if(_0x2f1f25){var _0x381a1e=_0x2f1f25['count'],_0x41af13=_0x4594f2[_0x65f1('0x19')],_0x56c23c=_0x4594f2[_0x65f1('0x19')]+_0x4594f2['limit'],_0x231f3e;if(_0x56c23c>=_0x381a1e){_0x56c23c=_0x381a1e;_0x231f3e=0xc8;}else{_0x231f3e=0xce;}_0x29d3ba[_0x65f1('0x16')](_0x231f3e);return _0x29d3ba[_0x65f1('0x1a')](_0x65f1('0x1b'),_0x41af13+'-'+_0x56c23c+'/'+_0x381a1e)[_0x65f1('0x18')](_0x2f1f25);}return null;};}function patchUpdates(_0x24b75a){return function(_0x166374){try{jsonpatch[_0x65f1('0x1c')](_0x166374,_0x24b75a,!![]);}catch(_0x16299b){return BPromise[_0x65f1('0x1d')](_0x16299b);}return _0x166374[_0x65f1('0x1e')]();};}function saveUpdates(_0x73fa90,_0x20c231){return function(_0x2f60be){if(_0x2f60be){return _0x2f60be['update'](_0x73fa90)[_0x65f1('0x1f')](function(_0x257bbf){return _0x257bbf;});}return null;};}function removeEntity(_0x47db1d,_0x10f223){return function(_0x3d19b1){if(_0x3d19b1){return _0x3d19b1[_0x65f1('0x20')]()[_0x65f1('0x1f')](function(){var _0x46f177=_0x3d19b1[_0x65f1('0x21')]({'plain':!![]});var _0x829523='CmContactHasItems';return db[_0x65f1('0x22')]['destroy']({'where':{'type':_0x829523,'resourceId':_0x46f177['id']}})[_0x65f1('0x1f')](function(){return _0x3d19b1;});})['then'](function(){_0x47db1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2acba3,_0x5e3dae){return function(_0x51015b){if(!_0x51015b){_0x2acba3[_0x65f1('0x15')](0x194);}return _0x51015b;};}function handleError(_0x3ebfc9,_0x416a24){_0x416a24=_0x416a24||0x1f4;return function(_0x44f050){logger[_0x65f1('0x23')](_0x44f050[_0x65f1('0x24')]);if(_0x44f050['name']){delete _0x44f050[_0x65f1('0x25')];}_0x3ebfc9[_0x65f1('0x16')](_0x416a24)['send'](_0x44f050);};}exports['index']=function(_0x3b449c,_0x32c621){var _0x56142e={},_0xac0589={},_0x1ca64b={'count':0x0,'rows':[]};var _0x861681=_[_0x65f1('0x26')](db[_0x65f1('0x27')]['rawAttributes'],function(_0x3fadb0){return{'name':_0x3fadb0[_0x65f1('0x28')],'type':_0x3fadb0[_0x65f1('0x29')][_0x65f1('0x2a')]};});_0xac0589[_0x65f1('0x2b')]=_[_0x65f1('0x26')](_0x861681,_0x65f1('0x25'));_0xac0589[_0x65f1('0x2c')]=_[_0x65f1('0x2d')](_0x3b449c[_0x65f1('0x2c')]);_0xac0589['filters']=_[_0x65f1('0x2e')](_0xac0589[_0x65f1('0x2b')],_0xac0589[_0x65f1('0x2c')]);_0x56142e[_0x65f1('0x2f')]=_[_0x65f1('0x2e')](_0xac0589['model'],qs[_0x65f1('0x30')](_0x3b449c[_0x65f1('0x2c')][_0x65f1('0x30')]));_0x56142e[_0x65f1('0x2f')]=_0x56142e[_0x65f1('0x2f')][_0x65f1('0x31')]?_0x56142e['attributes']:_0xac0589[_0x65f1('0x2b')];if(!_0x3b449c[_0x65f1('0x2c')]['hasOwnProperty']('nolimit')){_0x56142e['limit']=qs[_0x65f1('0x32')](_0x3b449c['query'][_0x65f1('0x32')]);_0x56142e[_0x65f1('0x19')]=qs[_0x65f1('0x19')](_0x3b449c[_0x65f1('0x2c')][_0x65f1('0x19')]);}_0x56142e[_0x65f1('0x33')]=qs[_0x65f1('0x34')](_0x3b449c[_0x65f1('0x2c')][_0x65f1('0x34')]);_0x56142e['where']=qs[_0x65f1('0x35')](_['pick'](_0x3b449c['query'],_0xac0589[_0x65f1('0x35')]),_0x861681);if(_0x3b449c['query'][_0x65f1('0x36')]){_0x56142e[_0x65f1('0x37')]=_['merge'](_0x56142e[_0x65f1('0x37')],{'$or':_[_0x65f1('0x26')](_0x861681,function(_0x1ba0fd){if(_0x1ba0fd[_0x65f1('0x29')]!=='VIRTUAL'){var _0x39986b={};_0x39986b[_0x1ba0fd[_0x65f1('0x25')]]={'$like':'%'+_0x3b449c[_0x65f1('0x2c')][_0x65f1('0x36')]+'%'};return _0x39986b;}})});}_0x56142e=_[_0x65f1('0x38')]({},_0x56142e,_0x3b449c['options']);var _0x44cc82={'where':_0x56142e[_0x65f1('0x37')]};return db[_0x65f1('0x27')][_0x65f1('0x39')](_0x44cc82)[_0x65f1('0x1f')](function(_0x4daefe){_0x1ca64b[_0x65f1('0x39')]=_0x4daefe;if(_0x3b449c['query'][_0x65f1('0x3a')]){_0x56142e[_0x65f1('0x3b')]=[{'all':!![]}];}return db[_0x65f1('0x27')][_0x65f1('0x3c')](_0x56142e);})[_0x65f1('0x1f')](function(_0xdd2ef8){_0x1ca64b['rows']=_0xdd2ef8;return _0x1ca64b;})[_0x65f1('0x1f')](respondWithFilteredResult(_0x32c621,_0x56142e))[_0x65f1('0x3d')](handleError(_0x32c621,null));};exports[_0x65f1('0x3e')]=function(_0x40246e,_0x2a0dfa){var _0x311f0c={'raw':!![],'where':{'id':_0x40246e[_0x65f1('0x3f')]['id']}},_0x14f9df={};_0x14f9df[_0x65f1('0x2b')]=_[_0x65f1('0x2d')](db[_0x65f1('0x27')]['rawAttributes']);_0x14f9df[_0x65f1('0x2c')]=_[_0x65f1('0x2d')](_0x40246e[_0x65f1('0x2c')]);_0x14f9df[_0x65f1('0x35')]=_[_0x65f1('0x2e')](_0x14f9df[_0x65f1('0x2b')],_0x14f9df[_0x65f1('0x2c')]);_0x311f0c[_0x65f1('0x2f')]=_['intersection'](_0x14f9df[_0x65f1('0x2b')],qs[_0x65f1('0x30')](_0x40246e[_0x65f1('0x2c')][_0x65f1('0x30')]));_0x311f0c[_0x65f1('0x2f')]=_0x311f0c['attributes']['length']?_0x311f0c[_0x65f1('0x2f')]:_0x14f9df[_0x65f1('0x2b')];if(_0x40246e['query'][_0x65f1('0x3a')]){_0x311f0c[_0x65f1('0x3b')]=[{'all':!![]}];}_0x311f0c=_[_0x65f1('0x38')]({},_0x311f0c,_0x40246e[_0x65f1('0x40')]);return db[_0x65f1('0x27')][_0x65f1('0x41')](_0x311f0c)[_0x65f1('0x1f')](handleEntityNotFound(_0x2a0dfa,null))[_0x65f1('0x1f')](respondWithResult(_0x2a0dfa,null))[_0x65f1('0x3d')](handleError(_0x2a0dfa,null));};exports[_0x65f1('0x42')]=function(_0xfdace7,_0x4a06d1){return db['CmContactHasItem'][_0x65f1('0x42')](_0xfdace7[_0x65f1('0x43')],{})[_0x65f1('0x1f')](function(_0x5a4e38){var _0x182443=_0xfdace7[_0x65f1('0x44')][_0x65f1('0x21')]({'plain':!![]});if(!_0x182443)throw new Error(_0x65f1('0x45'));if(_0x182443[_0x65f1('0x46')]===_0x65f1('0x44')){var _0x36342b=_0x5a4e38[_0x65f1('0x21')]({'plain':!![]});var _0x2b8888=_0x65f1('0x47');return db[_0x65f1('0x48')][_0x65f1('0x41')]({'where':{'name':_0x2b8888,'userProfileId':_0x182443[_0x65f1('0x49')]},'raw':!![]})[_0x65f1('0x1f')](function(_0x2c8f14){if(_0x2c8f14&&_0x2c8f14[_0x65f1('0x4a')]===0x0){return db[_0x65f1('0x22')][_0x65f1('0x42')]({'name':_0x36342b['name'],'resourceId':_0x36342b['id'],'type':_0x2c8f14[_0x65f1('0x25')],'sectionId':_0x2c8f14['id']},{})[_0x65f1('0x1f')](function(){return _0x5a4e38;});}else{return _0x5a4e38;}})['catch'](function(_0x29dcc9){logger['error'](_0x65f1('0x4b'),_0x29dcc9);throw _0x29dcc9;});}return _0x5a4e38;})[_0x65f1('0x1f')](respondWithResult(_0x4a06d1,0xc9))[_0x65f1('0x3d')](handleError(_0x4a06d1,null));};exports[_0x65f1('0x4c')]=function(_0x6de290,_0x2f03d9){if(_0x6de290[_0x65f1('0x43')]['id']){delete _0x6de290['body']['id'];}return db[_0x65f1('0x27')][_0x65f1('0x41')]({'where':{'id':_0x6de290[_0x65f1('0x3f')]['id']}})[_0x65f1('0x1f')](handleEntityNotFound(_0x2f03d9,null))[_0x65f1('0x1f')](saveUpdates(_0x6de290[_0x65f1('0x43')],null))['then'](respondWithResult(_0x2f03d9,null))['catch'](handleError(_0x2f03d9,null));};exports[_0x65f1('0x20')]=function(_0x510e83,_0x1b35bc){return db[_0x65f1('0x27')][_0x65f1('0x41')]({'where':{'id':_0x510e83[_0x65f1('0x3f')]['id']}})[_0x65f1('0x1f')](handleEntityNotFound(_0x1b35bc,null))['then'](removeEntity(_0x1b35bc,null))[_0x65f1('0x3d')](handleError(_0x1b35bc,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 44da39f..c68177d 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 _0x7278=['define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x50a7d3,_0x5a5cd7){var _0x30b87b=function(_0x18f103){while(--_0x18f103){_0x50a7d3['push'](_0x50a7d3['shift']());}};_0x30b87b(++_0x5a5cd7);}(_0x7278,0x161));var _0x8727=function(_0x46f419,_0x345cde){_0x46f419=_0x46f419-0x0;var _0x49d2ef=_0x7278[_0x46f419];return _0x49d2ef;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x4bedd6,_0x1642a7){var _0x209229=function(_0x7c6ed6){while(--_0x7c6ed6){_0x4bedd6['push'](_0x4bedd6['shift']());}};_0x209229(++_0x1642a7);}(_0x814b,0x1a2));var _0xb814=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x814b[_0x2ade6c];return _0x2cb372;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'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 ce2bebf..a3d5b1d 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 _0xac0d=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x17dc04,_0x26e92c){var _0x5c5043=function(_0x5dda93){while(--_0x5dda93){_0x17dc04['push'](_0x17dc04['shift']());}};_0x5c5043(++_0x26e92c);}(_0xac0d,0x181));var _0xdac0=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xac0d[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xdac0('0x0'));var util=require(_0xdac0('0x1'));var moment=require(_0xdac0('0x2'));var BPromise=require(_0xdac0('0x3'));var rs=require(_0xdac0('0x4'));var fs=require('fs');var Redis=require(_0xdac0('0x5'));var db=require(_0xdac0('0x6'))['db'];var utils=require(_0xdac0('0x7'));var logger=require(_0xdac0('0x8'))(_0xdac0('0x9'));var config=require(_0xdac0('0xa'));var jayson=require(_0xdac0('0xb'));var client=jayson[_0xdac0('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12480a,_0x5d94ef,_0x14a30d){return new BPromise(function(_0x54eafa,_0x43956a){return client[_0xdac0('0xd')](_0x12480a,_0x14a30d)[_0xdac0('0xe')](function(_0x22d2c2){logger[_0xdac0('0xf')](_0xdac0('0x10'),_0x5d94ef,_0xdac0('0x11'));logger[_0xdac0('0x12')](_0xdac0('0x13'),_0x5d94ef,_0xdac0('0x11'),JSON[_0xdac0('0x14')](_0x22d2c2));if(_0x22d2c2['error']){if(_0x22d2c2[_0xdac0('0x15')][_0xdac0('0x16')]===0x1f4){logger[_0xdac0('0x15')](_0xdac0('0x10'),_0x5d94ef,_0x22d2c2[_0xdac0('0x15')]['message']);return _0x43956a(_0x22d2c2[_0xdac0('0x15')][_0xdac0('0x17')]);}logger[_0xdac0('0x15')](_0xdac0('0x10'),_0x5d94ef,_0x22d2c2[_0xdac0('0x15')][_0xdac0('0x17')]);return _0x54eafa(_0x22d2c2[_0xdac0('0x15')][_0xdac0('0x17')]);}else{logger[_0xdac0('0xf')](_0xdac0('0x10'),_0x5d94ef,_0xdac0('0x11'));_0x54eafa(_0x22d2c2[_0xdac0('0x18')][_0xdac0('0x17')]);}})['catch'](function(_0x48e8cc){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x5d94ef,_0x48e8cc);_0x43956a(_0x48e8cc);});});} \ No newline at end of file +var _0x8ed2=['then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1093f3,_0x3e45b5){var _0x1c8581=function(_0x1ee315){while(--_0x1ee315){_0x1093f3['push'](_0x1093f3['shift']());}};_0x1c8581(++_0x3e45b5);}(_0x8ed2,0x1ee));var _0x28ed=function(_0x4b283d,_0x306150){_0x4b283d=_0x4b283d-0x0;var _0xb01621=_0x8ed2[_0x4b283d];return _0xb01621;};'use strict';var _=require(_0x28ed('0x0'));var util=require(_0x28ed('0x1'));var moment=require('moment');var BPromise=require(_0x28ed('0x2'));var rs=require(_0x28ed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28ed('0x4'))['db'];var utils=require(_0x28ed('0x5'));var logger=require('../../config/logger')(_0x28ed('0x6'));var config=require(_0x28ed('0x7'));var jayson=require(_0x28ed('0x8'));var client=jayson[_0x28ed('0x9')][_0x28ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe828f0,_0x2bdf1f,_0x22f88d){return new BPromise(function(_0x2e4217,_0x4e1c98){return client[_0x28ed('0xb')](_0xe828f0,_0x22f88d)[_0x28ed('0xc')](function(_0x14a2ee){logger['info'](_0x28ed('0xd'),_0x2bdf1f,_0x28ed('0xe'));logger[_0x28ed('0xf')](_0x28ed('0x10'),_0x2bdf1f,_0x28ed('0xe'),JSON[_0x28ed('0x11')](_0x14a2ee));if(_0x14a2ee[_0x28ed('0x12')]){if(_0x14a2ee[_0x28ed('0x12')]['code']===0x1f4){logger['error'](_0x28ed('0xd'),_0x2bdf1f,_0x14a2ee[_0x28ed('0x12')][_0x28ed('0x13')]);return _0x4e1c98(_0x14a2ee['error'][_0x28ed('0x13')]);}logger[_0x28ed('0x12')](_0x28ed('0xd'),_0x2bdf1f,_0x14a2ee['error'][_0x28ed('0x13')]);return _0x2e4217(_0x14a2ee[_0x28ed('0x12')][_0x28ed('0x13')]);}else{logger[_0x28ed('0x14')](_0x28ed('0xd'),_0x2bdf1f,_0x28ed('0xe'));_0x2e4217(_0x14a2ee[_0x28ed('0x15')]['message']);}})[_0x28ed('0x16')](function(_0x49e91f){logger[_0x28ed('0x12')](_0x28ed('0xd'),_0x2bdf1f,_0x49e91f);_0x4e1c98(_0x49e91f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 49718b8..3636c9d 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 _0x77e0=['get','index','/:id','isAuthenticated','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0xac4585,_0x59e24d){var _0x3dcb14=function(_0xbd3b04){while(--_0xbd3b04){_0xac4585['push'](_0xac4585['shift']());}};_0x3dcb14(++_0x59e24d);}(_0x77e0,0x96));var _0x077e=function(_0x8f8264,_0x59e0ff){_0x8f8264=_0x8f8264-0x0;var _0x4747f3=_0x77e0[_0x8f8264];return _0x4747f3;};'use strict';var multer=require(_0x077e('0x0'));var util=require('util');var path=require(_0x077e('0x1'));var timeout=require(_0x077e('0x2'));var express=require(_0x077e('0x3'));var router=express[_0x077e('0x4')]();var fs_extra=require(_0x077e('0x5'));var auth=require(_0x077e('0x6'));var interaction=require(_0x077e('0x7'));var config=require(_0x077e('0x8'));var controller=require(_0x077e('0x9'));router[_0x077e('0xa')]('/',auth['isAuthenticated'](),controller[_0x077e('0xb')]);router['get'](_0x077e('0xc'),auth[_0x077e('0xd')](),controller['show']);router[_0x077e('0xe')]('/',auth['isAuthenticated'](),controller[_0x077e('0xf')]);router[_0x077e('0x10')](_0x077e('0xc'),auth['isAuthenticated'](),controller[_0x077e('0x11')]);router[_0x077e('0x12')](_0x077e('0xc'),auth[_0x077e('0xd')](),controller['destroy']);module[_0x077e('0x13')]=router; \ No newline at end of file +var _0x7dc4=['index','show','post','create','update','delete','/:id','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated'];(function(_0x15e31d,_0x2e86c8){var _0x27614e=function(_0x3bc423){while(--_0x3bc423){_0x15e31d['push'](_0x15e31d['shift']());}};_0x27614e(++_0x2e86c8);}(_0x7dc4,0xff));var _0x47dc=function(_0x231257,_0x2a06e2){_0x231257=_0x231257-0x0;var _0x3e75bd=_0x7dc4[_0x231257];return _0x3e75bd;};'use strict';var multer=require(_0x47dc('0x0'));var util=require(_0x47dc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x47dc('0x2'));var router=express[_0x47dc('0x3')]();var fs_extra=require(_0x47dc('0x4'));var auth=require(_0x47dc('0x5'));var interaction=require(_0x47dc('0x6'));var config=require(_0x47dc('0x7'));var controller=require(_0x47dc('0x8'));router[_0x47dc('0x9')]('/',auth[_0x47dc('0xa')](),controller[_0x47dc('0xb')]);router[_0x47dc('0x9')]('/:id',auth[_0x47dc('0xa')](),controller[_0x47dc('0xc')]);router[_0x47dc('0xd')]('/',auth['isAuthenticated'](),controller[_0x47dc('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x47dc('0xf')]);router[_0x47dc('0x10')](_0x47dc('0x11'),auth['isAuthenticated'](),controller[_0x47dc('0x12')]);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 ba2c611..767b9a8 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 _0xad20=['INTEGER','exports'];(function(_0x3c20c9,_0x49d60c){var _0x173dc3=function(_0x112999){while(--_0x112999){_0x3c20c9['push'](_0x3c20c9['shift']());}};_0x173dc3(++_0x49d60c);}(_0xad20,0x77));var _0x0ad2=function(_0x53f707,_0x51a2f7){_0x53f707=_0x53f707-0x0;var _0x10a9f5=_0xad20[_0x53f707];return _0x10a9f5;};'use strict';var Sequelize=require('sequelize');module[_0x0ad2('0x0')]={'CmContactId':{'type':Sequelize[_0x0ad2('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xcae0=['exports','sequelize'];(function(_0x1554ff,_0x194f8b){var _0x2e5406=function(_0x3d3716){while(--_0x3d3716){_0x1554ff['push'](_0x1554ff['shift']());}};_0x2e5406(++_0x194f8b);}(_0xcae0,0x17d));var _0x0cae=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcae0[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x0cae('0x0'));module[_0x0cae('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 2773d8c..4a85196 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 _0x2229=['limit','set','Content-Range','apply','reject','save','update','destroy','then','CmContactHasPhones','UserProfileResource','name','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','CmContactHasPhone','rows','show','params','length','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','error','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','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x2229,0xde));var _0x9222=function(_0x5bcddc,_0x288f93){_0x5bcddc=_0x5bcddc-0x0;var _0x578229=_0x2229[_0x5bcddc];return _0x578229;};'use strict';var pdf=require(_0x9222('0x0'));var emlformat=require(_0x9222('0x1'));var rimraf=require(_0x9222('0x2'));var zipdir=require(_0x9222('0x3'));var jsonpatch=require(_0x9222('0x4'));var rp=require(_0x9222('0x5'));var moment=require(_0x9222('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9222('0x7'));var path=require(_0x9222('0x8'));var sox=require(_0x9222('0x9'));var csv=require(_0x9222('0xa'));var ejs=require(_0x9222('0xb'));var fs=require('fs');var fs_extra=require(_0x9222('0xc'));var _=require(_0x9222('0xd'));var squel=require(_0x9222('0xe'));var crypto=require('crypto');var jsforce=require(_0x9222('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9222('0xa'));var querystring=require(_0x9222('0x10'));var Papa=require(_0x9222('0x11'));var Redis=require(_0x9222('0x12'));var authService=require(_0x9222('0x13'));var qs=require(_0x9222('0x14'));var as=require(_0x9222('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9222('0x16'))(_0x9222('0x17'));var utils=require(_0x9222('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9222('0x19'));var db=require(_0x9222('0x1a'))['db'];function respondWithStatusCode(_0x356996,_0x19cd91){_0x19cd91=_0x19cd91||0xcc;return function(_0x488457){if(_0x488457){return _0x356996[_0x9222('0x1b')](_0x19cd91);}return _0x356996[_0x9222('0x1c')](_0x19cd91)[_0x9222('0x1d')]();};}function respondWithResult(_0x5bf899,_0x5dfe3d){_0x5dfe3d=_0x5dfe3d||0xc8;return function(_0x5a21bd){if(_0x5a21bd){return _0x5bf899[_0x9222('0x1c')](_0x5dfe3d)[_0x9222('0x1e')](_0x5a21bd);}};}function respondWithFilteredResult(_0x5f0b3e,_0x20f996){return function(_0xd9e791){if(_0xd9e791){var _0x45a40e=_0xd9e791[_0x9222('0x1f')],_0x5b3e3b=_0x20f996[_0x9222('0x20')],_0x4a4cce=_0x20f996['offset']+_0x20f996[_0x9222('0x21')],_0x2facd5;if(_0x4a4cce>=_0x45a40e){_0x4a4cce=_0x45a40e;_0x2facd5=0xc8;}else{_0x2facd5=0xce;}_0x5f0b3e[_0x9222('0x1c')](_0x2facd5);return _0x5f0b3e[_0x9222('0x22')](_0x9222('0x23'),_0x5b3e3b+'-'+_0x4a4cce+'/'+_0x45a40e)[_0x9222('0x1e')](_0xd9e791);}return null;};}function patchUpdates(_0x51b375){return function(_0x36b8e8){try{jsonpatch[_0x9222('0x24')](_0x36b8e8,_0x51b375,!![]);}catch(_0x5af83a){return BPromise[_0x9222('0x25')](_0x5af83a);}return _0x36b8e8[_0x9222('0x26')]();};}function saveUpdates(_0xca7bd3,_0x501a60){return function(_0x389eb5){if(_0x389eb5){return _0x389eb5[_0x9222('0x27')](_0xca7bd3)['then'](function(_0x5a3463){return _0x5a3463;});}return null;};}function removeEntity(_0x2834f6,_0x5b075d){return function(_0xcdda1b){if(_0xcdda1b){return _0xcdda1b[_0x9222('0x28')]()[_0x9222('0x29')](function(){var _0x34b83c=_0xcdda1b['get']({'plain':!![]});var _0x5b0eee=_0x9222('0x2a');return db[_0x9222('0x2b')][_0x9222('0x28')]({'where':{'type':_0x5b0eee,'resourceId':_0x34b83c['id']}})[_0x9222('0x29')](function(){return _0xcdda1b;});})['then'](function(){_0x2834f6['status'](0xcc)[_0x9222('0x1d')]();});}};}function handleEntityNotFound(_0x6a3833,_0x389cd2){return function(_0x52fb17){if(!_0x52fb17){_0x6a3833[_0x9222('0x1b')](0x194);}return _0x52fb17;};}function handleError(_0x1d6476,_0x20bb24){_0x20bb24=_0x20bb24||0x1f4;return function(_0x7e05de){logger['error'](_0x7e05de['stack']);if(_0x7e05de['name']){delete _0x7e05de[_0x9222('0x2c')];}_0x1d6476[_0x9222('0x1c')](_0x20bb24)['send'](_0x7e05de);};}exports[_0x9222('0x2d')]=function(_0x4816e0,_0x2d2561){var _0x576b11={},_0x3c3aab={},_0x20e28b={'count':0x0,'rows':[]};var _0xdec43c=_['map'](db['CmContactHasPhone'][_0x9222('0x2e')],function(_0x1359c0){return{'name':_0x1359c0[_0x9222('0x2f')],'type':_0x1359c0['type'][_0x9222('0x30')]};});_0x3c3aab[_0x9222('0x31')]=_[_0x9222('0x32')](_0xdec43c,'name');_0x3c3aab[_0x9222('0x33')]=_['keys'](_0x4816e0[_0x9222('0x33')]);_0x3c3aab[_0x9222('0x34')]=_[_0x9222('0x35')](_0x3c3aab[_0x9222('0x31')],_0x3c3aab[_0x9222('0x33')]);_0x576b11[_0x9222('0x36')]=_[_0x9222('0x35')](_0x3c3aab[_0x9222('0x31')],qs[_0x9222('0x37')](_0x4816e0[_0x9222('0x33')]['fields']));_0x576b11['attributes']=_0x576b11['attributes']['length']?_0x576b11[_0x9222('0x36')]:_0x3c3aab[_0x9222('0x31')];if(!_0x4816e0[_0x9222('0x33')][_0x9222('0x38')](_0x9222('0x39'))){_0x576b11[_0x9222('0x21')]=qs[_0x9222('0x21')](_0x4816e0[_0x9222('0x33')]['limit']);_0x576b11[_0x9222('0x20')]=qs[_0x9222('0x20')](_0x4816e0[_0x9222('0x33')][_0x9222('0x20')]);}_0x576b11[_0x9222('0x3a')]=qs['sort'](_0x4816e0[_0x9222('0x33')][_0x9222('0x3b')]);_0x576b11[_0x9222('0x3c')]=qs[_0x9222('0x34')](_[_0x9222('0x3d')](_0x4816e0[_0x9222('0x33')],_0x3c3aab[_0x9222('0x34')]),_0xdec43c);if(_0x4816e0[_0x9222('0x33')]['filter']){_0x576b11[_0x9222('0x3c')]=_[_0x9222('0x3e')](_0x576b11['where'],{'$or':_['map'](_0xdec43c,function(_0x8a6bb5){if(_0x8a6bb5[_0x9222('0x3f')]!==_0x9222('0x40')){var _0x1504cc={};_0x1504cc[_0x8a6bb5[_0x9222('0x2c')]]={'$like':'%'+_0x4816e0[_0x9222('0x33')][_0x9222('0x41')]+'%'};return _0x1504cc;}})});}_0x576b11=_[_0x9222('0x3e')]({},_0x576b11,_0x4816e0[_0x9222('0x42')]);var _0x25fc62={'where':_0x576b11['where']};return db[_0x9222('0x43')]['count'](_0x25fc62)[_0x9222('0x29')](function(_0x127a42){_0x20e28b['count']=_0x127a42;if(_0x4816e0['query']['includeAll']){_0x576b11['include']=[{'all':!![]}];}return db[_0x9222('0x43')]['findAll'](_0x576b11);})['then'](function(_0x2095cb){_0x20e28b[_0x9222('0x44')]=_0x2095cb;return _0x20e28b;})[_0x9222('0x29')](respondWithFilteredResult(_0x2d2561,_0x576b11))['catch'](handleError(_0x2d2561,null));};exports[_0x9222('0x45')]=function(_0x4b3db5,_0x3a4ce9){var _0x5627e2={'raw':!![],'where':{'id':_0x4b3db5[_0x9222('0x46')]['id']}},_0x824729={};_0x824729[_0x9222('0x31')]=_['keys'](db[_0x9222('0x43')]['rawAttributes']);_0x824729[_0x9222('0x33')]=_['keys'](_0x4b3db5[_0x9222('0x33')]);_0x824729[_0x9222('0x34')]=_[_0x9222('0x35')](_0x824729[_0x9222('0x31')],_0x824729['query']);_0x5627e2['attributes']=_[_0x9222('0x35')](_0x824729[_0x9222('0x31')],qs[_0x9222('0x37')](_0x4b3db5[_0x9222('0x33')][_0x9222('0x37')]));_0x5627e2[_0x9222('0x36')]=_0x5627e2['attributes'][_0x9222('0x47')]?_0x5627e2[_0x9222('0x36')]:_0x824729[_0x9222('0x31')];if(_0x4b3db5[_0x9222('0x33')]['includeAll']){_0x5627e2[_0x9222('0x48')]=[{'all':!![]}];}_0x5627e2=_['merge']({},_0x5627e2,_0x4b3db5[_0x9222('0x42')]);return db['CmContactHasPhone']['find'](_0x5627e2)['then'](handleEntityNotFound(_0x3a4ce9,null))[_0x9222('0x29')](respondWithResult(_0x3a4ce9,null))['catch'](handleError(_0x3a4ce9,null));};exports[_0x9222('0x49')]=function(_0x47078f,_0x154e7d){return db[_0x9222('0x43')][_0x9222('0x49')](_0x47078f['body'],{})[_0x9222('0x29')](function(_0x220773){var _0x28a223=_0x47078f[_0x9222('0x4a')][_0x9222('0x4b')]({'plain':!![]});if(!_0x28a223)throw new Error(_0x9222('0x4c'));if(_0x28a223[_0x9222('0x4d')]===_0x9222('0x4a')){var _0x384e8b=_0x220773['get']({'plain':!![]});var _0x1d5484=_0x9222('0x2a');return db[_0x9222('0x4e')][_0x9222('0x4f')]({'where':{'name':_0x1d5484,'userProfileId':_0x28a223[_0x9222('0x50')]},'raw':!![]})['then'](function(_0x98022c){if(_0x98022c&&_0x98022c['autoAssociation']===0x0){return db[_0x9222('0x2b')][_0x9222('0x49')]({'name':_0x384e8b[_0x9222('0x2c')],'resourceId':_0x384e8b['id'],'type':_0x98022c['name'],'sectionId':_0x98022c['id']},{})[_0x9222('0x29')](function(){return _0x220773;});}else{return _0x220773;}})[_0x9222('0x51')](function(_0x140b3c){logger[_0x9222('0x52')](_0x9222('0x53'),_0x140b3c);throw _0x140b3c;});}return _0x220773;})[_0x9222('0x29')](respondWithResult(_0x154e7d,0xc9))[_0x9222('0x51')](handleError(_0x154e7d,null));};exports['update']=function(_0x23f079,_0x3dea6e){if(_0x23f079[_0x9222('0x54')]['id']){delete _0x23f079[_0x9222('0x54')]['id'];}return db['CmContactHasPhone'][_0x9222('0x4f')]({'where':{'id':_0x23f079['params']['id']}})[_0x9222('0x29')](handleEntityNotFound(_0x3dea6e,null))['then'](saveUpdates(_0x23f079[_0x9222('0x54')],null))[_0x9222('0x29')](respondWithResult(_0x3dea6e,null))[_0x9222('0x51')](handleError(_0x3dea6e,null));};exports['destroy']=function(_0x2f0d99,_0xbf70c){return db['CmContactHasPhone'][_0x9222('0x4f')]({'where':{'id':_0x2f0d99['params']['id']}})['then'](handleEntityNotFound(_0xbf70c,null))[_0x9222('0x29')](removeEntity(_0xbf70c,null))['catch'](handleError(_0xbf70c,null));}; \ No newline at end of file +var _0x72bb=['Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','name','send','map','CmContactHasPhone','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmContactHasPhones','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set'];(function(_0x56b878,_0x4be9aa){var _0x32b9ec=function(_0x1511ea){while(--_0x1511ea){_0x56b878['push'](_0x56b878['shift']());}};_0x32b9ec(++_0x4be9aa);}(_0x72bb,0x16e));var _0xb72b=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x72bb[_0x18afca];return _0x11603f;};'use strict';var pdf=require(_0xb72b('0x0'));var emlformat=require(_0xb72b('0x1'));var rimraf=require(_0xb72b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb72b('0x3'));var moment=require(_0xb72b('0x4'));var BPromise=require(_0xb72b('0x5'));var Mustache=require(_0xb72b('0x6'));var util=require(_0xb72b('0x7'));var path=require('path');var sox=require(_0xb72b('0x8'));var csv=require(_0xb72b('0x9'));var ejs=require(_0xb72b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb72b('0xb'));var squel=require(_0xb72b('0xc'));var crypto=require(_0xb72b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb72b('0x9'));var querystring=require(_0xb72b('0xe'));var Papa=require(_0xb72b('0xf'));var Redis=require(_0xb72b('0x10'));var authService=require(_0xb72b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb72b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb72b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb72b('0x14'));var db=require(_0xb72b('0x15'))['db'];function respondWithStatusCode(_0x5564df,_0x3a9877){_0x3a9877=_0x3a9877||0xcc;return function(_0x209c5b){if(_0x209c5b){return _0x5564df[_0xb72b('0x16')](_0x3a9877);}return _0x5564df[_0xb72b('0x17')](_0x3a9877)[_0xb72b('0x18')]();};}function respondWithResult(_0x347c81,_0x2a6a56){_0x2a6a56=_0x2a6a56||0xc8;return function(_0x25724e){if(_0x25724e){return _0x347c81['status'](_0x2a6a56)[_0xb72b('0x19')](_0x25724e);}};}function respondWithFilteredResult(_0x57b287,_0x110d7e){return function(_0x10eeb5){if(_0x10eeb5){var _0x3f54ed=_0x10eeb5['count'],_0x2d790a=_0x110d7e[_0xb72b('0x1a')],_0x560e44=_0x110d7e['offset']+_0x110d7e[_0xb72b('0x1b')],_0x1e67fb;if(_0x560e44>=_0x3f54ed){_0x560e44=_0x3f54ed;_0x1e67fb=0xc8;}else{_0x1e67fb=0xce;}_0x57b287[_0xb72b('0x17')](_0x1e67fb);return _0x57b287[_0xb72b('0x1c')](_0xb72b('0x1d'),_0x2d790a+'-'+_0x560e44+'/'+_0x3f54ed)[_0xb72b('0x19')](_0x10eeb5);}return null;};}function patchUpdates(_0x412ec2){return function(_0x5f15e1){try{jsonpatch[_0xb72b('0x1e')](_0x5f15e1,_0x412ec2,!![]);}catch(_0x72b5d2){return BPromise[_0xb72b('0x1f')](_0x72b5d2);}return _0x5f15e1['save']();};}function saveUpdates(_0x24f035,_0x41da25){return function(_0x5e8cb5){if(_0x5e8cb5){return _0x5e8cb5[_0xb72b('0x20')](_0x24f035)[_0xb72b('0x21')](function(_0x8339dd){return _0x8339dd;});}return null;};}function removeEntity(_0x16a5ab,_0x3c24c3){return function(_0x1e1027){if(_0x1e1027){return _0x1e1027[_0xb72b('0x22')]()['then'](function(){var _0x4eb15a=_0x1e1027['get']({'plain':!![]});var _0x244723='CmContactHasPhones';return db[_0xb72b('0x23')][_0xb72b('0x22')]({'where':{'type':_0x244723,'resourceId':_0x4eb15a['id']}})[_0xb72b('0x21')](function(){return _0x1e1027;});})[_0xb72b('0x21')](function(){_0x16a5ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x357b4c,_0x3a9d57){return function(_0x5a6bff){if(!_0x5a6bff){_0x357b4c[_0xb72b('0x16')](0x194);}return _0x5a6bff;};}function handleError(_0x3d3380,_0x5e8a72){_0x5e8a72=_0x5e8a72||0x1f4;return function(_0x408626){logger[_0xb72b('0x24')](_0x408626['stack']);if(_0x408626[_0xb72b('0x25')]){delete _0x408626[_0xb72b('0x25')];}_0x3d3380[_0xb72b('0x17')](_0x5e8a72)[_0xb72b('0x26')](_0x408626);};}exports['index']=function(_0x3308c4,_0x562818){var _0x3fecc4={},_0x574d53={},_0x563b15={'count':0x0,'rows':[]};var _0x51d2f3=_[_0xb72b('0x27')](db[_0xb72b('0x28')]['rawAttributes'],function(_0x2ffcc7){return{'name':_0x2ffcc7[_0xb72b('0x29')],'type':_0x2ffcc7[_0xb72b('0x2a')]['key']};});_0x574d53[_0xb72b('0x2b')]=_[_0xb72b('0x27')](_0x51d2f3,_0xb72b('0x25'));_0x574d53[_0xb72b('0x2c')]=_[_0xb72b('0x2d')](_0x3308c4[_0xb72b('0x2c')]);_0x574d53['filters']=_[_0xb72b('0x2e')](_0x574d53[_0xb72b('0x2b')],_0x574d53[_0xb72b('0x2c')]);_0x3fecc4[_0xb72b('0x2f')]=_[_0xb72b('0x2e')](_0x574d53['model'],qs['fields'](_0x3308c4[_0xb72b('0x2c')][_0xb72b('0x30')]));_0x3fecc4[_0xb72b('0x2f')]=_0x3fecc4[_0xb72b('0x2f')][_0xb72b('0x31')]?_0x3fecc4[_0xb72b('0x2f')]:_0x574d53[_0xb72b('0x2b')];if(!_0x3308c4[_0xb72b('0x2c')][_0xb72b('0x32')](_0xb72b('0x33'))){_0x3fecc4[_0xb72b('0x1b')]=qs[_0xb72b('0x1b')](_0x3308c4['query'][_0xb72b('0x1b')]);_0x3fecc4[_0xb72b('0x1a')]=qs[_0xb72b('0x1a')](_0x3308c4[_0xb72b('0x2c')][_0xb72b('0x1a')]);}_0x3fecc4[_0xb72b('0x34')]=qs[_0xb72b('0x35')](_0x3308c4['query'][_0xb72b('0x35')]);_0x3fecc4[_0xb72b('0x36')]=qs[_0xb72b('0x37')](_[_0xb72b('0x38')](_0x3308c4['query'],_0x574d53[_0xb72b('0x37')]),_0x51d2f3);if(_0x3308c4[_0xb72b('0x2c')][_0xb72b('0x39')]){_0x3fecc4[_0xb72b('0x36')]=_['merge'](_0x3fecc4[_0xb72b('0x36')],{'$or':_[_0xb72b('0x27')](_0x51d2f3,function(_0x497c9e){if(_0x497c9e[_0xb72b('0x2a')]!==_0xb72b('0x3a')){var _0x4ee52e={};_0x4ee52e[_0x497c9e[_0xb72b('0x25')]]={'$like':'%'+_0x3308c4['query']['filter']+'%'};return _0x4ee52e;}})});}_0x3fecc4=_['merge']({},_0x3fecc4,_0x3308c4[_0xb72b('0x3b')]);var _0x1882d0={'where':_0x3fecc4[_0xb72b('0x36')]};return db['CmContactHasPhone']['count'](_0x1882d0)[_0xb72b('0x21')](function(_0x34eeb6){_0x563b15[_0xb72b('0x3c')]=_0x34eeb6;if(_0x3308c4['query'][_0xb72b('0x3d')]){_0x3fecc4[_0xb72b('0x3e')]=[{'all':!![]}];}return db[_0xb72b('0x28')][_0xb72b('0x3f')](_0x3fecc4);})[_0xb72b('0x21')](function(_0x43d24c){_0x563b15[_0xb72b('0x40')]=_0x43d24c;return _0x563b15;})['then'](respondWithFilteredResult(_0x562818,_0x3fecc4))[_0xb72b('0x41')](handleError(_0x562818,null));};exports[_0xb72b('0x42')]=function(_0x15c246,_0x1218ef){var _0x23c5a9={'raw':!![],'where':{'id':_0x15c246['params']['id']}},_0x22fa9e={};_0x22fa9e[_0xb72b('0x2b')]=_[_0xb72b('0x2d')](db[_0xb72b('0x28')]['rawAttributes']);_0x22fa9e[_0xb72b('0x2c')]=_['keys'](_0x15c246[_0xb72b('0x2c')]);_0x22fa9e[_0xb72b('0x37')]=_[_0xb72b('0x2e')](_0x22fa9e[_0xb72b('0x2b')],_0x22fa9e[_0xb72b('0x2c')]);_0x23c5a9[_0xb72b('0x2f')]=_['intersection'](_0x22fa9e['model'],qs[_0xb72b('0x30')](_0x15c246['query'][_0xb72b('0x30')]));_0x23c5a9[_0xb72b('0x2f')]=_0x23c5a9[_0xb72b('0x2f')][_0xb72b('0x31')]?_0x23c5a9[_0xb72b('0x2f')]:_0x22fa9e[_0xb72b('0x2b')];if(_0x15c246[_0xb72b('0x2c')][_0xb72b('0x3d')]){_0x23c5a9[_0xb72b('0x3e')]=[{'all':!![]}];}_0x23c5a9=_[_0xb72b('0x43')]({},_0x23c5a9,_0x15c246[_0xb72b('0x3b')]);return db[_0xb72b('0x28')][_0xb72b('0x44')](_0x23c5a9)[_0xb72b('0x21')](handleEntityNotFound(_0x1218ef,null))['then'](respondWithResult(_0x1218ef,null))[_0xb72b('0x41')](handleError(_0x1218ef,null));};exports[_0xb72b('0x45')]=function(_0x53379a,_0x3024d2){return db[_0xb72b('0x28')][_0xb72b('0x45')](_0x53379a[_0xb72b('0x46')],{})[_0xb72b('0x21')](function(_0x6661b2){var _0x3768d2=_0x53379a['user'][_0xb72b('0x47')]({'plain':!![]});if(!_0x3768d2)throw new Error(_0xb72b('0x48'));if(_0x3768d2[_0xb72b('0x49')]===_0xb72b('0x4a')){var _0x4b9726=_0x6661b2[_0xb72b('0x47')]({'plain':!![]});var _0x550add=_0xb72b('0x4b');return db['UserProfileSection'][_0xb72b('0x44')]({'where':{'name':_0x550add,'userProfileId':_0x3768d2[_0xb72b('0x4c')]},'raw':!![]})[_0xb72b('0x21')](function(_0x3da04d){if(_0x3da04d&&_0x3da04d['autoAssociation']===0x0){return db[_0xb72b('0x23')][_0xb72b('0x45')]({'name':_0x4b9726['name'],'resourceId':_0x4b9726['id'],'type':_0x3da04d[_0xb72b('0x25')],'sectionId':_0x3da04d['id']},{})[_0xb72b('0x21')](function(){return _0x6661b2;});}else{return _0x6661b2;}})['catch'](function(_0x48aa9c){logger['error'](_0xb72b('0x4d'),_0x48aa9c);throw _0x48aa9c;});}return _0x6661b2;})['then'](respondWithResult(_0x3024d2,0xc9))[_0xb72b('0x41')](handleError(_0x3024d2,null));};exports['update']=function(_0x42deaa,_0x260548){if(_0x42deaa[_0xb72b('0x46')]['id']){delete _0x42deaa[_0xb72b('0x46')]['id'];}return db['CmContactHasPhone'][_0xb72b('0x44')]({'where':{'id':_0x42deaa[_0xb72b('0x4e')]['id']}})[_0xb72b('0x21')](handleEntityNotFound(_0x260548,null))[_0xb72b('0x21')](saveUpdates(_0x42deaa[_0xb72b('0x46')],null))[_0xb72b('0x21')](respondWithResult(_0x260548,null))[_0xb72b('0x41')](handleError(_0x260548,null));};exports['destroy']=function(_0x5379fe,_0x1f42b6){return db[_0xb72b('0x28')]['find']({'where':{'id':_0x5379fe[_0xb72b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1f42b6,null))[_0xb72b('0x21')](removeEntity(_0x1f42b6,null))[_0xb72b('0x41')](handleError(_0x1f42b6,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 3de6cda..692c8bb 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 _0x26cf=['../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','CmContactHasPhone','cm_contact_has_phones','util'];(function(_0x51916e,_0x1c627e){var _0x450daf=function(_0x41e021){while(--_0x41e021){_0x51916e['push'](_0x51916e['shift']());}};_0x450daf(++_0x1c627e);}(_0x26cf,0x135));var _0xf26c=function(_0x5187d2,_0x1fea4c){_0x5187d2=_0x5187d2-0x0;var _0x1cedc9=_0x26cf[_0x5187d2];return _0x1cedc9;};'use strict';var _=require('lodash');var util=require(_0xf26c('0x0'));var logger=require(_0xf26c('0x1'))('api');var moment=require(_0xf26c('0x2'));var BPromise=require('bluebird');var rp=require(_0xf26c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf26c('0x4'));var config=require(_0xf26c('0x5'));var attributes=require('./cmContactHasPhone.attributes');module[_0xf26c('0x6')]=function(_0x10638a,_0x32d4ef){return _0x10638a[_0xf26c('0x7')](_0xf26c('0x8'),attributes,{'tableName':_0xf26c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x674a=['exports','define','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x5216af,_0x40b473){var _0xe6e4d9=function(_0x189a41){while(--_0x189a41){_0x5216af['push'](_0x5216af['shift']());}};_0xe6e4d9(++_0x40b473);}(_0x674a,0x1a0));var _0xa674=function(_0x2b10fb,_0x3ab77a){_0x2b10fb=_0x2b10fb-0x0;var _0x2ca490=_0x674a[_0x2b10fb];return _0x2ca490;};'use strict';var _=require(_0xa674('0x0'));var util=require('util');var logger=require(_0xa674('0x1'))(_0xa674('0x2'));var moment=require(_0xa674('0x3'));var BPromise=require('bluebird');var rp=require(_0xa674('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa674('0x5'));var config=require(_0xa674('0x6'));var attributes=require('./cmContactHasPhone.attributes');module[_0xa674('0x7')]=function(_0x222e18,_0x1d79a9){return _0x222e18[_0xa674('0x8')]('CmContactHasPhone',attributes,{'tableName':'cm_contact_has_phones','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 e84adf2..31d9ea1 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 _0x2ff5=['CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x20e676,_0x5347a4){var _0x2de6a6=function(_0x159948){while(--_0x159948){_0x20e676['push'](_0x20e676['shift']());}};_0x2de6a6(++_0x5347a4);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x44e19c,_0xf7b0ae){_0x44e19c=_0x44e19c-0x0;var _0xc56d93=_0x2ff5[_0x44e19c];return _0xc56d93;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var moment=require(_0x52ff('0x1'));var BPromise=require('bluebird');var rs=require(_0x52ff('0x2'));var fs=require('fs');var Redis=require(_0x52ff('0x3'));var db=require(_0x52ff('0x4'))['db'];var utils=require(_0x52ff('0x5'));var logger=require(_0x52ff('0x6'))(_0x52ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x52ff('0x8'));var client=jayson[_0x52ff('0x9')][_0x52ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47e375,_0x33be91,_0xbbba62){return new BPromise(function(_0x3cfd13,_0x17ca0b){return client[_0x52ff('0xb')](_0x47e375,_0xbbba62)[_0x52ff('0xc')](function(_0x27c199){logger[_0x52ff('0xd')](_0x52ff('0xe'),_0x33be91,_0x52ff('0xf'));logger[_0x52ff('0x10')](_0x52ff('0x11'),_0x33be91,_0x52ff('0xf'),JSON[_0x52ff('0x12')](_0x27c199));if(_0x27c199[_0x52ff('0x13')]){if(_0x27c199['error']['code']===0x1f4){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x33be91,_0x27c199[_0x52ff('0x13')]['message']);return _0x17ca0b(_0x27c199[_0x52ff('0x13')][_0x52ff('0x14')]);}logger['error'](_0x52ff('0xe'),_0x33be91,_0x27c199[_0x52ff('0x13')][_0x52ff('0x14')]);return _0x3cfd13(_0x27c199[_0x52ff('0x13')][_0x52ff('0x14')]);}else{logger[_0x52ff('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x33be91,_0x52ff('0xf'));_0x3cfd13(_0x27c199[_0x52ff('0x15')][_0x52ff('0x14')]);}})[_0x52ff('0x16')](function(_0xa7ce6c){logger[_0x52ff('0x13')]('CmContactHasPhone,\x20%s,\x20%s',_0x33be91,_0xa7ce6c);_0x17ca0b(_0xa7ce6c);});});} \ No newline at end of file +var _0x6be2=['result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x13a3a1,_0x4b1458){var _0x1f0fbf=function(_0x40677a){while(--_0x40677a){_0x13a3a1['push'](_0x13a3a1['shift']());}};_0x1f0fbf(++_0x4b1458);}(_0x6be2,0x1cc));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x26be('0x0'));var moment=require(_0x26be('0x1'));var BPromise=require(_0x26be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26be('0x3'))['db'];var utils=require(_0x26be('0x4'));var logger=require(_0x26be('0x5'))('rpc');var config=require(_0x26be('0x6'));var jayson=require(_0x26be('0x7'));var client=jayson[_0x26be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3194cc,_0x275dd9,_0x5ca41d){return new BPromise(function(_0x127894,_0x47ffc7){return client[_0x26be('0x9')](_0x3194cc,_0x5ca41d)['then'](function(_0x29fe19){logger[_0x26be('0xa')](_0x26be('0xb'),_0x275dd9,_0x26be('0xc'));logger['debug']('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x275dd9,'request\x20sent',JSON['stringify'](_0x29fe19));if(_0x29fe19[_0x26be('0xd')]){if(_0x29fe19['error'][_0x26be('0xe')]===0x1f4){logger[_0x26be('0xd')](_0x26be('0xb'),_0x275dd9,_0x29fe19[_0x26be('0xd')][_0x26be('0xf')]);return _0x47ffc7(_0x29fe19[_0x26be('0xd')][_0x26be('0xf')]);}logger[_0x26be('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x275dd9,_0x29fe19[_0x26be('0xd')][_0x26be('0xf')]);return _0x127894(_0x29fe19[_0x26be('0xd')][_0x26be('0xf')]);}else{logger[_0x26be('0xa')](_0x26be('0xb'),_0x275dd9,'request\x20sent');_0x127894(_0x29fe19[_0x26be('0x10')][_0x26be('0xf')]);}})['catch'](function(_0x326f1c){logger[_0x26be('0xd')](_0x26be('0xb'),_0x275dd9,_0x326f1c);_0x47ffc7(_0x326f1c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 4bb8fb2..caa9afe 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 _0x03bc=['/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasPhone.controller','get','isAuthenticated','index'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x03bc,0x7e));var _0xc03b=function(_0x14ff1f,_0x54cfd4){_0x14ff1f=_0x14ff1f-0x0;var _0x55911e=_0x03bc[_0x14ff1f];return _0x55911e;};'use strict';var multer=require('multer');var util=require(_0xc03b('0x0'));var path=require(_0xc03b('0x1'));var timeout=require(_0xc03b('0x2'));var express=require('express');var router=express[_0xc03b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc03b('0x4'));var interaction=require(_0xc03b('0x5'));var config=require('../../config/environment');var controller=require(_0xc03b('0x6'));router[_0xc03b('0x7')]('/',auth[_0xc03b('0x8')](),controller[_0xc03b('0x9')]);router[_0xc03b('0x7')](_0xc03b('0xa'),auth[_0xc03b('0x8')](),controller[_0xc03b('0xb')]);router[_0xc03b('0xc')]('/',auth['isAuthenticated'](),controller[_0xc03b('0xd')]);router['put'](_0xc03b('0xa'),auth[_0xc03b('0x8')](),controller[_0xc03b('0xe')]);router[_0xc03b('0xf')](_0xc03b('0xa'),auth['isAuthenticated'](),controller[_0xc03b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9910=['delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x34b5ca,_0x594010){var _0x2d72c0=function(_0x4ae1d3){while(--_0x4ae1d3){_0x34b5ca['push'](_0x34b5ca['shift']());}};_0x2d72c0(++_0x594010);}(_0x9910,0x1d7));var _0x0991=function(_0x53f208,_0x1a7dee){_0x53f208=_0x53f208-0x0;var _0x3ba3be=_0x9910[_0x53f208];return _0x3ba3be;};'use strict';var multer=require('multer');var util=require(_0x0991('0x0'));var path=require(_0x0991('0x1'));var timeout=require(_0x0991('0x2'));var express=require('express');var router=express[_0x0991('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0991('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0991('0x5'));var controller=require(_0x0991('0x6'));router[_0x0991('0x7')]('/',auth[_0x0991('0x8')](),controller[_0x0991('0x9')]);router[_0x0991('0x7')](_0x0991('0xa'),auth['isAuthenticated'](),controller[_0x0991('0xb')]);router[_0x0991('0xc')]('/',auth[_0x0991('0x8')](),controller[_0x0991('0xd')]);router['put'](_0x0991('0xa'),auth[_0x0991('0x8')](),controller[_0x0991('0xe')]);router[_0x0991('0xf')](_0x0991('0xa'),auth[_0x0991('0x8')](),controller[_0x0991('0x10')]);module[_0x0991('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 34550f9..9d27f47 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 _0xa630=['BOOLEAN','ENUM','voice','sequelize','lodash','alias','setDataValue','getDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify'];(function(_0x569c0b,_0x17a48f){var _0x5e23ad=function(_0x5316a6){while(--_0x5316a6){_0x569c0b['push'](_0x569c0b['shift']());}};_0x5e23ad(++_0x17a48f);}(_0xa630,0xbe));var _0x0a63=function(_0x12991b,_0xf92ce9){_0x12991b=_0x12991b-0x0;var _0x4c1133=_0xa630[_0x12991b];return _0x4c1133;};'use strict';var Sequelize=require(_0x0a63('0x0'));var _=require(_0x0a63('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1a9586){return this['getDataValue'](_0x0a63('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x91a747){this[_0x0a63('0x3')](_0x0a63('0x2'),_0x91a747?_0x91a747:this[_0x0a63('0x4')](_0x0a63('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x0a63('0x6')](_0x0a63('0x7')),'get':function(){if(this[_0x0a63('0x4')](_0x0a63('0x8'))===_0x0a63('0x9')){return JSON[_0x0a63('0xa')](this['getDataValue'](_0x0a63('0xb')));}else{return this[_0x0a63('0x4')](_0x0a63('0xb'));}},'set':function(_0x218142){if(Array[_0x0a63('0xc')](_0x218142)){this[_0x0a63('0x3')](_0x0a63('0xb'),JSON[_0x0a63('0xd')](_0x218142));}else{this[_0x0a63('0x3')](_0x0a63('0xb'),_0x218142);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0a63('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0a63('0xf')](_0x0a63('0x10'))}}; \ No newline at end of file +var _0xb647=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xb647,0xdb));var _0x7b64=function(_0x13aa8c,_0x324c77){_0x13aa8c=_0x13aa8c-0x0;var _0x607a49=_0xb647[_0x13aa8c];return _0x607a49;};'use strict';var Sequelize=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));module[_0x7b64('0x2')]={'name':{'type':Sequelize[_0x7b64('0x3')],'get':function(_0x38de52){return this[_0x7b64('0x4')](_0x7b64('0x5'));}},'alias':{'type':Sequelize[_0x7b64('0x6')],'allowNull':![],'set':function(_0x54eee8){this[_0x7b64('0x7')]('alias',_0x54eee8?_0x54eee8:this[_0x7b64('0x4')](_0x7b64('0x8')));}},'type':{'type':Sequelize[_0x7b64('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x7b64('0x9')](_0x7b64('0xa')),'get':function(){if(this[_0x7b64('0x4')](_0x7b64('0xb'))===_0x7b64('0xc')){return JSON[_0x7b64('0xd')](this['getDataValue'](_0x7b64('0xe')));}else{return this['getDataValue'](_0x7b64('0xe'));}},'set':function(_0x4c8014){if(Array['isArray'](_0x4c8014)){this[_0x7b64('0x7')](_0x7b64('0xe'),JSON['stringify'](_0x4c8014));}else{this[_0x7b64('0x7')](_0x7b64('0xe'),_0x4c8014);}}},'required':{'type':Sequelize[_0x7b64('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7b64('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7b64('0x10')](_0x7b64('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1a29b16..3bcb403 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 _0x4522=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','name','send','index','map','CmCustomField','rawAttributes','fieldName','model','differenceBy','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','keys','find','update','body','params','transaction','create','Sequelize','TEXT','text','number','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x3bc5bf,_0x587467){var _0x86a250=function(_0x4bfa44){while(--_0x4bfa44){_0x3bc5bf['push'](_0x3bc5bf['shift']());}};_0x86a250(++_0x587467);}(_0x4522,0x1a0));var _0x2452=function(_0xd8751d,_0x62410a){_0xd8751d=_0xd8751d-0x0;var _0x36c142=_0x4522[_0xd8751d];return _0x36c142;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2452('0x0'));var zipdir=require(_0x2452('0x1'));var jsonpatch=require(_0x2452('0x2'));var rp=require('request-promise');var moment=require(_0x2452('0x3'));var BPromise=require(_0x2452('0x4'));var Mustache=require(_0x2452('0x5'));var util=require(_0x2452('0x6'));var path=require(_0x2452('0x7'));var sox=require(_0x2452('0x8'));var csv=require(_0x2452('0x9'));var ejs=require(_0x2452('0xa'));var fs=require('fs');var fs_extra=require(_0x2452('0xb'));var _=require(_0x2452('0xc'));var squel=require(_0x2452('0xd'));var crypto=require(_0x2452('0xe'));var jsforce=require(_0x2452('0xf'));var deskjs=require(_0x2452('0x10'));var toCsv=require(_0x2452('0x9'));var querystring=require(_0x2452('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2452('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2452('0x13'));var logger=require(_0x2452('0x14'))(_0x2452('0x15'));var utils=require(_0x2452('0x16'));var config=require(_0x2452('0x17'));var licenseUtil=require(_0x2452('0x18'));var db=require(_0x2452('0x19'))['db'];function respondWithStatusCode(_0x2377b9,_0x4968e8){_0x4968e8=_0x4968e8||0xcc;return function(_0x529fb2){if(_0x529fb2){return _0x2377b9['sendStatus'](_0x4968e8);}return _0x2377b9[_0x2452('0x1a')](_0x4968e8)['end']();};}function respondWithResult(_0x33e592,_0x506cd4){_0x506cd4=_0x506cd4||0xc8;return function(_0x209a43){if(_0x209a43){return _0x33e592[_0x2452('0x1a')](_0x506cd4)['json'](_0x209a43);}};}function respondWithFilteredResult(_0x1dbadf,_0x47930c){return function(_0x3dd8cc){if(_0x3dd8cc){var _0x734b88=_0x3dd8cc[_0x2452('0x1b')],_0x461d2b=_0x47930c[_0x2452('0x1c')],_0xdede20=_0x47930c['offset']+_0x47930c['limit'],_0x4e1d20;if(_0xdede20>=_0x734b88){_0xdede20=_0x734b88;_0x4e1d20=0xc8;}else{_0x4e1d20=0xce;}_0x1dbadf[_0x2452('0x1a')](_0x4e1d20);return _0x1dbadf[_0x2452('0x1d')](_0x2452('0x1e'),_0x461d2b+'-'+_0xdede20+'/'+_0x734b88)['json'](_0x3dd8cc);}return null;};}function patchUpdates(_0x914d2b){return function(_0x467963){try{jsonpatch[_0x2452('0x1f')](_0x467963,_0x914d2b,!![]);}catch(_0x18b058){return BPromise[_0x2452('0x20')](_0x18b058);}return _0x467963[_0x2452('0x21')]();};}function saveUpdates(_0x3f48c2,_0xea452e){return function(_0x5e921d){if(_0x5e921d){return _0x5e921d['update'](_0x3f48c2)[_0x2452('0x22')](function(_0x32dfe7){return _0x32dfe7;});}return null;};}function removeEntity(_0x4bb3ff,_0x17d0a0){return function(_0x395cf1){if(_0x395cf1){return _0x395cf1[_0x2452('0x23')]()[_0x2452('0x22')](function(){_0x4bb3ff[_0x2452('0x1a')](0xcc)[_0x2452('0x24')]();});}};}function handleEntityNotFound(_0x155caa,_0x543b06){return function(_0x119bf6){if(!_0x119bf6){_0x155caa[_0x2452('0x25')](0x194);}return _0x119bf6;};}function handleError(_0x1561e5,_0x231410){_0x231410=_0x231410||0x1f4;return function(_0x3a4326){logger['error'](_0x3a4326['stack']);if(_0x3a4326[_0x2452('0x26')]){delete _0x3a4326[_0x2452('0x26')];}_0x1561e5[_0x2452('0x1a')](_0x231410)[_0x2452('0x27')](_0x3a4326);};}exports[_0x2452('0x28')]=function(_0x48b313,_0x3fba00){var _0x118db1={},_0x5e9184={},_0x4a25aa={'count':0x0,'rows':[]};var _0x332878=_[_0x2452('0x29')](db[_0x2452('0x2a')][_0x2452('0x2b')],function(_0x43fde0){return{'name':_0x43fde0[_0x2452('0x2c')],'type':_0x43fde0['type']['key']};});_0x5e9184[_0x2452('0x2d')]=_[_0x2452('0x2e')](_[_0x2452('0x29')](_0x332878,'name'),[_0x2452('0x26')]);_0x5e9184[_0x2452('0x2f')]=_['keys'](_0x48b313[_0x2452('0x2f')]);_0x5e9184[_0x2452('0x30')]=_[_0x2452('0x31')](_0x5e9184[_0x2452('0x2d')],_0x5e9184[_0x2452('0x2f')]);_0x118db1[_0x2452('0x32')]=_[_0x2452('0x31')](_0x5e9184[_0x2452('0x2d')],qs[_0x2452('0x33')](_0x48b313[_0x2452('0x2f')][_0x2452('0x33')]));_0x118db1[_0x2452('0x32')]=_0x118db1[_0x2452('0x32')]['length']?_0x118db1[_0x2452('0x32')]:_0x5e9184[_0x2452('0x2d')];if(!_0x48b313['query'][_0x2452('0x34')]('nolimit')){_0x118db1[_0x2452('0x35')]=qs[_0x2452('0x35')](_0x48b313['query'][_0x2452('0x35')]);_0x118db1[_0x2452('0x1c')]=qs[_0x2452('0x1c')](_0x48b313['query'][_0x2452('0x1c')]);}_0x118db1[_0x2452('0x36')]=qs['sort'](_0x48b313[_0x2452('0x2f')][_0x2452('0x37')]);_0x118db1[_0x2452('0x38')]=qs[_0x2452('0x30')](_[_0x2452('0x39')](_0x48b313['query'],_0x5e9184['filters']),_0x332878);if(_0x48b313['query'][_0x2452('0x3a')]){_0x118db1[_0x2452('0x38')]=_[_0x2452('0x3b')](_0x118db1[_0x2452('0x38')],{'$or':_[_0x2452('0x29')](_0x332878,function(_0x4c4c45){if(_0x4c4c45[_0x2452('0x3c')]!=='VIRTUAL'){var _0x5be9b4={};_0x5be9b4[_0x4c4c45[_0x2452('0x26')]]={'$like':'%'+_0x48b313['query'][_0x2452('0x3a')]+'%'};return _0x5be9b4;}})});}_0x118db1=_[_0x2452('0x3b')]({},_0x118db1,_0x48b313['options']);var _0x30b49f={'where':_0x118db1[_0x2452('0x38')]};return db[_0x2452('0x2a')][_0x2452('0x1b')](_0x30b49f)[_0x2452('0x22')](function(_0x112849){_0x4a25aa[_0x2452('0x1b')]=_0x112849;if(_0x48b313[_0x2452('0x2f')]['includeAll']){_0x118db1[_0x2452('0x3d')]=[{'all':!![]}];}return db['CmCustomField'][_0x2452('0x3e')](_0x118db1);})[_0x2452('0x22')](function(_0x56bd34){_0x4a25aa[_0x2452('0x3f')]=_0x56bd34;return _0x4a25aa;})[_0x2452('0x22')](respondWithFilteredResult(_0x3fba00,_0x118db1))[_0x2452('0x40')](handleError(_0x3fba00,null));};exports[_0x2452('0x41')]=function(_0x3d8bcb,_0x5af887){var _0x1a2cfd={'raw':!![],'where':{'id':_0x3d8bcb['params']['id']}},_0x29910e={};_0x29910e[_0x2452('0x2d')]=_[_0x2452('0x42')](db[_0x2452('0x2a')][_0x2452('0x2b')]);_0x29910e['query']=_[_0x2452('0x42')](_0x3d8bcb[_0x2452('0x2f')]);_0x29910e[_0x2452('0x30')]=_[_0x2452('0x31')](_0x29910e[_0x2452('0x2d')],_0x29910e[_0x2452('0x2f')]);_0x1a2cfd['attributes']=_[_0x2452('0x31')](_0x29910e['model'],qs[_0x2452('0x33')](_0x3d8bcb[_0x2452('0x2f')]['fields']));_0x1a2cfd['attributes']=_0x1a2cfd['attributes']['length']?_0x1a2cfd[_0x2452('0x32')]:_0x29910e['model'];if(_0x3d8bcb[_0x2452('0x2f')]['includeAll']){_0x1a2cfd[_0x2452('0x3d')]=[{'all':!![]}];}_0x1a2cfd=_[_0x2452('0x3b')]({},_0x1a2cfd,_0x3d8bcb['options']);return db['CmCustomField'][_0x2452('0x43')](_0x1a2cfd)['then'](handleEntityNotFound(_0x5af887,null))[_0x2452('0x22')](respondWithResult(_0x5af887,null))[_0x2452('0x40')](handleError(_0x5af887,null));};exports[_0x2452('0x44')]=function(_0x382ee3,_0x57f815){if(_0x382ee3['body']['id']){delete _0x382ee3[_0x2452('0x45')]['id'];}return db[_0x2452('0x2a')][_0x2452('0x43')]({'where':{'id':_0x382ee3[_0x2452('0x46')]['id']}})[_0x2452('0x22')](handleEntityNotFound(_0x57f815,null))['then'](saveUpdates(_0x382ee3[_0x2452('0x45')],null))['then'](respondWithResult(_0x57f815,null))[_0x2452('0x40')](handleError(_0x57f815,null));};exports['destroy']=function(_0x454666,_0x21369e){return db['CmCustomField'][_0x2452('0x43')]({'where':{'id':_0x454666['params']['id']}})[_0x2452('0x22')](handleEntityNotFound(_0x21369e,null))['then'](removeEntity(_0x21369e,null))['catch'](handleError(_0x21369e,null));};exports['create']=function(_0x319814,_0xa23333){var _0x36ebcb;return db['sequelize'][_0x2452('0x47')](function(_0x39ceba){return db[_0x2452('0x2a')][_0x2452('0x48')](_0x319814[_0x2452('0x45')],{'transaction':_0x39ceba})['then'](function(_0x43507c){_0x36ebcb=_0x43507c;var _0x52d286={'type':db[_0x2452('0x49')][_0x2452('0x4a')],'transaction':_0x39ceba};switch(_0x319814[_0x2452('0x45')][_0x2452('0x3c')]){case _0x2452('0x4b'):_0x52d286[_0x2452('0x3c')]=db[_0x2452('0x49')][_0x2452('0x4a')];break;case _0x2452('0x4c'):_0x52d286['type']=db[_0x2452('0x49')]['INTEGER'];break;case _0x2452('0x4d'):_0x52d286['type']=db[_0x2452('0x49')][_0x2452('0x4e')];_0x52d286['defaultValue']=![];break;default:}return db[_0x2452('0x4f')][_0x2452('0x50')][_0x2452('0x51')](_0x2452('0x52'),util[_0x2452('0x53')](_0x2452('0x54'),_0x36ebcb['id']),_0x52d286);})[_0x2452('0x22')](function(){return _0x36ebcb;});})[_0x2452('0x22')](respondWithResult(_0xa23333,0xc9))[_0x2452('0x40')](handleError(_0xa23333,null));}; \ No newline at end of file +var _0xe605=['apply','reject','save','then','destroy','end','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmCustomField','include','findAll','rows','params','keys','rawAttributes','includeAll','find','catch','update','body','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe605,0x92));var _0x5e60=function(_0x5b4677,_0x24aa33){_0x5b4677=_0x5b4677-0x0;var _0x52fd33=_0xe605[_0x5b4677];return _0x52fd33;};'use strict';var pdf=require(_0x5e60('0x0'));var emlformat=require(_0x5e60('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5e60('0x2'));var jsonpatch=require(_0x5e60('0x3'));var rp=require(_0x5e60('0x4'));var moment=require(_0x5e60('0x5'));var BPromise=require(_0x5e60('0x6'));var Mustache=require(_0x5e60('0x7'));var util=require(_0x5e60('0x8'));var path=require(_0x5e60('0x9'));var sox=require(_0x5e60('0xa'));var csv=require(_0x5e60('0xb'));var ejs=require(_0x5e60('0xc'));var fs=require('fs');var fs_extra=require(_0x5e60('0xd'));var _=require('lodash');var squel=require(_0x5e60('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e60('0xb'));var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e60('0x14'));var logger=require('../../config/logger')(_0x5e60('0x15'));var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e60('0x18'))['db'];function respondWithStatusCode(_0x178782,_0x1f4e14){_0x1f4e14=_0x1f4e14||0xcc;return function(_0xe039de){if(_0xe039de){return _0x178782[_0x5e60('0x19')](_0x1f4e14);}return _0x178782[_0x5e60('0x1a')](_0x1f4e14)['end']();};}function respondWithResult(_0x209adb,_0x45304f){_0x45304f=_0x45304f||0xc8;return function(_0x21e3c8){if(_0x21e3c8){return _0x209adb[_0x5e60('0x1a')](_0x45304f)['json'](_0x21e3c8);}};}function respondWithFilteredResult(_0x20af5f,_0x529ffe){return function(_0x1ffd77){if(_0x1ffd77){var _0x3bc7d8=_0x1ffd77[_0x5e60('0x1b')],_0x4cf084=_0x529ffe[_0x5e60('0x1c')],_0x39be57=_0x529ffe['offset']+_0x529ffe[_0x5e60('0x1d')],_0x3e1a44;if(_0x39be57>=_0x3bc7d8){_0x39be57=_0x3bc7d8;_0x3e1a44=0xc8;}else{_0x3e1a44=0xce;}_0x20af5f[_0x5e60('0x1a')](_0x3e1a44);return _0x20af5f['set'](_0x5e60('0x1e'),_0x4cf084+'-'+_0x39be57+'/'+_0x3bc7d8)[_0x5e60('0x1f')](_0x1ffd77);}return null;};}function patchUpdates(_0x17c630){return function(_0x311fef){try{jsonpatch[_0x5e60('0x20')](_0x311fef,_0x17c630,!![]);}catch(_0x3c8e47){return BPromise[_0x5e60('0x21')](_0x3c8e47);}return _0x311fef[_0x5e60('0x22')]();};}function saveUpdates(_0x3282e4,_0x45f1a6){return function(_0x228f13){if(_0x228f13){return _0x228f13['update'](_0x3282e4)[_0x5e60('0x23')](function(_0x5d77dd){return _0x5d77dd;});}return null;};}function removeEntity(_0x376069,_0x1a44e5){return function(_0x2b0bae){if(_0x2b0bae){return _0x2b0bae[_0x5e60('0x24')]()[_0x5e60('0x23')](function(){_0x376069[_0x5e60('0x1a')](0xcc)[_0x5e60('0x25')]();});}};}function handleEntityNotFound(_0x5d2c03,_0x18d527){return function(_0x7dbdb7){if(!_0x7dbdb7){_0x5d2c03[_0x5e60('0x19')](0x194);}return _0x7dbdb7;};}function handleError(_0x4dd9fb,_0x45cb62){_0x45cb62=_0x45cb62||0x1f4;return function(_0x56e3a5){logger[_0x5e60('0x26')](_0x56e3a5[_0x5e60('0x27')]);if(_0x56e3a5['name']){delete _0x56e3a5[_0x5e60('0x28')];}_0x4dd9fb['status'](_0x45cb62)[_0x5e60('0x29')](_0x56e3a5);};}exports[_0x5e60('0x2a')]=function(_0x4ba727,_0x46691f){var _0x19e5ab={},_0x5b1b46={},_0x1ee931={'count':0x0,'rows':[]};var _0xac9c7a=_['map'](db['CmCustomField']['rawAttributes'],function(_0xf25956){return{'name':_0xf25956[_0x5e60('0x2b')],'type':_0xf25956[_0x5e60('0x2c')][_0x5e60('0x2d')]};});_0x5b1b46[_0x5e60('0x2e')]=_['differenceBy'](_[_0x5e60('0x2f')](_0xac9c7a,_0x5e60('0x28')),['name']);_0x5b1b46[_0x5e60('0x30')]=_['keys'](_0x4ba727['query']);_0x5b1b46[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x5b1b46[_0x5e60('0x2e')],_0x5b1b46[_0x5e60('0x30')]);_0x19e5ab[_0x5e60('0x33')]=_[_0x5e60('0x32')](_0x5b1b46[_0x5e60('0x2e')],qs[_0x5e60('0x34')](_0x4ba727[_0x5e60('0x30')][_0x5e60('0x34')]));_0x19e5ab['attributes']=_0x19e5ab[_0x5e60('0x33')]['length']?_0x19e5ab['attributes']:_0x5b1b46[_0x5e60('0x2e')];if(!_0x4ba727[_0x5e60('0x30')]['hasOwnProperty'](_0x5e60('0x35'))){_0x19e5ab['limit']=qs[_0x5e60('0x1d')](_0x4ba727[_0x5e60('0x30')][_0x5e60('0x1d')]);_0x19e5ab[_0x5e60('0x1c')]=qs[_0x5e60('0x1c')](_0x4ba727[_0x5e60('0x30')][_0x5e60('0x1c')]);}_0x19e5ab[_0x5e60('0x36')]=qs['sort'](_0x4ba727[_0x5e60('0x30')][_0x5e60('0x37')]);_0x19e5ab[_0x5e60('0x38')]=qs[_0x5e60('0x31')](_[_0x5e60('0x39')](_0x4ba727[_0x5e60('0x30')],_0x5b1b46[_0x5e60('0x31')]),_0xac9c7a);if(_0x4ba727['query'][_0x5e60('0x3a')]){_0x19e5ab[_0x5e60('0x38')]=_['merge'](_0x19e5ab['where'],{'$or':_[_0x5e60('0x2f')](_0xac9c7a,function(_0xd67757){if(_0xd67757[_0x5e60('0x2c')]!==_0x5e60('0x3b')){var _0x31b900={};_0x31b900[_0xd67757['name']]={'$like':'%'+_0x4ba727[_0x5e60('0x30')][_0x5e60('0x3a')]+'%'};return _0x31b900;}})});}_0x19e5ab=_[_0x5e60('0x3c')]({},_0x19e5ab,_0x4ba727[_0x5e60('0x3d')]);var _0x2f4b3e={'where':_0x19e5ab[_0x5e60('0x38')]};return db[_0x5e60('0x3e')]['count'](_0x2f4b3e)[_0x5e60('0x23')](function(_0x1f95b2){_0x1ee931['count']=_0x1f95b2;if(_0x4ba727['query']['includeAll']){_0x19e5ab[_0x5e60('0x3f')]=[{'all':!![]}];}return db[_0x5e60('0x3e')][_0x5e60('0x40')](_0x19e5ab);})[_0x5e60('0x23')](function(_0x480ebb){_0x1ee931[_0x5e60('0x41')]=_0x480ebb;return _0x1ee931;})[_0x5e60('0x23')](respondWithFilteredResult(_0x46691f,_0x19e5ab))['catch'](handleError(_0x46691f,null));};exports['show']=function(_0x1bf6e4,_0x42b9b0){var _0x40cb06={'raw':!![],'where':{'id':_0x1bf6e4[_0x5e60('0x42')]['id']}},_0x38ff1d={};_0x38ff1d[_0x5e60('0x2e')]=_[_0x5e60('0x43')](db[_0x5e60('0x3e')][_0x5e60('0x44')]);_0x38ff1d['query']=_[_0x5e60('0x43')](_0x1bf6e4[_0x5e60('0x30')]);_0x38ff1d['filters']=_[_0x5e60('0x32')](_0x38ff1d[_0x5e60('0x2e')],_0x38ff1d[_0x5e60('0x30')]);_0x40cb06[_0x5e60('0x33')]=_[_0x5e60('0x32')](_0x38ff1d['model'],qs[_0x5e60('0x34')](_0x1bf6e4[_0x5e60('0x30')][_0x5e60('0x34')]));_0x40cb06[_0x5e60('0x33')]=_0x40cb06['attributes']['length']?_0x40cb06['attributes']:_0x38ff1d[_0x5e60('0x2e')];if(_0x1bf6e4[_0x5e60('0x30')][_0x5e60('0x45')]){_0x40cb06[_0x5e60('0x3f')]=[{'all':!![]}];}_0x40cb06=_[_0x5e60('0x3c')]({},_0x40cb06,_0x1bf6e4[_0x5e60('0x3d')]);return db['CmCustomField'][_0x5e60('0x46')](_0x40cb06)[_0x5e60('0x23')](handleEntityNotFound(_0x42b9b0,null))[_0x5e60('0x23')](respondWithResult(_0x42b9b0,null))[_0x5e60('0x47')](handleError(_0x42b9b0,null));};exports[_0x5e60('0x48')]=function(_0x3dbdc4,_0x214f27){if(_0x3dbdc4['body']['id']){delete _0x3dbdc4[_0x5e60('0x49')]['id'];}return db[_0x5e60('0x3e')][_0x5e60('0x46')]({'where':{'id':_0x3dbdc4[_0x5e60('0x42')]['id']}})[_0x5e60('0x23')](handleEntityNotFound(_0x214f27,null))[_0x5e60('0x23')](saveUpdates(_0x3dbdc4[_0x5e60('0x49')],null))[_0x5e60('0x23')](respondWithResult(_0x214f27,null))[_0x5e60('0x47')](handleError(_0x214f27,null));};exports[_0x5e60('0x24')]=function(_0xe5e675,_0x24e3aa){return db[_0x5e60('0x3e')][_0x5e60('0x46')]({'where':{'id':_0xe5e675[_0x5e60('0x42')]['id']}})[_0x5e60('0x23')](handleEntityNotFound(_0x24e3aa,null))[_0x5e60('0x23')](removeEntity(_0x24e3aa,null))[_0x5e60('0x47')](handleError(_0x24e3aa,null));};exports['create']=function(_0x494ed3,_0x1d85eb){var _0x4d3588;return db[_0x5e60('0x4a')][_0x5e60('0x4b')](function(_0x20d6e6){return db[_0x5e60('0x3e')][_0x5e60('0x4c')](_0x494ed3[_0x5e60('0x49')],{'transaction':_0x20d6e6})['then'](function(_0x48bea6){_0x4d3588=_0x48bea6;var _0xd7d32c={'type':db[_0x5e60('0x4d')][_0x5e60('0x4e')],'transaction':_0x20d6e6};switch(_0x494ed3['body']['type']){case _0x5e60('0x4f'):_0xd7d32c[_0x5e60('0x2c')]=db[_0x5e60('0x4d')]['TEXT'];break;case _0x5e60('0x50'):_0xd7d32c[_0x5e60('0x2c')]=db[_0x5e60('0x4d')][_0x5e60('0x51')];break;case _0x5e60('0x52'):_0xd7d32c[_0x5e60('0x2c')]=db['Sequelize'][_0x5e60('0x53')];_0xd7d32c[_0x5e60('0x54')]=![];break;default:}return db['sequelize'][_0x5e60('0x55')][_0x5e60('0x56')](_0x5e60('0x57'),util['format'](_0x5e60('0x58'),_0x4d3588['id']),_0xd7d32c);})[_0x5e60('0x23')](function(){return _0x4d3588;});})['then'](respondWithResult(_0x1d85eb,0xc9))[_0x5e60('0x47')](handleError(_0x1d85eb,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9fb563d..d11dec0 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 _0x0cc2=['moment','bluebird','path','./cmCustomField.attributes','CmCustomField','lodash','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0cc2,0x108));var _0x20cc=function(_0x35808a,_0x1ed4f9){_0x35808a=_0x35808a-0x0;var _0x1fcc89=_0x0cc2[_0x35808a];return _0x1fcc89;};'use strict';var _=require(_0x20cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x20cc('0x1'));var moment=require(_0x20cc('0x2'));var BPromise=require(_0x20cc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20cc('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x20cc('0x5'));module['exports']=function(_0x301a6a,_0xc9fbf){return _0x301a6a['define'](_0x20cc('0x6'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee68=['api','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x15ed84,_0x589521){var _0x426d2b=function(_0x5d294a){while(--_0x5d294a){_0x15ed84['push'](_0x15ed84['shift']());}};_0x426d2b(++_0x589521);}(_0xee68,0x1aa));var _0x8ee6=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xee68[_0x37756b];return _0x46efec;};'use strict';var _=require(_0x8ee6('0x0'));var util=require(_0x8ee6('0x1'));var logger=require(_0x8ee6('0x2'))(_0x8ee6('0x3'));var moment=require('moment');var BPromise=require(_0x8ee6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ee6('0x5'));var rimraf=require(_0x8ee6('0x6'));var config=require(_0x8ee6('0x7'));var attributes=require(_0x8ee6('0x8'));module[_0x8ee6('0x9')]=function(_0x56afef,_0x43b4c4){return _0x56afef[_0x8ee6('0xa')](_0x8ee6('0xb'),attributes,{'tableName':_0x8ee6('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0a456d3..812177f 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 _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7bae,0x13b));var _0xe7ba=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x7bae[_0x1992f1];return _0x413dfe;};'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')]('CmCustomField,\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')]('CmCustomField,\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 +var _0x9aea=['result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x128d7f,_0xda807){var _0x2c5c11=function(_0x4d6384){while(--_0x4d6384){_0x128d7f['push'](_0x128d7f['shift']());}};_0x2c5c11(++_0xda807);}(_0x9aea,0xdd));var _0xa9ae=function(_0x5947dc,_0x7fd857){_0x5947dc=_0x5947dc-0x0;var _0x5d8c3d=_0x9aea[_0x5947dc];return _0x5d8c3d;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var moment=require(_0xa9ae('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9ae('0x2'));var fs=require('fs');var Redis=require(_0xa9ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9ae('0x4'));var logger=require(_0xa9ae('0x5'))(_0xa9ae('0x6'));var config=require(_0xa9ae('0x7'));var jayson=require(_0xa9ae('0x8'));var client=jayson['client'][_0xa9ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22734b,_0x1e57c4,_0x53e52c){return new BPromise(function(_0x1f2e4b,_0x3917f0){return client[_0xa9ae('0xa')](_0x22734b,_0x53e52c)[_0xa9ae('0xb')](function(_0x1882dc){logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));logger[_0xa9ae('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1e57c4,_0xa9ae('0xe'),JSON['stringify'](_0x1882dc));if(_0x1882dc[_0xa9ae('0x10')]){if(_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x11')]===0x1f4){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x3917f0(_0x1882dc[_0xa9ae('0x10')]['message']);}logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x1f2e4b(_0x1882dc['error'][_0xa9ae('0x12')]);}else{logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));_0x1f2e4b(_0x1882dc[_0xa9ae('0x13')][_0xa9ae('0x12')]);}})['catch'](function(_0x3e4810){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x3e4810);_0x3917f0(_0x3e4810);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index de04c24..ae4c3f9 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 _0xae74=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','show','put','delete','destroy','exports','util'];(function(_0xd9c529,_0x19f8cc){var _0x146760=function(_0x1aa5e8){while(--_0x1aa5e8){_0xd9c529['push'](_0xd9c529['shift']());}};_0x146760(++_0x19f8cc);}(_0xae74,0x186));var _0x4ae7=function(_0x5de02f,_0x554f59){_0x5de02f=_0x5de02f-0x0;var _0x40083f=_0xae74[_0x5de02f];return _0x40083f;};'use strict';var multer=require('multer');var util=require(_0x4ae7('0x0'));var path=require(_0x4ae7('0x1'));var timeout=require(_0x4ae7('0x2'));var express=require('express');var router=express[_0x4ae7('0x3')]();var fs_extra=require(_0x4ae7('0x4'));var auth=require(_0x4ae7('0x5'));var interaction=require(_0x4ae7('0x6'));var config=require(_0x4ae7('0x7'));var controller=require(_0x4ae7('0x8'));router['get']('/',auth[_0x4ae7('0x9')](),controller[_0x4ae7('0xa')]);router['get'](_0x4ae7('0xb'),auth[_0x4ae7('0x9')](),controller[_0x4ae7('0xc')]);router['post']('/',auth[_0x4ae7('0x9')](),controller['create']);router[_0x4ae7('0xd')](_0x4ae7('0xb'),auth[_0x4ae7('0x9')](),controller['update']);router[_0x4ae7('0xe')](_0x4ae7('0xb'),auth[_0x4ae7('0x9')](),controller[_0x4ae7('0xf')]);module[_0x4ae7('0x10')]=router; \ No newline at end of file +var _0xa902=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','post','create','put','isAuthenticated','delete'];(function(_0x8ce582,_0x10b0b7){var _0x14bb7b=function(_0xdea4a6){while(--_0xdea4a6){_0x8ce582['push'](_0x8ce582['shift']());}};_0x14bb7b(++_0x10b0b7);}(_0xa902,0x132));var _0x2a90=function(_0x2dbd2a,_0x5bab37){_0x2dbd2a=_0x2dbd2a-0x0;var _0x2195a9=_0xa902[_0x2dbd2a];return _0x2195a9;};'use strict';var multer=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var path=require(_0x2a90('0x2'));var timeout=require(_0x2a90('0x3'));var express=require(_0x2a90('0x4'));var router=express['Router']();var fs_extra=require(_0x2a90('0x5'));var auth=require(_0x2a90('0x6'));var interaction=require(_0x2a90('0x7'));var config=require(_0x2a90('0x8'));var controller=require('./cmCustomField.controller');router[_0x2a90('0x9')]('/',auth['isAuthenticated'](),controller[_0x2a90('0xa')]);router['get'](_0x2a90('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2a90('0xc')]('/',auth['isAuthenticated'](),controller[_0x2a90('0xd')]);router[_0x2a90('0xe')](_0x2a90('0xb'),auth[_0x2a90('0xf')](),controller['update']);router[_0x2a90('0x10')](_0x2a90('0xb'),auth[_0x2a90('0xf')](),controller[_0x2a90('0x11')]);module[_0x2a90('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 951cddf..c52df8b 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 _0xb43b=['UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1709d4,_0x5a3776){_0x1709d4=_0x1709d4-0x0;var _0x5069bd=_0xb43b[_0x1709d4];return _0x5069bd;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'phone':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xbb43('0x4')],'defaultValue':moment()['format'](_0xbb43('0x5'))},'countbusyretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbb43('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xbb43('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbb43('0x6')],'unique':_0xbb43('0x8')},'ListId':{'type':Sequelize[_0xbb43('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xbb43('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xbb43('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xbb43('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file +var _0x4024=['BOOLEAN','format','INTEGER','DATE','moment','sequelize','STRING'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x4024,0x89));var _0x4402=function(_0x5bdc41,_0x1094e3){_0x5bdc41=_0x5bdc41-0x0;var _0x278715=_0x4024[_0x5bdc41];return _0x278715;};'use strict';var moment=require(_0x4402('0x0'));var Sequelize=require(_0x4402('0x1'));module['exports']={'phone':{'type':Sequelize[_0x4402('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x4402('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x4402('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4402('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4402('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4402('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4402('0x6')]},'priority':{'type':Sequelize[_0x4402('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4402('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4402('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x4402('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4402('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4402('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4402('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4402('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c182950..ee8bf77 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 _0x6cff=['then','count','includeAll','include','findAll','rows','catch','params','keys','CmHopper','rawAttributes','options','find','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','queue','ivr','CmContact','lastName','isNil','firstName','finally','CmHopperFinal','create','CRIS\x20DELETEHOPPER----','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','Content-Range','apply','reject','update','destroy','end','sendStatus','error','stack','name','index','map','fieldName','type','model','query','filters','concat','$or','$gte','$not','$between','$notBetween','$in','$notIn','$notLike','$notILike','$contains','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x6cff,0x166));var _0xf6cf=function(_0x20229e,_0xa59f8a){_0x20229e=_0x20229e-0x0;var _0x317377=_0x6cff[_0x20229e];return _0x317377;};'use strict';var pdf=require(_0xf6cf('0x0'));var emlformat=require(_0xf6cf('0x1'));var rimraf=require(_0xf6cf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6cf('0x3'));var rp=require('request-promise');var moment=require(_0xf6cf('0x4'));var BPromise=require(_0xf6cf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf6cf('0x6'));var sox=require(_0xf6cf('0x7'));var csv=require(_0xf6cf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6cf('0x9'));var _=require('lodash');var squel=require(_0xf6cf('0xa'));var crypto=require('crypto');var jsforce=require(_0xf6cf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf6cf('0x8'));var querystring=require(_0xf6cf('0xc'));var Papa=require('papaparse');var Redis=require(_0xf6cf('0xd'));var authService=require(_0xf6cf('0xe'));var qs=require(_0xf6cf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6cf('0x10'));var logger=require(_0xf6cf('0x11'))(_0xf6cf('0x12'));var utils=require(_0xf6cf('0x13'));var config=require(_0xf6cf('0x14'));var licenseUtil=require(_0xf6cf('0x15'));var db=require(_0xf6cf('0x16'))['db'];function respondWithStatusCode(_0x229b77,_0x55d423){_0x55d423=_0x55d423||0xcc;return function(_0x136e83){if(_0x136e83){return _0x229b77['sendStatus'](_0x55d423);}return _0x229b77[_0xf6cf('0x17')](_0x55d423)['end']();};}function respondWithResult(_0x180ebe,_0x238639){_0x238639=_0x238639||0xc8;return function(_0x4034e4){if(_0x4034e4){return _0x180ebe[_0xf6cf('0x17')](_0x238639)[_0xf6cf('0x18')](_0x4034e4);}};}function respondWithFilteredResult(_0x477bb6,_0x4fb943){return function(_0x4b6550){if(_0x4b6550){var _0xed1e04=_0x4b6550['count'],_0x290b7e=_0x4fb943[_0xf6cf('0x19')],_0x375298=_0x4fb943['offset']+_0x4fb943[_0xf6cf('0x1a')],_0x5cba2f;if(_0x375298>=_0xed1e04){_0x375298=_0xed1e04;_0x5cba2f=0xc8;}else{_0x5cba2f=0xce;}_0x477bb6[_0xf6cf('0x17')](_0x5cba2f);return _0x477bb6['set'](_0xf6cf('0x1b'),_0x290b7e+'-'+_0x375298+'/'+_0xed1e04)[_0xf6cf('0x18')](_0x4b6550);}return null;};}function patchUpdates(_0x2793af){return function(_0x4ea023){try{jsonpatch[_0xf6cf('0x1c')](_0x4ea023,_0x2793af,!![]);}catch(_0x3150f0){return BPromise[_0xf6cf('0x1d')](_0x3150f0);}return _0x4ea023['save']();};}function saveUpdates(_0x41b098,_0x2a2f5c){return function(_0x5886e6){if(_0x5886e6){return _0x5886e6[_0xf6cf('0x1e')](_0x41b098)['then'](function(_0x2ce5b1){return _0x2ce5b1;});}return null;};}function removeEntity(_0x31765f,_0x82eb05){return function(_0xd185d0){if(_0xd185d0){return _0xd185d0[_0xf6cf('0x1f')]()['then'](function(){_0x31765f[_0xf6cf('0x17')](0xcc)[_0xf6cf('0x20')]();});}};}function handleEntityNotFound(_0x164e57,_0x1266c8){return function(_0x285621){if(!_0x285621){_0x164e57[_0xf6cf('0x21')](0x194);}return _0x285621;};}function handleError(_0x52d88d,_0x203414){_0x203414=_0x203414||0x1f4;return function(_0x506422){logger[_0xf6cf('0x22')](_0x506422[_0xf6cf('0x23')]);if(_0x506422[_0xf6cf('0x24')]){delete _0x506422[_0xf6cf('0x24')];}_0x52d88d[_0xf6cf('0x17')](_0x203414)['send'](_0x506422);};}exports[_0xf6cf('0x25')]=function(_0xbc2e24,_0x1404bf){var _0x461acc={},_0x1ef30f={},_0x3b9124={'count':0x0,'rows':[]};var _0x27f0d4=_[_0xf6cf('0x26')](db['CmHopper']['rawAttributes'],function(_0x3420ea){return{'name':_0x3420ea[_0xf6cf('0x27')],'type':_0x3420ea[_0xf6cf('0x28')]['key']};});_0x1ef30f[_0xf6cf('0x29')]=_['map'](_0x27f0d4,'name');_0x1ef30f[_0xf6cf('0x2a')]=_['keys'](_0xbc2e24[_0xf6cf('0x2a')]);_0x1ef30f[_0xf6cf('0x2b')]=_['intersection'](_0x1ef30f[_0xf6cf('0x29')],_0x1ef30f[_0xf6cf('0x2a')]);_0x1ef30f[_0xf6cf('0x2b')]=_[_0xf6cf('0x2c')](_0x1ef30f['filters'],['$and',_0xf6cf('0x2d'),'$gt',_0xf6cf('0x2e'),'$lt','$lte','$ne','$eq',_0xf6cf('0x2f'),_0xf6cf('0x30'),_0xf6cf('0x31'),_0xf6cf('0x32'),_0xf6cf('0x33'),'$like',_0xf6cf('0x34'),'$iLike',_0xf6cf('0x35'),'$like','$overlap',_0xf6cf('0x36'),'$contained',_0xf6cf('0x37')]);_0x461acc[_0xf6cf('0x38')]=_[_0xf6cf('0x39')](_0x1ef30f[_0xf6cf('0x29')],qs[_0xf6cf('0x3a')](_0xbc2e24['query'][_0xf6cf('0x3a')]));_0x461acc[_0xf6cf('0x38')]=_0x461acc[_0xf6cf('0x38')][_0xf6cf('0x3b')]?_0x461acc[_0xf6cf('0x38')]:_0x1ef30f[_0xf6cf('0x29')];if(!_0xbc2e24[_0xf6cf('0x2a')][_0xf6cf('0x3c')](_0xf6cf('0x3d'))){_0x461acc[_0xf6cf('0x1a')]=qs[_0xf6cf('0x1a')](_0xbc2e24[_0xf6cf('0x2a')]['limit']);_0x461acc[_0xf6cf('0x19')]=qs[_0xf6cf('0x19')](_0xbc2e24['query'][_0xf6cf('0x19')]);}_0x461acc[_0xf6cf('0x3e')]=qs['sort'](_0xbc2e24['query'][_0xf6cf('0x3f')]);_0x461acc['where']=qs[_0xf6cf('0x2b')](_[_0xf6cf('0x40')](_0xbc2e24[_0xf6cf('0x2a')],_0x1ef30f['filters']),_0x27f0d4);if(_0xbc2e24[_0xf6cf('0x2a')][_0xf6cf('0x41')]){_0x461acc[_0xf6cf('0x42')]=_[_0xf6cf('0x43')](_0x461acc['where'],{'$or':_[_0xf6cf('0x26')](_0x27f0d4,function(_0x35c821){if(_0x35c821[_0xf6cf('0x28')]!=='VIRTUAL'){var _0x2e1de8={};_0x2e1de8[_0x35c821['name']]={'$like':'%'+_0xbc2e24['query']['filter']+'%'};return _0x2e1de8;}})});}_0x461acc=_[_0xf6cf('0x43')]({},_0x461acc,_0xbc2e24['options']);var _0x13d22c={'where':_0x461acc[_0xf6cf('0x42')]};return db['CmHopper']['count'](_0x13d22c)[_0xf6cf('0x44')](function(_0x29fd2e){_0x3b9124[_0xf6cf('0x45')]=_0x29fd2e;if(_0xbc2e24[_0xf6cf('0x2a')][_0xf6cf('0x46')]){_0x461acc[_0xf6cf('0x47')]=[{'all':!![]}];}return db['CmHopper'][_0xf6cf('0x48')](_0x461acc);})[_0xf6cf('0x44')](function(_0x23f5aa){_0x3b9124[_0xf6cf('0x49')]=_0x23f5aa;return _0x3b9124;})[_0xf6cf('0x44')](respondWithFilteredResult(_0x1404bf,_0x461acc))[_0xf6cf('0x4a')](handleError(_0x1404bf,null));};exports['show']=function(_0x309fe7,_0x28e672){var _0x2adaba={'raw':!![],'where':{'id':_0x309fe7[_0xf6cf('0x4b')]['id']}},_0x30d896={};_0x30d896['model']=_[_0xf6cf('0x4c')](db[_0xf6cf('0x4d')][_0xf6cf('0x4e')]);_0x30d896[_0xf6cf('0x2a')]=_[_0xf6cf('0x4c')](_0x309fe7[_0xf6cf('0x2a')]);_0x30d896[_0xf6cf('0x2b')]=_[_0xf6cf('0x39')](_0x30d896[_0xf6cf('0x29')],_0x30d896[_0xf6cf('0x2a')]);_0x2adaba[_0xf6cf('0x38')]=_[_0xf6cf('0x39')](_0x30d896[_0xf6cf('0x29')],qs[_0xf6cf('0x3a')](_0x309fe7[_0xf6cf('0x2a')][_0xf6cf('0x3a')]));_0x2adaba[_0xf6cf('0x38')]=_0x2adaba[_0xf6cf('0x38')]['length']?_0x2adaba[_0xf6cf('0x38')]:_0x30d896[_0xf6cf('0x29')];if(_0x309fe7['query'][_0xf6cf('0x46')]){_0x2adaba[_0xf6cf('0x47')]=[{'all':!![]}];}_0x2adaba=_[_0xf6cf('0x43')]({},_0x2adaba,_0x309fe7[_0xf6cf('0x4f')]);return db[_0xf6cf('0x4d')][_0xf6cf('0x50')](_0x2adaba)[_0xf6cf('0x44')](handleEntityNotFound(_0x28e672,null))['then'](respondWithResult(_0x28e672,null))[_0xf6cf('0x4a')](handleError(_0x28e672,null));};exports['create']=function(_0x41f001,_0x388375){return db[_0xf6cf('0x4d')]['create'](_0x41f001[_0xf6cf('0x51')],{})[_0xf6cf('0x44')](respondWithResult(_0x388375,0xc9))[_0xf6cf('0x4a')](handleError(_0x388375,null));};exports['update']=function(_0x4911ef,_0x3e5bd2){if(_0x4911ef[_0xf6cf('0x51')]['id']){delete _0x4911ef[_0xf6cf('0x51')]['id'];}return db[_0xf6cf('0x4d')][_0xf6cf('0x50')]({'where':{'id':_0x4911ef[_0xf6cf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e5bd2,null))[_0xf6cf('0x44')](saveUpdates(_0x4911ef[_0xf6cf('0x51')],null))['then'](respondWithResult(_0x3e5bd2,null))[_0xf6cf('0x4a')](handleError(_0x3e5bd2,null));};exports[_0xf6cf('0x52')]=function(_0x5e9807,_0x178f50){return db[_0xf6cf('0x4d')][_0xf6cf('0x52')]()[_0xf6cf('0x44')](respondWithResult(_0x178f50,null))[_0xf6cf('0x4a')](handleError(_0x178f50,null));};exports['destroy']=function(_0x20ab73,_0x165f94){var _0xaa954a;var _0x4d5df8=_0x20ab73[_0xf6cf('0x4b')]['id'];return db[_0xf6cf('0x4d')][_0xf6cf('0x50')]({'where':{'id':_0x20ab73[_0xf6cf('0x4b')]['id']}})[_0xf6cf('0x44')](handleEntityNotFound(_0x165f94,null))[_0xf6cf('0x44')](function(_0xc0aa69){if(_0xc0aa69){return _0xc0aa69[_0xf6cf('0x1f')]()[_0xf6cf('0x44')](function(_0x324e03){return _0x324e03;});}})['then'](function(_0x408db5){_0xaa954a=_0x408db5;if(_0x408db5){if(_0x408db5[_0xf6cf('0x53')]||_0x408db5[_0xf6cf('0x54')]){return db[_0x408db5[_0xf6cf('0x53')]?_0xf6cf('0x55'):_0xf6cf('0x56')][_0xf6cf('0x50')]({'where':{'id':_0x408db5['VoiceQueueId']?_0x408db5[_0xf6cf('0x53')]:_0x408db5[_0xf6cf('0x54')]},'attributes':['id',_0xf6cf('0x24')],'raw':!![]});}}})[_0xf6cf('0x44')](function(_0x2c238a){var _0x3124de={};if(_0x2c238a){_[_0xf6cf('0x43')](_0x3124de,_[_0xf6cf('0x57')](_0xaa954a[_0xf6cf('0x58')],[_0xf6cf('0x59'),_0xf6cf('0x5a'),'id']));_0x3124de[_0xf6cf('0x5b')]=0x15;_0x3124de[_0xf6cf('0x5c')]=_0xf6cf('0x5d');_0x3124de['campaign']=_0x2c238a[_0xf6cf('0x24')];_0x3124de[_0xf6cf('0x5e')]=_0x20ab73[_0xf6cf('0x5f')][_0xf6cf('0x24')];_0x3124de[_0xf6cf('0x60')]=_0x20ab73[_0xf6cf('0x5f')]['id'];_0x3124de['deleted']=!![];_0x3124de[_0xf6cf('0x61')]=moment()[_0xf6cf('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x3124de[_0xf6cf('0x63')]=_0xaa954a[_0xf6cf('0x64')];_0x3124de[_0xf6cf('0x65')]=_0xaa954a[_0xf6cf('0x53')]?_0xf6cf('0x66'):_0xf6cf('0x67');return db[_0xf6cf('0x68')]['find']({'where':{'id':_0x3124de['ContactId']},'attributes':['firstName',_0xf6cf('0x69')]})[_0xf6cf('0x44')](function(_0x1229d6){if(!_[_0xf6cf('0x6a')](_0x165f94)&&!_['isNil'](_0x1229d6[_0xf6cf('0x6b')])){_0x3124de['calleridname']=_0x1229d6['firstName'];if(!_[_0xf6cf('0x6a')](_0x1229d6[_0xf6cf('0x69')])){_0x3124de['calleridname']+='\x20'+_0x1229d6['lastName'];}}})[_0xf6cf('0x6c')](function(){return db[_0xf6cf('0x6d')][_0xf6cf('0x6e')](_0x3124de);});}})['then'](function(_0x3ee731){console['log'](_0xf6cf('0x6f')+_0x4d5df8);return db[_0xf6cf('0x70')][_0xf6cf('0x1f')]({'where':{'CmHopperId':_0x4d5df8}});})[_0xf6cf('0x44')](function(){return _0x165f94[_0xf6cf('0x17')](0xcc)['end']();})[_0xf6cf('0x4a')](handleError(_0x165f94,null));};exports[_0xf6cf('0x71')]=function(_0x2d2377,_0x277a0c,_0x59e1cf){var _0x2325fd=[];return db[_0xf6cf('0x68')]['describe']()[_0xf6cf('0x44')](function(_0x2eede1){_0x2325fd=_['keys'](_0x2eede1);return _0x2d2377[_0xf6cf('0x5f')][_0xf6cf('0x72')]({'where':{'type':_0xf6cf('0x73'),'dialActive':!![],'dialMethod':_0xf6cf('0x74')},'attributes':['id',_0xf6cf('0x75')],'raw':!![]});})[_0xf6cf('0x44')](function(_0x4910de){if(_0x4910de&&_0x4910de[_0xf6cf('0x3b')]){return db[_0xf6cf('0x76')]['transaction'](function(_0x522d28){var _0x4b2202={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf6cf('0x62')](_0xf6cf('0x77'))},'VoiceQueueId':{'$in':_[_0xf6cf('0x26')](_0x4910de,'id')},'$or':[{'UserId':null},{'UserId':_0x2d2377[_0xf6cf('0x5f')]['id']}]};var _0x4d9b97=[];if(_0x2d2377[_0xf6cf('0x51')][_0xf6cf('0x78')]&&_0x2d2377['body']['direction']===_0xf6cf('0x79')){if(!_[_0xf6cf('0x7a')](_0x2d2377[_0xf6cf('0x51')][_0xf6cf('0x7b')])){_0x4b2202['id']={'$in':_0x2d2377[_0xf6cf('0x51')][_0xf6cf('0x7b')]};}_0x4d9b97=[['priority','ASC'],['scheduledAt',_0x4910de[0x0]['dialOrderByScheduledAt']==='ASC'?_0xf6cf('0x7c'):_0xf6cf('0x7d')],db[_0xf6cf('0x76')][_0xf6cf('0x7e')](_0xf6cf('0x7f')),['id','DESC']];}else{if(!_[_0xf6cf('0x7a')](_0x2d2377[_0xf6cf('0x51')][_0xf6cf('0x7b')])){_0x4b2202['id']={'$notIn':_0x2d2377[_0xf6cf('0x51')]['hopperIds']};}_0x4d9b97=[[_0xf6cf('0x80'),_0xf6cf('0x7c')],['scheduledAt',_0x4910de[0x0]['dialOrderByScheduledAt']],db[_0xf6cf('0x76')][_0xf6cf('0x7e')](_0xf6cf('0x81')),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id',_0xf6cf('0x82'),_0xf6cf('0x64')],'where':_0x4b2202,'order':_0x4d9b97,'transaction':_0x522d28,'lock':_0x522d28[_0xf6cf('0x83')][_0xf6cf('0x84')],'include':[{'model':db['CmContact'],'as':_0xf6cf('0x85'),'attributes':_0x2325fd,'include':[{'model':db[_0xf6cf('0x86')],'as':'Company','attributes':['id',_0xf6cf('0x24')]}]},{'model':db[_0xf6cf('0x87')],'as':_0xf6cf('0x88'),'attributes':['id',_0xf6cf('0x24')]},{'model':db['VoiceQueue'],'as':_0xf6cf('0x89'),'attributes':['id',_0xf6cf('0x24'),'dialActive']}]})['then'](function(_0x40252d){if(_0x40252d){return _0x40252d[_0xf6cf('0x1e')]({'UserId':_0x2d2377[_0xf6cf('0x5f')]['id']},{'transaction':_0x522d28});}});});}})[_0xf6cf('0x44')](handleEntityNotFound(_0x277a0c,null))['then'](respondWithResult(_0x277a0c,null))[_0xf6cf('0x4a')](handleError(_0x277a0c,null));};exports[_0xf6cf('0x8a')]=function(_0x2630c2,_0x26fcc1,_0x5975b1){return _0x2630c2[_0xf6cf('0x5f')]['getVoiceQueues']({'where':{'type':_0xf6cf('0x73'),'dialActive':!![],'dialMethod':_0xf6cf('0x74')},'attributes':['id'],'raw':!![]})[_0xf6cf('0x44')](function(_0x204d86){if(_0x204d86&&_0x204d86[_0xf6cf('0x3b')]){return db[_0xf6cf('0x4d')][_0xf6cf('0x45')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf6cf('0x62')](_0xf6cf('0x77'))},'VoiceQueueId':{'$in':_[_0xf6cf('0x26')](_0x204d86,'id')},'$or':[{'UserId':null},{'UserId':_0x2630c2[_0xf6cf('0x5f')]['id']}]}});}return 0x0;})[_0xf6cf('0x44')](function(_0x295be4){if(!_[_0xf6cf('0x6a')](_0x295be4)&&_[_0xf6cf('0x8b')](_0x295be4)){return _0x26fcc1[_0xf6cf('0x17')](0xc8)[_0xf6cf('0x18')]({'contacts':_0x295be4});}else{logger[_0xf6cf('0x22')](_0xf6cf('0x8c'),_0xf6cf('0x8a'),0x194,_0xf6cf('0x8d'));_0x26fcc1[_0xf6cf('0x21')](0x194);}})[_0xf6cf('0x4a')](handleError(_0x26fcc1,null));}; \ No newline at end of file +var _0x4f82=['calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','getPreview','CmContact','getVoiceQueues','outbound','preview','direction','prev','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','CmHopper','fieldName','type','key','query','intersection','model','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xad500b,_0x58a97d){var _0x42f2f2=function(_0x5371b8){while(--_0x5371b8){_0xad500b['push'](_0xad500b['shift']());}};_0x42f2f2(++_0x58a97d);}(_0x4f82,0xbc));var _0x24f8=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x4f82[_0x15c421];return _0x5e5ed5;};'use strict';var pdf=require(_0x24f8('0x0'));var emlformat=require(_0x24f8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x24f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24f8('0x3'));var moment=require('moment');var BPromise=require(_0x24f8('0x4'));var Mustache=require('mustache');var util=require(_0x24f8('0x5'));var path=require(_0x24f8('0x6'));var sox=require(_0x24f8('0x7'));var csv=require(_0x24f8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24f8('0x9'));var _=require(_0x24f8('0xa'));var squel=require(_0x24f8('0xb'));var crypto=require(_0x24f8('0xc'));var jsforce=require(_0x24f8('0xd'));var deskjs=require(_0x24f8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x24f8('0xf'));var Papa=require(_0x24f8('0x10'));var Redis=require(_0x24f8('0x11'));var authService=require(_0x24f8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x24f8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x24f8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x24f8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x516ea1,_0x1f73ec){_0x1f73ec=_0x1f73ec||0xcc;return function(_0x31c123){if(_0x31c123){return _0x516ea1[_0x24f8('0x16')](_0x1f73ec);}return _0x516ea1[_0x24f8('0x17')](_0x1f73ec)[_0x24f8('0x18')]();};}function respondWithResult(_0x10fa27,_0x3d0d87){_0x3d0d87=_0x3d0d87||0xc8;return function(_0x2e312d){if(_0x2e312d){return _0x10fa27[_0x24f8('0x17')](_0x3d0d87)[_0x24f8('0x19')](_0x2e312d);}};}function respondWithFilteredResult(_0x319c54,_0x57d554){return function(_0x3a4760){if(_0x3a4760){var _0x2a980d=_0x3a4760[_0x24f8('0x1a')],_0x191bc9=_0x57d554[_0x24f8('0x1b')],_0x3552aa=_0x57d554[_0x24f8('0x1b')]+_0x57d554[_0x24f8('0x1c')],_0x1083a8;if(_0x3552aa>=_0x2a980d){_0x3552aa=_0x2a980d;_0x1083a8=0xc8;}else{_0x1083a8=0xce;}_0x319c54[_0x24f8('0x17')](_0x1083a8);return _0x319c54[_0x24f8('0x1d')](_0x24f8('0x1e'),_0x191bc9+'-'+_0x3552aa+'/'+_0x2a980d)['json'](_0x3a4760);}return null;};}function patchUpdates(_0x3ac69c){return function(_0x35eb3){try{jsonpatch[_0x24f8('0x1f')](_0x35eb3,_0x3ac69c,!![]);}catch(_0x59f1d5){return BPromise[_0x24f8('0x20')](_0x59f1d5);}return _0x35eb3['save']();};}function saveUpdates(_0x5c0232,_0x11548c){return function(_0x163d41){if(_0x163d41){return _0x163d41['update'](_0x5c0232)[_0x24f8('0x21')](function(_0x5ac5e){return _0x5ac5e;});}return null;};}function removeEntity(_0x873e4e,_0x4f2f5d){return function(_0x510505){if(_0x510505){return _0x510505[_0x24f8('0x22')]()[_0x24f8('0x21')](function(){_0x873e4e[_0x24f8('0x17')](0xcc)[_0x24f8('0x18')]();});}};}function handleEntityNotFound(_0x40790b,_0x3fcf7b){return function(_0x5cd49a){if(!_0x5cd49a){_0x40790b[_0x24f8('0x16')](0x194);}return _0x5cd49a;};}function handleError(_0x58a288,_0x200d47){_0x200d47=_0x200d47||0x1f4;return function(_0x3b89b5){logger[_0x24f8('0x23')](_0x3b89b5[_0x24f8('0x24')]);if(_0x3b89b5[_0x24f8('0x25')]){delete _0x3b89b5[_0x24f8('0x25')];}_0x58a288[_0x24f8('0x17')](_0x200d47)[_0x24f8('0x26')](_0x3b89b5);};}exports[_0x24f8('0x27')]=function(_0x206ca9,_0x533ce9){var _0xd8ef1f={},_0x2290ff={},_0x47370b={'count':0x0,'rows':[]};var _0x2d3aa3=_[_0x24f8('0x28')](db[_0x24f8('0x29')]['rawAttributes'],function(_0x26e3cf){return{'name':_0x26e3cf[_0x24f8('0x2a')],'type':_0x26e3cf[_0x24f8('0x2b')][_0x24f8('0x2c')]};});_0x2290ff['model']=_[_0x24f8('0x28')](_0x2d3aa3,_0x24f8('0x25'));_0x2290ff[_0x24f8('0x2d')]=_['keys'](_0x206ca9['query']);_0x2290ff['filters']=_[_0x24f8('0x2e')](_0x2290ff[_0x24f8('0x2f')],_0x2290ff[_0x24f8('0x2d')]);_0x2290ff[_0x24f8('0x30')]=_[_0x24f8('0x31')](_0x2290ff[_0x24f8('0x30')],[_0x24f8('0x32'),_0x24f8('0x33'),'$gt',_0x24f8('0x34'),_0x24f8('0x35'),_0x24f8('0x36'),_0x24f8('0x37'),_0x24f8('0x38'),_0x24f8('0x39'),'$between',_0x24f8('0x3a'),_0x24f8('0x3b'),_0x24f8('0x3c'),_0x24f8('0x3d'),_0x24f8('0x3e'),'$iLike',_0x24f8('0x3f'),_0x24f8('0x3d'),_0x24f8('0x40'),_0x24f8('0x41'),_0x24f8('0x42'),_0x24f8('0x43')]);_0xd8ef1f[_0x24f8('0x44')]=_[_0x24f8('0x2e')](_0x2290ff['model'],qs[_0x24f8('0x45')](_0x206ca9[_0x24f8('0x2d')][_0x24f8('0x45')]));_0xd8ef1f[_0x24f8('0x44')]=_0xd8ef1f[_0x24f8('0x44')][_0x24f8('0x46')]?_0xd8ef1f['attributes']:_0x2290ff['model'];if(!_0x206ca9[_0x24f8('0x2d')]['hasOwnProperty'](_0x24f8('0x47'))){_0xd8ef1f['limit']=qs['limit'](_0x206ca9['query'][_0x24f8('0x1c')]);_0xd8ef1f[_0x24f8('0x1b')]=qs[_0x24f8('0x1b')](_0x206ca9['query']['offset']);}_0xd8ef1f[_0x24f8('0x48')]=qs[_0x24f8('0x49')](_0x206ca9[_0x24f8('0x2d')][_0x24f8('0x49')]);_0xd8ef1f['where']=qs[_0x24f8('0x30')](_[_0x24f8('0x4a')](_0x206ca9[_0x24f8('0x2d')],_0x2290ff['filters']),_0x2d3aa3);if(_0x206ca9[_0x24f8('0x2d')][_0x24f8('0x4b')]){_0xd8ef1f[_0x24f8('0x4c')]=_[_0x24f8('0x4d')](_0xd8ef1f[_0x24f8('0x4c')],{'$or':_[_0x24f8('0x28')](_0x2d3aa3,function(_0x13ce93){if(_0x13ce93['type']!==_0x24f8('0x4e')){var _0x2c9ae9={};_0x2c9ae9[_0x13ce93['name']]={'$like':'%'+_0x206ca9[_0x24f8('0x2d')][_0x24f8('0x4b')]+'%'};return _0x2c9ae9;}})});}_0xd8ef1f=_[_0x24f8('0x4d')]({},_0xd8ef1f,_0x206ca9[_0x24f8('0x4f')]);var _0x33102a={'where':_0xd8ef1f[_0x24f8('0x4c')]};return db[_0x24f8('0x29')][_0x24f8('0x1a')](_0x33102a)[_0x24f8('0x21')](function(_0x489617){_0x47370b['count']=_0x489617;if(_0x206ca9['query'][_0x24f8('0x50')]){_0xd8ef1f['include']=[{'all':!![]}];}return db['CmHopper'][_0x24f8('0x51')](_0xd8ef1f);})[_0x24f8('0x21')](function(_0x2b73df){_0x47370b[_0x24f8('0x52')]=_0x2b73df;return _0x47370b;})[_0x24f8('0x21')](respondWithFilteredResult(_0x533ce9,_0xd8ef1f))[_0x24f8('0x53')](handleError(_0x533ce9,null));};exports[_0x24f8('0x54')]=function(_0x31a9e4,_0x5e60fa){var _0x3f3929={'raw':!![],'where':{'id':_0x31a9e4[_0x24f8('0x55')]['id']}},_0x2fd59f={};_0x2fd59f[_0x24f8('0x2f')]=_[_0x24f8('0x56')](db[_0x24f8('0x29')][_0x24f8('0x57')]);_0x2fd59f['query']=_[_0x24f8('0x56')](_0x31a9e4[_0x24f8('0x2d')]);_0x2fd59f[_0x24f8('0x30')]=_['intersection'](_0x2fd59f[_0x24f8('0x2f')],_0x2fd59f[_0x24f8('0x2d')]);_0x3f3929[_0x24f8('0x44')]=_['intersection'](_0x2fd59f[_0x24f8('0x2f')],qs[_0x24f8('0x45')](_0x31a9e4[_0x24f8('0x2d')][_0x24f8('0x45')]));_0x3f3929[_0x24f8('0x44')]=_0x3f3929[_0x24f8('0x44')][_0x24f8('0x46')]?_0x3f3929[_0x24f8('0x44')]:_0x2fd59f[_0x24f8('0x2f')];if(_0x31a9e4[_0x24f8('0x2d')]['includeAll']){_0x3f3929['include']=[{'all':!![]}];}_0x3f3929=_[_0x24f8('0x4d')]({},_0x3f3929,_0x31a9e4[_0x24f8('0x4f')]);return db[_0x24f8('0x29')][_0x24f8('0x58')](_0x3f3929)[_0x24f8('0x21')](handleEntityNotFound(_0x5e60fa,null))['then'](respondWithResult(_0x5e60fa,null))[_0x24f8('0x53')](handleError(_0x5e60fa,null));};exports[_0x24f8('0x59')]=function(_0x248c4b,_0x132258){return db[_0x24f8('0x29')][_0x24f8('0x59')](_0x248c4b[_0x24f8('0x5a')],{})['then'](respondWithResult(_0x132258,0xc9))[_0x24f8('0x53')](handleError(_0x132258,null));};exports[_0x24f8('0x5b')]=function(_0x139120,_0x2ce0ae){if(_0x139120[_0x24f8('0x5a')]['id']){delete _0x139120['body']['id'];}return db[_0x24f8('0x29')][_0x24f8('0x58')]({'where':{'id':_0x139120[_0x24f8('0x55')]['id']}})[_0x24f8('0x21')](handleEntityNotFound(_0x2ce0ae,null))[_0x24f8('0x21')](saveUpdates(_0x139120[_0x24f8('0x5a')],null))[_0x24f8('0x21')](respondWithResult(_0x2ce0ae,null))[_0x24f8('0x53')](handleError(_0x2ce0ae,null));};exports[_0x24f8('0x5c')]=function(_0x50a165,_0x47de09){return db['CmHopper'][_0x24f8('0x5c')]()[_0x24f8('0x21')](respondWithResult(_0x47de09,null))[_0x24f8('0x53')](handleError(_0x47de09,null));};exports[_0x24f8('0x22')]=function(_0x49b230,_0x65853f){var _0x15df7b;var _0x4a6efb=_0x49b230[_0x24f8('0x55')]['id'];return db['CmHopper'][_0x24f8('0x58')]({'where':{'id':_0x49b230['params']['id']}})[_0x24f8('0x21')](handleEntityNotFound(_0x65853f,null))[_0x24f8('0x21')](function(_0x4d85ca){if(_0x4d85ca){return _0x4d85ca['destroy']()['then'](function(_0x5bb998){return _0x5bb998;});}})['then'](function(_0x4292bb){_0x15df7b=_0x4292bb;if(_0x4292bb){if(_0x4292bb[_0x24f8('0x5d')]||_0x4292bb[_0x24f8('0x5e')]){return db[_0x4292bb[_0x24f8('0x5d')]?_0x24f8('0x5f'):_0x24f8('0x60')][_0x24f8('0x58')]({'where':{'id':_0x4292bb[_0x24f8('0x5d')]?_0x4292bb[_0x24f8('0x5d')]:_0x4292bb[_0x24f8('0x5e')]},'attributes':['id',_0x24f8('0x25')],'raw':!![]});}}})['then'](function(_0x4d2a44){var _0x47aa5c={};if(_0x4d2a44){_['merge'](_0x47aa5c,_['omit'](_0x15df7b[_0x24f8('0x61')],[_0x24f8('0x62'),_0x24f8('0x63'),'id']));_0x47aa5c['state']=0x15;_0x47aa5c[_0x24f8('0x64')]=_0x24f8('0x65');_0x47aa5c[_0x24f8('0x66')]=_0x4d2a44['name'];_0x47aa5c['membername']=_0x49b230[_0x24f8('0x67')][_0x24f8('0x25')];_0x47aa5c[_0x24f8('0x68')]=_0x49b230[_0x24f8('0x67')]['id'];_0x47aa5c['deleted']=!![];_0x47aa5c[_0x24f8('0x69')]=moment()[_0x24f8('0x6a')](_0x24f8('0x6b'));_0x47aa5c[_0x24f8('0x6c')]=_0x15df7b[_0x24f8('0x6d')];_0x47aa5c[_0x24f8('0x6e')]=_0x15df7b[_0x24f8('0x5d')]?_0x24f8('0x6f'):_0x24f8('0x70');return db['CmContact'][_0x24f8('0x58')]({'where':{'id':_0x47aa5c[_0x24f8('0x71')]},'attributes':[_0x24f8('0x72'),_0x24f8('0x73')]})[_0x24f8('0x21')](function(_0x105c7e){if(!_[_0x24f8('0x74')](_0x65853f)&&!_[_0x24f8('0x74')](_0x105c7e[_0x24f8('0x72')])){_0x47aa5c[_0x24f8('0x75')]=_0x105c7e[_0x24f8('0x72')];if(!_[_0x24f8('0x74')](_0x105c7e[_0x24f8('0x73')])){_0x47aa5c['calleridname']+='\x20'+_0x105c7e[_0x24f8('0x73')];}}})[_0x24f8('0x76')](function(){return db['CmHopperFinal']['create'](_0x47aa5c);});}})[_0x24f8('0x21')](function(_0x596e5a){return db[_0x24f8('0x77')][_0x24f8('0x22')]({'where':{'CmHopperId':_0x4a6efb}});})[_0x24f8('0x21')](function(){return _0x65853f[_0x24f8('0x17')](0xcc)['end']();})[_0x24f8('0x53')](handleError(_0x65853f,null));};exports[_0x24f8('0x78')]=function(_0xfe23dd,_0x5eeb65,_0x59c903){var _0x3b4339=[];return db[_0x24f8('0x79')][_0x24f8('0x5c')]()[_0x24f8('0x21')](function(_0x4f9059){_0x3b4339=_['keys'](_0x4f9059);return _0xfe23dd[_0x24f8('0x67')][_0x24f8('0x7a')]({'where':{'type':_0x24f8('0x7b'),'dialActive':!![],'dialMethod':_0x24f8('0x7c')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x5755b7){if(_0x5755b7&&_0x5755b7[_0x24f8('0x46')]){return db['sequelize']['transaction'](function(_0x29206d){var _0x88ca2f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x24f8('0x6b'))},'VoiceQueueId':{'$in':_[_0x24f8('0x28')](_0x5755b7,'id')},'$or':[{'UserId':null},{'UserId':_0xfe23dd[_0x24f8('0x67')]['id']}]};var _0x214392=[];if(_0xfe23dd[_0x24f8('0x5a')][_0x24f8('0x7d')]&&_0xfe23dd['body'][_0x24f8('0x7d')]===_0x24f8('0x7e')){if(!_['isEmpty'](_0xfe23dd[_0x24f8('0x5a')][_0x24f8('0x7f')])){_0x88ca2f['id']={'$in':_0xfe23dd[_0x24f8('0x5a')][_0x24f8('0x7f')]};}_0x214392=[[_0x24f8('0x80'),_0x24f8('0x81')],[_0x24f8('0x82'),_0x5755b7[0x0][_0x24f8('0x83')]===_0x24f8('0x81')?'DESC':'ASC'],db['sequelize']['literal'](_0x24f8('0x84')),['id',_0x24f8('0x85')]];}else{if(!_[_0x24f8('0x86')](_0xfe23dd[_0x24f8('0x5a')][_0x24f8('0x7f')])){_0x88ca2f['id']={'$notIn':_0xfe23dd[_0x24f8('0x5a')][_0x24f8('0x7f')]};}_0x214392=[['priority',_0x24f8('0x85')],[_0x24f8('0x82'),_0x5755b7[0x0][_0x24f8('0x83')]],db[_0x24f8('0x87')]['literal'](_0x24f8('0x88')),['id',_0x24f8('0x81')]];}return db[_0x24f8('0x29')]['findOne']({'attributes':['id',_0x24f8('0x89'),_0x24f8('0x6d')],'where':_0x88ca2f,'order':_0x214392,'transaction':_0x29206d,'lock':_0x29206d[_0x24f8('0x8a')]['UPDATE'],'include':[{'model':db[_0x24f8('0x79')],'as':'Contact','attributes':_0x3b4339,'include':[{'model':db['CmCompany'],'as':_0x24f8('0x8b'),'attributes':['id',_0x24f8('0x25')]}]},{'model':db[_0x24f8('0x8c')],'as':_0x24f8('0x8d'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x24f8('0x8e'),'attributes':['id',_0x24f8('0x25'),_0x24f8('0x8f')]}]})[_0x24f8('0x21')](function(_0x23a8ca){if(_0x23a8ca){return _0x23a8ca['update']({'UserId':_0xfe23dd[_0x24f8('0x67')]['id']},{'transaction':_0x29206d});}});});}})[_0x24f8('0x21')](handleEntityNotFound(_0x5eeb65,null))[_0x24f8('0x21')](respondWithResult(_0x5eeb65,null))[_0x24f8('0x53')](handleError(_0x5eeb65,null));};exports[_0x24f8('0x90')]=function(_0x4a6c79,_0x164995,_0x371c25){return _0x4a6c79[_0x24f8('0x67')][_0x24f8('0x7a')]({'where':{'type':_0x24f8('0x7b'),'dialActive':!![],'dialMethod':_0x24f8('0x7c')},'attributes':['id'],'raw':!![]})[_0x24f8('0x21')](function(_0x2e58e3){if(_0x2e58e3&&_0x2e58e3[_0x24f8('0x46')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x24f8('0x6a')](_0x24f8('0x6b'))},'VoiceQueueId':{'$in':_[_0x24f8('0x28')](_0x2e58e3,'id')},'$or':[{'UserId':null},{'UserId':_0x4a6c79['user']['id']}]}});}return 0x0;})['then'](function(_0x101d39){if(!_[_0x24f8('0x74')](_0x101d39)&&_[_0x24f8('0x91')](_0x101d39)){return _0x164995[_0x24f8('0x17')](0xc8)['json']({'contacts':_0x101d39});}else{logger[_0x24f8('0x23')](_0x24f8('0x92'),_0x24f8('0x90'),0x194,_0x24f8('0x93'));_0x164995[_0x24f8('0x16')](0x194);}})[_0x24f8('0x53')](handleError(_0x164995,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b25a11c..320c47a 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 _0x42d0=['rimraf','../../config/environment','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','request-promise','path'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x42d0,0x7d));var _0x042d=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x42d0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x042d('0x0'));var util=require('util');var logger=require(_0x042d('0x1'))(_0x042d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x042d('0x3'));var fs=require('fs');var path=require(_0x042d('0x4'));var rimraf=require(_0x042d('0x5'));var config=require(_0x042d('0x6'));var attributes=require('./cmHopper.attributes');module[_0x042d('0x7')]=function(_0x439c0b,_0xdd58a9){return _0x439c0b['define'](_0x042d('0x8'),attributes,{'tableName':_0x042d('0x9'),'paranoid':![],'indexes':[{'name':_0x042d('0xa'),'fields':[_0x042d('0xa')]},{'name':_0x042d('0xb'),'fields':['phone']},{'name':'priority','fields':[_0x042d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdffc=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xdffc,0x1a3));var _0xcdff=function(_0x20ab92,_0x198a5){_0x20ab92=_0x20ab92-0x0;var _0x542592=_0xdffc[_0x20ab92];return _0x542592;};'use strict';var _=require(_0xcdff('0x0'));var util=require(_0xcdff('0x1'));var logger=require(_0xcdff('0x2'))(_0xcdff('0x3'));var moment=require(_0xcdff('0x4'));var BPromise=require(_0xcdff('0x5'));var rp=require(_0xcdff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdff('0x7'));var config=require(_0xcdff('0x8'));var attributes=require(_0xcdff('0x9'));module[_0xcdff('0xa')]=function(_0x2433bc,_0x1e58bf){return _0x2433bc[_0xcdff('0xb')](_0xcdff('0xc'),attributes,{'tableName':_0xcdff('0xd'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xcdff('0xe')]},{'name':_0xcdff('0xf'),'fields':[_0xcdff('0xf')]},{'name':_0xcdff('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 21110d6..8918d5b 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 _0x6ba3=['stringify','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','keys','Agent','name','voicePause','length','includes','UserId','update','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','findAll','push','all','GetContactRecallMe','GetCmHopperPreview','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','message','result','GetCmHopper','CmHopper','options','raw','where','limit','include','map','model','attributes','debug','catch','ShowCmHopper','CreateCmHopper','create'];(function(_0x35c37d,_0xa8ee29){var _0x4fb360=function(_0x3bbd54){while(--_0x3bbd54){_0x35c37d['push'](_0x35c37d['shift']());}};_0x4fb360(++_0xa8ee29);}(_0x6ba3,0x69));var _0x36ba=function(_0x2b92ec,_0x18e0e3){_0x2b92ec=_0x2b92ec-0x0;var _0x12be46=_0x6ba3[_0x2b92ec];return _0x12be46;};'use strict';var _=require('lodash');var util=require(_0x36ba('0x0'));var moment=require(_0x36ba('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36ba('0x2'));var db=require(_0x36ba('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x36ba('0x4'))(_0x36ba('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x36ba('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c8163,_0x5949d6,_0x38218f){return new BPromise(function(_0x220575,_0x123a41){return client[_0x36ba('0x7')](_0x4c8163,_0x38218f)[_0x36ba('0x8')](function(_0x510baa){logger[_0x36ba('0x9')](_0x36ba('0xa'),_0x5949d6,_0x36ba('0xb'));logger['debug'](_0x36ba('0xc'),_0x5949d6,_0x36ba('0xb'),JSON['stringify'](_0x510baa));if(_0x510baa[_0x36ba('0xd')]){if(_0x510baa[_0x36ba('0xd')]['code']===0x1f4){logger[_0x36ba('0xd')](_0x36ba('0xa'),_0x5949d6,_0x510baa['error'][_0x36ba('0xe')]);return _0x123a41(_0x510baa[_0x36ba('0xd')][_0x36ba('0xe')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x5949d6,_0x510baa[_0x36ba('0xd')][_0x36ba('0xe')]);return _0x220575(_0x510baa[_0x36ba('0xd')]['message']);}else{logger['info'](_0x36ba('0xa'),_0x5949d6,'request\x20sent');_0x220575(_0x510baa[_0x36ba('0xf')][_0x36ba('0xe')]);}})['catch'](function(_0x55684d){logger[_0x36ba('0xd')](_0x36ba('0xa'),_0x5949d6,_0x55684d);_0x123a41(_0x55684d);});});}exports[_0x36ba('0x10')]=function(_0x1ad5b7){var _0x136e0a=this;return new Promise(function(_0x532794,_0x2d3bc2){return db[_0x36ba('0x11')]['findAll']({'raw':_0x1ad5b7[_0x36ba('0x12')]?_0x1ad5b7['options'][_0x36ba('0x13')]===undefined?!![]:![]:!![],'where':_0x1ad5b7['options']?_0x1ad5b7['options'][_0x36ba('0x14')]||null:null,'attributes':_0x1ad5b7[_0x36ba('0x12')]?_0x1ad5b7['options']['attributes']||null:null,'limit':_0x1ad5b7[_0x36ba('0x12')]?_0x1ad5b7[_0x36ba('0x12')][_0x36ba('0x15')]||null:null,'include':_0x1ad5b7[_0x36ba('0x12')]?_0x1ad5b7[_0x36ba('0x12')][_0x36ba('0x16')]?_[_0x36ba('0x17')](_0x1ad5b7['options'][_0x36ba('0x16')],function(_0x1b17cd){return{'model':db[_0x1b17cd[_0x36ba('0x18')]],'as':_0x1b17cd['as'],'attributes':_0x1b17cd[_0x36ba('0x19')],'include':_0x1b17cd['include']?_['map'](_0x1b17cd[_0x36ba('0x16')],function(_0x54ba45){return{'model':db[_0x54ba45[_0x36ba('0x18')]],'as':_0x54ba45['as'],'attributes':_0x54ba45[_0x36ba('0x19')],'include':_0x54ba45[_0x36ba('0x16')]?_[_0x36ba('0x17')](_0x54ba45[_0x36ba('0x16')],function(_0x4cf559){return{'model':db[_0x4cf559[_0x36ba('0x18')]],'as':_0x4cf559['as'],'attributes':_0x4cf559[_0x36ba('0x19')]};}):[]};}):[]};}):[]:[]})[_0x36ba('0x8')](function(_0x46107e){logger[_0x36ba('0x9')](_0x36ba('0x10'),_0x1ad5b7);logger[_0x36ba('0x1a')]('GetCmHopper',_0x1ad5b7,JSON['stringify'](_0x46107e));_0x532794(_0x46107e);})[_0x36ba('0x1b')](function(_0x2bb722){logger['error']('GetCmHopper',_0x2bb722['message'],_0x1ad5b7);_0x2d3bc2(_0x136e0a[_0x36ba('0xd')](0x1f4,_0x2bb722[_0x36ba('0xe')]));});});};exports['ShowCmHopper']=function(_0x10ab5d){var _0x2ba959=this;return new Promise(function(_0x3b31d2,_0x55233f){return db[_0x36ba('0x11')]['find']({'raw':_0x10ab5d[_0x36ba('0x12')]?_0x10ab5d[_0x36ba('0x12')][_0x36ba('0x13')]===undefined?!![]:![]:!![],'where':_0x10ab5d[_0x36ba('0x12')]?_0x10ab5d[_0x36ba('0x12')][_0x36ba('0x14')]||null:null,'attributes':_0x10ab5d[_0x36ba('0x12')]?_0x10ab5d[_0x36ba('0x12')]['attributes']||null:null,'include':_0x10ab5d[_0x36ba('0x12')]?_0x10ab5d[_0x36ba('0x12')][_0x36ba('0x16')]?_['map'](_0x10ab5d[_0x36ba('0x12')][_0x36ba('0x16')],function(_0xf180f8){return{'model':db[_0xf180f8[_0x36ba('0x18')]],'as':_0xf180f8['as'],'attributes':_0xf180f8[_0x36ba('0x19')],'include':_0xf180f8[_0x36ba('0x16')]?_[_0x36ba('0x17')](_0xf180f8[_0x36ba('0x16')],function(_0x148a1e){return{'model':db[_0x148a1e[_0x36ba('0x18')]],'as':_0x148a1e['as'],'attributes':_0x148a1e[_0x36ba('0x19')],'include':_0x148a1e[_0x36ba('0x16')]?_[_0x36ba('0x17')](_0x148a1e[_0x36ba('0x16')],function(_0x48b066){return{'model':db[_0x48b066[_0x36ba('0x18')]],'as':_0x48b066['as'],'attributes':_0x48b066[_0x36ba('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x559644){logger[_0x36ba('0x9')]('ShowCmHopper',_0x10ab5d);logger[_0x36ba('0x1a')](_0x36ba('0x1c'),_0x10ab5d,JSON['stringify'](_0x559644));_0x3b31d2(_0x559644);})[_0x36ba('0x1b')](function(_0x13a28b){logger[_0x36ba('0xd')]('ShowCmHopper',_0x13a28b[_0x36ba('0xe')],_0x10ab5d);_0x55233f(_0x2ba959['error'](0x1f4,_0x13a28b[_0x36ba('0xe')]));});});};exports[_0x36ba('0x1d')]=function(_0x8cc199){var _0x5431ff=this;return new Promise(function(_0x45b836,_0x7749a5){return db['CmHopper'][_0x36ba('0x1e')](_0x8cc199['body'],{'raw':_0x8cc199[_0x36ba('0x12')]?_0x8cc199[_0x36ba('0x12')][_0x36ba('0x13')]===undefined?!![]:![]:!![]})[_0x36ba('0x8')](function(_0x143519){logger[_0x36ba('0x9')](_0x36ba('0x1d'),_0x8cc199);logger[_0x36ba('0x1a')]('CreateCmHopper',_0x8cc199,JSON[_0x36ba('0x1f')](_0x143519));_0x45b836(_0x143519);})[_0x36ba('0x1b')](function(_0xe90e0b){logger[_0x36ba('0xd')](_0x36ba('0x1d'),_0xe90e0b[_0x36ba('0xe')],_0x8cc199);_0x7749a5(_0x5431ff['error'](0x1f4,_0xe90e0b[_0x36ba('0xe')]));});});};exports['UpdateCmHopper']=function(_0x57c9fb){var _0x483987=this;return new Promise(function(_0xf02c7,_0x4bd1fd){return db[_0x36ba('0x11')]['update'](_0x57c9fb[_0x36ba('0x20')],{'raw':_0x57c9fb[_0x36ba('0x12')]?_0x57c9fb[_0x36ba('0x12')][_0x36ba('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57c9fb[_0x36ba('0x12')]?_0x57c9fb['options'][_0x36ba('0x14')]||null:null,'attributes':_0x57c9fb[_0x36ba('0x12')]?_0x57c9fb[_0x36ba('0x12')][_0x36ba('0x19')]||null:null,'limit':_0x57c9fb[_0x36ba('0x12')]?_0x57c9fb[_0x36ba('0x12')]['limit']||null:null})['then'](function(_0x3e08a7){logger[_0x36ba('0x9')](_0x36ba('0x21'),_0x57c9fb);logger['debug'](_0x36ba('0x21'),_0x57c9fb,JSON[_0x36ba('0x1f')](_0x3e08a7));_0xf02c7(_0x3e08a7);})[_0x36ba('0x1b')](function(_0x51a709){logger[_0x36ba('0xd')](_0x36ba('0x21'),_0x51a709[_0x36ba('0xe')],_0x57c9fb);_0x4bd1fd(_0x483987[_0x36ba('0xd')](0x1f4,_0x51a709[_0x36ba('0xe')]));});});};exports[_0x36ba('0x22')]=function(_0x37b844){var _0x25aa43=this;return new Promise(function(_0x1b690c,_0x5035c1){return db[_0x36ba('0x11')][_0x36ba('0x23')]({'where':_0x37b844[_0x36ba('0x12')]?_0x37b844['options'][_0x36ba('0x14')]||null:null})['then'](function(_0x2cc2b2){logger['info'](_0x36ba('0x22'),_0x37b844);logger[_0x36ba('0x1a')]('DestroyCmHopper',_0x37b844,JSON[_0x36ba('0x1f')](_0x2cc2b2));_0x1b690c(_0x2cc2b2);})[_0x36ba('0x1b')](function(_0xb2a80c){logger[_0x36ba('0xd')]('DestroyCmHopper',_0xb2a80c['message'],_0x37b844);_0x5035c1(_0x25aa43[_0x36ba('0xd')](0x1f4,_0xb2a80c[_0x36ba('0xe')]));});});};exports[_0x36ba('0x24')]=function(_0x1488c0){var _0x52fbca=this;return new Promise(function(_0x4058da,_0x5a0ff8){return db[_0x36ba('0x25')][_0x36ba('0x26')]()[_0x36ba('0x8')](function(_0x21d2ea){return db[_0x36ba('0x27')]['transaction'](function(_0x5c0481){return db['CmHopper']['findAll']({'where':_0x1488c0['options']?_0x1488c0[_0x36ba('0x12')][_0x36ba('0x14')]||null:null,'attributes':_0x1488c0[_0x36ba('0x12')]?_0x1488c0[_0x36ba('0x12')][_0x36ba('0x19')]||null:null,'limit':_0x1488c0[_0x36ba('0x12')]?_0x1488c0['options']['limit']||null:null,'order':_0x1488c0[_0x36ba('0x12')]?_0x1488c0[_0x36ba('0x12')][_0x36ba('0x28')]||null:null,'transaction':_0x5c0481,'lock':_0x5c0481[_0x36ba('0x29')][_0x36ba('0x2a')],'include':[{'model':db[_0x36ba('0x25')],'as':_0x36ba('0x2b'),'attributes':_[_0x36ba('0x2c')](_0x21d2ea)},{'model':db['User'],'as':_0x36ba('0x2d'),'attributes':['id',_0x36ba('0x2e'),_0x36ba('0x2f')]}]})[_0x36ba('0x8')](function(_0x221c9b){var _0xc085e7=[];var _0xc20d9e=[];for(var _0xeed5e4=0x0;_0xeed5e4<_0x221c9b[_0x36ba('0x30')];_0xeed5e4+=0x1){if(!_0xc20d9e[_0x36ba('0x31')](_0x221c9b[_0xeed5e4]['UserId'])){_0xc20d9e['push'](_0x221c9b[_0xeed5e4][_0x36ba('0x32')]);_0xc085e7['push'](_0x221c9b[_0xeed5e4][_0x36ba('0x33')](_0x1488c0['body'],{'transaction':_0x5c0481}));}}return BPromise['all'](_0xc085e7);});})[_0x36ba('0x8')](function(_0x3f67cd){logger[_0x36ba('0x9')](_0x36ba('0x24'),_0x1488c0);logger['debug'](_0x36ba('0x24'),_0x1488c0,JSON[_0x36ba('0x1f')](_0x3f67cd));_0x4058da(_0x3f67cd);})[_0x36ba('0x1b')](function(_0x15985b){logger[_0x36ba('0xd')](_0x36ba('0x24'),_0x15985b[_0x36ba('0xe')],_0x1488c0);_0x5a0ff8(_0x52fbca['error'](0x1f4,_0x15985b['message']));});});});};exports[_0x36ba('0x34')]=function(_0x5cc179){var _0x1c752b=this;return new Promise(function(_0x5c627d,_0x207c1a){return db[_0x36ba('0x27')][_0x36ba('0x35')](function(_0x247491){return db[_0x36ba('0x36')][_0x36ba('0x1e')](_0x5cc179[_0x36ba('0x20')],{'raw':_0x5cc179[_0x36ba('0x12')]?_0x5cc179[_0x36ba('0x12')]['raw']===undefined?!![]:![]:!![],'transaction':_0x247491})[_0x36ba('0x8')](function(){return db[_0x36ba('0x11')][_0x36ba('0x23')]({'where':_0x5cc179[_0x36ba('0x12')]?_0x5cc179['options'][_0x36ba('0x14')]||null:null,'transaction':_0x247491});});})[_0x36ba('0x8')](function(_0x10e1c7){logger['info'](_0x36ba('0x34'),_0x5cc179);logger['debug'](_0x36ba('0x34'),_0x5cc179,JSON[_0x36ba('0x1f')](_0x10e1c7));_0x5c627d(_0x10e1c7);})[_0x36ba('0x1b')](function(_0x3f97af){logger[_0x36ba('0xd')]('MoveContactManagedDialer',_0x3f97af[_0x36ba('0xe')],_0x5cc179);_0x207c1a(_0x1c752b[_0x36ba('0xd')](0x1f4,_0x3f97af[_0x36ba('0xe')]));});});};exports[_0x36ba('0x37')]=function(_0x266507){var _0x55573f=this;return new Promise(function(_0x4e1b68,_0x2b1c7a){return db[_0x36ba('0x11')]['findAll']({'raw':_0x266507[_0x36ba('0x12')]?_0x266507[_0x36ba('0x12')][_0x36ba('0x13')]===undefined?!![]:![]:!![],'where':_0x266507['options']?_0x266507[_0x36ba('0x12')][_0x36ba('0x14')]||null:null,'attributes':[[db['sequelize']['fn'](_0x36ba('0x38'),db[_0x36ba('0x27')]['fn']('IF',db[_0x36ba('0x27')][_0x36ba('0x39')](_0x36ba('0x3a')+util['format']('\x22%s\x22',moment()[_0x36ba('0x3b')](_0x36ba('0x3c')))+_0x36ba('0x3d')))),_0x36ba('0x3e')]]})['then'](function(_0x2e0a43){logger[_0x36ba('0x9')](_0x36ba('0x37'),_0x266507);logger[_0x36ba('0x1a')](_0x36ba('0x37'),_0x266507,JSON[_0x36ba('0x1f')](_0x2e0a43));_0x4e1b68(_0x2e0a43);})[_0x36ba('0x1b')](function(_0x50db3b){logger[_0x36ba('0xd')]('CountReScheduled',_0x50db3b[_0x36ba('0xe')],_0x266507);_0x2b1c7a(_0x55573f[_0x36ba('0xd')](0x1f4,_0x50db3b[_0x36ba('0xe')]));});});};exports['GetContactRecallMe']=function(_0x59041f){var _0x21cf83=this;return new Promise(function(_0x17e441,_0x44202a){return db[_0x36ba('0x25')]['describe']()[_0x36ba('0x8')](function(_0xad6b14){return db[_0x36ba('0x27')][_0x36ba('0x35')](function(_0x410632){return db[_0x36ba('0x11')][_0x36ba('0x3f')]({'where':_0x59041f[_0x36ba('0x12')]?_0x59041f['options']['where']||null:null,'attributes':_0x59041f['options']?_0x59041f[_0x36ba('0x12')][_0x36ba('0x19')]||null:null,'limit':0x1,'order':_0x59041f['options']?_0x59041f['options'][_0x36ba('0x28')]||null:null,'group':db[_0x36ba('0x11')]['UserId'],'transaction':_0x410632,'lock':_0x410632[_0x36ba('0x29')][_0x36ba('0x2a')],'include':_0x59041f[_0x36ba('0x12')]?_0x59041f[_0x36ba('0x12')]['include']?_[_0x36ba('0x17')](_0x59041f[_0x36ba('0x12')][_0x36ba('0x16')],function(_0x372a91){return{'model':db[_0x372a91[_0x36ba('0x18')]],'as':_0x372a91['as'],'attributes':_0x372a91['attributes'],'include':_0x372a91[_0x36ba('0x16')]?_[_0x36ba('0x17')](_0x372a91[_0x36ba('0x16')],function(_0x1b46ed){return{'model':db[_0x1b46ed[_0x36ba('0x18')]],'as':_0x1b46ed['as'],'attributes':_0x1b46ed[_0x36ba('0x19')],'include':_0x1b46ed['include']?_[_0x36ba('0x17')](_0x1b46ed['include'],function(_0x1ef2cd){return{'model':db[_0x1ef2cd[_0x36ba('0x18')]],'as':_0x1ef2cd['as'],'attributes':_0x1ef2cd[_0x36ba('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45eedb){var _0x13a426=[];for(var _0x12398a=0x0;_0x12398a<_0x45eedb[_0x36ba('0x30')];_0x12398a+=0x1){_0x13a426[_0x36ba('0x40')](_0x45eedb[_0x12398a]['update'](_0x59041f['body'],{'transaction':_0x410632}));}return BPromise[_0x36ba('0x41')](_0x13a426);});})[_0x36ba('0x8')](function(_0x13a85b){logger[_0x36ba('0x9')](_0x36ba('0x42'),_0x59041f);logger[_0x36ba('0x1a')]('GetContactRecallMe',_0x59041f,JSON[_0x36ba('0x1f')](_0x13a85b));_0x17e441(_0x13a85b);})['catch'](function(_0xabcd34){logger['error']('GetContactRecallMe',_0xabcd34[_0x36ba('0xe')],_0x59041f);_0x44202a(_0x21cf83[_0x36ba('0xd')](0x1f4,_0xabcd34[_0x36ba('0xe')]));});});});};exports[_0x36ba('0x43')]=function(_0x8fde92){var _0x313fc8=this;return new Promise(function(_0x230b4f,_0x1e39ed){db[_0x36ba('0x25')][_0x36ba('0x26')]()['then'](function(_0x51054c){return db[_0x36ba('0x11')][_0x36ba('0x3f')]({'raw':_0x8fde92[_0x36ba('0x12')]?_0x8fde92[_0x36ba('0x12')][_0x36ba('0x13')]===undefined?!![]:![]:!![],'where':_0x8fde92[_0x36ba('0x12')]?_0x8fde92[_0x36ba('0x12')]['where']||null:null,'attributes':_0x8fde92[_0x36ba('0x12')]?_0x8fde92[_0x36ba('0x12')][_0x36ba('0x19')]||null:null,'limit':_0x8fde92[_0x36ba('0x12')]?_0x8fde92[_0x36ba('0x12')][_0x36ba('0x15')]||null:null,'include':_0x8fde92['options']?_0x8fde92[_0x36ba('0x12')][_0x36ba('0x16')]?_[_0x36ba('0x17')](_0x8fde92[_0x36ba('0x12')][_0x36ba('0x16')],function(_0x2a9b3e){return{'model':db[_0x2a9b3e['model']],'as':_0x2a9b3e['as'],'attributes':_0x2a9b3e['as']==='Contact'?_['keys'](_0x51054c):_0x2a9b3e[_0x36ba('0x19')],'include':_0x2a9b3e[_0x36ba('0x16')]?_[_0x36ba('0x17')](_0x2a9b3e[_0x36ba('0x16')],function(_0x53931f){return{'model':db[_0x53931f[_0x36ba('0x18')]],'as':_0x53931f['as'],'attributes':_0x53931f[_0x36ba('0x19')],'include':_0x53931f[_0x36ba('0x16')]?_[_0x36ba('0x17')](_0x53931f[_0x36ba('0x16')],function(_0x4caea6){return{'model':db[_0x4caea6[_0x36ba('0x18')]],'as':_0x4caea6['as'],'attributes':_0x4caea6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x161310){logger[_0x36ba('0x9')](_0x36ba('0x10'),_0x8fde92);logger['debug'](_0x36ba('0x10'),_0x8fde92,JSON[_0x36ba('0x1f')](_0x161310));_0x230b4f(_0x161310);})[_0x36ba('0x1b')](function(_0x3d4b63){logger[_0x36ba('0xd')](_0x36ba('0x10'),_0x3d4b63[_0x36ba('0xe')],_0x8fde92);_0x1e39ed(_0x313fc8['error'](0x1f4,_0x3d4b63['message']));});});});}; \ No newline at end of file +var _0xbb79=['update','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','LOCK','UPDATE','CmContact','keys','User','Agent','name','length','includes','UserId','push','all','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview','Contact','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','limit','include','map','model','attributes','debug','ShowCmHopper','find','raw','then','create','body','CreateCmHopper','UpdateCmHopper'];(function(_0x310846,_0x3441aa){var _0x2caa8d=function(_0x283ab0){while(--_0x283ab0){_0x310846['push'](_0x310846['shift']());}};_0x2caa8d(++_0x3441aa);}(_0xbb79,0xb3));var _0x9bb7=function(_0x56b0e9,_0x751b50){_0x56b0e9=_0x56b0e9-0x0;var _0x59ecbe=_0xbb79[_0x56b0e9];return _0x59ecbe;};'use strict';var _=require('lodash');var util=require(_0x9bb7('0x0'));var moment=require(_0x9bb7('0x1'));var BPromise=require(_0x9bb7('0x2'));var rs=require(_0x9bb7('0x3'));var fs=require('fs');var Redis=require(_0x9bb7('0x4'));var db=require(_0x9bb7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9bb7('0x6'));var config=require(_0x9bb7('0x7'));var jayson=require(_0x9bb7('0x8'));var client=jayson[_0x9bb7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e4cc9,_0x40e2ed,_0x1baad4){return new BPromise(function(_0x59d862,_0x16cb11){return client[_0x9bb7('0xa')](_0x5e4cc9,_0x1baad4)['then'](function(_0x530e93){logger[_0x9bb7('0xb')](_0x9bb7('0xc'),_0x40e2ed,'request\x20sent');logger['debug'](_0x9bb7('0xd'),_0x40e2ed,_0x9bb7('0xe'),JSON[_0x9bb7('0xf')](_0x530e93));if(_0x530e93[_0x9bb7('0x10')]){if(_0x530e93[_0x9bb7('0x10')][_0x9bb7('0x11')]===0x1f4){logger[_0x9bb7('0x10')](_0x9bb7('0xc'),_0x40e2ed,_0x530e93[_0x9bb7('0x10')]['message']);return _0x16cb11(_0x530e93[_0x9bb7('0x10')][_0x9bb7('0x12')]);}logger[_0x9bb7('0x10')]('CmHopper,\x20%s,\x20%s',_0x40e2ed,_0x530e93[_0x9bb7('0x10')][_0x9bb7('0x12')]);return _0x59d862(_0x530e93[_0x9bb7('0x10')][_0x9bb7('0x12')]);}else{logger[_0x9bb7('0xb')](_0x9bb7('0xc'),_0x40e2ed,_0x9bb7('0xe'));_0x59d862(_0x530e93[_0x9bb7('0x13')][_0x9bb7('0x12')]);}})[_0x9bb7('0x14')](function(_0x57a5ab){logger[_0x9bb7('0x10')](_0x9bb7('0xc'),_0x40e2ed,_0x57a5ab);_0x16cb11(_0x57a5ab);});});}exports[_0x9bb7('0x15')]=function(_0x442e39){var _0x11e7a9=this;return new Promise(function(_0x3e0126,_0x152027){return db[_0x9bb7('0x16')][_0x9bb7('0x17')]({'raw':_0x442e39[_0x9bb7('0x18')]?_0x442e39[_0x9bb7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x442e39[_0x9bb7('0x18')]?_0x442e39[_0x9bb7('0x18')][_0x9bb7('0x19')]||null:null,'attributes':_0x442e39['options']?_0x442e39[_0x9bb7('0x18')]['attributes']||null:null,'limit':_0x442e39[_0x9bb7('0x18')]?_0x442e39[_0x9bb7('0x18')][_0x9bb7('0x1a')]||null:null,'include':_0x442e39[_0x9bb7('0x18')]?_0x442e39[_0x9bb7('0x18')][_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x442e39[_0x9bb7('0x18')][_0x9bb7('0x1b')],function(_0x3bc5f7){return{'model':db[_0x3bc5f7[_0x9bb7('0x1d')]],'as':_0x3bc5f7['as'],'attributes':_0x3bc5f7[_0x9bb7('0x1e')],'include':_0x3bc5f7[_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x3bc5f7['include'],function(_0x412660){return{'model':db[_0x412660[_0x9bb7('0x1d')]],'as':_0x412660['as'],'attributes':_0x412660[_0x9bb7('0x1e')],'include':_0x412660['include']?_[_0x9bb7('0x1c')](_0x412660[_0x9bb7('0x1b')],function(_0x4bb51a){return{'model':db[_0x4bb51a['model']],'as':_0x4bb51a['as'],'attributes':_0x4bb51a[_0x9bb7('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5af726){logger[_0x9bb7('0xb')](_0x9bb7('0x15'),_0x442e39);logger[_0x9bb7('0x1f')](_0x9bb7('0x15'),_0x442e39,JSON[_0x9bb7('0xf')](_0x5af726));_0x3e0126(_0x5af726);})[_0x9bb7('0x14')](function(_0x5b0bf6){logger[_0x9bb7('0x10')](_0x9bb7('0x15'),_0x5b0bf6[_0x9bb7('0x12')],_0x442e39);_0x152027(_0x11e7a9[_0x9bb7('0x10')](0x1f4,_0x5b0bf6['message']));});});};exports[_0x9bb7('0x20')]=function(_0x342e24){var _0x2cd1c3=this;return new Promise(function(_0x19b2ee,_0x2a6dd8){return db[_0x9bb7('0x16')][_0x9bb7('0x21')]({'raw':_0x342e24[_0x9bb7('0x18')]?_0x342e24[_0x9bb7('0x18')][_0x9bb7('0x22')]===undefined?!![]:![]:!![],'where':_0x342e24[_0x9bb7('0x18')]?_0x342e24[_0x9bb7('0x18')][_0x9bb7('0x19')]||null:null,'attributes':_0x342e24[_0x9bb7('0x18')]?_0x342e24[_0x9bb7('0x18')][_0x9bb7('0x1e')]||null:null,'include':_0x342e24[_0x9bb7('0x18')]?_0x342e24[_0x9bb7('0x18')][_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x342e24[_0x9bb7('0x18')][_0x9bb7('0x1b')],function(_0x46c294){return{'model':db[_0x46c294[_0x9bb7('0x1d')]],'as':_0x46c294['as'],'attributes':_0x46c294[_0x9bb7('0x1e')],'include':_0x46c294[_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x46c294[_0x9bb7('0x1b')],function(_0x5a6a8e){return{'model':db[_0x5a6a8e[_0x9bb7('0x1d')]],'as':_0x5a6a8e['as'],'attributes':_0x5a6a8e[_0x9bb7('0x1e')],'include':_0x5a6a8e[_0x9bb7('0x1b')]?_['map'](_0x5a6a8e[_0x9bb7('0x1b')],function(_0x4e4b5e){return{'model':db[_0x4e4b5e[_0x9bb7('0x1d')]],'as':_0x4e4b5e['as'],'attributes':_0x4e4b5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9bb7('0x23')](function(_0x4a1ebd){logger[_0x9bb7('0xb')]('ShowCmHopper',_0x342e24);logger[_0x9bb7('0x1f')](_0x9bb7('0x20'),_0x342e24,JSON[_0x9bb7('0xf')](_0x4a1ebd));_0x19b2ee(_0x4a1ebd);})[_0x9bb7('0x14')](function(_0x4225d4){logger[_0x9bb7('0x10')](_0x9bb7('0x20'),_0x4225d4[_0x9bb7('0x12')],_0x342e24);_0x2a6dd8(_0x2cd1c3['error'](0x1f4,_0x4225d4['message']));});});};exports['CreateCmHopper']=function(_0xd03d34){var _0x2f4fa6=this;return new Promise(function(_0xcaf37c,_0x1d3ada){return db['CmHopper'][_0x9bb7('0x24')](_0xd03d34[_0x9bb7('0x25')],{'raw':_0xd03d34[_0x9bb7('0x18')]?_0xd03d34[_0x9bb7('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x34696f){logger[_0x9bb7('0xb')](_0x9bb7('0x26'),_0xd03d34);logger[_0x9bb7('0x1f')]('CreateCmHopper',_0xd03d34,JSON[_0x9bb7('0xf')](_0x34696f));_0xcaf37c(_0x34696f);})[_0x9bb7('0x14')](function(_0x15dcde){logger['error'](_0x9bb7('0x26'),_0x15dcde[_0x9bb7('0x12')],_0xd03d34);_0x1d3ada(_0x2f4fa6[_0x9bb7('0x10')](0x1f4,_0x15dcde['message']));});});};exports[_0x9bb7('0x27')]=function(_0x3404fc){var _0x1ac1b1=this;return new Promise(function(_0x32395b,_0x5cef81){return db[_0x9bb7('0x16')][_0x9bb7('0x28')](_0x3404fc['body'],{'raw':_0x3404fc['options']?_0x3404fc['options'][_0x9bb7('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3404fc[_0x9bb7('0x18')]?_0x3404fc[_0x9bb7('0x18')][_0x9bb7('0x19')]||null:null,'attributes':_0x3404fc[_0x9bb7('0x18')]?_0x3404fc[_0x9bb7('0x18')]['attributes']||null:null,'limit':_0x3404fc[_0x9bb7('0x18')]?_0x3404fc[_0x9bb7('0x18')][_0x9bb7('0x1a')]||null:null})[_0x9bb7('0x23')](function(_0x1e3de7){logger[_0x9bb7('0xb')](_0x9bb7('0x27'),_0x3404fc);logger[_0x9bb7('0x1f')](_0x9bb7('0x27'),_0x3404fc,JSON[_0x9bb7('0xf')](_0x1e3de7));_0x32395b(_0x1e3de7);})['catch'](function(_0x302fc4){logger[_0x9bb7('0x10')](_0x9bb7('0x27'),_0x302fc4[_0x9bb7('0x12')],_0x3404fc);_0x5cef81(_0x1ac1b1[_0x9bb7('0x10')](0x1f4,_0x302fc4['message']));});});};exports[_0x9bb7('0x29')]=function(_0x11b7a9){var _0x32fb9f=this;return new Promise(function(_0x143640,_0x4dd0b5){return db[_0x9bb7('0x16')][_0x9bb7('0x2a')]({'where':_0x11b7a9[_0x9bb7('0x18')]?_0x11b7a9[_0x9bb7('0x18')][_0x9bb7('0x19')]||null:null})[_0x9bb7('0x23')](function(_0x1f55cf){logger[_0x9bb7('0xb')](_0x9bb7('0x29'),_0x11b7a9);logger[_0x9bb7('0x1f')](_0x9bb7('0x29'),_0x11b7a9,JSON[_0x9bb7('0xf')](_0x1f55cf));_0x143640(_0x1f55cf);})[_0x9bb7('0x14')](function(_0x54025c){logger['error'](_0x9bb7('0x29'),_0x54025c[_0x9bb7('0x12')],_0x11b7a9);_0x4dd0b5(_0x32fb9f[_0x9bb7('0x10')](0x1f4,_0x54025c[_0x9bb7('0x12')]));});});};exports[_0x9bb7('0x2b')]=function(_0x484f0b){var _0x1265b2=this;return new Promise(function(_0x2d01d7,_0x4e53d5){return db['CmContact'][_0x9bb7('0x2c')]()[_0x9bb7('0x23')](function(_0x1f89b8){return db[_0x9bb7('0x2d')]['transaction'](function(_0x5e7b5a){return db[_0x9bb7('0x16')]['findAll']({'where':_0x484f0b[_0x9bb7('0x18')]?_0x484f0b[_0x9bb7('0x18')][_0x9bb7('0x19')]||null:null,'attributes':_0x484f0b[_0x9bb7('0x18')]?_0x484f0b[_0x9bb7('0x18')][_0x9bb7('0x1e')]||null:null,'limit':_0x484f0b[_0x9bb7('0x18')]?_0x484f0b['options'][_0x9bb7('0x1a')]||null:null,'order':_0x484f0b[_0x9bb7('0x18')]?_0x484f0b['options']['order']||null:null,'transaction':_0x5e7b5a,'lock':_0x5e7b5a[_0x9bb7('0x2e')][_0x9bb7('0x2f')],'include':[{'model':db[_0x9bb7('0x30')],'as':'Contact','attributes':_[_0x9bb7('0x31')](_0x1f89b8)},{'model':db[_0x9bb7('0x32')],'as':_0x9bb7('0x33'),'attributes':['id',_0x9bb7('0x34'),'voicePause']}]})[_0x9bb7('0x23')](function(_0x5e199d){var _0x39cd0c=[];var _0x34d298=[];for(var _0x41dda1=0x0;_0x41dda1<_0x5e199d[_0x9bb7('0x35')];_0x41dda1+=0x1){if(!_0x34d298[_0x9bb7('0x36')](_0x5e199d[_0x41dda1][_0x9bb7('0x37')])){_0x34d298[_0x9bb7('0x38')](_0x5e199d[_0x41dda1]['UserId']);_0x39cd0c[_0x9bb7('0x38')](_0x5e199d[_0x41dda1][_0x9bb7('0x28')](_0x484f0b[_0x9bb7('0x25')],{'transaction':_0x5e7b5a}));}}return BPromise[_0x9bb7('0x39')](_0x39cd0c);});})['then'](function(_0x7d9e2){logger[_0x9bb7('0xb')](_0x9bb7('0x2b'),_0x484f0b);logger['debug']('GetContactDialer',_0x484f0b,JSON[_0x9bb7('0xf')](_0x7d9e2));_0x2d01d7(_0x7d9e2);})[_0x9bb7('0x14')](function(_0x4e752d){logger[_0x9bb7('0x10')](_0x9bb7('0x2b'),_0x4e752d[_0x9bb7('0x12')],_0x484f0b);_0x4e53d5(_0x1265b2[_0x9bb7('0x10')](0x1f4,_0x4e752d['message']));});});});};exports[_0x9bb7('0x3a')]=function(_0xa6e264){var _0x294bac=this;return new Promise(function(_0x153c63,_0x5a98e1){return db[_0x9bb7('0x2d')][_0x9bb7('0x3b')](function(_0x336c20){return db[_0x9bb7('0x3c')][_0x9bb7('0x24')](_0xa6e264[_0x9bb7('0x25')],{'raw':_0xa6e264[_0x9bb7('0x18')]?_0xa6e264['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x336c20})[_0x9bb7('0x23')](function(){return db[_0x9bb7('0x16')][_0x9bb7('0x2a')]({'where':_0xa6e264['options']?_0xa6e264[_0x9bb7('0x18')]['where']||null:null,'transaction':_0x336c20});});})[_0x9bb7('0x23')](function(_0x49f698){logger['info'](_0x9bb7('0x3a'),_0xa6e264);logger[_0x9bb7('0x1f')](_0x9bb7('0x3a'),_0xa6e264,JSON[_0x9bb7('0xf')](_0x49f698));_0x153c63(_0x49f698);})['catch'](function(_0xf7263b){logger[_0x9bb7('0x10')]('MoveContactManagedDialer',_0xf7263b[_0x9bb7('0x12')],_0xa6e264);_0x5a98e1(_0x294bac['error'](0x1f4,_0xf7263b[_0x9bb7('0x12')]));});});};exports[_0x9bb7('0x3d')]=function(_0x2f43e0){var _0x30a3d8=this;return new Promise(function(_0x51bdeb,_0x4c93bd){return db[_0x9bb7('0x16')][_0x9bb7('0x17')]({'raw':_0x2f43e0[_0x9bb7('0x18')]?_0x2f43e0[_0x9bb7('0x18')][_0x9bb7('0x22')]===undefined?!![]:![]:!![],'where':_0x2f43e0[_0x9bb7('0x18')]?_0x2f43e0[_0x9bb7('0x18')][_0x9bb7('0x19')]||null:null,'attributes':[[db[_0x9bb7('0x2d')]['fn'](_0x9bb7('0x3e'),db[_0x9bb7('0x2d')]['fn']('IF',db['sequelize'][_0x9bb7('0x3f')]('`scheduledat`\x20>=\x20'+util[_0x9bb7('0x40')](_0x9bb7('0x41'),moment()['format'](_0x9bb7('0x42')))+_0x9bb7('0x43')))),_0x9bb7('0x44')]]})[_0x9bb7('0x23')](function(_0x13f775){logger['info'](_0x9bb7('0x3d'),_0x2f43e0);logger[_0x9bb7('0x1f')](_0x9bb7('0x3d'),_0x2f43e0,JSON['stringify'](_0x13f775));_0x51bdeb(_0x13f775);})[_0x9bb7('0x14')](function(_0x500114){logger[_0x9bb7('0x10')]('CountReScheduled',_0x500114[_0x9bb7('0x12')],_0x2f43e0);_0x4c93bd(_0x30a3d8['error'](0x1f4,_0x500114[_0x9bb7('0x12')]));});});};exports[_0x9bb7('0x45')]=function(_0x439904){var _0x86b978=this;return new Promise(function(_0x5ee476,_0x10a73d){return db[_0x9bb7('0x30')]['describe']()[_0x9bb7('0x23')](function(_0x1effa5){return db['sequelize'][_0x9bb7('0x3b')](function(_0x47a0c6){return db[_0x9bb7('0x16')][_0x9bb7('0x17')]({'where':_0x439904['options']?_0x439904[_0x9bb7('0x18')][_0x9bb7('0x19')]||null:null,'attributes':_0x439904['options']?_0x439904[_0x9bb7('0x18')][_0x9bb7('0x1e')]||null:null,'limit':0x1,'order':_0x439904[_0x9bb7('0x18')]?_0x439904[_0x9bb7('0x18')][_0x9bb7('0x46')]||null:null,'group':db[_0x9bb7('0x16')][_0x9bb7('0x37')],'transaction':_0x47a0c6,'lock':_0x47a0c6[_0x9bb7('0x2e')][_0x9bb7('0x2f')],'include':_0x439904['options']?_0x439904['options'][_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x439904[_0x9bb7('0x18')][_0x9bb7('0x1b')],function(_0x314421){return{'model':db[_0x314421[_0x9bb7('0x1d')]],'as':_0x314421['as'],'attributes':_0x314421['attributes'],'include':_0x314421[_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x314421[_0x9bb7('0x1b')],function(_0x35d0b6){return{'model':db[_0x35d0b6[_0x9bb7('0x1d')]],'as':_0x35d0b6['as'],'attributes':_0x35d0b6['attributes'],'include':_0x35d0b6[_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x35d0b6['include'],function(_0x315e78){return{'model':db[_0x315e78['model']],'as':_0x315e78['as'],'attributes':_0x315e78['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57ae4b){var _0x1a00be=[];for(var _0x532f03=0x0;_0x532f03<_0x57ae4b[_0x9bb7('0x35')];_0x532f03+=0x1){_0x1a00be['push'](_0x57ae4b[_0x532f03][_0x9bb7('0x28')](_0x439904[_0x9bb7('0x25')],{'transaction':_0x47a0c6}));}return BPromise['all'](_0x1a00be);});})['then'](function(_0x32325c){logger[_0x9bb7('0xb')]('GetContactRecallMe',_0x439904);logger[_0x9bb7('0x1f')](_0x9bb7('0x45'),_0x439904,JSON[_0x9bb7('0xf')](_0x32325c));_0x5ee476(_0x32325c);})['catch'](function(_0x352d4e){logger[_0x9bb7('0x10')](_0x9bb7('0x45'),_0x352d4e[_0x9bb7('0x12')],_0x439904);_0x10a73d(_0x86b978[_0x9bb7('0x10')](0x1f4,_0x352d4e[_0x9bb7('0x12')]));});});});};exports[_0x9bb7('0x47')]=function(_0x568e66){var _0x600953=this;return new Promise(function(_0x5148d0,_0x2c30ad){db[_0x9bb7('0x30')][_0x9bb7('0x2c')]()[_0x9bb7('0x23')](function(_0x45d9e4){return db[_0x9bb7('0x16')]['findAll']({'raw':_0x568e66[_0x9bb7('0x18')]?_0x568e66['options'][_0x9bb7('0x22')]===undefined?!![]:![]:!![],'where':_0x568e66[_0x9bb7('0x18')]?_0x568e66[_0x9bb7('0x18')][_0x9bb7('0x19')]||null:null,'attributes':_0x568e66[_0x9bb7('0x18')]?_0x568e66[_0x9bb7('0x18')][_0x9bb7('0x1e')]||null:null,'limit':_0x568e66[_0x9bb7('0x18')]?_0x568e66['options']['limit']||null:null,'include':_0x568e66[_0x9bb7('0x18')]?_0x568e66[_0x9bb7('0x18')][_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x568e66['options'][_0x9bb7('0x1b')],function(_0x241a5c){return{'model':db[_0x241a5c['model']],'as':_0x241a5c['as'],'attributes':_0x241a5c['as']===_0x9bb7('0x48')?_[_0x9bb7('0x31')](_0x45d9e4):_0x241a5c[_0x9bb7('0x1e')],'include':_0x241a5c[_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x241a5c[_0x9bb7('0x1b')],function(_0x472af9){return{'model':db[_0x472af9[_0x9bb7('0x1d')]],'as':_0x472af9['as'],'attributes':_0x472af9['attributes'],'include':_0x472af9[_0x9bb7('0x1b')]?_[_0x9bb7('0x1c')](_0x472af9[_0x9bb7('0x1b')],function(_0x54f26c){return{'model':db[_0x54f26c['model']],'as':_0x54f26c['as'],'attributes':_0x54f26c[_0x9bb7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9bb7('0x23')](function(_0x58526e){logger[_0x9bb7('0xb')](_0x9bb7('0x15'),_0x568e66);logger[_0x9bb7('0x1f')]('GetCmHopper',_0x568e66,JSON[_0x9bb7('0xf')](_0x58526e));_0x5148d0(_0x58526e);})['catch'](function(_0x236e65){logger[_0x9bb7('0x10')]('GetCmHopper',_0x236e65[_0x9bb7('0x12')],_0x568e66);_0x2c30ad(_0x600953[_0x9bb7('0x10')](0x1f4,_0x236e65[_0x9bb7('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 6a12bc1..383c5fc 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 _0x529f=['getOpenContacts','create','post','getPreview','/:id','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts'];(function(_0x25996d,_0x5b282e){var _0x12d802=function(_0x34fe7b){while(--_0x34fe7b){_0x25996d['push'](_0x25996d['shift']());}};_0x12d802(++_0x5b282e);}(_0x529f,0x1ac));var _0xf529=function(_0x485f41,_0xf300c2){_0x485f41=_0x485f41-0x0;var _0x6a79de=_0x529f[_0x485f41];return _0x6a79de;};'use strict';var multer=require(_0xf529('0x0'));var util=require(_0xf529('0x1'));var path=require(_0xf529('0x2'));var timeout=require('connect-timeout');var express=require(_0xf529('0x3'));var router=express['Router']();var fs_extra=require(_0xf529('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf529('0x5'));var config=require('../../config/environment');var controller=require(_0xf529('0x6'));router[_0xf529('0x7')]('/',auth['isAuthenticated'](),controller[_0xf529('0x8')]);router[_0xf529('0x7')](_0xf529('0x9'),auth[_0xf529('0xa')](),controller[_0xf529('0xb')]);router[_0xf529('0x7')](_0xf529('0xc'),auth[_0xf529('0xa')](),controller[_0xf529('0xd')]);router['get']('/:id',auth[_0xf529('0xa')](),controller['show']);router['post']('/',auth[_0xf529('0xa')](),controller[_0xf529('0xe')]);router[_0xf529('0xf')]('/preview',auth[_0xf529('0xa')](),controller[_0xf529('0x10')]);router['put'](_0xf529('0x11'),auth[_0xf529('0xa')](),controller['update']);router[_0xf529('0x12')]('/:id',auth[_0xf529('0xa')](),controller[_0xf529('0x13')]);module[_0xf529('0x14')]=router; \ No newline at end of file +var _0xe6e4=['../../config/environment','isAuthenticated','index','get','post','create','/preview','getPreview','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x56aabd,_0x1d05bd){var _0x5d7f48=function(_0x2f201e){while(--_0x2f201e){_0x56aabd['push'](_0x56aabd['shift']());}};_0x5d7f48(++_0x1d05bd);}(_0xe6e4,0x13b));var _0x4e6e=function(_0x115dfa,_0xa32a7b){_0x115dfa=_0x115dfa-0x0;var _0x358464=_0xe6e4[_0x115dfa];return _0x358464;};'use strict';var multer=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var path=require(_0x4e6e('0x2'));var timeout=require(_0x4e6e('0x3'));var express=require(_0x4e6e('0x4'));var router=express[_0x4e6e('0x5')]();var fs_extra=require(_0x4e6e('0x6'));var auth=require(_0x4e6e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4e6e('0x8'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x4e6e('0x9')](),controller[_0x4e6e('0xa')]);router[_0x4e6e('0xb')]('/describe',auth[_0x4e6e('0x9')](),controller['describe']);router[_0x4e6e('0xb')]('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x4e6e('0xb')]('/:id',auth[_0x4e6e('0x9')](),controller['show']);router[_0x4e6e('0xc')]('/',auth[_0x4e6e('0x9')](),controller[_0x4e6e('0xd')]);router[_0x4e6e('0xc')](_0x4e6e('0xe'),auth[_0x4e6e('0x9')](),controller[_0x4e6e('0xf')]);router['put'](_0x4e6e('0x10'),auth[_0x4e6e('0x9')](),controller[_0x4e6e('0x11')]);router[_0x4e6e('0x12')](_0x4e6e('0x10'),auth[_0x4e6e('0x9')](),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 f7e52ea..7d5eecc 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 _0xb901=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','sequelize','STRING','DATE'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb901,0x1d8));var _0x1b90=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xb901[_0x1a8bbc];return _0x212fc2;};'use strict';var moment=require('moment');var Sequelize=require(_0x1b90('0x0'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x1b90('0x1')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1b90('0x2')],'defaultValue':moment()['format'](_0x1b90('0x3'))},'countbusyretry':{'type':Sequelize[_0x1b90('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1b90('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1b90('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1b90('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1b90('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1b90('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e49=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x32cea1,_0x5400e0){var _0x138697=function(_0x2a1d10){while(--_0x2a1d10){_0x32cea1['push'](_0x32cea1['shift']());}};_0x138697(++_0x5400e0);}(_0x3e49,0x1d9));var _0x93e4=function(_0x4c6f22,_0x5543a8){_0x4c6f22=_0x4c6f22-0x0;var _0x1f400b=_0x3e49[_0x4c6f22];return _0x1f400b;};'use strict';var moment=require(_0x93e4('0x0'));var Sequelize=require(_0x93e4('0x1'));module[_0x93e4('0x2')]={'CmHopperId':{'type':Sequelize[_0x93e4('0x3')]},'phone':{'type':Sequelize[_0x93e4('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x93e4('0x5')],'defaultValue':moment()[_0x93e4('0x6')](_0x93e4('0x7'))},'countbusyretry':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x93e4('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 b082563..99b6718 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 _0x66f3=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','count','offset','limit','Content-Range','apply','reject','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1f2c09,_0x24a93d){var _0x1c9b4c=function(_0x7d42da){while(--_0x7d42da){_0x1f2c09['push'](_0x1f2c09['shift']());}};_0x1c9b4c(++_0x24a93d);}(_0x66f3,0xda));var _0x366f=function(_0x454629,_0x486c3f){_0x454629=_0x454629-0x0;var _0xb6121c=_0x66f3[_0x454629];return _0xb6121c;};'use strict';var pdf=require(_0x366f('0x0'));var emlformat=require(_0x366f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x366f('0x2'));var jsonpatch=require(_0x366f('0x3'));var rp=require(_0x366f('0x4'));var moment=require(_0x366f('0x5'));var BPromise=require(_0x366f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x366f('0x7'));var csv=require(_0x366f('0x8'));var ejs=require(_0x366f('0x9'));var fs=require('fs');var fs_extra=require(_0x366f('0xa'));var _=require(_0x366f('0xb'));var squel=require(_0x366f('0xc'));var crypto=require(_0x366f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x366f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x366f('0xf'));var Redis=require(_0x366f('0x10'));var authService=require(_0x366f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x366f('0x12'));var hardwareService=require(_0x366f('0x13'));var logger=require(_0x366f('0x14'))(_0x366f('0x15'));var utils=require(_0x366f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x366f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f16b0,_0x3d88db){_0x3d88db=_0x3d88db||0xcc;return function(_0x442479){if(_0x442479){return _0x1f16b0[_0x366f('0x18')](_0x3d88db);}return _0x1f16b0[_0x366f('0x19')](_0x3d88db)['end']();};}function respondWithResult(_0x3f3d35,_0x16179b){_0x16179b=_0x16179b||0xc8;return function(_0x275ff5){if(_0x275ff5){return _0x3f3d35['status'](_0x16179b)['json'](_0x275ff5);}};}function respondWithFilteredResult(_0x1461d1,_0x200627){return function(_0x480f43){if(_0x480f43){var _0x40dc53=_0x480f43[_0x366f('0x1a')],_0x116e7f=_0x200627[_0x366f('0x1b')],_0x48a546=_0x200627[_0x366f('0x1b')]+_0x200627[_0x366f('0x1c')],_0x4fe444;if(_0x48a546>=_0x40dc53){_0x48a546=_0x40dc53;_0x4fe444=0xc8;}else{_0x4fe444=0xce;}_0x1461d1[_0x366f('0x19')](_0x4fe444);return _0x1461d1['set'](_0x366f('0x1d'),_0x116e7f+'-'+_0x48a546+'/'+_0x40dc53)['json'](_0x480f43);}return null;};}function patchUpdates(_0xa94910){return function(_0x39647c){try{jsonpatch[_0x366f('0x1e')](_0x39647c,_0xa94910,!![]);}catch(_0x5d51c6){return BPromise[_0x366f('0x1f')](_0x5d51c6);}return _0x39647c['save']();};}function saveUpdates(_0x20d689,_0x561b5c){return function(_0x18f767){if(_0x18f767){return _0x18f767[_0x366f('0x20')](_0x20d689)[_0x366f('0x21')](function(_0x153c32){return _0x153c32;});}return null;};}function removeEntity(_0x299802,_0x550224){return function(_0x175a06){if(_0x175a06){return _0x175a06['destroy']()[_0x366f('0x21')](function(){var _0x1dea8f=_0x175a06[_0x366f('0x22')]({'plain':!![]});var _0x2e0101=_0x366f('0x23');return db[_0x366f('0x24')][_0x366f('0x25')]({'where':{'type':_0x2e0101,'resourceId':_0x1dea8f['id']}})[_0x366f('0x21')](function(){return _0x175a06;});})[_0x366f('0x21')](function(){_0x299802[_0x366f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c9d1d,_0x1fe915){return function(_0x62a3b2){if(!_0x62a3b2){_0x2c9d1d['sendStatus'](0x194);}return _0x62a3b2;};}function handleError(_0x1e8c5b,_0x4200ca){_0x4200ca=_0x4200ca||0x1f4;return function(_0x159286){logger['error'](_0x159286['stack']);if(_0x159286['name']){delete _0x159286[_0x366f('0x26')];}_0x1e8c5b[_0x366f('0x19')](_0x4200ca)[_0x366f('0x27')](_0x159286);};}exports[_0x366f('0x28')]=function(_0x5e7645,_0xc1dfa5){var _0x37dfd3={},_0x4e49bf={},_0x574662={'count':0x0,'rows':[]};var _0x7294ad=_[_0x366f('0x29')](db[_0x366f('0x2a')][_0x366f('0x2b')],function(_0x583f90){return{'name':_0x583f90[_0x366f('0x2c')],'type':_0x583f90[_0x366f('0x2d')][_0x366f('0x2e')]};});_0x4e49bf['model']=_[_0x366f('0x29')](_0x7294ad,_0x366f('0x26'));_0x4e49bf[_0x366f('0x2f')]=_[_0x366f('0x30')](_0x5e7645[_0x366f('0x2f')]);_0x4e49bf['filters']=_['intersection'](_0x4e49bf[_0x366f('0x31')],_0x4e49bf[_0x366f('0x2f')]);_0x37dfd3[_0x366f('0x32')]=_[_0x366f('0x33')](_0x4e49bf[_0x366f('0x31')],qs[_0x366f('0x34')](_0x5e7645[_0x366f('0x2f')][_0x366f('0x34')]));_0x37dfd3['attributes']=_0x37dfd3[_0x366f('0x32')][_0x366f('0x35')]?_0x37dfd3[_0x366f('0x32')]:_0x4e49bf[_0x366f('0x31')];if(!_0x5e7645['query'][_0x366f('0x36')](_0x366f('0x37'))){_0x37dfd3[_0x366f('0x1c')]=qs[_0x366f('0x1c')](_0x5e7645[_0x366f('0x2f')]['limit']);_0x37dfd3[_0x366f('0x1b')]=qs['offset'](_0x5e7645[_0x366f('0x2f')][_0x366f('0x1b')]);}_0x37dfd3[_0x366f('0x38')]=qs[_0x366f('0x39')](_0x5e7645[_0x366f('0x2f')][_0x366f('0x39')]);_0x37dfd3[_0x366f('0x3a')]=qs[_0x366f('0x3b')](_['pick'](_0x5e7645[_0x366f('0x2f')],_0x4e49bf[_0x366f('0x3b')]),_0x7294ad);if(_0x5e7645['query'][_0x366f('0x3c')]){_0x37dfd3[_0x366f('0x3a')]=_[_0x366f('0x3d')](_0x37dfd3[_0x366f('0x3a')],{'$or':_[_0x366f('0x29')](_0x7294ad,function(_0x12b768){if(_0x12b768[_0x366f('0x2d')]!==_0x366f('0x3e')){var _0x14b52c={};_0x14b52c[_0x12b768[_0x366f('0x26')]]={'$like':'%'+_0x5e7645['query']['filter']+'%'};return _0x14b52c;}})});}_0x37dfd3=_[_0x366f('0x3d')]({},_0x37dfd3,_0x5e7645[_0x366f('0x3f')]);var _0x1da47e={'where':_0x37dfd3['where']};return db[_0x366f('0x2a')][_0x366f('0x1a')](_0x1da47e)['then'](function(_0x5555dc){_0x574662[_0x366f('0x1a')]=_0x5555dc;if(_0x5e7645[_0x366f('0x2f')]['includeAll']){_0x37dfd3[_0x366f('0x40')]=[{'all':!![]}];}return db[_0x366f('0x2a')]['findAll'](_0x37dfd3);})[_0x366f('0x21')](function(_0x88be42){_0x574662[_0x366f('0x41')]=_0x88be42;return _0x574662;})['then'](respondWithFilteredResult(_0xc1dfa5,_0x37dfd3))[_0x366f('0x42')](handleError(_0xc1dfa5,null));};exports[_0x366f('0x43')]=function(_0x2e28de,_0x2ee61c){var _0x515111={'raw':!![],'where':{'id':_0x2e28de[_0x366f('0x44')]['id']}},_0x27c837={};_0x27c837[_0x366f('0x31')]=_[_0x366f('0x30')](db['CmHopperAdditionalPhone'][_0x366f('0x2b')]);_0x27c837['query']=_[_0x366f('0x30')](_0x2e28de[_0x366f('0x2f')]);_0x27c837[_0x366f('0x3b')]=_[_0x366f('0x33')](_0x27c837[_0x366f('0x31')],_0x27c837[_0x366f('0x2f')]);_0x515111[_0x366f('0x32')]=_[_0x366f('0x33')](_0x27c837[_0x366f('0x31')],qs[_0x366f('0x34')](_0x2e28de[_0x366f('0x2f')][_0x366f('0x34')]));_0x515111[_0x366f('0x32')]=_0x515111[_0x366f('0x32')]['length']?_0x515111['attributes']:_0x27c837[_0x366f('0x31')];if(_0x2e28de['query'][_0x366f('0x45')]){_0x515111[_0x366f('0x40')]=[{'all':!![]}];}_0x515111=_['merge']({},_0x515111,_0x2e28de[_0x366f('0x3f')]);return db['CmHopperAdditionalPhone']['find'](_0x515111)[_0x366f('0x21')](handleEntityNotFound(_0x2ee61c,null))[_0x366f('0x21')](respondWithResult(_0x2ee61c,null))['catch'](handleError(_0x2ee61c,null));};exports[_0x366f('0x46')]=function(_0x1eb4b1,_0x471204){return db[_0x366f('0x2a')]['create'](_0x1eb4b1[_0x366f('0x47')],{})[_0x366f('0x21')](function(_0x1385a6){var _0x58b08d=_0x1eb4b1[_0x366f('0x48')][_0x366f('0x22')]({'plain':!![]});if(!_0x58b08d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58b08d[_0x366f('0x49')]===_0x366f('0x48')){var _0x5cd377=_0x1385a6[_0x366f('0x22')]({'plain':!![]});var _0x2d3019=_0x366f('0x23');return db[_0x366f('0x4a')]['find']({'where':{'name':_0x2d3019,'userProfileId':_0x58b08d[_0x366f('0x4b')]},'raw':!![]})[_0x366f('0x21')](function(_0x98b48f){if(_0x98b48f&&_0x98b48f[_0x366f('0x4c')]===0x0){return db[_0x366f('0x24')][_0x366f('0x46')]({'name':_0x5cd377['name'],'resourceId':_0x5cd377['id'],'type':_0x98b48f[_0x366f('0x26')],'sectionId':_0x98b48f['id']},{})[_0x366f('0x21')](function(){return _0x1385a6;});}else{return _0x1385a6;}})[_0x366f('0x42')](function(_0x1b6317){logger['error'](_0x366f('0x4d'),_0x1b6317);throw _0x1b6317;});}return _0x1385a6;})[_0x366f('0x21')](respondWithResult(_0x471204,0xc9))[_0x366f('0x42')](handleError(_0x471204,null));};exports[_0x366f('0x20')]=function(_0x31c6c7,_0x15b9e8){if(_0x31c6c7['body']['id']){delete _0x31c6c7['body']['id'];}return db[_0x366f('0x2a')][_0x366f('0x4e')]({'where':{'id':_0x31c6c7[_0x366f('0x44')]['id']}})[_0x366f('0x21')](handleEntityNotFound(_0x15b9e8,null))[_0x366f('0x21')](saveUpdates(_0x31c6c7[_0x366f('0x47')],null))[_0x366f('0x21')](respondWithResult(_0x15b9e8,null))[_0x366f('0x42')](handleError(_0x15b9e8,null));};exports['destroy']=function(_0x753169,_0x5de2f7){return db[_0x366f('0x2a')]['find']({'where':{'id':_0x753169[_0x366f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5de2f7,null))[_0x366f('0x21')](removeEntity(_0x5de2f7,null))[_0x366f('0x42')](handleError(_0x5de2f7,null));}; \ No newline at end of file +var _0x3246=['type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','keys','includeAll','body','user','role','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName'];(function(_0x3b45b5,_0x7b6fc1){var _0x5350bd=function(_0x1c7a4f){while(--_0x1c7a4f){_0x3b45b5['push'](_0x3b45b5['shift']());}};_0x5350bd(++_0x7b6fc1);}(_0x3246,0x1ce));var _0x6324=function(_0x113e21,_0xcdc338){_0x113e21=_0x113e21-0x0;var _0xb82311=_0x3246[_0x113e21];return _0xb82311;};'use strict';var pdf=require(_0x6324('0x0'));var emlformat=require(_0x6324('0x1'));var rimraf=require(_0x6324('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6324('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6324('0x4'));var util=require(_0x6324('0x5'));var path=require(_0x6324('0x6'));var sox=require(_0x6324('0x7'));var csv=require(_0x6324('0x8'));var ejs=require(_0x6324('0x9'));var fs=require('fs');var fs_extra=require(_0x6324('0xa'));var _=require(_0x6324('0xb'));var squel=require(_0x6324('0xc'));var crypto=require(_0x6324('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6324('0x8'));var querystring=require(_0x6324('0xe'));var Papa=require('papaparse');var Redis=require(_0x6324('0xf'));var authService=require(_0x6324('0x10'));var qs=require(_0x6324('0x11'));var as=require(_0x6324('0x12'));var hardwareService=require(_0x6324('0x13'));var logger=require(_0x6324('0x14'))(_0x6324('0x15'));var utils=require('../../config/utils');var config=require(_0x6324('0x16'));var licenseUtil=require(_0x6324('0x17'));var db=require(_0x6324('0x18'))['db'];function respondWithStatusCode(_0x3d0648,_0x2ead44){_0x2ead44=_0x2ead44||0xcc;return function(_0x2f66fb){if(_0x2f66fb){return _0x3d0648[_0x6324('0x19')](_0x2ead44);}return _0x3d0648['status'](_0x2ead44)['end']();};}function respondWithResult(_0x3328fb,_0x9c71be){_0x9c71be=_0x9c71be||0xc8;return function(_0x13b0a4){if(_0x13b0a4){return _0x3328fb[_0x6324('0x1a')](_0x9c71be)[_0x6324('0x1b')](_0x13b0a4);}};}function respondWithFilteredResult(_0x3431f2,_0x36b781){return function(_0x5d9b52){if(_0x5d9b52){var _0x4386d4=_0x5d9b52['count'],_0x270b1c=_0x36b781[_0x6324('0x1c')],_0x4e3248=_0x36b781[_0x6324('0x1c')]+_0x36b781[_0x6324('0x1d')],_0x5c862d;if(_0x4e3248>=_0x4386d4){_0x4e3248=_0x4386d4;_0x5c862d=0xc8;}else{_0x5c862d=0xce;}_0x3431f2['status'](_0x5c862d);return _0x3431f2[_0x6324('0x1e')](_0x6324('0x1f'),_0x270b1c+'-'+_0x4e3248+'/'+_0x4386d4)[_0x6324('0x1b')](_0x5d9b52);}return null;};}function patchUpdates(_0x4989d1){return function(_0x19d223){try{jsonpatch[_0x6324('0x20')](_0x19d223,_0x4989d1,!![]);}catch(_0x3051fa){return BPromise['reject'](_0x3051fa);}return _0x19d223[_0x6324('0x21')]();};}function saveUpdates(_0x3298d0,_0x338acf){return function(_0x3cd0af){if(_0x3cd0af){return _0x3cd0af['update'](_0x3298d0)[_0x6324('0x22')](function(_0x20ef80){return _0x20ef80;});}return null;};}function removeEntity(_0x4db07e,_0x28c22d){return function(_0x1370aa){if(_0x1370aa){return _0x1370aa[_0x6324('0x23')]()[_0x6324('0x22')](function(){var _0x150804=_0x1370aa[_0x6324('0x24')]({'plain':!![]});var _0x4c4db1=_0x6324('0x25');return db[_0x6324('0x26')][_0x6324('0x23')]({'where':{'type':_0x4c4db1,'resourceId':_0x150804['id']}})[_0x6324('0x22')](function(){return _0x1370aa;});})[_0x6324('0x22')](function(){_0x4db07e[_0x6324('0x1a')](0xcc)[_0x6324('0x27')]();});}};}function handleEntityNotFound(_0x2efc6f,_0x1c1221){return function(_0x2196ff){if(!_0x2196ff){_0x2efc6f[_0x6324('0x19')](0x194);}return _0x2196ff;};}function handleError(_0x4917bc,_0x46a2fd){_0x46a2fd=_0x46a2fd||0x1f4;return function(_0x249df9){logger[_0x6324('0x28')](_0x249df9[_0x6324('0x29')]);if(_0x249df9['name']){delete _0x249df9[_0x6324('0x2a')];}_0x4917bc[_0x6324('0x1a')](_0x46a2fd)[_0x6324('0x2b')](_0x249df9);};}exports['index']=function(_0x2c6c3a,_0x3e78af){var _0x3f2f96={},_0x53b084={},_0x17b54f={'count':0x0,'rows':[]};var _0xbde455=_[_0x6324('0x2c')](db[_0x6324('0x2d')][_0x6324('0x2e')],function(_0x3e74dc){return{'name':_0x3e74dc[_0x6324('0x2f')],'type':_0x3e74dc[_0x6324('0x30')][_0x6324('0x31')]};});_0x53b084['model']=_[_0x6324('0x2c')](_0xbde455,_0x6324('0x2a'));_0x53b084['query']=_['keys'](_0x2c6c3a[_0x6324('0x32')]);_0x53b084[_0x6324('0x33')]=_['intersection'](_0x53b084[_0x6324('0x34')],_0x53b084['query']);_0x3f2f96[_0x6324('0x35')]=_[_0x6324('0x36')](_0x53b084[_0x6324('0x34')],qs[_0x6324('0x37')](_0x2c6c3a[_0x6324('0x32')][_0x6324('0x37')]));_0x3f2f96[_0x6324('0x35')]=_0x3f2f96[_0x6324('0x35')][_0x6324('0x38')]?_0x3f2f96[_0x6324('0x35')]:_0x53b084[_0x6324('0x34')];if(!_0x2c6c3a['query'][_0x6324('0x39')](_0x6324('0x3a'))){_0x3f2f96['limit']=qs['limit'](_0x2c6c3a['query'][_0x6324('0x1d')]);_0x3f2f96[_0x6324('0x1c')]=qs[_0x6324('0x1c')](_0x2c6c3a[_0x6324('0x32')][_0x6324('0x1c')]);}_0x3f2f96[_0x6324('0x3b')]=qs[_0x6324('0x3c')](_0x2c6c3a['query'][_0x6324('0x3c')]);_0x3f2f96['where']=qs[_0x6324('0x33')](_[_0x6324('0x3d')](_0x2c6c3a[_0x6324('0x32')],_0x53b084[_0x6324('0x33')]),_0xbde455);if(_0x2c6c3a[_0x6324('0x32')][_0x6324('0x3e')]){_0x3f2f96[_0x6324('0x3f')]=_[_0x6324('0x40')](_0x3f2f96[_0x6324('0x3f')],{'$or':_['map'](_0xbde455,function(_0x3d1235){if(_0x3d1235[_0x6324('0x30')]!==_0x6324('0x41')){var _0x5b5d49={};_0x5b5d49[_0x3d1235[_0x6324('0x2a')]]={'$like':'%'+_0x2c6c3a[_0x6324('0x32')]['filter']+'%'};return _0x5b5d49;}})});}_0x3f2f96=_[_0x6324('0x40')]({},_0x3f2f96,_0x2c6c3a[_0x6324('0x42')]);var _0x249565={'where':_0x3f2f96[_0x6324('0x3f')]};return db[_0x6324('0x2d')]['count'](_0x249565)['then'](function(_0x139f20){_0x17b54f[_0x6324('0x43')]=_0x139f20;if(_0x2c6c3a['query']['includeAll']){_0x3f2f96[_0x6324('0x44')]=[{'all':!![]}];}return db[_0x6324('0x2d')][_0x6324('0x45')](_0x3f2f96);})[_0x6324('0x22')](function(_0x2263d7){_0x17b54f[_0x6324('0x46')]=_0x2263d7;return _0x17b54f;})[_0x6324('0x22')](respondWithFilteredResult(_0x3e78af,_0x3f2f96))[_0x6324('0x47')](handleError(_0x3e78af,null));};exports[_0x6324('0x48')]=function(_0x39dd53,_0x508b30){var _0x262397={'raw':!![],'where':{'id':_0x39dd53[_0x6324('0x49')]['id']}},_0x130a01={};_0x130a01[_0x6324('0x34')]=_['keys'](db[_0x6324('0x2d')][_0x6324('0x2e')]);_0x130a01[_0x6324('0x32')]=_[_0x6324('0x4a')](_0x39dd53[_0x6324('0x32')]);_0x130a01[_0x6324('0x33')]=_[_0x6324('0x36')](_0x130a01[_0x6324('0x34')],_0x130a01[_0x6324('0x32')]);_0x262397[_0x6324('0x35')]=_['intersection'](_0x130a01[_0x6324('0x34')],qs[_0x6324('0x37')](_0x39dd53[_0x6324('0x32')][_0x6324('0x37')]));_0x262397[_0x6324('0x35')]=_0x262397[_0x6324('0x35')][_0x6324('0x38')]?_0x262397[_0x6324('0x35')]:_0x130a01[_0x6324('0x34')];if(_0x39dd53[_0x6324('0x32')][_0x6324('0x4b')]){_0x262397[_0x6324('0x44')]=[{'all':!![]}];}_0x262397=_[_0x6324('0x40')]({},_0x262397,_0x39dd53[_0x6324('0x42')]);return db['CmHopperAdditionalPhone']['find'](_0x262397)[_0x6324('0x22')](handleEntityNotFound(_0x508b30,null))[_0x6324('0x22')](respondWithResult(_0x508b30,null))[_0x6324('0x47')](handleError(_0x508b30,null));};exports['create']=function(_0x43ab6c,_0x5c2503){return db[_0x6324('0x2d')]['create'](_0x43ab6c[_0x6324('0x4c')],{})[_0x6324('0x22')](function(_0x7a1f3){var _0x52abae=_0x43ab6c[_0x6324('0x4d')]['get']({'plain':!![]});if(!_0x52abae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52abae[_0x6324('0x4e')]===_0x6324('0x4d')){var _0x5a0f2a=_0x7a1f3[_0x6324('0x24')]({'plain':!![]});var _0x5e96fe=_0x6324('0x25');return db[_0x6324('0x4f')][_0x6324('0x50')]({'where':{'name':_0x5e96fe,'userProfileId':_0x52abae['userProfileId']},'raw':!![]})[_0x6324('0x22')](function(_0x3b9c34){if(_0x3b9c34&&_0x3b9c34[_0x6324('0x51')]===0x0){return db['UserProfileResource'][_0x6324('0x52')]({'name':_0x5a0f2a[_0x6324('0x2a')],'resourceId':_0x5a0f2a['id'],'type':_0x3b9c34[_0x6324('0x2a')],'sectionId':_0x3b9c34['id']},{})[_0x6324('0x22')](function(){return _0x7a1f3;});}else{return _0x7a1f3;}})['catch'](function(_0x589a87){logger[_0x6324('0x28')](_0x6324('0x53'),_0x589a87);throw _0x589a87;});}return _0x7a1f3;})[_0x6324('0x22')](respondWithResult(_0x5c2503,0xc9))[_0x6324('0x47')](handleError(_0x5c2503,null));};exports[_0x6324('0x54')]=function(_0x3f1d45,_0x2de42c){if(_0x3f1d45['body']['id']){delete _0x3f1d45[_0x6324('0x4c')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x3f1d45[_0x6324('0x49')]['id']}})['then'](handleEntityNotFound(_0x2de42c,null))['then'](saveUpdates(_0x3f1d45[_0x6324('0x4c')],null))[_0x6324('0x22')](respondWithResult(_0x2de42c,null))[_0x6324('0x47')](handleError(_0x2de42c,null));};exports[_0x6324('0x23')]=function(_0x571abd,_0x4c7cf4){return db[_0x6324('0x2d')][_0x6324('0x50')]({'where':{'id':_0x571abd[_0x6324('0x49')]['id']}})[_0x6324('0x22')](handleEntityNotFound(_0x4c7cf4,null))[_0x6324('0x22')](removeEntity(_0x4c7cf4,null))[_0x6324('0x47')](handleError(_0x4c7cf4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 18e1409..f22f70c 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 _0x567e=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','define'];(function(_0x3eefc9,_0x231268){var _0x54f4ef=function(_0x6278b3){while(--_0x6278b3){_0x3eefc9['push'](_0x3eefc9['shift']());}};_0x54f4ef(++_0x231268);}(_0x567e,0x169));var _0xe567=function(_0x4db25d,_0x1b1646){_0x4db25d=_0x4db25d-0x0;var _0x237567=_0x567e[_0x4db25d];return _0x237567;};'use strict';var _=require(_0xe567('0x0'));var util=require(_0xe567('0x1'));var logger=require(_0xe567('0x2'))(_0xe567('0x3'));var moment=require(_0xe567('0x4'));var BPromise=require(_0xe567('0x5'));var rp=require(_0xe567('0x6'));var fs=require('fs');var path=require(_0xe567('0x7'));var rimraf=require('rimraf');var config=require(_0xe567('0x8'));var attributes=require(_0xe567('0x9'));module['exports']=function(_0x1f6b5a,_0x1c19de){return _0x1f6b5a[_0xe567('0xa')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xe567('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf92f=['request-promise','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','bluebird'];(function(_0x11608e,_0x17a102){var _0x50173f=function(_0x265f63){while(--_0x265f63){_0x11608e['push'](_0x11608e['shift']());}};_0x50173f(++_0x17a102);}(_0xf92f,0x1dd));var _0xff92=function(_0x5f5961,_0xe2e12f){_0x5f5961=_0x5f5961-0x0;var _0x2ee838=_0xf92f[_0x5f5961];return _0x2ee838;};'use strict';var _=require('lodash');var util=require(_0xff92('0x0'));var logger=require(_0xff92('0x1'))('api');var moment=require('moment');var BPromise=require(_0xff92('0x2'));var rp=require(_0xff92('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff92('0x4'));var config=require(_0xff92('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xff92('0x6')]=function(_0x4340f7,_0x43a316){return _0x4340f7[_0xff92('0x7')](_0xff92('0x8'),attributes,{'tableName':_0xff92('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 230c685..9ca8a1e 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 _0xcb17=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VerifyAdditionalPhones','CmHopper','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countdropretry','catch','SwapAdditionalPhones','waitTime','scheduledat','add','minutes','phone','isNil','updatedAt','createdAt','hopperToAdd','additionalToHop','update','field','IncrementPreviewCounters','lodash','util','moment','ioredis','../../config/utils'];(function(_0x42cf2a,_0x5b238a){var _0x504b51=function(_0x25877f){while(--_0x25877f){_0x42cf2a['push'](_0x42cf2a['shift']());}};_0x504b51(++_0x5b238a);}(_0xcb17,0x1d3));var _0x7cb1=function(_0xe74376,_0x3ae7e0){_0xe74376=_0xe74376-0x0;var _0x3f2e7e=_0xcb17[_0xe74376];return _0x3f2e7e;};'use strict';var _=require(_0x7cb1('0x0'));var util=require(_0x7cb1('0x1'));var moment=require(_0x7cb1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cb1('0x4'));var logger=require(_0x7cb1('0x5'))(_0x7cb1('0x6'));var config=require(_0x7cb1('0x7'));var jayson=require(_0x7cb1('0x8'));var client=jayson[_0x7cb1('0x9')][_0x7cb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x404a55,_0x459175,_0x8dee62){return new BPromise(function(_0x32d996,_0x27dff5){return client[_0x7cb1('0xb')](_0x404a55,_0x8dee62)[_0x7cb1('0xc')](function(_0x40e481){logger[_0x7cb1('0xd')](_0x7cb1('0xe'),_0x459175,_0x7cb1('0xf'));logger[_0x7cb1('0x10')](_0x7cb1('0x11'),_0x459175,_0x7cb1('0xf'),JSON[_0x7cb1('0x12')](_0x40e481));if(_0x40e481['error']){if(_0x40e481[_0x7cb1('0x13')][_0x7cb1('0x14')]===0x1f4){logger[_0x7cb1('0x13')](_0x7cb1('0xe'),_0x459175,_0x40e481[_0x7cb1('0x13')]['message']);return _0x27dff5(_0x40e481[_0x7cb1('0x13')]['message']);}logger[_0x7cb1('0x13')](_0x7cb1('0xe'),_0x459175,_0x40e481[_0x7cb1('0x13')][_0x7cb1('0x15')]);return _0x32d996(_0x40e481[_0x7cb1('0x13')][_0x7cb1('0x15')]);}else{logger[_0x7cb1('0xd')](_0x7cb1('0xe'),_0x459175,'request\x20sent');_0x32d996(_0x40e481[_0x7cb1('0x16')]['message']);}})['catch'](function(_0x196270){logger[_0x7cb1('0x13')](_0x7cb1('0xe'),_0x459175,_0x196270);_0x27dff5(_0x196270);});});}exports[_0x7cb1('0x17')]=function(_0x3a6f06){var _0x259a91=this;return new Promise(function(_0x5e3f61,_0x37d615){return db[_0x7cb1('0x18')][_0x7cb1('0x19')]({'raw':!![],'where':{'ContactId':_0x3a6f06['body'][_0x7cb1('0x1a')],'ListId':_0x3a6f06['body'][_0x7cb1('0x1b')],'VoiceQueueId':_0x3a6f06[_0x7cb1('0x1c')][_0x7cb1('0x1d')]===undefined?null:_0x3a6f06['body'][_0x7cb1('0x1d')],'CampaignId':_0x3a6f06['body'][_0x7cb1('0x1e')]===undefined?null:_0x3a6f06['body']['CampaignId']}})['then'](function(_0x12a7e4){if(_0x12a7e4!=null){return db[_0x7cb1('0x1f')][_0x7cb1('0x19')]({'raw':!![],'where':{'CmHopperId':_0x12a7e4['id'],'OrderBy':{'$gt':_0x12a7e4['OrderBy']}},'order':[[_0x7cb1('0x20'),'ASC']]})[_0x7cb1('0xc')](function(_0x3a5958){var _0x124161=0x0;if(_0x3a5958){if(_0x3a5958[_0x7cb1('0x21')]+_0x3a5958[_0x7cb1('0x22')]+_0x3a5958[_0x7cb1('0x23')]+_0x3a5958[_0x7cb1('0x24')]+_0x3a5958['countdropretry']+_0x3a5958[_0x7cb1('0x25')]+_0x3a5958[_0x7cb1('0x26')]+_0x3a5958[_0x7cb1('0x27')]<_0x3a6f06[_0x7cb1('0x28')][_0x7cb1('0x29')])_0x124161=0x1;_0x5e3f61({'additional':_0x124161});}else{return db[_0x7cb1('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x12a7e4['id']},'order':[['OrderBy',_0x7cb1('0x2a')]]})[_0x7cb1('0xc')](function(_0x225ec4){var _0x410df4=0x0;if(_0x225ec4){if(_0x225ec4['countbusyretry']+_0x225ec4[_0x7cb1('0x22')]+_0x225ec4[_0x7cb1('0x23')]+_0x225ec4[_0x7cb1('0x24')]+_0x225ec4[_0x7cb1('0x2b')]+_0x225ec4['countabandonedretry']+_0x225ec4['countmachineretry']+_0x225ec4[_0x7cb1('0x27')]<_0x3a6f06[_0x7cb1('0x28')][_0x7cb1('0x29')])_0x410df4=0x1;_0x5e3f61({'additional':_0x410df4});}else{_0x5e3f61({'additional':0x0});}})['catch'](function(_0x352b70){logger[_0x7cb1('0x13')](_0x7cb1('0x17'),_0x352b70[_0x7cb1('0x15')],_0x3a6f06);_0x37d615(_0x259a91[_0x7cb1('0x13')](0x1f4,_0x352b70[_0x7cb1('0x15')]));});}})[_0x7cb1('0x2c')](function(_0x868ef6){logger[_0x7cb1('0x13')]('VerifyAdditionalPhones',_0x868ef6[_0x7cb1('0x15')],_0x3a6f06);_0x37d615(_0x259a91[_0x7cb1('0x13')](0x1f4,_0x868ef6['message']));});}else _0x5e3f61({'additional':0x0});});});};exports[_0x7cb1('0x2d')]=function(_0x10bd65){var _0x5552d3=this;return new Promise(function(_0xba4a88,_0x218ad1){return db[_0x7cb1('0x18')][_0x7cb1('0x19')]({'raw':!![],'where':{'ContactId':_0x10bd65['body'][_0x7cb1('0x1a')],'ListId':_0x10bd65[_0x7cb1('0x1c')][_0x7cb1('0x1b')],'VoiceQueueId':_0x10bd65[_0x7cb1('0x1c')]['VoiceQueueId']===undefined?null:_0x10bd65[_0x7cb1('0x1c')]['VoiceQueueId'],'CampaignId':_0x10bd65[_0x7cb1('0x1c')]['CampaignId']===undefined?null:_0x10bd65[_0x7cb1('0x1c')][_0x7cb1('0x1e')]}})['then'](function(_0x7d268d){if(_0x7d268d!=null){return db[_0x7cb1('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x7d268d['id'],'OrderBy':{'$gt':_0x7d268d[_0x7cb1('0x20')]}},'order':[[_0x7cb1('0x20'),_0x7cb1('0x2a')]]})[_0x7cb1('0xc')](function(_0x39b9e9){if(_0x39b9e9)return activateAdditionalPhone(_0x7d268d,_0x10bd65[_0x7cb1('0x1c')],_0x39b9e9,_0x10bd65['duration'],_0x10bd65['waitTime'])['then'](function(_0x474d70){_0xba4a88(_0x474d70);});else{return db['CmHopperAdditionalPhone'][_0x7cb1('0x19')]({'raw':!![],'where':{'CmHopperId':_0x7d268d['id']},'order':[['OrderBy',_0x7cb1('0x2a')]]})[_0x7cb1('0xc')](function(_0x6298c2){if(_0x6298c2)return activateAdditionalPhone(_0x7d268d,_0x10bd65[_0x7cb1('0x1c')],_0x6298c2,_0x10bd65['duration'],_0x10bd65[_0x7cb1('0x2e')])[_0x7cb1('0xc')](function(_0x18c394){_0xba4a88(_0x18c394);});else{_0xba4a88({'id':_0x7d268d['id'],'phone':''});}})['catch'](function(_0x53fdea){logger[_0x7cb1('0x13')](_0x7cb1('0x17'),_0x53fdea[_0x7cb1('0x15')],_0x10bd65);_0x218ad1(_0x5552d3['error'](0x1f4,_0x53fdea[_0x7cb1('0x15')]));});}})['catch'](function(_0x5c6fb2){logger['error'](_0x7cb1('0x17'),_0x5c6fb2[_0x7cb1('0x15')],_0x10bd65);_0x218ad1(_0x5552d3[_0x7cb1('0x13')](0x1f4,_0x5c6fb2[_0x7cb1('0x15')]));});}else _0xba4a88(0x1);});});};function activateAdditionalPhone(_0x562dfb,_0x1c3bae,_0x3655c3,_0x61c135,_0x4635f0){return new Promise(function(_0x411903,_0x5c8445){logger['info'](_0x7cb1('0x17'),_0x3655c3);var _0xffcbaa;if(moment()>moment(_0x3655c3[_0x7cb1('0x2f')])){_0xffcbaa=moment()[_0x7cb1('0x30')](_0x4635f0||0x3,_0x7cb1('0x31'));}else{if(_0x3655c3[_0x7cb1('0x20')]==0x0){_0xffcbaa=moment(_0x3655c3['scheduledat']);}else{_0xffcbaa=moment()[_0x7cb1('0x30')](_0x4635f0||0x3,_0x7cb1('0x31'));}}var _0x4e7365={'phone':_0x562dfb[_0x7cb1('0x32')],'active':0x0,'OrderBy':_[_0x7cb1('0x33')](_0x562dfb[_0x7cb1('0x20')])?0x0:_0x562dfb[_0x7cb1('0x20')],'scheduledat':moment()[_0x7cb1('0x30')](_0x61c135||0x1,_0x7cb1('0x31')),'countbusyretry':_0x1c3bae[_0x7cb1('0x21')],'countcongestionretry':_0x1c3bae[_0x7cb1('0x22')],'countnoanswerretry':_0x1c3bae[_0x7cb1('0x23')],'countnosuchnumberretry':_0x1c3bae[_0x7cb1('0x24')],'countdropretry':_0x1c3bae[_0x7cb1('0x2b')],'countabandonedretry':_0x1c3bae[_0x7cb1('0x25')],'countmachineretry':_0x1c3bae[_0x7cb1('0x26')],'countagentrejectretry':_0x1c3bae['countagentrejectretry'],'createdAt':_0x1c3bae['createdAt'],'updatedAt':_0x1c3bae[_0x7cb1('0x34')]};var _0x3543f9={'CmHopperId':_0x562dfb['id'],'phone':_0x3655c3[_0x7cb1('0x32')],'active':0x0,'OrderBy':_[_0x7cb1('0x33')](_0x3655c3[_0x7cb1('0x20')])?0x0:_0x3655c3[_0x7cb1('0x20')],'scheduledat':_0xffcbaa,'countbusyretry':_0x3655c3[_0x7cb1('0x21')],'countcongestionretry':_0x3655c3[_0x7cb1('0x22')],'countnoanswerretry':_0x3655c3[_0x7cb1('0x23')],'countnosuchnumberretry':_0x1c3bae[_0x7cb1('0x24')],'countdropretry':_0x1c3bae['countdropretry'],'countabandonedretry':_0x1c3bae['countabandonedretry'],'countmachineretry':_0x1c3bae[_0x7cb1('0x26')],'countagentrejectretry':_0x1c3bae['countagentrejectretry'],'createdAt':_0x3655c3[_0x7cb1('0x35')],'updatedAt':_0x3655c3[_0x7cb1('0x34')]};logger[_0x7cb1('0xd')](_0x7cb1('0x36'),_0x4e7365);logger['info'](_0x7cb1('0x37'),_0x3543f9);return db['sequelize']['transaction'](function(_0x166c2c){return db[_0x7cb1('0x1f')]['update'](_0x4e7365,{'where':{'id':_0x3655c3['id']}},{'transaction':_0x166c2c})[_0x7cb1('0xc')](function(){return db['CmHopper'][_0x7cb1('0x38')](_0x3543f9,{'where':{'id':_0x562dfb['id']}},{'transaction':_0x166c2c});});})[_0x7cb1('0xc')](function(_0x349e94){_0x411903({'id':_0x562dfb['id'],'phone':_0x3655c3['phone']});})[_0x7cb1('0x2c')](function(_0x1532f6){logger[_0x7cb1('0x13')](_0x7cb1('0x17'),_0x1532f6['message'],req);_0x5c8445(_this['error'](0x1f4,_0x1532f6[_0x7cb1('0x15')]));});});}exports['IncrementPreviewCounters']=function(_0x5d2dfd){var _0x1d3ef0=this;return new Promise(function(_0xa29605,_0x2caec8){return db[_0x7cb1('0x18')]['update'](_0x5d2dfd[_0x7cb1('0x1c')][_0x7cb1('0x39')],{'where':{'id':_0x5d2dfd[_0x7cb1('0x1c')]['id']}})[_0x7cb1('0xc')](function(_0x34fac4){_0xa29605(_0x34fac4);})[_0x7cb1('0x2c')](function(_0x16b910){logger['error'](_0x7cb1('0x3a'),_0x16b910[_0x7cb1('0x15')],_0x5d2dfd);_0x2caec8(_0x1d3ef0[_0x7cb1('0x13')](0x1f4,_0x16b910[_0x7cb1('0x15')]));});});}; \ No newline at end of file +var _0x760c=['scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','info','hopperToAdd','sequelize','transaction','update','IncrementPreviewCounters','field','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','VerifyAdditionalPhones','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','then','catch','CmHopper','duration','waitTime'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x760c,0x1a4));var _0xc760=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x760c[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc760('0x0'));var BPromise=require(_0xc760('0x1'));var rs=require(_0xc760('0x2'));var fs=require('fs');var Redis=require(_0xc760('0x3'));var db=require(_0xc760('0x4'))['db'];var utils=require(_0xc760('0x5'));var logger=require(_0xc760('0x6'))(_0xc760('0x7'));var config=require(_0xc760('0x8'));var jayson=require(_0xc760('0x9'));var client=jayson[_0xc760('0xa')][_0xc760('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e7901,_0x41529e,_0x2070f5){return new BPromise(function(_0x5c14f7,_0x56907d){return client['request'](_0x3e7901,_0x2070f5)['then'](function(_0x377fbb){logger['info'](_0xc760('0xc'),_0x41529e,_0xc760('0xd'));logger[_0xc760('0xe')](_0xc760('0xf'),_0x41529e,_0xc760('0xd'),JSON[_0xc760('0x10')](_0x377fbb));if(_0x377fbb[_0xc760('0x11')]){if(_0x377fbb[_0xc760('0x11')]['code']===0x1f4){logger[_0xc760('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x41529e,_0x377fbb[_0xc760('0x11')][_0xc760('0x12')]);return _0x56907d(_0x377fbb[_0xc760('0x11')][_0xc760('0x12')]);}logger[_0xc760('0x11')](_0xc760('0xc'),_0x41529e,_0x377fbb['error'][_0xc760('0x12')]);return _0x5c14f7(_0x377fbb['error'][_0xc760('0x12')]);}else{logger['info'](_0xc760('0xc'),_0x41529e,_0xc760('0xd'));_0x5c14f7(_0x377fbb['result'][_0xc760('0x12')]);}})['catch'](function(_0x5bcfd0){logger['error'](_0xc760('0xc'),_0x41529e,_0x5bcfd0);_0x56907d(_0x5bcfd0);});});}exports[_0xc760('0x13')]=function(_0x3a98d2){var _0x58d48c=this;return new Promise(function(_0x1c9cac,_0x18f39d){return db['CmHopper'][_0xc760('0x14')]({'raw':!![],'where':{'ContactId':_0x3a98d2['body'][_0xc760('0x15')],'ListId':_0x3a98d2['body'][_0xc760('0x16')],'VoiceQueueId':_0x3a98d2[_0xc760('0x17')]['VoiceQueueId']===undefined?null:_0x3a98d2[_0xc760('0x17')][_0xc760('0x18')],'CampaignId':_0x3a98d2['body']['CampaignId']===undefined?null:_0x3a98d2[_0xc760('0x17')][_0xc760('0x19')]}})['then'](function(_0x52c0bd){if(_0x52c0bd!=null){return db['CmHopperAdditionalPhone'][_0xc760('0x14')]({'raw':!![],'where':{'CmHopperId':_0x52c0bd['id'],'OrderBy':{'$gt':_0x52c0bd[_0xc760('0x1a')]}},'order':[[_0xc760('0x1a'),_0xc760('0x1b')]]})['then'](function(_0xa29855){var _0x1b4e85=0x0;if(_0xa29855){if(_0xa29855[_0xc760('0x1c')]+_0xa29855[_0xc760('0x1d')]+_0xa29855[_0xc760('0x1e')]+_0xa29855[_0xc760('0x1f')]+_0xa29855[_0xc760('0x20')]+_0xa29855[_0xc760('0x21')]+_0xa29855[_0xc760('0x22')]+_0xa29855[_0xc760('0x23')]<_0x3a98d2[_0xc760('0x24')][_0xc760('0x25')])_0x1b4e85=0x1;_0x1c9cac({'additional':_0x1b4e85});}else{return db[_0xc760('0x26')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x52c0bd['id']},'order':[[_0xc760('0x1a'),'ASC']]})[_0xc760('0x27')](function(_0x1e1f8e){var _0x625810=0x0;if(_0x1e1f8e){if(_0x1e1f8e[_0xc760('0x1c')]+_0x1e1f8e[_0xc760('0x1d')]+_0x1e1f8e['countnoanswerretry']+_0x1e1f8e['countnosuchnumberretry']+_0x1e1f8e[_0xc760('0x20')]+_0x1e1f8e[_0xc760('0x21')]+_0x1e1f8e['countmachineretry']+_0x1e1f8e['countagentrejectretry']<_0x3a98d2[_0xc760('0x24')]['dialGlobalMaxRetry'])_0x625810=0x1;_0x1c9cac({'additional':_0x625810});}else{_0x1c9cac({'additional':0x0});}})[_0xc760('0x28')](function(_0x1bac90){logger[_0xc760('0x11')](_0xc760('0x13'),_0x1bac90[_0xc760('0x12')],_0x3a98d2);_0x18f39d(_0x58d48c[_0xc760('0x11')](0x1f4,_0x1bac90['message']));});}})[_0xc760('0x28')](function(_0x5510c1){logger[_0xc760('0x11')](_0xc760('0x13'),_0x5510c1[_0xc760('0x12')],_0x3a98d2);_0x18f39d(_0x58d48c[_0xc760('0x11')](0x1f4,_0x5510c1[_0xc760('0x12')]));});}else _0x1c9cac({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0xece4d4){var _0x4079dc=this;return new Promise(function(_0x3a9337,_0x33f065){return db[_0xc760('0x29')][_0xc760('0x14')]({'raw':!![],'where':{'ContactId':_0xece4d4['body']['ContactId'],'ListId':_0xece4d4['body'][_0xc760('0x16')],'VoiceQueueId':_0xece4d4[_0xc760('0x17')][_0xc760('0x18')]===undefined?null:_0xece4d4[_0xc760('0x17')][_0xc760('0x18')],'CampaignId':_0xece4d4[_0xc760('0x17')][_0xc760('0x19')]===undefined?null:_0xece4d4[_0xc760('0x17')][_0xc760('0x19')]}})['then'](function(_0x598564){if(_0x598564!=null){return db[_0xc760('0x26')][_0xc760('0x14')]({'raw':!![],'where':{'CmHopperId':_0x598564['id'],'OrderBy':{'$gt':_0x598564[_0xc760('0x1a')]}},'order':[[_0xc760('0x1a'),_0xc760('0x1b')]]})[_0xc760('0x27')](function(_0x538da8){if(_0x538da8)return activateAdditionalPhone(_0x598564,_0xece4d4[_0xc760('0x17')],_0x538da8,_0xece4d4[_0xc760('0x2a')],_0xece4d4[_0xc760('0x2b')])[_0xc760('0x27')](function(_0x5d0472){_0x3a9337(_0x5d0472);});else{return db[_0xc760('0x26')][_0xc760('0x14')]({'raw':!![],'where':{'CmHopperId':_0x598564['id']},'order':[[_0xc760('0x1a'),'ASC']]})[_0xc760('0x27')](function(_0x376797){if(_0x376797)return activateAdditionalPhone(_0x598564,_0xece4d4[_0xc760('0x17')],_0x376797,_0xece4d4[_0xc760('0x2a')],_0xece4d4[_0xc760('0x2b')])['then'](function(_0x285185){_0x3a9337(_0x285185);});else{_0x3a9337({'id':_0x598564['id'],'phone':''});}})[_0xc760('0x28')](function(_0x4b559a){logger[_0xc760('0x11')]('VerifyAdditionalPhones',_0x4b559a[_0xc760('0x12')],_0xece4d4);_0x33f065(_0x4079dc[_0xc760('0x11')](0x1f4,_0x4b559a[_0xc760('0x12')]));});}})[_0xc760('0x28')](function(_0x3b8169){logger['error'](_0xc760('0x13'),_0x3b8169[_0xc760('0x12')],_0xece4d4);_0x33f065(_0x4079dc[_0xc760('0x11')](0x1f4,_0x3b8169['message']));});}else _0x3a9337(0x1);});});};function activateAdditionalPhone(_0x2eff83,_0x474a7c,_0x387766,_0x3740e9,_0x5dc2f3){return new Promise(function(_0x388ad9,_0xf2c40a){logger['info'](_0xc760('0x13'),_0x387766);var _0x20766c;if(moment()>moment(_0x387766[_0xc760('0x2c')])){_0x20766c=moment()[_0xc760('0x2d')](_0x5dc2f3||0x3,_0xc760('0x2e'));}else{if(_0x387766[_0xc760('0x1a')]==0x0){_0x20766c=moment(_0x387766[_0xc760('0x2c')]);}else{_0x20766c=moment()[_0xc760('0x2d')](_0x5dc2f3||0x3,_0xc760('0x2e'));}}var _0x3fe411={'phone':_0x2eff83[_0xc760('0x2f')],'active':0x0,'OrderBy':_[_0xc760('0x30')](_0x2eff83[_0xc760('0x1a')])?0x0:_0x2eff83[_0xc760('0x1a')],'scheduledat':moment()[_0xc760('0x2d')](_0x3740e9||0x1,'minutes'),'countbusyretry':_0x474a7c[_0xc760('0x1c')],'countcongestionretry':_0x474a7c['countcongestionretry'],'countnoanswerretry':_0x474a7c[_0xc760('0x1e')],'countnosuchnumberretry':_0x474a7c[_0xc760('0x1f')],'countdropretry':_0x474a7c[_0xc760('0x20')],'countabandonedretry':_0x474a7c[_0xc760('0x21')],'countmachineretry':_0x474a7c['countmachineretry'],'countagentrejectretry':_0x474a7c[_0xc760('0x23')],'createdAt':_0x474a7c[_0xc760('0x31')],'updatedAt':_0x474a7c[_0xc760('0x32')]};var _0x2a1e7e={'CmHopperId':_0x2eff83['id'],'phone':_0x387766[_0xc760('0x2f')],'active':0x0,'OrderBy':_[_0xc760('0x30')](_0x387766['OrderBy'])?0x0:_0x387766[_0xc760('0x1a')],'scheduledat':_0x20766c,'countbusyretry':_0x387766[_0xc760('0x1c')],'countcongestionretry':_0x387766[_0xc760('0x1d')],'countnoanswerretry':_0x387766['countnoanswerretry'],'countnosuchnumberretry':_0x474a7c[_0xc760('0x1f')],'countdropretry':_0x474a7c['countdropretry'],'countabandonedretry':_0x474a7c[_0xc760('0x21')],'countmachineretry':_0x474a7c[_0xc760('0x22')],'countagentrejectretry':_0x474a7c['countagentrejectretry'],'createdAt':_0x387766['createdAt'],'updatedAt':_0x387766[_0xc760('0x32')]};logger[_0xc760('0x33')](_0xc760('0x34'),_0x3fe411);logger[_0xc760('0x33')]('additionalToHop',_0x2a1e7e);return db[_0xc760('0x35')][_0xc760('0x36')](function(_0x517245){return db['CmHopperAdditionalPhone'][_0xc760('0x37')](_0x3fe411,{'where':{'id':_0x387766['id']}},{'transaction':_0x517245})[_0xc760('0x27')](function(){return db[_0xc760('0x29')][_0xc760('0x37')](_0x2a1e7e,{'where':{'id':_0x2eff83['id']}},{'transaction':_0x517245});});})[_0xc760('0x27')](function(_0x1be1a2){_0x388ad9({'id':_0x2eff83['id'],'phone':_0x387766[_0xc760('0x2f')]});})[_0xc760('0x28')](function(_0x5c847e){logger[_0xc760('0x11')](_0xc760('0x13'),_0x5c847e[_0xc760('0x12')],req);_0xf2c40a(_this[_0xc760('0x11')](0x1f4,_0x5c847e[_0xc760('0x12')]));});});}exports[_0xc760('0x38')]=function(_0x18b441){var _0x339b66=this;return new Promise(function(_0x4ceb76,_0x25b486){return db[_0xc760('0x29')][_0xc760('0x37')](_0x18b441[_0xc760('0x17')][_0xc760('0x39')],{'where':{'id':_0x18b441[_0xc760('0x17')]['id']}})['then'](function(_0xd1b585){_0x4ceb76(_0xd1b585);})['catch'](function(_0x312e4d){logger[_0xc760('0x11')](_0xc760('0x38'),_0x312e4d[_0xc760('0x12')],_0x18b441);_0x25b486(_0x339b66[_0xc760('0x11')](0x1f4,_0x312e4d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 87d990e..15136c3 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 _0x4b8f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','get','/:id','show','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x57de73,_0x40e396){var _0x4f88c4=function(_0x20e2de){while(--_0x20e2de){_0x57de73['push'](_0x57de73['shift']());}};_0x4f88c4(++_0x40e396);}(_0x4b8f,0x6e));var _0xf4b8=function(_0x54e29f,_0x307d54){_0x54e29f=_0x54e29f-0x0;var _0x392edf=_0x4b8f[_0x54e29f];return _0x392edf;};'use strict';var multer=require('multer');var util=require(_0xf4b8('0x0'));var path=require(_0xf4b8('0x1'));var timeout=require(_0xf4b8('0x2'));var express=require(_0xf4b8('0x3'));var router=express['Router']();var fs_extra=require(_0xf4b8('0x4'));var auth=require(_0xf4b8('0x5'));var interaction=require(_0xf4b8('0x6'));var config=require(_0xf4b8('0x7'));var controller=require(_0xf4b8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf4b8('0x9')]);router[_0xf4b8('0xa')](_0xf4b8('0xb'),auth['isAuthenticated'](),controller[_0xf4b8('0xc')]);router['post']('/',auth[_0xf4b8('0xd')](),controller[_0xf4b8('0xe')]);router[_0xf4b8('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf4b8('0x10')](_0xf4b8('0xb'),auth[_0xf4b8('0xd')](),controller[_0xf4b8('0x11')]);module[_0xf4b8('0x12')]=router; \ No newline at end of file +var _0x08b2=['show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x1332df,_0x51efaa){var _0x4e9e27=function(_0x1f53dc){while(--_0x1f53dc){_0x1332df['push'](_0x1332df['shift']());}};_0x4e9e27(++_0x51efaa);}(_0x08b2,0x16e));var _0x208b=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x08b2[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0x208b('0x0'));var util=require(_0x208b('0x1'));var path=require(_0x208b('0x2'));var timeout=require(_0x208b('0x3'));var express=require(_0x208b('0x4'));var router=express['Router']();var fs_extra=require(_0x208b('0x5'));var auth=require(_0x208b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x208b('0x7'));router[_0x208b('0x8')]('/',auth[_0x208b('0x9')](),controller[_0x208b('0xa')]);router[_0x208b('0x8')](_0x208b('0xb'),auth[_0x208b('0x9')](),controller[_0x208b('0xc')]);router[_0x208b('0xd')]('/',auth[_0x208b('0x9')](),controller[_0x208b('0xe')]);router['put']('/:id',auth[_0x208b('0x9')](),controller['update']);router[_0x208b('0xf')](_0x208b('0xb'),auth[_0x208b('0x9')](),controller[_0x208b('0x10')]);module[_0x208b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 9f13606..a3d6f9b 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 _0x9b8b=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x5022a4,_0x569bd1){var _0x13a7c3=function(_0x401324){while(--_0x401324){_0x5022a4['push'](_0x5022a4['shift']());}};_0x13a7c3(++_0x569bd1);}(_0x9b8b,0x13e));var _0xb9b8=function(_0xd5bd7c,_0x475b10){_0xd5bd7c=_0xd5bd7c-0x0;var _0x44babe=_0x9b8b[_0xd5bd7c];return _0x44babe;};'use strict';var moment=require(_0xb9b8('0x0'));var Sequelize=require(_0xb9b8('0x1'));module[_0xb9b8('0x2')]={'phone':{'type':Sequelize[_0xb9b8('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb9b8('0x4')],'unique':_0xb9b8('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xb9b8('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xb003=['exports','STRING','contactListQueue','INTEGER'];(function(_0x45f435,_0x367764){var _0x33f257=function(_0x5b22e5){while(--_0x5b22e5){_0x45f435['push'](_0x45f435['shift']());}};_0x33f257(++_0x367764);}(_0xb003,0x1ac));var _0x3b00=function(_0x31f22e,_0x434db1){_0x31f22e=_0x31f22e-0x0;var _0x16e1b0=_0xb003[_0x31f22e];return _0x16e1b0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3b00('0x0')]={'phone':{'type':Sequelize[_0x3b00('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x3b00('0x2')},'ListId':{'type':Sequelize[_0x3b00('0x3')],'unique':_0x3b00('0x2')},'VoiceQueueId':{'type':Sequelize[_0x3b00('0x3')],'unique':_0x3b00('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6158131..b8ce49f 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 _0x9d9b=['lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmHopperBlack','count','catch','show','params','includeAll','include','find','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs'];(function(_0x3282fd,_0x538daf){var _0x24d856=function(_0x25742f){while(--_0x25742f){_0x3282fd['push'](_0x3282fd['shift']());}};_0x24d856(++_0x538daf);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x532106,_0x12f862){_0x532106=_0x532106-0x0;var _0x46b6cd=_0x9d9b[_0x532106];return _0x46b6cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9d9('0x0'));var rimraf=require(_0xb9d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9d9('0x2'));var rp=require('request-promise');var moment=require(_0xb9d9('0x3'));var BPromise=require(_0xb9d9('0x4'));var Mustache=require(_0xb9d9('0x5'));var util=require('util');var path=require(_0xb9d9('0x6'));var sox=require('sox');var csv=require(_0xb9d9('0x7'));var ejs=require(_0xb9d9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9d9('0x9'));var squel=require(_0xb9d9('0xa'));var crypto=require(_0xb9d9('0xb'));var jsforce=require(_0xb9d9('0xc'));var deskjs=require(_0xb9d9('0xd'));var toCsv=require(_0xb9d9('0x7'));var querystring=require(_0xb9d9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb9d9('0xf'));var hardwareService=require(_0xb9d9('0x10'));var logger=require(_0xb9d9('0x11'))('api');var utils=require(_0xb9d9('0x12'));var config=require(_0xb9d9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9d9('0x14'))['db'];function respondWithStatusCode(_0x5e3782,_0x1245e0){_0x1245e0=_0x1245e0||0xcc;return function(_0x3ad511){if(_0x3ad511){return _0x5e3782[_0xb9d9('0x15')](_0x1245e0);}return _0x5e3782[_0xb9d9('0x16')](_0x1245e0)[_0xb9d9('0x17')]();};}function respondWithResult(_0x1d26cf,_0x4f0c77){_0x4f0c77=_0x4f0c77||0xc8;return function(_0xfc9733){if(_0xfc9733){return _0x1d26cf['status'](_0x4f0c77)['json'](_0xfc9733);}};}function respondWithFilteredResult(_0x3db648,_0x2c9039){return function(_0x3909ab){if(_0x3909ab){var _0x168f07=_0x3909ab['count'],_0x5c6480=_0x2c9039['offset'],_0x5ab03a=_0x2c9039[_0xb9d9('0x18')]+_0x2c9039[_0xb9d9('0x19')],_0x1ffb39;if(_0x5ab03a>=_0x168f07){_0x5ab03a=_0x168f07;_0x1ffb39=0xc8;}else{_0x1ffb39=0xce;}_0x3db648[_0xb9d9('0x16')](_0x1ffb39);return _0x3db648['set'](_0xb9d9('0x1a'),_0x5c6480+'-'+_0x5ab03a+'/'+_0x168f07)[_0xb9d9('0x1b')](_0x3909ab);}return null;};}function patchUpdates(_0x493552){return function(_0x31eafd){try{jsonpatch[_0xb9d9('0x1c')](_0x31eafd,_0x493552,!![]);}catch(_0x491c1a){return BPromise[_0xb9d9('0x1d')](_0x491c1a);}return _0x31eafd[_0xb9d9('0x1e')]();};}function saveUpdates(_0x50f0ec,_0x39f7e1){return function(_0x42ca87){if(_0x42ca87){return _0x42ca87[_0xb9d9('0x1f')](_0x50f0ec)[_0xb9d9('0x20')](function(_0x288ccd){return _0x288ccd;});}return null;};}function removeEntity(_0x362104,_0x4c4230){return function(_0x46d4e8){if(_0x46d4e8){return _0x46d4e8[_0xb9d9('0x21')]()['then'](function(){_0x362104[_0xb9d9('0x16')](0xcc)[_0xb9d9('0x17')]();});}};}function handleEntityNotFound(_0x43bcab,_0x1bc364){return function(_0x543d1a){if(!_0x543d1a){_0x43bcab[_0xb9d9('0x15')](0x194);}return _0x543d1a;};}function handleError(_0xb641e9,_0x6fa6af){_0x6fa6af=_0x6fa6af||0x1f4;return function(_0x436cb7){logger[_0xb9d9('0x22')](_0x436cb7[_0xb9d9('0x23')]);if(_0x436cb7['name']){delete _0x436cb7[_0xb9d9('0x24')];}_0xb641e9[_0xb9d9('0x16')](_0x6fa6af)[_0xb9d9('0x25')](_0x436cb7);};}exports['index']=function(_0x2a30fe,_0x1743b1){var _0x63a35e={},_0x290c01={},_0x3caaaf={'count':0x0,'rows':[]};var _0x402968=_[_0xb9d9('0x26')](db['CmHopperBlack'][_0xb9d9('0x27')],function(_0x3e79ef){return{'name':_0x3e79ef[_0xb9d9('0x28')],'type':_0x3e79ef[_0xb9d9('0x29')][_0xb9d9('0x2a')]};});_0x290c01[_0xb9d9('0x2b')]=_['map'](_0x402968,_0xb9d9('0x24'));_0x290c01[_0xb9d9('0x2c')]=_[_0xb9d9('0x2d')](_0x2a30fe[_0xb9d9('0x2c')]);_0x290c01['filters']=_[_0xb9d9('0x2e')](_0x290c01[_0xb9d9('0x2b')],_0x290c01[_0xb9d9('0x2c')]);_0x63a35e[_0xb9d9('0x2f')]=_[_0xb9d9('0x2e')](_0x290c01[_0xb9d9('0x2b')],qs['fields'](_0x2a30fe['query'][_0xb9d9('0x30')]));_0x63a35e['attributes']=_0x63a35e[_0xb9d9('0x2f')][_0xb9d9('0x31')]?_0x63a35e[_0xb9d9('0x2f')]:_0x290c01['model'];if(!_0x2a30fe[_0xb9d9('0x2c')][_0xb9d9('0x32')](_0xb9d9('0x33'))){_0x63a35e[_0xb9d9('0x19')]=qs[_0xb9d9('0x19')](_0x2a30fe[_0xb9d9('0x2c')][_0xb9d9('0x19')]);_0x63a35e[_0xb9d9('0x18')]=qs[_0xb9d9('0x18')](_0x2a30fe['query']['offset']);}_0x63a35e['order']=qs[_0xb9d9('0x34')](_0x2a30fe[_0xb9d9('0x2c')][_0xb9d9('0x34')]);_0x63a35e[_0xb9d9('0x35')]=qs[_0xb9d9('0x36')](_[_0xb9d9('0x37')](_0x2a30fe['query'],_0x290c01['filters']),_0x402968);if(_0x2a30fe['query'][_0xb9d9('0x38')]){_0x63a35e[_0xb9d9('0x35')]=_[_0xb9d9('0x39')](_0x63a35e[_0xb9d9('0x35')],{'$or':_[_0xb9d9('0x26')](_0x402968,function(_0x1f351d){if(_0x1f351d[_0xb9d9('0x29')]!==_0xb9d9('0x3a')){var _0x296d77={};_0x296d77[_0x1f351d[_0xb9d9('0x24')]]={'$like':'%'+_0x2a30fe[_0xb9d9('0x2c')][_0xb9d9('0x38')]+'%'};return _0x296d77;}})});}_0x63a35e=_[_0xb9d9('0x39')]({},_0x63a35e,_0x2a30fe[_0xb9d9('0x3b')]);var _0x20c9e5={'where':_0x63a35e[_0xb9d9('0x35')]};return db[_0xb9d9('0x3c')][_0xb9d9('0x3d')](_0x20c9e5)[_0xb9d9('0x20')](function(_0x4d3cea){_0x3caaaf[_0xb9d9('0x3d')]=_0x4d3cea;if(_0x2a30fe[_0xb9d9('0x2c')]['includeAll']){_0x63a35e['include']=[{'all':!![]}];}return db[_0xb9d9('0x3c')]['findAll'](_0x63a35e);})[_0xb9d9('0x20')](function(_0x4c63e3){_0x3caaaf['rows']=_0x4c63e3;return _0x3caaaf;})[_0xb9d9('0x20')](respondWithFilteredResult(_0x1743b1,_0x63a35e))[_0xb9d9('0x3e')](handleError(_0x1743b1,null));};exports[_0xb9d9('0x3f')]=function(_0x2acfe8,_0x326c00){var _0x2de11f={'raw':!![],'where':{'id':_0x2acfe8[_0xb9d9('0x40')]['id']}},_0x403ea5={};_0x403ea5['model']=_['keys'](db[_0xb9d9('0x3c')][_0xb9d9('0x27')]);_0x403ea5[_0xb9d9('0x2c')]=_['keys'](_0x2acfe8[_0xb9d9('0x2c')]);_0x403ea5[_0xb9d9('0x36')]=_[_0xb9d9('0x2e')](_0x403ea5[_0xb9d9('0x2b')],_0x403ea5[_0xb9d9('0x2c')]);_0x2de11f[_0xb9d9('0x2f')]=_[_0xb9d9('0x2e')](_0x403ea5[_0xb9d9('0x2b')],qs['fields'](_0x2acfe8[_0xb9d9('0x2c')][_0xb9d9('0x30')]));_0x2de11f[_0xb9d9('0x2f')]=_0x2de11f[_0xb9d9('0x2f')][_0xb9d9('0x31')]?_0x2de11f[_0xb9d9('0x2f')]:_0x403ea5[_0xb9d9('0x2b')];if(_0x2acfe8[_0xb9d9('0x2c')][_0xb9d9('0x41')]){_0x2de11f[_0xb9d9('0x42')]=[{'all':!![]}];}_0x2de11f=_[_0xb9d9('0x39')]({},_0x2de11f,_0x2acfe8[_0xb9d9('0x3b')]);return db[_0xb9d9('0x3c')][_0xb9d9('0x43')](_0x2de11f)[_0xb9d9('0x20')](handleEntityNotFound(_0x326c00,null))[_0xb9d9('0x20')](respondWithResult(_0x326c00,null))[_0xb9d9('0x3e')](handleError(_0x326c00,null));};exports['update']=function(_0x4717cd,_0x372853){if(_0x4717cd['body']['id']){delete _0x4717cd[_0xb9d9('0x44')]['id'];}return db[_0xb9d9('0x3c')][_0xb9d9('0x43')]({'where':{'id':_0x4717cd[_0xb9d9('0x40')]['id']}})[_0xb9d9('0x20')](handleEntityNotFound(_0x372853,null))[_0xb9d9('0x20')](saveUpdates(_0x4717cd['body'],null))[_0xb9d9('0x20')](respondWithResult(_0x372853,null))[_0xb9d9('0x3e')](handleError(_0x372853,null));};exports[_0xb9d9('0x21')]=function(_0x30e3b1,_0x53f7cb){return db[_0xb9d9('0x3c')][_0xb9d9('0x43')]({'where':{'id':_0x30e3b1[_0xb9d9('0x40')]['id']}})['then'](handleEntityNotFound(_0x53f7cb,null))[_0xb9d9('0x20')](removeEntity(_0x53f7cb,null))[_0xb9d9('0x3e')](handleError(_0x53f7cb,null));};exports[_0xb9d9('0x45')]=function(_0x445f17,_0x1be7ee){return db[_0xb9d9('0x3c')]['describe']()[_0xb9d9('0x20')](respondWithResult(_0x1be7ee,null))['catch'](handleError(_0x1be7ee,null));}; \ No newline at end of file +var _0xb01a=['json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1b1223,_0x34f3ce){var _0x1f399a=function(_0x1d88b9){while(--_0x1d88b9){_0x1b1223['push'](_0x1b1223['shift']());}};_0x1f399a(++_0x34f3ce);}(_0xb01a,0x1a1));var _0xab01=function(_0x56039b,_0x3de8d8){_0x56039b=_0x56039b-0x0;var _0xc90792=_0xb01a[_0x56039b];return _0xc90792;};'use strict';var pdf=require(_0xab01('0x0'));var emlformat=require(_0xab01('0x1'));var rimraf=require(_0xab01('0x2'));var zipdir=require(_0xab01('0x3'));var jsonpatch=require(_0xab01('0x4'));var rp=require(_0xab01('0x5'));var moment=require(_0xab01('0x6'));var BPromise=require(_0xab01('0x7'));var Mustache=require(_0xab01('0x8'));var util=require(_0xab01('0x9'));var path=require(_0xab01('0xa'));var sox=require(_0xab01('0xb'));var csv=require(_0xab01('0xc'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab01('0xd'));var _=require(_0xab01('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xab01('0xf'));var deskjs=require(_0xab01('0x10'));var toCsv=require('to-csv');var querystring=require(_0xab01('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xab01('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xab01('0x13'));var hardwareService=require(_0xab01('0x14'));var logger=require('../../config/logger')(_0xab01('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xab01('0x16'));var db=require(_0xab01('0x17'))['db'];function respondWithStatusCode(_0x1ededa,_0xe9d23c){_0xe9d23c=_0xe9d23c||0xcc;return function(_0x449402){if(_0x449402){return _0x1ededa[_0xab01('0x18')](_0xe9d23c);}return _0x1ededa[_0xab01('0x19')](_0xe9d23c)[_0xab01('0x1a')]();};}function respondWithResult(_0x509ceb,_0x4812c6){_0x4812c6=_0x4812c6||0xc8;return function(_0x512124){if(_0x512124){return _0x509ceb['status'](_0x4812c6)[_0xab01('0x1b')](_0x512124);}};}function respondWithFilteredResult(_0x4c0557,_0x2bfa8a){return function(_0x2d9c23){if(_0x2d9c23){var _0x26af11=_0x2d9c23['count'],_0x17dddb=_0x2bfa8a[_0xab01('0x1c')],_0x54bd09=_0x2bfa8a[_0xab01('0x1c')]+_0x2bfa8a['limit'],_0x3bea90;if(_0x54bd09>=_0x26af11){_0x54bd09=_0x26af11;_0x3bea90=0xc8;}else{_0x3bea90=0xce;}_0x4c0557['status'](_0x3bea90);return _0x4c0557[_0xab01('0x1d')](_0xab01('0x1e'),_0x17dddb+'-'+_0x54bd09+'/'+_0x26af11)[_0xab01('0x1b')](_0x2d9c23);}return null;};}function patchUpdates(_0x1d5af2){return function(_0x290d30){try{jsonpatch[_0xab01('0x1f')](_0x290d30,_0x1d5af2,!![]);}catch(_0x196254){return BPromise[_0xab01('0x20')](_0x196254);}return _0x290d30[_0xab01('0x21')]();};}function saveUpdates(_0x331daf,_0x50d0bd){return function(_0x9208cc){if(_0x9208cc){return _0x9208cc[_0xab01('0x22')](_0x331daf)[_0xab01('0x23')](function(_0xac3a88){return _0xac3a88;});}return null;};}function removeEntity(_0x405c93,_0x180344){return function(_0x380176){if(_0x380176){return _0x380176[_0xab01('0x24')]()['then'](function(){_0x405c93[_0xab01('0x19')](0xcc)[_0xab01('0x1a')]();});}};}function handleEntityNotFound(_0x27b430,_0x343ae6){return function(_0x134c46){if(!_0x134c46){_0x27b430[_0xab01('0x18')](0x194);}return _0x134c46;};}function handleError(_0x2e4405,_0x55831d){_0x55831d=_0x55831d||0x1f4;return function(_0x1efebe){logger[_0xab01('0x25')](_0x1efebe[_0xab01('0x26')]);if(_0x1efebe[_0xab01('0x27')]){delete _0x1efebe[_0xab01('0x27')];}_0x2e4405[_0xab01('0x19')](_0x55831d)[_0xab01('0x28')](_0x1efebe);};}exports['index']=function(_0xd908be,_0x3533e5){var _0x34908d={},_0x36c53f={},_0x3bb7fc={'count':0x0,'rows':[]};var _0x409fa1=_['map'](db[_0xab01('0x29')][_0xab01('0x2a')],function(_0x4a22c0){return{'name':_0x4a22c0[_0xab01('0x2b')],'type':_0x4a22c0[_0xab01('0x2c')][_0xab01('0x2d')]};});_0x36c53f[_0xab01('0x2e')]=_[_0xab01('0x2f')](_0x409fa1,_0xab01('0x27'));_0x36c53f[_0xab01('0x30')]=_[_0xab01('0x31')](_0xd908be['query']);_0x36c53f[_0xab01('0x32')]=_[_0xab01('0x33')](_0x36c53f['model'],_0x36c53f[_0xab01('0x30')]);_0x34908d[_0xab01('0x34')]=_[_0xab01('0x33')](_0x36c53f[_0xab01('0x2e')],qs[_0xab01('0x35')](_0xd908be[_0xab01('0x30')]['fields']));_0x34908d[_0xab01('0x34')]=_0x34908d[_0xab01('0x34')][_0xab01('0x36')]?_0x34908d[_0xab01('0x34')]:_0x36c53f[_0xab01('0x2e')];if(!_0xd908be[_0xab01('0x30')][_0xab01('0x37')]('nolimit')){_0x34908d['limit']=qs['limit'](_0xd908be[_0xab01('0x30')][_0xab01('0x38')]);_0x34908d[_0xab01('0x1c')]=qs[_0xab01('0x1c')](_0xd908be[_0xab01('0x30')][_0xab01('0x1c')]);}_0x34908d[_0xab01('0x39')]=qs[_0xab01('0x3a')](_0xd908be[_0xab01('0x30')][_0xab01('0x3a')]);_0x34908d[_0xab01('0x3b')]=qs[_0xab01('0x32')](_[_0xab01('0x3c')](_0xd908be[_0xab01('0x30')],_0x36c53f[_0xab01('0x32')]),_0x409fa1);if(_0xd908be[_0xab01('0x30')]['filter']){_0x34908d['where']=_[_0xab01('0x3d')](_0x34908d[_0xab01('0x3b')],{'$or':_['map'](_0x409fa1,function(_0x1aa09d){if(_0x1aa09d[_0xab01('0x2c')]!==_0xab01('0x3e')){var _0x4e6936={};_0x4e6936[_0x1aa09d[_0xab01('0x27')]]={'$like':'%'+_0xd908be['query']['filter']+'%'};return _0x4e6936;}})});}_0x34908d=_[_0xab01('0x3d')]({},_0x34908d,_0xd908be[_0xab01('0x3f')]);var _0x595017={'where':_0x34908d[_0xab01('0x3b')]};return db[_0xab01('0x29')]['count'](_0x595017)[_0xab01('0x23')](function(_0x211cb8){_0x3bb7fc[_0xab01('0x40')]=_0x211cb8;if(_0xd908be[_0xab01('0x30')][_0xab01('0x41')]){_0x34908d[_0xab01('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xab01('0x43')](_0x34908d);})[_0xab01('0x23')](function(_0x28f407){_0x3bb7fc[_0xab01('0x44')]=_0x28f407;return _0x3bb7fc;})[_0xab01('0x23')](respondWithFilteredResult(_0x3533e5,_0x34908d))['catch'](handleError(_0x3533e5,null));};exports['show']=function(_0x4ddaff,_0x3132d5){var _0x4095bb={'raw':!![],'where':{'id':_0x4ddaff[_0xab01('0x45')]['id']}},_0x520182={};_0x520182[_0xab01('0x2e')]=_[_0xab01('0x31')](db[_0xab01('0x29')][_0xab01('0x2a')]);_0x520182[_0xab01('0x30')]=_[_0xab01('0x31')](_0x4ddaff[_0xab01('0x30')]);_0x520182[_0xab01('0x32')]=_[_0xab01('0x33')](_0x520182[_0xab01('0x2e')],_0x520182[_0xab01('0x30')]);_0x4095bb[_0xab01('0x34')]=_[_0xab01('0x33')](_0x520182[_0xab01('0x2e')],qs[_0xab01('0x35')](_0x4ddaff[_0xab01('0x30')]['fields']));_0x4095bb['attributes']=_0x4095bb[_0xab01('0x34')][_0xab01('0x36')]?_0x4095bb[_0xab01('0x34')]:_0x520182[_0xab01('0x2e')];if(_0x4ddaff[_0xab01('0x30')][_0xab01('0x41')]){_0x4095bb['include']=[{'all':!![]}];}_0x4095bb=_[_0xab01('0x3d')]({},_0x4095bb,_0x4ddaff[_0xab01('0x3f')]);return db['CmHopperBlack'][_0xab01('0x46')](_0x4095bb)[_0xab01('0x23')](handleEntityNotFound(_0x3132d5,null))[_0xab01('0x23')](respondWithResult(_0x3132d5,null))['catch'](handleError(_0x3132d5,null));};exports[_0xab01('0x22')]=function(_0xdcc33,_0x192a28){if(_0xdcc33[_0xab01('0x47')]['id']){delete _0xdcc33[_0xab01('0x47')]['id'];}return db['CmHopperBlack'][_0xab01('0x46')]({'where':{'id':_0xdcc33['params']['id']}})[_0xab01('0x23')](handleEntityNotFound(_0x192a28,null))[_0xab01('0x23')](saveUpdates(_0xdcc33[_0xab01('0x47')],null))['then'](respondWithResult(_0x192a28,null))[_0xab01('0x48')](handleError(_0x192a28,null));};exports[_0xab01('0x24')]=function(_0x46e255,_0x1b11c4){return db['CmHopperBlack'][_0xab01('0x46')]({'where':{'id':_0x46e255[_0xab01('0x45')]['id']}})[_0xab01('0x23')](handleEntityNotFound(_0x1b11c4,null))[_0xab01('0x23')](removeEntity(_0x1b11c4,null))[_0xab01('0x48')](handleError(_0x1b11c4,null));};exports['describe']=function(_0x256f87,_0x57ac48){return db['CmHopperBlack'][_0xab01('0x49')]()[_0xab01('0x23')](respondWithResult(_0x57ac48,null))[_0xab01('0x48')](handleError(_0x57ac48,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e239561..58dfb7e 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 _0xfcf7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x53b0a3,_0x9b10c1){var _0x460fa7=function(_0x541b59){while(--_0x541b59){_0x53b0a3['push'](_0x53b0a3['shift']());}};_0x460fa7(++_0x9b10c1);}(_0xfcf7,0x1d3));var _0x7fcf=function(_0x2ab0c6,_0x2d5cc1){_0x2ab0c6=_0x2ab0c6-0x0;var _0x4a652b=_0xfcf7[_0x2ab0c6];return _0x4a652b;};'use strict';var _=require(_0x7fcf('0x0'));var util=require(_0x7fcf('0x1'));var logger=require(_0x7fcf('0x2'))(_0x7fcf('0x3'));var moment=require(_0x7fcf('0x4'));var BPromise=require(_0x7fcf('0x5'));var rp=require(_0x7fcf('0x6'));var fs=require('fs');var path=require(_0x7fcf('0x7'));var rimraf=require(_0x7fcf('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x7fcf('0x9')]=function(_0x97718d,_0x2539b9){return _0x97718d['define'](_0x7fcf('0xa'),attributes,{'tableName':_0x7fcf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdae=['exports','CmHopperBlack','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbdae,0x17e));var _0xebda=function(_0x8d6c25,_0x25ac3b){_0x8d6c25=_0x8d6c25-0x0;var _0x5dfbbf=_0xbdae[_0x8d6c25];return _0x5dfbbf;};'use strict';var _=require(_0xebda('0x0'));var util=require('util');var logger=require(_0xebda('0x1'))('api');var moment=require(_0xebda('0x2'));var BPromise=require(_0xebda('0x3'));var rp=require(_0xebda('0x4'));var fs=require('fs');var path=require(_0xebda('0x5'));var rimraf=require('rimraf');var config=require(_0xebda('0x6'));var attributes=require(_0xebda('0x7'));module[_0xebda('0x8')]=function(_0x44bf8d,_0x1f6ea0){return _0x44bf8d['define'](_0xebda('0x9'),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 76443ff..a459e1d 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 _0xddf4=['message','result','catch','CmHopperBlack','findAll','options','raw','attributes','limit','include','model','map','GetCmHopperBlack','UpdateCmHopperBlack','update','body','where','destroy','DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xddf4,0xe5));var _0x4ddf=function(_0x3b599c,_0x28ba49){_0x3b599c=_0x3b599c-0x0;var _0x296d60=_0xddf4[_0x3b599c];return _0x296d60;};'use strict';var _=require(_0x4ddf('0x0'));var util=require(_0x4ddf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4ddf('0x2'));var fs=require('fs');var Redis=require(_0x4ddf('0x3'));var db=require(_0x4ddf('0x4'))['db'];var utils=require(_0x4ddf('0x5'));var logger=require(_0x4ddf('0x6'))(_0x4ddf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4ddf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x597eb7,_0x5c2a56,_0x513937){return new BPromise(function(_0x5b2983,_0xaf3ab6){return client['request'](_0x597eb7,_0x513937)[_0x4ddf('0x9')](function(_0x1274db){logger[_0x4ddf('0xa')](_0x4ddf('0xb'),_0x5c2a56,_0x4ddf('0xc'));logger['debug'](_0x4ddf('0xd'),_0x5c2a56,'request\x20sent',JSON[_0x4ddf('0xe')](_0x1274db));if(_0x1274db['error']){if(_0x1274db[_0x4ddf('0xf')]['code']===0x1f4){logger[_0x4ddf('0xf')](_0x4ddf('0xb'),_0x5c2a56,_0x1274db[_0x4ddf('0xf')][_0x4ddf('0x10')]);return _0xaf3ab6(_0x1274db[_0x4ddf('0xf')][_0x4ddf('0x10')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5c2a56,_0x1274db[_0x4ddf('0xf')][_0x4ddf('0x10')]);return _0x5b2983(_0x1274db[_0x4ddf('0xf')][_0x4ddf('0x10')]);}else{logger['info'](_0x4ddf('0xb'),_0x5c2a56,_0x4ddf('0xc'));_0x5b2983(_0x1274db[_0x4ddf('0x11')][_0x4ddf('0x10')]);}})[_0x4ddf('0x12')](function(_0x34e206){logger[_0x4ddf('0xf')](_0x4ddf('0xb'),_0x5c2a56,_0x34e206);_0xaf3ab6(_0x34e206);});});}exports['GetCmHopperBlack']=function(_0x5b01b4){var _0xf55cac=this;return new Promise(function(_0x31e273,_0x171e5c){return db[_0x4ddf('0x13')][_0x4ddf('0x14')]({'raw':_0x5b01b4[_0x4ddf('0x15')]?_0x5b01b4[_0x4ddf('0x15')][_0x4ddf('0x16')]===undefined?!![]:![]:!![],'where':_0x5b01b4[_0x4ddf('0x15')]?_0x5b01b4['options']['where']||null:null,'attributes':_0x5b01b4[_0x4ddf('0x15')]?_0x5b01b4['options'][_0x4ddf('0x17')]||null:null,'limit':_0x5b01b4[_0x4ddf('0x15')]?_0x5b01b4[_0x4ddf('0x15')][_0x4ddf('0x18')]||null:null,'include':_0x5b01b4['options']?_0x5b01b4[_0x4ddf('0x15')][_0x4ddf('0x19')]?_['map'](_0x5b01b4[_0x4ddf('0x15')][_0x4ddf('0x19')],function(_0x3a0300){return{'model':db[_0x3a0300[_0x4ddf('0x1a')]],'as':_0x3a0300['as'],'attributes':_0x3a0300[_0x4ddf('0x17')],'include':_0x3a0300['include']?_[_0x4ddf('0x1b')](_0x3a0300[_0x4ddf('0x19')],function(_0x200e63){return{'model':db[_0x200e63[_0x4ddf('0x1a')]],'as':_0x200e63['as'],'attributes':_0x200e63[_0x4ddf('0x17')],'include':_0x200e63['include']?_[_0x4ddf('0x1b')](_0x200e63[_0x4ddf('0x19')],function(_0x1c0b19){return{'model':db[_0x1c0b19['model']],'as':_0x1c0b19['as'],'attributes':_0x1c0b19[_0x4ddf('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4ddf('0x9')](function(_0x494324){logger[_0x4ddf('0xa')](_0x4ddf('0x1c'),_0x5b01b4);logger['debug'](_0x4ddf('0x1c'),_0x5b01b4,JSON[_0x4ddf('0xe')](_0x494324));_0x31e273(_0x494324);})[_0x4ddf('0x12')](function(_0x16f1cd){logger[_0x4ddf('0xf')](_0x4ddf('0x1c'),_0x16f1cd[_0x4ddf('0x10')],_0x5b01b4);_0x171e5c(_0xf55cac['error'](0x1f4,_0x16f1cd[_0x4ddf('0x10')]));});});};exports[_0x4ddf('0x1d')]=function(_0x15bb55){var _0xd5faf0=this;return new Promise(function(_0x4bac66,_0x15c4ab){return db[_0x4ddf('0x13')][_0x4ddf('0x1e')](_0x15bb55[_0x4ddf('0x1f')],{'raw':_0x15bb55[_0x4ddf('0x15')]?_0x15bb55['options'][_0x4ddf('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15bb55[_0x4ddf('0x15')]?_0x15bb55[_0x4ddf('0x15')][_0x4ddf('0x20')]||null:null,'attributes':_0x15bb55[_0x4ddf('0x15')]?_0x15bb55[_0x4ddf('0x15')][_0x4ddf('0x17')]||null:null,'limit':_0x15bb55[_0x4ddf('0x15')]?_0x15bb55[_0x4ddf('0x15')][_0x4ddf('0x18')]||null:null})[_0x4ddf('0x9')](function(_0x1c041f){logger[_0x4ddf('0xa')]('UpdateCmHopperBlack',_0x15bb55);logger['debug'](_0x4ddf('0x1d'),_0x15bb55,JSON[_0x4ddf('0xe')](_0x1c041f));_0x4bac66(_0x1c041f);})[_0x4ddf('0x12')](function(_0xae5a03){logger[_0x4ddf('0xf')](_0x4ddf('0x1d'),_0xae5a03['message'],_0x15bb55);_0x15c4ab(_0xd5faf0[_0x4ddf('0xf')](0x1f4,_0xae5a03[_0x4ddf('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x42c892){var _0x5accce=this;return new Promise(function(_0x4ee214,_0x5f37b8){return db['CmHopperBlack'][_0x4ddf('0x21')]({'where':_0x42c892[_0x4ddf('0x15')]?_0x42c892[_0x4ddf('0x15')][_0x4ddf('0x20')]||null:null})['then'](function(_0x13404f){logger[_0x4ddf('0xa')](_0x4ddf('0x22'),_0x42c892);logger['debug'](_0x4ddf('0x22'),_0x42c892,JSON['stringify'](_0x13404f));_0x4ee214(_0x13404f);})['catch'](function(_0x3d4e13){logger['error']('DestroyCmHopperBlack',_0x3d4e13['message'],_0x42c892);_0x5f37b8(_0x5accce[_0x4ddf('0xf')](0x1f4,_0x3d4e13[_0x4ddf('0x10')]));});});}; \ No newline at end of file +var _0x4bab=['jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','attributes','limit','include','model','map','GetCmHopperBlack','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x288d79,_0x4c81da){var _0x280cd2=function(_0x3dbd05){while(--_0x3dbd05){_0x288d79['push'](_0x288d79['shift']());}};_0x280cd2(++_0x4c81da);}(_0x4bab,0x70));var _0xb4ba=function(_0x13ef4b,_0x144a54){_0x13ef4b=_0x13ef4b-0x0;var _0x40f53a=_0x4bab[_0x13ef4b];return _0x40f53a;};'use strict';var _=require(_0xb4ba('0x0'));var util=require(_0xb4ba('0x1'));var moment=require(_0xb4ba('0x2'));var BPromise=require(_0xb4ba('0x3'));var rs=require(_0xb4ba('0x4'));var fs=require('fs');var Redis=require(_0xb4ba('0x5'));var db=require(_0xb4ba('0x6'))['db'];var utils=require(_0xb4ba('0x7'));var logger=require(_0xb4ba('0x8'))(_0xb4ba('0x9'));var config=require(_0xb4ba('0xa'));var jayson=require(_0xb4ba('0xb'));var client=jayson[_0xb4ba('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34bd47,_0x39df45,_0xac1bf0){return new BPromise(function(_0x3de95c,_0x417b47){return client[_0xb4ba('0xd')](_0x34bd47,_0xac1bf0)[_0xb4ba('0xe')](function(_0x5029c9){logger[_0xb4ba('0xf')](_0xb4ba('0x10'),_0x39df45,_0xb4ba('0x11'));logger[_0xb4ba('0x12')](_0xb4ba('0x13'),_0x39df45,_0xb4ba('0x11'),JSON[_0xb4ba('0x14')](_0x5029c9));if(_0x5029c9['error']){if(_0x5029c9[_0xb4ba('0x15')][_0xb4ba('0x16')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x39df45,_0x5029c9[_0xb4ba('0x15')][_0xb4ba('0x17')]);return _0x417b47(_0x5029c9[_0xb4ba('0x15')]['message']);}logger[_0xb4ba('0x15')](_0xb4ba('0x10'),_0x39df45,_0x5029c9[_0xb4ba('0x15')][_0xb4ba('0x17')]);return _0x3de95c(_0x5029c9[_0xb4ba('0x15')][_0xb4ba('0x17')]);}else{logger['info'](_0xb4ba('0x10'),_0x39df45,_0xb4ba('0x11'));_0x3de95c(_0x5029c9[_0xb4ba('0x18')]['message']);}})[_0xb4ba('0x19')](function(_0x887ddb){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x39df45,_0x887ddb);_0x417b47(_0x887ddb);});});}exports['GetCmHopperBlack']=function(_0x6c14c5){var _0x220616=this;return new Promise(function(_0x470624,_0x5befd4){return db[_0xb4ba('0x1a')][_0xb4ba('0x1b')]({'raw':_0x6c14c5[_0xb4ba('0x1c')]?_0x6c14c5[_0xb4ba('0x1c')][_0xb4ba('0x1d')]===undefined?!![]:![]:!![],'where':_0x6c14c5['options']?_0x6c14c5[_0xb4ba('0x1c')]['where']||null:null,'attributes':_0x6c14c5[_0xb4ba('0x1c')]?_0x6c14c5['options'][_0xb4ba('0x1e')]||null:null,'limit':_0x6c14c5[_0xb4ba('0x1c')]?_0x6c14c5[_0xb4ba('0x1c')][_0xb4ba('0x1f')]||null:null,'include':_0x6c14c5[_0xb4ba('0x1c')]?_0x6c14c5[_0xb4ba('0x1c')]['include']?_['map'](_0x6c14c5[_0xb4ba('0x1c')][_0xb4ba('0x20')],function(_0x524c97){return{'model':db[_0x524c97[_0xb4ba('0x21')]],'as':_0x524c97['as'],'attributes':_0x524c97[_0xb4ba('0x1e')],'include':_0x524c97[_0xb4ba('0x20')]?_[_0xb4ba('0x22')](_0x524c97[_0xb4ba('0x20')],function(_0x562292){return{'model':db[_0x562292[_0xb4ba('0x21')]],'as':_0x562292['as'],'attributes':_0x562292[_0xb4ba('0x1e')],'include':_0x562292[_0xb4ba('0x20')]?_[_0xb4ba('0x22')](_0x562292[_0xb4ba('0x20')],function(_0x1f95b8){return{'model':db[_0x1f95b8[_0xb4ba('0x21')]],'as':_0x1f95b8['as'],'attributes':_0x1f95b8[_0xb4ba('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18dd64){logger[_0xb4ba('0xf')]('GetCmHopperBlack',_0x6c14c5);logger[_0xb4ba('0x12')](_0xb4ba('0x23'),_0x6c14c5,JSON[_0xb4ba('0x14')](_0x18dd64));_0x470624(_0x18dd64);})['catch'](function(_0x2484ca){logger[_0xb4ba('0x15')](_0xb4ba('0x23'),_0x2484ca[_0xb4ba('0x17')],_0x6c14c5);_0x5befd4(_0x220616[_0xb4ba('0x15')](0x1f4,_0x2484ca[_0xb4ba('0x17')]));});});};exports['UpdateCmHopperBlack']=function(_0x248862){var _0x5863fa=this;return new Promise(function(_0x539c16,_0x13fd19){return db['CmHopperBlack']['update'](_0x248862[_0xb4ba('0x24')],{'raw':_0x248862[_0xb4ba('0x1c')]?_0x248862[_0xb4ba('0x1c')][_0xb4ba('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x248862[_0xb4ba('0x1c')]?_0x248862[_0xb4ba('0x1c')]['where']||null:null,'attributes':_0x248862['options']?_0x248862[_0xb4ba('0x1c')][_0xb4ba('0x1e')]||null:null,'limit':_0x248862[_0xb4ba('0x1c')]?_0x248862[_0xb4ba('0x1c')][_0xb4ba('0x1f')]||null:null})['then'](function(_0x37df0f){logger[_0xb4ba('0xf')](_0xb4ba('0x25'),_0x248862);logger[_0xb4ba('0x12')]('UpdateCmHopperBlack',_0x248862,JSON[_0xb4ba('0x14')](_0x37df0f));_0x539c16(_0x37df0f);})[_0xb4ba('0x19')](function(_0x516019){logger[_0xb4ba('0x15')](_0xb4ba('0x25'),_0x516019['message'],_0x248862);_0x13fd19(_0x5863fa[_0xb4ba('0x15')](0x1f4,_0x516019['message']));});});};exports[_0xb4ba('0x26')]=function(_0x2a4ff5){var _0x466411=this;return new Promise(function(_0x14127c,_0x3f5bef){return db[_0xb4ba('0x1a')][_0xb4ba('0x27')]({'where':_0x2a4ff5[_0xb4ba('0x1c')]?_0x2a4ff5[_0xb4ba('0x1c')][_0xb4ba('0x28')]||null:null})[_0xb4ba('0xe')](function(_0x413ba8){logger[_0xb4ba('0xf')](_0xb4ba('0x26'),_0x2a4ff5);logger['debug']('DestroyCmHopperBlack',_0x2a4ff5,JSON[_0xb4ba('0x14')](_0x413ba8));_0x14127c(_0x413ba8);})['catch'](function(_0xf34bab){logger['error'](_0xb4ba('0x26'),_0xf34bab[_0xb4ba('0x17')],_0x2a4ff5);_0x3f5bef(_0x466411[_0xb4ba('0x15')](0x1f4,_0xf34bab[_0xb4ba('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e546825..142ce86 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 _0xf072=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','multer','util','path','express','fs-extra'];(function(_0xd69d9b,_0x1ba566){var _0x3e0c2c=function(_0x375b7b){while(--_0x375b7b){_0xd69d9b['push'](_0xd69d9b['shift']());}};_0x3e0c2c(++_0x1ba566);}(_0xf072,0x1cf));var _0x2f07=function(_0x429234,_0x5c9ca0){_0x429234=_0x429234-0x0;var _0x2828f7=_0xf072[_0x429234];return _0x2828f7;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0xf')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller['update']);router[_0x2f07('0x10')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2542=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete'];(function(_0x369db0,_0x4a2ca7){var _0x2cf7dc=function(_0x18fabd){while(--_0x18fabd){_0x369db0['push'](_0x369db0['shift']());}};_0x2cf7dc(++_0x4a2ca7);}(_0x2542,0x169));var _0x2254=function(_0x373f81,_0x59b2e1){_0x373f81=_0x373f81-0x0;var _0xf91bfe=_0x2542[_0x373f81];return _0xf91bfe;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')](_0x2254('0xe'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x12')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller['destroy']);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 7dc126f..8838f84 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 _0x3488=['getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x1b82ad,_0x3b6a82){var _0x17d7c0=function(_0x11f602){while(--_0x11f602){_0x1b82ad['push'](_0x1b82ad['shift']());}};_0x17d7c0(++_0x3b6a82);}(_0x3488,0x1ce));var _0x8348=function(_0x476c48,_0x4a9203){_0x476c48=_0x476c48-0x0;var _0x1ec757=_0x3488[_0x476c48];return _0x1ec757;};'use strict';var Sequelize=require(_0x8348('0x0'));var moment=require(_0x8348('0x1'));module[_0x8348('0x2')]={'state':{'type':Sequelize[_0x8348('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x8348('0x4')]},'scheduledat':{'type':Sequelize[_0x8348('0x5')]},'countbusyretry':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8348('0x4')]},'originatecalleridname':{'type':Sequelize[_0x8348('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8348('0x4')]},'starttime':{'type':Sequelize[_0x8348('0x5')]},'responsetime':{'type':Sequelize[_0x8348('0x5')]},'answertime':{'type':Sequelize[_0x8348('0x5')]},'droptime':{'type':Sequelize[_0x8348('0x5')]},'endtime':{'type':Sequelize[_0x8348('0x5')]},'ringtime':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8348('0x4')]},'campaign':{'type':Sequelize[_0x8348('0x4')]},'campaigntype':{'type':Sequelize[_0x8348('0x4')]},'membername':{'type':Sequelize[_0x8348('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x8348('0x4')]},'secondDisposition':{'type':Sequelize[_0x8348('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8348('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4bdb3a){var _0x47b491=this[_0x8348('0x6')](_0x8348('0x7'));if(_0x47b491&&_0x4bdb3a){this[_0x8348('0x8')]('followuptime',moment(_0x4bdb3a)[_0x8348('0x9')](moment(_0x47b491),_0x8348('0xa')));}}},'amd':{'type':Sequelize[_0x8348('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8348('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8348('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8348('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8348('0x5')]},'callback':{'type':Sequelize[_0x8348('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8348('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8348('0x5')]},'deleted':{'type':Sequelize[_0x8348('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8348('0x5')]},'recallme':{'type':Sequelize[_0x8348('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8348('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8348('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x53a7=['followuptime','seconds','BOOLEAN','sequelize','moment','STRING','INTEGER','DATE','endtime','setDataValue'];(function(_0x391e9c,_0x3b4958){var _0x1807da=function(_0x2a1884){while(--_0x2a1884){_0x391e9c['push'](_0x391e9c['shift']());}};_0x1807da(++_0x3b4958);}(_0x53a7,0x85));var _0x753a=function(_0x300b72,_0x297c81){_0x300b72=_0x300b72-0x0;var _0x433a87=_0x53a7[_0x300b72];return _0x433a87;};'use strict';var Sequelize=require(_0x753a('0x0'));var moment=require(_0x753a('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x753a('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x753a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x753a('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x753a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x753a('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x753a('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x753a('0x4')]},'answertime':{'type':Sequelize[_0x753a('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x753a('0x4')]},'ringtime':{'type':Sequelize[_0x753a('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x753a('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x753a('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x753a('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x753a('0x2')]},'campaign':{'type':Sequelize[_0x753a('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x753a('0x2')]},'reason':{'type':Sequelize[_0x753a('0x2')]},'disposition':{'type':Sequelize[_0x753a('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x753a('0x2')]},'dispositionat':{'type':Sequelize[_0x753a('0x4')],'set':function(_0x306d81){var _0x184068=this['getDataValue'](_0x753a('0x5'));if(_0x184068&&_0x306d81){this[_0x753a('0x6')](_0x753a('0x7'),moment(_0x306d81)['diff'](moment(_0x184068),_0x753a('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x753a('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x753a('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x753a('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x753a('0x4')]},'callback':{'type':Sequelize[_0x753a('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x753a('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x753a('0x4')]},'recallme':{'type':Sequelize[_0x753a('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x753a('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x753a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x753a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x753a('0x3')],'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 ee6749e..9405eda 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 _0x4483=['updatedAt','ANY_VALUE(calleridnum)','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','select','state\x20=\x204','group','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','apply','reject','save','update','end','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','CmHopperFinal','includeAll','include','findAll','then','rows','catch','show','params','length','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','ContactId','ListId','createdAt'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4483,0x1a3));var _0x3448=function(_0x8847db,_0x356669){_0x8847db=_0x8847db-0x0;var _0x57bfbb=_0x4483[_0x8847db];return _0x57bfbb;};'use strict';var pdf=require(_0x3448('0x0'));var emlformat=require(_0x3448('0x1'));var rimraf=require(_0x3448('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3448('0x3'));var rp=require(_0x3448('0x4'));var moment=require(_0x3448('0x5'));var BPromise=require(_0x3448('0x6'));var Mustache=require(_0x3448('0x7'));var util=require('util');var path=require(_0x3448('0x8'));var sox=require(_0x3448('0x9'));var csv=require(_0x3448('0xa'));var ejs=require(_0x3448('0xb'));var fs=require('fs');var fs_extra=require(_0x3448('0xc'));var _=require(_0x3448('0xd'));var squel=require(_0x3448('0xe'));var crypto=require(_0x3448('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3448('0xa'));var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3448('0x1a'))['db'];function respondWithStatusCode(_0x38fbb1,_0x5f52bd){_0x5f52bd=_0x5f52bd||0xcc;return function(_0x2661e1){if(_0x2661e1){return _0x38fbb1[_0x3448('0x1b')](_0x5f52bd);}return _0x38fbb1[_0x3448('0x1c')](_0x5f52bd)['end']();};}function respondWithResult(_0x14104c,_0x2952a6){_0x2952a6=_0x2952a6||0xc8;return function(_0x4daf3e){if(_0x4daf3e){return _0x14104c[_0x3448('0x1c')](_0x2952a6)[_0x3448('0x1d')](_0x4daf3e);}};}function respondWithFilteredResult(_0x46784f,_0x4fc70f){return function(_0x472518){if(_0x472518){var _0x28f5b9=_0x472518[_0x3448('0x1e')],_0x13610a=_0x4fc70f[_0x3448('0x1f')],_0x30f8dd=_0x4fc70f[_0x3448('0x1f')]+_0x4fc70f['limit'],_0x400af8;if(_0x30f8dd>=_0x28f5b9){_0x30f8dd=_0x28f5b9;_0x400af8=0xc8;}else{_0x400af8=0xce;}_0x46784f[_0x3448('0x1c')](_0x400af8);return _0x46784f['set']('Content-Range',_0x13610a+'-'+_0x30f8dd+'/'+_0x28f5b9)['json'](_0x472518);}return null;};}function patchUpdates(_0x1e9774){return function(_0x278736){try{jsonpatch[_0x3448('0x20')](_0x278736,_0x1e9774,!![]);}catch(_0x5b5e26){return BPromise[_0x3448('0x21')](_0x5b5e26);}return _0x278736[_0x3448('0x22')]();};}function saveUpdates(_0x317de6,_0x18608e){return function(_0x29a15a){if(_0x29a15a){return _0x29a15a[_0x3448('0x23')](_0x317de6)['then'](function(_0x54c7ee){return _0x54c7ee;});}return null;};}function removeEntity(_0x4e6716,_0x1b3d5a){return function(_0x200f72){if(_0x200f72){return _0x200f72['destroy']()['then'](function(){_0x4e6716[_0x3448('0x1c')](0xcc)[_0x3448('0x24')]();});}};}function handleEntityNotFound(_0x22ad5c,_0x4368c7){return function(_0xbf2237){if(!_0xbf2237){_0x22ad5c['sendStatus'](0x194);}return _0xbf2237;};}function handleError(_0x229ce7,_0x1b5c49){_0x1b5c49=_0x1b5c49||0x1f4;return function(_0x114244){logger[_0x3448('0x25')](_0x114244[_0x3448('0x26')]);if(_0x114244['name']){delete _0x114244[_0x3448('0x27')];}_0x229ce7[_0x3448('0x1c')](_0x1b5c49)['send'](_0x114244);};}exports[_0x3448('0x28')]=function(_0x12c22d,_0x310912){var _0x1bd34c={},_0x38fab2={},_0x35f026={'count':0x0,'rows':[]};var _0x31be64=_[_0x3448('0x29')](db['CmHopperFinal'][_0x3448('0x2a')],function(_0x450704){return{'name':_0x450704[_0x3448('0x2b')],'type':_0x450704['type'][_0x3448('0x2c')]};});_0x38fab2['model']=_['map'](_0x31be64,'name');_0x38fab2[_0x3448('0x2d')]=_[_0x3448('0x2e')](_0x12c22d['query']);_0x38fab2['filters']=_[_0x3448('0x2f')](_0x38fab2[_0x3448('0x30')],_0x38fab2[_0x3448('0x2d')]);_0x1bd34c[_0x3448('0x31')]=_['intersection'](_0x38fab2[_0x3448('0x30')],qs[_0x3448('0x32')](_0x12c22d[_0x3448('0x2d')]['fields']));_0x1bd34c[_0x3448('0x31')]=_0x1bd34c[_0x3448('0x31')]['length']?_0x1bd34c['attributes']:_0x38fab2[_0x3448('0x30')];if(!_0x12c22d[_0x3448('0x2d')][_0x3448('0x33')](_0x3448('0x34'))){_0x1bd34c['limit']=qs[_0x3448('0x35')](_0x12c22d[_0x3448('0x2d')][_0x3448('0x35')]);_0x1bd34c[_0x3448('0x1f')]=qs['offset'](_0x12c22d[_0x3448('0x2d')][_0x3448('0x1f')]);}_0x1bd34c['order']=qs[_0x3448('0x36')](_0x12c22d[_0x3448('0x2d')][_0x3448('0x36')]);_0x1bd34c[_0x3448('0x37')]=qs[_0x3448('0x38')](_[_0x3448('0x39')](_0x12c22d[_0x3448('0x2d')],_0x38fab2[_0x3448('0x38')]),_0x31be64);if(_0x12c22d[_0x3448('0x2d')]['filter']){_0x1bd34c['where']=_[_0x3448('0x3a')](_0x1bd34c['where'],{'$or':_[_0x3448('0x29')](_0x31be64,function(_0x3048fa){if(_0x3048fa[_0x3448('0x3b')]!==_0x3448('0x3c')){var _0x5af6cd={};_0x5af6cd[_0x3048fa[_0x3448('0x27')]]={'$like':'%'+_0x12c22d[_0x3448('0x2d')][_0x3448('0x3d')]+'%'};return _0x5af6cd;}})});}_0x1bd34c=_[_0x3448('0x3a')]({},_0x1bd34c,_0x12c22d[_0x3448('0x3e')]);var _0x249131={'where':_0x1bd34c[_0x3448('0x37')]};return db[_0x3448('0x3f')][_0x3448('0x1e')](_0x249131)['then'](function(_0x39b22e){_0x35f026[_0x3448('0x1e')]=_0x39b22e;if(_0x12c22d[_0x3448('0x2d')][_0x3448('0x40')]){_0x1bd34c[_0x3448('0x41')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3448('0x42')](_0x1bd34c);})[_0x3448('0x43')](function(_0x4a6e5){_0x35f026[_0x3448('0x44')]=_0x4a6e5;return _0x35f026;})[_0x3448('0x43')](respondWithFilteredResult(_0x310912,_0x1bd34c))[_0x3448('0x45')](handleError(_0x310912,null));};exports[_0x3448('0x46')]=function(_0x3db5f1,_0x4a8f80){var _0x399246={'raw':!![],'where':{'id':_0x3db5f1[_0x3448('0x47')]['id']}},_0x3d96be={};_0x3d96be['model']=_[_0x3448('0x2e')](db[_0x3448('0x3f')][_0x3448('0x2a')]);_0x3d96be[_0x3448('0x2d')]=_[_0x3448('0x2e')](_0x3db5f1[_0x3448('0x2d')]);_0x3d96be[_0x3448('0x38')]=_['intersection'](_0x3d96be[_0x3448('0x30')],_0x3d96be[_0x3448('0x2d')]);_0x399246[_0x3448('0x31')]=_[_0x3448('0x2f')](_0x3d96be[_0x3448('0x30')],qs[_0x3448('0x32')](_0x3db5f1['query'][_0x3448('0x32')]));_0x399246['attributes']=_0x399246['attributes'][_0x3448('0x48')]?_0x399246[_0x3448('0x31')]:_0x3d96be['model'];if(_0x3db5f1[_0x3448('0x2d')][_0x3448('0x40')]){_0x399246['include']=[{'all':!![]}];}_0x399246=_[_0x3448('0x3a')]({},_0x399246,_0x3db5f1[_0x3448('0x3e')]);return db['CmHopperFinal'][_0x3448('0x49')](_0x399246)[_0x3448('0x43')](handleEntityNotFound(_0x4a8f80,null))[_0x3448('0x43')](respondWithResult(_0x4a8f80,null))[_0x3448('0x45')](handleError(_0x4a8f80,null));};exports[_0x3448('0x4a')]=function(_0x3e3208,_0x2cb2af){return db['CmHopperFinal']['describe']()[_0x3448('0x43')](respondWithResult(_0x2cb2af,null))[_0x3448('0x45')](handleError(_0x2cb2af,null));};exports[_0x3448('0x23')]=function(_0x3f48e3,_0x527259){if(_0x3f48e3[_0x3448('0x4b')][_0x3448('0x4c')]){delete _0x3f48e3[_0x3448('0x4b')][_0x3448('0x4c')];}return db[_0x3448('0x3f')]['find']({'where':{'uniqueid':_0x3f48e3[_0x3448('0x47')]['id']}})['then'](handleEntityNotFound(_0x527259,null))[_0x3448('0x43')](saveUpdates(_0x3f48e3[_0x3448('0x4b')],null))['then'](respondWithResult(_0x527259,null))[_0x3448('0x45')](handleError(_0x527259,null));};exports[_0x3448('0x4d')]=function(_0x257abb,_0x19c283,_0x44c15e){return db[_0x3448('0x3f')][_0x3448('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x257abb['params']['id']},'attributes':[[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x3448('0x50')](_0x3448('0x51')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3448('0x4f'),db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')][_0x3448('0x50')](_0x3448('0x52')))),_0x3448('0x53')],[db[_0x3448('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3448('0x50')](_0x3448('0x54')))),'busyContacts'],[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db['sequelize']['fn']('IF',db[_0x3448('0x4e')][_0x3448('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x3448('0x55')],[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')][_0x3448('0x50')](_0x3448('0x56')))),_0x3448('0x57')],[db[_0x3448('0x4e')]['fn']('COUNT',db[_0x3448('0x4e')]['fn']('IF',db['sequelize'][_0x3448('0x50')](_0x3448('0x58')))),_0x3448('0x59')],[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db[_0x3448('0x4e')]['fn']('IF',db['sequelize'][_0x3448('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3448('0x5a')],[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x3448('0x5b')]]})[_0x3448('0x43')](handleEntityNotFound(_0x19c283,null))[_0x3448('0x43')](respondWithResult(_0x19c283,null))['catch'](handleError(_0x19c283,null));};exports[_0x3448('0x5c')]=function(_0x3eb57b,_0x1e4fb9,_0x3128eb){return db[_0x3448('0x3f')][_0x3448('0x42')]({'raw':![],'where':{'CampaignId':_0x3eb57b[_0x3448('0x47')]['id']},'attributes':[[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')][_0x3448('0x50')](_0x3448('0x51')))),_0x3448('0x5d')],[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')]['literal'](_0x3448('0x52')))),'noAnswerContacts'],[db[_0x3448('0x4e')]['fn']('COUNT',db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')]['literal'](_0x3448('0x54')))),_0x3448('0x5e')],[db['sequelize']['fn']('COUNT',db[_0x3448('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x3448('0x5f')))),_0x3448('0x55')],[db['sequelize']['fn']('COUNT',db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')][_0x3448('0x50')](_0x3448('0x56')))),_0x3448('0x57')],[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')][_0x3448('0x50')](_0x3448('0x58')))),_0x3448('0x59')],[db[_0x3448('0x4e')]['fn'](_0x3448('0x4f'),db['sequelize']['fn']('IF',db[_0x3448('0x4e')][_0x3448('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3448('0x5a')],[db[_0x3448('0x4e')]['fn']('COUNT',db[_0x3448('0x4e')]['fn']('IF',db[_0x3448('0x4e')][_0x3448('0x50')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x3448('0x43')](handleEntityNotFound(_0x1e4fb9,null))['then'](respondWithResult(_0x1e4fb9,null))[_0x3448('0x45')](handleError(_0x1e4fb9,null));};exports[_0x3448('0x60')]=function(_0x5d952a,_0x50b81b,_0xa23d08){return db[_0x3448('0x61')][_0x3448('0x49')]({'where':{'id':_0x5d952a['params']['id']}})['then'](handleEntityNotFound(_0x50b81b,null))[_0x3448('0x43')](function(_0x36c0b5){var _0x1ddd54;if(_0x36c0b5){_0x1ddd54=squel[_0x3448('0x62')]()[_0x3448('0x63')](_0x3448('0x64'))['fromQuery']([_0x3448('0x65'),'scheduledAt',_0x3448('0x66'),_0x3448('0x67'),'VoiceQueueId',_0x3448('0x68'),_0x3448('0x69')],squel['select']()['field'](_0x3448('0x6a'),_0x3448('0x65'))[_0x3448('0x6b')](_0x3448('0x6c'),_0x3448('0x6d'))[_0x3448('0x6b')](_0x3448('0x6e'),_0x3448('0x66'))[_0x3448('0x6b')](_0x3448('0x6f'),_0x3448('0x67'))[_0x3448('0x6b')](_0x3448('0x70'),_0x3448('0x71'))[_0x3448('0x6b')](_0x3448('0x6c'),'createdAt')['field'](_0x3448('0x6c'),'updatedAt')[_0x3448('0x72')](_0x3448('0x73'))['where'](_0x3448('0x74'),_0x5d952a['params']['id'][_0x3448('0x75')]())[_0x3448('0x37')](_0x3448('0x76'),_0x5d952a[_0x3448('0x4b')][_0x3448('0x77')]['toString']())[_0x3448('0x37')](_0x3448('0x78'))[_0x3448('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3448('0x79')]()[_0x3448('0x6b')](_0x3448('0x65'))['from'](_0x3448('0x64'))['where']('VoiceQueueId\x20=\x20?',_0x5d952a[_0x3448('0x47')]['id']['toString']()))[_0x3448('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3448('0x79')]()[_0x3448('0x6b')]('calleridnum')['from'](_0x3448('0x73'))[_0x3448('0x37')]('VoiceQueueId\x20=\x20?',_0x5d952a[_0x3448('0x47')]['id'][_0x3448('0x75')]())['where'](_0x3448('0x7a')))[_0x3448('0x7b')](_0x3448('0x66')))[_0x3448('0x75')]();return db['sequelize'][_0x3448('0x2d')](_0x1ddd54);}return[];})['then'](respondWithResult(_0x50b81b,null))[_0x3448('0x45')](handleError(_0x50b81b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1afd5c,_0x20a047,_0x4117da){return db['Campaign'][_0x3448('0x49')]({'where':{'id':_0x1afd5c[_0x3448('0x47')]['id']}})['then'](handleEntityNotFound(_0x20a047,null))[_0x3448('0x43')](function(_0x51f6b0){var _0x520950;if(_0x51f6b0){_0x520950=squel[_0x3448('0x62')]()['into'](_0x3448('0x64'))[_0x3448('0x7c')]([_0x3448('0x65'),'scheduledAt',_0x3448('0x66'),_0x3448('0x67'),_0x3448('0x7d'),_0x3448('0x68'),_0x3448('0x69')],squel[_0x3448('0x79')]()[_0x3448('0x6b')](_0x3448('0x6a'),_0x3448('0x65'))[_0x3448('0x6b')](_0x3448('0x6c'),_0x3448('0x6d'))[_0x3448('0x6b')]('ANY_VALUE(ContactId)','ContactId')['field'](_0x3448('0x6f'),'ListId')['field'](_0x3448('0x7e'),_0x3448('0x7d'))[_0x3448('0x6b')](_0x3448('0x6c'),'createdAt')['field'](_0x3448('0x6c'),_0x3448('0x69'))[_0x3448('0x72')]('cm_hopper_final')[_0x3448('0x37')](_0x3448('0x7f'),_0x1afd5c[_0x3448('0x47')]['id'][_0x3448('0x75')]())['where'](_0x3448('0x76'),_0x1afd5c[_0x3448('0x4b')]['state']['toString']())[_0x3448('0x37')](_0x3448('0x78'))[_0x3448('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3448('0x79')]()[_0x3448('0x6b')](_0x3448('0x65'))[_0x3448('0x72')]('cm_hopper')[_0x3448('0x37')](_0x3448('0x7f'),_0x1afd5c['params']['id'][_0x3448('0x75')]()))[_0x3448('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x3448('0x6b')](_0x3448('0x80'))[_0x3448('0x72')](_0x3448('0x73'))[_0x3448('0x37')](_0x3448('0x7f'),_0x1afd5c[_0x3448('0x47')]['id'][_0x3448('0x75')]())[_0x3448('0x37')](_0x3448('0x7a')))['group'](_0x3448('0x66')))['toString']();return db[_0x3448('0x4e')]['query'](_0x520950);}return[];})[_0x3448('0x43')](respondWithResult(_0x20a047,null))[_0x3448('0x45')](handleError(_0x20a047,null));};exports['checkContactHopper']=function(_0x4e7771,_0x490ade,_0x2f0660){return db[_0x3448('0x81')][_0x3448('0x82')]({'where':{'VoiceQueueId':_0x4e7771['body'][_0x3448('0x71')],'CampaignId':_0x4e7771[_0x3448('0x4b')]['CampaignId'],'ContactId':_0x4e7771['body'][_0x3448('0x66')]}})[_0x3448('0x43')](handleEntityNotFound(_0x490ade,null))[_0x3448('0x43')](function(_0x44a139){if(_0x44a139){return _0x44a139;}return null;})[_0x3448('0x43')](respondWithResult(_0x490ade,null))[_0x3448('0x45')](handleError(_0x490ade,null));}; \ No newline at end of file +var _0xe511=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','count','includeAll','include','findAll','rows','catch','show','params','find','describe','update','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','congestionContacts','reCallContacts','VoiceQueue','insert','cm_hopper','scheduledAt','ListId','createdAt','select','field','phone','NOW()','ANY_VALUE(ContactId)','ContactId','VoiceQueueId','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','group','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','CmHopper','findOne','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0xe511,0x16f));var _0x1e51=function(_0x3fd603,_0x5f5b06){_0x3fd603=_0x3fd603-0x0;var _0x5026af=_0xe511[_0x3fd603];return _0x5026af;};'use strict';var pdf=require(_0x1e51('0x0'));var emlformat=require(_0x1e51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e51('0x3'));var moment=require(_0x1e51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e51('0x5'));var util=require(_0x1e51('0x6'));var path=require(_0x1e51('0x7'));var sox=require(_0x1e51('0x8'));var csv=require('to-csv');var ejs=require(_0x1e51('0x9'));var fs=require('fs');var fs_extra=require(_0x1e51('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e51('0xb'));var jsforce=require(_0x1e51('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1e51('0xd'));var Papa=require(_0x1e51('0xe'));var Redis=require(_0x1e51('0xf'));var authService=require(_0x1e51('0x10'));var qs=require(_0x1e51('0x11'));var as=require(_0x1e51('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e51('0x13'))(_0x1e51('0x14'));var utils=require(_0x1e51('0x15'));var config=require(_0x1e51('0x16'));var licenseUtil=require(_0x1e51('0x17'));var db=require(_0x1e51('0x18'))['db'];function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=_0x24db4f['count'],_0x5857e2=_0x3b01b7[_0x1e51('0x1d')],_0xa3b410=_0x3b01b7[_0x1e51('0x1d')]+_0x3b01b7[_0x1e51('0x1e')],_0x4f7aaf;if(_0xa3b410>=_0x4526b4){_0xa3b410=_0x4526b4;_0x4f7aaf=0xc8;}else{_0x4f7aaf=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4f7aaf);return _0x5a5c07[_0x1e51('0x1f')](_0x1e51('0x20'),_0x5857e2+'-'+_0xa3b410+'/'+_0x4526b4)['json'](_0x24db4f);}return null;};}function patchUpdates(_0x39449b){return function(_0x4a9272){try{jsonpatch[_0x1e51('0x21')](_0x4a9272,_0x39449b,!![]);}catch(_0x1cbd1c){return BPromise[_0x1e51('0x22')](_0x1cbd1c);}return _0x4a9272[_0x1e51('0x23')]();};}function saveUpdates(_0x506f40,_0x5223c3){return function(_0x4e6a49){if(_0x4e6a49){return _0x4e6a49['update'](_0x506f40)[_0x1e51('0x24')](function(_0x4f1f56){return _0x4f1f56;});}return null;};}function removeEntity(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x25')]()[_0x1e51('0x24')](function(){_0x3f7340[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x461d3d,_0x4bcdd3){return function(_0x4d04c0){if(!_0x4d04c0){_0x461d3d[_0x1e51('0x19')](0x194);}return _0x4d04c0;};}function handleError(_0xdf6c02,_0x2e42b1){_0x2e42b1=_0x2e42b1||0x1f4;return function(_0x1386db){logger['error'](_0x1386db['stack']);if(_0x1386db['name']){delete _0x1386db[_0x1e51('0x26')];}_0xdf6c02[_0x1e51('0x1a')](_0x2e42b1)[_0x1e51('0x27')](_0x1386db);};}exports['index']=function(_0x1e7a96,_0x49c507){var _0x5eccee={},_0x3349f0={},_0x5c5bbd={'count':0x0,'rows':[]};var _0x170ec6=_[_0x1e51('0x28')](db['CmHopperFinal'][_0x1e51('0x29')],function(_0x10ee23){return{'name':_0x10ee23[_0x1e51('0x2a')],'type':_0x10ee23[_0x1e51('0x2b')]['key']};});_0x3349f0['model']=_['map'](_0x170ec6,_0x1e51('0x26'));_0x3349f0[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x1e7a96[_0x1e51('0x2c')]);_0x3349f0[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x3349f0[_0x1e51('0x30')],_0x3349f0[_0x1e51('0x2c')]);_0x5eccee[_0x1e51('0x31')]=_[_0x1e51('0x2f')](_0x3349f0[_0x1e51('0x30')],qs['fields'](_0x1e7a96[_0x1e51('0x2c')][_0x1e51('0x32')]));_0x5eccee[_0x1e51('0x31')]=_0x5eccee[_0x1e51('0x31')][_0x1e51('0x33')]?_0x5eccee['attributes']:_0x3349f0[_0x1e51('0x30')];if(!_0x1e7a96['query'][_0x1e51('0x34')](_0x1e51('0x35'))){_0x5eccee[_0x1e51('0x1e')]=qs['limit'](_0x1e7a96[_0x1e51('0x2c')]['limit']);_0x5eccee[_0x1e51('0x1d')]=qs['offset'](_0x1e7a96['query'][_0x1e51('0x1d')]);}_0x5eccee[_0x1e51('0x36')]=qs[_0x1e51('0x37')](_0x1e7a96['query'][_0x1e51('0x37')]);_0x5eccee['where']=qs[_0x1e51('0x2e')](_[_0x1e51('0x38')](_0x1e7a96['query'],_0x3349f0[_0x1e51('0x2e')]),_0x170ec6);if(_0x1e7a96[_0x1e51('0x2c')][_0x1e51('0x39')]){_0x5eccee[_0x1e51('0x3a')]=_[_0x1e51('0x3b')](_0x5eccee[_0x1e51('0x3a')],{'$or':_['map'](_0x170ec6,function(_0x509f7d){if(_0x509f7d[_0x1e51('0x2b')]!=='VIRTUAL'){var _0x3c6c35={};_0x3c6c35[_0x509f7d[_0x1e51('0x26')]]={'$like':'%'+_0x1e7a96[_0x1e51('0x2c')][_0x1e51('0x39')]+'%'};return _0x3c6c35;}})});}_0x5eccee=_[_0x1e51('0x3b')]({},_0x5eccee,_0x1e7a96[_0x1e51('0x3c')]);var _0x845a62={'where':_0x5eccee[_0x1e51('0x3a')]};return db[_0x1e51('0x3d')][_0x1e51('0x3e')](_0x845a62)[_0x1e51('0x24')](function(_0x5360b3){_0x5c5bbd[_0x1e51('0x3e')]=_0x5360b3;if(_0x1e7a96['query'][_0x1e51('0x3f')]){_0x5eccee[_0x1e51('0x40')]=[{'all':!![]}];}return db[_0x1e51('0x3d')][_0x1e51('0x41')](_0x5eccee);})[_0x1e51('0x24')](function(_0x2f8fd9){_0x5c5bbd[_0x1e51('0x42')]=_0x2f8fd9;return _0x5c5bbd;})[_0x1e51('0x24')](respondWithFilteredResult(_0x49c507,_0x5eccee))[_0x1e51('0x43')](handleError(_0x49c507,null));};exports[_0x1e51('0x44')]=function(_0xc40fce,_0x5b4b3f){var _0x56cb66={'raw':!![],'where':{'id':_0xc40fce[_0x1e51('0x45')]['id']}},_0x13da51={};_0x13da51[_0x1e51('0x30')]=_[_0x1e51('0x2d')](db[_0x1e51('0x3d')][_0x1e51('0x29')]);_0x13da51[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0xc40fce['query']);_0x13da51[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x13da51[_0x1e51('0x30')],_0x13da51[_0x1e51('0x2c')]);_0x56cb66[_0x1e51('0x31')]=_[_0x1e51('0x2f')](_0x13da51[_0x1e51('0x30')],qs['fields'](_0xc40fce[_0x1e51('0x2c')][_0x1e51('0x32')]));_0x56cb66['attributes']=_0x56cb66[_0x1e51('0x31')][_0x1e51('0x33')]?_0x56cb66[_0x1e51('0x31')]:_0x13da51['model'];if(_0xc40fce[_0x1e51('0x2c')][_0x1e51('0x3f')]){_0x56cb66[_0x1e51('0x40')]=[{'all':!![]}];}_0x56cb66=_[_0x1e51('0x3b')]({},_0x56cb66,_0xc40fce[_0x1e51('0x3c')]);return db[_0x1e51('0x3d')][_0x1e51('0x46')](_0x56cb66)[_0x1e51('0x24')](handleEntityNotFound(_0x5b4b3f,null))[_0x1e51('0x24')](respondWithResult(_0x5b4b3f,null))['catch'](handleError(_0x5b4b3f,null));};exports[_0x1e51('0x47')]=function(_0x22a898,_0x4b5fa7){return db[_0x1e51('0x3d')][_0x1e51('0x47')]()[_0x1e51('0x24')](respondWithResult(_0x4b5fa7,null))['catch'](handleError(_0x4b5fa7,null));};exports[_0x1e51('0x48')]=function(_0x4634de,_0x29233c){if(_0x4634de['body'][_0x1e51('0x49')]){delete _0x4634de['body']['uniqueid'];}return db['CmHopperFinal'][_0x1e51('0x46')]({'where':{'uniqueid':_0x4634de[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x29233c,null))['then'](saveUpdates(_0x4634de[_0x1e51('0x4a')],null))[_0x1e51('0x24')](respondWithResult(_0x29233c,null))[_0x1e51('0x43')](handleError(_0x29233c,null));};exports[_0x1e51('0x4b')]=function(_0xf3377b,_0x54ce36,_0x4bb11f){return db[_0x1e51('0x3d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0xf3377b[_0x1e51('0x45')]['id']},'attributes':[[db[_0x1e51('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x1e51('0x4d')](_0x1e51('0x4e')))),_0x1e51('0x4f')],[db['sequelize']['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db[_0x1e51('0x4c')][_0x1e51('0x4d')](_0x1e51('0x51')))),_0x1e51('0x52')],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db['sequelize']['fn']('IF',db[_0x1e51('0x4c')][_0x1e51('0x4d')](_0x1e51('0x53')))),_0x1e51('0x54')],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db['sequelize']['fn']('IF',db[_0x1e51('0x4c')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db['sequelize'][_0x1e51('0x4d')](_0x1e51('0x55')))),_0x1e51('0x56')],[db['sequelize']['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db[_0x1e51('0x4c')]['literal'](_0x1e51('0x57')))),_0x1e51('0x58')],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db[_0x1e51('0x4c')][_0x1e51('0x4d')](_0x1e51('0x59')))),'reCallContacts'],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1e51('0x5a')))),_0x1e51('0x5b')]]})[_0x1e51('0x24')](handleEntityNotFound(_0x54ce36,null))[_0x1e51('0x24')](respondWithResult(_0x54ce36,null))[_0x1e51('0x43')](handleError(_0x54ce36,null));};exports[_0x1e51('0x5c')]=function(_0x45b649,_0x31fe87,_0x8ba6f4){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x45b649['params']['id']},'attributes':[[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0x1e51('0x4d')](_0x1e51('0x4e')))),'noSuchContacts'],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db[_0x1e51('0x4c')][_0x1e51('0x4d')](_0x1e51('0x51')))),_0x1e51('0x52')],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db['sequelize'][_0x1e51('0x4d')](_0x1e51('0x53')))),_0x1e51('0x54')],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x1e51('0x5d')))),_0x1e51('0x5e')],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1e51('0x55')))),_0x1e51('0x56')],[db[_0x1e51('0x4c')]['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db['sequelize'][_0x1e51('0x4d')](_0x1e51('0x57')))),_0x1e51('0x58')],[db['sequelize']['fn'](_0x1e51('0x50'),db[_0x1e51('0x4c')]['fn']('IF',db[_0x1e51('0x4c')]['literal'](_0x1e51('0x59')))),_0x1e51('0x5f')],[db['sequelize']['fn']('COUNT',db[_0x1e51('0x4c')]['fn']('IF',db['sequelize'][_0x1e51('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),_0x1e51('0x5b')]]})[_0x1e51('0x24')](handleEntityNotFound(_0x31fe87,null))[_0x1e51('0x24')](respondWithResult(_0x31fe87,null))[_0x1e51('0x43')](handleError(_0x31fe87,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x37f3e6,_0x4c9871,_0x5eaa16){return db[_0x1e51('0x60')][_0x1e51('0x46')]({'where':{'id':_0x37f3e6[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c9871,null))[_0x1e51('0x24')](function(_0x25ce1d){var _0x15f15b;if(_0x25ce1d){_0x15f15b=squel[_0x1e51('0x61')]()['into'](_0x1e51('0x62'))['fromQuery'](['phone',_0x1e51('0x63'),'ContactId',_0x1e51('0x64'),'VoiceQueueId',_0x1e51('0x65'),'updatedAt'],squel[_0x1e51('0x66')]()[_0x1e51('0x67')]('ANY_VALUE(calleridnum)',_0x1e51('0x68'))['field'](_0x1e51('0x69'),_0x1e51('0x63'))[_0x1e51('0x67')](_0x1e51('0x6a'),_0x1e51('0x6b'))[_0x1e51('0x67')]('ANY_VALUE(ListId)',_0x1e51('0x64'))['field']('ANY_VALUE(VoiceQueueId)',_0x1e51('0x6c'))[_0x1e51('0x67')](_0x1e51('0x69'),_0x1e51('0x65'))[_0x1e51('0x67')](_0x1e51('0x69'),_0x1e51('0x6d'))['from'](_0x1e51('0x6e'))[_0x1e51('0x3a')](_0x1e51('0x6f'),_0x37f3e6['params']['id']['toString']())[_0x1e51('0x3a')](_0x1e51('0x70'),_0x37f3e6['body'][_0x1e51('0x71')][_0x1e51('0x72')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x1e51('0x3a')](_0x1e51('0x73'),squel[_0x1e51('0x66')]()[_0x1e51('0x67')](_0x1e51('0x68'))[_0x1e51('0x74')](_0x1e51('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x37f3e6[_0x1e51('0x45')]['id'][_0x1e51('0x72')]()))['where'](_0x1e51('0x73'),squel[_0x1e51('0x66')]()['field'](_0x1e51('0x75'))['from'](_0x1e51('0x6e'))['where']('VoiceQueueId\x20=\x20?',_0x37f3e6['params']['id']['toString']())['where']('state\x20=\x204'))[_0x1e51('0x76')]('ContactId'))[_0x1e51('0x72')]();return db['sequelize'][_0x1e51('0x2c')](_0x15f15b);}return[];})[_0x1e51('0x24')](respondWithResult(_0x4c9871,null))[_0x1e51('0x43')](handleError(_0x4c9871,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x30336b,_0x3ed4b1,_0x4a2b44){return db[_0x1e51('0x77')]['find']({'where':{'id':_0x30336b[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ed4b1,null))[_0x1e51('0x24')](function(_0x42318c){var _0x2d5062;if(_0x42318c){_0x2d5062=squel[_0x1e51('0x61')]()[_0x1e51('0x78')](_0x1e51('0x62'))['fromQuery']([_0x1e51('0x68'),'scheduledAt',_0x1e51('0x6b'),_0x1e51('0x64'),_0x1e51('0x79'),_0x1e51('0x65'),'updatedAt'],squel['select']()['field'](_0x1e51('0x7a'),_0x1e51('0x68'))[_0x1e51('0x67')](_0x1e51('0x69'),'scheduledAt')[_0x1e51('0x67')]('ANY_VALUE(ContactId)',_0x1e51('0x6b'))['field']('ANY_VALUE(ListId)',_0x1e51('0x64'))[_0x1e51('0x67')]('ANY_VALUE(CampaignId)',_0x1e51('0x79'))['field'](_0x1e51('0x69'),'createdAt')[_0x1e51('0x67')](_0x1e51('0x69'),'updatedAt')[_0x1e51('0x74')]('cm_hopper_final')[_0x1e51('0x3a')](_0x1e51('0x7b'),_0x30336b[_0x1e51('0x45')]['id'][_0x1e51('0x72')]())['where'](_0x1e51('0x70'),_0x30336b[_0x1e51('0x4a')][_0x1e51('0x71')]['toString']())['where'](_0x1e51('0x7c'))[_0x1e51('0x3a')](_0x1e51('0x73'),squel['select']()['field']('phone')[_0x1e51('0x74')](_0x1e51('0x62'))[_0x1e51('0x3a')]('CampaignId\x20=\x20?',_0x30336b[_0x1e51('0x45')]['id'][_0x1e51('0x72')]()))['where'](_0x1e51('0x73'),squel[_0x1e51('0x66')]()[_0x1e51('0x67')]('calleridnum')[_0x1e51('0x74')]('cm_hopper_final')[_0x1e51('0x3a')](_0x1e51('0x7b'),_0x30336b[_0x1e51('0x45')]['id'][_0x1e51('0x72')]())[_0x1e51('0x3a')](_0x1e51('0x7d')))[_0x1e51('0x76')](_0x1e51('0x6b')))[_0x1e51('0x72')]();return db['sequelize'][_0x1e51('0x2c')](_0x2d5062);}return[];})['then'](respondWithResult(_0x3ed4b1,null))[_0x1e51('0x43')](handleError(_0x3ed4b1,null));};exports['checkContactHopper']=function(_0x4042f4,_0x2b4b7c,_0xe92e54){return db[_0x1e51('0x7e')][_0x1e51('0x7f')]({'where':{'VoiceQueueId':_0x4042f4[_0x1e51('0x4a')][_0x1e51('0x6c')],'CampaignId':_0x4042f4[_0x1e51('0x4a')][_0x1e51('0x79')],'ContactId':_0x4042f4['body'][_0x1e51('0x6b')]}})[_0x1e51('0x24')](handleEntityNotFound(_0x2b4b7c,null))[_0x1e51('0x24')](function(_0x4bcc13){if(_0x4bcc13){return _0x4bcc13;}return null;})[_0x1e51('0x24')](respondWithResult(_0x2b4b7c,null))[_0x1e51('0x43')](handleError(_0x2b4b7c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 533d8a1..66e4829 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 _0x807a=['api','request-promise','path','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x46f033,_0x4576cd){var _0x3b281a=function(_0x1e0eb5){while(--_0x1e0eb5){_0x46f033['push'](_0x46f033['shift']());}};_0x3b281a(++_0x4576cd);}(_0x807a,0x1a7));var _0xa807=function(_0x3f390d,_0x321430){_0x3f390d=_0x3f390d-0x0;var _0x22627b=_0x807a[_0x3f390d];return _0x22627b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa807('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa807('0x1'));var fs=require('fs');var path=require(_0xa807('0x2'));var rimraf=require(_0xa807('0x3'));var config=require(_0xa807('0x4'));var attributes=require('./cmHopperFinal.attributes');module[_0xa807('0x5')]=function(_0xa9d496,_0x141457){return _0xa9d496['define'](_0xa807('0x6'),attributes,{'tableName':_0xa807('0x7'),'paranoid':![],'indexes':[{'name':_0xa807('0x8'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x100d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x25bcb5,_0x2d3d20){var _0x526894=function(_0x192ef1){while(--_0x192ef1){_0x25bcb5['push'](_0x25bcb5['shift']());}};_0x526894(++_0x2d3d20);}(_0x100d,0x13f));var _0xd100=function(_0x3f5574,_0x36b727){_0x3f5574=_0x3f5574-0x0;var _0x3f7127=_0x100d[_0x3f5574];return _0x3f7127;};'use strict';var _=require(_0xd100('0x0'));var util=require(_0xd100('0x1'));var logger=require(_0xd100('0x2'))(_0xd100('0x3'));var moment=require('moment');var BPromise=require(_0xd100('0x4'));var rp=require(_0xd100('0x5'));var fs=require('fs');var path=require(_0xd100('0x6'));var rimraf=require(_0xd100('0x7'));var config=require(_0xd100('0x8'));var attributes=require(_0xd100('0x9'));module[_0xd100('0xa')]=function(_0x6975ac,_0x42ce55){return _0x6975ac[_0xd100('0xb')](_0xd100('0xc'),attributes,{'tableName':_0xd100('0xd'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xd100('0xe')]},{'name':_0xd100('0xf'),'fields':[_0xd100('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 1c0087c..9156834 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 _0xe775=['code','CmHopperFinal,\x20%s,\x20%s','message','result','catch','create','body','options','CreateCmHopperFinal','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2ddea4,_0x3b4d83){var _0xb3eb2=function(_0x11ab0a){while(--_0x11ab0a){_0x2ddea4['push'](_0x2ddea4['shift']());}};_0xb3eb2(++_0x3b4d83);}(_0xe775,0x10d));var _0x5e77=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xe775[_0x2f3794];return _0x1c9fbe;};'use strict';var _=require(_0x5e77('0x0'));var util=require(_0x5e77('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5e77('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e77('0x3'))['db'];var utils=require(_0x5e77('0x4'));var logger=require(_0x5e77('0x5'))('rpc');var config=require(_0x5e77('0x6'));var jayson=require(_0x5e77('0x7'));var client=jayson[_0x5e77('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3af536,_0x4ed390,_0x375ea3){return new BPromise(function(_0x2f3979,_0x2fb0ad){return client[_0x5e77('0x9')](_0x3af536,_0x375ea3)[_0x5e77('0xa')](function(_0xf3197){logger[_0x5e77('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0x4ed390,_0x5e77('0xc'));logger[_0x5e77('0xd')](_0x5e77('0xe'),_0x4ed390,_0x5e77('0xc'),JSON[_0x5e77('0xf')](_0xf3197));if(_0xf3197[_0x5e77('0x10')]){if(_0xf3197[_0x5e77('0x10')][_0x5e77('0x11')]===0x1f4){logger[_0x5e77('0x10')](_0x5e77('0x12'),_0x4ed390,_0xf3197['error'][_0x5e77('0x13')]);return _0x2fb0ad(_0xf3197[_0x5e77('0x10')]['message']);}logger[_0x5e77('0x10')](_0x5e77('0x12'),_0x4ed390,_0xf3197[_0x5e77('0x10')][_0x5e77('0x13')]);return _0x2f3979(_0xf3197[_0x5e77('0x10')][_0x5e77('0x13')]);}else{logger[_0x5e77('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0x4ed390,_0x5e77('0xc'));_0x2f3979(_0xf3197[_0x5e77('0x14')][_0x5e77('0x13')]);}})[_0x5e77('0x15')](function(_0x811c6){logger[_0x5e77('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x4ed390,_0x811c6);_0x2fb0ad(_0x811c6);});});}exports['CreateCmHopperFinal']=function(_0x4e59b8){var _0x2169df=this;return new Promise(function(_0x645e33,_0x491f3e){return db['CmHopperFinal'][_0x5e77('0x16')](_0x4e59b8[_0x5e77('0x17')],{'raw':_0x4e59b8[_0x5e77('0x18')]?_0x4e59b8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x50ee2f){logger[_0x5e77('0xb')]('CreateCmHopperFinal',_0x4e59b8);logger[_0x5e77('0xd')](_0x5e77('0x19'),_0x4e59b8,JSON['stringify'](_0x50ee2f));_0x645e33(_0x50ee2f);})['catch'](function(_0x593369){logger[_0x5e77('0x10')](_0x5e77('0x19'),_0x593369[_0x5e77('0x13')],_0x4e59b8);_0x491f3e(_0x2169df['error'](0x1f4,_0x593369['message']));});});}; \ No newline at end of file +var _0x31d2=['result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x32cea8,_0x15386a){var _0x2ee456=function(_0x48281d){while(--_0x48281d){_0x32cea8['push'](_0x32cea8['shift']());}};_0x2ee456(++_0x15386a);}(_0x31d2,0x64));var _0x231d=function(_0x451074,_0x2a418f){_0x451074=_0x451074-0x0;var _0x5e05ab=_0x31d2[_0x451074];return _0x5e05ab;};'use strict';var _=require(_0x231d('0x0'));var util=require(_0x231d('0x1'));var moment=require(_0x231d('0x2'));var BPromise=require(_0x231d('0x3'));var rs=require(_0x231d('0x4'));var fs=require('fs');var Redis=require(_0x231d('0x5'));var db=require(_0x231d('0x6'))['db'];var utils=require(_0x231d('0x7'));var logger=require(_0x231d('0x8'))(_0x231d('0x9'));var config=require(_0x231d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x231d('0xb')][_0x231d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59bac7,_0x481087,_0x46558a){return new BPromise(function(_0x54b7f4,_0x2872c8){return client[_0x231d('0xd')](_0x59bac7,_0x46558a)[_0x231d('0xe')](function(_0x1f70a2){logger[_0x231d('0xf')](_0x231d('0x10'),_0x481087,'request\x20sent');logger[_0x231d('0x11')](_0x231d('0x12'),_0x481087,'request\x20sent',JSON[_0x231d('0x13')](_0x1f70a2));if(_0x1f70a2[_0x231d('0x14')]){if(_0x1f70a2['error'][_0x231d('0x15')]===0x1f4){logger[_0x231d('0x14')](_0x231d('0x10'),_0x481087,_0x1f70a2[_0x231d('0x14')][_0x231d('0x16')]);return _0x2872c8(_0x1f70a2[_0x231d('0x14')][_0x231d('0x16')]);}logger[_0x231d('0x14')](_0x231d('0x10'),_0x481087,_0x1f70a2[_0x231d('0x14')]['message']);return _0x54b7f4(_0x1f70a2[_0x231d('0x14')][_0x231d('0x16')]);}else{logger['info'](_0x231d('0x10'),_0x481087,_0x231d('0x17'));_0x54b7f4(_0x1f70a2[_0x231d('0x18')][_0x231d('0x16')]);}})[_0x231d('0x19')](function(_0x57e60f){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x481087,_0x57e60f);_0x2872c8(_0x57e60f);});});}exports[_0x231d('0x1a')]=function(_0x316915){var _0x4dfcfc=this;return new Promise(function(_0x2e2d2e,_0x40ee37){return db[_0x231d('0x1b')][_0x231d('0x1c')](_0x316915[_0x231d('0x1d')],{'raw':_0x316915['options']?_0x316915[_0x231d('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x231d('0xe')](function(_0x3550f8){logger['info'](_0x231d('0x1a'),_0x316915);logger[_0x231d('0x11')](_0x231d('0x1a'),_0x316915,JSON['stringify'](_0x3550f8));_0x2e2d2e(_0x3550f8);})['catch'](function(_0x3ee89f){logger[_0x231d('0x14')](_0x231d('0x1a'),_0x3ee89f[_0x231d('0x16')],_0x316915);_0x40ee37(_0x4dfcfc[_0x231d('0x14')](0x1f4,_0x3ee89f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 58f1430..764cbb4 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 _0xb36c=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb36c,0x19a));var _0xcb36=function(_0x3a10bd,_0x26e147){_0x3a10bd=_0x3a10bd-0x0;var _0x37c6b3=_0xb36c[_0x3a10bd];return _0x37c6b3;};'use strict';var multer=require('multer');var util=require(_0xcb36('0x0'));var path=require(_0xcb36('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb36('0x2'));var router=express[_0xcb36('0x3')]();var fs_extra=require(_0xcb36('0x4'));var auth=require(_0xcb36('0x5'));var interaction=require(_0xcb36('0x6'));var config=require(_0xcb36('0x7'));var controller=require(_0xcb36('0x8'));router[_0xcb36('0x9')]('/',auth[_0xcb36('0xa')](),controller['index']);router[_0xcb36('0x9')](_0xcb36('0xb'),auth[_0xcb36('0xa')](),controller[_0xcb36('0xc')]);router['get']('/:id',auth[_0xcb36('0xa')](),controller[_0xcb36('0xd')]);router[_0xcb36('0x9')](_0xcb36('0xe'),auth[_0xcb36('0xa')](),controller[_0xcb36('0xf')]);router[_0xcb36('0x9')](_0xcb36('0x10'),auth[_0xcb36('0xa')](),controller[_0xcb36('0x11')]);router[_0xcb36('0x12')](_0xcb36('0x13'),auth[_0xcb36('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xcb36('0x12')]('/voice/campaign/moveContacts/:id',auth[_0xcb36('0xa')](),controller[_0xcb36('0x14')]);router[_0xcb36('0x12')](_0xcb36('0x15'),auth[_0xcb36('0xa')](),controller[_0xcb36('0x16')]);router[_0xcb36('0x17')](_0xcb36('0x18'),auth[_0xcb36('0xa')](),controller['update']);module[_0xcb36('0x19')]=router; \ No newline at end of file +var _0x2283=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','/:id','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','describe','show','countContactsQueueCampaignHopperFinal','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2283,0x16e));var _0x3228=function(_0x26fc3f,_0x362887){_0x26fc3f=_0x26fc3f-0x0;var _0x2976c9=_0x2283[_0x26fc3f];return _0x2976c9;};'use strict';var multer=require(_0x3228('0x0'));var util=require('util');var path=require(_0x3228('0x1'));var timeout=require(_0x3228('0x2'));var express=require(_0x3228('0x3'));var router=express[_0x3228('0x4')]();var fs_extra=require(_0x3228('0x5'));var auth=require(_0x3228('0x6'));var interaction=require(_0x3228('0x7'));var config=require(_0x3228('0x8'));var controller=require(_0x3228('0x9'));router[_0x3228('0xa')]('/',auth['isAuthenticated'](),controller[_0x3228('0xb')]);router['get'](_0x3228('0xc'),auth[_0x3228('0xd')](),controller[_0x3228('0xe')]);router[_0x3228('0xa')]('/:id',auth[_0x3228('0xd')](),controller[_0x3228('0xf')]);router[_0x3228('0xa')]('/voice/queue/countAttributes/:id',auth[_0x3228('0xd')](),controller[_0x3228('0x10')]);router[_0x3228('0xa')]('/campaign/countAttributes/:id',auth[_0x3228('0xd')](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x3228('0xd')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x3228('0x11')](_0x3228('0x12'),auth[_0x3228('0xd')](),controller[_0x3228('0x13')]);router[_0x3228('0x11')](_0x3228('0x14'),auth[_0x3228('0xd')](),controller['checkContactHopper']);router['put'](_0x3228('0x15'),auth['isAuthenticated'](),controller[_0x3228('0x16')]);module[_0x3228('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 4daeef0..a775925 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 _0x1fa0=['STRING','INTEGER','DATE','BOOLEAN'];(function(_0x4f1ff3,_0x2736a1){var _0x1768a5=function(_0xa12836){while(--_0xa12836){_0x4f1ff3['push'](_0x4f1ff3['shift']());}};_0x1768a5(++_0x2736a1);}(_0x1fa0,0x1f0));var _0x01fa=function(_0x52a010,_0xa10fd4){_0x52a010=_0x52a010-0x0;var _0x1373da=_0x1fa0[_0x52a010];return _0x1373da;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x01fa('0x0')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x01fa('0x0')]},'originatecalleridnum':{'type':Sequelize[_0x01fa('0x0')]},'originatecalleridname':{'type':Sequelize[_0x01fa('0x0')]},'calleridnum':{'type':Sequelize[_0x01fa('0x0')]},'calleridname':{'type':Sequelize[_0x01fa('0x0')]},'starttime':{'type':Sequelize[_0x01fa('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x01fa('0x2')]},'droptime':{'type':Sequelize[_0x01fa('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x01fa('0x0')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x01fa('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0x01fa('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x01fa('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x01fa('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x01fa('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x01fa('0x2')]},'edited':{'type':Sequelize[_0x01fa('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x01fa('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x76e4=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76e4,0x92));var _0x476e=function(_0x5c204b,_0x4e9c92){_0x5c204b=_0x5c204b-0x0;var _0x175c83=_0x76e4[_0x5c204b];return _0x175c83;};'use strict';var Sequelize=require(_0x476e('0x0'));module['exports']={'state':{'type':Sequelize[_0x476e('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x476e('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x476e('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x476e('0x2')]},'originatecalleridname':{'type':Sequelize[_0x476e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x476e('0x2')]},'starttime':{'type':Sequelize[_0x476e('0x3')]},'responsetime':{'type':Sequelize[_0x476e('0x3')]},'answertime':{'type':Sequelize[_0x476e('0x3')]},'droptime':{'type':Sequelize[_0x476e('0x3')]},'endtime':{'type':Sequelize[_0x476e('0x3')]},'ringtime':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x476e('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x476e('0x2')]},'membername':{'type':Sequelize[_0x476e('0x2')]},'reason':{'type':Sequelize[_0x476e('0x2')]},'amd':{'type':Sequelize[_0x476e('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x476e('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x476e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x476e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x476e('0x3')]},'recallme':{'type':Sequelize[_0x476e('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x476e('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0d7d219..6fc5443 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 _0xf3cd=['filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','length','catch','create','body','describe','update','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','CmHopperHistory','rawAttributes','type','key','query','keys'];(function(_0x5c25b8,_0x2f3abd){var _0x5bb79c=function(_0x32e5a0){while(--_0x32e5a0){_0x5c25b8['push'](_0x5c25b8['shift']());}};_0x5bb79c(++_0x2f3abd);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x224dda,_0x16d0f9){_0x224dda=_0x224dda-0x0;var _0x2987ac=_0xf3cd[_0x224dda];return _0x2987ac;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xc'));var _=require(_0xdf3c('0xd'));var squel=require(_0xdf3c('0xe'));var crypto=require('crypto');var jsforce=require(_0xdf3c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdf3c('0x10'));var Papa=require(_0xdf3c('0x11'));var Redis=require('ioredis');var authService=require(_0xdf3c('0x12'));var qs=require(_0xdf3c('0x13'));var as=require(_0xdf3c('0x14'));var hardwareService=require(_0xdf3c('0x15'));var logger=require(_0xdf3c('0x16'))(_0xdf3c('0x17'));var utils=require(_0xdf3c('0x18'));var config=require(_0xdf3c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf3c('0x1a'))['db'];function respondWithStatusCode(_0x166ae5,_0x41fc33){_0x41fc33=_0x41fc33||0xcc;return function(_0x17319c){if(_0x17319c){return _0x166ae5['sendStatus'](_0x41fc33);}return _0x166ae5[_0xdf3c('0x1b')](_0x41fc33)[_0xdf3c('0x1c')]();};}function respondWithResult(_0x13ea5f,_0x5e0047){_0x5e0047=_0x5e0047||0xc8;return function(_0x18aafa){if(_0x18aafa){return _0x13ea5f[_0xdf3c('0x1b')](_0x5e0047)[_0xdf3c('0x1d')](_0x18aafa);}};}function respondWithFilteredResult(_0x4274fd,_0x21e587){return function(_0x1a7a5a){if(_0x1a7a5a){var _0x305ea5=_0x1a7a5a['count'],_0x92008b=_0x21e587[_0xdf3c('0x1e')],_0x2986d0=_0x21e587[_0xdf3c('0x1e')]+_0x21e587[_0xdf3c('0x1f')],_0x5d3991;if(_0x2986d0>=_0x305ea5){_0x2986d0=_0x305ea5;_0x5d3991=0xc8;}else{_0x5d3991=0xce;}_0x4274fd[_0xdf3c('0x1b')](_0x5d3991);return _0x4274fd[_0xdf3c('0x20')](_0xdf3c('0x21'),_0x92008b+'-'+_0x2986d0+'/'+_0x305ea5)[_0xdf3c('0x1d')](_0x1a7a5a);}return null;};}function patchUpdates(_0x3ee0af){return function(_0x426f3a){try{jsonpatch[_0xdf3c('0x22')](_0x426f3a,_0x3ee0af,!![]);}catch(_0x267488){return BPromise[_0xdf3c('0x23')](_0x267488);}return _0x426f3a[_0xdf3c('0x24')]();};}function saveUpdates(_0x5d2390,_0x4d620f){return function(_0x3aa254){if(_0x3aa254){return _0x3aa254['update'](_0x5d2390)[_0xdf3c('0x25')](function(_0x40e7ec){return _0x40e7ec;});}return null;};}function removeEntity(_0x36552e,_0x38b319){return function(_0x33652f){if(_0x33652f){return _0x33652f[_0xdf3c('0x26')]()['then'](function(){_0x36552e[_0xdf3c('0x1b')](0xcc)[_0xdf3c('0x1c')]();});}};}function handleEntityNotFound(_0x13e3ca,_0x24754a){return function(_0x40032a){if(!_0x40032a){_0x13e3ca[_0xdf3c('0x27')](0x194);}return _0x40032a;};}function handleError(_0xef54cb,_0x155f54){_0x155f54=_0x155f54||0x1f4;return function(_0x18cb46){logger[_0xdf3c('0x28')](_0x18cb46['stack']);if(_0x18cb46[_0xdf3c('0x29')]){delete _0x18cb46[_0xdf3c('0x29')];}_0xef54cb['status'](_0x155f54)[_0xdf3c('0x2a')](_0x18cb46);};}exports['index']=function(_0x4eaced,_0x508be9){var _0x14aac9={},_0x186bba={},_0x52b8f6={'count':0x0,'rows':[]};var _0x5c3b5a=_[_0xdf3c('0x2b')](db[_0xdf3c('0x2c')][_0xdf3c('0x2d')],function(_0x1ccdd4){return{'name':_0x1ccdd4['fieldName'],'type':_0x1ccdd4[_0xdf3c('0x2e')][_0xdf3c('0x2f')]};});_0x186bba['model']=_['map'](_0x5c3b5a,_0xdf3c('0x29'));_0x186bba[_0xdf3c('0x30')]=_[_0xdf3c('0x31')](_0x4eaced['query']);_0x186bba[_0xdf3c('0x32')]=_[_0xdf3c('0x33')](_0x186bba[_0xdf3c('0x34')],_0x186bba[_0xdf3c('0x30')]);_0x14aac9['attributes']=_[_0xdf3c('0x33')](_0x186bba[_0xdf3c('0x34')],qs['fields'](_0x4eaced[_0xdf3c('0x30')][_0xdf3c('0x35')]));_0x14aac9[_0xdf3c('0x36')]=_0x14aac9[_0xdf3c('0x36')]['length']?_0x14aac9[_0xdf3c('0x36')]:_0x186bba[_0xdf3c('0x34')];if(!_0x4eaced[_0xdf3c('0x30')][_0xdf3c('0x37')]('nolimit')){_0x14aac9[_0xdf3c('0x1f')]=qs[_0xdf3c('0x1f')](_0x4eaced['query']['limit']);_0x14aac9[_0xdf3c('0x1e')]=qs['offset'](_0x4eaced[_0xdf3c('0x30')]['offset']);}_0x14aac9['order']=qs['sort'](_0x4eaced[_0xdf3c('0x30')][_0xdf3c('0x38')]);_0x14aac9[_0xdf3c('0x39')]=qs[_0xdf3c('0x32')](_['pick'](_0x4eaced['query'],_0x186bba[_0xdf3c('0x32')]),_0x5c3b5a);if(_0x4eaced['query'][_0xdf3c('0x3a')]){_0x14aac9[_0xdf3c('0x39')]=_[_0xdf3c('0x3b')](_0x14aac9[_0xdf3c('0x39')],{'$or':_[_0xdf3c('0x2b')](_0x5c3b5a,function(_0x1e0cf2){if(_0x1e0cf2[_0xdf3c('0x2e')]!==_0xdf3c('0x3c')){var _0x398c76={};_0x398c76[_0x1e0cf2['name']]={'$like':'%'+_0x4eaced[_0xdf3c('0x30')]['filter']+'%'};return _0x398c76;}})});}_0x14aac9=_['merge']({},_0x14aac9,_0x4eaced[_0xdf3c('0x3d')]);var _0x47f760={'where':_0x14aac9[_0xdf3c('0x39')]};return db['CmHopperHistory'][_0xdf3c('0x3e')](_0x47f760)[_0xdf3c('0x25')](function(_0x1c6dee){_0x52b8f6[_0xdf3c('0x3e')]=_0x1c6dee;if(_0x4eaced[_0xdf3c('0x30')][_0xdf3c('0x3f')]){_0x14aac9[_0xdf3c('0x40')]=[{'all':!![]}];}return db[_0xdf3c('0x2c')][_0xdf3c('0x41')](_0x14aac9);})[_0xdf3c('0x25')](function(_0x424acf){_0x52b8f6[_0xdf3c('0x42')]=_0x424acf;return _0x52b8f6;})['then'](respondWithFilteredResult(_0x508be9,_0x14aac9))['catch'](handleError(_0x508be9,null));};exports[_0xdf3c('0x43')]=function(_0x5752e6,_0x3a6527){var _0x14d8e1={'raw':!![],'where':{'id':_0x5752e6[_0xdf3c('0x44')]['id']}},_0x46194d={};_0x46194d['model']=_['keys'](db[_0xdf3c('0x2c')][_0xdf3c('0x2d')]);_0x46194d[_0xdf3c('0x30')]=_['keys'](_0x5752e6[_0xdf3c('0x30')]);_0x46194d[_0xdf3c('0x32')]=_[_0xdf3c('0x33')](_0x46194d[_0xdf3c('0x34')],_0x46194d['query']);_0x14d8e1[_0xdf3c('0x36')]=_[_0xdf3c('0x33')](_0x46194d[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x5752e6[_0xdf3c('0x30')]['fields']));_0x14d8e1[_0xdf3c('0x36')]=_0x14d8e1[_0xdf3c('0x36')][_0xdf3c('0x45')]?_0x14d8e1[_0xdf3c('0x36')]:_0x46194d[_0xdf3c('0x34')];if(_0x5752e6[_0xdf3c('0x30')]['includeAll']){_0x14d8e1['include']=[{'all':!![]}];}_0x14d8e1=_[_0xdf3c('0x3b')]({},_0x14d8e1,_0x5752e6[_0xdf3c('0x3d')]);return db['CmHopperHistory']['find'](_0x14d8e1)[_0xdf3c('0x25')](handleEntityNotFound(_0x3a6527,null))[_0xdf3c('0x25')](respondWithResult(_0x3a6527,null))[_0xdf3c('0x46')](handleError(_0x3a6527,null));};exports[_0xdf3c('0x47')]=function(_0xaae4bc,_0x2dbf54){return db[_0xdf3c('0x2c')][_0xdf3c('0x47')](_0xaae4bc[_0xdf3c('0x48')],{})['then'](respondWithResult(_0x2dbf54,0xc9))[_0xdf3c('0x46')](handleError(_0x2dbf54,null));};exports[_0xdf3c('0x49')]=function(_0x1c293d,_0xe760dd){return db[_0xdf3c('0x2c')][_0xdf3c('0x49')]()[_0xdf3c('0x25')](respondWithResult(_0xe760dd,null))['catch'](handleError(_0xe760dd,null));};exports[_0xdf3c('0x4a')]=function(_0x5c1dca,_0xa4e137){if(_0x5c1dca['body'][_0xdf3c('0x4b')]){delete _0x5c1dca[_0xdf3c('0x48')][_0xdf3c('0x4b')];}return db[_0xdf3c('0x2c')]['find']({'where':{'uniqueid':_0x5c1dca['params']['id']}})['then'](handleEntityNotFound(_0xa4e137,null))[_0xdf3c('0x25')](saveUpdates(_0x5c1dca['body'],null))[_0xdf3c('0x25')](respondWithResult(_0xa4e137,null))[_0xdf3c('0x46')](handleError(_0xa4e137,null));}; \ No newline at end of file +var _0x9f62=['status','end','json','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','findAll','catch','show','include','options','find','create','body','describe','update','uniqueid','params','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9f62,0x154));var _0x29f6=function(_0x577b4b,_0x33e24f){_0x577b4b=_0x577b4b-0x0;var _0x1755d6=_0x9f62[_0x577b4b];return _0x1755d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x1'));var jsonpatch=require(_0x29f6('0x2'));var rp=require(_0x29f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29f6('0x4'));var util=require(_0x29f6('0x5'));var path=require(_0x29f6('0x6'));var sox=require(_0x29f6('0x7'));var csv=require('to-csv');var ejs=require(_0x29f6('0x8'));var fs=require('fs');var fs_extra=require(_0x29f6('0x9'));var _=require(_0x29f6('0xa'));var squel=require(_0x29f6('0xb'));var crypto=require(_0x29f6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29f6('0xd'));var Redis=require(_0x29f6('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29f6('0xf'));var hardwareService=require(_0x29f6('0x10'));var logger=require('../../config/logger')(_0x29f6('0x11'));var utils=require(_0x29f6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57b2d2,_0x2ae0e4){_0x2ae0e4=_0x2ae0e4||0xcc;return function(_0x55cf4){if(_0x55cf4){return _0x57b2d2[_0x29f6('0x13')](_0x2ae0e4);}return _0x57b2d2[_0x29f6('0x14')](_0x2ae0e4)[_0x29f6('0x15')]();};}function respondWithResult(_0x156c96,_0x35d2e2){_0x35d2e2=_0x35d2e2||0xc8;return function(_0x2418ee){if(_0x2418ee){return _0x156c96[_0x29f6('0x14')](_0x35d2e2)[_0x29f6('0x16')](_0x2418ee);}};}function respondWithFilteredResult(_0x28d314,_0x370484){return function(_0x1dde97){if(_0x1dde97){var _0x3a75d0=_0x1dde97['count'],_0x25e5a2=_0x370484['offset'],_0x14dd56=_0x370484[_0x29f6('0x17')]+_0x370484[_0x29f6('0x18')],_0x3584a1;if(_0x14dd56>=_0x3a75d0){_0x14dd56=_0x3a75d0;_0x3584a1=0xc8;}else{_0x3584a1=0xce;}_0x28d314[_0x29f6('0x14')](_0x3584a1);return _0x28d314['set'](_0x29f6('0x19'),_0x25e5a2+'-'+_0x14dd56+'/'+_0x3a75d0)[_0x29f6('0x16')](_0x1dde97);}return null;};}function patchUpdates(_0x49252f){return function(_0x159227){try{jsonpatch[_0x29f6('0x1a')](_0x159227,_0x49252f,!![]);}catch(_0x42a8fa){return BPromise[_0x29f6('0x1b')](_0x42a8fa);}return _0x159227[_0x29f6('0x1c')]();};}function saveUpdates(_0x2bfb3d,_0x5673c8){return function(_0xfb8fd2){if(_0xfb8fd2){return _0xfb8fd2['update'](_0x2bfb3d)['then'](function(_0x470019){return _0x470019;});}return null;};}function removeEntity(_0x1fa159,_0x39c6b3){return function(_0xafb5dd){if(_0xafb5dd){return _0xafb5dd['destroy']()[_0x29f6('0x1d')](function(){_0x1fa159['status'](0xcc)[_0x29f6('0x15')]();});}};}function handleEntityNotFound(_0xcce041,_0x4200cc){return function(_0x1b80aa){if(!_0x1b80aa){_0xcce041['sendStatus'](0x194);}return _0x1b80aa;};}function handleError(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0x1f4;return function(_0x47c385){logger[_0x29f6('0x1e')](_0x47c385[_0x29f6('0x1f')]);if(_0x47c385[_0x29f6('0x20')]){delete _0x47c385[_0x29f6('0x20')];}_0x4290a2[_0x29f6('0x14')](_0x4d494f)[_0x29f6('0x21')](_0x47c385);};}exports[_0x29f6('0x22')]=function(_0x50cdd2,_0x2183b7){var _0x454a4a={},_0x1ab8d8={},_0x3dace7={'count':0x0,'rows':[]};var _0xda0a63=_[_0x29f6('0x23')](db[_0x29f6('0x24')][_0x29f6('0x25')],function(_0x3d88db){return{'name':_0x3d88db[_0x29f6('0x26')],'type':_0x3d88db[_0x29f6('0x27')][_0x29f6('0x28')]};});_0x1ab8d8[_0x29f6('0x29')]=_[_0x29f6('0x23')](_0xda0a63,_0x29f6('0x20'));_0x1ab8d8[_0x29f6('0x2a')]=_[_0x29f6('0x2b')](_0x50cdd2['query']);_0x1ab8d8['filters']=_[_0x29f6('0x2c')](_0x1ab8d8['model'],_0x1ab8d8[_0x29f6('0x2a')]);_0x454a4a[_0x29f6('0x2d')]=_[_0x29f6('0x2c')](_0x1ab8d8[_0x29f6('0x29')],qs['fields'](_0x50cdd2['query'][_0x29f6('0x2e')]));_0x454a4a[_0x29f6('0x2d')]=_0x454a4a[_0x29f6('0x2d')][_0x29f6('0x2f')]?_0x454a4a[_0x29f6('0x2d')]:_0x1ab8d8[_0x29f6('0x29')];if(!_0x50cdd2[_0x29f6('0x2a')][_0x29f6('0x30')](_0x29f6('0x31'))){_0x454a4a[_0x29f6('0x18')]=qs[_0x29f6('0x18')](_0x50cdd2[_0x29f6('0x2a')][_0x29f6('0x18')]);_0x454a4a[_0x29f6('0x17')]=qs['offset'](_0x50cdd2['query'][_0x29f6('0x17')]);}_0x454a4a[_0x29f6('0x32')]=qs[_0x29f6('0x33')](_0x50cdd2['query'][_0x29f6('0x33')]);_0x454a4a[_0x29f6('0x34')]=qs[_0x29f6('0x35')](_[_0x29f6('0x36')](_0x50cdd2[_0x29f6('0x2a')],_0x1ab8d8['filters']),_0xda0a63);if(_0x50cdd2[_0x29f6('0x2a')][_0x29f6('0x37')]){_0x454a4a[_0x29f6('0x34')]=_[_0x29f6('0x38')](_0x454a4a['where'],{'$or':_[_0x29f6('0x23')](_0xda0a63,function(_0x2a09e8){if(_0x2a09e8[_0x29f6('0x27')]!==_0x29f6('0x39')){var _0x5ddc09={};_0x5ddc09[_0x2a09e8['name']]={'$like':'%'+_0x50cdd2[_0x29f6('0x2a')]['filter']+'%'};return _0x5ddc09;}})});}_0x454a4a=_[_0x29f6('0x38')]({},_0x454a4a,_0x50cdd2['options']);var _0x3a1a75={'where':_0x454a4a['where']};return db[_0x29f6('0x24')][_0x29f6('0x3a')](_0x3a1a75)['then'](function(_0x1431fc){_0x3dace7['count']=_0x1431fc;if(_0x50cdd2[_0x29f6('0x2a')][_0x29f6('0x3b')]){_0x454a4a['include']=[{'all':!![]}];}return db[_0x29f6('0x24')][_0x29f6('0x3c')](_0x454a4a);})[_0x29f6('0x1d')](function(_0x1e9d5a){_0x3dace7['rows']=_0x1e9d5a;return _0x3dace7;})[_0x29f6('0x1d')](respondWithFilteredResult(_0x2183b7,_0x454a4a))[_0x29f6('0x3d')](handleError(_0x2183b7,null));};exports[_0x29f6('0x3e')]=function(_0x2322eb,_0x1dbd17){var _0x4d4189={'raw':!![],'where':{'id':_0x2322eb['params']['id']}},_0xb5f2b1={};_0xb5f2b1[_0x29f6('0x29')]=_['keys'](db[_0x29f6('0x24')][_0x29f6('0x25')]);_0xb5f2b1['query']=_[_0x29f6('0x2b')](_0x2322eb[_0x29f6('0x2a')]);_0xb5f2b1[_0x29f6('0x35')]=_[_0x29f6('0x2c')](_0xb5f2b1['model'],_0xb5f2b1[_0x29f6('0x2a')]);_0x4d4189[_0x29f6('0x2d')]=_[_0x29f6('0x2c')](_0xb5f2b1['model'],qs[_0x29f6('0x2e')](_0x2322eb['query'][_0x29f6('0x2e')]));_0x4d4189['attributes']=_0x4d4189['attributes']['length']?_0x4d4189[_0x29f6('0x2d')]:_0xb5f2b1[_0x29f6('0x29')];if(_0x2322eb[_0x29f6('0x2a')][_0x29f6('0x3b')]){_0x4d4189[_0x29f6('0x3f')]=[{'all':!![]}];}_0x4d4189=_[_0x29f6('0x38')]({},_0x4d4189,_0x2322eb[_0x29f6('0x40')]);return db[_0x29f6('0x24')][_0x29f6('0x41')](_0x4d4189)[_0x29f6('0x1d')](handleEntityNotFound(_0x1dbd17,null))['then'](respondWithResult(_0x1dbd17,null))['catch'](handleError(_0x1dbd17,null));};exports[_0x29f6('0x42')]=function(_0x450e76,_0x7a65c0){return db[_0x29f6('0x24')]['create'](_0x450e76[_0x29f6('0x43')],{})[_0x29f6('0x1d')](respondWithResult(_0x7a65c0,0xc9))['catch'](handleError(_0x7a65c0,null));};exports[_0x29f6('0x44')]=function(_0xd8514a,_0x123e2f){return db[_0x29f6('0x24')][_0x29f6('0x44')]()[_0x29f6('0x1d')](respondWithResult(_0x123e2f,null))[_0x29f6('0x3d')](handleError(_0x123e2f,null));};exports[_0x29f6('0x45')]=function(_0x2ca712,_0x8c2072){if(_0x2ca712[_0x29f6('0x43')][_0x29f6('0x46')]){delete _0x2ca712['body'][_0x29f6('0x46')];}return db[_0x29f6('0x24')][_0x29f6('0x41')]({'where':{'uniqueid':_0x2ca712[_0x29f6('0x47')]['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x8c2072,null))['then'](saveUpdates(_0x2ca712[_0x29f6('0x43')],null))['then'](respondWithResult(_0x8c2072,null))['catch'](handleError(_0x8c2072,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index fbc0099..bfb9e58 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 _0x3d92=['util','../../config/logger','moment','bluebird','request-promise','path','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3d92,0x1eb));var _0x23d9=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x3d92[_0xb98d8d];return _0x489b15;};'use strict';var _=require(_0x23d9('0x0'));var util=require(_0x23d9('0x1'));var logger=require(_0x23d9('0x2'))('api');var moment=require(_0x23d9('0x3'));var BPromise=require(_0x23d9('0x4'));var rp=require(_0x23d9('0x5'));var fs=require('fs');var path=require(_0x23d9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x23d9('0x7'));module['exports']=function(_0x4f66e4,_0x58d9f0){return _0x4f66e4['define'](_0x23d9('0x8'),attributes,{'tableName':_0x23d9('0x9'),'paranoid':![],'indexes':[{'name':_0x23d9('0xa'),'fields':[_0x23d9('0xa')]},{'name':_0x23d9('0xb'),'fields':[_0x23d9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb72e=['path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb72e,0x8a));var _0xeb72=function(_0x112f94,_0x559778){_0x112f94=_0x112f94-0x0;var _0x5db31c=_0xb72e[_0x112f94];return _0x5db31c;};'use strict';var _=require(_0xeb72('0x0'));var util=require(_0xeb72('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeb72('0x2'));var BPromise=require(_0xeb72('0x3'));var rp=require(_0xeb72('0x4'));var fs=require('fs');var path=require(_0xeb72('0x5'));var rimraf=require('rimraf');var config=require(_0xeb72('0x6'));var attributes=require(_0xeb72('0x7'));module[_0xeb72('0x8')]=function(_0x5a1e1d,_0xd1e881){return _0x5a1e1d[_0xeb72('0x9')](_0xeb72('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xeb72('0xb'),'fields':[_0xeb72('0xb')]},{'name':'uniqueid','fields':[_0xeb72('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 c3a5a1a..69106dd 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 _0xdcd2=['`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay'];(function(_0x59c369,_0x10cddc){var _0xb57a5f=function(_0x1f3873){while(--_0x1f3873){_0x59c369['push'](_0x59c369['shift']());}};_0xb57a5f(++_0x10cddc);}(_0xdcd2,0x151));var _0x2dcd=function(_0x13ac8d,_0x40016d){_0x13ac8d=_0x13ac8d-0x0;var _0x449d2f=_0xdcd2[_0x13ac8d];return _0x449d2f;};'use strict';var _=require(_0x2dcd('0x0'));var util=require(_0x2dcd('0x1'));var moment=require(_0x2dcd('0x2'));var BPromise=require(_0x2dcd('0x3'));var rs=require(_0x2dcd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2dcd('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2dcd('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2dcd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34496d,_0x3bfc71,_0x5d484d){return new BPromise(function(_0x3cb110,_0x23ea7e){return client[_0x2dcd('0x8')](_0x34496d,_0x5d484d)[_0x2dcd('0x9')](function(_0x237ffa){logger[_0x2dcd('0xa')](_0x2dcd('0xb'),_0x3bfc71,_0x2dcd('0xc'));logger[_0x2dcd('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3bfc71,'request\x20sent',JSON[_0x2dcd('0xe')](_0x237ffa));if(_0x237ffa[_0x2dcd('0xf')]){if(_0x237ffa[_0x2dcd('0xf')][_0x2dcd('0x10')]===0x1f4){logger[_0x2dcd('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x3bfc71,_0x237ffa[_0x2dcd('0xf')][_0x2dcd('0x11')]);return _0x23ea7e(_0x237ffa[_0x2dcd('0xf')][_0x2dcd('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3bfc71,_0x237ffa['error']['message']);return _0x3cb110(_0x237ffa[_0x2dcd('0xf')][_0x2dcd('0x11')]);}else{logger[_0x2dcd('0xa')](_0x2dcd('0xb'),_0x3bfc71,'request\x20sent');_0x3cb110(_0x237ffa['result'][_0x2dcd('0x11')]);}})[_0x2dcd('0x12')](function(_0x29408c){logger['error'](_0x2dcd('0xb'),_0x3bfc71,_0x29408c);_0x23ea7e(_0x29408c);});});}exports[_0x2dcd('0x13')]=function(_0x2805c2){var _0x531d48=this;return new Promise(function(_0x16c2e5,_0x525bea){return db[_0x2dcd('0x14')][_0x2dcd('0x15')](_0x2805c2[_0x2dcd('0x16')],{'raw':_0x2805c2[_0x2dcd('0x17')]?_0x2805c2['options'][_0x2dcd('0x18')]===undefined?!![]:![]:!![]})[_0x2dcd('0x9')](function(_0x27d231){logger[_0x2dcd('0xa')](_0x2dcd('0x13'),_0x2805c2);logger['debug'](_0x2dcd('0x13'),_0x2805c2,JSON[_0x2dcd('0xe')](_0x27d231));_0x16c2e5(_0x27d231);})[_0x2dcd('0x12')](function(_0x410a0e){logger['error']('CreateCmHopperHistory',_0x410a0e[_0x2dcd('0x11')],_0x2805c2);_0x525bea(_0x531d48['error'](0x1f4,_0x410a0e[_0x2dcd('0x11')]));});});};exports[_0x2dcd('0x19')]=function(_0x2a5af5){var _0x368621=this;return new Promise(function(_0x5eb1b5,_0x1a65b9){return db['CmHopperHistory']['findAll']({'raw':_0x2a5af5['options']?_0x2a5af5[_0x2dcd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2a5af5[_0x2dcd('0x17')]?_0x2a5af5[_0x2dcd('0x17')][_0x2dcd('0x1a')]||null:null,'attributes':[[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db[_0x2dcd('0x1b')][_0x2dcd('0x1d')]('id')),_0x2dcd('0x1e')],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')](_0x2dcd('0x20')))),_0x2dcd('0x21')],[db['sequelize']['fn'](_0x2dcd('0x1c'),db[_0x2dcd('0x1b')]['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')]['literal'](_0x2dcd('0x22')))),_0x2dcd('0x23')],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x24'),db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x2dcd('0x25')],[db[_0x2dcd('0x1b')]['fn']('AVG',db[_0x2dcd('0x1b')]['fn']('IF',db[_0x2dcd('0x1b')]['literal'](_0x2dcd('0x26')))),_0x2dcd('0x27')]]})[_0x2dcd('0x9')](function(_0x2e894d){logger[_0x2dcd('0xa')](_0x2dcd('0x19'),_0x2a5af5);logger[_0x2dcd('0xd')](_0x2dcd('0x19'),_0x2a5af5,JSON[_0x2dcd('0xe')](_0x2e894d));_0x5eb1b5(_0x2e894d);})[_0x2dcd('0x12')](function(_0x151276){logger[_0x2dcd('0xf')](_0x2dcd('0x19'),_0x151276[_0x2dcd('0x11')],_0x2a5af5);_0x1a65b9(_0x368621['error'](0x1f4,_0x151276[_0x2dcd('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x114688){var _0x10019d=this;return new Promise(function(_0x54e25d,_0x3992b0){return db[_0x2dcd('0x14')][_0x2dcd('0x28')]({'raw':_0x114688[_0x2dcd('0x17')]?_0x114688[_0x2dcd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x114688[_0x2dcd('0x17')]?_0x114688[_0x2dcd('0x17')][_0x2dcd('0x1a')]||null:null,'attributes':[[_0x2dcd('0x29'),'name'],[db[_0x2dcd('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')](_0x2dcd('0x2a')))),_0x2dcd('0x2b')],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),_0x2dcd('0x2c')],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db[_0x2dcd('0x1b')]['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db[_0x2dcd('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x2dcd('0x2d')))),'outboundBusyCallsDay'],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db[_0x2dcd('0x1b')]['fn']('IF',db['sequelize'][_0x2dcd('0x1f')](_0x2dcd('0x2e')))),_0x2dcd('0x2f')],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')](_0x2dcd('0x30')))),'outboundDropCallsDayTimeout'],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db[_0x2dcd('0x1b')]['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')](_0x2dcd('0x31')))),_0x2dcd('0x32')],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')]['literal'](_0x2dcd('0x33')))),_0x2dcd('0x34')],[db[_0x2dcd('0x1b')]['fn']('COUNT',db[_0x2dcd('0x1b')]['fn']('IF',db['sequelize'][_0x2dcd('0x1f')](_0x2dcd('0x35')))),'outboundBlacklistCallsDay'],[db[_0x2dcd('0x1b')]['fn']('COUNT',db[_0x2dcd('0x1b')]['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')]('`state`\x20=\x2014,\x201,\x20null'))),_0x2dcd('0x36')],[db[_0x2dcd('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')](_0x2dcd('0x37')))),_0x2dcd('0x38')],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db['sequelize']['fn']('IF',db[_0x2dcd('0x1b')]['literal'](_0x2dcd('0x39')))),'outboundAnswerAgiCallsDay'],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db[_0x2dcd('0x1b')]['fn']('IF',db['sequelize'][_0x2dcd('0x1f')](_0x2dcd('0x3a')))),_0x2dcd('0x38')],[db[_0x2dcd('0x1b')]['fn']('COUNT',db[_0x2dcd('0x1b')]['fn']('IF',db['sequelize'][_0x2dcd('0x1f')](_0x2dcd('0x3b')))),_0x2dcd('0x3c')]],'group':[_0x2dcd('0x29')]})['then'](function(_0x56439d){logger[_0x2dcd('0xa')](_0x2dcd('0x3d'),_0x114688);logger['debug'](_0x2dcd('0x3d'),_0x114688,JSON[_0x2dcd('0xe')](_0x56439d));_0x54e25d(_0x56439d);})[_0x2dcd('0x12')](function(_0x51dc5c){logger[_0x2dcd('0xf')](_0x2dcd('0x3d'),_0x51dc5c[_0x2dcd('0x11')],_0x114688);_0x3992b0(_0x10019d[_0x2dcd('0xf')](0x1f4,_0x51dc5c[_0x2dcd('0x11')]));});});};exports[_0x2dcd('0x3e')]=function(_0xbdaad7){var _0x3e97f5=this;return new Promise(function(_0x38ba4f,_0x4687e5){return db['CmHopperHistory'][_0x2dcd('0x28')]({'raw':_0xbdaad7[_0x2dcd('0x17')]?_0xbdaad7['options'][_0x2dcd('0x18')]===undefined?!![]:![]:!![],'where':_0xbdaad7[_0x2dcd('0x17')]?_0xbdaad7[_0x2dcd('0x17')][_0x2dcd('0x1a')]||null:null,'attributes':[['campaign',_0x2dcd('0x3f')],[db[_0x2dcd('0x1b')]['fn'](_0x2dcd('0x1c'),db[_0x2dcd('0x1b')]['col']('id')),'ivrTotalCallsDays'],[db[_0x2dcd('0x1b')]['fn']('COUNT',db[_0x2dcd('0x1b')]['fn']('IF',db[_0x2dcd('0x1b')][_0x2dcd('0x1f')](_0x2dcd('0x20')))),_0x2dcd('0x40')]],'group':[_0x2dcd('0x29')]})[_0x2dcd('0x9')](function(_0x3703af){logger[_0x2dcd('0xa')](_0x2dcd('0x3e'),_0xbdaad7);logger[_0x2dcd('0xd')](_0x2dcd('0x3e'),_0xbdaad7,JSON['stringify'](_0x3703af));_0x38ba4f(_0x3703af);})[_0x2dcd('0x12')](function(_0x4ac486){logger[_0x2dcd('0xf')](_0x2dcd('0x3e'),_0x4ac486['message'],_0xbdaad7);_0x4687e5(_0x3e97f5['error'](0x1f4,_0x4ac486[_0x2dcd('0x11')]));});});}; \ No newline at end of file +var _0x5345=['`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','body','options','CreateCmHopperHistory','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','CmHopperHistory','raw','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x5345,0x17c));var _0x5534=function(_0x11aca4,_0x4fa849){_0x11aca4=_0x11aca4-0x0;var _0x43b74c=_0x5345[_0x11aca4];return _0x43b74c;};'use strict';var _=require(_0x5534('0x0'));var util=require(_0x5534('0x1'));var moment=require('moment');var BPromise=require(_0x5534('0x2'));var rs=require(_0x5534('0x3'));var fs=require('fs');var Redis=require(_0x5534('0x4'));var db=require(_0x5534('0x5'))['db'];var utils=require(_0x5534('0x6'));var logger=require(_0x5534('0x7'))(_0x5534('0x8'));var config=require(_0x5534('0x9'));var jayson=require(_0x5534('0xa'));var client=jayson[_0x5534('0xb')][_0x5534('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bb6b4,_0x492c4d,_0x4c7ef0){return new BPromise(function(_0x1cca6f,_0x203dd2){return client[_0x5534('0xd')](_0x3bb6b4,_0x4c7ef0)[_0x5534('0xe')](function(_0x202c3e){logger[_0x5534('0xf')](_0x5534('0x10'),_0x492c4d,_0x5534('0x11'));logger['debug'](_0x5534('0x12'),_0x492c4d,_0x5534('0x11'),JSON[_0x5534('0x13')](_0x202c3e));if(_0x202c3e['error']){if(_0x202c3e['error'][_0x5534('0x14')]===0x1f4){logger[_0x5534('0x15')](_0x5534('0x10'),_0x492c4d,_0x202c3e[_0x5534('0x15')][_0x5534('0x16')]);return _0x203dd2(_0x202c3e[_0x5534('0x15')]['message']);}logger['error'](_0x5534('0x10'),_0x492c4d,_0x202c3e['error']['message']);return _0x1cca6f(_0x202c3e[_0x5534('0x15')][_0x5534('0x16')]);}else{logger[_0x5534('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x492c4d,_0x5534('0x11'));_0x1cca6f(_0x202c3e[_0x5534('0x17')][_0x5534('0x16')]);}})[_0x5534('0x18')](function(_0x317175){logger[_0x5534('0x15')](_0x5534('0x10'),_0x492c4d,_0x317175);_0x203dd2(_0x317175);});});}exports['CreateCmHopperHistory']=function(_0x2a49e5){var _0x3d8680=this;return new Promise(function(_0x39e970,_0x48ccff){return db['CmHopperHistory']['create'](_0x2a49e5[_0x5534('0x19')],{'raw':_0x2a49e5[_0x5534('0x1a')]?_0x2a49e5[_0x5534('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x41a773){logger[_0x5534('0xf')](_0x5534('0x1b'),_0x2a49e5);logger[_0x5534('0x1c')](_0x5534('0x1b'),_0x2a49e5,JSON['stringify'](_0x41a773));_0x39e970(_0x41a773);})[_0x5534('0x18')](function(_0x358d05){logger['error'](_0x5534('0x1b'),_0x358d05[_0x5534('0x16')],_0x2a49e5);_0x48ccff(_0x3d8680['error'](0x1f4,_0x358d05[_0x5534('0x16')]));});});};exports[_0x5534('0x1d')]=function(_0x3d7407){var _0x22fc33=this;return new Promise(function(_0x3ef72d,_0x1e10cd){return db['CmHopperHistory'][_0x5534('0x1e')]({'raw':_0x3d7407[_0x5534('0x1a')]?_0x3d7407[_0x5534('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3d7407[_0x5534('0x1a')]?_0x3d7407[_0x5534('0x1a')][_0x5534('0x1f')]||null:null,'attributes':[[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')][_0x5534('0x22')]('id')),_0x5534('0x23')],[db['sequelize']['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db['sequelize'][_0x5534('0x24')](_0x5534('0x25')))),_0x5534('0x26')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db['sequelize']['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db[_0x5534('0x20')]['fn']('IF',db['sequelize'][_0x5534('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x5534('0x28'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x29')))),_0x5534('0x2a')],[db[_0x5534('0x20')]['fn'](_0x5534('0x28'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x2b')))),_0x5534('0x2c')]]})[_0x5534('0xe')](function(_0x4d4ff6){logger[_0x5534('0xf')](_0x5534('0x1d'),_0x3d7407);logger['debug'](_0x5534('0x1d'),_0x3d7407,JSON[_0x5534('0x13')](_0x4d4ff6));_0x3ef72d(_0x4d4ff6);})[_0x5534('0x18')](function(_0x253e03){logger['error'](_0x5534('0x1d'),_0x253e03[_0x5534('0x16')],_0x3d7407);_0x1e10cd(_0x22fc33['error'](0x1f4,_0x253e03[_0x5534('0x16')]));});});};exports[_0x5534('0x2d')]=function(_0x942c29){var _0xdb742=this;return new Promise(function(_0x186e29,_0x3b9463){return db[_0x5534('0x2e')]['findAll']({'raw':_0x942c29[_0x5534('0x1a')]?_0x942c29[_0x5534('0x1a')][_0x5534('0x2f')]===undefined?!![]:![]:!![],'where':_0x942c29[_0x5534('0x1a')]?_0x942c29['options'][_0x5534('0x1f')]||null:null,'attributes':[[_0x5534('0x30'),'name'],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db['sequelize'][_0x5534('0x24')](_0x5534('0x31')))),_0x5534('0x32')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x33')))),_0x5534('0x34')],[db['sequelize']['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x25')))),_0x5534('0x35')],[db['sequelize']['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')]['literal'](_0x5534('0x36')))),_0x5534('0x37')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x38')))),_0x5534('0x39')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x3a')))),'outboundDropCallsDayTimeout'],[db[_0x5534('0x20')]['fn']('COUNT',db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x3b')))),_0x5534('0x3c')],[db[_0x5534('0x20')]['fn']('COUNT',db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),_0x5534('0x3d')],[db['sequelize']['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x3e')))),_0x5534('0x3f')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db['sequelize'][_0x5534('0x24')](_0x5534('0x40')))),_0x5534('0x41')],[db['sequelize']['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')](_0x5534('0x42')))),'outboundRejectCallsDay'],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db['sequelize']['fn']('IF',db[_0x5534('0x20')][_0x5534('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),_0x5534('0x43')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db['sequelize'][_0x5534('0x24')](_0x5534('0x44')))),_0x5534('0x45')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x5534('0x30')]})['then'](function(_0x4a20a3){logger[_0x5534('0xf')]('GetVoiceQueueHopperHistory',_0x942c29);logger['debug'](_0x5534('0x2d'),_0x942c29,JSON[_0x5534('0x13')](_0x4a20a3));_0x186e29(_0x4a20a3);})[_0x5534('0x18')](function(_0xdcfdd3){logger[_0x5534('0x15')](_0x5534('0x2d'),_0xdcfdd3[_0x5534('0x16')],_0x942c29);_0x3b9463(_0xdb742['error'](0x1f4,_0xdcfdd3[_0x5534('0x16')]));});});};exports[_0x5534('0x46')]=function(_0x5cfe41){var _0x198819=this;return new Promise(function(_0x1b39ca,_0x13390e){return db[_0x5534('0x2e')][_0x5534('0x1e')]({'raw':_0x5cfe41[_0x5534('0x1a')]?_0x5cfe41[_0x5534('0x1a')][_0x5534('0x2f')]===undefined?!![]:![]:!![],'where':_0x5cfe41['options']?_0x5cfe41['options']['where']||null:null,'attributes':[[_0x5534('0x30'),_0x5534('0x47')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')][_0x5534('0x22')]('id')),_0x5534('0x48')],[db[_0x5534('0x20')]['fn'](_0x5534('0x21'),db[_0x5534('0x20')]['fn']('IF',db[_0x5534('0x20')]['literal'](_0x5534('0x25')))),_0x5534('0x49')]],'group':[_0x5534('0x30')]})[_0x5534('0xe')](function(_0x420ad1){logger[_0x5534('0xf')](_0x5534('0x46'),_0x5cfe41);logger[_0x5534('0x1c')](_0x5534('0x46'),_0x5cfe41,JSON[_0x5534('0x13')](_0x420ad1));_0x1b39ca(_0x420ad1);})[_0x5534('0x18')](function(_0x29e42c){logger['error'](_0x5534('0x46'),_0x29e42c[_0x5534('0x16')],_0x5cfe41);_0x13390e(_0x198819['error'](0x1f4,_0x29e42c[_0x5534('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 90bb6e3..2996ffa 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 _0xbfd2=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','/describe','/:id','isAuthenticated','show','post','put'];(function(_0x129534,_0x560a44){var _0x430eb4=function(_0x3454ab){while(--_0x3454ab){_0x129534['push'](_0x129534['shift']());}};_0x430eb4(++_0x560a44);}(_0xbfd2,0x166));var _0x2bfd=function(_0xa02f30,_0x3eb907){_0xa02f30=_0xa02f30-0x0;var _0x36f284=_0xbfd2[_0xa02f30];return _0x36f284;};'use strict';var multer=require('multer');var util=require(_0x2bfd('0x0'));var path=require(_0x2bfd('0x1'));var timeout=require(_0x2bfd('0x2'));var express=require(_0x2bfd('0x3'));var router=express[_0x2bfd('0x4')]();var fs_extra=require(_0x2bfd('0x5'));var auth=require(_0x2bfd('0x6'));var interaction=require(_0x2bfd('0x7'));var config=require('../../config/environment');var controller=require(_0x2bfd('0x8'));router[_0x2bfd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2bfd('0x9')](_0x2bfd('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x2bfd('0xb'),auth[_0x2bfd('0xc')](),controller[_0x2bfd('0xd')]);router[_0x2bfd('0xe')]('/',auth[_0x2bfd('0xc')](),controller['create']);router[_0x2bfd('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x2bfd('0x10')]=router; \ No newline at end of file +var _0x5c4b=['../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','post','put','/:id','update','multer','util','path','express','Router','fs-extra'];(function(_0x51e1e6,_0x442983){var _0x3835dc=function(_0x3a9c8e){while(--_0x3a9c8e){_0x51e1e6['push'](_0x51e1e6['shift']());}};_0x3835dc(++_0x442983);}(_0x5c4b,0x11a));var _0xb5c4=function(_0x36fc03,_0x1f0b20){_0x36fc03=_0x36fc03-0x0;var _0x2c89aa=_0x5c4b[_0x36fc03];return _0x2c89aa;};'use strict';var multer=require(_0xb5c4('0x0'));var util=require(_0xb5c4('0x1'));var path=require(_0xb5c4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5c4('0x3'));var router=express[_0xb5c4('0x4')]();var fs_extra=require(_0xb5c4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb5c4('0x6'));var config=require(_0xb5c4('0x7'));var controller=require(_0xb5c4('0x8'));router['get']('/',auth[_0xb5c4('0x9')](),controller[_0xb5c4('0xa')]);router[_0xb5c4('0xb')](_0xb5c4('0xc'),auth[_0xb5c4('0x9')](),controller[_0xb5c4('0xd')]);router['get']('/:id',auth[_0xb5c4('0x9')](),controller['show']);router[_0xb5c4('0xe')]('/',auth[_0xb5c4('0x9')](),controller['create']);router[_0xb5c4('0xf')](_0xb5c4('0x10'),auth[_0xb5c4('0x9')](),controller[_0xb5c4('0x11')]);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 2864b1f..24c1801 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 _0x522c=['name','STRING'];(function(_0x3e6258,_0x247fe8){var _0x57e095=function(_0x5ab8fc){while(--_0x5ab8fc){_0x3e6258['push'](_0x3e6258['shift']());}};_0x57e095(++_0x247fe8);}(_0x522c,0xc5));var _0xc522=function(_0x31bddb,_0x478cc5){_0x31bddb=_0x31bddb-0x0;var _0x2c67d4=_0x522c[_0x31bddb];return _0x2c67d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc522('0x0')],'unique':_0xc522('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xc522('0x0')]}}; \ No newline at end of file +var _0xbed8=['exports','STRING','name','sequelize'];(function(_0x2d17d1,_0x3308a5){var _0x16399f=function(_0x14406c){while(--_0x14406c){_0x2d17d1['push'](_0x2d17d1['shift']());}};_0x16399f(++_0x3308a5);}(_0xbed8,0x123));var _0x8bed=function(_0x2f6e2d,_0x3ba8a5){_0x2f6e2d=_0x2f6e2d-0x0;var _0x3d122c=_0xbed8[_0x2f6e2d];return _0x3d122c;};'use strict';var Sequelize=require(_0x8bed('0x0'));module[_0x8bed('0x1')]={'name':{'type':Sequelize[_0x8bed('0x2')],'unique':_0x8bed('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8bed('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 1119853..9c77de8 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 _0xc8cc=['cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','then','get','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmList','includeAll','rows','catch','show','params','keys','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','ListId','getDispositions','findOne','Disposition','order','removeDispositions','addContacts','tags','isArray','join','push','each','CmContact','ids','success','dataValues','errors','message','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','addCustomField','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','sequelize'];(function(_0x54d582,_0x41d482){var _0x12d36d=function(_0x5dba99){while(--_0x5dba99){_0x54d582['push'](_0x54d582['shift']());}};_0x12d36d(++_0x41d482);}(_0xc8cc,0x12d));var _0xcc8c=function(_0x2f651d,_0x7d2f88){_0x2f651d=_0x2f651d-0x0;var _0x249e3b=_0xc8cc[_0x2f651d];return _0x249e3b;};'use strict';var pdf=require(_0xcc8c('0x0'));var emlformat=require(_0xcc8c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcc8c('0x2'));var jsonpatch=require(_0xcc8c('0x3'));var rp=require(_0xcc8c('0x4'));var moment=require('moment');var BPromise=require(_0xcc8c('0x5'));var Mustache=require(_0xcc8c('0x6'));var util=require(_0xcc8c('0x7'));var path=require(_0xcc8c('0x8'));var sox=require(_0xcc8c('0x9'));var csv=require('to-csv');var ejs=require(_0xcc8c('0xa'));var fs=require('fs');var fs_extra=require(_0xcc8c('0xb'));var _=require(_0xcc8c('0xc'));var squel=require(_0xcc8c('0xd'));var crypto=require(_0xcc8c('0xe'));var jsforce=require(_0xcc8c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcc8c('0x10'));var querystring=require(_0xcc8c('0x11'));var Papa=require('papaparse');var Redis=require(_0xcc8c('0x12'));var authService=require(_0xcc8c('0x13'));var qs=require(_0xcc8c('0x14'));var as=require(_0xcc8c('0x15'));var hardwareService=require(_0xcc8c('0x16'));var logger=require(_0xcc8c('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xcc8c('0x18'));var licenseUtil=require(_0xcc8c('0x19'));var db=require(_0xcc8c('0x1a'))['db'];config[_0xcc8c('0x1b')]=_['defaults'](config['redis'],{'host':_0xcc8c('0x1c'),'port':0x18eb});var socket=require(_0xcc8c('0x1d'))(new Redis(config[_0xcc8c('0x1b')]));require('./cmList.socket')[_0xcc8c('0x1e')](socket);function respondWithStatusCode(_0x592070,_0x2a7c26){_0x2a7c26=_0x2a7c26||0xcc;return function(_0x28aec5){if(_0x28aec5){return _0x592070[_0xcc8c('0x1f')](_0x2a7c26);}return _0x592070['status'](_0x2a7c26)['end']();};}function respondWithResult(_0x367b3a,_0x39dd70){_0x39dd70=_0x39dd70||0xc8;return function(_0x933ec3){if(_0x933ec3){return _0x367b3a[_0xcc8c('0x20')](_0x39dd70)['json'](_0x933ec3);}};}function respondWithFilteredResult(_0x36e58d,_0xfa5a30){return function(_0x106ada){if(_0x106ada){var _0x4957bd=_0x106ada[_0xcc8c('0x21')],_0x506bb1=_0xfa5a30['offset'],_0x2a4cdd=_0xfa5a30[_0xcc8c('0x22')]+_0xfa5a30[_0xcc8c('0x23')],_0x41701c;if(_0x2a4cdd>=_0x4957bd){_0x2a4cdd=_0x4957bd;_0x41701c=0xc8;}else{_0x41701c=0xce;}_0x36e58d['status'](_0x41701c);return _0x36e58d[_0xcc8c('0x24')]('Content-Range',_0x506bb1+'-'+_0x2a4cdd+'/'+_0x4957bd)[_0xcc8c('0x25')](_0x106ada);}return null;};}function patchUpdates(_0x387cad){return function(_0x536df4){try{jsonpatch[_0xcc8c('0x26')](_0x536df4,_0x387cad,!![]);}catch(_0x149d3d){return BPromise[_0xcc8c('0x27')](_0x149d3d);}return _0x536df4[_0xcc8c('0x28')]();};}function saveUpdates(_0x30492c,_0x5d48b1){return function(_0xa9f49b){if(_0xa9f49b){return _0xa9f49b[_0xcc8c('0x29')](_0x30492c)[_0xcc8c('0x2a')](function(_0x354b70){return _0x354b70;});}return null;};}function removeEntity(_0x40e1cf,_0x39929f){return function(_0x3c9692){if(_0x3c9692){return _0x3c9692['destroy']()[_0xcc8c('0x2a')](function(){var _0x4a86b0=_0x3c9692[_0xcc8c('0x2b')]({'plain':!![]});var _0x87536d='Lists';return db['UserProfileResource'][_0xcc8c('0x2c')]({'where':{'type':_0x87536d,'resourceId':_0x4a86b0['id']}})[_0xcc8c('0x2a')](function(){return _0x3c9692;});})[_0xcc8c('0x2a')](function(){_0x40e1cf['status'](0xcc)[_0xcc8c('0x2d')]();});}};}function handleEntityNotFound(_0x2b4c3d,_0x2e2db0){return function(_0x564521){if(!_0x564521){_0x2b4c3d[_0xcc8c('0x1f')](0x194);}return _0x564521;};}function handleError(_0xb9371d,_0x298561){_0x298561=_0x298561||0x1f4;return function(_0x333d78){logger[_0xcc8c('0x2e')](_0x333d78[_0xcc8c('0x2f')]);if(_0x333d78[_0xcc8c('0x30')]){delete _0x333d78['name'];}_0xb9371d[_0xcc8c('0x20')](_0x298561)[_0xcc8c('0x31')](_0x333d78);};}exports[_0xcc8c('0x32')]=function(_0x3f2a4d,_0xc2d46d){var _0x250a8b={},_0x4bc442={},_0x2d6670={'count':0x0,'rows':[]};var _0x21fc88=_['map'](db['CmList'][_0xcc8c('0x33')],function(_0x17e3ab){return{'name':_0x17e3ab[_0xcc8c('0x34')],'type':_0x17e3ab[_0xcc8c('0x35')]['key']};});_0x4bc442[_0xcc8c('0x36')]=_[_0xcc8c('0x37')](_0x21fc88,'name');_0x4bc442[_0xcc8c('0x38')]=_['keys'](_0x3f2a4d['query']);_0x4bc442['filters']=_['intersection'](_0x4bc442['model'],_0x4bc442['query']);_0x250a8b['attributes']=_[_0xcc8c('0x39')](_0x4bc442[_0xcc8c('0x36')],qs[_0xcc8c('0x3a')](_0x3f2a4d['query']['fields']));_0x250a8b[_0xcc8c('0x3b')]=_0x250a8b[_0xcc8c('0x3b')]['length']?_0x250a8b[_0xcc8c('0x3b')]:_0x4bc442['model'];if(!_0x3f2a4d[_0xcc8c('0x38')][_0xcc8c('0x3c')](_0xcc8c('0x3d'))){_0x250a8b[_0xcc8c('0x23')]=qs[_0xcc8c('0x23')](_0x3f2a4d[_0xcc8c('0x38')][_0xcc8c('0x23')]);_0x250a8b[_0xcc8c('0x22')]=qs[_0xcc8c('0x22')](_0x3f2a4d['query'][_0xcc8c('0x22')]);}_0x250a8b['order']=qs[_0xcc8c('0x3e')](_0x3f2a4d[_0xcc8c('0x38')][_0xcc8c('0x3e')]);_0x250a8b[_0xcc8c('0x3f')]=qs[_0xcc8c('0x40')](_[_0xcc8c('0x41')](_0x3f2a4d[_0xcc8c('0x38')],_0x4bc442[_0xcc8c('0x40')]),_0x21fc88);if(_0x3f2a4d[_0xcc8c('0x38')][_0xcc8c('0x42')]){_0x250a8b[_0xcc8c('0x3f')]=_[_0xcc8c('0x43')](_0x250a8b[_0xcc8c('0x3f')],{'$or':_['map'](_0x21fc88,function(_0x250681){if(_0x250681[_0xcc8c('0x35')]!==_0xcc8c('0x44')){var _0xe5a125={};_0xe5a125[_0x250681[_0xcc8c('0x30')]]={'$like':'%'+_0x3f2a4d['query'][_0xcc8c('0x42')]+'%'};return _0xe5a125;}})});}_0x250a8b=_['merge']({},_0x250a8b,_0x3f2a4d[_0xcc8c('0x45')]);var _0x41b4ab={'where':_0x250a8b[_0xcc8c('0x3f')]};return db[_0xcc8c('0x46')][_0xcc8c('0x21')](_0x41b4ab)[_0xcc8c('0x2a')](function(_0x173f54){_0x2d6670[_0xcc8c('0x21')]=_0x173f54;if(_0x3f2a4d['query'][_0xcc8c('0x47')]){_0x250a8b['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x250a8b);})[_0xcc8c('0x2a')](function(_0x447ae7){_0x2d6670[_0xcc8c('0x48')]=_0x447ae7;return _0x2d6670;})[_0xcc8c('0x2a')](respondWithFilteredResult(_0xc2d46d,_0x250a8b))[_0xcc8c('0x49')](handleError(_0xc2d46d,null));};exports[_0xcc8c('0x4a')]=function(_0x4f5230,_0x1c2350){var _0xcbe532={'raw':![],'where':{'id':_0x4f5230[_0xcc8c('0x4b')]['id']}},_0x24f72b={};_0x24f72b['model']=_[_0xcc8c('0x4c')](db[_0xcc8c('0x46')][_0xcc8c('0x33')]);_0x24f72b[_0xcc8c('0x38')]=_[_0xcc8c('0x4c')](_0x4f5230[_0xcc8c('0x38')]);_0x24f72b[_0xcc8c('0x40')]=_[_0xcc8c('0x39')](_0x24f72b[_0xcc8c('0x36')],_0x24f72b['query']);_0xcbe532[_0xcc8c('0x3b')]=_[_0xcc8c('0x39')](_0x24f72b[_0xcc8c('0x36')],qs[_0xcc8c('0x3a')](_0x4f5230[_0xcc8c('0x38')][_0xcc8c('0x3a')]));_0xcbe532[_0xcc8c('0x3b')]=_0xcbe532[_0xcc8c('0x3b')][_0xcc8c('0x4d')]?_0xcbe532['attributes']:_0x24f72b[_0xcc8c('0x36')];if(_0x4f5230[_0xcc8c('0x38')][_0xcc8c('0x47')]){_0xcbe532[_0xcc8c('0x4e')]=[{'all':!![]}];}_0xcbe532=_[_0xcc8c('0x43')]({},_0xcbe532,_0x4f5230['options']);return db[_0xcc8c('0x46')][_0xcc8c('0x4f')](_0xcbe532)[_0xcc8c('0x2a')](handleEntityNotFound(_0x1c2350,null))['then'](respondWithResult(_0x1c2350,null))[_0xcc8c('0x49')](handleError(_0x1c2350,null));};exports[_0xcc8c('0x50')]=function(_0x2f0037,_0x49ed76){return db['CmList'][_0xcc8c('0x50')](_0x2f0037[_0xcc8c('0x51')],{})[_0xcc8c('0x2a')](function(_0x4dc7ea){var _0x165d42=_0x2f0037[_0xcc8c('0x52')][_0xcc8c('0x2b')]({'plain':!![]});if(!_0x165d42)throw new Error(_0xcc8c('0x53'));if(_0x165d42[_0xcc8c('0x54')]===_0xcc8c('0x52')){var _0x2f66b5=_0x4dc7ea[_0xcc8c('0x2b')]({'plain':!![]});var _0x470c8a=_0xcc8c('0x55');return db[_0xcc8c('0x56')][_0xcc8c('0x4f')]({'where':{'name':_0x470c8a,'userProfileId':_0x165d42[_0xcc8c('0x57')]},'raw':!![]})[_0xcc8c('0x2a')](function(_0x369255){if(_0x369255&&_0x369255[_0xcc8c('0x58')]===0x0){return db[_0xcc8c('0x59')][_0xcc8c('0x50')]({'name':_0x2f66b5['name'],'resourceId':_0x2f66b5['id'],'type':_0x369255['name'],'sectionId':_0x369255['id']},{})[_0xcc8c('0x2a')](function(){return _0x4dc7ea;});}else{return _0x4dc7ea;}})[_0xcc8c('0x49')](function(_0x12dea9){logger[_0xcc8c('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12dea9);throw _0x12dea9;});}return _0x4dc7ea;})[_0xcc8c('0x2a')](respondWithResult(_0x49ed76,0xc9))[_0xcc8c('0x49')](handleError(_0x49ed76,null));};exports[_0xcc8c('0x29')]=function(_0x27adcb,_0x390162){if(_0x27adcb[_0xcc8c('0x51')]['id']){delete _0x27adcb[_0xcc8c('0x51')]['id'];}return db[_0xcc8c('0x46')]['find']({'where':{'id':_0x27adcb['params']['id']}})[_0xcc8c('0x2a')](handleEntityNotFound(_0x390162,null))['then'](saveUpdates(_0x27adcb[_0xcc8c('0x51')],null))[_0xcc8c('0x2a')](respondWithResult(_0x390162,null))[_0xcc8c('0x49')](handleError(_0x390162,null));};exports[_0xcc8c('0x2c')]=function(_0x224071,_0x1d00d2){return db[_0xcc8c('0x46')]['find']({'where':{'id':_0x224071['params']['id']}})[_0xcc8c('0x2a')](handleEntityNotFound(_0x1d00d2,null))[_0xcc8c('0x2a')](removeEntity(_0x1d00d2,null))[_0xcc8c('0x49')](handleError(_0x1d00d2,null));};exports['describe']=function(_0x4395f0,_0xb9bab0){return db[_0xcc8c('0x46')][_0xcc8c('0x5a')]()[_0xcc8c('0x2a')](respondWithResult(_0xb9bab0,null))[_0xcc8c('0x49')](handleError(_0xb9bab0,null));};exports[_0xcc8c('0x5b')]=function(_0x56395f,_0x2891ff,_0x56fb1b){if(_0x56395f[_0xcc8c('0x51')]['id']){delete _0x56395f[_0xcc8c('0x51')]['id'];}return db['CmList'][_0xcc8c('0x4f')]({'where':{'id':_0x56395f[_0xcc8c('0x4b')]['id']}})[_0xcc8c('0x2a')](handleEntityNotFound(_0x2891ff,null))[_0xcc8c('0x2a')](function(_0x57e12b){if(_0x57e12b){_0x56395f['body'][_0xcc8c('0x5c')]=_0x57e12b['id'];return db['Disposition'][_0xcc8c('0x50')](_0x56395f['body']);}})['then'](respondWithResult(_0x2891ff,null))['catch'](handleError(_0x2891ff,null));};exports[_0xcc8c('0x5d')]=function(_0x18fdee,_0x3fbe6e,_0x3c2d7e){var _0x1ef136={'raw':![],'where':{}};var _0x145049={};var _0x259a2a={'count':0x0,'rows':[]};return db[_0xcc8c('0x46')][_0xcc8c('0x5e')]({'where':{'id':_0x18fdee[_0xcc8c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3fbe6e,null))['then'](function(_0x463729){if(_0x463729){_0x145049[_0xcc8c('0x36')]=_[_0xcc8c('0x4c')](db[_0xcc8c('0x5f')][_0xcc8c('0x33')]);_0x145049[_0xcc8c('0x38')]=_[_0xcc8c('0x4c')](_0x18fdee[_0xcc8c('0x38')]);_0x145049['filters']=_[_0xcc8c('0x39')](_0x145049['model'],_0x145049[_0xcc8c('0x38')]);_0x1ef136[_0xcc8c('0x3b')]=_[_0xcc8c('0x39')](_0x145049[_0xcc8c('0x36')],qs[_0xcc8c('0x3a')](_0x18fdee['query']['fields']));_0x1ef136[_0xcc8c('0x3b')]=_0x1ef136[_0xcc8c('0x3b')]['length']?_0x1ef136[_0xcc8c('0x3b')]:_0x145049[_0xcc8c('0x36')];if(!_0x18fdee['query'][_0xcc8c('0x3c')](_0xcc8c('0x3d'))){_0x1ef136['limit']=qs['limit'](_0x18fdee[_0xcc8c('0x38')]['limit']);_0x1ef136[_0xcc8c('0x22')]=qs[_0xcc8c('0x22')](_0x18fdee[_0xcc8c('0x38')][_0xcc8c('0x22')]);}_0x1ef136[_0xcc8c('0x60')]=qs[_0xcc8c('0x3e')](_0x18fdee[_0xcc8c('0x38')][_0xcc8c('0x3e')]);_0x1ef136[_0xcc8c('0x3f')]=qs[_0xcc8c('0x40')](_[_0xcc8c('0x41')](_0x18fdee[_0xcc8c('0x38')],_0x145049[_0xcc8c('0x40')]));_0x1ef136['where'][_0xcc8c('0x5c')]=_0x463729['id'];if(_0x18fdee['query'][_0xcc8c('0x42')]){_0x1ef136['where']=_['merge'](_0x1ef136[_0xcc8c('0x3f')],{'$or':_[_0xcc8c('0x37')](_0x1ef136['attributes'],function(_0x3c4e25){var _0x3a30bb={};_0x3a30bb[_0x3c4e25]={'$like':'%'+_0x18fdee[_0xcc8c('0x38')]['filter']+'%'};return _0x3a30bb;})});}_0x1ef136=_[_0xcc8c('0x43')]({},_0x1ef136,_0x18fdee[_0xcc8c('0x45')]);return db[_0xcc8c('0x5f')][_0xcc8c('0x21')]({'where':_0x1ef136[_0xcc8c('0x3f')]})[_0xcc8c('0x2a')](function(_0x1dca54){_0x259a2a[_0xcc8c('0x21')]=_0x1dca54;if(_0x18fdee[_0xcc8c('0x38')][_0xcc8c('0x47')]){_0x1ef136[_0xcc8c('0x4e')]=[{'all':!![]}];}return db[_0xcc8c('0x5f')]['findAll'](_0x1ef136);})[_0xcc8c('0x2a')](function(_0x2df206){_0x259a2a[_0xcc8c('0x48')]=_0x2df206;return _0x259a2a;});}})['then'](respondWithFilteredResult(_0x3fbe6e,_0x1ef136))[_0xcc8c('0x49')](handleError(_0x3fbe6e,null));};exports['removeDispositions']=function(_0x403f9f,_0x365b5b,_0x4b928c){return db[_0xcc8c('0x46')][_0xcc8c('0x4f')]({'where':{'id':_0x403f9f['params']['id']}})[_0xcc8c('0x2a')](handleEntityNotFound(_0x365b5b,null))[_0xcc8c('0x2a')](function(_0x391863){if(_0x391863){return _0x391863[_0xcc8c('0x61')](_0x403f9f[_0xcc8c('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x365b5b,null))[_0xcc8c('0x49')](handleError(_0x365b5b,null));};exports[_0xcc8c('0x62')]=function(_0x22a45e,_0x520e23,_0x10ca4a){return db[_0xcc8c('0x46')][_0xcc8c('0x4f')]({'where':{'id':_0x22a45e['params']['id']}})['then'](handleEntityNotFound(_0x520e23,null))['then'](function(_0x2bd7d6){if(_0x2bd7d6){var _0x21e57a=[];var _0x59676d={'success':[],'errors':[]};return db['CmContact'][_0xcc8c('0x5a')]()[_0xcc8c('0x2a')](function(_0x52c9a9){if(_0x22a45e[_0xcc8c('0x51')][_0xcc8c('0x63')]&&_[_0xcc8c('0x64')](_0x22a45e[_0xcc8c('0x51')][_0xcc8c('0x63')])){if(_0x22a45e[_0xcc8c('0x51')][_0xcc8c('0x63')][_0xcc8c('0x4d')]){_0x22a45e[_0xcc8c('0x51')][_0xcc8c('0x63')]=_0x22a45e[_0xcc8c('0x51')][_0xcc8c('0x63')][_0xcc8c('0x65')](';')+';';}else{_0x22a45e['body']['tags']=null;}}else{_0x22a45e['body'][_0xcc8c('0x63')]=null;}if(_0x22a45e['body']&&_[_0xcc8c('0x64')](_0x22a45e[_0xcc8c('0x51')])){for(var _0x5efe4c=0x0;_0x5efe4c<_0x22a45e[_0xcc8c('0x51')][_0xcc8c('0x4d')];_0x5efe4c+=0x1){_0x22a45e[_0xcc8c('0x51')][_0x5efe4c]['ListId']=_0x22a45e[_0xcc8c('0x4b')]['id'];_0x21e57a[_0xcc8c('0x66')](_0x22a45e['body'][_0x5efe4c]);}return BPromise[_0xcc8c('0x67')](_0x21e57a,function(_0xef90a4){return db[_0xcc8c('0x68')][_0xcc8c('0x50')](_['omit'](_0xef90a4,[_0xcc8c('0x69'),'id'])||{},{'fields':_[_0xcc8c('0x4c')](_0x52c9a9),'raw':!![]})[_0xcc8c('0x2a')](function(_0x3f7090){_0x59676d[_0xcc8c('0x6a')]['push'](_0x3f7090[_0xcc8c('0x6b')]);})['catch'](function(_0x1fa402){_0x59676d[_0xcc8c('0x6c')]['push']({'data':_0xef90a4,'error':_0x1fa402[_0xcc8c('0x6d')]});});})[_0xcc8c('0x2a')](function(_0x9d05){return _0x59676d;})[_0xcc8c('0x49')](function(_0x2051cb){return _0x2051cb;});}else{_0x520e23['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xcc8c('0x2a')](respondWithResult(_0x520e23,null))['catch'](handleError(_0x520e23,null));};exports['getContacts']=function(_0x5e97ab,_0x141d2a,_0x23ca06){var _0xa3083d;return db[_0xcc8c('0x46')]['find']({'where':{'id':_0x5e97ab[_0xcc8c('0x4b')]['id']},'include':[{'model':db[_0xcc8c('0x6e')],'as':_0xcc8c('0x6f')}]})[_0xcc8c('0x2a')](handleEntityNotFound(_0x141d2a,null))[_0xcc8c('0x2a')](function(_0x1a51ce){if(_0x1a51ce){_0xa3083d=_0x1a51ce;return db[_0xcc8c('0x68')][_0xcc8c('0x33')];}})[_0xcc8c('0x2a')](function(_0xcb2f76){if(_0xcb2f76){var _0xef0ca0={};var _0xb541c3={};_0xb541c3[_0xcc8c('0x36')]=_[_0xcc8c('0x70')](_['keys'](_0xcb2f76),_[_0xcc8c('0x37')](_0xa3083d[_0xcc8c('0x6f')],function(_0x47aef6){return util[_0xcc8c('0x71')](_0xcc8c('0x72'),_0x47aef6['id']);}));_0xb541c3[_0xcc8c('0x38')]=_[_0xcc8c('0x4c')](_0x5e97ab[_0xcc8c('0x38')]);_0xb541c3[_0xcc8c('0x40')]=_['intersection'](_0xb541c3[_0xcc8c('0x36')],_0xb541c3[_0xcc8c('0x38')]);_0xef0ca0['attributes']=_[_0xcc8c('0x39')](_0xb541c3[_0xcc8c('0x36')],qs[_0xcc8c('0x3a')](_0x5e97ab[_0xcc8c('0x38')][_0xcc8c('0x3a')]));_0xef0ca0['attributes']=_0xef0ca0['attributes'][_0xcc8c('0x4d')]?_0xef0ca0[_0xcc8c('0x3b')]:_0xb541c3['model'];if(!_0x5e97ab[_0xcc8c('0x38')][_0xcc8c('0x3c')](_0xcc8c('0x3d'))){_0xef0ca0['limit']=qs[_0xcc8c('0x23')](_0x5e97ab[_0xcc8c('0x38')][_0xcc8c('0x23')]);_0xef0ca0['offset']=qs['offset'](_0x5e97ab['query'][_0xcc8c('0x22')]);}_0xef0ca0['order']=qs[_0xcc8c('0x3e')](_0x5e97ab[_0xcc8c('0x38')][_0xcc8c('0x3e')]);_0xef0ca0[_0xcc8c('0x3f')]=qs[_0xcc8c('0x40')](_[_0xcc8c('0x41')](_0x5e97ab[_0xcc8c('0x38')],_0xb541c3[_0xcc8c('0x40')]));_0xef0ca0[_0xcc8c('0x73')]=!![];if(_0x5e97ab[_0xcc8c('0x38')][_0xcc8c('0x42')]){_0xef0ca0[_0xcc8c('0x3f')]=_[_0xcc8c('0x43')](_0xef0ca0['where'],{'$or':_[_0xcc8c('0x37')](_0xef0ca0[_0xcc8c('0x3b')],function(_0x2e3a13){var _0x376fc1={};_0x376fc1[_0x2e3a13]={'$like':'%'+_0x5e97ab[_0xcc8c('0x38')]['filter']+'%'};return _0x376fc1;})});}_0xef0ca0=_[_0xcc8c('0x43')]({},_0xef0ca0,_0x5e97ab['options']);return _0xa3083d[_0xcc8c('0x74')](_0xef0ca0);}})[_0xcc8c('0x2a')](respondWithResult(_0x141d2a,null))[_0xcc8c('0x49')](handleError(_0x141d2a,null));};exports[_0xcc8c('0x75')]=function(_0x214617,_0x36b012,_0x24d867){var _0x21d4f1;return db['CmList'][_0xcc8c('0x4f')]({'where':{'id':_0x214617['params']['id']},'include':[{'model':db[_0xcc8c('0x6e')],'as':_0xcc8c('0x6f')}]})[_0xcc8c('0x2a')](handleEntityNotFound(_0x36b012,null))['then'](function(_0x3ad623){if(_0x3ad623){_0x21d4f1=_0x3ad623;return db['CmContact'][_0xcc8c('0x33')];}})['then'](function(_0x532a86){if(_0x532a86){var _0x19cc2c={};var _0x11ac93={};_0x11ac93[_0xcc8c('0x36')]=_[_0xcc8c('0x70')](_[_0xcc8c('0x4c')](_0x532a86),_[_0xcc8c('0x37')](_0x21d4f1[_0xcc8c('0x6f')],function(_0x5da0a3){return util[_0xcc8c('0x71')](_0xcc8c('0x72'),_0x5da0a3['id']);}));_0x11ac93[_0xcc8c('0x38')]=_['keys'](_0x214617['query']);_0x11ac93[_0xcc8c('0x40')]=_[_0xcc8c('0x39')](_0x11ac93[_0xcc8c('0x36')],_0x11ac93['query']);_0x19cc2c['attributes']=_[_0xcc8c('0x39')](_0x11ac93[_0xcc8c('0x36')],qs[_0xcc8c('0x3a')](_0x214617[_0xcc8c('0x38')][_0xcc8c('0x3a')]));_0x19cc2c['attributes']=_0x19cc2c[_0xcc8c('0x3b')][_0xcc8c('0x4d')]?_0x19cc2c['attributes']:_0x11ac93[_0xcc8c('0x36')];if(!_0x214617[_0xcc8c('0x38')][_0xcc8c('0x3c')](_0xcc8c('0x3d'))){_0x19cc2c['limit']=qs[_0xcc8c('0x23')](_0x214617[_0xcc8c('0x38')][_0xcc8c('0x23')]);_0x19cc2c[_0xcc8c('0x22')]=qs[_0xcc8c('0x22')](_0x214617[_0xcc8c('0x38')][_0xcc8c('0x22')]);}_0x19cc2c[_0xcc8c('0x60')]=qs['sort'](_0x214617[_0xcc8c('0x38')][_0xcc8c('0x3e')]);_0x19cc2c[_0xcc8c('0x3f')]=qs[_0xcc8c('0x40')](_[_0xcc8c('0x41')](_0x214617['query'],_0x11ac93[_0xcc8c('0x40')]));_0x19cc2c[_0xcc8c('0x73')]=!![];if(_0x214617[_0xcc8c('0x38')][_0xcc8c('0x42')]){_0x19cc2c['where']=_['merge'](_0x19cc2c[_0xcc8c('0x3f')],{'$or':_[_0xcc8c('0x37')](_0x19cc2c[_0xcc8c('0x3b')],function(_0x234438){var _0x5474c7={};_0x5474c7[_0x234438]={'$like':'%'+_0x214617[_0xcc8c('0x38')][_0xcc8c('0x42')]+'%'};return _0x5474c7;})});}_0x19cc2c=_['merge']({},_0x19cc2c,_0x214617[_0xcc8c('0x45')]);return _0x21d4f1[_0xcc8c('0x74')](_0x19cc2c);}})[_0xcc8c('0x2a')](function(_0x4473eb){if(!_[_0xcc8c('0x76')](_0x4473eb)){var _0x32e7f4=toCsv(_0x4473eb);var _0x32cfff=Date[_0xcc8c('0x77')]();fs[_0xcc8c('0x78')](util['format']('/tmp/list_%d_%s.csv',_0x21d4f1['id'],_0x32cfff),_0x32e7f4);_0x36b012[_0xcc8c('0x79')](_0xcc8c('0x7a'),_0xcc8c('0x7b')+util[_0xcc8c('0x71')]('list_%d_%s.csv',_0x21d4f1['id'],_0x32cfff));_0x36b012[_0xcc8c('0x79')](_0xcc8c('0x7c'),'text/csv');return _0x36b012[_0xcc8c('0x7d')](util[_0xcc8c('0x71')]('/tmp/list_%d_%s.csv',_0x21d4f1['id'],_0x32cfff));}else{return _0x36b012[_0xcc8c('0x1f')](0xcc);}})['catch'](handleError(_0x36b012,null));};exports[_0xcc8c('0x7e')]=function(_0x5c7725,_0x593a8d,_0x5b5f94){var _0x76b9e3;delete _0x5c7725['body']['id'];return db[_0xcc8c('0x46')][_0xcc8c('0x5e')]({'where':{'id':_0x5c7725[_0xcc8c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x593a8d,null))['then'](function(_0x20e6a5){if(_0x20e6a5){return db['sequelize']['transaction'](function(_0x48a6fa){return db[_0xcc8c('0x6e')]['create'](_0x5c7725[_0xcc8c('0x51')],{'transaction':_0x48a6fa})[_0xcc8c('0x2a')](function(_0x2a3ab3){_0x76b9e3=_0x2a3ab3;return _0x20e6a5['addCustomFields'](_0x2a3ab3,{'transaction':_0x48a6fa});})['then'](function(){var _0x2eb2f3={'type':db[_0xcc8c('0x7f')][_0xcc8c('0x80')],'transaction':_0x48a6fa};switch(_0x5c7725[_0xcc8c('0x51')][_0xcc8c('0x35')]){case'text':_0x2eb2f3[_0xcc8c('0x35')]=db[_0xcc8c('0x7f')][_0xcc8c('0x80')];break;case _0xcc8c('0x81'):_0x2eb2f3[_0xcc8c('0x35')]=db[_0xcc8c('0x7f')][_0xcc8c('0x82')];break;case'switch':_0x2eb2f3['type']=db[_0xcc8c('0x7f')][_0xcc8c('0x83')];_0x2eb2f3[_0xcc8c('0x84')]=![];break;default:}return db[_0xcc8c('0x85')]['queryInterface']['addColumn'](_0xcc8c('0x86'),util[_0xcc8c('0x71')](_0xcc8c('0x87'),_0x76b9e3['id']),_0x2eb2f3);})[_0xcc8c('0x2a')](function(){return _0x76b9e3;});});}})[_0xcc8c('0x2a')](respondWithResult(_0x593a8d,null))['catch'](handleError(_0x593a8d,null));};exports['getCustomFields']=function(_0xb1116e,_0x272347,_0x7388f1){var _0x55fa52={};var _0x2ac265={};var _0x24357d;var _0x52fa99;return db[_0xcc8c('0x46')]['findOne']({'where':{'id':_0xb1116e[_0xcc8c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x272347,null))['then'](function(_0x38d0a){if(_0x38d0a){_0x24357d=_0x38d0a;_0x2ac265['model']=_[_0xcc8c('0x4c')](db[_0xcc8c('0x6e')][_0xcc8c('0x33')]);_0x2ac265['query']=_[_0xcc8c('0x4c')](_0xb1116e['query']);_0x2ac265[_0xcc8c('0x40')]=_[_0xcc8c('0x39')](_0x2ac265['model'],_0x2ac265[_0xcc8c('0x38')]);_0x55fa52[_0xcc8c('0x3b')]=_[_0xcc8c('0x39')](_0x2ac265[_0xcc8c('0x36')],qs[_0xcc8c('0x3a')](_0xb1116e[_0xcc8c('0x38')][_0xcc8c('0x3a')]));_0x55fa52[_0xcc8c('0x3b')]=_0x55fa52[_0xcc8c('0x3b')][_0xcc8c('0x4d')]?_0x55fa52[_0xcc8c('0x3b')]:_0x2ac265[_0xcc8c('0x36')];_0x55fa52['order']=qs[_0xcc8c('0x3e')](_0xb1116e[_0xcc8c('0x38')][_0xcc8c('0x3e')]);_0x55fa52[_0xcc8c('0x3f')]=qs['filters'](_[_0xcc8c('0x41')](_0xb1116e[_0xcc8c('0x38')],_0x2ac265['filters']));_0x55fa52['where']=_[_0xcc8c('0x43')](_0x55fa52['where'],{'$or':[{'ListId':_0x38d0a['id']},{'ListId':null}]});if(_0xb1116e['query']['filter']){_0x55fa52['where']=_['merge'](_0x55fa52[_0xcc8c('0x3f')],{'$or':_['map'](_0x55fa52[_0xcc8c('0x3b')],function(_0x54b965){var _0x587822={};_0x587822[_0x54b965]={'$like':'%'+_0xb1116e[_0xcc8c('0x38')][_0xcc8c('0x42')]+'%'};return _0x587822;})});}_0x55fa52=_['merge']({},_0x55fa52,_0xb1116e[_0xcc8c('0x45')]);return db[_0xcc8c('0x6e')][_0xcc8c('0x88')](_0x55fa52);}})[_0xcc8c('0x2a')](respondWithResult(_0x272347,null))['catch'](handleError(_0x272347,null));};exports['addAgents']=function(_0x330eb2,_0xd5f43,_0x5e942b){return db[_0xcc8c('0x46')][_0xcc8c('0x4f')]({'where':{'id':_0x330eb2[_0xcc8c('0x4b')]['id']}})[_0xcc8c('0x2a')](handleEntityNotFound(_0xd5f43,null))['then'](function(_0x12c6ba){if(_0x12c6ba){return _0x12c6ba[_0xcc8c('0x89')](_0x330eb2[_0xcc8c('0x51')][_0xcc8c('0x69')],_['omit'](_0x330eb2[_0xcc8c('0x51')],[_0xcc8c('0x69'),'id'])||{})[_0xcc8c('0x8a')](function(_0x230cb6){for(var _0x4b66b9=0x0;_0x4b66b9<_0x330eb2['body']['ids'][_0xcc8c('0x4d')];_0x4b66b9+=0x1){socket[_0xcc8c('0x8b')](_0xcc8c('0x8c'),{'UserId':_0x330eb2[_0xcc8c('0x51')][_0xcc8c('0x69')][_0x4b66b9],'CmListId':_0x330eb2[_0xcc8c('0x4b')]['id']});}return _0x230cb6;});}})['then'](respondWithResult(_0xd5f43,null))[_0xcc8c('0x49')](handleError(_0xd5f43,null));};exports[_0xcc8c('0x8d')]=function(_0x57e77f,_0x58f667,_0x23779e){return db[_0xcc8c('0x46')][_0xcc8c('0x4f')]({'where':{'id':_0x57e77f[_0xcc8c('0x4b')]['id']}})[_0xcc8c('0x2a')](handleEntityNotFound(_0x58f667,null))[_0xcc8c('0x2a')](function(_0x2a8047){if(_0x2a8047){return _0x2a8047[_0xcc8c('0x8d')](_0x57e77f['query']['ids'])[_0xcc8c('0x2a')](function(){if(_['isArray'](_0x57e77f[_0xcc8c('0x38')]['ids'])){for(var _0x3ca51f=0x0;_0x3ca51f<_0x57e77f[_0xcc8c('0x38')][_0xcc8c('0x69')][_0xcc8c('0x4d')];_0x3ca51f+=0x1){socket['emit'](_0xcc8c('0x8e'),{'UserId':Number(_0x57e77f[_0xcc8c('0x38')][_0xcc8c('0x69')][_0x3ca51f]),'CmListId':Number(_0x57e77f[_0xcc8c('0x4b')]['id'])});}}else{socket['emit'](_0xcc8c('0x8e'),{'UserId':Number(_0x57e77f[_0xcc8c('0x38')][_0xcc8c('0x69')]),'CmListId':Number(_0x57e77f[_0xcc8c('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x58f667,null))[_0xcc8c('0x49')](handleError(_0x58f667,null));};exports['getAgents']=function(_0x43757f,_0xda3c9,_0x35bda0){var _0xae2f44={};var _0xc4caa8={};var _0x2bd0e;var _0x473282;return db['CmList'][_0xcc8c('0x5e')]({'where':{'id':_0x43757f[_0xcc8c('0x4b')]['id']}})[_0xcc8c('0x2a')](handleEntityNotFound(_0xda3c9,null))[_0xcc8c('0x2a')](function(_0x4ebd55){if(_0x4ebd55){_0x2bd0e=_0x4ebd55;_0xc4caa8[_0xcc8c('0x36')]=_[_0xcc8c('0x4c')](db[_0xcc8c('0x8f')][_0xcc8c('0x33')]);_0xc4caa8['query']=_[_0xcc8c('0x4c')](_0x43757f[_0xcc8c('0x38')]);_0xc4caa8[_0xcc8c('0x40')]=_[_0xcc8c('0x39')](_0xc4caa8[_0xcc8c('0x36')],_0xc4caa8[_0xcc8c('0x38')]);_0xae2f44[_0xcc8c('0x3b')]=_[_0xcc8c('0x39')](_0xc4caa8[_0xcc8c('0x36')],qs[_0xcc8c('0x3a')](_0x43757f['query']['fields']));_0xae2f44[_0xcc8c('0x3b')]=_0xae2f44[_0xcc8c('0x3b')][_0xcc8c('0x4d')]?_0xae2f44['attributes']:_0xc4caa8[_0xcc8c('0x36')];_0xae2f44[_0xcc8c('0x60')]=qs[_0xcc8c('0x3e')](_0x43757f[_0xcc8c('0x38')][_0xcc8c('0x3e')]);_0xae2f44[_0xcc8c('0x3f')]=qs[_0xcc8c('0x40')](_['pick'](_0x43757f['query'],_0xc4caa8['filters']));if(_0x43757f[_0xcc8c('0x38')][_0xcc8c('0x42')]){_0xae2f44[_0xcc8c('0x3f')]=_[_0xcc8c('0x43')](_0xae2f44[_0xcc8c('0x3f')],{'$or':_[_0xcc8c('0x37')](_0xae2f44['attributes'],function(_0xcec405){var _0x150ac2={};_0x150ac2[_0xcec405]={'$like':'%'+_0x43757f[_0xcc8c('0x38')][_0xcc8c('0x42')]+'%'};return _0x150ac2;})});}_0xae2f44=_[_0xcc8c('0x43')]({},_0xae2f44,_0x43757f[_0xcc8c('0x45')]);return _0x2bd0e[_0xcc8c('0x90')](_0xae2f44);}})[_0xcc8c('0x2a')](function(_0x28f053){if(_0x28f053){_0x473282=_0x28f053['length'];if(!_0x43757f[_0xcc8c('0x38')][_0xcc8c('0x3c')](_0xcc8c('0x3d'))){_0xae2f44[_0xcc8c('0x23')]=qs[_0xcc8c('0x23')](_0x43757f[_0xcc8c('0x38')][_0xcc8c('0x23')]);_0xae2f44['offset']=qs[_0xcc8c('0x22')](_0x43757f[_0xcc8c('0x38')]['offset']);}return _0x2bd0e['getAgents'](_0xae2f44);}})['then'](function(_0x9aa70e){if(_0x9aa70e){return _0x9aa70e?{'count':_0x473282,'rows':_0x9aa70e}:null;}})[_0xcc8c('0x2a')](respondWithResult(_0xda3c9,null))['catch'](handleError(_0xda3c9,null));}; \ No newline at end of file +var _0xb4fb=['Lists','UserProfileResource','stack','name','send','index','map','CmList','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','nolimit','removeDispositions','ids','addContacts','tags','isArray','join','each','omit','errors','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','CmContact','concat','format','cf_%d','getContactsCsv','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','count','limit','set','apply','reject','update','then','destroy'];(function(_0x6015d5,_0x40b1ce){var _0x1955da=function(_0x399e09){while(--_0x399e09){_0x6015d5['push'](_0x6015d5['shift']());}};_0x1955da(++_0x40b1ce);}(_0xb4fb,0x68));var _0xbb4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4fb[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xbb4f('0x0'));var emlformat=require(_0xbb4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb4f('0x2'));var jsonpatch=require(_0xbb4f('0x3'));var rp=require(_0xbb4f('0x4'));var moment=require(_0xbb4f('0x5'));var BPromise=require(_0xbb4f('0x6'));var Mustache=require(_0xbb4f('0x7'));var util=require(_0xbb4f('0x8'));var path=require(_0xbb4f('0x9'));var sox=require(_0xbb4f('0xa'));var csv=require(_0xbb4f('0xb'));var ejs=require(_0xbb4f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb4f('0xd'));var squel=require(_0xbb4f('0xe'));var crypto=require(_0xbb4f('0xf'));var jsforce=require(_0xbb4f('0x10'));var deskjs=require(_0xbb4f('0x11'));var toCsv=require(_0xbb4f('0xb'));var querystring=require(_0xbb4f('0x12'));var Papa=require(_0xbb4f('0x13'));var Redis=require(_0xbb4f('0x14'));var authService=require(_0xbb4f('0x15'));var qs=require(_0xbb4f('0x16'));var as=require(_0xbb4f('0x17'));var hardwareService=require(_0xbb4f('0x18'));var logger=require(_0xbb4f('0x19'))(_0xbb4f('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbb4f('0x1b'));var db=require(_0xbb4f('0x1c'))['db'];config[_0xbb4f('0x1d')]=_[_0xbb4f('0x1e')](config['redis'],{'host':_0xbb4f('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbb4f('0x20'))[_0xbb4f('0x21')](socket);function respondWithStatusCode(_0x3a6a5c,_0xc11b47){_0xc11b47=_0xc11b47||0xcc;return function(_0x84e31a){if(_0x84e31a){return _0x3a6a5c[_0xbb4f('0x22')](_0xc11b47);}return _0x3a6a5c[_0xbb4f('0x23')](_0xc11b47)[_0xbb4f('0x24')]();};}function respondWithResult(_0x1dbb56,_0x5af29e){_0x5af29e=_0x5af29e||0xc8;return function(_0x2700b3){if(_0x2700b3){return _0x1dbb56[_0xbb4f('0x23')](_0x5af29e)[_0xbb4f('0x25')](_0x2700b3);}};}function respondWithFilteredResult(_0x2de523,_0x379ab7){return function(_0x3e7ec){if(_0x3e7ec){var _0x70556=_0x3e7ec[_0xbb4f('0x26')],_0x2aff2f=_0x379ab7['offset'],_0x5f03c7=_0x379ab7['offset']+_0x379ab7[_0xbb4f('0x27')],_0xa1b62d;if(_0x5f03c7>=_0x70556){_0x5f03c7=_0x70556;_0xa1b62d=0xc8;}else{_0xa1b62d=0xce;}_0x2de523[_0xbb4f('0x23')](_0xa1b62d);return _0x2de523[_0xbb4f('0x28')]('Content-Range',_0x2aff2f+'-'+_0x5f03c7+'/'+_0x70556)[_0xbb4f('0x25')](_0x3e7ec);}return null;};}function patchUpdates(_0x49d067){return function(_0x438314){try{jsonpatch[_0xbb4f('0x29')](_0x438314,_0x49d067,!![]);}catch(_0x186bb3){return BPromise[_0xbb4f('0x2a')](_0x186bb3);}return _0x438314['save']();};}function saveUpdates(_0x296c69,_0x13b34b){return function(_0x5a58aa){if(_0x5a58aa){return _0x5a58aa[_0xbb4f('0x2b')](_0x296c69)[_0xbb4f('0x2c')](function(_0x2c7c96){return _0x2c7c96;});}return null;};}function removeEntity(_0x3941e9,_0x22bbe2){return function(_0x324b19){if(_0x324b19){return _0x324b19[_0xbb4f('0x2d')]()[_0xbb4f('0x2c')](function(){var _0x196ce9=_0x324b19['get']({'plain':!![]});var _0x5e7085=_0xbb4f('0x2e');return db[_0xbb4f('0x2f')]['destroy']({'where':{'type':_0x5e7085,'resourceId':_0x196ce9['id']}})[_0xbb4f('0x2c')](function(){return _0x324b19;});})[_0xbb4f('0x2c')](function(){_0x3941e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f74f5,_0x4ff538){return function(_0x40b6ae){if(!_0x40b6ae){_0x1f74f5[_0xbb4f('0x22')](0x194);}return _0x40b6ae;};}function handleError(_0x10c252,_0x4c2733){_0x4c2733=_0x4c2733||0x1f4;return function(_0x7f3bf5){logger['error'](_0x7f3bf5[_0xbb4f('0x30')]);if(_0x7f3bf5[_0xbb4f('0x31')]){delete _0x7f3bf5[_0xbb4f('0x31')];}_0x10c252[_0xbb4f('0x23')](_0x4c2733)[_0xbb4f('0x32')](_0x7f3bf5);};}exports[_0xbb4f('0x33')]=function(_0x1b4a07,_0x43e878){var _0x8d0df1={},_0x4e690d={},_0x2393bc={'count':0x0,'rows':[]};var _0xbaaa26=_[_0xbb4f('0x34')](db[_0xbb4f('0x35')]['rawAttributes'],function(_0x1f90a8){return{'name':_0x1f90a8[_0xbb4f('0x36')],'type':_0x1f90a8[_0xbb4f('0x37')]['key']};});_0x4e690d[_0xbb4f('0x38')]=_[_0xbb4f('0x34')](_0xbaaa26,_0xbb4f('0x31'));_0x4e690d[_0xbb4f('0x39')]=_[_0xbb4f('0x3a')](_0x1b4a07[_0xbb4f('0x39')]);_0x4e690d[_0xbb4f('0x3b')]=_[_0xbb4f('0x3c')](_0x4e690d[_0xbb4f('0x38')],_0x4e690d[_0xbb4f('0x39')]);_0x8d0df1[_0xbb4f('0x3d')]=_['intersection'](_0x4e690d[_0xbb4f('0x38')],qs['fields'](_0x1b4a07[_0xbb4f('0x39')][_0xbb4f('0x3e')]));_0x8d0df1[_0xbb4f('0x3d')]=_0x8d0df1['attributes'][_0xbb4f('0x3f')]?_0x8d0df1[_0xbb4f('0x3d')]:_0x4e690d[_0xbb4f('0x38')];if(!_0x1b4a07[_0xbb4f('0x39')][_0xbb4f('0x40')]('nolimit')){_0x8d0df1[_0xbb4f('0x27')]=qs['limit'](_0x1b4a07[_0xbb4f('0x39')][_0xbb4f('0x27')]);_0x8d0df1[_0xbb4f('0x41')]=qs[_0xbb4f('0x41')](_0x1b4a07[_0xbb4f('0x39')][_0xbb4f('0x41')]);}_0x8d0df1[_0xbb4f('0x42')]=qs['sort'](_0x1b4a07[_0xbb4f('0x39')][_0xbb4f('0x43')]);_0x8d0df1[_0xbb4f('0x44')]=qs['filters'](_[_0xbb4f('0x45')](_0x1b4a07['query'],_0x4e690d[_0xbb4f('0x3b')]),_0xbaaa26);if(_0x1b4a07[_0xbb4f('0x39')][_0xbb4f('0x46')]){_0x8d0df1[_0xbb4f('0x44')]=_['merge'](_0x8d0df1['where'],{'$or':_[_0xbb4f('0x34')](_0xbaaa26,function(_0x359d29){if(_0x359d29[_0xbb4f('0x37')]!==_0xbb4f('0x47')){var _0x21a012={};_0x21a012[_0x359d29[_0xbb4f('0x31')]]={'$like':'%'+_0x1b4a07[_0xbb4f('0x39')][_0xbb4f('0x46')]+'%'};return _0x21a012;}})});}_0x8d0df1=_[_0xbb4f('0x48')]({},_0x8d0df1,_0x1b4a07[_0xbb4f('0x49')]);var _0x3207c2={'where':_0x8d0df1['where']};return db[_0xbb4f('0x35')]['count'](_0x3207c2)['then'](function(_0x30436e){_0x2393bc[_0xbb4f('0x26')]=_0x30436e;if(_0x1b4a07['query'][_0xbb4f('0x4a')]){_0x8d0df1[_0xbb4f('0x4b')]=[{'all':!![]}];}return db[_0xbb4f('0x35')][_0xbb4f('0x4c')](_0x8d0df1);})[_0xbb4f('0x2c')](function(_0x632f94){_0x2393bc['rows']=_0x632f94;return _0x2393bc;})[_0xbb4f('0x2c')](respondWithFilteredResult(_0x43e878,_0x8d0df1))['catch'](handleError(_0x43e878,null));};exports[_0xbb4f('0x4d')]=function(_0x4af21f,_0x16d095){var _0x3d7806={'raw':![],'where':{'id':_0x4af21f[_0xbb4f('0x4e')]['id']}},_0x278690={};_0x278690['model']=_[_0xbb4f('0x3a')](db[_0xbb4f('0x35')][_0xbb4f('0x4f')]);_0x278690[_0xbb4f('0x39')]=_['keys'](_0x4af21f['query']);_0x278690['filters']=_[_0xbb4f('0x3c')](_0x278690['model'],_0x278690[_0xbb4f('0x39')]);_0x3d7806['attributes']=_['intersection'](_0x278690['model'],qs['fields'](_0x4af21f['query'][_0xbb4f('0x3e')]));_0x3d7806[_0xbb4f('0x3d')]=_0x3d7806[_0xbb4f('0x3d')][_0xbb4f('0x3f')]?_0x3d7806['attributes']:_0x278690[_0xbb4f('0x38')];if(_0x4af21f[_0xbb4f('0x39')]['includeAll']){_0x3d7806['include']=[{'all':!![]}];}_0x3d7806=_[_0xbb4f('0x48')]({},_0x3d7806,_0x4af21f['options']);return db[_0xbb4f('0x35')][_0xbb4f('0x50')](_0x3d7806)[_0xbb4f('0x2c')](handleEntityNotFound(_0x16d095,null))['then'](respondWithResult(_0x16d095,null))[_0xbb4f('0x51')](handleError(_0x16d095,null));};exports['create']=function(_0x29ac7c,_0x4893e2){return db[_0xbb4f('0x35')][_0xbb4f('0x52')](_0x29ac7c[_0xbb4f('0x53')],{})['then'](function(_0x1e665c){var _0x2ad084=_0x29ac7c[_0xbb4f('0x54')][_0xbb4f('0x55')]({'plain':!![]});if(!_0x2ad084)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ad084[_0xbb4f('0x56')]==='user'){var _0x493fd1=_0x1e665c[_0xbb4f('0x55')]({'plain':!![]});var _0x5e9cf7=_0xbb4f('0x2e');return db[_0xbb4f('0x57')]['find']({'where':{'name':_0x5e9cf7,'userProfileId':_0x2ad084[_0xbb4f('0x58')]},'raw':!![]})[_0xbb4f('0x2c')](function(_0x10a54a){if(_0x10a54a&&_0x10a54a[_0xbb4f('0x59')]===0x0){return db[_0xbb4f('0x2f')]['create']({'name':_0x493fd1[_0xbb4f('0x31')],'resourceId':_0x493fd1['id'],'type':_0x10a54a[_0xbb4f('0x31')],'sectionId':_0x10a54a['id']},{})[_0xbb4f('0x2c')](function(){return _0x1e665c;});}else{return _0x1e665c;}})['catch'](function(_0xc15236){logger[_0xbb4f('0x5a')](_0xbb4f('0x5b'),_0xc15236);throw _0xc15236;});}return _0x1e665c;})[_0xbb4f('0x2c')](respondWithResult(_0x4893e2,0xc9))[_0xbb4f('0x51')](handleError(_0x4893e2,null));};exports[_0xbb4f('0x2b')]=function(_0x3ee372,_0x450966){if(_0x3ee372[_0xbb4f('0x53')]['id']){delete _0x3ee372[_0xbb4f('0x53')]['id'];}return db['CmList']['find']({'where':{'id':_0x3ee372[_0xbb4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x450966,null))[_0xbb4f('0x2c')](saveUpdates(_0x3ee372[_0xbb4f('0x53')],null))[_0xbb4f('0x2c')](respondWithResult(_0x450966,null))[_0xbb4f('0x51')](handleError(_0x450966,null));};exports['destroy']=function(_0x32024e,_0xf3ecd2){return db[_0xbb4f('0x35')][_0xbb4f('0x50')]({'where':{'id':_0x32024e[_0xbb4f('0x4e')]['id']}})[_0xbb4f('0x2c')](handleEntityNotFound(_0xf3ecd2,null))[_0xbb4f('0x2c')](removeEntity(_0xf3ecd2,null))[_0xbb4f('0x51')](handleError(_0xf3ecd2,null));};exports['describe']=function(_0x559b1b,_0x1947d9){return db[_0xbb4f('0x35')][_0xbb4f('0x5c')]()['then'](respondWithResult(_0x1947d9,null))[_0xbb4f('0x51')](handleError(_0x1947d9,null));};exports[_0xbb4f('0x5d')]=function(_0x43196a,_0x4d31da,_0x3efc9d){if(_0x43196a[_0xbb4f('0x53')]['id']){delete _0x43196a[_0xbb4f('0x53')]['id'];}return db['CmList'][_0xbb4f('0x50')]({'where':{'id':_0x43196a[_0xbb4f('0x4e')]['id']}})[_0xbb4f('0x2c')](handleEntityNotFound(_0x4d31da,null))[_0xbb4f('0x2c')](function(_0x21a929){if(_0x21a929){_0x43196a['body'][_0xbb4f('0x5e')]=_0x21a929['id'];return db[_0xbb4f('0x5f')][_0xbb4f('0x52')](_0x43196a[_0xbb4f('0x53')]);}})[_0xbb4f('0x2c')](respondWithResult(_0x4d31da,null))[_0xbb4f('0x51')](handleError(_0x4d31da,null));};exports['getDispositions']=function(_0x2e69cf,_0x1239b0,_0x2956cf){var _0x3c98ee={'raw':![],'where':{}};var _0x1e08ee={};var _0x1f1f48={'count':0x0,'rows':[]};return db['CmList'][_0xbb4f('0x60')]({'where':{'id':_0x2e69cf[_0xbb4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1239b0,null))[_0xbb4f('0x2c')](function(_0x489f2f){if(_0x489f2f){_0x1e08ee[_0xbb4f('0x38')]=_[_0xbb4f('0x3a')](db[_0xbb4f('0x5f')][_0xbb4f('0x4f')]);_0x1e08ee[_0xbb4f('0x39')]=_[_0xbb4f('0x3a')](_0x2e69cf[_0xbb4f('0x39')]);_0x1e08ee[_0xbb4f('0x3b')]=_[_0xbb4f('0x3c')](_0x1e08ee[_0xbb4f('0x38')],_0x1e08ee[_0xbb4f('0x39')]);_0x3c98ee[_0xbb4f('0x3d')]=_[_0xbb4f('0x3c')](_0x1e08ee[_0xbb4f('0x38')],qs['fields'](_0x2e69cf[_0xbb4f('0x39')][_0xbb4f('0x3e')]));_0x3c98ee[_0xbb4f('0x3d')]=_0x3c98ee[_0xbb4f('0x3d')][_0xbb4f('0x3f')]?_0x3c98ee[_0xbb4f('0x3d')]:_0x1e08ee[_0xbb4f('0x38')];if(!_0x2e69cf['query'][_0xbb4f('0x40')](_0xbb4f('0x61'))){_0x3c98ee['limit']=qs[_0xbb4f('0x27')](_0x2e69cf[_0xbb4f('0x39')][_0xbb4f('0x27')]);_0x3c98ee[_0xbb4f('0x41')]=qs['offset'](_0x2e69cf[_0xbb4f('0x39')][_0xbb4f('0x41')]);}_0x3c98ee[_0xbb4f('0x42')]=qs[_0xbb4f('0x43')](_0x2e69cf[_0xbb4f('0x39')][_0xbb4f('0x43')]);_0x3c98ee[_0xbb4f('0x44')]=qs['filters'](_[_0xbb4f('0x45')](_0x2e69cf[_0xbb4f('0x39')],_0x1e08ee[_0xbb4f('0x3b')]));_0x3c98ee[_0xbb4f('0x44')][_0xbb4f('0x5e')]=_0x489f2f['id'];if(_0x2e69cf[_0xbb4f('0x39')][_0xbb4f('0x46')]){_0x3c98ee[_0xbb4f('0x44')]=_[_0xbb4f('0x48')](_0x3c98ee[_0xbb4f('0x44')],{'$or':_[_0xbb4f('0x34')](_0x3c98ee[_0xbb4f('0x3d')],function(_0x106846){var _0xcdb38d={};_0xcdb38d[_0x106846]={'$like':'%'+_0x2e69cf['query'][_0xbb4f('0x46')]+'%'};return _0xcdb38d;})});}_0x3c98ee=_[_0xbb4f('0x48')]({},_0x3c98ee,_0x2e69cf[_0xbb4f('0x49')]);return db[_0xbb4f('0x5f')][_0xbb4f('0x26')]({'where':_0x3c98ee[_0xbb4f('0x44')]})['then'](function(_0x4755b6){_0x1f1f48['count']=_0x4755b6;if(_0x2e69cf[_0xbb4f('0x39')]['includeAll']){_0x3c98ee[_0xbb4f('0x4b')]=[{'all':!![]}];}return db[_0xbb4f('0x5f')][_0xbb4f('0x4c')](_0x3c98ee);})[_0xbb4f('0x2c')](function(_0x1d1916){_0x1f1f48['rows']=_0x1d1916;return _0x1f1f48;});}})['then'](respondWithFilteredResult(_0x1239b0,_0x3c98ee))[_0xbb4f('0x51')](handleError(_0x1239b0,null));};exports[_0xbb4f('0x62')]=function(_0x4487f0,_0x93ac9f,_0x15a20d){return db['CmList'][_0xbb4f('0x50')]({'where':{'id':_0x4487f0[_0xbb4f('0x4e')]['id']}})[_0xbb4f('0x2c')](handleEntityNotFound(_0x93ac9f,null))[_0xbb4f('0x2c')](function(_0x2226ad){if(_0x2226ad){return _0x2226ad['removeDispositions'](_0x4487f0[_0xbb4f('0x39')][_0xbb4f('0x63')]);}})['then'](respondWithStatusCode(_0x93ac9f,null))[_0xbb4f('0x51')](handleError(_0x93ac9f,null));};exports[_0xbb4f('0x64')]=function(_0x8384a1,_0x4456e3,_0x5881df){return db[_0xbb4f('0x35')][_0xbb4f('0x50')]({'where':{'id':_0x8384a1[_0xbb4f('0x4e')]['id']}})[_0xbb4f('0x2c')](handleEntityNotFound(_0x4456e3,null))[_0xbb4f('0x2c')](function(_0x34effe){if(_0x34effe){var _0x4db441=[];var _0x1bbc05={'success':[],'errors':[]};return db['CmContact'][_0xbb4f('0x5c')]()[_0xbb4f('0x2c')](function(_0x3900e0){if(_0x8384a1[_0xbb4f('0x53')][_0xbb4f('0x65')]&&_[_0xbb4f('0x66')](_0x8384a1[_0xbb4f('0x53')]['tags'])){if(_0x8384a1[_0xbb4f('0x53')][_0xbb4f('0x65')]['length']){_0x8384a1['body'][_0xbb4f('0x65')]=_0x8384a1['body'][_0xbb4f('0x65')][_0xbb4f('0x67')](';')+';';}else{_0x8384a1[_0xbb4f('0x53')][_0xbb4f('0x65')]=null;}}else{_0x8384a1[_0xbb4f('0x53')]['tags']=null;}if(_0x8384a1[_0xbb4f('0x53')]&&_[_0xbb4f('0x66')](_0x8384a1[_0xbb4f('0x53')])){for(var _0x155eeb=0x0;_0x155eeb<_0x8384a1[_0xbb4f('0x53')][_0xbb4f('0x3f')];_0x155eeb+=0x1){_0x8384a1['body'][_0x155eeb]['ListId']=_0x8384a1[_0xbb4f('0x4e')]['id'];_0x4db441['push'](_0x8384a1[_0xbb4f('0x53')][_0x155eeb]);}return BPromise[_0xbb4f('0x68')](_0x4db441,function(_0xd870bb){return db['CmContact'][_0xbb4f('0x52')](_[_0xbb4f('0x69')](_0xd870bb,[_0xbb4f('0x63'),'id'])||{},{'fields':_[_0xbb4f('0x3a')](_0x3900e0),'raw':!![]})[_0xbb4f('0x2c')](function(_0x3f85c7){_0x1bbc05['success']['push'](_0x3f85c7['dataValues']);})[_0xbb4f('0x51')](function(_0x3f56a4){_0x1bbc05[_0xbb4f('0x6a')][_0xbb4f('0x6b')]({'data':_0xd870bb,'error':_0x3f56a4[_0xbb4f('0x6c')]});});})[_0xbb4f('0x2c')](function(_0x8f1c1a){return _0x1bbc05;})[_0xbb4f('0x51')](function(_0x280ca4){return _0x280ca4;});}else{_0x4456e3[_0xbb4f('0x23')](0x190)[_0xbb4f('0x25')]({'message':_0xbb4f('0x6d')});}});}})['then'](respondWithResult(_0x4456e3,null))[_0xbb4f('0x51')](handleError(_0x4456e3,null));};exports[_0xbb4f('0x6e')]=function(_0x2fa5a3,_0x1e5053,_0x5a282b){var _0xbbc12f;return db[_0xbb4f('0x35')][_0xbb4f('0x50')]({'where':{'id':_0x2fa5a3[_0xbb4f('0x4e')]['id']},'include':[{'model':db[_0xbb4f('0x6f')],'as':_0xbb4f('0x70')}]})[_0xbb4f('0x2c')](handleEntityNotFound(_0x1e5053,null))[_0xbb4f('0x2c')](function(_0x510d7b){if(_0x510d7b){_0xbbc12f=_0x510d7b;return db[_0xbb4f('0x71')][_0xbb4f('0x4f')];}})[_0xbb4f('0x2c')](function(_0x9e81b0){if(_0x9e81b0){var _0x5e01c0={};var _0x167c1e={};_0x167c1e[_0xbb4f('0x38')]=_[_0xbb4f('0x72')](_[_0xbb4f('0x3a')](_0x9e81b0),_[_0xbb4f('0x34')](_0xbbc12f[_0xbb4f('0x70')],function(_0x3104f7){return util[_0xbb4f('0x73')](_0xbb4f('0x74'),_0x3104f7['id']);}));_0x167c1e['query']=_[_0xbb4f('0x3a')](_0x2fa5a3[_0xbb4f('0x39')]);_0x167c1e[_0xbb4f('0x3b')]=_[_0xbb4f('0x3c')](_0x167c1e[_0xbb4f('0x38')],_0x167c1e['query']);_0x5e01c0[_0xbb4f('0x3d')]=_[_0xbb4f('0x3c')](_0x167c1e['model'],qs[_0xbb4f('0x3e')](_0x2fa5a3[_0xbb4f('0x39')][_0xbb4f('0x3e')]));_0x5e01c0[_0xbb4f('0x3d')]=_0x5e01c0['attributes']['length']?_0x5e01c0[_0xbb4f('0x3d')]:_0x167c1e['model'];if(!_0x2fa5a3[_0xbb4f('0x39')][_0xbb4f('0x40')](_0xbb4f('0x61'))){_0x5e01c0[_0xbb4f('0x27')]=qs[_0xbb4f('0x27')](_0x2fa5a3[_0xbb4f('0x39')][_0xbb4f('0x27')]);_0x5e01c0[_0xbb4f('0x41')]=qs[_0xbb4f('0x41')](_0x2fa5a3[_0xbb4f('0x39')][_0xbb4f('0x41')]);}_0x5e01c0[_0xbb4f('0x42')]=qs['sort'](_0x2fa5a3['query'][_0xbb4f('0x43')]);_0x5e01c0[_0xbb4f('0x44')]=qs['filters'](_[_0xbb4f('0x45')](_0x2fa5a3['query'],_0x167c1e[_0xbb4f('0x3b')]));_0x5e01c0['raw']=!![];if(_0x2fa5a3['query'][_0xbb4f('0x46')]){_0x5e01c0[_0xbb4f('0x44')]=_[_0xbb4f('0x48')](_0x5e01c0['where'],{'$or':_[_0xbb4f('0x34')](_0x5e01c0[_0xbb4f('0x3d')],function(_0x220538){var _0x3365f6={};_0x3365f6[_0x220538]={'$like':'%'+_0x2fa5a3['query'][_0xbb4f('0x46')]+'%'};return _0x3365f6;})});}_0x5e01c0=_['merge']({},_0x5e01c0,_0x2fa5a3[_0xbb4f('0x49')]);return _0xbbc12f[_0xbb4f('0x6e')](_0x5e01c0);}})[_0xbb4f('0x2c')](respondWithResult(_0x1e5053,null))[_0xbb4f('0x51')](handleError(_0x1e5053,null));};exports[_0xbb4f('0x75')]=function(_0x5a2934,_0xacf250,_0x4761b0){var _0x261145;return db['CmList'][_0xbb4f('0x50')]({'where':{'id':_0x5a2934['params']['id']},'include':[{'model':db[_0xbb4f('0x6f')],'as':_0xbb4f('0x70')}]})[_0xbb4f('0x2c')](handleEntityNotFound(_0xacf250,null))[_0xbb4f('0x2c')](function(_0x1117a7){if(_0x1117a7){_0x261145=_0x1117a7;return db[_0xbb4f('0x71')]['rawAttributes'];}})['then'](function(_0x247a0e){if(_0x247a0e){var _0x1668ac={};var _0x1430c1={};_0x1430c1['model']=_[_0xbb4f('0x72')](_[_0xbb4f('0x3a')](_0x247a0e),_[_0xbb4f('0x34')](_0x261145['CustomFields'],function(_0x420574){return util[_0xbb4f('0x73')]('cf_%d',_0x420574['id']);}));_0x1430c1[_0xbb4f('0x39')]=_[_0xbb4f('0x3a')](_0x5a2934['query']);_0x1430c1[_0xbb4f('0x3b')]=_['intersection'](_0x1430c1[_0xbb4f('0x38')],_0x1430c1[_0xbb4f('0x39')]);_0x1668ac[_0xbb4f('0x3d')]=_[_0xbb4f('0x3c')](_0x1430c1[_0xbb4f('0x38')],qs[_0xbb4f('0x3e')](_0x5a2934[_0xbb4f('0x39')][_0xbb4f('0x3e')]));_0x1668ac[_0xbb4f('0x3d')]=_0x1668ac['attributes'][_0xbb4f('0x3f')]?_0x1668ac['attributes']:_0x1430c1[_0xbb4f('0x38')];if(!_0x5a2934['query']['hasOwnProperty'](_0xbb4f('0x61'))){_0x1668ac['limit']=qs['limit'](_0x5a2934[_0xbb4f('0x39')][_0xbb4f('0x27')]);_0x1668ac['offset']=qs[_0xbb4f('0x41')](_0x5a2934[_0xbb4f('0x39')][_0xbb4f('0x41')]);}_0x1668ac[_0xbb4f('0x42')]=qs[_0xbb4f('0x43')](_0x5a2934[_0xbb4f('0x39')][_0xbb4f('0x43')]);_0x1668ac['where']=qs['filters'](_[_0xbb4f('0x45')](_0x5a2934[_0xbb4f('0x39')],_0x1430c1[_0xbb4f('0x3b')]));_0x1668ac[_0xbb4f('0x76')]=!![];if(_0x5a2934[_0xbb4f('0x39')]['filter']){_0x1668ac[_0xbb4f('0x44')]=_[_0xbb4f('0x48')](_0x1668ac[_0xbb4f('0x44')],{'$or':_[_0xbb4f('0x34')](_0x1668ac[_0xbb4f('0x3d')],function(_0x1d17c1){var _0x10688c={};_0x10688c[_0x1d17c1]={'$like':'%'+_0x5a2934['query']['filter']+'%'};return _0x10688c;})});}_0x1668ac=_['merge']({},_0x1668ac,_0x5a2934[_0xbb4f('0x49')]);return _0x261145[_0xbb4f('0x6e')](_0x1668ac);}})[_0xbb4f('0x2c')](function(_0x59d687){if(!_[_0xbb4f('0x77')](_0x59d687)){var _0x564d67=toCsv(_0x59d687);var _0x37363b=Date[_0xbb4f('0x78')]();fs[_0xbb4f('0x79')](util[_0xbb4f('0x73')](_0xbb4f('0x7a'),_0x261145['id'],_0x37363b),_0x564d67);_0xacf250[_0xbb4f('0x7b')](_0xbb4f('0x7c'),_0xbb4f('0x7d')+util[_0xbb4f('0x73')](_0xbb4f('0x7e'),_0x261145['id'],_0x37363b));_0xacf250[_0xbb4f('0x7b')]('Content-type',_0xbb4f('0x7f'));return _0xacf250[_0xbb4f('0x80')](util['format'](_0xbb4f('0x7a'),_0x261145['id'],_0x37363b));}else{return _0xacf250[_0xbb4f('0x22')](0xcc);}})[_0xbb4f('0x51')](handleError(_0xacf250,null));};exports[_0xbb4f('0x81')]=function(_0x5487d5,_0x2ef1b1,_0xc4b17c){var _0x2cfbc4;delete _0x5487d5['body']['id'];return db[_0xbb4f('0x35')][_0xbb4f('0x60')]({'where':{'id':_0x5487d5[_0xbb4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2ef1b1,null))[_0xbb4f('0x2c')](function(_0x5134e7){if(_0x5134e7){return db[_0xbb4f('0x82')]['transaction'](function(_0x3a7c9b){return db[_0xbb4f('0x6f')][_0xbb4f('0x52')](_0x5487d5[_0xbb4f('0x53')],{'transaction':_0x3a7c9b})['then'](function(_0x3282b2){_0x2cfbc4=_0x3282b2;return _0x5134e7[_0xbb4f('0x83')](_0x3282b2,{'transaction':_0x3a7c9b});})[_0xbb4f('0x2c')](function(){var _0xc4217f={'type':db['Sequelize'][_0xbb4f('0x84')],'transaction':_0x3a7c9b};switch(_0x5487d5[_0xbb4f('0x53')][_0xbb4f('0x37')]){case _0xbb4f('0x85'):_0xc4217f[_0xbb4f('0x37')]=db[_0xbb4f('0x86')]['TEXT'];break;case _0xbb4f('0x87'):_0xc4217f[_0xbb4f('0x37')]=db[_0xbb4f('0x86')][_0xbb4f('0x88')];break;case _0xbb4f('0x89'):_0xc4217f[_0xbb4f('0x37')]=db[_0xbb4f('0x86')][_0xbb4f('0x8a')];_0xc4217f['defaultValue']=![];break;default:}return db['sequelize']['queryInterface']['addColumn']('cm_contacts',util[_0xbb4f('0x73')](_0xbb4f('0x8b'),_0x2cfbc4['id']),_0xc4217f);})[_0xbb4f('0x2c')](function(){return _0x2cfbc4;});});}})['then'](respondWithResult(_0x2ef1b1,null))[_0xbb4f('0x51')](handleError(_0x2ef1b1,null));};exports[_0xbb4f('0x8c')]=function(_0x5967b8,_0x2b2de9,_0x4b39ee){var _0x3264e3={};var _0x5bab24={};var _0x35ad0f;var _0x26fb01;return db[_0xbb4f('0x35')][_0xbb4f('0x60')]({'where':{'id':_0x5967b8[_0xbb4f('0x4e')]['id']}})[_0xbb4f('0x2c')](handleEntityNotFound(_0x2b2de9,null))[_0xbb4f('0x2c')](function(_0x21c18f){if(_0x21c18f){_0x35ad0f=_0x21c18f;_0x5bab24[_0xbb4f('0x38')]=_['keys'](db[_0xbb4f('0x6f')][_0xbb4f('0x4f')]);_0x5bab24[_0xbb4f('0x39')]=_[_0xbb4f('0x3a')](_0x5967b8[_0xbb4f('0x39')]);_0x5bab24['filters']=_[_0xbb4f('0x3c')](_0x5bab24[_0xbb4f('0x38')],_0x5bab24[_0xbb4f('0x39')]);_0x3264e3[_0xbb4f('0x3d')]=_[_0xbb4f('0x3c')](_0x5bab24[_0xbb4f('0x38')],qs['fields'](_0x5967b8['query'][_0xbb4f('0x3e')]));_0x3264e3['attributes']=_0x3264e3[_0xbb4f('0x3d')][_0xbb4f('0x3f')]?_0x3264e3[_0xbb4f('0x3d')]:_0x5bab24[_0xbb4f('0x38')];_0x3264e3[_0xbb4f('0x42')]=qs[_0xbb4f('0x43')](_0x5967b8[_0xbb4f('0x39')][_0xbb4f('0x43')]);_0x3264e3['where']=qs['filters'](_[_0xbb4f('0x45')](_0x5967b8[_0xbb4f('0x39')],_0x5bab24['filters']));_0x3264e3[_0xbb4f('0x44')]=_[_0xbb4f('0x48')](_0x3264e3[_0xbb4f('0x44')],{'$or':[{'ListId':_0x21c18f['id']},{'ListId':null}]});if(_0x5967b8['query'][_0xbb4f('0x46')]){_0x3264e3[_0xbb4f('0x44')]=_['merge'](_0x3264e3[_0xbb4f('0x44')],{'$or':_[_0xbb4f('0x34')](_0x3264e3['attributes'],function(_0x26eebe){var _0x41747b={};_0x41747b[_0x26eebe]={'$like':'%'+_0x5967b8[_0xbb4f('0x39')][_0xbb4f('0x46')]+'%'};return _0x41747b;})});}_0x3264e3=_[_0xbb4f('0x48')]({},_0x3264e3,_0x5967b8[_0xbb4f('0x49')]);return db['CmCustomField'][_0xbb4f('0x8d')](_0x3264e3);}})['then'](respondWithResult(_0x2b2de9,null))[_0xbb4f('0x51')](handleError(_0x2b2de9,null));};exports['addAgents']=function(_0x3477a0,_0x19b9ad,_0x4694db){return db[_0xbb4f('0x35')]['find']({'where':{'id':_0x3477a0[_0xbb4f('0x4e')]['id']}})[_0xbb4f('0x2c')](handleEntityNotFound(_0x19b9ad,null))[_0xbb4f('0x2c')](function(_0x1491b1){if(_0x1491b1){return _0x1491b1[_0xbb4f('0x8e')](_0x3477a0[_0xbb4f('0x53')]['ids'],_[_0xbb4f('0x69')](_0x3477a0[_0xbb4f('0x53')],['ids','id'])||{})[_0xbb4f('0x8f')](function(_0x4e3705){for(var _0x108fbc=0x0;_0x108fbc<_0x3477a0[_0xbb4f('0x53')][_0xbb4f('0x63')]['length'];_0x108fbc+=0x1){socket[_0xbb4f('0x90')](_0xbb4f('0x91'),{'UserId':_0x3477a0[_0xbb4f('0x53')][_0xbb4f('0x63')][_0x108fbc],'CmListId':_0x3477a0[_0xbb4f('0x4e')]['id']});}return _0x4e3705;});}})[_0xbb4f('0x2c')](respondWithResult(_0x19b9ad,null))[_0xbb4f('0x51')](handleError(_0x19b9ad,null));};exports[_0xbb4f('0x92')]=function(_0x5ba464,_0x4b31ea,_0x2e2715){return db[_0xbb4f('0x35')][_0xbb4f('0x50')]({'where':{'id':_0x5ba464[_0xbb4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4b31ea,null))[_0xbb4f('0x2c')](function(_0xc1eac7){if(_0xc1eac7){return _0xc1eac7[_0xbb4f('0x92')](_0x5ba464[_0xbb4f('0x39')][_0xbb4f('0x63')])[_0xbb4f('0x2c')](function(){if(_[_0xbb4f('0x66')](_0x5ba464[_0xbb4f('0x39')][_0xbb4f('0x63')])){for(var _0xe60194=0x0;_0xe60194<_0x5ba464[_0xbb4f('0x39')][_0xbb4f('0x63')][_0xbb4f('0x3f')];_0xe60194+=0x1){socket[_0xbb4f('0x90')](_0xbb4f('0x93'),{'UserId':Number(_0x5ba464['query']['ids'][_0xe60194]),'CmListId':Number(_0x5ba464[_0xbb4f('0x4e')]['id'])});}}else{socket[_0xbb4f('0x90')]('userCmList:remove',{'UserId':Number(_0x5ba464[_0xbb4f('0x39')]['ids']),'CmListId':Number(_0x5ba464[_0xbb4f('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x4b31ea,null))[_0xbb4f('0x51')](handleError(_0x4b31ea,null));};exports[_0xbb4f('0x94')]=function(_0x31be6d,_0x3e5819,_0x347185){var _0x4cdd48={};var _0x11c935={};var _0x204d10;var _0x384c4a;return db[_0xbb4f('0x35')][_0xbb4f('0x60')]({'where':{'id':_0x31be6d[_0xbb4f('0x4e')]['id']}})[_0xbb4f('0x2c')](handleEntityNotFound(_0x3e5819,null))[_0xbb4f('0x2c')](function(_0x22e4f7){if(_0x22e4f7){_0x204d10=_0x22e4f7;_0x11c935[_0xbb4f('0x38')]=_[_0xbb4f('0x3a')](db[_0xbb4f('0x95')]['rawAttributes']);_0x11c935[_0xbb4f('0x39')]=_[_0xbb4f('0x3a')](_0x31be6d[_0xbb4f('0x39')]);_0x11c935[_0xbb4f('0x3b')]=_[_0xbb4f('0x3c')](_0x11c935[_0xbb4f('0x38')],_0x11c935[_0xbb4f('0x39')]);_0x4cdd48[_0xbb4f('0x3d')]=_[_0xbb4f('0x3c')](_0x11c935[_0xbb4f('0x38')],qs[_0xbb4f('0x3e')](_0x31be6d['query'][_0xbb4f('0x3e')]));_0x4cdd48['attributes']=_0x4cdd48[_0xbb4f('0x3d')][_0xbb4f('0x3f')]?_0x4cdd48[_0xbb4f('0x3d')]:_0x11c935[_0xbb4f('0x38')];_0x4cdd48[_0xbb4f('0x42')]=qs['sort'](_0x31be6d[_0xbb4f('0x39')]['sort']);_0x4cdd48[_0xbb4f('0x44')]=qs[_0xbb4f('0x3b')](_[_0xbb4f('0x45')](_0x31be6d[_0xbb4f('0x39')],_0x11c935[_0xbb4f('0x3b')]));if(_0x31be6d['query'][_0xbb4f('0x46')]){_0x4cdd48[_0xbb4f('0x44')]=_[_0xbb4f('0x48')](_0x4cdd48[_0xbb4f('0x44')],{'$or':_[_0xbb4f('0x34')](_0x4cdd48[_0xbb4f('0x3d')],function(_0x12bef4){var _0x2aca44={};_0x2aca44[_0x12bef4]={'$like':'%'+_0x31be6d['query'][_0xbb4f('0x46')]+'%'};return _0x2aca44;})});}_0x4cdd48=_[_0xbb4f('0x48')]({},_0x4cdd48,_0x31be6d[_0xbb4f('0x49')]);return _0x204d10[_0xbb4f('0x94')](_0x4cdd48);}})[_0xbb4f('0x2c')](function(_0x254409){if(_0x254409){_0x384c4a=_0x254409[_0xbb4f('0x3f')];if(!_0x31be6d[_0xbb4f('0x39')][_0xbb4f('0x40')](_0xbb4f('0x61'))){_0x4cdd48[_0xbb4f('0x27')]=qs[_0xbb4f('0x27')](_0x31be6d['query'][_0xbb4f('0x27')]);_0x4cdd48[_0xbb4f('0x41')]=qs[_0xbb4f('0x41')](_0x31be6d[_0xbb4f('0x39')][_0xbb4f('0x41')]);}return _0x204d10[_0xbb4f('0x94')](_0x4cdd48);}})[_0xbb4f('0x2c')](function(_0x39e64d){if(_0x39e64d){return _0x39e64d?{'count':_0x384c4a,'rows':_0x39e64d}:null;}})[_0xbb4f('0x2c')](respondWithResult(_0x3e5819,null))[_0xbb4f('0x51')](handleError(_0x3e5819,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a8c0181..485fb8b 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 _0x0ea7=['exports','CmList','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x0ea7,0x171));var _0x70ea=function(_0x22d210,_0x10a999){_0x22d210=_0x22d210-0x0;var _0x2f7178=_0x0ea7[_0x22d210];return _0x2f7178;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db'][_0x70ea('0x0')];var CmListEvents=new EventEmitter();CmListEvents[_0x70ea('0x1')](0x0);var events={'afterCreate':_0x70ea('0x2'),'afterUpdate':_0x70ea('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1141b4){return function(_0x48b813,_0x4e87ce,_0x505739){CmListEvents[_0x70ea('0x4')](_0x1141b4+':'+_0x48b813['id'],_0x48b813);CmListEvents[_0x70ea('0x4')](_0x1141b4,_0x48b813);_0x505739(null);};}for(var e in events){if(events[_0x70ea('0x5')](e)){var event=events[e];CmList[_0x70ea('0x6')](e,emitEvent(event));}}module[_0x70ea('0x7')]=CmListEvents; \ No newline at end of file +var _0xa6a4=['emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x273adf,_0x31a583){var _0x37e6ec=function(_0x3ee9c3){while(--_0x3ee9c3){_0x273adf['push'](_0x273adf['shift']());}};_0x37e6ec(++_0x31a583);}(_0xa6a4,0x192));var _0x4a6a=function(_0x3335e2,_0x44805a){_0x3335e2=_0x3335e2-0x0;var _0x3c5458=_0xa6a4[_0x3335e2];return _0x3c5458;};'use strict';var EventEmitter=require(_0x4a6a('0x0'));var CmList=require(_0x4a6a('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4a6a('0x2'),'afterUpdate':_0x4a6a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4175ff){return function(_0x54a65c,_0x36cbd9,_0x584af1){CmListEvents[_0x4a6a('0x4')](_0x4175ff+':'+_0x54a65c['id'],_0x54a65c);CmListEvents['emit'](_0x4175ff,_0x54a65c);_0x584af1(null);};}for(var e in events){if(events[_0x4a6a('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x4a6a('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 121caa2..028ecc6 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 _0x90ed=['util','../../config/logger','api','moment','bluebird','path','rimraf','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x4af6a0,_0x522121){var _0x4c2b23=function(_0x2f5955){while(--_0x2f5955){_0x4af6a0['push'](_0x4af6a0['shift']());}};_0x4c2b23(++_0x522121);}(_0x90ed,0x1ed));var _0xd90e=function(_0x3c7165,_0x5d8020){_0x3c7165=_0x3c7165-0x0;var _0x1c518d=_0x90ed[_0x3c7165];return _0x1c518d;};'use strict';var _=require(_0xd90e('0x0'));var util=require(_0xd90e('0x1'));var logger=require(_0xd90e('0x2'))(_0xd90e('0x3'));var moment=require(_0xd90e('0x4'));var BPromise=require(_0xd90e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd90e('0x6'));var rimraf=require(_0xd90e('0x7'));var config=require('../../config/environment');var attributes=require(_0xd90e('0x8'));module[_0xd90e('0x9')]=function(_0x54d905,_0x27077b){return _0x54d905[_0xd90e('0xa')](_0xd90e('0xb'),attributes,{'tableName':_0xd90e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a84=['rimraf','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','path'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x0a84,0x9b));var _0x40a8=function(_0x4a72f5,_0x3ab023){_0x4a72f5=_0x4a72f5-0x0;var _0x2bbfa3=_0x0a84[_0x4a72f5];return _0x2bbfa3;};'use strict';var _=require(_0x40a8('0x0'));var util=require(_0x40a8('0x1'));var logger=require(_0x40a8('0x2'))('api');var moment=require(_0x40a8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x40a8('0x4'));var rimraf=require(_0x40a8('0x5'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0x40a8('0x6')]=function(_0x1a1a7e,_0x54f63c){return _0x1a1a7e[_0x40a8('0x7')](_0x40a8('0x8'),attributes,{'tableName':_0x40a8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index c9f900a..d73a592 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 _0x1c22=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result','catch'];(function(_0x2a4521,_0x3871c2){var _0x48eab6=function(_0x1e43a5){while(--_0x1e43a5){_0x2a4521['push'](_0x2a4521['shift']());}};_0x48eab6(++_0x3871c2);}(_0x1c22,0x1ed));var _0x21c2=function(_0x3b6ec2,_0xef2a6c){_0x3b6ec2=_0x3b6ec2-0x0;var _0x20c994=_0x1c22[_0x3b6ec2];return _0x20c994;};'use strict';var _=require('lodash');var util=require(_0x21c2('0x0'));var moment=require(_0x21c2('0x1'));var BPromise=require(_0x21c2('0x2'));var rs=require(_0x21c2('0x3'));var fs=require('fs');var Redis=require(_0x21c2('0x4'));var db=require(_0x21c2('0x5'))['db'];var utils=require(_0x21c2('0x6'));var logger=require(_0x21c2('0x7'))(_0x21c2('0x8'));var config=require(_0x21c2('0x9'));var jayson=require(_0x21c2('0xa'));var client=jayson[_0x21c2('0xb')][_0x21c2('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x21c2('0xd')],{'host':_0x21c2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21c2('0xd')]));require(_0x21c2('0xf'))[_0x21c2('0x10')](socket);function respondWithRpcPromise(_0x5c68a7,_0x27493c,_0x3c1262){return new BPromise(function(_0x6b955f,_0x388a47){return client[_0x21c2('0x11')](_0x5c68a7,_0x3c1262)[_0x21c2('0x12')](function(_0xbca2ac){logger['info']('CmList,\x20%s,\x20%s',_0x27493c,'request\x20sent');logger['debug'](_0x21c2('0x13'),_0x27493c,_0x21c2('0x14'),JSON[_0x21c2('0x15')](_0xbca2ac));if(_0xbca2ac[_0x21c2('0x16')]){if(_0xbca2ac['error'][_0x21c2('0x17')]===0x1f4){logger[_0x21c2('0x16')](_0x21c2('0x18'),_0x27493c,_0xbca2ac[_0x21c2('0x16')][_0x21c2('0x19')]);return _0x388a47(_0xbca2ac[_0x21c2('0x16')][_0x21c2('0x19')]);}logger[_0x21c2('0x16')](_0x21c2('0x18'),_0x27493c,_0xbca2ac[_0x21c2('0x16')][_0x21c2('0x19')]);return _0x6b955f(_0xbca2ac[_0x21c2('0x16')][_0x21c2('0x19')]);}else{logger[_0x21c2('0x1a')]('CmList,\x20%s,\x20%s',_0x27493c,_0x21c2('0x14'));_0x6b955f(_0xbca2ac[_0x21c2('0x1b')][_0x21c2('0x19')]);}})[_0x21c2('0x1c')](function(_0x400383){logger[_0x21c2('0x16')](_0x21c2('0x18'),_0x27493c,_0x400383);_0x388a47(_0x400383);});});} \ No newline at end of file +var _0x9f2d=['request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x4c19e6,_0x5764de){var _0xbdd212=function(_0x594ce3){while(--_0x594ce3){_0x4c19e6['push'](_0x4c19e6['shift']());}};_0xbdd212(++_0x5764de);}(_0x9f2d,0x10d));var _0xd9f2=function(_0x50ed3c,_0x700b20){_0x50ed3c=_0x50ed3c-0x0;var _0x4981ea=_0x9f2d[_0x50ed3c];return _0x4981ea;};'use strict';var _=require(_0xd9f2('0x0'));var util=require(_0xd9f2('0x1'));var moment=require(_0xd9f2('0x2'));var BPromise=require(_0xd9f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9f2('0x4'));var db=require(_0xd9f2('0x5'))['db'];var utils=require(_0xd9f2('0x6'));var logger=require(_0xd9f2('0x7'))(_0xd9f2('0x8'));var config=require(_0xd9f2('0x9'));var jayson=require(_0xd9f2('0xa'));var client=jayson[_0xd9f2('0xb')]['http']({'port':0x232a});config['redis']=_[_0xd9f2('0xc')](config[_0xd9f2('0xd')],{'host':_0xd9f2('0xe'),'port':0x18eb});var socket=require(_0xd9f2('0xf'))(new Redis(config[_0xd9f2('0xd')]));require('./cmList.socket')[_0xd9f2('0x10')](socket);function respondWithRpcPromise(_0x27e5cb,_0x48bed7,_0x3ee903){return new BPromise(function(_0x58101a,_0x6c86a4){return client[_0xd9f2('0x11')](_0x27e5cb,_0x3ee903)[_0xd9f2('0x12')](function(_0x4fe10c){logger[_0xd9f2('0x13')]('CmList,\x20%s,\x20%s',_0x48bed7,'request\x20sent');logger['debug'](_0xd9f2('0x14'),_0x48bed7,_0xd9f2('0x15'),JSON[_0xd9f2('0x16')](_0x4fe10c));if(_0x4fe10c[_0xd9f2('0x17')]){if(_0x4fe10c[_0xd9f2('0x17')][_0xd9f2('0x18')]===0x1f4){logger['error'](_0xd9f2('0x19'),_0x48bed7,_0x4fe10c[_0xd9f2('0x17')][_0xd9f2('0x1a')]);return _0x6c86a4(_0x4fe10c[_0xd9f2('0x17')][_0xd9f2('0x1a')]);}logger[_0xd9f2('0x17')]('CmList,\x20%s,\x20%s',_0x48bed7,_0x4fe10c[_0xd9f2('0x17')]['message']);return _0x58101a(_0x4fe10c[_0xd9f2('0x17')]['message']);}else{logger[_0xd9f2('0x13')](_0xd9f2('0x19'),_0x48bed7,_0xd9f2('0x15'));_0x58101a(_0x4fe10c[_0xd9f2('0x1b')][_0xd9f2('0x1a')]);}})[_0xd9f2('0x1c')](function(_0xca5e44){logger[_0xd9f2('0x17')]('CmList,\x20%s,\x20%s',_0x48bed7,_0xca5e44);_0x6c86a4(_0xca5e44);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index db8c1e6..f8401c5 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 _0x432b=['remove','update','removeListener','length','cmList:','./cmList.events'];(function(_0xb4bed2,_0x1ba3db){var _0x17a2a5=function(_0x3957c1){while(--_0x3957c1){_0xb4bed2['push'](_0xb4bed2['shift']());}};_0x17a2a5(++_0x1ba3db);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0xb432('0x0'));var events=['save',_0xb432('0x1'),_0xb432('0x2')];function createListener(_0x7170b6,_0xee80f1){return function(_0x5173f6){_0xee80f1['emit'](_0x7170b6,_0x5173f6);};}function removeListener(_0x93e722,_0x4cefc4){return function(){CmListEvents[_0xb432('0x3')](_0x93e722,_0x4cefc4);};}exports['register']=function(_0x143093){for(var _0x3f1a78=0x0,_0x274447=events[_0xb432('0x4')];_0x3f1a78<_0x274447;_0x3f1a78++){var _0x14fed4=events[_0x3f1a78];var _0x6833df=createListener(_0xb432('0x5')+_0x14fed4,_0x143093);CmListEvents['on'](_0x14fed4,_0x6833df);}}; \ No newline at end of file +var _0xf8de=['save','remove','emit','removeListener','register','cmList:'];(function(_0x38c534,_0x447801){var _0x5e6c46=function(_0x5491ce){while(--_0x5491ce){_0x38c534['push'](_0x38c534['shift']());}};_0x5e6c46(++_0x447801);}(_0xf8de,0x1d4));var _0xef8d=function(_0x58cc78,_0x34778a){_0x58cc78=_0x58cc78-0x0;var _0x522dcb=_0xf8de[_0x58cc78];return _0x522dcb;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xef8d('0x0'),_0xef8d('0x1'),'update'];function createListener(_0x1b57df,_0x55d0e7){return function(_0x3651ec){_0x55d0e7[_0xef8d('0x2')](_0x1b57df,_0x3651ec);};}function removeListener(_0x3cdc6d,_0x58851e){return function(){CmListEvents[_0xef8d('0x3')](_0x3cdc6d,_0x58851e);};}exports[_0xef8d('0x4')]=function(_0x586e39){for(var _0x2ba6b9=0x0,_0x52d5f2=events['length'];_0x2ba6b9<_0x52d5f2;_0x2ba6b9++){var _0x1f4163=events[_0x2ba6b9];var _0x3e74f1=createListener(_0xef8d('0x5')+_0x1f4163,_0x586e39);CmListEvents['on'](_0x1f4163,_0x3e74f1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9c05de7..07d1f9d 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 _0x207c=['../../config/environment','index','get','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d08e4,_0x1c1ba6){var _0x1c7d40=function(_0x378004){while(--_0x378004){_0x5d08e4['push'](_0x5d08e4['shift']());}};_0x1c7d40(++_0x1c1ba6);}(_0x207c,0x1e8));var _0xc207=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x207c[_0x195577];return _0x13c367;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),auth['isAuthenticated'](),controller[_0xc207('0xb')]);router[_0xc207('0x9')](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0xd')]);router[_0xc207('0x9')](_0xc207('0xe'),auth[_0xc207('0xf')](),controller[_0xc207('0x10')]);router[_0xc207('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0xc207('0x9')]('/:id/contacts/csv',auth[_0xc207('0xf')](),controller[_0xc207('0x11')]);router['get'](_0xc207('0x12'),auth[_0xc207('0xf')](),controller[_0xc207('0x13')]);router[_0xc207('0x9')](_0xc207('0x14'),auth['isAuthenticated'](),controller[_0xc207('0x15')]);router[_0xc207('0x16')]('/',auth[_0xc207('0xf')](),controller[_0xc207('0x17')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc207('0x18')]);router[_0xc207('0x16')](_0xc207('0x19'),auth[_0xc207('0xf')](),controller['addContacts']);router[_0xc207('0x16')](_0xc207('0x12'),auth[_0xc207('0xf')](),controller['addCustomField']);router[_0xc207('0x16')]('/:id/users',auth[_0xc207('0xf')](),controller[_0xc207('0x1a')]);router[_0xc207('0x1b')](_0xc207('0xc'),auth[_0xc207('0xf')](),controller[_0xc207('0x1c')]);router[_0xc207('0x1d')](_0xc207('0xc'),auth[_0xc207('0xf')](),controller[_0xc207('0x1e')]);router[_0xc207('0x1d')](_0xc207('0xe'),auth[_0xc207('0xf')](),controller['removeDispositions']);router[_0xc207('0x1d')]('/:id/users',auth[_0xc207('0xf')](),controller[_0xc207('0x1f')]);module[_0xc207('0x20')]=router; \ No newline at end of file +var _0xae24=['removeDispositions','removeAgents','multer','path','express','Router','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','/:id'];(function(_0x482b74,_0x4ff641){var _0x3c478f=function(_0x5ba3cd){while(--_0x5ba3cd){_0x482b74['push'](_0x482b74['shift']());}};_0x3c478f(++_0x4ff641);}(_0xae24,0x182));var _0x4ae2=function(_0x2482f7,_0x5e31ee){_0x2482f7=_0x2482f7-0x0;var _0x371f01=_0xae24[_0x2482f7];return _0x371f01;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')]('/',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x8')]);router[_0x4ae2('0x6')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x4ae2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4ae2('0xa')]);router[_0x4ae2('0x6')]('/:id/dispositions',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0xb')]);router[_0x4ae2('0x6')](_0x4ae2('0xc'),auth['isAuthenticated'](),controller[_0x4ae2('0xd')]);router[_0x4ae2('0x6')](_0x4ae2('0xe'),auth['isAuthenticated'](),controller[_0x4ae2('0xf')]);router[_0x4ae2('0x6')](_0x4ae2('0x10'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x11')]);router[_0x4ae2('0x6')](_0x4ae2('0x12'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0x14')](_0x4ae2('0x15'),auth['isAuthenticated'](),controller[_0x4ae2('0x16')]);router[_0x4ae2('0x14')](_0x4ae2('0xc'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x17')]);router[_0x4ae2('0x14')](_0x4ae2('0x10'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x18')]);router[_0x4ae2('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x4ae2('0x19')]);router[_0x4ae2('0x1a')]('/:id',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x1b')]);router[_0x4ae2('0x1c')](_0x4ae2('0x1d'),auth[_0x4ae2('0x7')](),controller['destroy']);router[_0x4ae2('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4ae2('0x1e')]);router[_0x4ae2('0x1c')](_0x4ae2('0x12'),auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f32dfe7..ad2a123 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(_0x15fff8,_0x14a4e5){var _0x1f8959=function(_0x45be5f){while(--_0x45be5f){_0x15fff8['push'](_0x15fff8['shift']());}};_0x1f8959(++_0x14a4e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x198d52,_0x261b10){var _0x30c3a2=function(_0x5e033c){while(--_0x5e033c){_0x198d52['push'](_0x198d52['shift']());}};_0x30c3a2(++_0x261b10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 c7c54e3..c2f5105 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 _0x2799=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','body','Condition','find','params','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3180b0,_0x37cda0){var _0x4f7c35=function(_0x2c4670){while(--_0x2c4670){_0x3180b0['push'](_0x3180b0['shift']());}};_0x4f7c35(++_0x37cda0);}(_0x2799,0x11e));var _0x9279=function(_0x2daf53,_0x1a6d62){_0x2daf53=_0x2daf53-0x0;var _0x547e0c=_0x2799[_0x2daf53];return _0x547e0c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9279('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9279('0x1'));var rp=require(_0x9279('0x2'));var moment=require(_0x9279('0x3'));var BPromise=require(_0x9279('0x4'));var Mustache=require(_0x9279('0x5'));var util=require(_0x9279('0x6'));var path=require('path');var sox=require(_0x9279('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9279('0x8'));var _=require(_0x9279('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9279('0xa'));var querystring=require(_0x9279('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9279('0xc'));var qs=require(_0x9279('0xd'));var as=require(_0x9279('0xe'));var hardwareService=require(_0x9279('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x9279('0x10'));var config=require(_0x9279('0x11'));var licenseUtil=require(_0x9279('0x12'));var db=require(_0x9279('0x13'))['db'];function respondWithStatusCode(_0x37e731,_0x1fa27d){_0x1fa27d=_0x1fa27d||0xcc;return function(_0x26055e){if(_0x26055e){return _0x37e731[_0x9279('0x14')](_0x1fa27d);}return _0x37e731['status'](_0x1fa27d)['end']();};}function respondWithResult(_0x988a74,_0x86ea45){_0x86ea45=_0x86ea45||0xc8;return function(_0x13595f){if(_0x13595f){return _0x988a74[_0x9279('0x15')](_0x86ea45)[_0x9279('0x16')](_0x13595f);}};}function respondWithFilteredResult(_0x5c60a8,_0x5704d8){return function(_0x527f29){if(_0x527f29){var _0xc0c781=_0x527f29['count'],_0x172fb2=_0x5704d8['offset'],_0x584405=_0x5704d8[_0x9279('0x17')]+_0x5704d8[_0x9279('0x18')],_0x590acf;if(_0x584405>=_0xc0c781){_0x584405=_0xc0c781;_0x590acf=0xc8;}else{_0x590acf=0xce;}_0x5c60a8['status'](_0x590acf);return _0x5c60a8[_0x9279('0x19')](_0x9279('0x1a'),_0x172fb2+'-'+_0x584405+'/'+_0xc0c781)[_0x9279('0x16')](_0x527f29);}return null;};}function patchUpdates(_0x530fe1){return function(_0x54f01a){try{jsonpatch[_0x9279('0x1b')](_0x54f01a,_0x530fe1,!![]);}catch(_0x4cbc81){return BPromise[_0x9279('0x1c')](_0x4cbc81);}return _0x54f01a[_0x9279('0x1d')]();};}function saveUpdates(_0xc4c09c,_0x51c60e){return function(_0x191be7){if(_0x191be7){return _0x191be7[_0x9279('0x1e')](_0xc4c09c)[_0x9279('0x1f')](function(_0x14d2d7){return _0x14d2d7;});}return null;};}function removeEntity(_0x721dfe,_0x1be46e){return function(_0x46bd28){if(_0x46bd28){return _0x46bd28[_0x9279('0x20')]()[_0x9279('0x1f')](function(){_0x721dfe['status'](0xcc)[_0x9279('0x21')]();});}};}function handleEntityNotFound(_0x14da39,_0x4dc385){return function(_0xbced34){if(!_0xbced34){_0x14da39[_0x9279('0x14')](0x194);}return _0xbced34;};}function handleError(_0x55680f,_0x542fac){_0x542fac=_0x542fac||0x1f4;return function(_0x21a23f){logger[_0x9279('0x22')](_0x21a23f[_0x9279('0x23')]);if(_0x21a23f[_0x9279('0x24')]){delete _0x21a23f['name'];}_0x55680f[_0x9279('0x15')](_0x542fac)[_0x9279('0x25')](_0x21a23f);};}exports[_0x9279('0x1e')]=function(_0x43b8e3,_0x14461b){if(_0x43b8e3[_0x9279('0x26')]['id']){delete _0x43b8e3['body']['id'];}return db[_0x9279('0x27')][_0x9279('0x28')]({'where':{'id':_0x43b8e3[_0x9279('0x29')]['id']}})[_0x9279('0x1f')](handleEntityNotFound(_0x14461b,null))['then'](saveUpdates(_0x43b8e3['body'],null))[_0x9279('0x1f')](respondWithResult(_0x14461b,null))[_0x9279('0x2a')](handleError(_0x14461b,null));};exports[_0x9279('0x20')]=function(_0x7022ec,_0x2f2d41){return db[_0x9279('0x27')]['find']({'where':{'id':_0x7022ec[_0x9279('0x29')]['id']}})['then'](handleEntityNotFound(_0x2f2d41,null))[_0x9279('0x1f')](removeEntity(_0x2f2d41,null))[_0x9279('0x2a')](handleError(_0x2f2d41,null));}; \ No newline at end of file +var _0x268e=['json','offset','limit','Content-Range','reject','save','update','then','name','send','body','Condition','find','params','catch','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x329b62,_0x45f020){var _0x4c66c2=function(_0xf7eb79){while(--_0xf7eb79){_0x329b62['push'](_0x329b62['shift']());}};_0x4c66c2(++_0x45f020);}(_0x268e,0x97));var _0xe268=function(_0x56de0c,_0x5c9fdb){_0x56de0c=_0x56de0c-0x0;var _0x4c2485=_0x268e[_0x56de0c];return _0x4c2485;};'use strict';var pdf=require(_0xe268('0x0'));var emlformat=require(_0xe268('0x1'));var rimraf=require(_0xe268('0x2'));var zipdir=require(_0xe268('0x3'));var jsonpatch=require(_0xe268('0x4'));var rp=require(_0xe268('0x5'));var moment=require(_0xe268('0x6'));var BPromise=require(_0xe268('0x7'));var Mustache=require(_0xe268('0x8'));var util=require(_0xe268('0x9'));var path=require('path');var sox=require(_0xe268('0xa'));var csv=require('to-csv');var ejs=require(_0xe268('0xb'));var fs=require('fs');var fs_extra=require(_0xe268('0xc'));var _=require(_0xe268('0xd'));var squel=require('squel');var crypto=require(_0xe268('0xe'));var jsforce=require(_0xe268('0xf'));var deskjs=require(_0xe268('0x10'));var toCsv=require(_0xe268('0x11'));var querystring=require(_0xe268('0x12'));var Papa=require(_0xe268('0x13'));var Redis=require(_0xe268('0x14'));var authService=require(_0xe268('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe268('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe268('0x17'));var config=require(_0xe268('0x18'));var licenseUtil=require(_0xe268('0x19'));var db=require(_0xe268('0x1a'))['db'];function respondWithStatusCode(_0x127fc0,_0x90081d){_0x90081d=_0x90081d||0xcc;return function(_0x5e059c){if(_0x5e059c){return _0x127fc0[_0xe268('0x1b')](_0x90081d);}return _0x127fc0['status'](_0x90081d)['end']();};}function respondWithResult(_0x333d92,_0x2c5f57){_0x2c5f57=_0x2c5f57||0xc8;return function(_0x38236d){if(_0x38236d){return _0x333d92[_0xe268('0x1c')](_0x2c5f57)[_0xe268('0x1d')](_0x38236d);}};}function respondWithFilteredResult(_0x2ed332,_0x234ffe){return function(_0x18fa36){if(_0x18fa36){var _0x1991bc=_0x18fa36['count'],_0x5c2faf=_0x234ffe[_0xe268('0x1e')],_0x33525d=_0x234ffe[_0xe268('0x1e')]+_0x234ffe[_0xe268('0x1f')],_0x408a2d;if(_0x33525d>=_0x1991bc){_0x33525d=_0x1991bc;_0x408a2d=0xc8;}else{_0x408a2d=0xce;}_0x2ed332[_0xe268('0x1c')](_0x408a2d);return _0x2ed332['set'](_0xe268('0x20'),_0x5c2faf+'-'+_0x33525d+'/'+_0x1991bc)['json'](_0x18fa36);}return null;};}function patchUpdates(_0x443dce){return function(_0x47288c){try{jsonpatch['apply'](_0x47288c,_0x443dce,!![]);}catch(_0x33a9ae){return BPromise[_0xe268('0x21')](_0x33a9ae);}return _0x47288c[_0xe268('0x22')]();};}function saveUpdates(_0x147dec,_0x4a6737){return function(_0x4e33ce){if(_0x4e33ce){return _0x4e33ce[_0xe268('0x23')](_0x147dec)[_0xe268('0x24')](function(_0x3160ea){return _0x3160ea;});}return null;};}function removeEntity(_0x15f127,_0x7d45e5){return function(_0x304850){if(_0x304850){return _0x304850['destroy']()[_0xe268('0x24')](function(){_0x15f127[_0xe268('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f182,_0x38bfc4){return function(_0x5e6484){if(!_0x5e6484){_0x50f182[_0xe268('0x1b')](0x194);}return _0x5e6484;};}function handleError(_0x23e9e9,_0x535222){_0x535222=_0x535222||0x1f4;return function(_0x5ecb52){logger['error'](_0x5ecb52['stack']);if(_0x5ecb52[_0xe268('0x25')]){delete _0x5ecb52[_0xe268('0x25')];}_0x23e9e9[_0xe268('0x1c')](_0x535222)[_0xe268('0x26')](_0x5ecb52);};}exports['update']=function(_0x268659,_0x42b990){if(_0x268659['body']['id']){delete _0x268659[_0xe268('0x27')]['id'];}return db[_0xe268('0x28')][_0xe268('0x29')]({'where':{'id':_0x268659[_0xe268('0x2a')]['id']}})[_0xe268('0x24')](handleEntityNotFound(_0x42b990,null))[_0xe268('0x24')](saveUpdates(_0x268659[_0xe268('0x27')],null))[_0xe268('0x24')](respondWithResult(_0x42b990,null))[_0xe268('0x2b')](handleError(_0x42b990,null));};exports[_0xe268('0x2c')]=function(_0x1ffaed,_0x751e7e){return db[_0xe268('0x28')]['find']({'where':{'id':_0x1ffaed[_0xe268('0x2a')]['id']}})[_0xe268('0x24')](handleEntityNotFound(_0x751e7e,null))[_0xe268('0x24')](removeEntity(_0x751e7e,null))[_0xe268('0x2b')](handleError(_0x751e7e,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 62ddf08..f99bd15 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 _0x50e3=['../../config/environment','./condition.attributes','define','Condition','tools_conditions','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xc4eeab,_0x5b1b39){var _0xd76a01=function(_0x1b0c2a){while(--_0x1b0c2a){_0xc4eeab['push'](_0xc4eeab['shift']());}};_0xd76a01(++_0x5b1b39);}(_0x50e3,0x11d));var _0x350e=function(_0x1fc534,_0x170d15){_0x1fc534=_0x1fc534-0x0;var _0x4f4d09=_0x50e3[_0x1fc534];return _0x4f4d09;};'use strict';var _=require('lodash');var util=require(_0x350e('0x0'));var logger=require(_0x350e('0x1'))('api');var moment=require(_0x350e('0x2'));var BPromise=require(_0x350e('0x3'));var rp=require(_0x350e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x350e('0x5'));var attributes=require(_0x350e('0x6'));module['exports']=function(_0xfd240a,_0x375d1d){return _0xfd240a[_0x350e('0x7')](_0x350e('0x8'),attributes,{'tableName':_0x350e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3be=['define','Condition','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x491e3f,_0x16ca97){var _0x9e4dd7=function(_0x1a5639){while(--_0x1a5639){_0x491e3f['push'](_0x491e3f['shift']());}};_0x9e4dd7(++_0x16ca97);}(_0xa3be,0x147));var _0xea3b=function(_0x27994a,_0x44059f){_0x27994a=_0x27994a-0x0;var _0x25029f=_0xa3be[_0x27994a];return _0x25029f;};'use strict';var _=require('lodash');var util=require(_0xea3b('0x0'));var logger=require(_0xea3b('0x1'))(_0xea3b('0x2'));var moment=require(_0xea3b('0x3'));var BPromise=require(_0xea3b('0x4'));var rp=require(_0xea3b('0x5'));var fs=require('fs');var path=require(_0xea3b('0x6'));var rimraf=require(_0xea3b('0x7'));var config=require(_0xea3b('0x8'));var attributes=require(_0xea3b('0x9'));module[_0xea3b('0xa')]=function(_0x445b90,_0x1eabce){return _0x445b90[_0xea3b('0xb')](_0xea3b('0xc'),attributes,{'tableName':'tools_conditions','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 3e4503c..61c4e84 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 _0xca3c=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0xca3c,0x83));var _0xcca3=function(_0x6aa302,_0x208ebf){_0x6aa302=_0x6aa302-0x0;var _0x35285c=_0xca3c[_0x6aa302];return _0x35285c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcca3('0x0'));var BPromise=require(_0xcca3('0x1'));var rs=require(_0xcca3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcca3('0x3'));var logger=require(_0xcca3('0x4'))(_0xcca3('0x5'));var config=require(_0xcca3('0x6'));var jayson=require(_0xcca3('0x7'));var client=jayson['client'][_0xcca3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58001a,_0x4288c,_0x34fe0e){return new BPromise(function(_0x32fb55,_0x280cad){return client['request'](_0x58001a,_0x34fe0e)[_0xcca3('0x9')](function(_0x61e25a){logger['info'](_0xcca3('0xa'),_0x4288c,_0xcca3('0xb'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x4288c,_0xcca3('0xb'),JSON[_0xcca3('0xc')](_0x61e25a));if(_0x61e25a[_0xcca3('0xd')]){if(_0x61e25a[_0xcca3('0xd')][_0xcca3('0xe')]===0x1f4){logger[_0xcca3('0xd')]('Condition,\x20%s,\x20%s',_0x4288c,_0x61e25a[_0xcca3('0xd')]['message']);return _0x280cad(_0x61e25a[_0xcca3('0xd')][_0xcca3('0xf')]);}logger['error']('Condition,\x20%s,\x20%s',_0x4288c,_0x61e25a['error'][_0xcca3('0xf')]);return _0x32fb55(_0x61e25a['error']['message']);}else{logger[_0xcca3('0x10')](_0xcca3('0xa'),_0x4288c,_0xcca3('0xb'));_0x32fb55(_0x61e25a[_0xcca3('0x11')][_0xcca3('0xf')]);}})[_0xcca3('0x12')](function(_0x21fd2e){logger[_0xcca3('0xd')](_0xcca3('0xa'),_0x4288c,_0x21fd2e);_0x280cad(_0x21fd2e);});});} \ No newline at end of file +var _0x1b86=['randomstring','ioredis','../../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','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x440a02,_0x25da49){var _0xe22b19=function(_0x26cbf1){while(--_0x26cbf1){_0x440a02['push'](_0x440a02['shift']());}};_0xe22b19(++_0x25da49);}(_0x1b86,0xdd));var _0x61b8=function(_0x488520,_0x83e5d4){_0x488520=_0x488520-0x0;var _0x2ab48a=_0x1b86[_0x488520];return _0x2ab48a;};'use strict';var _=require(_0x61b8('0x0'));var util=require(_0x61b8('0x1'));var moment=require(_0x61b8('0x2'));var BPromise=require(_0x61b8('0x3'));var rs=require(_0x61b8('0x4'));var fs=require('fs');var Redis=require(_0x61b8('0x5'));var db=require(_0x61b8('0x6'))['db'];var utils=require(_0x61b8('0x7'));var logger=require(_0x61b8('0x8'))(_0x61b8('0x9'));var config=require('../../config/environment');var jayson=require(_0x61b8('0xa'));var client=jayson[_0x61b8('0xb')][_0x61b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d7a6d,_0x43ae45,_0x76118){return new BPromise(function(_0x436acf,_0x28873a){return client[_0x61b8('0xd')](_0x1d7a6d,_0x76118)[_0x61b8('0xe')](function(_0x4f6a91){logger['info'](_0x61b8('0xf'),_0x43ae45,_0x61b8('0x10'));logger[_0x61b8('0x11')](_0x61b8('0x12'),_0x43ae45,_0x61b8('0x10'),JSON['stringify'](_0x4f6a91));if(_0x4f6a91[_0x61b8('0x13')]){if(_0x4f6a91[_0x61b8('0x13')][_0x61b8('0x14')]===0x1f4){logger[_0x61b8('0x13')](_0x61b8('0xf'),_0x43ae45,_0x4f6a91[_0x61b8('0x13')][_0x61b8('0x15')]);return _0x28873a(_0x4f6a91[_0x61b8('0x13')][_0x61b8('0x15')]);}logger['error']('Condition,\x20%s,\x20%s',_0x43ae45,_0x4f6a91[_0x61b8('0x13')]['message']);return _0x436acf(_0x4f6a91['error'][_0x61b8('0x15')]);}else{logger[_0x61b8('0x16')](_0x61b8('0xf'),_0x43ae45,'request\x20sent');_0x436acf(_0x4f6a91[_0x61b8('0x17')][_0x61b8('0x15')]);}})[_0x61b8('0x18')](function(_0x19f911){logger[_0x61b8('0x13')]('Condition,\x20%s,\x20%s',_0x43ae45,_0x19f911);_0x28873a(_0x19f911);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index fe355d8..2291925 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);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 02aa7a8..c3dc151 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 _0xcd4e=['exports','STRING','name','sequelize'];(function(_0x396883,_0x5851ff){var _0x3b64d4=function(_0x3f271f){while(--_0x3f271f){_0x396883['push'](_0x396883['shift']());}};_0x3b64d4(++_0x5851ff);}(_0xcd4e,0x187));var _0xecd4=function(_0x54aed7,_0x2d07f5){_0x54aed7=_0x54aed7-0x0;var _0x363592=_0xcd4e[_0x54aed7];return _0x363592;};'use strict';var Sequelize=require(_0xecd4('0x0'));module[_0xecd4('0x1')]={'name':{'type':Sequelize[_0xecd4('0x2')],'allowNull':![],'unique':_0xecd4('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xae79=['name','INTEGER','sequelize','exports','STRING'];(function(_0x5cb42b,_0x28eea1){var _0x9d15e3=function(_0x393c16){while(--_0x393c16){_0x5cb42b['push'](_0x5cb42b['shift']());}};_0x9d15e3(++_0x28eea1);}(_0xae79,0x1d3));var _0x9ae7=function(_0x4fce13,_0x53dc29){_0x4fce13=_0x4fce13-0x0;var _0x4022fd=_0xae79[_0x4fce13];return _0x4022fd;};'use strict';var Sequelize=require(_0x9ae7('0x0'));module[_0x9ae7('0x1')]={'name':{'type':Sequelize[_0x9ae7('0x2')],'allowNull':![],'unique':_0x9ae7('0x3')},'OrderBy':{'type':Sequelize[_0x9ae7('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9ae7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1a5f328..9bbf282 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 _0x9048=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','catch','show','keys','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','find','params','html-pdf','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','ContactItemTypes','error','stack','name','map','ContactItemType','rawAttributes','fieldName','type','model','query','filters','intersection','attributes'];(function(_0x191e6c,_0x3d41b9){var _0x22e7a8=function(_0x51831c){while(--_0x51831c){_0x191e6c['push'](_0x191e6c['shift']());}};_0x22e7a8(++_0x3d41b9);}(_0x9048,0xf2));var _0x8904=function(_0xea5f0e,_0x1bead1){_0xea5f0e=_0xea5f0e-0x0;var _0x148ee1=_0x9048[_0xea5f0e];return _0x148ee1;};'use strict';var pdf=require(_0x8904('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8904('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8904('0x2'));var BPromise=require(_0x8904('0x3'));var Mustache=require('mustache');var util=require(_0x8904('0x4'));var path=require(_0x8904('0x5'));var sox=require(_0x8904('0x6'));var csv=require(_0x8904('0x7'));var ejs=require(_0x8904('0x8'));var fs=require('fs');var fs_extra=require(_0x8904('0x9'));var _=require(_0x8904('0xa'));var squel=require(_0x8904('0xb'));var crypto=require(_0x8904('0xc'));var jsforce=require(_0x8904('0xd'));var deskjs=require(_0x8904('0xe'));var toCsv=require(_0x8904('0x7'));var querystring=require(_0x8904('0xf'));var Papa=require(_0x8904('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8904('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8904('0x12'));var utils=require('../../config/utils');var config=require(_0x8904('0x13'));var licenseUtil=require(_0x8904('0x14'));var db=require(_0x8904('0x15'))['db'];function respondWithStatusCode(_0x3d037d,_0x1ef94d){_0x1ef94d=_0x1ef94d||0xcc;return function(_0x3118be){if(_0x3118be){return _0x3d037d[_0x8904('0x16')](_0x1ef94d);}return _0x3d037d[_0x8904('0x17')](_0x1ef94d)[_0x8904('0x18')]();};}function respondWithResult(_0x487be9,_0x287075){_0x287075=_0x287075||0xc8;return function(_0x5f54c6){if(_0x5f54c6){return _0x487be9['status'](_0x287075)[_0x8904('0x19')](_0x5f54c6);}};}function respondWithFilteredResult(_0xc03a5,_0x1ea343){return function(_0x34af7d){if(_0x34af7d){var _0x3e7673=_0x34af7d[_0x8904('0x1a')],_0x309557=_0x1ea343[_0x8904('0x1b')],_0x321846=_0x1ea343['offset']+_0x1ea343[_0x8904('0x1c')],_0x44ca3d;if(_0x321846>=_0x3e7673){_0x321846=_0x3e7673;_0x44ca3d=0xc8;}else{_0x44ca3d=0xce;}_0xc03a5[_0x8904('0x17')](_0x44ca3d);return _0xc03a5[_0x8904('0x1d')](_0x8904('0x1e'),_0x309557+'-'+_0x321846+'/'+_0x3e7673)[_0x8904('0x19')](_0x34af7d);}return null;};}function patchUpdates(_0x4b97aa){return function(_0x5b52d6){try{jsonpatch['apply'](_0x5b52d6,_0x4b97aa,!![]);}catch(_0x2a4be4){return BPromise[_0x8904('0x1f')](_0x2a4be4);}return _0x5b52d6[_0x8904('0x20')]();};}function saveUpdates(_0x37a0ba,_0x4b7307){return function(_0x4de471){if(_0x4de471){return _0x4de471[_0x8904('0x21')](_0x37a0ba)['then'](function(_0x57a201){return _0x57a201;});}return null;};}function removeEntity(_0x4f9a54,_0x5e4965){return function(_0x59abc8){if(_0x59abc8){return _0x59abc8[_0x8904('0x22')]()[_0x8904('0x23')](function(){var _0x2d53af=_0x59abc8['get']({'plain':!![]});var _0x2a1338=_0x8904('0x24');return db['UserProfileResource'][_0x8904('0x22')]({'where':{'type':_0x2a1338,'resourceId':_0x2d53af['id']}})[_0x8904('0x23')](function(){return _0x59abc8;});})[_0x8904('0x23')](function(){_0x4f9a54[_0x8904('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bda88,_0x397017){return function(_0x4afd74){if(!_0x4afd74){_0x2bda88[_0x8904('0x16')](0x194);}return _0x4afd74;};}function handleError(_0x2baae8,_0x271166){_0x271166=_0x271166||0x1f4;return function(_0x5e07bd){logger[_0x8904('0x25')](_0x5e07bd[_0x8904('0x26')]);if(_0x5e07bd[_0x8904('0x27')]){delete _0x5e07bd[_0x8904('0x27')];}_0x2baae8['status'](_0x271166)['send'](_0x5e07bd);};}exports['index']=function(_0x2593f1,_0x2a7bef){var _0x535b8c={},_0x5080ee={},_0x3c7325={'count':0x0,'rows':[]};var _0x46776d=_[_0x8904('0x28')](db[_0x8904('0x29')][_0x8904('0x2a')],function(_0x2172ce){return{'name':_0x2172ce[_0x8904('0x2b')],'type':_0x2172ce[_0x8904('0x2c')]['key']};});_0x5080ee[_0x8904('0x2d')]=_['map'](_0x46776d,_0x8904('0x27'));_0x5080ee[_0x8904('0x2e')]=_['keys'](_0x2593f1[_0x8904('0x2e')]);_0x5080ee[_0x8904('0x2f')]=_[_0x8904('0x30')](_0x5080ee['model'],_0x5080ee['query']);_0x535b8c[_0x8904('0x31')]=_[_0x8904('0x30')](_0x5080ee[_0x8904('0x2d')],qs[_0x8904('0x32')](_0x2593f1[_0x8904('0x2e')][_0x8904('0x32')]));_0x535b8c[_0x8904('0x31')]=_0x535b8c[_0x8904('0x31')][_0x8904('0x33')]?_0x535b8c['attributes']:_0x5080ee[_0x8904('0x2d')];if(!_0x2593f1['query'][_0x8904('0x34')](_0x8904('0x35'))){_0x535b8c[_0x8904('0x1c')]=qs['limit'](_0x2593f1[_0x8904('0x2e')][_0x8904('0x1c')]);_0x535b8c[_0x8904('0x1b')]=qs[_0x8904('0x1b')](_0x2593f1[_0x8904('0x2e')][_0x8904('0x1b')]);}_0x535b8c[_0x8904('0x36')]=qs[_0x8904('0x37')](_0x2593f1[_0x8904('0x2e')][_0x8904('0x37')]);_0x535b8c[_0x8904('0x38')]=qs[_0x8904('0x2f')](_[_0x8904('0x39')](_0x2593f1[_0x8904('0x2e')],_0x5080ee[_0x8904('0x2f')]),_0x46776d);if(_0x2593f1[_0x8904('0x2e')]['filter']){_0x535b8c[_0x8904('0x38')]=_[_0x8904('0x3a')](_0x535b8c[_0x8904('0x38')],{'$or':_[_0x8904('0x28')](_0x46776d,function(_0x2ea675){if(_0x2ea675['type']!=='VIRTUAL'){var _0x4d5a2e={};_0x4d5a2e[_0x2ea675[_0x8904('0x27')]]={'$like':'%'+_0x2593f1[_0x8904('0x2e')]['filter']+'%'};return _0x4d5a2e;}})});}_0x535b8c=_[_0x8904('0x3a')]({},_0x535b8c,_0x2593f1[_0x8904('0x3b')]);var _0x3541b7={'where':_0x535b8c[_0x8904('0x38')]};return db[_0x8904('0x29')][_0x8904('0x1a')](_0x3541b7)['then'](function(_0x5cff0f){_0x3c7325[_0x8904('0x1a')]=_0x5cff0f;if(_0x2593f1['query']['includeAll']){_0x535b8c[_0x8904('0x3c')]=[{'all':!![]}];}return db[_0x8904('0x29')]['findAll'](_0x535b8c);})[_0x8904('0x23')](function(_0x3ee26c){_0x3c7325['rows']=_0x3ee26c;return _0x3c7325;})[_0x8904('0x23')](respondWithFilteredResult(_0x2a7bef,_0x535b8c))[_0x8904('0x3d')](handleError(_0x2a7bef,null));};exports[_0x8904('0x3e')]=function(_0x231b3f,_0x20f6f4){var _0x4e1d7a={'raw':!![],'where':{'id':_0x231b3f['params']['id']}},_0x9f0e9d={};_0x9f0e9d[_0x8904('0x2d')]=_[_0x8904('0x3f')](db[_0x8904('0x29')]['rawAttributes']);_0x9f0e9d[_0x8904('0x2e')]=_[_0x8904('0x3f')](_0x231b3f['query']);_0x9f0e9d[_0x8904('0x2f')]=_['intersection'](_0x9f0e9d[_0x8904('0x2d')],_0x9f0e9d[_0x8904('0x2e')]);_0x4e1d7a[_0x8904('0x31')]=_[_0x8904('0x30')](_0x9f0e9d[_0x8904('0x2d')],qs[_0x8904('0x32')](_0x231b3f[_0x8904('0x2e')][_0x8904('0x32')]));_0x4e1d7a[_0x8904('0x31')]=_0x4e1d7a[_0x8904('0x31')][_0x8904('0x33')]?_0x4e1d7a['attributes']:_0x9f0e9d['model'];if(_0x231b3f[_0x8904('0x2e')][_0x8904('0x40')]){_0x4e1d7a['include']=[{'all':!![]}];}_0x4e1d7a=_[_0x8904('0x3a')]({},_0x4e1d7a,_0x231b3f[_0x8904('0x3b')]);return db[_0x8904('0x29')]['find'](_0x4e1d7a)[_0x8904('0x23')](handleEntityNotFound(_0x20f6f4,null))[_0x8904('0x23')](respondWithResult(_0x20f6f4,null))['catch'](handleError(_0x20f6f4,null));};exports[_0x8904('0x41')]=function(_0x5f23cb,_0xec9378){return db[_0x8904('0x29')][_0x8904('0x41')](_0x5f23cb[_0x8904('0x42')],{})[_0x8904('0x23')](function(_0x3a61c5){var _0x3f398d=_0x5f23cb['user'][_0x8904('0x43')]({'plain':!![]});if(!_0x3f398d)throw new Error(_0x8904('0x44'));if(_0x3f398d[_0x8904('0x45')]==='user'){var _0x6db97e=_0x3a61c5['get']({'plain':!![]});var _0x5e0331='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x5e0331,'userProfileId':_0x3f398d[_0x8904('0x46')]},'raw':!![]})[_0x8904('0x23')](function(_0x2f31a5){if(_0x2f31a5&&_0x2f31a5['autoAssociation']===0x0){return db['UserProfileResource'][_0x8904('0x41')]({'name':_0x6db97e[_0x8904('0x27')],'resourceId':_0x6db97e['id'],'type':_0x2f31a5['name'],'sectionId':_0x2f31a5['id']},{})[_0x8904('0x23')](function(){return _0x3a61c5;});}else{return _0x3a61c5;}})[_0x8904('0x3d')](function(_0x2425e2){logger[_0x8904('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2425e2);throw _0x2425e2;});}return _0x3a61c5;})[_0x8904('0x23')](respondWithResult(_0xec9378,0xc9))[_0x8904('0x3d')](handleError(_0xec9378,null));};exports['update']=function(_0x3e6759,_0x1a3760){if(_0x3e6759[_0x8904('0x42')]['id']){delete _0x3e6759[_0x8904('0x42')]['id'];}return db[_0x8904('0x29')][_0x8904('0x47')]({'where':{'id':_0x3e6759[_0x8904('0x48')]['id']}})[_0x8904('0x23')](handleEntityNotFound(_0x1a3760,null))[_0x8904('0x23')](saveUpdates(_0x3e6759[_0x8904('0x42')],null))[_0x8904('0x23')](respondWithResult(_0x1a3760,null))['catch'](handleError(_0x1a3760,null));};exports[_0x8904('0x22')]=function(_0x2790c2,_0x3ec8dd){return db[_0x8904('0x29')]['find']({'where':{'id':_0x2790c2[_0x8904('0x48')]['id']}})[_0x8904('0x23')](handleEntityNotFound(_0x3ec8dd,null))[_0x8904('0x23')](removeEntity(_0x3ec8dd,null))['catch'](handleError(_0x3ec8dd,null));}; \ No newline at end of file +var _0x47c2=['pick','filter','where','merge','type','VIRTUAL','count','then','include','catch','show','rawAttributes','filters','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','sendStatus','error','name','map','ContactItemType','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47c2,0x1c4));var _0x247c=function(_0x1acde2,_0x4cd189){_0x1acde2=_0x1acde2-0x0;var _0x4ccd31=_0x47c2[_0x1acde2];return _0x4ccd31;};'use strict';var pdf=require(_0x247c('0x0'));var emlformat=require(_0x247c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x247c('0x2'));var jsonpatch=require(_0x247c('0x3'));var rp=require(_0x247c('0x4'));var moment=require(_0x247c('0x5'));var BPromise=require(_0x247c('0x6'));var Mustache=require(_0x247c('0x7'));var util=require(_0x247c('0x8'));var path=require(_0x247c('0x9'));var sox=require(_0x247c('0xa'));var csv=require(_0x247c('0xb'));var ejs=require(_0x247c('0xc'));var fs=require('fs');var fs_extra=require(_0x247c('0xd'));var _=require(_0x247c('0xe'));var squel=require(_0x247c('0xf'));var crypto=require(_0x247c('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x247c('0x11'));var toCsv=require('to-csv');var querystring=require(_0x247c('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x247c('0x13'));var qs=require(_0x247c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x247c('0x15'));var logger=require(_0x247c('0x16'))(_0x247c('0x17'));var utils=require(_0x247c('0x18'));var config=require(_0x247c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x247c('0x1a'))['db'];function respondWithStatusCode(_0x1a8902,_0x57864e){_0x57864e=_0x57864e||0xcc;return function(_0x4d222a){if(_0x4d222a){return _0x1a8902['sendStatus'](_0x57864e);}return _0x1a8902[_0x247c('0x1b')](_0x57864e)[_0x247c('0x1c')]();};}function respondWithResult(_0x595423,_0x190acf){_0x190acf=_0x190acf||0xc8;return function(_0x521b9c){if(_0x521b9c){return _0x595423[_0x247c('0x1b')](_0x190acf)[_0x247c('0x1d')](_0x521b9c);}};}function respondWithFilteredResult(_0x29ca91,_0x1ba9ca){return function(_0x576ffb){if(_0x576ffb){var _0x51624d=_0x576ffb['count'],_0x5dfafe=_0x1ba9ca[_0x247c('0x1e')],_0x447e2b=_0x1ba9ca[_0x247c('0x1e')]+_0x1ba9ca[_0x247c('0x1f')],_0x5d926e;if(_0x447e2b>=_0x51624d){_0x447e2b=_0x51624d;_0x5d926e=0xc8;}else{_0x5d926e=0xce;}_0x29ca91[_0x247c('0x1b')](_0x5d926e);return _0x29ca91[_0x247c('0x20')](_0x247c('0x21'),_0x5dfafe+'-'+_0x447e2b+'/'+_0x51624d)[_0x247c('0x1d')](_0x576ffb);}return null;};}function patchUpdates(_0x30af5d){return function(_0x413cb8){try{jsonpatch[_0x247c('0x22')](_0x413cb8,_0x30af5d,!![]);}catch(_0x305772){return BPromise[_0x247c('0x23')](_0x305772);}return _0x413cb8[_0x247c('0x24')]();};}function saveUpdates(_0x139ee0,_0x4711f9){return function(_0x55e68f){if(_0x55e68f){return _0x55e68f[_0x247c('0x25')](_0x139ee0)['then'](function(_0xc2e84e){return _0xc2e84e;});}return null;};}function removeEntity(_0x26a028,_0x1f7db4){return function(_0x216c32){if(_0x216c32){return _0x216c32[_0x247c('0x26')]()['then'](function(){var _0x5a904b=_0x216c32['get']({'plain':!![]});var _0x4b9687='ContactItemTypes';return db[_0x247c('0x27')][_0x247c('0x26')]({'where':{'type':_0x4b9687,'resourceId':_0x5a904b['id']}})['then'](function(){return _0x216c32;});})['then'](function(){_0x26a028['status'](0xcc)[_0x247c('0x1c')]();});}};}function handleEntityNotFound(_0x109282,_0x267a8d){return function(_0xa13ebe){if(!_0xa13ebe){_0x109282[_0x247c('0x28')](0x194);}return _0xa13ebe;};}function handleError(_0xa16462,_0x233027){_0x233027=_0x233027||0x1f4;return function(_0x3b7ba3){logger[_0x247c('0x29')](_0x3b7ba3['stack']);if(_0x3b7ba3[_0x247c('0x2a')]){delete _0x3b7ba3[_0x247c('0x2a')];}_0xa16462[_0x247c('0x1b')](_0x233027)['send'](_0x3b7ba3);};}exports['index']=function(_0x4b43f5,_0x3007dc){var _0x473bc0={},_0x1a56bf={},_0x217e15={'count':0x0,'rows':[]};var _0x221ae6=_[_0x247c('0x2b')](db[_0x247c('0x2c')]['rawAttributes'],function(_0x2a8fda){return{'name':_0x2a8fda[_0x247c('0x2d')],'type':_0x2a8fda['type'][_0x247c('0x2e')]};});_0x1a56bf[_0x247c('0x2f')]=_[_0x247c('0x2b')](_0x221ae6,'name');_0x1a56bf[_0x247c('0x30')]=_[_0x247c('0x31')](_0x4b43f5['query']);_0x1a56bf['filters']=_['intersection'](_0x1a56bf[_0x247c('0x2f')],_0x1a56bf[_0x247c('0x30')]);_0x473bc0[_0x247c('0x32')]=_[_0x247c('0x33')](_0x1a56bf[_0x247c('0x2f')],qs[_0x247c('0x34')](_0x4b43f5[_0x247c('0x30')]['fields']));_0x473bc0['attributes']=_0x473bc0[_0x247c('0x32')][_0x247c('0x35')]?_0x473bc0['attributes']:_0x1a56bf[_0x247c('0x2f')];if(!_0x4b43f5[_0x247c('0x30')][_0x247c('0x36')](_0x247c('0x37'))){_0x473bc0['limit']=qs[_0x247c('0x1f')](_0x4b43f5[_0x247c('0x30')][_0x247c('0x1f')]);_0x473bc0['offset']=qs[_0x247c('0x1e')](_0x4b43f5[_0x247c('0x30')][_0x247c('0x1e')]);}_0x473bc0[_0x247c('0x38')]=qs[_0x247c('0x39')](_0x4b43f5[_0x247c('0x30')][_0x247c('0x39')]);_0x473bc0['where']=qs['filters'](_[_0x247c('0x3a')](_0x4b43f5[_0x247c('0x30')],_0x1a56bf['filters']),_0x221ae6);if(_0x4b43f5['query'][_0x247c('0x3b')]){_0x473bc0[_0x247c('0x3c')]=_[_0x247c('0x3d')](_0x473bc0[_0x247c('0x3c')],{'$or':_[_0x247c('0x2b')](_0x221ae6,function(_0x2bad66){if(_0x2bad66[_0x247c('0x3e')]!==_0x247c('0x3f')){var _0x4edde2={};_0x4edde2[_0x2bad66['name']]={'$like':'%'+_0x4b43f5['query'][_0x247c('0x3b')]+'%'};return _0x4edde2;}})});}_0x473bc0=_[_0x247c('0x3d')]({},_0x473bc0,_0x4b43f5['options']);var _0x70ee16={'where':_0x473bc0[_0x247c('0x3c')]};return db[_0x247c('0x2c')][_0x247c('0x40')](_0x70ee16)[_0x247c('0x41')](function(_0x46ed65){_0x217e15[_0x247c('0x40')]=_0x46ed65;if(_0x4b43f5[_0x247c('0x30')]['includeAll']){_0x473bc0[_0x247c('0x42')]=[{'all':!![]}];}return db[_0x247c('0x2c')]['findAll'](_0x473bc0);})[_0x247c('0x41')](function(_0x22627c){_0x217e15['rows']=_0x22627c;return _0x217e15;})[_0x247c('0x41')](respondWithFilteredResult(_0x3007dc,_0x473bc0))[_0x247c('0x43')](handleError(_0x3007dc,null));};exports[_0x247c('0x44')]=function(_0x2d1d65,_0xa528e3){var _0x429493={'raw':!![],'where':{'id':_0x2d1d65['params']['id']}},_0x592acf={};_0x592acf[_0x247c('0x2f')]=_[_0x247c('0x31')](db['ContactItemType'][_0x247c('0x45')]);_0x592acf['query']=_[_0x247c('0x31')](_0x2d1d65[_0x247c('0x30')]);_0x592acf[_0x247c('0x46')]=_[_0x247c('0x33')](_0x592acf[_0x247c('0x2f')],_0x592acf[_0x247c('0x30')]);_0x429493[_0x247c('0x32')]=_[_0x247c('0x33')](_0x592acf[_0x247c('0x2f')],qs[_0x247c('0x34')](_0x2d1d65[_0x247c('0x30')][_0x247c('0x34')]));_0x429493[_0x247c('0x32')]=_0x429493[_0x247c('0x32')][_0x247c('0x35')]?_0x429493[_0x247c('0x32')]:_0x592acf[_0x247c('0x2f')];if(_0x2d1d65[_0x247c('0x30')][_0x247c('0x47')]){_0x429493[_0x247c('0x42')]=[{'all':!![]}];}_0x429493=_['merge']({},_0x429493,_0x2d1d65[_0x247c('0x48')]);return db[_0x247c('0x2c')][_0x247c('0x49')](_0x429493)[_0x247c('0x41')](handleEntityNotFound(_0xa528e3,null))[_0x247c('0x41')](respondWithResult(_0xa528e3,null))['catch'](handleError(_0xa528e3,null));};exports['create']=function(_0x2eca91,_0x29982f){return db['ContactItemType'][_0x247c('0x4a')](_0x2eca91[_0x247c('0x4b')],{})['then'](function(_0x31891d){var _0x199466=_0x2eca91[_0x247c('0x4c')][_0x247c('0x4d')]({'plain':!![]});if(!_0x199466)throw new Error(_0x247c('0x4e'));if(_0x199466[_0x247c('0x4f')]===_0x247c('0x4c')){var _0xa608ad=_0x31891d[_0x247c('0x4d')]({'plain':!![]});var _0x3a83d1='ContactItemTypes';return db[_0x247c('0x50')][_0x247c('0x49')]({'where':{'name':_0x3a83d1,'userProfileId':_0x199466[_0x247c('0x51')]},'raw':!![]})[_0x247c('0x41')](function(_0x4581d3){if(_0x4581d3&&_0x4581d3[_0x247c('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0xa608ad[_0x247c('0x2a')],'resourceId':_0xa608ad['id'],'type':_0x4581d3[_0x247c('0x2a')],'sectionId':_0x4581d3['id']},{})[_0x247c('0x41')](function(){return _0x31891d;});}else{return _0x31891d;}})[_0x247c('0x43')](function(_0x434039){logger['error'](_0x247c('0x53'),_0x434039);throw _0x434039;});}return _0x31891d;})['then'](respondWithResult(_0x29982f,0xc9))[_0x247c('0x43')](handleError(_0x29982f,null));};exports['update']=function(_0x5919b2,_0x2b9a15){if(_0x5919b2['body']['id']){delete _0x5919b2[_0x247c('0x4b')]['id'];}return db[_0x247c('0x2c')][_0x247c('0x49')]({'where':{'id':_0x5919b2['params']['id']}})[_0x247c('0x41')](handleEntityNotFound(_0x2b9a15,null))[_0x247c('0x41')](saveUpdates(_0x5919b2[_0x247c('0x4b')],null))[_0x247c('0x41')](respondWithResult(_0x2b9a15,null))[_0x247c('0x43')](handleError(_0x2b9a15,null));};exports[_0x247c('0x26')]=function(_0xadb40e,_0x8518c6){return db[_0x247c('0x2c')][_0x247c('0x49')]({'where':{'id':_0xadb40e[_0x247c('0x54')]['id']}})[_0x247c('0x41')](handleEntityNotFound(_0x8518c6,null))['then'](removeEntity(_0x8518c6,null))[_0x247c('0x43')](handleError(_0x8518c6,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index b5ede66..1b34107 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 _0x496e=['rimraf','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','util','../../config/logger','api','moment'];(function(_0x3aa142,_0x85b0cd){var _0x55eded=function(_0x3ee62b){while(--_0x3ee62b){_0x3aa142['push'](_0x3aa142['shift']());}};_0x55eded(++_0x85b0cd);}(_0x496e,0x1a0));var _0xe496=function(_0x253d32,_0x47e407){_0x253d32=_0x253d32-0x0;var _0x4497bc=_0x496e[_0x253d32];return _0x4497bc;};'use strict';var _=require('lodash');var util=require(_0xe496('0x0'));var logger=require(_0xe496('0x1'))(_0xe496('0x2'));var moment=require(_0xe496('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe496('0x4'));var config=require('../../config/environment');var attributes=require(_0xe496('0x5'));module[_0xe496('0x6')]=function(_0x1fc796,_0x178897){return _0x1fc796[_0xe496('0x7')](_0xe496('0x8'),attributes,{'tableName':_0xe496('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb242=['./contactItemType.attributes','exports','define','ContactItemType','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3e6a0c,_0x5e3743){var _0x306142=function(_0x123b1a){while(--_0x123b1a){_0x3e6a0c['push'](_0x3e6a0c['shift']());}};_0x306142(++_0x5e3743);}(_0xb242,0x1f3));var _0x2b24=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0xb242[_0x36bff5];return _0x80ade5;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var logger=require(_0x2b24('0x1'))(_0x2b24('0x2'));var moment=require(_0x2b24('0x3'));var BPromise=require(_0x2b24('0x4'));var rp=require(_0x2b24('0x5'));var fs=require('fs');var path=require(_0x2b24('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b24('0x7'));module[_0x2b24('0x8')]=function(_0x5c1f57,_0x341c66){return _0x5c1f57[_0x2b24('0x9')](_0x2b24('0xa'),attributes,{'tableName':'tools_contact_item_types','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 85e2b3c..a592264 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 _0x7794=['randomstring','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0x7794,0x7b));var _0x4779=function(_0x2091bc,_0x513be3){_0x2091bc=_0x2091bc-0x0;var _0x2f45ee=_0x7794[_0x2091bc];return _0x2f45ee;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339512,_0x523c93,_0xb3fe18){return new BPromise(function(_0x13bb66,_0x270a5f){return client[_0x4779('0x8')](_0x339512,_0xb3fe18)[_0x4779('0x9')](function(_0x7179e1){logger[_0x4779('0xa')]('ContactItemType,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));logger[_0x4779('0xc')](_0x4779('0xd'),_0x523c93,_0x4779('0xb'),JSON[_0x4779('0xe')](_0x7179e1));if(_0x7179e1[_0x4779('0xf')]){if(_0x7179e1[_0x4779('0xf')][_0x4779('0x10')]===0x1f4){logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1['error']['message']);return _0x270a5f(_0x7179e1['error'][_0x4779('0x12')]);}logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1[_0x4779('0xf')]['message']);return _0x13bb66(_0x7179e1[_0x4779('0xf')][_0x4779('0x12')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));_0x13bb66(_0x7179e1[_0x4779('0x13')][_0x4779('0x12')]);}})[_0x4779('0x14')](function(_0x56ec51){logger['error'](_0x4779('0x11'),_0x523c93,_0x56ec51);_0x270a5f(_0x56ec51);});});} \ No newline at end of file +var _0x8388=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','ContactItemType,\x20%s,\x20%s','info','result','catch','lodash','util'];(function(_0x3a9fdb,_0x205d53){var _0x18fc17=function(_0x489f1d){while(--_0x489f1d){_0x3a9fdb['push'](_0x3a9fdb['shift']());}};_0x18fc17(++_0x205d53);}(_0x8388,0x18d));var _0x8838=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x8388[_0x1bb58c];return _0x277586;};'use strict';var _=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var moment=require(_0x8838('0x2'));var BPromise=require(_0x8838('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8838('0x4'));var db=require(_0x8838('0x5'))['db'];var utils=require(_0x8838('0x6'));var logger=require(_0x8838('0x7'))(_0x8838('0x8'));var config=require('../../config/environment');var jayson=require(_0x8838('0x9'));var client=jayson[_0x8838('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xca2d0f,_0x2d9615,_0x27707c){return new BPromise(function(_0x56596f,_0x4645f4){return client['request'](_0xca2d0f,_0x27707c)['then'](function(_0x8555b2){logger['info']('ContactItemType,\x20%s,\x20%s',_0x2d9615,_0x8838('0xb'));logger[_0x8838('0xc')](_0x8838('0xd'),_0x2d9615,_0x8838('0xb'),JSON['stringify'](_0x8555b2));if(_0x8555b2[_0x8838('0xe')]){if(_0x8555b2[_0x8838('0xe')][_0x8838('0xf')]===0x1f4){logger[_0x8838('0xe')]('ContactItemType,\x20%s,\x20%s',_0x2d9615,_0x8555b2[_0x8838('0xe')]['message']);return _0x4645f4(_0x8555b2['error'][_0x8838('0x10')]);}logger[_0x8838('0xe')](_0x8838('0x11'),_0x2d9615,_0x8555b2[_0x8838('0xe')][_0x8838('0x10')]);return _0x56596f(_0x8555b2[_0x8838('0xe')][_0x8838('0x10')]);}else{logger[_0x8838('0x12')]('ContactItemType,\x20%s,\x20%s',_0x2d9615,_0x8838('0xb'));_0x56596f(_0x8555b2[_0x8838('0x13')]['message']);}})[_0x8838('0x14')](function(_0xab3fb8){logger[_0x8838('0xe')]('ContactItemType,\x20%s,\x20%s',_0x2d9615,_0xab3fb8);_0x4645f4(_0xab3fb8);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 0739805..0d59f6f 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 _0xb85b=['express','Router','fs-extra','../../components/auth/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout'];(function(_0x14938e,_0x52808d){var _0x168422=function(_0x4b0c5c){while(--_0x4b0c5c){_0x14938e['push'](_0x14938e['shift']());}};_0x168422(++_0x52808d);}(_0xb85b,0x1ae));var _0xbb85=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb85b[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbb85('0x0'));var timeout=require(_0xbb85('0x1'));var express=require(_0xbb85('0x2'));var router=express[_0xbb85('0x3')]();var fs_extra=require(_0xbb85('0x4'));var auth=require(_0xbb85('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb85('0x6'));router[_0xbb85('0x7')]('/',auth[_0xbb85('0x8')](),controller[_0xbb85('0x9')]);router[_0xbb85('0x7')](_0xbb85('0xa'),auth[_0xbb85('0x8')](),controller[_0xbb85('0xb')]);router[_0xbb85('0xc')]('/',auth[_0xbb85('0x8')](),controller[_0xbb85('0xd')]);router['put'](_0xbb85('0xa'),auth[_0xbb85('0x8')](),controller[_0xbb85('0xe')]);router[_0xbb85('0xf')]('/:id',auth[_0xbb85('0x8')](),controller[_0xbb85('0x10')]);module[_0xbb85('0x11')]=router; \ No newline at end of file +var _0x4293=['../../components/auth/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x30dd24,_0xc91462){var _0x5103b0=function(_0x1e2d3f){while(--_0x1e2d3f){_0x30dd24['push'](_0x30dd24['shift']());}};_0x5103b0(++_0xc91462);}(_0x4293,0x11d));var _0x3429=function(_0x4afb98,_0x1d0958){_0x4afb98=_0x4afb98-0x0;var _0x5bbfe3=_0x4293[_0x4afb98];return _0x5bbfe3;};'use strict';var multer=require(_0x3429('0x0'));var util=require(_0x3429('0x1'));var path=require('path');var timeout=require(_0x3429('0x2'));var express=require(_0x3429('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3429('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3429('0x5'));var controller=require(_0x3429('0x6'));router['get']('/',auth[_0x3429('0x7')](),controller['index']);router[_0x3429('0x8')](_0x3429('0x9'),auth[_0x3429('0x7')](),controller[_0x3429('0xa')]);router[_0x3429('0xb')]('/',auth[_0x3429('0x7')](),controller[_0x3429('0xc')]);router[_0x3429('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3429('0xe')]);router['delete'](_0x3429('0x9'),auth[_0x3429('0x7')](),controller[_0x3429('0xf')]);module[_0x3429('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 7d40434..e9a83e8 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 _0x85d0=['STRING'];(function(_0x32dc0c,_0x4fc4d5){var _0x2bc321=function(_0x55de89){while(--_0x55de89){_0x32dc0c['push'](_0x32dc0c['shift']());}};_0x2bc321(++_0x4fc4d5);}(_0x85d0,0x164));var _0x085d=function(_0x217263,_0x1a7ee6){_0x217263=_0x217263-0x0;var _0x26d036=_0x85d0[_0x217263];return _0x26d036;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x085d('0x0')]}}; \ No newline at end of file +var _0x83f7=['sequelize','exports','STRING'];(function(_0x109905,_0x534e44){var _0x416c16=function(_0x142d2d){while(--_0x142d2d){_0x109905['push'](_0x109905['shift']());}};_0x416c16(++_0x534e44);}(_0x83f7,0x84));var _0x783f=function(_0x155a2d,_0xe6305e){_0x155a2d=_0x155a2d-0x0;var _0xcf4180=_0x83f7[_0x155a2d];return _0xcf4180;};'use strict';var Sequelize=require(_0x783f('0x0'));module[_0x783f('0x1')]={'name':{'type':Sequelize[_0x783f('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x783f('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ddfa2c2..31884d7 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 _0x0941=['ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','CustomDashboards','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','include','rows','catch','show','keys','Dashboard','rawAttributes','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','get','createdAt','updatedAt','userProfileId','params','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','total','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','reportType','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x359a3d,_0x50145f){var _0x2817c9=function(_0x49670d){while(--_0x49670d){_0x359a3d['push'](_0x359a3d['shift']());}};_0x2817c9(++_0x50145f);}(_0x0941,0xd3));var _0x1094=function(_0x3c924d,_0x335c4b){_0x3c924d=_0x3c924d-0x0;var _0x282822=_0x0941[_0x3c924d];return _0x282822;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1094('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1094('0x1'));var moment=require('moment');var BPromise=require(_0x1094('0x2'));var Mustache=require(_0x1094('0x3'));var util=require(_0x1094('0x4'));var path=require('path');var sox=require(_0x1094('0x5'));var csv=require(_0x1094('0x6'));var ejs=require(_0x1094('0x7'));var fs=require('fs');var fs_extra=require(_0x1094('0x8'));var _=require(_0x1094('0x9'));var squel=require(_0x1094('0xa'));var crypto=require(_0x1094('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1094('0xc'));var toCsv=require(_0x1094('0x6'));var querystring=require(_0x1094('0xd'));var Papa=require(_0x1094('0xe'));var Redis=require(_0x1094('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1094('0x10'));var logger=require(_0x1094('0x11'))(_0x1094('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1094('0x13'));var db=require(_0x1094('0x14'))['db'];config[_0x1094('0x15')]=_['defaults'](config['redis'],{'host':_0x1094('0x16'),'port':0x18eb});var socket=require(_0x1094('0x17'))(new Redis(config[_0x1094('0x15')]));require('./dashboard.socket')[_0x1094('0x18')](socket);function respondWithStatusCode(_0x155f05,_0x2ef261){_0x2ef261=_0x2ef261||0xcc;return function(_0x501f63){if(_0x501f63){return _0x155f05['sendStatus'](_0x2ef261);}return _0x155f05[_0x1094('0x19')](_0x2ef261)[_0x1094('0x1a')]();};}function respondWithResult(_0x1082d3,_0x437f72){_0x437f72=_0x437f72||0xc8;return function(_0x2902ee){if(_0x2902ee){return _0x1082d3[_0x1094('0x19')](_0x437f72)[_0x1094('0x1b')](_0x2902ee);}};}function respondWithFilteredResult(_0x3635d2,_0x110ac4){return function(_0x184c69){if(_0x184c69){var _0xeeda6=_0x184c69[_0x1094('0x1c')],_0x372346=_0x110ac4[_0x1094('0x1d')],_0x508844=_0x110ac4[_0x1094('0x1d')]+_0x110ac4[_0x1094('0x1e')],_0x5d690a;if(_0x508844>=_0xeeda6){_0x508844=_0xeeda6;_0x5d690a=0xc8;}else{_0x5d690a=0xce;}_0x3635d2[_0x1094('0x19')](_0x5d690a);return _0x3635d2[_0x1094('0x1f')]('Content-Range',_0x372346+'-'+_0x508844+'/'+_0xeeda6)['json'](_0x184c69);}return null;};}function patchUpdates(_0x560178){return function(_0x25e365){try{jsonpatch[_0x1094('0x20')](_0x25e365,_0x560178,!![]);}catch(_0x41fed4){return BPromise[_0x1094('0x21')](_0x41fed4);}return _0x25e365[_0x1094('0x22')]();};}function saveUpdates(_0x3f0266,_0x20dd62){return function(_0x33d482){if(_0x33d482){return _0x33d482[_0x1094('0x23')](_0x3f0266)['then'](function(_0x33c3f1){return _0x33c3f1;});}return null;};}function removeEntity(_0x3c0f11,_0x1ea33a){return function(_0x28536a){if(_0x28536a){return _0x28536a[_0x1094('0x24')]()[_0x1094('0x25')](function(){var _0x2ff05a=_0x28536a['get']({'plain':!![]});var _0x75e2ad=_0x1094('0x26');return db['UserProfileResource'][_0x1094('0x24')]({'where':{'type':_0x75e2ad,'resourceId':_0x2ff05a['id']}})[_0x1094('0x25')](function(){return _0x28536a;});})['then'](function(){_0x3c0f11[_0x1094('0x19')](0xcc)[_0x1094('0x1a')]();});}};}function handleEntityNotFound(_0x5cb297,_0x2d5d7e){return function(_0x4ec671){if(!_0x4ec671){_0x5cb297['sendStatus'](0x194);}return _0x4ec671;};}function handleError(_0x1b0d06,_0x2d38a3){_0x2d38a3=_0x2d38a3||0x1f4;return function(_0x184e9a){logger[_0x1094('0x27')](_0x184e9a[_0x1094('0x28')]);if(_0x184e9a['name']){delete _0x184e9a[_0x1094('0x29')];}_0x1b0d06[_0x1094('0x19')](_0x2d38a3)[_0x1094('0x2a')](_0x184e9a);};}exports[_0x1094('0x2b')]=function(_0x27d8aa,_0x43bea0){var _0x36e883={},_0x40933a={},_0x1e2c62={'count':0x0,'rows':[]};var _0x36a79d=_[_0x1094('0x2c')](db['Dashboard']['rawAttributes'],function(_0x2faea5){return{'name':_0x2faea5[_0x1094('0x2d')],'type':_0x2faea5[_0x1094('0x2e')][_0x1094('0x2f')]};});_0x40933a['model']=_[_0x1094('0x2c')](_0x36a79d,_0x1094('0x29'));_0x40933a[_0x1094('0x30')]=_['keys'](_0x27d8aa[_0x1094('0x30')]);_0x40933a[_0x1094('0x31')]=_[_0x1094('0x32')](_0x40933a['model'],_0x40933a['query']);_0x36e883[_0x1094('0x33')]=_[_0x1094('0x32')](_0x40933a[_0x1094('0x34')],qs[_0x1094('0x35')](_0x27d8aa[_0x1094('0x30')][_0x1094('0x35')]));_0x36e883[_0x1094('0x33')]=_0x36e883[_0x1094('0x33')][_0x1094('0x36')]?_0x36e883[_0x1094('0x33')]:_0x40933a[_0x1094('0x34')];if(!_0x27d8aa['query'][_0x1094('0x37')](_0x1094('0x38'))){_0x36e883['limit']=qs[_0x1094('0x1e')](_0x27d8aa[_0x1094('0x30')]['limit']);_0x36e883[_0x1094('0x1d')]=qs[_0x1094('0x1d')](_0x27d8aa[_0x1094('0x30')][_0x1094('0x1d')]);}_0x36e883[_0x1094('0x39')]=qs[_0x1094('0x3a')](_0x27d8aa[_0x1094('0x30')]['sort']);_0x36e883['where']=qs[_0x1094('0x31')](_[_0x1094('0x3b')](_0x27d8aa[_0x1094('0x30')],_0x40933a['filters']),_0x36a79d);if(_0x27d8aa[_0x1094('0x30')][_0x1094('0x3c')]){_0x36e883[_0x1094('0x3d')]=_['merge'](_0x36e883[_0x1094('0x3d')],{'$or':_[_0x1094('0x2c')](_0x36a79d,function(_0x31ef68){if(_0x31ef68['type']!==_0x1094('0x3e')){var _0x1a8c56={};_0x1a8c56[_0x31ef68[_0x1094('0x29')]]={'$like':'%'+_0x27d8aa['query']['filter']+'%'};return _0x1a8c56;}})});}_0x36e883=_['merge']({},_0x36e883,_0x27d8aa['options']);var _0x1c06a1={'where':_0x36e883[_0x1094('0x3d')]};return db['Dashboard'][_0x1094('0x1c')](_0x1c06a1)['then'](function(_0x1366ca){_0x1e2c62[_0x1094('0x1c')]=_0x1366ca;if(_0x27d8aa[_0x1094('0x30')]['includeAll']){_0x36e883[_0x1094('0x3f')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x36e883);})['then'](function(_0x39858d){_0x1e2c62[_0x1094('0x40')]=_0x39858d;return _0x1e2c62;})['then'](respondWithFilteredResult(_0x43bea0,_0x36e883))[_0x1094('0x41')](handleError(_0x43bea0,null));};exports[_0x1094('0x42')]=function(_0x1ad826,_0xd3f711){var _0x4dee7f={'raw':![],'where':{'id':_0x1ad826['params']['id']}},_0x36b6d5={};_0x36b6d5[_0x1094('0x34')]=_[_0x1094('0x43')](db[_0x1094('0x44')][_0x1094('0x45')]);_0x36b6d5[_0x1094('0x30')]=_['keys'](_0x1ad826[_0x1094('0x30')]);_0x36b6d5[_0x1094('0x31')]=_[_0x1094('0x32')](_0x36b6d5[_0x1094('0x34')],_0x36b6d5[_0x1094('0x30')]);_0x4dee7f['attributes']=_['intersection'](_0x36b6d5[_0x1094('0x34')],qs[_0x1094('0x35')](_0x1ad826[_0x1094('0x30')][_0x1094('0x35')]));_0x4dee7f[_0x1094('0x33')]=_0x4dee7f[_0x1094('0x33')][_0x1094('0x36')]?_0x4dee7f[_0x1094('0x33')]:_0x36b6d5[_0x1094('0x34')];if(_0x1ad826[_0x1094('0x30')][_0x1094('0x46')]){_0x4dee7f['include']=[{'all':!![]}];}_0x4dee7f=_[_0x1094('0x47')]({},_0x4dee7f,_0x1ad826[_0x1094('0x48')]);return db[_0x1094('0x44')][_0x1094('0x49')](_0x4dee7f)[_0x1094('0x25')](handleEntityNotFound(_0xd3f711,null))[_0x1094('0x25')](respondWithResult(_0xd3f711,null))[_0x1094('0x41')](handleError(_0xd3f711,null));};exports['create']=function(_0x24aefc,_0x2a14e4){return db['Dashboard'][_0x1094('0x4a')](_0x24aefc[_0x1094('0x4b')],{})[_0x1094('0x25')](function(_0x35e3c0){var _0x1aa9af=_0x24aefc['user']['get']({'plain':!![]});if(!_0x1aa9af)throw new Error(_0x1094('0x4c'));if(_0x1aa9af[_0x1094('0x4d')]===_0x1094('0x4e')){var _0x431bfe=_0x35e3c0['get']({'plain':!![]});var _0x3c8f90='CustomDashboards';return db[_0x1094('0x4f')]['find']({'where':{'name':_0x3c8f90,'userProfileId':_0x1aa9af['userProfileId']},'raw':!![]})[_0x1094('0x25')](function(_0x3cd8d5){if(_0x3cd8d5&&_0x3cd8d5[_0x1094('0x50')]===0x0){return db[_0x1094('0x51')]['create']({'name':_0x431bfe[_0x1094('0x29')],'resourceId':_0x431bfe['id'],'type':_0x3cd8d5[_0x1094('0x29')],'sectionId':_0x3cd8d5['id']},{})[_0x1094('0x25')](function(){return _0x35e3c0;});}else{return _0x35e3c0;}})[_0x1094('0x41')](function(_0x2e90c0){logger[_0x1094('0x27')](_0x1094('0x52'),_0x2e90c0);throw _0x2e90c0;});}return _0x35e3c0;})[_0x1094('0x25')](respondWithResult(_0x2a14e4,0xc9))['catch'](handleError(_0x2a14e4,null));};exports['clone']=function(_0x115805,_0x160af6){var _0x592bb7={'where':{'id':_0x115805['params']['id']}},_0x47f605={};_0x47f605[_0x1094('0x34')]=_[_0x1094('0x43')](db[_0x1094('0x44')][_0x1094('0x45')]);_0x592bb7[_0x1094('0x33')]=_['intersection'](_0x47f605[_0x1094('0x34')],qs['fields'](_0x115805[_0x1094('0x30')]['fields']));_0x592bb7[_0x1094('0x33')]=_0x592bb7[_0x1094('0x33')][_0x1094('0x36')]?_0x592bb7[_0x1094('0x33')]:_0x47f605[_0x1094('0x34')];if(_0x115805[_0x1094('0x30')]['includeAll']){_0x592bb7[_0x1094('0x3f')]=[{'all':!![]}];}_0x592bb7=_['merge']({},_0x592bb7,_0x115805[_0x1094('0x48')]);return db[_0x1094('0x44')][_0x1094('0x49')](_0x592bb7)[_0x1094('0x25')](handleEntityNotFound(_0x160af6,null))[_0x1094('0x25')](function(_0x58a72c){if(_0x58a72c){var _0xb56f7b=_0x58a72c[_0x1094('0x53')]({'plain':!![]});_0xb56f7b=qs['omit'](_0xb56f7b,['id','createdAt','updatedAt']);_0x115805[_0x1094('0x4b')]=_['omit'](_0x115805[_0x1094('0x4b')],['id',_0x1094('0x54'),_0x1094('0x55')]);return db[_0x1094('0x44')]['create'](_['merge'](_0xb56f7b,_0x115805[_0x1094('0x4b')]),{'include':_0x115805['query'][_0x1094('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x4dec63){var _0x3be0e4=_0x115805[_0x1094('0x4e')][_0x1094('0x53')]({'plain':!![]});if(!_0x3be0e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3be0e4[_0x1094('0x4d')]===_0x1094('0x4e')){var _0x4e3c97=_0x4dec63['get']({'plain':!![]});var _0x1c1d68=_0x1094('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x1c1d68,'userProfileId':_0x3be0e4[_0x1094('0x56')]},'raw':!![]})[_0x1094('0x25')](function(_0x46ad78){if(_0x46ad78&&_0x46ad78[_0x1094('0x50')]===0x0){return db[_0x1094('0x51')][_0x1094('0x4a')]({'name':_0x4e3c97['name'],'resourceId':_0x4e3c97['id'],'type':_0x46ad78[_0x1094('0x29')],'sectionId':_0x46ad78['id']},{})[_0x1094('0x25')](function(){return _0x4dec63;});}else{return _0x4dec63;}})['catch'](function(_0x45c067){logger[_0x1094('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45c067);throw _0x45c067;});}return _0x4dec63;});}})['then'](respondWithResult(_0x160af6,0xc9))[_0x1094('0x41')](handleError(_0x160af6,null));};exports[_0x1094('0x23')]=function(_0x54e4c7,_0x14ca24){if(_0x54e4c7['body']['id']){delete _0x54e4c7[_0x1094('0x4b')]['id'];}return db[_0x1094('0x44')]['find']({'where':{'id':_0x54e4c7['params']['id']}})[_0x1094('0x25')](handleEntityNotFound(_0x14ca24,null))['then'](saveUpdates(_0x54e4c7['body'],null))['then'](respondWithResult(_0x14ca24,null))[_0x1094('0x41')](handleError(_0x14ca24,null));};exports[_0x1094('0x24')]=function(_0x1ee6f6,_0x38d4fe){return db['Dashboard'][_0x1094('0x49')]({'where':{'id':_0x1ee6f6[_0x1094('0x57')]['id']}})[_0x1094('0x25')](handleEntityNotFound(_0x38d4fe,null))['then'](removeEntity(_0x38d4fe,null))['catch'](handleError(_0x38d4fe,null));};function widgetAttributes(_0x2929c5){try{switch(_0x2929c5[_0x1094('0x2e')]){case'iframe':return[{'name':_0x1094('0x58'),'value':_0x2929c5['attrUrl']||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x0]?_0x2929c5[_0x1094('0x59')][0x0][_0x1094('0x5a')]:undefined)||_0x1094('0x5b')}];case'custom':return[{'name':'attrPath','value':_0x2929c5[_0x1094('0x5c')]||(_0x2929c5['attrs']&&_0x2929c5['attrs'][0x0]?_0x2929c5[_0x1094('0x59')][0x0][_0x1094('0x5a')]:undefined)||''}];case _0x1094('0x5d'):return[{'name':_0x1094('0x5e'),'value':_0x2929c5['attrHourFormat']||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x0]?_0x2929c5['attrs'][0x0][_0x1094('0x5a')]:undefined)||'HH:mm:ss'},{'name':_0x1094('0x5f'),'value':_0x2929c5[_0x1094('0x5f')]||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x1]?_0x2929c5[_0x1094('0x59')][0x1][_0x1094('0x5a')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x2929c5[_0x1094('0x60')]||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x2]?_0x2929c5[_0x1094('0x59')][0x2][_0x1094('0x5a')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x2929c5['attrMetric']||(_0x2929c5['attrs']&&_0x2929c5[_0x1094('0x59')][0x0]?_0x2929c5[_0x1094('0x59')][0x0][_0x1094('0x5a')]:undefined)||_0x1094('0x61')},{'name':'attrVoiceQueues','value':_0x2929c5['attrVoiceQueues']||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x1]?_0x2929c5[_0x1094('0x59')][0x1][_0x1094('0x5a')]:undefined)||[]},{'name':_0x1094('0x60'),'value':_0x2929c5['attrFontSize']||(_0x2929c5['attrs']&&_0x2929c5['attrs'][0x2]?_0x2929c5[_0x1094('0x59')][0x2]['value']:undefined)||0x14}];case _0x1094('0x62'):case _0x1094('0x63'):return[{'name':_0x1094('0x64'),'value':_0x2929c5[_0x1094('0x64')]||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x0]?_0x2929c5['attrs'][0x0][_0x1094('0x5a')]:undefined)||_0x1094('0x61')},{'name':_0x1094('0x65'),'value':_0x2929c5[_0x1094('0x65')]||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x1]?_0x2929c5[_0x1094('0x59')][0x1][_0x1094('0x5a')]:undefined)||null},{'name':_0x1094('0x66'),'value':_0x2929c5['attrSerie3']||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x2]?_0x2929c5[_0x1094('0x59')][0x2][_0x1094('0x5a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2929c5[_0x1094('0x67')]||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x3]?_0x2929c5[_0x1094('0x59')][0x3]['value']:undefined)||[]}];case _0x1094('0x68'):return[{'name':'attrReport','type':_0x2929c5[_0x1094('0x69')]||(_0x2929c5['attrs']&&_0x2929c5[_0x1094('0x59')][0x0]?_0x2929c5['attrs'][0x0][_0x1094('0x2e')]:undefined)||null,'value':_0x2929c5[_0x1094('0x6a')]||(_0x2929c5[_0x1094('0x59')]&&_0x2929c5[_0x1094('0x59')][0x0]?_0x2929c5['attrs'][0x0][_0x1094('0x5a')]:undefined)||null},{'name':'attrRefresh','value':_0x2929c5[_0x1094('0x6b')]||(_0x2929c5['attrs']&&_0x2929c5[_0x1094('0x59')][0x1]?_0x2929c5[_0x1094('0x59')][0x1][_0x1094('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x31e53d){logger[_0x1094('0x27')]('widgetAttributes:\x20%s',JSON['stringify'](_0x31e53d));return[];}}exports[_0x1094('0x6c')]=function(_0x3d229f,_0x375341,_0xd42d13){if(_0x3d229f[_0x1094('0x4b')]['id']){delete _0x3d229f['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x3d229f[_0x1094('0x57')]['id']}})[_0x1094('0x25')](handleEntityNotFound(_0x375341,null))[_0x1094('0x25')](function(_0x10d11b){if(_0x10d11b){_0x3d229f['body'][_0x1094('0x6d')]=_0x10d11b['id'];_0x3d229f[_0x1094('0x4b')][_0x1094('0x59')]=widgetAttributes(_0x3d229f[_0x1094('0x4b')]);return db[_0x1094('0x6e')][_0x1094('0x4a')](_0x3d229f['body']);}})[_0x1094('0x25')](respondWithResult(_0x375341,null))['catch'](handleError(_0x375341,null));};exports[_0x1094('0x6f')]=function(_0x3096c5,_0x28e16c,_0x1db8fc){var _0x47d93f={};var _0x4d71e8={};var _0x2240bd;var _0x1e828b;return db['Dashboard'][_0x1094('0x70')]({'where':{'id':_0x3096c5[_0x1094('0x57')]['id']}})['then'](handleEntityNotFound(_0x28e16c,null))['then'](function(_0x5c2d81){if(_0x5c2d81){_0x2240bd=_0x5c2d81;_0x4d71e8[_0x1094('0x34')]=_[_0x1094('0x43')](db[_0x1094('0x6e')][_0x1094('0x45')]);_0x4d71e8[_0x1094('0x30')]=_['keys'](_0x3096c5[_0x1094('0x30')]);_0x4d71e8[_0x1094('0x31')]=_[_0x1094('0x32')](_0x4d71e8[_0x1094('0x34')],_0x4d71e8[_0x1094('0x30')]);_0x47d93f[_0x1094('0x33')]=_[_0x1094('0x32')](_0x4d71e8[_0x1094('0x34')],qs[_0x1094('0x35')](_0x3096c5[_0x1094('0x30')][_0x1094('0x35')]));_0x47d93f[_0x1094('0x33')]=_0x47d93f[_0x1094('0x33')][_0x1094('0x36')]?_0x47d93f[_0x1094('0x33')]:_0x4d71e8[_0x1094('0x34')];_0x47d93f[_0x1094('0x39')]=qs[_0x1094('0x3a')](_0x3096c5[_0x1094('0x30')]['sort']);_0x47d93f['where']=qs[_0x1094('0x31')](_[_0x1094('0x3b')](_0x3096c5[_0x1094('0x30')],_0x4d71e8['filters']));if(_0x3096c5[_0x1094('0x30')][_0x1094('0x3c')]){_0x47d93f[_0x1094('0x3d')]=_['merge'](_0x47d93f[_0x1094('0x3d')],{'$or':_[_0x1094('0x2c')](_0x47d93f[_0x1094('0x33')],function(_0x10e8f8){var _0x557728={};_0x557728[_0x10e8f8]={'$like':'%'+_0x3096c5['query'][_0x1094('0x3c')]+'%'};return _0x557728;})});}_0x47d93f=_[_0x1094('0x47')]({},_0x47d93f,_0x3096c5[_0x1094('0x48')]);return _0x2240bd[_0x1094('0x6f')](_0x47d93f);}})[_0x1094('0x25')](function(_0x16434b){if(_0x16434b){_0x1e828b=_0x16434b['length'];if(!_0x3096c5['query'][_0x1094('0x37')](_0x1094('0x38'))){_0x47d93f[_0x1094('0x1e')]=qs[_0x1094('0x1e')](_0x3096c5[_0x1094('0x30')][_0x1094('0x1e')]);_0x47d93f[_0x1094('0x1d')]=qs[_0x1094('0x1d')](_0x3096c5[_0x1094('0x30')][_0x1094('0x1d')]);}return _0x2240bd[_0x1094('0x6f')](_0x47d93f);}})[_0x1094('0x25')](function(_0x1f83dc){if(_0x1f83dc){return _0x1f83dc?{'count':_0x1e828b,'rows':_0x1f83dc}:null;}})['then'](respondWithResult(_0x28e16c,null))[_0x1094('0x41')](handleError(_0x28e16c,null));}; \ No newline at end of file +var _0x15ae=['catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','include','omit','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','DashboardId','DashboardItem','getItems','eml-format','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','json','count','offset','limit','set','apply','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation'];(function(_0x12b933,_0x32b4b9){var _0x4db9f4=function(_0x1a6a67){while(--_0x1a6a67){_0x12b933['push'](_0x12b933['shift']());}};_0x4db9f4(++_0x32b4b9);}(_0x15ae,0x10f));var _0xe15a=function(_0x37e5cf,_0xff51b2){_0x37e5cf=_0x37e5cf-0x0;var _0x52eba4=_0x15ae[_0x37e5cf];return _0x52eba4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe15a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe15a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe15a('0x2'));var BPromise=require(_0xe15a('0x3'));var Mustache=require(_0xe15a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe15a('0x5'));var csv=require(_0xe15a('0x6'));var ejs=require(_0xe15a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe15a('0x8'));var crypto=require(_0xe15a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe15a('0xa'));var toCsv=require(_0xe15a('0x6'));var querystring=require(_0xe15a('0xb'));var Papa=require(_0xe15a('0xc'));var Redis=require(_0xe15a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe15a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe15a('0xf'));var logger=require(_0xe15a('0x10'))(_0xe15a('0x11'));var utils=require(_0xe15a('0x12'));var config=require(_0xe15a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe15a('0x14'))['db'];config[_0xe15a('0x15')]=_[_0xe15a('0x16')](config[_0xe15a('0x15')],{'host':_0xe15a('0x17'),'port':0x18eb});var socket=require(_0xe15a('0x18'))(new Redis(config[_0xe15a('0x15')]));require(_0xe15a('0x19'))[_0xe15a('0x1a')](socket);function respondWithStatusCode(_0x11d338,_0x4d9165){_0x4d9165=_0x4d9165||0xcc;return function(_0x4c149e){if(_0x4c149e){return _0x11d338['sendStatus'](_0x4d9165);}return _0x11d338[_0xe15a('0x1b')](_0x4d9165)['end']();};}function respondWithResult(_0x2e45af,_0x288cee){_0x288cee=_0x288cee||0xc8;return function(_0x3f3b6d){if(_0x3f3b6d){return _0x2e45af[_0xe15a('0x1b')](_0x288cee)[_0xe15a('0x1c')](_0x3f3b6d);}};}function respondWithFilteredResult(_0x4c989a,_0x568148){return function(_0x3a4a41){if(_0x3a4a41){var _0xffda28=_0x3a4a41[_0xe15a('0x1d')],_0x306e86=_0x568148[_0xe15a('0x1e')],_0x1d79ab=_0x568148[_0xe15a('0x1e')]+_0x568148[_0xe15a('0x1f')],_0x4c9a32;if(_0x1d79ab>=_0xffda28){_0x1d79ab=_0xffda28;_0x4c9a32=0xc8;}else{_0x4c9a32=0xce;}_0x4c989a[_0xe15a('0x1b')](_0x4c9a32);return _0x4c989a[_0xe15a('0x20')]('Content-Range',_0x306e86+'-'+_0x1d79ab+'/'+_0xffda28)[_0xe15a('0x1c')](_0x3a4a41);}return null;};}function patchUpdates(_0x1bb984){return function(_0x3a42a0){try{jsonpatch[_0xe15a('0x21')](_0x3a42a0,_0x1bb984,!![]);}catch(_0x5b2761){return BPromise['reject'](_0x5b2761);}return _0x3a42a0['save']();};}function saveUpdates(_0x4528db,_0x4b24a4){return function(_0x13d78e){if(_0x13d78e){return _0x13d78e[_0xe15a('0x22')](_0x4528db)[_0xe15a('0x23')](function(_0x302672){return _0x302672;});}return null;};}function removeEntity(_0x3a61ef,_0x3e92f1){return function(_0x44a070){if(_0x44a070){return _0x44a070[_0xe15a('0x24')]()[_0xe15a('0x23')](function(){var _0x275d2b=_0x44a070[_0xe15a('0x25')]({'plain':!![]});var _0xf32661=_0xe15a('0x26');return db[_0xe15a('0x27')]['destroy']({'where':{'type':_0xf32661,'resourceId':_0x275d2b['id']}})[_0xe15a('0x23')](function(){return _0x44a070;});})[_0xe15a('0x23')](function(){_0x3a61ef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd67b20,_0x3c403b){return function(_0x31ecff){if(!_0x31ecff){_0xd67b20[_0xe15a('0x28')](0x194);}return _0x31ecff;};}function handleError(_0x3b318a,_0x531a50){_0x531a50=_0x531a50||0x1f4;return function(_0x3eb42e){logger[_0xe15a('0x29')](_0x3eb42e[_0xe15a('0x2a')]);if(_0x3eb42e[_0xe15a('0x2b')]){delete _0x3eb42e[_0xe15a('0x2b')];}_0x3b318a[_0xe15a('0x1b')](_0x531a50)[_0xe15a('0x2c')](_0x3eb42e);};}exports[_0xe15a('0x2d')]=function(_0x39f8c5,_0x1648ba){var _0x11e8bc={},_0x1c13ed={},_0x229cd1={'count':0x0,'rows':[]};var _0x412005=_[_0xe15a('0x2e')](db[_0xe15a('0x2f')]['rawAttributes'],function(_0x252224){return{'name':_0x252224[_0xe15a('0x30')],'type':_0x252224['type']['key']};});_0x1c13ed[_0xe15a('0x31')]=_[_0xe15a('0x2e')](_0x412005,_0xe15a('0x2b'));_0x1c13ed[_0xe15a('0x32')]=_[_0xe15a('0x33')](_0x39f8c5[_0xe15a('0x32')]);_0x1c13ed[_0xe15a('0x34')]=_[_0xe15a('0x35')](_0x1c13ed[_0xe15a('0x31')],_0x1c13ed[_0xe15a('0x32')]);_0x11e8bc[_0xe15a('0x36')]=_[_0xe15a('0x35')](_0x1c13ed[_0xe15a('0x31')],qs[_0xe15a('0x37')](_0x39f8c5[_0xe15a('0x32')][_0xe15a('0x37')]));_0x11e8bc[_0xe15a('0x36')]=_0x11e8bc[_0xe15a('0x36')][_0xe15a('0x38')]?_0x11e8bc[_0xe15a('0x36')]:_0x1c13ed['model'];if(!_0x39f8c5[_0xe15a('0x32')][_0xe15a('0x39')](_0xe15a('0x3a'))){_0x11e8bc[_0xe15a('0x1f')]=qs[_0xe15a('0x1f')](_0x39f8c5[_0xe15a('0x32')][_0xe15a('0x1f')]);_0x11e8bc[_0xe15a('0x1e')]=qs[_0xe15a('0x1e')](_0x39f8c5['query'][_0xe15a('0x1e')]);}_0x11e8bc['order']=qs[_0xe15a('0x3b')](_0x39f8c5['query'][_0xe15a('0x3b')]);_0x11e8bc[_0xe15a('0x3c')]=qs[_0xe15a('0x34')](_[_0xe15a('0x3d')](_0x39f8c5[_0xe15a('0x32')],_0x1c13ed[_0xe15a('0x34')]),_0x412005);if(_0x39f8c5[_0xe15a('0x32')][_0xe15a('0x3e')]){_0x11e8bc[_0xe15a('0x3c')]=_[_0xe15a('0x3f')](_0x11e8bc[_0xe15a('0x3c')],{'$or':_[_0xe15a('0x2e')](_0x412005,function(_0x3c90ea){if(_0x3c90ea[_0xe15a('0x40')]!==_0xe15a('0x41')){var _0x867cb3={};_0x867cb3[_0x3c90ea[_0xe15a('0x2b')]]={'$like':'%'+_0x39f8c5[_0xe15a('0x32')][_0xe15a('0x3e')]+'%'};return _0x867cb3;}})});}_0x11e8bc=_[_0xe15a('0x3f')]({},_0x11e8bc,_0x39f8c5['options']);var _0x354140={'where':_0x11e8bc['where']};return db[_0xe15a('0x2f')]['count'](_0x354140)[_0xe15a('0x23')](function(_0x3d0ac9){_0x229cd1[_0xe15a('0x1d')]=_0x3d0ac9;if(_0x39f8c5[_0xe15a('0x32')][_0xe15a('0x42')]){_0x11e8bc['include']=[{'all':!![]}];}return db[_0xe15a('0x2f')][_0xe15a('0x43')](_0x11e8bc);})[_0xe15a('0x23')](function(_0x1bf1a6){_0x229cd1[_0xe15a('0x44')]=_0x1bf1a6;return _0x229cd1;})[_0xe15a('0x23')](respondWithFilteredResult(_0x1648ba,_0x11e8bc))['catch'](handleError(_0x1648ba,null));};exports[_0xe15a('0x45')]=function(_0x348a19,_0x1777a5){var _0x1cbdea={'raw':![],'where':{'id':_0x348a19['params']['id']}},_0x28a057={};_0x28a057[_0xe15a('0x31')]=_[_0xe15a('0x33')](db[_0xe15a('0x2f')][_0xe15a('0x46')]);_0x28a057['query']=_[_0xe15a('0x33')](_0x348a19[_0xe15a('0x32')]);_0x28a057['filters']=_['intersection'](_0x28a057['model'],_0x28a057[_0xe15a('0x32')]);_0x1cbdea[_0xe15a('0x36')]=_[_0xe15a('0x35')](_0x28a057[_0xe15a('0x31')],qs['fields'](_0x348a19['query'][_0xe15a('0x37')]));_0x1cbdea[_0xe15a('0x36')]=_0x1cbdea[_0xe15a('0x36')][_0xe15a('0x38')]?_0x1cbdea[_0xe15a('0x36')]:_0x28a057[_0xe15a('0x31')];if(_0x348a19[_0xe15a('0x32')][_0xe15a('0x42')]){_0x1cbdea['include']=[{'all':!![]}];}_0x1cbdea=_[_0xe15a('0x3f')]({},_0x1cbdea,_0x348a19[_0xe15a('0x47')]);return db[_0xe15a('0x2f')][_0xe15a('0x48')](_0x1cbdea)['then'](handleEntityNotFound(_0x1777a5,null))[_0xe15a('0x23')](respondWithResult(_0x1777a5,null))['catch'](handleError(_0x1777a5,null));};exports[_0xe15a('0x49')]=function(_0x329120,_0x5522a1){return db[_0xe15a('0x2f')][_0xe15a('0x49')](_0x329120[_0xe15a('0x4a')],{})[_0xe15a('0x23')](function(_0x2cf644){var _0x229990=_0x329120['user'][_0xe15a('0x25')]({'plain':!![]});if(!_0x229990)throw new Error(_0xe15a('0x4b'));if(_0x229990[_0xe15a('0x4c')]===_0xe15a('0x4d')){var _0x217752=_0x2cf644[_0xe15a('0x25')]({'plain':!![]});var _0x475610=_0xe15a('0x26');return db[_0xe15a('0x4e')][_0xe15a('0x48')]({'where':{'name':_0x475610,'userProfileId':_0x229990['userProfileId']},'raw':!![]})[_0xe15a('0x23')](function(_0x19f69f){if(_0x19f69f&&_0x19f69f[_0xe15a('0x4f')]===0x0){return db[_0xe15a('0x27')][_0xe15a('0x49')]({'name':_0x217752[_0xe15a('0x2b')],'resourceId':_0x217752['id'],'type':_0x19f69f[_0xe15a('0x2b')],'sectionId':_0x19f69f['id']},{})[_0xe15a('0x23')](function(){return _0x2cf644;});}else{return _0x2cf644;}})[_0xe15a('0x50')](function(_0x179924){logger['error'](_0xe15a('0x51'),_0x179924);throw _0x179924;});}return _0x2cf644;})['then'](respondWithResult(_0x5522a1,0xc9))[_0xe15a('0x50')](handleError(_0x5522a1,null));};exports['clone']=function(_0x2812fe,_0x2e51ab){var _0x1ee5f7={'where':{'id':_0x2812fe[_0xe15a('0x52')]['id']}},_0x5cd58b={};_0x5cd58b[_0xe15a('0x31')]=_[_0xe15a('0x33')](db[_0xe15a('0x2f')][_0xe15a('0x46')]);_0x1ee5f7[_0xe15a('0x36')]=_[_0xe15a('0x35')](_0x5cd58b[_0xe15a('0x31')],qs[_0xe15a('0x37')](_0x2812fe[_0xe15a('0x32')]['fields']));_0x1ee5f7['attributes']=_0x1ee5f7[_0xe15a('0x36')]['length']?_0x1ee5f7[_0xe15a('0x36')]:_0x5cd58b[_0xe15a('0x31')];if(_0x2812fe[_0xe15a('0x32')][_0xe15a('0x42')]){_0x1ee5f7[_0xe15a('0x53')]=[{'all':!![]}];}_0x1ee5f7=_[_0xe15a('0x3f')]({},_0x1ee5f7,_0x2812fe[_0xe15a('0x47')]);return db[_0xe15a('0x2f')][_0xe15a('0x48')](_0x1ee5f7)[_0xe15a('0x23')](handleEntityNotFound(_0x2e51ab,null))[_0xe15a('0x23')](function(_0x26bdd6){if(_0x26bdd6){var _0x465990=_0x26bdd6['get']({'plain':!![]});_0x465990=qs[_0xe15a('0x54')](_0x465990,['id','createdAt','updatedAt']);_0x2812fe[_0xe15a('0x4a')]=_['omit'](_0x2812fe[_0xe15a('0x4a')],['id',_0xe15a('0x55'),_0xe15a('0x56')]);return db[_0xe15a('0x2f')][_0xe15a('0x49')](_['merge'](_0x465990,_0x2812fe[_0xe15a('0x4a')]),{'include':_0x2812fe[_0xe15a('0x32')][_0xe15a('0x42')]?[{'all':!![]}]:undefined})[_0xe15a('0x23')](function(_0x3296d9){var _0x3845fd=_0x2812fe['user']['get']({'plain':!![]});if(!_0x3845fd)throw new Error(_0xe15a('0x4b'));if(_0x3845fd[_0xe15a('0x4c')]===_0xe15a('0x4d')){var _0x473c70=_0x3296d9[_0xe15a('0x25')]({'plain':!![]});var _0x263a16='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x263a16,'userProfileId':_0x3845fd[_0xe15a('0x57')]},'raw':!![]})[_0xe15a('0x23')](function(_0x5da52f){if(_0x5da52f&&_0x5da52f[_0xe15a('0x4f')]===0x0){return db[_0xe15a('0x27')][_0xe15a('0x49')]({'name':_0x473c70[_0xe15a('0x2b')],'resourceId':_0x473c70['id'],'type':_0x5da52f[_0xe15a('0x2b')],'sectionId':_0x5da52f['id']},{})['then'](function(){return _0x3296d9;});}else{return _0x3296d9;}})[_0xe15a('0x50')](function(_0x42be24){logger[_0xe15a('0x29')](_0xe15a('0x51'),_0x42be24);throw _0x42be24;});}return _0x3296d9;});}})[_0xe15a('0x23')](respondWithResult(_0x2e51ab,0xc9))[_0xe15a('0x50')](handleError(_0x2e51ab,null));};exports[_0xe15a('0x22')]=function(_0x1d675c,_0x51eb3e){if(_0x1d675c[_0xe15a('0x4a')]['id']){delete _0x1d675c[_0xe15a('0x4a')]['id'];}return db['Dashboard'][_0xe15a('0x48')]({'where':{'id':_0x1d675c[_0xe15a('0x52')]['id']}})[_0xe15a('0x23')](handleEntityNotFound(_0x51eb3e,null))['then'](saveUpdates(_0x1d675c[_0xe15a('0x4a')],null))[_0xe15a('0x23')](respondWithResult(_0x51eb3e,null))[_0xe15a('0x50')](handleError(_0x51eb3e,null));};exports[_0xe15a('0x24')]=function(_0x879076,_0x5b3956){return db[_0xe15a('0x2f')][_0xe15a('0x48')]({'where':{'id':_0x879076[_0xe15a('0x52')]['id']}})[_0xe15a('0x23')](handleEntityNotFound(_0x5b3956,null))['then'](removeEntity(_0x5b3956,null))[_0xe15a('0x50')](handleError(_0x5b3956,null));};function widgetAttributes(_0x54331a){try{switch(_0x54331a[_0xe15a('0x40')]){case _0xe15a('0x58'):return[{'name':_0xe15a('0x59'),'value':_0x54331a[_0xe15a('0x59')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x0]?_0x54331a[_0xe15a('0x5a')][0x0]['value']:undefined)||_0xe15a('0x5b')}];case _0xe15a('0x5c'):return[{'name':'attrPath','value':_0x54331a[_0xe15a('0x5d')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x0]?_0x54331a[_0xe15a('0x5a')][0x0]['value']:undefined)||''}];case _0xe15a('0x5e'):return[{'name':_0xe15a('0x5f'),'value':_0x54331a[_0xe15a('0x5f')]||(_0x54331a['attrs']&&_0x54331a[_0xe15a('0x5a')][0x0]?_0x54331a['attrs'][0x0][_0xe15a('0x60')]:undefined)||_0xe15a('0x61')},{'name':'attrTimezone','value':_0x54331a[_0xe15a('0x62')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x1]?_0x54331a[_0xe15a('0x5a')][0x1][_0xe15a('0x60')]:undefined)||_0xe15a('0x63')},{'name':_0xe15a('0x64'),'value':_0x54331a['attrFontSize']||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a['attrs'][0x2]?_0x54331a['attrs'][0x2][_0xe15a('0x60')]:undefined)||0xc}];case _0xe15a('0x65'):return[{'name':_0xe15a('0x66'),'value':_0x54331a[_0xe15a('0x66')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x0]?_0x54331a[_0xe15a('0x5a')][0x0][_0xe15a('0x60')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x54331a[_0xe15a('0x67')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x1]?_0x54331a[_0xe15a('0x5a')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x54331a[_0xe15a('0x64')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x2]?_0x54331a[_0xe15a('0x5a')][0x2][_0xe15a('0x60')]:undefined)||0x14}];case _0xe15a('0x68'):case _0xe15a('0x69'):return[{'name':'attrSerie1','value':_0x54331a[_0xe15a('0x6a')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x0]?_0x54331a[_0xe15a('0x5a')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x54331a[_0xe15a('0x6b')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x1]?_0x54331a[_0xe15a('0x5a')][0x1]['value']:undefined)||null},{'name':_0xe15a('0x6c'),'value':_0x54331a[_0xe15a('0x6c')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x2]?_0x54331a[_0xe15a('0x5a')][0x2]['value']:undefined)||null},{'name':_0xe15a('0x67'),'value':_0x54331a[_0xe15a('0x67')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x3]?_0x54331a['attrs'][0x3][_0xe15a('0x60')]:undefined)||[]}];case _0xe15a('0x6d'):return[{'name':'attrReport','type':_0x54331a[_0xe15a('0x6e')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x0]?_0x54331a[_0xe15a('0x5a')][0x0][_0xe15a('0x40')]:undefined)||null,'value':_0x54331a[_0xe15a('0x6f')]||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x0]?_0x54331a[_0xe15a('0x5a')][0x0]['value']:undefined)||null},{'name':_0xe15a('0x70'),'value':_0x54331a['attrRefresh']||(_0x54331a[_0xe15a('0x5a')]&&_0x54331a[_0xe15a('0x5a')][0x1]?_0x54331a[_0xe15a('0x5a')][0x1][_0xe15a('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x5d7c3d){logger[_0xe15a('0x29')]('widgetAttributes:\x20%s',JSON[_0xe15a('0x71')](_0x5d7c3d));return[];}}exports['addItem']=function(_0x309a33,_0x51037b,_0x9be321){if(_0x309a33['body']['id']){delete _0x309a33[_0xe15a('0x4a')]['id'];}return db[_0xe15a('0x2f')][_0xe15a('0x48')]({'where':{'id':_0x309a33[_0xe15a('0x52')]['id']}})[_0xe15a('0x23')](handleEntityNotFound(_0x51037b,null))[_0xe15a('0x23')](function(_0x268619){if(_0x268619){_0x309a33['body'][_0xe15a('0x72')]=_0x268619['id'];_0x309a33[_0xe15a('0x4a')][_0xe15a('0x5a')]=widgetAttributes(_0x309a33[_0xe15a('0x4a')]);return db[_0xe15a('0x73')][_0xe15a('0x49')](_0x309a33[_0xe15a('0x4a')]);}})[_0xe15a('0x23')](respondWithResult(_0x51037b,null))[_0xe15a('0x50')](handleError(_0x51037b,null));};exports['getItems']=function(_0x5611e4,_0x151a2b,_0x1be311){var _0xd3ae5={};var _0x473f77={};var _0x4237cd;var _0x5bff71;return db[_0xe15a('0x2f')]['findOne']({'where':{'id':_0x5611e4['params']['id']}})['then'](handleEntityNotFound(_0x151a2b,null))[_0xe15a('0x23')](function(_0x15125a){if(_0x15125a){_0x4237cd=_0x15125a;_0x473f77[_0xe15a('0x31')]=_[_0xe15a('0x33')](db[_0xe15a('0x73')]['rawAttributes']);_0x473f77[_0xe15a('0x32')]=_[_0xe15a('0x33')](_0x5611e4['query']);_0x473f77[_0xe15a('0x34')]=_[_0xe15a('0x35')](_0x473f77[_0xe15a('0x31')],_0x473f77['query']);_0xd3ae5[_0xe15a('0x36')]=_['intersection'](_0x473f77['model'],qs['fields'](_0x5611e4[_0xe15a('0x32')][_0xe15a('0x37')]));_0xd3ae5[_0xe15a('0x36')]=_0xd3ae5[_0xe15a('0x36')][_0xe15a('0x38')]?_0xd3ae5[_0xe15a('0x36')]:_0x473f77['model'];_0xd3ae5['order']=qs[_0xe15a('0x3b')](_0x5611e4[_0xe15a('0x32')][_0xe15a('0x3b')]);_0xd3ae5[_0xe15a('0x3c')]=qs[_0xe15a('0x34')](_[_0xe15a('0x3d')](_0x5611e4[_0xe15a('0x32')],_0x473f77[_0xe15a('0x34')]));if(_0x5611e4[_0xe15a('0x32')][_0xe15a('0x3e')]){_0xd3ae5['where']=_[_0xe15a('0x3f')](_0xd3ae5[_0xe15a('0x3c')],{'$or':_[_0xe15a('0x2e')](_0xd3ae5[_0xe15a('0x36')],function(_0x3d3e71){var _0x19922e={};_0x19922e[_0x3d3e71]={'$like':'%'+_0x5611e4[_0xe15a('0x32')][_0xe15a('0x3e')]+'%'};return _0x19922e;})});}_0xd3ae5=_[_0xe15a('0x3f')]({},_0xd3ae5,_0x5611e4['options']);return _0x4237cd[_0xe15a('0x74')](_0xd3ae5);}})[_0xe15a('0x23')](function(_0x8b7bfd){if(_0x8b7bfd){_0x5bff71=_0x8b7bfd[_0xe15a('0x38')];if(!_0x5611e4[_0xe15a('0x32')][_0xe15a('0x39')](_0xe15a('0x3a'))){_0xd3ae5[_0xe15a('0x1f')]=qs[_0xe15a('0x1f')](_0x5611e4['query'][_0xe15a('0x1f')]);_0xd3ae5[_0xe15a('0x1e')]=qs[_0xe15a('0x1e')](_0x5611e4[_0xe15a('0x32')][_0xe15a('0x1e')]);}return _0x4237cd[_0xe15a('0x74')](_0xd3ae5);}})[_0xe15a('0x23')](function(_0x4960e9){if(_0x4960e9){return _0x4960e9?{'count':_0x5bff71,'rows':_0x4960e9}:null;}})[_0xe15a('0x23')](respondWithResult(_0x151a2b,null))[_0xe15a('0x50')](handleError(_0x151a2b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6c018f7..71ef336 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 _0xd051=['hasOwnProperty','hook','exports','events','../../mysqldb','update','remove'];(function(_0x15d1cc,_0x51f025){var _0x2182f9=function(_0x2c863f){while(--_0x2c863f){_0x15d1cc['push'](_0x15d1cc['shift']());}};_0x2182f9(++_0x51f025);}(_0xd051,0x1f4));var _0x1d05=function(_0x39888d,_0x28cd0e){_0x39888d=_0x39888d-0x0;var _0x11dea4=_0xd051[_0x39888d];return _0x11dea4;};'use strict';var EventEmitter=require(_0x1d05('0x0'));var Dashboard=require(_0x1d05('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1d05('0x2'),'afterDestroy':_0x1d05('0x3')};function emitEvent(_0x35dbe7){return function(_0x270e40,_0x8640ca,_0x39c0d){DashboardEvents['emit'](_0x35dbe7+':'+_0x270e40['id'],_0x270e40);DashboardEvents['emit'](_0x35dbe7,_0x270e40);_0x39c0d(null);};}for(var e in events){if(events[_0x1d05('0x4')](e)){var event=events[e];Dashboard[_0x1d05('0x5')](e,emitEvent(event));}}module[_0x1d05('0x6')]=DashboardEvents; \ No newline at end of file +var _0xe29d=['remove','emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','update'];(function(_0x56dac6,_0x291782){var _0x5766f1=function(_0x17a719){while(--_0x17a719){_0x56dac6['push'](_0x56dac6['shift']());}};_0x5766f1(++_0x291782);}(_0xe29d,0x148));var _0xde29=function(_0x3bf7e5,_0xc51291){_0x3bf7e5=_0x3bf7e5-0x0;var _0x3cfc0a=_0xe29d[_0x3bf7e5];return _0x3cfc0a;};'use strict';var EventEmitter=require(_0xde29('0x0'));var Dashboard=require(_0xde29('0x1'))['db'][_0xde29('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xde29('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xde29('0x4'),'afterDestroy':_0xde29('0x5')};function emitEvent(_0x43caca){return function(_0x4725c3,_0x36efd5,_0x22f8b8){DashboardEvents[_0xde29('0x6')](_0x43caca+':'+_0x4725c3['id'],_0x4725c3);DashboardEvents[_0xde29('0x6')](_0x43caca,_0x4725c3);_0x22f8b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xde29('0x7')](e,emitEvent(event));}}module[_0xde29('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 b5f8f73..66d3549 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 _0x040f=['moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','api'];(function(_0x1f17e0,_0x2ec866){var _0xd6c27f=function(_0x469cb7){while(--_0x469cb7){_0x1f17e0['push'](_0x1f17e0['shift']());}};_0xd6c27f(++_0x2ec866);}(_0x040f,0xfb));var _0xf040=function(_0x344dbd,_0x1e2616){_0x344dbd=_0x344dbd-0x0;var _0x2a0110=_0x040f[_0x344dbd];return _0x2a0110;};'use strict';var _=require(_0xf040('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf040('0x1'));var moment=require(_0xf040('0x2'));var BPromise=require(_0xf040('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf040('0x4'));var rimraf=require(_0xf040('0x5'));var config=require(_0xf040('0x6'));var attributes=require(_0xf040('0x7'));module[_0xf040('0x8')]=function(_0x33d3bc,_0x4ad6e6){return _0x33d3bc[_0xf040('0x9')]('Dashboard',attributes,{'tableName':_0xf040('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f2b=['Dashboard','dashboards','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x1c290f,_0x94ef44){var _0x3980fe=function(_0x203af9){while(--_0x203af9){_0x1c290f['push'](_0x1c290f['shift']());}};_0x3980fe(++_0x94ef44);}(_0x8f2b,0x10a));var _0xb8f2=function(_0x1fa15a,_0x22ccf6){_0x1fa15a=_0x1fa15a-0x0;var _0x512f5d=_0x8f2b[_0x1fa15a];return _0x512f5d;};'use strict';var _=require(_0xb8f2('0x0'));var util=require('util');var logger=require(_0xb8f2('0x1'))(_0xb8f2('0x2'));var moment=require(_0xb8f2('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8f2('0x5'));var config=require(_0xb8f2('0x6'));var attributes=require(_0xb8f2('0x7'));module[_0xb8f2('0x8')]=function(_0x3faf33,_0x4b979e){return _0x3faf33['define'](_0xb8f2('0x9'),attributes,{'tableName':_0xb8f2('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 7ab0ff2..3752e63 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 _0x5d50=['error','code','Dashboard,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','register','request','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4409d3,_0x393384){var _0x2fcc92=function(_0x24d678){while(--_0x24d678){_0x4409d3['push'](_0x4409d3['shift']());}};_0x2fcc92(++_0x393384);}(_0x5d50,0x171));var _0x05d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05d5('0x0'));var util=require(_0x05d5('0x1'));var moment=require(_0x05d5('0x2'));var BPromise=require(_0x05d5('0x3'));var rs=require(_0x05d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05d5('0x6'));var config=require(_0x05d5('0x7'));var jayson=require(_0x05d5('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x05d5('0x9')](config['redis'],{'host':_0x05d5('0xa'),'port':0x18eb});var socket=require(_0x05d5('0xb'))(new Redis(config[_0x05d5('0xc')]));require(_0x05d5('0xd'))[_0x05d5('0xe')](socket);function respondWithRpcPromise(_0x4a83f6,_0x554aa5,_0x2d95db){return new BPromise(function(_0x16848c,_0x53a407){return client[_0x05d5('0xf')](_0x4a83f6,_0x2d95db)['then'](function(_0x2cf8f8){logger[_0x05d5('0x10')]('Dashboard,\x20%s,\x20%s',_0x554aa5,'request\x20sent');logger[_0x05d5('0x11')](_0x05d5('0x12'),_0x554aa5,_0x05d5('0x13'),JSON[_0x05d5('0x14')](_0x2cf8f8));if(_0x2cf8f8[_0x05d5('0x15')]){if(_0x2cf8f8[_0x05d5('0x15')][_0x05d5('0x16')]===0x1f4){logger[_0x05d5('0x15')](_0x05d5('0x17'),_0x554aa5,_0x2cf8f8[_0x05d5('0x15')][_0x05d5('0x18')]);return _0x53a407(_0x2cf8f8['error']['message']);}logger[_0x05d5('0x15')](_0x05d5('0x17'),_0x554aa5,_0x2cf8f8[_0x05d5('0x15')][_0x05d5('0x18')]);return _0x16848c(_0x2cf8f8[_0x05d5('0x15')][_0x05d5('0x18')]);}else{logger[_0x05d5('0x10')]('Dashboard,\x20%s,\x20%s',_0x554aa5,_0x05d5('0x13'));_0x16848c(_0x2cf8f8['result'][_0x05d5('0x18')]);}})[_0x05d5('0x19')](function(_0x6fef90){logger[_0x05d5('0x15')](_0x05d5('0x17'),_0x554aa5,_0x6fef90);_0x53a407(_0x6fef90);});});} \ No newline at end of file +var _0x044c=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x43981c,_0x412885){var _0x15671e=function(_0x4b5ca9){while(--_0x4b5ca9){_0x43981c['push'](_0x43981c['shift']());}};_0x15671e(++_0x412885);}(_0x044c,0x1d1));var _0xc044=function(_0xcf1e52,_0xbc24d4){_0xcf1e52=_0xcf1e52-0x0;var _0x262f88=_0x044c[_0xcf1e52];return _0x262f88;};'use strict';var _=require(_0xc044('0x0'));var util=require(_0xc044('0x1'));var moment=require(_0xc044('0x2'));var BPromise=require(_0xc044('0x3'));var rs=require(_0xc044('0x4'));var fs=require('fs');var Redis=require(_0xc044('0x5'));var db=require(_0xc044('0x6'))['db'];var utils=require(_0xc044('0x7'));var logger=require(_0xc044('0x8'))(_0xc044('0x9'));var config=require(_0xc044('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc044('0xb')][_0xc044('0xc')]({'port':0x232a});config[_0xc044('0xd')]=_['defaults'](config[_0xc044('0xd')],{'host':_0xc044('0xe'),'port':0x18eb});var socket=require(_0xc044('0xf'))(new Redis(config[_0xc044('0xd')]));require(_0xc044('0x10'))[_0xc044('0x11')](socket);function respondWithRpcPromise(_0x4fff20,_0x5c166b,_0x2b2893){return new BPromise(function(_0x1beda5,_0x210918){return client[_0xc044('0x12')](_0x4fff20,_0x2b2893)[_0xc044('0x13')](function(_0x4c7b52){logger[_0xc044('0x14')](_0xc044('0x15'),_0x5c166b,_0xc044('0x16'));logger[_0xc044('0x17')](_0xc044('0x18'),_0x5c166b,_0xc044('0x16'),JSON['stringify'](_0x4c7b52));if(_0x4c7b52[_0xc044('0x19')]){if(_0x4c7b52[_0xc044('0x19')][_0xc044('0x1a')]===0x1f4){logger[_0xc044('0x19')](_0xc044('0x15'),_0x5c166b,_0x4c7b52[_0xc044('0x19')][_0xc044('0x1b')]);return _0x210918(_0x4c7b52[_0xc044('0x19')]['message']);}logger[_0xc044('0x19')]('Dashboard,\x20%s,\x20%s',_0x5c166b,_0x4c7b52['error']['message']);return _0x1beda5(_0x4c7b52['error'][_0xc044('0x1b')]);}else{logger[_0xc044('0x14')](_0xc044('0x15'),_0x5c166b,'request\x20sent');_0x1beda5(_0x4c7b52[_0xc044('0x1c')][_0xc044('0x1b')]);}})['catch'](function(_0x2290bb){logger[_0xc044('0x19')](_0xc044('0x15'),_0x5c166b,_0x2290bb);_0x210918(_0x2290bb);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0bb0f6b..5a636d0 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 _0x71e9=['remove','emit','register','length','save'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x71e9,0x11c));var _0x971e=function(_0x37ca2b,_0x1e02f5){_0x37ca2b=_0x37ca2b-0x0;var _0x390817=_0x71e9[_0x37ca2b];return _0x390817;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x971e('0x0'),_0x971e('0x1'),'update'];function createListener(_0x41ddcb,_0x55d5ed){return function(_0x5817a5){_0x55d5ed[_0x971e('0x2')](_0x41ddcb,_0x5817a5);};}function removeListener(_0x5f0724,_0x5d6a4e){return function(){DashboardEvents['removeListener'](_0x5f0724,_0x5d6a4e);};}exports[_0x971e('0x3')]=function(_0x58325e){for(var _0x3ad834=0x0,_0x51c33b=events[_0x971e('0x4')];_0x3ad834<_0x51c33b;_0x3ad834++){var _0xf526e5=events[_0x3ad834];var _0x17f17f=createListener('dashboard:'+_0xf526e5,_0x58325e);DashboardEvents['on'](_0xf526e5,_0x17f17f);}}; \ No newline at end of file +var _0x9f1b=['length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x22269e,_0x28928b){var _0x4cd7f9=function(_0x29c2ff){while(--_0x29c2ff){_0x22269e['push'](_0x22269e['shift']());}};_0x4cd7f9(++_0x28928b);}(_0x9f1b,0x107));var _0xb9f1=function(_0x481ac5,_0x367886){_0x481ac5=_0x481ac5-0x0;var _0x15336a=_0x9f1b[_0x481ac5];return _0x15336a;};'use strict';var DashboardEvents=require(_0xb9f1('0x0'));var events=[_0xb9f1('0x1'),_0xb9f1('0x2'),_0xb9f1('0x3')];function createListener(_0x4147b6,_0x2481ee){return function(_0x261f04){_0x2481ee[_0xb9f1('0x4')](_0x4147b6,_0x261f04);};}function removeListener(_0x7643b2,_0x5230ab){return function(){DashboardEvents[_0xb9f1('0x5')](_0x7643b2,_0x5230ab);};}exports[_0xb9f1('0x6')]=function(_0x16e84d){for(var _0x18f95e=0x0,_0x214b1b=events[_0xb9f1('0x7')];_0x18f95e<_0x214b1b;_0x18f95e++){var _0x1f2945=events[_0x18f95e];var _0x1b79b6=createListener(_0xb9f1('0x8')+_0x1f2945,_0x16e84d);DashboardEvents['on'](_0x1f2945,_0x1b79b6);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index bbcc1e3..2f627e3 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 _0xbec5=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','post','create','/:id/clone','clone','addItem','put'];(function(_0x596e0d,_0x53d882){var _0x388163=function(_0x5981e9){while(--_0x5981e9){_0x596e0d['push'](_0x596e0d['shift']());}};_0x388163(++_0x53d882);}(_0xbec5,0xe5));var _0x5bec=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0xbec5[_0x2fd0f0];return _0x57f71a;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['getItems']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0xf')](_0x5bec('0x11'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0xf')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x13')]);router[_0x5bec('0x14')]('/:id',auth[_0x5bec('0xc')](),controller[_0x5bec('0x15')]);router[_0x5bec('0x16')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0x17')]);module[_0x5bec('0x18')]=router; \ No newline at end of file +var _0xd2ea=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','/:id/items','getItems','create','post','/:id/clone','clone','addItem','put','delete','multer'];(function(_0x508def,_0x26d980){var _0x2ed523=function(_0x19c1e3){while(--_0x19c1e3){_0x508def['push'](_0x508def['shift']());}};_0x2ed523(++_0x26d980);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2d26cd,_0x4a44e1){_0x2d26cd=_0x2d26cd-0x0;var _0x2a03f3=_0xd2ea[_0x2d26cd];return _0x2a03f3;};'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 fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['show']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0x11'),auth['isAuthenticated'](),controller[_0xad2e('0x12')]);router['post'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x13')]);router[_0xad2e('0x14')]('/:id',auth[_0xad2e('0xb')](),controller['update']);router[_0xad2e('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 54ad0a3..0802880 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 _0x4f41=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','squel','lodash','exports','STRING'];(function(_0x5d799a,_0x28dbfd){var _0x2572e7=function(_0x1b9714){while(--_0x1b9714){_0x5d799a['push'](_0x5d799a['shift']());}};_0x2572e7(++_0x28dbfd);}(_0x4f41,0xcc));var _0x14f4=function(_0x5a54f2,_0x774ad6){_0x5a54f2=_0x5a54f2-0x0;var _0x1fffe9=_0x4f41[_0x5a54f2];return _0x1fffe9;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x14f4('0x0'));var _=require(_0x14f4('0x1'));module[_0x14f4('0x2')]={'title':{'type':Sequelize[_0x14f4('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x14f4('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x14f4('0x4')](_0x14f4('0x5')),'get':function(){try{return JSON[_0x14f4('0x6')](this[_0x14f4('0x7')](_0x14f4('0x8')));}catch(_0x303653){return[];}},'set':function(_0x527e39){try{this[_0x14f4('0x9')]('attrs',JSON[_0x14f4('0xa')](_0x527e39));}catch(_0xc1460c){this['setDataValue'](_0x14f4('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x14f4('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x14f4('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x14f4('0xb')]},'background':{'type':Sequelize[_0x14f4('0x3')],'allowNull':![],'defaultValue':_0x14f4('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x14f4('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5c69=['setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','getDataValue'];(function(_0x3e30f8,_0x272dae){var _0x5d4de9=function(_0x459304){while(--_0x459304){_0x3e30f8['push'](_0x3e30f8['shift']());}};_0x5d4de9(++_0x272dae);}(_0x5c69,0x102));var _0x95c6=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x5c69[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require(_0x95c6('0x0'));var squel=require(_0x95c6('0x1'));var _=require(_0x95c6('0x2'));module[_0x95c6('0x3')]={'title':{'type':Sequelize[_0x95c6('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x95c6('0x5')](_0x95c6('0x6')),'get':function(){try{return JSON['parse'](this[_0x95c6('0x7')]('attrs'));}catch(_0x3d4f71){return[];}},'set':function(_0x5606b2){try{this[_0x95c6('0x8')](_0x95c6('0x9'),JSON[_0x95c6('0xa')](_0x5606b2));}catch(_0x3fbbb6){this[_0x95c6('0x8')]('attrs',JSON[_0x95c6('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x95c6('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x95c6('0xb')]},'col':{'type':Sequelize[_0x95c6('0xb')]},'background':{'type':Sequelize[_0x95c6('0x4')],'allowNull':![],'defaultValue':_0x95c6('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x95c6('0x4')],'allowNull':![],'defaultValue':_0x95c6('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x95c6('0x4')]},'titleFontSize':{'type':Sequelize[_0x95c6('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 179f8ee..97e53b3 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 _0x10af=['json','apply','reject','save','then','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','intersection','model','attributes','fields','length','include','merge','options','catch','destroy','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','create','body','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','limit','set','Content-Range'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x10af,0xe6));var _0xf10a=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x10af[_0x243b59];return _0x3e1676;};'use strict';var pdf=require(_0xf10a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf10a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf10a('0x2'));var rp=require(_0xf10a('0x3'));var moment=require('moment');var BPromise=require(_0xf10a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf10a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf10a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf10a('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf10a('0x8'));var deskjs=require(_0xf10a('0x9'));var toCsv=require(_0xf10a('0xa'));var querystring=require(_0xf10a('0xb'));var Papa=require('papaparse');var Redis=require(_0xf10a('0xc'));var authService=require(_0xf10a('0xd'));var qs=require(_0xf10a('0xe'));var as=require(_0xf10a('0xf'));var hardwareService=require(_0xf10a('0x10'));var logger=require('../../config/logger')(_0xf10a('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf10a('0x12'))['db'];config[_0xf10a('0x13')]=_[_0xf10a('0x14')](config[_0xf10a('0x13')],{'host':_0xf10a('0x15'),'port':0x18eb});var socket=require(_0xf10a('0x16'))(new Redis(config[_0xf10a('0x13')]));require('./dashboardItem.socket')[_0xf10a('0x17')](socket);function respondWithStatusCode(_0x2f552d,_0x33845b){_0x33845b=_0x33845b||0xcc;return function(_0x1b702c){if(_0x1b702c){return _0x2f552d[_0xf10a('0x18')](_0x33845b);}return _0x2f552d['status'](_0x33845b)[_0xf10a('0x19')]();};}function respondWithResult(_0x236b00,_0x4d4a43){_0x4d4a43=_0x4d4a43||0xc8;return function(_0x46406b){if(_0x46406b){return _0x236b00[_0xf10a('0x1a')](_0x4d4a43)['json'](_0x46406b);}};}function respondWithFilteredResult(_0x21983f,_0x55fd6e){return function(_0x377e32){if(_0x377e32){var _0x35afbd=_0x377e32['count'],_0x55582c=_0x55fd6e['offset'],_0x97dbe0=_0x55fd6e[_0xf10a('0x1b')]+_0x55fd6e[_0xf10a('0x1c')],_0x17e873;if(_0x97dbe0>=_0x35afbd){_0x97dbe0=_0x35afbd;_0x17e873=0xc8;}else{_0x17e873=0xce;}_0x21983f[_0xf10a('0x1a')](_0x17e873);return _0x21983f[_0xf10a('0x1d')](_0xf10a('0x1e'),_0x55582c+'-'+_0x97dbe0+'/'+_0x35afbd)[_0xf10a('0x1f')](_0x377e32);}return null;};}function patchUpdates(_0x592266){return function(_0x159d32){try{jsonpatch[_0xf10a('0x20')](_0x159d32,_0x592266,!![]);}catch(_0x53451e){return BPromise[_0xf10a('0x21')](_0x53451e);}return _0x159d32[_0xf10a('0x22')]();};}function saveUpdates(_0x396103,_0x2d5d49){return function(_0x324a26){if(_0x324a26){return _0x324a26['update'](_0x396103)['then'](function(_0x42854f){return _0x42854f;});}return null;};}function removeEntity(_0x48201a,_0x9e2870){return function(_0x3c229a){if(_0x3c229a){return _0x3c229a['destroy']()[_0xf10a('0x23')](function(){_0x48201a[_0xf10a('0x1a')](0xcc)[_0xf10a('0x19')]();});}};}function handleEntityNotFound(_0xe8ae53,_0x4ec6d3){return function(_0x42f9e9){if(!_0x42f9e9){_0xe8ae53['sendStatus'](0x194);}return _0x42f9e9;};}function handleError(_0x3c86f7,_0x2de56e){_0x2de56e=_0x2de56e||0x1f4;return function(_0x11a32f){logger['error'](_0x11a32f[_0xf10a('0x24')]);if(_0x11a32f[_0xf10a('0x25')]){delete _0x11a32f[_0xf10a('0x25')];}_0x3c86f7[_0xf10a('0x1a')](_0x2de56e)[_0xf10a('0x26')](_0x11a32f);};}exports[_0xf10a('0x27')]=function(_0x4ccfa4,_0x5d9100){var _0x20f9db={'raw':![],'where':{'id':_0x4ccfa4[_0xf10a('0x28')]['id']}},_0x33b72e={};_0x33b72e['model']=_[_0xf10a('0x29')](db[_0xf10a('0x2a')][_0xf10a('0x2b')]);_0x33b72e[_0xf10a('0x2c')]=_[_0xf10a('0x29')](_0x4ccfa4[_0xf10a('0x2c')]);_0x33b72e['filters']=_[_0xf10a('0x2d')](_0x33b72e[_0xf10a('0x2e')],_0x33b72e['query']);_0x20f9db[_0xf10a('0x2f')]=_['intersection'](_0x33b72e[_0xf10a('0x2e')],qs[_0xf10a('0x30')](_0x4ccfa4['query'][_0xf10a('0x30')]));_0x20f9db[_0xf10a('0x2f')]=_0x20f9db['attributes'][_0xf10a('0x31')]?_0x20f9db[_0xf10a('0x2f')]:_0x33b72e[_0xf10a('0x2e')];if(_0x4ccfa4['query']['includeAll']){_0x20f9db[_0xf10a('0x32')]=[{'all':!![]}];}_0x20f9db=_[_0xf10a('0x33')]({},_0x20f9db,_0x4ccfa4[_0xf10a('0x34')]);return db[_0xf10a('0x2a')]['find'](_0x20f9db)[_0xf10a('0x23')](handleEntityNotFound(_0x5d9100,null))['then'](respondWithResult(_0x5d9100,null))[_0xf10a('0x35')](handleError(_0x5d9100,null));};exports[_0xf10a('0x36')]=function(_0x193972,_0x460b39){return db['DashboardItem'][_0xf10a('0x37')]({'where':{'id':_0x193972[_0xf10a('0x28')]['id']}})[_0xf10a('0x23')](handleEntityNotFound(_0x460b39,null))[_0xf10a('0x23')](removeEntity(_0x460b39,null))[_0xf10a('0x35')](handleError(_0x460b39,null));};function widgetAttributes(_0x27dc98){try{switch(_0x27dc98[_0xf10a('0x38')]){case _0xf10a('0x39'):return[{'name':_0xf10a('0x3a'),'value':_0x27dc98['attrUrl']||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x0]?_0x27dc98[_0xf10a('0x3b')][0x0][_0xf10a('0x3c')]:undefined)||_0xf10a('0x3d')}];case _0xf10a('0x3e'):return[{'name':_0xf10a('0x3f'),'value':_0x27dc98[_0xf10a('0x3f')]||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x0]?_0x27dc98[_0xf10a('0x3b')][0x0]['value']:undefined)||''}];case _0xf10a('0x40'):return[{'name':'attrHourFormat','value':_0x27dc98[_0xf10a('0x41')]||(_0x27dc98['attrs']&&_0x27dc98[_0xf10a('0x3b')][0x0]?_0x27dc98[_0xf10a('0x3b')][0x0][_0xf10a('0x3c')]:undefined)||_0xf10a('0x42')},{'name':'attrTimezone','value':_0x27dc98[_0xf10a('0x43')]||(_0x27dc98['attrs']&&_0x27dc98[_0xf10a('0x3b')][0x1]?_0x27dc98[_0xf10a('0x3b')][0x1][_0xf10a('0x3c')]:undefined)||_0xf10a('0x44')},{'name':_0xf10a('0x45'),'value':_0x27dc98[_0xf10a('0x45')]||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x2]?_0x27dc98[_0xf10a('0x3b')][0x2][_0xf10a('0x3c')]:undefined)||0xc}];case _0xf10a('0x46'):return[{'name':_0xf10a('0x47'),'value':_0x27dc98['attrMetric']||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x0]?_0x27dc98[_0xf10a('0x3b')][0x0]['value']:undefined)||_0xf10a('0x48')},{'name':'attrVoiceQueues','value':_0x27dc98[_0xf10a('0x49')]||(_0x27dc98['attrs']&&_0x27dc98[_0xf10a('0x3b')][0x1]?_0x27dc98[_0xf10a('0x3b')][0x1]['value']:undefined)||[]},{'name':_0xf10a('0x45'),'value':_0x27dc98[_0xf10a('0x45')]||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x2]?_0x27dc98['attrs'][0x2][_0xf10a('0x3c')]:undefined)||0x14}];case _0xf10a('0x4a'):case _0xf10a('0x4b'):return[{'name':_0xf10a('0x4c'),'value':_0x27dc98['attrSerie1']||(_0x27dc98['attrs']&&_0x27dc98[_0xf10a('0x3b')][0x0]?_0x27dc98[_0xf10a('0x3b')][0x0][_0xf10a('0x3c')]:undefined)||_0xf10a('0x48')},{'name':_0xf10a('0x4d'),'value':_0x27dc98['attrSerie2']||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x1]?_0x27dc98[_0xf10a('0x3b')][0x1]['value']:undefined)||null},{'name':_0xf10a('0x4e'),'value':_0x27dc98[_0xf10a('0x4e')]||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98['attrs'][0x2]?_0x27dc98[_0xf10a('0x3b')][0x2][_0xf10a('0x3c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x27dc98[_0xf10a('0x49')]||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x3]?_0x27dc98[_0xf10a('0x3b')][0x3][_0xf10a('0x3c')]:undefined)||[]}];case _0xf10a('0x4f'):return[{'name':_0xf10a('0x50'),'type':_0x27dc98[_0xf10a('0x51')]||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x0]?_0x27dc98['attrs'][0x0][_0xf10a('0x38')]:undefined)||null,'value':_0x27dc98[_0xf10a('0x50')]||(_0x27dc98['attrs']&&_0x27dc98[_0xf10a('0x3b')][0x0]?_0x27dc98[_0xf10a('0x3b')][0x0][_0xf10a('0x3c')]:undefined)||null},{'name':'attrRefresh','value':_0x27dc98[_0xf10a('0x52')]||(_0x27dc98[_0xf10a('0x3b')]&&_0x27dc98[_0xf10a('0x3b')][0x1]?_0x27dc98[_0xf10a('0x3b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1fb311){logger[_0xf10a('0x53')](_0xf10a('0x54'),JSON['stringify'](_0x1fb311));return[];}}exports[_0xf10a('0x55')]=function(_0x29d87d,_0x9514d2){if(_0x29d87d[_0xf10a('0x56')]){_0x29d87d['body'][_0xf10a('0x3b')]=widgetAttributes(_0x29d87d[_0xf10a('0x56')]);}return db[_0xf10a('0x2a')][_0xf10a('0x55')](_0x29d87d[_0xf10a('0x56')],{})[_0xf10a('0x23')](respondWithResult(_0x9514d2,0xc9))['catch'](handleError(_0x9514d2,null));};exports['update']=function(_0x5b22a2,_0x50d2f6){if(_0x5b22a2[_0xf10a('0x56')]['id']){delete _0x5b22a2[_0xf10a('0x56')]['id'];}_0x5b22a2[_0xf10a('0x56')]['attrs']=widgetAttributes(_0x5b22a2[_0xf10a('0x56')]);return db[_0xf10a('0x2a')][_0xf10a('0x37')]({'where':{'id':_0x5b22a2['params']['id']}})[_0xf10a('0x23')](handleEntityNotFound(_0x50d2f6,null))['then'](saveUpdates(_0x5b22a2[_0xf10a('0x56')],null))[_0xf10a('0x23')](respondWithResult(_0x50d2f6,null))[_0xf10a('0x35')](handleError(_0x50d2f6,null));}; \ No newline at end of file +var _0x9a15=['create','body','update','eml-format','rimraf','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','includeAll','merge','options','find','catch','params','type','attrUrl','attrs','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','stringify'];(function(_0x85d65a,_0x488308){var _0x335dc1=function(_0x3ae36a){while(--_0x3ae36a){_0x85d65a['push'](_0x85d65a['shift']());}};_0x335dc1(++_0x488308);}(_0x9a15,0x105));var _0x59a1=function(_0x591729,_0x273002){_0x591729=_0x591729-0x0;var _0x1f5b56=_0x9a15[_0x591729];return _0x1f5b56;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x59a1('0x0'));var rimraf=require(_0x59a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x59a1('0x2'));var BPromise=require(_0x59a1('0x3'));var Mustache=require(_0x59a1('0x4'));var util=require('util');var path=require(_0x59a1('0x5'));var sox=require(_0x59a1('0x6'));var csv=require('to-csv');var ejs=require(_0x59a1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59a1('0x8'));var squel=require(_0x59a1('0x9'));var crypto=require(_0x59a1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x59a1('0xb'));var toCsv=require(_0x59a1('0xc'));var querystring=require(_0x59a1('0xd'));var Papa=require(_0x59a1('0xe'));var Redis=require(_0x59a1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x59a1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59a1('0x11'));var logger=require(_0x59a1('0x12'))('api');var utils=require(_0x59a1('0x13'));var config=require(_0x59a1('0x14'));var licenseUtil=require(_0x59a1('0x15'));var db=require(_0x59a1('0x16'))['db'];config[_0x59a1('0x17')]=_[_0x59a1('0x18')](config[_0x59a1('0x17')],{'host':_0x59a1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59a1('0x17')]));require(_0x59a1('0x1a'))[_0x59a1('0x1b')](socket);function respondWithStatusCode(_0x4852ed,_0x4f3e60){_0x4f3e60=_0x4f3e60||0xcc;return function(_0x4cb01e){if(_0x4cb01e){return _0x4852ed[_0x59a1('0x1c')](_0x4f3e60);}return _0x4852ed[_0x59a1('0x1d')](_0x4f3e60)['end']();};}function respondWithResult(_0x49fb0d,_0x3b37f3){_0x3b37f3=_0x3b37f3||0xc8;return function(_0x2135f5){if(_0x2135f5){return _0x49fb0d[_0x59a1('0x1d')](_0x3b37f3)[_0x59a1('0x1e')](_0x2135f5);}};}function respondWithFilteredResult(_0x33ba45,_0x390097){return function(_0xa805ca){if(_0xa805ca){var _0x18be94=_0xa805ca[_0x59a1('0x1f')],_0x235180=_0x390097[_0x59a1('0x20')],_0x2e24eb=_0x390097[_0x59a1('0x20')]+_0x390097[_0x59a1('0x21')],_0x1d8518;if(_0x2e24eb>=_0x18be94){_0x2e24eb=_0x18be94;_0x1d8518=0xc8;}else{_0x1d8518=0xce;}_0x33ba45[_0x59a1('0x1d')](_0x1d8518);return _0x33ba45[_0x59a1('0x22')](_0x59a1('0x23'),_0x235180+'-'+_0x2e24eb+'/'+_0x18be94)[_0x59a1('0x1e')](_0xa805ca);}return null;};}function patchUpdates(_0x43c5f2){return function(_0x3cba67){try{jsonpatch[_0x59a1('0x24')](_0x3cba67,_0x43c5f2,!![]);}catch(_0x53b6ef){return BPromise[_0x59a1('0x25')](_0x53b6ef);}return _0x3cba67[_0x59a1('0x26')]();};}function saveUpdates(_0xadab0d,_0x4a9cc2){return function(_0x362003){if(_0x362003){return _0x362003['update'](_0xadab0d)[_0x59a1('0x27')](function(_0x5004f7){return _0x5004f7;});}return null;};}function removeEntity(_0x187370,_0x4a044f){return function(_0x5aad54){if(_0x5aad54){return _0x5aad54[_0x59a1('0x28')]()[_0x59a1('0x27')](function(){_0x187370[_0x59a1('0x1d')](0xcc)[_0x59a1('0x29')]();});}};}function handleEntityNotFound(_0x3b11eb,_0x24f293){return function(_0x253f57){if(!_0x253f57){_0x3b11eb[_0x59a1('0x1c')](0x194);}return _0x253f57;};}function handleError(_0x20188e,_0xc7b387){_0xc7b387=_0xc7b387||0x1f4;return function(_0x30b119){logger['error'](_0x30b119[_0x59a1('0x2a')]);if(_0x30b119[_0x59a1('0x2b')]){delete _0x30b119[_0x59a1('0x2b')];}_0x20188e['status'](_0xc7b387)[_0x59a1('0x2c')](_0x30b119);};}exports[_0x59a1('0x2d')]=function(_0x518f72,_0x129451){var _0x1741e4={'raw':![],'where':{'id':_0x518f72['params']['id']}},_0x3ef79a={};_0x3ef79a[_0x59a1('0x2e')]=_[_0x59a1('0x2f')](db[_0x59a1('0x30')][_0x59a1('0x31')]);_0x3ef79a[_0x59a1('0x32')]=_['keys'](_0x518f72[_0x59a1('0x32')]);_0x3ef79a['filters']=_[_0x59a1('0x33')](_0x3ef79a[_0x59a1('0x2e')],_0x3ef79a[_0x59a1('0x32')]);_0x1741e4[_0x59a1('0x34')]=_[_0x59a1('0x33')](_0x3ef79a[_0x59a1('0x2e')],qs[_0x59a1('0x35')](_0x518f72['query']['fields']));_0x1741e4[_0x59a1('0x34')]=_0x1741e4['attributes']['length']?_0x1741e4['attributes']:_0x3ef79a['model'];if(_0x518f72[_0x59a1('0x32')][_0x59a1('0x36')]){_0x1741e4['include']=[{'all':!![]}];}_0x1741e4=_[_0x59a1('0x37')]({},_0x1741e4,_0x518f72[_0x59a1('0x38')]);return db[_0x59a1('0x30')][_0x59a1('0x39')](_0x1741e4)[_0x59a1('0x27')](handleEntityNotFound(_0x129451,null))[_0x59a1('0x27')](respondWithResult(_0x129451,null))[_0x59a1('0x3a')](handleError(_0x129451,null));};exports[_0x59a1('0x28')]=function(_0x51491f,_0x2699ba){return db[_0x59a1('0x30')][_0x59a1('0x39')]({'where':{'id':_0x51491f[_0x59a1('0x3b')]['id']}})[_0x59a1('0x27')](handleEntityNotFound(_0x2699ba,null))[_0x59a1('0x27')](removeEntity(_0x2699ba,null))[_0x59a1('0x3a')](handleError(_0x2699ba,null));};function widgetAttributes(_0xe3d93e){try{switch(_0xe3d93e[_0x59a1('0x3c')]){case'iframe':return[{'name':_0x59a1('0x3d'),'value':_0xe3d93e[_0x59a1('0x3d')]||(_0xe3d93e['attrs']&&_0xe3d93e[_0x59a1('0x3e')][0x0]?_0xe3d93e[_0x59a1('0x3e')][0x0][_0x59a1('0x3f')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0xe3d93e['attrPath']||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x0]?_0xe3d93e[_0x59a1('0x3e')][0x0][_0x59a1('0x3f')]:undefined)||''}];case _0x59a1('0x40'):return[{'name':_0x59a1('0x41'),'value':_0xe3d93e[_0x59a1('0x41')]||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x0]?_0xe3d93e[_0x59a1('0x3e')][0x0][_0x59a1('0x3f')]:undefined)||_0x59a1('0x42')},{'name':_0x59a1('0x43'),'value':_0xe3d93e[_0x59a1('0x43')]||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x1]?_0xe3d93e[_0x59a1('0x3e')][0x1][_0x59a1('0x3f')]:undefined)||_0x59a1('0x44')},{'name':_0x59a1('0x45'),'value':_0xe3d93e[_0x59a1('0x45')]||(_0xe3d93e['attrs']&&_0xe3d93e[_0x59a1('0x3e')][0x2]?_0xe3d93e[_0x59a1('0x3e')][0x2][_0x59a1('0x3f')]:undefined)||0xc}];case _0x59a1('0x46'):return[{'name':_0x59a1('0x47'),'value':_0xe3d93e[_0x59a1('0x47')]||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x0]?_0xe3d93e[_0x59a1('0x3e')][0x0]['value']:undefined)||_0x59a1('0x48')},{'name':_0x59a1('0x49'),'value':_0xe3d93e['attrVoiceQueues']||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x1]?_0xe3d93e[_0x59a1('0x3e')][0x1][_0x59a1('0x3f')]:undefined)||[]},{'name':_0x59a1('0x45'),'value':_0xe3d93e['attrFontSize']||(_0xe3d93e['attrs']&&_0xe3d93e[_0x59a1('0x3e')][0x2]?_0xe3d93e[_0x59a1('0x3e')][0x2][_0x59a1('0x3f')]:undefined)||0x14}];case _0x59a1('0x4a'):case'pie-chart':return[{'name':_0x59a1('0x4b'),'value':_0xe3d93e[_0x59a1('0x4b')]||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x0]?_0xe3d93e['attrs'][0x0][_0x59a1('0x3f')]:undefined)||_0x59a1('0x48')},{'name':_0x59a1('0x4c'),'value':_0xe3d93e[_0x59a1('0x4c')]||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x1]?_0xe3d93e['attrs'][0x1]['value']:undefined)||null},{'name':_0x59a1('0x4d'),'value':_0xe3d93e['attrSerie3']||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e['attrs'][0x2]?_0xe3d93e[_0x59a1('0x3e')][0x2][_0x59a1('0x3f')]:undefined)||null},{'name':_0x59a1('0x49'),'value':_0xe3d93e['attrVoiceQueues']||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x3]?_0xe3d93e[_0x59a1('0x3e')][0x3][_0x59a1('0x3f')]:undefined)||[]}];case _0x59a1('0x4e'):return[{'name':_0x59a1('0x4f'),'type':_0xe3d93e['reportType']||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x0]?_0xe3d93e[_0x59a1('0x3e')][0x0]['type']:undefined)||null,'value':_0xe3d93e[_0x59a1('0x4f')]||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x0]?_0xe3d93e['attrs'][0x0][_0x59a1('0x3f')]:undefined)||null},{'name':_0x59a1('0x50'),'value':_0xe3d93e[_0x59a1('0x50')]||(_0xe3d93e[_0x59a1('0x3e')]&&_0xe3d93e[_0x59a1('0x3e')][0x1]?_0xe3d93e[_0x59a1('0x3e')][0x1][_0x59a1('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x54b5f3){logger[_0x59a1('0x51')]('widgetAttributes:\x20%s',JSON[_0x59a1('0x52')](_0x54b5f3));return[];}}exports[_0x59a1('0x53')]=function(_0x48c18b,_0x39bbef){if(_0x48c18b[_0x59a1('0x54')]){_0x48c18b[_0x59a1('0x54')][_0x59a1('0x3e')]=widgetAttributes(_0x48c18b[_0x59a1('0x54')]);}return db[_0x59a1('0x30')]['create'](_0x48c18b['body'],{})['then'](respondWithResult(_0x39bbef,0xc9))[_0x59a1('0x3a')](handleError(_0x39bbef,null));};exports[_0x59a1('0x55')]=function(_0x2c0129,_0xe7ea97){if(_0x2c0129[_0x59a1('0x54')]['id']){delete _0x2c0129[_0x59a1('0x54')]['id'];}_0x2c0129['body'][_0x59a1('0x3e')]=widgetAttributes(_0x2c0129[_0x59a1('0x54')]);return db[_0x59a1('0x30')][_0x59a1('0x39')]({'where':{'id':_0x2c0129[_0x59a1('0x3b')]['id']}})[_0x59a1('0x27')](handleEntityNotFound(_0xe7ea97,null))[_0x59a1('0x27')](saveUpdates(_0x2c0129['body'],null))['then'](respondWithResult(_0xe7ea97,null))[_0x59a1('0x3a')](handleError(_0xe7ea97,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index aabdab5..873b153 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 _0x8794=['../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xcffcbe,_0x143d81){var _0x447d0d=function(_0x5753c2){while(--_0x5753c2){_0xcffcbe['push'](_0xcffcbe['shift']());}};_0x447d0d(++_0x143d81);}(_0x8794,0x1cb));var _0x4879=function(_0xca8431,_0x335b83){_0xca8431=_0xca8431-0x0;var _0x409e1c=_0x8794[_0xca8431];return _0x409e1c;};'use strict';var EventEmitter=require(_0x4879('0x0'));var DashboardItem=require(_0x4879('0x1'))['db'][_0x4879('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4879('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4879('0x4'),'afterDestroy':_0x4879('0x5')};function emitEvent(_0x5bdd3f){return function(_0x2156d5,_0x417ac9,_0x18258a){DashboardItemEvents[_0x4879('0x6')](_0x5bdd3f+':'+_0x2156d5['id'],_0x2156d5);DashboardItemEvents[_0x4879('0x6')](_0x5bdd3f,_0x2156d5);_0x18258a(null);};}for(var e in events){if(events[_0x4879('0x7')](e)){var event=events[e];DashboardItem[_0x4879('0x8')](e,emitEvent(event));}}module[_0x4879('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xb807=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xb807,0x17c));var _0x7b80=function(_0x3b9149,_0x2f93ab){_0x3b9149=_0x3b9149-0x0;var _0x2067f4=_0xb807[_0x3b9149];return _0x2067f4;};'use strict';var EventEmitter=require(_0x7b80('0x0'));var DashboardItem=require(_0x7b80('0x1'))['db'][_0x7b80('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7b80('0x3')](0x0);var events={'afterCreate':_0x7b80('0x4'),'afterUpdate':_0x7b80('0x5'),'afterDestroy':_0x7b80('0x6')};function emitEvent(_0x41ec33){return function(_0x2ddaf3,_0x58a155,_0x446140){DashboardItemEvents['emit'](_0x41ec33+':'+_0x2ddaf3['id'],_0x2ddaf3);DashboardItemEvents[_0x7b80('0x7')](_0x41ec33,_0x2ddaf3);_0x446140(null);};}for(var e in events){if(events[_0x7b80('0x8')](e)){var event=events[e];DashboardItem[_0x7b80('0x9')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index ada9917..e0c3162 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 _0xd387=['path','rimraf','../../config/environment','exports','DashboardItem','dashboard_items','lodash','../../config/logger','bluebird','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd387,0x7e));var _0x7d38=function(_0xeef414,_0x139c2f){_0xeef414=_0xeef414-0x0;var _0x55e0cc=_0xd387[_0xeef414];return _0x55e0cc;};'use strict';var _=require(_0x7d38('0x0'));var util=require('util');var logger=require(_0x7d38('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7d38('0x2'));var rp=require(_0x7d38('0x3'));var fs=require('fs');var path=require(_0x7d38('0x4'));var rimraf=require(_0x7d38('0x5'));var config=require(_0x7d38('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x7d38('0x7')]=function(_0x3887b9,_0x51f9a2){return _0x3887b9['define'](_0x7d38('0x8'),attributes,{'tableName':_0x7d38('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac1f=['../../config/environment','exports','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0xac1f,0x1e7));var _0xfac1=function(_0x4a9be0,_0x59079a){_0x4a9be0=_0x4a9be0-0x0;var _0x15100f=_0xac1f[_0x4a9be0];return _0x15100f;};'use strict';var _=require(_0xfac1('0x0'));var util=require(_0xfac1('0x1'));var logger=require(_0xfac1('0x2'))(_0xfac1('0x3'));var moment=require(_0xfac1('0x4'));var BPromise=require(_0xfac1('0x5'));var rp=require(_0xfac1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfac1('0x7'));var config=require(_0xfac1('0x8'));var attributes=require('./dashboardItem.attributes');module[_0xfac1('0x9')]=function(_0x5bc89e,_0x61970a){return _0x5bc89e['define']('DashboardItem',attributes,{'tableName':_0xfac1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 70dbc15..d81b767 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 _0xd2d5=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird'];(function(_0x355715,_0x308622){var _0x29c104=function(_0x51c865){while(--_0x51c865){_0x355715['push'](_0x355715['shift']());}};_0x29c104(++_0x308622);}(_0xd2d5,0x1e0));var _0x5d2d=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0xd2d5[_0x188703];return _0x1a0c81;};'use strict';var _=require(_0x5d2d('0x0'));var util=require(_0x5d2d('0x1'));var moment=require(_0x5d2d('0x2'));var BPromise=require(_0x5d2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5d2d('0x5'));var config=require(_0x5d2d('0x6'));var jayson=require(_0x5d2d('0x7'));var client=jayson[_0x5d2d('0x8')]['http']({'port':0x232a});config[_0x5d2d('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5d2d('0xa'))(new Redis(config[_0x5d2d('0x9')]));require(_0x5d2d('0xb'))[_0x5d2d('0xc')](socket);function respondWithRpcPromise(_0xb3d9a4,_0x2c5c24,_0x146b5d){return new BPromise(function(_0x4cd7ac,_0x5b1c73){return client['request'](_0xb3d9a4,_0x146b5d)[_0x5d2d('0xd')](function(_0xe1c773){logger[_0x5d2d('0xe')](_0x5d2d('0xf'),_0x2c5c24,_0x5d2d('0x10'));logger[_0x5d2d('0x11')](_0x5d2d('0x12'),_0x2c5c24,'request\x20sent',JSON[_0x5d2d('0x13')](_0xe1c773));if(_0xe1c773[_0x5d2d('0x14')]){if(_0xe1c773[_0x5d2d('0x14')]['code']===0x1f4){logger[_0x5d2d('0x14')](_0x5d2d('0xf'),_0x2c5c24,_0xe1c773[_0x5d2d('0x14')][_0x5d2d('0x15')]);return _0x5b1c73(_0xe1c773[_0x5d2d('0x14')][_0x5d2d('0x15')]);}logger[_0x5d2d('0x14')](_0x5d2d('0xf'),_0x2c5c24,_0xe1c773[_0x5d2d('0x14')][_0x5d2d('0x15')]);return _0x4cd7ac(_0xe1c773['error']['message']);}else{logger[_0x5d2d('0xe')](_0x5d2d('0xf'),_0x2c5c24,_0x5d2d('0x10'));_0x4cd7ac(_0xe1c773['result'][_0x5d2d('0x15')]);}})['catch'](function(_0x5b828e){logger[_0x5d2d('0x14')](_0x5d2d('0xf'),_0x2c5c24,_0x5b828e);_0x5b1c73(_0x5b828e);});});} \ No newline at end of file +var _0x0d5b=['util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0x5029ec,_0x56e4e5){var _0x1667bf=function(_0x3e4fc8){while(--_0x3e4fc8){_0x5029ec['push'](_0x5029ec['shift']());}};_0x1667bf(++_0x56e4e5);}(_0x0d5b,0x10d));var _0xb0d5=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x0d5b[_0x556927];return _0x5f1235;};'use strict';var _=require(_0xb0d5('0x0'));var util=require(_0xb0d5('0x1'));var moment=require(_0xb0d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0d5('0x4'))(_0xb0d5('0x5'));var config=require(_0xb0d5('0x6'));var jayson=require(_0xb0d5('0x7'));var client=jayson[_0xb0d5('0x8')][_0xb0d5('0x9')]({'port':0x232a});config[_0xb0d5('0xa')]=_[_0xb0d5('0xb')](config['redis'],{'host':_0xb0d5('0xc'),'port':0x18eb});var socket=require(_0xb0d5('0xd'))(new Redis(config[_0xb0d5('0xa')]));require(_0xb0d5('0xe'))[_0xb0d5('0xf')](socket);function respondWithRpcPromise(_0x479b4c,_0x413f44,_0x1cd23f){return new BPromise(function(_0x1a0d1e,_0x734b80){return client[_0xb0d5('0x10')](_0x479b4c,_0x1cd23f)[_0xb0d5('0x11')](function(_0x1cf70d){logger[_0xb0d5('0x12')](_0xb0d5('0x13'),_0x413f44,_0xb0d5('0x14'));logger[_0xb0d5('0x15')](_0xb0d5('0x16'),_0x413f44,_0xb0d5('0x14'),JSON[_0xb0d5('0x17')](_0x1cf70d));if(_0x1cf70d[_0xb0d5('0x18')]){if(_0x1cf70d['error']['code']===0x1f4){logger[_0xb0d5('0x18')](_0xb0d5('0x13'),_0x413f44,_0x1cf70d['error'][_0xb0d5('0x19')]);return _0x734b80(_0x1cf70d[_0xb0d5('0x18')][_0xb0d5('0x19')]);}logger[_0xb0d5('0x18')](_0xb0d5('0x13'),_0x413f44,_0x1cf70d['error']['message']);return _0x1a0d1e(_0x1cf70d[_0xb0d5('0x18')][_0xb0d5('0x19')]);}else{logger[_0xb0d5('0x12')](_0xb0d5('0x13'),_0x413f44,_0xb0d5('0x14'));_0x1a0d1e(_0x1cf70d['result']['message']);}})[_0xb0d5('0x1a')](function(_0xbbf238){logger[_0xb0d5('0x18')](_0xb0d5('0x13'),_0x413f44,_0xbbf238);_0x734b80(_0xbbf238);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ddad102..dff8b77 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 _0x5554=['./dashboardItem.events','save','remove','update','register','length','dashboardItem:'];(function(_0x4a873f,_0x5679c0){var _0x3a22f2=function(_0x5a3fd0){while(--_0x5a3fd0){_0x4a873f['push'](_0x4a873f['shift']());}};_0x3a22f2(++_0x5679c0);}(_0x5554,0x70));var _0x4555=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5554[_0x5ddb1c];return _0x354adc;};'use strict';var DashboardItemEvents=require(_0x4555('0x0'));var events=[_0x4555('0x1'),_0x4555('0x2'),_0x4555('0x3')];function createListener(_0x19310d,_0x5b8091){return function(_0x51d1ca){_0x5b8091['emit'](_0x19310d,_0x51d1ca);};}function removeListener(_0x166b87,_0x365d3d){return function(){DashboardItemEvents['removeListener'](_0x166b87,_0x365d3d);};}exports[_0x4555('0x4')]=function(_0x23a9c6){for(var _0x4aa061=0x0,_0x3ee5c1=events[_0x4555('0x5')];_0x4aa061<_0x3ee5c1;_0x4aa061++){var _0x1ab9e0=events[_0x4aa061];var _0x464df1=createListener(_0x4555('0x6')+_0x1ab9e0,_0x23a9c6);DashboardItemEvents['on'](_0x1ab9e0,_0x464df1);}}; \ No newline at end of file +var _0xd4ba=['emit','removeListener','register','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x241e52,_0x91618d){var _0x50f344=function(_0x357728){while(--_0x357728){_0x241e52['push'](_0x241e52['shift']());}};_0x50f344(++_0x91618d);}(_0xd4ba,0x131));var _0xad4b=function(_0x3328a7,_0x92409){_0x3328a7=_0x3328a7-0x0;var _0x395331=_0xd4ba[_0x3328a7];return _0x395331;};'use strict';var DashboardItemEvents=require(_0xad4b('0x0'));var events=['save',_0xad4b('0x1'),_0xad4b('0x2')];function createListener(_0x3cf227,_0xd2f3ff){return function(_0x5e10f1){_0xd2f3ff[_0xad4b('0x3')](_0x3cf227,_0x5e10f1);};}function removeListener(_0x3a68a2,_0x1cbb44){return function(){DashboardItemEvents[_0xad4b('0x4')](_0x3a68a2,_0x1cbb44);};}exports[_0xad4b('0x5')]=function(_0xd014a0){for(var _0x3d2cf3=0x0,_0x58b10a=events['length'];_0x3d2cf3<_0x58b10a;_0x3d2cf3++){var _0xce683=events[_0x3d2cf3];var _0x6ce01d=createListener(_0xad4b('0x6')+_0xce683,_0xd014a0);DashboardItemEvents['on'](_0xce683,_0x6ce01d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a8cd5d3..37838d6 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 _0x4659=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','multer'];(function(_0x7f20ad,_0x3d7c8b){var _0x39671e=function(_0x4bcbea){while(--_0x4bcbea){_0x7f20ad['push'](_0x7f20ad['shift']());}};_0x39671e(++_0x3d7c8b);}(_0x4659,0x19d));var _0x9465=function(_0x264bfd,_0x4472c3){_0x264bfd=_0x264bfd-0x0;var _0x38f37f=_0x4659[_0x264bfd];return _0x38f37f;};'use strict';var multer=require(_0x9465('0x0'));var util=require(_0x9465('0x1'));var path=require(_0x9465('0x2'));var timeout=require(_0x9465('0x3'));var express=require(_0x9465('0x4'));var router=express[_0x9465('0x5')]();var fs_extra=require(_0x9465('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9465('0x7'));var config=require('../../config/environment');var controller=require(_0x9465('0x8'));router[_0x9465('0x9')](_0x9465('0xa'),auth[_0x9465('0xb')](),controller[_0x9465('0xc')]);router[_0x9465('0xd')]('/',auth['isAuthenticated'](),controller[_0x9465('0xe')]);router[_0x9465('0xf')]('/:id',auth[_0x9465('0xb')](),controller[_0x9465('0x10')]);router[_0x9465('0x11')]('/:id',auth[_0x9465('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8245=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x206711,_0x50d07e){var _0x51a20a=function(_0x5b2a27){while(--_0x5b2a27){_0x206711['push'](_0x206711['shift']());}};_0x51a20a(++_0x50d07e);}(_0x8245,0x178));var _0x5824=function(_0x187337,_0x383a06){_0x187337=_0x187337-0x0;var _0x1cf018=_0x8245[_0x187337];return _0x1cf018;};'use strict';var multer=require(_0x5824('0x0'));var util=require(_0x5824('0x1'));var path=require(_0x5824('0x2'));var timeout=require(_0x5824('0x3'));var express=require(_0x5824('0x4'));var router=express['Router']();var fs_extra=require(_0x5824('0x5'));var auth=require(_0x5824('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5824('0x7'));var controller=require(_0x5824('0x8'));router[_0x5824('0x9')](_0x5824('0xa'),auth['isAuthenticated'](),controller[_0x5824('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5824('0xc')](_0x5824('0xa'),auth[_0x5824('0xd')](),controller[_0x5824('0xe')]);router[_0x5824('0xf')](_0x5824('0xa'),auth[_0x5824('0xd')](),controller[_0x5824('0x10')]);module[_0x5824('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 254becb..455d418 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 _0x2b94=['exports','STRING','ENUM','first','second','sequelize'];(function(_0x38699b,_0x23d38e){var _0xb7212e=function(_0x424924){while(--_0x424924){_0x38699b['push'](_0x38699b['shift']());}};_0xb7212e(++_0x23d38e);}(_0x2b94,0x1cd));var _0x42b9=function(_0x190ec1,_0x4ab235){_0x190ec1=_0x190ec1-0x0;var _0x12789b=_0x2b94[_0x190ec1];return _0x12789b;};'use strict';var Sequelize=require(_0x42b9('0x0'));module[_0x42b9('0x1')]={'name':{'type':Sequelize[_0x42b9('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x42b9('0x3')](_0x42b9('0x4'),_0x42b9('0x5'),'third'),'allowNull':![],'defaultValue':_0x42b9('0x4')},'description':{'type':Sequelize[_0x42b9('0x2')]}}; \ No newline at end of file +var _0x8c3e=['exports','STRING','ENUM','first','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8c3e,0x6d));var _0xe8c3=function(_0x202686,_0x5c3908){_0x202686=_0x202686-0x0;var _0x35ade5=_0x8c3e[_0x202686];return _0x35ade5;};'use strict';var Sequelize=require(_0xe8c3('0x0'));module[_0xe8c3('0x1')]={'name':{'type':Sequelize[_0xe8c3('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xe8c3('0x3')]('first','second','third'),'allowNull':![],'defaultValue':_0xe8c3('0x4')},'description':{'type':Sequelize[_0xe8c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 82d85ca..2ef4f6b 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 _0x7063=['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','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','then','destroy','get','Dispositions','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7063,0x1e2));var _0x3706=function(_0x5f57ab,_0x41abe7){_0x5f57ab=_0x5f57ab-0x0;var _0x5c80ce=_0x7063[_0x5f57ab];return _0x5c80ce;};'use strict';var pdf=require(_0x3706('0x0'));var emlformat=require(_0x3706('0x1'));var rimraf=require(_0x3706('0x2'));var zipdir=require(_0x3706('0x3'));var jsonpatch=require(_0x3706('0x4'));var rp=require(_0x3706('0x5'));var moment=require(_0x3706('0x6'));var BPromise=require(_0x3706('0x7'));var Mustache=require(_0x3706('0x8'));var util=require(_0x3706('0x9'));var path=require(_0x3706('0xa'));var sox=require(_0x3706('0xb'));var csv=require(_0x3706('0xc'));var ejs=require(_0x3706('0xd'));var fs=require('fs');var fs_extra=require(_0x3706('0xe'));var _=require('lodash');var squel=require(_0x3706('0xf'));var crypto=require(_0x3706('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3706('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3706('0x12'));var hardwareService=require(_0x3706('0x13'));var logger=require(_0x3706('0x14'))(_0x3706('0x15'));var utils=require(_0x3706('0x16'));var config=require(_0x3706('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3706('0x18'))['db'];function respondWithStatusCode(_0x3b5cb8,_0x529729){_0x529729=_0x529729||0xcc;return function(_0x25df0a){if(_0x25df0a){return _0x3b5cb8[_0x3706('0x19')](_0x529729);}return _0x3b5cb8[_0x3706('0x1a')](_0x529729)[_0x3706('0x1b')]();};}function respondWithResult(_0x1e0364,_0x272cd0){_0x272cd0=_0x272cd0||0xc8;return function(_0x4a1e60){if(_0x4a1e60){return _0x1e0364[_0x3706('0x1a')](_0x272cd0)[_0x3706('0x1c')](_0x4a1e60);}};}function respondWithFilteredResult(_0x1f4bd7,_0x1bd15e){return function(_0xae0cff){if(_0xae0cff){var _0x1f2fce=_0xae0cff[_0x3706('0x1d')],_0x4143b0=_0x1bd15e[_0x3706('0x1e')],_0x2e8f15=_0x1bd15e[_0x3706('0x1e')]+_0x1bd15e[_0x3706('0x1f')],_0x43612e;if(_0x2e8f15>=_0x1f2fce){_0x2e8f15=_0x1f2fce;_0x43612e=0xc8;}else{_0x43612e=0xce;}_0x1f4bd7[_0x3706('0x1a')](_0x43612e);return _0x1f4bd7['set']('Content-Range',_0x4143b0+'-'+_0x2e8f15+'/'+_0x1f2fce)[_0x3706('0x1c')](_0xae0cff);}return null;};}function patchUpdates(_0x45e9f0){return function(_0x384552){try{jsonpatch['apply'](_0x384552,_0x45e9f0,!![]);}catch(_0x5b6786){return BPromise[_0x3706('0x20')](_0x5b6786);}return _0x384552[_0x3706('0x21')]();};}function saveUpdates(_0x4784c5,_0x470c87){return function(_0x4707b6){if(_0x4707b6){return _0x4707b6['update'](_0x4784c5)[_0x3706('0x22')](function(_0x4258b9){return _0x4258b9;});}return null;};}function removeEntity(_0x11a1b6,_0xdb9630){return function(_0x3334f4){if(_0x3334f4){return _0x3334f4[_0x3706('0x23')]()[_0x3706('0x22')](function(){var _0x4dc4fc=_0x3334f4[_0x3706('0x24')]({'plain':!![]});var _0x25852d=_0x3706('0x25');return db['UserProfileResource'][_0x3706('0x23')]({'where':{'type':_0x25852d,'resourceId':_0x4dc4fc['id']}})['then'](function(){return _0x3334f4;});})[_0x3706('0x22')](function(){_0x11a1b6[_0x3706('0x1a')](0xcc)[_0x3706('0x1b')]();});}};}function handleEntityNotFound(_0x3964c3,_0x5092ca){return function(_0x1197ee){if(!_0x1197ee){_0x3964c3[_0x3706('0x19')](0x194);}return _0x1197ee;};}function handleError(_0x40da1e,_0x351328){_0x351328=_0x351328||0x1f4;return function(_0x326923){logger[_0x3706('0x26')](_0x326923[_0x3706('0x27')]);if(_0x326923[_0x3706('0x28')]){delete _0x326923['name'];}_0x40da1e[_0x3706('0x1a')](_0x351328)[_0x3706('0x29')](_0x326923);};}exports[_0x3706('0x2a')]=function(_0x553422,_0x1dae1a){var _0x4e1d23={},_0x2a835b={},_0x38ae36={'count':0x0,'rows':[]};var _0x5d583b=_[_0x3706('0x2b')](db[_0x3706('0x2c')][_0x3706('0x2d')],function(_0x18985d){return{'name':_0x18985d[_0x3706('0x2e')],'type':_0x18985d[_0x3706('0x2f')][_0x3706('0x30')]};});_0x2a835b[_0x3706('0x31')]=_['map'](_0x5d583b,'name');_0x2a835b[_0x3706('0x32')]=_['keys'](_0x553422[_0x3706('0x32')]);_0x2a835b[_0x3706('0x33')]=_[_0x3706('0x34')](_0x2a835b[_0x3706('0x31')],_0x2a835b[_0x3706('0x32')]);_0x4e1d23[_0x3706('0x35')]=_[_0x3706('0x34')](_0x2a835b[_0x3706('0x31')],qs['fields'](_0x553422[_0x3706('0x32')][_0x3706('0x36')]));_0x4e1d23[_0x3706('0x35')]=_0x4e1d23['attributes'][_0x3706('0x37')]?_0x4e1d23['attributes']:_0x2a835b[_0x3706('0x31')];if(!_0x553422[_0x3706('0x32')][_0x3706('0x38')](_0x3706('0x39'))){_0x4e1d23['limit']=qs[_0x3706('0x1f')](_0x553422[_0x3706('0x32')][_0x3706('0x1f')]);_0x4e1d23[_0x3706('0x1e')]=qs[_0x3706('0x1e')](_0x553422[_0x3706('0x32')][_0x3706('0x1e')]);}_0x4e1d23[_0x3706('0x3a')]=qs[_0x3706('0x3b')](_0x553422[_0x3706('0x32')][_0x3706('0x3b')]);_0x4e1d23[_0x3706('0x3c')]=qs[_0x3706('0x33')](_[_0x3706('0x3d')](_0x553422[_0x3706('0x32')],_0x2a835b['filters']),_0x5d583b);if(_0x553422[_0x3706('0x32')]['filter']){_0x4e1d23['where']=_['merge'](_0x4e1d23[_0x3706('0x3c')],{'$or':_[_0x3706('0x2b')](_0x5d583b,function(_0x1b53f7){if(_0x1b53f7[_0x3706('0x2f')]!==_0x3706('0x3e')){var _0x1a1377={};_0x1a1377[_0x1b53f7[_0x3706('0x28')]]={'$like':'%'+_0x553422[_0x3706('0x32')][_0x3706('0x3f')]+'%'};return _0x1a1377;}})});}_0x4e1d23=_[_0x3706('0x40')]({},_0x4e1d23,_0x553422[_0x3706('0x41')]);var _0xb8500d={'where':_0x4e1d23[_0x3706('0x3c')]};return db['Disposition']['count'](_0xb8500d)[_0x3706('0x22')](function(_0x290ef1){_0x38ae36[_0x3706('0x1d')]=_0x290ef1;if(_0x553422[_0x3706('0x32')]['includeAll']){_0x4e1d23[_0x3706('0x42')]=[{'all':!![]}];}return db[_0x3706('0x2c')][_0x3706('0x43')](_0x4e1d23);})[_0x3706('0x22')](function(_0x17b7c7){_0x38ae36[_0x3706('0x44')]=_0x17b7c7;return _0x38ae36;})[_0x3706('0x22')](respondWithFilteredResult(_0x1dae1a,_0x4e1d23))[_0x3706('0x45')](handleError(_0x1dae1a,null));};exports['show']=function(_0x5991c1,_0x9cd799){var _0x1cf29a={'raw':!![],'where':{'id':_0x5991c1[_0x3706('0x46')]['id']}},_0x5d5dab={};_0x5d5dab['model']=_[_0x3706('0x47')](db['Disposition'][_0x3706('0x2d')]);_0x5d5dab[_0x3706('0x32')]=_[_0x3706('0x47')](_0x5991c1[_0x3706('0x32')]);_0x5d5dab[_0x3706('0x33')]=_[_0x3706('0x34')](_0x5d5dab[_0x3706('0x31')],_0x5d5dab[_0x3706('0x32')]);_0x1cf29a[_0x3706('0x35')]=_[_0x3706('0x34')](_0x5d5dab[_0x3706('0x31')],qs[_0x3706('0x36')](_0x5991c1[_0x3706('0x32')][_0x3706('0x36')]));_0x1cf29a[_0x3706('0x35')]=_0x1cf29a[_0x3706('0x35')][_0x3706('0x37')]?_0x1cf29a[_0x3706('0x35')]:_0x5d5dab['model'];if(_0x5991c1[_0x3706('0x32')][_0x3706('0x48')]){_0x1cf29a['include']=[{'all':!![]}];}_0x1cf29a=_[_0x3706('0x40')]({},_0x1cf29a,_0x5991c1[_0x3706('0x41')]);return db[_0x3706('0x2c')][_0x3706('0x49')](_0x1cf29a)[_0x3706('0x22')](handleEntityNotFound(_0x9cd799,null))[_0x3706('0x22')](respondWithResult(_0x9cd799,null))[_0x3706('0x45')](handleError(_0x9cd799,null));};exports['create']=function(_0x51e4e5,_0x4e7c72){return db['Disposition'][_0x3706('0x4a')](_0x51e4e5[_0x3706('0x4b')],{})[_0x3706('0x22')](function(_0x276516){var _0x493684=_0x51e4e5[_0x3706('0x4c')][_0x3706('0x24')]({'plain':!![]});if(!_0x493684)throw new Error(_0x3706('0x4d'));if(_0x493684['role']===_0x3706('0x4c')){var _0x2129aa=_0x276516[_0x3706('0x24')]({'plain':!![]});var _0x2fb409=_0x3706('0x25');return db['UserProfileSection'][_0x3706('0x49')]({'where':{'name':_0x2fb409,'userProfileId':_0x493684['userProfileId']},'raw':!![]})[_0x3706('0x22')](function(_0x2dbe01){if(_0x2dbe01&&_0x2dbe01['autoAssociation']===0x0){return db['UserProfileResource'][_0x3706('0x4a')]({'name':_0x2129aa[_0x3706('0x28')],'resourceId':_0x2129aa['id'],'type':_0x2dbe01[_0x3706('0x28')],'sectionId':_0x2dbe01['id']},{})['then'](function(){return _0x276516;});}else{return _0x276516;}})['catch'](function(_0x25f81a){logger[_0x3706('0x26')](_0x3706('0x4e'),_0x25f81a);throw _0x25f81a;});}return _0x276516;})[_0x3706('0x22')](respondWithResult(_0x4e7c72,0xc9))[_0x3706('0x45')](handleError(_0x4e7c72,null));};exports[_0x3706('0x4f')]=function(_0x4a6fce,_0x13e18a){if(_0x4a6fce['body']['id']){delete _0x4a6fce[_0x3706('0x4b')]['id'];}return db[_0x3706('0x2c')][_0x3706('0x49')]({'where':{'id':_0x4a6fce[_0x3706('0x46')]['id']}})[_0x3706('0x22')](handleEntityNotFound(_0x13e18a,null))[_0x3706('0x22')](saveUpdates(_0x4a6fce[_0x3706('0x4b')],null))['then'](respondWithResult(_0x13e18a,null))[_0x3706('0x45')](handleError(_0x13e18a,null));};exports['destroy']=function(_0xfd511,_0x7a373f){return db['Disposition']['find']({'where':{'id':_0xfd511['params']['id']}})['then'](handleEntityNotFound(_0x7a373f,null))[_0x3706('0x22')](removeEntity(_0x7a373f,null))[_0x3706('0x45')](handleError(_0x7a373f,null));}; \ No newline at end of file +var _0x8d73=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','count','offset','limit','set','apply','reject','update','then','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','Disposition','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8d73,0x13f));var _0x38d7=function(_0x3335a2,_0x3976d6){_0x3335a2=_0x3335a2-0x0;var _0x3b7381=_0x8d73[_0x3335a2];return _0x3b7381;};'use strict';var pdf=require(_0x38d7('0x0'));var emlformat=require(_0x38d7('0x1'));var rimraf=require(_0x38d7('0x2'));var zipdir=require(_0x38d7('0x3'));var jsonpatch=require(_0x38d7('0x4'));var rp=require(_0x38d7('0x5'));var moment=require(_0x38d7('0x6'));var BPromise=require(_0x38d7('0x7'));var Mustache=require(_0x38d7('0x8'));var util=require(_0x38d7('0x9'));var path=require('path');var sox=require(_0x38d7('0xa'));var csv=require(_0x38d7('0xb'));var ejs=require(_0x38d7('0xc'));var fs=require('fs');var fs_extra=require(_0x38d7('0xd'));var _=require('lodash');var squel=require(_0x38d7('0xe'));var crypto=require(_0x38d7('0xf'));var jsforce=require(_0x38d7('0x10'));var deskjs=require(_0x38d7('0x11'));var toCsv=require('to-csv');var querystring=require(_0x38d7('0x12'));var Papa=require(_0x38d7('0x13'));var Redis=require(_0x38d7('0x14'));var authService=require(_0x38d7('0x15'));var qs=require(_0x38d7('0x16'));var as=require(_0x38d7('0x17'));var hardwareService=require(_0x38d7('0x18'));var logger=require(_0x38d7('0x19'))(_0x38d7('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17d5da,_0xc071e9){_0xc071e9=_0xc071e9||0xcc;return function(_0x34efbf){if(_0x34efbf){return _0x17d5da['sendStatus'](_0xc071e9);}return _0x17d5da['status'](_0xc071e9)[_0x38d7('0x1b')]();};}function respondWithResult(_0x4b303e,_0x2b314a){_0x2b314a=_0x2b314a||0xc8;return function(_0x1f889c){if(_0x1f889c){return _0x4b303e[_0x38d7('0x1c')](_0x2b314a)[_0x38d7('0x1d')](_0x1f889c);}};}function respondWithFilteredResult(_0x3c71fa,_0x1678fa){return function(_0x47c5df){if(_0x47c5df){var _0x34a5e1=_0x47c5df[_0x38d7('0x1e')],_0x58f2ef=_0x1678fa[_0x38d7('0x1f')],_0x2b941d=_0x1678fa[_0x38d7('0x1f')]+_0x1678fa[_0x38d7('0x20')],_0x1f2cdd;if(_0x2b941d>=_0x34a5e1){_0x2b941d=_0x34a5e1;_0x1f2cdd=0xc8;}else{_0x1f2cdd=0xce;}_0x3c71fa[_0x38d7('0x1c')](_0x1f2cdd);return _0x3c71fa[_0x38d7('0x21')]('Content-Range',_0x58f2ef+'-'+_0x2b941d+'/'+_0x34a5e1)[_0x38d7('0x1d')](_0x47c5df);}return null;};}function patchUpdates(_0x26f628){return function(_0x2bcb06){try{jsonpatch[_0x38d7('0x22')](_0x2bcb06,_0x26f628,!![]);}catch(_0x309873){return BPromise[_0x38d7('0x23')](_0x309873);}return _0x2bcb06['save']();};}function saveUpdates(_0x2bb7fb,_0x31eb9d){return function(_0x35884c){if(_0x35884c){return _0x35884c[_0x38d7('0x24')](_0x2bb7fb)[_0x38d7('0x25')](function(_0x206604){return _0x206604;});}return null;};}function removeEntity(_0x5c840e,_0xe2da42){return function(_0x268272){if(_0x268272){return _0x268272['destroy']()['then'](function(){var _0x37ed12=_0x268272['get']({'plain':!![]});var _0x2f1179=_0x38d7('0x26');return db[_0x38d7('0x27')]['destroy']({'where':{'type':_0x2f1179,'resourceId':_0x37ed12['id']}})[_0x38d7('0x25')](function(){return _0x268272;});})[_0x38d7('0x25')](function(){_0x5c840e[_0x38d7('0x1c')](0xcc)[_0x38d7('0x1b')]();});}};}function handleEntityNotFound(_0x46c518,_0xe39160){return function(_0x49fa13){if(!_0x49fa13){_0x46c518[_0x38d7('0x28')](0x194);}return _0x49fa13;};}function handleError(_0x2d63f6,_0x27375e){_0x27375e=_0x27375e||0x1f4;return function(_0x34c3e2){logger[_0x38d7('0x29')](_0x34c3e2[_0x38d7('0x2a')]);if(_0x34c3e2[_0x38d7('0x2b')]){delete _0x34c3e2[_0x38d7('0x2b')];}_0x2d63f6[_0x38d7('0x1c')](_0x27375e)[_0x38d7('0x2c')](_0x34c3e2);};}exports[_0x38d7('0x2d')]=function(_0x1229a0,_0x5e318c){var _0x513ebe={},_0x4762a4={},_0x1fef80={'count':0x0,'rows':[]};var _0x21b1d5=_[_0x38d7('0x2e')](db['Disposition'][_0x38d7('0x2f')],function(_0x5374d9){return{'name':_0x5374d9[_0x38d7('0x30')],'type':_0x5374d9['type']['key']};});_0x4762a4[_0x38d7('0x31')]=_[_0x38d7('0x2e')](_0x21b1d5,_0x38d7('0x2b'));_0x4762a4[_0x38d7('0x32')]=_[_0x38d7('0x33')](_0x1229a0[_0x38d7('0x32')]);_0x4762a4[_0x38d7('0x34')]=_[_0x38d7('0x35')](_0x4762a4['model'],_0x4762a4[_0x38d7('0x32')]);_0x513ebe[_0x38d7('0x36')]=_[_0x38d7('0x35')](_0x4762a4[_0x38d7('0x31')],qs['fields'](_0x1229a0[_0x38d7('0x32')][_0x38d7('0x37')]));_0x513ebe[_0x38d7('0x36')]=_0x513ebe[_0x38d7('0x36')][_0x38d7('0x38')]?_0x513ebe[_0x38d7('0x36')]:_0x4762a4[_0x38d7('0x31')];if(!_0x1229a0[_0x38d7('0x32')]['hasOwnProperty'](_0x38d7('0x39'))){_0x513ebe[_0x38d7('0x20')]=qs[_0x38d7('0x20')](_0x1229a0['query']['limit']);_0x513ebe[_0x38d7('0x1f')]=qs[_0x38d7('0x1f')](_0x1229a0[_0x38d7('0x32')][_0x38d7('0x1f')]);}_0x513ebe[_0x38d7('0x3a')]=qs['sort'](_0x1229a0['query'][_0x38d7('0x3b')]);_0x513ebe[_0x38d7('0x3c')]=qs[_0x38d7('0x34')](_['pick'](_0x1229a0['query'],_0x4762a4[_0x38d7('0x34')]),_0x21b1d5);if(_0x1229a0[_0x38d7('0x32')]['filter']){_0x513ebe[_0x38d7('0x3c')]=_[_0x38d7('0x3d')](_0x513ebe[_0x38d7('0x3c')],{'$or':_[_0x38d7('0x2e')](_0x21b1d5,function(_0x46eced){if(_0x46eced[_0x38d7('0x3e')]!==_0x38d7('0x3f')){var _0x10257e={};_0x10257e[_0x46eced[_0x38d7('0x2b')]]={'$like':'%'+_0x1229a0[_0x38d7('0x32')][_0x38d7('0x40')]+'%'};return _0x10257e;}})});}_0x513ebe=_['merge']({},_0x513ebe,_0x1229a0[_0x38d7('0x41')]);var _0x498f6c={'where':_0x513ebe['where']};return db[_0x38d7('0x42')][_0x38d7('0x1e')](_0x498f6c)[_0x38d7('0x25')](function(_0x501648){_0x1fef80[_0x38d7('0x1e')]=_0x501648;if(_0x1229a0[_0x38d7('0x32')][_0x38d7('0x43')]){_0x513ebe[_0x38d7('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x513ebe);})[_0x38d7('0x25')](function(_0x17fa8e){_0x1fef80[_0x38d7('0x45')]=_0x17fa8e;return _0x1fef80;})[_0x38d7('0x25')](respondWithFilteredResult(_0x5e318c,_0x513ebe))[_0x38d7('0x46')](handleError(_0x5e318c,null));};exports[_0x38d7('0x47')]=function(_0x5a836a,_0x4fdb1c){var _0x33c058={'raw':!![],'where':{'id':_0x5a836a[_0x38d7('0x48')]['id']}},_0x27dbee={};_0x27dbee[_0x38d7('0x31')]=_[_0x38d7('0x33')](db[_0x38d7('0x42')][_0x38d7('0x2f')]);_0x27dbee['query']=_[_0x38d7('0x33')](_0x5a836a[_0x38d7('0x32')]);_0x27dbee[_0x38d7('0x34')]=_[_0x38d7('0x35')](_0x27dbee['model'],_0x27dbee[_0x38d7('0x32')]);_0x33c058[_0x38d7('0x36')]=_['intersection'](_0x27dbee[_0x38d7('0x31')],qs[_0x38d7('0x37')](_0x5a836a[_0x38d7('0x32')][_0x38d7('0x37')]));_0x33c058[_0x38d7('0x36')]=_0x33c058['attributes'][_0x38d7('0x38')]?_0x33c058[_0x38d7('0x36')]:_0x27dbee['model'];if(_0x5a836a[_0x38d7('0x32')][_0x38d7('0x43')]){_0x33c058['include']=[{'all':!![]}];}_0x33c058=_['merge']({},_0x33c058,_0x5a836a[_0x38d7('0x41')]);return db['Disposition']['find'](_0x33c058)[_0x38d7('0x25')](handleEntityNotFound(_0x4fdb1c,null))[_0x38d7('0x25')](respondWithResult(_0x4fdb1c,null))[_0x38d7('0x46')](handleError(_0x4fdb1c,null));};exports['create']=function(_0x3ad682,_0x4917ec){return db['Disposition'][_0x38d7('0x49')](_0x3ad682[_0x38d7('0x4a')],{})[_0x38d7('0x25')](function(_0x2836e3){var _0x587195=_0x3ad682[_0x38d7('0x4b')]['get']({'plain':!![]});if(!_0x587195)throw new Error(_0x38d7('0x4c'));if(_0x587195[_0x38d7('0x4d')]==='user'){var _0x3fb89c=_0x2836e3[_0x38d7('0x4e')]({'plain':!![]});var _0x47ef7b=_0x38d7('0x26');return db[_0x38d7('0x4f')][_0x38d7('0x50')]({'where':{'name':_0x47ef7b,'userProfileId':_0x587195[_0x38d7('0x51')]},'raw':!![]})[_0x38d7('0x25')](function(_0x184c42){if(_0x184c42&&_0x184c42[_0x38d7('0x52')]===0x0){return db[_0x38d7('0x27')]['create']({'name':_0x3fb89c[_0x38d7('0x2b')],'resourceId':_0x3fb89c['id'],'type':_0x184c42[_0x38d7('0x2b')],'sectionId':_0x184c42['id']},{})['then'](function(){return _0x2836e3;});}else{return _0x2836e3;}})[_0x38d7('0x46')](function(_0x374cc6){logger[_0x38d7('0x29')](_0x38d7('0x53'),_0x374cc6);throw _0x374cc6;});}return _0x2836e3;})['then'](respondWithResult(_0x4917ec,0xc9))[_0x38d7('0x46')](handleError(_0x4917ec,null));};exports[_0x38d7('0x24')]=function(_0x5d37a5,_0x2b511f){if(_0x5d37a5['body']['id']){delete _0x5d37a5[_0x38d7('0x4a')]['id'];}return db[_0x38d7('0x42')][_0x38d7('0x50')]({'where':{'id':_0x5d37a5[_0x38d7('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b511f,null))[_0x38d7('0x25')](saveUpdates(_0x5d37a5[_0x38d7('0x4a')],null))['then'](respondWithResult(_0x2b511f,null))[_0x38d7('0x46')](handleError(_0x2b511f,null));};exports[_0x38d7('0x54')]=function(_0x83ccfe,_0x582911){return db[_0x38d7('0x42')][_0x38d7('0x50')]({'where':{'id':_0x83ccfe[_0x38d7('0x48')]['id']}})[_0x38d7('0x25')](handleEntityNotFound(_0x582911,null))[_0x38d7('0x25')](removeEntity(_0x582911,null))[_0x38d7('0x46')](handleError(_0x582911,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7e9180d..52600c9 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 _0x6dc0=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./disposition.attributes','Disposition','name_voice','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0x6dc0,0x18c));var _0x06dc=function(_0x309c9f,_0x3f57d3){_0x309c9f=_0x309c9f-0x0;var _0x1cd54=_0x6dc0[_0x309c9f];return _0x1cd54;};'use strict';var _=require(_0x06dc('0x0'));var util=require('util');var logger=require(_0x06dc('0x1'))(_0x06dc('0x2'));var moment=require(_0x06dc('0x3'));var BPromise=require(_0x06dc('0x4'));var rp=require(_0x06dc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x06dc('0x6'));var attributes=require(_0x06dc('0x7'));module['exports']=function(_0x45a093,_0x26b287){return _0x45a093['define'](_0x06dc('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x06dc('0x9'),'fields':[_0x06dc('0xa'),_0x06dc('0xb')]},{'unique':!![],'name':_0x06dc('0xc'),'fields':[_0x06dc('0xa'),'ChatWebsiteId']},{'unique':!![],'name':_0x06dc('0xd'),'fields':['name',_0x06dc('0xe')]},{'unique':!![],'name':_0x06dc('0xf'),'fields':['name',_0x06dc('0x10')]},{'unique':!![],'name':_0x06dc('0x11'),'fields':[_0x06dc('0xa'),_0x06dc('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x06dc('0xa'),_0x06dc('0x13')]},{'unique':!![],'name':_0x06dc('0x14'),'fields':[_0x06dc('0xa'),_0x06dc('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e0c=['Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports'];(function(_0xb99d8a,_0x4ae03c){var _0x4e3f21=function(_0x1bb581){while(--_0x1bb581){_0xb99d8a['push'](_0xb99d8a['shift']());}};_0x4e3f21(++_0x4ae03c);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x3c4f93,_0x24be5c){_0x3c4f93=_0x3c4f93-0x0;var _0x56d097=_0x5e0c[_0x3c4f93];return _0x56d097;};'use strict';var _=require('lodash');var util=require(_0xc5e0('0x0'));var logger=require(_0xc5e0('0x1'))(_0xc5e0('0x2'));var moment=require(_0xc5e0('0x3'));var BPromise=require(_0xc5e0('0x4'));var rp=require(_0xc5e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5e0('0x6'));var config=require(_0xc5e0('0x7'));var attributes=require(_0xc5e0('0x8'));module[_0xc5e0('0x9')]=function(_0x665907,_0x5ae492){return _0x665907['define'](_0xc5e0('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xc5e0('0xb'),'fields':[_0xc5e0('0xc'),_0xc5e0('0xd')]},{'unique':!![],'name':_0xc5e0('0xe'),'fields':['name',_0xc5e0('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0xc5e0('0xc'),_0xc5e0('0x10')]},{'unique':!![],'name':_0xc5e0('0x11'),'fields':[_0xc5e0('0xc'),_0xc5e0('0x12')]},{'unique':!![],'name':_0xc5e0('0x13'),'fields':['name',_0xc5e0('0x14')]},{'unique':!![],'name':_0xc5e0('0x15'),'fields':[_0xc5e0('0xc'),_0xc5e0('0x16')]},{'unique':!![],'name':_0xc5e0('0x17'),'fields':['name',_0xc5e0('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7470451..a3d3457 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 _0x7969=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Disposition,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','moment','bluebird','randomstring'];(function(_0x564e4d,_0x12beb0){var _0x5c8435=function(_0x21cb5f){while(--_0x21cb5f){_0x564e4d['push'](_0x564e4d['shift']());}};_0x5c8435(++_0x12beb0);}(_0x7969,0x94));var _0x9796=function(_0x3a2d84,_0x5b4661){_0x3a2d84=_0x3a2d84-0x0;var _0xa2ea02=_0x7969[_0x3a2d84];return _0xa2ea02;};'use strict';var _=require(_0x9796('0x0'));var util=require('util');var moment=require(_0x9796('0x1'));var BPromise=require(_0x9796('0x2'));var rs=require(_0x9796('0x3'));var fs=require('fs');var Redis=require(_0x9796('0x4'));var db=require(_0x9796('0x5'))['db'];var utils=require(_0x9796('0x6'));var logger=require(_0x9796('0x7'))('rpc');var config=require(_0x9796('0x8'));var jayson=require(_0x9796('0x9'));var client=jayson['client'][_0x9796('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b9601,_0x2587dc,_0x3fdc0e){return new BPromise(function(_0xdf3d,_0x2306ac){return client[_0x9796('0xb')](_0x2b9601,_0x3fdc0e)['then'](function(_0x8047ee){logger[_0x9796('0xc')](_0x9796('0xd'),_0x2587dc,'request\x20sent');logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x2587dc,'request\x20sent',JSON[_0x9796('0xe')](_0x8047ee));if(_0x8047ee[_0x9796('0xf')]){if(_0x8047ee[_0x9796('0xf')]['code']===0x1f4){logger['error']('Disposition,\x20%s,\x20%s',_0x2587dc,_0x8047ee[_0x9796('0xf')][_0x9796('0x10')]);return _0x2306ac(_0x8047ee['error'][_0x9796('0x10')]);}logger[_0x9796('0xf')](_0x9796('0xd'),_0x2587dc,_0x8047ee[_0x9796('0xf')][_0x9796('0x10')]);return _0xdf3d(_0x8047ee[_0x9796('0xf')][_0x9796('0x10')]);}else{logger[_0x9796('0xc')](_0x9796('0xd'),_0x2587dc,_0x9796('0x11'));_0xdf3d(_0x8047ee[_0x9796('0x12')]['message']);}})['catch'](function(_0x28c6d7){logger[_0x9796('0xf')](_0x9796('0xd'),_0x2587dc,_0x28c6d7);_0x2306ac(_0x28c6d7);});});} \ No newline at end of file +var _0xbdb8=['../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xf17786,_0x22bf88){var _0x7d3eb1=function(_0x178705){while(--_0x178705){_0xf17786['push'](_0xf17786['shift']());}};_0x7d3eb1(++_0x22bf88);}(_0xbdb8,0x1ac));var _0x8bdb=function(_0x1796bc,_0x1d8a78){_0x1796bc=_0x1796bc-0x0;var _0x3a381f=_0xbdb8[_0x1796bc];return _0x3a381f;};'use strict';var _=require('lodash');var util=require(_0x8bdb('0x0'));var moment=require(_0x8bdb('0x1'));var BPromise=require(_0x8bdb('0x2'));var rs=require(_0x8bdb('0x3'));var fs=require('fs');var Redis=require(_0x8bdb('0x4'));var db=require(_0x8bdb('0x5'))['db'];var utils=require(_0x8bdb('0x6'));var logger=require(_0x8bdb('0x7'))(_0x8bdb('0x8'));var config=require(_0x8bdb('0x9'));var jayson=require(_0x8bdb('0xa'));var client=jayson[_0x8bdb('0xb')][_0x8bdb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe0de62,_0x561d41,_0x3f6da9){return new BPromise(function(_0x1da3ac,_0xe5ac68){return client[_0x8bdb('0xd')](_0xe0de62,_0x3f6da9)[_0x8bdb('0xe')](function(_0x2d14c8){logger[_0x8bdb('0xf')](_0x8bdb('0x10'),_0x561d41,_0x8bdb('0x11'));logger[_0x8bdb('0x12')](_0x8bdb('0x13'),_0x561d41,_0x8bdb('0x11'),JSON['stringify'](_0x2d14c8));if(_0x2d14c8['error']){if(_0x2d14c8[_0x8bdb('0x14')]['code']===0x1f4){logger[_0x8bdb('0x14')]('Disposition,\x20%s,\x20%s',_0x561d41,_0x2d14c8[_0x8bdb('0x14')][_0x8bdb('0x15')]);return _0xe5ac68(_0x2d14c8[_0x8bdb('0x14')][_0x8bdb('0x15')]);}logger['error']('Disposition,\x20%s,\x20%s',_0x561d41,_0x2d14c8[_0x8bdb('0x14')][_0x8bdb('0x15')]);return _0x1da3ac(_0x2d14c8[_0x8bdb('0x14')][_0x8bdb('0x15')]);}else{logger[_0x8bdb('0xf')]('Disposition,\x20%s,\x20%s',_0x561d41,'request\x20sent');_0x1da3ac(_0x2d14c8['result'][_0x8bdb('0x15')]);}})[_0x8bdb('0x16')](function(_0x208898){logger['error'](_0x8bdb('0x10'),_0x561d41,_0x208898);_0xe5ac68(_0x208898);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 5c3cfa6..ebde50e 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 _0x810b=['put','update','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','./disposition.controller','get','isAuthenticated','/:id','post','create'];(function(_0x216edc,_0x57df05){var _0x745d3e=function(_0x2b1bf8){while(--_0x2b1bf8){_0x216edc['push'](_0x216edc['shift']());}};_0x745d3e(++_0x57df05);}(_0x810b,0x6d));var _0xb810=function(_0x5aad99,_0x1cdf8d){_0x5aad99=_0x5aad99-0x0;var _0x5b6cc3=_0x810b[_0x5aad99];return _0x5b6cc3;};'use strict';var multer=require(_0xb810('0x0'));var util=require(_0xb810('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb810('0x2'));var router=express['Router']();var fs_extra=require(_0xb810('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb810('0x4'));var config=require('../../config/environment');var controller=require(_0xb810('0x5'));router[_0xb810('0x6')]('/',auth[_0xb810('0x7')](),controller['index']);router[_0xb810('0x6')](_0xb810('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xb810('0x9')]('/',auth['isAuthenticated'](),controller[_0xb810('0xa')]);router[_0xb810('0xb')](_0xb810('0x8'),auth[_0xb810('0x7')](),controller[_0xb810('0xc')]);router['delete']('/:id',auth[_0xb810('0x7')](),controller[_0xb810('0xd')]);module[_0xb810('0xe')]=router; \ No newline at end of file +var _0xa3d5=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x49bd0e,_0x12b3c1){var _0x43d5c3=function(_0x5ed13b){while(--_0x5ed13b){_0x49bd0e['push'](_0x49bd0e['shift']());}};_0x43d5c3(++_0x12b3c1);}(_0xa3d5,0xe6));var _0x5a3d=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0xa3d5[_0x53ad58];return _0x554b03;};'use strict';var multer=require(_0x5a3d('0x0'));var util=require('util');var path=require(_0x5a3d('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a3d('0x2'));var router=express[_0x5a3d('0x3')]();var fs_extra=require(_0x5a3d('0x4'));var auth=require(_0x5a3d('0x5'));var interaction=require(_0x5a3d('0x6'));var config=require(_0x5a3d('0x7'));var controller=require(_0x5a3d('0x8'));router[_0x5a3d('0x9')]('/',auth[_0x5a3d('0xa')](),controller[_0x5a3d('0xb')]);router[_0x5a3d('0x9')](_0x5a3d('0xc'),auth[_0x5a3d('0xa')](),controller[_0x5a3d('0xd')]);router[_0x5a3d('0xe')]('/',auth[_0x5a3d('0xa')](),controller[_0x5a3d('0xf')]);router[_0x5a3d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5a3d('0x11')]);router['delete']('/:id',auth[_0x5a3d('0xa')](),controller[_0x5a3d('0x12')]);module[_0x5a3d('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index ad06584..bc3a5db 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 _0xb08b=['mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','7200','9600','2400','12000','14400','v17,v27,v29','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0xfc2d61,_0x55b3d0){var _0x3f2f72=function(_0x5d7710){while(--_0x5d7710){_0xfc2d61['push'](_0xfc2d61['shift']());}};_0x3f2f72(++_0x55b3d0);}(_0xb08b,0xc7));var _0xbb08=function(_0x3bc826,_0x54bd09){_0x3bc826=_0x3bc826-0x0;var _0x2caa4b=_0xb08b[_0x3bc826];return _0x2caa4b;};'use strict';var Sequelize=require(_0xbb08('0x0'));module[_0xbb08('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbb08('0x2')]},'ecm':{'type':Sequelize[_0xbb08('0x3')](_0xbb08('0x4'),'no'),'defaultValue':_0xbb08('0x4')},'headerinfo':{'type':Sequelize[_0xbb08('0x2')],'defaultValue':_0xbb08('0x5')},'localstationid':{'type':Sequelize[_0xbb08('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xbb08('0x3')]('2400',_0xbb08('0x6'),_0xbb08('0x7'),_0xbb08('0x8'),'12000','14400'),'defaultValue':_0xbb08('0x6')},'maxrate':{'type':Sequelize[_0xbb08('0x3')](_0xbb08('0x9'),_0xbb08('0x6'),'7200',_0xbb08('0x8'),_0xbb08('0xa'),_0xbb08('0xb')),'defaultValue':_0xbb08('0xb')},'modem':{'type':Sequelize[_0xbb08('0x2')],'defaultValue':_0xbb08('0xc')},'gateway':{'type':Sequelize[_0xbb08('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbb08('0x3')]('SIP','IAX','DADHI','KHOMP'),'defaultValue':_0xbb08('0xd')},'key':{'type':Sequelize[_0xbb08('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbb08('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbb08('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbb08('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbb08('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbb08('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbb08('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb08('0x10')],'allowNull':!![],'defaultValue':null,'comment':_0xbb08('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xbb08('0xf')],'defaultValue':![],'comment':_0xbb08('0x12'),'set':function(_0x1daeb0){if(!_0x1daeb0)this[_0xbb08('0x13')](_0xbb08('0x14'),null);this['setDataValue'](_0xbb08('0x15'),_0x1daeb0);}}}; \ No newline at end of file +var _0x761e=['14400','4800','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000'];(function(_0x558a14,_0x22988e){var _0x273183=function(_0x41feae){while(--_0x41feae){_0x558a14['push'](_0x558a14['shift']());}};_0x273183(++_0x22988e);}(_0x761e,0xae));var _0xe761=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0x761e[_0x420f2a];return _0x28f802;};'use strict';var Sequelize=require(_0xe761('0x0'));module['exports']={'name':{'type':Sequelize[_0xe761('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xe761('0x2')]('yes','no'),'defaultValue':_0xe761('0x3')},'headerinfo':{'type':Sequelize[_0xe761('0x1')],'defaultValue':_0xe761('0x4')},'localstationid':{'type':Sequelize[_0xe761('0x1')],'unique':_0xe761('0x5')},'minrate':{'type':Sequelize[_0xe761('0x2')](_0xe761('0x6'),'4800',_0xe761('0x7'),_0xe761('0x8'),_0xe761('0x9'),_0xe761('0xa')),'defaultValue':_0xe761('0xb')},'maxrate':{'type':Sequelize['ENUM'](_0xe761('0x6'),_0xe761('0xb'),_0xe761('0x7'),_0xe761('0x8'),'12000',_0xe761('0xa')),'defaultValue':_0xe761('0xa')},'modem':{'type':Sequelize[_0xe761('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xe761('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[_0xe761('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe761('0x2')]('SIP',_0xe761('0xd'),_0xe761('0xe'),_0xe761('0xf')),'defaultValue':_0xe761('0x10')},'key':{'type':Sequelize[_0xe761('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe761('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe761('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe761('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe761('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe761('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe761('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe761('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe761('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xe761('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xe761('0x12')],'defaultValue':![],'comment':_0xe761('0x14'),'set':function(_0x2b89b7){if(!_0x2b89b7)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe761('0x15')](_0xe761('0x16'),_0x2b89b7);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index fae43db..c587ab3 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 _0xe3a9=['getApplications','context','from-voip-provider','app','system','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','omit','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','send','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','getDispositions','findOne','order','Disposition','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll'];(function(_0x4f9387,_0x2d9949){var _0x5783db=function(_0x5c358a){while(--_0x5c358a){_0x4f9387['push'](_0x4f9387['shift']());}};_0x5783db(++_0x2d9949);}(_0xe3a9,0x10b));var _0x9e3a=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0xe3a9[_0x1f9f5f];return _0x51d649;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9e3a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e3a('0x1'));var jsonpatch=require(_0x9e3a('0x2'));var rp=require(_0x9e3a('0x3'));var moment=require(_0x9e3a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e3a('0x5'));var util=require(_0x9e3a('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e3a('0x7'));var _=require(_0x9e3a('0x8'));var squel=require(_0x9e3a('0x9'));var crypto=require(_0x9e3a('0xa'));var jsforce=require(_0x9e3a('0xb'));var deskjs=require(_0x9e3a('0xc'));var toCsv=require(_0x9e3a('0xd'));var querystring=require(_0x9e3a('0xe'));var Papa=require(_0x9e3a('0xf'));var Redis=require(_0x9e3a('0x10'));var authService=require(_0x9e3a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9e3a('0x12'));var hardwareService=require(_0x9e3a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9e3a('0x14'));var config=require(_0x9e3a('0x15'));var licenseUtil=require(_0x9e3a('0x16'));var db=require('../../mysqldb')['db'];config[_0x9e3a('0x17')]=_[_0x9e3a('0x18')](config[_0x9e3a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e3a('0x19'))(new Redis(config[_0x9e3a('0x17')]));require(_0x9e3a('0x1a'))['register'](socket);var jayson=require(_0x9e3a('0x1b'));var client=jayson['client'][_0x9e3a('0x1c')]({'port':0x232c});var client9002=jayson[_0x9e3a('0x1d')][_0x9e3a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4bbc2d,_0x4f2854,_0x5b9eb2,_0x18c9a2){return new BPromise(function(_0xbcff66,_0xc1f86c){var _0x492b51=_0x18c9a2||client;return _0x492b51['request'](_0x4bbc2d,_0x5b9eb2)[_0x9e3a('0x1e')](function(_0x455642){logger['info'](_0x9e3a('0x1f'),_0x4f2854,_0x9e3a('0x20'));logger[_0x9e3a('0x21')](_0x9e3a('0x22'),_0x4f2854,_0x9e3a('0x20'),JSON[_0x9e3a('0x23')](_0x455642));if(_0x455642[_0x9e3a('0x24')]){if(_0x455642[_0x9e3a('0x24')]['code']===0x1f4){logger['error'](_0x9e3a('0x1f'),_0x4f2854,_0x455642[_0x9e3a('0x24')][_0x9e3a('0x25')]);return _0xc1f86c(_0x455642[_0x9e3a('0x24')][_0x9e3a('0x25')]);}logger['error'](_0x9e3a('0x1f'),_0x4f2854,_0x455642[_0x9e3a('0x24')]['message']);return _0xbcff66(_0x455642['error']['message']);}else{logger[_0x9e3a('0x26')](_0x9e3a('0x1f'),_0x4f2854,_0x9e3a('0x20'));_0xbcff66(_0x455642[_0x9e3a('0x27')][_0x9e3a('0x25')]);}})[_0x9e3a('0x28')](function(_0x33d9f0){logger[_0x9e3a('0x24')](_0x9e3a('0x1f'),_0x4f2854,_0x33d9f0);_0xc1f86c(_0x33d9f0);});});}function respondWithStatusCode(_0x19024f,_0x102416){_0x102416=_0x102416||0xcc;return function(_0x445d64){if(_0x445d64){return _0x19024f[_0x9e3a('0x29')](_0x102416);}return _0x19024f[_0x9e3a('0x2a')](_0x102416)[_0x9e3a('0x2b')]();};}function respondWithResult(_0x21b5d2,_0x517e62){_0x517e62=_0x517e62||0xc8;return function(_0x334250){if(_0x334250){return _0x21b5d2[_0x9e3a('0x2a')](_0x517e62)[_0x9e3a('0x2c')](_0x334250);}};}function respondWithFilteredResult(_0x3d163e,_0x5828f9){return function(_0x2af23f){if(_0x2af23f){var _0x1ff04f=_0x2af23f[_0x9e3a('0x2d')],_0x11e657=_0x5828f9[_0x9e3a('0x2e')],_0x2a7957=_0x5828f9[_0x9e3a('0x2e')]+_0x5828f9['limit'],_0x2c155b;if(_0x2a7957>=_0x1ff04f){_0x2a7957=_0x1ff04f;_0x2c155b=0xc8;}else{_0x2c155b=0xce;}_0x3d163e[_0x9e3a('0x2a')](_0x2c155b);return _0x3d163e[_0x9e3a('0x2f')](_0x9e3a('0x30'),_0x11e657+'-'+_0x2a7957+'/'+_0x1ff04f)[_0x9e3a('0x2c')](_0x2af23f);}return null;};}function patchUpdates(_0x57bb94){return function(_0x42b8be){try{jsonpatch[_0x9e3a('0x31')](_0x42b8be,_0x57bb94,!![]);}catch(_0x5f227b){return BPromise[_0x9e3a('0x32')](_0x5f227b);}return _0x42b8be[_0x9e3a('0x33')]();};}function saveUpdates(_0x43eeb3,_0x4d05af){return function(_0x13d12c){if(_0x13d12c){return _0x13d12c[_0x9e3a('0x34')](_0x43eeb3)[_0x9e3a('0x1e')](function(_0x2fa3e2){return _0x2fa3e2;});}return null;};}function removeEntity(_0x3f5d74,_0x545be4){return function(_0x3418c3){if(_0x3418c3){return _0x3418c3[_0x9e3a('0x35')]()[_0x9e3a('0x1e')](function(){var _0x80ef28=_0x3418c3[_0x9e3a('0x36')]({'plain':!![]});var _0x275e38=_0x9e3a('0x37');return db[_0x9e3a('0x38')][_0x9e3a('0x35')]({'where':{'type':_0x275e38,'resourceId':_0x80ef28['id']}})[_0x9e3a('0x1e')](function(){return _0x3418c3;});})[_0x9e3a('0x1e')](function(){_0x3f5d74['status'](0xcc)[_0x9e3a('0x2b')]();});}};}function handleEntityNotFound(_0x5540a7,_0x522b3b){return function(_0x132155){if(!_0x132155){_0x5540a7['sendStatus'](0x194);}return _0x132155;};}function handleError(_0x4076c2,_0x582b7a){_0x582b7a=_0x582b7a||0x1f4;return function(_0x2f03e3){logger[_0x9e3a('0x24')](_0x2f03e3[_0x9e3a('0x39')]);if(_0x2f03e3[_0x9e3a('0x3a')]){delete _0x2f03e3['name'];}_0x4076c2[_0x9e3a('0x2a')](_0x582b7a)['send'](_0x2f03e3);};}exports[_0x9e3a('0x3b')]=function(_0x410f6d,_0x3d3b1d){var _0x54c838={'include':[{'model':db[_0x9e3a('0x3c')],'as':_0x9e3a('0x3d')}]},_0x1da573={},_0x5111ae={'count':0x0,'rows':[]};var _0x5e16b1=_[_0x9e3a('0x3e')](db[_0x9e3a('0x3f')][_0x9e3a('0x40')],function(_0x21e635){return{'name':_0x21e635[_0x9e3a('0x41')],'type':_0x21e635[_0x9e3a('0x42')]['key']};});_0x1da573[_0x9e3a('0x43')]=_[_0x9e3a('0x3e')](_0x5e16b1,_0x9e3a('0x3a'));_0x1da573['query']=_[_0x9e3a('0x44')](_0x410f6d['query']);_0x1da573[_0x9e3a('0x45')]=_['intersection'](_0x1da573[_0x9e3a('0x43')],_0x1da573[_0x9e3a('0x46')]);_0x54c838[_0x9e3a('0x47')]=_[_0x9e3a('0x48')](_0x1da573['model'],qs['fields'](_0x410f6d[_0x9e3a('0x46')][_0x9e3a('0x49')]));_0x54c838[_0x9e3a('0x47')]=_0x54c838[_0x9e3a('0x47')][_0x9e3a('0x4a')]?_0x54c838[_0x9e3a('0x47')]:_0x1da573[_0x9e3a('0x43')];if(!_0x410f6d[_0x9e3a('0x46')][_0x9e3a('0x4b')](_0x9e3a('0x4c'))){_0x54c838[_0x9e3a('0x4d')]=qs[_0x9e3a('0x4d')](_0x410f6d[_0x9e3a('0x46')]['limit']);_0x54c838[_0x9e3a('0x2e')]=qs[_0x9e3a('0x2e')](_0x410f6d[_0x9e3a('0x46')]['offset']);}_0x54c838['order']=qs[_0x9e3a('0x4e')](_0x410f6d[_0x9e3a('0x46')]['sort']);_0x54c838[_0x9e3a('0x4f')]=qs[_0x9e3a('0x45')](_[_0x9e3a('0x50')](_0x410f6d[_0x9e3a('0x46')],_0x1da573[_0x9e3a('0x45')]),_0x5e16b1);if(_0x410f6d[_0x9e3a('0x46')][_0x9e3a('0x51')]){_0x54c838['where']=_[_0x9e3a('0x52')](_0x54c838[_0x9e3a('0x4f')],{'$or':_[_0x9e3a('0x3e')](_0x5e16b1,function(_0x2acc3e){if(_0x2acc3e[_0x9e3a('0x42')]!==_0x9e3a('0x53')){var _0x3eb1ad={};_0x3eb1ad[_0x2acc3e[_0x9e3a('0x3a')]]={'$like':'%'+_0x410f6d[_0x9e3a('0x46')][_0x9e3a('0x51')]+'%'};return _0x3eb1ad;}})});}_0x54c838=_[_0x9e3a('0x52')]({},_0x54c838,_0x410f6d[_0x9e3a('0x54')]);var _0x41bb10={'where':_0x54c838[_0x9e3a('0x4f')]};return db[_0x9e3a('0x3f')][_0x9e3a('0x2d')](_0x41bb10)[_0x9e3a('0x1e')](function(_0xc68519){_0x5111ae[_0x9e3a('0x2d')]=_0xc68519;if(_0x410f6d[_0x9e3a('0x46')]['includeAll']){_0x54c838[_0x9e3a('0x55')]=[{'all':!![]}];}return db[_0x9e3a('0x3f')][_0x9e3a('0x56')](_0x54c838);})[_0x9e3a('0x1e')](function(_0x12b1ba){_0x5111ae[_0x9e3a('0x57')]=_0x12b1ba;return _0x5111ae;})[_0x9e3a('0x1e')](respondWithFilteredResult(_0x3d3b1d,_0x54c838))['catch'](handleError(_0x3d3b1d,null));};exports['show']=function(_0x2d4dda,_0x5323e9){var _0x5b7c32={'raw':![],'where':{'id':_0x2d4dda[_0x9e3a('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5a9856={};_0x5a9856['model']=_[_0x9e3a('0x44')](db[_0x9e3a('0x3f')][_0x9e3a('0x40')]);_0x5a9856[_0x9e3a('0x46')]=_[_0x9e3a('0x44')](_0x2d4dda[_0x9e3a('0x46')]);_0x5a9856[_0x9e3a('0x45')]=_['intersection'](_0x5a9856[_0x9e3a('0x43')],_0x5a9856[_0x9e3a('0x46')]);_0x5b7c32[_0x9e3a('0x47')]=_[_0x9e3a('0x48')](_0x5a9856[_0x9e3a('0x43')],qs[_0x9e3a('0x49')](_0x2d4dda[_0x9e3a('0x46')]['fields']));_0x5b7c32[_0x9e3a('0x47')]=_0x5b7c32[_0x9e3a('0x47')]['length']?_0x5b7c32[_0x9e3a('0x47')]:_0x5a9856['model'];if(_0x2d4dda[_0x9e3a('0x46')]['includeAll']){_0x5b7c32[_0x9e3a('0x55')]=[{'all':!![]}];}_0x5b7c32=_[_0x9e3a('0x52')]({},_0x5b7c32,_0x2d4dda[_0x9e3a('0x54')]);return db[_0x9e3a('0x3f')][_0x9e3a('0x59')](_0x5b7c32)[_0x9e3a('0x1e')](handleEntityNotFound(_0x5323e9,null))[_0x9e3a('0x1e')](respondWithResult(_0x5323e9,null))[_0x9e3a('0x28')](handleError(_0x5323e9,null));};exports[_0x9e3a('0x5a')]=function(_0x2d25cd,_0x155c9c){return db[_0x9e3a('0x3f')]['create'](_0x2d25cd[_0x9e3a('0x5b')],{})[_0x9e3a('0x1e')](function(_0x43fc05){var _0x1c2d1e=_0x2d25cd[_0x9e3a('0x5c')][_0x9e3a('0x36')]({'plain':!![]});if(!_0x1c2d1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c2d1e[_0x9e3a('0x5d')]===_0x9e3a('0x5c')){var _0x5ab02b=_0x43fc05[_0x9e3a('0x36')]({'plain':!![]});var _0x1cd996=_0x9e3a('0x37');return db[_0x9e3a('0x5e')][_0x9e3a('0x59')]({'where':{'name':_0x1cd996,'userProfileId':_0x1c2d1e[_0x9e3a('0x5f')]},'raw':!![]})[_0x9e3a('0x1e')](function(_0x275ae4){if(_0x275ae4&&_0x275ae4[_0x9e3a('0x60')]===0x0){return db[_0x9e3a('0x38')]['create']({'name':_0x5ab02b[_0x9e3a('0x3a')],'resourceId':_0x5ab02b['id'],'type':_0x275ae4[_0x9e3a('0x3a')],'sectionId':_0x275ae4['id']},{})['then'](function(){return _0x43fc05;});}else{return _0x43fc05;}})['catch'](function(_0x3d1d71){logger[_0x9e3a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d1d71);throw _0x3d1d71;});}return _0x43fc05;})[_0x9e3a('0x1e')](respondWithResult(_0x155c9c,0xc9))[_0x9e3a('0x28')](handleError(_0x155c9c,null));};exports[_0x9e3a('0x34')]=function(_0x3bf1e8,_0x404581){if(_0x3bf1e8[_0x9e3a('0x5b')]['id']){delete _0x3bf1e8[_0x9e3a('0x5b')]['id'];}return db[_0x9e3a('0x3f')]['find']({'where':{'id':_0x3bf1e8['params']['id']},'include':[{'model':db[_0x9e3a('0x3c')],'as':_0x9e3a('0x3d')}]})[_0x9e3a('0x1e')](handleEntityNotFound(_0x404581,null))[_0x9e3a('0x1e')](saveUpdates(_0x3bf1e8['body'],null))[_0x9e3a('0x1e')](respondWithResult(_0x404581,null))['catch'](handleError(_0x404581,null));};exports['destroy']=function(_0xa2962c,_0x563676){return db[_0x9e3a('0x3f')][_0x9e3a('0x59')]({'where':{'id':_0xa2962c['params']['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x563676,null))['then'](removeEntity(_0x563676,null))[_0x9e3a('0x28')](handleError(_0x563676,null));};exports[_0x9e3a('0x61')]=function(_0x3b645b,_0xe85f04){return db[_0x9e3a('0x3f')][_0x9e3a('0x61')]()[_0x9e3a('0x1e')](respondWithResult(_0xe85f04,null))[_0x9e3a('0x28')](handleError(_0xe85f04,null));};exports[_0x9e3a('0x62')]=function(_0x345f7a,_0xc9384d,_0x5cf572){if(_0x345f7a[_0x9e3a('0x5b')]['id']){delete _0x345f7a['body']['id'];}return db[_0x9e3a('0x3f')][_0x9e3a('0x59')]({'where':{'id':_0x345f7a['params']['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0xc9384d,null))[_0x9e3a('0x1e')](function(_0xe6f18e){if(_0xe6f18e){_0x345f7a['body'][_0x9e3a('0x63')]=_0xe6f18e['id'];return db['Disposition'][_0x9e3a('0x5a')](_0x345f7a[_0x9e3a('0x5b')]);}})[_0x9e3a('0x1e')](respondWithResult(_0xc9384d,null))[_0x9e3a('0x28')](handleError(_0xc9384d,null));};exports[_0x9e3a('0x64')]=function(_0x50f6e3,_0x231e45,_0x114905){var _0x3f98ad={'raw':![],'where':{}};var _0x4a9139={};var _0xd6e46c={'count':0x0,'rows':[]};return db[_0x9e3a('0x3f')][_0x9e3a('0x65')]({'where':{'id':_0x50f6e3['params']['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x231e45,null))['then'](function(_0x5e8f0b){if(_0x5e8f0b){_0x4a9139[_0x9e3a('0x43')]=_[_0x9e3a('0x44')](db['Disposition'][_0x9e3a('0x40')]);_0x4a9139[_0x9e3a('0x46')]=_['keys'](_0x50f6e3[_0x9e3a('0x46')]);_0x4a9139[_0x9e3a('0x45')]=_[_0x9e3a('0x48')](_0x4a9139[_0x9e3a('0x43')],_0x4a9139[_0x9e3a('0x46')]);_0x3f98ad[_0x9e3a('0x47')]=_[_0x9e3a('0x48')](_0x4a9139[_0x9e3a('0x43')],qs[_0x9e3a('0x49')](_0x50f6e3[_0x9e3a('0x46')][_0x9e3a('0x49')]));_0x3f98ad[_0x9e3a('0x47')]=_0x3f98ad[_0x9e3a('0x47')][_0x9e3a('0x4a')]?_0x3f98ad['attributes']:_0x4a9139[_0x9e3a('0x43')];if(!_0x50f6e3[_0x9e3a('0x46')][_0x9e3a('0x4b')](_0x9e3a('0x4c'))){_0x3f98ad[_0x9e3a('0x4d')]=qs[_0x9e3a('0x4d')](_0x50f6e3['query'][_0x9e3a('0x4d')]);_0x3f98ad[_0x9e3a('0x2e')]=qs[_0x9e3a('0x2e')](_0x50f6e3['query'][_0x9e3a('0x2e')]);}_0x3f98ad[_0x9e3a('0x66')]=qs[_0x9e3a('0x4e')](_0x50f6e3[_0x9e3a('0x46')][_0x9e3a('0x4e')]);_0x3f98ad[_0x9e3a('0x4f')]=qs[_0x9e3a('0x45')](_[_0x9e3a('0x50')](_0x50f6e3[_0x9e3a('0x46')],_0x4a9139[_0x9e3a('0x45')]));_0x3f98ad[_0x9e3a('0x4f')][_0x9e3a('0x63')]=_0x5e8f0b['id'];if(_0x50f6e3[_0x9e3a('0x46')][_0x9e3a('0x51')]){_0x3f98ad[_0x9e3a('0x4f')]=_[_0x9e3a('0x52')](_0x3f98ad[_0x9e3a('0x4f')],{'$or':_[_0x9e3a('0x3e')](_0x3f98ad[_0x9e3a('0x47')],function(_0x4459d6){var _0x21f1b4={};_0x21f1b4[_0x4459d6]={'$like':'%'+_0x50f6e3[_0x9e3a('0x46')][_0x9e3a('0x51')]+'%'};return _0x21f1b4;})});}_0x3f98ad=_['merge']({},_0x3f98ad,_0x50f6e3[_0x9e3a('0x54')]);return db[_0x9e3a('0x67')][_0x9e3a('0x2d')]({'where':_0x3f98ad[_0x9e3a('0x4f')]})[_0x9e3a('0x1e')](function(_0x2cafb7){_0xd6e46c[_0x9e3a('0x2d')]=_0x2cafb7;if(_0x50f6e3[_0x9e3a('0x46')][_0x9e3a('0x68')]){_0x3f98ad['include']=[{'all':!![]}];}return db[_0x9e3a('0x67')][_0x9e3a('0x56')](_0x3f98ad);})[_0x9e3a('0x1e')](function(_0x5f3286){_0xd6e46c[_0x9e3a('0x57')]=_0x5f3286;return _0xd6e46c;});}})[_0x9e3a('0x1e')](respondWithFilteredResult(_0x231e45,_0x3f98ad))[_0x9e3a('0x28')](handleError(_0x231e45,null));};exports[_0x9e3a('0x69')]=function(_0x7b5d4a,_0x5892db,_0x523cdc){return db[_0x9e3a('0x3f')][_0x9e3a('0x59')]({'where':{'id':_0x7b5d4a[_0x9e3a('0x58')]['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x5892db,null))[_0x9e3a('0x1e')](function(_0x341793){if(_0x341793){return _0x341793[_0x9e3a('0x69')](_0x7b5d4a['query'][_0x9e3a('0x6a')]);}})[_0x9e3a('0x1e')](respondWithStatusCode(_0x5892db,null))[_0x9e3a('0x28')](handleError(_0x5892db,null));};exports[_0x9e3a('0x6b')]=function(_0x75e2b0,_0x478720,_0x5e14e7){if(_0x75e2b0[_0x9e3a('0x5b')]['id']){delete _0x75e2b0[_0x9e3a('0x5b')]['id'];}return db[_0x9e3a('0x3f')][_0x9e3a('0x59')]({'where':{'id':_0x75e2b0[_0x9e3a('0x58')]['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x478720,null))[_0x9e3a('0x1e')](function(_0xa0f0a6){if(_0xa0f0a6){_0x75e2b0[_0x9e3a('0x5b')][_0x9e3a('0x63')]=_0xa0f0a6['id'];return db[_0x9e3a('0x6c')][_0x9e3a('0x5a')](_0x75e2b0[_0x9e3a('0x5b')]);}})['then'](respondWithResult(_0x478720,null))[_0x9e3a('0x28')](handleError(_0x478720,null));};exports[_0x9e3a('0x6d')]=function(_0x25893a,_0x10db16,_0x685506){var _0x1faac2={'raw':![],'where':{}};var _0xaa25c={};var _0x5773dc={'count':0x0,'rows':[]};return db[_0x9e3a('0x3f')][_0x9e3a('0x65')]({'where':{'id':_0x25893a[_0x9e3a('0x58')]['id']}})['then'](handleEntityNotFound(_0x10db16,null))[_0x9e3a('0x1e')](function(_0x50e372){if(_0x50e372){_0xaa25c['model']=_['keys'](db[_0x9e3a('0x6c')][_0x9e3a('0x40')]);_0xaa25c[_0x9e3a('0x46')]=_[_0x9e3a('0x44')](_0x25893a['query']);_0xaa25c[_0x9e3a('0x45')]=_[_0x9e3a('0x48')](_0xaa25c['model'],_0xaa25c['query']);_0x1faac2[_0x9e3a('0x47')]=_['intersection'](_0xaa25c[_0x9e3a('0x43')],qs['fields'](_0x25893a[_0x9e3a('0x46')]['fields']));_0x1faac2[_0x9e3a('0x47')]=_0x1faac2[_0x9e3a('0x47')][_0x9e3a('0x4a')]?_0x1faac2['attributes']:_0xaa25c[_0x9e3a('0x43')];if(!_0x25893a['query']['hasOwnProperty'](_0x9e3a('0x4c'))){_0x1faac2[_0x9e3a('0x4d')]=qs[_0x9e3a('0x4d')](_0x25893a['query'][_0x9e3a('0x4d')]);_0x1faac2['offset']=qs[_0x9e3a('0x2e')](_0x25893a[_0x9e3a('0x46')][_0x9e3a('0x2e')]);}_0x1faac2[_0x9e3a('0x66')]=qs[_0x9e3a('0x4e')](_0x25893a['query'][_0x9e3a('0x4e')]);_0x1faac2[_0x9e3a('0x4f')]=qs['filters'](_[_0x9e3a('0x50')](_0x25893a[_0x9e3a('0x46')],_0xaa25c[_0x9e3a('0x45')]));_0x1faac2['where'][_0x9e3a('0x63')]=_0x50e372['id'];if(_0x25893a[_0x9e3a('0x46')][_0x9e3a('0x51')]){_0x1faac2[_0x9e3a('0x4f')]=_[_0x9e3a('0x52')](_0x1faac2[_0x9e3a('0x4f')],{'$or':_[_0x9e3a('0x3e')](_0x1faac2[_0x9e3a('0x47')],function(_0xbe53a8){var _0x4b4c2d={};_0x4b4c2d[_0xbe53a8]={'$like':'%'+_0x25893a[_0x9e3a('0x46')]['filter']+'%'};return _0x4b4c2d;})});}_0x1faac2=_[_0x9e3a('0x52')]({},_0x1faac2,_0x25893a['options']);return db['CannedAnswer']['count']({'where':_0x1faac2[_0x9e3a('0x4f')]})[_0x9e3a('0x1e')](function(_0x113ba1){_0x5773dc[_0x9e3a('0x2d')]=_0x113ba1;if(_0x25893a['query'][_0x9e3a('0x68')]){_0x1faac2[_0x9e3a('0x55')]=[{'all':!![]}];}return db[_0x9e3a('0x6c')]['findAll'](_0x1faac2);})[_0x9e3a('0x1e')](function(_0x2c2cf0){_0x5773dc[_0x9e3a('0x57')]=_0x2c2cf0;return _0x5773dc;});}})[_0x9e3a('0x1e')](respondWithFilteredResult(_0x10db16,_0x1faac2))[_0x9e3a('0x28')](handleError(_0x10db16,null));};exports[_0x9e3a('0x6e')]=function(_0x2a0287,_0x59a8bc,_0x126b89){return db[_0x9e3a('0x3f')][_0x9e3a('0x59')]({'where':{'id':_0x2a0287[_0x9e3a('0x58')]['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x59a8bc,null))['then'](function(_0x3afb41){if(_0x3afb41){return _0x3afb41[_0x9e3a('0x6e')](_0x2a0287['query'][_0x9e3a('0x6a')]);}})[_0x9e3a('0x1e')](respondWithStatusCode(_0x59a8bc,null))[_0x9e3a('0x28')](handleError(_0x59a8bc,null));};exports[_0x9e3a('0x6f')]=function(_0x51d7ce,_0x31465d,_0xd11996){return db['FaxInteraction'][_0x9e3a('0x59')]({'where':{'id':_0x51d7ce['params']['id']}})['then'](handleEntityNotFound(_0x31465d,null))[_0x9e3a('0x1e')](function(_0x27b1a0){if(_0x27b1a0){return _0x27b1a0[_0x9e3a('0x6f')](_0x51d7ce['body']['ids'],_['omit'](_0x51d7ce[_0x9e3a('0x5b')],[_0x9e3a('0x6a'),'id'])||{});}})[_0x9e3a('0x1e')](respondWithResult(_0x31465d,null))['catch'](handleError(_0x31465d,null));};exports[_0x9e3a('0x70')]=function(_0x139648,_0x2e398d,_0x22b6d9){var _0x545ce6={'raw':![],'where':{}};var _0x147069={};var _0x67daf2={'count':0x0,'rows':[]};return db[_0x9e3a('0x3f')]['findOne']({'where':{'id':_0x139648[_0x9e3a('0x58')]['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x2e398d,null))[_0x9e3a('0x1e')](function(_0x4f1fd5){if(_0x4f1fd5){_0x147069['model']=_[_0x9e3a('0x44')](db[_0x9e3a('0x71')][_0x9e3a('0x40')]);_0x147069[_0x9e3a('0x46')]=_[_0x9e3a('0x44')](_0x139648[_0x9e3a('0x46')]);_0x147069[_0x9e3a('0x45')]=_[_0x9e3a('0x48')](_0x147069['model'],_0x147069[_0x9e3a('0x46')]);_0x545ce6[_0x9e3a('0x47')]=_[_0x9e3a('0x48')](_0x147069[_0x9e3a('0x43')],qs[_0x9e3a('0x49')](_0x139648['query'][_0x9e3a('0x49')]));_0x545ce6[_0x9e3a('0x47')]=_0x545ce6[_0x9e3a('0x47')]['length']?_0x545ce6[_0x9e3a('0x47')]:_0x147069[_0x9e3a('0x43')];if(!_0x139648[_0x9e3a('0x46')][_0x9e3a('0x4b')](_0x9e3a('0x4c'))){_0x545ce6[_0x9e3a('0x4d')]=qs['limit'](_0x139648[_0x9e3a('0x46')][_0x9e3a('0x4d')]);_0x545ce6[_0x9e3a('0x2e')]=qs[_0x9e3a('0x2e')](_0x139648[_0x9e3a('0x46')]['offset']);}_0x545ce6[_0x9e3a('0x66')]=qs[_0x9e3a('0x4e')](_0x139648[_0x9e3a('0x46')][_0x9e3a('0x4e')]);_0x545ce6['where']=qs[_0x9e3a('0x45')](_['pick'](_0x139648[_0x9e3a('0x46')],_0x147069[_0x9e3a('0x45')]));_0x545ce6['where'][_0x9e3a('0x63')]=_0x4f1fd5['id'];if(_0x139648['query'][_0x9e3a('0x51')]){_0x545ce6[_0x9e3a('0x4f')]=_[_0x9e3a('0x52')](_0x545ce6[_0x9e3a('0x4f')],{'$or':_[_0x9e3a('0x3e')](_0x545ce6[_0x9e3a('0x47')],function(_0x21089d){var _0x2cf400={};_0x2cf400[_0x21089d]={'$like':'%'+_0x139648[_0x9e3a('0x46')][_0x9e3a('0x51')]+'%'};return _0x2cf400;})});}_0x545ce6=_[_0x9e3a('0x52')]({},_0x545ce6,_0x139648['options']);return db[_0x9e3a('0x71')][_0x9e3a('0x2d')]({'where':_0x545ce6['where']})[_0x9e3a('0x1e')](function(_0x566cad){_0x67daf2[_0x9e3a('0x2d')]=_0x566cad;if(_0x139648['query'][_0x9e3a('0x68')]){_0x545ce6[_0x9e3a('0x55')]=[{'model':db[_0x9e3a('0x72')],'as':_0x9e3a('0x73'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9e3a('0x3a'),_0x9e3a('0x74'),_0x9e3a('0x75')],'required':![]},{'model':db[_0x9e3a('0x76')],'as':_0x9e3a('0x77'),'attributes':['id',_0x9e3a('0x3a'),_0x9e3a('0x78')],'where':_0x139648[_0x9e3a('0x46')][_0x9e3a('0x79')]?{'id':_0x139648[_0x9e3a('0x46')]['tag']}:undefined,'required':_0x139648[_0x9e3a('0x46')][_0x9e3a('0x79')]?!![]:![]}];}return db[_0x9e3a('0x71')]['findAll'](_0x545ce6);})[_0x9e3a('0x1e')](function(_0x11ec37){_0x67daf2[_0x9e3a('0x57')]=_0x11ec37;return _0x67daf2;});}})[_0x9e3a('0x1e')](respondWithFilteredResult(_0x2e398d,_0x545ce6))[_0x9e3a('0x28')](handleError(_0x2e398d,null));};exports[_0x9e3a('0x7a')]=function(_0x3ac338,_0x374ba3,_0x44c481){return db['FaxAccount'][_0x9e3a('0x65')]({'where':{'id':_0x3ac338[_0x9e3a('0x58')]['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x374ba3,null))[_0x9e3a('0x1e')](function(_0x3e3681){if(_0x3e3681){return db[_0x9e3a('0x7b')][_0x9e3a('0x7c')](function(_0x3b750f){return db['FaxApplication'][_0x9e3a('0x35')]({'where':{'FaxAccountId':_0x3ac338[_0x9e3a('0x58')]['id']},'transaction':_0x3b750f})['then'](function(_0x4bdefd){var _0x547231=_[_0x9e3a('0x3e')](_0x3ac338[_0x9e3a('0x5b')],function(_0x22add0){_0x22add0['FaxAccountId']=_0x3ac338[_0x9e3a('0x58')]['id'];return _0x22add0;});return db[_0x9e3a('0x7d')]['bulkCreate'](_0x547231,{'transaction':_0x3b750f});});})[_0x9e3a('0x1e')](function(){return db[_0x9e3a('0x7d')][_0x9e3a('0x7e')]({'where':{'FaxAccountId':_0x3ac338[_0x9e3a('0x58')]['id']},'order':'priority'});});}})[_0x9e3a('0x1e')](respondWithResult(_0x374ba3,null))[_0x9e3a('0x28')](handleError(_0x374ba3,null));};exports[_0x9e3a('0x7f')]=function(_0x32b550,_0xf00465,_0xfbed65){var _0x3ae351={};var _0x310503={};var _0x2f7de0;var _0x470b6c;return db[_0x9e3a('0x3f')][_0x9e3a('0x65')]({'where':{'id':_0x32b550[_0x9e3a('0x58')]['id']}})['then'](handleEntityNotFound(_0xf00465,null))[_0x9e3a('0x1e')](function(_0x539a20){if(_0x539a20){_0x2f7de0=_0x539a20;_0x310503['model']=_['keys'](db[_0x9e3a('0x7d')]['rawAttributes']);_0x310503[_0x9e3a('0x46')]=_[_0x9e3a('0x44')](_0x32b550['query']);_0x310503['filters']=_[_0x9e3a('0x48')](_0x310503[_0x9e3a('0x43')],_0x310503[_0x9e3a('0x46')]);_0x3ae351[_0x9e3a('0x47')]=_[_0x9e3a('0x48')](_0x310503[_0x9e3a('0x43')],qs[_0x9e3a('0x49')](_0x32b550[_0x9e3a('0x46')][_0x9e3a('0x49')]));_0x3ae351['attributes']=_0x3ae351[_0x9e3a('0x47')]['length']?_0x3ae351[_0x9e3a('0x47')]:_0x310503[_0x9e3a('0x43')];_0x3ae351[_0x9e3a('0x66')]=qs['sort'](_0x32b550[_0x9e3a('0x46')][_0x9e3a('0x4e')]);_0x3ae351[_0x9e3a('0x4f')]=qs[_0x9e3a('0x45')](_[_0x9e3a('0x50')](_0x32b550[_0x9e3a('0x46')],_0x310503[_0x9e3a('0x45')]));if(_0x32b550[_0x9e3a('0x46')][_0x9e3a('0x51')]){_0x3ae351[_0x9e3a('0x4f')]=_[_0x9e3a('0x52')](_0x3ae351[_0x9e3a('0x4f')],{'$or':_[_0x9e3a('0x3e')](_0x3ae351[_0x9e3a('0x47')],function(_0x31e49f){var _0x5507b5={};_0x5507b5[_0x31e49f]={'$like':'%'+_0x32b550[_0x9e3a('0x46')][_0x9e3a('0x51')]+'%'};return _0x5507b5;})});}_0x3ae351=_[_0x9e3a('0x52')]({},_0x3ae351,_0x32b550['options']);return _0x2f7de0['getApplications'](_0x3ae351);}})[_0x9e3a('0x1e')](function(_0x337891){if(_0x337891){_0x470b6c=_0x337891['length'];if(!_0x32b550[_0x9e3a('0x46')][_0x9e3a('0x4b')](_0x9e3a('0x4c'))){_0x3ae351[_0x9e3a('0x4d')]=qs['limit'](_0x32b550[_0x9e3a('0x46')][_0x9e3a('0x4d')]);_0x3ae351['offset']=qs['offset'](_0x32b550[_0x9e3a('0x46')][_0x9e3a('0x2e')]);}return _0x2f7de0[_0x9e3a('0x7f')](_0x3ae351);}})[_0x9e3a('0x1e')](function(_0x1d63c7){if(_0x1d63c7){return _0x1d63c7?{'count':_0x470b6c,'rows':_0x1d63c7}:null;}})['then'](respondWithResult(_0xf00465,null))[_0x9e3a('0x28')](handleError(_0xf00465,null));};function Extension(_0xef851,_0x1dd176,_0x3a2eaa,_0x1391f3){this[_0x9e3a('0x80')]=_0x9e3a('0x81');this['exten']=_0xef851['localstationid'];this[_0x9e3a('0x82')]=_0x1391f3;this[_0x9e3a('0x42')]=_0x9e3a('0x83');this['description']=_0x9e3a('0x84');this[_0x9e3a('0x63')]=_0xef851['id'];this[_0x9e3a('0x85')]=_0x1dd176;this[_0x9e3a('0x86')]=_0x3a2eaa;}function createExtensionsReciveFax(_0x38f92c){var _0xfc3d5a=0x1;var _0x4198eb=[];_0x4198eb[_0x9e3a('0x87')](new Extension(_0x38f92c,_0xfc3d5a,'','Answer'));_0xfc3d5a+=0x1;_0x4198eb['push'](new Extension(_0x38f92c,_0xfc3d5a,_0x9e3a('0x88'),'Set'));_0xfc3d5a+=0x1;for(var _0x3d457d in _0x38f92c){if(_0x38f92c[_0x9e3a('0x4b')](_0x3d457d)&&(_0x3d457d===_0x9e3a('0x89')||_0x3d457d===_0x9e3a('0x8a')||_0x3d457d===_0x9e3a('0x8b')||_0x3d457d===_0x9e3a('0x8c')||_0x3d457d===_0x9e3a('0x8d')||_0x3d457d===_0x9e3a('0x8e')||_0x3d457d===_0x9e3a('0x8f')||_0x3d457d===_0x9e3a('0x90')||_0x3d457d===_0x9e3a('0x91'))){_0x4198eb[_0x9e3a('0x87')](new Extension(_0x38f92c,_0xfc3d5a,'FAXOPT('+_0x3d457d+')='+_0x38f92c[_0x3d457d],_0x9e3a('0x92')));_0xfc3d5a+=0x1;}}_0x4198eb[_0x9e3a('0x87')](new Extension(_0x38f92c,_0xfc3d5a,'6',_0x9e3a('0x93')));_0xfc3d5a+=0x1;_0x4198eb[_0x9e3a('0x87')](new Extension(_0x38f92c,_0xfc3d5a,'/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',_0x9e3a('0x94')));_0xfc3d5a=0x0;return _0x4198eb;}exports[_0x9e3a('0x95')]=function(_0x401ef7,_0x38fe55,_0x54291e){var _0x4d7437;return db[_0x9e3a('0x7b')]['transaction'](function(_0x42ff8f){return db['FaxAccount'][_0x9e3a('0x5a')](_0x401ef7['body'],{'transaction':_0x42ff8f})['then'](function(_0x253c68){_0x4d7437=_0x253c68[_0x9e3a('0x36')]({'plain':!![]});return db[_0x9e3a('0x96')][_0x9e3a('0x97')](createExtensionsReciveFax(_0x4d7437),{'transaction':_0x42ff8f});});})['then'](function(){return _0x4d7437;})[_0x9e3a('0x1e')](respondWithResult(_0x38fe55,null))['catch'](handleError(_0x38fe55,null));};exports[_0x9e3a('0x98')]=function(_0x31c221,_0x20f842,_0x5dabc2){var _0x291113;return db[_0x9e3a('0x7b')][_0x9e3a('0x7c')](function(_0x411a2b){return db[_0x9e3a('0x3f')][_0x9e3a('0x34')](_0x31c221['body'],{'where':{'id':_0x31c221[_0x9e3a('0x5b')]['id']},'transaction':_0x411a2b})[_0x9e3a('0x1e')](function(_0x1a9ab7){return db[_0x9e3a('0x96')][_0x9e3a('0x35')]({'where':{'FaxAccountId':_0x31c221[_0x9e3a('0x5b')]['id']},'transaction':_0x411a2b})[_0x9e3a('0x1e')](function(_0x2059ac){return db[_0x9e3a('0x96')][_0x9e3a('0x97')](createExtensionsReciveFax(_[_0x9e3a('0x99')](_0x31c221['body'],[_0x9e3a('0x9a'),_0x9e3a('0x9b'),_0x9e3a('0x9c'),_0x9e3a('0x9d'),_0x9e3a('0x9e'),_0x9e3a('0x9f')])),{'transaction':_0x411a2b});});});})[_0x9e3a('0x1e')](function(){return db['FaxAccount'][_0x9e3a('0xa0')](_0x31c221['body']['id']);})['then'](respondWithResult(_0x20f842,null))[_0x9e3a('0x28')](handleError(_0x20f842,null));};exports[_0x9e3a('0xa1')]=function(_0x44cb6d,_0x193bd8,_0xd597c6){var _0x30fc73={'raw':!![],'where':{}};var _0x19bb0d={};var _0x4d3b7e={'count':0x0,'rows':[]};return db[_0x9e3a('0x3f')][_0x9e3a('0x65')]({'where':{'id':_0x44cb6d[_0x9e3a('0x58')]['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x193bd8,null))[_0x9e3a('0x1e')](function(_0x3afed2){if(_0x3afed2){_0x19bb0d[_0x9e3a('0x43')]=_['keys'](db[_0x9e3a('0xa2')][_0x9e3a('0x40')]);_0x19bb0d['query']=_[_0x9e3a('0x44')](_0x44cb6d[_0x9e3a('0x46')]);_0x19bb0d[_0x9e3a('0x45')]=_[_0x9e3a('0x48')](_0x19bb0d[_0x9e3a('0x43')],_0x19bb0d[_0x9e3a('0x46')]);_0x30fc73[_0x9e3a('0x47')]=_[_0x9e3a('0x48')](_0x19bb0d['model'],qs['fields'](_0x44cb6d[_0x9e3a('0x46')][_0x9e3a('0x49')]));_0x30fc73[_0x9e3a('0x47')]=_0x30fc73[_0x9e3a('0x47')][_0x9e3a('0x4a')]?_0x30fc73['attributes']:_0x19bb0d['model'];if(!_0x44cb6d[_0x9e3a('0x46')][_0x9e3a('0x4b')](_0x9e3a('0x4c'))){_0x30fc73['limit']=qs[_0x9e3a('0x4d')](_0x44cb6d[_0x9e3a('0x46')][_0x9e3a('0x4d')]);_0x30fc73[_0x9e3a('0x2e')]=qs[_0x9e3a('0x2e')](_0x44cb6d[_0x9e3a('0x46')][_0x9e3a('0x2e')]);}_0x30fc73[_0x9e3a('0x66')]=qs['sort'](_0x44cb6d[_0x9e3a('0x46')][_0x9e3a('0x4e')]);_0x30fc73[_0x9e3a('0x4f')]=qs[_0x9e3a('0x45')](_['pick'](_0x44cb6d['query'],_0x19bb0d[_0x9e3a('0x45')]));_0x30fc73[_0x9e3a('0x4f')][_0x9e3a('0x63')]=_0x3afed2['id'];if(_0x44cb6d[_0x9e3a('0x46')][_0x9e3a('0x51')]){_0x30fc73[_0x9e3a('0x4f')]=_[_0x9e3a('0x52')](_0x30fc73[_0x9e3a('0x4f')],{'$or':_['map'](_0x30fc73['attributes'],function(_0x5f3729){var _0x1f8eed={};_0x1f8eed[_0x5f3729]={'$like':'%'+_0x44cb6d[_0x9e3a('0x46')][_0x9e3a('0x51')]+'%'};return _0x1f8eed;})});}if(_0x44cb6d['query'][_0x9e3a('0xa3')]){var _0x26d130=_0x44cb6d['query'][_0x9e3a('0xa3')]['split'](',');var _0x4017af={};_0x4017af[_0x26d130[0x0]]={'$gte':moment(_0x26d130[0x1])[_0x9e3a('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30fc73[_0x9e3a('0x4f')]=_['merge'](_0x30fc73['where'],_0x4017af);}_0x30fc73=_[_0x9e3a('0x52')]({},_0x30fc73,_0x44cb6d['options']);return db[_0x9e3a('0xa2')][_0x9e3a('0x2d')]({'where':_0x30fc73[_0x9e3a('0x4f')]})[_0x9e3a('0x1e')](function(_0x26fdf1){_0x4d3b7e['count']=_0x26fdf1;if(_0x44cb6d[_0x9e3a('0x46')]['includeAll']){_0x30fc73['include']=[{'all':!![]}];}return db[_0x9e3a('0xa2')]['findAll'](_0x30fc73);})[_0x9e3a('0x1e')](function(_0x143428){_0x4d3b7e[_0x9e3a('0x57')]=_0x143428;return _0x4d3b7e;});}})['then'](respondWithFilteredResult(_0x193bd8,_0x30fc73))[_0x9e3a('0x28')](handleError(_0x193bd8,null));};exports[_0x9e3a('0xa5')]=function(_0xf2b7a4,_0x14b2b5,_0x50bbee){var _0x4ccc6b,_0x127dd5={},_0x5a4a4a;if(_0xf2b7a4[_0x9e3a('0x5b')]['to']){_0x5a4a4a=_0xf2b7a4[_0x9e3a('0x5b')]['to'][0x0];}return db[_0x9e3a('0x3f')][_0x9e3a('0x59')]({'where':{'id':_0xf2b7a4['params']['id']},'include':[{'model':db[_0x9e3a('0xa6')],'as':'List','include':[{'model':db[_0x9e3a('0x72')],'as':_0x9e3a('0xa7'),'where':{'fax':_0x5a4a4a},'limit':0x1,'order':[[_0x9e3a('0x9d'),_0x9e3a('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x14b2b5,null))[_0x9e3a('0x1e')](function(_0x53a574){_0x4ccc6b=_0x53a574;if(_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')]&&_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][_0x9e3a('0x4a')]){for(var _0x277cbc=0x0;_0x277cbc<_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][_0x9e3a('0x4a')];_0x277cbc+=0x1){_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][_0x277cbc]={'filename':_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][_0x277cbc]['name'],'id':_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][_0x277cbc]['id'],'path':path[_0x9e3a('0xaa')](config[_0x9e3a('0xab')],_0x9e3a('0xac'),_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][_0x277cbc][_0x9e3a('0xad')])};}}return respondWithRpcPromise(_0x9e3a('0xae'),_0x9e3a('0xae'),{'FaxAccountId':_[_0x9e3a('0xaf')](_0xf2b7a4['params']['id'])?undefined:_0xf2b7a4['params']['id'],'path':_[_0x9e3a('0xaf')](_0xf2b7a4[_0x9e3a('0x5b')]['attachments'][0x0][_0x9e3a('0xb0')])?undefined:_0xf2b7a4[_0x9e3a('0x5b')]['attachments'][0x0][_0x9e3a('0xb0')],'fax':_[_0x9e3a('0xaf')](_0xf2b7a4[_0x9e3a('0x5b')]['to'][0x0])?undefined:_0xf2b7a4[_0x9e3a('0x5b')]['to'][0x0]},client9002);})[_0x9e3a('0x1e')](function(){if(_0x4ccc6b){if(_[_0x9e3a('0xaf')](_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xb1')])){_0xf2b7a4['body']['from']=util[_0x9e3a('0xa4')](_0x9e3a('0xb2'),_0x4ccc6b[_0x9e3a('0x3a')],_0x4ccc6b[_0x9e3a('0xb3')]);}if(_0x4ccc6b['List']){if(_0x4ccc6b['List'][_0x9e3a('0xa7')][_0x9e3a('0x4a')]){return _0x4ccc6b['List'][_0x9e3a('0xa7')][0x0];}else{return db[_0x9e3a('0x72')][_0x9e3a('0x5a')](_[_0x9e3a('0x18')](_0xf2b7a4[_0x9e3a('0x5b')],{'firstName':_0xf2b7a4['body']['to'][0x0],'phone':_0xf2b7a4[_0x9e3a('0x5b')]['to'][0x0],'fax':_0xf2b7a4[_0x9e3a('0x5b')]['to'][0x0],'ListId':_0x4ccc6b['ListId']}));}}else{throw new Error(_0x9e3a('0xb4'));}}else{throw new Error(_0x9e3a('0xb5'));}})[_0x9e3a('0x1e')](function(_0x2fd4d0){if(_0x2fd4d0){return db[_0x9e3a('0x71')][_0x9e3a('0x59')]({'where':{'ContactId':_0x2fd4d0['id'],'closed':![],'FaxAccountId':_0x4ccc6b['id']}})[_0x9e3a('0x1e')](function(_0x2c1fbc){if(_0x2c1fbc){return[_0x2c1fbc,![]];}return db[_0x9e3a('0x71')][_0x9e3a('0x5a')]({'UserId':_0xf2b7a4[_0x9e3a('0x5c')]['id'],'ContactId':_0x2fd4d0['id'],'FaxAccountId':_0x4ccc6b['id'],'fax':_0xf2b7a4[_0x9e3a('0x5b')]['to'][0x0],'firstMsgDirection':_0x9e3a('0xb6'),'Messages':[_[_0x9e3a('0x52')](_0xf2b7a4[_0x9e3a('0x5b')],{'read':![],'body':_0xf2b7a4['body'][_0x9e3a('0xa9')][0x0][_0x9e3a('0xb7')],'FaxAccountId':_0x4ccc6b['id'],'UserId':_0xf2b7a4[_0x9e3a('0x5c')]['id'],'ContactId':_0x2fd4d0['id'],'AttachmentId':_0xf2b7a4[_0x9e3a('0x5b')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x9e3a('0xb8')}]})['then'](function(_0x41ce08){return[_0x41ce08,!![]];});});}else{throw new Error(_0x9e3a('0xb9'));}})[_0x9e3a('0xba')](function(_0x2483c5,_0x128f17){if(_0x128f17){return _0x2483c5;}return db[_0x9e3a('0xa2')][_0x9e3a('0x5a')]({'direction':_0x9e3a('0xb6'),'read':![],'body':_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][0x0][_0x9e3a('0xb7')],'FaxAccountId':_0x4ccc6b['id'],'FaxInteractionId':_0x2483c5['id'],'UserId':_0xf2b7a4[_0x9e3a('0x5c')]['id'],'ContactId':_0x2483c5[_0x9e3a('0xbb')],'AttachmentId':_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][0x0]['id']})['then'](function(_0x398b04){_0x2483c5['dataValues']['Messages']=[];_0x2483c5['dataValues'][_0x9e3a('0xb8')][_0x9e3a('0x87')](_0x398b04['dataValues']);return _0x2483c5;});})[_0x9e3a('0x1e')](function(_0x147e34){respondWithRpcPromise(_0x9e3a('0xbc'),_0x9e3a('0xbc'),{'FaxAccountId':_[_0x9e3a('0xaf')](_0xf2b7a4['params']['id'])?undefined:_0xf2b7a4[_0x9e3a('0x58')]['id'],'path':_['isNil'](_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][0x0]['path'])?undefined:_0xf2b7a4[_0x9e3a('0x5b')][_0x9e3a('0xa9')][0x0][_0x9e3a('0xb0')],'fax':_['isNil'](_0xf2b7a4[_0x9e3a('0x5b')]['to'][0x0])?undefined:_0xf2b7a4[_0x9e3a('0x5b')]['to'][0x0],'AttachmentId':_0xf2b7a4['body']['attachments'][0x0]['id']},client9002)['then'](function(_0x17a94b){logger[_0x9e3a('0x26')](_0x9e3a('0xbd'),_0x17a94b);})['catch'](function(_0x556982){logger[_0x9e3a('0x26')](_0x9e3a('0xbd'),_0x556982);});return _0x147e34;})['then'](respondWithResult(_0x14b2b5,null))[_0x9e3a('0x28')](handleError(_0x14b2b5,null));};exports[_0x9e3a('0xbe')]=function(_0x2120b2,_0x102cb5,_0x51b84b){return db[_0x9e3a('0x3f')][_0x9e3a('0x59')]({'where':{'id':_0x2120b2['params']['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x102cb5,null))['then'](function(_0x2cf27d){if(_0x2cf27d){return _0x2cf27d[_0x9e3a('0xbe')](_0x2120b2['body']['ids'],_[_0x9e3a('0x99')](_0x2120b2[_0x9e3a('0x5b')],[_0x9e3a('0x6a'),'id'])||{})[_0x9e3a('0xba')](function(_0x3b742e){for(var _0x44e6dd=0x0;_0x44e6dd<_0x2120b2['body'][_0x9e3a('0x6a')][_0x9e3a('0x4a')];_0x44e6dd+=0x1){socket[_0x9e3a('0xbf')](_0x9e3a('0xc0'),{'UserId':_0x2120b2[_0x9e3a('0x5b')][_0x9e3a('0x6a')][_0x44e6dd],'FaxAccountId':_0x2120b2[_0x9e3a('0x58')]['id']});}return _0x3b742e;});}})[_0x9e3a('0x1e')](respondWithResult(_0x102cb5,null))[_0x9e3a('0x28')](handleError(_0x102cb5,null));};exports[_0x9e3a('0xc1')]=function(_0x43cb8f,_0x15ebf4,_0x3df322){return db['FaxAccount']['find']({'where':{'id':_0x43cb8f['params']['id']}})[_0x9e3a('0x1e')](handleEntityNotFound(_0x15ebf4,null))[_0x9e3a('0x1e')](function(_0x58a9f0){if(_0x58a9f0){return _0x58a9f0[_0x9e3a('0xc1')](_0x43cb8f[_0x9e3a('0x46')][_0x9e3a('0x6a')])[_0x9e3a('0x1e')](function(){if(_['isArray'](_0x43cb8f[_0x9e3a('0x46')][_0x9e3a('0x6a')])){for(var _0x30664f=0x0;_0x30664f<_0x43cb8f[_0x9e3a('0x46')]['ids'][_0x9e3a('0x4a')];_0x30664f+=0x1){socket[_0x9e3a('0xbf')](_0x9e3a('0xc2'),{'UserId':Number(_0x43cb8f[_0x9e3a('0x46')][_0x9e3a('0x6a')][_0x30664f]),'FaxAccountId':Number(_0x43cb8f[_0x9e3a('0x58')]['id'])});}}else{socket[_0x9e3a('0xbf')](_0x9e3a('0xc2'),{'UserId':Number(_0x43cb8f[_0x9e3a('0x46')]['ids']),'FaxAccountId':Number(_0x43cb8f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x15ebf4,null))[_0x9e3a('0x28')](handleError(_0x15ebf4,null));};exports[_0x9e3a('0xc3')]=function(_0x5338e0,_0x130225,_0x2ae9b0){var _0x376769={};var _0x339e66={};var _0x173bd2;var _0x2a7a29;return db[_0x9e3a('0x3f')]['findOne']({'where':{'id':_0x5338e0[_0x9e3a('0x58')]['id']}})['then'](handleEntityNotFound(_0x130225,null))[_0x9e3a('0x1e')](function(_0x5140d9){if(_0x5140d9){_0x173bd2=_0x5140d9;_0x339e66['model']=_[_0x9e3a('0x44')](db[_0x9e3a('0xc4')][_0x9e3a('0x40')]);_0x339e66[_0x9e3a('0x46')]=_[_0x9e3a('0x44')](_0x5338e0[_0x9e3a('0x46')]);_0x339e66['filters']=_['intersection'](_0x339e66[_0x9e3a('0x43')],_0x339e66[_0x9e3a('0x46')]);_0x376769['attributes']=_[_0x9e3a('0x48')](_0x339e66[_0x9e3a('0x43')],qs[_0x9e3a('0x49')](_0x5338e0[_0x9e3a('0x46')][_0x9e3a('0x49')]));_0x376769['attributes']=_0x376769[_0x9e3a('0x47')][_0x9e3a('0x4a')]?_0x376769[_0x9e3a('0x47')]:_0x339e66[_0x9e3a('0x43')];_0x376769[_0x9e3a('0x66')]=qs[_0x9e3a('0x4e')](_0x5338e0[_0x9e3a('0x46')][_0x9e3a('0x4e')]);_0x376769[_0x9e3a('0x4f')]=qs[_0x9e3a('0x45')](_[_0x9e3a('0x50')](_0x5338e0[_0x9e3a('0x46')],_0x339e66['filters']));if(_0x5338e0[_0x9e3a('0x46')][_0x9e3a('0x51')]){_0x376769[_0x9e3a('0x4f')]=_[_0x9e3a('0x52')](_0x376769[_0x9e3a('0x4f')],{'$or':_[_0x9e3a('0x3e')](_0x376769[_0x9e3a('0x47')],function(_0x12f595){var _0x5408ee={};_0x5408ee[_0x12f595]={'$like':'%'+_0x5338e0[_0x9e3a('0x46')][_0x9e3a('0x51')]+'%'};return _0x5408ee;})});}_0x376769=_[_0x9e3a('0x52')]({},_0x376769,_0x5338e0[_0x9e3a('0x54')]);return _0x173bd2[_0x9e3a('0xc3')](_0x376769);}})[_0x9e3a('0x1e')](function(_0x1c074c){if(_0x1c074c){_0x2a7a29=_0x1c074c[_0x9e3a('0x4a')];if(!_0x5338e0[_0x9e3a('0x46')][_0x9e3a('0x4b')]('nolimit')){_0x376769['limit']=qs['limit'](_0x5338e0[_0x9e3a('0x46')]['limit']);_0x376769[_0x9e3a('0x2e')]=qs[_0x9e3a('0x2e')](_0x5338e0[_0x9e3a('0x46')][_0x9e3a('0x2e')]);}return _0x173bd2[_0x9e3a('0xc3')](_0x376769);}})['then'](function(_0x244e98){if(_0x244e98){return _0x244e98?{'count':_0x2a7a29,'rows':_0x244e98}:null;}})[_0x9e3a('0x1e')](respondWithResult(_0x130225,null))[_0x9e3a('0x28')](handleError(_0x130225,null));}; \ No newline at end of file +var _0x02c7=['userFaxAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','set','reject','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','Pause','keys','includeAll','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','limit','removeDispositions','CannedAnswer','getAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','Answer','Set','localstationid','faxdetect','headerinfo','maxrate','minrate','push','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray'];(function(_0xeb9dd6,_0x268863){var _0x152f8f=function(_0xd969c9){while(--_0xd969c9){_0xeb9dd6['push'](_0xeb9dd6['shift']());}};_0x152f8f(++_0x268863);}(_0x02c7,0x176));var _0x702c=function(_0x127e0e,_0x28edbc){_0x127e0e=_0x127e0e-0x0;var _0x37e9b1=_0x02c7[_0x127e0e];return _0x37e9b1;};'use strict';var pdf=require(_0x702c('0x0'));var emlformat=require(_0x702c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x702c('0x2'));var jsonpatch=require(_0x702c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x702c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x702c('0x5'));var sox=require(_0x702c('0x6'));var csv=require('to-csv');var ejs=require(_0x702c('0x7'));var fs=require('fs');var fs_extra=require(_0x702c('0x8'));var _=require('lodash');var squel=require(_0x702c('0x9'));var crypto=require(_0x702c('0xa'));var jsforce=require(_0x702c('0xb'));var deskjs=require(_0x702c('0xc'));var toCsv=require(_0x702c('0xd'));var querystring=require(_0x702c('0xe'));var Papa=require(_0x702c('0xf'));var Redis=require(_0x702c('0x10'));var authService=require(_0x702c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x702c('0x12'));var hardwareService=require(_0x702c('0x13'));var logger=require(_0x702c('0x14'))(_0x702c('0x15'));var utils=require('../../config/utils');var config=require(_0x702c('0x16'));var licenseUtil=require(_0x702c('0x17'));var db=require('../../mysqldb')['db'];config[_0x702c('0x18')]=_['defaults'](config[_0x702c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x702c('0x19'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x702c('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x702c('0x1b')][_0x702c('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x702c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xd4a5f8,_0x5879a6,_0x4a9478,_0x27ce63){return new BPromise(function(_0x3901ba,_0x63e2f0){var _0x421b83=_0x27ce63||client;return _0x421b83[_0x702c('0x1d')](_0xd4a5f8,_0x4a9478)[_0x702c('0x1e')](function(_0x567100){logger[_0x702c('0x1f')](_0x702c('0x20'),_0x5879a6,_0x702c('0x21'));logger['debug'](_0x702c('0x22'),_0x5879a6,_0x702c('0x21'),JSON[_0x702c('0x23')](_0x567100));if(_0x567100[_0x702c('0x24')]){if(_0x567100[_0x702c('0x24')][_0x702c('0x25')]===0x1f4){logger[_0x702c('0x24')](_0x702c('0x20'),_0x5879a6,_0x567100['error'][_0x702c('0x26')]);return _0x63e2f0(_0x567100[_0x702c('0x24')]['message']);}logger['error'](_0x702c('0x20'),_0x5879a6,_0x567100[_0x702c('0x24')][_0x702c('0x26')]);return _0x3901ba(_0x567100[_0x702c('0x24')][_0x702c('0x26')]);}else{logger[_0x702c('0x1f')](_0x702c('0x20'),_0x5879a6,_0x702c('0x21'));_0x3901ba(_0x567100[_0x702c('0x27')][_0x702c('0x26')]);}})['catch'](function(_0x3213de){logger[_0x702c('0x24')](_0x702c('0x20'),_0x5879a6,_0x3213de);_0x63e2f0(_0x3213de);});});}function respondWithStatusCode(_0x33f661,_0x150368){_0x150368=_0x150368||0xcc;return function(_0x2cf5ab){if(_0x2cf5ab){return _0x33f661[_0x702c('0x28')](_0x150368);}return _0x33f661['status'](_0x150368)[_0x702c('0x29')]();};}function respondWithResult(_0x5d9615,_0xf121b7){_0xf121b7=_0xf121b7||0xc8;return function(_0x36da53){if(_0x36da53){return _0x5d9615[_0x702c('0x2a')](_0xf121b7)[_0x702c('0x2b')](_0x36da53);}};}function respondWithFilteredResult(_0x255e9e,_0x19189c){return function(_0x54fcad){if(_0x54fcad){var _0x30c0b9=_0x54fcad[_0x702c('0x2c')],_0x2dd605=_0x19189c['offset'],_0x4b07c3=_0x19189c[_0x702c('0x2d')]+_0x19189c['limit'],_0x6c6991;if(_0x4b07c3>=_0x30c0b9){_0x4b07c3=_0x30c0b9;_0x6c6991=0xc8;}else{_0x6c6991=0xce;}_0x255e9e[_0x702c('0x2a')](_0x6c6991);return _0x255e9e[_0x702c('0x2e')]('Content-Range',_0x2dd605+'-'+_0x4b07c3+'/'+_0x30c0b9)['json'](_0x54fcad);}return null;};}function patchUpdates(_0x5c6ff1){return function(_0x43e6e9){try{jsonpatch['apply'](_0x43e6e9,_0x5c6ff1,!![]);}catch(_0x1189cf){return BPromise[_0x702c('0x2f')](_0x1189cf);}return _0x43e6e9['save']();};}function saveUpdates(_0xb66e5c,_0x415b88){return function(_0x50989e){if(_0x50989e){return _0x50989e[_0x702c('0x30')](_0xb66e5c)[_0x702c('0x1e')](function(_0x301ebb){return _0x301ebb;});}return null;};}function removeEntity(_0x327eee,_0x209458){return function(_0x401276){if(_0x401276){return _0x401276[_0x702c('0x31')]()[_0x702c('0x1e')](function(){var _0x3b3162=_0x401276[_0x702c('0x32')]({'plain':!![]});var _0x3dd441=_0x702c('0x33');return db[_0x702c('0x34')][_0x702c('0x31')]({'where':{'type':_0x3dd441,'resourceId':_0x3b3162['id']}})[_0x702c('0x1e')](function(){return _0x401276;});})['then'](function(){_0x327eee[_0x702c('0x2a')](0xcc)[_0x702c('0x29')]();});}};}function handleEntityNotFound(_0x42c183,_0x3ba4cf){return function(_0x5ddbbd){if(!_0x5ddbbd){_0x42c183[_0x702c('0x28')](0x194);}return _0x5ddbbd;};}function handleError(_0x2a1455,_0x44f412){_0x44f412=_0x44f412||0x1f4;return function(_0x4611c5){logger[_0x702c('0x24')](_0x4611c5[_0x702c('0x35')]);if(_0x4611c5['name']){delete _0x4611c5[_0x702c('0x36')];}_0x2a1455[_0x702c('0x2a')](_0x44f412)['send'](_0x4611c5);};}exports['index']=function(_0x398617,_0x33bea3){var _0x3acbce={'include':[{'model':db['Pause'],'as':_0x702c('0x37')}]},_0x433d8b={},_0x34c5cb={'count':0x0,'rows':[]};var _0x14e538=_[_0x702c('0x38')](db[_0x702c('0x39')][_0x702c('0x3a')],function(_0x4daf00){return{'name':_0x4daf00[_0x702c('0x3b')],'type':_0x4daf00[_0x702c('0x3c')][_0x702c('0x3d')]};});_0x433d8b[_0x702c('0x3e')]=_[_0x702c('0x38')](_0x14e538,'name');_0x433d8b[_0x702c('0x3f')]=_['keys'](_0x398617[_0x702c('0x3f')]);_0x433d8b[_0x702c('0x40')]=_[_0x702c('0x41')](_0x433d8b[_0x702c('0x3e')],_0x433d8b[_0x702c('0x3f')]);_0x3acbce[_0x702c('0x42')]=_[_0x702c('0x41')](_0x433d8b[_0x702c('0x3e')],qs[_0x702c('0x43')](_0x398617[_0x702c('0x3f')][_0x702c('0x43')]));_0x3acbce['attributes']=_0x3acbce[_0x702c('0x42')][_0x702c('0x44')]?_0x3acbce[_0x702c('0x42')]:_0x433d8b['model'];if(!_0x398617[_0x702c('0x3f')][_0x702c('0x45')](_0x702c('0x46'))){_0x3acbce['limit']=qs['limit'](_0x398617[_0x702c('0x3f')]['limit']);_0x3acbce[_0x702c('0x2d')]=qs['offset'](_0x398617['query']['offset']);}_0x3acbce[_0x702c('0x47')]=qs['sort'](_0x398617[_0x702c('0x3f')][_0x702c('0x48')]);_0x3acbce[_0x702c('0x49')]=qs[_0x702c('0x40')](_[_0x702c('0x4a')](_0x398617[_0x702c('0x3f')],_0x433d8b[_0x702c('0x40')]),_0x14e538);if(_0x398617['query'][_0x702c('0x4b')]){_0x3acbce[_0x702c('0x49')]=_[_0x702c('0x4c')](_0x3acbce[_0x702c('0x49')],{'$or':_['map'](_0x14e538,function(_0x5816f9){if(_0x5816f9[_0x702c('0x3c')]!==_0x702c('0x4d')){var _0x2dce01={};_0x2dce01[_0x5816f9['name']]={'$like':'%'+_0x398617['query'][_0x702c('0x4b')]+'%'};return _0x2dce01;}})});}_0x3acbce=_[_0x702c('0x4c')]({},_0x3acbce,_0x398617[_0x702c('0x4e')]);var _0x47952f={'where':_0x3acbce[_0x702c('0x49')]};return db['FaxAccount'][_0x702c('0x2c')](_0x47952f)[_0x702c('0x1e')](function(_0x203b2d){_0x34c5cb[_0x702c('0x2c')]=_0x203b2d;if(_0x398617['query']['includeAll']){_0x3acbce[_0x702c('0x4f')]=[{'all':!![]}];}return db[_0x702c('0x39')][_0x702c('0x50')](_0x3acbce);})['then'](function(_0x4cebad){_0x34c5cb[_0x702c('0x51')]=_0x4cebad;return _0x34c5cb;})[_0x702c('0x1e')](respondWithFilteredResult(_0x33bea3,_0x3acbce))[_0x702c('0x52')](handleError(_0x33bea3,null));};exports[_0x702c('0x53')]=function(_0x378b52,_0x47c458){var _0x191f39={'raw':![],'where':{'id':_0x378b52[_0x702c('0x54')]['id']},'include':[{'model':db[_0x702c('0x55')],'as':_0x702c('0x37')}]},_0x136187={};_0x136187['model']=_['keys'](db['FaxAccount']['rawAttributes']);_0x136187[_0x702c('0x3f')]=_[_0x702c('0x56')](_0x378b52['query']);_0x136187[_0x702c('0x40')]=_[_0x702c('0x41')](_0x136187[_0x702c('0x3e')],_0x136187['query']);_0x191f39[_0x702c('0x42')]=_[_0x702c('0x41')](_0x136187['model'],qs['fields'](_0x378b52[_0x702c('0x3f')][_0x702c('0x43')]));_0x191f39['attributes']=_0x191f39[_0x702c('0x42')]['length']?_0x191f39[_0x702c('0x42')]:_0x136187['model'];if(_0x378b52[_0x702c('0x3f')][_0x702c('0x57')]){_0x191f39[_0x702c('0x4f')]=[{'all':!![]}];}_0x191f39=_[_0x702c('0x4c')]({},_0x191f39,_0x378b52[_0x702c('0x4e')]);return db[_0x702c('0x39')][_0x702c('0x58')](_0x191f39)['then'](handleEntityNotFound(_0x47c458,null))[_0x702c('0x1e')](respondWithResult(_0x47c458,null))[_0x702c('0x52')](handleError(_0x47c458,null));};exports[_0x702c('0x59')]=function(_0x23b6d8,_0x4e8d03){return db[_0x702c('0x39')][_0x702c('0x59')](_0x23b6d8[_0x702c('0x5a')],{})[_0x702c('0x1e')](function(_0x2a39ba){var _0x6cd72a=_0x23b6d8[_0x702c('0x5b')][_0x702c('0x32')]({'plain':!![]});if(!_0x6cd72a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6cd72a['role']==='user'){var _0x1fea2e=_0x2a39ba['get']({'plain':!![]});var _0x506e4c=_0x702c('0x33');return db[_0x702c('0x5c')][_0x702c('0x58')]({'where':{'name':_0x506e4c,'userProfileId':_0x6cd72a[_0x702c('0x5d')]},'raw':!![]})[_0x702c('0x1e')](function(_0x7490dd){if(_0x7490dd&&_0x7490dd[_0x702c('0x5e')]===0x0){return db[_0x702c('0x34')][_0x702c('0x59')]({'name':_0x1fea2e['name'],'resourceId':_0x1fea2e['id'],'type':_0x7490dd['name'],'sectionId':_0x7490dd['id']},{})[_0x702c('0x1e')](function(){return _0x2a39ba;});}else{return _0x2a39ba;}})[_0x702c('0x52')](function(_0x1adb31){logger[_0x702c('0x24')](_0x702c('0x5f'),_0x1adb31);throw _0x1adb31;});}return _0x2a39ba;})[_0x702c('0x1e')](respondWithResult(_0x4e8d03,0xc9))[_0x702c('0x52')](handleError(_0x4e8d03,null));};exports[_0x702c('0x30')]=function(_0x129485,_0x6b41ae){if(_0x129485[_0x702c('0x5a')]['id']){delete _0x129485[_0x702c('0x5a')]['id'];}return db['FaxAccount'][_0x702c('0x58')]({'where':{'id':_0x129485[_0x702c('0x54')]['id']},'include':[{'model':db[_0x702c('0x55')],'as':_0x702c('0x37')}]})['then'](handleEntityNotFound(_0x6b41ae,null))[_0x702c('0x1e')](saveUpdates(_0x129485[_0x702c('0x5a')],null))['then'](respondWithResult(_0x6b41ae,null))[_0x702c('0x52')](handleError(_0x6b41ae,null));};exports[_0x702c('0x31')]=function(_0x3a8b24,_0x3f59a3){return db[_0x702c('0x39')][_0x702c('0x58')]({'where':{'id':_0x3a8b24[_0x702c('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f59a3,null))['then'](removeEntity(_0x3f59a3,null))[_0x702c('0x52')](handleError(_0x3f59a3,null));};exports[_0x702c('0x60')]=function(_0x269425,_0x24809e){return db[_0x702c('0x39')][_0x702c('0x60')]()[_0x702c('0x1e')](respondWithResult(_0x24809e,null))[_0x702c('0x52')](handleError(_0x24809e,null));};exports[_0x702c('0x61')]=function(_0x75908,_0x31de84,_0x18592a){if(_0x75908[_0x702c('0x5a')]['id']){delete _0x75908[_0x702c('0x5a')]['id'];}return db[_0x702c('0x39')]['find']({'where':{'id':_0x75908['params']['id']}})['then'](handleEntityNotFound(_0x31de84,null))[_0x702c('0x1e')](function(_0x9213d9){if(_0x9213d9){_0x75908[_0x702c('0x5a')][_0x702c('0x62')]=_0x9213d9['id'];return db[_0x702c('0x63')][_0x702c('0x59')](_0x75908[_0x702c('0x5a')]);}})[_0x702c('0x1e')](respondWithResult(_0x31de84,null))['catch'](handleError(_0x31de84,null));};exports['getDispositions']=function(_0x46422a,_0x37e437,_0x5123bb){var _0x4f79bd={'raw':![],'where':{}};var _0x59a0d5={};var _0x55d035={'count':0x0,'rows':[]};return db['FaxAccount'][_0x702c('0x64')]({'where':{'id':_0x46422a[_0x702c('0x54')]['id']}})['then'](handleEntityNotFound(_0x37e437,null))[_0x702c('0x1e')](function(_0x26f16b){if(_0x26f16b){_0x59a0d5[_0x702c('0x3e')]=_[_0x702c('0x56')](db[_0x702c('0x63')][_0x702c('0x3a')]);_0x59a0d5[_0x702c('0x3f')]=_[_0x702c('0x56')](_0x46422a[_0x702c('0x3f')]);_0x59a0d5[_0x702c('0x40')]=_['intersection'](_0x59a0d5['model'],_0x59a0d5['query']);_0x4f79bd[_0x702c('0x42')]=_[_0x702c('0x41')](_0x59a0d5[_0x702c('0x3e')],qs['fields'](_0x46422a[_0x702c('0x3f')]['fields']));_0x4f79bd[_0x702c('0x42')]=_0x4f79bd[_0x702c('0x42')][_0x702c('0x44')]?_0x4f79bd['attributes']:_0x59a0d5[_0x702c('0x3e')];if(!_0x46422a[_0x702c('0x3f')][_0x702c('0x45')](_0x702c('0x46'))){_0x4f79bd['limit']=qs[_0x702c('0x65')](_0x46422a['query']['limit']);_0x4f79bd[_0x702c('0x2d')]=qs[_0x702c('0x2d')](_0x46422a['query'][_0x702c('0x2d')]);}_0x4f79bd[_0x702c('0x47')]=qs[_0x702c('0x48')](_0x46422a[_0x702c('0x3f')][_0x702c('0x48')]);_0x4f79bd[_0x702c('0x49')]=qs['filters'](_['pick'](_0x46422a[_0x702c('0x3f')],_0x59a0d5[_0x702c('0x40')]));_0x4f79bd[_0x702c('0x49')]['FaxAccountId']=_0x26f16b['id'];if(_0x46422a['query'][_0x702c('0x4b')]){_0x4f79bd[_0x702c('0x49')]=_[_0x702c('0x4c')](_0x4f79bd[_0x702c('0x49')],{'$or':_[_0x702c('0x38')](_0x4f79bd[_0x702c('0x42')],function(_0x3685c4){var _0x1bca6b={};_0x1bca6b[_0x3685c4]={'$like':'%'+_0x46422a['query']['filter']+'%'};return _0x1bca6b;})});}_0x4f79bd=_['merge']({},_0x4f79bd,_0x46422a[_0x702c('0x4e')]);return db[_0x702c('0x63')][_0x702c('0x2c')]({'where':_0x4f79bd[_0x702c('0x49')]})[_0x702c('0x1e')](function(_0x2cab75){_0x55d035[_0x702c('0x2c')]=_0x2cab75;if(_0x46422a['query'][_0x702c('0x57')]){_0x4f79bd[_0x702c('0x4f')]=[{'all':!![]}];}return db[_0x702c('0x63')][_0x702c('0x50')](_0x4f79bd);})[_0x702c('0x1e')](function(_0x2c753c){_0x55d035[_0x702c('0x51')]=_0x2c753c;return _0x55d035;});}})[_0x702c('0x1e')](respondWithFilteredResult(_0x37e437,_0x4f79bd))[_0x702c('0x52')](handleError(_0x37e437,null));};exports[_0x702c('0x66')]=function(_0x548186,_0xa5c90b,_0x373d3f){return db[_0x702c('0x39')]['find']({'where':{'id':_0x548186[_0x702c('0x54')]['id']}})[_0x702c('0x1e')](handleEntityNotFound(_0xa5c90b,null))['then'](function(_0xdeaa07){if(_0xdeaa07){return _0xdeaa07['removeDispositions'](_0x548186[_0x702c('0x3f')]['ids']);}})[_0x702c('0x1e')](respondWithStatusCode(_0xa5c90b,null))[_0x702c('0x52')](handleError(_0xa5c90b,null));};exports['addAnswer']=function(_0x296940,_0x15d8ef,_0x37ff86){if(_0x296940[_0x702c('0x5a')]['id']){delete _0x296940[_0x702c('0x5a')]['id'];}return db[_0x702c('0x39')]['find']({'where':{'id':_0x296940[_0x702c('0x54')]['id']}})[_0x702c('0x1e')](handleEntityNotFound(_0x15d8ef,null))['then'](function(_0x2055c4){if(_0x2055c4){_0x296940[_0x702c('0x5a')]['FaxAccountId']=_0x2055c4['id'];return db[_0x702c('0x67')][_0x702c('0x59')](_0x296940['body']);}})['then'](respondWithResult(_0x15d8ef,null))['catch'](handleError(_0x15d8ef,null));};exports[_0x702c('0x68')]=function(_0x5ed861,_0x26bb56,_0x279a9c){var _0x51ce77={'raw':![],'where':{}};var _0x20c5b8={};var _0xdaecdd={'count':0x0,'rows':[]};return db['FaxAccount'][_0x702c('0x64')]({'where':{'id':_0x5ed861[_0x702c('0x54')]['id']}})['then'](handleEntityNotFound(_0x26bb56,null))['then'](function(_0x5856b5){if(_0x5856b5){_0x20c5b8[_0x702c('0x3e')]=_[_0x702c('0x56')](db[_0x702c('0x67')][_0x702c('0x3a')]);_0x20c5b8[_0x702c('0x3f')]=_['keys'](_0x5ed861['query']);_0x20c5b8['filters']=_[_0x702c('0x41')](_0x20c5b8[_0x702c('0x3e')],_0x20c5b8[_0x702c('0x3f')]);_0x51ce77['attributes']=_[_0x702c('0x41')](_0x20c5b8[_0x702c('0x3e')],qs[_0x702c('0x43')](_0x5ed861[_0x702c('0x3f')][_0x702c('0x43')]));_0x51ce77[_0x702c('0x42')]=_0x51ce77['attributes'][_0x702c('0x44')]?_0x51ce77['attributes']:_0x20c5b8[_0x702c('0x3e')];if(!_0x5ed861[_0x702c('0x3f')][_0x702c('0x45')]('nolimit')){_0x51ce77['limit']=qs[_0x702c('0x65')](_0x5ed861[_0x702c('0x3f')][_0x702c('0x65')]);_0x51ce77[_0x702c('0x2d')]=qs['offset'](_0x5ed861[_0x702c('0x3f')][_0x702c('0x2d')]);}_0x51ce77[_0x702c('0x47')]=qs[_0x702c('0x48')](_0x5ed861[_0x702c('0x3f')]['sort']);_0x51ce77[_0x702c('0x49')]=qs[_0x702c('0x40')](_[_0x702c('0x4a')](_0x5ed861[_0x702c('0x3f')],_0x20c5b8[_0x702c('0x40')]));_0x51ce77[_0x702c('0x49')][_0x702c('0x62')]=_0x5856b5['id'];if(_0x5ed861[_0x702c('0x3f')][_0x702c('0x4b')]){_0x51ce77[_0x702c('0x49')]=_[_0x702c('0x4c')](_0x51ce77[_0x702c('0x49')],{'$or':_['map'](_0x51ce77[_0x702c('0x42')],function(_0xf70538){var _0x3866c6={};_0x3866c6[_0xf70538]={'$like':'%'+_0x5ed861[_0x702c('0x3f')][_0x702c('0x4b')]+'%'};return _0x3866c6;})});}_0x51ce77=_['merge']({},_0x51ce77,_0x5ed861[_0x702c('0x4e')]);return db[_0x702c('0x67')][_0x702c('0x2c')]({'where':_0x51ce77[_0x702c('0x49')]})['then'](function(_0x46cdcf){_0xdaecdd[_0x702c('0x2c')]=_0x46cdcf;if(_0x5ed861['query'][_0x702c('0x57')]){_0x51ce77[_0x702c('0x4f')]=[{'all':!![]}];}return db[_0x702c('0x67')][_0x702c('0x50')](_0x51ce77);})[_0x702c('0x1e')](function(_0x19ae4c){_0xdaecdd[_0x702c('0x51')]=_0x19ae4c;return _0xdaecdd;});}})[_0x702c('0x1e')](respondWithFilteredResult(_0x26bb56,_0x51ce77))['catch'](handleError(_0x26bb56,null));};exports['removeAnswers']=function(_0x1fa4e2,_0xb32190,_0x208e74){return db['FaxAccount']['find']({'where':{'id':_0x1fa4e2[_0x702c('0x54')]['id']}})[_0x702c('0x1e')](handleEntityNotFound(_0xb32190,null))[_0x702c('0x1e')](function(_0x1f92b8){if(_0x1f92b8){return _0x1f92b8['removeAnswers'](_0x1fa4e2['query'][_0x702c('0x69')]);}})[_0x702c('0x1e')](respondWithStatusCode(_0xb32190,null))['catch'](handleError(_0xb32190,null));};exports[_0x702c('0x6a')]=function(_0x54337e,_0x4b1bf6,_0x3710c9){return db['FaxInteraction'][_0x702c('0x58')]({'where':{'id':_0x54337e[_0x702c('0x54')]['id']}})[_0x702c('0x1e')](handleEntityNotFound(_0x4b1bf6,null))[_0x702c('0x1e')](function(_0x57fda5){if(_0x57fda5){return _0x57fda5[_0x702c('0x6a')](_0x54337e['body'][_0x702c('0x69')],_[_0x702c('0x6b')](_0x54337e[_0x702c('0x5a')],['ids','id'])||{});}})[_0x702c('0x1e')](respondWithResult(_0x4b1bf6,null))['catch'](handleError(_0x4b1bf6,null));};exports[_0x702c('0x6c')]=function(_0x288444,_0xe7d2c0,_0x2e687a){var _0x1dae0d={'raw':![],'where':{}};var _0x5bccce={};var _0x3bf486={'count':0x0,'rows':[]};return db['FaxAccount'][_0x702c('0x64')]({'where':{'id':_0x288444[_0x702c('0x54')]['id']}})['then'](handleEntityNotFound(_0xe7d2c0,null))[_0x702c('0x1e')](function(_0x14f28e){if(_0x14f28e){_0x5bccce[_0x702c('0x3e')]=_[_0x702c('0x56')](db[_0x702c('0x6d')][_0x702c('0x3a')]);_0x5bccce[_0x702c('0x3f')]=_[_0x702c('0x56')](_0x288444[_0x702c('0x3f')]);_0x5bccce[_0x702c('0x40')]=_['intersection'](_0x5bccce[_0x702c('0x3e')],_0x5bccce[_0x702c('0x3f')]);_0x1dae0d[_0x702c('0x42')]=_['intersection'](_0x5bccce[_0x702c('0x3e')],qs['fields'](_0x288444['query'][_0x702c('0x43')]));_0x1dae0d['attributes']=_0x1dae0d[_0x702c('0x42')]['length']?_0x1dae0d['attributes']:_0x5bccce['model'];if(!_0x288444[_0x702c('0x3f')][_0x702c('0x45')]('nolimit')){_0x1dae0d[_0x702c('0x65')]=qs['limit'](_0x288444[_0x702c('0x3f')][_0x702c('0x65')]);_0x1dae0d[_0x702c('0x2d')]=qs[_0x702c('0x2d')](_0x288444['query']['offset']);}_0x1dae0d['order']=qs[_0x702c('0x48')](_0x288444[_0x702c('0x3f')][_0x702c('0x48')]);_0x1dae0d['where']=qs[_0x702c('0x40')](_[_0x702c('0x4a')](_0x288444[_0x702c('0x3f')],_0x5bccce[_0x702c('0x40')]));_0x1dae0d[_0x702c('0x49')][_0x702c('0x62')]=_0x14f28e['id'];if(_0x288444[_0x702c('0x3f')][_0x702c('0x4b')]){_0x1dae0d[_0x702c('0x49')]=_['merge'](_0x1dae0d[_0x702c('0x49')],{'$or':_[_0x702c('0x38')](_0x1dae0d[_0x702c('0x42')],function(_0x23125f){var _0x1b6b8c={};_0x1b6b8c[_0x23125f]={'$like':'%'+_0x288444[_0x702c('0x3f')]['filter']+'%'};return _0x1b6b8c;})});}_0x1dae0d=_['merge']({},_0x1dae0d,_0x288444[_0x702c('0x4e')]);return db[_0x702c('0x6d')][_0x702c('0x2c')]({'where':_0x1dae0d['where']})[_0x702c('0x1e')](function(_0x3bcc06){_0x3bf486[_0x702c('0x2c')]=_0x3bcc06;if(_0x288444[_0x702c('0x3f')]['includeAll']){_0x1dae0d[_0x702c('0x4f')]=[{'model':db[_0x702c('0x6e')],'as':'Contact','required':![]},{'model':db[_0x702c('0x6f')],'as':_0x702c('0x70'),'attributes':[_0x702c('0x36'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x702c('0x71'),'attributes':['id',_0x702c('0x36'),_0x702c('0x72')],'where':_0x288444[_0x702c('0x3f')][_0x702c('0x73')]?{'id':_0x288444[_0x702c('0x3f')][_0x702c('0x73')]}:undefined,'required':_0x288444[_0x702c('0x3f')][_0x702c('0x73')]?!![]:![]}];}return db[_0x702c('0x6d')][_0x702c('0x50')](_0x1dae0d);})['then'](function(_0xa1d960){_0x3bf486[_0x702c('0x51')]=_0xa1d960;return _0x3bf486;});}})[_0x702c('0x1e')](respondWithFilteredResult(_0xe7d2c0,_0x1dae0d))['catch'](handleError(_0xe7d2c0,null));};exports[_0x702c('0x74')]=function(_0x25bac9,_0x2199f2,_0x930d1d){return db['FaxAccount'][_0x702c('0x64')]({'where':{'id':_0x25bac9[_0x702c('0x54')]['id']}})[_0x702c('0x1e')](handleEntityNotFound(_0x2199f2,null))['then'](function(_0x330472){if(_0x330472){return db['sequelize'][_0x702c('0x75')](function(_0x2a9a17){return db[_0x702c('0x76')][_0x702c('0x31')]({'where':{'FaxAccountId':_0x25bac9[_0x702c('0x54')]['id']},'transaction':_0x2a9a17})[_0x702c('0x1e')](function(_0x52f693){var _0x58cf68=_[_0x702c('0x38')](_0x25bac9[_0x702c('0x5a')],function(_0x6919ae){_0x6919ae[_0x702c('0x62')]=_0x25bac9[_0x702c('0x54')]['id'];return _0x6919ae;});return db[_0x702c('0x76')][_0x702c('0x77')](_0x58cf68,{'transaction':_0x2a9a17});});})['then'](function(){return db[_0x702c('0x76')][_0x702c('0x78')]({'where':{'FaxAccountId':_0x25bac9[_0x702c('0x54')]['id']},'order':_0x702c('0x79')});});}})[_0x702c('0x1e')](respondWithResult(_0x2199f2,null))['catch'](handleError(_0x2199f2,null));};exports['getApplications']=function(_0x449b28,_0x482a6d,_0x9ae2b0){var _0xa0f1aa={};var _0x122e4a={};var _0x2fc7dd;var _0x54ecb9;return db[_0x702c('0x39')][_0x702c('0x64')]({'where':{'id':_0x449b28[_0x702c('0x54')]['id']}})[_0x702c('0x1e')](handleEntityNotFound(_0x482a6d,null))[_0x702c('0x1e')](function(_0x3f15da){if(_0x3f15da){_0x2fc7dd=_0x3f15da;_0x122e4a['model']=_[_0x702c('0x56')](db['FaxApplication']['rawAttributes']);_0x122e4a[_0x702c('0x3f')]=_['keys'](_0x449b28[_0x702c('0x3f')]);_0x122e4a[_0x702c('0x40')]=_[_0x702c('0x41')](_0x122e4a[_0x702c('0x3e')],_0x122e4a[_0x702c('0x3f')]);_0xa0f1aa[_0x702c('0x42')]=_[_0x702c('0x41')](_0x122e4a[_0x702c('0x3e')],qs[_0x702c('0x43')](_0x449b28[_0x702c('0x3f')][_0x702c('0x43')]));_0xa0f1aa[_0x702c('0x42')]=_0xa0f1aa[_0x702c('0x42')][_0x702c('0x44')]?_0xa0f1aa[_0x702c('0x42')]:_0x122e4a[_0x702c('0x3e')];_0xa0f1aa[_0x702c('0x47')]=qs[_0x702c('0x48')](_0x449b28[_0x702c('0x3f')]['sort']);_0xa0f1aa[_0x702c('0x49')]=qs[_0x702c('0x40')](_[_0x702c('0x4a')](_0x449b28[_0x702c('0x3f')],_0x122e4a[_0x702c('0x40')]));if(_0x449b28['query'][_0x702c('0x4b')]){_0xa0f1aa[_0x702c('0x49')]=_['merge'](_0xa0f1aa[_0x702c('0x49')],{'$or':_[_0x702c('0x38')](_0xa0f1aa[_0x702c('0x42')],function(_0x207c41){var _0x469ec4={};_0x469ec4[_0x207c41]={'$like':'%'+_0x449b28[_0x702c('0x3f')][_0x702c('0x4b')]+'%'};return _0x469ec4;})});}_0xa0f1aa=_[_0x702c('0x4c')]({},_0xa0f1aa,_0x449b28[_0x702c('0x4e')]);return _0x2fc7dd[_0x702c('0x7a')](_0xa0f1aa);}})[_0x702c('0x1e')](function(_0x1befc0){if(_0x1befc0){_0x54ecb9=_0x1befc0[_0x702c('0x44')];if(!_0x449b28[_0x702c('0x3f')][_0x702c('0x45')](_0x702c('0x46'))){_0xa0f1aa[_0x702c('0x65')]=qs[_0x702c('0x65')](_0x449b28[_0x702c('0x3f')][_0x702c('0x65')]);_0xa0f1aa[_0x702c('0x2d')]=qs['offset'](_0x449b28[_0x702c('0x3f')][_0x702c('0x2d')]);}return _0x2fc7dd[_0x702c('0x7a')](_0xa0f1aa);}})[_0x702c('0x1e')](function(_0x2e4c26){if(_0x2e4c26){return _0x2e4c26?{'count':_0x54ecb9,'rows':_0x2e4c26}:null;}})[_0x702c('0x1e')](respondWithResult(_0x482a6d,null))[_0x702c('0x52')](handleError(_0x482a6d,null));};function Extension(_0x4e9331,_0x9835d9,_0x20cbd5,_0x4cc508){this['context']=_0x702c('0x7b');this[_0x702c('0x7c')]=_0x4e9331['localstationid'];this[_0x702c('0x7d')]=_0x4cc508;this[_0x702c('0x3c')]=_0x702c('0x7e');this[_0x702c('0x7f')]=_0x702c('0x80');this[_0x702c('0x62')]=_0x4e9331['id'];this['priority']=_0x9835d9;this[_0x702c('0x81')]=_0x20cbd5;}function createExtensionsReciveFax(_0x45d11f){var _0x5e7d90=0x1;var _0x4c5b73=[];_0x4c5b73['push'](new Extension(_0x45d11f,_0x5e7d90,'',_0x702c('0x82')));_0x5e7d90+=0x1;_0x4c5b73['push'](new Extension(_0x45d11f,_0x5e7d90,'CDR(type)=inbound-fax',_0x702c('0x83')));_0x5e7d90+=0x1;for(var _0x12b487 in _0x45d11f){if(_0x45d11f['hasOwnProperty'](_0x12b487)&&(_0x12b487==='ecm'||_0x12b487===_0x702c('0x84')||_0x12b487==='gateway'||_0x12b487===_0x702c('0x85')||_0x12b487===_0x702c('0x86')||_0x12b487===_0x702c('0x87')||_0x12b487===_0x702c('0x88')||_0x12b487==='modem'||_0x12b487==='t38timeout')){_0x4c5b73[_0x702c('0x89')](new Extension(_0x45d11f,_0x5e7d90,_0x702c('0x8a')+_0x12b487+')='+_0x45d11f[_0x12b487],_0x702c('0x83')));_0x5e7d90+=0x1;}}_0x4c5b73[_0x702c('0x89')](new Extension(_0x45d11f,_0x5e7d90,'6',_0x702c('0x8b')));_0x5e7d90+=0x1;_0x4c5b73[_0x702c('0x89')](new Extension(_0x45d11f,_0x5e7d90,_0x702c('0x8c'),_0x702c('0x8d')));_0x5e7d90=0x0;return _0x4c5b73;}exports[_0x702c('0x8e')]=function(_0x4580be,_0x32a835,_0x19482a){var _0x586728;return db['sequelize']['transaction'](function(_0x1ff595){return db[_0x702c('0x39')][_0x702c('0x59')](_0x4580be[_0x702c('0x5a')],{'transaction':_0x1ff595})[_0x702c('0x1e')](function(_0x9534ef){_0x586728=_0x9534ef[_0x702c('0x32')]({'plain':!![]});return db[_0x702c('0x8f')]['bulkCreate'](createExtensionsReciveFax(_0x586728),{'transaction':_0x1ff595});});})[_0x702c('0x1e')](function(){return _0x586728;})[_0x702c('0x1e')](respondWithResult(_0x32a835,null))['catch'](handleError(_0x32a835,null));};exports[_0x702c('0x90')]=function(_0x27d2c5,_0x329bc3,_0x905964){var _0x3d8ead;return db['sequelize'][_0x702c('0x75')](function(_0x4cfbf0){return db[_0x702c('0x39')][_0x702c('0x30')](_0x27d2c5[_0x702c('0x5a')],{'where':{'id':_0x27d2c5['body']['id']},'transaction':_0x4cfbf0})[_0x702c('0x1e')](function(_0x552692){return db[_0x702c('0x8f')]['destroy']({'where':{'FaxAccountId':_0x27d2c5[_0x702c('0x5a')]['id']},'transaction':_0x4cfbf0})[_0x702c('0x1e')](function(_0x40ce7f){return db[_0x702c('0x8f')][_0x702c('0x77')](createExtensionsReciveFax(_[_0x702c('0x6b')](_0x27d2c5[_0x702c('0x5a')],[_0x702c('0x91'),'key',_0x702c('0x92'),_0x702c('0x93'),_0x702c('0x94'),'ListId'])),{'transaction':_0x4cfbf0});});});})[_0x702c('0x1e')](function(){return db[_0x702c('0x39')][_0x702c('0x95')](_0x27d2c5[_0x702c('0x5a')]['id']);})[_0x702c('0x1e')](respondWithResult(_0x329bc3,null))[_0x702c('0x52')](handleError(_0x329bc3,null));};exports[_0x702c('0x96')]=function(_0x44f16a,_0x5b69c,_0x1b6a9c){var _0x34dffd={'raw':!![],'where':{}};var _0x23787a={};var _0x454d30={'count':0x0,'rows':[]};return db[_0x702c('0x39')][_0x702c('0x64')]({'where':{'id':_0x44f16a[_0x702c('0x54')]['id']}})['then'](handleEntityNotFound(_0x5b69c,null))[_0x702c('0x1e')](function(_0x332c7e){if(_0x332c7e){_0x23787a['model']=_[_0x702c('0x56')](db[_0x702c('0x97')][_0x702c('0x3a')]);_0x23787a['query']=_[_0x702c('0x56')](_0x44f16a['query']);_0x23787a[_0x702c('0x40')]=_[_0x702c('0x41')](_0x23787a[_0x702c('0x3e')],_0x23787a[_0x702c('0x3f')]);_0x34dffd['attributes']=_[_0x702c('0x41')](_0x23787a[_0x702c('0x3e')],qs[_0x702c('0x43')](_0x44f16a[_0x702c('0x3f')][_0x702c('0x43')]));_0x34dffd[_0x702c('0x42')]=_0x34dffd[_0x702c('0x42')][_0x702c('0x44')]?_0x34dffd[_0x702c('0x42')]:_0x23787a[_0x702c('0x3e')];if(!_0x44f16a['query'][_0x702c('0x45')](_0x702c('0x46'))){_0x34dffd['limit']=qs[_0x702c('0x65')](_0x44f16a[_0x702c('0x3f')][_0x702c('0x65')]);_0x34dffd['offset']=qs['offset'](_0x44f16a['query']['offset']);}_0x34dffd[_0x702c('0x47')]=qs[_0x702c('0x48')](_0x44f16a[_0x702c('0x3f')][_0x702c('0x48')]);_0x34dffd[_0x702c('0x49')]=qs[_0x702c('0x40')](_[_0x702c('0x4a')](_0x44f16a[_0x702c('0x3f')],_0x23787a['filters']));_0x34dffd['where'][_0x702c('0x62')]=_0x332c7e['id'];if(_0x44f16a[_0x702c('0x3f')][_0x702c('0x4b')]){_0x34dffd[_0x702c('0x49')]=_[_0x702c('0x4c')](_0x34dffd[_0x702c('0x49')],{'$or':_[_0x702c('0x38')](_0x34dffd[_0x702c('0x42')],function(_0x27f272){var _0x29c9a1={};_0x29c9a1[_0x27f272]={'$like':'%'+_0x44f16a[_0x702c('0x3f')]['filter']+'%'};return _0x29c9a1;})});}if(_0x44f16a['query']['$gte']){var _0x251794=_0x44f16a[_0x702c('0x3f')][_0x702c('0x98')][_0x702c('0x99')](',');var _0x1dd530={};_0x1dd530[_0x251794[0x0]]={'$gte':moment(_0x251794[0x1])[_0x702c('0x9a')](_0x702c('0x9b'))};_0x34dffd['where']=_[_0x702c('0x4c')](_0x34dffd['where'],_0x1dd530);}_0x34dffd=_[_0x702c('0x4c')]({},_0x34dffd,_0x44f16a[_0x702c('0x4e')]);return db['FaxMessage'][_0x702c('0x2c')]({'where':_0x34dffd[_0x702c('0x49')]})[_0x702c('0x1e')](function(_0x2e7918){_0x454d30[_0x702c('0x2c')]=_0x2e7918;if(_0x44f16a[_0x702c('0x3f')]['includeAll']){_0x34dffd[_0x702c('0x4f')]=[{'all':!![]}];}return db[_0x702c('0x97')][_0x702c('0x50')](_0x34dffd);})[_0x702c('0x1e')](function(_0x34d261){_0x454d30['rows']=_0x34d261;return _0x454d30;});}})[_0x702c('0x1e')](respondWithFilteredResult(_0x5b69c,_0x34dffd))[_0x702c('0x52')](handleError(_0x5b69c,null));};exports[_0x702c('0x9c')]=function(_0x203653,_0x19a7b6,_0x2b27f6){var _0x1990db,_0x127ecc={},_0x159b6f;if(_0x203653[_0x702c('0x5a')]['to']){_0x159b6f=_0x203653[_0x702c('0x5a')]['to'][0x0];}return db['FaxAccount'][_0x702c('0x58')]({'where':{'id':_0x203653[_0x702c('0x54')]['id']},'include':[{'model':db[_0x702c('0x9d')],'as':_0x702c('0x9e'),'include':[{'model':db['CmContact'],'as':_0x702c('0x9f'),'where':{'fax':_0x159b6f},'limit':0x1,'order':[[_0x702c('0x93'),_0x702c('0xa0')]]}]}]})['then'](handleEntityNotFound(_0x19a7b6,null))[_0x702c('0x1e')](function(_0x3e239d){_0x1990db=_0x3e239d;if(_0x203653[_0x702c('0x5a')][_0x702c('0xa1')]&&_0x203653[_0x702c('0x5a')][_0x702c('0xa1')][_0x702c('0x44')]){for(var _0x30083d=0x0;_0x30083d<_0x203653['body']['attachments'][_0x702c('0x44')];_0x30083d+=0x1){_0x203653['body']['attachments'][_0x30083d]={'filename':_0x203653['body'][_0x702c('0xa1')][_0x30083d][_0x702c('0x36')],'id':_0x203653['body'][_0x702c('0xa1')][_0x30083d]['id'],'path':path[_0x702c('0xa2')](config[_0x702c('0xa3')],_0x702c('0xa4'),_0x203653['body'][_0x702c('0xa1')][_0x30083d][_0x702c('0xa5')])};}}return respondWithRpcPromise('CheckAfterSend',_0x702c('0xa6'),{'FaxAccountId':_[_0x702c('0xa7')](_0x203653[_0x702c('0x54')]['id'])?undefined:_0x203653[_0x702c('0x54')]['id'],'path':_[_0x702c('0xa7')](_0x203653[_0x702c('0x5a')][_0x702c('0xa1')][0x0]['path'])?undefined:_0x203653[_0x702c('0x5a')][_0x702c('0xa1')][0x0][_0x702c('0x5')],'fax':_[_0x702c('0xa7')](_0x203653[_0x702c('0x5a')]['to'][0x0])?undefined:_0x203653[_0x702c('0x5a')]['to'][0x0]},client9002);})[_0x702c('0x1e')](function(){if(_0x1990db){if(_[_0x702c('0xa7')](_0x203653['body'][_0x702c('0xa8')])){_0x203653[_0x702c('0x5a')][_0x702c('0xa8')]=util[_0x702c('0x9a')]('\x22%s\x22\x20<%s>',_0x1990db[_0x702c('0x36')],_0x1990db['fax']);}if(_0x1990db[_0x702c('0x9e')]){if(_0x1990db['List'][_0x702c('0x9f')]['length']){return _0x1990db[_0x702c('0x9e')][_0x702c('0x9f')][0x0];}else{return db['CmContact'][_0x702c('0x59')](_[_0x702c('0xa9')](_0x203653[_0x702c('0x5a')],{'firstName':_0x203653[_0x702c('0x5a')]['to'][0x0],'phone':_0x203653[_0x702c('0x5a')]['to'][0x0],'fax':_0x203653[_0x702c('0x5a')]['to'][0x0],'ListId':_0x1990db['ListId']}));}}else{throw new Error(_0x702c('0xaa'));}}else{throw new Error(_0x702c('0xab'));}})[_0x702c('0x1e')](function(_0x2e4f02){if(_0x2e4f02){return db[_0x702c('0x6d')]['find']({'where':{'ContactId':_0x2e4f02['id'],'closed':![],'FaxAccountId':_0x1990db['id']}})[_0x702c('0x1e')](function(_0x56495c){if(_0x56495c){return[_0x56495c,![]];}return db[_0x702c('0x6d')][_0x702c('0x59')]({'UserId':_0x203653[_0x702c('0x5b')]['id'],'ContactId':_0x2e4f02['id'],'FaxAccountId':_0x1990db['id'],'fax':_0x203653['body']['to'][0x0],'firstMsgDirection':_0x702c('0xac'),'Messages':[_[_0x702c('0x4c')](_0x203653[_0x702c('0x5a')],{'read':![],'body':_0x203653[_0x702c('0x5a')][_0x702c('0xa1')][0x0]['filename'],'FaxAccountId':_0x1990db['id'],'UserId':_0x203653['user']['id'],'ContactId':_0x2e4f02['id'],'AttachmentId':_0x203653['body'][_0x702c('0xa1')][0x0]['id']})]},{'include':[{'model':db[_0x702c('0x97')],'as':_0x702c('0xad')}]})['then'](function(_0x1b6338){return[_0x1b6338,!![]];});});}else{throw new Error(_0x702c('0xae'));}})[_0x702c('0xaf')](function(_0x2f4944,_0x2c051b){if(_0x2c051b){return _0x2f4944;}return db[_0x702c('0x97')][_0x702c('0x59')]({'direction':_0x702c('0xac'),'read':![],'body':_0x203653[_0x702c('0x5a')][_0x702c('0xa1')][0x0]['filename'],'FaxAccountId':_0x1990db['id'],'FaxInteractionId':_0x2f4944['id'],'UserId':_0x203653['user']['id'],'ContactId':_0x2f4944[_0x702c('0xb0')],'AttachmentId':_0x203653['body'][_0x702c('0xa1')][0x0]['id']})['then'](function(_0x281a1e){_0x2f4944[_0x702c('0xb1')]['Messages']=[];_0x2f4944[_0x702c('0xb1')]['Messages'][_0x702c('0x89')](_0x281a1e['dataValues']);return _0x2f4944;});})[_0x702c('0x1e')](function(_0x181cd0){respondWithRpcPromise(_0x702c('0xb2'),_0x702c('0xb2'),{'FaxAccountId':_['isNil'](_0x203653[_0x702c('0x54')]['id'])?undefined:_0x203653[_0x702c('0x54')]['id'],'path':_[_0x702c('0xa7')](_0x203653[_0x702c('0x5a')][_0x702c('0xa1')][0x0][_0x702c('0x5')])?undefined:_0x203653[_0x702c('0x5a')][_0x702c('0xa1')][0x0][_0x702c('0x5')],'fax':_[_0x702c('0xa7')](_0x203653[_0x702c('0x5a')]['to'][0x0])?undefined:_0x203653[_0x702c('0x5a')]['to'][0x0],'AttachmentId':_0x203653[_0x702c('0x5a')][_0x702c('0xa1')][0x0]['id']},client9002)[_0x702c('0x1e')](function(_0x5d2057){logger[_0x702c('0x1f')](_0x702c('0xb3'),_0x5d2057);})['catch'](function(_0x16e88e){logger[_0x702c('0x1f')](_0x702c('0xb3'),_0x16e88e);});return _0x181cd0;})[_0x702c('0x1e')](respondWithResult(_0x19a7b6,null))[_0x702c('0x52')](handleError(_0x19a7b6,null));};exports['addAgents']=function(_0x201b73,_0x6a4d18,_0x1e02e3){return db['FaxAccount'][_0x702c('0x58')]({'where':{'id':_0x201b73[_0x702c('0x54')]['id']}})['then'](handleEntityNotFound(_0x6a4d18,null))[_0x702c('0x1e')](function(_0x47e7c6){if(_0x47e7c6){return _0x47e7c6['addAgents'](_0x201b73['body'][_0x702c('0x69')],_[_0x702c('0x6b')](_0x201b73[_0x702c('0x5a')],[_0x702c('0x69'),'id'])||{})[_0x702c('0xaf')](function(_0x413852){for(var _0x25bd38=0x0;_0x25bd38<_0x201b73[_0x702c('0x5a')][_0x702c('0x69')]['length'];_0x25bd38+=0x1){socket[_0x702c('0xb4')](_0x702c('0xb5'),{'UserId':_0x201b73[_0x702c('0x5a')][_0x702c('0x69')][_0x25bd38],'FaxAccountId':_0x201b73[_0x702c('0x54')]['id']});}return _0x413852;});}})[_0x702c('0x1e')](respondWithResult(_0x6a4d18,null))[_0x702c('0x52')](handleError(_0x6a4d18,null));};exports['removeAgents']=function(_0x5ed7f6,_0x1fdaf9,_0x476b6e){return db[_0x702c('0x39')][_0x702c('0x58')]({'where':{'id':_0x5ed7f6[_0x702c('0x54')]['id']}})[_0x702c('0x1e')](handleEntityNotFound(_0x1fdaf9,null))[_0x702c('0x1e')](function(_0x485930){if(_0x485930){return _0x485930[_0x702c('0xb6')](_0x5ed7f6[_0x702c('0x3f')][_0x702c('0x69')])[_0x702c('0x1e')](function(){if(_[_0x702c('0xb7')](_0x5ed7f6[_0x702c('0x3f')][_0x702c('0x69')])){for(var _0x475b50=0x0;_0x475b50<_0x5ed7f6[_0x702c('0x3f')][_0x702c('0x69')]['length'];_0x475b50+=0x1){socket['emit'](_0x702c('0xb8'),{'UserId':Number(_0x5ed7f6[_0x702c('0x3f')]['ids'][_0x475b50]),'FaxAccountId':Number(_0x5ed7f6['params']['id'])});}}else{socket['emit'](_0x702c('0xb8'),{'UserId':Number(_0x5ed7f6[_0x702c('0x3f')][_0x702c('0x69')]),'FaxAccountId':Number(_0x5ed7f6[_0x702c('0x54')]['id'])});}});}})[_0x702c('0x1e')](respondWithStatusCode(_0x1fdaf9,null))[_0x702c('0x52')](handleError(_0x1fdaf9,null));};exports['getAgents']=function(_0x2ab227,_0x2109c5,_0x388c00){var _0x1dda41={};var _0x4acebf={};var _0x18a731;var _0x38a296;return db['FaxAccount']['findOne']({'where':{'id':_0x2ab227['params']['id']}})[_0x702c('0x1e')](handleEntityNotFound(_0x2109c5,null))[_0x702c('0x1e')](function(_0x14ce02){if(_0x14ce02){_0x18a731=_0x14ce02;_0x4acebf['model']=_[_0x702c('0x56')](db['User'][_0x702c('0x3a')]);_0x4acebf[_0x702c('0x3f')]=_[_0x702c('0x56')](_0x2ab227[_0x702c('0x3f')]);_0x4acebf[_0x702c('0x40')]=_[_0x702c('0x41')](_0x4acebf[_0x702c('0x3e')],_0x4acebf['query']);_0x1dda41['attributes']=_[_0x702c('0x41')](_0x4acebf[_0x702c('0x3e')],qs['fields'](_0x2ab227['query'][_0x702c('0x43')]));_0x1dda41['attributes']=_0x1dda41[_0x702c('0x42')]['length']?_0x1dda41['attributes']:_0x4acebf[_0x702c('0x3e')];_0x1dda41[_0x702c('0x47')]=qs[_0x702c('0x48')](_0x2ab227[_0x702c('0x3f')][_0x702c('0x48')]);_0x1dda41['where']=qs[_0x702c('0x40')](_['pick'](_0x2ab227[_0x702c('0x3f')],_0x4acebf[_0x702c('0x40')]));if(_0x2ab227['query'][_0x702c('0x4b')]){_0x1dda41[_0x702c('0x49')]=_[_0x702c('0x4c')](_0x1dda41[_0x702c('0x49')],{'$or':_['map'](_0x1dda41[_0x702c('0x42')],function(_0x162102){var _0x4fb69f={};_0x4fb69f[_0x162102]={'$like':'%'+_0x2ab227['query'][_0x702c('0x4b')]+'%'};return _0x4fb69f;})});}_0x1dda41=_[_0x702c('0x4c')]({},_0x1dda41,_0x2ab227[_0x702c('0x4e')]);return _0x18a731[_0x702c('0xb9')](_0x1dda41);}})[_0x702c('0x1e')](function(_0x3b5892){if(_0x3b5892){_0x38a296=_0x3b5892[_0x702c('0x44')];if(!_0x2ab227['query']['hasOwnProperty'](_0x702c('0x46'))){_0x1dda41[_0x702c('0x65')]=qs[_0x702c('0x65')](_0x2ab227[_0x702c('0x3f')]['limit']);_0x1dda41['offset']=qs[_0x702c('0x2d')](_0x2ab227['query'][_0x702c('0x2d')]);}return _0x18a731[_0x702c('0xb9')](_0x1dda41);}})[_0x702c('0x1e')](function(_0x443db8){if(_0x443db8){return _0x443db8?{'count':_0x38a296,'rows':_0x443db8}:null;}})[_0x702c('0x1e')](respondWithResult(_0x2109c5,null))['catch'](handleError(_0x2109c5,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 5edb0bf..03185f0 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 _0x819a=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x819a,0x1bf));var _0xa819=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x819a[_0x57cb4f];return _0x29bb45;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xa819('0x0'))['db'][_0xa819('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa819('0x2')](0x0);var events={'afterCreate':_0xa819('0x3'),'afterUpdate':_0xa819('0x4'),'afterDestroy':_0xa819('0x5')};function emitEvent(_0xfde150){return function(_0x41799f,_0x293e70,_0x34b5da){FaxAccountEvents[_0xa819('0x6')](_0xfde150+':'+_0x41799f['id'],_0x41799f);FaxAccountEvents[_0xa819('0x6')](_0xfde150,_0x41799f);_0x34b5da(null);};}for(var e in events){if(events[_0xa819('0x7')](e)){var event=events[e];FaxAccount[_0xa819('0x8')](e,emitEvent(event));}}module[_0xa819('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x6c72=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','save','update','remove'];(function(_0x9e81e,_0x532225){var _0x41f69f=function(_0x1163fb){while(--_0x1163fb){_0x9e81e['push'](_0x9e81e['shift']());}};_0x41f69f(++_0x532225);}(_0x6c72,0x19e));var _0x26c7=function(_0x8b98b8,_0x63e9c1){_0x8b98b8=_0x8b98b8-0x0;var _0x4a07f1=_0x6c72[_0x8b98b8];return _0x4a07f1;};'use strict';var EventEmitter=require(_0x26c7('0x0'));var FaxAccount=require(_0x26c7('0x1'))['db'][_0x26c7('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x26c7('0x3'),'afterUpdate':_0x26c7('0x4'),'afterDestroy':_0x26c7('0x5')};function emitEvent(_0x3237){return function(_0x1f00de,_0x2d6951,_0x35f13f){FaxAccountEvents[_0x26c7('0x6')](_0x3237+':'+_0x1f00de['id'],_0x1f00de);FaxAccountEvents['emit'](_0x3237,_0x1f00de);_0x35f13f(null);};}for(var e in events){if(events[_0x26c7('0x7')](e)){var event=events[e];FaxAccount[_0x26c7('0x8')](e,emitEvent(event));}}module[_0x26c7('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index cc82498..b960ba9 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 _0x922d=['moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x2db4d5,_0x2ff676){var _0x567cb7=function(_0x367417){while(--_0x367417){_0x2db4d5['push'](_0x2db4d5['shift']());}};_0x567cb7(++_0x2ff676);}(_0x922d,0x106));var _0xd922=function(_0x4bf68f,_0x3791c6){_0x4bf68f=_0x4bf68f-0x0;var _0x5b09ce=_0x922d[_0x4bf68f];return _0x5b09ce;};'use strict';var _=require(_0xd922('0x0'));var util=require(_0xd922('0x1'));var logger=require(_0xd922('0x2'))(_0xd922('0x3'));var moment=require(_0xd922('0x4'));var BPromise=require('bluebird');var rp=require(_0xd922('0x5'));var fs=require('fs');var path=require(_0xd922('0x6'));var rimraf=require(_0xd922('0x7'));var config=require(_0xd922('0x8'));var attributes=require(_0xd922('0x9'));module[_0xd922('0xa')]=function(_0x489e1e,_0x4d8f52){return _0x489e1e[_0xd922('0xb')](_0xd922('0xc'),attributes,{'tableName':_0xd922('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe61f=['./faxAccount.attributes','exports','define','lodash','../../config/logger','api','bluebird','rimraf'];(function(_0x2abdde,_0x2baf86){var _0x3f2165=function(_0x1f32f3){while(--_0x1f32f3){_0x2abdde['push'](_0x2abdde['shift']());}};_0x3f2165(++_0x2baf86);}(_0xe61f,0x113));var _0xfe61=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe61f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfe61('0x0'));var util=require('util');var logger=require(_0xfe61('0x1'))(_0xfe61('0x2'));var moment=require('moment');var BPromise=require(_0xfe61('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe61('0x4'));var config=require('../../config/environment');var attributes=require(_0xfe61('0x5'));module[_0xfe61('0x6')]=function(_0xe2ee45,_0x1d4271){return _0xe2ee45[_0xfe61('0x7')]('FaxAccount',attributes,{'tableName':'fax_accounts','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 0b2da5e..29a416a 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 _0x6ac1=['agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','stringify','error','code','message','catch','FaxAccount','findAll','options','raw','where','include','model','map','attributes','GetFaxAccount','debug','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','from','isNil','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','CmContact','Contacts','DESC','List','get','applications','Applications','list','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','User','find','name','unshift'];(function(_0x1fe9e2,_0x4247a3){var _0x16f2f2=function(_0x5e880d){while(--_0x5e880d){_0x1fe9e2['push'](_0x1fe9e2['shift']());}};_0x16f2f2(++_0x4247a3);}(_0x6ac1,0x1c1));var _0x16ac=function(_0x1cc294,_0x5d677d){_0x1cc294=_0x1cc294-0x0;var _0x9af5f=_0x6ac1[_0x1cc294];return _0x9af5f;};'use strict';var _=require(_0x16ac('0x0'));var util=require(_0x16ac('0x1'));var moment=require(_0x16ac('0x2'));var BPromise=require(_0x16ac('0x3'));var rs=require(_0x16ac('0x4'));var fs=require('fs');var Redis=require(_0x16ac('0x5'));var db=require(_0x16ac('0x6'))['db'];var utils=require(_0x16ac('0x7'));var logger=require('../../config/logger')(_0x16ac('0x8'));var config=require(_0x16ac('0x9'));var jayson=require(_0x16ac('0xa'));var client=jayson[_0x16ac('0xb')][_0x16ac('0xc')]({'port':0x232c});config[_0x16ac('0xd')]=_[_0x16ac('0xe')](config[_0x16ac('0xd')],{'host':_0x16ac('0xf'),'port':0x18eb});var socket=require(_0x16ac('0x10'))(new Redis(config[_0x16ac('0xd')]));require(_0x16ac('0x11'))['register'](socket);function respondWithRpcPromise(_0xb862b4,_0x20ad08,_0x205002){return new BPromise(function(_0x2cf89d,_0x4b66d5){return client[_0x16ac('0x12')](_0xb862b4,_0x205002)[_0x16ac('0x13')](function(_0x4053ec){logger[_0x16ac('0x14')](_0x16ac('0x15'),_0x20ad08,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x20ad08,'request\x20sent',JSON[_0x16ac('0x16')](_0x4053ec));if(_0x4053ec[_0x16ac('0x17')]){if(_0x4053ec['error'][_0x16ac('0x18')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x20ad08,_0x4053ec['error']['message']);return _0x4b66d5(_0x4053ec[_0x16ac('0x17')][_0x16ac('0x19')]);}logger[_0x16ac('0x17')]('FaxAccount,\x20%s,\x20%s',_0x20ad08,_0x4053ec[_0x16ac('0x17')][_0x16ac('0x19')]);return _0x2cf89d(_0x4053ec[_0x16ac('0x17')]['message']);}else{logger[_0x16ac('0x14')](_0x16ac('0x15'),_0x20ad08,'request\x20sent');_0x2cf89d(_0x4053ec['result']['message']);}})[_0x16ac('0x1a')](function(_0x2f5a37){logger[_0x16ac('0x17')](_0x16ac('0x15'),_0x20ad08,_0x2f5a37);_0x4b66d5(_0x2f5a37);});});}exports['GetFaxAccount']=function(_0x266962){var _0x26f931=this;return new Promise(function(_0x3a024c,_0x55bf95){return db[_0x16ac('0x1b')][_0x16ac('0x1c')]({'raw':_0x266962[_0x16ac('0x1d')]?_0x266962['options'][_0x16ac('0x1e')]===undefined?!![]:![]:!![],'where':_0x266962['options']?_0x266962['options'][_0x16ac('0x1f')]||null:null,'attributes':_0x266962['options']?_0x266962[_0x16ac('0x1d')]['attributes']||null:null,'limit':_0x266962['options']?_0x266962[_0x16ac('0x1d')]['limit']||null:null,'include':_0x266962[_0x16ac('0x1d')]?_0x266962[_0x16ac('0x1d')][_0x16ac('0x20')]?_['map'](_0x266962[_0x16ac('0x1d')][_0x16ac('0x20')],function(_0x2f6604){return{'model':db[_0x2f6604[_0x16ac('0x21')]],'as':_0x2f6604['as'],'attributes':_0x2f6604['attributes'],'include':_0x2f6604[_0x16ac('0x20')]?_[_0x16ac('0x22')](_0x2f6604[_0x16ac('0x20')],function(_0x24a905){return{'model':db[_0x24a905['model']],'as':_0x24a905['as'],'attributes':_0x24a905[_0x16ac('0x23')],'include':_0x24a905[_0x16ac('0x20')]?_[_0x16ac('0x22')](_0x24a905[_0x16ac('0x20')],function(_0x51c5d0){return{'model':db[_0x51c5d0[_0x16ac('0x21')]],'as':_0x51c5d0['as'],'attributes':_0x51c5d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x16ac('0x13')](function(_0x55f24d){logger[_0x16ac('0x14')](_0x16ac('0x24'),_0x266962);logger[_0x16ac('0x25')]('GetFaxAccount',_0x266962,JSON['stringify'](_0x55f24d));_0x3a024c(_0x55f24d);})[_0x16ac('0x1a')](function(_0x5b7e55){logger[_0x16ac('0x17')](_0x16ac('0x24'),_0x5b7e55['message'],_0x266962);_0x55bf95(_0x26f931[_0x16ac('0x17')](0x1f4,_0x5b7e55[_0x16ac('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x540ed5,_0xf58182,_0xd3eb07){var _0x14618f=this;return new Promise(function(_0x449599,_0x4c1367){var _0x4d5ace={'body':_0x540ed5[_0x16ac('0x26')],'channel':_0x16ac('0x27')};var _0x584c52=[];var _0x4fc24f=[];var _0x19d9b3={};return db['CmContact'][_0x16ac('0x28')]()[_0x16ac('0x13')](function(_0x54b856){if(!_0x54b856){throw new db[(_0x16ac('0x29'))][(_0x16ac('0x2a'))](_0x16ac('0x2b'));}_0x584c52=_[_0x16ac('0x2c')](_['keys'](_0x54b856),['createdAt','updatedAt']);_0x4fc24f=_[_0x16ac('0x2c')](_[_0x16ac('0x2d')](_0x54b856),[_0x16ac('0x2e'),_0x16ac('0x2f'),'CompanyId',_0x16ac('0x30')]);if(_0x540ed5[_0x16ac('0x26')]['id']){delete _0x540ed5['body']['id'];}if(_['isNil'](_0x540ed5[_0x16ac('0x26')][_0x16ac('0x31')])){throw new db[(_0x16ac('0x29'))][(_0x16ac('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x16ac('0x32')](_0x540ed5[_0x16ac('0x26')][_0x16ac('0x26')])||_0x540ed5[_0x16ac('0x26')][_0x16ac('0x26')]===''){throw new db[(_0x16ac('0x29'))]['ValidationError'](_0x16ac('0x33'));}if(_['isNil'](_0x540ed5[_0x16ac('0x26')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x16ac('0x34')+_0x4fc24f);}if(!_['includes'](_0x4fc24f,_0x540ed5[_0x16ac('0x26')][_0x16ac('0x35')])){throw new db[(_0x16ac('0x29'))][(_0x16ac('0x2a'))](_0x16ac('0x36')+_0x4fc24f);}_0x19d9b3[_0x540ed5[_0x16ac('0x26')]['mapKey']]=_0x540ed5[_0x16ac('0x26')][_0x16ac('0x31')];})['then'](function(){return db[_0x16ac('0x1b')]['find']({'where':{'id':_0x540ed5[_0x16ac('0x37')]['id']},'include':[{'model':db[_0x16ac('0x38')],'as':'List','include':[{'model':db[_0x16ac('0x39')],'as':_0x16ac('0x3a'),'where':_0x19d9b3,'limit':0x1,'order':[[_0x16ac('0x2f'),_0x16ac('0x3b')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})['then'](function(_0x4a54af){if(_0x4a54af&&_0x4a54af[_0x16ac('0x3c')]){var _0x3e2be6=_0x4a54af[_0x16ac('0x3d')]({'plain':!![]});_0x4d5ace['account']=_0x3e2be6;_0x4d5ace[_0x16ac('0x3e')]=_0x3e2be6[_0x16ac('0x3f')];_0x4d5ace[_0x16ac('0x40')]=_0x3e2be6[_0x16ac('0x3c')];_0x4d5ace[_0x16ac('0x3e')]=_[_0x16ac('0x41')](_0x4d5ace[_0x16ac('0x3e')],[_0x16ac('0x42')],[_0x16ac('0x43')]);if(_0x4d5ace[_0x16ac('0x37')][_0x16ac('0x3f')]){delete _0x4d5ace[_0x16ac('0x37')]['Applications'];}if(_0x4d5ace[_0x16ac('0x37')]['List']&&_0x4d5ace[_0x16ac('0x37')][_0x16ac('0x3c')][_0x16ac('0x3a')][_0x16ac('0x44')]){return _0x4d5ace[_0x16ac('0x37')][_0x16ac('0x3c')][_0x16ac('0x3a')][0x0];}var _0x33d72c=_['defaults'](_0x540ed5[_0x16ac('0x26')],{'firstName':_0x540ed5[_0x16ac('0x26')][_0x16ac('0x31')],'ListId':_0x3e2be6[_0x16ac('0x30')]});_0x33d72c[_0x540ed5['body'][_0x16ac('0x35')]]=_0x540ed5[_0x16ac('0x26')][_0x16ac('0x31')];return db[_0x16ac('0x39')][_0x16ac('0x45')](_0x33d72c,{'fields':_0x584c52,'raw':!![]});}})[_0x16ac('0x13')](function(_0x2a5a15){_0x4d5ace[_0x16ac('0x46')]=_0x2a5a15;if(_0x2a5a15){var _0x19e6c4={'ContactId':_0x2a5a15['id'],'FaxAccountId':_0x540ed5[_0x16ac('0x37')]['id'],'fax':_0x2a5a15[_0x16ac('0x27')]};return db[_0x16ac('0x47')]['find']({'where':{'ContactId':_0x2a5a15['id'],'closed':![],'FaxAccountId':_0x540ed5[_0x16ac('0x37')]['id']}})[_0x16ac('0x13')](function(_0x14423c){if(_0x14423c){return[_0x14423c,![]];}return db['FaxInteraction'][_0x16ac('0x45')](_0x19e6c4)[_0x16ac('0x13')](function(_0x3bdcd7){return[_0x3bdcd7,!![]];});});}else{throw new Error(_0x16ac('0x48'));}})[_0x16ac('0x49')](function(_0x35fb6a,_0x12ac24){var _0x5509cc=_0x35fb6a[_0x16ac('0x3d')]({'plain':!![]});if(_0x12ac24){if(_0x4d5ace[_0x16ac('0x37')]['autoclose']){_0x4d5ace[_0x16ac('0x3e')][_0x16ac('0x4a')]({'id':0x0,'priority':_0x4d5ace[_0x16ac('0x3e')][_0x16ac('0x44')]+0x1,'app':'close','appdata':_0x16ac('0x4b'),'interval':_0x16ac('0x4c')});}_0x5509cc[_0x16ac('0x4d')]=!![];}else{_0x5509cc[_0x16ac('0x4d')]=![];}_0x4d5ace[_0x16ac('0x4e')]=_0x5509cc;return db['FaxMessage'][_0x16ac('0x45')]({'body':_0x540ed5[_0x16ac('0x26')][_0x16ac('0x26')],'FaxAccountId':_0x540ed5[_0x16ac('0x37')]['id'],'FaxInteractionId':_0x35fb6a['id'],'direction':'in','ContactId':_0x35fb6a[_0x16ac('0x4f')],'AttachmentId':_0x540ed5[_0x16ac('0x26')][_0x16ac('0x50')]});})[_0x16ac('0x13')](function(_0x5c29bf){_0x4d5ace[_0x16ac('0x19')]=_0x5c29bf;if(_0x4d5ace[_0x16ac('0x4e')]['UserId']){return db[_0x16ac('0x51')][_0x16ac('0x52')]({'attributes':['id',_0x16ac('0x53')],'where':{'id':_0x4d5ace[_0x16ac('0x4e')]['UserId']}})[_0x16ac('0x13')](function(_0x137c0a){if(_0x137c0a){_0x4d5ace[_0x16ac('0x3e')][_0x16ac('0x54')]({'id':0x0,'priority':0x0,'app':_0x16ac('0x55'),'appdata':_0x137c0a[_0x16ac('0x53')]+','+(_0x4d5ace['account'][_0x16ac('0x56')]||0xa),'interval':_0x16ac('0x4c')});}return respondWithRpcPromise(_0x16ac('0x57'),_0x16ac('0x58'),_0x4d5ace);});}return respondWithRpcPromise(_0x16ac('0x57'),'startRouting',_0x4d5ace);})[_0x16ac('0x13')](function(_0xfe984){_0x449599(_0xfe984);})[_0x16ac('0x1a')](function(_0x97d25b){_0x4c1367(_0x14618f[_0x16ac('0x17')](0x1f4,_0x97d25b['message']));});});}; \ No newline at end of file +var _0x2955=['Applications','get','applications','orderBy','priority','asc','length','ListId','CmContact','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','GetFaxAccount','FaxAccount','options','raw','limit','map','include','attributes','model','then','NotifyFaxAccount','body','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','FaxApplication'];(function(_0xa0d625,_0x59f4bd){var _0x1ec65a=function(_0x2b2817){while(--_0x2b2817){_0xa0d625['push'](_0xa0d625['shift']());}};_0x1ec65a(++_0x59f4bd);}(_0x2955,0xc6));var _0x5295=function(_0x2d3022,_0x656412){_0x2d3022=_0x2d3022-0x0;var _0x4d475c=_0x2955[_0x2d3022];return _0x4d475c;};'use strict';var _=require('lodash');var util=require(_0x5295('0x0'));var moment=require(_0x5295('0x1'));var BPromise=require(_0x5295('0x2'));var rs=require(_0x5295('0x3'));var fs=require('fs');var Redis=require(_0x5295('0x4'));var db=require(_0x5295('0x5'))['db'];var utils=require(_0x5295('0x6'));var logger=require(_0x5295('0x7'))(_0x5295('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5295('0x9')][_0x5295('0xa')]({'port':0x232c});config[_0x5295('0xb')]=_[_0x5295('0xc')](config['redis'],{'host':_0x5295('0xd'),'port':0x18eb});var socket=require(_0x5295('0xe'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x5295('0xf')](socket);function respondWithRpcPromise(_0x6101f1,_0x44e798,_0x3352f8){return new BPromise(function(_0x3c5321,_0x453add){return client[_0x5295('0x10')](_0x6101f1,_0x3352f8)['then'](function(_0x2a1959){logger['info']('FaxAccount,\x20%s,\x20%s',_0x44e798,'request\x20sent');logger[_0x5295('0x11')](_0x5295('0x12'),_0x44e798,_0x5295('0x13'),JSON[_0x5295('0x14')](_0x2a1959));if(_0x2a1959['error']){if(_0x2a1959[_0x5295('0x15')][_0x5295('0x16')]===0x1f4){logger['error'](_0x5295('0x17'),_0x44e798,_0x2a1959[_0x5295('0x15')][_0x5295('0x18')]);return _0x453add(_0x2a1959[_0x5295('0x15')]['message']);}logger[_0x5295('0x15')](_0x5295('0x17'),_0x44e798,_0x2a1959[_0x5295('0x15')]['message']);return _0x3c5321(_0x2a1959['error'][_0x5295('0x18')]);}else{logger[_0x5295('0x19')](_0x5295('0x17'),_0x44e798,_0x5295('0x13'));_0x3c5321(_0x2a1959['result'][_0x5295('0x18')]);}})[_0x5295('0x1a')](function(_0xa5abbc){logger['error']('FaxAccount,\x20%s,\x20%s',_0x44e798,_0xa5abbc);_0x453add(_0xa5abbc);});});}exports[_0x5295('0x1b')]=function(_0xc2deff){var _0x286bf0=this;return new Promise(function(_0x9d8474,_0xf01464){return db[_0x5295('0x1c')]['findAll']({'raw':_0xc2deff[_0x5295('0x1d')]?_0xc2deff[_0x5295('0x1d')][_0x5295('0x1e')]===undefined?!![]:![]:!![],'where':_0xc2deff[_0x5295('0x1d')]?_0xc2deff[_0x5295('0x1d')]['where']||null:null,'attributes':_0xc2deff[_0x5295('0x1d')]?_0xc2deff[_0x5295('0x1d')]['attributes']||null:null,'limit':_0xc2deff[_0x5295('0x1d')]?_0xc2deff['options'][_0x5295('0x1f')]||null:null,'include':_0xc2deff[_0x5295('0x1d')]?_0xc2deff['options']['include']?_[_0x5295('0x20')](_0xc2deff[_0x5295('0x1d')][_0x5295('0x21')],function(_0x67a03f){return{'model':db[_0x67a03f['model']],'as':_0x67a03f['as'],'attributes':_0x67a03f[_0x5295('0x22')],'include':_0x67a03f['include']?_[_0x5295('0x20')](_0x67a03f[_0x5295('0x21')],function(_0x5299ec){return{'model':db[_0x5299ec[_0x5295('0x23')]],'as':_0x5299ec['as'],'attributes':_0x5299ec[_0x5295('0x22')],'include':_0x5299ec[_0x5295('0x21')]?_[_0x5295('0x20')](_0x5299ec[_0x5295('0x21')],function(_0x3132b9){return{'model':db[_0x3132b9[_0x5295('0x23')]],'as':_0x3132b9['as'],'attributes':_0x3132b9[_0x5295('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5295('0x24')](function(_0x29bb02){logger[_0x5295('0x19')](_0x5295('0x1b'),_0xc2deff);logger[_0x5295('0x11')](_0x5295('0x1b'),_0xc2deff,JSON['stringify'](_0x29bb02));_0x9d8474(_0x29bb02);})['catch'](function(_0xa69894){logger['error'](_0x5295('0x1b'),_0xa69894[_0x5295('0x18')],_0xc2deff);_0xf01464(_0x286bf0[_0x5295('0x15')](0x1f4,_0xa69894[_0x5295('0x18')]));});});};exports[_0x5295('0x25')]=function(_0x191f88,_0x425a8e,_0x18cd29){var _0x2a45a8=this;return new Promise(function(_0x3bb15b,_0x13894a){var _0x215196={'body':_0x191f88[_0x5295('0x26')],'channel':_0x5295('0x27')};var _0x1f41f6=[];var _0x547980=[];var _0x541ae5={};return db['CmContact']['describe']()['then'](function(_0x53e549){if(!_0x53e549){throw new db[(_0x5295('0x28'))][(_0x5295('0x29'))](_0x5295('0x2a'));}_0x1f41f6=_[_0x5295('0x2b')](_[_0x5295('0x2c')](_0x53e549),[_0x5295('0x2d'),_0x5295('0x2e')]);_0x547980=_['difference'](_[_0x5295('0x2c')](_0x53e549),['createdAt',_0x5295('0x2e'),'CompanyId','ListId']);if(_0x191f88[_0x5295('0x26')]['id']){delete _0x191f88[_0x5295('0x26')]['id'];}if(_[_0x5295('0x2f')](_0x191f88[_0x5295('0x26')][_0x5295('0x30')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x5295('0x2f')](_0x191f88[_0x5295('0x26')][_0x5295('0x26')])||_0x191f88[_0x5295('0x26')]['body']===''){throw new db[(_0x5295('0x28'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5295('0x2f')](_0x191f88[_0x5295('0x26')][_0x5295('0x31')])){throw new db[(_0x5295('0x28'))][(_0x5295('0x29'))](_0x5295('0x32')+_0x547980);}if(!_[_0x5295('0x33')](_0x547980,_0x191f88[_0x5295('0x26')]['mapKey'])){throw new db[(_0x5295('0x28'))][(_0x5295('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x547980);}_0x541ae5[_0x191f88['body'][_0x5295('0x31')]]=_0x191f88['body']['from'];})[_0x5295('0x24')](function(){return db[_0x5295('0x1c')][_0x5295('0x34')]({'where':{'id':_0x191f88[_0x5295('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x5295('0x36'),'include':[{'model':db['CmContact'],'as':_0x5295('0x37'),'where':_0x541ae5,'limit':0x1,'order':[[_0x5295('0x2e'),'DESC']]}]},{'model':db[_0x5295('0x38')],'as':_0x5295('0x39')}]});})[_0x5295('0x24')](function(_0x424852){if(_0x424852&&_0x424852['List']){var _0x33299e=_0x424852[_0x5295('0x3a')]({'plain':!![]});_0x215196[_0x5295('0x35')]=_0x33299e;_0x215196[_0x5295('0x3b')]=_0x33299e['Applications'];_0x215196['list']=_0x33299e['List'];_0x215196['applications']=_[_0x5295('0x3c')](_0x215196[_0x5295('0x3b')],[_0x5295('0x3d')],[_0x5295('0x3e')]);if(_0x215196[_0x5295('0x35')][_0x5295('0x39')]){delete _0x215196[_0x5295('0x35')][_0x5295('0x39')];}if(_0x215196[_0x5295('0x35')][_0x5295('0x36')]&&_0x215196[_0x5295('0x35')]['List']['Contacts'][_0x5295('0x3f')]){return _0x215196[_0x5295('0x35')][_0x5295('0x36')][_0x5295('0x37')][0x0];}var _0x1e4d8b=_['defaults'](_0x191f88[_0x5295('0x26')],{'firstName':_0x191f88[_0x5295('0x26')]['from'],'ListId':_0x33299e[_0x5295('0x40')]});_0x1e4d8b[_0x191f88[_0x5295('0x26')][_0x5295('0x31')]]=_0x191f88['body']['from'];return db[_0x5295('0x41')][_0x5295('0x42')](_0x1e4d8b,{'fields':_0x1f41f6,'raw':!![]});}})[_0x5295('0x24')](function(_0x39fa88){_0x215196['contact']=_0x39fa88;if(_0x39fa88){var _0x2da6e0={'ContactId':_0x39fa88['id'],'FaxAccountId':_0x191f88['account']['id'],'fax':_0x39fa88[_0x5295('0x27')]};return db[_0x5295('0x43')][_0x5295('0x34')]({'where':{'ContactId':_0x39fa88['id'],'closed':![],'FaxAccountId':_0x191f88[_0x5295('0x35')]['id']}})[_0x5295('0x24')](function(_0x2f51e0){if(_0x2f51e0){return[_0x2f51e0,![]];}return db[_0x5295('0x43')][_0x5295('0x42')](_0x2da6e0)['then'](function(_0x521e13){return[_0x521e13,!![]];});});}else{throw new Error(_0x5295('0x44'));}})[_0x5295('0x45')](function(_0x431608,_0x5ca450){var _0x33e2fb=_0x431608[_0x5295('0x3a')]({'plain':!![]});if(_0x5ca450){if(_0x215196['account'][_0x5295('0x46')]){_0x215196[_0x5295('0x3b')]['push']({'id':0x0,'priority':_0x215196[_0x5295('0x3b')]['length']+0x1,'app':_0x5295('0x47'),'appdata':_0x5295('0x48'),'interval':_0x5295('0x49')});}_0x33e2fb[_0x5295('0x4a')]=!![];}else{_0x33e2fb[_0x5295('0x4a')]=![];}_0x215196['interaction']=_0x33e2fb;return db[_0x5295('0x4b')][_0x5295('0x42')]({'body':_0x191f88[_0x5295('0x26')][_0x5295('0x26')],'FaxAccountId':_0x191f88[_0x5295('0x35')]['id'],'FaxInteractionId':_0x431608['id'],'direction':'in','ContactId':_0x431608[_0x5295('0x4c')],'AttachmentId':_0x191f88[_0x5295('0x26')]['AttachmentId']});})[_0x5295('0x24')](function(_0x1dd930){_0x215196['message']=_0x1dd930;if(_0x215196[_0x5295('0x4d')][_0x5295('0x4e')]){return db[_0x5295('0x4f')]['find']({'attributes':['id',_0x5295('0x50')],'where':{'id':_0x215196['interaction'][_0x5295('0x4e')]}})[_0x5295('0x24')](function(_0x18be3b){if(_0x18be3b){_0x215196[_0x5295('0x3b')][_0x5295('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x18be3b[_0x5295('0x50')]+','+(_0x215196[_0x5295('0x35')][_0x5295('0x52')]||0xa),'interval':_0x5295('0x49')});}return respondWithRpcPromise(_0x5295('0x53'),_0x5295('0x54'),_0x215196);});}return respondWithRpcPromise(_0x5295('0x53'),_0x5295('0x54'),_0x215196);})[_0x5295('0x24')](function(_0x5b041f){_0x3bb15b(_0x5b041f);})[_0x5295('0x1a')](function(_0x2261ff){_0x13894a(_0x2a45a8[_0x5295('0x15')](0x1f4,_0x2261ff['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cf7a179..417a64f 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(_0x36aae4,_0x75c5a9){var _0x39de4a=function(_0x1967d2){while(--_0x1967d2){_0x36aae4['push'](_0x36aae4['shift']());}};_0x39de4a(++_0x75c5a9);}(_0x81c6,0x1d5));var _0x681c=function(_0x4bc532,_0x42f9c5){_0x4bc532=_0x4bc532-0x0;var _0x2b20f1=_0x81c6[_0x4bc532];return _0x2b20f1;};'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 _0xafc4=['register','length','faxAccount:','./faxAccount.events','remove','emit'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0xafc4,0x69));var _0x4afc=function(_0x14b9da,_0x46a9c1){_0x14b9da=_0x14b9da-0x0;var _0x1ad2d4=_0xafc4[_0x14b9da];return _0x1ad2d4;};'use strict';var FaxAccountEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){FaxAccountEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);FaxAccountEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 2fcd1ba..8e61375 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 _0x110c=['removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','update','delete','removeDispositions','removeAnswers'];(function(_0x732635,_0x1f1c24){var _0x4b6fff=function(_0x2c34c8){while(--_0x2c34c8){_0x732635['push'](_0x732635['shift']());}};_0x4b6fff(++_0x1f1c24);}(_0x110c,0x1ee));var _0xc110=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x110c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xc110('0x0'));var util=require('util');var path=require(_0xc110('0x1'));var timeout=require(_0xc110('0x2'));var express=require('express');var router=express[_0xc110('0x3')]();var fs_extra=require(_0xc110('0x4'));var auth=require(_0xc110('0x5'));var interaction=require(_0xc110('0x6'));var config=require(_0xc110('0x7'));var controller=require(_0xc110('0x8'));router[_0xc110('0x9')]('/',auth[_0xc110('0xa')](),controller[_0xc110('0xb')]);router['get'](_0xc110('0xc'),auth[_0xc110('0xa')](),controller['describe']);router['get'](_0xc110('0xd'),auth['isAuthenticated'](),controller[_0xc110('0xe')]);router['get'](_0xc110('0xf'),auth['isAuthenticated'](),controller[_0xc110('0x10')]);router['get'](_0xc110('0x11'),auth[_0xc110('0xa')](),controller[_0xc110('0x12')]);router[_0xc110('0x9')](_0xc110('0x13'),auth[_0xc110('0xa')](),controller[_0xc110('0x14')]);router[_0xc110('0x9')](_0xc110('0x15'),auth[_0xc110('0xa')](),controller[_0xc110('0x16')]);router[_0xc110('0x9')](_0xc110('0x17'),auth['isAuthenticated'](),controller['getMessages']);router[_0xc110('0x9')](_0xc110('0x18'),auth['isAuthenticated'](),controller[_0xc110('0x19')]);router[_0xc110('0x1a')]('/',auth[_0xc110('0xa')](),controller['create']);router[_0xc110('0x1a')](_0xc110('0xf'),auth['isAuthenticated'](),controller[_0xc110('0x1b')]);router[_0xc110('0x1a')]('/:id/canned_answers',auth[_0xc110('0xa')](),controller[_0xc110('0x1c')]);router[_0xc110('0x1a')](_0xc110('0x13'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xc110('0x1a')](_0xc110('0x15'),auth[_0xc110('0xa')](),controller[_0xc110('0x1d')]);router[_0xc110('0x1a')](_0xc110('0x1e'),auth[_0xc110('0xa')](),controller[_0xc110('0x1f')]);router[_0xc110('0x1a')](_0xc110('0x20'),auth[_0xc110('0xa')](),controller[_0xc110('0x21')]);router[_0xc110('0x1a')](_0xc110('0x22'),auth['isAuthenticated'](),controller['send']);router[_0xc110('0x1a')](_0xc110('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc110('0xd'),auth[_0xc110('0xa')](),controller[_0xc110('0x23')]);router[_0xc110('0x24')](_0xc110('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xc110('0xf'),auth['isAuthenticated'](),controller[_0xc110('0x25')]);router[_0xc110('0x24')](_0xc110('0x11'),auth[_0xc110('0xa')](),controller[_0xc110('0x26')]);router[_0xc110('0x24')](_0xc110('0x18'),auth[_0xc110('0xa')](),controller[_0xc110('0x27')]);module[_0xc110('0x28')]=router; \ No newline at end of file +var _0xdf2c=['index','/describe','describe','/:id','show','get','/:id/dispositions','getDispositions','getAnswers','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/interactions','addApplications','/addaccountapplications','addAccountApplications','send','put','update','delete','removeDispositions','removeAgents','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x14aed8,_0x523f1c){var _0x3349c4=function(_0x2bc0a7){while(--_0x2bc0a7){_0x14aed8['push'](_0x14aed8['shift']());}};_0x3349c4(++_0x523f1c);}(_0xdf2c,0x16b));var _0xcdf2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xdf2c[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcdf2('0x0'));var express=require(_0xcdf2('0x1'));var router=express[_0xcdf2('0x2')]();var fs_extra=require(_0xcdf2('0x3'));var auth=require(_0xcdf2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcdf2('0x5'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x7')]);router['get'](_0xcdf2('0x8'),auth['isAuthenticated'](),controller[_0xcdf2('0x9')]);router['get'](_0xcdf2('0xa'),auth[_0xcdf2('0x6')](),controller[_0xcdf2('0xb')]);router[_0xcdf2('0xc')](_0xcdf2('0xd'),auth[_0xcdf2('0x6')](),controller[_0xcdf2('0xe')]);router[_0xcdf2('0xc')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xcdf2('0xf')]);router[_0xcdf2('0xc')]('/:id/interactions',auth[_0xcdf2('0x6')](),controller['getInteractions']);router[_0xcdf2('0xc')](_0xcdf2('0x10'),auth[_0xcdf2('0x6')](),controller['getApplications']);router[_0xcdf2('0xc')](_0xcdf2('0x11'),auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x12')]);router[_0xcdf2('0xc')](_0xcdf2('0x13'),auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x14')]);router[_0xcdf2('0x15')]('/',auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x16')]);router['post'](_0xcdf2('0xd'),auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x17')]);router[_0xcdf2('0x15')](_0xcdf2('0x18'),auth['isAuthenticated'](),controller[_0xcdf2('0x19')]);router[_0xcdf2('0x15')](_0xcdf2('0x1a'),auth[_0xcdf2('0x6')](),controller['addInteraction']);router[_0xcdf2('0x15')](_0xcdf2('0x10'),auth['isAuthenticated'](),controller[_0xcdf2('0x1b')]);router[_0xcdf2('0x15')](_0xcdf2('0x1c'),auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x1d')]);router[_0xcdf2('0x15')]('/updateaccountapplications',auth[_0xcdf2('0x6')](),controller['updateAccountApplications']);router[_0xcdf2('0x15')]('/:id/send',auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x1e')]);router[_0xcdf2('0x15')]('/:id/users',auth[_0xcdf2('0x6')](),controller['addAgents']);router[_0xcdf2('0x1f')]('/:id',auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x20')]);router[_0xcdf2('0x21')]('/:id',auth[_0xcdf2('0x6')](),controller['destroy']);router[_0xcdf2('0x21')](_0xcdf2('0xd'),auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x22')]);router[_0xcdf2('0x21')](_0xcdf2('0x18'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xcdf2('0x21')](_0xcdf2('0x13'),auth[_0xcdf2('0x6')](),controller[_0xcdf2('0x23')]);module[_0xcdf2('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e0179ee..607eb0f 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 _0xc051=['STRING','sequelize','exports','noop','TEXT'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc051,0xb5));var _0x1c05=function(_0x36d5d8,_0x94ba7c){_0x36d5d8=_0x36d5d8-0x0;var _0x2e1108=_0xc051[_0x36d5d8];return _0x2e1108;};'use strict';var Sequelize=require(_0x1c05('0x0'));module[_0x1c05('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1c05('0x2')},'appdata':{'type':Sequelize[_0x1c05('0x3')]()},'description':{'type':Sequelize[_0x1c05('0x4')]},'interval':{'type':Sequelize[_0x1c05('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6132=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x17dfad,_0x1be268){var _0x3f0966=function(_0x14df16){while(--_0x14df16){_0x17dfad['push'](_0x17dfad['shift']());}};_0x3f0966(++_0x1be268);}(_0x6132,0xf3));var _0x2613=function(_0x417af4,_0x3663ea){_0x417af4=_0x417af4-0x0;var _0x15379d=_0x6132[_0x417af4];return _0x15379d;};'use strict';var Sequelize=require('sequelize');module[_0x2613('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2613('0x1')],'allowNull':![],'defaultValue':_0x2613('0x2')},'appdata':{'type':Sequelize[_0x2613('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2613('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5043299..7ccf2d0 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 _0x1af5=['find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','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','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','fields','includeAll','create','body','params'];(function(_0x425af8,_0x366c35){var _0x5c2eb1=function(_0x44785f){while(--_0x44785f){_0x425af8['push'](_0x425af8['shift']());}};_0x5c2eb1(++_0x366c35);}(_0x1af5,0x17d));var _0x51af=function(_0x320a3b,_0x1894be){_0x320a3b=_0x320a3b-0x0;var _0x5895ca=_0x1af5[_0x320a3b];return _0x5895ca;};'use strict';var pdf=require(_0x51af('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x51af('0x1'));var zipdir=require(_0x51af('0x2'));var jsonpatch=require(_0x51af('0x3'));var rp=require(_0x51af('0x4'));var moment=require(_0x51af('0x5'));var BPromise=require(_0x51af('0x6'));var Mustache=require(_0x51af('0x7'));var util=require(_0x51af('0x8'));var path=require(_0x51af('0x9'));var sox=require(_0x51af('0xa'));var csv=require(_0x51af('0xb'));var ejs=require(_0x51af('0xc'));var fs=require('fs');var fs_extra=require(_0x51af('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x51af('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51af('0xf'));var toCsv=require(_0x51af('0xb'));var querystring=require(_0x51af('0x10'));var Papa=require(_0x51af('0x11'));var Redis=require(_0x51af('0x12'));var authService=require(_0x51af('0x13'));var qs=require(_0x51af('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51af('0x15'));var logger=require(_0x51af('0x16'))(_0x51af('0x17'));var utils=require(_0x51af('0x18'));var config=require(_0x51af('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x51af('0x1a'))['db'];function respondWithStatusCode(_0x50b48d,_0x24eca2){_0x24eca2=_0x24eca2||0xcc;return function(_0x4c7bf4){if(_0x4c7bf4){return _0x50b48d[_0x51af('0x1b')](_0x24eca2);}return _0x50b48d[_0x51af('0x1c')](_0x24eca2)[_0x51af('0x1d')]();};}function respondWithResult(_0x5d5d40,_0x432a5d){_0x432a5d=_0x432a5d||0xc8;return function(_0x2800d1){if(_0x2800d1){return _0x5d5d40[_0x51af('0x1c')](_0x432a5d)[_0x51af('0x1e')](_0x2800d1);}};}function respondWithFilteredResult(_0x51f544,_0x32ea74){return function(_0x255e7e){if(_0x255e7e){var _0x319ebf=_0x255e7e[_0x51af('0x1f')],_0x519b9c=_0x32ea74[_0x51af('0x20')],_0x4970f5=_0x32ea74['offset']+_0x32ea74[_0x51af('0x21')],_0xb234e4;if(_0x4970f5>=_0x319ebf){_0x4970f5=_0x319ebf;_0xb234e4=0xc8;}else{_0xb234e4=0xce;}_0x51f544[_0x51af('0x1c')](_0xb234e4);return _0x51f544[_0x51af('0x22')](_0x51af('0x23'),_0x519b9c+'-'+_0x4970f5+'/'+_0x319ebf)[_0x51af('0x1e')](_0x255e7e);}return null;};}function patchUpdates(_0x23d8df){return function(_0x846c79){try{jsonpatch[_0x51af('0x24')](_0x846c79,_0x23d8df,!![]);}catch(_0x11e2e8){return BPromise['reject'](_0x11e2e8);}return _0x846c79['save']();};}function saveUpdates(_0x733b3b,_0x21df00){return function(_0x233e9e){if(_0x233e9e){return _0x233e9e[_0x51af('0x25')](_0x733b3b)[_0x51af('0x26')](function(_0x4962a9){return _0x4962a9;});}return null;};}function removeEntity(_0x31f4c0,_0x5a7360){return function(_0x59d0fe){if(_0x59d0fe){return _0x59d0fe[_0x51af('0x27')]()['then'](function(){_0x31f4c0[_0x51af('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e47d3,_0x44d35c){return function(_0x55382b){if(!_0x55382b){_0x5e47d3['sendStatus'](0x194);}return _0x55382b;};}function handleError(_0x44f791,_0x4e771f){_0x4e771f=_0x4e771f||0x1f4;return function(_0x3f725a){logger[_0x51af('0x28')](_0x3f725a[_0x51af('0x29')]);if(_0x3f725a[_0x51af('0x2a')]){delete _0x3f725a['name'];}_0x44f791[_0x51af('0x1c')](_0x4e771f)[_0x51af('0x2b')](_0x3f725a);};}exports[_0x51af('0x2c')]=function(_0x3d5130,_0x45cf25){var _0x192e8d={},_0x36647f={},_0x58866a={'count':0x0,'rows':[]};var _0x203d49=_[_0x51af('0x2d')](db[_0x51af('0x2e')][_0x51af('0x2f')],function(_0x20da9b){return{'name':_0x20da9b[_0x51af('0x30')],'type':_0x20da9b['type'][_0x51af('0x31')]};});_0x36647f['model']=_['map'](_0x203d49,_0x51af('0x2a'));_0x36647f[_0x51af('0x32')]=_[_0x51af('0x33')](_0x3d5130[_0x51af('0x32')]);_0x36647f[_0x51af('0x34')]=_[_0x51af('0x35')](_0x36647f['model'],_0x36647f[_0x51af('0x32')]);_0x192e8d['attributes']=_['intersection'](_0x36647f[_0x51af('0x36')],qs['fields'](_0x3d5130['query']['fields']));_0x192e8d['attributes']=_0x192e8d[_0x51af('0x37')][_0x51af('0x38')]?_0x192e8d[_0x51af('0x37')]:_0x36647f[_0x51af('0x36')];if(!_0x3d5130['query']['hasOwnProperty'](_0x51af('0x39'))){_0x192e8d[_0x51af('0x21')]=qs[_0x51af('0x21')](_0x3d5130[_0x51af('0x32')][_0x51af('0x21')]);_0x192e8d[_0x51af('0x20')]=qs[_0x51af('0x20')](_0x3d5130['query'][_0x51af('0x20')]);}_0x192e8d[_0x51af('0x3a')]=qs[_0x51af('0x3b')](_0x3d5130[_0x51af('0x32')]['sort']);_0x192e8d[_0x51af('0x3c')]=qs[_0x51af('0x34')](_['pick'](_0x3d5130[_0x51af('0x32')],_0x36647f[_0x51af('0x34')]),_0x203d49);if(_0x3d5130[_0x51af('0x32')][_0x51af('0x3d')]){_0x192e8d[_0x51af('0x3c')]=_[_0x51af('0x3e')](_0x192e8d[_0x51af('0x3c')],{'$or':_[_0x51af('0x2d')](_0x203d49,function(_0x80c083){if(_0x80c083[_0x51af('0x3f')]!==_0x51af('0x40')){var _0x2f1e43={};_0x2f1e43[_0x80c083['name']]={'$like':'%'+_0x3d5130[_0x51af('0x32')][_0x51af('0x3d')]+'%'};return _0x2f1e43;}})});}_0x192e8d=_[_0x51af('0x3e')]({},_0x192e8d,_0x3d5130[_0x51af('0x41')]);var _0x3aa80a={'where':_0x192e8d[_0x51af('0x3c')]};return db['FaxApplication'][_0x51af('0x1f')](_0x3aa80a)[_0x51af('0x26')](function(_0x3a56b7){_0x58866a[_0x51af('0x1f')]=_0x3a56b7;if(_0x3d5130[_0x51af('0x32')]['includeAll']){_0x192e8d[_0x51af('0x42')]=[{'all':!![]}];}return db[_0x51af('0x2e')][_0x51af('0x43')](_0x192e8d);})[_0x51af('0x26')](function(_0x1b6472){_0x58866a['rows']=_0x1b6472;return _0x58866a;})['then'](respondWithFilteredResult(_0x45cf25,_0x192e8d))[_0x51af('0x44')](handleError(_0x45cf25,null));};exports[_0x51af('0x45')]=function(_0x54fb63,_0x566f4a){var _0x442441={'raw':!![],'where':{'id':_0x54fb63['params']['id']}},_0x39d0b9={};_0x39d0b9[_0x51af('0x36')]=_['keys'](db[_0x51af('0x2e')][_0x51af('0x2f')]);_0x39d0b9[_0x51af('0x32')]=_[_0x51af('0x33')](_0x54fb63[_0x51af('0x32')]);_0x39d0b9[_0x51af('0x34')]=_['intersection'](_0x39d0b9[_0x51af('0x36')],_0x39d0b9['query']);_0x442441['attributes']=_['intersection'](_0x39d0b9[_0x51af('0x36')],qs[_0x51af('0x46')](_0x54fb63[_0x51af('0x32')][_0x51af('0x46')]));_0x442441[_0x51af('0x37')]=_0x442441[_0x51af('0x37')][_0x51af('0x38')]?_0x442441[_0x51af('0x37')]:_0x39d0b9[_0x51af('0x36')];if(_0x54fb63['query'][_0x51af('0x47')]){_0x442441['include']=[{'all':!![]}];}_0x442441=_['merge']({},_0x442441,_0x54fb63[_0x51af('0x41')]);return db['FaxApplication']['find'](_0x442441)[_0x51af('0x26')](handleEntityNotFound(_0x566f4a,null))[_0x51af('0x26')](respondWithResult(_0x566f4a,null))[_0x51af('0x44')](handleError(_0x566f4a,null));};exports['create']=function(_0x1a762c,_0x71bb8d){return db[_0x51af('0x2e')][_0x51af('0x48')](_0x1a762c[_0x51af('0x49')],{})[_0x51af('0x26')](respondWithResult(_0x71bb8d,0xc9))[_0x51af('0x44')](handleError(_0x71bb8d,null));};exports['update']=function(_0x5450e9,_0x1b1f48){if(_0x5450e9['body']['id']){delete _0x5450e9[_0x51af('0x49')]['id'];}return db[_0x51af('0x2e')]['find']({'where':{'id':_0x5450e9[_0x51af('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b1f48,null))[_0x51af('0x26')](saveUpdates(_0x5450e9[_0x51af('0x49')],null))[_0x51af('0x26')](respondWithResult(_0x1b1f48,null))['catch'](handleError(_0x1b1f48,null));};exports['destroy']=function(_0x45ad13,_0x574b15){return db[_0x51af('0x2e')][_0x51af('0x4b')]({'where':{'id':_0x45ad13[_0x51af('0x4a')]['id']}})[_0x51af('0x26')](handleEntityNotFound(_0x574b15,null))[_0x51af('0x26')](removeEntity(_0x574b15,null))[_0x51af('0x44')](handleError(_0x574b15,null));}; \ No newline at end of file +var _0x979e=['stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','apply','reject','save','update','destroy'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x979e,0x195));var _0xe979=function(_0x3c4249,_0x11242e){_0x3c4249=_0x3c4249-0x0;var _0x8fbd5e=_0x979e[_0x3c4249];return _0x8fbd5e;};'use strict';var pdf=require(_0xe979('0x0'));var emlformat=require(_0xe979('0x1'));var rimraf=require(_0xe979('0x2'));var zipdir=require(_0xe979('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe979('0x4'));var moment=require(_0xe979('0x5'));var BPromise=require(_0xe979('0x6'));var Mustache=require(_0xe979('0x7'));var util=require(_0xe979('0x8'));var path=require('path');var sox=require(_0xe979('0x9'));var csv=require('to-csv');var ejs=require(_0xe979('0xa'));var fs=require('fs');var fs_extra=require(_0xe979('0xb'));var _=require(_0xe979('0xc'));var squel=require(_0xe979('0xd'));var crypto=require(_0xe979('0xe'));var jsforce=require(_0xe979('0xf'));var deskjs=require(_0xe979('0x10'));var toCsv=require(_0xe979('0x11'));var querystring=require(_0xe979('0x12'));var Papa=require(_0xe979('0x13'));var Redis=require(_0xe979('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe979('0x15'));var as=require(_0xe979('0x16'));var hardwareService=require(_0xe979('0x17'));var logger=require('../../config/logger')(_0xe979('0x18'));var utils=require(_0xe979('0x19'));var config=require(_0xe979('0x1a'));var licenseUtil=require(_0xe979('0x1b'));var db=require(_0xe979('0x1c'))['db'];function respondWithStatusCode(_0x1170c6,_0x76e6e5){_0x76e6e5=_0x76e6e5||0xcc;return function(_0x29fdd7){if(_0x29fdd7){return _0x1170c6['sendStatus'](_0x76e6e5);}return _0x1170c6[_0xe979('0x1d')](_0x76e6e5)[_0xe979('0x1e')]();};}function respondWithResult(_0x1f7a6d,_0x4c56eb){_0x4c56eb=_0x4c56eb||0xc8;return function(_0x5e6079){if(_0x5e6079){return _0x1f7a6d[_0xe979('0x1d')](_0x4c56eb)[_0xe979('0x1f')](_0x5e6079);}};}function respondWithFilteredResult(_0x1ae6a2,_0x218ce0){return function(_0x49de62){if(_0x49de62){var _0x10ed22=_0x49de62[_0xe979('0x20')],_0x93e48c=_0x218ce0[_0xe979('0x21')],_0xcb7fa1=_0x218ce0[_0xe979('0x21')]+_0x218ce0['limit'],_0xbab2b0;if(_0xcb7fa1>=_0x10ed22){_0xcb7fa1=_0x10ed22;_0xbab2b0=0xc8;}else{_0xbab2b0=0xce;}_0x1ae6a2[_0xe979('0x1d')](_0xbab2b0);return _0x1ae6a2['set']('Content-Range',_0x93e48c+'-'+_0xcb7fa1+'/'+_0x10ed22)[_0xe979('0x1f')](_0x49de62);}return null;};}function patchUpdates(_0x2a8ffd){return function(_0xb99bbb){try{jsonpatch[_0xe979('0x22')](_0xb99bbb,_0x2a8ffd,!![]);}catch(_0x5d3cbe){return BPromise[_0xe979('0x23')](_0x5d3cbe);}return _0xb99bbb[_0xe979('0x24')]();};}function saveUpdates(_0x43207c,_0x641f44){return function(_0x27c6fb){if(_0x27c6fb){return _0x27c6fb[_0xe979('0x25')](_0x43207c)['then'](function(_0x19e171){return _0x19e171;});}return null;};}function removeEntity(_0x4a2d84,_0x37b1d4){return function(_0x358187){if(_0x358187){return _0x358187[_0xe979('0x26')]()['then'](function(){_0x4a2d84[_0xe979('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e0a0,_0x1151f0){return function(_0x3998b5){if(!_0x3998b5){_0x51e0a0['sendStatus'](0x194);}return _0x3998b5;};}function handleError(_0x31c614,_0x5bbfea){_0x5bbfea=_0x5bbfea||0x1f4;return function(_0x45dd65){logger['error'](_0x45dd65[_0xe979('0x27')]);if(_0x45dd65[_0xe979('0x28')]){delete _0x45dd65[_0xe979('0x28')];}_0x31c614[_0xe979('0x1d')](_0x5bbfea)[_0xe979('0x29')](_0x45dd65);};}exports['index']=function(_0x37150c,_0x5d35cc){var _0x17a0a4={},_0x192736={},_0x2b7fc4={'count':0x0,'rows':[]};var _0x53ada7=_[_0xe979('0x2a')](db[_0xe979('0x2b')][_0xe979('0x2c')],function(_0x2d7302){return{'name':_0x2d7302[_0xe979('0x2d')],'type':_0x2d7302['type'][_0xe979('0x2e')]};});_0x192736[_0xe979('0x2f')]=_[_0xe979('0x2a')](_0x53ada7,_0xe979('0x28'));_0x192736[_0xe979('0x30')]=_['keys'](_0x37150c[_0xe979('0x30')]);_0x192736[_0xe979('0x31')]=_['intersection'](_0x192736[_0xe979('0x2f')],_0x192736['query']);_0x17a0a4[_0xe979('0x32')]=_[_0xe979('0x33')](_0x192736[_0xe979('0x2f')],qs[_0xe979('0x34')](_0x37150c[_0xe979('0x30')]['fields']));_0x17a0a4['attributes']=_0x17a0a4['attributes'][_0xe979('0x35')]?_0x17a0a4[_0xe979('0x32')]:_0x192736[_0xe979('0x2f')];if(!_0x37150c['query'][_0xe979('0x36')](_0xe979('0x37'))){_0x17a0a4[_0xe979('0x38')]=qs['limit'](_0x37150c[_0xe979('0x30')][_0xe979('0x38')]);_0x17a0a4[_0xe979('0x21')]=qs[_0xe979('0x21')](_0x37150c[_0xe979('0x30')][_0xe979('0x21')]);}_0x17a0a4[_0xe979('0x39')]=qs[_0xe979('0x3a')](_0x37150c[_0xe979('0x30')][_0xe979('0x3a')]);_0x17a0a4[_0xe979('0x3b')]=qs[_0xe979('0x31')](_['pick'](_0x37150c[_0xe979('0x30')],_0x192736[_0xe979('0x31')]),_0x53ada7);if(_0x37150c[_0xe979('0x30')][_0xe979('0x3c')]){_0x17a0a4['where']=_[_0xe979('0x3d')](_0x17a0a4['where'],{'$or':_[_0xe979('0x2a')](_0x53ada7,function(_0x97b102){if(_0x97b102['type']!==_0xe979('0x3e')){var _0x58b217={};_0x58b217[_0x97b102['name']]={'$like':'%'+_0x37150c['query'][_0xe979('0x3c')]+'%'};return _0x58b217;}})});}_0x17a0a4=_['merge']({},_0x17a0a4,_0x37150c[_0xe979('0x3f')]);var _0xab7f0d={'where':_0x17a0a4[_0xe979('0x3b')]};return db[_0xe979('0x2b')][_0xe979('0x20')](_0xab7f0d)['then'](function(_0x3bc689){_0x2b7fc4[_0xe979('0x20')]=_0x3bc689;if(_0x37150c[_0xe979('0x30')][_0xe979('0x40')]){_0x17a0a4[_0xe979('0x41')]=[{'all':!![]}];}return db[_0xe979('0x2b')][_0xe979('0x42')](_0x17a0a4);})[_0xe979('0x43')](function(_0x31c818){_0x2b7fc4[_0xe979('0x44')]=_0x31c818;return _0x2b7fc4;})[_0xe979('0x43')](respondWithFilteredResult(_0x5d35cc,_0x17a0a4))[_0xe979('0x45')](handleError(_0x5d35cc,null));};exports['show']=function(_0x24f293,_0x4533c7){var _0x4ab855={'raw':!![],'where':{'id':_0x24f293[_0xe979('0x46')]['id']}},_0xcda10e={};_0xcda10e[_0xe979('0x2f')]=_['keys'](db['FaxApplication']['rawAttributes']);_0xcda10e['query']=_['keys'](_0x24f293['query']);_0xcda10e[_0xe979('0x31')]=_[_0xe979('0x33')](_0xcda10e['model'],_0xcda10e[_0xe979('0x30')]);_0x4ab855[_0xe979('0x32')]=_[_0xe979('0x33')](_0xcda10e[_0xe979('0x2f')],qs[_0xe979('0x34')](_0x24f293['query'][_0xe979('0x34')]));_0x4ab855[_0xe979('0x32')]=_0x4ab855['attributes'][_0xe979('0x35')]?_0x4ab855[_0xe979('0x32')]:_0xcda10e[_0xe979('0x2f')];if(_0x24f293[_0xe979('0x30')][_0xe979('0x40')]){_0x4ab855['include']=[{'all':!![]}];}_0x4ab855=_[_0xe979('0x3d')]({},_0x4ab855,_0x24f293['options']);return db[_0xe979('0x2b')][_0xe979('0x47')](_0x4ab855)['then'](handleEntityNotFound(_0x4533c7,null))[_0xe979('0x43')](respondWithResult(_0x4533c7,null))[_0xe979('0x45')](handleError(_0x4533c7,null));};exports[_0xe979('0x48')]=function(_0x1ad909,_0xad4f36){return db['FaxApplication']['create'](_0x1ad909[_0xe979('0x49')],{})[_0xe979('0x43')](respondWithResult(_0xad4f36,0xc9))[_0xe979('0x45')](handleError(_0xad4f36,null));};exports[_0xe979('0x25')]=function(_0x518c71,_0x429c29){if(_0x518c71[_0xe979('0x49')]['id']){delete _0x518c71[_0xe979('0x49')]['id'];}return db[_0xe979('0x2b')][_0xe979('0x47')]({'where':{'id':_0x518c71[_0xe979('0x46')]['id']}})['then'](handleEntityNotFound(_0x429c29,null))[_0xe979('0x43')](saveUpdates(_0x518c71[_0xe979('0x49')],null))[_0xe979('0x43')](respondWithResult(_0x429c29,null))[_0xe979('0x45')](handleError(_0x429c29,null));};exports[_0xe979('0x26')]=function(_0x4761d4,_0x4b7f4f){return db[_0xe979('0x2b')][_0xe979('0x47')]({'where':{'id':_0x4761d4[_0xe979('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b7f4f,null))['then'](removeEntity(_0x4b7f4f,null))['catch'](handleError(_0x4b7f4f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 2e426d7..aa0629c 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 _0xc907=['utf8mb4','lodash','util','../../config/logger','moment','bluebird','path','rimraf','exports','define','FaxApplication','fax_applications'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0xc907,0x1b1));var _0x7c90=function(_0x2407e3,_0x34dc69){_0x2407e3=_0x2407e3-0x0;var _0x1db569=_0xc907[_0x2407e3];return _0x1db569;};'use strict';var _=require(_0x7c90('0x0'));var util=require(_0x7c90('0x1'));var logger=require(_0x7c90('0x2'))('api');var moment=require(_0x7c90('0x3'));var BPromise=require(_0x7c90('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c90('0x5'));var rimraf=require(_0x7c90('0x6'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x7c90('0x7')]=function(_0x4dc5fb,_0x35d0eb){return _0x4dc5fb[_0x7c90('0x8')](_0x7c90('0x9'),attributes,{'tableName':_0x7c90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c90('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb4a8=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb4a8,0x1ed));var _0x8b4a=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0xb4a8[_0x33c603];return _0xae96f4;};'use strict';var _=require(_0x8b4a('0x0'));var util=require(_0x8b4a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8b4a('0x2'));var rp=require(_0x8b4a('0x3'));var fs=require('fs');var path=require(_0x8b4a('0x4'));var rimraf=require(_0x8b4a('0x5'));var config=require(_0x8b4a('0x6'));var attributes=require(_0x8b4a('0x7'));module[_0x8b4a('0x8')]=function(_0x2a7ad8,_0x25d113){return _0x2a7ad8[_0x8b4a('0x9')](_0x8b4a('0xa'),attributes,{'tableName':_0x8b4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b4a('0xc'),'collate':_0x8b4a('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index dfd9cfc..3ab95f3 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 _0xac52=['catch','UpdateFaxApplication','update','options','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xac52,0x1e3));var _0x2ac5=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xac52[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x2ac5('0x0'));var util=require('util');var moment=require(_0x2ac5('0x1'));var BPromise=require(_0x2ac5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ac5('0x3'));var db=require(_0x2ac5('0x4'))['db'];var utils=require(_0x2ac5('0x5'));var logger=require(_0x2ac5('0x6'))(_0x2ac5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2ac5('0x8')][_0x2ac5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x183502,_0x1baf9e,_0x7522df){return new BPromise(function(_0xc95445,_0x1e5baa){return client[_0x2ac5('0xa')](_0x183502,_0x7522df)[_0x2ac5('0xb')](function(_0x5adaa5){logger['info'](_0x2ac5('0xc'),_0x1baf9e,_0x2ac5('0xd'));logger[_0x2ac5('0xe')](_0x2ac5('0xf'),_0x1baf9e,_0x2ac5('0xd'),JSON[_0x2ac5('0x10')](_0x5adaa5));if(_0x5adaa5[_0x2ac5('0x11')]){if(_0x5adaa5[_0x2ac5('0x11')][_0x2ac5('0x12')]===0x1f4){logger[_0x2ac5('0x11')](_0x2ac5('0xc'),_0x1baf9e,_0x5adaa5[_0x2ac5('0x11')]['message']);return _0x1e5baa(_0x5adaa5['error'][_0x2ac5('0x13')]);}logger[_0x2ac5('0x11')]('FaxApplication,\x20%s,\x20%s',_0x1baf9e,_0x5adaa5[_0x2ac5('0x11')][_0x2ac5('0x13')]);return _0xc95445(_0x5adaa5[_0x2ac5('0x11')][_0x2ac5('0x13')]);}else{logger[_0x2ac5('0x14')](_0x2ac5('0xc'),_0x1baf9e,_0x2ac5('0xd'));_0xc95445(_0x5adaa5['result'][_0x2ac5('0x13')]);}})[_0x2ac5('0x15')](function(_0x310c4d){logger['error']('FaxApplication,\x20%s,\x20%s',_0x1baf9e,_0x310c4d);_0x1e5baa(_0x310c4d);});});}exports[_0x2ac5('0x16')]=function(_0xf2a5){var _0x10651a=this;return new Promise(function(_0x52d7d5,_0x4f59cc){return db['FaxApplication'][_0x2ac5('0x17')](_0xf2a5['body'],{'raw':_0xf2a5[_0x2ac5('0x18')]?_0xf2a5[_0x2ac5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2a5[_0x2ac5('0x18')]?_0xf2a5[_0x2ac5('0x18')][_0x2ac5('0x19')]||null:null,'attributes':_0xf2a5['options']?_0xf2a5[_0x2ac5('0x18')][_0x2ac5('0x1a')]||null:null,'limit':_0xf2a5[_0x2ac5('0x18')]?_0xf2a5[_0x2ac5('0x18')][_0x2ac5('0x1b')]||null:null})[_0x2ac5('0xb')](function(_0x562180){logger[_0x2ac5('0x14')](_0x2ac5('0x16'),_0xf2a5);logger[_0x2ac5('0xe')](_0x2ac5('0x16'),_0xf2a5,JSON[_0x2ac5('0x10')](_0x562180));_0x52d7d5(_0x562180);})[_0x2ac5('0x15')](function(_0x41f99e){logger['error'](_0x2ac5('0x16'),_0x41f99e[_0x2ac5('0x13')],_0xf2a5);_0x4f59cc(_0x10651a['error'](0x1f4,_0x41f99e[_0x2ac5('0x13')]));});});}; \ No newline at end of file +var _0xa9a0=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x47db5d,_0x3389be){var _0x15823c=function(_0x2b461e){while(--_0x2b461e){_0x47db5d['push'](_0x47db5d['shift']());}};_0x15823c(++_0x3389be);}(_0xa9a0,0x1b2));var _0x0a9a=function(_0x4de5b1,_0xf82eb1){_0x4de5b1=_0x4de5b1-0x0;var _0xf711fa=_0xa9a0[_0x4de5b1];return _0xf711fa;};'use strict';var _=require(_0x0a9a('0x0'));var util=require(_0x0a9a('0x1'));var moment=require(_0x0a9a('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a9a('0x3'));var fs=require('fs');var Redis=require(_0x0a9a('0x4'));var db=require(_0x0a9a('0x5'))['db'];var utils=require(_0x0a9a('0x6'));var logger=require(_0x0a9a('0x7'))('rpc');var config=require(_0x0a9a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9a('0x9')][_0x0a9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1292aa,_0x40bd57,_0x8eaa61){return new BPromise(function(_0x555f9a,_0x58526e){return client[_0x0a9a('0xb')](_0x1292aa,_0x8eaa61)[_0x0a9a('0xc')](function(_0x4b6ff1){logger[_0x0a9a('0xd')](_0x0a9a('0xe'),_0x40bd57,_0x0a9a('0xf'));logger[_0x0a9a('0x10')](_0x0a9a('0x11'),_0x40bd57,_0x0a9a('0xf'),JSON[_0x0a9a('0x12')](_0x4b6ff1));if(_0x4b6ff1[_0x0a9a('0x13')]){if(_0x4b6ff1['error'][_0x0a9a('0x14')]===0x1f4){logger[_0x0a9a('0x13')]('FaxApplication,\x20%s,\x20%s',_0x40bd57,_0x4b6ff1[_0x0a9a('0x13')][_0x0a9a('0x15')]);return _0x58526e(_0x4b6ff1[_0x0a9a('0x13')][_0x0a9a('0x15')]);}logger[_0x0a9a('0x13')](_0x0a9a('0xe'),_0x40bd57,_0x4b6ff1['error'][_0x0a9a('0x15')]);return _0x555f9a(_0x4b6ff1['error'][_0x0a9a('0x15')]);}else{logger[_0x0a9a('0xd')](_0x0a9a('0xe'),_0x40bd57,_0x0a9a('0xf'));_0x555f9a(_0x4b6ff1[_0x0a9a('0x16')][_0x0a9a('0x15')]);}})[_0x0a9a('0x17')](function(_0x44a062){logger[_0x0a9a('0x13')](_0x0a9a('0xe'),_0x40bd57,_0x44a062);_0x58526e(_0x44a062);});});}exports['UpdateFaxApplication']=function(_0x1fa66a){var _0x2a9fb2=this;return new Promise(function(_0x322319,_0x2dade4){return db['FaxApplication'][_0x0a9a('0x18')](_0x1fa66a[_0x0a9a('0x19')],{'raw':_0x1fa66a[_0x0a9a('0x1a')]?_0x1fa66a['options'][_0x0a9a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fa66a[_0x0a9a('0x1a')]?_0x1fa66a[_0x0a9a('0x1a')][_0x0a9a('0x1c')]||null:null,'attributes':_0x1fa66a['options']?_0x1fa66a[_0x0a9a('0x1a')][_0x0a9a('0x1d')]||null:null,'limit':_0x1fa66a[_0x0a9a('0x1a')]?_0x1fa66a[_0x0a9a('0x1a')][_0x0a9a('0x1e')]||null:null})['then'](function(_0x31c7be){logger[_0x0a9a('0xd')]('UpdateFaxApplication',_0x1fa66a);logger['debug'](_0x0a9a('0x1f'),_0x1fa66a,JSON['stringify'](_0x31c7be));_0x322319(_0x31c7be);})[_0x0a9a('0x17')](function(_0x5e1e1a){logger[_0x0a9a('0x13')](_0x0a9a('0x1f'),_0x5e1e1a[_0x0a9a('0x15')],_0x1fa66a);_0x2dade4(_0x2a9fb2[_0x0a9a('0x13')](0x1f4,_0x5e1e1a[_0x0a9a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 61c93fc..9109222 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 _0x2af0=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x51f575,_0x49918f){var _0x47e06d=function(_0x31c535){while(--_0x31c535){_0x51f575['push'](_0x51f575['shift']());}};_0x47e06d(++_0x49918f);}(_0x2af0,0x13c));var _0x02af=function(_0x5231a2,_0xa80132){_0x5231a2=_0x5231a2-0x0;var _0xdf1dbb=_0x2af0[_0x5231a2];return _0xdf1dbb;};'use strict';var multer=require('multer');var util=require(_0x02af('0x0'));var path=require(_0x02af('0x1'));var timeout=require('connect-timeout');var express=require(_0x02af('0x2'));var router=express[_0x02af('0x3')]();var fs_extra=require(_0x02af('0x4'));var auth=require(_0x02af('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x02af('0x6'));var controller=require('./faxApplication.controller');router[_0x02af('0x7')]('/',auth[_0x02af('0x8')](),controller[_0x02af('0x9')]);router[_0x02af('0x7')](_0x02af('0xa'),auth['isAuthenticated'](),controller[_0x02af('0xb')]);router[_0x02af('0xc')]('/',auth[_0x02af('0x8')](),controller[_0x02af('0xd')]);router[_0x02af('0xe')](_0x02af('0xa'),auth[_0x02af('0x8')](),controller[_0x02af('0xf')]);router[_0x02af('0x10')](_0x02af('0xa'),auth[_0x02af('0x8')](),controller['destroy']);module[_0x02af('0x11')]=router; \ No newline at end of file +var _0x976c=['put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','show','post'];(function(_0x1cc286,_0x10fd44){var _0x3dc771=function(_0x112968){while(--_0x112968){_0x1cc286['push'](_0x1cc286['shift']());}};_0x3dc771(++_0x10fd44);}(_0x976c,0x1be));var _0xc976=function(_0xaa1faa,_0x3aac1d){_0xaa1faa=_0xaa1faa-0x0;var _0x5025db=_0x976c[_0xaa1faa];return _0x5025db;};'use strict';var multer=require(_0xc976('0x0'));var util=require(_0xc976('0x1'));var path=require('path');var timeout=require(_0xc976('0x2'));var express=require(_0xc976('0x3'));var router=express[_0xc976('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc976('0x5'));var interaction=require(_0xc976('0x6'));var config=require(_0xc976('0x7'));var controller=require(_0xc976('0x8'));router[_0xc976('0x9')]('/',auth[_0xc976('0xa')](),controller['index']);router[_0xc976('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc976('0xb')]);router[_0xc976('0xc')]('/',auth[_0xc976('0xa')](),controller['create']);router[_0xc976('0xd')]('/:id',auth[_0xc976('0xa')](),controller['update']);router['delete'](_0xc976('0xe'),auth[_0xc976('0xa')](),controller[_0xc976('0xf')]);module[_0xc976('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 657210d..a19d8ca 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 _0x04e7=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x49f012,_0x4663bc){var _0x56384a=function(_0x26b355){while(--_0x26b355){_0x49f012['push'](_0x49f012['shift']());}};_0x56384a(++_0x4663bc);}(_0x04e7,0x121));var _0x704e=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x04e7[_0x590b63];return _0x3c9380;};'use strict';var Sequelize=require(_0x704e('0x0'));module[_0x704e('0x1')]={'closed':{'type':Sequelize[_0x704e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x704e('0x3')]},'disposition':{'type':Sequelize[_0x704e('0x4')]},'secondDisposition':{'type':Sequelize[_0x704e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x704e('0x4')]},'note':{'type':Sequelize[_0x704e('0x4')]},'read1stAt':{'type':Sequelize[_0x704e('0x3')]},'fax':{'type':Sequelize[_0x704e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x704e('0x5')]('in',_0x704e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x704e('0x5')]('in',_0x704e('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xdb4b=['exports','DATE','STRING','ENUM','out'];(function(_0x222b43,_0x442b2c){var _0x3f759d=function(_0x1d7849){while(--_0x1d7849){_0x222b43['push'](_0x222b43['shift']());}};_0x3f759d(++_0x442b2c);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x49ff48,_0x413d68){_0x49ff48=_0x49ff48-0x0;var _0x8ed443=_0xdb4b[_0x49ff48];return _0x8ed443;};'use strict';var Sequelize=require('sequelize');module[_0xbdb4('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbdb4('0x1')]},'disposition':{'type':Sequelize[_0xbdb4('0x2')]},'secondDisposition':{'type':Sequelize[_0xbdb4('0x2')]},'thirdDisposition':{'type':Sequelize[_0xbdb4('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbdb4('0x1')]},'fax':{'type':Sequelize[_0xbdb4('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xbdb4('0x3')]('in',_0xbdb4('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbdb4('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xbdb4('0x3')]('in',_0xbdb4('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 66c7a25..ed435ca 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 _0x6c2b=['findAll','addTags','spread','Tag','emit','removeTags','download','unix','join','files','root','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./faxInteraction.socket','register','status','json','count','offset','limit','set','reject','then','destroy','end','sendStatus','error','name','fullname','Tags','TagIds','push','catch','map','FaxInteraction','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','keys','compact','isEmpty','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','role','agent','user','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','rawAttributes','includeAll','options','create','update','describe','addMessage','ids','getMessages','findOne','FaxMessage','length','hasOwnProperty','pick','FaxInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include'];(function(_0x3f7608,_0x51adb3){var _0x983f01=function(_0x2310c2){while(--_0x2310c2){_0x3f7608['push'](_0x3f7608['shift']());}};_0x983f01(++_0x51adb3);}(_0x6c2b,0x1d1));var _0xb6c2=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0x6c2b[_0x5a187b];return _0x14d601;};'use strict';var pdf=require(_0xb6c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb6c2('0x1'));var zipdir=require(_0xb6c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c2('0x3'));var moment=require(_0xb6c2('0x4'));var BPromise=require(_0xb6c2('0x5'));var Mustache=require(_0xb6c2('0x6'));var util=require(_0xb6c2('0x7'));var path=require(_0xb6c2('0x8'));var sox=require('sox');var csv=require(_0xb6c2('0x9'));var ejs=require(_0xb6c2('0xa'));var fs=require('fs');var fs_extra=require(_0xb6c2('0xb'));var _=require('lodash');var squel=require(_0xb6c2('0xc'));var crypto=require(_0xb6c2('0xd'));var jsforce=require(_0xb6c2('0xe'));var deskjs=require(_0xb6c2('0xf'));var toCsv=require(_0xb6c2('0x9'));var querystring=require(_0xb6c2('0x10'));var Papa=require(_0xb6c2('0x11'));var Redis=require(_0xb6c2('0x12'));var authService=require(_0xb6c2('0x13'));var qs=require(_0xb6c2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6c2('0x15'));var logger=require(_0xb6c2('0x16'))(_0xb6c2('0x17'));var utils=require(_0xb6c2('0x18'));var config=require(_0xb6c2('0x19'));var licenseUtil=require(_0xb6c2('0x1a'));var db=require(_0xb6c2('0x1b'))['db'];config['redis']=_[_0xb6c2('0x1c')](config['redis'],{'host':_0xb6c2('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6c2('0x1e')]));require(_0xb6c2('0x1f'))[_0xb6c2('0x20')](socket);function respondWithStatusCode(_0x23d8b5,_0x29388d){_0x29388d=_0x29388d||0xcc;return function(_0x2b8577){if(_0x2b8577){return _0x23d8b5['sendStatus'](_0x29388d);}return _0x23d8b5[_0xb6c2('0x21')](_0x29388d)['end']();};}function respondWithResult(_0x58f3d2,_0x10b67d){_0x10b67d=_0x10b67d||0xc8;return function(_0x3caacc){if(_0x3caacc){return _0x58f3d2[_0xb6c2('0x21')](_0x10b67d)[_0xb6c2('0x22')](_0x3caacc);}};}function respondWithFilteredResult(_0x275b6e,_0x35c80b){return function(_0xf5568d){if(_0xf5568d){var _0x306067=_0xf5568d[_0xb6c2('0x23')],_0x37c103=_0x35c80b['offset'],_0x232a9d=_0x35c80b[_0xb6c2('0x24')]+_0x35c80b[_0xb6c2('0x25')],_0x55df3f;if(_0x232a9d>=_0x306067){_0x232a9d=_0x306067;_0x55df3f=0xc8;}else{_0x55df3f=0xce;}_0x275b6e[_0xb6c2('0x21')](_0x55df3f);return _0x275b6e[_0xb6c2('0x26')]('Content-Range',_0x37c103+'-'+_0x232a9d+'/'+_0x306067)['json'](_0xf5568d);}return null;};}function patchUpdates(_0x2dd3c9){return function(_0x563b4a){try{jsonpatch['apply'](_0x563b4a,_0x2dd3c9,!![]);}catch(_0x180107){return BPromise[_0xb6c2('0x27')](_0x180107);}return _0x563b4a['save']();};}function saveUpdates(_0x2c3822,_0x2a2b62){return function(_0x143d0f){if(_0x143d0f){return _0x143d0f['update'](_0x2c3822)[_0xb6c2('0x28')](function(_0x354b5d){return _0x354b5d;});}return null;};}function removeEntity(_0x3d63c1,_0x54df64){return function(_0x587fc4){if(_0x587fc4){return _0x587fc4[_0xb6c2('0x29')]()[_0xb6c2('0x28')](function(){_0x3d63c1['status'](0xcc)[_0xb6c2('0x2a')]();});}};}function handleEntityNotFound(_0x1fb005,_0x2465ab){return function(_0x2b4d7c){if(!_0x2b4d7c){_0x1fb005[_0xb6c2('0x2b')](0x194);}return _0x2b4d7c;};}function handleError(_0x19e6bc,_0x1339ad){_0x1339ad=_0x1339ad||0x1f4;return function(_0x11b081){logger[_0xb6c2('0x2c')](_0x11b081['stack']);if(_0x11b081[_0xb6c2('0x2d')]){delete _0x11b081[_0xb6c2('0x2d')];}_0x19e6bc[_0xb6c2('0x21')](_0x1339ad)['send'](_0x11b081);};}function getInteractionUsers(_0x3b3efc,_0x391794){return new BPromise(function(_0x34826c,_0x9450d1){try{if(_0x391794[_0x3b3efc['id']]){_0x3b3efc['Users']=_['map'](_0x391794[_0x3b3efc['id']],function(_0xd92c51){return{'id':_0xd92c51['id'],'fullname':_0xd92c51[_0xb6c2('0x2e')]};});}}catch(_0x36352d){_0x9450d1(_0x36352d);}_0x34826c(_0x3b3efc);});}function getInteractionTags(_0x55cd0c,_0x534cbe){return new BPromise(function(_0x1f6861,_0x53f233){try{if(_0x55cd0c['TagIds']){_0x55cd0c[_0xb6c2('0x2f')]=[];_0x55cd0c[_0xb6c2('0x30')]['split'](',')['forEach'](function(_0x2eeb6a){_0x55cd0c[_0xb6c2('0x2f')][_0xb6c2('0x31')](_0x534cbe[_0x2eeb6a]);});}delete _0x55cd0c[_0xb6c2('0x30')];}catch(_0x3bb2de){_0x53f233(_0x3bb2de);}_0x1f6861(_0x55cd0c);});}function updateFaxInteraction(_0x121b9a,_0x254852,_0x5183c1){return new BPromise(function(_0x466582,_0xf460ef){return getInteractionUsers(_0x121b9a,_0x5183c1)[_0xb6c2('0x28')](function(_0x1ddde7){return getInteractionTags(_0x1ddde7,_0x254852);})[_0xb6c2('0x28')](function(_0x304e08){_0x466582(_0x304e08);})[_0xb6c2('0x32')](function(_0x3515b0){_0xf460ef(_0x3515b0);});});}exports['index']=function(_0x21ff9c,_0x4d9f11){var _0x3f3d97={},_0x3bb407={},_0x138001={'count':0x0,'rows':[]};var _0x591258=_[_0xb6c2('0x33')](db[_0xb6c2('0x34')]['rawAttributes'],function(_0x24e38f){return{'name':_0x24e38f[_0xb6c2('0x35')],'type':_0x24e38f['type'][_0xb6c2('0x36')]};});_0x3bb407[_0xb6c2('0x37')]=_[_0xb6c2('0x33')](_0x591258,'name');_0x3bb407[_0xb6c2('0x38')]=_['keys'](_0x21ff9c[_0xb6c2('0x38')]);_0x3bb407[_0xb6c2('0x39')]=_[_0xb6c2('0x3a')](_0x3bb407[_0xb6c2('0x37')],_0x3bb407[_0xb6c2('0x38')]);_0x3f3d97[_0xb6c2('0x3b')]=_['intersection'](_0x3bb407['model'],qs[_0xb6c2('0x3c')](_0x21ff9c[_0xb6c2('0x38')][_0xb6c2('0x3c')]));_0x3f3d97[_0xb6c2('0x3b')]=_0x3f3d97[_0xb6c2('0x3b')]['length']?_0x3f3d97['attributes']:_0x3bb407[_0xb6c2('0x37')];if(!_0x21ff9c[_0xb6c2('0x38')]['hasOwnProperty'](_0xb6c2('0x3d'))){_0x3f3d97[_0xb6c2('0x25')]=qs[_0xb6c2('0x25')](_0x21ff9c['query']['limit']);_0x3f3d97[_0xb6c2('0x24')]=qs[_0xb6c2('0x24')](_0x21ff9c['query']['offset']);}_0x3f3d97[_0xb6c2('0x3e')]=qs['sort'](_0x21ff9c[_0xb6c2('0x38')][_0xb6c2('0x3f')]);_0x3f3d97['where']=qs[_0xb6c2('0x39')](_['pick'](_0x21ff9c[_0xb6c2('0x38')],_0x3bb407[_0xb6c2('0x39')]),_0x591258);var _0xcfb4b9=[];var _0x44eef0=squel[_0xb6c2('0x40')]()[_0xb6c2('0x41')]('id')[_0xb6c2('0x41')](_0xb6c2('0x2d'))['field'](_0xb6c2('0x42'))['from'](_0xb6c2('0x43'));var _0x12919e=squel[_0xb6c2('0x40')]()[_0xb6c2('0x41')](_0xb6c2('0x44'))[_0xb6c2('0x41')](_0xb6c2('0x45'))[_0xb6c2('0x41')](_0xb6c2('0x46'))[_0xb6c2('0x47')](_0xb6c2('0x48'),'ui')[_0xb6c2('0x49')](_0xb6c2('0x4a'),'u',_0xb6c2('0x4b'));var _0x99f5bc=squel[_0xb6c2('0x40')]()['from'](_0xb6c2('0x4c'),'i')[_0xb6c2('0x49')](_0xb6c2('0x4d'),'c',_0xb6c2('0x4e'))[_0xb6c2('0x49')](_0xb6c2('0x4a'),'o','o.id\x20=\x20i.UserId')[_0xb6c2('0x49')](_0xb6c2('0x4f'),'a','a.id\x20=\x20i.FaxAccountId')[_0xb6c2('0x49')](_0xb6c2('0x50'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xb6c2('0x49')](_0xb6c2('0x51'),'it',_0xb6c2('0x52'))[_0xb6c2('0x49')]('tools_tags','t',_0xb6c2('0x53'));var _0x7e555d=squel[_0xb6c2('0x54')]();var _0x391968=[];var _0x4796f0=squel['expr']();var _0x2081c1;if(_0x21ff9c['query'][_0xb6c2('0x55')]){_0x2081c1=as[_0xb6c2('0x56')](_0x21ff9c[_0xb6c2('0x38')]['search']);var _0xadcd7d=_0x2081c1[_0xb6c2('0x57')];for(var _0xbc5b00=0x0;_0xbc5b00<_0x2081c1[_0xb6c2('0x58')]['length'];_0xbc5b00++){var _0x23cc66=_0x2081c1[_0xb6c2('0x58')][_0xbc5b00];var _0x122e83='i';var _0x29620b=_[_0xb6c2('0x59')](_0x591258,[_0xb6c2('0x2d'),_0x23cc66[_0xb6c2('0x41')]]);if(!_0x29620b){switch(_0x23cc66[_0xb6c2('0x41')]){case'unreadMessages':if(_0x23cc66[_0xb6c2('0x5a')]==0x1){_0x99f5bc[_0xb6c2('0x5b')]('`'+_0x23cc66['field']+_0xb6c2('0x5c'));}else{_0x99f5bc['having']('`'+_0x23cc66[_0xb6c2('0x41')]+_0xb6c2('0x5d'));}break;case _0xb6c2('0x5e'):if(_0x23cc66[_0xb6c2('0x5f')]===_0xb6c2('0x60')){if(_0x23cc66[_0xb6c2('0x5a')][_0xb6c2('0x61')]('\x20')['length']>0x1){_0x7e555d[_0xadcd7d](_0xb6c2('0x62'),qs[_0xb6c2('0x63')](_0x23cc66[_0xb6c2('0x5a')]),null);}else{var _0x46c3ff='%'+_0x23cc66['value']+'%';_0x7e555d[_0xadcd7d](_0xb6c2('0x64'),_0x46c3ff,_0x46c3ff,_0x46c3ff);}}else{_0x29620b=_['find'](_0x591258,[_0xb6c2('0x2d'),_0xb6c2('0x65')]);_0x23cc66[_0xb6c2('0x41')]=_0xb6c2('0x65');_0x1206d1=as[_0xb6c2('0x66')](_0x122e83,_0x29620b[_0xb6c2('0x67')],_0x23cc66);_0x7e555d[_0xadcd7d](_0x1206d1[_0xb6c2('0x68')],_0x1206d1['value'][_0xb6c2('0x69')],_0x1206d1[_0xb6c2('0x5a')][_0xb6c2('0x2a')]);}break;case'Tag':var _0xb8094c=_0x23cc66[_0xb6c2('0x5a')][_0xb6c2('0x61')](',')[_0xb6c2('0x33')](function(_0xa49bc3){return Number(_0xa49bc3);});_0xb8094c[_0xb6c2('0x6a')](function(_0x319c6d){_0x4796f0['or'](_0xb6c2('0x6b'),'%,'+_0x319c6d+',%');});_0x391968=_[_0xb6c2('0x6c')](_0x391968,_0xb8094c);break;case _0xb6c2('0x6d'):if(_0x23cc66[_0xb6c2('0x5f')]==='$substring'){_0x7e555d[_0xadcd7d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x23cc66['value']+'%',null);}else{_0x29620b=_[_0xb6c2('0x59')](_0x591258,[_0xb6c2('0x2d'),_0xb6c2('0x6e')]);_0x23cc66['field']=_0xb6c2('0x6e');_0x1206d1=as['buildExpression'](_0x122e83,_0x29620b[_0xb6c2('0x67')],_0x23cc66);_0x7e555d[_0xadcd7d](_0x1206d1[_0xb6c2('0x68')],_0x1206d1[_0xb6c2('0x5a')][_0xb6c2('0x69')],_0x1206d1[_0xb6c2('0x5a')]['end']);}break;case _0xb6c2('0x6f'):_0x1206d1=as[_0xb6c2('0x66')]('me',null,_0x23cc66);_0x7e555d[_0xadcd7d](_0x1206d1['text'],_0x1206d1['value'][_0xb6c2('0x69')],_0x1206d1['value'][_0xb6c2('0x2a')]);break;}}else{var _0x1206d1=as['buildExpression'](_0x122e83,_0x29620b[_0xb6c2('0x67')],_0x23cc66);_0x7e555d[_0xadcd7d](_0x1206d1[_0xb6c2('0x68')],_0x1206d1[_0xb6c2('0x5a')][_0xb6c2('0x69')],_0x1206d1[_0xb6c2('0x5a')][_0xb6c2('0x2a')]);}}}else{var _0x18edd4=_(_0x21ff9c[_0xb6c2('0x38')])[_0xb6c2('0x70')]()[_0xb6c2('0x33')](function(_0x3316ff){return _['some'](_0x591258,[_0xb6c2('0x2d'),_0x3316ff])?_0x3316ff:undefined;})[_0xb6c2('0x71')]()['value']();if(!_[_0xb6c2('0x72')](_0x18edd4)){_0x18edd4[_0xb6c2('0x6a')](function(_0x5da602){if(_0x5da602==='FaxAccountId'){_0x99f5bc[_0xb6c2('0x73')](_0xb6c2('0x74'),[][_0xb6c2('0x75')](_0x21ff9c['query'][_0x5da602]));}else if(_0x5da602===_0xb6c2('0x76')){var _0x58904c=JSON[_0xb6c2('0x77')](_0x21ff9c['query'][_0x5da602])['$gte'];var _0x31856d=JSON[_0xb6c2('0x77')](_0x21ff9c[_0xb6c2('0x38')][_0x5da602])[_0xb6c2('0x78')];_0x99f5bc[_0xb6c2('0x73')](_0xb6c2('0x79'),_0x58904c,_0x31856d);}else{if(_0x21ff9c['query'][_0x5da602]===_0xb6c2('0x7a')){_0x99f5bc[_0xb6c2('0x73')]('i.'+_0x5da602+_0xb6c2('0x7b'));}else{_0x99f5bc[_0xb6c2('0x73')]('i.'+_0x5da602+'\x20=\x20?',_0x21ff9c[_0xb6c2('0x38')][_0x5da602]);}}});}if(_0x21ff9c['query'][_0xb6c2('0x7c')]){if(_0x21ff9c[_0xb6c2('0x38')][_0xb6c2('0x7c')]==0x1){_0x99f5bc[_0xb6c2('0x5b')]('`unreadMessages`\x20=\x200');}else{_0x99f5bc['having']('`unreadMessages`\x20>\x200');}}if(_0x21ff9c[_0xb6c2('0x38')][_0xb6c2('0x7d')]){_0x391968=_[_0xb6c2('0x7e')](_0x21ff9c[_0xb6c2('0x38')]['tag'])?_0x21ff9c[_0xb6c2('0x38')]['tag']:new Array(_0x21ff9c['query'][_0xb6c2('0x7d')]);_0x391968[_0xb6c2('0x6a')](function(_0x23cd99){_0x4796f0['or'](_0xb6c2('0x6b'),'%,'+_0x23cd99+',%');});}if(_0x21ff9c[_0xb6c2('0x38')][_0xb6c2('0x7f')]){var _0x4d4b36=_0x21ff9c['query'][_0xb6c2('0x7f')]['replace']('\x5c','\x5c\x5c')[_0xb6c2('0x80')](/'/g,'\x27\x27');if(qs[_0xb6c2('0x81')](_0x4d4b36)){_0x7e555d['or'](_0xb6c2('0x82'),_0x4d4b36+'%')['or'](_0xb6c2('0x83'),_0x4d4b36+'%');}_0x7e555d['or'](_0xb6c2('0x84'),_0x4d4b36+'%');}}_0x99f5bc['where'](_0x7e555d);_0x99f5bc[_0xb6c2('0x85')]('i.id');var _0x517a64={'type':db[_0xb6c2('0x86')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3ce6b6=_0x99f5bc['clone']();_0x3ce6b6[_0xb6c2('0x41')](_0xb6c2('0x87'));_0x3ce6b6[_0xb6c2('0x41')](_0xb6c2('0x88'),_0xb6c2('0x89'));if(_0x3f3d97['order']){_0x3f3d97[_0xb6c2('0x3e')][_0xb6c2('0x6a')](function(_0x1654a4){var _0x5980aa=_0x1654a4[0x0]==='contactName'?_0x1654a4[0x0]:'i.'+_0x1654a4[0x0];_0x99f5bc[_0xb6c2('0x3e')](_0x5980aa,_0x1654a4[0x1]===_0xb6c2('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x391968)){_0x99f5bc[_0xb6c2('0x5b')](_0x4796f0);_0x3ce6b6[_0xb6c2('0x73')](_0xb6c2('0x8b'),_0x391968);}BPromise[_0xb6c2('0x8c')]()[_0xb6c2('0x28')](function(){if(!_0x2081c1){if(_0x21ff9c[_0xb6c2('0x38')][_0xb6c2('0x8d')])return;_0x3ce6b6[_0xb6c2('0x73')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x99f5bc['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x21ff9c['user'][_0xb6c2('0x8e')]!==_0xb6c2('0x8f'))return;return _0x21ff9c[_0xb6c2('0x90')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xb6c2('0x28')](function(_0x13e289){if(_[_0xb6c2('0x72')](_0x13e289)){_0x3ce6b6[_0xb6c2('0x73')](_0xb6c2('0x91'));_0x99f5bc['where'](_0xb6c2('0x91'));}else{_0x3ce6b6[_0xb6c2('0x73')](_0xb6c2('0x74'),_['map'](_0x13e289,'id'));_0x99f5bc[_0xb6c2('0x73')](_0xb6c2('0x74'),_[_0xb6c2('0x33')](_0x13e289,'id'));}});})[_0xb6c2('0x28')](function(){if(_0x21ff9c[_0xb6c2('0x90')][_0xb6c2('0x8e')]===_0xb6c2('0x8f')&&!_0x2081c1&&!_0x21ff9c[_0xb6c2('0x38')]['FaxAccountId'])return[];return db['sequelize'][_0xb6c2('0x38')](_0x3ce6b6[_0xb6c2('0x92')](),_0x517a64);})['then'](function(_0x34764b){_0x138001[_0xb6c2('0x23')]=_0x34764b['length'];if(_0x138001[_0xb6c2('0x23')]===0x0)return[];return db[_0xb6c2('0x93')][_0xb6c2('0x38')](_0x44eef0[_0xb6c2('0x92')](),_0x517a64)[_0xb6c2('0x28')](function(_0x3510e4){_0xcfb4b9=_[_0xb6c2('0x94')](_0x3510e4,'id');_0x517a64=_[_0xb6c2('0x95')](_0x517a64,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21ff9c[_0xb6c2('0x38')][_0xb6c2('0x3c')]){_0x3f3d97['attributes'][_0xb6c2('0x6a')](function(_0x7446d){_0x99f5bc['field']('i.'+_0x7446d);});}else{_0x99f5bc['field'](_0xb6c2('0x88'),_0xb6c2('0x89'));_0x99f5bc[_0xb6c2('0x41')](_0xb6c2('0x96'),_0xb6c2('0x97'));_0x99f5bc[_0xb6c2('0x41')](_0xb6c2('0x98'),'Account.mandatoryDisposition');_0x99f5bc[_0xb6c2('0x41')](_0xb6c2('0x99'),_0xb6c2('0x9a'));_0x99f5bc[_0xb6c2('0x41')](_0xb6c2('0x9b'));_0x99f5bc['field'](_0xb6c2('0x9c'),_0xb6c2('0x9d'));_0x99f5bc[_0xb6c2('0x41')](_0xb6c2('0x9e'),_0xb6c2('0x9f'));_0x99f5bc[_0xb6c2('0x41')](_0xb6c2('0xa0'),_0xb6c2('0xa1'));_0x99f5bc['field'](_0xb6c2('0xa2'),'Contact.phone');_0x99f5bc[_0xb6c2('0x41')](_0xb6c2('0xa3'),_0xb6c2('0xa4'));_0x99f5bc['field'](_0xb6c2('0xa5'),_0xb6c2('0xa6'));_0x99f5bc['field'](_0xb6c2('0xa7'),'Owner.fullname');_0x99f5bc['field'](_0xb6c2('0xa8'),_0xb6c2('0xa9'));_0x99f5bc[_0xb6c2('0x41')](_0xb6c2('0xaa'),'TagIds');}if(_0x3f3d97[_0xb6c2('0x25')])_0x99f5bc[_0xb6c2('0x25')](_0x3f3d97[_0xb6c2('0x25')]);if(_0x3f3d97[_0xb6c2('0x24')])_0x99f5bc[_0xb6c2('0x24')](_0x3f3d97[_0xb6c2('0x24')]);return db[_0xb6c2('0x93')][_0xb6c2('0x38')](_0x99f5bc[_0xb6c2('0x92')](),_0x517a64);})[_0xb6c2('0x28')](function(_0x4301e8){_0x12919e[_0xb6c2('0x73')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x4301e8,'id'));return db['sequelize'][_0xb6c2('0x38')](_0x12919e['toString'](),_0x517a64)['then'](function(_0x2a0e95){var _0x44c09d=_[_0xb6c2('0xab')](_0x2a0e95,'FaxInteractionId');var _0x2f99f3=[];_0x4301e8[_0xb6c2('0x6a')](function(_0x311394){_0x2f99f3[_0xb6c2('0x31')](updateFaxInteraction(_0x311394,_0xcfb4b9,_0x44c09d));});return BPromise[_0xb6c2('0xac')](_0x2f99f3);});});})['then'](function(_0x4d7632){_0x138001[_0xb6c2('0xad')]=_0x4d7632;return _0x138001;})[_0xb6c2('0x28')](respondWithFilteredResult(_0x4d9f11,_0x3f3d97))['catch'](handleError(_0x4d9f11,null));};exports[_0xb6c2('0xae')]=function(_0x340f9a,_0x499a90){var _0xcae109={'raw':![],'where':{'id':_0x340f9a[_0xb6c2('0xaf')]['id']}},_0xc0b4a2={};_0xc0b4a2['model']=_[_0xb6c2('0x70')](db[_0xb6c2('0x34')][_0xb6c2('0xb0')]);_0xc0b4a2[_0xb6c2('0x38')]=_[_0xb6c2('0x70')](_0x340f9a[_0xb6c2('0x38')]);_0xc0b4a2[_0xb6c2('0x39')]=_['intersection'](_0xc0b4a2[_0xb6c2('0x37')],_0xc0b4a2[_0xb6c2('0x38')]);_0xcae109['attributes']=_['intersection'](_0xc0b4a2[_0xb6c2('0x37')],qs[_0xb6c2('0x3c')](_0x340f9a[_0xb6c2('0x38')][_0xb6c2('0x3c')]));_0xcae109[_0xb6c2('0x3b')]=_0xcae109[_0xb6c2('0x3b')]['length']?_0xcae109[_0xb6c2('0x3b')]:_0xc0b4a2[_0xb6c2('0x37')];if(_0x340f9a[_0xb6c2('0x38')][_0xb6c2('0xb1')]){_0xcae109['include']=[{'all':!![]}];}_0xcae109=_[_0xb6c2('0x95')]({},_0xcae109,_0x340f9a[_0xb6c2('0xb2')]);return db[_0xb6c2('0x34')][_0xb6c2('0x59')](_0xcae109)[_0xb6c2('0x28')](handleEntityNotFound(_0x499a90,null))['then'](respondWithResult(_0x499a90,null))[_0xb6c2('0x32')](handleError(_0x499a90,null));};exports[_0xb6c2('0xb3')]=function(_0x463b0f,_0x453191){return db[_0xb6c2('0x34')][_0xb6c2('0xb3')](_0x463b0f[_0xb6c2('0x6f')],{})[_0xb6c2('0x28')](respondWithResult(_0x453191,0xc9))[_0xb6c2('0x32')](handleError(_0x453191,null));};exports[_0xb6c2('0xb4')]=function(_0x188035,_0x4dcecc){if(_0x188035['body']['id']){delete _0x188035['body']['id'];}return db[_0xb6c2('0x34')][_0xb6c2('0x59')]({'where':{'id':_0x188035[_0xb6c2('0xaf')]['id']}})[_0xb6c2('0x28')](handleEntityNotFound(_0x4dcecc,null))[_0xb6c2('0x28')](saveUpdates(_0x188035[_0xb6c2('0x6f')],null))['then'](respondWithResult(_0x4dcecc,null))[_0xb6c2('0x32')](handleError(_0x4dcecc,null));};exports[_0xb6c2('0x29')]=function(_0x4536c3,_0x258014){return db[_0xb6c2('0x34')][_0xb6c2('0x59')]({'where':{'id':_0x4536c3[_0xb6c2('0xaf')]['id']}})[_0xb6c2('0x28')](handleEntityNotFound(_0x258014,null))[_0xb6c2('0x28')](removeEntity(_0x258014,null))[_0xb6c2('0x32')](handleError(_0x258014,null));};exports['describe']=function(_0x39a2e1,_0x67b372){return db['FaxInteraction'][_0xb6c2('0xb5')]()[_0xb6c2('0x28')](respondWithResult(_0x67b372,null))[_0xb6c2('0x32')](handleError(_0x67b372,null));};exports[_0xb6c2('0xb6')]=function(_0xda16dc,_0x342344,_0x44b575){return db['FaxMessage'][_0xb6c2('0x59')]({'where':{'id':_0xda16dc['params']['id']}})[_0xb6c2('0x28')](handleEntityNotFound(_0x342344,null))[_0xb6c2('0x28')](function(_0x52aa3b){if(_0x52aa3b){return _0x52aa3b[_0xb6c2('0xb6')](_0xda16dc[_0xb6c2('0x6f')][_0xb6c2('0xb7')],_['omit'](_0xda16dc[_0xb6c2('0x6f')],[_0xb6c2('0xb7'),'id'])||{});}})[_0xb6c2('0x28')](respondWithResult(_0x342344,null))[_0xb6c2('0x32')](handleError(_0x342344,null));};exports[_0xb6c2('0xb8')]=function(_0x135b0a,_0x129d67,_0x1ad167){var _0x44b8d1={'raw':![],'where':{}};var _0x29d30e={};var _0x3b9348={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xb6c2('0xb9')]({'where':{'id':_0x135b0a[_0xb6c2('0xaf')]['id']}})['then'](handleEntityNotFound(_0x129d67,null))[_0xb6c2('0x28')](function(_0x3e10ba){if(_0x3e10ba){_0x29d30e[_0xb6c2('0x37')]=_[_0xb6c2('0x70')](db[_0xb6c2('0xba')][_0xb6c2('0xb0')]);_0x29d30e['query']=_[_0xb6c2('0x70')](_0x135b0a[_0xb6c2('0x38')]);_0x29d30e['filters']=_[_0xb6c2('0x3a')](_0x29d30e[_0xb6c2('0x37')],_0x29d30e[_0xb6c2('0x38')]);_0x44b8d1[_0xb6c2('0x3b')]=_[_0xb6c2('0x3a')](_0x29d30e[_0xb6c2('0x37')],qs[_0xb6c2('0x3c')](_0x135b0a[_0xb6c2('0x38')][_0xb6c2('0x3c')]));_0x44b8d1['attributes']=_0x44b8d1[_0xb6c2('0x3b')][_0xb6c2('0xbb')]?_0x44b8d1['attributes']:_0x29d30e[_0xb6c2('0x37')];if(!_0x135b0a[_0xb6c2('0x38')][_0xb6c2('0xbc')]('nolimit')){_0x44b8d1[_0xb6c2('0x25')]=qs[_0xb6c2('0x25')](_0x135b0a[_0xb6c2('0x38')][_0xb6c2('0x25')]);_0x44b8d1[_0xb6c2('0x24')]=qs[_0xb6c2('0x24')](_0x135b0a[_0xb6c2('0x38')][_0xb6c2('0x24')]);}_0x44b8d1[_0xb6c2('0x3e')]=qs[_0xb6c2('0x3f')](_0x135b0a[_0xb6c2('0x38')][_0xb6c2('0x3f')]);_0x44b8d1[_0xb6c2('0x73')]=qs[_0xb6c2('0x39')](_[_0xb6c2('0xbd')](_0x135b0a[_0xb6c2('0x38')],_0x29d30e[_0xb6c2('0x39')]));_0x44b8d1[_0xb6c2('0x73')][_0xb6c2('0xbe')]=_0x3e10ba['id'];if(_0x135b0a[_0xb6c2('0x38')][_0xb6c2('0x7f')]){_0x44b8d1[_0xb6c2('0x73')]=_[_0xb6c2('0x95')](_0x44b8d1['where'],{'$or':_['map'](_0x44b8d1['attributes'],function(_0xe7a6ad){var _0x42ebd7={};_0x42ebd7[_0xe7a6ad]={'$like':'%'+_0x135b0a[_0xb6c2('0x38')][_0xb6c2('0x7f')]+'%'};return _0x42ebd7;})});}if(_0x135b0a['query'][_0xb6c2('0xbf')]){var _0x2478ba=_0x135b0a['query'][_0xb6c2('0xbf')][_0xb6c2('0x61')](',');var _0x38f483={};_0x38f483[_0x2478ba[0x0]]={'$gte':moment(_0x2478ba[0x1])[_0xb6c2('0xc0')](_0xb6c2('0xc1'))};_0x44b8d1['where']=_[_0xb6c2('0x95')](_0x44b8d1[_0xb6c2('0x73')],_0x38f483);}_0x44b8d1=_[_0xb6c2('0x95')]({},_0x44b8d1,_0x135b0a[_0xb6c2('0xb2')]);return db[_0xb6c2('0xba')][_0xb6c2('0x23')]({'where':_0x44b8d1[_0xb6c2('0x73')]})[_0xb6c2('0x28')](function(_0x4f71d2){_0x3b9348['count']=_0x4f71d2;if(_0x135b0a[_0xb6c2('0x38')][_0xb6c2('0xb1')]){_0x44b8d1[_0xb6c2('0xc2')]=[{'all':!![]}];}return db[_0xb6c2('0xba')][_0xb6c2('0xc3')](_0x44b8d1);})['then'](function(_0x328f35){_0x3b9348[_0xb6c2('0xad')]=_0x328f35;return _0x3b9348;});}})[_0xb6c2('0x28')](respondWithFilteredResult(_0x129d67,_0x44b8d1))[_0xb6c2('0x32')](handleError(_0x129d67,null));};exports[_0xb6c2('0xc4')]=function(_0x26a3a1,_0x137e05,_0x4c590e){return db[_0xb6c2('0x34')][_0xb6c2('0x59')]({'where':{'id':_0x26a3a1[_0xb6c2('0xaf')]['id']}})['then'](handleEntityNotFound(_0x137e05,null))['then'](function(_0x41227f){if(_0x41227f){return _0x41227f['setTags'](_0x26a3a1[_0xb6c2('0x6f')][_0xb6c2('0xb7')],_['omit'](_0x26a3a1[_0xb6c2('0x6f')],[_0xb6c2('0xb7'),'id'])||{})[_0xb6c2('0xc5')](function(){return db[_0xb6c2('0xc6')]['findAll']({'attributes':['id','name',_0xb6c2('0x42')],'where':{'id':_0x26a3a1['body'][_0xb6c2('0xb7')]}});})[_0xb6c2('0x28')](function(_0x447351){socket[_0xb6c2('0xc7')]('faxInteractionTags:save',{'id':Number(_0x26a3a1['params']['id']),'tags':_0x447351||[]});return{'id':Number(_0x26a3a1[_0xb6c2('0xaf')]['id']),'tags':_0x447351||[]};});}})['then'](respondWithResult(_0x137e05,null))[_0xb6c2('0x32')](handleError(_0x137e05,null));};exports['removeTags']=function(_0x247ee3,_0x571a6f,_0x3fdacb){return db[_0xb6c2('0x34')][_0xb6c2('0x59')]({'where':{'id':_0x247ee3[_0xb6c2('0xaf')]['id']}})[_0xb6c2('0x28')](handleEntityNotFound(_0x571a6f,null))[_0xb6c2('0x28')](function(_0x56ba3a){if(_0x56ba3a){return _0x56ba3a[_0xb6c2('0xc8')](_0x247ee3['query'][_0xb6c2('0xb7')]);}})[_0xb6c2('0x28')](respondWithStatusCode(_0x571a6f,null))['catch'](handleError(_0x571a6f,null));};exports[_0xb6c2('0xc9')]=function(_0x5b6444,_0x4dd1a0){var _0x5e1a4e=moment()[_0xb6c2('0xca')]()['toString']();var _0xce59ac=path[_0xb6c2('0xcb')](config['root'],'server',_0xb6c2('0xcc'),'tmp');var _0x3593ed=path[_0xb6c2('0xcb')](config[_0xb6c2('0xcd')],_0xb6c2('0xce'),_0xb6c2('0xcc'),_0xb6c2('0xcf'));var _0x5eff2d=path['join'](_0xce59ac,_0x5e1a4e);var _0x66137d=util[_0xb6c2('0xc0')](_0xb6c2('0xd0'),_0x5b6444[_0xb6c2('0xaf')]['id'],_0x5e1a4e);var _0x5bf498=path[_0xb6c2('0xcb')](_0xce59ac,_0x66137d);var _0x2ff981=[];_0x2ff981[_0xb6c2('0x31')]({'model':db[_0xb6c2('0xd1')],'as':_0xb6c2('0xd1'),'raw':!![]});var _0x33f25b=[{'model':db[_0xb6c2('0xba')],'as':'Messages','attributes':['id',_0xb6c2('0x6f'),'createdAt'],'include':_0x2ff981}];return db[_0xb6c2('0x34')]['find']({'where':{'id':_0x5b6444[_0xb6c2('0xaf')]['id']},'include':_0x33f25b})[_0xb6c2('0x28')](handleEntityNotFound(_0x4dd1a0,null))[_0xb6c2('0x28')](function(_0x424ddf){if(_0x424ddf&&_0x424ddf[_0xb6c2('0xd2')]){var _0x227218=_0x424ddf[_0xb6c2('0xd3')]({'plain':!![]});fs[_0xb6c2('0xd4')](_0x5eff2d);for(var _0x234036=0x0;_0x234036<_0x227218[_0xb6c2('0xd2')][_0xb6c2('0xbb')];_0x234036++){var _0x98523f=_0x227218['Messages'][_0x234036][_0xb6c2('0xd1')];if(_0x98523f){var _0x45a859=path[_0xb6c2('0xcb')](_0x3593ed,_0x98523f[_0xb6c2('0xd5')]);if(fs[_0xb6c2('0xd6')](_0x45a859)){fs[_0xb6c2('0xd7')](_0x45a859)['pipe'](fs[_0xb6c2('0xd8')](path['join'](_0x5eff2d,_0x98523f[_0xb6c2('0xd5')])));}}}return BPromise['resolve']()[_0xb6c2('0x28')](function(){return new BPromise(function(_0xdb6ed2,_0x18b387){zipdir(_0x5eff2d,{'saveTo':_0x5bf498},function(_0x31edd7,_0x49bdb8){if(_0x31edd7)return _0x18b387(_0x31edd7);return _0xdb6ed2(_0x49bdb8);});})[_0xb6c2('0x28')](function(){return new BPromise(function(_0x3893b5,_0x375236){rimraf(_0x5eff2d,function(_0x47d0d3){if(_0x47d0d3)_0x375236(_0x47d0d3);return _0x3893b5();});});})[_0xb6c2('0x28')](function(){return _0x4dd1a0[_0xb6c2('0xc9')](_0x5bf498,_0x66137d,function(_0x273655){if(_0x273655){console[_0xb6c2('0xd9')](_0xb6c2('0xda'),_0x273655);}else{fs[_0xb6c2('0xdb')](_0x5bf498);}});});});}else{return _0x4dd1a0['sendStatus'](0xc8);}})['catch'](handleError(_0x4dd1a0,null));}; \ No newline at end of file +var _0x8988=['cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','params','catch','create','update','destroy','describe','FaxMessage','addMessage','ids','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','addTags','spread','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','then','end','error','name','send','Users','map','fullname','TagIds','split','push','index','FaxInteraction','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions'];(function(_0x2fe3e3,_0x5a0534){var _0x4b9bf6=function(_0x38ab55){while(--_0x38ab55){_0x2fe3e3['push'](_0x2fe3e3['shift']());}};_0x4b9bf6(++_0x5a0534);}(_0x8988,0x89));var _0x8898=function(_0x29b7b7,_0x483ba8){_0x29b7b7=_0x29b7b7-0x0;var _0x1f47b6=_0x8988[_0x29b7b7];return _0x1f47b6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8898('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8898('0x1'));var jsonpatch=require(_0x8898('0x2'));var rp=require('request-promise');var moment=require(_0x8898('0x3'));var BPromise=require(_0x8898('0x4'));var Mustache=require(_0x8898('0x5'));var util=require(_0x8898('0x6'));var path=require(_0x8898('0x7'));var sox=require(_0x8898('0x8'));var csv=require(_0x8898('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8898('0xa'));var _=require(_0x8898('0xb'));var squel=require(_0x8898('0xc'));var crypto=require('crypto');var jsforce=require(_0x8898('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8898('0xe'));var Redis=require(_0x8898('0xf'));var authService=require(_0x8898('0x10'));var qs=require(_0x8898('0x11'));var as=require(_0x8898('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8898('0x13'))(_0x8898('0x14'));var utils=require(_0x8898('0x15'));var config=require(_0x8898('0x16'));var licenseUtil=require(_0x8898('0x17'));var db=require('../../mysqldb')['db'];config[_0x8898('0x18')]=_[_0x8898('0x19')](config['redis'],{'host':_0x8898('0x1a'),'port':0x18eb});var socket=require(_0x8898('0x1b'))(new Redis(config[_0x8898('0x18')]));require(_0x8898('0x1c'))[_0x8898('0x1d')](socket);function respondWithStatusCode(_0x3bb0ef,_0x697486){_0x697486=_0x697486||0xcc;return function(_0x28a3c5){if(_0x28a3c5){return _0x3bb0ef[_0x8898('0x1e')](_0x697486);}return _0x3bb0ef[_0x8898('0x1f')](_0x697486)['end']();};}function respondWithResult(_0x50639e,_0x331802){_0x331802=_0x331802||0xc8;return function(_0x563b76){if(_0x563b76){return _0x50639e['status'](_0x331802)[_0x8898('0x20')](_0x563b76);}};}function respondWithFilteredResult(_0x4c6882,_0x5acc09){return function(_0x297a98){if(_0x297a98){var _0x2ea277=_0x297a98[_0x8898('0x21')],_0x53eff0=_0x5acc09['offset'],_0x22fde5=_0x5acc09['offset']+_0x5acc09[_0x8898('0x22')],_0x4e11be;if(_0x22fde5>=_0x2ea277){_0x22fde5=_0x2ea277;_0x4e11be=0xc8;}else{_0x4e11be=0xce;}_0x4c6882[_0x8898('0x1f')](_0x4e11be);return _0x4c6882[_0x8898('0x23')](_0x8898('0x24'),_0x53eff0+'-'+_0x22fde5+'/'+_0x2ea277)['json'](_0x297a98);}return null;};}function patchUpdates(_0x126b40){return function(_0x1069c0){try{jsonpatch[_0x8898('0x25')](_0x1069c0,_0x126b40,!![]);}catch(_0x3251a7){return BPromise[_0x8898('0x26')](_0x3251a7);}return _0x1069c0[_0x8898('0x27')]();};}function saveUpdates(_0xb773d,_0x260d5e){return function(_0x178766){if(_0x178766){return _0x178766['update'](_0xb773d)[_0x8898('0x28')](function(_0x1de75c){return _0x1de75c;});}return null;};}function removeEntity(_0x140ad2,_0x2fed57){return function(_0x8dbcde){if(_0x8dbcde){return _0x8dbcde['destroy']()[_0x8898('0x28')](function(){_0x140ad2[_0x8898('0x1f')](0xcc)[_0x8898('0x29')]();});}};}function handleEntityNotFound(_0x18e5b6,_0x2ef6eb){return function(_0x5eab16){if(!_0x5eab16){_0x18e5b6[_0x8898('0x1e')](0x194);}return _0x5eab16;};}function handleError(_0x12e5cc,_0x3daf2a){_0x3daf2a=_0x3daf2a||0x1f4;return function(_0x8df38a){logger[_0x8898('0x2a')](_0x8df38a['stack']);if(_0x8df38a[_0x8898('0x2b')]){delete _0x8df38a[_0x8898('0x2b')];}_0x12e5cc[_0x8898('0x1f')](_0x3daf2a)[_0x8898('0x2c')](_0x8df38a);};}function getInteractionUsers(_0x5caf7c,_0x4e4c4f){return new BPromise(function(_0x17c775,_0x3bfa83){try{if(_0x4e4c4f[_0x5caf7c['id']]){_0x5caf7c[_0x8898('0x2d')]=_[_0x8898('0x2e')](_0x4e4c4f[_0x5caf7c['id']],function(_0x5622e3){return{'id':_0x5622e3['id'],'fullname':_0x5622e3[_0x8898('0x2f')]};});}}catch(_0x40faef){_0x3bfa83(_0x40faef);}_0x17c775(_0x5caf7c);});}function getInteractionTags(_0x3f1958,_0x3602a3){return new BPromise(function(_0x892816,_0xe67eb5){try{if(_0x3f1958[_0x8898('0x30')]){_0x3f1958['Tags']=[];_0x3f1958['TagIds'][_0x8898('0x31')](',')['forEach'](function(_0xe854e0){_0x3f1958['Tags'][_0x8898('0x32')](_0x3602a3[_0xe854e0]);});}delete _0x3f1958[_0x8898('0x30')];}catch(_0x5c9e76){_0xe67eb5(_0x5c9e76);}_0x892816(_0x3f1958);});}function updateFaxInteraction(_0xdfe1d9,_0x3866d1,_0x496d42){return new BPromise(function(_0x223bc1,_0x37c985){return getInteractionUsers(_0xdfe1d9,_0x496d42)['then'](function(_0x2ef9f3){return getInteractionTags(_0x2ef9f3,_0x3866d1);})[_0x8898('0x28')](function(_0x37d5c2){_0x223bc1(_0x37d5c2);})['catch'](function(_0x5d70c5){_0x37c985(_0x5d70c5);});});}exports[_0x8898('0x33')]=function(_0x5c620a,_0x591c75){var _0x34007e={},_0x47f342={},_0x4ccd7d={'count':0x0,'rows':[]};var _0x129876=_[_0x8898('0x2e')](db[_0x8898('0x34')][_0x8898('0x35')],function(_0x2ed9cf){return{'name':_0x2ed9cf[_0x8898('0x36')],'type':_0x2ed9cf['type'][_0x8898('0x37')]};});_0x47f342[_0x8898('0x38')]=_[_0x8898('0x2e')](_0x129876,_0x8898('0x2b'));_0x47f342['query']=_['keys'](_0x5c620a[_0x8898('0x39')]);_0x47f342[_0x8898('0x3a')]=_[_0x8898('0x3b')](_0x47f342[_0x8898('0x38')],_0x47f342[_0x8898('0x39')]);_0x34007e[_0x8898('0x3c')]=_[_0x8898('0x3b')](_0x47f342[_0x8898('0x38')],qs['fields'](_0x5c620a[_0x8898('0x39')][_0x8898('0x3d')]));_0x34007e['attributes']=_0x34007e[_0x8898('0x3c')][_0x8898('0x3e')]?_0x34007e[_0x8898('0x3c')]:_0x47f342['model'];if(!_0x5c620a[_0x8898('0x39')][_0x8898('0x3f')](_0x8898('0x40'))){_0x34007e[_0x8898('0x22')]=qs[_0x8898('0x22')](_0x5c620a[_0x8898('0x39')]['limit']);_0x34007e[_0x8898('0x41')]=qs[_0x8898('0x41')](_0x5c620a[_0x8898('0x39')][_0x8898('0x41')]);}_0x34007e[_0x8898('0x42')]=qs[_0x8898('0x43')](_0x5c620a[_0x8898('0x39')]['sort']);_0x34007e[_0x8898('0x44')]=qs[_0x8898('0x3a')](_[_0x8898('0x45')](_0x5c620a[_0x8898('0x39')],_0x47f342[_0x8898('0x3a')]),_0x129876);var _0x177053=[];var _0x3a3d92=squel[_0x8898('0x46')]()[_0x8898('0x47')]('id')[_0x8898('0x47')](_0x8898('0x2b'))[_0x8898('0x47')](_0x8898('0x48'))[_0x8898('0x49')]('tools_tags');var _0x39d75a=squel['select']()['field'](_0x8898('0x4a'))[_0x8898('0x47')](_0x8898('0x4b'))[_0x8898('0x47')](_0x8898('0x4c'))[_0x8898('0x49')](_0x8898('0x4d'),'ui')[_0x8898('0x4e')](_0x8898('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x1ff40b=squel[_0x8898('0x46')]()['from'](_0x8898('0x50'),'i')[_0x8898('0x4e')](_0x8898('0x51'),'c',_0x8898('0x52'))[_0x8898('0x4e')](_0x8898('0x4f'),'o',_0x8898('0x53'))[_0x8898('0x4e')](_0x8898('0x54'),'a',_0x8898('0x55'))[_0x8898('0x4e')](_0x8898('0x56'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x8898('0x4e')]('fax_interaction_has_tags','it',_0x8898('0x57'))['left_join'](_0x8898('0x58'),'t',_0x8898('0x59'));var _0x201571=squel[_0x8898('0x5a')]();var _0x1c26fb=[];var _0x204c41=squel['expr']();var _0x2f2bc9;if(_0x5c620a[_0x8898('0x39')][_0x8898('0x5b')]){_0x2f2bc9=as[_0x8898('0x5c')](_0x5c620a[_0x8898('0x39')][_0x8898('0x5b')]);var _0x28cbf5=_0x2f2bc9[_0x8898('0x5d')];for(var _0x186d0b=0x0;_0x186d0b<_0x2f2bc9['conditions'][_0x8898('0x3e')];_0x186d0b++){var _0x5dc57a=_0x2f2bc9['conditions'][_0x186d0b];var _0x1dc175='i';var _0x58db43=_[_0x8898('0x5e')](_0x129876,['name',_0x5dc57a['field']]);if(!_0x58db43){switch(_0x5dc57a[_0x8898('0x47')]){case _0x8898('0x5f'):if(_0x5dc57a[_0x8898('0x60')]==0x1){_0x1ff40b[_0x8898('0x61')]('`'+_0x5dc57a['field']+'`\x20=\x200');}else{_0x1ff40b[_0x8898('0x61')]('`'+_0x5dc57a[_0x8898('0x47')]+_0x8898('0x62'));}break;case _0x8898('0x63'):if(_0x5dc57a[_0x8898('0x64')]===_0x8898('0x65')){if(_0x5dc57a[_0x8898('0x60')]['split']('\x20')[_0x8898('0x3e')]>0x1){_0x201571[_0x28cbf5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5dc57a[_0x8898('0x60')]),null);}else{var _0x14fee5='%'+_0x5dc57a[_0x8898('0x60')]+'%';_0x201571[_0x28cbf5](_0x8898('0x66'),_0x14fee5,_0x14fee5,_0x14fee5);}}else{_0x58db43=_[_0x8898('0x5e')](_0x129876,[_0x8898('0x2b'),'ContactId']);_0x5dc57a[_0x8898('0x47')]=_0x8898('0x67');_0xe58d23=as[_0x8898('0x68')](_0x1dc175,_0x58db43[_0x8898('0x69')],_0x5dc57a);_0x201571[_0x28cbf5](_0xe58d23[_0x8898('0x6a')],_0xe58d23[_0x8898('0x60')][_0x8898('0x6b')],_0xe58d23[_0x8898('0x60')][_0x8898('0x29')]);}break;case _0x8898('0x6c'):var _0x457dea=_0x5dc57a[_0x8898('0x60')][_0x8898('0x31')](',')['map'](function(_0x4eae3f){return Number(_0x4eae3f);});_0x457dea['forEach'](function(_0x45f180){_0x204c41['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x45f180+',%');});_0x1c26fb=_[_0x8898('0x6d')](_0x1c26fb,_0x457dea);break;case _0x8898('0x6e'):if(_0x5dc57a[_0x8898('0x64')]===_0x8898('0x65')){_0x201571[_0x28cbf5](_0x8898('0x6f'),'%'+_0x5dc57a[_0x8898('0x60')]+'%',null);}else{_0x58db43=_['find'](_0x129876,[_0x8898('0x2b'),'UserId']);_0x5dc57a[_0x8898('0x47')]=_0x8898('0x70');_0xe58d23=as['buildExpression'](_0x1dc175,_0x58db43[_0x8898('0x69')],_0x5dc57a);_0x201571[_0x28cbf5](_0xe58d23[_0x8898('0x6a')],_0xe58d23['value'][_0x8898('0x6b')],_0xe58d23[_0x8898('0x60')]['end']);}break;case _0x8898('0x71'):_0xe58d23=as[_0x8898('0x68')]('me',null,_0x5dc57a);_0x201571[_0x28cbf5](_0xe58d23[_0x8898('0x6a')],_0xe58d23['value'][_0x8898('0x6b')],_0xe58d23[_0x8898('0x60')][_0x8898('0x29')]);break;}}else{var _0xe58d23=as[_0x8898('0x68')](_0x1dc175,_0x58db43[_0x8898('0x69')],_0x5dc57a);_0x201571[_0x28cbf5](_0xe58d23[_0x8898('0x6a')],_0xe58d23[_0x8898('0x60')][_0x8898('0x6b')],_0xe58d23[_0x8898('0x60')][_0x8898('0x29')]);}}}else{var _0x266e2c=_(_0x5c620a[_0x8898('0x39')])[_0x8898('0x72')]()[_0x8898('0x2e')](function(_0x237d25){return _[_0x8898('0x73')](_0x129876,['name',_0x237d25])?_0x237d25:undefined;})['compact']()[_0x8898('0x60')]();if(!_[_0x8898('0x74')](_0x266e2c)){_0x266e2c[_0x8898('0x75')](function(_0xd80ac1){if(_0xd80ac1===_0x8898('0x76')){_0x1ff40b[_0x8898('0x44')](_0x8898('0x77'),[][_0x8898('0x78')](_0x5c620a[_0x8898('0x39')][_0xd80ac1]));}else if(_0xd80ac1==='createdAt'){var _0x5c8558=JSON[_0x8898('0x79')](_0x5c620a['query'][_0xd80ac1])['$gte'];var _0x428d85=JSON['parse'](_0x5c620a[_0x8898('0x39')][_0xd80ac1])[_0x8898('0x7a')];_0x1ff40b['where'](_0x8898('0x7b'),_0x5c8558,_0x428d85);}else{if(_0x5c620a[_0x8898('0x39')][_0xd80ac1]===_0x8898('0x7c')){_0x1ff40b[_0x8898('0x44')]('i.'+_0xd80ac1+_0x8898('0x7d'));}else{_0x1ff40b[_0x8898('0x44')]('i.'+_0xd80ac1+_0x8898('0x7e'),_0x5c620a[_0x8898('0x39')][_0xd80ac1]);}}});}if(_0x5c620a[_0x8898('0x39')]['read']){if(_0x5c620a[_0x8898('0x39')][_0x8898('0x7f')]==0x1){_0x1ff40b[_0x8898('0x61')](_0x8898('0x80'));}else{_0x1ff40b[_0x8898('0x61')]('`unreadMessages`\x20>\x200');}}if(_0x5c620a[_0x8898('0x39')][_0x8898('0x81')]){_0x1c26fb=_[_0x8898('0x82')](_0x5c620a[_0x8898('0x39')][_0x8898('0x81')])?_0x5c620a[_0x8898('0x39')][_0x8898('0x81')]:new Array(_0x5c620a[_0x8898('0x39')][_0x8898('0x81')]);_0x1c26fb[_0x8898('0x75')](function(_0x6d770){_0x204c41['or'](_0x8898('0x83'),'%,'+_0x6d770+',%');});}if(_0x5c620a[_0x8898('0x39')]['filter']){var _0x3199e6=_0x5c620a[_0x8898('0x39')][_0x8898('0x84')][_0x8898('0x85')]('\x5c','\x5c\x5c')[_0x8898('0x85')](/'/g,'\x27\x27');if(qs[_0x8898('0x86')](_0x3199e6)){_0x201571['or'](_0x8898('0x87'),_0x3199e6+'%')['or'](_0x8898('0x88'),_0x3199e6+'%');}_0x201571['or'](_0x8898('0x89'),_0x3199e6+'%');}}_0x1ff40b['where'](_0x201571);_0x1ff40b['group'](_0x8898('0x8a'));var _0x5c566b={'type':db[_0x8898('0x8b')][_0x8898('0x8c')][_0x8898('0x8d')],'raw':!![]};var _0x272757=_0x1ff40b['clone']();_0x272757[_0x8898('0x47')](_0x8898('0x8a'));_0x272757[_0x8898('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x34007e['order']){_0x34007e[_0x8898('0x42')]['forEach'](function(_0x1b1ff5){var _0x5f5577=_0x1b1ff5[0x0]===_0x8898('0x8e')?_0x1b1ff5[0x0]:'i.'+_0x1b1ff5[0x0];_0x1ff40b[_0x8898('0x42')](_0x5f5577,_0x1b1ff5[0x1]===_0x8898('0x8f')?![]:!![]);});}if(!_[_0x8898('0x74')](_0x1c26fb)){_0x1ff40b[_0x8898('0x61')](_0x204c41);_0x272757[_0x8898('0x44')](_0x8898('0x90'),_0x1c26fb);}BPromise[_0x8898('0x91')]()[_0x8898('0x28')](function(){if(!_0x2f2bc9){if(_0x5c620a[_0x8898('0x39')][_0x8898('0x76')])return;_0x272757[_0x8898('0x44')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1ff40b[_0x8898('0x44')](_0x8898('0x92'));return;}if(_0x5c620a[_0x8898('0x93')][_0x8898('0x94')]!==_0x8898('0x95'))return;return _0x5c620a[_0x8898('0x93')][_0x8898('0x96')]({'attributes':['id'],'raw':!![]})[_0x8898('0x28')](function(_0x3be5f7){if(_[_0x8898('0x74')](_0x3be5f7)){_0x272757[_0x8898('0x44')](_0x8898('0x97'));_0x1ff40b[_0x8898('0x44')](_0x8898('0x97'));}else{_0x272757[_0x8898('0x44')](_0x8898('0x77'),_[_0x8898('0x2e')](_0x3be5f7,'id'));_0x1ff40b[_0x8898('0x44')](_0x8898('0x77'),_['map'](_0x3be5f7,'id'));}});})[_0x8898('0x28')](function(){if(_0x5c620a[_0x8898('0x93')][_0x8898('0x94')]===_0x8898('0x95')&&!_0x2f2bc9&&!_0x5c620a[_0x8898('0x39')][_0x8898('0x76')])return[];return db['sequelize']['query'](_0x272757[_0x8898('0x98')](),_0x5c566b);})[_0x8898('0x28')](function(_0x1cc5be){_0x4ccd7d['count']=_0x1cc5be[_0x8898('0x3e')];if(_0x4ccd7d['count']===0x0)return[];return db[_0x8898('0x99')][_0x8898('0x39')](_0x3a3d92[_0x8898('0x98')](),_0x5c566b)[_0x8898('0x28')](function(_0x2526ee){_0x177053=_[_0x8898('0x9a')](_0x2526ee,'id');_0x5c566b=_[_0x8898('0x9b')](_0x5c566b,{'model':db[_0x8898('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c620a[_0x8898('0x39')]['fields']){_0x34007e[_0x8898('0x3c')][_0x8898('0x75')](function(_0x3122de){_0x1ff40b['field']('i.'+_0x3122de);});}else{_0x1ff40b[_0x8898('0x47')](_0x8898('0x9c'),_0x8898('0x5f'));_0x1ff40b[_0x8898('0x47')](_0x8898('0x9d'),_0x8898('0x9e'));_0x1ff40b[_0x8898('0x47')](_0x8898('0x9f'),'Account.mandatoryDisposition');_0x1ff40b['field'](_0x8898('0xa0'),'contactName');_0x1ff40b[_0x8898('0x47')](_0x8898('0xa1'));_0x1ff40b['field'](_0x8898('0xa2'),_0x8898('0xa3'));_0x1ff40b['field']('c.lastName',_0x8898('0xa4'));_0x1ff40b[_0x8898('0x47')](_0x8898('0xa5'),'Contact.email');_0x1ff40b[_0x8898('0x47')](_0x8898('0xa6'),'Contact.phone');_0x1ff40b['field'](_0x8898('0xa7'),_0x8898('0xa8'));_0x1ff40b[_0x8898('0x47')](_0x8898('0xa9'),_0x8898('0xaa'));_0x1ff40b[_0x8898('0x47')](_0x8898('0xab'),_0x8898('0xac'));_0x1ff40b['field']('o.internal',_0x8898('0xad'));_0x1ff40b[_0x8898('0x47')](_0x8898('0xae'),_0x8898('0x30'));}if(_0x34007e[_0x8898('0x22')])_0x1ff40b[_0x8898('0x22')](_0x34007e[_0x8898('0x22')]);if(_0x34007e['offset'])_0x1ff40b[_0x8898('0x41')](_0x34007e[_0x8898('0x41')]);return db[_0x8898('0x99')]['query'](_0x1ff40b[_0x8898('0x98')](),_0x5c566b);})[_0x8898('0x28')](function(_0x48ff96){_0x39d75a['where'](_0x8898('0xaf'),_[_0x8898('0x2e')](_0x48ff96,'id'));return db[_0x8898('0x99')][_0x8898('0x39')](_0x39d75a['toString'](),_0x5c566b)[_0x8898('0x28')](function(_0x11125d){var _0x1a76c1=_[_0x8898('0xb0')](_0x11125d,'FaxInteractionId');var _0x67912e=[];_0x48ff96[_0x8898('0x75')](function(_0x3b5995){_0x67912e[_0x8898('0x32')](updateFaxInteraction(_0x3b5995,_0x177053,_0x1a76c1));});return BPromise[_0x8898('0xb1')](_0x67912e);});});})[_0x8898('0x28')](function(_0x6fb221){_0x4ccd7d[_0x8898('0xb2')]=_0x6fb221;return _0x4ccd7d;})[_0x8898('0x28')](respondWithFilteredResult(_0x591c75,_0x34007e))['catch'](handleError(_0x591c75,null));};exports['show']=function(_0x2848f9,_0x22433b){var _0x44669d={'raw':![],'where':{'id':_0x2848f9[_0x8898('0xb3')]['id']}},_0x3628a9={};_0x3628a9[_0x8898('0x38')]=_['keys'](db['FaxInteraction'][_0x8898('0x35')]);_0x3628a9[_0x8898('0x39')]=_['keys'](_0x2848f9[_0x8898('0x39')]);_0x3628a9[_0x8898('0x3a')]=_[_0x8898('0x3b')](_0x3628a9['model'],_0x3628a9[_0x8898('0x39')]);_0x44669d[_0x8898('0x3c')]=_[_0x8898('0x3b')](_0x3628a9['model'],qs[_0x8898('0x3d')](_0x2848f9[_0x8898('0x39')][_0x8898('0x3d')]));_0x44669d[_0x8898('0x3c')]=_0x44669d['attributes'][_0x8898('0x3e')]?_0x44669d[_0x8898('0x3c')]:_0x3628a9[_0x8898('0x38')];if(_0x2848f9[_0x8898('0x39')]['includeAll']){_0x44669d['include']=[{'all':!![]}];}_0x44669d=_[_0x8898('0x9b')]({},_0x44669d,_0x2848f9['options']);return db[_0x8898('0x34')][_0x8898('0x5e')](_0x44669d)['then'](handleEntityNotFound(_0x22433b,null))[_0x8898('0x28')](respondWithResult(_0x22433b,null))[_0x8898('0xb4')](handleError(_0x22433b,null));};exports['create']=function(_0x37e0aa,_0x86701e){return db['FaxInteraction'][_0x8898('0xb5')](_0x37e0aa[_0x8898('0x71')],{})[_0x8898('0x28')](respondWithResult(_0x86701e,0xc9))[_0x8898('0xb4')](handleError(_0x86701e,null));};exports[_0x8898('0xb6')]=function(_0xd4b5bd,_0x5876f7){if(_0xd4b5bd[_0x8898('0x71')]['id']){delete _0xd4b5bd['body']['id'];}return db[_0x8898('0x34')][_0x8898('0x5e')]({'where':{'id':_0xd4b5bd[_0x8898('0xb3')]['id']}})[_0x8898('0x28')](handleEntityNotFound(_0x5876f7,null))[_0x8898('0x28')](saveUpdates(_0xd4b5bd[_0x8898('0x71')],null))[_0x8898('0x28')](respondWithResult(_0x5876f7,null))['catch'](handleError(_0x5876f7,null));};exports[_0x8898('0xb7')]=function(_0x1247ca,_0x23a1ca){return db[_0x8898('0x34')]['find']({'where':{'id':_0x1247ca[_0x8898('0xb3')]['id']}})['then'](handleEntityNotFound(_0x23a1ca,null))[_0x8898('0x28')](removeEntity(_0x23a1ca,null))[_0x8898('0xb4')](handleError(_0x23a1ca,null));};exports['describe']=function(_0xce00d0,_0x543ba2){return db[_0x8898('0x34')][_0x8898('0xb8')]()['then'](respondWithResult(_0x543ba2,null))[_0x8898('0xb4')](handleError(_0x543ba2,null));};exports['addMessage']=function(_0x4ff6ad,_0x321dce,_0x15eab7){return db[_0x8898('0xb9')][_0x8898('0x5e')]({'where':{'id':_0x4ff6ad[_0x8898('0xb3')]['id']}})[_0x8898('0x28')](handleEntityNotFound(_0x321dce,null))[_0x8898('0x28')](function(_0x1c00bc){if(_0x1c00bc){return _0x1c00bc[_0x8898('0xba')](_0x4ff6ad[_0x8898('0x71')][_0x8898('0xbb')],_['omit'](_0x4ff6ad[_0x8898('0x71')],[_0x8898('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x321dce,null))[_0x8898('0xb4')](handleError(_0x321dce,null));};exports['getMessages']=function(_0x5e0769,_0x47c4ce,_0x396ce9){var _0x35588d={'raw':![],'where':{}};var _0x796458={};var _0x36d535={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x8898('0xbc')]({'where':{'id':_0x5e0769[_0x8898('0xb3')]['id']}})[_0x8898('0x28')](handleEntityNotFound(_0x47c4ce,null))[_0x8898('0x28')](function(_0x27b9bf){if(_0x27b9bf){_0x796458[_0x8898('0x38')]=_[_0x8898('0x72')](db[_0x8898('0xb9')][_0x8898('0x35')]);_0x796458['query']=_[_0x8898('0x72')](_0x5e0769['query']);_0x796458['filters']=_[_0x8898('0x3b')](_0x796458[_0x8898('0x38')],_0x796458[_0x8898('0x39')]);_0x35588d[_0x8898('0x3c')]=_[_0x8898('0x3b')](_0x796458[_0x8898('0x38')],qs[_0x8898('0x3d')](_0x5e0769['query']['fields']));_0x35588d[_0x8898('0x3c')]=_0x35588d[_0x8898('0x3c')][_0x8898('0x3e')]?_0x35588d[_0x8898('0x3c')]:_0x796458[_0x8898('0x38')];if(!_0x5e0769[_0x8898('0x39')][_0x8898('0x3f')](_0x8898('0x40'))){_0x35588d[_0x8898('0x22')]=qs[_0x8898('0x22')](_0x5e0769[_0x8898('0x39')][_0x8898('0x22')]);_0x35588d[_0x8898('0x41')]=qs[_0x8898('0x41')](_0x5e0769[_0x8898('0x39')][_0x8898('0x41')]);}_0x35588d['order']=qs['sort'](_0x5e0769[_0x8898('0x39')]['sort']);_0x35588d['where']=qs[_0x8898('0x3a')](_['pick'](_0x5e0769[_0x8898('0x39')],_0x796458[_0x8898('0x3a')]));_0x35588d[_0x8898('0x44')]['FaxInteractionId']=_0x27b9bf['id'];if(_0x5e0769['query'][_0x8898('0x84')]){_0x35588d[_0x8898('0x44')]=_[_0x8898('0x9b')](_0x35588d['where'],{'$or':_[_0x8898('0x2e')](_0x35588d[_0x8898('0x3c')],function(_0x20f8d8){var _0x1587d0={};_0x1587d0[_0x20f8d8]={'$like':'%'+_0x5e0769['query'][_0x8898('0x84')]+'%'};return _0x1587d0;})});}if(_0x5e0769[_0x8898('0x39')][_0x8898('0xbd')]){var _0x428cf=_0x5e0769[_0x8898('0x39')][_0x8898('0xbd')]['split'](',');var _0x1196a7={};_0x1196a7[_0x428cf[0x0]]={'$gte':moment(_0x428cf[0x1])[_0x8898('0xbe')](_0x8898('0xbf'))};_0x35588d[_0x8898('0x44')]=_[_0x8898('0x9b')](_0x35588d[_0x8898('0x44')],_0x1196a7);}_0x35588d=_['merge']({},_0x35588d,_0x5e0769[_0x8898('0xc0')]);return db[_0x8898('0xb9')][_0x8898('0x21')]({'where':_0x35588d['where']})[_0x8898('0x28')](function(_0x26ef85){_0x36d535['count']=_0x26ef85;if(_0x5e0769[_0x8898('0x39')][_0x8898('0xc1')]){_0x35588d[_0x8898('0xc2')]=[{'all':!![]}];}return db[_0x8898('0xb9')]['findAll'](_0x35588d);})[_0x8898('0x28')](function(_0x3dad49){_0x36d535['rows']=_0x3dad49;return _0x36d535;});}})[_0x8898('0x28')](respondWithFilteredResult(_0x47c4ce,_0x35588d))[_0x8898('0xb4')](handleError(_0x47c4ce,null));};exports[_0x8898('0xc3')]=function(_0x4b9445,_0x269ec0,_0x151309){return db[_0x8898('0x34')]['find']({'where':{'id':_0x4b9445[_0x8898('0xb3')]['id']}})[_0x8898('0x28')](handleEntityNotFound(_0x269ec0,null))[_0x8898('0x28')](function(_0x44a0b2){if(_0x44a0b2){return _0x44a0b2['setTags'](_0x4b9445[_0x8898('0x71')]['ids'],_['omit'](_0x4b9445[_0x8898('0x71')],[_0x8898('0xbb'),'id'])||{})[_0x8898('0xc4')](function(){return db['Tag']['findAll']({'attributes':['id',_0x8898('0x2b'),'color'],'where':{'id':_0x4b9445[_0x8898('0x71')][_0x8898('0xbb')]}});})[_0x8898('0x28')](function(_0x5c1f7a){socket['emit'](_0x8898('0xc5'),{'id':Number(_0x4b9445[_0x8898('0xb3')]['id']),'tags':_0x5c1f7a||[]});return{'id':Number(_0x4b9445[_0x8898('0xb3')]['id']),'tags':_0x5c1f7a||[]};});}})[_0x8898('0x28')](respondWithResult(_0x269ec0,null))['catch'](handleError(_0x269ec0,null));};exports['removeTags']=function(_0x3fd102,_0x36505d,_0x52145f){return db[_0x8898('0x34')][_0x8898('0x5e')]({'where':{'id':_0x3fd102['params']['id']}})[_0x8898('0x28')](handleEntityNotFound(_0x36505d,null))[_0x8898('0x28')](function(_0x58cffd){if(_0x58cffd){return _0x58cffd[_0x8898('0xc6')](_0x3fd102['query']['ids']);}})[_0x8898('0x28')](respondWithStatusCode(_0x36505d,null))['catch'](handleError(_0x36505d,null));};exports['download']=function(_0x3765a5,_0x10164e){var _0x22782e=moment()[_0x8898('0xc7')]()[_0x8898('0x98')]();var _0xbff9d6=path[_0x8898('0xc8')](config[_0x8898('0xc9')],_0x8898('0xca'),_0x8898('0xcb'),_0x8898('0xcc'));var _0x2f61b9=path[_0x8898('0xc8')](config[_0x8898('0xc9')],_0x8898('0xca'),_0x8898('0xcb'),_0x8898('0xcd'));var _0x12ccf9=path[_0x8898('0xc8')](_0xbff9d6,_0x22782e);var _0x3af775=util[_0x8898('0xbe')](_0x8898('0xce'),_0x3765a5[_0x8898('0xb3')]['id'],_0x22782e);var _0x4c8139=path[_0x8898('0xc8')](_0xbff9d6,_0x3af775);var _0x4cd09a=[];_0x4cd09a[_0x8898('0x32')]({'model':db[_0x8898('0xcf')],'as':_0x8898('0xcf'),'raw':!![]});var _0x28a75f=[{'model':db['FaxMessage'],'as':_0x8898('0xd0'),'attributes':['id',_0x8898('0x71'),_0x8898('0xd1')],'include':_0x4cd09a}];return db['FaxInteraction']['find']({'where':{'id':_0x3765a5[_0x8898('0xb3')]['id']},'include':_0x28a75f})[_0x8898('0x28')](handleEntityNotFound(_0x10164e,null))[_0x8898('0x28')](function(_0x358ce2){if(_0x358ce2&&_0x358ce2[_0x8898('0xd0')]){var _0x13631d=_0x358ce2['get']({'plain':!![]});fs['mkdirSync'](_0x12ccf9);for(var _0x5dda7b=0x0;_0x5dda7b<_0x13631d[_0x8898('0xd0')][_0x8898('0x3e')];_0x5dda7b++){var _0x42b5ef=_0x13631d[_0x8898('0xd0')][_0x5dda7b]['Attachment'];if(_0x42b5ef){var _0x4b05eb=path[_0x8898('0xc8')](_0x2f61b9,_0x42b5ef[_0x8898('0xd2')]);if(fs[_0x8898('0xd3')](_0x4b05eb)){fs[_0x8898('0xd4')](_0x4b05eb)[_0x8898('0xd5')](fs[_0x8898('0xd6')](path[_0x8898('0xc8')](_0x12ccf9,_0x42b5ef['basename'])));}}}return BPromise[_0x8898('0x91')]()[_0x8898('0x28')](function(){return new BPromise(function(_0x4d318d,_0x90e7f7){zipdir(_0x12ccf9,{'saveTo':_0x4c8139},function(_0xbb1cf2,_0x517e27){if(_0xbb1cf2)return _0x90e7f7(_0xbb1cf2);return _0x4d318d(_0x517e27);});})[_0x8898('0x28')](function(){return new BPromise(function(_0x3b4266,_0x42dd31){rimraf(_0x12ccf9,function(_0x338c61){if(_0x338c61)_0x42dd31(_0x338c61);return _0x3b4266();});});})[_0x8898('0x28')](function(){return _0x10164e['download'](_0x4c8139,_0x3af775,function(_0x7c857b){if(_0x7c857b){console[_0x8898('0xd7')](_0x8898('0xd8'),_0x7c857b);}else{fs[_0x8898('0xd9')](_0x4c8139);}});});});}else{return _0x10164e[_0x8898('0x1e')](0xc8);}})[_0x8898('0xb4')](handleError(_0x10164e,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b7964b6..915ee45 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x2136a0,_0x1bed51){var _0x52ac93=function(_0x616ba2){while(--_0x616ba2){_0x2136a0['push'](_0x2136a0['shift']());}};_0x52ac93(++_0x1bed51);}(_0x814b,0x1a2));var _0xb814=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0x814b[_0x415f7e];return _0x311ff4;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x160cd5,_0x19c58e){var _0x366763=function(_0x3b8e31){while(--_0x3b8e31){_0x160cd5['push'](_0x160cd5['shift']());}};_0x366763(++_0x19c58e);}(_0xadb5,0xad));var _0x5adb=function(_0x44950a,_0x596712){_0x44950a=_0x44950a-0x0;var _0x41626f=_0xadb5[_0x44950a];return _0x41626f;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 9f59fb9..f596286 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 _0x054f=['closed','closedAt','format','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','define','FaxInteraction','fax_interactions','changed'];(function(_0x1bdb0e,_0x2e98e8){var _0x3e811e=function(_0x1c91b2){while(--_0x1c91b2){_0x1bdb0e['push'](_0x1bdb0e['shift']());}};_0x3e811e(++_0x2e98e8);}(_0x054f,0x1a7));var _0xf054=function(_0x76fa3c,_0x2fffe9){_0x76fa3c=_0x76fa3c-0x0;var _0x10ef72=_0x054f[_0x76fa3c];return _0x10ef72;};'use strict';var _=require(_0xf054('0x0'));var util=require(_0xf054('0x1'));var logger=require(_0xf054('0x2'))(_0xf054('0x3'));var moment=require(_0xf054('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf054('0x5'));var config=require(_0xf054('0x6'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0xd2cb6e,_0x4634ff){return _0xd2cb6e[_0xf054('0x7')](_0xf054('0x8'),attributes,{'tableName':_0xf054('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48475e,_0x3d4d1d,_0x567433){if(_0x48475e[_0xf054('0xa')](_0xf054('0xb'))){_0x48475e[_0xf054('0xc')]=moment()[_0xf054('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x567433(null,_0x48475e);}}});}; \ No newline at end of file +var _0x46fa=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','FaxInteraction','fax_interactions','changed','closed','format'];(function(_0x235703,_0x571b9a){var _0x940197=function(_0x516264){while(--_0x516264){_0x235703['push'](_0x235703['shift']());}};_0x940197(++_0x571b9a);}(_0x46fa,0x138));var _0xa46f=function(_0x141b85,_0x2e2ab0){_0x141b85=_0x141b85-0x0;var _0x135f96=_0x46fa[_0x141b85];return _0x135f96;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa46f('0x0'))('api');var moment=require(_0xa46f('0x1'));var BPromise=require(_0xa46f('0x2'));var rp=require(_0xa46f('0x3'));var fs=require('fs');var path=require(_0xa46f('0x4'));var rimraf=require(_0xa46f('0x5'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xa46f('0x6')]=function(_0x3a8731,_0x4697b7){return _0x3a8731[_0xa46f('0x7')](_0xa46f('0x8'),attributes,{'tableName':_0xa46f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1aacd1,_0x5782d4,_0x3429a1){if(_0x1aacd1[_0xa46f('0xa')](_0xa46f('0xb'))){_0x1aacd1['closedAt']=moment()[_0xa46f('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3429a1(null,_0x1aacd1);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index dfa60c2..084c023 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 _0x831e=['ids','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','catch','AddTagsToFaxInteraction','find'];(function(_0x12ab87,_0x17964b){var _0x29d29c=function(_0xa8c1b0){while(--_0xa8c1b0){_0x12ab87['push'](_0x12ab87['shift']());}};_0x29d29c(++_0x17964b);}(_0x831e,0x96));var _0xe831=function(_0x5dafb2,_0x10424f){_0x5dafb2=_0x5dafb2-0x0;var _0x28dab3=_0x831e[_0x5dafb2];return _0x28dab3;};'use strict';var _=require('lodash');var util=require(_0xe831('0x0'));var moment=require('moment');var BPromise=require(_0xe831('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe831('0x2'));var db=require(_0xe831('0x3'))['db'];var utils=require(_0xe831('0x4'));var logger=require(_0xe831('0x5'))(_0xe831('0x6'));var config=require(_0xe831('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe831('0x8')]['http']({'port':0x232a});config[_0xe831('0x9')]=_[_0xe831('0xa')](config[_0xe831('0x9')],{'host':_0xe831('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe831('0x9')]));require(_0xe831('0xc'))[_0xe831('0xd')](socket);function respondWithRpcPromise(_0x383689,_0x1b6d39,_0x1c6c29){return new BPromise(function(_0x54ee12,_0x1cdc60){return client['request'](_0x383689,_0x1c6c29)[_0xe831('0xe')](function(_0x5b9698){logger[_0xe831('0xf')](_0xe831('0x10'),_0x1b6d39,_0xe831('0x11'));logger[_0xe831('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1b6d39,_0xe831('0x11'),JSON[_0xe831('0x13')](_0x5b9698));if(_0x5b9698['error']){if(_0x5b9698[_0xe831('0x14')][_0xe831('0x15')]===0x1f4){logger[_0xe831('0x14')](_0xe831('0x10'),_0x1b6d39,_0x5b9698[_0xe831('0x14')][_0xe831('0x16')]);return _0x1cdc60(_0x5b9698[_0xe831('0x14')][_0xe831('0x16')]);}logger[_0xe831('0x14')](_0xe831('0x10'),_0x1b6d39,_0x5b9698['error'][_0xe831('0x16')]);return _0x54ee12(_0x5b9698[_0xe831('0x14')]['message']);}else{logger[_0xe831('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x1b6d39,_0xe831('0x11'));_0x54ee12(_0x5b9698[_0xe831('0x17')][_0xe831('0x16')]);}})['catch'](function(_0x160adf){logger[_0xe831('0x14')](_0xe831('0x10'),_0x1b6d39,_0x160adf);_0x1cdc60(_0x160adf);});});}exports[_0xe831('0x18')]=function(_0x23c1b3){var _0x2981bf=this;return new Promise(function(_0x238064,_0x1c11c4){return db[_0xe831('0x19')][_0xe831('0x1a')](_0x23c1b3[_0xe831('0x1b')],{'raw':_0x23c1b3[_0xe831('0x1c')]?_0x23c1b3[_0xe831('0x1c')][_0xe831('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c1b3[_0xe831('0x1c')]?_0x23c1b3[_0xe831('0x1c')][_0xe831('0x1e')]||null:null,'attributes':_0x23c1b3[_0xe831('0x1c')]?_0x23c1b3['options'][_0xe831('0x1f')]||null:null,'limit':_0x23c1b3[_0xe831('0x1c')]?_0x23c1b3[_0xe831('0x1c')]['limit']||null:null})['then'](function(_0x28f264){logger[_0xe831('0xf')](_0xe831('0x18'),_0x23c1b3);logger[_0xe831('0x12')](_0xe831('0x18'),_0x23c1b3,JSON['stringify'](_0x28f264));_0x238064(_0x28f264);})[_0xe831('0x20')](function(_0x50b3ae){logger[_0xe831('0x14')]('UpdateFaxInteraction',_0x50b3ae[_0xe831('0x16')],_0x23c1b3);_0x1c11c4(_0x2981bf[_0xe831('0x14')](0x1f4,_0x50b3ae[_0xe831('0x16')]));});});};exports[_0xe831('0x21')]=function(_0x105490){return new Promise(function(_0x386c8f,_0x73938a){return db['FaxInteraction'][_0xe831('0x22')]({'where':_0x105490[_0xe831('0x1c')]?_0x105490[_0xe831('0x1c')][_0xe831('0x1e')]||null:null})[_0xe831('0xe')](function(_0x414f34){if(_0x414f34){return _0x414f34['addTags'](_0x105490['body'][_0xe831('0x23')],_['omit'](_0x105490['body'],['ids','id'])||{});}})['spread'](function(_0x5b676a){logger[_0xe831('0xf')](_0xe831('0x24'),_0x105490);logger['debug']('AddTags',_0x105490,JSON[_0xe831('0x13')](_0x5b676a));_0x386c8f(_0x5b676a);})[_0xe831('0x20')](function(_0x3162a9){logger[_0xe831('0x14')](_0xe831('0x24'),_0x3162a9[_0xe831('0x16')],_0x105490);_0x73938a(_this[_0xe831('0x14')](0x1f4,_0x3162a9[_0xe831('0x16')]));});});}; \ No newline at end of file +var _0x2fe1=['find','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','./faxInteraction.socket','request','request\x20sent','debug','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','then','info','AddTagsToFaxInteraction'];(function(_0x6763d2,_0x1f7abc){var _0x19e68c=function(_0x5b74ef){while(--_0x5b74ef){_0x6763d2['push'](_0x6763d2['shift']());}};_0x19e68c(++_0x1f7abc);}(_0x2fe1,0x1c1));var _0x12fe=function(_0xc1dbe4,_0x3b9e32){_0xc1dbe4=_0xc1dbe4-0x0;var _0x1af607=_0x2fe1[_0xc1dbe4];return _0x1af607;};'use strict';var _=require('lodash');var util=require(_0x12fe('0x0'));var moment=require(_0x12fe('0x1'));var BPromise=require(_0x12fe('0x2'));var rs=require(_0x12fe('0x3'));var fs=require('fs');var Redis=require(_0x12fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x12fe('0x5'));var logger=require(_0x12fe('0x6'))(_0x12fe('0x7'));var config=require(_0x12fe('0x8'));var jayson=require(_0x12fe('0x9'));var client=jayson[_0x12fe('0xa')]['http']({'port':0x232a});config[_0x12fe('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12fe('0xb')]));require(_0x12fe('0xc'))['register'](socket);function respondWithRpcPromise(_0x4808fe,_0xfac913,_0x1278cc){return new BPromise(function(_0x56f85f,_0x3b3e6e){return client[_0x12fe('0xd')](_0x4808fe,_0x1278cc)['then'](function(_0x467cdf){logger['info']('FaxInteraction,\x20%s,\x20%s',_0xfac913,_0x12fe('0xe'));logger[_0x12fe('0xf')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xfac913,_0x12fe('0xe'),JSON[_0x12fe('0x10')](_0x467cdf));if(_0x467cdf[_0x12fe('0x11')]){if(_0x467cdf[_0x12fe('0x11')][_0x12fe('0x12')]===0x1f4){logger[_0x12fe('0x11')](_0x12fe('0x13'),_0xfac913,_0x467cdf[_0x12fe('0x11')]['message']);return _0x3b3e6e(_0x467cdf[_0x12fe('0x11')][_0x12fe('0x14')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0xfac913,_0x467cdf[_0x12fe('0x11')][_0x12fe('0x14')]);return _0x56f85f(_0x467cdf['error']['message']);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0xfac913,'request\x20sent');_0x56f85f(_0x467cdf[_0x12fe('0x15')][_0x12fe('0x14')]);}})[_0x12fe('0x16')](function(_0x21a500){logger[_0x12fe('0x11')](_0x12fe('0x13'),_0xfac913,_0x21a500);_0x3b3e6e(_0x21a500);});});}exports[_0x12fe('0x17')]=function(_0x469eaf){var _0x2a0549=this;return new Promise(function(_0x53fcf7,_0x2ce015){return db[_0x12fe('0x18')]['update'](_0x469eaf[_0x12fe('0x19')],{'raw':_0x469eaf[_0x12fe('0x1a')]?_0x469eaf[_0x12fe('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x469eaf[_0x12fe('0x1a')]?_0x469eaf['options'][_0x12fe('0x1b')]||null:null,'attributes':_0x469eaf['options']?_0x469eaf[_0x12fe('0x1a')][_0x12fe('0x1c')]||null:null,'limit':_0x469eaf['options']?_0x469eaf['options']['limit']||null:null})[_0x12fe('0x1d')](function(_0x35d431){logger[_0x12fe('0x1e')]('UpdateFaxInteraction',_0x469eaf);logger[_0x12fe('0xf')](_0x12fe('0x17'),_0x469eaf,JSON[_0x12fe('0x10')](_0x35d431));_0x53fcf7(_0x35d431);})[_0x12fe('0x16')](function(_0x16e068){logger[_0x12fe('0x11')](_0x12fe('0x17'),_0x16e068[_0x12fe('0x14')],_0x469eaf);_0x2ce015(_0x2a0549[_0x12fe('0x11')](0x1f4,_0x16e068[_0x12fe('0x14')]));});});};exports[_0x12fe('0x1f')]=function(_0x130479){return new Promise(function(_0x24063d,_0x45a3e8){return db['FaxInteraction'][_0x12fe('0x20')]({'where':_0x130479[_0x12fe('0x1a')]?_0x130479[_0x12fe('0x1a')][_0x12fe('0x1b')]||null:null})[_0x12fe('0x1d')](function(_0x4df19e){if(_0x4df19e){return _0x4df19e['addTags'](_0x130479[_0x12fe('0x19')][_0x12fe('0x21')],_[_0x12fe('0x22')](_0x130479[_0x12fe('0x19')],[_0x12fe('0x21'),'id'])||{});}})[_0x12fe('0x23')](function(_0x4fbdd4){logger['info'](_0x12fe('0x24'),_0x130479);logger[_0x12fe('0xf')](_0x12fe('0x24'),_0x130479,JSON[_0x12fe('0x10')](_0x4fbdd4));_0x24063d(_0x4fbdd4);})[_0x12fe('0x16')](function(_0x3515e7){logger[_0x12fe('0x11')](_0x12fe('0x24'),_0x3515e7[_0x12fe('0x14')],_0x130479);_0x45a3e8(_this[_0x12fe('0x11')](0x1f4,_0x3515e7[_0x12fe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4bdee57..b525620 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 _0xccc2=['length','faxInteraction:','./faxInteraction.events','save','update','emit','removeListener','register'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xccc2,0xa2));var _0x2ccc=function(_0x4fa92b,_0x7d972){_0x4fa92b=_0x4fa92b-0x0;var _0x2a6579=_0xccc2[_0x4fa92b];return _0x2a6579;};'use strict';var FaxInteractionEvents=require(_0x2ccc('0x0'));var events=[_0x2ccc('0x1'),'remove',_0x2ccc('0x2')];function createListener(_0x2d6c3e,_0x178b8e){return function(_0x5d07da){_0x178b8e[_0x2ccc('0x3')](_0x2d6c3e,_0x5d07da);};}function removeListener(_0x3acf55,_0x4d7afb){return function(){FaxInteractionEvents[_0x2ccc('0x4')](_0x3acf55,_0x4d7afb);};}exports[_0x2ccc('0x5')]=function(_0x1fcda0){for(var _0x24aa61=0x0,_0x5834b3=events[_0x2ccc('0x6')];_0x24aa61<_0x5834b3;_0x24aa61++){var _0x3fb6b2=events[_0x24aa61];var _0x418d27=createListener(_0x2ccc('0x7')+_0x3fb6b2,_0x1fcda0);FaxInteractionEvents['on'](_0x3fb6b2,_0x418d27);}}; \ No newline at end of file +var _0x16f5=['faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x4748a2,_0x5d04bd){var _0x16c342=function(_0x26237e){while(--_0x26237e){_0x4748a2['push'](_0x4748a2['shift']());}};_0x16c342(++_0x5d04bd);}(_0x16f5,0x131));var _0x516f=function(_0x5787f0,_0x4b4a21){_0x5787f0=_0x5787f0-0x0;var _0x6e14b=_0x16f5[_0x5787f0];return _0x6e14b;};'use strict';var FaxInteractionEvents=require(_0x516f('0x0'));var events=['save',_0x516f('0x1'),_0x516f('0x2')];function createListener(_0xade8d0,_0x38cce6){return function(_0x3c1d0f){_0x38cce6[_0x516f('0x3')](_0xade8d0,_0x3c1d0f);};}function removeListener(_0x5b67ae,_0x10e890){return function(){FaxInteractionEvents[_0x516f('0x4')](_0x5b67ae,_0x10e890);};}exports[_0x516f('0x5')]=function(_0x52f100){for(var _0x2f2070=0x0,_0x11a51c=events[_0x516f('0x6')];_0x2f2070<_0x11a51c;_0x2f2070++){var _0x529921=events[_0x2f2070];var _0x2d6a49=createListener(_0x516f('0x7')+_0x529921,_0x52f100);FaxInteractionEvents['on'](_0x529921,_0x2d6a49);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2083499..6d9bdb1 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 _0xebd7=['isAuthenticated','index','get','/describe','/:id','show','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','addTags','faxinteraction:update','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xebd7,0xfc));var _0x7ebd=function(_0xa926e9,_0x4c76bc){_0xa926e9=_0xa926e9-0x0;var _0xad0ef2=_0xebd7[_0xa926e9];return _0xad0ef2;};'use strict';var multer=require('multer');var util=require(_0x7ebd('0x0'));var path=require(_0x7ebd('0x1'));var timeout=require(_0x7ebd('0x2'));var express=require('express');var router=express[_0x7ebd('0x3')]();var fs_extra=require(_0x7ebd('0x4'));var auth=require(_0x7ebd('0x5'));var interaction=require(_0x7ebd('0x6'));var config=require(_0x7ebd('0x7'));var controller=require(_0x7ebd('0x8'));router['get']('/',auth[_0x7ebd('0x9')](),controller[_0x7ebd('0xa')]);router[_0x7ebd('0xb')](_0x7ebd('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7ebd('0xd'),auth[_0x7ebd('0x9')](),controller[_0x7ebd('0xe')]);router[_0x7ebd('0xb')]('/:id/messages',auth[_0x7ebd('0x9')](),controller[_0x7ebd('0xf')]);router[_0x7ebd('0xb')](_0x7ebd('0x10'),auth[_0x7ebd('0x9')](),controller['download']);router[_0x7ebd('0x11')]('/',auth[_0x7ebd('0x9')](),controller[_0x7ebd('0x12')]);router['post'](_0x7ebd('0x13'),auth[_0x7ebd('0x9')](),controller[_0x7ebd('0x14')]);router[_0x7ebd('0x11')](_0x7ebd('0x15'),auth[_0x7ebd('0x9')](),interaction[_0x7ebd('0x16')](_0x7ebd('0x17'),'faxinteraction:addtags'),controller[_0x7ebd('0x18')]);router['put'](_0x7ebd('0xd'),auth[_0x7ebd('0x9')](),interaction[_0x7ebd('0x16')](_0x7ebd('0x17'),_0x7ebd('0x19')),controller[_0x7ebd('0x1a')]);router[_0x7ebd('0x1b')](_0x7ebd('0xd'),auth['isAuthenticated'](),interaction['tracked']('fax','faxinteraction:destroy'),controller['destroy']);router[_0x7ebd('0x1b')](_0x7ebd('0x15'),auth['isAuthenticated'](),controller['removeTags']);module[_0x7ebd('0x1c')]=router; \ No newline at end of file +var _0xf43a=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','update','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1b8297,_0x487336){var _0x3fa474=function(_0x4cb0d2){while(--_0x4cb0d2){_0x1b8297['push'](_0x1b8297['shift']());}};_0x3fa474(++_0x487336);}(_0xf43a,0x124));var _0xaf43=function(_0xbc27da,_0x55ea09){_0xbc27da=_0xbc27da-0x0;var _0x4e6ff5=_0xf43a[_0xbc27da];return _0x4e6ff5;};'use strict';var multer=require(_0xaf43('0x0'));var util=require(_0xaf43('0x1'));var path=require(_0xaf43('0x2'));var timeout=require(_0xaf43('0x3'));var express=require(_0xaf43('0x4'));var router=express[_0xaf43('0x5')]();var fs_extra=require(_0xaf43('0x6'));var auth=require(_0xaf43('0x7'));var interaction=require(_0xaf43('0x8'));var config=require(_0xaf43('0x9'));var controller=require(_0xaf43('0xa'));router[_0xaf43('0xb')]('/',auth[_0xaf43('0xc')](),controller['index']);router[_0xaf43('0xb')](_0xaf43('0xd'),auth[_0xaf43('0xc')](),controller[_0xaf43('0xe')]);router[_0xaf43('0xb')](_0xaf43('0xf'),auth[_0xaf43('0xc')](),controller[_0xaf43('0x10')]);router[_0xaf43('0xb')](_0xaf43('0x11'),auth[_0xaf43('0xc')](),controller[_0xaf43('0x12')]);router[_0xaf43('0xb')](_0xaf43('0x13'),auth[_0xaf43('0xc')](),controller[_0xaf43('0x14')]);router[_0xaf43('0x15')]('/',auth[_0xaf43('0xc')](),controller['create']);router['post'](_0xaf43('0x11'),auth[_0xaf43('0xc')](),controller[_0xaf43('0x16')]);router[_0xaf43('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xaf43('0x17')](_0xaf43('0x18'),_0xaf43('0x19')),controller[_0xaf43('0x1a')]);router['put'](_0xaf43('0xf'),auth[_0xaf43('0xc')](),interaction[_0xaf43('0x17')]('fax','faxinteraction:update'),controller[_0xaf43('0x1b')]);router['delete'](_0xaf43('0xf'),auth[_0xaf43('0xc')](),interaction[_0xaf43('0x17')]('fax','faxinteraction:destroy'),controller['destroy']);router['delete'](_0xaf43('0x1c'),auth['isAuthenticated'](),controller['removeTags']);module[_0xaf43('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b9bdfb1..cbbba19 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 _0x8e78=['TEXT','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e78,0x193));var _0x88e7=function(_0x9607f6,_0x3cec91){_0x9607f6=_0x9607f6-0x0;var _0x1aec87=_0x8e78[_0x9607f6];return _0x1aec87;};'use strict';var Sequelize=require(_0x88e7('0x0'));module[_0x88e7('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x88e7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x88e7('0x3')]('in',_0x88e7('0x4')),'defaultValue':_0x88e7('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x88e7('0x5')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x72b9=['out','TEXT','DATE','exports','medium','BOOLEAN','ENUM'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x72b9,0x16f));var _0x972b=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x72b9[_0x13ac10];return _0x28eda2;};'use strict';var Sequelize=require('sequelize');module[_0x972b('0x0')]={'body':{'type':Sequelize['TEXT'](_0x972b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x972b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x972b('0x3')]('in',_0x972b('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x972b('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x972b('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2e49d61..8138560 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 _0x4325=['code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','FaxMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','params','keys','options','find','body','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','CmContact','Contact','get','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','manual','event','EventManager','acceptmessage','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','channel','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','server','files','attachments','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x58144a,_0x33d1f7){var _0x517084=function(_0xe88f6d){while(--_0xe88f6d){_0x58144a['push'](_0x58144a['shift']());}};_0x517084(++_0x33d1f7);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'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 fs_extra=require('fs-extra');var _=require(_0x5432('0xa'));var squel=require('squel');var crypto=require(_0x5432('0xb'));var jsforce=require(_0x5432('0xc'));var deskjs=require(_0x5432('0xd'));var toCsv=require(_0x5432('0x8'));var querystring=require(_0x5432('0xe'));var Papa=require('papaparse');var Redis=require(_0x5432('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5432('0x10'));var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5432('0x14'));var licenseUtil=require(_0x5432('0x15'));var db=require('../../mysqldb')['db'];config[_0x5432('0x16')]=_[_0x5432('0x17')](config[_0x5432('0x16')],{'host':_0x5432('0x18'),'port':0x18eb});var socket=require(_0x5432('0x19'))(new Redis(config[_0x5432('0x16')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0x5432('0x1a'));var client=jayson[_0x5432('0x1b')][_0x5432('0x1c')]({'port':0x232c});var client9002=jayson[_0x5432('0x1b')][_0x5432('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11db3c,_0x5e18e8,_0x2cf409,_0x49e8fd){return new BPromise(function(_0x20aa50,_0x3de07a){var _0x333152=_0x49e8fd||client;return _0x333152[_0x5432('0x1d')](_0x11db3c,_0x2cf409)[_0x5432('0x1e')](function(_0x5f011f){logger[_0x5432('0x1f')](_0x5432('0x20'),_0x5e18e8,_0x5432('0x21'));logger[_0x5432('0x22')](_0x5432('0x23'),_0x5e18e8,_0x5432('0x21'),JSON[_0x5432('0x24')](_0x5f011f));if(_0x5f011f['error']){if(_0x5f011f[_0x5432('0x25')][_0x5432('0x26')]===0x1f4){logger[_0x5432('0x25')](_0x5432('0x20'),_0x5e18e8,_0x5f011f[_0x5432('0x25')]['message']);return _0x3de07a(_0x5f011f['error']['message']);}logger[_0x5432('0x25')](_0x5432('0x20'),_0x5e18e8,_0x5f011f[_0x5432('0x25')][_0x5432('0x27')]);return _0x20aa50(_0x5f011f['error']['message']);}else{logger[_0x5432('0x1f')](_0x5432('0x20'),_0x5e18e8,'request\x20sent');_0x20aa50(_0x5f011f[_0x5432('0x28')][_0x5432('0x27')]);}})[_0x5432('0x29')](function(_0x4b6ea5){logger[_0x5432('0x25')](_0x5432('0x20'),_0x5e18e8,_0x4b6ea5);_0x3de07a(_0x4b6ea5);});});}function respondWithStatusCode(_0xe7eda2,_0x520da1){_0x520da1=_0x520da1||0xcc;return function(_0x4ab09d){if(_0x4ab09d){return _0xe7eda2[_0x5432('0x2a')](_0x520da1);}return _0xe7eda2[_0x5432('0x2b')](_0x520da1)['end']();};}function respondWithResult(_0x1abe73,_0x66a647){_0x66a647=_0x66a647||0xc8;return function(_0x1f2e8f){if(_0x1f2e8f){return _0x1abe73['status'](_0x66a647)[_0x5432('0x2c')](_0x1f2e8f);}};}function respondWithFilteredResult(_0x5be867,_0x4821be){return function(_0x6fc7f5){if(_0x6fc7f5){var _0x4a52ba=_0x6fc7f5[_0x5432('0x2d')],_0x428141=_0x4821be[_0x5432('0x2e')],_0x578281=_0x4821be[_0x5432('0x2e')]+_0x4821be['limit'],_0x59a866;if(_0x578281>=_0x4a52ba){_0x578281=_0x4a52ba;_0x59a866=0xc8;}else{_0x59a866=0xce;}_0x5be867[_0x5432('0x2b')](_0x59a866);return _0x5be867[_0x5432('0x2f')](_0x5432('0x30'),_0x428141+'-'+_0x578281+'/'+_0x4a52ba)[_0x5432('0x2c')](_0x6fc7f5);}return null;};}function patchUpdates(_0x1a5612){return function(_0x308b4c){try{jsonpatch[_0x5432('0x31')](_0x308b4c,_0x1a5612,!![]);}catch(_0x444178){return BPromise[_0x5432('0x32')](_0x444178);}return _0x308b4c['save']();};}function saveUpdates(_0x57fd0b,_0x240dec){return function(_0x42ab1e){if(_0x42ab1e){return _0x42ab1e[_0x5432('0x33')](_0x57fd0b)[_0x5432('0x1e')](function(_0x119712){return _0x119712;});}return null;};}function removeEntity(_0x4ce287,_0x30a07f){return function(_0x5649b6){if(_0x5649b6){return _0x5649b6[_0x5432('0x34')]()[_0x5432('0x1e')](function(){_0x4ce287[_0x5432('0x2b')](0xcc)[_0x5432('0x35')]();});}};}function handleEntityNotFound(_0xb17e78,_0x112c83){return function(_0x5c3c77){if(!_0x5c3c77){_0xb17e78[_0x5432('0x2a')](0x194);}return _0x5c3c77;};}function handleError(_0x34d6e3,_0x2e8d14){_0x2e8d14=_0x2e8d14||0x1f4;return function(_0xcfb6e8){logger['error'](_0xcfb6e8[_0x5432('0x36')]);if(_0xcfb6e8[_0x5432('0x37')]){delete _0xcfb6e8[_0x5432('0x37')];}_0x34d6e3[_0x5432('0x2b')](_0x2e8d14)[_0x5432('0x38')](_0xcfb6e8);};}exports[_0x5432('0x39')]=function(_0x2618ce,_0x92b0b3){var _0x228c59={},_0x571bbe={},_0x1444f8={'count':0x0,'rows':[]};var _0x1f4679=_[_0x5432('0x3a')](db[_0x5432('0x3b')]['rawAttributes'],function(_0x268f65){return{'name':_0x268f65['fieldName'],'type':_0x268f65[_0x5432('0x3c')][_0x5432('0x3d')]};});_0x571bbe[_0x5432('0x3e')]=_[_0x5432('0x3a')](_0x1f4679,'name');_0x571bbe['query']=_['keys'](_0x2618ce[_0x5432('0x3f')]);_0x571bbe[_0x5432('0x40')]=_[_0x5432('0x41')](_0x571bbe[_0x5432('0x3e')],_0x571bbe['query']);_0x228c59[_0x5432('0x42')]=_[_0x5432('0x41')](_0x571bbe[_0x5432('0x3e')],qs['fields'](_0x2618ce[_0x5432('0x3f')][_0x5432('0x43')]));_0x228c59['attributes']=_0x228c59[_0x5432('0x42')][_0x5432('0x44')]?_0x228c59['attributes']:_0x571bbe[_0x5432('0x3e')];if(!_0x2618ce['query'][_0x5432('0x45')](_0x5432('0x46'))){_0x228c59[_0x5432('0x47')]=qs[_0x5432('0x47')](_0x2618ce['query'][_0x5432('0x47')]);_0x228c59['offset']=qs[_0x5432('0x2e')](_0x2618ce[_0x5432('0x3f')][_0x5432('0x2e')]);}_0x228c59[_0x5432('0x48')]=qs[_0x5432('0x49')](_0x2618ce[_0x5432('0x3f')][_0x5432('0x49')]);_0x228c59['where']=qs[_0x5432('0x40')](_[_0x5432('0x4a')](_0x2618ce[_0x5432('0x3f')],_0x571bbe[_0x5432('0x40')]),_0x1f4679);if(_0x2618ce[_0x5432('0x3f')][_0x5432('0x4b')]){_0x228c59[_0x5432('0x4c')]=_['merge'](_0x228c59[_0x5432('0x4c')],{'$or':_[_0x5432('0x3a')](_0x1f4679,function(_0x43ed9c){if(_0x43ed9c[_0x5432('0x3c')]!==_0x5432('0x4d')){var _0x4e8dba={};_0x4e8dba[_0x43ed9c[_0x5432('0x37')]]={'$like':'%'+_0x2618ce['query'][_0x5432('0x4b')]+'%'};return _0x4e8dba;}})});}_0x228c59=_[_0x5432('0x4e')]({},_0x228c59,_0x2618ce['options']);var _0x40e036={'where':_0x228c59['where']};return db[_0x5432('0x3b')][_0x5432('0x2d')](_0x40e036)['then'](function(_0x4ba050){_0x1444f8[_0x5432('0x2d')]=_0x4ba050;if(_0x2618ce[_0x5432('0x3f')][_0x5432('0x4f')]){_0x228c59[_0x5432('0x50')]=[{'all':!![]}];}return db[_0x5432('0x3b')][_0x5432('0x51')](_0x228c59);})[_0x5432('0x1e')](function(_0x4e3f9b){_0x1444f8[_0x5432('0x52')]=_0x4e3f9b;return _0x1444f8;})[_0x5432('0x1e')](respondWithFilteredResult(_0x92b0b3,_0x228c59))[_0x5432('0x29')](handleError(_0x92b0b3,null));};exports['show']=function(_0x5ca992,_0x483777){var _0x487dbf={'raw':!![],'where':{'id':_0x5ca992[_0x5432('0x53')]['id']}},_0x26d6ae={};_0x26d6ae[_0x5432('0x3e')]=_[_0x5432('0x54')](db[_0x5432('0x3b')]['rawAttributes']);_0x26d6ae[_0x5432('0x3f')]=_[_0x5432('0x54')](_0x5ca992[_0x5432('0x3f')]);_0x26d6ae['filters']=_[_0x5432('0x41')](_0x26d6ae[_0x5432('0x3e')],_0x26d6ae[_0x5432('0x3f')]);_0x487dbf[_0x5432('0x42')]=_[_0x5432('0x41')](_0x26d6ae['model'],qs[_0x5432('0x43')](_0x5ca992['query'][_0x5432('0x43')]));_0x487dbf['attributes']=_0x487dbf[_0x5432('0x42')][_0x5432('0x44')]?_0x487dbf['attributes']:_0x26d6ae[_0x5432('0x3e')];if(_0x5ca992['query'][_0x5432('0x4f')]){_0x487dbf[_0x5432('0x50')]=[{'all':!![]}];}_0x487dbf=_[_0x5432('0x4e')]({},_0x487dbf,_0x5ca992[_0x5432('0x55')]);return db['FaxMessage'][_0x5432('0x56')](_0x487dbf)['then'](handleEntityNotFound(_0x483777,null))[_0x5432('0x1e')](respondWithResult(_0x483777,null))['catch'](handleError(_0x483777,null));};exports[_0x5432('0x33')]=function(_0x8c72f1,_0x37d69b){if(_0x8c72f1[_0x5432('0x57')]['id']){delete _0x8c72f1[_0x5432('0x57')]['id'];}return db[_0x5432('0x3b')][_0x5432('0x56')]({'where':{'id':_0x8c72f1[_0x5432('0x53')]['id']}})[_0x5432('0x1e')](handleEntityNotFound(_0x37d69b,null))[_0x5432('0x1e')](saveUpdates(_0x8c72f1['body'],null))[_0x5432('0x1e')](respondWithResult(_0x37d69b,null))[_0x5432('0x29')](handleError(_0x37d69b,null));};exports['destroy']=function(_0x324691,_0x3eb16e){return db[_0x5432('0x3b')][_0x5432('0x56')]({'where':{'id':_0x324691[_0x5432('0x53')]['id']}})['then'](handleEntityNotFound(_0x3eb16e,null))['then'](removeEntity(_0x3eb16e,null))['catch'](handleError(_0x3eb16e,null));};exports['describe']=function(_0x3687b7,_0x806f5c){return db[_0x5432('0x3b')]['describe']()[_0x5432('0x1e')](respondWithResult(_0x806f5c,null))[_0x5432('0x29')](handleError(_0x806f5c,null));};var interaction_log=require(_0x5432('0x13'))(_0x5432('0x58'));exports[_0x5432('0x59')]=function(_0xf7a6bd,_0x328211,_0x3a2d2c){var _0x6614b8={'agent':{},'channel':_0x5432('0x5a')};if(_0xf7a6bd[_0x5432('0x57')]['id']){delete _0xf7a6bd['body']['id'];}_0xf7a6bd[_0x5432('0x57')][_0x5432('0x5b')]=!![];_0xf7a6bd[_0x5432('0x57')][_0x5432('0x5c')]=moment()[_0x5432('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0xf7a6bd[_0x5432('0x57')]['UserId']=_0xf7a6bd[_0x5432('0x57')][_0x5432('0x5e')]||_0xf7a6bd[_0x5432('0x5f')]['id'];_0x6614b8[_0x5432('0x60')]['id']=_0xf7a6bd[_0x5432('0x57')][_0x5432('0x5e')];return db[_0x5432('0x3b')][_0x5432('0x56')]({'where':{'id':_0xf7a6bd[_0x5432('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x5432('0x61')],'as':_0x5432('0x62')}]})[_0x5432('0x1e')](handleEntityNotFound(_0x328211,null))[_0x5432('0x1e')](saveUpdates(_0xf7a6bd[_0x5432('0x57')],null))[_0x5432('0x1e')](function(_0xb85b53){if(_0xb85b53){_0x6614b8[_0x5432('0x27')]=_0xb85b53[_0x5432('0x63')]({'plain':!![]});return db['FaxInteraction'][_0x5432('0x56')]({'where':{'id':_0xb85b53['FaxInteractionId']}});}return null;})[_0x5432('0x1e')](handleEntityNotFound(_0x328211,null))[_0x5432('0x1e')](function(_0x5aebe8){if(_0x5aebe8){return _0x5aebe8[_0x5432('0x33')]({'UserId':_0xf7a6bd[_0x5432('0x57')][_0x5432('0x5e')],'read1stAt':_[_0x5432('0x64')](_0x5aebe8['read1stAt'])?moment()[_0x5432('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5432('0x1e')](function(_0x18ef7f){if(_0x18ef7f){_0x6614b8[_0x5432('0x65')]=_0x18ef7f[_0x5432('0x63')]({'plain':!![]});interaction_log[_0x5432('0x1f')](_0x5432('0x66'),_0xf7a6bd['user']['id'],_0xf7a6bd[_0x5432('0x5f')][_0x5432('0x37')],_0xf7a6bd['user']['role'],_0x6614b8[_0x5432('0x65')]['id'],_0xf7a6bd['body']?JSON[_0x5432('0x24')](_0xf7a6bd['body']):_0x5432('0x67'));return respondWithRpcPromise('AcceptMessage',_0x5432('0x68'),_0x6614b8);}return null;})['then'](function(_0x5b4586){if(_0x5b4586){if(_0xf7a6bd[_0x5432('0x57')][_0x5432('0x69')]){_0x6614b8[_0x5432('0x27')]['interface']=util['format']('SIP/%s',_0xf7a6bd[_0x5432('0x5f')][_0x5432('0x37')]);_0x6614b8[_0x5432('0x27')]['channel']=_0x6614b8['channel'];_0x6614b8[_0x5432('0x27')][_0x5432('0x6a')]=_0x5432('0x59');return respondWithRpcPromise(_0x5432('0x6b'),_0x5432('0x6b'),{'event':_0x5432('0x6c'),'message':_0x6614b8[_0x5432('0x27')]},client9002)[_0x5432('0x1e')](function(){return _0x6614b8;});}return _0x6614b8;}return null;})['then'](respondWithResult(_0x328211,null))[_0x5432('0x29')](handleError(_0x328211,null));};var interaction_log=require('../../config/logger')(_0x5432('0x58'));exports[_0x5432('0x32')]=function(_0x45258b,_0x94062d,_0x304d81){var _0x332362={'agent':{},'channel':_0x5432('0x5a')};if(_0x45258b['body']['id']){delete _0x45258b[_0x5432('0x57')]['id'];}_0x45258b[_0x5432('0x57')][_0x5432('0x5e')]=_0x45258b[_0x5432('0x57')]['UserId']||_0x45258b[_0x5432('0x5f')]['id'];_0x332362[_0x5432('0x60')]['id']=_0x45258b[_0x5432('0x57')][_0x5432('0x5e')];return db[_0x5432('0x3b')][_0x5432('0x56')]({'where':{'id':_0x45258b[_0x5432('0x53')]['id'],'UserId':null}})[_0x5432('0x1e')](handleEntityNotFound(_0x94062d,null))['then'](function(_0x317b5b){if(_0x317b5b){_0x332362[_0x5432('0x27')]=_0x317b5b[_0x5432('0x63')]({'plain':!![]});return db[_0x5432('0x6d')][_0x5432('0x56')]({'where':{'id':_0x317b5b[_0x5432('0x6e')]}});}return null;})[_0x5432('0x1e')](handleEntityNotFound(_0x94062d,null))['then'](function(_0x1334ac){if(_0x1334ac){_0x332362[_0x5432('0x65')]=_0x1334ac[_0x5432('0x63')]({'plain':!![]});interaction_log[_0x5432('0x1f')](_0x5432('0x6f'),_0x45258b[_0x5432('0x5f')]['id'],_0x45258b['user']['name'],_0x45258b['user']['role'],_0x332362[_0x5432('0x65')]['id'],_0x45258b['body']?JSON[_0x5432('0x24')](_0x45258b[_0x5432('0x57')]):'null');return respondWithRpcPromise(_0x5432('0x70'),'rejectMessage',_0x332362);}return null;})['then'](function(_0x31a516){if(_0x31a516){_0x31a516[_0x5432('0x27')]['interface']=util[_0x5432('0x5d')](_0x5432('0x71'),_0x45258b[_0x5432('0x5f')]['name']);_0x31a516[_0x5432('0x27')][_0x5432('0x72')]=_0x332362['channel'];_0x31a516[_0x5432('0x27')]['event']=_0x5432('0x32');respondWithRpcPromise(_0x5432('0x6b'),_0x5432('0x6b'),{'event':_0x5432('0x73'),'message':_0x31a516[_0x5432('0x27')]},client9002);return _0x332362;}return null;})[_0x5432('0x1e')](respondWithResult(_0x94062d,null))['catch'](handleError(_0x94062d,null));};exports[_0x5432('0x74')]=function(_0x276772,_0x51f54f){var _0x45b0bb;return db[_0x5432('0x3b')][_0x5432('0x74')](_0x276772[_0x5432('0x57')],{})[_0x5432('0x1e')](function(_0x3aad8f){_0x45b0bb=_0x3aad8f;return db['CmContact'][_0x5432('0x75')]({'where':{'id':_0x45b0bb['ContactId']}});})['then'](function(_0x5e12f5){if(_[_0x5432('0x64')](_0x5e12f5)){return;}else{_0x45b0bb['fax']=_0x5e12f5['fax'];return db[_0x5432('0x76')]['findOne']({'where':{'id':_0x45b0bb[_0x5432('0x77')]}});}})[_0x5432('0x1e')](function(_0x2d26f7){return respondWithRpcPromise(_0x5432('0x78'),_0x5432('0x78'),{'FaxAccountId':_[_0x5432('0x64')](_0x276772[_0x5432('0x57')])?undefined:_0x276772[_0x5432('0x57')][_0x5432('0x79')],'path':_[_0x5432('0x64')](_0x2d26f7)?undefined:util[_0x5432('0x5d')](_0x5432('0x7a'),_0x2d26f7['basename']),'fax':_[_0x5432('0x64')](_0x45b0bb['fax'])?undefined:_0x45b0bb[_0x5432('0x5a')],'AttachmentId':_0x45b0bb[_0x5432('0x77')]},client9002);})[_0x5432('0x1e')](respondWithResult(_0x51f54f,0xc9))['catch'](handleError(_0x51f54f,null));};exports[_0x5432('0x7b')]=function(_0x221a7b,_0x1b2a4c){var _0x6b8913=path[_0x5432('0x7c')](config['root'],_0x5432('0x7d'),_0x5432('0x7e'),_0x5432('0x7f'));return db[_0x5432('0x3b')][_0x5432('0x56')]({'where':{'id':_0x221a7b[_0x5432('0x53')]['id']},'include':[{'model':db[_0x5432('0x76')],'as':_0x5432('0x76')}]})[_0x5432('0x1e')](handleEntityNotFound(_0x1b2a4c,null))[_0x5432('0x1e')](function(_0x70a811){if(_0x70a811){return _0x1b2a4c[_0x5432('0x7b')](path[_0x5432('0x7c')](_0x6b8913,_0x70a811[_0x5432('0x76')]['basename']));}})[_0x5432('0x29')](handleError(_0x1b2a4c,null));}; \ No newline at end of file +var _0x97c1=['error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','destroy','stack','name','send','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','show','length','find','update','params','describe','fax-interactions','fax','body','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteractionId','isNil','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','root','server','files','basename','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5760f6,_0x36517d){var _0x3b9b18=function(_0x631e9e){while(--_0x631e9e){_0x5760f6['push'](_0x5760f6['shift']());}};_0x3b9b18(++_0x36517d);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0x197c('0x0'));var emlformat=require(_0x197c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x197c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x197c('0x3'));var BPromise=require(_0x197c('0x4'));var Mustache=require(_0x197c('0x5'));var util=require(_0x197c('0x6'));var path=require(_0x197c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x197c('0x8'));var fs=require('fs');var fs_extra=require(_0x197c('0x9'));var _=require(_0x197c('0xa'));var squel=require(_0x197c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x197c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x197c('0xd'));var Papa=require(_0x197c('0xe'));var Redis=require(_0x197c('0xf'));var authService=require(_0x197c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x197c('0x11'));var hardwareService=require(_0x197c('0x12'));var logger=require(_0x197c('0x13'))(_0x197c('0x14'));var utils=require(_0x197c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x197c('0x16'));var db=require(_0x197c('0x17'))['db'];config[_0x197c('0x18')]=_[_0x197c('0x19')](config['redis'],{'host':_0x197c('0x1a'),'port':0x18eb});var socket=require(_0x197c('0x1b'))(new Redis(config[_0x197c('0x18')]));require(_0x197c('0x1c'))[_0x197c('0x1d')](socket);var jayson=require(_0x197c('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x197c('0x1f')][_0x197c('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2083d4,_0x24901f,_0x33f8d3,_0x7e302f){return new BPromise(function(_0x437050,_0x75beba){var _0x47f43b=_0x7e302f||client;return _0x47f43b[_0x197c('0x21')](_0x2083d4,_0x33f8d3)['then'](function(_0x50ac52){logger[_0x197c('0x22')](_0x197c('0x23'),_0x24901f,_0x197c('0x24'));logger[_0x197c('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x24901f,_0x197c('0x24'),JSON[_0x197c('0x26')](_0x50ac52));if(_0x50ac52[_0x197c('0x27')]){if(_0x50ac52['error'][_0x197c('0x28')]===0x1f4){logger[_0x197c('0x27')](_0x197c('0x23'),_0x24901f,_0x50ac52[_0x197c('0x27')][_0x197c('0x29')]);return _0x75beba(_0x50ac52[_0x197c('0x27')][_0x197c('0x29')]);}logger[_0x197c('0x27')](_0x197c('0x23'),_0x24901f,_0x50ac52[_0x197c('0x27')][_0x197c('0x29')]);return _0x437050(_0x50ac52[_0x197c('0x27')][_0x197c('0x29')]);}else{logger[_0x197c('0x22')](_0x197c('0x23'),_0x24901f,_0x197c('0x24'));_0x437050(_0x50ac52['result'][_0x197c('0x29')]);}})[_0x197c('0x2a')](function(_0x2b6319){logger['error'](_0x197c('0x23'),_0x24901f,_0x2b6319);_0x75beba(_0x2b6319);});});}function respondWithStatusCode(_0x3331ac,_0x4c3337){_0x4c3337=_0x4c3337||0xcc;return function(_0x5e7bc9){if(_0x5e7bc9){return _0x3331ac[_0x197c('0x2b')](_0x4c3337);}return _0x3331ac['status'](_0x4c3337)[_0x197c('0x2c')]();};}function respondWithResult(_0x14b0aa,_0x4e9a06){_0x4e9a06=_0x4e9a06||0xc8;return function(_0x16e026){if(_0x16e026){return _0x14b0aa[_0x197c('0x2d')](_0x4e9a06)[_0x197c('0x2e')](_0x16e026);}};}function respondWithFilteredResult(_0x2b6154,_0x215df1){return function(_0x4422d1){if(_0x4422d1){var _0x5df39e=_0x4422d1[_0x197c('0x2f')],_0x50dea3=_0x215df1['offset'],_0x574274=_0x215df1[_0x197c('0x30')]+_0x215df1[_0x197c('0x31')],_0x57c289;if(_0x574274>=_0x5df39e){_0x574274=_0x5df39e;_0x57c289=0xc8;}else{_0x57c289=0xce;}_0x2b6154['status'](_0x57c289);return _0x2b6154[_0x197c('0x32')]('Content-Range',_0x50dea3+'-'+_0x574274+'/'+_0x5df39e)[_0x197c('0x2e')](_0x4422d1);}return null;};}function patchUpdates(_0x1155e1){return function(_0x2ace33){try{jsonpatch[_0x197c('0x33')](_0x2ace33,_0x1155e1,!![]);}catch(_0x156332){return BPromise[_0x197c('0x34')](_0x156332);}return _0x2ace33[_0x197c('0x35')]();};}function saveUpdates(_0x41d792,_0x1e974e){return function(_0x5692d9){if(_0x5692d9){return _0x5692d9['update'](_0x41d792)[_0x197c('0x36')](function(_0x3af036){return _0x3af036;});}return null;};}function removeEntity(_0x3c56e3,_0x147257){return function(_0x2c3623){if(_0x2c3623){return _0x2c3623[_0x197c('0x37')]()[_0x197c('0x36')](function(){_0x3c56e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x146f59,_0x70a54){return function(_0x4d085b){if(!_0x4d085b){_0x146f59['sendStatus'](0x194);}return _0x4d085b;};}function handleError(_0x3cdaa1,_0x2a884b){_0x2a884b=_0x2a884b||0x1f4;return function(_0x218339){logger[_0x197c('0x27')](_0x218339[_0x197c('0x38')]);if(_0x218339[_0x197c('0x39')]){delete _0x218339[_0x197c('0x39')];}_0x3cdaa1[_0x197c('0x2d')](_0x2a884b)[_0x197c('0x3a')](_0x218339);};}exports['index']=function(_0x330f51,_0x221788){var _0x358900={},_0x41269e={},_0x14d169={'count':0x0,'rows':[]};var _0x151e2f=_['map'](db[_0x197c('0x3b')][_0x197c('0x3c')],function(_0x2c6cbc){return{'name':_0x2c6cbc['fieldName'],'type':_0x2c6cbc[_0x197c('0x3d')][_0x197c('0x3e')]};});_0x41269e[_0x197c('0x3f')]=_[_0x197c('0x40')](_0x151e2f,_0x197c('0x39'));_0x41269e[_0x197c('0x41')]=_[_0x197c('0x42')](_0x330f51[_0x197c('0x41')]);_0x41269e[_0x197c('0x43')]=_[_0x197c('0x44')](_0x41269e['model'],_0x41269e[_0x197c('0x41')]);_0x358900[_0x197c('0x45')]=_['intersection'](_0x41269e['model'],qs[_0x197c('0x46')](_0x330f51[_0x197c('0x41')][_0x197c('0x46')]));_0x358900[_0x197c('0x45')]=_0x358900[_0x197c('0x45')]['length']?_0x358900[_0x197c('0x45')]:_0x41269e[_0x197c('0x3f')];if(!_0x330f51[_0x197c('0x41')][_0x197c('0x47')](_0x197c('0x48'))){_0x358900['limit']=qs[_0x197c('0x31')](_0x330f51[_0x197c('0x41')][_0x197c('0x31')]);_0x358900[_0x197c('0x30')]=qs[_0x197c('0x30')](_0x330f51['query'][_0x197c('0x30')]);}_0x358900[_0x197c('0x49')]=qs[_0x197c('0x4a')](_0x330f51[_0x197c('0x41')][_0x197c('0x4a')]);_0x358900[_0x197c('0x4b')]=qs[_0x197c('0x43')](_[_0x197c('0x4c')](_0x330f51[_0x197c('0x41')],_0x41269e[_0x197c('0x43')]),_0x151e2f);if(_0x330f51[_0x197c('0x41')]['filter']){_0x358900['where']=_['merge'](_0x358900['where'],{'$or':_[_0x197c('0x40')](_0x151e2f,function(_0x34271f){if(_0x34271f['type']!==_0x197c('0x4d')){var _0x3899b1={};_0x3899b1[_0x34271f['name']]={'$like':'%'+_0x330f51[_0x197c('0x41')][_0x197c('0x4e')]+'%'};return _0x3899b1;}})});}_0x358900=_['merge']({},_0x358900,_0x330f51[_0x197c('0x4f')]);var _0x233ae1={'where':_0x358900['where']};return db[_0x197c('0x3b')][_0x197c('0x2f')](_0x233ae1)[_0x197c('0x36')](function(_0x5b4e52){_0x14d169[_0x197c('0x2f')]=_0x5b4e52;if(_0x330f51[_0x197c('0x41')][_0x197c('0x50')]){_0x358900[_0x197c('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x197c('0x52')](_0x358900);})[_0x197c('0x36')](function(_0x190819){_0x14d169['rows']=_0x190819;return _0x14d169;})['then'](respondWithFilteredResult(_0x221788,_0x358900))[_0x197c('0x2a')](handleError(_0x221788,null));};exports[_0x197c('0x53')]=function(_0x364bc5,_0x108f6d){var _0x11025f={'raw':!![],'where':{'id':_0x364bc5['params']['id']}},_0x28fac4={};_0x28fac4[_0x197c('0x3f')]=_['keys'](db[_0x197c('0x3b')][_0x197c('0x3c')]);_0x28fac4[_0x197c('0x41')]=_[_0x197c('0x42')](_0x364bc5[_0x197c('0x41')]);_0x28fac4[_0x197c('0x43')]=_[_0x197c('0x44')](_0x28fac4[_0x197c('0x3f')],_0x28fac4['query']);_0x11025f[_0x197c('0x45')]=_[_0x197c('0x44')](_0x28fac4[_0x197c('0x3f')],qs['fields'](_0x364bc5[_0x197c('0x41')]['fields']));_0x11025f[_0x197c('0x45')]=_0x11025f[_0x197c('0x45')][_0x197c('0x54')]?_0x11025f[_0x197c('0x45')]:_0x28fac4[_0x197c('0x3f')];if(_0x364bc5[_0x197c('0x41')][_0x197c('0x50')]){_0x11025f[_0x197c('0x51')]=[{'all':!![]}];}_0x11025f=_['merge']({},_0x11025f,_0x364bc5[_0x197c('0x4f')]);return db[_0x197c('0x3b')][_0x197c('0x55')](_0x11025f)['then'](handleEntityNotFound(_0x108f6d,null))[_0x197c('0x36')](respondWithResult(_0x108f6d,null))[_0x197c('0x2a')](handleError(_0x108f6d,null));};exports[_0x197c('0x56')]=function(_0x1043a5,_0x3388fa){if(_0x1043a5['body']['id']){delete _0x1043a5['body']['id'];}return db[_0x197c('0x3b')][_0x197c('0x55')]({'where':{'id':_0x1043a5[_0x197c('0x57')]['id']}})[_0x197c('0x36')](handleEntityNotFound(_0x3388fa,null))[_0x197c('0x36')](saveUpdates(_0x1043a5['body'],null))['then'](respondWithResult(_0x3388fa,null))[_0x197c('0x2a')](handleError(_0x3388fa,null));};exports[_0x197c('0x37')]=function(_0x5855bd,_0xb3747b){return db[_0x197c('0x3b')][_0x197c('0x55')]({'where':{'id':_0x5855bd[_0x197c('0x57')]['id']}})[_0x197c('0x36')](handleEntityNotFound(_0xb3747b,null))[_0x197c('0x36')](removeEntity(_0xb3747b,null))['catch'](handleError(_0xb3747b,null));};exports[_0x197c('0x58')]=function(_0x145939,_0x57c8c8){return db['FaxMessage'][_0x197c('0x58')]()['then'](respondWithResult(_0x57c8c8,null))[_0x197c('0x2a')](handleError(_0x57c8c8,null));};var interaction_log=require(_0x197c('0x13'))(_0x197c('0x59'));exports['accept']=function(_0x104034,_0x3da366,_0x5585de){var _0x2dcbca={'agent':{},'channel':_0x197c('0x5a')};if(_0x104034[_0x197c('0x5b')]['id']){delete _0x104034['body']['id'];}_0x104034[_0x197c('0x5b')][_0x197c('0x5c')]=!![];_0x104034['body']['readAt']=moment()[_0x197c('0x5d')](_0x197c('0x5e'));_0x104034[_0x197c('0x5b')]['UserId']=_0x104034[_0x197c('0x5b')][_0x197c('0x5f')]||_0x104034[_0x197c('0x60')]['id'];_0x2dcbca['agent']['id']=_0x104034[_0x197c('0x5b')][_0x197c('0x5f')];return db[_0x197c('0x3b')][_0x197c('0x55')]({'where':{'id':_0x104034[_0x197c('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x197c('0x61')],'as':_0x197c('0x62')}]})[_0x197c('0x36')](handleEntityNotFound(_0x3da366,null))[_0x197c('0x36')](saveUpdates(_0x104034[_0x197c('0x5b')],null))['then'](function(_0x1f7ad0){if(_0x1f7ad0){_0x2dcbca['message']=_0x1f7ad0['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x1f7ad0[_0x197c('0x63')]}});}return null;})[_0x197c('0x36')](handleEntityNotFound(_0x3da366,null))[_0x197c('0x36')](function(_0x3ad734){if(_0x3ad734){return _0x3ad734['update']({'UserId':_0x104034[_0x197c('0x5b')]['UserId'],'read1stAt':_[_0x197c('0x64')](_0x3ad734['read1stAt'])?moment()[_0x197c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x197c('0x36')](function(_0x1f6c6f){if(_0x1f6c6f){_0x2dcbca[_0x197c('0x65')]=_0x1f6c6f[_0x197c('0x66')]({'plain':!![]});interaction_log['info'](_0x197c('0x67'),_0x104034[_0x197c('0x60')]['id'],_0x104034[_0x197c('0x60')]['name'],_0x104034[_0x197c('0x60')][_0x197c('0x68')],_0x2dcbca[_0x197c('0x65')]['id'],_0x104034[_0x197c('0x5b')]?JSON[_0x197c('0x26')](_0x104034[_0x197c('0x5b')]):_0x197c('0x69'));return respondWithRpcPromise(_0x197c('0x6a'),_0x197c('0x6b'),_0x2dcbca);}return null;})[_0x197c('0x36')](function(_0x342efa){if(_0x342efa){if(_0x104034[_0x197c('0x5b')][_0x197c('0x6c')]){_0x2dcbca[_0x197c('0x29')][_0x197c('0x6d')]=util[_0x197c('0x5d')](_0x197c('0x6e'),_0x104034[_0x197c('0x60')]['name']);_0x2dcbca['message']['channel']=_0x2dcbca[_0x197c('0x6f')];_0x2dcbca['message'][_0x197c('0x70')]='accept';return respondWithRpcPromise('EventManager',_0x197c('0x71'),{'event':_0x197c('0x72'),'message':_0x2dcbca[_0x197c('0x29')]},client9002)['then'](function(){return _0x2dcbca;});}return _0x2dcbca;}return null;})[_0x197c('0x36')](respondWithResult(_0x3da366,null))[_0x197c('0x2a')](handleError(_0x3da366,null));};var interaction_log=require('../../config/logger')(_0x197c('0x59'));exports[_0x197c('0x34')]=function(_0xfb27c2,_0x1ac651,_0x54206a){var _0x10217d={'agent':{},'channel':'fax'};if(_0xfb27c2[_0x197c('0x5b')]['id']){delete _0xfb27c2['body']['id'];}_0xfb27c2[_0x197c('0x5b')][_0x197c('0x5f')]=_0xfb27c2[_0x197c('0x5b')]['UserId']||_0xfb27c2[_0x197c('0x60')]['id'];_0x10217d[_0x197c('0x73')]['id']=_0xfb27c2[_0x197c('0x5b')]['UserId'];return db[_0x197c('0x3b')][_0x197c('0x55')]({'where':{'id':_0xfb27c2[_0x197c('0x57')]['id'],'UserId':null}})[_0x197c('0x36')](handleEntityNotFound(_0x1ac651,null))[_0x197c('0x36')](function(_0x1c18aa){if(_0x1c18aa){_0x10217d['message']=_0x1c18aa[_0x197c('0x66')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x1c18aa[_0x197c('0x63')]}});}return null;})[_0x197c('0x36')](handleEntityNotFound(_0x1ac651,null))['then'](function(_0x41a758){if(_0x41a758){_0x10217d[_0x197c('0x65')]=_0x41a758[_0x197c('0x66')]({'plain':!![]});interaction_log[_0x197c('0x22')](_0x197c('0x74'),_0xfb27c2['user']['id'],_0xfb27c2['user']['name'],_0xfb27c2['user'][_0x197c('0x68')],_0x10217d[_0x197c('0x65')]['id'],_0xfb27c2['body']?JSON['stringify'](_0xfb27c2[_0x197c('0x5b')]):'null');return respondWithRpcPromise('RejectMessage',_0x197c('0x75'),_0x10217d);}return null;})[_0x197c('0x36')](function(_0x1b2dd4){if(_0x1b2dd4){_0x1b2dd4[_0x197c('0x29')][_0x197c('0x6d')]=util[_0x197c('0x5d')]('SIP/%s',_0xfb27c2[_0x197c('0x60')][_0x197c('0x39')]);_0x1b2dd4[_0x197c('0x29')][_0x197c('0x6f')]=_0x10217d[_0x197c('0x6f')];_0x1b2dd4[_0x197c('0x29')][_0x197c('0x70')]='reject';respondWithRpcPromise(_0x197c('0x71'),_0x197c('0x71'),{'event':_0x197c('0x76'),'message':_0x1b2dd4[_0x197c('0x29')]},client9002);return _0x10217d;}return null;})[_0x197c('0x36')](respondWithResult(_0x1ac651,null))[_0x197c('0x2a')](handleError(_0x1ac651,null));};exports['create']=function(_0x704f3,_0x2b09cd){var _0x530d41;return db[_0x197c('0x3b')][_0x197c('0x77')](_0x704f3[_0x197c('0x5b')],{})[_0x197c('0x36')](function(_0x15f9a7){_0x530d41=_0x15f9a7;return db['CmContact']['findOne']({'where':{'id':_0x530d41['ContactId']}});})[_0x197c('0x36')](function(_0x4aa465){if(_['isNil'](_0x4aa465)){return;}else{_0x530d41[_0x197c('0x5a')]=_0x4aa465[_0x197c('0x5a')];return db[_0x197c('0x78')][_0x197c('0x79')]({'where':{'id':_0x530d41[_0x197c('0x7a')]}});}})['then'](function(_0x4d49f5){return respondWithRpcPromise(_0x197c('0x7b'),_0x197c('0x7b'),{'FaxAccountId':_['isNil'](_0x704f3[_0x197c('0x5b')])?undefined:_0x704f3[_0x197c('0x5b')][_0x197c('0x7c')],'path':_[_0x197c('0x64')](_0x4d49f5)?undefined:util[_0x197c('0x5d')](_0x197c('0x7d'),_0x4d49f5['basename']),'fax':_[_0x197c('0x64')](_0x530d41[_0x197c('0x5a')])?undefined:_0x530d41[_0x197c('0x5a')],'AttachmentId':_0x530d41[_0x197c('0x7a')]},client9002);})[_0x197c('0x36')](respondWithResult(_0x2b09cd,0xc9))['catch'](handleError(_0x2b09cd,null));};exports['download']=function(_0xe515a1,_0x590996){var _0x1ea452=path[_0x197c('0x7e')](config[_0x197c('0x7f')],_0x197c('0x80'),_0x197c('0x81'),'attachments');return db[_0x197c('0x3b')][_0x197c('0x55')]({'where':{'id':_0xe515a1[_0x197c('0x57')]['id']},'include':[{'model':db[_0x197c('0x78')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x590996,null))[_0x197c('0x36')](function(_0x4be5c1){if(_0x4be5c1){return _0x590996['download'](path[_0x197c('0x7e')](_0x1ea452,_0x4be5c1[_0x197c('0x78')][_0x197c('0x82')]));}})['catch'](handleError(_0x590996,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b57ef38..2bcff79 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x5c2829,_0x2e1482){var _0x4d6544=function(_0x63b01e){while(--_0x63b01e){_0x5c2829['push'](_0x5c2829['shift']());}};_0x4d6544(++_0x2e1482);}(_0x7217,0x19e));var _0x7721=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7217[_0x4baae2];return _0x1a2285;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0xffe2d,_0x33ae57){var _0x5ee9c9=function(_0x4bbfe1){while(--_0x4bbfe1){_0xffe2d['push'](_0xffe2d['shift']());}};_0x5ee9c9(++_0x33ae57);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 5e7d090..dfb5dd0 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 _0xb444=['../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb444,0x1ca));var _0x4b44=function(_0xd8d708,_0xc90978){_0xd8d708=_0xd8d708-0x0;var _0x1fbbd3=_0xb444[_0xd8d708];return _0x1fbbd3;};'use strict';var _=require('lodash');var util=require(_0x4b44('0x0'));var logger=require(_0x4b44('0x1'))(_0x4b44('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4b44('0x3'));var fs=require('fs');var path=require(_0x4b44('0x4'));var rimraf=require(_0x4b44('0x5'));var config=require(_0x4b44('0x6'));var attributes=require(_0x4b44('0x7'));module[_0x4b44('0x8')]=function(_0x4bfbdb,_0x3bc008){return _0x4bfbdb[_0x4b44('0x9')](_0x4b44('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x4b44('0xb'),'fields':['body'],'type':_0x4b44('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ca19c,_0x5cd5da,_0x52b82e){var _0x4487e8=_0x4bfbdb[_0x4b44('0xd')];var _0x121f06=_0x4ca19c[_0x4b44('0xe')]({'plain':!![]});if(_0x121f06[_0x4b44('0xf')][_0x4b44('0x10')]()==='in'||_0x121f06[_0x4b44('0xf')][_0x4b44('0x10')]()===_0x4b44('0x11')&&!_0x121f06[_0x4b44('0x12')]&&!_[_0x4b44('0x13')](_0x121f06[_0x4b44('0x14')])){_0x4487e8['FaxInteraction'][_0x4b44('0x15')]({'where':{'id':_0x121f06[_0x4b44('0x16')]}})[_0x4b44('0x17')](function(_0x2c99e3){if(_0x2c99e3){_0x2c99e3[_0x4b44('0x18')]({'lastMsgAt':_0x121f06[_0x4b44('0x19')],'lastMsgDirection':_0x121f06[_0x4b44('0xf')]['toLowerCase']()});}})[_0x4b44('0x1a')](function(_0x5eb5f9){console[_0x4b44('0x1b')](_0x5eb5f9);});}_0x52b82e();}},'charset':_0x4b44('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xba88=['direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','createdAt','catch','error','utf8mb4','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xba88,0x15e));var _0x8ba8=function(_0x102f1d,_0x4014d4){_0x102f1d=_0x102f1d-0x0;var _0x39f632=_0xba88[_0x102f1d];return _0x39f632;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8ba8('0x0'))('api');var moment=require(_0x8ba8('0x1'));var BPromise=require(_0x8ba8('0x2'));var rp=require(_0x8ba8('0x3'));var fs=require('fs');var path=require(_0x8ba8('0x4'));var rimraf=require(_0x8ba8('0x5'));var config=require(_0x8ba8('0x6'));var attributes=require('./faxMessage.attributes');module[_0x8ba8('0x7')]=function(_0x2e1dbf,_0x1d0439){return _0x2e1dbf[_0x8ba8('0x8')](_0x8ba8('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x8ba8('0xa'),'fields':[_0x8ba8('0xb')],'type':_0x8ba8('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57e9e3,_0x2a7115,_0xdbdf6e){var _0x4e4e3f=_0x2e1dbf[_0x8ba8('0xd')];var _0x50f38f=_0x57e9e3['get']({'plain':!![]});if(_0x50f38f[_0x8ba8('0xe')]['toLowerCase']()==='in'||_0x50f38f[_0x8ba8('0xe')][_0x8ba8('0xf')]()===_0x8ba8('0x10')&&!_0x50f38f[_0x8ba8('0x11')]&&!_[_0x8ba8('0x12')](_0x50f38f[_0x8ba8('0x13')])){_0x4e4e3f[_0x8ba8('0x14')][_0x8ba8('0x15')]({'where':{'id':_0x50f38f['FaxInteractionId']}})['then'](function(_0xe25e97){if(_0xe25e97){_0xe25e97['update']({'lastMsgAt':_0x50f38f[_0x8ba8('0x16')],'lastMsgDirection':_0x50f38f[_0x8ba8('0xe')][_0x8ba8('0xf')]()});}})[_0x8ba8('0x17')](function(_0x155402){console[_0x8ba8('0x18')](_0x155402);});}_0xdbdf6e();}},'charset':_0x8ba8('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 11bf58d..5320b9f 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 _0x739d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','FaxMessage','update','attributes','limit','lodash','util'];(function(_0x2b7f56,_0x41bc7d){var _0x36896d=function(_0x551d56){while(--_0x551d56){_0x2b7f56['push'](_0x2b7f56['shift']());}};_0x36896d(++_0x41bc7d);}(_0x739d,0xe8));var _0xd739=function(_0x599e38,_0x158e19){_0x599e38=_0x599e38-0x0;var _0x5c6717=_0x739d[_0x599e38];return _0x5c6717;};'use strict';var _=require(_0xd739('0x0'));var util=require(_0xd739('0x1'));var moment=require(_0xd739('0x2'));var BPromise=require(_0xd739('0x3'));var rs=require(_0xd739('0x4'));var fs=require('fs');var Redis=require(_0xd739('0x5'));var db=require(_0xd739('0x6'))['db'];var utils=require(_0xd739('0x7'));var logger=require(_0xd739('0x8'))(_0xd739('0x9'));var config=require(_0xd739('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd739('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd739('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd739('0xd'))(new Redis(config['redis']));require(_0xd739('0xe'))[_0xd739('0xf')](socket);function respondWithRpcPromise(_0x2663a6,_0x562959,_0x10393c){return new BPromise(function(_0x85ce3b,_0xe28c46){return client[_0xd739('0x10')](_0x2663a6,_0x10393c)[_0xd739('0x11')](function(_0x3ec8f8){logger[_0xd739('0x12')](_0xd739('0x13'),_0x562959,_0xd739('0x14'));logger[_0xd739('0x15')](_0xd739('0x16'),_0x562959,'request\x20sent',JSON['stringify'](_0x3ec8f8));if(_0x3ec8f8[_0xd739('0x17')]){if(_0x3ec8f8['error'][_0xd739('0x18')]===0x1f4){logger['error'](_0xd739('0x13'),_0x562959,_0x3ec8f8[_0xd739('0x17')]['message']);return _0xe28c46(_0x3ec8f8['error'][_0xd739('0x19')]);}logger[_0xd739('0x17')]('FaxMessage,\x20%s,\x20%s',_0x562959,_0x3ec8f8['error'][_0xd739('0x19')]);return _0x85ce3b(_0x3ec8f8[_0xd739('0x17')][_0xd739('0x19')]);}else{logger[_0xd739('0x12')]('FaxMessage,\x20%s,\x20%s',_0x562959,_0xd739('0x14'));_0x85ce3b(_0x3ec8f8[_0xd739('0x1a')][_0xd739('0x19')]);}})[_0xd739('0x1b')](function(_0xeae704){logger[_0xd739('0x17')]('FaxMessage,\x20%s,\x20%s',_0x562959,_0xeae704);_0xe28c46(_0xeae704);});});}exports[_0xd739('0x1c')]=function(_0x2b3ca6){var _0x37d268=this;return new Promise(function(_0x57c45c,_0x1048e8){return db['FaxMessage'][_0xd739('0x1d')](_0x2b3ca6[_0xd739('0x1e')],{'raw':_0x2b3ca6[_0xd739('0x1f')]?_0x2b3ca6[_0xd739('0x1f')][_0xd739('0x20')]===undefined?!![]:![]:!![]})[_0xd739('0x11')](function(_0x26445b){logger[_0xd739('0x12')](_0xd739('0x1c'),_0x2b3ca6);logger['debug'](_0xd739('0x1c'),_0x2b3ca6,JSON[_0xd739('0x21')](_0x26445b));_0x57c45c(_0x26445b);})[_0xd739('0x1b')](function(_0x3c0710){logger[_0xd739('0x17')](_0xd739('0x1c'),_0x3c0710[_0xd739('0x19')],_0x2b3ca6);_0x1048e8(_0x37d268[_0xd739('0x17')](0x1f4,_0x3c0710['message']));});});};exports[_0xd739('0x22')]=function(_0x4e4272){var _0x4cb58a=this;return new Promise(function(_0x295e7c,_0x42ae3f){return db[_0xd739('0x23')][_0xd739('0x24')](_0x4e4272[_0xd739('0x1e')],{'raw':_0x4e4272['options']?_0x4e4272['options'][_0xd739('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e4272[_0xd739('0x1f')]?_0x4e4272[_0xd739('0x1f')]['where']||null:null,'attributes':_0x4e4272['options']?_0x4e4272['options'][_0xd739('0x25')]||null:null,'limit':_0x4e4272[_0xd739('0x1f')]?_0x4e4272[_0xd739('0x1f')][_0xd739('0x26')]||null:null})[_0xd739('0x11')](function(_0x53098d){logger[_0xd739('0x12')]('UpdateFaxMessage',_0x4e4272);logger[_0xd739('0x15')](_0xd739('0x22'),_0x4e4272,JSON['stringify'](_0x53098d));_0x295e7c(_0x53098d);})[_0xd739('0x1b')](function(_0x361e86){logger[_0xd739('0x17')](_0xd739('0x22'),_0x361e86[_0xd739('0x19')],_0x4e4272);_0x42ae3f(_0x4cb58a[_0xd739('0x17')](0x1f4,_0x361e86[_0xd739('0x19')]));});});}; \ No newline at end of file +var _0xeeb5=['error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','where','limit','UpdateFaxMessage','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4f2ec6,_0x444835){var _0x49d7a6=function(_0x4c27e8){while(--_0x4c27e8){_0x4f2ec6['push'](_0x4f2ec6['shift']());}};_0x49d7a6(++_0x444835);}(_0xeeb5,0x1f0));var _0x5eeb=function(_0x5e49de,_0x1d3dd9){_0x5e49de=_0x5e49de-0x0;var _0x328849=_0xeeb5[_0x5e49de];return _0x328849;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5eeb('0x0'));var BPromise=require(_0x5eeb('0x1'));var rs=require(_0x5eeb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5eeb('0x3'));var logger=require(_0x5eeb('0x4'))(_0x5eeb('0x5'));var config=require(_0x5eeb('0x6'));var jayson=require(_0x5eeb('0x7'));var client=jayson[_0x5eeb('0x8')][_0x5eeb('0x9')]({'port':0x232a});config[_0x5eeb('0xa')]=_[_0x5eeb('0xb')](config[_0x5eeb('0xa')],{'host':_0x5eeb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5eeb('0xa')]));require(_0x5eeb('0xd'))[_0x5eeb('0xe')](socket);function respondWithRpcPromise(_0x1f692e,_0xa73e47,_0x20220b){return new BPromise(function(_0xee1f84,_0x11aa7a){return client[_0x5eeb('0xf')](_0x1f692e,_0x20220b)[_0x5eeb('0x10')](function(_0x1e8114){logger[_0x5eeb('0x11')]('FaxMessage,\x20%s,\x20%s',_0xa73e47,_0x5eeb('0x12'));logger[_0x5eeb('0x13')](_0x5eeb('0x14'),_0xa73e47,'request\x20sent',JSON[_0x5eeb('0x15')](_0x1e8114));if(_0x1e8114[_0x5eeb('0x16')]){if(_0x1e8114['error'][_0x5eeb('0x17')]===0x1f4){logger[_0x5eeb('0x16')](_0x5eeb('0x18'),_0xa73e47,_0x1e8114[_0x5eeb('0x16')][_0x5eeb('0x19')]);return _0x11aa7a(_0x1e8114[_0x5eeb('0x16')][_0x5eeb('0x19')]);}logger[_0x5eeb('0x16')](_0x5eeb('0x18'),_0xa73e47,_0x1e8114[_0x5eeb('0x16')][_0x5eeb('0x19')]);return _0xee1f84(_0x1e8114['error'][_0x5eeb('0x19')]);}else{logger['info'](_0x5eeb('0x18'),_0xa73e47,'request\x20sent');_0xee1f84(_0x1e8114[_0x5eeb('0x1a')][_0x5eeb('0x19')]);}})['catch'](function(_0x150696){logger[_0x5eeb('0x16')]('FaxMessage,\x20%s,\x20%s',_0xa73e47,_0x150696);_0x11aa7a(_0x150696);});});}exports[_0x5eeb('0x1b')]=function(_0x43bd1a){var _0xc2e1b8=this;return new Promise(function(_0x93f25c,_0x1837e8){return db[_0x5eeb('0x1c')][_0x5eeb('0x1d')](_0x43bd1a[_0x5eeb('0x1e')],{'raw':_0x43bd1a[_0x5eeb('0x1f')]?_0x43bd1a[_0x5eeb('0x1f')][_0x5eeb('0x20')]===undefined?!![]:![]:!![]})[_0x5eeb('0x10')](function(_0x43e784){logger[_0x5eeb('0x11')](_0x5eeb('0x1b'),_0x43bd1a);logger[_0x5eeb('0x13')](_0x5eeb('0x1b'),_0x43bd1a,JSON['stringify'](_0x43e784));_0x93f25c(_0x43e784);})[_0x5eeb('0x21')](function(_0xbff3a5){logger[_0x5eeb('0x16')](_0x5eeb('0x1b'),_0xbff3a5[_0x5eeb('0x19')],_0x43bd1a);_0x1837e8(_0xc2e1b8[_0x5eeb('0x16')](0x1f4,_0xbff3a5[_0x5eeb('0x19')]));});});};exports['UpdateFaxMessage']=function(_0x2fe39f){var _0x2e6ba9=this;return new Promise(function(_0x28fdac,_0x15da7f){return db['FaxMessage']['update'](_0x2fe39f[_0x5eeb('0x1e')],{'raw':_0x2fe39f['options']?_0x2fe39f[_0x5eeb('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fe39f[_0x5eeb('0x1f')]?_0x2fe39f['options'][_0x5eeb('0x22')]||null:null,'attributes':_0x2fe39f['options']?_0x2fe39f[_0x5eeb('0x1f')]['attributes']||null:null,'limit':_0x2fe39f['options']?_0x2fe39f[_0x5eeb('0x1f')][_0x5eeb('0x23')]||null:null})[_0x5eeb('0x10')](function(_0xc041cb){logger[_0x5eeb('0x11')](_0x5eeb('0x24'),_0x2fe39f);logger[_0x5eeb('0x13')](_0x5eeb('0x24'),_0x2fe39f,JSON[_0x5eeb('0x15')](_0xc041cb));_0x28fdac(_0xc041cb);})[_0x5eeb('0x21')](function(_0x271c3d){logger[_0x5eeb('0x16')](_0x5eeb('0x24'),_0x271c3d[_0x5eeb('0x19')],_0x2fe39f);_0x15da7f(_0x2e6ba9[_0x5eeb('0x16')](0x1f4,_0x271c3d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index dd2abc7..8b414fd 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index efa715c..09a99a9 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 _0x9624=['index','/describe','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','update','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated'];(function(_0x49ba30,_0x5cb169){var _0x47d95f=function(_0x97768e){while(--_0x97768e){_0x49ba30['push'](_0x49ba30['shift']());}};_0x47d95f(++_0x5cb169);}(_0x9624,0xc0));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4962('0x0'));var util=require(_0x4962('0x1'));var path=require(_0x4962('0x2'));var timeout=require(_0x4962('0x3'));var express=require(_0x4962('0x4'));var router=express['Router']();var fs_extra=require(_0x4962('0x5'));var auth=require(_0x4962('0x6'));var interaction=require(_0x4962('0x7'));var config=require('../../config/environment');var controller=require(_0x4962('0x8'));router[_0x4962('0x9')]('/',auth[_0x4962('0xa')](),controller[_0x4962('0xb')]);router[_0x4962('0x9')](_0x4962('0xc'),auth[_0x4962('0xa')](),controller[_0x4962('0xd')]);router['get'](_0x4962('0xe'),auth[_0x4962('0xa')](),controller[_0x4962('0xf')]);router['get']('/:id/download',auth[_0x4962('0xa')](),controller[_0x4962('0x10')]);router[_0x4962('0x11')]('/',auth[_0x4962('0xa')](),interaction[_0x4962('0x12')](_0x4962('0x13'),_0x4962('0x14')),controller[_0x4962('0x15')]);router[_0x4962('0x16')](_0x4962('0xe'),auth[_0x4962('0xa')](),controller[_0x4962('0x17')]);router[_0x4962('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0x4962('0x18')]);router[_0x4962('0x16')]('/:id/reject',auth[_0x4962('0xa')](),controller[_0x4962('0x19')]);router[_0x4962('0x1a')](_0x4962('0xe'),auth[_0x4962('0xa')](),controller[_0x4962('0x1b')]);module[_0x4962('0x1c')]=router; \ No newline at end of file +var _0x2695=['index','describe','/:id','isAuthenticated','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./faxMessage.controller','get'];(function(_0x517fd1,_0xa18071){var _0x102c44=function(_0x3bcb5b){while(--_0x3bcb5b){_0x517fd1['push'](_0x517fd1['shift']());}};_0x102c44(++_0xa18071);}(_0x2695,0x1ef));var _0x5269=function(_0xab2e4c,_0x4fac18){_0xab2e4c=_0xab2e4c-0x0;var _0x5e2ac7=_0x2695[_0xab2e4c];return _0x5e2ac7;};'use strict';var multer=require(_0x5269('0x0'));var util=require(_0x5269('0x1'));var path=require('path');var timeout=require(_0x5269('0x2'));var express=require(_0x5269('0x3'));var router=express[_0x5269('0x4')]();var fs_extra=require(_0x5269('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5269('0x6'));var controller=require(_0x5269('0x7'));router[_0x5269('0x8')]('/',auth['isAuthenticated'](),controller[_0x5269('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x5269('0xa')]);router['get'](_0x5269('0xb'),auth[_0x5269('0xc')](),controller['show']);router[_0x5269('0x8')]('/:id/download',auth[_0x5269('0xc')](),controller['download']);router['post']('/',auth[_0x5269('0xc')](),interaction['tracked'](_0x5269('0xd'),_0x5269('0xe')),controller['create']);router[_0x5269('0xf')](_0x5269('0xb'),auth['isAuthenticated'](),controller[_0x5269('0x10')]);router[_0x5269('0xf')](_0x5269('0x11'),auth['isAuthenticated'](),controller[_0x5269('0x12')]);router[_0x5269('0xf')](_0x5269('0x13'),auth[_0x5269('0xc')](),controller[_0x5269('0x14')]);router[_0x5269('0x15')](_0x5269('0xb'),auth[_0x5269('0xc')](),controller[_0x5269('0x16')]);module[_0x5269('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index d868bf3..f47eeaa 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 _0xf164=['STRING','name','rrmemory','roundrobin','INTEGER','sequelize','exports'];(function(_0x5958d2,_0x550300){var _0x2a4809=function(_0x48048b){while(--_0x48048b){_0x5958d2['push'](_0x5958d2['shift']());}};_0x2a4809(++_0x550300);}(_0xf164,0xe5));var _0x4f16=function(_0x3df186,_0x12592c){_0x3df186=_0x3df186-0x0;var _0x5440fc=_0xf164[_0x3df186];return _0x5440fc;};'use strict';var Sequelize=require(_0x4f16('0x0'));module[_0x4f16('0x1')]={'name':{'type':Sequelize[_0x4f16('0x2')],'unique':_0x4f16('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4f16('0x4'),'beepall',_0x4f16('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4f16('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4556=['roundrobin','INTEGER','sequelize','exports','STRING'];(function(_0x592e40,_0x2ed011){var _0x5d4288=function(_0x366e87){while(--_0x366e87){_0x592e40['push'](_0x592e40['shift']());}};_0x5d4288(++_0x2ed011);}(_0x4556,0x156));var _0x6455=function(_0xab119e,_0x35de0f){_0xab119e=_0xab119e-0x0;var _0x5b41fc=_0x4556[_0xab119e];return _0x5b41fc;};'use strict';var Sequelize=require(_0x6455('0x0'));module[_0x6455('0x1')]={'name':{'type':Sequelize[_0x6455('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x6455('0x3')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6455('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 b19f9c2..b29447a 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 _0x008c=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','apply','reject','save','update','destroy','FaxQueues','UserProfileResource','sendStatus','error','stack','name','map','FaxQueue','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','where','pick','filter','merge','VIRTUAL','count','then','includeAll','include','rows','show','catch','create','body','user','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','UserFaxQueue','order','sort','FaxQueueId','options','findAll','findAndCountAll','UserId','updatedAt','createdAt','%s/%s','Team','addTeams','User','Agents','online','flatMap','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x008c,0x188));var _0xc008=function(_0xdbfe3,_0x4ebddd){_0xdbfe3=_0xdbfe3-0x0;var _0x3454b0=_0x008c[_0xdbfe3];return _0x3454b0;};'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 fs_extra=require(_0xc008('0xd'));var _=require('lodash');var squel=require(_0xc008('0xe'));var crypto=require('crypto');var jsforce=require(_0xc008('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc008('0x10'));var Papa=require(_0xc008('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc008('0x12'));var hardwareService=require(_0xc008('0x13'));var logger=require('../../config/logger')(_0xc008('0x14'));var utils=require(_0xc008('0x15'));var config=require(_0xc008('0x16'));var licenseUtil=require(_0xc008('0x17'));var db=require(_0xc008('0x18'))['db'];config[_0xc008('0x19')]=_[_0xc008('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0x1b'))(new Redis(config['redis']));require(_0xc008('0x1c'))[_0xc008('0x1d')](socket);function respondWithStatusCode(_0x2073ef,_0x339ffc){_0x339ffc=_0x339ffc||0xcc;return function(_0x3f0ecf){if(_0x3f0ecf){return _0x2073ef['sendStatus'](_0x339ffc);}return _0x2073ef['status'](_0x339ffc)['end']();};}function respondWithResult(_0x11ef38,_0x15a6ad){_0x15a6ad=_0x15a6ad||0xc8;return function(_0x3cafe3){if(_0x3cafe3){return _0x11ef38[_0xc008('0x1e')](_0x15a6ad)['json'](_0x3cafe3);}};}function respondWithFilteredResult(_0x53b06e,_0x540e45){return function(_0x5c2668){if(_0x5c2668){var _0x46042b=_0x5c2668['count'],_0x462af5=_0x540e45['offset'],_0x501137=_0x540e45['offset']+_0x540e45['limit'],_0x813397;if(_0x501137>=_0x46042b){_0x501137=_0x46042b;_0x813397=0xc8;}else{_0x813397=0xce;}_0x53b06e[_0xc008('0x1e')](_0x813397);return _0x53b06e['set']('Content-Range',_0x462af5+'-'+_0x501137+'/'+_0x46042b)['json'](_0x5c2668);}return null;};}function patchUpdates(_0x4a582d){return function(_0x5a58bd){try{jsonpatch[_0xc008('0x1f')](_0x5a58bd,_0x4a582d,!![]);}catch(_0x4777a6){return BPromise[_0xc008('0x20')](_0x4777a6);}return _0x5a58bd[_0xc008('0x21')]();};}function saveUpdates(_0x11cc75,_0x110128){return function(_0x4f43e2){if(_0x4f43e2){return _0x4f43e2[_0xc008('0x22')](_0x11cc75)['then'](function(_0x58a6ea){return _0x58a6ea;});}return null;};}function removeEntity(_0x218599,_0x36f358){return function(_0x2e3cfb){if(_0x2e3cfb){return _0x2e3cfb[_0xc008('0x23')]()['then'](function(){var _0x48582b=_0x2e3cfb['get']({'plain':!![]});var _0x3f7b07=_0xc008('0x24');return db[_0xc008('0x25')][_0xc008('0x23')]({'where':{'type':_0x3f7b07,'resourceId':_0x48582b['id']}})['then'](function(){return _0x2e3cfb;});})['then'](function(){_0x218599['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4caaf4,_0x3865c0){return function(_0x29ba43){if(!_0x29ba43){_0x4caaf4[_0xc008('0x26')](0x194);}return _0x29ba43;};}function handleError(_0x529961,_0x24c14c){_0x24c14c=_0x24c14c||0x1f4;return function(_0x32390d){logger[_0xc008('0x27')](_0x32390d[_0xc008('0x28')]);if(_0x32390d['name']){delete _0x32390d[_0xc008('0x29')];}_0x529961[_0xc008('0x1e')](_0x24c14c)['send'](_0x32390d);};}exports['index']=function(_0x539766,_0x1032b2){var _0x267abd={},_0xf831f2={},_0x10889f={'count':0x0,'rows':[]};var _0x1de04b=_[_0xc008('0x2a')](db[_0xc008('0x2b')][_0xc008('0x2c')],function(_0x1fe1e1){return{'name':_0x1fe1e1[_0xc008('0x2d')],'type':_0x1fe1e1[_0xc008('0x2e')][_0xc008('0x2f')]};});_0xf831f2['model']=_[_0xc008('0x2a')](_0x1de04b,_0xc008('0x29'));_0xf831f2['query']=_[_0xc008('0x30')](_0x539766[_0xc008('0x31')]);_0xf831f2[_0xc008('0x32')]=_[_0xc008('0x33')](_0xf831f2[_0xc008('0x34')],_0xf831f2[_0xc008('0x31')]);_0x267abd[_0xc008('0x35')]=_[_0xc008('0x33')](_0xf831f2[_0xc008('0x34')],qs['fields'](_0x539766[_0xc008('0x31')][_0xc008('0x36')]));_0x267abd[_0xc008('0x35')]=_0x267abd[_0xc008('0x35')][_0xc008('0x37')]?_0x267abd[_0xc008('0x35')]:_0xf831f2[_0xc008('0x34')];if(!_0x539766['query'][_0xc008('0x38')](_0xc008('0x39'))){_0x267abd['limit']=qs[_0xc008('0x3a')](_0x539766[_0xc008('0x31')]['limit']);_0x267abd[_0xc008('0x3b')]=qs[_0xc008('0x3b')](_0x539766[_0xc008('0x31')]['offset']);}_0x267abd['order']=qs['sort'](_0x539766[_0xc008('0x31')]['sort']);_0x267abd[_0xc008('0x3c')]=qs[_0xc008('0x32')](_[_0xc008('0x3d')](_0x539766[_0xc008('0x31')],_0xf831f2[_0xc008('0x32')]),_0x1de04b);if(_0x539766[_0xc008('0x31')][_0xc008('0x3e')]){_0x267abd[_0xc008('0x3c')]=_[_0xc008('0x3f')](_0x267abd[_0xc008('0x3c')],{'$or':_[_0xc008('0x2a')](_0x1de04b,function(_0xdfca2e){if(_0xdfca2e[_0xc008('0x2e')]!==_0xc008('0x40')){var _0x4cace5={};_0x4cace5[_0xdfca2e[_0xc008('0x29')]]={'$like':'%'+_0x539766[_0xc008('0x31')][_0xc008('0x3e')]+'%'};return _0x4cace5;}})});}_0x267abd=_[_0xc008('0x3f')]({},_0x267abd,_0x539766['options']);var _0x2c4964={'where':_0x267abd[_0xc008('0x3c')]};return db[_0xc008('0x2b')][_0xc008('0x41')](_0x2c4964)[_0xc008('0x42')](function(_0x5706bb){_0x10889f[_0xc008('0x41')]=_0x5706bb;if(_0x539766[_0xc008('0x31')][_0xc008('0x43')]){_0x267abd[_0xc008('0x44')]=[{'all':!![]}];}return db[_0xc008('0x2b')]['findAll'](_0x267abd);})[_0xc008('0x42')](function(_0x197854){_0x10889f[_0xc008('0x45')]=_0x197854;return _0x10889f;})[_0xc008('0x42')](respondWithFilteredResult(_0x1032b2,_0x267abd))['catch'](handleError(_0x1032b2,null));};exports[_0xc008('0x46')]=function(_0xe37446,_0x351d5c){var _0x5e1602={'raw':!![],'where':{'id':_0xe37446['params']['id']}},_0x1f9af7={};_0x1f9af7[_0xc008('0x34')]=_['keys'](db[_0xc008('0x2b')][_0xc008('0x2c')]);_0x1f9af7['query']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x31')]);_0x1f9af7[_0xc008('0x32')]=_['intersection'](_0x1f9af7[_0xc008('0x34')],_0x1f9af7[_0xc008('0x31')]);_0x5e1602[_0xc008('0x35')]=_[_0xc008('0x33')](_0x1f9af7[_0xc008('0x34')],qs[_0xc008('0x36')](_0xe37446['query']['fields']));_0x5e1602['attributes']=_0x5e1602[_0xc008('0x35')][_0xc008('0x37')]?_0x5e1602[_0xc008('0x35')]:_0x1f9af7[_0xc008('0x34')];if(_0xe37446[_0xc008('0x31')][_0xc008('0x43')]){_0x5e1602[_0xc008('0x44')]=[{'all':!![]}];}_0x5e1602=_[_0xc008('0x3f')]({},_0x5e1602,_0xe37446['options']);return db['FaxQueue']['find'](_0x5e1602)[_0xc008('0x42')](handleEntityNotFound(_0x351d5c,null))[_0xc008('0x42')](respondWithResult(_0x351d5c,null))[_0xc008('0x47')](handleError(_0x351d5c,null));};exports['create']=function(_0x28bc33,_0x2369c4){return db[_0xc008('0x2b')][_0xc008('0x48')](_0x28bc33[_0xc008('0x49')],{})[_0xc008('0x42')](function(_0x17ec90){var _0x405e87=_0x28bc33[_0xc008('0x4a')][_0xc008('0x4b')]({'plain':!![]});if(!_0x405e87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x405e87['role']===_0xc008('0x4a')){var _0x51cb14=_0x17ec90[_0xc008('0x4b')]({'plain':!![]});var _0x36e6f8=_0xc008('0x24');return db['UserProfileSection'][_0xc008('0x4c')]({'where':{'name':_0x36e6f8,'userProfileId':_0x405e87[_0xc008('0x4d')]},'raw':!![]})[_0xc008('0x42')](function(_0x8b9775){if(_0x8b9775&&_0x8b9775[_0xc008('0x4e')]===0x0){return db['UserProfileResource'][_0xc008('0x48')]({'name':_0x51cb14[_0xc008('0x29')],'resourceId':_0x51cb14['id'],'type':_0x8b9775['name'],'sectionId':_0x8b9775['id']},{})[_0xc008('0x42')](function(){return _0x17ec90;});}else{return _0x17ec90;}})[_0xc008('0x47')](function(_0x5b5fbf){logger['error'](_0xc008('0x4f'),_0x5b5fbf);throw _0x5b5fbf;});}return _0x17ec90;})[_0xc008('0x42')](respondWithResult(_0x2369c4,0xc9))[_0xc008('0x47')](handleError(_0x2369c4,null));};exports[_0xc008('0x22')]=function(_0x14b6a0,_0x588b60){if(_0x14b6a0['body']['id']){delete _0x14b6a0[_0xc008('0x49')]['id'];}return db['FaxQueue'][_0xc008('0x4c')]({'where':{'id':_0x14b6a0[_0xc008('0x50')]['id']}})[_0xc008('0x42')](handleEntityNotFound(_0x588b60,null))[_0xc008('0x42')](saveUpdates(_0x14b6a0[_0xc008('0x49')],null))[_0xc008('0x42')](respondWithResult(_0x588b60,null))['catch'](handleError(_0x588b60,null));};exports[_0xc008('0x23')]=function(_0xbd7422,_0x9a7abc){return db[_0xc008('0x2b')][_0xc008('0x4c')]({'where':{'id':_0xbd7422['params']['id']}})[_0xc008('0x42')](handleEntityNotFound(_0x9a7abc,null))['then'](removeEntity(_0x9a7abc,null))['catch'](handleError(_0x9a7abc,null));};exports['describe']=function(_0x89bb20,_0x1bcbb1){return db[_0xc008('0x2b')]['describe']()[_0xc008('0x42')](respondWithResult(_0x1bcbb1,null))[_0xc008('0x47')](handleError(_0x1bcbb1,null));};exports[_0xc008('0x51')]=function(_0x47a58b,_0x3587c3,_0x1092cb){var _0x12ba3f={'raw':!![],'where':{}},_0x1b5a22={},_0x5baff1;return db[_0xc008('0x2b')]['findOne']({'where':{'id':_0x47a58b[_0xc008('0x50')]['id']}})[_0xc008('0x42')](handleEntityNotFound(_0x3587c3,null))[_0xc008('0x42')](function(_0x943c91){if(_0x943c91){_0x5baff1=_0x943c91[_0xc008('0x4b')]({'plain':!![]});_0x1b5a22[_0xc008('0x34')]=_['keys'](db[_0xc008('0x52')]['rawAttributes']);_0x1b5a22['query']=_[_0xc008('0x30')](_0x47a58b[_0xc008('0x31')]);_0x1b5a22['filters']=_[_0xc008('0x33')](_0x1b5a22[_0xc008('0x34')],_0x1b5a22[_0xc008('0x31')]);_0x12ba3f[_0xc008('0x35')]=_[_0xc008('0x33')](_0x1b5a22[_0xc008('0x34')],qs[_0xc008('0x36')](_0x47a58b['query'][_0xc008('0x36')]));_0x12ba3f[_0xc008('0x35')]=_0x12ba3f[_0xc008('0x35')][_0xc008('0x37')]?_0x12ba3f[_0xc008('0x35')]:_0x1b5a22[_0xc008('0x34')];if(!_0x47a58b[_0xc008('0x31')][_0xc008('0x38')](_0xc008('0x39'))){_0x12ba3f[_0xc008('0x3a')]=qs[_0xc008('0x3a')](_0x47a58b[_0xc008('0x31')][_0xc008('0x3a')]);_0x12ba3f[_0xc008('0x3b')]=qs['offset'](_0x47a58b[_0xc008('0x31')][_0xc008('0x3b')]);}_0x12ba3f[_0xc008('0x53')]=qs['sort'](_0x47a58b[_0xc008('0x31')][_0xc008('0x54')]);_0x12ba3f['where']=qs['filters'](_[_0xc008('0x3d')](_0x47a58b[_0xc008('0x31')],_0x1b5a22[_0xc008('0x32')]));_0x12ba3f[_0xc008('0x3c')][_0xc008('0x55')]=_0x943c91['id'];if(_0x47a58b[_0xc008('0x31')][_0xc008('0x3e')]){_0x12ba3f[_0xc008('0x3c')]=_[_0xc008('0x3f')](_0x12ba3f[_0xc008('0x3c')],{'$or':_[_0xc008('0x2a')](_0x12ba3f['attributes'],function(_0x336516){var _0x25a52b={};_0x25a52b[_0x336516]={'$like':'%'+_0x47a58b[_0xc008('0x31')][_0xc008('0x3e')]+'%'};return _0x25a52b;})});}_0x12ba3f=_['merge']({},_0x12ba3f,_0x47a58b[_0xc008('0x56')]);return db['UserFaxQueue'][_0xc008('0x57')](_0x12ba3f);}})[_0xc008('0x42')](function(_0x419257){if(_0x419257){return db['User'][_0xc008('0x58')]({'where':{'id':_[_0xc008('0x2a')](_0x419257,_0xc008('0x59')),'role':'agent'},'attributes':['id',_0xc008('0x29'),'faxPause',_0xc008('0x5a'),_0xc008('0x5b')]});}})[_0xc008('0x42')](function(_0x6fe732){if(_0x6fe732){return{'count':_0x6fe732[_0xc008('0x41')],'rows':_['map'](_0x6fe732[_0xc008('0x45')],function(_0x3f2342){return{'membername':_0x3f2342['name'],'UserId':_0x3f2342['id'],'queue_name':_0x5baff1[_0xc008('0x29')],'FaxQueueId':_0x5baff1['id'],'interface':util['format'](_0xc008('0x5c'),'SIP',_0x3f2342[_0xc008('0x29')]),'penalty':0x0,'paused':_0x3f2342['faxPause'],'createdAt':_0x3f2342[_0xc008('0x5b')],'updatedAt':_0x3f2342[_0xc008('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc008('0x42')](respondWithFilteredResult(_0x3587c3,_0x12ba3f))[_0xc008('0x47')](handleError(_0x3587c3,null));};exports['getTeams']=function(_0x57752c,_0x415c66,_0xb24eec){var _0x1d49db={};var _0x321500={};var _0x13ef78;var _0xd9e3fd;return db[_0xc008('0x2b')]['findOne']({'where':{'id':_0x57752c[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x415c66,null))['then'](function(_0x4c84da){if(_0x4c84da){_0x13ef78=_0x4c84da;_0x321500[_0xc008('0x34')]=_[_0xc008('0x30')](db[_0xc008('0x5d')][_0xc008('0x2c')]);_0x321500[_0xc008('0x31')]=_[_0xc008('0x30')](_0x57752c[_0xc008('0x31')]);_0x321500[_0xc008('0x32')]=_[_0xc008('0x33')](_0x321500['model'],_0x321500[_0xc008('0x31')]);_0x1d49db[_0xc008('0x35')]=_[_0xc008('0x33')](_0x321500[_0xc008('0x34')],qs[_0xc008('0x36')](_0x57752c[_0xc008('0x31')][_0xc008('0x36')]));_0x1d49db[_0xc008('0x35')]=_0x1d49db[_0xc008('0x35')][_0xc008('0x37')]?_0x1d49db[_0xc008('0x35')]:_0x321500[_0xc008('0x34')];_0x1d49db['order']=qs['sort'](_0x57752c[_0xc008('0x31')][_0xc008('0x54')]);_0x1d49db[_0xc008('0x3c')]=qs['filters'](_[_0xc008('0x3d')](_0x57752c[_0xc008('0x31')],_0x321500['filters']));if(_0x57752c['query']['filter']){_0x1d49db[_0xc008('0x3c')]=_[_0xc008('0x3f')](_0x1d49db[_0xc008('0x3c')],{'$or':_[_0xc008('0x2a')](_0x1d49db[_0xc008('0x35')],function(_0x44f515){var _0x285c09={};_0x285c09[_0x44f515]={'$like':'%'+_0x57752c[_0xc008('0x31')][_0xc008('0x3e')]+'%'};return _0x285c09;})});}_0x1d49db=_[_0xc008('0x3f')]({},_0x1d49db,_0x57752c['options']);return _0x13ef78['getTeams'](_0x1d49db);}})[_0xc008('0x42')](function(_0x31ebde){if(_0x31ebde){_0xd9e3fd=_0x31ebde[_0xc008('0x37')];if(!_0x57752c[_0xc008('0x31')][_0xc008('0x38')](_0xc008('0x39'))){_0x1d49db['limit']=qs['limit'](_0x57752c[_0xc008('0x31')][_0xc008('0x3a')]);_0x1d49db[_0xc008('0x3b')]=qs['offset'](_0x57752c['query']['offset']);}return _0x13ef78['getTeams'](_0x1d49db);}})['then'](function(_0x5a29da){if(_0x5a29da){return _0x5a29da?{'count':_0xd9e3fd,'rows':_0x5a29da}:null;}})[_0xc008('0x42')](respondWithResult(_0x415c66,null))['catch'](handleError(_0x415c66,null));};exports[_0xc008('0x5e')]=function(_0x4b0039,_0x2772c9,_0x41151e){var _0x903f67=_0x4b0039['body']['ids'];return db[_0xc008('0x5d')]['findAll']({'where':{'id':_0x903f67},'attributes':['id'],'include':[{'model':db[_0xc008('0x5f')],'as':_0xc008('0x60'),'attributes':['id','name',_0xc008('0x61'),'voicePause','interface'],'raw':!![]}]})[_0xc008('0x42')](function(_0x1d50ac){if(_0x1d50ac){var _0x48de26=_[_0xc008('0x62')](_0x1d50ac,function(_0x3afc15){var _0x39ccf2=_0x3afc15['get']({'plain':!![]});return _0x39ccf2[_0xc008('0x60')];});return db[_0xc008('0x2b')][_0xc008('0x4c')]({'where':{'id':_0x4b0039[_0xc008('0x50')]['id']}})[_0xc008('0x42')](function(_0x1b5b91){return db['sequelize'][_0xc008('0x63')](function(_0xdaff5b){return _0x1b5b91[_0xc008('0x5e')](_0x903f67,{'transaction':_0xdaff5b})['then'](function(){return BPromise[_0xc008('0x64')](_0x48de26,function(_0x2dc401){return db[_0xc008('0x52')]['findOrCreate']({'where':{'UserId':_0x2dc401['id'],'FaxQueueId':_0x4b0039['params']['id']},'transaction':_0xdaff5b});});})['then'](function(){_0x48de26[_0xc008('0x65')](function(_0x470888){socket[_0xc008('0x66')](_0xc008('0x67'),{'UserId':_0x470888['id'],'FaxQueueId':_0x1b5b91['id']});});});});});}})[_0xc008('0x42')](respondWithStatusCode(_0x2772c9,null))[_0xc008('0x47')](handleError(_0x2772c9,null));};exports[_0xc008('0x68')]=function(_0x226fa0,_0x539ccb,_0x29f225){return db[_0xc008('0x5d')]['findAll']({'where':{'id':_0x226fa0['query'][_0xc008('0x69')]},'attributes':['id'],'include':[{'model':db[_0xc008('0x5f')],'as':_0xc008('0x60'),'attributes':['id'],'raw':!![]}]})[_0xc008('0x42')](handleEntityNotFound(_0x539ccb,null))[_0xc008('0x42')](function(_0x49e822){var _0xe988da=_[_0xc008('0x2a')](_0x49e822,'id');var _0x56be9d=[];var _0xb02bd=[];var _0x1cc68f=squel[_0xc008('0x6a')]();_0x1cc68f[_0xc008('0x6b')]('tq.TeamId')[_0xc008('0x6c')](_0xc008('0x6d'),'tq')[_0xc008('0x6e')](_0xc008('0x6f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc008('0x3c')](_0xc008('0x70'),_0x226fa0['params']['id']);for(var _0x555e8a=0x0;_0x555e8a<_0x49e822[_0xc008('0x37')];_0x555e8a+=0x1){let _0x581a45=_0x49e822[_0x555e8a];for(var _0x2ddb54=0x0;_0x2ddb54<_0x581a45[_0xc008('0x60')]['length'];_0x2ddb54+=0x1){let _0x1b6858=_0x581a45[_0xc008('0x60')][_0x2ddb54];var _0x3ed6eb=_0x1cc68f[_0xc008('0x71')]();_0x3ed6eb[_0xc008('0x3c')](_0xc008('0x72'),_0x1b6858['id']);_0xb02bd[_0xc008('0x73')](db[_0xc008('0x74')][_0xc008('0x31')](_0x3ed6eb[_0xc008('0x75')](),{'type':db['sequelize']['QueryTypes'][_0xc008('0x76')]})[_0xc008('0x42')](function(_0x4d07d2){if(_0x4d07d2[_0xc008('0x37')]===0x1){return _0x1b6858['id'];}else{var _0x1bdaa9=_[_0xc008('0x77')](_['map'](_0x4d07d2,_0xc008('0x78')),function(_0x38239a){return _[_0xc008('0x79')](_0xe988da,_0x38239a);});if(_0x1bdaa9){return _0x1b6858['id'];}}}));}}return BPromise[_0xc008('0x7a')](_0xb02bd)[_0xc008('0x42')](function(_0x15f338){_0x56be9d=_(_0x56be9d)[_0xc008('0x7b')](_0x15f338)['compact']()[_0xc008('0x7c')]();return db['FaxQueue'][_0xc008('0x4c')]({'where':{'id':_0x226fa0[_0xc008('0x50')]['id']}})[_0xc008('0x42')](function(_0x583077){return db[_0xc008('0x74')][_0xc008('0x63')](function(_0x41143f){return _0x583077[_0xc008('0x68')](_0x226fa0[_0xc008('0x31')][_0xc008('0x69')],{'transaction':_0x41143f})[_0xc008('0x42')](function(){if(!_[_0xc008('0x7d')](_0x56be9d)){return _0x583077[_0xc008('0x7e')](_0x56be9d,{'transaction':_0x41143f});}})[_0xc008('0x42')](function(){_0x56be9d['forEach'](function(_0x1e27ff){socket[_0xc008('0x66')](_0xc008('0x7f'),{'UserId':_0x1e27ff,'FaxQueueId':_0x583077['id']});});});});});});})[_0xc008('0x42')](respondWithStatusCode(_0x539ccb,null))[_0xc008('0x47')](handleError(_0x539ccb,null));};exports['addAgents']=function(_0x37da13,_0x3dd13f,_0x36a581){return db[_0xc008('0x2b')][_0xc008('0x4c')]({'where':{'id':_0x37da13[_0xc008('0x50')]['id']}})[_0xc008('0x42')](handleEntityNotFound(_0x3dd13f,null))[_0xc008('0x42')](function(_0x2cc170){if(_0x2cc170){return _0x2cc170[_0xc008('0x80')](_0x37da13[_0xc008('0x49')][_0xc008('0x69')],_[_0xc008('0x81')](_0x37da13[_0xc008('0x49')],[_0xc008('0x69'),'id'])||{})['spread'](function(_0x5e2610){for(var _0xa53d53=0x0;_0xa53d53<_0x37da13[_0xc008('0x49')][_0xc008('0x69')][_0xc008('0x37')];_0xa53d53+=0x1){socket[_0xc008('0x66')](_0xc008('0x67'),{'UserId':_0x37da13[_0xc008('0x49')][_0xc008('0x69')][_0xa53d53],'FaxQueueId':_0x37da13[_0xc008('0x50')]['id']});}return _0x5e2610;});}})['then'](respondWithResult(_0x3dd13f,null))[_0xc008('0x47')](handleError(_0x3dd13f,null));};exports[_0xc008('0x7e')]=function(_0x54fd75,_0x21ffe0,_0x159749){return db[_0xc008('0x2b')][_0xc008('0x4c')]({'where':{'id':_0x54fd75[_0xc008('0x50')]['id']}})[_0xc008('0x42')](handleEntityNotFound(_0x21ffe0,null))['then'](function(_0x26617c){if(_0x26617c){return _0x26617c[_0xc008('0x7e')](_0x54fd75[_0xc008('0x31')][_0xc008('0x69')])['then'](function(){if(_[_0xc008('0x82')](_0x54fd75['query'][_0xc008('0x69')])){for(var _0x4c5725=0x0;_0x4c5725<_0x54fd75['query'][_0xc008('0x69')]['length'];_0x4c5725+=0x1){socket[_0xc008('0x66')]('userFaxQueue:remove',{'UserId':Number(_0x54fd75['query']['ids'][_0x4c5725]),'FaxQueueId':Number(_0x54fd75[_0xc008('0x50')]['id'])});}}else{socket[_0xc008('0x66')]('userFaxQueue:remove',{'UserId':Number(_0x54fd75[_0xc008('0x31')][_0xc008('0x69')]),'FaxQueueId':Number(_0x54fd75['params']['id'])});}});}})[_0xc008('0x42')](respondWithStatusCode(_0x21ffe0,null))[_0xc008('0x47')](handleError(_0x21ffe0,null));};exports[_0xc008('0x83')]=function(_0x5843ee,_0x33cad3,_0x25c7d9){var _0x3735c3={};var _0x10b34d={};var _0x3f4272;var _0x9b6108;return db[_0xc008('0x2b')][_0xc008('0x84')]({'where':{'id':_0x5843ee[_0xc008('0x50')]['id']}})[_0xc008('0x42')](handleEntityNotFound(_0x33cad3,null))[_0xc008('0x42')](function(_0x4ea18b){if(_0x4ea18b){_0x3f4272=_0x4ea18b;_0x10b34d[_0xc008('0x34')]=_[_0xc008('0x30')](db[_0xc008('0x5f')]['rawAttributes']);_0x10b34d[_0xc008('0x31')]=_[_0xc008('0x30')](_0x5843ee[_0xc008('0x31')]);_0x10b34d['filters']=_[_0xc008('0x33')](_0x10b34d['model'],_0x10b34d[_0xc008('0x31')]);_0x3735c3[_0xc008('0x35')]=_[_0xc008('0x33')](_0x10b34d['model'],qs[_0xc008('0x36')](_0x5843ee[_0xc008('0x31')][_0xc008('0x36')]));_0x3735c3[_0xc008('0x35')]=_0x3735c3[_0xc008('0x35')][_0xc008('0x37')]?_0x3735c3[_0xc008('0x35')]:_0x10b34d['model'];_0x3735c3[_0xc008('0x53')]=qs[_0xc008('0x54')](_0x5843ee[_0xc008('0x31')][_0xc008('0x54')]);_0x3735c3['where']=qs[_0xc008('0x32')](_['pick'](_0x5843ee[_0xc008('0x31')],_0x10b34d[_0xc008('0x32')]));if(_0x5843ee[_0xc008('0x31')][_0xc008('0x3e')]){_0x3735c3[_0xc008('0x3c')]=_[_0xc008('0x3f')](_0x3735c3[_0xc008('0x3c')],{'$or':_['map'](_0x3735c3[_0xc008('0x35')],function(_0x34c532){var _0x372822={};_0x372822[_0x34c532]={'$like':'%'+_0x5843ee[_0xc008('0x31')]['filter']+'%'};return _0x372822;})});}_0x3735c3=_[_0xc008('0x3f')]({},_0x3735c3,_0x5843ee['options']);return _0x3f4272[_0xc008('0x83')](_0x3735c3);}})[_0xc008('0x42')](function(_0x286340){if(_0x286340){_0x9b6108=_0x286340['length'];if(!_0x5843ee['query'][_0xc008('0x38')]('nolimit')){_0x3735c3[_0xc008('0x3a')]=qs[_0xc008('0x3a')](_0x5843ee[_0xc008('0x31')][_0xc008('0x3a')]);_0x3735c3['offset']=qs[_0xc008('0x3b')](_0x5843ee[_0xc008('0x31')]['offset']);}return _0x3f4272['getAgents'](_0x3735c3);}})[_0xc008('0x42')](function(_0x1edf41){if(_0x1edf41){return _0x1edf41?{'count':_0x9b6108,'rows':_0x1edf41}:null;}})['then'](respondWithResult(_0x33cad3,null))[_0xc008('0x47')](handleError(_0x33cad3,null));}; \ No newline at end of file +var _0x55ca=['clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','getAgents','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./faxQueue.socket','register','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','rows','show','params','keys','length','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','nolimit','pick','FaxQueueId','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','User','Agents','flatMap','sequelize','transaction','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x55ca,0x126));var _0xa55c=function(_0x1ebd10,_0x4914b4){_0x1ebd10=_0x1ebd10-0x0;var _0x1004d3=_0x55ca[_0x1ebd10];return _0x1004d3;};'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 fs_extra=require(_0xa55c('0xa'));var _=require('lodash');var squel=require(_0xa55c('0xb'));var crypto=require(_0xa55c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa55c('0xd'));var toCsv=require(_0xa55c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa55c('0xe'));var authService=require(_0xa55c('0xf'));var qs=require(_0xa55c('0x10'));var as=require(_0xa55c('0x11'));var hardwareService=require(_0xa55c('0x12'));var logger=require(_0xa55c('0x13'))(_0xa55c('0x14'));var utils=require(_0xa55c('0x15'));var config=require(_0xa55c('0x16'));var licenseUtil=require(_0xa55c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa55c('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x19')]));require(_0xa55c('0x1a'))[_0xa55c('0x1b')](socket);function respondWithStatusCode(_0x938bd6,_0x458480){_0x458480=_0x458480||0xcc;return function(_0x247e77){if(_0x247e77){return _0x938bd6['sendStatus'](_0x458480);}return _0x938bd6[_0xa55c('0x1c')](_0x458480)[_0xa55c('0x1d')]();};}function respondWithResult(_0x25934f,_0x31e10d){_0x31e10d=_0x31e10d||0xc8;return function(_0x1c4cfd){if(_0x1c4cfd){return _0x25934f[_0xa55c('0x1c')](_0x31e10d)[_0xa55c('0x1e')](_0x1c4cfd);}};}function respondWithFilteredResult(_0x2d09d8,_0x24783b){return function(_0x4cee3c){if(_0x4cee3c){var _0x3d4c9e=_0x4cee3c[_0xa55c('0x1f')],_0x104a99=_0x24783b[_0xa55c('0x20')],_0x461284=_0x24783b['offset']+_0x24783b['limit'],_0x358b61;if(_0x461284>=_0x3d4c9e){_0x461284=_0x3d4c9e;_0x358b61=0xc8;}else{_0x358b61=0xce;}_0x2d09d8[_0xa55c('0x1c')](_0x358b61);return _0x2d09d8[_0xa55c('0x21')](_0xa55c('0x22'),_0x104a99+'-'+_0x461284+'/'+_0x3d4c9e)['json'](_0x4cee3c);}return null;};}function patchUpdates(_0x383d92){return function(_0x2fcb90){try{jsonpatch['apply'](_0x2fcb90,_0x383d92,!![]);}catch(_0x187a87){return BPromise[_0xa55c('0x23')](_0x187a87);}return _0x2fcb90[_0xa55c('0x24')]();};}function saveUpdates(_0x1965f1,_0x234372){return function(_0x49ed04){if(_0x49ed04){return _0x49ed04[_0xa55c('0x25')](_0x1965f1)['then'](function(_0x5ba836){return _0x5ba836;});}return null;};}function removeEntity(_0x59d89a,_0x19ae88){return function(_0x54b038){if(_0x54b038){return _0x54b038[_0xa55c('0x26')]()[_0xa55c('0x27')](function(){var _0x3f64de=_0x54b038[_0xa55c('0x28')]({'plain':!![]});var _0x2313a9=_0xa55c('0x29');return db[_0xa55c('0x2a')][_0xa55c('0x26')]({'where':{'type':_0x2313a9,'resourceId':_0x3f64de['id']}})[_0xa55c('0x27')](function(){return _0x54b038;});})[_0xa55c('0x27')](function(){_0x59d89a[_0xa55c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430d55,_0x28814f){return function(_0x1c9f6b){if(!_0x1c9f6b){_0x430d55[_0xa55c('0x2b')](0x194);}return _0x1c9f6b;};}function handleError(_0x5d940d,_0x1377b0){_0x1377b0=_0x1377b0||0x1f4;return function(_0x22f6b6){logger[_0xa55c('0x2c')](_0x22f6b6[_0xa55c('0x2d')]);if(_0x22f6b6[_0xa55c('0x2e')]){delete _0x22f6b6[_0xa55c('0x2e')];}_0x5d940d['status'](_0x1377b0)[_0xa55c('0x2f')](_0x22f6b6);};}exports['index']=function(_0x35c9c2,_0x1d730b){var _0x1cc53e={},_0x223813={},_0x4d8416={'count':0x0,'rows':[]};var _0x3d28fb=_[_0xa55c('0x30')](db[_0xa55c('0x31')][_0xa55c('0x32')],function(_0x10f4b7){return{'name':_0x10f4b7[_0xa55c('0x33')],'type':_0x10f4b7[_0xa55c('0x34')][_0xa55c('0x35')]};});_0x223813[_0xa55c('0x36')]=_[_0xa55c('0x30')](_0x3d28fb,_0xa55c('0x2e'));_0x223813['query']=_['keys'](_0x35c9c2[_0xa55c('0x37')]);_0x223813[_0xa55c('0x38')]=_['intersection'](_0x223813[_0xa55c('0x36')],_0x223813[_0xa55c('0x37')]);_0x1cc53e[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x223813[_0xa55c('0x36')],qs[_0xa55c('0x3b')](_0x35c9c2[_0xa55c('0x37')][_0xa55c('0x3b')]));_0x1cc53e[_0xa55c('0x39')]=_0x1cc53e['attributes']['length']?_0x1cc53e['attributes']:_0x223813[_0xa55c('0x36')];if(!_0x35c9c2[_0xa55c('0x37')][_0xa55c('0x3c')]('nolimit')){_0x1cc53e[_0xa55c('0x3d')]=qs['limit'](_0x35c9c2[_0xa55c('0x37')]['limit']);_0x1cc53e[_0xa55c('0x20')]=qs[_0xa55c('0x20')](_0x35c9c2[_0xa55c('0x37')]['offset']);}_0x1cc53e[_0xa55c('0x3e')]=qs[_0xa55c('0x3f')](_0x35c9c2['query'][_0xa55c('0x3f')]);_0x1cc53e[_0xa55c('0x40')]=qs['filters'](_['pick'](_0x35c9c2[_0xa55c('0x37')],_0x223813['filters']),_0x3d28fb);if(_0x35c9c2[_0xa55c('0x37')][_0xa55c('0x41')]){_0x1cc53e['where']=_['merge'](_0x1cc53e['where'],{'$or':_['map'](_0x3d28fb,function(_0x3b3308){if(_0x3b3308[_0xa55c('0x34')]!==_0xa55c('0x42')){var _0x99c4f8={};_0x99c4f8[_0x3b3308[_0xa55c('0x2e')]]={'$like':'%'+_0x35c9c2['query'][_0xa55c('0x41')]+'%'};return _0x99c4f8;}})});}_0x1cc53e=_[_0xa55c('0x43')]({},_0x1cc53e,_0x35c9c2[_0xa55c('0x44')]);var _0x317f6b={'where':_0x1cc53e[_0xa55c('0x40')]};return db[_0xa55c('0x31')]['count'](_0x317f6b)[_0xa55c('0x27')](function(_0x5ee63d){_0x4d8416['count']=_0x5ee63d;if(_0x35c9c2[_0xa55c('0x37')][_0xa55c('0x45')]){_0x1cc53e['include']=[{'all':!![]}];}return db[_0xa55c('0x31')]['findAll'](_0x1cc53e);})['then'](function(_0x2f8449){_0x4d8416[_0xa55c('0x46')]=_0x2f8449;return _0x4d8416;})[_0xa55c('0x27')](respondWithFilteredResult(_0x1d730b,_0x1cc53e))['catch'](handleError(_0x1d730b,null));};exports[_0xa55c('0x47')]=function(_0xd5a006,_0x5d9d5d){var _0x2ffb3c={'raw':!![],'where':{'id':_0xd5a006[_0xa55c('0x48')]['id']}},_0x514661={};_0x514661[_0xa55c('0x36')]=_['keys'](db[_0xa55c('0x31')][_0xa55c('0x32')]);_0x514661['query']=_[_0xa55c('0x49')](_0xd5a006[_0xa55c('0x37')]);_0x514661[_0xa55c('0x38')]=_['intersection'](_0x514661[_0xa55c('0x36')],_0x514661['query']);_0x2ffb3c[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x514661[_0xa55c('0x36')],qs['fields'](_0xd5a006[_0xa55c('0x37')][_0xa55c('0x3b')]));_0x2ffb3c['attributes']=_0x2ffb3c[_0xa55c('0x39')][_0xa55c('0x4a')]?_0x2ffb3c['attributes']:_0x514661[_0xa55c('0x36')];if(_0xd5a006[_0xa55c('0x37')]['includeAll']){_0x2ffb3c[_0xa55c('0x4b')]=[{'all':!![]}];}_0x2ffb3c=_[_0xa55c('0x43')]({},_0x2ffb3c,_0xd5a006[_0xa55c('0x44')]);return db[_0xa55c('0x31')]['find'](_0x2ffb3c)[_0xa55c('0x27')](handleEntityNotFound(_0x5d9d5d,null))['then'](respondWithResult(_0x5d9d5d,null))[_0xa55c('0x4c')](handleError(_0x5d9d5d,null));};exports[_0xa55c('0x4d')]=function(_0x194a79,_0x4a7adc){return db[_0xa55c('0x31')][_0xa55c('0x4d')](_0x194a79['body'],{})[_0xa55c('0x27')](function(_0x34de95){var _0x3822b7=_0x194a79[_0xa55c('0x4e')][_0xa55c('0x28')]({'plain':!![]});if(!_0x3822b7)throw new Error(_0xa55c('0x4f'));if(_0x3822b7[_0xa55c('0x50')]===_0xa55c('0x4e')){var _0x3c147b=_0x34de95[_0xa55c('0x28')]({'plain':!![]});var _0x4fc0a9=_0xa55c('0x29');return db[_0xa55c('0x51')][_0xa55c('0x52')]({'where':{'name':_0x4fc0a9,'userProfileId':_0x3822b7['userProfileId']},'raw':!![]})[_0xa55c('0x27')](function(_0x35bf0a){if(_0x35bf0a&&_0x35bf0a['autoAssociation']===0x0){return db[_0xa55c('0x2a')]['create']({'name':_0x3c147b[_0xa55c('0x2e')],'resourceId':_0x3c147b['id'],'type':_0x35bf0a[_0xa55c('0x2e')],'sectionId':_0x35bf0a['id']},{})[_0xa55c('0x27')](function(){return _0x34de95;});}else{return _0x34de95;}})[_0xa55c('0x4c')](function(_0x2ecf79){logger['error'](_0xa55c('0x53'),_0x2ecf79);throw _0x2ecf79;});}return _0x34de95;})[_0xa55c('0x27')](respondWithResult(_0x4a7adc,0xc9))['catch'](handleError(_0x4a7adc,null));};exports[_0xa55c('0x25')]=function(_0x2291e0,_0x17f4f8){if(_0x2291e0[_0xa55c('0x54')]['id']){delete _0x2291e0['body']['id'];}return db['FaxQueue'][_0xa55c('0x52')]({'where':{'id':_0x2291e0[_0xa55c('0x48')]['id']}})[_0xa55c('0x27')](handleEntityNotFound(_0x17f4f8,null))[_0xa55c('0x27')](saveUpdates(_0x2291e0['body'],null))[_0xa55c('0x27')](respondWithResult(_0x17f4f8,null))['catch'](handleError(_0x17f4f8,null));};exports[_0xa55c('0x26')]=function(_0x437ced,_0x20593d){return db[_0xa55c('0x31')][_0xa55c('0x52')]({'where':{'id':_0x437ced['params']['id']}})[_0xa55c('0x27')](handleEntityNotFound(_0x20593d,null))['then'](removeEntity(_0x20593d,null))[_0xa55c('0x4c')](handleError(_0x20593d,null));};exports[_0xa55c('0x55')]=function(_0x2cfe08,_0x1e1c5b){return db[_0xa55c('0x31')][_0xa55c('0x55')]()[_0xa55c('0x27')](respondWithResult(_0x1e1c5b,null))['catch'](handleError(_0x1e1c5b,null));};exports[_0xa55c('0x56')]=function(_0x449e00,_0x2f2d21,_0x23a30e){var _0x3fa00f={'raw':!![],'where':{}},_0x5ba2b0={},_0xa72718;return db[_0xa55c('0x31')][_0xa55c('0x57')]({'where':{'id':_0x449e00[_0xa55c('0x48')]['id']}})[_0xa55c('0x27')](handleEntityNotFound(_0x2f2d21,null))['then'](function(_0xdd92c1){if(_0xdd92c1){_0xa72718=_0xdd92c1[_0xa55c('0x28')]({'plain':!![]});_0x5ba2b0[_0xa55c('0x36')]=_[_0xa55c('0x49')](db[_0xa55c('0x58')]['rawAttributes']);_0x5ba2b0[_0xa55c('0x37')]=_['keys'](_0x449e00[_0xa55c('0x37')]);_0x5ba2b0['filters']=_[_0xa55c('0x3a')](_0x5ba2b0['model'],_0x5ba2b0[_0xa55c('0x37')]);_0x3fa00f[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x5ba2b0[_0xa55c('0x36')],qs[_0xa55c('0x3b')](_0x449e00[_0xa55c('0x37')][_0xa55c('0x3b')]));_0x3fa00f[_0xa55c('0x39')]=_0x3fa00f[_0xa55c('0x39')][_0xa55c('0x4a')]?_0x3fa00f['attributes']:_0x5ba2b0[_0xa55c('0x36')];if(!_0x449e00[_0xa55c('0x37')]['hasOwnProperty'](_0xa55c('0x59'))){_0x3fa00f[_0xa55c('0x3d')]=qs[_0xa55c('0x3d')](_0x449e00[_0xa55c('0x37')][_0xa55c('0x3d')]);_0x3fa00f[_0xa55c('0x20')]=qs[_0xa55c('0x20')](_0x449e00[_0xa55c('0x37')]['offset']);}_0x3fa00f[_0xa55c('0x3e')]=qs[_0xa55c('0x3f')](_0x449e00[_0xa55c('0x37')][_0xa55c('0x3f')]);_0x3fa00f[_0xa55c('0x40')]=qs[_0xa55c('0x38')](_[_0xa55c('0x5a')](_0x449e00[_0xa55c('0x37')],_0x5ba2b0[_0xa55c('0x38')]));_0x3fa00f['where'][_0xa55c('0x5b')]=_0xdd92c1['id'];if(_0x449e00[_0xa55c('0x37')][_0xa55c('0x41')]){_0x3fa00f[_0xa55c('0x40')]=_[_0xa55c('0x43')](_0x3fa00f[_0xa55c('0x40')],{'$or':_[_0xa55c('0x30')](_0x3fa00f[_0xa55c('0x39')],function(_0x2e4cf7){var _0x3178a6={};_0x3178a6[_0x2e4cf7]={'$like':'%'+_0x449e00[_0xa55c('0x37')]['filter']+'%'};return _0x3178a6;})});}_0x3fa00f=_[_0xa55c('0x43')]({},_0x3fa00f,_0x449e00['options']);return db[_0xa55c('0x58')][_0xa55c('0x5c')](_0x3fa00f);}})[_0xa55c('0x27')](function(_0x4f2a7b){if(_0x4f2a7b){return db['User'][_0xa55c('0x5d')]({'where':{'id':_[_0xa55c('0x30')](_0x4f2a7b,_0xa55c('0x5e')),'role':_0xa55c('0x5f')},'attributes':['id','name',_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x62')]});}})[_0xa55c('0x27')](function(_0x21fc9b){if(_0x21fc9b){return{'count':_0x21fc9b['count'],'rows':_['map'](_0x21fc9b[_0xa55c('0x46')],function(_0x38689e){return{'membername':_0x38689e[_0xa55c('0x2e')],'UserId':_0x38689e['id'],'queue_name':_0xa72718[_0xa55c('0x2e')],'FaxQueueId':_0xa72718['id'],'interface':util[_0xa55c('0x63')]('%s/%s',_0xa55c('0x64'),_0x38689e[_0xa55c('0x2e')]),'penalty':0x0,'paused':_0x38689e['faxPause'],'createdAt':_0x38689e[_0xa55c('0x62')],'updatedAt':_0x38689e[_0xa55c('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa55c('0x27')](respondWithFilteredResult(_0x2f2d21,_0x3fa00f))['catch'](handleError(_0x2f2d21,null));};exports[_0xa55c('0x65')]=function(_0x3ff604,_0xdf94b3,_0xb0de22){var _0x232143={};var _0x506f74={};var _0x25bd5b;var _0x2e2cf6;return db['FaxQueue']['findOne']({'where':{'id':_0x3ff604[_0xa55c('0x48')]['id']}})['then'](handleEntityNotFound(_0xdf94b3,null))[_0xa55c('0x27')](function(_0x5ca0bc){if(_0x5ca0bc){_0x25bd5b=_0x5ca0bc;_0x506f74[_0xa55c('0x36')]=_[_0xa55c('0x49')](db[_0xa55c('0x66')][_0xa55c('0x32')]);_0x506f74[_0xa55c('0x37')]=_[_0xa55c('0x49')](_0x3ff604[_0xa55c('0x37')]);_0x506f74['filters']=_[_0xa55c('0x3a')](_0x506f74[_0xa55c('0x36')],_0x506f74[_0xa55c('0x37')]);_0x232143[_0xa55c('0x39')]=_['intersection'](_0x506f74[_0xa55c('0x36')],qs[_0xa55c('0x3b')](_0x3ff604[_0xa55c('0x37')][_0xa55c('0x3b')]));_0x232143['attributes']=_0x232143['attributes'][_0xa55c('0x4a')]?_0x232143[_0xa55c('0x39')]:_0x506f74[_0xa55c('0x36')];_0x232143[_0xa55c('0x3e')]=qs['sort'](_0x3ff604['query'][_0xa55c('0x3f')]);_0x232143[_0xa55c('0x40')]=qs[_0xa55c('0x38')](_[_0xa55c('0x5a')](_0x3ff604[_0xa55c('0x37')],_0x506f74[_0xa55c('0x38')]));if(_0x3ff604[_0xa55c('0x37')]['filter']){_0x232143[_0xa55c('0x40')]=_['merge'](_0x232143[_0xa55c('0x40')],{'$or':_['map'](_0x232143[_0xa55c('0x39')],function(_0x313cdc){var _0x441c11={};_0x441c11[_0x313cdc]={'$like':'%'+_0x3ff604[_0xa55c('0x37')][_0xa55c('0x41')]+'%'};return _0x441c11;})});}_0x232143=_[_0xa55c('0x43')]({},_0x232143,_0x3ff604[_0xa55c('0x44')]);return _0x25bd5b[_0xa55c('0x65')](_0x232143);}})['then'](function(_0x59414d){if(_0x59414d){_0x2e2cf6=_0x59414d[_0xa55c('0x4a')];if(!_0x3ff604[_0xa55c('0x37')][_0xa55c('0x3c')](_0xa55c('0x59'))){_0x232143[_0xa55c('0x3d')]=qs[_0xa55c('0x3d')](_0x3ff604['query'][_0xa55c('0x3d')]);_0x232143[_0xa55c('0x20')]=qs[_0xa55c('0x20')](_0x3ff604[_0xa55c('0x37')][_0xa55c('0x20')]);}return _0x25bd5b[_0xa55c('0x65')](_0x232143);}})[_0xa55c('0x27')](function(_0x27ce81){if(_0x27ce81){return _0x27ce81?{'count':_0x2e2cf6,'rows':_0x27ce81}:null;}})['then'](respondWithResult(_0xdf94b3,null))[_0xa55c('0x4c')](handleError(_0xdf94b3,null));};exports[_0xa55c('0x67')]=function(_0x42d773,_0x25e246,_0xa957ad){var _0x4c599e=_0x42d773[_0xa55c('0x54')][_0xa55c('0x68')];return db['Team']['findAll']({'where':{'id':_0x4c599e},'attributes':['id'],'include':[{'model':db[_0xa55c('0x69')],'as':_0xa55c('0x6a'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0xa55c('0x27')](function(_0xf77ff8){if(_0xf77ff8){var _0x1f0363=_[_0xa55c('0x6b')](_0xf77ff8,function(_0x3e7aa2){var _0x3c07ed=_0x3e7aa2['get']({'plain':!![]});return _0x3c07ed[_0xa55c('0x6a')];});return db[_0xa55c('0x31')][_0xa55c('0x52')]({'where':{'id':_0x42d773[_0xa55c('0x48')]['id']}})['then'](function(_0x24154e){return db[_0xa55c('0x6c')][_0xa55c('0x6d')](function(_0x4cc104){return _0x24154e[_0xa55c('0x67')](_0x4c599e,{'transaction':_0x4cc104})['then'](function(){return BPromise['each'](_0x1f0363,function(_0x1d20bf){return db[_0xa55c('0x58')][_0xa55c('0x6e')]({'where':{'UserId':_0x1d20bf['id'],'FaxQueueId':_0x42d773[_0xa55c('0x48')]['id']},'transaction':_0x4cc104});});})[_0xa55c('0x27')](function(){_0x1f0363[_0xa55c('0x6f')](function(_0x2ab269){socket['emit']('userFaxQueue:save',{'UserId':_0x2ab269['id'],'FaxQueueId':_0x24154e['id']});});});});});}})[_0xa55c('0x27')](respondWithStatusCode(_0x25e246,null))[_0xa55c('0x4c')](handleError(_0x25e246,null));};exports[_0xa55c('0x70')]=function(_0x1f4bc8,_0x195c86,_0x2a0805){return db[_0xa55c('0x66')][_0xa55c('0x5c')]({'where':{'id':_0x1f4bc8[_0xa55c('0x37')][_0xa55c('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa55c('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xa55c('0x27')](handleEntityNotFound(_0x195c86,null))['then'](function(_0xb9708){var _0x584317=_[_0xa55c('0x30')](_0xb9708,'id');var _0xe504ba=[];var _0x3fe34d=[];var _0x314205=squel[_0xa55c('0x71')]();_0x314205['field'](_0xa55c('0x72'))[_0xa55c('0x73')](_0xa55c('0x74'),'tq')[_0xa55c('0x75')](_0xa55c('0x76'),'ut',_0xa55c('0x77'))[_0xa55c('0x40')]('FaxQueueId\x20=\x20?',_0x1f4bc8['params']['id']);for(var _0x5c08e5=0x0;_0x5c08e5<_0xb9708[_0xa55c('0x4a')];_0x5c08e5+=0x1){let _0x54badc=_0xb9708[_0x5c08e5];for(var _0x266014=0x0;_0x266014<_0x54badc[_0xa55c('0x6a')][_0xa55c('0x4a')];_0x266014+=0x1){let _0x73162a=_0x54badc[_0xa55c('0x6a')][_0x266014];var _0x4f8f56=_0x314205[_0xa55c('0x78')]();_0x4f8f56['where'](_0xa55c('0x79'),_0x73162a['id']);_0x3fe34d[_0xa55c('0x7a')](db[_0xa55c('0x6c')][_0xa55c('0x37')](_0x4f8f56['toString'](),{'type':db[_0xa55c('0x6c')][_0xa55c('0x7b')][_0xa55c('0x7c')]})[_0xa55c('0x27')](function(_0xc58a3){if(_0xc58a3[_0xa55c('0x4a')]===0x1){return _0x73162a['id'];}else{var _0x270bd0=_[_0xa55c('0x7d')](_['map'](_0xc58a3,_0xa55c('0x7e')),function(_0x1538dc){return _[_0xa55c('0x7f')](_0x584317,_0x1538dc);});if(_0x270bd0){return _0x73162a['id'];}}}));}}return BPromise[_0xa55c('0x80')](_0x3fe34d)[_0xa55c('0x27')](function(_0x111113){_0xe504ba=_(_0xe504ba)['union'](_0x111113)[_0xa55c('0x81')]()['value']();return db[_0xa55c('0x31')]['find']({'where':{'id':_0x1f4bc8[_0xa55c('0x48')]['id']}})[_0xa55c('0x27')](function(_0x17312b){return db['sequelize'][_0xa55c('0x6d')](function(_0x46efb4){return _0x17312b[_0xa55c('0x70')](_0x1f4bc8['query'][_0xa55c('0x68')],{'transaction':_0x46efb4})['then'](function(){if(!_[_0xa55c('0x82')](_0xe504ba)){return _0x17312b[_0xa55c('0x83')](_0xe504ba,{'transaction':_0x46efb4});}})['then'](function(){_0xe504ba[_0xa55c('0x6f')](function(_0x4d7e6c){socket[_0xa55c('0x84')](_0xa55c('0x85'),{'UserId':_0x4d7e6c,'FaxQueueId':_0x17312b['id']});});});});});});})['then'](respondWithStatusCode(_0x195c86,null))[_0xa55c('0x4c')](handleError(_0x195c86,null));};exports[_0xa55c('0x86')]=function(_0x4adadc,_0x1c981b,_0x8f3d34){return db['FaxQueue'][_0xa55c('0x52')]({'where':{'id':_0x4adadc['params']['id']}})['then'](handleEntityNotFound(_0x1c981b,null))[_0xa55c('0x27')](function(_0x3113b9){if(_0x3113b9){return _0x3113b9[_0xa55c('0x86')](_0x4adadc[_0xa55c('0x54')]['ids'],_[_0xa55c('0x87')](_0x4adadc['body'],[_0xa55c('0x68'),'id'])||{})['spread'](function(_0x4ab9f1){for(var _0x595774=0x0;_0x595774<_0x4adadc[_0xa55c('0x54')]['ids']['length'];_0x595774+=0x1){socket[_0xa55c('0x84')](_0xa55c('0x88'),{'UserId':_0x4adadc[_0xa55c('0x54')][_0xa55c('0x68')][_0x595774],'FaxQueueId':_0x4adadc[_0xa55c('0x48')]['id']});}return _0x4ab9f1;});}})[_0xa55c('0x27')](respondWithResult(_0x1c981b,null))[_0xa55c('0x4c')](handleError(_0x1c981b,null));};exports[_0xa55c('0x83')]=function(_0x465801,_0x1e37d6,_0x146365){return db[_0xa55c('0x31')][_0xa55c('0x52')]({'where':{'id':_0x465801['params']['id']}})[_0xa55c('0x27')](handleEntityNotFound(_0x1e37d6,null))['then'](function(_0x514d16){if(_0x514d16){return _0x514d16['removeAgents'](_0x465801[_0xa55c('0x37')]['ids'])[_0xa55c('0x27')](function(){if(_['isArray'](_0x465801[_0xa55c('0x37')]['ids'])){for(var _0x4aca22=0x0;_0x4aca22<_0x465801[_0xa55c('0x37')]['ids']['length'];_0x4aca22+=0x1){socket[_0xa55c('0x84')](_0xa55c('0x85'),{'UserId':Number(_0x465801['query'][_0xa55c('0x68')][_0x4aca22]),'FaxQueueId':Number(_0x465801['params']['id'])});}}else{socket[_0xa55c('0x84')](_0xa55c('0x85'),{'UserId':Number(_0x465801[_0xa55c('0x37')]['ids']),'FaxQueueId':Number(_0x465801['params']['id'])});}});}})[_0xa55c('0x27')](respondWithStatusCode(_0x1e37d6,null))[_0xa55c('0x4c')](handleError(_0x1e37d6,null));};exports[_0xa55c('0x89')]=function(_0xfda07f,_0x4297bf,_0x40c982){var _0x1483f4={};var _0x23ec95={};var _0x519ee5;var _0x2f3fb6;return db[_0xa55c('0x31')][_0xa55c('0x57')]({'where':{'id':_0xfda07f[_0xa55c('0x48')]['id']}})[_0xa55c('0x27')](handleEntityNotFound(_0x4297bf,null))[_0xa55c('0x27')](function(_0x2fa186){if(_0x2fa186){_0x519ee5=_0x2fa186;_0x23ec95[_0xa55c('0x36')]=_[_0xa55c('0x49')](db['User'][_0xa55c('0x32')]);_0x23ec95[_0xa55c('0x37')]=_[_0xa55c('0x49')](_0xfda07f['query']);_0x23ec95['filters']=_['intersection'](_0x23ec95[_0xa55c('0x36')],_0x23ec95['query']);_0x1483f4[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x23ec95[_0xa55c('0x36')],qs[_0xa55c('0x3b')](_0xfda07f[_0xa55c('0x37')][_0xa55c('0x3b')]));_0x1483f4[_0xa55c('0x39')]=_0x1483f4[_0xa55c('0x39')][_0xa55c('0x4a')]?_0x1483f4[_0xa55c('0x39')]:_0x23ec95[_0xa55c('0x36')];_0x1483f4[_0xa55c('0x3e')]=qs[_0xa55c('0x3f')](_0xfda07f[_0xa55c('0x37')][_0xa55c('0x3f')]);_0x1483f4[_0xa55c('0x40')]=qs[_0xa55c('0x38')](_[_0xa55c('0x5a')](_0xfda07f[_0xa55c('0x37')],_0x23ec95[_0xa55c('0x38')]));if(_0xfda07f[_0xa55c('0x37')][_0xa55c('0x41')]){_0x1483f4[_0xa55c('0x40')]=_[_0xa55c('0x43')](_0x1483f4['where'],{'$or':_[_0xa55c('0x30')](_0x1483f4[_0xa55c('0x39')],function(_0x49e8f2){var _0x2ea15f={};_0x2ea15f[_0x49e8f2]={'$like':'%'+_0xfda07f[_0xa55c('0x37')][_0xa55c('0x41')]+'%'};return _0x2ea15f;})});}_0x1483f4=_[_0xa55c('0x43')]({},_0x1483f4,_0xfda07f[_0xa55c('0x44')]);return _0x519ee5['getAgents'](_0x1483f4);}})[_0xa55c('0x27')](function(_0x5c2421){if(_0x5c2421){_0x2f3fb6=_0x5c2421['length'];if(!_0xfda07f[_0xa55c('0x37')][_0xa55c('0x3c')](_0xa55c('0x59'))){_0x1483f4[_0xa55c('0x3d')]=qs[_0xa55c('0x3d')](_0xfda07f[_0xa55c('0x37')][_0xa55c('0x3d')]);_0x1483f4[_0xa55c('0x20')]=qs[_0xa55c('0x20')](_0xfda07f[_0xa55c('0x37')][_0xa55c('0x20')]);}return _0x519ee5[_0xa55c('0x89')](_0x1483f4);}})[_0xa55c('0x27')](function(_0x97ae22){if(_0x97ae22){return _0x97ae22?{'count':_0x2f3fb6,'rows':_0x97ae22}:null;}})[_0xa55c('0x27')](respondWithResult(_0x4297bf,null))[_0xa55c('0x4c')](handleError(_0x4297bf,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e8eb82f..82d93e8 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 _0x9160=['hasOwnProperty','hook','events','../../mysqldb','FaxQueue','save','update','emit'];(function(_0x43d71c,_0x525e5d){var _0x5453f5=function(_0x3339e2){while(--_0x3339e2){_0x43d71c['push'](_0x43d71c['shift']());}};_0x5453f5(++_0x525e5d);}(_0x9160,0x1a2));var _0x0916=function(_0x1d6f0e,_0xc810af){_0x1d6f0e=_0x1d6f0e-0x0;var _0x1671d9=_0x9160[_0x1d6f0e];return _0x1671d9;};'use strict';var EventEmitter=require(_0x0916('0x0'));var FaxQueue=require(_0x0916('0x1'))['db'][_0x0916('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0916('0x3'),'afterUpdate':_0x0916('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2713de){return function(_0x137fc2,_0x1a96d4,_0xa3cb57){FaxQueueEvents[_0x0916('0x5')](_0x2713de+':'+_0x137fc2['id'],_0x137fc2);FaxQueueEvents[_0x0916('0x5')](_0x2713de,_0x137fc2);_0xa3cb57(null);};}for(var e in events){if(events[_0x0916('0x6')](e)){var event=events[e];FaxQueue[_0x0916('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x7b45=['events','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4eebdd,_0x2edb78){var _0x172d02=function(_0x1983db){while(--_0x1983db){_0x4eebdd['push'](_0x4eebdd['shift']());}};_0x172d02(++_0x2edb78);}(_0x7b45,0xb4));var _0x57b4=function(_0xe8202a,_0x1b625f){_0xe8202a=_0xe8202a-0x0;var _0x20857a=_0x7b45[_0xe8202a];return _0x20857a;};'use strict';var EventEmitter=require(_0x57b4('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x57b4('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x57b4('0x2')](0x0);var events={'afterCreate':_0x57b4('0x3'),'afterUpdate':_0x57b4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2852dd){return function(_0x17d4af,_0xfad47e,_0x27e879){FaxQueueEvents[_0x57b4('0x5')](_0x2852dd+':'+_0x17d4af['id'],_0x17d4af);FaxQueueEvents[_0x57b4('0x5')](_0x2852dd,_0x17d4af);_0x27e879(null);};}for(var e in events){if(events[_0x57b4('0x6')](e)){var event=events[e];FaxQueue[_0x57b4('0x7')](e,emitEvent(event));}}module[_0x57b4('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 c492a9f..03c7cc2 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 _0x14a3=['util','../../config/logger','moment','bluebird','rimraf','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x47dda1,_0x471128){var _0x6979e3=function(_0x32d702){while(--_0x32d702){_0x47dda1['push'](_0x47dda1['shift']());}};_0x6979e3(++_0x471128);}(_0x14a3,0xc7));var _0x314a=function(_0x3aacea,_0x4dec2d){_0x3aacea=_0x3aacea-0x0;var _0xabe687=_0x14a3[_0x3aacea];return _0xabe687;};'use strict';var _=require(_0x314a('0x0'));var util=require(_0x314a('0x1'));var logger=require(_0x314a('0x2'))('api');var moment=require(_0x314a('0x3'));var BPromise=require(_0x314a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x314a('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x314a('0x6')]=function(_0x22526f,_0x332203){return _0x22526f[_0x314a('0x7')](_0x314a('0x8'),attributes,{'tableName':_0x314a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf15a=['exports','define','FaxQueue','fax_queues','util','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x289ee4,_0x11369e){var _0x5e9df5=function(_0x5b4d84){while(--_0x5b4d84){_0x289ee4['push'](_0x289ee4['shift']());}};_0x5e9df5(++_0x11369e);}(_0xf15a,0x10c));var _0xaf15=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf15a[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xaf15('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xaf15('0x1'));var BPromise=require(_0xaf15('0x2'));var rp=require(_0xaf15('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf15('0x4'));var config=require(_0xaf15('0x5'));var attributes=require(_0xaf15('0x6'));module[_0xaf15('0x7')]=function(_0x4b0f8a,_0xfd3858){return _0x4b0f8a[_0xaf15('0x8')](_0xaf15('0x9'),attributes,{'tableName':_0xaf15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index aefc7c7..6fd324f 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 _0x7c23=['message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowFaxQueue','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x369368,_0x2a8685){var _0x170f6e=function(_0x5bbc40){while(--_0x5bbc40){_0x369368['push'](_0x369368['shift']());}};_0x170f6e(++_0x2a8685);}(_0x7c23,0x100));var _0x37c2=function(_0x5279dd,_0x173a46){_0x5279dd=_0x5279dd-0x0;var _0x42ea92=_0x7c23[_0x5279dd];return _0x42ea92;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x37c2('0x0'));var rs=require(_0x37c2('0x1'));var fs=require('fs');var Redis=require(_0x37c2('0x2'));var db=require(_0x37c2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x37c2('0x4'));var config=require(_0x37c2('0x5'));var jayson=require(_0x37c2('0x6'));var client=jayson['client'][_0x37c2('0x7')]({'port':0x232a});config[_0x37c2('0x8')]=_[_0x37c2('0x9')](config['redis'],{'host':_0x37c2('0xa'),'port':0x18eb});var socket=require(_0x37c2('0xb'))(new Redis(config[_0x37c2('0x8')]));require(_0x37c2('0xc'))[_0x37c2('0xd')](socket);function respondWithRpcPromise(_0x28abc3,_0x15b9ba,_0x37d009){return new BPromise(function(_0x3a7399,_0x41264d){return client[_0x37c2('0xe')](_0x28abc3,_0x37d009)[_0x37c2('0xf')](function(_0x206631){logger[_0x37c2('0x10')](_0x37c2('0x11'),_0x15b9ba,_0x37c2('0x12'));logger[_0x37c2('0x13')](_0x37c2('0x14'),_0x15b9ba,_0x37c2('0x12'),JSON[_0x37c2('0x15')](_0x206631));if(_0x206631[_0x37c2('0x16')]){if(_0x206631[_0x37c2('0x16')][_0x37c2('0x17')]===0x1f4){logger[_0x37c2('0x16')](_0x37c2('0x11'),_0x15b9ba,_0x206631[_0x37c2('0x16')][_0x37c2('0x18')]);return _0x41264d(_0x206631[_0x37c2('0x16')][_0x37c2('0x18')]);}logger[_0x37c2('0x16')]('FaxQueue,\x20%s,\x20%s',_0x15b9ba,_0x206631[_0x37c2('0x16')]['message']);return _0x3a7399(_0x206631['error'][_0x37c2('0x18')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x15b9ba,_0x37c2('0x12'));_0x3a7399(_0x206631[_0x37c2('0x19')][_0x37c2('0x18')]);}})[_0x37c2('0x1a')](function(_0x40134e){logger['error'](_0x37c2('0x11'),_0x15b9ba,_0x40134e);_0x41264d(_0x40134e);});});}exports[_0x37c2('0x1b')]=function(_0xdc870c){var _0x10e7be=this;return new Promise(function(_0x26e42f,_0x54e604){return db[_0x37c2('0x1c')][_0x37c2('0x1d')]({'raw':_0xdc870c[_0x37c2('0x1e')]?_0xdc870c[_0x37c2('0x1e')][_0x37c2('0x1f')]===undefined?!![]:![]:!![],'where':_0xdc870c['options']?_0xdc870c[_0x37c2('0x1e')][_0x37c2('0x20')]||null:null,'attributes':_0xdc870c['options']?_0xdc870c[_0x37c2('0x1e')][_0x37c2('0x21')]||null:null,'limit':_0xdc870c['options']?_0xdc870c['options'][_0x37c2('0x22')]||null:null,'include':_0xdc870c[_0x37c2('0x1e')]?_0xdc870c['options'][_0x37c2('0x23')]?_[_0x37c2('0x24')](_0xdc870c[_0x37c2('0x1e')][_0x37c2('0x23')],function(_0xd657a5){return{'model':db[_0xd657a5[_0x37c2('0x25')]],'as':_0xd657a5['as'],'attributes':_0xd657a5[_0x37c2('0x21')],'include':_0xd657a5[_0x37c2('0x23')]?_[_0x37c2('0x24')](_0xd657a5[_0x37c2('0x23')],function(_0x2f5114){return{'model':db[_0x2f5114['model']],'as':_0x2f5114['as'],'attributes':_0x2f5114[_0x37c2('0x21')],'include':_0x2f5114[_0x37c2('0x23')]?_['map'](_0x2f5114[_0x37c2('0x23')],function(_0x40c72e){return{'model':db[_0x40c72e[_0x37c2('0x25')]],'as':_0x40c72e['as'],'attributes':_0x40c72e[_0x37c2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x37c2('0xf')](function(_0x4d186f){logger[_0x37c2('0x10')](_0x37c2('0x1b'),_0xdc870c);logger[_0x37c2('0x13')](_0x37c2('0x1b'),_0xdc870c,JSON[_0x37c2('0x15')](_0x4d186f));_0x26e42f(_0x4d186f);})[_0x37c2('0x1a')](function(_0x2dcf04){logger[_0x37c2('0x16')](_0x37c2('0x1b'),_0x2dcf04[_0x37c2('0x18')],_0xdc870c);_0x54e604(_0x10e7be[_0x37c2('0x16')](0x1f4,_0x2dcf04['message']));});});};exports['ShowFaxQueue']=function(_0x2d2a88){var _0x4f0388=this;return new Promise(function(_0x23e42b,_0x561572){return db[_0x37c2('0x1c')][_0x37c2('0x26')]({'raw':_0x2d2a88[_0x37c2('0x1e')]?_0x2d2a88[_0x37c2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2d2a88[_0x37c2('0x1e')]?_0x2d2a88[_0x37c2('0x1e')][_0x37c2('0x20')]||null:null,'attributes':_0x2d2a88[_0x37c2('0x1e')]?_0x2d2a88[_0x37c2('0x1e')][_0x37c2('0x21')]||null:null,'include':_0x2d2a88['options']?_0x2d2a88[_0x37c2('0x1e')][_0x37c2('0x23')]?_[_0x37c2('0x24')](_0x2d2a88[_0x37c2('0x1e')][_0x37c2('0x23')],function(_0x133ac0){return{'model':db[_0x133ac0[_0x37c2('0x25')]],'as':_0x133ac0['as'],'attributes':_0x133ac0[_0x37c2('0x21')],'include':_0x133ac0['include']?_['map'](_0x133ac0[_0x37c2('0x23')],function(_0x1fc3de){return{'model':db[_0x1fc3de[_0x37c2('0x25')]],'as':_0x1fc3de['as'],'attributes':_0x1fc3de[_0x37c2('0x21')],'include':_0x1fc3de['include']?_[_0x37c2('0x24')](_0x1fc3de['include'],function(_0x765ad8){return{'model':db[_0x765ad8[_0x37c2('0x25')]],'as':_0x765ad8['as'],'attributes':_0x765ad8[_0x37c2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x37c2('0xf')](function(_0x157889){logger[_0x37c2('0x10')]('ShowFaxQueue',_0x2d2a88);logger[_0x37c2('0x13')](_0x37c2('0x27'),_0x2d2a88,JSON[_0x37c2('0x15')](_0x157889));_0x23e42b(_0x157889);})['catch'](function(_0x3f1467){logger[_0x37c2('0x16')](_0x37c2('0x27'),_0x3f1467[_0x37c2('0x18')],_0x2d2a88);_0x561572(_0x4f0388[_0x37c2('0x16')](0x1f4,_0x3f1467[_0x37c2('0x18')]));});});}; \ No newline at end of file +var _0x4ea2=['attributes','limit','include','map','model','stringify','find','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where'];(function(_0x1511db,_0x42e556){var _0x44afb5=function(_0x27b1c7){while(--_0x27b1c7){_0x1511db['push'](_0x1511db['shift']());}};_0x44afb5(++_0x42e556);}(_0x4ea2,0xa0));var _0x24ea=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x4ea2[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x24ea('0x0'));var util=require(_0x24ea('0x1'));var moment=require(_0x24ea('0x2'));var BPromise=require(_0x24ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24ea('0x4'));var db=require(_0x24ea('0x5'))['db'];var utils=require(_0x24ea('0x6'));var logger=require(_0x24ea('0x7'))(_0x24ea('0x8'));var config=require('../../config/environment');var jayson=require(_0x24ea('0x9'));var client=jayson[_0x24ea('0xa')]['http']({'port':0x232a});config[_0x24ea('0xb')]=_[_0x24ea('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24ea('0xb')]));require('./faxQueue.socket')[_0x24ea('0xd')](socket);function respondWithRpcPromise(_0x35e2a1,_0x5a6468,_0x4cf009){return new BPromise(function(_0x4a1082,_0x3b9cae){return client[_0x24ea('0xe')](_0x35e2a1,_0x4cf009)[_0x24ea('0xf')](function(_0x121135){logger[_0x24ea('0x10')](_0x24ea('0x11'),_0x5a6468,_0x24ea('0x12'));logger[_0x24ea('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5a6468,'request\x20sent',JSON['stringify'](_0x121135));if(_0x121135[_0x24ea('0x14')]){if(_0x121135['error']['code']===0x1f4){logger[_0x24ea('0x14')]('FaxQueue,\x20%s,\x20%s',_0x5a6468,_0x121135['error'][_0x24ea('0x15')]);return _0x3b9cae(_0x121135[_0x24ea('0x14')][_0x24ea('0x15')]);}logger[_0x24ea('0x14')](_0x24ea('0x11'),_0x5a6468,_0x121135[_0x24ea('0x14')][_0x24ea('0x15')]);return _0x4a1082(_0x121135[_0x24ea('0x14')]['message']);}else{logger[_0x24ea('0x10')]('FaxQueue,\x20%s,\x20%s',_0x5a6468,_0x24ea('0x12'));_0x4a1082(_0x121135[_0x24ea('0x16')][_0x24ea('0x15')]);}})[_0x24ea('0x17')](function(_0x575e7c){logger[_0x24ea('0x14')]('FaxQueue,\x20%s,\x20%s',_0x5a6468,_0x575e7c);_0x3b9cae(_0x575e7c);});});}exports[_0x24ea('0x18')]=function(_0x19aa10){var _0x3a536a=this;return new Promise(function(_0x35db1b,_0x34a437){return db[_0x24ea('0x19')][_0x24ea('0x1a')]({'raw':_0x19aa10[_0x24ea('0x1b')]?_0x19aa10['options'][_0x24ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x19aa10['options']?_0x19aa10[_0x24ea('0x1b')][_0x24ea('0x1d')]||null:null,'attributes':_0x19aa10['options']?_0x19aa10['options'][_0x24ea('0x1e')]||null:null,'limit':_0x19aa10[_0x24ea('0x1b')]?_0x19aa10[_0x24ea('0x1b')][_0x24ea('0x1f')]||null:null,'include':_0x19aa10['options']?_0x19aa10[_0x24ea('0x1b')][_0x24ea('0x20')]?_[_0x24ea('0x21')](_0x19aa10[_0x24ea('0x1b')]['include'],function(_0x3a6914){return{'model':db[_0x3a6914[_0x24ea('0x22')]],'as':_0x3a6914['as'],'attributes':_0x3a6914[_0x24ea('0x1e')],'include':_0x3a6914[_0x24ea('0x20')]?_[_0x24ea('0x21')](_0x3a6914[_0x24ea('0x20')],function(_0x317675){return{'model':db[_0x317675[_0x24ea('0x22')]],'as':_0x317675['as'],'attributes':_0x317675[_0x24ea('0x1e')],'include':_0x317675[_0x24ea('0x20')]?_['map'](_0x317675[_0x24ea('0x20')],function(_0x39a83f){return{'model':db[_0x39a83f['model']],'as':_0x39a83f['as'],'attributes':_0x39a83f[_0x24ea('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x24ea('0xf')](function(_0x50dda1){logger[_0x24ea('0x10')](_0x24ea('0x18'),_0x19aa10);logger[_0x24ea('0x13')](_0x24ea('0x18'),_0x19aa10,JSON[_0x24ea('0x23')](_0x50dda1));_0x35db1b(_0x50dda1);})['catch'](function(_0x2a3a17){logger['error'](_0x24ea('0x18'),_0x2a3a17[_0x24ea('0x15')],_0x19aa10);_0x34a437(_0x3a536a['error'](0x1f4,_0x2a3a17[_0x24ea('0x15')]));});});};exports['ShowFaxQueue']=function(_0x563a88){var _0x25ac6f=this;return new Promise(function(_0x2d4e03,_0x3dd38b){return db['FaxQueue'][_0x24ea('0x24')]({'raw':_0x563a88[_0x24ea('0x1b')]?_0x563a88[_0x24ea('0x1b')][_0x24ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x563a88[_0x24ea('0x1b')]?_0x563a88[_0x24ea('0x1b')]['where']||null:null,'attributes':_0x563a88[_0x24ea('0x1b')]?_0x563a88[_0x24ea('0x1b')][_0x24ea('0x1e')]||null:null,'include':_0x563a88[_0x24ea('0x1b')]?_0x563a88[_0x24ea('0x1b')][_0x24ea('0x20')]?_['map'](_0x563a88[_0x24ea('0x1b')]['include'],function(_0x36597c){return{'model':db[_0x36597c[_0x24ea('0x22')]],'as':_0x36597c['as'],'attributes':_0x36597c[_0x24ea('0x1e')],'include':_0x36597c[_0x24ea('0x20')]?_['map'](_0x36597c[_0x24ea('0x20')],function(_0x4fc1bd){return{'model':db[_0x4fc1bd[_0x24ea('0x22')]],'as':_0x4fc1bd['as'],'attributes':_0x4fc1bd[_0x24ea('0x1e')],'include':_0x4fc1bd['include']?_[_0x24ea('0x21')](_0x4fc1bd[_0x24ea('0x20')],function(_0x4f0283){return{'model':db[_0x4f0283[_0x24ea('0x22')]],'as':_0x4f0283['as'],'attributes':_0x4f0283[_0x24ea('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49da49){logger[_0x24ea('0x10')]('ShowFaxQueue',_0x563a88);logger[_0x24ea('0x13')](_0x24ea('0x25'),_0x563a88,JSON[_0x24ea('0x23')](_0x49da49));_0x2d4e03(_0x49da49);})['catch'](function(_0x1913f0){logger['error'](_0x24ea('0x25'),_0x1913f0[_0x24ea('0x15')],_0x563a88);_0x3dd38b(_0x25ac6f[_0x24ea('0x14')](0x1f4,_0x1913f0[_0x24ea('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d0dd70f..2f39ee2 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 _0x91f4=['emit','register','length','faxQueue:','./faxQueue.events','remove'];(function(_0x21b232,_0x1b9b77){var _0x54a541=function(_0x466d43){while(--_0x466d43){_0x21b232['push'](_0x21b232['shift']());}};_0x54a541(++_0x1b9b77);}(_0x91f4,0x10c));var _0x491f=function(_0x29f474,_0x24ebda){_0x29f474=_0x29f474-0x0;var _0x44644d=_0x91f4[_0x29f474];return _0x44644d;};'use strict';var FaxQueueEvents=require(_0x491f('0x0'));var events=['save',_0x491f('0x1'),'update'];function createListener(_0x3f59c,_0x4c92a){return function(_0x12e0d2){_0x4c92a[_0x491f('0x2')](_0x3f59c,_0x12e0d2);};}function removeListener(_0x40a2fa,_0x401756){return function(){FaxQueueEvents['removeListener'](_0x40a2fa,_0x401756);};}exports[_0x491f('0x3')]=function(_0x532ba2){for(var _0x5530bd=0x0,_0x1ff262=events[_0x491f('0x4')];_0x5530bd<_0x1ff262;_0x5530bd++){var _0x44e994=events[_0x5530bd];var _0x1aa593=createListener(_0x491f('0x5')+_0x44e994,_0x532ba2);FaxQueueEvents['on'](_0x44e994,_0x1aa593);}}; \ No newline at end of file +var _0xaea8=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x26e5a4,_0x24fba6){var _0x351321=function(_0x1a4b77){while(--_0x1a4b77){_0x26e5a4['push'](_0x26e5a4['shift']());}};_0x351321(++_0x24fba6);}(_0xaea8,0x101));var _0x8aea=function(_0x2e0046,_0x565867){_0x2e0046=_0x2e0046-0x0;var _0x22e85e=_0xaea8[_0x2e0046];return _0x22e85e;};'use strict';var FaxQueueEvents=require(_0x8aea('0x0'));var events=[_0x8aea('0x1'),_0x8aea('0x2'),_0x8aea('0x3')];function createListener(_0x4bf2c4,_0x48be6a){return function(_0x249d30){_0x48be6a[_0x8aea('0x4')](_0x4bf2c4,_0x249d30);};}function removeListener(_0x429fa3,_0x1ae7cf){return function(){FaxQueueEvents[_0x8aea('0x5')](_0x429fa3,_0x1ae7cf);};}exports[_0x8aea('0x6')]=function(_0x35be4f){for(var _0x14bcd7=0x0,_0x514220=events[_0x8aea('0x7')];_0x14bcd7<_0x514220;_0x14bcd7++){var _0x4f1b0a=events[_0x14bcd7];var _0x181484=createListener(_0x8aea('0x8')+_0x4f1b0a,_0x35be4f);FaxQueueEvents['on'](_0x4f1b0a,_0x181484);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 9837963..57c628b 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 _0x5e39=['getMembers','getTeams','/:id/users','post','create','/:id/teams','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members'];(function(_0x4dd1cd,_0x465758){var _0x309188=function(_0x10460c){while(--_0x10460c){_0x4dd1cd['push'](_0x4dd1cd['shift']());}};_0x309188(++_0x465758);}(_0x5e39,0xbb));var _0x95e3=function(_0x4aba2c,_0x1908cc){_0x4aba2c=_0x4aba2c-0x0;var _0x55a8e0=_0x5e39[_0x4aba2c];return _0x55a8e0;};'use strict';var multer=require(_0x95e3('0x0'));var util=require(_0x95e3('0x1'));var path=require(_0x95e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x95e3('0x3'));var router=express[_0x95e3('0x4')]();var fs_extra=require(_0x95e3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x95e3('0x6'));var config=require(_0x95e3('0x7'));var controller=require(_0x95e3('0x8'));router[_0x95e3('0x9')]('/',auth[_0x95e3('0xa')](),controller[_0x95e3('0xb')]);router[_0x95e3('0x9')](_0x95e3('0xc'),auth[_0x95e3('0xa')](),controller['describe']);router[_0x95e3('0x9')](_0x95e3('0xd'),auth[_0x95e3('0xa')](),controller[_0x95e3('0xe')]);router[_0x95e3('0x9')](_0x95e3('0xf'),auth['isAuthenticated'](),controller[_0x95e3('0x10')]);router['get']('/:id/teams',auth[_0x95e3('0xa')](),controller[_0x95e3('0x11')]);router['get'](_0x95e3('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x95e3('0x13')]('/',auth[_0x95e3('0xa')](),controller[_0x95e3('0x14')]);router['post'](_0x95e3('0x15'),auth[_0x95e3('0xa')](),controller['addTeams']);router[_0x95e3('0x13')]('/:id/users',auth[_0x95e3('0xa')](),controller['addAgents']);router[_0x95e3('0x16')](_0x95e3('0xd'),auth['isAuthenticated'](),controller[_0x95e3('0x17')]);router['delete'](_0x95e3('0xd'),auth['isAuthenticated'](),controller[_0x95e3('0x18')]);router[_0x95e3('0x19')]('/:id/teams',auth[_0x95e3('0xa')](),controller[_0x95e3('0x1a')]);router[_0x95e3('0x19')](_0x95e3('0x12'),auth[_0x95e3('0xa')](),controller[_0x95e3('0x1b')]);module[_0x95e3('0x1c')]=router; \ No newline at end of file +var _0x36e1=['getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update','delete','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x37710a,_0x5d53d1){var _0x2f6602=function(_0x5cecc6){while(--_0x5cecc6){_0x37710a['push'](_0x37710a['shift']());}};_0x2f6602(++_0x5d53d1);}(_0x36e1,0xae));var _0x136e=function(_0x962fc5,_0x58f074){_0x962fc5=_0x962fc5-0x0;var _0x43667c=_0x36e1[_0x962fc5];return _0x43667c;};'use strict';var multer=require(_0x136e('0x0'));var util=require(_0x136e('0x1'));var path=require(_0x136e('0x2'));var timeout=require('connect-timeout');var express=require(_0x136e('0x3'));var router=express[_0x136e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x136e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x136e('0x6'));var controller=require('./faxQueue.controller');router[_0x136e('0x7')]('/',auth[_0x136e('0x8')](),controller[_0x136e('0x9')]);router[_0x136e('0x7')](_0x136e('0xa'),auth['isAuthenticated'](),controller[_0x136e('0xb')]);router[_0x136e('0x7')](_0x136e('0xc'),auth[_0x136e('0x8')](),controller[_0x136e('0xd')]);router[_0x136e('0x7')](_0x136e('0xe'),auth[_0x136e('0x8')](),controller[_0x136e('0xf')]);router[_0x136e('0x7')](_0x136e('0x10'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x136e('0x11'),auth['isAuthenticated'](),controller[_0x136e('0x12')]);router[_0x136e('0x13')]('/',auth[_0x136e('0x8')](),controller[_0x136e('0x14')]);router[_0x136e('0x13')]('/:id/teams',auth[_0x136e('0x8')](),controller['addTeams']);router[_0x136e('0x13')]('/:id/users',auth[_0x136e('0x8')](),controller[_0x136e('0x15')]);router[_0x136e('0x16')](_0x136e('0xc'),auth[_0x136e('0x8')](),controller[_0x136e('0x17')]);router[_0x136e('0x18')]('/:id',auth[_0x136e('0x8')](),controller['destroy']);router[_0x136e('0x18')]('/:id/teams',auth[_0x136e('0x8')](),controller['removeTeams']);router['delete'](_0x136e('0x11'),auth[_0x136e('0x8')](),controller[_0x136e('0x19')]);module[_0x136e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index fd16051..3dfa232 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 _0x3fda=['STRING','DATE','moment','sequelize'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x3fda,0x10a));var _0xa3fd=function(_0x29c776,_0x32f050){_0x29c776=_0x29c776-0x0;var _0x21f00a=_0x3fda[_0x29c776];return _0x21f00a;};'use strict';var moment=require(_0xa3fd('0x0'));var Sequelize=require(_0xa3fd('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa3fd('0x2')]},'joinAt':{'type':Sequelize[_0xa3fd('0x3')]},'leaveAt':{'type':Sequelize[_0xa3fd('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa3fd('0x2')]}}; \ No newline at end of file +var _0x8177=['exports','STRING','DATE','moment','sequelize'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x8177,0x175));var _0x7817=function(_0x14eff2,_0x4cc49e){_0x14eff2=_0x14eff2-0x0;var _0x18258c=_0x8177[_0x14eff2];return _0x18258c;};'use strict';var moment=require(_0x7817('0x0'));var Sequelize=require(_0x7817('0x1'));module[_0x7817('0x2')]={'uniqueid':{'type':Sequelize[_0x7817('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7817('0x3')]},'joinAt':{'type':Sequelize[_0x7817('0x4')]},'leaveAt':{'type':Sequelize[_0x7817('0x4')]},'acceptAt':{'type':Sequelize[_0x7817('0x4')]},'exitAt':{'type':Sequelize[_0x7817('0x4')]},'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 3e82932..5c5379c 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 _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','create','update','body','describe','html-pdf'];(function(_0xa9328,_0x4763ea){var _0x5a2ec4=function(_0x5a9030){while(--_0x5a9030){_0xa9328['push'](_0xa9328['shift']());}};_0x5a2ec4(++_0x4763ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(!_0x4d00e6){_0x2fb0e4[_0x0a9e('0x23')](0x194);}return _0x4d00e6;};}function handleError(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0x1f4;return function(_0x5ea472){logger['error'](_0x5ea472[_0x0a9e('0x24')]);if(_0x5ea472[_0x0a9e('0x25')]){delete _0x5ea472[_0x0a9e('0x25')];}_0x42ac8f[_0x0a9e('0x16')](_0x16b1ca)['send'](_0x5ea472);};}exports[_0x0a9e('0x26')]=function(_0x479bc4,_0x45a1e7){var _0x5bfb33={},_0x1dc186={},_0x34dc65={'count':0x0,'rows':[]};var _0x25fba9=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x11c3b6){return{'name':_0x11c3b6[_0x0a9e('0x2a')],'type':_0x11c3b6['type'][_0x0a9e('0x2b')]};});_0x1dc186[_0x0a9e('0x2c')]=_[_0x0a9e('0x27')](_0x25fba9,_0x0a9e('0x25'));_0x1dc186['query']=_[_0x0a9e('0x2d')](_0x479bc4[_0x0a9e('0x2e')]);_0x1dc186[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],_0x1dc186[_0x0a9e('0x2e')]);_0x5bfb33[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],qs['fields'](_0x479bc4[_0x0a9e('0x2e')]['fields']));_0x5bfb33[_0x0a9e('0x31')]=_0x5bfb33[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x5bfb33[_0x0a9e('0x31')]:_0x1dc186[_0x0a9e('0x2c')];if(!_0x479bc4['query'][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x5bfb33[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x1a')]);_0x5bfb33[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x479bc4['query'][_0x0a9e('0x19')]);}_0x5bfb33['order']=qs[_0x0a9e('0x35')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x5bfb33[_0x0a9e('0x36')]=qs['filters'](_[_0x0a9e('0x37')](_0x479bc4[_0x0a9e('0x2e')],_0x1dc186[_0x0a9e('0x2f')]),_0x25fba9);if(_0x479bc4[_0x0a9e('0x2e')]['filter']){_0x5bfb33['where']=_[_0x0a9e('0x38')](_0x5bfb33['where'],{'$or':_[_0x0a9e('0x27')](_0x25fba9,function(_0x3d9717){if(_0x3d9717[_0x0a9e('0x39')]!==_0x0a9e('0x3a')){var _0x4f41ae={};_0x4f41ae[_0x3d9717[_0x0a9e('0x25')]]={'$like':'%'+_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3b')]+'%'};return _0x4f41ae;}})});}_0x5bfb33=_['merge']({},_0x5bfb33,_0x479bc4[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x5bfb33[_0x0a9e('0x36')]};return db['FaxQueueReport']['count'](_0x1a180b)[_0x0a9e('0x21')](function(_0x40d766){_0x34dc65['count']=_0x40d766;if(_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x5bfb33[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x28')]['findAll'](_0x5bfb33);})['then'](function(_0x15e37d){_0x34dc65[_0x0a9e('0x3f')]=_0x15e37d;return _0x34dc65;})['then'](respondWithFilteredResult(_0x45a1e7,_0x5bfb33))[_0x0a9e('0x40')](handleError(_0x45a1e7,null));};exports[_0x0a9e('0x41')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x42')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2cfea9[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1459bb[_0x0a9e('0x2e')]);_0x2cfea9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x2cfea9[_0x0a9e('0x2c')],_0x2cfea9[_0x0a9e('0x2e')]);_0x316c8f[_0x0a9e('0x31')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x43')](_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x316c8f[_0x0a9e('0x31')]=_0x316c8f[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x316c8f[_0x0a9e('0x31')]:_0x2cfea9[_0x0a9e('0x2c')];if(_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x316c8f[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x38')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x28')][_0x0a9e('0x44')](_0x316c8f)[_0x0a9e('0x21')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x21')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x40')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x45')]=function(_0x21eb86,_0x44dd99){return db['FaxQueueReport'][_0x0a9e('0x45')](_0x21eb86['body'],{})[_0x0a9e('0x21')](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x40')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){if(_0x562fb4[_0x0a9e('0x47')]['id']){delete _0x562fb4[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x44')]({'where':{'id':_0x562fb4[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x14bec2,null))['then'](saveUpdates(_0x562fb4[_0x0a9e('0x47')],null))[_0x0a9e('0x21')](respondWithResult(_0x14bec2,null))[_0x0a9e('0x40')](handleError(_0x14bec2,null));};exports[_0x0a9e('0x22')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x28')][_0x0a9e('0x44')]({'where':{'id':_0x409789[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x21')](removeEntity(_0x992c77,null))[_0x0a9e('0x40')](handleError(_0x992c77,null));};exports['describe']=function(_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x28')][_0x0a9e('0x48')]()[_0x0a9e('0x21')](respondWithResult(_0x5ddf84,null))[_0x0a9e('0x40')](handleError(_0x5ddf84,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','create','update','body','describe','html-pdf'];(function(_0x145598,_0x38f1b8){var _0x5068a7=function(_0x9efea4){while(--_0x9efea4){_0x145598['push'](_0x145598['shift']());}};_0x5068a7(++_0x38f1b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(!_0x4d00e6){_0x2fb0e4[_0x0a9e('0x23')](0x194);}return _0x4d00e6;};}function handleError(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0x1f4;return function(_0x5ea472){logger['error'](_0x5ea472[_0x0a9e('0x24')]);if(_0x5ea472[_0x0a9e('0x25')]){delete _0x5ea472[_0x0a9e('0x25')];}_0x42ac8f[_0x0a9e('0x16')](_0x16b1ca)['send'](_0x5ea472);};}exports[_0x0a9e('0x26')]=function(_0x479bc4,_0x45a1e7){var _0x5bfb33={},_0x1dc186={},_0x34dc65={'count':0x0,'rows':[]};var _0x25fba9=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x11c3b6){return{'name':_0x11c3b6[_0x0a9e('0x2a')],'type':_0x11c3b6['type'][_0x0a9e('0x2b')]};});_0x1dc186[_0x0a9e('0x2c')]=_[_0x0a9e('0x27')](_0x25fba9,_0x0a9e('0x25'));_0x1dc186['query']=_[_0x0a9e('0x2d')](_0x479bc4[_0x0a9e('0x2e')]);_0x1dc186[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],_0x1dc186[_0x0a9e('0x2e')]);_0x5bfb33[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],qs['fields'](_0x479bc4[_0x0a9e('0x2e')]['fields']));_0x5bfb33[_0x0a9e('0x31')]=_0x5bfb33[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x5bfb33[_0x0a9e('0x31')]:_0x1dc186[_0x0a9e('0x2c')];if(!_0x479bc4['query'][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x5bfb33[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x1a')]);_0x5bfb33[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x479bc4['query'][_0x0a9e('0x19')]);}_0x5bfb33['order']=qs[_0x0a9e('0x35')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x5bfb33[_0x0a9e('0x36')]=qs['filters'](_[_0x0a9e('0x37')](_0x479bc4[_0x0a9e('0x2e')],_0x1dc186[_0x0a9e('0x2f')]),_0x25fba9);if(_0x479bc4[_0x0a9e('0x2e')]['filter']){_0x5bfb33['where']=_[_0x0a9e('0x38')](_0x5bfb33['where'],{'$or':_[_0x0a9e('0x27')](_0x25fba9,function(_0x3d9717){if(_0x3d9717[_0x0a9e('0x39')]!==_0x0a9e('0x3a')){var _0x4f41ae={};_0x4f41ae[_0x3d9717[_0x0a9e('0x25')]]={'$like':'%'+_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3b')]+'%'};return _0x4f41ae;}})});}_0x5bfb33=_['merge']({},_0x5bfb33,_0x479bc4[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x5bfb33[_0x0a9e('0x36')]};return db['FaxQueueReport']['count'](_0x1a180b)[_0x0a9e('0x21')](function(_0x40d766){_0x34dc65['count']=_0x40d766;if(_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x5bfb33[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x28')]['findAll'](_0x5bfb33);})['then'](function(_0x15e37d){_0x34dc65[_0x0a9e('0x3f')]=_0x15e37d;return _0x34dc65;})['then'](respondWithFilteredResult(_0x45a1e7,_0x5bfb33))[_0x0a9e('0x40')](handleError(_0x45a1e7,null));};exports[_0x0a9e('0x41')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x42')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2cfea9[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1459bb[_0x0a9e('0x2e')]);_0x2cfea9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x2cfea9[_0x0a9e('0x2c')],_0x2cfea9[_0x0a9e('0x2e')]);_0x316c8f[_0x0a9e('0x31')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x43')](_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x316c8f[_0x0a9e('0x31')]=_0x316c8f[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x316c8f[_0x0a9e('0x31')]:_0x2cfea9[_0x0a9e('0x2c')];if(_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x316c8f[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x38')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x28')][_0x0a9e('0x44')](_0x316c8f)[_0x0a9e('0x21')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x21')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x40')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x45')]=function(_0x21eb86,_0x44dd99){return db['FaxQueueReport'][_0x0a9e('0x45')](_0x21eb86['body'],{})[_0x0a9e('0x21')](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x40')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){if(_0x562fb4[_0x0a9e('0x47')]['id']){delete _0x562fb4[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x44')]({'where':{'id':_0x562fb4[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x14bec2,null))['then'](saveUpdates(_0x562fb4[_0x0a9e('0x47')],null))[_0x0a9e('0x21')](respondWithResult(_0x14bec2,null))[_0x0a9e('0x40')](handleError(_0x14bec2,null));};exports[_0x0a9e('0x22')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x28')][_0x0a9e('0x44')]({'where':{'id':_0x409789[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x21')](removeEntity(_0x992c77,null))[_0x0a9e('0x40')](handleError(_0x992c77,null));};exports['describe']=function(_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x28')][_0x0a9e('0x48')]()[_0x0a9e('0x21')](respondWithResult(_0x5ddf84,null))[_0x0a9e('0x40')](handleError(_0x5ddf84,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c293d42..2ca0f6a 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 _0x4637=['../../config/environment','exports','define','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x5af3d8,_0x41e4e2){var _0x45eb31=function(_0x4fc0de){while(--_0x4fc0de){_0x5af3d8['push'](_0x5af3d8['shift']());}};_0x45eb31(++_0x41e4e2);}(_0x4637,0xe0));var _0x7463=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4637[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7463('0x0'));var util=require('util');var logger=require(_0x7463('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7463('0x2'));var rp=require(_0x7463('0x3'));var fs=require('fs');var path=require(_0x7463('0x4'));var rimraf=require(_0x7463('0x5'));var config=require(_0x7463('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0x7463('0x7')]=function(_0xab1e72,_0x56ab3b){return _0xab1e72[_0x7463('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x7463('0x9'),'fields':[_0x7463('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf47e=['define','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports'];(function(_0xe41584,_0x39da42){var _0x448220=function(_0x497ae3){while(--_0x497ae3){_0xe41584['push'](_0xe41584['shift']());}};_0x448220(++_0x39da42);}(_0xf47e,0x1e2));var _0xef47=function(_0x381ebc,_0x395cff){_0x381ebc=_0x381ebc-0x0;var _0x185962=_0xf47e[_0x381ebc];return _0x185962;};'use strict';var _=require(_0xef47('0x0'));var util=require('util');var logger=require(_0xef47('0x1'))(_0xef47('0x2'));var moment=require('moment');var BPromise=require(_0xef47('0x3'));var rp=require(_0xef47('0x4'));var fs=require('fs');var path=require(_0xef47('0x5'));var rimraf=require(_0xef47('0x6'));var config=require(_0xef47('0x7'));var attributes=require(_0xef47('0x8'));module[_0xef47('0x9')]=function(_0x36dd24,_0x382bf4){return _0x36dd24[_0xef47('0xa')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xef47('0xb'),'fields':[_0xef47('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1452930..0787ca8 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 _0x2e5c=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport','update','attributes','limit','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2e5c,0x9c));var _0xc2e5=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x2e5c[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0xc2e5('0x0'));var moment=require('moment');var BPromise=require(_0xc2e5('0x1'));var rs=require(_0xc2e5('0x2'));var fs=require('fs');var Redis=require(_0xc2e5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc2e5('0x4'))(_0xc2e5('0x5'));var config=require(_0xc2e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc2e5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x247c4e,_0x585d1d,_0x41530a){return new BPromise(function(_0x5c8fbf,_0x3c2ffa){return client['request'](_0x247c4e,_0x41530a)[_0xc2e5('0x8')](function(_0x521d37){logger[_0xc2e5('0x9')](_0xc2e5('0xa'),_0x585d1d,_0xc2e5('0xb'));logger[_0xc2e5('0xc')](_0xc2e5('0xd'),_0x585d1d,_0xc2e5('0xb'),JSON[_0xc2e5('0xe')](_0x521d37));if(_0x521d37[_0xc2e5('0xf')]){if(_0x521d37[_0xc2e5('0xf')]['code']===0x1f4){logger[_0xc2e5('0xf')](_0xc2e5('0xa'),_0x585d1d,_0x521d37['error'][_0xc2e5('0x10')]);return _0x3c2ffa(_0x521d37[_0xc2e5('0xf')]['message']);}logger['error'](_0xc2e5('0xa'),_0x585d1d,_0x521d37[_0xc2e5('0xf')][_0xc2e5('0x10')]);return _0x5c8fbf(_0x521d37[_0xc2e5('0xf')][_0xc2e5('0x10')]);}else{logger[_0xc2e5('0x9')](_0xc2e5('0xa'),_0x585d1d,_0xc2e5('0xb'));_0x5c8fbf(_0x521d37[_0xc2e5('0x11')][_0xc2e5('0x10')]);}})[_0xc2e5('0x12')](function(_0x16fdba){logger[_0xc2e5('0xf')](_0xc2e5('0xa'),_0x585d1d,_0x16fdba);_0x3c2ffa(_0x16fdba);});});}exports[_0xc2e5('0x13')]=function(_0x1cc2fb){var _0x4b786a=this;return new Promise(function(_0xfc45c9,_0x3d3d3c){return db[_0xc2e5('0x14')][_0xc2e5('0x15')](_0x1cc2fb[_0xc2e5('0x16')],{'raw':_0x1cc2fb[_0xc2e5('0x17')]?_0x1cc2fb[_0xc2e5('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc2e5('0x8')](function(_0x458b76){logger[_0xc2e5('0x9')](_0xc2e5('0x13'),_0x1cc2fb);logger[_0xc2e5('0xc')](_0xc2e5('0x13'),_0x1cc2fb,JSON[_0xc2e5('0xe')](_0x458b76));_0xfc45c9(_0x458b76);})[_0xc2e5('0x12')](function(_0x24d7ff){logger[_0xc2e5('0xf')](_0xc2e5('0x13'),_0x24d7ff[_0xc2e5('0x10')],_0x1cc2fb);_0x3d3d3c(_0x4b786a['error'](0x1f4,_0x24d7ff['message']));});});};exports[_0xc2e5('0x18')]=function(_0x1423d5){var _0x4b0bea=this;return new Promise(function(_0x29cec8,_0x5dfdf4){return db['FaxQueueReport'][_0xc2e5('0x19')](_0x1423d5[_0xc2e5('0x16')],{'raw':_0x1423d5[_0xc2e5('0x17')]?_0x1423d5[_0xc2e5('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1423d5[_0xc2e5('0x17')]?_0x1423d5['options']['where']||null:null,'attributes':_0x1423d5[_0xc2e5('0x17')]?_0x1423d5[_0xc2e5('0x17')][_0xc2e5('0x1a')]||null:null,'limit':_0x1423d5[_0xc2e5('0x17')]?_0x1423d5[_0xc2e5('0x17')][_0xc2e5('0x1b')]||null:null})[_0xc2e5('0x8')](function(_0x3cf8cf){logger['info'](_0xc2e5('0x18'),_0x1423d5);logger[_0xc2e5('0xc')](_0xc2e5('0x18'),_0x1423d5,JSON[_0xc2e5('0xe')](_0x3cf8cf));_0x29cec8(_0x3cf8cf);})['catch'](function(_0x6fdc3b){logger[_0xc2e5('0xf')](_0xc2e5('0x18'),_0x6fdc3b[_0xc2e5('0x10')],_0x1423d5);_0x5dfdf4(_0x4b0bea[_0xc2e5('0xf')](0x1f4,_0x6fdc3b['message']));});});}; \ No newline at end of file +var _0x5d39=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x5d39,0x177));var _0x95d3=function(_0x228d8d,_0x126fab){_0x228d8d=_0x228d8d-0x0;var _0x41320d=_0x5d39[_0x228d8d];return _0x41320d;};'use strict';var _=require(_0x95d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x95d3('0x1'));var rs=require(_0x95d3('0x2'));var fs=require('fs');var Redis=require(_0x95d3('0x3'));var db=require(_0x95d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x95d3('0x5'));var config=require('../../config/environment');var jayson=require(_0x95d3('0x6'));var client=jayson[_0x95d3('0x7')][_0x95d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x491530,_0x301bf5,_0x2f559f){return new BPromise(function(_0x204e61,_0x4fbb4c){return client[_0x95d3('0x9')](_0x491530,_0x2f559f)[_0x95d3('0xa')](function(_0x44f184){logger[_0x95d3('0xb')](_0x95d3('0xc'),_0x301bf5,_0x95d3('0xd'));logger[_0x95d3('0xe')](_0x95d3('0xf'),_0x301bf5,'request\x20sent',JSON[_0x95d3('0x10')](_0x44f184));if(_0x44f184[_0x95d3('0x11')]){if(_0x44f184[_0x95d3('0x11')][_0x95d3('0x12')]===0x1f4){logger[_0x95d3('0x11')](_0x95d3('0xc'),_0x301bf5,_0x44f184['error'][_0x95d3('0x13')]);return _0x4fbb4c(_0x44f184[_0x95d3('0x11')][_0x95d3('0x13')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x301bf5,_0x44f184['error'][_0x95d3('0x13')]);return _0x204e61(_0x44f184[_0x95d3('0x11')][_0x95d3('0x13')]);}else{logger[_0x95d3('0xb')](_0x95d3('0xc'),_0x301bf5,'request\x20sent');_0x204e61(_0x44f184['result'][_0x95d3('0x13')]);}})[_0x95d3('0x14')](function(_0x3dac4f){logger[_0x95d3('0x11')](_0x95d3('0xc'),_0x301bf5,_0x3dac4f);_0x4fbb4c(_0x3dac4f);});});}exports[_0x95d3('0x15')]=function(_0x3c89bf){var _0x534711=this;return new Promise(function(_0x548430,_0xee0021){return db[_0x95d3('0x16')][_0x95d3('0x17')](_0x3c89bf[_0x95d3('0x18')],{'raw':_0x3c89bf[_0x95d3('0x19')]?_0x3c89bf[_0x95d3('0x19')][_0x95d3('0x1a')]===undefined?!![]:![]:!![]})[_0x95d3('0xa')](function(_0x1b1aaa){logger['info'](_0x95d3('0x15'),_0x3c89bf);logger[_0x95d3('0xe')](_0x95d3('0x15'),_0x3c89bf,JSON[_0x95d3('0x10')](_0x1b1aaa));_0x548430(_0x1b1aaa);})[_0x95d3('0x14')](function(_0x3bd51f){logger['error'](_0x95d3('0x15'),_0x3bd51f[_0x95d3('0x13')],_0x3c89bf);_0xee0021(_0x534711[_0x95d3('0x11')](0x1f4,_0x3bd51f['message']));});});};exports[_0x95d3('0x1b')]=function(_0x1da063){var _0x485253=this;return new Promise(function(_0x444937,_0x557dd0){return db[_0x95d3('0x16')]['update'](_0x1da063[_0x95d3('0x18')],{'raw':_0x1da063['options']?_0x1da063['options'][_0x95d3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1da063[_0x95d3('0x19')]?_0x1da063[_0x95d3('0x19')]['where']||null:null,'attributes':_0x1da063[_0x95d3('0x19')]?_0x1da063[_0x95d3('0x19')][_0x95d3('0x1c')]||null:null,'limit':_0x1da063['options']?_0x1da063[_0x95d3('0x19')][_0x95d3('0x1d')]||null:null})[_0x95d3('0xa')](function(_0x3385b7){logger[_0x95d3('0xb')]('UpdateFaxQueueReport',_0x1da063);logger[_0x95d3('0xe')](_0x95d3('0x1b'),_0x1da063,JSON[_0x95d3('0x10')](_0x3385b7));_0x444937(_0x3385b7);})[_0x95d3('0x14')](function(_0x36b1f6){logger[_0x95d3('0x11')](_0x95d3('0x1b'),_0x36b1f6[_0x95d3('0x13')],_0x1da063);_0x557dd0(_0x485253[_0x95d3('0x11')](0x1f4,_0x36b1f6[_0x95d3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bc03b1f..3b3f1bf 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 _0xa01c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','delete','exports'];(function(_0x1b561c,_0x345281){var _0xdd501f=function(_0x4464de){while(--_0x4464de){_0x1b561c['push'](_0x1b561c['shift']());}};_0xdd501f(++_0x345281);}(_0xa01c,0x1c8));var _0xca01=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa01c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xca01('0x0'));var path=require(_0xca01('0x1'));var timeout=require(_0xca01('0x2'));var express=require(_0xca01('0x3'));var router=express[_0xca01('0x4')]();var fs_extra=require(_0xca01('0x5'));var auth=require(_0xca01('0x6'));var interaction=require(_0xca01('0x7'));var config=require(_0xca01('0x8'));var controller=require(_0xca01('0x9'));router[_0xca01('0xa')]('/',auth[_0xca01('0xb')](),controller[_0xca01('0xc')]);router[_0xca01('0xa')]('/describe',auth[_0xca01('0xb')](),controller['describe']);router[_0xca01('0xa')](_0xca01('0xd'),auth['isAuthenticated'](),controller[_0xca01('0xe')]);router[_0xca01('0xf')]('/',auth[_0xca01('0xb')](),controller[_0xca01('0x10')]);router['put'](_0xca01('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xca01('0x11')]('/:id',auth[_0xca01('0xb')](),controller['destroy']);module[_0xca01('0x12')]=router; \ No newline at end of file +var _0x938f=['show','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x43fc93,_0xce1b66){var _0xe1dce2=function(_0x198e82){while(--_0x198e82){_0x43fc93['push'](_0x43fc93['shift']());}};_0xe1dce2(++_0xce1b66);}(_0x938f,0xc1));var _0xf938=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0x938f[_0x3b16e1];return _0x311d1b;};'use strict';var multer=require(_0xf938('0x0'));var util=require(_0xf938('0x1'));var path=require(_0xf938('0x2'));var timeout=require(_0xf938('0x3'));var express=require(_0xf938('0x4'));var router=express[_0xf938('0x5')]();var fs_extra=require(_0xf938('0x6'));var auth=require(_0xf938('0x7'));var interaction=require(_0xf938('0x8'));var config=require('../../config/environment');var controller=require(_0xf938('0x9'));router[_0xf938('0xa')]('/',auth[_0xf938('0xb')](),controller[_0xf938('0xc')]);router[_0xf938('0xa')](_0xf938('0xd'),auth[_0xf938('0xb')](),controller[_0xf938('0xe')]);router['get'](_0xf938('0xf'),auth[_0xf938('0xb')](),controller[_0xf938('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xf938('0xb')](),controller['update']);router[_0xf938('0x11')](_0xf938('0xf'),auth[_0xf938('0xb')](),controller[_0xf938('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a1bacaa..2b31d1b 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 _0x6034=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x1180a3,_0x3e53ea){var _0x20b93d=function(_0x324bfa){while(--_0x324bfa){_0x1180a3['push'](_0x1180a3['shift']());}};_0x20b93d(++_0x3e53ea);}(_0x6034,0x179));var _0x4603=function(_0x383122,_0x40d045){_0x383122=_0x383122-0x0;var _0x3d48c5=_0x6034[_0x383122];return _0x3d48c5;};'use strict';var moment=require(_0x4603('0x0'));var Sequelize=require('sequelize');module[_0x4603('0x1')]={'uniqueid':{'type':Sequelize[_0x4603('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4603('0x3')](_0x4603('0x4'),_0x4603('0x5'),_0x4603('0x6')),'allowNull':![],'defaultValue':_0x4603('0x6')},'transferredAt':{'type':Sequelize[_0x4603('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x4603('0x8')]}}; \ No newline at end of file +var _0x9454=['STRING','ENUM','account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3b81eb,_0x175f32){var _0x149491=function(_0x454753){while(--_0x454753){_0x3b81eb['push'](_0x3b81eb['shift']());}};_0x149491(++_0x175f32);}(_0x9454,0x16e));var _0x4945=function(_0x59f394,_0x502a6c){_0x59f394=_0x59f394-0x0;var _0x102393=_0x9454[_0x59f394];return _0x102393;};'use strict';var moment=require(_0x4945('0x0'));var Sequelize=require(_0x4945('0x1'));module[_0x4945('0x2')]={'uniqueid':{'type':Sequelize[_0x4945('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4945('0x4')](_0x4945('0x5'),'agent',_0x4945('0x6')),'allowNull':![],'defaultValue':_0x4945('0x6')},'transferredAt':{'type':Sequelize[_0x4945('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x4945('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 61a89ff..8a1850d 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 _0xba4e=['merge','VIRTUAL','includeAll','findAll','rows','catch','include','options','find','create','body','params','describe','html-pdf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where'];(function(_0x1606c4,_0x15c7bd){var _0x33f6a1=function(_0x33b6c9){while(--_0x33b6c9){_0x1606c4['push'](_0x1606c4['shift']());}};_0x33f6a1(++_0x15c7bd);}(_0xba4e,0x99));var _0xeba4=function(_0x322652,_0x5a85c0){_0x322652=_0x322652-0x0;var _0x5d5e88=_0xba4e[_0x322652];return _0x5d5e88;};'use strict';var pdf=require(_0xeba4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeba4('0x1'));var rp=require('request-promise');var moment=require(_0xeba4('0x2'));var BPromise=require(_0xeba4('0x3'));var Mustache=require('mustache');var util=require(_0xeba4('0x4'));var path=require(_0xeba4('0x5'));var sox=require('sox');var csv=require(_0xeba4('0x6'));var ejs=require(_0xeba4('0x7'));var fs=require('fs');var fs_extra=require(_0xeba4('0x8'));var _=require(_0xeba4('0x9'));var squel=require(_0xeba4('0xa'));var crypto=require(_0xeba4('0xb'));var jsforce=require(_0xeba4('0xc'));var deskjs=require(_0xeba4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeba4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeba4('0xf'));var qs=require(_0xeba4('0x10'));var as=require(_0xeba4('0x11'));var hardwareService=require(_0xeba4('0x12'));var logger=require(_0xeba4('0x13'))(_0xeba4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeba4('0x15'));var db=require(_0xeba4('0x16'))['db'];function respondWithStatusCode(_0x2eabcd,_0x4f5d91){_0x4f5d91=_0x4f5d91||0xcc;return function(_0x497d08){if(_0x497d08){return _0x2eabcd['sendStatus'](_0x4f5d91);}return _0x2eabcd[_0xeba4('0x17')](_0x4f5d91)[_0xeba4('0x18')]();};}function respondWithResult(_0x16d886,_0xc2b80a){_0xc2b80a=_0xc2b80a||0xc8;return function(_0x148f72){if(_0x148f72){return _0x16d886[_0xeba4('0x17')](_0xc2b80a)['json'](_0x148f72);}};}function respondWithFilteredResult(_0x41eb2c,_0xea09b7){return function(_0x37ee6d){if(_0x37ee6d){var _0x2de09e=_0x37ee6d[_0xeba4('0x19')],_0x1a3485=_0xea09b7[_0xeba4('0x1a')],_0x5380e8=_0xea09b7[_0xeba4('0x1a')]+_0xea09b7[_0xeba4('0x1b')],_0x550436;if(_0x5380e8>=_0x2de09e){_0x5380e8=_0x2de09e;_0x550436=0xc8;}else{_0x550436=0xce;}_0x41eb2c['status'](_0x550436);return _0x41eb2c[_0xeba4('0x1c')](_0xeba4('0x1d'),_0x1a3485+'-'+_0x5380e8+'/'+_0x2de09e)[_0xeba4('0x1e')](_0x37ee6d);}return null;};}function patchUpdates(_0x226816){return function(_0x119fa9){try{jsonpatch[_0xeba4('0x1f')](_0x119fa9,_0x226816,!![]);}catch(_0x21d3a2){return BPromise[_0xeba4('0x20')](_0x21d3a2);}return _0x119fa9[_0xeba4('0x21')]();};}function saveUpdates(_0x5d96f2,_0x145e53){return function(_0x517a71){if(_0x517a71){return _0x517a71[_0xeba4('0x22')](_0x5d96f2)[_0xeba4('0x23')](function(_0x1ee67a){return _0x1ee67a;});}return null;};}function removeEntity(_0x41e16a,_0x57a283){return function(_0x17cd74){if(_0x17cd74){return _0x17cd74[_0xeba4('0x24')]()[_0xeba4('0x23')](function(){_0x41e16a[_0xeba4('0x17')](0xcc)[_0xeba4('0x18')]();});}};}function handleEntityNotFound(_0x52e2a4,_0x119fb5){return function(_0x4151a3){if(!_0x4151a3){_0x52e2a4[_0xeba4('0x25')](0x194);}return _0x4151a3;};}function handleError(_0x22a99e,_0x3b6e8d){_0x3b6e8d=_0x3b6e8d||0x1f4;return function(_0x3c17aa){logger[_0xeba4('0x26')](_0x3c17aa['stack']);if(_0x3c17aa[_0xeba4('0x27')]){delete _0x3c17aa[_0xeba4('0x27')];}_0x22a99e[_0xeba4('0x17')](_0x3b6e8d)['send'](_0x3c17aa);};}exports[_0xeba4('0x28')]=function(_0x42c480,_0x1e05ff){var _0x5a6ad2={},_0x33a9c8={},_0x2263b2={'count':0x0,'rows':[]};var _0x591c1b=_[_0xeba4('0x29')](db[_0xeba4('0x2a')][_0xeba4('0x2b')],function(_0x3b53f2){return{'name':_0x3b53f2[_0xeba4('0x2c')],'type':_0x3b53f2[_0xeba4('0x2d')]['key']};});_0x33a9c8['model']=_[_0xeba4('0x29')](_0x591c1b,'name');_0x33a9c8[_0xeba4('0x2e')]=_[_0xeba4('0x2f')](_0x42c480[_0xeba4('0x2e')]);_0x33a9c8[_0xeba4('0x30')]=_[_0xeba4('0x31')](_0x33a9c8['model'],_0x33a9c8['query']);_0x5a6ad2[_0xeba4('0x32')]=_['intersection'](_0x33a9c8[_0xeba4('0x33')],qs[_0xeba4('0x34')](_0x42c480[_0xeba4('0x2e')][_0xeba4('0x34')]));_0x5a6ad2[_0xeba4('0x32')]=_0x5a6ad2['attributes'][_0xeba4('0x35')]?_0x5a6ad2[_0xeba4('0x32')]:_0x33a9c8[_0xeba4('0x33')];if(!_0x42c480[_0xeba4('0x2e')][_0xeba4('0x36')]('nolimit')){_0x5a6ad2['limit']=qs[_0xeba4('0x1b')](_0x42c480[_0xeba4('0x2e')][_0xeba4('0x1b')]);_0x5a6ad2['offset']=qs[_0xeba4('0x1a')](_0x42c480[_0xeba4('0x2e')][_0xeba4('0x1a')]);}_0x5a6ad2['order']=qs[_0xeba4('0x37')](_0x42c480[_0xeba4('0x2e')][_0xeba4('0x37')]);_0x5a6ad2[_0xeba4('0x38')]=qs[_0xeba4('0x30')](_['pick'](_0x42c480[_0xeba4('0x2e')],_0x33a9c8[_0xeba4('0x30')]),_0x591c1b);if(_0x42c480[_0xeba4('0x2e')]['filter']){_0x5a6ad2[_0xeba4('0x38')]=_[_0xeba4('0x39')](_0x5a6ad2[_0xeba4('0x38')],{'$or':_['map'](_0x591c1b,function(_0x277d2d){if(_0x277d2d['type']!==_0xeba4('0x3a')){var _0x4a6063={};_0x4a6063[_0x277d2d['name']]={'$like':'%'+_0x42c480[_0xeba4('0x2e')]['filter']+'%'};return _0x4a6063;}})});}_0x5a6ad2=_[_0xeba4('0x39')]({},_0x5a6ad2,_0x42c480['options']);var _0x3dd5f2={'where':_0x5a6ad2[_0xeba4('0x38')]};return db[_0xeba4('0x2a')][_0xeba4('0x19')](_0x3dd5f2)[_0xeba4('0x23')](function(_0x2e198e){_0x2263b2[_0xeba4('0x19')]=_0x2e198e;if(_0x42c480[_0xeba4('0x2e')][_0xeba4('0x3b')]){_0x5a6ad2['include']=[{'all':!![]}];}return db[_0xeba4('0x2a')][_0xeba4('0x3c')](_0x5a6ad2);})[_0xeba4('0x23')](function(_0x1e7231){_0x2263b2[_0xeba4('0x3d')]=_0x1e7231;return _0x2263b2;})[_0xeba4('0x23')](respondWithFilteredResult(_0x1e05ff,_0x5a6ad2))[_0xeba4('0x3e')](handleError(_0x1e05ff,null));};exports['show']=function(_0x5861e5,_0x102e73){var _0x593868={'raw':!![],'where':{'id':_0x5861e5['params']['id']}},_0x3aeefe={};_0x3aeefe['model']=_['keys'](db['FaxTransferReport'][_0xeba4('0x2b')]);_0x3aeefe[_0xeba4('0x2e')]=_[_0xeba4('0x2f')](_0x5861e5[_0xeba4('0x2e')]);_0x3aeefe[_0xeba4('0x30')]=_[_0xeba4('0x31')](_0x3aeefe[_0xeba4('0x33')],_0x3aeefe[_0xeba4('0x2e')]);_0x593868[_0xeba4('0x32')]=_[_0xeba4('0x31')](_0x3aeefe[_0xeba4('0x33')],qs[_0xeba4('0x34')](_0x5861e5[_0xeba4('0x2e')][_0xeba4('0x34')]));_0x593868['attributes']=_0x593868[_0xeba4('0x32')][_0xeba4('0x35')]?_0x593868['attributes']:_0x3aeefe[_0xeba4('0x33')];if(_0x5861e5[_0xeba4('0x2e')][_0xeba4('0x3b')]){_0x593868[_0xeba4('0x3f')]=[{'all':!![]}];}_0x593868=_['merge']({},_0x593868,_0x5861e5[_0xeba4('0x40')]);return db[_0xeba4('0x2a')][_0xeba4('0x41')](_0x593868)[_0xeba4('0x23')](handleEntityNotFound(_0x102e73,null))[_0xeba4('0x23')](respondWithResult(_0x102e73,null))[_0xeba4('0x3e')](handleError(_0x102e73,null));};exports['create']=function(_0x1f8686,_0x3e58df){return db[_0xeba4('0x2a')][_0xeba4('0x42')](_0x1f8686[_0xeba4('0x43')],{})[_0xeba4('0x23')](respondWithResult(_0x3e58df,0xc9))[_0xeba4('0x3e')](handleError(_0x3e58df,null));};exports[_0xeba4('0x22')]=function(_0x102819,_0x4785e6){if(_0x102819['body']['id']){delete _0x102819[_0xeba4('0x43')]['id'];}return db[_0xeba4('0x2a')]['find']({'where':{'id':_0x102819[_0xeba4('0x44')]['id']}})[_0xeba4('0x23')](handleEntityNotFound(_0x4785e6,null))[_0xeba4('0x23')](saveUpdates(_0x102819[_0xeba4('0x43')],null))[_0xeba4('0x23')](respondWithResult(_0x4785e6,null))[_0xeba4('0x3e')](handleError(_0x4785e6,null));};exports[_0xeba4('0x24')]=function(_0x467e13,_0x278c8b){return db['FaxTransferReport']['find']({'where':{'id':_0x467e13['params']['id']}})[_0xeba4('0x23')](handleEntityNotFound(_0x278c8b,null))['then'](removeEntity(_0x278c8b,null))['catch'](handleError(_0x278c8b,null));};exports[_0xeba4('0x45')]=function(_0x17e08e,_0x14abf1){return db[_0xeba4('0x2a')][_0xeba4('0x45')]()['then'](respondWithResult(_0x14abf1,null))['catch'](handleError(_0x14abf1,null));}; \ No newline at end of file +var _0x2a84=['findAll','rows','find','create','body','params','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','options','FaxTransferReport','includeAll','include'];(function(_0x2b57fc,_0x4b3658){var _0x5bf238=function(_0x21661a){while(--_0x21661a){_0x2b57fc['push'](_0x2b57fc['shift']());}};_0x5bf238(++_0x4b3658);}(_0x2a84,0x94));var _0x42a8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2a84[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x42a8('0x0'));var emlformat=require(_0x42a8('0x1'));var rimraf=require(_0x42a8('0x2'));var zipdir=require(_0x42a8('0x3'));var jsonpatch=require(_0x42a8('0x4'));var rp=require(_0x42a8('0x5'));var moment=require(_0x42a8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x42a8('0x7'));var util=require('util');var path=require(_0x42a8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x42a8('0x9'));var fs=require('fs');var fs_extra=require(_0x42a8('0xa'));var _=require(_0x42a8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42a8('0xc'));var deskjs=require(_0x42a8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x42a8('0xe'));var Papa=require(_0x42a8('0xf'));var Redis=require(_0x42a8('0x10'));var authService=require(_0x42a8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x42a8('0x12'));var hardwareService=require(_0x42a8('0x13'));var logger=require(_0x42a8('0x14'))('api');var utils=require(_0x42a8('0x15'));var config=require(_0x42a8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42a8('0x17'))['db'];function respondWithStatusCode(_0x126ae3,_0x4154bf){_0x4154bf=_0x4154bf||0xcc;return function(_0x19e6fc){if(_0x19e6fc){return _0x126ae3[_0x42a8('0x18')](_0x4154bf);}return _0x126ae3[_0x42a8('0x19')](_0x4154bf)['end']();};}function respondWithResult(_0x2fac58,_0x5e2944){_0x5e2944=_0x5e2944||0xc8;return function(_0x14b499){if(_0x14b499){return _0x2fac58[_0x42a8('0x19')](_0x5e2944)[_0x42a8('0x1a')](_0x14b499);}};}function respondWithFilteredResult(_0x42da64,_0x2b7736){return function(_0x4cd793){if(_0x4cd793){var _0x40cf29=_0x4cd793[_0x42a8('0x1b')],_0x2786de=_0x2b7736[_0x42a8('0x1c')],_0x4027fa=_0x2b7736[_0x42a8('0x1c')]+_0x2b7736[_0x42a8('0x1d')],_0x19ab74;if(_0x4027fa>=_0x40cf29){_0x4027fa=_0x40cf29;_0x19ab74=0xc8;}else{_0x19ab74=0xce;}_0x42da64[_0x42a8('0x19')](_0x19ab74);return _0x42da64['set'](_0x42a8('0x1e'),_0x2786de+'-'+_0x4027fa+'/'+_0x40cf29)[_0x42a8('0x1a')](_0x4cd793);}return null;};}function patchUpdates(_0x1979df){return function(_0x1c1268){try{jsonpatch[_0x42a8('0x1f')](_0x1c1268,_0x1979df,!![]);}catch(_0x172cf3){return BPromise['reject'](_0x172cf3);}return _0x1c1268['save']();};}function saveUpdates(_0xefabfd,_0x29d637){return function(_0x2a4880){if(_0x2a4880){return _0x2a4880[_0x42a8('0x20')](_0xefabfd)[_0x42a8('0x21')](function(_0x5310bf){return _0x5310bf;});}return null;};}function removeEntity(_0x117114,_0x3b48b7){return function(_0x44c1f7){if(_0x44c1f7){return _0x44c1f7[_0x42a8('0x22')]()['then'](function(){_0x117114['status'](0xcc)[_0x42a8('0x23')]();});}};}function handleEntityNotFound(_0xe82f0f,_0x3447cc){return function(_0xd203a0){if(!_0xd203a0){_0xe82f0f[_0x42a8('0x18')](0x194);}return _0xd203a0;};}function handleError(_0x4de3ca,_0x232ca2){_0x232ca2=_0x232ca2||0x1f4;return function(_0x92da2){logger['error'](_0x92da2[_0x42a8('0x24')]);if(_0x92da2[_0x42a8('0x25')]){delete _0x92da2[_0x42a8('0x25')];}_0x4de3ca[_0x42a8('0x19')](_0x232ca2)['send'](_0x92da2);};}exports[_0x42a8('0x26')]=function(_0x235930,_0x304646){var _0x4889d7={},_0x2611f8={},_0x23651b={'count':0x0,'rows':[]};var _0x20e7ca=_[_0x42a8('0x27')](db['FaxTransferReport'][_0x42a8('0x28')],function(_0x19a113){return{'name':_0x19a113[_0x42a8('0x29')],'type':_0x19a113[_0x42a8('0x2a')][_0x42a8('0x2b')]};});_0x2611f8[_0x42a8('0x2c')]=_[_0x42a8('0x27')](_0x20e7ca,_0x42a8('0x25'));_0x2611f8[_0x42a8('0x2d')]=_[_0x42a8('0x2e')](_0x235930['query']);_0x2611f8[_0x42a8('0x2f')]=_['intersection'](_0x2611f8[_0x42a8('0x2c')],_0x2611f8['query']);_0x4889d7['attributes']=_[_0x42a8('0x30')](_0x2611f8[_0x42a8('0x2c')],qs[_0x42a8('0x31')](_0x235930[_0x42a8('0x2d')]['fields']));_0x4889d7['attributes']=_0x4889d7[_0x42a8('0x32')][_0x42a8('0x33')]?_0x4889d7[_0x42a8('0x32')]:_0x2611f8[_0x42a8('0x2c')];if(!_0x235930['query'][_0x42a8('0x34')]('nolimit')){_0x4889d7[_0x42a8('0x1d')]=qs[_0x42a8('0x1d')](_0x235930[_0x42a8('0x2d')][_0x42a8('0x1d')]);_0x4889d7['offset']=qs[_0x42a8('0x1c')](_0x235930['query'][_0x42a8('0x1c')]);}_0x4889d7[_0x42a8('0x35')]=qs[_0x42a8('0x36')](_0x235930['query'][_0x42a8('0x36')]);_0x4889d7['where']=qs[_0x42a8('0x2f')](_[_0x42a8('0x37')](_0x235930[_0x42a8('0x2d')],_0x2611f8[_0x42a8('0x2f')]),_0x20e7ca);if(_0x235930[_0x42a8('0x2d')]['filter']){_0x4889d7[_0x42a8('0x38')]=_[_0x42a8('0x39')](_0x4889d7[_0x42a8('0x38')],{'$or':_[_0x42a8('0x27')](_0x20e7ca,function(_0x3bfa71){if(_0x3bfa71[_0x42a8('0x2a')]!=='VIRTUAL'){var _0x273e82={};_0x273e82[_0x3bfa71[_0x42a8('0x25')]]={'$like':'%'+_0x235930[_0x42a8('0x2d')]['filter']+'%'};return _0x273e82;}})});}_0x4889d7=_[_0x42a8('0x39')]({},_0x4889d7,_0x235930[_0x42a8('0x3a')]);var _0x1fd051={'where':_0x4889d7[_0x42a8('0x38')]};return db[_0x42a8('0x3b')]['count'](_0x1fd051)['then'](function(_0x5e0a21){_0x23651b[_0x42a8('0x1b')]=_0x5e0a21;if(_0x235930[_0x42a8('0x2d')][_0x42a8('0x3c')]){_0x4889d7[_0x42a8('0x3d')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x42a8('0x3e')](_0x4889d7);})[_0x42a8('0x21')](function(_0x4f5ecb){_0x23651b[_0x42a8('0x3f')]=_0x4f5ecb;return _0x23651b;})[_0x42a8('0x21')](respondWithFilteredResult(_0x304646,_0x4889d7))['catch'](handleError(_0x304646,null));};exports['show']=function(_0x406243,_0x1cba24){var _0x4c47cc={'raw':!![],'where':{'id':_0x406243['params']['id']}},_0x157425={};_0x157425[_0x42a8('0x2c')]=_[_0x42a8('0x2e')](db[_0x42a8('0x3b')]['rawAttributes']);_0x157425[_0x42a8('0x2d')]=_['keys'](_0x406243['query']);_0x157425['filters']=_[_0x42a8('0x30')](_0x157425[_0x42a8('0x2c')],_0x157425['query']);_0x4c47cc[_0x42a8('0x32')]=_[_0x42a8('0x30')](_0x157425['model'],qs[_0x42a8('0x31')](_0x406243[_0x42a8('0x2d')][_0x42a8('0x31')]));_0x4c47cc[_0x42a8('0x32')]=_0x4c47cc[_0x42a8('0x32')][_0x42a8('0x33')]?_0x4c47cc['attributes']:_0x157425[_0x42a8('0x2c')];if(_0x406243[_0x42a8('0x2d')][_0x42a8('0x3c')]){_0x4c47cc[_0x42a8('0x3d')]=[{'all':!![]}];}_0x4c47cc=_[_0x42a8('0x39')]({},_0x4c47cc,_0x406243[_0x42a8('0x3a')]);return db['FaxTransferReport'][_0x42a8('0x40')](_0x4c47cc)[_0x42a8('0x21')](handleEntityNotFound(_0x1cba24,null))[_0x42a8('0x21')](respondWithResult(_0x1cba24,null))['catch'](handleError(_0x1cba24,null));};exports[_0x42a8('0x41')]=function(_0x53725c,_0x1b64b9){return db['FaxTransferReport'][_0x42a8('0x41')](_0x53725c[_0x42a8('0x42')],{})['then'](respondWithResult(_0x1b64b9,0xc9))['catch'](handleError(_0x1b64b9,null));};exports['update']=function(_0x6f1a8f,_0x3d6bc2){if(_0x6f1a8f[_0x42a8('0x42')]['id']){delete _0x6f1a8f[_0x42a8('0x42')]['id'];}return db[_0x42a8('0x3b')][_0x42a8('0x40')]({'where':{'id':_0x6f1a8f[_0x42a8('0x43')]['id']}})[_0x42a8('0x21')](handleEntityNotFound(_0x3d6bc2,null))[_0x42a8('0x21')](saveUpdates(_0x6f1a8f[_0x42a8('0x42')],null))[_0x42a8('0x21')](respondWithResult(_0x3d6bc2,null))[_0x42a8('0x44')](handleError(_0x3d6bc2,null));};exports[_0x42a8('0x22')]=function(_0x27aa90,_0x43dab9){return db['FaxTransferReport'][_0x42a8('0x40')]({'where':{'id':_0x27aa90['params']['id']}})[_0x42a8('0x21')](handleEntityNotFound(_0x43dab9,null))[_0x42a8('0x21')](removeEntity(_0x43dab9,null))['catch'](handleError(_0x43dab9,null));};exports[_0x42a8('0x45')]=function(_0x2d94a5,_0x93196f){return db[_0x42a8('0x3b')]['describe']()[_0x42a8('0x21')](respondWithResult(_0x93196f,null))[_0x42a8('0x44')](handleError(_0x93196f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ff3c3c8..146244c 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 _0xbfec=['bluebird','request-promise','rimraf','exports','uniqueid','util','../../config/logger','api','moment'];(function(_0x428d55,_0x4e5e47){var _0x4ba5fc=function(_0x216dcd){while(--_0x216dcd){_0x428d55['push'](_0x428d55['shift']());}};_0x4ba5fc(++_0x4e5e47);}(_0xbfec,0x83));var _0xcbfe=function(_0x42bebc,_0x3db09a){_0x42bebc=_0x42bebc-0x0;var _0x300b45=_0xbfec[_0x42bebc];return _0x300b45;};'use strict';var _=require('lodash');var util=require(_0xcbfe('0x0'));var logger=require(_0xcbfe('0x1'))(_0xcbfe('0x2'));var moment=require(_0xcbfe('0x3'));var BPromise=require(_0xcbfe('0x4'));var rp=require(_0xcbfe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbfe('0x6'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xcbfe('0x7')]=function(_0x2b8f97,_0x4d1cae){return _0x2b8f97['define']('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xcbfe('0x8'),'fields':[_0xcbfe('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1464=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x1a8b43,_0x562667){var _0x527470=function(_0x48da8d){while(--_0x48da8d){_0x1a8b43['push'](_0x1a8b43['shift']());}};_0x527470(++_0x562667);}(_0x1464,0x1a2));var _0x4146=function(_0x377f32,_0x2b032c){_0x377f32=_0x377f32-0x0;var _0x43a1b0=_0x1464[_0x377f32];return _0x43a1b0;};'use strict';var _=require(_0x4146('0x0'));var util=require(_0x4146('0x1'));var logger=require(_0x4146('0x2'))(_0x4146('0x3'));var moment=require(_0x4146('0x4'));var BPromise=require('bluebird');var rp=require(_0x4146('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4146('0x6'));var config=require(_0x4146('0x7'));var attributes=require(_0x4146('0x8'));module['exports']=function(_0x3b1adc,_0x455014){return _0x3b1adc[_0x4146('0x9')](_0x4146('0xa'),attributes,{'tableName':_0x4146('0xb'),'paranoid':![],'indexes':[{'name':_0x4146('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 477d91d..18659af 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 _0x7dca=['debug','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x59e29d,_0x4e6e5e){var _0x57eb67=function(_0x4b17cb){while(--_0x4b17cb){_0x59e29d['push'](_0x59e29d['shift']());}};_0x57eb67(++_0x4e6e5e);}(_0x7dca,0xc2));var _0xa7dc=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x7dca[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require(_0xa7dc('0x0'));var moment=require(_0xa7dc('0x1'));var BPromise=require(_0xa7dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7dc('0x3'));var db=require(_0xa7dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7dc('0x5'))(_0xa7dc('0x6'));var config=require(_0xa7dc('0x7'));var jayson=require(_0xa7dc('0x8'));var client=jayson[_0xa7dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x157487,_0x10cd6c,_0x3602b7){return new BPromise(function(_0x19df70,_0x4640fb){return client[_0xa7dc('0xa')](_0x157487,_0x3602b7)[_0xa7dc('0xb')](function(_0x54b964){logger[_0xa7dc('0xc')](_0xa7dc('0xd'),_0x10cd6c,_0xa7dc('0xe'));logger[_0xa7dc('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x10cd6c,_0xa7dc('0xe'),JSON['stringify'](_0x54b964));if(_0x54b964[_0xa7dc('0x10')]){if(_0x54b964['error']['code']===0x1f4){logger[_0xa7dc('0x10')](_0xa7dc('0xd'),_0x10cd6c,_0x54b964[_0xa7dc('0x10')][_0xa7dc('0x11')]);return _0x4640fb(_0x54b964['error'][_0xa7dc('0x11')]);}logger[_0xa7dc('0x10')](_0xa7dc('0xd'),_0x10cd6c,_0x54b964['error'][_0xa7dc('0x11')]);return _0x19df70(_0x54b964['error']['message']);}else{logger[_0xa7dc('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x10cd6c,_0xa7dc('0xe'));_0x19df70(_0x54b964['result']['message']);}})[_0xa7dc('0x12')](function(_0x5534c3){logger[_0xa7dc('0x10')](_0xa7dc('0xd'),_0x10cd6c,_0x5534c3);_0x4640fb(_0x5534c3);});});} \ No newline at end of file +var _0x5a0e=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','debug','request\x20sent','error','FaxTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x5a0e,0x1a4));var _0xe5a0=function(_0x9b678a,_0x2c797e){_0x9b678a=_0x9b678a-0x0;var _0x28fca4=_0x5a0e[_0x9b678a];return _0x28fca4;};'use strict';var _=require(_0xe5a0('0x0'));var util=require(_0xe5a0('0x1'));var moment=require(_0xe5a0('0x2'));var BPromise=require(_0xe5a0('0x3'));var rs=require(_0xe5a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5a0('0x5'))['db'];var utils=require(_0xe5a0('0x6'));var logger=require('../../config/logger')(_0xe5a0('0x7'));var config=require(_0xe5a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe5a0('0x9')][_0xe5a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5342d5,_0x4a6a09,_0x571485){return new BPromise(function(_0x352fe7,_0x292b67){return client['request'](_0x5342d5,_0x571485)[_0xe5a0('0xb')](function(_0x487ab3){logger[_0xe5a0('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x4a6a09,'request\x20sent');logger[_0xe5a0('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x4a6a09,_0xe5a0('0xe'),JSON['stringify'](_0x487ab3));if(_0x487ab3[_0xe5a0('0xf')]){if(_0x487ab3['error']['code']===0x1f4){logger['error'](_0xe5a0('0x10'),_0x4a6a09,_0x487ab3['error'][_0xe5a0('0x11')]);return _0x292b67(_0x487ab3['error']['message']);}logger[_0xe5a0('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x4a6a09,_0x487ab3[_0xe5a0('0xf')][_0xe5a0('0x11')]);return _0x352fe7(_0x487ab3[_0xe5a0('0xf')][_0xe5a0('0x11')]);}else{logger['info'](_0xe5a0('0x10'),_0x4a6a09,_0xe5a0('0xe'));_0x352fe7(_0x487ab3[_0xe5a0('0x12')][_0xe5a0('0x11')]);}})[_0xe5a0('0x13')](function(_0x54d3ab){logger[_0xe5a0('0xf')](_0xe5a0('0x10'),_0x4a6a09,_0x54d3ab);_0x292b67(_0x54d3ab);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 405ac13..f682502 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 _0x372a=['get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x42fa87,_0x380b14){var _0x5aa33d=function(_0x3eab42){while(--_0x3eab42){_0x42fa87['push'](_0x42fa87['shift']());}};_0x5aa33d(++_0x380b14);}(_0x372a,0x1ef));var _0xa372=function(_0x26a855,_0x845170){_0x26a855=_0x26a855-0x0;var _0x301785=_0x372a[_0x26a855];return _0x301785;};'use strict';var multer=require(_0xa372('0x0'));var util=require(_0xa372('0x1'));var path=require('path');var timeout=require(_0xa372('0x2'));var express=require(_0xa372('0x3'));var router=express[_0xa372('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa372('0x5'));var interaction=require(_0xa372('0x6'));var config=require(_0xa372('0x7'));var controller=require(_0xa372('0x8'));router[_0xa372('0x9')]('/',auth[_0xa372('0xa')](),controller[_0xa372('0xb')]);router[_0xa372('0x9')](_0xa372('0xc'),auth[_0xa372('0xa')](),controller[_0xa372('0xd')]);router['get'](_0xa372('0xe'),auth[_0xa372('0xa')](),controller[_0xa372('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa372('0x10')](_0xa372('0xe'),auth['isAuthenticated'](),controller[_0xa372('0x11')]);router[_0xa372('0x12')]('/:id',auth[_0xa372('0xa')](),controller[_0xa372('0x13')]);module[_0xa372('0x14')]=router; \ No newline at end of file +var _0xdbdb=['update','delete','exports','multer','util','path','express','Router','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','create'];(function(_0x148297,_0x53329d){var _0xc23496=function(_0x39d163){while(--_0x39d163){_0x148297['push'](_0x148297['shift']());}};_0xc23496(++_0x53329d);}(_0xdbdb,0x18a));var _0xbdbd=function(_0x3ed1c1,_0x45fe0a){_0x3ed1c1=_0x3ed1c1-0x0;var _0x11797d=_0xdbdb[_0x3ed1c1];return _0x11797d;};'use strict';var multer=require(_0xbdbd('0x0'));var util=require(_0xbdbd('0x1'));var path=require(_0xbdbd('0x2'));var timeout=require('connect-timeout');var express=require(_0xbdbd('0x3'));var router=express[_0xbdbd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbdbd('0x5'));var controller=require(_0xbdbd('0x6'));router['get']('/',auth[_0xbdbd('0x7')](),controller[_0xbdbd('0x8')]);router[_0xbdbd('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xbdbd('0xa')]);router[_0xbdbd('0x9')](_0xbdbd('0xb'),auth[_0xbdbd('0x7')](),controller[_0xbdbd('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbdbd('0xd')]);router['put'](_0xbdbd('0xb'),auth['isAuthenticated'](),controller[_0xbdbd('0xe')]);router[_0xbdbd('0xf')](_0xbdbd('0xb'),auth[_0xbdbd('0x7')](),controller['destroy']);module[_0xbdbd('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7174afd..b9dd31d 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 _0x7f99=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x365f0a,_0x580420){var _0x1f40e7=function(_0x4fc439){while(--_0x4fc439){_0x365f0a['push'](_0x365f0a['shift']());}};_0x1f40e7(++_0x580420);}(_0x7f99,0x16f));var _0x97f9=function(_0x13e789,_0x5ede49){_0x13e789=_0x13e789-0x0;var _0x21f62e=_0x7f99[_0x13e789];return _0x21f62e;};'use strict';var multer=require('multer');var util=require(_0x97f9('0x0'));var path=require(_0x97f9('0x1'));var timeout=require('connect-timeout');var express=require(_0x97f9('0x2'));var router=express[_0x97f9('0x3')]();var fs_extra=require(_0x97f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x97f9('0x5'));var config=require(_0x97f9('0x6'));var controller=require(_0x97f9('0x7'));router[_0x97f9('0x8')]('/',auth[_0x97f9('0x9')](),controller[_0x97f9('0xa')]);router[_0x97f9('0x8')]('/:id',auth[_0x97f9('0x9')](),controller[_0x97f9('0xb')]);router['get'](_0x97f9('0xc'),auth[_0x97f9('0x9')](),controller[_0x97f9('0xd')]);router[_0x97f9('0x8')](_0x97f9('0xe'),auth[_0x97f9('0x9')](),controller[_0x97f9('0xf')]);router[_0x97f9('0x10')]('/',auth[_0x97f9('0x9')](),controller[_0x97f9('0x11')]);router['post']('/:id/configurations',auth[_0x97f9('0x9')](),controller[_0x97f9('0x12')]);router[_0x97f9('0x13')](_0x97f9('0x14'),auth['isAuthenticated'](),controller[_0x97f9('0x15')]);router[_0x97f9('0x16')](_0x97f9('0x14'),auth[_0x97f9('0x9')](),controller[_0x97f9('0x17')]);module[_0x97f9('0x18')]=router; \ No newline at end of file +var _0x9163=['index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5f2a03,_0xfa8c73){var _0x5e36b4=function(_0x30ce91){while(--_0x30ce91){_0x5f2a03['push'](_0x5f2a03['shift']());}};_0x5e36b4(++_0xfa8c73);}(_0x9163,0x17d));var _0x3916=function(_0x38aa55,_0x527d35){_0x38aa55=_0x38aa55-0x0;var _0x4e951f=_0x9163[_0x38aa55];return _0x4e951f;};'use strict';var multer=require(_0x3916('0x0'));var util=require(_0x3916('0x1'));var path=require(_0x3916('0x2'));var timeout=require('connect-timeout');var express=require(_0x3916('0x3'));var router=express[_0x3916('0x4')]();var fs_extra=require(_0x3916('0x5'));var auth=require(_0x3916('0x6'));var interaction=require(_0x3916('0x7'));var config=require(_0x3916('0x8'));var controller=require('./intDeskAccount.controller');router[_0x3916('0x9')]('/',auth['isAuthenticated'](),controller[_0x3916('0xa')]);router[_0x3916('0x9')](_0x3916('0xb'),auth[_0x3916('0xc')](),controller[_0x3916('0xd')]);router[_0x3916('0x9')]('/:id/configurations',auth[_0x3916('0xc')](),controller[_0x3916('0xe')]);router[_0x3916('0x9')](_0x3916('0xf'),auth[_0x3916('0xc')](),controller['getFields']);router['post']('/',auth[_0x3916('0xc')](),controller[_0x3916('0x10')]);router['post'](_0x3916('0x11'),auth[_0x3916('0xc')](),controller[_0x3916('0x12')]);router[_0x3916('0x13')](_0x3916('0xb'),auth[_0x3916('0xc')](),controller['update']);router[_0x3916('0x14')](_0x3916('0xb'),auth[_0x3916('0xc')](),controller[_0x3916('0x15')]);module[_0x3916('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 6c0bf11..feb8001 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 _0xd844=['integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xd844,0x6d));var _0x4d84=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd844[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x4d84('0x0'));module[_0x4d84('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4d84('0x2')]},'username':{'type':Sequelize[_0x4d84('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x4d84('0x3')),'defaultValue':_0x4d84('0x3')},'password':{'type':Sequelize[_0x4d84('0x2')]},'consumerKey':{'type':Sequelize[_0x4d84('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4d84('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4d84('0x4')]('integrationTab','newTab'),'defaultValue':_0x4d84('0x5')}}; \ No newline at end of file +var _0xa3db=['integrationTab','newTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x518e15,_0x568735){var _0x3bd658=function(_0x6a579f){while(--_0x6a579f){_0x518e15['push'](_0x518e15['shift']());}};_0x3bd658(++_0x568735);}(_0xa3db,0x10c));var _0xba3d=function(_0x5b52a0,_0x2f9a9d){_0x5b52a0=_0x5b52a0-0x0;var _0x34b1e5=_0xa3db[_0x5b52a0];return _0x34b1e5;};'use strict';var Sequelize=require(_0xba3d('0x0'));module[_0xba3d('0x1')]={'name':{'type':Sequelize[_0xba3d('0x2')]},'description':{'type':Sequelize[_0xba3d('0x2')]},'username':{'type':Sequelize[_0xba3d('0x2')]},'remoteUri':{'type':Sequelize[_0xba3d('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0xba3d('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xba3d('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xba3d('0x2')]},'tokenSecret':{'type':Sequelize[_0xba3d('0x2')]},'serverUrl':{'type':Sequelize[_0xba3d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xba3d('0x4')](_0xba3d('0x5'),_0xba3d('0x6')),'defaultValue':_0xba3d('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f7a9f34..7e9ec07 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 _0xcd3a=['apply','reject','save','update','destroy','stack','name','status','send','index','map','DeskAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','active','label','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','count','offset','limit','set','Content-Range'];(function(_0x25ece4,_0x57b764){var _0x1e1e80=function(_0x363fd4){while(--_0x363fd4){_0x25ece4['push'](_0x25ece4['shift']());}};_0x1e1e80(++_0x57b764);}(_0xcd3a,0xcf));var _0xacd3=function(_0x537323,_0x330a6a){_0x537323=_0x537323-0x0;var _0x784009=_0xcd3a[_0x537323];return _0x784009;};'use strict';var pdf=require(_0xacd3('0x0'));var emlformat=require(_0xacd3('0x1'));var rimraf=require(_0xacd3('0x2'));var zipdir=require(_0xacd3('0x3'));var jsonpatch=require(_0xacd3('0x4'));var rp=require(_0xacd3('0x5'));var moment=require(_0xacd3('0x6'));var BPromise=require(_0xacd3('0x7'));var Mustache=require('mustache');var util=require(_0xacd3('0x8'));var path=require(_0xacd3('0x9'));var sox=require(_0xacd3('0xa'));var csv=require(_0xacd3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacd3('0xc'));var squel=require(_0xacd3('0xd'));var crypto=require(_0xacd3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xacd3('0xf'));var toCsv=require(_0xacd3('0xb'));var querystring=require(_0xacd3('0x10'));var Papa=require(_0xacd3('0x11'));var Redis=require('ioredis');var authService=require(_0xacd3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xacd3('0x13'));var hardwareService=require(_0xacd3('0x14'));var logger=require(_0xacd3('0x15'))(_0xacd3('0x16'));var utils=require('../../config/utils');var config=require(_0xacd3('0x17'));var licenseUtil=require(_0xacd3('0x18'));var db=require(_0xacd3('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xacd3('0x1a')][_0xacd3('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4eda89,_0x202692,_0x5b3112,_0x50a9d6){return new BPromise(function(_0x28d657,_0x16cc8f){var _0x4c9e01=_0x50a9d6||client;return _0x4c9e01[_0xacd3('0x1c')](_0x4eda89,_0x5b3112)[_0xacd3('0x1d')](function(_0x3689f5){logger['info'](_0xacd3('0x1e'),_0x202692,_0xacd3('0x1f'));logger['debug'](_0xacd3('0x20'),_0x202692,_0xacd3('0x1f'),JSON[_0xacd3('0x21')](_0x3689f5));if(_0x3689f5[_0xacd3('0x22')]){if(_0x3689f5[_0xacd3('0x22')][_0xacd3('0x23')]===0x1f4){logger[_0xacd3('0x22')](_0xacd3('0x1e'),_0x202692,_0x3689f5['error']['message']);return _0x16cc8f(_0x3689f5[_0xacd3('0x22')][_0xacd3('0x24')]);}logger[_0xacd3('0x22')](_0xacd3('0x1e'),_0x202692,_0x3689f5[_0xacd3('0x22')]['message']);return _0x28d657(_0x3689f5[_0xacd3('0x22')][_0xacd3('0x24')]);}else{logger[_0xacd3('0x25')](_0xacd3('0x1e'),_0x202692,'request\x20sent');_0x28d657(_0x3689f5[_0xacd3('0x26')][_0xacd3('0x24')]);}})[_0xacd3('0x27')](function(_0x1defd3){logger[_0xacd3('0x22')](_0xacd3('0x1e'),_0x202692,_0x1defd3);_0x16cc8f(_0x1defd3);});});}function respondWithStatusCode(_0x46cacc,_0x167929){_0x167929=_0x167929||0xcc;return function(_0x3b406d){if(_0x3b406d){return _0x46cacc[_0xacd3('0x28')](_0x167929);}return _0x46cacc['status'](_0x167929)[_0xacd3('0x29')]();};}function respondWithResult(_0x4d4797,_0xa94642){_0xa94642=_0xa94642||0xc8;return function(_0x5d43ad){if(_0x5d43ad){return _0x4d4797['status'](_0xa94642)['json'](_0x5d43ad);}};}function respondWithFilteredResult(_0x5ab55c,_0x476995){return function(_0x54da10){if(_0x54da10){var _0x2731a3=_0x54da10[_0xacd3('0x2a')],_0xd46aee=_0x476995[_0xacd3('0x2b')],_0x1400f0=_0x476995[_0xacd3('0x2b')]+_0x476995[_0xacd3('0x2c')],_0x3aa816;if(_0x1400f0>=_0x2731a3){_0x1400f0=_0x2731a3;_0x3aa816=0xc8;}else{_0x3aa816=0xce;}_0x5ab55c['status'](_0x3aa816);return _0x5ab55c[_0xacd3('0x2d')](_0xacd3('0x2e'),_0xd46aee+'-'+_0x1400f0+'/'+_0x2731a3)['json'](_0x54da10);}return null;};}function patchUpdates(_0x2fab38){return function(_0x191a96){try{jsonpatch[_0xacd3('0x2f')](_0x191a96,_0x2fab38,!![]);}catch(_0x1b3dc2){return BPromise[_0xacd3('0x30')](_0x1b3dc2);}return _0x191a96[_0xacd3('0x31')]();};}function saveUpdates(_0x229d8e,_0x4dd8f3){return function(_0x3d782e){if(_0x3d782e){return _0x3d782e[_0xacd3('0x32')](_0x229d8e)['then'](function(_0x360d0c){return _0x360d0c;});}return null;};}function removeEntity(_0x52f648,_0x1c72c9){return function(_0x2dd835){if(_0x2dd835){return _0x2dd835[_0xacd3('0x33')]()[_0xacd3('0x1d')](function(){_0x52f648['status'](0xcc)[_0xacd3('0x29')]();});}};}function handleEntityNotFound(_0x2cfc25,_0xd453cf){return function(_0x41f0b6){if(!_0x41f0b6){_0x2cfc25[_0xacd3('0x28')](0x194);}return _0x41f0b6;};}function handleError(_0x517087,_0x3b732a){_0x3b732a=_0x3b732a||0x1f4;return function(_0x3e68cd){logger[_0xacd3('0x22')](_0x3e68cd[_0xacd3('0x34')]);if(_0x3e68cd[_0xacd3('0x35')]){delete _0x3e68cd[_0xacd3('0x35')];}_0x517087[_0xacd3('0x36')](_0x3b732a)[_0xacd3('0x37')](_0x3e68cd);};}exports[_0xacd3('0x38')]=function(_0x72f256,_0x17d2d0){var _0x553ee6={},_0x22dffc={},_0x205768={'count':0x0,'rows':[]};var _0x361581=_[_0xacd3('0x39')](db[_0xacd3('0x3a')]['rawAttributes'],function(_0xf69d1a){return{'name':_0xf69d1a[_0xacd3('0x3b')],'type':_0xf69d1a[_0xacd3('0x3c')][_0xacd3('0x3d')]};});_0x22dffc[_0xacd3('0x3e')]=_['map'](_0x361581,_0xacd3('0x35'));_0x22dffc[_0xacd3('0x3f')]=_['keys'](_0x72f256['query']);_0x22dffc[_0xacd3('0x40')]=_[_0xacd3('0x41')](_0x22dffc['model'],_0x22dffc['query']);_0x553ee6['attributes']=_[_0xacd3('0x41')](_0x22dffc['model'],qs[_0xacd3('0x42')](_0x72f256[_0xacd3('0x3f')][_0xacd3('0x42')]));_0x553ee6['attributes']=_0x553ee6[_0xacd3('0x43')]['length']?_0x553ee6[_0xacd3('0x43')]:_0x22dffc['model'];if(!_0x72f256[_0xacd3('0x3f')][_0xacd3('0x44')](_0xacd3('0x45'))){_0x553ee6[_0xacd3('0x2c')]=qs[_0xacd3('0x2c')](_0x72f256[_0xacd3('0x3f')][_0xacd3('0x2c')]);_0x553ee6['offset']=qs['offset'](_0x72f256[_0xacd3('0x3f')][_0xacd3('0x2b')]);}_0x553ee6[_0xacd3('0x46')]=qs[_0xacd3('0x47')](_0x72f256[_0xacd3('0x3f')]['sort']);_0x553ee6[_0xacd3('0x48')]=qs[_0xacd3('0x40')](_['pick'](_0x72f256['query'],_0x22dffc[_0xacd3('0x40')]),_0x361581);if(_0x72f256[_0xacd3('0x3f')][_0xacd3('0x49')]){_0x553ee6['where']=_[_0xacd3('0x4a')](_0x553ee6[_0xacd3('0x48')],{'$or':_[_0xacd3('0x39')](_0x361581,function(_0x300dbc){if(_0x300dbc[_0xacd3('0x3c')]!==_0xacd3('0x4b')){var _0x5eb65d={};_0x5eb65d[_0x300dbc['name']]={'$like':'%'+_0x72f256[_0xacd3('0x3f')]['filter']+'%'};return _0x5eb65d;}})});}_0x553ee6=_[_0xacd3('0x4a')]({},_0x553ee6,_0x72f256[_0xacd3('0x4c')]);var _0x3c898e={'where':_0x553ee6[_0xacd3('0x48')]};return db['DeskAccount'][_0xacd3('0x2a')](_0x3c898e)[_0xacd3('0x1d')](function(_0x1e684d){_0x205768[_0xacd3('0x2a')]=_0x1e684d;if(_0x72f256[_0xacd3('0x3f')][_0xacd3('0x4d')]){_0x553ee6[_0xacd3('0x4e')]=[{'all':!![]}];}return db['DeskAccount'][_0xacd3('0x4f')](_0x553ee6);})[_0xacd3('0x1d')](function(_0x4da12a){_0x205768[_0xacd3('0x50')]=_0x4da12a;return _0x205768;})[_0xacd3('0x1d')](respondWithFilteredResult(_0x17d2d0,_0x553ee6))[_0xacd3('0x27')](handleError(_0x17d2d0,null));};exports[_0xacd3('0x51')]=function(_0x295489,_0x2dfcf1){var _0x2a3632={'raw':![],'where':{'id':_0x295489[_0xacd3('0x52')]['id']}},_0x45445a={};_0x45445a[_0xacd3('0x3e')]=_[_0xacd3('0x53')](db[_0xacd3('0x3a')][_0xacd3('0x54')]);_0x45445a[_0xacd3('0x3f')]=_[_0xacd3('0x53')](_0x295489[_0xacd3('0x3f')]);_0x45445a[_0xacd3('0x40')]=_[_0xacd3('0x41')](_0x45445a[_0xacd3('0x3e')],_0x45445a[_0xacd3('0x3f')]);_0x2a3632[_0xacd3('0x43')]=_['intersection'](_0x45445a[_0xacd3('0x3e')],qs[_0xacd3('0x42')](_0x295489[_0xacd3('0x3f')]['fields']));_0x2a3632[_0xacd3('0x43')]=_0x2a3632[_0xacd3('0x43')][_0xacd3('0x55')]?_0x2a3632[_0xacd3('0x43')]:_0x45445a[_0xacd3('0x3e')];if(_0x295489[_0xacd3('0x3f')][_0xacd3('0x4d')]){_0x2a3632[_0xacd3('0x4e')]=[{'all':!![]}];}_0x2a3632=_[_0xacd3('0x4a')]({},_0x2a3632,_0x295489['options']);return db['DeskAccount'][_0xacd3('0x56')](_0x2a3632)[_0xacd3('0x1d')](handleEntityNotFound(_0x2dfcf1,null))['then'](respondWithResult(_0x2dfcf1,null))[_0xacd3('0x27')](handleError(_0x2dfcf1,null));};exports[_0xacd3('0x57')]=function(_0x373094,_0x3996f0){return db[_0xacd3('0x3a')][_0xacd3('0x57')](_0x373094[_0xacd3('0x58')],{})[_0xacd3('0x1d')](respondWithResult(_0x3996f0,0xc9))['catch'](handleError(_0x3996f0,null));};exports[_0xacd3('0x32')]=function(_0x5382dd,_0x4629ff){if(_0x5382dd[_0xacd3('0x58')]['id']){delete _0x5382dd['body']['id'];}return db[_0xacd3('0x3a')]['find']({'where':{'id':_0x5382dd[_0xacd3('0x52')]['id']}})[_0xacd3('0x1d')](handleEntityNotFound(_0x4629ff,null))[_0xacd3('0x1d')](saveUpdates(_0x5382dd[_0xacd3('0x58')],null))[_0xacd3('0x1d')](respondWithResult(_0x4629ff,null))[_0xacd3('0x27')](handleError(_0x4629ff,null));};exports[_0xacd3('0x33')]=function(_0xa09450,_0x4a8cd4){return db[_0xacd3('0x3a')][_0xacd3('0x56')]({'where':{'id':_0xa09450[_0xacd3('0x52')]['id']}})[_0xacd3('0x1d')](handleEntityNotFound(_0x4a8cd4,null))[_0xacd3('0x1d')](removeEntity(_0x4a8cd4,null))[_0xacd3('0x27')](handleError(_0x4a8cd4,null));};exports[_0xacd3('0x59')]=function(_0x787e69,_0xa8b0f9,_0x2c6101){var _0x5bc4a9={};var _0x346a00={};var _0x2c6357;var _0x425163;return db[_0xacd3('0x3a')][_0xacd3('0x5a')]({'where':{'id':_0x787e69[_0xacd3('0x52')]['id']}})['then'](handleEntityNotFound(_0xa8b0f9,null))[_0xacd3('0x1d')](function(_0x205697){if(_0x205697){_0x2c6357=_0x205697;_0x346a00[_0xacd3('0x3e')]=_['keys'](db[_0xacd3('0x5b')]['rawAttributes']);_0x346a00[_0xacd3('0x3f')]=_[_0xacd3('0x53')](_0x787e69[_0xacd3('0x3f')]);_0x346a00['filters']=_['intersection'](_0x346a00[_0xacd3('0x3e')],_0x346a00['query']);_0x5bc4a9[_0xacd3('0x43')]=_[_0xacd3('0x41')](_0x346a00[_0xacd3('0x3e')],qs['fields'](_0x787e69[_0xacd3('0x3f')][_0xacd3('0x42')]));_0x5bc4a9[_0xacd3('0x43')]=_0x5bc4a9['attributes'][_0xacd3('0x55')]?_0x5bc4a9[_0xacd3('0x43')]:_0x346a00[_0xacd3('0x3e')];_0x5bc4a9[_0xacd3('0x46')]=qs[_0xacd3('0x47')](_0x787e69[_0xacd3('0x3f')]['sort']);_0x5bc4a9[_0xacd3('0x48')]=qs[_0xacd3('0x40')](_[_0xacd3('0x5c')](_0x787e69[_0xacd3('0x3f')],_0x346a00['filters']));if(_0x787e69['query'][_0xacd3('0x49')]){_0x5bc4a9[_0xacd3('0x48')]=_[_0xacd3('0x4a')](_0x5bc4a9[_0xacd3('0x48')],{'$or':_['map'](_0x5bc4a9[_0xacd3('0x43')],function(_0x36eb4a){var _0x25deed={};_0x25deed[_0x36eb4a]={'$like':'%'+_0x787e69[_0xacd3('0x3f')][_0xacd3('0x49')]+'%'};return _0x25deed;})});}_0x5bc4a9=_['merge']({},_0x5bc4a9,_0x787e69[_0xacd3('0x4c')]);return _0x2c6357[_0xacd3('0x59')](_0x5bc4a9);}})[_0xacd3('0x1d')](function(_0x1edc03){if(_0x1edc03){_0x425163=_0x1edc03[_0xacd3('0x55')];if(!_0x787e69[_0xacd3('0x3f')][_0xacd3('0x44')]('nolimit')){_0x5bc4a9[_0xacd3('0x2c')]=qs[_0xacd3('0x2c')](_0x787e69[_0xacd3('0x3f')][_0xacd3('0x2c')]);_0x5bc4a9[_0xacd3('0x2b')]=qs[_0xacd3('0x2b')](_0x787e69[_0xacd3('0x3f')][_0xacd3('0x2b')]);}return _0x2c6357[_0xacd3('0x59')](_0x5bc4a9);}})[_0xacd3('0x1d')](function(_0x3e5af4){if(_0x3e5af4){return _0x3e5af4?{'count':_0x425163,'rows':_0x3e5af4}:null;}})[_0xacd3('0x1d')](respondWithResult(_0xa8b0f9,null))[_0xacd3('0x27')](handleError(_0xa8b0f9,null));};exports[_0xacd3('0x5d')]=function(_0x33837d,_0x392658,_0xc9dced){if(_0x33837d['body']['id']){delete _0x33837d['body']['id'];}return db['DeskAccount'][_0xacd3('0x5a')]({'where':{'id':_0x33837d[_0xacd3('0x52')]['id']}})[_0xacd3('0x1d')](handleEntityNotFound(_0x392658,null))[_0xacd3('0x1d')](function(_0xf6f2a1){if(_0xf6f2a1){_0x33837d[_0xacd3('0x58')][_0xacd3('0x5e')]=_0xf6f2a1['id'];_0x33837d[_0xacd3('0x58')][_0xacd3('0x5f')]=integrations[_0xacd3('0x60')](_0x33837d['body'][_0xacd3('0x61')],_0x33837d[_0xacd3('0x58')][_0xacd3('0x3c')]);_0x33837d[_0xacd3('0x58')]['Descriptions']=integrations['getDescriptions'](_0x33837d['body']['channel'],_0x33837d['body']['type']);return db[_0xacd3('0x5b')][_0xacd3('0x57')](_0x33837d[_0xacd3('0x58')],{'include':[{'model':db['DeskField'],'as':_0xacd3('0x5f')},{'model':db[_0xacd3('0x62')],'as':'Descriptions'}]});}return null;})[_0xacd3('0x1d')](respondWithResult(_0x392658,null))[_0xacd3('0x27')](handleError(_0x392658,null));};exports[_0xacd3('0x63')]=function(_0x2c6fd4,_0x11630b,_0xd2c21c){var _0x96e408=[{'name':_0xacd3('0x64'),'label':_0xacd3('0x64'),'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 _0x10e31b='';return db[_0xacd3('0x3a')][_0xacd3('0x5a')]({'where':{'id':_0x2c6fd4[_0xacd3('0x52')]['id']},'attributes':['id',_0xacd3('0x65'),_0xacd3('0x66'),_0xacd3('0x67'),_0xacd3('0x68'),_0xacd3('0x69'),_0xacd3('0x6a'),_0xacd3('0x6b'),_0xacd3('0x6c')]})[_0xacd3('0x1d')](handleEntityNotFound(_0x11630b,null))[_0xacd3('0x1d')](function(_0x1b16c2){if(_0x1b16c2){_0x10e31b=_0x1b16c2[_0xacd3('0x65')];var _0x1e056a=_0x10e31b['slice'](-0x1);if(_0x1e056a==='/'){_0x10e31b=_0x10e31b[_0xacd3('0x6d')](0x0,_0x10e31b[_0xacd3('0x6e')](_0x1e056a));}var _0x3f9403={'method':_0xacd3('0x6f'),'uri':util[_0xacd3('0x70')](_0xacd3('0x71'),_0x10e31b),'headers':{'Content-Type':_0xacd3('0x72'),'Accept':'application/json'},'json':!![]};if(_0x1b16c2[_0xacd3('0x66')]==='basic'){_0x3f9403[_0xacd3('0x73')][_0xacd3('0x74')]=util[_0xacd3('0x70')](_0xacd3('0x75'),new Buffer(util[_0xacd3('0x70')](_0xacd3('0x76'),_0x1b16c2['username'],_0x1b16c2[_0xacd3('0x68')]))[_0xacd3('0x77')]('base64'));}return rp(_0x3f9403)[_0xacd3('0x1d')](function(_0x2d0a00){return _0x96e408[_0xacd3('0x78')](_[_0xacd3('0x39')](_0x2d0a00[_0xacd3('0x79')]['entries'],function(_0x2c4a89){return{'id':_0x2c4a89['name'],'name':_0x2c4a89['name'],'type':_0x2c4a89[_0xacd3('0x3c')],'active':_0x2c4a89[_0xacd3('0x7a')],'label':_0x2c4a89[_0xacd3('0x7b')],'custom':!![]};}));});}})['then'](function(_0xbc2575){return{'count':_0xbc2575[_0xacd3('0x55')],'rows':_0xbc2575};})[_0xacd3('0x1d')](respondWithResult(_0x11630b,null))[_0xacd3('0x27')](function(_0x9a176c){var _0x23848e=_0x2c6fd4[_0xacd3('0x3f')][_0xacd3('0x7c')]?0x1f4:_0x9a176c[_0xacd3('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xacd3('0x63'),_0x23848e,JSON[_0xacd3('0x21')](_0x9a176c));delete _0x9a176c[_0xacd3('0x35')];if(_0x23848e===0x191){_0x23848e=0x190;}_0x11630b[_0xacd3('0x36')](_0x23848e)[_0xacd3('0x37')](_0x2c6fd4[_0xacd3('0x3f')][_0xacd3('0x7c')]?{'message':_0xacd3('0x7e'),'statusCode':_0x9a176c[_0xacd3('0x7d')]}:_0x9a176c);});}; \ No newline at end of file +var _0x9206=['consumerKey','consumerSecret','token','slice','substring','GET','%s/custom_fields','application/json','authType','basic','headers','Authorization','format','%s:%s','toString','base64','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','count','offset','limit','Content-Range','apply','save','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','DeskAccount','includeAll','include','findAll','show','params','find','create','update','body','getConfigurations','findOne','filters','filter','hasOwnProperty','Subjects','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','username','password'];(function(_0x3d9d0e,_0x11940f){var _0x25e321=function(_0x35652f){while(--_0x35652f){_0x3d9d0e['push'](_0x3d9d0e['shift']());}};_0x25e321(++_0x11940f);}(_0x9206,0x176));var _0x6920=function(_0x33a841,_0x18245f){_0x33a841=_0x33a841-0x0;var _0x3f39a6=_0x9206[_0x33a841];return _0x3f39a6;};'use strict';var pdf=require(_0x6920('0x0'));var emlformat=require(_0x6920('0x1'));var rimraf=require(_0x6920('0x2'));var zipdir=require(_0x6920('0x3'));var jsonpatch=require(_0x6920('0x4'));var rp=require(_0x6920('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6920('0x6'));var util=require(_0x6920('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6920('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6920('0x9'));var _=require(_0x6920('0xa'));var squel=require(_0x6920('0xb'));var crypto=require(_0x6920('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6920('0x8'));var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x6920('0x19'));var client=jayson[_0x6920('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x151167,_0xfa2823,_0x18140a,_0x2c3a35){return new BPromise(function(_0x17c6e9,_0x4b39c4){var _0x338e5f=_0x2c3a35||client;return _0x338e5f[_0x6920('0x1b')](_0x151167,_0x18140a)[_0x6920('0x1c')](function(_0xa64034){logger[_0x6920('0x1d')](_0x6920('0x1e'),_0xfa2823,_0x6920('0x1f'));logger[_0x6920('0x20')](_0x6920('0x21'),_0xfa2823,_0x6920('0x1f'),JSON[_0x6920('0x22')](_0xa64034));if(_0xa64034[_0x6920('0x23')]){if(_0xa64034[_0x6920('0x23')][_0x6920('0x24')]===0x1f4){logger[_0x6920('0x23')]('DeskAccount,\x20%s,\x20%s',_0xfa2823,_0xa64034[_0x6920('0x23')][_0x6920('0x25')]);return _0x4b39c4(_0xa64034[_0x6920('0x23')][_0x6920('0x25')]);}logger[_0x6920('0x23')](_0x6920('0x1e'),_0xfa2823,_0xa64034[_0x6920('0x23')][_0x6920('0x25')]);return _0x17c6e9(_0xa64034[_0x6920('0x23')][_0x6920('0x25')]);}else{logger[_0x6920('0x1d')](_0x6920('0x1e'),_0xfa2823,_0x6920('0x1f'));_0x17c6e9(_0xa64034[_0x6920('0x26')][_0x6920('0x25')]);}})[_0x6920('0x27')](function(_0x1ae686){logger[_0x6920('0x23')](_0x6920('0x1e'),_0xfa2823,_0x1ae686);_0x4b39c4(_0x1ae686);});});}function respondWithStatusCode(_0x258986,_0x51cb24){_0x51cb24=_0x51cb24||0xcc;return function(_0x1996f1){if(_0x1996f1){return _0x258986['sendStatus'](_0x51cb24);}return _0x258986[_0x6920('0x28')](_0x51cb24)['end']();};}function respondWithResult(_0x72316a,_0x32a6ae){_0x32a6ae=_0x32a6ae||0xc8;return function(_0x23e4cd){if(_0x23e4cd){return _0x72316a[_0x6920('0x28')](_0x32a6ae)['json'](_0x23e4cd);}};}function respondWithFilteredResult(_0x1cab00,_0xfe11d){return function(_0x305129){if(_0x305129){var _0x1ae78f=_0x305129[_0x6920('0x29')],_0x72e8bc=_0xfe11d[_0x6920('0x2a')],_0x462692=_0xfe11d[_0x6920('0x2a')]+_0xfe11d[_0x6920('0x2b')],_0xdcc5e3;if(_0x462692>=_0x1ae78f){_0x462692=_0x1ae78f;_0xdcc5e3=0xc8;}else{_0xdcc5e3=0xce;}_0x1cab00[_0x6920('0x28')](_0xdcc5e3);return _0x1cab00['set'](_0x6920('0x2c'),_0x72e8bc+'-'+_0x462692+'/'+_0x1ae78f)['json'](_0x305129);}return null;};}function patchUpdates(_0x411ea2){return function(_0x49534b){try{jsonpatch[_0x6920('0x2d')](_0x49534b,_0x411ea2,!![]);}catch(_0x25e7ff){return BPromise['reject'](_0x25e7ff);}return _0x49534b[_0x6920('0x2e')]();};}function saveUpdates(_0x173660,_0x2c3ef2){return function(_0x488b7f){if(_0x488b7f){return _0x488b7f['update'](_0x173660)[_0x6920('0x1c')](function(_0x5bb636){return _0x5bb636;});}return null;};}function removeEntity(_0x59506b,_0xc2807c){return function(_0x641825){if(_0x641825){return _0x641825[_0x6920('0x2f')]()[_0x6920('0x1c')](function(){_0x59506b[_0x6920('0x28')](0xcc)[_0x6920('0x30')]();});}};}function handleEntityNotFound(_0x1e0ba2,_0x5aff49){return function(_0x26cf8c){if(!_0x26cf8c){_0x1e0ba2['sendStatus'](0x194);}return _0x26cf8c;};}function handleError(_0x4301ea,_0x48f53a){_0x48f53a=_0x48f53a||0x1f4;return function(_0x495b5b){logger[_0x6920('0x23')](_0x495b5b[_0x6920('0x31')]);if(_0x495b5b[_0x6920('0x32')]){delete _0x495b5b[_0x6920('0x32')];}_0x4301ea[_0x6920('0x28')](_0x48f53a)[_0x6920('0x33')](_0x495b5b);};}exports[_0x6920('0x34')]=function(_0x1a40b2,_0x33acf7){var _0x26a4b0={},_0xfdcc78={},_0x33fa02={'count':0x0,'rows':[]};var _0x55fa9f=_[_0x6920('0x35')](db['DeskAccount'][_0x6920('0x36')],function(_0x3fe190){return{'name':_0x3fe190[_0x6920('0x37')],'type':_0x3fe190['type'][_0x6920('0x38')]};});_0xfdcc78[_0x6920('0x39')]=_[_0x6920('0x35')](_0x55fa9f,_0x6920('0x32'));_0xfdcc78['query']=_[_0x6920('0x3a')](_0x1a40b2[_0x6920('0x3b')]);_0xfdcc78['filters']=_['intersection'](_0xfdcc78[_0x6920('0x39')],_0xfdcc78[_0x6920('0x3b')]);_0x26a4b0['attributes']=_[_0x6920('0x3c')](_0xfdcc78[_0x6920('0x39')],qs['fields'](_0x1a40b2['query'][_0x6920('0x3d')]));_0x26a4b0[_0x6920('0x3e')]=_0x26a4b0[_0x6920('0x3e')][_0x6920('0x3f')]?_0x26a4b0[_0x6920('0x3e')]:_0xfdcc78['model'];if(!_0x1a40b2['query']['hasOwnProperty'](_0x6920('0x40'))){_0x26a4b0['limit']=qs['limit'](_0x1a40b2[_0x6920('0x3b')][_0x6920('0x2b')]);_0x26a4b0['offset']=qs[_0x6920('0x2a')](_0x1a40b2['query'][_0x6920('0x2a')]);}_0x26a4b0[_0x6920('0x41')]=qs[_0x6920('0x42')](_0x1a40b2[_0x6920('0x3b')][_0x6920('0x42')]);_0x26a4b0['where']=qs['filters'](_[_0x6920('0x43')](_0x1a40b2['query'],_0xfdcc78['filters']),_0x55fa9f);if(_0x1a40b2['query']['filter']){_0x26a4b0[_0x6920('0x44')]=_[_0x6920('0x45')](_0x26a4b0[_0x6920('0x44')],{'$or':_['map'](_0x55fa9f,function(_0x2a2c52){if(_0x2a2c52[_0x6920('0x46')]!==_0x6920('0x47')){var _0x456625={};_0x456625[_0x2a2c52[_0x6920('0x32')]]={'$like':'%'+_0x1a40b2[_0x6920('0x3b')]['filter']+'%'};return _0x456625;}})});}_0x26a4b0=_[_0x6920('0x45')]({},_0x26a4b0,_0x1a40b2[_0x6920('0x48')]);var _0x3b0570={'where':_0x26a4b0[_0x6920('0x44')]};return db[_0x6920('0x49')][_0x6920('0x29')](_0x3b0570)[_0x6920('0x1c')](function(_0x22a8bb){_0x33fa02[_0x6920('0x29')]=_0x22a8bb;if(_0x1a40b2[_0x6920('0x3b')][_0x6920('0x4a')]){_0x26a4b0[_0x6920('0x4b')]=[{'all':!![]}];}return db['DeskAccount'][_0x6920('0x4c')](_0x26a4b0);})[_0x6920('0x1c')](function(_0x571aed){_0x33fa02['rows']=_0x571aed;return _0x33fa02;})[_0x6920('0x1c')](respondWithFilteredResult(_0x33acf7,_0x26a4b0))[_0x6920('0x27')](handleError(_0x33acf7,null));};exports[_0x6920('0x4d')]=function(_0x41c38d,_0xf9e322){var _0x5e68ee={'raw':![],'where':{'id':_0x41c38d[_0x6920('0x4e')]['id']}},_0x86c9d9={};_0x86c9d9[_0x6920('0x39')]=_['keys'](db['DeskAccount'][_0x6920('0x36')]);_0x86c9d9[_0x6920('0x3b')]=_[_0x6920('0x3a')](_0x41c38d[_0x6920('0x3b')]);_0x86c9d9['filters']=_[_0x6920('0x3c')](_0x86c9d9[_0x6920('0x39')],_0x86c9d9[_0x6920('0x3b')]);_0x5e68ee[_0x6920('0x3e')]=_[_0x6920('0x3c')](_0x86c9d9['model'],qs[_0x6920('0x3d')](_0x41c38d[_0x6920('0x3b')][_0x6920('0x3d')]));_0x5e68ee[_0x6920('0x3e')]=_0x5e68ee[_0x6920('0x3e')][_0x6920('0x3f')]?_0x5e68ee[_0x6920('0x3e')]:_0x86c9d9[_0x6920('0x39')];if(_0x41c38d[_0x6920('0x3b')][_0x6920('0x4a')]){_0x5e68ee['include']=[{'all':!![]}];}_0x5e68ee=_[_0x6920('0x45')]({},_0x5e68ee,_0x41c38d[_0x6920('0x48')]);return db[_0x6920('0x49')][_0x6920('0x4f')](_0x5e68ee)[_0x6920('0x1c')](handleEntityNotFound(_0xf9e322,null))[_0x6920('0x1c')](respondWithResult(_0xf9e322,null))[_0x6920('0x27')](handleError(_0xf9e322,null));};exports['create']=function(_0xac84f9,_0x123c0a){return db[_0x6920('0x49')][_0x6920('0x50')](_0xac84f9['body'],{})['then'](respondWithResult(_0x123c0a,0xc9))['catch'](handleError(_0x123c0a,null));};exports[_0x6920('0x51')]=function(_0x3e54f5,_0xc212fa){if(_0x3e54f5['body']['id']){delete _0x3e54f5[_0x6920('0x52')]['id'];}return db[_0x6920('0x49')][_0x6920('0x4f')]({'where':{'id':_0x3e54f5[_0x6920('0x4e')]['id']}})[_0x6920('0x1c')](handleEntityNotFound(_0xc212fa,null))[_0x6920('0x1c')](saveUpdates(_0x3e54f5[_0x6920('0x52')],null))['then'](respondWithResult(_0xc212fa,null))[_0x6920('0x27')](handleError(_0xc212fa,null));};exports[_0x6920('0x2f')]=function(_0x4a8664,_0x6492ad){return db[_0x6920('0x49')][_0x6920('0x4f')]({'where':{'id':_0x4a8664[_0x6920('0x4e')]['id']}})[_0x6920('0x1c')](handleEntityNotFound(_0x6492ad,null))['then'](removeEntity(_0x6492ad,null))[_0x6920('0x27')](handleError(_0x6492ad,null));};exports[_0x6920('0x53')]=function(_0x49cf32,_0x450c98,_0x46cf9a){var _0x4f0cdf={};var _0x555f61={};var _0x4483ac;var _0x24cfbe;return db['DeskAccount'][_0x6920('0x54')]({'where':{'id':_0x49cf32[_0x6920('0x4e')]['id']}})[_0x6920('0x1c')](handleEntityNotFound(_0x450c98,null))[_0x6920('0x1c')](function(_0xc2afba){if(_0xc2afba){_0x4483ac=_0xc2afba;_0x555f61[_0x6920('0x39')]=_[_0x6920('0x3a')](db['DeskConfiguration'][_0x6920('0x36')]);_0x555f61[_0x6920('0x3b')]=_[_0x6920('0x3a')](_0x49cf32[_0x6920('0x3b')]);_0x555f61[_0x6920('0x55')]=_[_0x6920('0x3c')](_0x555f61[_0x6920('0x39')],_0x555f61[_0x6920('0x3b')]);_0x4f0cdf[_0x6920('0x3e')]=_['intersection'](_0x555f61[_0x6920('0x39')],qs[_0x6920('0x3d')](_0x49cf32[_0x6920('0x3b')][_0x6920('0x3d')]));_0x4f0cdf['attributes']=_0x4f0cdf[_0x6920('0x3e')][_0x6920('0x3f')]?_0x4f0cdf[_0x6920('0x3e')]:_0x555f61[_0x6920('0x39')];_0x4f0cdf[_0x6920('0x41')]=qs[_0x6920('0x42')](_0x49cf32['query'][_0x6920('0x42')]);_0x4f0cdf[_0x6920('0x44')]=qs['filters'](_[_0x6920('0x43')](_0x49cf32[_0x6920('0x3b')],_0x555f61[_0x6920('0x55')]));if(_0x49cf32[_0x6920('0x3b')][_0x6920('0x56')]){_0x4f0cdf[_0x6920('0x44')]=_[_0x6920('0x45')](_0x4f0cdf[_0x6920('0x44')],{'$or':_[_0x6920('0x35')](_0x4f0cdf[_0x6920('0x3e')],function(_0xabcfa5){var _0xe389f2={};_0xe389f2[_0xabcfa5]={'$like':'%'+_0x49cf32[_0x6920('0x3b')][_0x6920('0x56')]+'%'};return _0xe389f2;})});}_0x4f0cdf=_['merge']({},_0x4f0cdf,_0x49cf32[_0x6920('0x48')]);return _0x4483ac[_0x6920('0x53')](_0x4f0cdf);}})[_0x6920('0x1c')](function(_0x4bc290){if(_0x4bc290){_0x24cfbe=_0x4bc290[_0x6920('0x3f')];if(!_0x49cf32[_0x6920('0x3b')][_0x6920('0x57')](_0x6920('0x40'))){_0x4f0cdf[_0x6920('0x2b')]=qs['limit'](_0x49cf32[_0x6920('0x3b')][_0x6920('0x2b')]);_0x4f0cdf[_0x6920('0x2a')]=qs['offset'](_0x49cf32[_0x6920('0x3b')]['offset']);}return _0x4483ac['getConfigurations'](_0x4f0cdf);}})[_0x6920('0x1c')](function(_0x5d0c73){if(_0x5d0c73){return _0x5d0c73?{'count':_0x24cfbe,'rows':_0x5d0c73}:null;}})[_0x6920('0x1c')](respondWithResult(_0x450c98,null))[_0x6920('0x27')](handleError(_0x450c98,null));};exports['addConfiguration']=function(_0x47e5d3,_0x415be8,_0x166a2f){if(_0x47e5d3[_0x6920('0x52')]['id']){delete _0x47e5d3[_0x6920('0x52')]['id'];}return db[_0x6920('0x49')][_0x6920('0x54')]({'where':{'id':_0x47e5d3[_0x6920('0x4e')]['id']}})[_0x6920('0x1c')](handleEntityNotFound(_0x415be8,null))[_0x6920('0x1c')](function(_0xbd4d1b){if(_0xbd4d1b){_0x47e5d3['body']['AccountId']=_0xbd4d1b['id'];_0x47e5d3[_0x6920('0x52')][_0x6920('0x58')]=integrations['getSubjects'](_0x47e5d3[_0x6920('0x52')]['channel'],_0x47e5d3[_0x6920('0x52')][_0x6920('0x46')]);_0x47e5d3[_0x6920('0x52')][_0x6920('0x59')]=integrations[_0x6920('0x5a')](_0x47e5d3['body']['channel'],_0x47e5d3['body']['type']);return db[_0x6920('0x5b')][_0x6920('0x50')](_0x47e5d3[_0x6920('0x52')],{'include':[{'model':db[_0x6920('0x5c')],'as':'Subjects'},{'model':db[_0x6920('0x5c')],'as':_0x6920('0x59')}]});}return null;})[_0x6920('0x1c')](respondWithResult(_0x415be8,null))[_0x6920('0x27')](handleError(_0x415be8,null));};exports[_0x6920('0x5d')]=function(_0x89a443,_0x18be21,_0x2f7f1c){var _0x1256cb=[{'name':_0x6920('0x5e'),'label':_0x6920('0x5e'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3a1c3a='';return db['DeskAccount'][_0x6920('0x54')]({'where':{'id':_0x89a443[_0x6920('0x4e')]['id']},'attributes':['id',_0x6920('0x5f'),'authType',_0x6920('0x60'),_0x6920('0x61'),_0x6920('0x62'),_0x6920('0x63'),_0x6920('0x64'),'tokenSecret']})[_0x6920('0x1c')](handleEntityNotFound(_0x18be21,null))[_0x6920('0x1c')](function(_0x1cc28c){if(_0x1cc28c){_0x3a1c3a=_0x1cc28c[_0x6920('0x5f')];var _0x57f568=_0x3a1c3a[_0x6920('0x65')](-0x1);if(_0x57f568==='/'){_0x3a1c3a=_0x3a1c3a[_0x6920('0x66')](0x0,_0x3a1c3a['lastIndexOf'](_0x57f568));}var _0x3d51d4={'method':_0x6920('0x67'),'uri':util['format'](_0x6920('0x68'),_0x3a1c3a),'headers':{'Content-Type':'application/json','Accept':_0x6920('0x69')},'json':!![]};if(_0x1cc28c[_0x6920('0x6a')]===_0x6920('0x6b')){_0x3d51d4[_0x6920('0x6c')][_0x6920('0x6d')]=util[_0x6920('0x6e')]('Basic\x20%s',new Buffer(util[_0x6920('0x6e')](_0x6920('0x6f'),_0x1cc28c[_0x6920('0x60')],_0x1cc28c[_0x6920('0x61')]))[_0x6920('0x70')](_0x6920('0x71')));}return rp(_0x3d51d4)[_0x6920('0x1c')](function(_0x2931bb){return _0x1256cb['concat'](_[_0x6920('0x35')](_0x2931bb['_embedded'][_0x6920('0x72')],function(_0x24230b){return{'id':_0x24230b[_0x6920('0x32')],'name':_0x24230b['name'],'type':_0x24230b['type'],'active':_0x24230b['active'],'label':_0x24230b[_0x6920('0x73')],'custom':!![]};}));});}})['then'](function(_0x5b19ee){return{'count':_0x5b19ee['length'],'rows':_0x5b19ee};})[_0x6920('0x1c')](respondWithResult(_0x18be21,null))[_0x6920('0x27')](function(_0x3e477f){var _0x176b38=_0x89a443[_0x6920('0x3b')]['test']?0x1f4:_0x3e477f[_0x6920('0x74')]||0x1f4;logger[_0x6920('0x23')](_0x6920('0x75'),'getFields',_0x176b38,JSON[_0x6920('0x22')](_0x3e477f));delete _0x3e477f[_0x6920('0x32')];if(_0x176b38===0x191){_0x176b38=0x190;}_0x18be21['status'](_0x176b38)['send'](_0x89a443[_0x6920('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3e477f[_0x6920('0x74')]}:_0x3e477f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ff21a71..ff39172 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 _0xf15a=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','lodash','api','moment','bluebird','request-promise'];(function(_0x37bad5,_0x475a74){var _0x3ac9ac=function(_0x56036b){while(--_0x56036b){_0x37bad5['push'](_0x37bad5['shift']());}};_0x3ac9ac(++_0x475a74);}(_0xf15a,0x119));var _0xaf15=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf15a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xaf15('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaf15('0x1'));var moment=require(_0xaf15('0x2'));var BPromise=require(_0xaf15('0x3'));var rp=require(_0xaf15('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf15('0x5'));var config=require(_0xaf15('0x6'));var attributes=require(_0xaf15('0x7'));var integrations=require(_0xaf15('0x8'));module['exports']=function(_0x311a53,_0x5cfcbc){return _0x311a53[_0xaf15('0x9')](_0xaf15('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc38=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define'];(function(_0x4b3344,_0x300f25){var _0x5bc49c=function(_0x1b273d){while(--_0x1b273d){_0x4b3344['push'](_0x4b3344['shift']());}};_0x5bc49c(++_0x300f25);}(_0xdc38,0x1af));var _0x8dc3=function(_0x49cabe,_0x313e82){_0x49cabe=_0x49cabe-0x0;var _0x64eede=_0xdc38[_0x49cabe];return _0x64eede;};'use strict';var _=require(_0x8dc3('0x0'));var util=require(_0x8dc3('0x1'));var logger=require(_0x8dc3('0x2'))('api');var moment=require(_0x8dc3('0x3'));var BPromise=require(_0x8dc3('0x4'));var rp=require(_0x8dc3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8dc3('0x6'));var config=require(_0x8dc3('0x7'));var attributes=require(_0x8dc3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8dc3('0x9')]=function(_0x3e29f4,_0x26db70){return _0x3e29f4[_0x8dc3('0xa')](_0x8dc3('0xb'),attributes,{'tableName':_0x8dc3('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 9041928..ec878b5 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 _0xe8e8=['GetDeskAccount','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','options','where','attributes','limit','include','map','model'];(function(_0x4a04de,_0x2e342c){var _0xbbe018=function(_0x39639c){while(--_0x39639c){_0x4a04de['push'](_0x4a04de['shift']());}};_0xbbe018(++_0x2e342c);}(_0xe8e8,0x1e5));var _0x8e8e=function(_0x2910cc,_0x2242e6){_0x2910cc=_0x2910cc-0x0;var _0x4b4aba=_0xe8e8[_0x2910cc];return _0x4b4aba;};'use strict';var _=require(_0x8e8e('0x0'));var util=require(_0x8e8e('0x1'));var moment=require(_0x8e8e('0x2'));var BPromise=require(_0x8e8e('0x3'));var rs=require(_0x8e8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e8e('0x6'))(_0x8e8e('0x7'));var config=require(_0x8e8e('0x8'));var jayson=require(_0x8e8e('0x9'));var client=jayson['client'][_0x8e8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaab85,_0x5b6da5,_0x1f7dbf){return new BPromise(function(_0x43e501,_0x4fe551){return client[_0x8e8e('0xb')](_0xaab85,_0x1f7dbf)[_0x8e8e('0xc')](function(_0x3b7f29){logger[_0x8e8e('0xd')](_0x8e8e('0xe'),_0x5b6da5,_0x8e8e('0xf'));logger[_0x8e8e('0x10')](_0x8e8e('0x11'),_0x5b6da5,'request\x20sent',JSON[_0x8e8e('0x12')](_0x3b7f29));if(_0x3b7f29[_0x8e8e('0x13')]){if(_0x3b7f29[_0x8e8e('0x13')][_0x8e8e('0x14')]===0x1f4){logger[_0x8e8e('0x13')](_0x8e8e('0xe'),_0x5b6da5,_0x3b7f29[_0x8e8e('0x13')][_0x8e8e('0x15')]);return _0x4fe551(_0x3b7f29[_0x8e8e('0x13')][_0x8e8e('0x15')]);}logger[_0x8e8e('0x13')]('DeskAccount,\x20%s,\x20%s',_0x5b6da5,_0x3b7f29[_0x8e8e('0x13')]['message']);return _0x43e501(_0x3b7f29[_0x8e8e('0x13')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x5b6da5,'request\x20sent');_0x43e501(_0x3b7f29[_0x8e8e('0x16')][_0x8e8e('0x15')]);}})[_0x8e8e('0x17')](function(_0xb99f8a){logger[_0x8e8e('0x13')](_0x8e8e('0xe'),_0x5b6da5,_0xb99f8a);_0x4fe551(_0xb99f8a);});});}exports['GetDeskAccount']=function(_0x2fd880){var _0x4bc444=this;return new Promise(function(_0x26f207,_0x11addb){return db[_0x8e8e('0x18')][_0x8e8e('0x19')]({'raw':_0x2fd880['options']?_0x2fd880['options']['raw']===undefined?!![]:![]:!![],'where':_0x2fd880[_0x8e8e('0x1a')]?_0x2fd880['options'][_0x8e8e('0x1b')]||null:null,'attributes':_0x2fd880[_0x8e8e('0x1a')]?_0x2fd880[_0x8e8e('0x1a')][_0x8e8e('0x1c')]||null:null,'limit':_0x2fd880[_0x8e8e('0x1a')]?_0x2fd880[_0x8e8e('0x1a')][_0x8e8e('0x1d')]||null:null,'include':_0x2fd880[_0x8e8e('0x1a')]?_0x2fd880['options'][_0x8e8e('0x1e')]?_[_0x8e8e('0x1f')](_0x2fd880['options'][_0x8e8e('0x1e')],function(_0x2e7de2){return{'model':db[_0x2e7de2[_0x8e8e('0x20')]],'as':_0x2e7de2['as'],'attributes':_0x2e7de2[_0x8e8e('0x1c')],'include':_0x2e7de2[_0x8e8e('0x1e')]?_[_0x8e8e('0x1f')](_0x2e7de2[_0x8e8e('0x1e')],function(_0x18b16a){return{'model':db[_0x18b16a['model']],'as':_0x18b16a['as'],'attributes':_0x18b16a[_0x8e8e('0x1c')],'include':_0x18b16a[_0x8e8e('0x1e')]?_[_0x8e8e('0x1f')](_0x18b16a[_0x8e8e('0x1e')],function(_0x2af74c){return{'model':db[_0x2af74c[_0x8e8e('0x20')]],'as':_0x2af74c['as'],'attributes':_0x2af74c[_0x8e8e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8e8e('0xc')](function(_0x15b724){logger[_0x8e8e('0xd')](_0x8e8e('0x21'),_0x2fd880);logger[_0x8e8e('0x10')]('GetDeskAccount',_0x2fd880,JSON[_0x8e8e('0x12')](_0x15b724));_0x26f207(_0x15b724);})[_0x8e8e('0x17')](function(_0x3ad24f){logger[_0x8e8e('0x13')](_0x8e8e('0x21'),_0x3ad24f[_0x8e8e('0x15')],_0x2fd880);_0x11addb(_0x4bc444[_0x8e8e('0x13')](0x1f4,_0x3ad24f[_0x8e8e('0x15')]));});});};exports[_0x8e8e('0x22')]=function(_0x436788){var _0x2b65a1=this;return new Promise(function(_0x4f91cd,_0x8a5e3d){return db[_0x8e8e('0x18')][_0x8e8e('0x23')]({'raw':_0x436788[_0x8e8e('0x1a')]?_0x436788[_0x8e8e('0x1a')][_0x8e8e('0x24')]===undefined?!![]:![]:!![],'where':_0x436788[_0x8e8e('0x1a')]?_0x436788['options'][_0x8e8e('0x1b')]||null:null,'attributes':_0x436788[_0x8e8e('0x1a')]?_0x436788[_0x8e8e('0x1a')][_0x8e8e('0x1c')]||null:null,'include':_0x436788[_0x8e8e('0x1a')]?_0x436788['options'][_0x8e8e('0x1e')]?_['map'](_0x436788['options'][_0x8e8e('0x1e')],function(_0x45f59f){return{'model':db[_0x45f59f[_0x8e8e('0x20')]],'as':_0x45f59f['as'],'attributes':_0x45f59f['attributes'],'include':_0x45f59f[_0x8e8e('0x1e')]?_[_0x8e8e('0x1f')](_0x45f59f['include'],function(_0xe4563c){return{'model':db[_0xe4563c['model']],'as':_0xe4563c['as'],'attributes':_0xe4563c['attributes'],'include':_0xe4563c['include']?_[_0x8e8e('0x1f')](_0xe4563c[_0x8e8e('0x1e')],function(_0x288b90){return{'model':db[_0x288b90['model']],'as':_0x288b90['as'],'attributes':_0x288b90['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e8e('0xc')](function(_0x46413a){logger[_0x8e8e('0xd')]('ShowDeskAccount',_0x436788);logger[_0x8e8e('0x10')]('ShowDeskAccount',_0x436788,JSON[_0x8e8e('0x12')](_0x46413a));_0x4f91cd(_0x46413a);})['catch'](function(_0x36cd7e){logger[_0x8e8e('0x13')]('ShowDeskAccount',_0x36cd7e[_0x8e8e('0x15')],_0x436788);_0x8a5e3d(_0x2b65a1['error'](0x1f4,_0x36cd7e[_0x8e8e('0x15')]));});});}; \ No newline at end of file +var _0x81ff=['DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetDeskAccount','DeskAccount','options','attributes','limit','include','map','model','then','ShowDeskAccount','find','raw','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x27926e,_0x160898){var _0x17e61b=function(_0x4c8540){while(--_0x4c8540){_0x27926e['push'](_0x27926e['shift']());}};_0x17e61b(++_0x160898);}(_0x81ff,0x115));var _0xf81f=function(_0x21944c,_0x3dc299){_0x21944c=_0x21944c-0x0;var _0x1829ea=_0x81ff[_0x21944c];return _0x1829ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf81f('0x0'));var BPromise=require(_0xf81f('0x1'));var rs=require(_0xf81f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf81f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf81f('0x4'))(_0xf81f('0x5'));var config=require(_0xf81f('0x6'));var jayson=require(_0xf81f('0x7'));var client=jayson['client'][_0xf81f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x407a46,_0x347009,_0x36884c){return new BPromise(function(_0x2deea6,_0x4d0b1d){return client[_0xf81f('0x9')](_0x407a46,_0x36884c)['then'](function(_0x1de627){logger[_0xf81f('0xa')](_0xf81f('0xb'),_0x347009,'request\x20sent');logger[_0xf81f('0xc')](_0xf81f('0xd'),_0x347009,_0xf81f('0xe'),JSON['stringify'](_0x1de627));if(_0x1de627[_0xf81f('0xf')]){if(_0x1de627[_0xf81f('0xf')][_0xf81f('0x10')]===0x1f4){logger[_0xf81f('0xf')](_0xf81f('0xb'),_0x347009,_0x1de627['error'][_0xf81f('0x11')]);return _0x4d0b1d(_0x1de627['error'][_0xf81f('0x11')]);}logger[_0xf81f('0xf')](_0xf81f('0xb'),_0x347009,_0x1de627[_0xf81f('0xf')]['message']);return _0x2deea6(_0x1de627[_0xf81f('0xf')][_0xf81f('0x11')]);}else{logger[_0xf81f('0xa')](_0xf81f('0xb'),_0x347009,'request\x20sent');_0x2deea6(_0x1de627[_0xf81f('0x12')][_0xf81f('0x11')]);}})['catch'](function(_0x58e9a8){logger[_0xf81f('0xf')]('DeskAccount,\x20%s,\x20%s',_0x347009,_0x58e9a8);_0x4d0b1d(_0x58e9a8);});});}exports[_0xf81f('0x13')]=function(_0x4af243){var _0x321392=this;return new Promise(function(_0x46eb7a,_0x19287e){return db[_0xf81f('0x14')]['findAll']({'raw':_0x4af243[_0xf81f('0x15')]?_0x4af243['options']['raw']===undefined?!![]:![]:!![],'where':_0x4af243['options']?_0x4af243[_0xf81f('0x15')]['where']||null:null,'attributes':_0x4af243[_0xf81f('0x15')]?_0x4af243['options'][_0xf81f('0x16')]||null:null,'limit':_0x4af243['options']?_0x4af243[_0xf81f('0x15')][_0xf81f('0x17')]||null:null,'include':_0x4af243[_0xf81f('0x15')]?_0x4af243[_0xf81f('0x15')][_0xf81f('0x18')]?_[_0xf81f('0x19')](_0x4af243[_0xf81f('0x15')][_0xf81f('0x18')],function(_0x4410ae){return{'model':db[_0x4410ae[_0xf81f('0x1a')]],'as':_0x4410ae['as'],'attributes':_0x4410ae[_0xf81f('0x16')],'include':_0x4410ae['include']?_[_0xf81f('0x19')](_0x4410ae['include'],function(_0x4f60cf){return{'model':db[_0x4f60cf[_0xf81f('0x1a')]],'as':_0x4f60cf['as'],'attributes':_0x4f60cf['attributes'],'include':_0x4f60cf[_0xf81f('0x18')]?_[_0xf81f('0x19')](_0x4f60cf[_0xf81f('0x18')],function(_0x43f7ba){return{'model':db[_0x43f7ba[_0xf81f('0x1a')]],'as':_0x43f7ba['as'],'attributes':_0x43f7ba[_0xf81f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xf81f('0x1b')](function(_0x236bb7){logger[_0xf81f('0xa')]('GetDeskAccount',_0x4af243);logger[_0xf81f('0xc')]('GetDeskAccount',_0x4af243,JSON['stringify'](_0x236bb7));_0x46eb7a(_0x236bb7);})['catch'](function(_0x48c679){logger[_0xf81f('0xf')](_0xf81f('0x13'),_0x48c679[_0xf81f('0x11')],_0x4af243);_0x19287e(_0x321392[_0xf81f('0xf')](0x1f4,_0x48c679[_0xf81f('0x11')]));});});};exports[_0xf81f('0x1c')]=function(_0x210cbf){var _0x1cd2ab=this;return new Promise(function(_0x3e7003,_0x352a38){return db[_0xf81f('0x14')][_0xf81f('0x1d')]({'raw':_0x210cbf['options']?_0x210cbf[_0xf81f('0x15')][_0xf81f('0x1e')]===undefined?!![]:![]:!![],'where':_0x210cbf[_0xf81f('0x15')]?_0x210cbf[_0xf81f('0x15')]['where']||null:null,'attributes':_0x210cbf[_0xf81f('0x15')]?_0x210cbf[_0xf81f('0x15')][_0xf81f('0x16')]||null:null,'include':_0x210cbf[_0xf81f('0x15')]?_0x210cbf['options']['include']?_[_0xf81f('0x19')](_0x210cbf['options'][_0xf81f('0x18')],function(_0x23325e){return{'model':db[_0x23325e['model']],'as':_0x23325e['as'],'attributes':_0x23325e[_0xf81f('0x16')],'include':_0x23325e['include']?_[_0xf81f('0x19')](_0x23325e[_0xf81f('0x18')],function(_0x4267c8){return{'model':db[_0x4267c8[_0xf81f('0x1a')]],'as':_0x4267c8['as'],'attributes':_0x4267c8[_0xf81f('0x16')],'include':_0x4267c8[_0xf81f('0x18')]?_[_0xf81f('0x19')](_0x4267c8[_0xf81f('0x18')],function(_0x31bf5e){return{'model':db[_0x31bf5e['model']],'as':_0x31bf5e['as'],'attributes':_0x31bf5e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf81f('0x1b')](function(_0x31cf4b){logger[_0xf81f('0xa')](_0xf81f('0x1c'),_0x210cbf);logger[_0xf81f('0xc')](_0xf81f('0x1c'),_0x210cbf,JSON[_0xf81f('0x1f')](_0x31cf4b));_0x3e7003(_0x31cf4b);})['catch'](function(_0x23accc){logger[_0xf81f('0xf')](_0xf81f('0x1c'),_0x23accc[_0xf81f('0x11')],_0x210cbf);_0x352a38(_0x1cd2ab[_0xf81f('0xf')](0x1f4,_0x23accc[_0xf81f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 0658857..f98bc7e 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 _0x7282=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','/:id','delete','destroy','multer','util','connect-timeout'];(function(_0x552192,_0x4d9370){var _0x6b7953=function(_0x4bccbf){while(--_0x4bccbf){_0x552192['push'](_0x552192['shift']());}};_0x6b7953(++_0x4d9370);}(_0x7282,0x1c8));var _0x2728=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0x7282[_0x4429e0];return _0x51a5b3;};'use strict';var multer=require(_0x2728('0x0'));var util=require(_0x2728('0x1'));var path=require('path');var timeout=require(_0x2728('0x2'));var express=require(_0x2728('0x3'));var router=express[_0x2728('0x4')]();var fs_extra=require(_0x2728('0x5'));var auth=require(_0x2728('0x6'));var interaction=require(_0x2728('0x7'));var config=require('../../config/environment');var controller=require(_0x2728('0x8'));router[_0x2728('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2728('0x9')]('/:id',auth[_0x2728('0xa')](),controller[_0x2728('0xb')]);router[_0x2728('0x9')](_0x2728('0xc'),auth[_0x2728('0xa')](),controller[_0x2728('0xd')]);router['get'](_0x2728('0xe'),auth[_0x2728('0xa')](),controller[_0x2728('0xf')]);router[_0x2728('0x9')](_0x2728('0x10'),auth[_0x2728('0xa')](),controller[_0x2728('0x11')]);router[_0x2728('0x9')]('/:id/tags',auth[_0x2728('0xa')](),controller[_0x2728('0x12')]);router[_0x2728('0x13')]('/',auth[_0x2728('0xa')](),controller[_0x2728('0x14')]);router['post'](_0x2728('0x15'),auth[_0x2728('0xa')](),controller[_0x2728('0x16')]);router[_0x2728('0x17')](_0x2728('0x18'),auth[_0x2728('0xa')](),controller['update']);router[_0x2728('0x19')]('/:id',auth[_0x2728('0xa')](),controller[_0x2728('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc49c=['../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x23a123,_0x23fbb9){var _0x30b428=function(_0x3f923c){while(--_0x3f923c){_0x23a123['push'](_0x23a123['shift']());}};_0x30b428(++_0x23fbb9);}(_0xc49c,0x8a));var _0xcc49=function(_0x47cff4,_0x1bb55c){_0x47cff4=_0x47cff4-0x0;var _0x2d8bbb=_0xc49c[_0x47cff4];return _0x2d8bbb;};'use strict';var multer=require('multer');var util=require(_0xcc49('0x0'));var path=require(_0xcc49('0x1'));var timeout=require(_0xcc49('0x2'));var express=require(_0xcc49('0x3'));var router=express[_0xcc49('0x4')]();var fs_extra=require(_0xcc49('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcc49('0x6'));var config=require('../../config/environment');var controller=require(_0xcc49('0x7'));router[_0xcc49('0x8')]('/',auth[_0xcc49('0x9')](),controller['index']);router[_0xcc49('0x8')](_0xcc49('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcc49('0x8')](_0xcc49('0xb'),auth[_0xcc49('0x9')](),controller[_0xcc49('0xc')]);router[_0xcc49('0x8')]('/:id/subjects',auth[_0xcc49('0x9')](),controller[_0xcc49('0xd')]);router[_0xcc49('0x8')](_0xcc49('0xe'),auth[_0xcc49('0x9')](),controller[_0xcc49('0xf')]);router[_0xcc49('0x8')](_0xcc49('0x10'),auth[_0xcc49('0x9')](),controller[_0xcc49('0x11')]);router[_0xcc49('0x12')]('/',auth['isAuthenticated'](),controller[_0xcc49('0x13')]);router[_0xcc49('0x12')](_0xcc49('0x10'),auth[_0xcc49('0x9')](),controller['setTags']);router[_0xcc49('0x14')](_0xcc49('0xa'),auth[_0xcc49('0x9')](),controller[_0xcc49('0x15')]);router[_0xcc49('0x16')](_0xcc49('0xa'),auth[_0xcc49('0x9')](),controller[_0xcc49('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 9c5935b..7a94b29 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 _0xa8ab=['sequelize','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa8ab,0xff));var _0xba8a=function(_0xcec9f3,_0x123ff6){_0xcec9f3=_0xcec9f3-0x0;var _0x2518dc=_0xa8ab[_0xcec9f3];return _0x2518dc;};'use strict';var Sequelize=require(_0xba8a('0x0'));module[_0xba8a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba8a('0x2')]}}; \ No newline at end of file +var _0xe290=['STRING'];(function(_0x58106b,_0x2119dd){var _0x5ca29c=function(_0x512e2a){while(--_0x512e2a){_0x58106b['push'](_0x58106b['shift']());}};_0x5ca29c(++_0x2119dd);}(_0xe290,0x119));var _0x0e29=function(_0x496cba,_0x92dd1f){_0x496cba=_0x496cba-0x0;var _0x248927=_0xe290[_0x496cba];return _0x248927;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0e29('0x0')]},'description':{'type':Sequelize[_0x0e29('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 37113f3..5114199 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 _0x5090=['filters','pick','filter','merge','DeskConfiguration','count','rows','catch','show','params','keys','includeAll','include','options','create','body','find','getFields','findOne','DeskField','hasOwnProperty','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','model','intersection','fields','attributes','length','nolimit','limit','order','sort','where'];(function(_0x2029d3,_0xffd70){var _0x5b0a22=function(_0x12b919){while(--_0x12b919){_0x2029d3['push'](_0x2029d3['shift']());}};_0x5b0a22(++_0xffd70);}(_0x5090,0x79));var _0x0509=function(_0x4f1356,_0x11d958){_0x4f1356=_0x4f1356-0x0;var _0x2ebd23=_0x5090[_0x4f1356];return _0x2ebd23;};'use strict';var pdf=require(_0x0509('0x0'));var emlformat=require(_0x0509('0x1'));var rimraf=require(_0x0509('0x2'));var zipdir=require(_0x0509('0x3'));var jsonpatch=require(_0x0509('0x4'));var rp=require(_0x0509('0x5'));var moment=require(_0x0509('0x6'));var BPromise=require(_0x0509('0x7'));var Mustache=require(_0x0509('0x8'));var util=require(_0x0509('0x9'));var path=require(_0x0509('0xa'));var sox=require(_0x0509('0xb'));var csv=require(_0x0509('0xc'));var ejs=require(_0x0509('0xd'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0509('0xe'));var crypto=require('crypto');var jsforce=require(_0x0509('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0509('0xc'));var querystring=require('querystring');var Papa=require(_0x0509('0x10'));var Redis=require(_0x0509('0x11'));var authService=require(_0x0509('0x12'));var qs=require(_0x0509('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0509('0x14'));var utils=require(_0x0509('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0509('0x16'));var db=require(_0x0509('0x17'))['db'];var jayson=require(_0x0509('0x18'));var client=jayson[_0x0509('0x19')][_0x0509('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x42d8dc,_0x3ca09b,_0x326e08,_0x84f17){return new BPromise(function(_0xc2fc90,_0x13ae23){var _0x39229c=_0x84f17||client;return _0x39229c[_0x0509('0x1b')](_0x42d8dc,_0x326e08)['then'](function(_0x641839){logger[_0x0509('0x1c')](_0x0509('0x1d'),_0x3ca09b,_0x0509('0x1e'));logger[_0x0509('0x1f')](_0x0509('0x20'),_0x3ca09b,_0x0509('0x1e'),JSON[_0x0509('0x21')](_0x641839));if(_0x641839['error']){if(_0x641839[_0x0509('0x22')][_0x0509('0x23')]===0x1f4){logger[_0x0509('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x3ca09b,_0x641839[_0x0509('0x22')][_0x0509('0x24')]);return _0x13ae23(_0x641839[_0x0509('0x22')]['message']);}logger[_0x0509('0x22')](_0x0509('0x1d'),_0x3ca09b,_0x641839[_0x0509('0x22')][_0x0509('0x24')]);return _0xc2fc90(_0x641839['error'][_0x0509('0x24')]);}else{logger[_0x0509('0x1c')](_0x0509('0x1d'),_0x3ca09b,_0x0509('0x1e'));_0xc2fc90(_0x641839[_0x0509('0x25')][_0x0509('0x24')]);}})['catch'](function(_0x17e9e0){logger[_0x0509('0x22')](_0x0509('0x1d'),_0x3ca09b,_0x17e9e0);_0x13ae23(_0x17e9e0);});});}function respondWithStatusCode(_0x81f7fc,_0x1fb23f){_0x1fb23f=_0x1fb23f||0xcc;return function(_0x41a84b){if(_0x41a84b){return _0x81f7fc[_0x0509('0x26')](_0x1fb23f);}return _0x81f7fc[_0x0509('0x27')](_0x1fb23f)[_0x0509('0x28')]();};}function respondWithResult(_0x20d879,_0x4933c9){_0x4933c9=_0x4933c9||0xc8;return function(_0x3f2675){if(_0x3f2675){return _0x20d879[_0x0509('0x27')](_0x4933c9)[_0x0509('0x29')](_0x3f2675);}};}function respondWithFilteredResult(_0x36de6f,_0x3242ae){return function(_0x20bf8e){if(_0x20bf8e){var _0xf27a7=_0x20bf8e['count'],_0x3e4953=_0x3242ae[_0x0509('0x2a')],_0x5495bc=_0x3242ae[_0x0509('0x2a')]+_0x3242ae['limit'],_0x406a22;if(_0x5495bc>=_0xf27a7){_0x5495bc=_0xf27a7;_0x406a22=0xc8;}else{_0x406a22=0xce;}_0x36de6f[_0x0509('0x27')](_0x406a22);return _0x36de6f[_0x0509('0x2b')](_0x0509('0x2c'),_0x3e4953+'-'+_0x5495bc+'/'+_0xf27a7)['json'](_0x20bf8e);}return null;};}function patchUpdates(_0x317969){return function(_0x2e34d0){try{jsonpatch[_0x0509('0x2d')](_0x2e34d0,_0x317969,!![]);}catch(_0x32b85c){return BPromise[_0x0509('0x2e')](_0x32b85c);}return _0x2e34d0[_0x0509('0x2f')]();};}function saveUpdates(_0x5c5572,_0xd6eb30){return function(_0x36d8ae){if(_0x36d8ae){return _0x36d8ae[_0x0509('0x30')](_0x5c5572)['then'](function(_0x1bc6c4){return _0x1bc6c4;});}return null;};}function removeEntity(_0x1463ca,_0x1ec736){return function(_0xd7258){if(_0xd7258){return _0xd7258[_0x0509('0x31')]()[_0x0509('0x32')](function(){_0x1463ca[_0x0509('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2009b9,_0x29fb86){return function(_0x12190a){if(!_0x12190a){_0x2009b9['sendStatus'](0x194);}return _0x12190a;};}function handleError(_0x5ee86b,_0x16ce08){_0x16ce08=_0x16ce08||0x1f4;return function(_0x1c6099){logger[_0x0509('0x22')](_0x1c6099[_0x0509('0x33')]);if(_0x1c6099[_0x0509('0x34')]){delete _0x1c6099[_0x0509('0x34')];}_0x5ee86b['status'](_0x16ce08)[_0x0509('0x35')](_0x1c6099);};}exports[_0x0509('0x36')]=function(_0x19a5b2,_0x55a8b0){var _0x1adcfa={},_0x53f7ed={},_0x2c43d6={'count':0x0,'rows':[]};var _0x144abe=_['map'](db['DeskConfiguration'][_0x0509('0x37')],function(_0x311d8a){return{'name':_0x311d8a[_0x0509('0x38')],'type':_0x311d8a[_0x0509('0x39')][_0x0509('0x3a')]};});_0x53f7ed['model']=_[_0x0509('0x3b')](_0x144abe,'name');_0x53f7ed['query']=_['keys'](_0x19a5b2[_0x0509('0x3c')]);_0x53f7ed['filters']=_['intersection'](_0x53f7ed[_0x0509('0x3d')],_0x53f7ed[_0x0509('0x3c')]);_0x1adcfa['attributes']=_[_0x0509('0x3e')](_0x53f7ed[_0x0509('0x3d')],qs['fields'](_0x19a5b2[_0x0509('0x3c')][_0x0509('0x3f')]));_0x1adcfa[_0x0509('0x40')]=_0x1adcfa[_0x0509('0x40')][_0x0509('0x41')]?_0x1adcfa[_0x0509('0x40')]:_0x53f7ed[_0x0509('0x3d')];if(!_0x19a5b2['query']['hasOwnProperty'](_0x0509('0x42'))){_0x1adcfa['limit']=qs['limit'](_0x19a5b2[_0x0509('0x3c')][_0x0509('0x43')]);_0x1adcfa[_0x0509('0x2a')]=qs[_0x0509('0x2a')](_0x19a5b2[_0x0509('0x3c')][_0x0509('0x2a')]);}_0x1adcfa[_0x0509('0x44')]=qs[_0x0509('0x45')](_0x19a5b2['query'][_0x0509('0x45')]);_0x1adcfa[_0x0509('0x46')]=qs[_0x0509('0x47')](_[_0x0509('0x48')](_0x19a5b2['query'],_0x53f7ed[_0x0509('0x47')]),_0x144abe);if(_0x19a5b2[_0x0509('0x3c')][_0x0509('0x49')]){_0x1adcfa['where']=_[_0x0509('0x4a')](_0x1adcfa[_0x0509('0x46')],{'$or':_['map'](_0x144abe,function(_0x5b9e20){if(_0x5b9e20[_0x0509('0x39')]!=='VIRTUAL'){var _0xac3011={};_0xac3011[_0x5b9e20[_0x0509('0x34')]]={'$like':'%'+_0x19a5b2[_0x0509('0x3c')][_0x0509('0x49')]+'%'};return _0xac3011;}})});}_0x1adcfa=_[_0x0509('0x4a')]({},_0x1adcfa,_0x19a5b2['options']);var _0x13b2b8={'where':_0x1adcfa['where']};return db[_0x0509('0x4b')][_0x0509('0x4c')](_0x13b2b8)['then'](function(_0x451908){_0x2c43d6['count']=_0x451908;if(_0x19a5b2[_0x0509('0x3c')]['includeAll']){_0x1adcfa['include']=[{'all':!![]}];}return db[_0x0509('0x4b')]['findAll'](_0x1adcfa);})[_0x0509('0x32')](function(_0x17e014){_0x2c43d6[_0x0509('0x4d')]=_0x17e014;return _0x2c43d6;})[_0x0509('0x32')](respondWithFilteredResult(_0x55a8b0,_0x1adcfa))[_0x0509('0x4e')](handleError(_0x55a8b0,null));};exports[_0x0509('0x4f')]=function(_0x313808,_0x5216f0){var _0x1a2eaf={'raw':![],'where':{'id':_0x313808[_0x0509('0x50')]['id']}},_0x257e26={};_0x257e26[_0x0509('0x3d')]=_[_0x0509('0x51')](db[_0x0509('0x4b')][_0x0509('0x37')]);_0x257e26[_0x0509('0x3c')]=_[_0x0509('0x51')](_0x313808[_0x0509('0x3c')]);_0x257e26[_0x0509('0x47')]=_[_0x0509('0x3e')](_0x257e26[_0x0509('0x3d')],_0x257e26[_0x0509('0x3c')]);_0x1a2eaf[_0x0509('0x40')]=_['intersection'](_0x257e26[_0x0509('0x3d')],qs[_0x0509('0x3f')](_0x313808[_0x0509('0x3c')]['fields']));_0x1a2eaf['attributes']=_0x1a2eaf['attributes']['length']?_0x1a2eaf[_0x0509('0x40')]:_0x257e26[_0x0509('0x3d')];if(_0x313808[_0x0509('0x3c')][_0x0509('0x52')]){_0x1a2eaf[_0x0509('0x53')]=[{'all':!![]}];}_0x1a2eaf=_[_0x0509('0x4a')]({},_0x1a2eaf,_0x313808[_0x0509('0x54')]);return db['DeskConfiguration']['find'](_0x1a2eaf)[_0x0509('0x32')](handleEntityNotFound(_0x5216f0,null))[_0x0509('0x32')](respondWithResult(_0x5216f0,null))[_0x0509('0x4e')](handleError(_0x5216f0,null));};exports[_0x0509('0x55')]=function(_0x481d3f,_0x113fad){return db['DeskConfiguration'][_0x0509('0x55')](_0x481d3f[_0x0509('0x56')],{})['then'](respondWithResult(_0x113fad,0xc9))[_0x0509('0x4e')](handleError(_0x113fad,null));};exports['update']=function(_0x3760e,_0xbf2b72){if(_0x3760e[_0x0509('0x56')]['id']){delete _0x3760e[_0x0509('0x56')]['id'];}return db['DeskConfiguration'][_0x0509('0x57')]({'where':{'id':_0x3760e[_0x0509('0x50')]['id']}})[_0x0509('0x32')](handleEntityNotFound(_0xbf2b72,null))[_0x0509('0x32')](saveUpdates(_0x3760e[_0x0509('0x56')],null))['then'](respondWithResult(_0xbf2b72,null))[_0x0509('0x4e')](handleError(_0xbf2b72,null));};exports[_0x0509('0x31')]=function(_0x3937b1,_0x1ed115){return db[_0x0509('0x4b')][_0x0509('0x57')]({'where':{'id':_0x3937b1['params']['id']}})[_0x0509('0x32')](handleEntityNotFound(_0x1ed115,null))[_0x0509('0x32')](removeEntity(_0x1ed115,null))[_0x0509('0x4e')](handleError(_0x1ed115,null));};exports[_0x0509('0x58')]=function(_0x52107d,_0x3922df,_0x372aeb){var _0x4e81f1={};var _0x2f1e2a={};var _0x5432a9;var _0x2c0f97;return db['DeskConfiguration'][_0x0509('0x59')]({'where':{'id':_0x52107d[_0x0509('0x50')]['id']}})['then'](handleEntityNotFound(_0x3922df,null))['then'](function(_0xa7b699){if(_0xa7b699){_0x5432a9=_0xa7b699;_0x2f1e2a[_0x0509('0x3d')]=_[_0x0509('0x51')](db[_0x0509('0x5a')][_0x0509('0x37')]);_0x2f1e2a[_0x0509('0x3c')]=_[_0x0509('0x51')](_0x52107d[_0x0509('0x3c')]);_0x2f1e2a[_0x0509('0x47')]=_[_0x0509('0x3e')](_0x2f1e2a['model'],_0x2f1e2a[_0x0509('0x3c')]);_0x4e81f1[_0x0509('0x40')]=_[_0x0509('0x3e')](_0x2f1e2a[_0x0509('0x3d')],qs[_0x0509('0x3f')](_0x52107d[_0x0509('0x3c')][_0x0509('0x3f')]));_0x4e81f1[_0x0509('0x40')]=_0x4e81f1[_0x0509('0x40')][_0x0509('0x41')]?_0x4e81f1[_0x0509('0x40')]:_0x2f1e2a[_0x0509('0x3d')];_0x4e81f1[_0x0509('0x44')]=qs[_0x0509('0x45')](_0x52107d[_0x0509('0x3c')]['sort']);_0x4e81f1['where']=qs[_0x0509('0x47')](_[_0x0509('0x48')](_0x52107d[_0x0509('0x3c')],_0x2f1e2a[_0x0509('0x47')]));if(_0x52107d[_0x0509('0x3c')]['filter']){_0x4e81f1[_0x0509('0x46')]=_[_0x0509('0x4a')](_0x4e81f1['where'],{'$or':_[_0x0509('0x3b')](_0x4e81f1[_0x0509('0x40')],function(_0x2a031e){var _0x4745e6={};_0x4745e6[_0x2a031e]={'$like':'%'+_0x52107d[_0x0509('0x3c')][_0x0509('0x49')]+'%'};return _0x4745e6;})});}_0x4e81f1=_[_0x0509('0x4a')]({},_0x4e81f1,_0x52107d[_0x0509('0x54')]);return _0x5432a9[_0x0509('0x58')](_0x4e81f1);}})[_0x0509('0x32')](function(_0x3f0cb8){if(_0x3f0cb8){_0x2c0f97=_0x3f0cb8[_0x0509('0x41')];if(!_0x52107d[_0x0509('0x3c')][_0x0509('0x5b')](_0x0509('0x42'))){_0x4e81f1[_0x0509('0x43')]=qs['limit'](_0x52107d[_0x0509('0x3c')][_0x0509('0x43')]);_0x4e81f1[_0x0509('0x2a')]=qs[_0x0509('0x2a')](_0x52107d[_0x0509('0x3c')][_0x0509('0x2a')]);}return _0x5432a9[_0x0509('0x58')](_0x4e81f1);}})[_0x0509('0x32')](function(_0x3ace66){if(_0x3ace66){return _0x3ace66?{'count':_0x2c0f97,'rows':_0x3ace66}:null;}})[_0x0509('0x32')](respondWithResult(_0x3922df,null))[_0x0509('0x4e')](handleError(_0x3922df,null));};exports['getSubjects']=function(_0x3d8d5f,_0x425622,_0x3c01f8){var _0x36bf8f={};var _0x56d8ed={};var _0x23d11e;var _0x2491a3;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3d8d5f[_0x0509('0x50')]['id']}})[_0x0509('0x32')](handleEntityNotFound(_0x425622,null))[_0x0509('0x32')](function(_0x4c33d7){if(_0x4c33d7){_0x23d11e=_0x4c33d7;_0x56d8ed[_0x0509('0x3d')]=_[_0x0509('0x51')](db[_0x0509('0x5a')][_0x0509('0x37')]);_0x56d8ed['query']=_[_0x0509('0x51')](_0x3d8d5f[_0x0509('0x3c')]);_0x56d8ed['filters']=_['intersection'](_0x56d8ed[_0x0509('0x3d')],_0x56d8ed[_0x0509('0x3c')]);_0x36bf8f[_0x0509('0x40')]=_[_0x0509('0x3e')](_0x56d8ed[_0x0509('0x3d')],qs['fields'](_0x3d8d5f[_0x0509('0x3c')]['fields']));_0x36bf8f['attributes']=_0x36bf8f[_0x0509('0x40')][_0x0509('0x41')]?_0x36bf8f[_0x0509('0x40')]:_0x56d8ed[_0x0509('0x3d')];_0x36bf8f['order']=qs[_0x0509('0x45')](_0x3d8d5f[_0x0509('0x3c')][_0x0509('0x45')]);_0x36bf8f['where']=qs[_0x0509('0x47')](_[_0x0509('0x48')](_0x3d8d5f[_0x0509('0x3c')],_0x56d8ed[_0x0509('0x47')]));if(_0x3d8d5f[_0x0509('0x3c')][_0x0509('0x49')]){_0x36bf8f['where']=_['merge'](_0x36bf8f['where'],{'$or':_[_0x0509('0x3b')](_0x36bf8f[_0x0509('0x40')],function(_0x13b3bc){var _0x32f6ac={};_0x32f6ac[_0x13b3bc]={'$like':'%'+_0x3d8d5f[_0x0509('0x3c')]['filter']+'%'};return _0x32f6ac;})});}_0x36bf8f=_[_0x0509('0x4a')]({},_0x36bf8f,_0x3d8d5f[_0x0509('0x54')]);return _0x23d11e['getSubjects'](_0x36bf8f);}})[_0x0509('0x32')](function(_0x317102){if(_0x317102){_0x2491a3=_0x317102[_0x0509('0x41')];if(!_0x3d8d5f[_0x0509('0x3c')][_0x0509('0x5b')](_0x0509('0x42'))){_0x36bf8f['limit']=qs[_0x0509('0x43')](_0x3d8d5f[_0x0509('0x3c')][_0x0509('0x43')]);_0x36bf8f[_0x0509('0x2a')]=qs[_0x0509('0x2a')](_0x3d8d5f[_0x0509('0x3c')][_0x0509('0x2a')]);}return _0x23d11e['getSubjects'](_0x36bf8f);}})[_0x0509('0x32')](function(_0x122260){if(_0x122260){return _0x122260?{'count':_0x2491a3,'rows':_0x122260}:null;}})[_0x0509('0x32')](respondWithResult(_0x425622,null))[_0x0509('0x4e')](handleError(_0x425622,null));};exports[_0x0509('0x5c')]=function(_0x227c6c,_0x34c4bf,_0x142cd4){var _0x20b094={};var _0xad1f74={};var _0x1ab1fb;var _0x35aee3;return db[_0x0509('0x4b')][_0x0509('0x59')]({'where':{'id':_0x227c6c[_0x0509('0x50')]['id']}})[_0x0509('0x32')](handleEntityNotFound(_0x34c4bf,null))[_0x0509('0x32')](function(_0x2cc69c){if(_0x2cc69c){_0x1ab1fb=_0x2cc69c;_0xad1f74[_0x0509('0x3d')]=_['keys'](db[_0x0509('0x5a')][_0x0509('0x37')]);_0xad1f74[_0x0509('0x3c')]=_['keys'](_0x227c6c[_0x0509('0x3c')]);_0xad1f74[_0x0509('0x47')]=_['intersection'](_0xad1f74[_0x0509('0x3d')],_0xad1f74[_0x0509('0x3c')]);_0x20b094[_0x0509('0x40')]=_[_0x0509('0x3e')](_0xad1f74[_0x0509('0x3d')],qs[_0x0509('0x3f')](_0x227c6c['query'][_0x0509('0x3f')]));_0x20b094[_0x0509('0x40')]=_0x20b094[_0x0509('0x40')]['length']?_0x20b094[_0x0509('0x40')]:_0xad1f74[_0x0509('0x3d')];_0x20b094[_0x0509('0x44')]=qs['sort'](_0x227c6c[_0x0509('0x3c')][_0x0509('0x45')]);_0x20b094[_0x0509('0x46')]=qs['filters'](_[_0x0509('0x48')](_0x227c6c[_0x0509('0x3c')],_0xad1f74['filters']));if(_0x227c6c[_0x0509('0x3c')]['filter']){_0x20b094['where']=_[_0x0509('0x4a')](_0x20b094['where'],{'$or':_[_0x0509('0x3b')](_0x20b094[_0x0509('0x40')],function(_0x114453){var _0x30ecb1={};_0x30ecb1[_0x114453]={'$like':'%'+_0x227c6c[_0x0509('0x3c')]['filter']+'%'};return _0x30ecb1;})});}_0x20b094=_[_0x0509('0x4a')]({},_0x20b094,_0x227c6c['options']);return _0x1ab1fb['getDescriptions'](_0x20b094);}})[_0x0509('0x32')](function(_0x526e57){if(_0x526e57){_0x35aee3=_0x526e57[_0x0509('0x41')];if(!_0x227c6c[_0x0509('0x3c')]['hasOwnProperty']('nolimit')){_0x20b094['limit']=qs[_0x0509('0x43')](_0x227c6c[_0x0509('0x3c')][_0x0509('0x43')]);_0x20b094['offset']=qs[_0x0509('0x2a')](_0x227c6c[_0x0509('0x3c')][_0x0509('0x2a')]);}return _0x1ab1fb['getDescriptions'](_0x20b094);}})[_0x0509('0x32')](function(_0x5ecde7){if(_0x5ecde7){return _0x5ecde7?{'count':_0x35aee3,'rows':_0x5ecde7}:null;}})[_0x0509('0x32')](respondWithResult(_0x34c4bf,null))['catch'](handleError(_0x34c4bf,null));};exports[_0x0509('0x5d')]=function(_0x6b8638,_0xd9db3d,_0x53b1aa){var _0x2c283c={};var _0x5455c0={};var _0x3d61a5;var _0x7ff451;return db[_0x0509('0x4b')][_0x0509('0x59')]({'where':{'id':_0x6b8638[_0x0509('0x50')]['id']}})[_0x0509('0x32')](handleEntityNotFound(_0xd9db3d,null))['then'](function(_0x3a95da){if(_0x3a95da){_0x3d61a5=_0x3a95da;_0x5455c0[_0x0509('0x3d')]=_[_0x0509('0x51')](db['Tag'][_0x0509('0x37')]);_0x5455c0[_0x0509('0x3c')]=_['keys'](_0x6b8638[_0x0509('0x3c')]);_0x5455c0[_0x0509('0x47')]=_[_0x0509('0x3e')](_0x5455c0['model'],_0x5455c0[_0x0509('0x3c')]);_0x2c283c[_0x0509('0x40')]=_[_0x0509('0x3e')](_0x5455c0[_0x0509('0x3d')],qs['fields'](_0x6b8638[_0x0509('0x3c')][_0x0509('0x3f')]));_0x2c283c['attributes']=_0x2c283c[_0x0509('0x40')][_0x0509('0x41')]?_0x2c283c[_0x0509('0x40')]:_0x5455c0[_0x0509('0x3d')];_0x2c283c['order']=qs[_0x0509('0x45')](_0x6b8638['query']['sort']);_0x2c283c[_0x0509('0x46')]=qs[_0x0509('0x47')](_[_0x0509('0x48')](_0x6b8638[_0x0509('0x3c')],_0x5455c0[_0x0509('0x47')]));if(_0x6b8638[_0x0509('0x3c')][_0x0509('0x49')]){_0x2c283c[_0x0509('0x46')]=_[_0x0509('0x4a')](_0x2c283c['where'],{'$or':_[_0x0509('0x3b')](_0x2c283c[_0x0509('0x40')],function(_0x307fa7){var _0x436166={};_0x436166[_0x307fa7]={'$like':'%'+_0x6b8638[_0x0509('0x3c')][_0x0509('0x49')]+'%'};return _0x436166;})});}_0x2c283c=_[_0x0509('0x4a')]({},_0x2c283c,_0x6b8638[_0x0509('0x54')]);return _0x3d61a5[_0x0509('0x5d')](_0x2c283c);}})[_0x0509('0x32')](function(_0x19be44){if(_0x19be44){_0x7ff451=_0x19be44[_0x0509('0x41')];if(!_0x6b8638['query']['hasOwnProperty'](_0x0509('0x42'))){_0x2c283c[_0x0509('0x43')]=qs[_0x0509('0x43')](_0x6b8638[_0x0509('0x3c')]['limit']);_0x2c283c[_0x0509('0x2a')]=qs[_0x0509('0x2a')](_0x6b8638[_0x0509('0x3c')][_0x0509('0x2a')]);}return _0x3d61a5['getTags'](_0x2c283c);}})['then'](function(_0x3f29c3){if(_0x3f29c3){return _0x3f29c3?{'count':_0x7ff451,'rows':_0x3f29c3}:null;}})['then'](respondWithResult(_0xd9db3d,null))['catch'](handleError(_0xd9db3d,null));};exports[_0x0509('0x5e')]=function(_0x110e1a,_0x19f7d0,_0x29062c){if(_0x110e1a['body']['id']){delete _0x110e1a['body']['id'];}return db['DeskConfiguration'][_0x0509('0x59')]({'where':{'id':_0x110e1a['params']['id']}})['then'](handleEntityNotFound(_0x19f7d0,null))['then'](function(_0x40b609){if(_0x40b609){return _0x40b609[_0x0509('0x5e')](_0x110e1a[_0x0509('0x56')][_0x0509('0x5f')]||[]);}return null;})[_0x0509('0x32')](respondWithResult(_0x19f7d0,null))['catch'](handleError(_0x19f7d0,null));}; \ No newline at end of file +var _0xd6a9=['save','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','find','create','body','update','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','client','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','reject'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xd6a9,0x13f));var _0x9d6a=function(_0x24b666,_0x3500f7){_0x24b666=_0x24b666-0x0;var _0x47ae61=_0xd6a9[_0x24b666];return _0x47ae61;};'use strict';var pdf=require(_0x9d6a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d6a('0x1'));var jsonpatch=require(_0x9d6a('0x2'));var rp=require(_0x9d6a('0x3'));var moment=require(_0x9d6a('0x4'));var BPromise=require(_0x9d6a('0x5'));var Mustache=require(_0x9d6a('0x6'));var util=require(_0x9d6a('0x7'));var path=require(_0x9d6a('0x8'));var sox=require(_0x9d6a('0x9'));var csv=require(_0x9d6a('0xa'));var ejs=require(_0x9d6a('0xb'));var fs=require('fs');var fs_extra=require(_0x9d6a('0xc'));var _=require(_0x9d6a('0xd'));var squel=require(_0x9d6a('0xe'));var crypto=require(_0x9d6a('0xf'));var jsforce=require(_0x9d6a('0x10'));var deskjs=require(_0x9d6a('0x11'));var toCsv=require(_0x9d6a('0xa'));var querystring=require('querystring');var Papa=require(_0x9d6a('0x12'));var Redis=require('ioredis');var authService=require(_0x9d6a('0x13'));var qs=require(_0x9d6a('0x14'));var as=require(_0x9d6a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d6a('0x16'))('api');var utils=require(_0x9d6a('0x17'));var config=require(_0x9d6a('0x18'));var licenseUtil=require(_0x9d6a('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x9d6a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52eb8b,_0x4ee542,_0x44359e,_0x29eecc){return new BPromise(function(_0x45a9f9,_0x3bb8e7){var _0x22c310=_0x29eecc||client;return _0x22c310['request'](_0x52eb8b,_0x44359e)[_0x9d6a('0x1b')](function(_0x33f9dc){logger[_0x9d6a('0x1c')](_0x9d6a('0x1d'),_0x4ee542,_0x9d6a('0x1e'));logger['debug'](_0x9d6a('0x1f'),_0x4ee542,_0x9d6a('0x1e'),JSON['stringify'](_0x33f9dc));if(_0x33f9dc['error']){if(_0x33f9dc[_0x9d6a('0x20')]['code']===0x1f4){logger['error'](_0x9d6a('0x1d'),_0x4ee542,_0x33f9dc[_0x9d6a('0x20')][_0x9d6a('0x21')]);return _0x3bb8e7(_0x33f9dc['error'][_0x9d6a('0x21')]);}logger[_0x9d6a('0x20')](_0x9d6a('0x1d'),_0x4ee542,_0x33f9dc[_0x9d6a('0x20')][_0x9d6a('0x21')]);return _0x45a9f9(_0x33f9dc[_0x9d6a('0x20')][_0x9d6a('0x21')]);}else{logger[_0x9d6a('0x1c')]('DeskConfiguration,\x20%s,\x20%s',_0x4ee542,_0x9d6a('0x1e'));_0x45a9f9(_0x33f9dc[_0x9d6a('0x22')][_0x9d6a('0x21')]);}})[_0x9d6a('0x23')](function(_0xd578c8){logger[_0x9d6a('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x4ee542,_0xd578c8);_0x3bb8e7(_0xd578c8);});});}function respondWithStatusCode(_0x5cca1b,_0x90486d){_0x90486d=_0x90486d||0xcc;return function(_0x30b258){if(_0x30b258){return _0x5cca1b[_0x9d6a('0x24')](_0x90486d);}return _0x5cca1b['status'](_0x90486d)[_0x9d6a('0x25')]();};}function respondWithResult(_0x18d14a,_0x366c6e){_0x366c6e=_0x366c6e||0xc8;return function(_0x5d9d36){if(_0x5d9d36){return _0x18d14a[_0x9d6a('0x26')](_0x366c6e)[_0x9d6a('0x27')](_0x5d9d36);}};}function respondWithFilteredResult(_0x3e435f,_0x1fd7b2){return function(_0x4e0fa0){if(_0x4e0fa0){var _0x3393b2=_0x4e0fa0[_0x9d6a('0x28')],_0xd0f401=_0x1fd7b2[_0x9d6a('0x29')],_0x3575ac=_0x1fd7b2[_0x9d6a('0x29')]+_0x1fd7b2[_0x9d6a('0x2a')],_0x31c15f;if(_0x3575ac>=_0x3393b2){_0x3575ac=_0x3393b2;_0x31c15f=0xc8;}else{_0x31c15f=0xce;}_0x3e435f[_0x9d6a('0x26')](_0x31c15f);return _0x3e435f['set'](_0x9d6a('0x2b'),_0xd0f401+'-'+_0x3575ac+'/'+_0x3393b2)[_0x9d6a('0x27')](_0x4e0fa0);}return null;};}function patchUpdates(_0x2b0057){return function(_0x3ab0c3){try{jsonpatch['apply'](_0x3ab0c3,_0x2b0057,!![]);}catch(_0x48f900){return BPromise[_0x9d6a('0x2c')](_0x48f900);}return _0x3ab0c3[_0x9d6a('0x2d')]();};}function saveUpdates(_0x4d3862,_0x3f7379){return function(_0x16f298){if(_0x16f298){return _0x16f298['update'](_0x4d3862)['then'](function(_0x573b0c){return _0x573b0c;});}return null;};}function removeEntity(_0x4ed138,_0x42afe6){return function(_0x3ccb95){if(_0x3ccb95){return _0x3ccb95[_0x9d6a('0x2e')]()[_0x9d6a('0x1b')](function(){_0x4ed138['status'](0xcc)[_0x9d6a('0x25')]();});}};}function handleEntityNotFound(_0x1b4bb8,_0x4caec3){return function(_0x4605b0){if(!_0x4605b0){_0x1b4bb8[_0x9d6a('0x24')](0x194);}return _0x4605b0;};}function handleError(_0x43867a,_0x571916){_0x571916=_0x571916||0x1f4;return function(_0x346dfc){logger['error'](_0x346dfc[_0x9d6a('0x2f')]);if(_0x346dfc[_0x9d6a('0x30')]){delete _0x346dfc[_0x9d6a('0x30')];}_0x43867a[_0x9d6a('0x26')](_0x571916)[_0x9d6a('0x31')](_0x346dfc);};}exports[_0x9d6a('0x32')]=function(_0x3729ea,_0x405ba6){var _0x4156c4={},_0x5c39b5={},_0x5b4eb7={'count':0x0,'rows':[]};var _0x20c600=_[_0x9d6a('0x33')](db[_0x9d6a('0x34')][_0x9d6a('0x35')],function(_0x366910){return{'name':_0x366910[_0x9d6a('0x36')],'type':_0x366910[_0x9d6a('0x37')][_0x9d6a('0x38')]};});_0x5c39b5[_0x9d6a('0x39')]=_[_0x9d6a('0x33')](_0x20c600,'name');_0x5c39b5['query']=_[_0x9d6a('0x3a')](_0x3729ea[_0x9d6a('0x3b')]);_0x5c39b5[_0x9d6a('0x3c')]=_[_0x9d6a('0x3d')](_0x5c39b5['model'],_0x5c39b5[_0x9d6a('0x3b')]);_0x4156c4['attributes']=_['intersection'](_0x5c39b5['model'],qs[_0x9d6a('0x3e')](_0x3729ea[_0x9d6a('0x3b')]['fields']));_0x4156c4['attributes']=_0x4156c4['attributes'][_0x9d6a('0x3f')]?_0x4156c4[_0x9d6a('0x40')]:_0x5c39b5['model'];if(!_0x3729ea['query'][_0x9d6a('0x41')](_0x9d6a('0x42'))){_0x4156c4[_0x9d6a('0x2a')]=qs[_0x9d6a('0x2a')](_0x3729ea['query']['limit']);_0x4156c4[_0x9d6a('0x29')]=qs[_0x9d6a('0x29')](_0x3729ea[_0x9d6a('0x3b')][_0x9d6a('0x29')]);}_0x4156c4[_0x9d6a('0x43')]=qs[_0x9d6a('0x44')](_0x3729ea[_0x9d6a('0x3b')]['sort']);_0x4156c4[_0x9d6a('0x45')]=qs['filters'](_[_0x9d6a('0x46')](_0x3729ea['query'],_0x5c39b5['filters']),_0x20c600);if(_0x3729ea['query'][_0x9d6a('0x47')]){_0x4156c4['where']=_[_0x9d6a('0x48')](_0x4156c4[_0x9d6a('0x45')],{'$or':_['map'](_0x20c600,function(_0x3e4606){if(_0x3e4606[_0x9d6a('0x37')]!=='VIRTUAL'){var _0x1c0850={};_0x1c0850[_0x3e4606[_0x9d6a('0x30')]]={'$like':'%'+_0x3729ea['query']['filter']+'%'};return _0x1c0850;}})});}_0x4156c4=_[_0x9d6a('0x48')]({},_0x4156c4,_0x3729ea[_0x9d6a('0x49')]);var _0x3a3786={'where':_0x4156c4[_0x9d6a('0x45')]};return db[_0x9d6a('0x34')]['count'](_0x3a3786)['then'](function(_0x45560e){_0x5b4eb7[_0x9d6a('0x28')]=_0x45560e;if(_0x3729ea['query'][_0x9d6a('0x4a')]){_0x4156c4[_0x9d6a('0x4b')]=[{'all':!![]}];}return db[_0x9d6a('0x34')]['findAll'](_0x4156c4);})['then'](function(_0x135618){_0x5b4eb7['rows']=_0x135618;return _0x5b4eb7;})[_0x9d6a('0x1b')](respondWithFilteredResult(_0x405ba6,_0x4156c4))[_0x9d6a('0x23')](handleError(_0x405ba6,null));};exports[_0x9d6a('0x4c')]=function(_0x3fbe24,_0x54ab44){var _0x3ed66={'raw':![],'where':{'id':_0x3fbe24['params']['id']}},_0x48a1fe={};_0x48a1fe[_0x9d6a('0x39')]=_[_0x9d6a('0x3a')](db[_0x9d6a('0x34')][_0x9d6a('0x35')]);_0x48a1fe['query']=_[_0x9d6a('0x3a')](_0x3fbe24['query']);_0x48a1fe['filters']=_['intersection'](_0x48a1fe[_0x9d6a('0x39')],_0x48a1fe[_0x9d6a('0x3b')]);_0x3ed66['attributes']=_[_0x9d6a('0x3d')](_0x48a1fe[_0x9d6a('0x39')],qs[_0x9d6a('0x3e')](_0x3fbe24[_0x9d6a('0x3b')]['fields']));_0x3ed66['attributes']=_0x3ed66[_0x9d6a('0x40')][_0x9d6a('0x3f')]?_0x3ed66[_0x9d6a('0x40')]:_0x48a1fe[_0x9d6a('0x39')];if(_0x3fbe24['query'][_0x9d6a('0x4a')]){_0x3ed66[_0x9d6a('0x4b')]=[{'all':!![]}];}_0x3ed66=_[_0x9d6a('0x48')]({},_0x3ed66,_0x3fbe24[_0x9d6a('0x49')]);return db['DeskConfiguration'][_0x9d6a('0x4d')](_0x3ed66)['then'](handleEntityNotFound(_0x54ab44,null))[_0x9d6a('0x1b')](respondWithResult(_0x54ab44,null))[_0x9d6a('0x23')](handleError(_0x54ab44,null));};exports[_0x9d6a('0x4e')]=function(_0x1d4ca7,_0x146aee){return db['DeskConfiguration']['create'](_0x1d4ca7[_0x9d6a('0x4f')],{})[_0x9d6a('0x1b')](respondWithResult(_0x146aee,0xc9))['catch'](handleError(_0x146aee,null));};exports[_0x9d6a('0x50')]=function(_0x5c9905,_0x10301b){if(_0x5c9905[_0x9d6a('0x4f')]['id']){delete _0x5c9905[_0x9d6a('0x4f')]['id'];}return db[_0x9d6a('0x34')][_0x9d6a('0x4d')]({'where':{'id':_0x5c9905[_0x9d6a('0x51')]['id']}})[_0x9d6a('0x1b')](handleEntityNotFound(_0x10301b,null))[_0x9d6a('0x1b')](saveUpdates(_0x5c9905[_0x9d6a('0x4f')],null))[_0x9d6a('0x1b')](respondWithResult(_0x10301b,null))['catch'](handleError(_0x10301b,null));};exports[_0x9d6a('0x2e')]=function(_0x4ee02d,_0x2e0360){return db[_0x9d6a('0x34')]['find']({'where':{'id':_0x4ee02d[_0x9d6a('0x51')]['id']}})[_0x9d6a('0x1b')](handleEntityNotFound(_0x2e0360,null))['then'](removeEntity(_0x2e0360,null))[_0x9d6a('0x23')](handleError(_0x2e0360,null));};exports[_0x9d6a('0x52')]=function(_0x366855,_0x257333,_0x470fb5){var _0x131a10={};var _0x2e5f51={};var _0x3e2260;var _0x2ca5f6;return db[_0x9d6a('0x34')][_0x9d6a('0x53')]({'where':{'id':_0x366855['params']['id']}})[_0x9d6a('0x1b')](handleEntityNotFound(_0x257333,null))[_0x9d6a('0x1b')](function(_0x556467){if(_0x556467){_0x3e2260=_0x556467;_0x2e5f51[_0x9d6a('0x39')]=_[_0x9d6a('0x3a')](db[_0x9d6a('0x54')][_0x9d6a('0x35')]);_0x2e5f51['query']=_[_0x9d6a('0x3a')](_0x366855[_0x9d6a('0x3b')]);_0x2e5f51['filters']=_['intersection'](_0x2e5f51['model'],_0x2e5f51[_0x9d6a('0x3b')]);_0x131a10['attributes']=_[_0x9d6a('0x3d')](_0x2e5f51[_0x9d6a('0x39')],qs['fields'](_0x366855['query']['fields']));_0x131a10[_0x9d6a('0x40')]=_0x131a10[_0x9d6a('0x40')]['length']?_0x131a10['attributes']:_0x2e5f51[_0x9d6a('0x39')];_0x131a10['order']=qs[_0x9d6a('0x44')](_0x366855[_0x9d6a('0x3b')][_0x9d6a('0x44')]);_0x131a10[_0x9d6a('0x45')]=qs['filters'](_[_0x9d6a('0x46')](_0x366855[_0x9d6a('0x3b')],_0x2e5f51['filters']));if(_0x366855[_0x9d6a('0x3b')][_0x9d6a('0x47')]){_0x131a10[_0x9d6a('0x45')]=_[_0x9d6a('0x48')](_0x131a10[_0x9d6a('0x45')],{'$or':_[_0x9d6a('0x33')](_0x131a10[_0x9d6a('0x40')],function(_0x1cc239){var _0x2901fd={};_0x2901fd[_0x1cc239]={'$like':'%'+_0x366855['query'][_0x9d6a('0x47')]+'%'};return _0x2901fd;})});}_0x131a10=_[_0x9d6a('0x48')]({},_0x131a10,_0x366855[_0x9d6a('0x49')]);return _0x3e2260['getFields'](_0x131a10);}})['then'](function(_0x4170c5){if(_0x4170c5){_0x2ca5f6=_0x4170c5[_0x9d6a('0x3f')];if(!_0x366855[_0x9d6a('0x3b')][_0x9d6a('0x41')](_0x9d6a('0x42'))){_0x131a10['limit']=qs[_0x9d6a('0x2a')](_0x366855[_0x9d6a('0x3b')][_0x9d6a('0x2a')]);_0x131a10[_0x9d6a('0x29')]=qs[_0x9d6a('0x29')](_0x366855['query'][_0x9d6a('0x29')]);}return _0x3e2260[_0x9d6a('0x52')](_0x131a10);}})['then'](function(_0x54f7ad){if(_0x54f7ad){return _0x54f7ad?{'count':_0x2ca5f6,'rows':_0x54f7ad}:null;}})[_0x9d6a('0x1b')](respondWithResult(_0x257333,null))[_0x9d6a('0x23')](handleError(_0x257333,null));};exports[_0x9d6a('0x55')]=function(_0x791090,_0x3f1f98,_0x835f01){var _0x178d48={};var _0x54aba4={};var _0x509b04;var _0x1de50f;return db['DeskConfiguration'][_0x9d6a('0x53')]({'where':{'id':_0x791090[_0x9d6a('0x51')]['id']}})[_0x9d6a('0x1b')](handleEntityNotFound(_0x3f1f98,null))['then'](function(_0x234017){if(_0x234017){_0x509b04=_0x234017;_0x54aba4['model']=_[_0x9d6a('0x3a')](db[_0x9d6a('0x54')][_0x9d6a('0x35')]);_0x54aba4[_0x9d6a('0x3b')]=_[_0x9d6a('0x3a')](_0x791090[_0x9d6a('0x3b')]);_0x54aba4[_0x9d6a('0x3c')]=_[_0x9d6a('0x3d')](_0x54aba4[_0x9d6a('0x39')],_0x54aba4['query']);_0x178d48[_0x9d6a('0x40')]=_[_0x9d6a('0x3d')](_0x54aba4['model'],qs['fields'](_0x791090[_0x9d6a('0x3b')][_0x9d6a('0x3e')]));_0x178d48['attributes']=_0x178d48[_0x9d6a('0x40')][_0x9d6a('0x3f')]?_0x178d48['attributes']:_0x54aba4[_0x9d6a('0x39')];_0x178d48['order']=qs['sort'](_0x791090[_0x9d6a('0x3b')][_0x9d6a('0x44')]);_0x178d48[_0x9d6a('0x45')]=qs[_0x9d6a('0x3c')](_[_0x9d6a('0x46')](_0x791090['query'],_0x54aba4[_0x9d6a('0x3c')]));if(_0x791090[_0x9d6a('0x3b')][_0x9d6a('0x47')]){_0x178d48[_0x9d6a('0x45')]=_[_0x9d6a('0x48')](_0x178d48[_0x9d6a('0x45')],{'$or':_[_0x9d6a('0x33')](_0x178d48[_0x9d6a('0x40')],function(_0x3d6c53){var _0x201c63={};_0x201c63[_0x3d6c53]={'$like':'%'+_0x791090[_0x9d6a('0x3b')][_0x9d6a('0x47')]+'%'};return _0x201c63;})});}_0x178d48=_[_0x9d6a('0x48')]({},_0x178d48,_0x791090['options']);return _0x509b04[_0x9d6a('0x55')](_0x178d48);}})[_0x9d6a('0x1b')](function(_0x58313a){if(_0x58313a){_0x1de50f=_0x58313a['length'];if(!_0x791090[_0x9d6a('0x3b')][_0x9d6a('0x41')](_0x9d6a('0x42'))){_0x178d48['limit']=qs[_0x9d6a('0x2a')](_0x791090[_0x9d6a('0x3b')]['limit']);_0x178d48[_0x9d6a('0x29')]=qs['offset'](_0x791090['query'][_0x9d6a('0x29')]);}return _0x509b04[_0x9d6a('0x55')](_0x178d48);}})[_0x9d6a('0x1b')](function(_0x278bb1){if(_0x278bb1){return _0x278bb1?{'count':_0x1de50f,'rows':_0x278bb1}:null;}})[_0x9d6a('0x1b')](respondWithResult(_0x3f1f98,null))['catch'](handleError(_0x3f1f98,null));};exports[_0x9d6a('0x56')]=function(_0x45d7c5,_0x25b039,_0x3e75c0){var _0x264425={};var _0x2e026e={};var _0x2ff6b9;var _0x4f46bc;return db[_0x9d6a('0x34')]['findOne']({'where':{'id':_0x45d7c5[_0x9d6a('0x51')]['id']}})[_0x9d6a('0x1b')](handleEntityNotFound(_0x25b039,null))['then'](function(_0x1d2bbf){if(_0x1d2bbf){_0x2ff6b9=_0x1d2bbf;_0x2e026e[_0x9d6a('0x39')]=_['keys'](db[_0x9d6a('0x54')][_0x9d6a('0x35')]);_0x2e026e[_0x9d6a('0x3b')]=_[_0x9d6a('0x3a')](_0x45d7c5['query']);_0x2e026e[_0x9d6a('0x3c')]=_['intersection'](_0x2e026e[_0x9d6a('0x39')],_0x2e026e[_0x9d6a('0x3b')]);_0x264425[_0x9d6a('0x40')]=_[_0x9d6a('0x3d')](_0x2e026e['model'],qs[_0x9d6a('0x3e')](_0x45d7c5[_0x9d6a('0x3b')][_0x9d6a('0x3e')]));_0x264425[_0x9d6a('0x40')]=_0x264425[_0x9d6a('0x40')][_0x9d6a('0x3f')]?_0x264425[_0x9d6a('0x40')]:_0x2e026e[_0x9d6a('0x39')];_0x264425['order']=qs['sort'](_0x45d7c5[_0x9d6a('0x3b')][_0x9d6a('0x44')]);_0x264425[_0x9d6a('0x45')]=qs['filters'](_[_0x9d6a('0x46')](_0x45d7c5[_0x9d6a('0x3b')],_0x2e026e[_0x9d6a('0x3c')]));if(_0x45d7c5['query'][_0x9d6a('0x47')]){_0x264425[_0x9d6a('0x45')]=_[_0x9d6a('0x48')](_0x264425['where'],{'$or':_[_0x9d6a('0x33')](_0x264425[_0x9d6a('0x40')],function(_0x49cf19){var _0x527f01={};_0x527f01[_0x49cf19]={'$like':'%'+_0x45d7c5[_0x9d6a('0x3b')][_0x9d6a('0x47')]+'%'};return _0x527f01;})});}_0x264425=_[_0x9d6a('0x48')]({},_0x264425,_0x45d7c5[_0x9d6a('0x49')]);return _0x2ff6b9[_0x9d6a('0x56')](_0x264425);}})[_0x9d6a('0x1b')](function(_0x42e5a9){if(_0x42e5a9){_0x4f46bc=_0x42e5a9[_0x9d6a('0x3f')];if(!_0x45d7c5[_0x9d6a('0x3b')][_0x9d6a('0x41')](_0x9d6a('0x42'))){_0x264425[_0x9d6a('0x2a')]=qs['limit'](_0x45d7c5[_0x9d6a('0x3b')]['limit']);_0x264425['offset']=qs[_0x9d6a('0x29')](_0x45d7c5[_0x9d6a('0x3b')][_0x9d6a('0x29')]);}return _0x2ff6b9['getDescriptions'](_0x264425);}})[_0x9d6a('0x1b')](function(_0x5e2d36){if(_0x5e2d36){return _0x5e2d36?{'count':_0x4f46bc,'rows':_0x5e2d36}:null;}})['then'](respondWithResult(_0x25b039,null))[_0x9d6a('0x23')](handleError(_0x25b039,null));};exports[_0x9d6a('0x57')]=function(_0x5d4699,_0x2dec6a,_0x2dd8e4){var _0x1cce4e={};var _0x1d322f={};var _0x566036;var _0x1276c9;return db[_0x9d6a('0x34')][_0x9d6a('0x53')]({'where':{'id':_0x5d4699['params']['id']}})[_0x9d6a('0x1b')](handleEntityNotFound(_0x2dec6a,null))['then'](function(_0x4e9530){if(_0x4e9530){_0x566036=_0x4e9530;_0x1d322f[_0x9d6a('0x39')]=_[_0x9d6a('0x3a')](db[_0x9d6a('0x58')]['rawAttributes']);_0x1d322f[_0x9d6a('0x3b')]=_[_0x9d6a('0x3a')](_0x5d4699['query']);_0x1d322f[_0x9d6a('0x3c')]=_[_0x9d6a('0x3d')](_0x1d322f['model'],_0x1d322f[_0x9d6a('0x3b')]);_0x1cce4e[_0x9d6a('0x40')]=_[_0x9d6a('0x3d')](_0x1d322f[_0x9d6a('0x39')],qs[_0x9d6a('0x3e')](_0x5d4699[_0x9d6a('0x3b')][_0x9d6a('0x3e')]));_0x1cce4e[_0x9d6a('0x40')]=_0x1cce4e[_0x9d6a('0x40')][_0x9d6a('0x3f')]?_0x1cce4e['attributes']:_0x1d322f[_0x9d6a('0x39')];_0x1cce4e[_0x9d6a('0x43')]=qs['sort'](_0x5d4699['query']['sort']);_0x1cce4e[_0x9d6a('0x45')]=qs[_0x9d6a('0x3c')](_[_0x9d6a('0x46')](_0x5d4699[_0x9d6a('0x3b')],_0x1d322f['filters']));if(_0x5d4699['query']['filter']){_0x1cce4e[_0x9d6a('0x45')]=_[_0x9d6a('0x48')](_0x1cce4e['where'],{'$or':_[_0x9d6a('0x33')](_0x1cce4e[_0x9d6a('0x40')],function(_0x45050a){var _0x4b7ab4={};_0x4b7ab4[_0x45050a]={'$like':'%'+_0x5d4699[_0x9d6a('0x3b')]['filter']+'%'};return _0x4b7ab4;})});}_0x1cce4e=_['merge']({},_0x1cce4e,_0x5d4699[_0x9d6a('0x49')]);return _0x566036[_0x9d6a('0x57')](_0x1cce4e);}})[_0x9d6a('0x1b')](function(_0x7e2334){if(_0x7e2334){_0x1276c9=_0x7e2334[_0x9d6a('0x3f')];if(!_0x5d4699[_0x9d6a('0x3b')]['hasOwnProperty'](_0x9d6a('0x42'))){_0x1cce4e[_0x9d6a('0x2a')]=qs['limit'](_0x5d4699[_0x9d6a('0x3b')][_0x9d6a('0x2a')]);_0x1cce4e[_0x9d6a('0x29')]=qs[_0x9d6a('0x29')](_0x5d4699[_0x9d6a('0x3b')]['offset']);}return _0x566036[_0x9d6a('0x57')](_0x1cce4e);}})[_0x9d6a('0x1b')](function(_0x4e7165){if(_0x4e7165){return _0x4e7165?{'count':_0x1276c9,'rows':_0x4e7165}:null;}})[_0x9d6a('0x1b')](respondWithResult(_0x2dec6a,null))['catch'](handleError(_0x2dec6a,null));};exports[_0x9d6a('0x59')]=function(_0x392bf8,_0x40dde1,_0x4ca279){if(_0x392bf8['body']['id']){delete _0x392bf8[_0x9d6a('0x4f')]['id'];}return db[_0x9d6a('0x34')]['findOne']({'where':{'id':_0x392bf8[_0x9d6a('0x51')]['id']}})['then'](handleEntityNotFound(_0x40dde1,null))[_0x9d6a('0x1b')](function(_0xf0392f){if(_0xf0392f){return _0xf0392f[_0x9d6a('0x59')](_0x392bf8[_0x9d6a('0x4f')][_0x9d6a('0x5a')]||[]);}return null;})[_0x9d6a('0x1b')](respondWithResult(_0x40dde1,null))[_0x9d6a('0x23')](handleError(_0x40dde1,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index cf3ca97..b55b554 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 _0x0747=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x914a58,_0x43041c){var _0x325028=function(_0x180d78){while(--_0x180d78){_0x914a58['push'](_0x914a58['shift']());}};_0x325028(++_0x43041c);}(_0x0747,0xa1));var _0x7074=function(_0x4b87cf,_0x6a6415){_0x4b87cf=_0x4b87cf-0x0;var _0x2a519b=_0x0747[_0x4b87cf];return _0x2a519b;};'use strict';var _=require(_0x7074('0x0'));var util=require('util');var logger=require(_0x7074('0x1'))('api');var moment=require(_0x7074('0x2'));var BPromise=require('bluebird');var rp=require(_0x7074('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7074('0x4'));var config=require(_0x7074('0x5'));var attributes=require(_0x7074('0x6'));module['exports']=function(_0x128a9e,_0x4965a4){return _0x128a9e['define']('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6d8=['path','rimraf','../../config/environment','exports','define','int_desk_configurations','api','moment','bluebird','request-promise'];(function(_0x2d2aaf,_0x23e74a){var _0x16cf35=function(_0xb91ad9){while(--_0xb91ad9){_0x2d2aaf['push'](_0x2d2aaf['shift']());}};_0x16cf35(++_0x23e74a);}(_0xc6d8,0x196));var _0x8c6d=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0xc6d8[_0x1678c8];return _0x387aa9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8c6d('0x0'));var moment=require(_0x8c6d('0x1'));var BPromise=require(_0x8c6d('0x2'));var rp=require(_0x8c6d('0x3'));var fs=require('fs');var path=require(_0x8c6d('0x4'));var rimraf=require(_0x8c6d('0x5'));var config=require(_0x8c6d('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x8c6d('0x7')]=function(_0x2b2ed2,_0x7e1f43){return _0x2b2ed2[_0x8c6d('0x8')]('DeskConfiguration',attributes,{'tableName':_0x8c6d('0x9'),'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 8131199..960364c 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 _0x4f6f=['http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x10a214,_0x9fdf13){var _0x2007e2=function(_0x411cba){while(--_0x411cba){_0x10a214['push'](_0x10a214['shift']());}};_0x2007e2(++_0x9fdf13);}(_0x4f6f,0x157));var _0xf4f6=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x4f6f[_0x3ef2d5];return _0x2fefb2;};'use strict';var _=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var moment=require(_0xf4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4f6('0x4'))['db'];var utils=require(_0xf4f6('0x5'));var logger=require('../../config/logger')(_0xf4f6('0x6'));var config=require(_0xf4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4f6('0x8')][_0xf4f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dc7b9,_0x4fa106,_0x106455){return new BPromise(function(_0x592fa6,_0x483c82){return client[_0xf4f6('0xa')](_0x2dc7b9,_0x106455)[_0xf4f6('0xb')](function(_0x34bc5d){logger[_0xf4f6('0xc')](_0xf4f6('0xd'),_0x4fa106,_0xf4f6('0xe'));logger['debug'](_0xf4f6('0xf'),_0x4fa106,_0xf4f6('0xe'),JSON[_0xf4f6('0x10')](_0x34bc5d));if(_0x34bc5d[_0xf4f6('0x11')]){if(_0x34bc5d[_0xf4f6('0x11')][_0xf4f6('0x12')]===0x1f4){logger['error'](_0xf4f6('0xd'),_0x4fa106,_0x34bc5d[_0xf4f6('0x11')]['message']);return _0x483c82(_0x34bc5d['error'][_0xf4f6('0x13')]);}logger[_0xf4f6('0x11')](_0xf4f6('0xd'),_0x4fa106,_0x34bc5d['error'][_0xf4f6('0x13')]);return _0x592fa6(_0x34bc5d[_0xf4f6('0x11')][_0xf4f6('0x13')]);}else{logger['info'](_0xf4f6('0xd'),_0x4fa106,'request\x20sent');_0x592fa6(_0x34bc5d[_0xf4f6('0x14')][_0xf4f6('0x13')]);}})[_0xf4f6('0x15')](function(_0x522af3){logger[_0xf4f6('0x11')](_0xf4f6('0xd'),_0x4fa106,_0x522af3);_0x483c82(_0x522af3);});});} \ No newline at end of file +var _0x87ae=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0x87ae,0xf5));var _0xe87a=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x87ae[_0x355ce8];return _0x1db8b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe87a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe87a('0x1'));var db=require(_0xe87a('0x2'))['db'];var utils=require(_0xe87a('0x3'));var logger=require('../../config/logger')(_0xe87a('0x4'));var config=require(_0xe87a('0x5'));var jayson=require(_0xe87a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x125dd3,_0x2fbd6b,_0x5dff22){return new BPromise(function(_0x379db4,_0x455b3a){return client['request'](_0x125dd3,_0x5dff22)[_0xe87a('0x7')](function(_0x278d7c){logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));logger[_0xe87a('0xa')](_0xe87a('0xb'),_0x2fbd6b,_0xe87a('0x9'),JSON[_0xe87a('0xc')](_0x278d7c));if(_0x278d7c['error']){if(_0x278d7c['error'][_0xe87a('0xd')]===0x1f4){logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c['error'][_0xe87a('0xf')]);return _0x455b3a(_0x278d7c[_0xe87a('0xe')]['message']);}logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c[_0xe87a('0xe')]['message']);return _0x379db4(_0x278d7c['error']['message']);}else{logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));_0x379db4(_0x278d7c[_0xe87a('0x10')][_0xe87a('0xf')]);}})['catch'](function(_0x415147){logger[_0xe87a('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x2fbd6b,_0x415147);_0x455b3a(_0x415147);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6a50f1b..5f61170 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x6aead1,_0x52c8b2){_0x6aead1=_0x6aead1-0x0;var _0x31369d=_0x7a54[_0x6aead1];return _0x31369d;};'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 fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x7a54,0x106));var _0x47a5=function(_0x4adba9,_0x43d2e4){_0x4adba9=_0x4adba9-0x0;var _0xd121e0=_0x7a54[_0x4adba9];return _0xd121e0;};'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 fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('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 163d690..48185a1 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 _0x38c4=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x38c4,0xbb));var _0x438c=function(_0x4aa965,_0x2e77eb){_0x4aa965=_0x4aa965-0x0;var _0x38ac24=_0x38c4[_0x4aa965];return _0x38ac24;};'use strict';var Sequelize=require(_0x438c('0x0'));module[_0x438c('0x1')]={'type':{'type':Sequelize[_0x438c('0x2')](_0x438c('0x3'),_0x438c('0x4'),_0x438c('0x5'),_0x438c('0x6'),_0x438c('0x7')),'defaultValue':_0x438c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x438c('0x8')]},'keyType':{'type':Sequelize[_0x438c('0x2')](_0x438c('0x3'),_0x438c('0x4'),_0x438c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x26d1=['string','STRING','ENUM','BOOLEAN','variable','customVariable','keyValue','picklist'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x26d1,0x7c));var _0x126d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x26d1[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x126d('0x0'),_0x126d('0x1'),_0x126d('0x2'),_0x126d('0x3')),'defaultValue':_0x126d('0x4')},'content':{'type':Sequelize[_0x126d('0x5')]},'key':{'type':Sequelize[_0x126d('0x5')]},'keyType':{'type':Sequelize[_0x126d('0x6')]('string',_0x126d('0x0'),_0x126d('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x126d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x126d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x126d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 63f48b6..00aa2a2 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 _0x11b3=['sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','index','map','DeskField','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','includeAll','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0x11b3,0xba));var _0x311b=function(_0x1cf838,_0x30bac8){_0x1cf838=_0x1cf838-0x0;var _0x3284f2=_0x11b3[_0x1cf838];return _0x3284f2;};'use strict';var pdf=require(_0x311b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x311b('0x1'));var zipdir=require(_0x311b('0x2'));var jsonpatch=require(_0x311b('0x3'));var rp=require(_0x311b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x311b('0x5'));var util=require(_0x311b('0x6'));var path=require(_0x311b('0x7'));var sox=require(_0x311b('0x8'));var csv=require(_0x311b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x311b('0xa'));var _=require(_0x311b('0xb'));var squel=require(_0x311b('0xc'));var crypto=require(_0x311b('0xd'));var jsforce=require(_0x311b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x311b('0x9'));var querystring=require(_0x311b('0xf'));var Papa=require(_0x311b('0x10'));var Redis=require(_0x311b('0x11'));var authService=require(_0x311b('0x12'));var qs=require(_0x311b('0x13'));var as=require(_0x311b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x311b('0x15'))(_0x311b('0x16'));var utils=require('../../config/utils');var config=require(_0x311b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34ed33,_0x2802a4){_0x2802a4=_0x2802a4||0xcc;return function(_0x59cd5e){if(_0x59cd5e){return _0x34ed33[_0x311b('0x18')](_0x2802a4);}return _0x34ed33['status'](_0x2802a4)[_0x311b('0x19')]();};}function respondWithResult(_0x3bf3e0,_0x3ddaf9){_0x3ddaf9=_0x3ddaf9||0xc8;return function(_0x3cddc9){if(_0x3cddc9){return _0x3bf3e0[_0x311b('0x1a')](_0x3ddaf9)[_0x311b('0x1b')](_0x3cddc9);}};}function respondWithFilteredResult(_0x4ac3d8,_0x4892d1){return function(_0x20487d){if(_0x20487d){var _0x3c6bdc=_0x20487d[_0x311b('0x1c')],_0x52082f=_0x4892d1[_0x311b('0x1d')],_0x3ab59c=_0x4892d1['offset']+_0x4892d1[_0x311b('0x1e')],_0x182e21;if(_0x3ab59c>=_0x3c6bdc){_0x3ab59c=_0x3c6bdc;_0x182e21=0xc8;}else{_0x182e21=0xce;}_0x4ac3d8[_0x311b('0x1a')](_0x182e21);return _0x4ac3d8['set'](_0x311b('0x1f'),_0x52082f+'-'+_0x3ab59c+'/'+_0x3c6bdc)[_0x311b('0x1b')](_0x20487d);}return null;};}function patchUpdates(_0x2e1da3){return function(_0x373fb8){try{jsonpatch[_0x311b('0x20')](_0x373fb8,_0x2e1da3,!![]);}catch(_0x22c5ee){return BPromise[_0x311b('0x21')](_0x22c5ee);}return _0x373fb8[_0x311b('0x22')]();};}function saveUpdates(_0x20e33d,_0x2e7cc6){return function(_0xe1ba9d){if(_0xe1ba9d){return _0xe1ba9d[_0x311b('0x23')](_0x20e33d)[_0x311b('0x24')](function(_0x2f73c9){return _0x2f73c9;});}return null;};}function removeEntity(_0x56fa1,_0x3a17f7){return function(_0x5c2ec0){if(_0x5c2ec0){return _0x5c2ec0[_0x311b('0x25')]()['then'](function(){_0x56fa1[_0x311b('0x1a')](0xcc)[_0x311b('0x19')]();});}};}function handleEntityNotFound(_0x500c5c,_0x3c300f){return function(_0x4b9772){if(!_0x4b9772){_0x500c5c[_0x311b('0x18')](0x194);}return _0x4b9772;};}function handleError(_0x387998,_0x1a9031){_0x1a9031=_0x1a9031||0x1f4;return function(_0xf66145){logger['error'](_0xf66145['stack']);if(_0xf66145[_0x311b('0x26')]){delete _0xf66145[_0x311b('0x26')];}_0x387998[_0x311b('0x1a')](_0x1a9031)['send'](_0xf66145);};}exports[_0x311b('0x27')]=function(_0x6d0a6c,_0x20fde6){var _0x139ceb={},_0x1ae713={},_0x19f9ca={'count':0x0,'rows':[]};var _0x232557=_[_0x311b('0x28')](db[_0x311b('0x29')][_0x311b('0x2a')],function(_0x43bb7d){return{'name':_0x43bb7d[_0x311b('0x2b')],'type':_0x43bb7d[_0x311b('0x2c')][_0x311b('0x2d')]};});_0x1ae713['model']=_[_0x311b('0x28')](_0x232557,_0x311b('0x26'));_0x1ae713[_0x311b('0x2e')]=_[_0x311b('0x2f')](_0x6d0a6c[_0x311b('0x2e')]);_0x1ae713['filters']=_[_0x311b('0x30')](_0x1ae713[_0x311b('0x31')],_0x1ae713[_0x311b('0x2e')]);_0x139ceb[_0x311b('0x32')]=_[_0x311b('0x30')](_0x1ae713[_0x311b('0x31')],qs[_0x311b('0x33')](_0x6d0a6c[_0x311b('0x2e')][_0x311b('0x33')]));_0x139ceb[_0x311b('0x32')]=_0x139ceb['attributes']['length']?_0x139ceb[_0x311b('0x32')]:_0x1ae713[_0x311b('0x31')];if(!_0x6d0a6c['query'][_0x311b('0x34')](_0x311b('0x35'))){_0x139ceb['limit']=qs[_0x311b('0x1e')](_0x6d0a6c[_0x311b('0x2e')][_0x311b('0x1e')]);_0x139ceb[_0x311b('0x1d')]=qs[_0x311b('0x1d')](_0x6d0a6c[_0x311b('0x2e')][_0x311b('0x1d')]);}_0x139ceb['order']=qs['sort'](_0x6d0a6c[_0x311b('0x2e')][_0x311b('0x36')]);_0x139ceb[_0x311b('0x37')]=qs[_0x311b('0x38')](_[_0x311b('0x39')](_0x6d0a6c['query'],_0x1ae713[_0x311b('0x38')]),_0x232557);if(_0x6d0a6c[_0x311b('0x2e')][_0x311b('0x3a')]){_0x139ceb['where']=_[_0x311b('0x3b')](_0x139ceb['where'],{'$or':_[_0x311b('0x28')](_0x232557,function(_0x571b74){if(_0x571b74['type']!==_0x311b('0x3c')){var _0x1febc9={};_0x1febc9[_0x571b74[_0x311b('0x26')]]={'$like':'%'+_0x6d0a6c[_0x311b('0x2e')][_0x311b('0x3a')]+'%'};return _0x1febc9;}})});}_0x139ceb=_['merge']({},_0x139ceb,_0x6d0a6c[_0x311b('0x3d')]);var _0x288c7d={'where':_0x139ceb[_0x311b('0x37')]};return db[_0x311b('0x29')][_0x311b('0x1c')](_0x288c7d)['then'](function(_0x654c71){_0x19f9ca[_0x311b('0x1c')]=_0x654c71;if(_0x6d0a6c[_0x311b('0x2e')]['includeAll']){_0x139ceb[_0x311b('0x3e')]=[{'all':!![]}];}return db[_0x311b('0x29')][_0x311b('0x3f')](_0x139ceb);})[_0x311b('0x24')](function(_0x40b809){_0x19f9ca['rows']=_0x40b809;return _0x19f9ca;})[_0x311b('0x24')](respondWithFilteredResult(_0x20fde6,_0x139ceb))[_0x311b('0x40')](handleError(_0x20fde6,null));};exports['show']=function(_0x517931,_0x741161){var _0x5a610a={'raw':!![],'where':{'id':_0x517931['params']['id']}},_0x3e4d96={};_0x3e4d96[_0x311b('0x31')]=_[_0x311b('0x2f')](db[_0x311b('0x29')][_0x311b('0x2a')]);_0x3e4d96[_0x311b('0x2e')]=_[_0x311b('0x2f')](_0x517931[_0x311b('0x2e')]);_0x3e4d96[_0x311b('0x38')]=_[_0x311b('0x30')](_0x3e4d96[_0x311b('0x31')],_0x3e4d96[_0x311b('0x2e')]);_0x5a610a['attributes']=_[_0x311b('0x30')](_0x3e4d96[_0x311b('0x31')],qs['fields'](_0x517931[_0x311b('0x2e')][_0x311b('0x33')]));_0x5a610a[_0x311b('0x32')]=_0x5a610a[_0x311b('0x32')]['length']?_0x5a610a[_0x311b('0x32')]:_0x3e4d96[_0x311b('0x31')];if(_0x517931[_0x311b('0x2e')][_0x311b('0x41')]){_0x5a610a[_0x311b('0x3e')]=[{'all':!![]}];}_0x5a610a=_[_0x311b('0x3b')]({},_0x5a610a,_0x517931[_0x311b('0x3d')]);return db[_0x311b('0x29')][_0x311b('0x42')](_0x5a610a)[_0x311b('0x24')](handleEntityNotFound(_0x741161,null))[_0x311b('0x24')](respondWithResult(_0x741161,null))[_0x311b('0x40')](handleError(_0x741161,null));};exports[_0x311b('0x43')]=function(_0x27450d,_0x278b5d){return db['DeskField']['create'](_0x27450d[_0x311b('0x44')],{})[_0x311b('0x24')](respondWithResult(_0x278b5d,0xc9))['catch'](handleError(_0x278b5d,null));};exports[_0x311b('0x23')]=function(_0x4793b9,_0x14ebeb){if(_0x4793b9[_0x311b('0x44')]['id']){delete _0x4793b9[_0x311b('0x44')]['id'];}return db[_0x311b('0x29')][_0x311b('0x42')]({'where':{'id':_0x4793b9[_0x311b('0x45')]['id']}})[_0x311b('0x24')](handleEntityNotFound(_0x14ebeb,null))[_0x311b('0x24')](saveUpdates(_0x4793b9[_0x311b('0x44')],null))[_0x311b('0x24')](respondWithResult(_0x14ebeb,null))[_0x311b('0x40')](handleError(_0x14ebeb,null));};exports[_0x311b('0x25')]=function(_0x32147b,_0xb718e5){return db[_0x311b('0x29')][_0x311b('0x42')]({'where':{'id':_0x32147b[_0x311b('0x45')]['id']}})[_0x311b('0x24')](handleEntityNotFound(_0xb718e5,null))[_0x311b('0x24')](removeEntity(_0xb718e5,null))[_0x311b('0x40')](handleError(_0xb718e5,null));}; \ No newline at end of file +var _0x6594=['rawAttributes','type','key','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','DeskField','count','include','findAll','catch','params','keys','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','save','update','then','destroy','error','name','index','map'];(function(_0x2d3e8a,_0x2f2c61){var _0x4c0ec2=function(_0x31b84b){while(--_0x31b84b){_0x2d3e8a['push'](_0x2d3e8a['shift']());}};_0x4c0ec2(++_0x2f2c61);}(_0x6594,0x100));var _0x4659=function(_0x44278,_0x1bd66f){_0x44278=_0x44278-0x0;var _0x2d97f9=_0x6594[_0x44278];return _0x2d97f9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4659('0x0'));var rimraf=require(_0x4659('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4659('0x2'));var rp=require(_0x4659('0x3'));var moment=require(_0x4659('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4659('0x5'));var path=require(_0x4659('0x6'));var sox=require(_0x4659('0x7'));var csv=require(_0x4659('0x8'));var ejs=require(_0x4659('0x9'));var fs=require('fs');var fs_extra=require(_0x4659('0xa'));var _=require(_0x4659('0xb'));var squel=require(_0x4659('0xc'));var crypto=require(_0x4659('0xd'));var jsforce=require(_0x4659('0xe'));var deskjs=require(_0x4659('0xf'));var toCsv=require(_0x4659('0x8'));var querystring=require(_0x4659('0x10'));var Papa=require(_0x4659('0x11'));var Redis=require(_0x4659('0x12'));var authService=require(_0x4659('0x13'));var qs=require(_0x4659('0x14'));var as=require(_0x4659('0x15'));var hardwareService=require(_0x4659('0x16'));var logger=require(_0x4659('0x17'))(_0x4659('0x18'));var utils=require(_0x4659('0x19'));var config=require(_0x4659('0x1a'));var licenseUtil=require(_0x4659('0x1b'));var db=require(_0x4659('0x1c'))['db'];function respondWithStatusCode(_0x47184d,_0x3fed50){_0x3fed50=_0x3fed50||0xcc;return function(_0x3b126b){if(_0x3b126b){return _0x47184d[_0x4659('0x1d')](_0x3fed50);}return _0x47184d[_0x4659('0x1e')](_0x3fed50)[_0x4659('0x1f')]();};}function respondWithResult(_0x280f69,_0x5a5329){_0x5a5329=_0x5a5329||0xc8;return function(_0x31bcc8){if(_0x31bcc8){return _0x280f69[_0x4659('0x1e')](_0x5a5329)[_0x4659('0x20')](_0x31bcc8);}};}function respondWithFilteredResult(_0x187669,_0x38e569){return function(_0x53aeae){if(_0x53aeae){var _0x483216=_0x53aeae['count'],_0x10e219=_0x38e569[_0x4659('0x21')],_0x1918ea=_0x38e569[_0x4659('0x21')]+_0x38e569['limit'],_0x16e19c;if(_0x1918ea>=_0x483216){_0x1918ea=_0x483216;_0x16e19c=0xc8;}else{_0x16e19c=0xce;}_0x187669[_0x4659('0x1e')](_0x16e19c);return _0x187669['set'](_0x4659('0x22'),_0x10e219+'-'+_0x1918ea+'/'+_0x483216)[_0x4659('0x20')](_0x53aeae);}return null;};}function patchUpdates(_0xf63636){return function(_0x204b59){try{jsonpatch[_0x4659('0x23')](_0x204b59,_0xf63636,!![]);}catch(_0x19b925){return BPromise['reject'](_0x19b925);}return _0x204b59[_0x4659('0x24')]();};}function saveUpdates(_0x307baa,_0x3547e3){return function(_0x4edc86){if(_0x4edc86){return _0x4edc86[_0x4659('0x25')](_0x307baa)[_0x4659('0x26')](function(_0x4a53a8){return _0x4a53a8;});}return null;};}function removeEntity(_0x76d8bd,_0x1b25bf){return function(_0x1ca517){if(_0x1ca517){return _0x1ca517[_0x4659('0x27')]()[_0x4659('0x26')](function(){_0x76d8bd[_0x4659('0x1e')](0xcc)[_0x4659('0x1f')]();});}};}function handleEntityNotFound(_0x22ae90,_0x5e5e52){return function(_0x2e06a){if(!_0x2e06a){_0x22ae90[_0x4659('0x1d')](0x194);}return _0x2e06a;};}function handleError(_0x79bb4b,_0x2021aa){_0x2021aa=_0x2021aa||0x1f4;return function(_0x1d4991){logger[_0x4659('0x28')](_0x1d4991['stack']);if(_0x1d4991[_0x4659('0x29')]){delete _0x1d4991['name'];}_0x79bb4b[_0x4659('0x1e')](_0x2021aa)['send'](_0x1d4991);};}exports[_0x4659('0x2a')]=function(_0xb4206d,_0x4f2f25){var _0x3087b0={},_0x2034f4={},_0x433b11={'count':0x0,'rows':[]};var _0x876b18=_[_0x4659('0x2b')](db['DeskField'][_0x4659('0x2c')],function(_0x428ea4){return{'name':_0x428ea4['fieldName'],'type':_0x428ea4[_0x4659('0x2d')][_0x4659('0x2e')]};});_0x2034f4['model']=_[_0x4659('0x2b')](_0x876b18,'name');_0x2034f4[_0x4659('0x2f')]=_['keys'](_0xb4206d[_0x4659('0x2f')]);_0x2034f4[_0x4659('0x30')]=_['intersection'](_0x2034f4['model'],_0x2034f4[_0x4659('0x2f')]);_0x3087b0[_0x4659('0x31')]=_[_0x4659('0x32')](_0x2034f4['model'],qs['fields'](_0xb4206d['query'][_0x4659('0x33')]));_0x3087b0[_0x4659('0x31')]=_0x3087b0['attributes'][_0x4659('0x34')]?_0x3087b0[_0x4659('0x31')]:_0x2034f4[_0x4659('0x35')];if(!_0xb4206d[_0x4659('0x2f')][_0x4659('0x36')](_0x4659('0x37'))){_0x3087b0['limit']=qs[_0x4659('0x38')](_0xb4206d[_0x4659('0x2f')][_0x4659('0x38')]);_0x3087b0[_0x4659('0x21')]=qs[_0x4659('0x21')](_0xb4206d[_0x4659('0x2f')][_0x4659('0x21')]);}_0x3087b0[_0x4659('0x39')]=qs[_0x4659('0x3a')](_0xb4206d['query'][_0x4659('0x3a')]);_0x3087b0[_0x4659('0x3b')]=qs[_0x4659('0x30')](_['pick'](_0xb4206d[_0x4659('0x2f')],_0x2034f4[_0x4659('0x30')]),_0x876b18);if(_0xb4206d[_0x4659('0x2f')][_0x4659('0x3c')]){_0x3087b0[_0x4659('0x3b')]=_[_0x4659('0x3d')](_0x3087b0[_0x4659('0x3b')],{'$or':_[_0x4659('0x2b')](_0x876b18,function(_0x298b84){if(_0x298b84[_0x4659('0x2d')]!==_0x4659('0x3e')){var _0x5f55ef={};_0x5f55ef[_0x298b84[_0x4659('0x29')]]={'$like':'%'+_0xb4206d[_0x4659('0x2f')][_0x4659('0x3c')]+'%'};return _0x5f55ef;}})});}_0x3087b0=_['merge']({},_0x3087b0,_0xb4206d[_0x4659('0x3f')]);var _0x42ad02={'where':_0x3087b0[_0x4659('0x3b')]};return db[_0x4659('0x40')]['count'](_0x42ad02)[_0x4659('0x26')](function(_0x2a0731){_0x433b11[_0x4659('0x41')]=_0x2a0731;if(_0xb4206d['query']['includeAll']){_0x3087b0[_0x4659('0x42')]=[{'all':!![]}];}return db[_0x4659('0x40')][_0x4659('0x43')](_0x3087b0);})[_0x4659('0x26')](function(_0x3f347f){_0x433b11['rows']=_0x3f347f;return _0x433b11;})['then'](respondWithFilteredResult(_0x4f2f25,_0x3087b0))[_0x4659('0x44')](handleError(_0x4f2f25,null));};exports['show']=function(_0x1d478f,_0x4a9c23){var _0x5ac1ae={'raw':!![],'where':{'id':_0x1d478f[_0x4659('0x45')]['id']}},_0x4c898c={};_0x4c898c[_0x4659('0x35')]=_[_0x4659('0x46')](db[_0x4659('0x40')][_0x4659('0x2c')]);_0x4c898c[_0x4659('0x2f')]=_[_0x4659('0x46')](_0x1d478f[_0x4659('0x2f')]);_0x4c898c[_0x4659('0x30')]=_[_0x4659('0x32')](_0x4c898c[_0x4659('0x35')],_0x4c898c[_0x4659('0x2f')]);_0x5ac1ae['attributes']=_[_0x4659('0x32')](_0x4c898c['model'],qs[_0x4659('0x33')](_0x1d478f[_0x4659('0x2f')][_0x4659('0x33')]));_0x5ac1ae[_0x4659('0x31')]=_0x5ac1ae[_0x4659('0x31')]['length']?_0x5ac1ae[_0x4659('0x31')]:_0x4c898c['model'];if(_0x1d478f[_0x4659('0x2f')][_0x4659('0x47')]){_0x5ac1ae[_0x4659('0x42')]=[{'all':!![]}];}_0x5ac1ae=_[_0x4659('0x3d')]({},_0x5ac1ae,_0x1d478f[_0x4659('0x3f')]);return db['DeskField'][_0x4659('0x48')](_0x5ac1ae)[_0x4659('0x26')](handleEntityNotFound(_0x4a9c23,null))[_0x4659('0x26')](respondWithResult(_0x4a9c23,null))[_0x4659('0x44')](handleError(_0x4a9c23,null));};exports['create']=function(_0x564ebb,_0x30275a){return db[_0x4659('0x40')][_0x4659('0x49')](_0x564ebb[_0x4659('0x4a')],{})[_0x4659('0x26')](respondWithResult(_0x30275a,0xc9))[_0x4659('0x44')](handleError(_0x30275a,null));};exports[_0x4659('0x25')]=function(_0x357c64,_0x485273){if(_0x357c64[_0x4659('0x4a')]['id']){delete _0x357c64[_0x4659('0x4a')]['id'];}return db[_0x4659('0x40')]['find']({'where':{'id':_0x357c64['params']['id']}})[_0x4659('0x26')](handleEntityNotFound(_0x485273,null))[_0x4659('0x26')](saveUpdates(_0x357c64[_0x4659('0x4a')],null))[_0x4659('0x26')](respondWithResult(_0x485273,null))['catch'](handleError(_0x485273,null));};exports[_0x4659('0x27')]=function(_0x5d6fc7,_0x2bde6d){return db['DeskField'][_0x4659('0x48')]({'where':{'id':_0x5d6fc7[_0x4659('0x45')]['id']}})[_0x4659('0x26')](handleEntityNotFound(_0x2bde6d,null))['then'](removeEntity(_0x2bde6d,null))[_0x4659('0x44')](handleError(_0x2bde6d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d91b44b..6c6b8e0 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 _0x265a=['idField','lodash','util','api','moment','request-promise','path','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index'];(function(_0x85a7f7,_0x1ed1ad){var _0x180fe2=function(_0xe797a3){while(--_0xe797a3){_0x85a7f7['push'](_0x85a7f7['shift']());}};_0x180fe2(++_0x1ed1ad);}(_0x265a,0x9d));var _0xa265=function(_0x40fabb,_0x4e01a9){_0x40fabb=_0x40fabb-0x0;var _0x575bc3=_0x265a[_0x40fabb];return _0x575bc3;};'use strict';var _=require(_0xa265('0x0'));var util=require(_0xa265('0x1'));var logger=require('../../config/logger')(_0xa265('0x2'));var moment=require(_0xa265('0x3'));var BPromise=require('bluebird');var rp=require(_0xa265('0x4'));var fs=require('fs');var path=require(_0xa265('0x5'));var rimraf=require('rimraf');var config=require(_0xa265('0x6'));var attributes=require(_0xa265('0x7'));module[_0xa265('0x8')]=function(_0x1988d5,_0x475f5c){return _0x1988d5['define'](_0xa265('0x9'),attributes,{'tableName':_0xa265('0xa'),'paranoid':![],'indexes':[{'name':_0xa265('0xb'),'fields':[_0xa265('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02d3=['exports','define','int_desk_fields','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x5e6cee,_0x2f0936){var _0x5e858b=function(_0x97e736){while(--_0x97e736){_0x5e6cee['push'](_0x5e6cee['shift']());}};_0x5e858b(++_0x2f0936);}(_0x02d3,0x17f));var _0x302d=function(_0x10ca16,_0xf68ed7){_0x10ca16=_0x10ca16-0x0;var _0x7b057=_0x02d3[_0x10ca16];return _0x7b057;};'use strict';var _=require(_0x302d('0x0'));var util=require(_0x302d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x302d('0x2'));var BPromise=require(_0x302d('0x3'));var rp=require(_0x302d('0x4'));var fs=require('fs');var path=require(_0x302d('0x5'));var rimraf=require(_0x302d('0x6'));var config=require(_0x302d('0x7'));var attributes=require(_0x302d('0x8'));module[_0x302d('0x9')]=function(_0x5b494e,_0x31b162){return _0x5b494e[_0x302d('0xa')]('DeskField',attributes,{'tableName':_0x302d('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x302d('0xc'),_0x302d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 956019f..69204dd 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 _0x8220=['then','debug','request\x20sent','error','message','info','DeskField,\x20%s,\x20%s','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x4271eb,_0x31d891){var _0x1ed1ea=function(_0x1c508c){while(--_0x1c508c){_0x4271eb['push'](_0x4271eb['shift']());}};_0x1ed1ea(++_0x31d891);}(_0x8220,0xa1));var _0x0822=function(_0x51276e,_0x28b616){_0x51276e=_0x51276e-0x0;var _0x1f5f30=_0x8220[_0x51276e];return _0x1f5f30;};'use strict';var _=require('lodash');var util=require(_0x0822('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0822('0x1'));var fs=require('fs');var Redis=require(_0x0822('0x2'));var db=require(_0x0822('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0822('0x4'))('rpc');var config=require(_0x0822('0x5'));var jayson=require(_0x0822('0x6'));var client=jayson[_0x0822('0x7')][_0x0822('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ba4d9,_0x120ffc,_0x447ecf){return new BPromise(function(_0x4464ba,_0x49ff93){return client[_0x0822('0x9')](_0x4ba4d9,_0x447ecf)[_0x0822('0xa')](function(_0x3d59ed){logger['info']('DeskField,\x20%s,\x20%s',_0x120ffc,'request\x20sent');logger[_0x0822('0xb')]('DeskField,\x20%s,\x20%s,\x20%s',_0x120ffc,_0x0822('0xc'),JSON['stringify'](_0x3d59ed));if(_0x3d59ed[_0x0822('0xd')]){if(_0x3d59ed[_0x0822('0xd')]['code']===0x1f4){logger[_0x0822('0xd')]('DeskField,\x20%s,\x20%s',_0x120ffc,_0x3d59ed[_0x0822('0xd')][_0x0822('0xe')]);return _0x49ff93(_0x3d59ed['error']['message']);}logger[_0x0822('0xd')]('DeskField,\x20%s,\x20%s',_0x120ffc,_0x3d59ed['error'][_0x0822('0xe')]);return _0x4464ba(_0x3d59ed[_0x0822('0xd')][_0x0822('0xe')]);}else{logger[_0x0822('0xf')](_0x0822('0x10'),_0x120ffc,_0x0822('0xc'));_0x4464ba(_0x3d59ed[_0x0822('0x11')][_0x0822('0xe')]);}})[_0x0822('0x12')](function(_0xf1e0f1){logger['error'](_0x0822('0x10'),_0x120ffc,_0xf1e0f1);_0x49ff93(_0xf1e0f1);});});} \ No newline at end of file +var _0xf826=['info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x155104,_0x3fb3f0){var _0x4956ee=function(_0x2538e9){while(--_0x2538e9){_0x155104['push'](_0x155104['shift']());}};_0x4956ee(++_0x3fb3f0);}(_0xf826,0x192));var _0x6f82=function(_0x2df56b,_0x33e930){_0x2df56b=_0x2df56b-0x0;var _0xefbd37=_0xf826[_0x2df56b];return _0xefbd37;};'use strict';var _=require(_0x6f82('0x0'));var util=require(_0x6f82('0x1'));var moment=require('moment');var BPromise=require(_0x6f82('0x2'));var rs=require(_0x6f82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6f82('0x4'));var logger=require('../../config/logger')(_0x6f82('0x5'));var config=require(_0x6f82('0x6'));var jayson=require(_0x6f82('0x7'));var client=jayson[_0x6f82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x588761,_0x4298c6,_0x26e6e2){return new BPromise(function(_0x562b2a,_0x28b330){return client[_0x6f82('0x9')](_0x588761,_0x26e6e2)['then'](function(_0x2b667d){logger['info'](_0x6f82('0xa'),_0x4298c6,_0x6f82('0xb'));logger[_0x6f82('0xc')](_0x6f82('0xd'),_0x4298c6,_0x6f82('0xb'),JSON[_0x6f82('0xe')](_0x2b667d));if(_0x2b667d[_0x6f82('0xf')]){if(_0x2b667d[_0x6f82('0xf')][_0x6f82('0x10')]===0x1f4){logger[_0x6f82('0xf')]('DeskField,\x20%s,\x20%s',_0x4298c6,_0x2b667d[_0x6f82('0xf')][_0x6f82('0x11')]);return _0x28b330(_0x2b667d[_0x6f82('0xf')]['message']);}logger[_0x6f82('0xf')]('DeskField,\x20%s,\x20%s',_0x4298c6,_0x2b667d[_0x6f82('0xf')][_0x6f82('0x11')]);return _0x562b2a(_0x2b667d[_0x6f82('0xf')][_0x6f82('0x11')]);}else{logger[_0x6f82('0x12')](_0x6f82('0xa'),_0x4298c6,_0x6f82('0xb'));_0x562b2a(_0x2b667d[_0x6f82('0x13')][_0x6f82('0x11')]);}})[_0x6f82('0x14')](function(_0x42525c){logger[_0x6f82('0xf')]('DeskField,\x20%s,\x20%s',_0x4298c6,_0x42525c);_0x28b330(_0x42525c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ab61173..b8a7895 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 _0x1f69=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x3278f1,_0x4f9f6b){var _0x508d44=function(_0x128bca){while(--_0x128bca){_0x3278f1['push'](_0x3278f1['shift']());}};_0x508d44(++_0x4f9f6b);}(_0x1f69,0xe1));var _0x91f6=function(_0x4915ad,_0x1ce15e){_0x4915ad=_0x4915ad-0x0;var _0x34b9ff=_0x1f69[_0x4915ad];return _0x34b9ff;};'use strict';var multer=require(_0x91f6('0x0'));var util=require(_0x91f6('0x1'));var path=require(_0x91f6('0x2'));var timeout=require(_0x91f6('0x3'));var express=require(_0x91f6('0x4'));var router=express[_0x91f6('0x5')]();var fs_extra=require(_0x91f6('0x6'));var auth=require(_0x91f6('0x7'));var interaction=require(_0x91f6('0x8'));var config=require(_0x91f6('0x9'));var controller=require(_0x91f6('0xa'));router[_0x91f6('0xb')]('/',auth['isAuthenticated'](),controller[_0x91f6('0xc')]);router['get'](_0x91f6('0xd'),auth[_0x91f6('0xe')](),controller['show']);router[_0x91f6('0xb')](_0x91f6('0xf'),auth['isAuthenticated'](),controller[_0x91f6('0x10')]);router[_0x91f6('0xb')](_0x91f6('0x11'),auth[_0x91f6('0xe')](),controller[_0x91f6('0x12')]);router[_0x91f6('0x13')]('/',auth[_0x91f6('0xe')](),controller[_0x91f6('0x14')]);router[_0x91f6('0x13')](_0x91f6('0xf'),auth[_0x91f6('0xe')](),controller[_0x91f6('0x15')]);router[_0x91f6('0x16')]('/:id',auth[_0x91f6('0xe')](),controller[_0x91f6('0x17')]);router[_0x91f6('0x18')](_0x91f6('0xd'),auth[_0x91f6('0xe')](),controller[_0x91f6('0x19')]);module[_0x91f6('0x1a')]=router; \ No newline at end of file +var _0xbcf8=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x90e575,_0x48c2ec){var _0x1aae60=function(_0x4e40cf){while(--_0x4e40cf){_0x90e575['push'](_0x90e575['shift']());}};_0x1aae60(++_0x48c2ec);}(_0xbcf8,0x1db));var _0x8bcf=function(_0x232ba4,_0x1eb213){_0x232ba4=_0x232ba4-0x0;var _0x3849b2=_0xbcf8[_0x232ba4];return _0x3849b2;};'use strict';var multer=require(_0x8bcf('0x0'));var util=require(_0x8bcf('0x1'));var path=require(_0x8bcf('0x2'));var timeout=require(_0x8bcf('0x3'));var express=require(_0x8bcf('0x4'));var router=express[_0x8bcf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8bcf('0x6'));var interaction=require(_0x8bcf('0x7'));var config=require(_0x8bcf('0x8'));var controller=require(_0x8bcf('0x9'));router[_0x8bcf('0xa')]('/',auth[_0x8bcf('0xb')](),controller[_0x8bcf('0xc')]);router[_0x8bcf('0xa')](_0x8bcf('0xd'),auth['isAuthenticated'](),controller[_0x8bcf('0xe')]);router['get'](_0x8bcf('0xf'),auth[_0x8bcf('0xb')](),controller[_0x8bcf('0x10')]);router[_0x8bcf('0xa')](_0x8bcf('0x11'),auth[_0x8bcf('0xb')](),controller[_0x8bcf('0x12')]);router[_0x8bcf('0x13')]('/',auth[_0x8bcf('0xb')](),controller[_0x8bcf('0x14')]);router['post'](_0x8bcf('0xf'),auth[_0x8bcf('0xb')](),controller[_0x8bcf('0x15')]);router[_0x8bcf('0x16')](_0x8bcf('0xd'),auth[_0x8bcf('0xb')](),controller[_0x8bcf('0x17')]);router[_0x8bcf('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x8bcf('0x19')]);module[_0x8bcf('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 9cf9d99..9c9d034 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 _0xd3cc=['STRING','exports'];(function(_0x2d328f,_0x16ddd3){var _0x16af1d=function(_0x16b42a){while(--_0x16b42a){_0x2d328f['push'](_0x2d328f['shift']());}};_0x16af1d(++_0x16ddd3);}(_0xd3cc,0x199));var _0xcd3c=function(_0xb1dcb3,_0x8f9af8){_0xb1dcb3=_0xb1dcb3-0x0;var _0x18dd46=_0xd3cc[_0xb1dcb3];return _0x18dd46;};'use strict';var Sequelize=require('sequelize');module[_0xcd3c('0x0')]={'name':{'type':Sequelize[_0xcd3c('0x1')]},'username':{'type':Sequelize[_0xcd3c('0x1')]},'password':{'type':Sequelize[_0xcd3c('0x1')]},'remoteUri':{'type':Sequelize[_0xcd3c('0x1')]},'tenantId':{'type':Sequelize[_0xcd3c('0x1')]},'clientId':{'type':Sequelize[_0xcd3c('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xcd3c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xcd3c('0x1')]}}; \ No newline at end of file +var _0x0594=['STRING','sequelize','exports'];(function(_0x372df5,_0xf9b6fd){var _0x3f725c=function(_0x141714){while(--_0x141714){_0x372df5['push'](_0x372df5['shift']());}};_0x3f725c(++_0xf9b6fd);}(_0x0594,0x15d));var _0x4059=function(_0xf5d6a2,_0x5deea9){_0xf5d6a2=_0xf5d6a2-0x0;var _0x414b03=_0x0594[_0xf5d6a2];return _0x414b03;};'use strict';var Sequelize=require(_0x4059('0x0'));module[_0x4059('0x1')]={'name':{'type':Sequelize[_0x4059('0x2')]},'username':{'type':Sequelize[_0x4059('0x2')]},'password':{'type':Sequelize[_0x4059('0x2')]},'remoteUri':{'type':Sequelize[_0x4059('0x2')]},'tenantId':{'type':Sequelize[_0x4059('0x2')]},'clientId':{'type':Sequelize[_0x4059('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4059('0x2')],'allowNull':![]},'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 6256b81..226d6fc 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 _0xb5d4=['rows','params','find','create','body','findOne','Dynamics365Configuration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','getFields','ticketType','incident','PhoneCall','title','ownerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','false','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include'];(function(_0x42d57e,_0xc97350){var _0x43e193=function(_0x47a16e){while(--_0x47a16e){_0x42d57e['push'](_0x42d57e['shift']());}};_0x43e193(++_0xc97350);}(_0xb5d4,0x165));var _0x4b5d=function(_0x52715d,_0x28927d){_0x52715d=_0x52715d-0x0;var _0x344e39=_0xb5d4[_0x52715d];return _0x344e39;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4b5d('0x0'));var rimraf=require(_0x4b5d('0x1'));var zipdir=require(_0x4b5d('0x2'));var jsonpatch=require(_0x4b5d('0x3'));var rp=require(_0x4b5d('0x4'));var moment=require(_0x4b5d('0x5'));var BPromise=require(_0x4b5d('0x6'));var Mustache=require(_0x4b5d('0x7'));var util=require('util');var path=require(_0x4b5d('0x8'));var sox=require(_0x4b5d('0x9'));var csv=require(_0x4b5d('0xa'));var ejs=require(_0x4b5d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b5d('0xc'));var squel=require(_0x4b5d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b5d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b5d('0xf'));var authService=require(_0x4b5d('0x10'));var qs=require(_0x4b5d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b5d('0x12'))(_0x4b5d('0x13'));var utils=require(_0x4b5d('0x14'));var config=require(_0x4b5d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b5d('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x4b5d('0x17'));var client=jayson[_0x4b5d('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57ede2,_0x23c2f6,_0x927d26,_0x555a93){return new BPromise(function(_0x1277d5,_0x54314a){var _0x59ebd3=_0x555a93||client;return _0x59ebd3['request'](_0x57ede2,_0x927d26)['then'](function(_0x42c048){logger[_0x4b5d('0x19')]('Dynamics365Account,\x20%s,\x20%s',_0x23c2f6,'request\x20sent');logger[_0x4b5d('0x1a')](_0x4b5d('0x1b'),_0x23c2f6,_0x4b5d('0x1c'),JSON[_0x4b5d('0x1d')](_0x42c048));if(_0x42c048[_0x4b5d('0x1e')]){if(_0x42c048['error'][_0x4b5d('0x1f')]===0x1f4){logger[_0x4b5d('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x23c2f6,_0x42c048['error']['message']);return _0x54314a(_0x42c048[_0x4b5d('0x1e')][_0x4b5d('0x20')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x23c2f6,_0x42c048[_0x4b5d('0x1e')]['message']);return _0x1277d5(_0x42c048[_0x4b5d('0x1e')]['message']);}else{logger[_0x4b5d('0x19')](_0x4b5d('0x21'),_0x23c2f6,_0x4b5d('0x1c'));_0x1277d5(_0x42c048[_0x4b5d('0x22')][_0x4b5d('0x20')]);}})[_0x4b5d('0x23')](function(_0x3f865d){logger[_0x4b5d('0x1e')](_0x4b5d('0x21'),_0x23c2f6,_0x3f865d);_0x54314a(_0x3f865d);});});}function respondWithStatusCode(_0x1618d1,_0x2a90b7){_0x2a90b7=_0x2a90b7||0xcc;return function(_0x43b4fa){if(_0x43b4fa){return _0x1618d1[_0x4b5d('0x24')](_0x2a90b7);}return _0x1618d1['status'](_0x2a90b7)[_0x4b5d('0x25')]();};}function respondWithResult(_0xda4366,_0x36c761){_0x36c761=_0x36c761||0xc8;return function(_0x456169){if(_0x456169){return _0xda4366[_0x4b5d('0x26')](_0x36c761)['json'](_0x456169);}};}function respondWithFilteredResult(_0x4fe624,_0x1e7752){return function(_0x26f465){if(_0x26f465){var _0x5b0a30=_0x26f465['count'],_0xa04aa0=_0x1e7752[_0x4b5d('0x27')],_0x513d50=_0x1e7752[_0x4b5d('0x27')]+_0x1e7752[_0x4b5d('0x28')],_0x121d4f;if(_0x513d50>=_0x5b0a30){_0x513d50=_0x5b0a30;_0x121d4f=0xc8;}else{_0x121d4f=0xce;}_0x4fe624[_0x4b5d('0x26')](_0x121d4f);return _0x4fe624[_0x4b5d('0x29')](_0x4b5d('0x2a'),_0xa04aa0+'-'+_0x513d50+'/'+_0x5b0a30)['json'](_0x26f465);}return null;};}function patchUpdates(_0x2e88bd){return function(_0x362eb7){try{jsonpatch['apply'](_0x362eb7,_0x2e88bd,!![]);}catch(_0x3074b3){return BPromise[_0x4b5d('0x2b')](_0x3074b3);}return _0x362eb7[_0x4b5d('0x2c')]();};}function saveUpdates(_0x32ce6f,_0x341b2a){return function(_0x254f4d){if(_0x254f4d){return _0x254f4d[_0x4b5d('0x2d')](_0x32ce6f)[_0x4b5d('0x2e')](function(_0x3822c6){return _0x3822c6;});}return null;};}function removeEntity(_0x4ff92d,_0x1cc5cb){return function(_0x1f52d7){if(_0x1f52d7){return _0x1f52d7[_0x4b5d('0x2f')]()[_0x4b5d('0x2e')](function(){_0x4ff92d[_0x4b5d('0x26')](0xcc)[_0x4b5d('0x25')]();});}};}function handleEntityNotFound(_0x5d8b6f,_0x5d9f41){return function(_0x3ebd4c){if(!_0x3ebd4c){_0x5d8b6f[_0x4b5d('0x24')](0x194);}return _0x3ebd4c;};}function handleError(_0x47b342,_0x3b9832){_0x3b9832=_0x3b9832||0x1f4;return function(_0x37cf8f){logger[_0x4b5d('0x1e')](_0x37cf8f[_0x4b5d('0x30')]);if(_0x37cf8f[_0x4b5d('0x31')]){delete _0x37cf8f['name'];}_0x47b342[_0x4b5d('0x26')](_0x3b9832)['send'](_0x37cf8f);};}exports[_0x4b5d('0x32')]=function(_0x37d1b9,_0x38efee){var _0x3bf130={},_0x51ad75={},_0x4bba0f={'count':0x0,'rows':[]};var _0x2b17c2=_[_0x4b5d('0x33')](db[_0x4b5d('0x34')][_0x4b5d('0x35')],function(_0x16788d){return{'name':_0x16788d[_0x4b5d('0x36')],'type':_0x16788d['type'][_0x4b5d('0x37')]};});_0x51ad75['model']=_[_0x4b5d('0x33')](_0x2b17c2,_0x4b5d('0x31'));_0x51ad75[_0x4b5d('0x38')]=_[_0x4b5d('0x39')](_0x37d1b9['query']);_0x51ad75[_0x4b5d('0x3a')]=_[_0x4b5d('0x3b')](_0x51ad75[_0x4b5d('0x3c')],_0x51ad75[_0x4b5d('0x38')]);_0x3bf130['attributes']=_[_0x4b5d('0x3b')](_0x51ad75[_0x4b5d('0x3c')],qs['fields'](_0x37d1b9['query'][_0x4b5d('0x3d')]));_0x3bf130[_0x4b5d('0x3e')]=_0x3bf130['attributes'][_0x4b5d('0x3f')]?_0x3bf130[_0x4b5d('0x3e')]:_0x51ad75[_0x4b5d('0x3c')];if(!_0x37d1b9[_0x4b5d('0x38')]['hasOwnProperty'](_0x4b5d('0x40'))){_0x3bf130[_0x4b5d('0x28')]=qs[_0x4b5d('0x28')](_0x37d1b9['query'][_0x4b5d('0x28')]);_0x3bf130[_0x4b5d('0x27')]=qs[_0x4b5d('0x27')](_0x37d1b9[_0x4b5d('0x38')][_0x4b5d('0x27')]);}_0x3bf130[_0x4b5d('0x41')]=qs[_0x4b5d('0x42')](_0x37d1b9[_0x4b5d('0x38')][_0x4b5d('0x42')]);_0x3bf130[_0x4b5d('0x43')]=qs[_0x4b5d('0x3a')](_[_0x4b5d('0x44')](_0x37d1b9[_0x4b5d('0x38')],_0x51ad75[_0x4b5d('0x3a')]),_0x2b17c2);if(_0x37d1b9[_0x4b5d('0x38')][_0x4b5d('0x45')]){_0x3bf130['where']=_[_0x4b5d('0x46')](_0x3bf130[_0x4b5d('0x43')],{'$or':_[_0x4b5d('0x33')](_0x2b17c2,function(_0x364fc5){if(_0x364fc5[_0x4b5d('0x47')]!==_0x4b5d('0x48')){var _0x2efb34={};_0x2efb34[_0x364fc5[_0x4b5d('0x31')]]={'$like':'%'+_0x37d1b9['query'][_0x4b5d('0x45')]+'%'};return _0x2efb34;}})});}_0x3bf130=_[_0x4b5d('0x46')]({},_0x3bf130,_0x37d1b9[_0x4b5d('0x49')]);var _0x25f61f={'where':_0x3bf130[_0x4b5d('0x43')]};return db[_0x4b5d('0x34')][_0x4b5d('0x4a')](_0x25f61f)[_0x4b5d('0x2e')](function(_0x280f3c){_0x4bba0f[_0x4b5d('0x4a')]=_0x280f3c;if(_0x37d1b9['query'][_0x4b5d('0x4b')]){_0x3bf130[_0x4b5d('0x4c')]=[{'all':!![]}];}return db[_0x4b5d('0x34')]['findAll'](_0x3bf130);})[_0x4b5d('0x2e')](function(_0x21e5d4){_0x4bba0f[_0x4b5d('0x4d')]=_0x21e5d4;return _0x4bba0f;})[_0x4b5d('0x2e')](respondWithFilteredResult(_0x38efee,_0x3bf130))['catch'](handleError(_0x38efee,null));};exports['show']=function(_0x65a54f,_0x4ca7ac){var _0x1136e3={'raw':![],'where':{'id':_0x65a54f[_0x4b5d('0x4e')]['id']}},_0x361591={};_0x361591[_0x4b5d('0x3c')]=_[_0x4b5d('0x39')](db[_0x4b5d('0x34')][_0x4b5d('0x35')]);_0x361591[_0x4b5d('0x38')]=_['keys'](_0x65a54f[_0x4b5d('0x38')]);_0x361591['filters']=_[_0x4b5d('0x3b')](_0x361591[_0x4b5d('0x3c')],_0x361591[_0x4b5d('0x38')]);_0x1136e3[_0x4b5d('0x3e')]=_[_0x4b5d('0x3b')](_0x361591[_0x4b5d('0x3c')],qs['fields'](_0x65a54f['query']['fields']));_0x1136e3['attributes']=_0x1136e3[_0x4b5d('0x3e')][_0x4b5d('0x3f')]?_0x1136e3[_0x4b5d('0x3e')]:_0x361591[_0x4b5d('0x3c')];if(_0x65a54f['query'][_0x4b5d('0x4b')]){_0x1136e3['include']=[{'all':!![]}];}_0x1136e3=_[_0x4b5d('0x46')]({},_0x1136e3,_0x65a54f[_0x4b5d('0x49')]);return db[_0x4b5d('0x34')][_0x4b5d('0x4f')](_0x1136e3)[_0x4b5d('0x2e')](handleEntityNotFound(_0x4ca7ac,null))[_0x4b5d('0x2e')](respondWithResult(_0x4ca7ac,null))[_0x4b5d('0x23')](handleError(_0x4ca7ac,null));};exports[_0x4b5d('0x50')]=function(_0x46efce,_0x7a9a6){return db[_0x4b5d('0x34')][_0x4b5d('0x50')](_0x46efce[_0x4b5d('0x51')],{})['then'](respondWithResult(_0x7a9a6,0xc9))[_0x4b5d('0x23')](handleError(_0x7a9a6,null));};exports[_0x4b5d('0x2d')]=function(_0x1bbc5a,_0x2c7b56){if(_0x1bbc5a[_0x4b5d('0x51')]['id']){delete _0x1bbc5a[_0x4b5d('0x51')]['id'];}return db[_0x4b5d('0x34')][_0x4b5d('0x4f')]({'where':{'id':_0x1bbc5a['params']['id']}})[_0x4b5d('0x2e')](handleEntityNotFound(_0x2c7b56,null))[_0x4b5d('0x2e')](saveUpdates(_0x1bbc5a[_0x4b5d('0x51')],null))[_0x4b5d('0x2e')](respondWithResult(_0x2c7b56,null))[_0x4b5d('0x23')](handleError(_0x2c7b56,null));};exports[_0x4b5d('0x2f')]=function(_0x124c04,_0x4b1f6a){return db[_0x4b5d('0x34')]['find']({'where':{'id':_0x124c04[_0x4b5d('0x4e')]['id']}})[_0x4b5d('0x2e')](handleEntityNotFound(_0x4b1f6a,null))[_0x4b5d('0x2e')](removeEntity(_0x4b1f6a,null))[_0x4b5d('0x23')](handleError(_0x4b1f6a,null));};exports['getConfigurations']=function(_0x267656,_0x2d073b,_0x4d9021){var _0x5656b5={};var _0x5e1693={};var _0x19b2ff;var _0xae1e2;return db[_0x4b5d('0x34')][_0x4b5d('0x52')]({'where':{'id':_0x267656[_0x4b5d('0x4e')]['id']}})[_0x4b5d('0x2e')](handleEntityNotFound(_0x2d073b,null))[_0x4b5d('0x2e')](function(_0x43c411){if(_0x43c411){_0x19b2ff=_0x43c411;_0x5e1693['model']=_['keys'](db[_0x4b5d('0x53')][_0x4b5d('0x35')]);_0x5e1693['query']=_[_0x4b5d('0x39')](_0x267656[_0x4b5d('0x38')]);_0x5e1693['filters']=_[_0x4b5d('0x3b')](_0x5e1693[_0x4b5d('0x3c')],_0x5e1693['query']);_0x5656b5[_0x4b5d('0x3e')]=_[_0x4b5d('0x3b')](_0x5e1693[_0x4b5d('0x3c')],qs['fields'](_0x267656[_0x4b5d('0x38')][_0x4b5d('0x3d')]));_0x5656b5[_0x4b5d('0x3e')]=_0x5656b5[_0x4b5d('0x3e')][_0x4b5d('0x3f')]?_0x5656b5[_0x4b5d('0x3e')]:_0x5e1693[_0x4b5d('0x3c')];_0x5656b5['order']=qs['sort'](_0x267656[_0x4b5d('0x38')][_0x4b5d('0x42')]);_0x5656b5[_0x4b5d('0x43')]=qs['filters'](_['pick'](_0x267656[_0x4b5d('0x38')],_0x5e1693[_0x4b5d('0x3a')]));if(_0x267656[_0x4b5d('0x38')][_0x4b5d('0x45')]){_0x5656b5[_0x4b5d('0x43')]=_[_0x4b5d('0x46')](_0x5656b5[_0x4b5d('0x43')],{'$or':_[_0x4b5d('0x33')](_0x5656b5[_0x4b5d('0x3e')],function(_0x29efc5){var _0x1bfd81={};_0x1bfd81[_0x29efc5]={'$like':'%'+_0x267656[_0x4b5d('0x38')][_0x4b5d('0x45')]+'%'};return _0x1bfd81;})});}_0x5656b5=_[_0x4b5d('0x46')]({},_0x5656b5,_0x267656[_0x4b5d('0x49')]);return _0x19b2ff[_0x4b5d('0x54')](_0x5656b5);}})['then'](function(_0x6bb92){if(_0x6bb92){_0xae1e2=_0x6bb92[_0x4b5d('0x3f')];if(!_0x267656[_0x4b5d('0x38')][_0x4b5d('0x55')](_0x4b5d('0x40'))){_0x5656b5['limit']=qs[_0x4b5d('0x28')](_0x267656[_0x4b5d('0x38')][_0x4b5d('0x28')]);_0x5656b5['offset']=qs[_0x4b5d('0x27')](_0x267656[_0x4b5d('0x38')]['offset']);}return _0x19b2ff[_0x4b5d('0x54')](_0x5656b5);}})[_0x4b5d('0x2e')](function(_0x1cf9d4){if(_0x1cf9d4){return _0x1cf9d4?{'count':_0xae1e2,'rows':_0x1cf9d4}:null;}})[_0x4b5d('0x2e')](respondWithResult(_0x2d073b,null))[_0x4b5d('0x23')](handleError(_0x2d073b,null));};exports[_0x4b5d('0x56')]=function(_0x5f2da1,_0x326de7,_0x420005){if(_0x5f2da1[_0x4b5d('0x51')]['id']){delete _0x5f2da1['body']['id'];}return db[_0x4b5d('0x34')][_0x4b5d('0x52')]({'where':{'id':_0x5f2da1['params']['id']}})[_0x4b5d('0x2e')](handleEntityNotFound(_0x326de7,null))[_0x4b5d('0x2e')](function(_0x1f5f53){if(_0x1f5f53){_0x5f2da1[_0x4b5d('0x51')][_0x4b5d('0x57')]=_0x1f5f53['id'];_0x5f2da1[_0x4b5d('0x51')][_0x4b5d('0x58')]=integrations[_0x4b5d('0x59')](_0x5f2da1['body'][_0x4b5d('0x5a')],_0x5f2da1[_0x4b5d('0x51')][_0x4b5d('0x47')]);_0x5f2da1[_0x4b5d('0x51')]['Descriptions']=integrations[_0x4b5d('0x5b')](_0x5f2da1[_0x4b5d('0x51')]['channel'],_0x5f2da1[_0x4b5d('0x51')][_0x4b5d('0x47')]);return db[_0x4b5d('0x53')]['create'](_0x5f2da1[_0x4b5d('0x51')],{'include':[{'model':db[_0x4b5d('0x5c')],'as':_0x4b5d('0x58')},{'model':db[_0x4b5d('0x5c')],'as':_0x4b5d('0x5d')}]});}return null;})['then'](respondWithResult(_0x326de7,null))[_0x4b5d('0x23')](handleError(_0x326de7,null));};exports[_0x4b5d('0x5e')]=function(_0x68dc90,_0x31eb3a,_0x552b4f){var _0x4478a5=_0x68dc90[_0x4b5d('0x38')][_0x4b5d('0x5f')];var _0x4a6528=_0x4478a5===_0x4b5d('0x60')?'Incident':_0x4b5d('0x61');var _0x1ea53b='';var _0x1bd127='';var _0x41797e='';var _0x51a35d='';var _0x3b9706='';var _0x3c74db='';var _0x18fa63='';var _0x34597e='';var _0x2ff58f=[_0x4b5d('0x62'),'description','customerid',_0x4b5d('0x63'),'caseorigincode',_0x4b5d('0x64'),'phonenumber',_0x4b5d('0x65'),_0x4b5d('0x66'),_0x4b5d('0x67')];var _0x2f397c=[_0x4b5d('0x68'),'accountidyominame',_0x4b5d('0x69'),_0x4b5d('0x6a'),_0x4b5d('0x6b'),_0x4b5d('0x6c'),'contractdetailidname',_0x4b5d('0x6d'),_0x4b5d('0x6e'),_0x4b5d('0x6f'),_0x4b5d('0x70'),_0x4b5d('0x71'),_0x4b5d('0x72'),_0x4b5d('0x73'),_0x4b5d('0x74'),_0x4b5d('0x75'),_0x4b5d('0x76'),'customeridyominame',_0x4b5d('0x77'),_0x4b5d('0x78'),'entityimage_timestamp',_0x4b5d('0x79'),_0x4b5d('0x7a'),_0x4b5d('0x7b'),'firstresponsebykpiidname','followupby',_0x4b5d('0x7c'),_0x4b5d('0x7d'),_0x4b5d('0x7e'),_0x4b5d('0x7f'),'masteridname',_0x4b5d('0x80'),_0x4b5d('0x81'),_0x4b5d('0x82'),_0x4b5d('0x83'),_0x4b5d('0x84'),_0x4b5d('0x85'),_0x4b5d('0x86'),_0x4b5d('0x87'),_0x4b5d('0x88'),_0x4b5d('0x89'),_0x4b5d('0x8a'),_0x4b5d('0x8b'),_0x4b5d('0x8c'),_0x4b5d('0x8d'),'owneridyominame',_0x4b5d('0x8e'),_0x4b5d('0x8f'),_0x4b5d('0x90'),_0x4b5d('0x91'),_0x4b5d('0x92'),_0x4b5d('0x93'),_0x4b5d('0x94'),_0x4b5d('0x95'),_0x4b5d('0x96'),_0x4b5d('0x97'),_0x4b5d('0x98'),_0x4b5d('0x99'),'slainvokedidname',_0x4b5d('0x9a'),_0x4b5d('0x9b'),_0x4b5d('0x9c'),_0x4b5d('0x9d'),_0x4b5d('0x9e'),_0x4b5d('0x9f'),_0x4b5d('0xa0'),_0x4b5d('0xa1'),_0x4b5d('0xa2'),'utcconversiontimezonecode',_0x4b5d('0xa3')];var _0x500d61=_0x2ff58f[_0x4b5d('0xa4')](_0x2f397c);return db[_0x4b5d('0x34')][_0x4b5d('0x52')]({'where':{'id':_0x68dc90[_0x4b5d('0x4e')]['id']},'attributes':['id',_0x4b5d('0xa5'),'password',_0x4b5d('0xa6'),_0x4b5d('0xa7'),_0x4b5d('0xa8'),_0x4b5d('0xa9')]})['then'](handleEntityNotFound(_0x31eb3a,null))['then'](function(_0x43ed04){if(_0x43ed04){_0x34597e=_0x43ed04['remoteUri'];var _0x5df842=_0x34597e[_0x4b5d('0xaa')](-0x1);if(_0x5df842==='/'){_0x34597e=_0x34597e[_0x4b5d('0xab')](0x0,_0x34597e[_0x4b5d('0xac')](_0x5df842));}_0x18fa63=util[_0x4b5d('0xad')](_0x4b5d('0xae'),_0x34597e);var _0xc155c3={'method':_0x4b5d('0xaf'),'uri':_0x4b5d('0xb0')+_0x43ed04[_0x4b5d('0xa7')]+_0x4b5d('0xb1'),'form':{'client_id':_0x43ed04['clientId'],'resource':_0x34597e,'username':_0x43ed04[_0x4b5d('0xa5')],'password':_0x43ed04[_0x4b5d('0xb2')],'grant_type':_0x4b5d('0xb2'),'client_secret':_0x43ed04['clientSecret']},'json':!![]};return rp(_0xc155c3);}})[_0x4b5d('0x2e')](function(_0x1dc3e9){_0x3c74db=_0x1dc3e9['access_token'];var _0x5db051={'method':_0x4b5d('0xb3'),'uri':encodeURI(_0x18fa63+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4a6528+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x3c74db,'If-None-Match':null,'OData-Version':_0x4b5d('0xb4')},'json':!![]};return rp(_0x5db051);})[_0x4b5d('0x2e')](function(_0x27d072){var _0x4c28ee=_0x27d072[_0x4b5d('0xb5')][0x0];var _0x1eeac8=_0x4c28ee[_0x4b5d('0xb6')];var _0xf267a8={'method':_0x4b5d('0xb3'),'uri':_0x18fa63+_0x4b5d('0xb7')+_0x1eeac8+_0x4b5d('0xb8'),'headers':{'Authorization':_0x4b5d('0xb9')+_0x3c74db,'If-None-Match':null,'OData-Version':_0x4b5d('0xb4')},'json':!![]};return rp(_0xf267a8);})['then'](function(_0x2b6116){_0x1ea53b=_0x2b6116;_0x1bd127=_0x1ea53b[_0x4b5d('0xba')];_0x1bd127=_['remove'](_0x1bd127,function(_0x2e1fda){return!_0x500d61[_0x4b5d('0xbb')](_0x2e1fda['LogicalName']);});var _0x4c442f=[];var _0x5af341=[];_0x1bd127[_0x4b5d('0xbc')](function(_0x24095b){if(_0x24095b['@odata.type']){var _0x5680c5=_0x24095b[_0x4b5d('0xbd')][_0x4b5d('0xab')](_0x24095b[_0x4b5d('0xbd')][_0x4b5d('0xac')]('.')+0x1);if(_0x5680c5===_0x4b5d('0xbe')){_0x4c442f[_0x4b5d('0xbf')](getSelectList(_0x18fa63,_0x4478a5,_0x5af341,_0x1ea53b['MetadataId'],_0x24095b[_0x4b5d('0xb6')],_0x3c74db));}}});return Promise[_0x4b5d('0xc0')](_0x4c442f);})['then'](function(_0x3ba533){_0x41797e=_0x3ba533[0x0];var _0x5c5cee=[];var _0x3b9652=[];_0x1bd127[_0x4b5d('0xbc')](function(_0x390b50){if(!_[_0x4b5d('0xc1')](_0x390b50[_0x4b5d('0xbd')])){var _0x565571=_0x390b50['@odata.type'][_0x4b5d('0xab')](_0x390b50[_0x4b5d('0xbd')][_0x4b5d('0xac')]('.')+0x1);if(_0x565571==='BooleanAttributeMetadata'){_0x5c5cee[_0x4b5d('0xbf')](getBooleanList(_0x18fa63,_0x4478a5,_0x3b9652,_0x1ea53b[_0x4b5d('0xb6')],_0x390b50['MetadataId'],_0x3c74db));}}});return Promise[_0x4b5d('0xc0')](_0x5c5cee);})[_0x4b5d('0x2e')](function(_0x22a542){_0x51a35d=_0x22a542[0x0];var _0x29f297=[];var _0x6b9814=[];_0x1bd127[_0x4b5d('0xbc')](function(_0x22f280){if(_0x22f280[_0x4b5d('0xbd')]){var _0x5294e0=_0x22f280['@odata.type']['substring'](_0x22f280[_0x4b5d('0xbd')]['lastIndexOf']('.')+0x1);if(_0x5294e0===_0x4b5d('0xc2')||_0x5294e0==='DoubleAttributeMetadata'||_0x5294e0==='BigIntAttributeMetadata'||_0x5294e0===_0x4b5d('0xc3')||_0x5294e0===_0x4b5d('0xc4')||_0x5294e0===_0x4b5d('0xc5')||_0x5294e0===_0x4b5d('0xc6')||_0x5294e0===_0x4b5d('0xc7')||_0x5294e0==='StateAttributeMetadata'||_0x5294e0==='DecimalAttributeMetadata'){_0x29f297[_0x4b5d('0xbf')](getInputList(_0x18fa63,_0x4478a5,_0x5294e0,_0x6b9814,_0x1ea53b[_0x4b5d('0xb6')],_0x22f280[_0x4b5d('0xb6')],_0x3c74db));}}});return Promise[_0x4b5d('0xc0')](_0x29f297);})[_0x4b5d('0x2e')](function(_0x3e88c7){_0x3b9706=_0x3e88c7[0x0];var _0x46c9a2=_0x41797e[_0x4b5d('0xa4')](_0x51a35d)['concat'](_0x3b9706);var _0x246e19={'count':_0x46c9a2[_0x4b5d('0x3f')],'rows':_0x46c9a2};return _0x246e19;})['then'](respondWithResult(_0x31eb3a,null))[_0x4b5d('0x23')](function(_0x40fa88){var _0x1990dd=_0x68dc90[_0x4b5d('0x38')][_0x4b5d('0xc8')]?0x1f4:_0x40fa88['statusCode']||0x1f4;logger['error'](_0x40fa88['stack']);delete _0x40fa88[_0x4b5d('0x31')];if(_0x1990dd===0x191){_0x1990dd=0x190;}_0x31eb3a[_0x4b5d('0x26')](_0x1990dd)['send'](_0x68dc90[_0x4b5d('0x38')][_0x4b5d('0xc8')]?{'message':_0x4b5d('0xc9'),'statusCode':_0x40fa88[_0x4b5d('0xca')]}:_0x40fa88);});};function getSelectList(_0x472310,_0x5287a7,_0x31ad58,_0xbb5c0e,_0x1d1d82,_0x333b59){var _0xf31494={'method':_0x4b5d('0xb3'),'uri':_0x472310+_0x4b5d('0xb7')+_0xbb5c0e+')/Attributes('+_0x1d1d82+_0x4b5d('0xcb')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x4b5d('0xb9')+_0x333b59,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf31494)[_0x4b5d('0x2e')](function(_0x5644bf){var _0x3c9331=[];var _0x2a96d6=_0x5644bf['OptionSet']['Options'];_0x2a96d6[_0x4b5d('0xbc')](function(_0x3b8ddb){_0x3c9331['push']({'name':_0x3b8ddb['Label'][_0x4b5d('0xcc')][_0x4b5d('0xcd')],'value':String(_0x3b8ddb[_0x4b5d('0xce')])});});var _0x4aecac={'id':_0x5287a7+'_'+_0x5644bf['LogicalName'],'name':_0x5644bf[_0x4b5d('0xcf')]['UserLocalizedLabel'][_0x4b5d('0xcd')],'custom':![],'options':_0x3c9331};_0x31ad58[_0x4b5d('0xbf')](_0x4aecac);return _0x31ad58;});}function getBooleanList(_0x4d620d,_0x6b6c7d,_0x91b506,_0x174c21,_0x250ee4,_0xf59026){var _0x5d2af2={'method':_0x4b5d('0xb3'),'uri':_0x4d620d+_0x4b5d('0xb7')+_0x174c21+_0x4b5d('0xd0')+_0x250ee4+_0x4b5d('0xd1'),'headers':{'Authorization':'Bearer\x20'+_0xf59026,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5d2af2)[_0x4b5d('0x2e')](function(_0x47c033){var _0x376e92=[];_0x376e92['push']({'name':_0x47c033[_0x4b5d('0xd2')][_0x4b5d('0xd3')][_0x4b5d('0xcd')]['UserLocalizedLabel']['Label'],'value':_0x4b5d('0xd4')},{'name':_0x47c033[_0x4b5d('0xd2')]['FalseOption']['Label'][_0x4b5d('0xcc')]['Label'],'value':_0x4b5d('0xd5')});var _0x569a9a={'id':_0x6b6c7d+'_'+_0x47c033[_0x4b5d('0xd6')],'name':_0x47c033[_0x4b5d('0xcf')]['UserLocalizedLabel'][_0x4b5d('0xcd')],'custom':![],'options':_0x376e92};_0x91b506[_0x4b5d('0xbf')](_0x569a9a);return _0x91b506;});}function getInputList(_0x2066dc,_0x19ed0f,_0x366382,_0x132a65,_0x536884,_0x15c9b4,_0x33585c){var _0x2fab09={'method':'GET','uri':_0x2066dc+_0x4b5d('0xb7')+_0x536884+_0x4b5d('0xd0')+_0x15c9b4+_0x4b5d('0xd7')+_0x366382+_0x4b5d('0xd8'),'headers':{'Authorization':'Bearer\x20'+_0x33585c,'If-None-Match':null,'OData-Version':_0x4b5d('0xb4')},'json':!![]};return rp(_0x2fab09)['then'](function(_0x573400){var _0x5d118c={'id':_0x19ed0f+'_'+_0x573400[_0x4b5d('0xd6')],'name':_0x573400[_0x4b5d('0xcf')][_0x4b5d('0xcc')]?_0x573400[_0x4b5d('0xcf')][_0x4b5d('0xcc')][_0x4b5d('0xcd')]:_0x573400[_0x4b5d('0xd6')],'custom':![],'options':[]};_0x132a65[_0x4b5d('0xbf')](_0x5d118c);return _0x132a65;});} \ No newline at end of file +var _0x2ea8=['onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','push','all','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','limit','set','reject','update','destroy','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','count','includeAll','include','rows','catch','intersection','find','create','body','params','findOne','order','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contractdetailidname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname'];(function(_0x4253ed,_0x30e9bf){var _0x303ae7=function(_0x55255a){while(--_0x55255a){_0x4253ed['push'](_0x4253ed['shift']());}};_0x303ae7(++_0x30e9bf);}(_0x2ea8,0x11c));var _0x82ea=function(_0x86f189,_0x3bb230){_0x86f189=_0x86f189-0x0;var _0x5527ee=_0x2ea8[_0x86f189];return _0x5527ee;};'use strict';var pdf=require(_0x82ea('0x0'));var emlformat=require(_0x82ea('0x1'));var rimraf=require(_0x82ea('0x2'));var zipdir=require(_0x82ea('0x3'));var jsonpatch=require(_0x82ea('0x4'));var rp=require(_0x82ea('0x5'));var moment=require('moment');var BPromise=require(_0x82ea('0x6'));var Mustache=require(_0x82ea('0x7'));var util=require('util');var path=require(_0x82ea('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82ea('0x9'));var _=require(_0x82ea('0xa'));var squel=require(_0x82ea('0xb'));var crypto=require(_0x82ea('0xc'));var jsforce=require(_0x82ea('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82ea('0xe'));var qs=require(_0x82ea('0xf'));var as=require(_0x82ea('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x82ea('0x11'))(_0x82ea('0x12'));var utils=require(_0x82ea('0x13'));var config=require(_0x82ea('0x14'));var licenseUtil=require(_0x82ea('0x15'));var db=require(_0x82ea('0x16'))['db'];var integrations=require(_0x82ea('0x17'));var jayson=require(_0x82ea('0x18'));var client=jayson[_0x82ea('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3900be,_0x2aedf1,_0x38a22a,_0x2f9045){return new BPromise(function(_0x3ddfda,_0x14535a){var _0x4f8d1d=_0x2f9045||client;return _0x4f8d1d[_0x82ea('0x1a')](_0x3900be,_0x38a22a)[_0x82ea('0x1b')](function(_0x3b7b33){logger['info'](_0x82ea('0x1c'),_0x2aedf1,_0x82ea('0x1d'));logger[_0x82ea('0x1e')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2aedf1,_0x82ea('0x1d'),JSON[_0x82ea('0x1f')](_0x3b7b33));if(_0x3b7b33[_0x82ea('0x20')]){if(_0x3b7b33['error'][_0x82ea('0x21')]===0x1f4){logger[_0x82ea('0x20')](_0x82ea('0x1c'),_0x2aedf1,_0x3b7b33[_0x82ea('0x20')][_0x82ea('0x22')]);return _0x14535a(_0x3b7b33[_0x82ea('0x20')]['message']);}logger[_0x82ea('0x20')]('Dynamics365Account,\x20%s,\x20%s',_0x2aedf1,_0x3b7b33['error'][_0x82ea('0x22')]);return _0x3ddfda(_0x3b7b33[_0x82ea('0x20')]['message']);}else{logger[_0x82ea('0x23')](_0x82ea('0x1c'),_0x2aedf1,'request\x20sent');_0x3ddfda(_0x3b7b33[_0x82ea('0x24')][_0x82ea('0x22')]);}})['catch'](function(_0x170ce3){logger[_0x82ea('0x20')]('Dynamics365Account,\x20%s,\x20%s',_0x2aedf1,_0x170ce3);_0x14535a(_0x170ce3);});});}function respondWithStatusCode(_0x401b19,_0x54a431){_0x54a431=_0x54a431||0xcc;return function(_0x5ba086){if(_0x5ba086){return _0x401b19[_0x82ea('0x25')](_0x54a431);}return _0x401b19[_0x82ea('0x26')](_0x54a431)[_0x82ea('0x27')]();};}function respondWithResult(_0x15aa19,_0x450852){_0x450852=_0x450852||0xc8;return function(_0x39b596){if(_0x39b596){return _0x15aa19[_0x82ea('0x26')](_0x450852)[_0x82ea('0x28')](_0x39b596);}};}function respondWithFilteredResult(_0x579738,_0x37c70c){return function(_0x34c1e6){if(_0x34c1e6){var _0x1d0d82=_0x34c1e6['count'],_0x39b028=_0x37c70c[_0x82ea('0x29')],_0x4efe1c=_0x37c70c[_0x82ea('0x29')]+_0x37c70c[_0x82ea('0x2a')],_0x21547f;if(_0x4efe1c>=_0x1d0d82){_0x4efe1c=_0x1d0d82;_0x21547f=0xc8;}else{_0x21547f=0xce;}_0x579738['status'](_0x21547f);return _0x579738[_0x82ea('0x2b')]('Content-Range',_0x39b028+'-'+_0x4efe1c+'/'+_0x1d0d82)[_0x82ea('0x28')](_0x34c1e6);}return null;};}function patchUpdates(_0xe716d6){return function(_0x5913f1){try{jsonpatch['apply'](_0x5913f1,_0xe716d6,!![]);}catch(_0x14160c){return BPromise[_0x82ea('0x2c')](_0x14160c);}return _0x5913f1['save']();};}function saveUpdates(_0x590b6b,_0x31b0df){return function(_0x451027){if(_0x451027){return _0x451027[_0x82ea('0x2d')](_0x590b6b)[_0x82ea('0x1b')](function(_0x1e8ec8){return _0x1e8ec8;});}return null;};}function removeEntity(_0x46042f,_0x1ee4ce){return function(_0x496391){if(_0x496391){return _0x496391[_0x82ea('0x2e')]()[_0x82ea('0x1b')](function(){_0x46042f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x131e05,_0x6caadc){return function(_0x30540a){if(!_0x30540a){_0x131e05[_0x82ea('0x25')](0x194);}return _0x30540a;};}function handleError(_0x231188,_0x460518){_0x460518=_0x460518||0x1f4;return function(_0x1ba7c1){logger[_0x82ea('0x20')](_0x1ba7c1[_0x82ea('0x2f')]);if(_0x1ba7c1['name']){delete _0x1ba7c1[_0x82ea('0x30')];}_0x231188[_0x82ea('0x26')](_0x460518)[_0x82ea('0x31')](_0x1ba7c1);};}exports['index']=function(_0x44cdcd,_0x122774){var _0x5eecb9={},_0x2e0ed7={},_0x170729={'count':0x0,'rows':[]};var _0x5687a8=_[_0x82ea('0x32')](db[_0x82ea('0x33')][_0x82ea('0x34')],function(_0x18d34f){return{'name':_0x18d34f[_0x82ea('0x35')],'type':_0x18d34f[_0x82ea('0x36')]['key']};});_0x2e0ed7['model']=_[_0x82ea('0x32')](_0x5687a8,_0x82ea('0x30'));_0x2e0ed7[_0x82ea('0x37')]=_[_0x82ea('0x38')](_0x44cdcd[_0x82ea('0x37')]);_0x2e0ed7[_0x82ea('0x39')]=_['intersection'](_0x2e0ed7[_0x82ea('0x3a')],_0x2e0ed7[_0x82ea('0x37')]);_0x5eecb9['attributes']=_['intersection'](_0x2e0ed7[_0x82ea('0x3a')],qs[_0x82ea('0x3b')](_0x44cdcd[_0x82ea('0x37')]['fields']));_0x5eecb9['attributes']=_0x5eecb9[_0x82ea('0x3c')][_0x82ea('0x3d')]?_0x5eecb9[_0x82ea('0x3c')]:_0x2e0ed7['model'];if(!_0x44cdcd[_0x82ea('0x37')][_0x82ea('0x3e')](_0x82ea('0x3f'))){_0x5eecb9[_0x82ea('0x2a')]=qs[_0x82ea('0x2a')](_0x44cdcd['query'][_0x82ea('0x2a')]);_0x5eecb9[_0x82ea('0x29')]=qs[_0x82ea('0x29')](_0x44cdcd[_0x82ea('0x37')]['offset']);}_0x5eecb9['order']=qs['sort'](_0x44cdcd[_0x82ea('0x37')][_0x82ea('0x40')]);_0x5eecb9[_0x82ea('0x41')]=qs['filters'](_['pick'](_0x44cdcd[_0x82ea('0x37')],_0x2e0ed7[_0x82ea('0x39')]),_0x5687a8);if(_0x44cdcd[_0x82ea('0x37')][_0x82ea('0x42')]){_0x5eecb9['where']=_['merge'](_0x5eecb9[_0x82ea('0x41')],{'$or':_[_0x82ea('0x32')](_0x5687a8,function(_0x549901){if(_0x549901[_0x82ea('0x36')]!=='VIRTUAL'){var _0x20fe35={};_0x20fe35[_0x549901[_0x82ea('0x30')]]={'$like':'%'+_0x44cdcd['query'][_0x82ea('0x42')]+'%'};return _0x20fe35;}})});}_0x5eecb9=_[_0x82ea('0x43')]({},_0x5eecb9,_0x44cdcd[_0x82ea('0x44')]);var _0x289705={'where':_0x5eecb9[_0x82ea('0x41')]};return db[_0x82ea('0x33')]['count'](_0x289705)['then'](function(_0x4f9058){_0x170729[_0x82ea('0x45')]=_0x4f9058;if(_0x44cdcd[_0x82ea('0x37')][_0x82ea('0x46')]){_0x5eecb9[_0x82ea('0x47')]=[{'all':!![]}];}return db[_0x82ea('0x33')]['findAll'](_0x5eecb9);})[_0x82ea('0x1b')](function(_0x2bab8c){_0x170729[_0x82ea('0x48')]=_0x2bab8c;return _0x170729;})[_0x82ea('0x1b')](respondWithFilteredResult(_0x122774,_0x5eecb9))[_0x82ea('0x49')](handleError(_0x122774,null));};exports['show']=function(_0x4427f4,_0x49498b){var _0x4d5c8b={'raw':![],'where':{'id':_0x4427f4['params']['id']}},_0x45d02a={};_0x45d02a[_0x82ea('0x3a')]=_[_0x82ea('0x38')](db[_0x82ea('0x33')]['rawAttributes']);_0x45d02a[_0x82ea('0x37')]=_['keys'](_0x4427f4[_0x82ea('0x37')]);_0x45d02a[_0x82ea('0x39')]=_['intersection'](_0x45d02a[_0x82ea('0x3a')],_0x45d02a[_0x82ea('0x37')]);_0x4d5c8b[_0x82ea('0x3c')]=_[_0x82ea('0x4a')](_0x45d02a[_0x82ea('0x3a')],qs['fields'](_0x4427f4['query']['fields']));_0x4d5c8b['attributes']=_0x4d5c8b[_0x82ea('0x3c')][_0x82ea('0x3d')]?_0x4d5c8b[_0x82ea('0x3c')]:_0x45d02a['model'];if(_0x4427f4[_0x82ea('0x37')][_0x82ea('0x46')]){_0x4d5c8b[_0x82ea('0x47')]=[{'all':!![]}];}_0x4d5c8b=_[_0x82ea('0x43')]({},_0x4d5c8b,_0x4427f4['options']);return db['Dynamics365Account'][_0x82ea('0x4b')](_0x4d5c8b)[_0x82ea('0x1b')](handleEntityNotFound(_0x49498b,null))['then'](respondWithResult(_0x49498b,null))[_0x82ea('0x49')](handleError(_0x49498b,null));};exports['create']=function(_0x4b452c,_0x5ac36){return db[_0x82ea('0x33')][_0x82ea('0x4c')](_0x4b452c[_0x82ea('0x4d')],{})[_0x82ea('0x1b')](respondWithResult(_0x5ac36,0xc9))[_0x82ea('0x49')](handleError(_0x5ac36,null));};exports[_0x82ea('0x2d')]=function(_0x57f9df,_0x38fda8){if(_0x57f9df[_0x82ea('0x4d')]['id']){delete _0x57f9df['body']['id'];}return db['Dynamics365Account'][_0x82ea('0x4b')]({'where':{'id':_0x57f9df['params']['id']}})[_0x82ea('0x1b')](handleEntityNotFound(_0x38fda8,null))[_0x82ea('0x1b')](saveUpdates(_0x57f9df[_0x82ea('0x4d')],null))[_0x82ea('0x1b')](respondWithResult(_0x38fda8,null))[_0x82ea('0x49')](handleError(_0x38fda8,null));};exports[_0x82ea('0x2e')]=function(_0x32c682,_0x343cde){return db[_0x82ea('0x33')][_0x82ea('0x4b')]({'where':{'id':_0x32c682[_0x82ea('0x4e')]['id']}})[_0x82ea('0x1b')](handleEntityNotFound(_0x343cde,null))['then'](removeEntity(_0x343cde,null))[_0x82ea('0x49')](handleError(_0x343cde,null));};exports['getConfigurations']=function(_0x512c57,_0x544798,_0x5c0b51){var _0x5c92ac={};var _0x37687b={};var _0x407662;var _0x434590;return db[_0x82ea('0x33')][_0x82ea('0x4f')]({'where':{'id':_0x512c57[_0x82ea('0x4e')]['id']}})['then'](handleEntityNotFound(_0x544798,null))['then'](function(_0x128b73){if(_0x128b73){_0x407662=_0x128b73;_0x37687b[_0x82ea('0x3a')]=_[_0x82ea('0x38')](db['Dynamics365Configuration']['rawAttributes']);_0x37687b['query']=_[_0x82ea('0x38')](_0x512c57[_0x82ea('0x37')]);_0x37687b[_0x82ea('0x39')]=_[_0x82ea('0x4a')](_0x37687b[_0x82ea('0x3a')],_0x37687b['query']);_0x5c92ac['attributes']=_['intersection'](_0x37687b['model'],qs[_0x82ea('0x3b')](_0x512c57[_0x82ea('0x37')][_0x82ea('0x3b')]));_0x5c92ac['attributes']=_0x5c92ac[_0x82ea('0x3c')][_0x82ea('0x3d')]?_0x5c92ac[_0x82ea('0x3c')]:_0x37687b[_0x82ea('0x3a')];_0x5c92ac[_0x82ea('0x50')]=qs[_0x82ea('0x40')](_0x512c57[_0x82ea('0x37')][_0x82ea('0x40')]);_0x5c92ac[_0x82ea('0x41')]=qs[_0x82ea('0x39')](_[_0x82ea('0x51')](_0x512c57[_0x82ea('0x37')],_0x37687b['filters']));if(_0x512c57[_0x82ea('0x37')][_0x82ea('0x42')]){_0x5c92ac[_0x82ea('0x41')]=_[_0x82ea('0x43')](_0x5c92ac[_0x82ea('0x41')],{'$or':_[_0x82ea('0x32')](_0x5c92ac[_0x82ea('0x3c')],function(_0x577d88){var _0x562c4d={};_0x562c4d[_0x577d88]={'$like':'%'+_0x512c57['query'][_0x82ea('0x42')]+'%'};return _0x562c4d;})});}_0x5c92ac=_[_0x82ea('0x43')]({},_0x5c92ac,_0x512c57['options']);return _0x407662[_0x82ea('0x52')](_0x5c92ac);}})['then'](function(_0x12c8e9){if(_0x12c8e9){_0x434590=_0x12c8e9[_0x82ea('0x3d')];if(!_0x512c57[_0x82ea('0x37')]['hasOwnProperty'](_0x82ea('0x3f'))){_0x5c92ac[_0x82ea('0x2a')]=qs[_0x82ea('0x2a')](_0x512c57[_0x82ea('0x37')][_0x82ea('0x2a')]);_0x5c92ac[_0x82ea('0x29')]=qs[_0x82ea('0x29')](_0x512c57[_0x82ea('0x37')]['offset']);}return _0x407662['getConfigurations'](_0x5c92ac);}})[_0x82ea('0x1b')](function(_0x540ae9){if(_0x540ae9){return _0x540ae9?{'count':_0x434590,'rows':_0x540ae9}:null;}})[_0x82ea('0x1b')](respondWithResult(_0x544798,null))[_0x82ea('0x49')](handleError(_0x544798,null));};exports[_0x82ea('0x53')]=function(_0x15dcf9,_0x212219,_0x5b814f){if(_0x15dcf9[_0x82ea('0x4d')]['id']){delete _0x15dcf9[_0x82ea('0x4d')]['id'];}return db[_0x82ea('0x33')][_0x82ea('0x4f')]({'where':{'id':_0x15dcf9[_0x82ea('0x4e')]['id']}})[_0x82ea('0x1b')](handleEntityNotFound(_0x212219,null))[_0x82ea('0x1b')](function(_0x9e12fc){if(_0x9e12fc){_0x15dcf9[_0x82ea('0x4d')][_0x82ea('0x54')]=_0x9e12fc['id'];_0x15dcf9[_0x82ea('0x4d')][_0x82ea('0x55')]=integrations[_0x82ea('0x56')](_0x15dcf9[_0x82ea('0x4d')][_0x82ea('0x57')],_0x15dcf9[_0x82ea('0x4d')][_0x82ea('0x36')]);_0x15dcf9[_0x82ea('0x4d')][_0x82ea('0x58')]=integrations[_0x82ea('0x59')](_0x15dcf9[_0x82ea('0x4d')][_0x82ea('0x57')],_0x15dcf9[_0x82ea('0x4d')][_0x82ea('0x36')]);return db[_0x82ea('0x5a')]['create'](_0x15dcf9[_0x82ea('0x4d')],{'include':[{'model':db[_0x82ea('0x5b')],'as':'Subjects'},{'model':db[_0x82ea('0x5b')],'as':_0x82ea('0x58')}]});}return null;})[_0x82ea('0x1b')](respondWithResult(_0x212219,null))[_0x82ea('0x49')](handleError(_0x212219,null));};exports[_0x82ea('0x5c')]=function(_0x2d7337,_0x379f52,_0x3af35c){var _0x4d3eba=_0x2d7337['query']['ticketType'];var _0x25c4ae=_0x4d3eba==='incident'?'Incident':'PhoneCall';var _0x24d473='';var _0xe459f2='';var _0x3f470f='';var _0x297eed='';var _0x57762c='';var _0x51e7d7='';var _0x182bb6='';var _0x15eecd='';var _0x3bca20=[_0x82ea('0x5d'),_0x82ea('0x5e'),_0x82ea('0x5f'),_0x82ea('0x60'),_0x82ea('0x61'),_0x82ea('0x62'),_0x82ea('0x63'),'regardingobjectid',_0x82ea('0x64'),_0x82ea('0x65')];var _0x260398=['accountidname',_0x82ea('0x66'),_0x82ea('0x67'),'billedserviceunits',_0x82ea('0x68'),'contactidyominame',_0x82ea('0x69'),'contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame',_0x82ea('0x6a'),'createdbyyominame',_0x82ea('0x6b'),_0x82ea('0x6c'),_0x82ea('0x6d'),_0x82ea('0x6e'),_0x82ea('0x6f'),'customeridyominame','emailaddress',_0x82ea('0x70'),_0x82ea('0x71'),_0x82ea('0x72'),_0x82ea('0x73'),_0x82ea('0x74'),'firstresponsebykpiidname','followupby',_0x82ea('0x75'),_0x82ea('0x76'),_0x82ea('0x77'),_0x82ea('0x78'),'masteridname',_0x82ea('0x79'),_0x82ea('0x7a'),_0x82ea('0x7b'),_0x82ea('0x7c'),_0x82ea('0x7d'),_0x82ea('0x7e'),_0x82ea('0x7f'),_0x82ea('0x80'),_0x82ea('0x81'),'numberofchildincidents',_0x82ea('0x82'),_0x82ea('0x83'),_0x82ea('0x84'),'owneridtype',_0x82ea('0x85'),'parentcaseidname',_0x82ea('0x86'),_0x82ea('0x87'),_0x82ea('0x88'),_0x82ea('0x89'),'productserialnumber',_0x82ea('0x8a'),_0x82ea('0x8b'),_0x82ea('0x8c'),_0x82ea('0x8d'),_0x82ea('0x8e'),_0x82ea('0x8f'),_0x82ea('0x90'),_0x82ea('0x91'),'socialprofileidname',_0x82ea('0x92'),_0x82ea('0x93'),_0x82ea('0x94'),_0x82ea('0x95'),_0x82ea('0x96'),_0x82ea('0x97'),'traversedpath',_0x82ea('0x98'),_0x82ea('0x99')];var _0x1a0eb7=_0x3bca20['concat'](_0x260398);return db[_0x82ea('0x33')]['findOne']({'where':{'id':_0x2d7337[_0x82ea('0x4e')]['id']},'attributes':['id','username',_0x82ea('0x9a'),_0x82ea('0x9b'),_0x82ea('0x9c'),_0x82ea('0x9d'),_0x82ea('0x9e')]})['then'](handleEntityNotFound(_0x379f52,null))['then'](function(_0x57b9f5){if(_0x57b9f5){_0x15eecd=_0x57b9f5[_0x82ea('0x9b')];var _0x4f3a8d=_0x15eecd[_0x82ea('0x9f')](-0x1);if(_0x4f3a8d==='/'){_0x15eecd=_0x15eecd[_0x82ea('0xa0')](0x0,_0x15eecd['lastIndexOf'](_0x4f3a8d));}_0x182bb6=util['format'](_0x82ea('0xa1'),_0x15eecd);var _0x514df1={'method':'POST','uri':_0x82ea('0xa2')+_0x57b9f5[_0x82ea('0x9c')]+_0x82ea('0xa3'),'form':{'client_id':_0x57b9f5[_0x82ea('0x9d')],'resource':_0x15eecd,'username':_0x57b9f5[_0x82ea('0xa4')],'password':_0x57b9f5[_0x82ea('0x9a')],'grant_type':'password','client_secret':_0x57b9f5[_0x82ea('0x9e')]},'json':!![]};return rp(_0x514df1);}})[_0x82ea('0x1b')](function(_0x106523){_0x51e7d7=_0x106523['access_token'];var _0x1add21={'method':_0x82ea('0xa5'),'uri':encodeURI(_0x182bb6+_0x82ea('0xa6')+_0x25c4ae+'\x27'),'headers':{'Authorization':_0x82ea('0xa7')+_0x51e7d7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1add21);})[_0x82ea('0x1b')](function(_0x11d090){var _0x7df012=_0x11d090[_0x82ea('0xa8')][0x0];var _0x46be95=_0x7df012[_0x82ea('0xa9')];var _0x2410ef={'method':'GET','uri':_0x182bb6+_0x82ea('0xaa')+_0x46be95+_0x82ea('0xab'),'headers':{'Authorization':_0x82ea('0xa7')+_0x51e7d7,'If-None-Match':null,'OData-Version':_0x82ea('0xac')},'json':!![]};return rp(_0x2410ef);})[_0x82ea('0x1b')](function(_0x39327b){_0x24d473=_0x39327b;_0xe459f2=_0x24d473[_0x82ea('0xad')];_0xe459f2=_[_0x82ea('0xae')](_0xe459f2,function(_0x460009){return!_0x1a0eb7[_0x82ea('0xaf')](_0x460009[_0x82ea('0xb0')]);});var _0x47e4a1=[];var _0x517678=[];_0xe459f2[_0x82ea('0xb1')](function(_0x10d6ed){if(_0x10d6ed[_0x82ea('0xb2')]){var _0x5a3ac1=_0x10d6ed[_0x82ea('0xb2')]['substring'](_0x10d6ed[_0x82ea('0xb2')][_0x82ea('0xb3')]('.')+0x1);if(_0x5a3ac1==='PicklistAttributeMetadata'){_0x47e4a1[_0x82ea('0xb4')](getSelectList(_0x182bb6,_0x4d3eba,_0x517678,_0x24d473['MetadataId'],_0x10d6ed[_0x82ea('0xa9')],_0x51e7d7));}}});return Promise[_0x82ea('0xb5')](_0x47e4a1);})[_0x82ea('0x1b')](function(_0x231197){_0x3f470f=_0x231197[0x0];var _0x2d93c6=[];var _0x166504=[];_0xe459f2[_0x82ea('0xb1')](function(_0x3e1cb9){if(!_['isNil'](_0x3e1cb9[_0x82ea('0xb2')])){var _0x139079=_0x3e1cb9[_0x82ea('0xb2')][_0x82ea('0xa0')](_0x3e1cb9[_0x82ea('0xb2')][_0x82ea('0xb3')]('.')+0x1);if(_0x139079==='BooleanAttributeMetadata'){_0x2d93c6[_0x82ea('0xb4')](getBooleanList(_0x182bb6,_0x4d3eba,_0x166504,_0x24d473['MetadataId'],_0x3e1cb9[_0x82ea('0xa9')],_0x51e7d7));}}});return Promise[_0x82ea('0xb5')](_0x2d93c6);})[_0x82ea('0x1b')](function(_0x4953f2){_0x297eed=_0x4953f2[0x0];var _0x17150c=[];var _0xbd4008=[];_0xe459f2[_0x82ea('0xb1')](function(_0x2184dc){if(_0x2184dc[_0x82ea('0xb2')]){var _0x47cfd3=_0x2184dc['@odata.type'][_0x82ea('0xa0')](_0x2184dc['@odata.type'][_0x82ea('0xb3')]('.')+0x1);if(_0x47cfd3===_0x82ea('0xb6')||_0x47cfd3==='DoubleAttributeMetadata'||_0x47cfd3===_0x82ea('0xb7')||_0x47cfd3==='IntegerAttributeMetadata'||_0x47cfd3===_0x82ea('0xb8')||_0x47cfd3===_0x82ea('0xb9')||_0x47cfd3===_0x82ea('0xba')||_0x47cfd3===_0x82ea('0xbb')||_0x47cfd3==='StateAttributeMetadata'||_0x47cfd3===_0x82ea('0xbc')){_0x17150c[_0x82ea('0xb4')](getInputList(_0x182bb6,_0x4d3eba,_0x47cfd3,_0xbd4008,_0x24d473['MetadataId'],_0x2184dc[_0x82ea('0xa9')],_0x51e7d7));}}});return Promise[_0x82ea('0xb5')](_0x17150c);})[_0x82ea('0x1b')](function(_0x5443e2){_0x57762c=_0x5443e2[0x0];var _0xec8b30=_0x3f470f[_0x82ea('0xbd')](_0x297eed)[_0x82ea('0xbd')](_0x57762c);var _0x3952f4={'count':_0xec8b30[_0x82ea('0x3d')],'rows':_0xec8b30};return _0x3952f4;})['then'](respondWithResult(_0x379f52,null))[_0x82ea('0x49')](function(_0x151c47){var _0x4dcd68=_0x2d7337[_0x82ea('0x37')]['test']?0x1f4:_0x151c47[_0x82ea('0xbe')]||0x1f4;logger['error'](_0x151c47[_0x82ea('0x2f')]);delete _0x151c47[_0x82ea('0x30')];if(_0x4dcd68===0x191){_0x4dcd68=0x190;}_0x379f52[_0x82ea('0x26')](_0x4dcd68)[_0x82ea('0x31')](_0x2d7337[_0x82ea('0x37')][_0x82ea('0xbf')]?{'message':_0x82ea('0xc0'),'statusCode':_0x151c47[_0x82ea('0xbe')]}:_0x151c47);});};function getSelectList(_0x2f31c0,_0x56be46,_0x58fb56,_0x36b303,_0x4e11ca,_0x49295c){var _0x43dd60={'method':'GET','uri':_0x2f31c0+_0x82ea('0xaa')+_0x36b303+_0x82ea('0xc1')+_0x4e11ca+_0x82ea('0xc2')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x82ea('0xa7')+_0x49295c,'If-None-Match':null,'OData-Version':_0x82ea('0xac')},'json':!![]};return rp(_0x43dd60)[_0x82ea('0x1b')](function(_0x453df4){var _0x4250a7=[];var _0x45068d=_0x453df4[_0x82ea('0xc3')][_0x82ea('0xc4')];_0x45068d[_0x82ea('0xb1')](function(_0x3a044b){_0x4250a7[_0x82ea('0xb4')]({'name':_0x3a044b[_0x82ea('0xc5')]['UserLocalizedLabel'][_0x82ea('0xc5')],'value':String(_0x3a044b[_0x82ea('0xc6')])});});var _0x2d411f={'id':_0x56be46+'_'+_0x453df4[_0x82ea('0xb0')],'name':_0x453df4['DisplayName'][_0x82ea('0xc7')]['Label'],'custom':![],'options':_0x4250a7};_0x58fb56[_0x82ea('0xb4')](_0x2d411f);return _0x58fb56;});}function getBooleanList(_0x28a3f3,_0x3fc8b2,_0xd0173a,_0x420a62,_0xdf8b13,_0x11ce8a){var _0x4f4da0={'method':_0x82ea('0xa5'),'uri':_0x28a3f3+_0x82ea('0xaa')+_0x420a62+_0x82ea('0xc1')+_0xdf8b13+_0x82ea('0xc8'),'headers':{'Authorization':_0x82ea('0xa7')+_0x11ce8a,'If-None-Match':null,'OData-Version':_0x82ea('0xac')},'json':!![]};return rp(_0x4f4da0)['then'](function(_0x1ae36d){var _0x1f8ead=[];_0x1f8ead[_0x82ea('0xb4')]({'name':_0x1ae36d['OptionSet']['TrueOption']['Label'][_0x82ea('0xc7')][_0x82ea('0xc5')],'value':_0x82ea('0xc9')},{'name':_0x1ae36d[_0x82ea('0xc3')][_0x82ea('0xca')][_0x82ea('0xc5')]['UserLocalizedLabel'][_0x82ea('0xc5')],'value':_0x82ea('0xcb')});var _0x2ecfaa={'id':_0x3fc8b2+'_'+_0x1ae36d['LogicalName'],'name':_0x1ae36d[_0x82ea('0xcc')][_0x82ea('0xc7')][_0x82ea('0xc5')],'custom':![],'options':_0x1f8ead};_0xd0173a['push'](_0x2ecfaa);return _0xd0173a;});}function getInputList(_0x55a6af,_0xff479c,_0x2868d5,_0x3386fd,_0x11690a,_0x1dcefa,_0xd12d8d){var _0x2e2bf5={'method':_0x82ea('0xa5'),'uri':_0x55a6af+_0x82ea('0xaa')+_0x11690a+')/Attributes('+_0x1dcefa+_0x82ea('0xcd')+_0x2868d5+_0x82ea('0xce'),'headers':{'Authorization':_0x82ea('0xa7')+_0xd12d8d,'If-None-Match':null,'OData-Version':_0x82ea('0xac')},'json':!![]};return rp(_0x2e2bf5)[_0x82ea('0x1b')](function(_0x36b16f){var _0xc29e6a={'id':_0xff479c+'_'+_0x36b16f[_0x82ea('0xb0')],'name':_0x36b16f[_0x82ea('0xcc')][_0x82ea('0xc7')]?_0x36b16f[_0x82ea('0xcc')][_0x82ea('0xc7')][_0x82ea('0xc5')]:_0x36b16f[_0x82ea('0xb0')],'custom':![],'options':[]};_0x3386fd[_0x82ea('0xb4')](_0xc29e6a);return _0x3386fd;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 3826af7..bc0cf33 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 _0x1c2d=['exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intDynamics365Account.attributes'];(function(_0x5137dd,_0x527080){var _0x42c920=function(_0x4c238d){while(--_0x4c238d){_0x5137dd['push'](_0x5137dd['shift']());}};_0x42c920(++_0x527080);}(_0x1c2d,0x79));var _0xd1c2=function(_0x33ba78,_0xbcaa2d){_0x33ba78=_0x33ba78-0x0;var _0x24a8a8=_0x1c2d[_0x33ba78];return _0x24a8a8;};'use strict';var _=require(_0xd1c2('0x0'));var util=require(_0xd1c2('0x1'));var logger=require(_0xd1c2('0x2'))(_0xd1c2('0x3'));var moment=require(_0xd1c2('0x4'));var BPromise=require('bluebird');var rp=require(_0xd1c2('0x5'));var fs=require('fs');var path=require(_0xd1c2('0x6'));var rimraf=require(_0xd1c2('0x7'));var config=require('../../config/environment');var attributes=require(_0xd1c2('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd1c2('0x9')]=function(_0x1fe6be,_0xf2a4a2){return _0x1fe6be[_0xd1c2('0xa')](_0xd1c2('0xb'),attributes,{'tableName':_0xd1c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e42=['exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x56d278,_0x3b4864){var _0x511467=function(_0x4a5f79){while(--_0x4a5f79){_0x56d278['push'](_0x56d278['shift']());}};_0x511467(++_0x3b4864);}(_0x4e42,0xa9));var _0x24e4=function(_0x5192a3,_0x13238e){_0x5192a3=_0x5192a3-0x0;var _0x16cd81=_0x4e42[_0x5192a3];return _0x16cd81;};'use strict';var _=require(_0x24e4('0x0'));var util=require(_0x24e4('0x1'));var logger=require('../../config/logger')(_0x24e4('0x2'));var moment=require(_0x24e4('0x3'));var BPromise=require(_0x24e4('0x4'));var rp=require(_0x24e4('0x5'));var fs=require('fs');var path=require(_0x24e4('0x6'));var rimraf=require(_0x24e4('0x7'));var config=require(_0x24e4('0x8'));var attributes=require(_0x24e4('0x9'));var integrations=require(_0x24e4('0xa'));module[_0x24e4('0xb')]=function(_0xa7316e,_0x3d9f35){return _0xa7316e[_0x24e4('0xc')](_0x24e4('0xd'),attributes,{'tableName':_0x24e4('0xe'),'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 bb05ed5..3f468fa 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 _0xb7b6=['findAll','options','raw','limit','include','map','model','attributes','info','ShowDynamics365Account','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account'];(function(_0x118503,_0x534758){var _0x3507cf=function(_0x5c7128){while(--_0x5c7128){_0x118503['push'](_0x118503['shift']());}};_0x3507cf(++_0x534758);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x3ecab3,_0x1acc2f){_0x3ecab3=_0x3ecab3-0x0;var _0x31a53c=_0xb7b6[_0x3ecab3];return _0x31a53c;};'use strict';var _=require(_0x6b7b('0x0'));var util=require(_0x6b7b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b7b('0x2'));var fs=require('fs');var Redis=require(_0x6b7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b7b('0x4'));var logger=require(_0x6b7b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6b7b('0x6'));var client=jayson[_0x6b7b('0x7')][_0x6b7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xff519e,_0x24359f,_0x483b9c){return new BPromise(function(_0x49a6c8,_0x2bb86d){return client[_0x6b7b('0x9')](_0xff519e,_0x483b9c)[_0x6b7b('0xa')](function(_0x115f2d){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x24359f,'request\x20sent');logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0x24359f,_0x6b7b('0xd'),JSON[_0x6b7b('0xe')](_0x115f2d));if(_0x115f2d[_0x6b7b('0xf')]){if(_0x115f2d[_0x6b7b('0xf')]['code']===0x1f4){logger[_0x6b7b('0xf')](_0x6b7b('0x10'),_0x24359f,_0x115f2d['error'][_0x6b7b('0x11')]);return _0x2bb86d(_0x115f2d[_0x6b7b('0xf')]['message']);}logger[_0x6b7b('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x24359f,_0x115f2d[_0x6b7b('0xf')][_0x6b7b('0x11')]);return _0x49a6c8(_0x115f2d[_0x6b7b('0xf')]['message']);}else{logger['info'](_0x6b7b('0x10'),_0x24359f,'request\x20sent');_0x49a6c8(_0x115f2d['result'][_0x6b7b('0x11')]);}})[_0x6b7b('0x12')](function(_0x4ef35b){logger[_0x6b7b('0xf')](_0x6b7b('0x10'),_0x24359f,_0x4ef35b);_0x2bb86d(_0x4ef35b);});});}exports[_0x6b7b('0x13')]=function(_0x41f48e){var _0x51b01f=this;return new Promise(function(_0x3d025c,_0x2036ec){return db[_0x6b7b('0x14')][_0x6b7b('0x15')]({'raw':_0x41f48e[_0x6b7b('0x16')]?_0x41f48e[_0x6b7b('0x16')][_0x6b7b('0x17')]===undefined?!![]:![]:!![],'where':_0x41f48e[_0x6b7b('0x16')]?_0x41f48e['options']['where']||null:null,'attributes':_0x41f48e[_0x6b7b('0x16')]?_0x41f48e['options']['attributes']||null:null,'limit':_0x41f48e['options']?_0x41f48e['options'][_0x6b7b('0x18')]||null:null,'include':_0x41f48e[_0x6b7b('0x16')]?_0x41f48e['options'][_0x6b7b('0x19')]?_[_0x6b7b('0x1a')](_0x41f48e['options'][_0x6b7b('0x19')],function(_0x1d3c69){return{'model':db[_0x1d3c69[_0x6b7b('0x1b')]],'as':_0x1d3c69['as'],'attributes':_0x1d3c69[_0x6b7b('0x1c')],'include':_0x1d3c69[_0x6b7b('0x19')]?_[_0x6b7b('0x1a')](_0x1d3c69[_0x6b7b('0x19')],function(_0x6edf){return{'model':db[_0x6edf[_0x6b7b('0x1b')]],'as':_0x6edf['as'],'attributes':_0x6edf[_0x6b7b('0x1c')],'include':_0x6edf[_0x6b7b('0x19')]?_[_0x6b7b('0x1a')](_0x6edf[_0x6b7b('0x19')],function(_0x2fc275){return{'model':db[_0x2fc275[_0x6b7b('0x1b')]],'as':_0x2fc275['as'],'attributes':_0x2fc275['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3120a3){logger[_0x6b7b('0x1d')](_0x6b7b('0x13'),_0x41f48e);logger['debug'](_0x6b7b('0x13'),_0x41f48e,JSON['stringify'](_0x3120a3));_0x3d025c(_0x3120a3);})[_0x6b7b('0x12')](function(_0x3117db){logger[_0x6b7b('0xf')](_0x6b7b('0x13'),_0x3117db['message'],_0x41f48e);_0x2036ec(_0x51b01f['error'](0x1f4,_0x3117db[_0x6b7b('0x11')]));});});};exports[_0x6b7b('0x1e')]=function(_0x3622e0){var _0x3ee2b6=this;return new Promise(function(_0x4f70e3,_0xef8922){return db[_0x6b7b('0x14')]['find']({'raw':_0x3622e0['options']?_0x3622e0[_0x6b7b('0x16')][_0x6b7b('0x17')]===undefined?!![]:![]:!![],'where':_0x3622e0[_0x6b7b('0x16')]?_0x3622e0[_0x6b7b('0x16')]['where']||null:null,'attributes':_0x3622e0['options']?_0x3622e0[_0x6b7b('0x16')][_0x6b7b('0x1c')]||null:null,'include':_0x3622e0['options']?_0x3622e0[_0x6b7b('0x16')][_0x6b7b('0x19')]?_[_0x6b7b('0x1a')](_0x3622e0[_0x6b7b('0x16')][_0x6b7b('0x19')],function(_0x54cde9){return{'model':db[_0x54cde9[_0x6b7b('0x1b')]],'as':_0x54cde9['as'],'attributes':_0x54cde9[_0x6b7b('0x1c')],'include':_0x54cde9[_0x6b7b('0x19')]?_['map'](_0x54cde9[_0x6b7b('0x19')],function(_0x1175dd){return{'model':db[_0x1175dd[_0x6b7b('0x1b')]],'as':_0x1175dd['as'],'attributes':_0x1175dd['attributes'],'include':_0x1175dd[_0x6b7b('0x19')]?_[_0x6b7b('0x1a')](_0x1175dd[_0x6b7b('0x19')],function(_0x9ed8e0){return{'model':db[_0x9ed8e0[_0x6b7b('0x1b')]],'as':_0x9ed8e0['as'],'attributes':_0x9ed8e0['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b7b('0xa')](function(_0xfbc125){logger[_0x6b7b('0x1d')](_0x6b7b('0x1e'),_0x3622e0);logger[_0x6b7b('0xb')](_0x6b7b('0x1e'),_0x3622e0,JSON[_0x6b7b('0xe')](_0xfbc125));_0x4f70e3(_0xfbc125);})[_0x6b7b('0x12')](function(_0x41b46e){logger['error'](_0x6b7b('0x1e'),_0x41b46e[_0x6b7b('0x11')],_0x3622e0);_0xef8922(_0x3ee2b6[_0x6b7b('0xf')](0x1f4,_0x41b46e[_0x6b7b('0x11')]));});});}; \ No newline at end of file +var _0x39c7=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','info','catch','GetDynamics365Account','findAll','options','attributes','limit','map','include','model','Dynamics365Account','find','raw','where','ShowDynamics365Account','util','moment','bluebird'];(function(_0x3b5cb7,_0xa12fcd){var _0x167ee2=function(_0x406eab){while(--_0x406eab){_0x3b5cb7['push'](_0x3b5cb7['shift']());}};_0x167ee2(++_0xa12fcd);}(_0x39c7,0x85));var _0x739c=function(_0x1c962e,_0xcfb220){_0x1c962e=_0x1c962e-0x0;var _0x2ecb50=_0x39c7[_0x1c962e];return _0x2ecb50;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var moment=require(_0x739c('0x1'));var BPromise=require(_0x739c('0x2'));var rs=require(_0x739c('0x3'));var fs=require('fs');var Redis=require(_0x739c('0x4'));var db=require(_0x739c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x739c('0x6'))(_0x739c('0x7'));var config=require(_0x739c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x739c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0af1,_0x5df5d3,_0x480159){return new BPromise(function(_0x27c5a4,_0x3475f2){return client['request'](_0x3c0af1,_0x480159)[_0x739c('0xa')](function(_0x277f61){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5df5d3,_0x739c('0xb'));logger[_0x739c('0xc')](_0x739c('0xd'),_0x5df5d3,_0x739c('0xb'),JSON[_0x739c('0xe')](_0x277f61));if(_0x277f61[_0x739c('0xf')]){if(_0x277f61[_0x739c('0xf')][_0x739c('0x10')]===0x1f4){logger[_0x739c('0xf')](_0x739c('0x11'),_0x5df5d3,_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);return _0x3475f2(_0x277f61['error'][_0x739c('0x12')]);}logger[_0x739c('0xf')](_0x739c('0x11'),_0x5df5d3,_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);return _0x27c5a4(_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);}else{logger[_0x739c('0x13')](_0x739c('0x11'),_0x5df5d3,_0x739c('0xb'));_0x27c5a4(_0x277f61['result']['message']);}})[_0x739c('0x14')](function(_0x23888d){logger[_0x739c('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x5df5d3,_0x23888d);_0x3475f2(_0x23888d);});});}exports[_0x739c('0x15')]=function(_0x2dc479){var _0x27141a=this;return new Promise(function(_0x25acc6,_0x25688d){return db['Dynamics365Account'][_0x739c('0x16')]({'raw':_0x2dc479[_0x739c('0x17')]?_0x2dc479[_0x739c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2dc479[_0x739c('0x17')]?_0x2dc479['options']['where']||null:null,'attributes':_0x2dc479[_0x739c('0x17')]?_0x2dc479['options'][_0x739c('0x18')]||null:null,'limit':_0x2dc479[_0x739c('0x17')]?_0x2dc479['options'][_0x739c('0x19')]||null:null,'include':_0x2dc479['options']?_0x2dc479[_0x739c('0x17')]['include']?_[_0x739c('0x1a')](_0x2dc479[_0x739c('0x17')][_0x739c('0x1b')],function(_0x3baad0){return{'model':db[_0x3baad0[_0x739c('0x1c')]],'as':_0x3baad0['as'],'attributes':_0x3baad0[_0x739c('0x18')],'include':_0x3baad0[_0x739c('0x1b')]?_[_0x739c('0x1a')](_0x3baad0['include'],function(_0x384bc5){return{'model':db[_0x384bc5[_0x739c('0x1c')]],'as':_0x384bc5['as'],'attributes':_0x384bc5['attributes'],'include':_0x384bc5[_0x739c('0x1b')]?_['map'](_0x384bc5['include'],function(_0x4200b3){return{'model':db[_0x4200b3[_0x739c('0x1c')]],'as':_0x4200b3['as'],'attributes':_0x4200b3[_0x739c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x739c('0xa')](function(_0x2053a5){logger[_0x739c('0x13')](_0x739c('0x15'),_0x2dc479);logger['debug'](_0x739c('0x15'),_0x2dc479,JSON[_0x739c('0xe')](_0x2053a5));_0x25acc6(_0x2053a5);})[_0x739c('0x14')](function(_0x2de5e6){logger[_0x739c('0xf')](_0x739c('0x15'),_0x2de5e6[_0x739c('0x12')],_0x2dc479);_0x25688d(_0x27141a['error'](0x1f4,_0x2de5e6['message']));});});};exports['ShowDynamics365Account']=function(_0x570c90){var _0xc0bda8=this;return new Promise(function(_0x132256,_0x1aaae8){return db[_0x739c('0x1d')][_0x739c('0x1e')]({'raw':_0x570c90[_0x739c('0x17')]?_0x570c90[_0x739c('0x17')][_0x739c('0x1f')]===undefined?!![]:![]:!![],'where':_0x570c90[_0x739c('0x17')]?_0x570c90[_0x739c('0x17')][_0x739c('0x20')]||null:null,'attributes':_0x570c90[_0x739c('0x17')]?_0x570c90[_0x739c('0x17')][_0x739c('0x18')]||null:null,'include':_0x570c90[_0x739c('0x17')]?_0x570c90[_0x739c('0x17')][_0x739c('0x1b')]?_[_0x739c('0x1a')](_0x570c90[_0x739c('0x17')][_0x739c('0x1b')],function(_0x222262){return{'model':db[_0x222262[_0x739c('0x1c')]],'as':_0x222262['as'],'attributes':_0x222262[_0x739c('0x18')],'include':_0x222262[_0x739c('0x1b')]?_[_0x739c('0x1a')](_0x222262[_0x739c('0x1b')],function(_0x3a4fec){return{'model':db[_0x3a4fec[_0x739c('0x1c')]],'as':_0x3a4fec['as'],'attributes':_0x3a4fec[_0x739c('0x18')],'include':_0x3a4fec[_0x739c('0x1b')]?_[_0x739c('0x1a')](_0x3a4fec[_0x739c('0x1b')],function(_0x387276){return{'model':db[_0x387276[_0x739c('0x1c')]],'as':_0x387276['as'],'attributes':_0x387276[_0x739c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x147339){logger[_0x739c('0x13')]('ShowDynamics365Account',_0x570c90);logger[_0x739c('0xc')](_0x739c('0x21'),_0x570c90,JSON['stringify'](_0x147339));_0x132256(_0x147339);})['catch'](function(_0x46f6a6){logger[_0x739c('0xf')]('ShowDynamics365Account',_0x46f6a6[_0x739c('0x12')],_0x570c90);_0x1aaae8(_0xc0bda8[_0x739c('0xf')](0x1f4,_0x46f6a6[_0x739c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b70d54d..39bd924 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 _0xe261=['getSubjects','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0xad8453,_0x34b112){var _0xb2f50b=function(_0x15b59){while(--_0x15b59){_0xad8453['push'](_0xad8453['shift']());}};_0xb2f50b(++_0x34b112);}(_0xe261,0xf7));var _0x1e26=function(_0x262a8f,_0xe6e251){_0x262a8f=_0x262a8f-0x0;var _0x584588=_0xe261[_0x262a8f];return _0x584588;};'use strict';var multer=require(_0x1e26('0x0'));var util=require('util');var path=require(_0x1e26('0x1'));var timeout=require(_0x1e26('0x2'));var express=require(_0x1e26('0x3'));var router=express[_0x1e26('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1e26('0x5'));var interaction=require(_0x1e26('0x6'));var config=require(_0x1e26('0x7'));var controller=require(_0x1e26('0x8'));router[_0x1e26('0x9')]('/',auth[_0x1e26('0xa')](),controller[_0x1e26('0xb')]);router[_0x1e26('0x9')](_0x1e26('0xc'),auth['isAuthenticated'](),controller[_0x1e26('0xd')]);router['get'](_0x1e26('0xe'),auth[_0x1e26('0xa')](),controller[_0x1e26('0xf')]);router[_0x1e26('0x9')](_0x1e26('0x10'),auth[_0x1e26('0xa')](),controller[_0x1e26('0x11')]);router[_0x1e26('0x9')]('/:id/descriptions',auth[_0x1e26('0xa')](),controller['getDescriptions']);router[_0x1e26('0x12')]('/',auth[_0x1e26('0xa')](),controller['create']);router[_0x1e26('0x13')]('/:id',auth[_0x1e26('0xa')](),controller[_0x1e26('0x14')]);router[_0x1e26('0x15')](_0x1e26('0xc'),auth[_0x1e26('0xa')](),controller[_0x1e26('0x16')]);module[_0x1e26('0x17')]=router; \ No newline at end of file +var _0xc1c9=['getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects'];(function(_0x1ebd6b,_0xed39d1){var _0x224bb2=function(_0x50d480){while(--_0x50d480){_0x1ebd6b['push'](_0x1ebd6b['shift']());}};_0x224bb2(++_0xed39d1);}(_0xc1c9,0x13c));var _0x9c1c=function(_0x218756,_0x419c39){_0x218756=_0x218756-0x0;var _0x1b90ec=_0xc1c9[_0x218756];return _0x1b90ec;};'use strict';var multer=require(_0x9c1c('0x0'));var util=require(_0x9c1c('0x1'));var path=require('path');var timeout=require(_0x9c1c('0x2'));var express=require(_0x9c1c('0x3'));var router=express[_0x9c1c('0x4')]();var fs_extra=require(_0x9c1c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c1c('0x6'));var config=require('../../config/environment');var controller=require(_0x9c1c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9c1c('0x8')](_0x9c1c('0x9'),auth[_0x9c1c('0xa')](),controller[_0x9c1c('0xb')]);router['get']('/:id/fields',auth[_0x9c1c('0xa')](),controller[_0x9c1c('0xc')]);router[_0x9c1c('0x8')](_0x9c1c('0xd'),auth[_0x9c1c('0xa')](),controller[_0x9c1c('0xe')]);router[_0x9c1c('0x8')](_0x9c1c('0xf'),auth[_0x9c1c('0xa')](),controller[_0x9c1c('0x10')]);router[_0x9c1c('0x11')]('/',auth[_0x9c1c('0xa')](),controller['create']);router[_0x9c1c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9c1c('0x13')]);router[_0x9c1c('0x14')](_0x9c1c('0x9'),auth[_0x9c1c('0xa')](),controller[_0x9c1c('0x15')]);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 ed11938..f94c22b 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 _0x578d=['ENUM','incident','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x578d,0xb6));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd578('0x0'));module[_0xd578('0x1')]={'name':{'type':Sequelize[_0xd578('0x2')]},'description':{'type':Sequelize[_0xd578('0x2')]},'ticketType':{'type':Sequelize[_0xd578('0x3')](_0xd578('0x4'),'phonecall'),'defaultValue':_0xd578('0x4')}}; \ No newline at end of file +var _0xe9b9=['incident','phonecall','sequelize','STRING','ENUM'];(function(_0x585473,_0x6ffa8b){var _0x2fe60d=function(_0x417f7e){while(--_0x417f7e){_0x585473['push'](_0x585473['shift']());}};_0x2fe60d(++_0x6ffa8b);}(_0xe9b9,0x1c4));var _0x9e9b=function(_0x499eaf,_0x560a5a){_0x499eaf=_0x499eaf-0x0;var _0x2fa121=_0xe9b9[_0x499eaf];return _0x2fa121;};'use strict';var Sequelize=require(_0x9e9b('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e9b('0x1')]},'description':{'type':Sequelize[_0x9e9b('0x1')]},'ticketType':{'type':Sequelize[_0x9e9b('0x2')](_0x9e9b('0x3'),_0x9e9b('0x4')),'defaultValue':_0x9e9b('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 42d9084..7cf8992 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 _0xe3da=['fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','create','body','update','find','params','getFields','findOne','Dynamics365Field','order','getSubjects','pick','hasOwnProperty','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x3d5453,_0x5f7e31){var _0x1421c1=function(_0x4ed7a0){while(--_0x4ed7a0){_0x3d5453['push'](_0x3d5453['shift']());}};_0x1421c1(++_0x5f7e31);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xae3d('0x0'));var emlformat=require(_0xae3d('0x1'));var rimraf=require(_0xae3d('0x2'));var zipdir=require(_0xae3d('0x3'));var jsonpatch=require(_0xae3d('0x4'));var rp=require(_0xae3d('0x5'));var moment=require(_0xae3d('0x6'));var BPromise=require(_0xae3d('0x7'));var Mustache=require(_0xae3d('0x8'));var util=require(_0xae3d('0x9'));var path=require(_0xae3d('0xa'));var sox=require(_0xae3d('0xb'));var csv=require(_0xae3d('0xc'));var ejs=require(_0xae3d('0xd'));var fs=require('fs');var fs_extra=require(_0xae3d('0xe'));var _=require(_0xae3d('0xf'));var squel=require('squel');var crypto=require(_0xae3d('0x10'));var jsforce=require(_0xae3d('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xae3d('0x12'));var Papa=require(_0xae3d('0x13'));var Redis=require(_0xae3d('0x14'));var authService=require(_0xae3d('0x15'));var qs=require(_0xae3d('0x16'));var as=require(_0xae3d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae3d('0x18'))('api');var utils=require(_0xae3d('0x19'));var config=require(_0xae3d('0x1a'));var licenseUtil=require(_0xae3d('0x1b'));var db=require(_0xae3d('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xae3d('0x1d')][_0xae3d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x16fd19,_0x1605ac,_0x2afdd3,_0x430659){return new BPromise(function(_0x31498d,_0x4e646f){var _0x1fb7a9=_0x430659||client;return _0x1fb7a9[_0xae3d('0x1f')](_0x16fd19,_0x2afdd3)[_0xae3d('0x20')](function(_0x230afb){logger[_0xae3d('0x21')](_0xae3d('0x22'),_0x1605ac,'request\x20sent');logger[_0xae3d('0x23')](_0xae3d('0x24'),_0x1605ac,_0xae3d('0x25'),JSON['stringify'](_0x230afb));if(_0x230afb[_0xae3d('0x26')]){if(_0x230afb[_0xae3d('0x26')]['code']===0x1f4){logger['error'](_0xae3d('0x22'),_0x1605ac,_0x230afb[_0xae3d('0x26')][_0xae3d('0x27')]);return _0x4e646f(_0x230afb[_0xae3d('0x26')][_0xae3d('0x27')]);}logger['error'](_0xae3d('0x22'),_0x1605ac,_0x230afb['error'][_0xae3d('0x27')]);return _0x31498d(_0x230afb[_0xae3d('0x26')][_0xae3d('0x27')]);}else{logger[_0xae3d('0x21')](_0xae3d('0x22'),_0x1605ac,_0xae3d('0x25'));_0x31498d(_0x230afb[_0xae3d('0x28')][_0xae3d('0x27')]);}})[_0xae3d('0x29')](function(_0x11ecf7){logger[_0xae3d('0x26')](_0xae3d('0x22'),_0x1605ac,_0x11ecf7);_0x4e646f(_0x11ecf7);});});}function respondWithStatusCode(_0x37f5ff,_0x1b2acb){_0x1b2acb=_0x1b2acb||0xcc;return function(_0x44a4e0){if(_0x44a4e0){return _0x37f5ff[_0xae3d('0x2a')](_0x1b2acb);}return _0x37f5ff[_0xae3d('0x2b')](_0x1b2acb)[_0xae3d('0x2c')]();};}function respondWithResult(_0x2131e9,_0x1b1217){_0x1b1217=_0x1b1217||0xc8;return function(_0x5d45db){if(_0x5d45db){return _0x2131e9[_0xae3d('0x2b')](_0x1b1217)[_0xae3d('0x2d')](_0x5d45db);}};}function respondWithFilteredResult(_0xb5940,_0x52df0f){return function(_0x256bd0){if(_0x256bd0){var _0x4391db=_0x256bd0[_0xae3d('0x2e')],_0x8de288=_0x52df0f[_0xae3d('0x2f')],_0x54c1e1=_0x52df0f[_0xae3d('0x2f')]+_0x52df0f[_0xae3d('0x30')],_0x57864e;if(_0x54c1e1>=_0x4391db){_0x54c1e1=_0x4391db;_0x57864e=0xc8;}else{_0x57864e=0xce;}_0xb5940[_0xae3d('0x2b')](_0x57864e);return _0xb5940['set'](_0xae3d('0x31'),_0x8de288+'-'+_0x54c1e1+'/'+_0x4391db)[_0xae3d('0x2d')](_0x256bd0);}return null;};}function patchUpdates(_0x5a39c5){return function(_0x5c155e){try{jsonpatch[_0xae3d('0x32')](_0x5c155e,_0x5a39c5,!![]);}catch(_0x2cf750){return BPromise[_0xae3d('0x33')](_0x2cf750);}return _0x5c155e[_0xae3d('0x34')]();};}function saveUpdates(_0x6ef13c,_0x5356d4){return function(_0x49125f){if(_0x49125f){return _0x49125f['update'](_0x6ef13c)[_0xae3d('0x20')](function(_0x90b62a){return _0x90b62a;});}return null;};}function removeEntity(_0x4306c1,_0x270043){return function(_0x54a75c){if(_0x54a75c){return _0x54a75c[_0xae3d('0x35')]()[_0xae3d('0x20')](function(){_0x4306c1[_0xae3d('0x2b')](0xcc)[_0xae3d('0x2c')]();});}};}function handleEntityNotFound(_0x422437,_0x166631){return function(_0x2dabb4){if(!_0x2dabb4){_0x422437['sendStatus'](0x194);}return _0x2dabb4;};}function handleError(_0x8827c3,_0x5a9a54){_0x5a9a54=_0x5a9a54||0x1f4;return function(_0x55aae4){logger[_0xae3d('0x26')](_0x55aae4['stack']);if(_0x55aae4[_0xae3d('0x36')]){delete _0x55aae4['name'];}_0x8827c3['status'](_0x5a9a54)[_0xae3d('0x37')](_0x55aae4);};}exports[_0xae3d('0x38')]=function(_0x403484,_0x5c1f4d){var _0x211b17={},_0x58ea2f={},_0xce647f={'count':0x0,'rows':[]};var _0x136ab5=_[_0xae3d('0x39')](db[_0xae3d('0x3a')][_0xae3d('0x3b')],function(_0x3fc3c0){return{'name':_0x3fc3c0[_0xae3d('0x3c')],'type':_0x3fc3c0[_0xae3d('0x3d')][_0xae3d('0x3e')]};});_0x58ea2f[_0xae3d('0x3f')]=_[_0xae3d('0x39')](_0x136ab5,'name');_0x58ea2f['query']=_[_0xae3d('0x40')](_0x403484['query']);_0x58ea2f[_0xae3d('0x41')]=_[_0xae3d('0x42')](_0x58ea2f[_0xae3d('0x3f')],_0x58ea2f[_0xae3d('0x43')]);_0x211b17[_0xae3d('0x44')]=_[_0xae3d('0x42')](_0x58ea2f[_0xae3d('0x3f')],qs[_0xae3d('0x45')](_0x403484[_0xae3d('0x43')][_0xae3d('0x45')]));_0x211b17[_0xae3d('0x44')]=_0x211b17['attributes'][_0xae3d('0x46')]?_0x211b17[_0xae3d('0x44')]:_0x58ea2f[_0xae3d('0x3f')];if(!_0x403484['query']['hasOwnProperty'](_0xae3d('0x47'))){_0x211b17[_0xae3d('0x30')]=qs['limit'](_0x403484[_0xae3d('0x43')][_0xae3d('0x30')]);_0x211b17[_0xae3d('0x2f')]=qs[_0xae3d('0x2f')](_0x403484[_0xae3d('0x43')][_0xae3d('0x2f')]);}_0x211b17['order']=qs[_0xae3d('0x48')](_0x403484[_0xae3d('0x43')][_0xae3d('0x48')]);_0x211b17[_0xae3d('0x49')]=qs[_0xae3d('0x41')](_['pick'](_0x403484[_0xae3d('0x43')],_0x58ea2f['filters']),_0x136ab5);if(_0x403484[_0xae3d('0x43')][_0xae3d('0x4a')]){_0x211b17[_0xae3d('0x49')]=_[_0xae3d('0x4b')](_0x211b17['where'],{'$or':_['map'](_0x136ab5,function(_0x5e924b){if(_0x5e924b[_0xae3d('0x3d')]!==_0xae3d('0x4c')){var _0x4dea21={};_0x4dea21[_0x5e924b['name']]={'$like':'%'+_0x403484['query'][_0xae3d('0x4a')]+'%'};return _0x4dea21;}})});}_0x211b17=_[_0xae3d('0x4b')]({},_0x211b17,_0x403484[_0xae3d('0x4d')]);var _0x1d410e={'where':_0x211b17[_0xae3d('0x49')]};return db[_0xae3d('0x3a')][_0xae3d('0x2e')](_0x1d410e)['then'](function(_0x566e31){_0xce647f['count']=_0x566e31;if(_0x403484[_0xae3d('0x43')]['includeAll']){_0x211b17[_0xae3d('0x4e')]=[{'all':!![]}];}return db[_0xae3d('0x3a')][_0xae3d('0x4f')](_0x211b17);})[_0xae3d('0x20')](function(_0x1e593c){_0xce647f[_0xae3d('0x50')]=_0x1e593c;return _0xce647f;})[_0xae3d('0x20')](respondWithFilteredResult(_0x5c1f4d,_0x211b17))[_0xae3d('0x29')](handleError(_0x5c1f4d,null));};exports[_0xae3d('0x51')]=function(_0x4ed0f9,_0x49b8df){var _0x5684a1={'raw':![],'where':{'id':_0x4ed0f9['params']['id']}},_0x53f835={};_0x53f835[_0xae3d('0x3f')]=_[_0xae3d('0x40')](db[_0xae3d('0x3a')][_0xae3d('0x3b')]);_0x53f835['query']=_['keys'](_0x4ed0f9[_0xae3d('0x43')]);_0x53f835[_0xae3d('0x41')]=_[_0xae3d('0x42')](_0x53f835[_0xae3d('0x3f')],_0x53f835['query']);_0x5684a1[_0xae3d('0x44')]=_[_0xae3d('0x42')](_0x53f835[_0xae3d('0x3f')],qs[_0xae3d('0x45')](_0x4ed0f9[_0xae3d('0x43')][_0xae3d('0x45')]));_0x5684a1[_0xae3d('0x44')]=_0x5684a1[_0xae3d('0x44')][_0xae3d('0x46')]?_0x5684a1[_0xae3d('0x44')]:_0x53f835[_0xae3d('0x3f')];if(_0x4ed0f9[_0xae3d('0x43')]['includeAll']){_0x5684a1['include']=[{'all':!![]}];}_0x5684a1=_['merge']({},_0x5684a1,_0x4ed0f9[_0xae3d('0x4d')]);return db[_0xae3d('0x3a')]['find'](_0x5684a1)[_0xae3d('0x20')](handleEntityNotFound(_0x49b8df,null))['then'](respondWithResult(_0x49b8df,null))['catch'](handleError(_0x49b8df,null));};exports[_0xae3d('0x52')]=function(_0x194f7c,_0x440ae6){return db[_0xae3d('0x3a')][_0xae3d('0x52')](_0x194f7c[_0xae3d('0x53')],{})[_0xae3d('0x20')](respondWithResult(_0x440ae6,0xc9))['catch'](handleError(_0x440ae6,null));};exports[_0xae3d('0x54')]=function(_0x165c63,_0x24fa2a){if(_0x165c63[_0xae3d('0x53')]['id']){delete _0x165c63['body']['id'];}return db[_0xae3d('0x3a')][_0xae3d('0x55')]({'where':{'id':_0x165c63[_0xae3d('0x56')]['id']}})[_0xae3d('0x20')](handleEntityNotFound(_0x24fa2a,null))['then'](saveUpdates(_0x165c63['body'],null))['then'](respondWithResult(_0x24fa2a,null))[_0xae3d('0x29')](handleError(_0x24fa2a,null));};exports['destroy']=function(_0x5ce3a8,_0x3c57b9){return db[_0xae3d('0x3a')][_0xae3d('0x55')]({'where':{'id':_0x5ce3a8[_0xae3d('0x56')]['id']}})[_0xae3d('0x20')](handleEntityNotFound(_0x3c57b9,null))[_0xae3d('0x20')](removeEntity(_0x3c57b9,null))['catch'](handleError(_0x3c57b9,null));};exports[_0xae3d('0x57')]=function(_0x4448d5,_0x1f9367,_0x32b524){var _0x285889={};var _0x91ba60={};var _0x4a2913;var _0x3cb7bd;return db[_0xae3d('0x3a')][_0xae3d('0x58')]({'where':{'id':_0x4448d5['params']['id']}})['then'](handleEntityNotFound(_0x1f9367,null))['then'](function(_0x2fd945){if(_0x2fd945){_0x4a2913=_0x2fd945;_0x91ba60[_0xae3d('0x3f')]=_['keys'](db[_0xae3d('0x59')][_0xae3d('0x3b')]);_0x91ba60[_0xae3d('0x43')]=_['keys'](_0x4448d5[_0xae3d('0x43')]);_0x91ba60[_0xae3d('0x41')]=_[_0xae3d('0x42')](_0x91ba60[_0xae3d('0x3f')],_0x91ba60[_0xae3d('0x43')]);_0x285889[_0xae3d('0x44')]=_[_0xae3d('0x42')](_0x91ba60[_0xae3d('0x3f')],qs['fields'](_0x4448d5['query'][_0xae3d('0x45')]));_0x285889[_0xae3d('0x44')]=_0x285889[_0xae3d('0x44')]['length']?_0x285889['attributes']:_0x91ba60[_0xae3d('0x3f')];_0x285889[_0xae3d('0x5a')]=qs[_0xae3d('0x48')](_0x4448d5[_0xae3d('0x43')]['sort']);_0x285889[_0xae3d('0x49')]=qs[_0xae3d('0x41')](_['pick'](_0x4448d5[_0xae3d('0x43')],_0x91ba60[_0xae3d('0x41')]));if(_0x4448d5[_0xae3d('0x43')][_0xae3d('0x4a')]){_0x285889[_0xae3d('0x49')]=_[_0xae3d('0x4b')](_0x285889[_0xae3d('0x49')],{'$or':_['map'](_0x285889[_0xae3d('0x44')],function(_0x12f04a){var _0x22828c={};_0x22828c[_0x12f04a]={'$like':'%'+_0x4448d5[_0xae3d('0x43')][_0xae3d('0x4a')]+'%'};return _0x22828c;})});}_0x285889=_['merge']({},_0x285889,_0x4448d5[_0xae3d('0x4d')]);return _0x4a2913[_0xae3d('0x57')](_0x285889);}})[_0xae3d('0x20')](function(_0x664cdc){if(_0x664cdc){_0x3cb7bd=_0x664cdc[_0xae3d('0x46')];if(!_0x4448d5[_0xae3d('0x43')]['hasOwnProperty'](_0xae3d('0x47'))){_0x285889[_0xae3d('0x30')]=qs['limit'](_0x4448d5[_0xae3d('0x43')][_0xae3d('0x30')]);_0x285889[_0xae3d('0x2f')]=qs['offset'](_0x4448d5['query'][_0xae3d('0x2f')]);}return _0x4a2913[_0xae3d('0x57')](_0x285889);}})[_0xae3d('0x20')](function(_0x3c5464){if(_0x3c5464){return _0x3c5464?{'count':_0x3cb7bd,'rows':_0x3c5464}:null;}})[_0xae3d('0x20')](respondWithResult(_0x1f9367,null))[_0xae3d('0x29')](handleError(_0x1f9367,null));};exports[_0xae3d('0x5b')]=function(_0x5548f9,_0x6e13d0,_0x2e696d){var _0x4e3161={};var _0x4380ae={};var _0x518da8;var _0x24684f;return db[_0xae3d('0x3a')][_0xae3d('0x58')]({'where':{'id':_0x5548f9[_0xae3d('0x56')]['id']}})[_0xae3d('0x20')](handleEntityNotFound(_0x6e13d0,null))['then'](function(_0x1b1bb4){if(_0x1b1bb4){_0x518da8=_0x1b1bb4;_0x4380ae[_0xae3d('0x3f')]=_[_0xae3d('0x40')](db['Dynamics365Field']['rawAttributes']);_0x4380ae[_0xae3d('0x43')]=_[_0xae3d('0x40')](_0x5548f9['query']);_0x4380ae['filters']=_[_0xae3d('0x42')](_0x4380ae['model'],_0x4380ae[_0xae3d('0x43')]);_0x4e3161['attributes']=_['intersection'](_0x4380ae['model'],qs['fields'](_0x5548f9[_0xae3d('0x43')][_0xae3d('0x45')]));_0x4e3161['attributes']=_0x4e3161['attributes'][_0xae3d('0x46')]?_0x4e3161[_0xae3d('0x44')]:_0x4380ae[_0xae3d('0x3f')];_0x4e3161[_0xae3d('0x5a')]=qs[_0xae3d('0x48')](_0x5548f9[_0xae3d('0x43')][_0xae3d('0x48')]);_0x4e3161['where']=qs[_0xae3d('0x41')](_[_0xae3d('0x5c')](_0x5548f9[_0xae3d('0x43')],_0x4380ae[_0xae3d('0x41')]));if(_0x5548f9[_0xae3d('0x43')][_0xae3d('0x4a')]){_0x4e3161['where']=_[_0xae3d('0x4b')](_0x4e3161[_0xae3d('0x49')],{'$or':_['map'](_0x4e3161['attributes'],function(_0x172b69){var _0x3ef5ff={};_0x3ef5ff[_0x172b69]={'$like':'%'+_0x5548f9['query'][_0xae3d('0x4a')]+'%'};return _0x3ef5ff;})});}_0x4e3161=_[_0xae3d('0x4b')]({},_0x4e3161,_0x5548f9[_0xae3d('0x4d')]);return _0x518da8['getSubjects'](_0x4e3161);}})[_0xae3d('0x20')](function(_0x1e9636){if(_0x1e9636){_0x24684f=_0x1e9636['length'];if(!_0x5548f9['query'][_0xae3d('0x5d')](_0xae3d('0x47'))){_0x4e3161[_0xae3d('0x30')]=qs['limit'](_0x5548f9[_0xae3d('0x43')][_0xae3d('0x30')]);_0x4e3161['offset']=qs[_0xae3d('0x2f')](_0x5548f9[_0xae3d('0x43')][_0xae3d('0x2f')]);}return _0x518da8['getSubjects'](_0x4e3161);}})[_0xae3d('0x20')](function(_0x290335){if(_0x290335){return _0x290335?{'count':_0x24684f,'rows':_0x290335}:null;}})[_0xae3d('0x20')](respondWithResult(_0x6e13d0,null))['catch'](handleError(_0x6e13d0,null));};exports[_0xae3d('0x5e')]=function(_0x58b079,_0x2a7a1f,_0x48ef2a){var _0x56f7d2={};var _0x3df66f={};var _0x56c1e8;var _0x258c3b;return db[_0xae3d('0x3a')][_0xae3d('0x58')]({'where':{'id':_0x58b079[_0xae3d('0x56')]['id']}})['then'](handleEntityNotFound(_0x2a7a1f,null))[_0xae3d('0x20')](function(_0xa3a5a2){if(_0xa3a5a2){_0x56c1e8=_0xa3a5a2;_0x3df66f[_0xae3d('0x3f')]=_[_0xae3d('0x40')](db[_0xae3d('0x59')][_0xae3d('0x3b')]);_0x3df66f[_0xae3d('0x43')]=_[_0xae3d('0x40')](_0x58b079[_0xae3d('0x43')]);_0x3df66f[_0xae3d('0x41')]=_[_0xae3d('0x42')](_0x3df66f[_0xae3d('0x3f')],_0x3df66f[_0xae3d('0x43')]);_0x56f7d2[_0xae3d('0x44')]=_[_0xae3d('0x42')](_0x3df66f[_0xae3d('0x3f')],qs[_0xae3d('0x45')](_0x58b079['query'][_0xae3d('0x45')]));_0x56f7d2[_0xae3d('0x44')]=_0x56f7d2[_0xae3d('0x44')][_0xae3d('0x46')]?_0x56f7d2[_0xae3d('0x44')]:_0x3df66f['model'];_0x56f7d2[_0xae3d('0x5a')]=qs[_0xae3d('0x48')](_0x58b079[_0xae3d('0x43')][_0xae3d('0x48')]);_0x56f7d2[_0xae3d('0x49')]=qs[_0xae3d('0x41')](_[_0xae3d('0x5c')](_0x58b079[_0xae3d('0x43')],_0x3df66f['filters']));if(_0x58b079[_0xae3d('0x43')][_0xae3d('0x4a')]){_0x56f7d2[_0xae3d('0x49')]=_['merge'](_0x56f7d2[_0xae3d('0x49')],{'$or':_[_0xae3d('0x39')](_0x56f7d2[_0xae3d('0x44')],function(_0x521883){var _0x3451cf={};_0x3451cf[_0x521883]={'$like':'%'+_0x58b079[_0xae3d('0x43')]['filter']+'%'};return _0x3451cf;})});}_0x56f7d2=_[_0xae3d('0x4b')]({},_0x56f7d2,_0x58b079['options']);return _0x56c1e8[_0xae3d('0x5e')](_0x56f7d2);}})['then'](function(_0x1d4b8c){if(_0x1d4b8c){_0x258c3b=_0x1d4b8c[_0xae3d('0x46')];if(!_0x58b079[_0xae3d('0x43')][_0xae3d('0x5d')](_0xae3d('0x47'))){_0x56f7d2['limit']=qs[_0xae3d('0x30')](_0x58b079[_0xae3d('0x43')]['limit']);_0x56f7d2['offset']=qs[_0xae3d('0x2f')](_0x58b079[_0xae3d('0x43')][_0xae3d('0x2f')]);}return _0x56c1e8[_0xae3d('0x5e')](_0x56f7d2);}})['then'](function(_0x204bb1){if(_0x204bb1){return _0x204bb1?{'count':_0x258c3b,'rows':_0x204bb1}:null;}})[_0xae3d('0x20')](respondWithResult(_0x2a7a1f,null))[_0xae3d('0x29')](handleError(_0x2a7a1f,null));}; \ No newline at end of file +var _0xfb65=['index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','create','body','find','findOne','Dynamics365Field','getFields','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','send'];(function(_0x23ff83,_0x1bc5c5){var _0x298bb5=function(_0x4d730d){while(--_0x4d730d){_0x23ff83['push'](_0x23ff83['shift']());}};_0x298bb5(++_0x1bc5c5);}(_0xfb65,0x82));var _0x5fb6=function(_0x51ac68,_0x505934){_0x51ac68=_0x51ac68-0x0;var _0x2fc26f=_0xfb65[_0x51ac68];return _0x2fc26f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5fb6('0x0'));var rimraf=require(_0x5fb6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fb6('0x2'));var rp=require('request-promise');var moment=require(_0x5fb6('0x3'));var BPromise=require(_0x5fb6('0x4'));var Mustache=require(_0x5fb6('0x5'));var util=require(_0x5fb6('0x6'));var path=require(_0x5fb6('0x7'));var sox=require(_0x5fb6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5fb6('0x9'));var _=require(_0x5fb6('0xa'));var squel=require(_0x5fb6('0xb'));var crypto=require(_0x5fb6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5fb6('0xd'));var toCsv=require(_0x5fb6('0xe'));var querystring=require(_0x5fb6('0xf'));var Papa=require(_0x5fb6('0x10'));var Redis=require('ioredis');var authService=require(_0x5fb6('0x11'));var qs=require(_0x5fb6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fb6('0x13'));var logger=require(_0x5fb6('0x14'))(_0x5fb6('0x15'));var utils=require(_0x5fb6('0x16'));var config=require(_0x5fb6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fb6('0x18'))['db'];var jayson=require(_0x5fb6('0x19'));var client=jayson[_0x5fb6('0x1a')][_0x5fb6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x6b58a2,_0x1bab1f,_0x1a391f,_0x1ded21){return new BPromise(function(_0x5e69c3,_0x47a197){var _0x46f1cf=_0x1ded21||client;return _0x46f1cf[_0x5fb6('0x1c')](_0x6b58a2,_0x1a391f)['then'](function(_0x1d57b1){logger[_0x5fb6('0x1d')](_0x5fb6('0x1e'),_0x1bab1f,'request\x20sent');logger[_0x5fb6('0x1f')](_0x5fb6('0x20'),_0x1bab1f,_0x5fb6('0x21'),JSON[_0x5fb6('0x22')](_0x1d57b1));if(_0x1d57b1[_0x5fb6('0x23')]){if(_0x1d57b1[_0x5fb6('0x23')]['code']===0x1f4){logger[_0x5fb6('0x23')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1bab1f,_0x1d57b1[_0x5fb6('0x23')]['message']);return _0x47a197(_0x1d57b1[_0x5fb6('0x23')][_0x5fb6('0x24')]);}logger[_0x5fb6('0x23')](_0x5fb6('0x1e'),_0x1bab1f,_0x1d57b1[_0x5fb6('0x23')][_0x5fb6('0x24')]);return _0x5e69c3(_0x1d57b1[_0x5fb6('0x23')]['message']);}else{logger['info'](_0x5fb6('0x1e'),_0x1bab1f,_0x5fb6('0x21'));_0x5e69c3(_0x1d57b1['result'][_0x5fb6('0x24')]);}})[_0x5fb6('0x25')](function(_0x331bba){logger[_0x5fb6('0x23')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1bab1f,_0x331bba);_0x47a197(_0x331bba);});});}function respondWithStatusCode(_0x2fca34,_0x44aebe){_0x44aebe=_0x44aebe||0xcc;return function(_0x45b484){if(_0x45b484){return _0x2fca34[_0x5fb6('0x26')](_0x44aebe);}return _0x2fca34[_0x5fb6('0x27')](_0x44aebe)[_0x5fb6('0x28')]();};}function respondWithResult(_0x4e2bff,_0x4cbdaf){_0x4cbdaf=_0x4cbdaf||0xc8;return function(_0x298b44){if(_0x298b44){return _0x4e2bff[_0x5fb6('0x27')](_0x4cbdaf)[_0x5fb6('0x29')](_0x298b44);}};}function respondWithFilteredResult(_0x3ce22f,_0x2731a3){return function(_0x1c3b0f){if(_0x1c3b0f){var _0x36ac58=_0x1c3b0f[_0x5fb6('0x2a')],_0x4d6e01=_0x2731a3['offset'],_0xe9a4cc=_0x2731a3[_0x5fb6('0x2b')]+_0x2731a3[_0x5fb6('0x2c')],_0x3f9b86;if(_0xe9a4cc>=_0x36ac58){_0xe9a4cc=_0x36ac58;_0x3f9b86=0xc8;}else{_0x3f9b86=0xce;}_0x3ce22f['status'](_0x3f9b86);return _0x3ce22f[_0x5fb6('0x2d')](_0x5fb6('0x2e'),_0x4d6e01+'-'+_0xe9a4cc+'/'+_0x36ac58)['json'](_0x1c3b0f);}return null;};}function patchUpdates(_0x1edc30){return function(_0x4856d9){try{jsonpatch[_0x5fb6('0x2f')](_0x4856d9,_0x1edc30,!![]);}catch(_0x53dbeb){return BPromise['reject'](_0x53dbeb);}return _0x4856d9[_0x5fb6('0x30')]();};}function saveUpdates(_0x30bc6c,_0x3199d4){return function(_0x13e045){if(_0x13e045){return _0x13e045[_0x5fb6('0x31')](_0x30bc6c)[_0x5fb6('0x32')](function(_0x585658){return _0x585658;});}return null;};}function removeEntity(_0x1db4ac,_0x39569e){return function(_0x11b2d1){if(_0x11b2d1){return _0x11b2d1[_0x5fb6('0x33')]()[_0x5fb6('0x32')](function(){_0x1db4ac[_0x5fb6('0x27')](0xcc)[_0x5fb6('0x28')]();});}};}function handleEntityNotFound(_0xf78e09,_0x396e72){return function(_0x40c938){if(!_0x40c938){_0xf78e09[_0x5fb6('0x26')](0x194);}return _0x40c938;};}function handleError(_0x5e3a38,_0xde8b2c){_0xde8b2c=_0xde8b2c||0x1f4;return function(_0x1aa02b){logger['error'](_0x1aa02b[_0x5fb6('0x34')]);if(_0x1aa02b['name']){delete _0x1aa02b['name'];}_0x5e3a38[_0x5fb6('0x27')](_0xde8b2c)[_0x5fb6('0x35')](_0x1aa02b);};}exports[_0x5fb6('0x36')]=function(_0x4c9d65,_0x1f183d){var _0x4e7569={},_0x5c256c={},_0x10065e={'count':0x0,'rows':[]};var _0x2fce55=_[_0x5fb6('0x37')](db[_0x5fb6('0x38')][_0x5fb6('0x39')],function(_0x1b96c0){return{'name':_0x1b96c0[_0x5fb6('0x3a')],'type':_0x1b96c0[_0x5fb6('0x3b')][_0x5fb6('0x3c')]};});_0x5c256c[_0x5fb6('0x3d')]=_[_0x5fb6('0x37')](_0x2fce55,_0x5fb6('0x3e'));_0x5c256c['query']=_[_0x5fb6('0x3f')](_0x4c9d65[_0x5fb6('0x40')]);_0x5c256c[_0x5fb6('0x41')]=_['intersection'](_0x5c256c[_0x5fb6('0x3d')],_0x5c256c['query']);_0x4e7569[_0x5fb6('0x42')]=_['intersection'](_0x5c256c[_0x5fb6('0x3d')],qs[_0x5fb6('0x43')](_0x4c9d65[_0x5fb6('0x40')][_0x5fb6('0x43')]));_0x4e7569[_0x5fb6('0x42')]=_0x4e7569['attributes'][_0x5fb6('0x44')]?_0x4e7569[_0x5fb6('0x42')]:_0x5c256c[_0x5fb6('0x3d')];if(!_0x4c9d65[_0x5fb6('0x40')]['hasOwnProperty'](_0x5fb6('0x45'))){_0x4e7569[_0x5fb6('0x2c')]=qs[_0x5fb6('0x2c')](_0x4c9d65[_0x5fb6('0x40')][_0x5fb6('0x2c')]);_0x4e7569[_0x5fb6('0x2b')]=qs['offset'](_0x4c9d65[_0x5fb6('0x40')][_0x5fb6('0x2b')]);}_0x4e7569[_0x5fb6('0x46')]=qs[_0x5fb6('0x47')](_0x4c9d65[_0x5fb6('0x40')][_0x5fb6('0x47')]);_0x4e7569[_0x5fb6('0x48')]=qs[_0x5fb6('0x41')](_[_0x5fb6('0x49')](_0x4c9d65[_0x5fb6('0x40')],_0x5c256c[_0x5fb6('0x41')]),_0x2fce55);if(_0x4c9d65['query'][_0x5fb6('0x4a')]){_0x4e7569['where']=_[_0x5fb6('0x4b')](_0x4e7569[_0x5fb6('0x48')],{'$or':_['map'](_0x2fce55,function(_0x116119){if(_0x116119[_0x5fb6('0x3b')]!==_0x5fb6('0x4c')){var _0x58424b={};_0x58424b[_0x116119['name']]={'$like':'%'+_0x4c9d65[_0x5fb6('0x40')][_0x5fb6('0x4a')]+'%'};return _0x58424b;}})});}_0x4e7569=_[_0x5fb6('0x4b')]({},_0x4e7569,_0x4c9d65[_0x5fb6('0x4d')]);var _0x43b442={'where':_0x4e7569[_0x5fb6('0x48')]};return db[_0x5fb6('0x38')][_0x5fb6('0x2a')](_0x43b442)[_0x5fb6('0x32')](function(_0x1cd003){_0x10065e[_0x5fb6('0x2a')]=_0x1cd003;if(_0x4c9d65['query'][_0x5fb6('0x4e')]){_0x4e7569['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x5fb6('0x4f')](_0x4e7569);})[_0x5fb6('0x32')](function(_0x18cfb1){_0x10065e[_0x5fb6('0x50')]=_0x18cfb1;return _0x10065e;})[_0x5fb6('0x32')](respondWithFilteredResult(_0x1f183d,_0x4e7569))[_0x5fb6('0x25')](handleError(_0x1f183d,null));};exports[_0x5fb6('0x51')]=function(_0x5729a2,_0x3c29b4){var _0xf3571d={'raw':![],'where':{'id':_0x5729a2[_0x5fb6('0x52')]['id']}},_0x59c923={};_0x59c923[_0x5fb6('0x3d')]=_[_0x5fb6('0x3f')](db[_0x5fb6('0x38')][_0x5fb6('0x39')]);_0x59c923[_0x5fb6('0x40')]=_[_0x5fb6('0x3f')](_0x5729a2[_0x5fb6('0x40')]);_0x59c923['filters']=_[_0x5fb6('0x53')](_0x59c923[_0x5fb6('0x3d')],_0x59c923['query']);_0xf3571d[_0x5fb6('0x42')]=_[_0x5fb6('0x53')](_0x59c923[_0x5fb6('0x3d')],qs[_0x5fb6('0x43')](_0x5729a2['query']['fields']));_0xf3571d[_0x5fb6('0x42')]=_0xf3571d[_0x5fb6('0x42')][_0x5fb6('0x44')]?_0xf3571d['attributes']:_0x59c923[_0x5fb6('0x3d')];if(_0x5729a2['query'][_0x5fb6('0x4e')]){_0xf3571d['include']=[{'all':!![]}];}_0xf3571d=_[_0x5fb6('0x4b')]({},_0xf3571d,_0x5729a2[_0x5fb6('0x4d')]);return db[_0x5fb6('0x38')]['find'](_0xf3571d)[_0x5fb6('0x32')](handleEntityNotFound(_0x3c29b4,null))[_0x5fb6('0x32')](respondWithResult(_0x3c29b4,null))[_0x5fb6('0x25')](handleError(_0x3c29b4,null));};exports[_0x5fb6('0x54')]=function(_0x1d89db,_0x39b672){return db[_0x5fb6('0x38')][_0x5fb6('0x54')](_0x1d89db[_0x5fb6('0x55')],{})[_0x5fb6('0x32')](respondWithResult(_0x39b672,0xc9))[_0x5fb6('0x25')](handleError(_0x39b672,null));};exports['update']=function(_0x4385c1,_0x5b01ae){if(_0x4385c1[_0x5fb6('0x55')]['id']){delete _0x4385c1[_0x5fb6('0x55')]['id'];}return db[_0x5fb6('0x38')][_0x5fb6('0x56')]({'where':{'id':_0x4385c1[_0x5fb6('0x52')]['id']}})[_0x5fb6('0x32')](handleEntityNotFound(_0x5b01ae,null))['then'](saveUpdates(_0x4385c1['body'],null))['then'](respondWithResult(_0x5b01ae,null))['catch'](handleError(_0x5b01ae,null));};exports[_0x5fb6('0x33')]=function(_0x2082dc,_0x3342d1){return db[_0x5fb6('0x38')]['find']({'where':{'id':_0x2082dc[_0x5fb6('0x52')]['id']}})[_0x5fb6('0x32')](handleEntityNotFound(_0x3342d1,null))['then'](removeEntity(_0x3342d1,null))[_0x5fb6('0x25')](handleError(_0x3342d1,null));};exports['getFields']=function(_0x2a879e,_0x19ded3,_0x4d541d){var _0x405ecb={};var _0x43919b={};var _0x1b9bd8;var _0x4da260;return db[_0x5fb6('0x38')][_0x5fb6('0x57')]({'where':{'id':_0x2a879e[_0x5fb6('0x52')]['id']}})[_0x5fb6('0x32')](handleEntityNotFound(_0x19ded3,null))[_0x5fb6('0x32')](function(_0x3d05c2){if(_0x3d05c2){_0x1b9bd8=_0x3d05c2;_0x43919b[_0x5fb6('0x3d')]=_['keys'](db[_0x5fb6('0x58')][_0x5fb6('0x39')]);_0x43919b[_0x5fb6('0x40')]=_[_0x5fb6('0x3f')](_0x2a879e[_0x5fb6('0x40')]);_0x43919b[_0x5fb6('0x41')]=_['intersection'](_0x43919b[_0x5fb6('0x3d')],_0x43919b['query']);_0x405ecb[_0x5fb6('0x42')]=_[_0x5fb6('0x53')](_0x43919b[_0x5fb6('0x3d')],qs[_0x5fb6('0x43')](_0x2a879e[_0x5fb6('0x40')][_0x5fb6('0x43')]));_0x405ecb[_0x5fb6('0x42')]=_0x405ecb[_0x5fb6('0x42')]['length']?_0x405ecb['attributes']:_0x43919b[_0x5fb6('0x3d')];_0x405ecb[_0x5fb6('0x46')]=qs[_0x5fb6('0x47')](_0x2a879e[_0x5fb6('0x40')]['sort']);_0x405ecb['where']=qs[_0x5fb6('0x41')](_['pick'](_0x2a879e['query'],_0x43919b[_0x5fb6('0x41')]));if(_0x2a879e[_0x5fb6('0x40')][_0x5fb6('0x4a')]){_0x405ecb[_0x5fb6('0x48')]=_[_0x5fb6('0x4b')](_0x405ecb['where'],{'$or':_[_0x5fb6('0x37')](_0x405ecb['attributes'],function(_0x300ef6){var _0x1853f4={};_0x1853f4[_0x300ef6]={'$like':'%'+_0x2a879e[_0x5fb6('0x40')][_0x5fb6('0x4a')]+'%'};return _0x1853f4;})});}_0x405ecb=_[_0x5fb6('0x4b')]({},_0x405ecb,_0x2a879e[_0x5fb6('0x4d')]);return _0x1b9bd8['getFields'](_0x405ecb);}})[_0x5fb6('0x32')](function(_0x31de5f){if(_0x31de5f){_0x4da260=_0x31de5f[_0x5fb6('0x44')];if(!_0x2a879e['query']['hasOwnProperty']('nolimit')){_0x405ecb[_0x5fb6('0x2c')]=qs[_0x5fb6('0x2c')](_0x2a879e[_0x5fb6('0x40')][_0x5fb6('0x2c')]);_0x405ecb[_0x5fb6('0x2b')]=qs[_0x5fb6('0x2b')](_0x2a879e[_0x5fb6('0x40')]['offset']);}return _0x1b9bd8[_0x5fb6('0x59')](_0x405ecb);}})[_0x5fb6('0x32')](function(_0x3c99d2){if(_0x3c99d2){return _0x3c99d2?{'count':_0x4da260,'rows':_0x3c99d2}:null;}})[_0x5fb6('0x32')](respondWithResult(_0x19ded3,null))[_0x5fb6('0x25')](handleError(_0x19ded3,null));};exports['getSubjects']=function(_0x56223d,_0x2c8b19,_0x547006){var _0x5cda26={};var _0x360170={};var _0x539301;var _0x4e01ab;return db['Dynamics365Configuration'][_0x5fb6('0x57')]({'where':{'id':_0x56223d[_0x5fb6('0x52')]['id']}})[_0x5fb6('0x32')](handleEntityNotFound(_0x2c8b19,null))[_0x5fb6('0x32')](function(_0x284e09){if(_0x284e09){_0x539301=_0x284e09;_0x360170[_0x5fb6('0x3d')]=_[_0x5fb6('0x3f')](db[_0x5fb6('0x58')][_0x5fb6('0x39')]);_0x360170[_0x5fb6('0x40')]=_[_0x5fb6('0x3f')](_0x56223d[_0x5fb6('0x40')]);_0x360170[_0x5fb6('0x41')]=_[_0x5fb6('0x53')](_0x360170[_0x5fb6('0x3d')],_0x360170[_0x5fb6('0x40')]);_0x5cda26[_0x5fb6('0x42')]=_[_0x5fb6('0x53')](_0x360170['model'],qs['fields'](_0x56223d[_0x5fb6('0x40')]['fields']));_0x5cda26['attributes']=_0x5cda26[_0x5fb6('0x42')][_0x5fb6('0x44')]?_0x5cda26['attributes']:_0x360170[_0x5fb6('0x3d')];_0x5cda26[_0x5fb6('0x46')]=qs[_0x5fb6('0x47')](_0x56223d['query'][_0x5fb6('0x47')]);_0x5cda26[_0x5fb6('0x48')]=qs[_0x5fb6('0x41')](_[_0x5fb6('0x49')](_0x56223d[_0x5fb6('0x40')],_0x360170['filters']));if(_0x56223d['query']['filter']){_0x5cda26[_0x5fb6('0x48')]=_[_0x5fb6('0x4b')](_0x5cda26[_0x5fb6('0x48')],{'$or':_[_0x5fb6('0x37')](_0x5cda26[_0x5fb6('0x42')],function(_0x1d11d0){var _0xacfbee={};_0xacfbee[_0x1d11d0]={'$like':'%'+_0x56223d[_0x5fb6('0x40')][_0x5fb6('0x4a')]+'%'};return _0xacfbee;})});}_0x5cda26=_[_0x5fb6('0x4b')]({},_0x5cda26,_0x56223d[_0x5fb6('0x4d')]);return _0x539301['getSubjects'](_0x5cda26);}})['then'](function(_0x4af45b){if(_0x4af45b){_0x4e01ab=_0x4af45b[_0x5fb6('0x44')];if(!_0x56223d[_0x5fb6('0x40')][_0x5fb6('0x5a')](_0x5fb6('0x45'))){_0x5cda26[_0x5fb6('0x2c')]=qs['limit'](_0x56223d[_0x5fb6('0x40')]['limit']);_0x5cda26[_0x5fb6('0x2b')]=qs[_0x5fb6('0x2b')](_0x56223d['query'][_0x5fb6('0x2b')]);}return _0x539301['getSubjects'](_0x5cda26);}})[_0x5fb6('0x32')](function(_0x1a95f0){if(_0x1a95f0){return _0x1a95f0?{'count':_0x4e01ab,'rows':_0x1a95f0}:null;}})[_0x5fb6('0x32')](respondWithResult(_0x2c8b19,null))[_0x5fb6('0x25')](handleError(_0x2c8b19,null));};exports['getDescriptions']=function(_0x232c54,_0x1e79eb,_0x34a69a){var _0x3e3482={};var _0x1eeb19={};var _0x348474;var _0x1394db;return db[_0x5fb6('0x38')][_0x5fb6('0x57')]({'where':{'id':_0x232c54[_0x5fb6('0x52')]['id']}})[_0x5fb6('0x32')](handleEntityNotFound(_0x1e79eb,null))[_0x5fb6('0x32')](function(_0x56276c){if(_0x56276c){_0x348474=_0x56276c;_0x1eeb19[_0x5fb6('0x3d')]=_[_0x5fb6('0x3f')](db[_0x5fb6('0x58')][_0x5fb6('0x39')]);_0x1eeb19[_0x5fb6('0x40')]=_['keys'](_0x232c54[_0x5fb6('0x40')]);_0x1eeb19['filters']=_['intersection'](_0x1eeb19['model'],_0x1eeb19[_0x5fb6('0x40')]);_0x3e3482[_0x5fb6('0x42')]=_[_0x5fb6('0x53')](_0x1eeb19['model'],qs[_0x5fb6('0x43')](_0x232c54['query']['fields']));_0x3e3482[_0x5fb6('0x42')]=_0x3e3482[_0x5fb6('0x42')][_0x5fb6('0x44')]?_0x3e3482[_0x5fb6('0x42')]:_0x1eeb19[_0x5fb6('0x3d')];_0x3e3482[_0x5fb6('0x46')]=qs[_0x5fb6('0x47')](_0x232c54[_0x5fb6('0x40')][_0x5fb6('0x47')]);_0x3e3482[_0x5fb6('0x48')]=qs['filters'](_['pick'](_0x232c54[_0x5fb6('0x40')],_0x1eeb19[_0x5fb6('0x41')]));if(_0x232c54[_0x5fb6('0x40')][_0x5fb6('0x4a')]){_0x3e3482[_0x5fb6('0x48')]=_[_0x5fb6('0x4b')](_0x3e3482[_0x5fb6('0x48')],{'$or':_[_0x5fb6('0x37')](_0x3e3482[_0x5fb6('0x42')],function(_0x2eda7e){var _0x2789d0={};_0x2789d0[_0x2eda7e]={'$like':'%'+_0x232c54[_0x5fb6('0x40')][_0x5fb6('0x4a')]+'%'};return _0x2789d0;})});}_0x3e3482=_[_0x5fb6('0x4b')]({},_0x3e3482,_0x232c54[_0x5fb6('0x4d')]);return _0x348474['getDescriptions'](_0x3e3482);}})['then'](function(_0x4c2682){if(_0x4c2682){_0x1394db=_0x4c2682[_0x5fb6('0x44')];if(!_0x232c54[_0x5fb6('0x40')][_0x5fb6('0x5a')](_0x5fb6('0x45'))){_0x3e3482[_0x5fb6('0x2c')]=qs['limit'](_0x232c54[_0x5fb6('0x40')][_0x5fb6('0x2c')]);_0x3e3482['offset']=qs[_0x5fb6('0x2b')](_0x232c54[_0x5fb6('0x40')][_0x5fb6('0x2b')]);}return _0x348474[_0x5fb6('0x5b')](_0x3e3482);}})[_0x5fb6('0x32')](function(_0x3997b1){if(_0x3997b1){return _0x3997b1?{'count':_0x1394db,'rows':_0x3997b1}:null;}})[_0x5fb6('0x32')](respondWithResult(_0x1e79eb,null))[_0x5fb6('0x25')](handleError(_0x1e79eb,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e01ea05..fb826ad 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 _0xe90f=['exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xe90f,0xb8));var _0xfe90=function(_0x2b07a1,_0x25c79a){_0x2b07a1=_0x2b07a1-0x0;var _0x4bb96b=_0xe90f[_0x2b07a1];return _0x4bb96b;};'use strict';var _=require(_0xfe90('0x0'));var util=require(_0xfe90('0x1'));var logger=require(_0xfe90('0x2'))(_0xfe90('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfe90('0x4'));var fs=require('fs');var path=require(_0xfe90('0x5'));var rimraf=require('rimraf');var config=require(_0xfe90('0x6'));var attributes=require(_0xfe90('0x7'));module[_0xfe90('0x8')]=function(_0x18084,_0x9e2b35){return _0x18084[_0xfe90('0x9')](_0xfe90('0xa'),attributes,{'tableName':_0xfe90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c4b=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','moment','bluebird'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x6c4b,0x1f4));var _0xb6c4=function(_0x597106,_0x44de51){_0x597106=_0x597106-0x0;var _0x3ca6b5=_0x6c4b[_0x597106];return _0x3ca6b5;};'use strict';var _=require('lodash');var util=require(_0xb6c4('0x0'));var logger=require(_0xb6c4('0x1'))('api');var moment=require(_0xb6c4('0x2'));var BPromise=require(_0xb6c4('0x3'));var rp=require(_0xb6c4('0x4'));var fs=require('fs');var path=require(_0xb6c4('0x5'));var rimraf=require(_0xb6c4('0x6'));var config=require(_0xb6c4('0x7'));var attributes=require(_0xb6c4('0x8'));module[_0xb6c4('0x9')]=function(_0x4d3a05,_0x309d4a){return _0x4d3a05[_0xb6c4('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0xb6c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 4259f11..ef20612 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 _0xafef=['stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x2ea4c0,_0x5c622d){var _0xe12396=function(_0x2bdbb6){while(--_0x2bdbb6){_0x2ea4c0['push'](_0x2ea4c0['shift']());}};_0xe12396(++_0x5c622d);}(_0xafef,0xa9));var _0xfafe=function(_0x53ae2a,_0x1a3f38){_0x53ae2a=_0x53ae2a-0x0;var _0x379fe7=_0xafef[_0x53ae2a];return _0x379fe7;};'use strict';var _=require(_0xfafe('0x0'));var util=require(_0xfafe('0x1'));var moment=require(_0xfafe('0x2'));var BPromise=require(_0xfafe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfafe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfafe('0x5'));var logger=require(_0xfafe('0x6'))('rpc');var config=require(_0xfafe('0x7'));var jayson=require(_0xfafe('0x8'));var client=jayson[_0xfafe('0x9')][_0xfafe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ef1bf,_0x2cb64e,_0x573ddf){return new BPromise(function(_0x19bb63,_0x11cb90){return client[_0xfafe('0xb')](_0x3ef1bf,_0x573ddf)['then'](function(_0x1e4d88){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2cb64e,_0xfafe('0xc'));logger[_0xfafe('0xd')](_0xfafe('0xe'),_0x2cb64e,_0xfafe('0xc'),JSON[_0xfafe('0xf')](_0x1e4d88));if(_0x1e4d88[_0xfafe('0x10')]){if(_0x1e4d88[_0xfafe('0x10')][_0xfafe('0x11')]===0x1f4){logger['error'](_0xfafe('0x12'),_0x2cb64e,_0x1e4d88[_0xfafe('0x10')][_0xfafe('0x13')]);return _0x11cb90(_0x1e4d88[_0xfafe('0x10')]['message']);}logger[_0xfafe('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2cb64e,_0x1e4d88[_0xfafe('0x10')]['message']);return _0x19bb63(_0x1e4d88[_0xfafe('0x10')][_0xfafe('0x13')]);}else{logger[_0xfafe('0x14')](_0xfafe('0x12'),_0x2cb64e,'request\x20sent');_0x19bb63(_0x1e4d88[_0xfafe('0x15')]['message']);}})[_0xfafe('0x16')](function(_0x28a687){logger[_0xfafe('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2cb64e,_0x28a687);_0x11cb90(_0x28a687);});});} \ No newline at end of file +var _0x1d14=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x101a8f,_0x16df1a){var _0x2a5c6b=function(_0x393e61){while(--_0x393e61){_0x101a8f['push'](_0x101a8f['shift']());}};_0x2a5c6b(++_0x16df1a);}(_0x1d14,0xdc));var _0x41d1=function(_0x35b48b,_0x34e65d){_0x35b48b=_0x35b48b-0x0;var _0x11746d=_0x1d14[_0x35b48b];return _0x11746d;};'use strict';var _=require(_0x41d1('0x0'));var util=require(_0x41d1('0x1'));var moment=require(_0x41d1('0x2'));var BPromise=require(_0x41d1('0x3'));var rs=require(_0x41d1('0x4'));var fs=require('fs');var Redis=require(_0x41d1('0x5'));var db=require(_0x41d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x41d1('0x7'))(_0x41d1('0x8'));var config=require(_0x41d1('0x9'));var jayson=require(_0x41d1('0xa'));var client=jayson[_0x41d1('0xb')][_0x41d1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3975c7,_0xc824af,_0x26ba38){return new BPromise(function(_0x181860,_0x13fad9){return client[_0x41d1('0xd')](_0x3975c7,_0x26ba38)['then'](function(_0x5135cf){logger[_0x41d1('0xe')](_0x41d1('0xf'),_0xc824af,'request\x20sent');logger['debug'](_0x41d1('0x10'),_0xc824af,_0x41d1('0x11'),JSON['stringify'](_0x5135cf));if(_0x5135cf[_0x41d1('0x12')]){if(_0x5135cf[_0x41d1('0x12')][_0x41d1('0x13')]===0x1f4){logger[_0x41d1('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0xc824af,_0x5135cf[_0x41d1('0x12')][_0x41d1('0x14')]);return _0x13fad9(_0x5135cf['error'][_0x41d1('0x14')]);}logger[_0x41d1('0x12')](_0x41d1('0xf'),_0xc824af,_0x5135cf[_0x41d1('0x12')][_0x41d1('0x14')]);return _0x181860(_0x5135cf[_0x41d1('0x12')]['message']);}else{logger[_0x41d1('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0xc824af,_0x41d1('0x11'));_0x181860(_0x5135cf['result'][_0x41d1('0x14')]);}})[_0x41d1('0x15')](function(_0x3b3859){logger[_0x41d1('0x12')](_0x41d1('0xf'),_0xc824af,_0x3b3859);_0x13fad9(_0x3b3859);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 76c71f0..41bb3af 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 _0xcf62=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x2a319c,_0x1c6b4c){var _0x272239=function(_0xb9a37a){while(--_0xb9a37a){_0x2a319c['push'](_0x2a319c['shift']());}};_0x272239(++_0x1c6b4c);}(_0xcf62,0x71));var _0x2cf6=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xcf62[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x2cf6('0x0'));var util=require(_0x2cf6('0x1'));var path=require('path');var timeout=require(_0x2cf6('0x2'));var express=require(_0x2cf6('0x3'));var router=express[_0x2cf6('0x4')]();var fs_extra=require(_0x2cf6('0x5'));var auth=require(_0x2cf6('0x6'));var interaction=require(_0x2cf6('0x7'));var config=require(_0x2cf6('0x8'));var controller=require(_0x2cf6('0x9'));router['get']('/',auth[_0x2cf6('0xa')](),controller['index']);router[_0x2cf6('0xb')](_0x2cf6('0xc'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0xd')]);router['post']('/',auth[_0x2cf6('0xa')](),controller[_0x2cf6('0xe')]);router[_0x2cf6('0xf')](_0x2cf6('0xc'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x10')]);router[_0x2cf6('0x11')](_0x2cf6('0xc'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x804e=['isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get'];(function(_0x45d21c,_0x27df44){var _0x2df98b=function(_0x1c57ec){while(--_0x1c57ec){_0x45d21c['push'](_0x45d21c['shift']());}};_0x2df98b(++_0x27df44);}(_0x804e,0x6e));var _0xe804=function(_0x258e5f,_0xb9bbf3){_0x258e5f=_0x258e5f-0x0;var _0x21a56d=_0x804e[_0x258e5f];return _0x21a56d;};'use strict';var multer=require(_0xe804('0x0'));var util=require(_0xe804('0x1'));var path=require('path');var timeout=require(_0xe804('0x2'));var express=require(_0xe804('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe804('0x4'));var interaction=require(_0xe804('0x5'));var config=require(_0xe804('0x6'));var controller=require(_0xe804('0x7'));router[_0xe804('0x8')]('/',auth[_0xe804('0x9')](),controller[_0xe804('0xa')]);router[_0xe804('0x8')](_0xe804('0xb'),auth[_0xe804('0x9')](),controller[_0xe804('0xc')]);router[_0xe804('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe804('0xe')](_0xe804('0xb'),auth[_0xe804('0x9')](),controller[_0xe804('0xf')]);router[_0xe804('0x10')](_0xe804('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 1e13ce4..b83a08a 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 _0x277c=['keyValue','picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x5c107d,_0x155dbe){var _0x3eaf06=function(_0x348dd6){while(--_0x348dd6){_0x5c107d['push'](_0x5c107d['shift']());}};_0x3eaf06(++_0x155dbe);}(_0x277c,0x153));var _0xc277=function(_0x25a64d,_0x335d73){_0x25a64d=_0x25a64d-0x0;var _0x17d964=_0x277c[_0x25a64d];return _0x17d964;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'type':{'type':Sequelize[_0xc277('0x1')](_0xc277('0x2'),_0xc277('0x3'),_0xc277('0x4'),_0xc277('0x5'),_0xc277('0x6')),'defaultValue':_0xc277('0x2')},'content':{'type':Sequelize[_0xc277('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc277('0x2'),'variable',_0xc277('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc277('0x7')]},'nameField':{'type':Sequelize[_0xc277('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc277('0x7')]}}; \ No newline at end of file +var _0x5fc3=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fc3,0xa8));var _0x35fc=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5fc3[_0x6cf19c];return _0xce14f3;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'type':{'type':Sequelize['ENUM'](_0x35fc('0x2'),_0x35fc('0x3'),_0x35fc('0x4'),_0x35fc('0x5'),_0x35fc('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x35fc('0x7')]},'key':{'type':Sequelize[_0x35fc('0x7')]},'keyType':{'type':Sequelize[_0x35fc('0x8')]('string','variable',_0x35fc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x35fc('0x7')]},'nameField':{'type':Sequelize[_0x35fc('0x7')]},'customField':{'type':Sequelize[_0x35fc('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35fc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0a25472..75f54b9 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 _0xf274=['body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Field','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create'];(function(_0xef0a8c,_0x39e693){var _0x1cded6=function(_0x1c9fbd){while(--_0x1c9fbd){_0xef0a8c['push'](_0xef0a8c['shift']());}};_0x1cded6(++_0x39e693);}(_0xf274,0x9b));var _0x4f27=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf274[_0x2be8c2];return _0x97f531;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f27('0x0'));var jsonpatch=require(_0x4f27('0x1'));var rp=require('request-promise');var moment=require(_0x4f27('0x2'));var BPromise=require(_0x4f27('0x3'));var Mustache=require(_0x4f27('0x4'));var util=require(_0x4f27('0x5'));var path=require(_0x4f27('0x6'));var sox=require(_0x4f27('0x7'));var csv=require(_0x4f27('0x8'));var ejs=require(_0x4f27('0x9'));var fs=require('fs');var fs_extra=require(_0x4f27('0xa'));var _=require('lodash');var squel=require(_0x4f27('0xb'));var crypto=require(_0x4f27('0xc'));var jsforce=require(_0x4f27('0xd'));var deskjs=require(_0x4f27('0xe'));var toCsv=require(_0x4f27('0x8'));var querystring=require('querystring');var Papa=require(_0x4f27('0xf'));var Redis=require(_0x4f27('0x10'));var authService=require(_0x4f27('0x11'));var qs=require(_0x4f27('0x12'));var as=require(_0x4f27('0x13'));var hardwareService=require(_0x4f27('0x14'));var logger=require(_0x4f27('0x15'))('api');var utils=require(_0x4f27('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4f27('0x17'));var db=require(_0x4f27('0x18'))['db'];function respondWithStatusCode(_0x57984d,_0x21033d){_0x21033d=_0x21033d||0xcc;return function(_0x3e044f){if(_0x3e044f){return _0x57984d[_0x4f27('0x19')](_0x21033d);}return _0x57984d[_0x4f27('0x1a')](_0x21033d)[_0x4f27('0x1b')]();};}function respondWithResult(_0x3b9e95,_0x3b8747){_0x3b8747=_0x3b8747||0xc8;return function(_0x2e07d1){if(_0x2e07d1){return _0x3b9e95[_0x4f27('0x1a')](_0x3b8747)[_0x4f27('0x1c')](_0x2e07d1);}};}function respondWithFilteredResult(_0x278fd3,_0x30d2e0){return function(_0x1ff8a5){if(_0x1ff8a5){var _0x2c6575=_0x1ff8a5[_0x4f27('0x1d')],_0x4cf291=_0x30d2e0[_0x4f27('0x1e')],_0x4a4058=_0x30d2e0[_0x4f27('0x1e')]+_0x30d2e0[_0x4f27('0x1f')],_0x5c11ce;if(_0x4a4058>=_0x2c6575){_0x4a4058=_0x2c6575;_0x5c11ce=0xc8;}else{_0x5c11ce=0xce;}_0x278fd3[_0x4f27('0x1a')](_0x5c11ce);return _0x278fd3[_0x4f27('0x20')](_0x4f27('0x21'),_0x4cf291+'-'+_0x4a4058+'/'+_0x2c6575)['json'](_0x1ff8a5);}return null;};}function patchUpdates(_0x1ca146){return function(_0x1bccb9){try{jsonpatch['apply'](_0x1bccb9,_0x1ca146,!![]);}catch(_0x32a0f1){return BPromise[_0x4f27('0x22')](_0x32a0f1);}return _0x1bccb9[_0x4f27('0x23')]();};}function saveUpdates(_0x41b840,_0x7a67e0){return function(_0x2d892d){if(_0x2d892d){return _0x2d892d[_0x4f27('0x24')](_0x41b840)[_0x4f27('0x25')](function(_0x1ab096){return _0x1ab096;});}return null;};}function removeEntity(_0x2bae84,_0x3060bf){return function(_0x3b6be1){if(_0x3b6be1){return _0x3b6be1[_0x4f27('0x26')]()[_0x4f27('0x25')](function(){_0x2bae84[_0x4f27('0x1a')](0xcc)[_0x4f27('0x1b')]();});}};}function handleEntityNotFound(_0x1ebf89,_0x3a908c){return function(_0x32ddd2){if(!_0x32ddd2){_0x1ebf89[_0x4f27('0x19')](0x194);}return _0x32ddd2;};}function handleError(_0x4b413f,_0x39c63d){_0x39c63d=_0x39c63d||0x1f4;return function(_0x9f2f5){logger[_0x4f27('0x27')](_0x9f2f5[_0x4f27('0x28')]);if(_0x9f2f5[_0x4f27('0x29')]){delete _0x9f2f5[_0x4f27('0x29')];}_0x4b413f[_0x4f27('0x1a')](_0x39c63d)[_0x4f27('0x2a')](_0x9f2f5);};}exports['index']=function(_0x48c332,_0x3fdf94){var _0x553827={},_0x450957={},_0x4b7495={'count':0x0,'rows':[]};var _0x567fb6=_[_0x4f27('0x2b')](db[_0x4f27('0x2c')]['rawAttributes'],function(_0x5883d1){return{'name':_0x5883d1[_0x4f27('0x2d')],'type':_0x5883d1[_0x4f27('0x2e')][_0x4f27('0x2f')]};});_0x450957['model']=_['map'](_0x567fb6,_0x4f27('0x29'));_0x450957[_0x4f27('0x30')]=_[_0x4f27('0x31')](_0x48c332[_0x4f27('0x30')]);_0x450957[_0x4f27('0x32')]=_[_0x4f27('0x33')](_0x450957[_0x4f27('0x34')],_0x450957[_0x4f27('0x30')]);_0x553827['attributes']=_['intersection'](_0x450957[_0x4f27('0x34')],qs[_0x4f27('0x35')](_0x48c332[_0x4f27('0x30')][_0x4f27('0x35')]));_0x553827[_0x4f27('0x36')]=_0x553827[_0x4f27('0x36')][_0x4f27('0x37')]?_0x553827[_0x4f27('0x36')]:_0x450957[_0x4f27('0x34')];if(!_0x48c332[_0x4f27('0x30')][_0x4f27('0x38')](_0x4f27('0x39'))){_0x553827[_0x4f27('0x1f')]=qs[_0x4f27('0x1f')](_0x48c332[_0x4f27('0x30')][_0x4f27('0x1f')]);_0x553827[_0x4f27('0x1e')]=qs[_0x4f27('0x1e')](_0x48c332[_0x4f27('0x30')]['offset']);}_0x553827[_0x4f27('0x3a')]=qs[_0x4f27('0x3b')](_0x48c332['query'][_0x4f27('0x3b')]);_0x553827[_0x4f27('0x3c')]=qs[_0x4f27('0x32')](_[_0x4f27('0x3d')](_0x48c332[_0x4f27('0x30')],_0x450957[_0x4f27('0x32')]),_0x567fb6);if(_0x48c332[_0x4f27('0x30')]['filter']){_0x553827[_0x4f27('0x3c')]=_[_0x4f27('0x3e')](_0x553827[_0x4f27('0x3c')],{'$or':_['map'](_0x567fb6,function(_0x5b1fdf){if(_0x5b1fdf[_0x4f27('0x2e')]!==_0x4f27('0x3f')){var _0x40b40c={};_0x40b40c[_0x5b1fdf[_0x4f27('0x29')]]={'$like':'%'+_0x48c332['query'][_0x4f27('0x40')]+'%'};return _0x40b40c;}})});}_0x553827=_[_0x4f27('0x3e')]({},_0x553827,_0x48c332['options']);var _0x383e26={'where':_0x553827[_0x4f27('0x3c')]};return db[_0x4f27('0x2c')][_0x4f27('0x1d')](_0x383e26)[_0x4f27('0x25')](function(_0x219b1d){_0x4b7495[_0x4f27('0x1d')]=_0x219b1d;if(_0x48c332[_0x4f27('0x30')][_0x4f27('0x41')]){_0x553827[_0x4f27('0x42')]=[{'all':!![]}];}return db[_0x4f27('0x2c')][_0x4f27('0x43')](_0x553827);})[_0x4f27('0x25')](function(_0x28f860){_0x4b7495[_0x4f27('0x44')]=_0x28f860;return _0x4b7495;})[_0x4f27('0x25')](respondWithFilteredResult(_0x3fdf94,_0x553827))[_0x4f27('0x45')](handleError(_0x3fdf94,null));};exports[_0x4f27('0x46')]=function(_0x595cc7,_0x4e94d2){var _0x5a75b9={'raw':!![],'where':{'id':_0x595cc7[_0x4f27('0x47')]['id']}},_0x4a00d0={};_0x4a00d0[_0x4f27('0x34')]=_[_0x4f27('0x31')](db['Dynamics365Field'][_0x4f27('0x48')]);_0x4a00d0[_0x4f27('0x30')]=_[_0x4f27('0x31')](_0x595cc7[_0x4f27('0x30')]);_0x4a00d0[_0x4f27('0x32')]=_[_0x4f27('0x33')](_0x4a00d0[_0x4f27('0x34')],_0x4a00d0[_0x4f27('0x30')]);_0x5a75b9[_0x4f27('0x36')]=_[_0x4f27('0x33')](_0x4a00d0[_0x4f27('0x34')],qs['fields'](_0x595cc7[_0x4f27('0x30')]['fields']));_0x5a75b9['attributes']=_0x5a75b9[_0x4f27('0x36')]['length']?_0x5a75b9[_0x4f27('0x36')]:_0x4a00d0[_0x4f27('0x34')];if(_0x595cc7[_0x4f27('0x30')][_0x4f27('0x41')]){_0x5a75b9['include']=[{'all':!![]}];}_0x5a75b9=_[_0x4f27('0x3e')]({},_0x5a75b9,_0x595cc7[_0x4f27('0x49')]);return db[_0x4f27('0x2c')][_0x4f27('0x4a')](_0x5a75b9)['then'](handleEntityNotFound(_0x4e94d2,null))[_0x4f27('0x25')](respondWithResult(_0x4e94d2,null))[_0x4f27('0x45')](handleError(_0x4e94d2,null));};exports[_0x4f27('0x4b')]=function(_0x370895,_0x297152){return db['Dynamics365Field'][_0x4f27('0x4b')](_0x370895[_0x4f27('0x4c')],{})['then'](respondWithResult(_0x297152,0xc9))[_0x4f27('0x45')](handleError(_0x297152,null));};exports[_0x4f27('0x24')]=function(_0x505c00,_0x5e4dfd){if(_0x505c00[_0x4f27('0x4c')]['id']){delete _0x505c00[_0x4f27('0x4c')]['id'];}return db[_0x4f27('0x2c')][_0x4f27('0x4a')]({'where':{'id':_0x505c00[_0x4f27('0x47')]['id']}})[_0x4f27('0x25')](handleEntityNotFound(_0x5e4dfd,null))['then'](saveUpdates(_0x505c00[_0x4f27('0x4c')],null))[_0x4f27('0x25')](respondWithResult(_0x5e4dfd,null))[_0x4f27('0x45')](handleError(_0x5e4dfd,null));};exports[_0x4f27('0x26')]=function(_0xb253dc,_0x428052){return db[_0x4f27('0x2c')][_0x4f27('0x4a')]({'where':{'id':_0xb253dc[_0x4f27('0x47')]['id']}})[_0x4f27('0x25')](handleEntityNotFound(_0x428052,null))[_0x4f27('0x25')](removeEntity(_0x428052,null))[_0x4f27('0x45')](handleError(_0x428052,null));}; \ No newline at end of file +var _0xfbc7=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','reject','error','stack','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','hasOwnProperty','limit','sort','pick','filter','merge','where','VIRTUAL','include','findAll','then','rows','catch','show','params','keys','length','includeAll','options','create','update','body','destroy','find','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xfbc7,0x152));var _0x7fbc=function(_0x1b6516,_0x2d4ec9){_0x1b6516=_0x1b6516-0x0;var _0x473fab=_0xfbc7[_0x1b6516];return _0x473fab;};'use strict';var pdf=require(_0x7fbc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7fbc('0x1'));var jsonpatch=require(_0x7fbc('0x2'));var rp=require(_0x7fbc('0x3'));var moment=require(_0x7fbc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7fbc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7fbc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fbc('0x7'));var squel=require('squel');var crypto=require(_0x7fbc('0x8'));var jsforce=require(_0x7fbc('0x9'));var deskjs=require(_0x7fbc('0xa'));var toCsv=require(_0x7fbc('0xb'));var querystring=require(_0x7fbc('0xc'));var Papa=require(_0x7fbc('0xd'));var Redis=require(_0x7fbc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7fbc('0xf'));var as=require(_0x7fbc('0x10'));var hardwareService=require(_0x7fbc('0x11'));var logger=require(_0x7fbc('0x12'))('api');var utils=require(_0x7fbc('0x13'));var config=require(_0x7fbc('0x14'));var licenseUtil=require(_0x7fbc('0x15'));var db=require(_0x7fbc('0x16'))['db'];function respondWithStatusCode(_0x362037,_0xc772dd){_0xc772dd=_0xc772dd||0xcc;return function(_0x4dac6c){if(_0x4dac6c){return _0x362037[_0x7fbc('0x17')](_0xc772dd);}return _0x362037['status'](_0xc772dd)[_0x7fbc('0x18')]();};}function respondWithResult(_0x49077d,_0x23cc5c){_0x23cc5c=_0x23cc5c||0xc8;return function(_0x2196fa){if(_0x2196fa){return _0x49077d[_0x7fbc('0x19')](_0x23cc5c)[_0x7fbc('0x1a')](_0x2196fa);}};}function respondWithFilteredResult(_0x2c6af7,_0x57753c){return function(_0x285df8){if(_0x285df8){var _0x36f650=_0x285df8[_0x7fbc('0x1b')],_0x716df1=_0x57753c[_0x7fbc('0x1c')],_0x412112=_0x57753c['offset']+_0x57753c['limit'],_0x34c85a;if(_0x412112>=_0x36f650){_0x412112=_0x36f650;_0x34c85a=0xc8;}else{_0x34c85a=0xce;}_0x2c6af7[_0x7fbc('0x19')](_0x34c85a);return _0x2c6af7[_0x7fbc('0x1d')]('Content-Range',_0x716df1+'-'+_0x412112+'/'+_0x36f650)[_0x7fbc('0x1a')](_0x285df8);}return null;};}function patchUpdates(_0x2d7c62){return function(_0x12a731){try{jsonpatch['apply'](_0x12a731,_0x2d7c62,!![]);}catch(_0x4c8bea){return BPromise[_0x7fbc('0x1e')](_0x4c8bea);}return _0x12a731['save']();};}function saveUpdates(_0x2fc64c,_0x155c7d){return function(_0x28954a){if(_0x28954a){return _0x28954a['update'](_0x2fc64c)['then'](function(_0x17e30e){return _0x17e30e;});}return null;};}function removeEntity(_0x55ce98,_0x1ecb08){return function(_0x439e4f){if(_0x439e4f){return _0x439e4f['destroy']()['then'](function(){_0x55ce98['status'](0xcc)[_0x7fbc('0x18')]();});}};}function handleEntityNotFound(_0x2115fe,_0xf176cc){return function(_0x5f64af){if(!_0x5f64af){_0x2115fe[_0x7fbc('0x17')](0x194);}return _0x5f64af;};}function handleError(_0x130c65,_0x4c63c4){_0x4c63c4=_0x4c63c4||0x1f4;return function(_0x3f10cc){logger[_0x7fbc('0x1f')](_0x3f10cc[_0x7fbc('0x20')]);if(_0x3f10cc['name']){delete _0x3f10cc['name'];}_0x130c65[_0x7fbc('0x19')](_0x4c63c4)[_0x7fbc('0x21')](_0x3f10cc);};}exports['index']=function(_0x24eaf1,_0x36a84a){var _0x6b4ceb={},_0x350680={},_0x3fbe1c={'count':0x0,'rows':[]};var _0x121401=_[_0x7fbc('0x22')](db[_0x7fbc('0x23')][_0x7fbc('0x24')],function(_0x132367){return{'name':_0x132367[_0x7fbc('0x25')],'type':_0x132367[_0x7fbc('0x26')][_0x7fbc('0x27')]};});_0x350680['model']=_['map'](_0x121401,_0x7fbc('0x28'));_0x350680[_0x7fbc('0x29')]=_['keys'](_0x24eaf1[_0x7fbc('0x29')]);_0x350680[_0x7fbc('0x2a')]=_[_0x7fbc('0x2b')](_0x350680[_0x7fbc('0x2c')],_0x350680[_0x7fbc('0x29')]);_0x6b4ceb[_0x7fbc('0x2d')]=_['intersection'](_0x350680[_0x7fbc('0x2c')],qs[_0x7fbc('0x2e')](_0x24eaf1['query'][_0x7fbc('0x2e')]));_0x6b4ceb['attributes']=_0x6b4ceb[_0x7fbc('0x2d')]['length']?_0x6b4ceb[_0x7fbc('0x2d')]:_0x350680[_0x7fbc('0x2c')];if(!_0x24eaf1['query'][_0x7fbc('0x2f')]('nolimit')){_0x6b4ceb[_0x7fbc('0x30')]=qs[_0x7fbc('0x30')](_0x24eaf1['query'][_0x7fbc('0x30')]);_0x6b4ceb[_0x7fbc('0x1c')]=qs['offset'](_0x24eaf1[_0x7fbc('0x29')][_0x7fbc('0x1c')]);}_0x6b4ceb['order']=qs[_0x7fbc('0x31')](_0x24eaf1[_0x7fbc('0x29')][_0x7fbc('0x31')]);_0x6b4ceb['where']=qs[_0x7fbc('0x2a')](_[_0x7fbc('0x32')](_0x24eaf1[_0x7fbc('0x29')],_0x350680[_0x7fbc('0x2a')]),_0x121401);if(_0x24eaf1[_0x7fbc('0x29')][_0x7fbc('0x33')]){_0x6b4ceb['where']=_[_0x7fbc('0x34')](_0x6b4ceb[_0x7fbc('0x35')],{'$or':_[_0x7fbc('0x22')](_0x121401,function(_0x1a3b2b){if(_0x1a3b2b[_0x7fbc('0x26')]!==_0x7fbc('0x36')){var _0x131d67={};_0x131d67[_0x1a3b2b[_0x7fbc('0x28')]]={'$like':'%'+_0x24eaf1[_0x7fbc('0x29')][_0x7fbc('0x33')]+'%'};return _0x131d67;}})});}_0x6b4ceb=_['merge']({},_0x6b4ceb,_0x24eaf1['options']);var _0x349182={'where':_0x6b4ceb[_0x7fbc('0x35')]};return db[_0x7fbc('0x23')][_0x7fbc('0x1b')](_0x349182)['then'](function(_0xee4e1){_0x3fbe1c[_0x7fbc('0x1b')]=_0xee4e1;if(_0x24eaf1[_0x7fbc('0x29')]['includeAll']){_0x6b4ceb[_0x7fbc('0x37')]=[{'all':!![]}];}return db[_0x7fbc('0x23')][_0x7fbc('0x38')](_0x6b4ceb);})[_0x7fbc('0x39')](function(_0x588a15){_0x3fbe1c[_0x7fbc('0x3a')]=_0x588a15;return _0x3fbe1c;})[_0x7fbc('0x39')](respondWithFilteredResult(_0x36a84a,_0x6b4ceb))[_0x7fbc('0x3b')](handleError(_0x36a84a,null));};exports[_0x7fbc('0x3c')]=function(_0x14d4e9,_0x4fe3a7){var _0x570744={'raw':!![],'where':{'id':_0x14d4e9[_0x7fbc('0x3d')]['id']}},_0x4a982c={};_0x4a982c[_0x7fbc('0x2c')]=_[_0x7fbc('0x3e')](db[_0x7fbc('0x23')][_0x7fbc('0x24')]);_0x4a982c[_0x7fbc('0x29')]=_['keys'](_0x14d4e9[_0x7fbc('0x29')]);_0x4a982c[_0x7fbc('0x2a')]=_['intersection'](_0x4a982c[_0x7fbc('0x2c')],_0x4a982c[_0x7fbc('0x29')]);_0x570744['attributes']=_['intersection'](_0x4a982c['model'],qs['fields'](_0x14d4e9[_0x7fbc('0x29')][_0x7fbc('0x2e')]));_0x570744[_0x7fbc('0x2d')]=_0x570744[_0x7fbc('0x2d')][_0x7fbc('0x3f')]?_0x570744[_0x7fbc('0x2d')]:_0x4a982c[_0x7fbc('0x2c')];if(_0x14d4e9[_0x7fbc('0x29')][_0x7fbc('0x40')]){_0x570744[_0x7fbc('0x37')]=[{'all':!![]}];}_0x570744=_[_0x7fbc('0x34')]({},_0x570744,_0x14d4e9[_0x7fbc('0x41')]);return db['Dynamics365Field']['find'](_0x570744)['then'](handleEntityNotFound(_0x4fe3a7,null))[_0x7fbc('0x39')](respondWithResult(_0x4fe3a7,null))[_0x7fbc('0x3b')](handleError(_0x4fe3a7,null));};exports[_0x7fbc('0x42')]=function(_0x93ab20,_0x565804){return db['Dynamics365Field'][_0x7fbc('0x42')](_0x93ab20['body'],{})[_0x7fbc('0x39')](respondWithResult(_0x565804,0xc9))['catch'](handleError(_0x565804,null));};exports[_0x7fbc('0x43')]=function(_0x500247,_0x51b6f7){if(_0x500247[_0x7fbc('0x44')]['id']){delete _0x500247[_0x7fbc('0x44')]['id'];}return db[_0x7fbc('0x23')]['find']({'where':{'id':_0x500247[_0x7fbc('0x3d')]['id']}})['then'](handleEntityNotFound(_0x51b6f7,null))[_0x7fbc('0x39')](saveUpdates(_0x500247[_0x7fbc('0x44')],null))['then'](respondWithResult(_0x51b6f7,null))['catch'](handleError(_0x51b6f7,null));};exports[_0x7fbc('0x45')]=function(_0x439826,_0x57c51a){return db[_0x7fbc('0x23')][_0x7fbc('0x46')]({'where':{'id':_0x439826[_0x7fbc('0x3d')]['id']}})[_0x7fbc('0x39')](handleEntityNotFound(_0x57c51a,null))['then'](removeEntity(_0x57c51a,null))[_0x7fbc('0x3b')](handleError(_0x57c51a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index fce6067..904e40f 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 _0x1b0d=['idField','util','../../config/logger','path','rimraf','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields'];(function(_0x5c84dd,_0x1b2c66){var _0x159c62=function(_0xc7b804){while(--_0xc7b804){_0x5c84dd['push'](_0x5c84dd['shift']());}};_0x159c62(++_0x1b2c66);}(_0x1b0d,0x1cc));var _0xd1b0=function(_0x16a7fd,_0x2aa1da){_0x16a7fd=_0x16a7fd-0x0;var _0x336c41=_0x1b0d[_0x16a7fd];return _0x336c41;};'use strict';var _=require('lodash');var util=require(_0xd1b0('0x0'));var logger=require(_0xd1b0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1b0('0x2'));var rimraf=require(_0xd1b0('0x3'));var config=require(_0xd1b0('0x4'));var attributes=require(_0xd1b0('0x5'));module['exports']=function(_0x7039a,_0x128f15){return _0x7039a['define'](_0xd1b0('0x6'),attributes,{'tableName':_0xd1b0('0x7'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xd1b0('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b69=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x120506,_0x56cacd){var _0xdaa57c=function(_0x2a1032){while(--_0x2a1032){_0x120506['push'](_0x120506['shift']());}};_0xdaa57c(++_0x56cacd);}(_0x8b69,0x81));var _0x98b6=function(_0x1dd904,_0x2f5fc){_0x1dd904=_0x1dd904-0x0;var _0x6fb97=_0x8b69[_0x1dd904];return _0x6fb97;};'use strict';var _=require(_0x98b6('0x0'));var util=require(_0x98b6('0x1'));var logger=require(_0x98b6('0x2'))(_0x98b6('0x3'));var moment=require(_0x98b6('0x4'));var BPromise=require(_0x98b6('0x5'));var rp=require(_0x98b6('0x6'));var fs=require('fs');var path=require(_0x98b6('0x7'));var rimraf=require(_0x98b6('0x8'));var config=require(_0x98b6('0x9'));var attributes=require(_0x98b6('0xa'));module[_0x98b6('0xb')]=function(_0x222aea,_0x22aed1){return _0x222aea[_0x98b6('0xc')]('Dynamics365Field',attributes,{'tableName':_0x98b6('0xd'),'paranoid':![],'indexes':[{'name':_0x98b6('0xe'),'fields':[_0x98b6('0xf'),_0x98b6('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 995f36e..18fe758 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 _0xfd2e=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0xfd2e,0x6e));var _0xefd2=function(_0x58dfbe,_0x45d8d6){_0x58dfbe=_0x58dfbe-0x0;var _0x595b10=_0xfd2e[_0x58dfbe];return _0x595b10;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var moment=require(_0xefd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefd2('0x3'))['db'];var utils=require(_0xefd2('0x4'));var logger=require(_0xefd2('0x5'))(_0xefd2('0x6'));var config=require(_0xefd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516aab,_0x51fab0,_0x43d90b){return new BPromise(function(_0x50dd63,_0x440d11){return client[_0xefd2('0x9')](_0x516aab,_0x43d90b)[_0xefd2('0xa')](function(_0xded765){logger[_0xefd2('0xb')](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));logger['debug'](_0xefd2('0xe'),_0x51fab0,_0xefd2('0xd'),JSON[_0xefd2('0xf')](_0xded765));if(_0xded765[_0xefd2('0x10')]){if(_0xded765[_0xefd2('0x10')][_0xefd2('0x11')]===0x1f4){logger[_0xefd2('0x10')](_0xefd2('0xc'),_0x51fab0,_0xded765['error']['message']);return _0x440d11(_0xded765[_0xefd2('0x10')]['message']);}logger['error'](_0xefd2('0xc'),_0x51fab0,_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);return _0x50dd63(_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);}else{logger['info'](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));_0x50dd63(_0xded765[_0xefd2('0x13')][_0xefd2('0x12')]);}})[_0xefd2('0x14')](function(_0x471e3b){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x51fab0,_0x471e3b);_0x440d11(_0x471e3b);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x4975,0x86));var _0x5497=function(_0x2ebc2b,_0x5a3399){_0x2ebc2b=_0x2ebc2b-0x0;var _0x570f2f=_0x4975[_0x2ebc2b];return _0x570f2f;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a216d83..541e8c7 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 _0xc8b3=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','put','update','delete'];(function(_0x356a35,_0x16916e){var _0x486b37=function(_0x37e98f){while(--_0x37e98f){_0x356a35['push'](_0x356a35['shift']());}};_0x486b37(++_0x16916e);}(_0xc8b3,0xe9));var _0x3c8b=function(_0x1bc173,_0x1f46f5){_0x1bc173=_0x1bc173-0x0;var _0x2815a0=_0xc8b3[_0x1bc173];return _0x2815a0;};'use strict';var multer=require('multer');var util=require(_0x3c8b('0x0'));var path=require('path');var timeout=require(_0x3c8b('0x1'));var express=require(_0x3c8b('0x2'));var router=express[_0x3c8b('0x3')]();var fs_extra=require(_0x3c8b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c8b('0x5'));var config=require(_0x3c8b('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x3c8b('0x7')]('/',auth[_0x3c8b('0x8')](),controller[_0x3c8b('0x9')]);router[_0x3c8b('0x7')](_0x3c8b('0xa'),auth[_0x3c8b('0x8')](),controller[_0x3c8b('0xb')]);router[_0x3c8b('0x7')](_0x3c8b('0xc'),auth['isAuthenticated'](),controller[_0x3c8b('0xd')]);router[_0x3c8b('0x7')]('/:id/fields',auth[_0x3c8b('0x8')](),controller['getFields']);router[_0x3c8b('0xe')]('/',auth[_0x3c8b('0x8')](),controller[_0x3c8b('0xf')]);router[_0x3c8b('0xe')](_0x3c8b('0xc'),auth[_0x3c8b('0x8')](),controller['addConfiguration']);router[_0x3c8b('0x10')](_0x3c8b('0xa'),auth['isAuthenticated'](),controller[_0x3c8b('0x11')]);router[_0x3c8b('0x12')](_0x3c8b('0xa'),auth['isAuthenticated'](),controller[_0x3c8b('0x13')]);module[_0x3c8b('0x14')]=router; \ No newline at end of file +var _0x5549=['get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','express','Router','fs-extra'];(function(_0x129367,_0x476c61){var _0x234afc=function(_0x2426c8){while(--_0x2426c8){_0x129367['push'](_0x129367['shift']());}};_0x234afc(++_0x476c61);}(_0x5549,0x13c));var _0x9554=function(_0x58823c,_0x55aadb){_0x58823c=_0x58823c-0x0;var _0x252265=_0x5549[_0x58823c];return _0x252265;};'use strict';var multer=require('multer');var util=require(_0x9554('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9554('0x1'));var router=express[_0x9554('0x2')]();var fs_extra=require(_0x9554('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x9554('0x4')]('/',auth['isAuthenticated'](),controller[_0x9554('0x5')]);router[_0x9554('0x4')](_0x9554('0x6'),auth[_0x9554('0x7')](),controller[_0x9554('0x8')]);router[_0x9554('0x4')](_0x9554('0x9'),auth[_0x9554('0x7')](),controller[_0x9554('0xa')]);router['get'](_0x9554('0xb'),auth[_0x9554('0x7')](),controller[_0x9554('0xc')]);router[_0x9554('0xd')]('/',auth[_0x9554('0x7')](),controller[_0x9554('0xe')]);router[_0x9554('0xd')](_0x9554('0x9'),auth[_0x9554('0x7')](),controller[_0x9554('0xf')]);router[_0x9554('0x10')](_0x9554('0x6'),auth['isAuthenticated'](),controller[_0x9554('0x11')]);router['delete'](_0x9554('0x6'),auth[_0x9554('0x7')](),controller[_0x9554('0x12')]);module[_0x9554('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index c6f8051..ba13ab1 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 _0xc690=['STRING','username','sequelize','exports'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0xc690,0x146));var _0x0c69=function(_0x2fe5e4,_0x43a312){_0x2fe5e4=_0x2fe5e4-0x0;var _0x5ece82=_0xc690[_0x2fe5e4];return _0x5ece82;};'use strict';var Sequelize=require(_0x0c69('0x0'));module[_0x0c69('0x1')]={'name':{'type':Sequelize[_0x0c69('0x2')]},'description':{'type':Sequelize[_0x0c69('0x2')]},'username':{'type':Sequelize[_0x0c69('0x2')],'unique':_0x0c69('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0c69('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x474c=['username','STRING','remoteUri','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x474c,0xff));var _0xc474=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x474c[_0x280f4a];return _0x1bb157;};'use strict';var Sequelize=require('sequelize');module[_0xc474('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xc474('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc474('0x2')],'unique':_0xc474('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 2da7a7b..03b8085 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 _0x0482=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','status','end','json','count','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','index','map','FreshdeskAccount','type','key','query','filters','intersection','model','attributes','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','keys','fields','length','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','hasOwnProperty','addConfiguration','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','subject','agent','description','priority','group','company','remove','includes','default','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x16c9f3,_0x4fe03f){var _0x47709f=function(_0x54dabb){while(--_0x54dabb){_0x16c9f3['push'](_0x16c9f3['shift']());}};_0x47709f(++_0x4fe03f);}(_0x0482,0x14c));var _0x2048=function(_0x9cf14e,_0x57d04f){_0x9cf14e=_0x9cf14e-0x0;var _0x14877a=_0x0482[_0x9cf14e];return _0x14877a;};'use strict';var pdf=require(_0x2048('0x0'));var emlformat=require(_0x2048('0x1'));var rimraf=require(_0x2048('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2048('0x3'));var rp=require('request-promise');var moment=require(_0x2048('0x4'));var BPromise=require(_0x2048('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2048('0x6'));var sox=require(_0x2048('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2048('0x8'));var _=require(_0x2048('0x9'));var squel=require(_0x2048('0xa'));var crypto=require('crypto');var jsforce=require(_0x2048('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2048('0xc'));var querystring=require(_0x2048('0xd'));var Papa=require('papaparse');var Redis=require(_0x2048('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2048('0xf'));var as=require(_0x2048('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2048('0x11'))('api');var utils=require(_0x2048('0x12'));var config=require(_0x2048('0x13'));var licenseUtil=require(_0x2048('0x14'));var db=require(_0x2048('0x15'))['db'];var integrations=require(_0x2048('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x2048('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x820280,_0x4c2e4c,_0x5c7255,_0x1236fa){return new BPromise(function(_0x314eed,_0x16c85d){var _0x2816d8=_0x1236fa||client;return _0x2816d8[_0x2048('0x18')](_0x820280,_0x5c7255)[_0x2048('0x19')](function(_0x5c855b){logger[_0x2048('0x1a')](_0x2048('0x1b'),_0x4c2e4c,_0x2048('0x1c'));logger[_0x2048('0x1d')](_0x2048('0x1e'),_0x4c2e4c,_0x2048('0x1c'),JSON['stringify'](_0x5c855b));if(_0x5c855b['error']){if(_0x5c855b['error'][_0x2048('0x1f')]===0x1f4){logger[_0x2048('0x20')](_0x2048('0x1b'),_0x4c2e4c,_0x5c855b[_0x2048('0x20')]['message']);return _0x16c85d(_0x5c855b[_0x2048('0x20')][_0x2048('0x21')]);}logger[_0x2048('0x20')](_0x2048('0x1b'),_0x4c2e4c,_0x5c855b['error'][_0x2048('0x21')]);return _0x314eed(_0x5c855b[_0x2048('0x20')][_0x2048('0x21')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x4c2e4c,'request\x20sent');_0x314eed(_0x5c855b[_0x2048('0x22')][_0x2048('0x21')]);}})[_0x2048('0x23')](function(_0x12927a){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4c2e4c,_0x12927a);_0x16c85d(_0x12927a);});});}function respondWithStatusCode(_0x54ac33,_0x4efd5d){_0x4efd5d=_0x4efd5d||0xcc;return function(_0x411b38){if(_0x411b38){return _0x54ac33['sendStatus'](_0x4efd5d);}return _0x54ac33[_0x2048('0x24')](_0x4efd5d)[_0x2048('0x25')]();};}function respondWithResult(_0x57d196,_0x5c8d26){_0x5c8d26=_0x5c8d26||0xc8;return function(_0x37c468){if(_0x37c468){return _0x57d196[_0x2048('0x24')](_0x5c8d26)[_0x2048('0x26')](_0x37c468);}};}function respondWithFilteredResult(_0x4e0a8f,_0x6aa9cb){return function(_0xc7a737){if(_0xc7a737){var _0x149763=_0xc7a737[_0x2048('0x27')],_0x561740=_0x6aa9cb['offset'],_0x510aed=_0x6aa9cb['offset']+_0x6aa9cb[_0x2048('0x28')],_0x461110;if(_0x510aed>=_0x149763){_0x510aed=_0x149763;_0x461110=0xc8;}else{_0x461110=0xce;}_0x4e0a8f['status'](_0x461110);return _0x4e0a8f[_0x2048('0x29')](_0x2048('0x2a'),_0x561740+'-'+_0x510aed+'/'+_0x149763)[_0x2048('0x26')](_0xc7a737);}return null;};}function patchUpdates(_0xdec218){return function(_0x57a8b0){try{jsonpatch[_0x2048('0x2b')](_0x57a8b0,_0xdec218,!![]);}catch(_0x287594){return BPromise['reject'](_0x287594);}return _0x57a8b0[_0x2048('0x2c')]();};}function saveUpdates(_0xacd83a,_0x251f09){return function(_0x1b780f){if(_0x1b780f){return _0x1b780f[_0x2048('0x2d')](_0xacd83a)[_0x2048('0x19')](function(_0x3f4bce){return _0x3f4bce;});}return null;};}function removeEntity(_0x4e5472,_0x30e041){return function(_0x4eb333){if(_0x4eb333){return _0x4eb333[_0x2048('0x2e')]()[_0x2048('0x19')](function(){_0x4e5472[_0x2048('0x24')](0xcc)[_0x2048('0x25')]();});}};}function handleEntityNotFound(_0x370dd2,_0x4e45fd){return function(_0x1d48a7){if(!_0x1d48a7){_0x370dd2[_0x2048('0x2f')](0x194);}return _0x1d48a7;};}function handleError(_0x136f7d,_0x56c756){_0x56c756=_0x56c756||0x1f4;return function(_0x313d73){logger['error'](_0x313d73[_0x2048('0x30')]);if(_0x313d73[_0x2048('0x31')]){delete _0x313d73[_0x2048('0x31')];}_0x136f7d[_0x2048('0x24')](_0x56c756)['send'](_0x313d73);};}exports[_0x2048('0x32')]=function(_0x432b51,_0x57b8c7){var _0x237c9f={},_0x27c27b={},_0x1aa7bb={'count':0x0,'rows':[]};var _0x3d45c1=_[_0x2048('0x33')](db[_0x2048('0x34')]['rawAttributes'],function(_0x5361c5){return{'name':_0x5361c5['fieldName'],'type':_0x5361c5[_0x2048('0x35')][_0x2048('0x36')]};});_0x27c27b['model']=_['map'](_0x3d45c1,_0x2048('0x31'));_0x27c27b[_0x2048('0x37')]=_['keys'](_0x432b51[_0x2048('0x37')]);_0x27c27b[_0x2048('0x38')]=_[_0x2048('0x39')](_0x27c27b[_0x2048('0x3a')],_0x27c27b[_0x2048('0x37')]);_0x237c9f[_0x2048('0x3b')]=_['intersection'](_0x27c27b[_0x2048('0x3a')],qs['fields'](_0x432b51[_0x2048('0x37')]['fields']));_0x237c9f[_0x2048('0x3b')]=_0x237c9f[_0x2048('0x3b')]['length']?_0x237c9f[_0x2048('0x3b')]:_0x27c27b['model'];if(!_0x432b51[_0x2048('0x37')]['hasOwnProperty'](_0x2048('0x3c'))){_0x237c9f[_0x2048('0x28')]=qs['limit'](_0x432b51[_0x2048('0x37')][_0x2048('0x28')]);_0x237c9f[_0x2048('0x3d')]=qs['offset'](_0x432b51[_0x2048('0x37')][_0x2048('0x3d')]);}_0x237c9f[_0x2048('0x3e')]=qs['sort'](_0x432b51[_0x2048('0x37')][_0x2048('0x3f')]);_0x237c9f[_0x2048('0x40')]=qs[_0x2048('0x38')](_[_0x2048('0x41')](_0x432b51[_0x2048('0x37')],_0x27c27b[_0x2048('0x38')]),_0x3d45c1);if(_0x432b51[_0x2048('0x37')]['filter']){_0x237c9f[_0x2048('0x40')]=_[_0x2048('0x42')](_0x237c9f[_0x2048('0x40')],{'$or':_[_0x2048('0x33')](_0x3d45c1,function(_0x109187){if(_0x109187[_0x2048('0x35')]!==_0x2048('0x43')){var _0x641e0e={};_0x641e0e[_0x109187[_0x2048('0x31')]]={'$like':'%'+_0x432b51[_0x2048('0x37')][_0x2048('0x44')]+'%'};return _0x641e0e;}})});}_0x237c9f=_['merge']({},_0x237c9f,_0x432b51[_0x2048('0x45')]);var _0x5d0557={'where':_0x237c9f[_0x2048('0x40')]};return db[_0x2048('0x34')][_0x2048('0x27')](_0x5d0557)[_0x2048('0x19')](function(_0x5071cc){_0x1aa7bb['count']=_0x5071cc;if(_0x432b51[_0x2048('0x37')][_0x2048('0x46')]){_0x237c9f['include']=[{'all':!![]}];}return db[_0x2048('0x34')][_0x2048('0x47')](_0x237c9f);})[_0x2048('0x19')](function(_0xd53d8){_0x1aa7bb[_0x2048('0x48')]=_0xd53d8;return _0x1aa7bb;})[_0x2048('0x19')](respondWithFilteredResult(_0x57b8c7,_0x237c9f))[_0x2048('0x23')](handleError(_0x57b8c7,null));};exports[_0x2048('0x49')]=function(_0x43ac50,_0x3f8572){var _0x4bb611={'raw':![],'where':{'id':_0x43ac50[_0x2048('0x4a')]['id']}},_0x27170d={};_0x27170d[_0x2048('0x3a')]=_['keys'](db['FreshdeskAccount'][_0x2048('0x4b')]);_0x27170d[_0x2048('0x37')]=_[_0x2048('0x4c')](_0x43ac50['query']);_0x27170d['filters']=_[_0x2048('0x39')](_0x27170d[_0x2048('0x3a')],_0x27170d[_0x2048('0x37')]);_0x4bb611['attributes']=_[_0x2048('0x39')](_0x27170d[_0x2048('0x3a')],qs['fields'](_0x43ac50['query'][_0x2048('0x4d')]));_0x4bb611[_0x2048('0x3b')]=_0x4bb611[_0x2048('0x3b')][_0x2048('0x4e')]?_0x4bb611[_0x2048('0x3b')]:_0x27170d[_0x2048('0x3a')];if(_0x43ac50[_0x2048('0x37')][_0x2048('0x46')]){_0x4bb611['include']=[{'all':!![]}];}_0x4bb611=_['merge']({},_0x4bb611,_0x43ac50[_0x2048('0x45')]);return db[_0x2048('0x34')][_0x2048('0x4f')](_0x4bb611)[_0x2048('0x19')](handleEntityNotFound(_0x3f8572,null))['then'](respondWithResult(_0x3f8572,null))[_0x2048('0x23')](handleError(_0x3f8572,null));};exports[_0x2048('0x50')]=function(_0x56dffb,_0x367381){return db['FreshdeskAccount'][_0x2048('0x50')](_0x56dffb[_0x2048('0x51')],{})[_0x2048('0x19')](respondWithResult(_0x367381,0xc9))['catch'](handleError(_0x367381,null));};exports[_0x2048('0x2d')]=function(_0x32a787,_0x83b269){if(_0x32a787[_0x2048('0x51')]['id']){delete _0x32a787[_0x2048('0x51')]['id'];}return db[_0x2048('0x34')][_0x2048('0x4f')]({'where':{'id':_0x32a787[_0x2048('0x4a')]['id']}})['then'](handleEntityNotFound(_0x83b269,null))[_0x2048('0x19')](saveUpdates(_0x32a787['body'],null))[_0x2048('0x19')](respondWithResult(_0x83b269,null))['catch'](handleError(_0x83b269,null));};exports[_0x2048('0x2e')]=function(_0x2063f3,_0x194df3){return db['FreshdeskAccount'][_0x2048('0x4f')]({'where':{'id':_0x2063f3[_0x2048('0x4a')]['id']}})['then'](handleEntityNotFound(_0x194df3,null))[_0x2048('0x19')](removeEntity(_0x194df3,null))[_0x2048('0x23')](handleError(_0x194df3,null));};exports['getConfigurations']=function(_0x4afb95,_0x4691ee,_0x51bebc){var _0x533d1e={};var _0x12240d={};var _0x5ed6bd;var _0xcebd47;return db['FreshdeskAccount'][_0x2048('0x52')]({'where':{'id':_0x4afb95[_0x2048('0x4a')]['id']}})[_0x2048('0x19')](handleEntityNotFound(_0x4691ee,null))[_0x2048('0x19')](function(_0x2bda2f){if(_0x2bda2f){_0x5ed6bd=_0x2bda2f;_0x12240d[_0x2048('0x3a')]=_[_0x2048('0x4c')](db[_0x2048('0x53')]['rawAttributes']);_0x12240d[_0x2048('0x37')]=_['keys'](_0x4afb95[_0x2048('0x37')]);_0x12240d[_0x2048('0x38')]=_['intersection'](_0x12240d['model'],_0x12240d['query']);_0x533d1e[_0x2048('0x3b')]=_['intersection'](_0x12240d[_0x2048('0x3a')],qs[_0x2048('0x4d')](_0x4afb95[_0x2048('0x37')][_0x2048('0x4d')]));_0x533d1e[_0x2048('0x3b')]=_0x533d1e[_0x2048('0x3b')][_0x2048('0x4e')]?_0x533d1e[_0x2048('0x3b')]:_0x12240d[_0x2048('0x3a')];_0x533d1e[_0x2048('0x3e')]=qs['sort'](_0x4afb95[_0x2048('0x37')]['sort']);_0x533d1e[_0x2048('0x40')]=qs[_0x2048('0x38')](_[_0x2048('0x41')](_0x4afb95[_0x2048('0x37')],_0x12240d[_0x2048('0x38')]));if(_0x4afb95['query'][_0x2048('0x44')]){_0x533d1e[_0x2048('0x40')]=_[_0x2048('0x42')](_0x533d1e[_0x2048('0x40')],{'$or':_[_0x2048('0x33')](_0x533d1e['attributes'],function(_0x4d3e60){var _0x2dcb03={};_0x2dcb03[_0x4d3e60]={'$like':'%'+_0x4afb95[_0x2048('0x37')]['filter']+'%'};return _0x2dcb03;})});}_0x533d1e=_['merge']({},_0x533d1e,_0x4afb95[_0x2048('0x45')]);return _0x5ed6bd[_0x2048('0x54')](_0x533d1e);}})[_0x2048('0x19')](function(_0x424a48){if(_0x424a48){_0xcebd47=_0x424a48['length'];if(!_0x4afb95['query'][_0x2048('0x55')](_0x2048('0x3c'))){_0x533d1e['limit']=qs[_0x2048('0x28')](_0x4afb95[_0x2048('0x37')]['limit']);_0x533d1e['offset']=qs['offset'](_0x4afb95[_0x2048('0x37')][_0x2048('0x3d')]);}return _0x5ed6bd[_0x2048('0x54')](_0x533d1e);}})[_0x2048('0x19')](function(_0x1ee543){if(_0x1ee543){return _0x1ee543?{'count':_0xcebd47,'rows':_0x1ee543}:null;}})[_0x2048('0x19')](respondWithResult(_0x4691ee,null))[_0x2048('0x23')](handleError(_0x4691ee,null));};exports[_0x2048('0x56')]=function(_0x3e0579,_0x39edf7,_0x4f0e54){if(_0x3e0579['body']['id']){delete _0x3e0579[_0x2048('0x51')]['id'];}return db[_0x2048('0x34')][_0x2048('0x52')]({'where':{'id':_0x3e0579[_0x2048('0x4a')]['id']}})[_0x2048('0x19')](handleEntityNotFound(_0x39edf7,null))['then'](function(_0x1f474b){if(_0x1f474b){_0x3e0579[_0x2048('0x51')]['AccountId']=_0x1f474b['id'];_0x3e0579[_0x2048('0x51')]['Subjects']=integrations['getSubjects'](_0x3e0579[_0x2048('0x51')][_0x2048('0x57')],_0x3e0579[_0x2048('0x51')][_0x2048('0x35')]);_0x3e0579[_0x2048('0x51')][_0x2048('0x58')]=integrations[_0x2048('0x59')](_0x3e0579['body'][_0x2048('0x57')],_0x3e0579[_0x2048('0x51')][_0x2048('0x35')]);return db[_0x2048('0x53')][_0x2048('0x50')](_0x3e0579[_0x2048('0x51')],{'include':[{'model':db[_0x2048('0x5a')],'as':_0x2048('0x5b')},{'model':db[_0x2048('0x5a')],'as':_0x2048('0x58')}]});}return null;})[_0x2048('0x19')](respondWithResult(_0x39edf7,null))[_0x2048('0x23')](handleError(_0x39edf7,null));};exports['getFields']=function(_0x1c6c3f,_0x33bbdb,_0x1b3b7a){var _0x2c9d1a='';return db[_0x2048('0x34')][_0x2048('0x52')]({'where':{'id':_0x1c6c3f[_0x2048('0x4a')]['id']},'attributes':['id',_0x2048('0x5c'),_0x2048('0x5d')]})[_0x2048('0x19')](handleEntityNotFound(_0x33bbdb,null))[_0x2048('0x19')](function(_0x58b568){if(_0x58b568){_0x2c9d1a=_0x58b568[_0x2048('0x5c')];var _0x1c45ec=_0x2c9d1a[_0x2048('0x5e')](-0x1);if(_0x1c45ec==='/'){_0x2c9d1a=_0x2c9d1a[_0x2048('0x5f')](0x0,_0x2c9d1a['lastIndexOf'](_0x1c45ec));}return rp({'method':_0x2048('0x60'),'uri':util[_0x2048('0x61')](_0x2048('0x62'),_0x2c9d1a,_0x2048('0x63')),'headers':{'Authorization':util[_0x2048('0x61')](_0x2048('0x64'),new Buffer(util['format'](_0x2048('0x65'),_0x58b568[_0x2048('0x5d')]))[_0x2048('0x66')]('base64'))},'json':!![]});}})['then'](function(_0x56b103){if(_0x56b103){var _0xd03170=['requester',_0x2048('0x67'),_0x2048('0x68'),_0x2048('0x69'),_0x2048('0x24'),_0x2048('0x6a'),'group','source','ticket_type',_0x2048('0x6b'),_0x2048('0x6c')];_[_0x2048('0x6d')](_0x56b103,function(_0x28bd98){return _0xd03170[_0x2048('0x6e')](_0x28bd98['name'])||!_0x28bd98[_0x2048('0x6f')]&&_0x28bd98['type']!=='custom_text'&&_0x28bd98[_0x2048('0x35')]!==_0x2048('0x70');});return{'count':_0x56b103[_0x2048('0x4e')],'rows':_[_0x2048('0x33')](_0x56b103,function(_0x4d2a01){return{'id':_0x4d2a01['name'],'name':_0x4d2a01[_0x2048('0x71')],'custom':!_0x4d2a01['default'],'options':_0x4d2a01[_0x2048('0x72')]?_[_0x2048('0x33')](_0x4d2a01[_0x2048('0x72')],function(_0x50d2d2){return{'name':_[_0x2048('0x73')](_0x50d2d2),'value':_0x50d2d2};}):[]};})};}})[_0x2048('0x19')](respondWithResult(_0x33bbdb,null))[_0x2048('0x23')](function(_0x282c60){var _0x2b822d=_0x1c6c3f[_0x2048('0x37')][_0x2048('0x74')]?0x1f4:_0x282c60['statusCode']||0x1f4;logger[_0x2048('0x20')](_0x2048('0x75'),'getFields',_0x2b822d,JSON['stringify'](_0x282c60));delete _0x282c60[_0x2048('0x31')];if(_0x2b822d===0x191){_0x2b822d=0x190;}_0x33bbdb['status'](_0x2b822d)['send'](_0x1c6c3f['query'][_0x2048('0x74')]?{'message':_0x2048('0x76'),'statusCode':_0x282c60[_0x2048('0x77')]}:_0x282c60);});}; \ No newline at end of file +var _0x244a=['http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','subject','agent','description','priority','ticket_type','group','company','remove','includes','custom_text','custom_dropdown','label','default','choices','test','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x382d7e,_0x16798c){var _0x33c721=function(_0x13d857){while(--_0x13d857){_0x382d7e['push'](_0x382d7e['shift']());}};_0x33c721(++_0x16798c);}(_0x244a,0x153));var _0xa244=function(_0x121f72,_0x299f72){_0x121f72=_0x121f72-0x0;var _0x3ef898=_0x244a[_0x121f72];return _0x3ef898;};'use strict';var pdf=require(_0xa244('0x0'));var emlformat=require(_0xa244('0x1'));var rimraf=require(_0xa244('0x2'));var zipdir=require(_0xa244('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa244('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa244('0x5'));var util=require(_0xa244('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa244('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa244('0x8'));var squel=require('squel');var crypto=require(_0xa244('0x9'));var jsforce=require(_0xa244('0xa'));var deskjs=require(_0xa244('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa244('0xc'));var Papa=require(_0xa244('0xd'));var Redis=require('ioredis');var authService=require(_0xa244('0xe'));var qs=require(_0xa244('0xf'));var as=require(_0xa244('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa244('0x11'))(_0xa244('0x12'));var utils=require('../../config/utils');var config=require(_0xa244('0x13'));var licenseUtil=require(_0xa244('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0xa244('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x264413,_0x836be0,_0xe90196,_0x457f35){return new BPromise(function(_0x4e240a,_0x2cb95c){var _0x38a78e=_0x457f35||client;return _0x38a78e['request'](_0x264413,_0xe90196)[_0xa244('0x16')](function(_0x172bf6){logger[_0xa244('0x17')](_0xa244('0x18'),_0x836be0,_0xa244('0x19'));logger['debug'](_0xa244('0x1a'),_0x836be0,_0xa244('0x19'),JSON[_0xa244('0x1b')](_0x172bf6));if(_0x172bf6[_0xa244('0x1c')]){if(_0x172bf6[_0xa244('0x1c')][_0xa244('0x1d')]===0x1f4){logger[_0xa244('0x1c')](_0xa244('0x18'),_0x836be0,_0x172bf6[_0xa244('0x1c')]['message']);return _0x2cb95c(_0x172bf6['error']['message']);}logger['error'](_0xa244('0x18'),_0x836be0,_0x172bf6[_0xa244('0x1c')][_0xa244('0x1e')]);return _0x4e240a(_0x172bf6[_0xa244('0x1c')][_0xa244('0x1e')]);}else{logger[_0xa244('0x17')](_0xa244('0x18'),_0x836be0,_0xa244('0x19'));_0x4e240a(_0x172bf6[_0xa244('0x1f')][_0xa244('0x1e')]);}})[_0xa244('0x20')](function(_0x44da9c){logger['error'](_0xa244('0x18'),_0x836be0,_0x44da9c);_0x2cb95c(_0x44da9c);});});}function respondWithStatusCode(_0x1dea53,_0x7ab393){_0x7ab393=_0x7ab393||0xcc;return function(_0x5381ee){if(_0x5381ee){return _0x1dea53['sendStatus'](_0x7ab393);}return _0x1dea53[_0xa244('0x21')](_0x7ab393)[_0xa244('0x22')]();};}function respondWithResult(_0x241f2c,_0x464274){_0x464274=_0x464274||0xc8;return function(_0x315ccd){if(_0x315ccd){return _0x241f2c['status'](_0x464274)[_0xa244('0x23')](_0x315ccd);}};}function respondWithFilteredResult(_0x3310b0,_0x11c8c6){return function(_0x503b95){if(_0x503b95){var _0x132726=_0x503b95[_0xa244('0x24')],_0x2894c2=_0x11c8c6[_0xa244('0x25')],_0x422f1c=_0x11c8c6[_0xa244('0x25')]+_0x11c8c6[_0xa244('0x26')],_0xe73fb4;if(_0x422f1c>=_0x132726){_0x422f1c=_0x132726;_0xe73fb4=0xc8;}else{_0xe73fb4=0xce;}_0x3310b0[_0xa244('0x21')](_0xe73fb4);return _0x3310b0[_0xa244('0x27')](_0xa244('0x28'),_0x2894c2+'-'+_0x422f1c+'/'+_0x132726)['json'](_0x503b95);}return null;};}function patchUpdates(_0x41b021){return function(_0x3a7026){try{jsonpatch[_0xa244('0x29')](_0x3a7026,_0x41b021,!![]);}catch(_0x508fe3){return BPromise[_0xa244('0x2a')](_0x508fe3);}return _0x3a7026[_0xa244('0x2b')]();};}function saveUpdates(_0x44f889,_0x3b4879){return function(_0x83b86e){if(_0x83b86e){return _0x83b86e[_0xa244('0x2c')](_0x44f889)[_0xa244('0x16')](function(_0x1f0165){return _0x1f0165;});}return null;};}function removeEntity(_0x41c161,_0x458e21){return function(_0x468620){if(_0x468620){return _0x468620[_0xa244('0x2d')]()['then'](function(){_0x41c161[_0xa244('0x21')](0xcc)[_0xa244('0x22')]();});}};}function handleEntityNotFound(_0x937b8a,_0x587d78){return function(_0x367b35){if(!_0x367b35){_0x937b8a[_0xa244('0x2e')](0x194);}return _0x367b35;};}function handleError(_0x1faabb,_0x2c9af7){_0x2c9af7=_0x2c9af7||0x1f4;return function(_0x3206d2){logger['error'](_0x3206d2['stack']);if(_0x3206d2[_0xa244('0x2f')]){delete _0x3206d2[_0xa244('0x2f')];}_0x1faabb[_0xa244('0x21')](_0x2c9af7)['send'](_0x3206d2);};}exports[_0xa244('0x30')]=function(_0x4585ac,_0x55fc26){var _0x529f09={},_0x2662b6={},_0x1bbb5c={'count':0x0,'rows':[]};var _0x4b8b83=_[_0xa244('0x31')](db[_0xa244('0x32')][_0xa244('0x33')],function(_0x29ee25){return{'name':_0x29ee25[_0xa244('0x34')],'type':_0x29ee25[_0xa244('0x35')][_0xa244('0x36')]};});_0x2662b6[_0xa244('0x37')]=_[_0xa244('0x31')](_0x4b8b83,_0xa244('0x2f'));_0x2662b6[_0xa244('0x38')]=_['keys'](_0x4585ac['query']);_0x2662b6['filters']=_['intersection'](_0x2662b6[_0xa244('0x37')],_0x2662b6[_0xa244('0x38')]);_0x529f09[_0xa244('0x39')]=_[_0xa244('0x3a')](_0x2662b6[_0xa244('0x37')],qs[_0xa244('0x3b')](_0x4585ac[_0xa244('0x38')][_0xa244('0x3b')]));_0x529f09[_0xa244('0x39')]=_0x529f09[_0xa244('0x39')][_0xa244('0x3c')]?_0x529f09[_0xa244('0x39')]:_0x2662b6[_0xa244('0x37')];if(!_0x4585ac['query'][_0xa244('0x3d')](_0xa244('0x3e'))){_0x529f09[_0xa244('0x26')]=qs[_0xa244('0x26')](_0x4585ac['query'][_0xa244('0x26')]);_0x529f09['offset']=qs['offset'](_0x4585ac[_0xa244('0x38')][_0xa244('0x25')]);}_0x529f09[_0xa244('0x3f')]=qs[_0xa244('0x40')](_0x4585ac[_0xa244('0x38')][_0xa244('0x40')]);_0x529f09[_0xa244('0x41')]=qs[_0xa244('0x42')](_[_0xa244('0x43')](_0x4585ac['query'],_0x2662b6[_0xa244('0x42')]),_0x4b8b83);if(_0x4585ac[_0xa244('0x38')][_0xa244('0x44')]){_0x529f09['where']=_[_0xa244('0x45')](_0x529f09[_0xa244('0x41')],{'$or':_['map'](_0x4b8b83,function(_0x300073){if(_0x300073[_0xa244('0x35')]!==_0xa244('0x46')){var _0x53f432={};_0x53f432[_0x300073['name']]={'$like':'%'+_0x4585ac[_0xa244('0x38')][_0xa244('0x44')]+'%'};return _0x53f432;}})});}_0x529f09=_[_0xa244('0x45')]({},_0x529f09,_0x4585ac[_0xa244('0x47')]);var _0x14253d={'where':_0x529f09[_0xa244('0x41')]};return db[_0xa244('0x32')][_0xa244('0x24')](_0x14253d)[_0xa244('0x16')](function(_0x290255){_0x1bbb5c[_0xa244('0x24')]=_0x290255;if(_0x4585ac[_0xa244('0x38')][_0xa244('0x48')]){_0x529f09[_0xa244('0x49')]=[{'all':!![]}];}return db[_0xa244('0x32')][_0xa244('0x4a')](_0x529f09);})[_0xa244('0x16')](function(_0x5dd347){_0x1bbb5c[_0xa244('0x4b')]=_0x5dd347;return _0x1bbb5c;})[_0xa244('0x16')](respondWithFilteredResult(_0x55fc26,_0x529f09))[_0xa244('0x20')](handleError(_0x55fc26,null));};exports[_0xa244('0x4c')]=function(_0x4a71a8,_0x44f9a0){var _0x2159db={'raw':![],'where':{'id':_0x4a71a8[_0xa244('0x4d')]['id']}},_0x57f640={};_0x57f640[_0xa244('0x37')]=_[_0xa244('0x4e')](db['FreshdeskAccount'][_0xa244('0x33')]);_0x57f640[_0xa244('0x38')]=_[_0xa244('0x4e')](_0x4a71a8['query']);_0x57f640[_0xa244('0x42')]=_[_0xa244('0x3a')](_0x57f640[_0xa244('0x37')],_0x57f640['query']);_0x2159db[_0xa244('0x39')]=_[_0xa244('0x3a')](_0x57f640['model'],qs[_0xa244('0x3b')](_0x4a71a8[_0xa244('0x38')][_0xa244('0x3b')]));_0x2159db[_0xa244('0x39')]=_0x2159db[_0xa244('0x39')][_0xa244('0x3c')]?_0x2159db[_0xa244('0x39')]:_0x57f640[_0xa244('0x37')];if(_0x4a71a8[_0xa244('0x38')][_0xa244('0x48')]){_0x2159db[_0xa244('0x49')]=[{'all':!![]}];}_0x2159db=_[_0xa244('0x45')]({},_0x2159db,_0x4a71a8[_0xa244('0x47')]);return db['FreshdeskAccount'][_0xa244('0x4f')](_0x2159db)[_0xa244('0x16')](handleEntityNotFound(_0x44f9a0,null))[_0xa244('0x16')](respondWithResult(_0x44f9a0,null))[_0xa244('0x20')](handleError(_0x44f9a0,null));};exports[_0xa244('0x50')]=function(_0x27c8e5,_0x46100c){return db[_0xa244('0x32')][_0xa244('0x50')](_0x27c8e5[_0xa244('0x51')],{})[_0xa244('0x16')](respondWithResult(_0x46100c,0xc9))['catch'](handleError(_0x46100c,null));};exports[_0xa244('0x2c')]=function(_0x5efc5a,_0x4f575f){if(_0x5efc5a[_0xa244('0x51')]['id']){delete _0x5efc5a[_0xa244('0x51')]['id'];}return db[_0xa244('0x32')][_0xa244('0x4f')]({'where':{'id':_0x5efc5a['params']['id']}})[_0xa244('0x16')](handleEntityNotFound(_0x4f575f,null))['then'](saveUpdates(_0x5efc5a[_0xa244('0x51')],null))[_0xa244('0x16')](respondWithResult(_0x4f575f,null))['catch'](handleError(_0x4f575f,null));};exports['destroy']=function(_0x1fef0f,_0x18405b){return db['FreshdeskAccount'][_0xa244('0x4f')]({'where':{'id':_0x1fef0f[_0xa244('0x4d')]['id']}})[_0xa244('0x16')](handleEntityNotFound(_0x18405b,null))[_0xa244('0x16')](removeEntity(_0x18405b,null))[_0xa244('0x20')](handleError(_0x18405b,null));};exports[_0xa244('0x52')]=function(_0x4fe64e,_0x249e89,_0x5d628f){var _0x13d2f5={};var _0x2b1eee={};var _0x330b73;var _0x264857;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x4fe64e[_0xa244('0x4d')]['id']}})[_0xa244('0x16')](handleEntityNotFound(_0x249e89,null))[_0xa244('0x16')](function(_0x32334d){if(_0x32334d){_0x330b73=_0x32334d;_0x2b1eee[_0xa244('0x37')]=_['keys'](db[_0xa244('0x53')][_0xa244('0x33')]);_0x2b1eee['query']=_[_0xa244('0x4e')](_0x4fe64e[_0xa244('0x38')]);_0x2b1eee[_0xa244('0x42')]=_['intersection'](_0x2b1eee['model'],_0x2b1eee[_0xa244('0x38')]);_0x13d2f5[_0xa244('0x39')]=_[_0xa244('0x3a')](_0x2b1eee[_0xa244('0x37')],qs[_0xa244('0x3b')](_0x4fe64e[_0xa244('0x38')][_0xa244('0x3b')]));_0x13d2f5[_0xa244('0x39')]=_0x13d2f5[_0xa244('0x39')]['length']?_0x13d2f5['attributes']:_0x2b1eee[_0xa244('0x37')];_0x13d2f5['order']=qs[_0xa244('0x40')](_0x4fe64e[_0xa244('0x38')][_0xa244('0x40')]);_0x13d2f5[_0xa244('0x41')]=qs[_0xa244('0x42')](_[_0xa244('0x43')](_0x4fe64e[_0xa244('0x38')],_0x2b1eee[_0xa244('0x42')]));if(_0x4fe64e[_0xa244('0x38')][_0xa244('0x44')]){_0x13d2f5[_0xa244('0x41')]=_[_0xa244('0x45')](_0x13d2f5[_0xa244('0x41')],{'$or':_[_0xa244('0x31')](_0x13d2f5[_0xa244('0x39')],function(_0x2222b9){var _0x581676={};_0x581676[_0x2222b9]={'$like':'%'+_0x4fe64e[_0xa244('0x38')][_0xa244('0x44')]+'%'};return _0x581676;})});}_0x13d2f5=_[_0xa244('0x45')]({},_0x13d2f5,_0x4fe64e[_0xa244('0x47')]);return _0x330b73[_0xa244('0x52')](_0x13d2f5);}})[_0xa244('0x16')](function(_0x50d6d4){if(_0x50d6d4){_0x264857=_0x50d6d4['length'];if(!_0x4fe64e[_0xa244('0x38')][_0xa244('0x3d')](_0xa244('0x3e'))){_0x13d2f5['limit']=qs['limit'](_0x4fe64e[_0xa244('0x38')]['limit']);_0x13d2f5[_0xa244('0x25')]=qs['offset'](_0x4fe64e[_0xa244('0x38')][_0xa244('0x25')]);}return _0x330b73[_0xa244('0x52')](_0x13d2f5);}})[_0xa244('0x16')](function(_0x58220e){if(_0x58220e){return _0x58220e?{'count':_0x264857,'rows':_0x58220e}:null;}})['then'](respondWithResult(_0x249e89,null))['catch'](handleError(_0x249e89,null));};exports[_0xa244('0x54')]=function(_0x45a2f5,_0x218f13,_0x4b1899){if(_0x45a2f5[_0xa244('0x51')]['id']){delete _0x45a2f5[_0xa244('0x51')]['id'];}return db[_0xa244('0x32')][_0xa244('0x55')]({'where':{'id':_0x45a2f5[_0xa244('0x4d')]['id']}})[_0xa244('0x16')](handleEntityNotFound(_0x218f13,null))[_0xa244('0x16')](function(_0x4dd3eb){if(_0x4dd3eb){_0x45a2f5[_0xa244('0x51')]['AccountId']=_0x4dd3eb['id'];_0x45a2f5[_0xa244('0x51')][_0xa244('0x56')]=integrations['getSubjects'](_0x45a2f5[_0xa244('0x51')][_0xa244('0x57')],_0x45a2f5[_0xa244('0x51')]['type']);_0x45a2f5[_0xa244('0x51')][_0xa244('0x58')]=integrations[_0xa244('0x59')](_0x45a2f5[_0xa244('0x51')]['channel'],_0x45a2f5[_0xa244('0x51')][_0xa244('0x35')]);return db[_0xa244('0x53')][_0xa244('0x50')](_0x45a2f5[_0xa244('0x51')],{'include':[{'model':db[_0xa244('0x5a')],'as':'Subjects'},{'model':db[_0xa244('0x5a')],'as':_0xa244('0x58')}]});}return null;})['then'](respondWithResult(_0x218f13,null))['catch'](handleError(_0x218f13,null));};exports[_0xa244('0x5b')]=function(_0x1456c3,_0x5efcd5,_0x1f798b){var _0x14eb8d='';return db[_0xa244('0x32')]['findOne']({'where':{'id':_0x1456c3[_0xa244('0x4d')]['id']},'attributes':['id',_0xa244('0x5c'),_0xa244('0x5d')]})[_0xa244('0x16')](handleEntityNotFound(_0x5efcd5,null))[_0xa244('0x16')](function(_0x47d004){if(_0x47d004){_0x14eb8d=_0x47d004[_0xa244('0x5c')];var _0x2afd3c=_0x14eb8d[_0xa244('0x5e')](-0x1);if(_0x2afd3c==='/'){_0x14eb8d=_0x14eb8d[_0xa244('0x5f')](0x0,_0x14eb8d[_0xa244('0x60')](_0x2afd3c));}return rp({'method':'GET','uri':util[_0xa244('0x61')]('%s/%s',_0x14eb8d,_0xa244('0x62')),'headers':{'Authorization':util['format'](_0xa244('0x63'),new Buffer(util[_0xa244('0x61')]('%s:X',_0x47d004[_0xa244('0x5d')]))[_0xa244('0x64')](_0xa244('0x65')))},'json':!![]});}})['then'](function(_0x3101b4){if(_0x3101b4){var _0x279cbd=['requester',_0xa244('0x66'),_0xa244('0x67'),_0xa244('0x68'),'status',_0xa244('0x69'),'group','source',_0xa244('0x6a'),_0xa244('0x6b'),_0xa244('0x6c')];_[_0xa244('0x6d')](_0x3101b4,function(_0x2b7937){return _0x279cbd[_0xa244('0x6e')](_0x2b7937[_0xa244('0x2f')])||!_0x2b7937['default']&&_0x2b7937['type']!==_0xa244('0x6f')&&_0x2b7937[_0xa244('0x35')]!==_0xa244('0x70');});return{'count':_0x3101b4[_0xa244('0x3c')],'rows':_[_0xa244('0x31')](_0x3101b4,function(_0x4c5057){return{'id':_0x4c5057[_0xa244('0x2f')],'name':_0x4c5057[_0xa244('0x71')],'custom':!_0x4c5057[_0xa244('0x72')],'options':_0x4c5057[_0xa244('0x73')]?_[_0xa244('0x31')](_0x4c5057[_0xa244('0x73')],function(_0x22c384){return{'name':_['capitalize'](_0x22c384),'value':_0x22c384};}):[]};})};}})[_0xa244('0x16')](respondWithResult(_0x5efcd5,null))[_0xa244('0x20')](function(_0x150b6a){var _0xafc9e5=_0x1456c3[_0xa244('0x38')][_0xa244('0x74')]?0x1f4:_0x150b6a[_0xa244('0x75')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xafc9e5,JSON[_0xa244('0x1b')](_0x150b6a));delete _0x150b6a[_0xa244('0x2f')];if(_0xafc9e5===0x191){_0xafc9e5=0x190;}_0x5efcd5[_0xa244('0x21')](_0xafc9e5)[_0xa244('0x76')](_0x1456c3[_0xa244('0x38')][_0xa244('0x74')]?{'message':_0xa244('0x77'),'statusCode':_0x150b6a[_0xa244('0x75')]}:_0x150b6a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 62c5876..55eb1e3 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 _0x7fde=['exports','define','FreshdeskAccount','util','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x7fde,0x14d));var _0xe7fd=function(_0x472130,_0x19f3f8){_0x472130=_0x472130-0x0;var _0x460f5c=_0x7fde[_0x472130];return _0x460f5c;};'use strict';var _=require('lodash');var util=require(_0xe7fd('0x0'));var logger=require('../../config/logger')(_0xe7fd('0x1'));var moment=require('moment');var BPromise=require(_0xe7fd('0x2'));var rp=require(_0xe7fd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7fd('0x4'));var config=require(_0xe7fd('0x5'));var attributes=require(_0xe7fd('0x6'));var integrations=require(_0xe7fd('0x7'));module[_0xe7fd('0x8')]=function(_0x3ab83c,_0x543851){return _0x3ab83c[_0xe7fd('0x9')](_0xe7fd('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c62=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x2d2892,_0x57ec66){var _0x236e6f=function(_0x3912ac){while(--_0x3912ac){_0x2d2892['push'](_0x2d2892['shift']());}};_0x236e6f(++_0x57ec66);}(_0x2c62,0x98));var _0x22c6=function(_0x22605b,_0x53a49e){_0x22605b=_0x22605b-0x0;var _0x3afe1a=_0x2c62[_0x22605b];return _0x3afe1a;};'use strict';var _=require(_0x22c6('0x0'));var util=require(_0x22c6('0x1'));var logger=require(_0x22c6('0x2'))(_0x22c6('0x3'));var moment=require(_0x22c6('0x4'));var BPromise=require(_0x22c6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22c6('0x6'));var rimraf=require(_0x22c6('0x7'));var config=require(_0x22c6('0x8'));var attributes=require(_0x22c6('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x22c6('0xa')]=function(_0x9e0004,_0x3b072c){return _0x9e0004[_0x22c6('0xb')](_0x22c6('0xc'),attributes,{'tableName':_0x22c6('0xd'),'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 e4af24e..34a5c75 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 _0x611a=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','findAll','options','attributes','limit','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x611a,0x144));var _0xa611=function(_0x1d046e,_0x34004c){_0x1d046e=_0x1d046e-0x0;var _0x238c98=_0x611a[_0x1d046e];return _0x238c98;};'use strict';var _=require(_0xa611('0x0'));var util=require(_0xa611('0x1'));var moment=require(_0xa611('0x2'));var BPromise=require(_0xa611('0x3'));var rs=require(_0xa611('0x4'));var fs=require('fs');var Redis=require(_0xa611('0x5'));var db=require(_0xa611('0x6'))['db'];var utils=require(_0xa611('0x7'));var logger=require('../../config/logger')(_0xa611('0x8'));var config=require(_0xa611('0x9'));var jayson=require(_0xa611('0xa'));var client=jayson[_0xa611('0xb')][_0xa611('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ad0ef,_0x256cfe,_0x4fd74c){return new BPromise(function(_0x4f428b,_0xa2ee3c){return client[_0xa611('0xd')](_0x4ad0ef,_0x4fd74c)[_0xa611('0xe')](function(_0x36f53f){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x256cfe,_0xa611('0xf'));logger[_0xa611('0x10')](_0xa611('0x11'),_0x256cfe,'request\x20sent',JSON[_0xa611('0x12')](_0x36f53f));if(_0x36f53f[_0xa611('0x13')]){if(_0x36f53f[_0xa611('0x13')][_0xa611('0x14')]===0x1f4){logger[_0xa611('0x13')](_0xa611('0x15'),_0x256cfe,_0x36f53f['error'][_0xa611('0x16')]);return _0xa2ee3c(_0x36f53f['error']['message']);}logger[_0xa611('0x13')](_0xa611('0x15'),_0x256cfe,_0x36f53f[_0xa611('0x13')][_0xa611('0x16')]);return _0x4f428b(_0x36f53f[_0xa611('0x13')][_0xa611('0x16')]);}else{logger[_0xa611('0x17')](_0xa611('0x15'),_0x256cfe,_0xa611('0xf'));_0x4f428b(_0x36f53f[_0xa611('0x18')][_0xa611('0x16')]);}})[_0xa611('0x19')](function(_0x23c113){logger[_0xa611('0x13')](_0xa611('0x15'),_0x256cfe,_0x23c113);_0xa2ee3c(_0x23c113);});});}exports['GetFreshdeskAccount']=function(_0x4bec17){var _0xf3a0bd=this;return new Promise(function(_0x212e54,_0x10b105){return db['FreshdeskAccount'][_0xa611('0x1a')]({'raw':_0x4bec17[_0xa611('0x1b')]?_0x4bec17[_0xa611('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4bec17[_0xa611('0x1b')]?_0x4bec17[_0xa611('0x1b')]['where']||null:null,'attributes':_0x4bec17['options']?_0x4bec17[_0xa611('0x1b')][_0xa611('0x1c')]||null:null,'limit':_0x4bec17[_0xa611('0x1b')]?_0x4bec17[_0xa611('0x1b')][_0xa611('0x1d')]||null:null,'include':_0x4bec17[_0xa611('0x1b')]?_0x4bec17[_0xa611('0x1b')][_0xa611('0x1e')]?_['map'](_0x4bec17[_0xa611('0x1b')][_0xa611('0x1e')],function(_0x457394){return{'model':db[_0x457394[_0xa611('0x1f')]],'as':_0x457394['as'],'attributes':_0x457394['attributes'],'include':_0x457394['include']?_['map'](_0x457394[_0xa611('0x1e')],function(_0x1b02c8){return{'model':db[_0x1b02c8['model']],'as':_0x1b02c8['as'],'attributes':_0x1b02c8[_0xa611('0x1c')],'include':_0x1b02c8[_0xa611('0x1e')]?_[_0xa611('0x20')](_0x1b02c8[_0xa611('0x1e')],function(_0x2a7822){return{'model':db[_0x2a7822[_0xa611('0x1f')]],'as':_0x2a7822['as'],'attributes':_0x2a7822[_0xa611('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa611('0xe')](function(_0x49c031){logger[_0xa611('0x17')](_0xa611('0x21'),_0x4bec17);logger[_0xa611('0x10')](_0xa611('0x21'),_0x4bec17,JSON[_0xa611('0x12')](_0x49c031));_0x212e54(_0x49c031);})['catch'](function(_0x20f2ff){logger[_0xa611('0x13')](_0xa611('0x21'),_0x20f2ff[_0xa611('0x16')],_0x4bec17);_0x10b105(_0xf3a0bd[_0xa611('0x13')](0x1f4,_0x20f2ff[_0xa611('0x16')]));});});};exports[_0xa611('0x22')]=function(_0x1c4734){var _0x2e0598=this;return new Promise(function(_0x4cb8ce,_0x327b2d){return db[_0xa611('0x23')][_0xa611('0x24')]({'raw':_0x1c4734[_0xa611('0x1b')]?_0x1c4734['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c4734['options']?_0x1c4734['options']['where']||null:null,'attributes':_0x1c4734[_0xa611('0x1b')]?_0x1c4734['options'][_0xa611('0x1c')]||null:null,'include':_0x1c4734['options']?_0x1c4734['options']['include']?_[_0xa611('0x20')](_0x1c4734['options'][_0xa611('0x1e')],function(_0x4d17c2){return{'model':db[_0x4d17c2['model']],'as':_0x4d17c2['as'],'attributes':_0x4d17c2[_0xa611('0x1c')],'include':_0x4d17c2['include']?_[_0xa611('0x20')](_0x4d17c2[_0xa611('0x1e')],function(_0x16c4e3){return{'model':db[_0x16c4e3[_0xa611('0x1f')]],'as':_0x16c4e3['as'],'attributes':_0x16c4e3[_0xa611('0x1c')],'include':_0x16c4e3[_0xa611('0x1e')]?_['map'](_0x16c4e3['include'],function(_0x223c52){return{'model':db[_0x223c52[_0xa611('0x1f')]],'as':_0x223c52['as'],'attributes':_0x223c52['attributes']};}):[]};}):[]};}):[]:[]})[_0xa611('0xe')](function(_0x4d07ca){logger['info'](_0xa611('0x22'),_0x1c4734);logger[_0xa611('0x10')](_0xa611('0x22'),_0x1c4734,JSON[_0xa611('0x12')](_0x4d07ca));_0x4cb8ce(_0x4d07ca);})[_0xa611('0x19')](function(_0x42ec44){logger['error'](_0xa611('0x22'),_0x42ec44[_0xa611('0x16')],_0x1c4734);_0x327b2d(_0x2e0598[_0xa611('0x13')](0x1f4,_0x42ec44[_0xa611('0x16')]));});});}; \ No newline at end of file +var _0x921e=['request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','GetFreshdeskAccount','options','raw','where','attributes','limit','include','model','map','catch','ShowFreshdeskAccount','FreshdeskAccount','find','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x59b16a,_0xdf7e85){var _0x40eb9a=function(_0x16da33){while(--_0x16da33){_0x59b16a['push'](_0x59b16a['shift']());}};_0x40eb9a(++_0xdf7e85);}(_0x921e,0x106));var _0xe921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x921e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe921('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe921('0x1'));var rs=require(_0xe921('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe921('0x3'))['db'];var utils=require(_0xe921('0x4'));var logger=require(_0xe921('0x5'))(_0xe921('0x6'));var config=require(_0xe921('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe921('0x8')][_0xe921('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x595ae3,_0x455bd9,_0x4bf4fc){return new BPromise(function(_0x5656d3,_0x104b35){return client[_0xe921('0xa')](_0x595ae3,_0x4bf4fc)[_0xe921('0xb')](function(_0x588975){logger['info'](_0xe921('0xc'),_0x455bd9,_0xe921('0xd'));logger[_0xe921('0xe')](_0xe921('0xf'),_0x455bd9,'request\x20sent',JSON['stringify'](_0x588975));if(_0x588975[_0xe921('0x10')]){if(_0x588975[_0xe921('0x10')]['code']===0x1f4){logger['error'](_0xe921('0xc'),_0x455bd9,_0x588975[_0xe921('0x10')][_0xe921('0x11')]);return _0x104b35(_0x588975[_0xe921('0x10')][_0xe921('0x11')]);}logger[_0xe921('0x10')](_0xe921('0xc'),_0x455bd9,_0x588975['error']['message']);return _0x5656d3(_0x588975['error'][_0xe921('0x11')]);}else{logger[_0xe921('0x12')](_0xe921('0xc'),_0x455bd9,_0xe921('0xd'));_0x5656d3(_0x588975[_0xe921('0x13')][_0xe921('0x11')]);}})['catch'](function(_0x5aa6c8){logger[_0xe921('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x455bd9,_0x5aa6c8);_0x104b35(_0x5aa6c8);});});}exports[_0xe921('0x14')]=function(_0x4cef21){var _0x2f095f=this;return new Promise(function(_0x4e0cd5,_0x59ccab){return db['FreshdeskAccount']['findAll']({'raw':_0x4cef21[_0xe921('0x15')]?_0x4cef21[_0xe921('0x15')][_0xe921('0x16')]===undefined?!![]:![]:!![],'where':_0x4cef21[_0xe921('0x15')]?_0x4cef21['options'][_0xe921('0x17')]||null:null,'attributes':_0x4cef21[_0xe921('0x15')]?_0x4cef21['options'][_0xe921('0x18')]||null:null,'limit':_0x4cef21[_0xe921('0x15')]?_0x4cef21[_0xe921('0x15')][_0xe921('0x19')]||null:null,'include':_0x4cef21[_0xe921('0x15')]?_0x4cef21[_0xe921('0x15')][_0xe921('0x1a')]?_['map'](_0x4cef21[_0xe921('0x15')]['include'],function(_0x2b3554){return{'model':db[_0x2b3554[_0xe921('0x1b')]],'as':_0x2b3554['as'],'attributes':_0x2b3554['attributes'],'include':_0x2b3554[_0xe921('0x1a')]?_['map'](_0x2b3554['include'],function(_0x21f0c3){return{'model':db[_0x21f0c3[_0xe921('0x1b')]],'as':_0x21f0c3['as'],'attributes':_0x21f0c3[_0xe921('0x18')],'include':_0x21f0c3[_0xe921('0x1a')]?_[_0xe921('0x1c')](_0x21f0c3['include'],function(_0xe51bc1){return{'model':db[_0xe51bc1[_0xe921('0x1b')]],'as':_0xe51bc1['as'],'attributes':_0xe51bc1[_0xe921('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe921('0xb')](function(_0x331657){logger[_0xe921('0x12')](_0xe921('0x14'),_0x4cef21);logger['debug'](_0xe921('0x14'),_0x4cef21,JSON['stringify'](_0x331657));_0x4e0cd5(_0x331657);})[_0xe921('0x1d')](function(_0x5315dd){logger[_0xe921('0x10')]('GetFreshdeskAccount',_0x5315dd[_0xe921('0x11')],_0x4cef21);_0x59ccab(_0x2f095f[_0xe921('0x10')](0x1f4,_0x5315dd[_0xe921('0x11')]));});});};exports[_0xe921('0x1e')]=function(_0x5de56f){var _0x5f12ea=this;return new Promise(function(_0x32906d,_0x4f35fc){return db[_0xe921('0x1f')][_0xe921('0x20')]({'raw':_0x5de56f[_0xe921('0x15')]?_0x5de56f[_0xe921('0x15')][_0xe921('0x16')]===undefined?!![]:![]:!![],'where':_0x5de56f['options']?_0x5de56f[_0xe921('0x15')][_0xe921('0x17')]||null:null,'attributes':_0x5de56f[_0xe921('0x15')]?_0x5de56f['options'][_0xe921('0x18')]||null:null,'include':_0x5de56f[_0xe921('0x15')]?_0x5de56f[_0xe921('0x15')][_0xe921('0x1a')]?_[_0xe921('0x1c')](_0x5de56f['options'][_0xe921('0x1a')],function(_0x5c4a2d){return{'model':db[_0x5c4a2d[_0xe921('0x1b')]],'as':_0x5c4a2d['as'],'attributes':_0x5c4a2d[_0xe921('0x18')],'include':_0x5c4a2d['include']?_[_0xe921('0x1c')](_0x5c4a2d['include'],function(_0x396226){return{'model':db[_0x396226[_0xe921('0x1b')]],'as':_0x396226['as'],'attributes':_0x396226[_0xe921('0x18')],'include':_0x396226[_0xe921('0x1a')]?_[_0xe921('0x1c')](_0x396226['include'],function(_0x1fbda5){return{'model':db[_0x1fbda5[_0xe921('0x1b')]],'as':_0x1fbda5['as'],'attributes':_0x1fbda5[_0xe921('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe921('0xb')](function(_0x2a94d2){logger['info']('ShowFreshdeskAccount',_0x5de56f);logger[_0xe921('0xe')](_0xe921('0x1e'),_0x5de56f,JSON[_0xe921('0x21')](_0x2a94d2));_0x32906d(_0x2a94d2);})[_0xe921('0x1d')](function(_0x11ff71){logger[_0xe921('0x10')](_0xe921('0x1e'),_0x11ff71[_0xe921('0x11')],_0x5de56f);_0x4f35fc(_0x5f12ea[_0xe921('0x10')](0x1f4,_0x11ff71['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index bc0de0e..2a699c7 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 _0x994e=['put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','setTags'];(function(_0x4c86ae,_0x313d1b){var _0x2a6ac7=function(_0x1cadf3){while(--_0x1cadf3){_0x4c86ae['push'](_0x4c86ae['shift']());}};_0x2a6ac7(++_0x313d1b);}(_0x994e,0x109));var _0xe994=function(_0x2c5919,_0x204c87){_0x2c5919=_0x2c5919-0x0;var _0x35b831=_0x994e[_0x2c5919];return _0x35b831;};'use strict';var multer=require(_0xe994('0x0'));var util=require(_0xe994('0x1'));var path=require(_0xe994('0x2'));var timeout=require(_0xe994('0x3'));var express=require(_0xe994('0x4'));var router=express['Router']();var fs_extra=require(_0xe994('0x5'));var auth=require(_0xe994('0x6'));var interaction=require(_0xe994('0x7'));var config=require(_0xe994('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xe994('0x9')](),controller[_0xe994('0xa')]);router[_0xe994('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe994('0xc')]);router[_0xe994('0xb')](_0xe994('0xd'),auth[_0xe994('0x9')](),controller[_0xe994('0xe')]);router[_0xe994('0xb')](_0xe994('0xf'),auth[_0xe994('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xe994('0x9')](),controller[_0xe994('0x10')]);router['get'](_0xe994('0x11'),auth[_0xe994('0x9')](),controller[_0xe994('0x12')]);router[_0xe994('0x13')]('/',auth[_0xe994('0x9')](),controller['create']);router[_0xe994('0x13')](_0xe994('0x11'),auth[_0xe994('0x9')](),controller[_0xe994('0x14')]);router[_0xe994('0x15')]('/:id',auth[_0xe994('0x9')](),controller[_0xe994('0x16')]);router['delete'](_0xe994('0x17'),auth['isAuthenticated'](),controller[_0xe994('0x18')]);module[_0xe994('0x19')]=router; \ No newline at end of file +var _0xbefe=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','setTags','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x31759d,_0x3dde6a){var _0xdc1887=function(_0x28a59f){while(--_0x28a59f){_0x31759d['push'](_0x31759d['shift']());}};_0xdc1887(++_0x3dde6a);}(_0xbefe,0x168));var _0xebef=function(_0x32f776,_0x1bf7e6){_0x32f776=_0x32f776-0x0;var _0xa9f55=_0xbefe[_0x32f776];return _0xa9f55;};'use strict';var multer=require('multer');var util=require(_0xebef('0x0'));var path=require('path');var timeout=require(_0xebef('0x1'));var express=require(_0xebef('0x2'));var router=express[_0xebef('0x3')]();var fs_extra=require(_0xebef('0x4'));var auth=require(_0xebef('0x5'));var interaction=require(_0xebef('0x6'));var config=require(_0xebef('0x7'));var controller=require(_0xebef('0x8'));router['get']('/',auth[_0xebef('0x9')](),controller[_0xebef('0xa')]);router[_0xebef('0xb')]('/:id',auth[_0xebef('0x9')](),controller[_0xebef('0xc')]);router['get']('/:id/fields',auth[_0xebef('0x9')](),controller[_0xebef('0xd')]);router[_0xebef('0xb')](_0xebef('0xe'),auth[_0xebef('0x9')](),controller[_0xebef('0xf')]);router[_0xebef('0xb')](_0xebef('0x10'),auth['isAuthenticated'](),controller[_0xebef('0x11')]);router[_0xebef('0xb')](_0xebef('0x12'),auth[_0xebef('0x9')](),controller[_0xebef('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xebef('0x12'),auth[_0xebef('0x9')](),controller[_0xebef('0x14')]);router[_0xebef('0x15')](_0xebef('0x16'),auth[_0xebef('0x9')](),controller['update']);router[_0xebef('0x17')](_0xebef('0x16'),auth[_0xebef('0x9')](),controller[_0xebef('0x18')]);module[_0xebef('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 37a73da..c9340b2 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 _0x4513=['exports','STRING','sequelize'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0x4513,0x113));var _0x3451=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4513[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x3451('0x0'));module[_0x3451('0x1')]={'name':{'type':Sequelize[_0x3451('0x2')]},'description':{'type':Sequelize[_0x3451('0x2')]}}; \ No newline at end of file +var _0xd243=['exports','STRING'];(function(_0x4dd943,_0x5f379e){var _0x4e06ee=function(_0x2c1747){while(--_0x2c1747){_0x4dd943['push'](_0x4dd943['shift']());}};_0x4e06ee(++_0x5f379e);}(_0xd243,0xba));var _0x3d24=function(_0x4406ab,_0x106bbe){_0x4406ab=_0x4406ab-0x0;var _0x3b3296=_0xd243[_0x4406ab];return _0x3b3296;};'use strict';var Sequelize=require('sequelize');module[_0x3d24('0x0')]={'name':{'type':Sequelize[_0x3d24('0x1')]},'description':{'type':Sequelize[_0x3d24('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 86011d0..b069960 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 _0x5b92=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then'];(function(_0x385a4b,_0x22e1d7){var _0x3d9a7c=function(_0x7fef25){while(--_0x7fef25){_0x385a4b['push'](_0x385a4b['shift']());}};_0x3d9a7c(++_0x22e1d7);}(_0x5b92,0xa3));var _0x25b9=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x5b92[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0x25b9('0x0'));var emlformat=require(_0x25b9('0x1'));var rimraf=require(_0x25b9('0x2'));var zipdir=require(_0x25b9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b9('0x4'));var moment=require(_0x25b9('0x5'));var BPromise=require(_0x25b9('0x6'));var Mustache=require('mustache');var util=require(_0x25b9('0x7'));var path=require(_0x25b9('0x8'));var sox=require(_0x25b9('0x9'));var csv=require(_0x25b9('0xa'));var ejs=require(_0x25b9('0xb'));var fs=require('fs');var fs_extra=require(_0x25b9('0xc'));var _=require(_0x25b9('0xd'));var squel=require('squel');var crypto=require(_0x25b9('0xe'));var jsforce=require(_0x25b9('0xf'));var deskjs=require(_0x25b9('0x10'));var toCsv=require(_0x25b9('0xa'));var querystring=require(_0x25b9('0x11'));var Papa=require('papaparse');var Redis=require(_0x25b9('0x12'));var authService=require(_0x25b9('0x13'));var qs=require(_0x25b9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25b9('0x15'));var logger=require(_0x25b9('0x16'))('api');var utils=require(_0x25b9('0x17'));var config=require(_0x25b9('0x18'));var licenseUtil=require(_0x25b9('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x25b9('0x1a'));var client=jayson[_0x25b9('0x1b')][_0x25b9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x25ed42,_0x41dc11,_0x512960,_0x37a90b){return new BPromise(function(_0x1a6d08,_0xf4db2c){var _0x475311=_0x37a90b||client;return _0x475311[_0x25b9('0x1d')](_0x25ed42,_0x512960)[_0x25b9('0x1e')](function(_0x4164e3){logger[_0x25b9('0x1f')](_0x25b9('0x20'),_0x41dc11,_0x25b9('0x21'));logger[_0x25b9('0x22')](_0x25b9('0x23'),_0x41dc11,'request\x20sent',JSON['stringify'](_0x4164e3));if(_0x4164e3[_0x25b9('0x24')]){if(_0x4164e3[_0x25b9('0x24')]['code']===0x1f4){logger['error'](_0x25b9('0x20'),_0x41dc11,_0x4164e3[_0x25b9('0x24')]['message']);return _0xf4db2c(_0x4164e3['error'][_0x25b9('0x25')]);}logger['error'](_0x25b9('0x20'),_0x41dc11,_0x4164e3[_0x25b9('0x24')][_0x25b9('0x25')]);return _0x1a6d08(_0x4164e3[_0x25b9('0x24')][_0x25b9('0x25')]);}else{logger['info'](_0x25b9('0x20'),_0x41dc11,_0x25b9('0x21'));_0x1a6d08(_0x4164e3[_0x25b9('0x26')][_0x25b9('0x25')]);}})[_0x25b9('0x27')](function(_0x21b728){logger[_0x25b9('0x24')](_0x25b9('0x20'),_0x41dc11,_0x21b728);_0xf4db2c(_0x21b728);});});}function respondWithStatusCode(_0x4321cf,_0x3a53b9){_0x3a53b9=_0x3a53b9||0xcc;return function(_0x259586){if(_0x259586){return _0x4321cf[_0x25b9('0x28')](_0x3a53b9);}return _0x4321cf[_0x25b9('0x29')](_0x3a53b9)[_0x25b9('0x2a')]();};}function respondWithResult(_0x37a098,_0x27d57d){_0x27d57d=_0x27d57d||0xc8;return function(_0x106b62){if(_0x106b62){return _0x37a098[_0x25b9('0x29')](_0x27d57d)['json'](_0x106b62);}};}function respondWithFilteredResult(_0x4b09ac,_0x4be617){return function(_0x3ae461){if(_0x3ae461){var _0x1a00d0=_0x3ae461[_0x25b9('0x2b')],_0x35b56e=_0x4be617[_0x25b9('0x2c')],_0x5b4dde=_0x4be617[_0x25b9('0x2c')]+_0x4be617[_0x25b9('0x2d')],_0x5f1d0c;if(_0x5b4dde>=_0x1a00d0){_0x5b4dde=_0x1a00d0;_0x5f1d0c=0xc8;}else{_0x5f1d0c=0xce;}_0x4b09ac['status'](_0x5f1d0c);return _0x4b09ac[_0x25b9('0x2e')](_0x25b9('0x2f'),_0x35b56e+'-'+_0x5b4dde+'/'+_0x1a00d0)[_0x25b9('0x30')](_0x3ae461);}return null;};}function patchUpdates(_0xcc2527){return function(_0x14594a){try{jsonpatch[_0x25b9('0x31')](_0x14594a,_0xcc2527,!![]);}catch(_0x27cd98){return BPromise[_0x25b9('0x32')](_0x27cd98);}return _0x14594a['save']();};}function saveUpdates(_0x4ccbe6,_0x32ff1e){return function(_0x296a68){if(_0x296a68){return _0x296a68[_0x25b9('0x33')](_0x4ccbe6)[_0x25b9('0x1e')](function(_0x1ac413){return _0x1ac413;});}return null;};}function removeEntity(_0x37d05d,_0x568a94){return function(_0x5ffa2b){if(_0x5ffa2b){return _0x5ffa2b[_0x25b9('0x34')]()[_0x25b9('0x1e')](function(){_0x37d05d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57f181,_0x418e73){return function(_0x237267){if(!_0x237267){_0x57f181['sendStatus'](0x194);}return _0x237267;};}function handleError(_0x106faf,_0x3c979c){_0x3c979c=_0x3c979c||0x1f4;return function(_0x20448c){logger[_0x25b9('0x24')](_0x20448c[_0x25b9('0x35')]);if(_0x20448c[_0x25b9('0x36')]){delete _0x20448c[_0x25b9('0x36')];}_0x106faf[_0x25b9('0x29')](_0x3c979c)[_0x25b9('0x37')](_0x20448c);};}exports[_0x25b9('0x38')]=function(_0x524bfe,_0x4a458d){var _0x204a42={},_0x6d7408={},_0x46e388={'count':0x0,'rows':[]};var _0x113476=_[_0x25b9('0x39')](db[_0x25b9('0x3a')][_0x25b9('0x3b')],function(_0x5b39df){return{'name':_0x5b39df[_0x25b9('0x3c')],'type':_0x5b39df[_0x25b9('0x3d')]['key']};});_0x6d7408[_0x25b9('0x3e')]=_[_0x25b9('0x39')](_0x113476,_0x25b9('0x36'));_0x6d7408['query']=_[_0x25b9('0x3f')](_0x524bfe[_0x25b9('0x40')]);_0x6d7408[_0x25b9('0x41')]=_[_0x25b9('0x42')](_0x6d7408[_0x25b9('0x3e')],_0x6d7408['query']);_0x204a42[_0x25b9('0x43')]=_[_0x25b9('0x42')](_0x6d7408[_0x25b9('0x3e')],qs[_0x25b9('0x44')](_0x524bfe[_0x25b9('0x40')][_0x25b9('0x44')]));_0x204a42[_0x25b9('0x43')]=_0x204a42[_0x25b9('0x43')][_0x25b9('0x45')]?_0x204a42[_0x25b9('0x43')]:_0x6d7408[_0x25b9('0x3e')];if(!_0x524bfe[_0x25b9('0x40')][_0x25b9('0x46')](_0x25b9('0x47'))){_0x204a42[_0x25b9('0x2d')]=qs[_0x25b9('0x2d')](_0x524bfe[_0x25b9('0x40')][_0x25b9('0x2d')]);_0x204a42[_0x25b9('0x2c')]=qs[_0x25b9('0x2c')](_0x524bfe[_0x25b9('0x40')][_0x25b9('0x2c')]);}_0x204a42[_0x25b9('0x48')]=qs[_0x25b9('0x49')](_0x524bfe[_0x25b9('0x40')]['sort']);_0x204a42[_0x25b9('0x4a')]=qs['filters'](_[_0x25b9('0x4b')](_0x524bfe[_0x25b9('0x40')],_0x6d7408[_0x25b9('0x41')]),_0x113476);if(_0x524bfe[_0x25b9('0x40')][_0x25b9('0x4c')]){_0x204a42[_0x25b9('0x4a')]=_[_0x25b9('0x4d')](_0x204a42[_0x25b9('0x4a')],{'$or':_['map'](_0x113476,function(_0x2ee843){if(_0x2ee843[_0x25b9('0x3d')]!==_0x25b9('0x4e')){var _0x19daf5={};_0x19daf5[_0x2ee843['name']]={'$like':'%'+_0x524bfe[_0x25b9('0x40')][_0x25b9('0x4c')]+'%'};return _0x19daf5;}})});}_0x204a42=_['merge']({},_0x204a42,_0x524bfe[_0x25b9('0x4f')]);var _0x1af3ec={'where':_0x204a42[_0x25b9('0x4a')]};return db[_0x25b9('0x3a')][_0x25b9('0x2b')](_0x1af3ec)[_0x25b9('0x1e')](function(_0x4bc3e3){_0x46e388[_0x25b9('0x2b')]=_0x4bc3e3;if(_0x524bfe[_0x25b9('0x40')][_0x25b9('0x50')]){_0x204a42['include']=[{'all':!![]}];}return db[_0x25b9('0x3a')][_0x25b9('0x51')](_0x204a42);})['then'](function(_0x14d23c){_0x46e388[_0x25b9('0x52')]=_0x14d23c;return _0x46e388;})['then'](respondWithFilteredResult(_0x4a458d,_0x204a42))[_0x25b9('0x27')](handleError(_0x4a458d,null));};exports[_0x25b9('0x53')]=function(_0x627f48,_0x37e0e3){var _0x776895={'raw':![],'where':{'id':_0x627f48[_0x25b9('0x54')]['id']}},_0x2c8395={};_0x2c8395[_0x25b9('0x3e')]=_[_0x25b9('0x3f')](db[_0x25b9('0x3a')][_0x25b9('0x3b')]);_0x2c8395[_0x25b9('0x40')]=_[_0x25b9('0x3f')](_0x627f48[_0x25b9('0x40')]);_0x2c8395[_0x25b9('0x41')]=_[_0x25b9('0x42')](_0x2c8395['model'],_0x2c8395[_0x25b9('0x40')]);_0x776895[_0x25b9('0x43')]=_['intersection'](_0x2c8395[_0x25b9('0x3e')],qs[_0x25b9('0x44')](_0x627f48['query']['fields']));_0x776895['attributes']=_0x776895[_0x25b9('0x43')]['length']?_0x776895[_0x25b9('0x43')]:_0x2c8395['model'];if(_0x627f48[_0x25b9('0x40')]['includeAll']){_0x776895[_0x25b9('0x55')]=[{'all':!![]}];}_0x776895=_[_0x25b9('0x4d')]({},_0x776895,_0x627f48['options']);return db['FreshdeskConfiguration'][_0x25b9('0x56')](_0x776895)['then'](handleEntityNotFound(_0x37e0e3,null))[_0x25b9('0x1e')](respondWithResult(_0x37e0e3,null))[_0x25b9('0x27')](handleError(_0x37e0e3,null));};exports[_0x25b9('0x57')]=function(_0x18f02e,_0x4eedfa){return db[_0x25b9('0x3a')][_0x25b9('0x57')](_0x18f02e['body'],{})[_0x25b9('0x1e')](respondWithResult(_0x4eedfa,0xc9))[_0x25b9('0x27')](handleError(_0x4eedfa,null));};exports['update']=function(_0x3e0183,_0x2eec93){if(_0x3e0183[_0x25b9('0x58')]['id']){delete _0x3e0183[_0x25b9('0x58')]['id'];}return db[_0x25b9('0x3a')][_0x25b9('0x56')]({'where':{'id':_0x3e0183['params']['id']}})['then'](handleEntityNotFound(_0x2eec93,null))[_0x25b9('0x1e')](saveUpdates(_0x3e0183[_0x25b9('0x58')],null))['then'](respondWithResult(_0x2eec93,null))[_0x25b9('0x27')](handleError(_0x2eec93,null));};exports['destroy']=function(_0x58fb81,_0xbc4928){return db[_0x25b9('0x3a')][_0x25b9('0x56')]({'where':{'id':_0x58fb81[_0x25b9('0x54')]['id']}})['then'](handleEntityNotFound(_0xbc4928,null))[_0x25b9('0x1e')](removeEntity(_0xbc4928,null))[_0x25b9('0x27')](handleError(_0xbc4928,null));};exports[_0x25b9('0x59')]=function(_0x4c62d7,_0x1e580e,_0x5ee41c){var _0x2997c2={};var _0x105097={};var _0x5376a9;var _0x525f90;return db[_0x25b9('0x3a')][_0x25b9('0x5a')]({'where':{'id':_0x4c62d7[_0x25b9('0x54')]['id']}})[_0x25b9('0x1e')](handleEntityNotFound(_0x1e580e,null))['then'](function(_0x4ba0e1){if(_0x4ba0e1){_0x5376a9=_0x4ba0e1;_0x105097[_0x25b9('0x3e')]=_[_0x25b9('0x3f')](db[_0x25b9('0x5b')][_0x25b9('0x3b')]);_0x105097[_0x25b9('0x40')]=_[_0x25b9('0x3f')](_0x4c62d7['query']);_0x105097[_0x25b9('0x41')]=_[_0x25b9('0x42')](_0x105097[_0x25b9('0x3e')],_0x105097[_0x25b9('0x40')]);_0x2997c2[_0x25b9('0x43')]=_['intersection'](_0x105097[_0x25b9('0x3e')],qs['fields'](_0x4c62d7[_0x25b9('0x40')][_0x25b9('0x44')]));_0x2997c2[_0x25b9('0x43')]=_0x2997c2[_0x25b9('0x43')]['length']?_0x2997c2[_0x25b9('0x43')]:_0x105097['model'];_0x2997c2['order']=qs[_0x25b9('0x49')](_0x4c62d7[_0x25b9('0x40')]['sort']);_0x2997c2[_0x25b9('0x4a')]=qs[_0x25b9('0x41')](_[_0x25b9('0x4b')](_0x4c62d7[_0x25b9('0x40')],_0x105097[_0x25b9('0x41')]));if(_0x4c62d7[_0x25b9('0x40')]['filter']){_0x2997c2[_0x25b9('0x4a')]=_[_0x25b9('0x4d')](_0x2997c2[_0x25b9('0x4a')],{'$or':_[_0x25b9('0x39')](_0x2997c2[_0x25b9('0x43')],function(_0x2511e1){var _0x3ba7ad={};_0x3ba7ad[_0x2511e1]={'$like':'%'+_0x4c62d7[_0x25b9('0x40')][_0x25b9('0x4c')]+'%'};return _0x3ba7ad;})});}_0x2997c2=_[_0x25b9('0x4d')]({},_0x2997c2,_0x4c62d7['options']);return _0x5376a9[_0x25b9('0x59')](_0x2997c2);}})['then'](function(_0xa58b54){if(_0xa58b54){_0x525f90=_0xa58b54['length'];if(!_0x4c62d7[_0x25b9('0x40')][_0x25b9('0x46')](_0x25b9('0x47'))){_0x2997c2[_0x25b9('0x2d')]=qs[_0x25b9('0x2d')](_0x4c62d7[_0x25b9('0x40')][_0x25b9('0x2d')]);_0x2997c2['offset']=qs[_0x25b9('0x2c')](_0x4c62d7[_0x25b9('0x40')][_0x25b9('0x2c')]);}return _0x5376a9[_0x25b9('0x59')](_0x2997c2);}})[_0x25b9('0x1e')](function(_0x8a7483){if(_0x8a7483){return _0x8a7483?{'count':_0x525f90,'rows':_0x8a7483}:null;}})[_0x25b9('0x1e')](respondWithResult(_0x1e580e,null))[_0x25b9('0x27')](handleError(_0x1e580e,null));};exports[_0x25b9('0x5c')]=function(_0x28e6cc,_0x57bbcb,_0x2179bc){var _0x5ec42e={};var _0x1d21bc={};var _0x382fd7;var _0x7468df;return db[_0x25b9('0x3a')]['findOne']({'where':{'id':_0x28e6cc[_0x25b9('0x54')]['id']}})[_0x25b9('0x1e')](handleEntityNotFound(_0x57bbcb,null))[_0x25b9('0x1e')](function(_0x15ad89){if(_0x15ad89){_0x382fd7=_0x15ad89;_0x1d21bc['model']=_[_0x25b9('0x3f')](db[_0x25b9('0x5b')][_0x25b9('0x3b')]);_0x1d21bc[_0x25b9('0x40')]=_[_0x25b9('0x3f')](_0x28e6cc[_0x25b9('0x40')]);_0x1d21bc[_0x25b9('0x41')]=_[_0x25b9('0x42')](_0x1d21bc['model'],_0x1d21bc[_0x25b9('0x40')]);_0x5ec42e['attributes']=_[_0x25b9('0x42')](_0x1d21bc[_0x25b9('0x3e')],qs['fields'](_0x28e6cc['query'][_0x25b9('0x44')]));_0x5ec42e['attributes']=_0x5ec42e['attributes'][_0x25b9('0x45')]?_0x5ec42e['attributes']:_0x1d21bc[_0x25b9('0x3e')];_0x5ec42e[_0x25b9('0x48')]=qs[_0x25b9('0x49')](_0x28e6cc[_0x25b9('0x40')][_0x25b9('0x49')]);_0x5ec42e[_0x25b9('0x4a')]=qs[_0x25b9('0x41')](_[_0x25b9('0x4b')](_0x28e6cc[_0x25b9('0x40')],_0x1d21bc['filters']));if(_0x28e6cc['query'][_0x25b9('0x4c')]){_0x5ec42e[_0x25b9('0x4a')]=_[_0x25b9('0x4d')](_0x5ec42e['where'],{'$or':_['map'](_0x5ec42e[_0x25b9('0x43')],function(_0x4d01e1){var _0x3ede83={};_0x3ede83[_0x4d01e1]={'$like':'%'+_0x28e6cc['query'][_0x25b9('0x4c')]+'%'};return _0x3ede83;})});}_0x5ec42e=_[_0x25b9('0x4d')]({},_0x5ec42e,_0x28e6cc[_0x25b9('0x4f')]);return _0x382fd7[_0x25b9('0x5c')](_0x5ec42e);}})[_0x25b9('0x1e')](function(_0x196382){if(_0x196382){_0x7468df=_0x196382[_0x25b9('0x45')];if(!_0x28e6cc[_0x25b9('0x40')][_0x25b9('0x46')](_0x25b9('0x47'))){_0x5ec42e[_0x25b9('0x2d')]=qs[_0x25b9('0x2d')](_0x28e6cc['query'][_0x25b9('0x2d')]);_0x5ec42e[_0x25b9('0x2c')]=qs['offset'](_0x28e6cc['query'][_0x25b9('0x2c')]);}return _0x382fd7[_0x25b9('0x5c')](_0x5ec42e);}})[_0x25b9('0x1e')](function(_0x269f9e){if(_0x269f9e){return _0x269f9e?{'count':_0x7468df,'rows':_0x269f9e}:null;}})['then'](respondWithResult(_0x57bbcb,null))[_0x25b9('0x27')](handleError(_0x57bbcb,null));};exports[_0x25b9('0x5d')]=function(_0xfb422d,_0x5c4cd5,_0x352260){var _0x29a66a={};var _0x30751f={};var _0x1a72e5;var _0x589de1;return db[_0x25b9('0x3a')]['findOne']({'where':{'id':_0xfb422d[_0x25b9('0x54')]['id']}})[_0x25b9('0x1e')](handleEntityNotFound(_0x5c4cd5,null))[_0x25b9('0x1e')](function(_0x2c6fdb){if(_0x2c6fdb){_0x1a72e5=_0x2c6fdb;_0x30751f[_0x25b9('0x3e')]=_['keys'](db['FreshdeskField'][_0x25b9('0x3b')]);_0x30751f['query']=_[_0x25b9('0x3f')](_0xfb422d[_0x25b9('0x40')]);_0x30751f[_0x25b9('0x41')]=_['intersection'](_0x30751f['model'],_0x30751f[_0x25b9('0x40')]);_0x29a66a[_0x25b9('0x43')]=_[_0x25b9('0x42')](_0x30751f[_0x25b9('0x3e')],qs[_0x25b9('0x44')](_0xfb422d[_0x25b9('0x40')]['fields']));_0x29a66a[_0x25b9('0x43')]=_0x29a66a[_0x25b9('0x43')]['length']?_0x29a66a[_0x25b9('0x43')]:_0x30751f[_0x25b9('0x3e')];_0x29a66a[_0x25b9('0x48')]=qs[_0x25b9('0x49')](_0xfb422d['query'][_0x25b9('0x49')]);_0x29a66a['where']=qs[_0x25b9('0x41')](_['pick'](_0xfb422d['query'],_0x30751f[_0x25b9('0x41')]));if(_0xfb422d[_0x25b9('0x40')][_0x25b9('0x4c')]){_0x29a66a['where']=_['merge'](_0x29a66a[_0x25b9('0x4a')],{'$or':_[_0x25b9('0x39')](_0x29a66a[_0x25b9('0x43')],function(_0x1b5368){var _0x190f47={};_0x190f47[_0x1b5368]={'$like':'%'+_0xfb422d['query'][_0x25b9('0x4c')]+'%'};return _0x190f47;})});}_0x29a66a=_[_0x25b9('0x4d')]({},_0x29a66a,_0xfb422d[_0x25b9('0x4f')]);return _0x1a72e5[_0x25b9('0x5d')](_0x29a66a);}})[_0x25b9('0x1e')](function(_0xf0bfc7){if(_0xf0bfc7){_0x589de1=_0xf0bfc7[_0x25b9('0x45')];if(!_0xfb422d['query'][_0x25b9('0x46')](_0x25b9('0x47'))){_0x29a66a[_0x25b9('0x2d')]=qs[_0x25b9('0x2d')](_0xfb422d[_0x25b9('0x40')][_0x25b9('0x2d')]);_0x29a66a['offset']=qs[_0x25b9('0x2c')](_0xfb422d['query'][_0x25b9('0x2c')]);}return _0x1a72e5[_0x25b9('0x5d')](_0x29a66a);}})['then'](function(_0x2fc580){if(_0x2fc580){return _0x2fc580?{'count':_0x589de1,'rows':_0x2fc580}:null;}})[_0x25b9('0x1e')](respondWithResult(_0x5c4cd5,null))[_0x25b9('0x27')](handleError(_0x5c4cd5,null));};exports[_0x25b9('0x5e')]=function(_0x3f351b,_0x1a6613,_0x3970fd){var _0x340db1={};var _0x5d9dfa={};var _0x9658e;var _0x2d9c63;return db[_0x25b9('0x3a')]['findOne']({'where':{'id':_0x3f351b[_0x25b9('0x54')]['id']}})[_0x25b9('0x1e')](handleEntityNotFound(_0x1a6613,null))[_0x25b9('0x1e')](function(_0x58cf78){if(_0x58cf78){_0x9658e=_0x58cf78;_0x5d9dfa[_0x25b9('0x3e')]=_['keys'](db[_0x25b9('0x5f')][_0x25b9('0x3b')]);_0x5d9dfa[_0x25b9('0x40')]=_['keys'](_0x3f351b[_0x25b9('0x40')]);_0x5d9dfa['filters']=_[_0x25b9('0x42')](_0x5d9dfa[_0x25b9('0x3e')],_0x5d9dfa[_0x25b9('0x40')]);_0x340db1[_0x25b9('0x43')]=_[_0x25b9('0x42')](_0x5d9dfa[_0x25b9('0x3e')],qs[_0x25b9('0x44')](_0x3f351b[_0x25b9('0x40')][_0x25b9('0x44')]));_0x340db1['attributes']=_0x340db1['attributes']['length']?_0x340db1[_0x25b9('0x43')]:_0x5d9dfa[_0x25b9('0x3e')];_0x340db1[_0x25b9('0x48')]=qs[_0x25b9('0x49')](_0x3f351b['query'][_0x25b9('0x49')]);_0x340db1[_0x25b9('0x4a')]=qs[_0x25b9('0x41')](_[_0x25b9('0x4b')](_0x3f351b[_0x25b9('0x40')],_0x5d9dfa[_0x25b9('0x41')]));if(_0x3f351b[_0x25b9('0x40')]['filter']){_0x340db1['where']=_[_0x25b9('0x4d')](_0x340db1[_0x25b9('0x4a')],{'$or':_[_0x25b9('0x39')](_0x340db1[_0x25b9('0x43')],function(_0x4dec91){var _0x373cbd={};_0x373cbd[_0x4dec91]={'$like':'%'+_0x3f351b['query'][_0x25b9('0x4c')]+'%'};return _0x373cbd;})});}_0x340db1=_[_0x25b9('0x4d')]({},_0x340db1,_0x3f351b['options']);return _0x9658e[_0x25b9('0x5e')](_0x340db1);}})['then'](function(_0x4733f6){if(_0x4733f6){_0x2d9c63=_0x4733f6[_0x25b9('0x45')];if(!_0x3f351b['query'][_0x25b9('0x46')](_0x25b9('0x47'))){_0x340db1['limit']=qs['limit'](_0x3f351b[_0x25b9('0x40')]['limit']);_0x340db1[_0x25b9('0x2c')]=qs[_0x25b9('0x2c')](_0x3f351b['query'][_0x25b9('0x2c')]);}return _0x9658e['getTags'](_0x340db1);}})[_0x25b9('0x1e')](function(_0x14ecf5){if(_0x14ecf5){return _0x14ecf5?{'count':_0x2d9c63,'rows':_0x14ecf5}:null;}})[_0x25b9('0x1e')](respondWithResult(_0x1a6613,null))['catch'](handleError(_0x1a6613,null));};exports[_0x25b9('0x60')]=function(_0x1af877,_0x53e81d,_0x16bceb){if(_0x1af877['body']['id']){delete _0x1af877['body']['id'];}return db[_0x25b9('0x3a')][_0x25b9('0x5a')]({'where':{'id':_0x1af877[_0x25b9('0x54')]['id']}})[_0x25b9('0x1e')](handleEntityNotFound(_0x53e81d,null))[_0x25b9('0x1e')](function(_0x340e69){if(_0x340e69){return _0x340e69[_0x25b9('0x60')](_0x1af877[_0x25b9('0x58')]['ids']||[]);}return null;})[_0x25b9('0x1e')](respondWithResult(_0x53e81d,null))[_0x25b9('0x27')](handleError(_0x53e81d,null));}; \ No newline at end of file +var _0x14c3=['create','body','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','filters','pick','merge','filter','options','where','count','includeAll','include','findAll','rows','show','params','find'];(function(_0x33e38d,_0x52b6a2){var _0x2bf03b=function(_0x373b03){while(--_0x373b03){_0x33e38d['push'](_0x33e38d['shift']());}};_0x2bf03b(++_0x52b6a2);}(_0x14c3,0x6c));var _0x314c=function(_0x28911,_0xadd4cf){_0x28911=_0x28911-0x0;var _0x1b5ffc=_0x14c3[_0x28911];return _0x1b5ffc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x314c('0x0'));var rimraf=require(_0x314c('0x1'));var zipdir=require(_0x314c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x314c('0x3'));var moment=require(_0x314c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x314c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x314c('0x6'));var csv=require('to-csv');var ejs=require(_0x314c('0x7'));var fs=require('fs');var fs_extra=require(_0x314c('0x8'));var _=require(_0x314c('0x9'));var squel=require(_0x314c('0xa'));var crypto=require(_0x314c('0xb'));var jsforce=require(_0x314c('0xc'));var deskjs=require(_0x314c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x314c('0xe'));var Papa=require(_0x314c('0xf'));var Redis=require(_0x314c('0x10'));var authService=require(_0x314c('0x11'));var qs=require(_0x314c('0x12'));var as=require(_0x314c('0x13'));var hardwareService=require(_0x314c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x314c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x314c('0x16'));var db=require(_0x314c('0x17'))['db'];var jayson=require(_0x314c('0x18'));var client=jayson[_0x314c('0x19')][_0x314c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x21706a,_0x22c368,_0x8a3764,_0x345196){return new BPromise(function(_0x4e5c9c,_0x528580){var _0xfcf1fc=_0x345196||client;return _0xfcf1fc[_0x314c('0x1b')](_0x21706a,_0x8a3764)['then'](function(_0x390422){logger[_0x314c('0x1c')](_0x314c('0x1d'),_0x22c368,'request\x20sent');logger['debug'](_0x314c('0x1e'),_0x22c368,_0x314c('0x1f'),JSON[_0x314c('0x20')](_0x390422));if(_0x390422['error']){if(_0x390422[_0x314c('0x21')][_0x314c('0x22')]===0x1f4){logger[_0x314c('0x21')](_0x314c('0x1d'),_0x22c368,_0x390422[_0x314c('0x21')][_0x314c('0x23')]);return _0x528580(_0x390422[_0x314c('0x21')][_0x314c('0x23')]);}logger[_0x314c('0x21')](_0x314c('0x1d'),_0x22c368,_0x390422[_0x314c('0x21')][_0x314c('0x23')]);return _0x4e5c9c(_0x390422[_0x314c('0x21')]['message']);}else{logger[_0x314c('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x22c368,_0x314c('0x1f'));_0x4e5c9c(_0x390422[_0x314c('0x24')][_0x314c('0x23')]);}})[_0x314c('0x25')](function(_0x5c4ecb){logger[_0x314c('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x22c368,_0x5c4ecb);_0x528580(_0x5c4ecb);});});}function respondWithStatusCode(_0x494078,_0x33b054){_0x33b054=_0x33b054||0xcc;return function(_0x77159c){if(_0x77159c){return _0x494078[_0x314c('0x26')](_0x33b054);}return _0x494078[_0x314c('0x27')](_0x33b054)[_0x314c('0x28')]();};}function respondWithResult(_0x322ec0,_0x57d12c){_0x57d12c=_0x57d12c||0xc8;return function(_0x1933bd){if(_0x1933bd){return _0x322ec0['status'](_0x57d12c)[_0x314c('0x29')](_0x1933bd);}};}function respondWithFilteredResult(_0x380a5c,_0x146d30){return function(_0xc0a2ab){if(_0xc0a2ab){var _0x2982ea=_0xc0a2ab['count'],_0x9d24fa=_0x146d30['offset'],_0x1ce73d=_0x146d30['offset']+_0x146d30['limit'],_0x4acd3b;if(_0x1ce73d>=_0x2982ea){_0x1ce73d=_0x2982ea;_0x4acd3b=0xc8;}else{_0x4acd3b=0xce;}_0x380a5c[_0x314c('0x27')](_0x4acd3b);return _0x380a5c['set'](_0x314c('0x2a'),_0x9d24fa+'-'+_0x1ce73d+'/'+_0x2982ea)['json'](_0xc0a2ab);}return null;};}function patchUpdates(_0x162819){return function(_0x42313f){try{jsonpatch[_0x314c('0x2b')](_0x42313f,_0x162819,!![]);}catch(_0x33a964){return BPromise[_0x314c('0x2c')](_0x33a964);}return _0x42313f[_0x314c('0x2d')]();};}function saveUpdates(_0x1dfa04,_0x1bf045){return function(_0x4cf0e1){if(_0x4cf0e1){return _0x4cf0e1[_0x314c('0x2e')](_0x1dfa04)['then'](function(_0x33056e){return _0x33056e;});}return null;};}function removeEntity(_0x1c989b,_0xc92bf){return function(_0x15ceec){if(_0x15ceec){return _0x15ceec[_0x314c('0x2f')]()[_0x314c('0x30')](function(){_0x1c989b[_0x314c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e9cf,_0x2bd585){return function(_0xdd87d4){if(!_0xdd87d4){_0x13e9cf[_0x314c('0x26')](0x194);}return _0xdd87d4;};}function handleError(_0x14e62b,_0x4dea23){_0x4dea23=_0x4dea23||0x1f4;return function(_0xd1d559){logger['error'](_0xd1d559[_0x314c('0x31')]);if(_0xd1d559['name']){delete _0xd1d559[_0x314c('0x32')];}_0x14e62b[_0x314c('0x27')](_0x4dea23)[_0x314c('0x33')](_0xd1d559);};}exports[_0x314c('0x34')]=function(_0x1690db,_0x1c4804){var _0x1d32b9={},_0x39310d={},_0x4f5f67={'count':0x0,'rows':[]};var _0xf3b80f=_['map'](db[_0x314c('0x35')][_0x314c('0x36')],function(_0x4185fa){return{'name':_0x4185fa['fieldName'],'type':_0x4185fa[_0x314c('0x37')][_0x314c('0x38')]};});_0x39310d['model']=_[_0x314c('0x39')](_0xf3b80f,'name');_0x39310d[_0x314c('0x3a')]=_[_0x314c('0x3b')](_0x1690db[_0x314c('0x3a')]);_0x39310d['filters']=_[_0x314c('0x3c')](_0x39310d[_0x314c('0x3d')],_0x39310d['query']);_0x1d32b9[_0x314c('0x3e')]=_[_0x314c('0x3c')](_0x39310d[_0x314c('0x3d')],qs[_0x314c('0x3f')](_0x1690db[_0x314c('0x3a')][_0x314c('0x3f')]));_0x1d32b9[_0x314c('0x3e')]=_0x1d32b9[_0x314c('0x3e')][_0x314c('0x40')]?_0x1d32b9['attributes']:_0x39310d[_0x314c('0x3d')];if(!_0x1690db[_0x314c('0x3a')][_0x314c('0x41')](_0x314c('0x42'))){_0x1d32b9['limit']=qs[_0x314c('0x43')](_0x1690db[_0x314c('0x3a')][_0x314c('0x43')]);_0x1d32b9[_0x314c('0x44')]=qs[_0x314c('0x44')](_0x1690db['query'][_0x314c('0x44')]);}_0x1d32b9['order']=qs[_0x314c('0x45')](_0x1690db['query'][_0x314c('0x45')]);_0x1d32b9['where']=qs[_0x314c('0x46')](_[_0x314c('0x47')](_0x1690db['query'],_0x39310d[_0x314c('0x46')]),_0xf3b80f);if(_0x1690db[_0x314c('0x3a')]['filter']){_0x1d32b9['where']=_[_0x314c('0x48')](_0x1d32b9['where'],{'$or':_[_0x314c('0x39')](_0xf3b80f,function(_0x4ffd9c){if(_0x4ffd9c[_0x314c('0x37')]!=='VIRTUAL'){var _0x50a0b0={};_0x50a0b0[_0x4ffd9c[_0x314c('0x32')]]={'$like':'%'+_0x1690db['query'][_0x314c('0x49')]+'%'};return _0x50a0b0;}})});}_0x1d32b9=_[_0x314c('0x48')]({},_0x1d32b9,_0x1690db[_0x314c('0x4a')]);var _0x56c999={'where':_0x1d32b9[_0x314c('0x4b')]};return db[_0x314c('0x35')][_0x314c('0x4c')](_0x56c999)['then'](function(_0x1c4c50){_0x4f5f67['count']=_0x1c4c50;if(_0x1690db[_0x314c('0x3a')][_0x314c('0x4d')]){_0x1d32b9[_0x314c('0x4e')]=[{'all':!![]}];}return db[_0x314c('0x35')][_0x314c('0x4f')](_0x1d32b9);})['then'](function(_0x1cf892){_0x4f5f67[_0x314c('0x50')]=_0x1cf892;return _0x4f5f67;})[_0x314c('0x30')](respondWithFilteredResult(_0x1c4804,_0x1d32b9))['catch'](handleError(_0x1c4804,null));};exports[_0x314c('0x51')]=function(_0x15d9ba,_0x51ff54){var _0x472d06={'raw':![],'where':{'id':_0x15d9ba[_0x314c('0x52')]['id']}},_0x2d5c62={};_0x2d5c62['model']=_[_0x314c('0x3b')](db[_0x314c('0x35')][_0x314c('0x36')]);_0x2d5c62[_0x314c('0x3a')]=_[_0x314c('0x3b')](_0x15d9ba[_0x314c('0x3a')]);_0x2d5c62[_0x314c('0x46')]=_[_0x314c('0x3c')](_0x2d5c62['model'],_0x2d5c62[_0x314c('0x3a')]);_0x472d06[_0x314c('0x3e')]=_[_0x314c('0x3c')](_0x2d5c62[_0x314c('0x3d')],qs[_0x314c('0x3f')](_0x15d9ba[_0x314c('0x3a')]['fields']));_0x472d06[_0x314c('0x3e')]=_0x472d06[_0x314c('0x3e')][_0x314c('0x40')]?_0x472d06[_0x314c('0x3e')]:_0x2d5c62[_0x314c('0x3d')];if(_0x15d9ba[_0x314c('0x3a')][_0x314c('0x4d')]){_0x472d06[_0x314c('0x4e')]=[{'all':!![]}];}_0x472d06=_[_0x314c('0x48')]({},_0x472d06,_0x15d9ba[_0x314c('0x4a')]);return db[_0x314c('0x35')][_0x314c('0x53')](_0x472d06)[_0x314c('0x30')](handleEntityNotFound(_0x51ff54,null))[_0x314c('0x30')](respondWithResult(_0x51ff54,null))[_0x314c('0x25')](handleError(_0x51ff54,null));};exports[_0x314c('0x54')]=function(_0x1b812f,_0x20f202){return db[_0x314c('0x35')][_0x314c('0x54')](_0x1b812f[_0x314c('0x55')],{})[_0x314c('0x30')](respondWithResult(_0x20f202,0xc9))[_0x314c('0x25')](handleError(_0x20f202,null));};exports[_0x314c('0x2e')]=function(_0x156534,_0x48b694){if(_0x156534[_0x314c('0x55')]['id']){delete _0x156534['body']['id'];}return db[_0x314c('0x35')][_0x314c('0x53')]({'where':{'id':_0x156534[_0x314c('0x52')]['id']}})[_0x314c('0x30')](handleEntityNotFound(_0x48b694,null))[_0x314c('0x30')](saveUpdates(_0x156534[_0x314c('0x55')],null))['then'](respondWithResult(_0x48b694,null))[_0x314c('0x25')](handleError(_0x48b694,null));};exports[_0x314c('0x2f')]=function(_0x1cc325,_0x411e0f){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1cc325['params']['id']}})[_0x314c('0x30')](handleEntityNotFound(_0x411e0f,null))[_0x314c('0x30')](removeEntity(_0x411e0f,null))[_0x314c('0x25')](handleError(_0x411e0f,null));};exports[_0x314c('0x56')]=function(_0x56225d,_0x4748c3,_0x1f6b2b){var _0x53a0cf={};var _0x3f4ce9={};var _0x36e434;var _0x355189;return db['FreshdeskConfiguration'][_0x314c('0x57')]({'where':{'id':_0x56225d[_0x314c('0x52')]['id']}})[_0x314c('0x30')](handleEntityNotFound(_0x4748c3,null))[_0x314c('0x30')](function(_0x22c43d){if(_0x22c43d){_0x36e434=_0x22c43d;_0x3f4ce9['model']=_[_0x314c('0x3b')](db[_0x314c('0x58')][_0x314c('0x36')]);_0x3f4ce9[_0x314c('0x3a')]=_[_0x314c('0x3b')](_0x56225d['query']);_0x3f4ce9[_0x314c('0x46')]=_[_0x314c('0x3c')](_0x3f4ce9[_0x314c('0x3d')],_0x3f4ce9['query']);_0x53a0cf[_0x314c('0x3e')]=_[_0x314c('0x3c')](_0x3f4ce9[_0x314c('0x3d')],qs[_0x314c('0x3f')](_0x56225d['query'][_0x314c('0x3f')]));_0x53a0cf[_0x314c('0x3e')]=_0x53a0cf[_0x314c('0x3e')][_0x314c('0x40')]?_0x53a0cf['attributes']:_0x3f4ce9[_0x314c('0x3d')];_0x53a0cf[_0x314c('0x59')]=qs[_0x314c('0x45')](_0x56225d['query'][_0x314c('0x45')]);_0x53a0cf[_0x314c('0x4b')]=qs['filters'](_['pick'](_0x56225d['query'],_0x3f4ce9[_0x314c('0x46')]));if(_0x56225d['query'][_0x314c('0x49')]){_0x53a0cf[_0x314c('0x4b')]=_['merge'](_0x53a0cf[_0x314c('0x4b')],{'$or':_[_0x314c('0x39')](_0x53a0cf['attributes'],function(_0x56854b){var _0xe311e4={};_0xe311e4[_0x56854b]={'$like':'%'+_0x56225d[_0x314c('0x3a')][_0x314c('0x49')]+'%'};return _0xe311e4;})});}_0x53a0cf=_['merge']({},_0x53a0cf,_0x56225d[_0x314c('0x4a')]);return _0x36e434[_0x314c('0x56')](_0x53a0cf);}})[_0x314c('0x30')](function(_0x10fc16){if(_0x10fc16){_0x355189=_0x10fc16[_0x314c('0x40')];if(!_0x56225d[_0x314c('0x3a')][_0x314c('0x41')](_0x314c('0x42'))){_0x53a0cf['limit']=qs[_0x314c('0x43')](_0x56225d['query'][_0x314c('0x43')]);_0x53a0cf[_0x314c('0x44')]=qs[_0x314c('0x44')](_0x56225d['query'][_0x314c('0x44')]);}return _0x36e434[_0x314c('0x56')](_0x53a0cf);}})[_0x314c('0x30')](function(_0x27e6b7){if(_0x27e6b7){return _0x27e6b7?{'count':_0x355189,'rows':_0x27e6b7}:null;}})[_0x314c('0x30')](respondWithResult(_0x4748c3,null))[_0x314c('0x25')](handleError(_0x4748c3,null));};exports[_0x314c('0x5a')]=function(_0x155192,_0x6092b2,_0xbc857a){var _0x4f6fc3={};var _0x351dce={};var _0x392c0d;var _0x20ec2a;return db[_0x314c('0x35')][_0x314c('0x57')]({'where':{'id':_0x155192[_0x314c('0x52')]['id']}})[_0x314c('0x30')](handleEntityNotFound(_0x6092b2,null))[_0x314c('0x30')](function(_0x5827b2){if(_0x5827b2){_0x392c0d=_0x5827b2;_0x351dce['model']=_[_0x314c('0x3b')](db['FreshdeskField'][_0x314c('0x36')]);_0x351dce[_0x314c('0x3a')]=_[_0x314c('0x3b')](_0x155192[_0x314c('0x3a')]);_0x351dce[_0x314c('0x46')]=_['intersection'](_0x351dce[_0x314c('0x3d')],_0x351dce['query']);_0x4f6fc3[_0x314c('0x3e')]=_[_0x314c('0x3c')](_0x351dce['model'],qs[_0x314c('0x3f')](_0x155192['query'][_0x314c('0x3f')]));_0x4f6fc3[_0x314c('0x3e')]=_0x4f6fc3['attributes'][_0x314c('0x40')]?_0x4f6fc3[_0x314c('0x3e')]:_0x351dce['model'];_0x4f6fc3[_0x314c('0x59')]=qs['sort'](_0x155192[_0x314c('0x3a')][_0x314c('0x45')]);_0x4f6fc3[_0x314c('0x4b')]=qs[_0x314c('0x46')](_[_0x314c('0x47')](_0x155192[_0x314c('0x3a')],_0x351dce[_0x314c('0x46')]));if(_0x155192[_0x314c('0x3a')][_0x314c('0x49')]){_0x4f6fc3[_0x314c('0x4b')]=_[_0x314c('0x48')](_0x4f6fc3[_0x314c('0x4b')],{'$or':_['map'](_0x4f6fc3['attributes'],function(_0x3cc505){var _0x26934f={};_0x26934f[_0x3cc505]={'$like':'%'+_0x155192[_0x314c('0x3a')][_0x314c('0x49')]+'%'};return _0x26934f;})});}_0x4f6fc3=_[_0x314c('0x48')]({},_0x4f6fc3,_0x155192[_0x314c('0x4a')]);return _0x392c0d['getSubjects'](_0x4f6fc3);}})[_0x314c('0x30')](function(_0x2f0212){if(_0x2f0212){_0x20ec2a=_0x2f0212[_0x314c('0x40')];if(!_0x155192[_0x314c('0x3a')]['hasOwnProperty'](_0x314c('0x42'))){_0x4f6fc3[_0x314c('0x43')]=qs['limit'](_0x155192[_0x314c('0x3a')][_0x314c('0x43')]);_0x4f6fc3[_0x314c('0x44')]=qs[_0x314c('0x44')](_0x155192['query'][_0x314c('0x44')]);}return _0x392c0d[_0x314c('0x5a')](_0x4f6fc3);}})[_0x314c('0x30')](function(_0x99deeb){if(_0x99deeb){return _0x99deeb?{'count':_0x20ec2a,'rows':_0x99deeb}:null;}})['then'](respondWithResult(_0x6092b2,null))[_0x314c('0x25')](handleError(_0x6092b2,null));};exports[_0x314c('0x5b')]=function(_0x117d16,_0x2ac37c,_0x496d5d){var _0x565504={};var _0x1eaa98={};var _0x186275;var _0x405d3;return db[_0x314c('0x35')][_0x314c('0x57')]({'where':{'id':_0x117d16[_0x314c('0x52')]['id']}})[_0x314c('0x30')](handleEntityNotFound(_0x2ac37c,null))[_0x314c('0x30')](function(_0x4dffab){if(_0x4dffab){_0x186275=_0x4dffab;_0x1eaa98['model']=_[_0x314c('0x3b')](db[_0x314c('0x58')][_0x314c('0x36')]);_0x1eaa98[_0x314c('0x3a')]=_[_0x314c('0x3b')](_0x117d16[_0x314c('0x3a')]);_0x1eaa98[_0x314c('0x46')]=_[_0x314c('0x3c')](_0x1eaa98[_0x314c('0x3d')],_0x1eaa98[_0x314c('0x3a')]);_0x565504[_0x314c('0x3e')]=_['intersection'](_0x1eaa98[_0x314c('0x3d')],qs[_0x314c('0x3f')](_0x117d16[_0x314c('0x3a')][_0x314c('0x3f')]));_0x565504[_0x314c('0x3e')]=_0x565504[_0x314c('0x3e')][_0x314c('0x40')]?_0x565504[_0x314c('0x3e')]:_0x1eaa98['model'];_0x565504[_0x314c('0x59')]=qs[_0x314c('0x45')](_0x117d16[_0x314c('0x3a')][_0x314c('0x45')]);_0x565504[_0x314c('0x4b')]=qs[_0x314c('0x46')](_[_0x314c('0x47')](_0x117d16[_0x314c('0x3a')],_0x1eaa98[_0x314c('0x46')]));if(_0x117d16['query'][_0x314c('0x49')]){_0x565504[_0x314c('0x4b')]=_['merge'](_0x565504[_0x314c('0x4b')],{'$or':_[_0x314c('0x39')](_0x565504[_0x314c('0x3e')],function(_0xab0256){var _0x79730b={};_0x79730b[_0xab0256]={'$like':'%'+_0x117d16[_0x314c('0x3a')][_0x314c('0x49')]+'%'};return _0x79730b;})});}_0x565504=_[_0x314c('0x48')]({},_0x565504,_0x117d16[_0x314c('0x4a')]);return _0x186275[_0x314c('0x5b')](_0x565504);}})['then'](function(_0x453b34){if(_0x453b34){_0x405d3=_0x453b34[_0x314c('0x40')];if(!_0x117d16[_0x314c('0x3a')]['hasOwnProperty'](_0x314c('0x42'))){_0x565504['limit']=qs[_0x314c('0x43')](_0x117d16['query'][_0x314c('0x43')]);_0x565504['offset']=qs['offset'](_0x117d16[_0x314c('0x3a')][_0x314c('0x44')]);}return _0x186275[_0x314c('0x5b')](_0x565504);}})[_0x314c('0x30')](function(_0x2c2900){if(_0x2c2900){return _0x2c2900?{'count':_0x405d3,'rows':_0x2c2900}:null;}})['then'](respondWithResult(_0x2ac37c,null))[_0x314c('0x25')](handleError(_0x2ac37c,null));};exports[_0x314c('0x5c')]=function(_0x24ea98,_0x978c5b,_0x41f6d5){var _0x50b297={};var _0x56be93={};var _0x4ffdf2;var _0x3e338e;return db['FreshdeskConfiguration'][_0x314c('0x57')]({'where':{'id':_0x24ea98[_0x314c('0x52')]['id']}})[_0x314c('0x30')](handleEntityNotFound(_0x978c5b,null))[_0x314c('0x30')](function(_0x569ed4){if(_0x569ed4){_0x4ffdf2=_0x569ed4;_0x56be93[_0x314c('0x3d')]=_[_0x314c('0x3b')](db[_0x314c('0x5d')][_0x314c('0x36')]);_0x56be93[_0x314c('0x3a')]=_[_0x314c('0x3b')](_0x24ea98[_0x314c('0x3a')]);_0x56be93['filters']=_['intersection'](_0x56be93[_0x314c('0x3d')],_0x56be93[_0x314c('0x3a')]);_0x50b297[_0x314c('0x3e')]=_['intersection'](_0x56be93[_0x314c('0x3d')],qs[_0x314c('0x3f')](_0x24ea98['query']['fields']));_0x50b297[_0x314c('0x3e')]=_0x50b297['attributes'][_0x314c('0x40')]?_0x50b297[_0x314c('0x3e')]:_0x56be93[_0x314c('0x3d')];_0x50b297[_0x314c('0x59')]=qs[_0x314c('0x45')](_0x24ea98[_0x314c('0x3a')][_0x314c('0x45')]);_0x50b297[_0x314c('0x4b')]=qs['filters'](_[_0x314c('0x47')](_0x24ea98[_0x314c('0x3a')],_0x56be93[_0x314c('0x46')]));if(_0x24ea98[_0x314c('0x3a')][_0x314c('0x49')]){_0x50b297['where']=_['merge'](_0x50b297[_0x314c('0x4b')],{'$or':_[_0x314c('0x39')](_0x50b297[_0x314c('0x3e')],function(_0x216b6c){var _0x37f74c={};_0x37f74c[_0x216b6c]={'$like':'%'+_0x24ea98['query'][_0x314c('0x49')]+'%'};return _0x37f74c;})});}_0x50b297=_[_0x314c('0x48')]({},_0x50b297,_0x24ea98[_0x314c('0x4a')]);return _0x4ffdf2['getTags'](_0x50b297);}})[_0x314c('0x30')](function(_0x100d01){if(_0x100d01){_0x3e338e=_0x100d01[_0x314c('0x40')];if(!_0x24ea98[_0x314c('0x3a')][_0x314c('0x41')](_0x314c('0x42'))){_0x50b297[_0x314c('0x43')]=qs[_0x314c('0x43')](_0x24ea98['query'][_0x314c('0x43')]);_0x50b297[_0x314c('0x44')]=qs[_0x314c('0x44')](_0x24ea98[_0x314c('0x3a')]['offset']);}return _0x4ffdf2[_0x314c('0x5c')](_0x50b297);}})[_0x314c('0x30')](function(_0x384457){if(_0x384457){return _0x384457?{'count':_0x3e338e,'rows':_0x384457}:null;}})[_0x314c('0x30')](respondWithResult(_0x978c5b,null))[_0x314c('0x25')](handleError(_0x978c5b,null));};exports[_0x314c('0x5e')]=function(_0x3e2b21,_0x4b3cc3,_0xfa068f){if(_0x3e2b21[_0x314c('0x55')]['id']){delete _0x3e2b21[_0x314c('0x55')]['id'];}return db[_0x314c('0x35')][_0x314c('0x57')]({'where':{'id':_0x3e2b21[_0x314c('0x52')]['id']}})[_0x314c('0x30')](handleEntityNotFound(_0x4b3cc3,null))['then'](function(_0x518063){if(_0x518063){return _0x518063[_0x314c('0x5e')](_0x3e2b21[_0x314c('0x55')][_0x314c('0x5f')]||[]);}return null;})['then'](respondWithResult(_0x4b3cc3,null))[_0x314c('0x25')](handleError(_0x4b3cc3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b535ed7..558e317 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 _0x51a8=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x54955d,_0x3830c0){var _0x140497=function(_0x372481){while(--_0x372481){_0x54955d['push'](_0x54955d['shift']());}};_0x140497(++_0x3830c0);}(_0x51a8,0x173));var _0x851a=function(_0x4a072d,_0x5d387b){_0x4a072d=_0x4a072d-0x0;var _0x460c2a=_0x51a8[_0x4a072d];return _0x460c2a;};'use strict';var _=require(_0x851a('0x0'));var util=require(_0x851a('0x1'));var logger=require(_0x851a('0x2'))(_0x851a('0x3'));var moment=require('moment');var BPromise=require(_0x851a('0x4'));var rp=require(_0x851a('0x5'));var fs=require('fs');var path=require(_0x851a('0x6'));var rimraf=require(_0x851a('0x7'));var config=require(_0x851a('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x851a('0x9')]=function(_0x47e368,_0x10937f){return _0x47e368['define'](_0x851a('0xa'),attributes,{'tableName':_0x851a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa20e=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0xd9e94d,_0x44ad4e){var _0x25f358=function(_0xf6d104){while(--_0xf6d104){_0xd9e94d['push'](_0xd9e94d['shift']());}};_0x25f358(++_0x44ad4e);}(_0xa20e,0xf0));var _0xea20=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0xa20e[_0x1e17eb];return _0x4de4c7;};'use strict';var _=require(_0xea20('0x0'));var util=require(_0xea20('0x1'));var logger=require('../../config/logger')(_0xea20('0x2'));var moment=require(_0xea20('0x3'));var BPromise=require(_0xea20('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea20('0x5'));var rimraf=require(_0xea20('0x6'));var config=require(_0xea20('0x7'));var attributes=require(_0xea20('0x8'));module[_0xea20('0x9')]=function(_0x2d10c3,_0xaf712c){return _0x2d10c3['define'](_0xea20('0xa'),attributes,{'tableName':_0xea20('0xb'),'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 b54747b..9440d6f 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 _0x209b=['error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x31ab80,_0x59e4ab){var _0x485827=function(_0x5e39f5){while(--_0x5e39f5){_0x31ab80['push'](_0x31ab80['shift']());}};_0x485827(++_0x59e4ab);}(_0x209b,0x1df));var _0xb209=function(_0x58428c,_0x435751){_0x58428c=_0x58428c-0x0;var _0x4bebd4=_0x209b[_0x58428c];return _0x4bebd4;};'use strict';var _=require('lodash');var util=require(_0xb209('0x0'));var moment=require(_0xb209('0x1'));var BPromise=require('bluebird');var rs=require(_0xb209('0x2'));var fs=require('fs');var Redis=require(_0xb209('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb209('0x4'));var logger=require(_0xb209('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb209('0x6'));var client=jayson[_0xb209('0x7')][_0xb209('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x128277,_0x185d72,_0x4cd55f){return new BPromise(function(_0x2aaf80,_0x26964a){return client[_0xb209('0x9')](_0x128277,_0x4cd55f)['then'](function(_0x24c855){logger[_0xb209('0xa')](_0xb209('0xb'),_0x185d72,_0xb209('0xc'));logger[_0xb209('0xd')](_0xb209('0xe'),_0x185d72,_0xb209('0xc'),JSON['stringify'](_0x24c855));if(_0x24c855[_0xb209('0xf')]){if(_0x24c855[_0xb209('0xf')][_0xb209('0x10')]===0x1f4){logger[_0xb209('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x185d72,_0x24c855[_0xb209('0xf')][_0xb209('0x11')]);return _0x26964a(_0x24c855['error'][_0xb209('0x11')]);}logger[_0xb209('0xf')](_0xb209('0xb'),_0x185d72,_0x24c855[_0xb209('0xf')][_0xb209('0x11')]);return _0x2aaf80(_0x24c855['error'][_0xb209('0x11')]);}else{logger[_0xb209('0xa')](_0xb209('0xb'),_0x185d72,_0xb209('0xc'));_0x2aaf80(_0x24c855[_0xb209('0x12')][_0xb209('0x11')]);}})['catch'](function(_0x39c602){logger[_0xb209('0xf')](_0xb209('0xb'),_0x185d72,_0x39c602);_0x26964a(_0x39c602);});});} \ No newline at end of file +var _0x43f2=['error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x43f2,0x1ba));var _0x243f=function(_0x4bb2db,_0x26739a){_0x4bb2db=_0x4bb2db-0x0;var _0xcb6126=_0x43f2[_0x4bb2db];return _0xcb6126;};'use strict';var _=require(_0x243f('0x0'));var util=require(_0x243f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x243f('0x2'));var fs=require('fs');var Redis=require(_0x243f('0x3'));var db=require(_0x243f('0x4'))['db'];var utils=require(_0x243f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x243f('0x6')][_0x243f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5212b3,_0x540bab,_0x1e9c81){return new BPromise(function(_0x2425fd,_0x453138){return client['request'](_0x5212b3,_0x1e9c81)[_0x243f('0x8')](function(_0x4dc149){logger[_0x243f('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x540bab,_0x243f('0xa'));logger[_0x243f('0xb')](_0x243f('0xc'),_0x540bab,_0x243f('0xa'),JSON[_0x243f('0xd')](_0x4dc149));if(_0x4dc149[_0x243f('0xe')]){if(_0x4dc149[_0x243f('0xe')][_0x243f('0xf')]===0x1f4){logger[_0x243f('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x540bab,_0x4dc149[_0x243f('0xe')][_0x243f('0x10')]);return _0x453138(_0x4dc149['error'][_0x243f('0x10')]);}logger[_0x243f('0xe')](_0x243f('0x11'),_0x540bab,_0x4dc149[_0x243f('0xe')][_0x243f('0x10')]);return _0x2425fd(_0x4dc149[_0x243f('0xe')][_0x243f('0x10')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x540bab,_0x243f('0xa'));_0x2425fd(_0x4dc149['result']['message']);}})[_0x243f('0x12')](function(_0x43a284){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x540bab,_0x43a284);_0x453138(_0x43a284);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 18b1251..ae5c414 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 _0x6597=['/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index'];(function(_0x4d250c,_0x3cd414){var _0x4d2254=function(_0x19c98a){while(--_0x19c98a){_0x4d250c['push'](_0x4d250c['shift']());}};_0x4d2254(++_0x3cd414);}(_0x6597,0x12a));var _0x7659=function(_0x252fc4,_0x2c9c41){_0x252fc4=_0x252fc4-0x0;var _0x88cae6=_0x6597[_0x252fc4];return _0x88cae6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7659('0x0'));var timeout=require(_0x7659('0x1'));var express=require('express');var router=express[_0x7659('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7659('0x3'));var config=require(_0x7659('0x4'));var controller=require(_0x7659('0x5'));router[_0x7659('0x6')]('/',auth['isAuthenticated'](),controller[_0x7659('0x7')]);router[_0x7659('0x6')](_0x7659('0x8'),auth[_0x7659('0x9')](),controller[_0x7659('0xa')]);router[_0x7659('0xb')]('/',auth[_0x7659('0x9')](),controller[_0x7659('0xc')]);router[_0x7659('0xd')](_0x7659('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x7659('0xe')]('/:id',auth[_0x7659('0x9')](),controller[_0x7659('0xf')]);module[_0x7659('0x10')]=router; \ No newline at end of file +var _0x5b1a=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','put','delete'];(function(_0x3c7c6a,_0x54b857){var _0x1f3f6d=function(_0x364d5f){while(--_0x364d5f){_0x3c7c6a['push'](_0x3c7c6a['shift']());}};_0x1f3f6d(++_0x54b857);}(_0x5b1a,0xa3));var _0xa5b1=function(_0x2c7060,_0x2004ea){_0x2c7060=_0x2c7060-0x0;var _0x316b03=_0x5b1a[_0x2c7060];return _0x316b03;};'use strict';var multer=require(_0xa5b1('0x0'));var util=require(_0xa5b1('0x1'));var path=require(_0xa5b1('0x2'));var timeout=require(_0xa5b1('0x3'));var express=require(_0xa5b1('0x4'));var router=express['Router']();var fs_extra=require(_0xa5b1('0x5'));var auth=require(_0xa5b1('0x6'));var interaction=require(_0xa5b1('0x7'));var config=require(_0xa5b1('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa5b1('0x9')]);router[_0xa5b1('0xa')](_0xa5b1('0xb'),auth[_0xa5b1('0xc')](),controller[_0xa5b1('0xd')]);router[_0xa5b1('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa5b1('0xf')](_0xa5b1('0xb'),auth[_0xa5b1('0xc')](),controller['update']);router[_0xa5b1('0x10')](_0xa5b1('0xb'),auth[_0xa5b1('0xc')](),controller['destroy']);module[_0xa5b1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 11ed586..a9880da 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 _0x72b1=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x72b1,0x16e));var _0x172b=function(_0x30c471,_0x2797e8){_0x30c471=_0x30c471-0x0;var _0x8bca5=_0x72b1[_0x30c471];return _0x8bca5;};'use strict';var Sequelize=require(_0x172b('0x0'));module['exports']={'type':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2'),_0x172b('0x3'),_0x172b('0x4'),_0x172b('0x5'),_0x172b('0x6')),'defaultValue':_0x172b('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x172b('0x7')]},'keyType':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2'),_0x172b('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x172b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x172b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x172b('0x7')]}}; \ No newline at end of file +var _0x5c12=['keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM','variable','customVariable'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x5c12,0x188));var _0x25c1=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0x5c12[_0x404957];return _0x4e0365;};'use strict';var Sequelize=require('sequelize');module[_0x25c1('0x0')]={'type':{'type':Sequelize[_0x25c1('0x1')]('string',_0x25c1('0x2'),_0x25c1('0x3'),_0x25c1('0x4'),_0x25c1('0x5')),'defaultValue':_0x25c1('0x6')},'content':{'type':Sequelize[_0x25c1('0x7')]},'key':{'type':Sequelize[_0x25c1('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x25c1('0x6'),_0x25c1('0x2'),_0x25c1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x25c1('0x7')]},'customField':{'type':Sequelize[_0x25c1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x25c1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 7175cd6..bec8d4b 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 _0x1121=['map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','length','include','merge','find','catch','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send'];(function(_0x16ee24,_0xf29e9b){var _0x4381d7=function(_0x4aef4a){while(--_0x4aef4a){_0x16ee24['push'](_0x16ee24['shift']());}};_0x4381d7(++_0xf29e9b);}(_0x1121,0x1ea));var _0x1112=function(_0x77858e,_0x23c8fb){_0x77858e=_0x77858e-0x0;var _0x329841=_0x1121[_0x77858e];return _0x329841;};'use strict';var pdf=require(_0x1112('0x0'));var emlformat=require(_0x1112('0x1'));var rimraf=require(_0x1112('0x2'));var zipdir=require(_0x1112('0x3'));var jsonpatch=require(_0x1112('0x4'));var rp=require(_0x1112('0x5'));var moment=require(_0x1112('0x6'));var BPromise=require(_0x1112('0x7'));var Mustache=require(_0x1112('0x8'));var util=require(_0x1112('0x9'));var path=require(_0x1112('0xa'));var sox=require(_0x1112('0xb'));var csv=require(_0x1112('0xc'));var ejs=require(_0x1112('0xd'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1112('0xe'));var crypto=require(_0x1112('0xf'));var jsforce=require(_0x1112('0x10'));var deskjs=require(_0x1112('0x11'));var toCsv=require(_0x1112('0xc'));var querystring=require('querystring');var Papa=require(_0x1112('0x12'));var Redis=require(_0x1112('0x13'));var authService=require(_0x1112('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1112('0x15'));var hardwareService=require(_0x1112('0x16'));var logger=require(_0x1112('0x17'))(_0x1112('0x18'));var utils=require(_0x1112('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1112('0x1a'))['db'];function respondWithStatusCode(_0x3f7510,_0x350b57){_0x350b57=_0x350b57||0xcc;return function(_0x33c0ff){if(_0x33c0ff){return _0x3f7510[_0x1112('0x1b')](_0x350b57);}return _0x3f7510[_0x1112('0x1c')](_0x350b57)[_0x1112('0x1d')]();};}function respondWithResult(_0x3af2c1,_0x1ca32f){_0x1ca32f=_0x1ca32f||0xc8;return function(_0x2732ba){if(_0x2732ba){return _0x3af2c1[_0x1112('0x1c')](_0x1ca32f)[_0x1112('0x1e')](_0x2732ba);}};}function respondWithFilteredResult(_0x360469,_0x3db377){return function(_0x42a217){if(_0x42a217){var _0xc5efb9=_0x42a217[_0x1112('0x1f')],_0x496546=_0x3db377['offset'],_0x142efb=_0x3db377['offset']+_0x3db377['limit'],_0x210bbc;if(_0x142efb>=_0xc5efb9){_0x142efb=_0xc5efb9;_0x210bbc=0xc8;}else{_0x210bbc=0xce;}_0x360469['status'](_0x210bbc);return _0x360469[_0x1112('0x20')](_0x1112('0x21'),_0x496546+'-'+_0x142efb+'/'+_0xc5efb9)[_0x1112('0x1e')](_0x42a217);}return null;};}function patchUpdates(_0x4ee3c7){return function(_0x23bf4e){try{jsonpatch[_0x1112('0x22')](_0x23bf4e,_0x4ee3c7,!![]);}catch(_0x184d29){return BPromise['reject'](_0x184d29);}return _0x23bf4e[_0x1112('0x23')]();};}function saveUpdates(_0x3b6a24,_0x499cc3){return function(_0x39c96a){if(_0x39c96a){return _0x39c96a[_0x1112('0x24')](_0x3b6a24)[_0x1112('0x25')](function(_0x338097){return _0x338097;});}return null;};}function removeEntity(_0x225eeb,_0x6f7cd3){return function(_0x1faa36){if(_0x1faa36){return _0x1faa36[_0x1112('0x26')]()[_0x1112('0x25')](function(){_0x225eeb[_0x1112('0x1c')](0xcc)[_0x1112('0x1d')]();});}};}function handleEntityNotFound(_0x24523e,_0x37ae6a){return function(_0x590125){if(!_0x590125){_0x24523e[_0x1112('0x1b')](0x194);}return _0x590125;};}function handleError(_0x434854,_0x31acdc){_0x31acdc=_0x31acdc||0x1f4;return function(_0x2b8f95){logger['error'](_0x2b8f95[_0x1112('0x27')]);if(_0x2b8f95[_0x1112('0x28')]){delete _0x2b8f95['name'];}_0x434854['status'](_0x31acdc)[_0x1112('0x29')](_0x2b8f95);};}exports['index']=function(_0xc00d2,_0x44adf9){var _0x4bb016={},_0x41f2e5={},_0x255303={'count':0x0,'rows':[]};var _0x1efd3b=_[_0x1112('0x2a')](db[_0x1112('0x2b')][_0x1112('0x2c')],function(_0x211f3a){return{'name':_0x211f3a[_0x1112('0x2d')],'type':_0x211f3a[_0x1112('0x2e')][_0x1112('0x2f')]};});_0x41f2e5[_0x1112('0x30')]=_[_0x1112('0x2a')](_0x1efd3b,_0x1112('0x28'));_0x41f2e5['query']=_[_0x1112('0x31')](_0xc00d2[_0x1112('0x32')]);_0x41f2e5[_0x1112('0x33')]=_[_0x1112('0x34')](_0x41f2e5[_0x1112('0x30')],_0x41f2e5[_0x1112('0x32')]);_0x4bb016[_0x1112('0x35')]=_[_0x1112('0x34')](_0x41f2e5[_0x1112('0x30')],qs[_0x1112('0x36')](_0xc00d2['query'][_0x1112('0x36')]));_0x4bb016[_0x1112('0x35')]=_0x4bb016[_0x1112('0x35')]['length']?_0x4bb016[_0x1112('0x35')]:_0x41f2e5[_0x1112('0x30')];if(!_0xc00d2[_0x1112('0x32')][_0x1112('0x37')]('nolimit')){_0x4bb016[_0x1112('0x38')]=qs['limit'](_0xc00d2[_0x1112('0x32')][_0x1112('0x38')]);_0x4bb016[_0x1112('0x39')]=qs['offset'](_0xc00d2[_0x1112('0x32')][_0x1112('0x39')]);}_0x4bb016[_0x1112('0x3a')]=qs[_0x1112('0x3b')](_0xc00d2[_0x1112('0x32')][_0x1112('0x3b')]);_0x4bb016[_0x1112('0x3c')]=qs['filters'](_[_0x1112('0x3d')](_0xc00d2[_0x1112('0x32')],_0x41f2e5[_0x1112('0x33')]),_0x1efd3b);if(_0xc00d2[_0x1112('0x32')][_0x1112('0x3e')]){_0x4bb016['where']=_['merge'](_0x4bb016[_0x1112('0x3c')],{'$or':_[_0x1112('0x2a')](_0x1efd3b,function(_0x179d51){if(_0x179d51[_0x1112('0x2e')]!==_0x1112('0x3f')){var _0x5435fc={};_0x5435fc[_0x179d51[_0x1112('0x28')]]={'$like':'%'+_0xc00d2[_0x1112('0x32')][_0x1112('0x3e')]+'%'};return _0x5435fc;}})});}_0x4bb016=_['merge']({},_0x4bb016,_0xc00d2[_0x1112('0x40')]);var _0xd8dcf3={'where':_0x4bb016['where']};return db[_0x1112('0x2b')][_0x1112('0x1f')](_0xd8dcf3)[_0x1112('0x25')](function(_0x27e3ff){_0x255303[_0x1112('0x1f')]=_0x27e3ff;if(_0xc00d2[_0x1112('0x32')][_0x1112('0x41')]){_0x4bb016['include']=[{'all':!![]}];}return db[_0x1112('0x2b')][_0x1112('0x42')](_0x4bb016);})[_0x1112('0x25')](function(_0x12d178){_0x255303[_0x1112('0x43')]=_0x12d178;return _0x255303;})['then'](respondWithFilteredResult(_0x44adf9,_0x4bb016))['catch'](handleError(_0x44adf9,null));};exports[_0x1112('0x44')]=function(_0x22f910,_0x1284ac){var _0x9aec73={'raw':!![],'where':{'id':_0x22f910['params']['id']}},_0x14fded={};_0x14fded[_0x1112('0x30')]=_[_0x1112('0x31')](db['FreshdeskField']['rawAttributes']);_0x14fded['query']=_[_0x1112('0x31')](_0x22f910['query']);_0x14fded[_0x1112('0x33')]=_['intersection'](_0x14fded[_0x1112('0x30')],_0x14fded[_0x1112('0x32')]);_0x9aec73['attributes']=_['intersection'](_0x14fded[_0x1112('0x30')],qs[_0x1112('0x36')](_0x22f910[_0x1112('0x32')]['fields']));_0x9aec73[_0x1112('0x35')]=_0x9aec73[_0x1112('0x35')][_0x1112('0x45')]?_0x9aec73[_0x1112('0x35')]:_0x14fded[_0x1112('0x30')];if(_0x22f910[_0x1112('0x32')]['includeAll']){_0x9aec73[_0x1112('0x46')]=[{'all':!![]}];}_0x9aec73=_[_0x1112('0x47')]({},_0x9aec73,_0x22f910['options']);return db['FreshdeskField'][_0x1112('0x48')](_0x9aec73)[_0x1112('0x25')](handleEntityNotFound(_0x1284ac,null))[_0x1112('0x25')](respondWithResult(_0x1284ac,null))[_0x1112('0x49')](handleError(_0x1284ac,null));};exports['create']=function(_0x42f9b5,_0x3d4cc8){return db[_0x1112('0x2b')]['create'](_0x42f9b5[_0x1112('0x4a')],{})[_0x1112('0x25')](respondWithResult(_0x3d4cc8,0xc9))[_0x1112('0x49')](handleError(_0x3d4cc8,null));};exports[_0x1112('0x24')]=function(_0x5a2315,_0x435868){if(_0x5a2315[_0x1112('0x4a')]['id']){delete _0x5a2315[_0x1112('0x4a')]['id'];}return db[_0x1112('0x2b')][_0x1112('0x48')]({'where':{'id':_0x5a2315[_0x1112('0x4b')]['id']}})[_0x1112('0x25')](handleEntityNotFound(_0x435868,null))[_0x1112('0x25')](saveUpdates(_0x5a2315['body'],null))[_0x1112('0x25')](respondWithResult(_0x435868,null))['catch'](handleError(_0x435868,null));};exports[_0x1112('0x26')]=function(_0x23e46b,_0x242fa6){return db[_0x1112('0x2b')]['find']({'where':{'id':_0x23e46b['params']['id']}})[_0x1112('0x25')](handleEntityNotFound(_0x242fa6,null))[_0x1112('0x25')](removeEntity(_0x242fa6,null))[_0x1112('0x49')](handleError(_0x242fa6,null));}; \ No newline at end of file +var _0xe485=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','options','findAll','rows','show','params','keys','FreshdeskField','length','includeAll','include','merge','find','catch','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe485,0x1e5));var _0x5e48=function(_0x8f8bfa,_0xe4c16a){_0x8f8bfa=_0x8f8bfa-0x0;var _0x23ba0b=_0xe485[_0x8f8bfa];return _0x23ba0b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5e48('0x0'));var zipdir=require(_0x5e48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e48('0x2'));var BPromise=require(_0x5e48('0x3'));var Mustache=require(_0x5e48('0x4'));var util=require(_0x5e48('0x5'));var path=require(_0x5e48('0x6'));var sox=require('sox');var csv=require(_0x5e48('0x7'));var ejs=require(_0x5e48('0x8'));var fs=require('fs');var fs_extra=require(_0x5e48('0x9'));var _=require(_0x5e48('0xa'));var squel=require(_0x5e48('0xb'));var crypto=require(_0x5e48('0xc'));var jsforce=require(_0x5e48('0xd'));var deskjs=require(_0x5e48('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e48('0xf'));var Redis=require(_0x5e48('0x10'));var authService=require(_0x5e48('0x11'));var qs=require(_0x5e48('0x12'));var as=require(_0x5e48('0x13'));var hardwareService=require(_0x5e48('0x14'));var logger=require('../../config/logger')(_0x5e48('0x15'));var utils=require(_0x5e48('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5e48('0x17'));var db=require(_0x5e48('0x18'))['db'];function respondWithStatusCode(_0x743c65,_0x2f092f){_0x2f092f=_0x2f092f||0xcc;return function(_0x523f04){if(_0x523f04){return _0x743c65['sendStatus'](_0x2f092f);}return _0x743c65[_0x5e48('0x19')](_0x2f092f)[_0x5e48('0x1a')]();};}function respondWithResult(_0x5ed3e6,_0x39bffa){_0x39bffa=_0x39bffa||0xc8;return function(_0x219f37){if(_0x219f37){return _0x5ed3e6[_0x5e48('0x19')](_0x39bffa)[_0x5e48('0x1b')](_0x219f37);}};}function respondWithFilteredResult(_0x53b25d,_0x43b60a){return function(_0x52a970){if(_0x52a970){var _0x3e21fe=_0x52a970[_0x5e48('0x1c')],_0x1adce3=_0x43b60a[_0x5e48('0x1d')],_0x47c9ca=_0x43b60a[_0x5e48('0x1d')]+_0x43b60a[_0x5e48('0x1e')],_0x2ef465;if(_0x47c9ca>=_0x3e21fe){_0x47c9ca=_0x3e21fe;_0x2ef465=0xc8;}else{_0x2ef465=0xce;}_0x53b25d[_0x5e48('0x19')](_0x2ef465);return _0x53b25d['set'](_0x5e48('0x1f'),_0x1adce3+'-'+_0x47c9ca+'/'+_0x3e21fe)[_0x5e48('0x1b')](_0x52a970);}return null;};}function patchUpdates(_0x3efc76){return function(_0x258f77){try{jsonpatch['apply'](_0x258f77,_0x3efc76,!![]);}catch(_0x497eb0){return BPromise[_0x5e48('0x20')](_0x497eb0);}return _0x258f77[_0x5e48('0x21')]();};}function saveUpdates(_0x5dac7c,_0x1cd292){return function(_0x5c74d4){if(_0x5c74d4){return _0x5c74d4[_0x5e48('0x22')](_0x5dac7c)[_0x5e48('0x23')](function(_0x2972de){return _0x2972de;});}return null;};}function removeEntity(_0x5510ef,_0x199145){return function(_0x4d6ab8){if(_0x4d6ab8){return _0x4d6ab8[_0x5e48('0x24')]()[_0x5e48('0x23')](function(){_0x5510ef[_0x5e48('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ba14,_0x503863){return function(_0x534b4b){if(!_0x534b4b){_0x16ba14['sendStatus'](0x194);}return _0x534b4b;};}function handleError(_0x282fde,_0xbf4399){_0xbf4399=_0xbf4399||0x1f4;return function(_0x18072d){logger[_0x5e48('0x25')](_0x18072d[_0x5e48('0x26')]);if(_0x18072d[_0x5e48('0x27')]){delete _0x18072d[_0x5e48('0x27')];}_0x282fde['status'](_0xbf4399)[_0x5e48('0x28')](_0x18072d);};}exports['index']=function(_0x11967d,_0x5e534c){var _0x328e42={},_0x2116c6={},_0x103e2f={'count':0x0,'rows':[]};var _0x5aae14=_['map'](db['FreshdeskField'][_0x5e48('0x29')],function(_0x5cf541){return{'name':_0x5cf541['fieldName'],'type':_0x5cf541[_0x5e48('0x2a')]['key']};});_0x2116c6[_0x5e48('0x2b')]=_['map'](_0x5aae14,_0x5e48('0x27'));_0x2116c6[_0x5e48('0x2c')]=_['keys'](_0x11967d['query']);_0x2116c6[_0x5e48('0x2d')]=_[_0x5e48('0x2e')](_0x2116c6[_0x5e48('0x2b')],_0x2116c6[_0x5e48('0x2c')]);_0x328e42[_0x5e48('0x2f')]=_[_0x5e48('0x2e')](_0x2116c6[_0x5e48('0x2b')],qs[_0x5e48('0x30')](_0x11967d['query'][_0x5e48('0x30')]));_0x328e42[_0x5e48('0x2f')]=_0x328e42['attributes']['length']?_0x328e42['attributes']:_0x2116c6['model'];if(!_0x11967d[_0x5e48('0x2c')][_0x5e48('0x31')](_0x5e48('0x32'))){_0x328e42[_0x5e48('0x1e')]=qs[_0x5e48('0x1e')](_0x11967d[_0x5e48('0x2c')][_0x5e48('0x1e')]);_0x328e42[_0x5e48('0x1d')]=qs[_0x5e48('0x1d')](_0x11967d['query'][_0x5e48('0x1d')]);}_0x328e42[_0x5e48('0x33')]=qs['sort'](_0x11967d[_0x5e48('0x2c')][_0x5e48('0x34')]);_0x328e42[_0x5e48('0x35')]=qs[_0x5e48('0x2d')](_[_0x5e48('0x36')](_0x11967d[_0x5e48('0x2c')],_0x2116c6['filters']),_0x5aae14);if(_0x11967d['query']['filter']){_0x328e42[_0x5e48('0x35')]=_['merge'](_0x328e42[_0x5e48('0x35')],{'$or':_[_0x5e48('0x37')](_0x5aae14,function(_0x5797e3){if(_0x5797e3[_0x5e48('0x2a')]!=='VIRTUAL'){var _0x3e89b0={};_0x3e89b0[_0x5797e3['name']]={'$like':'%'+_0x11967d['query'][_0x5e48('0x38')]+'%'};return _0x3e89b0;}})});}_0x328e42=_['merge']({},_0x328e42,_0x11967d[_0x5e48('0x39')]);var _0x2fc151={'where':_0x328e42['where']};return db['FreshdeskField'][_0x5e48('0x1c')](_0x2fc151)[_0x5e48('0x23')](function(_0x44288d){_0x103e2f[_0x5e48('0x1c')]=_0x44288d;if(_0x11967d['query']['includeAll']){_0x328e42['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x5e48('0x3a')](_0x328e42);})[_0x5e48('0x23')](function(_0x2ddc54){_0x103e2f[_0x5e48('0x3b')]=_0x2ddc54;return _0x103e2f;})[_0x5e48('0x23')](respondWithFilteredResult(_0x5e534c,_0x328e42))['catch'](handleError(_0x5e534c,null));};exports[_0x5e48('0x3c')]=function(_0x2db773,_0x7150e6){var _0x274fd0={'raw':!![],'where':{'id':_0x2db773[_0x5e48('0x3d')]['id']}},_0x42317a={};_0x42317a['model']=_[_0x5e48('0x3e')](db[_0x5e48('0x3f')][_0x5e48('0x29')]);_0x42317a[_0x5e48('0x2c')]=_[_0x5e48('0x3e')](_0x2db773[_0x5e48('0x2c')]);_0x42317a[_0x5e48('0x2d')]=_[_0x5e48('0x2e')](_0x42317a['model'],_0x42317a[_0x5e48('0x2c')]);_0x274fd0['attributes']=_[_0x5e48('0x2e')](_0x42317a[_0x5e48('0x2b')],qs[_0x5e48('0x30')](_0x2db773[_0x5e48('0x2c')][_0x5e48('0x30')]));_0x274fd0[_0x5e48('0x2f')]=_0x274fd0[_0x5e48('0x2f')][_0x5e48('0x40')]?_0x274fd0[_0x5e48('0x2f')]:_0x42317a[_0x5e48('0x2b')];if(_0x2db773[_0x5e48('0x2c')][_0x5e48('0x41')]){_0x274fd0[_0x5e48('0x42')]=[{'all':!![]}];}_0x274fd0=_[_0x5e48('0x43')]({},_0x274fd0,_0x2db773[_0x5e48('0x39')]);return db['FreshdeskField'][_0x5e48('0x44')](_0x274fd0)['then'](handleEntityNotFound(_0x7150e6,null))[_0x5e48('0x23')](respondWithResult(_0x7150e6,null))[_0x5e48('0x45')](handleError(_0x7150e6,null));};exports[_0x5e48('0x46')]=function(_0x17a776,_0x3d3ec9){return db['FreshdeskField'][_0x5e48('0x46')](_0x17a776['body'],{})[_0x5e48('0x23')](respondWithResult(_0x3d3ec9,0xc9))[_0x5e48('0x45')](handleError(_0x3d3ec9,null));};exports[_0x5e48('0x22')]=function(_0x223c24,_0x272c88){if(_0x223c24[_0x5e48('0x47')]['id']){delete _0x223c24[_0x5e48('0x47')]['id'];}return db[_0x5e48('0x3f')][_0x5e48('0x44')]({'where':{'id':_0x223c24['params']['id']}})[_0x5e48('0x23')](handleEntityNotFound(_0x272c88,null))['then'](saveUpdates(_0x223c24[_0x5e48('0x47')],null))[_0x5e48('0x23')](respondWithResult(_0x272c88,null))[_0x5e48('0x45')](handleError(_0x272c88,null));};exports[_0x5e48('0x24')]=function(_0x553556,_0x24fca9){return db[_0x5e48('0x3f')]['find']({'where':{'id':_0x553556[_0x5e48('0x3d')]['id']}})[_0x5e48('0x23')](handleEntityNotFound(_0x24fca9,null))[_0x5e48('0x23')](removeEntity(_0x24fca9,null))[_0x5e48('0x45')](handleError(_0x24fca9,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 44ad5f9..c43047f 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 _0xa80f=['FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','define'];(function(_0x512943,_0x3630b6){var _0x4dfc02=function(_0xb9ad50){while(--_0xb9ad50){_0x512943['push'](_0x512943['shift']());}};_0x4dfc02(++_0x3630b6);}(_0xa80f,0x14e));var _0xfa80=function(_0x214fe8,_0x3eea5e){_0x214fe8=_0x214fe8-0x0;var _0x405a51=_0xa80f[_0x214fe8];return _0x405a51;};'use strict';var _=require(_0xfa80('0x0'));var util=require(_0xfa80('0x1'));var logger=require(_0xfa80('0x2'))(_0xfa80('0x3'));var moment=require(_0xfa80('0x4'));var BPromise=require(_0xfa80('0x5'));var rp=require(_0xfa80('0x6'));var fs=require('fs');var path=require(_0xfa80('0x7'));var rimraf=require(_0xfa80('0x8'));var config=require('../../config/environment');var attributes=require(_0xfa80('0x9'));module['exports']=function(_0x594fbc,_0x5a6ea1){return _0x594fbc[_0xfa80('0xa')](_0xfa80('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xfa80('0xc'),'fields':[_0xfa80('0xd'),_0xfa80('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x350e=['../../config/environment','./intFreshdeskField.attributes','define','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x350e,0x1c8));var _0xe350=function(_0x1606eb,_0x28d213){_0x1606eb=_0x1606eb-0x0;var _0x2ebed7=_0x350e[_0x1606eb];return _0x2ebed7;};'use strict';var _=require(_0xe350('0x0'));var util=require('util');var logger=require(_0xe350('0x1'))(_0xe350('0x2'));var moment=require(_0xe350('0x3'));var BPromise=require('bluebird');var rp=require(_0xe350('0x4'));var fs=require('fs');var path=require(_0xe350('0x5'));var rimraf=require('rimraf');var config=require(_0xe350('0x6'));var attributes=require(_0xe350('0x7'));module['exports']=function(_0x1fd1f9,_0x10a95b){return _0x1fd1f9[_0xe350('0x8')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xe350('0x9'),_0xe350('0xa')],'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 3159857..f41bcaf 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(_0x5abb9b,_0x5e5aa5){var _0x3905e0=function(_0x5c92d3){while(--_0x5c92d3){_0x5abb9b['push'](_0x5abb9b['shift']());}};_0x3905e0(++_0x5e5aa5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3443d3,_0xf1bb82){_0x3443d3=_0x3443d3-0x0;var _0x3de675=_0xb10b[_0x3443d3];return _0x3de675;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0xe6b7e4,_0x44864a){_0xe6b7e4=_0xe6b7e4-0x0;var _0x1513a6=_0x7a54[_0xe6b7e4];return _0x1513a6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index c517740..c8cf397 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 _0xd23d=['getFields','post','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x483915,_0x31000d){var _0x53229f=function(_0x9f7f8f){while(--_0x9f7f8f){_0x483915['push'](_0x483915['shift']());}};_0x53229f(++_0x31000d);}(_0xd23d,0xed));var _0xdd23=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xd23d[_0x3e531a];return _0x3c2574;};'use strict';var multer=require('multer');var util=require(_0xdd23('0x0'));var path=require(_0xdd23('0x1'));var timeout=require(_0xdd23('0x2'));var express=require('express');var router=express[_0xdd23('0x3')]();var fs_extra=require(_0xdd23('0x4'));var auth=require(_0xdd23('0x5'));var interaction=require(_0xdd23('0x6'));var config=require(_0xdd23('0x7'));var controller=require(_0xdd23('0x8'));router['get']('/',auth[_0xdd23('0x9')](),controller['index']);router['get'](_0xdd23('0xa'),auth[_0xdd23('0x9')](),controller[_0xdd23('0xb')]);router['get'](_0xdd23('0xc'),auth[_0xdd23('0x9')](),controller[_0xdd23('0xd')]);router['get'](_0xdd23('0xe'),auth[_0xdd23('0x9')](),controller[_0xdd23('0xf')]);router[_0xdd23('0x10')]('/',auth[_0xdd23('0x9')](),controller['create']);router['post'](_0xdd23('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xdd23('0x11')](_0xdd23('0xa'),auth['isAuthenticated'](),controller[_0xdd23('0x12')]);router['delete'](_0xdd23('0xa'),auth['isAuthenticated'](),controller[_0xdd23('0x13')]);module[_0xdd23('0x14')]=router; \ No newline at end of file +var _0x1290=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','create','post','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x16d302,_0x56cadb){var _0x389078=function(_0x3b5632){while(--_0x3b5632){_0x16d302['push'](_0x16d302['shift']());}};_0x389078(++_0x56cadb);}(_0x1290,0x136));var _0x0129=function(_0x538069,_0x276658){_0x538069=_0x538069-0x0;var _0x50b4cd=_0x1290[_0x538069];return _0x50b4cd;};'use strict';var multer=require(_0x0129('0x0'));var util=require(_0x0129('0x1'));var path=require('path');var timeout=require(_0x0129('0x2'));var express=require('express');var router=express[_0x0129('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0129('0x4'));var interaction=require(_0x0129('0x5'));var config=require(_0x0129('0x6'));var controller=require(_0x0129('0x7'));router[_0x0129('0x8')]('/',auth[_0x0129('0x9')](),controller[_0x0129('0xa')]);router[_0x0129('0x8')](_0x0129('0xb'),auth[_0x0129('0x9')](),controller[_0x0129('0xc')]);router['get'](_0x0129('0xd'),auth[_0x0129('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x0129('0x9')](),controller[_0x0129('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0129('0xf')]);router[_0x0129('0x10')](_0x0129('0xd'),auth[_0x0129('0x9')](),controller['addConfiguration']);router['put']('/:id',auth[_0x0129('0x9')](),controller[_0x0129('0x11')]);router[_0x0129('0x12')](_0x0129('0xb'),auth['isAuthenticated'](),controller[_0x0129('0x13')]);module[_0x0129('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 addccb0..b2a8425 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 _0xfac1=['STRING','remoteUri','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfac1,0x140));var _0x1fac=function(_0x590ef3,_0x3b2dd2){_0x590ef3=_0x590ef3-0x0;var _0x4502be=_0xfac1[_0x590ef3];return _0x4502be;};'use strict';var Sequelize=require('sequelize');module[_0x1fac('0x0')]={'name':{'type':Sequelize[_0x1fac('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1fac('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0x1fac('0x1')]},'remoteUri':{'type':Sequelize[_0x1fac('0x1')],'unique':_0x1fac('0x2')},'serverUrl':{'type':Sequelize[_0x1fac('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb3df=['STRING','remoteUri','exports'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0xb3df,0x167));var _0xfb3d=function(_0x463b98,_0x8e23b7){_0x463b98=_0x463b98-0x0;var _0x4f18da=_0xb3df[_0x463b98];return _0x4f18da;};'use strict';var Sequelize=require('sequelize');module[_0xfb3d('0x0')]={'name':{'type':Sequelize[_0xfb3d('0x1')]},'description':{'type':Sequelize[_0xfb3d('0x1')]},'username':{'type':Sequelize[_0xfb3d('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfb3d('0x1')]},'remoteUri':{'type':Sequelize[_0xfb3d('0x1')],'unique':_0xfb3d('0x2')},'serverUrl':{'type':Sequelize[_0xfb3d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 87bbe49..3723632 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 _0xf006=['path','sox','to-csv','fs-extra','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','then','info','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','include','findAll','rows','show','params','keys','fields','includeAll','find','create','body','update','getConfigurations','FreshsalesConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','rimraf','zip-dir','request-promise','bluebird'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0xf006,0x146));var _0x6f00=function(_0x1bbfce,_0x47b774){_0x1bbfce=_0x1bbfce-0x0;var _0x9cd77=_0xf006[_0x1bbfce];return _0x9cd77;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6f00('0x0'));var zipdir=require(_0x6f00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f00('0x2'));var moment=require('moment');var BPromise=require(_0x6f00('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f00('0x4'));var sox=require(_0x6f00('0x5'));var csv=require(_0x6f00('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f00('0x7'));var _=require('lodash');var squel=require(_0x6f00('0x8'));var crypto=require(_0x6f00('0x9'));var jsforce=require(_0x6f00('0xa'));var deskjs=require(_0x6f00('0xb'));var toCsv=require(_0x6f00('0x6'));var querystring=require(_0x6f00('0xc'));var Papa=require(_0x6f00('0xd'));var Redis=require(_0x6f00('0xe'));var authService=require(_0x6f00('0xf'));var qs=require(_0x6f00('0x10'));var as=require(_0x6f00('0x11'));var hardwareService=require(_0x6f00('0x12'));var logger=require(_0x6f00('0x13'))('api');var utils=require(_0x6f00('0x14'));var config=require(_0x6f00('0x15'));var licenseUtil=require(_0x6f00('0x16'));var db=require(_0x6f00('0x17'))['db'];var integrations=require(_0x6f00('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x6f00('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30b10e,_0x5047f5,_0x324e67,_0x220e68){return new BPromise(function(_0x327e10,_0x33f3a2){var _0xa6e7a1=_0x220e68||client;return _0xa6e7a1[_0x6f00('0x1a')](_0x30b10e,_0x324e67)[_0x6f00('0x1b')](function(_0x4d8aee){logger[_0x6f00('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x5047f5,_0x6f00('0x1d'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5047f5,_0x6f00('0x1d'),JSON[_0x6f00('0x1e')](_0x4d8aee));if(_0x4d8aee[_0x6f00('0x1f')]){if(_0x4d8aee[_0x6f00('0x1f')][_0x6f00('0x20')]===0x1f4){logger[_0x6f00('0x1f')](_0x6f00('0x21'),_0x5047f5,_0x4d8aee[_0x6f00('0x1f')][_0x6f00('0x22')]);return _0x33f3a2(_0x4d8aee[_0x6f00('0x1f')][_0x6f00('0x22')]);}logger[_0x6f00('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x5047f5,_0x4d8aee['error']['message']);return _0x327e10(_0x4d8aee[_0x6f00('0x1f')][_0x6f00('0x22')]);}else{logger[_0x6f00('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x5047f5,_0x6f00('0x1d'));_0x327e10(_0x4d8aee[_0x6f00('0x23')][_0x6f00('0x22')]);}})[_0x6f00('0x24')](function(_0x388983){logger[_0x6f00('0x1f')](_0x6f00('0x21'),_0x5047f5,_0x388983);_0x33f3a2(_0x388983);});});}function respondWithStatusCode(_0x1ea061,_0x533d70){_0x533d70=_0x533d70||0xcc;return function(_0x3c05ef){if(_0x3c05ef){return _0x1ea061[_0x6f00('0x25')](_0x533d70);}return _0x1ea061[_0x6f00('0x26')](_0x533d70)['end']();};}function respondWithResult(_0x37f062,_0x4f7e29){_0x4f7e29=_0x4f7e29||0xc8;return function(_0x25c6a7){if(_0x25c6a7){return _0x37f062['status'](_0x4f7e29)[_0x6f00('0x27')](_0x25c6a7);}};}function respondWithFilteredResult(_0x39375d,_0x7c6bcb){return function(_0x1f84a6){if(_0x1f84a6){var _0x375d76=_0x1f84a6[_0x6f00('0x28')],_0x49eb87=_0x7c6bcb[_0x6f00('0x29')],_0x23a346=_0x7c6bcb[_0x6f00('0x29')]+_0x7c6bcb[_0x6f00('0x2a')],_0x25cc71;if(_0x23a346>=_0x375d76){_0x23a346=_0x375d76;_0x25cc71=0xc8;}else{_0x25cc71=0xce;}_0x39375d[_0x6f00('0x26')](_0x25cc71);return _0x39375d[_0x6f00('0x2b')](_0x6f00('0x2c'),_0x49eb87+'-'+_0x23a346+'/'+_0x375d76)[_0x6f00('0x27')](_0x1f84a6);}return null;};}function patchUpdates(_0x380e68){return function(_0x448888){try{jsonpatch[_0x6f00('0x2d')](_0x448888,_0x380e68,!![]);}catch(_0x17d9d1){return BPromise['reject'](_0x17d9d1);}return _0x448888['save']();};}function saveUpdates(_0x5d16ad,_0x5df06d){return function(_0x522d4f){if(_0x522d4f){return _0x522d4f['update'](_0x5d16ad)[_0x6f00('0x1b')](function(_0x56338c){return _0x56338c;});}return null;};}function removeEntity(_0x3c0e5d,_0x192bc1){return function(_0x85e7ef){if(_0x85e7ef){return _0x85e7ef[_0x6f00('0x2e')]()[_0x6f00('0x1b')](function(){_0x3c0e5d[_0x6f00('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c77d,_0x1c5443){return function(_0x3cefb8){if(!_0x3cefb8){_0x26c77d[_0x6f00('0x25')](0x194);}return _0x3cefb8;};}function handleError(_0x4255e8,_0x4fed1c){_0x4fed1c=_0x4fed1c||0x1f4;return function(_0x52274f){logger['error'](_0x52274f[_0x6f00('0x2f')]);if(_0x52274f[_0x6f00('0x30')]){delete _0x52274f[_0x6f00('0x30')];}_0x4255e8[_0x6f00('0x26')](_0x4fed1c)[_0x6f00('0x31')](_0x52274f);};}exports['index']=function(_0xf6f5e9,_0x4038ae){var _0x2adff4={},_0x4646dc={},_0x3865ab={'count':0x0,'rows':[]};var _0x493190=_[_0x6f00('0x32')](db['FreshsalesAccount'][_0x6f00('0x33')],function(_0x1dee52){return{'name':_0x1dee52[_0x6f00('0x34')],'type':_0x1dee52['type'][_0x6f00('0x35')]};});_0x4646dc[_0x6f00('0x36')]=_[_0x6f00('0x32')](_0x493190,'name');_0x4646dc[_0x6f00('0x37')]=_['keys'](_0xf6f5e9[_0x6f00('0x37')]);_0x4646dc['filters']=_[_0x6f00('0x38')](_0x4646dc[_0x6f00('0x36')],_0x4646dc[_0x6f00('0x37')]);_0x2adff4[_0x6f00('0x39')]=_['intersection'](_0x4646dc[_0x6f00('0x36')],qs['fields'](_0xf6f5e9[_0x6f00('0x37')]['fields']));_0x2adff4[_0x6f00('0x39')]=_0x2adff4[_0x6f00('0x39')][_0x6f00('0x3a')]?_0x2adff4[_0x6f00('0x39')]:_0x4646dc['model'];if(!_0xf6f5e9['query'][_0x6f00('0x3b')]('nolimit')){_0x2adff4[_0x6f00('0x2a')]=qs[_0x6f00('0x2a')](_0xf6f5e9['query'][_0x6f00('0x2a')]);_0x2adff4['offset']=qs['offset'](_0xf6f5e9[_0x6f00('0x37')][_0x6f00('0x29')]);}_0x2adff4[_0x6f00('0x3c')]=qs[_0x6f00('0x3d')](_0xf6f5e9['query'][_0x6f00('0x3d')]);_0x2adff4[_0x6f00('0x3e')]=qs[_0x6f00('0x3f')](_[_0x6f00('0x40')](_0xf6f5e9[_0x6f00('0x37')],_0x4646dc[_0x6f00('0x3f')]),_0x493190);if(_0xf6f5e9['query'][_0x6f00('0x41')]){_0x2adff4[_0x6f00('0x3e')]=_[_0x6f00('0x42')](_0x2adff4[_0x6f00('0x3e')],{'$or':_[_0x6f00('0x32')](_0x493190,function(_0x35ce8d){if(_0x35ce8d['type']!==_0x6f00('0x43')){var _0x290dbf={};_0x290dbf[_0x35ce8d[_0x6f00('0x30')]]={'$like':'%'+_0xf6f5e9['query'][_0x6f00('0x41')]+'%'};return _0x290dbf;}})});}_0x2adff4=_['merge']({},_0x2adff4,_0xf6f5e9[_0x6f00('0x44')]);var _0x346c0c={'where':_0x2adff4['where']};return db[_0x6f00('0x45')]['count'](_0x346c0c)[_0x6f00('0x1b')](function(_0x3d4158){_0x3865ab[_0x6f00('0x28')]=_0x3d4158;if(_0xf6f5e9[_0x6f00('0x37')]['includeAll']){_0x2adff4[_0x6f00('0x46')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x6f00('0x47')](_0x2adff4);})['then'](function(_0x96c15d){_0x3865ab[_0x6f00('0x48')]=_0x96c15d;return _0x3865ab;})[_0x6f00('0x1b')](respondWithFilteredResult(_0x4038ae,_0x2adff4))[_0x6f00('0x24')](handleError(_0x4038ae,null));};exports[_0x6f00('0x49')]=function(_0x3472f0,_0x189109){var _0x23af58={'raw':![],'where':{'id':_0x3472f0[_0x6f00('0x4a')]['id']}},_0x555706={};_0x555706['model']=_[_0x6f00('0x4b')](db[_0x6f00('0x45')][_0x6f00('0x33')]);_0x555706['query']=_['keys'](_0x3472f0[_0x6f00('0x37')]);_0x555706[_0x6f00('0x3f')]=_['intersection'](_0x555706[_0x6f00('0x36')],_0x555706['query']);_0x23af58[_0x6f00('0x39')]=_['intersection'](_0x555706[_0x6f00('0x36')],qs[_0x6f00('0x4c')](_0x3472f0['query']['fields']));_0x23af58[_0x6f00('0x39')]=_0x23af58[_0x6f00('0x39')]['length']?_0x23af58[_0x6f00('0x39')]:_0x555706['model'];if(_0x3472f0[_0x6f00('0x37')][_0x6f00('0x4d')]){_0x23af58[_0x6f00('0x46')]=[{'all':!![]}];}_0x23af58=_[_0x6f00('0x42')]({},_0x23af58,_0x3472f0[_0x6f00('0x44')]);return db[_0x6f00('0x45')][_0x6f00('0x4e')](_0x23af58)[_0x6f00('0x1b')](handleEntityNotFound(_0x189109,null))[_0x6f00('0x1b')](respondWithResult(_0x189109,null))[_0x6f00('0x24')](handleError(_0x189109,null));};exports[_0x6f00('0x4f')]=function(_0x75f030,_0x4537ec){return db[_0x6f00('0x45')][_0x6f00('0x4f')](_0x75f030[_0x6f00('0x50')],{})[_0x6f00('0x1b')](respondWithResult(_0x4537ec,0xc9))[_0x6f00('0x24')](handleError(_0x4537ec,null));};exports[_0x6f00('0x51')]=function(_0xb51b72,_0x4ad55c){if(_0xb51b72['body']['id']){delete _0xb51b72[_0x6f00('0x50')]['id'];}return db['FreshsalesAccount'][_0x6f00('0x4e')]({'where':{'id':_0xb51b72[_0x6f00('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ad55c,null))[_0x6f00('0x1b')](saveUpdates(_0xb51b72[_0x6f00('0x50')],null))[_0x6f00('0x1b')](respondWithResult(_0x4ad55c,null))['catch'](handleError(_0x4ad55c,null));};exports[_0x6f00('0x2e')]=function(_0x4e5638,_0x1515bb){return db[_0x6f00('0x45')]['find']({'where':{'id':_0x4e5638[_0x6f00('0x4a')]['id']}})[_0x6f00('0x1b')](handleEntityNotFound(_0x1515bb,null))[_0x6f00('0x1b')](removeEntity(_0x1515bb,null))[_0x6f00('0x24')](handleError(_0x1515bb,null));};exports[_0x6f00('0x52')]=function(_0x1bb9f5,_0x2f8720,_0x4a4905){var _0x566b42={};var _0x5bd485={};var _0x4a421b;var _0x197555;return db[_0x6f00('0x45')]['findOne']({'where':{'id':_0x1bb9f5['params']['id']}})[_0x6f00('0x1b')](handleEntityNotFound(_0x2f8720,null))[_0x6f00('0x1b')](function(_0x33bee1){if(_0x33bee1){_0x4a421b=_0x33bee1;_0x5bd485[_0x6f00('0x36')]=_['keys'](db[_0x6f00('0x53')]['rawAttributes']);_0x5bd485['query']=_[_0x6f00('0x4b')](_0x1bb9f5[_0x6f00('0x37')]);_0x5bd485[_0x6f00('0x3f')]=_[_0x6f00('0x38')](_0x5bd485[_0x6f00('0x36')],_0x5bd485['query']);_0x566b42[_0x6f00('0x39')]=_[_0x6f00('0x38')](_0x5bd485[_0x6f00('0x36')],qs[_0x6f00('0x4c')](_0x1bb9f5['query']['fields']));_0x566b42[_0x6f00('0x39')]=_0x566b42['attributes'][_0x6f00('0x3a')]?_0x566b42[_0x6f00('0x39')]:_0x5bd485[_0x6f00('0x36')];_0x566b42[_0x6f00('0x3c')]=qs['sort'](_0x1bb9f5['query'][_0x6f00('0x3d')]);_0x566b42[_0x6f00('0x3e')]=qs[_0x6f00('0x3f')](_[_0x6f00('0x40')](_0x1bb9f5['query'],_0x5bd485[_0x6f00('0x3f')]));if(_0x1bb9f5[_0x6f00('0x37')][_0x6f00('0x41')]){_0x566b42[_0x6f00('0x3e')]=_[_0x6f00('0x42')](_0x566b42['where'],{'$or':_['map'](_0x566b42['attributes'],function(_0x1e4ae3){var _0x3ca0af={};_0x3ca0af[_0x1e4ae3]={'$like':'%'+_0x1bb9f5['query']['filter']+'%'};return _0x3ca0af;})});}_0x566b42=_[_0x6f00('0x42')]({},_0x566b42,_0x1bb9f5[_0x6f00('0x44')]);return _0x4a421b['getConfigurations'](_0x566b42);}})['then'](function(_0x2c5c8d){if(_0x2c5c8d){_0x197555=_0x2c5c8d[_0x6f00('0x3a')];if(!_0x1bb9f5[_0x6f00('0x37')][_0x6f00('0x3b')](_0x6f00('0x54'))){_0x566b42[_0x6f00('0x2a')]=qs[_0x6f00('0x2a')](_0x1bb9f5[_0x6f00('0x37')]['limit']);_0x566b42['offset']=qs[_0x6f00('0x29')](_0x1bb9f5[_0x6f00('0x37')][_0x6f00('0x29')]);}return _0x4a421b[_0x6f00('0x52')](_0x566b42);}})[_0x6f00('0x1b')](function(_0xe1ea4e){if(_0xe1ea4e){return _0xe1ea4e?{'count':_0x197555,'rows':_0xe1ea4e}:null;}})[_0x6f00('0x1b')](respondWithResult(_0x2f8720,null))[_0x6f00('0x24')](handleError(_0x2f8720,null));};exports[_0x6f00('0x55')]=function(_0xeaa3ca,_0x393915,_0x1dcccb){if(_0xeaa3ca[_0x6f00('0x50')]['id']){delete _0xeaa3ca[_0x6f00('0x50')]['id'];}return db[_0x6f00('0x45')][_0x6f00('0x56')]({'where':{'id':_0xeaa3ca[_0x6f00('0x4a')]['id']}})['then'](handleEntityNotFound(_0x393915,null))['then'](function(_0x28bdeb){if(_0x28bdeb){_0xeaa3ca['body'][_0x6f00('0x57')]=_0x28bdeb['id'];_0xeaa3ca[_0x6f00('0x50')][_0x6f00('0x58')]=integrations[_0x6f00('0x59')](_0xeaa3ca[_0x6f00('0x50')]['channel'],_0xeaa3ca[_0x6f00('0x50')][_0x6f00('0x5a')]);_0xeaa3ca[_0x6f00('0x50')][_0x6f00('0x5b')]=integrations[_0x6f00('0x5c')](_0xeaa3ca[_0x6f00('0x50')][_0x6f00('0x5d')],_0xeaa3ca[_0x6f00('0x50')][_0x6f00('0x5a')]);return db[_0x6f00('0x53')][_0x6f00('0x4f')](_0xeaa3ca['body'],{'include':[{'model':db[_0x6f00('0x5e')],'as':_0x6f00('0x58')},{'model':db[_0x6f00('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x393915,null))[_0x6f00('0x24')](handleError(_0x393915,null));};exports[_0x6f00('0x5f')]=function(_0x1e5182,_0x1d24d0,_0x5a9b42){var _0x564625='';var _0x4cb62d='';return db['FreshsalesAccount'][_0x6f00('0x56')]({'where':{'id':_0x1e5182[_0x6f00('0x4a')]['id']},'attributes':['id',_0x6f00('0x60'),_0x6f00('0x61'),_0x6f00('0x62')]})['then'](handleEntityNotFound(_0x1d24d0,null))[_0x6f00('0x1b')](function(_0xefbe9d){if(_0xefbe9d){_0x4cb62d=_0xefbe9d['username'];_0x564625=_0xefbe9d[_0x6f00('0x61')];var _0x220711=_0xefbe9d[_0x6f00('0x61')][_0x6f00('0x63')](-0x1);if(_0x220711==='/'){_0x564625=_0x564625[_0x6f00('0x64')](0x0,_0x564625[_0x6f00('0x65')](_0x220711));}return rp({'method':_0x6f00('0x66'),'uri':util[_0x6f00('0x67')]('%s%s',_0x564625,_0x6f00('0x68')),'headers':{'Authorization':'Token\x20token='+_0xefbe9d[_0x6f00('0x62')]},'json':!![]});}})[_0x6f00('0x1b')](function(_0x3a5b37){if(_0x3a5b37){var _0x233f2b=_0x3a5b37[_0x6f00('0x69')];var _0x1468ca=![];var _0x2d1c2b=null;for(_0x2d1c2b=0x0;_0x2d1c2b<_0x233f2b[_0x6f00('0x3a')];_0x2d1c2b++){if(_0x233f2b[_0x2d1c2b][_0x6f00('0x6a')]===_0x4cb62d){_0x1468ca=!![];}}if(_0x1468ca){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6f00('0x6b')});}}})[_0x6f00('0x1b')](respondWithResult(_0x1d24d0,null))[_0x6f00('0x24')](function(_0x2e460e){var _0x31e3f4=_0x1e5182['query'][_0x6f00('0x6c')]?0x1f4:_0x2e460e[_0x6f00('0x6d')]||0x1f4;logger[_0x6f00('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x6f00('0x5f'),_0x31e3f4,JSON[_0x6f00('0x1e')](_0x2e460e));delete _0x2e460e['name'];if(_0x31e3f4===0x191){_0x31e3f4=0x190;}_0x1d24d0[_0x6f00('0x26')](_0x31e3f4)[_0x6f00('0x31')](_0x1e5182[_0x6f00('0x37')][_0x6f00('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x2e460e['statusCode']}:_0x2e460e);});}; \ No newline at end of file +var _0x089f=['email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','name','send','index','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','FreshsalesAccount','findAll','rows','show','params','rawAttributes','include','find','create','body','destroy','getConfigurations','findOne','hasOwnProperty','AccountId','Subjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','username','apiKey','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users'];(function(_0x521b5e,_0x28e147){var _0x2b9ded=function(_0x1ebb36){while(--_0x1ebb36){_0x521b5e['push'](_0x521b5e['shift']());}};_0x2b9ded(++_0x28e147);}(_0x089f,0x1c7));var _0xf089=function(_0xf8ff10,_0x273604){_0xf8ff10=_0xf8ff10-0x0;var _0x45a024=_0x089f[_0xf8ff10];return _0x45a024;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf089('0x0'));var rimraf=require(_0xf089('0x1'));var zipdir=require(_0xf089('0x2'));var jsonpatch=require(_0xf089('0x3'));var rp=require(_0xf089('0x4'));var moment=require('moment');var BPromise=require(_0xf089('0x5'));var Mustache=require(_0xf089('0x6'));var util=require(_0xf089('0x7'));var path=require('path');var sox=require(_0xf089('0x8'));var csv=require(_0xf089('0x9'));var ejs=require(_0xf089('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf089('0xb'));var squel=require(_0xf089('0xc'));var crypto=require(_0xf089('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf089('0xe'));var toCsv=require(_0xf089('0x9'));var querystring=require(_0xf089('0xf'));var Papa=require(_0xf089('0x10'));var Redis=require(_0xf089('0x11'));var authService=require(_0xf089('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf089('0x13'));var hardwareService=require(_0xf089('0x14'));var logger=require(_0xf089('0x15'))('api');var utils=require(_0xf089('0x16'));var config=require(_0xf089('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf089('0x18'));var jayson=require(_0xf089('0x19'));var client=jayson['client'][_0xf089('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x470ba9,_0x72b34f,_0x337673,_0x58b0db){return new BPromise(function(_0x329719,_0x4e6438){var _0x2d5f2b=_0x58b0db||client;return _0x2d5f2b['request'](_0x470ba9,_0x337673)[_0xf089('0x1b')](function(_0x5aee45){logger[_0xf089('0x1c')](_0xf089('0x1d'),_0x72b34f,_0xf089('0x1e'));logger[_0xf089('0x1f')](_0xf089('0x20'),_0x72b34f,'request\x20sent',JSON[_0xf089('0x21')](_0x5aee45));if(_0x5aee45['error']){if(_0x5aee45[_0xf089('0x22')][_0xf089('0x23')]===0x1f4){logger['error'](_0xf089('0x1d'),_0x72b34f,_0x5aee45[_0xf089('0x22')]['message']);return _0x4e6438(_0x5aee45[_0xf089('0x22')][_0xf089('0x24')]);}logger[_0xf089('0x22')](_0xf089('0x1d'),_0x72b34f,_0x5aee45[_0xf089('0x22')][_0xf089('0x24')]);return _0x329719(_0x5aee45[_0xf089('0x22')][_0xf089('0x24')]);}else{logger[_0xf089('0x1c')](_0xf089('0x1d'),_0x72b34f,'request\x20sent');_0x329719(_0x5aee45[_0xf089('0x25')][_0xf089('0x24')]);}})[_0xf089('0x26')](function(_0x1b9444){logger[_0xf089('0x22')](_0xf089('0x1d'),_0x72b34f,_0x1b9444);_0x4e6438(_0x1b9444);});});}function respondWithStatusCode(_0x249b88,_0x94df4d){_0x94df4d=_0x94df4d||0xcc;return function(_0x22f2f2){if(_0x22f2f2){return _0x249b88[_0xf089('0x27')](_0x94df4d);}return _0x249b88['status'](_0x94df4d)[_0xf089('0x28')]();};}function respondWithResult(_0x598a4e,_0x38078a){_0x38078a=_0x38078a||0xc8;return function(_0x372a7a){if(_0x372a7a){return _0x598a4e['status'](_0x38078a)[_0xf089('0x29')](_0x372a7a);}};}function respondWithFilteredResult(_0x5e72c9,_0x52ea47){return function(_0x42c286){if(_0x42c286){var _0x220746=_0x42c286['count'],_0x2ffff6=_0x52ea47[_0xf089('0x2a')],_0x3a4957=_0x52ea47['offset']+_0x52ea47[_0xf089('0x2b')],_0x14aa96;if(_0x3a4957>=_0x220746){_0x3a4957=_0x220746;_0x14aa96=0xc8;}else{_0x14aa96=0xce;}_0x5e72c9[_0xf089('0x2c')](_0x14aa96);return _0x5e72c9[_0xf089('0x2d')](_0xf089('0x2e'),_0x2ffff6+'-'+_0x3a4957+'/'+_0x220746)[_0xf089('0x29')](_0x42c286);}return null;};}function patchUpdates(_0x250ad3){return function(_0x3268ca){try{jsonpatch[_0xf089('0x2f')](_0x3268ca,_0x250ad3,!![]);}catch(_0x281fee){return BPromise[_0xf089('0x30')](_0x281fee);}return _0x3268ca[_0xf089('0x31')]();};}function saveUpdates(_0x12924c,_0x5b85a4){return function(_0x5747a2){if(_0x5747a2){return _0x5747a2[_0xf089('0x32')](_0x12924c)[_0xf089('0x1b')](function(_0x3fcd88){return _0x3fcd88;});}return null;};}function removeEntity(_0x26ec9c,_0x33f2d8){return function(_0x585b15){if(_0x585b15){return _0x585b15['destroy']()[_0xf089('0x1b')](function(){_0x26ec9c[_0xf089('0x2c')](0xcc)[_0xf089('0x28')]();});}};}function handleEntityNotFound(_0x6c58c7,_0x1d0d62){return function(_0x45bc05){if(!_0x45bc05){_0x6c58c7[_0xf089('0x27')](0x194);}return _0x45bc05;};}function handleError(_0x29bd70,_0x41d699){_0x41d699=_0x41d699||0x1f4;return function(_0x488746){logger[_0xf089('0x22')](_0x488746['stack']);if(_0x488746[_0xf089('0x33')]){delete _0x488746[_0xf089('0x33')];}_0x29bd70['status'](_0x41d699)[_0xf089('0x34')](_0x488746);};}exports[_0xf089('0x35')]=function(_0xcbc1a7,_0x440798){var _0x5e646c={},_0x2108ca={},_0x4d8b0c={'count':0x0,'rows':[]};var _0x3332f8=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x3bbcb3){return{'name':_0x3bbcb3[_0xf089('0x36')],'type':_0x3bbcb3['type']['key']};});_0x2108ca['model']=_[_0xf089('0x37')](_0x3332f8,_0xf089('0x33'));_0x2108ca[_0xf089('0x38')]=_[_0xf089('0x39')](_0xcbc1a7['query']);_0x2108ca[_0xf089('0x3a')]=_[_0xf089('0x3b')](_0x2108ca[_0xf089('0x3c')],_0x2108ca['query']);_0x5e646c[_0xf089('0x3d')]=_['intersection'](_0x2108ca[_0xf089('0x3c')],qs[_0xf089('0x3e')](_0xcbc1a7[_0xf089('0x38')][_0xf089('0x3e')]));_0x5e646c[_0xf089('0x3d')]=_0x5e646c[_0xf089('0x3d')][_0xf089('0x3f')]?_0x5e646c[_0xf089('0x3d')]:_0x2108ca[_0xf089('0x3c')];if(!_0xcbc1a7[_0xf089('0x38')]['hasOwnProperty'](_0xf089('0x40'))){_0x5e646c[_0xf089('0x2b')]=qs[_0xf089('0x2b')](_0xcbc1a7['query']['limit']);_0x5e646c[_0xf089('0x2a')]=qs[_0xf089('0x2a')](_0xcbc1a7[_0xf089('0x38')]['offset']);}_0x5e646c[_0xf089('0x41')]=qs[_0xf089('0x42')](_0xcbc1a7['query'][_0xf089('0x42')]);_0x5e646c[_0xf089('0x43')]=qs['filters'](_[_0xf089('0x44')](_0xcbc1a7['query'],_0x2108ca[_0xf089('0x3a')]),_0x3332f8);if(_0xcbc1a7[_0xf089('0x38')][_0xf089('0x45')]){_0x5e646c[_0xf089('0x43')]=_[_0xf089('0x46')](_0x5e646c['where'],{'$or':_[_0xf089('0x37')](_0x3332f8,function(_0x2b5f09){if(_0x2b5f09['type']!==_0xf089('0x47')){var _0x3d333b={};_0x3d333b[_0x2b5f09[_0xf089('0x33')]]={'$like':'%'+_0xcbc1a7[_0xf089('0x38')][_0xf089('0x45')]+'%'};return _0x3d333b;}})});}_0x5e646c=_[_0xf089('0x46')]({},_0x5e646c,_0xcbc1a7[_0xf089('0x48')]);var _0x5e7a3b={'where':_0x5e646c['where']};return db['FreshsalesAccount'][_0xf089('0x49')](_0x5e7a3b)[_0xf089('0x1b')](function(_0x43b087){_0x4d8b0c[_0xf089('0x49')]=_0x43b087;if(_0xcbc1a7['query'][_0xf089('0x4a')]){_0x5e646c['include']=[{'all':!![]}];}return db[_0xf089('0x4b')][_0xf089('0x4c')](_0x5e646c);})[_0xf089('0x1b')](function(_0x53e4f7){_0x4d8b0c[_0xf089('0x4d')]=_0x53e4f7;return _0x4d8b0c;})[_0xf089('0x1b')](respondWithFilteredResult(_0x440798,_0x5e646c))['catch'](handleError(_0x440798,null));};exports[_0xf089('0x4e')]=function(_0x1a28cd,_0xb68f3e){var _0x34abf3={'raw':![],'where':{'id':_0x1a28cd[_0xf089('0x4f')]['id']}},_0x4af5d0={};_0x4af5d0['model']=_['keys'](db[_0xf089('0x4b')][_0xf089('0x50')]);_0x4af5d0['query']=_[_0xf089('0x39')](_0x1a28cd['query']);_0x4af5d0['filters']=_['intersection'](_0x4af5d0['model'],_0x4af5d0[_0xf089('0x38')]);_0x34abf3[_0xf089('0x3d')]=_['intersection'](_0x4af5d0[_0xf089('0x3c')],qs[_0xf089('0x3e')](_0x1a28cd[_0xf089('0x38')][_0xf089('0x3e')]));_0x34abf3[_0xf089('0x3d')]=_0x34abf3[_0xf089('0x3d')][_0xf089('0x3f')]?_0x34abf3['attributes']:_0x4af5d0[_0xf089('0x3c')];if(_0x1a28cd[_0xf089('0x38')][_0xf089('0x4a')]){_0x34abf3[_0xf089('0x51')]=[{'all':!![]}];}_0x34abf3=_['merge']({},_0x34abf3,_0x1a28cd[_0xf089('0x48')]);return db[_0xf089('0x4b')][_0xf089('0x52')](_0x34abf3)[_0xf089('0x1b')](handleEntityNotFound(_0xb68f3e,null))[_0xf089('0x1b')](respondWithResult(_0xb68f3e,null))[_0xf089('0x26')](handleError(_0xb68f3e,null));};exports[_0xf089('0x53')]=function(_0x527c43,_0x5bd300){return db['FreshsalesAccount'][_0xf089('0x53')](_0x527c43[_0xf089('0x54')],{})['then'](respondWithResult(_0x5bd300,0xc9))['catch'](handleError(_0x5bd300,null));};exports[_0xf089('0x32')]=function(_0x26fd10,_0x34b58b){if(_0x26fd10[_0xf089('0x54')]['id']){delete _0x26fd10[_0xf089('0x54')]['id'];}return db[_0xf089('0x4b')][_0xf089('0x52')]({'where':{'id':_0x26fd10['params']['id']}})['then'](handleEntityNotFound(_0x34b58b,null))[_0xf089('0x1b')](saveUpdates(_0x26fd10[_0xf089('0x54')],null))[_0xf089('0x1b')](respondWithResult(_0x34b58b,null))['catch'](handleError(_0x34b58b,null));};exports[_0xf089('0x55')]=function(_0x20ae39,_0x30a8ac){return db[_0xf089('0x4b')][_0xf089('0x52')]({'where':{'id':_0x20ae39['params']['id']}})['then'](handleEntityNotFound(_0x30a8ac,null))[_0xf089('0x1b')](removeEntity(_0x30a8ac,null))[_0xf089('0x26')](handleError(_0x30a8ac,null));};exports[_0xf089('0x56')]=function(_0x4eb267,_0x5ea5c3,_0x2f4bcb){var _0x511f2c={};var _0x26b5e7={};var _0xef097;var _0x571bf7;return db['FreshsalesAccount'][_0xf089('0x57')]({'where':{'id':_0x4eb267['params']['id']}})[_0xf089('0x1b')](handleEntityNotFound(_0x5ea5c3,null))[_0xf089('0x1b')](function(_0x33bd2d){if(_0x33bd2d){_0xef097=_0x33bd2d;_0x26b5e7[_0xf089('0x3c')]=_['keys'](db['FreshsalesConfiguration'][_0xf089('0x50')]);_0x26b5e7['query']=_[_0xf089('0x39')](_0x4eb267['query']);_0x26b5e7['filters']=_[_0xf089('0x3b')](_0x26b5e7[_0xf089('0x3c')],_0x26b5e7['query']);_0x511f2c['attributes']=_[_0xf089('0x3b')](_0x26b5e7['model'],qs[_0xf089('0x3e')](_0x4eb267[_0xf089('0x38')][_0xf089('0x3e')]));_0x511f2c[_0xf089('0x3d')]=_0x511f2c[_0xf089('0x3d')][_0xf089('0x3f')]?_0x511f2c['attributes']:_0x26b5e7[_0xf089('0x3c')];_0x511f2c[_0xf089('0x41')]=qs['sort'](_0x4eb267[_0xf089('0x38')][_0xf089('0x42')]);_0x511f2c[_0xf089('0x43')]=qs[_0xf089('0x3a')](_[_0xf089('0x44')](_0x4eb267[_0xf089('0x38')],_0x26b5e7[_0xf089('0x3a')]));if(_0x4eb267[_0xf089('0x38')][_0xf089('0x45')]){_0x511f2c[_0xf089('0x43')]=_[_0xf089('0x46')](_0x511f2c[_0xf089('0x43')],{'$or':_[_0xf089('0x37')](_0x511f2c[_0xf089('0x3d')],function(_0xc445e7){var _0x31fd35={};_0x31fd35[_0xc445e7]={'$like':'%'+_0x4eb267['query']['filter']+'%'};return _0x31fd35;})});}_0x511f2c=_[_0xf089('0x46')]({},_0x511f2c,_0x4eb267[_0xf089('0x48')]);return _0xef097[_0xf089('0x56')](_0x511f2c);}})[_0xf089('0x1b')](function(_0x10e932){if(_0x10e932){_0x571bf7=_0x10e932[_0xf089('0x3f')];if(!_0x4eb267['query'][_0xf089('0x58')](_0xf089('0x40'))){_0x511f2c[_0xf089('0x2b')]=qs['limit'](_0x4eb267[_0xf089('0x38')][_0xf089('0x2b')]);_0x511f2c[_0xf089('0x2a')]=qs[_0xf089('0x2a')](_0x4eb267['query'][_0xf089('0x2a')]);}return _0xef097[_0xf089('0x56')](_0x511f2c);}})[_0xf089('0x1b')](function(_0x32f0c9){if(_0x32f0c9){return _0x32f0c9?{'count':_0x571bf7,'rows':_0x32f0c9}:null;}})[_0xf089('0x1b')](respondWithResult(_0x5ea5c3,null))[_0xf089('0x26')](handleError(_0x5ea5c3,null));};exports['addConfiguration']=function(_0x47effd,_0x38eafb,_0x357899){if(_0x47effd[_0xf089('0x54')]['id']){delete _0x47effd[_0xf089('0x54')]['id'];}return db['FreshsalesAccount'][_0xf089('0x57')]({'where':{'id':_0x47effd['params']['id']}})[_0xf089('0x1b')](handleEntityNotFound(_0x38eafb,null))[_0xf089('0x1b')](function(_0x19d213){if(_0x19d213){_0x47effd[_0xf089('0x54')][_0xf089('0x59')]=_0x19d213['id'];_0x47effd['body'][_0xf089('0x5a')]=integrations['getSubjects'](_0x47effd[_0xf089('0x54')][_0xf089('0x5b')],_0x47effd[_0xf089('0x54')]['type']);_0x47effd[_0xf089('0x54')]['Descriptions']=integrations[_0xf089('0x5c')](_0x47effd[_0xf089('0x54')][_0xf089('0x5b')],_0x47effd[_0xf089('0x54')]['type']);return db[_0xf089('0x5d')][_0xf089('0x53')](_0x47effd['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xf089('0x5a')},{'model':db[_0xf089('0x5e')],'as':'Descriptions'}]});}return null;})[_0xf089('0x1b')](respondWithResult(_0x38eafb,null))['catch'](handleError(_0x38eafb,null));};exports['getFields']=function(_0x15dd61,_0x1b74d4,_0x3586f9){var _0x451333='';var _0x66e783='';return db[_0xf089('0x4b')]['findOne']({'where':{'id':_0x15dd61['params']['id']},'attributes':['id',_0xf089('0x5f'),'remoteUri',_0xf089('0x60')]})['then'](handleEntityNotFound(_0x1b74d4,null))['then'](function(_0x49734d){if(_0x49734d){_0x66e783=_0x49734d[_0xf089('0x5f')];_0x451333=_0x49734d[_0xf089('0x61')];var _0x49eb29=_0x49734d[_0xf089('0x61')]['slice'](-0x1);if(_0x49eb29==='/'){_0x451333=_0x451333[_0xf089('0x62')](0x0,_0x451333[_0xf089('0x63')](_0x49eb29));}return rp({'method':_0xf089('0x64'),'uri':util[_0xf089('0x65')](_0xf089('0x66'),_0x451333,_0xf089('0x67')),'headers':{'Authorization':'Token\x20token='+_0x49734d[_0xf089('0x60')]},'json':!![]});}})[_0xf089('0x1b')](function(_0x355dd2){if(_0x355dd2){var _0x49fdfc=_0x355dd2[_0xf089('0x68')];var _0x4b0755=![];var _0x4354b0=null;for(_0x4354b0=0x0;_0x4354b0<_0x49fdfc['length'];_0x4354b0++){if(_0x49fdfc[_0x4354b0][_0xf089('0x69')]===_0x66e783){_0x4b0755=!![];}}if(_0x4b0755){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf089('0x6a')});}}})[_0xf089('0x1b')](respondWithResult(_0x1b74d4,null))[_0xf089('0x26')](function(_0x3e7f38){var _0x261dd4=_0x15dd61[_0xf089('0x38')]['test']?0x1f4:_0x3e7f38['statusCode']||0x1f4;logger[_0xf089('0x22')](_0xf089('0x6b'),_0xf089('0x6c'),_0x261dd4,JSON[_0xf089('0x21')](_0x3e7f38));delete _0x3e7f38[_0xf089('0x33')];if(_0x261dd4===0x191){_0x261dd4=0x190;}_0x1b74d4[_0xf089('0x2c')](_0x261dd4)[_0xf089('0x34')](_0x15dd61[_0xf089('0x38')][_0xf089('0x6d')]?{'message':_0xf089('0x6e'),'statusCode':_0x3e7f38[_0xf089('0x6f')]}:_0x3e7f38);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 0d7d233..9aef18f 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 _0x04a1=['../../components/integrations/configuration','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x51189a,_0x1f43aa){var _0x31ec09=function(_0x1e3ea2){while(--_0x1e3ea2){_0x51189a['push'](_0x51189a['shift']());}};_0x31ec09(++_0x1f43aa);}(_0x04a1,0x18e));var _0x104a=function(_0x216330,_0x35e767){_0x216330=_0x216330-0x0;var _0x4528ee=_0x04a1[_0x216330];return _0x4528ee;};'use strict';var _=require(_0x104a('0x0'));var util=require(_0x104a('0x1'));var logger=require(_0x104a('0x2'))(_0x104a('0x3'));var moment=require('moment');var BPromise=require(_0x104a('0x4'));var rp=require(_0x104a('0x5'));var fs=require('fs');var path=require(_0x104a('0x6'));var rimraf=require(_0x104a('0x7'));var config=require(_0x104a('0x8'));var attributes=require(_0x104a('0x9'));var integrations=require(_0x104a('0xa'));module['exports']=function(_0x5bfa3c,_0x38ce4d){return _0x5bfa3c['define']('FreshsalesAccount',attributes,{'tableName':_0x104a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x352e=['path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26bceb,_0x124ed3){var _0xcb6fef=function(_0x22acf7){while(--_0x22acf7){_0x26bceb['push'](_0x26bceb['shift']());}};_0xcb6fef(++_0x124ed3);}(_0x352e,0x1a6));var _0xe352=function(_0x334454,_0x256d81){_0x334454=_0x334454-0x0;var _0xb6db19=_0x352e[_0x334454];return _0xb6db19;};'use strict';var _=require(_0xe352('0x0'));var util=require(_0xe352('0x1'));var logger=require(_0xe352('0x2'))(_0xe352('0x3'));var moment=require(_0xe352('0x4'));var BPromise=require(_0xe352('0x5'));var rp=require(_0xe352('0x6'));var fs=require('fs');var path=require(_0xe352('0x7'));var rimraf=require('rimraf');var config=require(_0xe352('0x8'));var attributes=require(_0xe352('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xe352('0xa')]=function(_0x31aac8,_0x32d7c6){return _0x31aac8[_0xe352('0xb')]('FreshsalesAccount',attributes,{'tableName':_0xe352('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 2a39115..aafc5f5 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 _0xba38=['GetFreshsalesAccount','find','where','ShowFreshsalesAccount','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FreshsalesAccount','options','raw','attributes','include','map','model','info'];(function(_0xb02630,_0x2cd4cd){var _0x280fea=function(_0x100ff4){while(--_0x100ff4){_0xb02630['push'](_0xb02630['shift']());}};_0x280fea(++_0x2cd4cd);}(_0xba38,0x190));var _0x8ba3=function(_0x1723a4,_0x2b58a4){_0x1723a4=_0x1723a4-0x0;var _0x199117=_0xba38[_0x1723a4];return _0x199117;};'use strict';var _=require('lodash');var util=require(_0x8ba3('0x0'));var moment=require(_0x8ba3('0x1'));var BPromise=require(_0x8ba3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ba3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ba3('0x4'));var logger=require(_0x8ba3('0x5'))(_0x8ba3('0x6'));var config=require(_0x8ba3('0x7'));var jayson=require(_0x8ba3('0x8'));var client=jayson[_0x8ba3('0x9')][_0x8ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17276c,_0x193e7e,_0x1dab1f){return new BPromise(function(_0x1b02f3,_0x1be1c3){return client['request'](_0x17276c,_0x1dab1f)[_0x8ba3('0xb')](function(_0x3041b5){logger['info'](_0x8ba3('0xc'),_0x193e7e,'request\x20sent');logger[_0x8ba3('0xd')](_0x8ba3('0xe'),_0x193e7e,_0x8ba3('0xf'),JSON[_0x8ba3('0x10')](_0x3041b5));if(_0x3041b5[_0x8ba3('0x11')]){if(_0x3041b5[_0x8ba3('0x11')][_0x8ba3('0x12')]===0x1f4){logger[_0x8ba3('0x11')](_0x8ba3('0xc'),_0x193e7e,_0x3041b5['error'][_0x8ba3('0x13')]);return _0x1be1c3(_0x3041b5[_0x8ba3('0x11')]['message']);}logger[_0x8ba3('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x193e7e,_0x3041b5[_0x8ba3('0x11')]['message']);return _0x1b02f3(_0x3041b5[_0x8ba3('0x11')][_0x8ba3('0x13')]);}else{logger['info'](_0x8ba3('0xc'),_0x193e7e,_0x8ba3('0xf'));_0x1b02f3(_0x3041b5['result'][_0x8ba3('0x13')]);}})[_0x8ba3('0x14')](function(_0x4c0818){logger['error'](_0x8ba3('0xc'),_0x193e7e,_0x4c0818);_0x1be1c3(_0x4c0818);});});}exports['GetFreshsalesAccount']=function(_0x5a8f04){var _0x2e2ed7=this;return new Promise(function(_0x563d61,_0x4c34c0){return db[_0x8ba3('0x15')]['findAll']({'raw':_0x5a8f04[_0x8ba3('0x16')]?_0x5a8f04['options'][_0x8ba3('0x17')]===undefined?!![]:![]:!![],'where':_0x5a8f04[_0x8ba3('0x16')]?_0x5a8f04[_0x8ba3('0x16')]['where']||null:null,'attributes':_0x5a8f04[_0x8ba3('0x16')]?_0x5a8f04[_0x8ba3('0x16')][_0x8ba3('0x18')]||null:null,'limit':_0x5a8f04[_0x8ba3('0x16')]?_0x5a8f04[_0x8ba3('0x16')]['limit']||null:null,'include':_0x5a8f04['options']?_0x5a8f04[_0x8ba3('0x16')][_0x8ba3('0x19')]?_[_0x8ba3('0x1a')](_0x5a8f04[_0x8ba3('0x16')]['include'],function(_0x543021){return{'model':db[_0x543021[_0x8ba3('0x1b')]],'as':_0x543021['as'],'attributes':_0x543021[_0x8ba3('0x18')],'include':_0x543021[_0x8ba3('0x19')]?_[_0x8ba3('0x1a')](_0x543021['include'],function(_0x199ad6){return{'model':db[_0x199ad6['model']],'as':_0x199ad6['as'],'attributes':_0x199ad6[_0x8ba3('0x18')],'include':_0x199ad6[_0x8ba3('0x19')]?_[_0x8ba3('0x1a')](_0x199ad6[_0x8ba3('0x19')],function(_0x43e306){return{'model':db[_0x43e306[_0x8ba3('0x1b')]],'as':_0x43e306['as'],'attributes':_0x43e306[_0x8ba3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8ba3('0xb')](function(_0x2ffd77){logger[_0x8ba3('0x1c')](_0x8ba3('0x1d'),_0x5a8f04);logger[_0x8ba3('0xd')](_0x8ba3('0x1d'),_0x5a8f04,JSON[_0x8ba3('0x10')](_0x2ffd77));_0x563d61(_0x2ffd77);})[_0x8ba3('0x14')](function(_0xee2109){logger[_0x8ba3('0x11')](_0x8ba3('0x1d'),_0xee2109['message'],_0x5a8f04);_0x4c34c0(_0x2e2ed7[_0x8ba3('0x11')](0x1f4,_0xee2109[_0x8ba3('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x52e795){var _0xd6bc23=this;return new Promise(function(_0x1d6715,_0x98e8e7){return db[_0x8ba3('0x15')][_0x8ba3('0x1e')]({'raw':_0x52e795[_0x8ba3('0x16')]?_0x52e795[_0x8ba3('0x16')][_0x8ba3('0x17')]===undefined?!![]:![]:!![],'where':_0x52e795[_0x8ba3('0x16')]?_0x52e795['options'][_0x8ba3('0x1f')]||null:null,'attributes':_0x52e795[_0x8ba3('0x16')]?_0x52e795[_0x8ba3('0x16')][_0x8ba3('0x18')]||null:null,'include':_0x52e795[_0x8ba3('0x16')]?_0x52e795[_0x8ba3('0x16')][_0x8ba3('0x19')]?_['map'](_0x52e795['options'][_0x8ba3('0x19')],function(_0x2d9448){return{'model':db[_0x2d9448[_0x8ba3('0x1b')]],'as':_0x2d9448['as'],'attributes':_0x2d9448[_0x8ba3('0x18')],'include':_0x2d9448['include']?_['map'](_0x2d9448[_0x8ba3('0x19')],function(_0x5a5b34){return{'model':db[_0x5a5b34['model']],'as':_0x5a5b34['as'],'attributes':_0x5a5b34[_0x8ba3('0x18')],'include':_0x5a5b34['include']?_[_0x8ba3('0x1a')](_0x5a5b34[_0x8ba3('0x19')],function(_0x556500){return{'model':db[_0x556500[_0x8ba3('0x1b')]],'as':_0x556500['as'],'attributes':_0x556500[_0x8ba3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8ba3('0xb')](function(_0x2806e5){logger[_0x8ba3('0x1c')](_0x8ba3('0x20'),_0x52e795);logger[_0x8ba3('0xd')](_0x8ba3('0x20'),_0x52e795,JSON[_0x8ba3('0x10')](_0x2806e5));_0x1d6715(_0x2806e5);})[_0x8ba3('0x14')](function(_0x2b850a){logger[_0x8ba3('0x11')]('ShowFreshsalesAccount',_0x2b850a[_0x8ba3('0x13')],_0x52e795);_0x98e8e7(_0xd6bc23[_0x8ba3('0x11')](0x1f4,_0x2b850a[_0x8ba3('0x13')]));});});}; \ No newline at end of file +var _0x8af6=['attributes','limit','include','model','map','then','GetFreshsalesAccount','ShowFreshsalesAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','FreshsalesAccount','findAll','options','raw'];(function(_0x43180e,_0x31ddd1){var _0x384e14=function(_0x3fca07){while(--_0x3fca07){_0x43180e['push'](_0x43180e['shift']());}};_0x384e14(++_0x31ddd1);}(_0x8af6,0x76));var _0x68af=function(_0x297fff,_0x1b2f9a){_0x297fff=_0x297fff-0x0;var _0x2c4f26=_0x8af6[_0x297fff];return _0x2c4f26;};'use strict';var _=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var moment=require(_0x68af('0x2'));var BPromise=require(_0x68af('0x3'));var rs=require(_0x68af('0x4'));var fs=require('fs');var Redis=require(_0x68af('0x5'));var db=require(_0x68af('0x6'))['db'];var utils=require(_0x68af('0x7'));var logger=require(_0x68af('0x8'))(_0x68af('0x9'));var config=require('../../config/environment');var jayson=require(_0x68af('0xa'));var client=jayson['client'][_0x68af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be0c1,_0x89146f,_0x1e77b0){return new BPromise(function(_0x3c6018,_0x20d61c){return client[_0x68af('0xc')](_0x2be0c1,_0x1e77b0)['then'](function(_0x56bc37){logger[_0x68af('0xd')](_0x68af('0xe'),_0x89146f,'request\x20sent');logger[_0x68af('0xf')](_0x68af('0x10'),_0x89146f,_0x68af('0x11'),JSON[_0x68af('0x12')](_0x56bc37));if(_0x56bc37[_0x68af('0x13')]){if(_0x56bc37[_0x68af('0x13')]['code']===0x1f4){logger['error'](_0x68af('0xe'),_0x89146f,_0x56bc37['error']['message']);return _0x20d61c(_0x56bc37[_0x68af('0x13')][_0x68af('0x14')]);}logger[_0x68af('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x89146f,_0x56bc37[_0x68af('0x13')]['message']);return _0x3c6018(_0x56bc37[_0x68af('0x13')][_0x68af('0x14')]);}else{logger[_0x68af('0xd')](_0x68af('0xe'),_0x89146f,_0x68af('0x11'));_0x3c6018(_0x56bc37['result'][_0x68af('0x14')]);}})[_0x68af('0x15')](function(_0x326b12){logger[_0x68af('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x89146f,_0x326b12);_0x20d61c(_0x326b12);});});}exports['GetFreshsalesAccount']=function(_0x3aa998){var _0x29ddbf=this;return new Promise(function(_0x4e1c41,_0x9ad23){return db[_0x68af('0x16')][_0x68af('0x17')]({'raw':_0x3aa998[_0x68af('0x18')]?_0x3aa998['options'][_0x68af('0x19')]===undefined?!![]:![]:!![],'where':_0x3aa998[_0x68af('0x18')]?_0x3aa998['options']['where']||null:null,'attributes':_0x3aa998[_0x68af('0x18')]?_0x3aa998[_0x68af('0x18')][_0x68af('0x1a')]||null:null,'limit':_0x3aa998[_0x68af('0x18')]?_0x3aa998[_0x68af('0x18')][_0x68af('0x1b')]||null:null,'include':_0x3aa998['options']?_0x3aa998[_0x68af('0x18')][_0x68af('0x1c')]?_['map'](_0x3aa998[_0x68af('0x18')]['include'],function(_0x13af7b){return{'model':db[_0x13af7b[_0x68af('0x1d')]],'as':_0x13af7b['as'],'attributes':_0x13af7b[_0x68af('0x1a')],'include':_0x13af7b[_0x68af('0x1c')]?_[_0x68af('0x1e')](_0x13af7b[_0x68af('0x1c')],function(_0x5851b9){return{'model':db[_0x5851b9[_0x68af('0x1d')]],'as':_0x5851b9['as'],'attributes':_0x5851b9[_0x68af('0x1a')],'include':_0x5851b9[_0x68af('0x1c')]?_[_0x68af('0x1e')](_0x5851b9[_0x68af('0x1c')],function(_0x375d38){return{'model':db[_0x375d38[_0x68af('0x1d')]],'as':_0x375d38['as'],'attributes':_0x375d38[_0x68af('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x68af('0x1f')](function(_0x5417e9){logger[_0x68af('0xd')](_0x68af('0x20'),_0x3aa998);logger[_0x68af('0xf')](_0x68af('0x20'),_0x3aa998,JSON['stringify'](_0x5417e9));_0x4e1c41(_0x5417e9);})['catch'](function(_0x128d5d){logger[_0x68af('0x13')](_0x68af('0x20'),_0x128d5d['message'],_0x3aa998);_0x9ad23(_0x29ddbf['error'](0x1f4,_0x128d5d[_0x68af('0x14')]));});});};exports[_0x68af('0x21')]=function(_0x5c0adb){var _0x718b39=this;return new Promise(function(_0x2d5aac,_0x21b677){return db[_0x68af('0x16')][_0x68af('0x22')]({'raw':_0x5c0adb[_0x68af('0x18')]?_0x5c0adb[_0x68af('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5c0adb[_0x68af('0x18')]?_0x5c0adb[_0x68af('0x18')][_0x68af('0x23')]||null:null,'attributes':_0x5c0adb['options']?_0x5c0adb[_0x68af('0x18')][_0x68af('0x1a')]||null:null,'include':_0x5c0adb['options']?_0x5c0adb[_0x68af('0x18')][_0x68af('0x1c')]?_['map'](_0x5c0adb[_0x68af('0x18')]['include'],function(_0x48c8b4){return{'model':db[_0x48c8b4[_0x68af('0x1d')]],'as':_0x48c8b4['as'],'attributes':_0x48c8b4[_0x68af('0x1a')],'include':_0x48c8b4[_0x68af('0x1c')]?_[_0x68af('0x1e')](_0x48c8b4[_0x68af('0x1c')],function(_0x39152a){return{'model':db[_0x39152a['model']],'as':_0x39152a['as'],'attributes':_0x39152a['attributes'],'include':_0x39152a['include']?_[_0x68af('0x1e')](_0x39152a[_0x68af('0x1c')],function(_0x47c527){return{'model':db[_0x47c527[_0x68af('0x1d')]],'as':_0x47c527['as'],'attributes':_0x47c527[_0x68af('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x68af('0x1f')](function(_0x486242){logger[_0x68af('0xd')](_0x68af('0x21'),_0x5c0adb);logger[_0x68af('0xf')](_0x68af('0x21'),_0x5c0adb,JSON[_0x68af('0x12')](_0x486242));_0x2d5aac(_0x486242);})['catch'](function(_0x1a8c0d){logger[_0x68af('0x13')](_0x68af('0x21'),_0x1a8c0d[_0x68af('0x14')],_0x5c0adb);_0x21b677(_0x718b39[_0x68af('0x13')](0x1f4,_0x1a8c0d[_0x68af('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 516cdfd..4527885 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 _0xf23c=['/:id/fields','getFields','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','getSubjects','getDescriptions'];(function(_0x580ed2,_0x265c30){var _0x5b8dc3=function(_0x49a15f){while(--_0x49a15f){_0x580ed2['push'](_0x580ed2['shift']());}};_0x5b8dc3(++_0x265c30);}(_0xf23c,0x1b8));var _0xcf23=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xf23c[_0xd0a847];return _0x2536ec;};'use strict';var multer=require('multer');var util=require(_0xcf23('0x0'));var path=require(_0xcf23('0x1'));var timeout=require(_0xcf23('0x2'));var express=require(_0xcf23('0x3'));var router=express[_0xcf23('0x4')]();var fs_extra=require(_0xcf23('0x5'));var auth=require(_0xcf23('0x6'));var interaction=require(_0xcf23('0x7'));var config=require(_0xcf23('0x8'));var controller=require(_0xcf23('0x9'));router[_0xcf23('0xa')]('/',auth[_0xcf23('0xb')](),controller[_0xcf23('0xc')]);router[_0xcf23('0xa')](_0xcf23('0xd'),auth[_0xcf23('0xb')](),controller['show']);router[_0xcf23('0xa')]('/:id/subjects',auth[_0xcf23('0xb')](),controller[_0xcf23('0xe')]);router[_0xcf23('0xa')]('/:id/descriptions',auth[_0xcf23('0xb')](),controller[_0xcf23('0xf')]);router[_0xcf23('0xa')](_0xcf23('0x10'),auth[_0xcf23('0xb')](),controller[_0xcf23('0x11')]);router[_0xcf23('0x12')]('/',auth[_0xcf23('0xb')](),controller[_0xcf23('0x13')]);router[_0xcf23('0x14')](_0xcf23('0xd'),auth[_0xcf23('0xb')](),controller[_0xcf23('0x15')]);router[_0xcf23('0x16')](_0xcf23('0xd'),auth[_0xcf23('0xb')](),controller['destroy']);module[_0xcf23('0x17')]=router; \ No newline at end of file +var _0xcd12=['/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated','get','show','/:id/subjects'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xcd12,0x129));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2cd1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2cd1('0x1'));var express=require('express');var router=express[_0x2cd1('0x2')]();var fs_extra=require(_0x2cd1('0x3'));var auth=require(_0x2cd1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x2cd1('0x5')](),controller['index']);router[_0x2cd1('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2cd1('0x7')]);router[_0x2cd1('0x6')](_0x2cd1('0x8'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2cd1('0x6')](_0x2cd1('0x9'),auth[_0x2cd1('0x5')](),controller[_0x2cd1('0xa')]);router['get']('/:id/fields',auth[_0x2cd1('0x5')](),controller['getFields']);router['post']('/',auth[_0x2cd1('0x5')](),controller[_0x2cd1('0xb')]);router[_0x2cd1('0xc')](_0x2cd1('0xd'),auth[_0x2cd1('0x5')](),controller[_0x2cd1('0xe')]);router[_0x2cd1('0xf')](_0x2cd1('0xd'),auth[_0x2cd1('0x5')](),controller[_0x2cd1('0x10')]);module[_0x2cd1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index eead77c..85a30c9 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 _0x4b75=['sequelize','exports','STRING'];(function(_0x3aa24d,_0x53bf18){var _0x2cb4f0=function(_0xc7df7){while(--_0xc7df7){_0x3aa24d['push'](_0x3aa24d['shift']());}};_0x2cb4f0(++_0x53bf18);}(_0x4b75,0x108));var _0x54b7=function(_0x2b0f25,_0x5e1b2a){_0x2b0f25=_0x2b0f25-0x0;var _0x2ffd4e=_0x4b75[_0x2b0f25];return _0x2ffd4e;};'use strict';var Sequelize=require(_0x54b7('0x0'));module[_0x54b7('0x1')]={'name':{'type':Sequelize[_0x54b7('0x2')]},'description':{'type':Sequelize[_0x54b7('0x2')]}}; \ No newline at end of file +var _0xb45a=['STRING','sequelize','exports'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb45a,0x1a8));var _0xab45=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0xb45a[_0x470e67];return _0x28bbde;};'use strict';var Sequelize=require(_0xab45('0x0'));module[_0xab45('0x1')]={'name':{'type':Sequelize[_0xab45('0x2')]},'description':{'type':Sequelize[_0xab45('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9091962..2b88ef3 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 _0xf003=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','destroy','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','keys','find','create','body','update','FreshsalesField','pick','getSubjects','hasOwnProperty','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel'];(function(_0x3bc061,_0x21609b){var _0x2ba49d=function(_0x52dbdf){while(--_0x52dbdf){_0x3bc061['push'](_0x3bc061['shift']());}};_0x2ba49d(++_0x21609b);}(_0xf003,0x1a6));var _0x3f00=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xf003[_0x4e6eb2];return _0x4e0c1c;};'use strict';var pdf=require(_0x3f00('0x0'));var emlformat=require(_0x3f00('0x1'));var rimraf=require(_0x3f00('0x2'));var zipdir=require(_0x3f00('0x3'));var jsonpatch=require(_0x3f00('0x4'));var rp=require(_0x3f00('0x5'));var moment=require(_0x3f00('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3f00('0x7'));var util=require(_0x3f00('0x8'));var path=require(_0x3f00('0x9'));var sox=require(_0x3f00('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f00('0xb'));var squel=require(_0x3f00('0xc'));var crypto=require(_0x3f00('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3f00('0xe'));var toCsv=require(_0x3f00('0xf'));var querystring=require(_0x3f00('0x10'));var Papa=require(_0x3f00('0x11'));var Redis=require(_0x3f00('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f00('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f00('0x14'))('api');var utils=require(_0x3f00('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3f00('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3f00('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x486a7a,_0x5eb67a,_0x5ab167,_0x564745){return new BPromise(function(_0x52c1ba,_0x20ba70){var _0x40aa36=_0x564745||client;return _0x40aa36[_0x3f00('0x18')](_0x486a7a,_0x5ab167)[_0x3f00('0x19')](function(_0xa58c95){logger[_0x3f00('0x1a')](_0x3f00('0x1b'),_0x5eb67a,_0x3f00('0x1c'));logger[_0x3f00('0x1d')](_0x3f00('0x1e'),_0x5eb67a,_0x3f00('0x1c'),JSON[_0x3f00('0x1f')](_0xa58c95));if(_0xa58c95[_0x3f00('0x20')]){if(_0xa58c95[_0x3f00('0x20')][_0x3f00('0x21')]===0x1f4){logger['error'](_0x3f00('0x1b'),_0x5eb67a,_0xa58c95[_0x3f00('0x20')]['message']);return _0x20ba70(_0xa58c95['error'][_0x3f00('0x22')]);}logger[_0x3f00('0x20')](_0x3f00('0x1b'),_0x5eb67a,_0xa58c95['error'][_0x3f00('0x22')]);return _0x52c1ba(_0xa58c95[_0x3f00('0x20')][_0x3f00('0x22')]);}else{logger['info'](_0x3f00('0x1b'),_0x5eb67a,_0x3f00('0x1c'));_0x52c1ba(_0xa58c95[_0x3f00('0x23')][_0x3f00('0x22')]);}})[_0x3f00('0x24')](function(_0x2c7f0c){logger['error'](_0x3f00('0x1b'),_0x5eb67a,_0x2c7f0c);_0x20ba70(_0x2c7f0c);});});}function respondWithStatusCode(_0xb59e86,_0x3896ea){_0x3896ea=_0x3896ea||0xcc;return function(_0x162103){if(_0x162103){return _0xb59e86[_0x3f00('0x25')](_0x3896ea);}return _0xb59e86[_0x3f00('0x26')](_0x3896ea)[_0x3f00('0x27')]();};}function respondWithResult(_0x24e966,_0xfd0b61){_0xfd0b61=_0xfd0b61||0xc8;return function(_0x48a733){if(_0x48a733){return _0x24e966[_0x3f00('0x26')](_0xfd0b61)[_0x3f00('0x28')](_0x48a733);}};}function respondWithFilteredResult(_0x38d5bc,_0x3f3d30){return function(_0x56afaa){if(_0x56afaa){var _0x124d3c=_0x56afaa[_0x3f00('0x29')],_0x2e600a=_0x3f3d30[_0x3f00('0x2a')],_0x516233=_0x3f3d30[_0x3f00('0x2a')]+_0x3f3d30[_0x3f00('0x2b')],_0x435f4d;if(_0x516233>=_0x124d3c){_0x516233=_0x124d3c;_0x435f4d=0xc8;}else{_0x435f4d=0xce;}_0x38d5bc[_0x3f00('0x26')](_0x435f4d);return _0x38d5bc[_0x3f00('0x2c')](_0x3f00('0x2d'),_0x2e600a+'-'+_0x516233+'/'+_0x124d3c)[_0x3f00('0x28')](_0x56afaa);}return null;};}function patchUpdates(_0x11ecea){return function(_0x402eea){try{jsonpatch['apply'](_0x402eea,_0x11ecea,!![]);}catch(_0x1db428){return BPromise['reject'](_0x1db428);}return _0x402eea['save']();};}function saveUpdates(_0x330cc7,_0x1107c5){return function(_0x41cb03){if(_0x41cb03){return _0x41cb03['update'](_0x330cc7)[_0x3f00('0x19')](function(_0x35f4e4){return _0x35f4e4;});}return null;};}function removeEntity(_0x5f06ae,_0x38d167){return function(_0x1351c4){if(_0x1351c4){return _0x1351c4[_0x3f00('0x2e')]()[_0x3f00('0x19')](function(){_0x5f06ae[_0x3f00('0x26')](0xcc)[_0x3f00('0x27')]();});}};}function handleEntityNotFound(_0x363fc7,_0x589b09){return function(_0x41e0c3){if(!_0x41e0c3){_0x363fc7['sendStatus'](0x194);}return _0x41e0c3;};}function handleError(_0x2836a2,_0x2c384f){_0x2c384f=_0x2c384f||0x1f4;return function(_0x2fb0bc){logger[_0x3f00('0x20')](_0x2fb0bc['stack']);if(_0x2fb0bc[_0x3f00('0x2f')]){delete _0x2fb0bc['name'];}_0x2836a2['status'](_0x2c384f)['send'](_0x2fb0bc);};}exports[_0x3f00('0x30')]=function(_0x288856,_0x4b9b5c){var _0x56ace1={},_0x564add={},_0x471a13={'count':0x0,'rows':[]};var _0x138d3c=_[_0x3f00('0x31')](db[_0x3f00('0x32')][_0x3f00('0x33')],function(_0x1eb51e){return{'name':_0x1eb51e[_0x3f00('0x34')],'type':_0x1eb51e['type'][_0x3f00('0x35')]};});_0x564add['model']=_[_0x3f00('0x31')](_0x138d3c,_0x3f00('0x2f'));_0x564add['query']=_['keys'](_0x288856['query']);_0x564add[_0x3f00('0x36')]=_[_0x3f00('0x37')](_0x564add[_0x3f00('0x38')],_0x564add[_0x3f00('0x39')]);_0x56ace1[_0x3f00('0x3a')]=_[_0x3f00('0x37')](_0x564add[_0x3f00('0x38')],qs[_0x3f00('0x3b')](_0x288856[_0x3f00('0x39')]['fields']));_0x56ace1['attributes']=_0x56ace1[_0x3f00('0x3a')][_0x3f00('0x3c')]?_0x56ace1[_0x3f00('0x3a')]:_0x564add['model'];if(!_0x288856[_0x3f00('0x39')]['hasOwnProperty'](_0x3f00('0x3d'))){_0x56ace1[_0x3f00('0x2b')]=qs[_0x3f00('0x2b')](_0x288856[_0x3f00('0x39')][_0x3f00('0x2b')]);_0x56ace1['offset']=qs[_0x3f00('0x2a')](_0x288856[_0x3f00('0x39')][_0x3f00('0x2a')]);}_0x56ace1[_0x3f00('0x3e')]=qs[_0x3f00('0x3f')](_0x288856[_0x3f00('0x39')]['sort']);_0x56ace1[_0x3f00('0x40')]=qs['filters'](_['pick'](_0x288856['query'],_0x564add['filters']),_0x138d3c);if(_0x288856[_0x3f00('0x39')]['filter']){_0x56ace1[_0x3f00('0x40')]=_[_0x3f00('0x41')](_0x56ace1[_0x3f00('0x40')],{'$or':_[_0x3f00('0x31')](_0x138d3c,function(_0x5a80b1){if(_0x5a80b1[_0x3f00('0x42')]!==_0x3f00('0x43')){var _0x58557f={};_0x58557f[_0x5a80b1['name']]={'$like':'%'+_0x288856[_0x3f00('0x39')][_0x3f00('0x44')]+'%'};return _0x58557f;}})});}_0x56ace1=_[_0x3f00('0x41')]({},_0x56ace1,_0x288856[_0x3f00('0x45')]);var _0x2e2119={'where':_0x56ace1['where']};return db[_0x3f00('0x32')][_0x3f00('0x29')](_0x2e2119)['then'](function(_0x3254ec){_0x471a13[_0x3f00('0x29')]=_0x3254ec;if(_0x288856[_0x3f00('0x39')][_0x3f00('0x46')]){_0x56ace1[_0x3f00('0x47')]=[{'all':!![]}];}return db[_0x3f00('0x32')]['findAll'](_0x56ace1);})[_0x3f00('0x19')](function(_0x1d7a08){_0x471a13[_0x3f00('0x48')]=_0x1d7a08;return _0x471a13;})[_0x3f00('0x19')](respondWithFilteredResult(_0x4b9b5c,_0x56ace1))[_0x3f00('0x24')](handleError(_0x4b9b5c,null));};exports[_0x3f00('0x49')]=function(_0x38d44,_0x3ef937){var _0x54b2fe={'raw':![],'where':{'id':_0x38d44[_0x3f00('0x4a')]['id']}},_0x4fdf03={};_0x4fdf03[_0x3f00('0x38')]=_[_0x3f00('0x4b')](db[_0x3f00('0x32')][_0x3f00('0x33')]);_0x4fdf03[_0x3f00('0x39')]=_['keys'](_0x38d44[_0x3f00('0x39')]);_0x4fdf03[_0x3f00('0x36')]=_[_0x3f00('0x37')](_0x4fdf03[_0x3f00('0x38')],_0x4fdf03[_0x3f00('0x39')]);_0x54b2fe[_0x3f00('0x3a')]=_['intersection'](_0x4fdf03[_0x3f00('0x38')],qs[_0x3f00('0x3b')](_0x38d44[_0x3f00('0x39')][_0x3f00('0x3b')]));_0x54b2fe[_0x3f00('0x3a')]=_0x54b2fe[_0x3f00('0x3a')][_0x3f00('0x3c')]?_0x54b2fe[_0x3f00('0x3a')]:_0x4fdf03['model'];if(_0x38d44[_0x3f00('0x39')][_0x3f00('0x46')]){_0x54b2fe[_0x3f00('0x47')]=[{'all':!![]}];}_0x54b2fe=_[_0x3f00('0x41')]({},_0x54b2fe,_0x38d44[_0x3f00('0x45')]);return db[_0x3f00('0x32')][_0x3f00('0x4c')](_0x54b2fe)['then'](handleEntityNotFound(_0x3ef937,null))['then'](respondWithResult(_0x3ef937,null))['catch'](handleError(_0x3ef937,null));};exports[_0x3f00('0x4d')]=function(_0x20d194,_0x2272da){return db[_0x3f00('0x32')][_0x3f00('0x4d')](_0x20d194[_0x3f00('0x4e')],{})[_0x3f00('0x19')](respondWithResult(_0x2272da,0xc9))['catch'](handleError(_0x2272da,null));};exports[_0x3f00('0x4f')]=function(_0x54e8ee,_0x417522){if(_0x54e8ee[_0x3f00('0x4e')]['id']){delete _0x54e8ee['body']['id'];}return db['FreshsalesConfiguration'][_0x3f00('0x4c')]({'where':{'id':_0x54e8ee['params']['id']}})[_0x3f00('0x19')](handleEntityNotFound(_0x417522,null))[_0x3f00('0x19')](saveUpdates(_0x54e8ee[_0x3f00('0x4e')],null))[_0x3f00('0x19')](respondWithResult(_0x417522,null))[_0x3f00('0x24')](handleError(_0x417522,null));};exports[_0x3f00('0x2e')]=function(_0x57a837,_0x127de6){return db[_0x3f00('0x32')]['find']({'where':{'id':_0x57a837[_0x3f00('0x4a')]['id']}})['then'](handleEntityNotFound(_0x127de6,null))['then'](removeEntity(_0x127de6,null))[_0x3f00('0x24')](handleError(_0x127de6,null));};exports['getSubjects']=function(_0x4c553f,_0x2fadbf,_0x44f8e1){var _0xbd725f={};var _0x54c88b={};var _0x329825;var _0x5eb336;return db[_0x3f00('0x32')]['findOne']({'where':{'id':_0x4c553f[_0x3f00('0x4a')]['id']}})[_0x3f00('0x19')](handleEntityNotFound(_0x2fadbf,null))[_0x3f00('0x19')](function(_0x39df2c){if(_0x39df2c){_0x329825=_0x39df2c;_0x54c88b[_0x3f00('0x38')]=_[_0x3f00('0x4b')](db[_0x3f00('0x50')][_0x3f00('0x33')]);_0x54c88b[_0x3f00('0x39')]=_[_0x3f00('0x4b')](_0x4c553f[_0x3f00('0x39')]);_0x54c88b['filters']=_[_0x3f00('0x37')](_0x54c88b[_0x3f00('0x38')],_0x54c88b[_0x3f00('0x39')]);_0xbd725f[_0x3f00('0x3a')]=_[_0x3f00('0x37')](_0x54c88b[_0x3f00('0x38')],qs[_0x3f00('0x3b')](_0x4c553f[_0x3f00('0x39')][_0x3f00('0x3b')]));_0xbd725f[_0x3f00('0x3a')]=_0xbd725f[_0x3f00('0x3a')][_0x3f00('0x3c')]?_0xbd725f[_0x3f00('0x3a')]:_0x54c88b[_0x3f00('0x38')];_0xbd725f[_0x3f00('0x3e')]=qs[_0x3f00('0x3f')](_0x4c553f[_0x3f00('0x39')][_0x3f00('0x3f')]);_0xbd725f['where']=qs[_0x3f00('0x36')](_[_0x3f00('0x51')](_0x4c553f[_0x3f00('0x39')],_0x54c88b[_0x3f00('0x36')]));if(_0x4c553f[_0x3f00('0x39')][_0x3f00('0x44')]){_0xbd725f[_0x3f00('0x40')]=_[_0x3f00('0x41')](_0xbd725f[_0x3f00('0x40')],{'$or':_['map'](_0xbd725f[_0x3f00('0x3a')],function(_0x142c0a){var _0x28c4b8={};_0x28c4b8[_0x142c0a]={'$like':'%'+_0x4c553f[_0x3f00('0x39')][_0x3f00('0x44')]+'%'};return _0x28c4b8;})});}_0xbd725f=_[_0x3f00('0x41')]({},_0xbd725f,_0x4c553f[_0x3f00('0x45')]);return _0x329825[_0x3f00('0x52')](_0xbd725f);}})[_0x3f00('0x19')](function(_0x4f60ef){if(_0x4f60ef){_0x5eb336=_0x4f60ef[_0x3f00('0x3c')];if(!_0x4c553f[_0x3f00('0x39')][_0x3f00('0x53')]('nolimit')){_0xbd725f[_0x3f00('0x2b')]=qs['limit'](_0x4c553f[_0x3f00('0x39')]['limit']);_0xbd725f[_0x3f00('0x2a')]=qs[_0x3f00('0x2a')](_0x4c553f[_0x3f00('0x39')][_0x3f00('0x2a')]);}return _0x329825['getSubjects'](_0xbd725f);}})['then'](function(_0x3a6e87){if(_0x3a6e87){return _0x3a6e87?{'count':_0x5eb336,'rows':_0x3a6e87}:null;}})[_0x3f00('0x19')](respondWithResult(_0x2fadbf,null))[_0x3f00('0x24')](handleError(_0x2fadbf,null));};exports[_0x3f00('0x54')]=function(_0x489321,_0x45b690,_0x2872b1){var _0x2e4e6c={};var _0x1e9ca3={};var _0x3b1f70;var _0xb7ad2a;return db[_0x3f00('0x32')][_0x3f00('0x55')]({'where':{'id':_0x489321[_0x3f00('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45b690,null))[_0x3f00('0x19')](function(_0x481d29){if(_0x481d29){_0x3b1f70=_0x481d29;_0x1e9ca3['model']=_[_0x3f00('0x4b')](db[_0x3f00('0x50')][_0x3f00('0x33')]);_0x1e9ca3[_0x3f00('0x39')]=_[_0x3f00('0x4b')](_0x489321[_0x3f00('0x39')]);_0x1e9ca3['filters']=_[_0x3f00('0x37')](_0x1e9ca3['model'],_0x1e9ca3[_0x3f00('0x39')]);_0x2e4e6c[_0x3f00('0x3a')]=_[_0x3f00('0x37')](_0x1e9ca3['model'],qs[_0x3f00('0x3b')](_0x489321[_0x3f00('0x39')][_0x3f00('0x3b')]));_0x2e4e6c[_0x3f00('0x3a')]=_0x2e4e6c['attributes'][_0x3f00('0x3c')]?_0x2e4e6c[_0x3f00('0x3a')]:_0x1e9ca3[_0x3f00('0x38')];_0x2e4e6c['order']=qs['sort'](_0x489321['query'][_0x3f00('0x3f')]);_0x2e4e6c[_0x3f00('0x40')]=qs[_0x3f00('0x36')](_[_0x3f00('0x51')](_0x489321[_0x3f00('0x39')],_0x1e9ca3[_0x3f00('0x36')]));if(_0x489321['query'][_0x3f00('0x44')]){_0x2e4e6c[_0x3f00('0x40')]=_[_0x3f00('0x41')](_0x2e4e6c[_0x3f00('0x40')],{'$or':_['map'](_0x2e4e6c[_0x3f00('0x3a')],function(_0x324ef8){var _0x103f26={};_0x103f26[_0x324ef8]={'$like':'%'+_0x489321['query']['filter']+'%'};return _0x103f26;})});}_0x2e4e6c=_[_0x3f00('0x41')]({},_0x2e4e6c,_0x489321[_0x3f00('0x45')]);return _0x3b1f70['getDescriptions'](_0x2e4e6c);}})[_0x3f00('0x19')](function(_0x4a5633){if(_0x4a5633){_0xb7ad2a=_0x4a5633[_0x3f00('0x3c')];if(!_0x489321[_0x3f00('0x39')][_0x3f00('0x53')](_0x3f00('0x3d'))){_0x2e4e6c[_0x3f00('0x2b')]=qs[_0x3f00('0x2b')](_0x489321[_0x3f00('0x39')]['limit']);_0x2e4e6c[_0x3f00('0x2a')]=qs[_0x3f00('0x2a')](_0x489321[_0x3f00('0x39')][_0x3f00('0x2a')]);}return _0x3b1f70['getDescriptions'](_0x2e4e6c);}})['then'](function(_0x18d46a){if(_0x18d46a){return _0x18d46a?{'count':_0xb7ad2a,'rows':_0x18d46a}:null;}})[_0x3f00('0x19')](respondWithResult(_0x45b690,null))[_0x3f00('0x24')](handleError(_0x45b690,null));};exports[_0x3f00('0x56')]=function(_0x1f6744,_0x38945a,_0x126d50){var _0x542163={};var _0x29b0f4={};var _0x33930a;var _0x5dd177;return db['FreshsalesConfiguration'][_0x3f00('0x55')]({'where':{'id':_0x1f6744['params']['id']}})['then'](handleEntityNotFound(_0x38945a,null))[_0x3f00('0x19')](function(_0x2a6b64){if(_0x2a6b64){_0x33930a=_0x2a6b64;_0x29b0f4[_0x3f00('0x38')]=_[_0x3f00('0x4b')](db[_0x3f00('0x50')][_0x3f00('0x33')]);_0x29b0f4[_0x3f00('0x39')]=_['keys'](_0x1f6744['query']);_0x29b0f4['filters']=_['intersection'](_0x29b0f4[_0x3f00('0x38')],_0x29b0f4[_0x3f00('0x39')]);_0x542163[_0x3f00('0x3a')]=_[_0x3f00('0x37')](_0x29b0f4[_0x3f00('0x38')],qs['fields'](_0x1f6744[_0x3f00('0x39')]['fields']));_0x542163[_0x3f00('0x3a')]=_0x542163[_0x3f00('0x3a')]['length']?_0x542163[_0x3f00('0x3a')]:_0x29b0f4[_0x3f00('0x38')];_0x542163[_0x3f00('0x3e')]=qs[_0x3f00('0x3f')](_0x1f6744['query'][_0x3f00('0x3f')]);_0x542163['where']=qs[_0x3f00('0x36')](_[_0x3f00('0x51')](_0x1f6744[_0x3f00('0x39')],_0x29b0f4[_0x3f00('0x36')]));if(_0x1f6744[_0x3f00('0x39')]['filter']){_0x542163[_0x3f00('0x40')]=_[_0x3f00('0x41')](_0x542163[_0x3f00('0x40')],{'$or':_[_0x3f00('0x31')](_0x542163['attributes'],function(_0xee200c){var _0x9b43e0={};_0x9b43e0[_0xee200c]={'$like':'%'+_0x1f6744[_0x3f00('0x39')]['filter']+'%'};return _0x9b43e0;})});}_0x542163=_[_0x3f00('0x41')]({},_0x542163,_0x1f6744['options']);return _0x33930a['getFields'](_0x542163);}})['then'](function(_0x377ea3){if(_0x377ea3){_0x5dd177=_0x377ea3[_0x3f00('0x3c')];if(!_0x1f6744['query'][_0x3f00('0x53')]('nolimit')){_0x542163['limit']=qs['limit'](_0x1f6744['query'][_0x3f00('0x2b')]);_0x542163[_0x3f00('0x2a')]=qs[_0x3f00('0x2a')](_0x1f6744['query'][_0x3f00('0x2a')]);}return _0x33930a['getFields'](_0x542163);}})[_0x3f00('0x19')](function(_0x56b41d){if(_0x56b41d){return _0x56b41d?{'count':_0x5dd177,'rows':_0x56b41d}:null;}})[_0x3f00('0x19')](respondWithResult(_0x38945a,null))[_0x3f00('0x24')](handleError(_0x38945a,null));}; \ No newline at end of file +var _0x5a03=['hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\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','destroy','stack','name','send','map','FreshsalesConfiguration','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','merge','find','create','body','getSubjects','findOne','FreshsalesField','order','nolimit','getDescriptions','getFields'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0x5a03,0x1e6));var _0x35a0=function(_0x594969,_0x1aa124){_0x594969=_0x594969-0x0;var _0xc86317=_0x5a03[_0x594969];return _0xc86317;};'use strict';var pdf=require(_0x35a0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x35a0('0x1'));var zipdir=require(_0x35a0('0x2'));var jsonpatch=require(_0x35a0('0x3'));var rp=require(_0x35a0('0x4'));var moment=require(_0x35a0('0x5'));var BPromise=require(_0x35a0('0x6'));var Mustache=require(_0x35a0('0x7'));var util=require(_0x35a0('0x8'));var path=require(_0x35a0('0x9'));var sox=require(_0x35a0('0xa'));var csv=require(_0x35a0('0xb'));var ejs=require(_0x35a0('0xc'));var fs=require('fs');var fs_extra=require(_0x35a0('0xd'));var _=require(_0x35a0('0xe'));var squel=require(_0x35a0('0xf'));var crypto=require(_0x35a0('0x10'));var jsforce=require(_0x35a0('0x11'));var deskjs=require(_0x35a0('0x12'));var toCsv=require(_0x35a0('0xb'));var querystring=require(_0x35a0('0x13'));var Papa=require(_0x35a0('0x14'));var Redis=require('ioredis');var authService=require(_0x35a0('0x15'));var qs=require(_0x35a0('0x16'));var as=require(_0x35a0('0x17'));var hardwareService=require(_0x35a0('0x18'));var logger=require(_0x35a0('0x19'))(_0x35a0('0x1a'));var utils=require(_0x35a0('0x1b'));var config=require(_0x35a0('0x1c'));var licenseUtil=require(_0x35a0('0x1d'));var db=require('../../mysqldb')['db'];var jayson=require(_0x35a0('0x1e'));var client=jayson[_0x35a0('0x1f')][_0x35a0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x43a8f1,_0x3ecb49,_0x1e9285,_0x80fe67){return new BPromise(function(_0x5ae0fa,_0x2532a1){var _0x1a0ed7=_0x80fe67||client;return _0x1a0ed7[_0x35a0('0x21')](_0x43a8f1,_0x1e9285)[_0x35a0('0x22')](function(_0x18c313){logger[_0x35a0('0x23')](_0x35a0('0x24'),_0x3ecb49,_0x35a0('0x25'));logger[_0x35a0('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3ecb49,_0x35a0('0x25'),JSON[_0x35a0('0x27')](_0x18c313));if(_0x18c313[_0x35a0('0x28')]){if(_0x18c313[_0x35a0('0x28')][_0x35a0('0x29')]===0x1f4){logger['error'](_0x35a0('0x24'),_0x3ecb49,_0x18c313['error'][_0x35a0('0x2a')]);return _0x2532a1(_0x18c313[_0x35a0('0x28')]['message']);}logger[_0x35a0('0x28')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3ecb49,_0x18c313[_0x35a0('0x28')][_0x35a0('0x2a')]);return _0x5ae0fa(_0x18c313[_0x35a0('0x28')][_0x35a0('0x2a')]);}else{logger[_0x35a0('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3ecb49,_0x35a0('0x25'));_0x5ae0fa(_0x18c313['result'][_0x35a0('0x2a')]);}})[_0x35a0('0x2b')](function(_0x379395){logger[_0x35a0('0x28')](_0x35a0('0x24'),_0x3ecb49,_0x379395);_0x2532a1(_0x379395);});});}function respondWithStatusCode(_0x3fd0d8,_0x3e8181){_0x3e8181=_0x3e8181||0xcc;return function(_0x130cb7){if(_0x130cb7){return _0x3fd0d8[_0x35a0('0x2c')](_0x3e8181);}return _0x3fd0d8[_0x35a0('0x2d')](_0x3e8181)[_0x35a0('0x2e')]();};}function respondWithResult(_0x3b3d8c,_0x2964a3){_0x2964a3=_0x2964a3||0xc8;return function(_0xa6eb05){if(_0xa6eb05){return _0x3b3d8c[_0x35a0('0x2d')](_0x2964a3)[_0x35a0('0x2f')](_0xa6eb05);}};}function respondWithFilteredResult(_0xedeb5,_0x383eed){return function(_0x3355eb){if(_0x3355eb){var _0x453c2f=_0x3355eb[_0x35a0('0x30')],_0x201b5e=_0x383eed[_0x35a0('0x31')],_0x22f13b=_0x383eed[_0x35a0('0x31')]+_0x383eed[_0x35a0('0x32')],_0x373e81;if(_0x22f13b>=_0x453c2f){_0x22f13b=_0x453c2f;_0x373e81=0xc8;}else{_0x373e81=0xce;}_0xedeb5[_0x35a0('0x2d')](_0x373e81);return _0xedeb5[_0x35a0('0x33')](_0x35a0('0x34'),_0x201b5e+'-'+_0x22f13b+'/'+_0x453c2f)[_0x35a0('0x2f')](_0x3355eb);}return null;};}function patchUpdates(_0x55dffd){return function(_0x54c146){try{jsonpatch['apply'](_0x54c146,_0x55dffd,!![]);}catch(_0xa714d9){return BPromise[_0x35a0('0x35')](_0xa714d9);}return _0x54c146[_0x35a0('0x36')]();};}function saveUpdates(_0x4e3fc5,_0x2105d0){return function(_0x160d21){if(_0x160d21){return _0x160d21[_0x35a0('0x37')](_0x4e3fc5)['then'](function(_0x435475){return _0x435475;});}return null;};}function removeEntity(_0x4ef593,_0x336144){return function(_0xdfc665){if(_0xdfc665){return _0xdfc665[_0x35a0('0x38')]()[_0x35a0('0x22')](function(){_0x4ef593[_0x35a0('0x2d')](0xcc)[_0x35a0('0x2e')]();});}};}function handleEntityNotFound(_0x551f34,_0x24fe8c){return function(_0x56ddb3){if(!_0x56ddb3){_0x551f34[_0x35a0('0x2c')](0x194);}return _0x56ddb3;};}function handleError(_0x759362,_0x25b75a){_0x25b75a=_0x25b75a||0x1f4;return function(_0x59c98e){logger[_0x35a0('0x28')](_0x59c98e[_0x35a0('0x39')]);if(_0x59c98e[_0x35a0('0x3a')]){delete _0x59c98e['name'];}_0x759362[_0x35a0('0x2d')](_0x25b75a)[_0x35a0('0x3b')](_0x59c98e);};}exports['index']=function(_0x3bfff2,_0x104977){var _0x47897e={},_0x20dec9={},_0x42fb15={'count':0x0,'rows':[]};var _0x54b680=_[_0x35a0('0x3c')](db[_0x35a0('0x3d')][_0x35a0('0x3e')],function(_0x8f1cc8){return{'name':_0x8f1cc8['fieldName'],'type':_0x8f1cc8[_0x35a0('0x3f')][_0x35a0('0x40')]};});_0x20dec9['model']=_[_0x35a0('0x3c')](_0x54b680,_0x35a0('0x3a'));_0x20dec9[_0x35a0('0x41')]=_[_0x35a0('0x42')](_0x3bfff2[_0x35a0('0x41')]);_0x20dec9['filters']=_[_0x35a0('0x43')](_0x20dec9[_0x35a0('0x44')],_0x20dec9[_0x35a0('0x41')]);_0x47897e[_0x35a0('0x45')]=_['intersection'](_0x20dec9[_0x35a0('0x44')],qs[_0x35a0('0x46')](_0x3bfff2['query']['fields']));_0x47897e['attributes']=_0x47897e[_0x35a0('0x45')][_0x35a0('0x47')]?_0x47897e[_0x35a0('0x45')]:_0x20dec9['model'];if(!_0x3bfff2[_0x35a0('0x41')]['hasOwnProperty']('nolimit')){_0x47897e['limit']=qs[_0x35a0('0x32')](_0x3bfff2['query'][_0x35a0('0x32')]);_0x47897e[_0x35a0('0x31')]=qs['offset'](_0x3bfff2[_0x35a0('0x41')][_0x35a0('0x31')]);}_0x47897e['order']=qs[_0x35a0('0x48')](_0x3bfff2[_0x35a0('0x41')][_0x35a0('0x48')]);_0x47897e[_0x35a0('0x49')]=qs[_0x35a0('0x4a')](_[_0x35a0('0x4b')](_0x3bfff2[_0x35a0('0x41')],_0x20dec9[_0x35a0('0x4a')]),_0x54b680);if(_0x3bfff2['query'][_0x35a0('0x4c')]){_0x47897e['where']=_['merge'](_0x47897e[_0x35a0('0x49')],{'$or':_[_0x35a0('0x3c')](_0x54b680,function(_0x36cc3d){if(_0x36cc3d[_0x35a0('0x3f')]!==_0x35a0('0x4d')){var _0x3d1f5e={};_0x3d1f5e[_0x36cc3d[_0x35a0('0x3a')]]={'$like':'%'+_0x3bfff2[_0x35a0('0x41')]['filter']+'%'};return _0x3d1f5e;}})});}_0x47897e=_['merge']({},_0x47897e,_0x3bfff2[_0x35a0('0x4e')]);var _0x499210={'where':_0x47897e[_0x35a0('0x49')]};return db[_0x35a0('0x3d')][_0x35a0('0x30')](_0x499210)[_0x35a0('0x22')](function(_0xce877f){_0x42fb15[_0x35a0('0x30')]=_0xce877f;if(_0x3bfff2[_0x35a0('0x41')][_0x35a0('0x4f')]){_0x47897e['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x35a0('0x50')](_0x47897e);})[_0x35a0('0x22')](function(_0xdad864){_0x42fb15[_0x35a0('0x51')]=_0xdad864;return _0x42fb15;})[_0x35a0('0x22')](respondWithFilteredResult(_0x104977,_0x47897e))[_0x35a0('0x2b')](handleError(_0x104977,null));};exports[_0x35a0('0x52')]=function(_0xc2c2ac,_0x11cb0e){var _0x19a6ad={'raw':![],'where':{'id':_0xc2c2ac[_0x35a0('0x53')]['id']}},_0x3d431e={};_0x3d431e[_0x35a0('0x44')]=_[_0x35a0('0x42')](db[_0x35a0('0x3d')][_0x35a0('0x3e')]);_0x3d431e['query']=_[_0x35a0('0x42')](_0xc2c2ac[_0x35a0('0x41')]);_0x3d431e[_0x35a0('0x4a')]=_['intersection'](_0x3d431e[_0x35a0('0x44')],_0x3d431e[_0x35a0('0x41')]);_0x19a6ad[_0x35a0('0x45')]=_[_0x35a0('0x43')](_0x3d431e[_0x35a0('0x44')],qs['fields'](_0xc2c2ac[_0x35a0('0x41')]['fields']));_0x19a6ad['attributes']=_0x19a6ad['attributes'][_0x35a0('0x47')]?_0x19a6ad[_0x35a0('0x45')]:_0x3d431e['model'];if(_0xc2c2ac['query']['includeAll']){_0x19a6ad[_0x35a0('0x54')]=[{'all':!![]}];}_0x19a6ad=_[_0x35a0('0x55')]({},_0x19a6ad,_0xc2c2ac[_0x35a0('0x4e')]);return db['FreshsalesConfiguration'][_0x35a0('0x56')](_0x19a6ad)[_0x35a0('0x22')](handleEntityNotFound(_0x11cb0e,null))[_0x35a0('0x22')](respondWithResult(_0x11cb0e,null))['catch'](handleError(_0x11cb0e,null));};exports[_0x35a0('0x57')]=function(_0x5d95e8,_0x15245d){return db['FreshsalesConfiguration']['create'](_0x5d95e8['body'],{})[_0x35a0('0x22')](respondWithResult(_0x15245d,0xc9))[_0x35a0('0x2b')](handleError(_0x15245d,null));};exports['update']=function(_0x30125e,_0x343ebe){if(_0x30125e['body']['id']){delete _0x30125e[_0x35a0('0x58')]['id'];}return db[_0x35a0('0x3d')][_0x35a0('0x56')]({'where':{'id':_0x30125e[_0x35a0('0x53')]['id']}})[_0x35a0('0x22')](handleEntityNotFound(_0x343ebe,null))[_0x35a0('0x22')](saveUpdates(_0x30125e[_0x35a0('0x58')],null))[_0x35a0('0x22')](respondWithResult(_0x343ebe,null))['catch'](handleError(_0x343ebe,null));};exports[_0x35a0('0x38')]=function(_0x550e34,_0x415448){return db[_0x35a0('0x3d')][_0x35a0('0x56')]({'where':{'id':_0x550e34['params']['id']}})['then'](handleEntityNotFound(_0x415448,null))['then'](removeEntity(_0x415448,null))[_0x35a0('0x2b')](handleError(_0x415448,null));};exports[_0x35a0('0x59')]=function(_0x2cdcaa,_0x3c76bb,_0x39a8f6){var _0x28ff01={};var _0x5e2e07={};var _0x40b693;var _0x5a6bd8;return db['FreshsalesConfiguration'][_0x35a0('0x5a')]({'where':{'id':_0x2cdcaa[_0x35a0('0x53')]['id']}})[_0x35a0('0x22')](handleEntityNotFound(_0x3c76bb,null))[_0x35a0('0x22')](function(_0x1e7923){if(_0x1e7923){_0x40b693=_0x1e7923;_0x5e2e07['model']=_[_0x35a0('0x42')](db[_0x35a0('0x5b')][_0x35a0('0x3e')]);_0x5e2e07[_0x35a0('0x41')]=_[_0x35a0('0x42')](_0x2cdcaa[_0x35a0('0x41')]);_0x5e2e07[_0x35a0('0x4a')]=_[_0x35a0('0x43')](_0x5e2e07['model'],_0x5e2e07['query']);_0x28ff01[_0x35a0('0x45')]=_[_0x35a0('0x43')](_0x5e2e07[_0x35a0('0x44')],qs[_0x35a0('0x46')](_0x2cdcaa[_0x35a0('0x41')]['fields']));_0x28ff01[_0x35a0('0x45')]=_0x28ff01[_0x35a0('0x45')][_0x35a0('0x47')]?_0x28ff01[_0x35a0('0x45')]:_0x5e2e07[_0x35a0('0x44')];_0x28ff01[_0x35a0('0x5c')]=qs[_0x35a0('0x48')](_0x2cdcaa[_0x35a0('0x41')][_0x35a0('0x48')]);_0x28ff01[_0x35a0('0x49')]=qs[_0x35a0('0x4a')](_[_0x35a0('0x4b')](_0x2cdcaa['query'],_0x5e2e07[_0x35a0('0x4a')]));if(_0x2cdcaa[_0x35a0('0x41')][_0x35a0('0x4c')]){_0x28ff01[_0x35a0('0x49')]=_['merge'](_0x28ff01[_0x35a0('0x49')],{'$or':_['map'](_0x28ff01[_0x35a0('0x45')],function(_0x311fa9){var _0xdd2b59={};_0xdd2b59[_0x311fa9]={'$like':'%'+_0x2cdcaa[_0x35a0('0x41')]['filter']+'%'};return _0xdd2b59;})});}_0x28ff01=_['merge']({},_0x28ff01,_0x2cdcaa[_0x35a0('0x4e')]);return _0x40b693[_0x35a0('0x59')](_0x28ff01);}})[_0x35a0('0x22')](function(_0x5d7778){if(_0x5d7778){_0x5a6bd8=_0x5d7778[_0x35a0('0x47')];if(!_0x2cdcaa[_0x35a0('0x41')]['hasOwnProperty'](_0x35a0('0x5d'))){_0x28ff01[_0x35a0('0x32')]=qs[_0x35a0('0x32')](_0x2cdcaa[_0x35a0('0x41')][_0x35a0('0x32')]);_0x28ff01[_0x35a0('0x31')]=qs[_0x35a0('0x31')](_0x2cdcaa[_0x35a0('0x41')][_0x35a0('0x31')]);}return _0x40b693[_0x35a0('0x59')](_0x28ff01);}})['then'](function(_0x18d634){if(_0x18d634){return _0x18d634?{'count':_0x5a6bd8,'rows':_0x18d634}:null;}})[_0x35a0('0x22')](respondWithResult(_0x3c76bb,null))[_0x35a0('0x2b')](handleError(_0x3c76bb,null));};exports[_0x35a0('0x5e')]=function(_0x5bf0ab,_0x54826c,_0x2297e7){var _0x5d044c={};var _0x3ac607={};var _0x38c1d1;var _0x11dc95;return db[_0x35a0('0x3d')][_0x35a0('0x5a')]({'where':{'id':_0x5bf0ab[_0x35a0('0x53')]['id']}})['then'](handleEntityNotFound(_0x54826c,null))[_0x35a0('0x22')](function(_0x10a9fd){if(_0x10a9fd){_0x38c1d1=_0x10a9fd;_0x3ac607[_0x35a0('0x44')]=_['keys'](db['FreshsalesField'][_0x35a0('0x3e')]);_0x3ac607[_0x35a0('0x41')]=_[_0x35a0('0x42')](_0x5bf0ab[_0x35a0('0x41')]);_0x3ac607[_0x35a0('0x4a')]=_[_0x35a0('0x43')](_0x3ac607[_0x35a0('0x44')],_0x3ac607[_0x35a0('0x41')]);_0x5d044c[_0x35a0('0x45')]=_['intersection'](_0x3ac607['model'],qs[_0x35a0('0x46')](_0x5bf0ab[_0x35a0('0x41')][_0x35a0('0x46')]));_0x5d044c[_0x35a0('0x45')]=_0x5d044c[_0x35a0('0x45')]['length']?_0x5d044c[_0x35a0('0x45')]:_0x3ac607[_0x35a0('0x44')];_0x5d044c[_0x35a0('0x5c')]=qs['sort'](_0x5bf0ab[_0x35a0('0x41')][_0x35a0('0x48')]);_0x5d044c['where']=qs[_0x35a0('0x4a')](_[_0x35a0('0x4b')](_0x5bf0ab[_0x35a0('0x41')],_0x3ac607[_0x35a0('0x4a')]));if(_0x5bf0ab['query'][_0x35a0('0x4c')]){_0x5d044c['where']=_['merge'](_0x5d044c['where'],{'$or':_[_0x35a0('0x3c')](_0x5d044c[_0x35a0('0x45')],function(_0x342e25){var _0xcd4ce0={};_0xcd4ce0[_0x342e25]={'$like':'%'+_0x5bf0ab[_0x35a0('0x41')][_0x35a0('0x4c')]+'%'};return _0xcd4ce0;})});}_0x5d044c=_[_0x35a0('0x55')]({},_0x5d044c,_0x5bf0ab[_0x35a0('0x4e')]);return _0x38c1d1[_0x35a0('0x5e')](_0x5d044c);}})[_0x35a0('0x22')](function(_0x298e9b){if(_0x298e9b){_0x11dc95=_0x298e9b[_0x35a0('0x47')];if(!_0x5bf0ab[_0x35a0('0x41')]['hasOwnProperty'](_0x35a0('0x5d'))){_0x5d044c[_0x35a0('0x32')]=qs[_0x35a0('0x32')](_0x5bf0ab['query'][_0x35a0('0x32')]);_0x5d044c['offset']=qs[_0x35a0('0x31')](_0x5bf0ab[_0x35a0('0x41')][_0x35a0('0x31')]);}return _0x38c1d1[_0x35a0('0x5e')](_0x5d044c);}})[_0x35a0('0x22')](function(_0x286218){if(_0x286218){return _0x286218?{'count':_0x11dc95,'rows':_0x286218}:null;}})['then'](respondWithResult(_0x54826c,null))['catch'](handleError(_0x54826c,null));};exports[_0x35a0('0x5f')]=function(_0x57c080,_0x3d8948,_0x12168b){var _0x3869a6={};var _0x241a9b={};var _0x26e458;var _0x2a1095;return db[_0x35a0('0x3d')][_0x35a0('0x5a')]({'where':{'id':_0x57c080['params']['id']}})[_0x35a0('0x22')](handleEntityNotFound(_0x3d8948,null))[_0x35a0('0x22')](function(_0xb6aa4d){if(_0xb6aa4d){_0x26e458=_0xb6aa4d;_0x241a9b[_0x35a0('0x44')]=_['keys'](db[_0x35a0('0x5b')][_0x35a0('0x3e')]);_0x241a9b[_0x35a0('0x41')]=_['keys'](_0x57c080[_0x35a0('0x41')]);_0x241a9b[_0x35a0('0x4a')]=_[_0x35a0('0x43')](_0x241a9b['model'],_0x241a9b[_0x35a0('0x41')]);_0x3869a6[_0x35a0('0x45')]=_[_0x35a0('0x43')](_0x241a9b[_0x35a0('0x44')],qs[_0x35a0('0x46')](_0x57c080[_0x35a0('0x41')][_0x35a0('0x46')]));_0x3869a6[_0x35a0('0x45')]=_0x3869a6[_0x35a0('0x45')][_0x35a0('0x47')]?_0x3869a6[_0x35a0('0x45')]:_0x241a9b['model'];_0x3869a6[_0x35a0('0x5c')]=qs[_0x35a0('0x48')](_0x57c080['query'][_0x35a0('0x48')]);_0x3869a6['where']=qs[_0x35a0('0x4a')](_[_0x35a0('0x4b')](_0x57c080['query'],_0x241a9b[_0x35a0('0x4a')]));if(_0x57c080[_0x35a0('0x41')][_0x35a0('0x4c')]){_0x3869a6[_0x35a0('0x49')]=_['merge'](_0x3869a6[_0x35a0('0x49')],{'$or':_[_0x35a0('0x3c')](_0x3869a6['attributes'],function(_0x5035ca){var _0xc8bb6={};_0xc8bb6[_0x5035ca]={'$like':'%'+_0x57c080[_0x35a0('0x41')][_0x35a0('0x4c')]+'%'};return _0xc8bb6;})});}_0x3869a6=_[_0x35a0('0x55')]({},_0x3869a6,_0x57c080['options']);return _0x26e458[_0x35a0('0x5f')](_0x3869a6);}})[_0x35a0('0x22')](function(_0x51071d){if(_0x51071d){_0x2a1095=_0x51071d[_0x35a0('0x47')];if(!_0x57c080[_0x35a0('0x41')][_0x35a0('0x60')](_0x35a0('0x5d'))){_0x3869a6[_0x35a0('0x32')]=qs[_0x35a0('0x32')](_0x57c080[_0x35a0('0x41')]['limit']);_0x3869a6['offset']=qs['offset'](_0x57c080[_0x35a0('0x41')][_0x35a0('0x31')]);}return _0x26e458[_0x35a0('0x5f')](_0x3869a6);}})['then'](function(_0x39ca95){if(_0x39ca95){return _0x39ca95?{'count':_0x2a1095,'rows':_0x39ca95}:null;}})[_0x35a0('0x22')](respondWithResult(_0x3d8948,null))[_0x35a0('0x2b')](handleError(_0x3d8948,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c3804b7..3b9cfc0 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 _0x29c1=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api'];(function(_0x48fa19,_0x449238){var _0x3bacdf=function(_0x2b7979){while(--_0x2b7979){_0x48fa19['push'](_0x48fa19['shift']());}};_0x3bacdf(++_0x449238);}(_0x29c1,0x72));var _0x129c=function(_0x553fd7,_0x558cb3){_0x553fd7=_0x553fd7-0x0;var _0x257e7c=_0x29c1[_0x553fd7];return _0x257e7c;};'use strict';var _=require('lodash');var util=require(_0x129c('0x0'));var logger=require(_0x129c('0x1'))(_0x129c('0x2'));var moment=require('moment');var BPromise=require(_0x129c('0x3'));var rp=require(_0x129c('0x4'));var fs=require('fs');var path=require(_0x129c('0x5'));var rimraf=require(_0x129c('0x6'));var config=require(_0x129c('0x7'));var attributes=require(_0x129c('0x8'));module[_0x129c('0x9')]=function(_0x4f4ab5,_0x3e241f){return _0x4f4ab5[_0x129c('0xa')](_0x129c('0xb'),attributes,{'tableName':_0x129c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4fb=['request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','api','moment','bluebird'];(function(_0x23f0df,_0x55e679){var _0x1564b2=function(_0x53e00c){while(--_0x53e00c){_0x23f0df['push'](_0x23f0df['shift']());}};_0x1564b2(++_0x55e679);}(_0xe4fb,0x9d));var _0xbe4f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe4fb[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbe4f('0x0'));var moment=require(_0xbe4f('0x1'));var BPromise=require(_0xbe4f('0x2'));var rp=require(_0xbe4f('0x3'));var fs=require('fs');var path=require(_0xbe4f('0x4'));var rimraf=require(_0xbe4f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbe4f('0x6'));module['exports']=function(_0x362596,_0x1a9396){return _0x362596['define'](_0xbe4f('0x7'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 9cb1730..b431645 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 _0x1707=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../config/utils'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1707,0x1df));var _0x7170=function(_0x53d380,_0x407ea3){_0x53d380=_0x53d380-0x0;var _0x54aeb7=_0x1707[_0x53d380];return _0x54aeb7;};'use strict';var _=require(_0x7170('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7170('0x1'));var fs=require('fs');var Redis=require(_0x7170('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7170('0x3'));var logger=require(_0x7170('0x4'))(_0x7170('0x5'));var config=require(_0x7170('0x6'));var jayson=require(_0x7170('0x7'));var client=jayson[_0x7170('0x8')][_0x7170('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cfade,_0x106886,_0x1f574e){return new BPromise(function(_0x1d6a14,_0x3b56ae){return client[_0x7170('0xa')](_0x1cfade,_0x1f574e)[_0x7170('0xb')](function(_0x1f6319){logger[_0x7170('0xc')](_0x7170('0xd'),_0x106886,'request\x20sent');logger[_0x7170('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x106886,_0x7170('0xf'),JSON[_0x7170('0x10')](_0x1f6319));if(_0x1f6319[_0x7170('0x11')]){if(_0x1f6319['error']['code']===0x1f4){logger['error'](_0x7170('0xd'),_0x106886,_0x1f6319[_0x7170('0x11')]['message']);return _0x3b56ae(_0x1f6319[_0x7170('0x11')][_0x7170('0x12')]);}logger[_0x7170('0x11')](_0x7170('0xd'),_0x106886,_0x1f6319[_0x7170('0x11')][_0x7170('0x12')]);return _0x1d6a14(_0x1f6319['error']['message']);}else{logger[_0x7170('0xc')](_0x7170('0xd'),_0x106886,_0x7170('0xf'));_0x1d6a14(_0x1f6319[_0x7170('0x13')]['message']);}})[_0x7170('0x14')](function(_0x53f51d){logger[_0x7170('0x11')](_0x7170('0xd'),_0x106886,_0x53f51d);_0x3b56ae(_0x53f51d);});});} \ No newline at end of file +var _0x0472=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0472,0x197));var _0x2047=function(_0x501e64,_0x214f41){_0x501e64=_0x501e64-0x0;var _0x24f66b=_0x0472[_0x501e64];return _0x24f66b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2047('0x0'));var BPromise=require('bluebird');var rs=require(_0x2047('0x1'));var fs=require('fs');var Redis=require(_0x2047('0x2'));var db=require(_0x2047('0x3'))['db'];var utils=require(_0x2047('0x4'));var logger=require('../../config/logger')(_0x2047('0x5'));var config=require('../../config/environment');var jayson=require(_0x2047('0x6'));var client=jayson[_0x2047('0x7')][_0x2047('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14bf92,_0x487d16,_0x8561de){return new BPromise(function(_0x29f752,_0x236708){return client[_0x2047('0x9')](_0x14bf92,_0x8561de)[_0x2047('0xa')](function(_0xfaf294){logger[_0x2047('0xb')](_0x2047('0xc'),_0x487d16,_0x2047('0xd'));logger['debug'](_0x2047('0xe'),_0x487d16,_0x2047('0xd'),JSON['stringify'](_0xfaf294));if(_0xfaf294[_0x2047('0xf')]){if(_0xfaf294[_0x2047('0xf')][_0x2047('0x10')]===0x1f4){logger[_0x2047('0xf')](_0x2047('0xc'),_0x487d16,_0xfaf294[_0x2047('0xf')][_0x2047('0x11')]);return _0x236708(_0xfaf294[_0x2047('0xf')][_0x2047('0x11')]);}logger[_0x2047('0xf')](_0x2047('0xc'),_0x487d16,_0xfaf294[_0x2047('0xf')]['message']);return _0x29f752(_0xfaf294[_0x2047('0xf')][_0x2047('0x11')]);}else{logger[_0x2047('0xb')](_0x2047('0xc'),_0x487d16,_0x2047('0xd'));_0x29f752(_0xfaf294['result'][_0x2047('0x11')]);}})[_0x2047('0x12')](function(_0x354cb1){logger[_0x2047('0xf')](_0x2047('0xc'),_0x487d16,_0x354cb1);_0x236708(_0x354cb1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index ac9a2bc..9214371 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 _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x599d65,_0x1029b8){var _0x568288=function(_0x2536bc){while(--_0x2536bc){_0x599d65['push'](_0x599d65['shift']());}};_0x568288(++_0x1029b8);}(_0x4024,0x89));var _0x4402=function(_0x23530e,_0x431413){_0x23530e=_0x23530e-0x0;var _0x123f1b=_0x4024[_0x23530e];return _0x123f1b;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file +var _0x1339=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x1339,0x1ed));var _0x9133=function(_0x54deaf,_0x5ce595){_0x54deaf=_0x54deaf-0x0;var _0x25dfc2=_0x1339[_0x54deaf];return _0x25dfc2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0xd')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['delete'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);module[_0x9133('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f1e4373..fd403fd 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 _0xee14=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0xb46866,_0x542a79){var _0x3dfbb1=function(_0x597ffc){while(--_0x597ffc){_0xb46866['push'](_0xb46866['shift']());}};_0x3dfbb1(++_0x542a79);}(_0xee14,0x13a));var _0x4ee1=function(_0x54a301,_0x35484b){_0x54a301=_0x54a301-0x0;var _0x42689d=_0xee14[_0x54a301];return _0x42689d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4ee1('0x0')](_0x4ee1('0x1'),_0x4ee1('0x2'),_0x4ee1('0x3'),_0x4ee1('0x4'),_0x4ee1('0x5')),'defaultValue':_0x4ee1('0x1')},'content':{'type':Sequelize[_0x4ee1('0x6')]},'key':{'type':Sequelize[_0x4ee1('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4ee1('0x1'),'variable',_0x4ee1('0x3'))},'keyContent':{'type':Sequelize[_0x4ee1('0x6')]},'idField':{'type':Sequelize[_0x4ee1('0x6')]},'nameField':{'type':Sequelize[_0x4ee1('0x6')]},'customField':{'type':Sequelize[_0x4ee1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4ee1('0x6')]}}; \ No newline at end of file +var _0xc949=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x1a36bb,_0x9e8fcf){var _0x1aad16=function(_0x29e6eb){while(--_0x29e6eb){_0x1a36bb['push'](_0x1a36bb['shift']());}};_0x1aad16(++_0x9e8fcf);}(_0xc949,0x181));var _0x9c94=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xc949[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0x9c94('0x0'));module['exports']={'type':{'type':Sequelize[_0x9c94('0x1')](_0x9c94('0x2'),_0x9c94('0x3'),_0x9c94('0x4'),'keyValue',_0x9c94('0x5')),'defaultValue':_0x9c94('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9c94('0x6')]},'keyType':{'type':Sequelize[_0x9c94('0x1')](_0x9c94('0x2'),_0x9c94('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9c94('0x6')]},'idField':{'type':Sequelize[_0x9c94('0x6')]},'nameField':{'type':Sequelize[_0x9c94('0x6')]},'customField':{'type':Sequelize[_0x9c94('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c94('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fee8e60..c4c4661 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 _0x2032=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','sendStatus','stack','name','send','index','map','FreshsalesField','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','include','findAll','show','params','rawAttributes','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x24db71,_0x1c463f){var _0x466dbd=function(_0x2f8680){while(--_0x2f8680){_0x24db71['push'](_0x24db71['shift']());}};_0x466dbd(++_0x1c463f);}(_0x2032,0xd9));var _0x2203=function(_0x61e917,_0x1b1953){_0x61e917=_0x61e917-0x0;var _0xec02c0=_0x2032[_0x61e917];return _0xec02c0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2203('0x0'));var rimraf=require(_0x2203('0x1'));var zipdir=require(_0x2203('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2203('0x3'));var moment=require(_0x2203('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2203('0x5'));var util=require(_0x2203('0x6'));var path=require(_0x2203('0x7'));var sox=require(_0x2203('0x8'));var csv=require(_0x2203('0x9'));var ejs=require(_0x2203('0xa'));var fs=require('fs');var fs_extra=require(_0x2203('0xb'));var _=require(_0x2203('0xc'));var squel=require(_0x2203('0xd'));var crypto=require(_0x2203('0xe'));var jsforce=require(_0x2203('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2203('0x10'));var Papa=require('papaparse');var Redis=require(_0x2203('0x11'));var authService=require(_0x2203('0x12'));var qs=require(_0x2203('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2203('0x14'));var logger=require('../../config/logger')(_0x2203('0x15'));var utils=require('../../config/utils');var config=require(_0x2203('0x16'));var licenseUtil=require(_0x2203('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x583bc7,_0x585c76){_0x585c76=_0x585c76||0xcc;return function(_0x5f56ff){if(_0x5f56ff){return _0x583bc7['sendStatus'](_0x585c76);}return _0x583bc7[_0x2203('0x18')](_0x585c76)['end']();};}function respondWithResult(_0x592e47,_0x21a3af){_0x21a3af=_0x21a3af||0xc8;return function(_0x472265){if(_0x472265){return _0x592e47[_0x2203('0x18')](_0x21a3af)[_0x2203('0x19')](_0x472265);}};}function respondWithFilteredResult(_0x226209,_0x3fe0a8){return function(_0x2c36e6){if(_0x2c36e6){var _0x2c085c=_0x2c36e6[_0x2203('0x1a')],_0xdf9d0b=_0x3fe0a8[_0x2203('0x1b')],_0x3053f3=_0x3fe0a8['offset']+_0x3fe0a8[_0x2203('0x1c')],_0x5129fb;if(_0x3053f3>=_0x2c085c){_0x3053f3=_0x2c085c;_0x5129fb=0xc8;}else{_0x5129fb=0xce;}_0x226209[_0x2203('0x18')](_0x5129fb);return _0x226209['set'](_0x2203('0x1d'),_0xdf9d0b+'-'+_0x3053f3+'/'+_0x2c085c)['json'](_0x2c36e6);}return null;};}function patchUpdates(_0x2904ba){return function(_0x310b8c){try{jsonpatch[_0x2203('0x1e')](_0x310b8c,_0x2904ba,!![]);}catch(_0x3b4034){return BPromise[_0x2203('0x1f')](_0x3b4034);}return _0x310b8c[_0x2203('0x20')]();};}function saveUpdates(_0x538c23,_0x13d3f7){return function(_0x50822b){if(_0x50822b){return _0x50822b['update'](_0x538c23)[_0x2203('0x21')](function(_0x496d82){return _0x496d82;});}return null;};}function removeEntity(_0x3b8ef9,_0x5bfe61){return function(_0x5d4c4e){if(_0x5d4c4e){return _0x5d4c4e[_0x2203('0x22')]()['then'](function(){_0x3b8ef9['status'](0xcc)[_0x2203('0x23')]();});}};}function handleEntityNotFound(_0x2718f5,_0x21f930){return function(_0xfd0970){if(!_0xfd0970){_0x2718f5[_0x2203('0x24')](0x194);}return _0xfd0970;};}function handleError(_0x3114ef,_0x49c12){_0x49c12=_0x49c12||0x1f4;return function(_0x250349){logger['error'](_0x250349[_0x2203('0x25')]);if(_0x250349[_0x2203('0x26')]){delete _0x250349[_0x2203('0x26')];}_0x3114ef['status'](_0x49c12)[_0x2203('0x27')](_0x250349);};}exports[_0x2203('0x28')]=function(_0x5c5fd3,_0xd6e109){var _0xd91f5d={},_0x1c6a77={},_0x46b8b9={'count':0x0,'rows':[]};var _0x28ae02=_[_0x2203('0x29')](db[_0x2203('0x2a')]['rawAttributes'],function(_0x34b8ba){return{'name':_0x34b8ba[_0x2203('0x2b')],'type':_0x34b8ba[_0x2203('0x2c')][_0x2203('0x2d')]};});_0x1c6a77['model']=_[_0x2203('0x29')](_0x28ae02,_0x2203('0x26'));_0x1c6a77[_0x2203('0x2e')]=_[_0x2203('0x2f')](_0x5c5fd3['query']);_0x1c6a77[_0x2203('0x30')]=_[_0x2203('0x31')](_0x1c6a77['model'],_0x1c6a77['query']);_0xd91f5d[_0x2203('0x32')]=_['intersection'](_0x1c6a77['model'],qs[_0x2203('0x33')](_0x5c5fd3[_0x2203('0x2e')][_0x2203('0x33')]));_0xd91f5d[_0x2203('0x32')]=_0xd91f5d[_0x2203('0x32')]['length']?_0xd91f5d[_0x2203('0x32')]:_0x1c6a77[_0x2203('0x34')];if(!_0x5c5fd3['query'][_0x2203('0x35')](_0x2203('0x36'))){_0xd91f5d[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5c5fd3[_0x2203('0x2e')][_0x2203('0x1c')]);_0xd91f5d[_0x2203('0x1b')]=qs[_0x2203('0x1b')](_0x5c5fd3[_0x2203('0x2e')]['offset']);}_0xd91f5d[_0x2203('0x37')]=qs[_0x2203('0x38')](_0x5c5fd3['query']['sort']);_0xd91f5d[_0x2203('0x39')]=qs['filters'](_[_0x2203('0x3a')](_0x5c5fd3[_0x2203('0x2e')],_0x1c6a77[_0x2203('0x30')]),_0x28ae02);if(_0x5c5fd3['query']['filter']){_0xd91f5d[_0x2203('0x39')]=_['merge'](_0xd91f5d[_0x2203('0x39')],{'$or':_['map'](_0x28ae02,function(_0x11451e){if(_0x11451e['type']!==_0x2203('0x3b')){var _0x13ed9e={};_0x13ed9e[_0x11451e[_0x2203('0x26')]]={'$like':'%'+_0x5c5fd3[_0x2203('0x2e')][_0x2203('0x3c')]+'%'};return _0x13ed9e;}})});}_0xd91f5d=_['merge']({},_0xd91f5d,_0x5c5fd3['options']);var _0x4c0e9e={'where':_0xd91f5d[_0x2203('0x39')]};return db[_0x2203('0x2a')][_0x2203('0x1a')](_0x4c0e9e)[_0x2203('0x21')](function(_0x3283fb){_0x46b8b9[_0x2203('0x1a')]=_0x3283fb;if(_0x5c5fd3[_0x2203('0x2e')]['includeAll']){_0xd91f5d[_0x2203('0x3d')]=[{'all':!![]}];}return db[_0x2203('0x2a')][_0x2203('0x3e')](_0xd91f5d);})[_0x2203('0x21')](function(_0x493d12){_0x46b8b9['rows']=_0x493d12;return _0x46b8b9;})[_0x2203('0x21')](respondWithFilteredResult(_0xd6e109,_0xd91f5d))['catch'](handleError(_0xd6e109,null));};exports[_0x2203('0x3f')]=function(_0x446209,_0x132091){var _0x548e06={'raw':!![],'where':{'id':_0x446209[_0x2203('0x40')]['id']}},_0x5bba52={};_0x5bba52[_0x2203('0x34')]=_[_0x2203('0x2f')](db[_0x2203('0x2a')][_0x2203('0x41')]);_0x5bba52[_0x2203('0x2e')]=_['keys'](_0x446209[_0x2203('0x2e')]);_0x5bba52[_0x2203('0x30')]=_[_0x2203('0x31')](_0x5bba52[_0x2203('0x34')],_0x5bba52[_0x2203('0x2e')]);_0x548e06[_0x2203('0x32')]=_[_0x2203('0x31')](_0x5bba52[_0x2203('0x34')],qs[_0x2203('0x33')](_0x446209[_0x2203('0x2e')]['fields']));_0x548e06[_0x2203('0x32')]=_0x548e06[_0x2203('0x32')][_0x2203('0x42')]?_0x548e06[_0x2203('0x32')]:_0x5bba52['model'];if(_0x446209['query'][_0x2203('0x43')]){_0x548e06['include']=[{'all':!![]}];}_0x548e06=_[_0x2203('0x44')]({},_0x548e06,_0x446209[_0x2203('0x45')]);return db[_0x2203('0x2a')][_0x2203('0x46')](_0x548e06)['then'](handleEntityNotFound(_0x132091,null))[_0x2203('0x21')](respondWithResult(_0x132091,null))[_0x2203('0x47')](handleError(_0x132091,null));};exports['create']=function(_0x29bd91,_0x381b3e){return db[_0x2203('0x2a')][_0x2203('0x48')](_0x29bd91['body'],{})['then'](respondWithResult(_0x381b3e,0xc9))[_0x2203('0x47')](handleError(_0x381b3e,null));};exports['update']=function(_0x543fde,_0x450082){if(_0x543fde[_0x2203('0x49')]['id']){delete _0x543fde[_0x2203('0x49')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x543fde[_0x2203('0x40')]['id']}})[_0x2203('0x21')](handleEntityNotFound(_0x450082,null))[_0x2203('0x21')](saveUpdates(_0x543fde[_0x2203('0x49')],null))[_0x2203('0x21')](respondWithResult(_0x450082,null))[_0x2203('0x47')](handleError(_0x450082,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2a')][_0x2203('0x46')]({'where':{'id':_0x747dce[_0x2203('0x40')]['id']}})[_0x2203('0x21')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));}; \ No newline at end of file +var _0xb10b=['ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','intersection','include','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x46c6a2,_0x441de6){var _0x3d6fe8=function(_0x3791a9){while(--_0x3791a9){_0x46c6a2['push'](_0x46c6a2['shift']());}};_0x3d6fe8(++_0x441de6);}(_0xb10b,0x12a));var _0xbb10=function(_0x495ebf,_0x27df21){_0x495ebf=_0x495ebf-0x0;var _0x5841ef=_0xb10b[_0x495ebf];return _0x5841ef;};'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 fs_extra=require(_0xbb10('0xb'));var _=require('lodash');var squel=require(_0xbb10('0xc'));var crypto=require(_0xbb10('0xd'));var jsforce=require(_0xbb10('0xe'));var deskjs=require(_0xbb10('0xf'));var toCsv=require(_0xbb10('0x10'));var querystring=require(_0xbb10('0x11'));var Papa=require(_0xbb10('0x12'));var Redis=require(_0xbb10('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb10('0x14'));var hardwareService=require(_0xbb10('0x15'));var logger=require(_0xbb10('0x16'))('api');var utils=require(_0xbb10('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbb10('0x18'));var db=require(_0xbb10('0x19'))['db'];function respondWithStatusCode(_0x285009,_0x193a27){_0x193a27=_0x193a27||0xcc;return function(_0x442548){if(_0x442548){return _0x285009[_0xbb10('0x1a')](_0x193a27);}return _0x285009['status'](_0x193a27)[_0xbb10('0x1b')]();};}function respondWithResult(_0x42d7e4,_0x45b9d6){_0x45b9d6=_0x45b9d6||0xc8;return function(_0x17fd46){if(_0x17fd46){return _0x42d7e4[_0xbb10('0x1c')](_0x45b9d6)[_0xbb10('0x1d')](_0x17fd46);}};}function respondWithFilteredResult(_0x24a57b,_0x36b5e8){return function(_0x3e26f4){if(_0x3e26f4){var _0x2b184e=_0x3e26f4[_0xbb10('0x1e')],_0x4a2bfc=_0x36b5e8[_0xbb10('0x1f')],_0x2eca0f=_0x36b5e8[_0xbb10('0x1f')]+_0x36b5e8[_0xbb10('0x20')],_0x1145f1;if(_0x2eca0f>=_0x2b184e){_0x2eca0f=_0x2b184e;_0x1145f1=0xc8;}else{_0x1145f1=0xce;}_0x24a57b[_0xbb10('0x1c')](_0x1145f1);return _0x24a57b[_0xbb10('0x21')](_0xbb10('0x22'),_0x4a2bfc+'-'+_0x2eca0f+'/'+_0x2b184e)[_0xbb10('0x1d')](_0x3e26f4);}return null;};}function patchUpdates(_0x48b6e9){return function(_0x5ff0cf){try{jsonpatch[_0xbb10('0x23')](_0x5ff0cf,_0x48b6e9,!![]);}catch(_0x388fab){return BPromise[_0xbb10('0x24')](_0x388fab);}return _0x5ff0cf[_0xbb10('0x25')]();};}function saveUpdates(_0x44e563,_0x4deb49){return function(_0x12f888){if(_0x12f888){return _0x12f888[_0xbb10('0x26')](_0x44e563)['then'](function(_0x4c4b0d){return _0x4c4b0d;});}return null;};}function removeEntity(_0x8e2b97,_0x311abe){return function(_0x2e911d){if(_0x2e911d){return _0x2e911d[_0xbb10('0x27')]()[_0xbb10('0x28')](function(){_0x8e2b97[_0xbb10('0x1c')](0xcc)[_0xbb10('0x1b')]();});}};}function handleEntityNotFound(_0x436104,_0x7f2377){return function(_0x395404){if(!_0x395404){_0x436104[_0xbb10('0x1a')](0x194);}return _0x395404;};}function handleError(_0x26ad93,_0x537898){_0x537898=_0x537898||0x1f4;return function(_0x4fedac){logger['error'](_0x4fedac[_0xbb10('0x29')]);if(_0x4fedac[_0xbb10('0x2a')]){delete _0x4fedac[_0xbb10('0x2a')];}_0x26ad93['status'](_0x537898)[_0xbb10('0x2b')](_0x4fedac);};}exports[_0xbb10('0x2c')]=function(_0x6ed43b,_0x1d5e95){var _0x1acce9={},_0x20d946={},_0x2a0e8b={'count':0x0,'rows':[]};var _0x4aabb9=_[_0xbb10('0x2d')](db[_0xbb10('0x2e')][_0xbb10('0x2f')],function(_0x2e0249){return{'name':_0x2e0249[_0xbb10('0x30')],'type':_0x2e0249[_0xbb10('0x31')]['key']};});_0x20d946[_0xbb10('0x32')]=_['map'](_0x4aabb9,_0xbb10('0x2a'));_0x20d946['query']=_[_0xbb10('0x33')](_0x6ed43b[_0xbb10('0x34')]);_0x20d946[_0xbb10('0x35')]=_['intersection'](_0x20d946['model'],_0x20d946[_0xbb10('0x34')]);_0x1acce9[_0xbb10('0x36')]=_['intersection'](_0x20d946[_0xbb10('0x32')],qs[_0xbb10('0x37')](_0x6ed43b[_0xbb10('0x34')][_0xbb10('0x37')]));_0x1acce9[_0xbb10('0x36')]=_0x1acce9[_0xbb10('0x36')][_0xbb10('0x38')]?_0x1acce9['attributes']:_0x20d946[_0xbb10('0x32')];if(!_0x6ed43b[_0xbb10('0x34')][_0xbb10('0x39')](_0xbb10('0x3a'))){_0x1acce9[_0xbb10('0x20')]=qs[_0xbb10('0x20')](_0x6ed43b[_0xbb10('0x34')][_0xbb10('0x20')]);_0x1acce9[_0xbb10('0x1f')]=qs['offset'](_0x6ed43b[_0xbb10('0x34')][_0xbb10('0x1f')]);}_0x1acce9[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0x6ed43b['query'][_0xbb10('0x3c')]);_0x1acce9['where']=qs['filters'](_[_0xbb10('0x3d')](_0x6ed43b[_0xbb10('0x34')],_0x20d946[_0xbb10('0x35')]),_0x4aabb9);if(_0x6ed43b[_0xbb10('0x34')][_0xbb10('0x3e')]){_0x1acce9[_0xbb10('0x3f')]=_['merge'](_0x1acce9[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x2d')](_0x4aabb9,function(_0x52de31){if(_0x52de31['type']!=='VIRTUAL'){var _0x31bee3={};_0x31bee3[_0x52de31[_0xbb10('0x2a')]]={'$like':'%'+_0x6ed43b[_0xbb10('0x34')]['filter']+'%'};return _0x31bee3;}})});}_0x1acce9=_[_0xbb10('0x40')]({},_0x1acce9,_0x6ed43b[_0xbb10('0x41')]);var _0x4345f3={'where':_0x1acce9['where']};return db[_0xbb10('0x2e')][_0xbb10('0x1e')](_0x4345f3)[_0xbb10('0x28')](function(_0x446f49){_0x2a0e8b['count']=_0x446f49;if(_0x6ed43b[_0xbb10('0x34')][_0xbb10('0x42')]){_0x1acce9['include']=[{'all':!![]}];}return db[_0xbb10('0x2e')][_0xbb10('0x43')](_0x1acce9);})[_0xbb10('0x28')](function(_0x3a9934){_0x2a0e8b[_0xbb10('0x44')]=_0x3a9934;return _0x2a0e8b;})[_0xbb10('0x28')](respondWithFilteredResult(_0x1d5e95,_0x1acce9))['catch'](handleError(_0x1d5e95,null));};exports[_0xbb10('0x45')]=function(_0x1c7fae,_0x3e7b4c){var _0x3d3c41={'raw':!![],'where':{'id':_0x1c7fae[_0xbb10('0x46')]['id']}},_0x4943d9={};_0x4943d9[_0xbb10('0x32')]=_[_0xbb10('0x33')](db[_0xbb10('0x2e')]['rawAttributes']);_0x4943d9[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x1c7fae['query']);_0x4943d9['filters']=_[_0xbb10('0x47')](_0x4943d9['model'],_0x4943d9[_0xbb10('0x34')]);_0x3d3c41[_0xbb10('0x36')]=_['intersection'](_0x4943d9[_0xbb10('0x32')],qs[_0xbb10('0x37')](_0x1c7fae[_0xbb10('0x34')]['fields']));_0x3d3c41[_0xbb10('0x36')]=_0x3d3c41[_0xbb10('0x36')][_0xbb10('0x38')]?_0x3d3c41[_0xbb10('0x36')]:_0x4943d9[_0xbb10('0x32')];if(_0x1c7fae[_0xbb10('0x34')][_0xbb10('0x42')]){_0x3d3c41[_0xbb10('0x48')]=[{'all':!![]}];}_0x3d3c41=_[_0xbb10('0x40')]({},_0x3d3c41,_0x1c7fae[_0xbb10('0x41')]);return db[_0xbb10('0x2e')][_0xbb10('0x49')](_0x3d3c41)['then'](handleEntityNotFound(_0x3e7b4c,null))[_0xbb10('0x28')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x4a')](handleError(_0x3e7b4c,null));};exports['create']=function(_0x14e1cb,_0x2f5027){return db[_0xbb10('0x2e')][_0xbb10('0x4b')](_0x14e1cb[_0xbb10('0x4c')],{})[_0xbb10('0x28')](respondWithResult(_0x2f5027,0xc9))[_0xbb10('0x4a')](handleError(_0x2f5027,null));};exports['update']=function(_0x4a9793,_0xcb3354){if(_0x4a9793[_0xbb10('0x4c')]['id']){delete _0x4a9793[_0xbb10('0x4c')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x4a9793[_0xbb10('0x46')]['id']}})[_0xbb10('0x28')](handleEntityNotFound(_0xcb3354,null))[_0xbb10('0x28')](saveUpdates(_0x4a9793[_0xbb10('0x4c')],null))[_0xbb10('0x28')](respondWithResult(_0xcb3354,null))[_0xbb10('0x4a')](handleError(_0xcb3354,null));};exports[_0xbb10('0x27')]=function(_0x460788,_0x2626d8){return db[_0xbb10('0x2e')]['find']({'where':{'id':_0x460788['params']['id']}})[_0xbb10('0x28')](handleEntityNotFound(_0x2626d8,null))[_0xbb10('0x28')](removeEntity(_0x2626d8,null))[_0xbb10('0x4a')](handleError(_0x2626d8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index de8bfad..bba49a4 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 _0x4d50=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','int_freshsales_fields'];(function(_0xd62e7a,_0xac4f19){var _0x1bf0c8=function(_0x5f6f96){while(--_0x5f6f96){_0xd62e7a['push'](_0xd62e7a['shift']());}};_0x1bf0c8(++_0xac4f19);}(_0x4d50,0x1b8));var _0x04d5=function(_0x21b683,_0x56b7b6){_0x21b683=_0x21b683-0x0;var _0x183a2b=_0x4d50[_0x21b683];return _0x183a2b;};'use strict';var _=require(_0x04d5('0x0'));var util=require(_0x04d5('0x1'));var logger=require(_0x04d5('0x2'))(_0x04d5('0x3'));var moment=require(_0x04d5('0x4'));var BPromise=require(_0x04d5('0x5'));var rp=require(_0x04d5('0x6'));var fs=require('fs');var path=require(_0x04d5('0x7'));var rimraf=require('rimraf');var config=require(_0x04d5('0x8'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x531025,_0xb34b99){return _0x531025['define']('FreshsalesField',attributes,{'tableName':_0x04d5('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc119=['int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','FreshsalesField'];(function(_0x405480,_0x4c1afd){var _0x5bf9dc=function(_0x5b8504){while(--_0x5b8504){_0x405480['push'](_0x405480['shift']());}};_0x5bf9dc(++_0x4c1afd);}(_0xc119,0xb9));var _0x9c11=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xc119[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x9c11('0x0'));var util=require(_0x9c11('0x1'));var logger=require(_0x9c11('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9c11('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c11('0x4'));var rimraf=require(_0x9c11('0x5'));var config=require(_0x9c11('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x9c11('0x7')]=function(_0x57f5f7,_0x56b42e){return _0x57f5f7[_0x9c11('0x8')](_0x9c11('0x9'),attributes,{'tableName':_0x9c11('0xa'),'paranoid':![],'indexes':[{'name':_0x9c11('0xb'),'fields':[_0x9c11('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 0dc457a..5bf9d88 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 _0x7982=['FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','FreshsalesField,\x20%s,\x20%s','request\x20sent'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7982,0x152));var _0x2798=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x7982[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var util=require(_0x2798('0x0'));var moment=require(_0x2798('0x1'));var BPromise=require(_0x2798('0x2'));var rs=require(_0x2798('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2798('0x4'))['db'];var utils=require(_0x2798('0x5'));var logger=require(_0x2798('0x6'))(_0x2798('0x7'));var config=require(_0x2798('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2798('0x9')][_0x2798('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f11ed,_0x5e9511,_0x4c6c9a){return new BPromise(function(_0x264444,_0x3f75ed){return client[_0x2798('0xb')](_0x1f11ed,_0x4c6c9a)['then'](function(_0x33b7e6){logger['info'](_0x2798('0xc'),_0x5e9511,_0x2798('0xd'));logger['debug'](_0x2798('0xe'),_0x5e9511,'request\x20sent',JSON[_0x2798('0xf')](_0x33b7e6));if(_0x33b7e6[_0x2798('0x10')]){if(_0x33b7e6[_0x2798('0x10')][_0x2798('0x11')]===0x1f4){logger[_0x2798('0x10')](_0x2798('0xc'),_0x5e9511,_0x33b7e6[_0x2798('0x10')][_0x2798('0x12')]);return _0x3f75ed(_0x33b7e6[_0x2798('0x10')][_0x2798('0x12')]);}logger['error'](_0x2798('0xc'),_0x5e9511,_0x33b7e6[_0x2798('0x10')][_0x2798('0x12')]);return _0x264444(_0x33b7e6[_0x2798('0x10')][_0x2798('0x12')]);}else{logger[_0x2798('0x13')](_0x2798('0xc'),_0x5e9511,_0x2798('0xd'));_0x264444(_0x33b7e6[_0x2798('0x14')]['message']);}})[_0x2798('0x15')](function(_0xb48cd9){logger[_0x2798('0x10')](_0x2798('0xc'),_0x5e9511,_0xb48cd9);_0x3f75ed(_0xb48cd9);});});} \ No newline at end of file +var _0xdc84=['info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2aab5b,_0x3bc4d8){var _0x407a44=function(_0x5ac19a){while(--_0x5ac19a){_0x2aab5b['push'](_0x2aab5b['shift']());}};_0x407a44(++_0x3bc4d8);}(_0xdc84,0x1ad));var _0x4dc8=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0xdc84[_0xc82d1a];return _0x32fad2;};'use strict';var _=require(_0x4dc8('0x0'));var util=require('util');var moment=require(_0x4dc8('0x1'));var BPromise=require(_0x4dc8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4dc8('0x3'))['db'];var utils=require(_0x4dc8('0x4'));var logger=require(_0x4dc8('0x5'))(_0x4dc8('0x6'));var config=require(_0x4dc8('0x7'));var jayson=require(_0x4dc8('0x8'));var client=jayson[_0x4dc8('0x9')][_0x4dc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ef5b1,_0x2a32f3,_0x311329){return new BPromise(function(_0x926f93,_0x3e51af){return client[_0x4dc8('0xb')](_0x3ef5b1,_0x311329)['then'](function(_0x2a0106){logger[_0x4dc8('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x2a32f3,'request\x20sent');logger[_0x4dc8('0xd')](_0x4dc8('0xe'),_0x2a32f3,'request\x20sent',JSON['stringify'](_0x2a0106));if(_0x2a0106[_0x4dc8('0xf')]){if(_0x2a0106['error'][_0x4dc8('0x10')]===0x1f4){logger[_0x4dc8('0xf')](_0x4dc8('0x11'),_0x2a32f3,_0x2a0106['error'][_0x4dc8('0x12')]);return _0x3e51af(_0x2a0106[_0x4dc8('0xf')][_0x4dc8('0x12')]);}logger[_0x4dc8('0xf')](_0x4dc8('0x11'),_0x2a32f3,_0x2a0106['error']['message']);return _0x926f93(_0x2a0106[_0x4dc8('0xf')][_0x4dc8('0x12')]);}else{logger[_0x4dc8('0xc')](_0x4dc8('0x11'),_0x2a32f3,_0x4dc8('0x13'));_0x926f93(_0x2a0106['result']['message']);}})[_0x4dc8('0x14')](function(_0x2dbd38){logger[_0x4dc8('0xf')](_0x4dc8('0x11'),_0x2a32f3,_0x2dbd38);_0x3e51af(_0x2dbd38);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c1d2cec..b52fd75 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 _0x5cb1=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x5cb1,0x1cc));var _0x15cb=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0x5cb1[_0x4bb94b];return _0x36dcc6;};'use strict';var multer=require(_0x15cb('0x0'));var util=require(_0x15cb('0x1'));var path=require(_0x15cb('0x2'));var timeout=require(_0x15cb('0x3'));var express=require('express');var router=express[_0x15cb('0x4')]();var fs_extra=require(_0x15cb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x15cb('0x6'));var config=require(_0x15cb('0x7'));var controller=require(_0x15cb('0x8'));router[_0x15cb('0x9')]('/',auth[_0x15cb('0xa')](),controller[_0x15cb('0xb')]);router[_0x15cb('0x9')](_0x15cb('0xc'),auth[_0x15cb('0xa')](),controller[_0x15cb('0xd')]);router[_0x15cb('0x9')]('/:id/configurations',auth[_0x15cb('0xa')](),controller[_0x15cb('0xe')]);router[_0x15cb('0x9')](_0x15cb('0xf'),auth['isAuthenticated'](),controller[_0x15cb('0x10')]);router[_0x15cb('0x11')]('/',auth[_0x15cb('0xa')](),controller[_0x15cb('0x12')]);router[_0x15cb('0x11')](_0x15cb('0x13'),auth[_0x15cb('0xa')](),controller[_0x15cb('0x14')]);router[_0x15cb('0x15')](_0x15cb('0xc'),auth[_0x15cb('0xa')](),controller[_0x15cb('0x16')]);router[_0x15cb('0x17')](_0x15cb('0xc'),auth[_0x15cb('0xa')](),controller[_0x15cb('0x18')]);module['exports']=router; \ No newline at end of file +var _0xcd03=['addConfiguration','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','show','/:id/fields','getFields','post','create'];(function(_0x5d71a0,_0x3ed337){var _0x50cf17=function(_0x55cb6c){while(--_0x55cb6c){_0x5d71a0['push'](_0x5d71a0['shift']());}};_0x50cf17(++_0x3ed337);}(_0xcd03,0x15f));var _0x3cd0=function(_0x3e7755,_0x4af6b3){_0x3e7755=_0x3e7755-0x0;var _0xd934dd=_0xcd03[_0x3e7755];return _0xd934dd;};'use strict';var multer=require(_0x3cd0('0x0'));var util=require(_0x3cd0('0x1'));var path=require(_0x3cd0('0x2'));var timeout=require(_0x3cd0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3cd0('0x4'));var auth=require(_0x3cd0('0x5'));var interaction=require(_0x3cd0('0x6'));var config=require(_0x3cd0('0x7'));var controller=require(_0x3cd0('0x8'));router['get']('/',auth[_0x3cd0('0x9')](),controller[_0x3cd0('0xa')]);router[_0x3cd0('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x3cd0('0xc')]);router[_0x3cd0('0xb')]('/:id/configurations',auth[_0x3cd0('0x9')](),controller['getConfigurations']);router[_0x3cd0('0xb')](_0x3cd0('0xd'),auth[_0x3cd0('0x9')](),controller[_0x3cd0('0xe')]);router[_0x3cd0('0xf')]('/',auth[_0x3cd0('0x9')](),controller[_0x3cd0('0x10')]);router['post']('/:id/configurations',auth[_0x3cd0('0x9')](),controller[_0x3cd0('0x11')]);router[_0x3cd0('0x12')]('/:id',auth[_0x3cd0('0x9')](),controller[_0x3cd0('0x13')]);router['delete'](_0x3cd0('0x14'),auth['isAuthenticated'](),controller[_0x3cd0('0x15')]);module[_0x3cd0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e7f22b8..012ecbe 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 _0x1bdd=['sequelize','exports','STRING','ENUM','integrationTab','newTab'];(function(_0x1a174a,_0x3e1def){var _0x2791e7=function(_0x5077f0){while(--_0x5077f0){_0x1a174a['push'](_0x1a174a['shift']());}};_0x2791e7(++_0x3e1def);}(_0x1bdd,0x168));var _0xd1bd=function(_0x2b252f,_0x15b5f8){_0x2b252f=_0x2b252f-0x0;var _0x5aa51c=_0x1bdd[_0x2b252f];return _0x5aa51c;};'use strict';var Sequelize=require(_0xd1bd('0x0'));module[_0xd1bd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd1bd('0x2')]},'username':{'type':Sequelize[_0xd1bd('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xd1bd('0x2')]},'password':{'type':Sequelize[_0xd1bd('0x2')]},'clientId':{'type':Sequelize[_0xd1bd('0x2')]},'clientSecret':{'type':Sequelize[_0xd1bd('0x2')]},'securityToken':{'type':Sequelize[_0xd1bd('0x2')]},'serverUrl':{'type':Sequelize[_0xd1bd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd1bd('0x3')](_0xd1bd('0x4'),_0xd1bd('0x5')),'defaultValue':_0xd1bd('0x4')}}; \ No newline at end of file +var _0x4144=['sequelize','exports','STRING','username','integrationTab','newTab'];(function(_0x24c971,_0x48698c){var _0x13f5f2=function(_0xdd971){while(--_0xdd971){_0x24c971['push'](_0x24c971['shift']());}};_0x13f5f2(++_0x48698c);}(_0x4144,0x14a));var _0x4414=function(_0x536258,_0x5bd128){_0x536258=_0x536258-0x0;var _0x256de3=_0x4144[_0x536258];return _0x256de3;};'use strict';var Sequelize=require(_0x4414('0x0'));module[_0x4414('0x1')]={'name':{'type':Sequelize[_0x4414('0x2')]},'description':{'type':Sequelize[_0x4414('0x2')]},'username':{'type':Sequelize[_0x4414('0x2')],'unique':_0x4414('0x3')},'remoteUri':{'type':Sequelize[_0x4414('0x2')]},'password':{'type':Sequelize[_0x4414('0x2')]},'clientId':{'type':Sequelize[_0x4414('0x2')]},'clientSecret':{'type':Sequelize[_0x4414('0x2')]},'securityToken':{'type':Sequelize[_0x4414('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4414('0x4'),_0x4414('0x5')),'defaultValue':_0x4414('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d98f8ff..e46931b 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 _0xe706=['Task','clientSecret','password','slice','substring','username','concat','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','phone','includes','custom','picklistValues','value','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','error','message','info','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','pick','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields'];(function(_0x278e89,_0x3e2bf0){var _0x3f7cac=function(_0x2309a4){while(--_0x2309a4){_0x278e89['push'](_0x278e89['shift']());}};_0x3f7cac(++_0x3e2bf0);}(_0xe706,0xa3));var _0x6e70=function(_0x516f52,_0x210b10){_0x516f52=_0x516f52-0x0;var _0x5d06db=_0xe706[_0x516f52];return _0x5d06db;};'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 fs_extra=require(_0x6e70('0xd'));var _=require(_0x6e70('0xe'));var squel=require(_0x6e70('0xf'));var crypto=require(_0x6e70('0x10'));var jsforce=require(_0x6e70('0x11'));var deskjs=require(_0x6e70('0x12'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x13'));var Papa=require(_0x6e70('0x14'));var Redis=require(_0x6e70('0x15'));var authService=require(_0x6e70('0x16'));var qs=require(_0x6e70('0x17'));var as=require(_0x6e70('0x18'));var hardwareService=require(_0x6e70('0x19'));var logger=require('../../config/logger')('api');var utils=require(_0x6e70('0x1a'));var config=require(_0x6e70('0x1b'));var licenseUtil=require(_0x6e70('0x1c'));var db=require(_0x6e70('0x1d'))['db'];var integrations=require(_0x6e70('0x1e'));var jayson=require(_0x6e70('0x1f'));var client=jayson[_0x6e70('0x20')][_0x6e70('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5dfbaa,_0x52737e,_0x48bc72,_0x257e81){return new BPromise(function(_0x5a37a6,_0x53aed0){var _0x304716=_0x257e81||client;return _0x304716[_0x6e70('0x22')](_0x5dfbaa,_0x48bc72)['then'](function(_0x24f3ac){logger['info'](_0x6e70('0x23'),_0x52737e,_0x6e70('0x24'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x52737e,_0x6e70('0x24'),JSON['stringify'](_0x24f3ac));if(_0x24f3ac[_0x6e70('0x25')]){if(_0x24f3ac[_0x6e70('0x25')]['code']===0x1f4){logger['error'](_0x6e70('0x23'),_0x52737e,_0x24f3ac[_0x6e70('0x25')][_0x6e70('0x26')]);return _0x53aed0(_0x24f3ac[_0x6e70('0x25')][_0x6e70('0x26')]);}logger[_0x6e70('0x25')](_0x6e70('0x23'),_0x52737e,_0x24f3ac[_0x6e70('0x25')][_0x6e70('0x26')]);return _0x5a37a6(_0x24f3ac[_0x6e70('0x25')]['message']);}else{logger[_0x6e70('0x27')](_0x6e70('0x23'),_0x52737e,_0x6e70('0x24'));_0x5a37a6(_0x24f3ac['result'][_0x6e70('0x26')]);}})[_0x6e70('0x28')](function(_0x3337a6){logger['error'](_0x6e70('0x23'),_0x52737e,_0x3337a6);_0x53aed0(_0x3337a6);});});}function respondWithStatusCode(_0x538b9c,_0x50aec2){_0x50aec2=_0x50aec2||0xcc;return function(_0x4e97c7){if(_0x4e97c7){return _0x538b9c[_0x6e70('0x29')](_0x50aec2);}return _0x538b9c[_0x6e70('0x2a')](_0x50aec2)['end']();};}function respondWithResult(_0x3ecdf1,_0x1196ed){_0x1196ed=_0x1196ed||0xc8;return function(_0x5f268f){if(_0x5f268f){return _0x3ecdf1[_0x6e70('0x2a')](_0x1196ed)[_0x6e70('0x2b')](_0x5f268f);}};}function respondWithFilteredResult(_0x2bb231,_0x4a67ac){return function(_0x54a5fe){if(_0x54a5fe){var _0x2c4d37=_0x54a5fe[_0x6e70('0x2c')],_0x3af17f=_0x4a67ac['offset'],_0x83c836=_0x4a67ac[_0x6e70('0x2d')]+_0x4a67ac[_0x6e70('0x2e')],_0x114344;if(_0x83c836>=_0x2c4d37){_0x83c836=_0x2c4d37;_0x114344=0xc8;}else{_0x114344=0xce;}_0x2bb231[_0x6e70('0x2a')](_0x114344);return _0x2bb231[_0x6e70('0x2f')](_0x6e70('0x30'),_0x3af17f+'-'+_0x83c836+'/'+_0x2c4d37)[_0x6e70('0x2b')](_0x54a5fe);}return null;};}function patchUpdates(_0x3f78d2){return function(_0x24114a){try{jsonpatch[_0x6e70('0x31')](_0x24114a,_0x3f78d2,!![]);}catch(_0x3a5d30){return BPromise['reject'](_0x3a5d30);}return _0x24114a[_0x6e70('0x32')]();};}function saveUpdates(_0x50d60b,_0x259486){return function(_0x5a7a2a){if(_0x5a7a2a){return _0x5a7a2a[_0x6e70('0x33')](_0x50d60b)[_0x6e70('0x34')](function(_0x30fa0b){return _0x30fa0b;});}return null;};}function removeEntity(_0x56f6f7,_0x38c40d){return function(_0x42b094){if(_0x42b094){return _0x42b094['destroy']()[_0x6e70('0x34')](function(){_0x56f6f7[_0x6e70('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10d8f6,_0x3665a1){return function(_0x2d52bd){if(!_0x2d52bd){_0x10d8f6[_0x6e70('0x29')](0x194);}return _0x2d52bd;};}function handleError(_0x3b4a13,_0x1e3e76){_0x1e3e76=_0x1e3e76||0x1f4;return function(_0x44b19d){logger[_0x6e70('0x25')](_0x44b19d[_0x6e70('0x35')]);if(_0x44b19d[_0x6e70('0x36')]){delete _0x44b19d['name'];}_0x3b4a13[_0x6e70('0x2a')](_0x1e3e76)['send'](_0x44b19d);};}exports[_0x6e70('0x37')]=function(_0x3222a2,_0x98c683){var _0x32d12d={},_0x233a83={},_0x989b80={'count':0x0,'rows':[]};var _0x2440be=_[_0x6e70('0x38')](db[_0x6e70('0x39')][_0x6e70('0x3a')],function(_0x2a5444){return{'name':_0x2a5444[_0x6e70('0x3b')],'type':_0x2a5444[_0x6e70('0x3c')]['key']};});_0x233a83['model']=_['map'](_0x2440be,_0x6e70('0x36'));_0x233a83[_0x6e70('0x3d')]=_[_0x6e70('0x3e')](_0x3222a2[_0x6e70('0x3d')]);_0x233a83[_0x6e70('0x3f')]=_[_0x6e70('0x40')](_0x233a83['model'],_0x233a83[_0x6e70('0x3d')]);_0x32d12d[_0x6e70('0x41')]=_[_0x6e70('0x40')](_0x233a83[_0x6e70('0x42')],qs[_0x6e70('0x43')](_0x3222a2[_0x6e70('0x3d')][_0x6e70('0x43')]));_0x32d12d[_0x6e70('0x41')]=_0x32d12d['attributes'][_0x6e70('0x44')]?_0x32d12d[_0x6e70('0x41')]:_0x233a83[_0x6e70('0x42')];if(!_0x3222a2[_0x6e70('0x3d')][_0x6e70('0x45')](_0x6e70('0x46'))){_0x32d12d[_0x6e70('0x2e')]=qs['limit'](_0x3222a2['query']['limit']);_0x32d12d[_0x6e70('0x2d')]=qs[_0x6e70('0x2d')](_0x3222a2[_0x6e70('0x3d')][_0x6e70('0x2d')]);}_0x32d12d[_0x6e70('0x47')]=qs['sort'](_0x3222a2[_0x6e70('0x3d')][_0x6e70('0x48')]);_0x32d12d[_0x6e70('0x49')]=qs['filters'](_['pick'](_0x3222a2['query'],_0x233a83[_0x6e70('0x3f')]),_0x2440be);if(_0x3222a2['query'][_0x6e70('0x4a')]){_0x32d12d[_0x6e70('0x49')]=_[_0x6e70('0x4b')](_0x32d12d[_0x6e70('0x49')],{'$or':_['map'](_0x2440be,function(_0x62b925){if(_0x62b925['type']!==_0x6e70('0x4c')){var _0x1e9b06={};_0x1e9b06[_0x62b925[_0x6e70('0x36')]]={'$like':'%'+_0x3222a2[_0x6e70('0x3d')]['filter']+'%'};return _0x1e9b06;}})});}_0x32d12d=_[_0x6e70('0x4b')]({},_0x32d12d,_0x3222a2[_0x6e70('0x4d')]);var _0x3d39c3={'where':_0x32d12d[_0x6e70('0x49')]};return db[_0x6e70('0x39')][_0x6e70('0x2c')](_0x3d39c3)[_0x6e70('0x34')](function(_0x552e7e){_0x989b80[_0x6e70('0x2c')]=_0x552e7e;if(_0x3222a2[_0x6e70('0x3d')][_0x6e70('0x4e')]){_0x32d12d[_0x6e70('0x4f')]=[{'all':!![]}];}return db[_0x6e70('0x39')][_0x6e70('0x50')](_0x32d12d);})[_0x6e70('0x34')](function(_0x4ab26e){_0x989b80[_0x6e70('0x51')]=_0x4ab26e;return _0x989b80;})['then'](respondWithFilteredResult(_0x98c683,_0x32d12d))[_0x6e70('0x28')](handleError(_0x98c683,null));};exports[_0x6e70('0x52')]=function(_0x4b351e,_0x53efc3){var _0x333abd={'raw':![],'where':{'id':_0x4b351e[_0x6e70('0x53')]['id']}},_0x25a208={};_0x25a208['model']=_['keys'](db[_0x6e70('0x39')][_0x6e70('0x3a')]);_0x25a208[_0x6e70('0x3d')]=_[_0x6e70('0x3e')](_0x4b351e[_0x6e70('0x3d')]);_0x25a208[_0x6e70('0x3f')]=_['intersection'](_0x25a208[_0x6e70('0x42')],_0x25a208[_0x6e70('0x3d')]);_0x333abd[_0x6e70('0x41')]=_[_0x6e70('0x40')](_0x25a208[_0x6e70('0x42')],qs['fields'](_0x4b351e['query'][_0x6e70('0x43')]));_0x333abd[_0x6e70('0x41')]=_0x333abd[_0x6e70('0x41')][_0x6e70('0x44')]?_0x333abd[_0x6e70('0x41')]:_0x25a208['model'];if(_0x4b351e[_0x6e70('0x3d')][_0x6e70('0x4e')]){_0x333abd[_0x6e70('0x4f')]=[{'all':!![]}];}_0x333abd=_[_0x6e70('0x4b')]({},_0x333abd,_0x4b351e[_0x6e70('0x4d')]);return db['SalesforceAccount'][_0x6e70('0x54')](_0x333abd)[_0x6e70('0x34')](handleEntityNotFound(_0x53efc3,null))[_0x6e70('0x34')](respondWithResult(_0x53efc3,null))[_0x6e70('0x28')](handleError(_0x53efc3,null));};exports[_0x6e70('0x55')]=function(_0x3fd03d,_0x5d2e29){return db[_0x6e70('0x39')][_0x6e70('0x55')](_0x3fd03d['body'],{})[_0x6e70('0x34')](respondWithResult(_0x5d2e29,0xc9))[_0x6e70('0x28')](handleError(_0x5d2e29,null));};exports['update']=function(_0x3cfaa9,_0xb3f06c){if(_0x3cfaa9[_0x6e70('0x56')]['id']){delete _0x3cfaa9[_0x6e70('0x56')]['id'];}return db[_0x6e70('0x39')]['find']({'where':{'id':_0x3cfaa9[_0x6e70('0x53')]['id']}})[_0x6e70('0x34')](handleEntityNotFound(_0xb3f06c,null))[_0x6e70('0x34')](saveUpdates(_0x3cfaa9[_0x6e70('0x56')],null))[_0x6e70('0x34')](respondWithResult(_0xb3f06c,null))[_0x6e70('0x28')](handleError(_0xb3f06c,null));};exports[_0x6e70('0x57')]=function(_0x2e2587,_0x6043cd){return db[_0x6e70('0x39')][_0x6e70('0x54')]({'where':{'id':_0x2e2587[_0x6e70('0x53')]['id']}})[_0x6e70('0x34')](handleEntityNotFound(_0x6043cd,null))[_0x6e70('0x34')](removeEntity(_0x6043cd,null))[_0x6e70('0x28')](handleError(_0x6043cd,null));};exports[_0x6e70('0x58')]=function(_0x324fa6,_0x4329a6,_0x2a8627){var _0x1c7dca={};var _0x4c6aab={};var _0x28898a;var _0x4434dd;return db[_0x6e70('0x39')][_0x6e70('0x59')]({'where':{'id':_0x324fa6[_0x6e70('0x53')]['id']}})[_0x6e70('0x34')](handleEntityNotFound(_0x4329a6,null))['then'](function(_0x42bd85){if(_0x42bd85){_0x28898a=_0x42bd85;_0x4c6aab[_0x6e70('0x42')]=_['keys'](db[_0x6e70('0x5a')][_0x6e70('0x3a')]);_0x4c6aab[_0x6e70('0x3d')]=_['keys'](_0x324fa6['query']);_0x4c6aab[_0x6e70('0x3f')]=_[_0x6e70('0x40')](_0x4c6aab[_0x6e70('0x42')],_0x4c6aab[_0x6e70('0x3d')]);_0x1c7dca[_0x6e70('0x41')]=_[_0x6e70('0x40')](_0x4c6aab[_0x6e70('0x42')],qs['fields'](_0x324fa6['query'][_0x6e70('0x43')]));_0x1c7dca[_0x6e70('0x41')]=_0x1c7dca[_0x6e70('0x41')][_0x6e70('0x44')]?_0x1c7dca['attributes']:_0x4c6aab['model'];_0x1c7dca[_0x6e70('0x47')]=qs[_0x6e70('0x48')](_0x324fa6['query']['sort']);_0x1c7dca[_0x6e70('0x49')]=qs['filters'](_[_0x6e70('0x5b')](_0x324fa6[_0x6e70('0x3d')],_0x4c6aab[_0x6e70('0x3f')]));if(_0x324fa6[_0x6e70('0x3d')][_0x6e70('0x4a')]){_0x1c7dca[_0x6e70('0x49')]=_[_0x6e70('0x4b')](_0x1c7dca[_0x6e70('0x49')],{'$or':_['map'](_0x1c7dca[_0x6e70('0x41')],function(_0x6a560f){var _0x22c836={};_0x22c836[_0x6a560f]={'$like':'%'+_0x324fa6[_0x6e70('0x3d')][_0x6e70('0x4a')]+'%'};return _0x22c836;})});}_0x1c7dca=_['merge']({},_0x1c7dca,_0x324fa6['options']);return _0x28898a['getConfigurations'](_0x1c7dca);}})[_0x6e70('0x34')](function(_0xd91b9){if(_0xd91b9){_0x4434dd=_0xd91b9[_0x6e70('0x44')];if(!_0x324fa6['query']['hasOwnProperty'](_0x6e70('0x46'))){_0x1c7dca[_0x6e70('0x2e')]=qs[_0x6e70('0x2e')](_0x324fa6[_0x6e70('0x3d')][_0x6e70('0x2e')]);_0x1c7dca[_0x6e70('0x2d')]=qs['offset'](_0x324fa6[_0x6e70('0x3d')][_0x6e70('0x2d')]);}return _0x28898a[_0x6e70('0x58')](_0x1c7dca);}})[_0x6e70('0x34')](function(_0x515c0c){if(_0x515c0c){return _0x515c0c?{'count':_0x4434dd,'rows':_0x515c0c}:null;}})[_0x6e70('0x34')](respondWithResult(_0x4329a6,null))['catch'](handleError(_0x4329a6,null));};exports['addConfiguration']=function(_0x30487b,_0x3249a5,_0x3f37c1){if(_0x30487b[_0x6e70('0x56')]['id']){delete _0x30487b[_0x6e70('0x56')]['id'];}return db[_0x6e70('0x39')]['findOne']({'where':{'id':_0x30487b[_0x6e70('0x53')]['id']}})[_0x6e70('0x34')](handleEntityNotFound(_0x3249a5,null))[_0x6e70('0x34')](function(_0x18e64c){if(_0x18e64c){_0x30487b[_0x6e70('0x56')][_0x6e70('0x5c')]=_0x18e64c['id'];_0x30487b[_0x6e70('0x56')][_0x6e70('0x5d')]=integrations[_0x6e70('0x5e')](_0x30487b[_0x6e70('0x56')]['channel'],_0x30487b[_0x6e70('0x56')][_0x6e70('0x3c')]);_0x30487b[_0x6e70('0x56')]['Descriptions']=integrations['getDescriptions'](_0x30487b[_0x6e70('0x56')][_0x6e70('0x5f')],_0x30487b[_0x6e70('0x56')][_0x6e70('0x3c')]);return db[_0x6e70('0x5a')]['create'](_0x30487b['body'],{'include':[{'model':db[_0x6e70('0x60')],'as':_0x6e70('0x5d')},{'model':db['SalesforceField'],'as':_0x6e70('0x61')}]});}return null;})[_0x6e70('0x34')](respondWithResult(_0x3249a5,null))[_0x6e70('0x28')](handleError(_0x3249a5,null));};exports[_0x6e70('0x62')]=function(_0x3b01c9,_0x44bf96,_0x46ba13){var _0x150e57;var _0x3650e9='';var _0x580f52=_0x6e70('0x63');return db[_0x6e70('0x39')][_0x6e70('0x59')]({'where':{'id':_0x3b01c9[_0x6e70('0x53')]['id']},'attributes':['id','remoteUri','clientId',_0x6e70('0x64'),'username',_0x6e70('0x65'),'securityToken']})['then'](handleEntityNotFound(_0x44bf96,null))[_0x6e70('0x34')](function(_0x48e04b){if(_0x48e04b){_0x3650e9=_0x48e04b['remoteUri'];var _0x3c77d8=_0x3650e9[_0x6e70('0x66')](-0x1);if(_0x3c77d8==='/'){_0x3650e9=_0x3650e9[_0x6e70('0x67')](0x0,_0x3650e9['lastIndexOf'](_0x3c77d8));}_0x150e57=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3650e9,'clientId':_0x48e04b['clientId'],'clientSecret':_0x48e04b[_0x6e70('0x64')]}});return _0x150e57['login'](_0x48e04b[_0x6e70('0x68')],_0x48e04b[_0x6e70('0x65')][_0x6e70('0x69')](_0x48e04b[_0x6e70('0x6a')]));}})[_0x6e70('0x34')](function(_0x5d7caa){if(_0x5d7caa){if(!_[_0x6e70('0x6b')](_0x3b01c9['query'][_0x6e70('0x6c')])){_0x580f52=_0x3b01c9[_0x6e70('0x3d')][_0x6e70('0x6c')];}return _0x150e57['sobject'](_0x580f52)[_0x6e70('0x6d')]();}})[_0x6e70('0x34')](function(_0x11a615){var _0x267576=[_0x6e70('0x6e'),_0x6e70('0x6f'),_0x6e70('0x70'),_0x6e70('0x71'),_0x6e70('0x72'),'Description'];var _0x463eed=[_0x6e70('0x73'),'int',_0x6e70('0x74'),_0x6e70('0x75'),'email','textarea',_0x6e70('0x76')];if(_0x11a615){_['remove'](_0x11a615[_0x6e70('0x43')],function(_0x56d640){return _0x267576[_0x6e70('0x77')](_0x56d640[_0x6e70('0x36')])||!_0x463eed[_0x6e70('0x77')](_0x56d640[_0x6e70('0x3c')]);});return{'count':_0x11a615[_0x6e70('0x43')][_0x6e70('0x44')],'rows':_[_0x6e70('0x38')](_0x11a615['fields'],function(_0x4d6a09){return{'id':_0x4d6a09[_0x6e70('0x36')],'name':_0x4d6a09['label'],'custom':_0x4d6a09[_0x6e70('0x78')],'options':_0x4d6a09[_0x6e70('0x79')][_0x6e70('0x44')]>0x0?_[_0x6e70('0x38')](_0x4d6a09['picklistValues'],function(_0x21fb9a){return{'name':_0x21fb9a['label'],'value':_0x21fb9a[_0x6e70('0x7a')]};}):_0x4d6a09[_0x6e70('0x3c')]==_0x6e70('0x75')?[{'name':_0x6e70('0x7b'),'value':_0x6e70('0x7c')},{'name':_0x6e70('0x7d'),'value':_0x6e70('0x7e')}]:[]};})};}})['then'](respondWithResult(_0x44bf96,null))[_0x6e70('0x28')](function(_0x5b9a97){var _0x185599=_0x3b01c9['query']['test']?0x1f4:_0x5b9a97['statusCode']||0x1f4;logger[_0x6e70('0x25')](_0x6e70('0x7f'),_0x6e70('0x62'),_0x185599,JSON[_0x6e70('0x80')](_0x5b9a97));delete _0x5b9a97[_0x6e70('0x36')];if(_0x185599===0x191){_0x185599=0x190;}_0x44bf96['status'](_0x185599)[_0x6e70('0x81')](_0x3b01c9[_0x6e70('0x3d')]['test']?{'message':_0x6e70('0x82'),'statusCode':_0x5b9a97['statusCode']}:_0x5b9a97);});}; \ No newline at end of file +var _0x8603=['email','textarea','phone','includes','label','custom','picklistValues','true','False','false','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','offset','limit','set','Content-Range','json','reject','save','update','destroy','end','sendStatus','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceAccount','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','SalesforceConfiguration','rawAttributes','addConfiguration','findOne','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','remoteUri','clientId','clientSecret','username','slice','substring','login','securityToken','isNil','ticketType','sobject','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','picklist','boolean'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x8603,0x190));var _0x3860=function(_0x2496da,_0x3fe1fc){_0x2496da=_0x2496da-0x0;var _0x4caae0=_0x8603[_0x2496da];return _0x4caae0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3860('0x0'));var rimraf=require(_0x3860('0x1'));var zipdir=require(_0x3860('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3860('0x3'));var BPromise=require(_0x3860('0x4'));var Mustache=require(_0x3860('0x5'));var util=require('util');var path=require(_0x3860('0x6'));var sox=require('sox');var csv=require(_0x3860('0x7'));var ejs=require(_0x3860('0x8'));var fs=require('fs');var fs_extra=require(_0x3860('0x9'));var _=require(_0x3860('0xa'));var squel=require(_0x3860('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3860('0x7'));var querystring=require(_0x3860('0xc'));var Papa=require('papaparse');var Redis=require(_0x3860('0xd'));var authService=require(_0x3860('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3860('0xf'));var hardwareService=require(_0x3860('0x10'));var logger=require('../../config/logger')(_0x3860('0x11'));var utils=require(_0x3860('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3860('0x13'));var db=require(_0x3860('0x14'))['db'];var integrations=require(_0x3860('0x15'));var jayson=require(_0x3860('0x16'));var client=jayson[_0x3860('0x17')][_0x3860('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3d4ae1,_0x12b23b,_0x465d8d,_0x46264d){return new BPromise(function(_0x54dbc3,_0x3d861d){var _0x21eaf1=_0x46264d||client;return _0x21eaf1[_0x3860('0x19')](_0x3d4ae1,_0x465d8d)[_0x3860('0x1a')](function(_0x1055b3){logger[_0x3860('0x1b')](_0x3860('0x1c'),_0x12b23b,_0x3860('0x1d'));logger[_0x3860('0x1e')](_0x3860('0x1f'),_0x12b23b,_0x3860('0x1d'),JSON[_0x3860('0x20')](_0x1055b3));if(_0x1055b3['error']){if(_0x1055b3['error'][_0x3860('0x21')]===0x1f4){logger[_0x3860('0x22')](_0x3860('0x1c'),_0x12b23b,_0x1055b3['error'][_0x3860('0x23')]);return _0x3d861d(_0x1055b3[_0x3860('0x22')][_0x3860('0x23')]);}logger[_0x3860('0x22')](_0x3860('0x1c'),_0x12b23b,_0x1055b3[_0x3860('0x22')][_0x3860('0x23')]);return _0x54dbc3(_0x1055b3[_0x3860('0x22')][_0x3860('0x23')]);}else{logger[_0x3860('0x1b')](_0x3860('0x1c'),_0x12b23b,_0x3860('0x1d'));_0x54dbc3(_0x1055b3[_0x3860('0x24')][_0x3860('0x23')]);}})[_0x3860('0x25')](function(_0x564efd){logger[_0x3860('0x22')](_0x3860('0x1c'),_0x12b23b,_0x564efd);_0x3d861d(_0x564efd);});});}function respondWithStatusCode(_0x2b91f2,_0x301e03){_0x301e03=_0x301e03||0xcc;return function(_0x20bb1e){if(_0x20bb1e){return _0x2b91f2['sendStatus'](_0x301e03);}return _0x2b91f2[_0x3860('0x26')](_0x301e03)['end']();};}function respondWithResult(_0x577750,_0xfa9705){_0xfa9705=_0xfa9705||0xc8;return function(_0x1c4bbc){if(_0x1c4bbc){return _0x577750['status'](_0xfa9705)['json'](_0x1c4bbc);}};}function respondWithFilteredResult(_0x5f42d5,_0x1b2e4d){return function(_0x3ebc5b){if(_0x3ebc5b){var _0xb25cc2=_0x3ebc5b['count'],_0x371f3a=_0x1b2e4d['offset'],_0x9332a5=_0x1b2e4d[_0x3860('0x27')]+_0x1b2e4d[_0x3860('0x28')],_0x228d34;if(_0x9332a5>=_0xb25cc2){_0x9332a5=_0xb25cc2;_0x228d34=0xc8;}else{_0x228d34=0xce;}_0x5f42d5['status'](_0x228d34);return _0x5f42d5[_0x3860('0x29')](_0x3860('0x2a'),_0x371f3a+'-'+_0x9332a5+'/'+_0xb25cc2)[_0x3860('0x2b')](_0x3ebc5b);}return null;};}function patchUpdates(_0x426e6c){return function(_0x3628f7){try{jsonpatch['apply'](_0x3628f7,_0x426e6c,!![]);}catch(_0x36ae2b){return BPromise[_0x3860('0x2c')](_0x36ae2b);}return _0x3628f7[_0x3860('0x2d')]();};}function saveUpdates(_0x4bd90c,_0x45d24f){return function(_0x5e25ce){if(_0x5e25ce){return _0x5e25ce[_0x3860('0x2e')](_0x4bd90c)['then'](function(_0x1c498c){return _0x1c498c;});}return null;};}function removeEntity(_0x2e542a,_0x24cf39){return function(_0x47e350){if(_0x47e350){return _0x47e350[_0x3860('0x2f')]()[_0x3860('0x1a')](function(){_0x2e542a['status'](0xcc)[_0x3860('0x30')]();});}};}function handleEntityNotFound(_0x5a54a6,_0x2c0bf3){return function(_0x3a577a){if(!_0x3a577a){_0x5a54a6[_0x3860('0x31')](0x194);}return _0x3a577a;};}function handleError(_0x2fc231,_0x30dc2a){_0x30dc2a=_0x30dc2a||0x1f4;return function(_0x1b93f3){logger[_0x3860('0x22')](_0x1b93f3['stack']);if(_0x1b93f3[_0x3860('0x32')]){delete _0x1b93f3[_0x3860('0x32')];}_0x2fc231['status'](_0x30dc2a)[_0x3860('0x33')](_0x1b93f3);};}exports[_0x3860('0x34')]=function(_0x3a17ea,_0x5af661){var _0x523cc1={},_0x285b1b={},_0x37a871={'count':0x0,'rows':[]};var _0x3abf18=_[_0x3860('0x35')](db['SalesforceAccount']['rawAttributes'],function(_0x3ad0aa){return{'name':_0x3ad0aa[_0x3860('0x36')],'type':_0x3ad0aa[_0x3860('0x37')][_0x3860('0x38')]};});_0x285b1b[_0x3860('0x39')]=_['map'](_0x3abf18,_0x3860('0x32'));_0x285b1b[_0x3860('0x3a')]=_['keys'](_0x3a17ea['query']);_0x285b1b[_0x3860('0x3b')]=_[_0x3860('0x3c')](_0x285b1b[_0x3860('0x39')],_0x285b1b[_0x3860('0x3a')]);_0x523cc1[_0x3860('0x3d')]=_['intersection'](_0x285b1b[_0x3860('0x39')],qs['fields'](_0x3a17ea[_0x3860('0x3a')][_0x3860('0x3e')]));_0x523cc1['attributes']=_0x523cc1[_0x3860('0x3d')][_0x3860('0x3f')]?_0x523cc1['attributes']:_0x285b1b[_0x3860('0x39')];if(!_0x3a17ea[_0x3860('0x3a')][_0x3860('0x40')](_0x3860('0x41'))){_0x523cc1['limit']=qs[_0x3860('0x28')](_0x3a17ea[_0x3860('0x3a')][_0x3860('0x28')]);_0x523cc1['offset']=qs[_0x3860('0x27')](_0x3a17ea['query'][_0x3860('0x27')]);}_0x523cc1[_0x3860('0x42')]=qs[_0x3860('0x43')](_0x3a17ea[_0x3860('0x3a')][_0x3860('0x43')]);_0x523cc1[_0x3860('0x44')]=qs['filters'](_[_0x3860('0x45')](_0x3a17ea[_0x3860('0x3a')],_0x285b1b['filters']),_0x3abf18);if(_0x3a17ea['query'][_0x3860('0x46')]){_0x523cc1[_0x3860('0x44')]=_['merge'](_0x523cc1[_0x3860('0x44')],{'$or':_[_0x3860('0x35')](_0x3abf18,function(_0x4c6c23){if(_0x4c6c23[_0x3860('0x37')]!==_0x3860('0x47')){var _0x392dc3={};_0x392dc3[_0x4c6c23[_0x3860('0x32')]]={'$like':'%'+_0x3a17ea[_0x3860('0x3a')][_0x3860('0x46')]+'%'};return _0x392dc3;}})});}_0x523cc1=_[_0x3860('0x48')]({},_0x523cc1,_0x3a17ea[_0x3860('0x49')]);var _0x1a3f39={'where':_0x523cc1[_0x3860('0x44')]};return db[_0x3860('0x4a')][_0x3860('0x4b')](_0x1a3f39)[_0x3860('0x1a')](function(_0x57b91d){_0x37a871[_0x3860('0x4b')]=_0x57b91d;if(_0x3a17ea['query'][_0x3860('0x4c')]){_0x523cc1[_0x3860('0x4d')]=[{'all':!![]}];}return db[_0x3860('0x4a')][_0x3860('0x4e')](_0x523cc1);})[_0x3860('0x1a')](function(_0x36d469){_0x37a871[_0x3860('0x4f')]=_0x36d469;return _0x37a871;})[_0x3860('0x1a')](respondWithFilteredResult(_0x5af661,_0x523cc1))['catch'](handleError(_0x5af661,null));};exports[_0x3860('0x50')]=function(_0x147cb7,_0x19d590){var _0x4eae44={'raw':![],'where':{'id':_0x147cb7[_0x3860('0x51')]['id']}},_0x9b8ab0={};_0x9b8ab0[_0x3860('0x39')]=_[_0x3860('0x52')](db['SalesforceAccount']['rawAttributes']);_0x9b8ab0[_0x3860('0x3a')]=_['keys'](_0x147cb7[_0x3860('0x3a')]);_0x9b8ab0[_0x3860('0x3b')]=_[_0x3860('0x3c')](_0x9b8ab0['model'],_0x9b8ab0[_0x3860('0x3a')]);_0x4eae44['attributes']=_[_0x3860('0x3c')](_0x9b8ab0['model'],qs[_0x3860('0x3e')](_0x147cb7[_0x3860('0x3a')][_0x3860('0x3e')]));_0x4eae44['attributes']=_0x4eae44['attributes'][_0x3860('0x3f')]?_0x4eae44[_0x3860('0x3d')]:_0x9b8ab0['model'];if(_0x147cb7[_0x3860('0x3a')]['includeAll']){_0x4eae44[_0x3860('0x4d')]=[{'all':!![]}];}_0x4eae44=_[_0x3860('0x48')]({},_0x4eae44,_0x147cb7[_0x3860('0x49')]);return db[_0x3860('0x4a')][_0x3860('0x53')](_0x4eae44)[_0x3860('0x1a')](handleEntityNotFound(_0x19d590,null))[_0x3860('0x1a')](respondWithResult(_0x19d590,null))['catch'](handleError(_0x19d590,null));};exports[_0x3860('0x54')]=function(_0x73222c,_0x3367ce){return db[_0x3860('0x4a')][_0x3860('0x54')](_0x73222c[_0x3860('0x55')],{})['then'](respondWithResult(_0x3367ce,0xc9))[_0x3860('0x25')](handleError(_0x3367ce,null));};exports[_0x3860('0x2e')]=function(_0x19a26d,_0x31f2af){if(_0x19a26d[_0x3860('0x55')]['id']){delete _0x19a26d[_0x3860('0x55')]['id'];}return db[_0x3860('0x4a')][_0x3860('0x53')]({'where':{'id':_0x19a26d['params']['id']}})[_0x3860('0x1a')](handleEntityNotFound(_0x31f2af,null))[_0x3860('0x1a')](saveUpdates(_0x19a26d['body'],null))[_0x3860('0x1a')](respondWithResult(_0x31f2af,null))[_0x3860('0x25')](handleError(_0x31f2af,null));};exports[_0x3860('0x2f')]=function(_0x4ecec2,_0x17d2df){return db['SalesforceAccount'][_0x3860('0x53')]({'where':{'id':_0x4ecec2[_0x3860('0x51')]['id']}})[_0x3860('0x1a')](handleEntityNotFound(_0x17d2df,null))[_0x3860('0x1a')](removeEntity(_0x17d2df,null))[_0x3860('0x25')](handleError(_0x17d2df,null));};exports[_0x3860('0x56')]=function(_0x1a4f58,_0x2c7218,_0x67e6b8){var _0x151492={};var _0x3ba9a1={};var _0x2bac24;var _0x58147d;return db['SalesforceAccount']['findOne']({'where':{'id':_0x1a4f58[_0x3860('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c7218,null))['then'](function(_0xc2bd40){if(_0xc2bd40){_0x2bac24=_0xc2bd40;_0x3ba9a1[_0x3860('0x39')]=_[_0x3860('0x52')](db[_0x3860('0x57')][_0x3860('0x58')]);_0x3ba9a1[_0x3860('0x3a')]=_['keys'](_0x1a4f58['query']);_0x3ba9a1['filters']=_[_0x3860('0x3c')](_0x3ba9a1[_0x3860('0x39')],_0x3ba9a1[_0x3860('0x3a')]);_0x151492['attributes']=_[_0x3860('0x3c')](_0x3ba9a1['model'],qs[_0x3860('0x3e')](_0x1a4f58[_0x3860('0x3a')]['fields']));_0x151492[_0x3860('0x3d')]=_0x151492[_0x3860('0x3d')][_0x3860('0x3f')]?_0x151492[_0x3860('0x3d')]:_0x3ba9a1['model'];_0x151492[_0x3860('0x42')]=qs[_0x3860('0x43')](_0x1a4f58[_0x3860('0x3a')]['sort']);_0x151492['where']=qs[_0x3860('0x3b')](_[_0x3860('0x45')](_0x1a4f58[_0x3860('0x3a')],_0x3ba9a1[_0x3860('0x3b')]));if(_0x1a4f58[_0x3860('0x3a')][_0x3860('0x46')]){_0x151492['where']=_[_0x3860('0x48')](_0x151492[_0x3860('0x44')],{'$or':_['map'](_0x151492[_0x3860('0x3d')],function(_0x2afdde){var _0x3574c5={};_0x3574c5[_0x2afdde]={'$like':'%'+_0x1a4f58[_0x3860('0x3a')][_0x3860('0x46')]+'%'};return _0x3574c5;})});}_0x151492=_[_0x3860('0x48')]({},_0x151492,_0x1a4f58['options']);return _0x2bac24[_0x3860('0x56')](_0x151492);}})[_0x3860('0x1a')](function(_0x2aa22f){if(_0x2aa22f){_0x58147d=_0x2aa22f[_0x3860('0x3f')];if(!_0x1a4f58[_0x3860('0x3a')][_0x3860('0x40')]('nolimit')){_0x151492[_0x3860('0x28')]=qs[_0x3860('0x28')](_0x1a4f58[_0x3860('0x3a')]['limit']);_0x151492['offset']=qs[_0x3860('0x27')](_0x1a4f58[_0x3860('0x3a')][_0x3860('0x27')]);}return _0x2bac24[_0x3860('0x56')](_0x151492);}})[_0x3860('0x1a')](function(_0x501ed0){if(_0x501ed0){return _0x501ed0?{'count':_0x58147d,'rows':_0x501ed0}:null;}})['then'](respondWithResult(_0x2c7218,null))[_0x3860('0x25')](handleError(_0x2c7218,null));};exports[_0x3860('0x59')]=function(_0x47e144,_0x5d9416,_0x2fd2ec){if(_0x47e144[_0x3860('0x55')]['id']){delete _0x47e144['body']['id'];}return db[_0x3860('0x4a')][_0x3860('0x5a')]({'where':{'id':_0x47e144[_0x3860('0x51')]['id']}})[_0x3860('0x1a')](handleEntityNotFound(_0x5d9416,null))['then'](function(_0x1e8c5c){if(_0x1e8c5c){_0x47e144[_0x3860('0x55')]['AccountId']=_0x1e8c5c['id'];_0x47e144['body'][_0x3860('0x5b')]=integrations[_0x3860('0x5c')](_0x47e144['body'][_0x3860('0x5d')],_0x47e144['body'][_0x3860('0x37')]);_0x47e144['body']['Descriptions']=integrations[_0x3860('0x5e')](_0x47e144['body'][_0x3860('0x5d')],_0x47e144[_0x3860('0x55')][_0x3860('0x37')]);return db[_0x3860('0x57')][_0x3860('0x54')](_0x47e144[_0x3860('0x55')],{'include':[{'model':db['SalesforceField'],'as':_0x3860('0x5b')},{'model':db[_0x3860('0x5f')],'as':_0x3860('0x60')}]});}return null;})['then'](respondWithResult(_0x5d9416,null))[_0x3860('0x25')](handleError(_0x5d9416,null));};exports['getFields']=function(_0x30e093,_0x3dc2c5,_0x5a54f6){var _0x73732c;var _0x2cd731='';var _0x1e94c4='Task';return db['SalesforceAccount']['findOne']({'where':{'id':_0x30e093['params']['id']},'attributes':['id',_0x3860('0x61'),_0x3860('0x62'),_0x3860('0x63'),_0x3860('0x64'),'password','securityToken']})[_0x3860('0x1a')](handleEntityNotFound(_0x3dc2c5,null))[_0x3860('0x1a')](function(_0x1b0e46){if(_0x1b0e46){_0x2cd731=_0x1b0e46[_0x3860('0x61')];var _0x4b0652=_0x2cd731[_0x3860('0x65')](-0x1);if(_0x4b0652==='/'){_0x2cd731=_0x2cd731[_0x3860('0x66')](0x0,_0x2cd731['lastIndexOf'](_0x4b0652));}_0x73732c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2cd731,'clientId':_0x1b0e46[_0x3860('0x62')],'clientSecret':_0x1b0e46[_0x3860('0x63')]}});return _0x73732c[_0x3860('0x67')](_0x1b0e46[_0x3860('0x64')],_0x1b0e46['password']['concat'](_0x1b0e46[_0x3860('0x68')]));}})['then'](function(_0x466d90){if(_0x466d90){if(!_[_0x3860('0x69')](_0x30e093['query']['ticketType'])){_0x1e94c4=_0x30e093['query'][_0x3860('0x6a')];}return _0x73732c[_0x3860('0x6b')](_0x1e94c4)['describe']();}})[_0x3860('0x1a')](function(_0x1371b5){var _0x2351fe=[_0x3860('0x6c'),_0x3860('0x6d'),'IsReminderSet',_0x3860('0x6e'),_0x3860('0x6f'),_0x3860('0x70')];var _0x35a2b1=[_0x3860('0x71'),'int',_0x3860('0x72'),_0x3860('0x73'),_0x3860('0x74'),_0x3860('0x75'),_0x3860('0x76')];if(_0x1371b5){_['remove'](_0x1371b5['fields'],function(_0x196c50){return _0x2351fe[_0x3860('0x77')](_0x196c50[_0x3860('0x32')])||!_0x35a2b1[_0x3860('0x77')](_0x196c50[_0x3860('0x37')]);});return{'count':_0x1371b5[_0x3860('0x3e')][_0x3860('0x3f')],'rows':_['map'](_0x1371b5[_0x3860('0x3e')],function(_0x3eb292){return{'id':_0x3eb292['name'],'name':_0x3eb292[_0x3860('0x78')],'custom':_0x3eb292[_0x3860('0x79')],'options':_0x3eb292[_0x3860('0x7a')]['length']>0x0?_[_0x3860('0x35')](_0x3eb292[_0x3860('0x7a')],function(_0x5f11ca){return{'name':_0x5f11ca[_0x3860('0x78')],'value':_0x5f11ca['value']};}):_0x3eb292[_0x3860('0x37')]==_0x3860('0x73')?[{'name':'True','value':_0x3860('0x7b')},{'name':_0x3860('0x7c'),'value':_0x3860('0x7d')}]:[]};})};}})[_0x3860('0x1a')](respondWithResult(_0x3dc2c5,null))[_0x3860('0x25')](function(_0x5d37e4){var _0x307d19=_0x30e093[_0x3860('0x3a')][_0x3860('0x7e')]?0x1f4:_0x5d37e4[_0x3860('0x7f')]||0x1f4;logger[_0x3860('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x307d19,JSON[_0x3860('0x20')](_0x5d37e4));delete _0x5d37e4[_0x3860('0x32')];if(_0x307d19===0x191){_0x307d19=0x190;}_0x3dc2c5['status'](_0x307d19)[_0x3860('0x33')](_0x30e093[_0x3860('0x3a')][_0x3860('0x7e')]?{'message':_0x3860('0x80'),'statusCode':_0x5d37e4['statusCode']}:_0x5d37e4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index af6043d..ef6e60e 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 _0xedca=['request-promise','path','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api'];(function(_0x71f211,_0x890ea){var _0x1b9061=function(_0x469d87){while(--_0x469d87){_0x71f211['push'](_0x71f211['shift']());}};_0x1b9061(++_0x890ea);}(_0xedca,0x15c));var _0xaedc=function(_0xb908d7,_0x4f1161){_0xb908d7=_0xb908d7-0x0;var _0x4ba1fa=_0xedca[_0xb908d7];return _0x4ba1fa;};'use strict';var _=require(_0xaedc('0x0'));var util=require(_0xaedc('0x1'));var logger=require(_0xaedc('0x2'))(_0xaedc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaedc('0x4'));var fs=require('fs');var path=require(_0xaedc('0x5'));var rimraf=require(_0xaedc('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xaedc('0x7'));module[_0xaedc('0x8')]=function(_0x4414dc,_0x5c34f0){return _0x4414dc[_0xaedc('0x9')](_0xaedc('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc77=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x18fe2e,_0x50fbe8){var _0x4a9b16=function(_0xa45a30){while(--_0xa45a30){_0x18fe2e['push'](_0x18fe2e['shift']());}};_0x4a9b16(++_0x50fbe8);}(_0xcc77,0x10a));var _0x7cc7=function(_0xc44f0c,_0x3a5290){_0xc44f0c=_0xc44f0c-0x0;var _0x4849f1=_0xcc77[_0xc44f0c];return _0x4849f1;};'use strict';var _=require(_0x7cc7('0x0'));var util=require(_0x7cc7('0x1'));var logger=require(_0x7cc7('0x2'))(_0x7cc7('0x3'));var moment=require('moment');var BPromise=require(_0x7cc7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cc7('0x5'));var rimraf=require(_0x7cc7('0x6'));var config=require(_0x7cc7('0x7'));var attributes=require(_0x7cc7('0x8'));var integrations=require(_0x7cc7('0x9'));module[_0x7cc7('0xa')]=function(_0x3e7d68,_0x111cc0){return _0x3e7d68[_0x7cc7('0xb')](_0x7cc7('0xc'),attributes,{'tableName':_0x7cc7('0xd'),'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 4adc625..8cce5a3 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 _0x5db8=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','stringify','ShowSalesforceAccount','find','map','lodash','util','moment','randomstring','ioredis'];(function(_0x5370e7,_0x380262){var _0x1d5b6f=function(_0x122442){while(--_0x122442){_0x5370e7['push'](_0x5370e7['shift']());}};_0x1d5b6f(++_0x380262);}(_0x5db8,0xbb));var _0x85db=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x5db8[_0xb1174e];return _0x285bac;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});}exports[_0x85db('0x12')]=function(_0x3209b3){var _0x56d3b2=this;return new Promise(function(_0x37ac04,_0xf89937){return db[_0x85db('0x13')][_0x85db('0x14')]({'raw':_0x3209b3[_0x85db('0x15')]?_0x3209b3[_0x85db('0x15')][_0x85db('0x16')]===undefined?!![]:![]:!![],'where':_0x3209b3[_0x85db('0x15')]?_0x3209b3[_0x85db('0x15')][_0x85db('0x17')]||null:null,'attributes':_0x3209b3['options']?_0x3209b3[_0x85db('0x15')][_0x85db('0x18')]||null:null,'limit':_0x3209b3[_0x85db('0x15')]?_0x3209b3[_0x85db('0x15')][_0x85db('0x19')]||null:null,'include':_0x3209b3[_0x85db('0x15')]?_0x3209b3[_0x85db('0x15')][_0x85db('0x1a')]?_['map'](_0x3209b3[_0x85db('0x15')][_0x85db('0x1a')],function(_0x57fe5b){return{'model':db[_0x57fe5b[_0x85db('0x1b')]],'as':_0x57fe5b['as'],'attributes':_0x57fe5b[_0x85db('0x18')],'include':_0x57fe5b[_0x85db('0x1a')]?_['map'](_0x57fe5b[_0x85db('0x1a')],function(_0x46f428){return{'model':db[_0x46f428[_0x85db('0x1b')]],'as':_0x46f428['as'],'attributes':_0x46f428['attributes'],'include':_0x46f428['include']?_['map'](_0x46f428[_0x85db('0x1a')],function(_0x105bb9){return{'model':db[_0x105bb9[_0x85db('0x1b')]],'as':_0x105bb9['as'],'attributes':_0x105bb9['attributes']};}):[]};}):[]};}):[]:[]})[_0x85db('0xa')](function(_0xc2abb8){logger[_0x85db('0xb')]('GetSalesforceAccount',_0x3209b3);logger['debug'](_0x85db('0x12'),_0x3209b3,JSON[_0x85db('0x1c')](_0xc2abb8));_0x37ac04(_0xc2abb8);})[_0x85db('0x11')](function(_0x226540){logger[_0x85db('0xf')](_0x85db('0x12'),_0x226540[_0x85db('0x10')],_0x3209b3);_0xf89937(_0x56d3b2[_0x85db('0xf')](0x1f4,_0x226540[_0x85db('0x10')]));});});};exports[_0x85db('0x1d')]=function(_0x580e90){var _0x4a15b9=this;return new Promise(function(_0x13ad98,_0x5e0e75){return db[_0x85db('0x13')][_0x85db('0x1e')]({'raw':_0x580e90['options']?_0x580e90[_0x85db('0x15')][_0x85db('0x16')]===undefined?!![]:![]:!![],'where':_0x580e90[_0x85db('0x15')]?_0x580e90[_0x85db('0x15')]['where']||null:null,'attributes':_0x580e90[_0x85db('0x15')]?_0x580e90[_0x85db('0x15')][_0x85db('0x18')]||null:null,'include':_0x580e90[_0x85db('0x15')]?_0x580e90[_0x85db('0x15')]['include']?_[_0x85db('0x1f')](_0x580e90[_0x85db('0x15')][_0x85db('0x1a')],function(_0xd0d27){return{'model':db[_0xd0d27['model']],'as':_0xd0d27['as'],'attributes':_0xd0d27[_0x85db('0x18')],'include':_0xd0d27[_0x85db('0x1a')]?_[_0x85db('0x1f')](_0xd0d27['include'],function(_0x550194){return{'model':db[_0x550194[_0x85db('0x1b')]],'as':_0x550194['as'],'attributes':_0x550194[_0x85db('0x18')],'include':_0x550194['include']?_[_0x85db('0x1f')](_0x550194[_0x85db('0x1a')],function(_0x20939b){return{'model':db[_0x20939b[_0x85db('0x1b')]],'as':_0x20939b['as'],'attributes':_0x20939b[_0x85db('0x18')]};}):[]};}):[]};}):[]:[]})[_0x85db('0xa')](function(_0x1791f3){logger[_0x85db('0xb')](_0x85db('0x1d'),_0x580e90);logger[_0x85db('0xe')](_0x85db('0x1d'),_0x580e90,JSON[_0x85db('0x1c')](_0x1791f3));_0x13ad98(_0x1791f3);})['catch'](function(_0x35e938){logger[_0x85db('0xf')](_0x85db('0x1d'),_0x35e938[_0x85db('0x10')],_0x580e90);_0x5e0e75(_0x4a15b9['error'](0x1f4,_0x35e938[_0x85db('0x10')]));});});}; \ 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(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x40afd5,_0x3e7ddf){_0x40afd5=_0x40afd5-0x0;var _0x2cc580=_0x7a2c[_0x40afd5];return _0x2cc580;};'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 128685a..32274de 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 _0xe9bd=['getDescriptions','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5afc34,_0x2bec82){var _0x3e34ec=function(_0x52cea4){while(--_0x52cea4){_0x5afc34['push'](_0x5afc34['shift']());}};_0x3e34ec(++_0x2bec82);}(_0xe9bd,0x14d));var _0xde9b=function(_0x4c9759,_0x27c520){_0x4c9759=_0x4c9759-0x0;var _0x3c7c4f=_0xe9bd[_0x4c9759];return _0x3c7c4f;};'use strict';var multer=require('multer');var util=require(_0xde9b('0x0'));var path=require('path');var timeout=require(_0xde9b('0x1'));var express=require('express');var router=express[_0xde9b('0x2')]();var fs_extra=require(_0xde9b('0x3'));var auth=require(_0xde9b('0x4'));var interaction=require(_0xde9b('0x5'));var config=require(_0xde9b('0x6'));var controller=require(_0xde9b('0x7'));router[_0xde9b('0x8')]('/',auth['isAuthenticated'](),controller[_0xde9b('0x9')]);router[_0xde9b('0x8')](_0xde9b('0xa'),auth[_0xde9b('0xb')](),controller['show']);router[_0xde9b('0x8')](_0xde9b('0xc'),auth['isAuthenticated'](),controller[_0xde9b('0xd')]);router[_0xde9b('0x8')](_0xde9b('0xe'),auth[_0xde9b('0xb')](),controller[_0xde9b('0xf')]);router[_0xde9b('0x8')](_0xde9b('0x10'),auth[_0xde9b('0xb')](),controller[_0xde9b('0x11')]);router[_0xde9b('0x12')]('/',auth[_0xde9b('0xb')](),controller[_0xde9b('0x13')]);router[_0xde9b('0x14')](_0xde9b('0xa'),auth[_0xde9b('0xb')](),controller[_0xde9b('0x15')]);router[_0xde9b('0x16')]('/:id',auth[_0xde9b('0xb')](),controller[_0xde9b('0x17')]);module[_0xde9b('0x18')]=router; \ No newline at end of file +var _0xfe6b=['../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x614386,_0x181ef8){var _0x3e1c89=function(_0x2b8900){while(--_0x2b8900){_0x614386['push'](_0x614386['shift']());}};_0x3e1c89(++_0x181ef8);}(_0xfe6b,0x10b));var _0xbfe6=function(_0x3804da,_0x4b1678){_0x3804da=_0x3804da-0x0;var _0x1038e3=_0xfe6b[_0x3804da];return _0x1038e3;};'use strict';var multer=require(_0xbfe6('0x0'));var util=require(_0xbfe6('0x1'));var path=require(_0xbfe6('0x2'));var timeout=require(_0xbfe6('0x3'));var express=require('express');var router=express[_0xbfe6('0x4')]();var fs_extra=require(_0xbfe6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbfe6('0x6'));var config=require(_0xbfe6('0x7'));var controller=require(_0xbfe6('0x8'));router[_0xbfe6('0x9')]('/',auth[_0xbfe6('0xa')](),controller['index']);router['get'](_0xbfe6('0xb'),auth[_0xbfe6('0xa')](),controller['show']);router[_0xbfe6('0x9')]('/:id/fields',auth[_0xbfe6('0xa')](),controller[_0xbfe6('0xc')]);router[_0xbfe6('0x9')]('/:id/subjects',auth[_0xbfe6('0xa')](),controller[_0xbfe6('0xd')]);router['get'](_0xbfe6('0xe'),auth[_0xbfe6('0xa')](),controller[_0xbfe6('0xf')]);router['post']('/',auth[_0xbfe6('0xa')](),controller[_0xbfe6('0x10')]);router['put'](_0xbfe6('0xb'),auth[_0xbfe6('0xa')](),controller[_0xbfe6('0x11')]);router[_0xbfe6('0x12')]('/:id',auth[_0xbfe6('0xa')](),controller[_0xbfe6('0x13')]);module[_0xbfe6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1256af4..b1fe4fa 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 _0xfbe5=['account','ENUM','nothing','sequelize','exports','STRING','Task','Case','contact_lead','contact','lead','account_contact_lead'];(function(_0x3ad4f6,_0x519b1b){var _0x581a11=function(_0x21261d){while(--_0x21261d){_0x3ad4f6['push'](_0x3ad4f6['shift']());}};_0x581a11(++_0x519b1b);}(_0xfbe5,0xb7));var _0x5fbe=function(_0x84149a,_0x16ab6a){_0x84149a=_0x84149a-0x0;var _0x2e8770=_0xfbe5[_0x84149a];return _0x2e8770;};'use strict';var Sequelize=require(_0x5fbe('0x0'));module[_0x5fbe('0x1')]={'name':{'type':Sequelize[_0x5fbe('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x5fbe('0x3'),_0x5fbe('0x4')),'defaultValue':_0x5fbe('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x5fbe('0x5'),_0x5fbe('0x6'),_0x5fbe('0x7'),_0x5fbe('0x8'),_0x5fbe('0x9')),'defaultValue':_0x5fbe('0x5')},'moduleCreate':{'type':Sequelize[_0x5fbe('0xa')](_0x5fbe('0xb'),'contact',_0x5fbe('0x7'),_0x5fbe('0x9')),'defaultValue':_0x5fbe('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x5fbe('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x5fbe('0x2')]}}; \ No newline at end of file +var _0x3360=['contact_lead','contact','account_contact_lead','account','lead','sequelize','exports','STRING','Task','Case','ENUM'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0x3360,0x15a));var _0x0336=function(_0x3de5db,_0x400f9b){_0x3de5db=_0x3de5db-0x0;var _0x32408b=_0x3360[_0x3de5db];return _0x32408b;};'use strict';var Sequelize=require(_0x0336('0x0'));module[_0x0336('0x1')]={'name':{'type':Sequelize[_0x0336('0x2')]},'description':{'type':Sequelize[_0x0336('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x0336('0x3'),_0x0336('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x0336('0x5')](_0x0336('0x6'),_0x0336('0x7'),'lead',_0x0336('0x8'),_0x0336('0x9')),'defaultValue':_0x0336('0x6')},'moduleCreate':{'type':Sequelize['ENUM']('nothing','contact',_0x0336('0xa'),_0x0336('0x9')),'defaultValue':_0x0336('0xa')},'leadId':{'type':Sequelize[_0x0336('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x0336('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x0336('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x0336('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4ea4dd1..7cade87 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 _0xeae8=['params','keys','includeAll','find','create','body','getFields','findOne','SalesforceField','length','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','name','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','include','findAll','rows','show'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0xeae8,0x66));var _0x8eae=function(_0x4e7969,_0x2dc719){_0x4e7969=_0x4e7969-0x0;var _0x5a8892=_0xeae8[_0x4e7969];return _0x5a8892;};'use strict';var pdf=require(_0x8eae('0x0'));var emlformat=require(_0x8eae('0x1'));var rimraf=require(_0x8eae('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eae('0x3'));var rp=require('request-promise');var moment=require(_0x8eae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eae('0x5'));var util=require(_0x8eae('0x6'));var path=require(_0x8eae('0x7'));var sox=require(_0x8eae('0x8'));var csv=require(_0x8eae('0x9'));var ejs=require(_0x8eae('0xa'));var fs=require('fs');var fs_extra=require(_0x8eae('0xb'));var _=require(_0x8eae('0xc'));var squel=require(_0x8eae('0xd'));var crypto=require(_0x8eae('0xe'));var jsforce=require(_0x8eae('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8eae('0x10'));var Papa=require(_0x8eae('0x11'));var Redis=require(_0x8eae('0x12'));var authService=require(_0x8eae('0x13'));var qs=require(_0x8eae('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8eae('0x15'));var utils=require(_0x8eae('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8eae('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8eae('0x18'));var client=jayson[_0x8eae('0x19')][_0x8eae('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x10f61e,_0x14172c,_0x549d19,_0x16f24a){return new BPromise(function(_0x39d8e7,_0x384477){var _0x249320=_0x16f24a||client;return _0x249320[_0x8eae('0x1b')](_0x10f61e,_0x549d19)[_0x8eae('0x1c')](function(_0x28eae2){logger[_0x8eae('0x1d')](_0x8eae('0x1e'),_0x14172c,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x14172c,_0x8eae('0x1f'),JSON['stringify'](_0x28eae2));if(_0x28eae2[_0x8eae('0x20')]){if(_0x28eae2[_0x8eae('0x20')][_0x8eae('0x21')]===0x1f4){logger[_0x8eae('0x20')](_0x8eae('0x1e'),_0x14172c,_0x28eae2[_0x8eae('0x20')][_0x8eae('0x22')]);return _0x384477(_0x28eae2[_0x8eae('0x20')][_0x8eae('0x22')]);}logger[_0x8eae('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x14172c,_0x28eae2['error'][_0x8eae('0x22')]);return _0x39d8e7(_0x28eae2[_0x8eae('0x20')][_0x8eae('0x22')]);}else{logger['info'](_0x8eae('0x1e'),_0x14172c,_0x8eae('0x1f'));_0x39d8e7(_0x28eae2['result'][_0x8eae('0x22')]);}})[_0x8eae('0x23')](function(_0x529301){logger[_0x8eae('0x20')](_0x8eae('0x1e'),_0x14172c,_0x529301);_0x384477(_0x529301);});});}function respondWithStatusCode(_0x171710,_0x282fa5){_0x282fa5=_0x282fa5||0xcc;return function(_0x3edfdb){if(_0x3edfdb){return _0x171710[_0x8eae('0x24')](_0x282fa5);}return _0x171710[_0x8eae('0x25')](_0x282fa5)[_0x8eae('0x26')]();};}function respondWithResult(_0x14c0c5,_0x2fc7ec){_0x2fc7ec=_0x2fc7ec||0xc8;return function(_0x386bec){if(_0x386bec){return _0x14c0c5['status'](_0x2fc7ec)[_0x8eae('0x27')](_0x386bec);}};}function respondWithFilteredResult(_0xe9a3c5,_0x141940){return function(_0x34dff7){if(_0x34dff7){var _0x149b83=_0x34dff7[_0x8eae('0x28')],_0x13a80a=_0x141940['offset'],_0x206ba3=_0x141940[_0x8eae('0x29')]+_0x141940[_0x8eae('0x2a')],_0x4e7d7c;if(_0x206ba3>=_0x149b83){_0x206ba3=_0x149b83;_0x4e7d7c=0xc8;}else{_0x4e7d7c=0xce;}_0xe9a3c5[_0x8eae('0x25')](_0x4e7d7c);return _0xe9a3c5[_0x8eae('0x2b')](_0x8eae('0x2c'),_0x13a80a+'-'+_0x206ba3+'/'+_0x149b83)['json'](_0x34dff7);}return null;};}function patchUpdates(_0x52a030){return function(_0x2d50e1){try{jsonpatch[_0x8eae('0x2d')](_0x2d50e1,_0x52a030,!![]);}catch(_0x35c717){return BPromise[_0x8eae('0x2e')](_0x35c717);}return _0x2d50e1['save']();};}function saveUpdates(_0x113dc7,_0x22ffeb){return function(_0x3426d3){if(_0x3426d3){return _0x3426d3[_0x8eae('0x2f')](_0x113dc7)[_0x8eae('0x1c')](function(_0x2e9c51){return _0x2e9c51;});}return null;};}function removeEntity(_0x286bb2,_0x453b45){return function(_0x116024){if(_0x116024){return _0x116024[_0x8eae('0x30')]()[_0x8eae('0x1c')](function(){_0x286bb2[_0x8eae('0x25')](0xcc)[_0x8eae('0x26')]();});}};}function handleEntityNotFound(_0x2a0b6a,_0x1f247e){return function(_0x3d19f7){if(!_0x3d19f7){_0x2a0b6a[_0x8eae('0x24')](0x194);}return _0x3d19f7;};}function handleError(_0x6952f3,_0x3cba73){_0x3cba73=_0x3cba73||0x1f4;return function(_0x2fc72a){logger[_0x8eae('0x20')](_0x2fc72a['stack']);if(_0x2fc72a[_0x8eae('0x31')]){delete _0x2fc72a[_0x8eae('0x31')];}_0x6952f3[_0x8eae('0x25')](_0x3cba73)['send'](_0x2fc72a);};}exports[_0x8eae('0x32')]=function(_0x4c4ac8,_0x1e8e2e){var _0x172470={},_0x52c049={},_0xa885ad={'count':0x0,'rows':[]};var _0x538121=_['map'](db[_0x8eae('0x33')][_0x8eae('0x34')],function(_0x468e6d){return{'name':_0x468e6d[_0x8eae('0x35')],'type':_0x468e6d[_0x8eae('0x36')][_0x8eae('0x37')]};});_0x52c049[_0x8eae('0x38')]=_['map'](_0x538121,_0x8eae('0x31'));_0x52c049[_0x8eae('0x39')]=_['keys'](_0x4c4ac8['query']);_0x52c049['filters']=_[_0x8eae('0x3a')](_0x52c049[_0x8eae('0x38')],_0x52c049['query']);_0x172470[_0x8eae('0x3b')]=_[_0x8eae('0x3a')](_0x52c049['model'],qs[_0x8eae('0x3c')](_0x4c4ac8[_0x8eae('0x39')][_0x8eae('0x3c')]));_0x172470[_0x8eae('0x3b')]=_0x172470[_0x8eae('0x3b')]['length']?_0x172470[_0x8eae('0x3b')]:_0x52c049[_0x8eae('0x38')];if(!_0x4c4ac8[_0x8eae('0x39')]['hasOwnProperty'](_0x8eae('0x3d'))){_0x172470[_0x8eae('0x2a')]=qs['limit'](_0x4c4ac8[_0x8eae('0x39')][_0x8eae('0x2a')]);_0x172470[_0x8eae('0x29')]=qs[_0x8eae('0x29')](_0x4c4ac8['query'][_0x8eae('0x29')]);}_0x172470[_0x8eae('0x3e')]=qs[_0x8eae('0x3f')](_0x4c4ac8[_0x8eae('0x39')]['sort']);_0x172470[_0x8eae('0x40')]=qs[_0x8eae('0x41')](_[_0x8eae('0x42')](_0x4c4ac8[_0x8eae('0x39')],_0x52c049['filters']),_0x538121);if(_0x4c4ac8[_0x8eae('0x39')]['filter']){_0x172470[_0x8eae('0x40')]=_['merge'](_0x172470[_0x8eae('0x40')],{'$or':_[_0x8eae('0x43')](_0x538121,function(_0x4f0e5c){if(_0x4f0e5c[_0x8eae('0x36')]!==_0x8eae('0x44')){var _0x1fdf59={};_0x1fdf59[_0x4f0e5c[_0x8eae('0x31')]]={'$like':'%'+_0x4c4ac8[_0x8eae('0x39')][_0x8eae('0x45')]+'%'};return _0x1fdf59;}})});}_0x172470=_[_0x8eae('0x46')]({},_0x172470,_0x4c4ac8[_0x8eae('0x47')]);var _0x24a3ff={'where':_0x172470['where']};return db[_0x8eae('0x33')]['count'](_0x24a3ff)[_0x8eae('0x1c')](function(_0x39aeff){_0xa885ad[_0x8eae('0x28')]=_0x39aeff;if(_0x4c4ac8[_0x8eae('0x39')]['includeAll']){_0x172470[_0x8eae('0x48')]=[{'all':!![]}];}return db[_0x8eae('0x33')][_0x8eae('0x49')](_0x172470);})[_0x8eae('0x1c')](function(_0xc3f899){_0xa885ad[_0x8eae('0x4a')]=_0xc3f899;return _0xa885ad;})[_0x8eae('0x1c')](respondWithFilteredResult(_0x1e8e2e,_0x172470))[_0x8eae('0x23')](handleError(_0x1e8e2e,null));};exports[_0x8eae('0x4b')]=function(_0x84a054,_0x319a94){var _0x5c53d6={'raw':![],'where':{'id':_0x84a054[_0x8eae('0x4c')]['id']}},_0x2e06bb={};_0x2e06bb['model']=_[_0x8eae('0x4d')](db['SalesforceConfiguration'][_0x8eae('0x34')]);_0x2e06bb['query']=_[_0x8eae('0x4d')](_0x84a054['query']);_0x2e06bb[_0x8eae('0x41')]=_[_0x8eae('0x3a')](_0x2e06bb[_0x8eae('0x38')],_0x2e06bb[_0x8eae('0x39')]);_0x5c53d6[_0x8eae('0x3b')]=_[_0x8eae('0x3a')](_0x2e06bb[_0x8eae('0x38')],qs[_0x8eae('0x3c')](_0x84a054[_0x8eae('0x39')][_0x8eae('0x3c')]));_0x5c53d6[_0x8eae('0x3b')]=_0x5c53d6['attributes']['length']?_0x5c53d6[_0x8eae('0x3b')]:_0x2e06bb[_0x8eae('0x38')];if(_0x84a054[_0x8eae('0x39')][_0x8eae('0x4e')]){_0x5c53d6[_0x8eae('0x48')]=[{'all':!![]}];}_0x5c53d6=_[_0x8eae('0x46')]({},_0x5c53d6,_0x84a054['options']);return db[_0x8eae('0x33')][_0x8eae('0x4f')](_0x5c53d6)[_0x8eae('0x1c')](handleEntityNotFound(_0x319a94,null))[_0x8eae('0x1c')](respondWithResult(_0x319a94,null))[_0x8eae('0x23')](handleError(_0x319a94,null));};exports[_0x8eae('0x50')]=function(_0x581947,_0x14ec02){return db[_0x8eae('0x33')]['create'](_0x581947[_0x8eae('0x51')],{})[_0x8eae('0x1c')](respondWithResult(_0x14ec02,0xc9))[_0x8eae('0x23')](handleError(_0x14ec02,null));};exports[_0x8eae('0x2f')]=function(_0x1965a2,_0x1e66f1){if(_0x1965a2['body']['id']){delete _0x1965a2[_0x8eae('0x51')]['id'];}return db['SalesforceConfiguration'][_0x8eae('0x4f')]({'where':{'id':_0x1965a2[_0x8eae('0x4c')]['id']}})[_0x8eae('0x1c')](handleEntityNotFound(_0x1e66f1,null))['then'](saveUpdates(_0x1965a2[_0x8eae('0x51')],null))[_0x8eae('0x1c')](respondWithResult(_0x1e66f1,null))[_0x8eae('0x23')](handleError(_0x1e66f1,null));};exports[_0x8eae('0x30')]=function(_0x29c543,_0x4433ec){return db[_0x8eae('0x33')][_0x8eae('0x4f')]({'where':{'id':_0x29c543[_0x8eae('0x4c')]['id']}})[_0x8eae('0x1c')](handleEntityNotFound(_0x4433ec,null))[_0x8eae('0x1c')](removeEntity(_0x4433ec,null))['catch'](handleError(_0x4433ec,null));};exports[_0x8eae('0x52')]=function(_0x1a6d4c,_0x7cc387,_0x2f2a9f){var _0x2d7264={};var _0x1404df={};var _0x30ff16;var _0x1d105e;return db[_0x8eae('0x33')][_0x8eae('0x53')]({'where':{'id':_0x1a6d4c[_0x8eae('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7cc387,null))[_0x8eae('0x1c')](function(_0xef2735){if(_0xef2735){_0x30ff16=_0xef2735;_0x1404df[_0x8eae('0x38')]=_[_0x8eae('0x4d')](db[_0x8eae('0x54')][_0x8eae('0x34')]);_0x1404df['query']=_[_0x8eae('0x4d')](_0x1a6d4c['query']);_0x1404df[_0x8eae('0x41')]=_['intersection'](_0x1404df[_0x8eae('0x38')],_0x1404df[_0x8eae('0x39')]);_0x2d7264['attributes']=_[_0x8eae('0x3a')](_0x1404df['model'],qs['fields'](_0x1a6d4c[_0x8eae('0x39')]['fields']));_0x2d7264[_0x8eae('0x3b')]=_0x2d7264['attributes'][_0x8eae('0x55')]?_0x2d7264['attributes']:_0x1404df[_0x8eae('0x38')];_0x2d7264['order']=qs['sort'](_0x1a6d4c['query'][_0x8eae('0x3f')]);_0x2d7264[_0x8eae('0x40')]=qs['filters'](_[_0x8eae('0x42')](_0x1a6d4c[_0x8eae('0x39')],_0x1404df[_0x8eae('0x41')]));if(_0x1a6d4c['query'][_0x8eae('0x45')]){_0x2d7264['where']=_[_0x8eae('0x46')](_0x2d7264['where'],{'$or':_['map'](_0x2d7264[_0x8eae('0x3b')],function(_0x7269d7){var _0x47b1a6={};_0x47b1a6[_0x7269d7]={'$like':'%'+_0x1a6d4c[_0x8eae('0x39')][_0x8eae('0x45')]+'%'};return _0x47b1a6;})});}_0x2d7264=_['merge']({},_0x2d7264,_0x1a6d4c[_0x8eae('0x47')]);return _0x30ff16[_0x8eae('0x52')](_0x2d7264);}})[_0x8eae('0x1c')](function(_0x2de5da){if(_0x2de5da){_0x1d105e=_0x2de5da[_0x8eae('0x55')];if(!_0x1a6d4c['query'][_0x8eae('0x56')](_0x8eae('0x3d'))){_0x2d7264['limit']=qs[_0x8eae('0x2a')](_0x1a6d4c[_0x8eae('0x39')][_0x8eae('0x2a')]);_0x2d7264[_0x8eae('0x29')]=qs['offset'](_0x1a6d4c[_0x8eae('0x39')][_0x8eae('0x29')]);}return _0x30ff16[_0x8eae('0x52')](_0x2d7264);}})[_0x8eae('0x1c')](function(_0x327ead){if(_0x327ead){return _0x327ead?{'count':_0x1d105e,'rows':_0x327ead}:null;}})[_0x8eae('0x1c')](respondWithResult(_0x7cc387,null))[_0x8eae('0x23')](handleError(_0x7cc387,null));};exports[_0x8eae('0x57')]=function(_0x2f0532,_0x2eddda,_0xacd8fc){var _0x59ef33={};var _0x515840={};var _0x15a043;var _0x11cd28;return db[_0x8eae('0x33')][_0x8eae('0x53')]({'where':{'id':_0x2f0532[_0x8eae('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2eddda,null))[_0x8eae('0x1c')](function(_0x4d14e2){if(_0x4d14e2){_0x15a043=_0x4d14e2;_0x515840['model']=_[_0x8eae('0x4d')](db[_0x8eae('0x54')][_0x8eae('0x34')]);_0x515840[_0x8eae('0x39')]=_[_0x8eae('0x4d')](_0x2f0532[_0x8eae('0x39')]);_0x515840[_0x8eae('0x41')]=_[_0x8eae('0x3a')](_0x515840[_0x8eae('0x38')],_0x515840[_0x8eae('0x39')]);_0x59ef33[_0x8eae('0x3b')]=_[_0x8eae('0x3a')](_0x515840['model'],qs[_0x8eae('0x3c')](_0x2f0532['query']['fields']));_0x59ef33['attributes']=_0x59ef33[_0x8eae('0x3b')][_0x8eae('0x55')]?_0x59ef33['attributes']:_0x515840[_0x8eae('0x38')];_0x59ef33['order']=qs['sort'](_0x2f0532[_0x8eae('0x39')][_0x8eae('0x3f')]);_0x59ef33[_0x8eae('0x40')]=qs[_0x8eae('0x41')](_[_0x8eae('0x42')](_0x2f0532[_0x8eae('0x39')],_0x515840[_0x8eae('0x41')]));if(_0x2f0532[_0x8eae('0x39')]['filter']){_0x59ef33['where']=_[_0x8eae('0x46')](_0x59ef33[_0x8eae('0x40')],{'$or':_['map'](_0x59ef33[_0x8eae('0x3b')],function(_0x5b8c7e){var _0x5ababe={};_0x5ababe[_0x5b8c7e]={'$like':'%'+_0x2f0532['query'][_0x8eae('0x45')]+'%'};return _0x5ababe;})});}_0x59ef33=_[_0x8eae('0x46')]({},_0x59ef33,_0x2f0532[_0x8eae('0x47')]);return _0x15a043[_0x8eae('0x57')](_0x59ef33);}})[_0x8eae('0x1c')](function(_0x5b8245){if(_0x5b8245){_0x11cd28=_0x5b8245[_0x8eae('0x55')];if(!_0x2f0532['query']['hasOwnProperty'](_0x8eae('0x3d'))){_0x59ef33[_0x8eae('0x2a')]=qs[_0x8eae('0x2a')](_0x2f0532[_0x8eae('0x39')][_0x8eae('0x2a')]);_0x59ef33['offset']=qs[_0x8eae('0x29')](_0x2f0532[_0x8eae('0x39')][_0x8eae('0x29')]);}return _0x15a043[_0x8eae('0x57')](_0x59ef33);}})[_0x8eae('0x1c')](function(_0x2532de){if(_0x2532de){return _0x2532de?{'count':_0x11cd28,'rows':_0x2532de}:null;}})['then'](respondWithResult(_0x2eddda,null))[_0x8eae('0x23')](handleError(_0x2eddda,null));};exports['getDescriptions']=function(_0x636493,_0x33bcae,_0x366fa1){var _0x57da24={};var _0x9afb05={};var _0x25d296;var _0x1f4a61;return db['SalesforceConfiguration'][_0x8eae('0x53')]({'where':{'id':_0x636493[_0x8eae('0x4c')]['id']}})['then'](handleEntityNotFound(_0x33bcae,null))[_0x8eae('0x1c')](function(_0x116dd2){if(_0x116dd2){_0x25d296=_0x116dd2;_0x9afb05[_0x8eae('0x38')]=_[_0x8eae('0x4d')](db[_0x8eae('0x54')][_0x8eae('0x34')]);_0x9afb05['query']=_['keys'](_0x636493[_0x8eae('0x39')]);_0x9afb05[_0x8eae('0x41')]=_[_0x8eae('0x3a')](_0x9afb05[_0x8eae('0x38')],_0x9afb05[_0x8eae('0x39')]);_0x57da24[_0x8eae('0x3b')]=_[_0x8eae('0x3a')](_0x9afb05[_0x8eae('0x38')],qs[_0x8eae('0x3c')](_0x636493[_0x8eae('0x39')]['fields']));_0x57da24[_0x8eae('0x3b')]=_0x57da24[_0x8eae('0x3b')]['length']?_0x57da24['attributes']:_0x9afb05[_0x8eae('0x38')];_0x57da24[_0x8eae('0x3e')]=qs[_0x8eae('0x3f')](_0x636493['query'][_0x8eae('0x3f')]);_0x57da24[_0x8eae('0x40')]=qs[_0x8eae('0x41')](_['pick'](_0x636493[_0x8eae('0x39')],_0x9afb05[_0x8eae('0x41')]));if(_0x636493[_0x8eae('0x39')]['filter']){_0x57da24['where']=_[_0x8eae('0x46')](_0x57da24[_0x8eae('0x40')],{'$or':_[_0x8eae('0x43')](_0x57da24[_0x8eae('0x3b')],function(_0x3e40fb){var _0x1ff60c={};_0x1ff60c[_0x3e40fb]={'$like':'%'+_0x636493[_0x8eae('0x39')][_0x8eae('0x45')]+'%'};return _0x1ff60c;})});}_0x57da24=_['merge']({},_0x57da24,_0x636493[_0x8eae('0x47')]);return _0x25d296['getDescriptions'](_0x57da24);}})[_0x8eae('0x1c')](function(_0x16db71){if(_0x16db71){_0x1f4a61=_0x16db71['length'];if(!_0x636493[_0x8eae('0x39')][_0x8eae('0x56')](_0x8eae('0x3d'))){_0x57da24[_0x8eae('0x2a')]=qs[_0x8eae('0x2a')](_0x636493['query'][_0x8eae('0x2a')]);_0x57da24[_0x8eae('0x29')]=qs[_0x8eae('0x29')](_0x636493['query'][_0x8eae('0x29')]);}return _0x25d296[_0x8eae('0x58')](_0x57da24);}})['then'](function(_0x1340eb){if(_0x1340eb){return _0x1340eb?{'count':_0x1f4a61,'rows':_0x1340eb}:null;}})[_0x8eae('0x1c')](respondWithResult(_0x33bcae,null))[_0x8eae('0x23')](handleError(_0x33bcae,null));}; \ No newline at end of file +var _0x761c=['stack','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','name','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','count','includeAll','include','findAll','show','params','keys','options','find','create','body','update','findOne','SalesforceField','order','getFields','getSubjects','pick','nolimit','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','json','apply','reject','save','then','destroy'];(function(_0x349afa,_0x3914d5){var _0x1b8e23=function(_0x3e330d){while(--_0x3e330d){_0x349afa['push'](_0x349afa['shift']());}};_0x1b8e23(++_0x3914d5);}(_0x761c,0x18a));var _0xc761=function(_0xa61424,_0x43455b){_0xa61424=_0xa61424-0x0;var _0xbaef5e=_0x761c[_0xa61424];return _0xbaef5e;};'use strict';var pdf=require(_0xc761('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc761('0x1'));var zipdir=require(_0xc761('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc761('0x3'));var moment=require(_0xc761('0x4'));var BPromise=require(_0xc761('0x5'));var Mustache=require('mustache');var util=require(_0xc761('0x6'));var path=require('path');var sox=require(_0xc761('0x7'));var csv=require(_0xc761('0x8'));var ejs=require(_0xc761('0x9'));var fs=require('fs');var fs_extra=require(_0xc761('0xa'));var _=require(_0xc761('0xb'));var squel=require(_0xc761('0xc'));var crypto=require(_0xc761('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc761('0xe'));var toCsv=require(_0xc761('0x8'));var querystring=require(_0xc761('0xf'));var Papa=require(_0xc761('0x10'));var Redis=require(_0xc761('0x11'));var authService=require(_0xc761('0x12'));var qs=require(_0xc761('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc761('0x14'))(_0xc761('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc761('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc761('0x17'));var client=jayson['client'][_0xc761('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4a9bd3,_0x2abdd4,_0x2fb125,_0x186315){return new BPromise(function(_0x31cc11,_0x32f8a0){var _0x20061d=_0x186315||client;return _0x20061d[_0xc761('0x19')](_0x4a9bd3,_0x2fb125)['then'](function(_0x4c487e){logger[_0xc761('0x1a')](_0xc761('0x1b'),_0x2abdd4,_0xc761('0x1c'));logger['debug'](_0xc761('0x1d'),_0x2abdd4,_0xc761('0x1c'),JSON[_0xc761('0x1e')](_0x4c487e));if(_0x4c487e[_0xc761('0x1f')]){if(_0x4c487e[_0xc761('0x1f')]['code']===0x1f4){logger['error'](_0xc761('0x1b'),_0x2abdd4,_0x4c487e[_0xc761('0x1f')]['message']);return _0x32f8a0(_0x4c487e['error'][_0xc761('0x20')]);}logger[_0xc761('0x1f')](_0xc761('0x1b'),_0x2abdd4,_0x4c487e[_0xc761('0x1f')][_0xc761('0x20')]);return _0x31cc11(_0x4c487e['error'][_0xc761('0x20')]);}else{logger[_0xc761('0x1a')](_0xc761('0x1b'),_0x2abdd4,_0xc761('0x1c'));_0x31cc11(_0x4c487e[_0xc761('0x21')]['message']);}})[_0xc761('0x22')](function(_0x2043e0){logger[_0xc761('0x1f')](_0xc761('0x1b'),_0x2abdd4,_0x2043e0);_0x32f8a0(_0x2043e0);});});}function respondWithStatusCode(_0x47c0d9,_0x5a4b77){_0x5a4b77=_0x5a4b77||0xcc;return function(_0x361ac6){if(_0x361ac6){return _0x47c0d9[_0xc761('0x23')](_0x5a4b77);}return _0x47c0d9[_0xc761('0x24')](_0x5a4b77)[_0xc761('0x25')]();};}function respondWithResult(_0x2a8b01,_0x3728bd){_0x3728bd=_0x3728bd||0xc8;return function(_0x2909ce){if(_0x2909ce){return _0x2a8b01[_0xc761('0x24')](_0x3728bd)['json'](_0x2909ce);}};}function respondWithFilteredResult(_0x362dbb,_0x475e24){return function(_0xb90fd8){if(_0xb90fd8){var _0x4e8db5=_0xb90fd8['count'],_0x5542d6=_0x475e24[_0xc761('0x26')],_0x15dfb4=_0x475e24['offset']+_0x475e24[_0xc761('0x27')],_0x12192c;if(_0x15dfb4>=_0x4e8db5){_0x15dfb4=_0x4e8db5;_0x12192c=0xc8;}else{_0x12192c=0xce;}_0x362dbb['status'](_0x12192c);return _0x362dbb['set']('Content-Range',_0x5542d6+'-'+_0x15dfb4+'/'+_0x4e8db5)[_0xc761('0x28')](_0xb90fd8);}return null;};}function patchUpdates(_0x1989bb){return function(_0x358d64){try{jsonpatch[_0xc761('0x29')](_0x358d64,_0x1989bb,!![]);}catch(_0x58b80a){return BPromise[_0xc761('0x2a')](_0x58b80a);}return _0x358d64[_0xc761('0x2b')]();};}function saveUpdates(_0x3f37fb,_0x37da20){return function(_0x33148a){if(_0x33148a){return _0x33148a['update'](_0x3f37fb)[_0xc761('0x2c')](function(_0x2d142e){return _0x2d142e;});}return null;};}function removeEntity(_0xe0f026,_0x46741d){return function(_0x41e5a0){if(_0x41e5a0){return _0x41e5a0[_0xc761('0x2d')]()[_0xc761('0x2c')](function(){_0xe0f026[_0xc761('0x24')](0xcc)[_0xc761('0x25')]();});}};}function handleEntityNotFound(_0x1f4dfe,_0x48e9c8){return function(_0x6d53fa){if(!_0x6d53fa){_0x1f4dfe[_0xc761('0x23')](0x194);}return _0x6d53fa;};}function handleError(_0x59e9a9,_0x5cf48e){_0x5cf48e=_0x5cf48e||0x1f4;return function(_0x2360fc){logger[_0xc761('0x1f')](_0x2360fc[_0xc761('0x2e')]);if(_0x2360fc['name']){delete _0x2360fc['name'];}_0x59e9a9['status'](_0x5cf48e)[_0xc761('0x2f')](_0x2360fc);};}exports[_0xc761('0x30')]=function(_0x254603,_0x2b6ef0){var _0x49a84c={},_0x1489a7={},_0x58d2b6={'count':0x0,'rows':[]};var _0x4f5164=_[_0xc761('0x31')](db[_0xc761('0x32')][_0xc761('0x33')],function(_0x52ab02){return{'name':_0x52ab02[_0xc761('0x34')],'type':_0x52ab02[_0xc761('0x35')][_0xc761('0x36')]};});_0x1489a7['model']=_[_0xc761('0x31')](_0x4f5164,_0xc761('0x37'));_0x1489a7[_0xc761('0x38')]=_['keys'](_0x254603[_0xc761('0x38')]);_0x1489a7[_0xc761('0x39')]=_['intersection'](_0x1489a7[_0xc761('0x3a')],_0x1489a7['query']);_0x49a84c['attributes']=_[_0xc761('0x3b')](_0x1489a7[_0xc761('0x3a')],qs[_0xc761('0x3c')](_0x254603[_0xc761('0x38')]['fields']));_0x49a84c['attributes']=_0x49a84c[_0xc761('0x3d')][_0xc761('0x3e')]?_0x49a84c[_0xc761('0x3d')]:_0x1489a7[_0xc761('0x3a')];if(!_0x254603[_0xc761('0x38')][_0xc761('0x3f')]('nolimit')){_0x49a84c[_0xc761('0x27')]=qs[_0xc761('0x27')](_0x254603[_0xc761('0x38')][_0xc761('0x27')]);_0x49a84c['offset']=qs['offset'](_0x254603[_0xc761('0x38')][_0xc761('0x26')]);}_0x49a84c['order']=qs[_0xc761('0x40')](_0x254603[_0xc761('0x38')][_0xc761('0x40')]);_0x49a84c[_0xc761('0x41')]=qs[_0xc761('0x39')](_['pick'](_0x254603[_0xc761('0x38')],_0x1489a7[_0xc761('0x39')]),_0x4f5164);if(_0x254603[_0xc761('0x38')]['filter']){_0x49a84c[_0xc761('0x41')]=_['merge'](_0x49a84c['where'],{'$or':_['map'](_0x4f5164,function(_0x3af6aa){if(_0x3af6aa[_0xc761('0x35')]!=='VIRTUAL'){var _0x22d58d={};_0x22d58d[_0x3af6aa[_0xc761('0x37')]]={'$like':'%'+_0x254603[_0xc761('0x38')][_0xc761('0x42')]+'%'};return _0x22d58d;}})});}_0x49a84c=_[_0xc761('0x43')]({},_0x49a84c,_0x254603['options']);var _0xe14a5d={'where':_0x49a84c[_0xc761('0x41')]};return db[_0xc761('0x32')][_0xc761('0x44')](_0xe14a5d)[_0xc761('0x2c')](function(_0x13d7fc){_0x58d2b6[_0xc761('0x44')]=_0x13d7fc;if(_0x254603[_0xc761('0x38')][_0xc761('0x45')]){_0x49a84c[_0xc761('0x46')]=[{'all':!![]}];}return db[_0xc761('0x32')][_0xc761('0x47')](_0x49a84c);})['then'](function(_0x3926aa){_0x58d2b6['rows']=_0x3926aa;return _0x58d2b6;})['then'](respondWithFilteredResult(_0x2b6ef0,_0x49a84c))[_0xc761('0x22')](handleError(_0x2b6ef0,null));};exports[_0xc761('0x48')]=function(_0x232d8b,_0x50de1c){var _0x53d81b={'raw':![],'where':{'id':_0x232d8b[_0xc761('0x49')]['id']}},_0xdef9ba={};_0xdef9ba['model']=_[_0xc761('0x4a')](db['SalesforceConfiguration']['rawAttributes']);_0xdef9ba['query']=_['keys'](_0x232d8b[_0xc761('0x38')]);_0xdef9ba[_0xc761('0x39')]=_[_0xc761('0x3b')](_0xdef9ba[_0xc761('0x3a')],_0xdef9ba[_0xc761('0x38')]);_0x53d81b[_0xc761('0x3d')]=_[_0xc761('0x3b')](_0xdef9ba['model'],qs['fields'](_0x232d8b['query']['fields']));_0x53d81b[_0xc761('0x3d')]=_0x53d81b[_0xc761('0x3d')][_0xc761('0x3e')]?_0x53d81b[_0xc761('0x3d')]:_0xdef9ba[_0xc761('0x3a')];if(_0x232d8b['query'][_0xc761('0x45')]){_0x53d81b[_0xc761('0x46')]=[{'all':!![]}];}_0x53d81b=_[_0xc761('0x43')]({},_0x53d81b,_0x232d8b[_0xc761('0x4b')]);return db[_0xc761('0x32')][_0xc761('0x4c')](_0x53d81b)[_0xc761('0x2c')](handleEntityNotFound(_0x50de1c,null))['then'](respondWithResult(_0x50de1c,null))[_0xc761('0x22')](handleError(_0x50de1c,null));};exports[_0xc761('0x4d')]=function(_0x49aa15,_0x4b2f08){return db[_0xc761('0x32')][_0xc761('0x4d')](_0x49aa15[_0xc761('0x4e')],{})['then'](respondWithResult(_0x4b2f08,0xc9))[_0xc761('0x22')](handleError(_0x4b2f08,null));};exports[_0xc761('0x4f')]=function(_0x5753e5,_0x310cc1){if(_0x5753e5[_0xc761('0x4e')]['id']){delete _0x5753e5['body']['id'];}return db['SalesforceConfiguration'][_0xc761('0x4c')]({'where':{'id':_0x5753e5['params']['id']}})['then'](handleEntityNotFound(_0x310cc1,null))[_0xc761('0x2c')](saveUpdates(_0x5753e5[_0xc761('0x4e')],null))[_0xc761('0x2c')](respondWithResult(_0x310cc1,null))[_0xc761('0x22')](handleError(_0x310cc1,null));};exports['destroy']=function(_0x55d0a7,_0x31bc2b){return db[_0xc761('0x32')][_0xc761('0x4c')]({'where':{'id':_0x55d0a7[_0xc761('0x49')]['id']}})[_0xc761('0x2c')](handleEntityNotFound(_0x31bc2b,null))[_0xc761('0x2c')](removeEntity(_0x31bc2b,null))[_0xc761('0x22')](handleError(_0x31bc2b,null));};exports['getFields']=function(_0x3db4cc,_0x5cd0b6,_0x288503){var _0x54df3e={};var _0x41a9a4={};var _0x455009;var _0x3170eb;return db[_0xc761('0x32')][_0xc761('0x50')]({'where':{'id':_0x3db4cc[_0xc761('0x49')]['id']}})['then'](handleEntityNotFound(_0x5cd0b6,null))[_0xc761('0x2c')](function(_0x2c93c3){if(_0x2c93c3){_0x455009=_0x2c93c3;_0x41a9a4[_0xc761('0x3a')]=_[_0xc761('0x4a')](db[_0xc761('0x51')][_0xc761('0x33')]);_0x41a9a4[_0xc761('0x38')]=_[_0xc761('0x4a')](_0x3db4cc[_0xc761('0x38')]);_0x41a9a4[_0xc761('0x39')]=_[_0xc761('0x3b')](_0x41a9a4[_0xc761('0x3a')],_0x41a9a4[_0xc761('0x38')]);_0x54df3e[_0xc761('0x3d')]=_[_0xc761('0x3b')](_0x41a9a4['model'],qs[_0xc761('0x3c')](_0x3db4cc['query'][_0xc761('0x3c')]));_0x54df3e[_0xc761('0x3d')]=_0x54df3e[_0xc761('0x3d')]['length']?_0x54df3e['attributes']:_0x41a9a4['model'];_0x54df3e[_0xc761('0x52')]=qs[_0xc761('0x40')](_0x3db4cc['query'][_0xc761('0x40')]);_0x54df3e['where']=qs['filters'](_['pick'](_0x3db4cc['query'],_0x41a9a4['filters']));if(_0x3db4cc[_0xc761('0x38')]['filter']){_0x54df3e[_0xc761('0x41')]=_[_0xc761('0x43')](_0x54df3e[_0xc761('0x41')],{'$or':_[_0xc761('0x31')](_0x54df3e['attributes'],function(_0x2917fd){var _0x533b4b={};_0x533b4b[_0x2917fd]={'$like':'%'+_0x3db4cc[_0xc761('0x38')][_0xc761('0x42')]+'%'};return _0x533b4b;})});}_0x54df3e=_['merge']({},_0x54df3e,_0x3db4cc[_0xc761('0x4b')]);return _0x455009[_0xc761('0x53')](_0x54df3e);}})[_0xc761('0x2c')](function(_0x547335){if(_0x547335){_0x3170eb=_0x547335[_0xc761('0x3e')];if(!_0x3db4cc[_0xc761('0x38')]['hasOwnProperty']('nolimit')){_0x54df3e[_0xc761('0x27')]=qs['limit'](_0x3db4cc[_0xc761('0x38')][_0xc761('0x27')]);_0x54df3e[_0xc761('0x26')]=qs[_0xc761('0x26')](_0x3db4cc[_0xc761('0x38')][_0xc761('0x26')]);}return _0x455009['getFields'](_0x54df3e);}})['then'](function(_0x110c31){if(_0x110c31){return _0x110c31?{'count':_0x3170eb,'rows':_0x110c31}:null;}})[_0xc761('0x2c')](respondWithResult(_0x5cd0b6,null))[_0xc761('0x22')](handleError(_0x5cd0b6,null));};exports[_0xc761('0x54')]=function(_0x2d383e,_0x270bb7,_0x135205){var _0x1c2692={};var _0x5a03c8={};var _0x5a3f95;var _0x32520c;return db[_0xc761('0x32')][_0xc761('0x50')]({'where':{'id':_0x2d383e[_0xc761('0x49')]['id']}})[_0xc761('0x2c')](handleEntityNotFound(_0x270bb7,null))['then'](function(_0x41d58f){if(_0x41d58f){_0x5a3f95=_0x41d58f;_0x5a03c8[_0xc761('0x3a')]=_[_0xc761('0x4a')](db[_0xc761('0x51')][_0xc761('0x33')]);_0x5a03c8[_0xc761('0x38')]=_[_0xc761('0x4a')](_0x2d383e[_0xc761('0x38')]);_0x5a03c8[_0xc761('0x39')]=_[_0xc761('0x3b')](_0x5a03c8[_0xc761('0x3a')],_0x5a03c8[_0xc761('0x38')]);_0x1c2692[_0xc761('0x3d')]=_[_0xc761('0x3b')](_0x5a03c8[_0xc761('0x3a')],qs[_0xc761('0x3c')](_0x2d383e[_0xc761('0x38')][_0xc761('0x3c')]));_0x1c2692[_0xc761('0x3d')]=_0x1c2692['attributes'][_0xc761('0x3e')]?_0x1c2692[_0xc761('0x3d')]:_0x5a03c8[_0xc761('0x3a')];_0x1c2692[_0xc761('0x52')]=qs[_0xc761('0x40')](_0x2d383e[_0xc761('0x38')][_0xc761('0x40')]);_0x1c2692['where']=qs['filters'](_[_0xc761('0x55')](_0x2d383e['query'],_0x5a03c8['filters']));if(_0x2d383e[_0xc761('0x38')][_0xc761('0x42')]){_0x1c2692[_0xc761('0x41')]=_[_0xc761('0x43')](_0x1c2692[_0xc761('0x41')],{'$or':_[_0xc761('0x31')](_0x1c2692[_0xc761('0x3d')],function(_0x1caf31){var _0x4583d0={};_0x4583d0[_0x1caf31]={'$like':'%'+_0x2d383e['query'][_0xc761('0x42')]+'%'};return _0x4583d0;})});}_0x1c2692=_[_0xc761('0x43')]({},_0x1c2692,_0x2d383e[_0xc761('0x4b')]);return _0x5a3f95[_0xc761('0x54')](_0x1c2692);}})[_0xc761('0x2c')](function(_0x255ad4){if(_0x255ad4){_0x32520c=_0x255ad4['length'];if(!_0x2d383e[_0xc761('0x38')][_0xc761('0x3f')](_0xc761('0x56'))){_0x1c2692[_0xc761('0x27')]=qs[_0xc761('0x27')](_0x2d383e[_0xc761('0x38')][_0xc761('0x27')]);_0x1c2692['offset']=qs[_0xc761('0x26')](_0x2d383e[_0xc761('0x38')][_0xc761('0x26')]);}return _0x5a3f95[_0xc761('0x54')](_0x1c2692);}})['then'](function(_0x36ced5){if(_0x36ced5){return _0x36ced5?{'count':_0x32520c,'rows':_0x36ced5}:null;}})[_0xc761('0x2c')](respondWithResult(_0x270bb7,null))[_0xc761('0x22')](handleError(_0x270bb7,null));};exports[_0xc761('0x57')]=function(_0x205a37,_0x2d4fbc,_0x1762cc){var _0x3ab53f={};var _0x4f64ff={};var _0x5ce6ea;var _0x3cc142;return db[_0xc761('0x32')][_0xc761('0x50')]({'where':{'id':_0x205a37[_0xc761('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d4fbc,null))['then'](function(_0x246eab){if(_0x246eab){_0x5ce6ea=_0x246eab;_0x4f64ff['model']=_[_0xc761('0x4a')](db[_0xc761('0x51')]['rawAttributes']);_0x4f64ff[_0xc761('0x38')]=_[_0xc761('0x4a')](_0x205a37['query']);_0x4f64ff[_0xc761('0x39')]=_['intersection'](_0x4f64ff[_0xc761('0x3a')],_0x4f64ff[_0xc761('0x38')]);_0x3ab53f[_0xc761('0x3d')]=_['intersection'](_0x4f64ff[_0xc761('0x3a')],qs[_0xc761('0x3c')](_0x205a37[_0xc761('0x38')][_0xc761('0x3c')]));_0x3ab53f[_0xc761('0x3d')]=_0x3ab53f[_0xc761('0x3d')][_0xc761('0x3e')]?_0x3ab53f[_0xc761('0x3d')]:_0x4f64ff[_0xc761('0x3a')];_0x3ab53f[_0xc761('0x52')]=qs[_0xc761('0x40')](_0x205a37[_0xc761('0x38')]['sort']);_0x3ab53f[_0xc761('0x41')]=qs[_0xc761('0x39')](_[_0xc761('0x55')](_0x205a37[_0xc761('0x38')],_0x4f64ff['filters']));if(_0x205a37['query'][_0xc761('0x42')]){_0x3ab53f['where']=_[_0xc761('0x43')](_0x3ab53f[_0xc761('0x41')],{'$or':_[_0xc761('0x31')](_0x3ab53f[_0xc761('0x3d')],function(_0x479654){var _0x4b1edf={};_0x4b1edf[_0x479654]={'$like':'%'+_0x205a37['query']['filter']+'%'};return _0x4b1edf;})});}_0x3ab53f=_[_0xc761('0x43')]({},_0x3ab53f,_0x205a37[_0xc761('0x4b')]);return _0x5ce6ea[_0xc761('0x57')](_0x3ab53f);}})[_0xc761('0x2c')](function(_0x137040){if(_0x137040){_0x3cc142=_0x137040[_0xc761('0x3e')];if(!_0x205a37[_0xc761('0x38')][_0xc761('0x3f')](_0xc761('0x56'))){_0x3ab53f[_0xc761('0x27')]=qs['limit'](_0x205a37['query'][_0xc761('0x27')]);_0x3ab53f[_0xc761('0x26')]=qs[_0xc761('0x26')](_0x205a37[_0xc761('0x38')][_0xc761('0x26')]);}return _0x5ce6ea[_0xc761('0x57')](_0x3ab53f);}})['then'](function(_0x1955db){if(_0x1955db){return _0x1955db?{'count':_0x3cc142,'rows':_0x1955db}:null;}})['then'](respondWithResult(_0x2d4fbc,null))[_0xc761('0x22')](handleError(_0x2d4fbc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 74a7df5..2c09d44 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 _0x4bff=['request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1b4474,_0x4f2025){var _0x3c7dac=function(_0x338ef6){while(--_0x338ef6){_0x1b4474['push'](_0x1b4474['shift']());}};_0x3c7dac(++_0x4f2025);}(_0x4bff,0x166));var _0xf4bf=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x4bff[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0xf4bf('0x0'));var util=require(_0xf4bf('0x1'));var logger=require(_0xf4bf('0x2'))(_0xf4bf('0x3'));var moment=require(_0xf4bf('0x4'));var BPromise=require(_0xf4bf('0x5'));var rp=require(_0xf4bf('0x6'));var fs=require('fs');var path=require(_0xf4bf('0x7'));var rimraf=require(_0xf4bf('0x8'));var config=require('../../config/environment');var attributes=require(_0xf4bf('0x9'));module[_0xf4bf('0xa')]=function(_0x344966,_0x308bd3){return _0x344966[_0xf4bf('0xb')](_0xf4bf('0xc'),attributes,{'tableName':_0xf4bf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aaf=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_salesforce_configurations','lodash','../../config/logger','api'];(function(_0x55b816,_0x3d5043){var _0x8853a1=function(_0x4589a8){while(--_0x4589a8){_0x55b816['push'](_0x55b816['shift']());}};_0x8853a1(++_0x3d5043);}(_0x0aaf,0x13c));var _0xf0aa=function(_0x3ea8b8,_0x508efb){_0x3ea8b8=_0x3ea8b8-0x0;var _0x7d213f=_0x0aaf[_0x3ea8b8];return _0x7d213f;};'use strict';var _=require(_0xf0aa('0x0'));var util=require('util');var logger=require(_0xf0aa('0x1'))(_0xf0aa('0x2'));var moment=require(_0xf0aa('0x3'));var BPromise=require(_0xf0aa('0x4'));var rp=require(_0xf0aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0aa('0x6'));var config=require(_0xf0aa('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xf0aa('0x8')]=function(_0x2842af,_0x291314){return _0x2842af[_0xf0aa('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0xf0aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index d7329cc..7b7c5aa 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 _0x13cd=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x820259,_0x274fd9){var _0x9ffe7b=function(_0x1a14b5){while(--_0x1a14b5){_0x820259['push'](_0x820259['shift']());}};_0x9ffe7b(++_0x274fd9);}(_0x13cd,0x162));var _0xd13c=function(_0x2ed20e,_0x4d01c5){_0x2ed20e=_0x2ed20e-0x0;var _0x354003=_0x13cd[_0x2ed20e];return _0x354003;};'use strict';var _=require(_0xd13c('0x0'));var util=require(_0xd13c('0x1'));var moment=require(_0xd13c('0x2'));var BPromise=require(_0xd13c('0x3'));var rs=require(_0xd13c('0x4'));var fs=require('fs');var Redis=require(_0xd13c('0x5'));var db=require(_0xd13c('0x6'))['db'];var utils=require(_0xd13c('0x7'));var logger=require(_0xd13c('0x8'))(_0xd13c('0x9'));var config=require('../../config/environment');var jayson=require(_0xd13c('0xa'));var client=jayson[_0xd13c('0xb')][_0xd13c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cf4ff,_0x532d79,_0x285e59){return new BPromise(function(_0x310b28,_0x5b3849){return client[_0xd13c('0xd')](_0x5cf4ff,_0x285e59)['then'](function(_0x50146b){logger[_0xd13c('0xe')](_0xd13c('0xf'),_0x532d79,_0xd13c('0x10'));logger[_0xd13c('0x11')](_0xd13c('0x12'),_0x532d79,_0xd13c('0x10'),JSON[_0xd13c('0x13')](_0x50146b));if(_0x50146b['error']){if(_0x50146b[_0xd13c('0x14')][_0xd13c('0x15')]===0x1f4){logger['error'](_0xd13c('0xf'),_0x532d79,_0x50146b[_0xd13c('0x14')][_0xd13c('0x16')]);return _0x5b3849(_0x50146b[_0xd13c('0x14')][_0xd13c('0x16')]);}logger[_0xd13c('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x532d79,_0x50146b[_0xd13c('0x14')][_0xd13c('0x16')]);return _0x310b28(_0x50146b[_0xd13c('0x14')][_0xd13c('0x16')]);}else{logger[_0xd13c('0xe')](_0xd13c('0xf'),_0x532d79,_0xd13c('0x10'));_0x310b28(_0x50146b[_0xd13c('0x17')][_0xd13c('0x16')]);}})[_0xd13c('0x18')](function(_0x58f173){logger[_0xd13c('0x14')](_0xd13c('0xf'),_0x532d79,_0x58f173);_0x5b3849(_0x58f173);});});} \ No newline at end of file +var _0x7049=['client','http','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x217b6b,_0x2d8f85){var _0x1410ff=function(_0x5fe6d0){while(--_0x5fe6d0){_0x217b6b['push'](_0x217b6b['shift']());}};_0x1410ff(++_0x2d8f85);}(_0x7049,0xfb));var _0x9704=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7049[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x9704('0x0'));var moment=require('moment');var BPromise=require(_0x9704('0x1'));var rs=require(_0x9704('0x2'));var fs=require('fs');var Redis=require(_0x9704('0x3'));var db=require(_0x9704('0x4'))['db'];var utils=require(_0x9704('0x5'));var logger=require('../../config/logger')(_0x9704('0x6'));var config=require(_0x9704('0x7'));var jayson=require(_0x9704('0x8'));var client=jayson[_0x9704('0x9')][_0x9704('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bcc8b,_0x5573c4,_0x421c21){return new BPromise(function(_0x3ba6cd,_0x15eb67){return client[_0x9704('0xb')](_0x2bcc8b,_0x421c21)['then'](function(_0x524d16){logger['info'](_0x9704('0xc'),_0x5573c4,_0x9704('0xd'));logger[_0x9704('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5573c4,_0x9704('0xd'),JSON['stringify'](_0x524d16));if(_0x524d16[_0x9704('0xf')]){if(_0x524d16[_0x9704('0xf')][_0x9704('0x10')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5573c4,_0x524d16['error']['message']);return _0x15eb67(_0x524d16['error'][_0x9704('0x11')]);}logger[_0x9704('0xf')](_0x9704('0xc'),_0x5573c4,_0x524d16[_0x9704('0xf')][_0x9704('0x11')]);return _0x3ba6cd(_0x524d16[_0x9704('0xf')][_0x9704('0x11')]);}else{logger[_0x9704('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5573c4,_0x9704('0xd'));_0x3ba6cd(_0x524d16['result'][_0x9704('0x11')]);}})[_0x9704('0x13')](function(_0x118018){logger[_0x9704('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5573c4,_0x118018);_0x15eb67(_0x118018);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ea38ca4..c69e222 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 _0xf7d9=['delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x24a136,_0x54bb31){var _0x2275a4=function(_0x28d9fa){while(--_0x28d9fa){_0x24a136['push'](_0x24a136['shift']());}};_0x2275a4(++_0x54bb31);}(_0xf7d9,0x122));var _0x9f7d=function(_0x4b45ff,_0x21ff30){_0x4b45ff=_0x4b45ff-0x0;var _0x140c4f=_0xf7d9[_0x4b45ff];return _0x140c4f;};'use strict';var multer=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var path=require(_0x9f7d('0x2'));var timeout=require(_0x9f7d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f7d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f7d('0x5'));var config=require(_0x9f7d('0x6'));var controller=require(_0x9f7d('0x7'));router[_0x9f7d('0x8')]('/',auth[_0x9f7d('0x9')](),controller['index']);router['get'](_0x9f7d('0xa'),auth[_0x9f7d('0x9')](),controller[_0x9f7d('0xb')]);router[_0x9f7d('0xc')]('/',auth[_0x9f7d('0x9')](),controller[_0x9f7d('0xd')]);router['put'](_0x9f7d('0xa'),auth[_0x9f7d('0x9')](),controller['update']);router[_0x9f7d('0xe')](_0x9f7d('0xa'),auth[_0x9f7d('0x9')](),controller['destroy']);module[_0x9f7d('0xf')]=router; \ No newline at end of file +var _0x002d=['./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0x002d,0xca));var _0xd002=function(_0x300cf3,_0x35081d){_0x300cf3=_0x300cf3-0x0;var _0x427a00=_0x002d[_0x300cf3];return _0x427a00;};'use strict';var multer=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var path=require(_0xd002('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd002('0x3')]();var fs_extra=require(_0xd002('0x4'));var auth=require(_0xd002('0x5'));var interaction=require(_0xd002('0x6'));var config=require(_0xd002('0x7'));var controller=require(_0xd002('0x8'));router[_0xd002('0x9')]('/',auth[_0xd002('0xa')](),controller[_0xd002('0xb')]);router[_0xd002('0x9')](_0xd002('0xc'),auth[_0xd002('0xa')](),controller[_0xd002('0xd')]);router[_0xd002('0xe')]('/',auth[_0xd002('0xa')](),controller[_0xd002('0xf')]);router[_0xd002('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd002('0x11')]);router[_0xd002('0x12')](_0xd002('0xc'),auth['isAuthenticated'](),controller[_0xd002('0x13')]);module[_0xd002('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 20f99d4..03a372f 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 _0xedd9=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0x1d7791,_0x2a291f){var _0x2293f8=function(_0x464734){while(--_0x464734){_0x1d7791['push'](_0x1d7791['shift']());}};_0x2293f8(++_0x2a291f);}(_0xedd9,0xfc));var _0x9edd=function(_0x196ee8,_0xdb9c49){_0x196ee8=_0x196ee8-0x0;var _0x24bba1=_0xedd9[_0x196ee8];return _0x24bba1;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'type':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'defaultValue':_0x9edd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9edd('0x7')]},'keyType':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9edd('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xcb91=['string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x2ee96b,_0x83fb7d){var _0x200083=function(_0x1d34ab){while(--_0x1d34ab){_0x2ee96b['push'](_0x2ee96b['shift']());}};_0x200083(++_0x83fb7d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0xcb91[_0x3ccdf8];return _0x243dab;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue',_0x1cb9('0x4')),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1cb9('0x5')]},'keyType':{'type':Sequelize[_0x1cb9('0x0')]('string',_0x1cb9('0x2'),_0x1cb9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb9('0x5')]},'variableName':{'type':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2ebfbb5..0f305b5 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 _0x09a4=['set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','SalesforceField','includeAll','include','rows','catch','show','params','keys','fields','find','create','body','destroy','html-pdf','eml-format','rimraf','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','count','offset','limit'];(function(_0x3d9931,_0x1c1039){var _0x449059=function(_0x406f5e){while(--_0x406f5e){_0x3d9931['push'](_0x3d9931['shift']());}};_0x449059(++_0x1c1039);}(_0x09a4,0x13a));var _0x409a=function(_0x35e773,_0x101684){_0x35e773=_0x35e773-0x0;var _0x414198=_0x09a4[_0x35e773];return _0x414198;};'use strict';var pdf=require(_0x409a('0x0'));var emlformat=require(_0x409a('0x1'));var rimraf=require(_0x409a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x409a('0x3'));var Mustache=require(_0x409a('0x4'));var util=require(_0x409a('0x5'));var path=require(_0x409a('0x6'));var sox=require('sox');var csv=require(_0x409a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x409a('0x8'));var _=require(_0x409a('0x9'));var squel=require(_0x409a('0xa'));var crypto=require(_0x409a('0xb'));var jsforce=require(_0x409a('0xc'));var deskjs=require(_0x409a('0xd'));var toCsv=require(_0x409a('0x7'));var querystring=require(_0x409a('0xe'));var Papa=require('papaparse');var Redis=require(_0x409a('0xf'));var authService=require(_0x409a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x409a('0x11'));var logger=require(_0x409a('0x12'))(_0x409a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a0730,_0x279c17){_0x279c17=_0x279c17||0xcc;return function(_0x1af5e9){if(_0x1af5e9){return _0x3a0730[_0x409a('0x14')](_0x279c17);}return _0x3a0730[_0x409a('0x15')](_0x279c17)['end']();};}function respondWithResult(_0x40081d,_0x35ebfd){_0x35ebfd=_0x35ebfd||0xc8;return function(_0x246ce8){if(_0x246ce8){return _0x40081d[_0x409a('0x15')](_0x35ebfd)[_0x409a('0x16')](_0x246ce8);}};}function respondWithFilteredResult(_0x22b362,_0x264d07){return function(_0x7ebcb8){if(_0x7ebcb8){var _0x49c1cc=_0x7ebcb8[_0x409a('0x17')],_0x4db335=_0x264d07['offset'],_0x59400d=_0x264d07[_0x409a('0x18')]+_0x264d07[_0x409a('0x19')],_0x36ed92;if(_0x59400d>=_0x49c1cc){_0x59400d=_0x49c1cc;_0x36ed92=0xc8;}else{_0x36ed92=0xce;}_0x22b362['status'](_0x36ed92);return _0x22b362[_0x409a('0x1a')](_0x409a('0x1b'),_0x4db335+'-'+_0x59400d+'/'+_0x49c1cc)[_0x409a('0x16')](_0x7ebcb8);}return null;};}function patchUpdates(_0x27d33a){return function(_0x18052c){try{jsonpatch[_0x409a('0x1c')](_0x18052c,_0x27d33a,!![]);}catch(_0x5943c7){return BPromise[_0x409a('0x1d')](_0x5943c7);}return _0x18052c['save']();};}function saveUpdates(_0x2372e2,_0x429c21){return function(_0x253702){if(_0x253702){return _0x253702[_0x409a('0x1e')](_0x2372e2)[_0x409a('0x1f')](function(_0x9613eb){return _0x9613eb;});}return null;};}function removeEntity(_0x45297a,_0x20b377){return function(_0x31332c){if(_0x31332c){return _0x31332c['destroy']()[_0x409a('0x1f')](function(){_0x45297a[_0x409a('0x15')](0xcc)[_0x409a('0x20')]();});}};}function handleEntityNotFound(_0x4e17a8,_0xe99690){return function(_0x29fa15){if(!_0x29fa15){_0x4e17a8[_0x409a('0x14')](0x194);}return _0x29fa15;};}function handleError(_0x48ecef,_0x488cf0){_0x488cf0=_0x488cf0||0x1f4;return function(_0x520841){logger[_0x409a('0x21')](_0x520841[_0x409a('0x22')]);if(_0x520841[_0x409a('0x23')]){delete _0x520841[_0x409a('0x23')];}_0x48ecef[_0x409a('0x15')](_0x488cf0)[_0x409a('0x24')](_0x520841);};}exports[_0x409a('0x25')]=function(_0x235bd0,_0x578425){var _0x354d99={},_0x5d26a1={},_0x25261a={'count':0x0,'rows':[]};var _0x3ed28e=_[_0x409a('0x26')](db['SalesforceField'][_0x409a('0x27')],function(_0x16947e){return{'name':_0x16947e[_0x409a('0x28')],'type':_0x16947e[_0x409a('0x29')]['key']};});_0x5d26a1[_0x409a('0x2a')]=_[_0x409a('0x26')](_0x3ed28e,_0x409a('0x23'));_0x5d26a1[_0x409a('0x2b')]=_['keys'](_0x235bd0['query']);_0x5d26a1['filters']=_[_0x409a('0x2c')](_0x5d26a1[_0x409a('0x2a')],_0x5d26a1['query']);_0x354d99[_0x409a('0x2d')]=_[_0x409a('0x2c')](_0x5d26a1['model'],qs['fields'](_0x235bd0[_0x409a('0x2b')]['fields']));_0x354d99[_0x409a('0x2d')]=_0x354d99[_0x409a('0x2d')][_0x409a('0x2e')]?_0x354d99[_0x409a('0x2d')]:_0x5d26a1[_0x409a('0x2a')];if(!_0x235bd0[_0x409a('0x2b')][_0x409a('0x2f')]('nolimit')){_0x354d99[_0x409a('0x19')]=qs['limit'](_0x235bd0['query'][_0x409a('0x19')]);_0x354d99['offset']=qs[_0x409a('0x18')](_0x235bd0[_0x409a('0x2b')][_0x409a('0x18')]);}_0x354d99[_0x409a('0x30')]=qs['sort'](_0x235bd0[_0x409a('0x2b')][_0x409a('0x31')]);_0x354d99[_0x409a('0x32')]=qs['filters'](_[_0x409a('0x33')](_0x235bd0[_0x409a('0x2b')],_0x5d26a1['filters']),_0x3ed28e);if(_0x235bd0[_0x409a('0x2b')][_0x409a('0x34')]){_0x354d99[_0x409a('0x32')]=_[_0x409a('0x35')](_0x354d99[_0x409a('0x32')],{'$or':_[_0x409a('0x26')](_0x3ed28e,function(_0x417f28){if(_0x417f28[_0x409a('0x29')]!==_0x409a('0x36')){var _0x27c6df={};_0x27c6df[_0x417f28[_0x409a('0x23')]]={'$like':'%'+_0x235bd0['query'][_0x409a('0x34')]+'%'};return _0x27c6df;}})});}_0x354d99=_['merge']({},_0x354d99,_0x235bd0['options']);var _0xab44f={'where':_0x354d99['where']};return db[_0x409a('0x37')][_0x409a('0x17')](_0xab44f)[_0x409a('0x1f')](function(_0x4f4a55){_0x25261a['count']=_0x4f4a55;if(_0x235bd0[_0x409a('0x2b')][_0x409a('0x38')]){_0x354d99[_0x409a('0x39')]=[{'all':!![]}];}return db[_0x409a('0x37')]['findAll'](_0x354d99);})['then'](function(_0x99ff30){_0x25261a[_0x409a('0x3a')]=_0x99ff30;return _0x25261a;})[_0x409a('0x1f')](respondWithFilteredResult(_0x578425,_0x354d99))[_0x409a('0x3b')](handleError(_0x578425,null));};exports[_0x409a('0x3c')]=function(_0x10a169,_0x4f97a6){var _0x2e141b={'raw':!![],'where':{'id':_0x10a169[_0x409a('0x3d')]['id']}},_0x6a10a6={};_0x6a10a6[_0x409a('0x2a')]=_[_0x409a('0x3e')](db[_0x409a('0x37')][_0x409a('0x27')]);_0x6a10a6[_0x409a('0x2b')]=_[_0x409a('0x3e')](_0x10a169[_0x409a('0x2b')]);_0x6a10a6['filters']=_[_0x409a('0x2c')](_0x6a10a6[_0x409a('0x2a')],_0x6a10a6['query']);_0x2e141b[_0x409a('0x2d')]=_[_0x409a('0x2c')](_0x6a10a6[_0x409a('0x2a')],qs[_0x409a('0x3f')](_0x10a169[_0x409a('0x2b')][_0x409a('0x3f')]));_0x2e141b[_0x409a('0x2d')]=_0x2e141b[_0x409a('0x2d')][_0x409a('0x2e')]?_0x2e141b['attributes']:_0x6a10a6['model'];if(_0x10a169[_0x409a('0x2b')][_0x409a('0x38')]){_0x2e141b[_0x409a('0x39')]=[{'all':!![]}];}_0x2e141b=_['merge']({},_0x2e141b,_0x10a169['options']);return db[_0x409a('0x37')][_0x409a('0x40')](_0x2e141b)['then'](handleEntityNotFound(_0x4f97a6,null))[_0x409a('0x1f')](respondWithResult(_0x4f97a6,null))[_0x409a('0x3b')](handleError(_0x4f97a6,null));};exports[_0x409a('0x41')]=function(_0x1e03a5,_0x12477b){return db[_0x409a('0x37')]['create'](_0x1e03a5[_0x409a('0x42')],{})[_0x409a('0x1f')](respondWithResult(_0x12477b,0xc9))[_0x409a('0x3b')](handleError(_0x12477b,null));};exports[_0x409a('0x1e')]=function(_0x18b04e,_0x20bf8b){if(_0x18b04e['body']['id']){delete _0x18b04e['body']['id'];}return db[_0x409a('0x37')][_0x409a('0x40')]({'where':{'id':_0x18b04e[_0x409a('0x3d')]['id']}})[_0x409a('0x1f')](handleEntityNotFound(_0x20bf8b,null))['then'](saveUpdates(_0x18b04e[_0x409a('0x42')],null))['then'](respondWithResult(_0x20bf8b,null))['catch'](handleError(_0x20bf8b,null));};exports[_0x409a('0x43')]=function(_0x171c87,_0x22f309){return db[_0x409a('0x37')][_0x409a('0x40')]({'where':{'id':_0x171c87['params']['id']}})[_0x409a('0x1f')](handleEntityNotFound(_0x22f309,null))[_0x409a('0x1f')](removeEntity(_0x22f309,null))['catch'](handleError(_0x22f309,null));}; \ No newline at end of file +var _0x1718=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','limit','set','apply','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceField','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs'];(function(_0x15bb84,_0x12876a){var _0x2c334c=function(_0x15c835){while(--_0x15c835){_0x15bb84['push'](_0x15bb84['shift']());}};_0x2c334c(++_0x12876a);}(_0x1718,0xdc));var _0x8171=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1718[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x8171('0x0'));var emlformat=require(_0x8171('0x1'));var rimraf=require(_0x8171('0x2'));var zipdir=require(_0x8171('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8171('0x4'));var moment=require(_0x8171('0x5'));var BPromise=require(_0x8171('0x6'));var Mustache=require('mustache');var util=require(_0x8171('0x7'));var path=require(_0x8171('0x8'));var sox=require(_0x8171('0x9'));var csv=require('to-csv');var ejs=require(_0x8171('0xa'));var fs=require('fs');var fs_extra=require(_0x8171('0xb'));var _=require(_0x8171('0xc'));var squel=require(_0x8171('0xd'));var crypto=require(_0x8171('0xe'));var jsforce=require(_0x8171('0xf'));var deskjs=require(_0x8171('0x10'));var toCsv=require(_0x8171('0x11'));var querystring=require(_0x8171('0x12'));var Papa=require('papaparse');var Redis=require(_0x8171('0x13'));var authService=require(_0x8171('0x14'));var qs=require(_0x8171('0x15'));var as=require(_0x8171('0x16'));var hardwareService=require(_0x8171('0x17'));var logger=require(_0x8171('0x18'))(_0x8171('0x19'));var utils=require('../../config/utils');var config=require(_0x8171('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eb950,_0x2b5739){_0x2b5739=_0x2b5739||0xcc;return function(_0xc2e3ad){if(_0xc2e3ad){return _0x4eb950['sendStatus'](_0x2b5739);}return _0x4eb950[_0x8171('0x1b')](_0x2b5739)[_0x8171('0x1c')]();};}function respondWithResult(_0x59c0da,_0x226b60){_0x226b60=_0x226b60||0xc8;return function(_0x2483a5){if(_0x2483a5){return _0x59c0da[_0x8171('0x1b')](_0x226b60)[_0x8171('0x1d')](_0x2483a5);}};}function respondWithFilteredResult(_0x2402a2,_0x1bcbcf){return function(_0x17a9ca){if(_0x17a9ca){var _0x3844c4=_0x17a9ca['count'],_0x52916a=_0x1bcbcf[_0x8171('0x1e')],_0x1c0c48=_0x1bcbcf['offset']+_0x1bcbcf[_0x8171('0x1f')],_0x52a87d;if(_0x1c0c48>=_0x3844c4){_0x1c0c48=_0x3844c4;_0x52a87d=0xc8;}else{_0x52a87d=0xce;}_0x2402a2[_0x8171('0x1b')](_0x52a87d);return _0x2402a2[_0x8171('0x20')]('Content-Range',_0x52916a+'-'+_0x1c0c48+'/'+_0x3844c4)[_0x8171('0x1d')](_0x17a9ca);}return null;};}function patchUpdates(_0x5e09c1){return function(_0x4e4a03){try{jsonpatch[_0x8171('0x21')](_0x4e4a03,_0x5e09c1,!![]);}catch(_0x4392db){return BPromise[_0x8171('0x22')](_0x4392db);}return _0x4e4a03[_0x8171('0x23')]();};}function saveUpdates(_0x104302,_0x5e576d){return function(_0x4832ec){if(_0x4832ec){return _0x4832ec[_0x8171('0x24')](_0x104302)[_0x8171('0x25')](function(_0x179541){return _0x179541;});}return null;};}function removeEntity(_0xdd3785,_0x396752){return function(_0x12dbc9){if(_0x12dbc9){return _0x12dbc9['destroy']()['then'](function(){_0xdd3785[_0x8171('0x1b')](0xcc)[_0x8171('0x1c')]();});}};}function handleEntityNotFound(_0x1df7a5,_0xd5e4b0){return function(_0x2fa285){if(!_0x2fa285){_0x1df7a5[_0x8171('0x26')](0x194);}return _0x2fa285;};}function handleError(_0x24e4f8,_0x2f4800){_0x2f4800=_0x2f4800||0x1f4;return function(_0x471dde){logger[_0x8171('0x27')](_0x471dde['stack']);if(_0x471dde[_0x8171('0x28')]){delete _0x471dde[_0x8171('0x28')];}_0x24e4f8[_0x8171('0x1b')](_0x2f4800)[_0x8171('0x29')](_0x471dde);};}exports[_0x8171('0x2a')]=function(_0x1ce775,_0x4495fe){var _0x58a895={},_0xdf2ba9={},_0x297ec8={'count':0x0,'rows':[]};var _0x564fb1=_[_0x8171('0x2b')](db['SalesforceField'][_0x8171('0x2c')],function(_0x37351c){return{'name':_0x37351c['fieldName'],'type':_0x37351c[_0x8171('0x2d')][_0x8171('0x2e')]};});_0xdf2ba9[_0x8171('0x2f')]=_[_0x8171('0x2b')](_0x564fb1,_0x8171('0x28'));_0xdf2ba9[_0x8171('0x30')]=_[_0x8171('0x31')](_0x1ce775['query']);_0xdf2ba9[_0x8171('0x32')]=_['intersection'](_0xdf2ba9[_0x8171('0x2f')],_0xdf2ba9[_0x8171('0x30')]);_0x58a895['attributes']=_[_0x8171('0x33')](_0xdf2ba9[_0x8171('0x2f')],qs['fields'](_0x1ce775[_0x8171('0x30')][_0x8171('0x34')]));_0x58a895['attributes']=_0x58a895['attributes'][_0x8171('0x35')]?_0x58a895[_0x8171('0x36')]:_0xdf2ba9['model'];if(!_0x1ce775['query'][_0x8171('0x37')](_0x8171('0x38'))){_0x58a895['limit']=qs[_0x8171('0x1f')](_0x1ce775['query'][_0x8171('0x1f')]);_0x58a895[_0x8171('0x1e')]=qs[_0x8171('0x1e')](_0x1ce775['query']['offset']);}_0x58a895[_0x8171('0x39')]=qs[_0x8171('0x3a')](_0x1ce775[_0x8171('0x30')]['sort']);_0x58a895[_0x8171('0x3b')]=qs[_0x8171('0x32')](_[_0x8171('0x3c')](_0x1ce775[_0x8171('0x30')],_0xdf2ba9[_0x8171('0x32')]),_0x564fb1);if(_0x1ce775[_0x8171('0x30')][_0x8171('0x3d')]){_0x58a895[_0x8171('0x3b')]=_['merge'](_0x58a895[_0x8171('0x3b')],{'$or':_['map'](_0x564fb1,function(_0x47002b){if(_0x47002b[_0x8171('0x2d')]!==_0x8171('0x3e')){var _0x2c4467={};_0x2c4467[_0x47002b['name']]={'$like':'%'+_0x1ce775[_0x8171('0x30')]['filter']+'%'};return _0x2c4467;}})});}_0x58a895=_[_0x8171('0x3f')]({},_0x58a895,_0x1ce775[_0x8171('0x40')]);var _0x4b50ae={'where':_0x58a895[_0x8171('0x3b')]};return db[_0x8171('0x41')][_0x8171('0x42')](_0x4b50ae)['then'](function(_0x2084c2){_0x297ec8[_0x8171('0x42')]=_0x2084c2;if(_0x1ce775[_0x8171('0x30')][_0x8171('0x43')]){_0x58a895[_0x8171('0x44')]=[{'all':!![]}];}return db['SalesforceField'][_0x8171('0x45')](_0x58a895);})[_0x8171('0x25')](function(_0x36c843){_0x297ec8[_0x8171('0x46')]=_0x36c843;return _0x297ec8;})[_0x8171('0x25')](respondWithFilteredResult(_0x4495fe,_0x58a895))[_0x8171('0x47')](handleError(_0x4495fe,null));};exports[_0x8171('0x48')]=function(_0xd58f68,_0x7a674f){var _0x39d967={'raw':!![],'where':{'id':_0xd58f68[_0x8171('0x49')]['id']}},_0x53f345={};_0x53f345[_0x8171('0x2f')]=_['keys'](db[_0x8171('0x41')][_0x8171('0x2c')]);_0x53f345[_0x8171('0x30')]=_['keys'](_0xd58f68[_0x8171('0x30')]);_0x53f345['filters']=_[_0x8171('0x33')](_0x53f345[_0x8171('0x2f')],_0x53f345[_0x8171('0x30')]);_0x39d967[_0x8171('0x36')]=_['intersection'](_0x53f345[_0x8171('0x2f')],qs[_0x8171('0x34')](_0xd58f68[_0x8171('0x30')]['fields']));_0x39d967['attributes']=_0x39d967[_0x8171('0x36')][_0x8171('0x35')]?_0x39d967[_0x8171('0x36')]:_0x53f345[_0x8171('0x2f')];if(_0xd58f68[_0x8171('0x30')][_0x8171('0x43')]){_0x39d967[_0x8171('0x44')]=[{'all':!![]}];}_0x39d967=_[_0x8171('0x3f')]({},_0x39d967,_0xd58f68[_0x8171('0x40')]);return db['SalesforceField']['find'](_0x39d967)['then'](handleEntityNotFound(_0x7a674f,null))[_0x8171('0x25')](respondWithResult(_0x7a674f,null))['catch'](handleError(_0x7a674f,null));};exports[_0x8171('0x4a')]=function(_0x520b28,_0x22fd57){return db[_0x8171('0x41')][_0x8171('0x4a')](_0x520b28['body'],{})[_0x8171('0x25')](respondWithResult(_0x22fd57,0xc9))[_0x8171('0x47')](handleError(_0x22fd57,null));};exports[_0x8171('0x24')]=function(_0x409034,_0x235a01){if(_0x409034[_0x8171('0x4b')]['id']){delete _0x409034[_0x8171('0x4b')]['id'];}return db[_0x8171('0x41')][_0x8171('0x4c')]({'where':{'id':_0x409034['params']['id']}})[_0x8171('0x25')](handleEntityNotFound(_0x235a01,null))[_0x8171('0x25')](saveUpdates(_0x409034[_0x8171('0x4b')],null))[_0x8171('0x25')](respondWithResult(_0x235a01,null))[_0x8171('0x47')](handleError(_0x235a01,null));};exports['destroy']=function(_0x4d3783,_0xa969bc){return db['SalesforceField']['find']({'where':{'id':_0x4d3783[_0x8171('0x49')]['id']}})[_0x8171('0x25')](handleEntityNotFound(_0xa969bc,null))['then'](removeEntity(_0xa969bc,null))[_0x8171('0x47')](handleError(_0xa969bc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ebcab50..9116988 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 _0x871e=['api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','lodash','../../config/logger'];(function(_0x3f9cd6,_0x234970){var _0x5520a5=function(_0x24bd79){while(--_0x24bd79){_0x3f9cd6['push'](_0x3f9cd6['shift']());}};_0x5520a5(++_0x234970);}(_0x871e,0x1b0));var _0xe871=function(_0x2f44ad,_0x317f33){_0x2f44ad=_0x2f44ad-0x0;var _0x3a681a=_0x871e[_0x2f44ad];return _0x3a681a;};'use strict';var _=require(_0xe871('0x0'));var util=require('util');var logger=require(_0xe871('0x1'))(_0xe871('0x2'));var moment=require(_0xe871('0x3'));var BPromise=require(_0xe871('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe871('0x5'));var rimraf=require(_0xe871('0x6'));var config=require(_0xe871('0x7'));var attributes=require(_0xe871('0x8'));module[_0xe871('0x9')]=function(_0x2c0254,_0x1068cc){return _0x2c0254[_0xe871('0xa')](_0xe871('0xb'),attributes,{'tableName':_0xe871('0xc'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xe871('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0eaa=['int_salesforce_fields','salesforce_unique_index','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x3acf5a,_0x2b9804){var _0x15b9a1=function(_0x4bfb40){while(--_0x4bfb40){_0x3acf5a['push'](_0x3acf5a['shift']());}};_0x15b9a1(++_0x2b9804);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x23d679,_0x16f04e){_0x23d679=_0x23d679-0x0;var _0x5d8af5=_0x0eaa[_0x23d679];return _0x5d8af5;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0ea('0x2'));var BPromise=require(_0xa0ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0ea('0x4'));var rimraf=require(_0xa0ea('0x5'));var config=require(_0xa0ea('0x6'));var attributes=require(_0xa0ea('0x7'));module[_0xa0ea('0x8')]=function(_0x5636ed,_0x3c6586){return _0x5636ed['define']('SalesforceField',attributes,{'tableName':_0xa0ea('0x9'),'paranoid':![],'indexes':[{'name':_0xa0ea('0xa'),'fields':['idField','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 09d933d..718d6b2 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x514e38,_0x36b519){var _0x5d528a=function(_0x2e6d0e){while(--_0x2e6d0e){_0x514e38['push'](_0x514e38['shift']());}};_0x5d528a(++_0x36b519);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0xcb91[_0x43a5c7];return _0x3b12a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('SalesforceField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x91a7=['message','SalesforceField,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x3c48cb,_0x269361){var _0x51344e=function(_0x6b7b8f){while(--_0x6b7b8f){_0x3c48cb['push'](_0x3c48cb['shift']());}};_0x51344e(++_0x269361);}(_0x91a7,0xe7));var _0x791a=function(_0x5d764a,_0x5a80a5){_0x5d764a=_0x5d764a-0x0;var _0x124de1=_0x91a7[_0x5d764a];return _0x124de1;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index c9a9325..0077c67 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 _0xd7d1=['/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show'];(function(_0x3d270b,_0xc4b68d){var _0x198a55=function(_0x23da13){while(--_0x23da13){_0x3d270b['push'](_0x3d270b['shift']());}};_0x198a55(++_0xc4b68d);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x207a08,_0x127987){_0x207a08=_0x207a08-0x0;var _0x4333df=_0xd7d1[_0x207a08];return _0x4333df;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xb')](_0x1d7d('0xf'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0xb')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller['getFields']);router[_0x1d7d('0x12')]('/',auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);router[_0x1d7d('0x12')](_0x1d7d('0xf'),auth[_0x1d7d('0xc')](),controller['addConfiguration']);router[_0x1d7d('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x1d7d('0x15')]);router[_0x1d7d('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x1d7d('0x17')]);module[_0x1d7d('0x18')]=router; \ No newline at end of file +var _0x58a4=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer'];(function(_0x227c57,_0x5d917e){var _0x155820=function(_0x37a990){while(--_0x37a990){_0x227c57['push'](_0x227c57['shift']());}};_0x155820(++_0x5d917e);}(_0x58a4,0xbf));var _0x458a=function(_0x1badc1,_0x19fd91){_0x1badc1=_0x1badc1-0x0;var _0x37e23d=_0x58a4[_0x1badc1];return _0x37e23d;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var fs_extra=require(_0x458a('0x6'));var auth=require(_0x458a('0x7'));var interaction=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var controller=require(_0x458a('0xa'));router[_0x458a('0xb')]('/',auth[_0x458a('0xc')](),controller['index']);router['get'](_0x458a('0xd'),auth[_0x458a('0xc')](),controller[_0x458a('0xe')]);router[_0x458a('0xb')](_0x458a('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x458a('0xb')](_0x458a('0x10'),auth[_0x458a('0xc')](),controller[_0x458a('0x11')]);router[_0x458a('0x12')]('/',auth['isAuthenticated'](),controller[_0x458a('0x13')]);router[_0x458a('0x12')]('/:id/configurations',auth[_0x458a('0xc')](),controller[_0x458a('0x14')]);router[_0x458a('0x15')](_0x458a('0xd'),auth[_0x458a('0xc')](),controller['update']);router['delete'](_0x458a('0xd'),auth['isAuthenticated'](),controller[_0x458a('0x16')]);module[_0x458a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 25a61f6..82bed83 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 _0x77c7=['username','remoteUri','exports','STRING'];(function(_0x21afde,_0x4454ce){var _0x33cde=function(_0x4020fc){while(--_0x4020fc){_0x21afde['push'](_0x21afde['shift']());}};_0x33cde(++_0x4454ce);}(_0x77c7,0x16a));var _0x777c=function(_0x11d8b5,_0x267cb6){_0x11d8b5=_0x11d8b5-0x0;var _0x13908b=_0x77c7[_0x11d8b5];return _0x13908b;};'use strict';var Sequelize=require('sequelize');module[_0x777c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x777c('0x1')]},'username':{'type':Sequelize[_0x777c('0x1')],'unique':_0x777c('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x777c('0x1')]},'remoteUri':{'type':Sequelize[_0x777c('0x1')],'unique':_0x777c('0x3')},'serverUrl':{'type':Sequelize[_0x777c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xdc04=['username','sequelize','exports','STRING'];(function(_0x3911a5,_0x11425f){var _0x452f81=function(_0x52da58){while(--_0x52da58){_0x3911a5['push'](_0x3911a5['shift']());}};_0x452f81(++_0x11425f);}(_0xdc04,0x1b5));var _0x4dc0=function(_0x2b139b,_0x18ae83){_0x2b139b=_0x2b139b-0x0;var _0x991707=_0xdc04[_0x2b139b];return _0x991707;};'use strict';var Sequelize=require(_0x4dc0('0x0'));module[_0x4dc0('0x1')]={'name':{'type':Sequelize[_0x4dc0('0x2')]},'description':{'type':Sequelize[_0x4dc0('0x2')]},'username':{'type':Sequelize[_0x4dc0('0x2')],'unique':_0x4dc0('0x3')},'password':{'type':Sequelize[_0x4dc0('0x2')]},'email':{'type':Sequelize[_0x4dc0('0x2')]},'remoteUri':{'type':Sequelize[_0x4dc0('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4dc0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index f833562..fd9696d 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 _0x4fc2=['number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','delivery_task','additional_assignee_list','calendar_duration','close_notes','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','findAll','rows','catch','show','find','create','body','params','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','made_sla','knowledge','subcategory','notify','incident_state','severity','category','parent','watch_list','sys_updated_on','approval_history'];(function(_0x1faeb2,_0xb4f2d9){var _0x173a29=function(_0xd7b3e1){while(--_0xd7b3e1){_0x1faeb2['push'](_0x1faeb2['shift']());}};_0x173a29(++_0xb4f2d9);}(_0x4fc2,0x111));var _0x24fc=function(_0x52aa1d,_0x2c150f){_0x52aa1d=_0x52aa1d-0x0;var _0x8024f8=_0x4fc2[_0x52aa1d];return _0x8024f8;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24fc('0xb'));var squel=require(_0x24fc('0xc'));var crypto=require(_0x24fc('0xd'));var jsforce=require(_0x24fc('0xe'));var deskjs=require(_0x24fc('0xf'));var toCsv=require(_0x24fc('0x9'));var querystring=require('querystring');var Papa=require(_0x24fc('0x10'));var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require('../../config/utils');var config=require(_0x24fc('0x18'));var licenseUtil=require(_0x24fc('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x24fc('0x1a'));var jayson=require(_0x24fc('0x1b'));var client=jayson[_0x24fc('0x1c')][_0x24fc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x30f19b,_0x326276,_0x537b5c,_0x2a0971){return new BPromise(function(_0x18c0a7,_0x2ffed3){var _0x42cbe8=_0x2a0971||client;return _0x42cbe8['request'](_0x30f19b,_0x537b5c)[_0x24fc('0x1e')](function(_0x588543){logger[_0x24fc('0x1f')](_0x24fc('0x20'),_0x326276,_0x24fc('0x21'));logger[_0x24fc('0x22')](_0x24fc('0x23'),_0x326276,'request\x20sent',JSON[_0x24fc('0x24')](_0x588543));if(_0x588543[_0x24fc('0x25')]){if(_0x588543[_0x24fc('0x25')][_0x24fc('0x26')]===0x1f4){logger['error'](_0x24fc('0x20'),_0x326276,_0x588543[_0x24fc('0x25')][_0x24fc('0x27')]);return _0x2ffed3(_0x588543['error'][_0x24fc('0x27')]);}logger[_0x24fc('0x25')](_0x24fc('0x20'),_0x326276,_0x588543[_0x24fc('0x25')]['message']);return _0x18c0a7(_0x588543[_0x24fc('0x25')]['message']);}else{logger[_0x24fc('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x326276,_0x24fc('0x21'));_0x18c0a7(_0x588543[_0x24fc('0x28')][_0x24fc('0x27')]);}})['catch'](function(_0x313a25){logger['error'](_0x24fc('0x20'),_0x326276,_0x313a25);_0x2ffed3(_0x313a25);});});}function respondWithStatusCode(_0x2bb93a,_0x36a9b4){_0x36a9b4=_0x36a9b4||0xcc;return function(_0x34b5b2){if(_0x34b5b2){return _0x2bb93a[_0x24fc('0x29')](_0x36a9b4);}return _0x2bb93a[_0x24fc('0x2a')](_0x36a9b4)[_0x24fc('0x2b')]();};}function respondWithResult(_0x20192b,_0x168d98){_0x168d98=_0x168d98||0xc8;return function(_0x2a5c4b){if(_0x2a5c4b){return _0x20192b['status'](_0x168d98)[_0x24fc('0x2c')](_0x2a5c4b);}};}function respondWithFilteredResult(_0x16f27f,_0x3ee302){return function(_0x5bb4c8){if(_0x5bb4c8){var _0xf2f77d=_0x5bb4c8[_0x24fc('0x2d')],_0x3d1ec8=_0x3ee302[_0x24fc('0x2e')],_0x35f9f9=_0x3ee302['offset']+_0x3ee302[_0x24fc('0x2f')],_0x290f84;if(_0x35f9f9>=_0xf2f77d){_0x35f9f9=_0xf2f77d;_0x290f84=0xc8;}else{_0x290f84=0xce;}_0x16f27f[_0x24fc('0x2a')](_0x290f84);return _0x16f27f[_0x24fc('0x30')](_0x24fc('0x31'),_0x3d1ec8+'-'+_0x35f9f9+'/'+_0xf2f77d)[_0x24fc('0x2c')](_0x5bb4c8);}return null;};}function patchUpdates(_0x490aa5){return function(_0x55c27f){try{jsonpatch['apply'](_0x55c27f,_0x490aa5,!![]);}catch(_0x3df6f4){return BPromise['reject'](_0x3df6f4);}return _0x55c27f[_0x24fc('0x32')]();};}function saveUpdates(_0x3e6389,_0xae4f22){return function(_0x2086c0){if(_0x2086c0){return _0x2086c0['update'](_0x3e6389)[_0x24fc('0x1e')](function(_0x33f368){return _0x33f368;});}return null;};}function removeEntity(_0x523c1f,_0xf46cd5){return function(_0x1b174d){if(_0x1b174d){return _0x1b174d['destroy']()['then'](function(){_0x523c1f[_0x24fc('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c20a7,_0x98e81b){return function(_0x5491b0){if(!_0x5491b0){_0x3c20a7[_0x24fc('0x29')](0x194);}return _0x5491b0;};}function handleError(_0x33bbf2,_0x3b2862){_0x3b2862=_0x3b2862||0x1f4;return function(_0x1f7f8d){logger[_0x24fc('0x25')](_0x1f7f8d[_0x24fc('0x33')]);if(_0x1f7f8d[_0x24fc('0x34')]){delete _0x1f7f8d[_0x24fc('0x34')];}_0x33bbf2[_0x24fc('0x2a')](_0x3b2862)['send'](_0x1f7f8d);};}exports[_0x24fc('0x35')]=function(_0x4224f4,_0x2fbe30){var _0x316aa2={},_0x242bd5={},_0x5781d2={'count':0x0,'rows':[]};var _0x56a9bd=_[_0x24fc('0x36')](db['ServicenowAccount'][_0x24fc('0x37')],function(_0x38798d){return{'name':_0x38798d[_0x24fc('0x38')],'type':_0x38798d[_0x24fc('0x39')]['key']};});_0x242bd5[_0x24fc('0x3a')]=_['map'](_0x56a9bd,_0x24fc('0x34'));_0x242bd5[_0x24fc('0x3b')]=_[_0x24fc('0x3c')](_0x4224f4[_0x24fc('0x3b')]);_0x242bd5[_0x24fc('0x3d')]=_['intersection'](_0x242bd5[_0x24fc('0x3a')],_0x242bd5[_0x24fc('0x3b')]);_0x316aa2[_0x24fc('0x3e')]=_[_0x24fc('0x3f')](_0x242bd5['model'],qs[_0x24fc('0x40')](_0x4224f4[_0x24fc('0x3b')]['fields']));_0x316aa2[_0x24fc('0x3e')]=_0x316aa2['attributes'][_0x24fc('0x41')]?_0x316aa2[_0x24fc('0x3e')]:_0x242bd5[_0x24fc('0x3a')];if(!_0x4224f4[_0x24fc('0x3b')][_0x24fc('0x42')](_0x24fc('0x43'))){_0x316aa2[_0x24fc('0x2f')]=qs[_0x24fc('0x2f')](_0x4224f4['query'][_0x24fc('0x2f')]);_0x316aa2[_0x24fc('0x2e')]=qs[_0x24fc('0x2e')](_0x4224f4['query'][_0x24fc('0x2e')]);}_0x316aa2[_0x24fc('0x44')]=qs['sort'](_0x4224f4[_0x24fc('0x3b')][_0x24fc('0x45')]);_0x316aa2[_0x24fc('0x46')]=qs['filters'](_[_0x24fc('0x47')](_0x4224f4[_0x24fc('0x3b')],_0x242bd5['filters']),_0x56a9bd);if(_0x4224f4[_0x24fc('0x3b')][_0x24fc('0x48')]){_0x316aa2[_0x24fc('0x46')]=_[_0x24fc('0x49')](_0x316aa2['where'],{'$or':_[_0x24fc('0x36')](_0x56a9bd,function(_0x9bc56a){if(_0x9bc56a[_0x24fc('0x39')]!==_0x24fc('0x4a')){var _0xbcbcfa={};_0xbcbcfa[_0x9bc56a['name']]={'$like':'%'+_0x4224f4[_0x24fc('0x3b')][_0x24fc('0x48')]+'%'};return _0xbcbcfa;}})});}_0x316aa2=_[_0x24fc('0x49')]({},_0x316aa2,_0x4224f4[_0x24fc('0x4b')]);var _0x5c0798={'where':_0x316aa2[_0x24fc('0x46')]};return db[_0x24fc('0x4c')]['count'](_0x5c0798)['then'](function(_0x38dedd){_0x5781d2['count']=_0x38dedd;if(_0x4224f4['query'][_0x24fc('0x4d')]){_0x316aa2['include']=[{'all':!![]}];}return db[_0x24fc('0x4c')][_0x24fc('0x4e')](_0x316aa2);})[_0x24fc('0x1e')](function(_0x53389c){_0x5781d2[_0x24fc('0x4f')]=_0x53389c;return _0x5781d2;})[_0x24fc('0x1e')](respondWithFilteredResult(_0x2fbe30,_0x316aa2))[_0x24fc('0x50')](handleError(_0x2fbe30,null));};exports[_0x24fc('0x51')]=function(_0x39873d,_0x6c6754){var _0x166f6c={'raw':![],'where':{'id':_0x39873d['params']['id']}},_0x87f242={};_0x87f242['model']=_[_0x24fc('0x3c')](db[_0x24fc('0x4c')][_0x24fc('0x37')]);_0x87f242['query']=_['keys'](_0x39873d[_0x24fc('0x3b')]);_0x87f242[_0x24fc('0x3d')]=_[_0x24fc('0x3f')](_0x87f242[_0x24fc('0x3a')],_0x87f242[_0x24fc('0x3b')]);_0x166f6c[_0x24fc('0x3e')]=_[_0x24fc('0x3f')](_0x87f242[_0x24fc('0x3a')],qs[_0x24fc('0x40')](_0x39873d[_0x24fc('0x3b')][_0x24fc('0x40')]));_0x166f6c[_0x24fc('0x3e')]=_0x166f6c['attributes'][_0x24fc('0x41')]?_0x166f6c[_0x24fc('0x3e')]:_0x87f242[_0x24fc('0x3a')];if(_0x39873d[_0x24fc('0x3b')][_0x24fc('0x4d')]){_0x166f6c['include']=[{'all':!![]}];}_0x166f6c=_[_0x24fc('0x49')]({},_0x166f6c,_0x39873d['options']);return db[_0x24fc('0x4c')][_0x24fc('0x52')](_0x166f6c)[_0x24fc('0x1e')](handleEntityNotFound(_0x6c6754,null))[_0x24fc('0x1e')](respondWithResult(_0x6c6754,null))[_0x24fc('0x50')](handleError(_0x6c6754,null));};exports[_0x24fc('0x53')]=function(_0x4c9216,_0xb1fb56){return db[_0x24fc('0x4c')][_0x24fc('0x53')](_0x4c9216[_0x24fc('0x54')],{})[_0x24fc('0x1e')](respondWithResult(_0xb1fb56,0xc9))[_0x24fc('0x50')](handleError(_0xb1fb56,null));};exports['update']=function(_0x36d500,_0x3b24e6){if(_0x36d500[_0x24fc('0x54')]['id']){delete _0x36d500[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x4c')][_0x24fc('0x52')]({'where':{'id':_0x36d500[_0x24fc('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b24e6,null))[_0x24fc('0x1e')](saveUpdates(_0x36d500[_0x24fc('0x54')],null))['then'](respondWithResult(_0x3b24e6,null))[_0x24fc('0x50')](handleError(_0x3b24e6,null));};exports[_0x24fc('0x56')]=function(_0x276f11,_0x2ba959){return db[_0x24fc('0x4c')][_0x24fc('0x52')]({'where':{'id':_0x276f11['params']['id']}})[_0x24fc('0x1e')](handleEntityNotFound(_0x2ba959,null))['then'](removeEntity(_0x2ba959,null))[_0x24fc('0x50')](handleError(_0x2ba959,null));};exports[_0x24fc('0x57')]=function(_0x50e5b0,_0x435442,_0x5c1a92){var _0x1c1f74={};var _0x595c47={};var _0xdff811;var _0x27b612;return db['ServicenowAccount'][_0x24fc('0x58')]({'where':{'id':_0x50e5b0['params']['id']}})[_0x24fc('0x1e')](handleEntityNotFound(_0x435442,null))[_0x24fc('0x1e')](function(_0x59e46e){if(_0x59e46e){_0xdff811=_0x59e46e;_0x595c47[_0x24fc('0x3a')]=_[_0x24fc('0x3c')](db[_0x24fc('0x59')][_0x24fc('0x37')]);_0x595c47[_0x24fc('0x3b')]=_['keys'](_0x50e5b0[_0x24fc('0x3b')]);_0x595c47[_0x24fc('0x3d')]=_[_0x24fc('0x3f')](_0x595c47[_0x24fc('0x3a')],_0x595c47[_0x24fc('0x3b')]);_0x1c1f74['attributes']=_['intersection'](_0x595c47[_0x24fc('0x3a')],qs[_0x24fc('0x40')](_0x50e5b0['query']['fields']));_0x1c1f74[_0x24fc('0x3e')]=_0x1c1f74[_0x24fc('0x3e')][_0x24fc('0x41')]?_0x1c1f74[_0x24fc('0x3e')]:_0x595c47['model'];_0x1c1f74[_0x24fc('0x44')]=qs[_0x24fc('0x45')](_0x50e5b0[_0x24fc('0x3b')][_0x24fc('0x45')]);_0x1c1f74[_0x24fc('0x46')]=qs[_0x24fc('0x3d')](_[_0x24fc('0x47')](_0x50e5b0[_0x24fc('0x3b')],_0x595c47[_0x24fc('0x3d')]));if(_0x50e5b0[_0x24fc('0x3b')][_0x24fc('0x48')]){_0x1c1f74[_0x24fc('0x46')]=_[_0x24fc('0x49')](_0x1c1f74[_0x24fc('0x46')],{'$or':_[_0x24fc('0x36')](_0x1c1f74['attributes'],function(_0xd53778){var _0x3cff00={};_0x3cff00[_0xd53778]={'$like':'%'+_0x50e5b0[_0x24fc('0x3b')][_0x24fc('0x48')]+'%'};return _0x3cff00;})});}_0x1c1f74=_[_0x24fc('0x49')]({},_0x1c1f74,_0x50e5b0[_0x24fc('0x4b')]);return _0xdff811[_0x24fc('0x57')](_0x1c1f74);}})[_0x24fc('0x1e')](function(_0x4f1674){if(_0x4f1674){_0x27b612=_0x4f1674[_0x24fc('0x41')];if(!_0x50e5b0[_0x24fc('0x3b')][_0x24fc('0x42')](_0x24fc('0x43'))){_0x1c1f74['limit']=qs[_0x24fc('0x2f')](_0x50e5b0[_0x24fc('0x3b')]['limit']);_0x1c1f74['offset']=qs['offset'](_0x50e5b0[_0x24fc('0x3b')][_0x24fc('0x2e')]);}return _0xdff811[_0x24fc('0x57')](_0x1c1f74);}})[_0x24fc('0x1e')](function(_0x333a34){if(_0x333a34){return _0x333a34?{'count':_0x27b612,'rows':_0x333a34}:null;}})[_0x24fc('0x1e')](respondWithResult(_0x435442,null))['catch'](handleError(_0x435442,null));};exports[_0x24fc('0x5a')]=function(_0x15e8a3,_0x5a2c09,_0x51b1c0){if(_0x15e8a3[_0x24fc('0x54')]['id']){delete _0x15e8a3[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x4c')]['findOne']({'where':{'id':_0x15e8a3[_0x24fc('0x55')]['id']}})[_0x24fc('0x1e')](handleEntityNotFound(_0x5a2c09,null))[_0x24fc('0x1e')](function(_0x4f5547){if(_0x4f5547){_0x15e8a3['body']['AccountId']=_0x4f5547['id'];_0x15e8a3['body']['Subjects']=integrations[_0x24fc('0x5b')](_0x15e8a3[_0x24fc('0x54')][_0x24fc('0x5c')],_0x15e8a3[_0x24fc('0x54')]['type']);_0x15e8a3[_0x24fc('0x54')]['Descriptions']=integrations[_0x24fc('0x5d')](_0x15e8a3['body'][_0x24fc('0x5c')],_0x15e8a3[_0x24fc('0x54')][_0x24fc('0x39')]);return db[_0x24fc('0x59')][_0x24fc('0x53')](_0x15e8a3[_0x24fc('0x54')],{'include':[{'model':db[_0x24fc('0x5e')],'as':'Subjects'},{'model':db[_0x24fc('0x5e')],'as':_0x24fc('0x5f')}]});}return null;})[_0x24fc('0x1e')](respondWithResult(_0x5a2c09,null))['catch'](handleError(_0x5a2c09,null));};exports['getFields']=function(_0x13d4ba,_0x1d80db,_0x4d4291){var _0x42b972=[_0x24fc('0x60'),'hold_reason',_0x24fc('0x61'),_0x24fc('0x62'),'close_code',_0x24fc('0x63'),_0x24fc('0x64'),_0x24fc('0x65'),_0x24fc('0x66')];var _0x1c67fc=[_0x24fc('0x67'),'made_sla','caused_by',_0x24fc('0x68'),'upon_reject',_0x24fc('0x69'),'child_incidents','hold_reason',_0x24fc('0x6a'),_0x24fc('0x6b'),_0x24fc('0x6c'),_0x24fc('0x6d'),_0x24fc('0x6e'),_0x24fc('0x6f'),_0x24fc('0x70'),_0x24fc('0x71'),'state',_0x24fc('0x72'),_0x24fc('0x61'),'order','calendar_stc',_0x24fc('0x73'),_0x24fc('0x74'),_0x24fc('0x75'),_0x24fc('0x76'),_0x24fc('0x77'),'work_notes_list',_0x24fc('0x78'),_0x24fc('0x79'),'sys_domain_path',_0x24fc('0x7a'),_0x24fc('0x7b'),_0x24fc('0x7c'),'opened_at',_0x24fc('0x7d'),_0x24fc('0x7e'),_0x24fc('0x7f'),_0x24fc('0x80'),_0x24fc('0x81'),_0x24fc('0x82'),_0x24fc('0x83'),_0x24fc('0x62'),_0x24fc('0x84'),'short_description',_0x24fc('0x85'),_0x24fc('0x86'),_0x24fc('0x87'),'work_start','assignment_group','business_stc',_0x24fc('0x88'),'description',_0x24fc('0x89'),_0x24fc('0x63'),'sys_class_name',_0x24fc('0x8a'),'closed_by',_0x24fc('0x8b'),'parent_incident',_0x24fc('0x8c'),_0x24fc('0x8d'),_0x24fc('0x8e'),_0x24fc('0x64'),_0x24fc('0x8f'),_0x24fc('0x90'),'company',_0x24fc('0x91'),_0x24fc('0x92'),_0x24fc('0x93'),_0x24fc('0x65'),_0x24fc('0x94'),_0x24fc('0x95'),_0x24fc('0x96'),_0x24fc('0x97'),_0x24fc('0x98'),'sys_mod_count',_0x24fc('0x99'),_0x24fc('0x9a'),_0x24fc('0x9b'),_0x24fc('0x9c'),'correlation_id',_0x24fc('0x9d'),_0x24fc('0x66')];var _0xc2be0f='';var _0x59411e='';var _0x29cbc5=[];var _0x57e16d='';var _0x5a9859='';var _0x4e7c8b=[];var _0x369048='';var _0x49c35c='';var _0x29f1c1={};var _0x1236ab='';return db[_0x24fc('0x4c')][_0x24fc('0x58')]({'where':{'id':_0x13d4ba['params']['id']},'attributes':['id',_0x24fc('0x9e'),_0x24fc('0x9f'),_0x24fc('0xa0'),_0x24fc('0xa1'),_0x24fc('0xa2')]})['then'](handleEntityNotFound(_0x1d80db,null))[_0x24fc('0x1e')](function(_0x23ceb9){if(_0x23ceb9){_0x1236ab=_0x23ceb9[_0x24fc('0xa1')];var _0xdc1cb7=_0x1236ab['slice'](-0x1);if(_0xdc1cb7==='/'){_0x1236ab=_0x1236ab['substring'](0x0,_0x1236ab[_0x24fc('0xa3')](_0xdc1cb7));}_0x49c35c=util[_0x24fc('0xa4')](_0x24fc('0xa5'),_0x1236ab);_0x369048=util[_0x24fc('0xa4')](_0x24fc('0xa6'),_0x1236ab);_0x29f1c1={'user':_0x23ceb9['username'],'pass':_0x23ceb9[_0x24fc('0x9f')]};var _0x31dad1={'method':_0x24fc('0xa7'),'uri':_0x49c35c+'incident?sysparm_display_value=all','auth':_0x29f1c1,'json':!![]};return rp(_0x31dad1);}})[_0x24fc('0x1e')](function(_0x69a2cd){if(_0x69a2cd[_0x24fc('0x28')][_0x24fc('0x41')]>0x0){_0xc2be0f=_0x69a2cd[_0x24fc('0x28')];}console['log']('incident\x20table\x20objects',_0xc2be0f);_0x4e7c8b=[];_0x59411e=Object['assign']([],_0xc2be0f);_[_0x24fc('0xa8')](_0x59411e,function(_0x1822c1){return!_0x42b972[_0x24fc('0xa9')](_0x1822c1[_0x24fc('0x34')]);});_0x59411e[_0x24fc('0xaa')](function(_0x2ac3e8){var _0x1a2838=createFieldObject(_0x369048,_0x29f1c1,_0x2ac3e8[_0x24fc('0xab')],_0x2ac3e8[_0x24fc('0x34')],_0x2ac3e8[_0x24fc('0xac')],![]);_0x4e7c8b[_0x24fc('0xad')](_0x1a2838);});return Promise[_0x24fc('0xae')](_0x4e7c8b);})['then'](function(_0x567d19){_0x29cbc5=_0x567d19;_0x57e16d=Object[_0x24fc('0xaf')]([],_0xc2be0f);console['log'](_0x24fc('0xb0'),_0xc2be0f);_[_0x24fc('0xa8')](_0x57e16d,function(_0x519c02){return _0x1c67fc[_0x24fc('0xa9')](_0x519c02[_0x24fc('0x34')]);});console[_0x24fc('0xb1')](_0x24fc('0xb2'),_0x57e16d);_0x4e7c8b=[];_0x57e16d[_0x24fc('0xaa')](function(_0x45978b){var _0x575b12=createFieldObject(_0x369048,_0x29f1c1,_0x45978b[_0x24fc('0xab')],_0x45978b[_0x24fc('0x34')],_0x45978b['label'],!![]);_0x4e7c8b['push'](_0x575b12);});return Promise[_0x24fc('0xae')](_0x4e7c8b);})[_0x24fc('0x1e')](function(_0x5407a9){_0x5a9859=_0x5407a9;var _0x45e87a=_0x29cbc5[_0x24fc('0xb3')](_0x5a9859);return{'count':_0x45e87a[_0x24fc('0x41')],'rows':_0x45e87a};})['then'](respondWithResult(_0x1d80db,null))[_0x24fc('0x50')](function(_0x2f5968){console[_0x24fc('0xb1')](_0x24fc('0xb4')+_0x2f5968);var _0x4d423a=_0x13d4ba[_0x24fc('0x3b')][_0x24fc('0xb5')]?0x1f4:_0x2f5968[_0x24fc('0xb6')]||0x1f4;logger['error'](_0x2f5968[_0x24fc('0x33')]);delete _0x2f5968[_0x24fc('0x34')];if(_0x4d423a===0x191){_0x4d423a=0x190;}_0x1d80db[_0x24fc('0x2a')](_0x4d423a)['send'](_0x13d4ba[_0x24fc('0x3b')][_0x24fc('0xb5')]?{'message':'Wrong\x20credentials','statusCode':_0x2f5968['statusCode']}:_0x2f5968);});};function createFieldObject(_0x283251,_0xaf91cb,_0x42d93c,_0x2029cd,_0x783cb2,_0x3afe80){return new Promise(function(_0x590d99,_0xfc5410){var _0x1e67c4={'id':_0x2029cd,'name':_0x783cb2,'custom':_0x3afe80};if(_0x42d93c===_0x24fc('0xb7')){_0x1e67c4[_0x24fc('0x4b')]=[{'name':_0x24fc('0xb8'),'value':_0x24fc('0xb9')},{'name':'False','value':_0x24fc('0xba')}];_0x590d99(_0x1e67c4);}else{var _0x4a2522={'method':'GET','uri':_0x283251+_0x24fc('0xbb')+_0x2029cd,'auth':_0xaf91cb,'json':!![]};return rp(_0x4a2522)[_0x24fc('0x1e')](function(_0x49d3bf){var _0x94a2b2=[];if(_0x49d3bf[_0x24fc('0x28')][_0x24fc('0x41')]>0x0){_0x49d3bf[_0x24fc('0x28')]['forEach'](function(_0x3640ec){if(_0x3640ec[_0x24fc('0xbc')]===_0x24fc('0xba')){var _0x1bd3df={'name':_0x3640ec[_0x24fc('0xac')],'value':_0x3640ec[_0x24fc('0xbd')]};_0x94a2b2['push'](_0x1bd3df);}});}_0x1e67c4['options']=_0x94a2b2;if(_0x1e67c4['options'][_0x24fc('0x41')]>0x0){_0x590d99(_0x1e67c4);}else{if(_0x3afe80==![]){_0x590d99();}else{_0x590d99(_0x1e67c4);}}});}});} \ No newline at end of file +var _0xbdb7=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','body','getConfigurations','findOne','ServicenowConfiguration','AccountId','channel','create','ServicenowField','Subjects','Descriptions','made_sla','hold_reason','knowledge','notify','incident_state','category','caused_by','upon_reject','approval_history','sys_updated_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','time_worked','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','comments','sla_due','comments_and_work_notes','due_date','escalation','password','email','remoteUri','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x452c50,_0x44dd24){var _0x2c492d=function(_0x2a794d){while(--_0x2a794d){_0x452c50['push'](_0x452c50['shift']());}};_0x2c492d(++_0x44dd24);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x26a672,_0x59f5be){_0x26a672=_0x26a672-0x0;var _0x348f43=_0xbdb7[_0x26a672];return _0x348f43;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var fs_extra=require(_0x7bdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7bdb('0xc'));var jsforce=require(_0x7bdb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7bdb('0xe'));var Papa=require(_0x7bdb('0xf'));var Redis=require(_0x7bdb('0x10'));var authService=require(_0x7bdb('0x11'));var qs=require(_0x7bdb('0x12'));var as=require(_0x7bdb('0x13'));var hardwareService=require(_0x7bdb('0x14'));var logger=require(_0x7bdb('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7bdb('0x16'));var db=require(_0x7bdb('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7bdb('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2abca6,_0x46dd4a,_0x4fd91a,_0x50eeca){return new BPromise(function(_0x4e98f7,_0x4476ff){var _0x195b2e=_0x50eeca||client;return _0x195b2e[_0x7bdb('0x19')](_0x2abca6,_0x4fd91a)[_0x7bdb('0x1a')](function(_0x31c909){logger[_0x7bdb('0x1b')](_0x7bdb('0x1c'),_0x46dd4a,_0x7bdb('0x1d'));logger['debug'](_0x7bdb('0x1e'),_0x46dd4a,_0x7bdb('0x1d'),JSON[_0x7bdb('0x1f')](_0x31c909));if(_0x31c909[_0x7bdb('0x20')]){if(_0x31c909['error'][_0x7bdb('0x21')]===0x1f4){logger[_0x7bdb('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x46dd4a,_0x31c909[_0x7bdb('0x20')][_0x7bdb('0x22')]);return _0x4476ff(_0x31c909[_0x7bdb('0x20')][_0x7bdb('0x22')]);}logger[_0x7bdb('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x46dd4a,_0x31c909['error'][_0x7bdb('0x22')]);return _0x4e98f7(_0x31c909[_0x7bdb('0x20')]['message']);}else{logger[_0x7bdb('0x1b')](_0x7bdb('0x1c'),_0x46dd4a,_0x7bdb('0x1d'));_0x4e98f7(_0x31c909[_0x7bdb('0x23')][_0x7bdb('0x22')]);}})['catch'](function(_0x1d37ac){logger[_0x7bdb('0x20')](_0x7bdb('0x1c'),_0x46dd4a,_0x1d37ac);_0x4476ff(_0x1d37ac);});});}function respondWithStatusCode(_0x3a456f,_0x481f4b){_0x481f4b=_0x481f4b||0xcc;return function(_0x4d6e44){if(_0x4d6e44){return _0x3a456f[_0x7bdb('0x24')](_0x481f4b);}return _0x3a456f['status'](_0x481f4b)['end']();};}function respondWithResult(_0x4a9e02,_0x2abef6){_0x2abef6=_0x2abef6||0xc8;return function(_0x51ab04){if(_0x51ab04){return _0x4a9e02[_0x7bdb('0x25')](_0x2abef6)[_0x7bdb('0x26')](_0x51ab04);}};}function respondWithFilteredResult(_0x3ec129,_0x7c09cf){return function(_0x2a494e){if(_0x2a494e){var _0x523869=_0x2a494e[_0x7bdb('0x27')],_0x10e818=_0x7c09cf[_0x7bdb('0x28')],_0x32242d=_0x7c09cf[_0x7bdb('0x28')]+_0x7c09cf[_0x7bdb('0x29')],_0x399b62;if(_0x32242d>=_0x523869){_0x32242d=_0x523869;_0x399b62=0xc8;}else{_0x399b62=0xce;}_0x3ec129[_0x7bdb('0x25')](_0x399b62);return _0x3ec129[_0x7bdb('0x2a')](_0x7bdb('0x2b'),_0x10e818+'-'+_0x32242d+'/'+_0x523869)[_0x7bdb('0x26')](_0x2a494e);}return null;};}function patchUpdates(_0x81ca6f){return function(_0x5b386d){try{jsonpatch[_0x7bdb('0x2c')](_0x5b386d,_0x81ca6f,!![]);}catch(_0x23fc3a){return BPromise[_0x7bdb('0x2d')](_0x23fc3a);}return _0x5b386d[_0x7bdb('0x2e')]();};}function saveUpdates(_0x29eac5,_0x5da819){return function(_0x28aa2f){if(_0x28aa2f){return _0x28aa2f[_0x7bdb('0x2f')](_0x29eac5)[_0x7bdb('0x1a')](function(_0x103585){return _0x103585;});}return null;};}function removeEntity(_0x58c6b7,_0x4f43b9){return function(_0x58f45f){if(_0x58f45f){return _0x58f45f[_0x7bdb('0x30')]()['then'](function(){_0x58c6b7[_0x7bdb('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e5b2,_0x438ee5){return function(_0x1cf75a){if(!_0x1cf75a){_0x23e5b2['sendStatus'](0x194);}return _0x1cf75a;};}function handleError(_0x2ffdb5,_0x514713){_0x514713=_0x514713||0x1f4;return function(_0x532206){logger[_0x7bdb('0x20')](_0x532206['stack']);if(_0x532206[_0x7bdb('0x31')]){delete _0x532206['name'];}_0x2ffdb5['status'](_0x514713)[_0x7bdb('0x32')](_0x532206);};}exports[_0x7bdb('0x33')]=function(_0x3ddee4,_0x62e562){var _0x3c2bb8={},_0x2bb28a={},_0x59e269={'count':0x0,'rows':[]};var _0x46aa93=_[_0x7bdb('0x34')](db[_0x7bdb('0x35')][_0x7bdb('0x36')],function(_0x26de16){return{'name':_0x26de16[_0x7bdb('0x37')],'type':_0x26de16[_0x7bdb('0x38')][_0x7bdb('0x39')]};});_0x2bb28a[_0x7bdb('0x3a')]=_['map'](_0x46aa93,'name');_0x2bb28a[_0x7bdb('0x3b')]=_[_0x7bdb('0x3c')](_0x3ddee4[_0x7bdb('0x3b')]);_0x2bb28a[_0x7bdb('0x3d')]=_[_0x7bdb('0x3e')](_0x2bb28a['model'],_0x2bb28a['query']);_0x3c2bb8[_0x7bdb('0x3f')]=_['intersection'](_0x2bb28a[_0x7bdb('0x3a')],qs['fields'](_0x3ddee4[_0x7bdb('0x3b')]['fields']));_0x3c2bb8['attributes']=_0x3c2bb8[_0x7bdb('0x3f')][_0x7bdb('0x40')]?_0x3c2bb8[_0x7bdb('0x3f')]:_0x2bb28a[_0x7bdb('0x3a')];if(!_0x3ddee4[_0x7bdb('0x3b')][_0x7bdb('0x41')](_0x7bdb('0x42'))){_0x3c2bb8['limit']=qs['limit'](_0x3ddee4[_0x7bdb('0x3b')][_0x7bdb('0x29')]);_0x3c2bb8[_0x7bdb('0x28')]=qs[_0x7bdb('0x28')](_0x3ddee4[_0x7bdb('0x3b')][_0x7bdb('0x28')]);}_0x3c2bb8[_0x7bdb('0x43')]=qs['sort'](_0x3ddee4['query'][_0x7bdb('0x44')]);_0x3c2bb8[_0x7bdb('0x45')]=qs[_0x7bdb('0x3d')](_[_0x7bdb('0x46')](_0x3ddee4['query'],_0x2bb28a[_0x7bdb('0x3d')]),_0x46aa93);if(_0x3ddee4['query'][_0x7bdb('0x47')]){_0x3c2bb8[_0x7bdb('0x45')]=_[_0x7bdb('0x48')](_0x3c2bb8[_0x7bdb('0x45')],{'$or':_[_0x7bdb('0x34')](_0x46aa93,function(_0x375deb){if(_0x375deb[_0x7bdb('0x38')]!==_0x7bdb('0x49')){var _0x3d65e8={};_0x3d65e8[_0x375deb['name']]={'$like':'%'+_0x3ddee4[_0x7bdb('0x3b')][_0x7bdb('0x47')]+'%'};return _0x3d65e8;}})});}_0x3c2bb8=_['merge']({},_0x3c2bb8,_0x3ddee4[_0x7bdb('0x4a')]);var _0x48e97a={'where':_0x3c2bb8[_0x7bdb('0x45')]};return db[_0x7bdb('0x35')][_0x7bdb('0x27')](_0x48e97a)[_0x7bdb('0x1a')](function(_0x2d979f){_0x59e269['count']=_0x2d979f;if(_0x3ddee4[_0x7bdb('0x3b')][_0x7bdb('0x4b')]){_0x3c2bb8[_0x7bdb('0x4c')]=[{'all':!![]}];}return db[_0x7bdb('0x35')][_0x7bdb('0x4d')](_0x3c2bb8);})['then'](function(_0x26db62){_0x59e269[_0x7bdb('0x4e')]=_0x26db62;return _0x59e269;})[_0x7bdb('0x1a')](respondWithFilteredResult(_0x62e562,_0x3c2bb8))[_0x7bdb('0x4f')](handleError(_0x62e562,null));};exports[_0x7bdb('0x50')]=function(_0x25c534,_0x1895b6){var _0x176508={'raw':![],'where':{'id':_0x25c534[_0x7bdb('0x51')]['id']}},_0x38c00f={};_0x38c00f['model']=_[_0x7bdb('0x3c')](db['ServicenowAccount']['rawAttributes']);_0x38c00f[_0x7bdb('0x3b')]=_[_0x7bdb('0x3c')](_0x25c534['query']);_0x38c00f[_0x7bdb('0x3d')]=_[_0x7bdb('0x3e')](_0x38c00f['model'],_0x38c00f['query']);_0x176508['attributes']=_[_0x7bdb('0x3e')](_0x38c00f[_0x7bdb('0x3a')],qs[_0x7bdb('0x52')](_0x25c534[_0x7bdb('0x3b')][_0x7bdb('0x52')]));_0x176508[_0x7bdb('0x3f')]=_0x176508[_0x7bdb('0x3f')][_0x7bdb('0x40')]?_0x176508[_0x7bdb('0x3f')]:_0x38c00f[_0x7bdb('0x3a')];if(_0x25c534['query'][_0x7bdb('0x4b')]){_0x176508['include']=[{'all':!![]}];}_0x176508=_[_0x7bdb('0x48')]({},_0x176508,_0x25c534[_0x7bdb('0x4a')]);return db[_0x7bdb('0x35')][_0x7bdb('0x53')](_0x176508)['then'](handleEntityNotFound(_0x1895b6,null))[_0x7bdb('0x1a')](respondWithResult(_0x1895b6,null))['catch'](handleError(_0x1895b6,null));};exports['create']=function(_0x1439c3,_0x17e4cf){return db['ServicenowAccount']['create'](_0x1439c3['body'],{})[_0x7bdb('0x1a')](respondWithResult(_0x17e4cf,0xc9))['catch'](handleError(_0x17e4cf,null));};exports['update']=function(_0x12a101,_0x32ef56){if(_0x12a101[_0x7bdb('0x54')]['id']){delete _0x12a101[_0x7bdb('0x54')]['id'];}return db['ServicenowAccount'][_0x7bdb('0x53')]({'where':{'id':_0x12a101['params']['id']}})[_0x7bdb('0x1a')](handleEntityNotFound(_0x32ef56,null))[_0x7bdb('0x1a')](saveUpdates(_0x12a101[_0x7bdb('0x54')],null))[_0x7bdb('0x1a')](respondWithResult(_0x32ef56,null))[_0x7bdb('0x4f')](handleError(_0x32ef56,null));};exports[_0x7bdb('0x30')]=function(_0x52d90e,_0x40d3b5){return db[_0x7bdb('0x35')][_0x7bdb('0x53')]({'where':{'id':_0x52d90e['params']['id']}})[_0x7bdb('0x1a')](handleEntityNotFound(_0x40d3b5,null))[_0x7bdb('0x1a')](removeEntity(_0x40d3b5,null))['catch'](handleError(_0x40d3b5,null));};exports[_0x7bdb('0x55')]=function(_0x56e88f,_0x7ecc9f,_0xc3a0cb){var _0x4f3f8c={};var _0x478bbd={};var _0x21a54f;var _0x2a6c5b;return db['ServicenowAccount'][_0x7bdb('0x56')]({'where':{'id':_0x56e88f['params']['id']}})[_0x7bdb('0x1a')](handleEntityNotFound(_0x7ecc9f,null))['then'](function(_0x496cc3){if(_0x496cc3){_0x21a54f=_0x496cc3;_0x478bbd[_0x7bdb('0x3a')]=_[_0x7bdb('0x3c')](db[_0x7bdb('0x57')][_0x7bdb('0x36')]);_0x478bbd[_0x7bdb('0x3b')]=_[_0x7bdb('0x3c')](_0x56e88f[_0x7bdb('0x3b')]);_0x478bbd[_0x7bdb('0x3d')]=_[_0x7bdb('0x3e')](_0x478bbd[_0x7bdb('0x3a')],_0x478bbd[_0x7bdb('0x3b')]);_0x4f3f8c[_0x7bdb('0x3f')]=_['intersection'](_0x478bbd[_0x7bdb('0x3a')],qs[_0x7bdb('0x52')](_0x56e88f['query'][_0x7bdb('0x52')]));_0x4f3f8c[_0x7bdb('0x3f')]=_0x4f3f8c[_0x7bdb('0x3f')][_0x7bdb('0x40')]?_0x4f3f8c[_0x7bdb('0x3f')]:_0x478bbd['model'];_0x4f3f8c[_0x7bdb('0x43')]=qs[_0x7bdb('0x44')](_0x56e88f[_0x7bdb('0x3b')]['sort']);_0x4f3f8c[_0x7bdb('0x45')]=qs[_0x7bdb('0x3d')](_[_0x7bdb('0x46')](_0x56e88f[_0x7bdb('0x3b')],_0x478bbd[_0x7bdb('0x3d')]));if(_0x56e88f[_0x7bdb('0x3b')][_0x7bdb('0x47')]){_0x4f3f8c[_0x7bdb('0x45')]=_[_0x7bdb('0x48')](_0x4f3f8c['where'],{'$or':_[_0x7bdb('0x34')](_0x4f3f8c[_0x7bdb('0x3f')],function(_0x1cf8b1){var _0x16141d={};_0x16141d[_0x1cf8b1]={'$like':'%'+_0x56e88f[_0x7bdb('0x3b')][_0x7bdb('0x47')]+'%'};return _0x16141d;})});}_0x4f3f8c=_[_0x7bdb('0x48')]({},_0x4f3f8c,_0x56e88f[_0x7bdb('0x4a')]);return _0x21a54f[_0x7bdb('0x55')](_0x4f3f8c);}})[_0x7bdb('0x1a')](function(_0x29f5af){if(_0x29f5af){_0x2a6c5b=_0x29f5af[_0x7bdb('0x40')];if(!_0x56e88f[_0x7bdb('0x3b')]['hasOwnProperty'](_0x7bdb('0x42'))){_0x4f3f8c['limit']=qs[_0x7bdb('0x29')](_0x56e88f[_0x7bdb('0x3b')][_0x7bdb('0x29')]);_0x4f3f8c['offset']=qs[_0x7bdb('0x28')](_0x56e88f[_0x7bdb('0x3b')]['offset']);}return _0x21a54f[_0x7bdb('0x55')](_0x4f3f8c);}})[_0x7bdb('0x1a')](function(_0x5b3105){if(_0x5b3105){return _0x5b3105?{'count':_0x2a6c5b,'rows':_0x5b3105}:null;}})[_0x7bdb('0x1a')](respondWithResult(_0x7ecc9f,null))[_0x7bdb('0x4f')](handleError(_0x7ecc9f,null));};exports['addConfiguration']=function(_0x291fd3,_0x237688,_0x4fbb58){if(_0x291fd3[_0x7bdb('0x54')]['id']){delete _0x291fd3[_0x7bdb('0x54')]['id'];}return db['ServicenowAccount'][_0x7bdb('0x56')]({'where':{'id':_0x291fd3['params']['id']}})[_0x7bdb('0x1a')](handleEntityNotFound(_0x237688,null))[_0x7bdb('0x1a')](function(_0x2ff95c){if(_0x2ff95c){_0x291fd3[_0x7bdb('0x54')][_0x7bdb('0x58')]=_0x2ff95c['id'];_0x291fd3['body']['Subjects']=integrations['getSubjects'](_0x291fd3[_0x7bdb('0x54')]['channel'],_0x291fd3[_0x7bdb('0x54')][_0x7bdb('0x38')]);_0x291fd3[_0x7bdb('0x54')]['Descriptions']=integrations['getDescriptions'](_0x291fd3[_0x7bdb('0x54')][_0x7bdb('0x59')],_0x291fd3[_0x7bdb('0x54')][_0x7bdb('0x38')]);return db['ServicenowConfiguration'][_0x7bdb('0x5a')](_0x291fd3[_0x7bdb('0x54')],{'include':[{'model':db[_0x7bdb('0x5b')],'as':_0x7bdb('0x5c')},{'model':db[_0x7bdb('0x5b')],'as':_0x7bdb('0x5d')}]});}return null;})['then'](respondWithResult(_0x237688,null))[_0x7bdb('0x4f')](handleError(_0x237688,null));};exports['getFields']=function(_0x6a50e7,_0x569d65,_0x6a8f7e){var _0x3725a2=[_0x7bdb('0x5e'),_0x7bdb('0x5f'),_0x7bdb('0x60'),'subcategory','close_code',_0x7bdb('0x61'),_0x7bdb('0x62'),'severity',_0x7bdb('0x63')];var _0x2d5991=['parent',_0x7bdb('0x5e'),_0x7bdb('0x64'),'watch_list',_0x7bdb('0x65'),'sys_updated_on','child_incidents',_0x7bdb('0x5f'),_0x7bdb('0x66'),'number','resolved_by',_0x7bdb('0x67'),'opened_by',_0x7bdb('0x68'),'sys_created_on',_0x7bdb('0x69'),_0x7bdb('0x6a'),_0x7bdb('0x6b'),_0x7bdb('0x60'),'order',_0x7bdb('0x6c'),_0x7bdb('0x6d'),'cmdb_ci',_0x7bdb('0x6e'),_0x7bdb('0x6f'),'active',_0x7bdb('0x70'),_0x7bdb('0x71'),_0x7bdb('0x72'),_0x7bdb('0x73'),'rfc',_0x7bdb('0x74'),'expected_start',_0x7bdb('0x75'),_0x7bdb('0x76'),_0x7bdb('0x77'),'work_end',_0x7bdb('0x78'),_0x7bdb('0x79'),_0x7bdb('0x7a'),_0x7bdb('0x7b'),_0x7bdb('0x7c'),_0x7bdb('0x7d'),_0x7bdb('0x7e'),_0x7bdb('0x7f'),_0x7bdb('0x80'),_0x7bdb('0x81'),_0x7bdb('0x82'),_0x7bdb('0x83'),_0x7bdb('0x84'),_0x7bdb('0x85'),_0x7bdb('0x86'),_0x7bdb('0x87'),_0x7bdb('0x61'),_0x7bdb('0x88'),'close_notes',_0x7bdb('0x89'),_0x7bdb('0x8a'),_0x7bdb('0x8b'),_0x7bdb('0x8c'),_0x7bdb('0x8d'),_0x7bdb('0x8e'),_0x7bdb('0x62'),_0x7bdb('0x8f'),_0x7bdb('0x90'),_0x7bdb('0x91'),_0x7bdb('0x92'),'activity_due','assigned_to','severity',_0x7bdb('0x93'),_0x7bdb('0x94'),'approval',_0x7bdb('0x95'),_0x7bdb('0x96'),'sys_mod_count','reopen_count','sys_tags',_0x7bdb('0x97'),'upon_approval','correlation_id','location',_0x7bdb('0x63')];var _0x32419c='';var _0x32ef5e='';var _0x535a06=[];var _0xe3826e='';var _0x1bc3ea='';var _0x1b5e00=[];var _0x2cf30c='';var _0x4b3258='';var _0x11f759={};var _0x4dddbf='';return db[_0x7bdb('0x35')][_0x7bdb('0x56')]({'where':{'id':_0x6a50e7[_0x7bdb('0x51')]['id']},'attributes':['id','username',_0x7bdb('0x98'),_0x7bdb('0x99'),_0x7bdb('0x9a'),'serverUrl']})[_0x7bdb('0x1a')](handleEntityNotFound(_0x569d65,null))[_0x7bdb('0x1a')](function(_0x58d401){if(_0x58d401){_0x4dddbf=_0x58d401[_0x7bdb('0x9a')];var _0x1d8199=_0x4dddbf['slice'](-0x1);if(_0x1d8199==='/'){_0x4dddbf=_0x4dddbf[_0x7bdb('0x9b')](0x0,_0x4dddbf[_0x7bdb('0x9c')](_0x1d8199));}_0x4b3258=util[_0x7bdb('0x9d')](_0x7bdb('0x9e'),_0x4dddbf);_0x2cf30c=util[_0x7bdb('0x9d')]('%s/api/now/table/',_0x4dddbf);_0x11f759={'user':_0x58d401[_0x7bdb('0x9f')],'pass':_0x58d401['password']};var _0x31b62e={'method':_0x7bdb('0xa0'),'uri':_0x4b3258+_0x7bdb('0xa1'),'auth':_0x11f759,'json':!![]};return rp(_0x31b62e);}})['then'](function(_0xeebdc2){if(_0xeebdc2['result'][_0x7bdb('0x40')]>0x0){_0x32419c=_0xeebdc2['result'];}console[_0x7bdb('0xa2')](_0x7bdb('0xa3'),_0x32419c);_0x1b5e00=[];_0x32ef5e=Object[_0x7bdb('0xa4')]([],_0x32419c);_[_0x7bdb('0xa5')](_0x32ef5e,function(_0x15f2ad){return!_0x3725a2['includes'](_0x15f2ad['name']);});_0x32ef5e[_0x7bdb('0xa6')](function(_0x1175c6){var _0x295bb1=createFieldObject(_0x2cf30c,_0x11f759,_0x1175c6[_0x7bdb('0xa7')],_0x1175c6['name'],_0x1175c6[_0x7bdb('0xa8')],![]);_0x1b5e00[_0x7bdb('0xa9')](_0x295bb1);});return Promise['all'](_0x1b5e00);})[_0x7bdb('0x1a')](function(_0x2bc59a){_0x535a06=_0x2bc59a;_0xe3826e=Object['assign']([],_0x32419c);console[_0x7bdb('0xa2')](_0x7bdb('0xaa'),_0x32419c);_[_0x7bdb('0xa5')](_0xe3826e,function(_0x213157){return _0x2d5991[_0x7bdb('0xab')](_0x213157[_0x7bdb('0x31')]);});console[_0x7bdb('0xa2')](_0x7bdb('0xac'),_0xe3826e);_0x1b5e00=[];_0xe3826e['forEach'](function(_0x51d259){var _0x247569=createFieldObject(_0x2cf30c,_0x11f759,_0x51d259[_0x7bdb('0xa7')],_0x51d259[_0x7bdb('0x31')],_0x51d259[_0x7bdb('0xa8')],!![]);_0x1b5e00[_0x7bdb('0xa9')](_0x247569);});return Promise[_0x7bdb('0xad')](_0x1b5e00);})['then'](function(_0xe2ce4b){_0x1bc3ea=_0xe2ce4b;var _0x15bcfd=_0x535a06[_0x7bdb('0xae')](_0x1bc3ea);return{'count':_0x15bcfd[_0x7bdb('0x40')],'rows':_0x15bcfd};})['then'](respondWithResult(_0x569d65,null))[_0x7bdb('0x4f')](function(_0x202890){console['log'](_0x7bdb('0xaf')+_0x202890);var _0x241495=_0x6a50e7[_0x7bdb('0x3b')]['test']?0x1f4:_0x202890['statusCode']||0x1f4;logger[_0x7bdb('0x20')](_0x202890['stack']);delete _0x202890['name'];if(_0x241495===0x191){_0x241495=0x190;}_0x569d65[_0x7bdb('0x25')](_0x241495)['send'](_0x6a50e7[_0x7bdb('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x202890[_0x7bdb('0xb0')]}:_0x202890);});};function createFieldObject(_0x5b5999,_0x3cfaf8,_0x40141b,_0x55805d,_0x130c88,_0x113745){return new Promise(function(_0x341111,_0x3edace){var _0x489a79={'id':_0x55805d,'name':_0x130c88,'custom':_0x113745};if(_0x40141b===_0x7bdb('0xb1')){_0x489a79['options']=[{'name':_0x7bdb('0xb2'),'value':_0x7bdb('0xb3')},{'name':_0x7bdb('0xb4'),'value':_0x7bdb('0xb5')}];_0x341111(_0x489a79);}else{var _0x4ebf68={'method':'GET','uri':_0x5b5999+_0x7bdb('0xb6')+_0x55805d,'auth':_0x3cfaf8,'json':!![]};return rp(_0x4ebf68)[_0x7bdb('0x1a')](function(_0x424aa1){var _0x5e3ced=[];if(_0x424aa1[_0x7bdb('0x23')][_0x7bdb('0x40')]>0x0){_0x424aa1['result'][_0x7bdb('0xa6')](function(_0x5b788e){if(_0x5b788e[_0x7bdb('0xb7')]===_0x7bdb('0xb5')){var _0x507309={'name':_0x5b788e[_0x7bdb('0xa8')],'value':_0x5b788e[_0x7bdb('0xb8')]};_0x5e3ced[_0x7bdb('0xa9')](_0x507309);}});}_0x489a79[_0x7bdb('0x4a')]=_0x5e3ced;if(_0x489a79[_0x7bdb('0x4a')][_0x7bdb('0x40')]>0x0){_0x341111(_0x489a79);}else{if(_0x113745==![]){_0x341111();}else{_0x341111(_0x489a79);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index fdf6fde..303b13a 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 _0x5fd1=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_servicenow_accounts'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x5fd1,0x155));var _0x15fd=function(_0x5d340e,_0x4894f9){_0x5d340e=_0x5d340e-0x0;var _0x191853=_0x5fd1[_0x5d340e];return _0x191853;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x15fd('0x7'));module[_0x15fd('0x8')]=function(_0x18450c,_0x2e88bf){return _0x18450c[_0x15fd('0x9')]('ServicenowAccount',attributes,{'tableName':_0x15fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad3=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x388da2,_0x571cad){var _0x2b1a45=function(_0x10f0e2){while(--_0x10f0e2){_0x388da2['push'](_0x388da2['shift']());}};_0x2b1a45(++_0x571cad);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x352b44,_0x4a91a1){_0x352b44=_0x352b44-0x0;var _0x3e8baa=_0x5ad3[_0x352b44];return _0x3e8baa;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));var integrations=require(_0x35ad('0xa'));module[_0x35ad('0xb')]=function(_0x36c606,_0x31cc6a){return _0x36c606['define'](_0x35ad('0xc'),attributes,{'tableName':_0x35ad('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index c671888..46aca92 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 _0xf22e=['model','map','stringify','ShowServicenowAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','error','message','request\x20sent','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xf22e,0x12e));var _0xef22=function(_0x148540,_0x318dca){_0x148540=_0x148540-0x0;var _0x1f8f14=_0xf22e[_0x148540];return _0x1f8f14;};'use strict';var _=require(_0xef22('0x0'));var util=require(_0xef22('0x1'));var moment=require('moment');var BPromise=require(_0xef22('0x2'));var rs=require(_0xef22('0x3'));var fs=require('fs');var Redis=require(_0xef22('0x4'));var db=require(_0xef22('0x5'))['db'];var utils=require(_0xef22('0x6'));var logger=require(_0xef22('0x7'))(_0xef22('0x8'));var config=require('../../config/environment');var jayson=require(_0xef22('0x9'));var client=jayson['client'][_0xef22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ad7ad,_0x5625dc,_0x3f168f){return new BPromise(function(_0x96f5cf,_0x1e9208){return client[_0xef22('0xb')](_0x4ad7ad,_0x3f168f)[_0xef22('0xc')](function(_0x12335b){logger[_0xef22('0xd')](_0xef22('0xe'),_0x5625dc,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5625dc,'request\x20sent',JSON['stringify'](_0x12335b));if(_0x12335b[_0xef22('0xf')]){if(_0x12335b[_0xef22('0xf')]['code']===0x1f4){logger[_0xef22('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x5625dc,_0x12335b['error'][_0xef22('0x10')]);return _0x1e9208(_0x12335b[_0xef22('0xf')]['message']);}logger[_0xef22('0xf')](_0xef22('0xe'),_0x5625dc,_0x12335b[_0xef22('0xf')][_0xef22('0x10')]);return _0x96f5cf(_0x12335b[_0xef22('0xf')]['message']);}else{logger[_0xef22('0xd')](_0xef22('0xe'),_0x5625dc,_0xef22('0x11'));_0x96f5cf(_0x12335b[_0xef22('0x12')]['message']);}})['catch'](function(_0x792e56){logger['error'](_0xef22('0xe'),_0x5625dc,_0x792e56);_0x1e9208(_0x792e56);});});}exports[_0xef22('0x13')]=function(_0x37f4bf){var _0x5909a8=this;return new Promise(function(_0x78036b,_0x1ebdb6){return db[_0xef22('0x14')][_0xef22('0x15')]({'raw':_0x37f4bf[_0xef22('0x16')]?_0x37f4bf[_0xef22('0x16')][_0xef22('0x17')]===undefined?!![]:![]:!![],'where':_0x37f4bf[_0xef22('0x16')]?_0x37f4bf['options'][_0xef22('0x18')]||null:null,'attributes':_0x37f4bf['options']?_0x37f4bf[_0xef22('0x16')][_0xef22('0x19')]||null:null,'limit':_0x37f4bf['options']?_0x37f4bf[_0xef22('0x16')][_0xef22('0x1a')]||null:null,'include':_0x37f4bf['options']?_0x37f4bf[_0xef22('0x16')][_0xef22('0x1b')]?_['map'](_0x37f4bf[_0xef22('0x16')]['include'],function(_0x438ead){return{'model':db[_0x438ead[_0xef22('0x1c')]],'as':_0x438ead['as'],'attributes':_0x438ead[_0xef22('0x19')],'include':_0x438ead['include']?_[_0xef22('0x1d')](_0x438ead[_0xef22('0x1b')],function(_0x91f83){return{'model':db[_0x91f83[_0xef22('0x1c')]],'as':_0x91f83['as'],'attributes':_0x91f83['attributes'],'include':_0x91f83[_0xef22('0x1b')]?_[_0xef22('0x1d')](_0x91f83['include'],function(_0x55c82b){return{'model':db[_0x55c82b[_0xef22('0x1c')]],'as':_0x55c82b['as'],'attributes':_0x55c82b[_0xef22('0x19')]};}):[]};}):[]};}):[]:[]})[_0xef22('0xc')](function(_0x6b3324){logger[_0xef22('0xd')](_0xef22('0x13'),_0x37f4bf);logger['debug'](_0xef22('0x13'),_0x37f4bf,JSON[_0xef22('0x1e')](_0x6b3324));_0x78036b(_0x6b3324);})['catch'](function(_0x4e41b3){logger['error'](_0xef22('0x13'),_0x4e41b3[_0xef22('0x10')],_0x37f4bf);_0x1ebdb6(_0x5909a8[_0xef22('0xf')](0x1f4,_0x4e41b3['message']));});});};exports[_0xef22('0x1f')]=function(_0x98949){var _0x569f21=this;return new Promise(function(_0x2edf80,_0x573916){return db[_0xef22('0x14')]['find']({'raw':_0x98949[_0xef22('0x16')]?_0x98949['options'][_0xef22('0x17')]===undefined?!![]:![]:!![],'where':_0x98949[_0xef22('0x16')]?_0x98949['options'][_0xef22('0x18')]||null:null,'attributes':_0x98949['options']?_0x98949[_0xef22('0x16')]['attributes']||null:null,'include':_0x98949[_0xef22('0x16')]?_0x98949[_0xef22('0x16')][_0xef22('0x1b')]?_['map'](_0x98949[_0xef22('0x16')][_0xef22('0x1b')],function(_0x162d2e){return{'model':db[_0x162d2e['model']],'as':_0x162d2e['as'],'attributes':_0x162d2e[_0xef22('0x19')],'include':_0x162d2e['include']?_[_0xef22('0x1d')](_0x162d2e[_0xef22('0x1b')],function(_0x39cf40){return{'model':db[_0x39cf40['model']],'as':_0x39cf40['as'],'attributes':_0x39cf40['attributes'],'include':_0x39cf40[_0xef22('0x1b')]?_[_0xef22('0x1d')](_0x39cf40[_0xef22('0x1b')],function(_0x251b38){return{'model':db[_0x251b38['model']],'as':_0x251b38['as'],'attributes':_0x251b38[_0xef22('0x19')]};}):[]};}):[]};}):[]:[]})[_0xef22('0xc')](function(_0x4b4bff){logger[_0xef22('0xd')](_0xef22('0x1f'),_0x98949);logger['debug'](_0xef22('0x1f'),_0x98949,JSON['stringify'](_0x4b4bff));_0x2edf80(_0x4b4bff);})[_0xef22('0x20')](function(_0x2a77f1){logger[_0xef22('0xf')](_0xef22('0x1f'),_0x2a77f1[_0xef22('0x10')],_0x98949);_0x573916(_0x569f21[_0xef22('0xf')](0x1f4,_0x2a77f1[_0xef22('0x10')]));});});}; \ No newline at end of file +var _0x7007=['http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowServicenowAccount','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x374055,_0x2d326c){var _0x263bad=function(_0x488fdc){while(--_0x488fdc){_0x374055['push'](_0x374055['shift']());}};_0x263bad(++_0x2d326c);}(_0x7007,0x19a));var _0x7700=function(_0x1dbd26,_0x2868fa){_0x1dbd26=_0x1dbd26-0x0;var _0x128bd1=_0x7007[_0x1dbd26];return _0x128bd1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7700('0x0'));var BPromise=require(_0x7700('0x1'));var rs=require(_0x7700('0x2'));var fs=require('fs');var Redis=require(_0x7700('0x3'));var db=require(_0x7700('0x4'))['db'];var utils=require(_0x7700('0x5'));var logger=require(_0x7700('0x6'))('rpc');var config=require(_0x7700('0x7'));var jayson=require(_0x7700('0x8'));var client=jayson[_0x7700('0x9')][_0x7700('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18e2ad,_0x4ea5b6,_0x1a209f){return new BPromise(function(_0x4ca825,_0x3624b1){return client[_0x7700('0xb')](_0x18e2ad,_0x1a209f)['then'](function(_0x5ba48e){logger[_0x7700('0xc')](_0x7700('0xd'),_0x4ea5b6,_0x7700('0xe'));logger[_0x7700('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4ea5b6,_0x7700('0xe'),JSON[_0x7700('0x10')](_0x5ba48e));if(_0x5ba48e[_0x7700('0x11')]){if(_0x5ba48e[_0x7700('0x11')][_0x7700('0x12')]===0x1f4){logger[_0x7700('0x11')](_0x7700('0xd'),_0x4ea5b6,_0x5ba48e[_0x7700('0x11')][_0x7700('0x13')]);return _0x3624b1(_0x5ba48e[_0x7700('0x11')][_0x7700('0x13')]);}logger[_0x7700('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4ea5b6,_0x5ba48e['error'][_0x7700('0x13')]);return _0x4ca825(_0x5ba48e[_0x7700('0x11')][_0x7700('0x13')]);}else{logger[_0x7700('0xc')](_0x7700('0xd'),_0x4ea5b6,_0x7700('0xe'));_0x4ca825(_0x5ba48e[_0x7700('0x14')][_0x7700('0x13')]);}})[_0x7700('0x15')](function(_0x4d576e){logger['error'](_0x7700('0xd'),_0x4ea5b6,_0x4d576e);_0x3624b1(_0x4d576e);});});}exports[_0x7700('0x16')]=function(_0x84d781){var _0x1dc39a=this;return new Promise(function(_0x436de0,_0xd9898d){return db[_0x7700('0x17')][_0x7700('0x18')]({'raw':_0x84d781[_0x7700('0x19')]?_0x84d781[_0x7700('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x84d781['options']?_0x84d781[_0x7700('0x19')][_0x7700('0x1a')]||null:null,'attributes':_0x84d781[_0x7700('0x19')]?_0x84d781['options'][_0x7700('0x1b')]||null:null,'limit':_0x84d781[_0x7700('0x19')]?_0x84d781['options'][_0x7700('0x1c')]||null:null,'include':_0x84d781['options']?_0x84d781['options'][_0x7700('0x1d')]?_[_0x7700('0x1e')](_0x84d781[_0x7700('0x19')][_0x7700('0x1d')],function(_0x2e8da2){return{'model':db[_0x2e8da2[_0x7700('0x1f')]],'as':_0x2e8da2['as'],'attributes':_0x2e8da2['attributes'],'include':_0x2e8da2[_0x7700('0x1d')]?_[_0x7700('0x1e')](_0x2e8da2[_0x7700('0x1d')],function(_0x42bc8b){return{'model':db[_0x42bc8b['model']],'as':_0x42bc8b['as'],'attributes':_0x42bc8b[_0x7700('0x1b')],'include':_0x42bc8b[_0x7700('0x1d')]?_['map'](_0x42bc8b[_0x7700('0x1d')],function(_0x2af59f){return{'model':db[_0x2af59f[_0x7700('0x1f')]],'as':_0x2af59f['as'],'attributes':_0x2af59f[_0x7700('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7700('0x20')](function(_0x399149){logger[_0x7700('0xc')](_0x7700('0x16'),_0x84d781);logger[_0x7700('0xf')](_0x7700('0x16'),_0x84d781,JSON['stringify'](_0x399149));_0x436de0(_0x399149);})[_0x7700('0x15')](function(_0x2d6fe6){logger['error'](_0x7700('0x16'),_0x2d6fe6[_0x7700('0x13')],_0x84d781);_0xd9898d(_0x1dc39a[_0x7700('0x11')](0x1f4,_0x2d6fe6[_0x7700('0x13')]));});});};exports[_0x7700('0x21')]=function(_0x1315b6){var _0x5a1024=this;return new Promise(function(_0x259475,_0xe0353d){return db['ServicenowAccount']['find']({'raw':_0x1315b6[_0x7700('0x19')]?_0x1315b6[_0x7700('0x19')][_0x7700('0x22')]===undefined?!![]:![]:!![],'where':_0x1315b6[_0x7700('0x19')]?_0x1315b6[_0x7700('0x19')][_0x7700('0x1a')]||null:null,'attributes':_0x1315b6[_0x7700('0x19')]?_0x1315b6[_0x7700('0x19')][_0x7700('0x1b')]||null:null,'include':_0x1315b6['options']?_0x1315b6[_0x7700('0x19')][_0x7700('0x1d')]?_['map'](_0x1315b6[_0x7700('0x19')][_0x7700('0x1d')],function(_0x3505b7){return{'model':db[_0x3505b7[_0x7700('0x1f')]],'as':_0x3505b7['as'],'attributes':_0x3505b7['attributes'],'include':_0x3505b7['include']?_['map'](_0x3505b7[_0x7700('0x1d')],function(_0x26caef){return{'model':db[_0x26caef['model']],'as':_0x26caef['as'],'attributes':_0x26caef['attributes'],'include':_0x26caef[_0x7700('0x1d')]?_[_0x7700('0x1e')](_0x26caef[_0x7700('0x1d')],function(_0x535c38){return{'model':db[_0x535c38[_0x7700('0x1f')]],'as':_0x535c38['as'],'attributes':_0x535c38['attributes']};}):[]};}):[]};}):[]:[]})[_0x7700('0x20')](function(_0x507777){logger[_0x7700('0xc')](_0x7700('0x21'),_0x1315b6);logger[_0x7700('0xf')]('ShowServicenowAccount',_0x1315b6,JSON[_0x7700('0x10')](_0x507777));_0x259475(_0x507777);})[_0x7700('0x15')](function(_0x53e0d6){logger[_0x7700('0x11')](_0x7700('0x21'),_0x53e0d6[_0x7700('0x13')],_0x1315b6);_0xe0353d(_0x5a1024[_0x7700('0x11')](0x1f4,_0x53e0d6[_0x7700('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 45a190e..a02035d 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 _0xd24e=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5bc8ac,_0x26dfca){var _0x3fd546=function(_0x33e043){while(--_0x33e043){_0x5bc8ac['push'](_0x5bc8ac['shift']());}};_0x3fd546(++_0x26dfca);}(_0xd24e,0x1f1));var _0xed24=function(_0x213f03,_0x55bc3b){_0x213f03=_0x213f03-0x0;var _0x17784b=_0xd24e[_0x213f03];return _0x17784b;};'use strict';var multer=require(_0xed24('0x0'));var util=require(_0xed24('0x1'));var path=require(_0xed24('0x2'));var timeout=require(_0xed24('0x3'));var express=require(_0xed24('0x4'));var router=express[_0xed24('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xed24('0x6'));var interaction=require(_0xed24('0x7'));var config=require(_0xed24('0x8'));var controller=require(_0xed24('0x9'));router[_0xed24('0xa')]('/',auth[_0xed24('0xb')](),controller[_0xed24('0xc')]);router['get'](_0xed24('0xd'),auth['isAuthenticated'](),controller[_0xed24('0xe')]);router['get']('/:id/fields',auth[_0xed24('0xb')](),controller[_0xed24('0xf')]);router[_0xed24('0xa')](_0xed24('0x10'),auth['isAuthenticated'](),controller[_0xed24('0x11')]);router[_0xed24('0xa')](_0xed24('0x12'),auth['isAuthenticated'](),controller[_0xed24('0x13')]);router['post']('/',auth[_0xed24('0xb')](),controller[_0xed24('0x14')]);router['put']('/:id',auth[_0xed24('0xb')](),controller[_0xed24('0x15')]);router['delete'](_0xed24('0xd'),auth['isAuthenticated'](),controller[_0xed24('0x16')]);module[_0xed24('0x17')]=router; \ No newline at end of file +var _0xaece=['isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index'];(function(_0x399302,_0x5ce1c5){var _0x586b40=function(_0x2e4c63){while(--_0x2e4c63){_0x399302['push'](_0x399302['shift']());}};_0x586b40(++_0x5ce1c5);}(_0xaece,0x1ef));var _0xeaec=function(_0x5d1f55,_0x36a110){_0x5d1f55=_0x5d1f55-0x0;var _0x3c9652=_0xaece[_0x5d1f55];return _0x3c9652;};'use strict';var multer=require('multer');var util=require(_0xeaec('0x0'));var path=require(_0xeaec('0x1'));var timeout=require(_0xeaec('0x2'));var express=require(_0xeaec('0x3'));var router=express[_0xeaec('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xeaec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeaec('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0xeaec('0x7')]('/',auth['isAuthenticated'](),controller[_0xeaec('0x8')]);router[_0xeaec('0x7')]('/:id',auth[_0xeaec('0x9')](),controller[_0xeaec('0xa')]);router[_0xeaec('0x7')]('/:id/fields',auth[_0xeaec('0x9')](),controller[_0xeaec('0xb')]);router[_0xeaec('0x7')](_0xeaec('0xc'),auth[_0xeaec('0x9')](),controller['getSubjects']);router['get'](_0xeaec('0xd'),auth[_0xeaec('0x9')](),controller[_0xeaec('0xe')]);router[_0xeaec('0xf')]('/',auth['isAuthenticated'](),controller[_0xeaec('0x10')]);router['put'](_0xeaec('0x11'),auth[_0xeaec('0x9')](),controller[_0xeaec('0x12')]);router[_0xeaec('0x13')](_0xeaec('0x11'),auth[_0xeaec('0x9')](),controller['destroy']);module[_0xeaec('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 612cdae..90fb407 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 _0x820d=['sequelize','exports','STRING'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x820d,0x1b3));var _0xd820=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x820d[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0xd820('0x0'));module[_0xd820('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd820('0x2')]}}; \ No newline at end of file +var _0x43d4=['exports','STRING','sequelize'];(function(_0x4b91e5,_0x44b343){var _0xc57634=function(_0x2c6b23){while(--_0x2c6b23){_0x4b91e5['push'](_0x4b91e5['shift']());}};_0xc57634(++_0x44b343);}(_0x43d4,0x143));var _0x443d=function(_0x560b74,_0x93117e){_0x560b74=_0x560b74-0x0;var _0x3941db=_0x43d4[_0x560b74];return _0x3941db;};'use strict';var Sequelize=require(_0x443d('0x0'));module[_0x443d('0x1')]={'name':{'type':Sequelize[_0x443d('0x2')]},'description':{'type':Sequelize[_0x443d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 20a9eba..cb49d9e 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 _0x7a55=['request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','create','body','find','ServicenowField','pick','getFields','nolimit','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','bluebird','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5cc7b2,_0x3272a5){var _0x1ab21d=function(_0x37dcb8){while(--_0x37dcb8){_0x5cc7b2['push'](_0x5cc7b2['shift']());}};_0x1ab21d(++_0x3272a5);}(_0x7a55,0xea));var _0x57a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7a55[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x57a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x57a5('0x1'));var zipdir=require(_0x57a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57a5('0x3'));var moment=require('moment');var BPromise=require(_0x57a5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x57a5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57a5('0x6'));var fs=require('fs');var fs_extra=require(_0x57a5('0x7'));var _=require('lodash');var squel=require(_0x57a5('0x8'));var crypto=require(_0x57a5('0x9'));var jsforce=require(_0x57a5('0xa'));var deskjs=require(_0x57a5('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57a5('0xc'));var Redis=require('ioredis');var authService=require(_0x57a5('0xd'));var qs=require(_0x57a5('0xe'));var as=require(_0x57a5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x57a5('0x10'))(_0x57a5('0x11'));var utils=require(_0x57a5('0x12'));var config=require(_0x57a5('0x13'));var licenseUtil=require(_0x57a5('0x14'));var db=require(_0x57a5('0x15'))['db'];var jayson=require(_0x57a5('0x16'));var client=jayson['client'][_0x57a5('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x465abb,_0x11b8c3,_0x296adc,_0x4b5e2b){return new BPromise(function(_0x2cf260,_0xd8d91a){var _0x3dba8c=_0x4b5e2b||client;return _0x3dba8c['request'](_0x465abb,_0x296adc)['then'](function(_0x112d76){logger[_0x57a5('0x18')](_0x57a5('0x19'),_0x11b8c3,'request\x20sent');logger['debug'](_0x57a5('0x1a'),_0x11b8c3,_0x57a5('0x1b'),JSON[_0x57a5('0x1c')](_0x112d76));if(_0x112d76[_0x57a5('0x1d')]){if(_0x112d76[_0x57a5('0x1d')][_0x57a5('0x1e')]===0x1f4){logger['error'](_0x57a5('0x19'),_0x11b8c3,_0x112d76[_0x57a5('0x1d')][_0x57a5('0x1f')]);return _0xd8d91a(_0x112d76[_0x57a5('0x1d')][_0x57a5('0x1f')]);}logger[_0x57a5('0x1d')](_0x57a5('0x19'),_0x11b8c3,_0x112d76[_0x57a5('0x1d')]['message']);return _0x2cf260(_0x112d76[_0x57a5('0x1d')][_0x57a5('0x1f')]);}else{logger[_0x57a5('0x18')](_0x57a5('0x19'),_0x11b8c3,_0x57a5('0x1b'));_0x2cf260(_0x112d76['result']['message']);}})[_0x57a5('0x20')](function(_0xed2aca){logger[_0x57a5('0x1d')](_0x57a5('0x19'),_0x11b8c3,_0xed2aca);_0xd8d91a(_0xed2aca);});});}function respondWithStatusCode(_0x2eb3e8,_0x518f02){_0x518f02=_0x518f02||0xcc;return function(_0x39b539){if(_0x39b539){return _0x2eb3e8[_0x57a5('0x21')](_0x518f02);}return _0x2eb3e8[_0x57a5('0x22')](_0x518f02)['end']();};}function respondWithResult(_0x3bbc0b,_0x12ca19){_0x12ca19=_0x12ca19||0xc8;return function(_0x12cea6){if(_0x12cea6){return _0x3bbc0b[_0x57a5('0x22')](_0x12ca19)[_0x57a5('0x23')](_0x12cea6);}};}function respondWithFilteredResult(_0x22e356,_0x148284){return function(_0x181026){if(_0x181026){var _0x490b1b=_0x181026[_0x57a5('0x24')],_0x2652f2=_0x148284[_0x57a5('0x25')],_0x201b86=_0x148284[_0x57a5('0x25')]+_0x148284['limit'],_0x221337;if(_0x201b86>=_0x490b1b){_0x201b86=_0x490b1b;_0x221337=0xc8;}else{_0x221337=0xce;}_0x22e356[_0x57a5('0x22')](_0x221337);return _0x22e356['set'](_0x57a5('0x26'),_0x2652f2+'-'+_0x201b86+'/'+_0x490b1b)[_0x57a5('0x23')](_0x181026);}return null;};}function patchUpdates(_0x116087){return function(_0x598cd6){try{jsonpatch[_0x57a5('0x27')](_0x598cd6,_0x116087,!![]);}catch(_0x2c6163){return BPromise[_0x57a5('0x28')](_0x2c6163);}return _0x598cd6[_0x57a5('0x29')]();};}function saveUpdates(_0x284899,_0x3f8c30){return function(_0x28d85a){if(_0x28d85a){return _0x28d85a[_0x57a5('0x2a')](_0x284899)[_0x57a5('0x2b')](function(_0xc85612){return _0xc85612;});}return null;};}function removeEntity(_0x3b588e,_0x184b2f){return function(_0x58eb91){if(_0x58eb91){return _0x58eb91[_0x57a5('0x2c')]()[_0x57a5('0x2b')](function(){_0x3b588e[_0x57a5('0x22')](0xcc)[_0x57a5('0x2d')]();});}};}function handleEntityNotFound(_0x509bab,_0x56766f){return function(_0x33781d){if(!_0x33781d){_0x509bab[_0x57a5('0x21')](0x194);}return _0x33781d;};}function handleError(_0x39ad44,_0x307dc2){_0x307dc2=_0x307dc2||0x1f4;return function(_0x489a53){logger['error'](_0x489a53[_0x57a5('0x2e')]);if(_0x489a53[_0x57a5('0x2f')]){delete _0x489a53['name'];}_0x39ad44['status'](_0x307dc2)[_0x57a5('0x30')](_0x489a53);};}exports[_0x57a5('0x31')]=function(_0x3a58ed,_0x42d105){var _0x454248={},_0x312bbe={},_0x56957f={'count':0x0,'rows':[]};var _0x5a886e=_[_0x57a5('0x32')](db[_0x57a5('0x33')][_0x57a5('0x34')],function(_0xeb4669){return{'name':_0xeb4669[_0x57a5('0x35')],'type':_0xeb4669[_0x57a5('0x36')]['key']};});_0x312bbe[_0x57a5('0x37')]=_[_0x57a5('0x32')](_0x5a886e,_0x57a5('0x2f'));_0x312bbe[_0x57a5('0x38')]=_[_0x57a5('0x39')](_0x3a58ed[_0x57a5('0x38')]);_0x312bbe[_0x57a5('0x3a')]=_['intersection'](_0x312bbe[_0x57a5('0x37')],_0x312bbe['query']);_0x454248[_0x57a5('0x3b')]=_[_0x57a5('0x3c')](_0x312bbe['model'],qs[_0x57a5('0x3d')](_0x3a58ed[_0x57a5('0x38')][_0x57a5('0x3d')]));_0x454248[_0x57a5('0x3b')]=_0x454248[_0x57a5('0x3b')][_0x57a5('0x3e')]?_0x454248[_0x57a5('0x3b')]:_0x312bbe[_0x57a5('0x37')];if(!_0x3a58ed[_0x57a5('0x38')][_0x57a5('0x3f')]('nolimit')){_0x454248[_0x57a5('0x40')]=qs[_0x57a5('0x40')](_0x3a58ed[_0x57a5('0x38')][_0x57a5('0x40')]);_0x454248[_0x57a5('0x25')]=qs[_0x57a5('0x25')](_0x3a58ed[_0x57a5('0x38')][_0x57a5('0x25')]);}_0x454248[_0x57a5('0x41')]=qs[_0x57a5('0x42')](_0x3a58ed[_0x57a5('0x38')][_0x57a5('0x42')]);_0x454248[_0x57a5('0x43')]=qs[_0x57a5('0x3a')](_['pick'](_0x3a58ed['query'],_0x312bbe['filters']),_0x5a886e);if(_0x3a58ed[_0x57a5('0x38')][_0x57a5('0x44')]){_0x454248[_0x57a5('0x43')]=_[_0x57a5('0x45')](_0x454248[_0x57a5('0x43')],{'$or':_[_0x57a5('0x32')](_0x5a886e,function(_0x5b7f4f){if(_0x5b7f4f['type']!==_0x57a5('0x46')){var _0x2cacb6={};_0x2cacb6[_0x5b7f4f[_0x57a5('0x2f')]]={'$like':'%'+_0x3a58ed['query'][_0x57a5('0x44')]+'%'};return _0x2cacb6;}})});}_0x454248=_[_0x57a5('0x45')]({},_0x454248,_0x3a58ed['options']);var _0x5a09a7={'where':_0x454248[_0x57a5('0x43')]};return db[_0x57a5('0x33')][_0x57a5('0x24')](_0x5a09a7)[_0x57a5('0x2b')](function(_0x4ed0a3){_0x56957f[_0x57a5('0x24')]=_0x4ed0a3;if(_0x3a58ed['query'][_0x57a5('0x47')]){_0x454248[_0x57a5('0x48')]=[{'all':!![]}];}return db[_0x57a5('0x33')][_0x57a5('0x49')](_0x454248);})[_0x57a5('0x2b')](function(_0xe116b1){_0x56957f['rows']=_0xe116b1;return _0x56957f;})[_0x57a5('0x2b')](respondWithFilteredResult(_0x42d105,_0x454248))[_0x57a5('0x20')](handleError(_0x42d105,null));};exports[_0x57a5('0x4a')]=function(_0xd6cc2e,_0x38c894){var _0xf492c9={'raw':![],'where':{'id':_0xd6cc2e[_0x57a5('0x4b')]['id']}},_0x6d2173={};_0x6d2173[_0x57a5('0x37')]=_[_0x57a5('0x39')](db[_0x57a5('0x33')]['rawAttributes']);_0x6d2173[_0x57a5('0x38')]=_[_0x57a5('0x39')](_0xd6cc2e['query']);_0x6d2173[_0x57a5('0x3a')]=_[_0x57a5('0x3c')](_0x6d2173[_0x57a5('0x37')],_0x6d2173['query']);_0xf492c9['attributes']=_[_0x57a5('0x3c')](_0x6d2173['model'],qs['fields'](_0xd6cc2e['query'][_0x57a5('0x3d')]));_0xf492c9[_0x57a5('0x3b')]=_0xf492c9[_0x57a5('0x3b')]['length']?_0xf492c9['attributes']:_0x6d2173[_0x57a5('0x37')];if(_0xd6cc2e[_0x57a5('0x38')][_0x57a5('0x47')]){_0xf492c9['include']=[{'all':!![]}];}_0xf492c9=_[_0x57a5('0x45')]({},_0xf492c9,_0xd6cc2e[_0x57a5('0x4c')]);return db[_0x57a5('0x33')]['find'](_0xf492c9)[_0x57a5('0x2b')](handleEntityNotFound(_0x38c894,null))[_0x57a5('0x2b')](respondWithResult(_0x38c894,null))[_0x57a5('0x20')](handleError(_0x38c894,null));};exports[_0x57a5('0x4d')]=function(_0x11e69e,_0x29ce46){return db[_0x57a5('0x33')][_0x57a5('0x4d')](_0x11e69e[_0x57a5('0x4e')],{})[_0x57a5('0x2b')](respondWithResult(_0x29ce46,0xc9))[_0x57a5('0x20')](handleError(_0x29ce46,null));};exports[_0x57a5('0x2a')]=function(_0x30e7dc,_0x3c17e5){if(_0x30e7dc[_0x57a5('0x4e')]['id']){delete _0x30e7dc[_0x57a5('0x4e')]['id'];}return db['ServicenowConfiguration'][_0x57a5('0x4f')]({'where':{'id':_0x30e7dc[_0x57a5('0x4b')]['id']}})[_0x57a5('0x2b')](handleEntityNotFound(_0x3c17e5,null))[_0x57a5('0x2b')](saveUpdates(_0x30e7dc['body'],null))[_0x57a5('0x2b')](respondWithResult(_0x3c17e5,null))[_0x57a5('0x20')](handleError(_0x3c17e5,null));};exports[_0x57a5('0x2c')]=function(_0xad4cbd,_0x5ebf1f){return db[_0x57a5('0x33')]['find']({'where':{'id':_0xad4cbd[_0x57a5('0x4b')]['id']}})[_0x57a5('0x2b')](handleEntityNotFound(_0x5ebf1f,null))[_0x57a5('0x2b')](removeEntity(_0x5ebf1f,null))[_0x57a5('0x20')](handleError(_0x5ebf1f,null));};exports['getFields']=function(_0x159362,_0x4bcd84,_0x365dc1){var _0x4af5a3={};var _0x286efa={};var _0x424447;var _0x43cbde;return db[_0x57a5('0x33')]['findOne']({'where':{'id':_0x159362['params']['id']}})[_0x57a5('0x2b')](handleEntityNotFound(_0x4bcd84,null))[_0x57a5('0x2b')](function(_0x5dd11b){if(_0x5dd11b){_0x424447=_0x5dd11b;_0x286efa['model']=_['keys'](db[_0x57a5('0x50')]['rawAttributes']);_0x286efa[_0x57a5('0x38')]=_['keys'](_0x159362[_0x57a5('0x38')]);_0x286efa[_0x57a5('0x3a')]=_[_0x57a5('0x3c')](_0x286efa['model'],_0x286efa['query']);_0x4af5a3['attributes']=_['intersection'](_0x286efa['model'],qs[_0x57a5('0x3d')](_0x159362[_0x57a5('0x38')][_0x57a5('0x3d')]));_0x4af5a3[_0x57a5('0x3b')]=_0x4af5a3[_0x57a5('0x3b')]['length']?_0x4af5a3[_0x57a5('0x3b')]:_0x286efa[_0x57a5('0x37')];_0x4af5a3[_0x57a5('0x41')]=qs['sort'](_0x159362[_0x57a5('0x38')][_0x57a5('0x42')]);_0x4af5a3['where']=qs[_0x57a5('0x3a')](_[_0x57a5('0x51')](_0x159362[_0x57a5('0x38')],_0x286efa[_0x57a5('0x3a')]));if(_0x159362[_0x57a5('0x38')][_0x57a5('0x44')]){_0x4af5a3[_0x57a5('0x43')]=_['merge'](_0x4af5a3[_0x57a5('0x43')],{'$or':_['map'](_0x4af5a3[_0x57a5('0x3b')],function(_0x2a4119){var _0x19513a={};_0x19513a[_0x2a4119]={'$like':'%'+_0x159362[_0x57a5('0x38')][_0x57a5('0x44')]+'%'};return _0x19513a;})});}_0x4af5a3=_[_0x57a5('0x45')]({},_0x4af5a3,_0x159362[_0x57a5('0x4c')]);return _0x424447[_0x57a5('0x52')](_0x4af5a3);}})[_0x57a5('0x2b')](function(_0x25693d){if(_0x25693d){_0x43cbde=_0x25693d['length'];if(!_0x159362[_0x57a5('0x38')][_0x57a5('0x3f')](_0x57a5('0x53'))){_0x4af5a3[_0x57a5('0x40')]=qs[_0x57a5('0x40')](_0x159362[_0x57a5('0x38')][_0x57a5('0x40')]);_0x4af5a3[_0x57a5('0x25')]=qs['offset'](_0x159362[_0x57a5('0x38')][_0x57a5('0x25')]);}return _0x424447[_0x57a5('0x52')](_0x4af5a3);}})['then'](function(_0x16b6c8){if(_0x16b6c8){return _0x16b6c8?{'count':_0x43cbde,'rows':_0x16b6c8}:null;}})[_0x57a5('0x2b')](respondWithResult(_0x4bcd84,null))[_0x57a5('0x20')](handleError(_0x4bcd84,null));};exports[_0x57a5('0x54')]=function(_0xca5dfa,_0x49b863,_0x336efe){var _0x5f0c69={};var _0x3e6ae3={};var _0x28f2b0;var _0x262897;return db[_0x57a5('0x33')][_0x57a5('0x55')]({'where':{'id':_0xca5dfa[_0x57a5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x49b863,null))[_0x57a5('0x2b')](function(_0x3dc629){if(_0x3dc629){_0x28f2b0=_0x3dc629;_0x3e6ae3[_0x57a5('0x37')]=_[_0x57a5('0x39')](db['ServicenowField'][_0x57a5('0x34')]);_0x3e6ae3[_0x57a5('0x38')]=_[_0x57a5('0x39')](_0xca5dfa[_0x57a5('0x38')]);_0x3e6ae3[_0x57a5('0x3a')]=_[_0x57a5('0x3c')](_0x3e6ae3[_0x57a5('0x37')],_0x3e6ae3[_0x57a5('0x38')]);_0x5f0c69[_0x57a5('0x3b')]=_['intersection'](_0x3e6ae3[_0x57a5('0x37')],qs[_0x57a5('0x3d')](_0xca5dfa['query'][_0x57a5('0x3d')]));_0x5f0c69['attributes']=_0x5f0c69[_0x57a5('0x3b')][_0x57a5('0x3e')]?_0x5f0c69[_0x57a5('0x3b')]:_0x3e6ae3['model'];_0x5f0c69['order']=qs[_0x57a5('0x42')](_0xca5dfa[_0x57a5('0x38')][_0x57a5('0x42')]);_0x5f0c69[_0x57a5('0x43')]=qs[_0x57a5('0x3a')](_[_0x57a5('0x51')](_0xca5dfa[_0x57a5('0x38')],_0x3e6ae3[_0x57a5('0x3a')]));if(_0xca5dfa[_0x57a5('0x38')][_0x57a5('0x44')]){_0x5f0c69[_0x57a5('0x43')]=_[_0x57a5('0x45')](_0x5f0c69[_0x57a5('0x43')],{'$or':_[_0x57a5('0x32')](_0x5f0c69['attributes'],function(_0xdff3f6){var _0x493747={};_0x493747[_0xdff3f6]={'$like':'%'+_0xca5dfa[_0x57a5('0x38')][_0x57a5('0x44')]+'%'};return _0x493747;})});}_0x5f0c69=_[_0x57a5('0x45')]({},_0x5f0c69,_0xca5dfa['options']);return _0x28f2b0[_0x57a5('0x54')](_0x5f0c69);}})['then'](function(_0x4b0ef0){if(_0x4b0ef0){_0x262897=_0x4b0ef0[_0x57a5('0x3e')];if(!_0xca5dfa[_0x57a5('0x38')]['hasOwnProperty'](_0x57a5('0x53'))){_0x5f0c69['limit']=qs[_0x57a5('0x40')](_0xca5dfa['query']['limit']);_0x5f0c69[_0x57a5('0x25')]=qs[_0x57a5('0x25')](_0xca5dfa[_0x57a5('0x38')]['offset']);}return _0x28f2b0['getSubjects'](_0x5f0c69);}})['then'](function(_0x4a9bb2){if(_0x4a9bb2){return _0x4a9bb2?{'count':_0x262897,'rows':_0x4a9bb2}:null;}})[_0x57a5('0x2b')](respondWithResult(_0x49b863,null))['catch'](handleError(_0x49b863,null));};exports[_0x57a5('0x56')]=function(_0x366c60,_0x5cbcb2,_0x363509){var _0x3f34db={};var _0x28a5a6={};var _0xa2478d;var _0x519ffb;return db['ServicenowConfiguration'][_0x57a5('0x55')]({'where':{'id':_0x366c60[_0x57a5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5cbcb2,null))[_0x57a5('0x2b')](function(_0x35b1d7){if(_0x35b1d7){_0xa2478d=_0x35b1d7;_0x28a5a6[_0x57a5('0x37')]=_[_0x57a5('0x39')](db[_0x57a5('0x50')][_0x57a5('0x34')]);_0x28a5a6[_0x57a5('0x38')]=_[_0x57a5('0x39')](_0x366c60[_0x57a5('0x38')]);_0x28a5a6[_0x57a5('0x3a')]=_[_0x57a5('0x3c')](_0x28a5a6[_0x57a5('0x37')],_0x28a5a6[_0x57a5('0x38')]);_0x3f34db[_0x57a5('0x3b')]=_[_0x57a5('0x3c')](_0x28a5a6[_0x57a5('0x37')],qs[_0x57a5('0x3d')](_0x366c60['query']['fields']));_0x3f34db[_0x57a5('0x3b')]=_0x3f34db[_0x57a5('0x3b')]['length']?_0x3f34db[_0x57a5('0x3b')]:_0x28a5a6[_0x57a5('0x37')];_0x3f34db[_0x57a5('0x41')]=qs['sort'](_0x366c60['query'][_0x57a5('0x42')]);_0x3f34db['where']=qs[_0x57a5('0x3a')](_[_0x57a5('0x51')](_0x366c60[_0x57a5('0x38')],_0x28a5a6['filters']));if(_0x366c60[_0x57a5('0x38')]['filter']){_0x3f34db[_0x57a5('0x43')]=_[_0x57a5('0x45')](_0x3f34db['where'],{'$or':_[_0x57a5('0x32')](_0x3f34db[_0x57a5('0x3b')],function(_0x3b76bf){var _0x334327={};_0x334327[_0x3b76bf]={'$like':'%'+_0x366c60[_0x57a5('0x38')][_0x57a5('0x44')]+'%'};return _0x334327;})});}_0x3f34db=_['merge']({},_0x3f34db,_0x366c60['options']);return _0xa2478d[_0x57a5('0x56')](_0x3f34db);}})['then'](function(_0x289870){if(_0x289870){_0x519ffb=_0x289870[_0x57a5('0x3e')];if(!_0x366c60[_0x57a5('0x38')]['hasOwnProperty'](_0x57a5('0x53'))){_0x3f34db[_0x57a5('0x40')]=qs[_0x57a5('0x40')](_0x366c60[_0x57a5('0x38')][_0x57a5('0x40')]);_0x3f34db[_0x57a5('0x25')]=qs['offset'](_0x366c60[_0x57a5('0x38')][_0x57a5('0x25')]);}return _0xa2478d['getDescriptions'](_0x3f34db);}})['then'](function(_0x40efc0){if(_0x40efc0){return _0x40efc0?{'count':_0x519ffb,'rows':_0x40efc0}:null;}})[_0x57a5('0x2b')](respondWithResult(_0x5cbcb2,null))[_0x57a5('0x20')](handleError(_0x5cbcb2,null));}; \ No newline at end of file +var _0xcbd1=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','limit','set','Content-Range','reject','save','destroy','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','length','attributes','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','find','create','update','body','params','getFields','findOne','ServicenowField','filters','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0xcbd1,0x15b));var _0x1cbd=function(_0x2a2845,_0x596fee){_0x2a2845=_0x2a2845-0x0;var _0x2346c8=_0xcbd1[_0x2a2845];return _0x2346c8;};'use strict';var pdf=require(_0x1cbd('0x0'));var emlformat=require(_0x1cbd('0x1'));var rimraf=require(_0x1cbd('0x2'));var zipdir=require(_0x1cbd('0x3'));var jsonpatch=require(_0x1cbd('0x4'));var rp=require(_0x1cbd('0x5'));var moment=require(_0x1cbd('0x6'));var BPromise=require(_0x1cbd('0x7'));var Mustache=require(_0x1cbd('0x8'));var util=require('util');var path=require(_0x1cbd('0x9'));var sox=require(_0x1cbd('0xa'));var csv=require(_0x1cbd('0xb'));var ejs=require(_0x1cbd('0xc'));var fs=require('fs');var fs_extra=require(_0x1cbd('0xd'));var _=require(_0x1cbd('0xe'));var squel=require(_0x1cbd('0xf'));var crypto=require(_0x1cbd('0x10'));var jsforce=require(_0x1cbd('0x11'));var deskjs=require(_0x1cbd('0x12'));var toCsv=require(_0x1cbd('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cbd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1cbd('0x14'));var logger=require(_0x1cbd('0x15'))(_0x1cbd('0x16'));var utils=require('../../config/utils');var config=require(_0x1cbd('0x17'));var licenseUtil=require(_0x1cbd('0x18'));var db=require(_0x1cbd('0x19'))['db'];var jayson=require(_0x1cbd('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x423273,_0x3ecd52,_0x5881c1,_0x479023){return new BPromise(function(_0x242716,_0x84e908){var _0x113bb4=_0x479023||client;return _0x113bb4[_0x1cbd('0x1b')](_0x423273,_0x5881c1)[_0x1cbd('0x1c')](function(_0x1fca7a){logger['info'](_0x1cbd('0x1d'),_0x3ecd52,_0x1cbd('0x1e'));logger['debug'](_0x1cbd('0x1f'),_0x3ecd52,_0x1cbd('0x1e'),JSON[_0x1cbd('0x20')](_0x1fca7a));if(_0x1fca7a[_0x1cbd('0x21')]){if(_0x1fca7a[_0x1cbd('0x21')][_0x1cbd('0x22')]===0x1f4){logger[_0x1cbd('0x21')](_0x1cbd('0x1d'),_0x3ecd52,_0x1fca7a[_0x1cbd('0x21')][_0x1cbd('0x23')]);return _0x84e908(_0x1fca7a[_0x1cbd('0x21')][_0x1cbd('0x23')]);}logger[_0x1cbd('0x21')](_0x1cbd('0x1d'),_0x3ecd52,_0x1fca7a['error'][_0x1cbd('0x23')]);return _0x242716(_0x1fca7a[_0x1cbd('0x21')][_0x1cbd('0x23')]);}else{logger[_0x1cbd('0x24')](_0x1cbd('0x1d'),_0x3ecd52,_0x1cbd('0x1e'));_0x242716(_0x1fca7a['result'][_0x1cbd('0x23')]);}})[_0x1cbd('0x25')](function(_0x45e759){logger[_0x1cbd('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3ecd52,_0x45e759);_0x84e908(_0x45e759);});});}function respondWithStatusCode(_0x42dbaa,_0x58452d){_0x58452d=_0x58452d||0xcc;return function(_0x3752d3){if(_0x3752d3){return _0x42dbaa['sendStatus'](_0x58452d);}return _0x42dbaa[_0x1cbd('0x26')](_0x58452d)['end']();};}function respondWithResult(_0x3d7a52,_0x2265d3){_0x2265d3=_0x2265d3||0xc8;return function(_0x29cbd3){if(_0x29cbd3){return _0x3d7a52[_0x1cbd('0x26')](_0x2265d3)[_0x1cbd('0x27')](_0x29cbd3);}};}function respondWithFilteredResult(_0x5647cf,_0x210867){return function(_0x4cc9a9){if(_0x4cc9a9){var _0x10ef99=_0x4cc9a9['count'],_0x3dfbe3=_0x210867['offset'],_0x5c8dcd=_0x210867['offset']+_0x210867[_0x1cbd('0x28')],_0x4ad52d;if(_0x5c8dcd>=_0x10ef99){_0x5c8dcd=_0x10ef99;_0x4ad52d=0xc8;}else{_0x4ad52d=0xce;}_0x5647cf[_0x1cbd('0x26')](_0x4ad52d);return _0x5647cf[_0x1cbd('0x29')](_0x1cbd('0x2a'),_0x3dfbe3+'-'+_0x5c8dcd+'/'+_0x10ef99)[_0x1cbd('0x27')](_0x4cc9a9);}return null;};}function patchUpdates(_0x4d88ee){return function(_0x5524d9){try{jsonpatch['apply'](_0x5524d9,_0x4d88ee,!![]);}catch(_0x39db39){return BPromise[_0x1cbd('0x2b')](_0x39db39);}return _0x5524d9[_0x1cbd('0x2c')]();};}function saveUpdates(_0x2bc65d,_0x92d836){return function(_0x3dc279){if(_0x3dc279){return _0x3dc279['update'](_0x2bc65d)[_0x1cbd('0x1c')](function(_0x4667f1){return _0x4667f1;});}return null;};}function removeEntity(_0x3116e1,_0x45259c){return function(_0x557eed){if(_0x557eed){return _0x557eed[_0x1cbd('0x2d')]()[_0x1cbd('0x1c')](function(){_0x3116e1['status'](0xcc)[_0x1cbd('0x2e')]();});}};}function handleEntityNotFound(_0x3021de,_0x567386){return function(_0x46563d){if(!_0x46563d){_0x3021de['sendStatus'](0x194);}return _0x46563d;};}function handleError(_0x37a203,_0x15b29b){_0x15b29b=_0x15b29b||0x1f4;return function(_0x1d0e96){logger[_0x1cbd('0x21')](_0x1d0e96[_0x1cbd('0x2f')]);if(_0x1d0e96[_0x1cbd('0x30')]){delete _0x1d0e96[_0x1cbd('0x30')];}_0x37a203['status'](_0x15b29b)[_0x1cbd('0x31')](_0x1d0e96);};}exports[_0x1cbd('0x32')]=function(_0x32eb3f,_0xc36f46){var _0x366325={},_0x487a12={},_0x3421d4={'count':0x0,'rows':[]};var _0xb49055=_[_0x1cbd('0x33')](db[_0x1cbd('0x34')][_0x1cbd('0x35')],function(_0x37ce57){return{'name':_0x37ce57[_0x1cbd('0x36')],'type':_0x37ce57[_0x1cbd('0x37')][_0x1cbd('0x38')]};});_0x487a12['model']=_[_0x1cbd('0x33')](_0xb49055,_0x1cbd('0x30'));_0x487a12[_0x1cbd('0x39')]=_[_0x1cbd('0x3a')](_0x32eb3f[_0x1cbd('0x39')]);_0x487a12['filters']=_['intersection'](_0x487a12[_0x1cbd('0x3b')],_0x487a12[_0x1cbd('0x39')]);_0x366325['attributes']=_[_0x1cbd('0x3c')](_0x487a12[_0x1cbd('0x3b')],qs[_0x1cbd('0x3d')](_0x32eb3f['query'][_0x1cbd('0x3d')]));_0x366325['attributes']=_0x366325['attributes'][_0x1cbd('0x3e')]?_0x366325[_0x1cbd('0x3f')]:_0x487a12[_0x1cbd('0x3b')];if(!_0x32eb3f['query']['hasOwnProperty'](_0x1cbd('0x40'))){_0x366325['limit']=qs['limit'](_0x32eb3f['query'][_0x1cbd('0x28')]);_0x366325[_0x1cbd('0x41')]=qs[_0x1cbd('0x41')](_0x32eb3f[_0x1cbd('0x39')][_0x1cbd('0x41')]);}_0x366325[_0x1cbd('0x42')]=qs[_0x1cbd('0x43')](_0x32eb3f['query'][_0x1cbd('0x43')]);_0x366325['where']=qs['filters'](_[_0x1cbd('0x44')](_0x32eb3f[_0x1cbd('0x39')],_0x487a12['filters']),_0xb49055);if(_0x32eb3f[_0x1cbd('0x39')][_0x1cbd('0x45')]){_0x366325[_0x1cbd('0x46')]=_[_0x1cbd('0x47')](_0x366325[_0x1cbd('0x46')],{'$or':_[_0x1cbd('0x33')](_0xb49055,function(_0x7a4b25){if(_0x7a4b25[_0x1cbd('0x37')]!==_0x1cbd('0x48')){var _0x30fa56={};_0x30fa56[_0x7a4b25[_0x1cbd('0x30')]]={'$like':'%'+_0x32eb3f[_0x1cbd('0x39')][_0x1cbd('0x45')]+'%'};return _0x30fa56;}})});}_0x366325=_[_0x1cbd('0x47')]({},_0x366325,_0x32eb3f[_0x1cbd('0x49')]);var _0x1db9b2={'where':_0x366325[_0x1cbd('0x46')]};return db[_0x1cbd('0x34')][_0x1cbd('0x4a')](_0x1db9b2)[_0x1cbd('0x1c')](function(_0x319371){_0x3421d4[_0x1cbd('0x4a')]=_0x319371;if(_0x32eb3f[_0x1cbd('0x39')]['includeAll']){_0x366325[_0x1cbd('0x4b')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x1cbd('0x4c')](_0x366325);})['then'](function(_0x1ee08a){_0x3421d4['rows']=_0x1ee08a;return _0x3421d4;})[_0x1cbd('0x1c')](respondWithFilteredResult(_0xc36f46,_0x366325))[_0x1cbd('0x25')](handleError(_0xc36f46,null));};exports['show']=function(_0x31805a,_0xdd4edb){var _0x30a458={'raw':![],'where':{'id':_0x31805a['params']['id']}},_0x560465={};_0x560465[_0x1cbd('0x3b')]=_['keys'](db[_0x1cbd('0x34')]['rawAttributes']);_0x560465[_0x1cbd('0x39')]=_[_0x1cbd('0x3a')](_0x31805a[_0x1cbd('0x39')]);_0x560465['filters']=_['intersection'](_0x560465[_0x1cbd('0x3b')],_0x560465[_0x1cbd('0x39')]);_0x30a458[_0x1cbd('0x3f')]=_[_0x1cbd('0x3c')](_0x560465[_0x1cbd('0x3b')],qs[_0x1cbd('0x3d')](_0x31805a[_0x1cbd('0x39')]['fields']));_0x30a458[_0x1cbd('0x3f')]=_0x30a458[_0x1cbd('0x3f')]['length']?_0x30a458[_0x1cbd('0x3f')]:_0x560465['model'];if(_0x31805a[_0x1cbd('0x39')]['includeAll']){_0x30a458[_0x1cbd('0x4b')]=[{'all':!![]}];}_0x30a458=_[_0x1cbd('0x47')]({},_0x30a458,_0x31805a['options']);return db[_0x1cbd('0x34')][_0x1cbd('0x4d')](_0x30a458)[_0x1cbd('0x1c')](handleEntityNotFound(_0xdd4edb,null))[_0x1cbd('0x1c')](respondWithResult(_0xdd4edb,null))[_0x1cbd('0x25')](handleError(_0xdd4edb,null));};exports['create']=function(_0x458376,_0x5fb8a9){return db[_0x1cbd('0x34')][_0x1cbd('0x4e')](_0x458376['body'],{})[_0x1cbd('0x1c')](respondWithResult(_0x5fb8a9,0xc9))[_0x1cbd('0x25')](handleError(_0x5fb8a9,null));};exports[_0x1cbd('0x4f')]=function(_0x1bb536,_0x456ef4){if(_0x1bb536[_0x1cbd('0x50')]['id']){delete _0x1bb536[_0x1cbd('0x50')]['id'];}return db[_0x1cbd('0x34')]['find']({'where':{'id':_0x1bb536[_0x1cbd('0x51')]['id']}})['then'](handleEntityNotFound(_0x456ef4,null))['then'](saveUpdates(_0x1bb536['body'],null))[_0x1cbd('0x1c')](respondWithResult(_0x456ef4,null))[_0x1cbd('0x25')](handleError(_0x456ef4,null));};exports[_0x1cbd('0x2d')]=function(_0x5807b2,_0x1bcd48){return db['ServicenowConfiguration'][_0x1cbd('0x4d')]({'where':{'id':_0x5807b2['params']['id']}})[_0x1cbd('0x1c')](handleEntityNotFound(_0x1bcd48,null))[_0x1cbd('0x1c')](removeEntity(_0x1bcd48,null))[_0x1cbd('0x25')](handleError(_0x1bcd48,null));};exports[_0x1cbd('0x52')]=function(_0x144c46,_0x143143,_0x113c3e){var _0x4f8045={};var _0x57510f={};var _0x5a99e7;var _0x55ec1d;return db[_0x1cbd('0x34')][_0x1cbd('0x53')]({'where':{'id':_0x144c46['params']['id']}})['then'](handleEntityNotFound(_0x143143,null))[_0x1cbd('0x1c')](function(_0x5ee458){if(_0x5ee458){_0x5a99e7=_0x5ee458;_0x57510f[_0x1cbd('0x3b')]=_['keys'](db[_0x1cbd('0x54')]['rawAttributes']);_0x57510f['query']=_[_0x1cbd('0x3a')](_0x144c46[_0x1cbd('0x39')]);_0x57510f['filters']=_['intersection'](_0x57510f[_0x1cbd('0x3b')],_0x57510f[_0x1cbd('0x39')]);_0x4f8045[_0x1cbd('0x3f')]=_['intersection'](_0x57510f[_0x1cbd('0x3b')],qs['fields'](_0x144c46[_0x1cbd('0x39')][_0x1cbd('0x3d')]));_0x4f8045[_0x1cbd('0x3f')]=_0x4f8045[_0x1cbd('0x3f')][_0x1cbd('0x3e')]?_0x4f8045['attributes']:_0x57510f[_0x1cbd('0x3b')];_0x4f8045[_0x1cbd('0x42')]=qs[_0x1cbd('0x43')](_0x144c46[_0x1cbd('0x39')][_0x1cbd('0x43')]);_0x4f8045['where']=qs[_0x1cbd('0x55')](_[_0x1cbd('0x44')](_0x144c46[_0x1cbd('0x39')],_0x57510f[_0x1cbd('0x55')]));if(_0x144c46[_0x1cbd('0x39')]['filter']){_0x4f8045['where']=_[_0x1cbd('0x47')](_0x4f8045['where'],{'$or':_['map'](_0x4f8045[_0x1cbd('0x3f')],function(_0x24caa0){var _0x14bf2d={};_0x14bf2d[_0x24caa0]={'$like':'%'+_0x144c46[_0x1cbd('0x39')][_0x1cbd('0x45')]+'%'};return _0x14bf2d;})});}_0x4f8045=_[_0x1cbd('0x47')]({},_0x4f8045,_0x144c46[_0x1cbd('0x49')]);return _0x5a99e7['getFields'](_0x4f8045);}})[_0x1cbd('0x1c')](function(_0x61b060){if(_0x61b060){_0x55ec1d=_0x61b060['length'];if(!_0x144c46[_0x1cbd('0x39')][_0x1cbd('0x56')](_0x1cbd('0x40'))){_0x4f8045[_0x1cbd('0x28')]=qs[_0x1cbd('0x28')](_0x144c46[_0x1cbd('0x39')][_0x1cbd('0x28')]);_0x4f8045[_0x1cbd('0x41')]=qs[_0x1cbd('0x41')](_0x144c46[_0x1cbd('0x39')][_0x1cbd('0x41')]);}return _0x5a99e7[_0x1cbd('0x52')](_0x4f8045);}})[_0x1cbd('0x1c')](function(_0x25df74){if(_0x25df74){return _0x25df74?{'count':_0x55ec1d,'rows':_0x25df74}:null;}})[_0x1cbd('0x1c')](respondWithResult(_0x143143,null))[_0x1cbd('0x25')](handleError(_0x143143,null));};exports['getSubjects']=function(_0x13cfcf,_0xad5d47,_0x3cffb1){var _0x112040={};var _0x47dbfb={};var _0x37d685;var _0x31ee22;return db['ServicenowConfiguration'][_0x1cbd('0x53')]({'where':{'id':_0x13cfcf[_0x1cbd('0x51')]['id']}})[_0x1cbd('0x1c')](handleEntityNotFound(_0xad5d47,null))['then'](function(_0x4fea2c){if(_0x4fea2c){_0x37d685=_0x4fea2c;_0x47dbfb[_0x1cbd('0x3b')]=_[_0x1cbd('0x3a')](db[_0x1cbd('0x54')][_0x1cbd('0x35')]);_0x47dbfb[_0x1cbd('0x39')]=_[_0x1cbd('0x3a')](_0x13cfcf[_0x1cbd('0x39')]);_0x47dbfb[_0x1cbd('0x55')]=_[_0x1cbd('0x3c')](_0x47dbfb[_0x1cbd('0x3b')],_0x47dbfb[_0x1cbd('0x39')]);_0x112040['attributes']=_[_0x1cbd('0x3c')](_0x47dbfb[_0x1cbd('0x3b')],qs['fields'](_0x13cfcf[_0x1cbd('0x39')]['fields']));_0x112040[_0x1cbd('0x3f')]=_0x112040[_0x1cbd('0x3f')][_0x1cbd('0x3e')]?_0x112040[_0x1cbd('0x3f')]:_0x47dbfb[_0x1cbd('0x3b')];_0x112040[_0x1cbd('0x42')]=qs[_0x1cbd('0x43')](_0x13cfcf[_0x1cbd('0x39')][_0x1cbd('0x43')]);_0x112040[_0x1cbd('0x46')]=qs['filters'](_[_0x1cbd('0x44')](_0x13cfcf[_0x1cbd('0x39')],_0x47dbfb['filters']));if(_0x13cfcf[_0x1cbd('0x39')][_0x1cbd('0x45')]){_0x112040[_0x1cbd('0x46')]=_[_0x1cbd('0x47')](_0x112040[_0x1cbd('0x46')],{'$or':_[_0x1cbd('0x33')](_0x112040[_0x1cbd('0x3f')],function(_0x4723b7){var _0x4927b5={};_0x4927b5[_0x4723b7]={'$like':'%'+_0x13cfcf[_0x1cbd('0x39')][_0x1cbd('0x45')]+'%'};return _0x4927b5;})});}_0x112040=_[_0x1cbd('0x47')]({},_0x112040,_0x13cfcf['options']);return _0x37d685[_0x1cbd('0x57')](_0x112040);}})['then'](function(_0x3d22aa){if(_0x3d22aa){_0x31ee22=_0x3d22aa[_0x1cbd('0x3e')];if(!_0x13cfcf[_0x1cbd('0x39')][_0x1cbd('0x56')](_0x1cbd('0x40'))){_0x112040['limit']=qs[_0x1cbd('0x28')](_0x13cfcf[_0x1cbd('0x39')][_0x1cbd('0x28')]);_0x112040[_0x1cbd('0x41')]=qs[_0x1cbd('0x41')](_0x13cfcf[_0x1cbd('0x39')]['offset']);}return _0x37d685['getSubjects'](_0x112040);}})[_0x1cbd('0x1c')](function(_0x2b3c36){if(_0x2b3c36){return _0x2b3c36?{'count':_0x31ee22,'rows':_0x2b3c36}:null;}})[_0x1cbd('0x1c')](respondWithResult(_0xad5d47,null))[_0x1cbd('0x25')](handleError(_0xad5d47,null));};exports[_0x1cbd('0x58')]=function(_0x3798ec,_0x5c9e0b,_0x5ad2c8){var _0x606292={};var _0x1057de={};var _0x3f035b;var _0xec439a;return db['ServicenowConfiguration'][_0x1cbd('0x53')]({'where':{'id':_0x3798ec[_0x1cbd('0x51')]['id']}})[_0x1cbd('0x1c')](handleEntityNotFound(_0x5c9e0b,null))['then'](function(_0x12ff12){if(_0x12ff12){_0x3f035b=_0x12ff12;_0x1057de[_0x1cbd('0x3b')]=_[_0x1cbd('0x3a')](db[_0x1cbd('0x54')]['rawAttributes']);_0x1057de['query']=_['keys'](_0x3798ec[_0x1cbd('0x39')]);_0x1057de['filters']=_['intersection'](_0x1057de[_0x1cbd('0x3b')],_0x1057de[_0x1cbd('0x39')]);_0x606292[_0x1cbd('0x3f')]=_[_0x1cbd('0x3c')](_0x1057de[_0x1cbd('0x3b')],qs[_0x1cbd('0x3d')](_0x3798ec[_0x1cbd('0x39')][_0x1cbd('0x3d')]));_0x606292['attributes']=_0x606292[_0x1cbd('0x3f')]['length']?_0x606292[_0x1cbd('0x3f')]:_0x1057de[_0x1cbd('0x3b')];_0x606292[_0x1cbd('0x42')]=qs[_0x1cbd('0x43')](_0x3798ec[_0x1cbd('0x39')][_0x1cbd('0x43')]);_0x606292['where']=qs[_0x1cbd('0x55')](_[_0x1cbd('0x44')](_0x3798ec['query'],_0x1057de['filters']));if(_0x3798ec['query'][_0x1cbd('0x45')]){_0x606292['where']=_[_0x1cbd('0x47')](_0x606292[_0x1cbd('0x46')],{'$or':_[_0x1cbd('0x33')](_0x606292[_0x1cbd('0x3f')],function(_0x1a3557){var _0x4ef87f={};_0x4ef87f[_0x1a3557]={'$like':'%'+_0x3798ec['query'][_0x1cbd('0x45')]+'%'};return _0x4ef87f;})});}_0x606292=_[_0x1cbd('0x47')]({},_0x606292,_0x3798ec['options']);return _0x3f035b['getDescriptions'](_0x606292);}})[_0x1cbd('0x1c')](function(_0x3067fd){if(_0x3067fd){_0xec439a=_0x3067fd[_0x1cbd('0x3e')];if(!_0x3798ec[_0x1cbd('0x39')][_0x1cbd('0x56')]('nolimit')){_0x606292[_0x1cbd('0x28')]=qs[_0x1cbd('0x28')](_0x3798ec[_0x1cbd('0x39')]['limit']);_0x606292[_0x1cbd('0x41')]=qs[_0x1cbd('0x41')](_0x3798ec[_0x1cbd('0x39')][_0x1cbd('0x41')]);}return _0x3f035b[_0x1cbd('0x58')](_0x606292);}})['then'](function(_0xec39ab){if(_0xec39ab){return _0xec39ab?{'count':_0xec439a,'rows':_0xec39ab}:null;}})[_0x1cbd('0x1c')](respondWithResult(_0x5c9e0b,null))[_0x1cbd('0x25')](handleError(_0x5c9e0b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 70d07fe..09643eb 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 _0xf303=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intServicenowConfiguration.attributes','define'];(function(_0x510560,_0xff7333){var _0xbc9627=function(_0x16293b){while(--_0x16293b){_0x510560['push'](_0x510560['shift']());}};_0xbc9627(++_0xff7333);}(_0xf303,0x9e));var _0x3f30=function(_0x3fb722,_0x2ed856){_0x3fb722=_0x3fb722-0x0;var _0x1b9664=_0xf303[_0x3fb722];return _0x1b9664;};'use strict';var _=require(_0x3f30('0x0'));var util=require(_0x3f30('0x1'));var logger=require(_0x3f30('0x2'))(_0x3f30('0x3'));var moment=require(_0x3f30('0x4'));var BPromise=require(_0x3f30('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f30('0x6'));var rimraf=require('rimraf');var config=require(_0x3f30('0x7'));var attributes=require(_0x3f30('0x8'));module['exports']=function(_0x1cd2de,_0x32cd26){return _0x1cd2de[_0x3f30('0x9')](_0x3f30('0xa'),attributes,{'tableName':_0x3f30('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd931=['exports','define','ServicenowConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd931,0xe0));var _0x1d93=function(_0x4ed17b,_0x2b1745){_0x4ed17b=_0x4ed17b-0x0;var _0x24b248=_0xd931[_0x4ed17b];return _0x24b248;};'use strict';var _=require(_0x1d93('0x0'));var util=require(_0x1d93('0x1'));var logger=require(_0x1d93('0x2'))('api');var moment=require(_0x1d93('0x3'));var BPromise=require(_0x1d93('0x4'));var rp=require(_0x1d93('0x5'));var fs=require('fs');var path=require(_0x1d93('0x6'));var rimraf=require(_0x1d93('0x7'));var config=require(_0x1d93('0x8'));var attributes=require(_0x1d93('0x9'));module[_0x1d93('0xa')]=function(_0x4ab048,_0x1a4989){return _0x4ab048[_0x1d93('0xb')](_0x1d93('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 9169d40..15765a9 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 _0xa900=['../../config/logger','../../config/environment','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x572c2a,_0x2917e9){var _0x46b72f=function(_0x52e0b5){while(--_0x52e0b5){_0x572c2a['push'](_0x572c2a['shift']());}};_0x46b72f(++_0x2917e9);}(_0xa900,0x18a));var _0x0a90=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0xa900[_0x53f964];return _0x17be6c;};'use strict';var _=require(_0x0a90('0x0'));var util=require('util');var moment=require(_0x0a90('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a90('0x2'));var fs=require('fs');var Redis=require(_0x0a90('0x3'));var db=require(_0x0a90('0x4'))['db'];var utils=require(_0x0a90('0x5'));var logger=require(_0x0a90('0x6'))('rpc');var config=require(_0x0a90('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0a90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x480c89,_0xc2db4,_0x3518d9){return new BPromise(function(_0x519bd0,_0x532a90){return client['request'](_0x480c89,_0x3518d9)[_0x0a90('0x9')](function(_0x30207a){logger[_0x0a90('0xa')](_0x0a90('0xb'),_0xc2db4,_0x0a90('0xc'));logger[_0x0a90('0xd')](_0x0a90('0xe'),_0xc2db4,_0x0a90('0xc'),JSON['stringify'](_0x30207a));if(_0x30207a[_0x0a90('0xf')]){if(_0x30207a['error'][_0x0a90('0x10')]===0x1f4){logger['error'](_0x0a90('0xb'),_0xc2db4,_0x30207a[_0x0a90('0xf')][_0x0a90('0x11')]);return _0x532a90(_0x30207a[_0x0a90('0xf')][_0x0a90('0x11')]);}logger[_0x0a90('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0xc2db4,_0x30207a[_0x0a90('0xf')][_0x0a90('0x11')]);return _0x519bd0(_0x30207a['error']['message']);}else{logger[_0x0a90('0xa')](_0x0a90('0xb'),_0xc2db4,_0x0a90('0xc'));_0x519bd0(_0x30207a[_0x0a90('0x12')]['message']);}})[_0x0a90('0x13')](function(_0x20006d){logger[_0x0a90('0xf')](_0x0a90('0xb'),_0xc2db4,_0x20006d);_0x532a90(_0x20006d);});});} \ No newline at end of file +var _0x0ee4=['request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x356f73,_0x270422){var _0x11473c=function(_0x582fac){while(--_0x582fac){_0x356f73['push'](_0x356f73['shift']());}};_0x11473c(++_0x270422);}(_0x0ee4,0xcb));var _0x40ee=function(_0x4ca23a,_0x38be47){_0x4ca23a=_0x4ca23a-0x0;var _0x10cd81=_0x0ee4[_0x4ca23a];return _0x10cd81;};'use strict';var _=require(_0x40ee('0x0'));var util=require(_0x40ee('0x1'));var moment=require(_0x40ee('0x2'));var BPromise=require(_0x40ee('0x3'));var rs=require(_0x40ee('0x4'));var fs=require('fs');var Redis=require(_0x40ee('0x5'));var db=require(_0x40ee('0x6'))['db'];var utils=require(_0x40ee('0x7'));var logger=require('../../config/logger')(_0x40ee('0x8'));var config=require(_0x40ee('0x9'));var jayson=require(_0x40ee('0xa'));var client=jayson[_0x40ee('0xb')][_0x40ee('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x827b5f,_0x1889af,_0xe38578){return new BPromise(function(_0x396636,_0x43c988){return client[_0x40ee('0xd')](_0x827b5f,_0xe38578)[_0x40ee('0xe')](function(_0x1ea34d){logger[_0x40ee('0xf')](_0x40ee('0x10'),_0x1889af,_0x40ee('0x11'));logger[_0x40ee('0x12')](_0x40ee('0x13'),_0x1889af,'request\x20sent',JSON[_0x40ee('0x14')](_0x1ea34d));if(_0x1ea34d[_0x40ee('0x15')]){if(_0x1ea34d[_0x40ee('0x15')]['code']===0x1f4){logger['error'](_0x40ee('0x10'),_0x1889af,_0x1ea34d['error'][_0x40ee('0x16')]);return _0x43c988(_0x1ea34d['error']['message']);}logger[_0x40ee('0x15')](_0x40ee('0x10'),_0x1889af,_0x1ea34d[_0x40ee('0x15')]['message']);return _0x396636(_0x1ea34d[_0x40ee('0x15')][_0x40ee('0x16')]);}else{logger[_0x40ee('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1889af,_0x40ee('0x11'));_0x396636(_0x1ea34d[_0x40ee('0x17')][_0x40ee('0x16')]);}})['catch'](function(_0x126312){logger[_0x40ee('0x15')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1889af,_0x126312);_0x43c988(_0x126312);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a318790..f9b2eac 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 _0xedb9=['get','isAuthenticated','show','post','create','put','/:id','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x3b4a61,_0x125b47){var _0x2fac06=function(_0x1c99d4){while(--_0x1c99d4){_0x3b4a61['push'](_0x3b4a61['shift']());}};_0x2fac06(++_0x125b47);}(_0xedb9,0xb3));var _0x9edb=function(_0x314aff,_0xe6e8a2){_0x314aff=_0x314aff-0x0;var _0xf835e3=_0xedb9[_0x314aff];return _0xf835e3;};'use strict';var multer=require('multer');var util=require(_0x9edb('0x0'));var path=require('path');var timeout=require(_0x9edb('0x1'));var express=require(_0x9edb('0x2'));var router=express[_0x9edb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9edb('0x4'));var interaction=require(_0x9edb('0x5'));var config=require(_0x9edb('0x6'));var controller=require(_0x9edb('0x7'));router[_0x9edb('0x8')]('/',auth[_0x9edb('0x9')](),controller['index']);router[_0x9edb('0x8')]('/:id',auth[_0x9edb('0x9')](),controller[_0x9edb('0xa')]);router[_0x9edb('0xb')]('/',auth[_0x9edb('0x9')](),controller[_0x9edb('0xc')]);router[_0x9edb('0xd')](_0x9edb('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x9edb('0xf')]('/:id',auth[_0x9edb('0x9')](),controller['destroy']);module[_0x9edb('0x10')]=router; \ No newline at end of file +var _0x2758=['index','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated'];(function(_0x596818,_0x3366ac){var _0x2cd8f0=function(_0x42b8d5){while(--_0x42b8d5){_0x596818['push'](_0x596818['shift']());}};_0x2cd8f0(++_0x3366ac);}(_0x2758,0x1d4));var _0x8275=function(_0x520fac,_0x42e7a5){_0x520fac=_0x520fac-0x0;var _0xe026f3=_0x2758[_0x520fac];return _0xe026f3;};'use strict';var multer=require(_0x8275('0x0'));var util=require(_0x8275('0x1'));var path=require(_0x8275('0x2'));var timeout=require(_0x8275('0x3'));var express=require(_0x8275('0x4'));var router=express[_0x8275('0x5')]();var fs_extra=require(_0x8275('0x6'));var auth=require(_0x8275('0x7'));var interaction=require(_0x8275('0x8'));var config=require('../../config/environment');var controller=require(_0x8275('0x9'));router[_0x8275('0xa')]('/',auth[_0x8275('0xb')](),controller[_0x8275('0xc')]);router[_0x8275('0xa')](_0x8275('0xd'),auth[_0x8275('0xb')](),controller['show']);router[_0x8275('0xe')]('/',auth[_0x8275('0xb')](),controller[_0x8275('0xf')]);router[_0x8275('0x10')](_0x8275('0xd'),auth[_0x8275('0xb')](),controller[_0x8275('0x11')]);router[_0x8275('0x12')](_0x8275('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8275('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1fedd18..250f355 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 _0x4fb4=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x2de5a1,_0x19c1b4){var _0x2a9bee=function(_0x42d1bb){while(--_0x42d1bb){_0x2de5a1['push'](_0x2de5a1['shift']());}};_0x2a9bee(++_0x19c1b4);}(_0x4fb4,0x190));var _0x44fb=function(_0x2b9eeb,_0x4eb3){_0x2b9eeb=_0x2b9eeb-0x0;var _0x255bba=_0x4fb4[_0x2b9eeb];return _0x255bba;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'type':{'type':Sequelize[_0x44fb('0x1')](_0x44fb('0x2'),_0x44fb('0x3'),_0x44fb('0x4'),_0x44fb('0x5'),'picklist'),'defaultValue':_0x44fb('0x2')},'content':{'type':Sequelize[_0x44fb('0x6')]},'key':{'type':Sequelize[_0x44fb('0x6')]},'keyType':{'type':Sequelize[_0x44fb('0x1')](_0x44fb('0x2'),_0x44fb('0x3'),_0x44fb('0x4'))},'keyContent':{'type':Sequelize[_0x44fb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x44fb('0x6')]},'customField':{'type':Sequelize[_0x44fb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x687b=['sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','customVariable','BOOLEAN'];(function(_0x18d098,_0x2e5fe6){var _0x30dd6f=function(_0x2d38fa){while(--_0x2d38fa){_0x18d098['push'](_0x18d098['shift']());}};_0x30dd6f(++_0x2e5fe6);}(_0x687b,0x14a));var _0xb687=function(_0x23055f,_0x22a833){_0x23055f=_0x23055f-0x0;var _0x31bd9d=_0x687b[_0x23055f];return _0x31bd9d;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'type':{'type':Sequelize[_0xb687('0x2')](_0xb687('0x3'),'variable','customVariable',_0xb687('0x4'),_0xb687('0x5')),'defaultValue':_0xb687('0x3')},'content':{'type':Sequelize[_0xb687('0x6')]},'key':{'type':Sequelize[_0xb687('0x6')]},'keyType':{'type':Sequelize[_0xb687('0x2')](_0xb687('0x3'),_0xb687('0x7'),_0xb687('0x8'))},'keyContent':{'type':Sequelize[_0xb687('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb687('0x6')]},'customField':{'type':Sequelize[_0xb687('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0442e14..2656d62 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 _0x643d=['sort','filters','filter','where','merge','VIRTUAL','options','include','ServicenowField','rows','show','params','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x643d,0x1d2));var _0xd643=function(_0x4b19cf,_0x24be08){_0x4b19cf=_0x4b19cf-0x0;var _0x4fdb3b=_0x643d[_0x4b19cf];return _0x4fdb3b;};'use strict';var pdf=require(_0xd643('0x0'));var emlformat=require(_0xd643('0x1'));var rimraf=require(_0xd643('0x2'));var zipdir=require(_0xd643('0x3'));var jsonpatch=require(_0xd643('0x4'));var rp=require('request-promise');var moment=require(_0xd643('0x5'));var BPromise=require(_0xd643('0x6'));var Mustache=require(_0xd643('0x7'));var util=require('util');var path=require(_0xd643('0x8'));var sox=require(_0xd643('0x9'));var csv=require(_0xd643('0xa'));var ejs=require(_0xd643('0xb'));var fs=require('fs');var fs_extra=require(_0xd643('0xc'));var _=require('lodash');var squel=require(_0xd643('0xd'));var crypto=require(_0xd643('0xe'));var jsforce=require(_0xd643('0xf'));var deskjs=require(_0xd643('0x10'));var toCsv=require(_0xd643('0xa'));var querystring=require(_0xd643('0x11'));var Papa=require(_0xd643('0x12'));var Redis=require('ioredis');var authService=require(_0xd643('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd643('0x14'));var hardwareService=require(_0xd643('0x15'));var logger=require(_0xd643('0x16'))(_0xd643('0x17'));var utils=require('../../config/utils');var config=require(_0xd643('0x18'));var licenseUtil=require(_0xd643('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3caa7b,_0x3280ae){_0x3280ae=_0x3280ae||0xcc;return function(_0x2b8abe){if(_0x2b8abe){return _0x3caa7b[_0xd643('0x1a')](_0x3280ae);}return _0x3caa7b['status'](_0x3280ae)['end']();};}function respondWithResult(_0x1f9759,_0x17426f){_0x17426f=_0x17426f||0xc8;return function(_0x42769f){if(_0x42769f){return _0x1f9759[_0xd643('0x1b')](_0x17426f)[_0xd643('0x1c')](_0x42769f);}};}function respondWithFilteredResult(_0xc990bb,_0x3d352a){return function(_0x46152b){if(_0x46152b){var _0x1d67bd=_0x46152b[_0xd643('0x1d')],_0x24db18=_0x3d352a[_0xd643('0x1e')],_0x59fbc9=_0x3d352a['offset']+_0x3d352a[_0xd643('0x1f')],_0x5a9f42;if(_0x59fbc9>=_0x1d67bd){_0x59fbc9=_0x1d67bd;_0x5a9f42=0xc8;}else{_0x5a9f42=0xce;}_0xc990bb[_0xd643('0x1b')](_0x5a9f42);return _0xc990bb[_0xd643('0x20')](_0xd643('0x21'),_0x24db18+'-'+_0x59fbc9+'/'+_0x1d67bd)[_0xd643('0x1c')](_0x46152b);}return null;};}function patchUpdates(_0x343776){return function(_0x540301){try{jsonpatch[_0xd643('0x22')](_0x540301,_0x343776,!![]);}catch(_0x89cf01){return BPromise[_0xd643('0x23')](_0x89cf01);}return _0x540301['save']();};}function saveUpdates(_0x54e1ba,_0xcc11b5){return function(_0xa96675){if(_0xa96675){return _0xa96675[_0xd643('0x24')](_0x54e1ba)['then'](function(_0x30abae){return _0x30abae;});}return null;};}function removeEntity(_0x12260f,_0x4b95c3){return function(_0x9b4ca5){if(_0x9b4ca5){return _0x9b4ca5[_0xd643('0x25')]()[_0xd643('0x26')](function(){_0x12260f[_0xd643('0x1b')](0xcc)[_0xd643('0x27')]();});}};}function handleEntityNotFound(_0x45ed2e,_0x2aac3){return function(_0x911014){if(!_0x911014){_0x45ed2e['sendStatus'](0x194);}return _0x911014;};}function handleError(_0x3af767,_0x219eec){_0x219eec=_0x219eec||0x1f4;return function(_0x13c12c){logger[_0xd643('0x28')](_0x13c12c[_0xd643('0x29')]);if(_0x13c12c['name']){delete _0x13c12c[_0xd643('0x2a')];}_0x3af767[_0xd643('0x1b')](_0x219eec)[_0xd643('0x2b')](_0x13c12c);};}exports['index']=function(_0x2e498c,_0x4e6ebf){var _0x2c4167={},_0x76bb2={},_0x48a6a2={'count':0x0,'rows':[]};var _0x46b8f4=_[_0xd643('0x2c')](db['ServicenowField'][_0xd643('0x2d')],function(_0x1d7f0b){return{'name':_0x1d7f0b[_0xd643('0x2e')],'type':_0x1d7f0b[_0xd643('0x2f')][_0xd643('0x30')]};});_0x76bb2[_0xd643('0x31')]=_['map'](_0x46b8f4,'name');_0x76bb2[_0xd643('0x32')]=_[_0xd643('0x33')](_0x2e498c[_0xd643('0x32')]);_0x76bb2['filters']=_['intersection'](_0x76bb2[_0xd643('0x31')],_0x76bb2['query']);_0x2c4167[_0xd643('0x34')]=_[_0xd643('0x35')](_0x76bb2[_0xd643('0x31')],qs[_0xd643('0x36')](_0x2e498c[_0xd643('0x32')][_0xd643('0x36')]));_0x2c4167[_0xd643('0x34')]=_0x2c4167[_0xd643('0x34')][_0xd643('0x37')]?_0x2c4167[_0xd643('0x34')]:_0x76bb2[_0xd643('0x31')];if(!_0x2e498c[_0xd643('0x32')][_0xd643('0x38')](_0xd643('0x39'))){_0x2c4167[_0xd643('0x1f')]=qs[_0xd643('0x1f')](_0x2e498c[_0xd643('0x32')]['limit']);_0x2c4167['offset']=qs['offset'](_0x2e498c[_0xd643('0x32')]['offset']);}_0x2c4167[_0xd643('0x3a')]=qs[_0xd643('0x3b')](_0x2e498c['query'][_0xd643('0x3b')]);_0x2c4167['where']=qs['filters'](_['pick'](_0x2e498c[_0xd643('0x32')],_0x76bb2[_0xd643('0x3c')]),_0x46b8f4);if(_0x2e498c[_0xd643('0x32')][_0xd643('0x3d')]){_0x2c4167[_0xd643('0x3e')]=_[_0xd643('0x3f')](_0x2c4167['where'],{'$or':_[_0xd643('0x2c')](_0x46b8f4,function(_0x484059){if(_0x484059['type']!==_0xd643('0x40')){var _0x2f718a={};_0x2f718a[_0x484059[_0xd643('0x2a')]]={'$like':'%'+_0x2e498c[_0xd643('0x32')][_0xd643('0x3d')]+'%'};return _0x2f718a;}})});}_0x2c4167=_['merge']({},_0x2c4167,_0x2e498c[_0xd643('0x41')]);var _0x557a16={'where':_0x2c4167[_0xd643('0x3e')]};return db['ServicenowField'][_0xd643('0x1d')](_0x557a16)[_0xd643('0x26')](function(_0x1146ac){_0x48a6a2[_0xd643('0x1d')]=_0x1146ac;if(_0x2e498c['query']['includeAll']){_0x2c4167[_0xd643('0x42')]=[{'all':!![]}];}return db[_0xd643('0x43')]['findAll'](_0x2c4167);})[_0xd643('0x26')](function(_0x1fc8b7){_0x48a6a2[_0xd643('0x44')]=_0x1fc8b7;return _0x48a6a2;})[_0xd643('0x26')](respondWithFilteredResult(_0x4e6ebf,_0x2c4167))['catch'](handleError(_0x4e6ebf,null));};exports[_0xd643('0x45')]=function(_0x411fb5,_0x393521){var _0x3df57b={'raw':!![],'where':{'id':_0x411fb5[_0xd643('0x46')]['id']}},_0x5c63cc={};_0x5c63cc[_0xd643('0x31')]=_[_0xd643('0x33')](db[_0xd643('0x43')][_0xd643('0x2d')]);_0x5c63cc[_0xd643('0x32')]=_[_0xd643('0x33')](_0x411fb5['query']);_0x5c63cc[_0xd643('0x3c')]=_[_0xd643('0x35')](_0x5c63cc[_0xd643('0x31')],_0x5c63cc['query']);_0x3df57b[_0xd643('0x34')]=_[_0xd643('0x35')](_0x5c63cc[_0xd643('0x31')],qs[_0xd643('0x36')](_0x411fb5[_0xd643('0x32')][_0xd643('0x36')]));_0x3df57b[_0xd643('0x34')]=_0x3df57b[_0xd643('0x34')][_0xd643('0x37')]?_0x3df57b[_0xd643('0x34')]:_0x5c63cc['model'];if(_0x411fb5[_0xd643('0x32')]['includeAll']){_0x3df57b[_0xd643('0x42')]=[{'all':!![]}];}_0x3df57b=_[_0xd643('0x3f')]({},_0x3df57b,_0x411fb5[_0xd643('0x41')]);return db[_0xd643('0x43')]['find'](_0x3df57b)[_0xd643('0x26')](handleEntityNotFound(_0x393521,null))[_0xd643('0x26')](respondWithResult(_0x393521,null))[_0xd643('0x47')](handleError(_0x393521,null));};exports['create']=function(_0x1914de,_0x45e535){return db[_0xd643('0x43')][_0xd643('0x48')](_0x1914de['body'],{})[_0xd643('0x26')](respondWithResult(_0x45e535,0xc9))['catch'](handleError(_0x45e535,null));};exports[_0xd643('0x24')]=function(_0x3f5f18,_0x4d8d97){if(_0x3f5f18[_0xd643('0x49')]['id']){delete _0x3f5f18['body']['id'];}return db['ServicenowField'][_0xd643('0x4a')]({'where':{'id':_0x3f5f18[_0xd643('0x46')]['id']}})[_0xd643('0x26')](handleEntityNotFound(_0x4d8d97,null))[_0xd643('0x26')](saveUpdates(_0x3f5f18['body'],null))['then'](respondWithResult(_0x4d8d97,null))[_0xd643('0x47')](handleError(_0x4d8d97,null));};exports[_0xd643('0x25')]=function(_0x44bf85,_0x3c95af){return db[_0xd643('0x43')][_0xd643('0x4a')]({'where':{'id':_0x44bf85['params']['id']}})[_0xd643('0x26')](handleEntityNotFound(_0x3c95af,null))[_0xd643('0x26')](removeEntity(_0x3c95af,null))[_0xd643('0x47')](handleError(_0x3c95af,null));}; \ No newline at end of file +var _0xa609=['where','pick','filter','merge','include','findAll','catch','show','includeAll','options','create','body','find','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','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','json','apply','reject','update','destroy','then','name','index','map','ServicenowField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x113b1e,_0x5d7b69){var _0x57d557=function(_0x9bd1f5){while(--_0x9bd1f5){_0x113b1e['push'](_0x113b1e['shift']());}};_0x57d557(++_0x5d7b69);}(_0xa609,0x96));var _0x9a60=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa609[_0x138adb];return _0x1b27f2;};'use strict';var pdf=require(_0x9a60('0x0'));var emlformat=require(_0x9a60('0x1'));var rimraf=require(_0x9a60('0x2'));var zipdir=require(_0x9a60('0x3'));var jsonpatch=require(_0x9a60('0x4'));var rp=require(_0x9a60('0x5'));var moment=require(_0x9a60('0x6'));var BPromise=require(_0x9a60('0x7'));var Mustache=require(_0x9a60('0x8'));var util=require(_0x9a60('0x9'));var path=require(_0x9a60('0xa'));var sox=require(_0x9a60('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9a60('0xc'));var crypto=require(_0x9a60('0xd'));var jsforce=require(_0x9a60('0xe'));var deskjs=require(_0x9a60('0xf'));var toCsv=require(_0x9a60('0x10'));var querystring=require(_0x9a60('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9a60('0x12'));var qs=require(_0x9a60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a60('0x14'));var logger=require('../../config/logger')(_0x9a60('0x15'));var utils=require(_0x9a60('0x16'));var config=require(_0x9a60('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x63a99d,_0x5e5a89){_0x5e5a89=_0x5e5a89||0xcc;return function(_0x441d5c){if(_0x441d5c){return _0x63a99d[_0x9a60('0x18')](_0x5e5a89);}return _0x63a99d[_0x9a60('0x19')](_0x5e5a89)['end']();};}function respondWithResult(_0x7f71e5,_0x2788a4){_0x2788a4=_0x2788a4||0xc8;return function(_0x16bec){if(_0x16bec){return _0x7f71e5[_0x9a60('0x19')](_0x2788a4)['json'](_0x16bec);}};}function respondWithFilteredResult(_0x4a28f9,_0x313df7){return function(_0xf4c97c){if(_0xf4c97c){var _0x98d616=_0xf4c97c[_0x9a60('0x1a')],_0x13deb7=_0x313df7[_0x9a60('0x1b')],_0x22df7d=_0x313df7['offset']+_0x313df7[_0x9a60('0x1c')],_0x3c8111;if(_0x22df7d>=_0x98d616){_0x22df7d=_0x98d616;_0x3c8111=0xc8;}else{_0x3c8111=0xce;}_0x4a28f9[_0x9a60('0x19')](_0x3c8111);return _0x4a28f9[_0x9a60('0x1d')]('Content-Range',_0x13deb7+'-'+_0x22df7d+'/'+_0x98d616)[_0x9a60('0x1e')](_0xf4c97c);}return null;};}function patchUpdates(_0x202f65){return function(_0x52cad1){try{jsonpatch[_0x9a60('0x1f')](_0x52cad1,_0x202f65,!![]);}catch(_0x167226){return BPromise[_0x9a60('0x20')](_0x167226);}return _0x52cad1['save']();};}function saveUpdates(_0x11d33a,_0x18ad69){return function(_0x2c9067){if(_0x2c9067){return _0x2c9067[_0x9a60('0x21')](_0x11d33a)['then'](function(_0x4a81c7){return _0x4a81c7;});}return null;};}function removeEntity(_0x455f96,_0x3b9b07){return function(_0x5c921d){if(_0x5c921d){return _0x5c921d[_0x9a60('0x22')]()[_0x9a60('0x23')](function(){_0x455f96[_0x9a60('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a6d5e,_0x10e5f9){return function(_0x5b6abb){if(!_0x5b6abb){_0x2a6d5e[_0x9a60('0x18')](0x194);}return _0x5b6abb;};}function handleError(_0x58a771,_0x12bab5){_0x12bab5=_0x12bab5||0x1f4;return function(_0x3f795d){logger['error'](_0x3f795d['stack']);if(_0x3f795d[_0x9a60('0x24')]){delete _0x3f795d[_0x9a60('0x24')];}_0x58a771['status'](_0x12bab5)['send'](_0x3f795d);};}exports[_0x9a60('0x25')]=function(_0x179b5c,_0x2e3572){var _0x476132={},_0x5408af={},_0x2801a9={'count':0x0,'rows':[]};var _0x38dd11=_[_0x9a60('0x26')](db[_0x9a60('0x27')][_0x9a60('0x28')],function(_0x33ffa2){return{'name':_0x33ffa2['fieldName'],'type':_0x33ffa2[_0x9a60('0x29')][_0x9a60('0x2a')]};});_0x5408af[_0x9a60('0x2b')]=_[_0x9a60('0x26')](_0x38dd11,_0x9a60('0x24'));_0x5408af[_0x9a60('0x2c')]=_[_0x9a60('0x2d')](_0x179b5c[_0x9a60('0x2c')]);_0x5408af[_0x9a60('0x2e')]=_[_0x9a60('0x2f')](_0x5408af['model'],_0x5408af[_0x9a60('0x2c')]);_0x476132['attributes']=_['intersection'](_0x5408af[_0x9a60('0x2b')],qs['fields'](_0x179b5c[_0x9a60('0x2c')][_0x9a60('0x30')]));_0x476132[_0x9a60('0x31')]=_0x476132[_0x9a60('0x31')][_0x9a60('0x32')]?_0x476132[_0x9a60('0x31')]:_0x5408af[_0x9a60('0x2b')];if(!_0x179b5c['query'][_0x9a60('0x33')](_0x9a60('0x34'))){_0x476132[_0x9a60('0x1c')]=qs[_0x9a60('0x1c')](_0x179b5c['query'][_0x9a60('0x1c')]);_0x476132[_0x9a60('0x1b')]=qs[_0x9a60('0x1b')](_0x179b5c[_0x9a60('0x2c')][_0x9a60('0x1b')]);}_0x476132['order']=qs['sort'](_0x179b5c['query'][_0x9a60('0x35')]);_0x476132[_0x9a60('0x36')]=qs[_0x9a60('0x2e')](_[_0x9a60('0x37')](_0x179b5c[_0x9a60('0x2c')],_0x5408af[_0x9a60('0x2e')]),_0x38dd11);if(_0x179b5c[_0x9a60('0x2c')][_0x9a60('0x38')]){_0x476132[_0x9a60('0x36')]=_[_0x9a60('0x39')](_0x476132['where'],{'$or':_[_0x9a60('0x26')](_0x38dd11,function(_0x263b79){if(_0x263b79['type']!=='VIRTUAL'){var _0x48f529={};_0x48f529[_0x263b79[_0x9a60('0x24')]]={'$like':'%'+_0x179b5c['query'][_0x9a60('0x38')]+'%'};return _0x48f529;}})});}_0x476132=_[_0x9a60('0x39')]({},_0x476132,_0x179b5c['options']);var _0x12a2eb={'where':_0x476132[_0x9a60('0x36')]};return db[_0x9a60('0x27')]['count'](_0x12a2eb)[_0x9a60('0x23')](function(_0x2c5fd1){_0x2801a9[_0x9a60('0x1a')]=_0x2c5fd1;if(_0x179b5c[_0x9a60('0x2c')]['includeAll']){_0x476132[_0x9a60('0x3a')]=[{'all':!![]}];}return db['ServicenowField'][_0x9a60('0x3b')](_0x476132);})[_0x9a60('0x23')](function(_0x5bf4bb){_0x2801a9['rows']=_0x5bf4bb;return _0x2801a9;})[_0x9a60('0x23')](respondWithFilteredResult(_0x2e3572,_0x476132))[_0x9a60('0x3c')](handleError(_0x2e3572,null));};exports[_0x9a60('0x3d')]=function(_0x28c8fc,_0xe745f){var _0x8b5609={'raw':!![],'where':{'id':_0x28c8fc['params']['id']}},_0x2a44c5={};_0x2a44c5[_0x9a60('0x2b')]=_[_0x9a60('0x2d')](db[_0x9a60('0x27')][_0x9a60('0x28')]);_0x2a44c5['query']=_[_0x9a60('0x2d')](_0x28c8fc['query']);_0x2a44c5[_0x9a60('0x2e')]=_[_0x9a60('0x2f')](_0x2a44c5[_0x9a60('0x2b')],_0x2a44c5[_0x9a60('0x2c')]);_0x8b5609[_0x9a60('0x31')]=_[_0x9a60('0x2f')](_0x2a44c5[_0x9a60('0x2b')],qs[_0x9a60('0x30')](_0x28c8fc[_0x9a60('0x2c')][_0x9a60('0x30')]));_0x8b5609['attributes']=_0x8b5609[_0x9a60('0x31')]['length']?_0x8b5609['attributes']:_0x2a44c5[_0x9a60('0x2b')];if(_0x28c8fc[_0x9a60('0x2c')][_0x9a60('0x3e')]){_0x8b5609[_0x9a60('0x3a')]=[{'all':!![]}];}_0x8b5609=_[_0x9a60('0x39')]({},_0x8b5609,_0x28c8fc[_0x9a60('0x3f')]);return db[_0x9a60('0x27')]['find'](_0x8b5609)['then'](handleEntityNotFound(_0xe745f,null))[_0x9a60('0x23')](respondWithResult(_0xe745f,null))[_0x9a60('0x3c')](handleError(_0xe745f,null));};exports[_0x9a60('0x40')]=function(_0xdc6a4e,_0x98a21c){return db['ServicenowField'][_0x9a60('0x40')](_0xdc6a4e[_0x9a60('0x41')],{})[_0x9a60('0x23')](respondWithResult(_0x98a21c,0xc9))[_0x9a60('0x3c')](handleError(_0x98a21c,null));};exports[_0x9a60('0x21')]=function(_0xd6f607,_0x2822e3){if(_0xd6f607['body']['id']){delete _0xd6f607[_0x9a60('0x41')]['id'];}return db['ServicenowField'][_0x9a60('0x42')]({'where':{'id':_0xd6f607['params']['id']}})['then'](handleEntityNotFound(_0x2822e3,null))[_0x9a60('0x23')](saveUpdates(_0xd6f607[_0x9a60('0x41')],null))['then'](respondWithResult(_0x2822e3,null))[_0x9a60('0x3c')](handleError(_0x2822e3,null));};exports[_0x9a60('0x22')]=function(_0x31a4d5,_0x2ea2e3){return db[_0x9a60('0x27')][_0x9a60('0x42')]({'where':{'id':_0x31a4d5[_0x9a60('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ea2e3,null))[_0x9a60('0x23')](removeEntity(_0x2ea2e3,null))[_0x9a60('0x3c')](handleError(_0x2ea2e3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 48f7120..5475915 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 _0xaa98=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','idField','FieldId'];(function(_0x48924c,_0x1c7225){var _0x5affcc=function(_0x2ae409){while(--_0x2ae409){_0x48924c['push'](_0x48924c['shift']());}};_0x5affcc(++_0x1c7225);}(_0xaa98,0xdd));var _0x8aa9=function(_0x1a6a4c,_0x1488f2){_0x1a6a4c=_0x1a6a4c-0x0;var _0x1b9e0f=_0xaa98[_0x1a6a4c];return _0x1b9e0f;};'use strict';var _=require(_0x8aa9('0x0'));var util=require(_0x8aa9('0x1'));var logger=require(_0x8aa9('0x2'))('api');var moment=require(_0x8aa9('0x3'));var BPromise=require('bluebird');var rp=require(_0x8aa9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8aa9('0x5'));var config=require(_0x8aa9('0x6'));var attributes=require(_0x8aa9('0x7'));module[_0x8aa9('0x8')]=function(_0x33fee3,_0x5592c4){return _0x33fee3['define'](_0x8aa9('0x9'),attributes,{'tableName':_0x8aa9('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x8aa9('0xb'),_0x8aa9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32c2=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x3765aa,_0x904d95){var _0x136bf2=function(_0xfe928e){while(--_0xfe928e){_0x3765aa['push'](_0x3765aa['shift']());}};_0x136bf2(++_0x904d95);}(_0x32c2,0x90));var _0x232c=function(_0x2a39c4,_0x2617a8){_0x2a39c4=_0x2a39c4-0x0;var _0x49b9a3=_0x32c2[_0x2a39c4];return _0x49b9a3;};'use strict';var _=require(_0x232c('0x0'));var util=require(_0x232c('0x1'));var logger=require(_0x232c('0x2'))(_0x232c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x232c('0x4'));var rimraf=require('rimraf');var config=require(_0x232c('0x5'));var attributes=require(_0x232c('0x6'));module[_0x232c('0x7')]=function(_0xa72963,_0x15375d){return _0xa72963[_0x232c('0x8')](_0x232c('0x9'),attributes,{'tableName':_0x232c('0xa'),'paranoid':![],'indexes':[{'name':_0x232c('0xb'),'fields':[_0x232c('0xc'),_0x232c('0xd')],'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 4b7c149..7a167ae 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 _0x0a0b=['code','message','result','ServicenowField,\x20%s,\x20%s','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5672f5,_0x58b514){var _0x4bb9b0=function(_0x43ad5a){while(--_0x43ad5a){_0x5672f5['push'](_0x5672f5['shift']());}};_0x4bb9b0(++_0x58b514);}(_0x0a0b,0x158));var _0xb0a0=function(_0x5725bc,_0x1087b5){_0x5725bc=_0x5725bc-0x0;var _0x58fdf5=_0x0a0b[_0x5725bc];return _0x58fdf5;};'use strict';var _=require(_0xb0a0('0x0'));var util=require('util');var moment=require(_0xb0a0('0x1'));var BPromise=require(_0xb0a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a0('0x3'))['db'];var utils=require(_0xb0a0('0x4'));var logger=require(_0xb0a0('0x5'))(_0xb0a0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb0a0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcc307e,_0x502d2b,_0x1a3492){return new BPromise(function(_0x15877b,_0x4a2735){return client[_0xb0a0('0x8')](_0xcc307e,_0x1a3492)[_0xb0a0('0x9')](function(_0x4f8c15){logger[_0xb0a0('0xa')]('ServicenowField,\x20%s,\x20%s',_0x502d2b,_0xb0a0('0xb'));logger[_0xb0a0('0xc')](_0xb0a0('0xd'),_0x502d2b,'request\x20sent',JSON[_0xb0a0('0xe')](_0x4f8c15));if(_0x4f8c15[_0xb0a0('0xf')]){if(_0x4f8c15[_0xb0a0('0xf')][_0xb0a0('0x10')]===0x1f4){logger[_0xb0a0('0xf')]('ServicenowField,\x20%s,\x20%s',_0x502d2b,_0x4f8c15[_0xb0a0('0xf')][_0xb0a0('0x11')]);return _0x4a2735(_0x4f8c15['error']['message']);}logger[_0xb0a0('0xf')]('ServicenowField,\x20%s,\x20%s',_0x502d2b,_0x4f8c15[_0xb0a0('0xf')][_0xb0a0('0x11')]);return _0x15877b(_0x4f8c15[_0xb0a0('0xf')][_0xb0a0('0x11')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x502d2b,_0xb0a0('0xb'));_0x15877b(_0x4f8c15[_0xb0a0('0x12')][_0xb0a0('0x11')]);}})['catch'](function(_0x3f54f8){logger['error'](_0xb0a0('0x13'),_0x502d2b,_0x3f54f8);_0x4a2735(_0x3f54f8);});});} \ No newline at end of file +var _0x33d7=['stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x33d7,0x1bd));var _0x733d=function(_0x57c1af,_0x396617){_0x57c1af=_0x57c1af-0x0;var _0x26c355=_0x33d7[_0x57c1af];return _0x26c355;};'use strict';var _=require('lodash');var util=require(_0x733d('0x0'));var moment=require(_0x733d('0x1'));var BPromise=require('bluebird');var rs=require(_0x733d('0x2'));var fs=require('fs');var Redis=require(_0x733d('0x3'));var db=require(_0x733d('0x4'))['db'];var utils=require(_0x733d('0x5'));var logger=require(_0x733d('0x6'))(_0x733d('0x7'));var config=require(_0x733d('0x8'));var jayson=require(_0x733d('0x9'));var client=jayson['client'][_0x733d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92a864,_0x1bab69,_0x184f07){return new BPromise(function(_0xba7629,_0x35a73f){return client[_0x733d('0xb')](_0x92a864,_0x184f07)[_0x733d('0xc')](function(_0x2dad70){logger[_0x733d('0xd')](_0x733d('0xe'),_0x1bab69,_0x733d('0xf'));logger[_0x733d('0x10')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x1bab69,'request\x20sent',JSON[_0x733d('0x11')](_0x2dad70));if(_0x2dad70[_0x733d('0x12')]){if(_0x2dad70[_0x733d('0x12')]['code']===0x1f4){logger[_0x733d('0x12')]('ServicenowField,\x20%s,\x20%s',_0x1bab69,_0x2dad70['error']['message']);return _0x35a73f(_0x2dad70[_0x733d('0x12')][_0x733d('0x13')]);}logger[_0x733d('0x12')](_0x733d('0xe'),_0x1bab69,_0x2dad70[_0x733d('0x12')][_0x733d('0x13')]);return _0xba7629(_0x2dad70[_0x733d('0x12')][_0x733d('0x13')]);}else{logger[_0x733d('0xd')](_0x733d('0xe'),_0x1bab69,_0x733d('0xf'));_0xba7629(_0x2dad70[_0x733d('0x14')][_0x733d('0x13')]);}})[_0x733d('0x15')](function(_0xd44e30){logger[_0x733d('0x12')](_0x733d('0xe'),_0x1bab69,_0xd44e30);_0x35a73f(_0xd44e30);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ca01625..dfc251a 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 _0x407b=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','create','addConfiguration','put','update'];(function(_0x37f6eb,_0x5ea671){var _0x444aa4=function(_0x5522f7){while(--_0x5522f7){_0x37f6eb['push'](_0x37f6eb['shift']());}};_0x444aa4(++_0x5ea671);}(_0x407b,0x13b));var _0xb407=function(_0x850b13,_0x40f8e1){_0x850b13=_0x850b13-0x0;var _0x2fb2f6=_0x407b[_0x850b13];return _0x2fb2f6;};'use strict';var multer=require(_0xb407('0x0'));var util=require(_0xb407('0x1'));var path=require(_0xb407('0x2'));var timeout=require(_0xb407('0x3'));var express=require(_0xb407('0x4'));var router=express[_0xb407('0x5')]();var fs_extra=require(_0xb407('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb407('0x7'));var config=require(_0xb407('0x8'));var controller=require(_0xb407('0x9'));router[_0xb407('0xa')]('/',auth[_0xb407('0xb')](),controller['index']);router[_0xb407('0xa')](_0xb407('0xc'),auth['isAuthenticated'](),controller[_0xb407('0xd')]);router[_0xb407('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xb407('0xe'),auth['isAuthenticated'](),controller[_0xb407('0xf')]);router[_0xb407('0x10')]('/',auth[_0xb407('0xb')](),controller[_0xb407('0x11')]);router[_0xb407('0x10')]('/:id/configurations',auth[_0xb407('0xb')](),controller[_0xb407('0x12')]);router[_0xb407('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb407('0x14')]);router[_0xb407('0x15')](_0xb407('0xc'),auth['isAuthenticated'](),controller[_0xb407('0x16')]);module[_0xb407('0x17')]=router; \ No newline at end of file +var _0xe8ba=['getConfigurations','/:id/fields','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x358afa,_0x1c4f98){var _0x1b5f4f=function(_0x90e0da){while(--_0x90e0da){_0x358afa['push'](_0x358afa['shift']());}};_0x1b5f4f(++_0x1c4f98);}(_0xe8ba,0xe5));var _0xae8b=function(_0x273a71,_0x322009){_0x273a71=_0x273a71-0x0;var _0x154492=_0xe8ba[_0x273a71];return _0x154492;};'use strict';var multer=require(_0xae8b('0x0'));var util=require(_0xae8b('0x1'));var path=require(_0xae8b('0x2'));var timeout=require('connect-timeout');var express=require(_0xae8b('0x3'));var router=express['Router']();var fs_extra=require(_0xae8b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xae8b('0x5'));var config=require(_0xae8b('0x6'));var controller=require(_0xae8b('0x7'));router[_0xae8b('0x8')]('/',auth[_0xae8b('0x9')](),controller[_0xae8b('0xa')]);router[_0xae8b('0x8')](_0xae8b('0xb'),auth['isAuthenticated'](),controller[_0xae8b('0xc')]);router[_0xae8b('0x8')]('/:id/configurations',auth[_0xae8b('0x9')](),controller[_0xae8b('0xd')]);router['get'](_0xae8b('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xae8b('0xf')]);router['post'](_0xae8b('0x10'),auth[_0xae8b('0x9')](),controller[_0xae8b('0x11')]);router[_0xae8b('0x12')](_0xae8b('0xb'),auth['isAuthenticated'](),controller[_0xae8b('0x13')]);router[_0xae8b('0x14')](_0xae8b('0xb'),auth[_0xae8b('0x9')](),controller['destroy']);module[_0xae8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3b358c1..46096f6 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 _0x857a=['sequelize','STRING','username'];(function(_0x3b3750,_0x28f3b8){var _0x1b9e8b=function(_0xaf75c3){while(--_0xaf75c3){_0x3b3750['push'](_0x3b3750['shift']());}};_0x1b9e8b(++_0x28f3b8);}(_0x857a,0x168));var _0xa857=function(_0x135830,_0x2d6552){_0x135830=_0x135830-0x0;var _0x531f7b=_0x857a[_0x135830];return _0x531f7b;};'use strict';var Sequelize=require(_0xa857('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa857('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xa857('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa857('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4319=['exports','STRING','sequelize'];(function(_0x588e09,_0x271a23){var _0x381748=function(_0x24fa8f){while(--_0x24fa8f){_0x588e09['push'](_0x588e09['shift']());}};_0x381748(++_0x271a23);}(_0x4319,0xd4));var _0x9431=function(_0x181dfe,_0xf84557){_0x181dfe=_0x181dfe-0x0;var _0x40c38f=_0x4319[_0x181dfe];return _0x40c38f;};'use strict';var Sequelize=require(_0x9431('0x0'));module[_0x9431('0x1')]={'name':{'type':Sequelize[_0x9431('0x2')]},'description':{'type':Sequelize[_0x9431('0x2')]},'username':{'type':Sequelize[_0x9431('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x9431('0x2')]},'remoteUri':{'type':Sequelize[_0x9431('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x9431('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 0d63f3d..27a431c 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 _0xdbc6=['rows','catch','show','params','create','body','find','order','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','findOne','username','password','remoteUri','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','value','test','getFields,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','SugarcrmAccount','includeAll','include'];(function(_0x2f3947,_0x2ee083){var _0x3e6ab7=function(_0x4057c0){while(--_0x4057c0){_0x2f3947['push'](_0x2f3947['shift']());}};_0x3e6ab7(++_0x2ee083);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x281b45,_0x4e0034){_0x281b45=_0x281b45-0x0;var _0x5efcf5=_0xdbc6[_0x281b45];return _0x5efcf5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6dbc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6dbc('0x1'));var rp=require(_0x6dbc('0x2'));var moment=require(_0x6dbc('0x3'));var BPromise=require(_0x6dbc('0x4'));var Mustache=require(_0x6dbc('0x5'));var util=require(_0x6dbc('0x6'));var path=require('path');var sox=require(_0x6dbc('0x7'));var csv=require(_0x6dbc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6dbc('0x9'));var _=require(_0x6dbc('0xa'));var squel=require(_0x6dbc('0xb'));var crypto=require(_0x6dbc('0xc'));var jsforce=require(_0x6dbc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6dbc('0x8'));var querystring=require(_0x6dbc('0xe'));var Papa=require('papaparse');var Redis=require(_0x6dbc('0xf'));var authService=require(_0x6dbc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6dbc('0x11'));var hardwareService=require(_0x6dbc('0x12'));var logger=require(_0x6dbc('0x13'))(_0x6dbc('0x14'));var utils=require(_0x6dbc('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6dbc('0x16'))['db'];var integrations=require(_0x6dbc('0x17'));var jayson=require(_0x6dbc('0x18'));var client=jayson[_0x6dbc('0x19')][_0x6dbc('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x103e3f,_0x314a55,_0x424e52,_0x297b6a){return new BPromise(function(_0x5397af,_0x31d4ee){var _0x3fc449=_0x297b6a||client;return _0x3fc449[_0x6dbc('0x1b')](_0x103e3f,_0x424e52)[_0x6dbc('0x1c')](function(_0x25b8a8){logger[_0x6dbc('0x1d')](_0x6dbc('0x1e'),_0x314a55,_0x6dbc('0x1f'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x314a55,'request\x20sent',JSON[_0x6dbc('0x20')](_0x25b8a8));if(_0x25b8a8[_0x6dbc('0x21')]){if(_0x25b8a8[_0x6dbc('0x21')][_0x6dbc('0x22')]===0x1f4){logger[_0x6dbc('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x314a55,_0x25b8a8[_0x6dbc('0x21')][_0x6dbc('0x23')]);return _0x31d4ee(_0x25b8a8[_0x6dbc('0x21')][_0x6dbc('0x23')]);}logger[_0x6dbc('0x21')](_0x6dbc('0x1e'),_0x314a55,_0x25b8a8[_0x6dbc('0x21')][_0x6dbc('0x23')]);return _0x5397af(_0x25b8a8[_0x6dbc('0x21')][_0x6dbc('0x23')]);}else{logger[_0x6dbc('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x314a55,_0x6dbc('0x1f'));_0x5397af(_0x25b8a8[_0x6dbc('0x24')][_0x6dbc('0x23')]);}})['catch'](function(_0x1b8e84){logger['error'](_0x6dbc('0x1e'),_0x314a55,_0x1b8e84);_0x31d4ee(_0x1b8e84);});});}function respondWithStatusCode(_0x3f290e,_0x15ac30){_0x15ac30=_0x15ac30||0xcc;return function(_0x5390b9){if(_0x5390b9){return _0x3f290e[_0x6dbc('0x25')](_0x15ac30);}return _0x3f290e[_0x6dbc('0x26')](_0x15ac30)[_0x6dbc('0x27')]();};}function respondWithResult(_0x8cc556,_0xd6dd78){_0xd6dd78=_0xd6dd78||0xc8;return function(_0x3c7fdb){if(_0x3c7fdb){return _0x8cc556[_0x6dbc('0x26')](_0xd6dd78)[_0x6dbc('0x28')](_0x3c7fdb);}};}function respondWithFilteredResult(_0x4bcbfb,_0x3593ff){return function(_0xe10b16){if(_0xe10b16){var _0x455f29=_0xe10b16[_0x6dbc('0x29')],_0x8a24fd=_0x3593ff[_0x6dbc('0x2a')],_0x19e43e=_0x3593ff[_0x6dbc('0x2a')]+_0x3593ff['limit'],_0x224533;if(_0x19e43e>=_0x455f29){_0x19e43e=_0x455f29;_0x224533=0xc8;}else{_0x224533=0xce;}_0x4bcbfb[_0x6dbc('0x26')](_0x224533);return _0x4bcbfb[_0x6dbc('0x2b')](_0x6dbc('0x2c'),_0x8a24fd+'-'+_0x19e43e+'/'+_0x455f29)[_0x6dbc('0x28')](_0xe10b16);}return null;};}function patchUpdates(_0x564920){return function(_0x491a19){try{jsonpatch[_0x6dbc('0x2d')](_0x491a19,_0x564920,!![]);}catch(_0x30cefd){return BPromise[_0x6dbc('0x2e')](_0x30cefd);}return _0x491a19[_0x6dbc('0x2f')]();};}function saveUpdates(_0x2b706a,_0x791561){return function(_0x5df85d){if(_0x5df85d){return _0x5df85d[_0x6dbc('0x30')](_0x2b706a)[_0x6dbc('0x1c')](function(_0xa51e45){return _0xa51e45;});}return null;};}function removeEntity(_0x423626,_0xda388a){return function(_0x46c626){if(_0x46c626){return _0x46c626[_0x6dbc('0x31')]()[_0x6dbc('0x1c')](function(){_0x423626[_0x6dbc('0x26')](0xcc)[_0x6dbc('0x27')]();});}};}function handleEntityNotFound(_0xfe49e7,_0x30f399){return function(_0x3be925){if(!_0x3be925){_0xfe49e7[_0x6dbc('0x25')](0x194);}return _0x3be925;};}function handleError(_0x2c3928,_0x34a8c4){_0x34a8c4=_0x34a8c4||0x1f4;return function(_0x3b951c){logger[_0x6dbc('0x21')](_0x3b951c[_0x6dbc('0x32')]);if(_0x3b951c[_0x6dbc('0x33')]){delete _0x3b951c[_0x6dbc('0x33')];}_0x2c3928[_0x6dbc('0x26')](_0x34a8c4)[_0x6dbc('0x34')](_0x3b951c);};}exports[_0x6dbc('0x35')]=function(_0xb1cbdc,_0x1bb22b){var _0x57e7a3={},_0x5589cc={},_0x32ae2e={'count':0x0,'rows':[]};var _0x3230c6=_[_0x6dbc('0x36')](db['SugarcrmAccount'][_0x6dbc('0x37')],function(_0x517081){return{'name':_0x517081['fieldName'],'type':_0x517081[_0x6dbc('0x38')][_0x6dbc('0x39')]};});_0x5589cc['model']=_[_0x6dbc('0x36')](_0x3230c6,_0x6dbc('0x33'));_0x5589cc[_0x6dbc('0x3a')]=_[_0x6dbc('0x3b')](_0xb1cbdc[_0x6dbc('0x3a')]);_0x5589cc['filters']=_[_0x6dbc('0x3c')](_0x5589cc['model'],_0x5589cc[_0x6dbc('0x3a')]);_0x57e7a3[_0x6dbc('0x3d')]=_['intersection'](_0x5589cc[_0x6dbc('0x3e')],qs[_0x6dbc('0x3f')](_0xb1cbdc[_0x6dbc('0x3a')][_0x6dbc('0x3f')]));_0x57e7a3[_0x6dbc('0x3d')]=_0x57e7a3['attributes'][_0x6dbc('0x40')]?_0x57e7a3['attributes']:_0x5589cc['model'];if(!_0xb1cbdc['query'][_0x6dbc('0x41')](_0x6dbc('0x42'))){_0x57e7a3[_0x6dbc('0x43')]=qs[_0x6dbc('0x43')](_0xb1cbdc[_0x6dbc('0x3a')][_0x6dbc('0x43')]);_0x57e7a3[_0x6dbc('0x2a')]=qs[_0x6dbc('0x2a')](_0xb1cbdc[_0x6dbc('0x3a')][_0x6dbc('0x2a')]);}_0x57e7a3['order']=qs[_0x6dbc('0x44')](_0xb1cbdc[_0x6dbc('0x3a')]['sort']);_0x57e7a3[_0x6dbc('0x45')]=qs[_0x6dbc('0x46')](_[_0x6dbc('0x47')](_0xb1cbdc[_0x6dbc('0x3a')],_0x5589cc[_0x6dbc('0x46')]),_0x3230c6);if(_0xb1cbdc['query'][_0x6dbc('0x48')]){_0x57e7a3[_0x6dbc('0x45')]=_[_0x6dbc('0x49')](_0x57e7a3[_0x6dbc('0x45')],{'$or':_[_0x6dbc('0x36')](_0x3230c6,function(_0x2dcbf0){if(_0x2dcbf0[_0x6dbc('0x38')]!=='VIRTUAL'){var _0x3b5c30={};_0x3b5c30[_0x2dcbf0['name']]={'$like':'%'+_0xb1cbdc[_0x6dbc('0x3a')][_0x6dbc('0x48')]+'%'};return _0x3b5c30;}})});}_0x57e7a3=_[_0x6dbc('0x49')]({},_0x57e7a3,_0xb1cbdc[_0x6dbc('0x4a')]);var _0x1d998a={'where':_0x57e7a3[_0x6dbc('0x45')]};return db[_0x6dbc('0x4b')][_0x6dbc('0x29')](_0x1d998a)[_0x6dbc('0x1c')](function(_0x5ef4e4){_0x32ae2e[_0x6dbc('0x29')]=_0x5ef4e4;if(_0xb1cbdc[_0x6dbc('0x3a')][_0x6dbc('0x4c')]){_0x57e7a3[_0x6dbc('0x4d')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x57e7a3);})[_0x6dbc('0x1c')](function(_0x4fc9b9){_0x32ae2e[_0x6dbc('0x4e')]=_0x4fc9b9;return _0x32ae2e;})[_0x6dbc('0x1c')](respondWithFilteredResult(_0x1bb22b,_0x57e7a3))[_0x6dbc('0x4f')](handleError(_0x1bb22b,null));};exports[_0x6dbc('0x50')]=function(_0x2b3c97,_0x4efc7a){var _0x2ae1b2={'raw':![],'where':{'id':_0x2b3c97[_0x6dbc('0x51')]['id']}},_0x42aab8={};_0x42aab8['model']=_[_0x6dbc('0x3b')](db[_0x6dbc('0x4b')]['rawAttributes']);_0x42aab8[_0x6dbc('0x3a')]=_[_0x6dbc('0x3b')](_0x2b3c97[_0x6dbc('0x3a')]);_0x42aab8['filters']=_['intersection'](_0x42aab8['model'],_0x42aab8['query']);_0x2ae1b2[_0x6dbc('0x3d')]=_[_0x6dbc('0x3c')](_0x42aab8[_0x6dbc('0x3e')],qs['fields'](_0x2b3c97[_0x6dbc('0x3a')][_0x6dbc('0x3f')]));_0x2ae1b2[_0x6dbc('0x3d')]=_0x2ae1b2['attributes']['length']?_0x2ae1b2[_0x6dbc('0x3d')]:_0x42aab8[_0x6dbc('0x3e')];if(_0x2b3c97[_0x6dbc('0x3a')][_0x6dbc('0x4c')]){_0x2ae1b2[_0x6dbc('0x4d')]=[{'all':!![]}];}_0x2ae1b2=_['merge']({},_0x2ae1b2,_0x2b3c97[_0x6dbc('0x4a')]);return db[_0x6dbc('0x4b')]['find'](_0x2ae1b2)[_0x6dbc('0x1c')](handleEntityNotFound(_0x4efc7a,null))[_0x6dbc('0x1c')](respondWithResult(_0x4efc7a,null))['catch'](handleError(_0x4efc7a,null));};exports[_0x6dbc('0x52')]=function(_0x3045a1,_0x57428a){return db[_0x6dbc('0x4b')][_0x6dbc('0x52')](_0x3045a1[_0x6dbc('0x53')],{})[_0x6dbc('0x1c')](respondWithResult(_0x57428a,0xc9))[_0x6dbc('0x4f')](handleError(_0x57428a,null));};exports['update']=function(_0x1b17fb,_0x5d0a8b){if(_0x1b17fb[_0x6dbc('0x53')]['id']){delete _0x1b17fb[_0x6dbc('0x53')]['id'];}return db[_0x6dbc('0x4b')][_0x6dbc('0x54')]({'where':{'id':_0x1b17fb[_0x6dbc('0x51')]['id']}})[_0x6dbc('0x1c')](handleEntityNotFound(_0x5d0a8b,null))[_0x6dbc('0x1c')](saveUpdates(_0x1b17fb['body'],null))[_0x6dbc('0x1c')](respondWithResult(_0x5d0a8b,null))[_0x6dbc('0x4f')](handleError(_0x5d0a8b,null));};exports[_0x6dbc('0x31')]=function(_0x24d851,_0x45dcbf){return db[_0x6dbc('0x4b')][_0x6dbc('0x54')]({'where':{'id':_0x24d851['params']['id']}})[_0x6dbc('0x1c')](handleEntityNotFound(_0x45dcbf,null))[_0x6dbc('0x1c')](removeEntity(_0x45dcbf,null))['catch'](handleError(_0x45dcbf,null));};exports['getConfigurations']=function(_0xca0fff,_0x5a812d,_0x45dc8f){var _0x13e1b7={};var _0x510f47={};var _0xbb5629;var _0x1dd723;return db[_0x6dbc('0x4b')]['findOne']({'where':{'id':_0xca0fff[_0x6dbc('0x51')]['id']}})[_0x6dbc('0x1c')](handleEntityNotFound(_0x5a812d,null))[_0x6dbc('0x1c')](function(_0x257787){if(_0x257787){_0xbb5629=_0x257787;_0x510f47['model']=_[_0x6dbc('0x3b')](db['SugarcrmConfiguration'][_0x6dbc('0x37')]);_0x510f47[_0x6dbc('0x3a')]=_[_0x6dbc('0x3b')](_0xca0fff[_0x6dbc('0x3a')]);_0x510f47[_0x6dbc('0x46')]=_[_0x6dbc('0x3c')](_0x510f47[_0x6dbc('0x3e')],_0x510f47[_0x6dbc('0x3a')]);_0x13e1b7[_0x6dbc('0x3d')]=_[_0x6dbc('0x3c')](_0x510f47['model'],qs[_0x6dbc('0x3f')](_0xca0fff[_0x6dbc('0x3a')][_0x6dbc('0x3f')]));_0x13e1b7[_0x6dbc('0x3d')]=_0x13e1b7[_0x6dbc('0x3d')][_0x6dbc('0x40')]?_0x13e1b7[_0x6dbc('0x3d')]:_0x510f47[_0x6dbc('0x3e')];_0x13e1b7[_0x6dbc('0x55')]=qs[_0x6dbc('0x44')](_0xca0fff[_0x6dbc('0x3a')][_0x6dbc('0x44')]);_0x13e1b7[_0x6dbc('0x45')]=qs['filters'](_[_0x6dbc('0x47')](_0xca0fff[_0x6dbc('0x3a')],_0x510f47[_0x6dbc('0x46')]));if(_0xca0fff['query'][_0x6dbc('0x48')]){_0x13e1b7[_0x6dbc('0x45')]=_[_0x6dbc('0x49')](_0x13e1b7[_0x6dbc('0x45')],{'$or':_[_0x6dbc('0x36')](_0x13e1b7[_0x6dbc('0x3d')],function(_0x371cff){var _0x4f3d44={};_0x4f3d44[_0x371cff]={'$like':'%'+_0xca0fff['query'][_0x6dbc('0x48')]+'%'};return _0x4f3d44;})});}_0x13e1b7=_['merge']({},_0x13e1b7,_0xca0fff['options']);return _0xbb5629[_0x6dbc('0x56')](_0x13e1b7);}})['then'](function(_0x2c9d3c){if(_0x2c9d3c){_0x1dd723=_0x2c9d3c[_0x6dbc('0x40')];if(!_0xca0fff[_0x6dbc('0x3a')][_0x6dbc('0x41')](_0x6dbc('0x42'))){_0x13e1b7[_0x6dbc('0x43')]=qs[_0x6dbc('0x43')](_0xca0fff['query'][_0x6dbc('0x43')]);_0x13e1b7[_0x6dbc('0x2a')]=qs['offset'](_0xca0fff['query'][_0x6dbc('0x2a')]);}return _0xbb5629[_0x6dbc('0x56')](_0x13e1b7);}})['then'](function(_0x4d0743){if(_0x4d0743){return _0x4d0743?{'count':_0x1dd723,'rows':_0x4d0743}:null;}})[_0x6dbc('0x1c')](respondWithResult(_0x5a812d,null))[_0x6dbc('0x4f')](handleError(_0x5a812d,null));};exports[_0x6dbc('0x57')]=function(_0x398f6e,_0x43d26e,_0x4c3f50){if(_0x398f6e[_0x6dbc('0x53')]['id']){delete _0x398f6e['body']['id'];}return db[_0x6dbc('0x4b')]['findOne']({'where':{'id':_0x398f6e[_0x6dbc('0x51')]['id']}})[_0x6dbc('0x1c')](handleEntityNotFound(_0x43d26e,null))[_0x6dbc('0x1c')](function(_0x5b767c){if(_0x5b767c){_0x398f6e[_0x6dbc('0x53')][_0x6dbc('0x58')]=_0x5b767c['id'];_0x398f6e['body']['Subjects']=integrations[_0x6dbc('0x59')](_0x398f6e[_0x6dbc('0x53')]['channel'],_0x398f6e[_0x6dbc('0x53')][_0x6dbc('0x38')]);_0x398f6e[_0x6dbc('0x53')][_0x6dbc('0x5a')]=integrations[_0x6dbc('0x5b')](_0x398f6e[_0x6dbc('0x53')][_0x6dbc('0x5c')],_0x398f6e[_0x6dbc('0x53')][_0x6dbc('0x38')]);return db['SugarcrmConfiguration'][_0x6dbc('0x52')](_0x398f6e[_0x6dbc('0x53')],{'include':[{'model':db[_0x6dbc('0x5d')],'as':_0x6dbc('0x5e')},{'model':db[_0x6dbc('0x5d')],'as':_0x6dbc('0x5a')}]});}return null;})[_0x6dbc('0x1c')](respondWithResult(_0x43d26e,null))[_0x6dbc('0x4f')](handleError(_0x43d26e,null));};exports[_0x6dbc('0x5f')]=function(_0x231dc2,_0x57de7d,_0x39e7a0){var _0xa7e803='';var _0x54b710=['id',_0x6dbc('0x33'),_0x6dbc('0x60'),_0x6dbc('0x61'),_0x6dbc('0x62'),_0x6dbc('0x63'),_0x6dbc('0x64'),_0x6dbc('0x65'),'parent_id',_0x6dbc('0x66'),_0x6dbc('0x67'),_0x6dbc('0x68')];return db['SugarcrmAccount'][_0x6dbc('0x69')]({'where':{'id':_0x231dc2[_0x6dbc('0x51')]['id']},'attributes':['id',_0x6dbc('0x6a'),_0x6dbc('0x6b'),_0x6dbc('0x6c')]})[_0x6dbc('0x1c')](handleEntityNotFound(_0x57de7d,null))[_0x6dbc('0x1c')](function(_0x233ee8){if(_0x233ee8){_0xa7e803=_0x233ee8['remoteUri'];var _0x59d5c7=_0xa7e803['slice'](-0x1);if(_0x59d5c7==='/'){_0xa7e803=_0xa7e803[_0x6dbc('0x6d')](0x0,_0xa7e803[_0x6dbc('0x6e')](_0x59d5c7));}return rp({'method':'POST','uri':util[_0x6dbc('0x6f')](_0x6dbc('0x70'),_0xa7e803,_0x6dbc('0x71')),'json':!![],'form':{'method':_0x6dbc('0x72'),'input_type':_0x6dbc('0x73'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x233ee8[_0x6dbc('0x6a')],'password':_0x233ee8[_0x6dbc('0x6b')],'encryption':_0x6dbc('0x74')},'application':_0x6dbc('0x75')})}});}})[_0x6dbc('0x1c')](function(_0x4be16b){if(_0x4be16b&&_0x4be16b[_0x6dbc('0x33')]!==_0x6dbc('0x76')&&_0x4be16b[_0x6dbc('0x33')]!==_0x6dbc('0x77')){return rp({'method':'POST','uri':util[_0x6dbc('0x6f')](_0x6dbc('0x70'),_0xa7e803,_0x6dbc('0x71')),'json':!![],'form':{'method':_0x6dbc('0x78'),'input_type':'JSON','response_type':_0x6dbc('0x73'),'rest_data':JSON[_0x6dbc('0x20')]({'session':_0x4be16b['id'],'module_name':_0x6dbc('0x79')})}})[_0x6dbc('0x1c')](function(_0x4dea5f){if(_0x4dea5f){var _0x5f5903=_['values'](_0x4dea5f[_0x6dbc('0x7a')]);_[_0x6dbc('0x7b')](_0x5f5903,function(_0x49f75d){return _0x54b710[_0x6dbc('0x7c')](_0x49f75d['name']);});return{'count':_0x5f5903[_0x6dbc('0x40')],'rows':_[_0x6dbc('0x36')](_0x5f5903,function(_0x1d55d4){return{'id':_0x1d55d4['name'],'name':_0x1d55d4[_0x6dbc('0x7d')],'custom':_[_0x6dbc('0x7e')](_0x1d55d4['name'],'_c')?!![]:![],'options':_0x1d55d4['options']?_[_0x6dbc('0x36')](_[_0x6dbc('0x7f')](_0x1d55d4[_0x6dbc('0x4a')]),function(_0x118b97){return{'name':_0x118b97[_0x6dbc('0x80')],'value':_0x118b97[_0x6dbc('0x33')]};}):[]};})};}})[_0x6dbc('0x1c')](respondWithResult(_0x57de7d,null))[_0x6dbc('0x4f')](function(_0x379f6e){var _0x3086ef=_0x231dc2[_0x6dbc('0x3a')][_0x6dbc('0x81')]?0x1f4:_0x379f6e['statusCode']||0x1f4;logger[_0x6dbc('0x21')](_0x6dbc('0x82'),_0x6dbc('0x5f'),_0x3086ef,JSON[_0x6dbc('0x20')](_0x379f6e));delete _0x379f6e['name'];if(_0x3086ef===0x191){_0x3086ef=0x190;}_0x57de7d[_0x6dbc('0x26')](_0x3086ef)['send'](_0x231dc2['query'][_0x6dbc('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x379f6e['statusCode']}:_0x379f6e);});}else{var _0x2f5718=0x1f4;_0x57de7d[_0x6dbc('0x26')](_0x2f5718)[_0x6dbc('0x34')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x9a86=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','SugarcrmAccount','includeAll','include','findAll','rows','params','options','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','created_by','description','date_start','duration_minutes','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','values','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir'];(function(_0x38bc63,_0x2e0eed){var _0x3d8442=function(_0x344191){while(--_0x344191){_0x38bc63['push'](_0x38bc63['shift']());}};_0x3d8442(++_0x2e0eed);}(_0x9a86,0x1ed));var _0x69a8=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x9a86[_0x5d80de];return _0x1c7556;};'use strict';var pdf=require(_0x69a8('0x0'));var emlformat=require(_0x69a8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x69a8('0x2'));var jsonpatch=require(_0x69a8('0x3'));var rp=require(_0x69a8('0x4'));var moment=require(_0x69a8('0x5'));var BPromise=require(_0x69a8('0x6'));var Mustache=require(_0x69a8('0x7'));var util=require(_0x69a8('0x8'));var path=require(_0x69a8('0x9'));var sox=require(_0x69a8('0xa'));var csv=require(_0x69a8('0xb'));var ejs=require(_0x69a8('0xc'));var fs=require('fs');var fs_extra=require(_0x69a8('0xd'));var _=require(_0x69a8('0xe'));var squel=require(_0x69a8('0xf'));var crypto=require(_0x69a8('0x10'));var jsforce=require(_0x69a8('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x69a8('0xb'));var querystring=require(_0x69a8('0x12'));var Papa=require('papaparse');var Redis=require(_0x69a8('0x13'));var authService=require(_0x69a8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69a8('0x15'));var logger=require(_0x69a8('0x16'))(_0x69a8('0x17'));var utils=require(_0x69a8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69a8('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x69a8('0x1a'));var client=jayson[_0x69a8('0x1b')][_0x69a8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x12b148,_0x272100,_0x524b28,_0x463937){return new BPromise(function(_0x4fb021,_0x381a2a){var _0x10c6c8=_0x463937||client;return _0x10c6c8['request'](_0x12b148,_0x524b28)[_0x69a8('0x1d')](function(_0x264347){logger[_0x69a8('0x1e')](_0x69a8('0x1f'),_0x272100,_0x69a8('0x20'));logger[_0x69a8('0x21')](_0x69a8('0x22'),_0x272100,_0x69a8('0x20'),JSON[_0x69a8('0x23')](_0x264347));if(_0x264347[_0x69a8('0x24')]){if(_0x264347[_0x69a8('0x24')]['code']===0x1f4){logger[_0x69a8('0x24')](_0x69a8('0x1f'),_0x272100,_0x264347[_0x69a8('0x24')]['message']);return _0x381a2a(_0x264347[_0x69a8('0x24')]['message']);}logger[_0x69a8('0x24')](_0x69a8('0x1f'),_0x272100,_0x264347[_0x69a8('0x24')][_0x69a8('0x25')]);return _0x4fb021(_0x264347[_0x69a8('0x24')][_0x69a8('0x25')]);}else{logger[_0x69a8('0x1e')](_0x69a8('0x1f'),_0x272100,_0x69a8('0x20'));_0x4fb021(_0x264347[_0x69a8('0x26')][_0x69a8('0x25')]);}})[_0x69a8('0x27')](function(_0x33e39c){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x272100,_0x33e39c);_0x381a2a(_0x33e39c);});});}function respondWithStatusCode(_0x2381bf,_0x55e45a){_0x55e45a=_0x55e45a||0xcc;return function(_0xca3c4b){if(_0xca3c4b){return _0x2381bf[_0x69a8('0x28')](_0x55e45a);}return _0x2381bf[_0x69a8('0x29')](_0x55e45a)[_0x69a8('0x2a')]();};}function respondWithResult(_0x352087,_0x1f1baa){_0x1f1baa=_0x1f1baa||0xc8;return function(_0x21412d){if(_0x21412d){return _0x352087[_0x69a8('0x29')](_0x1f1baa)[_0x69a8('0x2b')](_0x21412d);}};}function respondWithFilteredResult(_0x1c9588,_0x7aad77){return function(_0x21e789){if(_0x21e789){var _0x3d0754=_0x21e789[_0x69a8('0x2c')],_0xb61a04=_0x7aad77[_0x69a8('0x2d')],_0x2244c7=_0x7aad77[_0x69a8('0x2d')]+_0x7aad77[_0x69a8('0x2e')],_0x277764;if(_0x2244c7>=_0x3d0754){_0x2244c7=_0x3d0754;_0x277764=0xc8;}else{_0x277764=0xce;}_0x1c9588[_0x69a8('0x29')](_0x277764);return _0x1c9588['set'](_0x69a8('0x2f'),_0xb61a04+'-'+_0x2244c7+'/'+_0x3d0754)[_0x69a8('0x2b')](_0x21e789);}return null;};}function patchUpdates(_0x4f0293){return function(_0x2e7355){try{jsonpatch['apply'](_0x2e7355,_0x4f0293,!![]);}catch(_0x111167){return BPromise[_0x69a8('0x30')](_0x111167);}return _0x2e7355['save']();};}function saveUpdates(_0x51a25e,_0x11c7aa){return function(_0x2dbdb0){if(_0x2dbdb0){return _0x2dbdb0['update'](_0x51a25e)[_0x69a8('0x1d')](function(_0x4fd0ee){return _0x4fd0ee;});}return null;};}function removeEntity(_0x3fc8a9,_0x19a271){return function(_0x5b1cbc){if(_0x5b1cbc){return _0x5b1cbc['destroy']()[_0x69a8('0x1d')](function(){_0x3fc8a9[_0x69a8('0x29')](0xcc)[_0x69a8('0x2a')]();});}};}function handleEntityNotFound(_0x48378a,_0x143341){return function(_0x4c8279){if(!_0x4c8279){_0x48378a[_0x69a8('0x28')](0x194);}return _0x4c8279;};}function handleError(_0x2d3fd8,_0x1b8568){_0x1b8568=_0x1b8568||0x1f4;return function(_0x5b93ec){logger['error'](_0x5b93ec[_0x69a8('0x31')]);if(_0x5b93ec[_0x69a8('0x32')]){delete _0x5b93ec[_0x69a8('0x32')];}_0x2d3fd8[_0x69a8('0x29')](_0x1b8568)[_0x69a8('0x33')](_0x5b93ec);};}exports['index']=function(_0x5c3673,_0xdf049a){var _0x5a1bbc={},_0x51f130={},_0x2ec582={'count':0x0,'rows':[]};var _0x4eaf2f=_[_0x69a8('0x34')](db['SugarcrmAccount'][_0x69a8('0x35')],function(_0x1273be){return{'name':_0x1273be[_0x69a8('0x36')],'type':_0x1273be[_0x69a8('0x37')][_0x69a8('0x38')]};});_0x51f130[_0x69a8('0x39')]=_['map'](_0x4eaf2f,_0x69a8('0x32'));_0x51f130[_0x69a8('0x3a')]=_[_0x69a8('0x3b')](_0x5c3673[_0x69a8('0x3a')]);_0x51f130[_0x69a8('0x3c')]=_[_0x69a8('0x3d')](_0x51f130[_0x69a8('0x39')],_0x51f130[_0x69a8('0x3a')]);_0x5a1bbc[_0x69a8('0x3e')]=_[_0x69a8('0x3d')](_0x51f130['model'],qs[_0x69a8('0x3f')](_0x5c3673[_0x69a8('0x3a')][_0x69a8('0x3f')]));_0x5a1bbc[_0x69a8('0x3e')]=_0x5a1bbc['attributes'][_0x69a8('0x40')]?_0x5a1bbc['attributes']:_0x51f130[_0x69a8('0x39')];if(!_0x5c3673['query'][_0x69a8('0x41')](_0x69a8('0x42'))){_0x5a1bbc[_0x69a8('0x2e')]=qs[_0x69a8('0x2e')](_0x5c3673[_0x69a8('0x3a')][_0x69a8('0x2e')]);_0x5a1bbc[_0x69a8('0x2d')]=qs[_0x69a8('0x2d')](_0x5c3673['query']['offset']);}_0x5a1bbc[_0x69a8('0x43')]=qs[_0x69a8('0x44')](_0x5c3673[_0x69a8('0x3a')]['sort']);_0x5a1bbc[_0x69a8('0x45')]=qs[_0x69a8('0x3c')](_['pick'](_0x5c3673[_0x69a8('0x3a')],_0x51f130['filters']),_0x4eaf2f);if(_0x5c3673[_0x69a8('0x3a')][_0x69a8('0x46')]){_0x5a1bbc[_0x69a8('0x45')]=_[_0x69a8('0x47')](_0x5a1bbc[_0x69a8('0x45')],{'$or':_[_0x69a8('0x34')](_0x4eaf2f,function(_0x5e283d){if(_0x5e283d['type']!=='VIRTUAL'){var _0x518c9b={};_0x518c9b[_0x5e283d[_0x69a8('0x32')]]={'$like':'%'+_0x5c3673[_0x69a8('0x3a')][_0x69a8('0x46')]+'%'};return _0x518c9b;}})});}_0x5a1bbc=_[_0x69a8('0x47')]({},_0x5a1bbc,_0x5c3673['options']);var _0x2480ca={'where':_0x5a1bbc['where']};return db[_0x69a8('0x48')][_0x69a8('0x2c')](_0x2480ca)[_0x69a8('0x1d')](function(_0x13741d){_0x2ec582[_0x69a8('0x2c')]=_0x13741d;if(_0x5c3673[_0x69a8('0x3a')][_0x69a8('0x49')]){_0x5a1bbc[_0x69a8('0x4a')]=[{'all':!![]}];}return db[_0x69a8('0x48')][_0x69a8('0x4b')](_0x5a1bbc);})[_0x69a8('0x1d')](function(_0x4f3231){_0x2ec582[_0x69a8('0x4c')]=_0x4f3231;return _0x2ec582;})[_0x69a8('0x1d')](respondWithFilteredResult(_0xdf049a,_0x5a1bbc))[_0x69a8('0x27')](handleError(_0xdf049a,null));};exports['show']=function(_0x46ca7d,_0x29de1c){var _0x4c1a1a={'raw':![],'where':{'id':_0x46ca7d[_0x69a8('0x4d')]['id']}},_0x481394={};_0x481394[_0x69a8('0x39')]=_['keys'](db[_0x69a8('0x48')][_0x69a8('0x35')]);_0x481394[_0x69a8('0x3a')]=_[_0x69a8('0x3b')](_0x46ca7d['query']);_0x481394['filters']=_[_0x69a8('0x3d')](_0x481394['model'],_0x481394[_0x69a8('0x3a')]);_0x4c1a1a['attributes']=_['intersection'](_0x481394[_0x69a8('0x39')],qs[_0x69a8('0x3f')](_0x46ca7d[_0x69a8('0x3a')][_0x69a8('0x3f')]));_0x4c1a1a['attributes']=_0x4c1a1a[_0x69a8('0x3e')][_0x69a8('0x40')]?_0x4c1a1a[_0x69a8('0x3e')]:_0x481394[_0x69a8('0x39')];if(_0x46ca7d[_0x69a8('0x3a')]['includeAll']){_0x4c1a1a[_0x69a8('0x4a')]=[{'all':!![]}];}_0x4c1a1a=_[_0x69a8('0x47')]({},_0x4c1a1a,_0x46ca7d[_0x69a8('0x4e')]);return db['SugarcrmAccount'][_0x69a8('0x4f')](_0x4c1a1a)[_0x69a8('0x1d')](handleEntityNotFound(_0x29de1c,null))[_0x69a8('0x1d')](respondWithResult(_0x29de1c,null))['catch'](handleError(_0x29de1c,null));};exports[_0x69a8('0x50')]=function(_0x3529d1,_0x1484a2){return db[_0x69a8('0x48')]['create'](_0x3529d1[_0x69a8('0x51')],{})[_0x69a8('0x1d')](respondWithResult(_0x1484a2,0xc9))[_0x69a8('0x27')](handleError(_0x1484a2,null));};exports[_0x69a8('0x52')]=function(_0x183d98,_0x520506){if(_0x183d98[_0x69a8('0x51')]['id']){delete _0x183d98[_0x69a8('0x51')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x183d98[_0x69a8('0x4d')]['id']}})[_0x69a8('0x1d')](handleEntityNotFound(_0x520506,null))[_0x69a8('0x1d')](saveUpdates(_0x183d98[_0x69a8('0x51')],null))[_0x69a8('0x1d')](respondWithResult(_0x520506,null))['catch'](handleError(_0x520506,null));};exports['destroy']=function(_0x4ab9ef,_0xce9ef0){return db[_0x69a8('0x48')][_0x69a8('0x4f')]({'where':{'id':_0x4ab9ef[_0x69a8('0x4d')]['id']}})[_0x69a8('0x1d')](handleEntityNotFound(_0xce9ef0,null))['then'](removeEntity(_0xce9ef0,null))['catch'](handleError(_0xce9ef0,null));};exports[_0x69a8('0x53')]=function(_0x286eea,_0x357e02,_0x2a06fe){var _0x4f1bbc={};var _0x1d8dda={};var _0x9c7438;var _0x387703;return db['SugarcrmAccount'][_0x69a8('0x54')]({'where':{'id':_0x286eea[_0x69a8('0x4d')]['id']}})[_0x69a8('0x1d')](handleEntityNotFound(_0x357e02,null))[_0x69a8('0x1d')](function(_0x3d6484){if(_0x3d6484){_0x9c7438=_0x3d6484;_0x1d8dda[_0x69a8('0x39')]=_['keys'](db[_0x69a8('0x55')][_0x69a8('0x35')]);_0x1d8dda[_0x69a8('0x3a')]=_[_0x69a8('0x3b')](_0x286eea[_0x69a8('0x3a')]);_0x1d8dda[_0x69a8('0x3c')]=_[_0x69a8('0x3d')](_0x1d8dda[_0x69a8('0x39')],_0x1d8dda[_0x69a8('0x3a')]);_0x4f1bbc[_0x69a8('0x3e')]=_[_0x69a8('0x3d')](_0x1d8dda[_0x69a8('0x39')],qs[_0x69a8('0x3f')](_0x286eea[_0x69a8('0x3a')][_0x69a8('0x3f')]));_0x4f1bbc[_0x69a8('0x3e')]=_0x4f1bbc['attributes'][_0x69a8('0x40')]?_0x4f1bbc['attributes']:_0x1d8dda[_0x69a8('0x39')];_0x4f1bbc[_0x69a8('0x43')]=qs[_0x69a8('0x44')](_0x286eea[_0x69a8('0x3a')][_0x69a8('0x44')]);_0x4f1bbc[_0x69a8('0x45')]=qs['filters'](_['pick'](_0x286eea['query'],_0x1d8dda[_0x69a8('0x3c')]));if(_0x286eea[_0x69a8('0x3a')][_0x69a8('0x46')]){_0x4f1bbc[_0x69a8('0x45')]=_['merge'](_0x4f1bbc[_0x69a8('0x45')],{'$or':_[_0x69a8('0x34')](_0x4f1bbc[_0x69a8('0x3e')],function(_0x506ee2){var _0x55e512={};_0x55e512[_0x506ee2]={'$like':'%'+_0x286eea[_0x69a8('0x3a')]['filter']+'%'};return _0x55e512;})});}_0x4f1bbc=_['merge']({},_0x4f1bbc,_0x286eea[_0x69a8('0x4e')]);return _0x9c7438[_0x69a8('0x53')](_0x4f1bbc);}})[_0x69a8('0x1d')](function(_0x27a4e5){if(_0x27a4e5){_0x387703=_0x27a4e5[_0x69a8('0x40')];if(!_0x286eea['query'][_0x69a8('0x41')](_0x69a8('0x42'))){_0x4f1bbc[_0x69a8('0x2e')]=qs[_0x69a8('0x2e')](_0x286eea['query'][_0x69a8('0x2e')]);_0x4f1bbc[_0x69a8('0x2d')]=qs['offset'](_0x286eea[_0x69a8('0x3a')]['offset']);}return _0x9c7438[_0x69a8('0x53')](_0x4f1bbc);}})[_0x69a8('0x1d')](function(_0x11002c){if(_0x11002c){return _0x11002c?{'count':_0x387703,'rows':_0x11002c}:null;}})['then'](respondWithResult(_0x357e02,null))[_0x69a8('0x27')](handleError(_0x357e02,null));};exports[_0x69a8('0x56')]=function(_0x44b7f3,_0x3db30e,_0x1fa5ce){if(_0x44b7f3['body']['id']){delete _0x44b7f3[_0x69a8('0x51')]['id'];}return db['SugarcrmAccount'][_0x69a8('0x54')]({'where':{'id':_0x44b7f3[_0x69a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3db30e,null))[_0x69a8('0x1d')](function(_0x237dab){if(_0x237dab){_0x44b7f3['body'][_0x69a8('0x57')]=_0x237dab['id'];_0x44b7f3[_0x69a8('0x51')][_0x69a8('0x58')]=integrations[_0x69a8('0x59')](_0x44b7f3[_0x69a8('0x51')]['channel'],_0x44b7f3[_0x69a8('0x51')][_0x69a8('0x37')]);_0x44b7f3['body'][_0x69a8('0x5a')]=integrations[_0x69a8('0x5b')](_0x44b7f3[_0x69a8('0x51')][_0x69a8('0x5c')],_0x44b7f3['body']['type']);return db[_0x69a8('0x55')][_0x69a8('0x50')](_0x44b7f3['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x69a8('0x58')},{'model':db[_0x69a8('0x5d')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3db30e,null))[_0x69a8('0x27')](handleError(_0x3db30e,null));};exports[_0x69a8('0x5e')]=function(_0x2cdfe8,_0x1e0268,_0x402147){var _0x4a0741='';var _0x378e08=['id',_0x69a8('0x32'),'assigned_user_id',_0x69a8('0x5f'),_0x69a8('0x60'),_0x69a8('0x61'),'duration_hours',_0x69a8('0x62'),'parent_id','parent_type',_0x69a8('0x63'),_0x69a8('0x64')];return db[_0x69a8('0x48')][_0x69a8('0x54')]({'where':{'id':_0x2cdfe8[_0x69a8('0x4d')]['id']},'attributes':['id',_0x69a8('0x65'),_0x69a8('0x66'),_0x69a8('0x67')]})[_0x69a8('0x1d')](handleEntityNotFound(_0x1e0268,null))[_0x69a8('0x1d')](function(_0x55f1ce){if(_0x55f1ce){_0x4a0741=_0x55f1ce[_0x69a8('0x67')];var _0x4f82b7=_0x4a0741[_0x69a8('0x68')](-0x1);if(_0x4f82b7==='/'){_0x4a0741=_0x4a0741[_0x69a8('0x69')](0x0,_0x4a0741[_0x69a8('0x6a')](_0x4f82b7));}return rp({'method':_0x69a8('0x6b'),'uri':util['format'](_0x69a8('0x6c'),_0x4a0741,_0x69a8('0x6d')),'json':!![],'form':{'method':_0x69a8('0x6e'),'input_type':_0x69a8('0x6f'),'response_type':_0x69a8('0x6f'),'rest_data':JSON[_0x69a8('0x23')]({'user_auth':{'user_name':_0x55f1ce[_0x69a8('0x65')],'password':_0x55f1ce[_0x69a8('0x66')],'encryption':_0x69a8('0x70')},'application':_0x69a8('0x71')})}});}})[_0x69a8('0x1d')](function(_0x465c44){if(_0x465c44&&_0x465c44[_0x69a8('0x32')]!==_0x69a8('0x72')&&_0x465c44['name']!==_0x69a8('0x73')){return rp({'method':_0x69a8('0x6b'),'uri':util['format']('%s%s',_0x4a0741,_0x69a8('0x6d')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x69a8('0x6f'),'response_type':_0x69a8('0x6f'),'rest_data':JSON[_0x69a8('0x23')]({'session':_0x465c44['id'],'module_name':'Calls'})}})[_0x69a8('0x1d')](function(_0x188e95){if(_0x188e95){var _0x2115e6=_[_0x69a8('0x74')](_0x188e95['module_fields']);_['remove'](_0x2115e6,function(_0x2955ab){return _0x378e08['includes'](_0x2955ab[_0x69a8('0x32')]);});return{'count':_0x2115e6[_0x69a8('0x40')],'rows':_['map'](_0x2115e6,function(_0x255a59){return{'id':_0x255a59[_0x69a8('0x32')],'name':_0x255a59[_0x69a8('0x75')],'custom':_[_0x69a8('0x76')](_0x255a59[_0x69a8('0x32')],'_c')?!![]:![],'options':_0x255a59['options']?_[_0x69a8('0x34')](_[_0x69a8('0x74')](_0x255a59[_0x69a8('0x4e')]),function(_0x50e2ac){return{'name':_0x50e2ac[_0x69a8('0x77')],'value':_0x50e2ac[_0x69a8('0x32')]};}):[]};})};}})[_0x69a8('0x1d')](respondWithResult(_0x1e0268,null))[_0x69a8('0x27')](function(_0x2481ba){var _0xbf3a3b=_0x2cdfe8['query'][_0x69a8('0x78')]?0x1f4:_0x2481ba[_0x69a8('0x79')]||0x1f4;logger[_0x69a8('0x24')](_0x69a8('0x7a'),'getFields',_0xbf3a3b,JSON['stringify'](_0x2481ba));delete _0x2481ba[_0x69a8('0x32')];if(_0xbf3a3b===0x191){_0xbf3a3b=0x190;}_0x1e0268[_0x69a8('0x29')](_0xbf3a3b)[_0x69a8('0x33')](_0x2cdfe8[_0x69a8('0x3a')][_0x69a8('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x2481ba[_0x69a8('0x79')]}:_0x2481ba);});}else{var _0x384893=0x1f4;_0x1e0268[_0x69a8('0x29')](_0x384893)[_0x69a8('0x33')]({'message':_0x69a8('0x7b'),'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 6b5e6ba..f2d22ce 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 _0x0dcd=['../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes'];(function(_0x2deb2b,_0x35f4e5){var _0x5836a0=function(_0x10d89b){while(--_0x10d89b){_0x2deb2b['push'](_0x2deb2b['shift']());}};_0x5836a0(++_0x35f4e5);}(_0x0dcd,0x148));var _0xd0dc=function(_0x324d6d,_0x15a194){_0x324d6d=_0x324d6d-0x0;var _0x46a189=_0x0dcd[_0x324d6d];return _0x46a189;};'use strict';var _=require(_0xd0dc('0x0'));var util=require('util');var logger=require(_0xd0dc('0x1'))('api');var moment=require(_0xd0dc('0x2'));var BPromise=require(_0xd0dc('0x3'));var rp=require(_0xd0dc('0x4'));var fs=require('fs');var path=require(_0xd0dc('0x5'));var rimraf=require(_0xd0dc('0x6'));var config=require('../../config/environment');var attributes=require(_0xd0dc('0x7'));var integrations=require(_0xd0dc('0x8'));module['exports']=function(_0x24f15d,_0x13e295){return _0x24f15d[_0xd0dc('0x9')](_0xd0dc('0xa'),attributes,{'tableName':_0xd0dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe854=['SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x44989b,_0x1824e8){var _0x1c771c=function(_0xbbfbac){while(--_0xbbfbac){_0x44989b['push'](_0x44989b['shift']());}};_0x1c771c(++_0x1824e8);}(_0xe854,0xb6));var _0x4e85=function(_0x169d5e,_0x19dcb8){_0x169d5e=_0x169d5e-0x0;var _0x5a2489=_0xe854[_0x169d5e];return _0x5a2489;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e85('0x0'))(_0x4e85('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e85('0x2'));var fs=require('fs');var path=require(_0x4e85('0x3'));var rimraf=require(_0x4e85('0x4'));var config=require(_0x4e85('0x5'));var attributes=require(_0x4e85('0x6'));var integrations=require(_0x4e85('0x7'));module[_0x4e85('0x8')]=function(_0xd0d54,_0x3a4f8c){return _0xd0d54[_0x4e85('0x9')](_0x4e85('0xa'),attributes,{'tableName':_0x4e85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 5fcb182..33648c0 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 _0xef34=['where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw'];(function(_0x48a4ac,_0x2469ee){var _0x111e28=function(_0x18aee8){while(--_0x18aee8){_0x48a4ac['push'](_0x48a4ac['shift']());}};_0x111e28(++_0x2469ee);}(_0xef34,0xa8));var _0x4ef3=function(_0x41eb6e,_0x1be8b7){_0x41eb6e=_0x41eb6e-0x0;var _0x464274=_0xef34[_0x41eb6e];return _0x464274;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ef3('0x0'));var BPromise=require(_0x4ef3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ef3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ef3('0x3'))(_0x4ef3('0x4'));var config=require(_0x4ef3('0x5'));var jayson=require(_0x4ef3('0x6'));var client=jayson['client'][_0x4ef3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x498557,_0x279e37,_0x19decc){return new BPromise(function(_0x115475,_0x533672){return client[_0x4ef3('0x8')](_0x498557,_0x19decc)[_0x4ef3('0x9')](function(_0x2d18a8){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x279e37,_0x4ef3('0xa'));logger[_0x4ef3('0xb')](_0x4ef3('0xc'),_0x279e37,_0x4ef3('0xa'),JSON[_0x4ef3('0xd')](_0x2d18a8));if(_0x2d18a8[_0x4ef3('0xe')]){if(_0x2d18a8['error'][_0x4ef3('0xf')]===0x1f4){logger[_0x4ef3('0xe')](_0x4ef3('0x10'),_0x279e37,_0x2d18a8[_0x4ef3('0xe')][_0x4ef3('0x11')]);return _0x533672(_0x2d18a8['error'][_0x4ef3('0x11')]);}logger[_0x4ef3('0xe')](_0x4ef3('0x10'),_0x279e37,_0x2d18a8[_0x4ef3('0xe')]['message']);return _0x115475(_0x2d18a8['error']['message']);}else{logger[_0x4ef3('0x12')](_0x4ef3('0x10'),_0x279e37,_0x4ef3('0xa'));_0x115475(_0x2d18a8['result'][_0x4ef3('0x11')]);}})[_0x4ef3('0x13')](function(_0x597172){logger['error'](_0x4ef3('0x10'),_0x279e37,_0x597172);_0x533672(_0x597172);});});}exports[_0x4ef3('0x14')]=function(_0x2b3486){var _0x51d87f=this;return new Promise(function(_0x2f8784,_0x235e98){return db[_0x4ef3('0x15')]['findAll']({'raw':_0x2b3486[_0x4ef3('0x16')]?_0x2b3486[_0x4ef3('0x16')][_0x4ef3('0x17')]===undefined?!![]:![]:!![],'where':_0x2b3486['options']?_0x2b3486['options'][_0x4ef3('0x18')]||null:null,'attributes':_0x2b3486[_0x4ef3('0x16')]?_0x2b3486['options'][_0x4ef3('0x19')]||null:null,'limit':_0x2b3486[_0x4ef3('0x16')]?_0x2b3486[_0x4ef3('0x16')][_0x4ef3('0x1a')]||null:null,'include':_0x2b3486[_0x4ef3('0x16')]?_0x2b3486['options'][_0x4ef3('0x1b')]?_['map'](_0x2b3486['options']['include'],function(_0xd8f790){return{'model':db[_0xd8f790['model']],'as':_0xd8f790['as'],'attributes':_0xd8f790['attributes'],'include':_0xd8f790['include']?_[_0x4ef3('0x1c')](_0xd8f790[_0x4ef3('0x1b')],function(_0x2a8d9c){return{'model':db[_0x2a8d9c[_0x4ef3('0x1d')]],'as':_0x2a8d9c['as'],'attributes':_0x2a8d9c[_0x4ef3('0x19')],'include':_0x2a8d9c[_0x4ef3('0x1b')]?_[_0x4ef3('0x1c')](_0x2a8d9c[_0x4ef3('0x1b')],function(_0x169c1c){return{'model':db[_0x169c1c[_0x4ef3('0x1d')]],'as':_0x169c1c['as'],'attributes':_0x169c1c[_0x4ef3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4ef3('0x9')](function(_0x1f7e51){logger['info'](_0x4ef3('0x14'),_0x2b3486);logger[_0x4ef3('0xb')](_0x4ef3('0x14'),_0x2b3486,JSON[_0x4ef3('0xd')](_0x1f7e51));_0x2f8784(_0x1f7e51);})[_0x4ef3('0x13')](function(_0x59887f){logger[_0x4ef3('0xe')](_0x4ef3('0x14'),_0x59887f[_0x4ef3('0x11')],_0x2b3486);_0x235e98(_0x51d87f[_0x4ef3('0xe')](0x1f4,_0x59887f[_0x4ef3('0x11')]));});});};exports[_0x4ef3('0x1e')]=function(_0x1d2372){var _0x537aec=this;return new Promise(function(_0x18e146,_0x424ee7){return db[_0x4ef3('0x15')][_0x4ef3('0x1f')]({'raw':_0x1d2372['options']?_0x1d2372[_0x4ef3('0x16')][_0x4ef3('0x17')]===undefined?!![]:![]:!![],'where':_0x1d2372[_0x4ef3('0x16')]?_0x1d2372['options'][_0x4ef3('0x18')]||null:null,'attributes':_0x1d2372[_0x4ef3('0x16')]?_0x1d2372[_0x4ef3('0x16')][_0x4ef3('0x19')]||null:null,'include':_0x1d2372[_0x4ef3('0x16')]?_0x1d2372['options'][_0x4ef3('0x1b')]?_[_0x4ef3('0x1c')](_0x1d2372[_0x4ef3('0x16')][_0x4ef3('0x1b')],function(_0x3f0334){return{'model':db[_0x3f0334[_0x4ef3('0x1d')]],'as':_0x3f0334['as'],'attributes':_0x3f0334[_0x4ef3('0x19')],'include':_0x3f0334[_0x4ef3('0x1b')]?_[_0x4ef3('0x1c')](_0x3f0334[_0x4ef3('0x1b')],function(_0x4e5a75){return{'model':db[_0x4e5a75[_0x4ef3('0x1d')]],'as':_0x4e5a75['as'],'attributes':_0x4e5a75[_0x4ef3('0x19')],'include':_0x4e5a75['include']?_[_0x4ef3('0x1c')](_0x4e5a75[_0x4ef3('0x1b')],function(_0x5d2c3d){return{'model':db[_0x5d2c3d[_0x4ef3('0x1d')]],'as':_0x5d2c3d['as'],'attributes':_0x5d2c3d[_0x4ef3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4ef3('0x9')](function(_0x198c81){logger[_0x4ef3('0x12')]('ShowSugarcrmAccount',_0x1d2372);logger[_0x4ef3('0xb')](_0x4ef3('0x1e'),_0x1d2372,JSON[_0x4ef3('0xd')](_0x198c81));_0x18e146(_0x198c81);})[_0x4ef3('0x13')](function(_0x583f7c){logger[_0x4ef3('0xe')](_0x4ef3('0x1e'),_0x583f7c[_0x4ef3('0x11')],_0x1d2372);_0x424ee7(_0x537aec['error'](0x1f4,_0x583f7c['message']));});});}; \ No newline at end of file +var _0x6b6b=['client','http','request','then','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','options','raw','where','attributes','include','map','model','SugarcrmAccount','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x63cf06,_0x41899a){var _0x2e9066=function(_0xec80e0){while(--_0xec80e0){_0x63cf06['push'](_0x63cf06['shift']());}};_0x2e9066(++_0x41899a);}(_0x6b6b,0xe5));var _0xb6b6=function(_0x29eb7b,_0x403ab6){_0x29eb7b=_0x29eb7b-0x0;var _0x2c2157=_0x6b6b[_0x29eb7b];return _0x2c2157;};'use strict';var _=require(_0xb6b6('0x0'));var util=require('util');var moment=require(_0xb6b6('0x1'));var BPromise=require(_0xb6b6('0x2'));var rs=require(_0xb6b6('0x3'));var fs=require('fs');var Redis=require(_0xb6b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6b6('0x5'));var logger=require(_0xb6b6('0x6'))('rpc');var config=require(_0xb6b6('0x7'));var jayson=require(_0xb6b6('0x8'));var client=jayson[_0xb6b6('0x9')][_0xb6b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e9dd,_0x4893e6,_0x5b7c7e){return new BPromise(function(_0x515fce,_0x11fb39){return client[_0xb6b6('0xb')](_0x52e9dd,_0x5b7c7e)[_0xb6b6('0xc')](function(_0x5ce50f){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x4893e6,'request\x20sent');logger[_0xb6b6('0xd')](_0xb6b6('0xe'),_0x4893e6,_0xb6b6('0xf'),JSON[_0xb6b6('0x10')](_0x5ce50f));if(_0x5ce50f[_0xb6b6('0x11')]){if(_0x5ce50f[_0xb6b6('0x11')][_0xb6b6('0x12')]===0x1f4){logger[_0xb6b6('0x11')](_0xb6b6('0x13'),_0x4893e6,_0x5ce50f[_0xb6b6('0x11')][_0xb6b6('0x14')]);return _0x11fb39(_0x5ce50f[_0xb6b6('0x11')][_0xb6b6('0x14')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4893e6,_0x5ce50f[_0xb6b6('0x11')][_0xb6b6('0x14')]);return _0x515fce(_0x5ce50f[_0xb6b6('0x11')][_0xb6b6('0x14')]);}else{logger[_0xb6b6('0x15')](_0xb6b6('0x13'),_0x4893e6,_0xb6b6('0xf'));_0x515fce(_0x5ce50f[_0xb6b6('0x16')]['message']);}})[_0xb6b6('0x17')](function(_0x4a390e){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4893e6,_0x4a390e);_0x11fb39(_0x4a390e);});});}exports[_0xb6b6('0x18')]=function(_0x2538e2){var _0xd8a217=this;return new Promise(function(_0x1de5e0,_0x16ab7c){return db['SugarcrmAccount']['findAll']({'raw':_0x2538e2[_0xb6b6('0x19')]?_0x2538e2[_0xb6b6('0x19')][_0xb6b6('0x1a')]===undefined?!![]:![]:!![],'where':_0x2538e2[_0xb6b6('0x19')]?_0x2538e2[_0xb6b6('0x19')][_0xb6b6('0x1b')]||null:null,'attributes':_0x2538e2['options']?_0x2538e2[_0xb6b6('0x19')][_0xb6b6('0x1c')]||null:null,'limit':_0x2538e2[_0xb6b6('0x19')]?_0x2538e2[_0xb6b6('0x19')]['limit']||null:null,'include':_0x2538e2['options']?_0x2538e2[_0xb6b6('0x19')][_0xb6b6('0x1d')]?_[_0xb6b6('0x1e')](_0x2538e2['options']['include'],function(_0x129e4a){return{'model':db[_0x129e4a[_0xb6b6('0x1f')]],'as':_0x129e4a['as'],'attributes':_0x129e4a[_0xb6b6('0x1c')],'include':_0x129e4a[_0xb6b6('0x1d')]?_['map'](_0x129e4a[_0xb6b6('0x1d')],function(_0x30c19a){return{'model':db[_0x30c19a[_0xb6b6('0x1f')]],'as':_0x30c19a['as'],'attributes':_0x30c19a['attributes'],'include':_0x30c19a['include']?_['map'](_0x30c19a[_0xb6b6('0x1d')],function(_0x5f4ec4){return{'model':db[_0x5f4ec4['model']],'as':_0x5f4ec4['as'],'attributes':_0x5f4ec4[_0xb6b6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb6b6('0xc')](function(_0x2ec440){logger[_0xb6b6('0x15')](_0xb6b6('0x18'),_0x2538e2);logger[_0xb6b6('0xd')]('GetSugarcrmAccount',_0x2538e2,JSON['stringify'](_0x2ec440));_0x1de5e0(_0x2ec440);})[_0xb6b6('0x17')](function(_0x46d397){logger[_0xb6b6('0x11')](_0xb6b6('0x18'),_0x46d397['message'],_0x2538e2);_0x16ab7c(_0xd8a217[_0xb6b6('0x11')](0x1f4,_0x46d397[_0xb6b6('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x15f2c9){var _0xe2b29f=this;return new Promise(function(_0x5d290e,_0x265a1e){return db[_0xb6b6('0x20')]['find']({'raw':_0x15f2c9[_0xb6b6('0x19')]?_0x15f2c9[_0xb6b6('0x19')][_0xb6b6('0x1a')]===undefined?!![]:![]:!![],'where':_0x15f2c9['options']?_0x15f2c9['options'][_0xb6b6('0x1b')]||null:null,'attributes':_0x15f2c9[_0xb6b6('0x19')]?_0x15f2c9['options'][_0xb6b6('0x1c')]||null:null,'include':_0x15f2c9[_0xb6b6('0x19')]?_0x15f2c9[_0xb6b6('0x19')]['include']?_['map'](_0x15f2c9[_0xb6b6('0x19')][_0xb6b6('0x1d')],function(_0x4eca15){return{'model':db[_0x4eca15[_0xb6b6('0x1f')]],'as':_0x4eca15['as'],'attributes':_0x4eca15['attributes'],'include':_0x4eca15[_0xb6b6('0x1d')]?_[_0xb6b6('0x1e')](_0x4eca15['include'],function(_0x1922a1){return{'model':db[_0x1922a1['model']],'as':_0x1922a1['as'],'attributes':_0x1922a1['attributes'],'include':_0x1922a1[_0xb6b6('0x1d')]?_['map'](_0x1922a1['include'],function(_0x19bd2c){return{'model':db[_0x19bd2c['model']],'as':_0x19bd2c['as'],'attributes':_0x19bd2c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb6b6('0xc')](function(_0x3911db){logger[_0xb6b6('0x15')]('ShowSugarcrmAccount',_0x15f2c9);logger[_0xb6b6('0xd')](_0xb6b6('0x21'),_0x15f2c9,JSON['stringify'](_0x3911db));_0x5d290e(_0x3911db);})[_0xb6b6('0x17')](function(_0x22c644){logger[_0xb6b6('0x11')](_0xb6b6('0x21'),_0x22c644[_0xb6b6('0x14')],_0x15f2c9);_0x265a1e(_0xe2b29f['error'](0x1f4,_0x22c644[_0xb6b6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4500324..27e0580 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 _0x80ef=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x403bd8,_0x4b1b8e){var _0x5d06be=function(_0x36dfc0){while(--_0x36dfc0){_0x403bd8['push'](_0x403bd8['shift']());}};_0x5d06be(++_0x4b1b8e);}(_0x80ef,0xd3));var _0xf80e=function(_0x52e2a8,_0x22d875){_0x52e2a8=_0x52e2a8-0x0;var _0x3d3fb0=_0x80ef[_0x52e2a8];return _0x3d3fb0;};'use strict';var multer=require(_0xf80e('0x0'));var util=require('util');var path=require(_0xf80e('0x1'));var timeout=require(_0xf80e('0x2'));var express=require(_0xf80e('0x3'));var router=express['Router']();var fs_extra=require(_0xf80e('0x4'));var auth=require(_0xf80e('0x5'));var interaction=require(_0xf80e('0x6'));var config=require(_0xf80e('0x7'));var controller=require(_0xf80e('0x8'));router[_0xf80e('0x9')]('/',auth[_0xf80e('0xa')](),controller[_0xf80e('0xb')]);router['get']('/:id',auth[_0xf80e('0xa')](),controller[_0xf80e('0xc')]);router[_0xf80e('0x9')](_0xf80e('0xd'),auth[_0xf80e('0xa')](),controller[_0xf80e('0xe')]);router[_0xf80e('0x9')](_0xf80e('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf80e('0x9')]('/:id/descriptions',auth[_0xf80e('0xa')](),controller[_0xf80e('0x10')]);router['post']('/',auth[_0xf80e('0xa')](),controller[_0xf80e('0x11')]);router[_0xf80e('0x12')](_0xf80e('0x13'),auth[_0xf80e('0xa')](),controller[_0xf80e('0x14')]);router[_0xf80e('0x15')](_0xf80e('0x13'),auth[_0xf80e('0xa')](),controller[_0xf80e('0x16')]);module[_0xf80e('0x17')]=router; \ No newline at end of file +var _0x4744=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','put','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4744,0x1c7));var _0x4474=function(_0x53622a,_0x28a53d){_0x53622a=_0x53622a-0x0;var _0x467912=_0x4744[_0x53622a];return _0x467912;};'use strict';var multer=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var path=require(_0x4474('0x2'));var timeout=require('connect-timeout');var express=require(_0x4474('0x3'));var router=express['Router']();var fs_extra=require(_0x4474('0x4'));var auth=require(_0x4474('0x5'));var interaction=require(_0x4474('0x6'));var config=require(_0x4474('0x7'));var controller=require(_0x4474('0x8'));router[_0x4474('0x9')]('/',auth[_0x4474('0xa')](),controller[_0x4474('0xb')]);router[_0x4474('0x9')]('/:id',auth[_0x4474('0xa')](),controller[_0x4474('0xc')]);router[_0x4474('0x9')](_0x4474('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x4474('0x9')](_0x4474('0xe'),auth['isAuthenticated'](),controller[_0x4474('0xf')]);router['get'](_0x4474('0x10'),auth[_0x4474('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x4474('0xa')](),controller[_0x4474('0x11')]);router[_0x4474('0x12')]('/:id',auth[_0x4474('0xa')](),controller['update']);router['delete'](_0x4474('0x13'),auth[_0x4474('0xa')](),controller[_0x4474('0x14')]);module[_0x4474('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9dd5315..4305170 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 _0x93e7=['exports','STRING','sequelize'];(function(_0x13842e,_0x152769){var _0x251b66=function(_0x5468bd){while(--_0x5468bd){_0x13842e['push'](_0x13842e['shift']());}};_0x251b66(++_0x152769);}(_0x93e7,0x89));var _0x793e=function(_0x390752,_0x42cad3){_0x390752=_0x390752-0x0;var _0x5eca55=_0x93e7[_0x390752];return _0x5eca55;};'use strict';var Sequelize=require(_0x793e('0x0'));module[_0x793e('0x1')]={'name':{'type':Sequelize[_0x793e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf477=['exports','STRING','sequelize'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf477,0x110));var _0x7f47=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf477[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x7f47('0x0'));module[_0x7f47('0x1')]={'name':{'type':Sequelize[_0x7f47('0x2')]},'description':{'type':Sequelize[_0x7f47('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fce4bc1..4c1d48e 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 _0x10b3=['show','params','length','includeAll','find','create','body','SugarcrmField','rawAttributes','sort','filter','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','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','../../config/license/util','jayson/promise','client','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','where','pick','VIRTUAL','merge','options','then','include','rows'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x10b3,0xcb));var _0x310b=function(_0x47f922,_0x5c0231){_0x47f922=_0x47f922-0x0;var _0x16d288=_0x10b3[_0x47f922];return _0x16d288;};'use strict';var pdf=require(_0x310b('0x0'));var emlformat=require(_0x310b('0x1'));var rimraf=require(_0x310b('0x2'));var zipdir=require(_0x310b('0x3'));var jsonpatch=require(_0x310b('0x4'));var rp=require(_0x310b('0x5'));var moment=require(_0x310b('0x6'));var BPromise=require(_0x310b('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x310b('0x8'));var sox=require(_0x310b('0x9'));var csv=require(_0x310b('0xa'));var ejs=require(_0x310b('0xb'));var fs=require('fs');var fs_extra=require(_0x310b('0xc'));var _=require(_0x310b('0xd'));var squel=require(_0x310b('0xe'));var crypto=require(_0x310b('0xf'));var jsforce=require(_0x310b('0x10'));var deskjs=require(_0x310b('0x11'));var toCsv=require(_0x310b('0xa'));var querystring=require(_0x310b('0x12'));var Papa=require(_0x310b('0x13'));var Redis=require(_0x310b('0x14'));var authService=require(_0x310b('0x15'));var qs=require(_0x310b('0x16'));var as=require(_0x310b('0x17'));var hardwareService=require(_0x310b('0x18'));var logger=require(_0x310b('0x19'))('api');var utils=require(_0x310b('0x1a'));var config=require(_0x310b('0x1b'));var licenseUtil=require(_0x310b('0x1c'));var db=require('../../mysqldb')['db'];var jayson=require(_0x310b('0x1d'));var client=jayson[_0x310b('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6d4604,_0x410404,_0x39d528,_0x36bbd5){return new BPromise(function(_0x418f5c,_0x5b957b){var _0x37b481=_0x36bbd5||client;return _0x37b481[_0x310b('0x1f')](_0x6d4604,_0x39d528)['then'](function(_0x2fce7b){logger['info'](_0x310b('0x20'),_0x410404,_0x310b('0x21'));logger[_0x310b('0x22')](_0x310b('0x23'),_0x410404,_0x310b('0x21'),JSON[_0x310b('0x24')](_0x2fce7b));if(_0x2fce7b[_0x310b('0x25')]){if(_0x2fce7b[_0x310b('0x25')][_0x310b('0x26')]===0x1f4){logger[_0x310b('0x25')](_0x310b('0x20'),_0x410404,_0x2fce7b[_0x310b('0x25')]['message']);return _0x5b957b(_0x2fce7b['error'][_0x310b('0x27')]);}logger[_0x310b('0x25')](_0x310b('0x20'),_0x410404,_0x2fce7b[_0x310b('0x25')][_0x310b('0x27')]);return _0x418f5c(_0x2fce7b[_0x310b('0x25')][_0x310b('0x27')]);}else{logger[_0x310b('0x28')](_0x310b('0x20'),_0x410404,'request\x20sent');_0x418f5c(_0x2fce7b[_0x310b('0x29')]['message']);}})[_0x310b('0x2a')](function(_0x320594){logger[_0x310b('0x25')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x410404,_0x320594);_0x5b957b(_0x320594);});});}function respondWithStatusCode(_0x22cbff,_0x200bd5){_0x200bd5=_0x200bd5||0xcc;return function(_0x3941e9){if(_0x3941e9){return _0x22cbff[_0x310b('0x2b')](_0x200bd5);}return _0x22cbff[_0x310b('0x2c')](_0x200bd5)[_0x310b('0x2d')]();};}function respondWithResult(_0x798100,_0x272289){_0x272289=_0x272289||0xc8;return function(_0x38e4aa){if(_0x38e4aa){return _0x798100[_0x310b('0x2c')](_0x272289)[_0x310b('0x2e')](_0x38e4aa);}};}function respondWithFilteredResult(_0x144967,_0x509614){return function(_0x45f286){if(_0x45f286){var _0x1c5392=_0x45f286[_0x310b('0x2f')],_0x58d13d=_0x509614[_0x310b('0x30')],_0x1e1cbd=_0x509614[_0x310b('0x30')]+_0x509614[_0x310b('0x31')],_0x4866fc;if(_0x1e1cbd>=_0x1c5392){_0x1e1cbd=_0x1c5392;_0x4866fc=0xc8;}else{_0x4866fc=0xce;}_0x144967[_0x310b('0x2c')](_0x4866fc);return _0x144967['set']('Content-Range',_0x58d13d+'-'+_0x1e1cbd+'/'+_0x1c5392)[_0x310b('0x2e')](_0x45f286);}return null;};}function patchUpdates(_0x39a5c3){return function(_0x398cd7){try{jsonpatch[_0x310b('0x32')](_0x398cd7,_0x39a5c3,!![]);}catch(_0x363850){return BPromise[_0x310b('0x33')](_0x363850);}return _0x398cd7[_0x310b('0x34')]();};}function saveUpdates(_0x127d12,_0xea0f6){return function(_0xb14f0b){if(_0xb14f0b){return _0xb14f0b[_0x310b('0x35')](_0x127d12)['then'](function(_0x40c39b){return _0x40c39b;});}return null;};}function removeEntity(_0x3a3b80,_0x5267e6){return function(_0x2f0bbe){if(_0x2f0bbe){return _0x2f0bbe['destroy']()['then'](function(){_0x3a3b80[_0x310b('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x215f3b,_0x5d6785){return function(_0x1a5e35){if(!_0x1a5e35){_0x215f3b[_0x310b('0x2b')](0x194);}return _0x1a5e35;};}function handleError(_0x2915a7,_0x52bfbf){_0x52bfbf=_0x52bfbf||0x1f4;return function(_0x1a0e97){logger[_0x310b('0x25')](_0x1a0e97[_0x310b('0x36')]);if(_0x1a0e97[_0x310b('0x37')]){delete _0x1a0e97[_0x310b('0x37')];}_0x2915a7[_0x310b('0x2c')](_0x52bfbf)['send'](_0x1a0e97);};}exports[_0x310b('0x38')]=function(_0x24e173,_0x39bb7b){var _0xd7922b={},_0x12d0da={},_0x37c789={'count':0x0,'rows':[]};var _0x57c1ad=_[_0x310b('0x39')](db[_0x310b('0x3a')]['rawAttributes'],function(_0x4c3a66){return{'name':_0x4c3a66[_0x310b('0x3b')],'type':_0x4c3a66[_0x310b('0x3c')][_0x310b('0x3d')]};});_0x12d0da[_0x310b('0x3e')]=_[_0x310b('0x39')](_0x57c1ad,_0x310b('0x37'));_0x12d0da[_0x310b('0x3f')]=_[_0x310b('0x40')](_0x24e173[_0x310b('0x3f')]);_0x12d0da[_0x310b('0x41')]=_[_0x310b('0x42')](_0x12d0da[_0x310b('0x3e')],_0x12d0da['query']);_0xd7922b['attributes']=_[_0x310b('0x42')](_0x12d0da[_0x310b('0x3e')],qs['fields'](_0x24e173[_0x310b('0x3f')][_0x310b('0x43')]));_0xd7922b[_0x310b('0x44')]=_0xd7922b[_0x310b('0x44')]['length']?_0xd7922b[_0x310b('0x44')]:_0x12d0da[_0x310b('0x3e')];if(!_0x24e173[_0x310b('0x3f')][_0x310b('0x45')]('nolimit')){_0xd7922b[_0x310b('0x31')]=qs[_0x310b('0x31')](_0x24e173['query'][_0x310b('0x31')]);_0xd7922b['offset']=qs[_0x310b('0x30')](_0x24e173['query'][_0x310b('0x30')]);}_0xd7922b[_0x310b('0x46')]=qs['sort'](_0x24e173[_0x310b('0x3f')]['sort']);_0xd7922b[_0x310b('0x47')]=qs[_0x310b('0x41')](_[_0x310b('0x48')](_0x24e173[_0x310b('0x3f')],_0x12d0da['filters']),_0x57c1ad);if(_0x24e173[_0x310b('0x3f')]['filter']){_0xd7922b[_0x310b('0x47')]=_['merge'](_0xd7922b[_0x310b('0x47')],{'$or':_[_0x310b('0x39')](_0x57c1ad,function(_0x58196e){if(_0x58196e[_0x310b('0x3c')]!==_0x310b('0x49')){var _0x21a53={};_0x21a53[_0x58196e[_0x310b('0x37')]]={'$like':'%'+_0x24e173[_0x310b('0x3f')]['filter']+'%'};return _0x21a53;}})});}_0xd7922b=_[_0x310b('0x4a')]({},_0xd7922b,_0x24e173[_0x310b('0x4b')]);var _0x75999e={'where':_0xd7922b['where']};return db['SugarcrmConfiguration'][_0x310b('0x2f')](_0x75999e)[_0x310b('0x4c')](function(_0x49909b){_0x37c789[_0x310b('0x2f')]=_0x49909b;if(_0x24e173[_0x310b('0x3f')]['includeAll']){_0xd7922b[_0x310b('0x4d')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0xd7922b);})[_0x310b('0x4c')](function(_0x454899){_0x37c789[_0x310b('0x4e')]=_0x454899;return _0x37c789;})[_0x310b('0x4c')](respondWithFilteredResult(_0x39bb7b,_0xd7922b))[_0x310b('0x2a')](handleError(_0x39bb7b,null));};exports[_0x310b('0x4f')]=function(_0x44039c,_0x5735a9){var _0xf35b40={'raw':![],'where':{'id':_0x44039c[_0x310b('0x50')]['id']}},_0x45aea8={};_0x45aea8[_0x310b('0x3e')]=_['keys'](db[_0x310b('0x3a')]['rawAttributes']);_0x45aea8[_0x310b('0x3f')]=_[_0x310b('0x40')](_0x44039c[_0x310b('0x3f')]);_0x45aea8['filters']=_['intersection'](_0x45aea8[_0x310b('0x3e')],_0x45aea8[_0x310b('0x3f')]);_0xf35b40['attributes']=_[_0x310b('0x42')](_0x45aea8['model'],qs['fields'](_0x44039c[_0x310b('0x3f')][_0x310b('0x43')]));_0xf35b40['attributes']=_0xf35b40[_0x310b('0x44')][_0x310b('0x51')]?_0xf35b40[_0x310b('0x44')]:_0x45aea8[_0x310b('0x3e')];if(_0x44039c[_0x310b('0x3f')][_0x310b('0x52')]){_0xf35b40[_0x310b('0x4d')]=[{'all':!![]}];}_0xf35b40=_[_0x310b('0x4a')]({},_0xf35b40,_0x44039c[_0x310b('0x4b')]);return db[_0x310b('0x3a')][_0x310b('0x53')](_0xf35b40)[_0x310b('0x4c')](handleEntityNotFound(_0x5735a9,null))[_0x310b('0x4c')](respondWithResult(_0x5735a9,null))['catch'](handleError(_0x5735a9,null));};exports[_0x310b('0x54')]=function(_0x17a8fd,_0x28ec13){return db['SugarcrmConfiguration'][_0x310b('0x54')](_0x17a8fd[_0x310b('0x55')],{})['then'](respondWithResult(_0x28ec13,0xc9))[_0x310b('0x2a')](handleError(_0x28ec13,null));};exports[_0x310b('0x35')]=function(_0x3512db,_0x45e6b3){if(_0x3512db[_0x310b('0x55')]['id']){delete _0x3512db[_0x310b('0x55')]['id'];}return db['SugarcrmConfiguration'][_0x310b('0x53')]({'where':{'id':_0x3512db[_0x310b('0x50')]['id']}})[_0x310b('0x4c')](handleEntityNotFound(_0x45e6b3,null))[_0x310b('0x4c')](saveUpdates(_0x3512db[_0x310b('0x55')],null))['then'](respondWithResult(_0x45e6b3,null))[_0x310b('0x2a')](handleError(_0x45e6b3,null));};exports['destroy']=function(_0xba3fc2,_0x5785fa){return db['SugarcrmConfiguration'][_0x310b('0x53')]({'where':{'id':_0xba3fc2['params']['id']}})[_0x310b('0x4c')](handleEntityNotFound(_0x5785fa,null))['then'](removeEntity(_0x5785fa,null))[_0x310b('0x2a')](handleError(_0x5785fa,null));};exports['getFields']=function(_0x469909,_0x3eed44,_0x4ead90){var _0x4f94af={};var _0x412bd8={};var _0x56485f;var _0x43ff7d;return db[_0x310b('0x3a')]['findOne']({'where':{'id':_0x469909[_0x310b('0x50')]['id']}})[_0x310b('0x4c')](handleEntityNotFound(_0x3eed44,null))[_0x310b('0x4c')](function(_0x40d8f4){if(_0x40d8f4){_0x56485f=_0x40d8f4;_0x412bd8['model']=_['keys'](db[_0x310b('0x56')][_0x310b('0x57')]);_0x412bd8['query']=_[_0x310b('0x40')](_0x469909[_0x310b('0x3f')]);_0x412bd8[_0x310b('0x41')]=_[_0x310b('0x42')](_0x412bd8['model'],_0x412bd8['query']);_0x4f94af[_0x310b('0x44')]=_[_0x310b('0x42')](_0x412bd8[_0x310b('0x3e')],qs['fields'](_0x469909[_0x310b('0x3f')][_0x310b('0x43')]));_0x4f94af[_0x310b('0x44')]=_0x4f94af[_0x310b('0x44')][_0x310b('0x51')]?_0x4f94af['attributes']:_0x412bd8[_0x310b('0x3e')];_0x4f94af[_0x310b('0x46')]=qs[_0x310b('0x58')](_0x469909[_0x310b('0x3f')][_0x310b('0x58')]);_0x4f94af['where']=qs[_0x310b('0x41')](_[_0x310b('0x48')](_0x469909[_0x310b('0x3f')],_0x412bd8[_0x310b('0x41')]));if(_0x469909[_0x310b('0x3f')][_0x310b('0x59')]){_0x4f94af[_0x310b('0x47')]=_['merge'](_0x4f94af[_0x310b('0x47')],{'$or':_[_0x310b('0x39')](_0x4f94af[_0x310b('0x44')],function(_0xfcb7a5){var _0x1cf6f4={};_0x1cf6f4[_0xfcb7a5]={'$like':'%'+_0x469909[_0x310b('0x3f')][_0x310b('0x59')]+'%'};return _0x1cf6f4;})});}_0x4f94af=_[_0x310b('0x4a')]({},_0x4f94af,_0x469909[_0x310b('0x4b')]);return _0x56485f[_0x310b('0x5a')](_0x4f94af);}})[_0x310b('0x4c')](function(_0x357fed){if(_0x357fed){_0x43ff7d=_0x357fed[_0x310b('0x51')];if(!_0x469909[_0x310b('0x3f')][_0x310b('0x45')](_0x310b('0x5b'))){_0x4f94af[_0x310b('0x31')]=qs[_0x310b('0x31')](_0x469909[_0x310b('0x3f')]['limit']);_0x4f94af[_0x310b('0x30')]=qs[_0x310b('0x30')](_0x469909['query'][_0x310b('0x30')]);}return _0x56485f['getFields'](_0x4f94af);}})[_0x310b('0x4c')](function(_0x234c8d){if(_0x234c8d){return _0x234c8d?{'count':_0x43ff7d,'rows':_0x234c8d}:null;}})[_0x310b('0x4c')](respondWithResult(_0x3eed44,null))[_0x310b('0x2a')](handleError(_0x3eed44,null));};exports[_0x310b('0x5c')]=function(_0x1fdeb1,_0x10a832,_0x2f1468){var _0x565337={};var _0x31ba26={};var _0x1f0e8f;var _0x4c3e78;return db[_0x310b('0x3a')]['findOne']({'where':{'id':_0x1fdeb1[_0x310b('0x50')]['id']}})[_0x310b('0x4c')](handleEntityNotFound(_0x10a832,null))[_0x310b('0x4c')](function(_0x4533bd){if(_0x4533bd){_0x1f0e8f=_0x4533bd;_0x31ba26[_0x310b('0x3e')]=_[_0x310b('0x40')](db[_0x310b('0x56')]['rawAttributes']);_0x31ba26['query']=_[_0x310b('0x40')](_0x1fdeb1[_0x310b('0x3f')]);_0x31ba26[_0x310b('0x41')]=_[_0x310b('0x42')](_0x31ba26['model'],_0x31ba26[_0x310b('0x3f')]);_0x565337['attributes']=_['intersection'](_0x31ba26[_0x310b('0x3e')],qs[_0x310b('0x43')](_0x1fdeb1[_0x310b('0x3f')]['fields']));_0x565337[_0x310b('0x44')]=_0x565337[_0x310b('0x44')]['length']?_0x565337[_0x310b('0x44')]:_0x31ba26[_0x310b('0x3e')];_0x565337[_0x310b('0x46')]=qs[_0x310b('0x58')](_0x1fdeb1[_0x310b('0x3f')][_0x310b('0x58')]);_0x565337[_0x310b('0x47')]=qs['filters'](_[_0x310b('0x48')](_0x1fdeb1[_0x310b('0x3f')],_0x31ba26['filters']));if(_0x1fdeb1[_0x310b('0x3f')]['filter']){_0x565337[_0x310b('0x47')]=_[_0x310b('0x4a')](_0x565337[_0x310b('0x47')],{'$or':_[_0x310b('0x39')](_0x565337[_0x310b('0x44')],function(_0x2b96a0){var _0x23ea60={};_0x23ea60[_0x2b96a0]={'$like':'%'+_0x1fdeb1[_0x310b('0x3f')][_0x310b('0x59')]+'%'};return _0x23ea60;})});}_0x565337=_[_0x310b('0x4a')]({},_0x565337,_0x1fdeb1[_0x310b('0x4b')]);return _0x1f0e8f[_0x310b('0x5c')](_0x565337);}})[_0x310b('0x4c')](function(_0x35a617){if(_0x35a617){_0x4c3e78=_0x35a617[_0x310b('0x51')];if(!_0x1fdeb1[_0x310b('0x3f')]['hasOwnProperty'](_0x310b('0x5b'))){_0x565337[_0x310b('0x31')]=qs[_0x310b('0x31')](_0x1fdeb1[_0x310b('0x3f')]['limit']);_0x565337[_0x310b('0x30')]=qs[_0x310b('0x30')](_0x1fdeb1['query']['offset']);}return _0x1f0e8f[_0x310b('0x5c')](_0x565337);}})[_0x310b('0x4c')](function(_0x58a9e7){if(_0x58a9e7){return _0x58a9e7?{'count':_0x4c3e78,'rows':_0x58a9e7}:null;}})[_0x310b('0x4c')](respondWithResult(_0x10a832,null))[_0x310b('0x2a')](handleError(_0x10a832,null));};exports['getDescriptions']=function(_0x40f95a,_0x552f54,_0xed24a8){var _0x2eb284={};var _0x1ee29c={};var _0x10cbaf;var _0x38e4ef;return db[_0x310b('0x3a')]['findOne']({'where':{'id':_0x40f95a[_0x310b('0x50')]['id']}})['then'](handleEntityNotFound(_0x552f54,null))[_0x310b('0x4c')](function(_0x36b207){if(_0x36b207){_0x10cbaf=_0x36b207;_0x1ee29c[_0x310b('0x3e')]=_[_0x310b('0x40')](db[_0x310b('0x56')]['rawAttributes']);_0x1ee29c[_0x310b('0x3f')]=_[_0x310b('0x40')](_0x40f95a[_0x310b('0x3f')]);_0x1ee29c[_0x310b('0x41')]=_[_0x310b('0x42')](_0x1ee29c[_0x310b('0x3e')],_0x1ee29c[_0x310b('0x3f')]);_0x2eb284[_0x310b('0x44')]=_['intersection'](_0x1ee29c[_0x310b('0x3e')],qs['fields'](_0x40f95a[_0x310b('0x3f')][_0x310b('0x43')]));_0x2eb284[_0x310b('0x44')]=_0x2eb284[_0x310b('0x44')][_0x310b('0x51')]?_0x2eb284['attributes']:_0x1ee29c['model'];_0x2eb284[_0x310b('0x46')]=qs[_0x310b('0x58')](_0x40f95a[_0x310b('0x3f')][_0x310b('0x58')]);_0x2eb284['where']=qs[_0x310b('0x41')](_[_0x310b('0x48')](_0x40f95a[_0x310b('0x3f')],_0x1ee29c[_0x310b('0x41')]));if(_0x40f95a[_0x310b('0x3f')][_0x310b('0x59')]){_0x2eb284[_0x310b('0x47')]=_[_0x310b('0x4a')](_0x2eb284[_0x310b('0x47')],{'$or':_['map'](_0x2eb284[_0x310b('0x44')],function(_0x4dba3a){var _0x23917e={};_0x23917e[_0x4dba3a]={'$like':'%'+_0x40f95a[_0x310b('0x3f')][_0x310b('0x59')]+'%'};return _0x23917e;})});}_0x2eb284=_['merge']({},_0x2eb284,_0x40f95a['options']);return _0x10cbaf[_0x310b('0x5d')](_0x2eb284);}})[_0x310b('0x4c')](function(_0x808ce2){if(_0x808ce2){_0x38e4ef=_0x808ce2['length'];if(!_0x40f95a[_0x310b('0x3f')]['hasOwnProperty'](_0x310b('0x5b'))){_0x2eb284[_0x310b('0x31')]=qs[_0x310b('0x31')](_0x40f95a[_0x310b('0x3f')][_0x310b('0x31')]);_0x2eb284['offset']=qs['offset'](_0x40f95a[_0x310b('0x3f')][_0x310b('0x30')]);}return _0x10cbaf[_0x310b('0x5d')](_0x2eb284);}})[_0x310b('0x4c')](function(_0x22a418){if(_0x22a418){return _0x22a418?{'count':_0x38e4ef,'rows':_0x22a418}:null;}})['then'](respondWithResult(_0x552f54,null))[_0x310b('0x2a')](handleError(_0x552f54,null));}; \ No newline at end of file +var _0xfe96=['sendStatus','status','json','count','offset','limit','apply','save','update','destroy','end','stack','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','nolimit','getSubjects','getDescriptions','rimraf','request-promise','moment','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x511d5c,_0x4d44a0){var _0x128d3b=function(_0x271de6){while(--_0x271de6){_0x511d5c['push'](_0x511d5c['shift']());}};_0x128d3b(++_0x4d44a0);}(_0xfe96,0x131));var _0x6fe9=function(_0x3e3ac9,_0x403f3a){_0x3e3ac9=_0x3e3ac9-0x0;var _0x285f73=_0xfe96[_0x3e3ac9];return _0x285f73;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6fe9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6fe9('0x1'));var moment=require(_0x6fe9('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6fe9('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x6fe9('0x4'));var ejs=require(_0x6fe9('0x5'));var fs=require('fs');var fs_extra=require(_0x6fe9('0x6'));var _=require('lodash');var squel=require(_0x6fe9('0x7'));var crypto=require(_0x6fe9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6fe9('0x9'));var toCsv=require(_0x6fe9('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6fe9('0xa'));var authService=require(_0x6fe9('0xb'));var qs=require(_0x6fe9('0xc'));var as=require(_0x6fe9('0xd'));var hardwareService=require(_0x6fe9('0xe'));var logger=require(_0x6fe9('0xf'))(_0x6fe9('0x10'));var utils=require(_0x6fe9('0x11'));var config=require(_0x6fe9('0x12'));var licenseUtil=require(_0x6fe9('0x13'));var db=require(_0x6fe9('0x14'))['db'];var jayson=require(_0x6fe9('0x15'));var client=jayson[_0x6fe9('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38a731,_0x54e8d9,_0x3d5fbd,_0x4e6a92){return new BPromise(function(_0x1bb1ba,_0x462509){var _0x415c32=_0x4e6a92||client;return _0x415c32[_0x6fe9('0x17')](_0x38a731,_0x3d5fbd)[_0x6fe9('0x18')](function(_0x30bd1b){logger[_0x6fe9('0x19')](_0x6fe9('0x1a'),_0x54e8d9,'request\x20sent');logger['debug'](_0x6fe9('0x1b'),_0x54e8d9,'request\x20sent',JSON[_0x6fe9('0x1c')](_0x30bd1b));if(_0x30bd1b[_0x6fe9('0x1d')]){if(_0x30bd1b[_0x6fe9('0x1d')][_0x6fe9('0x1e')]===0x1f4){logger['error'](_0x6fe9('0x1a'),_0x54e8d9,_0x30bd1b[_0x6fe9('0x1d')]['message']);return _0x462509(_0x30bd1b['error'][_0x6fe9('0x1f')]);}logger[_0x6fe9('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x54e8d9,_0x30bd1b['error'][_0x6fe9('0x1f')]);return _0x1bb1ba(_0x30bd1b[_0x6fe9('0x1d')]['message']);}else{logger[_0x6fe9('0x19')](_0x6fe9('0x1a'),_0x54e8d9,_0x6fe9('0x20'));_0x1bb1ba(_0x30bd1b[_0x6fe9('0x21')][_0x6fe9('0x1f')]);}})[_0x6fe9('0x22')](function(_0x370ff8){logger[_0x6fe9('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x54e8d9,_0x370ff8);_0x462509(_0x370ff8);});});}function respondWithStatusCode(_0x310af9,_0x1d3b11){_0x1d3b11=_0x1d3b11||0xcc;return function(_0x4febd8){if(_0x4febd8){return _0x310af9[_0x6fe9('0x23')](_0x1d3b11);}return _0x310af9['status'](_0x1d3b11)['end']();};}function respondWithResult(_0x386a1,_0x16f893){_0x16f893=_0x16f893||0xc8;return function(_0x523c3c){if(_0x523c3c){return _0x386a1[_0x6fe9('0x24')](_0x16f893)[_0x6fe9('0x25')](_0x523c3c);}};}function respondWithFilteredResult(_0x550ea0,_0x5a1d05){return function(_0xc55520){if(_0xc55520){var _0x2b1ded=_0xc55520[_0x6fe9('0x26')],_0x45f924=_0x5a1d05[_0x6fe9('0x27')],_0x1429a2=_0x5a1d05['offset']+_0x5a1d05[_0x6fe9('0x28')],_0x138905;if(_0x1429a2>=_0x2b1ded){_0x1429a2=_0x2b1ded;_0x138905=0xc8;}else{_0x138905=0xce;}_0x550ea0[_0x6fe9('0x24')](_0x138905);return _0x550ea0['set']('Content-Range',_0x45f924+'-'+_0x1429a2+'/'+_0x2b1ded)[_0x6fe9('0x25')](_0xc55520);}return null;};}function patchUpdates(_0x21c603){return function(_0x558dd0){try{jsonpatch[_0x6fe9('0x29')](_0x558dd0,_0x21c603,!![]);}catch(_0x2c5e38){return BPromise['reject'](_0x2c5e38);}return _0x558dd0[_0x6fe9('0x2a')]();};}function saveUpdates(_0x29da2e,_0x4bf7e4){return function(_0x5e1c69){if(_0x5e1c69){return _0x5e1c69[_0x6fe9('0x2b')](_0x29da2e)[_0x6fe9('0x18')](function(_0x39baa2){return _0x39baa2;});}return null;};}function removeEntity(_0x259cbf,_0x52e15a){return function(_0x14f95a){if(_0x14f95a){return _0x14f95a[_0x6fe9('0x2c')]()[_0x6fe9('0x18')](function(){_0x259cbf[_0x6fe9('0x24')](0xcc)[_0x6fe9('0x2d')]();});}};}function handleEntityNotFound(_0x12f399,_0x8b8362){return function(_0xaf663c){if(!_0xaf663c){_0x12f399[_0x6fe9('0x23')](0x194);}return _0xaf663c;};}function handleError(_0x30a2a4,_0xdf662e){_0xdf662e=_0xdf662e||0x1f4;return function(_0x14ff26){logger[_0x6fe9('0x1d')](_0x14ff26[_0x6fe9('0x2e')]);if(_0x14ff26['name']){delete _0x14ff26[_0x6fe9('0x2f')];}_0x30a2a4[_0x6fe9('0x24')](_0xdf662e)['send'](_0x14ff26);};}exports['index']=function(_0x3bf429,_0x490ec3){var _0x432901={},_0x41ff58={},_0x444327={'count':0x0,'rows':[]};var _0x5dcf41=_[_0x6fe9('0x30')](db[_0x6fe9('0x31')][_0x6fe9('0x32')],function(_0x7a18dd){return{'name':_0x7a18dd[_0x6fe9('0x33')],'type':_0x7a18dd[_0x6fe9('0x34')][_0x6fe9('0x35')]};});_0x41ff58[_0x6fe9('0x36')]=_[_0x6fe9('0x30')](_0x5dcf41,_0x6fe9('0x2f'));_0x41ff58[_0x6fe9('0x37')]=_[_0x6fe9('0x38')](_0x3bf429[_0x6fe9('0x37')]);_0x41ff58[_0x6fe9('0x39')]=_[_0x6fe9('0x3a')](_0x41ff58[_0x6fe9('0x36')],_0x41ff58['query']);_0x432901[_0x6fe9('0x3b')]=_['intersection'](_0x41ff58[_0x6fe9('0x36')],qs['fields'](_0x3bf429[_0x6fe9('0x37')][_0x6fe9('0x3c')]));_0x432901[_0x6fe9('0x3b')]=_0x432901['attributes'][_0x6fe9('0x3d')]?_0x432901[_0x6fe9('0x3b')]:_0x41ff58[_0x6fe9('0x36')];if(!_0x3bf429['query']['hasOwnProperty']('nolimit')){_0x432901[_0x6fe9('0x28')]=qs['limit'](_0x3bf429[_0x6fe9('0x37')][_0x6fe9('0x28')]);_0x432901[_0x6fe9('0x27')]=qs[_0x6fe9('0x27')](_0x3bf429[_0x6fe9('0x37')][_0x6fe9('0x27')]);}_0x432901[_0x6fe9('0x3e')]=qs[_0x6fe9('0x3f')](_0x3bf429[_0x6fe9('0x37')][_0x6fe9('0x3f')]);_0x432901[_0x6fe9('0x40')]=qs[_0x6fe9('0x39')](_[_0x6fe9('0x41')](_0x3bf429['query'],_0x41ff58[_0x6fe9('0x39')]),_0x5dcf41);if(_0x3bf429['query'][_0x6fe9('0x42')]){_0x432901[_0x6fe9('0x40')]=_[_0x6fe9('0x43')](_0x432901['where'],{'$or':_[_0x6fe9('0x30')](_0x5dcf41,function(_0x2414c7){if(_0x2414c7[_0x6fe9('0x34')]!==_0x6fe9('0x44')){var _0x4d9948={};_0x4d9948[_0x2414c7[_0x6fe9('0x2f')]]={'$like':'%'+_0x3bf429[_0x6fe9('0x37')][_0x6fe9('0x42')]+'%'};return _0x4d9948;}})});}_0x432901=_[_0x6fe9('0x43')]({},_0x432901,_0x3bf429[_0x6fe9('0x45')]);var _0x119b8c={'where':_0x432901[_0x6fe9('0x40')]};return db[_0x6fe9('0x31')][_0x6fe9('0x26')](_0x119b8c)[_0x6fe9('0x18')](function(_0x4187fc){_0x444327[_0x6fe9('0x26')]=_0x4187fc;if(_0x3bf429[_0x6fe9('0x37')][_0x6fe9('0x46')]){_0x432901[_0x6fe9('0x47')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x432901);})[_0x6fe9('0x18')](function(_0x32e55a){_0x444327[_0x6fe9('0x48')]=_0x32e55a;return _0x444327;})[_0x6fe9('0x18')](respondWithFilteredResult(_0x490ec3,_0x432901))['catch'](handleError(_0x490ec3,null));};exports[_0x6fe9('0x49')]=function(_0x9721ac,_0x3ebd77){var _0x1a4eeb={'raw':![],'where':{'id':_0x9721ac[_0x6fe9('0x4a')]['id']}},_0x1103ae={};_0x1103ae[_0x6fe9('0x36')]=_[_0x6fe9('0x38')](db[_0x6fe9('0x31')][_0x6fe9('0x32')]);_0x1103ae[_0x6fe9('0x37')]=_[_0x6fe9('0x38')](_0x9721ac[_0x6fe9('0x37')]);_0x1103ae[_0x6fe9('0x39')]=_[_0x6fe9('0x3a')](_0x1103ae['model'],_0x1103ae[_0x6fe9('0x37')]);_0x1a4eeb[_0x6fe9('0x3b')]=_[_0x6fe9('0x3a')](_0x1103ae[_0x6fe9('0x36')],qs[_0x6fe9('0x3c')](_0x9721ac[_0x6fe9('0x37')]['fields']));_0x1a4eeb[_0x6fe9('0x3b')]=_0x1a4eeb[_0x6fe9('0x3b')][_0x6fe9('0x3d')]?_0x1a4eeb['attributes']:_0x1103ae['model'];if(_0x9721ac[_0x6fe9('0x37')][_0x6fe9('0x46')]){_0x1a4eeb[_0x6fe9('0x47')]=[{'all':!![]}];}_0x1a4eeb=_[_0x6fe9('0x43')]({},_0x1a4eeb,_0x9721ac['options']);return db[_0x6fe9('0x31')][_0x6fe9('0x4b')](_0x1a4eeb)[_0x6fe9('0x18')](handleEntityNotFound(_0x3ebd77,null))[_0x6fe9('0x18')](respondWithResult(_0x3ebd77,null))['catch'](handleError(_0x3ebd77,null));};exports[_0x6fe9('0x4c')]=function(_0x294864,_0x4ebb59){return db[_0x6fe9('0x31')]['create'](_0x294864['body'],{})[_0x6fe9('0x18')](respondWithResult(_0x4ebb59,0xc9))[_0x6fe9('0x22')](handleError(_0x4ebb59,null));};exports[_0x6fe9('0x2b')]=function(_0x5b01cf,_0x52865e){if(_0x5b01cf[_0x6fe9('0x4d')]['id']){delete _0x5b01cf['body']['id'];}return db[_0x6fe9('0x31')][_0x6fe9('0x4b')]({'where':{'id':_0x5b01cf[_0x6fe9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52865e,null))[_0x6fe9('0x18')](saveUpdates(_0x5b01cf[_0x6fe9('0x4d')],null))[_0x6fe9('0x18')](respondWithResult(_0x52865e,null))['catch'](handleError(_0x52865e,null));};exports[_0x6fe9('0x2c')]=function(_0x544121,_0x5dcb10){return db['SugarcrmConfiguration'][_0x6fe9('0x4b')]({'where':{'id':_0x544121['params']['id']}})[_0x6fe9('0x18')](handleEntityNotFound(_0x5dcb10,null))[_0x6fe9('0x18')](removeEntity(_0x5dcb10,null))['catch'](handleError(_0x5dcb10,null));};exports[_0x6fe9('0x4e')]=function(_0x158ace,_0x4d2cdd,_0x274a47){var _0x2f1b79={};var _0x3cf0d3={};var _0x1d7f82;var _0x423dfc;return db[_0x6fe9('0x31')][_0x6fe9('0x4f')]({'where':{'id':_0x158ace['params']['id']}})[_0x6fe9('0x18')](handleEntityNotFound(_0x4d2cdd,null))[_0x6fe9('0x18')](function(_0x45810b){if(_0x45810b){_0x1d7f82=_0x45810b;_0x3cf0d3['model']=_[_0x6fe9('0x38')](db[_0x6fe9('0x50')][_0x6fe9('0x32')]);_0x3cf0d3['query']=_[_0x6fe9('0x38')](_0x158ace['query']);_0x3cf0d3['filters']=_[_0x6fe9('0x3a')](_0x3cf0d3[_0x6fe9('0x36')],_0x3cf0d3['query']);_0x2f1b79['attributes']=_['intersection'](_0x3cf0d3[_0x6fe9('0x36')],qs['fields'](_0x158ace[_0x6fe9('0x37')]['fields']));_0x2f1b79[_0x6fe9('0x3b')]=_0x2f1b79[_0x6fe9('0x3b')][_0x6fe9('0x3d')]?_0x2f1b79[_0x6fe9('0x3b')]:_0x3cf0d3[_0x6fe9('0x36')];_0x2f1b79['order']=qs[_0x6fe9('0x3f')](_0x158ace['query'][_0x6fe9('0x3f')]);_0x2f1b79['where']=qs['filters'](_['pick'](_0x158ace[_0x6fe9('0x37')],_0x3cf0d3[_0x6fe9('0x39')]));if(_0x158ace[_0x6fe9('0x37')][_0x6fe9('0x42')]){_0x2f1b79[_0x6fe9('0x40')]=_[_0x6fe9('0x43')](_0x2f1b79[_0x6fe9('0x40')],{'$or':_[_0x6fe9('0x30')](_0x2f1b79[_0x6fe9('0x3b')],function(_0xcadaf1){var _0x2d0cc5={};_0x2d0cc5[_0xcadaf1]={'$like':'%'+_0x158ace[_0x6fe9('0x37')][_0x6fe9('0x42')]+'%'};return _0x2d0cc5;})});}_0x2f1b79=_[_0x6fe9('0x43')]({},_0x2f1b79,_0x158ace[_0x6fe9('0x45')]);return _0x1d7f82['getFields'](_0x2f1b79);}})['then'](function(_0x32a34f){if(_0x32a34f){_0x423dfc=_0x32a34f[_0x6fe9('0x3d')];if(!_0x158ace['query'][_0x6fe9('0x51')](_0x6fe9('0x52'))){_0x2f1b79[_0x6fe9('0x28')]=qs['limit'](_0x158ace[_0x6fe9('0x37')][_0x6fe9('0x28')]);_0x2f1b79['offset']=qs[_0x6fe9('0x27')](_0x158ace[_0x6fe9('0x37')][_0x6fe9('0x27')]);}return _0x1d7f82[_0x6fe9('0x4e')](_0x2f1b79);}})['then'](function(_0x2ca3f4){if(_0x2ca3f4){return _0x2ca3f4?{'count':_0x423dfc,'rows':_0x2ca3f4}:null;}})[_0x6fe9('0x18')](respondWithResult(_0x4d2cdd,null))[_0x6fe9('0x22')](handleError(_0x4d2cdd,null));};exports[_0x6fe9('0x53')]=function(_0x3fa1cd,_0x13cbd4,_0x271bfa){var _0x5356a0={};var _0x37e503={};var _0x24c203;var _0x38e5e0;return db['SugarcrmConfiguration'][_0x6fe9('0x4f')]({'where':{'id':_0x3fa1cd[_0x6fe9('0x4a')]['id']}})[_0x6fe9('0x18')](handleEntityNotFound(_0x13cbd4,null))['then'](function(_0x14a0da){if(_0x14a0da){_0x24c203=_0x14a0da;_0x37e503['model']=_[_0x6fe9('0x38')](db['SugarcrmField'][_0x6fe9('0x32')]);_0x37e503[_0x6fe9('0x37')]=_[_0x6fe9('0x38')](_0x3fa1cd[_0x6fe9('0x37')]);_0x37e503[_0x6fe9('0x39')]=_[_0x6fe9('0x3a')](_0x37e503[_0x6fe9('0x36')],_0x37e503[_0x6fe9('0x37')]);_0x5356a0[_0x6fe9('0x3b')]=_[_0x6fe9('0x3a')](_0x37e503['model'],qs['fields'](_0x3fa1cd['query'][_0x6fe9('0x3c')]));_0x5356a0['attributes']=_0x5356a0['attributes'][_0x6fe9('0x3d')]?_0x5356a0[_0x6fe9('0x3b')]:_0x37e503[_0x6fe9('0x36')];_0x5356a0[_0x6fe9('0x3e')]=qs['sort'](_0x3fa1cd[_0x6fe9('0x37')][_0x6fe9('0x3f')]);_0x5356a0['where']=qs[_0x6fe9('0x39')](_[_0x6fe9('0x41')](_0x3fa1cd[_0x6fe9('0x37')],_0x37e503['filters']));if(_0x3fa1cd[_0x6fe9('0x37')][_0x6fe9('0x42')]){_0x5356a0[_0x6fe9('0x40')]=_[_0x6fe9('0x43')](_0x5356a0['where'],{'$or':_['map'](_0x5356a0[_0x6fe9('0x3b')],function(_0x5074e5){var _0x3cd4e9={};_0x3cd4e9[_0x5074e5]={'$like':'%'+_0x3fa1cd['query'][_0x6fe9('0x42')]+'%'};return _0x3cd4e9;})});}_0x5356a0=_[_0x6fe9('0x43')]({},_0x5356a0,_0x3fa1cd[_0x6fe9('0x45')]);return _0x24c203[_0x6fe9('0x53')](_0x5356a0);}})['then'](function(_0x3528a5){if(_0x3528a5){_0x38e5e0=_0x3528a5[_0x6fe9('0x3d')];if(!_0x3fa1cd[_0x6fe9('0x37')][_0x6fe9('0x51')](_0x6fe9('0x52'))){_0x5356a0['limit']=qs['limit'](_0x3fa1cd['query'][_0x6fe9('0x28')]);_0x5356a0['offset']=qs[_0x6fe9('0x27')](_0x3fa1cd[_0x6fe9('0x37')][_0x6fe9('0x27')]);}return _0x24c203[_0x6fe9('0x53')](_0x5356a0);}})['then'](function(_0x3bfbcd){if(_0x3bfbcd){return _0x3bfbcd?{'count':_0x38e5e0,'rows':_0x3bfbcd}:null;}})[_0x6fe9('0x18')](respondWithResult(_0x13cbd4,null))[_0x6fe9('0x22')](handleError(_0x13cbd4,null));};exports[_0x6fe9('0x54')]=function(_0x32497d,_0x38b329,_0x579371){var _0x10fced={};var _0x58881d={};var _0x15a3ca;var _0x354bab;return db[_0x6fe9('0x31')][_0x6fe9('0x4f')]({'where':{'id':_0x32497d[_0x6fe9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38b329,null))[_0x6fe9('0x18')](function(_0x1d5343){if(_0x1d5343){_0x15a3ca=_0x1d5343;_0x58881d['model']=_[_0x6fe9('0x38')](db[_0x6fe9('0x50')]['rawAttributes']);_0x58881d[_0x6fe9('0x37')]=_[_0x6fe9('0x38')](_0x32497d['query']);_0x58881d[_0x6fe9('0x39')]=_['intersection'](_0x58881d[_0x6fe9('0x36')],_0x58881d[_0x6fe9('0x37')]);_0x10fced[_0x6fe9('0x3b')]=_['intersection'](_0x58881d[_0x6fe9('0x36')],qs[_0x6fe9('0x3c')](_0x32497d[_0x6fe9('0x37')]['fields']));_0x10fced[_0x6fe9('0x3b')]=_0x10fced[_0x6fe9('0x3b')][_0x6fe9('0x3d')]?_0x10fced[_0x6fe9('0x3b')]:_0x58881d[_0x6fe9('0x36')];_0x10fced[_0x6fe9('0x3e')]=qs[_0x6fe9('0x3f')](_0x32497d[_0x6fe9('0x37')][_0x6fe9('0x3f')]);_0x10fced[_0x6fe9('0x40')]=qs[_0x6fe9('0x39')](_[_0x6fe9('0x41')](_0x32497d['query'],_0x58881d[_0x6fe9('0x39')]));if(_0x32497d[_0x6fe9('0x37')][_0x6fe9('0x42')]){_0x10fced['where']=_[_0x6fe9('0x43')](_0x10fced['where'],{'$or':_['map'](_0x10fced[_0x6fe9('0x3b')],function(_0x38015e){var _0x4fc1d1={};_0x4fc1d1[_0x38015e]={'$like':'%'+_0x32497d[_0x6fe9('0x37')]['filter']+'%'};return _0x4fc1d1;})});}_0x10fced=_['merge']({},_0x10fced,_0x32497d[_0x6fe9('0x45')]);return _0x15a3ca['getDescriptions'](_0x10fced);}})[_0x6fe9('0x18')](function(_0x50272d){if(_0x50272d){_0x354bab=_0x50272d[_0x6fe9('0x3d')];if(!_0x32497d['query'][_0x6fe9('0x51')](_0x6fe9('0x52'))){_0x10fced['limit']=qs['limit'](_0x32497d[_0x6fe9('0x37')]['limit']);_0x10fced[_0x6fe9('0x27')]=qs[_0x6fe9('0x27')](_0x32497d['query']['offset']);}return _0x15a3ca[_0x6fe9('0x54')](_0x10fced);}})['then'](function(_0x388085){if(_0x388085){return _0x388085?{'count':_0x354bab,'rows':_0x388085}:null;}})[_0x6fe9('0x18')](respondWithResult(_0x38b329,null))['catch'](handleError(_0x38b329,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 03e4845..e3327ee 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 _0xe477=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xe477,0xa1));var _0x7e47=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0xe477[_0x56d1ed];return _0x1b282b;};'use strict';var _=require('lodash');var util=require(_0x7e47('0x0'));var logger=require(_0x7e47('0x1'))(_0x7e47('0x2'));var moment=require(_0x7e47('0x3'));var BPromise=require(_0x7e47('0x4'));var rp=require(_0x7e47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e47('0x6'));var config=require(_0x7e47('0x7'));var attributes=require(_0x7e47('0x8'));module['exports']=function(_0x340a74,_0x343b13){return _0x340a74['define'](_0x7e47('0x9'),attributes,{'tableName':_0x7e47('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc964=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x3e6220,_0x3b4331){var _0x31b19c=function(_0x4bbaa4){while(--_0x4bbaa4){_0x3e6220['push'](_0x3e6220['shift']());}};_0x31b19c(++_0x3b4331);}(_0xc964,0xad));var _0x4c96=function(_0x45579c,_0x53df33){_0x45579c=_0x45579c-0x0;var _0x43d347=_0xc964[_0x45579c];return _0x43d347;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var logger=require(_0x4c96('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4c96('0x3'));var rp=require(_0x4c96('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c96('0x5'));var config=require(_0x4c96('0x6'));var attributes=require(_0x4c96('0x7'));module['exports']=function(_0x415846,_0x52a80c){return _0x415846[_0x4c96('0x8')](_0x4c96('0x9'),attributes,{'tableName':_0x4c96('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 2f67bce..2771e11 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 _0xbe0c=['../../config/logger','rpc','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a441,_0xf8b325){var _0x4962d4=function(_0x341031){while(--_0x341031){_0x20a441['push'](_0x20a441['shift']());}};_0x4962d4(++_0xf8b325);}(_0xbe0c,0xd0));var _0xcbe0=function(_0xf28958,_0x53f0ed){_0xf28958=_0xf28958-0x0;var _0x4a4ce4=_0xbe0c[_0xf28958];return _0x4a4ce4;};'use strict';var _=require(_0xcbe0('0x0'));var util=require(_0xcbe0('0x1'));var moment=require(_0xcbe0('0x2'));var BPromise=require(_0xcbe0('0x3'));var rs=require(_0xcbe0('0x4'));var fs=require('fs');var Redis=require(_0xcbe0('0x5'));var db=require(_0xcbe0('0x6'))['db'];var utils=require(_0xcbe0('0x7'));var logger=require(_0xcbe0('0x8'))(_0xcbe0('0x9'));var config=require('../../config/environment');var jayson=require(_0xcbe0('0xa'));var client=jayson[_0xcbe0('0xb')][_0xcbe0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c17c6,_0x2a69c9,_0x2780e4){return new BPromise(function(_0x542c96,_0x3de2bb){return client[_0xcbe0('0xd')](_0x5c17c6,_0x2780e4)['then'](function(_0x18af4f){logger[_0xcbe0('0xe')](_0xcbe0('0xf'),_0x2a69c9,_0xcbe0('0x10'));logger[_0xcbe0('0x11')](_0xcbe0('0x12'),_0x2a69c9,'request\x20sent',JSON[_0xcbe0('0x13')](_0x18af4f));if(_0x18af4f[_0xcbe0('0x14')]){if(_0x18af4f[_0xcbe0('0x14')][_0xcbe0('0x15')]===0x1f4){logger[_0xcbe0('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a69c9,_0x18af4f[_0xcbe0('0x14')][_0xcbe0('0x16')]);return _0x3de2bb(_0x18af4f[_0xcbe0('0x14')]['message']);}logger[_0xcbe0('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a69c9,_0x18af4f[_0xcbe0('0x14')][_0xcbe0('0x16')]);return _0x542c96(_0x18af4f[_0xcbe0('0x14')][_0xcbe0('0x16')]);}else{logger[_0xcbe0('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a69c9,_0xcbe0('0x10'));_0x542c96(_0x18af4f['result']['message']);}})[_0xcbe0('0x17')](function(_0x5ea99b){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a69c9,_0x5ea99b);_0x3de2bb(_0x5ea99b);});});} \ No newline at end of file +var _0xe60e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring'];(function(_0x2c4440,_0x4fe366){var _0x20f1dd=function(_0x7495a5){while(--_0x7495a5){_0x2c4440['push'](_0x2c4440['shift']());}};_0x20f1dd(++_0x4fe366);}(_0xe60e,0x16d));var _0xee60=function(_0x28abe3,_0x35a411){_0x28abe3=_0x28abe3-0x0;var _0x5b1192=_0xe60e[_0x28abe3];return _0x5b1192;};'use strict';var _=require('lodash');var util=require(_0xee60('0x0'));var moment=require(_0xee60('0x1'));var BPromise=require('bluebird');var rs=require(_0xee60('0x2'));var fs=require('fs');var Redis=require(_0xee60('0x3'));var db=require(_0xee60('0x4'))['db'];var utils=require(_0xee60('0x5'));var logger=require(_0xee60('0x6'))(_0xee60('0x7'));var config=require(_0xee60('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xee60('0x9')][_0xee60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa82001,_0x1934ba,_0x53af12){return new BPromise(function(_0x521ef5,_0x3cdb7f){return client[_0xee60('0xb')](_0xa82001,_0x53af12)[_0xee60('0xc')](function(_0x3315af){logger[_0xee60('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1934ba,_0xee60('0xe'));logger[_0xee60('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1934ba,_0xee60('0xe'),JSON[_0xee60('0x10')](_0x3315af));if(_0x3315af[_0xee60('0x11')]){if(_0x3315af[_0xee60('0x11')][_0xee60('0x12')]===0x1f4){logger[_0xee60('0x11')](_0xee60('0x13'),_0x1934ba,_0x3315af[_0xee60('0x11')][_0xee60('0x14')]);return _0x3cdb7f(_0x3315af[_0xee60('0x11')]['message']);}logger[_0xee60('0x11')](_0xee60('0x13'),_0x1934ba,_0x3315af[_0xee60('0x11')][_0xee60('0x14')]);return _0x521ef5(_0x3315af[_0xee60('0x11')][_0xee60('0x14')]);}else{logger[_0xee60('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1934ba,'request\x20sent');_0x521ef5(_0x3315af[_0xee60('0x15')][_0xee60('0x14')]);}})[_0xee60('0x16')](function(_0x5e9199){logger[_0xee60('0x11')](_0xee60('0x13'),_0x1934ba,_0x5e9199);_0x3cdb7f(_0x5e9199);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 703f038..09ff96b 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 _0x63e1=['express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','multer','util','connect-timeout'];(function(_0x5e4732,_0x1b3817){var _0x45182d=function(_0x2a4058){while(--_0x2a4058){_0x5e4732['push'](_0x5e4732['shift']());}};_0x45182d(++_0x1b3817);}(_0x63e1,0x6d));var _0x163e=function(_0x85d3b0,_0xb0205){_0x85d3b0=_0x85d3b0-0x0;var _0x492cf5=_0x63e1[_0x85d3b0];return _0x492cf5;};'use strict';var multer=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var path=require('path');var timeout=require(_0x163e('0x2'));var express=require(_0x163e('0x3'));var router=express[_0x163e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x163e('0x5'));var interaction=require(_0x163e('0x6'));var config=require('../../config/environment');var controller=require(_0x163e('0x7'));router[_0x163e('0x8')]('/',auth[_0x163e('0x9')](),controller['index']);router[_0x163e('0x8')](_0x163e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x163e('0xb')]('/',auth['isAuthenticated'](),controller[_0x163e('0xc')]);router[_0x163e('0xd')]('/:id',auth[_0x163e('0x9')](),controller['update']);router[_0x163e('0xe')](_0x163e('0xa'),auth[_0x163e('0x9')](),controller[_0x163e('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa567=['../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','path','connect-timeout','express','../../components/interaction/service'];(function(_0x43ea63,_0x2ed6ab){var _0x467805=function(_0x390087){while(--_0x390087){_0x43ea63['push'](_0x43ea63['shift']());}};_0x467805(++_0x2ed6ab);}(_0xa567,0x119));var _0x7a56=function(_0x4f07ab,_0x1e3d8d){_0x4f07ab=_0x4f07ab-0x0;var _0x13c3a5=_0xa567[_0x4f07ab];return _0x13c3a5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7a56('0x0'));var timeout=require(_0x7a56('0x1'));var express=require(_0x7a56('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7a56('0x3'));var config=require(_0x7a56('0x4'));var controller=require('./intSugarcrmField.controller');router[_0x7a56('0x5')]('/',auth['isAuthenticated'](),controller[_0x7a56('0x6')]);router['get'](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x9')]);router[_0x7a56('0xa')]('/',auth[_0x7a56('0x8')](),controller[_0x7a56('0xb')]);router['put'](_0x7a56('0x7'),auth['isAuthenticated'](),controller[_0x7a56('0xc')]);router[_0x7a56('0xd')](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index c664eb0..4606c9f 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 _0x2dae=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0x2dae,0xc3));var _0xe2da=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x2dae[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'type':{'type':Sequelize[_0xe2da('0x1')](_0xe2da('0x2'),_0xe2da('0x3'),_0xe2da('0x4'),_0xe2da('0x5'),'picklist'),'defaultValue':_0xe2da('0x2')},'content':{'type':Sequelize[_0xe2da('0x6')]},'key':{'type':Sequelize[_0xe2da('0x6')]},'keyType':{'type':Sequelize[_0xe2da('0x1')]('string',_0xe2da('0x3'),_0xe2da('0x4'))},'keyContent':{'type':Sequelize[_0xe2da('0x6')]},'idField':{'type':Sequelize[_0xe2da('0x6')]},'nameField':{'type':Sequelize[_0xe2da('0x6')]},'customField':{'type':Sequelize[_0xe2da('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe2da('0x6')]}}; \ No newline at end of file +var _0xe5b3=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0xa4fb21,_0x301fee){var _0x4e1d37=function(_0x3ca754){while(--_0x3ca754){_0xa4fb21['push'](_0xa4fb21['shift']());}};_0x4e1d37(++_0x301fee);}(_0xe5b3,0x133));var _0x3e5b=function(_0x51c932,_0x3efdc5){_0x51c932=_0x51c932-0x0;var _0x2d8cb0=_0xe5b3[_0x51c932];return _0x2d8cb0;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'type':{'type':Sequelize[_0x3e5b('0x1')](_0x3e5b('0x2'),_0x3e5b('0x3'),_0x3e5b('0x4'),_0x3e5b('0x5'),_0x3e5b('0x6')),'defaultValue':_0x3e5b('0x2')},'content':{'type':Sequelize[_0x3e5b('0x7')]},'key':{'type':Sequelize[_0x3e5b('0x7')]},'keyType':{'type':Sequelize[_0x3e5b('0x1')]('string',_0x3e5b('0x3'),_0x3e5b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3e5b('0x7')]},'nameField':{'type':Sequelize[_0x3e5b('0x7')]},'customField':{'type':Sequelize[_0x3e5b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e5b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 9ab1f8e..45593c5 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 _0x0d57=['filter','options','includeAll','include','findAll','rows','catch','show','keys','fields','length','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','query','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','filters','where','merge','type','VIRTUAL'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x0d57,0x143));var _0x70d5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0d57[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x70d5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x70d5('0x1'));var zipdir=require(_0x70d5('0x2'));var jsonpatch=require(_0x70d5('0x3'));var rp=require(_0x70d5('0x4'));var moment=require(_0x70d5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x70d5('0x6'));var path=require('path');var sox=require(_0x70d5('0x7'));var csv=require(_0x70d5('0x8'));var ejs=require(_0x70d5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70d5('0xa'));var squel=require('squel');var crypto=require(_0x70d5('0xb'));var jsforce=require(_0x70d5('0xc'));var deskjs=require(_0x70d5('0xd'));var toCsv=require(_0x70d5('0x8'));var querystring=require(_0x70d5('0xe'));var Papa=require(_0x70d5('0xf'));var Redis=require(_0x70d5('0x10'));var authService=require(_0x70d5('0x11'));var qs=require(_0x70d5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70d5('0x13'));var logger=require(_0x70d5('0x14'))(_0x70d5('0x15'));var utils=require(_0x70d5('0x16'));var config=require(_0x70d5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x70d5('0x18'))['db'];function respondWithStatusCode(_0x3583e3,_0x3306d7){_0x3306d7=_0x3306d7||0xcc;return function(_0xfa26bc){if(_0xfa26bc){return _0x3583e3[_0x70d5('0x19')](_0x3306d7);}return _0x3583e3[_0x70d5('0x1a')](_0x3306d7)[_0x70d5('0x1b')]();};}function respondWithResult(_0x450f2b,_0x50d4a9){_0x50d4a9=_0x50d4a9||0xc8;return function(_0x5bbbc3){if(_0x5bbbc3){return _0x450f2b[_0x70d5('0x1a')](_0x50d4a9)[_0x70d5('0x1c')](_0x5bbbc3);}};}function respondWithFilteredResult(_0xb94786,_0x392064){return function(_0x25f513){if(_0x25f513){var _0x3d9aa6=_0x25f513[_0x70d5('0x1d')],_0x5021dc=_0x392064[_0x70d5('0x1e')],_0x413b0c=_0x392064['offset']+_0x392064[_0x70d5('0x1f')],_0x12340a;if(_0x413b0c>=_0x3d9aa6){_0x413b0c=_0x3d9aa6;_0x12340a=0xc8;}else{_0x12340a=0xce;}_0xb94786['status'](_0x12340a);return _0xb94786[_0x70d5('0x20')](_0x70d5('0x21'),_0x5021dc+'-'+_0x413b0c+'/'+_0x3d9aa6)[_0x70d5('0x1c')](_0x25f513);}return null;};}function patchUpdates(_0x2d87e1){return function(_0x45034c){try{jsonpatch['apply'](_0x45034c,_0x2d87e1,!![]);}catch(_0xccaa51){return BPromise[_0x70d5('0x22')](_0xccaa51);}return _0x45034c[_0x70d5('0x23')]();};}function saveUpdates(_0x1eb94e,_0x1cfdf5){return function(_0x21cb24){if(_0x21cb24){return _0x21cb24[_0x70d5('0x24')](_0x1eb94e)[_0x70d5('0x25')](function(_0x5415a7){return _0x5415a7;});}return null;};}function removeEntity(_0x2c48cc,_0xc5a9fc){return function(_0x5cd168){if(_0x5cd168){return _0x5cd168[_0x70d5('0x26')]()[_0x70d5('0x25')](function(){_0x2c48cc[_0x70d5('0x1a')](0xcc)[_0x70d5('0x1b')]();});}};}function handleEntityNotFound(_0x1f085f,_0x59afd6){return function(_0x241da4){if(!_0x241da4){_0x1f085f['sendStatus'](0x194);}return _0x241da4;};}function handleError(_0x6bc540,_0x371296){_0x371296=_0x371296||0x1f4;return function(_0x5e7b14){logger[_0x70d5('0x27')](_0x5e7b14[_0x70d5('0x28')]);if(_0x5e7b14['name']){delete _0x5e7b14[_0x70d5('0x29')];}_0x6bc540['status'](_0x371296)[_0x70d5('0x2a')](_0x5e7b14);};}exports[_0x70d5('0x2b')]=function(_0x5c276e,_0x111ab1){var _0x4dde44={},_0x1fac90={},_0x3d60b9={'count':0x0,'rows':[]};var _0x1cddb7=_[_0x70d5('0x2c')](db[_0x70d5('0x2d')][_0x70d5('0x2e')],function(_0x4c88eb){return{'name':_0x4c88eb[_0x70d5('0x2f')],'type':_0x4c88eb['type'][_0x70d5('0x30')]};});_0x1fac90['model']=_[_0x70d5('0x2c')](_0x1cddb7,'name');_0x1fac90[_0x70d5('0x31')]=_['keys'](_0x5c276e[_0x70d5('0x31')]);_0x1fac90['filters']=_['intersection'](_0x1fac90[_0x70d5('0x32')],_0x1fac90['query']);_0x4dde44[_0x70d5('0x33')]=_[_0x70d5('0x34')](_0x1fac90[_0x70d5('0x32')],qs['fields'](_0x5c276e[_0x70d5('0x31')]['fields']));_0x4dde44[_0x70d5('0x33')]=_0x4dde44[_0x70d5('0x33')]['length']?_0x4dde44[_0x70d5('0x33')]:_0x1fac90[_0x70d5('0x32')];if(!_0x5c276e['query'][_0x70d5('0x35')](_0x70d5('0x36'))){_0x4dde44[_0x70d5('0x1f')]=qs[_0x70d5('0x1f')](_0x5c276e[_0x70d5('0x31')][_0x70d5('0x1f')]);_0x4dde44['offset']=qs['offset'](_0x5c276e['query']['offset']);}_0x4dde44[_0x70d5('0x37')]=qs[_0x70d5('0x38')](_0x5c276e[_0x70d5('0x31')][_0x70d5('0x38')]);_0x4dde44['where']=qs[_0x70d5('0x39')](_['pick'](_0x5c276e[_0x70d5('0x31')],_0x1fac90['filters']),_0x1cddb7);if(_0x5c276e[_0x70d5('0x31')]['filter']){_0x4dde44[_0x70d5('0x3a')]=_[_0x70d5('0x3b')](_0x4dde44[_0x70d5('0x3a')],{'$or':_[_0x70d5('0x2c')](_0x1cddb7,function(_0x4a5598){if(_0x4a5598[_0x70d5('0x3c')]!==_0x70d5('0x3d')){var _0x3c1492={};_0x3c1492[_0x4a5598[_0x70d5('0x29')]]={'$like':'%'+_0x5c276e['query'][_0x70d5('0x3e')]+'%'};return _0x3c1492;}})});}_0x4dde44=_[_0x70d5('0x3b')]({},_0x4dde44,_0x5c276e[_0x70d5('0x3f')]);var _0xd3a2a5={'where':_0x4dde44[_0x70d5('0x3a')]};return db['SugarcrmField'][_0x70d5('0x1d')](_0xd3a2a5)['then'](function(_0x472473){_0x3d60b9['count']=_0x472473;if(_0x5c276e[_0x70d5('0x31')][_0x70d5('0x40')]){_0x4dde44[_0x70d5('0x41')]=[{'all':!![]}];}return db[_0x70d5('0x2d')][_0x70d5('0x42')](_0x4dde44);})[_0x70d5('0x25')](function(_0x28bdfd){_0x3d60b9[_0x70d5('0x43')]=_0x28bdfd;return _0x3d60b9;})[_0x70d5('0x25')](respondWithFilteredResult(_0x111ab1,_0x4dde44))[_0x70d5('0x44')](handleError(_0x111ab1,null));};exports[_0x70d5('0x45')]=function(_0x8f1327,_0x533162){var _0x1aeae5={'raw':!![],'where':{'id':_0x8f1327['params']['id']}},_0x6c8135={};_0x6c8135[_0x70d5('0x32')]=_[_0x70d5('0x46')](db['SugarcrmField'][_0x70d5('0x2e')]);_0x6c8135['query']=_[_0x70d5('0x46')](_0x8f1327['query']);_0x6c8135['filters']=_[_0x70d5('0x34')](_0x6c8135[_0x70d5('0x32')],_0x6c8135['query']);_0x1aeae5[_0x70d5('0x33')]=_[_0x70d5('0x34')](_0x6c8135[_0x70d5('0x32')],qs[_0x70d5('0x47')](_0x8f1327[_0x70d5('0x31')][_0x70d5('0x47')]));_0x1aeae5[_0x70d5('0x33')]=_0x1aeae5[_0x70d5('0x33')][_0x70d5('0x48')]?_0x1aeae5[_0x70d5('0x33')]:_0x6c8135[_0x70d5('0x32')];if(_0x8f1327[_0x70d5('0x31')][_0x70d5('0x40')]){_0x1aeae5[_0x70d5('0x41')]=[{'all':!![]}];}_0x1aeae5=_['merge']({},_0x1aeae5,_0x8f1327[_0x70d5('0x3f')]);return db[_0x70d5('0x2d')][_0x70d5('0x49')](_0x1aeae5)[_0x70d5('0x25')](handleEntityNotFound(_0x533162,null))[_0x70d5('0x25')](respondWithResult(_0x533162,null))['catch'](handleError(_0x533162,null));};exports[_0x70d5('0x4a')]=function(_0x506060,_0x3b0579){return db[_0x70d5('0x2d')][_0x70d5('0x4a')](_0x506060[_0x70d5('0x4b')],{})['then'](respondWithResult(_0x3b0579,0xc9))[_0x70d5('0x44')](handleError(_0x3b0579,null));};exports[_0x70d5('0x24')]=function(_0x5c9498,_0x5832cf){if(_0x5c9498[_0x70d5('0x4b')]['id']){delete _0x5c9498['body']['id'];}return db[_0x70d5('0x2d')][_0x70d5('0x49')]({'where':{'id':_0x5c9498[_0x70d5('0x4c')]['id']}})[_0x70d5('0x25')](handleEntityNotFound(_0x5832cf,null))['then'](saveUpdates(_0x5c9498[_0x70d5('0x4b')],null))[_0x70d5('0x25')](respondWithResult(_0x5832cf,null))[_0x70d5('0x44')](handleError(_0x5832cf,null));};exports['destroy']=function(_0x431228,_0x5b05df){return db['SugarcrmField'][_0x70d5('0x49')]({'where':{'id':_0x431228['params']['id']}})[_0x70d5('0x25')](handleEntityNotFound(_0x5b05df,null))['then'](removeEntity(_0x5b05df,null))[_0x70d5('0x44')](handleError(_0x5b05df,null));}; \ No newline at end of file +var _0xe948=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','show','params','keys','length','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x174e6b,_0x124a26){var _0x10ab0e=function(_0x704225){while(--_0x704225){_0x174e6b['push'](_0x174e6b['shift']());}};_0x10ab0e(++_0x124a26);}(_0xe948,0xcf));var _0x8e94=function(_0x1d1eaf,_0x114e64){_0x1d1eaf=_0x1d1eaf-0x0;var _0x3bd31b=_0xe948[_0x1d1eaf];return _0x3bd31b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8e94('0x0'));var rimraf=require(_0x8e94('0x1'));var zipdir=require(_0x8e94('0x2'));var jsonpatch=require(_0x8e94('0x3'));var rp=require(_0x8e94('0x4'));var moment=require('moment');var BPromise=require(_0x8e94('0x5'));var Mustache=require('mustache');var util=require(_0x8e94('0x6'));var path=require(_0x8e94('0x7'));var sox=require(_0x8e94('0x8'));var csv=require(_0x8e94('0x9'));var ejs=require(_0x8e94('0xa'));var fs=require('fs');var fs_extra=require(_0x8e94('0xb'));var _=require(_0x8e94('0xc'));var squel=require('squel');var crypto=require(_0x8e94('0xd'));var jsforce=require(_0x8e94('0xe'));var deskjs=require(_0x8e94('0xf'));var toCsv=require(_0x8e94('0x9'));var querystring=require('querystring');var Papa=require(_0x8e94('0x10'));var Redis=require(_0x8e94('0x11'));var authService=require(_0x8e94('0x12'));var qs=require(_0x8e94('0x13'));var as=require(_0x8e94('0x14'));var hardwareService=require(_0x8e94('0x15'));var logger=require(_0x8e94('0x16'))(_0x8e94('0x17'));var utils=require('../../config/utils');var config=require(_0x8e94('0x18'));var licenseUtil=require(_0x8e94('0x19'));var db=require(_0x8e94('0x1a'))['db'];function respondWithStatusCode(_0x8a198f,_0x266c1a){_0x266c1a=_0x266c1a||0xcc;return function(_0x50c8ec){if(_0x50c8ec){return _0x8a198f['sendStatus'](_0x266c1a);}return _0x8a198f[_0x8e94('0x1b')](_0x266c1a)[_0x8e94('0x1c')]();};}function respondWithResult(_0x54ddee,_0x408557){_0x408557=_0x408557||0xc8;return function(_0x45cc67){if(_0x45cc67){return _0x54ddee['status'](_0x408557)[_0x8e94('0x1d')](_0x45cc67);}};}function respondWithFilteredResult(_0x3c9484,_0xb76f77){return function(_0x2e610c){if(_0x2e610c){var _0x34a680=_0x2e610c[_0x8e94('0x1e')],_0x382d8b=_0xb76f77[_0x8e94('0x1f')],_0x109725=_0xb76f77[_0x8e94('0x1f')]+_0xb76f77[_0x8e94('0x20')],_0x33cd41;if(_0x109725>=_0x34a680){_0x109725=_0x34a680;_0x33cd41=0xc8;}else{_0x33cd41=0xce;}_0x3c9484[_0x8e94('0x1b')](_0x33cd41);return _0x3c9484[_0x8e94('0x21')](_0x8e94('0x22'),_0x382d8b+'-'+_0x109725+'/'+_0x34a680)[_0x8e94('0x1d')](_0x2e610c);}return null;};}function patchUpdates(_0x19beb4){return function(_0x312ccf){try{jsonpatch[_0x8e94('0x23')](_0x312ccf,_0x19beb4,!![]);}catch(_0xed96e6){return BPromise[_0x8e94('0x24')](_0xed96e6);}return _0x312ccf[_0x8e94('0x25')]();};}function saveUpdates(_0x4859a0,_0x227ca1){return function(_0x1cd2b7){if(_0x1cd2b7){return _0x1cd2b7[_0x8e94('0x26')](_0x4859a0)[_0x8e94('0x27')](function(_0x30138f){return _0x30138f;});}return null;};}function removeEntity(_0x528225,_0x16f3fd){return function(_0x476013){if(_0x476013){return _0x476013[_0x8e94('0x28')]()[_0x8e94('0x27')](function(){_0x528225['status'](0xcc)[_0x8e94('0x1c')]();});}};}function handleEntityNotFound(_0x4a2184,_0x24750e){return function(_0x3c896d){if(!_0x3c896d){_0x4a2184[_0x8e94('0x29')](0x194);}return _0x3c896d;};}function handleError(_0x27a712,_0x4a5879){_0x4a5879=_0x4a5879||0x1f4;return function(_0xc5f2b7){logger[_0x8e94('0x2a')](_0xc5f2b7[_0x8e94('0x2b')]);if(_0xc5f2b7['name']){delete _0xc5f2b7[_0x8e94('0x2c')];}_0x27a712[_0x8e94('0x1b')](_0x4a5879)[_0x8e94('0x2d')](_0xc5f2b7);};}exports[_0x8e94('0x2e')]=function(_0x282e9e,_0x4d615e){var _0x31e030={},_0x24fef1={},_0x5a391f={'count':0x0,'rows':[]};var _0x4c8fca=_[_0x8e94('0x2f')](db[_0x8e94('0x30')][_0x8e94('0x31')],function(_0x28b5fa){return{'name':_0x28b5fa[_0x8e94('0x32')],'type':_0x28b5fa[_0x8e94('0x33')][_0x8e94('0x34')]};});_0x24fef1['model']=_[_0x8e94('0x2f')](_0x4c8fca,_0x8e94('0x2c'));_0x24fef1['query']=_['keys'](_0x282e9e[_0x8e94('0x35')]);_0x24fef1[_0x8e94('0x36')]=_['intersection'](_0x24fef1[_0x8e94('0x37')],_0x24fef1[_0x8e94('0x35')]);_0x31e030[_0x8e94('0x38')]=_[_0x8e94('0x39')](_0x24fef1[_0x8e94('0x37')],qs[_0x8e94('0x3a')](_0x282e9e[_0x8e94('0x35')][_0x8e94('0x3a')]));_0x31e030['attributes']=_0x31e030[_0x8e94('0x38')]['length']?_0x31e030[_0x8e94('0x38')]:_0x24fef1[_0x8e94('0x37')];if(!_0x282e9e[_0x8e94('0x35')][_0x8e94('0x3b')](_0x8e94('0x3c'))){_0x31e030[_0x8e94('0x20')]=qs[_0x8e94('0x20')](_0x282e9e['query'][_0x8e94('0x20')]);_0x31e030[_0x8e94('0x1f')]=qs[_0x8e94('0x1f')](_0x282e9e['query'][_0x8e94('0x1f')]);}_0x31e030[_0x8e94('0x3d')]=qs[_0x8e94('0x3e')](_0x282e9e['query'][_0x8e94('0x3e')]);_0x31e030[_0x8e94('0x3f')]=qs['filters'](_[_0x8e94('0x40')](_0x282e9e['query'],_0x24fef1[_0x8e94('0x36')]),_0x4c8fca);if(_0x282e9e[_0x8e94('0x35')]['filter']){_0x31e030[_0x8e94('0x3f')]=_['merge'](_0x31e030['where'],{'$or':_[_0x8e94('0x2f')](_0x4c8fca,function(_0x48aa4e){if(_0x48aa4e['type']!==_0x8e94('0x41')){var _0x3d0b53={};_0x3d0b53[_0x48aa4e[_0x8e94('0x2c')]]={'$like':'%'+_0x282e9e[_0x8e94('0x35')][_0x8e94('0x42')]+'%'};return _0x3d0b53;}})});}_0x31e030=_[_0x8e94('0x43')]({},_0x31e030,_0x282e9e['options']);var _0x2bc8cd={'where':_0x31e030['where']};return db['SugarcrmField'][_0x8e94('0x1e')](_0x2bc8cd)[_0x8e94('0x27')](function(_0xf6badd){_0x5a391f[_0x8e94('0x1e')]=_0xf6badd;if(_0x282e9e[_0x8e94('0x35')][_0x8e94('0x44')]){_0x31e030[_0x8e94('0x45')]=[{'all':!![]}];}return db[_0x8e94('0x30')][_0x8e94('0x46')](_0x31e030);})[_0x8e94('0x27')](function(_0x3b36bf){_0x5a391f['rows']=_0x3b36bf;return _0x5a391f;})[_0x8e94('0x27')](respondWithFilteredResult(_0x4d615e,_0x31e030))['catch'](handleError(_0x4d615e,null));};exports[_0x8e94('0x47')]=function(_0x578466,_0x15a3e9){var _0x20d6a2={'raw':!![],'where':{'id':_0x578466[_0x8e94('0x48')]['id']}},_0x3ac096={};_0x3ac096['model']=_[_0x8e94('0x49')](db[_0x8e94('0x30')][_0x8e94('0x31')]);_0x3ac096[_0x8e94('0x35')]=_[_0x8e94('0x49')](_0x578466[_0x8e94('0x35')]);_0x3ac096[_0x8e94('0x36')]=_[_0x8e94('0x39')](_0x3ac096[_0x8e94('0x37')],_0x3ac096['query']);_0x20d6a2[_0x8e94('0x38')]=_['intersection'](_0x3ac096[_0x8e94('0x37')],qs[_0x8e94('0x3a')](_0x578466[_0x8e94('0x35')][_0x8e94('0x3a')]));_0x20d6a2['attributes']=_0x20d6a2[_0x8e94('0x38')][_0x8e94('0x4a')]?_0x20d6a2[_0x8e94('0x38')]:_0x3ac096[_0x8e94('0x37')];if(_0x578466[_0x8e94('0x35')][_0x8e94('0x44')]){_0x20d6a2['include']=[{'all':!![]}];}_0x20d6a2=_[_0x8e94('0x43')]({},_0x20d6a2,_0x578466['options']);return db['SugarcrmField']['find'](_0x20d6a2)[_0x8e94('0x27')](handleEntityNotFound(_0x15a3e9,null))[_0x8e94('0x27')](respondWithResult(_0x15a3e9,null))['catch'](handleError(_0x15a3e9,null));};exports[_0x8e94('0x4b')]=function(_0x411453,_0x5b430f){return db['SugarcrmField']['create'](_0x411453[_0x8e94('0x4c')],{})['then'](respondWithResult(_0x5b430f,0xc9))[_0x8e94('0x4d')](handleError(_0x5b430f,null));};exports[_0x8e94('0x26')]=function(_0x477fdc,_0x3bd167){if(_0x477fdc[_0x8e94('0x4c')]['id']){delete _0x477fdc[_0x8e94('0x4c')]['id'];}return db[_0x8e94('0x30')][_0x8e94('0x4e')]({'where':{'id':_0x477fdc[_0x8e94('0x48')]['id']}})[_0x8e94('0x27')](handleEntityNotFound(_0x3bd167,null))[_0x8e94('0x27')](saveUpdates(_0x477fdc[_0x8e94('0x4c')],null))[_0x8e94('0x27')](respondWithResult(_0x3bd167,null))['catch'](handleError(_0x3bd167,null));};exports['destroy']=function(_0x10ca9e,_0x11c723){return db['SugarcrmField']['find']({'where':{'id':_0x10ca9e[_0x8e94('0x48')]['id']}})['then'](handleEntityNotFound(_0x11c723,null))[_0x8e94('0x27')](removeEntity(_0x11c723,null))[_0x8e94('0x4d')](handleError(_0x11c723,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ee6afff..4d4ea12 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 _0x73a2=['sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields'];(function(_0x4bbffb,_0x107d37){var _0x4e6dbd=function(_0x6b7581){while(--_0x6b7581){_0x4bbffb['push'](_0x4bbffb['shift']());}};_0x4e6dbd(++_0x107d37);}(_0x73a2,0x1c3));var _0x273a=function(_0x37db47,_0x565fa0){_0x37db47=_0x37db47-0x0;var _0x27526a=_0x73a2[_0x37db47];return _0x27526a;};'use strict';var _=require('lodash');var util=require(_0x273a('0x0'));var logger=require(_0x273a('0x1'))(_0x273a('0x2'));var moment=require(_0x273a('0x3'));var BPromise=require(_0x273a('0x4'));var rp=require(_0x273a('0x5'));var fs=require('fs');var path=require(_0x273a('0x6'));var rimraf=require('rimraf');var config=require(_0x273a('0x7'));var attributes=require(_0x273a('0x8'));module['exports']=function(_0x15f882,_0x578864){return _0x15f882['define'](_0x273a('0x9'),attributes,{'tableName':_0x273a('0xa'),'paranoid':![],'indexes':[{'name':_0x273a('0xb'),'fields':[_0x273a('0xc'),_0x273a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa200=['int_sugarcrm_fields','FieldId','lodash','util','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x219658,_0x537467){var _0x258214=function(_0xb939e1){while(--_0xb939e1){_0x219658['push'](_0x219658['shift']());}};_0x258214(++_0x537467);}(_0xa200,0xdf));var _0x0a20=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa200[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x0a20('0x0'));var util=require(_0x0a20('0x1'));var logger=require('../../config/logger')(_0x0a20('0x2'));var moment=require('moment');var BPromise=require(_0x0a20('0x3'));var rp=require(_0x0a20('0x4'));var fs=require('fs');var path=require(_0x0a20('0x5'));var rimraf=require('rimraf');var config=require(_0x0a20('0x6'));var attributes=require(_0x0a20('0x7'));module[_0x0a20('0x8')]=function(_0x5be0b0,_0x1f91b3){return _0x5be0b0[_0x0a20('0x9')](_0x0a20('0xa'),attributes,{'tableName':_0x0a20('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x0a20('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 5cfe141..6d96324 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x554634,_0x1048d2){var _0x4f1a08=function(_0x2be861){while(--_0x2be861){_0x554634['push'](_0x554634['shift']());}};_0x4f1a08(++_0x1048d2);}(_0x14a0,0x8e));var _0x014a=function(_0x10235a,_0xd393e9){_0x10235a=_0x10235a-0x0;var _0x4c4728=_0x14a0[_0x10235a];return _0x4c4728;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _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(_0x24a6bc,_0x4074a6){var _0xb06138=function(_0x21ed79){while(--_0x21ed79){_0x24a6bc['push'](_0x24a6bc['shift']());}};_0xb06138(++_0x4074a6);}(_0xda2d,0x102));var _0xdda2=function(_0x37efb5,_0x12efba){_0x37efb5=_0x37efb5-0x0;var _0x16d423=_0xda2d[_0x37efb5];return _0x16d423;};'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 9dc7ab3..0dc8812 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 _0x5f50=['index','/:id','getConfigurations','/:id/fields','create','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x1141b9,_0x296033){var _0x2bddbb=function(_0x30c77d){while(--_0x30c77d){_0x1141b9['push'](_0x1141b9['shift']());}};_0x2bddbb(++_0x296033);}(_0x5f50,0xbb));var _0x05f5=function(_0x55e645,_0x2e8017){_0x55e645=_0x55e645-0x0;var _0x34c1c3=_0x5f50[_0x55e645];return _0x34c1c3;};'use strict';var multer=require(_0x05f5('0x0'));var util=require(_0x05f5('0x1'));var path=require(_0x05f5('0x2'));var timeout=require(_0x05f5('0x3'));var express=require(_0x05f5('0x4'));var router=express[_0x05f5('0x5')]();var fs_extra=require(_0x05f5('0x6'));var auth=require(_0x05f5('0x7'));var interaction=require(_0x05f5('0x8'));var config=require(_0x05f5('0x9'));var controller=require(_0x05f5('0xa'));router[_0x05f5('0xb')]('/',auth[_0x05f5('0xc')](),controller[_0x05f5('0xd')]);router[_0x05f5('0xb')](_0x05f5('0xe'),auth[_0x05f5('0xc')](),controller['show']);router[_0x05f5('0xb')]('/:id/configurations',auth[_0x05f5('0xc')](),controller[_0x05f5('0xf')]);router[_0x05f5('0xb')](_0x05f5('0x10'),auth[_0x05f5('0xc')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x05f5('0x11')]);router[_0x05f5('0x12')](_0x05f5('0x13'),auth[_0x05f5('0xc')](),controller[_0x05f5('0x14')]);router[_0x05f5('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x05f5('0x16')](_0x05f5('0xe'),auth[_0x05f5('0xc')](),controller[_0x05f5('0x17')]);module[_0x05f5('0x18')]=router; \ No newline at end of file +var _0xb81e=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','/:id','update','delete','destroy','exports','Router','fs-extra'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xb81e,0xc6));var _0xeb81=function(_0x4382f9,_0x1c3641){_0x4382f9=_0x4382f9-0x0;var _0x50b785=_0xb81e[_0x4382f9];return _0x50b785;};'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[_0xeb81('0x0')]();var fs_extra=require(_0xeb81('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0xeb81('0x2'));var config=require(_0xeb81('0x3'));var controller=require(_0xeb81('0x4'));router['get']('/',auth[_0xeb81('0x5')](),controller[_0xeb81('0x6')]);router[_0xeb81('0x7')]('/:id',auth[_0xeb81('0x5')](),controller['show']);router['get']('/:id/configurations',auth[_0xeb81('0x5')](),controller[_0xeb81('0x8')]);router['get'](_0xeb81('0x9'),auth[_0xeb81('0x5')](),controller[_0xeb81('0xa')]);router['post']('/',auth[_0xeb81('0x5')](),controller[_0xeb81('0xb')]);router[_0xeb81('0xc')](_0xeb81('0xd'),auth[_0xeb81('0x5')](),controller['addConfiguration']);router[_0xeb81('0xe')](_0xeb81('0xf'),auth[_0xeb81('0x5')](),controller[_0xeb81('0x10')]);router[_0xeb81('0x11')](_0xeb81('0xf'),auth[_0xeb81('0x5')](),controller[_0xeb81('0x12')]);module[_0xeb81('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 415d9a1..4fcbafc 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 _0x7136=['sequelize','exports','STRING','HelpDesk'];(function(_0x49ff4f,_0x3f2905){var _0x2aca22=function(_0xbdfb11){while(--_0xbdfb11){_0x49ff4f['push'](_0x49ff4f['shift']());}};_0x2aca22(++_0x3f2905);}(_0x7136,0x1c0));var _0x6713=function(_0x389cda,_0x31155c){_0x389cda=_0x389cda-0x0;var _0x5889bc=_0x7136[_0x389cda];return _0x5889bc;};'use strict';var Sequelize=require(_0x6713('0x0'));module[_0x6713('0x1')]={'name':{'type':Sequelize[_0x6713('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6713('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6713('0x2')],'allowNull':![],'defaultValue':_0x6713('0x3')},'remoteUri':{'type':Sequelize[_0x6713('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6713('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf319=['sequelize','exports','STRING','HelpDesk'];(function(_0x1a1373,_0x595a59){var _0xd8c9e3=function(_0x1fd7ca){while(--_0x1fd7ca){_0x1a1373['push'](_0x1a1373['shift']());}};_0xd8c9e3(++_0x595a59);}(_0xf319,0xe8));var _0x9f31=function(_0x3efbda,_0x447f07){_0x3efbda=_0x3efbda-0x0;var _0xa84627=_0xf319[_0x3efbda];return _0xa84627;};'use strict';var Sequelize=require(_0x9f31('0x0'));module[_0x9f31('0x1')]={'name':{'type':Sequelize[_0x9f31('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9f31('0x2')]},'username':{'type':Sequelize[_0x9f31('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9f31('0x2')],'allowNull':![],'defaultValue':_0x9f31('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9f31('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9f31('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 42de0cd..def6ea8 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 _0x4142=['jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','save','destroy','end','sendStatus','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','update','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','VtigerField','md5','getFields','username','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','%s/webservice.php','success','POST','login','token','GET','sessionName','reference','owner','remove','includes','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration'];(function(_0x57b020,_0x1f5a2c){var _0xd7c0e7=function(_0x22740e){while(--_0x22740e){_0x57b020['push'](_0x57b020['shift']());}};_0xd7c0e7(++_0x1f5a2c);}(_0x4142,0x164));var _0x2414=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4142[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2414('0x0'));var emlformat=require(_0x2414('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2414('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2414('0x3'));var moment=require(_0x2414('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2414('0x5'));var util=require(_0x2414('0x6'));var path=require(_0x2414('0x7'));var sox=require(_0x2414('0x8'));var csv=require(_0x2414('0x9'));var ejs=require(_0x2414('0xa'));var fs=require('fs');var fs_extra=require(_0x2414('0xb'));var _=require(_0x2414('0xc'));var squel=require('squel');var crypto=require(_0x2414('0xd'));var jsforce=require(_0x2414('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2414('0x9'));var querystring=require('querystring');var Papa=require(_0x2414('0xf'));var Redis=require(_0x2414('0x10'));var authService=require(_0x2414('0x11'));var qs=require(_0x2414('0x12'));var as=require(_0x2414('0x13'));var hardwareService=require(_0x2414('0x14'));var logger=require(_0x2414('0x15'))('api');var utils=require(_0x2414('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2414('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2414('0x18'));var jayson=require(_0x2414('0x19'));var client=jayson[_0x2414('0x1a')][_0x2414('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x331d0e,_0x2e0ff9,_0x60d2cf,_0x243889){return new BPromise(function(_0x2acbdc,_0xea17ca){var _0x274edf=_0x243889||client;return _0x274edf[_0x2414('0x1c')](_0x331d0e,_0x60d2cf)[_0x2414('0x1d')](function(_0x1ce68f){logger[_0x2414('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x2e0ff9,'request\x20sent');logger[_0x2414('0x1f')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2e0ff9,_0x2414('0x20'),JSON['stringify'](_0x1ce68f));if(_0x1ce68f[_0x2414('0x21')]){if(_0x1ce68f[_0x2414('0x21')][_0x2414('0x22')]===0x1f4){logger[_0x2414('0x21')](_0x2414('0x23'),_0x2e0ff9,_0x1ce68f['error'][_0x2414('0x24')]);return _0xea17ca(_0x1ce68f['error'][_0x2414('0x24')]);}logger['error'](_0x2414('0x23'),_0x2e0ff9,_0x1ce68f[_0x2414('0x21')]['message']);return _0x2acbdc(_0x1ce68f[_0x2414('0x21')][_0x2414('0x24')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x2e0ff9,'request\x20sent');_0x2acbdc(_0x1ce68f[_0x2414('0x25')][_0x2414('0x24')]);}})[_0x2414('0x26')](function(_0x555994){logger[_0x2414('0x21')](_0x2414('0x23'),_0x2e0ff9,_0x555994);_0xea17ca(_0x555994);});});}function respondWithStatusCode(_0x348c0a,_0x642781){_0x642781=_0x642781||0xcc;return function(_0x154acb){if(_0x154acb){return _0x348c0a['sendStatus'](_0x642781);}return _0x348c0a[_0x2414('0x27')](_0x642781)['end']();};}function respondWithResult(_0x6ed9cf,_0x2c5c40){_0x2c5c40=_0x2c5c40||0xc8;return function(_0x33ec61){if(_0x33ec61){return _0x6ed9cf['status'](_0x2c5c40)[_0x2414('0x28')](_0x33ec61);}};}function respondWithFilteredResult(_0x437355,_0x15218a){return function(_0x18457b){if(_0x18457b){var _0x166607=_0x18457b[_0x2414('0x29')],_0x6d77a0=_0x15218a[_0x2414('0x2a')],_0x238561=_0x15218a['offset']+_0x15218a[_0x2414('0x2b')],_0x2b2947;if(_0x238561>=_0x166607){_0x238561=_0x166607;_0x2b2947=0xc8;}else{_0x2b2947=0xce;}_0x437355['status'](_0x2b2947);return _0x437355[_0x2414('0x2c')](_0x2414('0x2d'),_0x6d77a0+'-'+_0x238561+'/'+_0x166607)['json'](_0x18457b);}return null;};}function patchUpdates(_0x16ec7e){return function(_0x527e9e){try{jsonpatch[_0x2414('0x2e')](_0x527e9e,_0x16ec7e,!![]);}catch(_0x306a19){return BPromise['reject'](_0x306a19);}return _0x527e9e[_0x2414('0x2f')]();};}function saveUpdates(_0x3abb5c,_0x158d0e){return function(_0xfc35d9){if(_0xfc35d9){return _0xfc35d9['update'](_0x3abb5c)[_0x2414('0x1d')](function(_0x539973){return _0x539973;});}return null;};}function removeEntity(_0x8550b0,_0x13b936){return function(_0x2017c7){if(_0x2017c7){return _0x2017c7[_0x2414('0x30')]()['then'](function(){_0x8550b0['status'](0xcc)[_0x2414('0x31')]();});}};}function handleEntityNotFound(_0x41977a,_0x4e96b0){return function(_0x15cfa6){if(!_0x15cfa6){_0x41977a[_0x2414('0x32')](0x194);}return _0x15cfa6;};}function handleError(_0x9b54f9,_0x4d1573){_0x4d1573=_0x4d1573||0x1f4;return function(_0x4ab9a1){logger[_0x2414('0x21')](_0x4ab9a1[_0x2414('0x33')]);if(_0x4ab9a1[_0x2414('0x34')]){delete _0x4ab9a1[_0x2414('0x34')];}_0x9b54f9[_0x2414('0x27')](_0x4d1573)[_0x2414('0x35')](_0x4ab9a1);};}exports[_0x2414('0x36')]=function(_0x5ec78c,_0x3b1ea3){var _0x378792={},_0x473bd5={},_0x36623e={'count':0x0,'rows':[]};var _0x2f61c3=_[_0x2414('0x37')](db[_0x2414('0x38')][_0x2414('0x39')],function(_0x1ea4ee){return{'name':_0x1ea4ee[_0x2414('0x3a')],'type':_0x1ea4ee['type']['key']};});_0x473bd5[_0x2414('0x3b')]=_[_0x2414('0x37')](_0x2f61c3,_0x2414('0x34'));_0x473bd5[_0x2414('0x3c')]=_[_0x2414('0x3d')](_0x5ec78c[_0x2414('0x3c')]);_0x473bd5[_0x2414('0x3e')]=_[_0x2414('0x3f')](_0x473bd5['model'],_0x473bd5[_0x2414('0x3c')]);_0x378792[_0x2414('0x40')]=_[_0x2414('0x3f')](_0x473bd5[_0x2414('0x3b')],qs[_0x2414('0x41')](_0x5ec78c[_0x2414('0x3c')][_0x2414('0x41')]));_0x378792['attributes']=_0x378792[_0x2414('0x40')][_0x2414('0x42')]?_0x378792[_0x2414('0x40')]:_0x473bd5[_0x2414('0x3b')];if(!_0x5ec78c[_0x2414('0x3c')]['hasOwnProperty'](_0x2414('0x43'))){_0x378792[_0x2414('0x2b')]=qs[_0x2414('0x2b')](_0x5ec78c[_0x2414('0x3c')][_0x2414('0x2b')]);_0x378792[_0x2414('0x2a')]=qs[_0x2414('0x2a')](_0x5ec78c[_0x2414('0x3c')][_0x2414('0x2a')]);}_0x378792[_0x2414('0x44')]=qs['sort'](_0x5ec78c['query'][_0x2414('0x45')]);_0x378792[_0x2414('0x46')]=qs[_0x2414('0x3e')](_[_0x2414('0x47')](_0x5ec78c[_0x2414('0x3c')],_0x473bd5['filters']),_0x2f61c3);if(_0x5ec78c[_0x2414('0x3c')]['filter']){_0x378792[_0x2414('0x46')]=_[_0x2414('0x48')](_0x378792[_0x2414('0x46')],{'$or':_[_0x2414('0x37')](_0x2f61c3,function(_0x44f604){if(_0x44f604[_0x2414('0x49')]!==_0x2414('0x4a')){var _0x4bbdeb={};_0x4bbdeb[_0x44f604[_0x2414('0x34')]]={'$like':'%'+_0x5ec78c[_0x2414('0x3c')][_0x2414('0x4b')]+'%'};return _0x4bbdeb;}})});}_0x378792=_[_0x2414('0x48')]({},_0x378792,_0x5ec78c[_0x2414('0x4c')]);var _0x1cb786={'where':_0x378792[_0x2414('0x46')]};return db[_0x2414('0x38')][_0x2414('0x29')](_0x1cb786)['then'](function(_0x5becc7){_0x36623e['count']=_0x5becc7;if(_0x5ec78c[_0x2414('0x3c')][_0x2414('0x4d')]){_0x378792[_0x2414('0x4e')]=[{'all':!![]}];}return db['VtigerAccount'][_0x2414('0x4f')](_0x378792);})['then'](function(_0x110035){_0x36623e[_0x2414('0x50')]=_0x110035;return _0x36623e;})[_0x2414('0x1d')](respondWithFilteredResult(_0x3b1ea3,_0x378792))[_0x2414('0x26')](handleError(_0x3b1ea3,null));};exports['show']=function(_0x2363b6,_0x2522b1){var _0x25419c={'raw':![],'where':{'id':_0x2363b6[_0x2414('0x51')]['id']}},_0x53f0c4={};_0x53f0c4[_0x2414('0x3b')]=_['keys'](db[_0x2414('0x38')]['rawAttributes']);_0x53f0c4[_0x2414('0x3c')]=_['keys'](_0x2363b6[_0x2414('0x3c')]);_0x53f0c4[_0x2414('0x3e')]=_[_0x2414('0x3f')](_0x53f0c4[_0x2414('0x3b')],_0x53f0c4[_0x2414('0x3c')]);_0x25419c[_0x2414('0x40')]=_['intersection'](_0x53f0c4['model'],qs['fields'](_0x2363b6[_0x2414('0x3c')][_0x2414('0x41')]));_0x25419c[_0x2414('0x40')]=_0x25419c[_0x2414('0x40')][_0x2414('0x42')]?_0x25419c[_0x2414('0x40')]:_0x53f0c4[_0x2414('0x3b')];if(_0x2363b6[_0x2414('0x3c')][_0x2414('0x4d')]){_0x25419c['include']=[{'all':!![]}];}_0x25419c=_[_0x2414('0x48')]({},_0x25419c,_0x2363b6['options']);return db[_0x2414('0x38')][_0x2414('0x52')](_0x25419c)['then'](handleEntityNotFound(_0x2522b1,null))[_0x2414('0x1d')](respondWithResult(_0x2522b1,null))['catch'](handleError(_0x2522b1,null));};exports['create']=function(_0x42fa92,_0x3a2dfd){return db['VtigerAccount'][_0x2414('0x53')](_0x42fa92[_0x2414('0x54')],{})['then'](respondWithResult(_0x3a2dfd,0xc9))[_0x2414('0x26')](handleError(_0x3a2dfd,null));};exports[_0x2414('0x55')]=function(_0x145cd6,_0xe02b72){if(_0x145cd6[_0x2414('0x54')]['id']){delete _0x145cd6[_0x2414('0x54')]['id'];}return db[_0x2414('0x38')]['find']({'where':{'id':_0x145cd6[_0x2414('0x51')]['id']}})[_0x2414('0x1d')](handleEntityNotFound(_0xe02b72,null))[_0x2414('0x1d')](saveUpdates(_0x145cd6['body'],null))[_0x2414('0x1d')](respondWithResult(_0xe02b72,null))['catch'](handleError(_0xe02b72,null));};exports[_0x2414('0x30')]=function(_0x543ae9,_0x496e8f){return db[_0x2414('0x38')][_0x2414('0x52')]({'where':{'id':_0x543ae9[_0x2414('0x51')]['id']}})[_0x2414('0x1d')](handleEntityNotFound(_0x496e8f,null))['then'](removeEntity(_0x496e8f,null))[_0x2414('0x26')](handleError(_0x496e8f,null));};exports[_0x2414('0x56')]=function(_0x1600cd,_0x15f60e,_0xabf9cf){var _0x404d48={};var _0x1fdea4={};var _0x427b37;var _0x5ee0c4;return db[_0x2414('0x38')]['findOne']({'where':{'id':_0x1600cd['params']['id']}})[_0x2414('0x1d')](handleEntityNotFound(_0x15f60e,null))[_0x2414('0x1d')](function(_0x28cdfa){if(_0x28cdfa){_0x427b37=_0x28cdfa;_0x1fdea4[_0x2414('0x3b')]=_['keys'](db['VtigerConfiguration'][_0x2414('0x39')]);_0x1fdea4[_0x2414('0x3c')]=_[_0x2414('0x3d')](_0x1600cd['query']);_0x1fdea4[_0x2414('0x3e')]=_[_0x2414('0x3f')](_0x1fdea4['model'],_0x1fdea4[_0x2414('0x3c')]);_0x404d48['attributes']=_['intersection'](_0x1fdea4[_0x2414('0x3b')],qs[_0x2414('0x41')](_0x1600cd['query'][_0x2414('0x41')]));_0x404d48[_0x2414('0x40')]=_0x404d48['attributes'][_0x2414('0x42')]?_0x404d48['attributes']:_0x1fdea4[_0x2414('0x3b')];_0x404d48['order']=qs[_0x2414('0x45')](_0x1600cd[_0x2414('0x3c')][_0x2414('0x45')]);_0x404d48[_0x2414('0x46')]=qs[_0x2414('0x3e')](_[_0x2414('0x47')](_0x1600cd['query'],_0x1fdea4[_0x2414('0x3e')]));if(_0x1600cd['query'][_0x2414('0x4b')]){_0x404d48['where']=_[_0x2414('0x48')](_0x404d48['where'],{'$or':_[_0x2414('0x37')](_0x404d48[_0x2414('0x40')],function(_0x2a33e3){var _0x2358a4={};_0x2358a4[_0x2a33e3]={'$like':'%'+_0x1600cd[_0x2414('0x3c')][_0x2414('0x4b')]+'%'};return _0x2358a4;})});}_0x404d48=_[_0x2414('0x48')]({},_0x404d48,_0x1600cd[_0x2414('0x4c')]);return _0x427b37[_0x2414('0x56')](_0x404d48);}})[_0x2414('0x1d')](function(_0x2a6346){if(_0x2a6346){_0x5ee0c4=_0x2a6346['length'];if(!_0x1600cd[_0x2414('0x3c')][_0x2414('0x57')]('nolimit')){_0x404d48[_0x2414('0x2b')]=qs[_0x2414('0x2b')](_0x1600cd[_0x2414('0x3c')][_0x2414('0x2b')]);_0x404d48[_0x2414('0x2a')]=qs[_0x2414('0x2a')](_0x1600cd[_0x2414('0x3c')][_0x2414('0x2a')]);}return _0x427b37[_0x2414('0x56')](_0x404d48);}})[_0x2414('0x1d')](function(_0x3b4a15){if(_0x3b4a15){return _0x3b4a15?{'count':_0x5ee0c4,'rows':_0x3b4a15}:null;}})['then'](respondWithResult(_0x15f60e,null))[_0x2414('0x26')](handleError(_0x15f60e,null));};exports[_0x2414('0x58')]=function(_0x4432d2,_0x31abce,_0x277fff){if(_0x4432d2[_0x2414('0x54')]['id']){delete _0x4432d2[_0x2414('0x54')]['id'];}return db['VtigerAccount'][_0x2414('0x59')]({'where':{'id':_0x4432d2[_0x2414('0x51')]['id']}})[_0x2414('0x1d')](handleEntityNotFound(_0x31abce,null))['then'](function(_0x662f5f){if(_0x662f5f){_0x4432d2[_0x2414('0x54')][_0x2414('0x5a')]=_0x662f5f['id'];_0x4432d2['body'][_0x2414('0x5b')]=integrations['getSubjects'](_0x4432d2[_0x2414('0x54')]['channel'],_0x4432d2[_0x2414('0x54')][_0x2414('0x49')]);_0x4432d2['body'][_0x2414('0x5c')]=integrations[_0x2414('0x5d')](_0x4432d2[_0x2414('0x54')]['channel'],_0x4432d2[_0x2414('0x54')][_0x2414('0x49')]);return db['VtigerConfiguration'][_0x2414('0x53')](_0x4432d2[_0x2414('0x54')],{'include':[{'model':db[_0x2414('0x5e')],'as':_0x2414('0x5b')},{'model':db[_0x2414('0x5e')],'as':_0x2414('0x5c')}]});}return null;})[_0x2414('0x1d')](respondWithResult(_0x31abce,null))['catch'](handleError(_0x31abce,null));};var md5=require(_0x2414('0x5f'));exports[_0x2414('0x60')]=function(_0x2c4a78,_0x18d4ed,_0x36a1a1){var _0xe5bb02=null;var _0xb92c4b=null;var _0x530144=null;var _0x56aa0e=null;var _0x1d5df0='';return db['VtigerAccount'][_0x2414('0x59')]({'where':{'id':_0x2c4a78[_0x2414('0x51')]['id']},'attributes':['id','name',_0x2414('0x61'),'description','moduleName',_0x2414('0x62'),_0x2414('0x63'),_0x2414('0x64')]})[_0x2414('0x1d')](handleEntityNotFound(_0x18d4ed,null))[_0x2414('0x1d')](function(_0x141461){if(_0x141461){_0xe5bb02=_0x141461[_0x2414('0x61')];_0xb92c4b=_0x141461[_0x2414('0x64')];_0x530144=_0x141461[_0x2414('0x65')];_0x1d5df0=_0x141461['remoteUri'];var _0x2f8c5a=_0x1d5df0[_0x2414('0x66')](-0x1);if(_0x2f8c5a==='/'){_0x1d5df0=_0x1d5df0['substring'](0x0,_0x1d5df0[_0x2414('0x67')](_0x2f8c5a));}_0x56aa0e=util['format'](_0x2414('0x68'),_0x1d5df0);var _0x3d65f5={'method':'GET','uri':_0x56aa0e,'qs':{'operation':'getchallenge','username':_0x141461[_0x2414('0x61')]},'json':!![]};return rp(_0x3d65f5);}})[_0x2414('0x1d')](function(_0x421219){if(_0x421219[_0x2414('0x69')]){var _0x363f09={'method':_0x2414('0x6a'),'uri':_0x56aa0e,'form':{'operation':_0x2414('0x6b'),'username':_0xe5bb02,'accessKey':md5(_0x421219[_0x2414('0x25')][_0x2414('0x6c')]+_0xb92c4b)},'json':!![]};return rp(_0x363f09);}})['then'](function(_0x299e06){if(_0x299e06[_0x2414('0x69')]){var _0x5c5ec6={'method':_0x2414('0x6d'),'uri':_0x56aa0e,'qs':{'operation':'describe','username':_0xe5bb02,'sessionName':_0x299e06['result'][_0x2414('0x6e')],'elementType':_0x530144},'json':!![]};return rp(_0x5c5ec6);}})['then'](function(_0x897889){if(_0x897889[_0x2414('0x69')]){var _0x27f9b4=['autogenerated',_0x2414('0x6f'),_0x2414('0x70')];_[_0x2414('0x71')](_0x897889[_0x2414('0x25')][_0x2414('0x41')],function(_0x54dfd8){return _0x27f9b4[_0x2414('0x72')](_0x54dfd8[_0x2414('0x49')]['name']);});_[_0x2414('0x71')](_0x897889[_0x2414('0x25')]['fields'],function(_0x5ac2c8){return _0x5ac2c8['editable']===_0x2414('0x73');});return{'count':_0x897889[_0x2414('0x25')][_0x2414('0x41')][_0x2414('0x42')],'rows':_[_0x2414('0x37')](_0x897889['result'][_0x2414('0x41')],function(_0x217a61){return{'id':_0x217a61[_0x2414('0x34')],'name':_0x217a61['label'],'custom':_[_0x2414('0x74')](_0x217a61[_0x2414('0x34')],_0x2414('0x75'))?!![]:![],'options':_0x217a61[_0x2414('0x49')][_0x2414('0x34')]===_0x2414('0x76')&&_0x217a61[_0x2414('0x49')][_0x2414('0x77')][_0x2414('0x42')]>0x0?_['map'](_0x217a61['type'][_0x2414('0x77')],function(_0x5629b7){return{'name':_0x5629b7[_0x2414('0x78')],'value':_0x5629b7[_0x2414('0x79')]};}):[]};})};}})['then'](respondWithResult(_0x18d4ed,null))[_0x2414('0x26')](function(_0x42a062){console[_0x2414('0x7a')](_0x2414('0x7b')+_0x42a062);var _0x4727a5=_0x2c4a78[_0x2414('0x3c')][_0x2414('0x7c')]?0x1f4:_0x42a062['statusCode']||0x1f4;logger['error'](_0x2414('0x7d'),_0x2414('0x60'),_0x4727a5,JSON[_0x2414('0x7e')](_0x42a062));delete _0x42a062[_0x2414('0x34')];if(_0x4727a5===0x191){_0x4727a5=0x190;}_0x18d4ed[_0x2414('0x27')](_0x4727a5)[_0x2414('0x35')](_0x2c4a78[_0x2414('0x3c')][_0x2414('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x42a062['statusCode']}:_0x42a062);});}; \ No newline at end of file +var _0x40c7=['index','VtigerAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','create','body','update','params','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','format','getchallenge','POST','login','result','token','success','GET','describe','sessionName','autogenerated','reference','owner','editable','startsWith','cf_','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','status','end','json','count','offset','limit','set','apply','reject','save','destroy','sendStatus','name','send'];(function(_0x214bcd,_0x35084c){var _0xacbe24=function(_0xd8f05d){while(--_0xd8f05d){_0x214bcd['push'](_0x214bcd['shift']());}};_0xacbe24(++_0x35084c);}(_0x40c7,0xca));var _0x740c=function(_0x2124a6,_0x4b788c){_0x2124a6=_0x2124a6-0x0;var _0x23e704=_0x40c7[_0x2124a6];return _0x23e704;};'use strict';var pdf=require(_0x740c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x740c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x740c('0x2'));var BPromise=require(_0x740c('0x3'));var Mustache=require('mustache');var util=require(_0x740c('0x4'));var path=require(_0x740c('0x5'));var sox=require(_0x740c('0x6'));var csv=require(_0x740c('0x7'));var ejs=require(_0x740c('0x8'));var fs=require('fs');var fs_extra=require(_0x740c('0x9'));var _=require(_0x740c('0xa'));var squel=require(_0x740c('0xb'));var crypto=require(_0x740c('0xc'));var jsforce=require(_0x740c('0xd'));var deskjs=require(_0x740c('0xe'));var toCsv=require(_0x740c('0x7'));var querystring=require(_0x740c('0xf'));var Papa=require(_0x740c('0x10'));var Redis=require('ioredis');var authService=require(_0x740c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x740c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x740c('0x13'))(_0x740c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x740c('0x15'));var db=require(_0x740c('0x16'))['db'];var integrations=require(_0x740c('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x740c('0x18')][_0x740c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x59a140,_0x4bdbf8,_0x232bdf,_0x5dc940){return new BPromise(function(_0x2533dc,_0x13b900){var _0x244185=_0x5dc940||client;return _0x244185[_0x740c('0x1a')](_0x59a140,_0x232bdf)[_0x740c('0x1b')](function(_0x3f24fe){logger['info'](_0x740c('0x1c'),_0x4bdbf8,_0x740c('0x1d'));logger[_0x740c('0x1e')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4bdbf8,_0x740c('0x1d'),JSON[_0x740c('0x1f')](_0x3f24fe));if(_0x3f24fe[_0x740c('0x20')]){if(_0x3f24fe['error']['code']===0x1f4){logger[_0x740c('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x4bdbf8,_0x3f24fe[_0x740c('0x20')][_0x740c('0x21')]);return _0x13b900(_0x3f24fe[_0x740c('0x20')][_0x740c('0x21')]);}logger[_0x740c('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x4bdbf8,_0x3f24fe[_0x740c('0x20')][_0x740c('0x21')]);return _0x2533dc(_0x3f24fe['error'][_0x740c('0x21')]);}else{logger[_0x740c('0x22')]('VtigerAccount,\x20%s,\x20%s',_0x4bdbf8,_0x740c('0x1d'));_0x2533dc(_0x3f24fe['result'][_0x740c('0x21')]);}})[_0x740c('0x23')](function(_0x5c28d4){logger['error'](_0x740c('0x1c'),_0x4bdbf8,_0x5c28d4);_0x13b900(_0x5c28d4);});});}function respondWithStatusCode(_0x55a015,_0x33c999){_0x33c999=_0x33c999||0xcc;return function(_0x27c661){if(_0x27c661){return _0x55a015['sendStatus'](_0x33c999);}return _0x55a015[_0x740c('0x24')](_0x33c999)[_0x740c('0x25')]();};}function respondWithResult(_0x5224a6,_0x8df147){_0x8df147=_0x8df147||0xc8;return function(_0x8b2908){if(_0x8b2908){return _0x5224a6[_0x740c('0x24')](_0x8df147)[_0x740c('0x26')](_0x8b2908);}};}function respondWithFilteredResult(_0x23822b,_0x2af7cc){return function(_0xb408aa){if(_0xb408aa){var _0x483855=_0xb408aa[_0x740c('0x27')],_0x16f4de=_0x2af7cc[_0x740c('0x28')],_0x1d39a3=_0x2af7cc[_0x740c('0x28')]+_0x2af7cc[_0x740c('0x29')],_0x146e0f;if(_0x1d39a3>=_0x483855){_0x1d39a3=_0x483855;_0x146e0f=0xc8;}else{_0x146e0f=0xce;}_0x23822b[_0x740c('0x24')](_0x146e0f);return _0x23822b[_0x740c('0x2a')]('Content-Range',_0x16f4de+'-'+_0x1d39a3+'/'+_0x483855)[_0x740c('0x26')](_0xb408aa);}return null;};}function patchUpdates(_0x13585a){return function(_0x530024){try{jsonpatch[_0x740c('0x2b')](_0x530024,_0x13585a,!![]);}catch(_0x395c81){return BPromise[_0x740c('0x2c')](_0x395c81);}return _0x530024[_0x740c('0x2d')]();};}function saveUpdates(_0x89e4ab,_0x1d4c7c){return function(_0x2567cc){if(_0x2567cc){return _0x2567cc['update'](_0x89e4ab)['then'](function(_0x51c97b){return _0x51c97b;});}return null;};}function removeEntity(_0x544685,_0x40a3f5){return function(_0x386524){if(_0x386524){return _0x386524[_0x740c('0x2e')]()[_0x740c('0x1b')](function(){_0x544685[_0x740c('0x24')](0xcc)[_0x740c('0x25')]();});}};}function handleEntityNotFound(_0x3446ac,_0x580b00){return function(_0x31d599){if(!_0x31d599){_0x3446ac[_0x740c('0x2f')](0x194);}return _0x31d599;};}function handleError(_0x11ee7c,_0x12607c){_0x12607c=_0x12607c||0x1f4;return function(_0xc2cfc9){logger[_0x740c('0x20')](_0xc2cfc9['stack']);if(_0xc2cfc9[_0x740c('0x30')]){delete _0xc2cfc9[_0x740c('0x30')];}_0x11ee7c['status'](_0x12607c)[_0x740c('0x31')](_0xc2cfc9);};}exports[_0x740c('0x32')]=function(_0x970159,_0x44e195){var _0x2bda28={},_0x21f480={},_0x359cb7={'count':0x0,'rows':[]};var _0x787446=_['map'](db[_0x740c('0x33')][_0x740c('0x34')],function(_0x333c94){return{'name':_0x333c94['fieldName'],'type':_0x333c94[_0x740c('0x35')][_0x740c('0x36')]};});_0x21f480[_0x740c('0x37')]=_[_0x740c('0x38')](_0x787446,'name');_0x21f480['query']=_[_0x740c('0x39')](_0x970159[_0x740c('0x3a')]);_0x21f480[_0x740c('0x3b')]=_[_0x740c('0x3c')](_0x21f480['model'],_0x21f480['query']);_0x2bda28[_0x740c('0x3d')]=_[_0x740c('0x3c')](_0x21f480[_0x740c('0x37')],qs[_0x740c('0x3e')](_0x970159[_0x740c('0x3a')][_0x740c('0x3e')]));_0x2bda28[_0x740c('0x3d')]=_0x2bda28[_0x740c('0x3d')][_0x740c('0x3f')]?_0x2bda28['attributes']:_0x21f480[_0x740c('0x37')];if(!_0x970159[_0x740c('0x3a')][_0x740c('0x40')]('nolimit')){_0x2bda28[_0x740c('0x29')]=qs[_0x740c('0x29')](_0x970159[_0x740c('0x3a')][_0x740c('0x29')]);_0x2bda28[_0x740c('0x28')]=qs[_0x740c('0x28')](_0x970159[_0x740c('0x3a')][_0x740c('0x28')]);}_0x2bda28['order']=qs[_0x740c('0x41')](_0x970159[_0x740c('0x3a')][_0x740c('0x41')]);_0x2bda28[_0x740c('0x42')]=qs[_0x740c('0x3b')](_[_0x740c('0x43')](_0x970159[_0x740c('0x3a')],_0x21f480[_0x740c('0x3b')]),_0x787446);if(_0x970159[_0x740c('0x3a')][_0x740c('0x44')]){_0x2bda28[_0x740c('0x42')]=_[_0x740c('0x45')](_0x2bda28['where'],{'$or':_[_0x740c('0x38')](_0x787446,function(_0x17ea17){if(_0x17ea17[_0x740c('0x35')]!==_0x740c('0x46')){var _0x6dee2b={};_0x6dee2b[_0x17ea17['name']]={'$like':'%'+_0x970159[_0x740c('0x3a')][_0x740c('0x44')]+'%'};return _0x6dee2b;}})});}_0x2bda28=_[_0x740c('0x45')]({},_0x2bda28,_0x970159[_0x740c('0x47')]);var _0x4896ea={'where':_0x2bda28['where']};return db[_0x740c('0x33')][_0x740c('0x27')](_0x4896ea)[_0x740c('0x1b')](function(_0x416548){_0x359cb7[_0x740c('0x27')]=_0x416548;if(_0x970159['query'][_0x740c('0x48')]){_0x2bda28[_0x740c('0x49')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x2bda28);})['then'](function(_0x5e2f75){_0x359cb7[_0x740c('0x4a')]=_0x5e2f75;return _0x359cb7;})[_0x740c('0x1b')](respondWithFilteredResult(_0x44e195,_0x2bda28))[_0x740c('0x23')](handleError(_0x44e195,null));};exports[_0x740c('0x4b')]=function(_0x306602,_0x65946b){var _0x20e474={'raw':![],'where':{'id':_0x306602['params']['id']}},_0x1a299a={};_0x1a299a[_0x740c('0x37')]=_[_0x740c('0x39')](db[_0x740c('0x33')][_0x740c('0x34')]);_0x1a299a[_0x740c('0x3a')]=_[_0x740c('0x39')](_0x306602[_0x740c('0x3a')]);_0x1a299a[_0x740c('0x3b')]=_[_0x740c('0x3c')](_0x1a299a[_0x740c('0x37')],_0x1a299a[_0x740c('0x3a')]);_0x20e474['attributes']=_['intersection'](_0x1a299a[_0x740c('0x37')],qs[_0x740c('0x3e')](_0x306602[_0x740c('0x3a')][_0x740c('0x3e')]));_0x20e474[_0x740c('0x3d')]=_0x20e474[_0x740c('0x3d')][_0x740c('0x3f')]?_0x20e474[_0x740c('0x3d')]:_0x1a299a[_0x740c('0x37')];if(_0x306602[_0x740c('0x3a')][_0x740c('0x48')]){_0x20e474[_0x740c('0x49')]=[{'all':!![]}];}_0x20e474=_['merge']({},_0x20e474,_0x306602['options']);return db[_0x740c('0x33')][_0x740c('0x4c')](_0x20e474)['then'](handleEntityNotFound(_0x65946b,null))[_0x740c('0x1b')](respondWithResult(_0x65946b,null))[_0x740c('0x23')](handleError(_0x65946b,null));};exports[_0x740c('0x4d')]=function(_0x56aefb,_0x2a8e60){return db['VtigerAccount'][_0x740c('0x4d')](_0x56aefb[_0x740c('0x4e')],{})[_0x740c('0x1b')](respondWithResult(_0x2a8e60,0xc9))[_0x740c('0x23')](handleError(_0x2a8e60,null));};exports[_0x740c('0x4f')]=function(_0x1123db,_0x744301){if(_0x1123db['body']['id']){delete _0x1123db['body']['id'];}return db['VtigerAccount'][_0x740c('0x4c')]({'where':{'id':_0x1123db[_0x740c('0x50')]['id']}})[_0x740c('0x1b')](handleEntityNotFound(_0x744301,null))[_0x740c('0x1b')](saveUpdates(_0x1123db[_0x740c('0x4e')],null))['then'](respondWithResult(_0x744301,null))[_0x740c('0x23')](handleError(_0x744301,null));};exports[_0x740c('0x2e')]=function(_0x111328,_0x3df5d0){return db[_0x740c('0x33')][_0x740c('0x4c')]({'where':{'id':_0x111328['params']['id']}})['then'](handleEntityNotFound(_0x3df5d0,null))[_0x740c('0x1b')](removeEntity(_0x3df5d0,null))['catch'](handleError(_0x3df5d0,null));};exports[_0x740c('0x51')]=function(_0xd24f6d,_0x130ca8,_0xbf853){var _0x4fe3ba={};var _0x5e5777={};var _0x102592;var _0x4d63d9;return db[_0x740c('0x33')][_0x740c('0x52')]({'where':{'id':_0xd24f6d['params']['id']}})[_0x740c('0x1b')](handleEntityNotFound(_0x130ca8,null))[_0x740c('0x1b')](function(_0x32f227){if(_0x32f227){_0x102592=_0x32f227;_0x5e5777['model']=_[_0x740c('0x39')](db[_0x740c('0x53')][_0x740c('0x34')]);_0x5e5777['query']=_[_0x740c('0x39')](_0xd24f6d[_0x740c('0x3a')]);_0x5e5777[_0x740c('0x3b')]=_[_0x740c('0x3c')](_0x5e5777[_0x740c('0x37')],_0x5e5777['query']);_0x4fe3ba[_0x740c('0x3d')]=_['intersection'](_0x5e5777[_0x740c('0x37')],qs[_0x740c('0x3e')](_0xd24f6d[_0x740c('0x3a')][_0x740c('0x3e')]));_0x4fe3ba[_0x740c('0x3d')]=_0x4fe3ba[_0x740c('0x3d')][_0x740c('0x3f')]?_0x4fe3ba[_0x740c('0x3d')]:_0x5e5777[_0x740c('0x37')];_0x4fe3ba['order']=qs[_0x740c('0x41')](_0xd24f6d[_0x740c('0x3a')][_0x740c('0x41')]);_0x4fe3ba[_0x740c('0x42')]=qs[_0x740c('0x3b')](_[_0x740c('0x43')](_0xd24f6d[_0x740c('0x3a')],_0x5e5777[_0x740c('0x3b')]));if(_0xd24f6d[_0x740c('0x3a')][_0x740c('0x44')]){_0x4fe3ba[_0x740c('0x42')]=_[_0x740c('0x45')](_0x4fe3ba[_0x740c('0x42')],{'$or':_[_0x740c('0x38')](_0x4fe3ba[_0x740c('0x3d')],function(_0xb33766){var _0x15c3c6={};_0x15c3c6[_0xb33766]={'$like':'%'+_0xd24f6d[_0x740c('0x3a')][_0x740c('0x44')]+'%'};return _0x15c3c6;})});}_0x4fe3ba=_[_0x740c('0x45')]({},_0x4fe3ba,_0xd24f6d['options']);return _0x102592[_0x740c('0x51')](_0x4fe3ba);}})[_0x740c('0x1b')](function(_0x552da4){if(_0x552da4){_0x4d63d9=_0x552da4[_0x740c('0x3f')];if(!_0xd24f6d[_0x740c('0x3a')][_0x740c('0x40')]('nolimit')){_0x4fe3ba[_0x740c('0x29')]=qs[_0x740c('0x29')](_0xd24f6d[_0x740c('0x3a')]['limit']);_0x4fe3ba[_0x740c('0x28')]=qs[_0x740c('0x28')](_0xd24f6d[_0x740c('0x3a')][_0x740c('0x28')]);}return _0x102592[_0x740c('0x51')](_0x4fe3ba);}})[_0x740c('0x1b')](function(_0x50cee5){if(_0x50cee5){return _0x50cee5?{'count':_0x4d63d9,'rows':_0x50cee5}:null;}})[_0x740c('0x1b')](respondWithResult(_0x130ca8,null))['catch'](handleError(_0x130ca8,null));};exports[_0x740c('0x54')]=function(_0x469ef0,_0x27aedd,_0x5dd1b3){if(_0x469ef0[_0x740c('0x4e')]['id']){delete _0x469ef0[_0x740c('0x4e')]['id'];}return db[_0x740c('0x33')]['findOne']({'where':{'id':_0x469ef0[_0x740c('0x50')]['id']}})['then'](handleEntityNotFound(_0x27aedd,null))['then'](function(_0x2e27f6){if(_0x2e27f6){_0x469ef0[_0x740c('0x4e')][_0x740c('0x55')]=_0x2e27f6['id'];_0x469ef0['body'][_0x740c('0x56')]=integrations[_0x740c('0x57')](_0x469ef0[_0x740c('0x4e')][_0x740c('0x58')],_0x469ef0[_0x740c('0x4e')][_0x740c('0x35')]);_0x469ef0[_0x740c('0x4e')][_0x740c('0x59')]=integrations[_0x740c('0x5a')](_0x469ef0[_0x740c('0x4e')][_0x740c('0x58')],_0x469ef0[_0x740c('0x4e')][_0x740c('0x35')]);return db[_0x740c('0x53')][_0x740c('0x4d')](_0x469ef0[_0x740c('0x4e')],{'include':[{'model':db[_0x740c('0x5b')],'as':'Subjects'},{'model':db[_0x740c('0x5b')],'as':'Descriptions'}]});}return null;})[_0x740c('0x1b')](respondWithResult(_0x27aedd,null))[_0x740c('0x23')](handleError(_0x27aedd,null));};var md5=require(_0x740c('0x5c'));exports[_0x740c('0x5d')]=function(_0x47de1b,_0x273ca0,_0x400817){var _0x35f26f=null;var _0x279290=null;var _0x260fb7=null;var _0x4c5bde=null;var _0x3a10b7='';return db[_0x740c('0x33')][_0x740c('0x52')]({'where':{'id':_0x47de1b['params']['id']},'attributes':['id',_0x740c('0x30'),_0x740c('0x5e'),_0x740c('0x5f'),'moduleName',_0x740c('0x60'),_0x740c('0x61'),_0x740c('0x62')]})[_0x740c('0x1b')](handleEntityNotFound(_0x273ca0,null))[_0x740c('0x1b')](function(_0x3ca3e0){if(_0x3ca3e0){_0x35f26f=_0x3ca3e0['username'];_0x279290=_0x3ca3e0['accessKey'];_0x260fb7=_0x3ca3e0[_0x740c('0x63')];_0x3a10b7=_0x3ca3e0['remoteUri'];var _0x357157=_0x3a10b7[_0x740c('0x64')](-0x1);if(_0x357157==='/'){_0x3a10b7=_0x3a10b7['substring'](0x0,_0x3a10b7['lastIndexOf'](_0x357157));}_0x4c5bde=util[_0x740c('0x65')]('%s/webservice.php',_0x3a10b7);var _0x19b398={'method':'GET','uri':_0x4c5bde,'qs':{'operation':_0x740c('0x66'),'username':_0x3ca3e0[_0x740c('0x5e')]},'json':!![]};return rp(_0x19b398);}})[_0x740c('0x1b')](function(_0x46ab1c){if(_0x46ab1c['success']){var _0xf8a96b={'method':_0x740c('0x67'),'uri':_0x4c5bde,'form':{'operation':_0x740c('0x68'),'username':_0x35f26f,'accessKey':md5(_0x46ab1c[_0x740c('0x69')][_0x740c('0x6a')]+_0x279290)},'json':!![]};return rp(_0xf8a96b);}})[_0x740c('0x1b')](function(_0x1f1a47){if(_0x1f1a47[_0x740c('0x6b')]){var _0x384e29={'method':_0x740c('0x6c'),'uri':_0x4c5bde,'qs':{'operation':_0x740c('0x6d'),'username':_0x35f26f,'sessionName':_0x1f1a47['result'][_0x740c('0x6e')],'elementType':_0x260fb7},'json':!![]};return rp(_0x384e29);}})[_0x740c('0x1b')](function(_0x5b8927){if(_0x5b8927[_0x740c('0x6b')]){var _0x3c1416=[_0x740c('0x6f'),_0x740c('0x70'),_0x740c('0x71')];_['remove'](_0x5b8927['result']['fields'],function(_0x4640c7){return _0x3c1416['includes'](_0x4640c7[_0x740c('0x35')][_0x740c('0x30')]);});_['remove'](_0x5b8927['result'][_0x740c('0x3e')],function(_0x100172){return _0x100172[_0x740c('0x72')]==='false';});return{'count':_0x5b8927[_0x740c('0x69')]['fields'][_0x740c('0x3f')],'rows':_[_0x740c('0x38')](_0x5b8927['result'][_0x740c('0x3e')],function(_0xdf16f3){return{'id':_0xdf16f3['name'],'name':_0xdf16f3['label'],'custom':_[_0x740c('0x73')](_0xdf16f3[_0x740c('0x30')],_0x740c('0x74'))?!![]:![],'options':_0xdf16f3[_0x740c('0x35')][_0x740c('0x30')]==='picklist'&&_0xdf16f3[_0x740c('0x35')][_0x740c('0x75')]['length']>0x0?_['map'](_0xdf16f3[_0x740c('0x35')][_0x740c('0x75')],function(_0x1d2079){return{'name':_0x1d2079[_0x740c('0x76')],'value':_0x1d2079[_0x740c('0x77')]};}):[]};})};}})['then'](respondWithResult(_0x273ca0,null))[_0x740c('0x23')](function(_0x41bb9f){console[_0x740c('0x78')](_0x740c('0x79')+_0x41bb9f);var _0x424c98=_0x47de1b['query'][_0x740c('0x7a')]?0x1f4:_0x41bb9f[_0x740c('0x7b')]||0x1f4;logger[_0x740c('0x20')](_0x740c('0x7c'),_0x740c('0x5d'),_0x424c98,JSON[_0x740c('0x1f')](_0x41bb9f));delete _0x41bb9f[_0x740c('0x30')];if(_0x424c98===0x191){_0x424c98=0x190;}_0x273ca0['status'](_0x424c98)[_0x740c('0x31')](_0x47de1b[_0x740c('0x3a')][_0x740c('0x7a')]?{'message':_0x740c('0x7d'),'statusCode':_0x41bb9f[_0x740c('0x7b')]}:_0x41bb9f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index aa1e762..2a47774 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 _0x393f=['request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3d4d5f,_0x492434){var _0x281329=function(_0x5827bc){while(--_0x5827bc){_0x3d4d5f['push'](_0x3d4d5f['shift']());}};_0x281329(++_0x492434);}(_0x393f,0xa3));var _0xf393=function(_0x2d25ee,_0x16826b){_0x2d25ee=_0x2d25ee-0x0;var _0x4db6ad=_0x393f[_0x2d25ee];return _0x4db6ad;};'use strict';var _=require(_0xf393('0x0'));var util=require(_0xf393('0x1'));var logger=require(_0xf393('0x2'))('api');var moment=require(_0xf393('0x3'));var BPromise=require(_0xf393('0x4'));var rp=require(_0xf393('0x5'));var fs=require('fs');var path=require(_0xf393('0x6'));var rimraf=require(_0xf393('0x7'));var config=require('../../config/environment');var attributes=require(_0xf393('0x8'));var integrations=require(_0xf393('0x9'));module[_0xf393('0xa')]=function(_0x4bf533,_0x91b57b){return _0x4bf533[_0xf393('0xb')](_0xf393('0xc'),attributes,{'tableName':_0xf393('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f99=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7f99,0x14b));var _0x97f9=function(_0x419cfe,_0x4d39dd){_0x419cfe=_0x419cfe-0x0;var _0x3324e4=_0x7f99[_0x419cfe];return _0x3324e4;};'use strict';var _=require('lodash');var util=require(_0x97f9('0x0'));var logger=require(_0x97f9('0x1'))(_0x97f9('0x2'));var moment=require(_0x97f9('0x3'));var BPromise=require('bluebird');var rp=require(_0x97f9('0x4'));var fs=require('fs');var path=require(_0x97f9('0x5'));var rimraf=require(_0x97f9('0x6'));var config=require(_0x97f9('0x7'));var attributes=require(_0x97f9('0x8'));var integrations=require(_0x97f9('0x9'));module[_0x97f9('0xa')]=function(_0x1ece0a,_0x5cdb1e){return _0x1ece0a[_0x97f9('0xb')](_0x97f9('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 296010c..1048e66 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 _0x8c6c=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','include','map','model','attributes','ShowVtigerAccount','find','raw','stringify','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c6c,0x1be));var _0xc8c6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8c6c[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xc8c6('0x0'));var util=require(_0xc8c6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8c6('0x2'));var db=require(_0xc8c6('0x3'))['db'];var utils=require(_0xc8c6('0x4'));var logger=require('../../config/logger')(_0xc8c6('0x5'));var config=require(_0xc8c6('0x6'));var jayson=require(_0xc8c6('0x7'));var client=jayson[_0xc8c6('0x8')][_0xc8c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x326ad6,_0x4a79c,_0x291afe){return new BPromise(function(_0x3fd85b,_0x3da013){return client[_0xc8c6('0xa')](_0x326ad6,_0x291afe)[_0xc8c6('0xb')](function(_0x956961){logger[_0xc8c6('0xc')](_0xc8c6('0xd'),_0x4a79c,_0xc8c6('0xe'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4a79c,_0xc8c6('0xe'),JSON['stringify'](_0x956961));if(_0x956961[_0xc8c6('0xf')]){if(_0x956961[_0xc8c6('0xf')]['code']===0x1f4){logger['error'](_0xc8c6('0xd'),_0x4a79c,_0x956961[_0xc8c6('0xf')]['message']);return _0x3da013(_0x956961[_0xc8c6('0xf')][_0xc8c6('0x10')]);}logger[_0xc8c6('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4a79c,_0x956961[_0xc8c6('0xf')][_0xc8c6('0x10')]);return _0x3fd85b(_0x956961['error'][_0xc8c6('0x10')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4a79c,_0xc8c6('0xe'));_0x3fd85b(_0x956961[_0xc8c6('0x11')][_0xc8c6('0x10')]);}})[_0xc8c6('0x12')](function(_0x12609b){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4a79c,_0x12609b);_0x3da013(_0x12609b);});});}exports[_0xc8c6('0x13')]=function(_0x3efdbc){var _0x124717=this;return new Promise(function(_0x38164b,_0x46479b){return db[_0xc8c6('0x14')][_0xc8c6('0x15')]({'raw':_0x3efdbc['options']?_0x3efdbc[_0xc8c6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3efdbc['options']?_0x3efdbc[_0xc8c6('0x16')][_0xc8c6('0x17')]||null:null,'attributes':_0x3efdbc[_0xc8c6('0x16')]?_0x3efdbc[_0xc8c6('0x16')]['attributes']||null:null,'limit':_0x3efdbc['options']?_0x3efdbc[_0xc8c6('0x16')]['limit']||null:null,'include':_0x3efdbc[_0xc8c6('0x16')]?_0x3efdbc[_0xc8c6('0x16')][_0xc8c6('0x18')]?_[_0xc8c6('0x19')](_0x3efdbc[_0xc8c6('0x16')]['include'],function(_0x15395d){return{'model':db[_0x15395d[_0xc8c6('0x1a')]],'as':_0x15395d['as'],'attributes':_0x15395d[_0xc8c6('0x1b')],'include':_0x15395d['include']?_[_0xc8c6('0x19')](_0x15395d[_0xc8c6('0x18')],function(_0x1125f6){return{'model':db[_0x1125f6[_0xc8c6('0x1a')]],'as':_0x1125f6['as'],'attributes':_0x1125f6[_0xc8c6('0x1b')],'include':_0x1125f6[_0xc8c6('0x18')]?_['map'](_0x1125f6['include'],function(_0x38b52e){return{'model':db[_0x38b52e['model']],'as':_0x38b52e['as'],'attributes':_0x38b52e[_0xc8c6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8c6('0xb')](function(_0x6c1dc){logger[_0xc8c6('0xc')]('GetVtigerAccount',_0x3efdbc);logger['debug'](_0xc8c6('0x13'),_0x3efdbc,JSON['stringify'](_0x6c1dc));_0x38164b(_0x6c1dc);})[_0xc8c6('0x12')](function(_0x2037fb){logger['error'](_0xc8c6('0x13'),_0x2037fb[_0xc8c6('0x10')],_0x3efdbc);_0x46479b(_0x124717[_0xc8c6('0xf')](0x1f4,_0x2037fb[_0xc8c6('0x10')]));});});};exports[_0xc8c6('0x1c')]=function(_0x55a464){var _0x312fd6=this;return new Promise(function(_0x3684d9,_0x105ec9){return db[_0xc8c6('0x14')][_0xc8c6('0x1d')]({'raw':_0x55a464['options']?_0x55a464[_0xc8c6('0x16')][_0xc8c6('0x1e')]===undefined?!![]:![]:!![],'where':_0x55a464['options']?_0x55a464[_0xc8c6('0x16')][_0xc8c6('0x17')]||null:null,'attributes':_0x55a464['options']?_0x55a464[_0xc8c6('0x16')][_0xc8c6('0x1b')]||null:null,'include':_0x55a464['options']?_0x55a464[_0xc8c6('0x16')][_0xc8c6('0x18')]?_[_0xc8c6('0x19')](_0x55a464[_0xc8c6('0x16')][_0xc8c6('0x18')],function(_0x5c81b3){return{'model':db[_0x5c81b3[_0xc8c6('0x1a')]],'as':_0x5c81b3['as'],'attributes':_0x5c81b3['attributes'],'include':_0x5c81b3[_0xc8c6('0x18')]?_[_0xc8c6('0x19')](_0x5c81b3['include'],function(_0x593eea){return{'model':db[_0x593eea[_0xc8c6('0x1a')]],'as':_0x593eea['as'],'attributes':_0x593eea[_0xc8c6('0x1b')],'include':_0x593eea[_0xc8c6('0x18')]?_[_0xc8c6('0x19')](_0x593eea[_0xc8c6('0x18')],function(_0x3ad982){return{'model':db[_0x3ad982['model']],'as':_0x3ad982['as'],'attributes':_0x3ad982[_0xc8c6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8c6('0xb')](function(_0xdd6d19){logger[_0xc8c6('0xc')](_0xc8c6('0x1c'),_0x55a464);logger['debug']('ShowVtigerAccount',_0x55a464,JSON[_0xc8c6('0x1f')](_0xdd6d19));_0x3684d9(_0xdd6d19);})[_0xc8c6('0x12')](function(_0x3652bc){logger[_0xc8c6('0xf')](_0xc8c6('0x1c'),_0x3652bc[_0xc8c6('0x10')],_0x55a464);_0x105ec9(_0x312fd6[_0xc8c6('0xf')](0x1f4,_0x3652bc[_0xc8c6('0x10')]));});});}; \ No newline at end of file +var _0x9cfd=['ShowVtigerAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','raw','where','map','include','model','attributes','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9cfd,0x1bc));var _0xd9cf=function(_0x296a76,_0xb18304){_0x296a76=_0x296a76-0x0;var _0x394372=_0x9cfd[_0x296a76];return _0x394372;};'use strict';var _=require(_0xd9cf('0x0'));var util=require('util');var moment=require(_0xd9cf('0x1'));var BPromise=require(_0xd9cf('0x2'));var rs=require(_0xd9cf('0x3'));var fs=require('fs');var Redis=require(_0xd9cf('0x4'));var db=require(_0xd9cf('0x5'))['db'];var utils=require(_0xd9cf('0x6'));var logger=require(_0xd9cf('0x7'))(_0xd9cf('0x8'));var config=require('../../config/environment');var jayson=require(_0xd9cf('0x9'));var client=jayson[_0xd9cf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc91e01,_0x149b9f,_0x2a19c2){return new BPromise(function(_0xdd2f97,_0x15edab){return client[_0xd9cf('0xb')](_0xc91e01,_0x2a19c2)[_0xd9cf('0xc')](function(_0x5c1619){logger[_0xd9cf('0xd')](_0xd9cf('0xe'),_0x149b9f,_0xd9cf('0xf'));logger[_0xd9cf('0x10')](_0xd9cf('0x11'),_0x149b9f,_0xd9cf('0xf'),JSON['stringify'](_0x5c1619));if(_0x5c1619['error']){if(_0x5c1619[_0xd9cf('0x12')][_0xd9cf('0x13')]===0x1f4){logger[_0xd9cf('0x12')](_0xd9cf('0xe'),_0x149b9f,_0x5c1619[_0xd9cf('0x12')][_0xd9cf('0x14')]);return _0x15edab(_0x5c1619['error']['message']);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x149b9f,_0x5c1619[_0xd9cf('0x12')][_0xd9cf('0x14')]);return _0xdd2f97(_0x5c1619['error'][_0xd9cf('0x14')]);}else{logger[_0xd9cf('0xd')](_0xd9cf('0xe'),_0x149b9f,_0xd9cf('0xf'));_0xdd2f97(_0x5c1619['result'][_0xd9cf('0x14')]);}})[_0xd9cf('0x15')](function(_0x5487cd){logger[_0xd9cf('0x12')](_0xd9cf('0xe'),_0x149b9f,_0x5487cd);_0x15edab(_0x5487cd);});});}exports[_0xd9cf('0x16')]=function(_0x49d5aa){var _0x2b16fc=this;return new Promise(function(_0x4a94d6,_0x29bc81){return db[_0xd9cf('0x17')]['findAll']({'raw':_0x49d5aa[_0xd9cf('0x18')]?_0x49d5aa[_0xd9cf('0x18')][_0xd9cf('0x19')]===undefined?!![]:![]:!![],'where':_0x49d5aa[_0xd9cf('0x18')]?_0x49d5aa['options'][_0xd9cf('0x1a')]||null:null,'attributes':_0x49d5aa[_0xd9cf('0x18')]?_0x49d5aa[_0xd9cf('0x18')]['attributes']||null:null,'limit':_0x49d5aa[_0xd9cf('0x18')]?_0x49d5aa[_0xd9cf('0x18')]['limit']||null:null,'include':_0x49d5aa[_0xd9cf('0x18')]?_0x49d5aa[_0xd9cf('0x18')]['include']?_[_0xd9cf('0x1b')](_0x49d5aa['options'][_0xd9cf('0x1c')],function(_0x3319ad){return{'model':db[_0x3319ad['model']],'as':_0x3319ad['as'],'attributes':_0x3319ad['attributes'],'include':_0x3319ad['include']?_[_0xd9cf('0x1b')](_0x3319ad[_0xd9cf('0x1c')],function(_0x24a075){return{'model':db[_0x24a075[_0xd9cf('0x1d')]],'as':_0x24a075['as'],'attributes':_0x24a075[_0xd9cf('0x1e')],'include':_0x24a075[_0xd9cf('0x1c')]?_[_0xd9cf('0x1b')](_0x24a075[_0xd9cf('0x1c')],function(_0x2c0a33){return{'model':db[_0x2c0a33['model']],'as':_0x2c0a33['as'],'attributes':_0x2c0a33['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9cf('0xc')](function(_0x5806dd){logger['info'](_0xd9cf('0x16'),_0x49d5aa);logger[_0xd9cf('0x10')](_0xd9cf('0x16'),_0x49d5aa,JSON[_0xd9cf('0x1f')](_0x5806dd));_0x4a94d6(_0x5806dd);})['catch'](function(_0x25919a){logger[_0xd9cf('0x12')]('GetVtigerAccount',_0x25919a[_0xd9cf('0x14')],_0x49d5aa);_0x29bc81(_0x2b16fc['error'](0x1f4,_0x25919a['message']));});});};exports[_0xd9cf('0x20')]=function(_0x4b5145){var _0x29037b=this;return new Promise(function(_0x470f6d,_0x3a94ba){return db[_0xd9cf('0x17')][_0xd9cf('0x21')]({'raw':_0x4b5145[_0xd9cf('0x18')]?_0x4b5145['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b5145['options']?_0x4b5145[_0xd9cf('0x18')][_0xd9cf('0x1a')]||null:null,'attributes':_0x4b5145[_0xd9cf('0x18')]?_0x4b5145[_0xd9cf('0x18')][_0xd9cf('0x1e')]||null:null,'include':_0x4b5145[_0xd9cf('0x18')]?_0x4b5145['options'][_0xd9cf('0x1c')]?_['map'](_0x4b5145[_0xd9cf('0x18')][_0xd9cf('0x1c')],function(_0x5c2e19){return{'model':db[_0x5c2e19[_0xd9cf('0x1d')]],'as':_0x5c2e19['as'],'attributes':_0x5c2e19[_0xd9cf('0x1e')],'include':_0x5c2e19[_0xd9cf('0x1c')]?_[_0xd9cf('0x1b')](_0x5c2e19['include'],function(_0x8c53a7){return{'model':db[_0x8c53a7[_0xd9cf('0x1d')]],'as':_0x8c53a7['as'],'attributes':_0x8c53a7[_0xd9cf('0x1e')],'include':_0x8c53a7[_0xd9cf('0x1c')]?_[_0xd9cf('0x1b')](_0x8c53a7[_0xd9cf('0x1c')],function(_0x27c17e){return{'model':db[_0x27c17e[_0xd9cf('0x1d')]],'as':_0x27c17e['as'],'attributes':_0x27c17e[_0xd9cf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd9cf('0xc')](function(_0x4aa586){logger[_0xd9cf('0xd')](_0xd9cf('0x20'),_0x4b5145);logger['debug'](_0xd9cf('0x20'),_0x4b5145,JSON[_0xd9cf('0x1f')](_0x4aa586));_0x470f6d(_0x4aa586);})['catch'](function(_0x1b795a){logger[_0xd9cf('0x12')]('ShowVtigerAccount',_0x1b795a[_0xd9cf('0x14')],_0x4b5145);_0x3a94ba(_0x29037b[_0xd9cf('0x12')](0x1f4,_0x1b795a[_0xd9cf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 154a5b5..332ffae 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x32baba,_0x41852b){var _0x3569f2=function(_0x524e99){while(--_0x524e99){_0x32baba['push'](_0x32baba['shift']());}};_0x3569f2(++_0x41852b);}(_0xadb5,0xad));var _0x5adb=function(_0x90eec1,_0x3d44e6){_0x90eec1=_0x90eec1-0x0;var _0x3153df=_0xadb5[_0x90eec1];return _0x3153df;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x553f1b,_0xda32d0){var _0x57f135=function(_0x3a290d){while(--_0x3a290d){_0x553f1b['push'](_0x553f1b['shift']());}};_0x57f135(++_0xda32d0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c7d5b,_0x18b598){_0x2c7d5b=_0x2c7d5b-0x0;var _0x24227d=_0x5f2f[_0x2c7d5b];return _0x24227d;};'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 fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index d67e22e..6405218 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 _0x310b=['sequelize','exports','STRING'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x310b,0x14a));var _0xb310=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x310b[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require(_0xb310('0x0'));module[_0xb310('0x1')]={'name':{'type':Sequelize[_0xb310('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7464=['exports','STRING','sequelize'];(function(_0xf147f1,_0x1632b3){var _0xd2fe8d=function(_0x56383a){while(--_0x56383a){_0xf147f1['push'](_0xf147f1['shift']());}};_0xd2fe8d(++_0x1632b3);}(_0x7464,0x170));var _0x4746=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7464[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4746('0x0'));module[_0x4746('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4746('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index dc2a7c3..72fa348 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 _0xf360=['../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','merge','filter','options','include','findAll','rows','params','keys','fields','includeAll','create','body','find','getFields','findOne','VtigerField','length','order','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4c9d58,_0x1c83f0){var _0x3ad22d=function(_0xd95048){while(--_0xd95048){_0x4c9d58['push'](_0x4c9d58['shift']());}};_0x3ad22d(++_0x1c83f0);}(_0xf360,0x9e));var _0x0f36=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf360[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x0f36('0x0'));var emlformat=require(_0x0f36('0x1'));var rimraf=require(_0x0f36('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f36('0x3'));var rp=require('request-promise');var moment=require(_0x0f36('0x4'));var BPromise=require(_0x0f36('0x5'));var Mustache=require(_0x0f36('0x6'));var util=require('util');var path=require(_0x0f36('0x7'));var sox=require(_0x0f36('0x8'));var csv=require(_0x0f36('0x9'));var ejs=require(_0x0f36('0xa'));var fs=require('fs');var fs_extra=require(_0x0f36('0xb'));var _=require(_0x0f36('0xc'));var squel=require(_0x0f36('0xd'));var crypto=require(_0x0f36('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0f36('0xf'));var toCsv=require(_0x0f36('0x9'));var querystring=require(_0x0f36('0x10'));var Papa=require(_0x0f36('0x11'));var Redis=require(_0x0f36('0x12'));var authService=require(_0x0f36('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0f36('0x14'));var hardwareService=require(_0x0f36('0x15'));var logger=require(_0x0f36('0x16'))('api');var utils=require(_0x0f36('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0f36('0x18'))['db'];var jayson=require(_0x0f36('0x19'));var client=jayson['client'][_0x0f36('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x44bf94,_0x1f8661,_0xb021c,_0x5dee19){return new BPromise(function(_0x1a06cc,_0x5e85c6){var _0x1d91bb=_0x5dee19||client;return _0x1d91bb[_0x0f36('0x1b')](_0x44bf94,_0xb021c)[_0x0f36('0x1c')](function(_0x38e64a){logger[_0x0f36('0x1d')](_0x0f36('0x1e'),_0x1f8661,_0x0f36('0x1f'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1f8661,_0x0f36('0x1f'),JSON[_0x0f36('0x20')](_0x38e64a));if(_0x38e64a['error']){if(_0x38e64a['error'][_0x0f36('0x21')]===0x1f4){logger[_0x0f36('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f8661,_0x38e64a[_0x0f36('0x22')][_0x0f36('0x23')]);return _0x5e85c6(_0x38e64a['error'][_0x0f36('0x23')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1f8661,_0x38e64a[_0x0f36('0x22')][_0x0f36('0x23')]);return _0x1a06cc(_0x38e64a['error']['message']);}else{logger[_0x0f36('0x1d')](_0x0f36('0x1e'),_0x1f8661,'request\x20sent');_0x1a06cc(_0x38e64a[_0x0f36('0x24')]['message']);}})[_0x0f36('0x25')](function(_0x5ae0bd){logger[_0x0f36('0x22')](_0x0f36('0x1e'),_0x1f8661,_0x5ae0bd);_0x5e85c6(_0x5ae0bd);});});}function respondWithStatusCode(_0x15722f,_0x552d90){_0x552d90=_0x552d90||0xcc;return function(_0x44c08d){if(_0x44c08d){return _0x15722f[_0x0f36('0x26')](_0x552d90);}return _0x15722f[_0x0f36('0x27')](_0x552d90)['end']();};}function respondWithResult(_0x2e7ee5,_0x23050c){_0x23050c=_0x23050c||0xc8;return function(_0x264639){if(_0x264639){return _0x2e7ee5[_0x0f36('0x27')](_0x23050c)['json'](_0x264639);}};}function respondWithFilteredResult(_0x20c2e7,_0x5aaa73){return function(_0x2563c9){if(_0x2563c9){var _0x481492=_0x2563c9[_0x0f36('0x28')],_0x186527=_0x5aaa73['offset'],_0x3b8385=_0x5aaa73[_0x0f36('0x29')]+_0x5aaa73['limit'],_0x42ed91;if(_0x3b8385>=_0x481492){_0x3b8385=_0x481492;_0x42ed91=0xc8;}else{_0x42ed91=0xce;}_0x20c2e7[_0x0f36('0x27')](_0x42ed91);return _0x20c2e7[_0x0f36('0x2a')](_0x0f36('0x2b'),_0x186527+'-'+_0x3b8385+'/'+_0x481492)[_0x0f36('0x2c')](_0x2563c9);}return null;};}function patchUpdates(_0xec35f0){return function(_0x47cbd0){try{jsonpatch[_0x0f36('0x2d')](_0x47cbd0,_0xec35f0,!![]);}catch(_0x21f4c5){return BPromise[_0x0f36('0x2e')](_0x21f4c5);}return _0x47cbd0[_0x0f36('0x2f')]();};}function saveUpdates(_0xbd824c,_0x4b76e7){return function(_0x55add1){if(_0x55add1){return _0x55add1[_0x0f36('0x30')](_0xbd824c)[_0x0f36('0x1c')](function(_0x10b43c){return _0x10b43c;});}return null;};}function removeEntity(_0x21b929,_0x467cfa){return function(_0x4af3fc){if(_0x4af3fc){return _0x4af3fc[_0x0f36('0x31')]()['then'](function(){_0x21b929[_0x0f36('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x370d46,_0x5d90e3){return function(_0x47cfe8){if(!_0x47cfe8){_0x370d46[_0x0f36('0x26')](0x194);}return _0x47cfe8;};}function handleError(_0x412fc4,_0x2b42d8){_0x2b42d8=_0x2b42d8||0x1f4;return function(_0x1112f7){logger[_0x0f36('0x22')](_0x1112f7[_0x0f36('0x32')]);if(_0x1112f7[_0x0f36('0x33')]){delete _0x1112f7[_0x0f36('0x33')];}_0x412fc4[_0x0f36('0x27')](_0x2b42d8)[_0x0f36('0x34')](_0x1112f7);};}exports[_0x0f36('0x35')]=function(_0x2993b1,_0x3e5304){var _0x9494ef={},_0x474458={},_0x4f227f={'count':0x0,'rows':[]};var _0x2a8e57=_['map'](db[_0x0f36('0x36')][_0x0f36('0x37')],function(_0x50f7a2){return{'name':_0x50f7a2[_0x0f36('0x38')],'type':_0x50f7a2[_0x0f36('0x39')]['key']};});_0x474458[_0x0f36('0x3a')]=_[_0x0f36('0x3b')](_0x2a8e57,_0x0f36('0x33'));_0x474458['query']=_['keys'](_0x2993b1[_0x0f36('0x3c')]);_0x474458[_0x0f36('0x3d')]=_[_0x0f36('0x3e')](_0x474458[_0x0f36('0x3a')],_0x474458[_0x0f36('0x3c')]);_0x9494ef['attributes']=_[_0x0f36('0x3e')](_0x474458['model'],qs['fields'](_0x2993b1[_0x0f36('0x3c')]['fields']));_0x9494ef[_0x0f36('0x3f')]=_0x9494ef[_0x0f36('0x3f')]['length']?_0x9494ef['attributes']:_0x474458['model'];if(!_0x2993b1[_0x0f36('0x3c')][_0x0f36('0x40')](_0x0f36('0x41'))){_0x9494ef[_0x0f36('0x42')]=qs[_0x0f36('0x42')](_0x2993b1[_0x0f36('0x3c')][_0x0f36('0x42')]);_0x9494ef[_0x0f36('0x29')]=qs['offset'](_0x2993b1[_0x0f36('0x3c')][_0x0f36('0x29')]);}_0x9494ef['order']=qs[_0x0f36('0x43')](_0x2993b1[_0x0f36('0x3c')]['sort']);_0x9494ef[_0x0f36('0x44')]=qs[_0x0f36('0x3d')](_[_0x0f36('0x45')](_0x2993b1['query'],_0x474458[_0x0f36('0x3d')]),_0x2a8e57);if(_0x2993b1[_0x0f36('0x3c')]['filter']){_0x9494ef[_0x0f36('0x44')]=_[_0x0f36('0x46')](_0x9494ef[_0x0f36('0x44')],{'$or':_[_0x0f36('0x3b')](_0x2a8e57,function(_0x1bc47b){if(_0x1bc47b['type']!=='VIRTUAL'){var _0x5bbc38={};_0x5bbc38[_0x1bc47b['name']]={'$like':'%'+_0x2993b1[_0x0f36('0x3c')][_0x0f36('0x47')]+'%'};return _0x5bbc38;}})});}_0x9494ef=_['merge']({},_0x9494ef,_0x2993b1[_0x0f36('0x48')]);var _0x73fe36={'where':_0x9494ef[_0x0f36('0x44')]};return db['VtigerConfiguration']['count'](_0x73fe36)[_0x0f36('0x1c')](function(_0x3140a5){_0x4f227f['count']=_0x3140a5;if(_0x2993b1[_0x0f36('0x3c')]['includeAll']){_0x9494ef[_0x0f36('0x49')]=[{'all':!![]}];}return db[_0x0f36('0x36')][_0x0f36('0x4a')](_0x9494ef);})['then'](function(_0x49d432){_0x4f227f[_0x0f36('0x4b')]=_0x49d432;return _0x4f227f;})[_0x0f36('0x1c')](respondWithFilteredResult(_0x3e5304,_0x9494ef))[_0x0f36('0x25')](handleError(_0x3e5304,null));};exports['show']=function(_0x4ee09c,_0x2895c0){var _0x4174ab={'raw':![],'where':{'id':_0x4ee09c[_0x0f36('0x4c')]['id']}},_0x2e9ab1={};_0x2e9ab1['model']=_[_0x0f36('0x4d')](db[_0x0f36('0x36')][_0x0f36('0x37')]);_0x2e9ab1[_0x0f36('0x3c')]=_[_0x0f36('0x4d')](_0x4ee09c[_0x0f36('0x3c')]);_0x2e9ab1[_0x0f36('0x3d')]=_['intersection'](_0x2e9ab1[_0x0f36('0x3a')],_0x2e9ab1[_0x0f36('0x3c')]);_0x4174ab[_0x0f36('0x3f')]=_[_0x0f36('0x3e')](_0x2e9ab1[_0x0f36('0x3a')],qs[_0x0f36('0x4e')](_0x4ee09c[_0x0f36('0x3c')][_0x0f36('0x4e')]));_0x4174ab['attributes']=_0x4174ab[_0x0f36('0x3f')]['length']?_0x4174ab[_0x0f36('0x3f')]:_0x2e9ab1[_0x0f36('0x3a')];if(_0x4ee09c[_0x0f36('0x3c')][_0x0f36('0x4f')]){_0x4174ab[_0x0f36('0x49')]=[{'all':!![]}];}_0x4174ab=_[_0x0f36('0x46')]({},_0x4174ab,_0x4ee09c['options']);return db[_0x0f36('0x36')]['find'](_0x4174ab)['then'](handleEntityNotFound(_0x2895c0,null))['then'](respondWithResult(_0x2895c0,null))[_0x0f36('0x25')](handleError(_0x2895c0,null));};exports['create']=function(_0x5425d0,_0x96dcd9){return db[_0x0f36('0x36')][_0x0f36('0x50')](_0x5425d0[_0x0f36('0x51')],{})[_0x0f36('0x1c')](respondWithResult(_0x96dcd9,0xc9))[_0x0f36('0x25')](handleError(_0x96dcd9,null));};exports['update']=function(_0x4e535f,_0x5499f0){if(_0x4e535f[_0x0f36('0x51')]['id']){delete _0x4e535f[_0x0f36('0x51')]['id'];}return db[_0x0f36('0x36')][_0x0f36('0x52')]({'where':{'id':_0x4e535f[_0x0f36('0x4c')]['id']}})[_0x0f36('0x1c')](handleEntityNotFound(_0x5499f0,null))[_0x0f36('0x1c')](saveUpdates(_0x4e535f[_0x0f36('0x51')],null))[_0x0f36('0x1c')](respondWithResult(_0x5499f0,null))['catch'](handleError(_0x5499f0,null));};exports[_0x0f36('0x31')]=function(_0x189809,_0x4f57ff){return db[_0x0f36('0x36')][_0x0f36('0x52')]({'where':{'id':_0x189809[_0x0f36('0x4c')]['id']}})[_0x0f36('0x1c')](handleEntityNotFound(_0x4f57ff,null))[_0x0f36('0x1c')](removeEntity(_0x4f57ff,null))[_0x0f36('0x25')](handleError(_0x4f57ff,null));};exports[_0x0f36('0x53')]=function(_0x4d7d96,_0x543f6c,_0x10355e){var _0x1a44a7={};var _0x6bd3ae={};var _0x5619c5;var _0x2086d2;return db[_0x0f36('0x36')][_0x0f36('0x54')]({'where':{'id':_0x4d7d96['params']['id']}})[_0x0f36('0x1c')](handleEntityNotFound(_0x543f6c,null))[_0x0f36('0x1c')](function(_0x262455){if(_0x262455){_0x5619c5=_0x262455;_0x6bd3ae['model']=_[_0x0f36('0x4d')](db[_0x0f36('0x55')][_0x0f36('0x37')]);_0x6bd3ae[_0x0f36('0x3c')]=_[_0x0f36('0x4d')](_0x4d7d96[_0x0f36('0x3c')]);_0x6bd3ae['filters']=_[_0x0f36('0x3e')](_0x6bd3ae[_0x0f36('0x3a')],_0x6bd3ae['query']);_0x1a44a7[_0x0f36('0x3f')]=_[_0x0f36('0x3e')](_0x6bd3ae[_0x0f36('0x3a')],qs[_0x0f36('0x4e')](_0x4d7d96[_0x0f36('0x3c')][_0x0f36('0x4e')]));_0x1a44a7[_0x0f36('0x3f')]=_0x1a44a7[_0x0f36('0x3f')][_0x0f36('0x56')]?_0x1a44a7[_0x0f36('0x3f')]:_0x6bd3ae[_0x0f36('0x3a')];_0x1a44a7[_0x0f36('0x57')]=qs['sort'](_0x4d7d96['query'][_0x0f36('0x43')]);_0x1a44a7[_0x0f36('0x44')]=qs['filters'](_[_0x0f36('0x45')](_0x4d7d96[_0x0f36('0x3c')],_0x6bd3ae[_0x0f36('0x3d')]));if(_0x4d7d96[_0x0f36('0x3c')]['filter']){_0x1a44a7[_0x0f36('0x44')]=_[_0x0f36('0x46')](_0x1a44a7[_0x0f36('0x44')],{'$or':_[_0x0f36('0x3b')](_0x1a44a7[_0x0f36('0x3f')],function(_0x1b962b){var _0x127040={};_0x127040[_0x1b962b]={'$like':'%'+_0x4d7d96[_0x0f36('0x3c')][_0x0f36('0x47')]+'%'};return _0x127040;})});}_0x1a44a7=_['merge']({},_0x1a44a7,_0x4d7d96[_0x0f36('0x48')]);return _0x5619c5[_0x0f36('0x53')](_0x1a44a7);}})[_0x0f36('0x1c')](function(_0x2ff335){if(_0x2ff335){_0x2086d2=_0x2ff335[_0x0f36('0x56')];if(!_0x4d7d96['query'][_0x0f36('0x40')](_0x0f36('0x41'))){_0x1a44a7['limit']=qs['limit'](_0x4d7d96[_0x0f36('0x3c')][_0x0f36('0x42')]);_0x1a44a7['offset']=qs[_0x0f36('0x29')](_0x4d7d96[_0x0f36('0x3c')][_0x0f36('0x29')]);}return _0x5619c5[_0x0f36('0x53')](_0x1a44a7);}})[_0x0f36('0x1c')](function(_0x28d187){if(_0x28d187){return _0x28d187?{'count':_0x2086d2,'rows':_0x28d187}:null;}})['then'](respondWithResult(_0x543f6c,null))[_0x0f36('0x25')](handleError(_0x543f6c,null));};exports['getSubjects']=function(_0x4c0341,_0x373596,_0x1e7982){var _0x48d4c8={};var _0x260831={};var _0x3be8d3;var _0x456d54;return db[_0x0f36('0x36')][_0x0f36('0x54')]({'where':{'id':_0x4c0341[_0x0f36('0x4c')]['id']}})['then'](handleEntityNotFound(_0x373596,null))['then'](function(_0x11c046){if(_0x11c046){_0x3be8d3=_0x11c046;_0x260831[_0x0f36('0x3a')]=_[_0x0f36('0x4d')](db['VtigerField'][_0x0f36('0x37')]);_0x260831[_0x0f36('0x3c')]=_['keys'](_0x4c0341[_0x0f36('0x3c')]);_0x260831[_0x0f36('0x3d')]=_[_0x0f36('0x3e')](_0x260831[_0x0f36('0x3a')],_0x260831[_0x0f36('0x3c')]);_0x48d4c8['attributes']=_[_0x0f36('0x3e')](_0x260831[_0x0f36('0x3a')],qs[_0x0f36('0x4e')](_0x4c0341[_0x0f36('0x3c')][_0x0f36('0x4e')]));_0x48d4c8[_0x0f36('0x3f')]=_0x48d4c8['attributes'][_0x0f36('0x56')]?_0x48d4c8['attributes']:_0x260831['model'];_0x48d4c8[_0x0f36('0x57')]=qs[_0x0f36('0x43')](_0x4c0341[_0x0f36('0x3c')]['sort']);_0x48d4c8['where']=qs[_0x0f36('0x3d')](_[_0x0f36('0x45')](_0x4c0341[_0x0f36('0x3c')],_0x260831['filters']));if(_0x4c0341[_0x0f36('0x3c')][_0x0f36('0x47')]){_0x48d4c8['where']=_[_0x0f36('0x46')](_0x48d4c8[_0x0f36('0x44')],{'$or':_[_0x0f36('0x3b')](_0x48d4c8[_0x0f36('0x3f')],function(_0x39aea9){var _0x5452ab={};_0x5452ab[_0x39aea9]={'$like':'%'+_0x4c0341[_0x0f36('0x3c')][_0x0f36('0x47')]+'%'};return _0x5452ab;})});}_0x48d4c8=_['merge']({},_0x48d4c8,_0x4c0341[_0x0f36('0x48')]);return _0x3be8d3[_0x0f36('0x58')](_0x48d4c8);}})[_0x0f36('0x1c')](function(_0xff585a){if(_0xff585a){_0x456d54=_0xff585a[_0x0f36('0x56')];if(!_0x4c0341[_0x0f36('0x3c')]['hasOwnProperty'](_0x0f36('0x41'))){_0x48d4c8[_0x0f36('0x42')]=qs[_0x0f36('0x42')](_0x4c0341[_0x0f36('0x3c')][_0x0f36('0x42')]);_0x48d4c8['offset']=qs[_0x0f36('0x29')](_0x4c0341[_0x0f36('0x3c')][_0x0f36('0x29')]);}return _0x3be8d3[_0x0f36('0x58')](_0x48d4c8);}})['then'](function(_0x472fc1){if(_0x472fc1){return _0x472fc1?{'count':_0x456d54,'rows':_0x472fc1}:null;}})[_0x0f36('0x1c')](respondWithResult(_0x373596,null))[_0x0f36('0x25')](handleError(_0x373596,null));};exports[_0x0f36('0x59')]=function(_0x6a1958,_0x44f0e4,_0x120f59){var _0xcd4228={};var _0x398f68={};var _0x31a2f0;var _0x207347;return db[_0x0f36('0x36')][_0x0f36('0x54')]({'where':{'id':_0x6a1958['params']['id']}})['then'](handleEntityNotFound(_0x44f0e4,null))[_0x0f36('0x1c')](function(_0x5b10f1){if(_0x5b10f1){_0x31a2f0=_0x5b10f1;_0x398f68[_0x0f36('0x3a')]=_[_0x0f36('0x4d')](db[_0x0f36('0x55')][_0x0f36('0x37')]);_0x398f68[_0x0f36('0x3c')]=_[_0x0f36('0x4d')](_0x6a1958[_0x0f36('0x3c')]);_0x398f68[_0x0f36('0x3d')]=_['intersection'](_0x398f68[_0x0f36('0x3a')],_0x398f68[_0x0f36('0x3c')]);_0xcd4228[_0x0f36('0x3f')]=_[_0x0f36('0x3e')](_0x398f68[_0x0f36('0x3a')],qs[_0x0f36('0x4e')](_0x6a1958[_0x0f36('0x3c')]['fields']));_0xcd4228[_0x0f36('0x3f')]=_0xcd4228['attributes'][_0x0f36('0x56')]?_0xcd4228[_0x0f36('0x3f')]:_0x398f68[_0x0f36('0x3a')];_0xcd4228[_0x0f36('0x57')]=qs['sort'](_0x6a1958[_0x0f36('0x3c')][_0x0f36('0x43')]);_0xcd4228[_0x0f36('0x44')]=qs['filters'](_[_0x0f36('0x45')](_0x6a1958['query'],_0x398f68['filters']));if(_0x6a1958[_0x0f36('0x3c')]['filter']){_0xcd4228[_0x0f36('0x44')]=_[_0x0f36('0x46')](_0xcd4228[_0x0f36('0x44')],{'$or':_[_0x0f36('0x3b')](_0xcd4228[_0x0f36('0x3f')],function(_0x443a28){var _0x274a52={};_0x274a52[_0x443a28]={'$like':'%'+_0x6a1958[_0x0f36('0x3c')][_0x0f36('0x47')]+'%'};return _0x274a52;})});}_0xcd4228=_[_0x0f36('0x46')]({},_0xcd4228,_0x6a1958[_0x0f36('0x48')]);return _0x31a2f0['getDescriptions'](_0xcd4228);}})['then'](function(_0x199cfd){if(_0x199cfd){_0x207347=_0x199cfd[_0x0f36('0x56')];if(!_0x6a1958[_0x0f36('0x3c')][_0x0f36('0x40')](_0x0f36('0x41'))){_0xcd4228['limit']=qs[_0x0f36('0x42')](_0x6a1958['query']['limit']);_0xcd4228[_0x0f36('0x29')]=qs[_0x0f36('0x29')](_0x6a1958['query']['offset']);}return _0x31a2f0[_0x0f36('0x59')](_0xcd4228);}})['then'](function(_0x2bd474){if(_0x2bd474){return _0x2bd474?{'count':_0x207347,'rows':_0x2bd474}:null;}})[_0x0f36('0x1c')](respondWithResult(_0x44f0e4,null))[_0x0f36('0x25')](handleError(_0x44f0e4,null));}; \ No newline at end of file +var _0x212b=['result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','params','keys','find','create','update','body','findOne','getFields','nolimit','getSubjects','VtigerField','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message'];(function(_0x5a366e,_0x158fd3){var _0x30e0b6=function(_0x2b54a0){while(--_0x2b54a0){_0x5a366e['push'](_0x5a366e['shift']());}};_0x30e0b6(++_0x158fd3);}(_0x212b,0x148));var _0xb212=function(_0x48c32c,_0x25aaee){_0x48c32c=_0x48c32c-0x0;var _0x18527f=_0x212b[_0x48c32c];return _0x18527f;};'use strict';var pdf=require(_0xb212('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb212('0x1'));var zipdir=require(_0xb212('0x2'));var jsonpatch=require(_0xb212('0x3'));var rp=require(_0xb212('0x4'));var moment=require('moment');var BPromise=require(_0xb212('0x5'));var Mustache=require(_0xb212('0x6'));var util=require(_0xb212('0x7'));var path=require('path');var sox=require(_0xb212('0x8'));var csv=require(_0xb212('0x9'));var ejs=require(_0xb212('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb212('0xb'));var squel=require(_0xb212('0xc'));var crypto=require('crypto');var jsforce=require(_0xb212('0xd'));var deskjs=require(_0xb212('0xe'));var toCsv=require(_0xb212('0x9'));var querystring=require('querystring');var Papa=require(_0xb212('0xf'));var Redis=require(_0xb212('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb212('0x11'));var logger=require('../../config/logger')(_0xb212('0x12'));var utils=require(_0xb212('0x13'));var config=require(_0xb212('0x14'));var licenseUtil=require(_0xb212('0x15'));var db=require(_0xb212('0x16'))['db'];var jayson=require(_0xb212('0x17'));var client=jayson[_0xb212('0x18')][_0xb212('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x168ce9,_0x3ea7dc,_0x2b64a7,_0x2f12bf){return new BPromise(function(_0x5118f5,_0x576095){var _0x5c56e2=_0x2f12bf||client;return _0x5c56e2['request'](_0x168ce9,_0x2b64a7)[_0xb212('0x1a')](function(_0x11dcab){logger[_0xb212('0x1b')]('VtigerConfiguration,\x20%s,\x20%s',_0x3ea7dc,_0xb212('0x1c'));logger[_0xb212('0x1d')](_0xb212('0x1e'),_0x3ea7dc,_0xb212('0x1c'),JSON[_0xb212('0x1f')](_0x11dcab));if(_0x11dcab[_0xb212('0x20')]){if(_0x11dcab[_0xb212('0x20')][_0xb212('0x21')]===0x1f4){logger[_0xb212('0x20')](_0xb212('0x22'),_0x3ea7dc,_0x11dcab[_0xb212('0x20')][_0xb212('0x23')]);return _0x576095(_0x11dcab[_0xb212('0x20')]['message']);}logger['error'](_0xb212('0x22'),_0x3ea7dc,_0x11dcab[_0xb212('0x20')][_0xb212('0x23')]);return _0x5118f5(_0x11dcab[_0xb212('0x20')][_0xb212('0x23')]);}else{logger[_0xb212('0x1b')](_0xb212('0x22'),_0x3ea7dc,_0xb212('0x1c'));_0x5118f5(_0x11dcab[_0xb212('0x24')][_0xb212('0x23')]);}})[_0xb212('0x25')](function(_0x94b568){logger[_0xb212('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x3ea7dc,_0x94b568);_0x576095(_0x94b568);});});}function respondWithStatusCode(_0x5e0c12,_0x25d40e){_0x25d40e=_0x25d40e||0xcc;return function(_0x3d01f9){if(_0x3d01f9){return _0x5e0c12[_0xb212('0x26')](_0x25d40e);}return _0x5e0c12[_0xb212('0x27')](_0x25d40e)[_0xb212('0x28')]();};}function respondWithResult(_0x2b9046,_0x2aafe4){_0x2aafe4=_0x2aafe4||0xc8;return function(_0x4ca0a2){if(_0x4ca0a2){return _0x2b9046[_0xb212('0x27')](_0x2aafe4)['json'](_0x4ca0a2);}};}function respondWithFilteredResult(_0xd1180f,_0x32849a){return function(_0xfd638d){if(_0xfd638d){var _0x508137=_0xfd638d['count'],_0x43d4b6=_0x32849a[_0xb212('0x29')],_0x2f9c0e=_0x32849a[_0xb212('0x29')]+_0x32849a[_0xb212('0x2a')],_0x42df2d;if(_0x2f9c0e>=_0x508137){_0x2f9c0e=_0x508137;_0x42df2d=0xc8;}else{_0x42df2d=0xce;}_0xd1180f[_0xb212('0x27')](_0x42df2d);return _0xd1180f[_0xb212('0x2b')](_0xb212('0x2c'),_0x43d4b6+'-'+_0x2f9c0e+'/'+_0x508137)[_0xb212('0x2d')](_0xfd638d);}return null;};}function patchUpdates(_0x170adf){return function(_0x1e8406){try{jsonpatch[_0xb212('0x2e')](_0x1e8406,_0x170adf,!![]);}catch(_0x36746b){return BPromise[_0xb212('0x2f')](_0x36746b);}return _0x1e8406[_0xb212('0x30')]();};}function saveUpdates(_0x365d42,_0x1f99c1){return function(_0x5c00c7){if(_0x5c00c7){return _0x5c00c7['update'](_0x365d42)[_0xb212('0x1a')](function(_0x37635b){return _0x37635b;});}return null;};}function removeEntity(_0x4831f3,_0x9424e7){return function(_0x34e597){if(_0x34e597){return _0x34e597[_0xb212('0x31')]()[_0xb212('0x1a')](function(){_0x4831f3[_0xb212('0x27')](0xcc)[_0xb212('0x28')]();});}};}function handleEntityNotFound(_0x2ad759,_0x1a770f){return function(_0x58cc94){if(!_0x58cc94){_0x2ad759['sendStatus'](0x194);}return _0x58cc94;};}function handleError(_0x5d5b02,_0x12b662){_0x12b662=_0x12b662||0x1f4;return function(_0xcb5c5c){logger[_0xb212('0x20')](_0xcb5c5c[_0xb212('0x32')]);if(_0xcb5c5c[_0xb212('0x33')]){delete _0xcb5c5c[_0xb212('0x33')];}_0x5d5b02[_0xb212('0x27')](_0x12b662)[_0xb212('0x34')](_0xcb5c5c);};}exports[_0xb212('0x35')]=function(_0x769ba9,_0x8727ab){var _0x3dea7c={},_0x50f4f4={},_0xb1f204={'count':0x0,'rows':[]};var _0x2a1bea=_[_0xb212('0x36')](db[_0xb212('0x37')][_0xb212('0x38')],function(_0x4b4fce){return{'name':_0x4b4fce[_0xb212('0x39')],'type':_0x4b4fce[_0xb212('0x3a')]['key']};});_0x50f4f4[_0xb212('0x3b')]=_['map'](_0x2a1bea,_0xb212('0x33'));_0x50f4f4[_0xb212('0x3c')]=_['keys'](_0x769ba9[_0xb212('0x3c')]);_0x50f4f4[_0xb212('0x3d')]=_[_0xb212('0x3e')](_0x50f4f4[_0xb212('0x3b')],_0x50f4f4['query']);_0x3dea7c[_0xb212('0x3f')]=_[_0xb212('0x3e')](_0x50f4f4['model'],qs[_0xb212('0x40')](_0x769ba9['query']['fields']));_0x3dea7c[_0xb212('0x3f')]=_0x3dea7c[_0xb212('0x3f')][_0xb212('0x41')]?_0x3dea7c[_0xb212('0x3f')]:_0x50f4f4[_0xb212('0x3b')];if(!_0x769ba9[_0xb212('0x3c')][_0xb212('0x42')]('nolimit')){_0x3dea7c[_0xb212('0x2a')]=qs[_0xb212('0x2a')](_0x769ba9[_0xb212('0x3c')][_0xb212('0x2a')]);_0x3dea7c['offset']=qs[_0xb212('0x29')](_0x769ba9['query']['offset']);}_0x3dea7c[_0xb212('0x43')]=qs[_0xb212('0x44')](_0x769ba9[_0xb212('0x3c')][_0xb212('0x44')]);_0x3dea7c['where']=qs[_0xb212('0x3d')](_[_0xb212('0x45')](_0x769ba9[_0xb212('0x3c')],_0x50f4f4[_0xb212('0x3d')]),_0x2a1bea);if(_0x769ba9[_0xb212('0x3c')][_0xb212('0x46')]){_0x3dea7c[_0xb212('0x47')]=_[_0xb212('0x48')](_0x3dea7c[_0xb212('0x47')],{'$or':_['map'](_0x2a1bea,function(_0x213253){if(_0x213253['type']!==_0xb212('0x49')){var _0x54bde9={};_0x54bde9[_0x213253[_0xb212('0x33')]]={'$like':'%'+_0x769ba9[_0xb212('0x3c')]['filter']+'%'};return _0x54bde9;}})});}_0x3dea7c=_[_0xb212('0x48')]({},_0x3dea7c,_0x769ba9[_0xb212('0x4a')]);var _0x98e4e6={'where':_0x3dea7c[_0xb212('0x47')]};return db[_0xb212('0x37')]['count'](_0x98e4e6)['then'](function(_0x275359){_0xb1f204[_0xb212('0x4b')]=_0x275359;if(_0x769ba9[_0xb212('0x3c')][_0xb212('0x4c')]){_0x3dea7c[_0xb212('0x4d')]=[{'all':!![]}];}return db[_0xb212('0x37')][_0xb212('0x4e')](_0x3dea7c);})[_0xb212('0x1a')](function(_0x590601){_0xb1f204['rows']=_0x590601;return _0xb1f204;})['then'](respondWithFilteredResult(_0x8727ab,_0x3dea7c))[_0xb212('0x25')](handleError(_0x8727ab,null));};exports['show']=function(_0x6861cc,_0x42fdf5){var _0x2e25df={'raw':![],'where':{'id':_0x6861cc[_0xb212('0x4f')]['id']}},_0x171d7d={};_0x171d7d[_0xb212('0x3b')]=_[_0xb212('0x50')](db['VtigerConfiguration']['rawAttributes']);_0x171d7d[_0xb212('0x3c')]=_[_0xb212('0x50')](_0x6861cc[_0xb212('0x3c')]);_0x171d7d['filters']=_[_0xb212('0x3e')](_0x171d7d[_0xb212('0x3b')],_0x171d7d[_0xb212('0x3c')]);_0x2e25df[_0xb212('0x3f')]=_[_0xb212('0x3e')](_0x171d7d[_0xb212('0x3b')],qs[_0xb212('0x40')](_0x6861cc[_0xb212('0x3c')]['fields']));_0x2e25df[_0xb212('0x3f')]=_0x2e25df[_0xb212('0x3f')][_0xb212('0x41')]?_0x2e25df[_0xb212('0x3f')]:_0x171d7d[_0xb212('0x3b')];if(_0x6861cc[_0xb212('0x3c')][_0xb212('0x4c')]){_0x2e25df[_0xb212('0x4d')]=[{'all':!![]}];}_0x2e25df=_['merge']({},_0x2e25df,_0x6861cc['options']);return db[_0xb212('0x37')][_0xb212('0x51')](_0x2e25df)['then'](handleEntityNotFound(_0x42fdf5,null))[_0xb212('0x1a')](respondWithResult(_0x42fdf5,null))[_0xb212('0x25')](handleError(_0x42fdf5,null));};exports[_0xb212('0x52')]=function(_0x434b76,_0x82aaeb){return db['VtigerConfiguration']['create'](_0x434b76['body'],{})[_0xb212('0x1a')](respondWithResult(_0x82aaeb,0xc9))[_0xb212('0x25')](handleError(_0x82aaeb,null));};exports[_0xb212('0x53')]=function(_0x203b02,_0x2a94e6){if(_0x203b02[_0xb212('0x54')]['id']){delete _0x203b02['body']['id'];}return db[_0xb212('0x37')]['find']({'where':{'id':_0x203b02['params']['id']}})[_0xb212('0x1a')](handleEntityNotFound(_0x2a94e6,null))[_0xb212('0x1a')](saveUpdates(_0x203b02[_0xb212('0x54')],null))[_0xb212('0x1a')](respondWithResult(_0x2a94e6,null))[_0xb212('0x25')](handleError(_0x2a94e6,null));};exports[_0xb212('0x31')]=function(_0x474110,_0x400d05){return db[_0xb212('0x37')][_0xb212('0x51')]({'where':{'id':_0x474110[_0xb212('0x4f')]['id']}})[_0xb212('0x1a')](handleEntityNotFound(_0x400d05,null))[_0xb212('0x1a')](removeEntity(_0x400d05,null))[_0xb212('0x25')](handleError(_0x400d05,null));};exports['getFields']=function(_0x526e22,_0x48a886,_0x52300d){var _0x31e507={};var _0x4ca7cd={};var _0x2408d7;var _0x3aaf7c;return db[_0xb212('0x37')][_0xb212('0x55')]({'where':{'id':_0x526e22[_0xb212('0x4f')]['id']}})[_0xb212('0x1a')](handleEntityNotFound(_0x48a886,null))[_0xb212('0x1a')](function(_0xdd55d1){if(_0xdd55d1){_0x2408d7=_0xdd55d1;_0x4ca7cd[_0xb212('0x3b')]=_[_0xb212('0x50')](db['VtigerField'][_0xb212('0x38')]);_0x4ca7cd['query']=_['keys'](_0x526e22[_0xb212('0x3c')]);_0x4ca7cd[_0xb212('0x3d')]=_['intersection'](_0x4ca7cd[_0xb212('0x3b')],_0x4ca7cd[_0xb212('0x3c')]);_0x31e507[_0xb212('0x3f')]=_[_0xb212('0x3e')](_0x4ca7cd[_0xb212('0x3b')],qs[_0xb212('0x40')](_0x526e22[_0xb212('0x3c')][_0xb212('0x40')]));_0x31e507[_0xb212('0x3f')]=_0x31e507[_0xb212('0x3f')][_0xb212('0x41')]?_0x31e507['attributes']:_0x4ca7cd[_0xb212('0x3b')];_0x31e507[_0xb212('0x43')]=qs[_0xb212('0x44')](_0x526e22[_0xb212('0x3c')][_0xb212('0x44')]);_0x31e507[_0xb212('0x47')]=qs['filters'](_[_0xb212('0x45')](_0x526e22[_0xb212('0x3c')],_0x4ca7cd[_0xb212('0x3d')]));if(_0x526e22[_0xb212('0x3c')][_0xb212('0x46')]){_0x31e507[_0xb212('0x47')]=_[_0xb212('0x48')](_0x31e507[_0xb212('0x47')],{'$or':_[_0xb212('0x36')](_0x31e507[_0xb212('0x3f')],function(_0x507dfa){var _0x410bf5={};_0x410bf5[_0x507dfa]={'$like':'%'+_0x526e22['query'][_0xb212('0x46')]+'%'};return _0x410bf5;})});}_0x31e507=_['merge']({},_0x31e507,_0x526e22[_0xb212('0x4a')]);return _0x2408d7[_0xb212('0x56')](_0x31e507);}})[_0xb212('0x1a')](function(_0x398991){if(_0x398991){_0x3aaf7c=_0x398991[_0xb212('0x41')];if(!_0x526e22[_0xb212('0x3c')][_0xb212('0x42')](_0xb212('0x57'))){_0x31e507[_0xb212('0x2a')]=qs['limit'](_0x526e22[_0xb212('0x3c')][_0xb212('0x2a')]);_0x31e507[_0xb212('0x29')]=qs['offset'](_0x526e22[_0xb212('0x3c')]['offset']);}return _0x2408d7[_0xb212('0x56')](_0x31e507);}})[_0xb212('0x1a')](function(_0x2e7c91){if(_0x2e7c91){return _0x2e7c91?{'count':_0x3aaf7c,'rows':_0x2e7c91}:null;}})[_0xb212('0x1a')](respondWithResult(_0x48a886,null))[_0xb212('0x25')](handleError(_0x48a886,null));};exports[_0xb212('0x58')]=function(_0x1a551c,_0x275f8f,_0x40ee58){var _0x401b60={};var _0x3318f9={};var _0xad1832;var _0x54410d;return db[_0xb212('0x37')][_0xb212('0x55')]({'where':{'id':_0x1a551c['params']['id']}})[_0xb212('0x1a')](handleEntityNotFound(_0x275f8f,null))[_0xb212('0x1a')](function(_0x39f7fc){if(_0x39f7fc){_0xad1832=_0x39f7fc;_0x3318f9[_0xb212('0x3b')]=_[_0xb212('0x50')](db[_0xb212('0x59')][_0xb212('0x38')]);_0x3318f9['query']=_[_0xb212('0x50')](_0x1a551c[_0xb212('0x3c')]);_0x3318f9[_0xb212('0x3d')]=_[_0xb212('0x3e')](_0x3318f9['model'],_0x3318f9[_0xb212('0x3c')]);_0x401b60[_0xb212('0x3f')]=_[_0xb212('0x3e')](_0x3318f9['model'],qs[_0xb212('0x40')](_0x1a551c[_0xb212('0x3c')]['fields']));_0x401b60[_0xb212('0x3f')]=_0x401b60[_0xb212('0x3f')]['length']?_0x401b60[_0xb212('0x3f')]:_0x3318f9[_0xb212('0x3b')];_0x401b60[_0xb212('0x43')]=qs[_0xb212('0x44')](_0x1a551c[_0xb212('0x3c')][_0xb212('0x44')]);_0x401b60['where']=qs[_0xb212('0x3d')](_[_0xb212('0x45')](_0x1a551c[_0xb212('0x3c')],_0x3318f9[_0xb212('0x3d')]));if(_0x1a551c['query'][_0xb212('0x46')]){_0x401b60[_0xb212('0x47')]=_[_0xb212('0x48')](_0x401b60[_0xb212('0x47')],{'$or':_[_0xb212('0x36')](_0x401b60[_0xb212('0x3f')],function(_0x2e3ec6){var _0x1f25a4={};_0x1f25a4[_0x2e3ec6]={'$like':'%'+_0x1a551c[_0xb212('0x3c')][_0xb212('0x46')]+'%'};return _0x1f25a4;})});}_0x401b60=_['merge']({},_0x401b60,_0x1a551c['options']);return _0xad1832[_0xb212('0x58')](_0x401b60);}})[_0xb212('0x1a')](function(_0x291a00){if(_0x291a00){_0x54410d=_0x291a00['length'];if(!_0x1a551c['query'][_0xb212('0x42')](_0xb212('0x57'))){_0x401b60[_0xb212('0x2a')]=qs[_0xb212('0x2a')](_0x1a551c[_0xb212('0x3c')][_0xb212('0x2a')]);_0x401b60[_0xb212('0x29')]=qs[_0xb212('0x29')](_0x1a551c[_0xb212('0x3c')]['offset']);}return _0xad1832[_0xb212('0x58')](_0x401b60);}})[_0xb212('0x1a')](function(_0x4fde52){if(_0x4fde52){return _0x4fde52?{'count':_0x54410d,'rows':_0x4fde52}:null;}})['then'](respondWithResult(_0x275f8f,null))[_0xb212('0x25')](handleError(_0x275f8f,null));};exports[_0xb212('0x5a')]=function(_0x3b32c9,_0xeb469,_0x5c1053){var _0x383961={};var _0x791044={};var _0x129f51;var _0x1de428;return db[_0xb212('0x37')]['findOne']({'where':{'id':_0x3b32c9[_0xb212('0x4f')]['id']}})['then'](handleEntityNotFound(_0xeb469,null))[_0xb212('0x1a')](function(_0x53c9fa){if(_0x53c9fa){_0x129f51=_0x53c9fa;_0x791044[_0xb212('0x3b')]=_[_0xb212('0x50')](db[_0xb212('0x59')][_0xb212('0x38')]);_0x791044['query']=_[_0xb212('0x50')](_0x3b32c9['query']);_0x791044['filters']=_['intersection'](_0x791044[_0xb212('0x3b')],_0x791044[_0xb212('0x3c')]);_0x383961[_0xb212('0x3f')]=_[_0xb212('0x3e')](_0x791044[_0xb212('0x3b')],qs[_0xb212('0x40')](_0x3b32c9[_0xb212('0x3c')][_0xb212('0x40')]));_0x383961[_0xb212('0x3f')]=_0x383961['attributes']['length']?_0x383961[_0xb212('0x3f')]:_0x791044[_0xb212('0x3b')];_0x383961['order']=qs[_0xb212('0x44')](_0x3b32c9['query'][_0xb212('0x44')]);_0x383961['where']=qs[_0xb212('0x3d')](_[_0xb212('0x45')](_0x3b32c9[_0xb212('0x3c')],_0x791044['filters']));if(_0x3b32c9[_0xb212('0x3c')][_0xb212('0x46')]){_0x383961[_0xb212('0x47')]=_[_0xb212('0x48')](_0x383961[_0xb212('0x47')],{'$or':_[_0xb212('0x36')](_0x383961['attributes'],function(_0xa883f5){var _0x4ec6ef={};_0x4ec6ef[_0xa883f5]={'$like':'%'+_0x3b32c9[_0xb212('0x3c')][_0xb212('0x46')]+'%'};return _0x4ec6ef;})});}_0x383961=_['merge']({},_0x383961,_0x3b32c9[_0xb212('0x4a')]);return _0x129f51[_0xb212('0x5a')](_0x383961);}})[_0xb212('0x1a')](function(_0x4575d6){if(_0x4575d6){_0x1de428=_0x4575d6['length'];if(!_0x3b32c9[_0xb212('0x3c')]['hasOwnProperty'](_0xb212('0x57'))){_0x383961['limit']=qs['limit'](_0x3b32c9[_0xb212('0x3c')][_0xb212('0x2a')]);_0x383961[_0xb212('0x29')]=qs[_0xb212('0x29')](_0x3b32c9[_0xb212('0x3c')]['offset']);}return _0x129f51[_0xb212('0x5a')](_0x383961);}})[_0xb212('0x1a')](function(_0x4dccc1){if(_0x4dccc1){return _0x4dccc1?{'count':_0x1de428,'rows':_0x4dccc1}:null;}})[_0xb212('0x1a')](respondWithResult(_0xeb469,null))[_0xb212('0x25')](handleError(_0xeb469,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b9ad4da..b7c3d94 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 _0x1adb=['bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment'];(function(_0xa44026,_0x2bdc56){var _0x167311=function(_0x38f123){while(--_0x38f123){_0xa44026['push'](_0xa44026['shift']());}};_0x167311(++_0x2bdc56);}(_0x1adb,0xa5));var _0xb1ad=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1adb[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb1ad('0x0'));var util=require(_0xb1ad('0x1'));var logger=require('../../config/logger')(_0xb1ad('0x2'));var moment=require(_0xb1ad('0x3'));var BPromise=require(_0xb1ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1ad('0x5'));var rimraf=require(_0xb1ad('0x6'));var config=require(_0xb1ad('0x7'));var attributes=require(_0xb1ad('0x8'));module[_0xb1ad('0x9')]=function(_0x4a6efb,_0x120dff){return _0x4a6efb[_0xb1ad('0xa')](_0xb1ad('0xb'),attributes,{'tableName':_0xb1ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['request-promise','path','rimraf','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x65c180,_0x4f41a2){var _0x5b6e7c=function(_0x564a86){while(--_0x564a86){_0x65c180['push'](_0x65c180['shift']());}};_0x5b6e7c(++_0x4f41a2);}(_0xba34,0xcd));var _0x4ba3=function(_0x11711a,_0x1f555c){_0x11711a=_0x11711a-0x0;var _0x9601a=_0xba34[_0x11711a];return _0x9601a;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var fs=require('fs');var path=require(_0x4ba3('0x5'));var rimraf=require(_0x4ba3('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x4ba3('0x7')]=function(_0x2efb8c,_0x5eb739){return _0x2efb8c[_0x4ba3('0x8')](_0x4ba3('0x9'),attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 2f1d6bb..ec14c0f 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 _0x2cba=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4f4c28,_0x509704){var _0x42b0a7=function(_0x20e967){while(--_0x20e967){_0x4f4c28['push'](_0x4f4c28['shift']());}};_0x42b0a7(++_0x509704);}(_0x2cba,0xbf));var _0xa2cb=function(_0x54fa92,_0x37f89d){_0x54fa92=_0x54fa92-0x0;var _0x7ac7ef=_0x2cba[_0x54fa92];return _0x7ac7ef;};'use strict';var _=require(_0xa2cb('0x0'));var util=require(_0xa2cb('0x1'));var moment=require('moment');var BPromise=require(_0xa2cb('0x2'));var rs=require(_0xa2cb('0x3'));var fs=require('fs');var Redis=require(_0xa2cb('0x4'));var db=require(_0xa2cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa2cb('0x6'));var client=jayson[_0xa2cb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1635d2,_0x13dd00,_0x5c2ac1){return new BPromise(function(_0x1ed45b,_0x394a34){return client[_0xa2cb('0x8')](_0x1635d2,_0x5c2ac1)[_0xa2cb('0x9')](function(_0x3b7c02){logger[_0xa2cb('0xa')](_0xa2cb('0xb'),_0x13dd00,_0xa2cb('0xc'));logger['debug'](_0xa2cb('0xd'),_0x13dd00,'request\x20sent',JSON['stringify'](_0x3b7c02));if(_0x3b7c02['error']){if(_0x3b7c02[_0xa2cb('0xe')]['code']===0x1f4){logger[_0xa2cb('0xe')](_0xa2cb('0xb'),_0x13dd00,_0x3b7c02[_0xa2cb('0xe')][_0xa2cb('0xf')]);return _0x394a34(_0x3b7c02['error']['message']);}logger[_0xa2cb('0xe')](_0xa2cb('0xb'),_0x13dd00,_0x3b7c02[_0xa2cb('0xe')][_0xa2cb('0xf')]);return _0x1ed45b(_0x3b7c02['error']['message']);}else{logger[_0xa2cb('0xa')](_0xa2cb('0xb'),_0x13dd00,_0xa2cb('0xc'));_0x1ed45b(_0x3b7c02[_0xa2cb('0x10')]['message']);}})['catch'](function(_0x141907){logger[_0xa2cb('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x13dd00,_0x141907);_0x394a34(_0x141907);});});} \ No newline at end of file +var _0x356f=['../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x356f,0x1f4));var _0xf356=function(_0x19985a,_0x249fb7){_0x19985a=_0x19985a-0x0;var _0x236e5a=_0x356f[_0x19985a];return _0x236e5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf356('0x0'));var BPromise=require(_0xf356('0x1'));var rs=require(_0xf356('0x2'));var fs=require('fs');var Redis=require(_0xf356('0x3'));var db=require(_0xf356('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf356('0x5'));var config=require(_0xf356('0x6'));var jayson=require(_0xf356('0x7'));var client=jayson[_0xf356('0x8')][_0xf356('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ff1f7,_0x10a00c,_0xe0d280){return new BPromise(function(_0x295b15,_0x11bb19){return client[_0xf356('0xa')](_0x1ff1f7,_0xe0d280)[_0xf356('0xb')](function(_0x4ef0d0){logger['info'](_0xf356('0xc'),_0x10a00c,_0xf356('0xd'));logger[_0xf356('0xe')](_0xf356('0xf'),_0x10a00c,'request\x20sent',JSON[_0xf356('0x10')](_0x4ef0d0));if(_0x4ef0d0[_0xf356('0x11')]){if(_0x4ef0d0[_0xf356('0x11')]['code']===0x1f4){logger[_0xf356('0x11')](_0xf356('0xc'),_0x10a00c,_0x4ef0d0['error']['message']);return _0x11bb19(_0x4ef0d0[_0xf356('0x11')][_0xf356('0x12')]);}logger[_0xf356('0x11')](_0xf356('0xc'),_0x10a00c,_0x4ef0d0[_0xf356('0x11')]['message']);return _0x295b15(_0x4ef0d0[_0xf356('0x11')][_0xf356('0x12')]);}else{logger[_0xf356('0x13')](_0xf356('0xc'),_0x10a00c,'request\x20sent');_0x295b15(_0x4ef0d0[_0xf356('0x14')][_0xf356('0x12')]);}})[_0xf356('0x15')](function(_0x59ae16){logger[_0xf356('0x11')](_0xf356('0xc'),_0x10a00c,_0x59ae16);_0x11bb19(_0x59ae16);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5867042..5d8c327 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 _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x3a4208,_0x5d44bf){var _0x54d425=function(_0x1bea83){while(--_0x1bea83){_0x3a4208['push'](_0x3a4208['shift']());}};_0x54d425(++_0x5d44bf);}(_0x814b,0x1a2));var _0xb814=function(_0x21b762,_0xc8ef11){_0x21b762=_0x21b762-0x0;var _0x2ea6d4=_0x814b[_0x21b762];return _0x2ea6d4;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xe')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['destroy']);module[_0xb814('0x13')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x24271a,_0x397670){var _0x4a5ffb=function(_0x3c8f02){while(--_0x3c8f02){_0x24271a['push'](_0x24271a['shift']());}};_0x4a5ffb(++_0x397670);}(_0x814b,0x1a2));var _0xb814=function(_0x5106c1,_0x13233a){_0x5106c1=_0x5106c1-0x0;var _0x5bcaac=_0x814b[_0x5106c1];return _0x5bcaac;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xe')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['destroy']);module[_0xb814('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 1fed21a..d0b69a7 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 _0x0f9f=['keyValue','picklist','STRING','variable','exports','ENUM','string','customVariable'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x1f43f4,_0x16d500){_0x1f43f4=_0x1f43f4-0x0;var _0x5435b7=_0x0f9f[_0x1f43f4];return _0x5435b7;};'use strict';var Sequelize=require('sequelize');module[_0xf0f9('0x0')]={'type':{'type':Sequelize[_0xf0f9('0x1')](_0xf0f9('0x2'),'variable',_0xf0f9('0x3'),_0xf0f9('0x4'),_0xf0f9('0x5')),'defaultValue':_0xf0f9('0x2')},'content':{'type':Sequelize[_0xf0f9('0x6')]},'key':{'type':Sequelize[_0xf0f9('0x6')]},'keyType':{'type':Sequelize[_0xf0f9('0x1')](_0xf0f9('0x2'),_0xf0f9('0x7'),_0xf0f9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf0f9('0x6')]},'nameField':{'type':Sequelize[_0xf0f9('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf0f9('0x6')]}}; \ No newline at end of file +var _0x4c4e=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x4a16fc,_0x35a32d){var _0x290f19=function(_0x3a6fe5){while(--_0x3a6fe5){_0x4a16fc['push'](_0x4a16fc['shift']());}};_0x290f19(++_0x35a32d);}(_0x4c4e,0x152));var _0xe4c4=function(_0x5b57f0,_0x29cbb8){_0x5b57f0=_0x5b57f0-0x0;var _0x58dbb6=_0x4c4e[_0x5b57f0];return _0x58dbb6;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'type':{'type':Sequelize[_0xe4c4('0x1')](_0xe4c4('0x2'),_0xe4c4('0x3'),'customVariable',_0xe4c4('0x4'),_0xe4c4('0x5')),'defaultValue':_0xe4c4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe4c4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xe4c4('0x2'),_0xe4c4('0x3'),_0xe4c4('0x7'))},'keyContent':{'type':Sequelize[_0xe4c4('0x6')]},'idField':{'type':Sequelize[_0xe4c4('0x6')]},'nameField':{'type':Sequelize[_0xe4c4('0x6')]},'customField':{'type':Sequelize[_0xe4c4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index a9e3f03..9744ce1 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 _0x807b=['update','then','error','name','send','index','VtigerField','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject'];(function(_0x131043,_0x4ca7ea){var _0x33825a=function(_0x1cc895){while(--_0x1cc895){_0x131043['push'](_0x131043['shift']());}};_0x33825a(++_0x4ca7ea);}(_0x807b,0x13f));var _0xb807=function(_0x2feecd,_0x6d0beb){_0x2feecd=_0x2feecd-0x0;var _0x2be185=_0x807b[_0x2feecd];return _0x2be185;};'use strict';var pdf=require(_0xb807('0x0'));var emlformat=require(_0xb807('0x1'));var rimraf=require(_0xb807('0x2'));var zipdir=require(_0xb807('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb807('0x4'));var moment=require('moment');var BPromise=require(_0xb807('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb807('0x6'));var sox=require(_0xb807('0x7'));var csv=require(_0xb807('0x8'));var ejs=require(_0xb807('0x9'));var fs=require('fs');var fs_extra=require(_0xb807('0xa'));var _=require('lodash');var squel=require(_0xb807('0xb'));var crypto=require(_0xb807('0xc'));var jsforce=require(_0xb807('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb807('0x8'));var querystring=require(_0xb807('0xe'));var Papa=require(_0xb807('0xf'));var Redis=require(_0xb807('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb807('0x11'));var logger=require(_0xb807('0x12'))(_0xb807('0x13'));var utils=require(_0xb807('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb807('0x15'));var db=require(_0xb807('0x16'))['db'];function respondWithStatusCode(_0x2ad4b3,_0x44f419){_0x44f419=_0x44f419||0xcc;return function(_0x5383f8){if(_0x5383f8){return _0x2ad4b3[_0xb807('0x17')](_0x44f419);}return _0x2ad4b3[_0xb807('0x18')](_0x44f419)[_0xb807('0x19')]();};}function respondWithResult(_0x4d9d4a,_0x27fccf){_0x27fccf=_0x27fccf||0xc8;return function(_0x8777b9){if(_0x8777b9){return _0x4d9d4a[_0xb807('0x18')](_0x27fccf)[_0xb807('0x1a')](_0x8777b9);}};}function respondWithFilteredResult(_0x53dd3e,_0x163ca2){return function(_0x396145){if(_0x396145){var _0x2685ef=_0x396145[_0xb807('0x1b')],_0x535ddb=_0x163ca2[_0xb807('0x1c')],_0x4cd86b=_0x163ca2[_0xb807('0x1c')]+_0x163ca2['limit'],_0x205019;if(_0x4cd86b>=_0x2685ef){_0x4cd86b=_0x2685ef;_0x205019=0xc8;}else{_0x205019=0xce;}_0x53dd3e['status'](_0x205019);return _0x53dd3e[_0xb807('0x1d')]('Content-Range',_0x535ddb+'-'+_0x4cd86b+'/'+_0x2685ef)['json'](_0x396145);}return null;};}function patchUpdates(_0x5f3859){return function(_0x5892a1){try{jsonpatch['apply'](_0x5892a1,_0x5f3859,!![]);}catch(_0xccde1a){return BPromise[_0xb807('0x1e')](_0xccde1a);}return _0x5892a1['save']();};}function saveUpdates(_0x2ded81,_0x1b276f){return function(_0xd230a){if(_0xd230a){return _0xd230a[_0xb807('0x1f')](_0x2ded81)['then'](function(_0x1eee23){return _0x1eee23;});}return null;};}function removeEntity(_0x278c33,_0x141441){return function(_0x50ea5a){if(_0x50ea5a){return _0x50ea5a['destroy']()[_0xb807('0x20')](function(){_0x278c33['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48bced,_0x2bd523){return function(_0x209944){if(!_0x209944){_0x48bced['sendStatus'](0x194);}return _0x209944;};}function handleError(_0x45305c,_0x28fbd8){_0x28fbd8=_0x28fbd8||0x1f4;return function(_0x37091c){logger[_0xb807('0x21')](_0x37091c['stack']);if(_0x37091c[_0xb807('0x22')]){delete _0x37091c[_0xb807('0x22')];}_0x45305c[_0xb807('0x18')](_0x28fbd8)[_0xb807('0x23')](_0x37091c);};}exports[_0xb807('0x24')]=function(_0x142897,_0x274674){var _0x52226d={},_0x3e4650={},_0x37892d={'count':0x0,'rows':[]};var _0x2b8c90=_['map'](db[_0xb807('0x25')]['rawAttributes'],function(_0x4053f6){return{'name':_0x4053f6[_0xb807('0x26')],'type':_0x4053f6['type'][_0xb807('0x27')]};});_0x3e4650[_0xb807('0x28')]=_['map'](_0x2b8c90,_0xb807('0x22'));_0x3e4650['query']=_['keys'](_0x142897[_0xb807('0x29')]);_0x3e4650[_0xb807('0x2a')]=_['intersection'](_0x3e4650['model'],_0x3e4650[_0xb807('0x29')]);_0x52226d[_0xb807('0x2b')]=_[_0xb807('0x2c')](_0x3e4650['model'],qs[_0xb807('0x2d')](_0x142897[_0xb807('0x29')][_0xb807('0x2d')]));_0x52226d[_0xb807('0x2b')]=_0x52226d[_0xb807('0x2b')][_0xb807('0x2e')]?_0x52226d['attributes']:_0x3e4650[_0xb807('0x28')];if(!_0x142897[_0xb807('0x29')]['hasOwnProperty'](_0xb807('0x2f'))){_0x52226d[_0xb807('0x30')]=qs['limit'](_0x142897['query']['limit']);_0x52226d['offset']=qs[_0xb807('0x1c')](_0x142897[_0xb807('0x29')][_0xb807('0x1c')]);}_0x52226d[_0xb807('0x31')]=qs[_0xb807('0x32')](_0x142897[_0xb807('0x29')][_0xb807('0x32')]);_0x52226d[_0xb807('0x33')]=qs[_0xb807('0x2a')](_['pick'](_0x142897[_0xb807('0x29')],_0x3e4650[_0xb807('0x2a')]),_0x2b8c90);if(_0x142897['query'][_0xb807('0x34')]){_0x52226d[_0xb807('0x33')]=_[_0xb807('0x35')](_0x52226d[_0xb807('0x33')],{'$or':_[_0xb807('0x36')](_0x2b8c90,function(_0x287ce7){if(_0x287ce7[_0xb807('0x37')]!==_0xb807('0x38')){var _0x1ffa9a={};_0x1ffa9a[_0x287ce7[_0xb807('0x22')]]={'$like':'%'+_0x142897['query'][_0xb807('0x34')]+'%'};return _0x1ffa9a;}})});}_0x52226d=_[_0xb807('0x35')]({},_0x52226d,_0x142897[_0xb807('0x39')]);var _0x1476fb={'where':_0x52226d[_0xb807('0x33')]};return db[_0xb807('0x25')][_0xb807('0x1b')](_0x1476fb)[_0xb807('0x20')](function(_0xa7fb50){_0x37892d[_0xb807('0x1b')]=_0xa7fb50;if(_0x142897['query'][_0xb807('0x3a')]){_0x52226d[_0xb807('0x3b')]=[{'all':!![]}];}return db[_0xb807('0x25')][_0xb807('0x3c')](_0x52226d);})[_0xb807('0x20')](function(_0x196e2f){_0x37892d[_0xb807('0x3d')]=_0x196e2f;return _0x37892d;})[_0xb807('0x20')](respondWithFilteredResult(_0x274674,_0x52226d))[_0xb807('0x3e')](handleError(_0x274674,null));};exports[_0xb807('0x3f')]=function(_0x1840d8,_0xb752ed){var _0x4742c5={'raw':!![],'where':{'id':_0x1840d8['params']['id']}},_0x3bfbae={};_0x3bfbae[_0xb807('0x28')]=_[_0xb807('0x40')](db[_0xb807('0x25')][_0xb807('0x41')]);_0x3bfbae['query']=_['keys'](_0x1840d8['query']);_0x3bfbae['filters']=_[_0xb807('0x2c')](_0x3bfbae[_0xb807('0x28')],_0x3bfbae['query']);_0x4742c5['attributes']=_[_0xb807('0x2c')](_0x3bfbae[_0xb807('0x28')],qs[_0xb807('0x2d')](_0x1840d8[_0xb807('0x29')][_0xb807('0x2d')]));_0x4742c5[_0xb807('0x2b')]=_0x4742c5[_0xb807('0x2b')]['length']?_0x4742c5['attributes']:_0x3bfbae[_0xb807('0x28')];if(_0x1840d8['query']['includeAll']){_0x4742c5['include']=[{'all':!![]}];}_0x4742c5=_['merge']({},_0x4742c5,_0x1840d8[_0xb807('0x39')]);return db[_0xb807('0x25')][_0xb807('0x42')](_0x4742c5)[_0xb807('0x20')](handleEntityNotFound(_0xb752ed,null))['then'](respondWithResult(_0xb752ed,null))['catch'](handleError(_0xb752ed,null));};exports['create']=function(_0x1d645b,_0x3322ee){return db['VtigerField'][_0xb807('0x43')](_0x1d645b[_0xb807('0x44')],{})[_0xb807('0x20')](respondWithResult(_0x3322ee,0xc9))['catch'](handleError(_0x3322ee,null));};exports[_0xb807('0x1f')]=function(_0x15b3b4,_0xc63c09){if(_0x15b3b4[_0xb807('0x44')]['id']){delete _0x15b3b4[_0xb807('0x44')]['id'];}return db[_0xb807('0x25')][_0xb807('0x42')]({'where':{'id':_0x15b3b4['params']['id']}})[_0xb807('0x20')](handleEntityNotFound(_0xc63c09,null))[_0xb807('0x20')](saveUpdates(_0x15b3b4[_0xb807('0x44')],null))[_0xb807('0x20')](respondWithResult(_0xc63c09,null))['catch'](handleError(_0xc63c09,null));};exports[_0xb807('0x45')]=function(_0x18f481,_0x6c0238){return db[_0xb807('0x25')][_0xb807('0x42')]({'where':{'id':_0x18f481['params']['id']}})[_0xb807('0x20')](handleEntityNotFound(_0x6c0238,null))['then'](removeEntity(_0x6c0238,null))[_0xb807('0x3e')](handleError(_0x6c0238,null));}; \ No newline at end of file +var _0x96dd=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','update','then','end','error','stack','name','send','VtigerField','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','include','findAll','catch','params','includeAll','create','body','find','eml-format'];(function(_0x1415d1,_0x562a8c){var _0x10fe08=function(_0x5706f8){while(--_0x5706f8){_0x1415d1['push'](_0x1415d1['shift']());}};_0x10fe08(++_0x562a8c);}(_0x96dd,0x162));var _0xd96d=function(_0x450e53,_0x554f81){_0x450e53=_0x450e53-0x0;var _0xf91855=_0x96dd[_0x450e53];return _0xf91855;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd96d('0x0'));var rimraf=require(_0xd96d('0x1'));var zipdir=require(_0xd96d('0x2'));var jsonpatch=require(_0xd96d('0x3'));var rp=require(_0xd96d('0x4'));var moment=require(_0xd96d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd96d('0x6'));var util=require('util');var path=require(_0xd96d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd96d('0x8'));var fs=require('fs');var fs_extra=require(_0xd96d('0x9'));var _=require(_0xd96d('0xa'));var squel=require(_0xd96d('0xb'));var crypto=require(_0xd96d('0xc'));var jsforce=require(_0xd96d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd96d('0xe'));var querystring=require('querystring');var Papa=require(_0xd96d('0xf'));var Redis=require(_0xd96d('0x10'));var authService=require(_0xd96d('0x11'));var qs=require(_0xd96d('0x12'));var as=require(_0xd96d('0x13'));var hardwareService=require(_0xd96d('0x14'));var logger=require(_0xd96d('0x15'))(_0xd96d('0x16'));var utils=require(_0xd96d('0x17'));var config=require(_0xd96d('0x18'));var licenseUtil=require(_0xd96d('0x19'));var db=require(_0xd96d('0x1a'))['db'];function respondWithStatusCode(_0x3e68e9,_0x46de32){_0x46de32=_0x46de32||0xcc;return function(_0x5064ad){if(_0x5064ad){return _0x3e68e9[_0xd96d('0x1b')](_0x46de32);}return _0x3e68e9[_0xd96d('0x1c')](_0x46de32)['end']();};}function respondWithResult(_0x50bbc1,_0x5cd451){_0x5cd451=_0x5cd451||0xc8;return function(_0x2ad5cd){if(_0x2ad5cd){return _0x50bbc1[_0xd96d('0x1c')](_0x5cd451)[_0xd96d('0x1d')](_0x2ad5cd);}};}function respondWithFilteredResult(_0x3e93d4,_0x58ee36){return function(_0x8e7201){if(_0x8e7201){var _0x1674c0=_0x8e7201[_0xd96d('0x1e')],_0x21fd7a=_0x58ee36[_0xd96d('0x1f')],_0xb9cb3a=_0x58ee36[_0xd96d('0x1f')]+_0x58ee36[_0xd96d('0x20')],_0x58cefc;if(_0xb9cb3a>=_0x1674c0){_0xb9cb3a=_0x1674c0;_0x58cefc=0xc8;}else{_0x58cefc=0xce;}_0x3e93d4['status'](_0x58cefc);return _0x3e93d4[_0xd96d('0x21')]('Content-Range',_0x21fd7a+'-'+_0xb9cb3a+'/'+_0x1674c0)[_0xd96d('0x1d')](_0x8e7201);}return null;};}function patchUpdates(_0xea4257){return function(_0xe13aa2){try{jsonpatch['apply'](_0xe13aa2,_0xea4257,!![]);}catch(_0x3c4be1){return BPromise[_0xd96d('0x22')](_0x3c4be1);}return _0xe13aa2['save']();};}function saveUpdates(_0x44a0e4,_0x572be3){return function(_0x4beea4){if(_0x4beea4){return _0x4beea4[_0xd96d('0x23')](_0x44a0e4)['then'](function(_0x7b38d4){return _0x7b38d4;});}return null;};}function removeEntity(_0x621a49,_0x35b52e){return function(_0x50eace){if(_0x50eace){return _0x50eace['destroy']()[_0xd96d('0x24')](function(){_0x621a49[_0xd96d('0x1c')](0xcc)[_0xd96d('0x25')]();});}};}function handleEntityNotFound(_0x46d602,_0x2c5fed){return function(_0x3819f6){if(!_0x3819f6){_0x46d602[_0xd96d('0x1b')](0x194);}return _0x3819f6;};}function handleError(_0x39d2e0,_0x5f4762){_0x5f4762=_0x5f4762||0x1f4;return function(_0x3f9031){logger[_0xd96d('0x26')](_0x3f9031[_0xd96d('0x27')]);if(_0x3f9031[_0xd96d('0x28')]){delete _0x3f9031['name'];}_0x39d2e0['status'](_0x5f4762)[_0xd96d('0x29')](_0x3f9031);};}exports['index']=function(_0x213222,_0x433ba5){var _0x35ae5f={},_0x3ef804={},_0x349a94={'count':0x0,'rows':[]};var _0x3d948e=_['map'](db[_0xd96d('0x2a')][_0xd96d('0x2b')],function(_0xee9ff1){return{'name':_0xee9ff1[_0xd96d('0x2c')],'type':_0xee9ff1['type'][_0xd96d('0x2d')]};});_0x3ef804[_0xd96d('0x2e')]=_[_0xd96d('0x2f')](_0x3d948e,_0xd96d('0x28'));_0x3ef804['query']=_[_0xd96d('0x30')](_0x213222['query']);_0x3ef804[_0xd96d('0x31')]=_[_0xd96d('0x32')](_0x3ef804[_0xd96d('0x2e')],_0x3ef804[_0xd96d('0x33')]);_0x35ae5f[_0xd96d('0x34')]=_[_0xd96d('0x32')](_0x3ef804[_0xd96d('0x2e')],qs[_0xd96d('0x35')](_0x213222[_0xd96d('0x33')][_0xd96d('0x35')]));_0x35ae5f[_0xd96d('0x34')]=_0x35ae5f[_0xd96d('0x34')][_0xd96d('0x36')]?_0x35ae5f[_0xd96d('0x34')]:_0x3ef804['model'];if(!_0x213222[_0xd96d('0x33')][_0xd96d('0x37')](_0xd96d('0x38'))){_0x35ae5f[_0xd96d('0x20')]=qs[_0xd96d('0x20')](_0x213222[_0xd96d('0x33')][_0xd96d('0x20')]);_0x35ae5f[_0xd96d('0x1f')]=qs['offset'](_0x213222[_0xd96d('0x33')][_0xd96d('0x1f')]);}_0x35ae5f[_0xd96d('0x39')]=qs[_0xd96d('0x3a')](_0x213222['query'][_0xd96d('0x3a')]);_0x35ae5f['where']=qs[_0xd96d('0x31')](_[_0xd96d('0x3b')](_0x213222[_0xd96d('0x33')],_0x3ef804['filters']),_0x3d948e);if(_0x213222[_0xd96d('0x33')][_0xd96d('0x3c')]){_0x35ae5f['where']=_[_0xd96d('0x3d')](_0x35ae5f['where'],{'$or':_['map'](_0x3d948e,function(_0x100f79){if(_0x100f79[_0xd96d('0x3e')]!=='VIRTUAL'){var _0x42ba1e={};_0x42ba1e[_0x100f79[_0xd96d('0x28')]]={'$like':'%'+_0x213222[_0xd96d('0x33')][_0xd96d('0x3c')]+'%'};return _0x42ba1e;}})});}_0x35ae5f=_['merge']({},_0x35ae5f,_0x213222['options']);var _0xbead75={'where':_0x35ae5f['where']};return db[_0xd96d('0x2a')][_0xd96d('0x1e')](_0xbead75)['then'](function(_0x4626a1){_0x349a94[_0xd96d('0x1e')]=_0x4626a1;if(_0x213222['query']['includeAll']){_0x35ae5f[_0xd96d('0x3f')]=[{'all':!![]}];}return db[_0xd96d('0x2a')][_0xd96d('0x40')](_0x35ae5f);})[_0xd96d('0x24')](function(_0x608755){_0x349a94['rows']=_0x608755;return _0x349a94;})['then'](respondWithFilteredResult(_0x433ba5,_0x35ae5f))[_0xd96d('0x41')](handleError(_0x433ba5,null));};exports['show']=function(_0x2e0029,_0x146213){var _0x3f38cf={'raw':!![],'where':{'id':_0x2e0029[_0xd96d('0x42')]['id']}},_0x5b74b3={};_0x5b74b3['model']=_[_0xd96d('0x30')](db['VtigerField'][_0xd96d('0x2b')]);_0x5b74b3[_0xd96d('0x33')]=_['keys'](_0x2e0029[_0xd96d('0x33')]);_0x5b74b3[_0xd96d('0x31')]=_['intersection'](_0x5b74b3['model'],_0x5b74b3[_0xd96d('0x33')]);_0x3f38cf[_0xd96d('0x34')]=_[_0xd96d('0x32')](_0x5b74b3[_0xd96d('0x2e')],qs[_0xd96d('0x35')](_0x2e0029['query'][_0xd96d('0x35')]));_0x3f38cf[_0xd96d('0x34')]=_0x3f38cf[_0xd96d('0x34')][_0xd96d('0x36')]?_0x3f38cf[_0xd96d('0x34')]:_0x5b74b3[_0xd96d('0x2e')];if(_0x2e0029['query'][_0xd96d('0x43')]){_0x3f38cf['include']=[{'all':!![]}];}_0x3f38cf=_[_0xd96d('0x3d')]({},_0x3f38cf,_0x2e0029['options']);return db[_0xd96d('0x2a')]['find'](_0x3f38cf)[_0xd96d('0x24')](handleEntityNotFound(_0x146213,null))[_0xd96d('0x24')](respondWithResult(_0x146213,null))['catch'](handleError(_0x146213,null));};exports[_0xd96d('0x44')]=function(_0x264624,_0x1be095){return db[_0xd96d('0x2a')][_0xd96d('0x44')](_0x264624['body'],{})['then'](respondWithResult(_0x1be095,0xc9))[_0xd96d('0x41')](handleError(_0x1be095,null));};exports['update']=function(_0x1fd704,_0x465230){if(_0x1fd704[_0xd96d('0x45')]['id']){delete _0x1fd704[_0xd96d('0x45')]['id'];}return db[_0xd96d('0x2a')][_0xd96d('0x46')]({'where':{'id':_0x1fd704[_0xd96d('0x42')]['id']}})['then'](handleEntityNotFound(_0x465230,null))[_0xd96d('0x24')](saveUpdates(_0x1fd704[_0xd96d('0x45')],null))['then'](respondWithResult(_0x465230,null))[_0xd96d('0x41')](handleError(_0x465230,null));};exports['destroy']=function(_0x3e7103,_0x19ac9e){return db[_0xd96d('0x2a')][_0xd96d('0x46')]({'where':{'id':_0x3e7103['params']['id']}})[_0xd96d('0x24')](handleEntityNotFound(_0x19ac9e,null))[_0xd96d('0x24')](removeEntity(_0x19ac9e,null))[_0xd96d('0x41')](handleError(_0x19ac9e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 8b1cf5d..3d4f49a 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xeffed2,_0x6eb854){var _0x14a313=function(_0x1995ce){while(--_0x1995ce){_0xeffed2['push'](_0xeffed2['shift']());}};_0x14a313(++_0x6eb854);}(_0x7a54,0x106));var _0x47a5=function(_0x3eeec8,_0x220fc8){_0x3eeec8=_0x3eeec8-0x0;var _0x11c19e=_0x7a54[_0x3eeec8];return _0x11c19e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 1a32335..c678d77 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 _0x4227=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x494ab5,_0x4b86dd){var _0x23a592=function(_0x1e0e33){while(--_0x1e0e33){_0x494ab5['push'](_0x494ab5['shift']());}};_0x23a592(++_0x4b86dd);}(_0x4227,0x89));var _0x7422=function(_0x30e5ed,_0x4ef4a3){_0x30e5ed=_0x30e5ed-0x0;var _0x233308=_0x4227[_0x30e5ed];return _0x233308;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7422('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7422('0x2'));var db=require(_0x7422('0x3'))['db'];var utils=require(_0x7422('0x4'));var logger=require('../../config/logger')(_0x7422('0x5'));var config=require(_0x7422('0x6'));var jayson=require(_0x7422('0x7'));var client=jayson[_0x7422('0x8')][_0x7422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3432,_0xe99299,_0x45ca1a){return new BPromise(function(_0x12965e,_0x599d78){return client[_0x7422('0xa')](_0x2b3432,_0x45ca1a)[_0x7422('0xb')](function(_0x25de34){logger['info'](_0x7422('0xc'),_0xe99299,'request\x20sent');logger[_0x7422('0xd')](_0x7422('0xe'),_0xe99299,_0x7422('0xf'),JSON[_0x7422('0x10')](_0x25de34));if(_0x25de34[_0x7422('0x11')]){if(_0x25de34['error'][_0x7422('0x12')]===0x1f4){logger[_0x7422('0x11')]('VtigerField,\x20%s,\x20%s',_0xe99299,_0x25de34[_0x7422('0x11')][_0x7422('0x13')]);return _0x599d78(_0x25de34['error'][_0x7422('0x13')]);}logger[_0x7422('0x11')]('VtigerField,\x20%s,\x20%s',_0xe99299,_0x25de34['error'][_0x7422('0x13')]);return _0x12965e(_0x25de34['error'][_0x7422('0x13')]);}else{logger[_0x7422('0x14')]('VtigerField,\x20%s,\x20%s',_0xe99299,_0x7422('0xf'));_0x12965e(_0x25de34[_0x7422('0x15')][_0x7422('0x13')]);}})[_0x7422('0x16')](function(_0x2946ca){logger[_0x7422('0x11')]('VtigerField,\x20%s,\x20%s',_0xe99299,_0x2946ca);_0x599d78(_0x2946ca);});});} \ No newline at end of file +var _0x594d=['VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VtigerField,\x20%s,\x20%s','debug'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x594d,0x92));var _0xd594=function(_0x460ef0,_0x1489f0){_0x460ef0=_0x460ef0-0x0;var _0x966564=_0x594d[_0x460ef0];return _0x966564;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd594('0x1'));var rs=require(_0xd594('0x2'));var fs=require('fs');var Redis=require(_0xd594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd594('0x4'));var logger=require(_0xd594('0x5'))(_0xd594('0x6'));var config=require(_0xd594('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1c64,_0x446711,_0xeedad0){return new BPromise(function(_0x20325a,_0x20718a){return client[_0xd594('0x9')](_0x3b1c64,_0xeedad0)[_0xd594('0xa')](function(_0xf3043e){logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');logger[_0xd594('0xd')](_0xd594('0xe'),_0x446711,_0xd594('0xf'),JSON['stringify'](_0xf3043e));if(_0xf3043e[_0xd594('0x10')]){if(_0xf3043e[_0xd594('0x10')][_0xd594('0x11')]===0x1f4){logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e[_0xd594('0x10')][_0xd594('0x12')]);return _0x20718a(_0xf3043e['error']['message']);}logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e['error'][_0xd594('0x12')]);return _0x20325a(_0xf3043e['error'][_0xd594('0x12')]);}else{logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');_0x20325a(_0xf3043e[_0xd594('0x13')]['message']);}})['catch'](function(_0x2a5f17){logger[_0xd594('0x10')]('VtigerField,\x20%s,\x20%s',_0x446711,_0x2a5f17);_0x20718a(_0x2a5f17);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2f5f351..d0b3892 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 _0x06f4=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x4c96e4,_0x2fe2ea){var _0x2dd5d2=function(_0x3f040d){while(--_0x3f040d){_0x4c96e4['push'](_0x4c96e4['shift']());}};_0x2dd5d2(++_0x2fe2ea);}(_0x06f4,0x136));var _0x406f=function(_0x1d3d6b,_0x50cb4d){_0x1d3d6b=_0x1d3d6b-0x0;var _0xf2dcfb=_0x06f4[_0x1d3d6b];return _0xf2dcfb;};'use strict';var multer=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var path=require('path');var timeout=require(_0x406f('0x2'));var express=require(_0x406f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x406f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x406f('0x5'));var controller=require(_0x406f('0x6'));router[_0x406f('0x7')]('/',auth[_0x406f('0x8')](),controller['index']);router[_0x406f('0x7')]('/:id',auth[_0x406f('0x8')](),controller[_0x406f('0x9')]);router[_0x406f('0x7')]('/:id/configurations',auth[_0x406f('0x8')](),controller['getConfigurations']);router['get'](_0x406f('0xa'),auth['isAuthenticated'](),controller[_0x406f('0xb')]);router['post']('/',auth[_0x406f('0x8')](),controller['create']);router[_0x406f('0xc')](_0x406f('0xd'),auth['isAuthenticated'](),controller[_0x406f('0xe')]);router[_0x406f('0xf')](_0x406f('0x10'),auth[_0x406f('0x8')](),controller[_0x406f('0x11')]);router[_0x406f('0x12')](_0x406f('0x10'),auth[_0x406f('0x8')](),controller[_0x406f('0x13')]);module[_0x406f('0x14')]=router; \ No newline at end of file +var _0x022a=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xb19178,_0x396eb2){var _0x39fbe2=function(_0x26fe50){while(--_0x26fe50){_0xb19178['push'](_0xb19178['shift']());}};_0x39fbe2(++_0x396eb2);}(_0x022a,0x1f0));var _0xa022=function(_0x5b93f8,_0xffefcd){_0x5b93f8=_0x5b93f8-0x0;var _0x1430ec=_0x022a[_0x5b93f8];return _0x1430ec;};'use strict';var multer=require(_0xa022('0x0'));var util=require(_0xa022('0x1'));var path=require(_0xa022('0x2'));var timeout=require(_0xa022('0x3'));var express=require(_0xa022('0x4'));var router=express[_0xa022('0x5')]();var fs_extra=require(_0xa022('0x6'));var auth=require(_0xa022('0x7'));var interaction=require(_0xa022('0x8'));var config=require(_0xa022('0x9'));var controller=require(_0xa022('0xa'));router[_0xa022('0xb')]('/',auth['isAuthenticated'](),controller[_0xa022('0xc')]);router['get']('/:id',auth[_0xa022('0xd')](),controller[_0xa022('0xe')]);router[_0xa022('0xb')](_0xa022('0xf'),auth[_0xa022('0xd')](),controller[_0xa022('0x10')]);router[_0xa022('0xb')]('/:id/fields',auth[_0xa022('0xd')](),controller[_0xa022('0x11')]);router[_0xa022('0x12')]('/',auth['isAuthenticated'](),controller[_0xa022('0x13')]);router['post'](_0xa022('0xf'),auth[_0xa022('0xd')](),controller['addConfiguration']);router['put'](_0xa022('0x14'),auth[_0xa022('0xd')](),controller[_0xa022('0x15')]);router[_0xa022('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xa022('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 07416fd..98dfe03 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 _0x7ba3=['newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab'];(function(_0x4cf14f,_0x41049d){var _0x212715=function(_0x4e7044){while(--_0x4e7044){_0x4cf14f['push'](_0x4cf14f['shift']());}};_0x212715(++_0x41049d);}(_0x7ba3,0x191));var _0x37ba=function(_0x44f4c5,_0x60cd8b){_0x44f4c5=_0x44f4c5-0x0;var _0x35cf6a=_0x7ba3[_0x44f4c5];return _0x35cf6a;};'use strict';var Sequelize=require(_0x37ba('0x0'));module[_0x37ba('0x1')]={'name':{'type':Sequelize[_0x37ba('0x2')]},'description':{'type':Sequelize[_0x37ba('0x2')]},'username':{'type':Sequelize[_0x37ba('0x2')],'unique':_0x37ba('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x37ba('0x2')]},'remoteUri':{'type':Sequelize[_0x37ba('0x2')],'unique':_0x37ba('0x4')},'authType':{'type':Sequelize[_0x37ba('0x5')](_0x37ba('0x6'),_0x37ba('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x37ba('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x37ba('0x5')](_0x37ba('0x8'),_0x37ba('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x8ad5=['token','integrationTab','newTab','exports','STRING','ENUM'];(function(_0x2c9509,_0x159071){var _0x7125e7=function(_0x3d101f){while(--_0x3d101f){_0x2c9509['push'](_0x2c9509['shift']());}};_0x7125e7(++_0x159071);}(_0x8ad5,0x87));var _0x58ad=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x8ad5[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require('sequelize');module[_0x58ad('0x0')]={'name':{'type':Sequelize[_0x58ad('0x1')]},'description':{'type':Sequelize[_0x58ad('0x1')]},'username':{'type':Sequelize[_0x58ad('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x58ad('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x58ad('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x58ad('0x2')]('password',_0x58ad('0x3')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x58ad('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x58ad('0x4'),_0x58ad('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6991af0..f876558 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 _0xa9e0=['body','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','ZendeskAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create'];(function(_0x5e1154,_0x1d418d){var _0x447f8f=function(_0x123a15){while(--_0x123a15){_0x5e1154['push'](_0x5e1154['shift']());}};_0x447f8f(++_0x1d418d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];var integrations=require(_0x0a9e('0x16'));var jayson=require(_0x0a9e('0x17'));var client=jayson[_0x0a9e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4283ce,_0x239b12,_0x2b4227,_0x281129){return new BPromise(function(_0x44dcfd,_0x4d5611){var _0x52a03d=_0x281129||client;return _0x52a03d[_0x0a9e('0x19')](_0x4283ce,_0x2b4227)['then'](function(_0x1985b6){logger['info'](_0x0a9e('0x1a'),_0x239b12,_0x0a9e('0x1b'));logger['debug'](_0x0a9e('0x1c'),_0x239b12,'request\x20sent',JSON[_0x0a9e('0x1d')](_0x1985b6));if(_0x1985b6[_0x0a9e('0x1e')]){if(_0x1985b6[_0x0a9e('0x1e')][_0x0a9e('0x1f')]===0x1f4){logger[_0x0a9e('0x1e')](_0x0a9e('0x1a'),_0x239b12,_0x1985b6[_0x0a9e('0x1e')][_0x0a9e('0x20')]);return _0x4d5611(_0x1985b6[_0x0a9e('0x1e')][_0x0a9e('0x20')]);}logger[_0x0a9e('0x1e')](_0x0a9e('0x1a'),_0x239b12,_0x1985b6['error'][_0x0a9e('0x20')]);return _0x44dcfd(_0x1985b6[_0x0a9e('0x1e')]['message']);}else{logger[_0x0a9e('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x239b12,'request\x20sent');_0x44dcfd(_0x1985b6[_0x0a9e('0x22')][_0x0a9e('0x20')]);}})[_0x0a9e('0x23')](function(_0x30bae6){logger['error'](_0x0a9e('0x1a'),_0x239b12,_0x30bae6);_0x4d5611(_0x30bae6);});});}function respondWithStatusCode(_0x2fb0e4,_0x3b45bc){_0x3b45bc=_0x3b45bc||0xcc;return function(_0x4d00e6){if(_0x4d00e6){return _0x2fb0e4[_0x0a9e('0x24')](_0x3b45bc);}return _0x2fb0e4[_0x0a9e('0x25')](_0x3b45bc)[_0x0a9e('0x26')]();};}function respondWithResult(_0x5ea472,_0x59181e){_0x59181e=_0x59181e||0xc8;return function(_0x197ec0){if(_0x197ec0){return _0x5ea472[_0x0a9e('0x25')](_0x59181e)[_0x0a9e('0x27')](_0x197ec0);}};}function respondWithFilteredResult(_0x33161b,_0x526cf3){return function(_0x384319){if(_0x384319){var _0x479bc4=_0x384319[_0x0a9e('0x28')],_0x45a1e7=_0x526cf3[_0x0a9e('0x29')],_0x5bfb33=_0x526cf3[_0x0a9e('0x29')]+_0x526cf3[_0x0a9e('0x2a')],_0x1dc186;if(_0x5bfb33>=_0x479bc4){_0x5bfb33=_0x479bc4;_0x1dc186=0xc8;}else{_0x1dc186=0xce;}_0x33161b[_0x0a9e('0x25')](_0x1dc186);return _0x33161b[_0x0a9e('0x2b')](_0x0a9e('0x2c'),_0x45a1e7+'-'+_0x5bfb33+'/'+_0x479bc4)['json'](_0x384319);}return null;};}function patchUpdates(_0x3652a7){return function(_0x468813){try{jsonpatch[_0x0a9e('0x2d')](_0x468813,_0x3652a7,!![]);}catch(_0x2ec755){return BPromise['reject'](_0x2ec755);}return _0x468813[_0x0a9e('0x2e')]();};}function saveUpdates(_0x40e7a3,_0x1843b2){return function(_0x824a4f){if(_0x824a4f){return _0x824a4f[_0x0a9e('0x2f')](_0x40e7a3)[_0x0a9e('0x30')](function(_0x296f41){return _0x296f41;});}return null;};}function removeEntity(_0x2e8759,_0x1dbde2){return function(_0x540530){if(_0x540530){return _0x540530[_0x0a9e('0x31')]()['then'](function(){_0x2e8759[_0x0a9e('0x25')](0xcc)[_0x0a9e('0x26')]();});}};}function handleEntityNotFound(_0x1122db,_0x33bdb7){return function(_0x25ce3a){if(!_0x25ce3a){_0x1122db['sendStatus'](0x194);}return _0x25ce3a;};}function handleError(_0x66c1d2,_0x46f0a5){_0x46f0a5=_0x46f0a5||0x1f4;return function(_0x40cb85){logger[_0x0a9e('0x1e')](_0x40cb85[_0x0a9e('0x32')]);if(_0x40cb85[_0x0a9e('0x33')]){delete _0x40cb85[_0x0a9e('0x33')];}_0x66c1d2[_0x0a9e('0x25')](_0x46f0a5)['send'](_0x40cb85);};}exports[_0x0a9e('0x34')]=function(_0x5e7238,_0x2cc7a0){var _0x14b13f={},_0x2b7e7f={},_0x3f3d41={'count':0x0,'rows':[]};var _0x567193=_[_0x0a9e('0x35')](db[_0x0a9e('0x36')][_0x0a9e('0x37')],function(_0x15de0e){return{'name':_0x15de0e['fieldName'],'type':_0x15de0e['type'][_0x0a9e('0x38')]};});_0x2b7e7f['model']=_[_0x0a9e('0x35')](_0x567193,_0x0a9e('0x33'));_0x2b7e7f[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5e7238['query']);_0x2b7e7f[_0x0a9e('0x3b')]=_[_0x0a9e('0x3c')](_0x2b7e7f[_0x0a9e('0x3d')],_0x2b7e7f['query']);_0x14b13f[_0x0a9e('0x3e')]=_[_0x0a9e('0x3c')](_0x2b7e7f[_0x0a9e('0x3d')],qs['fields'](_0x5e7238['query'][_0x0a9e('0x3f')]));_0x14b13f[_0x0a9e('0x3e')]=_0x14b13f['attributes'][_0x0a9e('0x40')]?_0x14b13f[_0x0a9e('0x3e')]:_0x2b7e7f[_0x0a9e('0x3d')];if(!_0x5e7238[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x14b13f[_0x0a9e('0x2a')]=qs[_0x0a9e('0x2a')](_0x5e7238['query'][_0x0a9e('0x2a')]);_0x14b13f[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x5e7238['query'][_0x0a9e('0x29')]);}_0x14b13f[_0x0a9e('0x41')]=qs[_0x0a9e('0x42')](_0x5e7238[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x14b13f[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5e7238[_0x0a9e('0x39')],_0x2b7e7f[_0x0a9e('0x3b')]),_0x567193);if(_0x5e7238[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x14b13f[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x14b13f[_0x0a9e('0x43')],{'$or':_['map'](_0x567193,function(_0x52628e){if(_0x52628e[_0x0a9e('0x47')]!==_0x0a9e('0x48')){var _0x405c8f={};_0x405c8f[_0x52628e[_0x0a9e('0x33')]]={'$like':'%'+_0x5e7238[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x405c8f;}})});}_0x14b13f=_[_0x0a9e('0x46')]({},_0x14b13f,_0x5e7238[_0x0a9e('0x49')]);var _0x432fcc={'where':_0x14b13f[_0x0a9e('0x43')]};return db[_0x0a9e('0x36')][_0x0a9e('0x28')](_0x432fcc)['then'](function(_0x117c99){_0x3f3d41[_0x0a9e('0x28')]=_0x117c99;if(_0x5e7238[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x14b13f[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x36')][_0x0a9e('0x4c')](_0x14b13f);})[_0x0a9e('0x30')](function(_0x59afe8){_0x3f3d41[_0x0a9e('0x4d')]=_0x59afe8;return _0x3f3d41;})['then'](respondWithFilteredResult(_0x2cc7a0,_0x14b13f))[_0x0a9e('0x23')](handleError(_0x2cc7a0,null));};exports[_0x0a9e('0x4e')]=function(_0x8d6dd1,_0x562fb4){var _0x14bec2={'raw':![],'where':{'id':_0x8d6dd1[_0x0a9e('0x4f')]['id']}},_0x7f6eb1={};_0x7f6eb1[_0x0a9e('0x3d')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x36')][_0x0a9e('0x37')]);_0x7f6eb1['query']=_[_0x0a9e('0x3a')](_0x8d6dd1[_0x0a9e('0x39')]);_0x7f6eb1[_0x0a9e('0x3b')]=_[_0x0a9e('0x3c')](_0x7f6eb1[_0x0a9e('0x3d')],_0x7f6eb1[_0x0a9e('0x39')]);_0x14bec2[_0x0a9e('0x3e')]=_[_0x0a9e('0x3c')](_0x7f6eb1[_0x0a9e('0x3d')],qs['fields'](_0x8d6dd1[_0x0a9e('0x39')][_0x0a9e('0x3f')]));_0x14bec2['attributes']=_0x14bec2['attributes']['length']?_0x14bec2[_0x0a9e('0x3e')]:_0x7f6eb1[_0x0a9e('0x3d')];if(_0x8d6dd1[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x14bec2[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x14bec2=_[_0x0a9e('0x46')]({},_0x14bec2,_0x8d6dd1[_0x0a9e('0x49')]);return db[_0x0a9e('0x36')]['find'](_0x14bec2)['then'](handleEntityNotFound(_0x562fb4,null))['then'](respondWithResult(_0x562fb4,null))[_0x0a9e('0x23')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x50')]=function(_0x14d602,_0x5bb3ed){return db[_0x0a9e('0x36')][_0x0a9e('0x50')](_0x14d602['body'],{})['then'](respondWithResult(_0x5bb3ed,0xc9))[_0x0a9e('0x23')](handleError(_0x5bb3ed,null));};exports['update']=function(_0x443e72,_0x4c3845){if(_0x443e72[_0x0a9e('0x51')]['id']){delete _0x443e72[_0x0a9e('0x51')]['id'];}return db[_0x0a9e('0x36')]['find']({'where':{'id':_0x443e72[_0x0a9e('0x4f')]['id']}})[_0x0a9e('0x30')](handleEntityNotFound(_0x4c3845,null))['then'](saveUpdates(_0x443e72['body'],null))[_0x0a9e('0x30')](respondWithResult(_0x4c3845,null))[_0x0a9e('0x23')](handleError(_0x4c3845,null));};exports['destroy']=function(_0x145931,_0x5ce9ac){return db[_0x0a9e('0x36')]['find']({'where':{'id':_0x145931[_0x0a9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5ce9ac,null))['then'](removeEntity(_0x5ce9ac,null))['catch'](handleError(_0x5ce9ac,null));};exports[_0x0a9e('0x52')]=function(_0x47de4c,_0x2f7092,_0x65432){var _0x3cfd00={};var _0x19b4df={};var _0x232830;var _0x272738;return db[_0x0a9e('0x36')][_0x0a9e('0x53')]({'where':{'id':_0x47de4c['params']['id']}})[_0x0a9e('0x30')](handleEntityNotFound(_0x2f7092,null))[_0x0a9e('0x30')](function(_0x2642bb){if(_0x2642bb){_0x232830=_0x2642bb;_0x19b4df[_0x0a9e('0x3d')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x54')]['rawAttributes']);_0x19b4df[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x47de4c['query']);_0x19b4df[_0x0a9e('0x3b')]=_['intersection'](_0x19b4df[_0x0a9e('0x3d')],_0x19b4df['query']);_0x3cfd00['attributes']=_['intersection'](_0x19b4df[_0x0a9e('0x3d')],qs['fields'](_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x3f')]));_0x3cfd00[_0x0a9e('0x3e')]=_0x3cfd00[_0x0a9e('0x3e')][_0x0a9e('0x40')]?_0x3cfd00[_0x0a9e('0x3e')]:_0x19b4df['model'];_0x3cfd00[_0x0a9e('0x41')]=qs['sort'](_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x3cfd00[_0x0a9e('0x43')]=qs['filters'](_[_0x0a9e('0x44')](_0x47de4c[_0x0a9e('0x39')],_0x19b4df[_0x0a9e('0x3b')]));if(_0x47de4c[_0x0a9e('0x39')]['filter']){_0x3cfd00[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x3cfd00['where'],{'$or':_[_0x0a9e('0x35')](_0x3cfd00[_0x0a9e('0x3e')],function(_0x88dcbf){var _0x409b29={};_0x409b29[_0x88dcbf]={'$like':'%'+_0x47de4c[_0x0a9e('0x39')]['filter']+'%'};return _0x409b29;})});}_0x3cfd00=_[_0x0a9e('0x46')]({},_0x3cfd00,_0x47de4c[_0x0a9e('0x49')]);return _0x232830[_0x0a9e('0x52')](_0x3cfd00);}})['then'](function(_0x3528b7){if(_0x3528b7){_0x272738=_0x3528b7['length'];if(!_0x47de4c['query'][_0x0a9e('0x55')](_0x0a9e('0x56'))){_0x3cfd00[_0x0a9e('0x2a')]=qs[_0x0a9e('0x2a')](_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x2a')]);_0x3cfd00[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x29')]);}return _0x232830[_0x0a9e('0x52')](_0x3cfd00);}})[_0x0a9e('0x30')](function(_0x2bbb86){if(_0x2bbb86){return _0x2bbb86?{'count':_0x272738,'rows':_0x2bbb86}:null;}})[_0x0a9e('0x30')](respondWithResult(_0x2f7092,null))[_0x0a9e('0x23')](handleError(_0x2f7092,null));};exports[_0x0a9e('0x57')]=function(_0x2a28c0,_0x4257c9,_0x5150a4){if(_0x2a28c0[_0x0a9e('0x51')]['id']){delete _0x2a28c0[_0x0a9e('0x51')]['id'];}return db[_0x0a9e('0x36')]['findOne']({'where':{'id':_0x2a28c0[_0x0a9e('0x4f')]['id']}})[_0x0a9e('0x30')](handleEntityNotFound(_0x4257c9,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x58')]=_0x83f0b2['id'];_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x59')]=integrations['getSubjects'](_0x2a28c0['body']['channel'],_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x47')]);_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x5a')]=integrations[_0x0a9e('0x5b')](_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x5c')],_0x2a28c0[_0x0a9e('0x51')]['type']);return db[_0x0a9e('0x54')][_0x0a9e('0x50')](_0x2a28c0[_0x0a9e('0x51')],{'include':[{'model':db['ZendeskField'],'as':_0x0a9e('0x59')},{'model':db['ZendeskField'],'as':_0x0a9e('0x5a')}]});}return null;})[_0x0a9e('0x30')](respondWithResult(_0x4257c9,null))['catch'](handleError(_0x4257c9,null));};exports[_0x0a9e('0x5d')]=function(_0x75912a,_0x2cc7a7,_0x317c0c){var _0x542ece='';return db[_0x0a9e('0x36')][_0x0a9e('0x53')]({'where':{'id':_0x75912a[_0x0a9e('0x4f')]['id']},'attributes':['id',_0x0a9e('0x5e'),'password',_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x0a9e('0x61')]})[_0x0a9e('0x30')](handleEntityNotFound(_0x2cc7a7,null))['then'](function(_0x290d43){if(_0x290d43){_0x542ece=_0x290d43[_0x0a9e('0x61')];var _0x30a4c7=_0x542ece[_0x0a9e('0x62')](-0x1);if(_0x30a4c7==='/'){_0x542ece=_0x542ece[_0x0a9e('0x63')](0x0,_0x542ece[_0x0a9e('0x64')](_0x30a4c7));}var _0x40fc56={'method':_0x0a9e('0x65'),'uri':util[_0x0a9e('0x66')](_0x0a9e('0x67'),_0x542ece,_0x0a9e('0x68')),'json':!![]};switch(_0x290d43[_0x0a9e('0x60')]){case _0x0a9e('0x69'):_0x40fc56[_0x0a9e('0x6a')]={'Authorization':util['format'](_0x0a9e('0x6b'),new Buffer(util[_0x0a9e('0x66')](_0x0a9e('0x6c'),_0x290d43['username'],_0x290d43[_0x0a9e('0x69')]))[_0x0a9e('0x6d')](_0x0a9e('0x6e')))};break;case _0x0a9e('0x5f'):_0x40fc56['headers']={'Authorization':util['format'](_0x0a9e('0x6b'),new Buffer(util[_0x0a9e('0x66')]('%s/token:%s',_0x290d43[_0x0a9e('0x5e')],_0x290d43['token']))[_0x0a9e('0x6d')](_0x0a9e('0x6e')))};break;default:throw new db['Sequelize'][(_0x0a9e('0x6f'))](_0x0a9e('0x70'));}return rp(_0x40fc56);}})[_0x0a9e('0x30')](function(_0x42b959){if(_0x42b959){var _0x3755fe=[_0x0a9e('0x71'),_0x0a9e('0x72'),'group',_0x0a9e('0x73')];_[_0x0a9e('0x74')](_0x42b959[_0x0a9e('0x68')],function(_0x16e5b9){return _0x3755fe['includes'](_0x16e5b9[_0x0a9e('0x47')]);});return{'count':_0x42b959[_0x0a9e('0x68')]['length'],'rows':_[_0x0a9e('0x35')](_0x42b959['ticket_fields'],function(_0x163710){return{'id':_0x163710['id'],'name':_0x163710[_0x0a9e('0x75')]>0x7?_0x163710[_0x0a9e('0x76')]:_0x163710[_0x0a9e('0x47')],'custom':_0x163710['position']>0x7?!![]:![],'options':_0x163710['system_field_options']?_0x163710[_0x0a9e('0x77')]:_0x163710[_0x0a9e('0x78')]?_0x163710[_0x0a9e('0x78')]:[]};})};}})['then'](respondWithResult(_0x2cc7a7,null))[_0x0a9e('0x23')](function(_0x36e975){var _0x524e38=_0x75912a['query'][_0x0a9e('0x79')]?0x1f4:_0x36e975['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x5d'),_0x524e38,JSON[_0x0a9e('0x1d')](_0x36e975));delete _0x36e975[_0x0a9e('0x33')];if(_0x524e38===0x191){_0x524e38=0x190;}_0x2cc7a7[_0x0a9e('0x25')](_0x524e38)[_0x0a9e('0x7a')](_0x75912a[_0x0a9e('0x39')]['test']?{'message':_0x0a9e('0x7b'),'statusCode':_0x36e975['statusCode']}:_0x36e975);});}; \ No newline at end of file +var _0xa9e0=['body','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','ZendeskAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create'];(function(_0x2cce96,_0x2381e9){var _0x5c2436=function(_0x389471){while(--_0x389471){_0x2cce96['push'](_0x2cce96['shift']());}};_0x5c2436(++_0x2381e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];var integrations=require(_0x0a9e('0x16'));var jayson=require(_0x0a9e('0x17'));var client=jayson[_0x0a9e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4283ce,_0x239b12,_0x2b4227,_0x281129){return new BPromise(function(_0x44dcfd,_0x4d5611){var _0x52a03d=_0x281129||client;return _0x52a03d[_0x0a9e('0x19')](_0x4283ce,_0x2b4227)['then'](function(_0x1985b6){logger['info'](_0x0a9e('0x1a'),_0x239b12,_0x0a9e('0x1b'));logger['debug'](_0x0a9e('0x1c'),_0x239b12,'request\x20sent',JSON[_0x0a9e('0x1d')](_0x1985b6));if(_0x1985b6[_0x0a9e('0x1e')]){if(_0x1985b6[_0x0a9e('0x1e')][_0x0a9e('0x1f')]===0x1f4){logger[_0x0a9e('0x1e')](_0x0a9e('0x1a'),_0x239b12,_0x1985b6[_0x0a9e('0x1e')][_0x0a9e('0x20')]);return _0x4d5611(_0x1985b6[_0x0a9e('0x1e')][_0x0a9e('0x20')]);}logger[_0x0a9e('0x1e')](_0x0a9e('0x1a'),_0x239b12,_0x1985b6['error'][_0x0a9e('0x20')]);return _0x44dcfd(_0x1985b6[_0x0a9e('0x1e')]['message']);}else{logger[_0x0a9e('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x239b12,'request\x20sent');_0x44dcfd(_0x1985b6[_0x0a9e('0x22')][_0x0a9e('0x20')]);}})[_0x0a9e('0x23')](function(_0x30bae6){logger['error'](_0x0a9e('0x1a'),_0x239b12,_0x30bae6);_0x4d5611(_0x30bae6);});});}function respondWithStatusCode(_0x2fb0e4,_0x3b45bc){_0x3b45bc=_0x3b45bc||0xcc;return function(_0x4d00e6){if(_0x4d00e6){return _0x2fb0e4[_0x0a9e('0x24')](_0x3b45bc);}return _0x2fb0e4[_0x0a9e('0x25')](_0x3b45bc)[_0x0a9e('0x26')]();};}function respondWithResult(_0x5ea472,_0x59181e){_0x59181e=_0x59181e||0xc8;return function(_0x197ec0){if(_0x197ec0){return _0x5ea472[_0x0a9e('0x25')](_0x59181e)[_0x0a9e('0x27')](_0x197ec0);}};}function respondWithFilteredResult(_0x33161b,_0x526cf3){return function(_0x384319){if(_0x384319){var _0x479bc4=_0x384319[_0x0a9e('0x28')],_0x45a1e7=_0x526cf3[_0x0a9e('0x29')],_0x5bfb33=_0x526cf3[_0x0a9e('0x29')]+_0x526cf3[_0x0a9e('0x2a')],_0x1dc186;if(_0x5bfb33>=_0x479bc4){_0x5bfb33=_0x479bc4;_0x1dc186=0xc8;}else{_0x1dc186=0xce;}_0x33161b[_0x0a9e('0x25')](_0x1dc186);return _0x33161b[_0x0a9e('0x2b')](_0x0a9e('0x2c'),_0x45a1e7+'-'+_0x5bfb33+'/'+_0x479bc4)['json'](_0x384319);}return null;};}function patchUpdates(_0x3652a7){return function(_0x468813){try{jsonpatch[_0x0a9e('0x2d')](_0x468813,_0x3652a7,!![]);}catch(_0x2ec755){return BPromise['reject'](_0x2ec755);}return _0x468813[_0x0a9e('0x2e')]();};}function saveUpdates(_0x40e7a3,_0x1843b2){return function(_0x824a4f){if(_0x824a4f){return _0x824a4f[_0x0a9e('0x2f')](_0x40e7a3)[_0x0a9e('0x30')](function(_0x296f41){return _0x296f41;});}return null;};}function removeEntity(_0x2e8759,_0x1dbde2){return function(_0x540530){if(_0x540530){return _0x540530[_0x0a9e('0x31')]()['then'](function(){_0x2e8759[_0x0a9e('0x25')](0xcc)[_0x0a9e('0x26')]();});}};}function handleEntityNotFound(_0x1122db,_0x33bdb7){return function(_0x25ce3a){if(!_0x25ce3a){_0x1122db['sendStatus'](0x194);}return _0x25ce3a;};}function handleError(_0x66c1d2,_0x46f0a5){_0x46f0a5=_0x46f0a5||0x1f4;return function(_0x40cb85){logger[_0x0a9e('0x1e')](_0x40cb85[_0x0a9e('0x32')]);if(_0x40cb85[_0x0a9e('0x33')]){delete _0x40cb85[_0x0a9e('0x33')];}_0x66c1d2[_0x0a9e('0x25')](_0x46f0a5)['send'](_0x40cb85);};}exports[_0x0a9e('0x34')]=function(_0x5e7238,_0x2cc7a0){var _0x14b13f={},_0x2b7e7f={},_0x3f3d41={'count':0x0,'rows':[]};var _0x567193=_[_0x0a9e('0x35')](db[_0x0a9e('0x36')][_0x0a9e('0x37')],function(_0x15de0e){return{'name':_0x15de0e['fieldName'],'type':_0x15de0e['type'][_0x0a9e('0x38')]};});_0x2b7e7f['model']=_[_0x0a9e('0x35')](_0x567193,_0x0a9e('0x33'));_0x2b7e7f[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5e7238['query']);_0x2b7e7f[_0x0a9e('0x3b')]=_[_0x0a9e('0x3c')](_0x2b7e7f[_0x0a9e('0x3d')],_0x2b7e7f['query']);_0x14b13f[_0x0a9e('0x3e')]=_[_0x0a9e('0x3c')](_0x2b7e7f[_0x0a9e('0x3d')],qs['fields'](_0x5e7238['query'][_0x0a9e('0x3f')]));_0x14b13f[_0x0a9e('0x3e')]=_0x14b13f['attributes'][_0x0a9e('0x40')]?_0x14b13f[_0x0a9e('0x3e')]:_0x2b7e7f[_0x0a9e('0x3d')];if(!_0x5e7238[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x14b13f[_0x0a9e('0x2a')]=qs[_0x0a9e('0x2a')](_0x5e7238['query'][_0x0a9e('0x2a')]);_0x14b13f[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x5e7238['query'][_0x0a9e('0x29')]);}_0x14b13f[_0x0a9e('0x41')]=qs[_0x0a9e('0x42')](_0x5e7238[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x14b13f[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5e7238[_0x0a9e('0x39')],_0x2b7e7f[_0x0a9e('0x3b')]),_0x567193);if(_0x5e7238[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x14b13f[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x14b13f[_0x0a9e('0x43')],{'$or':_['map'](_0x567193,function(_0x52628e){if(_0x52628e[_0x0a9e('0x47')]!==_0x0a9e('0x48')){var _0x405c8f={};_0x405c8f[_0x52628e[_0x0a9e('0x33')]]={'$like':'%'+_0x5e7238[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x405c8f;}})});}_0x14b13f=_[_0x0a9e('0x46')]({},_0x14b13f,_0x5e7238[_0x0a9e('0x49')]);var _0x432fcc={'where':_0x14b13f[_0x0a9e('0x43')]};return db[_0x0a9e('0x36')][_0x0a9e('0x28')](_0x432fcc)['then'](function(_0x117c99){_0x3f3d41[_0x0a9e('0x28')]=_0x117c99;if(_0x5e7238[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x14b13f[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x36')][_0x0a9e('0x4c')](_0x14b13f);})[_0x0a9e('0x30')](function(_0x59afe8){_0x3f3d41[_0x0a9e('0x4d')]=_0x59afe8;return _0x3f3d41;})['then'](respondWithFilteredResult(_0x2cc7a0,_0x14b13f))[_0x0a9e('0x23')](handleError(_0x2cc7a0,null));};exports[_0x0a9e('0x4e')]=function(_0x8d6dd1,_0x562fb4){var _0x14bec2={'raw':![],'where':{'id':_0x8d6dd1[_0x0a9e('0x4f')]['id']}},_0x7f6eb1={};_0x7f6eb1[_0x0a9e('0x3d')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x36')][_0x0a9e('0x37')]);_0x7f6eb1['query']=_[_0x0a9e('0x3a')](_0x8d6dd1[_0x0a9e('0x39')]);_0x7f6eb1[_0x0a9e('0x3b')]=_[_0x0a9e('0x3c')](_0x7f6eb1[_0x0a9e('0x3d')],_0x7f6eb1[_0x0a9e('0x39')]);_0x14bec2[_0x0a9e('0x3e')]=_[_0x0a9e('0x3c')](_0x7f6eb1[_0x0a9e('0x3d')],qs['fields'](_0x8d6dd1[_0x0a9e('0x39')][_0x0a9e('0x3f')]));_0x14bec2['attributes']=_0x14bec2['attributes']['length']?_0x14bec2[_0x0a9e('0x3e')]:_0x7f6eb1[_0x0a9e('0x3d')];if(_0x8d6dd1[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x14bec2[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x14bec2=_[_0x0a9e('0x46')]({},_0x14bec2,_0x8d6dd1[_0x0a9e('0x49')]);return db[_0x0a9e('0x36')]['find'](_0x14bec2)['then'](handleEntityNotFound(_0x562fb4,null))['then'](respondWithResult(_0x562fb4,null))[_0x0a9e('0x23')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x50')]=function(_0x14d602,_0x5bb3ed){return db[_0x0a9e('0x36')][_0x0a9e('0x50')](_0x14d602['body'],{})['then'](respondWithResult(_0x5bb3ed,0xc9))[_0x0a9e('0x23')](handleError(_0x5bb3ed,null));};exports['update']=function(_0x443e72,_0x4c3845){if(_0x443e72[_0x0a9e('0x51')]['id']){delete _0x443e72[_0x0a9e('0x51')]['id'];}return db[_0x0a9e('0x36')]['find']({'where':{'id':_0x443e72[_0x0a9e('0x4f')]['id']}})[_0x0a9e('0x30')](handleEntityNotFound(_0x4c3845,null))['then'](saveUpdates(_0x443e72['body'],null))[_0x0a9e('0x30')](respondWithResult(_0x4c3845,null))[_0x0a9e('0x23')](handleError(_0x4c3845,null));};exports['destroy']=function(_0x145931,_0x5ce9ac){return db[_0x0a9e('0x36')]['find']({'where':{'id':_0x145931[_0x0a9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5ce9ac,null))['then'](removeEntity(_0x5ce9ac,null))['catch'](handleError(_0x5ce9ac,null));};exports[_0x0a9e('0x52')]=function(_0x47de4c,_0x2f7092,_0x65432){var _0x3cfd00={};var _0x19b4df={};var _0x232830;var _0x272738;return db[_0x0a9e('0x36')][_0x0a9e('0x53')]({'where':{'id':_0x47de4c['params']['id']}})[_0x0a9e('0x30')](handleEntityNotFound(_0x2f7092,null))[_0x0a9e('0x30')](function(_0x2642bb){if(_0x2642bb){_0x232830=_0x2642bb;_0x19b4df[_0x0a9e('0x3d')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x54')]['rawAttributes']);_0x19b4df[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x47de4c['query']);_0x19b4df[_0x0a9e('0x3b')]=_['intersection'](_0x19b4df[_0x0a9e('0x3d')],_0x19b4df['query']);_0x3cfd00['attributes']=_['intersection'](_0x19b4df[_0x0a9e('0x3d')],qs['fields'](_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x3f')]));_0x3cfd00[_0x0a9e('0x3e')]=_0x3cfd00[_0x0a9e('0x3e')][_0x0a9e('0x40')]?_0x3cfd00[_0x0a9e('0x3e')]:_0x19b4df['model'];_0x3cfd00[_0x0a9e('0x41')]=qs['sort'](_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x3cfd00[_0x0a9e('0x43')]=qs['filters'](_[_0x0a9e('0x44')](_0x47de4c[_0x0a9e('0x39')],_0x19b4df[_0x0a9e('0x3b')]));if(_0x47de4c[_0x0a9e('0x39')]['filter']){_0x3cfd00[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x3cfd00['where'],{'$or':_[_0x0a9e('0x35')](_0x3cfd00[_0x0a9e('0x3e')],function(_0x88dcbf){var _0x409b29={};_0x409b29[_0x88dcbf]={'$like':'%'+_0x47de4c[_0x0a9e('0x39')]['filter']+'%'};return _0x409b29;})});}_0x3cfd00=_[_0x0a9e('0x46')]({},_0x3cfd00,_0x47de4c[_0x0a9e('0x49')]);return _0x232830[_0x0a9e('0x52')](_0x3cfd00);}})['then'](function(_0x3528b7){if(_0x3528b7){_0x272738=_0x3528b7['length'];if(!_0x47de4c['query'][_0x0a9e('0x55')](_0x0a9e('0x56'))){_0x3cfd00[_0x0a9e('0x2a')]=qs[_0x0a9e('0x2a')](_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x2a')]);_0x3cfd00[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x29')]);}return _0x232830[_0x0a9e('0x52')](_0x3cfd00);}})[_0x0a9e('0x30')](function(_0x2bbb86){if(_0x2bbb86){return _0x2bbb86?{'count':_0x272738,'rows':_0x2bbb86}:null;}})[_0x0a9e('0x30')](respondWithResult(_0x2f7092,null))[_0x0a9e('0x23')](handleError(_0x2f7092,null));};exports[_0x0a9e('0x57')]=function(_0x2a28c0,_0x4257c9,_0x5150a4){if(_0x2a28c0[_0x0a9e('0x51')]['id']){delete _0x2a28c0[_0x0a9e('0x51')]['id'];}return db[_0x0a9e('0x36')]['findOne']({'where':{'id':_0x2a28c0[_0x0a9e('0x4f')]['id']}})[_0x0a9e('0x30')](handleEntityNotFound(_0x4257c9,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x58')]=_0x83f0b2['id'];_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x59')]=integrations['getSubjects'](_0x2a28c0['body']['channel'],_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x47')]);_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x5a')]=integrations[_0x0a9e('0x5b')](_0x2a28c0[_0x0a9e('0x51')][_0x0a9e('0x5c')],_0x2a28c0[_0x0a9e('0x51')]['type']);return db[_0x0a9e('0x54')][_0x0a9e('0x50')](_0x2a28c0[_0x0a9e('0x51')],{'include':[{'model':db['ZendeskField'],'as':_0x0a9e('0x59')},{'model':db['ZendeskField'],'as':_0x0a9e('0x5a')}]});}return null;})[_0x0a9e('0x30')](respondWithResult(_0x4257c9,null))['catch'](handleError(_0x4257c9,null));};exports[_0x0a9e('0x5d')]=function(_0x75912a,_0x2cc7a7,_0x317c0c){var _0x542ece='';return db[_0x0a9e('0x36')][_0x0a9e('0x53')]({'where':{'id':_0x75912a[_0x0a9e('0x4f')]['id']},'attributes':['id',_0x0a9e('0x5e'),'password',_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x0a9e('0x61')]})[_0x0a9e('0x30')](handleEntityNotFound(_0x2cc7a7,null))['then'](function(_0x290d43){if(_0x290d43){_0x542ece=_0x290d43[_0x0a9e('0x61')];var _0x30a4c7=_0x542ece[_0x0a9e('0x62')](-0x1);if(_0x30a4c7==='/'){_0x542ece=_0x542ece[_0x0a9e('0x63')](0x0,_0x542ece[_0x0a9e('0x64')](_0x30a4c7));}var _0x40fc56={'method':_0x0a9e('0x65'),'uri':util[_0x0a9e('0x66')](_0x0a9e('0x67'),_0x542ece,_0x0a9e('0x68')),'json':!![]};switch(_0x290d43[_0x0a9e('0x60')]){case _0x0a9e('0x69'):_0x40fc56[_0x0a9e('0x6a')]={'Authorization':util['format'](_0x0a9e('0x6b'),new Buffer(util[_0x0a9e('0x66')](_0x0a9e('0x6c'),_0x290d43['username'],_0x290d43[_0x0a9e('0x69')]))[_0x0a9e('0x6d')](_0x0a9e('0x6e')))};break;case _0x0a9e('0x5f'):_0x40fc56['headers']={'Authorization':util['format'](_0x0a9e('0x6b'),new Buffer(util[_0x0a9e('0x66')]('%s/token:%s',_0x290d43[_0x0a9e('0x5e')],_0x290d43['token']))[_0x0a9e('0x6d')](_0x0a9e('0x6e')))};break;default:throw new db['Sequelize'][(_0x0a9e('0x6f'))](_0x0a9e('0x70'));}return rp(_0x40fc56);}})[_0x0a9e('0x30')](function(_0x42b959){if(_0x42b959){var _0x3755fe=[_0x0a9e('0x71'),_0x0a9e('0x72'),'group',_0x0a9e('0x73')];_[_0x0a9e('0x74')](_0x42b959[_0x0a9e('0x68')],function(_0x16e5b9){return _0x3755fe['includes'](_0x16e5b9[_0x0a9e('0x47')]);});return{'count':_0x42b959[_0x0a9e('0x68')]['length'],'rows':_[_0x0a9e('0x35')](_0x42b959['ticket_fields'],function(_0x163710){return{'id':_0x163710['id'],'name':_0x163710[_0x0a9e('0x75')]>0x7?_0x163710[_0x0a9e('0x76')]:_0x163710[_0x0a9e('0x47')],'custom':_0x163710['position']>0x7?!![]:![],'options':_0x163710['system_field_options']?_0x163710[_0x0a9e('0x77')]:_0x163710[_0x0a9e('0x78')]?_0x163710[_0x0a9e('0x78')]:[]};})};}})['then'](respondWithResult(_0x2cc7a7,null))[_0x0a9e('0x23')](function(_0x36e975){var _0x524e38=_0x75912a['query'][_0x0a9e('0x79')]?0x1f4:_0x36e975['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x5d'),_0x524e38,JSON[_0x0a9e('0x1d')](_0x36e975));delete _0x36e975[_0x0a9e('0x33')];if(_0x524e38===0x191){_0x524e38=0x190;}_0x2cc7a7[_0x0a9e('0x25')](_0x524e38)[_0x0a9e('0x7a')](_0x75912a[_0x0a9e('0x39')]['test']?{'message':_0x0a9e('0x7b'),'statusCode':_0x36e975['statusCode']}:_0x36e975);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 837de00..d594605 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 _0x22db=['exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x5af812,_0x43d252){var _0x1489f2=function(_0x1c7fa9){while(--_0x1c7fa9){_0x5af812['push'](_0x5af812['shift']());}};_0x1489f2(++_0x43d252);}(_0x22db,0x74));var _0xb22d=function(_0x4b8b21,_0x1a910b){_0x4b8b21=_0x4b8b21-0x0;var _0xeb8cc1=_0x22db[_0x4b8b21];return _0xeb8cc1;};'use strict';var _=require('lodash');var util=require(_0xb22d('0x0'));var logger=require(_0xb22d('0x1'))(_0xb22d('0x2'));var moment=require(_0xb22d('0x3'));var BPromise=require(_0xb22d('0x4'));var rp=require(_0xb22d('0x5'));var fs=require('fs');var path=require(_0xb22d('0x6'));var rimraf=require(_0xb22d('0x7'));var config=require(_0xb22d('0x8'));var attributes=require(_0xb22d('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xb22d('0xa')]=function(_0x10f6ed,_0x422492){return _0x10f6ed[_0xb22d('0xb')](_0xb22d('0xc'),attributes,{'tableName':_0xb22d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a50=['../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x30c167,_0x3c0f7c){var _0x107376=function(_0x1bcbb6){while(--_0x1bcbb6){_0x30c167['push'](_0x30c167['shift']());}};_0x107376(++_0x3c0f7c);}(_0x0a50,0x1d5));var _0x00a5=function(_0x16bf05,_0x4f70da){_0x16bf05=_0x16bf05-0x0;var _0xbcf546=_0x0a50[_0x16bf05];return _0xbcf546;};'use strict';var _=require(_0x00a5('0x0'));var util=require(_0x00a5('0x1'));var logger=require(_0x00a5('0x2'))(_0x00a5('0x3'));var moment=require(_0x00a5('0x4'));var BPromise=require(_0x00a5('0x5'));var rp=require(_0x00a5('0x6'));var fs=require('fs');var path=require(_0x00a5('0x7'));var rimraf=require(_0x00a5('0x8'));var config=require(_0x00a5('0x9'));var attributes=require(_0x00a5('0xa'));var integrations=require(_0x00a5('0xb'));module[_0x00a5('0xc')]=function(_0x5e0749,_0xdf2908){return _0x5e0749[_0x00a5('0xd')](_0x00a5('0xe'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 48ff300..6978d0e 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x307e17,_0x208671){var _0x3aa571=function(_0x12995d){while(--_0x12995d){_0x307e17['push'](_0x307e17['shift']());}};_0x3aa571(++_0x208671);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file +var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0xcb91[_0x1f83a5];return _0x45edf0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1b01a69..2413ede 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 _0xaabe=['delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update'];(function(_0x1d4caf,_0x5cc62b){var _0x1b2db1=function(_0x5117ff){while(--_0x5117ff){_0x1d4caf['push'](_0x1d4caf['shift']());}};_0x1b2db1(++_0x5cc62b);}(_0xaabe,0x121));var _0xeaab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xaabe[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xeaab('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeaab('0x1'));var express=require(_0xeaab('0x2'));var router=express['Router']();var fs_extra=require(_0xeaab('0x3'));var auth=require(_0xeaab('0x4'));var interaction=require(_0xeaab('0x5'));var config=require('../../config/environment');var controller=require(_0xeaab('0x6'));router[_0xeaab('0x7')]('/',auth[_0xeaab('0x8')](),controller[_0xeaab('0x9')]);router['get'](_0xeaab('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xeaab('0x7')](_0xeaab('0xb'),auth[_0xeaab('0x8')](),controller['getFields']);router['get'](_0xeaab('0xc'),auth[_0xeaab('0x8')](),controller[_0xeaab('0xd')]);router[_0xeaab('0x7')](_0xeaab('0xe'),auth[_0xeaab('0x8')](),controller[_0xeaab('0xf')]);router[_0xeaab('0x7')](_0xeaab('0x10'),auth[_0xeaab('0x8')](),controller[_0xeaab('0x11')]);router['post']('/',auth[_0xeaab('0x8')](),controller[_0xeaab('0x12')]);router[_0xeaab('0x13')]('/:id/tags',auth[_0xeaab('0x8')](),controller[_0xeaab('0x14')]);router[_0xeaab('0x15')](_0xeaab('0xa'),auth[_0xeaab('0x8')](),controller[_0xeaab('0x16')]);router[_0xeaab('0x17')](_0xeaab('0xa'),auth[_0xeaab('0x8')](),controller[_0xeaab('0x18')]);module[_0xeaab('0x19')]=router; \ No newline at end of file +var _0x5461=['getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x1ce762,_0x43f515){var _0x43be9f=function(_0x21f768){while(--_0x21f768){_0x1ce762['push'](_0x1ce762['shift']());}};_0x43be9f(++_0x43f515);}(_0x5461,0x72));var _0x1546=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0x5461[_0x5de1bc];return _0x19f4b8;};'use strict';var multer=require(_0x1546('0x0'));var util=require(_0x1546('0x1'));var path=require(_0x1546('0x2'));var timeout=require(_0x1546('0x3'));var express=require('express');var router=express[_0x1546('0x4')]();var fs_extra=require(_0x1546('0x5'));var auth=require(_0x1546('0x6'));var interaction=require(_0x1546('0x7'));var config=require(_0x1546('0x8'));var controller=require(_0x1546('0x9'));router[_0x1546('0xa')]('/',auth[_0x1546('0xb')](),controller[_0x1546('0xc')]);router[_0x1546('0xa')](_0x1546('0xd'),auth[_0x1546('0xb')](),controller[_0x1546('0xe')]);router[_0x1546('0xa')](_0x1546('0xf'),auth[_0x1546('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x1546('0x10')]);router[_0x1546('0xa')](_0x1546('0x11'),auth['isAuthenticated'](),controller[_0x1546('0x12')]);router[_0x1546('0xa')](_0x1546('0x13'),auth['isAuthenticated'](),controller['getTags']);router[_0x1546('0x14')]('/',auth['isAuthenticated'](),controller[_0x1546('0x15')]);router[_0x1546('0x14')](_0x1546('0x13'),auth[_0x1546('0xb')](),controller['setTags']);router[_0x1546('0x16')](_0x1546('0xd'),auth[_0x1546('0xb')](),controller[_0x1546('0x17')]);router[_0x1546('0x18')](_0x1546('0xd'),auth[_0x1546('0xb')](),controller['destroy']);module[_0x1546('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index c877cfa..23be1b8 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 _0x48a7=['sequelize','exports','STRING'];(function(_0x599aaf,_0x3d3622){var _0xd995f3=function(_0x19825e){while(--_0x19825e){_0x599aaf['push'](_0x599aaf['shift']());}};_0xd995f3(++_0x3d3622);}(_0x48a7,0x123));var _0x748a=function(_0x5a0b82,_0x5cade3){_0x5a0b82=_0x5a0b82-0x0;var _0x30bde5=_0x48a7[_0x5a0b82];return _0x30bde5;};'use strict';var Sequelize=require(_0x748a('0x0'));module[_0x748a('0x1')]={'name':{'type':Sequelize[_0x748a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f12=['exports','STRING','sequelize'];(function(_0x40e12b,_0xc1c6d9){var _0x30cbc2=function(_0x592ec6){while(--_0x592ec6){_0x40e12b['push'](_0x40e12b['shift']());}};_0x30cbc2(++_0xc1c6d9);}(_0x6f12,0xe3));var _0x26f1=function(_0x9b6188,_0x28cb0b){_0x9b6188=_0x9b6188-0x0;var _0x37d16d=_0x6f12[_0x9b6188];return _0x37d16d;};'use strict';var Sequelize=require(_0x26f1('0x0'));module[_0x26f1('0x1')]={'name':{'type':Sequelize[_0x26f1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0001445..9b1b6d0 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 _0x7217=['pick','filter','where','merge','map','options','includeAll','include','findAll','then','rows','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','ZendeskField','order','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','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','../../config/license/util','jayson/promise','client','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','length','attributes','nolimit','sort'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var fs_extra=require(_0x7721('0xb'));var _=require(_0x7721('0xc'));var squel=require(_0x7721('0xd'));var crypto=require(_0x7721('0xe'));var jsforce=require(_0x7721('0xf'));var deskjs=require(_0x7721('0x10'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x11'));var Papa=require(_0x7721('0x12'));var Redis=require(_0x7721('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7721('0x14'));var as=require(_0x7721('0x15'));var hardwareService=require(_0x7721('0x16'));var logger=require(_0x7721('0x17'))(_0x7721('0x18'));var utils=require(_0x7721('0x19'));var config=require(_0x7721('0x1a'));var licenseUtil=require(_0x7721('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7721('0x1c'));var client=jayson[_0x7721('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x109900,_0x30da54,_0x3f01c5,_0x2e9752){return new BPromise(function(_0x5069da,_0x3cbce8){var _0x25b1c0=_0x2e9752||client;return _0x25b1c0['request'](_0x109900,_0x3f01c5)['then'](function(_0x4b183e){logger[_0x7721('0x1e')](_0x7721('0x1f'),_0x30da54,_0x7721('0x20'));logger[_0x7721('0x21')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x30da54,_0x7721('0x20'),JSON['stringify'](_0x4b183e));if(_0x4b183e[_0x7721('0x22')]){if(_0x4b183e['error'][_0x7721('0x23')]===0x1f4){logger[_0x7721('0x22')](_0x7721('0x1f'),_0x30da54,_0x4b183e[_0x7721('0x22')][_0x7721('0x24')]);return _0x3cbce8(_0x4b183e[_0x7721('0x22')][_0x7721('0x24')]);}logger[_0x7721('0x22')](_0x7721('0x1f'),_0x30da54,_0x4b183e[_0x7721('0x22')]['message']);return _0x5069da(_0x4b183e[_0x7721('0x22')][_0x7721('0x24')]);}else{logger[_0x7721('0x1e')](_0x7721('0x1f'),_0x30da54,'request\x20sent');_0x5069da(_0x4b183e[_0x7721('0x25')]['message']);}})[_0x7721('0x26')](function(_0x288e3a){logger[_0x7721('0x22')](_0x7721('0x1f'),_0x30da54,_0x288e3a);_0x3cbce8(_0x288e3a);});});}function respondWithStatusCode(_0x121cc4,_0x395b15){_0x395b15=_0x395b15||0xcc;return function(_0x2c6b7b){if(_0x2c6b7b){return _0x121cc4['sendStatus'](_0x395b15);}return _0x121cc4[_0x7721('0x27')](_0x395b15)[_0x7721('0x28')]();};}function respondWithResult(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xc8;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x27')](_0x1f67c7)[_0x7721('0x29')](_0x40d550);}};}function respondWithFilteredResult(_0xf753f1,_0x40f367){return function(_0x52316e){if(_0x52316e){var _0x258ddf=_0x52316e[_0x7721('0x2a')],_0x5b0551=_0x40f367[_0x7721('0x2b')],_0x499b87=_0x40f367[_0x7721('0x2b')]+_0x40f367[_0x7721('0x2c')],_0x315202;if(_0x499b87>=_0x258ddf){_0x499b87=_0x258ddf;_0x315202=0xc8;}else{_0x315202=0xce;}_0xf753f1[_0x7721('0x27')](_0x315202);return _0xf753f1[_0x7721('0x2d')](_0x7721('0x2e'),_0x5b0551+'-'+_0x499b87+'/'+_0x258ddf)['json'](_0x52316e);}return null;};}function patchUpdates(_0x471651){return function(_0x2871c5){try{jsonpatch['apply'](_0x2871c5,_0x471651,!![]);}catch(_0x4a25c9){return BPromise[_0x7721('0x2f')](_0x4a25c9);}return _0x2871c5[_0x7721('0x30')]();};}function saveUpdates(_0x48f329,_0x46f772){return function(_0x4651b5){if(_0x4651b5){return _0x4651b5[_0x7721('0x31')](_0x48f329)['then'](function(_0x3d9a32){return _0x3d9a32;});}return null;};}function removeEntity(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x32')]()['then'](function(){_0x1ff31b[_0x7721('0x27')](0xcc)[_0x7721('0x28')]();});}};}function handleEntityNotFound(_0xb2386d,_0x5c5b33){return function(_0x35de7a){if(!_0x35de7a){_0xb2386d[_0x7721('0x33')](0x194);}return _0x35de7a;};}function handleError(_0x498654,_0x217592){_0x217592=_0x217592||0x1f4;return function(_0x5ce026){logger[_0x7721('0x22')](_0x5ce026[_0x7721('0x34')]);if(_0x5ce026[_0x7721('0x35')]){delete _0x5ce026[_0x7721('0x35')];}_0x498654[_0x7721('0x27')](_0x217592)[_0x7721('0x36')](_0x5ce026);};}exports[_0x7721('0x37')]=function(_0x15545a,_0x25bdd9){var _0x3a2eb7={},_0x385454={},_0x5c806d={'count':0x0,'rows':[]};var _0xd1df68=_['map'](db[_0x7721('0x38')][_0x7721('0x39')],function(_0x7942f7){return{'name':_0x7942f7[_0x7721('0x3a')],'type':_0x7942f7[_0x7721('0x3b')][_0x7721('0x3c')]};});_0x385454['model']=_['map'](_0xd1df68,'name');_0x385454['query']=_[_0x7721('0x3d')](_0x15545a[_0x7721('0x3e')]);_0x385454[_0x7721('0x3f')]=_[_0x7721('0x40')](_0x385454['model'],_0x385454[_0x7721('0x3e')]);_0x3a2eb7['attributes']=_[_0x7721('0x40')](_0x385454[_0x7721('0x41')],qs['fields'](_0x15545a[_0x7721('0x3e')][_0x7721('0x42')]));_0x3a2eb7['attributes']=_0x3a2eb7['attributes'][_0x7721('0x43')]?_0x3a2eb7[_0x7721('0x44')]:_0x385454[_0x7721('0x41')];if(!_0x15545a[_0x7721('0x3e')]['hasOwnProperty'](_0x7721('0x45'))){_0x3a2eb7[_0x7721('0x2c')]=qs[_0x7721('0x2c')](_0x15545a[_0x7721('0x3e')][_0x7721('0x2c')]);_0x3a2eb7['offset']=qs[_0x7721('0x2b')](_0x15545a['query'][_0x7721('0x2b')]);}_0x3a2eb7['order']=qs[_0x7721('0x46')](_0x15545a[_0x7721('0x3e')][_0x7721('0x46')]);_0x3a2eb7['where']=qs[_0x7721('0x3f')](_[_0x7721('0x47')](_0x15545a[_0x7721('0x3e')],_0x385454['filters']),_0xd1df68);if(_0x15545a[_0x7721('0x3e')][_0x7721('0x48')]){_0x3a2eb7[_0x7721('0x49')]=_[_0x7721('0x4a')](_0x3a2eb7[_0x7721('0x49')],{'$or':_[_0x7721('0x4b')](_0xd1df68,function(_0x463ccc){if(_0x463ccc['type']!=='VIRTUAL'){var _0x1ac3af={};_0x1ac3af[_0x463ccc[_0x7721('0x35')]]={'$like':'%'+_0x15545a[_0x7721('0x3e')][_0x7721('0x48')]+'%'};return _0x1ac3af;}})});}_0x3a2eb7=_[_0x7721('0x4a')]({},_0x3a2eb7,_0x15545a[_0x7721('0x4c')]);var _0x1d2ea5={'where':_0x3a2eb7[_0x7721('0x49')]};return db[_0x7721('0x38')][_0x7721('0x2a')](_0x1d2ea5)['then'](function(_0x578867){_0x5c806d[_0x7721('0x2a')]=_0x578867;if(_0x15545a[_0x7721('0x3e')][_0x7721('0x4d')]){_0x3a2eb7[_0x7721('0x4e')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x7721('0x4f')](_0x3a2eb7);})[_0x7721('0x50')](function(_0x56c3d9){_0x5c806d[_0x7721('0x51')]=_0x56c3d9;return _0x5c806d;})['then'](respondWithFilteredResult(_0x25bdd9,_0x3a2eb7))[_0x7721('0x26')](handleError(_0x25bdd9,null));};exports['show']=function(_0x334f23,_0x196be4){var _0xf17c40={'raw':![],'where':{'id':_0x334f23[_0x7721('0x52')]['id']}},_0x4eda58={};_0x4eda58[_0x7721('0x41')]=_['keys'](db[_0x7721('0x38')][_0x7721('0x39')]);_0x4eda58[_0x7721('0x3e')]=_['keys'](_0x334f23[_0x7721('0x3e')]);_0x4eda58['filters']=_[_0x7721('0x40')](_0x4eda58[_0x7721('0x41')],_0x4eda58[_0x7721('0x3e')]);_0xf17c40[_0x7721('0x44')]=_[_0x7721('0x40')](_0x4eda58[_0x7721('0x41')],qs[_0x7721('0x42')](_0x334f23[_0x7721('0x3e')][_0x7721('0x42')]));_0xf17c40[_0x7721('0x44')]=_0xf17c40[_0x7721('0x44')][_0x7721('0x43')]?_0xf17c40[_0x7721('0x44')]:_0x4eda58[_0x7721('0x41')];if(_0x334f23[_0x7721('0x3e')]['includeAll']){_0xf17c40[_0x7721('0x4e')]=[{'all':!![]}];}_0xf17c40=_[_0x7721('0x4a')]({},_0xf17c40,_0x334f23[_0x7721('0x4c')]);return db[_0x7721('0x38')][_0x7721('0x53')](_0xf17c40)[_0x7721('0x50')](handleEntityNotFound(_0x196be4,null))[_0x7721('0x50')](respondWithResult(_0x196be4,null))['catch'](handleError(_0x196be4,null));};exports[_0x7721('0x54')]=function(_0x17036e,_0x134908){return db[_0x7721('0x38')][_0x7721('0x54')](_0x17036e[_0x7721('0x55')],{})[_0x7721('0x50')](respondWithResult(_0x134908,0xc9))[_0x7721('0x26')](handleError(_0x134908,null));};exports[_0x7721('0x31')]=function(_0x3b968d,_0x8eca10){if(_0x3b968d['body']['id']){delete _0x3b968d[_0x7721('0x55')]['id'];}return db[_0x7721('0x38')][_0x7721('0x53')]({'where':{'id':_0x3b968d[_0x7721('0x52')]['id']}})[_0x7721('0x50')](handleEntityNotFound(_0x8eca10,null))[_0x7721('0x50')](saveUpdates(_0x3b968d[_0x7721('0x55')],null))[_0x7721('0x50')](respondWithResult(_0x8eca10,null))[_0x7721('0x26')](handleError(_0x8eca10,null));};exports[_0x7721('0x32')]=function(_0x39962f,_0x2e5c28){return db[_0x7721('0x38')][_0x7721('0x53')]({'where':{'id':_0x39962f[_0x7721('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e5c28,null))['then'](removeEntity(_0x2e5c28,null))['catch'](handleError(_0x2e5c28,null));};exports[_0x7721('0x56')]=function(_0x4f2fe6,_0x4a46db,_0x57348c){var _0x5d7036={};var _0x47925a={};var _0x219181;var _0x13f254;return db['ZendeskConfiguration'][_0x7721('0x57')]({'where':{'id':_0x4f2fe6['params']['id']}})['then'](handleEntityNotFound(_0x4a46db,null))['then'](function(_0x24d1dc){if(_0x24d1dc){_0x219181=_0x24d1dc;_0x47925a['model']=_['keys'](db['ZendeskField'][_0x7721('0x39')]);_0x47925a[_0x7721('0x3e')]=_[_0x7721('0x3d')](_0x4f2fe6['query']);_0x47925a[_0x7721('0x3f')]=_[_0x7721('0x40')](_0x47925a[_0x7721('0x41')],_0x47925a[_0x7721('0x3e')]);_0x5d7036[_0x7721('0x44')]=_[_0x7721('0x40')](_0x47925a[_0x7721('0x41')],qs[_0x7721('0x42')](_0x4f2fe6[_0x7721('0x3e')][_0x7721('0x42')]));_0x5d7036[_0x7721('0x44')]=_0x5d7036[_0x7721('0x44')][_0x7721('0x43')]?_0x5d7036[_0x7721('0x44')]:_0x47925a[_0x7721('0x41')];_0x5d7036['order']=qs[_0x7721('0x46')](_0x4f2fe6[_0x7721('0x3e')][_0x7721('0x46')]);_0x5d7036[_0x7721('0x49')]=qs['filters'](_[_0x7721('0x47')](_0x4f2fe6[_0x7721('0x3e')],_0x47925a['filters']));if(_0x4f2fe6[_0x7721('0x3e')]['filter']){_0x5d7036[_0x7721('0x49')]=_[_0x7721('0x4a')](_0x5d7036[_0x7721('0x49')],{'$or':_[_0x7721('0x4b')](_0x5d7036[_0x7721('0x44')],function(_0x158aae){var _0x3121e0={};_0x3121e0[_0x158aae]={'$like':'%'+_0x4f2fe6[_0x7721('0x3e')][_0x7721('0x48')]+'%'};return _0x3121e0;})});}_0x5d7036=_['merge']({},_0x5d7036,_0x4f2fe6[_0x7721('0x4c')]);return _0x219181[_0x7721('0x56')](_0x5d7036);}})[_0x7721('0x50')](function(_0x3a11e2){if(_0x3a11e2){_0x13f254=_0x3a11e2[_0x7721('0x43')];if(!_0x4f2fe6[_0x7721('0x3e')][_0x7721('0x58')]('nolimit')){_0x5d7036[_0x7721('0x2c')]=qs[_0x7721('0x2c')](_0x4f2fe6['query'][_0x7721('0x2c')]);_0x5d7036['offset']=qs[_0x7721('0x2b')](_0x4f2fe6[_0x7721('0x3e')][_0x7721('0x2b')]);}return _0x219181[_0x7721('0x56')](_0x5d7036);}})[_0x7721('0x50')](function(_0x2bab14){if(_0x2bab14){return _0x2bab14?{'count':_0x13f254,'rows':_0x2bab14}:null;}})[_0x7721('0x50')](respondWithResult(_0x4a46db,null))['catch'](handleError(_0x4a46db,null));};exports[_0x7721('0x59')]=function(_0x1d252a,_0x280b1d,_0x5f08cc){var _0x5cef5a={};var _0x515fb9={};var _0x5d3561;var _0x5e966f;return db[_0x7721('0x38')][_0x7721('0x57')]({'where':{'id':_0x1d252a['params']['id']}})[_0x7721('0x50')](handleEntityNotFound(_0x280b1d,null))[_0x7721('0x50')](function(_0xbbc86f){if(_0xbbc86f){_0x5d3561=_0xbbc86f;_0x515fb9[_0x7721('0x41')]=_['keys'](db[_0x7721('0x5a')][_0x7721('0x39')]);_0x515fb9[_0x7721('0x3e')]=_[_0x7721('0x3d')](_0x1d252a[_0x7721('0x3e')]);_0x515fb9['filters']=_[_0x7721('0x40')](_0x515fb9[_0x7721('0x41')],_0x515fb9[_0x7721('0x3e')]);_0x5cef5a['attributes']=_['intersection'](_0x515fb9[_0x7721('0x41')],qs[_0x7721('0x42')](_0x1d252a[_0x7721('0x3e')][_0x7721('0x42')]));_0x5cef5a[_0x7721('0x44')]=_0x5cef5a['attributes']['length']?_0x5cef5a[_0x7721('0x44')]:_0x515fb9[_0x7721('0x41')];_0x5cef5a[_0x7721('0x5b')]=qs[_0x7721('0x46')](_0x1d252a[_0x7721('0x3e')][_0x7721('0x46')]);_0x5cef5a[_0x7721('0x49')]=qs['filters'](_[_0x7721('0x47')](_0x1d252a[_0x7721('0x3e')],_0x515fb9[_0x7721('0x3f')]));if(_0x1d252a['query'][_0x7721('0x48')]){_0x5cef5a[_0x7721('0x49')]=_[_0x7721('0x4a')](_0x5cef5a[_0x7721('0x49')],{'$or':_['map'](_0x5cef5a['attributes'],function(_0x37f8f8){var _0x2cac50={};_0x2cac50[_0x37f8f8]={'$like':'%'+_0x1d252a[_0x7721('0x3e')][_0x7721('0x48')]+'%'};return _0x2cac50;})});}_0x5cef5a=_[_0x7721('0x4a')]({},_0x5cef5a,_0x1d252a[_0x7721('0x4c')]);return _0x5d3561['getSubjects'](_0x5cef5a);}})[_0x7721('0x50')](function(_0x42bb5a){if(_0x42bb5a){_0x5e966f=_0x42bb5a[_0x7721('0x43')];if(!_0x1d252a['query'][_0x7721('0x58')](_0x7721('0x45'))){_0x5cef5a[_0x7721('0x2c')]=qs[_0x7721('0x2c')](_0x1d252a[_0x7721('0x3e')]['limit']);_0x5cef5a[_0x7721('0x2b')]=qs['offset'](_0x1d252a[_0x7721('0x3e')][_0x7721('0x2b')]);}return _0x5d3561[_0x7721('0x59')](_0x5cef5a);}})[_0x7721('0x50')](function(_0x963dbe){if(_0x963dbe){return _0x963dbe?{'count':_0x5e966f,'rows':_0x963dbe}:null;}})[_0x7721('0x50')](respondWithResult(_0x280b1d,null))[_0x7721('0x26')](handleError(_0x280b1d,null));};exports[_0x7721('0x5c')]=function(_0x2ec5f8,_0x3b78f5,_0x2c74d8){var _0x55d209={};var _0x19fad6={};var _0x19f451;var _0x39194e;return db['ZendeskConfiguration'][_0x7721('0x57')]({'where':{'id':_0x2ec5f8[_0x7721('0x52')]['id']}})[_0x7721('0x50')](handleEntityNotFound(_0x3b78f5,null))[_0x7721('0x50')](function(_0xcd9f0d){if(_0xcd9f0d){_0x19f451=_0xcd9f0d;_0x19fad6['model']=_[_0x7721('0x3d')](db[_0x7721('0x5a')][_0x7721('0x39')]);_0x19fad6[_0x7721('0x3e')]=_[_0x7721('0x3d')](_0x2ec5f8[_0x7721('0x3e')]);_0x19fad6['filters']=_[_0x7721('0x40')](_0x19fad6[_0x7721('0x41')],_0x19fad6['query']);_0x55d209[_0x7721('0x44')]=_['intersection'](_0x19fad6[_0x7721('0x41')],qs[_0x7721('0x42')](_0x2ec5f8['query'][_0x7721('0x42')]));_0x55d209['attributes']=_0x55d209['attributes']['length']?_0x55d209[_0x7721('0x44')]:_0x19fad6[_0x7721('0x41')];_0x55d209[_0x7721('0x5b')]=qs['sort'](_0x2ec5f8['query']['sort']);_0x55d209[_0x7721('0x49')]=qs[_0x7721('0x3f')](_[_0x7721('0x47')](_0x2ec5f8[_0x7721('0x3e')],_0x19fad6[_0x7721('0x3f')]));if(_0x2ec5f8[_0x7721('0x3e')]['filter']){_0x55d209[_0x7721('0x49')]=_[_0x7721('0x4a')](_0x55d209[_0x7721('0x49')],{'$or':_[_0x7721('0x4b')](_0x55d209[_0x7721('0x44')],function(_0x1a0232){var _0x342da2={};_0x342da2[_0x1a0232]={'$like':'%'+_0x2ec5f8[_0x7721('0x3e')][_0x7721('0x48')]+'%'};return _0x342da2;})});}_0x55d209=_[_0x7721('0x4a')]({},_0x55d209,_0x2ec5f8[_0x7721('0x4c')]);return _0x19f451[_0x7721('0x5c')](_0x55d209);}})['then'](function(_0x4bfa29){if(_0x4bfa29){_0x39194e=_0x4bfa29[_0x7721('0x43')];if(!_0x2ec5f8[_0x7721('0x3e')]['hasOwnProperty'](_0x7721('0x45'))){_0x55d209['limit']=qs['limit'](_0x2ec5f8[_0x7721('0x3e')]['limit']);_0x55d209['offset']=qs[_0x7721('0x2b')](_0x2ec5f8[_0x7721('0x3e')][_0x7721('0x2b')]);}return _0x19f451[_0x7721('0x5c')](_0x55d209);}})[_0x7721('0x50')](function(_0x494c5e){if(_0x494c5e){return _0x494c5e?{'count':_0x39194e,'rows':_0x494c5e}:null;}})[_0x7721('0x50')](respondWithResult(_0x3b78f5,null))[_0x7721('0x26')](handleError(_0x3b78f5,null));};exports[_0x7721('0x5d')]=function(_0x1d06a7,_0x4a1749,_0x52fcc1){var _0x66ec15={};var _0x1790d3={};var _0x510864;var _0x2005d1;return db[_0x7721('0x38')]['findOne']({'where':{'id':_0x1d06a7['params']['id']}})[_0x7721('0x50')](handleEntityNotFound(_0x4a1749,null))[_0x7721('0x50')](function(_0x606b4b){if(_0x606b4b){_0x510864=_0x606b4b;_0x1790d3[_0x7721('0x41')]=_[_0x7721('0x3d')](db[_0x7721('0x5e')][_0x7721('0x39')]);_0x1790d3[_0x7721('0x3e')]=_['keys'](_0x1d06a7[_0x7721('0x3e')]);_0x1790d3[_0x7721('0x3f')]=_[_0x7721('0x40')](_0x1790d3[_0x7721('0x41')],_0x1790d3[_0x7721('0x3e')]);_0x66ec15[_0x7721('0x44')]=_[_0x7721('0x40')](_0x1790d3['model'],qs[_0x7721('0x42')](_0x1d06a7[_0x7721('0x3e')]['fields']));_0x66ec15[_0x7721('0x44')]=_0x66ec15[_0x7721('0x44')][_0x7721('0x43')]?_0x66ec15[_0x7721('0x44')]:_0x1790d3[_0x7721('0x41')];_0x66ec15[_0x7721('0x5b')]=qs[_0x7721('0x46')](_0x1d06a7[_0x7721('0x3e')][_0x7721('0x46')]);_0x66ec15[_0x7721('0x49')]=qs['filters'](_[_0x7721('0x47')](_0x1d06a7[_0x7721('0x3e')],_0x1790d3[_0x7721('0x3f')]));if(_0x1d06a7[_0x7721('0x3e')][_0x7721('0x48')]){_0x66ec15[_0x7721('0x49')]=_[_0x7721('0x4a')](_0x66ec15[_0x7721('0x49')],{'$or':_[_0x7721('0x4b')](_0x66ec15[_0x7721('0x44')],function(_0x29b576){var _0x3dc348={};_0x3dc348[_0x29b576]={'$like':'%'+_0x1d06a7[_0x7721('0x3e')][_0x7721('0x48')]+'%'};return _0x3dc348;})});}_0x66ec15=_[_0x7721('0x4a')]({},_0x66ec15,_0x1d06a7[_0x7721('0x4c')]);return _0x510864[_0x7721('0x5d')](_0x66ec15);}})[_0x7721('0x50')](function(_0xfe14f3){if(_0xfe14f3){_0x2005d1=_0xfe14f3[_0x7721('0x43')];if(!_0x1d06a7['query'][_0x7721('0x58')]('nolimit')){_0x66ec15[_0x7721('0x2c')]=qs[_0x7721('0x2c')](_0x1d06a7[_0x7721('0x3e')][_0x7721('0x2c')]);_0x66ec15[_0x7721('0x2b')]=qs['offset'](_0x1d06a7['query']['offset']);}return _0x510864['getTags'](_0x66ec15);}})[_0x7721('0x50')](function(_0x17c9dd){if(_0x17c9dd){return _0x17c9dd?{'count':_0x2005d1,'rows':_0x17c9dd}:null;}})[_0x7721('0x50')](respondWithResult(_0x4a1749,null))[_0x7721('0x26')](handleError(_0x4a1749,null));};exports[_0x7721('0x5f')]=function(_0x47fa06,_0x123769,_0x501a11){if(_0x47fa06[_0x7721('0x55')]['id']){delete _0x47fa06[_0x7721('0x55')]['id'];}return db[_0x7721('0x38')][_0x7721('0x57')]({'where':{'id':_0x47fa06[_0x7721('0x52')]['id']}})[_0x7721('0x50')](handleEntityNotFound(_0x123769,null))['then'](function(_0x30ce7c){if(_0x30ce7c){return _0x30ce7c['setTags'](_0x47fa06['body'][_0x7721('0x60')]||[]);}return null;})[_0x7721('0x50')](respondWithResult(_0x123769,null))[_0x7721('0x26')](handleError(_0x123769,null));}; \ No newline at end of file +var _0xc4aa=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','reject','save','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ZendeskConfiguration','include','findAll','rows','includeAll','find','create','update','body','params','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x3540f1,_0x44e3a3){var _0x170b40=function(_0x57190f){while(--_0x57190f){_0x3540f1['push'](_0x3540f1['shift']());}};_0x170b40(++_0x44e3a3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var fs_extra=require(_0xac4a('0xb'));var _=require(_0xac4a('0xc'));var squel=require(_0xac4a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac4a('0xe'));var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xf'));var Papa=require('papaparse');var Redis=require(_0xac4a('0x10'));var authService=require(_0xac4a('0x11'));var qs=require(_0xac4a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac4a('0x13'));var logger=require('../../config/logger')(_0xac4a('0x14'));var utils=require('../../config/utils');var config=require(_0xac4a('0x15'));var licenseUtil=require(_0xac4a('0x16'));var db=require(_0xac4a('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xac4a('0x18')][_0xac4a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x247b78,_0x6e00d4,_0x1b4313,_0x3b71c0){return new BPromise(function(_0x34bc01,_0x33c287){var _0x190418=_0x3b71c0||client;return _0x190418[_0xac4a('0x1a')](_0x247b78,_0x1b4313)[_0xac4a('0x1b')](function(_0x26dbb8){logger['info'](_0xac4a('0x1c'),_0x6e00d4,_0xac4a('0x1d'));logger[_0xac4a('0x1e')](_0xac4a('0x1f'),_0x6e00d4,_0xac4a('0x1d'),JSON[_0xac4a('0x20')](_0x26dbb8));if(_0x26dbb8[_0xac4a('0x21')]){if(_0x26dbb8[_0xac4a('0x21')]['code']===0x1f4){logger['error'](_0xac4a('0x1c'),_0x6e00d4,_0x26dbb8[_0xac4a('0x21')][_0xac4a('0x22')]);return _0x33c287(_0x26dbb8['error'][_0xac4a('0x22')]);}logger[_0xac4a('0x21')](_0xac4a('0x1c'),_0x6e00d4,_0x26dbb8[_0xac4a('0x21')][_0xac4a('0x22')]);return _0x34bc01(_0x26dbb8[_0xac4a('0x21')][_0xac4a('0x22')]);}else{logger[_0xac4a('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x6e00d4,_0xac4a('0x1d'));_0x34bc01(_0x26dbb8[_0xac4a('0x24')]['message']);}})[_0xac4a('0x25')](function(_0x4169c0){logger[_0xac4a('0x21')](_0xac4a('0x1c'),_0x6e00d4,_0x4169c0);_0x33c287(_0x4169c0);});});}function respondWithStatusCode(_0x4d2d6c,_0x1b7998){_0x1b7998=_0x1b7998||0xcc;return function(_0x2503d8){if(_0x2503d8){return _0x4d2d6c[_0xac4a('0x26')](_0x1b7998);}return _0x4d2d6c[_0xac4a('0x27')](_0x1b7998)[_0xac4a('0x28')]();};}function respondWithResult(_0x2b0dc2,_0x222507){_0x222507=_0x222507||0xc8;return function(_0x36054a){if(_0x36054a){return _0x2b0dc2[_0xac4a('0x27')](_0x222507)[_0xac4a('0x29')](_0x36054a);}};}function respondWithFilteredResult(_0x1d0539,_0x215a31){return function(_0x14832b){if(_0x14832b){var _0x472c57=_0x14832b[_0xac4a('0x2a')],_0x1c13dc=_0x215a31[_0xac4a('0x2b')],_0x20202c=_0x215a31[_0xac4a('0x2b')]+_0x215a31[_0xac4a('0x2c')],_0x4e17ce;if(_0x20202c>=_0x472c57){_0x20202c=_0x472c57;_0x4e17ce=0xc8;}else{_0x4e17ce=0xce;}_0x1d0539[_0xac4a('0x27')](_0x4e17ce);return _0x1d0539['set']('Content-Range',_0x1c13dc+'-'+_0x20202c+'/'+_0x472c57)[_0xac4a('0x29')](_0x14832b);}return null;};}function patchUpdates(_0x7a948b){return function(_0x1f12d5){try{jsonpatch['apply'](_0x1f12d5,_0x7a948b,!![]);}catch(_0x4bda1f){return BPromise[_0xac4a('0x2d')](_0x4bda1f);}return _0x1f12d5[_0xac4a('0x2e')]();};}function saveUpdates(_0x228629,_0x432066){return function(_0x17118e){if(_0x17118e){return _0x17118e['update'](_0x228629)[_0xac4a('0x1b')](function(_0x482afc){return _0x482afc;});}return null;};}function removeEntity(_0x30364b,_0x57adcf){return function(_0x17e6de){if(_0x17e6de){return _0x17e6de[_0xac4a('0x2f')]()[_0xac4a('0x1b')](function(){_0x30364b[_0xac4a('0x27')](0xcc)[_0xac4a('0x28')]();});}};}function handleEntityNotFound(_0x61e552,_0xbd4591){return function(_0x1f13f3){if(!_0x1f13f3){_0x61e552[_0xac4a('0x26')](0x194);}return _0x1f13f3;};}function handleError(_0xfd7c16,_0x36ab49){_0x36ab49=_0x36ab49||0x1f4;return function(_0x1634df){logger[_0xac4a('0x21')](_0x1634df[_0xac4a('0x30')]);if(_0x1634df['name']){delete _0x1634df[_0xac4a('0x31')];}_0xfd7c16[_0xac4a('0x27')](_0x36ab49)['send'](_0x1634df);};}exports[_0xac4a('0x32')]=function(_0x1af1c1,_0x565164){var _0x58804b={},_0x11f0be={},_0x1ba096={'count':0x0,'rows':[]};var _0x1b42b6=_[_0xac4a('0x33')](db['ZendeskConfiguration'][_0xac4a('0x34')],function(_0x2e56c6){return{'name':_0x2e56c6['fieldName'],'type':_0x2e56c6[_0xac4a('0x35')][_0xac4a('0x36')]};});_0x11f0be[_0xac4a('0x37')]=_['map'](_0x1b42b6,_0xac4a('0x31'));_0x11f0be[_0xac4a('0x38')]=_[_0xac4a('0x39')](_0x1af1c1['query']);_0x11f0be[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x11f0be['model'],_0x11f0be['query']);_0x58804b[_0xac4a('0x3c')]=_['intersection'](_0x11f0be['model'],qs['fields'](_0x1af1c1['query'][_0xac4a('0x3d')]));_0x58804b[_0xac4a('0x3c')]=_0x58804b[_0xac4a('0x3c')][_0xac4a('0x3e')]?_0x58804b[_0xac4a('0x3c')]:_0x11f0be[_0xac4a('0x37')];if(!_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x3f')](_0xac4a('0x40'))){_0x58804b[_0xac4a('0x2c')]=qs[_0xac4a('0x2c')](_0x1af1c1[_0xac4a('0x38')]['limit']);_0x58804b['offset']=qs['offset'](_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x2b')]);}_0x58804b[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x42')]);_0x58804b[_0xac4a('0x43')]=qs[_0xac4a('0x3a')](_[_0xac4a('0x44')](_0x1af1c1[_0xac4a('0x38')],_0x11f0be['filters']),_0x1b42b6);if(_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x45')]){_0x58804b[_0xac4a('0x43')]=_[_0xac4a('0x46')](_0x58804b[_0xac4a('0x43')],{'$or':_['map'](_0x1b42b6,function(_0x8700b4){if(_0x8700b4[_0xac4a('0x35')]!=='VIRTUAL'){var _0x3c912d={};_0x3c912d[_0x8700b4['name']]={'$like':'%'+_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x45')]+'%'};return _0x3c912d;}})});}_0x58804b=_[_0xac4a('0x46')]({},_0x58804b,_0x1af1c1[_0xac4a('0x47')]);var _0x520e4a={'where':_0x58804b[_0xac4a('0x43')]};return db[_0xac4a('0x48')][_0xac4a('0x2a')](_0x520e4a)[_0xac4a('0x1b')](function(_0xcb002b){_0x1ba096[_0xac4a('0x2a')]=_0xcb002b;if(_0x1af1c1[_0xac4a('0x38')]['includeAll']){_0x58804b[_0xac4a('0x49')]=[{'all':!![]}];}return db[_0xac4a('0x48')][_0xac4a('0x4a')](_0x58804b);})['then'](function(_0x1764bf){_0x1ba096[_0xac4a('0x4b')]=_0x1764bf;return _0x1ba096;})['then'](respondWithFilteredResult(_0x565164,_0x58804b))[_0xac4a('0x25')](handleError(_0x565164,null));};exports['show']=function(_0x244950,_0xe620f6){var _0x136a65={'raw':![],'where':{'id':_0x244950['params']['id']}},_0x5e3581={};_0x5e3581[_0xac4a('0x37')]=_['keys'](db[_0xac4a('0x48')]['rawAttributes']);_0x5e3581[_0xac4a('0x38')]=_['keys'](_0x244950[_0xac4a('0x38')]);_0x5e3581[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x5e3581[_0xac4a('0x37')],_0x5e3581['query']);_0x136a65[_0xac4a('0x3c')]=_[_0xac4a('0x3b')](_0x5e3581[_0xac4a('0x37')],qs[_0xac4a('0x3d')](_0x244950[_0xac4a('0x38')][_0xac4a('0x3d')]));_0x136a65[_0xac4a('0x3c')]=_0x136a65['attributes'][_0xac4a('0x3e')]?_0x136a65[_0xac4a('0x3c')]:_0x5e3581['model'];if(_0x244950[_0xac4a('0x38')][_0xac4a('0x4c')]){_0x136a65[_0xac4a('0x49')]=[{'all':!![]}];}_0x136a65=_[_0xac4a('0x46')]({},_0x136a65,_0x244950['options']);return db[_0xac4a('0x48')][_0xac4a('0x4d')](_0x136a65)[_0xac4a('0x1b')](handleEntityNotFound(_0xe620f6,null))[_0xac4a('0x1b')](respondWithResult(_0xe620f6,null))[_0xac4a('0x25')](handleError(_0xe620f6,null));};exports['create']=function(_0x179373,_0x564b10){return db[_0xac4a('0x48')][_0xac4a('0x4e')](_0x179373['body'],{})['then'](respondWithResult(_0x564b10,0xc9))[_0xac4a('0x25')](handleError(_0x564b10,null));};exports[_0xac4a('0x4f')]=function(_0x4d448f,_0x18d29c){if(_0x4d448f[_0xac4a('0x50')]['id']){delete _0x4d448f[_0xac4a('0x50')]['id'];}return db[_0xac4a('0x48')]['find']({'where':{'id':_0x4d448f[_0xac4a('0x51')]['id']}})[_0xac4a('0x1b')](handleEntityNotFound(_0x18d29c,null))[_0xac4a('0x1b')](saveUpdates(_0x4d448f[_0xac4a('0x50')],null))[_0xac4a('0x1b')](respondWithResult(_0x18d29c,null))[_0xac4a('0x25')](handleError(_0x18d29c,null));};exports[_0xac4a('0x2f')]=function(_0x487a44,_0x39123d){return db[_0xac4a('0x48')][_0xac4a('0x4d')]({'where':{'id':_0x487a44[_0xac4a('0x51')]['id']}})[_0xac4a('0x1b')](handleEntityNotFound(_0x39123d,null))[_0xac4a('0x1b')](removeEntity(_0x39123d,null))[_0xac4a('0x25')](handleError(_0x39123d,null));};exports[_0xac4a('0x52')]=function(_0x159e43,_0x786d9,_0x3b175a){var _0x38dd4f={};var _0x400ac4={};var _0x2fe7df;var _0x5222f3;return db[_0xac4a('0x48')]['findOne']({'where':{'id':_0x159e43[_0xac4a('0x51')]['id']}})['then'](handleEntityNotFound(_0x786d9,null))[_0xac4a('0x1b')](function(_0x4b7f79){if(_0x4b7f79){_0x2fe7df=_0x4b7f79;_0x400ac4[_0xac4a('0x37')]=_['keys'](db[_0xac4a('0x53')]['rawAttributes']);_0x400ac4['query']=_[_0xac4a('0x39')](_0x159e43[_0xac4a('0x38')]);_0x400ac4[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x400ac4[_0xac4a('0x37')],_0x400ac4[_0xac4a('0x38')]);_0x38dd4f['attributes']=_[_0xac4a('0x3b')](_0x400ac4['model'],qs[_0xac4a('0x3d')](_0x159e43['query'][_0xac4a('0x3d')]));_0x38dd4f[_0xac4a('0x3c')]=_0x38dd4f[_0xac4a('0x3c')][_0xac4a('0x3e')]?_0x38dd4f[_0xac4a('0x3c')]:_0x400ac4[_0xac4a('0x37')];_0x38dd4f[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_0x159e43[_0xac4a('0x38')][_0xac4a('0x42')]);_0x38dd4f[_0xac4a('0x43')]=qs[_0xac4a('0x3a')](_[_0xac4a('0x44')](_0x159e43[_0xac4a('0x38')],_0x400ac4[_0xac4a('0x3a')]));if(_0x159e43[_0xac4a('0x38')][_0xac4a('0x45')]){_0x38dd4f['where']=_[_0xac4a('0x46')](_0x38dd4f[_0xac4a('0x43')],{'$or':_['map'](_0x38dd4f[_0xac4a('0x3c')],function(_0x34bd1c){var _0x2d24c7={};_0x2d24c7[_0x34bd1c]={'$like':'%'+_0x159e43[_0xac4a('0x38')][_0xac4a('0x45')]+'%'};return _0x2d24c7;})});}_0x38dd4f=_['merge']({},_0x38dd4f,_0x159e43['options']);return _0x2fe7df[_0xac4a('0x52')](_0x38dd4f);}})[_0xac4a('0x1b')](function(_0x158223){if(_0x158223){_0x5222f3=_0x158223[_0xac4a('0x3e')];if(!_0x159e43[_0xac4a('0x38')][_0xac4a('0x3f')](_0xac4a('0x40'))){_0x38dd4f[_0xac4a('0x2c')]=qs[_0xac4a('0x2c')](_0x159e43[_0xac4a('0x38')][_0xac4a('0x2c')]);_0x38dd4f['offset']=qs['offset'](_0x159e43[_0xac4a('0x38')][_0xac4a('0x2b')]);}return _0x2fe7df[_0xac4a('0x52')](_0x38dd4f);}})[_0xac4a('0x1b')](function(_0x663a97){if(_0x663a97){return _0x663a97?{'count':_0x5222f3,'rows':_0x663a97}:null;}})[_0xac4a('0x1b')](respondWithResult(_0x786d9,null))[_0xac4a('0x25')](handleError(_0x786d9,null));};exports[_0xac4a('0x54')]=function(_0x453d62,_0x2a5acc,_0xb09b89){var _0xb12cc5={};var _0x5f0173={};var _0x13c854;var _0xc74ce8;return db[_0xac4a('0x48')][_0xac4a('0x55')]({'where':{'id':_0x453d62['params']['id']}})[_0xac4a('0x1b')](handleEntityNotFound(_0x2a5acc,null))['then'](function(_0xab4305){if(_0xab4305){_0x13c854=_0xab4305;_0x5f0173[_0xac4a('0x37')]=_['keys'](db['ZendeskField'][_0xac4a('0x34')]);_0x5f0173[_0xac4a('0x38')]=_[_0xac4a('0x39')](_0x453d62['query']);_0x5f0173[_0xac4a('0x3a')]=_['intersection'](_0x5f0173[_0xac4a('0x37')],_0x5f0173['query']);_0xb12cc5['attributes']=_[_0xac4a('0x3b')](_0x5f0173['model'],qs[_0xac4a('0x3d')](_0x453d62['query'][_0xac4a('0x3d')]));_0xb12cc5[_0xac4a('0x3c')]=_0xb12cc5['attributes'][_0xac4a('0x3e')]?_0xb12cc5['attributes']:_0x5f0173[_0xac4a('0x37')];_0xb12cc5[_0xac4a('0x41')]=qs['sort'](_0x453d62[_0xac4a('0x38')]['sort']);_0xb12cc5['where']=qs[_0xac4a('0x3a')](_['pick'](_0x453d62[_0xac4a('0x38')],_0x5f0173['filters']));if(_0x453d62['query'][_0xac4a('0x45')]){_0xb12cc5[_0xac4a('0x43')]=_[_0xac4a('0x46')](_0xb12cc5['where'],{'$or':_['map'](_0xb12cc5[_0xac4a('0x3c')],function(_0x9c0fa1){var _0x5ac8cc={};_0x5ac8cc[_0x9c0fa1]={'$like':'%'+_0x453d62['query'][_0xac4a('0x45')]+'%'};return _0x5ac8cc;})});}_0xb12cc5=_[_0xac4a('0x46')]({},_0xb12cc5,_0x453d62[_0xac4a('0x47')]);return _0x13c854[_0xac4a('0x54')](_0xb12cc5);}})[_0xac4a('0x1b')](function(_0x38ac74){if(_0x38ac74){_0xc74ce8=_0x38ac74[_0xac4a('0x3e')];if(!_0x453d62[_0xac4a('0x38')][_0xac4a('0x3f')]('nolimit')){_0xb12cc5[_0xac4a('0x2c')]=qs[_0xac4a('0x2c')](_0x453d62[_0xac4a('0x38')]['limit']);_0xb12cc5[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x453d62[_0xac4a('0x38')][_0xac4a('0x2b')]);}return _0x13c854[_0xac4a('0x54')](_0xb12cc5);}})['then'](function(_0x290a73){if(_0x290a73){return _0x290a73?{'count':_0xc74ce8,'rows':_0x290a73}:null;}})[_0xac4a('0x1b')](respondWithResult(_0x2a5acc,null))[_0xac4a('0x25')](handleError(_0x2a5acc,null));};exports[_0xac4a('0x56')]=function(_0x72c90c,_0x451248,_0xd7bdd6){var _0x5b9e82={};var _0x2e3bb7={};var _0x2be178;var _0x19bd6f;return db[_0xac4a('0x48')][_0xac4a('0x55')]({'where':{'id':_0x72c90c[_0xac4a('0x51')]['id']}})['then'](handleEntityNotFound(_0x451248,null))[_0xac4a('0x1b')](function(_0x29c772){if(_0x29c772){_0x2be178=_0x29c772;_0x2e3bb7[_0xac4a('0x37')]=_[_0xac4a('0x39')](db['ZendeskField'][_0xac4a('0x34')]);_0x2e3bb7['query']=_[_0xac4a('0x39')](_0x72c90c[_0xac4a('0x38')]);_0x2e3bb7['filters']=_['intersection'](_0x2e3bb7[_0xac4a('0x37')],_0x2e3bb7[_0xac4a('0x38')]);_0x5b9e82[_0xac4a('0x3c')]=_['intersection'](_0x2e3bb7[_0xac4a('0x37')],qs['fields'](_0x72c90c[_0xac4a('0x38')][_0xac4a('0x3d')]));_0x5b9e82[_0xac4a('0x3c')]=_0x5b9e82[_0xac4a('0x3c')][_0xac4a('0x3e')]?_0x5b9e82['attributes']:_0x2e3bb7['model'];_0x5b9e82[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_0x72c90c[_0xac4a('0x38')][_0xac4a('0x42')]);_0x5b9e82[_0xac4a('0x43')]=qs[_0xac4a('0x3a')](_[_0xac4a('0x44')](_0x72c90c[_0xac4a('0x38')],_0x2e3bb7['filters']));if(_0x72c90c['query'][_0xac4a('0x45')]){_0x5b9e82[_0xac4a('0x43')]=_[_0xac4a('0x46')](_0x5b9e82[_0xac4a('0x43')],{'$or':_[_0xac4a('0x33')](_0x5b9e82[_0xac4a('0x3c')],function(_0xdaa2ef){var _0x2e704b={};_0x2e704b[_0xdaa2ef]={'$like':'%'+_0x72c90c['query']['filter']+'%'};return _0x2e704b;})});}_0x5b9e82=_[_0xac4a('0x46')]({},_0x5b9e82,_0x72c90c[_0xac4a('0x47')]);return _0x2be178[_0xac4a('0x56')](_0x5b9e82);}})[_0xac4a('0x1b')](function(_0x3030cf){if(_0x3030cf){_0x19bd6f=_0x3030cf[_0xac4a('0x3e')];if(!_0x72c90c[_0xac4a('0x38')]['hasOwnProperty'](_0xac4a('0x40'))){_0x5b9e82[_0xac4a('0x2c')]=qs[_0xac4a('0x2c')](_0x72c90c['query'][_0xac4a('0x2c')]);_0x5b9e82[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x72c90c[_0xac4a('0x38')][_0xac4a('0x2b')]);}return _0x2be178[_0xac4a('0x56')](_0x5b9e82);}})[_0xac4a('0x1b')](function(_0x2ef42a){if(_0x2ef42a){return _0x2ef42a?{'count':_0x19bd6f,'rows':_0x2ef42a}:null;}})[_0xac4a('0x1b')](respondWithResult(_0x451248,null))['catch'](handleError(_0x451248,null));};exports[_0xac4a('0x57')]=function(_0x50f71c,_0x203321,_0x1199f6){var _0x3184b3={};var _0x166cd9={};var _0x840fec;var _0x337da7;return db[_0xac4a('0x48')]['findOne']({'where':{'id':_0x50f71c[_0xac4a('0x51')]['id']}})[_0xac4a('0x1b')](handleEntityNotFound(_0x203321,null))[_0xac4a('0x1b')](function(_0x3315e7){if(_0x3315e7){_0x840fec=_0x3315e7;_0x166cd9[_0xac4a('0x37')]=_['keys'](db[_0xac4a('0x58')][_0xac4a('0x34')]);_0x166cd9['query']=_['keys'](_0x50f71c[_0xac4a('0x38')]);_0x166cd9[_0xac4a('0x3a')]=_['intersection'](_0x166cd9[_0xac4a('0x37')],_0x166cd9[_0xac4a('0x38')]);_0x3184b3[_0xac4a('0x3c')]=_[_0xac4a('0x3b')](_0x166cd9[_0xac4a('0x37')],qs[_0xac4a('0x3d')](_0x50f71c['query'][_0xac4a('0x3d')]));_0x3184b3[_0xac4a('0x3c')]=_0x3184b3[_0xac4a('0x3c')]['length']?_0x3184b3[_0xac4a('0x3c')]:_0x166cd9[_0xac4a('0x37')];_0x3184b3[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_0x50f71c[_0xac4a('0x38')][_0xac4a('0x42')]);_0x3184b3['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x44')](_0x50f71c['query'],_0x166cd9[_0xac4a('0x3a')]));if(_0x50f71c['query'][_0xac4a('0x45')]){_0x3184b3[_0xac4a('0x43')]=_['merge'](_0x3184b3[_0xac4a('0x43')],{'$or':_['map'](_0x3184b3[_0xac4a('0x3c')],function(_0x4e6612){var _0x3c601e={};_0x3c601e[_0x4e6612]={'$like':'%'+_0x50f71c[_0xac4a('0x38')][_0xac4a('0x45')]+'%'};return _0x3c601e;})});}_0x3184b3=_[_0xac4a('0x46')]({},_0x3184b3,_0x50f71c[_0xac4a('0x47')]);return _0x840fec[_0xac4a('0x57')](_0x3184b3);}})[_0xac4a('0x1b')](function(_0x2a508c){if(_0x2a508c){_0x337da7=_0x2a508c[_0xac4a('0x3e')];if(!_0x50f71c[_0xac4a('0x38')][_0xac4a('0x3f')](_0xac4a('0x40'))){_0x3184b3[_0xac4a('0x2c')]=qs[_0xac4a('0x2c')](_0x50f71c['query'][_0xac4a('0x2c')]);_0x3184b3[_0xac4a('0x2b')]=qs['offset'](_0x50f71c[_0xac4a('0x38')][_0xac4a('0x2b')]);}return _0x840fec[_0xac4a('0x57')](_0x3184b3);}})[_0xac4a('0x1b')](function(_0x3fea6e){if(_0x3fea6e){return _0x3fea6e?{'count':_0x337da7,'rows':_0x3fea6e}:null;}})['then'](respondWithResult(_0x203321,null))[_0xac4a('0x25')](handleError(_0x203321,null));};exports['setTags']=function(_0x46d3d9,_0x28ae76,_0x240ff1){if(_0x46d3d9[_0xac4a('0x50')]['id']){delete _0x46d3d9['body']['id'];}return db[_0xac4a('0x48')]['findOne']({'where':{'id':_0x46d3d9[_0xac4a('0x51')]['id']}})[_0xac4a('0x1b')](handleEntityNotFound(_0x28ae76,null))[_0xac4a('0x1b')](function(_0x5b45d9){if(_0x5b45d9){return _0x5b45d9[_0xac4a('0x59')](_0x46d3d9[_0xac4a('0x50')][_0xac4a('0x5a')]||[]);}return null;})['then'](respondWithResult(_0x28ae76,null))[_0xac4a('0x25')](handleError(_0x28ae76,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 000c3f0..9d15b28 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 _0xf5d1=['moment','bluebird','request-promise','rimraf','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0x2f356f,_0x97aec6){var _0x4a9db4=function(_0x34c433){while(--_0x34c433){_0x2f356f['push'](_0x2f356f['shift']());}};_0x4a9db4(++_0x97aec6);}(_0xf5d1,0x194));var _0x1f5d=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xf5d1[_0x52b7b9];return _0x5b5d30;};'use strict';var _=require(_0x1f5d('0x0'));var util=require(_0x1f5d('0x1'));var logger=require(_0x1f5d('0x2'))(_0x1f5d('0x3'));var moment=require(_0x1f5d('0x4'));var BPromise=require(_0x1f5d('0x5'));var rp=require(_0x1f5d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f5d('0x7'));var config=require('../../config/environment');var attributes=require(_0x1f5d('0x8'));module[_0x1f5d('0x9')]=function(_0x34fe60,_0x5b5d08){return _0x34fe60[_0x1f5d('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x1f5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa825=['../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x46bec2,_0x36cde0){var _0x39b857=function(_0xf29a34){while(--_0xf29a34){_0x46bec2['push'](_0x46bec2['shift']());}};_0x39b857(++_0x36cde0);}(_0xa825,0x68));var _0x5a82=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa825[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5a82('0x0'));var logger=require(_0x5a82('0x1'))(_0x5a82('0x2'));var moment=require('moment');var BPromise=require(_0x5a82('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a82('0x4'));var rimraf=require(_0x5a82('0x5'));var config=require(_0x5a82('0x6'));var attributes=require(_0x5a82('0x7'));module[_0x5a82('0x8')]=function(_0x528dba,_0x1570a3){return _0x528dba['define'](_0x5a82('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index bb2eadb..2593976 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 _0x08d3=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x359e8b,_0xa3b580){var _0x1c5b96=function(_0x359fb7){while(--_0x359fb7){_0x359e8b['push'](_0x359e8b['shift']());}};_0x1c5b96(++_0xa3b580);}(_0x08d3,0xcc));var _0x308d=function(_0x16ad8e,_0x3f3157){_0x16ad8e=_0x16ad8e-0x0;var _0x19e58e=_0x08d3[_0x16ad8e];return _0x19e58e;};'use strict';var _=require(_0x308d('0x0'));var util=require(_0x308d('0x1'));var moment=require(_0x308d('0x2'));var BPromise=require(_0x308d('0x3'));var rs=require(_0x308d('0x4'));var fs=require('fs');var Redis=require(_0x308d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x308d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x308d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x308d('0x8')][_0x308d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x395062,_0x4db075,_0x2791ad){return new BPromise(function(_0x4e905b,_0x5612a4){return client['request'](_0x395062,_0x2791ad)[_0x308d('0xa')](function(_0x36ca5a){logger[_0x308d('0xb')](_0x308d('0xc'),_0x4db075,_0x308d('0xd'));logger[_0x308d('0xe')](_0x308d('0xf'),_0x4db075,_0x308d('0xd'),JSON['stringify'](_0x36ca5a));if(_0x36ca5a[_0x308d('0x10')]){if(_0x36ca5a[_0x308d('0x10')][_0x308d('0x11')]===0x1f4){logger[_0x308d('0x10')](_0x308d('0xc'),_0x4db075,_0x36ca5a[_0x308d('0x10')][_0x308d('0x12')]);return _0x5612a4(_0x36ca5a['error'][_0x308d('0x12')]);}logger[_0x308d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4db075,_0x36ca5a[_0x308d('0x10')]['message']);return _0x4e905b(_0x36ca5a[_0x308d('0x10')][_0x308d('0x12')]);}else{logger[_0x308d('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4db075,'request\x20sent');_0x4e905b(_0x36ca5a[_0x308d('0x13')][_0x308d('0x12')]);}})['catch'](function(_0x11c5ac){logger[_0x308d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4db075,_0x11c5ac);_0x5612a4(_0x11c5ac);});});} \ No newline at end of file +var _0xed30=['rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3c2f91,_0x15df4c){var _0x54783b=function(_0x59d2a8){while(--_0x59d2a8){_0x3c2f91['push'](_0x3c2f91['shift']());}};_0x54783b(++_0x15df4c);}(_0xed30,0x79));var _0x0ed3=function(_0x341dc7,_0xbeb816){_0x341dc7=_0x341dc7-0x0;var _0x1d37d9=_0xed30[_0x341dc7];return _0x1d37d9;};'use strict';var _=require('lodash');var util=require(_0x0ed3('0x0'));var moment=require(_0x0ed3('0x1'));var BPromise=require(_0x0ed3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ed3('0x3'))['db'];var utils=require(_0x0ed3('0x4'));var logger=require('../../config/logger')(_0x0ed3('0x5'));var config=require('../../config/environment');var jayson=require(_0x0ed3('0x6'));var client=jayson[_0x0ed3('0x7')][_0x0ed3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ff60d,_0x133301,_0x2aa850){return new BPromise(function(_0x115b31,_0x5641d7){return client[_0x0ed3('0x9')](_0x4ff60d,_0x2aa850)[_0x0ed3('0xa')](function(_0x53490f){logger[_0x0ed3('0xb')](_0x0ed3('0xc'),_0x133301,_0x0ed3('0xd'));logger[_0x0ed3('0xe')](_0x0ed3('0xf'),_0x133301,_0x0ed3('0xd'),JSON['stringify'](_0x53490f));if(_0x53490f['error']){if(_0x53490f[_0x0ed3('0x10')][_0x0ed3('0x11')]===0x1f4){logger[_0x0ed3('0x10')](_0x0ed3('0xc'),_0x133301,_0x53490f[_0x0ed3('0x10')][_0x0ed3('0x12')]);return _0x5641d7(_0x53490f[_0x0ed3('0x10')][_0x0ed3('0x12')]);}logger[_0x0ed3('0x10')](_0x0ed3('0xc'),_0x133301,_0x53490f[_0x0ed3('0x10')][_0x0ed3('0x12')]);return _0x115b31(_0x53490f[_0x0ed3('0x10')][_0x0ed3('0x12')]);}else{logger[_0x0ed3('0xb')](_0x0ed3('0xc'),_0x133301,_0x0ed3('0xd'));_0x115b31(_0x53490f[_0x0ed3('0x13')][_0x0ed3('0x12')]);}})[_0x0ed3('0x14')](function(_0x1b867c){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x133301,_0x1b867c);_0x5641d7(_0x1b867c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f28b010..385eb2d 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 _0x6fdd=['index','get','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x34b4a9,_0xffe471){var _0x215fda=function(_0x4b5189){while(--_0x4b5189){_0x34b4a9['push'](_0x34b4a9['shift']());}};_0x215fda(++_0xffe471);}(_0x6fdd,0x171));var _0xd6fd=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6fdd[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xd6fd('0x0'));var util=require(_0xd6fd('0x1'));var path=require(_0xd6fd('0x2'));var timeout=require(_0xd6fd('0x3'));var express=require(_0xd6fd('0x4'));var router=express[_0xd6fd('0x5')]();var fs_extra=require(_0xd6fd('0x6'));var auth=require(_0xd6fd('0x7'));var interaction=require(_0xd6fd('0x8'));var config=require(_0xd6fd('0x9'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xd6fd('0xa')](),controller[_0xd6fd('0xb')]);router[_0xd6fd('0xc')](_0xd6fd('0xd'),auth['isAuthenticated'](),controller[_0xd6fd('0xe')]);router['post']('/',auth[_0xd6fd('0xa')](),controller['create']);router[_0xd6fd('0xf')]('/:id',auth[_0xd6fd('0xa')](),controller[_0xd6fd('0x10')]);router[_0xd6fd('0x11')](_0xd6fd('0xd'),auth[_0xd6fd('0xa')](),controller[_0xd6fd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf0c1=['show','post','create','put','/:id','update','delete','multer','util','express','fs-extra','../../components/auth/service','./intZendeskField.controller','isAuthenticated','index','get'];(function(_0x2daebd,_0x3b5499){var _0x418624=function(_0x18c077){while(--_0x18c077){_0x2daebd['push'](_0x2daebd['shift']());}};_0x418624(++_0x3b5499);}(_0xf0c1,0x167));var _0x1f0c=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf0c1[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x1f0c('0x0'));var util=require(_0x1f0c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1f0c('0x2'));var router=express['Router']();var fs_extra=require(_0x1f0c('0x3'));var auth=require(_0x1f0c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1f0c('0x5'));router['get']('/',auth[_0x1f0c('0x6')](),controller[_0x1f0c('0x7')]);router[_0x1f0c('0x8')]('/:id',auth[_0x1f0c('0x6')](),controller[_0x1f0c('0x9')]);router[_0x1f0c('0xa')]('/',auth[_0x1f0c('0x6')](),controller[_0x1f0c('0xb')]);router[_0x1f0c('0xc')](_0x1f0c('0xd'),auth[_0x1f0c('0x6')](),controller[_0x1f0c('0xe')]);router[_0x1f0c('0xf')](_0x1f0c('0xd'),auth[_0x1f0c('0x6')](),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 54fdf1e..ed0c6df 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 _0x3140=['picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue'];(function(_0x44960d,_0x27ab5f){var _0x370dbf=function(_0x1a8098){while(--_0x1a8098){_0x44960d['push'](_0x44960d['shift']());}};_0x370dbf(++_0x27ab5f);}(_0x3140,0xaf));var _0x0314=function(_0x16eb19,_0x58cea4){_0x16eb19=_0x16eb19-0x0;var _0x312a25=_0x3140[_0x16eb19];return _0x312a25;};'use strict';var Sequelize=require(_0x0314('0x0'));module[_0x0314('0x1')]={'type':{'type':Sequelize[_0x0314('0x2')](_0x0314('0x3'),'variable','customVariable',_0x0314('0x4'),_0x0314('0x5')),'defaultValue':_0x0314('0x3')},'content':{'type':Sequelize[_0x0314('0x6')]},'key':{'type':Sequelize[_0x0314('0x6')]},'keyType':{'type':Sequelize[_0x0314('0x2')](_0x0314('0x3'),_0x0314('0x7'),_0x0314('0x8'))},'keyContent':{'type':Sequelize[_0x0314('0x6')]},'idField':{'type':Sequelize[_0x0314('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0314('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0314('0x6')]}}; \ No newline at end of file +var _0xb6b1=['STRING','string','BOOLEAN','sequelize','ENUM','variable','customVariable','picklist'];(function(_0x65b8ec,_0x213a66){var _0x471f16=function(_0x4f6379){while(--_0x4f6379){_0x65b8ec['push'](_0x65b8ec['shift']());}};_0x471f16(++_0x213a66);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xb6b1[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0x1b6b('0x0'));module['exports']={'type':{'type':Sequelize[_0x1b6b('0x1')]('string',_0x1b6b('0x2'),_0x1b6b('0x3'),'keyValue',_0x1b6b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1b6b('0x5')]},'key':{'type':Sequelize[_0x1b6b('0x5')]},'keyType':{'type':Sequelize[_0x1b6b('0x1')](_0x1b6b('0x6'),'variable',_0x1b6b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1b6b('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1b6b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b6b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6a6710c..1983a93 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 _0xd323=['findAll','catch','show','params','include','create','body','find','destroy','eml-format','rimraf','request-promise','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','save','update','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x493dda,_0x1528d3){var _0x31a5a6=function(_0x43c676){while(--_0x43c676){_0x493dda['push'](_0x493dda['shift']());}};_0x31a5a6(++_0x1528d3);}(_0xd323,0xd5));var _0x3d32=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd323[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3d32('0x0'));var rimraf=require(_0x3d32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3d32('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3d32('0x3'));var path=require(_0x3d32('0x4'));var sox=require(_0x3d32('0x5'));var csv=require(_0x3d32('0x6'));var ejs=require(_0x3d32('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d32('0x8'));var squel=require(_0x3d32('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d32('0xa'));var toCsv=require(_0x3d32('0x6'));var querystring=require(_0x3d32('0xb'));var Papa=require('papaparse');var Redis=require(_0x3d32('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3d32('0xd'));var as=require(_0x3d32('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d32('0xf'));var utils=require(_0x3d32('0x10'));var config=require(_0x3d32('0x11'));var licenseUtil=require(_0x3d32('0x12'));var db=require(_0x3d32('0x13'))['db'];function respondWithStatusCode(_0x420009,_0x59e569){_0x59e569=_0x59e569||0xcc;return function(_0x25b7a6){if(_0x25b7a6){return _0x420009['sendStatus'](_0x59e569);}return _0x420009[_0x3d32('0x14')](_0x59e569)[_0x3d32('0x15')]();};}function respondWithResult(_0x518f23,_0x351a9c){_0x351a9c=_0x351a9c||0xc8;return function(_0xbcde04){if(_0xbcde04){return _0x518f23[_0x3d32('0x14')](_0x351a9c)['json'](_0xbcde04);}};}function respondWithFilteredResult(_0x34df6f,_0x3a2e10){return function(_0x32c2f2){if(_0x32c2f2){var _0x2fb040=_0x32c2f2[_0x3d32('0x16')],_0x2fd03e=_0x3a2e10[_0x3d32('0x17')],_0x15bbce=_0x3a2e10[_0x3d32('0x17')]+_0x3a2e10[_0x3d32('0x18')],_0x1a4354;if(_0x15bbce>=_0x2fb040){_0x15bbce=_0x2fb040;_0x1a4354=0xc8;}else{_0x1a4354=0xce;}_0x34df6f[_0x3d32('0x14')](_0x1a4354);return _0x34df6f[_0x3d32('0x19')](_0x3d32('0x1a'),_0x2fd03e+'-'+_0x15bbce+'/'+_0x2fb040)[_0x3d32('0x1b')](_0x32c2f2);}return null;};}function patchUpdates(_0x26aee6){return function(_0x5f3518){try{jsonpatch['apply'](_0x5f3518,_0x26aee6,!![]);}catch(_0x784a7b){return BPromise['reject'](_0x784a7b);}return _0x5f3518[_0x3d32('0x1c')]();};}function saveUpdates(_0x64bb2c,_0x48bc97){return function(_0xad1aa7){if(_0xad1aa7){return _0xad1aa7[_0x3d32('0x1d')](_0x64bb2c)[_0x3d32('0x1e')](function(_0x2e67e8){return _0x2e67e8;});}return null;};}function removeEntity(_0x48c3d6,_0x5d90f9){return function(_0x520dff){if(_0x520dff){return _0x520dff['destroy']()['then'](function(){_0x48c3d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3148c3,_0xfc824f){return function(_0x2468be){if(!_0x2468be){_0x3148c3['sendStatus'](0x194);}return _0x2468be;};}function handleError(_0x359b4c,_0x3ada72){_0x3ada72=_0x3ada72||0x1f4;return function(_0x59edb4){logger[_0x3d32('0x1f')](_0x59edb4[_0x3d32('0x20')]);if(_0x59edb4[_0x3d32('0x21')]){delete _0x59edb4[_0x3d32('0x21')];}_0x359b4c[_0x3d32('0x14')](_0x3ada72)[_0x3d32('0x22')](_0x59edb4);};}exports[_0x3d32('0x23')]=function(_0x1dc076,_0x1a021f){var _0x803a36={},_0x1e0c84={},_0x508584={'count':0x0,'rows':[]};var _0x5c634a=_[_0x3d32('0x24')](db[_0x3d32('0x25')][_0x3d32('0x26')],function(_0x2e5eaf){return{'name':_0x2e5eaf[_0x3d32('0x27')],'type':_0x2e5eaf[_0x3d32('0x28')][_0x3d32('0x29')]};});_0x1e0c84[_0x3d32('0x2a')]=_[_0x3d32('0x24')](_0x5c634a,_0x3d32('0x21'));_0x1e0c84['query']=_[_0x3d32('0x2b')](_0x1dc076[_0x3d32('0x2c')]);_0x1e0c84[_0x3d32('0x2d')]=_['intersection'](_0x1e0c84[_0x3d32('0x2a')],_0x1e0c84['query']);_0x803a36[_0x3d32('0x2e')]=_[_0x3d32('0x2f')](_0x1e0c84[_0x3d32('0x2a')],qs[_0x3d32('0x30')](_0x1dc076['query'][_0x3d32('0x30')]));_0x803a36[_0x3d32('0x2e')]=_0x803a36[_0x3d32('0x2e')]['length']?_0x803a36[_0x3d32('0x2e')]:_0x1e0c84['model'];if(!_0x1dc076['query']['hasOwnProperty'](_0x3d32('0x31'))){_0x803a36[_0x3d32('0x18')]=qs['limit'](_0x1dc076[_0x3d32('0x2c')][_0x3d32('0x18')]);_0x803a36[_0x3d32('0x17')]=qs[_0x3d32('0x17')](_0x1dc076[_0x3d32('0x2c')]['offset']);}_0x803a36[_0x3d32('0x32')]=qs[_0x3d32('0x33')](_0x1dc076[_0x3d32('0x2c')][_0x3d32('0x33')]);_0x803a36[_0x3d32('0x34')]=qs[_0x3d32('0x2d')](_[_0x3d32('0x35')](_0x1dc076[_0x3d32('0x2c')],_0x1e0c84[_0x3d32('0x2d')]),_0x5c634a);if(_0x1dc076[_0x3d32('0x2c')][_0x3d32('0x36')]){_0x803a36[_0x3d32('0x34')]=_[_0x3d32('0x37')](_0x803a36[_0x3d32('0x34')],{'$or':_['map'](_0x5c634a,function(_0x45e460){if(_0x45e460[_0x3d32('0x28')]!==_0x3d32('0x38')){var _0x1fae1f={};_0x1fae1f[_0x45e460[_0x3d32('0x21')]]={'$like':'%'+_0x1dc076[_0x3d32('0x2c')][_0x3d32('0x36')]+'%'};return _0x1fae1f;}})});}_0x803a36=_[_0x3d32('0x37')]({},_0x803a36,_0x1dc076[_0x3d32('0x39')]);var _0x2cb25c={'where':_0x803a36['where']};return db[_0x3d32('0x25')][_0x3d32('0x16')](_0x2cb25c)[_0x3d32('0x1e')](function(_0x314f69){_0x508584[_0x3d32('0x16')]=_0x314f69;if(_0x1dc076[_0x3d32('0x2c')][_0x3d32('0x3a')]){_0x803a36['include']=[{'all':!![]}];}return db[_0x3d32('0x25')][_0x3d32('0x3b')](_0x803a36);})[_0x3d32('0x1e')](function(_0x1a9342){_0x508584['rows']=_0x1a9342;return _0x508584;})[_0x3d32('0x1e')](respondWithFilteredResult(_0x1a021f,_0x803a36))[_0x3d32('0x3c')](handleError(_0x1a021f,null));};exports[_0x3d32('0x3d')]=function(_0x415aae,_0x19acc3){var _0x264c80={'raw':!![],'where':{'id':_0x415aae[_0x3d32('0x3e')]['id']}},_0x3b03cf={};_0x3b03cf[_0x3d32('0x2a')]=_[_0x3d32('0x2b')](db[_0x3d32('0x25')][_0x3d32('0x26')]);_0x3b03cf[_0x3d32('0x2c')]=_[_0x3d32('0x2b')](_0x415aae[_0x3d32('0x2c')]);_0x3b03cf[_0x3d32('0x2d')]=_[_0x3d32('0x2f')](_0x3b03cf[_0x3d32('0x2a')],_0x3b03cf['query']);_0x264c80[_0x3d32('0x2e')]=_['intersection'](_0x3b03cf[_0x3d32('0x2a')],qs['fields'](_0x415aae[_0x3d32('0x2c')][_0x3d32('0x30')]));_0x264c80[_0x3d32('0x2e')]=_0x264c80[_0x3d32('0x2e')]['length']?_0x264c80[_0x3d32('0x2e')]:_0x3b03cf[_0x3d32('0x2a')];if(_0x415aae[_0x3d32('0x2c')][_0x3d32('0x3a')]){_0x264c80[_0x3d32('0x3f')]=[{'all':!![]}];}_0x264c80=_[_0x3d32('0x37')]({},_0x264c80,_0x415aae[_0x3d32('0x39')]);return db[_0x3d32('0x25')]['find'](_0x264c80)[_0x3d32('0x1e')](handleEntityNotFound(_0x19acc3,null))[_0x3d32('0x1e')](respondWithResult(_0x19acc3,null))[_0x3d32('0x3c')](handleError(_0x19acc3,null));};exports[_0x3d32('0x40')]=function(_0x4098c2,_0xecc2cd){return db[_0x3d32('0x25')][_0x3d32('0x40')](_0x4098c2[_0x3d32('0x41')],{})[_0x3d32('0x1e')](respondWithResult(_0xecc2cd,0xc9))[_0x3d32('0x3c')](handleError(_0xecc2cd,null));};exports[_0x3d32('0x1d')]=function(_0x33fa60,_0x4e2bba){if(_0x33fa60[_0x3d32('0x41')]['id']){delete _0x33fa60[_0x3d32('0x41')]['id'];}return db[_0x3d32('0x25')][_0x3d32('0x42')]({'where':{'id':_0x33fa60[_0x3d32('0x3e')]['id']}})[_0x3d32('0x1e')](handleEntityNotFound(_0x4e2bba,null))[_0x3d32('0x1e')](saveUpdates(_0x33fa60['body'],null))[_0x3d32('0x1e')](respondWithResult(_0x4e2bba,null))[_0x3d32('0x3c')](handleError(_0x4e2bba,null));};exports[_0x3d32('0x43')]=function(_0x414b44,_0x3d4679){return db[_0x3d32('0x25')][_0x3d32('0x42')]({'where':{'id':_0x414b44[_0x3d32('0x3e')]['id']}})[_0x3d32('0x1e')](handleEntityNotFound(_0x3d4679,null))[_0x3d32('0x1e')](removeEntity(_0x3d4679,null))['catch'](handleError(_0x3d4679,null));}; \ No newline at end of file +var _0x5153=['keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','rows','catch','show','params','rawAttributes','include','options','create','body','find','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','name','send','map','ZendeskField','key','query'];(function(_0x34c910,_0x49ff44){var _0x1d6a12=function(_0x53b932){while(--_0x53b932){_0x34c910['push'](_0x34c910['shift']());}};_0x1d6a12(++_0x49ff44);}(_0x5153,0x173));var _0x3515=function(_0x324006,_0x141aad){_0x324006=_0x324006-0x0;var _0x4a54b8=_0x5153[_0x324006];return _0x4a54b8;};'use strict';var pdf=require(_0x3515('0x0'));var emlformat=require(_0x3515('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3515('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3515('0x3'));var moment=require(_0x3515('0x4'));var BPromise=require(_0x3515('0x5'));var Mustache=require(_0x3515('0x6'));var util=require('util');var path=require(_0x3515('0x7'));var sox=require(_0x3515('0x8'));var csv=require(_0x3515('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3515('0xa'));var _=require(_0x3515('0xb'));var squel=require('squel');var crypto=require(_0x3515('0xc'));var jsforce=require(_0x3515('0xd'));var deskjs=require(_0x3515('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3515('0xf'));var Redis=require(_0x3515('0x10'));var authService=require(_0x3515('0x11'));var qs=require(_0x3515('0x12'));var as=require(_0x3515('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3515('0x14'))(_0x3515('0x15'));var utils=require(_0x3515('0x16'));var config=require(_0x3515('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346e43,_0x4f511d){_0x4f511d=_0x4f511d||0xcc;return function(_0x44b111){if(_0x44b111){return _0x346e43[_0x3515('0x18')](_0x4f511d);}return _0x346e43[_0x3515('0x19')](_0x4f511d)[_0x3515('0x1a')]();};}function respondWithResult(_0x5f3932,_0x7cc4ea){_0x7cc4ea=_0x7cc4ea||0xc8;return function(_0x59faff){if(_0x59faff){return _0x5f3932['status'](_0x7cc4ea)[_0x3515('0x1b')](_0x59faff);}};}function respondWithFilteredResult(_0x45b4ff,_0x20529e){return function(_0x35cd80){if(_0x35cd80){var _0x44c367=_0x35cd80[_0x3515('0x1c')],_0x55b057=_0x20529e[_0x3515('0x1d')],_0x1f9821=_0x20529e[_0x3515('0x1d')]+_0x20529e[_0x3515('0x1e')],_0x4ac728;if(_0x1f9821>=_0x44c367){_0x1f9821=_0x44c367;_0x4ac728=0xc8;}else{_0x4ac728=0xce;}_0x45b4ff[_0x3515('0x19')](_0x4ac728);return _0x45b4ff[_0x3515('0x1f')]('Content-Range',_0x55b057+'-'+_0x1f9821+'/'+_0x44c367)[_0x3515('0x1b')](_0x35cd80);}return null;};}function patchUpdates(_0x201088){return function(_0x16616e){try{jsonpatch[_0x3515('0x20')](_0x16616e,_0x201088,!![]);}catch(_0x3d90c1){return BPromise[_0x3515('0x21')](_0x3d90c1);}return _0x16616e['save']();};}function saveUpdates(_0x1a5fac,_0x1b3bba){return function(_0xdf1461){if(_0xdf1461){return _0xdf1461[_0x3515('0x22')](_0x1a5fac)[_0x3515('0x23')](function(_0x2401ee){return _0x2401ee;});}return null;};}function removeEntity(_0x543dc9,_0x501881){return function(_0x1abe61){if(_0x1abe61){return _0x1abe61[_0x3515('0x24')]()['then'](function(){_0x543dc9[_0x3515('0x19')](0xcc)[_0x3515('0x1a')]();});}};}function handleEntityNotFound(_0x2eb7f1,_0x355d3c){return function(_0x40a084){if(!_0x40a084){_0x2eb7f1[_0x3515('0x18')](0x194);}return _0x40a084;};}function handleError(_0x5c0432,_0x369ef7){_0x369ef7=_0x369ef7||0x1f4;return function(_0x3ff98c){logger['error'](_0x3ff98c['stack']);if(_0x3ff98c[_0x3515('0x25')]){delete _0x3ff98c[_0x3515('0x25')];}_0x5c0432['status'](_0x369ef7)[_0x3515('0x26')](_0x3ff98c);};}exports['index']=function(_0x272b34,_0x655081){var _0x49b5fb={},_0x329f3e={},_0xe51679={'count':0x0,'rows':[]};var _0x89d2af=_[_0x3515('0x27')](db[_0x3515('0x28')]['rawAttributes'],function(_0x4ca786){return{'name':_0x4ca786['fieldName'],'type':_0x4ca786['type'][_0x3515('0x29')]};});_0x329f3e['model']=_['map'](_0x89d2af,'name');_0x329f3e[_0x3515('0x2a')]=_[_0x3515('0x2b')](_0x272b34[_0x3515('0x2a')]);_0x329f3e[_0x3515('0x2c')]=_['intersection'](_0x329f3e[_0x3515('0x2d')],_0x329f3e[_0x3515('0x2a')]);_0x49b5fb[_0x3515('0x2e')]=_[_0x3515('0x2f')](_0x329f3e['model'],qs[_0x3515('0x30')](_0x272b34[_0x3515('0x2a')][_0x3515('0x30')]));_0x49b5fb[_0x3515('0x2e')]=_0x49b5fb[_0x3515('0x2e')][_0x3515('0x31')]?_0x49b5fb['attributes']:_0x329f3e['model'];if(!_0x272b34[_0x3515('0x2a')][_0x3515('0x32')](_0x3515('0x33'))){_0x49b5fb['limit']=qs[_0x3515('0x1e')](_0x272b34['query']['limit']);_0x49b5fb[_0x3515('0x1d')]=qs[_0x3515('0x1d')](_0x272b34[_0x3515('0x2a')][_0x3515('0x1d')]);}_0x49b5fb[_0x3515('0x34')]=qs[_0x3515('0x35')](_0x272b34[_0x3515('0x2a')][_0x3515('0x35')]);_0x49b5fb[_0x3515('0x36')]=qs[_0x3515('0x2c')](_[_0x3515('0x37')](_0x272b34['query'],_0x329f3e['filters']),_0x89d2af);if(_0x272b34[_0x3515('0x2a')][_0x3515('0x38')]){_0x49b5fb[_0x3515('0x36')]=_[_0x3515('0x39')](_0x49b5fb['where'],{'$or':_[_0x3515('0x27')](_0x89d2af,function(_0x14f2b2){if(_0x14f2b2[_0x3515('0x3a')]!=='VIRTUAL'){var _0x1cd3de={};_0x1cd3de[_0x14f2b2[_0x3515('0x25')]]={'$like':'%'+_0x272b34['query']['filter']+'%'};return _0x1cd3de;}})});}_0x49b5fb=_[_0x3515('0x39')]({},_0x49b5fb,_0x272b34['options']);var _0x3589e0={'where':_0x49b5fb[_0x3515('0x36')]};return db[_0x3515('0x28')]['count'](_0x3589e0)[_0x3515('0x23')](function(_0x25674b){_0xe51679[_0x3515('0x1c')]=_0x25674b;if(_0x272b34[_0x3515('0x2a')]['includeAll']){_0x49b5fb['include']=[{'all':!![]}];}return db[_0x3515('0x28')]['findAll'](_0x49b5fb);})[_0x3515('0x23')](function(_0x4b944f){_0xe51679[_0x3515('0x3b')]=_0x4b944f;return _0xe51679;})[_0x3515('0x23')](respondWithFilteredResult(_0x655081,_0x49b5fb))[_0x3515('0x3c')](handleError(_0x655081,null));};exports[_0x3515('0x3d')]=function(_0x395c08,_0x75ece1){var _0x55ba6d={'raw':!![],'where':{'id':_0x395c08[_0x3515('0x3e')]['id']}},_0x3ea9eb={};_0x3ea9eb[_0x3515('0x2d')]=_[_0x3515('0x2b')](db['ZendeskField'][_0x3515('0x3f')]);_0x3ea9eb[_0x3515('0x2a')]=_[_0x3515('0x2b')](_0x395c08['query']);_0x3ea9eb[_0x3515('0x2c')]=_[_0x3515('0x2f')](_0x3ea9eb[_0x3515('0x2d')],_0x3ea9eb[_0x3515('0x2a')]);_0x55ba6d[_0x3515('0x2e')]=_[_0x3515('0x2f')](_0x3ea9eb[_0x3515('0x2d')],qs[_0x3515('0x30')](_0x395c08[_0x3515('0x2a')]['fields']));_0x55ba6d[_0x3515('0x2e')]=_0x55ba6d[_0x3515('0x2e')]['length']?_0x55ba6d[_0x3515('0x2e')]:_0x3ea9eb[_0x3515('0x2d')];if(_0x395c08['query']['includeAll']){_0x55ba6d[_0x3515('0x40')]=[{'all':!![]}];}_0x55ba6d=_[_0x3515('0x39')]({},_0x55ba6d,_0x395c08[_0x3515('0x41')]);return db[_0x3515('0x28')]['find'](_0x55ba6d)[_0x3515('0x23')](handleEntityNotFound(_0x75ece1,null))['then'](respondWithResult(_0x75ece1,null))['catch'](handleError(_0x75ece1,null));};exports[_0x3515('0x42')]=function(_0x2ee94c,_0x5e514d){return db[_0x3515('0x28')]['create'](_0x2ee94c[_0x3515('0x43')],{})[_0x3515('0x23')](respondWithResult(_0x5e514d,0xc9))[_0x3515('0x3c')](handleError(_0x5e514d,null));};exports[_0x3515('0x22')]=function(_0x817902,_0xe28d0e){if(_0x817902[_0x3515('0x43')]['id']){delete _0x817902['body']['id'];}return db['ZendeskField'][_0x3515('0x44')]({'where':{'id':_0x817902[_0x3515('0x3e')]['id']}})[_0x3515('0x23')](handleEntityNotFound(_0xe28d0e,null))[_0x3515('0x23')](saveUpdates(_0x817902[_0x3515('0x43')],null))[_0x3515('0x23')](respondWithResult(_0xe28d0e,null))[_0x3515('0x3c')](handleError(_0xe28d0e,null));};exports[_0x3515('0x24')]=function(_0x24f76c,_0xf04e9){return db[_0x3515('0x28')][_0x3515('0x44')]({'where':{'id':_0x24f76c['params']['id']}})['then'](handleEntityNotFound(_0xf04e9,null))[_0x3515('0x23')](removeEntity(_0xf04e9,null))[_0x3515('0x3c')](handleError(_0xf04e9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index abf7164..7adcdd4 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 _0x7c59=['moment','request-promise','path','./intZendeskField.attributes','exports','define','int_zendesk_fields','FieldId','util','../../config/logger','api'];(function(_0x3fcb3e,_0x1e9bc3){var _0x2ef576=function(_0x254706){while(--_0x254706){_0x3fcb3e['push'](_0x3fcb3e['shift']());}};_0x2ef576(++_0x1e9bc3);}(_0x7c59,0x147));var _0x97c5=function(_0x296da8,_0x1b1585){_0x296da8=_0x296da8-0x0;var _0xb41e6a=_0x7c59[_0x296da8];return _0xb41e6a;};'use strict';var _=require('lodash');var util=require(_0x97c5('0x0'));var logger=require(_0x97c5('0x1'))(_0x97c5('0x2'));var moment=require(_0x97c5('0x3'));var BPromise=require('bluebird');var rp=require(_0x97c5('0x4'));var fs=require('fs');var path=require(_0x97c5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97c5('0x6'));module[_0x97c5('0x7')]=function(_0x29832f,_0xb7c5e1){return _0x29832f[_0x97c5('0x8')]('ZendeskField',attributes,{'tableName':_0x97c5('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x97c5('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc03=['int_zendesk_fields','idField','FieldId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x835f74,_0x123452){var _0x46a4d6=function(_0x5b7adc){while(--_0x5b7adc){_0x835f74['push'](_0x835f74['shift']());}};_0x46a4d6(++_0x123452);}(_0xfc03,0x16f));var _0x3fc0=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xfc03[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x3fc0('0x0'));var util=require('util');var logger=require(_0x3fc0('0x1'))(_0x3fc0('0x2'));var moment=require('moment');var BPromise=require(_0x3fc0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fc0('0x4'));var rimraf=require(_0x3fc0('0x5'));var config=require(_0x3fc0('0x6'));var attributes=require(_0x3fc0('0x7'));module[_0x3fc0('0x8')]=function(_0x389bfb,_0x2b4ef6){return _0x389bfb[_0x3fc0('0x9')]('ZendeskField',attributes,{'tableName':_0x3fc0('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x3fc0('0xb'),_0x3fc0('0xc')],'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 f2564ef..7ba105f 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 _0xbca3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','randomstring','ioredis','../../mysqldb'];(function(_0x883521,_0x233fdc){var _0x4c6bfe=function(_0x2ed012){while(--_0x2ed012){_0x883521['push'](_0x883521['shift']());}};_0x4c6bfe(++_0x233fdc);}(_0xbca3,0x1a0));var _0x3bca=function(_0x425005,_0xb33d4f){_0x425005=_0x425005-0x0;var _0x196052=_0xbca3[_0x425005];return _0x196052;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3bca('0x0'));var BPromise=require('bluebird');var rs=require(_0x3bca('0x1'));var fs=require('fs');var Redis=require(_0x3bca('0x2'));var db=require(_0x3bca('0x3'))['db'];var utils=require(_0x3bca('0x4'));var logger=require(_0x3bca('0x5'))('rpc');var config=require(_0x3bca('0x6'));var jayson=require(_0x3bca('0x7'));var client=jayson[_0x3bca('0x8')][_0x3bca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x493823,_0x14c34e,_0x3099b1){return new BPromise(function(_0x459ea4,_0x4c4614){return client[_0x3bca('0xa')](_0x493823,_0x3099b1)[_0x3bca('0xb')](function(_0x59d282){logger[_0x3bca('0xc')](_0x3bca('0xd'),_0x14c34e,_0x3bca('0xe'));logger[_0x3bca('0xf')](_0x3bca('0x10'),_0x14c34e,_0x3bca('0xe'),JSON[_0x3bca('0x11')](_0x59d282));if(_0x59d282[_0x3bca('0x12')]){if(_0x59d282[_0x3bca('0x12')]['code']===0x1f4){logger[_0x3bca('0x12')](_0x3bca('0xd'),_0x14c34e,_0x59d282[_0x3bca('0x12')]['message']);return _0x4c4614(_0x59d282[_0x3bca('0x12')][_0x3bca('0x13')]);}logger[_0x3bca('0x12')](_0x3bca('0xd'),_0x14c34e,_0x59d282['error']['message']);return _0x459ea4(_0x59d282['error']['message']);}else{logger[_0x3bca('0xc')](_0x3bca('0xd'),_0x14c34e,_0x3bca('0xe'));_0x459ea4(_0x59d282[_0x3bca('0x14')][_0x3bca('0x13')]);}})['catch'](function(_0xe974ab){logger['error'](_0x3bca('0xd'),_0x14c34e,_0xe974ab);_0x4c4614(_0xe974ab);});});} \ No newline at end of file +var _0x9e69=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x35f27f,_0x3ca07a){var _0x3377c0=function(_0x1c1678){while(--_0x1c1678){_0x35f27f['push'](_0x35f27f['shift']());}};_0x3377c0(++_0x3ca07a);}(_0x9e69,0x161));var _0x99e6=function(_0x2d71fc,_0x75cc0e){_0x2d71fc=_0x2d71fc-0x0;var _0x4bf145=_0x9e69[_0x2d71fc];return _0x4bf145;};'use strict';var _=require(_0x99e6('0x0'));var util=require('util');var moment=require(_0x99e6('0x1'));var BPromise=require('bluebird');var rs=require(_0x99e6('0x2'));var fs=require('fs');var Redis=require(_0x99e6('0x3'));var db=require(_0x99e6('0x4'))['db'];var utils=require(_0x99e6('0x5'));var logger=require(_0x99e6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x99e6('0x7'));var client=jayson['client'][_0x99e6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x192232,_0x38b804,_0x2dcd4e){return new BPromise(function(_0x2d98b2,_0x3e5dce){return client[_0x99e6('0x9')](_0x192232,_0x2dcd4e)[_0x99e6('0xa')](function(_0x213896){logger[_0x99e6('0xb')](_0x99e6('0xc'),_0x38b804,_0x99e6('0xd'));logger[_0x99e6('0xe')](_0x99e6('0xf'),_0x38b804,_0x99e6('0xd'),JSON[_0x99e6('0x10')](_0x213896));if(_0x213896[_0x99e6('0x11')]){if(_0x213896[_0x99e6('0x11')][_0x99e6('0x12')]===0x1f4){logger[_0x99e6('0x11')](_0x99e6('0xc'),_0x38b804,_0x213896[_0x99e6('0x11')]['message']);return _0x3e5dce(_0x213896[_0x99e6('0x11')][_0x99e6('0x13')]);}logger[_0x99e6('0x11')](_0x99e6('0xc'),_0x38b804,_0x213896[_0x99e6('0x11')][_0x99e6('0x13')]);return _0x2d98b2(_0x213896[_0x99e6('0x11')][_0x99e6('0x13')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x38b804,'request\x20sent');_0x2d98b2(_0x213896[_0x99e6('0x14')][_0x99e6('0x13')]);}})[_0x99e6('0x15')](function(_0x23ac5d){logger[_0x99e6('0x11')](_0x99e6('0xc'),_0x38b804,_0x23ac5d);_0x3e5dce(_0x23ac5d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index bf3b61a..866002a 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 _0xe1ac=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x478b7b,_0x5db5a3){var _0x5f15e2=function(_0x1961e2){while(--_0x1961e2){_0x478b7b['push'](_0x478b7b['shift']());}};_0x5f15e2(++_0x5db5a3);}(_0xe1ac,0x15d));var _0xce1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe1ac[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xce1a('0x0'));var util=require(_0xce1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xce1a('0x2'));var router=express[_0xce1a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce1a('0x4'));var config=require(_0xce1a('0x5'));var controller=require(_0xce1a('0x6'));router[_0xce1a('0x7')]('/',auth[_0xce1a('0x8')](),controller[_0xce1a('0x9')]);router[_0xce1a('0x7')](_0xce1a('0xa'),auth[_0xce1a('0x8')](),controller['show']);router[_0xce1a('0x7')](_0xce1a('0xb'),auth[_0xce1a('0x8')](),controller[_0xce1a('0xc')]);router['get'](_0xce1a('0xd'),auth[_0xce1a('0x8')](),controller[_0xce1a('0xe')]);router[_0xce1a('0xf')]('/',auth['isAuthenticated'](),controller[_0xce1a('0x10')]);router[_0xce1a('0xf')](_0xce1a('0xb'),auth['isAuthenticated'](),controller[_0xce1a('0x11')]);router['put'](_0xce1a('0xa'),auth[_0xce1a('0x8')](),controller[_0xce1a('0x12')]);router['delete'](_0xce1a('0xa'),auth['isAuthenticated'](),controller[_0xce1a('0x13')]);module[_0xce1a('0x14')]=router; \ No newline at end of file +var _0x72ff=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update'];(function(_0x683edc,_0x5105c5){var _0x5992f0=function(_0x51350d){while(--_0x51350d){_0x683edc['push'](_0x683edc['shift']());}};_0x5992f0(++_0x5105c5);}(_0x72ff,0x116));var _0xf72f=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x72ff[_0x23e7c1];return _0x1add43;};'use strict';var multer=require('multer');var util=require(_0xf72f('0x0'));var path=require(_0xf72f('0x1'));var timeout=require(_0xf72f('0x2'));var express=require(_0xf72f('0x3'));var router=express[_0xf72f('0x4')]();var fs_extra=require(_0xf72f('0x5'));var auth=require(_0xf72f('0x6'));var interaction=require(_0xf72f('0x7'));var config=require(_0xf72f('0x8'));var controller=require('./intZohoAccount.controller');router[_0xf72f('0x9')]('/',auth[_0xf72f('0xa')](),controller[_0xf72f('0xb')]);router[_0xf72f('0x9')]('/:id',auth[_0xf72f('0xa')](),controller[_0xf72f('0xc')]);router[_0xf72f('0x9')](_0xf72f('0xd'),auth[_0xf72f('0xa')](),controller[_0xf72f('0xe')]);router[_0xf72f('0x9')](_0xf72f('0xf'),auth[_0xf72f('0xa')](),controller['getFields']);router[_0xf72f('0x10')]('/',auth[_0xf72f('0xa')](),controller[_0xf72f('0x11')]);router[_0xf72f('0x10')](_0xf72f('0xd'),auth['isAuthenticated'](),controller[_0xf72f('0x12')]);router[_0xf72f('0x13')](_0xf72f('0x14'),auth['isAuthenticated'](),controller[_0xf72f('0x15')]);router[_0xf72f('0x16')](_0xf72f('0x14'),auth['isAuthenticated'](),controller[_0xf72f('0x17')]);module[_0xf72f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index d66021f..e907c6b 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 _0x0cb1=['STRING'];(function(_0x3f4423,_0x293466){var _0x4d0e7c=function(_0x331da6){while(--_0x331da6){_0x3f4423['push'](_0x3f4423['shift']());}};_0x4d0e7c(++_0x293466);}(_0x0cb1,0xa3));var _0x10cb=function(_0x45b7ac,_0x2900f8){_0x45b7ac=_0x45b7ac-0x0;var _0x27b63d=_0x0cb1[_0x45b7ac];return _0x27b63d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x10cb('0x0')]},'description':{'type':Sequelize[_0x10cb('0x0')]},'host':{'type':Sequelize[_0x10cb('0x0')]},'zone':{'type':Sequelize[_0x10cb('0x0')]},'clientId':{'type':Sequelize[_0x10cb('0x0')]},'clientSecret':{'type':Sequelize[_0x10cb('0x0')]},'serverUrl':{'type':Sequelize[_0x10cb('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x10cb('0x0')]}}; \ No newline at end of file +var _0xb581=['STRING','sequelize','exports'];(function(_0x4f082d,_0x36064e){var _0x518130=function(_0x345210){while(--_0x345210){_0x4f082d['push'](_0x4f082d['shift']());}};_0x518130(++_0x36064e);}(_0xb581,0x17b));var _0x1b58=function(_0x4ab57a,_0x1b1d53){_0x4ab57a=_0x4ab57a-0x0;var _0x2541ec=_0xb581[_0x4ab57a];return _0x2541ec;};'use strict';var Sequelize=require(_0x1b58('0x0'));module[_0x1b58('0x1')]={'name':{'type':Sequelize[_0x1b58('0x2')]},'description':{'type':Sequelize[_0x1b58('0x2')]},'host':{'type':Sequelize[_0x1b58('0x2')]},'zone':{'type':Sequelize[_0x1b58('0x2')]},'clientId':{'type':Sequelize[_0x1b58('0x2')]},'clientSecret':{'type':Sequelize[_0x1b58('0x2')]},'serverUrl':{'type':Sequelize[_0x1b58('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x1b58('0x2')]},'refreshToken':{'type':Sequelize[_0x1b58('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3ad6f3c..54b5e0a 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 _0xb8aa=['show','params','length','options','create','body','destroy','find','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','Subjects','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zoho.eu','com','slice','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','end','status','json','count','offset','set','Content-Range','apply','save','update','sendStatus','name','send','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','ZohoAccount','includeAll','include','findAll','rows'];(function(_0x1a57fe,_0x32ec9f){var _0x2efff1=function(_0x33637b){while(--_0x33637b){_0x1a57fe['push'](_0x1a57fe['shift']());}};_0x2efff1(++_0x32ec9f);}(_0xb8aa,0xc8));var _0xab8a=function(_0xd5400e,_0x2bf761){_0xd5400e=_0xd5400e-0x0;var _0x3ad7c7=_0xb8aa[_0xd5400e];return _0x3ad7c7;};'use strict';var pdf=require(_0xab8a('0x0'));var emlformat=require(_0xab8a('0x1'));var rimraf=require(_0xab8a('0x2'));var zipdir=require(_0xab8a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab8a('0x4'));var moment=require('moment');var BPromise=require(_0xab8a('0x5'));var Mustache=require(_0xab8a('0x6'));var util=require('util');var path=require('path');var sox=require(_0xab8a('0x7'));var csv=require(_0xab8a('0x8'));var ejs=require(_0xab8a('0x9'));var fs=require('fs');var fs_extra=require(_0xab8a('0xa'));var _=require('lodash');var squel=require(_0xab8a('0xb'));var crypto=require('crypto');var jsforce=require(_0xab8a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab8a('0xd'));var Papa=require(_0xab8a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xab8a('0xf'));var as=require(_0xab8a('0x10'));var hardwareService=require(_0xab8a('0x11'));var logger=require('../../config/logger')(_0xab8a('0x12'));var utils=require('../../config/utils');var config=require(_0xab8a('0x13'));var licenseUtil=require(_0xab8a('0x14'));var db=require(_0xab8a('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xab8a('0x16')][_0xab8a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5bca6e,_0x5d67da,_0x1e478c,_0x4a1cb0){return new BPromise(function(_0x2194d0,_0xce0d91){var _0x3ee5c8=_0x4a1cb0||client;return _0x3ee5c8['request'](_0x5bca6e,_0x1e478c)[_0xab8a('0x18')](function(_0x1fe624){logger[_0xab8a('0x19')](_0xab8a('0x1a'),_0x5d67da,'request\x20sent');logger[_0xab8a('0x1b')](_0xab8a('0x1c'),_0x5d67da,_0xab8a('0x1d'),JSON[_0xab8a('0x1e')](_0x1fe624));if(_0x1fe624[_0xab8a('0x1f')]){if(_0x1fe624['error'][_0xab8a('0x20')]===0x1f4){logger[_0xab8a('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x5d67da,_0x1fe624['error']['message']);return _0xce0d91(_0x1fe624[_0xab8a('0x1f')][_0xab8a('0x21')]);}logger[_0xab8a('0x1f')](_0xab8a('0x1a'),_0x5d67da,_0x1fe624['error'][_0xab8a('0x21')]);return _0x2194d0(_0x1fe624[_0xab8a('0x1f')]['message']);}else{logger[_0xab8a('0x19')](_0xab8a('0x1a'),_0x5d67da,'request\x20sent');_0x2194d0(_0x1fe624['result'][_0xab8a('0x21')]);}})[_0xab8a('0x22')](function(_0x291dfd){logger[_0xab8a('0x1f')](_0xab8a('0x1a'),_0x5d67da,_0x291dfd);_0xce0d91(_0x291dfd);});});}function respondWithStatusCode(_0x477ae4,_0x5e6fc0){_0x5e6fc0=_0x5e6fc0||0xcc;return function(_0x83fd02){if(_0x83fd02){return _0x477ae4['sendStatus'](_0x5e6fc0);}return _0x477ae4['status'](_0x5e6fc0)[_0xab8a('0x23')]();};}function respondWithResult(_0x4276e9,_0x563042){_0x563042=_0x563042||0xc8;return function(_0x4c3a85){if(_0x4c3a85){return _0x4276e9[_0xab8a('0x24')](_0x563042)[_0xab8a('0x25')](_0x4c3a85);}};}function respondWithFilteredResult(_0x21ba7f,_0xcf84d){return function(_0x4ab7a6){if(_0x4ab7a6){var _0x5ad95a=_0x4ab7a6[_0xab8a('0x26')],_0x443d85=_0xcf84d['offset'],_0xc4be84=_0xcf84d[_0xab8a('0x27')]+_0xcf84d['limit'],_0x2fe769;if(_0xc4be84>=_0x5ad95a){_0xc4be84=_0x5ad95a;_0x2fe769=0xc8;}else{_0x2fe769=0xce;}_0x21ba7f[_0xab8a('0x24')](_0x2fe769);return _0x21ba7f[_0xab8a('0x28')](_0xab8a('0x29'),_0x443d85+'-'+_0xc4be84+'/'+_0x5ad95a)[_0xab8a('0x25')](_0x4ab7a6);}return null;};}function patchUpdates(_0x5dae6e){return function(_0x51ab6e){try{jsonpatch[_0xab8a('0x2a')](_0x51ab6e,_0x5dae6e,!![]);}catch(_0x5f0a9b){return BPromise['reject'](_0x5f0a9b);}return _0x51ab6e[_0xab8a('0x2b')]();};}function saveUpdates(_0x29706b,_0x4cd653){return function(_0x25ddfc){if(_0x25ddfc){return _0x25ddfc[_0xab8a('0x2c')](_0x29706b)[_0xab8a('0x18')](function(_0x24d0cc){return _0x24d0cc;});}return null;};}function removeEntity(_0x132f7b,_0x233c49){return function(_0x233d83){if(_0x233d83){return _0x233d83['destroy']()['then'](function(){_0x132f7b[_0xab8a('0x24')](0xcc)[_0xab8a('0x23')]();});}};}function handleEntityNotFound(_0x4d607a,_0x582bc7){return function(_0x22b2a3){if(!_0x22b2a3){_0x4d607a[_0xab8a('0x2d')](0x194);}return _0x22b2a3;};}function handleError(_0xf33b,_0x2c7847){_0x2c7847=_0x2c7847||0x1f4;return function(_0x5c41f3){logger[_0xab8a('0x1f')](_0x5c41f3['stack']);if(_0x5c41f3[_0xab8a('0x2e')]){delete _0x5c41f3['name'];}_0xf33b[_0xab8a('0x24')](_0x2c7847)[_0xab8a('0x2f')](_0x5c41f3);};}exports['index']=function(_0xac01f8,_0x28d549){var _0x35edf3={},_0xc228d1={},_0x47d5aa={'count':0x0,'rows':[]};var _0x4d96d8=_[_0xab8a('0x30')](db['ZohoAccount'][_0xab8a('0x31')],function(_0x2c56ef){return{'name':_0x2c56ef['fieldName'],'type':_0x2c56ef[_0xab8a('0x32')][_0xab8a('0x33')]};});_0xc228d1[_0xab8a('0x34')]=_[_0xab8a('0x30')](_0x4d96d8,_0xab8a('0x2e'));_0xc228d1[_0xab8a('0x35')]=_[_0xab8a('0x36')](_0xac01f8['query']);_0xc228d1['filters']=_['intersection'](_0xc228d1['model'],_0xc228d1[_0xab8a('0x35')]);_0x35edf3[_0xab8a('0x37')]=_[_0xab8a('0x38')](_0xc228d1[_0xab8a('0x34')],qs['fields'](_0xac01f8[_0xab8a('0x35')][_0xab8a('0x39')]));_0x35edf3[_0xab8a('0x37')]=_0x35edf3[_0xab8a('0x37')]['length']?_0x35edf3[_0xab8a('0x37')]:_0xc228d1[_0xab8a('0x34')];if(!_0xac01f8[_0xab8a('0x35')][_0xab8a('0x3a')](_0xab8a('0x3b'))){_0x35edf3['limit']=qs[_0xab8a('0x3c')](_0xac01f8[_0xab8a('0x35')]['limit']);_0x35edf3[_0xab8a('0x27')]=qs['offset'](_0xac01f8[_0xab8a('0x35')][_0xab8a('0x27')]);}_0x35edf3[_0xab8a('0x3d')]=qs[_0xab8a('0x3e')](_0xac01f8[_0xab8a('0x35')][_0xab8a('0x3e')]);_0x35edf3[_0xab8a('0x3f')]=qs[_0xab8a('0x40')](_[_0xab8a('0x41')](_0xac01f8[_0xab8a('0x35')],_0xc228d1[_0xab8a('0x40')]),_0x4d96d8);if(_0xac01f8[_0xab8a('0x35')][_0xab8a('0x42')]){_0x35edf3[_0xab8a('0x3f')]=_['merge'](_0x35edf3['where'],{'$or':_[_0xab8a('0x30')](_0x4d96d8,function(_0x3a6567){if(_0x3a6567['type']!==_0xab8a('0x43')){var _0x275b70={};_0x275b70[_0x3a6567[_0xab8a('0x2e')]]={'$like':'%'+_0xac01f8[_0xab8a('0x35')][_0xab8a('0x42')]+'%'};return _0x275b70;}})});}_0x35edf3=_[_0xab8a('0x44')]({},_0x35edf3,_0xac01f8['options']);var _0x62aafd={'where':_0x35edf3[_0xab8a('0x3f')]};return db[_0xab8a('0x45')][_0xab8a('0x26')](_0x62aafd)[_0xab8a('0x18')](function(_0x1ad61d){_0x47d5aa[_0xab8a('0x26')]=_0x1ad61d;if(_0xac01f8['query'][_0xab8a('0x46')]){_0x35edf3[_0xab8a('0x47')]=[{'all':!![]}];}return db[_0xab8a('0x45')][_0xab8a('0x48')](_0x35edf3);})[_0xab8a('0x18')](function(_0x4e8863){_0x47d5aa[_0xab8a('0x49')]=_0x4e8863;return _0x47d5aa;})['then'](respondWithFilteredResult(_0x28d549,_0x35edf3))[_0xab8a('0x22')](handleError(_0x28d549,null));};exports[_0xab8a('0x4a')]=function(_0x3c5303,_0x1ba71f){var _0x5a49b4={'raw':![],'where':{'id':_0x3c5303[_0xab8a('0x4b')]['id']}},_0x2c4847={};_0x2c4847[_0xab8a('0x34')]=_[_0xab8a('0x36')](db[_0xab8a('0x45')]['rawAttributes']);_0x2c4847['query']=_[_0xab8a('0x36')](_0x3c5303[_0xab8a('0x35')]);_0x2c4847[_0xab8a('0x40')]=_[_0xab8a('0x38')](_0x2c4847[_0xab8a('0x34')],_0x2c4847[_0xab8a('0x35')]);_0x5a49b4[_0xab8a('0x37')]=_[_0xab8a('0x38')](_0x2c4847[_0xab8a('0x34')],qs[_0xab8a('0x39')](_0x3c5303['query'][_0xab8a('0x39')]));_0x5a49b4[_0xab8a('0x37')]=_0x5a49b4['attributes'][_0xab8a('0x4c')]?_0x5a49b4['attributes']:_0x2c4847[_0xab8a('0x34')];if(_0x3c5303[_0xab8a('0x35')][_0xab8a('0x46')]){_0x5a49b4[_0xab8a('0x47')]=[{'all':!![]}];}_0x5a49b4=_[_0xab8a('0x44')]({},_0x5a49b4,_0x3c5303[_0xab8a('0x4d')]);return db[_0xab8a('0x45')]['find'](_0x5a49b4)[_0xab8a('0x18')](handleEntityNotFound(_0x1ba71f,null))[_0xab8a('0x18')](respondWithResult(_0x1ba71f,null))['catch'](handleError(_0x1ba71f,null));};exports[_0xab8a('0x4e')]=function(_0x32ee85,_0x1b38a8){return db[_0xab8a('0x45')][_0xab8a('0x4e')](_0x32ee85['body'],{})[_0xab8a('0x18')](respondWithResult(_0x1b38a8,0xc9))[_0xab8a('0x22')](handleError(_0x1b38a8,null));};exports[_0xab8a('0x2c')]=function(_0x50f236,_0x2ab72c){if(_0x50f236[_0xab8a('0x4f')]['id']){delete _0x50f236[_0xab8a('0x4f')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x50f236[_0xab8a('0x4b')]['id']}})[_0xab8a('0x18')](handleEntityNotFound(_0x2ab72c,null))[_0xab8a('0x18')](saveUpdates(_0x50f236[_0xab8a('0x4f')],null))[_0xab8a('0x18')](respondWithResult(_0x2ab72c,null))[_0xab8a('0x22')](handleError(_0x2ab72c,null));};exports[_0xab8a('0x50')]=function(_0x40df0b,_0x53bd6e){return db['ZohoAccount'][_0xab8a('0x51')]({'where':{'id':_0x40df0b[_0xab8a('0x4b')]['id']}})[_0xab8a('0x18')](handleEntityNotFound(_0x53bd6e,null))[_0xab8a('0x18')](removeEntity(_0x53bd6e,null))[_0xab8a('0x22')](handleError(_0x53bd6e,null));};exports[_0xab8a('0x52')]=function(_0x9d6fcd,_0x400173,_0x15215a){var _0x1771aa={};var _0x47e432={};var _0x4eafd2;var _0x57d068;return db[_0xab8a('0x45')]['findOne']({'where':{'id':_0x9d6fcd[_0xab8a('0x4b')]['id']}})[_0xab8a('0x18')](handleEntityNotFound(_0x400173,null))[_0xab8a('0x18')](function(_0x2c978b){if(_0x2c978b){_0x4eafd2=_0x2c978b;_0x47e432[_0xab8a('0x34')]=_[_0xab8a('0x36')](db[_0xab8a('0x53')][_0xab8a('0x31')]);_0x47e432['query']=_[_0xab8a('0x36')](_0x9d6fcd[_0xab8a('0x35')]);_0x47e432[_0xab8a('0x40')]=_[_0xab8a('0x38')](_0x47e432[_0xab8a('0x34')],_0x47e432[_0xab8a('0x35')]);_0x1771aa['attributes']=_[_0xab8a('0x38')](_0x47e432[_0xab8a('0x34')],qs['fields'](_0x9d6fcd['query'][_0xab8a('0x39')]));_0x1771aa[_0xab8a('0x37')]=_0x1771aa[_0xab8a('0x37')][_0xab8a('0x4c')]?_0x1771aa[_0xab8a('0x37')]:_0x47e432['model'];_0x1771aa[_0xab8a('0x3d')]=qs[_0xab8a('0x3e')](_0x9d6fcd[_0xab8a('0x35')][_0xab8a('0x3e')]);_0x1771aa[_0xab8a('0x3f')]=qs[_0xab8a('0x40')](_['pick'](_0x9d6fcd[_0xab8a('0x35')],_0x47e432[_0xab8a('0x40')]));if(_0x9d6fcd[_0xab8a('0x35')]['filter']){_0x1771aa[_0xab8a('0x3f')]=_[_0xab8a('0x44')](_0x1771aa[_0xab8a('0x3f')],{'$or':_[_0xab8a('0x30')](_0x1771aa[_0xab8a('0x37')],function(_0x3657ff){var _0x3838bc={};_0x3838bc[_0x3657ff]={'$like':'%'+_0x9d6fcd[_0xab8a('0x35')]['filter']+'%'};return _0x3838bc;})});}_0x1771aa=_[_0xab8a('0x44')]({},_0x1771aa,_0x9d6fcd['options']);return _0x4eafd2['getConfigurations'](_0x1771aa);}})[_0xab8a('0x18')](function(_0x1ecf62){if(_0x1ecf62){_0x57d068=_0x1ecf62['length'];if(!_0x9d6fcd[_0xab8a('0x35')]['hasOwnProperty'](_0xab8a('0x3b'))){_0x1771aa['limit']=qs[_0xab8a('0x3c')](_0x9d6fcd[_0xab8a('0x35')][_0xab8a('0x3c')]);_0x1771aa[_0xab8a('0x27')]=qs['offset'](_0x9d6fcd[_0xab8a('0x35')][_0xab8a('0x27')]);}return _0x4eafd2[_0xab8a('0x52')](_0x1771aa);}})[_0xab8a('0x18')](function(_0x1dd853){if(_0x1dd853){return _0x1dd853?{'count':_0x57d068,'rows':_0x1dd853}:null;}})[_0xab8a('0x18')](respondWithResult(_0x400173,null))[_0xab8a('0x22')](handleError(_0x400173,null));};exports[_0xab8a('0x54')]=function(_0x23a13f,_0xdbafb5,_0x10c212){if(_0x23a13f[_0xab8a('0x4f')]['id']){delete _0x23a13f[_0xab8a('0x4f')]['id'];}return db['ZohoAccount'][_0xab8a('0x55')]({'where':{'id':_0x23a13f[_0xab8a('0x4b')]['id']}})[_0xab8a('0x18')](handleEntityNotFound(_0xdbafb5,null))[_0xab8a('0x18')](function(_0x43da9f){if(_0x43da9f){_0x23a13f[_0xab8a('0x4f')][_0xab8a('0x56')]=_0x43da9f['id'];_0x23a13f['body']['Subjects']=integrations[_0xab8a('0x57')](_0x23a13f[_0xab8a('0x4f')][_0xab8a('0x58')],_0x23a13f[_0xab8a('0x4f')][_0xab8a('0x32')]);_0x23a13f[_0xab8a('0x4f')][_0xab8a('0x59')]=integrations['getDescriptions'](_0x23a13f['body'][_0xab8a('0x58')],_0x23a13f['body']['type']);return db[_0xab8a('0x53')]['create'](_0x23a13f[_0xab8a('0x4f')],{'include':[{'model':db['ZohoField'],'as':_0xab8a('0x5a')},{'model':db[_0xab8a('0x5b')],'as':_0xab8a('0x59')}]});}return null;})[_0xab8a('0x18')](respondWithResult(_0xdbafb5,null))[_0xab8a('0x22')](handleError(_0xdbafb5,null));};function getAccessToken(_0x3f8179){return new Promise(function(_0x4eea9a,_0x18bbe0){var _0x27a74b;switch(_0x3f8179[_0xab8a('0x5c')]){case'US':_0x27a74b=_0xab8a('0x5d');break;case'AU':_0x27a74b=_0xab8a('0x5e');break;case'EU':_0x27a74b=_0xab8a('0x5f');break;case'IN':_0x27a74b=_0xab8a('0x60');break;case'CN':_0x27a74b=_0xab8a('0x61');break;default:_0x27a74b=_0xab8a('0x5f');break;}var _0xf0b816={'method':_0xab8a('0x62'),'uri':_0x27a74b+_0xab8a('0x63'),'qs':{'refresh_token':_0x3f8179['refreshToken'],'client_id':_0x3f8179[_0xab8a('0x64')],'client_secret':_0x3f8179[_0xab8a('0x65')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xf0b816)[_0xab8a('0x18')](function(_0x14add6){if(_0x14add6[_0xab8a('0x66')]){_0x4eea9a(_0x14add6[_0xab8a('0x66')]);}else{_0x18bbe0(_0xab8a('0x67'));}})[_0xab8a('0x22')](function(_0x241f85){_0x18bbe0(_0x241f85);});});}exports[_0xab8a('0x68')]=function(_0x2d1e7c,_0xf81901,_0x1669d9){var _0x531882,_0x3cadc2,_0x4f6118,_0x57bf9f,_0x1879d3;return db[_0xab8a('0x45')][_0xab8a('0x55')]({'where':{'id':_0x2d1e7c[_0xab8a('0x4b')]['id']},'attributes':['id','host',_0xab8a('0x5c'),_0xab8a('0x64'),'clientSecret','serverUrl','code','refreshToken']})[_0xab8a('0x18')](handleEntityNotFound(_0xf81901,null))[_0xab8a('0x18')](function(_0x4bb43c){_0x1879d3=_0x4bb43c;_0x531882=_0x1879d3['host'];_0x3cadc2=_0x531882===_0xab8a('0x69')?'eu':_0xab8a('0x6a');_0x4f6118=_0x1879d3['serverUrl'];var _0x52cba2=_0x4f6118[_0xab8a('0x6b')](-0x1);if(_0x52cba2==='/'||_0x52cba2==='\x5c'||_0x52cba2===':'){_0x4f6118=_0x4f6118[_0xab8a('0x6c')](0x0,_0x4f6118[_0xab8a('0x6d')](_0x52cba2));}if(!_0x1879d3[_0xab8a('0x6e')]){throw new Error(_0xab8a('0x6f'));}return getAccessToken(_0x1879d3);})[_0xab8a('0x18')](function(_0x4283b6){if(_0x4283b6){return rp({'method':'GET','uri':util[_0xab8a('0x70')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3cadc2),'qs':{'module':_0xab8a('0x71')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4283b6},'json':!![]});}})[_0xab8a('0x18')](function(_0x3f531e){if(_0x3f531e){if(_0x3f531e['response']&&_0x3f531e[_0xab8a('0x72')][_0xab8a('0x1f')]){throw new Error(_0x3f531e[_0xab8a('0x72')][_0xab8a('0x1f')][_0xab8a('0x21')]);}var _0x9aa0e6=[];var _0x2aebf0=[];var _0xa88149=[_0xab8a('0x73'),_0xab8a('0x74'),_0xab8a('0x75'),_0xab8a('0x76'),_0xab8a('0x77'),_0xab8a('0x78'),_0xab8a('0x79'),_0xab8a('0x7a')];_0x2aebf0=_[_0xab8a('0x7b')](_0x3f531e['fields'],function(_0x462ade){return _0xa88149[_0xab8a('0x7c')](_0x462ade[_0xab8a('0x7d')]);});for(var _0x2bd85f=0x0;_0x2bd85f<_0x2aebf0['length'];_0x2bd85f++){if(_0x2aebf0[_0x2bd85f][_0xab8a('0x7e')]===![]){_0x9aa0e6[_0xab8a('0x7f')]({'id':_0x2aebf0[_0x2bd85f]['id'],'name':_0x2aebf0[_0x2bd85f][_0xab8a('0x80')],'custom':_0x2aebf0[_0x2bd85f][_0xab8a('0x81')],'options':_0x2aebf0[_0x2bd85f][_0xab8a('0x82')]===_0xab8a('0x83')&&_0x2aebf0[_0x2bd85f][_0xab8a('0x84')][_0xab8a('0x4c')]>-0x1?_[_0xab8a('0x30')](_0x2aebf0[_0x2bd85f][_0xab8a('0x84')],function(_0x1ba833){return{'name':_0x1ba833,'value':_0x1ba833};}):[]});}}return{'count':_0x9aa0e6['length'],'rows':_0x9aa0e6};}else{return{'count':0x0,'rows':[]};}})[_0xab8a('0x18')](respondWithResult(_0xf81901,null))[_0xab8a('0x22')](function(_0x10df88){var _0x1714c1=_0x2d1e7c[_0xab8a('0x35')]['test']?0x1f4:_0x10df88['statusCode']||0x1f4;logger[_0xab8a('0x1f')](_0xab8a('0x85'),_0xab8a('0x68'),_0x1714c1,JSON[_0xab8a('0x1e')](_0x10df88));delete _0x10df88[_0xab8a('0x2e')];if(_0x1714c1===0x191){_0x1714c1=0x190;}_0xf81901[_0xab8a('0x24')](_0x1714c1)[_0xab8a('0x2f')](_0x2d1e7c[_0xab8a('0x35')][_0xab8a('0x86')]?{'message':_0xab8a('0x87'),'statusCode':_0x10df88[_0xab8a('0x88')]}:_0x10df88);});}; \ No newline at end of file +var _0xa5b9=['../../components/integrations/configuration','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','status','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','ZohoAccount','find','create','body','findOne','ZohoConfiguration','length','options','getConfigurations','addConfiguration','AccountId','getSubjects','channel','type','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0xa5b9,0x102));var _0x9a5b=function(_0x30e15f,_0x11cf78){_0x30e15f=_0x30e15f-0x0;var _0x384e0c=_0xa5b9[_0x30e15f];return _0x384e0c;};'use strict';var pdf=require(_0x9a5b('0x0'));var emlformat=require(_0x9a5b('0x1'));var rimraf=require(_0x9a5b('0x2'));var zipdir=require(_0x9a5b('0x3'));var jsonpatch=require(_0x9a5b('0x4'));var rp=require(_0x9a5b('0x5'));var moment=require(_0x9a5b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9a5b('0x7'));var path=require(_0x9a5b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a5b('0x9'));var fs=require('fs');var fs_extra=require(_0x9a5b('0xa'));var _=require(_0x9a5b('0xb'));var squel=require(_0x9a5b('0xc'));var crypto=require(_0x9a5b('0xd'));var jsforce=require(_0x9a5b('0xe'));var deskjs=require(_0x9a5b('0xf'));var toCsv=require(_0x9a5b('0x10'));var querystring=require(_0x9a5b('0x11'));var Papa=require('papaparse');var Redis=require(_0x9a5b('0x12'));var authService=require(_0x9a5b('0x13'));var qs=require(_0x9a5b('0x14'));var as=require(_0x9a5b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a5b('0x16'))(_0x9a5b('0x17'));var utils=require(_0x9a5b('0x18'));var config=require(_0x9a5b('0x19'));var licenseUtil=require(_0x9a5b('0x1a'));var db=require(_0x9a5b('0x1b'))['db'];var integrations=require(_0x9a5b('0x1c'));var jayson=require('jayson/promise');var client=jayson[_0x9a5b('0x1d')][_0x9a5b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1fb4a9,_0x36b488,_0x7c369c,_0x19cb68){return new BPromise(function(_0x1a5c5a,_0x543c56){var _0x1210fc=_0x19cb68||client;return _0x1210fc[_0x9a5b('0x1f')](_0x1fb4a9,_0x7c369c)[_0x9a5b('0x20')](function(_0x2d2ddb){logger[_0x9a5b('0x21')](_0x9a5b('0x22'),_0x36b488,_0x9a5b('0x23'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x36b488,_0x9a5b('0x23'),JSON[_0x9a5b('0x24')](_0x2d2ddb));if(_0x2d2ddb[_0x9a5b('0x25')]){if(_0x2d2ddb[_0x9a5b('0x25')]['code']===0x1f4){logger[_0x9a5b('0x25')](_0x9a5b('0x22'),_0x36b488,_0x2d2ddb[_0x9a5b('0x25')][_0x9a5b('0x26')]);return _0x543c56(_0x2d2ddb['error'][_0x9a5b('0x26')]);}logger[_0x9a5b('0x25')](_0x9a5b('0x22'),_0x36b488,_0x2d2ddb['error'][_0x9a5b('0x26')]);return _0x1a5c5a(_0x2d2ddb[_0x9a5b('0x25')]['message']);}else{logger[_0x9a5b('0x21')](_0x9a5b('0x22'),_0x36b488,_0x9a5b('0x23'));_0x1a5c5a(_0x2d2ddb[_0x9a5b('0x27')]['message']);}})[_0x9a5b('0x28')](function(_0x21aa87){logger[_0x9a5b('0x25')](_0x9a5b('0x22'),_0x36b488,_0x21aa87);_0x543c56(_0x21aa87);});});}function respondWithStatusCode(_0xf9b2fd,_0x5298c0){_0x5298c0=_0x5298c0||0xcc;return function(_0x4d778d){if(_0x4d778d){return _0xf9b2fd[_0x9a5b('0x29')](_0x5298c0);}return _0xf9b2fd['status'](_0x5298c0)['end']();};}function respondWithResult(_0x4ea1e2,_0x509f13){_0x509f13=_0x509f13||0xc8;return function(_0x4c264a){if(_0x4c264a){return _0x4ea1e2['status'](_0x509f13)[_0x9a5b('0x2a')](_0x4c264a);}};}function respondWithFilteredResult(_0x5113f6,_0x21c700){return function(_0x13e9dc){if(_0x13e9dc){var _0x125ad8=_0x13e9dc[_0x9a5b('0x2b')],_0x4bbe80=_0x21c700[_0x9a5b('0x2c')],_0x23dc25=_0x21c700['offset']+_0x21c700[_0x9a5b('0x2d')],_0xd59643;if(_0x23dc25>=_0x125ad8){_0x23dc25=_0x125ad8;_0xd59643=0xc8;}else{_0xd59643=0xce;}_0x5113f6['status'](_0xd59643);return _0x5113f6[_0x9a5b('0x2e')](_0x9a5b('0x2f'),_0x4bbe80+'-'+_0x23dc25+'/'+_0x125ad8)['json'](_0x13e9dc);}return null;};}function patchUpdates(_0x1b637f){return function(_0x498ef1){try{jsonpatch[_0x9a5b('0x30')](_0x498ef1,_0x1b637f,!![]);}catch(_0x4cb9bd){return BPromise[_0x9a5b('0x31')](_0x4cb9bd);}return _0x498ef1[_0x9a5b('0x32')]();};}function saveUpdates(_0x1c58f9,_0x28cc91){return function(_0x94ada9){if(_0x94ada9){return _0x94ada9[_0x9a5b('0x33')](_0x1c58f9)[_0x9a5b('0x20')](function(_0x1ac478){return _0x1ac478;});}return null;};}function removeEntity(_0x202570,_0x56bec6){return function(_0x4f66b6){if(_0x4f66b6){return _0x4f66b6[_0x9a5b('0x34')]()[_0x9a5b('0x20')](function(){_0x202570['status'](0xcc)[_0x9a5b('0x35')]();});}};}function handleEntityNotFound(_0x13f3dc,_0x4b4d1b){return function(_0x39312a){if(!_0x39312a){_0x13f3dc['sendStatus'](0x194);}return _0x39312a;};}function handleError(_0x2506a5,_0xb2ec9e){_0xb2ec9e=_0xb2ec9e||0x1f4;return function(_0x2e077f){logger[_0x9a5b('0x25')](_0x2e077f[_0x9a5b('0x36')]);if(_0x2e077f[_0x9a5b('0x37')]){delete _0x2e077f[_0x9a5b('0x37')];}_0x2506a5[_0x9a5b('0x38')](_0xb2ec9e)[_0x9a5b('0x39')](_0x2e077f);};}exports[_0x9a5b('0x3a')]=function(_0x2c4ed8,_0x4cd2ce){var _0x3efb11={},_0x399c73={},_0x1e855d={'count':0x0,'rows':[]};var _0x4c9298=_[_0x9a5b('0x3b')](db['ZohoAccount'][_0x9a5b('0x3c')],function(_0x137a9e){return{'name':_0x137a9e['fieldName'],'type':_0x137a9e['type'][_0x9a5b('0x3d')]};});_0x399c73[_0x9a5b('0x3e')]=_[_0x9a5b('0x3b')](_0x4c9298,'name');_0x399c73[_0x9a5b('0x3f')]=_[_0x9a5b('0x40')](_0x2c4ed8[_0x9a5b('0x3f')]);_0x399c73[_0x9a5b('0x41')]=_[_0x9a5b('0x42')](_0x399c73[_0x9a5b('0x3e')],_0x399c73[_0x9a5b('0x3f')]);_0x3efb11[_0x9a5b('0x43')]=_[_0x9a5b('0x42')](_0x399c73['model'],qs[_0x9a5b('0x44')](_0x2c4ed8['query'][_0x9a5b('0x44')]));_0x3efb11['attributes']=_0x3efb11['attributes']['length']?_0x3efb11['attributes']:_0x399c73[_0x9a5b('0x3e')];if(!_0x2c4ed8[_0x9a5b('0x3f')]['hasOwnProperty'](_0x9a5b('0x45'))){_0x3efb11[_0x9a5b('0x2d')]=qs[_0x9a5b('0x2d')](_0x2c4ed8[_0x9a5b('0x3f')][_0x9a5b('0x2d')]);_0x3efb11[_0x9a5b('0x2c')]=qs['offset'](_0x2c4ed8[_0x9a5b('0x3f')][_0x9a5b('0x2c')]);}_0x3efb11[_0x9a5b('0x46')]=qs[_0x9a5b('0x47')](_0x2c4ed8[_0x9a5b('0x3f')]['sort']);_0x3efb11[_0x9a5b('0x48')]=qs[_0x9a5b('0x41')](_[_0x9a5b('0x49')](_0x2c4ed8[_0x9a5b('0x3f')],_0x399c73['filters']),_0x4c9298);if(_0x2c4ed8[_0x9a5b('0x3f')][_0x9a5b('0x4a')]){_0x3efb11[_0x9a5b('0x48')]=_['merge'](_0x3efb11[_0x9a5b('0x48')],{'$or':_[_0x9a5b('0x3b')](_0x4c9298,function(_0x69687c){if(_0x69687c['type']!=='VIRTUAL'){var _0x32acf6={};_0x32acf6[_0x69687c[_0x9a5b('0x37')]]={'$like':'%'+_0x2c4ed8[_0x9a5b('0x3f')][_0x9a5b('0x4a')]+'%'};return _0x32acf6;}})});}_0x3efb11=_[_0x9a5b('0x4b')]({},_0x3efb11,_0x2c4ed8['options']);var _0x2b6d35={'where':_0x3efb11[_0x9a5b('0x48')]};return db['ZohoAccount'][_0x9a5b('0x2b')](_0x2b6d35)['then'](function(_0x1b121b){_0x1e855d[_0x9a5b('0x2b')]=_0x1b121b;if(_0x2c4ed8['query'][_0x9a5b('0x4c')]){_0x3efb11[_0x9a5b('0x4d')]=[{'all':!![]}];}return db['ZohoAccount'][_0x9a5b('0x4e')](_0x3efb11);})[_0x9a5b('0x20')](function(_0x1efc27){_0x1e855d['rows']=_0x1efc27;return _0x1e855d;})['then'](respondWithFilteredResult(_0x4cd2ce,_0x3efb11))['catch'](handleError(_0x4cd2ce,null));};exports[_0x9a5b('0x4f')]=function(_0x1f893e,_0x33afeb){var _0x13a7b1={'raw':![],'where':{'id':_0x1f893e[_0x9a5b('0x50')]['id']}},_0x2d64b7={};_0x2d64b7[_0x9a5b('0x3e')]=_[_0x9a5b('0x40')](db[_0x9a5b('0x51')][_0x9a5b('0x3c')]);_0x2d64b7['query']=_[_0x9a5b('0x40')](_0x1f893e[_0x9a5b('0x3f')]);_0x2d64b7[_0x9a5b('0x41')]=_['intersection'](_0x2d64b7[_0x9a5b('0x3e')],_0x2d64b7['query']);_0x13a7b1[_0x9a5b('0x43')]=_['intersection'](_0x2d64b7[_0x9a5b('0x3e')],qs[_0x9a5b('0x44')](_0x1f893e[_0x9a5b('0x3f')]['fields']));_0x13a7b1[_0x9a5b('0x43')]=_0x13a7b1[_0x9a5b('0x43')]['length']?_0x13a7b1[_0x9a5b('0x43')]:_0x2d64b7[_0x9a5b('0x3e')];if(_0x1f893e[_0x9a5b('0x3f')][_0x9a5b('0x4c')]){_0x13a7b1[_0x9a5b('0x4d')]=[{'all':!![]}];}_0x13a7b1=_[_0x9a5b('0x4b')]({},_0x13a7b1,_0x1f893e['options']);return db[_0x9a5b('0x51')][_0x9a5b('0x52')](_0x13a7b1)[_0x9a5b('0x20')](handleEntityNotFound(_0x33afeb,null))['then'](respondWithResult(_0x33afeb,null))[_0x9a5b('0x28')](handleError(_0x33afeb,null));};exports['create']=function(_0x12d815,_0x3aaa98){return db['ZohoAccount'][_0x9a5b('0x53')](_0x12d815['body'],{})[_0x9a5b('0x20')](respondWithResult(_0x3aaa98,0xc9))[_0x9a5b('0x28')](handleError(_0x3aaa98,null));};exports['update']=function(_0x460e21,_0x136bf6){if(_0x460e21[_0x9a5b('0x54')]['id']){delete _0x460e21[_0x9a5b('0x54')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x460e21[_0x9a5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x136bf6,null))[_0x9a5b('0x20')](saveUpdates(_0x460e21[_0x9a5b('0x54')],null))['then'](respondWithResult(_0x136bf6,null))[_0x9a5b('0x28')](handleError(_0x136bf6,null));};exports[_0x9a5b('0x34')]=function(_0x21fcd0,_0x2c9bb6){return db[_0x9a5b('0x51')]['find']({'where':{'id':_0x21fcd0[_0x9a5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c9bb6,null))[_0x9a5b('0x20')](removeEntity(_0x2c9bb6,null))[_0x9a5b('0x28')](handleError(_0x2c9bb6,null));};exports['getConfigurations']=function(_0x5de7cc,_0x3e3300,_0x26e246){var _0x306c76={};var _0xc0343b={};var _0x4ed565;var _0x3ac114;return db[_0x9a5b('0x51')][_0x9a5b('0x55')]({'where':{'id':_0x5de7cc[_0x9a5b('0x50')]['id']}})[_0x9a5b('0x20')](handleEntityNotFound(_0x3e3300,null))['then'](function(_0x51ed30){if(_0x51ed30){_0x4ed565=_0x51ed30;_0xc0343b[_0x9a5b('0x3e')]=_['keys'](db[_0x9a5b('0x56')][_0x9a5b('0x3c')]);_0xc0343b[_0x9a5b('0x3f')]=_['keys'](_0x5de7cc[_0x9a5b('0x3f')]);_0xc0343b[_0x9a5b('0x41')]=_[_0x9a5b('0x42')](_0xc0343b['model'],_0xc0343b[_0x9a5b('0x3f')]);_0x306c76[_0x9a5b('0x43')]=_[_0x9a5b('0x42')](_0xc0343b[_0x9a5b('0x3e')],qs['fields'](_0x5de7cc['query']['fields']));_0x306c76[_0x9a5b('0x43')]=_0x306c76[_0x9a5b('0x43')][_0x9a5b('0x57')]?_0x306c76[_0x9a5b('0x43')]:_0xc0343b[_0x9a5b('0x3e')];_0x306c76['order']=qs[_0x9a5b('0x47')](_0x5de7cc[_0x9a5b('0x3f')][_0x9a5b('0x47')]);_0x306c76[_0x9a5b('0x48')]=qs[_0x9a5b('0x41')](_[_0x9a5b('0x49')](_0x5de7cc[_0x9a5b('0x3f')],_0xc0343b[_0x9a5b('0x41')]));if(_0x5de7cc[_0x9a5b('0x3f')][_0x9a5b('0x4a')]){_0x306c76[_0x9a5b('0x48')]=_[_0x9a5b('0x4b')](_0x306c76['where'],{'$or':_[_0x9a5b('0x3b')](_0x306c76['attributes'],function(_0x203bfb){var _0x337742={};_0x337742[_0x203bfb]={'$like':'%'+_0x5de7cc['query']['filter']+'%'};return _0x337742;})});}_0x306c76=_[_0x9a5b('0x4b')]({},_0x306c76,_0x5de7cc[_0x9a5b('0x58')]);return _0x4ed565[_0x9a5b('0x59')](_0x306c76);}})[_0x9a5b('0x20')](function(_0x57dbf7){if(_0x57dbf7){_0x3ac114=_0x57dbf7['length'];if(!_0x5de7cc[_0x9a5b('0x3f')]['hasOwnProperty']('nolimit')){_0x306c76[_0x9a5b('0x2d')]=qs['limit'](_0x5de7cc[_0x9a5b('0x3f')][_0x9a5b('0x2d')]);_0x306c76[_0x9a5b('0x2c')]=qs[_0x9a5b('0x2c')](_0x5de7cc['query']['offset']);}return _0x4ed565[_0x9a5b('0x59')](_0x306c76);}})[_0x9a5b('0x20')](function(_0x5d85cd){if(_0x5d85cd){return _0x5d85cd?{'count':_0x3ac114,'rows':_0x5d85cd}:null;}})['then'](respondWithResult(_0x3e3300,null))[_0x9a5b('0x28')](handleError(_0x3e3300,null));};exports[_0x9a5b('0x5a')]=function(_0x500391,_0x497b1b,_0x679934){if(_0x500391[_0x9a5b('0x54')]['id']){delete _0x500391[_0x9a5b('0x54')]['id'];}return db[_0x9a5b('0x51')][_0x9a5b('0x55')]({'where':{'id':_0x500391['params']['id']}})['then'](handleEntityNotFound(_0x497b1b,null))['then'](function(_0x2e2d00){if(_0x2e2d00){_0x500391[_0x9a5b('0x54')][_0x9a5b('0x5b')]=_0x2e2d00['id'];_0x500391[_0x9a5b('0x54')]['Subjects']=integrations[_0x9a5b('0x5c')](_0x500391[_0x9a5b('0x54')][_0x9a5b('0x5d')],_0x500391['body'][_0x9a5b('0x5e')]);_0x500391[_0x9a5b('0x54')][_0x9a5b('0x5f')]=integrations['getDescriptions'](_0x500391['body']['channel'],_0x500391[_0x9a5b('0x54')][_0x9a5b('0x5e')]);return db[_0x9a5b('0x56')][_0x9a5b('0x53')](_0x500391[_0x9a5b('0x54')],{'include':[{'model':db[_0x9a5b('0x60')],'as':'Subjects'},{'model':db[_0x9a5b('0x60')],'as':_0x9a5b('0x5f')}]});}return null;})['then'](respondWithResult(_0x497b1b,null))[_0x9a5b('0x28')](handleError(_0x497b1b,null));};function getAccessToken(_0x44d994){return new Promise(function(_0x40ac8c,_0x252084){var _0x185f7a;switch(_0x44d994[_0x9a5b('0x61')]){case'US':_0x185f7a=_0x9a5b('0x62');break;case'AU':_0x185f7a='https://accounts.zoho.com.au';break;case'EU':_0x185f7a=_0x9a5b('0x63');break;case'IN':_0x185f7a=_0x9a5b('0x64');break;case'CN':_0x185f7a=_0x9a5b('0x65');break;default:_0x185f7a=_0x9a5b('0x63');break;}var _0x58b176={'method':_0x9a5b('0x66'),'uri':_0x185f7a+_0x9a5b('0x67'),'qs':{'refresh_token':_0x44d994['refreshToken'],'client_id':_0x44d994['clientId'],'client_secret':_0x44d994[_0x9a5b('0x68')],'grant_type':_0x9a5b('0x69')},'json':!![]};return rp(_0x58b176)[_0x9a5b('0x20')](function(_0x412ae1){if(_0x412ae1[_0x9a5b('0x6a')]){_0x40ac8c(_0x412ae1[_0x9a5b('0x6a')]);}else{_0x252084(_0x9a5b('0x6b'));}})[_0x9a5b('0x28')](function(_0x4dc491){_0x252084(_0x4dc491);});});}exports[_0x9a5b('0x6c')]=function(_0x48c693,_0x2cc771,_0x15656f){var _0x34eb6e,_0x4aa3d6,_0x2e0b25,_0x487a27,_0x2d480c;return db[_0x9a5b('0x51')][_0x9a5b('0x55')]({'where':{'id':_0x48c693[_0x9a5b('0x50')]['id']},'attributes':['id',_0x9a5b('0x6d'),_0x9a5b('0x61'),_0x9a5b('0x6e'),_0x9a5b('0x68'),_0x9a5b('0x6f'),'code','refreshToken']})[_0x9a5b('0x20')](handleEntityNotFound(_0x2cc771,null))['then'](function(_0xf2a352){_0x2d480c=_0xf2a352;_0x34eb6e=_0x2d480c[_0x9a5b('0x6d')];_0x4aa3d6=_0x34eb6e===_0x9a5b('0x70')?'eu':_0x9a5b('0x71');_0x2e0b25=_0x2d480c['serverUrl'];var _0x1dde70=_0x2e0b25[_0x9a5b('0x72')](-0x1);if(_0x1dde70==='/'||_0x1dde70==='\x5c'||_0x1dde70===':'){_0x2e0b25=_0x2e0b25[_0x9a5b('0x73')](0x0,_0x2e0b25[_0x9a5b('0x74')](_0x1dde70));}if(!_0x2d480c['refreshToken']){throw new Error(_0x9a5b('0x75'));}return getAccessToken(_0x2d480c);})['then'](function(_0x4db84f){if(_0x4db84f){return rp({'method':_0x9a5b('0x76'),'uri':util[_0x9a5b('0x77')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4aa3d6),'qs':{'module':_0x9a5b('0x78')},'headers':{'Authorization':_0x9a5b('0x79')+_0x4db84f},'json':!![]});}})[_0x9a5b('0x20')](function(_0x3b7e78){if(_0x3b7e78){if(_0x3b7e78[_0x9a5b('0x7a')]&&_0x3b7e78[_0x9a5b('0x7a')][_0x9a5b('0x25')]){throw new Error(_0x3b7e78[_0x9a5b('0x7a')][_0x9a5b('0x25')]['message']);}var _0x1470c8=[];var _0x39ceb7=[];var _0x4c30b3=[_0x9a5b('0x7b'),_0x9a5b('0x7c'),_0x9a5b('0x7d'),_0x9a5b('0x7e'),_0x9a5b('0x7f'),_0x9a5b('0x80'),_0x9a5b('0x81'),_0x9a5b('0x82')];_0x39ceb7=_[_0x9a5b('0x83')](_0x3b7e78[_0x9a5b('0x44')],function(_0x35b363){return _0x4c30b3[_0x9a5b('0x84')](_0x35b363['api_name']);});for(var _0x4e0078=0x0;_0x4e0078<_0x39ceb7[_0x9a5b('0x57')];_0x4e0078++){if(_0x39ceb7[_0x4e0078][_0x9a5b('0x85')]===![]){_0x1470c8[_0x9a5b('0x86')]({'id':_0x39ceb7[_0x4e0078]['id'],'name':_0x39ceb7[_0x4e0078]['display_label'],'custom':_0x39ceb7[_0x4e0078][_0x9a5b('0x87')],'options':_0x39ceb7[_0x4e0078][_0x9a5b('0x88')]===_0x9a5b('0x89')&&_0x39ceb7[_0x4e0078][_0x9a5b('0x8a')][_0x9a5b('0x57')]>-0x1?_[_0x9a5b('0x3b')](_0x39ceb7[_0x4e0078][_0x9a5b('0x8a')],function(_0x18c18c){return{'name':_0x18c18c,'value':_0x18c18c};}):[]});}}return{'count':_0x1470c8['length'],'rows':_0x1470c8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2cc771,null))[_0x9a5b('0x28')](function(_0x3fbad0){var _0x55f38c=_0x48c693[_0x9a5b('0x3f')][_0x9a5b('0x8b')]?0x1f4:_0x3fbad0[_0x9a5b('0x8c')]||0x1f4;logger[_0x9a5b('0x25')](_0x9a5b('0x8d'),_0x9a5b('0x6c'),_0x55f38c,JSON[_0x9a5b('0x24')](_0x3fbad0));delete _0x3fbad0['name'];if(_0x55f38c===0x191){_0x55f38c=0x190;}_0x2cc771[_0x9a5b('0x38')](_0x55f38c)['send'](_0x48c693[_0x9a5b('0x3f')][_0x9a5b('0x8b')]?{'message':_0x9a5b('0x8e'),'statusCode':_0x3fbad0[_0x9a5b('0x8c')]}:_0x3fbad0);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4e66701..9e9cae9 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 _0x92a2=['zone','serverUrl','clientId','clientSecret','code','slice','substring','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','name','inspect','https://accounts.zoho.com.au','authorization_code','then','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed'];(function(_0x5ba8ea,_0xbb9234){var _0x47e1af=function(_0x227596){while(--_0x227596){_0x5ba8ea['push'](_0x5ba8ea['shift']());}};_0x47e1af(++_0xbb9234);}(_0x92a2,0xb5));var _0x292a=function(_0x573444,_0x15d023){_0x573444=_0x573444-0x0;var _0x123c93=_0x92a2[_0x573444];return _0x123c93;};'use strict';var _=require(_0x292a('0x0'));var util=require(_0x292a('0x1'));var logger=require('../../config/logger')(_0x292a('0x2'));var moment=require(_0x292a('0x3'));var BPromise=require('bluebird');var rp=require(_0x292a('0x4'));var fs=require('fs');var path=require(_0x292a('0x5'));var rimraf=require(_0x292a('0x6'));var config=require(_0x292a('0x7'));var attributes=require(_0x292a('0x8'));var integrations=require(_0x292a('0x9'));module[_0x292a('0xa')]=function(_0x41c250,_0x13491d){return _0x41c250[_0x292a('0xb')](_0x292a('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4036b2,_0x55dd99,_0x15b150){if(_0x4036b2[_0x292a('0xd')](_0x292a('0xe'))||_0x4036b2[_0x292a('0xd')](_0x292a('0xf'))||_0x4036b2[_0x292a('0xd')](_0x292a('0x10'))||_0x4036b2[_0x292a('0xd')](_0x292a('0x11'))||_0x4036b2[_0x292a('0xd')](_0x292a('0x12'))||_0x4036b2[_0x292a('0xd')]('host')){var _0x5ac98e,_0x16d519;_0x5ac98e=_0x4036b2[_0x292a('0xf')];var _0x24056c=_0x5ac98e[_0x292a('0x13')](-0x1);if(_0x24056c==='/'||_0x24056c==='\x5c'||_0x24056c===':'){_0x5ac98e=_0x5ac98e[_0x292a('0x14')](0x0,_0x5ac98e['lastIndexOf'](_0x24056c));}switch(_0x4036b2[_0x292a('0xe')]){case'US':_0x16d519='https://accounts.zoho.com';break;case'AU':_0x16d519='https://accounts.zoho.com.au';break;case'IN':_0x16d519='https://accounts.zoho.in';break;case'CN':_0x16d519=_0x292a('0x15');break;default:_0x16d519=_0x292a('0x16');break;}var _0x7fec61={'method':_0x292a('0x17'),'uri':_0x16d519+_0x292a('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x4036b2[_0x292a('0x10')],'client_secret':_0x4036b2['clientSecret'],'redirect_uri':_0x4036b2[_0x292a('0xf')],'code':_0x4036b2[_0x292a('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x7fec61)['then'](function(_0x3f83aa){var _0x168b22=JSON[_0x292a('0x19')](_0x3f83aa);if(_0x168b22[_0x292a('0x1a')]){_0x4036b2[_0x292a('0x1b')]=_0x168b22['refresh_token'];logger[_0x292a('0x1c')](util['format'](_0x292a('0x1d'),_0x4036b2['name'],_0x4036b2['id']));}else{logger[_0x292a('0x1e')](util[_0x292a('0x1f')](_0x292a('0x20'),_0x4036b2['name'],_0x4036b2['id']),util['inspect'](_0x168b22,{'showHidden':![],'depth':null}));}return _0x15b150(null,_0x55dd99);})[_0x292a('0x21')](function(_0x55db32){logger[_0x292a('0x1e')](util[_0x292a('0x1f')](_0x292a('0x20'),_0x4036b2[_0x292a('0x22')],_0x4036b2['id']),util[_0x292a('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x15b150(_0x55db32);});}else{return _0x15b150(null,_0x55dd99);}},'beforeUpdate':function(_0x2f9d6e,_0x49fb89,_0x146162){if(_0x2f9d6e['changed'](_0x292a('0xe'))||_0x2f9d6e[_0x292a('0xd')](_0x292a('0xf'))||_0x2f9d6e[_0x292a('0xd')]('clientId')||_0x2f9d6e[_0x292a('0xd')](_0x292a('0x11'))||_0x2f9d6e[_0x292a('0xd')](_0x292a('0x12'))||_0x2f9d6e[_0x292a('0xd')]('host')){var _0x582d9c,_0x5cb304;_0x582d9c=_0x2f9d6e[_0x292a('0xf')];var _0x5b7f9f=_0x582d9c[_0x292a('0x13')](-0x1);if(_0x5b7f9f==='/'||_0x5b7f9f==='\x5c'||_0x5b7f9f===':'){_0x582d9c=_0x582d9c[_0x292a('0x14')](0x0,_0x582d9c['lastIndexOf'](_0x5b7f9f));}switch(_0x2f9d6e['zone']){case'US':_0x5cb304='https://accounts.zoho.com';break;case'AU':_0x5cb304=_0x292a('0x24');break;case'IN':_0x5cb304='https://accounts.zoho.in';break;case'CN':_0x5cb304='https://accounts.zoho.com.cn';break;default:_0x5cb304=_0x292a('0x16');break;}var _0x18fac0={'method':_0x292a('0x17'),'uri':_0x5cb304+_0x292a('0x18'),'form':{'grant_type':_0x292a('0x25'),'client_id':_0x2f9d6e[_0x292a('0x10')],'client_secret':_0x2f9d6e[_0x292a('0x11')],'redirect_uri':_0x2f9d6e[_0x292a('0xf')],'code':_0x2f9d6e['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x18fac0)[_0x292a('0x26')](function(_0x3d6e59){var _0x427744=JSON[_0x292a('0x19')](_0x3d6e59);if(_0x427744[_0x292a('0x1a')]){_0x2f9d6e['refreshToken']=_0x427744['refresh_token'];logger[_0x292a('0x1c')](util[_0x292a('0x1f')](_0x292a('0x1d'),_0x2f9d6e['name'],_0x2f9d6e['id']));}else{logger[_0x292a('0x1e')](util[_0x292a('0x1f')](_0x292a('0x20'),_0x2f9d6e[_0x292a('0x22')],_0x2f9d6e['id']),util['inspect'](_0x427744,{'showHidden':![],'depth':null}));}return _0x146162(null,_0x49fb89);})[_0x292a('0x21')](function(_0x4a3f0d){logger[_0x292a('0x1e')](util[_0x292a('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2f9d6e[_0x292a('0x22')],_0x2f9d6e['id']),util[_0x292a('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x146162(_0x4a3f0d);});}else{return _0x146162(null,_0x49fb89);}}}});}; \ No newline at end of file +var _0x2953=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','zone','changed','serverUrl','clientId','clientSecret','code','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.in','catch'];(function(_0x434658,_0x1d4d6b){var _0x37e5b5=function(_0x3f11a0){while(--_0x3f11a0){_0x434658['push'](_0x434658['shift']());}};_0x37e5b5(++_0x1d4d6b);}(_0x2953,0x12d));var _0x3295=function(_0x35f035,_0x4e66c6){_0x35f035=_0x35f035-0x0;var _0x1b4ef3=_0x2953[_0x35f035];return _0x1b4ef3;};'use strict';var _=require(_0x3295('0x0'));var util=require(_0x3295('0x1'));var logger=require(_0x3295('0x2'))(_0x3295('0x3'));var moment=require(_0x3295('0x4'));var BPromise=require(_0x3295('0x5'));var rp=require(_0x3295('0x6'));var fs=require('fs');var path=require(_0x3295('0x7'));var rimraf=require(_0x3295('0x8'));var config=require(_0x3295('0x9'));var attributes=require(_0x3295('0xa'));var integrations=require(_0x3295('0xb'));module[_0x3295('0xc')]=function(_0x8badf4,_0x307eb1){return _0x8badf4[_0x3295('0xd')](_0x3295('0xe'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x376405,_0x307d8f,_0x547578){if(_0x376405['changed'](_0x3295('0xf'))||_0x376405[_0x3295('0x10')](_0x3295('0x11'))||_0x376405['changed'](_0x3295('0x12'))||_0x376405['changed'](_0x3295('0x13'))||_0x376405[_0x3295('0x10')](_0x3295('0x14'))||_0x376405[_0x3295('0x10')]('host')){var _0x1067e1,_0x447c00;_0x1067e1=_0x376405[_0x3295('0x11')];var _0x422030=_0x1067e1['slice'](-0x1);if(_0x422030==='/'||_0x422030==='\x5c'||_0x422030===':'){_0x1067e1=_0x1067e1[_0x3295('0x15')](0x0,_0x1067e1[_0x3295('0x16')](_0x422030));}switch(_0x376405['zone']){case'US':_0x447c00='https://accounts.zoho.com';break;case'AU':_0x447c00=_0x3295('0x17');break;case'IN':_0x447c00='https://accounts.zoho.in';break;case'CN':_0x447c00=_0x3295('0x18');break;default:_0x447c00=_0x3295('0x19');break;}var _0x29d97b={'method':_0x3295('0x1a'),'uri':_0x447c00+_0x3295('0x1b'),'form':{'grant_type':_0x3295('0x1c'),'client_id':_0x376405['clientId'],'client_secret':_0x376405[_0x3295('0x13')],'redirect_uri':_0x376405['serverUrl'],'code':_0x376405['code']},'headers':{'Content-Type':_0x3295('0x1d')}};return rp(_0x29d97b)[_0x3295('0x1e')](function(_0x112734){var _0x4e1d6e=JSON[_0x3295('0x1f')](_0x112734);if(_0x4e1d6e['refresh_token']){_0x376405[_0x3295('0x20')]=_0x4e1d6e[_0x3295('0x21')];logger[_0x3295('0x22')](util['format'](_0x3295('0x23'),_0x376405[_0x3295('0x24')],_0x376405['id']));}else{logger[_0x3295('0x25')](util[_0x3295('0x26')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x376405[_0x3295('0x24')],_0x376405['id']),util[_0x3295('0x27')](_0x4e1d6e,{'showHidden':![],'depth':null}));}return _0x547578(null,_0x307d8f);})['catch'](function(_0x5291f2){logger[_0x3295('0x25')](util['format'](_0x3295('0x28'),_0x376405[_0x3295('0x24')],_0x376405['id']),util[_0x3295('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x547578(_0x5291f2);});}else{return _0x547578(null,_0x307d8f);}},'beforeUpdate':function(_0x376a3f,_0x3be983,_0x50f43e){if(_0x376a3f[_0x3295('0x10')](_0x3295('0xf'))||_0x376a3f[_0x3295('0x10')](_0x3295('0x11'))||_0x376a3f['changed'](_0x3295('0x12'))||_0x376a3f[_0x3295('0x10')](_0x3295('0x13'))||_0x376a3f[_0x3295('0x10')](_0x3295('0x14'))||_0x376a3f[_0x3295('0x10')]('host')){var _0x2246b6,_0x5526c9;_0x2246b6=_0x376a3f['serverUrl'];var _0xab3a7d=_0x2246b6['slice'](-0x1);if(_0xab3a7d==='/'||_0xab3a7d==='\x5c'||_0xab3a7d===':'){_0x2246b6=_0x2246b6['substring'](0x0,_0x2246b6[_0x3295('0x16')](_0xab3a7d));}switch(_0x376a3f['zone']){case'US':_0x5526c9='https://accounts.zoho.com';break;case'AU':_0x5526c9=_0x3295('0x17');break;case'IN':_0x5526c9=_0x3295('0x29');break;case'CN':_0x5526c9=_0x3295('0x18');break;default:_0x5526c9='https://accounts.zoho.eu';break;}var _0x37da74={'method':_0x3295('0x1a'),'uri':_0x5526c9+'/oauth/v2/token','form':{'grant_type':_0x3295('0x1c'),'client_id':_0x376a3f[_0x3295('0x12')],'client_secret':_0x376a3f[_0x3295('0x13')],'redirect_uri':_0x376a3f[_0x3295('0x11')],'code':_0x376a3f[_0x3295('0x14')]},'headers':{'Content-Type':_0x3295('0x1d')}};return rp(_0x37da74)['then'](function(_0x31b0a8){var _0x163e3f=JSON[_0x3295('0x1f')](_0x31b0a8);if(_0x163e3f[_0x3295('0x21')]){_0x376a3f[_0x3295('0x20')]=_0x163e3f[_0x3295('0x21')];logger['info'](util['format'](_0x3295('0x23'),_0x376a3f[_0x3295('0x24')],_0x376a3f['id']));}else{logger[_0x3295('0x25')](util[_0x3295('0x26')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x376a3f[_0x3295('0x24')],_0x376a3f['id']),util[_0x3295('0x27')](_0x163e3f,{'showHidden':![],'depth':null}));}return _0x50f43e(null,_0x3be983);})[_0x3295('0x2a')](function(_0x3f73aa){logger[_0x3295('0x25')](util[_0x3295('0x26')](_0x3295('0x28'),_0x376a3f['name'],_0x376a3f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x50f43e(_0x3f73aa);});}else{return _0x50f43e(null,_0x3be983);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 561c62c..19cd45e 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 _0x21bd=['rpc','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','findAll','options','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x33a0fd,_0x4349ad){var _0x3184ee=function(_0x5cd8d0){while(--_0x5cd8d0){_0x33a0fd['push'](_0x33a0fd['shift']());}};_0x3184ee(++_0x4349ad);}(_0x21bd,0x157));var _0xd21b=function(_0x36c3ea,_0x2bc427){_0x36c3ea=_0x36c3ea-0x0;var _0x26a30a=_0x21bd[_0x36c3ea];return _0x26a30a;};'use strict';var _=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var moment=require(_0xd21b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd21b('0x3'));var fs=require('fs');var Redis=require(_0xd21b('0x4'));var db=require(_0xd21b('0x5'))['db'];var utils=require(_0xd21b('0x6'));var logger=require('../../config/logger')(_0xd21b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd21b('0x8')][_0xd21b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55bf09,_0x3faa25,_0x4034a5){return new BPromise(function(_0x2eeabb,_0x59154d){return client[_0xd21b('0xa')](_0x55bf09,_0x4034a5)[_0xd21b('0xb')](function(_0x20702d){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x3faa25,_0xd21b('0xc'));logger[_0xd21b('0xd')](_0xd21b('0xe'),_0x3faa25,'request\x20sent',JSON[_0xd21b('0xf')](_0x20702d));if(_0x20702d['error']){if(_0x20702d[_0xd21b('0x10')][_0xd21b('0x11')]===0x1f4){logger[_0xd21b('0x10')](_0xd21b('0x12'),_0x3faa25,_0x20702d[_0xd21b('0x10')][_0xd21b('0x13')]);return _0x59154d(_0x20702d[_0xd21b('0x10')]['message']);}logger[_0xd21b('0x10')](_0xd21b('0x12'),_0x3faa25,_0x20702d[_0xd21b('0x10')][_0xd21b('0x13')]);return _0x2eeabb(_0x20702d['error'][_0xd21b('0x13')]);}else{logger[_0xd21b('0x14')](_0xd21b('0x12'),_0x3faa25,_0xd21b('0xc'));_0x2eeabb(_0x20702d[_0xd21b('0x15')][_0xd21b('0x13')]);}})[_0xd21b('0x16')](function(_0x43e12e){logger['error'](_0xd21b('0x12'),_0x3faa25,_0x43e12e);_0x59154d(_0x43e12e);});});}exports['GetZohoAccount']=function(_0x4fe2e2){var _0x242c61=this;return new Promise(function(_0x1a6607,_0x3ab047){return db['ZohoAccount'][_0xd21b('0x17')]({'raw':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2[_0xd21b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2[_0xd21b('0x18')][_0xd21b('0x19')]||null:null,'attributes':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2['options'][_0xd21b('0x1a')]||null:null,'limit':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2['options'][_0xd21b('0x1b')]||null:null,'include':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2[_0xd21b('0x18')][_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x4fe2e2[_0xd21b('0x18')][_0xd21b('0x1c')],function(_0x5c4893){return{'model':db[_0x5c4893['model']],'as':_0x5c4893['as'],'attributes':_0x5c4893[_0xd21b('0x1a')],'include':_0x5c4893[_0xd21b('0x1c')]?_['map'](_0x5c4893[_0xd21b('0x1c')],function(_0x5ac946){return{'model':db[_0x5ac946['model']],'as':_0x5ac946['as'],'attributes':_0x5ac946[_0xd21b('0x1a')],'include':_0x5ac946[_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x5ac946['include'],function(_0x29a7d3){return{'model':db[_0x29a7d3[_0xd21b('0x1e')]],'as':_0x29a7d3['as'],'attributes':_0x29a7d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xd21b('0xb')](function(_0x3b5abd){logger[_0xd21b('0x14')](_0xd21b('0x1f'),_0x4fe2e2);logger['debug'](_0xd21b('0x1f'),_0x4fe2e2,JSON[_0xd21b('0xf')](_0x3b5abd));_0x1a6607(_0x3b5abd);})[_0xd21b('0x16')](function(_0x96c788){logger['error'](_0xd21b('0x1f'),_0x96c788[_0xd21b('0x13')],_0x4fe2e2);_0x3ab047(_0x242c61['error'](0x1f4,_0x96c788[_0xd21b('0x13')]));});});};exports[_0xd21b('0x20')]=function(_0x19dfdb){var _0x17b981=this;return new Promise(function(_0x26c2f9,_0x22d94f){return db['ZohoAccount'][_0xd21b('0x21')]({'raw':_0x19dfdb[_0xd21b('0x18')]?_0x19dfdb['options'][_0xd21b('0x22')]===undefined?!![]:![]:!![],'where':_0x19dfdb['options']?_0x19dfdb[_0xd21b('0x18')][_0xd21b('0x19')]||null:null,'attributes':_0x19dfdb[_0xd21b('0x18')]?_0x19dfdb['options'][_0xd21b('0x1a')]||null:null,'include':_0x19dfdb[_0xd21b('0x18')]?_0x19dfdb[_0xd21b('0x18')][_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x19dfdb[_0xd21b('0x18')][_0xd21b('0x1c')],function(_0x139d32){return{'model':db[_0x139d32[_0xd21b('0x1e')]],'as':_0x139d32['as'],'attributes':_0x139d32[_0xd21b('0x1a')],'include':_0x139d32[_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x139d32[_0xd21b('0x1c')],function(_0x4023b0){return{'model':db[_0x4023b0[_0xd21b('0x1e')]],'as':_0x4023b0['as'],'attributes':_0x4023b0[_0xd21b('0x1a')],'include':_0x4023b0[_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x4023b0[_0xd21b('0x1c')],function(_0x2f09bd){return{'model':db[_0x2f09bd[_0xd21b('0x1e')]],'as':_0x2f09bd['as'],'attributes':_0x2f09bd[_0xd21b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd21b('0xb')](function(_0x53816c){logger[_0xd21b('0x14')](_0xd21b('0x20'),_0x19dfdb);logger[_0xd21b('0xd')](_0xd21b('0x20'),_0x19dfdb,JSON[_0xd21b('0xf')](_0x53816c));_0x26c2f9(_0x53816c);})[_0xd21b('0x16')](function(_0x34167c){logger['error']('ShowZohoAccount',_0x34167c[_0xd21b('0x13')],_0x19dfdb);_0x22d94f(_0x17b981['error'](0x1f4,_0x34167c[_0xd21b('0x13')]));});});}; \ No newline at end of file +var _0xa3f7=['limit','include','map','model','GetZohoAccount','find','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ZohoAccount','findAll','options','raw','attributes'];(function(_0x4a9991,_0x2031dd){var _0x1ff74f=function(_0x2dcb7e){while(--_0x2dcb7e){_0x4a9991['push'](_0x4a9991['shift']());}};_0x1ff74f(++_0x2031dd);}(_0xa3f7,0xf5));var _0x7a3f=function(_0x5698de,_0x279942){_0x5698de=_0x5698de-0x0;var _0x6a1829=_0xa3f7[_0x5698de];return _0x6a1829;};'use strict';var _=require(_0x7a3f('0x0'));var util=require(_0x7a3f('0x1'));var moment=require(_0x7a3f('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a3f('0x3'));var fs=require('fs');var Redis=require(_0x7a3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a3f('0x5'));var logger=require('../../config/logger')(_0x7a3f('0x6'));var config=require(_0x7a3f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a3f('0x8')][_0x7a3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262e2b,_0x1dd0b5,_0x52e2fb){return new BPromise(function(_0x58a732,_0x14e130){return client['request'](_0x262e2b,_0x52e2fb)[_0x7a3f('0xa')](function(_0x4773c7){logger['info'](_0x7a3f('0xb'),_0x1dd0b5,_0x7a3f('0xc'));logger[_0x7a3f('0xd')](_0x7a3f('0xe'),_0x1dd0b5,_0x7a3f('0xc'),JSON[_0x7a3f('0xf')](_0x4773c7));if(_0x4773c7[_0x7a3f('0x10')]){if(_0x4773c7[_0x7a3f('0x10')][_0x7a3f('0x11')]===0x1f4){logger[_0x7a3f('0x10')](_0x7a3f('0xb'),_0x1dd0b5,_0x4773c7[_0x7a3f('0x10')][_0x7a3f('0x12')]);return _0x14e130(_0x4773c7[_0x7a3f('0x10')][_0x7a3f('0x12')]);}logger[_0x7a3f('0x10')](_0x7a3f('0xb'),_0x1dd0b5,_0x4773c7['error'][_0x7a3f('0x12')]);return _0x58a732(_0x4773c7[_0x7a3f('0x10')][_0x7a3f('0x12')]);}else{logger[_0x7a3f('0x13')](_0x7a3f('0xb'),_0x1dd0b5,_0x7a3f('0xc'));_0x58a732(_0x4773c7[_0x7a3f('0x14')][_0x7a3f('0x12')]);}})[_0x7a3f('0x15')](function(_0x4f83f9){logger[_0x7a3f('0x10')](_0x7a3f('0xb'),_0x1dd0b5,_0x4f83f9);_0x14e130(_0x4f83f9);});});}exports['GetZohoAccount']=function(_0x29ae4b){var _0xa2a8a1=this;return new Promise(function(_0x6d87f9,_0x46af25){return db[_0x7a3f('0x16')][_0x7a3f('0x17')]({'raw':_0x29ae4b[_0x7a3f('0x18')]?_0x29ae4b[_0x7a3f('0x18')][_0x7a3f('0x19')]===undefined?!![]:![]:!![],'where':_0x29ae4b[_0x7a3f('0x18')]?_0x29ae4b[_0x7a3f('0x18')]['where']||null:null,'attributes':_0x29ae4b['options']?_0x29ae4b['options'][_0x7a3f('0x1a')]||null:null,'limit':_0x29ae4b['options']?_0x29ae4b[_0x7a3f('0x18')][_0x7a3f('0x1b')]||null:null,'include':_0x29ae4b[_0x7a3f('0x18')]?_0x29ae4b['options'][_0x7a3f('0x1c')]?_[_0x7a3f('0x1d')](_0x29ae4b[_0x7a3f('0x18')]['include'],function(_0x15fa63){return{'model':db[_0x15fa63['model']],'as':_0x15fa63['as'],'attributes':_0x15fa63[_0x7a3f('0x1a')],'include':_0x15fa63[_0x7a3f('0x1c')]?_[_0x7a3f('0x1d')](_0x15fa63[_0x7a3f('0x1c')],function(_0x5563df){return{'model':db[_0x5563df[_0x7a3f('0x1e')]],'as':_0x5563df['as'],'attributes':_0x5563df[_0x7a3f('0x1a')],'include':_0x5563df[_0x7a3f('0x1c')]?_[_0x7a3f('0x1d')](_0x5563df['include'],function(_0x585182){return{'model':db[_0x585182[_0x7a3f('0x1e')]],'as':_0x585182['as'],'attributes':_0x585182[_0x7a3f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7a3f('0xa')](function(_0x219160){logger[_0x7a3f('0x13')](_0x7a3f('0x1f'),_0x29ae4b);logger[_0x7a3f('0xd')](_0x7a3f('0x1f'),_0x29ae4b,JSON[_0x7a3f('0xf')](_0x219160));_0x6d87f9(_0x219160);})['catch'](function(_0x392511){logger[_0x7a3f('0x10')]('GetZohoAccount',_0x392511[_0x7a3f('0x12')],_0x29ae4b);_0x46af25(_0xa2a8a1[_0x7a3f('0x10')](0x1f4,_0x392511[_0x7a3f('0x12')]));});});};exports['ShowZohoAccount']=function(_0x45008b){var _0xe3a6a8=this;return new Promise(function(_0x53cd56,_0x4c4b04){return db['ZohoAccount'][_0x7a3f('0x20')]({'raw':_0x45008b[_0x7a3f('0x18')]?_0x45008b[_0x7a3f('0x18')][_0x7a3f('0x19')]===undefined?!![]:![]:!![],'where':_0x45008b[_0x7a3f('0x18')]?_0x45008b[_0x7a3f('0x18')]['where']||null:null,'attributes':_0x45008b[_0x7a3f('0x18')]?_0x45008b[_0x7a3f('0x18')][_0x7a3f('0x1a')]||null:null,'include':_0x45008b[_0x7a3f('0x18')]?_0x45008b[_0x7a3f('0x18')][_0x7a3f('0x1c')]?_[_0x7a3f('0x1d')](_0x45008b[_0x7a3f('0x18')][_0x7a3f('0x1c')],function(_0x247971){return{'model':db[_0x247971['model']],'as':_0x247971['as'],'attributes':_0x247971['attributes'],'include':_0x247971['include']?_['map'](_0x247971[_0x7a3f('0x1c')],function(_0x4bdf18){return{'model':db[_0x4bdf18[_0x7a3f('0x1e')]],'as':_0x4bdf18['as'],'attributes':_0x4bdf18[_0x7a3f('0x1a')],'include':_0x4bdf18[_0x7a3f('0x1c')]?_[_0x7a3f('0x1d')](_0x4bdf18[_0x7a3f('0x1c')],function(_0x3fc4fa){return{'model':db[_0x3fc4fa[_0x7a3f('0x1e')]],'as':_0x3fc4fa['as'],'attributes':_0x3fc4fa[_0x7a3f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7a3f('0xa')](function(_0x17847f){logger[_0x7a3f('0x13')](_0x7a3f('0x21'),_0x45008b);logger[_0x7a3f('0xd')]('ShowZohoAccount',_0x45008b,JSON[_0x7a3f('0xf')](_0x17847f));_0x53cd56(_0x17847f);})[_0x7a3f('0x15')](function(_0x415b85){logger[_0x7a3f('0x10')](_0x7a3f('0x21'),_0x415b85[_0x7a3f('0x12')],_0x45008b);_0x4c4b04(_0xe3a6a8[_0x7a3f('0x10')](0x1f4,_0x415b85[_0x7a3f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 8ccc13c..1f44c82 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 _0x2629=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','delete'];(function(_0x3a57b0,_0x23145a){var _0x2b8f3e=function(_0x1c721a){while(--_0x1c721a){_0x3a57b0['push'](_0x3a57b0['shift']());}};_0x2b8f3e(++_0x23145a);}(_0x2629,0x84));var _0x9262=function(_0x58284c,_0x52bfa7){_0x58284c=_0x58284c-0x0;var _0x4fc8bb=_0x2629[_0x58284c];return _0x4fc8bb;};'use strict';var multer=require(_0x9262('0x0'));var util=require(_0x9262('0x1'));var path=require(_0x9262('0x2'));var timeout=require(_0x9262('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9262('0x4'));var auth=require(_0x9262('0x5'));var interaction=require(_0x9262('0x6'));var config=require(_0x9262('0x7'));var controller=require(_0x9262('0x8'));router[_0x9262('0x9')]('/',auth['isAuthenticated'](),controller[_0x9262('0xa')]);router[_0x9262('0x9')]('/:id',auth[_0x9262('0xb')](),controller[_0x9262('0xc')]);router[_0x9262('0x9')](_0x9262('0xd'),auth['isAuthenticated'](),controller[_0x9262('0xe')]);router[_0x9262('0x9')]('/:id/subjects',auth[_0x9262('0xb')](),controller[_0x9262('0xf')]);router[_0x9262('0x9')](_0x9262('0x10'),auth['isAuthenticated'](),controller[_0x9262('0x11')]);router[_0x9262('0x12')]('/',auth[_0x9262('0xb')](),controller[_0x9262('0x13')]);router['put'](_0x9262('0x14'),auth[_0x9262('0xb')](),controller['update']);router[_0x9262('0x15')]('/:id',auth[_0x9262('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe2d5=['getDescriptions','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xe2d5,0x102));var _0x5e2d=function(_0x34a6a8,_0x4be7ca){_0x34a6a8=_0x34a6a8-0x0;var _0x28e857=_0xe2d5[_0x34a6a8];return _0x28e857;};'use strict';var multer=require('multer');var util=require(_0x5e2d('0x0'));var path=require(_0x5e2d('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e2d('0x2'));var router=express[_0x5e2d('0x3')]();var fs_extra=require(_0x5e2d('0x4'));var auth=require(_0x5e2d('0x5'));var interaction=require(_0x5e2d('0x6'));var config=require(_0x5e2d('0x7'));var controller=require(_0x5e2d('0x8'));router[_0x5e2d('0x9')]('/',auth[_0x5e2d('0xa')](),controller[_0x5e2d('0xb')]);router[_0x5e2d('0x9')](_0x5e2d('0xc'),auth[_0x5e2d('0xa')](),controller[_0x5e2d('0xd')]);router[_0x5e2d('0x9')]('/:id/fields',auth[_0x5e2d('0xa')](),controller[_0x5e2d('0xe')]);router['get'](_0x5e2d('0xf'),auth[_0x5e2d('0xa')](),controller[_0x5e2d('0x10')]);router[_0x5e2d('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5e2d('0x11')]);router[_0x5e2d('0x12')]('/',auth[_0x5e2d('0xa')](),controller[_0x5e2d('0x13')]);router[_0x5e2d('0x14')]('/:id',auth[_0x5e2d('0xa')](),controller[_0x5e2d('0x15')]);router[_0x5e2d('0x16')](_0x5e2d('0xc'),auth[_0x5e2d('0xa')](),controller[_0x5e2d('0x17')]);module[_0x5e2d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 004f3d1..cbed5fe 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 _0xaefd=['contact_lead','sequelize','exports','STRING','ENUM','lead','contact','nothing'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xaefd,0x1f1));var _0xdaef=function(_0x45352d,_0x1c79f1){_0x45352d=_0x45352d-0x0;var _0xda7a70=_0xaefd[_0x45352d];return _0xda7a70;};'use strict';var Sequelize=require(_0xdaef('0x0'));module[_0xdaef('0x1')]={'name':{'type':Sequelize[_0xdaef('0x2')]},'moduleCreate':{'type':Sequelize[_0xdaef('0x3')](_0xdaef('0x4'),_0xdaef('0x5'),_0xdaef('0x6')),'defaultValue':_0xdaef('0x4')},'moduleSearch':{'type':Sequelize[_0xdaef('0x3')](_0xdaef('0x7'),'contact','lead'),'defaultValue':_0xdaef('0x7')},'description':{'type':Sequelize[_0xdaef('0x2')]}}; \ No newline at end of file +var _0x574e=['lead','nothing','contact','sequelize','exports','STRING','ENUM'];(function(_0x20fbd5,_0x548e19){var _0x1bf745=function(_0x1ff7c3){while(--_0x1ff7c3){_0x20fbd5['push'](_0x20fbd5['shift']());}};_0x1bf745(++_0x548e19);}(_0x574e,0x153));var _0xe574=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x574e[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0xe574('0x0'));module[_0xe574('0x1')]={'name':{'type':Sequelize[_0xe574('0x2')]},'moduleCreate':{'type':Sequelize[_0xe574('0x3')](_0xe574('0x4'),'contact',_0xe574('0x5')),'defaultValue':_0xe574('0x4')},'moduleSearch':{'type':Sequelize[_0xe574('0x3')]('contact_lead',_0xe574('0x6'),_0xe574('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe574('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 25510bc..a02adfd 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 _0xafb9=['options','includeAll','include','rows','catch','show','params','find','create','body','destroy','findOne','ZohoField','order','getSubjects','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','status','end','json','count','offset','limit','set','reject','update','sendStatus','name','send','map','ZohoConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge'];(function(_0x96aa98,_0xa48484){var _0x4325b0=function(_0x57dc34){while(--_0x57dc34){_0x96aa98['push'](_0x96aa98['shift']());}};_0x4325b0(++_0xa48484);}(_0xafb9,0x68));var _0x9afb=function(_0x4141c5,_0x44959a){_0x4141c5=_0x4141c5-0x0;var _0x47d6ae=_0xafb9[_0x4141c5];return _0x47d6ae;};'use strict';var pdf=require(_0x9afb('0x0'));var emlformat=require(_0x9afb('0x1'));var rimraf=require(_0x9afb('0x2'));var zipdir=require(_0x9afb('0x3'));var jsonpatch=require(_0x9afb('0x4'));var rp=require(_0x9afb('0x5'));var moment=require(_0x9afb('0x6'));var BPromise=require(_0x9afb('0x7'));var Mustache=require(_0x9afb('0x8'));var util=require('util');var path=require('path');var sox=require(_0x9afb('0x9'));var csv=require('to-csv');var ejs=require(_0x9afb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9afb('0xb'));var crypto=require(_0x9afb('0xc'));var jsforce=require(_0x9afb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9afb('0xe'));var querystring=require(_0x9afb('0xf'));var Papa=require(_0x9afb('0x10'));var Redis=require(_0x9afb('0x11'));var authService=require(_0x9afb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9afb('0x13'));var logger=require(_0x9afb('0x14'))(_0x9afb('0x15'));var utils=require(_0x9afb('0x16'));var config=require(_0x9afb('0x17'));var licenseUtil=require(_0x9afb('0x18'));var db=require(_0x9afb('0x19'))['db'];var jayson=require(_0x9afb('0x1a'));var client=jayson[_0x9afb('0x1b')][_0x9afb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x47a804,_0x27137c,_0x572a02,_0x59fd82){return new BPromise(function(_0x2f286f,_0x3e40c1){var _0x3c8d2e=_0x59fd82||client;return _0x3c8d2e[_0x9afb('0x1d')](_0x47a804,_0x572a02)[_0x9afb('0x1e')](function(_0x39cdf1){logger[_0x9afb('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x27137c,_0x9afb('0x20'));logger[_0x9afb('0x21')](_0x9afb('0x22'),_0x27137c,_0x9afb('0x20'),JSON[_0x9afb('0x23')](_0x39cdf1));if(_0x39cdf1['error']){if(_0x39cdf1[_0x9afb('0x24')]['code']===0x1f4){logger[_0x9afb('0x24')](_0x9afb('0x25'),_0x27137c,_0x39cdf1['error']['message']);return _0x3e40c1(_0x39cdf1[_0x9afb('0x24')][_0x9afb('0x26')]);}logger[_0x9afb('0x24')](_0x9afb('0x25'),_0x27137c,_0x39cdf1[_0x9afb('0x24')]['message']);return _0x2f286f(_0x39cdf1[_0x9afb('0x24')]['message']);}else{logger['info'](_0x9afb('0x25'),_0x27137c,_0x9afb('0x20'));_0x2f286f(_0x39cdf1[_0x9afb('0x27')][_0x9afb('0x26')]);}})['catch'](function(_0x1e6f9c){logger[_0x9afb('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x27137c,_0x1e6f9c);_0x3e40c1(_0x1e6f9c);});});}function respondWithStatusCode(_0x571bd9,_0x5b5dab){_0x5b5dab=_0x5b5dab||0xcc;return function(_0x342169){if(_0x342169){return _0x571bd9['sendStatus'](_0x5b5dab);}return _0x571bd9[_0x9afb('0x28')](_0x5b5dab)[_0x9afb('0x29')]();};}function respondWithResult(_0x50a919,_0x324293){_0x324293=_0x324293||0xc8;return function(_0x28beba){if(_0x28beba){return _0x50a919[_0x9afb('0x28')](_0x324293)[_0x9afb('0x2a')](_0x28beba);}};}function respondWithFilteredResult(_0x530fbe,_0x348255){return function(_0x591e1d){if(_0x591e1d){var _0x29e092=_0x591e1d[_0x9afb('0x2b')],_0x4ad975=_0x348255[_0x9afb('0x2c')],_0x5692fa=_0x348255[_0x9afb('0x2c')]+_0x348255[_0x9afb('0x2d')],_0x1e6100;if(_0x5692fa>=_0x29e092){_0x5692fa=_0x29e092;_0x1e6100=0xc8;}else{_0x1e6100=0xce;}_0x530fbe[_0x9afb('0x28')](_0x1e6100);return _0x530fbe[_0x9afb('0x2e')]('Content-Range',_0x4ad975+'-'+_0x5692fa+'/'+_0x29e092)['json'](_0x591e1d);}return null;};}function patchUpdates(_0x1cc791){return function(_0x433fc1){try{jsonpatch['apply'](_0x433fc1,_0x1cc791,!![]);}catch(_0x1d0bed){return BPromise[_0x9afb('0x2f')](_0x1d0bed);}return _0x433fc1['save']();};}function saveUpdates(_0x1b9f18,_0xc220e9){return function(_0x762896){if(_0x762896){return _0x762896[_0x9afb('0x30')](_0x1b9f18)[_0x9afb('0x1e')](function(_0x131204){return _0x131204;});}return null;};}function removeEntity(_0x3c6de5,_0x367f9d){return function(_0x57fcc5){if(_0x57fcc5){return _0x57fcc5['destroy']()[_0x9afb('0x1e')](function(){_0x3c6de5[_0x9afb('0x28')](0xcc)[_0x9afb('0x29')]();});}};}function handleEntityNotFound(_0xf9364e,_0x1a8d78){return function(_0x313816){if(!_0x313816){_0xf9364e[_0x9afb('0x31')](0x194);}return _0x313816;};}function handleError(_0x5e6210,_0x5ebb29){_0x5ebb29=_0x5ebb29||0x1f4;return function(_0x67d63a){logger[_0x9afb('0x24')](_0x67d63a['stack']);if(_0x67d63a[_0x9afb('0x32')]){delete _0x67d63a['name'];}_0x5e6210[_0x9afb('0x28')](_0x5ebb29)[_0x9afb('0x33')](_0x67d63a);};}exports['index']=function(_0x2ea8ff,_0x51c8a9){var _0x199756={},_0x2e8e87={},_0x45c57f={'count':0x0,'rows':[]};var _0x44d11d=_[_0x9afb('0x34')](db[_0x9afb('0x35')][_0x9afb('0x36')],function(_0x334c2b){return{'name':_0x334c2b['fieldName'],'type':_0x334c2b[_0x9afb('0x37')]['key']};});_0x2e8e87[_0x9afb('0x38')]=_[_0x9afb('0x34')](_0x44d11d,_0x9afb('0x32'));_0x2e8e87[_0x9afb('0x39')]=_[_0x9afb('0x3a')](_0x2ea8ff[_0x9afb('0x39')]);_0x2e8e87[_0x9afb('0x3b')]=_[_0x9afb('0x3c')](_0x2e8e87[_0x9afb('0x38')],_0x2e8e87['query']);_0x199756[_0x9afb('0x3d')]=_['intersection'](_0x2e8e87[_0x9afb('0x38')],qs[_0x9afb('0x3e')](_0x2ea8ff[_0x9afb('0x39')]['fields']));_0x199756[_0x9afb('0x3d')]=_0x199756[_0x9afb('0x3d')][_0x9afb('0x3f')]?_0x199756[_0x9afb('0x3d')]:_0x2e8e87[_0x9afb('0x38')];if(!_0x2ea8ff[_0x9afb('0x39')][_0x9afb('0x40')]('nolimit')){_0x199756[_0x9afb('0x2d')]=qs[_0x9afb('0x2d')](_0x2ea8ff[_0x9afb('0x39')][_0x9afb('0x2d')]);_0x199756[_0x9afb('0x2c')]=qs[_0x9afb('0x2c')](_0x2ea8ff[_0x9afb('0x39')][_0x9afb('0x2c')]);}_0x199756['order']=qs[_0x9afb('0x41')](_0x2ea8ff['query']['sort']);_0x199756['where']=qs[_0x9afb('0x3b')](_[_0x9afb('0x42')](_0x2ea8ff['query'],_0x2e8e87[_0x9afb('0x3b')]),_0x44d11d);if(_0x2ea8ff[_0x9afb('0x39')][_0x9afb('0x43')]){_0x199756[_0x9afb('0x44')]=_[_0x9afb('0x45')](_0x199756[_0x9afb('0x44')],{'$or':_[_0x9afb('0x34')](_0x44d11d,function(_0x350986){if(_0x350986[_0x9afb('0x37')]!=='VIRTUAL'){var _0x272317={};_0x272317[_0x350986[_0x9afb('0x32')]]={'$like':'%'+_0x2ea8ff[_0x9afb('0x39')][_0x9afb('0x43')]+'%'};return _0x272317;}})});}_0x199756=_['merge']({},_0x199756,_0x2ea8ff[_0x9afb('0x46')]);var _0x381033={'where':_0x199756[_0x9afb('0x44')]};return db['ZohoConfiguration'][_0x9afb('0x2b')](_0x381033)[_0x9afb('0x1e')](function(_0x13179d){_0x45c57f[_0x9afb('0x2b')]=_0x13179d;if(_0x2ea8ff[_0x9afb('0x39')][_0x9afb('0x47')]){_0x199756[_0x9afb('0x48')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x199756);})['then'](function(_0x414645){_0x45c57f[_0x9afb('0x49')]=_0x414645;return _0x45c57f;})['then'](respondWithFilteredResult(_0x51c8a9,_0x199756))[_0x9afb('0x4a')](handleError(_0x51c8a9,null));};exports[_0x9afb('0x4b')]=function(_0x26e88a,_0x3b2c71){var _0x3ccec4={'raw':![],'where':{'id':_0x26e88a[_0x9afb('0x4c')]['id']}},_0x122a35={};_0x122a35[_0x9afb('0x38')]=_[_0x9afb('0x3a')](db[_0x9afb('0x35')][_0x9afb('0x36')]);_0x122a35['query']=_['keys'](_0x26e88a[_0x9afb('0x39')]);_0x122a35['filters']=_[_0x9afb('0x3c')](_0x122a35[_0x9afb('0x38')],_0x122a35[_0x9afb('0x39')]);_0x3ccec4[_0x9afb('0x3d')]=_[_0x9afb('0x3c')](_0x122a35['model'],qs[_0x9afb('0x3e')](_0x26e88a['query'][_0x9afb('0x3e')]));_0x3ccec4[_0x9afb('0x3d')]=_0x3ccec4[_0x9afb('0x3d')][_0x9afb('0x3f')]?_0x3ccec4[_0x9afb('0x3d')]:_0x122a35[_0x9afb('0x38')];if(_0x26e88a[_0x9afb('0x39')]['includeAll']){_0x3ccec4[_0x9afb('0x48')]=[{'all':!![]}];}_0x3ccec4=_[_0x9afb('0x45')]({},_0x3ccec4,_0x26e88a[_0x9afb('0x46')]);return db['ZohoConfiguration'][_0x9afb('0x4d')](_0x3ccec4)[_0x9afb('0x1e')](handleEntityNotFound(_0x3b2c71,null))['then'](respondWithResult(_0x3b2c71,null))[_0x9afb('0x4a')](handleError(_0x3b2c71,null));};exports[_0x9afb('0x4e')]=function(_0x44210e,_0x5bcea5){return db[_0x9afb('0x35')][_0x9afb('0x4e')](_0x44210e['body'],{})['then'](respondWithResult(_0x5bcea5,0xc9))['catch'](handleError(_0x5bcea5,null));};exports[_0x9afb('0x30')]=function(_0x4be509,_0xce2e33){if(_0x4be509['body']['id']){delete _0x4be509[_0x9afb('0x4f')]['id'];}return db[_0x9afb('0x35')][_0x9afb('0x4d')]({'where':{'id':_0x4be509['params']['id']}})[_0x9afb('0x1e')](handleEntityNotFound(_0xce2e33,null))[_0x9afb('0x1e')](saveUpdates(_0x4be509[_0x9afb('0x4f')],null))[_0x9afb('0x1e')](respondWithResult(_0xce2e33,null))[_0x9afb('0x4a')](handleError(_0xce2e33,null));};exports[_0x9afb('0x50')]=function(_0x4e1309,_0x2f889d){return db[_0x9afb('0x35')][_0x9afb('0x4d')]({'where':{'id':_0x4e1309[_0x9afb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f889d,null))[_0x9afb('0x1e')](removeEntity(_0x2f889d,null))[_0x9afb('0x4a')](handleError(_0x2f889d,null));};exports['getFields']=function(_0x681e4e,_0x2ab4da,_0x3faf33){var _0x55612b={};var _0x347ce8={};var _0x12b44e;var _0x158dfd;return db[_0x9afb('0x35')][_0x9afb('0x51')]({'where':{'id':_0x681e4e[_0x9afb('0x4c')]['id']}})[_0x9afb('0x1e')](handleEntityNotFound(_0x2ab4da,null))[_0x9afb('0x1e')](function(_0x25429d){if(_0x25429d){_0x12b44e=_0x25429d;_0x347ce8[_0x9afb('0x38')]=_[_0x9afb('0x3a')](db[_0x9afb('0x52')][_0x9afb('0x36')]);_0x347ce8['query']=_[_0x9afb('0x3a')](_0x681e4e[_0x9afb('0x39')]);_0x347ce8['filters']=_[_0x9afb('0x3c')](_0x347ce8[_0x9afb('0x38')],_0x347ce8['query']);_0x55612b['attributes']=_[_0x9afb('0x3c')](_0x347ce8[_0x9afb('0x38')],qs[_0x9afb('0x3e')](_0x681e4e[_0x9afb('0x39')][_0x9afb('0x3e')]));_0x55612b['attributes']=_0x55612b[_0x9afb('0x3d')][_0x9afb('0x3f')]?_0x55612b[_0x9afb('0x3d')]:_0x347ce8[_0x9afb('0x38')];_0x55612b[_0x9afb('0x53')]=qs[_0x9afb('0x41')](_0x681e4e[_0x9afb('0x39')][_0x9afb('0x41')]);_0x55612b['where']=qs[_0x9afb('0x3b')](_['pick'](_0x681e4e[_0x9afb('0x39')],_0x347ce8[_0x9afb('0x3b')]));if(_0x681e4e[_0x9afb('0x39')][_0x9afb('0x43')]){_0x55612b[_0x9afb('0x44')]=_['merge'](_0x55612b['where'],{'$or':_[_0x9afb('0x34')](_0x55612b[_0x9afb('0x3d')],function(_0x3e22ce){var _0x484a85={};_0x484a85[_0x3e22ce]={'$like':'%'+_0x681e4e[_0x9afb('0x39')]['filter']+'%'};return _0x484a85;})});}_0x55612b=_[_0x9afb('0x45')]({},_0x55612b,_0x681e4e[_0x9afb('0x46')]);return _0x12b44e['getFields'](_0x55612b);}})[_0x9afb('0x1e')](function(_0x4674b5){if(_0x4674b5){_0x158dfd=_0x4674b5['length'];if(!_0x681e4e[_0x9afb('0x39')][_0x9afb('0x40')]('nolimit')){_0x55612b[_0x9afb('0x2d')]=qs['limit'](_0x681e4e[_0x9afb('0x39')][_0x9afb('0x2d')]);_0x55612b[_0x9afb('0x2c')]=qs[_0x9afb('0x2c')](_0x681e4e[_0x9afb('0x39')]['offset']);}return _0x12b44e['getFields'](_0x55612b);}})[_0x9afb('0x1e')](function(_0x46b566){if(_0x46b566){return _0x46b566?{'count':_0x158dfd,'rows':_0x46b566}:null;}})[_0x9afb('0x1e')](respondWithResult(_0x2ab4da,null))['catch'](handleError(_0x2ab4da,null));};exports[_0x9afb('0x54')]=function(_0x33060b,_0x277bc0,_0x5357b4){var _0x3c16a8={};var _0x1ee714={};var _0x134716;var _0x392b79;return db[_0x9afb('0x35')][_0x9afb('0x51')]({'where':{'id':_0x33060b['params']['id']}})[_0x9afb('0x1e')](handleEntityNotFound(_0x277bc0,null))['then'](function(_0x463df3){if(_0x463df3){_0x134716=_0x463df3;_0x1ee714[_0x9afb('0x38')]=_[_0x9afb('0x3a')](db['ZohoField'][_0x9afb('0x36')]);_0x1ee714['query']=_[_0x9afb('0x3a')](_0x33060b[_0x9afb('0x39')]);_0x1ee714['filters']=_[_0x9afb('0x3c')](_0x1ee714[_0x9afb('0x38')],_0x1ee714[_0x9afb('0x39')]);_0x3c16a8[_0x9afb('0x3d')]=_['intersection'](_0x1ee714[_0x9afb('0x38')],qs[_0x9afb('0x3e')](_0x33060b[_0x9afb('0x39')][_0x9afb('0x3e')]));_0x3c16a8[_0x9afb('0x3d')]=_0x3c16a8['attributes'][_0x9afb('0x3f')]?_0x3c16a8[_0x9afb('0x3d')]:_0x1ee714['model'];_0x3c16a8[_0x9afb('0x53')]=qs[_0x9afb('0x41')](_0x33060b[_0x9afb('0x39')][_0x9afb('0x41')]);_0x3c16a8['where']=qs[_0x9afb('0x3b')](_[_0x9afb('0x42')](_0x33060b[_0x9afb('0x39')],_0x1ee714[_0x9afb('0x3b')]));if(_0x33060b[_0x9afb('0x39')][_0x9afb('0x43')]){_0x3c16a8['where']=_[_0x9afb('0x45')](_0x3c16a8['where'],{'$or':_[_0x9afb('0x34')](_0x3c16a8[_0x9afb('0x3d')],function(_0x1d92e8){var _0x2fa464={};_0x2fa464[_0x1d92e8]={'$like':'%'+_0x33060b[_0x9afb('0x39')][_0x9afb('0x43')]+'%'};return _0x2fa464;})});}_0x3c16a8=_[_0x9afb('0x45')]({},_0x3c16a8,_0x33060b[_0x9afb('0x46')]);return _0x134716['getSubjects'](_0x3c16a8);}})[_0x9afb('0x1e')](function(_0x35bd4b){if(_0x35bd4b){_0x392b79=_0x35bd4b[_0x9afb('0x3f')];if(!_0x33060b[_0x9afb('0x39')][_0x9afb('0x40')](_0x9afb('0x55'))){_0x3c16a8[_0x9afb('0x2d')]=qs[_0x9afb('0x2d')](_0x33060b[_0x9afb('0x39')]['limit']);_0x3c16a8[_0x9afb('0x2c')]=qs[_0x9afb('0x2c')](_0x33060b[_0x9afb('0x39')][_0x9afb('0x2c')]);}return _0x134716[_0x9afb('0x54')](_0x3c16a8);}})[_0x9afb('0x1e')](function(_0x5922a6){if(_0x5922a6){return _0x5922a6?{'count':_0x392b79,'rows':_0x5922a6}:null;}})[_0x9afb('0x1e')](respondWithResult(_0x277bc0,null))[_0x9afb('0x4a')](handleError(_0x277bc0,null));};exports[_0x9afb('0x56')]=function(_0x1a58ff,_0x500617,_0x372aed){var _0x42de38={};var _0xcdc629={};var _0x23bdca;var _0x548350;return db[_0x9afb('0x35')]['findOne']({'where':{'id':_0x1a58ff[_0x9afb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x500617,null))[_0x9afb('0x1e')](function(_0xa3f4cf){if(_0xa3f4cf){_0x23bdca=_0xa3f4cf;_0xcdc629[_0x9afb('0x38')]=_['keys'](db[_0x9afb('0x52')]['rawAttributes']);_0xcdc629['query']=_[_0x9afb('0x3a')](_0x1a58ff['query']);_0xcdc629[_0x9afb('0x3b')]=_[_0x9afb('0x3c')](_0xcdc629['model'],_0xcdc629['query']);_0x42de38[_0x9afb('0x3d')]=_[_0x9afb('0x3c')](_0xcdc629['model'],qs[_0x9afb('0x3e')](_0x1a58ff[_0x9afb('0x39')][_0x9afb('0x3e')]));_0x42de38['attributes']=_0x42de38['attributes'][_0x9afb('0x3f')]?_0x42de38[_0x9afb('0x3d')]:_0xcdc629[_0x9afb('0x38')];_0x42de38[_0x9afb('0x53')]=qs[_0x9afb('0x41')](_0x1a58ff[_0x9afb('0x39')][_0x9afb('0x41')]);_0x42de38[_0x9afb('0x44')]=qs[_0x9afb('0x3b')](_[_0x9afb('0x42')](_0x1a58ff['query'],_0xcdc629[_0x9afb('0x3b')]));if(_0x1a58ff[_0x9afb('0x39')]['filter']){_0x42de38[_0x9afb('0x44')]=_['merge'](_0x42de38[_0x9afb('0x44')],{'$or':_[_0x9afb('0x34')](_0x42de38[_0x9afb('0x3d')],function(_0xb4a934){var _0x538303={};_0x538303[_0xb4a934]={'$like':'%'+_0x1a58ff[_0x9afb('0x39')]['filter']+'%'};return _0x538303;})});}_0x42de38=_[_0x9afb('0x45')]({},_0x42de38,_0x1a58ff[_0x9afb('0x46')]);return _0x23bdca[_0x9afb('0x56')](_0x42de38);}})[_0x9afb('0x1e')](function(_0x2d6cf1){if(_0x2d6cf1){_0x548350=_0x2d6cf1['length'];if(!_0x1a58ff['query'][_0x9afb('0x40')]('nolimit')){_0x42de38[_0x9afb('0x2d')]=qs[_0x9afb('0x2d')](_0x1a58ff[_0x9afb('0x39')][_0x9afb('0x2d')]);_0x42de38['offset']=qs[_0x9afb('0x2c')](_0x1a58ff[_0x9afb('0x39')][_0x9afb('0x2c')]);}return _0x23bdca['getDescriptions'](_0x42de38);}})[_0x9afb('0x1e')](function(_0x9a7ee1){if(_0x9a7ee1){return _0x9a7ee1?{'count':_0x548350,'rows':_0x9a7ee1}:null;}})[_0x9afb('0x1e')](respondWithResult(_0x500617,null))['catch'](handleError(_0x500617,null));}; \ No newline at end of file +var _0x2542=['../../mysqldb','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','ZohoConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','findOne','ZohoField','getFields','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x1d031e,_0x2c1e90){var _0x2d24a4=function(_0x14598a){while(--_0x14598a){_0x1d031e['push'](_0x1d031e['shift']());}};_0x2d24a4(++_0x2c1e90);}(_0x2542,0x169));var _0x2254=function(_0x4459bd,_0x2f1d86){_0x4459bd=_0x4459bd-0x0;var _0x24f619=_0x2542[_0x4459bd];return _0x24f619;};'use strict';var pdf=require(_0x2254('0x0'));var emlformat=require(_0x2254('0x1'));var rimraf=require(_0x2254('0x2'));var zipdir=require(_0x2254('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2254('0x4'));var moment=require('moment');var BPromise=require(_0x2254('0x5'));var Mustache=require(_0x2254('0x6'));var util=require(_0x2254('0x7'));var path=require(_0x2254('0x8'));var sox=require(_0x2254('0x9'));var csv=require('to-csv');var ejs=require(_0x2254('0xa'));var fs=require('fs');var fs_extra=require(_0x2254('0xb'));var _=require(_0x2254('0xc'));var squel=require(_0x2254('0xd'));var crypto=require(_0x2254('0xe'));var jsforce=require(_0x2254('0xf'));var deskjs=require(_0x2254('0x10'));var toCsv=require(_0x2254('0x11'));var querystring=require(_0x2254('0x12'));var Papa=require(_0x2254('0x13'));var Redis=require(_0x2254('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2254('0x15'));var as=require(_0x2254('0x16'));var hardwareService=require(_0x2254('0x17'));var logger=require(_0x2254('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x2254('0x19'));var licenseUtil=require(_0x2254('0x1a'));var db=require(_0x2254('0x1b'))['db'];var jayson=require(_0x2254('0x1c'));var client=jayson[_0x2254('0x1d')][_0x2254('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x592a4f,_0x439238,_0x7c7ab0,_0x504749){return new BPromise(function(_0x2f4de,_0x1e582d){var _0xfb23cb=_0x504749||client;return _0xfb23cb[_0x2254('0x1f')](_0x592a4f,_0x7c7ab0)[_0x2254('0x20')](function(_0xbc5548){logger['info'](_0x2254('0x21'),_0x439238,'request\x20sent');logger[_0x2254('0x22')](_0x2254('0x23'),_0x439238,_0x2254('0x24'),JSON[_0x2254('0x25')](_0xbc5548));if(_0xbc5548[_0x2254('0x26')]){if(_0xbc5548[_0x2254('0x26')]['code']===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x439238,_0xbc5548[_0x2254('0x26')][_0x2254('0x27')]);return _0x1e582d(_0xbc5548[_0x2254('0x26')][_0x2254('0x27')]);}logger[_0x2254('0x26')](_0x2254('0x21'),_0x439238,_0xbc5548['error'][_0x2254('0x27')]);return _0x2f4de(_0xbc5548[_0x2254('0x26')][_0x2254('0x27')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x439238,'request\x20sent');_0x2f4de(_0xbc5548[_0x2254('0x28')][_0x2254('0x27')]);}})[_0x2254('0x29')](function(_0x56b91e){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x439238,_0x56b91e);_0x1e582d(_0x56b91e);});});}function respondWithStatusCode(_0x540020,_0x5e5edb){_0x5e5edb=_0x5e5edb||0xcc;return function(_0x4f797d){if(_0x4f797d){return _0x540020[_0x2254('0x2a')](_0x5e5edb);}return _0x540020[_0x2254('0x2b')](_0x5e5edb)[_0x2254('0x2c')]();};}function respondWithResult(_0x265467,_0x13522d){_0x13522d=_0x13522d||0xc8;return function(_0x1349c9){if(_0x1349c9){return _0x265467['status'](_0x13522d)['json'](_0x1349c9);}};}function respondWithFilteredResult(_0x1ada42,_0x4f6877){return function(_0x35608a){if(_0x35608a){var _0x141dc5=_0x35608a['count'],_0x31a543=_0x4f6877[_0x2254('0x2d')],_0x3aa0bd=_0x4f6877[_0x2254('0x2d')]+_0x4f6877[_0x2254('0x2e')],_0x19043b;if(_0x3aa0bd>=_0x141dc5){_0x3aa0bd=_0x141dc5;_0x19043b=0xc8;}else{_0x19043b=0xce;}_0x1ada42[_0x2254('0x2b')](_0x19043b);return _0x1ada42[_0x2254('0x2f')](_0x2254('0x30'),_0x31a543+'-'+_0x3aa0bd+'/'+_0x141dc5)[_0x2254('0x31')](_0x35608a);}return null;};}function patchUpdates(_0x22e791){return function(_0x29975f){try{jsonpatch[_0x2254('0x32')](_0x29975f,_0x22e791,!![]);}catch(_0x21c641){return BPromise[_0x2254('0x33')](_0x21c641);}return _0x29975f[_0x2254('0x34')]();};}function saveUpdates(_0x27d30a,_0x4577f4){return function(_0x1b16c8){if(_0x1b16c8){return _0x1b16c8[_0x2254('0x35')](_0x27d30a)[_0x2254('0x20')](function(_0x2f32f8){return _0x2f32f8;});}return null;};}function removeEntity(_0x4e3658,_0xe29526){return function(_0xa39b89){if(_0xa39b89){return _0xa39b89[_0x2254('0x36')]()[_0x2254('0x20')](function(){_0x4e3658[_0x2254('0x2b')](0xcc)[_0x2254('0x2c')]();});}};}function handleEntityNotFound(_0x2cfc9c,_0x3ed00e){return function(_0x5b84ce){if(!_0x5b84ce){_0x2cfc9c['sendStatus'](0x194);}return _0x5b84ce;};}function handleError(_0x835a0e,_0x3aa0bb){_0x3aa0bb=_0x3aa0bb||0x1f4;return function(_0x503540){logger[_0x2254('0x26')](_0x503540[_0x2254('0x37')]);if(_0x503540[_0x2254('0x38')]){delete _0x503540[_0x2254('0x38')];}_0x835a0e['status'](_0x3aa0bb)['send'](_0x503540);};}exports[_0x2254('0x39')]=function(_0x4e2035,_0x3d620a){var _0x10d749={},_0x2ba6a1={},_0x141ddc={'count':0x0,'rows':[]};var _0x12428a=_[_0x2254('0x3a')](db[_0x2254('0x3b')]['rawAttributes'],function(_0x3234d4){return{'name':_0x3234d4[_0x2254('0x3c')],'type':_0x3234d4[_0x2254('0x3d')][_0x2254('0x3e')]};});_0x2ba6a1[_0x2254('0x3f')]=_[_0x2254('0x3a')](_0x12428a,_0x2254('0x38'));_0x2ba6a1[_0x2254('0x40')]=_[_0x2254('0x41')](_0x4e2035[_0x2254('0x40')]);_0x2ba6a1['filters']=_[_0x2254('0x42')](_0x2ba6a1[_0x2254('0x3f')],_0x2ba6a1[_0x2254('0x40')]);_0x10d749[_0x2254('0x43')]=_['intersection'](_0x2ba6a1[_0x2254('0x3f')],qs[_0x2254('0x44')](_0x4e2035[_0x2254('0x40')][_0x2254('0x44')]));_0x10d749[_0x2254('0x43')]=_0x10d749[_0x2254('0x43')][_0x2254('0x45')]?_0x10d749[_0x2254('0x43')]:_0x2ba6a1['model'];if(!_0x4e2035[_0x2254('0x40')]['hasOwnProperty'](_0x2254('0x46'))){_0x10d749[_0x2254('0x2e')]=qs[_0x2254('0x2e')](_0x4e2035[_0x2254('0x40')][_0x2254('0x2e')]);_0x10d749[_0x2254('0x2d')]=qs[_0x2254('0x2d')](_0x4e2035['query'][_0x2254('0x2d')]);}_0x10d749[_0x2254('0x47')]=qs[_0x2254('0x48')](_0x4e2035[_0x2254('0x40')][_0x2254('0x48')]);_0x10d749['where']=qs[_0x2254('0x49')](_[_0x2254('0x4a')](_0x4e2035[_0x2254('0x40')],_0x2ba6a1[_0x2254('0x49')]),_0x12428a);if(_0x4e2035[_0x2254('0x40')]['filter']){_0x10d749[_0x2254('0x4b')]=_['merge'](_0x10d749[_0x2254('0x4b')],{'$or':_[_0x2254('0x3a')](_0x12428a,function(_0xb4d042){if(_0xb4d042[_0x2254('0x3d')]!==_0x2254('0x4c')){var _0x32ad54={};_0x32ad54[_0xb4d042[_0x2254('0x38')]]={'$like':'%'+_0x4e2035[_0x2254('0x40')][_0x2254('0x4d')]+'%'};return _0x32ad54;}})});}_0x10d749=_[_0x2254('0x4e')]({},_0x10d749,_0x4e2035[_0x2254('0x4f')]);var _0x2349cf={'where':_0x10d749[_0x2254('0x4b')]};return db['ZohoConfiguration'][_0x2254('0x50')](_0x2349cf)[_0x2254('0x20')](function(_0x2c5609){_0x141ddc['count']=_0x2c5609;if(_0x4e2035[_0x2254('0x40')][_0x2254('0x51')]){_0x10d749[_0x2254('0x52')]=[{'all':!![]}];}return db[_0x2254('0x3b')][_0x2254('0x53')](_0x10d749);})[_0x2254('0x20')](function(_0x1f69bb){_0x141ddc[_0x2254('0x54')]=_0x1f69bb;return _0x141ddc;})[_0x2254('0x20')](respondWithFilteredResult(_0x3d620a,_0x10d749))['catch'](handleError(_0x3d620a,null));};exports[_0x2254('0x55')]=function(_0x405eb2,_0x2c3055){var _0x32515f={'raw':![],'where':{'id':_0x405eb2[_0x2254('0x56')]['id']}},_0xbbc059={};_0xbbc059[_0x2254('0x3f')]=_[_0x2254('0x41')](db[_0x2254('0x3b')][_0x2254('0x57')]);_0xbbc059['query']=_[_0x2254('0x41')](_0x405eb2[_0x2254('0x40')]);_0xbbc059['filters']=_[_0x2254('0x42')](_0xbbc059[_0x2254('0x3f')],_0xbbc059[_0x2254('0x40')]);_0x32515f[_0x2254('0x43')]=_['intersection'](_0xbbc059[_0x2254('0x3f')],qs[_0x2254('0x44')](_0x405eb2['query'][_0x2254('0x44')]));_0x32515f[_0x2254('0x43')]=_0x32515f[_0x2254('0x43')][_0x2254('0x45')]?_0x32515f['attributes']:_0xbbc059[_0x2254('0x3f')];if(_0x405eb2[_0x2254('0x40')][_0x2254('0x51')]){_0x32515f['include']=[{'all':!![]}];}_0x32515f=_['merge']({},_0x32515f,_0x405eb2[_0x2254('0x4f')]);return db[_0x2254('0x3b')]['find'](_0x32515f)[_0x2254('0x20')](handleEntityNotFound(_0x2c3055,null))['then'](respondWithResult(_0x2c3055,null))['catch'](handleError(_0x2c3055,null));};exports[_0x2254('0x58')]=function(_0x135962,_0x3be0f3){return db[_0x2254('0x3b')][_0x2254('0x58')](_0x135962['body'],{})['then'](respondWithResult(_0x3be0f3,0xc9))[_0x2254('0x29')](handleError(_0x3be0f3,null));};exports['update']=function(_0x10a8db,_0x28a7c6){if(_0x10a8db[_0x2254('0x59')]['id']){delete _0x10a8db[_0x2254('0x59')]['id'];}return db['ZohoConfiguration'][_0x2254('0x5a')]({'where':{'id':_0x10a8db[_0x2254('0x56')]['id']}})['then'](handleEntityNotFound(_0x28a7c6,null))['then'](saveUpdates(_0x10a8db[_0x2254('0x59')],null))['then'](respondWithResult(_0x28a7c6,null))[_0x2254('0x29')](handleError(_0x28a7c6,null));};exports[_0x2254('0x36')]=function(_0x2ef4a0,_0x2cdcf1){return db[_0x2254('0x3b')]['find']({'where':{'id':_0x2ef4a0['params']['id']}})[_0x2254('0x20')](handleEntityNotFound(_0x2cdcf1,null))['then'](removeEntity(_0x2cdcf1,null))[_0x2254('0x29')](handleError(_0x2cdcf1,null));};exports['getFields']=function(_0x4da493,_0x5999c8,_0x2c0063){var _0x448773={};var _0x1d4b90={};var _0x3ea2d9;var _0x13606e;return db[_0x2254('0x3b')][_0x2254('0x5b')]({'where':{'id':_0x4da493[_0x2254('0x56')]['id']}})[_0x2254('0x20')](handleEntityNotFound(_0x5999c8,null))[_0x2254('0x20')](function(_0x2e68b5){if(_0x2e68b5){_0x3ea2d9=_0x2e68b5;_0x1d4b90[_0x2254('0x3f')]=_[_0x2254('0x41')](db[_0x2254('0x5c')][_0x2254('0x57')]);_0x1d4b90[_0x2254('0x40')]=_[_0x2254('0x41')](_0x4da493[_0x2254('0x40')]);_0x1d4b90[_0x2254('0x49')]=_['intersection'](_0x1d4b90[_0x2254('0x3f')],_0x1d4b90[_0x2254('0x40')]);_0x448773[_0x2254('0x43')]=_[_0x2254('0x42')](_0x1d4b90['model'],qs['fields'](_0x4da493[_0x2254('0x40')][_0x2254('0x44')]));_0x448773[_0x2254('0x43')]=_0x448773[_0x2254('0x43')][_0x2254('0x45')]?_0x448773['attributes']:_0x1d4b90[_0x2254('0x3f')];_0x448773[_0x2254('0x47')]=qs[_0x2254('0x48')](_0x4da493['query']['sort']);_0x448773[_0x2254('0x4b')]=qs['filters'](_[_0x2254('0x4a')](_0x4da493[_0x2254('0x40')],_0x1d4b90['filters']));if(_0x4da493[_0x2254('0x40')][_0x2254('0x4d')]){_0x448773['where']=_[_0x2254('0x4e')](_0x448773[_0x2254('0x4b')],{'$or':_['map'](_0x448773['attributes'],function(_0xde4e7){var _0xa159a4={};_0xa159a4[_0xde4e7]={'$like':'%'+_0x4da493['query']['filter']+'%'};return _0xa159a4;})});}_0x448773=_[_0x2254('0x4e')]({},_0x448773,_0x4da493['options']);return _0x3ea2d9[_0x2254('0x5d')](_0x448773);}})['then'](function(_0x1cabab){if(_0x1cabab){_0x13606e=_0x1cabab[_0x2254('0x45')];if(!_0x4da493[_0x2254('0x40')][_0x2254('0x5e')]('nolimit')){_0x448773[_0x2254('0x2e')]=qs['limit'](_0x4da493[_0x2254('0x40')][_0x2254('0x2e')]);_0x448773['offset']=qs[_0x2254('0x2d')](_0x4da493[_0x2254('0x40')]['offset']);}return _0x3ea2d9[_0x2254('0x5d')](_0x448773);}})[_0x2254('0x20')](function(_0x28ef48){if(_0x28ef48){return _0x28ef48?{'count':_0x13606e,'rows':_0x28ef48}:null;}})[_0x2254('0x20')](respondWithResult(_0x5999c8,null))['catch'](handleError(_0x5999c8,null));};exports[_0x2254('0x5f')]=function(_0x301db7,_0x544102,_0x1ac8ff){var _0x4469c7={};var _0x49d611={};var _0x242e15;var _0x566805;return db[_0x2254('0x3b')]['findOne']({'where':{'id':_0x301db7[_0x2254('0x56')]['id']}})[_0x2254('0x20')](handleEntityNotFound(_0x544102,null))['then'](function(_0x334d31){if(_0x334d31){_0x242e15=_0x334d31;_0x49d611['model']=_[_0x2254('0x41')](db[_0x2254('0x5c')][_0x2254('0x57')]);_0x49d611['query']=_[_0x2254('0x41')](_0x301db7['query']);_0x49d611[_0x2254('0x49')]=_[_0x2254('0x42')](_0x49d611['model'],_0x49d611['query']);_0x4469c7[_0x2254('0x43')]=_[_0x2254('0x42')](_0x49d611[_0x2254('0x3f')],qs[_0x2254('0x44')](_0x301db7['query'][_0x2254('0x44')]));_0x4469c7[_0x2254('0x43')]=_0x4469c7[_0x2254('0x43')][_0x2254('0x45')]?_0x4469c7['attributes']:_0x49d611[_0x2254('0x3f')];_0x4469c7[_0x2254('0x47')]=qs['sort'](_0x301db7[_0x2254('0x40')]['sort']);_0x4469c7[_0x2254('0x4b')]=qs['filters'](_['pick'](_0x301db7['query'],_0x49d611[_0x2254('0x49')]));if(_0x301db7['query'][_0x2254('0x4d')]){_0x4469c7[_0x2254('0x4b')]=_['merge'](_0x4469c7[_0x2254('0x4b')],{'$or':_[_0x2254('0x3a')](_0x4469c7[_0x2254('0x43')],function(_0x1a7c04){var _0x259e10={};_0x259e10[_0x1a7c04]={'$like':'%'+_0x301db7[_0x2254('0x40')]['filter']+'%'};return _0x259e10;})});}_0x4469c7=_['merge']({},_0x4469c7,_0x301db7[_0x2254('0x4f')]);return _0x242e15[_0x2254('0x5f')](_0x4469c7);}})[_0x2254('0x20')](function(_0x17d06a){if(_0x17d06a){_0x566805=_0x17d06a[_0x2254('0x45')];if(!_0x301db7[_0x2254('0x40')][_0x2254('0x5e')](_0x2254('0x46'))){_0x4469c7[_0x2254('0x2e')]=qs[_0x2254('0x2e')](_0x301db7['query'][_0x2254('0x2e')]);_0x4469c7[_0x2254('0x2d')]=qs['offset'](_0x301db7[_0x2254('0x40')]['offset']);}return _0x242e15[_0x2254('0x5f')](_0x4469c7);}})[_0x2254('0x20')](function(_0x4dfcb4){if(_0x4dfcb4){return _0x4dfcb4?{'count':_0x566805,'rows':_0x4dfcb4}:null;}})[_0x2254('0x20')](respondWithResult(_0x544102,null))['catch'](handleError(_0x544102,null));};exports[_0x2254('0x60')]=function(_0x2f66ba,_0x30f2c9,_0x1f7a48){var _0x5044a9={};var _0x15a29a={};var _0x242ab1;var _0x1ebc68;return db[_0x2254('0x3b')]['findOne']({'where':{'id':_0x2f66ba[_0x2254('0x56')]['id']}})[_0x2254('0x20')](handleEntityNotFound(_0x30f2c9,null))['then'](function(_0x23f9ca){if(_0x23f9ca){_0x242ab1=_0x23f9ca;_0x15a29a[_0x2254('0x3f')]=_['keys'](db['ZohoField'][_0x2254('0x57')]);_0x15a29a[_0x2254('0x40')]=_[_0x2254('0x41')](_0x2f66ba[_0x2254('0x40')]);_0x15a29a[_0x2254('0x49')]=_[_0x2254('0x42')](_0x15a29a[_0x2254('0x3f')],_0x15a29a[_0x2254('0x40')]);_0x5044a9[_0x2254('0x43')]=_['intersection'](_0x15a29a[_0x2254('0x3f')],qs['fields'](_0x2f66ba[_0x2254('0x40')]['fields']));_0x5044a9[_0x2254('0x43')]=_0x5044a9[_0x2254('0x43')][_0x2254('0x45')]?_0x5044a9['attributes']:_0x15a29a[_0x2254('0x3f')];_0x5044a9[_0x2254('0x47')]=qs[_0x2254('0x48')](_0x2f66ba[_0x2254('0x40')][_0x2254('0x48')]);_0x5044a9[_0x2254('0x4b')]=qs[_0x2254('0x49')](_[_0x2254('0x4a')](_0x2f66ba[_0x2254('0x40')],_0x15a29a[_0x2254('0x49')]));if(_0x2f66ba[_0x2254('0x40')][_0x2254('0x4d')]){_0x5044a9[_0x2254('0x4b')]=_['merge'](_0x5044a9[_0x2254('0x4b')],{'$or':_['map'](_0x5044a9[_0x2254('0x43')],function(_0xb98b40){var _0x3b1d5c={};_0x3b1d5c[_0xb98b40]={'$like':'%'+_0x2f66ba[_0x2254('0x40')][_0x2254('0x4d')]+'%'};return _0x3b1d5c;})});}_0x5044a9=_[_0x2254('0x4e')]({},_0x5044a9,_0x2f66ba[_0x2254('0x4f')]);return _0x242ab1['getDescriptions'](_0x5044a9);}})[_0x2254('0x20')](function(_0x55a603){if(_0x55a603){_0x1ebc68=_0x55a603[_0x2254('0x45')];if(!_0x2f66ba['query'][_0x2254('0x5e')](_0x2254('0x46'))){_0x5044a9[_0x2254('0x2e')]=qs['limit'](_0x2f66ba[_0x2254('0x40')][_0x2254('0x2e')]);_0x5044a9[_0x2254('0x2d')]=qs[_0x2254('0x2d')](_0x2f66ba[_0x2254('0x40')][_0x2254('0x2d')]);}return _0x242ab1[_0x2254('0x60')](_0x5044a9);}})[_0x2254('0x20')](function(_0x5e94b6){if(_0x5e94b6){return _0x5e94b6?{'count':_0x1ebc68,'rows':_0x5e94b6}:null;}})['then'](respondWithResult(_0x30f2c9,null))[_0x2254('0x29')](handleError(_0x30f2c9,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 9958cb9..6f78734 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 _0x9151=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util'];(function(_0x5d4664,_0x2203b7){var _0x44b112=function(_0x4a5fad){while(--_0x4a5fad){_0x5d4664['push'](_0x5d4664['shift']());}};_0x44b112(++_0x2203b7);}(_0x9151,0xde));var _0x1915=function(_0x527a20,_0x347399){_0x527a20=_0x527a20-0x0;var _0x21f5e0=_0x9151[_0x527a20];return _0x21f5e0;};'use strict';var _=require(_0x1915('0x0'));var util=require(_0x1915('0x1'));var logger=require(_0x1915('0x2'))(_0x1915('0x3'));var moment=require(_0x1915('0x4'));var BPromise=require(_0x1915('0x5'));var rp=require(_0x1915('0x6'));var fs=require('fs');var path=require(_0x1915('0x7'));var rimraf=require(_0x1915('0x8'));var config=require(_0x1915('0x9'));var attributes=require(_0x1915('0xa'));module[_0x1915('0xb')]=function(_0x361aa7,_0x181f3d){return _0x361aa7[_0x1915('0xc')](_0x1915('0xd'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dbd=['path','rimraf','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','api','moment','bluebird'];(function(_0x1dcfd8,_0x58b010){var _0xbf94cf=function(_0x5bf52e){while(--_0x5bf52e){_0x1dcfd8['push'](_0x1dcfd8['shift']());}};_0xbf94cf(++_0x58b010);}(_0x2dbd,0x164));var _0xd2db=function(_0x9bbfde,_0x15a0f0){_0x9bbfde=_0x9bbfde-0x0;var _0xc94417=_0x2dbd[_0x9bbfde];return _0xc94417;};'use strict';var _=require(_0xd2db('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd2db('0x1'));var moment=require(_0xd2db('0x2'));var BPromise=require(_0xd2db('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2db('0x4'));var rimraf=require(_0xd2db('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xd2db('0x6')]=function(_0x285039,_0x1594a4){return _0x285039[_0xd2db('0x7')](_0xd2db('0x8'),attributes,{'tableName':_0xd2db('0x9'),'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 77a3f83..f1023ea 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 _0xfb36=['then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x565fd3,_0x5c94e7){var _0x13c2b7=function(_0x2d186b){while(--_0x2d186b){_0x565fd3['push'](_0x565fd3['shift']());}};_0x13c2b7(++_0x5c94e7);}(_0xfb36,0x8f));var _0x6fb3=function(_0x39a64d,_0x39d211){_0x39a64d=_0x39a64d-0x0;var _0x40b1b4=_0xfb36[_0x39a64d];return _0x40b1b4;};'use strict';var _=require('lodash');var util=require(_0x6fb3('0x0'));var moment=require(_0x6fb3('0x1'));var BPromise=require(_0x6fb3('0x2'));var rs=require(_0x6fb3('0x3'));var fs=require('fs');var Redis=require(_0x6fb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6fb3('0x5'))(_0x6fb3('0x6'));var config=require(_0x6fb3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6fb3('0x8')][_0x6fb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41482f,_0x5409da,_0x1926f5){return new BPromise(function(_0x5f1b7d,_0x1c978b){return client[_0x6fb3('0xa')](_0x41482f,_0x1926f5)[_0x6fb3('0xb')](function(_0x4083b4){logger[_0x6fb3('0xc')](_0x6fb3('0xd'),_0x5409da,'request\x20sent');logger[_0x6fb3('0xe')](_0x6fb3('0xf'),_0x5409da,_0x6fb3('0x10'),JSON[_0x6fb3('0x11')](_0x4083b4));if(_0x4083b4[_0x6fb3('0x12')]){if(_0x4083b4[_0x6fb3('0x12')][_0x6fb3('0x13')]===0x1f4){logger[_0x6fb3('0x12')](_0x6fb3('0xd'),_0x5409da,_0x4083b4[_0x6fb3('0x12')][_0x6fb3('0x14')]);return _0x1c978b(_0x4083b4[_0x6fb3('0x12')][_0x6fb3('0x14')]);}logger['error'](_0x6fb3('0xd'),_0x5409da,_0x4083b4[_0x6fb3('0x12')][_0x6fb3('0x14')]);return _0x5f1b7d(_0x4083b4[_0x6fb3('0x12')][_0x6fb3('0x14')]);}else{logger['info'](_0x6fb3('0xd'),_0x5409da,_0x6fb3('0x10'));_0x5f1b7d(_0x4083b4['result']['message']);}})[_0x6fb3('0x15')](function(_0x14ab82){logger[_0x6fb3('0x12')](_0x6fb3('0xd'),_0x5409da,_0x14ab82);_0x1c978b(_0x14ab82);});});} \ No newline at end of file +var _0x3adc=['info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then'];(function(_0x16762e,_0x576e8d){var _0x18b5f7=function(_0x54a86e){while(--_0x54a86e){_0x16762e['push'](_0x16762e['shift']());}};_0x18b5f7(++_0x576e8d);}(_0x3adc,0x17b));var _0xc3ad=function(_0x293c74,_0x4e0f53){_0x293c74=_0x293c74-0x0;var _0x125b5e=_0x3adc[_0x293c74];return _0x125b5e;};'use strict';var _=require('lodash');var util=require(_0xc3ad('0x0'));var moment=require(_0xc3ad('0x1'));var BPromise=require(_0xc3ad('0x2'));var rs=require(_0xc3ad('0x3'));var fs=require('fs');var Redis=require(_0xc3ad('0x4'));var db=require(_0xc3ad('0x5'))['db'];var utils=require(_0xc3ad('0x6'));var logger=require(_0xc3ad('0x7'))(_0xc3ad('0x8'));var config=require(_0xc3ad('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc3ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18831f,_0xc65216,_0x3fb438){return new BPromise(function(_0x5cfc6c,_0x10941f){return client['request'](_0x18831f,_0x3fb438)[_0xc3ad('0xb')](function(_0x148d66){logger[_0xc3ad('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0xc65216,_0xc3ad('0xd'));logger[_0xc3ad('0xe')](_0xc3ad('0xf'),_0xc65216,_0xc3ad('0xd'),JSON[_0xc3ad('0x10')](_0x148d66));if(_0x148d66['error']){if(_0x148d66['error'][_0xc3ad('0x11')]===0x1f4){logger[_0xc3ad('0x12')](_0xc3ad('0x13'),_0xc65216,_0x148d66[_0xc3ad('0x12')]['message']);return _0x10941f(_0x148d66['error'][_0xc3ad('0x14')]);}logger[_0xc3ad('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xc65216,_0x148d66[_0xc3ad('0x12')]['message']);return _0x5cfc6c(_0x148d66[_0xc3ad('0x12')][_0xc3ad('0x14')]);}else{logger[_0xc3ad('0xc')](_0xc3ad('0x13'),_0xc65216,_0xc3ad('0xd'));_0x5cfc6c(_0x148d66[_0xc3ad('0x15')][_0xc3ad('0x14')]);}})[_0xc3ad('0x16')](function(_0x493af8){logger[_0xc3ad('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xc65216,_0x493af8);_0x10941f(_0x493af8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 7d3ee5f..0fa6edd 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 _0xbff2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','/:id','isAuthenticated','post','put','delete','destroy','multer','util'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xbff2,0x10e));var _0x2bff=function(_0x564dc4,_0x381202){_0x564dc4=_0x564dc4-0x0;var _0x25e686=_0xbff2[_0x564dc4];return _0x25e686;};'use strict';var multer=require(_0x2bff('0x0'));var util=require(_0x2bff('0x1'));var path=require(_0x2bff('0x2'));var timeout=require(_0x2bff('0x3'));var express=require(_0x2bff('0x4'));var router=express[_0x2bff('0x5')]();var fs_extra=require(_0x2bff('0x6'));var auth=require(_0x2bff('0x7'));var interaction=require(_0x2bff('0x8'));var config=require('../../config/environment');var controller=require(_0x2bff('0x9'));router[_0x2bff('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2bff('0xb'),auth[_0x2bff('0xc')](),controller['show']);router[_0x2bff('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2bff('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2bff('0xf')]('/:id',auth[_0x2bff('0xc')](),controller[_0x2bff('0x10')]);module['exports']=router; \ No newline at end of file +var _0xffe1=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x2d362b,_0x17c8b7){var _0x1200e0=function(_0x336b1a){while(--_0x336b1a){_0x2d362b['push'](_0x2d362b['shift']());}};_0x1200e0(++_0x17c8b7);}(_0xffe1,0x187));var _0x1ffe=function(_0x210950,_0x12b86c){_0x210950=_0x210950-0x0;var _0x212a5d=_0xffe1[_0x210950];return _0x212a5d;};'use strict';var multer=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var path=require('path');var timeout=require(_0x1ffe('0x2'));var express=require('express');var router=express[_0x1ffe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ffe('0x4'));var interaction=require(_0x1ffe('0x5'));var config=require(_0x1ffe('0x6'));var controller=require(_0x1ffe('0x7'));router[_0x1ffe('0x8')]('/',auth[_0x1ffe('0x9')](),controller[_0x1ffe('0xa')]);router[_0x1ffe('0x8')](_0x1ffe('0xb'),auth['isAuthenticated'](),controller[_0x1ffe('0xc')]);router['post']('/',auth[_0x1ffe('0x9')](),controller['create']);router[_0x1ffe('0xd')]('/:id',auth[_0x1ffe('0x9')](),controller[_0x1ffe('0xe')]);router[_0x1ffe('0xf')](_0x1ffe('0xb'),auth[_0x1ffe('0x9')](),controller[_0x1ffe('0x10')]);module[_0x1ffe('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 90e1b22..3995a14 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 _0x84ab=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x36feba,_0x541932){var _0x358e41=function(_0x3dc247){while(--_0x3dc247){_0x36feba['push'](_0x36feba['shift']());}};_0x358e41(++_0x541932);}(_0x84ab,0x12f));var _0xb84a=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x84ab[_0x7d62cb];return _0x3a6266;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'type':{'type':Sequelize[_0xb84a('0x2')](_0xb84a('0x3'),_0xb84a('0x4'),'customVariable',_0xb84a('0x5'),_0xb84a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb84a('0x7')]},'key':{'type':Sequelize[_0xb84a('0x7')]},'keyType':{'type':Sequelize[_0xb84a('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xb84a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb84a('0x7')]},'customField':{'type':Sequelize[_0xb84a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c02=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x140357,_0x6670bd){var _0x4fdf00=function(_0x527977){while(--_0x527977){_0x140357['push'](_0x140357['shift']());}};_0x4fdf00(++_0x6670bd);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x20c0('0x0')]={'type':{'type':Sequelize[_0x20c0('0x1')]('string',_0x20c0('0x2'),_0x20c0('0x3'),_0x20c0('0x4'),_0x20c0('0x5')),'defaultValue':_0x20c0('0x6')},'content':{'type':Sequelize[_0x20c0('0x7')]},'key':{'type':Sequelize[_0x20c0('0x7')]},'keyType':{'type':Sequelize[_0x20c0('0x1')](_0x20c0('0x6'),_0x20c0('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x20c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x20c0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 0fcf0d0..e608d88 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 _0x5f21=['offset','limit','set','Content-Range','json','reject','save','update','destroy','then','error','name','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','ZohoField','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count'];(function(_0x15a557,_0x54bcff){var _0x1500d9=function(_0x135976){while(--_0x135976){_0x15a557['push'](_0x15a557['shift']());}};_0x1500d9(++_0x54bcff);}(_0x5f21,0x1b3));var _0x15f2=function(_0x2a1f80,_0xccd024){_0x2a1f80=_0x2a1f80-0x0;var _0x54f352=_0x5f21[_0x2a1f80];return _0x54f352;};'use strict';var pdf=require(_0x15f2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15f2('0x1'));var zipdir=require(_0x15f2('0x2'));var jsonpatch=require(_0x15f2('0x3'));var rp=require(_0x15f2('0x4'));var moment=require('moment');var BPromise=require(_0x15f2('0x5'));var Mustache=require(_0x15f2('0x6'));var util=require(_0x15f2('0x7'));var path=require(_0x15f2('0x8'));var sox=require(_0x15f2('0x9'));var csv=require('to-csv');var ejs=require(_0x15f2('0xa'));var fs=require('fs');var fs_extra=require(_0x15f2('0xb'));var _=require(_0x15f2('0xc'));var squel=require(_0x15f2('0xd'));var crypto=require('crypto');var jsforce=require(_0x15f2('0xe'));var deskjs=require(_0x15f2('0xf'));var toCsv=require(_0x15f2('0x10'));var querystring=require(_0x15f2('0x11'));var Papa=require(_0x15f2('0x12'));var Redis=require(_0x15f2('0x13'));var authService=require(_0x15f2('0x14'));var qs=require(_0x15f2('0x15'));var as=require(_0x15f2('0x16'));var hardwareService=require(_0x15f2('0x17'));var logger=require('../../config/logger')(_0x15f2('0x18'));var utils=require(_0x15f2('0x19'));var config=require(_0x15f2('0x1a'));var licenseUtil=require(_0x15f2('0x1b'));var db=require(_0x15f2('0x1c'))['db'];function respondWithStatusCode(_0x2785c3,_0x2835dd){_0x2835dd=_0x2835dd||0xcc;return function(_0x5a45a0){if(_0x5a45a0){return _0x2785c3[_0x15f2('0x1d')](_0x2835dd);}return _0x2785c3[_0x15f2('0x1e')](_0x2835dd)[_0x15f2('0x1f')]();};}function respondWithResult(_0x28724e,_0x37d8b0){_0x37d8b0=_0x37d8b0||0xc8;return function(_0x4ad673){if(_0x4ad673){return _0x28724e[_0x15f2('0x1e')](_0x37d8b0)['json'](_0x4ad673);}};}function respondWithFilteredResult(_0x5f10e3,_0x58ae31){return function(_0x5c0ecc){if(_0x5c0ecc){var _0x21a59b=_0x5c0ecc[_0x15f2('0x20')],_0x705a53=_0x58ae31['offset'],_0x3a67e2=_0x58ae31[_0x15f2('0x21')]+_0x58ae31[_0x15f2('0x22')],_0x561a81;if(_0x3a67e2>=_0x21a59b){_0x3a67e2=_0x21a59b;_0x561a81=0xc8;}else{_0x561a81=0xce;}_0x5f10e3['status'](_0x561a81);return _0x5f10e3[_0x15f2('0x23')](_0x15f2('0x24'),_0x705a53+'-'+_0x3a67e2+'/'+_0x21a59b)[_0x15f2('0x25')](_0x5c0ecc);}return null;};}function patchUpdates(_0x134a6d){return function(_0x2d27fd){try{jsonpatch['apply'](_0x2d27fd,_0x134a6d,!![]);}catch(_0x4fe766){return BPromise[_0x15f2('0x26')](_0x4fe766);}return _0x2d27fd[_0x15f2('0x27')]();};}function saveUpdates(_0x194ac1,_0x40ccb5){return function(_0x55f975){if(_0x55f975){return _0x55f975[_0x15f2('0x28')](_0x194ac1)['then'](function(_0x5ec909){return _0x5ec909;});}return null;};}function removeEntity(_0x5d779e,_0x50edb5){return function(_0x4b31d7){if(_0x4b31d7){return _0x4b31d7[_0x15f2('0x29')]()[_0x15f2('0x2a')](function(){_0x5d779e[_0x15f2('0x1e')](0xcc)[_0x15f2('0x1f')]();});}};}function handleEntityNotFound(_0x12fdc8,_0x214c90){return function(_0x18b35c){if(!_0x18b35c){_0x12fdc8[_0x15f2('0x1d')](0x194);}return _0x18b35c;};}function handleError(_0x1c5d66,_0x4009d2){_0x4009d2=_0x4009d2||0x1f4;return function(_0x203705){logger[_0x15f2('0x2b')](_0x203705['stack']);if(_0x203705[_0x15f2('0x2c')]){delete _0x203705[_0x15f2('0x2c')];}_0x1c5d66['status'](_0x4009d2)['send'](_0x203705);};}exports[_0x15f2('0x2d')]=function(_0x29d92b,_0x3509f0){var _0x54c348={},_0x5d87b7={},_0xf5719f={'count':0x0,'rows':[]};var _0x4a739f=_[_0x15f2('0x2e')](db['ZohoField']['rawAttributes'],function(_0x1906c8){return{'name':_0x1906c8['fieldName'],'type':_0x1906c8[_0x15f2('0x2f')][_0x15f2('0x30')]};});_0x5d87b7[_0x15f2('0x31')]=_[_0x15f2('0x2e')](_0x4a739f,_0x15f2('0x2c'));_0x5d87b7[_0x15f2('0x32')]=_[_0x15f2('0x33')](_0x29d92b['query']);_0x5d87b7[_0x15f2('0x34')]=_[_0x15f2('0x35')](_0x5d87b7[_0x15f2('0x31')],_0x5d87b7[_0x15f2('0x32')]);_0x54c348[_0x15f2('0x36')]=_[_0x15f2('0x35')](_0x5d87b7[_0x15f2('0x31')],qs['fields'](_0x29d92b[_0x15f2('0x32')][_0x15f2('0x37')]));_0x54c348[_0x15f2('0x36')]=_0x54c348['attributes'][_0x15f2('0x38')]?_0x54c348[_0x15f2('0x36')]:_0x5d87b7[_0x15f2('0x31')];if(!_0x29d92b[_0x15f2('0x32')][_0x15f2('0x39')](_0x15f2('0x3a'))){_0x54c348['limit']=qs[_0x15f2('0x22')](_0x29d92b['query']['limit']);_0x54c348[_0x15f2('0x21')]=qs['offset'](_0x29d92b[_0x15f2('0x32')][_0x15f2('0x21')]);}_0x54c348[_0x15f2('0x3b')]=qs[_0x15f2('0x3c')](_0x29d92b[_0x15f2('0x32')][_0x15f2('0x3c')]);_0x54c348[_0x15f2('0x3d')]=qs[_0x15f2('0x34')](_[_0x15f2('0x3e')](_0x29d92b[_0x15f2('0x32')],_0x5d87b7['filters']),_0x4a739f);if(_0x29d92b['query'][_0x15f2('0x3f')]){_0x54c348[_0x15f2('0x3d')]=_[_0x15f2('0x40')](_0x54c348[_0x15f2('0x3d')],{'$or':_['map'](_0x4a739f,function(_0x28308b){if(_0x28308b[_0x15f2('0x2f')]!=='VIRTUAL'){var _0x349178={};_0x349178[_0x28308b['name']]={'$like':'%'+_0x29d92b[_0x15f2('0x32')]['filter']+'%'};return _0x349178;}})});}_0x54c348=_['merge']({},_0x54c348,_0x29d92b['options']);var _0x441a7b={'where':_0x54c348[_0x15f2('0x3d')]};return db[_0x15f2('0x41')][_0x15f2('0x20')](_0x441a7b)[_0x15f2('0x2a')](function(_0x128ef4){_0xf5719f[_0x15f2('0x20')]=_0x128ef4;if(_0x29d92b['query'][_0x15f2('0x42')]){_0x54c348['include']=[{'all':!![]}];}return db[_0x15f2('0x41')][_0x15f2('0x43')](_0x54c348);})[_0x15f2('0x2a')](function(_0x3d6db8){_0xf5719f[_0x15f2('0x44')]=_0x3d6db8;return _0xf5719f;})[_0x15f2('0x2a')](respondWithFilteredResult(_0x3509f0,_0x54c348))[_0x15f2('0x45')](handleError(_0x3509f0,null));};exports[_0x15f2('0x46')]=function(_0x2c5f43,_0x14c06d){var _0x534d26={'raw':!![],'where':{'id':_0x2c5f43[_0x15f2('0x47')]['id']}},_0x1902fd={};_0x1902fd[_0x15f2('0x31')]=_['keys'](db[_0x15f2('0x41')][_0x15f2('0x48')]);_0x1902fd['query']=_['keys'](_0x2c5f43[_0x15f2('0x32')]);_0x1902fd['filters']=_[_0x15f2('0x35')](_0x1902fd[_0x15f2('0x31')],_0x1902fd['query']);_0x534d26[_0x15f2('0x36')]=_[_0x15f2('0x35')](_0x1902fd[_0x15f2('0x31')],qs[_0x15f2('0x37')](_0x2c5f43['query'][_0x15f2('0x37')]));_0x534d26[_0x15f2('0x36')]=_0x534d26['attributes'][_0x15f2('0x38')]?_0x534d26[_0x15f2('0x36')]:_0x1902fd['model'];if(_0x2c5f43['query'][_0x15f2('0x42')]){_0x534d26[_0x15f2('0x49')]=[{'all':!![]}];}_0x534d26=_[_0x15f2('0x40')]({},_0x534d26,_0x2c5f43[_0x15f2('0x4a')]);return db[_0x15f2('0x41')][_0x15f2('0x4b')](_0x534d26)[_0x15f2('0x2a')](handleEntityNotFound(_0x14c06d,null))[_0x15f2('0x2a')](respondWithResult(_0x14c06d,null))['catch'](handleError(_0x14c06d,null));};exports[_0x15f2('0x4c')]=function(_0x146337,_0x4e7441){return db[_0x15f2('0x41')][_0x15f2('0x4c')](_0x146337[_0x15f2('0x4d')],{})['then'](respondWithResult(_0x4e7441,0xc9))[_0x15f2('0x45')](handleError(_0x4e7441,null));};exports[_0x15f2('0x28')]=function(_0x1d1ca8,_0x3c76c3){if(_0x1d1ca8[_0x15f2('0x4d')]['id']){delete _0x1d1ca8[_0x15f2('0x4d')]['id'];}return db[_0x15f2('0x41')][_0x15f2('0x4b')]({'where':{'id':_0x1d1ca8[_0x15f2('0x47')]['id']}})[_0x15f2('0x2a')](handleEntityNotFound(_0x3c76c3,null))[_0x15f2('0x2a')](saveUpdates(_0x1d1ca8[_0x15f2('0x4d')],null))[_0x15f2('0x2a')](respondWithResult(_0x3c76c3,null))[_0x15f2('0x45')](handleError(_0x3c76c3,null));};exports[_0x15f2('0x29')]=function(_0x4f6d62,_0x54466b){return db['ZohoField'][_0x15f2('0x4b')]({'where':{'id':_0x4f6d62[_0x15f2('0x47')]['id']}})[_0x15f2('0x2a')](handleEntityNotFound(_0x54466b,null))[_0x15f2('0x2a')](removeEntity(_0x54466b,null))[_0x15f2('0x45')](handleError(_0x54466b,null));}; \ No newline at end of file +var _0xc3d4=['params','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','catch','show'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0xc3d4,0x17d));var _0x4c3d=function(_0x2b3b07,_0xa237cb){_0x2b3b07=_0x2b3b07-0x0;var _0x553ac5=_0xc3d4[_0x2b3b07];return _0x553ac5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4c3d('0x0'));var rimraf=require(_0x4c3d('0x1'));var zipdir=require(_0x4c3d('0x2'));var jsonpatch=require(_0x4c3d('0x3'));var rp=require(_0x4c3d('0x4'));var moment=require(_0x4c3d('0x5'));var BPromise=require(_0x4c3d('0x6'));var Mustache=require(_0x4c3d('0x7'));var util=require(_0x4c3d('0x8'));var path=require(_0x4c3d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c3d('0xa'));var _=require(_0x4c3d('0xb'));var squel=require(_0x4c3d('0xc'));var crypto=require(_0x4c3d('0xd'));var jsforce=require(_0x4c3d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4c3d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4c3d('0x10'));var authService=require(_0x4c3d('0x11'));var qs=require(_0x4c3d('0x12'));var as=require(_0x4c3d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c3d('0x14'))(_0x4c3d('0x15'));var utils=require(_0x4c3d('0x16'));var config=require(_0x4c3d('0x17'));var licenseUtil=require(_0x4c3d('0x18'));var db=require(_0x4c3d('0x19'))['db'];function respondWithStatusCode(_0x4c52bc,_0x547295){_0x547295=_0x547295||0xcc;return function(_0x3e4231){if(_0x3e4231){return _0x4c52bc['sendStatus'](_0x547295);}return _0x4c52bc[_0x4c3d('0x1a')](_0x547295)[_0x4c3d('0x1b')]();};}function respondWithResult(_0x5ec110,_0x31f907){_0x31f907=_0x31f907||0xc8;return function(_0x59d29a){if(_0x59d29a){return _0x5ec110['status'](_0x31f907)[_0x4c3d('0x1c')](_0x59d29a);}};}function respondWithFilteredResult(_0x4abbab,_0x584aa0){return function(_0x4bb3e9){if(_0x4bb3e9){var _0x1135cf=_0x4bb3e9['count'],_0x69cf7c=_0x584aa0[_0x4c3d('0x1d')],_0x106893=_0x584aa0[_0x4c3d('0x1d')]+_0x584aa0[_0x4c3d('0x1e')],_0xa32387;if(_0x106893>=_0x1135cf){_0x106893=_0x1135cf;_0xa32387=0xc8;}else{_0xa32387=0xce;}_0x4abbab['status'](_0xa32387);return _0x4abbab['set'](_0x4c3d('0x1f'),_0x69cf7c+'-'+_0x106893+'/'+_0x1135cf)[_0x4c3d('0x1c')](_0x4bb3e9);}return null;};}function patchUpdates(_0x1c0080){return function(_0x5bef0c){try{jsonpatch[_0x4c3d('0x20')](_0x5bef0c,_0x1c0080,!![]);}catch(_0x546fe4){return BPromise[_0x4c3d('0x21')](_0x546fe4);}return _0x5bef0c[_0x4c3d('0x22')]();};}function saveUpdates(_0x217216,_0x16f614){return function(_0x440438){if(_0x440438){return _0x440438[_0x4c3d('0x23')](_0x217216)[_0x4c3d('0x24')](function(_0x209e79){return _0x209e79;});}return null;};}function removeEntity(_0x391a34,_0x15a5d4){return function(_0x3c8889){if(_0x3c8889){return _0x3c8889[_0x4c3d('0x25')]()['then'](function(){_0x391a34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f57f7,_0x2a584d){return function(_0x5056c9){if(!_0x5056c9){_0x4f57f7['sendStatus'](0x194);}return _0x5056c9;};}function handleError(_0x3b3f3a,_0x138610){_0x138610=_0x138610||0x1f4;return function(_0x55fea7){logger[_0x4c3d('0x26')](_0x55fea7[_0x4c3d('0x27')]);if(_0x55fea7[_0x4c3d('0x28')]){delete _0x55fea7['name'];}_0x3b3f3a['status'](_0x138610)[_0x4c3d('0x29')](_0x55fea7);};}exports[_0x4c3d('0x2a')]=function(_0x16b231,_0x3c230e){var _0x4af1bc={},_0x31267d={},_0x1becb3={'count':0x0,'rows':[]};var _0x122e84=_['map'](db[_0x4c3d('0x2b')]['rawAttributes'],function(_0x2f8be9){return{'name':_0x2f8be9[_0x4c3d('0x2c')],'type':_0x2f8be9[_0x4c3d('0x2d')][_0x4c3d('0x2e')]};});_0x31267d[_0x4c3d('0x2f')]=_[_0x4c3d('0x30')](_0x122e84,_0x4c3d('0x28'));_0x31267d[_0x4c3d('0x31')]=_[_0x4c3d('0x32')](_0x16b231['query']);_0x31267d[_0x4c3d('0x33')]=_[_0x4c3d('0x34')](_0x31267d[_0x4c3d('0x2f')],_0x31267d[_0x4c3d('0x31')]);_0x4af1bc[_0x4c3d('0x35')]=_[_0x4c3d('0x34')](_0x31267d['model'],qs[_0x4c3d('0x36')](_0x16b231[_0x4c3d('0x31')][_0x4c3d('0x36')]));_0x4af1bc[_0x4c3d('0x35')]=_0x4af1bc[_0x4c3d('0x35')][_0x4c3d('0x37')]?_0x4af1bc[_0x4c3d('0x35')]:_0x31267d['model'];if(!_0x16b231['query'][_0x4c3d('0x38')](_0x4c3d('0x39'))){_0x4af1bc[_0x4c3d('0x1e')]=qs[_0x4c3d('0x1e')](_0x16b231[_0x4c3d('0x31')]['limit']);_0x4af1bc['offset']=qs[_0x4c3d('0x1d')](_0x16b231[_0x4c3d('0x31')][_0x4c3d('0x1d')]);}_0x4af1bc[_0x4c3d('0x3a')]=qs[_0x4c3d('0x3b')](_0x16b231[_0x4c3d('0x31')][_0x4c3d('0x3b')]);_0x4af1bc[_0x4c3d('0x3c')]=qs['filters'](_[_0x4c3d('0x3d')](_0x16b231[_0x4c3d('0x31')],_0x31267d[_0x4c3d('0x33')]),_0x122e84);if(_0x16b231[_0x4c3d('0x31')][_0x4c3d('0x3e')]){_0x4af1bc[_0x4c3d('0x3c')]=_[_0x4c3d('0x3f')](_0x4af1bc['where'],{'$or':_[_0x4c3d('0x30')](_0x122e84,function(_0xfc9760){if(_0xfc9760[_0x4c3d('0x2d')]!=='VIRTUAL'){var _0x5e4029={};_0x5e4029[_0xfc9760[_0x4c3d('0x28')]]={'$like':'%'+_0x16b231[_0x4c3d('0x31')][_0x4c3d('0x3e')]+'%'};return _0x5e4029;}})});}_0x4af1bc=_[_0x4c3d('0x3f')]({},_0x4af1bc,_0x16b231[_0x4c3d('0x40')]);var _0x12c749={'where':_0x4af1bc[_0x4c3d('0x3c')]};return db['ZohoField'][_0x4c3d('0x41')](_0x12c749)[_0x4c3d('0x24')](function(_0x4850df){_0x1becb3[_0x4c3d('0x41')]=_0x4850df;if(_0x16b231[_0x4c3d('0x31')][_0x4c3d('0x42')]){_0x4af1bc['include']=[{'all':!![]}];}return db[_0x4c3d('0x2b')]['findAll'](_0x4af1bc);})['then'](function(_0x16d6da){_0x1becb3['rows']=_0x16d6da;return _0x1becb3;})[_0x4c3d('0x24')](respondWithFilteredResult(_0x3c230e,_0x4af1bc))[_0x4c3d('0x43')](handleError(_0x3c230e,null));};exports[_0x4c3d('0x44')]=function(_0x248050,_0x594a23){var _0x50687d={'raw':!![],'where':{'id':_0x248050[_0x4c3d('0x45')]['id']}},_0x433738={};_0x433738[_0x4c3d('0x2f')]=_[_0x4c3d('0x32')](db[_0x4c3d('0x2b')][_0x4c3d('0x46')]);_0x433738[_0x4c3d('0x31')]=_[_0x4c3d('0x32')](_0x248050[_0x4c3d('0x31')]);_0x433738['filters']=_['intersection'](_0x433738[_0x4c3d('0x2f')],_0x433738[_0x4c3d('0x31')]);_0x50687d[_0x4c3d('0x35')]=_[_0x4c3d('0x34')](_0x433738[_0x4c3d('0x2f')],qs['fields'](_0x248050[_0x4c3d('0x31')][_0x4c3d('0x36')]));_0x50687d[_0x4c3d('0x35')]=_0x50687d[_0x4c3d('0x35')][_0x4c3d('0x37')]?_0x50687d[_0x4c3d('0x35')]:_0x433738[_0x4c3d('0x2f')];if(_0x248050[_0x4c3d('0x31')][_0x4c3d('0x42')]){_0x50687d[_0x4c3d('0x47')]=[{'all':!![]}];}_0x50687d=_[_0x4c3d('0x3f')]({},_0x50687d,_0x248050[_0x4c3d('0x40')]);return db[_0x4c3d('0x2b')]['find'](_0x50687d)[_0x4c3d('0x24')](handleEntityNotFound(_0x594a23,null))[_0x4c3d('0x24')](respondWithResult(_0x594a23,null))['catch'](handleError(_0x594a23,null));};exports[_0x4c3d('0x48')]=function(_0x2bfe70,_0x778ac5){return db['ZohoField'][_0x4c3d('0x48')](_0x2bfe70[_0x4c3d('0x49')],{})[_0x4c3d('0x24')](respondWithResult(_0x778ac5,0xc9))['catch'](handleError(_0x778ac5,null));};exports[_0x4c3d('0x23')]=function(_0xe74079,_0x17e481){if(_0xe74079[_0x4c3d('0x49')]['id']){delete _0xe74079[_0x4c3d('0x49')]['id'];}return db[_0x4c3d('0x2b')][_0x4c3d('0x4a')]({'where':{'id':_0xe74079[_0x4c3d('0x45')]['id']}})[_0x4c3d('0x24')](handleEntityNotFound(_0x17e481,null))[_0x4c3d('0x24')](saveUpdates(_0xe74079['body'],null))[_0x4c3d('0x24')](respondWithResult(_0x17e481,null))['catch'](handleError(_0x17e481,null));};exports[_0x4c3d('0x25')]=function(_0x1d7271,_0xf9dc5){return db[_0x4c3d('0x2b')][_0x4c3d('0x4a')]({'where':{'id':_0x1d7271[_0x4c3d('0x45')]['id']}})[_0x4c3d('0x24')](handleEntityNotFound(_0xf9dc5,null))['then'](removeEntity(_0xf9dc5,null))[_0x4c3d('0x43')](handleError(_0xf9dc5,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4bf7efc..f15aef8 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 _0x67e1=['./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x67e1,0x138));var _0x167e=function(_0x1b4c77,_0x563946){_0x1b4c77=_0x1b4c77-0x0;var _0xf6f21b=_0x67e1[_0x1b4c77];return _0xf6f21b;};'use strict';var _=require(_0x167e('0x0'));var util=require(_0x167e('0x1'));var logger=require(_0x167e('0x2'))(_0x167e('0x3'));var moment=require(_0x167e('0x4'));var BPromise=require('bluebird');var rp=require(_0x167e('0x5'));var fs=require('fs');var path=require(_0x167e('0x6'));var rimraf=require(_0x167e('0x7'));var config=require('../../config/environment');var attributes=require(_0x167e('0x8'));module[_0x167e('0x9')]=function(_0x4b96f7,_0x1cb462){return _0x4b96f7[_0x167e('0xa')](_0x167e('0xb'),attributes,{'tableName':_0x167e('0xc'),'paranoid':![],'indexes':[{'name':_0x167e('0xd'),'fields':[_0x167e('0xe'),_0x167e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21b1=['define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intZohoField.attributes'];(function(_0x33a73f,_0x36681d){var _0x3695a0=function(_0x482bea){while(--_0x482bea){_0x33a73f['push'](_0x33a73f['shift']());}};_0x3695a0(++_0x36681d);}(_0x21b1,0x198));var _0x121b=function(_0x25ed12,_0x29172f){_0x25ed12=_0x25ed12-0x0;var _0x1f7652=_0x21b1[_0x25ed12];return _0x1f7652;};'use strict';var _=require(_0x121b('0x0'));var util=require(_0x121b('0x1'));var logger=require(_0x121b('0x2'))('api');var moment=require(_0x121b('0x3'));var BPromise=require(_0x121b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x121b('0x5'));var rimraf=require(_0x121b('0x6'));var config=require('../../config/environment');var attributes=require(_0x121b('0x7'));module['exports']=function(_0x334aa7,_0x23b639){return _0x334aa7[_0x121b('0x8')](_0x121b('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x121b('0xa'),'fields':[_0x121b('0xb'),_0x121b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 03c7889..5c13b02 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 _0x24ca=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0xb61c79,_0x39cbbe){var _0x78aa83=function(_0x739e43){while(--_0x739e43){_0xb61c79['push'](_0xb61c79['shift']());}};_0x78aa83(++_0x39cbbe);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x24ca[_0x2bfe52];return _0x1cf649;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('ZohoField,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file +var _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb458,0x103));var _0x8b45=function(_0x4f20c3,_0x404155){_0x4f20c3=_0x4f20c3-0x0;var _0x223819=_0xb458[_0x4f20c3];return _0x223819;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index ff54cbe..ea14a3a 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 _0xe1e3=['../../config/environment','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x117788,_0x4daf67){var _0x324c56=function(_0x15e785){while(--_0x15e785){_0x117788['push'](_0x117788['shift']());}};_0x324c56(++_0x4daf67);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x2536cf,_0x4d51f5){_0x2536cf=_0x2536cf-0x0;var _0x39afb=_0xe1e3[_0x2536cf];return _0x39afb;};'use strict';var multer=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var path=require('path');var timeout=require(_0x3e1e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e1e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));module[_0x3e1e('0x6')]=router; \ No newline at end of file +var _0x7275=['../../components/auth/service','../../config/environment','exports','multer','util','path','express','fs-extra'];(function(_0x5ee2f8,_0x475b54){var _0x3f0ea6=function(_0x1dbbab){while(--_0x1dbbab){_0x5ee2f8['push'](_0x5ee2f8['shift']());}};_0x3f0ea6(++_0x475b54);}(_0x7275,0x143));var _0x5727=function(_0x449daa,_0x5a1155){_0x449daa=_0x449daa-0x0;var _0x3b7960=_0x7275[_0x449daa];return _0x3b7960;};'use strict';var multer=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var path=require(_0x5727('0x2'));var timeout=require('connect-timeout');var express=require(_0x5727('0x3'));var router=express['Router']();var fs_extra=require(_0x5727('0x4'));var auth=require(_0x5727('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5727('0x6'));module[_0x5727('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index a5a4708..9744c75 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 _0x47a1=['sequelize','exports','STRING','unique_name_and_version','INTEGER','state'];(function(_0x288325,_0x26e4ff){var _0x3b9fd7=function(_0x1f2816){while(--_0x1f2816){_0x288325['push'](_0x288325['shift']());}};_0x3b9fd7(++_0x26e4ff);}(_0x47a1,0x96));var _0x147a=function(_0x5e0ee6,_0x2bb448){_0x5e0ee6=_0x5e0ee6-0x0;var _0x4c1075=_0x47a1[_0x5e0ee6];return _0x4c1075;};'use strict';var Sequelize=require(_0x147a('0x0'));module[_0x147a('0x1')]={'name':{'type':Sequelize[_0x147a('0x2')],'allowNull':![],'unique':_0x147a('0x3')},'version':{'type':Sequelize[_0x147a('0x2')],'allowNull':![],'unique':_0x147a('0x3')},'main':{'type':Sequelize[_0x147a('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x147a('0x2')]},'path':{'type':Sequelize[_0x147a('0x2')]},'type':{'type':Sequelize[_0x147a('0x2')]},'size':{'type':Sequelize[_0x147a('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x147a('0x2')]},'logo':{'type':Sequelize[_0x147a('0x2')]},'state':{'type':Sequelize[_0x147a('0x2')],'unique':_0x147a('0x5')},'description':{'type':Sequelize[_0x147a('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x147a('0x2')]},'link':{'type':Sequelize[_0x147a('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf5c0=['exports','unique_name_and_version','STRING','INTEGER','BOOLEAN'];(function(_0x1e4013,_0x2e8a2d){var _0x53bbb4=function(_0x1dc08b){while(--_0x1dc08b){_0x1e4013['push'](_0x1e4013['shift']());}};_0x53bbb4(++_0x2e8a2d);}(_0xf5c0,0x64));var _0x0f5c=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xf5c0[_0x1646fa];return _0x5a47a5;};'use strict';var Sequelize=require('sequelize');module[_0x0f5c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0f5c('0x1')},'version':{'type':Sequelize[_0x0f5c('0x2')],'allowNull':![],'unique':_0x0f5c('0x1')},'main':{'type':Sequelize[_0x0f5c('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x0f5c('0x2')]},'path':{'type':Sequelize[_0x0f5c('0x2')]},'type':{'type':Sequelize[_0x0f5c('0x2')]},'size':{'type':Sequelize[_0x0f5c('0x3')]},'active':{'type':Sequelize[_0x0f5c('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x0f5c('0x2')]},'logo':{'type':Sequelize[_0x0f5c('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x0f5c('0x2')]},'title':{'type':Sequelize[_0x0f5c('0x2')]},'remoteUri':{'type':Sequelize[_0x0f5c('0x2')]},'link':{'type':Sequelize[_0x0f5c('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 85a4f44..47de424 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 _0x9c32=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','Integration','include','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','name','send','index','map','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x14c86d,_0x5e1b37){var _0x5c46ff=function(_0x364c6a){while(--_0x364c6a){_0x14c86d['push'](_0x14c86d['shift']());}};_0x5c46ff(++_0x5e1b37);}(_0x9c32,0x15d));var _0x29c3=function(_0x2bf062,_0x50635d){_0x2bf062=_0x2bf062-0x0;var _0xac44a3=_0x9c32[_0x2bf062];return _0xac44a3;};'use strict';var pdf=require(_0x29c3('0x0'));var emlformat=require(_0x29c3('0x1'));var rimraf=require(_0x29c3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29c3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x29c3('0x4'));var Mustache=require(_0x29c3('0x5'));var util=require('util');var path=require(_0x29c3('0x6'));var sox=require('sox');var csv=require(_0x29c3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29c3('0x8'));var squel=require(_0x29c3('0x9'));var crypto=require(_0x29c3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x29c3('0xb'));var Papa=require(_0x29c3('0xc'));var Redis=require(_0x29c3('0xd'));var authService=require(_0x29c3('0xe'));var qs=require(_0x29c3('0xf'));var as=require(_0x29c3('0x10'));var hardwareService=require(_0x29c3('0x11'));var logger=require(_0x29c3('0x12'))(_0x29c3('0x13'));var utils=require(_0x29c3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x29c3('0x15'));var db=require(_0x29c3('0x16'))['db'];function respondWithStatusCode(_0x237e6e,_0x17eaae){_0x17eaae=_0x17eaae||0xcc;return function(_0x47489f){if(_0x47489f){return _0x237e6e['sendStatus'](_0x17eaae);}return _0x237e6e['status'](_0x17eaae)['end']();};}function respondWithResult(_0x1e8dac,_0x4f1da4){_0x4f1da4=_0x4f1da4||0xc8;return function(_0x2eb262){if(_0x2eb262){return _0x1e8dac[_0x29c3('0x17')](_0x4f1da4)[_0x29c3('0x18')](_0x2eb262);}};}function respondWithFilteredResult(_0x407168,_0x4314a){return function(_0x1ba961){if(_0x1ba961){var _0x63d752=_0x1ba961[_0x29c3('0x19')],_0x46bf7e=_0x4314a[_0x29c3('0x1a')],_0x15d85b=_0x4314a['offset']+_0x4314a[_0x29c3('0x1b')],_0x552054;if(_0x15d85b>=_0x63d752){_0x15d85b=_0x63d752;_0x552054=0xc8;}else{_0x552054=0xce;}_0x407168['status'](_0x552054);return _0x407168[_0x29c3('0x1c')]('Content-Range',_0x46bf7e+'-'+_0x15d85b+'/'+_0x63d752)[_0x29c3('0x18')](_0x1ba961);}return null;};}function patchUpdates(_0x1a5ae6){return function(_0x5937aa){try{jsonpatch[_0x29c3('0x1d')](_0x5937aa,_0x1a5ae6,!![]);}catch(_0x2bdd60){return BPromise[_0x29c3('0x1e')](_0x2bdd60);}return _0x5937aa[_0x29c3('0x1f')]();};}function saveUpdates(_0x50e34a,_0x52d96e){return function(_0x5843da){if(_0x5843da){return _0x5843da[_0x29c3('0x20')](_0x50e34a)[_0x29c3('0x21')](function(_0x25ae6a){return _0x25ae6a;});}return null;};}function removeEntity(_0x1e4ae9,_0x56b7d9){return function(_0x5cd9f5){if(_0x5cd9f5){return _0x5cd9f5[_0x29c3('0x22')]()[_0x29c3('0x21')](function(){_0x1e4ae9[_0x29c3('0x17')](0xcc)[_0x29c3('0x23')]();});}};}function handleEntityNotFound(_0x4016ff,_0xec68e2){return function(_0x4386b4){if(!_0x4386b4){_0x4016ff['sendStatus'](0x194);}return _0x4386b4;};}function handleError(_0xbb6330,_0x2d49e4){_0x2d49e4=_0x2d49e4||0x1f4;return function(_0x5a2587){logger['error'](_0x5a2587['stack']);if(_0x5a2587['name']){delete _0x5a2587[_0x29c3('0x24')];}_0xbb6330[_0x29c3('0x17')](_0x2d49e4)[_0x29c3('0x25')](_0x5a2587);};}exports[_0x29c3('0x26')]=function(_0x2736c9,_0x25fed2){var _0x471e2b={},_0x663ed6={},_0x1bc5aa={'count':0x0,'rows':[]};var _0x17d3bd=_[_0x29c3('0x27')](db['Integration']['rawAttributes'],function(_0x33deb0){return{'name':_0x33deb0['fieldName'],'type':_0x33deb0[_0x29c3('0x28')]['key']};});_0x663ed6[_0x29c3('0x29')]=_['map'](_0x17d3bd,_0x29c3('0x24'));_0x663ed6[_0x29c3('0x2a')]=_[_0x29c3('0x2b')](_0x2736c9[_0x29c3('0x2a')]);_0x663ed6[_0x29c3('0x2c')]=_[_0x29c3('0x2d')](_0x663ed6[_0x29c3('0x29')],_0x663ed6['query']);_0x471e2b[_0x29c3('0x2e')]=_[_0x29c3('0x2d')](_0x663ed6[_0x29c3('0x29')],qs['fields'](_0x2736c9[_0x29c3('0x2a')][_0x29c3('0x2f')]));_0x471e2b[_0x29c3('0x2e')]=_0x471e2b[_0x29c3('0x2e')][_0x29c3('0x30')]?_0x471e2b[_0x29c3('0x2e')]:_0x663ed6['model'];if(!_0x2736c9[_0x29c3('0x2a')][_0x29c3('0x31')]('nolimit')){_0x471e2b[_0x29c3('0x1b')]=qs['limit'](_0x2736c9['query'][_0x29c3('0x1b')]);_0x471e2b[_0x29c3('0x1a')]=qs[_0x29c3('0x1a')](_0x2736c9[_0x29c3('0x2a')][_0x29c3('0x1a')]);}_0x471e2b['order']=qs['sort'](_0x2736c9['query'][_0x29c3('0x32')]);_0x471e2b[_0x29c3('0x33')]=qs['filters'](_[_0x29c3('0x34')](_0x2736c9[_0x29c3('0x2a')],_0x663ed6['filters']),_0x17d3bd);if(_0x2736c9[_0x29c3('0x2a')][_0x29c3('0x35')]){_0x471e2b[_0x29c3('0x33')]=_[_0x29c3('0x36')](_0x471e2b[_0x29c3('0x33')],{'$or':_[_0x29c3('0x27')](_0x17d3bd,function(_0x17c934){if(_0x17c934[_0x29c3('0x28')]!==_0x29c3('0x37')){var _0x1b272e={};_0x1b272e[_0x17c934[_0x29c3('0x24')]]={'$like':'%'+_0x2736c9[_0x29c3('0x2a')][_0x29c3('0x35')]+'%'};return _0x1b272e;}})});}_0x471e2b=_[_0x29c3('0x36')]({},_0x471e2b,_0x2736c9[_0x29c3('0x38')]);var _0x5d8215={'where':_0x471e2b['where']};return db['Integration'][_0x29c3('0x19')](_0x5d8215)[_0x29c3('0x21')](function(_0x5a0f94){_0x1bc5aa['count']=_0x5a0f94;if(_0x2736c9[_0x29c3('0x2a')][_0x29c3('0x39')]){_0x471e2b['include']=[{'all':!![]}];}return db['Integration'][_0x29c3('0x3a')](_0x471e2b);})[_0x29c3('0x21')](function(_0x43beb4){_0x1bc5aa[_0x29c3('0x3b')]=_0x43beb4;return _0x1bc5aa;})[_0x29c3('0x21')](respondWithFilteredResult(_0x25fed2,_0x471e2b))['catch'](handleError(_0x25fed2,null));};exports['show']=function(_0x2d7e77,_0x4be859){var _0x40e838={'raw':![],'where':{'id':_0x2d7e77[_0x29c3('0x3c')]['id']}},_0x255ec5={};_0x255ec5[_0x29c3('0x29')]=_[_0x29c3('0x2b')](db[_0x29c3('0x3d')]['rawAttributes']);_0x255ec5[_0x29c3('0x2a')]=_['keys'](_0x2d7e77[_0x29c3('0x2a')]);_0x255ec5[_0x29c3('0x2c')]=_[_0x29c3('0x2d')](_0x255ec5['model'],_0x255ec5[_0x29c3('0x2a')]);_0x40e838[_0x29c3('0x2e')]=_[_0x29c3('0x2d')](_0x255ec5['model'],qs[_0x29c3('0x2f')](_0x2d7e77[_0x29c3('0x2a')]['fields']));_0x40e838['attributes']=_0x40e838[_0x29c3('0x2e')]['length']?_0x40e838[_0x29c3('0x2e')]:_0x255ec5['model'];if(_0x2d7e77[_0x29c3('0x2a')][_0x29c3('0x39')]){_0x40e838[_0x29c3('0x3e')]=[{'all':!![]}];}_0x40e838=_[_0x29c3('0x36')]({},_0x40e838,_0x2d7e77[_0x29c3('0x38')]);return db[_0x29c3('0x3d')][_0x29c3('0x3f')](_0x40e838)[_0x29c3('0x21')](handleEntityNotFound(_0x4be859,null))[_0x29c3('0x21')](respondWithResult(_0x4be859,null))[_0x29c3('0x40')](handleError(_0x4be859,null));};exports[_0x29c3('0x41')]=function(_0x38e3c7,_0x2b3881){return db[_0x29c3('0x3d')][_0x29c3('0x41')](_0x38e3c7[_0x29c3('0x42')],{})['then'](respondWithResult(_0x2b3881,0xc9))[_0x29c3('0x40')](handleError(_0x2b3881,null));};exports[_0x29c3('0x20')]=function(_0x174904,_0x39f0cd){if(_0x174904[_0x29c3('0x42')]['id']){delete _0x174904[_0x29c3('0x42')]['id'];}return db[_0x29c3('0x3d')][_0x29c3('0x3f')]({'where':{'id':_0x174904[_0x29c3('0x3c')]['id']}})[_0x29c3('0x21')](handleEntityNotFound(_0x39f0cd,null))[_0x29c3('0x21')](saveUpdates(_0x174904['body'],null))['then'](respondWithResult(_0x39f0cd,null))[_0x29c3('0x40')](handleError(_0x39f0cd,null));};exports[_0x29c3('0x22')]=function(_0x3f98ae,_0x42604e){return db['Integration']['find']({'where':{'id':_0x3f98ae[_0x29c3('0x3c')]['id']}})[_0x29c3('0x21')](handleEntityNotFound(_0x42604e,null))[_0x29c3('0x21')](removeEntity(_0x42604e,null))[_0x29c3('0x40')](handleError(_0x42604e,null));}; \ No newline at end of file +var _0x2c91=['params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','includeAll','Integration','findAll','rows','catch','show'];(function(_0x8a45d2,_0x48cd29){var _0x4f36fe=function(_0x2af890){while(--_0x2af890){_0x8a45d2['push'](_0x8a45d2['shift']());}};_0x4f36fe(++_0x48cd29);}(_0x2c91,0xe0));var _0x12c9=function(_0x17ac5e,_0x3f3ea0){_0x17ac5e=_0x17ac5e-0x0;var _0x46a0f2=_0x2c91[_0x17ac5e];return _0x46a0f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x12c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12c9('0x1'));var jsonpatch=require(_0x12c9('0x2'));var rp=require(_0x12c9('0x3'));var moment=require('moment');var BPromise=require(_0x12c9('0x4'));var Mustache=require('mustache');var util=require(_0x12c9('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x12c9('0x6'));var fs=require('fs');var fs_extra=require(_0x12c9('0x7'));var _=require(_0x12c9('0x8'));var squel=require('squel');var crypto=require(_0x12c9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x12c9('0xa'));var toCsv=require(_0x12c9('0xb'));var querystring=require('querystring');var Papa=require(_0x12c9('0xc'));var Redis=require(_0x12c9('0xd'));var authService=require(_0x12c9('0xe'));var qs=require(_0x12c9('0xf'));var as=require(_0x12c9('0x10'));var hardwareService=require(_0x12c9('0x11'));var logger=require(_0x12c9('0x12'))(_0x12c9('0x13'));var utils=require(_0x12c9('0x14'));var config=require(_0x12c9('0x15'));var licenseUtil=require(_0x12c9('0x16'));var db=require(_0x12c9('0x17'))['db'];function respondWithStatusCode(_0x503880,_0x43c54d){_0x43c54d=_0x43c54d||0xcc;return function(_0x4d22bc){if(_0x4d22bc){return _0x503880[_0x12c9('0x18')](_0x43c54d);}return _0x503880[_0x12c9('0x19')](_0x43c54d)[_0x12c9('0x1a')]();};}function respondWithResult(_0x4f9825,_0x38c297){_0x38c297=_0x38c297||0xc8;return function(_0xd20d4e){if(_0xd20d4e){return _0x4f9825[_0x12c9('0x19')](_0x38c297)['json'](_0xd20d4e);}};}function respondWithFilteredResult(_0x34a18b,_0x140dbd){return function(_0x1d4222){if(_0x1d4222){var _0x4877c2=_0x1d4222[_0x12c9('0x1b')],_0x3828d4=_0x140dbd[_0x12c9('0x1c')],_0x269cb3=_0x140dbd[_0x12c9('0x1c')]+_0x140dbd['limit'],_0xc440fc;if(_0x269cb3>=_0x4877c2){_0x269cb3=_0x4877c2;_0xc440fc=0xc8;}else{_0xc440fc=0xce;}_0x34a18b[_0x12c9('0x19')](_0xc440fc);return _0x34a18b[_0x12c9('0x1d')](_0x12c9('0x1e'),_0x3828d4+'-'+_0x269cb3+'/'+_0x4877c2)[_0x12c9('0x1f')](_0x1d4222);}return null;};}function patchUpdates(_0xe948b2){return function(_0x222ffe){try{jsonpatch['apply'](_0x222ffe,_0xe948b2,!![]);}catch(_0x5a747c){return BPromise['reject'](_0x5a747c);}return _0x222ffe[_0x12c9('0x20')]();};}function saveUpdates(_0x4009a9,_0x37a3a9){return function(_0x57566e){if(_0x57566e){return _0x57566e[_0x12c9('0x21')](_0x4009a9)[_0x12c9('0x22')](function(_0x16a2f5){return _0x16a2f5;});}return null;};}function removeEntity(_0x595234,_0x2e7f82){return function(_0x348fa0){if(_0x348fa0){return _0x348fa0[_0x12c9('0x23')]()[_0x12c9('0x22')](function(){_0x595234['status'](0xcc)[_0x12c9('0x1a')]();});}};}function handleEntityNotFound(_0x47cd3c,_0x2e1fa6){return function(_0x2859dc){if(!_0x2859dc){_0x47cd3c[_0x12c9('0x18')](0x194);}return _0x2859dc;};}function handleError(_0x4735e5,_0x4cb069){_0x4cb069=_0x4cb069||0x1f4;return function(_0x15f747){logger[_0x12c9('0x24')](_0x15f747[_0x12c9('0x25')]);if(_0x15f747['name']){delete _0x15f747[_0x12c9('0x26')];}_0x4735e5[_0x12c9('0x19')](_0x4cb069)[_0x12c9('0x27')](_0x15f747);};}exports[_0x12c9('0x28')]=function(_0x15ce86,_0x2176f9){var _0x32af10={},_0x246850={},_0x1f4f09={'count':0x0,'rows':[]};var _0x27b97a=_[_0x12c9('0x29')](db['Integration'][_0x12c9('0x2a')],function(_0x464812){return{'name':_0x464812[_0x12c9('0x2b')],'type':_0x464812[_0x12c9('0x2c')][_0x12c9('0x2d')]};});_0x246850['model']=_[_0x12c9('0x29')](_0x27b97a,'name');_0x246850[_0x12c9('0x2e')]=_[_0x12c9('0x2f')](_0x15ce86['query']);_0x246850[_0x12c9('0x30')]=_[_0x12c9('0x31')](_0x246850[_0x12c9('0x32')],_0x246850['query']);_0x32af10[_0x12c9('0x33')]=_[_0x12c9('0x31')](_0x246850[_0x12c9('0x32')],qs[_0x12c9('0x34')](_0x15ce86[_0x12c9('0x2e')]['fields']));_0x32af10[_0x12c9('0x33')]=_0x32af10[_0x12c9('0x33')][_0x12c9('0x35')]?_0x32af10['attributes']:_0x246850[_0x12c9('0x32')];if(!_0x15ce86['query'][_0x12c9('0x36')](_0x12c9('0x37'))){_0x32af10[_0x12c9('0x38')]=qs[_0x12c9('0x38')](_0x15ce86[_0x12c9('0x2e')]['limit']);_0x32af10['offset']=qs[_0x12c9('0x1c')](_0x15ce86['query']['offset']);}_0x32af10[_0x12c9('0x39')]=qs[_0x12c9('0x3a')](_0x15ce86[_0x12c9('0x2e')][_0x12c9('0x3a')]);_0x32af10['where']=qs[_0x12c9('0x30')](_['pick'](_0x15ce86['query'],_0x246850[_0x12c9('0x30')]),_0x27b97a);if(_0x15ce86[_0x12c9('0x2e')]['filter']){_0x32af10[_0x12c9('0x3b')]=_[_0x12c9('0x3c')](_0x32af10[_0x12c9('0x3b')],{'$or':_['map'](_0x27b97a,function(_0x6afc81){if(_0x6afc81['type']!==_0x12c9('0x3d')){var _0x353968={};_0x353968[_0x6afc81[_0x12c9('0x26')]]={'$like':'%'+_0x15ce86[_0x12c9('0x2e')]['filter']+'%'};return _0x353968;}})});}_0x32af10=_['merge']({},_0x32af10,_0x15ce86['options']);var _0x182b3e={'where':_0x32af10[_0x12c9('0x3b')]};return db['Integration']['count'](_0x182b3e)['then'](function(_0x1f051c){_0x1f4f09[_0x12c9('0x1b')]=_0x1f051c;if(_0x15ce86[_0x12c9('0x2e')][_0x12c9('0x3e')]){_0x32af10['include']=[{'all':!![]}];}return db[_0x12c9('0x3f')][_0x12c9('0x40')](_0x32af10);})['then'](function(_0x5af74f){_0x1f4f09[_0x12c9('0x41')]=_0x5af74f;return _0x1f4f09;})[_0x12c9('0x22')](respondWithFilteredResult(_0x2176f9,_0x32af10))[_0x12c9('0x42')](handleError(_0x2176f9,null));};exports[_0x12c9('0x43')]=function(_0x10af4c,_0x506ab3){var _0x1e7480={'raw':![],'where':{'id':_0x10af4c[_0x12c9('0x44')]['id']}},_0x23b59e={};_0x23b59e[_0x12c9('0x32')]=_[_0x12c9('0x2f')](db['Integration']['rawAttributes']);_0x23b59e[_0x12c9('0x2e')]=_[_0x12c9('0x2f')](_0x10af4c[_0x12c9('0x2e')]);_0x23b59e[_0x12c9('0x30')]=_['intersection'](_0x23b59e[_0x12c9('0x32')],_0x23b59e['query']);_0x1e7480[_0x12c9('0x33')]=_['intersection'](_0x23b59e[_0x12c9('0x32')],qs[_0x12c9('0x34')](_0x10af4c[_0x12c9('0x2e')][_0x12c9('0x34')]));_0x1e7480[_0x12c9('0x33')]=_0x1e7480['attributes'][_0x12c9('0x35')]?_0x1e7480[_0x12c9('0x33')]:_0x23b59e[_0x12c9('0x32')];if(_0x10af4c['query']['includeAll']){_0x1e7480['include']=[{'all':!![]}];}_0x1e7480=_['merge']({},_0x1e7480,_0x10af4c[_0x12c9('0x45')]);return db[_0x12c9('0x3f')][_0x12c9('0x46')](_0x1e7480)[_0x12c9('0x22')](handleEntityNotFound(_0x506ab3,null))[_0x12c9('0x22')](respondWithResult(_0x506ab3,null))['catch'](handleError(_0x506ab3,null));};exports[_0x12c9('0x47')]=function(_0x324e4f,_0x3ee9ad){return db[_0x12c9('0x3f')][_0x12c9('0x47')](_0x324e4f[_0x12c9('0x48')],{})[_0x12c9('0x22')](respondWithResult(_0x3ee9ad,0xc9))[_0x12c9('0x42')](handleError(_0x3ee9ad,null));};exports['update']=function(_0x291cc4,_0x55f37a){if(_0x291cc4[_0x12c9('0x48')]['id']){delete _0x291cc4[_0x12c9('0x48')]['id'];}return db[_0x12c9('0x3f')][_0x12c9('0x46')]({'where':{'id':_0x291cc4['params']['id']}})[_0x12c9('0x22')](handleEntityNotFound(_0x55f37a,null))['then'](saveUpdates(_0x291cc4['body'],null))[_0x12c9('0x22')](respondWithResult(_0x55f37a,null))[_0x12c9('0x42')](handleError(_0x55f37a,null));};exports[_0x12c9('0x23')]=function(_0x39b659,_0xb7fc30){return db[_0x12c9('0x3f')][_0x12c9('0x46')]({'where':{'id':_0x39b659[_0x12c9('0x44')]['id']}})[_0x12c9('0x22')](handleEntityNotFound(_0xb7fc30,null))['then'](removeEntity(_0xb7fc30,null))[_0x12c9('0x42')](handleError(_0xb7fc30,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 65a583f..4379cbe 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 _0x5f91=['Integration','integrations','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x8fd7d2,_0x319277){var _0x1d2796=function(_0x29feb8){while(--_0x29feb8){_0x8fd7d2['push'](_0x8fd7d2['shift']());}};_0x1d2796(++_0x319277);}(_0x5f91,0x152));var _0x15f9=function(_0x1e3f32,_0x3a6d68){_0x1e3f32=_0x1e3f32-0x0;var _0x173b1c=_0x5f91[_0x1e3f32];return _0x173b1c;};'use strict';var _=require(_0x15f9('0x0'));var util=require(_0x15f9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x15f9('0x2'));var rp=require(_0x15f9('0x3'));var fs=require('fs');var path=require(_0x15f9('0x4'));var rimraf=require(_0x15f9('0x5'));var config=require(_0x15f9('0x6'));var attributes=require(_0x15f9('0x7'));module[_0x15f9('0x8')]=function(_0x5e89f9,_0x45a7b0){return _0x5e89f9[_0x15f9('0x9')](_0x15f9('0xa'),attributes,{'tableName':_0x15f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe290=['bluebird','path','rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment'];(function(_0x164030,_0x4d341b){var _0x3e7432=function(_0x1be25b){while(--_0x1be25b){_0x164030['push'](_0x164030['shift']());}};_0x3e7432(++_0x4d341b);}(_0xe290,0x1c2));var _0x0e29=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0xe290[_0x2d0b84];return _0x8d0088;};'use strict';var _=require(_0x0e29('0x0'));var util=require(_0x0e29('0x1'));var logger=require(_0x0e29('0x2'))(_0x0e29('0x3'));var moment=require(_0x0e29('0x4'));var BPromise=require(_0x0e29('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e29('0x6'));var rimraf=require(_0x0e29('0x7'));var config=require('../../config/environment');var attributes=require(_0x0e29('0x8'));module[_0x0e29('0x9')]=function(_0x176499,_0x1b49d0){return _0x176499[_0x0e29('0xa')](_0x0e29('0xb'),attributes,{'tableName':_0x0e29('0xc'),'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 050ccbc..47d63f9 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 _0xc1f1=['stringify','code','error','message','result','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xc1f1,0x122));var _0x1c1f=function(_0x42182d,_0x125b1a){_0x42182d=_0x42182d-0x0;var _0x26459b=_0xc1f1[_0x42182d];return _0x26459b;};'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')]('Integration,\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 +var _0x6a9a=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xfcdd8b,_0x481a52){var _0x288607=function(_0x39afc0){while(--_0x39afc0){_0xfcdd8b['push'](_0xfcdd8b['shift']());}};_0x288607(++_0x481a52);}(_0x6a9a,0x1bd));var _0xa6a9=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x6a9a[_0xf55e73];return _0x116b99;};'use strict';var _=require(_0xa6a9('0x0'));var util=require(_0xa6a9('0x1'));var moment=require('moment');var BPromise=require(_0xa6a9('0x2'));var rs=require(_0xa6a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6a9('0x5'))(_0xa6a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa6a9('0x7'));var client=jayson[_0xa6a9('0x8')][_0xa6a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32ac64,_0x20c241,_0x3ee7b8){return new BPromise(function(_0x36823e,_0x21ecf2){return client[_0xa6a9('0xa')](_0x32ac64,_0x3ee7b8)[_0xa6a9('0xb')](function(_0x51a48b){logger['info'](_0xa6a9('0xc'),_0x20c241,_0xa6a9('0xd'));logger[_0xa6a9('0xe')](_0xa6a9('0xf'),_0x20c241,_0xa6a9('0xd'),JSON[_0xa6a9('0x10')](_0x51a48b));if(_0x51a48b[_0xa6a9('0x11')]){if(_0x51a48b[_0xa6a9('0x11')][_0xa6a9('0x12')]===0x1f4){logger[_0xa6a9('0x11')](_0xa6a9('0xc'),_0x20c241,_0x51a48b[_0xa6a9('0x11')][_0xa6a9('0x13')]);return _0x21ecf2(_0x51a48b[_0xa6a9('0x11')][_0xa6a9('0x13')]);}logger[_0xa6a9('0x11')](_0xa6a9('0xc'),_0x20c241,_0x51a48b[_0xa6a9('0x11')][_0xa6a9('0x13')]);return _0x36823e(_0x51a48b[_0xa6a9('0x11')][_0xa6a9('0x13')]);}else{logger[_0xa6a9('0x14')]('Integration,\x20%s,\x20%s',_0x20c241,'request\x20sent');_0x36823e(_0x51a48b[_0xa6a9('0x15')][_0xa6a9('0x13')]);}})[_0xa6a9('0x16')](function(_0x82b9d){logger['error'](_0xa6a9('0xc'),_0x20c241,_0x82b9d);_0x21ecf2(_0x82b9d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 65a8804..c30d6a9 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 _0x0b2e=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x0b2e,0x12e));var _0xe0b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b2e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe0b2('0x0'));var util=require(_0xe0b2('0x1'));var path=require(_0xe0b2('0x2'));var timeout=require(_0xe0b2('0x3'));var express=require('express');var router=express[_0xe0b2('0x4')]();var fs_extra=require(_0xe0b2('0x5'));var auth=require(_0xe0b2('0x6'));var interaction=require(_0xe0b2('0x7'));var config=require(_0xe0b2('0x8'));var controller=require('./integrationReport.controller');router[_0xe0b2('0x9')]('/',auth[_0xe0b2('0xa')](),controller[_0xe0b2('0xb')]);router[_0xe0b2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b2('0xc')]);router[_0xe0b2('0x9')](_0xe0b2('0xd'),auth[_0xe0b2('0xa')](),controller[_0xe0b2('0xe')]);router['post']('/',auth[_0xe0b2('0xa')](),controller[_0xe0b2('0xf')]);router[_0xe0b2('0x10')](_0xe0b2('0xd'),auth[_0xe0b2('0xa')](),controller[_0xe0b2('0x11')]);router['delete']('/:id',auth[_0xe0b2('0xa')](),controller[_0xe0b2('0x12')]);module[_0xe0b2('0x13')]=router; \ No newline at end of file +var _0x36cd=['isAuthenticated','index','/:id','show','post','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x2a5517,_0x250516){var _0x2a40b4=function(_0x3a35b4){while(--_0x3a35b4){_0x2a5517['push'](_0x2a5517['shift']());}};_0x2a40b4(++_0x250516);}(_0x36cd,0x115));var _0xd36c=function(_0x2a24f9,_0x33f21b){_0x2a24f9=_0x2a24f9-0x0;var _0x32edf3=_0x36cd[_0x2a24f9];return _0x32edf3;};'use strict';var multer=require(_0xd36c('0x0'));var util=require('util');var path=require(_0xd36c('0x1'));var timeout=require(_0xd36c('0x2'));var express=require(_0xd36c('0x3'));var router=express[_0xd36c('0x4')]();var fs_extra=require(_0xd36c('0x5'));var auth=require(_0xd36c('0x6'));var interaction=require(_0xd36c('0x7'));var config=require(_0xd36c('0x8'));var controller=require(_0xd36c('0x9'));router[_0xd36c('0xa')]('/',auth[_0xd36c('0xb')](),controller[_0xd36c('0xc')]);router['get']('/describe',auth[_0xd36c('0xb')](),controller['describe']);router[_0xd36c('0xa')](_0xd36c('0xd'),auth[_0xd36c('0xb')](),controller[_0xd36c('0xe')]);router[_0xd36c('0xf')]('/',auth[_0xd36c('0xb')](),controller['create']);router['put'](_0xd36c('0xd'),auth[_0xd36c('0xb')](),controller[_0xd36c('0x10')]);router[_0xd36c('0x11')](_0xd36c('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f91d944..71502ec 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 _0xd12a=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x44bf54,_0x5be3d6){var _0x2c4a96=function(_0x2bd0ee){while(--_0x2bd0ee){_0x44bf54['push'](_0x44bf54['shift']());}};_0x2c4a96(++_0x5be3d6);}(_0xd12a,0x196));var _0xad12=function(_0x3406d2,_0x17338c){_0x3406d2=_0x3406d2-0x0;var _0x46f2ed=_0xd12a[_0x3406d2];return _0x46f2ed;};'use strict';var Sequelize=require(_0xad12('0x0'));module[_0xad12('0x1')]={'integration':{'type':Sequelize[_0xad12('0x2')]},'eventChannel':{'type':Sequelize[_0xad12('0x2')]},'exitStatus':{'type':Sequelize[_0xad12('0x2')]},'ticketId':{'type':Sequelize[_0xad12('0x2')]},'integrationId':{'type':Sequelize[_0xad12('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xad12('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xad12('0x2')]},'queue':{'type':Sequelize[_0xad12('0x2')]},'interface':{'type':Sequelize[_0xad12('0x2')]},'membername':{'type':Sequelize[_0xad12('0x2')]},'agentcalledAt':{'type':Sequelize[_0xad12('0x4')]},'agentconnectAt':{'type':Sequelize[_0xad12('0x4')]},'holdtime':{'type':Sequelize[_0xad12('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xad12('0x4')]},'talktime':{'type':Sequelize[_0xad12('0x3')]},'agentacw':{'type':Sequelize[_0xad12('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xad12('0x3')]},'reason':{'type':Sequelize[_0xad12('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xad12('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xad12('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xad12('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xad12('0x2')]},'channelstate':{'type':Sequelize[_0xad12('0x3')]},'channelstatedesc':{'type':Sequelize[_0xad12('0x2')]},'connectedlinenum':{'type':Sequelize[_0xad12('0x2')]},'connectedlinename':{'type':Sequelize[_0xad12('0x2')]},'language':{'type':Sequelize[_0xad12('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xad12('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xad12('0x2')]},'destchannel':{'type':Sequelize[_0xad12('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xad12('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xad12('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xad12('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xad12('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xad12('0x2')]},'destcontext':{'type':Sequelize[_0xad12('0x2')]},'destexten':{'type':Sequelize[_0xad12('0x2')]},'destpriority':{'type':Sequelize[_0xad12('0x2')]},'destuniqueid':{'type':Sequelize[_0xad12('0x2')]},'messageId':{'type':Sequelize[_0xad12('0x2')]},'inReplyTo':{'type':Sequelize[_0xad12('0x2')]},'subject':{'type':Sequelize[_0xad12('0x2')]},'from':{'type':Sequelize[_0xad12('0x2')]},'to':{'type':Sequelize[_0xad12('0x2')]},'cc':{'type':Sequelize[_0xad12('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xad12('0x6')]},'status':{'type':Sequelize[_0xad12('0x7')]('SENT',_0xad12('0x8'),_0xad12('0x9'),_0xad12('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xad12('0x2')]},'appdata':{'type':Sequelize[_0xad12('0x2')]},'projectId':{'type':Sequelize[_0xad12('0x3')]}}; \ No newline at end of file +var _0x6824=['ENUM','SENDING','FAILED','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0x6824,0x13e));var _0x4682=function(_0x269d40,_0x8c74d7){_0x269d40=_0x269d40-0x0;var _0x5ca88b=_0x6824[_0x269d40];return _0x5ca88b;};'use strict';var Sequelize=require('sequelize');module[_0x4682('0x0')]={'integration':{'type':Sequelize[_0x4682('0x1')]},'eventChannel':{'type':Sequelize[_0x4682('0x1')]},'exitStatus':{'type':Sequelize[_0x4682('0x1')]},'ticketId':{'type':Sequelize[_0x4682('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4682('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4682('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4682('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4682('0x2')]},'agentconnectAt':{'type':Sequelize[_0x4682('0x2')]},'holdtime':{'type':Sequelize[_0x4682('0x3')]},'agentcomplete':{'type':Sequelize[_0x4682('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4682('0x2')]},'talktime':{'type':Sequelize[_0x4682('0x3')]},'agentacw':{'type':Sequelize[_0x4682('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4682('0x2')]},'agentdump':{'type':Sequelize[_0x4682('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4682('0x2')]},'lastevent':{'type':Sequelize[_0x4682('0x1')]},'channel':{'type':Sequelize[_0x4682('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4682('0x1')]},'connectedlinename':{'type':Sequelize[_0x4682('0x1')]},'language':{'type':Sequelize[_0x4682('0x1')]},'accountcode':{'type':Sequelize[_0x4682('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4682('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4682('0x1')]},'destchannelstate':{'type':Sequelize[_0x4682('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4682('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4682('0x1')]},'destcalleridname':{'type':Sequelize[_0x4682('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4682('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4682('0x1')]},'destlanguage':{'type':Sequelize[_0x4682('0x1')]},'destaccountcode':{'type':Sequelize[_0x4682('0x1')]},'destcontext':{'type':Sequelize[_0x4682('0x1')]},'destexten':{'type':Sequelize[_0x4682('0x1')]},'destpriority':{'type':Sequelize[_0x4682('0x1')]},'destuniqueid':{'type':Sequelize[_0x4682('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x4682('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4682('0x1')]},'attachment':{'type':Sequelize[_0x4682('0x5')]},'html':{'type':Sequelize[_0x4682('0x5')]},'text':{'type':Sequelize[_0x4682('0x5')]},'status':{'type':Sequelize[_0x4682('0x6')]('SENT',_0x4682('0x7'),'RECEIVED',_0x4682('0x8'))},'url':{'type':Sequelize[_0x4682('0x1')]},'app':{'type':Sequelize[_0x4682('0x1')]},'appdata':{'type':Sequelize[_0x4682('0x1')]},'projectId':{'type':Sequelize[_0x4682('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5c61967..42f1aef 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 _0x02f9=['show','params','keys','rawAttributes','catch','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','IntegrationReport','includeAll','include','findAll','rows'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x02f9,0x19a));var _0x902f=function(_0x360083,_0x272ea6){_0x360083=_0x360083-0x0;var _0x36036a=_0x02f9[_0x360083];return _0x36036a;};'use strict';var pdf=require(_0x902f('0x0'));var emlformat=require(_0x902f('0x1'));var rimraf=require(_0x902f('0x2'));var zipdir=require(_0x902f('0x3'));var jsonpatch=require(_0x902f('0x4'));var rp=require(_0x902f('0x5'));var moment=require(_0x902f('0x6'));var BPromise=require(_0x902f('0x7'));var Mustache=require(_0x902f('0x8'));var util=require(_0x902f('0x9'));var path=require(_0x902f('0xa'));var sox=require(_0x902f('0xb'));var csv=require(_0x902f('0xc'));var ejs=require(_0x902f('0xd'));var fs=require('fs');var fs_extra=require(_0x902f('0xe'));var _=require(_0x902f('0xf'));var squel=require(_0x902f('0x10'));var crypto=require(_0x902f('0x11'));var jsforce=require(_0x902f('0x12'));var deskjs=require(_0x902f('0x13'));var toCsv=require('to-csv');var querystring=require(_0x902f('0x14'));var Papa=require(_0x902f('0x15'));var Redis=require(_0x902f('0x16'));var authService=require(_0x902f('0x17'));var qs=require(_0x902f('0x18'));var as=require(_0x902f('0x19'));var hardwareService=require(_0x902f('0x1a'));var logger=require('../../config/logger')('api');var utils=require(_0x902f('0x1b'));var config=require(_0x902f('0x1c'));var licenseUtil=require(_0x902f('0x1d'));var db=require(_0x902f('0x1e'))['db'];function respondWithStatusCode(_0x12f9db,_0x4d40a9){_0x4d40a9=_0x4d40a9||0xcc;return function(_0x4a5d57){if(_0x4a5d57){return _0x12f9db['sendStatus'](_0x4d40a9);}return _0x12f9db[_0x902f('0x1f')](_0x4d40a9)['end']();};}function respondWithResult(_0xd6b69b,_0x4673c9){_0x4673c9=_0x4673c9||0xc8;return function(_0x44dc4a){if(_0x44dc4a){return _0xd6b69b[_0x902f('0x1f')](_0x4673c9)[_0x902f('0x20')](_0x44dc4a);}};}function respondWithFilteredResult(_0x40bbf2,_0x1791d4){return function(_0x5e953e){if(_0x5e953e){var _0x2ab050=_0x5e953e[_0x902f('0x21')],_0xa9582f=_0x1791d4[_0x902f('0x22')],_0x424ebd=_0x1791d4[_0x902f('0x22')]+_0x1791d4[_0x902f('0x23')],_0x315168;if(_0x424ebd>=_0x2ab050){_0x424ebd=_0x2ab050;_0x315168=0xc8;}else{_0x315168=0xce;}_0x40bbf2[_0x902f('0x1f')](_0x315168);return _0x40bbf2[_0x902f('0x24')](_0x902f('0x25'),_0xa9582f+'-'+_0x424ebd+'/'+_0x2ab050)[_0x902f('0x20')](_0x5e953e);}return null;};}function patchUpdates(_0x1773f7){return function(_0x32e906){try{jsonpatch[_0x902f('0x26')](_0x32e906,_0x1773f7,!![]);}catch(_0x599cd9){return BPromise[_0x902f('0x27')](_0x599cd9);}return _0x32e906['save']();};}function saveUpdates(_0x1cef1a,_0x4c2082){return function(_0x58b41d){if(_0x58b41d){return _0x58b41d['update'](_0x1cef1a)[_0x902f('0x28')](function(_0x5b69a4){return _0x5b69a4;});}return null;};}function removeEntity(_0x345c00,_0x5f6bef){return function(_0x1f5d69){if(_0x1f5d69){return _0x1f5d69[_0x902f('0x29')]()[_0x902f('0x28')](function(){_0x345c00[_0x902f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27aee8,_0x333897){return function(_0x34cb41){if(!_0x34cb41){_0x27aee8[_0x902f('0x2a')](0x194);}return _0x34cb41;};}function handleError(_0x520f91,_0xdab89){_0xdab89=_0xdab89||0x1f4;return function(_0x2e2f97){logger[_0x902f('0x2b')](_0x2e2f97[_0x902f('0x2c')]);if(_0x2e2f97[_0x902f('0x2d')]){delete _0x2e2f97[_0x902f('0x2d')];}_0x520f91[_0x902f('0x1f')](_0xdab89)[_0x902f('0x2e')](_0x2e2f97);};}exports['index']=function(_0x55c871,_0x1841fb){var _0x189fc7={},_0xd8b500={},_0xe01b9c={'count':0x0,'rows':[]};var _0x251054=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x2d3cd7){return{'name':_0x2d3cd7[_0x902f('0x2f')],'type':_0x2d3cd7[_0x902f('0x30')][_0x902f('0x31')]};});_0xd8b500['model']=_[_0x902f('0x32')](_0x251054,_0x902f('0x2d'));_0xd8b500[_0x902f('0x33')]=_['keys'](_0x55c871[_0x902f('0x33')]);_0xd8b500[_0x902f('0x34')]=_[_0x902f('0x35')](_0xd8b500[_0x902f('0x36')],_0xd8b500[_0x902f('0x33')]);_0x189fc7[_0x902f('0x37')]=_[_0x902f('0x35')](_0xd8b500[_0x902f('0x36')],qs[_0x902f('0x38')](_0x55c871[_0x902f('0x33')][_0x902f('0x38')]));_0x189fc7['attributes']=_0x189fc7['attributes'][_0x902f('0x39')]?_0x189fc7[_0x902f('0x37')]:_0xd8b500['model'];if(!_0x55c871['query'][_0x902f('0x3a')]('nolimit')){_0x189fc7[_0x902f('0x23')]=qs['limit'](_0x55c871[_0x902f('0x33')]['limit']);_0x189fc7[_0x902f('0x22')]=qs[_0x902f('0x22')](_0x55c871['query'][_0x902f('0x22')]);}_0x189fc7['order']=qs[_0x902f('0x3b')](_0x55c871['query'][_0x902f('0x3b')]);_0x189fc7[_0x902f('0x3c')]=qs[_0x902f('0x34')](_[_0x902f('0x3d')](_0x55c871['query'],_0xd8b500['filters']),_0x251054);if(_0x55c871['query'][_0x902f('0x3e')]){_0x189fc7[_0x902f('0x3c')]=_[_0x902f('0x3f')](_0x189fc7[_0x902f('0x3c')],{'$or':_[_0x902f('0x32')](_0x251054,function(_0x4da966){if(_0x4da966[_0x902f('0x30')]!=='VIRTUAL'){var _0x3c6094={};_0x3c6094[_0x4da966[_0x902f('0x2d')]]={'$like':'%'+_0x55c871[_0x902f('0x33')][_0x902f('0x3e')]+'%'};return _0x3c6094;}})});}_0x189fc7=_[_0x902f('0x3f')]({},_0x189fc7,_0x55c871[_0x902f('0x40')]);var _0x425839={'where':_0x189fc7[_0x902f('0x3c')]};return db[_0x902f('0x41')][_0x902f('0x21')](_0x425839)['then'](function(_0x30b1bf){_0xe01b9c[_0x902f('0x21')]=_0x30b1bf;if(_0x55c871[_0x902f('0x33')][_0x902f('0x42')]){_0x189fc7[_0x902f('0x43')]=[{'all':!![]}];}return db[_0x902f('0x41')][_0x902f('0x44')](_0x189fc7);})['then'](function(_0x30d109){_0xe01b9c[_0x902f('0x45')]=_0x30d109;return _0xe01b9c;})[_0x902f('0x28')](respondWithFilteredResult(_0x1841fb,_0x189fc7))['catch'](handleError(_0x1841fb,null));};exports[_0x902f('0x46')]=function(_0xaa7ca,_0x42bf0a){var _0x5d15b2={'raw':![],'where':{'id':_0xaa7ca[_0x902f('0x47')]['id']}},_0x597883={};_0x597883[_0x902f('0x36')]=_[_0x902f('0x48')](db[_0x902f('0x41')][_0x902f('0x49')]);_0x597883[_0x902f('0x33')]=_[_0x902f('0x48')](_0xaa7ca['query']);_0x597883[_0x902f('0x34')]=_[_0x902f('0x35')](_0x597883[_0x902f('0x36')],_0x597883[_0x902f('0x33')]);_0x5d15b2[_0x902f('0x37')]=_[_0x902f('0x35')](_0x597883[_0x902f('0x36')],qs[_0x902f('0x38')](_0xaa7ca[_0x902f('0x33')][_0x902f('0x38')]));_0x5d15b2['attributes']=_0x5d15b2[_0x902f('0x37')][_0x902f('0x39')]?_0x5d15b2[_0x902f('0x37')]:_0x597883[_0x902f('0x36')];if(_0xaa7ca[_0x902f('0x33')]['includeAll']){_0x5d15b2[_0x902f('0x43')]=[{'all':!![]}];}_0x5d15b2=_[_0x902f('0x3f')]({},_0x5d15b2,_0xaa7ca[_0x902f('0x40')]);return db[_0x902f('0x41')]['find'](_0x5d15b2)[_0x902f('0x28')](handleEntityNotFound(_0x42bf0a,null))[_0x902f('0x28')](respondWithResult(_0x42bf0a,null))[_0x902f('0x4a')](handleError(_0x42bf0a,null));};exports[_0x902f('0x4b')]=function(_0x36f830,_0x9b299d){return db[_0x902f('0x41')][_0x902f('0x4b')](_0x36f830[_0x902f('0x4c')],{})[_0x902f('0x28')](respondWithResult(_0x9b299d,0xc9))[_0x902f('0x4a')](handleError(_0x9b299d,null));};exports[_0x902f('0x4d')]=function(_0x56028b,_0x8c4716){if(_0x56028b[_0x902f('0x4c')]['id']){delete _0x56028b[_0x902f('0x4c')]['id'];}return db['IntegrationReport'][_0x902f('0x4e')]({'where':{'id':_0x56028b[_0x902f('0x47')]['id']}})['then'](handleEntityNotFound(_0x8c4716,null))[_0x902f('0x28')](saveUpdates(_0x56028b['body'],null))[_0x902f('0x28')](respondWithResult(_0x8c4716,null))['catch'](handleError(_0x8c4716,null));};exports['destroy']=function(_0x50f146,_0x4985b3){return db[_0x902f('0x41')]['find']({'where':{'id':_0x50f146['params']['id']}})['then'](handleEntityNotFound(_0x4985b3,null))[_0x902f('0x28')](removeEntity(_0x4985b3,null))[_0x902f('0x4a')](handleError(_0x4985b3,null));};exports[_0x902f('0x4f')]=function(_0x2b9574,_0x128ba1){return db[_0x902f('0x41')]['describe']()['then'](respondWithResult(_0x128ba1,null))['catch'](handleError(_0x128ba1,null));}; \ No newline at end of file +var _0x537f=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','Content-Range','apply','reject','save','then','end','name','send','index','map','IntegrationReport','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params','keys','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x537f,0x106));var _0xf537=function(_0x2abb93,_0x394fe8){_0x2abb93=_0x2abb93-0x0;var _0x3dc516=_0x537f[_0x2abb93];return _0x3dc516;};'use strict';var pdf=require(_0xf537('0x0'));var emlformat=require(_0xf537('0x1'));var rimraf=require(_0xf537('0x2'));var zipdir=require(_0xf537('0x3'));var jsonpatch=require(_0xf537('0x4'));var rp=require(_0xf537('0x5'));var moment=require(_0xf537('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf537('0x7'));var util=require(_0xf537('0x8'));var path=require(_0xf537('0x9'));var sox=require('sox');var csv=require(_0xf537('0xa'));var ejs=require(_0xf537('0xb'));var fs=require('fs');var fs_extra=require(_0xf537('0xc'));var _=require(_0xf537('0xd'));var squel=require(_0xf537('0xe'));var crypto=require(_0xf537('0xf'));var jsforce=require(_0xf537('0x10'));var deskjs=require(_0xf537('0x11'));var toCsv=require(_0xf537('0xa'));var querystring=require(_0xf537('0x12'));var Papa=require(_0xf537('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf537('0x14'));var as=require(_0xf537('0x15'));var hardwareService=require(_0xf537('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xf537('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf537('0x18'));var db=require(_0xf537('0x19'))['db'];function respondWithStatusCode(_0x372d01,_0x1f35c3){_0x1f35c3=_0x1f35c3||0xcc;return function(_0x1fa873){if(_0x1fa873){return _0x372d01['sendStatus'](_0x1f35c3);}return _0x372d01[_0xf537('0x1a')](_0x1f35c3)['end']();};}function respondWithResult(_0x3fcde4,_0x29b645){_0x29b645=_0x29b645||0xc8;return function(_0x2f8d69){if(_0x2f8d69){return _0x3fcde4[_0xf537('0x1a')](_0x29b645)[_0xf537('0x1b')](_0x2f8d69);}};}function respondWithFilteredResult(_0x21e786,_0x2dfd19){return function(_0x2fff5f){if(_0x2fff5f){var _0x507905=_0x2fff5f['count'],_0x4a18cf=_0x2dfd19['offset'],_0x56629e=_0x2dfd19[_0xf537('0x1c')]+_0x2dfd19[_0xf537('0x1d')],_0x345311;if(_0x56629e>=_0x507905){_0x56629e=_0x507905;_0x345311=0xc8;}else{_0x345311=0xce;}_0x21e786[_0xf537('0x1a')](_0x345311);return _0x21e786['set'](_0xf537('0x1e'),_0x4a18cf+'-'+_0x56629e+'/'+_0x507905)[_0xf537('0x1b')](_0x2fff5f);}return null;};}function patchUpdates(_0x438420){return function(_0x5e81d6){try{jsonpatch[_0xf537('0x1f')](_0x5e81d6,_0x438420,!![]);}catch(_0x449252){return BPromise[_0xf537('0x20')](_0x449252);}return _0x5e81d6[_0xf537('0x21')]();};}function saveUpdates(_0x277b69,_0x23d919){return function(_0x46d6e1){if(_0x46d6e1){return _0x46d6e1['update'](_0x277b69)[_0xf537('0x22')](function(_0x3f135f){return _0x3f135f;});}return null;};}function removeEntity(_0x5952b9,_0x4bf2d2){return function(_0x3d5070){if(_0x3d5070){return _0x3d5070['destroy']()[_0xf537('0x22')](function(){_0x5952b9[_0xf537('0x1a')](0xcc)[_0xf537('0x23')]();});}};}function handleEntityNotFound(_0xf24e97,_0xfe7ad1){return function(_0x50849e){if(!_0x50849e){_0xf24e97['sendStatus'](0x194);}return _0x50849e;};}function handleError(_0x302757,_0x19f490){_0x19f490=_0x19f490||0x1f4;return function(_0x1e0b3e){logger['error'](_0x1e0b3e['stack']);if(_0x1e0b3e[_0xf537('0x24')]){delete _0x1e0b3e['name'];}_0x302757['status'](_0x19f490)[_0xf537('0x25')](_0x1e0b3e);};}exports[_0xf537('0x26')]=function(_0x5bb87d,_0x2eca2a){var _0x481e91={},_0x3102ed={},_0x16ff31={'count':0x0,'rows':[]};var _0x115a30=_[_0xf537('0x27')](db[_0xf537('0x28')][_0xf537('0x29')],function(_0x2d4ed8){return{'name':_0x2d4ed8['fieldName'],'type':_0x2d4ed8['type']['key']};});_0x3102ed[_0xf537('0x2a')]=_[_0xf537('0x27')](_0x115a30,_0xf537('0x24'));_0x3102ed[_0xf537('0x2b')]=_['keys'](_0x5bb87d['query']);_0x3102ed[_0xf537('0x2c')]=_[_0xf537('0x2d')](_0x3102ed['model'],_0x3102ed[_0xf537('0x2b')]);_0x481e91['attributes']=_[_0xf537('0x2d')](_0x3102ed[_0xf537('0x2a')],qs[_0xf537('0x2e')](_0x5bb87d['query'][_0xf537('0x2e')]));_0x481e91[_0xf537('0x2f')]=_0x481e91['attributes'][_0xf537('0x30')]?_0x481e91[_0xf537('0x2f')]:_0x3102ed['model'];if(!_0x5bb87d[_0xf537('0x2b')][_0xf537('0x31')](_0xf537('0x32'))){_0x481e91[_0xf537('0x1d')]=qs[_0xf537('0x1d')](_0x5bb87d['query']['limit']);_0x481e91[_0xf537('0x1c')]=qs['offset'](_0x5bb87d[_0xf537('0x2b')][_0xf537('0x1c')]);}_0x481e91[_0xf537('0x33')]=qs['sort'](_0x5bb87d[_0xf537('0x2b')]['sort']);_0x481e91[_0xf537('0x34')]=qs['filters'](_[_0xf537('0x35')](_0x5bb87d[_0xf537('0x2b')],_0x3102ed[_0xf537('0x2c')]),_0x115a30);if(_0x5bb87d[_0xf537('0x2b')][_0xf537('0x36')]){_0x481e91[_0xf537('0x34')]=_['merge'](_0x481e91[_0xf537('0x34')],{'$or':_[_0xf537('0x27')](_0x115a30,function(_0x2b8105){if(_0x2b8105[_0xf537('0x37')]!==_0xf537('0x38')){var _0x22c249={};_0x22c249[_0x2b8105[_0xf537('0x24')]]={'$like':'%'+_0x5bb87d[_0xf537('0x2b')][_0xf537('0x36')]+'%'};return _0x22c249;}})});}_0x481e91=_[_0xf537('0x39')]({},_0x481e91,_0x5bb87d[_0xf537('0x3a')]);var _0xfed732={'where':_0x481e91[_0xf537('0x34')]};return db[_0xf537('0x28')][_0xf537('0x3b')](_0xfed732)[_0xf537('0x22')](function(_0x4f0219){_0x16ff31['count']=_0x4f0219;if(_0x5bb87d[_0xf537('0x2b')][_0xf537('0x3c')]){_0x481e91['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x481e91);})['then'](function(_0x44762a){_0x16ff31[_0xf537('0x3d')]=_0x44762a;return _0x16ff31;})[_0xf537('0x22')](respondWithFilteredResult(_0x2eca2a,_0x481e91))[_0xf537('0x3e')](handleError(_0x2eca2a,null));};exports[_0xf537('0x3f')]=function(_0x340072,_0x4daf45){var _0x52463e={'raw':![],'where':{'id':_0x340072[_0xf537('0x40')]['id']}},_0x64a24f={};_0x64a24f[_0xf537('0x2a')]=_[_0xf537('0x41')](db[_0xf537('0x28')][_0xf537('0x29')]);_0x64a24f[_0xf537('0x2b')]=_[_0xf537('0x41')](_0x340072[_0xf537('0x2b')]);_0x64a24f[_0xf537('0x2c')]=_['intersection'](_0x64a24f[_0xf537('0x2a')],_0x64a24f['query']);_0x52463e[_0xf537('0x2f')]=_[_0xf537('0x2d')](_0x64a24f[_0xf537('0x2a')],qs['fields'](_0x340072[_0xf537('0x2b')][_0xf537('0x2e')]));_0x52463e[_0xf537('0x2f')]=_0x52463e[_0xf537('0x2f')][_0xf537('0x30')]?_0x52463e['attributes']:_0x64a24f[_0xf537('0x2a')];if(_0x340072[_0xf537('0x2b')][_0xf537('0x3c')]){_0x52463e['include']=[{'all':!![]}];}_0x52463e=_[_0xf537('0x39')]({},_0x52463e,_0x340072[_0xf537('0x3a')]);return db['IntegrationReport'][_0xf537('0x42')](_0x52463e)[_0xf537('0x22')](handleEntityNotFound(_0x4daf45,null))[_0xf537('0x22')](respondWithResult(_0x4daf45,null))[_0xf537('0x3e')](handleError(_0x4daf45,null));};exports[_0xf537('0x43')]=function(_0x51042d,_0x3edc3c){return db[_0xf537('0x28')][_0xf537('0x43')](_0x51042d['body'],{})[_0xf537('0x22')](respondWithResult(_0x3edc3c,0xc9))[_0xf537('0x3e')](handleError(_0x3edc3c,null));};exports['update']=function(_0x562570,_0x5329ae){if(_0x562570[_0xf537('0x44')]['id']){delete _0x562570[_0xf537('0x44')]['id'];}return db[_0xf537('0x28')]['find']({'where':{'id':_0x562570['params']['id']}})[_0xf537('0x22')](handleEntityNotFound(_0x5329ae,null))[_0xf537('0x22')](saveUpdates(_0x562570[_0xf537('0x44')],null))['then'](respondWithResult(_0x5329ae,null))['catch'](handleError(_0x5329ae,null));};exports[_0xf537('0x45')]=function(_0x3e4e24,_0x30c337){return db[_0xf537('0x28')][_0xf537('0x42')]({'where':{'id':_0x3e4e24[_0xf537('0x40')]['id']}})['then'](handleEntityNotFound(_0x30c337,null))['then'](removeEntity(_0x30c337,null))['catch'](handleError(_0x30c337,null));};exports['describe']=function(_0x516de9,_0x25e7f3){return db[_0xf537('0x28')]['describe']()[_0xf537('0x22')](respondWithResult(_0x25e7f3,null))['catch'](handleError(_0x25e7f3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5457cbb..83bf76e 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 _0x6c69=['IntegrationReport','report_integration','util','../../config/logger','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x557d81,_0x2a6677){var _0x13fb9c=function(_0x421b67){while(--_0x421b67){_0x557d81['push'](_0x557d81['shift']());}};_0x13fb9c(++_0x2a6677);}(_0x6c69,0x1b0));var _0x96c6=function(_0x536d69,_0x43a3dd){_0x536d69=_0x536d69-0x0;var _0x564fd5=_0x6c69[_0x536d69];return _0x564fd5;};'use strict';var _=require('lodash');var util=require(_0x96c6('0x0'));var logger=require(_0x96c6('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x96c6('0x2'));var rimraf=require(_0x96c6('0x3'));var config=require(_0x96c6('0x4'));var attributes=require(_0x96c6('0x5'));module[_0x96c6('0x6')]=function(_0x3b607c,_0x2f1506){return _0x3b607c[_0x96c6('0x7')](_0x96c6('0x8'),attributes,{'tableName':_0x96c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77c9=['report_integration','lodash','util','api','moment','path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x7e2f5e,_0x3e2fbd){var _0x3bf45f=function(_0x519381){while(--_0x519381){_0x7e2f5e['push'](_0x7e2f5e['shift']());}};_0x3bf45f(++_0x3e2fbd);}(_0x77c9,0x1a3));var _0x977c=function(_0x3e438f,_0x4439e7){_0x3e438f=_0x3e438f-0x0;var _0x35f7ff=_0x77c9[_0x3e438f];return _0x35f7ff;};'use strict';var _=require(_0x977c('0x0'));var util=require(_0x977c('0x1'));var logger=require('../../config/logger')(_0x977c('0x2'));var moment=require(_0x977c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x977c('0x4'));var rimraf=require('rimraf');var config=require(_0x977c('0x5'));var attributes=require(_0x977c('0x6'));module[_0x977c('0x7')]=function(_0x287f07,_0x305b90){return _0x287f07[_0x977c('0x8')](_0x977c('0x9'),attributes,{'tableName':_0x977c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 6cc1a98..7f99c5c 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2a5aa2,_0x58ec86){var _0x42257e=function(_0x3b8df2){while(--_0x3b8df2){_0x2a5aa2['push'](_0x2a5aa2['shift']());}};_0x42257e(++_0x58ec86);}(_0x757a,0xde));var _0xa757=function(_0x29fe39,_0x3c8187){_0x29fe39=_0x29fe39-0x0;var _0x5ee9eb=_0x757a[_0x29fe39];return _0x5ee9eb;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file +var _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x0b0e[_0x1f7996];return _0x584609;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c1779ca..6499042 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 _0x2b48=['get','isAuthenticated','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index'];(function(_0xd3dfd6,_0x2c8337){var _0x2f961c=function(_0x198d7e){while(--_0x198d7e){_0xd3dfd6['push'](_0xd3dfd6['shift']());}};_0x2f961c(++_0x2c8337);}(_0x2b48,0xe6));var _0x82b4=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x2b48[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x82b4('0x0'));var util=require(_0x82b4('0x1'));var path=require('path');var timeout=require(_0x82b4('0x2'));var express=require(_0x82b4('0x3'));var router=express['Router']();var fs_extra=require(_0x82b4('0x4'));var auth=require(_0x82b4('0x5'));var interaction=require(_0x82b4('0x6'));var config=require(_0x82b4('0x7'));var controller=require(_0x82b4('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x82b4('0x9')]);router[_0x82b4('0xa')]('/:id',auth[_0x82b4('0xb')](),controller[_0x82b4('0xc')]);router[_0x82b4('0xa')](_0x82b4('0xd'),auth['isAuthenticated'](),controller['getIntervals']);router[_0x82b4('0xe')]('/',auth[_0x82b4('0xb')](),controller[_0x82b4('0xf')]);router['post'](_0x82b4('0xd'),auth[_0x82b4('0xb')](),controller[_0x82b4('0x10')]);router[_0x82b4('0xe')](_0x82b4('0x11'),auth[_0x82b4('0xb')](),controller[_0x82b4('0x12')]);router['put'](_0x82b4('0x13'),auth[_0x82b4('0xb')](),controller[_0x82b4('0x14')]);router[_0x82b4('0x15')](_0x82b4('0x13'),auth['isAuthenticated'](),controller[_0x82b4('0x16')]);module[_0x82b4('0x17')]=router; \ No newline at end of file +var _0x9c48=['multer','util','path','express','Router','fs-extra','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','update','delete','destroy','exports'];(function(_0x3c3849,_0x57a7a0){var _0x1e78eb=function(_0x397637){while(--_0x397637){_0x3c3849['push'](_0x3c3849['shift']());}};_0x1e78eb(++_0x57a7a0);}(_0x9c48,0xa1));var _0x89c4=function(_0x14eac8,_0x59be6f){_0x14eac8=_0x14eac8-0x0;var _0x2dc84e=_0x9c48[_0x14eac8];return _0x2dc84e;};'use strict';var multer=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var path=require(_0x89c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x89c4('0x3'));var router=express[_0x89c4('0x4')]();var fs_extra=require(_0x89c4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x89c4('0x6'));var controller=require(_0x89c4('0x7'));router['get']('/',auth[_0x89c4('0x8')](),controller[_0x89c4('0x9')]);router[_0x89c4('0xa')](_0x89c4('0xb'),auth[_0x89c4('0x8')](),controller[_0x89c4('0xc')]);router[_0x89c4('0xa')](_0x89c4('0xd'),auth[_0x89c4('0x8')](),controller[_0x89c4('0xe')]);router[_0x89c4('0xf')]('/',auth[_0x89c4('0x8')](),controller[_0x89c4('0x10')]);router[_0x89c4('0xf')](_0x89c4('0xd'),auth[_0x89c4('0x8')](),controller[_0x89c4('0x11')]);router[_0x89c4('0xf')](_0x89c4('0x12'),auth[_0x89c4('0x8')](),controller['addIntervals']);router['put']('/:id',auth[_0x89c4('0x8')](),controller[_0x89c4('0x13')]);router[_0x89c4('0x14')](_0x89c4('0xb'),auth[_0x89c4('0x8')](),controller[_0x89c4('0x15')]);module[_0x89c4('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9e0ef44..a383aaf 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 _0xf2fe=['exports','STRING'];(function(_0x38160f,_0x4fd814){var _0x51220e=function(_0x80f64d){while(--_0x80f64d){_0x38160f['push'](_0x38160f['shift']());}};_0x51220e(++_0x4fd814);}(_0xf2fe,0x9a));var _0xef2f=function(_0x4c8fa4,_0x288578){_0x4c8fa4=_0x4c8fa4-0x0;var _0x5fb7=_0xf2fe[_0x4c8fa4];return _0x5fb7;};'use strict';var Sequelize=require('sequelize');module[_0xef2f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef2f('0x1')]},'interval':{'type':Sequelize[_0xef2f('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x3702=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3702,0x132));var _0x2370=function(_0x4116e4,_0x5b6d5f){_0x4116e4=_0x4116e4-0x0;var _0x1cfc19=_0x3702[_0x4116e4];return _0x1cfc19;};'use strict';var Sequelize=require(_0x2370('0x0'));module[_0x2370('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2370('0x2')]},'interval':{'type':Sequelize[_0x2370('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 9e7f1ea..d380522 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 _0xde8a=['json','count','offset','set','Content-Range','apply','reject','save','destroy','get','Intervals','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Interval','includeAll','include','findAll','rows','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','addInterval','IntervalId','getIntervals','findOne','sequelize','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end'];(function(_0x274d2e,_0xa3fc12){var _0x5821c1=function(_0x38b541){while(--_0x38b541){_0x274d2e['push'](_0x274d2e['shift']());}};_0x5821c1(++_0xa3fc12);}(_0xde8a,0x9c));var _0xade8=function(_0x2d32e3,_0x28c891){_0x2d32e3=_0x2d32e3-0x0;var _0x48d498=_0xde8a[_0x2d32e3];return _0x48d498;};'use strict';var pdf=require(_0xade8('0x0'));var emlformat=require(_0xade8('0x1'));var rimraf=require(_0xade8('0x2'));var zipdir=require(_0xade8('0x3'));var jsonpatch=require(_0xade8('0x4'));var rp=require(_0xade8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xade8('0x6'));var util=require(_0xade8('0x7'));var path=require(_0xade8('0x8'));var sox=require(_0xade8('0x9'));var csv=require('to-csv');var ejs=require(_0xade8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xade8('0xb'));var squel=require(_0xade8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xade8('0xd'));var querystring=require(_0xade8('0xe'));var Papa=require(_0xade8('0xf'));var Redis=require(_0xade8('0x10'));var authService=require(_0xade8('0x11'));var qs=require(_0xade8('0x12'));var as=require(_0xade8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xade8('0x14'))(_0xade8('0x15'));var utils=require(_0xade8('0x16'));var config=require(_0xade8('0x17'));var licenseUtil=require(_0xade8('0x18'));var db=require(_0xade8('0x19'))['db'];var extensions=require(_0xade8('0x1a'));function respondWithStatusCode(_0x933cd2,_0x511a88){_0x511a88=_0x511a88||0xcc;return function(_0xf51f77){if(_0xf51f77){return _0x933cd2[_0xade8('0x1b')](_0x511a88);}return _0x933cd2[_0xade8('0x1c')](_0x511a88)[_0xade8('0x1d')]();};}function respondWithResult(_0x229a69,_0x31258a){_0x31258a=_0x31258a||0xc8;return function(_0x42fae6){if(_0x42fae6){return _0x229a69[_0xade8('0x1c')](_0x31258a)[_0xade8('0x1e')](_0x42fae6);}};}function respondWithFilteredResult(_0x138969,_0x3d8a01){return function(_0x1f70c1){if(_0x1f70c1){var _0x3fdf51=_0x1f70c1[_0xade8('0x1f')],_0x1e036c=_0x3d8a01[_0xade8('0x20')],_0x2f71b5=_0x3d8a01[_0xade8('0x20')]+_0x3d8a01['limit'],_0x1247db;if(_0x2f71b5>=_0x3fdf51){_0x2f71b5=_0x3fdf51;_0x1247db=0xc8;}else{_0x1247db=0xce;}_0x138969[_0xade8('0x1c')](_0x1247db);return _0x138969[_0xade8('0x21')](_0xade8('0x22'),_0x1e036c+'-'+_0x2f71b5+'/'+_0x3fdf51)['json'](_0x1f70c1);}return null;};}function patchUpdates(_0x7e6c70){return function(_0x5447f1){try{jsonpatch[_0xade8('0x23')](_0x5447f1,_0x7e6c70,!![]);}catch(_0x106cb5){return BPromise[_0xade8('0x24')](_0x106cb5);}return _0x5447f1[_0xade8('0x25')]();};}function saveUpdates(_0x64b621,_0x45f330){return function(_0x3e4f44){if(_0x3e4f44){return _0x3e4f44['update'](_0x64b621)['then'](function(_0x2fdd87){return _0x2fdd87;});}return null;};}function removeEntity(_0x19595a,_0x490e76){return function(_0x12a8d4){if(_0x12a8d4){return _0x12a8d4[_0xade8('0x26')]()['then'](function(){var _0x41ae0e=_0x12a8d4[_0xade8('0x27')]({'plain':!![]});var _0x219e86=_0xade8('0x28');return db[_0xade8('0x29')]['destroy']({'where':{'type':_0x219e86,'resourceId':_0x41ae0e['id']}})[_0xade8('0x2a')](function(){return _0x12a8d4;});})[_0xade8('0x2a')](function(){_0x19595a[_0xade8('0x1c')](0xcc)[_0xade8('0x1d')]();});}};}function handleEntityNotFound(_0x266f5b,_0x103c59){return function(_0x3ccd79){if(!_0x3ccd79){_0x266f5b[_0xade8('0x1b')](0x194);}return _0x3ccd79;};}function handleError(_0x3fca2a,_0x15d6ba){_0x15d6ba=_0x15d6ba||0x1f4;return function(_0x55dcf4){logger[_0xade8('0x2b')](_0x55dcf4[_0xade8('0x2c')]);if(_0x55dcf4['name']){delete _0x55dcf4[_0xade8('0x2d')];}_0x3fca2a[_0xade8('0x1c')](_0x15d6ba)[_0xade8('0x2e')](_0x55dcf4);};}exports[_0xade8('0x2f')]=function(_0x5be3a8,_0x93b18f){var _0x26426a={},_0x5a2efb={},_0x282f15={'count':0x0,'rows':[]};var _0x516415=_[_0xade8('0x30')](db['Interval'][_0xade8('0x31')],function(_0x565dc5){return{'name':_0x565dc5[_0xade8('0x32')],'type':_0x565dc5['type'][_0xade8('0x33')]};});_0x5a2efb[_0xade8('0x34')]=_[_0xade8('0x30')](_0x516415,_0xade8('0x2d'));_0x5a2efb[_0xade8('0x35')]=_[_0xade8('0x36')](_0x5be3a8[_0xade8('0x35')]);_0x5a2efb['filters']=_[_0xade8('0x37')](_0x5a2efb['model'],_0x5a2efb[_0xade8('0x35')]);_0x26426a[_0xade8('0x38')]=_['intersection'](_0x5a2efb['model'],qs[_0xade8('0x39')](_0x5be3a8[_0xade8('0x35')][_0xade8('0x39')]));_0x26426a['attributes']=_0x26426a[_0xade8('0x38')][_0xade8('0x3a')]?_0x26426a['attributes']:_0x5a2efb[_0xade8('0x34')];if(!_0x5be3a8[_0xade8('0x35')][_0xade8('0x3b')](_0xade8('0x3c'))){_0x26426a[_0xade8('0x3d')]=qs[_0xade8('0x3d')](_0x5be3a8['query'][_0xade8('0x3d')]);_0x26426a[_0xade8('0x20')]=qs[_0xade8('0x20')](_0x5be3a8[_0xade8('0x35')][_0xade8('0x20')]);}_0x26426a[_0xade8('0x3e')]=qs[_0xade8('0x3f')](_0x5be3a8[_0xade8('0x35')][_0xade8('0x3f')]);_0x26426a['where']=qs[_0xade8('0x40')](_[_0xade8('0x41')](_0x5be3a8[_0xade8('0x35')],_0x5a2efb['filters']),_0x516415);if(_0x5be3a8[_0xade8('0x35')][_0xade8('0x42')]){_0x26426a[_0xade8('0x43')]=_[_0xade8('0x44')](_0x26426a[_0xade8('0x43')],{'$or':_['map'](_0x516415,function(_0x330f98){if(_0x330f98['type']!==_0xade8('0x45')){var _0xcd4327={};_0xcd4327[_0x330f98[_0xade8('0x2d')]]={'$like':'%'+_0x5be3a8[_0xade8('0x35')][_0xade8('0x42')]+'%'};return _0xcd4327;}})});}_0x26426a=_[_0xade8('0x44')]({},_0x26426a,_0x5be3a8[_0xade8('0x46')]);var _0x5aa67c={'where':_0x26426a[_0xade8('0x43')]};return db[_0xade8('0x47')][_0xade8('0x1f')](_0x5aa67c)[_0xade8('0x2a')](function(_0x23e59c){_0x282f15[_0xade8('0x1f')]=_0x23e59c;if(_0x5be3a8[_0xade8('0x35')][_0xade8('0x48')]){_0x26426a[_0xade8('0x49')]=[{'all':!![]}];}return db[_0xade8('0x47')][_0xade8('0x4a')](_0x26426a);})[_0xade8('0x2a')](function(_0x8aa91){_0x282f15[_0xade8('0x4b')]=_0x8aa91;return _0x282f15;})[_0xade8('0x2a')](respondWithFilteredResult(_0x93b18f,_0x26426a))['catch'](handleError(_0x93b18f,null));};exports[_0xade8('0x4c')]=function(_0x11b790,_0x336143){var _0x57a06a={'raw':!![],'where':{'id':_0x11b790[_0xade8('0x4d')]['id']}},_0x3e8ee0={};_0x3e8ee0[_0xade8('0x34')]=_[_0xade8('0x36')](db[_0xade8('0x47')]['rawAttributes']);_0x3e8ee0[_0xade8('0x35')]=_[_0xade8('0x36')](_0x11b790[_0xade8('0x35')]);_0x3e8ee0[_0xade8('0x40')]=_[_0xade8('0x37')](_0x3e8ee0['model'],_0x3e8ee0[_0xade8('0x35')]);_0x57a06a['attributes']=_[_0xade8('0x37')](_0x3e8ee0[_0xade8('0x34')],qs[_0xade8('0x39')](_0x11b790[_0xade8('0x35')][_0xade8('0x39')]));_0x57a06a[_0xade8('0x38')]=_0x57a06a[_0xade8('0x38')]['length']?_0x57a06a['attributes']:_0x3e8ee0[_0xade8('0x34')];if(_0x11b790[_0xade8('0x35')][_0xade8('0x48')]){_0x57a06a[_0xade8('0x49')]=[{'all':!![]}];}_0x57a06a=_[_0xade8('0x44')]({},_0x57a06a,_0x11b790[_0xade8('0x46')]);return db[_0xade8('0x47')]['find'](_0x57a06a)[_0xade8('0x2a')](handleEntityNotFound(_0x336143,null))[_0xade8('0x2a')](respondWithResult(_0x336143,null))['catch'](handleError(_0x336143,null));};exports[_0xade8('0x4e')]=function(_0x576e81,_0x4627e3){return db['Interval']['create'](_0x576e81[_0xade8('0x4f')],{})['then'](function(_0x5e6753){var _0x2535e3=_0x576e81['user'][_0xade8('0x27')]({'plain':!![]});if(!_0x2535e3)throw new Error(_0xade8('0x50'));if(_0x2535e3['role']==='user'){var _0x584097=_0x5e6753[_0xade8('0x27')]({'plain':!![]});var _0x3fba26=_0xade8('0x28');return db[_0xade8('0x51')][_0xade8('0x52')]({'where':{'name':_0x3fba26,'userProfileId':_0x2535e3['userProfileId']},'raw':!![]})[_0xade8('0x2a')](function(_0x5be192){if(_0x5be192&&_0x5be192[_0xade8('0x53')]===0x0){return db[_0xade8('0x29')][_0xade8('0x4e')]({'name':_0x584097[_0xade8('0x2d')],'resourceId':_0x584097['id'],'type':_0x5be192[_0xade8('0x2d')],'sectionId':_0x5be192['id']},{})[_0xade8('0x2a')](function(){return _0x5e6753;});}else{return _0x5e6753;}})['catch'](function(_0xe61b86){logger[_0xade8('0x2b')](_0xade8('0x54'),_0xe61b86);throw _0xe61b86;});}return _0x5e6753;})[_0xade8('0x2a')](respondWithResult(_0x4627e3,0xc9))[_0xade8('0x55')](handleError(_0x4627e3,null));};exports[_0xade8('0x56')]=function(_0x1a33e8,_0x21b6ad){if(_0x1a33e8[_0xade8('0x4f')]['id']){delete _0x1a33e8[_0xade8('0x4f')]['id'];}return db[_0xade8('0x47')][_0xade8('0x52')]({'where':{'id':_0x1a33e8[_0xade8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x21b6ad,null))[_0xade8('0x2a')](saveUpdates(_0x1a33e8['body'],null))[_0xade8('0x2a')](respondWithResult(_0x21b6ad,null))[_0xade8('0x55')](handleError(_0x21b6ad,null));};exports[_0xade8('0x26')]=function(_0x20c8f5,_0x1c0471){return db[_0xade8('0x47')]['find']({'where':{'id':_0x20c8f5[_0xade8('0x4d')]['id']}})[_0xade8('0x2a')](handleEntityNotFound(_0x1c0471,null))[_0xade8('0x2a')](removeEntity(_0x1c0471,null))[_0xade8('0x55')](handleError(_0x1c0471,null));};exports[_0xade8('0x57')]=function(_0x2befff,_0x2ea90d,_0x3eab37){if(_0x2befff[_0xade8('0x4f')]['id']){delete _0x2befff[_0xade8('0x4f')]['id'];}return db[_0xade8('0x47')]['find']({'where':{'id':_0x2befff[_0xade8('0x4d')]['id']}})[_0xade8('0x2a')](handleEntityNotFound(_0x2ea90d,null))[_0xade8('0x2a')](function(_0x594de0){if(_0x594de0){_0x2befff[_0xade8('0x4f')][_0xade8('0x58')]=_0x594de0['id'];return db[_0xade8('0x47')]['create'](_0x2befff[_0xade8('0x4f')]);}})['then'](respondWithResult(_0x2ea90d,null))[_0xade8('0x55')](handleError(_0x2ea90d,null));};exports[_0xade8('0x59')]=function(_0x3e74c1,_0x2ba301,_0x511bbd){var _0x148daa={};var _0x4304c1={};var _0xbff3b8;var _0x567542;return db['Interval'][_0xade8('0x5a')]({'where':{'id':_0x3e74c1[_0xade8('0x4d')]['id']}})[_0xade8('0x2a')](handleEntityNotFound(_0x2ba301,null))[_0xade8('0x2a')](function(_0x3f3025){if(_0x3f3025){_0xbff3b8=_0x3f3025;_0x4304c1['model']=_[_0xade8('0x36')](db[_0xade8('0x47')][_0xade8('0x31')]);_0x4304c1[_0xade8('0x35')]=_[_0xade8('0x36')](_0x3e74c1['query']);_0x4304c1[_0xade8('0x40')]=_[_0xade8('0x37')](_0x4304c1[_0xade8('0x34')],_0x4304c1[_0xade8('0x35')]);_0x148daa['attributes']=_[_0xade8('0x37')](_0x4304c1['model'],qs[_0xade8('0x39')](_0x3e74c1[_0xade8('0x35')][_0xade8('0x39')]));_0x148daa['attributes']=_0x148daa['attributes']['length']?_0x148daa[_0xade8('0x38')]:_0x4304c1[_0xade8('0x34')];_0x148daa[_0xade8('0x3e')]=qs[_0xade8('0x3f')](_0x3e74c1['query'][_0xade8('0x3f')]);_0x148daa[_0xade8('0x43')]=qs[_0xade8('0x40')](_['pick'](_0x3e74c1['query'],_0x4304c1[_0xade8('0x40')]));if(_0x3e74c1[_0xade8('0x35')][_0xade8('0x42')]){_0x148daa[_0xade8('0x43')]=_['merge'](_0x148daa[_0xade8('0x43')],{'$or':_[_0xade8('0x30')](_0x148daa[_0xade8('0x38')],function(_0x2158e3){var _0x4e818f={};_0x4e818f[_0x2158e3]={'$like':'%'+_0x3e74c1[_0xade8('0x35')][_0xade8('0x42')]+'%'};return _0x4e818f;})});}_0x148daa=_[_0xade8('0x44')]({},_0x148daa,_0x3e74c1[_0xade8('0x46')]);return _0xbff3b8[_0xade8('0x59')](_0x148daa);}})[_0xade8('0x2a')](function(_0x24eddd){if(_0x24eddd){_0x567542=_0x24eddd['length'];if(!_0x3e74c1[_0xade8('0x35')][_0xade8('0x3b')]('nolimit')){_0x148daa['limit']=qs[_0xade8('0x3d')](_0x3e74c1[_0xade8('0x35')][_0xade8('0x3d')]);_0x148daa[_0xade8('0x20')]=qs[_0xade8('0x20')](_0x3e74c1['query']['offset']);}return _0xbff3b8[_0xade8('0x59')](_0x148daa);}})[_0xade8('0x2a')](function(_0x272c09){if(_0x272c09){return _0x272c09?{'count':_0x567542,'rows':_0x272c09}:null;}})['then'](respondWithResult(_0x2ba301,null))['catch'](handleError(_0x2ba301,null));};exports['addIntervals']=function(_0x65cf18,_0x5685e0,_0x552c2a){return db['Interval'][_0xade8('0x5a')]({'where':{'id':_0x65cf18[_0xade8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5685e0,null))['then'](function(_0x1a8b01){if(_0x1a8b01){return db[_0xade8('0x5b')]['transaction'](function(_0x53d9bb){return db[_0xade8('0x47')][_0xade8('0x26')]({'where':{'IntervalId':_0x65cf18[_0xade8('0x4d')]['id']},'transaction':_0x53d9bb})[_0xade8('0x2a')](function(_0x4be79c){var _0x363bbb=_['map'](_0x65cf18['body'],function(_0xceca14){delete _0xceca14['id'];_0xceca14[_0xade8('0x58')]=_0x65cf18['params']['id'];return _0xceca14;});return db[_0xade8('0x47')][_0xade8('0x5c')](_0x363bbb,{'transaction':_0x53d9bb});});})['then'](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x65cf18['params']['id']}});});}})[_0xade8('0x2a')](respondWithResult(_0x5685e0,null))[_0xade8('0x55')](handleError(_0x5685e0,null));}; \ No newline at end of file +var _0xaa9c=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','addInterval','IntervalId','findOne','order','getIntervals','addIntervals','sequelize','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','model','query','filters','intersection','attributes'];(function(_0x2bb6f2,_0x37616c){var _0x4cc723=function(_0x38e619){while(--_0x38e619){_0x2bb6f2['push'](_0x2bb6f2['shift']());}};_0x4cc723(++_0x37616c);}(_0xaa9c,0x1f4));var _0xcaa9=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xaa9c[_0x4c12ec];return _0x3ae42c;};'use strict';var pdf=require(_0xcaa9('0x0'));var emlformat=require(_0xcaa9('0x1'));var rimraf=require(_0xcaa9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcaa9('0x3'));var rp=require(_0xcaa9('0x4'));var moment=require(_0xcaa9('0x5'));var BPromise=require(_0xcaa9('0x6'));var Mustache=require('mustache');var util=require(_0xcaa9('0x7'));var path=require('path');var sox=require(_0xcaa9('0x8'));var csv=require(_0xcaa9('0x9'));var ejs=require(_0xcaa9('0xa'));var fs=require('fs');var fs_extra=require(_0xcaa9('0xb'));var _=require(_0xcaa9('0xc'));var squel=require(_0xcaa9('0xd'));var crypto=require(_0xcaa9('0xe'));var jsforce=require(_0xcaa9('0xf'));var deskjs=require(_0xcaa9('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcaa9('0x11'));var Papa=require(_0xcaa9('0x12'));var Redis=require(_0xcaa9('0x13'));var authService=require(_0xcaa9('0x14'));var qs=require(_0xcaa9('0x15'));var as=require(_0xcaa9('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaa9('0x17'))(_0xcaa9('0x18'));var utils=require(_0xcaa9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xcaa9('0x1a'));var db=require(_0xcaa9('0x1b'))['db'];var extensions=require(_0xcaa9('0x1c'));function respondWithStatusCode(_0x55b319,_0x33de03){_0x33de03=_0x33de03||0xcc;return function(_0x47b46e){if(_0x47b46e){return _0x55b319[_0xcaa9('0x1d')](_0x33de03);}return _0x55b319[_0xcaa9('0x1e')](_0x33de03)[_0xcaa9('0x1f')]();};}function respondWithResult(_0x333bdf,_0x3ba4e1){_0x3ba4e1=_0x3ba4e1||0xc8;return function(_0x1fdce0){if(_0x1fdce0){return _0x333bdf['status'](_0x3ba4e1)[_0xcaa9('0x20')](_0x1fdce0);}};}function respondWithFilteredResult(_0x4e497e,_0x52ed35){return function(_0x4a5dfc){if(_0x4a5dfc){var _0x188197=_0x4a5dfc[_0xcaa9('0x21')],_0x31411b=_0x52ed35['offset'],_0xafd219=_0x52ed35[_0xcaa9('0x22')]+_0x52ed35[_0xcaa9('0x23')],_0x34854a;if(_0xafd219>=_0x188197){_0xafd219=_0x188197;_0x34854a=0xc8;}else{_0x34854a=0xce;}_0x4e497e[_0xcaa9('0x1e')](_0x34854a);return _0x4e497e[_0xcaa9('0x24')](_0xcaa9('0x25'),_0x31411b+'-'+_0xafd219+'/'+_0x188197)[_0xcaa9('0x20')](_0x4a5dfc);}return null;};}function patchUpdates(_0x3743cc){return function(_0x3f5e4a){try{jsonpatch['apply'](_0x3f5e4a,_0x3743cc,!![]);}catch(_0x39e192){return BPromise[_0xcaa9('0x26')](_0x39e192);}return _0x3f5e4a[_0xcaa9('0x27')]();};}function saveUpdates(_0x41b397,_0x4b74c8){return function(_0x4baa0a){if(_0x4baa0a){return _0x4baa0a[_0xcaa9('0x28')](_0x41b397)[_0xcaa9('0x29')](function(_0x13b4d9){return _0x13b4d9;});}return null;};}function removeEntity(_0x59de94,_0x36ccf6){return function(_0x248049){if(_0x248049){return _0x248049[_0xcaa9('0x2a')]()[_0xcaa9('0x29')](function(){var _0x1bc750=_0x248049['get']({'plain':!![]});var _0x912303=_0xcaa9('0x2b');return db[_0xcaa9('0x2c')][_0xcaa9('0x2a')]({'where':{'type':_0x912303,'resourceId':_0x1bc750['id']}})[_0xcaa9('0x29')](function(){return _0x248049;});})['then'](function(){_0x59de94['status'](0xcc)[_0xcaa9('0x1f')]();});}};}function handleEntityNotFound(_0x474be9,_0x5426a5){return function(_0x53091e){if(!_0x53091e){_0x474be9[_0xcaa9('0x1d')](0x194);}return _0x53091e;};}function handleError(_0x1530b5,_0xdf9f59){_0xdf9f59=_0xdf9f59||0x1f4;return function(_0x5d59eb){logger[_0xcaa9('0x2d')](_0x5d59eb[_0xcaa9('0x2e')]);if(_0x5d59eb[_0xcaa9('0x2f')]){delete _0x5d59eb[_0xcaa9('0x2f')];}_0x1530b5[_0xcaa9('0x1e')](_0xdf9f59)[_0xcaa9('0x30')](_0x5d59eb);};}exports[_0xcaa9('0x31')]=function(_0x59b256,_0x226c6b){var _0x5bb4ba={},_0xa601b4={},_0x80abd9={'count':0x0,'rows':[]};var _0x15b255=_[_0xcaa9('0x32')](db[_0xcaa9('0x33')][_0xcaa9('0x34')],function(_0x2e33b7){return{'name':_0x2e33b7['fieldName'],'type':_0x2e33b7['type']['key']};});_0xa601b4[_0xcaa9('0x35')]=_['map'](_0x15b255,_0xcaa9('0x2f'));_0xa601b4[_0xcaa9('0x36')]=_['keys'](_0x59b256[_0xcaa9('0x36')]);_0xa601b4[_0xcaa9('0x37')]=_[_0xcaa9('0x38')](_0xa601b4[_0xcaa9('0x35')],_0xa601b4[_0xcaa9('0x36')]);_0x5bb4ba[_0xcaa9('0x39')]=_[_0xcaa9('0x38')](_0xa601b4['model'],qs[_0xcaa9('0x3a')](_0x59b256['query'][_0xcaa9('0x3a')]));_0x5bb4ba[_0xcaa9('0x39')]=_0x5bb4ba[_0xcaa9('0x39')][_0xcaa9('0x3b')]?_0x5bb4ba[_0xcaa9('0x39')]:_0xa601b4['model'];if(!_0x59b256[_0xcaa9('0x36')][_0xcaa9('0x3c')](_0xcaa9('0x3d'))){_0x5bb4ba[_0xcaa9('0x23')]=qs[_0xcaa9('0x23')](_0x59b256[_0xcaa9('0x36')]['limit']);_0x5bb4ba['offset']=qs['offset'](_0x59b256[_0xcaa9('0x36')]['offset']);}_0x5bb4ba['order']=qs[_0xcaa9('0x3e')](_0x59b256[_0xcaa9('0x36')][_0xcaa9('0x3e')]);_0x5bb4ba[_0xcaa9('0x3f')]=qs[_0xcaa9('0x37')](_[_0xcaa9('0x40')](_0x59b256['query'],_0xa601b4[_0xcaa9('0x37')]),_0x15b255);if(_0x59b256['query'][_0xcaa9('0x41')]){_0x5bb4ba[_0xcaa9('0x3f')]=_[_0xcaa9('0x42')](_0x5bb4ba['where'],{'$or':_['map'](_0x15b255,function(_0x3a2c82){if(_0x3a2c82[_0xcaa9('0x43')]!==_0xcaa9('0x44')){var _0x1eacbc={};_0x1eacbc[_0x3a2c82[_0xcaa9('0x2f')]]={'$like':'%'+_0x59b256[_0xcaa9('0x36')][_0xcaa9('0x41')]+'%'};return _0x1eacbc;}})});}_0x5bb4ba=_[_0xcaa9('0x42')]({},_0x5bb4ba,_0x59b256[_0xcaa9('0x45')]);var _0x12067b={'where':_0x5bb4ba[_0xcaa9('0x3f')]};return db[_0xcaa9('0x33')][_0xcaa9('0x21')](_0x12067b)[_0xcaa9('0x29')](function(_0x604dd4){_0x80abd9[_0xcaa9('0x21')]=_0x604dd4;if(_0x59b256[_0xcaa9('0x36')][_0xcaa9('0x46')]){_0x5bb4ba[_0xcaa9('0x47')]=[{'all':!![]}];}return db[_0xcaa9('0x33')][_0xcaa9('0x48')](_0x5bb4ba);})[_0xcaa9('0x29')](function(_0x1be025){_0x80abd9['rows']=_0x1be025;return _0x80abd9;})[_0xcaa9('0x29')](respondWithFilteredResult(_0x226c6b,_0x5bb4ba))[_0xcaa9('0x49')](handleError(_0x226c6b,null));};exports[_0xcaa9('0x4a')]=function(_0x325b6e,_0x5bfd0b){var _0x3539b7={'raw':!![],'where':{'id':_0x325b6e[_0xcaa9('0x4b')]['id']}},_0xda5b8c={};_0xda5b8c['model']=_[_0xcaa9('0x4c')](db[_0xcaa9('0x33')][_0xcaa9('0x34')]);_0xda5b8c[_0xcaa9('0x36')]=_[_0xcaa9('0x4c')](_0x325b6e['query']);_0xda5b8c[_0xcaa9('0x37')]=_[_0xcaa9('0x38')](_0xda5b8c[_0xcaa9('0x35')],_0xda5b8c['query']);_0x3539b7[_0xcaa9('0x39')]=_[_0xcaa9('0x38')](_0xda5b8c['model'],qs[_0xcaa9('0x3a')](_0x325b6e[_0xcaa9('0x36')][_0xcaa9('0x3a')]));_0x3539b7['attributes']=_0x3539b7[_0xcaa9('0x39')][_0xcaa9('0x3b')]?_0x3539b7[_0xcaa9('0x39')]:_0xda5b8c[_0xcaa9('0x35')];if(_0x325b6e['query'][_0xcaa9('0x46')]){_0x3539b7[_0xcaa9('0x47')]=[{'all':!![]}];}_0x3539b7=_[_0xcaa9('0x42')]({},_0x3539b7,_0x325b6e['options']);return db[_0xcaa9('0x33')]['find'](_0x3539b7)['then'](handleEntityNotFound(_0x5bfd0b,null))['then'](respondWithResult(_0x5bfd0b,null))[_0xcaa9('0x49')](handleError(_0x5bfd0b,null));};exports[_0xcaa9('0x4d')]=function(_0x8a9d54,_0x5d3bf3){return db[_0xcaa9('0x33')][_0xcaa9('0x4d')](_0x8a9d54[_0xcaa9('0x4e')],{})['then'](function(_0x58b305){var _0x376cd2=_0x8a9d54[_0xcaa9('0x4f')][_0xcaa9('0x50')]({'plain':!![]});if(!_0x376cd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376cd2[_0xcaa9('0x51')]===_0xcaa9('0x4f')){var _0xe8fed6=_0x58b305[_0xcaa9('0x50')]({'plain':!![]});var _0x2eb7d6=_0xcaa9('0x2b');return db[_0xcaa9('0x52')][_0xcaa9('0x53')]({'where':{'name':_0x2eb7d6,'userProfileId':_0x376cd2[_0xcaa9('0x54')]},'raw':!![]})['then'](function(_0x12aa56){if(_0x12aa56&&_0x12aa56[_0xcaa9('0x55')]===0x0){return db[_0xcaa9('0x2c')][_0xcaa9('0x4d')]({'name':_0xe8fed6[_0xcaa9('0x2f')],'resourceId':_0xe8fed6['id'],'type':_0x12aa56[_0xcaa9('0x2f')],'sectionId':_0x12aa56['id']},{})['then'](function(){return _0x58b305;});}else{return _0x58b305;}})['catch'](function(_0xc69c3b){logger[_0xcaa9('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc69c3b);throw _0xc69c3b;});}return _0x58b305;})[_0xcaa9('0x29')](respondWithResult(_0x5d3bf3,0xc9))[_0xcaa9('0x49')](handleError(_0x5d3bf3,null));};exports[_0xcaa9('0x28')]=function(_0x12365e,_0x1f62f1){if(_0x12365e['body']['id']){delete _0x12365e[_0xcaa9('0x4e')]['id'];}return db['Interval']['find']({'where':{'id':_0x12365e[_0xcaa9('0x4b')]['id']}})[_0xcaa9('0x29')](handleEntityNotFound(_0x1f62f1,null))[_0xcaa9('0x29')](saveUpdates(_0x12365e[_0xcaa9('0x4e')],null))[_0xcaa9('0x29')](respondWithResult(_0x1f62f1,null))[_0xcaa9('0x49')](handleError(_0x1f62f1,null));};exports[_0xcaa9('0x2a')]=function(_0x1ec871,_0x22441e){return db[_0xcaa9('0x33')]['find']({'where':{'id':_0x1ec871['params']['id']}})[_0xcaa9('0x29')](handleEntityNotFound(_0x22441e,null))['then'](removeEntity(_0x22441e,null))[_0xcaa9('0x49')](handleError(_0x22441e,null));};exports[_0xcaa9('0x56')]=function(_0x4cd0ed,_0x3007ce,_0x4d6c98){if(_0x4cd0ed[_0xcaa9('0x4e')]['id']){delete _0x4cd0ed[_0xcaa9('0x4e')]['id'];}return db[_0xcaa9('0x33')][_0xcaa9('0x53')]({'where':{'id':_0x4cd0ed[_0xcaa9('0x4b')]['id']}})[_0xcaa9('0x29')](handleEntityNotFound(_0x3007ce,null))[_0xcaa9('0x29')](function(_0x545a38){if(_0x545a38){_0x4cd0ed[_0xcaa9('0x4e')][_0xcaa9('0x57')]=_0x545a38['id'];return db[_0xcaa9('0x33')][_0xcaa9('0x4d')](_0x4cd0ed['body']);}})[_0xcaa9('0x29')](respondWithResult(_0x3007ce,null))['catch'](handleError(_0x3007ce,null));};exports['getIntervals']=function(_0x4f559c,_0x341c0d,_0x497556){var _0x36ef17={};var _0x1524c1={};var _0x185bbc;var _0x19f14f;return db['Interval'][_0xcaa9('0x58')]({'where':{'id':_0x4f559c[_0xcaa9('0x4b')]['id']}})[_0xcaa9('0x29')](handleEntityNotFound(_0x341c0d,null))[_0xcaa9('0x29')](function(_0x133d77){if(_0x133d77){_0x185bbc=_0x133d77;_0x1524c1[_0xcaa9('0x35')]=_['keys'](db[_0xcaa9('0x33')]['rawAttributes']);_0x1524c1[_0xcaa9('0x36')]=_[_0xcaa9('0x4c')](_0x4f559c[_0xcaa9('0x36')]);_0x1524c1[_0xcaa9('0x37')]=_[_0xcaa9('0x38')](_0x1524c1[_0xcaa9('0x35')],_0x1524c1[_0xcaa9('0x36')]);_0x36ef17[_0xcaa9('0x39')]=_[_0xcaa9('0x38')](_0x1524c1['model'],qs[_0xcaa9('0x3a')](_0x4f559c['query'][_0xcaa9('0x3a')]));_0x36ef17[_0xcaa9('0x39')]=_0x36ef17[_0xcaa9('0x39')][_0xcaa9('0x3b')]?_0x36ef17[_0xcaa9('0x39')]:_0x1524c1['model'];_0x36ef17[_0xcaa9('0x59')]=qs[_0xcaa9('0x3e')](_0x4f559c[_0xcaa9('0x36')][_0xcaa9('0x3e')]);_0x36ef17[_0xcaa9('0x3f')]=qs['filters'](_[_0xcaa9('0x40')](_0x4f559c[_0xcaa9('0x36')],_0x1524c1[_0xcaa9('0x37')]));if(_0x4f559c[_0xcaa9('0x36')][_0xcaa9('0x41')]){_0x36ef17[_0xcaa9('0x3f')]=_[_0xcaa9('0x42')](_0x36ef17[_0xcaa9('0x3f')],{'$or':_[_0xcaa9('0x32')](_0x36ef17[_0xcaa9('0x39')],function(_0x394f7e){var _0x4396e2={};_0x4396e2[_0x394f7e]={'$like':'%'+_0x4f559c[_0xcaa9('0x36')][_0xcaa9('0x41')]+'%'};return _0x4396e2;})});}_0x36ef17=_[_0xcaa9('0x42')]({},_0x36ef17,_0x4f559c[_0xcaa9('0x45')]);return _0x185bbc[_0xcaa9('0x5a')](_0x36ef17);}})['then'](function(_0x390f75){if(_0x390f75){_0x19f14f=_0x390f75['length'];if(!_0x4f559c[_0xcaa9('0x36')][_0xcaa9('0x3c')]('nolimit')){_0x36ef17[_0xcaa9('0x23')]=qs[_0xcaa9('0x23')](_0x4f559c['query']['limit']);_0x36ef17['offset']=qs[_0xcaa9('0x22')](_0x4f559c['query'][_0xcaa9('0x22')]);}return _0x185bbc[_0xcaa9('0x5a')](_0x36ef17);}})[_0xcaa9('0x29')](function(_0x335100){if(_0x335100){return _0x335100?{'count':_0x19f14f,'rows':_0x335100}:null;}})[_0xcaa9('0x29')](respondWithResult(_0x341c0d,null))['catch'](handleError(_0x341c0d,null));};exports[_0xcaa9('0x5b')]=function(_0x5d24f0,_0x434339,_0x1c0dce){return db[_0xcaa9('0x33')][_0xcaa9('0x58')]({'where':{'id':_0x5d24f0[_0xcaa9('0x4b')]['id']}})[_0xcaa9('0x29')](handleEntityNotFound(_0x434339,null))[_0xcaa9('0x29')](function(_0xe47f1){if(_0xe47f1){return db[_0xcaa9('0x5c')]['transaction'](function(_0x28d45b){return db['Interval'][_0xcaa9('0x2a')]({'where':{'IntervalId':_0x5d24f0[_0xcaa9('0x4b')]['id']},'transaction':_0x28d45b})[_0xcaa9('0x29')](function(_0x3c84d8){var _0x80b1e4=_[_0xcaa9('0x32')](_0x5d24f0[_0xcaa9('0x4e')],function(_0x2d92f5){delete _0x2d92f5['id'];_0x2d92f5['IntervalId']=_0x5d24f0[_0xcaa9('0x4b')]['id'];return _0x2d92f5;});return db[_0xcaa9('0x33')]['bulkCreate'](_0x80b1e4,{'transaction':_0x28d45b});});})[_0xcaa9('0x29')](function(){return db[_0xcaa9('0x33')]['findAll']({'where':{'IntervalId':_0x5d24f0[_0xcaa9('0x4b')]['id']}});});}})['then'](respondWithResult(_0x434339,null))[_0xcaa9('0x49')](handleError(_0x434339,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1db7730..4edbeef 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 _0xb404=['./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3a769f,_0x3fa0ca){var _0x538069=function(_0x493805){while(--_0x493805){_0x3a769f['push'](_0x3a769f['shift']());}};_0x538069(++_0x3fa0ca);}(_0xb404,0x123));var _0x4b40=function(_0x2f33af,_0x246ba4){_0x2f33af=_0x2f33af-0x0;var _0x54cc99=_0xb404[_0x2f33af];return _0x54cc99;};'use strict';var _=require(_0x4b40('0x0'));var util=require('util');var logger=require(_0x4b40('0x1'))(_0x4b40('0x2'));var moment=require(_0x4b40('0x3'));var BPromise=require(_0x4b40('0x4'));var rp=require(_0x4b40('0x5'));var fs=require('fs');var path=require(_0x4b40('0x6'));var rimraf=require(_0x4b40('0x7'));var config=require(_0x4b40('0x8'));var attributes=require(_0x4b40('0x9'));var extensions=require(_0x4b40('0xa'));module[_0x4b40('0xb')]=function(_0x4c5b7f,_0x2b81c5){return _0x4c5b7f[_0x4b40('0xc')](_0x4b40('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4027ed,_0x556025){extensions[_0x4b40('0xe')](_0x4c5b7f,_0x4027ed);},'afterBulkCreate':function(_0x3a1b2f,_0x552d29,_0x5f3bed){_0x5f3bed();extensions[_0x4b40('0xe')](_0x4c5b7f,_0x3a1b2f[0x0]);},'afterUpdate':function(_0x4b67cd,_0x113be1){extensions[_0x4b40('0xe')](_0x4c5b7f,_0x4b67cd);},'afterDestroy':function(_0x29c1b4,_0x12d8db){extensions['rewrite'](_0x4c5b7f,_0x29c1b4);}}});}; \ No newline at end of file +var _0x2162=['request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','util','api','moment'];(function(_0x191513,_0x25de2e){var _0x5bddab=function(_0x10c663){while(--_0x10c663){_0x191513['push'](_0x191513['shift']());}};_0x5bddab(++_0x25de2e);}(_0x2162,0x110));var _0x2216=function(_0x1dbfa3,_0x5717dd){_0x1dbfa3=_0x1dbfa3-0x0;var _0x4f8e54=_0x2162[_0x1dbfa3];return _0x4f8e54;};'use strict';var _=require('lodash');var util=require(_0x2216('0x0'));var logger=require('../../config/logger')(_0x2216('0x1'));var moment=require(_0x2216('0x2'));var BPromise=require('bluebird');var rp=require(_0x2216('0x3'));var fs=require('fs');var path=require(_0x2216('0x4'));var rimraf=require('rimraf');var config=require(_0x2216('0x5'));var attributes=require(_0x2216('0x6'));var extensions=require(_0x2216('0x7'));module['exports']=function(_0x39378b,_0x4db005){return _0x39378b['define'](_0x2216('0x8'),attributes,{'tableName':_0x2216('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a01d1,_0x2314d8){extensions['rewrite'](_0x39378b,_0x2a01d1);},'afterBulkCreate':function(_0x5dc257,_0x5ef687,_0x4b16f8){_0x4b16f8();extensions[_0x2216('0xa')](_0x39378b,_0x5dc257[0x0]);},'afterUpdate':function(_0x291559,_0x4bae57){extensions[_0x2216('0xa')](_0x39378b,_0x291559);},'afterDestroy':function(_0x1e70cd,_0x462180){extensions[_0x2216('0xa')](_0x39378b,_0x1e70cd);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index d73c714..20a980b 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 _0x0934=['request','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetInterval','Interval','findAll','options','where','attributes','limit','model','include','map','then','ShowInterval','find','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x8c0711,_0x588bba){var _0x51ae03=function(_0x5347eb){while(--_0x5347eb){_0x8c0711['push'](_0x8c0711['shift']());}};_0x51ae03(++_0x588bba);}(_0x0934,0x177));var _0x4093=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x0934[_0x1895b7];return _0x1aecdc;};'use strict';var _=require(_0x4093('0x0'));var util=require(_0x4093('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4093('0x2'));var fs=require('fs');var Redis=require(_0x4093('0x3'));var db=require(_0x4093('0x4'))['db'];var utils=require(_0x4093('0x5'));var logger=require('../../config/logger')(_0x4093('0x6'));var config=require(_0x4093('0x7'));var jayson=require(_0x4093('0x8'));var client=jayson['client'][_0x4093('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ff0ed,_0x1fcfb8,_0x28d2eb){return new BPromise(function(_0x2df411,_0x45bf2d){return client[_0x4093('0xa')](_0x3ff0ed,_0x28d2eb)['then'](function(_0x392b03){logger[_0x4093('0xb')](_0x4093('0xc'),_0x1fcfb8,_0x4093('0xd'));logger[_0x4093('0xe')](_0x4093('0xf'),_0x1fcfb8,_0x4093('0xd'),JSON[_0x4093('0x10')](_0x392b03));if(_0x392b03['error']){if(_0x392b03[_0x4093('0x11')][_0x4093('0x12')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x1fcfb8,_0x392b03[_0x4093('0x11')][_0x4093('0x13')]);return _0x45bf2d(_0x392b03[_0x4093('0x11')][_0x4093('0x13')]);}logger[_0x4093('0x11')](_0x4093('0xc'),_0x1fcfb8,_0x392b03[_0x4093('0x11')][_0x4093('0x13')]);return _0x2df411(_0x392b03[_0x4093('0x11')][_0x4093('0x13')]);}else{logger[_0x4093('0xb')](_0x4093('0xc'),_0x1fcfb8,_0x4093('0xd'));_0x2df411(_0x392b03['result'][_0x4093('0x13')]);}})[_0x4093('0x14')](function(_0x2bff9e){logger[_0x4093('0x11')](_0x4093('0xc'),_0x1fcfb8,_0x2bff9e);_0x45bf2d(_0x2bff9e);});});}exports[_0x4093('0x15')]=function(_0x48b9d9){var _0x5091c5=this;return new Promise(function(_0x2f048b,_0x4c6c74){return db[_0x4093('0x16')][_0x4093('0x17')]({'raw':_0x48b9d9[_0x4093('0x18')]?_0x48b9d9[_0x4093('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x48b9d9[_0x4093('0x18')]?_0x48b9d9[_0x4093('0x18')][_0x4093('0x19')]||null:null,'attributes':_0x48b9d9[_0x4093('0x18')]?_0x48b9d9['options'][_0x4093('0x1a')]||null:null,'limit':_0x48b9d9['options']?_0x48b9d9[_0x4093('0x18')][_0x4093('0x1b')]||null:null,'include':_0x48b9d9[_0x4093('0x18')]?_0x48b9d9[_0x4093('0x18')]['include']?_['map'](_0x48b9d9[_0x4093('0x18')]['include'],function(_0x5674f3){return{'model':db[_0x5674f3[_0x4093('0x1c')]],'as':_0x5674f3['as'],'attributes':_0x5674f3['attributes'],'include':_0x5674f3[_0x4093('0x1d')]?_['map'](_0x5674f3['include'],function(_0x243241){return{'model':db[_0x243241[_0x4093('0x1c')]],'as':_0x243241['as'],'attributes':_0x243241[_0x4093('0x1a')],'include':_0x243241[_0x4093('0x1d')]?_[_0x4093('0x1e')](_0x243241[_0x4093('0x1d')],function(_0x1729ef){return{'model':db[_0x1729ef[_0x4093('0x1c')]],'as':_0x1729ef['as'],'attributes':_0x1729ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x4093('0x1f')](function(_0x1da0f7){logger[_0x4093('0xb')](_0x4093('0x15'),_0x48b9d9);logger[_0x4093('0xe')](_0x4093('0x15'),_0x48b9d9,JSON[_0x4093('0x10')](_0x1da0f7));_0x2f048b(_0x1da0f7);})['catch'](function(_0x5cf98d){logger[_0x4093('0x11')]('GetInterval',_0x5cf98d[_0x4093('0x13')],_0x48b9d9);_0x4c6c74(_0x5091c5['error'](0x1f4,_0x5cf98d[_0x4093('0x13')]));});});};exports[_0x4093('0x20')]=function(_0x15b16b){var _0x3aff8b=this;return new Promise(function(_0x3582ae,_0x5185b9){return db[_0x4093('0x16')][_0x4093('0x21')]({'raw':_0x15b16b[_0x4093('0x18')]?_0x15b16b[_0x4093('0x18')][_0x4093('0x22')]===undefined?!![]:![]:!![],'where':_0x15b16b[_0x4093('0x18')]?_0x15b16b[_0x4093('0x18')]['where']||null:null,'attributes':_0x15b16b[_0x4093('0x18')]?_0x15b16b[_0x4093('0x18')][_0x4093('0x1a')]||null:null,'include':_0x15b16b[_0x4093('0x18')]?_0x15b16b[_0x4093('0x18')][_0x4093('0x1d')]?_[_0x4093('0x1e')](_0x15b16b[_0x4093('0x18')]['include'],function(_0x14e88d){return{'model':db[_0x14e88d[_0x4093('0x1c')]],'as':_0x14e88d['as'],'attributes':_0x14e88d[_0x4093('0x1a')],'include':_0x14e88d[_0x4093('0x1d')]?_[_0x4093('0x1e')](_0x14e88d[_0x4093('0x1d')],function(_0x528169){return{'model':db[_0x528169['model']],'as':_0x528169['as'],'attributes':_0x528169[_0x4093('0x1a')],'include':_0x528169[_0x4093('0x1d')]?_[_0x4093('0x1e')](_0x528169[_0x4093('0x1d')],function(_0xe2a0ce){return{'model':db[_0xe2a0ce['model']],'as':_0xe2a0ce['as'],'attributes':_0xe2a0ce['attributes']};}):[]};}):[]};}):[]:[]})[_0x4093('0x1f')](function(_0x489b84){logger['info']('ShowInterval',_0x15b16b);logger['debug'](_0x4093('0x20'),_0x15b16b,JSON[_0x4093('0x10')](_0x489b84));_0x3582ae(_0x489b84);})[_0x4093('0x14')](function(_0x6d7e2c){logger[_0x4093('0x11')](_0x4093('0x20'),_0x6d7e2c[_0x4093('0x13')],_0x15b16b);_0x5185b9(_0x3aff8b[_0x4093('0x11')](0x1f4,_0x6d7e2c['message']));});});}; \ No newline at end of file +var _0xaab3=['then','info','Interval,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','GetInterval','findAll','options','raw','attributes','limit','include','model','map','catch','find','where','ShowInterval','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4c9ef5,_0x331e5d){var _0x26906b=function(_0x2e92d2){while(--_0x2e92d2){_0x4c9ef5['push'](_0x4c9ef5['shift']());}};_0x26906b(++_0x331e5d);}(_0xaab3,0x18a));var _0x3aab=function(_0x25f178,_0x54f890){_0x25f178=_0x25f178-0x0;var _0x11310c=_0xaab3[_0x25f178];return _0x11310c;};'use strict';var _=require('lodash');var util=require(_0x3aab('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3aab('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3aab('0x2'));var logger=require(_0x3aab('0x3'))(_0x3aab('0x4'));var config=require(_0x3aab('0x5'));var jayson=require(_0x3aab('0x6'));var client=jayson[_0x3aab('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217aa7,_0x1945c3,_0x1c1e41){return new BPromise(function(_0x2b9302,_0x4c1cae){return client[_0x3aab('0x8')](_0x217aa7,_0x1c1e41)[_0x3aab('0x9')](function(_0x35d3ff){logger[_0x3aab('0xa')](_0x3aab('0xb'),_0x1945c3,'request\x20sent');logger[_0x3aab('0xc')]('Interval,\x20%s,\x20%s,\x20%s',_0x1945c3,_0x3aab('0xd'),JSON[_0x3aab('0xe')](_0x35d3ff));if(_0x35d3ff[_0x3aab('0xf')]){if(_0x35d3ff[_0x3aab('0xf')][_0x3aab('0x10')]===0x1f4){logger[_0x3aab('0xf')](_0x3aab('0xb'),_0x1945c3,_0x35d3ff[_0x3aab('0xf')]['message']);return _0x4c1cae(_0x35d3ff[_0x3aab('0xf')][_0x3aab('0x11')]);}logger['error'](_0x3aab('0xb'),_0x1945c3,_0x35d3ff[_0x3aab('0xf')]['message']);return _0x2b9302(_0x35d3ff[_0x3aab('0xf')]['message']);}else{logger[_0x3aab('0xa')](_0x3aab('0xb'),_0x1945c3,_0x3aab('0xd'));_0x2b9302(_0x35d3ff['result'][_0x3aab('0x11')]);}})['catch'](function(_0x39e0f5){logger['error'](_0x3aab('0xb'),_0x1945c3,_0x39e0f5);_0x4c1cae(_0x39e0f5);});});}exports[_0x3aab('0x12')]=function(_0x3f47cf){var _0xae6c60=this;return new Promise(function(_0x2a4aae,_0x443cc9){return db['Interval'][_0x3aab('0x13')]({'raw':_0x3f47cf[_0x3aab('0x14')]?_0x3f47cf[_0x3aab('0x14')][_0x3aab('0x15')]===undefined?!![]:![]:!![],'where':_0x3f47cf[_0x3aab('0x14')]?_0x3f47cf['options']['where']||null:null,'attributes':_0x3f47cf[_0x3aab('0x14')]?_0x3f47cf[_0x3aab('0x14')][_0x3aab('0x16')]||null:null,'limit':_0x3f47cf[_0x3aab('0x14')]?_0x3f47cf[_0x3aab('0x14')][_0x3aab('0x17')]||null:null,'include':_0x3f47cf[_0x3aab('0x14')]?_0x3f47cf[_0x3aab('0x14')][_0x3aab('0x18')]?_['map'](_0x3f47cf[_0x3aab('0x14')][_0x3aab('0x18')],function(_0x1e08f6){return{'model':db[_0x1e08f6[_0x3aab('0x19')]],'as':_0x1e08f6['as'],'attributes':_0x1e08f6[_0x3aab('0x16')],'include':_0x1e08f6['include']?_[_0x3aab('0x1a')](_0x1e08f6[_0x3aab('0x18')],function(_0x313bcc){return{'model':db[_0x313bcc['model']],'as':_0x313bcc['as'],'attributes':_0x313bcc[_0x3aab('0x16')],'include':_0x313bcc['include']?_[_0x3aab('0x1a')](_0x313bcc[_0x3aab('0x18')],function(_0x1b4eee){return{'model':db[_0x1b4eee[_0x3aab('0x19')]],'as':_0x1b4eee['as'],'attributes':_0x1b4eee['attributes']};}):[]};}):[]};}):[]:[]})[_0x3aab('0x9')](function(_0x4c7e2b){logger['info'](_0x3aab('0x12'),_0x3f47cf);logger[_0x3aab('0xc')](_0x3aab('0x12'),_0x3f47cf,JSON['stringify'](_0x4c7e2b));_0x2a4aae(_0x4c7e2b);})[_0x3aab('0x1b')](function(_0x9f5a65){logger[_0x3aab('0xf')](_0x3aab('0x12'),_0x9f5a65[_0x3aab('0x11')],_0x3f47cf);_0x443cc9(_0xae6c60[_0x3aab('0xf')](0x1f4,_0x9f5a65[_0x3aab('0x11')]));});});};exports['ShowInterval']=function(_0x5cbc5b){var _0x34631d=this;return new Promise(function(_0x333691,_0xa5a12d){return db['Interval'][_0x3aab('0x1c')]({'raw':_0x5cbc5b[_0x3aab('0x14')]?_0x5cbc5b[_0x3aab('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5cbc5b[_0x3aab('0x14')]?_0x5cbc5b[_0x3aab('0x14')][_0x3aab('0x1d')]||null:null,'attributes':_0x5cbc5b[_0x3aab('0x14')]?_0x5cbc5b['options']['attributes']||null:null,'include':_0x5cbc5b[_0x3aab('0x14')]?_0x5cbc5b[_0x3aab('0x14')][_0x3aab('0x18')]?_[_0x3aab('0x1a')](_0x5cbc5b[_0x3aab('0x14')][_0x3aab('0x18')],function(_0x4235fd){return{'model':db[_0x4235fd['model']],'as':_0x4235fd['as'],'attributes':_0x4235fd[_0x3aab('0x16')],'include':_0x4235fd['include']?_[_0x3aab('0x1a')](_0x4235fd[_0x3aab('0x18')],function(_0x23faf6){return{'model':db[_0x23faf6['model']],'as':_0x23faf6['as'],'attributes':_0x23faf6['attributes'],'include':_0x23faf6[_0x3aab('0x18')]?_['map'](_0x23faf6[_0x3aab('0x18')],function(_0xb32144){return{'model':db[_0xb32144[_0x3aab('0x19')]],'as':_0xb32144['as'],'attributes':_0xb32144['attributes']};}):[]};}):[]};}):[]:[]})[_0x3aab('0x9')](function(_0x4034c1){logger[_0x3aab('0xa')](_0x3aab('0x1e'),_0x5cbc5b);logger[_0x3aab('0xc')](_0x3aab('0x1e'),_0x5cbc5b,JSON[_0x3aab('0xe')](_0x4034c1));_0x333691(_0x4034c1);})['catch'](function(_0x2c6ecd){logger[_0x3aab('0xf')]('ShowInterval',_0x2c6ecd[_0x3aab('0x11')],_0x5cbc5b);_0xa5a12d(_0x34631d[_0x3aab('0xf')](0x1f4,_0x2c6ecd[_0x3aab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 723e2cc..94c3d39 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 _0x3be6=['./jira.controller','post','isAuthenticated','send','exports','express','Router','../../components/auth/service'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x3be6,0x6d));var _0x63be=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0x3be6[_0x580971];return _0x16d873;};'use strict';var express=require(_0x63be('0x0'));var router=express[_0x63be('0x1')]();var auth=require(_0x63be('0x2'));var controller=require(_0x63be('0x3'));router[_0x63be('0x4')]('/',auth[_0x63be('0x5')](),controller[_0x63be('0x6')]);module[_0x63be('0x7')]=router; \ No newline at end of file +var _0xa3f4=['post','isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x118862,_0x19a21b){var _0x3ff03d=function(_0x1bf2b4){while(--_0x1bf2b4){_0x118862['push'](_0x118862['shift']());}};_0x3ff03d(++_0x19a21b);}(_0xa3f4,0x1ec));var _0x4a3f=function(_0x464fcd,_0x3ab804){_0x464fcd=_0x464fcd-0x0;var _0x43d14c=_0xa3f4[_0x464fcd];return _0x43d14c;};'use strict';var express=require(_0x4a3f('0x0'));var router=express[_0x4a3f('0x1')]();var auth=require(_0x4a3f('0x2'));var controller=require(_0x4a3f('0x3'));router[_0x4a3f('0x4')]('/',auth[_0x4a3f('0x5')](),controller[_0x4a3f('0x6')]);module[_0x4a3f('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 9cb0055..df060aa 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 _0x69a9=['parse','api.jira','openIssue','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','https','key','MOTGUI','description','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','stringify','setEncoding','data','end','status','statusCode','json'];(function(_0x311666,_0x17b07d){var _0x2bc692=function(_0x200073){while(--_0x200073){_0x311666['push'](_0x311666['shift']());}};_0x2bc692(++_0x17b07d);}(_0x69a9,0x10b));var _0x969a=function(_0x49e2b1,_0x107057){_0x49e2b1=_0x49e2b1-0x0;var _0x43b842=_0x69a9[_0x49e2b1];return _0x43b842;};'use strict';var BPromise=require(_0x969a('0x0'));var https=require(_0x969a('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x2c3918,_0x5e9539){var _0x3528a3={'fields':{'project':{'key':_0x2c3918[_0x969a('0x2')]||_0x969a('0x3')},'summary':(_0x2c3918['summary']||'Report')+'\x20from\x20'+_0x2c3918['ip'],'description':_0x2c3918[_0x969a('0x4')]||JSON['stringify'](_0x2c3918),'issuetype':{'name':_0x2c3918['issuetype']||_0x969a('0x5')}}};_0x3528a3[_0x969a('0x6')][_0x969a('0x7')]=_0x2c3918['email'];_0x3528a3[_0x969a('0x6')][_0x969a('0x8')]=_0x2c3918[_0x969a('0x9')];_0x3528a3['fields'][_0x969a('0xa')]=_0x2c3918[_0x969a('0xb')];_0x3528a3[_0x969a('0x6')][_0x969a('0xc')]=_0x2c3918[_0x969a('0xd')];_0x3528a3[_0x969a('0x6')][_0x969a('0xe')]=_0x2c3918[_0x969a('0xf')];_0x3528a3['fields'][_0x969a('0x10')]=_0x2c3918['ip'];var _0x19fe6f={'host':_0x969a('0x11'),'port':0x1bb,'path':_0x969a('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x969a('0x13'),'Authorization':_0x969a('0x14')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x969a('0x15'))}};var _0x5c906c=JSON[_0x969a('0x16')](_0x3528a3);var _0x19c767=https['request'](_0x19fe6f,function(_0xc4dfef){_0xc4dfef[_0x969a('0x17')]('utf8');var _0x206a4f='';_0xc4dfef['on'](_0x969a('0x18'),function(_0x44655b){_0x206a4f+=_0x44655b;});_0xc4dfef['on'](_0x969a('0x19'),function(){if(_0x5e9539){return _0x5e9539[_0x969a('0x1a')](_0xc4dfef[_0x969a('0x1b')])[_0x969a('0x1c')](JSON[_0x969a('0x1d')](_0x206a4f));}});});_0x19c767['on']('error',function(_0x588d27){if(_0x5e9539){return _0x5e9539[_0x969a('0x1a')](0x1f4)[_0x969a('0x1c')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x969a('0x1e')}]});}});_0x19c767['write'](_0x5c906c);_0x19c767[_0x969a('0x19')]();}exports[_0x969a('0x1f')]=openIssue;exports['send']=function(_0x13c29c,_0x58eb7e){_0x13c29c[_0x969a('0x20')]['ip']=_0x13c29c[_0x969a('0x21')][_0x969a('0x22')]||_0x13c29c['connection']['remoteAddress']||_0x13c29c['socket'][_0x969a('0x23')]||_0x13c29c['connection'][_0x969a('0x24')][_0x969a('0x23')];return openIssue(_0x13c29c[_0x969a('0x20')],_0x58eb7e);}; \ No newline at end of file +var _0x86e4=['customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','utf8','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','email','fields','customfield_11501','oldToken'];(function(_0x5706cc,_0x23435a){var _0x337f3c=function(_0x45d499){while(--_0x45d499){_0x5706cc['push'](_0x5706cc['shift']());}};_0x337f3c(++_0x23435a);}(_0x86e4,0x167));var _0x486e=function(_0x372515,_0xdd11f){_0x372515=_0x372515-0x0;var _0xa3bf4e=_0x86e4[_0x372515];return _0xa3bf4e;};'use strict';var BPromise=require(_0x486e('0x0'));var https=require(_0x486e('0x1'));var logger=require(_0x486e('0x2'))(_0x486e('0x3'));var USERNAME=_0x486e('0x4');var PASSWORD=_0x486e('0x5');function openIssue(_0x1d2ce1,_0x483dde){var _0x5921b6={'fields':{'project':{'key':_0x1d2ce1[_0x486e('0x6')]||_0x486e('0x7')},'summary':(_0x1d2ce1[_0x486e('0x8')]||_0x486e('0x9'))+'\x20from\x20'+_0x1d2ce1['ip'],'description':_0x1d2ce1[_0x486e('0xa')]||JSON[_0x486e('0xb')](_0x1d2ce1),'issuetype':{'name':_0x1d2ce1[_0x486e('0xc')]||'Bug'}}};_0x5921b6['fields']['customfield_11500']=_0x1d2ce1[_0x486e('0xd')];_0x5921b6[_0x486e('0xe')][_0x486e('0xf')]=_0x1d2ce1[_0x486e('0x10')];_0x5921b6[_0x486e('0xe')][_0x486e('0x11')]=_0x1d2ce1[_0x486e('0x12')];_0x5921b6[_0x486e('0xe')][_0x486e('0x13')]=_0x1d2ce1[_0x486e('0x14')];_0x5921b6[_0x486e('0xe')][_0x486e('0x15')]=_0x1d2ce1[_0x486e('0x16')];_0x5921b6['fields']['customfield_10102']=_0x1d2ce1['ip'];var _0x23ad78={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x486e('0x17'),'method':_0x486e('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x486e('0x19'),'Authorization':_0x486e('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x486e('0x1b')]('base64')}};var _0x2b48a3=JSON['stringify'](_0x5921b6);var _0x1c1151=https[_0x486e('0x1c')](_0x23ad78,function(_0x20f9d2){_0x20f9d2['setEncoding'](_0x486e('0x1d'));var _0x2dd961='';_0x20f9d2['on'](_0x486e('0x1e'),function(_0x311abe){_0x2dd961+=_0x311abe;});_0x20f9d2['on'](_0x486e('0x1f'),function(){if(_0x483dde){return _0x483dde[_0x486e('0x20')](_0x20f9d2[_0x486e('0x21')])[_0x486e('0x22')](JSON[_0x486e('0x23')](_0x2dd961));}});});_0x1c1151['on']('error',function(_0x442ce4){if(_0x483dde){return _0x483dde['status'](0x1f4)[_0x486e('0x22')]({'errors':[{'message':_0x486e('0x24'),'type':_0x486e('0x25')}]});}});_0x1c1151[_0x486e('0x26')](_0x2b48a3);_0x1c1151[_0x486e('0x1f')]();}exports[_0x486e('0x27')]=openIssue;exports[_0x486e('0x28')]=function(_0x250ad0,_0x547c15){_0x250ad0[_0x486e('0x29')]['ip']=_0x250ad0[_0x486e('0x2a')][_0x486e('0x2b')]||_0x250ad0[_0x486e('0x2c')]['remoteAddress']||_0x250ad0[_0x486e('0x2d')][_0x486e('0x2e')]||_0x250ad0['connection'][_0x486e('0x2d')][_0x486e('0x2e')];return openIssue(_0x250ad0[_0x486e('0x29')],_0x547c15);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3397fff..5db1696 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 _0x4cbf=['get','isAuthenticated','index','/describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller'];(function(_0x2f0268,_0x29b269){var _0x2bb096=function(_0x43bb13){while(--_0x43bb13){_0x2f0268['push'](_0x2f0268['shift']());}};_0x2bb096(++_0x29b269);}(_0x4cbf,0x19a));var _0xf4cb=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4cbf[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xf4cb('0x0'));var util=require(_0xf4cb('0x1'));var path=require(_0xf4cb('0x2'));var timeout=require(_0xf4cb('0x3'));var express=require(_0xf4cb('0x4'));var router=express[_0xf4cb('0x5')]();var fs_extra=require(_0xf4cb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf4cb('0x7'));var config=require(_0xf4cb('0x8'));var controller=require(_0xf4cb('0x9'));router[_0xf4cb('0xa')]('/',auth[_0xf4cb('0xb')](),controller[_0xf4cb('0xc')]);router[_0xf4cb('0xa')](_0xf4cb('0xd'),auth[_0xf4cb('0xb')](),controller['describe']);router[_0xf4cb('0xa')](_0xf4cb('0xe'),auth[_0xf4cb('0xb')](),controller[_0xf4cb('0xf')]);router[_0xf4cb('0x10')]('/',auth[_0xf4cb('0xb')](),controller[_0xf4cb('0x11')]);router['put'](_0xf4cb('0xe'),auth['isAuthenticated'](),controller[_0xf4cb('0x12')]);router['delete']('/:id',auth[_0xf4cb('0xb')](),controller[_0xf4cb('0x13')]);module[_0xf4cb('0x14')]=router; \ No newline at end of file +var _0x8e38=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','put','update','delete','destroy'];(function(_0x200242,_0x29d042){var _0x44104c=function(_0x4f6087){while(--_0x4f6087){_0x200242['push'](_0x200242['shift']());}};_0x44104c(++_0x29d042);}(_0x8e38,0x16a));var _0x88e3=function(_0x2e8c30,_0x1e8d3e){_0x2e8c30=_0x2e8c30-0x0;var _0x523b93=_0x8e38[_0x2e8c30];return _0x523b93;};'use strict';var multer=require(_0x88e3('0x0'));var util=require(_0x88e3('0x1'));var path=require(_0x88e3('0x2'));var timeout=require(_0x88e3('0x3'));var express=require(_0x88e3('0x4'));var router=express[_0x88e3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x88e3('0x6'));var interaction=require(_0x88e3('0x7'));var config=require('../../config/environment');var controller=require(_0x88e3('0x8'));router['get']('/',auth[_0x88e3('0x9')](),controller['index']);router[_0x88e3('0xa')](_0x88e3('0xb'),auth[_0x88e3('0x9')](),controller[_0x88e3('0xc')]);router[_0x88e3('0xa')](_0x88e3('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x88e3('0xe')](_0x88e3('0xd'),auth['isAuthenticated'](),controller[_0x88e3('0xf')]);router[_0x88e3('0x10')](_0x88e3('0xd'),auth[_0x88e3('0x9')](),controller[_0x88e3('0x11')]);module[_0x88e3('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 1e4b212..fc7c79d 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 _0xdb94=['STRING','sequelize','exports','TEXT','long'];(function(_0x20b822,_0x479e34){var _0x37dd6c=function(_0x4a60b6){while(--_0x4a60b6){_0x20b822['push'](_0x20b822['shift']());}};_0x37dd6c(++_0x479e34);}(_0xdb94,0xab));var _0x4db9=function(_0x2d66ee,_0x27b65c){_0x2d66ee=_0x2d66ee-0x0;var _0x5c7b7a=_0xdb94[_0x2d66ee];return _0x5c7b7a;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'question':{'type':Sequelize[_0x4db9('0x2')]},'answer':{'type':Sequelize[_0x4db9('0x2')](_0x4db9('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x4db9('0x4')]},'queue':{'type':Sequelize[_0x4db9('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4db9('0x4')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x13f6=['sequelize','exports','long','STRING'];(function(_0x6f05ee,_0x552589){var _0x47c597=function(_0x589d90){while(--_0x589d90){_0x6f05ee['push'](_0x6f05ee['shift']());}};_0x47c597(++_0x552589);}(_0x13f6,0x124));var _0x613f=function(_0x113a52,_0x2b94c5){_0x113a52=_0x113a52-0x0;var _0x4cb9b9=_0x13f6[_0x113a52];return _0x4cb9b9;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize['TEXT'](_0x613f('0x2'))},'membername':{'type':Sequelize[_0x613f('0x3')]},'projectname':{'type':Sequelize[_0x613f('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x613f('0x3')]},'calleridname':{'type':Sequelize[_0x613f('0x3')]},'calleridnum':{'type':Sequelize[_0x613f('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index b85caf5..c16b969 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 _0x960a=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x2223ed,_0x27e51b){var _0x4b8063=function(_0x544067){while(--_0x544067){_0x2223ed['push'](_0x2223ed['shift']());}};_0x4b8063(++_0x27e51b);}(_0x960a,0x176));var _0xa960=function(_0x55eb06,_0x3ed231){_0x55eb06=_0x55eb06-0x0;var _0x30441b=_0x960a[_0x55eb06];return _0x30441b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa960('0x0'));var rimraf=require(_0xa960('0x1'));var zipdir=require(_0xa960('0x2'));var jsonpatch=require(_0xa960('0x3'));var rp=require(_0xa960('0x4'));var moment=require(_0xa960('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa960('0x6'));var util=require('util');var path=require(_0xa960('0x7'));var sox=require(_0xa960('0x8'));var csv=require(_0xa960('0x9'));var ejs=require(_0xa960('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa960('0xb'));var crypto=require(_0xa960('0xc'));var jsforce=require(_0xa960('0xd'));var deskjs=require(_0xa960('0xe'));var toCsv=require(_0xa960('0x9'));var querystring=require(_0xa960('0xf'));var Papa=require(_0xa960('0x10'));var Redis=require(_0xa960('0x11'));var authService=require(_0xa960('0x12'));var qs=require(_0xa960('0x13'));var as=require(_0xa960('0x14'));var hardwareService=require(_0xa960('0x15'));var logger=require('../../config/logger')(_0xa960('0x16'));var utils=require(_0xa960('0x17'));var config=require(_0xa960('0x18'));var licenseUtil=require(_0xa960('0x19'));var db=require(_0xa960('0x1a'))['db'];function respondWithStatusCode(_0x5ddcaa,_0x1268ff){_0x1268ff=_0x1268ff||0xcc;return function(_0x503e6c){if(_0x503e6c){return _0x5ddcaa[_0xa960('0x1b')](_0x1268ff);}return _0x5ddcaa[_0xa960('0x1c')](_0x1268ff)[_0xa960('0x1d')]();};}function respondWithResult(_0x330406,_0x2747ae){_0x2747ae=_0x2747ae||0xc8;return function(_0x3fb804){if(_0x3fb804){return _0x330406[_0xa960('0x1c')](_0x2747ae)['json'](_0x3fb804);}};}function respondWithFilteredResult(_0x3e8c99,_0x2670a9){return function(_0x1b99d1){if(_0x1b99d1){var _0x1513c6=_0x1b99d1[_0xa960('0x1e')],_0x501870=_0x2670a9[_0xa960('0x1f')],_0x1af900=_0x2670a9[_0xa960('0x1f')]+_0x2670a9['limit'],_0x14e333;if(_0x1af900>=_0x1513c6){_0x1af900=_0x1513c6;_0x14e333=0xc8;}else{_0x14e333=0xce;}_0x3e8c99[_0xa960('0x1c')](_0x14e333);return _0x3e8c99[_0xa960('0x20')](_0xa960('0x21'),_0x501870+'-'+_0x1af900+'/'+_0x1513c6)[_0xa960('0x22')](_0x1b99d1);}return null;};}function patchUpdates(_0x319bbe){return function(_0x1b2eea){try{jsonpatch[_0xa960('0x23')](_0x1b2eea,_0x319bbe,!![]);}catch(_0x430fc2){return BPromise[_0xa960('0x24')](_0x430fc2);}return _0x1b2eea[_0xa960('0x25')]();};}function saveUpdates(_0xc2d503,_0x356f19){return function(_0x216244){if(_0x216244){return _0x216244[_0xa960('0x26')](_0xc2d503)[_0xa960('0x27')](function(_0x7236e2){return _0x7236e2;});}return null;};}function removeEntity(_0x7de3c3,_0xadf2bb){return function(_0x3a88f5){if(_0x3a88f5){return _0x3a88f5[_0xa960('0x28')]()['then'](function(){_0x7de3c3[_0xa960('0x1c')](0xcc)[_0xa960('0x1d')]();});}};}function handleEntityNotFound(_0x3709c0,_0x46e0bb){return function(_0x2a9d1c){if(!_0x2a9d1c){_0x3709c0[_0xa960('0x1b')](0x194);}return _0x2a9d1c;};}function handleError(_0x241520,_0x3bde9a){_0x3bde9a=_0x3bde9a||0x1f4;return function(_0x5670e7){logger[_0xa960('0x29')](_0x5670e7[_0xa960('0x2a')]);if(_0x5670e7[_0xa960('0x2b')]){delete _0x5670e7[_0xa960('0x2b')];}_0x241520['status'](_0x3bde9a)['send'](_0x5670e7);};}exports[_0xa960('0x2c')]=function(_0x2ccb57,_0x75d365){var _0x4a8337={},_0x4b5e05={},_0x17939f={'count':0x0,'rows':[]};var _0x459544=_[_0xa960('0x2d')](db[_0xa960('0x2e')][_0xa960('0x2f')],function(_0x52a021){return{'name':_0x52a021[_0xa960('0x30')],'type':_0x52a021[_0xa960('0x31')][_0xa960('0x32')]};});_0x4b5e05[_0xa960('0x33')]=_['map'](_0x459544,'name');_0x4b5e05[_0xa960('0x34')]=_['keys'](_0x2ccb57[_0xa960('0x34')]);_0x4b5e05[_0xa960('0x35')]=_[_0xa960('0x36')](_0x4b5e05[_0xa960('0x33')],_0x4b5e05['query']);_0x4a8337[_0xa960('0x37')]=_[_0xa960('0x36')](_0x4b5e05['model'],qs[_0xa960('0x38')](_0x2ccb57[_0xa960('0x34')][_0xa960('0x38')]));_0x4a8337[_0xa960('0x37')]=_0x4a8337[_0xa960('0x37')][_0xa960('0x39')]?_0x4a8337[_0xa960('0x37')]:_0x4b5e05[_0xa960('0x33')];if(!_0x2ccb57[_0xa960('0x34')]['hasOwnProperty']('nolimit')){_0x4a8337[_0xa960('0x3a')]=qs[_0xa960('0x3a')](_0x2ccb57[_0xa960('0x34')][_0xa960('0x3a')]);_0x4a8337[_0xa960('0x1f')]=qs['offset'](_0x2ccb57[_0xa960('0x34')][_0xa960('0x1f')]);}_0x4a8337['order']=qs[_0xa960('0x3b')](_0x2ccb57[_0xa960('0x34')][_0xa960('0x3b')]);_0x4a8337[_0xa960('0x3c')]=qs[_0xa960('0x35')](_['pick'](_0x2ccb57[_0xa960('0x34')],_0x4b5e05[_0xa960('0x35')]),_0x459544);if(_0x2ccb57[_0xa960('0x34')][_0xa960('0x3d')]){_0x4a8337[_0xa960('0x3c')]=_[_0xa960('0x3e')](_0x4a8337[_0xa960('0x3c')],{'$or':_[_0xa960('0x2d')](_0x459544,function(_0x5499d8){if(_0x5499d8['type']!==_0xa960('0x3f')){var _0x13f775={};_0x13f775[_0x5499d8[_0xa960('0x2b')]]={'$like':'%'+_0x2ccb57[_0xa960('0x34')][_0xa960('0x3d')]+'%'};return _0x13f775;}})});}_0x4a8337=_['merge']({},_0x4a8337,_0x2ccb57[_0xa960('0x40')]);var _0x261b9d={'where':_0x4a8337[_0xa960('0x3c')]};return db[_0xa960('0x2e')][_0xa960('0x1e')](_0x261b9d)['then'](function(_0x43eb66){_0x17939f[_0xa960('0x1e')]=_0x43eb66;if(_0x2ccb57[_0xa960('0x34')][_0xa960('0x41')]){_0x4a8337[_0xa960('0x42')]=[{'all':!![]}];}return db[_0xa960('0x2e')][_0xa960('0x43')](_0x4a8337);})[_0xa960('0x27')](function(_0x35b04b){_0x17939f[_0xa960('0x44')]=_0x35b04b;return _0x17939f;})[_0xa960('0x27')](respondWithFilteredResult(_0x75d365,_0x4a8337))[_0xa960('0x45')](handleError(_0x75d365,null));};exports[_0xa960('0x46')]=function(_0x280e25,_0x4450f7){var _0x28e8ef={'raw':!![],'where':{'id':_0x280e25[_0xa960('0x47')]['id']}},_0x5927d6={};_0x5927d6[_0xa960('0x33')]=_[_0xa960('0x48')](db[_0xa960('0x2e')][_0xa960('0x2f')]);_0x5927d6[_0xa960('0x34')]=_[_0xa960('0x48')](_0x280e25[_0xa960('0x34')]);_0x5927d6['filters']=_[_0xa960('0x36')](_0x5927d6[_0xa960('0x33')],_0x5927d6[_0xa960('0x34')]);_0x28e8ef[_0xa960('0x37')]=_[_0xa960('0x36')](_0x5927d6['model'],qs[_0xa960('0x38')](_0x280e25[_0xa960('0x34')][_0xa960('0x38')]));_0x28e8ef[_0xa960('0x37')]=_0x28e8ef['attributes']['length']?_0x28e8ef[_0xa960('0x37')]:_0x5927d6[_0xa960('0x33')];if(_0x280e25[_0xa960('0x34')][_0xa960('0x41')]){_0x28e8ef['include']=[{'all':!![]}];}_0x28e8ef=_[_0xa960('0x3e')]({},_0x28e8ef,_0x280e25[_0xa960('0x40')]);return db[_0xa960('0x2e')][_0xa960('0x49')](_0x28e8ef)[_0xa960('0x27')](handleEntityNotFound(_0x4450f7,null))[_0xa960('0x27')](respondWithResult(_0x4450f7,null))[_0xa960('0x45')](handleError(_0x4450f7,null));};exports[_0xa960('0x4a')]=function(_0x1b246a,_0x91055f){return db['JscriptyAnswerReport'][_0xa960('0x4a')](_0x1b246a['body'],{})['then'](respondWithResult(_0x91055f,0xc9))[_0xa960('0x45')](handleError(_0x91055f,null));};exports[_0xa960('0x26')]=function(_0x109c53,_0x2b743b){if(_0x109c53[_0xa960('0x4b')]['id']){delete _0x109c53['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x109c53[_0xa960('0x47')]['id']}})[_0xa960('0x27')](handleEntityNotFound(_0x2b743b,null))[_0xa960('0x27')](saveUpdates(_0x109c53[_0xa960('0x4b')],null))[_0xa960('0x27')](respondWithResult(_0x2b743b,null))['catch'](handleError(_0x2b743b,null));};exports[_0xa960('0x28')]=function(_0x390e73,_0x4f5f72){return db[_0xa960('0x2e')][_0xa960('0x49')]({'where':{'id':_0x390e73[_0xa960('0x47')]['id']}})[_0xa960('0x27')](handleEntityNotFound(_0x4f5f72,null))[_0xa960('0x27')](removeEntity(_0x4f5f72,null))[_0xa960('0x45')](handleError(_0x4f5f72,null));};exports[_0xa960('0x4c')]=function(_0x5dcf52,_0x5e8337){return db[_0xa960('0x2e')][_0xa960('0x4c')]()['then'](respondWithResult(_0x5e8337,null))[_0xa960('0x45')](handleError(_0x5e8337,null));}; \ No newline at end of file +var _0x5b20=['crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit','Content-Range','reject','save','then','sendStatus','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1f1429,_0x190d47){var _0xa65e5=function(_0x37d267){while(--_0x37d267){_0x1f1429['push'](_0x1f1429['shift']());}};_0xa65e5(++_0x190d47);}(_0x5b20,0x147));var _0x05b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5b20[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x05b2('0x0'));var zipdir=require(_0x05b2('0x1'));var jsonpatch=require(_0x05b2('0x2'));var rp=require(_0x05b2('0x3'));var moment=require(_0x05b2('0x4'));var BPromise=require(_0x05b2('0x5'));var Mustache=require(_0x05b2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x05b2('0x7'));var csv=require(_0x05b2('0x8'));var ejs=require(_0x05b2('0x9'));var fs=require('fs');var fs_extra=require(_0x05b2('0xa'));var _=require(_0x05b2('0xb'));var squel=require(_0x05b2('0xc'));var crypto=require(_0x05b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x05b2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x05b2('0xf'));var Redis=require(_0x05b2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x05b2('0x11'));var hardwareService=require(_0x05b2('0x12'));var logger=require(_0x05b2('0x13'))(_0x05b2('0x14'));var utils=require(_0x05b2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f4b79,_0x26940d){_0x26940d=_0x26940d||0xcc;return function(_0x19a791){if(_0x19a791){return _0x2f4b79['sendStatus'](_0x26940d);}return _0x2f4b79[_0x05b2('0x16')](_0x26940d)[_0x05b2('0x17')]();};}function respondWithResult(_0x20a39c,_0x1166f6){_0x1166f6=_0x1166f6||0xc8;return function(_0x1b9e2f){if(_0x1b9e2f){return _0x20a39c[_0x05b2('0x16')](_0x1166f6)[_0x05b2('0x18')](_0x1b9e2f);}};}function respondWithFilteredResult(_0x30f073,_0x3803a3){return function(_0x11f69d){if(_0x11f69d){var _0x5bd043=_0x11f69d[_0x05b2('0x19')],_0x2d83ef=_0x3803a3[_0x05b2('0x1a')],_0x32048b=_0x3803a3[_0x05b2('0x1a')]+_0x3803a3[_0x05b2('0x1b')],_0x4f96df;if(_0x32048b>=_0x5bd043){_0x32048b=_0x5bd043;_0x4f96df=0xc8;}else{_0x4f96df=0xce;}_0x30f073[_0x05b2('0x16')](_0x4f96df);return _0x30f073['set'](_0x05b2('0x1c'),_0x2d83ef+'-'+_0x32048b+'/'+_0x5bd043)[_0x05b2('0x18')](_0x11f69d);}return null;};}function patchUpdates(_0x274ceb){return function(_0x1797bf){try{jsonpatch['apply'](_0x1797bf,_0x274ceb,!![]);}catch(_0x196358){return BPromise[_0x05b2('0x1d')](_0x196358);}return _0x1797bf[_0x05b2('0x1e')]();};}function saveUpdates(_0x1fac06,_0x275f87){return function(_0xf3d956){if(_0xf3d956){return _0xf3d956['update'](_0x1fac06)['then'](function(_0x2a7fd5){return _0x2a7fd5;});}return null;};}function removeEntity(_0x3ccfff,_0x3ddda3){return function(_0x33c266){if(_0x33c266){return _0x33c266['destroy']()[_0x05b2('0x1f')](function(){_0x3ccfff[_0x05b2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5567c4,_0x3d2332){return function(_0xf7baff){if(!_0xf7baff){_0x5567c4[_0x05b2('0x20')](0x194);}return _0xf7baff;};}function handleError(_0x56ba41,_0x28538f){_0x28538f=_0x28538f||0x1f4;return function(_0x2e8a12){logger['error'](_0x2e8a12['stack']);if(_0x2e8a12['name']){delete _0x2e8a12[_0x05b2('0x21')];}_0x56ba41[_0x05b2('0x16')](_0x28538f)[_0x05b2('0x22')](_0x2e8a12);};}exports[_0x05b2('0x23')]=function(_0x33600d,_0x20bb93){var _0x34ba6d={},_0x128ee8={},_0x36173f={'count':0x0,'rows':[]};var _0x2160e5=_[_0x05b2('0x24')](db[_0x05b2('0x25')]['rawAttributes'],function(_0x42dbb2){return{'name':_0x42dbb2[_0x05b2('0x26')],'type':_0x42dbb2[_0x05b2('0x27')][_0x05b2('0x28')]};});_0x128ee8[_0x05b2('0x29')]=_[_0x05b2('0x24')](_0x2160e5,_0x05b2('0x21'));_0x128ee8[_0x05b2('0x2a')]=_[_0x05b2('0x2b')](_0x33600d[_0x05b2('0x2a')]);_0x128ee8[_0x05b2('0x2c')]=_[_0x05b2('0x2d')](_0x128ee8[_0x05b2('0x29')],_0x128ee8[_0x05b2('0x2a')]);_0x34ba6d['attributes']=_[_0x05b2('0x2d')](_0x128ee8['model'],qs[_0x05b2('0x2e')](_0x33600d[_0x05b2('0x2a')]['fields']));_0x34ba6d['attributes']=_0x34ba6d[_0x05b2('0x2f')][_0x05b2('0x30')]?_0x34ba6d['attributes']:_0x128ee8[_0x05b2('0x29')];if(!_0x33600d['query'][_0x05b2('0x31')](_0x05b2('0x32'))){_0x34ba6d[_0x05b2('0x1b')]=qs['limit'](_0x33600d[_0x05b2('0x2a')][_0x05b2('0x1b')]);_0x34ba6d[_0x05b2('0x1a')]=qs[_0x05b2('0x1a')](_0x33600d[_0x05b2('0x2a')][_0x05b2('0x1a')]);}_0x34ba6d[_0x05b2('0x33')]=qs[_0x05b2('0x34')](_0x33600d[_0x05b2('0x2a')][_0x05b2('0x34')]);_0x34ba6d['where']=qs['filters'](_['pick'](_0x33600d[_0x05b2('0x2a')],_0x128ee8[_0x05b2('0x2c')]),_0x2160e5);if(_0x33600d[_0x05b2('0x2a')][_0x05b2('0x35')]){_0x34ba6d[_0x05b2('0x36')]=_[_0x05b2('0x37')](_0x34ba6d['where'],{'$or':_[_0x05b2('0x24')](_0x2160e5,function(_0x481d13){if(_0x481d13[_0x05b2('0x27')]!==_0x05b2('0x38')){var _0xdd3563={};_0xdd3563[_0x481d13['name']]={'$like':'%'+_0x33600d['query']['filter']+'%'};return _0xdd3563;}})});}_0x34ba6d=_[_0x05b2('0x37')]({},_0x34ba6d,_0x33600d['options']);var _0x4abc25={'where':_0x34ba6d[_0x05b2('0x36')]};return db['JscriptyAnswerReport'][_0x05b2('0x19')](_0x4abc25)[_0x05b2('0x1f')](function(_0x36f258){_0x36173f['count']=_0x36f258;if(_0x33600d[_0x05b2('0x2a')]['includeAll']){_0x34ba6d[_0x05b2('0x39')]=[{'all':!![]}];}return db[_0x05b2('0x25')][_0x05b2('0x3a')](_0x34ba6d);})['then'](function(_0x486e8f){_0x36173f[_0x05b2('0x3b')]=_0x486e8f;return _0x36173f;})['then'](respondWithFilteredResult(_0x20bb93,_0x34ba6d))[_0x05b2('0x3c')](handleError(_0x20bb93,null));};exports[_0x05b2('0x3d')]=function(_0x3b5c13,_0x207768){var _0x157590={'raw':!![],'where':{'id':_0x3b5c13['params']['id']}},_0xae4b1f={};_0xae4b1f[_0x05b2('0x29')]=_[_0x05b2('0x2b')](db['JscriptyAnswerReport']['rawAttributes']);_0xae4b1f[_0x05b2('0x2a')]=_['keys'](_0x3b5c13[_0x05b2('0x2a')]);_0xae4b1f['filters']=_[_0x05b2('0x2d')](_0xae4b1f[_0x05b2('0x29')],_0xae4b1f['query']);_0x157590['attributes']=_[_0x05b2('0x2d')](_0xae4b1f['model'],qs['fields'](_0x3b5c13[_0x05b2('0x2a')]['fields']));_0x157590[_0x05b2('0x2f')]=_0x157590['attributes'][_0x05b2('0x30')]?_0x157590[_0x05b2('0x2f')]:_0xae4b1f[_0x05b2('0x29')];if(_0x3b5c13[_0x05b2('0x2a')]['includeAll']){_0x157590['include']=[{'all':!![]}];}_0x157590=_['merge']({},_0x157590,_0x3b5c13['options']);return db[_0x05b2('0x25')][_0x05b2('0x3e')](_0x157590)[_0x05b2('0x1f')](handleEntityNotFound(_0x207768,null))[_0x05b2('0x1f')](respondWithResult(_0x207768,null))[_0x05b2('0x3c')](handleError(_0x207768,null));};exports[_0x05b2('0x3f')]=function(_0x312825,_0x1ddfce){return db[_0x05b2('0x25')][_0x05b2('0x3f')](_0x312825[_0x05b2('0x40')],{})[_0x05b2('0x1f')](respondWithResult(_0x1ddfce,0xc9))['catch'](handleError(_0x1ddfce,null));};exports['update']=function(_0x126613,_0xf71ef4){if(_0x126613[_0x05b2('0x40')]['id']){delete _0x126613['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x126613[_0x05b2('0x41')]['id']}})[_0x05b2('0x1f')](handleEntityNotFound(_0xf71ef4,null))['then'](saveUpdates(_0x126613[_0x05b2('0x40')],null))[_0x05b2('0x1f')](respondWithResult(_0xf71ef4,null))[_0x05b2('0x3c')](handleError(_0xf71ef4,null));};exports[_0x05b2('0x42')]=function(_0x16915f,_0x292d47){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x16915f[_0x05b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x292d47,null))[_0x05b2('0x1f')](removeEntity(_0x292d47,null))['catch'](handleError(_0x292d47,null));};exports[_0x05b2('0x43')]=function(_0x490667,_0x5b0a2b){return db[_0x05b2('0x25')]['describe']()['then'](respondWithResult(_0x5b0a2b,null))[_0x05b2('0x3c')](handleError(_0x5b0a2b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index d53e1a2..92ca263 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 _0x5ae1=['api','moment','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger'];(function(_0x2b96b1,_0x4295c2){var _0x15076d=function(_0x2eb3c8){while(--_0x2eb3c8){_0x2b96b1['push'](_0x2b96b1['shift']());}};_0x15076d(++_0x4295c2);}(_0x5ae1,0x1e9));var _0x15ae=function(_0x20f772,_0x3d714e){_0x20f772=_0x20f772-0x0;var _0x3a9bb8=_0x5ae1[_0x20f772];return _0x3a9bb8;};'use strict';var _=require(_0x15ae('0x0'));var util=require(_0x15ae('0x1'));var logger=require(_0x15ae('0x2'))(_0x15ae('0x3'));var moment=require(_0x15ae('0x4'));var BPromise=require('bluebird');var rp=require(_0x15ae('0x5'));var fs=require('fs');var path=require(_0x15ae('0x6'));var rimraf=require(_0x15ae('0x7'));var config=require('../../config/environment');var attributes=require(_0x15ae('0x8'));module[_0x15ae('0x9')]=function(_0x4497fa,_0x16bde9){return _0x4497fa[_0x15ae('0xa')](_0x15ae('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7863=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./jscriptyAnswerReport.attributes','define'];(function(_0x5a228f,_0x21e8f9){var _0x8103a7=function(_0x1f845a){while(--_0x1f845a){_0x5a228f['push'](_0x5a228f['shift']());}};_0x8103a7(++_0x21e8f9);}(_0x7863,0x1af));var _0x3786=function(_0x1474fd,_0x30b9aa){_0x1474fd=_0x1474fd-0x0;var _0x1b76e3=_0x7863[_0x1474fd];return _0x1b76e3;};'use strict';var _=require(_0x3786('0x0'));var util=require(_0x3786('0x1'));var logger=require(_0x3786('0x2'))('api');var moment=require(_0x3786('0x3'));var BPromise=require(_0x3786('0x4'));var rp=require(_0x3786('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3786('0x6'));var config=require('../../config/environment');var attributes=require(_0x3786('0x7'));module['exports']=function(_0x176ad4,_0x246b47){return _0x176ad4[_0x3786('0x8')](_0x3786('0x9'),attributes,{'tableName':_0x3786('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 94b6aad..fa79b80 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 _0x4e85=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','client'];(function(_0x1a6830,_0x57ab21){var _0x478659=function(_0x15c406){while(--_0x15c406){_0x1a6830['push'](_0x1a6830['shift']());}};_0x478659(++_0x57ab21);}(_0x4e85,0x119));var _0x54e8=function(_0x461492,_0x37456f){_0x461492=_0x461492-0x0;var _0x4d4e3d=_0x4e85[_0x461492];return _0x4d4e3d;};'use strict';var _=require(_0x54e8('0x0'));var util=require(_0x54e8('0x1'));var moment=require('moment');var BPromise=require(_0x54e8('0x2'));var rs=require(_0x54e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54e8('0x4'));var logger=require(_0x54e8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x54e8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea47e,_0x2b9c36,_0x4ff8a6){return new BPromise(function(_0x9239d4,_0x41d0b5){return client[_0x54e8('0x7')](_0x5ea47e,_0x4ff8a6)[_0x54e8('0x8')](function(_0x21b00f){logger[_0x54e8('0x9')](_0x54e8('0xa'),_0x2b9c36,'request\x20sent');logger[_0x54e8('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2b9c36,_0x54e8('0xc'),JSON[_0x54e8('0xd')](_0x21b00f));if(_0x21b00f[_0x54e8('0xe')]){if(_0x21b00f[_0x54e8('0xe')][_0x54e8('0xf')]===0x1f4){logger[_0x54e8('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b9c36,_0x21b00f[_0x54e8('0xe')]['message']);return _0x41d0b5(_0x21b00f[_0x54e8('0xe')][_0x54e8('0x10')]);}logger[_0x54e8('0xe')](_0x54e8('0xa'),_0x2b9c36,_0x21b00f['error'][_0x54e8('0x10')]);return _0x9239d4(_0x21b00f[_0x54e8('0xe')][_0x54e8('0x10')]);}else{logger[_0x54e8('0x9')](_0x54e8('0xa'),_0x2b9c36,'request\x20sent');_0x9239d4(_0x21b00f[_0x54e8('0x11')]['message']);}})['catch'](function(_0x3d9d0e){logger[_0x54e8('0xe')](_0x54e8('0xa'),_0x2b9c36,_0x3d9d0e);_0x41d0b5(_0x3d9d0e);});});} \ No newline at end of file +var _0x518a=['rpc','jayson/promise','client','http','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x572706,_0xadcdb5){var _0x556ee9=function(_0x5c174b){while(--_0x5c174b){_0x572706['push'](_0x572706['shift']());}};_0x556ee9(++_0xadcdb5);}(_0x518a,0xde));var _0xa518=function(_0x411808,_0x2f5be7){_0x411808=_0x411808-0x0;var _0x4d2c5c=_0x518a[_0x411808];return _0x4d2c5c;};'use strict';var _=require('lodash');var util=require(_0xa518('0x0'));var moment=require(_0xa518('0x1'));var BPromise=require(_0xa518('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa518('0x3'))['db'];var utils=require(_0xa518('0x4'));var logger=require(_0xa518('0x5'))(_0xa518('0x6'));var config=require('../../config/environment');var jayson=require(_0xa518('0x7'));var client=jayson[_0xa518('0x8')][_0xa518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aa2e4,_0x26fae6,_0x2ccec7){return new BPromise(function(_0x1bf4f9,_0x186d9a){return client['request'](_0x5aa2e4,_0x2ccec7)['then'](function(_0xc4183a){logger['info'](_0xa518('0xa'),_0x26fae6,_0xa518('0xb'));logger[_0xa518('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x26fae6,_0xa518('0xb'),JSON[_0xa518('0xd')](_0xc4183a));if(_0xc4183a[_0xa518('0xe')]){if(_0xc4183a[_0xa518('0xe')][_0xa518('0xf')]===0x1f4){logger[_0xa518('0xe')](_0xa518('0xa'),_0x26fae6,_0xc4183a[_0xa518('0xe')][_0xa518('0x10')]);return _0x186d9a(_0xc4183a[_0xa518('0xe')][_0xa518('0x10')]);}logger[_0xa518('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x26fae6,_0xc4183a[_0xa518('0xe')][_0xa518('0x10')]);return _0x1bf4f9(_0xc4183a[_0xa518('0xe')][_0xa518('0x10')]);}else{logger['info'](_0xa518('0xa'),_0x26fae6,_0xa518('0xb'));_0x1bf4f9(_0xc4183a[_0xa518('0x11')][_0xa518('0x10')]);}})[_0xa518('0x12')](function(_0x2226fa){logger[_0xa518('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x26fae6,_0x2226fa);_0x186d9a(_0x2226fa);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5213477..05829b3 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 _0x9f0e=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','clone','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5ae4d6,_0x481058){_0x5ae4d6=_0x5ae4d6-0x0;var _0x5eab20=_0x9f0e[_0x5ae4d6];return _0x5eab20;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['show']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x9')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x9')]('/:id/summary',auth[_0xe9f0('0xb')](),timeout(_0xe9f0('0x10')),controller[_0xe9f0('0x11')]);router['post']('/',auth[_0xe9f0('0xb')](),controller['create']);router[_0xe9f0('0x12')](_0xe9f0('0x13'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x14')]);router['put'](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x15')]);router[_0xe9f0('0x16')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x17')]);module[_0xe9f0('0x18')]=router; \ No newline at end of file +var _0xbff5=['getSummary','post','create','/:id/clone','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbff5,0x1bc));var _0x5bff=function(_0x3c6f22,_0xc2472d){_0x3c6f22=_0x3c6f22-0x0;var _0x230e36=_0xbff5[_0x3c6f22];return _0x230e36;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['get'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller['getAnswers']);router[_0x5bff('0x8')]('/:id/summary',auth[_0x5bff('0x9')](),timeout('30s'),controller[_0x5bff('0x10')]);router[_0x5bff('0x11')]('/',auth['isAuthenticated'](),controller[_0x5bff('0x12')]);router['post'](_0x5bff('0x13'),auth[_0x5bff('0x9')](),controller['clone']);router[_0x5bff('0x14')](_0x5bff('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5bff('0x15')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller['destroy']);module[_0x5bff('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 0e57e02..2f394de 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 _0xd405=['formData','stringify','isString','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','isObjectLike','setDataValue'];(function(_0x18f838,_0xa46fca){var _0x2dbd6d=function(_0x5e56e8){while(--_0x5e56e8){_0x18f838['push'](_0x18f838['shift']());}};_0x2dbd6d(++_0xa46fca);}(_0xd405,0x17f));var _0x5d40=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0xd405[_0x8e8ca7];return _0x561381;};'use strict';var Sequelize=require(_0x5d40('0x0'));var _=require(_0x5d40('0x1'));var util=require(_0x5d40('0x2'));module[_0x5d40('0x3')]={'name':{'type':Sequelize[_0x5d40('0x4')],'unique':_0x5d40('0x5')},'description':{'type':Sequelize[_0x5d40('0x4')]},'formData':{'type':Sequelize[_0x5d40('0x6')]('long'),'set':function(_0x15e914){if(_[_0x5d40('0x7')](_0x15e914)){this[_0x5d40('0x8')](_0x5d40('0x9'),JSON[_0x5d40('0xa')](_0x15e914));}else if(_[_0x5d40('0xb')](_0x15e914)){this['setDataValue']('formData',_0x15e914);}else{this[_0x5d40('0x8')](_0x5d40('0x9'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x5d40('0xc')](_0x5d40('0x5'))||'',this[_0x5d40('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5d40('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5d40('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xf451=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','lodash','STRING','TEXT','long','formData','stringify','isString','setDataValue','format'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xf451,0xbb));var _0x1f45=function(_0x2485c8,_0x1a522b){_0x2485c8=_0x2485c8-0x0;var _0x1c6674=_0xf451[_0x2485c8];return _0x1c6674;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1f45('0x0'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0x1f45('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x1f45('0x1')]},'formData':{'type':Sequelize[_0x1f45('0x2')](_0x1f45('0x3')),'set':function(_0x554343){if(_['isObjectLike'](_0x554343)){this['setDataValue'](_0x1f45('0x4'),JSON[_0x1f45('0x5')](_0x554343));}else if(_[_0x1f45('0x6')](_0x554343)){this[_0x1f45('0x7')](_0x1f45('0x4'),_0x554343);}else{this[_0x1f45('0x7')](_0x1f45('0x4'),util[_0x1f45('0x8')](_0x1f45('0x9'),this[_0x1f45('0xa')](_0x1f45('0xb'))||'',this[_0x1f45('0xa')](_0x1f45('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1f45('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a5daed2..db168f9 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 _0x0b5b=['startTime','JscriptyQuestionReport','-createdAt','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','error','name','index','map','rawAttributes','fieldName','type','key','model','filters','attributes','intersection','fields','query','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','JscriptyProject','rows','catch','params','keys','length','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','nolimit','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary'];(function(_0x1e6e39,_0x3c98ed){var _0x2d9029=function(_0x2de96b){while(--_0x2de96b){_0x1e6e39['push'](_0x1e6e39['shift']());}};_0x2d9029(++_0x3c98ed);}(_0x0b5b,0x17c));var _0xb0b5=function(_0x34d568,_0x386c29){_0x34d568=_0x34d568-0x0;var _0x97c7b4=_0x0b5b[_0x34d568];return _0x97c7b4;};'use strict';var pdf=require(_0xb0b5('0x0'));var emlformat=require(_0xb0b5('0x1'));var rimraf=require(_0xb0b5('0x2'));var zipdir=require(_0xb0b5('0x3'));var jsonpatch=require(_0xb0b5('0x4'));var rp=require(_0xb0b5('0x5'));var moment=require(_0xb0b5('0x6'));var BPromise=require(_0xb0b5('0x7'));var Mustache=require(_0xb0b5('0x8'));var util=require(_0xb0b5('0x9'));var path=require('path');var sox=require(_0xb0b5('0xa'));var csv=require('to-csv');var ejs=require(_0xb0b5('0xb'));var fs=require('fs');var fs_extra=require(_0xb0b5('0xc'));var _=require('lodash');var squel=require(_0xb0b5('0xd'));var crypto=require(_0xb0b5('0xe'));var jsforce=require(_0xb0b5('0xf'));var deskjs=require(_0xb0b5('0x10'));var toCsv=require(_0xb0b5('0x11'));var querystring=require(_0xb0b5('0x12'));var Papa=require(_0xb0b5('0x13'));var Redis=require(_0xb0b5('0x14'));var authService=require(_0xb0b5('0x15'));var qs=require(_0xb0b5('0x16'));var as=require(_0xb0b5('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0b5('0x18'))(_0xb0b5('0x19'));var utils=require('../../config/utils');var config=require(_0xb0b5('0x1a'));var licenseUtil=require(_0xb0b5('0x1b'));var db=require(_0xb0b5('0x1c'))['db'];function respondWithStatusCode(_0x3efc25,_0x57960e){_0x57960e=_0x57960e||0xcc;return function(_0x28dd63){if(_0x28dd63){return _0x3efc25[_0xb0b5('0x1d')](_0x57960e);}return _0x3efc25[_0xb0b5('0x1e')](_0x57960e)['end']();};}function respondWithResult(_0x698370,_0x3d3837){_0x3d3837=_0x3d3837||0xc8;return function(_0x40eb89){if(_0x40eb89){return _0x698370[_0xb0b5('0x1e')](_0x3d3837)[_0xb0b5('0x1f')](_0x40eb89);}};}function respondWithFilteredResult(_0x42e674,_0x3a7ec5){return function(_0x13304b){if(_0x13304b){var _0x25126b=_0x13304b[_0xb0b5('0x20')],_0x497943=_0x3a7ec5['offset'],_0x536c72=_0x3a7ec5[_0xb0b5('0x21')]+_0x3a7ec5[_0xb0b5('0x22')],_0x4406ef;if(_0x536c72>=_0x25126b){_0x536c72=_0x25126b;_0x4406ef=0xc8;}else{_0x4406ef=0xce;}_0x42e674[_0xb0b5('0x1e')](_0x4406ef);return _0x42e674[_0xb0b5('0x23')](_0xb0b5('0x24'),_0x497943+'-'+_0x536c72+'/'+_0x25126b)[_0xb0b5('0x1f')](_0x13304b);}return null;};}function patchUpdates(_0x4bae2c){return function(_0x98816e){try{jsonpatch[_0xb0b5('0x25')](_0x98816e,_0x4bae2c,!![]);}catch(_0x39717e){return BPromise[_0xb0b5('0x26')](_0x39717e);}return _0x98816e[_0xb0b5('0x27')]();};}function saveUpdates(_0x381b4a,_0x52a036){return function(_0x382930){if(_0x382930){return _0x382930[_0xb0b5('0x28')](_0x381b4a)[_0xb0b5('0x29')](function(_0x4f486e){return _0x4f486e;});}return null;};}function removeEntity(_0x51d468,_0x3ef871){return function(_0x2d41a4){if(_0x2d41a4){return _0x2d41a4[_0xb0b5('0x2a')]()['then'](function(){var _0x2888cc=_0x2d41a4[_0xb0b5('0x2b')]({'plain':!![]});var _0x151470=_0xb0b5('0x2c');return db[_0xb0b5('0x2d')][_0xb0b5('0x2a')]({'where':{'type':_0x151470,'resourceId':_0x2888cc['id']}})[_0xb0b5('0x29')](function(){return _0x2d41a4;});})[_0xb0b5('0x29')](function(){_0x51d468['status'](0xcc)[_0xb0b5('0x2e')]();});}};}function handleEntityNotFound(_0x58082b,_0x50583d){return function(_0x3efc80){if(!_0x3efc80){_0x58082b[_0xb0b5('0x1d')](0x194);}return _0x3efc80;};}function handleError(_0x2658ad,_0x20e373){_0x20e373=_0x20e373||0x1f4;return function(_0x251cd2){logger[_0xb0b5('0x2f')](_0x251cd2['stack']);if(_0x251cd2[_0xb0b5('0x30')]){delete _0x251cd2['name'];}_0x2658ad[_0xb0b5('0x1e')](_0x20e373)['send'](_0x251cd2);};}exports[_0xb0b5('0x31')]=function(_0x154a44,_0x20d479){var _0x2109b={},_0x2c5691={},_0x3ac6bd={'count':0x0,'rows':[]};var _0x1fa063=_[_0xb0b5('0x32')](db['JscriptyProject'][_0xb0b5('0x33')],function(_0x55cc4f){return{'name':_0x55cc4f[_0xb0b5('0x34')],'type':_0x55cc4f[_0xb0b5('0x35')][_0xb0b5('0x36')]};});_0x2c5691[_0xb0b5('0x37')]=_[_0xb0b5('0x32')](_0x1fa063,_0xb0b5('0x30'));_0x2c5691['query']=_['keys'](_0x154a44['query']);_0x2c5691[_0xb0b5('0x38')]=_['intersection'](_0x2c5691[_0xb0b5('0x37')],_0x2c5691['query']);_0x2109b[_0xb0b5('0x39')]=_[_0xb0b5('0x3a')](_0x2c5691[_0xb0b5('0x37')],qs[_0xb0b5('0x3b')](_0x154a44[_0xb0b5('0x3c')][_0xb0b5('0x3b')]));_0x2109b[_0xb0b5('0x39')]=_0x2109b[_0xb0b5('0x39')]['length']?_0x2109b['attributes']:_0x2c5691[_0xb0b5('0x37')];if(!_0x154a44[_0xb0b5('0x3c')][_0xb0b5('0x3d')]('nolimit')){_0x2109b[_0xb0b5('0x22')]=qs[_0xb0b5('0x22')](_0x154a44[_0xb0b5('0x3c')][_0xb0b5('0x22')]);_0x2109b[_0xb0b5('0x21')]=qs[_0xb0b5('0x21')](_0x154a44[_0xb0b5('0x3c')][_0xb0b5('0x21')]);}_0x2109b[_0xb0b5('0x3e')]=qs[_0xb0b5('0x3f')](_0x154a44[_0xb0b5('0x3c')][_0xb0b5('0x3f')]);_0x2109b[_0xb0b5('0x40')]=qs[_0xb0b5('0x38')](_[_0xb0b5('0x41')](_0x154a44[_0xb0b5('0x3c')],_0x2c5691[_0xb0b5('0x38')]),_0x1fa063);if(_0x154a44[_0xb0b5('0x3c')][_0xb0b5('0x42')]){_0x2109b['where']=_['merge'](_0x2109b[_0xb0b5('0x40')],{'$or':_[_0xb0b5('0x32')](_0x1fa063,function(_0x41c8e4){if(_0x41c8e4[_0xb0b5('0x35')]!==_0xb0b5('0x43')){var _0x36c5e9={};_0x36c5e9[_0x41c8e4[_0xb0b5('0x30')]]={'$like':'%'+_0x154a44['query'][_0xb0b5('0x42')]+'%'};return _0x36c5e9;}})});}_0x2109b=_[_0xb0b5('0x44')]({},_0x2109b,_0x154a44[_0xb0b5('0x45')]);var _0x481bef={'where':_0x2109b['where']};return db['JscriptyProject'][_0xb0b5('0x20')](_0x481bef)[_0xb0b5('0x29')](function(_0x48d803){_0x3ac6bd[_0xb0b5('0x20')]=_0x48d803;if(_0x154a44['query'][_0xb0b5('0x46')]){_0x2109b[_0xb0b5('0x47')]=[{'all':!![]}];}return db[_0xb0b5('0x48')]['findAll'](_0x2109b);})[_0xb0b5('0x29')](function(_0x1864bc){_0x3ac6bd[_0xb0b5('0x49')]=_0x1864bc;return _0x3ac6bd;})[_0xb0b5('0x29')](respondWithFilteredResult(_0x20d479,_0x2109b))[_0xb0b5('0x4a')](handleError(_0x20d479,null));};exports['show']=function(_0x5316df,_0x2407d3){var _0x17a066={'raw':![],'where':{'id':_0x5316df[_0xb0b5('0x4b')]['id']}},_0x3632d={};_0x3632d[_0xb0b5('0x37')]=_[_0xb0b5('0x4c')](db[_0xb0b5('0x48')][_0xb0b5('0x33')]);_0x3632d[_0xb0b5('0x3c')]=_[_0xb0b5('0x4c')](_0x5316df['query']);_0x3632d['filters']=_[_0xb0b5('0x3a')](_0x3632d[_0xb0b5('0x37')],_0x3632d[_0xb0b5('0x3c')]);_0x17a066[_0xb0b5('0x39')]=_[_0xb0b5('0x3a')](_0x3632d['model'],qs[_0xb0b5('0x3b')](_0x5316df[_0xb0b5('0x3c')][_0xb0b5('0x3b')]));_0x17a066[_0xb0b5('0x39')]=_0x17a066[_0xb0b5('0x39')][_0xb0b5('0x4d')]?_0x17a066[_0xb0b5('0x39')]:_0x3632d[_0xb0b5('0x37')];if(_0x5316df['query']['includeAll']){_0x17a066[_0xb0b5('0x47')]=[{'all':!![]}];}_0x17a066=_['merge']({},_0x17a066,_0x5316df[_0xb0b5('0x45')]);return db[_0xb0b5('0x48')]['find'](_0x17a066)['then'](handleEntityNotFound(_0x2407d3,null))[_0xb0b5('0x29')](respondWithResult(_0x2407d3,null))[_0xb0b5('0x4a')](handleError(_0x2407d3,null));};exports[_0xb0b5('0x4e')]=function(_0x47cd2a,_0x93e5c9){return db[_0xb0b5('0x48')][_0xb0b5('0x4e')](_0x47cd2a[_0xb0b5('0x4f')],{})[_0xb0b5('0x29')](function(_0x4fe3d8){var _0x9a293d=_0x47cd2a[_0xb0b5('0x50')]['get']({'plain':!![]});if(!_0x9a293d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9a293d['role']==='user'){var _0x3d9c1f=_0x4fe3d8['get']({'plain':!![]});var _0x14a027='Projects';return db[_0xb0b5('0x51')][_0xb0b5('0x52')]({'where':{'name':_0x14a027,'userProfileId':_0x9a293d[_0xb0b5('0x53')]},'raw':!![]})[_0xb0b5('0x29')](function(_0x1f8c9e){if(_0x1f8c9e&&_0x1f8c9e[_0xb0b5('0x54')]===0x0){return db['UserProfileResource'][_0xb0b5('0x4e')]({'name':_0x3d9c1f[_0xb0b5('0x30')],'resourceId':_0x3d9c1f['id'],'type':_0x1f8c9e[_0xb0b5('0x30')],'sectionId':_0x1f8c9e['id']},{})[_0xb0b5('0x29')](function(){return _0x4fe3d8;});}else{return _0x4fe3d8;}})[_0xb0b5('0x4a')](function(_0x2c570b){logger[_0xb0b5('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c570b);throw _0x2c570b;});}return _0x4fe3d8;})[_0xb0b5('0x29')](respondWithResult(_0x93e5c9,0xc9))[_0xb0b5('0x4a')](handleError(_0x93e5c9,null));};exports['clone']=function(_0x228aed,_0x414d6d){var _0xe7bef1={'where':{'id':_0x228aed[_0xb0b5('0x4b')]['id']}},_0x10e2bb={};_0x10e2bb['model']=_[_0xb0b5('0x4c')](db[_0xb0b5('0x48')][_0xb0b5('0x33')]);_0xe7bef1[_0xb0b5('0x39')]=_[_0xb0b5('0x3a')](_0x10e2bb[_0xb0b5('0x37')],qs[_0xb0b5('0x3b')](_0x228aed[_0xb0b5('0x3c')]['fields']));_0xe7bef1[_0xb0b5('0x39')]=_0xe7bef1['attributes'][_0xb0b5('0x4d')]?_0xe7bef1[_0xb0b5('0x39')]:_0x10e2bb[_0xb0b5('0x37')];if(_0x228aed[_0xb0b5('0x3c')][_0xb0b5('0x46')]){_0xe7bef1['include']=[{'all':!![]}];}_0xe7bef1=_[_0xb0b5('0x44')]({},_0xe7bef1,_0x228aed[_0xb0b5('0x45')]);return db['JscriptyProject'][_0xb0b5('0x52')](_0xe7bef1)[_0xb0b5('0x29')](handleEntityNotFound(_0x414d6d,null))[_0xb0b5('0x29')](function(_0x36a1c3){if(_0x36a1c3){var _0x5313fe=_0x36a1c3[_0xb0b5('0x2b')]({'plain':!![]});_0x5313fe=qs[_0xb0b5('0x55')](_0x5313fe,['id',_0xb0b5('0x56'),'updatedAt']);_0x228aed[_0xb0b5('0x4f')]=_[_0xb0b5('0x55')](_0x228aed[_0xb0b5('0x4f')],['id',_0xb0b5('0x56'),_0xb0b5('0x57')]);return db[_0xb0b5('0x48')][_0xb0b5('0x4e')](_[_0xb0b5('0x44')](_0x5313fe,_0x228aed[_0xb0b5('0x4f')]),{'include':_0x228aed[_0xb0b5('0x3c')][_0xb0b5('0x46')]?[{'all':!![]}]:undefined})[_0xb0b5('0x29')](function(_0x13ce74){var _0x147315=_0x228aed[_0xb0b5('0x50')][_0xb0b5('0x2b')]({'plain':!![]});if(!_0x147315)throw new Error(_0xb0b5('0x58'));if(_0x147315[_0xb0b5('0x59')]===_0xb0b5('0x50')){var _0x24465e=_0x13ce74[_0xb0b5('0x2b')]({'plain':!![]});var _0x4daf4d='Projects';return db[_0xb0b5('0x51')][_0xb0b5('0x52')]({'where':{'name':_0x4daf4d,'userProfileId':_0x147315[_0xb0b5('0x53')]},'raw':!![]})[_0xb0b5('0x29')](function(_0x23b288){if(_0x23b288&&_0x23b288[_0xb0b5('0x54')]===0x0){return db[_0xb0b5('0x2d')][_0xb0b5('0x4e')]({'name':_0x24465e[_0xb0b5('0x30')],'resourceId':_0x24465e['id'],'type':_0x23b288[_0xb0b5('0x30')],'sectionId':_0x23b288['id']},{})['then'](function(){return _0x13ce74;});}else{return _0x13ce74;}})[_0xb0b5('0x4a')](function(_0x11a386){logger['error'](_0xb0b5('0x5a'),_0x11a386);throw _0x11a386;});}return _0x13ce74;});}})[_0xb0b5('0x29')](respondWithResult(_0x414d6d,0xc9))[_0xb0b5('0x4a')](handleError(_0x414d6d,null));};exports[_0xb0b5('0x28')]=function(_0x415ff9,_0x1bef63){if(_0x415ff9[_0xb0b5('0x4f')]['id']){delete _0x415ff9['body']['id'];}return db['JscriptyProject'][_0xb0b5('0x52')]({'where':{'id':_0x415ff9[_0xb0b5('0x4b')]['id']}})[_0xb0b5('0x29')](handleEntityNotFound(_0x1bef63,null))['then'](saveUpdates(_0x415ff9[_0xb0b5('0x4f')],null))['then'](respondWithResult(_0x1bef63,null))[_0xb0b5('0x4a')](handleError(_0x1bef63,null));};exports[_0xb0b5('0x2a')]=function(_0x489b76,_0x1598c6){return db[_0xb0b5('0x48')][_0xb0b5('0x52')]({'where':{'id':_0x489b76[_0xb0b5('0x4b')]['id']}})[_0xb0b5('0x29')](handleEntityNotFound(_0x1598c6,null))['then'](removeEntity(_0x1598c6,null))['catch'](handleError(_0x1598c6,null));};exports[_0xb0b5('0x5b')]=function(_0x558e8d,_0x1bd9a5,_0x1fc750){var _0x184a61={'raw':!![],'where':{}};var _0x2af3e6={};var _0x136d3e={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x558e8d[_0xb0b5('0x4b')]['id']}})[_0xb0b5('0x29')](handleEntityNotFound(_0x1bd9a5,null))[_0xb0b5('0x29')](function(_0x2155e6){if(_0x2155e6){_0x2af3e6[_0xb0b5('0x37')]=_[_0xb0b5('0x4c')](db[_0xb0b5('0x5c')][_0xb0b5('0x33')]);_0x2af3e6[_0xb0b5('0x3c')]=_['keys'](_0x558e8d['query']);_0x2af3e6[_0xb0b5('0x38')]=_[_0xb0b5('0x3a')](_0x2af3e6[_0xb0b5('0x37')],_0x2af3e6[_0xb0b5('0x3c')]);_0x184a61[_0xb0b5('0x39')]=_[_0xb0b5('0x3a')](_0x2af3e6['model'],qs[_0xb0b5('0x3b')](_0x558e8d[_0xb0b5('0x3c')][_0xb0b5('0x3b')]));_0x184a61[_0xb0b5('0x39')]=_0x184a61['attributes']['length']?_0x184a61[_0xb0b5('0x39')]:_0x2af3e6[_0xb0b5('0x37')];if(!_0x558e8d[_0xb0b5('0x3c')][_0xb0b5('0x3d')]('nolimit')){_0x184a61[_0xb0b5('0x22')]=qs['limit'](_0x558e8d[_0xb0b5('0x3c')][_0xb0b5('0x22')]);_0x184a61[_0xb0b5('0x21')]=qs[_0xb0b5('0x21')](_0x558e8d[_0xb0b5('0x3c')][_0xb0b5('0x21')]);}_0x184a61[_0xb0b5('0x3e')]=qs[_0xb0b5('0x3f')](_0x558e8d[_0xb0b5('0x3c')][_0xb0b5('0x3f')]);_0x184a61[_0xb0b5('0x40')]=qs[_0xb0b5('0x38')](_[_0xb0b5('0x41')](_0x558e8d[_0xb0b5('0x3c')],_0x2af3e6['filters']));_0x184a61[_0xb0b5('0x40')]['ProjectId']=_0x2155e6['id'];if(_0x558e8d[_0xb0b5('0x3c')][_0xb0b5('0x42')]){_0x184a61['where']=_[_0xb0b5('0x44')](_0x184a61[_0xb0b5('0x40')],{'$or':_['map'](_0x184a61['attributes'],function(_0x294c49){var _0x274dc7={};_0x274dc7[_0x294c49]={'$like':'%'+_0x558e8d[_0xb0b5('0x3c')][_0xb0b5('0x42')]+'%'};return _0x274dc7;})});}_0x184a61=_['merge']({},_0x184a61,_0x558e8d['options']);return db[_0xb0b5('0x5c')][_0xb0b5('0x20')]({'where':_0x184a61[_0xb0b5('0x40')]})[_0xb0b5('0x29')](function(_0x2686e6){_0x136d3e['count']=_0x2686e6;if(_0x558e8d[_0xb0b5('0x3c')][_0xb0b5('0x46')]){_0x184a61[_0xb0b5('0x47')]=[{'all':!![]}];}return db[_0xb0b5('0x5c')][_0xb0b5('0x5d')](_0x184a61);})[_0xb0b5('0x29')](function(_0x1de8ca){_0x136d3e['rows']=_0x1de8ca;return _0x136d3e;});}})['then'](respondWithFilteredResult(_0x1bd9a5,_0x184a61))[_0xb0b5('0x4a')](handleError(_0x1bd9a5,null));};exports[_0xb0b5('0x5e')]=function(_0x1aba03,_0x5b70f5,_0x18043c){var _0x533c8e={'raw':!![],'where':{}};var _0x20c7d0={};var _0x56b28a={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x1aba03['params']['id']}})[_0xb0b5('0x29')](handleEntityNotFound(_0x5b70f5,null))['then'](function(_0x2447bf){if(_0x2447bf){_0x20c7d0['model']=_[_0xb0b5('0x4c')](db[_0xb0b5('0x5f')][_0xb0b5('0x33')]);_0x20c7d0[_0xb0b5('0x3c')]=_['keys'](_0x1aba03['query']);_0x20c7d0[_0xb0b5('0x38')]=_[_0xb0b5('0x3a')](_0x20c7d0[_0xb0b5('0x37')],_0x20c7d0[_0xb0b5('0x3c')]);_0x533c8e['attributes']=_[_0xb0b5('0x3a')](_0x20c7d0[_0xb0b5('0x37')],qs[_0xb0b5('0x3b')](_0x1aba03[_0xb0b5('0x3c')][_0xb0b5('0x3b')]));_0x533c8e[_0xb0b5('0x39')]=_0x533c8e[_0xb0b5('0x39')][_0xb0b5('0x4d')]?_0x533c8e[_0xb0b5('0x39')]:_0x20c7d0[_0xb0b5('0x37')];if(!_0x1aba03[_0xb0b5('0x3c')]['hasOwnProperty'](_0xb0b5('0x60'))){_0x533c8e[_0xb0b5('0x22')]=qs[_0xb0b5('0x22')](_0x1aba03['query'][_0xb0b5('0x22')]);_0x533c8e[_0xb0b5('0x21')]=qs[_0xb0b5('0x21')](_0x1aba03[_0xb0b5('0x3c')][_0xb0b5('0x21')]);}_0x533c8e[_0xb0b5('0x3e')]=qs['sort'](_0x1aba03[_0xb0b5('0x3c')]['sort']);_0x533c8e['where']=qs[_0xb0b5('0x38')](_[_0xb0b5('0x41')](_0x1aba03['query'],_0x20c7d0['filters']));_0x533c8e[_0xb0b5('0x40')][_0xb0b5('0x61')]=_0x2447bf['id'];if(_0x1aba03[_0xb0b5('0x3c')]['filter']){_0x533c8e['where']=_[_0xb0b5('0x44')](_0x533c8e['where'],{'$or':_['map'](_0x533c8e['attributes'],function(_0x115e2e){var _0x10790d={};_0x10790d[_0x115e2e]={'$like':'%'+_0x1aba03[_0xb0b5('0x3c')][_0xb0b5('0x42')]+'%'};return _0x10790d;})});}_0x533c8e=_[_0xb0b5('0x44')]({},_0x533c8e,_0x1aba03[_0xb0b5('0x45')]);return db['JscriptyAnswerReport'][_0xb0b5('0x20')]({'where':_0x533c8e['where']})['then'](function(_0x2754e0){_0x56b28a[_0xb0b5('0x20')]=_0x2754e0;if(_0x1aba03[_0xb0b5('0x3c')][_0xb0b5('0x46')]){_0x533c8e['include']=[{'all':!![]}];}return db[_0xb0b5('0x5f')][_0xb0b5('0x5d')](_0x533c8e);})[_0xb0b5('0x29')](function(_0x338c43){_0x56b28a[_0xb0b5('0x49')]=_0x338c43;return _0x56b28a;});}})[_0xb0b5('0x29')](respondWithFilteredResult(_0x5b70f5,_0x533c8e))[_0xb0b5('0x4a')](handleError(_0x5b70f5,null));};function char(_0x57117c){return _0xb0b5('0x62')===typeof _0x57117c?String[_0xb0b5('0x63')][_0xb0b5('0x25')](null,arguments):_0x57117c;}function needsEncapsulation(_0x2628bf){return!!_0x2628bf&&(_0x2628bf[_0xb0b5('0x64')]()[_0xb0b5('0x65')](char(0xd))>=0x0||_0x2628bf[_0xb0b5('0x64')]()[_0xb0b5('0x65')](char(0xa))>=0x0||_0x2628bf['toString']()['indexOf'](char(0x2c))>=0x0||_0x2628bf[_0xb0b5('0x64')]()[_0xb0b5('0x65')](char(0x22))>=0x0);}function encapsulate(_0x32e833){var _0x314149=char(0x22),_0x17cfee='\x5c'+char(0x22),_0x3fa22d=_0x32e833[_0xb0b5('0x64')]()[_0xb0b5('0x66')](new RegExp(_0x314149,'g'),_0x17cfee);return _0x314149+_0x3fa22d+_0x314149;}exports[_0xb0b5('0x67')]=function(_0xbc08f5,_0x33bce2,_0x5ead66){var _0x513120,_0xd65c67;var _0x290647={'where':{'ProjectId':_0xbc08f5[_0xb0b5('0x4b')]['id']}};if(_0xbc08f5[_0xb0b5('0x3c')][_0xb0b5('0x68')]){_0x290647[_0xb0b5('0x40')]['starttime']=JSON['parse'](_0xbc08f5[_0xb0b5('0x3c')][_0xb0b5('0x68')]);}return db[_0xb0b5('0x5c')][_0xb0b5('0x5d')](_0x290647)[_0xb0b5('0x29')](handleEntityNotFound(_0x33bce2,null))[_0xb0b5('0x29')](function(_0x20d16f){if(_0x20d16f){_0x513120=_0x20d16f;return db[_0xb0b5('0x69')][_0xb0b5('0x5d')]({'where':{'SessionId':{'$in':_[_0xb0b5('0x32')](_0x513120,'id')},'ProjectId':_0xbc08f5[_0xb0b5('0x4b')]['id']},'order':_0xb0b5('0x6a')});}})[_0xb0b5('0x29')](handleEntityNotFound(_0x33bce2,null))['then'](function(_0x249b22){if(_0x249b22){_0xd65c67=_0x249b22;var _0x3f3e61={};for(var _0x5f4548=0x0,_0x467979=_0xd65c67[_0xb0b5('0x4d')];_0x5f4548<_0x467979;_0x5f4548++){if(!_0x3f3e61['hasOwnProperty'](_0xd65c67[_0x5f4548]['questionId'])){_0x3f3e61[_0xd65c67[_0x5f4548]['questionId']]=needsEncapsulation(_0xd65c67[_0x5f4548][_0xb0b5('0x6b')])?encapsulate(_0xd65c67[_0x5f4548][_0xb0b5('0x6b')]):_0xd65c67[_0x5f4548][_0xb0b5('0x6b')];}}var _0x87b684=[],_0x441b83={};for(var _0x97b11e=0x0,_0x5916c=_0x513120[_0xb0b5('0x4d')];_0x97b11e<_0x5916c;_0x97b11e++){_0x441b83={'ProjectId':_0xbc08f5[_0xb0b5('0x4b')]['id'],'SessionId':_0x513120[_0x97b11e]['id'],'StartTime':moment(_0x513120[_0x97b11e][_0xb0b5('0x6c')])[_0xb0b5('0x6d')](_0xb0b5('0x6e'))};for(var _0x17ba0d=0x0,_0x307a61=_0xd65c67[_0xb0b5('0x4d')];_0x17ba0d<_0x307a61;_0x17ba0d++){if(_0xd65c67[_0x17ba0d][_0xb0b5('0x6f')]==_0x513120[_0x97b11e]['id']&&_0x3f3e61[_0xb0b5('0x3d')](_0xd65c67[_0x17ba0d][_0xb0b5('0x70')])){_0x441b83[_0x3f3e61[_0xd65c67[_0x17ba0d][_0xb0b5('0x70')]]]=_0xd65c67[_0x17ba0d][_0xb0b5('0x71')];}}for(var _0x39d840 in _0x3f3e61){if(!_0x441b83[_0xb0b5('0x3d')](_0x3f3e61[_0x39d840])){_0x441b83[_0x3f3e61[_0x39d840]]=null;}}_0x87b684['push'](_0x441b83);}return _0x87b684;}})[_0xb0b5('0x29')](function(_0xbf35c0){if(!_[_0xb0b5('0x72')](_0xbf35c0)){var _0x5e421a=toCsv(_0xbf35c0);var _0x12187d=Date[_0xb0b5('0x73')]();fs['writeFileSync'](util[_0xb0b5('0x6d')](_0xb0b5('0x74'),_0xbc08f5[_0xb0b5('0x4b')]['id'],_0x12187d),_0x5e421a);_0x33bce2[_0xb0b5('0x75')]('Content-disposition','attachment;\x20filename='+util[_0xb0b5('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0xbc08f5['params']['id'],_0x12187d));_0x33bce2['setHeader'](_0xb0b5('0x76'),_0xb0b5('0x77'));return _0x33bce2[_0xb0b5('0x78')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xbc08f5['params']['id'],_0x12187d));}else{return _0x33bce2['sendStatus'](0xcc);}})[_0xb0b5('0x4a')](handleError(_0x33bce2,null));}; \ No newline at end of file +var _0x047b=['starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','then','get','Projects','UserProfileResource','destroy','error','name','map','JscriptyProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','includeAll','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','params','omit','createdAt','updatedAt','update','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x047b,0x1e6));var _0xb047=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x047b[_0xdd2bfa];return _0x55397e;};'use strict';var pdf=require(_0xb047('0x0'));var emlformat=require(_0xb047('0x1'));var rimraf=require(_0xb047('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb047('0x3'));var rp=require('request-promise');var moment=require(_0xb047('0x4'));var BPromise=require(_0xb047('0x5'));var Mustache=require(_0xb047('0x6'));var util=require(_0xb047('0x7'));var path=require(_0xb047('0x8'));var sox=require(_0xb047('0x9'));var csv=require(_0xb047('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb047('0xb'));var squel=require(_0xb047('0xc'));var crypto=require(_0xb047('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb047('0xe'));var toCsv=require(_0xb047('0xa'));var querystring=require(_0xb047('0xf'));var Papa=require(_0xb047('0x10'));var Redis=require(_0xb047('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb047('0x12'));var as=require(_0xb047('0x13'));var hardwareService=require(_0xb047('0x14'));var logger=require(_0xb047('0x15'))('api');var utils=require(_0xb047('0x16'));var config=require(_0xb047('0x17'));var licenseUtil=require(_0xb047('0x18'));var db=require(_0xb047('0x19'))['db'];function respondWithStatusCode(_0x48b95a,_0x39c8b0){_0x39c8b0=_0x39c8b0||0xcc;return function(_0x44ec37){if(_0x44ec37){return _0x48b95a[_0xb047('0x1a')](_0x39c8b0);}return _0x48b95a[_0xb047('0x1b')](_0x39c8b0)[_0xb047('0x1c')]();};}function respondWithResult(_0x2c36da,_0x23c8d5){_0x23c8d5=_0x23c8d5||0xc8;return function(_0x33bce2){if(_0x33bce2){return _0x2c36da[_0xb047('0x1b')](_0x23c8d5)[_0xb047('0x1d')](_0x33bce2);}};}function respondWithFilteredResult(_0x5241f0,_0xa4c6be){return function(_0x43cfb2){if(_0x43cfb2){var _0x51c7ab=_0x43cfb2[_0xb047('0x1e')],_0x16d1ae=_0xa4c6be['offset'],_0x104a38=_0xa4c6be['offset']+_0xa4c6be[_0xb047('0x1f')],_0x513cb1;if(_0x104a38>=_0x51c7ab){_0x104a38=_0x51c7ab;_0x513cb1=0xc8;}else{_0x513cb1=0xce;}_0x5241f0[_0xb047('0x1b')](_0x513cb1);return _0x5241f0[_0xb047('0x20')](_0xb047('0x21'),_0x16d1ae+'-'+_0x104a38+'/'+_0x51c7ab)['json'](_0x43cfb2);}return null;};}function patchUpdates(_0x1cb13e){return function(_0x46e9fa){try{jsonpatch['apply'](_0x46e9fa,_0x1cb13e,!![]);}catch(_0x2c55ec){return BPromise[_0xb047('0x22')](_0x2c55ec);}return _0x46e9fa['save']();};}function saveUpdates(_0x43e427,_0x412c42){return function(_0x2ee377){if(_0x2ee377){return _0x2ee377['update'](_0x43e427)['then'](function(_0x6c4ae0){return _0x6c4ae0;});}return null;};}function removeEntity(_0x462a4b,_0x40ec66){return function(_0x64d788){if(_0x64d788){return _0x64d788['destroy']()[_0xb047('0x23')](function(){var _0x26684c=_0x64d788[_0xb047('0x24')]({'plain':!![]});var _0x161ae3=_0xb047('0x25');return db[_0xb047('0x26')][_0xb047('0x27')]({'where':{'type':_0x161ae3,'resourceId':_0x26684c['id']}})['then'](function(){return _0x64d788;});})['then'](function(){_0x462a4b[_0xb047('0x1b')](0xcc)[_0xb047('0x1c')]();});}};}function handleEntityNotFound(_0x31beaf,_0x40d93b){return function(_0x1825f6){if(!_0x1825f6){_0x31beaf[_0xb047('0x1a')](0x194);}return _0x1825f6;};}function handleError(_0x9bff25,_0x5ab8ea){_0x5ab8ea=_0x5ab8ea||0x1f4;return function(_0x5a59a3){logger[_0xb047('0x28')](_0x5a59a3['stack']);if(_0x5a59a3[_0xb047('0x29')]){delete _0x5a59a3[_0xb047('0x29')];}_0x9bff25[_0xb047('0x1b')](_0x5ab8ea)['send'](_0x5a59a3);};}exports['index']=function(_0x4cc5e0,_0x1d5aeb){var _0x26c07a={},_0x331889={},_0x4677e6={'count':0x0,'rows':[]};var _0x50dc50=_[_0xb047('0x2a')](db[_0xb047('0x2b')][_0xb047('0x2c')],function(_0x4fc4c4){return{'name':_0x4fc4c4[_0xb047('0x2d')],'type':_0x4fc4c4[_0xb047('0x2e')]['key']};});_0x331889[_0xb047('0x2f')]=_[_0xb047('0x2a')](_0x50dc50,_0xb047('0x29'));_0x331889[_0xb047('0x30')]=_[_0xb047('0x31')](_0x4cc5e0[_0xb047('0x30')]);_0x331889[_0xb047('0x32')]=_[_0xb047('0x33')](_0x331889[_0xb047('0x2f')],_0x331889[_0xb047('0x30')]);_0x26c07a[_0xb047('0x34')]=_[_0xb047('0x33')](_0x331889[_0xb047('0x2f')],qs['fields'](_0x4cc5e0[_0xb047('0x30')][_0xb047('0x35')]));_0x26c07a['attributes']=_0x26c07a[_0xb047('0x34')][_0xb047('0x36')]?_0x26c07a[_0xb047('0x34')]:_0x331889['model'];if(!_0x4cc5e0[_0xb047('0x30')][_0xb047('0x37')](_0xb047('0x38'))){_0x26c07a[_0xb047('0x1f')]=qs[_0xb047('0x1f')](_0x4cc5e0[_0xb047('0x30')]['limit']);_0x26c07a[_0xb047('0x39')]=qs[_0xb047('0x39')](_0x4cc5e0['query']['offset']);}_0x26c07a['order']=qs[_0xb047('0x3a')](_0x4cc5e0[_0xb047('0x30')][_0xb047('0x3a')]);_0x26c07a[_0xb047('0x3b')]=qs[_0xb047('0x32')](_[_0xb047('0x3c')](_0x4cc5e0[_0xb047('0x30')],_0x331889[_0xb047('0x32')]),_0x50dc50);if(_0x4cc5e0['query'][_0xb047('0x3d')]){_0x26c07a[_0xb047('0x3b')]=_['merge'](_0x26c07a[_0xb047('0x3b')],{'$or':_[_0xb047('0x2a')](_0x50dc50,function(_0x9dac48){if(_0x9dac48[_0xb047('0x2e')]!==_0xb047('0x3e')){var _0x254700={};_0x254700[_0x9dac48[_0xb047('0x29')]]={'$like':'%'+_0x4cc5e0[_0xb047('0x30')][_0xb047('0x3d')]+'%'};return _0x254700;}})});}_0x26c07a=_[_0xb047('0x3f')]({},_0x26c07a,_0x4cc5e0['options']);var _0x157bba={'where':_0x26c07a[_0xb047('0x3b')]};return db[_0xb047('0x2b')][_0xb047('0x1e')](_0x157bba)[_0xb047('0x23')](function(_0x31fb3a){_0x4677e6[_0xb047('0x1e')]=_0x31fb3a;if(_0x4cc5e0[_0xb047('0x30')]['includeAll']){_0x26c07a[_0xb047('0x40')]=[{'all':!![]}];}return db[_0xb047('0x2b')][_0xb047('0x41')](_0x26c07a);})[_0xb047('0x23')](function(_0x38d8af){_0x4677e6[_0xb047('0x42')]=_0x38d8af;return _0x4677e6;})[_0xb047('0x23')](respondWithFilteredResult(_0x1d5aeb,_0x26c07a))[_0xb047('0x43')](handleError(_0x1d5aeb,null));};exports[_0xb047('0x44')]=function(_0xa76663,_0x4049f9){var _0x40fad6={'raw':![],'where':{'id':_0xa76663['params']['id']}},_0x4d23a7={};_0x4d23a7['model']=_['keys'](db[_0xb047('0x2b')][_0xb047('0x2c')]);_0x4d23a7[_0xb047('0x30')]=_[_0xb047('0x31')](_0xa76663[_0xb047('0x30')]);_0x4d23a7[_0xb047('0x32')]=_[_0xb047('0x33')](_0x4d23a7[_0xb047('0x2f')],_0x4d23a7['query']);_0x40fad6['attributes']=_[_0xb047('0x33')](_0x4d23a7[_0xb047('0x2f')],qs[_0xb047('0x35')](_0xa76663[_0xb047('0x30')][_0xb047('0x35')]));_0x40fad6['attributes']=_0x40fad6[_0xb047('0x34')][_0xb047('0x36')]?_0x40fad6[_0xb047('0x34')]:_0x4d23a7['model'];if(_0xa76663['query'][_0xb047('0x45')]){_0x40fad6['include']=[{'all':!![]}];}_0x40fad6=_[_0xb047('0x3f')]({},_0x40fad6,_0xa76663[_0xb047('0x46')]);return db[_0xb047('0x2b')][_0xb047('0x47')](_0x40fad6)[_0xb047('0x23')](handleEntityNotFound(_0x4049f9,null))[_0xb047('0x23')](respondWithResult(_0x4049f9,null))['catch'](handleError(_0x4049f9,null));};exports[_0xb047('0x48')]=function(_0x34e102,_0x3d01e8){return db[_0xb047('0x2b')][_0xb047('0x48')](_0x34e102[_0xb047('0x49')],{})[_0xb047('0x23')](function(_0x4bd2f8){var _0x3d23af=_0x34e102[_0xb047('0x4a')][_0xb047('0x24')]({'plain':!![]});if(!_0x3d23af)throw new Error(_0xb047('0x4b'));if(_0x3d23af[_0xb047('0x4c')]==='user'){var _0xb354=_0x4bd2f8[_0xb047('0x24')]({'plain':!![]});var _0x724e5e=_0xb047('0x25');return db[_0xb047('0x4d')][_0xb047('0x47')]({'where':{'name':_0x724e5e,'userProfileId':_0x3d23af[_0xb047('0x4e')]},'raw':!![]})[_0xb047('0x23')](function(_0x1b5464){if(_0x1b5464&&_0x1b5464[_0xb047('0x4f')]===0x0){return db['UserProfileResource'][_0xb047('0x48')]({'name':_0xb354['name'],'resourceId':_0xb354['id'],'type':_0x1b5464[_0xb047('0x29')],'sectionId':_0x1b5464['id']},{})[_0xb047('0x23')](function(){return _0x4bd2f8;});}else{return _0x4bd2f8;}})['catch'](function(_0x45586c){logger[_0xb047('0x28')](_0xb047('0x50'),_0x45586c);throw _0x45586c;});}return _0x4bd2f8;})[_0xb047('0x23')](respondWithResult(_0x3d01e8,0xc9))['catch'](handleError(_0x3d01e8,null));};exports['clone']=function(_0x45fe2f,_0x47e0e4){var _0x4a7a41={'where':{'id':_0x45fe2f[_0xb047('0x51')]['id']}},_0x5cb323={};_0x5cb323[_0xb047('0x2f')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x4a7a41[_0xb047('0x34')]=_['intersection'](_0x5cb323[_0xb047('0x2f')],qs[_0xb047('0x35')](_0x45fe2f[_0xb047('0x30')]['fields']));_0x4a7a41['attributes']=_0x4a7a41['attributes'][_0xb047('0x36')]?_0x4a7a41[_0xb047('0x34')]:_0x5cb323['model'];if(_0x45fe2f['query'][_0xb047('0x45')]){_0x4a7a41['include']=[{'all':!![]}];}_0x4a7a41=_[_0xb047('0x3f')]({},_0x4a7a41,_0x45fe2f[_0xb047('0x46')]);return db[_0xb047('0x2b')][_0xb047('0x47')](_0x4a7a41)[_0xb047('0x23')](handleEntityNotFound(_0x47e0e4,null))[_0xb047('0x23')](function(_0x34fbd9){if(_0x34fbd9){var _0xa16f7e=_0x34fbd9[_0xb047('0x24')]({'plain':!![]});_0xa16f7e=qs[_0xb047('0x52')](_0xa16f7e,['id',_0xb047('0x53'),_0xb047('0x54')]);_0x45fe2f[_0xb047('0x49')]=_[_0xb047('0x52')](_0x45fe2f[_0xb047('0x49')],['id',_0xb047('0x53'),_0xb047('0x54')]);return db['JscriptyProject'][_0xb047('0x48')](_[_0xb047('0x3f')](_0xa16f7e,_0x45fe2f[_0xb047('0x49')]),{'include':_0x45fe2f[_0xb047('0x30')][_0xb047('0x45')]?[{'all':!![]}]:undefined})[_0xb047('0x23')](function(_0x359abc){var _0x3350ed=_0x45fe2f['user'][_0xb047('0x24')]({'plain':!![]});if(!_0x3350ed)throw new Error(_0xb047('0x4b'));if(_0x3350ed[_0xb047('0x4c')]===_0xb047('0x4a')){var _0x1a858b=_0x359abc[_0xb047('0x24')]({'plain':!![]});var _0x53e8b9=_0xb047('0x25');return db[_0xb047('0x4d')][_0xb047('0x47')]({'where':{'name':_0x53e8b9,'userProfileId':_0x3350ed['userProfileId']},'raw':!![]})[_0xb047('0x23')](function(_0x568400){if(_0x568400&&_0x568400['autoAssociation']===0x0){return db[_0xb047('0x26')][_0xb047('0x48')]({'name':_0x1a858b['name'],'resourceId':_0x1a858b['id'],'type':_0x568400['name'],'sectionId':_0x568400['id']},{})[_0xb047('0x23')](function(){return _0x359abc;});}else{return _0x359abc;}})[_0xb047('0x43')](function(_0x3c1c1c){logger['error'](_0xb047('0x50'),_0x3c1c1c);throw _0x3c1c1c;});}return _0x359abc;});}})[_0xb047('0x23')](respondWithResult(_0x47e0e4,0xc9))['catch'](handleError(_0x47e0e4,null));};exports[_0xb047('0x55')]=function(_0x23082f,_0x1a69d4){if(_0x23082f[_0xb047('0x49')]['id']){delete _0x23082f['body']['id'];}return db[_0xb047('0x2b')][_0xb047('0x47')]({'where':{'id':_0x23082f[_0xb047('0x51')]['id']}})[_0xb047('0x23')](handleEntityNotFound(_0x1a69d4,null))[_0xb047('0x23')](saveUpdates(_0x23082f['body'],null))[_0xb047('0x23')](respondWithResult(_0x1a69d4,null))[_0xb047('0x43')](handleError(_0x1a69d4,null));};exports[_0xb047('0x27')]=function(_0x5a8e52,_0x4cbed4){return db[_0xb047('0x2b')]['find']({'where':{'id':_0x5a8e52[_0xb047('0x51')]['id']}})[_0xb047('0x23')](handleEntityNotFound(_0x4cbed4,null))[_0xb047('0x23')](removeEntity(_0x4cbed4,null))['catch'](handleError(_0x4cbed4,null));};exports['getSessions']=function(_0x286145,_0x115d21,_0x4f0672){var _0x455210={'raw':!![],'where':{}};var _0x300bf={};var _0x34be20={'count':0x0,'rows':[]};return db[_0xb047('0x2b')][_0xb047('0x56')]({'where':{'id':_0x286145[_0xb047('0x51')]['id']}})[_0xb047('0x23')](handleEntityNotFound(_0x115d21,null))[_0xb047('0x23')](function(_0x597fd9){if(_0x597fd9){_0x300bf[_0xb047('0x2f')]=_[_0xb047('0x31')](db[_0xb047('0x57')][_0xb047('0x2c')]);_0x300bf[_0xb047('0x30')]=_[_0xb047('0x31')](_0x286145[_0xb047('0x30')]);_0x300bf[_0xb047('0x32')]=_[_0xb047('0x33')](_0x300bf[_0xb047('0x2f')],_0x300bf[_0xb047('0x30')]);_0x455210[_0xb047('0x34')]=_['intersection'](_0x300bf['model'],qs[_0xb047('0x35')](_0x286145[_0xb047('0x30')][_0xb047('0x35')]));_0x455210[_0xb047('0x34')]=_0x455210[_0xb047('0x34')][_0xb047('0x36')]?_0x455210[_0xb047('0x34')]:_0x300bf[_0xb047('0x2f')];if(!_0x286145[_0xb047('0x30')][_0xb047('0x37')](_0xb047('0x38'))){_0x455210['limit']=qs['limit'](_0x286145[_0xb047('0x30')][_0xb047('0x1f')]);_0x455210[_0xb047('0x39')]=qs[_0xb047('0x39')](_0x286145['query']['offset']);}_0x455210[_0xb047('0x58')]=qs[_0xb047('0x3a')](_0x286145[_0xb047('0x30')][_0xb047('0x3a')]);_0x455210[_0xb047('0x3b')]=qs[_0xb047('0x32')](_[_0xb047('0x3c')](_0x286145[_0xb047('0x30')],_0x300bf['filters']));_0x455210[_0xb047('0x3b')][_0xb047('0x59')]=_0x597fd9['id'];if(_0x286145[_0xb047('0x30')]['filter']){_0x455210[_0xb047('0x3b')]=_[_0xb047('0x3f')](_0x455210['where'],{'$or':_[_0xb047('0x2a')](_0x455210[_0xb047('0x34')],function(_0x51408b){var _0x33db5b={};_0x33db5b[_0x51408b]={'$like':'%'+_0x286145['query'][_0xb047('0x3d')]+'%'};return _0x33db5b;})});}_0x455210=_['merge']({},_0x455210,_0x286145[_0xb047('0x46')]);return db[_0xb047('0x57')]['count']({'where':_0x455210[_0xb047('0x3b')]})[_0xb047('0x23')](function(_0x55aa52){_0x34be20[_0xb047('0x1e')]=_0x55aa52;if(_0x286145[_0xb047('0x30')][_0xb047('0x45')]){_0x455210[_0xb047('0x40')]=[{'all':!![]}];}return db[_0xb047('0x57')]['findAll'](_0x455210);})[_0xb047('0x23')](function(_0x11c36d){_0x34be20[_0xb047('0x42')]=_0x11c36d;return _0x34be20;});}})['then'](respondWithFilteredResult(_0x115d21,_0x455210))[_0xb047('0x43')](handleError(_0x115d21,null));};exports[_0xb047('0x5a')]=function(_0x2551d5,_0x95d920,_0x339061){var _0x713c6d={'raw':!![],'where':{}};var _0x3aa5f0={};var _0x535687={'count':0x0,'rows':[]};return db[_0xb047('0x2b')]['findOne']({'where':{'id':_0x2551d5[_0xb047('0x51')]['id']}})[_0xb047('0x23')](handleEntityNotFound(_0x95d920,null))[_0xb047('0x23')](function(_0x7249eb){if(_0x7249eb){_0x3aa5f0[_0xb047('0x2f')]=_[_0xb047('0x31')](db[_0xb047('0x5b')][_0xb047('0x2c')]);_0x3aa5f0[_0xb047('0x30')]=_[_0xb047('0x31')](_0x2551d5['query']);_0x3aa5f0['filters']=_[_0xb047('0x33')](_0x3aa5f0[_0xb047('0x2f')],_0x3aa5f0[_0xb047('0x30')]);_0x713c6d[_0xb047('0x34')]=_[_0xb047('0x33')](_0x3aa5f0[_0xb047('0x2f')],qs['fields'](_0x2551d5[_0xb047('0x30')][_0xb047('0x35')]));_0x713c6d[_0xb047('0x34')]=_0x713c6d[_0xb047('0x34')][_0xb047('0x36')]?_0x713c6d[_0xb047('0x34')]:_0x3aa5f0[_0xb047('0x2f')];if(!_0x2551d5[_0xb047('0x30')]['hasOwnProperty'](_0xb047('0x38'))){_0x713c6d[_0xb047('0x1f')]=qs[_0xb047('0x1f')](_0x2551d5[_0xb047('0x30')][_0xb047('0x1f')]);_0x713c6d[_0xb047('0x39')]=qs[_0xb047('0x39')](_0x2551d5['query'][_0xb047('0x39')]);}_0x713c6d[_0xb047('0x58')]=qs[_0xb047('0x3a')](_0x2551d5[_0xb047('0x30')][_0xb047('0x3a')]);_0x713c6d[_0xb047('0x3b')]=qs[_0xb047('0x32')](_[_0xb047('0x3c')](_0x2551d5[_0xb047('0x30')],_0x3aa5f0[_0xb047('0x32')]));_0x713c6d[_0xb047('0x3b')][_0xb047('0x59')]=_0x7249eb['id'];if(_0x2551d5[_0xb047('0x30')][_0xb047('0x3d')]){_0x713c6d['where']=_[_0xb047('0x3f')](_0x713c6d['where'],{'$or':_['map'](_0x713c6d['attributes'],function(_0x3f1895){var _0x4de668={};_0x4de668[_0x3f1895]={'$like':'%'+_0x2551d5[_0xb047('0x30')][_0xb047('0x3d')]+'%'};return _0x4de668;})});}_0x713c6d=_['merge']({},_0x713c6d,_0x2551d5['options']);return db[_0xb047('0x5b')][_0xb047('0x1e')]({'where':_0x713c6d[_0xb047('0x3b')]})[_0xb047('0x23')](function(_0x467e6e){_0x535687[_0xb047('0x1e')]=_0x467e6e;if(_0x2551d5[_0xb047('0x30')]['includeAll']){_0x713c6d[_0xb047('0x40')]=[{'all':!![]}];}return db[_0xb047('0x5b')]['findAll'](_0x713c6d);})['then'](function(_0x5a375a){_0x535687[_0xb047('0x42')]=_0x5a375a;return _0x535687;});}})[_0xb047('0x23')](respondWithFilteredResult(_0x95d920,_0x713c6d))[_0xb047('0x43')](handleError(_0x95d920,null));};function char(_0x43055c){return _0xb047('0x5c')===typeof _0x43055c?String[_0xb047('0x5d')][_0xb047('0x5e')](null,arguments):_0x43055c;}function needsEncapsulation(_0x5d7960){return!!_0x5d7960&&(_0x5d7960[_0xb047('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x5d7960[_0xb047('0x5f')]()[_0xb047('0x60')](char(0xa))>=0x0||_0x5d7960[_0xb047('0x5f')]()[_0xb047('0x60')](char(0x2c))>=0x0||_0x5d7960['toString']()[_0xb047('0x60')](char(0x22))>=0x0);}function encapsulate(_0x56581c){var _0x50bc51=char(0x22),_0x3bb74f='\x5c'+char(0x22),_0x45fe37=_0x56581c[_0xb047('0x5f')]()[_0xb047('0x61')](new RegExp(_0x50bc51,'g'),_0x3bb74f);return _0x50bc51+_0x45fe37+_0x50bc51;}exports[_0xb047('0x62')]=function(_0x6e5622,_0x2993d8,_0x4ece95){var _0x301d91,_0x21d121;var _0x517541={'where':{'ProjectId':_0x6e5622['params']['id']}};if(_0x6e5622[_0xb047('0x30')]['startTime']){_0x517541['where'][_0xb047('0x63')]=JSON['parse'](_0x6e5622[_0xb047('0x30')][_0xb047('0x64')]);}return db[_0xb047('0x57')][_0xb047('0x41')](_0x517541)['then'](handleEntityNotFound(_0x2993d8,null))[_0xb047('0x23')](function(_0x3e36f5){if(_0x3e36f5){_0x301d91=_0x3e36f5;return db[_0xb047('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0xb047('0x2a')](_0x301d91,'id')},'ProjectId':_0x6e5622['params']['id']},'order':_0xb047('0x66')});}})['then'](handleEntityNotFound(_0x2993d8,null))['then'](function(_0x40f622){if(_0x40f622){_0x21d121=_0x40f622;var _0x21292c={};for(var _0x2961f2=0x0,_0x43fe40=_0x21d121[_0xb047('0x36')];_0x2961f2<_0x43fe40;_0x2961f2++){if(!_0x21292c[_0xb047('0x37')](_0x21d121[_0x2961f2]['questionId'])){_0x21292c[_0x21d121[_0x2961f2][_0xb047('0x67')]]=needsEncapsulation(_0x21d121[_0x2961f2]['question'])?encapsulate(_0x21d121[_0x2961f2][_0xb047('0x68')]):_0x21d121[_0x2961f2][_0xb047('0x68')];}}var _0x13d759=[],_0x323edc={};for(var _0x7f7f0c=0x0,_0x3addf9=_0x301d91[_0xb047('0x36')];_0x7f7f0c<_0x3addf9;_0x7f7f0c++){_0x323edc={'ProjectId':_0x6e5622['params']['id'],'SessionId':_0x301d91[_0x7f7f0c]['id'],'StartTime':moment(_0x301d91[_0x7f7f0c][_0xb047('0x63')])[_0xb047('0x69')](_0xb047('0x6a'))};for(var _0x22cdda=0x0,_0x556faf=_0x21d121[_0xb047('0x36')];_0x22cdda<_0x556faf;_0x22cdda++){if(_0x21d121[_0x22cdda][_0xb047('0x6b')]==_0x301d91[_0x7f7f0c]['id']&&_0x21292c['hasOwnProperty'](_0x21d121[_0x22cdda]['questionId'])){_0x323edc[_0x21292c[_0x21d121[_0x22cdda]['questionId']]]=_0x21d121[_0x22cdda][_0xb047('0x6c')];}}for(var _0x12625f in _0x21292c){if(!_0x323edc[_0xb047('0x37')](_0x21292c[_0x12625f])){_0x323edc[_0x21292c[_0x12625f]]=null;}}_0x13d759[_0xb047('0x6d')](_0x323edc);}return _0x13d759;}})['then'](function(_0xf52b1f){if(!_['isEmpty'](_0xf52b1f)){var _0x2641bb=toCsv(_0xf52b1f);var _0x5676c3=Date[_0xb047('0x6e')]();fs[_0xb047('0x6f')](util[_0xb047('0x69')](_0xb047('0x70'),_0x6e5622[_0xb047('0x51')]['id'],_0x5676c3),_0x2641bb);_0x2993d8[_0xb047('0x71')]('Content-disposition','attachment;\x20filename='+util[_0xb047('0x69')](_0xb047('0x72'),_0x6e5622[_0xb047('0x51')]['id'],_0x5676c3));_0x2993d8[_0xb047('0x71')](_0xb047('0x73'),_0xb047('0x74'));return _0x2993d8['download'](util[_0xb047('0x69')](_0xb047('0x70'),_0x6e5622['params']['id'],_0x5676c3));}else{return _0x2993d8[_0xb047('0x1a')](0xcc);}})[_0xb047('0x43')](handleError(_0x2993d8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b03aad4..9cff712 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 _0x6fb6=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0x26f797,_0x55d7f7){var _0x41294a=function(_0x57d486){while(--_0x57d486){_0x26f797['push'](_0x26f797['shift']());}};_0x41294a(++_0x55d7f7);}(_0x6fb6,0x1ba));var _0x66fb=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x6fb6[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x66fb('0x0'));var util=require(_0x66fb('0x1'));var logger=require('../../config/logger')(_0x66fb('0x2'));var moment=require(_0x66fb('0x3'));var BPromise=require(_0x66fb('0x4'));var rp=require(_0x66fb('0x5'));var fs=require('fs');var path=require(_0x66fb('0x6'));var rimraf=require('rimraf');var config=require(_0x66fb('0x7'));var attributes=require(_0x66fb('0x8'));module[_0x66fb('0x9')]=function(_0x166991,_0x4583d0){return _0x166991[_0x66fb('0xa')](_0x66fb('0xb'),attributes,{'tableName':_0x66fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0a8=['bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects','lodash','../../config/logger','api'];(function(_0x2c6979,_0x1bd6d7){var _0x35cf57=function(_0x25d440){while(--_0x25d440){_0x2c6979['push'](_0x2c6979['shift']());}};_0x35cf57(++_0x1bd6d7);}(_0xe0a8,0xc3));var _0x8e0a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe0a8[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x8e0a('0x0'));var util=require('util');var logger=require(_0x8e0a('0x1'))(_0x8e0a('0x2'));var moment=require('moment');var BPromise=require(_0x8e0a('0x3'));var rp=require(_0x8e0a('0x4'));var fs=require('fs');var path=require(_0x8e0a('0x5'));var rimraf=require(_0x8e0a('0x6'));var config=require(_0x8e0a('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x8e0a('0x8')]=function(_0x407515,_0x2e2157){return _0x407515['define'](_0x8e0a('0x9'),attributes,{'tableName':_0x8e0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 3eec0d5..ee32131 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 _0x5f3f=['http','request','then','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x484b27,_0x43f02a){var _0x26a0d0=function(_0x5f5ceb){while(--_0x5f5ceb){_0x484b27['push'](_0x484b27['shift']());}};_0x26a0d0(++_0x43f02a);}(_0x5f3f,0x100));var _0xf5f3=function(_0x1b81ae,_0x1941f7){_0x1b81ae=_0x1b81ae-0x0;var _0x33ba48=_0x5f3f[_0x1b81ae];return _0x33ba48;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf5f3('0x0'));var BPromise=require('bluebird');var rs=require(_0xf5f3('0x1'));var fs=require('fs');var Redis=require(_0xf5f3('0x2'));var db=require(_0xf5f3('0x3'))['db'];var utils=require(_0xf5f3('0x4'));var logger=require('../../config/logger')(_0xf5f3('0x5'));var config=require('../../config/environment');var jayson=require(_0xf5f3('0x6'));var client=jayson[_0xf5f3('0x7')][_0xf5f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45a35d,_0x32e140,_0x4784a9){return new BPromise(function(_0x469af8,_0x478c10){return client[_0xf5f3('0x9')](_0x45a35d,_0x4784a9)[_0xf5f3('0xa')](function(_0x2f81cd){logger['info'](_0xf5f3('0xb'),_0x32e140,'request\x20sent');logger[_0xf5f3('0xc')](_0xf5f3('0xd'),_0x32e140,_0xf5f3('0xe'),JSON[_0xf5f3('0xf')](_0x2f81cd));if(_0x2f81cd[_0xf5f3('0x10')]){if(_0x2f81cd[_0xf5f3('0x10')][_0xf5f3('0x11')]===0x1f4){logger[_0xf5f3('0x10')](_0xf5f3('0xb'),_0x32e140,_0x2f81cd[_0xf5f3('0x10')][_0xf5f3('0x12')]);return _0x478c10(_0x2f81cd[_0xf5f3('0x10')][_0xf5f3('0x12')]);}logger['error'](_0xf5f3('0xb'),_0x32e140,_0x2f81cd[_0xf5f3('0x10')][_0xf5f3('0x12')]);return _0x469af8(_0x2f81cd[_0xf5f3('0x10')]['message']);}else{logger[_0xf5f3('0x13')](_0xf5f3('0xb'),_0x32e140,_0xf5f3('0xe'));_0x469af8(_0x2f81cd[_0xf5f3('0x14')][_0xf5f3('0x12')]);}})[_0xf5f3('0x15')](function(_0x1441eb){logger[_0xf5f3('0x10')](_0xf5f3('0xb'),_0x32e140,_0x1441eb);_0x478c10(_0x1441eb);});});} \ No newline at end of file +var _0x1710=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x44f082,_0xddf18f){var _0x406f1d=function(_0x1f66ae){while(--_0x1f66ae){_0x44f082['push'](_0x44f082['shift']());}};_0x406f1d(++_0xddf18f);}(_0x1710,0x1c6));var _0x0171=function(_0x4c794b,_0x599ba7){_0x4c794b=_0x4c794b-0x0;var _0x2603f8=_0x1710[_0x4c794b];return _0x2603f8;};'use strict';var _=require(_0x0171('0x0'));var util=require(_0x0171('0x1'));var moment=require(_0x0171('0x2'));var BPromise=require(_0x0171('0x3'));var rs=require(_0x0171('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0171('0x5'))['db'];var utils=require(_0x0171('0x6'));var logger=require('../../config/logger')(_0x0171('0x7'));var config=require(_0x0171('0x8'));var jayson=require(_0x0171('0x9'));var client=jayson['client'][_0x0171('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25fb9b,_0x54d3e4,_0x5b0207){return new BPromise(function(_0x2d0732,_0x621cae){return client[_0x0171('0xb')](_0x25fb9b,_0x5b0207)[_0x0171('0xc')](function(_0x31f2cf){logger[_0x0171('0xd')](_0x0171('0xe'),_0x54d3e4,_0x0171('0xf'));logger[_0x0171('0x10')](_0x0171('0x11'),_0x54d3e4,_0x0171('0xf'),JSON['stringify'](_0x31f2cf));if(_0x31f2cf[_0x0171('0x12')]){if(_0x31f2cf[_0x0171('0x12')]['code']===0x1f4){logger[_0x0171('0x12')](_0x0171('0xe'),_0x54d3e4,_0x31f2cf[_0x0171('0x12')][_0x0171('0x13')]);return _0x621cae(_0x31f2cf[_0x0171('0x12')][_0x0171('0x13')]);}logger[_0x0171('0x12')](_0x0171('0xe'),_0x54d3e4,_0x31f2cf[_0x0171('0x12')][_0x0171('0x13')]);return _0x2d0732(_0x31f2cf[_0x0171('0x12')][_0x0171('0x13')]);}else{logger['info'](_0x0171('0xe'),_0x54d3e4,_0x0171('0xf'));_0x2d0732(_0x31f2cf['result'][_0x0171('0x13')]);}})['catch'](function(_0x570682){logger[_0x0171('0x12')](_0x0171('0xe'),_0x54d3e4,_0x570682);_0x621cae(_0x570682);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f8e7b60..139fb5e 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 _0xb5c1=['fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','exports','multer','util','express','Router'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xb5c1,0x152));var _0x1b5c=function(_0x522541,_0xd70441){_0x522541=_0x522541-0x0;var _0x474299=_0xb5c1[_0x522541];return _0x474299;};'use strict';var multer=require(_0x1b5c('0x0'));var util=require(_0x1b5c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1b5c('0x2'));var router=express[_0x1b5c('0x3')]();var fs_extra=require(_0x1b5c('0x4'));var auth=require(_0x1b5c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1b5c('0x6'));var controller=require(_0x1b5c('0x7'));router[_0x1b5c('0x8')]('/',auth[_0x1b5c('0x9')](),controller[_0x1b5c('0xa')]);router['get'](_0x1b5c('0xb'),auth[_0x1b5c('0x9')](),controller[_0x1b5c('0xc')]);router['get'](_0x1b5c('0xd'),auth[_0x1b5c('0x9')](),controller[_0x1b5c('0xe')]);router['post']('/',auth[_0x1b5c('0x9')](),controller[_0x1b5c('0xf')]);router['put'](_0x1b5c('0xd'),auth['isAuthenticated'](),controller[_0x1b5c('0x10')]);router[_0x1b5c('0x11')](_0x1b5c('0xd'),auth[_0x1b5c('0x9')](),controller['destroy']);module[_0x1b5c('0x12')]=router; \ No newline at end of file +var _0x66a5=['fs-extra','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1c7882,_0x373078){var _0x1c761e=function(_0x42b144){while(--_0x42b144){_0x1c7882['push'](_0x1c7882['shift']());}};_0x1c761e(++_0x373078);}(_0x66a5,0x1be));var _0x566a=function(_0x1ec479,_0x54d127){_0x1ec479=_0x1ec479-0x0;var _0x43ca09=_0x66a5[_0x1ec479];return _0x43ca09;};'use strict';var multer=require(_0x566a('0x0'));var util=require('util');var path=require(_0x566a('0x1'));var timeout=require(_0x566a('0x2'));var express=require(_0x566a('0x3'));var router=express['Router']();var fs_extra=require(_0x566a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x566a('0x5'));var controller=require(_0x566a('0x6'));router[_0x566a('0x7')]('/',auth[_0x566a('0x8')](),controller['index']);router[_0x566a('0x7')](_0x566a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x566a('0x7')](_0x566a('0xa'),auth['isAuthenticated'](),controller[_0x566a('0xb')]);router[_0x566a('0xc')]('/',auth[_0x566a('0x8')](),controller[_0x566a('0xd')]);router['put'](_0x566a('0xa'),auth[_0x566a('0x8')](),controller[_0x566a('0xe')]);router[_0x566a('0xf')](_0x566a('0xa'),auth['isAuthenticated'](),controller[_0x566a('0x10')]);module[_0x566a('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ad3bf67..cb3882a 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 _0xde9f=['sequelize','TEXT','long','STRING'];(function(_0x44f4c1,_0x117b72){var _0x2f87c4=function(_0xeb877f){while(--_0xeb877f){_0x44f4c1['push'](_0x44f4c1['shift']());}};_0x2f87c4(++_0x117b72);}(_0xde9f,0x118));var _0xfde9=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0xde9f[_0x6ca7f4];return _0x494fa6;};'use strict';var Sequelize=require(_0xfde9('0x0'));module['exports']={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0xfde9('0x1')](_0xfde9('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xfde9('0x3')]},'queue':{'type':Sequelize[_0xfde9('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfde9('0x3')]},'calleridnum':{'type':Sequelize[_0xfde9('0x3')]},'questionId':{'type':Sequelize[_0xfde9('0x3')]}}; \ No newline at end of file +var _0xfef3=['sequelize','TEXT','long','STRING'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0xfef3,0x118));var _0x3fef=function(_0x4e448b,_0x10dee3){_0x4e448b=_0x4e448b-0x0;var _0x13638d=_0xfef3[_0x4e448b];return _0x13638d;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'question':{'type':Sequelize[_0x3fef('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x3fef('0x2'))},'membername':{'type':Sequelize[_0x3fef('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3fef('0x3')]},'uniqueid':{'type':Sequelize[_0x3fef('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3fef('0x3')]},'questionId':{'type':Sequelize[_0x3fef('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index aa12b07..52240a4 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 _0x25e7=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','fieldName','type','model','query','keys'];(function(_0x27c3f0,_0x198aa2){var _0x11e51c=function(_0x2a48ec){while(--_0x2a48ec){_0x27c3f0['push'](_0x27c3f0['shift']());}};_0x11e51c(++_0x198aa2);}(_0x25e7,0x1d6));var _0x725e=function(_0x135ebc,_0x123430){_0x135ebc=_0x135ebc-0x0;var _0x210162=_0x25e7[_0x135ebc];return _0x210162;};'use strict';var pdf=require(_0x725e('0x0'));var emlformat=require(_0x725e('0x1'));var rimraf=require(_0x725e('0x2'));var zipdir=require(_0x725e('0x3'));var jsonpatch=require(_0x725e('0x4'));var rp=require(_0x725e('0x5'));var moment=require(_0x725e('0x6'));var BPromise=require(_0x725e('0x7'));var Mustache=require(_0x725e('0x8'));var util=require(_0x725e('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x725e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x725e('0xb'));var squel=require(_0x725e('0xc'));var crypto=require(_0x725e('0xd'));var jsforce=require(_0x725e('0xe'));var deskjs=require(_0x725e('0xf'));var toCsv=require(_0x725e('0xa'));var querystring=require(_0x725e('0x10'));var Papa=require(_0x725e('0x11'));var Redis=require(_0x725e('0x12'));var authService=require(_0x725e('0x13'));var qs=require(_0x725e('0x14'));var as=require(_0x725e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x725e('0x16'));var utils=require(_0x725e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x725e('0x18'))['db'];function respondWithStatusCode(_0x14218e,_0x5c5e44){_0x5c5e44=_0x5c5e44||0xcc;return function(_0x289980){if(_0x289980){return _0x14218e[_0x725e('0x19')](_0x5c5e44);}return _0x14218e[_0x725e('0x1a')](_0x5c5e44)['end']();};}function respondWithResult(_0x3f8052,_0x221e02){_0x221e02=_0x221e02||0xc8;return function(_0x44e652){if(_0x44e652){return _0x3f8052[_0x725e('0x1a')](_0x221e02)[_0x725e('0x1b')](_0x44e652);}};}function respondWithFilteredResult(_0x13fbfe,_0x523422){return function(_0x156b99){if(_0x156b99){var _0x268312=_0x156b99[_0x725e('0x1c')],_0x297bb7=_0x523422[_0x725e('0x1d')],_0x54ac0f=_0x523422[_0x725e('0x1d')]+_0x523422[_0x725e('0x1e')],_0x1a94c1;if(_0x54ac0f>=_0x268312){_0x54ac0f=_0x268312;_0x1a94c1=0xc8;}else{_0x1a94c1=0xce;}_0x13fbfe[_0x725e('0x1a')](_0x1a94c1);return _0x13fbfe['set'](_0x725e('0x1f'),_0x297bb7+'-'+_0x54ac0f+'/'+_0x268312)[_0x725e('0x1b')](_0x156b99);}return null;};}function patchUpdates(_0x1b8879){return function(_0x338a1d){try{jsonpatch[_0x725e('0x20')](_0x338a1d,_0x1b8879,!![]);}catch(_0x3ad3d2){return BPromise['reject'](_0x3ad3d2);}return _0x338a1d[_0x725e('0x21')]();};}function saveUpdates(_0xd30de9,_0x2651c3){return function(_0x40c21b){if(_0x40c21b){return _0x40c21b[_0x725e('0x22')](_0xd30de9)[_0x725e('0x23')](function(_0x127c99){return _0x127c99;});}return null;};}function removeEntity(_0x262b01,_0x7d0792){return function(_0x5c33c1){if(_0x5c33c1){return _0x5c33c1[_0x725e('0x24')]()[_0x725e('0x23')](function(){_0x262b01[_0x725e('0x1a')](0xcc)[_0x725e('0x25')]();});}};}function handleEntityNotFound(_0x5a8191,_0xffe474){return function(_0x5268c8){if(!_0x5268c8){_0x5a8191['sendStatus'](0x194);}return _0x5268c8;};}function handleError(_0x4e6b3e,_0x2aad7b){_0x2aad7b=_0x2aad7b||0x1f4;return function(_0x1cbaae){logger[_0x725e('0x26')](_0x1cbaae['stack']);if(_0x1cbaae[_0x725e('0x27')]){delete _0x1cbaae[_0x725e('0x27')];}_0x4e6b3e['status'](_0x2aad7b)[_0x725e('0x28')](_0x1cbaae);};}exports[_0x725e('0x29')]=function(_0x4b0d0c,_0x378ace){var _0x5daa2d={},_0x561656={},_0x34b71c={'count':0x0,'rows':[]};var _0x5b8dec=_[_0x725e('0x2a')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x9b5b7f){return{'name':_0x9b5b7f[_0x725e('0x2b')],'type':_0x9b5b7f[_0x725e('0x2c')]['key']};});_0x561656[_0x725e('0x2d')]=_['map'](_0x5b8dec,_0x725e('0x27'));_0x561656[_0x725e('0x2e')]=_[_0x725e('0x2f')](_0x4b0d0c[_0x725e('0x2e')]);_0x561656[_0x725e('0x30')]=_[_0x725e('0x31')](_0x561656[_0x725e('0x2d')],_0x561656[_0x725e('0x2e')]);_0x5daa2d[_0x725e('0x32')]=_[_0x725e('0x31')](_0x561656[_0x725e('0x2d')],qs['fields'](_0x4b0d0c[_0x725e('0x2e')][_0x725e('0x33')]));_0x5daa2d['attributes']=_0x5daa2d[_0x725e('0x32')]['length']?_0x5daa2d[_0x725e('0x32')]:_0x561656['model'];if(!_0x4b0d0c[_0x725e('0x2e')][_0x725e('0x34')](_0x725e('0x35'))){_0x5daa2d[_0x725e('0x1e')]=qs[_0x725e('0x1e')](_0x4b0d0c[_0x725e('0x2e')]['limit']);_0x5daa2d['offset']=qs[_0x725e('0x1d')](_0x4b0d0c[_0x725e('0x2e')][_0x725e('0x1d')]);}_0x5daa2d['order']=qs[_0x725e('0x36')](_0x4b0d0c['query'][_0x725e('0x36')]);_0x5daa2d[_0x725e('0x37')]=qs[_0x725e('0x30')](_[_0x725e('0x38')](_0x4b0d0c['query'],_0x561656['filters']),_0x5b8dec);if(_0x4b0d0c[_0x725e('0x2e')][_0x725e('0x39')]){_0x5daa2d[_0x725e('0x37')]=_['merge'](_0x5daa2d[_0x725e('0x37')],{'$or':_[_0x725e('0x2a')](_0x5b8dec,function(_0x2c2669){if(_0x2c2669['type']!==_0x725e('0x3a')){var _0x490413={};_0x490413[_0x2c2669[_0x725e('0x27')]]={'$like':'%'+_0x4b0d0c[_0x725e('0x2e')][_0x725e('0x39')]+'%'};return _0x490413;}})});}_0x5daa2d=_[_0x725e('0x3b')]({},_0x5daa2d,_0x4b0d0c[_0x725e('0x3c')]);var _0x4bf370={'where':_0x5daa2d['where']};return db[_0x725e('0x3d')][_0x725e('0x1c')](_0x4bf370)[_0x725e('0x23')](function(_0x5dd1d1){_0x34b71c[_0x725e('0x1c')]=_0x5dd1d1;if(_0x4b0d0c['query'][_0x725e('0x3e')]){_0x5daa2d[_0x725e('0x3f')]=[{'all':!![]}];}return db[_0x725e('0x3d')][_0x725e('0x40')](_0x5daa2d);})['then'](function(_0x448ebc){_0x34b71c[_0x725e('0x41')]=_0x448ebc;return _0x34b71c;})[_0x725e('0x23')](respondWithFilteredResult(_0x378ace,_0x5daa2d))[_0x725e('0x42')](handleError(_0x378ace,null));};exports[_0x725e('0x43')]=function(_0x19ed0a,_0x3e5460){var _0x49848f={'raw':!![],'where':{'id':_0x19ed0a[_0x725e('0x44')]['id']}},_0x36b0ae={};_0x36b0ae['model']=_[_0x725e('0x2f')](db[_0x725e('0x3d')]['rawAttributes']);_0x36b0ae['query']=_['keys'](_0x19ed0a['query']);_0x36b0ae[_0x725e('0x30')]=_[_0x725e('0x31')](_0x36b0ae[_0x725e('0x2d')],_0x36b0ae['query']);_0x49848f[_0x725e('0x32')]=_['intersection'](_0x36b0ae['model'],qs[_0x725e('0x33')](_0x19ed0a[_0x725e('0x2e')][_0x725e('0x33')]));_0x49848f[_0x725e('0x32')]=_0x49848f[_0x725e('0x32')][_0x725e('0x45')]?_0x49848f['attributes']:_0x36b0ae[_0x725e('0x2d')];if(_0x19ed0a['query'][_0x725e('0x3e')]){_0x49848f[_0x725e('0x3f')]=[{'all':!![]}];}_0x49848f=_['merge']({},_0x49848f,_0x19ed0a[_0x725e('0x3c')]);return db['JscriptyQuestionReport'][_0x725e('0x46')](_0x49848f)[_0x725e('0x23')](handleEntityNotFound(_0x3e5460,null))['then'](respondWithResult(_0x3e5460,null))['catch'](handleError(_0x3e5460,null));};exports[_0x725e('0x47')]=function(_0x5e4c0c,_0x25e57b){return db['JscriptyQuestionReport']['create'](_0x5e4c0c['body'],{})[_0x725e('0x23')](respondWithResult(_0x25e57b,0xc9))[_0x725e('0x42')](handleError(_0x25e57b,null));};exports['update']=function(_0x1afd73,_0x252c20){if(_0x1afd73['body']['id']){delete _0x1afd73[_0x725e('0x48')]['id'];}return db[_0x725e('0x3d')][_0x725e('0x46')]({'where':{'id':_0x1afd73[_0x725e('0x44')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x252c20,null))[_0x725e('0x23')](saveUpdates(_0x1afd73[_0x725e('0x48')],null))[_0x725e('0x23')](respondWithResult(_0x252c20,null))[_0x725e('0x42')](handleError(_0x252c20,null));};exports[_0x725e('0x24')]=function(_0x34edcd,_0x14753a){return db[_0x725e('0x3d')]['find']({'where':{'id':_0x34edcd[_0x725e('0x44')]['id']}})['then'](handleEntityNotFound(_0x14753a,null))[_0x725e('0x23')](removeEntity(_0x14753a,null))[_0x725e('0x42')](handleError(_0x14753a,null));};exports[_0x725e('0x49')]=function(_0x1a289e,_0x34eab7){return db[_0x725e('0x3d')][_0x725e('0x49')]()[_0x725e('0x23')](respondWithResult(_0x34eab7,null))[_0x725e('0x42')](handleError(_0x34eab7,null));}; \ No newline at end of file +var _0xb7de=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0xb7de,0xc7));var _0xeb7d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb7de[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0xeb7d('0x0'));var emlformat=require(_0xeb7d('0x1'));var rimraf=require(_0xeb7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb7d('0x3'));var rp=require(_0xeb7d('0x4'));var moment=require(_0xeb7d('0x5'));var BPromise=require(_0xeb7d('0x6'));var Mustache=require(_0xeb7d('0x7'));var util=require('util');var path=require(_0xeb7d('0x8'));var sox=require(_0xeb7d('0x9'));var csv=require(_0xeb7d('0xa'));var ejs=require(_0xeb7d('0xb'));var fs=require('fs');var fs_extra=require(_0xeb7d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeb7d('0xd'));var jsforce=require(_0xeb7d('0xe'));var deskjs=require(_0xeb7d('0xf'));var toCsv=require(_0xeb7d('0xa'));var querystring=require('querystring');var Papa=require(_0xeb7d('0x10'));var Redis=require(_0xeb7d('0x11'));var authService=require(_0xeb7d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb7d('0x13'));var logger=require('../../config/logger')(_0xeb7d('0x14'));var utils=require(_0xeb7d('0x15'));var config=require(_0xeb7d('0x16'));var licenseUtil=require(_0xeb7d('0x17'));var db=require(_0xeb7d('0x18'))['db'];function respondWithStatusCode(_0x57eb05,_0x598828){_0x598828=_0x598828||0xcc;return function(_0x2defe5){if(_0x2defe5){return _0x57eb05[_0xeb7d('0x19')](_0x598828);}return _0x57eb05[_0xeb7d('0x1a')](_0x598828)[_0xeb7d('0x1b')]();};}function respondWithResult(_0xb418,_0x5f29b0){_0x5f29b0=_0x5f29b0||0xc8;return function(_0xdc94e7){if(_0xdc94e7){return _0xb418['status'](_0x5f29b0)[_0xeb7d('0x1c')](_0xdc94e7);}};}function respondWithFilteredResult(_0x45131f,_0x35186c){return function(_0x56dce2){if(_0x56dce2){var _0x59d9fc=_0x56dce2['count'],_0x1eaa20=_0x35186c[_0xeb7d('0x1d')],_0xfcbbce=_0x35186c[_0xeb7d('0x1d')]+_0x35186c['limit'],_0x588dcc;if(_0xfcbbce>=_0x59d9fc){_0xfcbbce=_0x59d9fc;_0x588dcc=0xc8;}else{_0x588dcc=0xce;}_0x45131f[_0xeb7d('0x1a')](_0x588dcc);return _0x45131f[_0xeb7d('0x1e')](_0xeb7d('0x1f'),_0x1eaa20+'-'+_0xfcbbce+'/'+_0x59d9fc)[_0xeb7d('0x1c')](_0x56dce2);}return null;};}function patchUpdates(_0x215a75){return function(_0x233a86){try{jsonpatch[_0xeb7d('0x20')](_0x233a86,_0x215a75,!![]);}catch(_0x38d591){return BPromise[_0xeb7d('0x21')](_0x38d591);}return _0x233a86['save']();};}function saveUpdates(_0x1507f5,_0x4ec55b){return function(_0xf2807d){if(_0xf2807d){return _0xf2807d[_0xeb7d('0x22')](_0x1507f5)[_0xeb7d('0x23')](function(_0x5beab9){return _0x5beab9;});}return null;};}function removeEntity(_0x19ad4f,_0x1b68e8){return function(_0x505403){if(_0x505403){return _0x505403[_0xeb7d('0x24')]()[_0xeb7d('0x23')](function(){_0x19ad4f[_0xeb7d('0x1a')](0xcc)[_0xeb7d('0x1b')]();});}};}function handleEntityNotFound(_0x3c58ba,_0x374fce){return function(_0x39a4f3){if(!_0x39a4f3){_0x3c58ba['sendStatus'](0x194);}return _0x39a4f3;};}function handleError(_0x3ac528,_0x392ba1){_0x392ba1=_0x392ba1||0x1f4;return function(_0x1331ca){logger[_0xeb7d('0x25')](_0x1331ca[_0xeb7d('0x26')]);if(_0x1331ca[_0xeb7d('0x27')]){delete _0x1331ca[_0xeb7d('0x27')];}_0x3ac528['status'](_0x392ba1)[_0xeb7d('0x28')](_0x1331ca);};}exports[_0xeb7d('0x29')]=function(_0x69b982,_0xe0bf4f){var _0xe6f93c={},_0x32c518={},_0x58ba4f={'count':0x0,'rows':[]};var _0x310f25=_[_0xeb7d('0x2a')](db['JscriptyQuestionReport'][_0xeb7d('0x2b')],function(_0x3fcff4){return{'name':_0x3fcff4[_0xeb7d('0x2c')],'type':_0x3fcff4[_0xeb7d('0x2d')][_0xeb7d('0x2e')]};});_0x32c518[_0xeb7d('0x2f')]=_[_0xeb7d('0x2a')](_0x310f25,_0xeb7d('0x27'));_0x32c518[_0xeb7d('0x30')]=_[_0xeb7d('0x31')](_0x69b982[_0xeb7d('0x30')]);_0x32c518[_0xeb7d('0x32')]=_[_0xeb7d('0x33')](_0x32c518[_0xeb7d('0x2f')],_0x32c518[_0xeb7d('0x30')]);_0xe6f93c[_0xeb7d('0x34')]=_[_0xeb7d('0x33')](_0x32c518[_0xeb7d('0x2f')],qs[_0xeb7d('0x35')](_0x69b982[_0xeb7d('0x30')][_0xeb7d('0x35')]));_0xe6f93c[_0xeb7d('0x34')]=_0xe6f93c[_0xeb7d('0x34')][_0xeb7d('0x36')]?_0xe6f93c[_0xeb7d('0x34')]:_0x32c518[_0xeb7d('0x2f')];if(!_0x69b982[_0xeb7d('0x30')][_0xeb7d('0x37')](_0xeb7d('0x38'))){_0xe6f93c[_0xeb7d('0x39')]=qs[_0xeb7d('0x39')](_0x69b982['query'][_0xeb7d('0x39')]);_0xe6f93c[_0xeb7d('0x1d')]=qs[_0xeb7d('0x1d')](_0x69b982[_0xeb7d('0x30')][_0xeb7d('0x1d')]);}_0xe6f93c['order']=qs[_0xeb7d('0x3a')](_0x69b982[_0xeb7d('0x30')]['sort']);_0xe6f93c[_0xeb7d('0x3b')]=qs[_0xeb7d('0x32')](_[_0xeb7d('0x3c')](_0x69b982[_0xeb7d('0x30')],_0x32c518[_0xeb7d('0x32')]),_0x310f25);if(_0x69b982[_0xeb7d('0x30')][_0xeb7d('0x3d')]){_0xe6f93c['where']=_[_0xeb7d('0x3e')](_0xe6f93c['where'],{'$or':_[_0xeb7d('0x2a')](_0x310f25,function(_0x472468){if(_0x472468[_0xeb7d('0x2d')]!==_0xeb7d('0x3f')){var _0x1c15f1={};_0x1c15f1[_0x472468[_0xeb7d('0x27')]]={'$like':'%'+_0x69b982[_0xeb7d('0x30')][_0xeb7d('0x3d')]+'%'};return _0x1c15f1;}})});}_0xe6f93c=_[_0xeb7d('0x3e')]({},_0xe6f93c,_0x69b982[_0xeb7d('0x40')]);var _0x2ae821={'where':_0xe6f93c[_0xeb7d('0x3b')]};return db[_0xeb7d('0x41')][_0xeb7d('0x42')](_0x2ae821)[_0xeb7d('0x23')](function(_0x5ed81c){_0x58ba4f['count']=_0x5ed81c;if(_0x69b982[_0xeb7d('0x30')][_0xeb7d('0x43')]){_0xe6f93c[_0xeb7d('0x44')]=[{'all':!![]}];}return db[_0xeb7d('0x41')][_0xeb7d('0x45')](_0xe6f93c);})[_0xeb7d('0x23')](function(_0x4efb37){_0x58ba4f[_0xeb7d('0x46')]=_0x4efb37;return _0x58ba4f;})['then'](respondWithFilteredResult(_0xe0bf4f,_0xe6f93c))[_0xeb7d('0x47')](handleError(_0xe0bf4f,null));};exports[_0xeb7d('0x48')]=function(_0x2b6f97,_0x31d074){var _0x4090cf={'raw':!![],'where':{'id':_0x2b6f97[_0xeb7d('0x49')]['id']}},_0x5d6d24={};_0x5d6d24['model']=_[_0xeb7d('0x31')](db[_0xeb7d('0x41')][_0xeb7d('0x2b')]);_0x5d6d24[_0xeb7d('0x30')]=_[_0xeb7d('0x31')](_0x2b6f97[_0xeb7d('0x30')]);_0x5d6d24[_0xeb7d('0x32')]=_['intersection'](_0x5d6d24[_0xeb7d('0x2f')],_0x5d6d24[_0xeb7d('0x30')]);_0x4090cf['attributes']=_[_0xeb7d('0x33')](_0x5d6d24['model'],qs[_0xeb7d('0x35')](_0x2b6f97[_0xeb7d('0x30')]['fields']));_0x4090cf[_0xeb7d('0x34')]=_0x4090cf[_0xeb7d('0x34')][_0xeb7d('0x36')]?_0x4090cf['attributes']:_0x5d6d24[_0xeb7d('0x2f')];if(_0x2b6f97[_0xeb7d('0x30')]['includeAll']){_0x4090cf[_0xeb7d('0x44')]=[{'all':!![]}];}_0x4090cf=_[_0xeb7d('0x3e')]({},_0x4090cf,_0x2b6f97[_0xeb7d('0x40')]);return db[_0xeb7d('0x41')]['find'](_0x4090cf)[_0xeb7d('0x23')](handleEntityNotFound(_0x31d074,null))[_0xeb7d('0x23')](respondWithResult(_0x31d074,null))[_0xeb7d('0x47')](handleError(_0x31d074,null));};exports[_0xeb7d('0x4a')]=function(_0xb171c,_0x566dfe){return db[_0xeb7d('0x41')][_0xeb7d('0x4a')](_0xb171c['body'],{})['then'](respondWithResult(_0x566dfe,0xc9))['catch'](handleError(_0x566dfe,null));};exports[_0xeb7d('0x22')]=function(_0x16f72a,_0x5bf95f){if(_0x16f72a[_0xeb7d('0x4b')]['id']){delete _0x16f72a[_0xeb7d('0x4b')]['id'];}return db['JscriptyQuestionReport'][_0xeb7d('0x4c')]({'where':{'id':_0x16f72a['params']['id']}})['then'](handleEntityNotFound(_0x5bf95f,null))[_0xeb7d('0x23')](saveUpdates(_0x16f72a[_0xeb7d('0x4b')],null))[_0xeb7d('0x23')](respondWithResult(_0x5bf95f,null))[_0xeb7d('0x47')](handleError(_0x5bf95f,null));};exports[_0xeb7d('0x24')]=function(_0x12286d,_0x27064c){return db['JscriptyQuestionReport'][_0xeb7d('0x4c')]({'where':{'id':_0x12286d['params']['id']}})[_0xeb7d('0x23')](handleEntityNotFound(_0x27064c,null))[_0xeb7d('0x23')](removeEntity(_0x27064c,null))[_0xeb7d('0x47')](handleError(_0x27064c,null));};exports[_0xeb7d('0x4d')]=function(_0x12257a,_0x55c6f5){return db['JscriptyQuestionReport'][_0xeb7d('0x4d')]()[_0xeb7d('0x23')](respondWithResult(_0x55c6f5,null))[_0xeb7d('0x47')](handleError(_0x55c6f5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 201faef..e58e147 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 _0x4d01=['bluebird','request-promise','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x55fc62,_0x41eba2){var _0x4ba483=function(_0x38ef0f){while(--_0x38ef0f){_0x55fc62['push'](_0x55fc62['shift']());}};_0x4ba483(++_0x41eba2);}(_0x4d01,0x1a6));var _0x14d0=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x4d01[_0x3b6652];return _0x14d39f;};'use strict';var _=require('lodash');var util=require(_0x14d0('0x0'));var logger=require(_0x14d0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x14d0('0x2'));var rp=require(_0x14d0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14d0('0x4'));var config=require(_0x14d0('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x14d0('0x6')]=function(_0x3d5e3d,_0xa27acd){return _0x3d5e3d[_0x14d0('0x7')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a8d=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x499684,_0x34f92c){var _0x1bd363=function(_0x22f77a){while(--_0x22f77a){_0x499684['push'](_0x499684['shift']());}};_0x1bd363(++_0x34f92c);}(_0x0a8d,0xdc));var _0xd0a8=function(_0x1ed98a,_0x17eed0){_0x1ed98a=_0x1ed98a-0x0;var _0x86d7c0=_0x0a8d[_0x1ed98a];return _0x86d7c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd0a8('0x0'))(_0xd0a8('0x1'));var moment=require(_0xd0a8('0x2'));var BPromise=require(_0xd0a8('0x3'));var rp=require(_0xd0a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd0a8('0x5'));var attributes=require(_0xd0a8('0x6'));module[_0xd0a8('0x7')]=function(_0x2d14a7,_0x3678a9){return _0x2d14a7[_0xd0a8('0x8')](_0xd0a8('0x9'),attributes,{'tableName':_0xd0a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 05b30af..b205769 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 _0xa5f1=['code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ff527,_0x54b6d2){var _0x51cc75=function(_0x4168e5){while(--_0x4168e5){_0x1ff527['push'](_0x1ff527['shift']());}};_0x51cc75(++_0x54b6d2);}(_0xa5f1,0xb0));var _0x1a5f=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa5f1[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var util=require(_0x1a5f('0x0'));var moment=require(_0x1a5f('0x1'));var BPromise=require(_0x1a5f('0x2'));var rs=require(_0x1a5f('0x3'));var fs=require('fs');var Redis=require(_0x1a5f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a5f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1a5f('0x6'));var client=jayson[_0x1a5f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ac777,_0x37ceb3,_0x171f0f){return new BPromise(function(_0x2c9295,_0x4688f9){return client[_0x1a5f('0x8')](_0x3ac777,_0x171f0f)[_0x1a5f('0x9')](function(_0x1e7147){logger['info'](_0x1a5f('0xa'),_0x37ceb3,_0x1a5f('0xb'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x37ceb3,_0x1a5f('0xb'),JSON[_0x1a5f('0xc')](_0x1e7147));if(_0x1e7147['error']){if(_0x1e7147[_0x1a5f('0xd')][_0x1a5f('0xe')]===0x1f4){logger[_0x1a5f('0xd')](_0x1a5f('0xa'),_0x37ceb3,_0x1e7147['error']['message']);return _0x4688f9(_0x1e7147[_0x1a5f('0xd')][_0x1a5f('0xf')]);}logger[_0x1a5f('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x37ceb3,_0x1e7147[_0x1a5f('0xd')]['message']);return _0x2c9295(_0x1e7147[_0x1a5f('0xd')][_0x1a5f('0xf')]);}else{logger[_0x1a5f('0x10')](_0x1a5f('0xa'),_0x37ceb3,_0x1a5f('0xb'));_0x2c9295(_0x1e7147[_0x1a5f('0x11')][_0x1a5f('0xf')]);}})[_0x1a5f('0x12')](function(_0x3302d4){logger[_0x1a5f('0xd')](_0x1a5f('0xa'),_0x37ceb3,_0x3302d4);_0x4688f9(_0x3302d4);});});} \ No newline at end of file +var _0x6ed7=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x6ed7,0x148));var _0x76ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ed7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x76ed('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76ed('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x76ed('0x3'))(_0x76ed('0x4'));var config=require(_0x76ed('0x5'));var jayson=require(_0x76ed('0x6'));var client=jayson['client'][_0x76ed('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cab9c,_0x367dff,_0x3a2ec3){return new BPromise(function(_0x2d2e9d,_0x335e6f){return client[_0x76ed('0x8')](_0x1cab9c,_0x3a2ec3)[_0x76ed('0x9')](function(_0x4c5cc7){logger['info'](_0x76ed('0xa'),_0x367dff,_0x76ed('0xb'));logger[_0x76ed('0xc')](_0x76ed('0xd'),_0x367dff,_0x76ed('0xb'),JSON[_0x76ed('0xe')](_0x4c5cc7));if(_0x4c5cc7[_0x76ed('0xf')]){if(_0x4c5cc7[_0x76ed('0xf')][_0x76ed('0x10')]===0x1f4){logger[_0x76ed('0xf')](_0x76ed('0xa'),_0x367dff,_0x4c5cc7[_0x76ed('0xf')][_0x76ed('0x11')]);return _0x335e6f(_0x4c5cc7[_0x76ed('0xf')][_0x76ed('0x11')]);}logger[_0x76ed('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x367dff,_0x4c5cc7['error'][_0x76ed('0x11')]);return _0x2d2e9d(_0x4c5cc7[_0x76ed('0xf')][_0x76ed('0x11')]);}else{logger[_0x76ed('0x12')](_0x76ed('0xa'),_0x367dff,_0x76ed('0xb'));_0x2d2e9d(_0x4c5cc7['result'][_0x76ed('0x11')]);}})[_0x76ed('0x13')](function(_0x285f8f){logger[_0x76ed('0xf')](_0x76ed('0xa'),_0x367dff,_0x285f8f);_0x335e6f(_0x285f8f);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 86dfe2a..97aa450 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 _0x31f0=['update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x31f0,0xb7));var _0x031f=function(_0x258d2a,_0x227588){_0x258d2a=_0x258d2a-0x0;var _0x48aad5=_0x31f0[_0x258d2a];return _0x48aad5;};'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 fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x031f('0x8')]('/describe',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0x8')](_0x031f('0xb'),auth['isAuthenticated'](),controller[_0x031f('0xc')]);router[_0x031f('0x8')](_0x031f('0xd'),auth[_0x031f('0x9')](),controller[_0x031f('0xe')]);router[_0x031f('0xf')]('/',auth[_0x031f('0x9')](),controller[_0x031f('0x10')]);router['put'](_0x031f('0xb'),auth[_0x031f('0x9')](),controller[_0x031f('0x11')]);router[_0x031f('0x12')](_0x031f('0xb'),auth[_0x031f('0x9')](),controller[_0x031f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1cb9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3466d9,_0x1fa476){_0x3466d9=_0x3466d9-0x0;var _0x5ac5c2=_0x1cb9[_0x3466d9];return _0x5ac5c2;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);router[_0x91cb('0x15')]('/:id',auth[_0x91cb('0x9')](),controller[_0x91cb('0x16')]);module[_0x91cb('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index e564049..c523ada 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 _0xbda9=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue'];(function(_0x741a7b,_0x5cb899){var _0x43a8e6=function(_0x3a3aa3){while(--_0x3a3aa3){_0x741a7b['push'](_0x741a7b['shift']());}};_0x43a8e6(++_0x5cb899);}(_0xbda9,0x92));var _0x9bda=function(_0x2ed537,_0x11d131){_0x2ed537=_0x2ed537-0x0;var _0x3f6ac8=_0xbda9[_0x2ed537];return _0x3f6ac8;};'use strict';var moment=require('moment');var Sequelize=require(_0x9bda('0x0'));module[_0x9bda('0x1')]={'starttime':{'type':Sequelize[_0x9bda('0x2')],'set':function(_0x3e362e){this[_0x9bda('0x3')](_0x9bda('0x4'),_0x3e362e);this['setDataValue'](_0x9bda('0x5'),moment()[_0x9bda('0x6')](_0x9bda('0x7')));}},'endtime':{'type':Sequelize[_0x9bda('0x2')]},'membername':{'type':Sequelize[_0x9bda('0x8')]},'projectname':{'type':Sequelize[_0x9bda('0x8')]},'queue':{'type':Sequelize[_0x9bda('0x8')]},'uniqueid':{'type':Sequelize[_0x9bda('0x8')]},'calleridname':{'type':Sequelize[_0x9bda('0x8')]},'calleridnum':{'type':Sequelize[_0x9bda('0x8')]},'completed':{'type':Sequelize[_0x9bda('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xff52=['sequelize','exports','DATE','setDataValue','starttime','format','STRING','BOOLEAN'];(function(_0x48026e,_0x2bb295){var _0x4b42aa=function(_0x42c647){while(--_0x42c647){_0x48026e['push'](_0x48026e['shift']());}};_0x4b42aa(++_0x2bb295);}(_0xff52,0xf0));var _0x2ff5=function(_0x6839e1,_0x424ff0){_0x6839e1=_0x6839e1-0x0;var _0x57cd23=_0xff52[_0x6839e1];return _0x57cd23;};'use strict';var moment=require('moment');var Sequelize=require(_0x2ff5('0x0'));module[_0x2ff5('0x1')]={'starttime':{'type':Sequelize[_0x2ff5('0x2')],'set':function(_0x13f872){this[_0x2ff5('0x3')](_0x2ff5('0x4'),_0x13f872);this['setDataValue']('endtime',moment()[_0x2ff5('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x2ff5('0x2')]},'membername':{'type':Sequelize[_0x2ff5('0x6')]},'projectname':{'type':Sequelize[_0x2ff5('0x6')]},'queue':{'type':Sequelize[_0x2ff5('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2ff5('0x6')]},'calleridnum':{'type':Sequelize[_0x2ff5('0x6')]},'completed':{'type':Sequelize[_0x2ff5('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ef27f6e..b61d23b 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 _0x48cf=['SessionId','includeAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','limit','sort','where','merge','filter','options','rows','catch','show','params','keys','fields','length','include','find','create','body','describe','getQuestions','findOne','hasOwnProperty','nolimit','pick'];(function(_0x9fae2e,_0x2d065e){var _0x4222aa=function(_0x2f223d){while(--_0x2f223d){_0x9fae2e['push'](_0x9fae2e['shift']());}};_0x4222aa(++_0x2d065e);}(_0x48cf,0x183));var _0xf48c=function(_0x3a5a15,_0x542552){_0x3a5a15=_0x3a5a15-0x0;var _0x435e3d=_0x48cf[_0x3a5a15];return _0x435e3d;};'use strict';var pdf=require(_0xf48c('0x0'));var emlformat=require(_0xf48c('0x1'));var rimraf=require(_0xf48c('0x2'));var zipdir=require(_0xf48c('0x3'));var jsonpatch=require(_0xf48c('0x4'));var rp=require('request-promise');var moment=require(_0xf48c('0x5'));var BPromise=require(_0xf48c('0x6'));var Mustache=require(_0xf48c('0x7'));var util=require(_0xf48c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf48c('0x9'));var ejs=require(_0xf48c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf48c('0xb'));var crypto=require('crypto');var jsforce=require(_0xf48c('0xc'));var deskjs=require(_0xf48c('0xd'));var toCsv=require(_0xf48c('0x9'));var querystring=require('querystring');var Papa=require(_0xf48c('0xe'));var Redis=require(_0xf48c('0xf'));var authService=require(_0xf48c('0x10'));var qs=require(_0xf48c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf48c('0x12'));var logger=require(_0xf48c('0x13'))(_0xf48c('0x14'));var utils=require(_0xf48c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf48c('0x16'));var db=require(_0xf48c('0x17'))['db'];function respondWithStatusCode(_0x283a71,_0x3916d0){_0x3916d0=_0x3916d0||0xcc;return function(_0x2071c6){if(_0x2071c6){return _0x283a71['sendStatus'](_0x3916d0);}return _0x283a71[_0xf48c('0x18')](_0x3916d0)[_0xf48c('0x19')]();};}function respondWithResult(_0x3c29d4,_0x1580dc){_0x1580dc=_0x1580dc||0xc8;return function(_0x1d5cf8){if(_0x1d5cf8){return _0x3c29d4[_0xf48c('0x18')](_0x1580dc)[_0xf48c('0x1a')](_0x1d5cf8);}};}function respondWithFilteredResult(_0x18b884,_0xb17c42){return function(_0x23b193){if(_0x23b193){var _0x21f22e=_0x23b193[_0xf48c('0x1b')],_0x494cb7=_0xb17c42[_0xf48c('0x1c')],_0x5e954d=_0xb17c42[_0xf48c('0x1c')]+_0xb17c42['limit'],_0xc86aa0;if(_0x5e954d>=_0x21f22e){_0x5e954d=_0x21f22e;_0xc86aa0=0xc8;}else{_0xc86aa0=0xce;}_0x18b884[_0xf48c('0x18')](_0xc86aa0);return _0x18b884[_0xf48c('0x1d')](_0xf48c('0x1e'),_0x494cb7+'-'+_0x5e954d+'/'+_0x21f22e)[_0xf48c('0x1a')](_0x23b193);}return null;};}function patchUpdates(_0x2001bc){return function(_0x372d63){try{jsonpatch[_0xf48c('0x1f')](_0x372d63,_0x2001bc,!![]);}catch(_0x415856){return BPromise[_0xf48c('0x20')](_0x415856);}return _0x372d63[_0xf48c('0x21')]();};}function saveUpdates(_0x150ec4,_0x46a957){return function(_0x57f244){if(_0x57f244){return _0x57f244[_0xf48c('0x22')](_0x150ec4)[_0xf48c('0x23')](function(_0x32d9c8){return _0x32d9c8;});}return null;};}function removeEntity(_0x56e363,_0xe5a32e){return function(_0x141f4a){if(_0x141f4a){return _0x141f4a[_0xf48c('0x24')]()[_0xf48c('0x23')](function(){_0x56e363[_0xf48c('0x18')](0xcc)[_0xf48c('0x19')]();});}};}function handleEntityNotFound(_0x32337f,_0x35a39c){return function(_0x52d902){if(!_0x52d902){_0x32337f[_0xf48c('0x25')](0x194);}return _0x52d902;};}function handleError(_0x3655ab,_0x5b24b2){_0x5b24b2=_0x5b24b2||0x1f4;return function(_0x1bd14d){logger['error'](_0x1bd14d[_0xf48c('0x26')]);if(_0x1bd14d[_0xf48c('0x27')]){delete _0x1bd14d[_0xf48c('0x27')];}_0x3655ab[_0xf48c('0x18')](_0x5b24b2)[_0xf48c('0x28')](_0x1bd14d);};}exports['index']=function(_0x2dceca,_0x5b39ab){var _0x48fbb2={},_0x4bfe85={},_0x123514={'count':0x0,'rows':[]};var _0x3010f4=_['map'](db[_0xf48c('0x29')][_0xf48c('0x2a')],function(_0x238673){return{'name':_0x238673[_0xf48c('0x2b')],'type':_0x238673[_0xf48c('0x2c')][_0xf48c('0x2d')]};});_0x4bfe85[_0xf48c('0x2e')]=_[_0xf48c('0x2f')](_0x3010f4,_0xf48c('0x27'));_0x4bfe85[_0xf48c('0x30')]=_['keys'](_0x2dceca[_0xf48c('0x30')]);_0x4bfe85[_0xf48c('0x31')]=_[_0xf48c('0x32')](_0x4bfe85[_0xf48c('0x2e')],_0x4bfe85[_0xf48c('0x30')]);_0x48fbb2[_0xf48c('0x33')]=_[_0xf48c('0x32')](_0x4bfe85[_0xf48c('0x2e')],qs['fields'](_0x2dceca[_0xf48c('0x30')]['fields']));_0x48fbb2['attributes']=_0x48fbb2['attributes']['length']?_0x48fbb2[_0xf48c('0x33')]:_0x4bfe85[_0xf48c('0x2e')];if(!_0x2dceca[_0xf48c('0x30')]['hasOwnProperty']('nolimit')){_0x48fbb2[_0xf48c('0x34')]=qs['limit'](_0x2dceca[_0xf48c('0x30')][_0xf48c('0x34')]);_0x48fbb2[_0xf48c('0x1c')]=qs['offset'](_0x2dceca['query'][_0xf48c('0x1c')]);}_0x48fbb2['order']=qs['sort'](_0x2dceca[_0xf48c('0x30')][_0xf48c('0x35')]);_0x48fbb2[_0xf48c('0x36')]=qs[_0xf48c('0x31')](_['pick'](_0x2dceca[_0xf48c('0x30')],_0x4bfe85['filters']),_0x3010f4);if(_0x2dceca[_0xf48c('0x30')]['filter']){_0x48fbb2[_0xf48c('0x36')]=_[_0xf48c('0x37')](_0x48fbb2[_0xf48c('0x36')],{'$or':_[_0xf48c('0x2f')](_0x3010f4,function(_0x1fbf42){if(_0x1fbf42[_0xf48c('0x2c')]!=='VIRTUAL'){var _0x4b75be={};_0x4b75be[_0x1fbf42[_0xf48c('0x27')]]={'$like':'%'+_0x2dceca[_0xf48c('0x30')][_0xf48c('0x38')]+'%'};return _0x4b75be;}})});}_0x48fbb2=_[_0xf48c('0x37')]({},_0x48fbb2,_0x2dceca[_0xf48c('0x39')]);var _0x49c820={'where':_0x48fbb2[_0xf48c('0x36')]};return db[_0xf48c('0x29')]['count'](_0x49c820)[_0xf48c('0x23')](function(_0x5043f9){_0x123514[_0xf48c('0x1b')]=_0x5043f9;if(_0x2dceca[_0xf48c('0x30')]['includeAll']){_0x48fbb2['include']=[{'all':!![]}];}return db[_0xf48c('0x29')]['findAll'](_0x48fbb2);})['then'](function(_0x42724){_0x123514[_0xf48c('0x3a')]=_0x42724;return _0x123514;})['then'](respondWithFilteredResult(_0x5b39ab,_0x48fbb2))[_0xf48c('0x3b')](handleError(_0x5b39ab,null));};exports[_0xf48c('0x3c')]=function(_0x1db3db,_0x215314){var _0x42c768={'raw':!![],'where':{'id':_0x1db3db[_0xf48c('0x3d')]['id']}},_0x58c356={};_0x58c356[_0xf48c('0x2e')]=_[_0xf48c('0x3e')](db[_0xf48c('0x29')][_0xf48c('0x2a')]);_0x58c356[_0xf48c('0x30')]=_[_0xf48c('0x3e')](_0x1db3db[_0xf48c('0x30')]);_0x58c356['filters']=_['intersection'](_0x58c356[_0xf48c('0x2e')],_0x58c356[_0xf48c('0x30')]);_0x42c768[_0xf48c('0x33')]=_[_0xf48c('0x32')](_0x58c356[_0xf48c('0x2e')],qs[_0xf48c('0x3f')](_0x1db3db[_0xf48c('0x30')][_0xf48c('0x3f')]));_0x42c768[_0xf48c('0x33')]=_0x42c768['attributes'][_0xf48c('0x40')]?_0x42c768['attributes']:_0x58c356[_0xf48c('0x2e')];if(_0x1db3db[_0xf48c('0x30')]['includeAll']){_0x42c768[_0xf48c('0x41')]=[{'all':!![]}];}_0x42c768=_['merge']({},_0x42c768,_0x1db3db[_0xf48c('0x39')]);return db['JscriptySessionReport'][_0xf48c('0x42')](_0x42c768)[_0xf48c('0x23')](handleEntityNotFound(_0x215314,null))[_0xf48c('0x23')](respondWithResult(_0x215314,null))[_0xf48c('0x3b')](handleError(_0x215314,null));};exports[_0xf48c('0x43')]=function(_0x3bb0db,_0x331bbc){return db['JscriptySessionReport'][_0xf48c('0x43')](_0x3bb0db[_0xf48c('0x44')],{})['then'](respondWithResult(_0x331bbc,0xc9))[_0xf48c('0x3b')](handleError(_0x331bbc,null));};exports[_0xf48c('0x22')]=function(_0x37ce50,_0x3087b1){if(_0x37ce50[_0xf48c('0x44')]['id']){delete _0x37ce50[_0xf48c('0x44')]['id'];}return db[_0xf48c('0x29')]['find']({'where':{'id':_0x37ce50['params']['id']}})['then'](handleEntityNotFound(_0x3087b1,null))[_0xf48c('0x23')](saveUpdates(_0x37ce50['body'],null))[_0xf48c('0x23')](respondWithResult(_0x3087b1,null))['catch'](handleError(_0x3087b1,null));};exports['destroy']=function(_0x6787de,_0x4b7754){return db[_0xf48c('0x29')][_0xf48c('0x42')]({'where':{'id':_0x6787de['params']['id']}})[_0xf48c('0x23')](handleEntityNotFound(_0x4b7754,null))['then'](removeEntity(_0x4b7754,null))[_0xf48c('0x3b')](handleError(_0x4b7754,null));};exports[_0xf48c('0x45')]=function(_0x45422b,_0x446cd1){return db[_0xf48c('0x29')][_0xf48c('0x45')]()[_0xf48c('0x23')](respondWithResult(_0x446cd1,null))['catch'](handleError(_0x446cd1,null));};exports[_0xf48c('0x46')]=function(_0x5e5466,_0x26e4fb,_0x57d912){var _0x443a35={'raw':!![],'where':{}};var _0x5147c9={};var _0x117c8e={'count':0x0,'rows':[]};return db[_0xf48c('0x29')][_0xf48c('0x47')]({'where':{'id':_0x5e5466[_0xf48c('0x3d')]['id']}})[_0xf48c('0x23')](handleEntityNotFound(_0x26e4fb,null))['then'](function(_0x29f14e){if(_0x29f14e){_0x5147c9[_0xf48c('0x2e')]=_['keys'](db['JscriptyQuestionReport'][_0xf48c('0x2a')]);_0x5147c9[_0xf48c('0x30')]=_[_0xf48c('0x3e')](_0x5e5466[_0xf48c('0x30')]);_0x5147c9[_0xf48c('0x31')]=_['intersection'](_0x5147c9[_0xf48c('0x2e')],_0x5147c9[_0xf48c('0x30')]);_0x443a35[_0xf48c('0x33')]=_[_0xf48c('0x32')](_0x5147c9[_0xf48c('0x2e')],qs[_0xf48c('0x3f')](_0x5e5466[_0xf48c('0x30')][_0xf48c('0x3f')]));_0x443a35['attributes']=_0x443a35[_0xf48c('0x33')][_0xf48c('0x40')]?_0x443a35[_0xf48c('0x33')]:_0x5147c9[_0xf48c('0x2e')];if(!_0x5e5466['query'][_0xf48c('0x48')](_0xf48c('0x49'))){_0x443a35['limit']=qs[_0xf48c('0x34')](_0x5e5466[_0xf48c('0x30')][_0xf48c('0x34')]);_0x443a35[_0xf48c('0x1c')]=qs['offset'](_0x5e5466[_0xf48c('0x30')][_0xf48c('0x1c')]);}_0x443a35['order']=qs[_0xf48c('0x35')](_0x5e5466['query'][_0xf48c('0x35')]);_0x443a35[_0xf48c('0x36')]=qs[_0xf48c('0x31')](_[_0xf48c('0x4a')](_0x5e5466[_0xf48c('0x30')],_0x5147c9[_0xf48c('0x31')]));_0x443a35[_0xf48c('0x36')][_0xf48c('0x4b')]=_0x29f14e['id'];if(_0x5e5466['query'][_0xf48c('0x38')]){_0x443a35[_0xf48c('0x36')]=_['merge'](_0x443a35[_0xf48c('0x36')],{'$or':_[_0xf48c('0x2f')](_0x443a35[_0xf48c('0x33')],function(_0x2f737d){var _0x155daa={};_0x155daa[_0x2f737d]={'$like':'%'+_0x5e5466[_0xf48c('0x30')][_0xf48c('0x38')]+'%'};return _0x155daa;})});}_0x443a35=_['merge']({},_0x443a35,_0x5e5466[_0xf48c('0x39')]);return db['JscriptyQuestionReport']['count']({'where':_0x443a35['where']})[_0xf48c('0x23')](function(_0x1dfb9c){_0x117c8e[_0xf48c('0x1b')]=_0x1dfb9c;if(_0x5e5466[_0xf48c('0x30')][_0xf48c('0x4c')]){_0x443a35[_0xf48c('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x443a35);})[_0xf48c('0x23')](function(_0xfdf7e5){_0x117c8e[_0xf48c('0x3a')]=_0xfdf7e5;return _0x117c8e;});}})[_0xf48c('0x23')](respondWithFilteredResult(_0x26e4fb,_0x443a35))[_0xf48c('0x3b')](handleError(_0x26e4fb,null));}; \ No newline at end of file +var _0x01e0=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','show','params','keys','includeAll','include','options','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','pick','SessionId','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x01e0,0xdc));var _0x001e=function(_0xe6ba3b,_0x58e953){_0xe6ba3b=_0xe6ba3b-0x0;var _0x19adbe=_0x01e0[_0xe6ba3b];return _0x19adbe;};'use strict';var pdf=require(_0x001e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x001e('0x1'));var zipdir=require(_0x001e('0x2'));var jsonpatch=require(_0x001e('0x3'));var rp=require(_0x001e('0x4'));var moment=require(_0x001e('0x5'));var BPromise=require(_0x001e('0x6'));var Mustache=require(_0x001e('0x7'));var util=require('util');var path=require('path');var sox=require(_0x001e('0x8'));var csv=require(_0x001e('0x9'));var ejs=require(_0x001e('0xa'));var fs=require('fs');var fs_extra=require(_0x001e('0xb'));var _=require(_0x001e('0xc'));var squel=require(_0x001e('0xd'));var crypto=require(_0x001e('0xe'));var jsforce=require(_0x001e('0xf'));var deskjs=require(_0x001e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x001e('0x11'));var Papa=require(_0x001e('0x12'));var Redis=require('ioredis');var authService=require(_0x001e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x001e('0x14'))(_0x001e('0x15'));var utils=require(_0x001e('0x16'));var config=require(_0x001e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x001e('0x18'))['db'];function respondWithStatusCode(_0x5ce873,_0x557ac4){_0x557ac4=_0x557ac4||0xcc;return function(_0x42d3fb){if(_0x42d3fb){return _0x5ce873['sendStatus'](_0x557ac4);}return _0x5ce873['status'](_0x557ac4)['end']();};}function respondWithResult(_0x24a2fd,_0x4db06a){_0x4db06a=_0x4db06a||0xc8;return function(_0x400b92){if(_0x400b92){return _0x24a2fd[_0x001e('0x19')](_0x4db06a)[_0x001e('0x1a')](_0x400b92);}};}function respondWithFilteredResult(_0x1a8b7a,_0x53e170){return function(_0x1d352f){if(_0x1d352f){var _0x4343ea=_0x1d352f[_0x001e('0x1b')],_0x234c6c=_0x53e170[_0x001e('0x1c')],_0x287e9b=_0x53e170[_0x001e('0x1c')]+_0x53e170[_0x001e('0x1d')],_0x4c9e46;if(_0x287e9b>=_0x4343ea){_0x287e9b=_0x4343ea;_0x4c9e46=0xc8;}else{_0x4c9e46=0xce;}_0x1a8b7a['status'](_0x4c9e46);return _0x1a8b7a['set'](_0x001e('0x1e'),_0x234c6c+'-'+_0x287e9b+'/'+_0x4343ea)[_0x001e('0x1a')](_0x1d352f);}return null;};}function patchUpdates(_0x3497c0){return function(_0x43d8b7){try{jsonpatch[_0x001e('0x1f')](_0x43d8b7,_0x3497c0,!![]);}catch(_0x2a4048){return BPromise['reject'](_0x2a4048);}return _0x43d8b7[_0x001e('0x20')]();};}function saveUpdates(_0x3b069d,_0x11482a){return function(_0x298f31){if(_0x298f31){return _0x298f31[_0x001e('0x21')](_0x3b069d)[_0x001e('0x22')](function(_0x55d997){return _0x55d997;});}return null;};}function removeEntity(_0x4eaa29,_0x1c3a8a){return function(_0x2b59ca){if(_0x2b59ca){return _0x2b59ca[_0x001e('0x23')]()['then'](function(){_0x4eaa29[_0x001e('0x19')](0xcc)[_0x001e('0x24')]();});}};}function handleEntityNotFound(_0x54e60,_0x11fbb7){return function(_0x4c3b73){if(!_0x4c3b73){_0x54e60[_0x001e('0x25')](0x194);}return _0x4c3b73;};}function handleError(_0x58e67f,_0x1a1771){_0x1a1771=_0x1a1771||0x1f4;return function(_0x55d4fb){logger[_0x001e('0x26')](_0x55d4fb[_0x001e('0x27')]);if(_0x55d4fb['name']){delete _0x55d4fb[_0x001e('0x28')];}_0x58e67f['status'](_0x1a1771)[_0x001e('0x29')](_0x55d4fb);};}exports[_0x001e('0x2a')]=function(_0x2bde95,_0x161d02){var _0x53c7cc={},_0x351a1e={},_0x16b177={'count':0x0,'rows':[]};var _0x690e38=_[_0x001e('0x2b')](db[_0x001e('0x2c')][_0x001e('0x2d')],function(_0x45b69f){return{'name':_0x45b69f[_0x001e('0x2e')],'type':_0x45b69f[_0x001e('0x2f')]['key']};});_0x351a1e[_0x001e('0x30')]=_[_0x001e('0x2b')](_0x690e38,'name');_0x351a1e['query']=_['keys'](_0x2bde95[_0x001e('0x31')]);_0x351a1e[_0x001e('0x32')]=_[_0x001e('0x33')](_0x351a1e[_0x001e('0x30')],_0x351a1e[_0x001e('0x31')]);_0x53c7cc['attributes']=_[_0x001e('0x33')](_0x351a1e[_0x001e('0x30')],qs[_0x001e('0x34')](_0x2bde95[_0x001e('0x31')][_0x001e('0x34')]));_0x53c7cc[_0x001e('0x35')]=_0x53c7cc[_0x001e('0x35')][_0x001e('0x36')]?_0x53c7cc[_0x001e('0x35')]:_0x351a1e['model'];if(!_0x2bde95[_0x001e('0x31')][_0x001e('0x37')](_0x001e('0x38'))){_0x53c7cc[_0x001e('0x1d')]=qs['limit'](_0x2bde95[_0x001e('0x31')][_0x001e('0x1d')]);_0x53c7cc['offset']=qs['offset'](_0x2bde95[_0x001e('0x31')][_0x001e('0x1c')]);}_0x53c7cc[_0x001e('0x39')]=qs[_0x001e('0x3a')](_0x2bde95[_0x001e('0x31')][_0x001e('0x3a')]);_0x53c7cc[_0x001e('0x3b')]=qs[_0x001e('0x32')](_['pick'](_0x2bde95[_0x001e('0x31')],_0x351a1e[_0x001e('0x32')]),_0x690e38);if(_0x2bde95[_0x001e('0x31')][_0x001e('0x3c')]){_0x53c7cc[_0x001e('0x3b')]=_[_0x001e('0x3d')](_0x53c7cc['where'],{'$or':_[_0x001e('0x2b')](_0x690e38,function(_0x20a04b){if(_0x20a04b[_0x001e('0x2f')]!==_0x001e('0x3e')){var _0x230602={};_0x230602[_0x20a04b[_0x001e('0x28')]]={'$like':'%'+_0x2bde95[_0x001e('0x31')][_0x001e('0x3c')]+'%'};return _0x230602;}})});}_0x53c7cc=_[_0x001e('0x3d')]({},_0x53c7cc,_0x2bde95['options']);var _0x34f0bb={'where':_0x53c7cc['where']};return db[_0x001e('0x2c')][_0x001e('0x1b')](_0x34f0bb)[_0x001e('0x22')](function(_0x3fa37a){_0x16b177[_0x001e('0x1b')]=_0x3fa37a;if(_0x2bde95[_0x001e('0x31')]['includeAll']){_0x53c7cc['include']=[{'all':!![]}];}return db[_0x001e('0x2c')][_0x001e('0x3f')](_0x53c7cc);})[_0x001e('0x22')](function(_0x494a52){_0x16b177[_0x001e('0x40')]=_0x494a52;return _0x16b177;})[_0x001e('0x22')](respondWithFilteredResult(_0x161d02,_0x53c7cc))['catch'](handleError(_0x161d02,null));};exports[_0x001e('0x41')]=function(_0x5e13ce,_0x38bb22){var _0x2de2ab={'raw':!![],'where':{'id':_0x5e13ce[_0x001e('0x42')]['id']}},_0x29f0fb={};_0x29f0fb[_0x001e('0x30')]=_[_0x001e('0x43')](db[_0x001e('0x2c')][_0x001e('0x2d')]);_0x29f0fb['query']=_['keys'](_0x5e13ce[_0x001e('0x31')]);_0x29f0fb[_0x001e('0x32')]=_[_0x001e('0x33')](_0x29f0fb['model'],_0x29f0fb[_0x001e('0x31')]);_0x2de2ab[_0x001e('0x35')]=_[_0x001e('0x33')](_0x29f0fb[_0x001e('0x30')],qs[_0x001e('0x34')](_0x5e13ce[_0x001e('0x31')][_0x001e('0x34')]));_0x2de2ab[_0x001e('0x35')]=_0x2de2ab[_0x001e('0x35')][_0x001e('0x36')]?_0x2de2ab[_0x001e('0x35')]:_0x29f0fb[_0x001e('0x30')];if(_0x5e13ce[_0x001e('0x31')][_0x001e('0x44')]){_0x2de2ab[_0x001e('0x45')]=[{'all':!![]}];}_0x2de2ab=_[_0x001e('0x3d')]({},_0x2de2ab,_0x5e13ce[_0x001e('0x46')]);return db[_0x001e('0x2c')][_0x001e('0x47')](_0x2de2ab)[_0x001e('0x22')](handleEntityNotFound(_0x38bb22,null))[_0x001e('0x22')](respondWithResult(_0x38bb22,null))[_0x001e('0x48')](handleError(_0x38bb22,null));};exports[_0x001e('0x49')]=function(_0x42e602,_0x392564){return db['JscriptySessionReport'][_0x001e('0x49')](_0x42e602[_0x001e('0x4a')],{})[_0x001e('0x22')](respondWithResult(_0x392564,0xc9))[_0x001e('0x48')](handleError(_0x392564,null));};exports[_0x001e('0x21')]=function(_0x281b45,_0x4934c1){if(_0x281b45[_0x001e('0x4a')]['id']){delete _0x281b45[_0x001e('0x4a')]['id'];}return db[_0x001e('0x2c')][_0x001e('0x47')]({'where':{'id':_0x281b45[_0x001e('0x42')]['id']}})[_0x001e('0x22')](handleEntityNotFound(_0x4934c1,null))['then'](saveUpdates(_0x281b45[_0x001e('0x4a')],null))[_0x001e('0x22')](respondWithResult(_0x4934c1,null))[_0x001e('0x48')](handleError(_0x4934c1,null));};exports[_0x001e('0x23')]=function(_0x73d8e0,_0x4009f2){return db[_0x001e('0x2c')]['find']({'where':{'id':_0x73d8e0[_0x001e('0x42')]['id']}})[_0x001e('0x22')](handleEntityNotFound(_0x4009f2,null))[_0x001e('0x22')](removeEntity(_0x4009f2,null))[_0x001e('0x48')](handleError(_0x4009f2,null));};exports[_0x001e('0x4b')]=function(_0x31045b,_0x55e15f){return db[_0x001e('0x2c')]['describe']()[_0x001e('0x22')](respondWithResult(_0x55e15f,null))[_0x001e('0x48')](handleError(_0x55e15f,null));};exports[_0x001e('0x4c')]=function(_0xb818bc,_0x2117e2,_0x6fa1db){var _0x16828a={'raw':!![],'where':{}};var _0x348431={};var _0x1d2916={'count':0x0,'rows':[]};return db[_0x001e('0x2c')]['findOne']({'where':{'id':_0xb818bc[_0x001e('0x42')]['id']}})[_0x001e('0x22')](handleEntityNotFound(_0x2117e2,null))[_0x001e('0x22')](function(_0x40c90b){if(_0x40c90b){_0x348431[_0x001e('0x30')]=_[_0x001e('0x43')](db[_0x001e('0x4d')][_0x001e('0x2d')]);_0x348431[_0x001e('0x31')]=_['keys'](_0xb818bc[_0x001e('0x31')]);_0x348431[_0x001e('0x32')]=_[_0x001e('0x33')](_0x348431['model'],_0x348431[_0x001e('0x31')]);_0x16828a[_0x001e('0x35')]=_[_0x001e('0x33')](_0x348431['model'],qs[_0x001e('0x34')](_0xb818bc[_0x001e('0x31')][_0x001e('0x34')]));_0x16828a[_0x001e('0x35')]=_0x16828a[_0x001e('0x35')][_0x001e('0x36')]?_0x16828a[_0x001e('0x35')]:_0x348431[_0x001e('0x30')];if(!_0xb818bc[_0x001e('0x31')]['hasOwnProperty'](_0x001e('0x38'))){_0x16828a[_0x001e('0x1d')]=qs[_0x001e('0x1d')](_0xb818bc[_0x001e('0x31')]['limit']);_0x16828a['offset']=qs[_0x001e('0x1c')](_0xb818bc[_0x001e('0x31')][_0x001e('0x1c')]);}_0x16828a[_0x001e('0x39')]=qs[_0x001e('0x3a')](_0xb818bc[_0x001e('0x31')][_0x001e('0x3a')]);_0x16828a[_0x001e('0x3b')]=qs[_0x001e('0x32')](_[_0x001e('0x4e')](_0xb818bc[_0x001e('0x31')],_0x348431[_0x001e('0x32')]));_0x16828a[_0x001e('0x3b')][_0x001e('0x4f')]=_0x40c90b['id'];if(_0xb818bc[_0x001e('0x31')][_0x001e('0x3c')]){_0x16828a['where']=_[_0x001e('0x3d')](_0x16828a[_0x001e('0x3b')],{'$or':_[_0x001e('0x2b')](_0x16828a[_0x001e('0x35')],function(_0x306ce5){var _0x5a64df={};_0x5a64df[_0x306ce5]={'$like':'%'+_0xb818bc[_0x001e('0x31')][_0x001e('0x3c')]+'%'};return _0x5a64df;})});}_0x16828a=_[_0x001e('0x3d')]({},_0x16828a,_0xb818bc[_0x001e('0x46')]);return db[_0x001e('0x4d')][_0x001e('0x1b')]({'where':_0x16828a['where']})['then'](function(_0x4bf760){_0x1d2916[_0x001e('0x1b')]=_0x4bf760;if(_0xb818bc[_0x001e('0x31')][_0x001e('0x44')]){_0x16828a[_0x001e('0x45')]=[{'all':!![]}];}return db[_0x001e('0x4d')]['findAll'](_0x16828a);})[_0x001e('0x22')](function(_0x225ba9){_0x1d2916[_0x001e('0x40')]=_0x225ba9;return _0x1d2916;});}})['then'](respondWithFilteredResult(_0x2117e2,_0x16828a))['catch'](handleError(_0x2117e2,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a1f916a..1d5ffb6 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 _0x95fc=['path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x334603,_0x44f4ca){var _0xf2530c=function(_0x365137){while(--_0x365137){_0x334603['push'](_0x334603['shift']());}};_0xf2530c(++_0x44f4ca);}(_0x95fc,0x96));var _0xc95f=function(_0x1801f5,_0x3ba9a5){_0x1801f5=_0x1801f5-0x0;var _0x480316=_0x95fc[_0x1801f5];return _0x480316;};'use strict';var _=require(_0xc95f('0x0'));var util=require(_0xc95f('0x1'));var logger=require(_0xc95f('0x2'))(_0xc95f('0x3'));var moment=require('moment');var BPromise=require(_0xc95f('0x4'));var rp=require(_0xc95f('0x5'));var fs=require('fs');var path=require(_0xc95f('0x6'));var rimraf=require(_0xc95f('0x7'));var config=require('../../config/environment');var attributes=require(_0xc95f('0x8'));module[_0xc95f('0x9')]=function(_0x2a887b,_0x512bd3){return _0x2a887b[_0xc95f('0xa')](_0xc95f('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x017a=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x39868e,_0x4b6da9){var _0x4eadec=function(_0x2f993c){while(--_0x2f993c){_0x39868e['push'](_0x39868e['shift']());}};_0x4eadec(++_0x4b6da9);}(_0x017a,0x1b5));var _0xa017=function(_0x25d6c3,_0x526269){_0x25d6c3=_0x25d6c3-0x0;var _0x168a5d=_0x017a[_0x25d6c3];return _0x168a5d;};'use strict';var _=require(_0xa017('0x0'));var util=require(_0xa017('0x1'));var logger=require(_0xa017('0x2'))(_0xa017('0x3'));var moment=require(_0xa017('0x4'));var BPromise=require(_0xa017('0x5'));var rp=require(_0xa017('0x6'));var fs=require('fs');var path=require(_0xa017('0x7'));var rimraf=require(_0xa017('0x8'));var config=require(_0xa017('0x9'));var attributes=require(_0xa017('0xa'));module['exports']=function(_0x2fe021,_0x3827bf){return _0x2fe021[_0xa017('0xb')](_0xa017('0xc'),attributes,{'tableName':_0xa017('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 585ae51..9fcadd1 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 _0x3436=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3436,0x1b6));var _0x6343=function(_0x3f6d47,_0x47cc3e){_0x3f6d47=_0x3f6d47-0x0;var _0x101a18=_0x3436[_0x3f6d47];return _0x101a18;};'use strict';var _=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var moment=require(_0x6343('0x2'));var BPromise=require(_0x6343('0x3'));var rs=require(_0x6343('0x4'));var fs=require('fs');var Redis=require(_0x6343('0x5'));var db=require(_0x6343('0x6'))['db'];var utils=require(_0x6343('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6343('0x8'));var jayson=require(_0x6343('0x9'));var client=jayson['client'][_0x6343('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16d117,_0x2f658e,_0x313ee5){return new BPromise(function(_0x1832bd,_0xf57b31){return client[_0x6343('0xb')](_0x16d117,_0x313ee5)[_0x6343('0xc')](function(_0x15ef6e){logger[_0x6343('0xd')](_0x6343('0xe'),_0x2f658e,_0x6343('0xf'));logger[_0x6343('0x10')](_0x6343('0x11'),_0x2f658e,_0x6343('0xf'),JSON[_0x6343('0x12')](_0x15ef6e));if(_0x15ef6e[_0x6343('0x13')]){if(_0x15ef6e[_0x6343('0x13')][_0x6343('0x14')]===0x1f4){logger[_0x6343('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f658e,_0x15ef6e['error'][_0x6343('0x15')]);return _0xf57b31(_0x15ef6e[_0x6343('0x13')]['message']);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2f658e,_0x15ef6e[_0x6343('0x13')][_0x6343('0x15')]);return _0x1832bd(_0x15ef6e[_0x6343('0x13')][_0x6343('0x15')]);}else{logger[_0x6343('0xd')](_0x6343('0xe'),_0x2f658e,_0x6343('0xf'));_0x1832bd(_0x15ef6e[_0x6343('0x16')][_0x6343('0x15')]);}})[_0x6343('0x17')](function(_0x50989e){logger[_0x6343('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f658e,_0x50989e);_0xf57b31(_0x50989e);});});} \ No newline at end of file +var _0xa7b5=['../../config/utils','../../config/logger','jayson/promise','client','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5de97d,_0x1141ee){var _0x2da950=function(_0xd74837){while(--_0xd74837){_0x5de97d['push'](_0x5de97d['shift']());}};_0x2da950(++_0x1141ee);}(_0xa7b5,0x162));var _0x5a7b=function(_0x482f81,_0x50d27a){_0x482f81=_0x482f81-0x0;var _0x361aa9=_0xa7b5[_0x482f81];return _0x361aa9;};'use strict';var _=require(_0x5a7b('0x0'));var util=require(_0x5a7b('0x1'));var moment=require(_0x5a7b('0x2'));var BPromise=require(_0x5a7b('0x3'));var rs=require(_0x5a7b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a7b('0x5'))['db'];var utils=require(_0x5a7b('0x6'));var logger=require(_0x5a7b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5a7b('0x8'));var client=jayson[_0x5a7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38dac6,_0xe45788,_0x390a68){return new BPromise(function(_0x265597,_0x14c477){return client['request'](_0x38dac6,_0x390a68)[_0x5a7b('0xa')](function(_0x59b6df){logger[_0x5a7b('0xb')](_0x5a7b('0xc'),_0xe45788,'request\x20sent');logger[_0x5a7b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0xe45788,_0x5a7b('0xe'),JSON[_0x5a7b('0xf')](_0x59b6df));if(_0x59b6df[_0x5a7b('0x10')]){if(_0x59b6df[_0x5a7b('0x10')]['code']===0x1f4){logger['error'](_0x5a7b('0xc'),_0xe45788,_0x59b6df['error']['message']);return _0x14c477(_0x59b6df[_0x5a7b('0x10')][_0x5a7b('0x11')]);}logger['error'](_0x5a7b('0xc'),_0xe45788,_0x59b6df[_0x5a7b('0x10')][_0x5a7b('0x11')]);return _0x265597(_0x59b6df['error'][_0x5a7b('0x11')]);}else{logger[_0x5a7b('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0xe45788,_0x5a7b('0xe'));_0x265597(_0x59b6df['result'][_0x5a7b('0x11')]);}})['catch'](function(_0x34804c){logger[_0x5a7b('0x10')](_0x5a7b('0xc'),_0xe45788,_0x34804c);_0x14c477(_0x34804c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index e2e2c28..075401a 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 _0x7885=['fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','exports','multer','path','connect-timeout','express','Router'];(function(_0x2dc2d3,_0x175734){var _0x291966=function(_0x1d9bf3){while(--_0x1d9bf3){_0x2dc2d3['push'](_0x2dc2d3['shift']());}};_0x291966(++_0x175734);}(_0x7885,0x1db));var _0x5788=function(_0x474ced,_0xb25add){_0x474ced=_0x474ced-0x0;var _0x550265=_0x7885[_0x474ced];return _0x550265;};'use strict';var multer=require(_0x5788('0x0'));var util=require('util');var path=require(_0x5788('0x1'));var timeout=require(_0x5788('0x2'));var express=require(_0x5788('0x3'));var router=express[_0x5788('0x4')]();var fs_extra=require(_0x5788('0x5'));var auth=require(_0x5788('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5788('0x7'));var controller=require(_0x5788('0x8'));router[_0x5788('0x9')]('/',controller[_0x5788('0xa')]);router['put'](_0x5788('0xb'),auth[_0x5788('0xc')](),controller[_0x5788('0xd')]);module[_0x5788('0xe')]=router; \ No newline at end of file +var _0x595c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','multer'];(function(_0x1385e0,_0x3876d4){var _0x2517b3=function(_0x36208f){while(--_0x36208f){_0x1385e0['push'](_0x1385e0['shift']());}};_0x2517b3(++_0x3876d4);}(_0x595c,0xb3));var _0xc595=function(_0x5d7fb5,_0x5aeacd){_0x5d7fb5=_0x5d7fb5-0x0;var _0x5af126=_0x595c[_0x5d7fb5];return _0x5af126;};'use strict';var multer=require(_0xc595('0x0'));var util=require(_0xc595('0x1'));var path=require(_0xc595('0x2'));var timeout=require(_0xc595('0x3'));var express=require(_0xc595('0x4'));var router=express[_0xc595('0x5')]();var fs_extra=require(_0xc595('0x6'));var auth=require(_0xc595('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc595('0x8'));var controller=require('./license.controller');router[_0xc595('0x9')]('/',controller[_0xc595('0xa')]);router[_0xc595('0xb')](_0xc595('0xc'),auth[_0xc595('0xd')](),controller[_0xc595('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6c2c4a1..ac3928f 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 _0x2675=['sequelize','STRING','INTEGER'];(function(_0x2dc58c,_0x58b769){var _0x1a59bf=function(_0x3e3c43){while(--_0x3e3c43){_0x2dc58c['push'](_0x2dc58c['shift']());}};_0x1a59bf(++_0x58b769);}(_0x2675,0x75));var _0x5267=function(_0x10e906,_0x3d50dc){_0x10e906=_0x10e906-0x0;var _0x4ee8b3=_0x2675[_0x10e906];return _0x4ee8b3;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5267('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5267('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xba34=['STRING','sequelize','exports','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xba34,0x119));var _0x4ba3=function(_0x5c2d23,_0x18db4e){_0x5c2d23=_0x5c2d23-0x0;var _0x2409db=_0xba34[_0x5c2d23];return _0x2409db;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'license':{'type':Sequelize[_0x4ba3('0x2')]},'data1':{'type':Sequelize[_0x4ba3('0x3')]},'data2':{'type':Sequelize[_0x4ba3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 95bb10c..ed71074 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 _0x01db=['getLicense','body','License','find','params','get','checkLicense','key','demo','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','rawAttributes','query','filters','attributes','intersection','fields','options'];(function(_0x335f50,_0x1f2f1a){var _0x5803b6=function(_0x33a0f5){while(--_0x33a0f5){_0x335f50['push'](_0x335f50['shift']());}};_0x5803b6(++_0x1f2f1a);}(_0x01db,0x171));var _0xb01d=function(_0x11c0f6,_0x1f7c81){_0x11c0f6=_0x11c0f6-0x0;var _0x392a9d=_0x01db[_0x11c0f6];return _0x392a9d;};'use strict';var pdf=require(_0xb01d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb01d('0x1'));var jsonpatch=require(_0xb01d('0x2'));var rp=require(_0xb01d('0x3'));var moment=require('moment');var BPromise=require(_0xb01d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb01d('0x5'));var sox=require(_0xb01d('0x6'));var csv=require(_0xb01d('0x7'));var ejs=require(_0xb01d('0x8'));var fs=require('fs');var fs_extra=require(_0xb01d('0x9'));var _=require(_0xb01d('0xa'));var squel=require(_0xb01d('0xb'));var crypto=require(_0xb01d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb01d('0x7'));var querystring=require(_0xb01d('0xd'));var Papa=require(_0xb01d('0xe'));var Redis=require(_0xb01d('0xf'));var authService=require(_0xb01d('0x10'));var qs=require(_0xb01d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb01d('0x12'))(_0xb01d('0x13'));var utils=require(_0xb01d('0x14'));var config=require(_0xb01d('0x15'));var licenseUtil=require(_0xb01d('0x16'));var db=require(_0xb01d('0x17'))['db'];function respondWithStatusCode(_0xbcc293,_0x48b905){_0x48b905=_0x48b905||0xcc;return function(_0x4ae3c4){if(_0x4ae3c4){return _0xbcc293[_0xb01d('0x18')](_0x48b905);}return _0xbcc293['status'](_0x48b905)[_0xb01d('0x19')]();};}function respondWithResult(_0x2e1ec7,_0x4a7641){_0x4a7641=_0x4a7641||0xc8;return function(_0x28ee78){if(_0x28ee78){return _0x2e1ec7[_0xb01d('0x1a')](_0x4a7641)[_0xb01d('0x1b')](_0x28ee78);}};}function respondWithFilteredResult(_0x219327,_0x515789){return function(_0x135604){if(_0x135604){var _0x507930=_0x135604[_0xb01d('0x1c')],_0xd9c0b0=_0x515789['offset'],_0x9a96e=_0x515789[_0xb01d('0x1d')]+_0x515789[_0xb01d('0x1e')],_0x15b165;if(_0x9a96e>=_0x507930){_0x9a96e=_0x507930;_0x15b165=0xc8;}else{_0x15b165=0xce;}_0x219327[_0xb01d('0x1a')](_0x15b165);return _0x219327['set'](_0xb01d('0x1f'),_0xd9c0b0+'-'+_0x9a96e+'/'+_0x507930)['json'](_0x135604);}return null;};}function patchUpdates(_0x42961b){return function(_0x3fd01d){try{jsonpatch[_0xb01d('0x20')](_0x3fd01d,_0x42961b,!![]);}catch(_0x28a6a7){return BPromise[_0xb01d('0x21')](_0x28a6a7);}return _0x3fd01d['save']();};}function saveUpdates(_0x2528ac,_0x34e9fb){return function(_0x149b50){if(_0x149b50){return _0x149b50[_0xb01d('0x22')](_0x2528ac)[_0xb01d('0x23')](function(_0x7de0a2){return _0x7de0a2;});}return null;};}function removeEntity(_0x28f643,_0x42064d){return function(_0x138485){if(_0x138485){return _0x138485[_0xb01d('0x24')]()[_0xb01d('0x23')](function(){_0x28f643[_0xb01d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446824,_0x48dc4c){return function(_0xed76c0){if(!_0xed76c0){_0x446824[_0xb01d('0x18')](0x194);}return _0xed76c0;};}function handleError(_0x17cdf8,_0x3ce3f8){_0x3ce3f8=_0x3ce3f8||0x1f4;return function(_0xf92ae7){logger[_0xb01d('0x25')](_0xf92ae7[_0xb01d('0x26')]);if(_0xf92ae7[_0xb01d('0x27')]){delete _0xf92ae7[_0xb01d('0x27')];}_0x17cdf8[_0xb01d('0x1a')](_0x3ce3f8)[_0xb01d('0x28')](_0xf92ae7);};}var utilLicense=require('../../config/license/util');exports[_0xb01d('0x29')]=function(_0x37e513,_0x1e3141){var _0x483a27={'raw':!![],'where':{'id':0x1}},_0x1cf399={};_0x1cf399[_0xb01d('0x2a')]=_[_0xb01d('0x2b')](db['License'][_0xb01d('0x2c')]);_0x1cf399['query']=_[_0xb01d('0x2b')](_0x37e513[_0xb01d('0x2d')]);_0x1cf399[_0xb01d('0x2e')]=_['intersection'](_0x1cf399[_0xb01d('0x2a')],_0x1cf399[_0xb01d('0x2d')]);_0x483a27[_0xb01d('0x2f')]=_[_0xb01d('0x30')](_0x1cf399[_0xb01d('0x2a')],qs[_0xb01d('0x31')](_0x37e513['query'][_0xb01d('0x31')]));_0x483a27[_0xb01d('0x2f')]=_0x483a27[_0xb01d('0x2f')]['length']?_0x483a27[_0xb01d('0x2f')]:_0x1cf399['model'];_0x483a27=_['merge']({},_0x483a27,_0x37e513[_0xb01d('0x32')]);return utilLicense[_0xb01d('0x33')](_0x483a27)['then'](respondWithResult(_0x1e3141,null))['catch'](handleError(_0x1e3141,null));};exports[_0xb01d('0x22')]=function(_0x16046e,_0x2d0022){if(_0x16046e[_0xb01d('0x34')]['id']){delete _0x16046e[_0xb01d('0x34')]['id'];}return db[_0xb01d('0x35')][_0xb01d('0x36')]({'where':{'id':_0x16046e[_0xb01d('0x37')]['id']}})[_0xb01d('0x23')](handleEntityNotFound(_0x2d0022,null))['then'](function(_0x314fc5){var _0x20bb65=_0x314fc5[_0xb01d('0x38')]({'plain':!![]});return utilLicense[_0xb01d('0x39')](_0x20bb65,_0x16046e['body'][_0xb01d('0x3a')]);})['then'](function(_0x109283){if(!_0x109283[_0xb01d('0x3b')]){return saveUpdates(_0x16046e[_0xb01d('0x34')],null);}return _0x109283;})[_0xb01d('0x23')](respondWithResult(_0x2d0022,null))['catch'](handleError(_0x2d0022,null));}; \ No newline at end of file +var _0xa49e=['json','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range'];(function(_0x2d64e7,_0x53a230){var _0x4f4d44=function(_0x39d4bf){while(--_0x39d4bf){_0x2d64e7['push'](_0x2d64e7['shift']());}};_0x4f4d44(++_0x53a230);}(_0xa49e,0x1de));var _0xea49=function(_0x372129,_0x539547){_0x372129=_0x372129-0x0;var _0x2385b4=_0xa49e[_0x372129];return _0x2385b4;};'use strict';var pdf=require(_0xea49('0x0'));var emlformat=require(_0xea49('0x1'));var rimraf=require(_0xea49('0x2'));var zipdir=require(_0xea49('0x3'));var jsonpatch=require(_0xea49('0x4'));var rp=require(_0xea49('0x5'));var moment=require(_0xea49('0x6'));var BPromise=require(_0xea49('0x7'));var Mustache=require('mustache');var util=require(_0xea49('0x8'));var path=require(_0xea49('0x9'));var sox=require(_0xea49('0xa'));var csv=require('to-csv');var ejs=require(_0xea49('0xb'));var fs=require('fs');var fs_extra=require(_0xea49('0xc'));var _=require(_0xea49('0xd'));var squel=require(_0xea49('0xe'));var crypto=require(_0xea49('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xea49('0x10'));var toCsv=require('to-csv');var querystring=require(_0xea49('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea49('0x12'));var as=require(_0xea49('0x13'));var hardwareService=require(_0xea49('0x14'));var logger=require(_0xea49('0x15'))(_0xea49('0x16'));var utils=require(_0xea49('0x17'));var config=require(_0xea49('0x18'));var licenseUtil=require(_0xea49('0x19'));var db=require(_0xea49('0x1a'))['db'];function respondWithStatusCode(_0xade20,_0x42ba70){_0x42ba70=_0x42ba70||0xcc;return function(_0x5095b6){if(_0x5095b6){return _0xade20[_0xea49('0x1b')](_0x42ba70);}return _0xade20[_0xea49('0x1c')](_0x42ba70)[_0xea49('0x1d')]();};}function respondWithResult(_0x3cc1f8,_0x499800){_0x499800=_0x499800||0xc8;return function(_0x4425a2){if(_0x4425a2){return _0x3cc1f8[_0xea49('0x1c')](_0x499800)['json'](_0x4425a2);}};}function respondWithFilteredResult(_0x21047d,_0x415114){return function(_0x20a73d){if(_0x20a73d){var _0x41a010=_0x20a73d['count'],_0x5265a3=_0x415114[_0xea49('0x1e')],_0x538efa=_0x415114[_0xea49('0x1e')]+_0x415114[_0xea49('0x1f')],_0x427386;if(_0x538efa>=_0x41a010){_0x538efa=_0x41a010;_0x427386=0xc8;}else{_0x427386=0xce;}_0x21047d['status'](_0x427386);return _0x21047d[_0xea49('0x20')](_0xea49('0x21'),_0x5265a3+'-'+_0x538efa+'/'+_0x41a010)[_0xea49('0x22')](_0x20a73d);}return null;};}function patchUpdates(_0x50ffa6){return function(_0x8c7b9e){try{jsonpatch['apply'](_0x8c7b9e,_0x50ffa6,!![]);}catch(_0x162425){return BPromise[_0xea49('0x23')](_0x162425);}return _0x8c7b9e[_0xea49('0x24')]();};}function saveUpdates(_0x23c480,_0x360b0a){return function(_0x291adc){if(_0x291adc){return _0x291adc[_0xea49('0x25')](_0x23c480)[_0xea49('0x26')](function(_0x5f5730){return _0x5f5730;});}return null;};}function removeEntity(_0x9f1fc2,_0x544cbb){return function(_0x3f704f){if(_0x3f704f){return _0x3f704f[_0xea49('0x27')]()[_0xea49('0x26')](function(){_0x9f1fc2[_0xea49('0x1c')](0xcc)[_0xea49('0x1d')]();});}};}function handleEntityNotFound(_0x4b22d8,_0x8bbcc5){return function(_0x16fcb7){if(!_0x16fcb7){_0x4b22d8[_0xea49('0x1b')](0x194);}return _0x16fcb7;};}function handleError(_0x3b25d2,_0xb13981){_0xb13981=_0xb13981||0x1f4;return function(_0x50f2fa){logger[_0xea49('0x28')](_0x50f2fa[_0xea49('0x29')]);if(_0x50f2fa[_0xea49('0x2a')]){delete _0x50f2fa[_0xea49('0x2a')];}_0x3b25d2['status'](_0xb13981)[_0xea49('0x2b')](_0x50f2fa);};}var utilLicense=require(_0xea49('0x19'));exports[_0xea49('0x2c')]=function(_0x180d2b,_0x406332){var _0x4b39a4={'raw':!![],'where':{'id':0x1}},_0x19ba26={};_0x19ba26[_0xea49('0x2d')]=_[_0xea49('0x2e')](db[_0xea49('0x2f')][_0xea49('0x30')]);_0x19ba26[_0xea49('0x31')]=_[_0xea49('0x2e')](_0x180d2b[_0xea49('0x31')]);_0x19ba26[_0xea49('0x32')]=_['intersection'](_0x19ba26['model'],_0x19ba26[_0xea49('0x31')]);_0x4b39a4[_0xea49('0x33')]=_[_0xea49('0x34')](_0x19ba26['model'],qs[_0xea49('0x35')](_0x180d2b['query']['fields']));_0x4b39a4[_0xea49('0x33')]=_0x4b39a4[_0xea49('0x33')]['length']?_0x4b39a4[_0xea49('0x33')]:_0x19ba26['model'];_0x4b39a4=_[_0xea49('0x36')]({},_0x4b39a4,_0x180d2b[_0xea49('0x37')]);return utilLicense[_0xea49('0x38')](_0x4b39a4)['then'](respondWithResult(_0x406332,null))[_0xea49('0x39')](handleError(_0x406332,null));};exports[_0xea49('0x25')]=function(_0x3cf9cc,_0x42894e){if(_0x3cf9cc[_0xea49('0x3a')]['id']){delete _0x3cf9cc[_0xea49('0x3a')]['id'];}return db[_0xea49('0x2f')][_0xea49('0x3b')]({'where':{'id':_0x3cf9cc[_0xea49('0x3c')]['id']}})['then'](handleEntityNotFound(_0x42894e,null))[_0xea49('0x26')](function(_0x40bbeb){var _0x23ab88=_0x40bbeb['get']({'plain':!![]});return utilLicense[_0xea49('0x3d')](_0x23ab88,_0x3cf9cc[_0xea49('0x3a')][_0xea49('0x3e')]);})[_0xea49('0x26')](function(_0x5d771a){if(!_0x5d771a[_0xea49('0x3f')]){return saveUpdates(_0x3cf9cc[_0xea49('0x3a')],null);}return _0x5d771a;})[_0xea49('0x26')](respondWithResult(_0x42894e,null))[_0xea49('0x39')](handleError(_0x42894e,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5f40d3a..fb4158a 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 _0x8a47=['./license.attributes','license','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4ae996,_0x9a27c){var _0x519697=function(_0x481b73){while(--_0x481b73){_0x4ae996['push'](_0x4ae996['shift']());}};_0x519697(++_0x9a27c);}(_0x8a47,0x17e));var _0x78a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a47[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x78a4('0x0'));var util=require(_0x78a4('0x1'));var logger=require(_0x78a4('0x2'))(_0x78a4('0x3'));var moment=require('moment');var BPromise=require(_0x78a4('0x4'));var rp=require(_0x78a4('0x5'));var fs=require('fs');var path=require(_0x78a4('0x6'));var rimraf=require(_0x78a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x78a4('0x8'));module['exports']=function(_0x4184fc,_0x2d7ec3){return _0x4184fc['define']('License',attributes,{'tableName':_0x78a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5ec=['request-promise','path','../../config/environment','exports','define','License','license','lodash','util','../../config/logger','api','bluebird'];(function(_0x2c500b,_0x43f5ee){var _0x3f53d4=function(_0x2e47af){while(--_0x2e47af){_0x2c500b['push'](_0x2c500b['shift']());}};_0x3f53d4(++_0x43f5ee);}(_0xb5ec,0x97));var _0xcb5e=function(_0x5409ce,_0x18e9a7){_0x5409ce=_0x5409ce-0x0;var _0x551d39=_0xb5ec[_0x5409ce];return _0x551d39;};'use strict';var _=require(_0xcb5e('0x0'));var util=require(_0xcb5e('0x1'));var logger=require(_0xcb5e('0x2'))(_0xcb5e('0x3'));var moment=require('moment');var BPromise=require(_0xcb5e('0x4'));var rp=require(_0xcb5e('0x5'));var fs=require('fs');var path=require(_0xcb5e('0x6'));var rimraf=require('rimraf');var config=require(_0xcb5e('0x7'));var attributes=require('./license.attributes');module[_0xcb5e('0x8')]=function(_0xfbd838,_0x38fd3e){return _0xfbd838[_0xcb5e('0x9')](_0xcb5e('0xa'),attributes,{'tableName':_0xcb5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index fa1da90..4c2611f 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 _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x3076bd,_0x5a00f6){var _0x2af920=function(_0x59a17c){while(--_0x59a17c){_0x3076bd['push'](_0x3076bd['shift']());}};_0x2af920(++_0x5a00f6);}(_0x96cc,0x16c));var _0xc96c=function(_0x338fe6,_0x325063){_0x338fe6=_0x338fe6-0x0;var _0x17ed6d=_0x96cc[_0x338fe6];return _0x17ed6d;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('License,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('License,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file +var _0xf69b=['then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x1966ec,_0x3c9668){var _0x4ae09f=function(_0x42d8f2){while(--_0x42d8f2){_0x1966ec['push'](_0x1966ec['shift']());}};_0x4ae09f(++_0x3c9668);}(_0xf69b,0xc8));var _0xbf69=function(_0x306086,_0x494520){_0x306086=_0x306086-0x0;var _0x2f805d=_0xf69b[_0x306086];return _0x2f805d;};'use strict';var _=require('lodash');var util=require(_0xbf69('0x0'));var moment=require('moment');var BPromise=require(_0xbf69('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf69('0x2'));var db=require(_0xbf69('0x3'))['db'];var utils=require(_0xbf69('0x4'));var logger=require('../../config/logger')(_0xbf69('0x5'));var config=require('../../config/environment');var jayson=require(_0xbf69('0x6'));var client=jayson[_0xbf69('0x7')][_0xbf69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x642645,_0x1af327,_0x4e3088){return new BPromise(function(_0x1fec31,_0x3a4504){return client[_0xbf69('0x9')](_0x642645,_0x4e3088)[_0xbf69('0xa')](function(_0x516ebe){logger[_0xbf69('0xb')](_0xbf69('0xc'),_0x1af327,_0xbf69('0xd'));logger['debug'](_0xbf69('0xe'),_0x1af327,_0xbf69('0xd'),JSON[_0xbf69('0xf')](_0x516ebe));if(_0x516ebe[_0xbf69('0x10')]){if(_0x516ebe['error'][_0xbf69('0x11')]===0x1f4){logger[_0xbf69('0x10')](_0xbf69('0xc'),_0x1af327,_0x516ebe[_0xbf69('0x10')][_0xbf69('0x12')]);return _0x3a4504(_0x516ebe['error']['message']);}logger[_0xbf69('0x10')]('License,\x20%s,\x20%s',_0x1af327,_0x516ebe['error']['message']);return _0x1fec31(_0x516ebe[_0xbf69('0x10')][_0xbf69('0x12')]);}else{logger[_0xbf69('0xb')]('License,\x20%s,\x20%s',_0x1af327,_0xbf69('0xd'));_0x1fec31(_0x516ebe[_0xbf69('0x13')][_0xbf69('0x12')]);}})[_0xbf69('0x14')](function(_0x45312f){logger[_0xbf69('0x10')](_0xbf69('0xc'),_0x1af327,_0x45312f);_0x3a4504(_0x45312f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1901495..6a11b9c 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 _0xb7d1=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addInteraction','addApplications','/:id/send','addAgents','put','update','removeDispositions','delete','removeImap','removeSmtp','multer','util','path','connect-timeout','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xb7d1,0x79));var _0x1b7d=function(_0x42c126,_0x1fdb0c){_0x42c126=_0x42c126-0x0;var _0x5db17d=_0xb7d1[_0x42c126];return _0x5db17d;};'use strict';var multer=require(_0x1b7d('0x0'));var util=require(_0x1b7d('0x1'));var path=require(_0x1b7d('0x2'));var timeout=require(_0x1b7d('0x3'));var express=require(_0x1b7d('0x4'));var router=express[_0x1b7d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1b7d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x8')]);router[_0x1b7d('0x9')](_0x1b7d('0xa'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0xb')]);router[_0x1b7d('0x9')](_0x1b7d('0xc'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0xd')]);router['get'](_0x1b7d('0xe'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0xf')]);router[_0x1b7d('0x9')](_0x1b7d('0x10'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x11')]);router[_0x1b7d('0x9')](_0x1b7d('0x12'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x13')]);router[_0x1b7d('0x9')](_0x1b7d('0x14'),auth['isAuthenticated'](),controller[_0x1b7d('0x15')]);router[_0x1b7d('0x9')](_0x1b7d('0x16'),auth[_0x1b7d('0x7')](),controller['getInteractions']);router[_0x1b7d('0x9')](_0x1b7d('0x17'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x18')]);router[_0x1b7d('0x9')]('/:id/messages',auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x19')]);router[_0x1b7d('0x9')]('/:id/verify',auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x1a')]);router[_0x1b7d('0x9')](_0x1b7d('0x1b'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x1c')]);router[_0x1b7d('0x1d')](_0x1b7d('0xe'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x1e')]);router['post'](_0x1b7d('0x10'),auth['isAuthenticated'](),controller[_0x1b7d('0x1f')]);router['post']('/',auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x20')]);router[_0x1b7d('0x1d')](_0x1b7d('0x12'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x21')]);router[_0x1b7d('0x1d')](_0x1b7d('0x14'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x1b7d('0x1d')](_0x1b7d('0x16'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x22')]);router[_0x1b7d('0x1d')](_0x1b7d('0x17'),auth['isAuthenticated'](),controller[_0x1b7d('0x23')]);router['post'](_0x1b7d('0x24'),auth[_0x1b7d('0x7')](),controller['send']);router[_0x1b7d('0x1d')]('/:id/users',auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x25')]);router[_0x1b7d('0x26')](_0x1b7d('0xc'),auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x27')]);router['delete'](_0x1b7d('0xe'),auth['isAuthenticated'](),controller[_0x1b7d('0x28')]);router['delete'](_0x1b7d('0x10'),auth[_0x1b7d('0x7')](),controller['removeAnswers']);router[_0x1b7d('0x29')]('/:id/in_servers',auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x2a')]);router[_0x1b7d('0x29')]('/:id/out_servers',auth[_0x1b7d('0x7')](),controller[_0x1b7d('0x2b')]);router[_0x1b7d('0x29')]('/:id',auth[_0x1b7d('0x7')](),controller['destroy']);router[_0x1b7d('0x29')](_0x1b7d('0x1b'),auth[_0x1b7d('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1f33=['../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','describe','get','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','/:id/canned_answers','addAnswer','create','addSmtp','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1f33,0x190));var _0x31f3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1f33[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x31f3('0x0'));var util=require(_0x31f3('0x1'));var path=require(_0x31f3('0x2'));var timeout=require(_0x31f3('0x3'));var express=require(_0x31f3('0x4'));var router=express[_0x31f3('0x5')]();var fs_extra=require(_0x31f3('0x6'));var auth=require(_0x31f3('0x7'));var interaction=require(_0x31f3('0x8'));var config=require(_0x31f3('0x9'));var controller=require(_0x31f3('0xa'));router['get']('/',auth[_0x31f3('0xb')](),controller[_0x31f3('0xc')]);router['get']('/describe',auth[_0x31f3('0xb')](),controller[_0x31f3('0xd')]);router[_0x31f3('0xe')](_0x31f3('0xf'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x10')]);router[_0x31f3('0xe')](_0x31f3('0x11'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x12')]);router[_0x31f3('0xe')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x31f3('0x13')]);router[_0x31f3('0xe')](_0x31f3('0x14'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x15')]);router[_0x31f3('0xe')](_0x31f3('0x16'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x17')]);router[_0x31f3('0xe')](_0x31f3('0x18'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x19')]);router['get'](_0x31f3('0x1a'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x1b')]);router[_0x31f3('0xe')](_0x31f3('0x1c'),auth['isAuthenticated'](),controller[_0x31f3('0x1d')]);router[_0x31f3('0xe')](_0x31f3('0x1e'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x1f')]);router['get'](_0x31f3('0x20'),auth['isAuthenticated'](),controller['getAgents']);router[_0x31f3('0x21')](_0x31f3('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x31f3('0x21')](_0x31f3('0x22'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x23')]);router['post']('/',auth[_0x31f3('0xb')](),controller[_0x31f3('0x24')]);router[_0x31f3('0x21')](_0x31f3('0x14'),auth[_0x31f3('0xb')](),controller['addImap']);router[_0x31f3('0x21')](_0x31f3('0x16'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x25')]);router['post'](_0x31f3('0x18'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x31f3('0x1a'),auth[_0x31f3('0xb')](),controller['addApplications']);router['post'](_0x31f3('0x26'),auth['isAuthenticated'](),controller[_0x31f3('0x27')]);router[_0x31f3('0x21')](_0x31f3('0x20'),auth['isAuthenticated'](),controller[_0x31f3('0x28')]);router[_0x31f3('0x29')](_0x31f3('0xf'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x2a')]);router[_0x31f3('0x2b')]('/:id/dispositions',auth[_0x31f3('0xb')](),controller[_0x31f3('0x2c')]);router['delete'](_0x31f3('0x22'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x2d')]);router[_0x31f3('0x2b')](_0x31f3('0x14'),auth['isAuthenticated'](),controller[_0x31f3('0x2e')]);router[_0x31f3('0x2b')](_0x31f3('0x16'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x2f')]);router[_0x31f3('0x2b')]('/:id',auth[_0x31f3('0xb')](),controller[_0x31f3('0x30')]);router[_0x31f3('0x2b')](_0x31f3('0x20'),auth[_0x31f3('0xb')](),controller[_0x31f3('0x31')]);module[_0x31f3('0x32')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4680738..daa69b0 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 _0x5472=['mandatoryDisposition','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3ef639,_0x5d436c){var _0x1e5abc=function(_0x26b021){while(--_0x26b021){_0x3ef639['push'](_0x3ef639['shift']());}};_0x1e5abc(++_0x5d436c);}(_0x5472,0xa6));var _0x2547=function(_0x472ddf,_0x22b836){_0x472ddf=_0x472ddf-0x0;var _0x42c7de=_0x5472[_0x472ddf];return _0x42c7de;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x2547('0x0')]},'name':{'type':Sequelize[_0x2547('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x2547('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x2547('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x2547('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x2547('0x2')]},'markAsUnread':{'type':Sequelize[_0x2547('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2547('0x0')],'allowNull':![],'defaultValue':_0x2547('0x3')},'fontSize':{'type':Sequelize[_0x2547('0x4')](0x2)[_0x2547('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2547('0x6');}},'notificationSound':{'type':Sequelize[_0x2547('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2547('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2547('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2547('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2547('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2547('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2547('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2547('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x2547('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x2547('0x1')],'defaultValue':![],'comment':_0x2547('0x8'),'set':function(_0x3b1353){if(!_0x3b1353)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x2547('0x9')](_0x2547('0xa'),_0x3b1353);}}}; \ No newline at end of file +var _0x8f07=['STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x5023cb,_0x5ae9a6){var _0x52c5d6=function(_0x4fe596){while(--_0x4fe596){_0x5023cb['push'](_0x5023cb['shift']());}};_0x52c5d6(++_0x5ae9a6);}(_0x8f07,0x77));var _0x78f0=function(_0x5d8447,_0x37807e){_0x5d8447=_0x5d8447-0x0;var _0x1ce4d8=_0x8f07[_0x5d8447];return _0x1ce4d8;};'use strict';var Sequelize=require(_0x78f0('0x0'));module['exports']={'description':{'type':Sequelize[_0x78f0('0x1')]},'name':{'type':Sequelize[_0x78f0('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x78f0('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x78f0('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x78f0('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x78f0('0x3')]},'markAsUnread':{'type':Sequelize[_0x78f0('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x78f0('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x78f0('0x4')](0x2)[_0x78f0('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x78f0('0x3')],'defaultValue':function(){return _0x78f0('0x6');}},'notificationSound':{'type':Sequelize[_0x78f0('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x78f0('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x78f0('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x78f0('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x78f0('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x78f0('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x78f0('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x78f0('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x78f0('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x78f0('0x8'),'set':function(_0x32e026){if(!_0x32e026)this[_0x78f0('0x9')](_0x78f0('0xa'),null);this[_0x78f0('0x9')](_0x78f0('0xb'),_0x32e026);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8303f16..93bc64f 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 _0x2298=['api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','MailAccounts','stack','index','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','MailServerIn','Imap','includeAll','find','update','body','params','describe','addDisposition','Disposition','create','getDispositions','findOne','nolimit','sort','MailAccountId','rows','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','email','isNil','description','cservice','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','password','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','Contact','Owner','internal','Tag','Tags','tag','sequelize','MailApplication','destroy','bulkCreate','priority','getApplications','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','split','CmList','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','List\x20not\x20found','ListId','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3f052f,_0x54d259){var _0x12bc15=function(_0x4e1269){while(--_0x4e1269){_0x3f052f['push'](_0x3f052f['shift']());}};_0x12bc15(++_0x54d259);}(_0x2298,0xac));var _0x8229=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x2298[_0x4baae2];return _0x1a2285;};'use strict';var pdf=require(_0x8229('0x0'));var emlformat=require(_0x8229('0x1'));var rimraf=require(_0x8229('0x2'));var zipdir=require(_0x8229('0x3'));var jsonpatch=require(_0x8229('0x4'));var rp=require(_0x8229('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8229('0x6'));var util=require(_0x8229('0x7'));var path=require(_0x8229('0x8'));var sox=require(_0x8229('0x9'));var csv=require(_0x8229('0xa'));var ejs=require(_0x8229('0xb'));var fs=require('fs');var fs_extra=require(_0x8229('0xc'));var _=require(_0x8229('0xd'));var squel=require(_0x8229('0xe'));var crypto=require('crypto');var jsforce=require(_0x8229('0xf'));var deskjs=require(_0x8229('0x10'));var toCsv=require(_0x8229('0xa'));var querystring=require('querystring');var Papa=require(_0x8229('0x11'));var htmlToText=require(_0x8229('0x12'));var juice=require(_0x8229('0x13'));var Redis=require(_0x8229('0x14'));var authService=require(_0x8229('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x8229('0x16'));var hardwareService=require(_0x8229('0x17'));var logger=require('../../config/logger')(_0x8229('0x18'));var utils=require('../../config/utils');var config=require(_0x8229('0x19'));var licenseUtil=require(_0x8229('0x1a'));var db=require(_0x8229('0x1b'))['db'];config[_0x8229('0x1c')]=_[_0x8229('0x1d')](config[_0x8229('0x1c')],{'host':_0x8229('0x1e'),'port':0x18eb});var socket=require(_0x8229('0x1f'))(new Redis(config[_0x8229('0x1c')]));require(_0x8229('0x20'))[_0x8229('0x21')](socket);var jayson=require(_0x8229('0x22'));var client=jayson[_0x8229('0x23')][_0x8229('0x24')]({'port':0x232b});function respondWithRpcPromise(_0x1df68c,_0x5510ef,_0xa43dd2,_0x599a15){return new BPromise(function(_0x5b1915,_0x512c95){var _0x1feee3=_0x599a15||client;return _0x1feee3[_0x8229('0x25')](_0x1df68c,_0xa43dd2)[_0x8229('0x26')](function(_0x5413a6){logger[_0x8229('0x27')](_0x8229('0x28'),_0x5510ef,'request\x20sent');logger[_0x8229('0x29')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5510ef,_0x8229('0x2a'),JSON['stringify'](_0x5413a6));if(_0x5413a6[_0x8229('0x2b')]){if(_0x5413a6[_0x8229('0x2b')][_0x8229('0x2c')]===0x1f4){logger[_0x8229('0x2b')](_0x8229('0x28'),_0x5510ef,_0x5413a6['error'][_0x8229('0x2d')]);return _0x512c95(_0x5413a6['error'][_0x8229('0x2d')]);}logger[_0x8229('0x2b')]('MailAccount,\x20%s,\x20%s',_0x5510ef,_0x5413a6[_0x8229('0x2b')][_0x8229('0x2d')]);return _0x5b1915(_0x5413a6[_0x8229('0x2b')]['message']);}else{logger[_0x8229('0x27')](_0x8229('0x28'),_0x5510ef,'request\x20sent');_0x5b1915(_0x5413a6[_0x8229('0x2e')]['message']);}})[_0x8229('0x2f')](function(_0x4a06ae){logger['error'](_0x8229('0x28'),_0x5510ef,_0x4a06ae);_0x512c95(_0x4a06ae);});});}function respondWithStatusCode(_0x1bbe9d,_0x32d8dd){_0x32d8dd=_0x32d8dd||0xcc;return function(_0x7a9462){if(_0x7a9462){return _0x1bbe9d[_0x8229('0x30')](_0x32d8dd);}return _0x1bbe9d[_0x8229('0x31')](_0x32d8dd)[_0x8229('0x32')]();};}function respondWithResult(_0x4712b1,_0x143ab8){_0x143ab8=_0x143ab8||0xc8;return function(_0x4a2839){if(_0x4a2839){return _0x4712b1['status'](_0x143ab8)[_0x8229('0x33')](_0x4a2839);}};}function respondWithFilteredResult(_0x336735,_0x18baf0){return function(_0x2c798c){if(_0x2c798c){var _0xd7c119=_0x2c798c[_0x8229('0x34')],_0x452856=_0x18baf0[_0x8229('0x35')],_0x386873=_0x18baf0['offset']+_0x18baf0[_0x8229('0x36')],_0x1a05ce;if(_0x386873>=_0xd7c119){_0x386873=_0xd7c119;_0x1a05ce=0xc8;}else{_0x1a05ce=0xce;}_0x336735[_0x8229('0x31')](_0x1a05ce);return _0x336735[_0x8229('0x37')](_0x8229('0x38'),_0x452856+'-'+_0x386873+'/'+_0xd7c119)[_0x8229('0x33')](_0x2c798c);}return null;};}function patchUpdates(_0x19e3f3){return function(_0x4423b1){try{jsonpatch[_0x8229('0x39')](_0x4423b1,_0x19e3f3,!![]);}catch(_0x554aa9){return BPromise[_0x8229('0x3a')](_0x554aa9);}return _0x4423b1[_0x8229('0x3b')]();};}function saveUpdates(_0x5e2b53,_0x15b730){return function(_0x1603d0){if(_0x1603d0){return _0x1603d0['update'](_0x5e2b53)[_0x8229('0x26')](function(_0x3f9134){return _0x3f9134;});}return null;};}function removeEntity(_0x57ecb6,_0x33f21e){return function(_0x5b3fea){if(_0x5b3fea){return _0x5b3fea['destroy']()['then'](function(){var _0x208114=_0x5b3fea['get']({'plain':!![]});var _0x3cc385=_0x8229('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cc385,'resourceId':_0x208114['id']}})[_0x8229('0x26')](function(){return _0x5b3fea;});})['then'](function(){_0x57ecb6[_0x8229('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227253,_0x26f88){return function(_0x25b858){if(!_0x25b858){_0x227253[_0x8229('0x30')](0x194);}return _0x25b858;};}function handleError(_0xa6544b,_0x4aab48){_0x4aab48=_0x4aab48||0x1f4;return function(_0x20fd1a){logger['error'](_0x20fd1a[_0x8229('0x3d')]);if(_0x20fd1a['name']){delete _0x20fd1a['name'];}_0xa6544b[_0x8229('0x31')](_0x4aab48)['send'](_0x20fd1a);};}exports[_0x8229('0x3e')]=function(_0x16e641,_0x18f8de){var _0x216706={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x8229('0x3f')],'as':_0x8229('0x40')},{'model':db[_0x8229('0x41')],'as':_0x8229('0x42')}]},_0x59ca49={},_0x42ee69={'count':0x0,'rows':[]};var _0x4611cb=_[_0x8229('0x43')](db[_0x8229('0x44')][_0x8229('0x45')],function(_0x31d3fa){return{'name':_0x31d3fa[_0x8229('0x46')],'type':_0x31d3fa['type'][_0x8229('0x47')]};});_0x59ca49[_0x8229('0x48')]=_[_0x8229('0x43')](_0x4611cb,_0x8229('0x49'));_0x59ca49[_0x8229('0x4a')]=_[_0x8229('0x4b')](_0x16e641[_0x8229('0x4a')]);_0x59ca49[_0x8229('0x4c')]=_[_0x8229('0x4d')](_0x59ca49[_0x8229('0x48')],_0x59ca49[_0x8229('0x4a')]);_0x216706[_0x8229('0x4e')]=_[_0x8229('0x4d')](_0x59ca49[_0x8229('0x48')],qs[_0x8229('0x4f')](_0x16e641['query'][_0x8229('0x4f')]));_0x216706[_0x8229('0x4e')]=_0x216706[_0x8229('0x4e')][_0x8229('0x50')]?_0x216706[_0x8229('0x4e')]:_0x59ca49['model'];if(!_0x16e641[_0x8229('0x4a')][_0x8229('0x51')]('nolimit')){_0x216706['limit']=qs[_0x8229('0x36')](_0x16e641[_0x8229('0x4a')][_0x8229('0x36')]);_0x216706['offset']=qs[_0x8229('0x35')](_0x16e641[_0x8229('0x4a')]['offset']);}_0x216706[_0x8229('0x52')]=qs['sort'](_0x16e641[_0x8229('0x4a')]['sort']);_0x216706['where']=qs['filters'](_[_0x8229('0x53')](_0x16e641[_0x8229('0x4a')],_0x59ca49[_0x8229('0x4c')]),_0x4611cb);if(_0x16e641[_0x8229('0x4a')][_0x8229('0x54')]){_0x216706[_0x8229('0x55')]=_['merge'](_0x216706[_0x8229('0x55')],{'$or':_[_0x8229('0x43')](_0x4611cb,function(_0x4d20c7){if(_0x4d20c7[_0x8229('0x56')]!==_0x8229('0x57')){var _0x5ebc39={};_0x5ebc39[_0x4d20c7['name']]={'$like':'%'+_0x16e641['query'][_0x8229('0x54')]+'%'};return _0x5ebc39;}})});}_0x216706=_[_0x8229('0x58')]({},_0x216706,_0x16e641[_0x8229('0x59')]);var _0x433d27={'where':_0x216706[_0x8229('0x55')]};return db['MailAccount'][_0x8229('0x34')](_0x433d27)[_0x8229('0x26')](function(_0x1a9059){_0x42ee69[_0x8229('0x34')]=_0x1a9059;if(_0x16e641[_0x8229('0x4a')]['includeAll']){_0x216706[_0x8229('0x5a')]=[{'all':!![]}];}return db[_0x8229('0x44')][_0x8229('0x5b')](_0x216706);})['then'](function(_0x3c7e37){_0x42ee69['rows']=_0x3c7e37;return _0x42ee69;})['then'](respondWithFilteredResult(_0x18f8de,_0x216706))['catch'](handleError(_0x18f8de,null));};exports['show']=function(_0xcac670,_0x318765){var _0x1ba81b={'raw':![],'where':{'id':_0xcac670['params']['id']},'include':[{'model':db[_0x8229('0x5c')],'as':_0x8229('0x5d')},{'model':db[_0x8229('0x3f')],'as':_0x8229('0x40')},{'model':db[_0x8229('0x41')],'as':'mandatoryDispositionPause'}]},_0x1c4694={};_0x1c4694[_0x8229('0x48')]=_[_0x8229('0x4b')](db[_0x8229('0x44')][_0x8229('0x45')]);_0x1c4694['query']=_[_0x8229('0x4b')](_0xcac670[_0x8229('0x4a')]);_0x1c4694[_0x8229('0x4c')]=_['intersection'](_0x1c4694['model'],_0x1c4694[_0x8229('0x4a')]);_0x1ba81b[_0x8229('0x4e')]=_[_0x8229('0x4d')](_0x1c4694[_0x8229('0x48')],qs[_0x8229('0x4f')](_0xcac670[_0x8229('0x4a')][_0x8229('0x4f')]));_0x1ba81b['attributes']=_0x1ba81b['attributes'][_0x8229('0x50')]?_0x1ba81b[_0x8229('0x4e')]:_0x1c4694[_0x8229('0x48')];if(_0xcac670['query'][_0x8229('0x5e')]){_0x1ba81b[_0x8229('0x5a')]=[{'all':!![]}];}_0x1ba81b=_[_0x8229('0x58')]({},_0x1ba81b,_0xcac670['options']);return db[_0x8229('0x44')][_0x8229('0x5f')](_0x1ba81b)[_0x8229('0x26')](handleEntityNotFound(_0x318765,null))[_0x8229('0x26')](respondWithResult(_0x318765,null))[_0x8229('0x2f')](handleError(_0x318765,null));};exports[_0x8229('0x60')]=function(_0x584b99,_0xa33891){if(_0x584b99[_0x8229('0x61')]['id']){delete _0x584b99['body']['id'];}return db['MailAccount'][_0x8229('0x5f')]({'where':{'id':_0x584b99[_0x8229('0x62')]['id']},'include':[{'model':db[_0x8229('0x5c')],'as':_0x8229('0x5d')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x8229('0x41')],'as':'mandatoryDispositionPause'}]})[_0x8229('0x26')](handleEntityNotFound(_0xa33891,null))[_0x8229('0x26')](saveUpdates(_0x584b99[_0x8229('0x61')],null))[_0x8229('0x26')](function(_0x16329){if(_0x16329&&_0x584b99[_0x8229('0x61')][_0x8229('0x5d')]){return db[_0x8229('0x5c')][_0x8229('0x60')](_0x584b99[_0x8229('0x61')]['Imap'],{'where':{'MailAccountId':_0x16329['id']}})[_0x8229('0x26')](function(){return _0x16329;});}return _0x16329;})[_0x8229('0x26')](function(_0x3ed45b){if(_0x3ed45b&&_0x584b99[_0x8229('0x61')][_0x8229('0x40')]){return db[_0x8229('0x3f')][_0x8229('0x60')](_0x584b99['body'][_0x8229('0x40')],{'where':{'MailAccountId':_0x3ed45b['id']}})[_0x8229('0x26')](function(){return _0x3ed45b;});}return _0x3ed45b;})[_0x8229('0x26')](respondWithResult(_0xa33891,null))[_0x8229('0x2f')](handleError(_0xa33891,null));};exports['describe']=function(_0x5ec318,_0x323d6e){return db[_0x8229('0x44')][_0x8229('0x63')]()[_0x8229('0x26')](respondWithResult(_0x323d6e,null))[_0x8229('0x2f')](handleError(_0x323d6e,null));};exports[_0x8229('0x64')]=function(_0x31ead9,_0x1f8ccf,_0x113cf8){if(_0x31ead9['body']['id']){delete _0x31ead9[_0x8229('0x61')]['id'];}return db[_0x8229('0x44')]['find']({'where':{'id':_0x31ead9[_0x8229('0x62')]['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x1f8ccf,null))[_0x8229('0x26')](function(_0x529bba){if(_0x529bba){_0x31ead9[_0x8229('0x61')]['MailAccountId']=_0x529bba['id'];return db[_0x8229('0x65')][_0x8229('0x66')](_0x31ead9['body']);}})[_0x8229('0x26')](respondWithResult(_0x1f8ccf,null))[_0x8229('0x2f')](handleError(_0x1f8ccf,null));};exports[_0x8229('0x67')]=function(_0x395b1b,_0x5beb96,_0x4cfcae){var _0x2fa48d={'raw':![],'where':{}};var _0x193cb5={};var _0x2bbb04={'count':0x0,'rows':[]};return db[_0x8229('0x44')][_0x8229('0x68')]({'where':{'id':_0x395b1b[_0x8229('0x62')]['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x5beb96,null))[_0x8229('0x26')](function(_0x2eb561){if(_0x2eb561){_0x193cb5['model']=_[_0x8229('0x4b')](db[_0x8229('0x65')][_0x8229('0x45')]);_0x193cb5[_0x8229('0x4a')]=_[_0x8229('0x4b')](_0x395b1b['query']);_0x193cb5[_0x8229('0x4c')]=_[_0x8229('0x4d')](_0x193cb5[_0x8229('0x48')],_0x193cb5[_0x8229('0x4a')]);_0x2fa48d[_0x8229('0x4e')]=_['intersection'](_0x193cb5['model'],qs[_0x8229('0x4f')](_0x395b1b['query'][_0x8229('0x4f')]));_0x2fa48d[_0x8229('0x4e')]=_0x2fa48d[_0x8229('0x4e')][_0x8229('0x50')]?_0x2fa48d[_0x8229('0x4e')]:_0x193cb5['model'];if(!_0x395b1b[_0x8229('0x4a')][_0x8229('0x51')](_0x8229('0x69'))){_0x2fa48d['limit']=qs[_0x8229('0x36')](_0x395b1b[_0x8229('0x4a')][_0x8229('0x36')]);_0x2fa48d[_0x8229('0x35')]=qs['offset'](_0x395b1b[_0x8229('0x4a')][_0x8229('0x35')]);}_0x2fa48d[_0x8229('0x52')]=qs[_0x8229('0x6a')](_0x395b1b['query']['sort']);_0x2fa48d[_0x8229('0x55')]=qs['filters'](_[_0x8229('0x53')](_0x395b1b[_0x8229('0x4a')],_0x193cb5[_0x8229('0x4c')]));_0x2fa48d['where'][_0x8229('0x6b')]=_0x2eb561['id'];if(_0x395b1b[_0x8229('0x4a')][_0x8229('0x54')]){_0x2fa48d[_0x8229('0x55')]=_[_0x8229('0x58')](_0x2fa48d[_0x8229('0x55')],{'$or':_['map'](_0x2fa48d[_0x8229('0x4e')],function(_0x55ffc8){var _0x500865={};_0x500865[_0x55ffc8]={'$like':'%'+_0x395b1b[_0x8229('0x4a')][_0x8229('0x54')]+'%'};return _0x500865;})});}_0x2fa48d=_['merge']({},_0x2fa48d,_0x395b1b[_0x8229('0x59')]);return db['Disposition'][_0x8229('0x34')]({'where':_0x2fa48d[_0x8229('0x55')]})[_0x8229('0x26')](function(_0x43e855){_0x2bbb04[_0x8229('0x34')]=_0x43e855;if(_0x395b1b[_0x8229('0x4a')][_0x8229('0x5e')]){_0x2fa48d[_0x8229('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x8229('0x5b')](_0x2fa48d);})[_0x8229('0x26')](function(_0x5246ff){_0x2bbb04[_0x8229('0x6c')]=_0x5246ff;return _0x2bbb04;});}})[_0x8229('0x26')](respondWithFilteredResult(_0x5beb96,_0x2fa48d))[_0x8229('0x2f')](handleError(_0x5beb96,null));};exports['removeDispositions']=function(_0x568097,_0xd22d3d,_0x5b6e7a){return db[_0x8229('0x44')][_0x8229('0x5f')]({'where':{'id':_0x568097['params']['id']}})[_0x8229('0x26')](handleEntityNotFound(_0xd22d3d,null))[_0x8229('0x26')](function(_0x3e6096){if(_0x3e6096){return _0x3e6096['removeDispositions'](_0x568097['query']['ids']);}})[_0x8229('0x26')](respondWithStatusCode(_0xd22d3d,null))[_0x8229('0x2f')](handleError(_0xd22d3d,null));};exports[_0x8229('0x6d')]=function(_0x405972,_0x52c890,_0x4249b8){if(_0x405972['body']['id']){delete _0x405972[_0x8229('0x61')]['id'];}return db[_0x8229('0x44')][_0x8229('0x5f')]({'where':{'id':_0x405972['params']['id']}})['then'](handleEntityNotFound(_0x52c890,null))[_0x8229('0x26')](function(_0x48796c){if(_0x48796c){_0x405972[_0x8229('0x61')][_0x8229('0x6b')]=_0x48796c['id'];return db['CannedAnswer'][_0x8229('0x66')](_0x405972[_0x8229('0x61')]);}})[_0x8229('0x26')](respondWithResult(_0x52c890,null))[_0x8229('0x2f')](handleError(_0x52c890,null));};exports[_0x8229('0x6e')]=function(_0x15f31b,_0x338bb7,_0x1cb401){var _0x39a9dd={'raw':![],'where':{}};var _0x2216f0={};var _0x389bb7={'count':0x0,'rows':[]};return db['MailAccount'][_0x8229('0x68')]({'where':{'id':_0x15f31b['params']['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x338bb7,null))[_0x8229('0x26')](function(_0x24c76c){if(_0x24c76c){_0x2216f0[_0x8229('0x48')]=_[_0x8229('0x4b')](db['CannedAnswer'][_0x8229('0x45')]);_0x2216f0[_0x8229('0x4a')]=_[_0x8229('0x4b')](_0x15f31b[_0x8229('0x4a')]);_0x2216f0[_0x8229('0x4c')]=_[_0x8229('0x4d')](_0x2216f0[_0x8229('0x48')],_0x2216f0[_0x8229('0x4a')]);_0x39a9dd[_0x8229('0x4e')]=_[_0x8229('0x4d')](_0x2216f0[_0x8229('0x48')],qs[_0x8229('0x4f')](_0x15f31b[_0x8229('0x4a')][_0x8229('0x4f')]));_0x39a9dd[_0x8229('0x4e')]=_0x39a9dd[_0x8229('0x4e')][_0x8229('0x50')]?_0x39a9dd[_0x8229('0x4e')]:_0x2216f0['model'];if(!_0x15f31b['query'][_0x8229('0x51')](_0x8229('0x69'))){_0x39a9dd[_0x8229('0x36')]=qs['limit'](_0x15f31b[_0x8229('0x4a')]['limit']);_0x39a9dd[_0x8229('0x35')]=qs[_0x8229('0x35')](_0x15f31b[_0x8229('0x4a')]['offset']);}_0x39a9dd['order']=qs[_0x8229('0x6a')](_0x15f31b[_0x8229('0x4a')]['sort']);_0x39a9dd[_0x8229('0x55')]=qs['filters'](_[_0x8229('0x53')](_0x15f31b[_0x8229('0x4a')],_0x2216f0[_0x8229('0x4c')]));_0x39a9dd[_0x8229('0x55')][_0x8229('0x6b')]=_0x24c76c['id'];if(_0x15f31b[_0x8229('0x4a')][_0x8229('0x54')]){_0x39a9dd['where']=_[_0x8229('0x58')](_0x39a9dd[_0x8229('0x55')],{'$or':_[_0x8229('0x43')](_0x39a9dd[_0x8229('0x4e')],function(_0x388c94){var _0x3ee095={};_0x3ee095[_0x388c94]={'$like':'%'+_0x15f31b['query'][_0x8229('0x54')]+'%'};return _0x3ee095;})});}_0x39a9dd=_[_0x8229('0x58')]({},_0x39a9dd,_0x15f31b[_0x8229('0x59')]);return db[_0x8229('0x6f')][_0x8229('0x34')]({'where':_0x39a9dd['where']})[_0x8229('0x26')](function(_0x438f55){_0x389bb7['count']=_0x438f55;if(_0x15f31b['query'][_0x8229('0x5e')]){_0x39a9dd['include']=[{'all':!![]}];}return db[_0x8229('0x6f')]['findAll'](_0x39a9dd);})[_0x8229('0x26')](function(_0x3cec76){_0x389bb7[_0x8229('0x6c')]=_0x3cec76;return _0x389bb7;});}})[_0x8229('0x26')](respondWithFilteredResult(_0x338bb7,_0x39a9dd))[_0x8229('0x2f')](handleError(_0x338bb7,null));};exports[_0x8229('0x70')]=function(_0x325688,_0x30899b,_0xad42b1){return db[_0x8229('0x44')][_0x8229('0x5f')]({'where':{'id':_0x325688[_0x8229('0x62')]['id']}})['then'](handleEntityNotFound(_0x30899b,null))[_0x8229('0x26')](function(_0x44176e){if(_0x44176e){return _0x44176e[_0x8229('0x70')](_0x325688[_0x8229('0x4a')][_0x8229('0x71')]);}})[_0x8229('0x26')](respondWithStatusCode(_0x30899b,null))[_0x8229('0x2f')](handleError(_0x30899b,null));};exports[_0x8229('0x66')]=function(_0x40212f,_0x1e2b2e){var _0x4a7a71={'name':_0x40212f[_0x8229('0x61')]['name'],'key':_0x40212f['body']['key'],'email':_0x40212f[_0x8229('0x61')][_0x8229('0x72')],'ListId':_0x40212f[_0x8229('0x61')]['ListId'],'active':!_[_0x8229('0x73')](_0x40212f[_0x8229('0x61')]['active'])?_0x40212f['body']['active']:!![],'description':_0x40212f[_0x8229('0x61')][_0x8229('0x74')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x40212f['body'][_0x8229('0x75')])){if(_0x40212f[_0x8229('0x61')][_0x8229('0x76')]){_0x4a7a71[_0x8229('0x5d')][_0x8229('0x77')]=_0x4a7a71['Smtp']['user']=_0x40212f[_0x8229('0x61')][_0x8229('0x78')];_0x4a7a71[_0x8229('0x5d')]['password']=_0x4a7a71[_0x8229('0x40')][_0x8229('0x79')]=_0x40212f[_0x8229('0x61')][_0x8229('0x7a')];}else{_0x4a7a71[_0x8229('0x5d')][_0x8229('0x7b')]=_0x4a7a71[_0x8229('0x40')]['authentication']=![];}_0x4a7a71[_0x8229('0x5d')]['host']=_0x40212f[_0x8229('0x61')][_0x8229('0x5d')][_0x8229('0x7c')];_0x4a7a71[_0x8229('0x5d')][_0x8229('0x7d')]=_0x40212f[_0x8229('0x61')][_0x8229('0x5d')][_0x8229('0x7d')];_0x4a7a71[_0x8229('0x40')][_0x8229('0x7c')]=_0x40212f[_0x8229('0x61')][_0x8229('0x40')][_0x8229('0x7c')];_0x4a7a71[_0x8229('0x40')][_0x8229('0x7d')]=_0x40212f['body'][_0x8229('0x40')]['port'];}else{_0x4a7a71[_0x8229('0x5d')][_0x8229('0x7e')]=_0x4a7a71[_0x8229('0x40')]['service']=_0x40212f[_0x8229('0x61')][_0x8229('0x75')];_0x4a7a71[_0x8229('0x5d')]['user']=_0x4a7a71[_0x8229('0x40')][_0x8229('0x77')]=_0x40212f[_0x8229('0x61')][_0x8229('0x78')];_0x4a7a71['Imap'][_0x8229('0x7f')]=_0x4a7a71[_0x8229('0x40')][_0x8229('0x79')]=_0x40212f[_0x8229('0x61')][_0x8229('0x7a')];}return db['MailAccount'][_0x8229('0x66')](_0x4a7a71,{'include':[{'model':db[_0x8229('0x3f')],'as':'Smtp'},{'model':db[_0x8229('0x5c')],'as':_0x8229('0x5d')}]})[_0x8229('0x26')](function(_0x523519){var _0x4f9a45=_0x40212f[_0x8229('0x77')][_0x8229('0x80')]({'plain':!![]});if(!_0x4f9a45)throw new Error(_0x8229('0x81'));if(_0x4f9a45[_0x8229('0x82')]===_0x8229('0x77')){var _0x752cc6=_0x523519[_0x8229('0x80')]({'plain':!![]});return db[_0x8229('0x83')][_0x8229('0x5f')]({'where':{'name':_0x8229('0x3c'),'userProfileId':_0x4f9a45[_0x8229('0x84')]},'raw':!![]})[_0x8229('0x26')](function(_0x4aff7e){if(_0x4aff7e&&_0x4aff7e[_0x8229('0x85')]===0x0){return db[_0x8229('0x86')][_0x8229('0x66')]({'name':_0x752cc6[_0x8229('0x49')],'resourceId':_0x752cc6['id'],'type':_0x4aff7e['name'],'sectionId':_0x4aff7e['id']},{})[_0x8229('0x26')](function(){return _0x523519;});}else{return _0x523519;}})[_0x8229('0x2f')](function(_0x1dcc2d){logger[_0x8229('0x2b')](_0x8229('0x87'),_0x1dcc2d);throw _0x1dcc2d;});}return _0x523519;})[_0x8229('0x26')](respondWithResult(_0x1e2b2e,0xc9))['catch'](handleError(_0x1e2b2e,null));};exports[_0x8229('0x88')]=function(_0x2a57ec,_0x56d0f2,_0x59b5d7){return db[_0x8229('0x44')][_0x8229('0x68')]({'where':{'id':_0x2a57ec['params']['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x56d0f2,null))[_0x8229('0x26')](function(_0x13ea35){if(_0x13ea35){return _0x13ea35[_0x8229('0x88')]();}return null;})[_0x8229('0x26')](respondWithResult(_0x56d0f2,null))[_0x8229('0x2f')](handleError(_0x56d0f2,null));};exports['addImap']=function(_0x466f16,_0x21b0c9,_0x4069a4){if(_0x466f16[_0x8229('0x61')]['id']){delete _0x466f16[_0x8229('0x61')]['id'];}return db[_0x8229('0x44')][_0x8229('0x5f')]({'where':{'id':_0x466f16[_0x8229('0x62')]['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x21b0c9,null))['then'](function(_0x4dc1a0){if(_0x4dc1a0){_0x466f16['body'][_0x8229('0x6b')]=_0x4dc1a0['id'];return db['MailServerIn'][_0x8229('0x66')](_0x466f16[_0x8229('0x61')]);}})[_0x8229('0x26')](respondWithResult(_0x21b0c9,null))[_0x8229('0x2f')](handleError(_0x21b0c9,null));};exports[_0x8229('0x89')]=function(_0x47f03d,_0x5be38a,_0x4a563a){return db[_0x8229('0x44')][_0x8229('0x68')]({'where':{'id':_0x47f03d[_0x8229('0x62')]['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x5be38a,null))[_0x8229('0x26')](function(_0x4b28fd){if(_0x4b28fd){return _0x4b28fd[_0x8229('0x8a')](null);}return null;})[_0x8229('0x26')](respondWithStatusCode(_0x5be38a,null))[_0x8229('0x2f')](handleError(_0x5be38a,null));};exports['getSmtp']=function(_0x55753f,_0x4ed944,_0x4f373b){return db[_0x8229('0x44')][_0x8229('0x68')]({'where':{'id':_0x55753f[_0x8229('0x62')]['id']}})['then'](handleEntityNotFound(_0x4ed944,null))[_0x8229('0x26')](function(_0x353512){if(_0x353512){return _0x353512[_0x8229('0x8b')]();}return null;})[_0x8229('0x26')](respondWithResult(_0x4ed944,null))[_0x8229('0x2f')](handleError(_0x4ed944,null));};exports[_0x8229('0x8c')]=function(_0xcb637d,_0x406a29,_0xb4cf04){if(_0xcb637d[_0x8229('0x61')]['id']){delete _0xcb637d[_0x8229('0x61')]['id'];}return db[_0x8229('0x44')][_0x8229('0x5f')]({'where':{'id':_0xcb637d['params']['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x406a29,null))[_0x8229('0x26')](function(_0x2b06e1){if(_0x2b06e1){_0xcb637d[_0x8229('0x61')][_0x8229('0x6b')]=_0x2b06e1['id'];return db[_0x8229('0x3f')][_0x8229('0x66')](_0xcb637d[_0x8229('0x61')]);}})['then'](respondWithResult(_0x406a29,null))[_0x8229('0x2f')](handleError(_0x406a29,null));};exports[_0x8229('0x8d')]=function(_0x88a11d,_0x10ffa3,_0x1f2147){return db[_0x8229('0x44')]['findOne']({'where':{'id':_0x88a11d[_0x8229('0x62')]['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x10ffa3,null))[_0x8229('0x26')](function(_0x474cb8){if(_0x474cb8){return _0x474cb8[_0x8229('0x8e')](null);}return null;})['then'](respondWithStatusCode(_0x10ffa3,null))[_0x8229('0x2f')](handleError(_0x10ffa3,null));};exports[_0x8229('0x8f')]=function(_0x566e0a,_0x5dad88,_0x2d7f43){return db['MailInteraction'][_0x8229('0x5f')]({'where':{'id':_0x566e0a['params']['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x5dad88,null))['then'](function(_0x2217b0){if(_0x2217b0){return _0x2217b0[_0x8229('0x8f')](_0x566e0a[_0x8229('0x61')][_0x8229('0x71')],_[_0x8229('0x90')](_0x566e0a['body'],[_0x8229('0x71'),'id'])||{});}})['then'](respondWithResult(_0x5dad88,null))[_0x8229('0x2f')](handleError(_0x5dad88,null));};exports[_0x8229('0x91')]=function(_0x33edaa,_0x250eb6,_0x2d886a){var _0x3f7360={'raw':![],'where':{}};var _0x5be7af={};var _0x85f4cf={'count':0x0,'rows':[]};return db[_0x8229('0x44')][_0x8229('0x68')]({'where':{'id':_0x33edaa['params']['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x250eb6,null))['then'](function(_0x2f74e4){if(_0x2f74e4){_0x5be7af[_0x8229('0x48')]=_[_0x8229('0x4b')](db[_0x8229('0x92')][_0x8229('0x45')]);_0x5be7af[_0x8229('0x4a')]=_[_0x8229('0x4b')](_0x33edaa['query']);_0x5be7af[_0x8229('0x4c')]=_[_0x8229('0x4d')](_0x5be7af['model'],_0x5be7af[_0x8229('0x4a')]);_0x3f7360[_0x8229('0x4e')]=_[_0x8229('0x4d')](_0x5be7af[_0x8229('0x48')],qs[_0x8229('0x4f')](_0x33edaa[_0x8229('0x4a')][_0x8229('0x4f')]));_0x3f7360[_0x8229('0x4e')]=_0x3f7360['attributes'][_0x8229('0x50')]?_0x3f7360['attributes']:_0x5be7af['model'];if(!_0x33edaa[_0x8229('0x4a')][_0x8229('0x51')]('nolimit')){_0x3f7360[_0x8229('0x36')]=qs[_0x8229('0x36')](_0x33edaa[_0x8229('0x4a')][_0x8229('0x36')]);_0x3f7360[_0x8229('0x35')]=qs[_0x8229('0x35')](_0x33edaa[_0x8229('0x4a')][_0x8229('0x35')]);}_0x3f7360[_0x8229('0x52')]=qs[_0x8229('0x6a')](_0x33edaa[_0x8229('0x4a')]['sort']);_0x3f7360[_0x8229('0x55')]=qs[_0x8229('0x4c')](_[_0x8229('0x53')](_0x33edaa['query'],_0x5be7af[_0x8229('0x4c')]));_0x3f7360['where'][_0x8229('0x6b')]=_0x2f74e4['id'];if(_0x33edaa[_0x8229('0x4a')]['filter']){_0x3f7360['where']=_[_0x8229('0x58')](_0x3f7360[_0x8229('0x55')],{'$or':_[_0x8229('0x43')](_0x3f7360[_0x8229('0x4e')],function(_0x1c738e){var _0x942c22={};_0x942c22[_0x1c738e]={'$like':'%'+_0x33edaa[_0x8229('0x4a')][_0x8229('0x54')]+'%'};return _0x942c22;})});}_0x3f7360=_['merge']({},_0x3f7360,_0x33edaa[_0x8229('0x59')]);return db[_0x8229('0x92')]['count']({'where':_0x3f7360['where']})[_0x8229('0x26')](function(_0xdcddc2){_0x85f4cf[_0x8229('0x34')]=_0xdcddc2;if(_0x33edaa[_0x8229('0x4a')][_0x8229('0x5e')]){_0x3f7360[_0x8229('0x5a')]=[{'model':db['CmContact'],'as':_0x8229('0x93'),'required':![]},{'model':db['User'],'as':_0x8229('0x94'),'attributes':['name','fullname',_0x8229('0x95')],'required':![]},{'model':db[_0x8229('0x96')],'as':_0x8229('0x97'),'attributes':['id',_0x8229('0x49'),'color'],'where':_0x33edaa[_0x8229('0x4a')][_0x8229('0x98')]?{'id':_0x33edaa[_0x8229('0x4a')][_0x8229('0x98')]}:undefined,'required':_0x33edaa['query'][_0x8229('0x98')]?!![]:![]}];}return db['MailInteraction'][_0x8229('0x5b')](_0x3f7360);})['then'](function(_0x2cb1ca){_0x85f4cf[_0x8229('0x6c')]=_0x2cb1ca;return _0x85f4cf;});}})[_0x8229('0x26')](respondWithFilteredResult(_0x250eb6,_0x3f7360))[_0x8229('0x2f')](handleError(_0x250eb6,null));};exports['addApplications']=function(_0x34a0e6,_0x28b5b7,_0x1bab76){return db[_0x8229('0x44')][_0x8229('0x68')]({'where':{'id':_0x34a0e6[_0x8229('0x62')]['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x28b5b7,null))[_0x8229('0x26')](function(_0x247f50){if(_0x247f50){return db[_0x8229('0x99')]['transaction'](function(_0x57e11b){return db[_0x8229('0x9a')][_0x8229('0x9b')]({'where':{'MailAccountId':_0x34a0e6['params']['id']},'transaction':_0x57e11b})[_0x8229('0x26')](function(_0x89e0d9){var _0x2784f9=_['map'](_0x34a0e6[_0x8229('0x61')],function(_0x43771b){_0x43771b[_0x8229('0x6b')]=_0x34a0e6[_0x8229('0x62')]['id'];return _0x43771b;});return db[_0x8229('0x9a')][_0x8229('0x9c')](_0x2784f9,{'transaction':_0x57e11b});});})[_0x8229('0x26')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x34a0e6[_0x8229('0x62')]['id']},'order':_0x8229('0x9d')});});}})['then'](respondWithResult(_0x28b5b7,null))[_0x8229('0x2f')](handleError(_0x28b5b7,null));};exports[_0x8229('0x9e')]=function(_0x5e6060,_0x59d0a2,_0x1326df){var _0x5b5f26={};var _0x23a7b4={};var _0x12922d;var _0x480335;return db[_0x8229('0x44')]['findOne']({'where':{'id':_0x5e6060[_0x8229('0x62')]['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x59d0a2,null))[_0x8229('0x26')](function(_0x21ebf1){if(_0x21ebf1){_0x12922d=_0x21ebf1;_0x23a7b4[_0x8229('0x48')]=_[_0x8229('0x4b')](db['MailApplication'][_0x8229('0x45')]);_0x23a7b4[_0x8229('0x4a')]=_[_0x8229('0x4b')](_0x5e6060[_0x8229('0x4a')]);_0x23a7b4[_0x8229('0x4c')]=_[_0x8229('0x4d')](_0x23a7b4[_0x8229('0x48')],_0x23a7b4[_0x8229('0x4a')]);_0x5b5f26[_0x8229('0x4e')]=_[_0x8229('0x4d')](_0x23a7b4['model'],qs['fields'](_0x5e6060[_0x8229('0x4a')][_0x8229('0x4f')]));_0x5b5f26[_0x8229('0x4e')]=_0x5b5f26['attributes']['length']?_0x5b5f26[_0x8229('0x4e')]:_0x23a7b4[_0x8229('0x48')];_0x5b5f26[_0x8229('0x52')]=qs[_0x8229('0x6a')](_0x5e6060[_0x8229('0x4a')][_0x8229('0x6a')]);_0x5b5f26[_0x8229('0x55')]=qs[_0x8229('0x4c')](_[_0x8229('0x53')](_0x5e6060['query'],_0x23a7b4[_0x8229('0x4c')]));if(_0x5e6060[_0x8229('0x4a')][_0x8229('0x54')]){_0x5b5f26[_0x8229('0x55')]=_[_0x8229('0x58')](_0x5b5f26[_0x8229('0x55')],{'$or':_['map'](_0x5b5f26[_0x8229('0x4e')],function(_0x10b706){var _0x238a46={};_0x238a46[_0x10b706]={'$like':'%'+_0x5e6060[_0x8229('0x4a')][_0x8229('0x54')]+'%'};return _0x238a46;})});}_0x5b5f26=_[_0x8229('0x58')]({},_0x5b5f26,_0x5e6060[_0x8229('0x59')]);return _0x12922d[_0x8229('0x9e')](_0x5b5f26);}})[_0x8229('0x26')](function(_0x4ca3cb){if(_0x4ca3cb){_0x480335=_0x4ca3cb[_0x8229('0x50')];if(!_0x5e6060[_0x8229('0x4a')][_0x8229('0x51')](_0x8229('0x69'))){_0x5b5f26[_0x8229('0x36')]=qs[_0x8229('0x36')](_0x5e6060['query'][_0x8229('0x36')]);_0x5b5f26[_0x8229('0x35')]=qs['offset'](_0x5e6060[_0x8229('0x4a')][_0x8229('0x35')]);}return _0x12922d[_0x8229('0x9e')](_0x5b5f26);}})[_0x8229('0x26')](function(_0x13a46c){if(_0x13a46c){return _0x13a46c?{'count':_0x480335,'rows':_0x13a46c}:null;}})[_0x8229('0x26')](respondWithResult(_0x59d0a2,null))['catch'](handleError(_0x59d0a2,null));};exports['getMessages']=function(_0x48bb37,_0x271840,_0x30d47e){var _0x3d6347={'raw':!![],'where':{}};var _0x5b42e6={};var _0x23ffab={'count':0x0,'rows':[]};return db[_0x8229('0x44')][_0x8229('0x68')]({'where':{'id':_0x48bb37['params']['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x271840,null))[_0x8229('0x26')](function(_0x1e1d87){if(_0x1e1d87){_0x5b42e6[_0x8229('0x48')]=_[_0x8229('0x4b')](db['MailMessage']['rawAttributes']);_0x5b42e6[_0x8229('0x4a')]=_[_0x8229('0x4b')](_0x48bb37[_0x8229('0x4a')]);_0x5b42e6[_0x8229('0x4c')]=_[_0x8229('0x4d')](_0x5b42e6[_0x8229('0x48')],_0x5b42e6[_0x8229('0x4a')]);_0x3d6347[_0x8229('0x4e')]=_[_0x8229('0x4d')](_0x5b42e6[_0x8229('0x48')],qs[_0x8229('0x4f')](_0x48bb37['query'][_0x8229('0x4f')]));_0x3d6347[_0x8229('0x4e')]=_0x3d6347[_0x8229('0x4e')][_0x8229('0x50')]?_0x3d6347['attributes']:_0x5b42e6[_0x8229('0x48')];if(!_0x48bb37[_0x8229('0x4a')][_0x8229('0x51')]('nolimit')){_0x3d6347[_0x8229('0x36')]=qs[_0x8229('0x36')](_0x48bb37['query'][_0x8229('0x36')]);_0x3d6347[_0x8229('0x35')]=qs[_0x8229('0x35')](_0x48bb37[_0x8229('0x4a')][_0x8229('0x35')]);}_0x3d6347[_0x8229('0x52')]=qs[_0x8229('0x6a')](_0x48bb37[_0x8229('0x4a')][_0x8229('0x6a')]);_0x3d6347[_0x8229('0x55')]=qs[_0x8229('0x4c')](_['pick'](_0x48bb37[_0x8229('0x4a')],_0x5b42e6[_0x8229('0x4c')]));_0x3d6347[_0x8229('0x55')]['MailAccountId']=_0x1e1d87['id'];if(_0x48bb37[_0x8229('0x4a')]['filter']){_0x3d6347[_0x8229('0x55')]=_[_0x8229('0x58')](_0x3d6347[_0x8229('0x55')],{'$or':_[_0x8229('0x43')](_0x3d6347['attributes'],function(_0x50b7a0){var _0x3a1099={};_0x3a1099[_0x50b7a0]={'$like':'%'+_0x48bb37[_0x8229('0x4a')][_0x8229('0x54')]+'%'};return _0x3a1099;})});}if(_0x48bb37[_0x8229('0x4a')][_0x8229('0x9f')]){var _0x4714cf=_0x48bb37[_0x8229('0x4a')][_0x8229('0x9f')]['split'](',');var _0x5341b6={};_0x5341b6[_0x4714cf[0x0]]={'$gte':moment(_0x4714cf[0x1])[_0x8229('0xa0')](_0x8229('0xa1'))};_0x3d6347['where']=_['merge'](_0x3d6347[_0x8229('0x55')],_0x5341b6);}_0x3d6347=_[_0x8229('0x58')]({},_0x3d6347,_0x48bb37[_0x8229('0x59')]);return db['MailMessage']['count']({'where':_0x3d6347['where']})[_0x8229('0x26')](function(_0x40b73e){_0x23ffab[_0x8229('0x34')]=_0x40b73e;if(_0x48bb37[_0x8229('0x4a')][_0x8229('0x5e')]){_0x3d6347[_0x8229('0x5a')]=[{'all':!![]}];}return db[_0x8229('0xa2')][_0x8229('0x5b')](_0x3d6347);})[_0x8229('0x26')](function(_0x265034){if(_0x48bb37[_0x8229('0x4a')][_0x8229('0xa3')]==='true'){for(var _0xe560f8=0x0;_0xe560f8<_0x265034['length'];_0xe560f8++){_0x265034[_0xe560f8]['body']=juice(_0x265034[_0xe560f8][_0x8229('0x61')]);}}_0x23ffab['rows']=_0x265034;return _0x23ffab;});}})[_0x8229('0x26')](respondWithFilteredResult(_0x271840,_0x3d6347))['catch'](handleError(_0x271840,null));};exports['send']=function(_0x45aba6,_0x29c017,_0x34edb6){var _0x32ed11,_0x3bd3d2={},_0x4ea0a3;if(_0x45aba6['body']['to']){_0x4ea0a3=_0x45aba6['body']['to'][_0x8229('0xa4')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x45aba6[_0x8229('0x62')]['id']},'include':[{'model':db[_0x8229('0xa5')],'as':_0x8229('0xa6'),'include':[{'model':db[_0x8229('0xa7')],'as':_0x8229('0xa8'),'where':{'email':_0x4ea0a3},'limit':0x1,'order':[[_0x8229('0xa9'),_0x8229('0xaa')]]}]},{'model':db[_0x8229('0x3f')],'as':_0x8229('0x40'),'raw':!![]}]})[_0x8229('0x26')](handleEntityNotFound(_0x29c017,null))[_0x8229('0x26')](function(_0x132cfc){if(_0x132cfc){_0x32ed11=_0x132cfc;if(_0x132cfc[_0x8229('0x40')]){if(_[_0x8229('0x73')](_0x45aba6[_0x8229('0x61')][_0x8229('0xab')])){_0x45aba6[_0x8229('0x61')]['from']=util[_0x8229('0xa0')](_0x8229('0xac'),_0x132cfc[_0x8229('0x49')],_0x132cfc[_0x8229('0x72')]||_0x132cfc[_0x8229('0x40')]['user']);}if(_0x45aba6[_0x8229('0x61')]['attachments']&&_0x45aba6['body'][_0x8229('0xad')]['length']){for(var _0x2f7d3a=0x0;_0x2f7d3a<_0x45aba6[_0x8229('0x61')][_0x8229('0xad')][_0x8229('0x50')];_0x2f7d3a+=0x1){_0x45aba6[_0x8229('0x61')][_0x8229('0xad')][_0x2f7d3a]={'filename':_0x45aba6[_0x8229('0x61')][_0x8229('0xad')][_0x2f7d3a][_0x8229('0x49')],'path':path[_0x8229('0xae')](config[_0x8229('0xaf')],'server/files/attachments',_0x45aba6[_0x8229('0x61')]['attachments'][_0x2f7d3a][_0x8229('0xb0')])};}}var _0x3f1ef8={'tls':{'rejectUnauthorized':![]}};if(_[_0x8229('0x73')](_0x132cfc['Smtp'][_0x8229('0x7e')])){if(_0x132cfc[_0x8229('0x40')]['authentication']){_0x3f1ef8[_0x8229('0xb1')]={'user':_0x132cfc[_0x8229('0x40')][_0x8229('0x77')],'pass':_0x132cfc[_0x8229('0x40')][_0x8229('0x79')]};}_0x3f1ef8[_0x8229('0x7c')]=_0x132cfc[_0x8229('0x40')][_0x8229('0x7c')];_0x3f1ef8[_0x8229('0x7d')]=_0x132cfc[_0x8229('0x40')][_0x8229('0x7d')];_0x3f1ef8[_0x8229('0xb2')]=_0x132cfc[_0x8229('0x40')]['secure'];}else{_0x3f1ef8[_0x8229('0x7e')]=_0x132cfc['Smtp'][_0x8229('0x7e')];_0x3f1ef8[_0x8229('0xb1')]={'user':_0x132cfc[_0x8229('0x40')]['user'],'pass':_0x132cfc[_0x8229('0x40')][_0x8229('0x79')]};}return respondWithRpcPromise(_0x8229('0xb3'),'sendMail',{'account':_0x3f1ef8,'message':_0x45aba6[_0x8229('0x61')]});}else{throw new Error(_0x8229('0xb4'));}}})['then'](function(_0xec3571){if(_0xec3571){_0x3bd3d2=_0xec3571;if(_0x32ed11[_0x8229('0xa6')]){if(_0x32ed11[_0x8229('0xa6')][_0x8229('0xa8')][_0x8229('0x50')]){return _0x32ed11[_0x8229('0xa6')][_0x8229('0xa8')][0x0];}else{return db[_0x8229('0xa7')][_0x8229('0x66')](_[_0x8229('0x1d')](_0x45aba6[_0x8229('0x61')],{'firstName':_0x45aba6['body']['to'],'email':_0x45aba6[_0x8229('0x61')]['to'],'phone':_0x45aba6[_0x8229('0x61')]['to'],'ListId':_0x32ed11[_0x8229('0xb5')]}));}}else{throw new Error(_0x8229('0xb4'));}}})[_0x8229('0x26')](function(_0xce2c2d){if(_0xce2c2d){var _0x4e2bd3={'UserId':_0x45aba6[_0x8229('0x77')]['id'],'ContactId':_0xce2c2d['id'],'MailAccountId':_0x32ed11['id'],'inReplyTo':_0x3bd3d2['messageId'],'to':_0x45aba6['body'][_0x8229('0xab')],'cc':_0x45aba6[_0x8229('0x61')]['cc'],'subject':_0x45aba6[_0x8229('0x61')]['subject'],'attach':_0x45aba6['body'][_0x8229('0xb6')],'firstMsgDirection':_0x8229('0xb7'),'lastMsgAt':moment()[_0x8229('0xa0')](_0x8229('0xa1')),'lastMsgDirection':_0x8229('0xb7'),'Messages':[_[_0x8229('0x58')](_0x45aba6[_0x8229('0x61')],{'messageId':_0x3bd3d2['messageId'],'sentAt':moment()[_0x8229('0xa0')](_0x8229('0xa1')),'read':!![],'MailAccountId':_0x32ed11['id'],'UserId':_0x45aba6[_0x8229('0x77')]['id'],'ContactId':_0xce2c2d['id']})]};if(_0x45aba6[_0x8229('0x61')][_0x8229('0xb8')]){_0x4e2bd3=_[_0x8229('0x58')](_0x4e2bd3,_0x45aba6['body'][_0x8229('0xb8')]);}return db['MailInteraction'][_0x8229('0x66')](_0x4e2bd3,{'include':[{'model':db[_0x8229('0xa2')],'as':'Messages'}]});}})[_0x8229('0x26')](respondWithResult(_0x29c017,null))[_0x8229('0x2f')](handleError(_0x29c017,null));};exports[_0x8229('0xb9')]=function(_0x4d0d9d,_0x1bd521,_0x49a3c8){return db['MailAccount'][_0x8229('0x5f')]({'where':{'id':_0x4d0d9d[_0x8229('0x62')]['id']},'include':[{'model':db[_0x8229('0x3f')],'as':_0x8229('0x40'),'raw':!![]}]})[_0x8229('0x26')](handleEntityNotFound(_0x1bd521,null))[_0x8229('0x26')](function(_0x264c77){if(_0x264c77&&_0x264c77[_0x8229('0x40')]){var _0x450135={'id':_0x264c77['id'],'tls':{'rejectUnauthorized':![]}};if(_0x264c77['Smtp'][_0x8229('0x7e')]){_0x450135['service']=_0x264c77['Smtp']['service'];}else{_0x450135[_0x8229('0x7c')]=_0x264c77[_0x8229('0x40')]['host'];_0x450135[_0x8229('0x7d')]=_0x264c77['Smtp']['port'];_0x450135['secure']=_0x264c77[_0x8229('0x40')]['secure'];}if(_0x264c77['Smtp']['authentication']){_0x450135['auth']={'user':_0x264c77['Smtp'][_0x8229('0x77')],'pass':_0x264c77[_0x8229('0x40')]['pass']};}return respondWithRpcPromise(_0x8229('0xba'),_0x8229('0xb9'),{'account':_0x450135});}})[_0x8229('0x26')](respondWithResult(_0x1bd521,null))[_0x8229('0x2f')](handleError(_0x1bd521,null));};exports[_0x8229('0x9b')]=function(_0x11e9dd,_0x3e931f){return db[_0x8229('0x44')][_0x8229('0x5f')]({'where':{'id':_0x11e9dd[_0x8229('0x62')]['id']}})['then'](handleEntityNotFound(_0x3e931f,null))[_0x8229('0x26')](function(_0x12a860){if(_0x12a860&&_0x12a860[_0x8229('0x7e')]){throw new db[(_0x8229('0xbb'))][(_0x8229('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x12a860;})['then'](removeEntity(_0x3e931f,null))[_0x8229('0x2f')](handleError(_0x3e931f,null));};exports[_0x8229('0xbd')]=function(_0x31b82f,_0x2becf6,_0x3cea43){return db['MailAccount']['find']({'where':{'id':_0x31b82f[_0x8229('0x62')]['id']}})[_0x8229('0x26')](handleEntityNotFound(_0x2becf6,null))['then'](function(_0x270bcd){if(_0x270bcd){return _0x270bcd[_0x8229('0xbd')](_0x31b82f['body'][_0x8229('0x71')],_[_0x8229('0x90')](_0x31b82f[_0x8229('0x61')],[_0x8229('0x71'),'id'])||{})['spread'](function(_0x4d4622){for(var _0x3a86e9=0x0;_0x3a86e9<_0x31b82f[_0x8229('0x61')][_0x8229('0x71')][_0x8229('0x50')];_0x3a86e9+=0x1){socket['emit'](_0x8229('0xbe'),{'UserId':_0x31b82f[_0x8229('0x61')][_0x8229('0x71')][_0x3a86e9],'MailAccountId':_0x31b82f[_0x8229('0x62')]['id']});}return _0x4d4622;});}})[_0x8229('0x26')](respondWithResult(_0x2becf6,null))[_0x8229('0x2f')](handleError(_0x2becf6,null));};exports[_0x8229('0xbf')]=function(_0x17f189,_0x2c11d2,_0x57b2c9){return db[_0x8229('0x44')][_0x8229('0x5f')]({'where':{'id':_0x17f189[_0x8229('0x62')]['id']}})['then'](handleEntityNotFound(_0x2c11d2,null))[_0x8229('0x26')](function(_0xded419){if(_0xded419){return _0xded419[_0x8229('0xbf')](_0x17f189['query'][_0x8229('0x71')])[_0x8229('0x26')](function(){if(_[_0x8229('0xc0')](_0x17f189[_0x8229('0x4a')][_0x8229('0x71')])){for(var _0x397992=0x0;_0x397992<_0x17f189[_0x8229('0x4a')][_0x8229('0x71')][_0x8229('0x50')];_0x397992+=0x1){socket[_0x8229('0xc1')](_0x8229('0xc2'),{'UserId':Number(_0x17f189[_0x8229('0x4a')]['ids'][_0x397992]),'MailAccountId':Number(_0x17f189[_0x8229('0x62')]['id'])});}}else{socket[_0x8229('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x17f189['query'][_0x8229('0x71')]),'MailAccountId':Number(_0x17f189['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2c11d2,null))[_0x8229('0x2f')](handleError(_0x2c11d2,null));};exports[_0x8229('0xc3')]=function(_0x5597f4,_0x546d32,_0x1b5ec4){var _0x44eb14={};var _0x18f32a={};var _0x29c319;var _0x416bfa;return db['MailAccount']['findOne']({'where':{'id':_0x5597f4[_0x8229('0x62')]['id']}})['then'](handleEntityNotFound(_0x546d32,null))[_0x8229('0x26')](function(_0x347203){if(_0x347203){_0x29c319=_0x347203;_0x18f32a['model']=_[_0x8229('0x4b')](db['User']['rawAttributes']);_0x18f32a['query']=_['keys'](_0x5597f4[_0x8229('0x4a')]);_0x18f32a['filters']=_[_0x8229('0x4d')](_0x18f32a['model'],_0x18f32a[_0x8229('0x4a')]);_0x44eb14[_0x8229('0x4e')]=_[_0x8229('0x4d')](_0x18f32a[_0x8229('0x48')],qs[_0x8229('0x4f')](_0x5597f4['query']['fields']));_0x44eb14[_0x8229('0x4e')]=_0x44eb14[_0x8229('0x4e')]['length']?_0x44eb14[_0x8229('0x4e')]:_0x18f32a[_0x8229('0x48')];_0x44eb14[_0x8229('0x52')]=qs[_0x8229('0x6a')](_0x5597f4['query'][_0x8229('0x6a')]);_0x44eb14[_0x8229('0x55')]=qs[_0x8229('0x4c')](_[_0x8229('0x53')](_0x5597f4[_0x8229('0x4a')],_0x18f32a['filters']));if(_0x5597f4[_0x8229('0x4a')]['filter']){_0x44eb14[_0x8229('0x55')]=_[_0x8229('0x58')](_0x44eb14[_0x8229('0x55')],{'$or':_['map'](_0x44eb14[_0x8229('0x4e')],function(_0x1f814a){var _0x3e4044={};_0x3e4044[_0x1f814a]={'$like':'%'+_0x5597f4[_0x8229('0x4a')][_0x8229('0x54')]+'%'};return _0x3e4044;})});}_0x44eb14=_[_0x8229('0x58')]({},_0x44eb14,_0x5597f4['options']);return _0x29c319[_0x8229('0xc3')](_0x44eb14);}})[_0x8229('0x26')](function(_0x3d5698){if(_0x3d5698){_0x416bfa=_0x3d5698[_0x8229('0x50')];if(!_0x5597f4[_0x8229('0x4a')][_0x8229('0x51')](_0x8229('0x69'))){_0x44eb14[_0x8229('0x36')]=qs[_0x8229('0x36')](_0x5597f4[_0x8229('0x4a')][_0x8229('0x36')]);_0x44eb14[_0x8229('0x35')]=qs[_0x8229('0x35')](_0x5597f4['query'][_0x8229('0x35')]);}return _0x29c319[_0x8229('0xc3')](_0x44eb14);}})['then'](function(_0x441ea9){if(_0x441ea9){return _0x441ea9?{'count':_0x416bfa,'rows':_0x441ea9}:null;}})[_0x8229('0x26')](respondWithResult(_0x546d32,null))['catch'](handleError(_0x546d32,null));}; \ No newline at end of file +var _0x1869=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tags','color','tag','transaction','MailApplication','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','Contacts','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','secure','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','save','update','destroy','get','UserProfileResource','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys','length','includeAll','find','body','Pause','addDisposition','Disposition','create','getDispositions','findOne','hasOwnProperty','MailAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','userProfileId','autoAssociation'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x1869,0x1c3));var _0x9186=function(_0x4a49fd,_0xdf7290){_0x4a49fd=_0x4a49fd-0x0;var _0x352773=_0x1869[_0x4a49fd];return _0x352773;};'use strict';var pdf=require(_0x9186('0x0'));var emlformat=require(_0x9186('0x1'));var rimraf=require(_0x9186('0x2'));var zipdir=require(_0x9186('0x3'));var jsonpatch=require(_0x9186('0x4'));var rp=require(_0x9186('0x5'));var moment=require('moment');var BPromise=require(_0x9186('0x6'));var Mustache=require(_0x9186('0x7'));var util=require(_0x9186('0x8'));var path=require(_0x9186('0x9'));var sox=require(_0x9186('0xa'));var csv=require(_0x9186('0xb'));var ejs=require(_0x9186('0xc'));var fs=require('fs');var fs_extra=require(_0x9186('0xd'));var _=require(_0x9186('0xe'));var squel=require(_0x9186('0xf'));var crypto=require(_0x9186('0x10'));var jsforce=require(_0x9186('0x11'));var deskjs=require(_0x9186('0x12'));var toCsv=require(_0x9186('0xb'));var querystring=require(_0x9186('0x13'));var Papa=require(_0x9186('0x14'));var htmlToText=require(_0x9186('0x15'));var juice=require(_0x9186('0x16'));var Redis=require('ioredis');var authService=require(_0x9186('0x17'));var qs=require('../../components/parsers/qs');var as=require(_0x9186('0x18'));var hardwareService=require(_0x9186('0x19'));var logger=require('../../config/logger')(_0x9186('0x1a'));var utils=require(_0x9186('0x1b'));var config=require(_0x9186('0x1c'));var licenseUtil=require(_0x9186('0x1d'));var db=require('../../mysqldb')['db'];config[_0x9186('0x1e')]=_[_0x9186('0x1f')](config[_0x9186('0x1e')],{'host':_0x9186('0x20'),'port':0x18eb});var socket=require(_0x9186('0x21'))(new Redis(config[_0x9186('0x1e')]));require('./mailAccount.socket')[_0x9186('0x22')](socket);var jayson=require(_0x9186('0x23'));var client=jayson[_0x9186('0x24')][_0x9186('0x25')]({'port':0x232b});function respondWithRpcPromise(_0x26efae,_0x234e8b,_0x59e320,_0x18739a){return new BPromise(function(_0x45cf6f,_0x4b8a84){var _0x2e3d66=_0x18739a||client;return _0x2e3d66[_0x9186('0x26')](_0x26efae,_0x59e320)[_0x9186('0x27')](function(_0x55c49a){logger[_0x9186('0x28')]('MailAccount,\x20%s,\x20%s',_0x234e8b,_0x9186('0x29'));logger[_0x9186('0x2a')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x234e8b,_0x9186('0x29'),JSON[_0x9186('0x2b')](_0x55c49a));if(_0x55c49a['error']){if(_0x55c49a[_0x9186('0x2c')][_0x9186('0x2d')]===0x1f4){logger[_0x9186('0x2c')](_0x9186('0x2e'),_0x234e8b,_0x55c49a[_0x9186('0x2c')][_0x9186('0x2f')]);return _0x4b8a84(_0x55c49a[_0x9186('0x2c')][_0x9186('0x2f')]);}logger[_0x9186('0x2c')](_0x9186('0x2e'),_0x234e8b,_0x55c49a[_0x9186('0x2c')][_0x9186('0x2f')]);return _0x45cf6f(_0x55c49a[_0x9186('0x2c')][_0x9186('0x2f')]);}else{logger[_0x9186('0x28')]('MailAccount,\x20%s,\x20%s',_0x234e8b,_0x9186('0x29'));_0x45cf6f(_0x55c49a['result'][_0x9186('0x2f')]);}})[_0x9186('0x30')](function(_0x3db7be){logger[_0x9186('0x2c')](_0x9186('0x2e'),_0x234e8b,_0x3db7be);_0x4b8a84(_0x3db7be);});});}function respondWithStatusCode(_0x46fc11,_0xf559c6){_0xf559c6=_0xf559c6||0xcc;return function(_0x4c8a2f){if(_0x4c8a2f){return _0x46fc11[_0x9186('0x31')](_0xf559c6);}return _0x46fc11[_0x9186('0x32')](_0xf559c6)[_0x9186('0x33')]();};}function respondWithResult(_0x37aff2,_0xacce5f){_0xacce5f=_0xacce5f||0xc8;return function(_0xb8cb87){if(_0xb8cb87){return _0x37aff2[_0x9186('0x32')](_0xacce5f)['json'](_0xb8cb87);}};}function respondWithFilteredResult(_0xd19f0c,_0x44ded3){return function(_0x639939){if(_0x639939){var _0xd43b61=_0x639939['count'],_0x798cbf=_0x44ded3[_0x9186('0x34')],_0x29f89e=_0x44ded3['offset']+_0x44ded3['limit'],_0x498e1c;if(_0x29f89e>=_0xd43b61){_0x29f89e=_0xd43b61;_0x498e1c=0xc8;}else{_0x498e1c=0xce;}_0xd19f0c[_0x9186('0x32')](_0x498e1c);return _0xd19f0c[_0x9186('0x35')](_0x9186('0x36'),_0x798cbf+'-'+_0x29f89e+'/'+_0xd43b61)[_0x9186('0x37')](_0x639939);}return null;};}function patchUpdates(_0x5eb42a){return function(_0x1013a3){try{jsonpatch[_0x9186('0x38')](_0x1013a3,_0x5eb42a,!![]);}catch(_0x31f549){return BPromise['reject'](_0x31f549);}return _0x1013a3[_0x9186('0x39')]();};}function saveUpdates(_0x1cccff,_0x20d9f0){return function(_0x390c38){if(_0x390c38){return _0x390c38[_0x9186('0x3a')](_0x1cccff)[_0x9186('0x27')](function(_0x4a575b){return _0x4a575b;});}return null;};}function removeEntity(_0x1c2f8e,_0xa46455){return function(_0x9fc989){if(_0x9fc989){return _0x9fc989[_0x9186('0x3b')]()[_0x9186('0x27')](function(){var _0x4f39be=_0x9fc989[_0x9186('0x3c')]({'plain':!![]});var _0x13d570='MailAccounts';return db[_0x9186('0x3d')][_0x9186('0x3b')]({'where':{'type':_0x13d570,'resourceId':_0x4f39be['id']}})[_0x9186('0x27')](function(){return _0x9fc989;});})[_0x9186('0x27')](function(){_0x1c2f8e['status'](0xcc)[_0x9186('0x33')]();});}};}function handleEntityNotFound(_0x54d0c0,_0x58718f){return function(_0x1bb953){if(!_0x1bb953){_0x54d0c0[_0x9186('0x31')](0x194);}return _0x1bb953;};}function handleError(_0x1fe821,_0x4c9092){_0x4c9092=_0x4c9092||0x1f4;return function(_0x56ec4a){logger[_0x9186('0x2c')](_0x56ec4a['stack']);if(_0x56ec4a[_0x9186('0x3e')]){delete _0x56ec4a[_0x9186('0x3e')];}_0x1fe821[_0x9186('0x32')](_0x4c9092)[_0x9186('0x3f')](_0x56ec4a);};}exports[_0x9186('0x40')]=function(_0x25f9f9,_0x54a095){var _0x1cd3a4={'include':[{'model':db[_0x9186('0x41')],'as':_0x9186('0x42')},{'model':db[_0x9186('0x43')],'as':_0x9186('0x44')},{'model':db['Pause'],'as':_0x9186('0x45')}]},_0x2633f0={},_0x582157={'count':0x0,'rows':[]};var _0x4cd9d0=_[_0x9186('0x46')](db[_0x9186('0x47')][_0x9186('0x48')],function(_0x101431){return{'name':_0x101431[_0x9186('0x49')],'type':_0x101431[_0x9186('0x4a')][_0x9186('0x4b')]};});_0x2633f0['model']=_[_0x9186('0x46')](_0x4cd9d0,_0x9186('0x3e'));_0x2633f0[_0x9186('0x4c')]=_['keys'](_0x25f9f9['query']);_0x2633f0[_0x9186('0x4d')]=_[_0x9186('0x4e')](_0x2633f0[_0x9186('0x4f')],_0x2633f0[_0x9186('0x4c')]);_0x1cd3a4[_0x9186('0x50')]=_[_0x9186('0x4e')](_0x2633f0[_0x9186('0x4f')],qs[_0x9186('0x51')](_0x25f9f9[_0x9186('0x4c')]['fields']));_0x1cd3a4['attributes']=_0x1cd3a4[_0x9186('0x50')]['length']?_0x1cd3a4[_0x9186('0x50')]:_0x2633f0[_0x9186('0x4f')];if(!_0x25f9f9[_0x9186('0x4c')]['hasOwnProperty'](_0x9186('0x52'))){_0x1cd3a4[_0x9186('0x53')]=qs[_0x9186('0x53')](_0x25f9f9['query'][_0x9186('0x53')]);_0x1cd3a4[_0x9186('0x34')]=qs[_0x9186('0x34')](_0x25f9f9[_0x9186('0x4c')][_0x9186('0x34')]);}_0x1cd3a4[_0x9186('0x54')]=qs['sort'](_0x25f9f9[_0x9186('0x4c')][_0x9186('0x55')]);_0x1cd3a4['where']=qs[_0x9186('0x4d')](_[_0x9186('0x56')](_0x25f9f9[_0x9186('0x4c')],_0x2633f0[_0x9186('0x4d')]),_0x4cd9d0);if(_0x25f9f9[_0x9186('0x4c')][_0x9186('0x57')]){_0x1cd3a4[_0x9186('0x58')]=_[_0x9186('0x59')](_0x1cd3a4[_0x9186('0x58')],{'$or':_[_0x9186('0x46')](_0x4cd9d0,function(_0x4ccab1){if(_0x4ccab1[_0x9186('0x4a')]!==_0x9186('0x5a')){var _0x573d9a={};_0x573d9a[_0x4ccab1[_0x9186('0x3e')]]={'$like':'%'+_0x25f9f9[_0x9186('0x4c')]['filter']+'%'};return _0x573d9a;}})});}_0x1cd3a4=_[_0x9186('0x59')]({},_0x1cd3a4,_0x25f9f9[_0x9186('0x5b')]);var _0x58a8bf={'where':_0x1cd3a4[_0x9186('0x58')]};return db[_0x9186('0x47')][_0x9186('0x5c')](_0x58a8bf)[_0x9186('0x27')](function(_0x145b1e){_0x582157[_0x9186('0x5c')]=_0x145b1e;if(_0x25f9f9['query']['includeAll']){_0x1cd3a4[_0x9186('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0x9186('0x5e')](_0x1cd3a4);})[_0x9186('0x27')](function(_0x574389){_0x582157[_0x9186('0x5f')]=_0x574389;return _0x582157;})[_0x9186('0x27')](respondWithFilteredResult(_0x54a095,_0x1cd3a4))['catch'](handleError(_0x54a095,null));};exports[_0x9186('0x60')]=function(_0x129197,_0x3bb623){var _0x2dbbb6={'raw':![],'where':{'id':_0x129197[_0x9186('0x61')]['id']},'include':[{'model':db[_0x9186('0x41')],'as':'Imap'},{'model':db[_0x9186('0x43')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2afbac={};_0x2afbac[_0x9186('0x4f')]=_['keys'](db[_0x9186('0x47')][_0x9186('0x48')]);_0x2afbac[_0x9186('0x4c')]=_[_0x9186('0x62')](_0x129197[_0x9186('0x4c')]);_0x2afbac[_0x9186('0x4d')]=_[_0x9186('0x4e')](_0x2afbac[_0x9186('0x4f')],_0x2afbac[_0x9186('0x4c')]);_0x2dbbb6[_0x9186('0x50')]=_['intersection'](_0x2afbac[_0x9186('0x4f')],qs[_0x9186('0x51')](_0x129197[_0x9186('0x4c')]['fields']));_0x2dbbb6[_0x9186('0x50')]=_0x2dbbb6['attributes'][_0x9186('0x63')]?_0x2dbbb6[_0x9186('0x50')]:_0x2afbac[_0x9186('0x4f')];if(_0x129197[_0x9186('0x4c')][_0x9186('0x64')]){_0x2dbbb6[_0x9186('0x5d')]=[{'all':!![]}];}_0x2dbbb6=_[_0x9186('0x59')]({},_0x2dbbb6,_0x129197[_0x9186('0x5b')]);return db[_0x9186('0x47')][_0x9186('0x65')](_0x2dbbb6)[_0x9186('0x27')](handleEntityNotFound(_0x3bb623,null))[_0x9186('0x27')](respondWithResult(_0x3bb623,null))[_0x9186('0x30')](handleError(_0x3bb623,null));};exports[_0x9186('0x3a')]=function(_0x12cdf1,_0x137448){if(_0x12cdf1[_0x9186('0x66')]['id']){delete _0x12cdf1[_0x9186('0x66')]['id'];}return db[_0x9186('0x47')]['find']({'where':{'id':_0x12cdf1[_0x9186('0x61')]['id']},'include':[{'model':db[_0x9186('0x41')],'as':'Imap'},{'model':db[_0x9186('0x43')],'as':_0x9186('0x44')},{'model':db[_0x9186('0x67')],'as':'mandatoryDispositionPause'}]})[_0x9186('0x27')](handleEntityNotFound(_0x137448,null))[_0x9186('0x27')](saveUpdates(_0x12cdf1[_0x9186('0x66')],null))[_0x9186('0x27')](function(_0x92d070){if(_0x92d070&&_0x12cdf1[_0x9186('0x66')][_0x9186('0x42')]){return db[_0x9186('0x41')][_0x9186('0x3a')](_0x12cdf1[_0x9186('0x66')]['Imap'],{'where':{'MailAccountId':_0x92d070['id']}})[_0x9186('0x27')](function(){return _0x92d070;});}return _0x92d070;})['then'](function(_0x5b2c21){if(_0x5b2c21&&_0x12cdf1[_0x9186('0x66')][_0x9186('0x44')]){return db['MailServerOut'][_0x9186('0x3a')](_0x12cdf1['body'][_0x9186('0x44')],{'where':{'MailAccountId':_0x5b2c21['id']}})[_0x9186('0x27')](function(){return _0x5b2c21;});}return _0x5b2c21;})[_0x9186('0x27')](respondWithResult(_0x137448,null))[_0x9186('0x30')](handleError(_0x137448,null));};exports['describe']=function(_0x472bae,_0x4ac31f){return db[_0x9186('0x47')]['describe']()[_0x9186('0x27')](respondWithResult(_0x4ac31f,null))[_0x9186('0x30')](handleError(_0x4ac31f,null));};exports[_0x9186('0x68')]=function(_0xe52454,_0x3fc5ef,_0x8393af){if(_0xe52454[_0x9186('0x66')]['id']){delete _0xe52454[_0x9186('0x66')]['id'];}return db[_0x9186('0x47')][_0x9186('0x65')]({'where':{'id':_0xe52454['params']['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x3fc5ef,null))[_0x9186('0x27')](function(_0x263e0f){if(_0x263e0f){_0xe52454[_0x9186('0x66')]['MailAccountId']=_0x263e0f['id'];return db[_0x9186('0x69')][_0x9186('0x6a')](_0xe52454['body']);}})[_0x9186('0x27')](respondWithResult(_0x3fc5ef,null))[_0x9186('0x30')](handleError(_0x3fc5ef,null));};exports[_0x9186('0x6b')]=function(_0x4d80e7,_0xe75735,_0x32983f){var _0x282719={'raw':![],'where':{}};var _0x5a87ee={};var _0x9fdfd2={'count':0x0,'rows':[]};return db[_0x9186('0x47')][_0x9186('0x6c')]({'where':{'id':_0x4d80e7[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0xe75735,null))[_0x9186('0x27')](function(_0x27c366){if(_0x27c366){_0x5a87ee[_0x9186('0x4f')]=_['keys'](db['Disposition'][_0x9186('0x48')]);_0x5a87ee[_0x9186('0x4c')]=_[_0x9186('0x62')](_0x4d80e7[_0x9186('0x4c')]);_0x5a87ee['filters']=_['intersection'](_0x5a87ee['model'],_0x5a87ee[_0x9186('0x4c')]);_0x282719['attributes']=_[_0x9186('0x4e')](_0x5a87ee[_0x9186('0x4f')],qs[_0x9186('0x51')](_0x4d80e7['query'][_0x9186('0x51')]));_0x282719[_0x9186('0x50')]=_0x282719[_0x9186('0x50')][_0x9186('0x63')]?_0x282719['attributes']:_0x5a87ee[_0x9186('0x4f')];if(!_0x4d80e7[_0x9186('0x4c')][_0x9186('0x6d')](_0x9186('0x52'))){_0x282719[_0x9186('0x53')]=qs['limit'](_0x4d80e7[_0x9186('0x4c')]['limit']);_0x282719[_0x9186('0x34')]=qs['offset'](_0x4d80e7[_0x9186('0x4c')][_0x9186('0x34')]);}_0x282719['order']=qs[_0x9186('0x55')](_0x4d80e7['query'][_0x9186('0x55')]);_0x282719[_0x9186('0x58')]=qs[_0x9186('0x4d')](_[_0x9186('0x56')](_0x4d80e7['query'],_0x5a87ee[_0x9186('0x4d')]));_0x282719[_0x9186('0x58')][_0x9186('0x6e')]=_0x27c366['id'];if(_0x4d80e7[_0x9186('0x4c')][_0x9186('0x57')]){_0x282719['where']=_[_0x9186('0x59')](_0x282719[_0x9186('0x58')],{'$or':_[_0x9186('0x46')](_0x282719[_0x9186('0x50')],function(_0x571608){var _0x31dd54={};_0x31dd54[_0x571608]={'$like':'%'+_0x4d80e7[_0x9186('0x4c')]['filter']+'%'};return _0x31dd54;})});}_0x282719=_[_0x9186('0x59')]({},_0x282719,_0x4d80e7[_0x9186('0x5b')]);return db['Disposition']['count']({'where':_0x282719[_0x9186('0x58')]})[_0x9186('0x27')](function(_0x1ccfe6){_0x9fdfd2[_0x9186('0x5c')]=_0x1ccfe6;if(_0x4d80e7[_0x9186('0x4c')][_0x9186('0x64')]){_0x282719['include']=[{'all':!![]}];}return db['Disposition'][_0x9186('0x5e')](_0x282719);})['then'](function(_0x387d6e){_0x9fdfd2[_0x9186('0x5f')]=_0x387d6e;return _0x9fdfd2;});}})[_0x9186('0x27')](respondWithFilteredResult(_0xe75735,_0x282719))['catch'](handleError(_0xe75735,null));};exports['removeDispositions']=function(_0x4e8818,_0x16b7ed,_0x5c8971){return db[_0x9186('0x47')][_0x9186('0x65')]({'where':{'id':_0x4e8818[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x16b7ed,null))[_0x9186('0x27')](function(_0x6aff3f){if(_0x6aff3f){return _0x6aff3f[_0x9186('0x6f')](_0x4e8818[_0x9186('0x4c')]['ids']);}})['then'](respondWithStatusCode(_0x16b7ed,null))[_0x9186('0x30')](handleError(_0x16b7ed,null));};exports[_0x9186('0x70')]=function(_0xf19895,_0x1f2193,_0x2238ec){if(_0xf19895[_0x9186('0x66')]['id']){delete _0xf19895[_0x9186('0x66')]['id'];}return db[_0x9186('0x47')][_0x9186('0x65')]({'where':{'id':_0xf19895[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x1f2193,null))[_0x9186('0x27')](function(_0x4b92b8){if(_0x4b92b8){_0xf19895[_0x9186('0x66')][_0x9186('0x6e')]=_0x4b92b8['id'];return db[_0x9186('0x71')][_0x9186('0x6a')](_0xf19895['body']);}})[_0x9186('0x27')](respondWithResult(_0x1f2193,null))[_0x9186('0x30')](handleError(_0x1f2193,null));};exports[_0x9186('0x72')]=function(_0x40eb8a,_0x3110e9,_0x1aa707){var _0x2a8935={'raw':![],'where':{}};var _0x53499d={};var _0x210b4e={'count':0x0,'rows':[]};return db[_0x9186('0x47')][_0x9186('0x6c')]({'where':{'id':_0x40eb8a[_0x9186('0x61')]['id']}})['then'](handleEntityNotFound(_0x3110e9,null))[_0x9186('0x27')](function(_0x1f2740){if(_0x1f2740){_0x53499d[_0x9186('0x4f')]=_[_0x9186('0x62')](db[_0x9186('0x71')]['rawAttributes']);_0x53499d[_0x9186('0x4c')]=_['keys'](_0x40eb8a[_0x9186('0x4c')]);_0x53499d['filters']=_['intersection'](_0x53499d[_0x9186('0x4f')],_0x53499d['query']);_0x2a8935[_0x9186('0x50')]=_['intersection'](_0x53499d[_0x9186('0x4f')],qs[_0x9186('0x51')](_0x40eb8a['query']['fields']));_0x2a8935[_0x9186('0x50')]=_0x2a8935[_0x9186('0x50')][_0x9186('0x63')]?_0x2a8935['attributes']:_0x53499d[_0x9186('0x4f')];if(!_0x40eb8a[_0x9186('0x4c')][_0x9186('0x6d')](_0x9186('0x52'))){_0x2a8935['limit']=qs[_0x9186('0x53')](_0x40eb8a[_0x9186('0x4c')]['limit']);_0x2a8935[_0x9186('0x34')]=qs[_0x9186('0x34')](_0x40eb8a['query'][_0x9186('0x34')]);}_0x2a8935[_0x9186('0x54')]=qs[_0x9186('0x55')](_0x40eb8a['query'][_0x9186('0x55')]);_0x2a8935[_0x9186('0x58')]=qs['filters'](_[_0x9186('0x56')](_0x40eb8a[_0x9186('0x4c')],_0x53499d[_0x9186('0x4d')]));_0x2a8935[_0x9186('0x58')][_0x9186('0x6e')]=_0x1f2740['id'];if(_0x40eb8a['query'][_0x9186('0x57')]){_0x2a8935[_0x9186('0x58')]=_['merge'](_0x2a8935[_0x9186('0x58')],{'$or':_[_0x9186('0x46')](_0x2a8935[_0x9186('0x50')],function(_0x4f360d){var _0x5368c1={};_0x5368c1[_0x4f360d]={'$like':'%'+_0x40eb8a[_0x9186('0x4c')][_0x9186('0x57')]+'%'};return _0x5368c1;})});}_0x2a8935=_[_0x9186('0x59')]({},_0x2a8935,_0x40eb8a['options']);return db[_0x9186('0x71')][_0x9186('0x5c')]({'where':_0x2a8935[_0x9186('0x58')]})['then'](function(_0x18bad0){_0x210b4e['count']=_0x18bad0;if(_0x40eb8a[_0x9186('0x4c')][_0x9186('0x64')]){_0x2a8935[_0x9186('0x5d')]=[{'all':!![]}];}return db[_0x9186('0x71')][_0x9186('0x5e')](_0x2a8935);})[_0x9186('0x27')](function(_0x7ec0c9){_0x210b4e[_0x9186('0x5f')]=_0x7ec0c9;return _0x210b4e;});}})[_0x9186('0x27')](respondWithFilteredResult(_0x3110e9,_0x2a8935))['catch'](handleError(_0x3110e9,null));};exports['removeAnswers']=function(_0x1c08d0,_0xc7f1a,_0x2059cb){return db[_0x9186('0x47')][_0x9186('0x65')]({'where':{'id':_0x1c08d0[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0xc7f1a,null))[_0x9186('0x27')](function(_0x37ea8b){if(_0x37ea8b){return _0x37ea8b[_0x9186('0x73')](_0x1c08d0[_0x9186('0x4c')][_0x9186('0x74')]);}})[_0x9186('0x27')](respondWithStatusCode(_0xc7f1a,null))[_0x9186('0x30')](handleError(_0xc7f1a,null));};exports[_0x9186('0x6a')]=function(_0x3d641f,_0x579a83){var _0x3a9827={'name':_0x3d641f[_0x9186('0x66')][_0x9186('0x3e')],'key':_0x3d641f[_0x9186('0x66')][_0x9186('0x4b')],'email':_0x3d641f[_0x9186('0x66')]['email'],'ListId':_0x3d641f['body'][_0x9186('0x75')],'active':!_[_0x9186('0x76')](_0x3d641f['body'][_0x9186('0x77')])?_0x3d641f[_0x9186('0x66')][_0x9186('0x77')]:!![],'description':_0x3d641f[_0x9186('0x66')][_0x9186('0x78')]||null,'Imap':{},'Smtp':{}};if(_[_0x9186('0x76')](_0x3d641f['body'][_0x9186('0x79')])){if(_0x3d641f['body'][_0x9186('0x7a')]){_0x3a9827[_0x9186('0x42')][_0x9186('0x7b')]=_0x3a9827[_0x9186('0x44')][_0x9186('0x7b')]=_0x3d641f['body'][_0x9186('0x7c')];_0x3a9827[_0x9186('0x42')][_0x9186('0x7d')]=_0x3a9827[_0x9186('0x44')][_0x9186('0x7e')]=_0x3d641f['body'][_0x9186('0x7f')];}else{_0x3a9827[_0x9186('0x42')]['authentication']=_0x3a9827['Smtp'][_0x9186('0x80')]=![];}_0x3a9827[_0x9186('0x42')][_0x9186('0x81')]=_0x3d641f[_0x9186('0x66')][_0x9186('0x42')][_0x9186('0x81')];_0x3a9827[_0x9186('0x42')]['port']=_0x3d641f['body']['Imap'][_0x9186('0x82')];_0x3a9827[_0x9186('0x44')][_0x9186('0x81')]=_0x3d641f['body']['Smtp'][_0x9186('0x81')];_0x3a9827[_0x9186('0x44')][_0x9186('0x82')]=_0x3d641f[_0x9186('0x66')][_0x9186('0x44')][_0x9186('0x82')];}else{_0x3a9827[_0x9186('0x42')]['service']=_0x3a9827[_0x9186('0x44')][_0x9186('0x83')]=_0x3d641f[_0x9186('0x66')][_0x9186('0x79')];_0x3a9827[_0x9186('0x42')]['user']=_0x3a9827[_0x9186('0x44')]['user']=_0x3d641f['body']['cuser'];_0x3a9827['Imap'][_0x9186('0x7d')]=_0x3a9827[_0x9186('0x44')][_0x9186('0x7e')]=_0x3d641f[_0x9186('0x66')][_0x9186('0x7f')];}return db['MailAccount']['create'](_0x3a9827,{'include':[{'model':db['MailServerOut'],'as':_0x9186('0x44')},{'model':db[_0x9186('0x41')],'as':_0x9186('0x42')}]})['then'](function(_0x4d90e7){var _0x3b4b3a=_0x3d641f[_0x9186('0x7b')]['get']({'plain':!![]});if(!_0x3b4b3a)throw new Error(_0x9186('0x84'));if(_0x3b4b3a[_0x9186('0x85')]===_0x9186('0x7b')){var _0x527bc9=_0x4d90e7[_0x9186('0x3c')]({'plain':!![]});return db['UserProfileSection'][_0x9186('0x65')]({'where':{'name':_0x9186('0x86'),'userProfileId':_0x3b4b3a[_0x9186('0x87')]},'raw':!![]})[_0x9186('0x27')](function(_0x1136d2){if(_0x1136d2&&_0x1136d2[_0x9186('0x88')]===0x0){return db[_0x9186('0x3d')][_0x9186('0x6a')]({'name':_0x527bc9['name'],'resourceId':_0x527bc9['id'],'type':_0x1136d2[_0x9186('0x3e')],'sectionId':_0x1136d2['id']},{})['then'](function(){return _0x4d90e7;});}else{return _0x4d90e7;}})['catch'](function(_0x5446a6){logger[_0x9186('0x2c')](_0x9186('0x89'),_0x5446a6);throw _0x5446a6;});}return _0x4d90e7;})[_0x9186('0x27')](respondWithResult(_0x579a83,0xc9))['catch'](handleError(_0x579a83,null));};exports[_0x9186('0x8a')]=function(_0x3ee892,_0x2179e0,_0x4eb946){return db['MailAccount']['findOne']({'where':{'id':_0x3ee892[_0x9186('0x61')]['id']}})['then'](handleEntityNotFound(_0x2179e0,null))[_0x9186('0x27')](function(_0x3b270f){if(_0x3b270f){return _0x3b270f['getImap']();}return null;})['then'](respondWithResult(_0x2179e0,null))[_0x9186('0x30')](handleError(_0x2179e0,null));};exports[_0x9186('0x8b')]=function(_0x2871e5,_0xeb004f,_0x2d864d){if(_0x2871e5[_0x9186('0x66')]['id']){delete _0x2871e5['body']['id'];}return db[_0x9186('0x47')]['find']({'where':{'id':_0x2871e5['params']['id']}})[_0x9186('0x27')](handleEntityNotFound(_0xeb004f,null))['then'](function(_0x213d3e){if(_0x213d3e){_0x2871e5[_0x9186('0x66')][_0x9186('0x6e')]=_0x213d3e['id'];return db[_0x9186('0x41')][_0x9186('0x6a')](_0x2871e5[_0x9186('0x66')]);}})[_0x9186('0x27')](respondWithResult(_0xeb004f,null))[_0x9186('0x30')](handleError(_0xeb004f,null));};exports[_0x9186('0x8c')]=function(_0x564d40,_0x8a4fa0,_0x90557d){return db[_0x9186('0x47')]['findOne']({'where':{'id':_0x564d40[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x8a4fa0,null))[_0x9186('0x27')](function(_0x25fcbd){if(_0x25fcbd){return _0x25fcbd[_0x9186('0x8d')](null);}return null;})[_0x9186('0x27')](respondWithStatusCode(_0x8a4fa0,null))['catch'](handleError(_0x8a4fa0,null));};exports[_0x9186('0x8e')]=function(_0x58dce2,_0x28f9e4,_0x12e275){return db['MailAccount'][_0x9186('0x6c')]({'where':{'id':_0x58dce2[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x28f9e4,null))['then'](function(_0x15d8ec){if(_0x15d8ec){return _0x15d8ec['getSmtp']();}return null;})[_0x9186('0x27')](respondWithResult(_0x28f9e4,null))['catch'](handleError(_0x28f9e4,null));};exports['addSmtp']=function(_0x8bd5c5,_0xf3ab06,_0x123008){if(_0x8bd5c5[_0x9186('0x66')]['id']){delete _0x8bd5c5[_0x9186('0x66')]['id'];}return db[_0x9186('0x47')]['find']({'where':{'id':_0x8bd5c5[_0x9186('0x61')]['id']}})['then'](handleEntityNotFound(_0xf3ab06,null))[_0x9186('0x27')](function(_0x19b056){if(_0x19b056){_0x8bd5c5['body']['MailAccountId']=_0x19b056['id'];return db[_0x9186('0x43')]['create'](_0x8bd5c5[_0x9186('0x66')]);}})['then'](respondWithResult(_0xf3ab06,null))['catch'](handleError(_0xf3ab06,null));};exports[_0x9186('0x8f')]=function(_0x13f323,_0x4b9b36,_0x41b239){return db[_0x9186('0x47')][_0x9186('0x6c')]({'where':{'id':_0x13f323[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x4b9b36,null))[_0x9186('0x27')](function(_0x2188b2){if(_0x2188b2){return _0x2188b2[_0x9186('0x90')](null);}return null;})[_0x9186('0x27')](respondWithStatusCode(_0x4b9b36,null))['catch'](handleError(_0x4b9b36,null));};exports[_0x9186('0x91')]=function(_0x13e26f,_0x537155,_0xc3093f){return db[_0x9186('0x92')]['find']({'where':{'id':_0x13e26f[_0x9186('0x61')]['id']}})['then'](handleEntityNotFound(_0x537155,null))['then'](function(_0x320a0e){if(_0x320a0e){return _0x320a0e[_0x9186('0x91')](_0x13e26f[_0x9186('0x66')]['ids'],_[_0x9186('0x93')](_0x13e26f['body'],['ids','id'])||{});}})[_0x9186('0x27')](respondWithResult(_0x537155,null))[_0x9186('0x30')](handleError(_0x537155,null));};exports[_0x9186('0x94')]=function(_0x22ca76,_0x387808,_0x2ad757){var _0x421b71={'raw':![],'where':{}};var _0x113093={};var _0x156f11={'count':0x0,'rows':[]};return db[_0x9186('0x47')][_0x9186('0x6c')]({'where':{'id':_0x22ca76[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x387808,null))[_0x9186('0x27')](function(_0x9c55d1){if(_0x9c55d1){_0x113093[_0x9186('0x4f')]=_[_0x9186('0x62')](db[_0x9186('0x92')][_0x9186('0x48')]);_0x113093['query']=_[_0x9186('0x62')](_0x22ca76['query']);_0x113093[_0x9186('0x4d')]=_['intersection'](_0x113093[_0x9186('0x4f')],_0x113093[_0x9186('0x4c')]);_0x421b71['attributes']=_[_0x9186('0x4e')](_0x113093[_0x9186('0x4f')],qs[_0x9186('0x51')](_0x22ca76[_0x9186('0x4c')]['fields']));_0x421b71['attributes']=_0x421b71[_0x9186('0x50')][_0x9186('0x63')]?_0x421b71[_0x9186('0x50')]:_0x113093[_0x9186('0x4f')];if(!_0x22ca76[_0x9186('0x4c')][_0x9186('0x6d')](_0x9186('0x52'))){_0x421b71[_0x9186('0x53')]=qs[_0x9186('0x53')](_0x22ca76[_0x9186('0x4c')]['limit']);_0x421b71['offset']=qs[_0x9186('0x34')](_0x22ca76['query'][_0x9186('0x34')]);}_0x421b71[_0x9186('0x54')]=qs[_0x9186('0x55')](_0x22ca76[_0x9186('0x4c')]['sort']);_0x421b71['where']=qs[_0x9186('0x4d')](_[_0x9186('0x56')](_0x22ca76[_0x9186('0x4c')],_0x113093[_0x9186('0x4d')]));_0x421b71[_0x9186('0x58')]['MailAccountId']=_0x9c55d1['id'];if(_0x22ca76[_0x9186('0x4c')][_0x9186('0x57')]){_0x421b71[_0x9186('0x58')]=_[_0x9186('0x59')](_0x421b71[_0x9186('0x58')],{'$or':_[_0x9186('0x46')](_0x421b71[_0x9186('0x50')],function(_0x287413){var _0x1b6645={};_0x1b6645[_0x287413]={'$like':'%'+_0x22ca76[_0x9186('0x4c')][_0x9186('0x57')]+'%'};return _0x1b6645;})});}_0x421b71=_[_0x9186('0x59')]({},_0x421b71,_0x22ca76['options']);return db[_0x9186('0x92')][_0x9186('0x5c')]({'where':_0x421b71[_0x9186('0x58')]})[_0x9186('0x27')](function(_0x42f044){_0x156f11[_0x9186('0x5c')]=_0x42f044;if(_0x22ca76['query'][_0x9186('0x64')]){_0x421b71['include']=[{'model':db[_0x9186('0x95')],'as':'Contact','required':![]},{'model':db[_0x9186('0x96')],'as':_0x9186('0x97'),'attributes':[_0x9186('0x3e'),_0x9186('0x98'),_0x9186('0x99')],'required':![]},{'model':db['Tag'],'as':_0x9186('0x9a'),'attributes':['id','name',_0x9186('0x9b')],'where':_0x22ca76[_0x9186('0x4c')]['tag']?{'id':_0x22ca76[_0x9186('0x4c')][_0x9186('0x9c')]}:undefined,'required':_0x22ca76[_0x9186('0x4c')][_0x9186('0x9c')]?!![]:![]}];}return db[_0x9186('0x92')][_0x9186('0x5e')](_0x421b71);})[_0x9186('0x27')](function(_0x10e245){_0x156f11[_0x9186('0x5f')]=_0x10e245;return _0x156f11;});}})[_0x9186('0x27')](respondWithFilteredResult(_0x387808,_0x421b71))[_0x9186('0x30')](handleError(_0x387808,null));};exports['addApplications']=function(_0x68ba85,_0xcaa75b,_0x4247ef){return db[_0x9186('0x47')][_0x9186('0x6c')]({'where':{'id':_0x68ba85[_0x9186('0x61')]['id']}})['then'](handleEntityNotFound(_0xcaa75b,null))[_0x9186('0x27')](function(_0x3fe67f){if(_0x3fe67f){return db['sequelize'][_0x9186('0x9d')](function(_0x240337){return db[_0x9186('0x9e')][_0x9186('0x3b')]({'where':{'MailAccountId':_0x68ba85[_0x9186('0x61')]['id']},'transaction':_0x240337})['then'](function(_0x5f2630){var _0x2ad324=_[_0x9186('0x46')](_0x68ba85[_0x9186('0x66')],function(_0x37cd6e){_0x37cd6e[_0x9186('0x6e')]=_0x68ba85[_0x9186('0x61')]['id'];return _0x37cd6e;});return db['MailApplication']['bulkCreate'](_0x2ad324,{'transaction':_0x240337});});})[_0x9186('0x27')](function(){return db[_0x9186('0x9e')]['findAndCountAll']({'where':{'MailAccountId':_0x68ba85[_0x9186('0x61')]['id']},'order':'priority'});});}})[_0x9186('0x27')](respondWithResult(_0xcaa75b,null))[_0x9186('0x30')](handleError(_0xcaa75b,null));};exports['getApplications']=function(_0x4da46a,_0x4676b5,_0x3c659a){var _0x5bf3c7={};var _0x55528a={};var _0x5e5dc4;var _0x3be2e1;return db[_0x9186('0x47')][_0x9186('0x6c')]({'where':{'id':_0x4da46a[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x4676b5,null))[_0x9186('0x27')](function(_0x33c367){if(_0x33c367){_0x5e5dc4=_0x33c367;_0x55528a['model']=_['keys'](db['MailApplication'][_0x9186('0x48')]);_0x55528a[_0x9186('0x4c')]=_[_0x9186('0x62')](_0x4da46a['query']);_0x55528a['filters']=_['intersection'](_0x55528a['model'],_0x55528a[_0x9186('0x4c')]);_0x5bf3c7[_0x9186('0x50')]=_[_0x9186('0x4e')](_0x55528a[_0x9186('0x4f')],qs[_0x9186('0x51')](_0x4da46a[_0x9186('0x4c')][_0x9186('0x51')]));_0x5bf3c7['attributes']=_0x5bf3c7['attributes'][_0x9186('0x63')]?_0x5bf3c7[_0x9186('0x50')]:_0x55528a[_0x9186('0x4f')];_0x5bf3c7[_0x9186('0x54')]=qs[_0x9186('0x55')](_0x4da46a[_0x9186('0x4c')]['sort']);_0x5bf3c7['where']=qs[_0x9186('0x4d')](_['pick'](_0x4da46a['query'],_0x55528a[_0x9186('0x4d')]));if(_0x4da46a['query'][_0x9186('0x57')]){_0x5bf3c7[_0x9186('0x58')]=_[_0x9186('0x59')](_0x5bf3c7[_0x9186('0x58')],{'$or':_['map'](_0x5bf3c7['attributes'],function(_0x56e443){var _0x5bab2e={};_0x5bab2e[_0x56e443]={'$like':'%'+_0x4da46a['query'][_0x9186('0x57')]+'%'};return _0x5bab2e;})});}_0x5bf3c7=_[_0x9186('0x59')]({},_0x5bf3c7,_0x4da46a[_0x9186('0x5b')]);return _0x5e5dc4['getApplications'](_0x5bf3c7);}})[_0x9186('0x27')](function(_0x2ca769){if(_0x2ca769){_0x3be2e1=_0x2ca769[_0x9186('0x63')];if(!_0x4da46a['query'][_0x9186('0x6d')](_0x9186('0x52'))){_0x5bf3c7[_0x9186('0x53')]=qs[_0x9186('0x53')](_0x4da46a[_0x9186('0x4c')][_0x9186('0x53')]);_0x5bf3c7[_0x9186('0x34')]=qs[_0x9186('0x34')](_0x4da46a[_0x9186('0x4c')]['offset']);}return _0x5e5dc4[_0x9186('0x9f')](_0x5bf3c7);}})[_0x9186('0x27')](function(_0x2bfbac){if(_0x2bfbac){return _0x2bfbac?{'count':_0x3be2e1,'rows':_0x2bfbac}:null;}})['then'](respondWithResult(_0x4676b5,null))[_0x9186('0x30')](handleError(_0x4676b5,null));};exports[_0x9186('0xa0')]=function(_0x1a62c5,_0x58dc4b,_0x37d112){var _0x44ffe0={'raw':!![],'where':{}};var _0x41bdee={};var _0x272265={'count':0x0,'rows':[]};return db[_0x9186('0x47')][_0x9186('0x6c')]({'where':{'id':_0x1a62c5[_0x9186('0x61')]['id']}})['then'](handleEntityNotFound(_0x58dc4b,null))[_0x9186('0x27')](function(_0x169ea7){if(_0x169ea7){_0x41bdee[_0x9186('0x4f')]=_[_0x9186('0x62')](db[_0x9186('0xa1')][_0x9186('0x48')]);_0x41bdee['query']=_[_0x9186('0x62')](_0x1a62c5['query']);_0x41bdee[_0x9186('0x4d')]=_[_0x9186('0x4e')](_0x41bdee['model'],_0x41bdee[_0x9186('0x4c')]);_0x44ffe0[_0x9186('0x50')]=_['intersection'](_0x41bdee[_0x9186('0x4f')],qs[_0x9186('0x51')](_0x1a62c5[_0x9186('0x4c')][_0x9186('0x51')]));_0x44ffe0[_0x9186('0x50')]=_0x44ffe0['attributes'][_0x9186('0x63')]?_0x44ffe0[_0x9186('0x50')]:_0x41bdee['model'];if(!_0x1a62c5[_0x9186('0x4c')]['hasOwnProperty']('nolimit')){_0x44ffe0['limit']=qs['limit'](_0x1a62c5[_0x9186('0x4c')][_0x9186('0x53')]);_0x44ffe0[_0x9186('0x34')]=qs[_0x9186('0x34')](_0x1a62c5[_0x9186('0x4c')][_0x9186('0x34')]);}_0x44ffe0['order']=qs[_0x9186('0x55')](_0x1a62c5[_0x9186('0x4c')][_0x9186('0x55')]);_0x44ffe0[_0x9186('0x58')]=qs[_0x9186('0x4d')](_['pick'](_0x1a62c5['query'],_0x41bdee[_0x9186('0x4d')]));_0x44ffe0[_0x9186('0x58')][_0x9186('0x6e')]=_0x169ea7['id'];if(_0x1a62c5[_0x9186('0x4c')][_0x9186('0x57')]){_0x44ffe0[_0x9186('0x58')]=_[_0x9186('0x59')](_0x44ffe0[_0x9186('0x58')],{'$or':_['map'](_0x44ffe0['attributes'],function(_0x82e555){var _0x8c7429={};_0x8c7429[_0x82e555]={'$like':'%'+_0x1a62c5[_0x9186('0x4c')][_0x9186('0x57')]+'%'};return _0x8c7429;})});}if(_0x1a62c5[_0x9186('0x4c')][_0x9186('0xa2')]){var _0x11e9d8=_0x1a62c5[_0x9186('0x4c')]['$gte'][_0x9186('0xa3')](',');var _0x146187={};_0x146187[_0x11e9d8[0x0]]={'$gte':moment(_0x11e9d8[0x1])[_0x9186('0xa4')](_0x9186('0xa5'))};_0x44ffe0[_0x9186('0x58')]=_[_0x9186('0x59')](_0x44ffe0[_0x9186('0x58')],_0x146187);}_0x44ffe0=_['merge']({},_0x44ffe0,_0x1a62c5[_0x9186('0x5b')]);return db[_0x9186('0xa1')][_0x9186('0x5c')]({'where':_0x44ffe0[_0x9186('0x58')]})[_0x9186('0x27')](function(_0x454db5){_0x272265[_0x9186('0x5c')]=_0x454db5;if(_0x1a62c5[_0x9186('0x4c')]['includeAll']){_0x44ffe0[_0x9186('0x5d')]=[{'all':!![]}];}return db[_0x9186('0xa1')][_0x9186('0x5e')](_0x44ffe0);})[_0x9186('0x27')](function(_0x495978){if(_0x1a62c5['query'][_0x9186('0xa6')]==='true'){for(var _0x42b496=0x0;_0x42b496<_0x495978[_0x9186('0x63')];_0x42b496++){_0x495978[_0x42b496][_0x9186('0x66')]=juice(_0x495978[_0x42b496][_0x9186('0x66')]);}}_0x272265[_0x9186('0x5f')]=_0x495978;return _0x272265;});}})[_0x9186('0x27')](respondWithFilteredResult(_0x58dc4b,_0x44ffe0))[_0x9186('0x30')](handleError(_0x58dc4b,null));};exports[_0x9186('0x3f')]=function(_0x2fbf61,_0x51f982,_0x360b25){var _0x286189,_0x4df9ba={},_0x16e110;if(_0x2fbf61[_0x9186('0x66')]['to']){_0x16e110=_0x2fbf61[_0x9186('0x66')]['to'][_0x9186('0xa3')](',')[0x0];}return db['MailAccount'][_0x9186('0x65')]({'where':{'id':_0x2fbf61[_0x9186('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x9186('0xa7'),'include':[{'model':db[_0x9186('0x95')],'as':_0x9186('0xa8'),'where':{'email':_0x16e110},'limit':0x1,'order':[['updatedAt',_0x9186('0xa9')]]}]},{'model':db[_0x9186('0x43')],'as':_0x9186('0x44'),'raw':!![]}]})['then'](handleEntityNotFound(_0x51f982,null))[_0x9186('0x27')](function(_0x41f43b){if(_0x41f43b){_0x286189=_0x41f43b;if(_0x41f43b[_0x9186('0x44')]){if(_[_0x9186('0x76')](_0x2fbf61[_0x9186('0x66')][_0x9186('0xaa')])){_0x2fbf61['body']['from']=util[_0x9186('0xa4')](_0x9186('0xab'),_0x41f43b[_0x9186('0x3e')],_0x41f43b[_0x9186('0xac')]||_0x41f43b[_0x9186('0x44')][_0x9186('0x7b')]);}if(_0x2fbf61['body'][_0x9186('0xad')]&&_0x2fbf61[_0x9186('0x66')][_0x9186('0xad')][_0x9186('0x63')]){for(var _0x10dc05=0x0;_0x10dc05<_0x2fbf61[_0x9186('0x66')][_0x9186('0xad')][_0x9186('0x63')];_0x10dc05+=0x1){_0x2fbf61[_0x9186('0x66')][_0x9186('0xad')][_0x10dc05]={'filename':_0x2fbf61[_0x9186('0x66')][_0x9186('0xad')][_0x10dc05][_0x9186('0x3e')],'path':path[_0x9186('0xae')](config[_0x9186('0xaf')],_0x9186('0xb0'),_0x2fbf61[_0x9186('0x66')][_0x9186('0xad')][_0x10dc05][_0x9186('0xb1')])};}}var _0x4c38ed={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x41f43b['Smtp'][_0x9186('0x83')])){if(_0x41f43b[_0x9186('0x44')]['authentication']){_0x4c38ed[_0x9186('0xb2')]={'user':_0x41f43b[_0x9186('0x44')][_0x9186('0x7b')],'pass':_0x41f43b['Smtp']['pass']};}_0x4c38ed[_0x9186('0x81')]=_0x41f43b[_0x9186('0x44')][_0x9186('0x81')];_0x4c38ed[_0x9186('0x82')]=_0x41f43b[_0x9186('0x44')][_0x9186('0x82')];_0x4c38ed['secure']=_0x41f43b[_0x9186('0x44')]['secure'];}else{_0x4c38ed[_0x9186('0x83')]=_0x41f43b[_0x9186('0x44')]['service'];_0x4c38ed[_0x9186('0xb2')]={'user':_0x41f43b[_0x9186('0x44')][_0x9186('0x7b')],'pass':_0x41f43b[_0x9186('0x44')][_0x9186('0x7e')]};}return respondWithRpcPromise(_0x9186('0xb3'),_0x9186('0xb4'),{'account':_0x4c38ed,'message':_0x2fbf61[_0x9186('0x66')]});}else{throw new Error(_0x9186('0xb5'));}}})['then'](function(_0x130bf9){if(_0x130bf9){_0x4df9ba=_0x130bf9;if(_0x286189[_0x9186('0xa7')]){if(_0x286189['List'][_0x9186('0xa8')][_0x9186('0x63')]){return _0x286189[_0x9186('0xa7')]['Contacts'][0x0];}else{return db[_0x9186('0x95')][_0x9186('0x6a')](_[_0x9186('0x1f')](_0x2fbf61['body'],{'firstName':_0x2fbf61[_0x9186('0x66')]['to'],'email':_0x2fbf61[_0x9186('0x66')]['to'],'phone':_0x2fbf61[_0x9186('0x66')]['to'],'ListId':_0x286189['ListId']}));}}else{throw new Error(_0x9186('0xb5'));}}})[_0x9186('0x27')](function(_0x145c05){if(_0x145c05){var _0x4b5b27={'UserId':_0x2fbf61[_0x9186('0x7b')]['id'],'ContactId':_0x145c05['id'],'MailAccountId':_0x286189['id'],'inReplyTo':_0x4df9ba[_0x9186('0xb6')],'to':_0x2fbf61[_0x9186('0x66')][_0x9186('0xaa')],'cc':_0x2fbf61[_0x9186('0x66')]['cc'],'subject':_0x2fbf61[_0x9186('0x66')]['subject'],'attach':_0x2fbf61[_0x9186('0x66')][_0x9186('0xb7')],'firstMsgDirection':_0x9186('0xb8'),'lastMsgAt':moment()[_0x9186('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x9186('0x59')](_0x2fbf61[_0x9186('0x66')],{'messageId':_0x4df9ba[_0x9186('0xb6')],'sentAt':moment()[_0x9186('0xa4')](_0x9186('0xa5')),'read':!![],'MailAccountId':_0x286189['id'],'UserId':_0x2fbf61[_0x9186('0x7b')]['id'],'ContactId':_0x145c05['id']})]};if(_0x2fbf61[_0x9186('0x66')]['Interaction']){_0x4b5b27=_['merge'](_0x4b5b27,_0x2fbf61[_0x9186('0x66')]['Interaction']);}return db[_0x9186('0x92')][_0x9186('0x6a')](_0x4b5b27,{'include':[{'model':db[_0x9186('0xa1')],'as':'Messages'}]});}})[_0x9186('0x27')](respondWithResult(_0x51f982,null))[_0x9186('0x30')](handleError(_0x51f982,null));};exports['verifySmtp']=function(_0x2674ac,_0x2fdd6,_0x4fe0be){return db['MailAccount'][_0x9186('0x65')]({'where':{'id':_0x2674ac[_0x9186('0x61')]['id']},'include':[{'model':db[_0x9186('0x43')],'as':_0x9186('0x44'),'raw':!![]}]})['then'](handleEntityNotFound(_0x2fdd6,null))[_0x9186('0x27')](function(_0x32d737){if(_0x32d737&&_0x32d737[_0x9186('0x44')]){var _0xec2990={'id':_0x32d737['id'],'tls':{'rejectUnauthorized':![]}};if(_0x32d737[_0x9186('0x44')][_0x9186('0x83')]){_0xec2990[_0x9186('0x83')]=_0x32d737['Smtp'][_0x9186('0x83')];}else{_0xec2990[_0x9186('0x81')]=_0x32d737[_0x9186('0x44')][_0x9186('0x81')];_0xec2990[_0x9186('0x82')]=_0x32d737[_0x9186('0x44')][_0x9186('0x82')];_0xec2990[_0x9186('0xb9')]=_0x32d737['Smtp']['secure'];}if(_0x32d737[_0x9186('0x44')][_0x9186('0x80')]){_0xec2990[_0x9186('0xb2')]={'user':_0x32d737['Smtp'][_0x9186('0x7b')],'pass':_0x32d737[_0x9186('0x44')][_0x9186('0x7e')]};}return respondWithRpcPromise(_0x9186('0xba'),'verifySmtp',{'account':_0xec2990});}})[_0x9186('0x27')](respondWithResult(_0x2fdd6,null))[_0x9186('0x30')](handleError(_0x2fdd6,null));};exports[_0x9186('0x3b')]=function(_0x15ce6e,_0x5ed075){return db[_0x9186('0x47')]['find']({'where':{'id':_0x15ce6e[_0x9186('0x61')]['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x5ed075,null))[_0x9186('0x27')](function(_0x511394){if(_0x511394&&_0x511394[_0x9186('0x83')]){throw new db['Sequelize']['ValidationError'](_0x9186('0xbb'));}return _0x511394;})['then'](removeEntity(_0x5ed075,null))[_0x9186('0x30')](handleError(_0x5ed075,null));};exports[_0x9186('0xbc')]=function(_0xe645f2,_0x3afc6e,_0x42841b){return db[_0x9186('0x47')]['find']({'where':{'id':_0xe645f2['params']['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x3afc6e,null))[_0x9186('0x27')](function(_0x11e8c5){if(_0x11e8c5){return _0x11e8c5[_0x9186('0xbc')](_0xe645f2[_0x9186('0x66')][_0x9186('0x74')],_[_0x9186('0x93')](_0xe645f2[_0x9186('0x66')],[_0x9186('0x74'),'id'])||{})[_0x9186('0xbd')](function(_0x169808){for(var _0x3e6af1=0x0;_0x3e6af1<_0xe645f2[_0x9186('0x66')][_0x9186('0x74')]['length'];_0x3e6af1+=0x1){socket['emit'](_0x9186('0xbe'),{'UserId':_0xe645f2[_0x9186('0x66')][_0x9186('0x74')][_0x3e6af1],'MailAccountId':_0xe645f2[_0x9186('0x61')]['id']});}return _0x169808;});}})[_0x9186('0x27')](respondWithResult(_0x3afc6e,null))[_0x9186('0x30')](handleError(_0x3afc6e,null));};exports[_0x9186('0xbf')]=function(_0x47c5c1,_0xa4bba6,_0x328c6e){return db[_0x9186('0x47')]['find']({'where':{'id':_0x47c5c1['params']['id']}})[_0x9186('0x27')](handleEntityNotFound(_0xa4bba6,null))[_0x9186('0x27')](function(_0x2a9db0){if(_0x2a9db0){return _0x2a9db0[_0x9186('0xbf')](_0x47c5c1[_0x9186('0x4c')][_0x9186('0x74')])[_0x9186('0x27')](function(){if(_[_0x9186('0xc0')](_0x47c5c1[_0x9186('0x4c')][_0x9186('0x74')])){for(var _0x3b1d1c=0x0;_0x3b1d1c<_0x47c5c1[_0x9186('0x4c')][_0x9186('0x74')][_0x9186('0x63')];_0x3b1d1c+=0x1){socket[_0x9186('0xc1')](_0x9186('0xc2'),{'UserId':Number(_0x47c5c1[_0x9186('0x4c')][_0x9186('0x74')][_0x3b1d1c]),'MailAccountId':Number(_0x47c5c1[_0x9186('0x61')]['id'])});}}else{socket[_0x9186('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x47c5c1[_0x9186('0x4c')][_0x9186('0x74')]),'MailAccountId':Number(_0x47c5c1['params']['id'])});}});}})[_0x9186('0x27')](respondWithStatusCode(_0xa4bba6,null))[_0x9186('0x30')](handleError(_0xa4bba6,null));};exports[_0x9186('0xc3')]=function(_0x1e4023,_0x15fe11,_0x293719){var _0x31e44d={};var _0x3f74e0={};var _0x20f13d;var _0x3f8677;return db['MailAccount'][_0x9186('0x6c')]({'where':{'id':_0x1e4023['params']['id']}})[_0x9186('0x27')](handleEntityNotFound(_0x15fe11,null))[_0x9186('0x27')](function(_0x53bb51){if(_0x53bb51){_0x20f13d=_0x53bb51;_0x3f74e0['model']=_[_0x9186('0x62')](db[_0x9186('0x96')][_0x9186('0x48')]);_0x3f74e0[_0x9186('0x4c')]=_[_0x9186('0x62')](_0x1e4023[_0x9186('0x4c')]);_0x3f74e0[_0x9186('0x4d')]=_['intersection'](_0x3f74e0[_0x9186('0x4f')],_0x3f74e0[_0x9186('0x4c')]);_0x31e44d['attributes']=_[_0x9186('0x4e')](_0x3f74e0[_0x9186('0x4f')],qs[_0x9186('0x51')](_0x1e4023[_0x9186('0x4c')][_0x9186('0x51')]));_0x31e44d[_0x9186('0x50')]=_0x31e44d[_0x9186('0x50')][_0x9186('0x63')]?_0x31e44d[_0x9186('0x50')]:_0x3f74e0[_0x9186('0x4f')];_0x31e44d['order']=qs['sort'](_0x1e4023[_0x9186('0x4c')][_0x9186('0x55')]);_0x31e44d[_0x9186('0x58')]=qs[_0x9186('0x4d')](_[_0x9186('0x56')](_0x1e4023['query'],_0x3f74e0[_0x9186('0x4d')]));if(_0x1e4023[_0x9186('0x4c')][_0x9186('0x57')]){_0x31e44d[_0x9186('0x58')]=_[_0x9186('0x59')](_0x31e44d[_0x9186('0x58')],{'$or':_['map'](_0x31e44d[_0x9186('0x50')],function(_0x1636ee){var _0x1fe302={};_0x1fe302[_0x1636ee]={'$like':'%'+_0x1e4023[_0x9186('0x4c')]['filter']+'%'};return _0x1fe302;})});}_0x31e44d=_[_0x9186('0x59')]({},_0x31e44d,_0x1e4023[_0x9186('0x5b')]);return _0x20f13d[_0x9186('0xc3')](_0x31e44d);}})[_0x9186('0x27')](function(_0x3a4b4c){if(_0x3a4b4c){_0x3f8677=_0x3a4b4c[_0x9186('0x63')];if(!_0x1e4023[_0x9186('0x4c')][_0x9186('0x6d')](_0x9186('0x52'))){_0x31e44d[_0x9186('0x53')]=qs[_0x9186('0x53')](_0x1e4023[_0x9186('0x4c')][_0x9186('0x53')]);_0x31e44d['offset']=qs[_0x9186('0x34')](_0x1e4023[_0x9186('0x4c')][_0x9186('0x34')]);}return _0x20f13d[_0x9186('0xc3')](_0x31e44d);}})[_0x9186('0x27')](function(_0x48c08c){if(_0x48c08c){return _0x48c08c?{'count':_0x3f8677,'rows':_0x48c08c}:null;}})[_0x9186('0x27')](respondWithResult(_0x15fe11,null))[_0x9186('0x30')](handleError(_0x15fe11,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d87bb8f..00da035 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 _0xde8e=['../../mysqldb','save','update','remove','emit','exports'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0xde8e,0x1c8));var _0xede8=function(_0x256cc1,_0x568424){_0x256cc1=_0x256cc1-0x0;var _0x330d0a=_0xde8e[_0x256cc1];return _0x330d0a;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xede8('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xede8('0x1'),'afterUpdate':_0xede8('0x2'),'afterDestroy':_0xede8('0x3')};function emitEvent(_0x21f47e){return function(_0x22e6d2,_0x4edd0a,_0xf00298){MailAccountEvents[_0xede8('0x4')](_0x21f47e+':'+_0x22e6d2['id'],_0x22e6d2);MailAccountEvents['emit'](_0x21f47e,_0x22e6d2);_0xf00298(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xede8('0x5')]=MailAccountEvents; \ No newline at end of file +var _0x1f7e=['events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x446e61,_0x1b0314){var _0xf992b=function(_0x537f0f){while(--_0x537f0f){_0x446e61['push'](_0x446e61['shift']());}};_0xf992b(++_0x1b0314);}(_0x1f7e,0x1ef));var _0xe1f7=function(_0x1833ab,_0x10e949){_0x1833ab=_0x1833ab-0x0;var _0x5adb3a=_0x1f7e[_0x1833ab];return _0x5adb3a;};'use strict';var EventEmitter=require(_0xe1f7('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xe1f7('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe1f7('0x2')](0x0);var events={'afterCreate':_0xe1f7('0x3'),'afterUpdate':_0xe1f7('0x4'),'afterDestroy':_0xe1f7('0x5')};function emitEvent(_0x346ae1){return function(_0x1fc625,_0x57b542,_0x222b80){MailAccountEvents[_0xe1f7('0x6')](_0x346ae1+':'+_0x1fc625['id'],_0x1fc625);MailAccountEvents[_0xe1f7('0x6')](_0x346ae1,_0x1fc625);_0x222b80(null);};}for(var e in events){if(events[_0xe1f7('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xe1f7('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 88274c5..1862abf 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 _0x2ba6=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','lodash'];(function(_0x1a4cf8,_0xf8146e){var _0x486716=function(_0x311580){while(--_0x311580){_0x1a4cf8['push'](_0x1a4cf8['shift']());}};_0x486716(++_0xf8146e);}(_0x2ba6,0x199));var _0x62ba=function(_0x34aef8,_0x419ebe){_0x34aef8=_0x34aef8-0x0;var _0x38b1b3=_0x2ba6[_0x34aef8];return _0x38b1b3;};'use strict';var _=require(_0x62ba('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x62ba('0x1'));var moment=require(_0x62ba('0x2'));var BPromise=require(_0x62ba('0x3'));var rp=require(_0x62ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62ba('0x5'));var config=require(_0x62ba('0x6'));var attributes=require(_0x62ba('0x7'));module[_0x62ba('0x8')]=function(_0x10108b,_0x5c73e7){return _0x10108b['define'](_0x62ba('0x9'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d3d=['exports','MailAccount','mail_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x2b1ae0,_0xd2280a){var _0x5f4d71=function(_0x514562){while(--_0x514562){_0x2b1ae0['push'](_0x2b1ae0['shift']());}};_0x5f4d71(++_0xd2280a);}(_0x1d3d,0x13b));var _0xd1d3=function(_0x297524,_0x1f308e){_0x297524=_0x297524-0x0;var _0x9bb17e=_0x1d3d[_0x297524];return _0x9bb17e;};'use strict';var _=require(_0xd1d3('0x0'));var util=require(_0xd1d3('0x1'));var logger=require(_0xd1d3('0x2'))('api');var moment=require(_0xd1d3('0x3'));var BPromise=require(_0xd1d3('0x4'));var rp=require(_0xd1d3('0x5'));var fs=require('fs');var path=require(_0xd1d3('0x6'));var rimraf=require(_0xd1d3('0x7'));var config=require(_0xd1d3('0x8'));var attributes=require(_0xd1d3('0x9'));module[_0xd1d3('0xa')]=function(_0x512fc1,_0x259b67){return _0x512fc1['define'](_0xd1d3('0xb'),attributes,{'tableName':_0xd1d3('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 2cf8616..d87f8a7 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 _0x1766=['stringify','ShowMailAccount','debug','NotifyMailAccount','body','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','CmContact','Contacts','MailApplication','MailServerOut','Smtp','get','omit','Applications','List','applications','orderBy','priority','autoclose','length','close','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','attachments','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetMailAccount'];(function(_0x3752e6,_0x4fe2b4){var _0xc8a96a=function(_0x1c664e){while(--_0x1c664e){_0x3752e6['push'](_0x3752e6['shift']());}};_0xc8a96a(++_0x4fe2b4);}(_0x1766,0xad));var _0x6176=function(_0x415dac,_0x1625ad){_0x415dac=_0x415dac-0x0;var _0x262a6e=_0x1766[_0x415dac];return _0x262a6e;};'use strict';var _=require('lodash');var util=require(_0x6176('0x0'));var moment=require(_0x6176('0x1'));var BPromise=require(_0x6176('0x2'));var rs=require(_0x6176('0x3'));var fs=require('fs');var Redis=require(_0x6176('0x4'));var db=require(_0x6176('0x5'))['db'];var utils=require(_0x6176('0x6'));var logger=require(_0x6176('0x7'))('rpc');var config=require(_0x6176('0x8'));var jayson=require(_0x6176('0x9'));var client=jayson[_0x6176('0xa')][_0x6176('0xb')]({'port':0x232c});config[_0x6176('0xc')]=_[_0x6176('0xd')](config[_0x6176('0xc')],{'host':_0x6176('0xe'),'port':0x18eb});var socket=require(_0x6176('0xf'))(new Redis(config[_0x6176('0xc')]));require(_0x6176('0x10'))[_0x6176('0x11')](socket);function respondWithRpcPromise(_0x26134a,_0x5846d4,_0x30216c){return new BPromise(function(_0x479856,_0x5d91ff){return client[_0x6176('0x12')](_0x26134a,_0x30216c)[_0x6176('0x13')](function(_0x197441){logger['info'](_0x6176('0x14'),_0x5846d4,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x5846d4,_0x6176('0x15'),JSON['stringify'](_0x197441));if(_0x197441[_0x6176('0x16')]){if(_0x197441[_0x6176('0x16')][_0x6176('0x17')]===0x1f4){logger[_0x6176('0x16')](_0x6176('0x14'),_0x5846d4,_0x197441[_0x6176('0x16')][_0x6176('0x18')]);return _0x5d91ff(_0x197441[_0x6176('0x16')][_0x6176('0x18')]);}logger['error'](_0x6176('0x14'),_0x5846d4,_0x197441[_0x6176('0x16')][_0x6176('0x18')]);return _0x479856(_0x197441[_0x6176('0x16')][_0x6176('0x18')]);}else{logger[_0x6176('0x19')](_0x6176('0x14'),_0x5846d4,_0x6176('0x15'));_0x479856(_0x197441[_0x6176('0x1a')][_0x6176('0x18')]);}})[_0x6176('0x1b')](function(_0x1ead20){logger['error'](_0x6176('0x14'),_0x5846d4,_0x1ead20);_0x5d91ff(_0x1ead20);});});}exports['GetMailAccount']=function(_0x343c2f){var _0xbf1f0e=this;return new Promise(function(_0x2720bb,_0x2ead82){return db[_0x6176('0x1c')][_0x6176('0x1d')]({'raw':_0x343c2f[_0x6176('0x1e')]?_0x343c2f[_0x6176('0x1e')][_0x6176('0x1f')]===undefined?!![]:![]:!![],'where':_0x343c2f[_0x6176('0x1e')]?_0x343c2f[_0x6176('0x1e')][_0x6176('0x20')]||null:null,'attributes':_0x343c2f[_0x6176('0x1e')]?_0x343c2f[_0x6176('0x1e')][_0x6176('0x21')]||null:null,'limit':_0x343c2f['options']?_0x343c2f[_0x6176('0x1e')][_0x6176('0x22')]||null:null,'include':_0x343c2f[_0x6176('0x1e')]?_0x343c2f[_0x6176('0x1e')][_0x6176('0x23')]?_[_0x6176('0x24')](_0x343c2f[_0x6176('0x1e')][_0x6176('0x23')],function(_0x2aa952){return{'model':db[_0x2aa952[_0x6176('0x25')]],'as':_0x2aa952['as'],'attributes':_0x2aa952[_0x6176('0x21')],'include':_0x2aa952[_0x6176('0x23')]?_['map'](_0x2aa952['include'],function(_0xe0c264){return{'model':db[_0xe0c264[_0x6176('0x25')]],'as':_0xe0c264['as'],'attributes':_0xe0c264[_0x6176('0x21')],'include':_0xe0c264[_0x6176('0x23')]?_[_0x6176('0x24')](_0xe0c264[_0x6176('0x23')],function(_0x4894fd){return{'model':db[_0x4894fd[_0x6176('0x25')]],'as':_0x4894fd['as'],'attributes':_0x4894fd[_0x6176('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6176('0x13')](function(_0x2f53f2){logger[_0x6176('0x19')](_0x6176('0x26'),_0x343c2f);logger['debug'](_0x6176('0x26'),_0x343c2f,JSON[_0x6176('0x27')](_0x2f53f2));_0x2720bb(_0x2f53f2);})[_0x6176('0x1b')](function(_0x315427){logger[_0x6176('0x16')](_0x6176('0x26'),_0x315427[_0x6176('0x18')],_0x343c2f);_0x2ead82(_0xbf1f0e['error'](0x1f4,_0x315427[_0x6176('0x18')]));});});};exports[_0x6176('0x28')]=function(_0x571b05){var _0x3d5549=this;return new Promise(function(_0x4260e7,_0x29e1e8){return db[_0x6176('0x1c')]['find']({'raw':_0x571b05[_0x6176('0x1e')]?_0x571b05[_0x6176('0x1e')][_0x6176('0x1f')]===undefined?!![]:![]:!![],'where':_0x571b05[_0x6176('0x1e')]?_0x571b05['options'][_0x6176('0x20')]||null:null,'attributes':_0x571b05['options']?_0x571b05['options']['attributes']||null:null,'include':_0x571b05['options']?_0x571b05['options'][_0x6176('0x23')]?_['map'](_0x571b05[_0x6176('0x1e')][_0x6176('0x23')],function(_0x48b1ed){return{'model':db[_0x48b1ed['model']],'as':_0x48b1ed['as'],'attributes':_0x48b1ed[_0x6176('0x21')],'include':_0x48b1ed['include']?_[_0x6176('0x24')](_0x48b1ed[_0x6176('0x23')],function(_0x1bfea5){return{'model':db[_0x1bfea5[_0x6176('0x25')]],'as':_0x1bfea5['as'],'attributes':_0x1bfea5[_0x6176('0x21')],'include':_0x1bfea5[_0x6176('0x23')]?_[_0x6176('0x24')](_0x1bfea5['include'],function(_0x5d0c73){return{'model':db[_0x5d0c73[_0x6176('0x25')]],'as':_0x5d0c73['as'],'attributes':_0x5d0c73[_0x6176('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6176('0x13')](function(_0x38a7fd){logger[_0x6176('0x19')](_0x6176('0x28'),_0x571b05);logger[_0x6176('0x29')]('ShowMailAccount',_0x571b05,JSON['stringify'](_0x38a7fd));_0x4260e7(_0x38a7fd);})[_0x6176('0x1b')](function(_0x5fbd6f){logger['error']('ShowMailAccount',_0x5fbd6f[_0x6176('0x18')],_0x571b05);_0x29e1e8(_0x3d5549['error'](0x1f4,_0x5fbd6f[_0x6176('0x18')]));});});};exports[_0x6176('0x2a')]=function(_0x2cf1f5){var _0x9d3d51=this;return new Promise(function(_0x453ad2,_0x4bd156){var _0x2ddeb8={'body':_0x2cf1f5[_0x6176('0x2b')],'channel':'mail'};var _0x2e697d=_[_0x6176('0x2c')](_[_0x6176('0x2d')](db['CmContact'][_0x6176('0x2e')]),[_0x6176('0x2f'),_0x6176('0x30'),_0x6176('0x31'),'ListId']);var _0x2b4e78=![];if(_0x2cf1f5[_0x6176('0x2b')]['id']){delete _0x2cf1f5[_0x6176('0x2b')]['id'];}if(_[_0x6176('0x32')](_0x2cf1f5[_0x6176('0x2b')]['from'])){return _0x4bd156(_0x9d3d51[_0x6176('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x6176('0x32')](_0x2cf1f5['body'][_0x6176('0x2b')])||_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x2b')]===''){return _0x4bd156(_0x9d3d51[_0x6176('0x16')](0x1f4,_0x6176('0x33')));}if(_[_0x6176('0x32')](_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x34')])){return _0x4bd156(_0x9d3d51[_0x6176('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e697d));}if(!_[_0x6176('0x35')](_0x2e697d,_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x34')])){return _0x4bd156(_0x9d3d51[_0x6176('0x16')](0x1f4,_0x6176('0x36')+_0x2e697d));}var _0x183585={};_0x183585[_0x2cf1f5['body'][_0x6176('0x34')]]=_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x37')];return db[_0x6176('0x1c')][_0x6176('0x38')]({'where':{'id':_0x2cf1f5[_0x6176('0x39')]['id']},'include':[{'model':db[_0x6176('0x3a')],'as':'List','include':[{'model':db[_0x6176('0x3b')],'as':_0x6176('0x3c'),'where':_0x183585,'limit':0x1,'order':[[_0x6176('0x30'),'DESC']]}]},{'model':db[_0x6176('0x3d')],'as':'Applications'},{'model':db[_0x6176('0x3e')],'as':_0x6176('0x3f')}]})['then'](function(_0x22bcbc){if(_0x22bcbc&&_0x22bcbc['List']){var _0x42624c=_0x22bcbc[_0x6176('0x40')]({'plain':!![]});_0x2ddeb8[_0x6176('0x39')]=_[_0x6176('0x41')](_0x42624c,[_0x6176('0x42'),_0x6176('0x43')]);_0x2ddeb8[_0x6176('0x44')]=_0x42624c[_0x6176('0x42')];_0x2ddeb8['list']=_0x42624c[_0x6176('0x43')];_0x2ddeb8[_0x6176('0x44')]=_[_0x6176('0x45')](_0x2ddeb8[_0x6176('0x44')],[_0x6176('0x46')],['asc']);if(_0x2ddeb8['account']&&_0x2ddeb8[_0x6176('0x39')][_0x6176('0x47')]){_0x2ddeb8[_0x6176('0x44')]['push']({'id':0x0,'priority':_0x2ddeb8['applications'][_0x6176('0x48')]+0x1,'app':_0x6176('0x49'),'appdata':_0x6176('0x47'),'interval':'*,*,*,*'});}if(_0x2ddeb8[_0x6176('0x39')][_0x6176('0x42')]){delete _0x2ddeb8[_0x6176('0x39')][_0x6176('0x42')];}if(_0x2ddeb8[_0x6176('0x39')][_0x6176('0x43')]){delete _0x2ddeb8[_0x6176('0x39')][_0x6176('0x43')];}if(_0x42624c[_0x6176('0x43')][_0x6176('0x3c')][_0x6176('0x48')]){return _0x42624c[_0x6176('0x43')][_0x6176('0x3c')][0x0];}var _0x11c047=_[_0x6176('0xd')](_0x2cf1f5[_0x6176('0x2b')],{'firstName':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x37')],'ListId':_0x42624c['ListId']});_0x11c047[_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x34')]]=_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x37')];return db[_0x6176('0x3b')][_0x6176('0x4a')](_0x11c047);}else{throw new Error(_0x6176('0x4b'));}})[_0x6176('0x13')](function(_0x545360){_0x2ddeb8[_0x6176('0x4c')]=_0x545360;if(_0x545360){if(!_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x4d')]){_0x2cf1f5[_0x6176('0x2b')]['message'][_0x6176('0x4d')]=rs['generate']()+'\x20'+_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x37')];}var _0x59f623={'ContactId':_0x545360['id'],'MailAccountId':_0x2cf1f5[_0x6176('0x39')]['id'],'inReplyTo':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x4d')],'to':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x37')],'cc':_0x2cf1f5['body']['message']['cc'],'subject':_0x2cf1f5['body'][_0x6176('0x18')][_0x6176('0x4e')],'attach':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x4f')],'lastMsgAt':moment()[_0x6176('0x50')](_0x6176('0x51')),'lastMsgDirection':'in'};return db[_0x6176('0x52')][_0x6176('0x38')]({'where':{'closed':![],'MailAccountId':_0x2cf1f5[_0x6176('0x39')]['id']},'include':[{'model':db[_0x6176('0x53')],'as':_0x6176('0x54'),'attributes':[_0x6176('0x4d')],'where':{'messageId':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x55')]}}]})[_0x6176('0x13')](function(_0x29be91){if(_0x29be91){return[_0x29be91,![]];}return db[_0x6176('0x52')][_0x6176('0x4a')](_0x59f623)[_0x6176('0x13')](function(_0x26d3a6){return[_0x26d3a6,!![]];});});}else{throw new Error(_0x6176('0x56'));}})[_0x6176('0x57')](function(_0x45e53a,_0x35622c){if(_0x45e53a){_0x2b4e78=_0x35622c;if(!_0x35622c){return _0x45e53a[_0x6176('0x58')]({'inReplyTo':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')]['messageId'],'to':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x37')],'cc':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')]['cc'],'subject':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x4e')],'attach':_0x45e53a['attach']?_0x45e53a[_0x6176('0x4f')]:_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x4f')],'substatus':null,'substatusAt':moment()[_0x6176('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x6176('0x50')](_0x6176('0x51')),'lastMsgDirection':'in'});}else{return _0x45e53a;}}})['then'](function(_0x5d49de){_0x2ddeb8[_0x6176('0x59')]=_0x5d49de['get']({'plain':!![]});_0x2ddeb8['interaction'][_0x6176('0x5a')]=_0x2b4e78;return db[_0x6176('0x53')]['create']({'body':_0x2cf1f5['body'][_0x6176('0x2b')],'MailAccountId':_0x2cf1f5[_0x6176('0x39')]['id'],'MailInteractionId':_0x5d49de['id'],'direction':'in','ContactId':_0x2ddeb8[_0x6176('0x4c')]['id'],'messageId':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')]['messageId'],'from':_0x2cf1f5['body']['message']['from'],'to':_0x2cf1f5[_0x6176('0x2b')]['message']['to'],'cc':_0x2cf1f5['body'][_0x6176('0x18')]['cc'],'subject':_0x2cf1f5[_0x6176('0x2b')]['message']['subject'],'attach':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x4f')],'Attachments':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x5b')],'originTo':_0x2cf1f5['body']['message']['originTo'],'originCc':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x5c')],'bcc':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')]['bcc'],'ChatWebsiteId':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x5d')]||null,'originChannel':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x5e')]||'Email','ChatOfflineMessageId':_0x2cf1f5[_0x6176('0x2b')][_0x6176('0x18')][_0x6176('0x5f')]||null},{'include':[{'model':db[_0x6176('0x60')],'as':_0x6176('0x61')}]});})[_0x6176('0x13')](function(_0x517e2a){_0x2ddeb8['message']=_0x517e2a;if(_0x2ddeb8[_0x6176('0x59')][_0x6176('0x62')]){return db[_0x6176('0x63')]['find']({'attributes':['id',_0x6176('0x64')],'where':{'id':_0x2ddeb8['interaction'][_0x6176('0x62')]}})['then'](function(_0x8caea4){if(_0x8caea4){_0x2ddeb8[_0x6176('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0x6176('0x65'),'appdata':_0x8caea4[_0x6176('0x64')]+','+(_0x2ddeb8[_0x6176('0x39')][_0x6176('0x66')]||0xa),'interval':_0x6176('0x67')});}return respondWithRpcPromise(_0x6176('0x68'),_0x6176('0x69'),_0x2ddeb8);});}return respondWithRpcPromise(_0x6176('0x68'),'startRouting',_0x2ddeb8);})['then'](function(_0x41a50d){_0x453ad2(_0x41a50d);})['catch'](function(_0x2aaccd){_0x4bd156(_0x9d3d51[_0x6176('0x16')](0x1f4,_0x2aaccd['message']));});});}; \ No newline at end of file +var _0xf527=['MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','limit','include','map','model','attributes','ShowMailAccount','find','where','NotifyMailAccount','mail','difference','keys','rawAttributes','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','account','CmList','List','CmContact','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','get','applications','list','priority','asc','autoclose','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','format'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0xf527,0x7e));var _0x7f52=function(_0x377698,_0x2ca7af){_0x377698=_0x377698-0x0;var _0x32b07d=_0xf527[_0x377698];return _0x32b07d;};'use strict';var _=require(_0x7f52('0x0'));var util=require(_0x7f52('0x1'));var moment=require(_0x7f52('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f52('0x3'));var db=require(_0x7f52('0x4'))['db'];var utils=require(_0x7f52('0x5'));var logger=require(_0x7f52('0x6'))(_0x7f52('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f52('0x8'));var client=jayson[_0x7f52('0x9')]['http']({'port':0x232c});config[_0x7f52('0xa')]=_[_0x7f52('0xb')](config[_0x7f52('0xa')],{'host':_0x7f52('0xc'),'port':0x18eb});var socket=require(_0x7f52('0xd'))(new Redis(config[_0x7f52('0xa')]));require('./mailAccount.socket')[_0x7f52('0xe')](socket);function respondWithRpcPromise(_0xb8f5f8,_0x3af26c,_0x222bce){return new BPromise(function(_0x4220e0,_0x2cd44f){return client['request'](_0xb8f5f8,_0x222bce)[_0x7f52('0xf')](function(_0x4b9bb5){logger['info'](_0x7f52('0x10'),_0x3af26c,_0x7f52('0x11'));logger[_0x7f52('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3af26c,'request\x20sent',JSON[_0x7f52('0x13')](_0x4b9bb5));if(_0x4b9bb5[_0x7f52('0x14')]){if(_0x4b9bb5[_0x7f52('0x14')][_0x7f52('0x15')]===0x1f4){logger[_0x7f52('0x14')](_0x7f52('0x10'),_0x3af26c,_0x4b9bb5[_0x7f52('0x14')]['message']);return _0x2cd44f(_0x4b9bb5[_0x7f52('0x14')][_0x7f52('0x16')]);}logger[_0x7f52('0x14')]('MailAccount,\x20%s,\x20%s',_0x3af26c,_0x4b9bb5['error'][_0x7f52('0x16')]);return _0x4220e0(_0x4b9bb5[_0x7f52('0x14')]['message']);}else{logger[_0x7f52('0x17')](_0x7f52('0x10'),_0x3af26c,'request\x20sent');_0x4220e0(_0x4b9bb5[_0x7f52('0x18')][_0x7f52('0x16')]);}})[_0x7f52('0x19')](function(_0x2a99cb){logger[_0x7f52('0x14')](_0x7f52('0x10'),_0x3af26c,_0x2a99cb);_0x2cd44f(_0x2a99cb);});});}exports[_0x7f52('0x1a')]=function(_0x555b8e){var _0x40c365=this;return new Promise(function(_0x448500,_0x28f3d8){return db[_0x7f52('0x1b')][_0x7f52('0x1c')]({'raw':_0x555b8e[_0x7f52('0x1d')]?_0x555b8e['options'][_0x7f52('0x1e')]===undefined?!![]:![]:!![],'where':_0x555b8e['options']?_0x555b8e[_0x7f52('0x1d')]['where']||null:null,'attributes':_0x555b8e[_0x7f52('0x1d')]?_0x555b8e[_0x7f52('0x1d')]['attributes']||null:null,'limit':_0x555b8e['options']?_0x555b8e[_0x7f52('0x1d')][_0x7f52('0x1f')]||null:null,'include':_0x555b8e[_0x7f52('0x1d')]?_0x555b8e[_0x7f52('0x1d')][_0x7f52('0x20')]?_[_0x7f52('0x21')](_0x555b8e[_0x7f52('0x1d')][_0x7f52('0x20')],function(_0x356e45){return{'model':db[_0x356e45[_0x7f52('0x22')]],'as':_0x356e45['as'],'attributes':_0x356e45[_0x7f52('0x23')],'include':_0x356e45[_0x7f52('0x20')]?_[_0x7f52('0x21')](_0x356e45[_0x7f52('0x20')],function(_0x3d3edc){return{'model':db[_0x3d3edc[_0x7f52('0x22')]],'as':_0x3d3edc['as'],'attributes':_0x3d3edc['attributes'],'include':_0x3d3edc[_0x7f52('0x20')]?_['map'](_0x3d3edc['include'],function(_0x5b2ac5){return{'model':db[_0x5b2ac5[_0x7f52('0x22')]],'as':_0x5b2ac5['as'],'attributes':_0x5b2ac5[_0x7f52('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7f52('0xf')](function(_0xd4684c){logger[_0x7f52('0x17')](_0x7f52('0x1a'),_0x555b8e);logger['debug'](_0x7f52('0x1a'),_0x555b8e,JSON['stringify'](_0xd4684c));_0x448500(_0xd4684c);})['catch'](function(_0x33aa38){logger['error'](_0x7f52('0x1a'),_0x33aa38[_0x7f52('0x16')],_0x555b8e);_0x28f3d8(_0x40c365[_0x7f52('0x14')](0x1f4,_0x33aa38[_0x7f52('0x16')]));});});};exports[_0x7f52('0x24')]=function(_0x5482a4){var _0x13e4ed=this;return new Promise(function(_0x57030e,_0x5c8fcf){return db['MailAccount'][_0x7f52('0x25')]({'raw':_0x5482a4[_0x7f52('0x1d')]?_0x5482a4['options'][_0x7f52('0x1e')]===undefined?!![]:![]:!![],'where':_0x5482a4[_0x7f52('0x1d')]?_0x5482a4[_0x7f52('0x1d')][_0x7f52('0x26')]||null:null,'attributes':_0x5482a4[_0x7f52('0x1d')]?_0x5482a4[_0x7f52('0x1d')][_0x7f52('0x23')]||null:null,'include':_0x5482a4[_0x7f52('0x1d')]?_0x5482a4[_0x7f52('0x1d')][_0x7f52('0x20')]?_[_0x7f52('0x21')](_0x5482a4[_0x7f52('0x1d')]['include'],function(_0x44e050){return{'model':db[_0x44e050[_0x7f52('0x22')]],'as':_0x44e050['as'],'attributes':_0x44e050[_0x7f52('0x23')],'include':_0x44e050[_0x7f52('0x20')]?_[_0x7f52('0x21')](_0x44e050[_0x7f52('0x20')],function(_0x177819){return{'model':db[_0x177819[_0x7f52('0x22')]],'as':_0x177819['as'],'attributes':_0x177819[_0x7f52('0x23')],'include':_0x177819[_0x7f52('0x20')]?_[_0x7f52('0x21')](_0x177819[_0x7f52('0x20')],function(_0x2defe2){return{'model':db[_0x2defe2['model']],'as':_0x2defe2['as'],'attributes':_0x2defe2['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f52('0xf')](function(_0x82adef){logger[_0x7f52('0x17')](_0x7f52('0x24'),_0x5482a4);logger[_0x7f52('0x12')](_0x7f52('0x24'),_0x5482a4,JSON[_0x7f52('0x13')](_0x82adef));_0x57030e(_0x82adef);})[_0x7f52('0x19')](function(_0x51d42b){logger[_0x7f52('0x14')](_0x7f52('0x24'),_0x51d42b[_0x7f52('0x16')],_0x5482a4);_0x5c8fcf(_0x13e4ed[_0x7f52('0x14')](0x1f4,_0x51d42b['message']));});});};exports[_0x7f52('0x27')]=function(_0x390010){var _0x583e54=this;return new Promise(function(_0x252b4b,_0x3decfd){var _0x443467={'body':_0x390010['body'],'channel':_0x7f52('0x28')};var _0x473f67=_[_0x7f52('0x29')](_[_0x7f52('0x2a')](db['CmContact'][_0x7f52('0x2b')]),[_0x7f52('0x2c'),'updatedAt',_0x7f52('0x2d'),_0x7f52('0x2e')]);var _0x2e613c=![];if(_0x390010[_0x7f52('0x2f')]['id']){delete _0x390010[_0x7f52('0x2f')]['id'];}if(_[_0x7f52('0x30')](_0x390010[_0x7f52('0x2f')][_0x7f52('0x31')])){return _0x3decfd(_0x583e54[_0x7f52('0x14')](0x1f4,_0x7f52('0x32')));}if(_['isNil'](_0x390010[_0x7f52('0x2f')][_0x7f52('0x2f')])||_0x390010[_0x7f52('0x2f')][_0x7f52('0x2f')]===''){return _0x3decfd(_0x583e54[_0x7f52('0x14')](0x1f4,_0x7f52('0x33')));}if(_[_0x7f52('0x30')](_0x390010[_0x7f52('0x2f')]['mapKey'])){return _0x3decfd(_0x583e54[_0x7f52('0x14')](0x1f4,_0x7f52('0x34')+_0x473f67));}if(!_[_0x7f52('0x35')](_0x473f67,_0x390010['body'][_0x7f52('0x36')])){return _0x3decfd(_0x583e54[_0x7f52('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x473f67));}var _0x9bc2c={};_0x9bc2c[_0x390010[_0x7f52('0x2f')]['mapKey']]=_0x390010[_0x7f52('0x2f')]['from'];return db[_0x7f52('0x1b')]['find']({'where':{'id':_0x390010[_0x7f52('0x37')]['id']},'include':[{'model':db[_0x7f52('0x38')],'as':_0x7f52('0x39'),'include':[{'model':db[_0x7f52('0x3a')],'as':_0x7f52('0x3b'),'where':_0x9bc2c,'limit':0x1,'order':[[_0x7f52('0x3c'),_0x7f52('0x3d')]]}]},{'model':db[_0x7f52('0x3e')],'as':_0x7f52('0x3f')},{'model':db[_0x7f52('0x40')],'as':'Smtp'}]})[_0x7f52('0xf')](function(_0x499066){if(_0x499066&&_0x499066['List']){var _0x540c99=_0x499066[_0x7f52('0x41')]({'plain':!![]});_0x443467[_0x7f52('0x37')]=_['omit'](_0x540c99,['Applications',_0x7f52('0x39')]);_0x443467[_0x7f52('0x42')]=_0x540c99['Applications'];_0x443467[_0x7f52('0x43')]=_0x540c99['List'];_0x443467[_0x7f52('0x42')]=_['orderBy'](_0x443467[_0x7f52('0x42')],[_0x7f52('0x44')],[_0x7f52('0x45')]);if(_0x443467['account']&&_0x443467[_0x7f52('0x37')][_0x7f52('0x46')]){_0x443467[_0x7f52('0x42')]['push']({'id':0x0,'priority':_0x443467[_0x7f52('0x42')][_0x7f52('0x47')]+0x1,'app':_0x7f52('0x48'),'appdata':_0x7f52('0x46'),'interval':_0x7f52('0x49')});}if(_0x443467['account'][_0x7f52('0x3f')]){delete _0x443467['account']['Applications'];}if(_0x443467[_0x7f52('0x37')][_0x7f52('0x39')]){delete _0x443467['account']['List'];}if(_0x540c99[_0x7f52('0x39')][_0x7f52('0x3b')][_0x7f52('0x47')]){return _0x540c99[_0x7f52('0x39')][_0x7f52('0x3b')][0x0];}var _0x465cc3=_[_0x7f52('0xb')](_0x390010[_0x7f52('0x2f')],{'firstName':_0x390010[_0x7f52('0x2f')][_0x7f52('0x31')],'ListId':_0x540c99[_0x7f52('0x2e')]});_0x465cc3[_0x390010['body'][_0x7f52('0x36')]]=_0x390010[_0x7f52('0x2f')][_0x7f52('0x31')];return db[_0x7f52('0x3a')]['create'](_0x465cc3);}else{throw new Error(_0x7f52('0x4a'));}})[_0x7f52('0xf')](function(_0x457ee8){_0x443467[_0x7f52('0x4b')]=_0x457ee8;if(_0x457ee8){if(!_0x390010[_0x7f52('0x2f')]['message'][_0x7f52('0x4c')]){_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')][_0x7f52('0x4c')]=rs[_0x7f52('0x4d')]()+'\x20'+_0x390010[_0x7f52('0x2f')]['message'][_0x7f52('0x31')];}var _0x167cc1={'ContactId':_0x457ee8['id'],'MailAccountId':_0x390010[_0x7f52('0x37')]['id'],'inReplyTo':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')][_0x7f52('0x4c')],'to':_0x390010['body'][_0x7f52('0x16')]['from'],'cc':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')]['cc'],'subject':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')][_0x7f52('0x4e')],'attach':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')]['attach'],'lastMsgAt':moment()[_0x7f52('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x7f52('0x25')]({'where':{'closed':![],'MailAccountId':_0x390010[_0x7f52('0x37')]['id']},'include':[{'model':db[_0x7f52('0x50')],'as':_0x7f52('0x51'),'attributes':[_0x7f52('0x4c')],'where':{'messageId':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')][_0x7f52('0x52')]}}]})['then'](function(_0xdaa0d){if(_0xdaa0d){return[_0xdaa0d,![]];}return db['MailInteraction'][_0x7f52('0x53')](_0x167cc1)[_0x7f52('0xf')](function(_0x3fb352){return[_0x3fb352,!![]];});});}else{throw new Error(_0x7f52('0x54'));}})[_0x7f52('0x55')](function(_0x326a01,_0x2a9747){if(_0x326a01){_0x2e613c=_0x2a9747;if(!_0x2a9747){return _0x326a01[_0x7f52('0x56')]({'inReplyTo':_0x390010['body'][_0x7f52('0x16')][_0x7f52('0x4c')],'to':_0x390010[_0x7f52('0x2f')]['message']['from'],'cc':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')]['cc'],'subject':_0x390010[_0x7f52('0x2f')]['message']['subject'],'attach':_0x326a01['attach']?_0x326a01[_0x7f52('0x57')]:_0x390010['body'][_0x7f52('0x16')][_0x7f52('0x57')],'substatus':null,'substatusAt':moment()[_0x7f52('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x7f52('0x58')),'lastMsgDirection':'in'});}else{return _0x326a01;}}})[_0x7f52('0xf')](function(_0x4a367b){_0x443467['interaction']=_0x4a367b['get']({'plain':!![]});_0x443467['interaction']['created']=_0x2e613c;return db['MailMessage'][_0x7f52('0x53')]({'body':_0x390010[_0x7f52('0x2f')][_0x7f52('0x2f')],'MailAccountId':_0x390010[_0x7f52('0x37')]['id'],'MailInteractionId':_0x4a367b['id'],'direction':'in','ContactId':_0x443467[_0x7f52('0x4b')]['id'],'messageId':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')][_0x7f52('0x4c')],'from':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')][_0x7f52('0x31')],'to':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')]['to'],'cc':_0x390010[_0x7f52('0x2f')]['message']['cc'],'subject':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')]['subject'],'attach':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')]['attach'],'Attachments':_0x390010['body'][_0x7f52('0x16')]['attachments'],'originTo':_0x390010['body'][_0x7f52('0x16')][_0x7f52('0x59')],'originCc':_0x390010[_0x7f52('0x2f')][_0x7f52('0x16')][_0x7f52('0x5a')],'bcc':_0x390010[_0x7f52('0x2f')]['message'][_0x7f52('0x5b')],'ChatWebsiteId':_0x390010['body']['message'][_0x7f52('0x5c')]||null,'originChannel':_0x390010['body'][_0x7f52('0x16')][_0x7f52('0x5d')]||'Email','ChatOfflineMessageId':_0x390010['body'][_0x7f52('0x16')][_0x7f52('0x5e')]||null},{'include':[{'model':db[_0x7f52('0x5f')],'as':_0x7f52('0x60')}]});})[_0x7f52('0xf')](function(_0x47ff44){_0x443467['message']=_0x47ff44;if(_0x443467['interaction']['UserId']){return db[_0x7f52('0x61')]['find']({'attributes':['id',_0x7f52('0x62')],'where':{'id':_0x443467['interaction']['UserId']}})['then'](function(_0x2d7ce6){if(_0x2d7ce6){_0x443467[_0x7f52('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7f52('0x63'),'appdata':_0x2d7ce6['name']+','+(_0x443467['account'][_0x7f52('0x64')]||0xa),'interval':_0x7f52('0x49')});}return respondWithRpcPromise('Start',_0x7f52('0x65'),_0x443467);});}return respondWithRpcPromise(_0x7f52('0x66'),_0x7f52('0x65'),_0x443467);})[_0x7f52('0xf')](function(_0x41fccf){_0x252b4b(_0x41fccf);})[_0x7f52('0x19')](function(_0x3013ff){_0x3decfd(_0x583e54[_0x7f52('0x14')](0x1f4,_0x3013ff[_0x7f52('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 20f88b0..e3843e7 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 _0xe0c1=['mailAccount:','./mailAccount.events','save','remove','update','length'];(function(_0x595764,_0x1cc566){var _0x16e598=function(_0x29a2c0){while(--_0x29a2c0){_0x595764['push'](_0x595764['shift']());}};_0x16e598(++_0x1cc566);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x484429,_0x2fb401){_0x484429=_0x484429-0x0;var _0x3b67bb=_0xe0c1[_0x484429];return _0x3b67bb;};'use strict';var MailAccountEvents=require(_0x1e0c('0x0'));var events=[_0x1e0c('0x1'),_0x1e0c('0x2'),_0x1e0c('0x3')];function createListener(_0x282c76,_0x444afa){return function(_0x3e31dd){_0x444afa['emit'](_0x282c76,_0x3e31dd);};}function removeListener(_0x565573,_0x4ad70a){return function(){MailAccountEvents['removeListener'](_0x565573,_0x4ad70a);};}exports['register']=function(_0x57c88f){for(var _0x935e3b=0x0,_0x3ccad8=events[_0x1e0c('0x4')];_0x935e3b<_0x3ccad8;_0x935e3b++){var _0x3d4bf5=events[_0x935e3b];var _0x21f9d0=createListener(_0x1e0c('0x5')+_0x3d4bf5,_0x57c88f);MailAccountEvents['on'](_0x3d4bf5,_0x21f9d0);}}; \ No newline at end of file +var _0xfd87=['./mailAccount.events','save','remove','update','emit','removeListener','length','mailAccount:'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x7fd8('0x0'));var events=[_0x7fd8('0x1'),_0x7fd8('0x2'),_0x7fd8('0x3')];function createListener(_0x11b128,_0x15d25f){return function(_0x2631d9){_0x15d25f[_0x7fd8('0x4')](_0x11b128,_0x2631d9);};}function removeListener(_0x4429f2,_0x43b442){return function(){MailAccountEvents[_0x7fd8('0x5')](_0x4429f2,_0x43b442);};}exports['register']=function(_0x1395b6){for(var _0x10a778=0x0,_0x55681d=events[_0x7fd8('0x6')];_0x10a778<_0x55681d;_0x10a778++){var _0x6eaf96=events[_0x10a778];var _0x2e2d74=createListener(_0x7fd8('0x7')+_0x6eaf96,_0x1395b6);MailAccountEvents['on'](_0x6eaf96,_0x2e2d74);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1350df3..9d5e43d 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 _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','/:id','update','delete','destroy'];(function(_0x3f6a5a,_0x41108a){var _0x54d9e3=function(_0x3ce4c8){while(--_0x3ce4c8){_0x3f6a5a['push'](_0x3f6a5a['shift']());}};_0x54d9e3(++_0x41108a);}(_0x1261,0x144));var _0x1126=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x1261[_0x13ac10];return _0x28eda2;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/:id',auth[_0x1126('0xa')](),controller[_0x1126('0xb')]);router['put'](_0x1126('0xc'),auth[_0x1126('0xa')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')](_0x1126('0xc'),auth['isAuthenticated'](),controller[_0x1126('0xf')]);module[_0x1126('0x10')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x34d470,_0x4140a6){var _0x54295a=function(_0x466f7b){while(--_0x466f7b){_0x34d470['push'](_0x34d470['shift']());}};_0x54295a(++_0x4140a6);}(_0xadb5,0xad));var _0x5adb=function(_0x3f98c0,_0x2d7c56){_0x3f98c0=_0x3f98c0-0x0;var _0x5f4ee5=_0xadb5[_0x3f98c0];return _0x5f4ee5;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./mailApplication.controller');router[_0x5adb('0x7')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xa')]);router[_0x5adb('0xb')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xc')]);router[_0x5adb('0xd')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xe')]);module[_0x5adb('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a91d2db..a674555 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 _0xd1e7=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x267c95,_0x5f3e92){var _0x510cf5=function(_0x5b43d9){while(--_0x5b43d9){_0x267c95['push'](_0x267c95['shift']());}};_0x510cf5(++_0x5f3e92);}(_0xd1e7,0x1b3));var _0x7d1e=function(_0x4d5e17,_0x48c080){_0x4d5e17=_0x4d5e17-0x0;var _0x382191=_0xd1e7[_0x4d5e17];return _0x382191;};'use strict';var Sequelize=require(_0x7d1e('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7d1e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7d1e('0x2')],'allowNull':![],'defaultValue':_0x7d1e('0x3')},'appdata':{'type':Sequelize[_0x7d1e('0x4')]()},'description':{'type':Sequelize[_0x7d1e('0x2')]},'interval':{'type':Sequelize[_0x7d1e('0x2')],'defaultValue':_0x7d1e('0x5')}}; \ No newline at end of file +var _0xdfba=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x371a1c,_0x4008f9){var _0x438bc1=function(_0x12aaae){while(--_0x12aaae){_0x371a1c['push'](_0x371a1c['shift']());}};_0x438bc1(++_0x4008f9);}(_0xdfba,0x170));var _0xadfb=function(_0x459776,_0x36de5a){_0x459776=_0x459776-0x0;var _0x3c3188=_0xdfba[_0x459776];return _0x3c3188;};'use strict';var Sequelize=require(_0xadfb('0x0'));module[_0xadfb('0x1')]={'priority':{'type':Sequelize[_0xadfb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xadfb('0x3')],'allowNull':![],'defaultValue':_0xadfb('0x4')},'appdata':{'type':Sequelize[_0xadfb('0x5')]()},'description':{'type':Sequelize[_0xadfb('0x3')]},'interval':{'type':Sequelize[_0xadfb('0x3')],'defaultValue':_0xadfb('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e7a5a3d..34ee598 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 _0xb75d=['filters','intersection','attributes','fields','includeAll','include','options','MailApplication','find','body','params','catch','eml-format','rimraf','zip-dir','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','save','update','then','stack','name','send','show','model','keys','rawAttributes','query'];(function(_0x1ec57b,_0x539209){var _0x3c57b8=function(_0xefbb9f){while(--_0xefbb9f){_0x1ec57b['push'](_0x1ec57b['shift']());}};_0x3c57b8(++_0x539209);}(_0xb75d,0xec));var _0xdb75=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0xb75d[_0xe1b5f6];return _0x44636e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdb75('0x0'));var rimraf=require(_0xdb75('0x1'));var zipdir=require(_0xdb75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdb75('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdb75('0x4'));var util=require(_0xdb75('0x5'));var path=require(_0xdb75('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb75('0x7'));var _=require(_0xdb75('0x8'));var squel=require(_0xdb75('0x9'));var crypto=require(_0xdb75('0xa'));var jsforce=require(_0xdb75('0xb'));var deskjs=require(_0xdb75('0xc'));var toCsv=require(_0xdb75('0xd'));var querystring=require(_0xdb75('0xe'));var Papa=require(_0xdb75('0xf'));var Redis=require(_0xdb75('0x10'));var authService=require(_0xdb75('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb75('0x12'));var hardwareService=require(_0xdb75('0x13'));var logger=require('../../config/logger')(_0xdb75('0x14'));var utils=require(_0xdb75('0x15'));var config=require(_0xdb75('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb75('0x17'))['db'];function respondWithStatusCode(_0x5e0401,_0xa62096){_0xa62096=_0xa62096||0xcc;return function(_0x32b203){if(_0x32b203){return _0x5e0401[_0xdb75('0x18')](_0xa62096);}return _0x5e0401['status'](_0xa62096)[_0xdb75('0x19')]();};}function respondWithResult(_0x1f1a76,_0x27a957){_0x27a957=_0x27a957||0xc8;return function(_0x4a6906){if(_0x4a6906){return _0x1f1a76[_0xdb75('0x1a')](_0x27a957)[_0xdb75('0x1b')](_0x4a6906);}};}function respondWithFilteredResult(_0x40d1a3,_0x55e4df){return function(_0x5b375e){if(_0x5b375e){var _0x3d3b80=_0x5b375e['count'],_0xc1ba44=_0x55e4df['offset'],_0x248bb2=_0x55e4df[_0xdb75('0x1c')]+_0x55e4df[_0xdb75('0x1d')],_0x3c18b2;if(_0x248bb2>=_0x3d3b80){_0x248bb2=_0x3d3b80;_0x3c18b2=0xc8;}else{_0x3c18b2=0xce;}_0x40d1a3['status'](_0x3c18b2);return _0x40d1a3[_0xdb75('0x1e')]('Content-Range',_0xc1ba44+'-'+_0x248bb2+'/'+_0x3d3b80)[_0xdb75('0x1b')](_0x5b375e);}return null;};}function patchUpdates(_0x1178d0){return function(_0x57a863){try{jsonpatch[_0xdb75('0x1f')](_0x57a863,_0x1178d0,!![]);}catch(_0x16423c){return BPromise[_0xdb75('0x20')](_0x16423c);}return _0x57a863[_0xdb75('0x21')]();};}function saveUpdates(_0x5afe08,_0xbe6496){return function(_0x5c744){if(_0x5c744){return _0x5c744[_0xdb75('0x22')](_0x5afe08)[_0xdb75('0x23')](function(_0x223a31){return _0x223a31;});}return null;};}function removeEntity(_0x168383,_0x17760e){return function(_0x5677fd){if(_0x5677fd){return _0x5677fd['destroy']()['then'](function(){_0x168383['status'](0xcc)[_0xdb75('0x19')]();});}};}function handleEntityNotFound(_0x12ad61,_0x3b9c43){return function(_0x3f2863){if(!_0x3f2863){_0x12ad61[_0xdb75('0x18')](0x194);}return _0x3f2863;};}function handleError(_0x2b1eeb,_0x5605ab){_0x5605ab=_0x5605ab||0x1f4;return function(_0x201cb9){logger['error'](_0x201cb9[_0xdb75('0x24')]);if(_0x201cb9[_0xdb75('0x25')]){delete _0x201cb9[_0xdb75('0x25')];}_0x2b1eeb['status'](_0x5605ab)[_0xdb75('0x26')](_0x201cb9);};}exports[_0xdb75('0x27')]=function(_0x55dc14,_0x413509){var _0x33ad0e={'raw':!![],'where':{'id':_0x55dc14['params']['id']}},_0x2eba08={};_0x2eba08[_0xdb75('0x28')]=_[_0xdb75('0x29')](db['MailApplication'][_0xdb75('0x2a')]);_0x2eba08['query']=_['keys'](_0x55dc14[_0xdb75('0x2b')]);_0x2eba08[_0xdb75('0x2c')]=_[_0xdb75('0x2d')](_0x2eba08[_0xdb75('0x28')],_0x2eba08['query']);_0x33ad0e[_0xdb75('0x2e')]=_[_0xdb75('0x2d')](_0x2eba08[_0xdb75('0x28')],qs[_0xdb75('0x2f')](_0x55dc14[_0xdb75('0x2b')]['fields']));_0x33ad0e['attributes']=_0x33ad0e[_0xdb75('0x2e')]['length']?_0x33ad0e[_0xdb75('0x2e')]:_0x2eba08[_0xdb75('0x28')];if(_0x55dc14[_0xdb75('0x2b')][_0xdb75('0x30')]){_0x33ad0e[_0xdb75('0x31')]=[{'all':!![]}];}_0x33ad0e=_['merge']({},_0x33ad0e,_0x55dc14[_0xdb75('0x32')]);return db[_0xdb75('0x33')][_0xdb75('0x34')](_0x33ad0e)[_0xdb75('0x23')](handleEntityNotFound(_0x413509,null))['then'](respondWithResult(_0x413509,null))['catch'](handleError(_0x413509,null));};exports[_0xdb75('0x22')]=function(_0x5b044d,_0x5f0912){if(_0x5b044d[_0xdb75('0x35')]['id']){delete _0x5b044d[_0xdb75('0x35')]['id'];}return db[_0xdb75('0x33')]['find']({'where':{'id':_0x5b044d[_0xdb75('0x36')]['id']}})[_0xdb75('0x23')](handleEntityNotFound(_0x5f0912,null))[_0xdb75('0x23')](saveUpdates(_0x5b044d[_0xdb75('0x35')],null))[_0xdb75('0x23')](respondWithResult(_0x5f0912,null))['catch'](handleError(_0x5f0912,null));};exports['destroy']=function(_0x18ced9,_0x7169b9){return db[_0xdb75('0x33')]['find']({'where':{'id':_0x18ced9[_0xdb75('0x36')]['id']}})[_0xdb75('0x23')](handleEntityNotFound(_0x7169b9,null))[_0xdb75('0x23')](removeEntity(_0x7169b9,null))[_0xdb75('0x37')](handleError(_0x7169b9,null));}; \ No newline at end of file +var _0xf2ba=['MailApplication','query','filters','model','attributes','intersection','fields','length','includeAll','options','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','destroy','name','show','params','keys'];(function(_0x42e176,_0x2af13b){var _0x5a32d9=function(_0x439d93){while(--_0x439d93){_0x42e176['push'](_0x42e176['shift']());}};_0x5a32d9(++_0x2af13b);}(_0xf2ba,0x151));var _0xaf2b=function(_0x571d85,_0xda439c){_0x571d85=_0x571d85-0x0;var _0x3c2e07=_0xf2ba[_0x571d85];return _0x3c2e07;};'use strict';var pdf=require(_0xaf2b('0x0'));var emlformat=require(_0xaf2b('0x1'));var rimraf=require(_0xaf2b('0x2'));var zipdir=require(_0xaf2b('0x3'));var jsonpatch=require(_0xaf2b('0x4'));var rp=require(_0xaf2b('0x5'));var moment=require(_0xaf2b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf2b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xaf2b('0x8'));var ejs=require(_0xaf2b('0x9'));var fs=require('fs');var fs_extra=require(_0xaf2b('0xa'));var _=require(_0xaf2b('0xb'));var squel=require(_0xaf2b('0xc'));var crypto=require(_0xaf2b('0xd'));var jsforce=require(_0xaf2b('0xe'));var deskjs=require(_0xaf2b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaf2b('0x10'));var Redis=require(_0xaf2b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaf2b('0x12'));var as=require(_0xaf2b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf2b('0x14'))('api');var utils=require(_0xaf2b('0x15'));var config=require(_0xaf2b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf2b('0x17'))['db'];function respondWithStatusCode(_0x26198d,_0x1030ac){_0x1030ac=_0x1030ac||0xcc;return function(_0x289ff9){if(_0x289ff9){return _0x26198d[_0xaf2b('0x18')](_0x1030ac);}return _0x26198d[_0xaf2b('0x19')](_0x1030ac)[_0xaf2b('0x1a')]();};}function respondWithResult(_0x115b26,_0x431b4c){_0x431b4c=_0x431b4c||0xc8;return function(_0xbef2bf){if(_0xbef2bf){return _0x115b26[_0xaf2b('0x19')](_0x431b4c)['json'](_0xbef2bf);}};}function respondWithFilteredResult(_0x2727a1,_0x1a2d53){return function(_0x1c1355){if(_0x1c1355){var _0xacd19d=_0x1c1355[_0xaf2b('0x1b')],_0x3357e5=_0x1a2d53[_0xaf2b('0x1c')],_0x46bf0a=_0x1a2d53[_0xaf2b('0x1c')]+_0x1a2d53[_0xaf2b('0x1d')],_0x5ab105;if(_0x46bf0a>=_0xacd19d){_0x46bf0a=_0xacd19d;_0x5ab105=0xc8;}else{_0x5ab105=0xce;}_0x2727a1[_0xaf2b('0x19')](_0x5ab105);return _0x2727a1[_0xaf2b('0x1e')]('Content-Range',_0x3357e5+'-'+_0x46bf0a+'/'+_0xacd19d)['json'](_0x1c1355);}return null;};}function patchUpdates(_0x32ab49){return function(_0x4c4e28){try{jsonpatch[_0xaf2b('0x1f')](_0x4c4e28,_0x32ab49,!![]);}catch(_0x544e39){return BPromise[_0xaf2b('0x20')](_0x544e39);}return _0x4c4e28[_0xaf2b('0x21')]();};}function saveUpdates(_0x435976,_0x55c1ee){return function(_0x26b66e){if(_0x26b66e){return _0x26b66e[_0xaf2b('0x22')](_0x435976)[_0xaf2b('0x23')](function(_0x374e95){return _0x374e95;});}return null;};}function removeEntity(_0x230a44,_0x13356b){return function(_0x394b71){if(_0x394b71){return _0x394b71[_0xaf2b('0x24')]()[_0xaf2b('0x23')](function(){_0x230a44[_0xaf2b('0x19')](0xcc)[_0xaf2b('0x1a')]();});}};}function handleEntityNotFound(_0x2b88d3,_0x13d15d){return function(_0x141a39){if(!_0x141a39){_0x2b88d3[_0xaf2b('0x18')](0x194);}return _0x141a39;};}function handleError(_0x10ae6d,_0x3f3dd8){_0x3f3dd8=_0x3f3dd8||0x1f4;return function(_0x4d28eb){logger['error'](_0x4d28eb['stack']);if(_0x4d28eb[_0xaf2b('0x25')]){delete _0x4d28eb[_0xaf2b('0x25')];}_0x10ae6d['status'](_0x3f3dd8)['send'](_0x4d28eb);};}exports[_0xaf2b('0x26')]=function(_0x35b986,_0x43e04d){var _0x42c619={'raw':!![],'where':{'id':_0x35b986[_0xaf2b('0x27')]['id']}},_0x3fb80a={};_0x3fb80a['model']=_[_0xaf2b('0x28')](db[_0xaf2b('0x29')]['rawAttributes']);_0x3fb80a[_0xaf2b('0x2a')]=_['keys'](_0x35b986[_0xaf2b('0x2a')]);_0x3fb80a[_0xaf2b('0x2b')]=_['intersection'](_0x3fb80a[_0xaf2b('0x2c')],_0x3fb80a[_0xaf2b('0x2a')]);_0x42c619[_0xaf2b('0x2d')]=_[_0xaf2b('0x2e')](_0x3fb80a[_0xaf2b('0x2c')],qs[_0xaf2b('0x2f')](_0x35b986[_0xaf2b('0x2a')]['fields']));_0x42c619[_0xaf2b('0x2d')]=_0x42c619[_0xaf2b('0x2d')][_0xaf2b('0x30')]?_0x42c619[_0xaf2b('0x2d')]:_0x3fb80a[_0xaf2b('0x2c')];if(_0x35b986[_0xaf2b('0x2a')][_0xaf2b('0x31')]){_0x42c619['include']=[{'all':!![]}];}_0x42c619=_['merge']({},_0x42c619,_0x35b986[_0xaf2b('0x32')]);return db[_0xaf2b('0x29')][_0xaf2b('0x33')](_0x42c619)[_0xaf2b('0x23')](handleEntityNotFound(_0x43e04d,null))['then'](respondWithResult(_0x43e04d,null))[_0xaf2b('0x34')](handleError(_0x43e04d,null));};exports['update']=function(_0x3f64af,_0x2fc8f9){if(_0x3f64af[_0xaf2b('0x35')]['id']){delete _0x3f64af[_0xaf2b('0x35')]['id'];}return db[_0xaf2b('0x29')][_0xaf2b('0x33')]({'where':{'id':_0x3f64af[_0xaf2b('0x27')]['id']}})[_0xaf2b('0x23')](handleEntityNotFound(_0x2fc8f9,null))['then'](saveUpdates(_0x3f64af[_0xaf2b('0x35')],null))[_0xaf2b('0x23')](respondWithResult(_0x2fc8f9,null))['catch'](handleError(_0x2fc8f9,null));};exports['destroy']=function(_0x21d58e,_0x11e0f9){return db[_0xaf2b('0x29')][_0xaf2b('0x33')]({'where':{'id':_0x21d58e['params']['id']}})[_0xaf2b('0x23')](handleEntityNotFound(_0x11e0f9,null))['then'](removeEntity(_0x11e0f9,null))[_0xaf2b('0x34')](handleError(_0x11e0f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index cfe9e55..93a82d8 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 _0x6d0c=['api','moment','bluebird','path','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x4a0e45,_0x2fe983){var _0x131bad=function(_0x1ab3d5){while(--_0x1ab3d5){_0x4a0e45['push'](_0x4a0e45['shift']());}};_0x131bad(++_0x2fe983);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x357a2e,_0x273786){_0x357a2e=_0x357a2e-0x0;var _0x5503e1=_0x6d0c[_0x357a2e];return _0x5503e1;};'use strict';var _=require(_0xc6d0('0x0'));var util=require(_0xc6d0('0x1'));var logger=require(_0xc6d0('0x2'))(_0xc6d0('0x3'));var moment=require(_0xc6d0('0x4'));var BPromise=require(_0xc6d0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6d0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc6d0('0x7'));module['exports']=function(_0x589214,_0xdae4c3){return _0x589214[_0xc6d0('0x8')](_0xc6d0('0x9'),attributes,{'tableName':_0xc6d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc6d0('0xb'),'collate':_0xc6d0('0xc')});}; \ No newline at end of file +var _0x7af9=['../../config/environment','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1c8225,_0x1dac7c){var _0x45489b=function(_0x48ffbd){while(--_0x48ffbd){_0x1c8225['push'](_0x1c8225['shift']());}};_0x45489b(++_0x1dac7c);}(_0x7af9,0x95));var _0x97af=function(_0x5cce38,_0x1b9946){_0x5cce38=_0x5cce38-0x0;var _0x555756=_0x7af9[_0x5cce38];return _0x555756;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var logger=require(_0x97af('0x1'))(_0x97af('0x2'));var moment=require('moment');var BPromise=require(_0x97af('0x3'));var rp=require(_0x97af('0x4'));var fs=require('fs');var path=require(_0x97af('0x5'));var rimraf=require(_0x97af('0x6'));var config=require(_0x97af('0x7'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x4e2dff,_0x440a77){return _0x4e2dff[_0x97af('0x8')](_0x97af('0x9'),attributes,{'tableName':_0x97af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x97af('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ab9f890..b991254 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 _0x7fa2=['stringify','error','code','message','MailApplication,\x20%s,\x20%s','info','result','catch','UpdateMailApplication','update','body','raw','options','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7fa2,0x66));var _0x27fa=function(_0x32814c,_0x2a68f5){_0x32814c=_0x32814c-0x0;var _0x394c8d=_0x7fa2[_0x32814c];return _0x394c8d;};'use strict';var _=require(_0x27fa('0x0'));var util=require(_0x27fa('0x1'));var moment=require('moment');var BPromise=require(_0x27fa('0x2'));var rs=require(_0x27fa('0x3'));var fs=require('fs');var Redis=require(_0x27fa('0x4'));var db=require(_0x27fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x27fa('0x6'));var jayson=require(_0x27fa('0x7'));var client=jayson[_0x27fa('0x8')][_0x27fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fb90f,_0x2ccef3,_0x461fab){return new BPromise(function(_0x50c95c,_0x55aa2d){return client[_0x27fa('0xa')](_0x1fb90f,_0x461fab)[_0x27fa('0xb')](function(_0x1db345){logger['info']('MailApplication,\x20%s,\x20%s',_0x2ccef3,_0x27fa('0xc'));logger[_0x27fa('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2ccef3,'request\x20sent',JSON[_0x27fa('0xe')](_0x1db345));if(_0x1db345[_0x27fa('0xf')]){if(_0x1db345[_0x27fa('0xf')][_0x27fa('0x10')]===0x1f4){logger[_0x27fa('0xf')]('MailApplication,\x20%s,\x20%s',_0x2ccef3,_0x1db345['error']['message']);return _0x55aa2d(_0x1db345[_0x27fa('0xf')][_0x27fa('0x11')]);}logger[_0x27fa('0xf')](_0x27fa('0x12'),_0x2ccef3,_0x1db345[_0x27fa('0xf')][_0x27fa('0x11')]);return _0x50c95c(_0x1db345[_0x27fa('0xf')][_0x27fa('0x11')]);}else{logger[_0x27fa('0x13')](_0x27fa('0x12'),_0x2ccef3,'request\x20sent');_0x50c95c(_0x1db345[_0x27fa('0x14')][_0x27fa('0x11')]);}})[_0x27fa('0x15')](function(_0x403b0d){logger[_0x27fa('0xf')](_0x27fa('0x12'),_0x2ccef3,_0x403b0d);_0x55aa2d(_0x403b0d);});});}exports[_0x27fa('0x16')]=function(_0x5ba271){var _0x44a98b=this;return new Promise(function(_0x327345,_0x3f3768){return db['MailApplication'][_0x27fa('0x17')](_0x5ba271[_0x27fa('0x18')],{'raw':_0x5ba271['options']?_0x5ba271['options'][_0x27fa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba271[_0x27fa('0x1a')]?_0x5ba271[_0x27fa('0x1a')][_0x27fa('0x1b')]||null:null,'attributes':_0x5ba271['options']?_0x5ba271[_0x27fa('0x1a')][_0x27fa('0x1c')]||null:null,'limit':_0x5ba271['options']?_0x5ba271[_0x27fa('0x1a')]['limit']||null:null})[_0x27fa('0xb')](function(_0x16b7a6){logger['info'](_0x27fa('0x16'),_0x5ba271);logger[_0x27fa('0xd')](_0x27fa('0x16'),_0x5ba271,JSON[_0x27fa('0xe')](_0x16b7a6));_0x327345(_0x16b7a6);})[_0x27fa('0x15')](function(_0x4a4835){logger[_0x27fa('0xf')]('UpdateMailApplication',_0x4a4835['message'],_0x5ba271);_0x3f3768(_0x44a98b[_0x27fa('0xf')](0x1f4,_0x4a4835[_0x27fa('0x11')]));});});}; \ No newline at end of file +var _0xde1b=['request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x2abd13,_0x501317){var _0x5ad645=function(_0x55ae11){while(--_0x55ae11){_0x2abd13['push'](_0x2abd13['shift']());}};_0x5ad645(++_0x501317);}(_0xde1b,0x128));var _0xbde1=function(_0x179042,_0x47a3b8){_0x179042=_0x179042-0x0;var _0x568997=_0xde1b[_0x179042];return _0x568997;};'use strict';var _=require(_0xbde1('0x0'));var util=require('util');var moment=require(_0xbde1('0x1'));var BPromise=require(_0xbde1('0x2'));var rs=require(_0xbde1('0x3'));var fs=require('fs');var Redis=require(_0xbde1('0x4'));var db=require(_0xbde1('0x5'))['db'];var utils=require(_0xbde1('0x6'));var logger=require(_0xbde1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbde1('0x8'));var client=jayson[_0xbde1('0x9')][_0xbde1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907388,_0x53c2e1,_0x2f4565){return new BPromise(function(_0x7dc7f,_0x4b32ce){return client[_0xbde1('0xb')](_0x907388,_0x2f4565)[_0xbde1('0xc')](function(_0x478b18){logger[_0xbde1('0xd')]('MailApplication,\x20%s,\x20%s',_0x53c2e1,_0xbde1('0xe'));logger['debug'](_0xbde1('0xf'),_0x53c2e1,_0xbde1('0xe'),JSON[_0xbde1('0x10')](_0x478b18));if(_0x478b18[_0xbde1('0x11')]){if(_0x478b18['error']['code']===0x1f4){logger[_0xbde1('0x11')](_0xbde1('0x12'),_0x53c2e1,_0x478b18[_0xbde1('0x11')][_0xbde1('0x13')]);return _0x4b32ce(_0x478b18[_0xbde1('0x11')][_0xbde1('0x13')]);}logger[_0xbde1('0x11')](_0xbde1('0x12'),_0x53c2e1,_0x478b18[_0xbde1('0x11')][_0xbde1('0x13')]);return _0x7dc7f(_0x478b18[_0xbde1('0x11')][_0xbde1('0x13')]);}else{logger[_0xbde1('0xd')]('MailApplication,\x20%s,\x20%s',_0x53c2e1,_0xbde1('0xe'));_0x7dc7f(_0x478b18[_0xbde1('0x14')][_0xbde1('0x13')]);}})[_0xbde1('0x15')](function(_0x58db8e){logger['error']('MailApplication,\x20%s,\x20%s',_0x53c2e1,_0x58db8e);_0x4b32ce(_0x58db8e);});});}exports[_0xbde1('0x16')]=function(_0x323dcd){var _0x580fd3=this;return new Promise(function(_0x261ed2,_0xd4773c){return db[_0xbde1('0x17')][_0xbde1('0x18')](_0x323dcd[_0xbde1('0x19')],{'raw':_0x323dcd[_0xbde1('0x1a')]?_0x323dcd[_0xbde1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x323dcd['options']?_0x323dcd[_0xbde1('0x1a')][_0xbde1('0x1b')]||null:null,'attributes':_0x323dcd[_0xbde1('0x1a')]?_0x323dcd[_0xbde1('0x1a')][_0xbde1('0x1c')]||null:null,'limit':_0x323dcd[_0xbde1('0x1a')]?_0x323dcd[_0xbde1('0x1a')][_0xbde1('0x1d')]||null:null})[_0xbde1('0xc')](function(_0x38c313){logger['info'](_0xbde1('0x16'),_0x323dcd);logger[_0xbde1('0x1e')](_0xbde1('0x16'),_0x323dcd,JSON[_0xbde1('0x10')](_0x38c313));_0x261ed2(_0x38c313);})[_0xbde1('0x15')](function(_0x42d0e8){logger[_0xbde1('0x11')](_0xbde1('0x16'),_0x42d0e8[_0xbde1('0x13')],_0x323dcd);_0xd4773c(_0x580fd3['error'](0x1f4,_0x42d0e8[_0xbde1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8664cf8..bc2d549 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 _0xe637=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','multer'];(function(_0x1f1ada,_0x578d0d){var _0x16362e=function(_0x257d3c){while(--_0x257d3c){_0x1f1ada['push'](_0x1f1ada['shift']());}};_0x16362e(++_0x578d0d);}(_0xe637,0x83));var _0x7e63=function(_0x56de39,_0x38084c){_0x56de39=_0x56de39-0x0;var _0x42228b=_0xe637[_0x56de39];return _0x42228b;};'use strict';var multer=require(_0x7e63('0x0'));var util=require(_0x7e63('0x1'));var path=require(_0x7e63('0x2'));var timeout=require(_0x7e63('0x3'));var express=require('express');var router=express[_0x7e63('0x4')]();var fs_extra=require(_0x7e63('0x5'));var auth=require(_0x7e63('0x6'));var interaction=require(_0x7e63('0x7'));var config=require(_0x7e63('0x8'));var controller=require('./mailInteraction.controller');router[_0x7e63('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e63('0xa')]);router[_0x7e63('0x9')](_0x7e63('0xb'),auth[_0x7e63('0xc')](),controller['describe']);router['get'](_0x7e63('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7e63('0x9')](_0x7e63('0xe'),auth[_0x7e63('0xc')](),controller[_0x7e63('0xf')]);router[_0x7e63('0x9')](_0x7e63('0x10'),auth[_0x7e63('0xc')](),controller[_0x7e63('0x11')]);router[_0x7e63('0x12')]('/',auth[_0x7e63('0xc')](),controller[_0x7e63('0x13')]);router[_0x7e63('0x12')]('/:id/messages',auth[_0x7e63('0xc')](),controller[_0x7e63('0x14')]);router[_0x7e63('0x12')](_0x7e63('0x15'),auth[_0x7e63('0xc')](),interaction[_0x7e63('0x16')]('mail',_0x7e63('0x17')),controller[_0x7e63('0x18')]);router[_0x7e63('0x19')]('/:id',auth[_0x7e63('0xc')](),interaction[_0x7e63('0x16')](_0x7e63('0x1a'),_0x7e63('0x1b')),controller[_0x7e63('0x1c')]);router[_0x7e63('0x1d')](_0x7e63('0xd'),auth[_0x7e63('0xc')](),interaction[_0x7e63('0x16')](_0x7e63('0x1a'),_0x7e63('0x1e')),controller[_0x7e63('0x1f')]);router[_0x7e63('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x7e63('0x20')]=router; \ No newline at end of file +var _0x1bf9=['mailinteraction:update','update','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailInteraction.controller','index','get','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','tracked','mail','mailinteraction:addtags','addTags','put'];(function(_0x3bc7da,_0x56298c){var _0x154dad=function(_0x58dc6d){while(--_0x58dc6d){_0x3bc7da['push'](_0x3bc7da['shift']());}};_0x154dad(++_0x56298c);}(_0x1bf9,0xc7));var _0x91bf=function(_0x17b705,_0x1cd948){_0x17b705=_0x17b705-0x0;var _0x54b7ba=_0x1bf9[_0x17b705];return _0x54b7ba;};'use strict';var multer=require(_0x91bf('0x0'));var util=require(_0x91bf('0x1'));var path=require('path');var timeout=require(_0x91bf('0x2'));var express=require(_0x91bf('0x3'));var router=express[_0x91bf('0x4')]();var fs_extra=require(_0x91bf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x91bf('0x6'));var config=require(_0x91bf('0x7'));var controller=require(_0x91bf('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x91bf('0x9')]);router[_0x91bf('0xa')]('/describe',auth[_0x91bf('0xb')](),controller[_0x91bf('0xc')]);router['get'](_0x91bf('0xd'),auth[_0x91bf('0xb')](),controller['show']);router['get'](_0x91bf('0xe'),auth[_0x91bf('0xb')](),controller[_0x91bf('0xf')]);router[_0x91bf('0xa')](_0x91bf('0x10'),auth[_0x91bf('0xb')](),controller[_0x91bf('0x11')]);router['post']('/',auth[_0x91bf('0xb')](),controller[_0x91bf('0x12')]);router[_0x91bf('0x13')](_0x91bf('0xe'),auth[_0x91bf('0xb')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x91bf('0x14')](_0x91bf('0x15'),_0x91bf('0x16')),controller[_0x91bf('0x17')]);router[_0x91bf('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x91bf('0x14')](_0x91bf('0x15'),_0x91bf('0x19')),controller[_0x91bf('0x1a')]);router['delete'](_0x91bf('0xd'),auth[_0x91bf('0xb')](),interaction[_0x91bf('0x14')](_0x91bf('0x15'),_0x91bf('0x1b')),controller[_0x91bf('0x1c')]);router['delete'](_0x91bf('0x1d'),auth[_0x91bf('0xb')](),controller[_0x91bf('0x1e')]);module[_0x91bf('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 2e264de..5dc97f1 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 _0x218d=['TEXT','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','long'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x218d,0x143));var _0xd218=function(_0x5e0616,_0x4b72dc){_0x5e0616=_0x5e0616-0x0;var _0x594d6b=_0x218d[_0x5e0616];return _0x594d6b;};'use strict';var Sequelize=require(_0xd218('0x0'));var iconv=require(_0xd218('0x1'));module[_0xd218('0x2')]={'closed':{'type':Sequelize[_0xd218('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd218('0x4')]},'disposition':{'type':Sequelize[_0xd218('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd218('0x5')]},'note':{'type':Sequelize[_0xd218('0x5')]},'inReplyTo':{'type':Sequelize[_0xd218('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0xd218('0x6'))},'subject':{'type':Sequelize[_0xd218('0x7')]()},'attach':{'type':Sequelize[_0xd218('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd218('0x4')]},'substatus':{'type':Sequelize[_0xd218('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd218('0x8')]('in',_0xd218('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd218('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd218('0x9')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xab9c=['ENUM','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','out'];(function(_0x1e54cb,_0x3c9c47){var _0x4aaa61=function(_0x40374b){while(--_0x40374b){_0x1e54cb['push'](_0x1e54cb['shift']());}};_0x4aaa61(++_0x3c9c47);}(_0xab9c,0xd0));var _0xcab9=function(_0x418683,_0x7ddf89){_0x418683=_0x418683-0x0;var _0x1fbead=_0xab9c[_0x418683];return _0x1fbead;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xcab9('0x0'));module[_0xcab9('0x1')]={'closed':{'type':Sequelize[_0xcab9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcab9('0x3')]},'disposition':{'type':Sequelize[_0xcab9('0x4')]},'secondDisposition':{'type':Sequelize[_0xcab9('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcab9('0x4')]},'note':{'type':Sequelize[_0xcab9('0x4')]},'inReplyTo':{'type':Sequelize[_0xcab9('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xcab9('0x5')](_0xcab9('0x6'))},'subject':{'type':Sequelize[_0xcab9('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcab9('0x3')]},'substatus':{'type':Sequelize[_0xcab9('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xcab9('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xcab9('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcab9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xcab9('0x8')]('in',_0xcab9('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 5c56d85..7f9056c 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 _0x54ee=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','MailMessage','findOne','out','lastMsgText','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','length','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','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','text','plainBody','some','compact','MailAccountId','concat','createdAt','parse','$gte','$lte','where','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','MailInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','push','all','catch','show','params','rawAttributes','includeAll','create','body','describe','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','rows','addTags','spread','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','writeFileSync','message%d.eml','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xed287d,_0xee0593){var _0x306816=function(_0x2b56a8){while(--_0x2b56a8){_0xed287d['push'](_0xed287d['shift']());}};_0x306816(++_0xee0593);}(_0x54ee,0x1e2));var _0xe54e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x54ee[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0xe54e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe54e('0x1'));var jsonpatch=require(_0xe54e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe54e('0x3'));var Mustache=require(_0xe54e('0x4'));var util=require('util');var path=require(_0xe54e('0x5'));var sox=require(_0xe54e('0x6'));var csv=require(_0xe54e('0x7'));var ejs=require(_0xe54e('0x8'));var fs=require('fs');var fs_extra=require(_0xe54e('0x9'));var _=require(_0xe54e('0xa'));var squel=require(_0xe54e('0xb'));var crypto=require(_0xe54e('0xc'));var jsforce=require(_0xe54e('0xd'));var deskjs=require(_0xe54e('0xe'));var toCsv=require(_0xe54e('0x7'));var querystring=require('querystring');var Papa=require(_0xe54e('0xf'));var htmlToText=require(_0xe54e('0x10'));var juice=require('juice');var Redis=require(_0xe54e('0x11'));var authService=require(_0xe54e('0x12'));var qs=require(_0xe54e('0x13'));var as=require(_0xe54e('0x14'));var hardwareService=require(_0xe54e('0x15'));var logger=require(_0xe54e('0x16'))(_0xe54e('0x17'));var utils=require(_0xe54e('0x18'));var config=require(_0xe54e('0x19'));var licenseUtil=require(_0xe54e('0x1a'));var db=require(_0xe54e('0x1b'))['db'];config[_0xe54e('0x1c')]=_[_0xe54e('0x1d')](config[_0xe54e('0x1c')],{'host':_0xe54e('0x1e'),'port':0x18eb});var socket=require(_0xe54e('0x1f'))(new Redis(config['redis']));require(_0xe54e('0x20'))[_0xe54e('0x21')](socket);function respondWithStatusCode(_0x402c02,_0x14572b){_0x14572b=_0x14572b||0xcc;return function(_0x23aa39){if(_0x23aa39){return _0x402c02[_0xe54e('0x22')](_0x14572b);}return _0x402c02[_0xe54e('0x23')](_0x14572b)[_0xe54e('0x24')]();};}function respondWithResult(_0xe6ae9e,_0x9abac6){_0x9abac6=_0x9abac6||0xc8;return function(_0x308c73){if(_0x308c73){return _0xe6ae9e['status'](_0x9abac6)[_0xe54e('0x25')](_0x308c73);}};}function respondWithFilteredResult(_0x773566,_0x4f9767){return function(_0x1f37b4){if(_0x1f37b4){var _0x583e5a=_0x1f37b4[_0xe54e('0x26')],_0x5229a8=_0x4f9767[_0xe54e('0x27')],_0x5ded62=_0x4f9767['offset']+_0x4f9767[_0xe54e('0x28')],_0x57c852;if(_0x5ded62>=_0x583e5a){_0x5ded62=_0x583e5a;_0x57c852=0xc8;}else{_0x57c852=0xce;}_0x773566[_0xe54e('0x23')](_0x57c852);return _0x773566[_0xe54e('0x29')](_0xe54e('0x2a'),_0x5229a8+'-'+_0x5ded62+'/'+_0x583e5a)[_0xe54e('0x25')](_0x1f37b4);}return null;};}function patchUpdates(_0x463ed5){return function(_0x4f5740){try{jsonpatch['apply'](_0x4f5740,_0x463ed5,!![]);}catch(_0x1530a9){return BPromise[_0xe54e('0x2b')](_0x1530a9);}return _0x4f5740['save']();};}function saveUpdates(_0x4dd34d,_0x554030){return function(_0x48bacf){if(_0x48bacf){return _0x48bacf[_0xe54e('0x2c')](_0x4dd34d)[_0xe54e('0x2d')](function(_0x54b259){return _0x54b259;});}return null;};}function removeEntity(_0x3c4699,_0x4496b5){return function(_0x11f66d){if(_0x11f66d){return _0x11f66d[_0xe54e('0x2e')]()[_0xe54e('0x2d')](function(){_0x3c4699[_0xe54e('0x23')](0xcc)[_0xe54e('0x24')]();});}};}function handleEntityNotFound(_0x2d4d07,_0x438059){return function(_0x3717fa){if(!_0x3717fa){_0x2d4d07[_0xe54e('0x22')](0x194);}return _0x3717fa;};}function handleError(_0x1d6a5a,_0x149d82){_0x149d82=_0x149d82||0x1f4;return function(_0x34ad3b){logger[_0xe54e('0x2f')](_0x34ad3b[_0xe54e('0x30')]);if(_0x34ad3b['name']){delete _0x34ad3b[_0xe54e('0x31')];}_0x1d6a5a[_0xe54e('0x23')](_0x149d82)['send'](_0x34ad3b);};}function getInteractionUsers(_0x38901e,_0x440d51){return new BPromise(function(_0x16c577,_0x1fc0bd){try{if(_0x440d51[_0x38901e['id']]){_0x38901e[_0xe54e('0x32')]=_[_0xe54e('0x33')](_0x440d51[_0x38901e['id']],function(_0x29b43c){return{'id':_0x29b43c['id'],'fullname':_0x29b43c[_0xe54e('0x34')]};});}}catch(_0x226afe){_0x1fc0bd(_0x226afe);}_0x16c577(_0x38901e);});}function getInteractionTags(_0x19ab92,_0x956d3d){return new BPromise(function(_0x658181,_0x46051c){try{if(_0x19ab92[_0xe54e('0x35')]){_0x19ab92[_0xe54e('0x36')]=[];_0x19ab92[_0xe54e('0x35')][_0xe54e('0x37')](',')[_0xe54e('0x38')](function(_0x4448cc){_0x19ab92['Tags']['push'](_0x956d3d[_0x4448cc]);});}delete _0x19ab92[_0xe54e('0x35')];}catch(_0x4056d1){_0x46051c(_0x4056d1);}_0x658181(_0x19ab92);});}function getLastMessageText(_0x3fe6b9){return new BPromise(function(_0x48822c,_0x1bc8de){return db[_0xe54e('0x39')][_0xe54e('0x3a')]({'where':{'$and':[{'MailInteractionId':_0x3fe6b9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe54e('0x3b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0xe54e('0x2d')](function(_0x2679a2){if(_0x2679a2&&_0x2679a2['plainBody']){_0x3fe6b9[_0xe54e('0x3c')]=_['trimStart'](_0x2679a2['plainBody']);}_0x48822c(_0x3fe6b9);})['catch'](function(_0x587548){_0x1bc8de(_0x587548);});});}function updateMailInteraction(_0x792f10,_0x101bc7,_0x4abba2,_0x597df6){return new BPromise(function(_0x496902,_0x382342){return getInteractionUsers(_0x792f10,_0x4abba2)[_0xe54e('0x2d')](function(_0xba685f){return getInteractionTags(_0xba685f,_0x101bc7);})[_0xe54e('0x2d')](function(_0x557d9e){if(_0x597df6){_0x496902(getLastMessageText(_0x557d9e));}else{_0x496902(_0x557d9e);}})['catch'](function(_0x248142){_0x382342(_0x248142);});});}exports[_0xe54e('0x3d')]=function(_0x254739,_0x1e1572){var _0x304ae7={},_0x461898={},_0x4fddd4={'count':0x0,'rows':[]};var _0x57e83a=_[_0xe54e('0x33')](db['MailInteraction']['rawAttributes'],function(_0x62cb69){return{'name':_0x62cb69[_0xe54e('0x3e')],'type':_0x62cb69[_0xe54e('0x3f')][_0xe54e('0x40')]};});_0x461898['model']=_[_0xe54e('0x33')](_0x57e83a,_0xe54e('0x31'));_0x461898[_0xe54e('0x41')]=_[_0xe54e('0x42')](_0x254739[_0xe54e('0x41')]);_0x461898[_0xe54e('0x43')]=_[_0xe54e('0x44')](_0x461898[_0xe54e('0x45')],_0x461898['query']);_0x304ae7['attributes']=_[_0xe54e('0x44')](_0x461898[_0xe54e('0x45')],qs[_0xe54e('0x46')](_0x254739[_0xe54e('0x41')][_0xe54e('0x46')]));_0x304ae7[_0xe54e('0x47')]=_0x304ae7[_0xe54e('0x47')]['length']?_0x304ae7[_0xe54e('0x47')]:_0x461898[_0xe54e('0x45')];if(!_0x254739[_0xe54e('0x41')][_0xe54e('0x48')](_0xe54e('0x49'))){_0x304ae7[_0xe54e('0x28')]=qs[_0xe54e('0x28')](_0x254739[_0xe54e('0x41')][_0xe54e('0x28')]);_0x304ae7['offset']=qs[_0xe54e('0x27')](_0x254739[_0xe54e('0x41')]['offset']);}_0x304ae7[_0xe54e('0x4a')]=qs[_0xe54e('0x4b')](_0x254739[_0xe54e('0x41')][_0xe54e('0x4b')]);_0x304ae7['where']=qs[_0xe54e('0x43')](_[_0xe54e('0x4c')](_0x254739[_0xe54e('0x41')],_0x461898[_0xe54e('0x43')]),_0x57e83a);var _0x3e6ef7=[];var _0x4eb0dc=squel[_0xe54e('0x4d')]()[_0xe54e('0x4e')]('id')['field'](_0xe54e('0x31'))['field'](_0xe54e('0x4f'))[_0xe54e('0x50')](_0xe54e('0x51'));var _0xa3d17e=squel[_0xe54e('0x4d')]()['field'](_0xe54e('0x52'))['field'](_0xe54e('0x53'))[_0xe54e('0x4e')](_0xe54e('0x54'))['from'](_0xe54e('0x55'),'ui')[_0xe54e('0x56')](_0xe54e('0x57'),'u','u.id\x20=\x20ui.UserId');var _0x417de9=squel[_0xe54e('0x4d')]()[_0xe54e('0x50')](_0xe54e('0x58'),'i')['left_join'](_0xe54e('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe54e('0x56')]('users','o',_0xe54e('0x5a'))[_0xe54e('0x56')](_0xe54e('0x5b'),'a',_0xe54e('0x5c'))[_0xe54e('0x56')](_0xe54e('0x5d'),'me',_0xe54e('0x5e'))[_0xe54e('0x56')](_0xe54e('0x5f'),'it',_0xe54e('0x60'))[_0xe54e('0x56')](_0xe54e('0x51'),'t',_0xe54e('0x61'));var _0x1c3fb4=squel[_0xe54e('0x62')]();var _0x2455e3=[];var _0x28720c=squel[_0xe54e('0x62')]();var _0x51eaf2;if(_0x254739[_0xe54e('0x41')][_0xe54e('0x63')]){_0x51eaf2=as['parseSearch'](_0x254739['query'][_0xe54e('0x63')]);var _0x18288e=_0x51eaf2['sqlOperator'];for(var _0x3ca9b3=0x0;_0x3ca9b3<_0x51eaf2[_0xe54e('0x64')]['length'];_0x3ca9b3++){var _0x3d8fed=_0x51eaf2['conditions'][_0x3ca9b3];var _0x21247f='i';var _0x1e5691=_['find'](_0x57e83a,['name',_0x3d8fed[_0xe54e('0x4e')]]);if(!_0x1e5691){switch(_0x3d8fed[_0xe54e('0x4e')]){case _0xe54e('0x65'):if(_0x3d8fed[_0xe54e('0x66')]==0x1){_0x417de9[_0xe54e('0x67')]('`'+_0x3d8fed[_0xe54e('0x4e')]+_0xe54e('0x68'));}else{_0x417de9[_0xe54e('0x67')]('`'+_0x3d8fed[_0xe54e('0x4e')]+_0xe54e('0x69'));}break;case _0xe54e('0x6a'):if(_0x3d8fed[_0xe54e('0x6b')]==='$substring'){if(_0x3d8fed[_0xe54e('0x66')][_0xe54e('0x37')]('\x20')[_0xe54e('0x6c')]>0x1){_0x1c3fb4[_0x18288e](_0xe54e('0x6d'),qs[_0xe54e('0x6e')](_0x3d8fed[_0xe54e('0x66')]),null);}else{var _0x549b53='%'+_0x3d8fed[_0xe54e('0x66')]+'%';_0x1c3fb4[_0x18288e](_0xe54e('0x6f'),_0x549b53,_0x549b53,_0x549b53);}}else{_0x1e5691=_['find'](_0x57e83a,[_0xe54e('0x31'),'ContactId']);_0x3d8fed['field']=_0xe54e('0x70');_0x2856e7=as[_0xe54e('0x71')](_0x21247f,_0x1e5691[_0xe54e('0x3f')],_0x3d8fed);_0x1c3fb4[_0x18288e](_0x2856e7['text'],_0x2856e7[_0xe54e('0x66')][_0xe54e('0x72')],_0x2856e7[_0xe54e('0x66')]['end']);}break;case _0xe54e('0x73'):var _0x503d1e=_0x3d8fed[_0xe54e('0x66')][_0xe54e('0x37')](',')['map'](function(_0x48834d){return Number(_0x48834d);});_0x503d1e[_0xe54e('0x38')](function(_0x141fc5){_0x28720c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x141fc5+',%');});_0x2455e3=_[_0xe54e('0x74')](_0x2455e3,_0x503d1e);break;case'User':if(_0x3d8fed[_0xe54e('0x6b')]==='$substring'){_0x1c3fb4[_0x18288e](_0xe54e('0x75'),'%'+_0x3d8fed[_0xe54e('0x66')]+'%',null);}else{_0x1e5691=_[_0xe54e('0x76')](_0x57e83a,[_0xe54e('0x31'),_0xe54e('0x77')]);_0x3d8fed[_0xe54e('0x4e')]=_0xe54e('0x77');_0x2856e7=as[_0xe54e('0x71')](_0x21247f,_0x1e5691['type'],_0x3d8fed);_0x1c3fb4[_0x18288e](_0x2856e7[_0xe54e('0x78')],_0x2856e7[_0xe54e('0x66')][_0xe54e('0x72')],_0x2856e7[_0xe54e('0x66')][_0xe54e('0x24')]);}break;case _0xe54e('0x79'):_0x2856e7=as['buildExpression']('me',null,_0x3d8fed);_0x1c3fb4[_0x18288e](_0x2856e7['text'],_0x2856e7[_0xe54e('0x66')][_0xe54e('0x72')],_0x2856e7[_0xe54e('0x66')][_0xe54e('0x24')]);break;}}else{var _0x2856e7=as[_0xe54e('0x71')](_0x21247f,_0x1e5691[_0xe54e('0x3f')],_0x3d8fed);_0x1c3fb4[_0x18288e](_0x2856e7['text'],_0x2856e7[_0xe54e('0x66')][_0xe54e('0x72')],_0x2856e7[_0xe54e('0x66')][_0xe54e('0x24')]);}}}else{var _0x29dbfb=_(_0x254739['query'])['keys']()['map'](function(_0x5c9b8e){return _[_0xe54e('0x7a')](_0x57e83a,[_0xe54e('0x31'),_0x5c9b8e])?_0x5c9b8e:undefined;})[_0xe54e('0x7b')]()[_0xe54e('0x66')]();if(!_['isEmpty'](_0x29dbfb)){_0x29dbfb[_0xe54e('0x38')](function(_0x51928d){if(_0x51928d===_0xe54e('0x7c')){_0x417de9['where']('i.MailAccountId\x20IN\x20?',[][_0xe54e('0x7d')](_0x254739[_0xe54e('0x41')][_0x51928d]));}else if(_0x51928d===_0xe54e('0x7e')){var _0x4551fa=JSON[_0xe54e('0x7f')](_0x254739[_0xe54e('0x41')][_0x51928d])[_0xe54e('0x80')];var _0x4ea66b=JSON['parse'](_0x254739[_0xe54e('0x41')][_0x51928d])[_0xe54e('0x81')];_0x417de9[_0xe54e('0x82')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4551fa,_0x4ea66b);}else{if(_0x254739[_0xe54e('0x41')][_0x51928d]===_0xe54e('0x83')){_0x417de9[_0xe54e('0x82')]('i.'+_0x51928d+'\x20IS\x20NULL');}else{_0x417de9['where']('i.'+_0x51928d+'\x20=\x20?',_0x254739['query'][_0x51928d]);}}});}if(_0x254739[_0xe54e('0x41')][_0xe54e('0x84')]){if(_0x254739['query'][_0xe54e('0x84')]==0x1){_0x417de9[_0xe54e('0x67')](_0xe54e('0x85'));}else{_0x417de9['having'](_0xe54e('0x86'));}}if(_0x254739[_0xe54e('0x41')][_0xe54e('0x87')]){_0x2455e3=_[_0xe54e('0x88')](_0x254739[_0xe54e('0x41')][_0xe54e('0x87')])?_0x254739[_0xe54e('0x41')]['tag']:new Array(_0x254739[_0xe54e('0x41')][_0xe54e('0x87')]);_0x2455e3[_0xe54e('0x38')](function(_0x90d05d){_0x28720c['or'](_0xe54e('0x89'),'%,'+_0x90d05d+',%');});}if(_0x254739[_0xe54e('0x41')]['filter']){var _0x4f7d1c=_0x254739['query'][_0xe54e('0x8a')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4f7d1c)){_0x1c3fb4['or'](_0xe54e('0x8b'),_0x4f7d1c+'%');}else if(qs['isEmail'](_0x4f7d1c)){_0x1c3fb4['or'](_0xe54e('0x8c'),_0x4f7d1c+'%');}else{_0x1c3fb4['or'](_0xe54e('0x8d'),qs[_0xe54e('0x6e')](_0x4f7d1c))['or'](_0xe54e('0x8e'),qs[_0xe54e('0x6e')](_0x4f7d1c));}}}_0x417de9[_0xe54e('0x82')](_0x1c3fb4);_0x417de9[_0xe54e('0x8f')](_0xe54e('0x90'));var _0x185a24={'type':db[_0xe54e('0x91')]['QueryTypes'][_0xe54e('0x92')],'raw':!![]};var _0x2019d1=_0x417de9[_0xe54e('0x93')]();_0x2019d1[_0xe54e('0x4e')](_0xe54e('0x90'));_0x2019d1[_0xe54e('0x4e')](_0xe54e('0x94'),_0xe54e('0x65'));if(_0x304ae7[_0xe54e('0x4a')]){_0x304ae7['order'][_0xe54e('0x38')](function(_0x4c6a3f){var _0x3dd500=_0x4c6a3f[0x0]===_0xe54e('0x95')?_0x4c6a3f[0x0]:'i.'+_0x4c6a3f[0x0];_0x417de9['order'](_0x3dd500,_0x4c6a3f[0x1]===_0xe54e('0x96')?![]:!![]);});}if(!_[_0xe54e('0x97')](_0x2455e3)){_0x417de9['having'](_0x28720c);_0x2019d1[_0xe54e('0x82')](_0xe54e('0x98'),_0x2455e3);}BPromise[_0xe54e('0x99')]()[_0xe54e('0x2d')](function(){if(!_0x51eaf2){if(_0x254739[_0xe54e('0x41')][_0xe54e('0x7c')])return;_0x2019d1['where'](_0xe54e('0x9a'));_0x417de9[_0xe54e('0x82')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x254739[_0xe54e('0x9b')][_0xe54e('0x9c')]!==_0xe54e('0x9d'))return;return _0x254739[_0xe54e('0x9b')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xe54e('0x2d')](function(_0x2b26da){if(_[_0xe54e('0x97')](_0x2b26da)){_0x2019d1['where'](_0xe54e('0x9e'));_0x417de9[_0xe54e('0x82')]('i.MailAccountId\x20IS\x20NULL');}else{_0x2019d1['where'](_0xe54e('0x9f'),_['map'](_0x2b26da,'id'));_0x417de9[_0xe54e('0x82')](_0xe54e('0x9f'),_[_0xe54e('0x33')](_0x2b26da,'id'));}});})[_0xe54e('0x2d')](function(){if(_0x254739['user']['role']===_0xe54e('0x9d')&&!_0x51eaf2&&!_0x254739[_0xe54e('0x41')][_0xe54e('0x7c')])return[];return db['sequelize'][_0xe54e('0x41')](_0x2019d1[_0xe54e('0xa0')](),_0x185a24);})[_0xe54e('0x2d')](function(_0x23ecca){_0x4fddd4[_0xe54e('0x26')]=_0x23ecca['length'];if(_0x4fddd4[_0xe54e('0x26')]===0x0)return[];return db[_0xe54e('0xa1')][_0xe54e('0x41')](_0x4eb0dc[_0xe54e('0xa0')](),_0x185a24)[_0xe54e('0x2d')](function(_0x24ece6){_0x3e6ef7=_[_0xe54e('0xa2')](_0x24ece6,'id');_0x185a24=_[_0xe54e('0xa3')](_0x185a24,{'model':db[_0xe54e('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x254739[_0xe54e('0x41')]['fields']){_0x304ae7[_0xe54e('0x47')]['forEach'](function(_0x214856){_0x417de9[_0xe54e('0x4e')]('i.'+_0x214856);});}else{_0x417de9['field'](_0xe54e('0x94'),_0xe54e('0x65'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xa5'),_0xe54e('0xa6'));_0x417de9['field'](_0xe54e('0xa7'),_0xe54e('0xa8'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xa9'),'contactName');_0x417de9[_0xe54e('0x4e')](_0xe54e('0x90'));_0x417de9['field'](_0xe54e('0xaa'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xab'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xac'));_0x417de9['field']('i.closedAt');_0x417de9[_0xe54e('0x4e')](_0xe54e('0xad'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xae'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xaf'));_0x417de9['field'](_0xe54e('0xb0'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xb1'));_0x417de9['field'](_0xe54e('0xb2'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xb3'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xb4'));_0x417de9['field']('i.to');_0x417de9[_0xe54e('0x4e')](_0xe54e('0xb5'));_0x417de9[_0xe54e('0x4e')]('i.MailAccountId');_0x417de9['field'](_0xe54e('0xb6'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xb7'),_0xe54e('0xb8'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xb9'),_0xe54e('0xba'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xbb'),_0xe54e('0xbc'));_0x417de9['field'](_0xe54e('0xbd'),'Contact.phone');_0x417de9[_0xe54e('0x4e')](_0xe54e('0xbe'),_0xe54e('0xbf'));_0x417de9['field'](_0xe54e('0xc0'),_0xe54e('0xc1'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xc2'),_0xe54e('0xc3'));_0x417de9[_0xe54e('0x4e')](_0xe54e('0xc4'),'Owner.internal');_0x417de9[_0xe54e('0x4e')](_0xe54e('0xc5'),'TagIds');}if(_0x304ae7[_0xe54e('0x28')])_0x417de9[_0xe54e('0x28')](_0x304ae7['limit']);if(_0x304ae7['offset'])_0x417de9[_0xe54e('0x27')](_0x304ae7[_0xe54e('0x27')]);return db['sequelize']['query'](_0x417de9['toString'](),_0x185a24);})[_0xe54e('0x2d')](function(_0x2c93e0){_0xa3d17e[_0xe54e('0x82')](_0xe54e('0xc6'),_[_0xe54e('0x33')](_0x2c93e0,'id'));return db['sequelize'][_0xe54e('0x41')](_0xa3d17e[_0xe54e('0xa0')](),_0x185a24)['then'](function(_0xeca020){var _0x3f3ba9=_[_0xe54e('0xc7')](_0xeca020,_0xe54e('0xc8'));var _0x2517c0=[];return db[_0xe54e('0xc9')][_0xe54e('0x3a')]({'attributes':[_0xe54e('0xca')],'raw':!![]})['then'](function(_0x212ab3){var _0x5a2771=_0x212ab3[_0xe54e('0xca')];_0x2c93e0[_0xe54e('0x38')](function(_0x3c3679){_0x2517c0[_0xe54e('0xcb')](updateMailInteraction(_0x3c3679,_0x3e6ef7,_0x3f3ba9,_0x5a2771));});return BPromise[_0xe54e('0xcc')](_0x2517c0);});});});})[_0xe54e('0x2d')](function(_0x111769){_0x4fddd4['rows']=_0x111769;return _0x4fddd4;})[_0xe54e('0x2d')](respondWithFilteredResult(_0x1e1572,_0x304ae7))[_0xe54e('0xcd')](handleError(_0x1e1572,null));};exports[_0xe54e('0xce')]=function(_0x515cb7,_0x28dc15){var _0x309ef7={'raw':![],'where':{'id':_0x515cb7[_0xe54e('0xcf')]['id']}},_0x363849={};_0x363849['model']=_[_0xe54e('0x42')](db[_0xe54e('0xa4')][_0xe54e('0xd0')]);_0x363849[_0xe54e('0x41')]=_[_0xe54e('0x42')](_0x515cb7['query']);_0x363849['filters']=_[_0xe54e('0x44')](_0x363849[_0xe54e('0x45')],_0x363849[_0xe54e('0x41')]);_0x309ef7[_0xe54e('0x47')]=_[_0xe54e('0x44')](_0x363849[_0xe54e('0x45')],qs[_0xe54e('0x46')](_0x515cb7[_0xe54e('0x41')]['fields']));_0x309ef7[_0xe54e('0x47')]=_0x309ef7[_0xe54e('0x47')]['length']?_0x309ef7[_0xe54e('0x47')]:_0x363849['model'];if(_0x515cb7[_0xe54e('0x41')][_0xe54e('0xd1')]){_0x309ef7['include']=[{'all':!![]}];}_0x309ef7=_[_0xe54e('0xa3')]({},_0x309ef7,_0x515cb7['options']);return db[_0xe54e('0xa4')][_0xe54e('0x76')](_0x309ef7)[_0xe54e('0x2d')](handleEntityNotFound(_0x28dc15,null))['then'](respondWithResult(_0x28dc15,null))[_0xe54e('0xcd')](handleError(_0x28dc15,null));};exports['create']=function(_0x505e6c,_0x3b546c){return db[_0xe54e('0xa4')][_0xe54e('0xd2')](_0x505e6c[_0xe54e('0xd3')],{})[_0xe54e('0x2d')](respondWithResult(_0x3b546c,0xc9))[_0xe54e('0xcd')](handleError(_0x3b546c,null));};exports[_0xe54e('0x2c')]=function(_0x365c84,_0x4f2a47){if(_0x365c84[_0xe54e('0xd3')]['id']){delete _0x365c84[_0xe54e('0xd3')]['id'];}return db[_0xe54e('0xa4')][_0xe54e('0x76')]({'where':{'id':_0x365c84[_0xe54e('0xcf')]['id']}})['then'](handleEntityNotFound(_0x4f2a47,null))[_0xe54e('0x2d')](saveUpdates(_0x365c84[_0xe54e('0xd3')],null))[_0xe54e('0x2d')](respondWithResult(_0x4f2a47,null))[_0xe54e('0xcd')](handleError(_0x4f2a47,null));};exports[_0xe54e('0x2e')]=function(_0x50387b,_0x3e4cd8){return db['MailInteraction']['find']({'where':{'id':_0x50387b[_0xe54e('0xcf')]['id']}})[_0xe54e('0x2d')](handleEntityNotFound(_0x3e4cd8,null))[_0xe54e('0x2d')](removeEntity(_0x3e4cd8,null))[_0xe54e('0xcd')](handleError(_0x3e4cd8,null));};exports[_0xe54e('0xd4')]=function(_0x404607,_0x1328f7){return db['MailInteraction'][_0xe54e('0xd4')]()[_0xe54e('0x2d')](respondWithResult(_0x1328f7,null))[_0xe54e('0xcd')](handleError(_0x1328f7,null));};exports['addMessage']=function(_0x46f8c3,_0x1c20c4,_0x5c901e){return db[_0xe54e('0x39')]['find']({'where':{'id':_0x46f8c3[_0xe54e('0xcf')]['id']}})['then'](handleEntityNotFound(_0x1c20c4,null))[_0xe54e('0x2d')](function(_0x4f1251){if(_0x4f1251){return _0x4f1251['addMessage'](_0x46f8c3['body'][_0xe54e('0xd5')],_[_0xe54e('0xd6')](_0x46f8c3[_0xe54e('0xd3')],[_0xe54e('0xd5'),'id'])||{});}})[_0xe54e('0x2d')](respondWithResult(_0x1c20c4,null))[_0xe54e('0xcd')](handleError(_0x1c20c4,null));};exports[_0xe54e('0xd7')]=function(_0x148ccc,_0x193194,_0x196422){var _0x322f11={'raw':![],'where':{}};var _0x5a47a8={};var _0x56b402={'count':0x0,'rows':[]};return db[_0xe54e('0xa4')][_0xe54e('0x3a')]({'where':{'id':_0x148ccc['params']['id']}})[_0xe54e('0x2d')](handleEntityNotFound(_0x193194,null))[_0xe54e('0x2d')](function(_0x427051){if(_0x427051){_0x5a47a8['model']=_[_0xe54e('0x42')](db[_0xe54e('0x39')][_0xe54e('0xd0')]);_0x5a47a8[_0xe54e('0x41')]=_[_0xe54e('0x42')](_0x148ccc[_0xe54e('0x41')]);_0x5a47a8['filters']=_[_0xe54e('0x44')](_0x5a47a8[_0xe54e('0x45')],_0x5a47a8[_0xe54e('0x41')]);_0x322f11['attributes']=_[_0xe54e('0x44')](_0x5a47a8[_0xe54e('0x45')],qs[_0xe54e('0x46')](_0x148ccc[_0xe54e('0x41')][_0xe54e('0x46')]));_0x322f11['attributes']=_0x322f11['attributes'][_0xe54e('0x6c')]?_0x322f11['attributes']:_0x5a47a8[_0xe54e('0x45')];if(!_0x148ccc['query'][_0xe54e('0x48')](_0xe54e('0x49'))){_0x322f11[_0xe54e('0x28')]=qs[_0xe54e('0x28')](_0x148ccc[_0xe54e('0x41')]['limit']);_0x322f11[_0xe54e('0x27')]=qs[_0xe54e('0x27')](_0x148ccc['query'][_0xe54e('0x27')]);}_0x322f11[_0xe54e('0x4a')]=qs[_0xe54e('0x4b')](_0x148ccc['query'][_0xe54e('0x4b')]);_0x322f11[_0xe54e('0x82')]=qs[_0xe54e('0x43')](_[_0xe54e('0x4c')](_0x148ccc[_0xe54e('0x41')],_0x5a47a8[_0xe54e('0x43')]));_0x322f11[_0xe54e('0x82')][_0xe54e('0xc8')]=_0x427051['id'];if(_0x148ccc[_0xe54e('0x41')][_0xe54e('0x8a')]){_0x322f11[_0xe54e('0x82')]=_['merge'](_0x322f11[_0xe54e('0x82')],{'$or':_[_0xe54e('0x33')](_0x322f11['attributes'],function(_0x40a34a){var _0x59dbfd={};_0x59dbfd[_0x40a34a]={'$like':'%'+_0x148ccc['query'][_0xe54e('0x8a')]+'%'};return _0x59dbfd;})});}if(_0x148ccc[_0xe54e('0x41')]['$gte']){var _0x576744=_0x148ccc[_0xe54e('0x41')]['$gte'][_0xe54e('0x37')](',');var _0x2b1c35={};_0x2b1c35[_0x576744[0x0]]={'$gte':moment(_0x576744[0x1])[_0xe54e('0xd8')](_0xe54e('0xd9'))};_0x322f11[_0xe54e('0x82')]=_[_0xe54e('0xa3')](_0x322f11[_0xe54e('0x82')],_0x2b1c35);}_0x322f11=_[_0xe54e('0xa3')]({},_0x322f11,_0x148ccc[_0xe54e('0xda')]);return db[_0xe54e('0x39')]['count']({'where':_0x322f11[_0xe54e('0x82')]})[_0xe54e('0x2d')](function(_0x458d48){_0x56b402[_0xe54e('0x26')]=_0x458d48;if(_0x148ccc[_0xe54e('0x41')][_0xe54e('0xd1')]){_0x322f11[_0xe54e('0xdb')]=[{'all':!![]}];}return db[_0xe54e('0x39')][_0xe54e('0xdc')](_0x322f11);})[_0xe54e('0x2d')](function(_0x4ac602){if(_0x148ccc[_0xe54e('0x41')]['inlineCss']==='true'){for(var _0x4633dd=0x0;_0x4633dd<_0x4ac602[_0xe54e('0x6c')];_0x4633dd++){_0x4ac602[_0x4633dd][_0xe54e('0xd3')]=juice(_0x4ac602[_0x4633dd]['body']);}}_0x56b402[_0xe54e('0xdd')]=_0x4ac602;return _0x56b402;});}})[_0xe54e('0x2d')](respondWithFilteredResult(_0x193194,_0x322f11))[_0xe54e('0xcd')](handleError(_0x193194,null));};exports[_0xe54e('0xde')]=function(_0x4eb1fe,_0x103b9d,_0x3f13a5){return db[_0xe54e('0xa4')][_0xe54e('0x76')]({'where':{'id':_0x4eb1fe[_0xe54e('0xcf')]['id']}})[_0xe54e('0x2d')](handleEntityNotFound(_0x103b9d,null))[_0xe54e('0x2d')](function(_0x1ed7ee){if(_0x1ed7ee){return _0x1ed7ee['setTags'](_0x4eb1fe[_0xe54e('0xd3')]['ids'],_[_0xe54e('0xd6')](_0x4eb1fe[_0xe54e('0xd3')],[_0xe54e('0xd5'),'id'])||{})[_0xe54e('0xdf')](function(){return db[_0xe54e('0x73')][_0xe54e('0xdc')]({'attributes':['id',_0xe54e('0x31'),'color'],'where':{'id':_0x4eb1fe[_0xe54e('0xd3')]['ids']}});})[_0xe54e('0x2d')](function(_0x2315e2){socket[_0xe54e('0xe0')](_0xe54e('0xe1'),{'id':Number(_0x4eb1fe[_0xe54e('0xcf')]['id']),'tags':_0x2315e2||[]});return{'id':Number(_0x4eb1fe[_0xe54e('0xcf')]['id']),'tags':_0x2315e2||[]};});}})[_0xe54e('0x2d')](respondWithResult(_0x103b9d,null))[_0xe54e('0xcd')](handleError(_0x103b9d,null));};exports[_0xe54e('0xe2')]=function(_0x5a264b,_0x2e142a,_0x5a2119){return db[_0xe54e('0xa4')]['find']({'where':{'id':_0x5a264b[_0xe54e('0xcf')]['id']}})[_0xe54e('0x2d')](handleEntityNotFound(_0x2e142a,null))[_0xe54e('0x2d')](function(_0x380cc3){if(_0x380cc3){return _0x380cc3[_0xe54e('0xe2')](_0x5a264b['query'][_0xe54e('0xd5')]);}})[_0xe54e('0x2d')](respondWithStatusCode(_0x2e142a,null))[_0xe54e('0xcd')](handleError(_0x2e142a,null));};exports['download']=function(_0x5ce621,_0x4242e3){var _0x21517a=moment()[_0xe54e('0xe3')]()[_0xe54e('0xa0')]();var _0x39011e=path[_0xe54e('0xe4')](config[_0xe54e('0xe5')],_0xe54e('0xe6'),_0xe54e('0xe7'),_0xe54e('0xe8'));var _0x3ba0ca=path['join'](config[_0xe54e('0xe5')],_0xe54e('0xe6'),_0xe54e('0xe7'),'attachments');var _0x947aab=path[_0xe54e('0xe4')](_0x39011e,_0x21517a);var _0x32e9af=util['format'](_0xe54e('0xe9'),_0x5ce621['params']['id'],_0x21517a);var _0xb5950c=path[_0xe54e('0xe4')](_0x39011e,_0x32e9af);var _0x326225=[];if(_0x5ce621[_0xe54e('0x41')][_0xe54e('0xea')]){_0x326225['push']({'model':db[_0xe54e('0xeb')],'as':_0xe54e('0xec'),'raw':!![]});}var _0x5b3900=[{'model':db[_0xe54e('0x39')],'as':_0xe54e('0xed'),'attributes':['id',_0xe54e('0xd3'),_0xe54e('0x50'),'to','cc',_0xe54e('0xee'),'subject',_0xe54e('0x7e')],'where':{'secret':![]},'order':qs[_0xe54e('0x4b')]('id'),'include':_0x326225}];return db[_0xe54e('0xa4')][_0xe54e('0x76')]({'where':{'id':_0x5ce621[_0xe54e('0xcf')]['id']},'include':_0x5b3900})['then'](handleEntityNotFound(_0x4242e3,null))[_0xe54e('0x2d')](function(_0x3b8be3){if(_0x3b8be3&&_0x3b8be3[_0xe54e('0xed')]){var _0x27aa10=_0x3b8be3[_0xe54e('0xef')]({'plain':!![]});fs['mkdirSync'](_0x947aab);return BPromise[_0xe54e('0xf0')](_0x27aa10[_0xe54e('0xed')],function(_0x597ef9,_0x5dbb20){var _0x1e4973={'from':_0x597ef9['from'],'to':_0x597ef9['to'],'subject':_0x597ef9['subject'],'html':_0x597ef9['body'],'headers':{'Date':moment(_0x597ef9[_0xe54e('0x7e')])[_0xe54e('0xd8')](_0xe54e('0xf1'))},'attachments':[]};if(_0x597ef9['cc']){_0x1e4973[_0xe54e('0xf2')]['Cc']=_0x597ef9['cc'];}if(_0x597ef9[_0xe54e('0xee')]){_0x1e4973['headers'][_0xe54e('0xf3')]=_0x597ef9[_0xe54e('0xee')];}return new BPromise(function(_0x5eaa7e,_0x2a8ef9){if(_0x597ef9['Attachments']){for(var _0x6474c1=0x0;_0x6474c1<_0x597ef9[_0xe54e('0xec')]['length'];_0x6474c1++){var _0x3c83ca=_0x597ef9[_0xe54e('0xec')][_0x6474c1];var _0x3bec4e=path[_0xe54e('0xe4')](_0x3ba0ca,_0x3c83ca['basename']);if(fs[_0xe54e('0xf4')](_0x3bec4e)){_0x1e4973[_0xe54e('0xea')]['push']({'name':_0x3c83ca['name'],'contentType':_0x3c83ca[_0xe54e('0x3f')],'data':fs[_0xe54e('0xf5')](_0x3bec4e)});}}}emlformat['build'](_0x1e4973,function(_0x530e1d,_0x3cb435){if(_0x530e1d)return _0x2a8ef9(_0x530e1d);fs[_0xe54e('0xf6')](path[_0xe54e('0xe4')](_0x947aab,util[_0xe54e('0xd8')](_0xe54e('0xf7'),_0x5dbb20)),_0x3cb435);return _0x5eaa7e(_0x3cb435);});});})[_0xe54e('0x2d')](function(){return new BPromise(function(_0x57a820,_0x42cd24){zipdir(_0x947aab,{'saveTo':_0xb5950c},function(_0xa5e669,_0x1e098d){if(_0xa5e669)return _0x42cd24(_0xa5e669);return _0x57a820(_0x1e098d);});})[_0xe54e('0x2d')](function(){return new BPromise(function(_0x473a2d,_0x17ed40){rimraf(_0x947aab,function(_0x58c270){if(_0x58c270)_0x17ed40(_0x58c270);return _0x473a2d();});});})['then'](function(){return _0x4242e3['download'](_0xb5950c,_0x32e9af,function(_0x7b08c4){if(_0x7b08c4){console[_0xe54e('0xf8')](_0xe54e('0xf9'),_0x7b08c4);}else{fs[_0xe54e('0xfa')](_0xb5950c);}});});});}else{return _0x4242e3[_0xe54e('0x22')](0xc8);}})[_0xe54e('0xcd')](handleError(_0x4242e3,null));}; \ No newline at end of file +var _0xbd99=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','stack','send','Users','fullname','TagIds','Tags','push','findOne','out','lastMsgText','trimStart','plainBody','catch','index','MailInteraction','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','getFullTextValue','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','text','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.MailAccountId','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','update','describe','addMessage','MailMessage','ids','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','bcc','get','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','message%d.eml','log','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x32b59a,_0x55dbaa){var _0x450483=function(_0x10b12b){while(--_0x10b12b){_0x32b59a['push'](_0x32b59a['shift']());}};_0x450483(++_0x55dbaa);}(_0xbd99,0x1df));var _0x9bd9=function(_0x5800bd,_0x57bfde){_0x5800bd=_0x5800bd-0x0;var _0x47adb8=_0xbd99[_0x5800bd];return _0x47adb8;};'use strict';var pdf=require(_0x9bd9('0x0'));var emlformat=require(_0x9bd9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9bd9('0x2'));var jsonpatch=require(_0x9bd9('0x3'));var rp=require('request-promise');var moment=require(_0x9bd9('0x4'));var BPromise=require(_0x9bd9('0x5'));var Mustache=require(_0x9bd9('0x6'));var util=require(_0x9bd9('0x7'));var path=require(_0x9bd9('0x8'));var sox=require(_0x9bd9('0x9'));var csv=require(_0x9bd9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bd9('0xb'));var _=require(_0x9bd9('0xc'));var squel=require(_0x9bd9('0xd'));var crypto=require(_0x9bd9('0xe'));var jsforce=require(_0x9bd9('0xf'));var deskjs=require(_0x9bd9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9bd9('0x11'));var Papa=require('papaparse');var htmlToText=require(_0x9bd9('0x12'));var juice=require(_0x9bd9('0x13'));var Redis=require(_0x9bd9('0x14'));var authService=require(_0x9bd9('0x15'));var qs=require(_0x9bd9('0x16'));var as=require(_0x9bd9('0x17'));var hardwareService=require(_0x9bd9('0x18'));var logger=require('../../config/logger')(_0x9bd9('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9bd9('0x1a'));var db=require('../../mysqldb')['db'];config[_0x9bd9('0x1b')]=_[_0x9bd9('0x1c')](config[_0x9bd9('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bd9('0x1d'))(new Redis(config['redis']));require(_0x9bd9('0x1e'))[_0x9bd9('0x1f')](socket);function respondWithStatusCode(_0x4bab02,_0x197bcc){_0x197bcc=_0x197bcc||0xcc;return function(_0xf3949c){if(_0xf3949c){return _0x4bab02[_0x9bd9('0x20')](_0x197bcc);}return _0x4bab02[_0x9bd9('0x21')](_0x197bcc)['end']();};}function respondWithResult(_0x57ffcb,_0x334927){_0x334927=_0x334927||0xc8;return function(_0x221d94){if(_0x221d94){return _0x57ffcb[_0x9bd9('0x21')](_0x334927)[_0x9bd9('0x22')](_0x221d94);}};}function respondWithFilteredResult(_0x3cba37,_0x3e52ae){return function(_0x4bb159){if(_0x4bb159){var _0x4296aa=_0x4bb159[_0x9bd9('0x23')],_0x323e88=_0x3e52ae[_0x9bd9('0x24')],_0x3b3b38=_0x3e52ae[_0x9bd9('0x24')]+_0x3e52ae[_0x9bd9('0x25')],_0x5d43b7;if(_0x3b3b38>=_0x4296aa){_0x3b3b38=_0x4296aa;_0x5d43b7=0xc8;}else{_0x5d43b7=0xce;}_0x3cba37[_0x9bd9('0x21')](_0x5d43b7);return _0x3cba37[_0x9bd9('0x26')]('Content-Range',_0x323e88+'-'+_0x3b3b38+'/'+_0x4296aa)['json'](_0x4bb159);}return null;};}function patchUpdates(_0x4e6032){return function(_0x4f05dc){try{jsonpatch[_0x9bd9('0x27')](_0x4f05dc,_0x4e6032,!![]);}catch(_0x3c8cab){return BPromise[_0x9bd9('0x28')](_0x3c8cab);}return _0x4f05dc[_0x9bd9('0x29')]();};}function saveUpdates(_0x4506d3,_0x50fd9e){return function(_0x299573){if(_0x299573){return _0x299573['update'](_0x4506d3)[_0x9bd9('0x2a')](function(_0x511d05){return _0x511d05;});}return null;};}function removeEntity(_0x2a06e9,_0x2a39ba){return function(_0x4896d8){if(_0x4896d8){return _0x4896d8[_0x9bd9('0x2b')]()[_0x9bd9('0x2a')](function(){_0x2a06e9[_0x9bd9('0x21')](0xcc)[_0x9bd9('0x2c')]();});}};}function handleEntityNotFound(_0x2ff274,_0x439cb8){return function(_0x48cd59){if(!_0x48cd59){_0x2ff274[_0x9bd9('0x20')](0x194);}return _0x48cd59;};}function handleError(_0x2dd667,_0x52880d){_0x52880d=_0x52880d||0x1f4;return function(_0x2d9a99){logger[_0x9bd9('0x2d')](_0x2d9a99[_0x9bd9('0x2e')]);if(_0x2d9a99['name']){delete _0x2d9a99['name'];}_0x2dd667['status'](_0x52880d)[_0x9bd9('0x2f')](_0x2d9a99);};}function getInteractionUsers(_0x4399bb,_0x159eac){return new BPromise(function(_0x2e025f,_0x3d3968){try{if(_0x159eac[_0x4399bb['id']]){_0x4399bb[_0x9bd9('0x30')]=_['map'](_0x159eac[_0x4399bb['id']],function(_0x1e9450){return{'id':_0x1e9450['id'],'fullname':_0x1e9450[_0x9bd9('0x31')]};});}}catch(_0x23b35b){_0x3d3968(_0x23b35b);}_0x2e025f(_0x4399bb);});}function getInteractionTags(_0x125f67,_0x3a8222){return new BPromise(function(_0x9f5b7f,_0x407499){try{if(_0x125f67['TagIds']){_0x125f67['Tags']=[];_0x125f67[_0x9bd9('0x32')]['split'](',')['forEach'](function(_0x4c9a5a){_0x125f67[_0x9bd9('0x33')][_0x9bd9('0x34')](_0x3a8222[_0x4c9a5a]);});}delete _0x125f67['TagIds'];}catch(_0x5dbdd8){_0x407499(_0x5dbdd8);}_0x9f5b7f(_0x125f67);});}function getLastMessageText(_0x192399){return new BPromise(function(_0x2a4094,_0x501df3){return db['MailMessage'][_0x9bd9('0x35')]({'where':{'$and':[{'MailInteractionId':_0x192399['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9bd9('0x36')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0x9bd9('0x2a')](function(_0x48d734){if(_0x48d734&&_0x48d734['plainBody']){_0x192399[_0x9bd9('0x37')]=_[_0x9bd9('0x38')](_0x48d734[_0x9bd9('0x39')]);}_0x2a4094(_0x192399);})[_0x9bd9('0x3a')](function(_0xceaf7c){_0x501df3(_0xceaf7c);});});}function updateMailInteraction(_0x55c40f,_0x519b82,_0xb91bed,_0x2b72c1){return new BPromise(function(_0xbfd337,_0x21ac29){return getInteractionUsers(_0x55c40f,_0xb91bed)[_0x9bd9('0x2a')](function(_0x2cb421){return getInteractionTags(_0x2cb421,_0x519b82);})[_0x9bd9('0x2a')](function(_0x69f496){if(_0x2b72c1){_0xbfd337(getLastMessageText(_0x69f496));}else{_0xbfd337(_0x69f496);}})[_0x9bd9('0x3a')](function(_0x1211db){_0x21ac29(_0x1211db);});});}exports[_0x9bd9('0x3b')]=function(_0x9c69a0,_0x31bf2f){var _0x2f285a={},_0x10dc61={},_0x313fc0={'count':0x0,'rows':[]};var _0x58f4a7=_['map'](db[_0x9bd9('0x3c')][_0x9bd9('0x3d')],function(_0x484929){return{'name':_0x484929[_0x9bd9('0x3e')],'type':_0x484929[_0x9bd9('0x3f')][_0x9bd9('0x40')]};});_0x10dc61[_0x9bd9('0x41')]=_[_0x9bd9('0x42')](_0x58f4a7,_0x9bd9('0x43'));_0x10dc61[_0x9bd9('0x44')]=_[_0x9bd9('0x45')](_0x9c69a0['query']);_0x10dc61[_0x9bd9('0x46')]=_[_0x9bd9('0x47')](_0x10dc61[_0x9bd9('0x41')],_0x10dc61['query']);_0x2f285a['attributes']=_[_0x9bd9('0x47')](_0x10dc61[_0x9bd9('0x41')],qs[_0x9bd9('0x48')](_0x9c69a0['query']['fields']));_0x2f285a[_0x9bd9('0x49')]=_0x2f285a[_0x9bd9('0x49')][_0x9bd9('0x4a')]?_0x2f285a[_0x9bd9('0x49')]:_0x10dc61[_0x9bd9('0x41')];if(!_0x9c69a0[_0x9bd9('0x44')][_0x9bd9('0x4b')](_0x9bd9('0x4c'))){_0x2f285a[_0x9bd9('0x25')]=qs['limit'](_0x9c69a0['query']['limit']);_0x2f285a[_0x9bd9('0x24')]=qs[_0x9bd9('0x24')](_0x9c69a0[_0x9bd9('0x44')][_0x9bd9('0x24')]);}_0x2f285a['order']=qs[_0x9bd9('0x4d')](_0x9c69a0[_0x9bd9('0x44')]['sort']);_0x2f285a[_0x9bd9('0x4e')]=qs[_0x9bd9('0x46')](_['pick'](_0x9c69a0[_0x9bd9('0x44')],_0x10dc61['filters']),_0x58f4a7);var _0x3bc80b=[];var _0x2751c9=squel[_0x9bd9('0x4f')]()[_0x9bd9('0x50')]('id')['field'](_0x9bd9('0x43'))['field'](_0x9bd9('0x51'))[_0x9bd9('0x52')](_0x9bd9('0x53'));var _0x366b7f=squel[_0x9bd9('0x4f')]()[_0x9bd9('0x50')](_0x9bd9('0x54'))[_0x9bd9('0x50')](_0x9bd9('0x55'))[_0x9bd9('0x50')]('ui.MailInteractionId')['from'](_0x9bd9('0x56'),'ui')[_0x9bd9('0x57')]('users','u',_0x9bd9('0x58'));var _0x503198=squel[_0x9bd9('0x4f')]()[_0x9bd9('0x52')](_0x9bd9('0x59'),'i')[_0x9bd9('0x57')](_0x9bd9('0x5a'),'c',_0x9bd9('0x5b'))[_0x9bd9('0x57')](_0x9bd9('0x5c'),'o',_0x9bd9('0x5d'))[_0x9bd9('0x57')](_0x9bd9('0x5e'),'a',_0x9bd9('0x5f'))[_0x9bd9('0x57')]('mail_messages','me',_0x9bd9('0x60'))['left_join'](_0x9bd9('0x61'),'it',_0x9bd9('0x62'))[_0x9bd9('0x57')](_0x9bd9('0x53'),'t',_0x9bd9('0x63'));var _0x4dda2e=squel['expr']();var _0x4fe177=[];var _0x4df5dd=squel[_0x9bd9('0x64')]();var _0x4a4cf9;if(_0x9c69a0['query'][_0x9bd9('0x65')]){_0x4a4cf9=as[_0x9bd9('0x66')](_0x9c69a0[_0x9bd9('0x44')][_0x9bd9('0x65')]);var _0xe06ed4=_0x4a4cf9[_0x9bd9('0x67')];for(var _0x5144ae=0x0;_0x5144ae<_0x4a4cf9[_0x9bd9('0x68')][_0x9bd9('0x4a')];_0x5144ae++){var _0xa2a92a=_0x4a4cf9[_0x9bd9('0x68')][_0x5144ae];var _0x25a56e='i';var _0x216709=_['find'](_0x58f4a7,[_0x9bd9('0x43'),_0xa2a92a['field']]);if(!_0x216709){switch(_0xa2a92a[_0x9bd9('0x50')]){case _0x9bd9('0x69'):if(_0xa2a92a['value']==0x1){_0x503198[_0x9bd9('0x6a')]('`'+_0xa2a92a[_0x9bd9('0x50')]+_0x9bd9('0x6b'));}else{_0x503198['having']('`'+_0xa2a92a['field']+_0x9bd9('0x6c'));}break;case _0x9bd9('0x6d'):if(_0xa2a92a[_0x9bd9('0x6e')]===_0x9bd9('0x6f')){if(_0xa2a92a[_0x9bd9('0x70')][_0x9bd9('0x71')]('\x20')[_0x9bd9('0x4a')]>0x1){_0x4dda2e[_0xe06ed4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9bd9('0x72')](_0xa2a92a['value']),null);}else{var _0x5bddc0='%'+_0xa2a92a[_0x9bd9('0x70')]+'%';_0x4dda2e[_0xe06ed4]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5bddc0,_0x5bddc0,_0x5bddc0);}}else{_0x216709=_['find'](_0x58f4a7,[_0x9bd9('0x43'),_0x9bd9('0x73')]);_0xa2a92a[_0x9bd9('0x50')]=_0x9bd9('0x73');_0x32c6fe=as[_0x9bd9('0x74')](_0x25a56e,_0x216709[_0x9bd9('0x3f')],_0xa2a92a);_0x4dda2e[_0xe06ed4](_0x32c6fe['text'],_0x32c6fe[_0x9bd9('0x70')][_0x9bd9('0x75')],_0x32c6fe[_0x9bd9('0x70')][_0x9bd9('0x2c')]);}break;case _0x9bd9('0x76'):var _0x3d313b=_0xa2a92a['value']['split'](',')[_0x9bd9('0x42')](function(_0x31f0a6){return Number(_0x31f0a6);});_0x3d313b[_0x9bd9('0x77')](function(_0x3d5afa){_0x4df5dd['or'](_0x9bd9('0x78'),'%,'+_0x3d5afa+',%');});_0x4fe177=_['union'](_0x4fe177,_0x3d313b);break;case _0x9bd9('0x79'):if(_0xa2a92a[_0x9bd9('0x6e')]===_0x9bd9('0x6f')){_0x4dda2e[_0xe06ed4](_0x9bd9('0x7a'),'%'+_0xa2a92a['value']+'%',null);}else{_0x216709=_[_0x9bd9('0x7b')](_0x58f4a7,['name',_0x9bd9('0x7c')]);_0xa2a92a['field']=_0x9bd9('0x7c');_0x32c6fe=as[_0x9bd9('0x74')](_0x25a56e,_0x216709[_0x9bd9('0x3f')],_0xa2a92a);_0x4dda2e[_0xe06ed4](_0x32c6fe[_0x9bd9('0x7d')],_0x32c6fe['value'][_0x9bd9('0x75')],_0x32c6fe[_0x9bd9('0x70')][_0x9bd9('0x2c')]);}break;case _0x9bd9('0x39'):_0x32c6fe=as['buildExpression']('me',null,_0xa2a92a);_0x4dda2e[_0xe06ed4](_0x32c6fe['text'],_0x32c6fe[_0x9bd9('0x70')]['start'],_0x32c6fe[_0x9bd9('0x70')][_0x9bd9('0x2c')]);break;}}else{var _0x32c6fe=as['buildExpression'](_0x25a56e,_0x216709[_0x9bd9('0x3f')],_0xa2a92a);_0x4dda2e[_0xe06ed4](_0x32c6fe[_0x9bd9('0x7d')],_0x32c6fe['value']['start'],_0x32c6fe[_0x9bd9('0x70')][_0x9bd9('0x2c')]);}}}else{var _0x50e694=_(_0x9c69a0[_0x9bd9('0x44')])[_0x9bd9('0x45')]()['map'](function(_0xba5799){return _[_0x9bd9('0x7e')](_0x58f4a7,[_0x9bd9('0x43'),_0xba5799])?_0xba5799:undefined;})['compact']()[_0x9bd9('0x70')]();if(!_[_0x9bd9('0x7f')](_0x50e694)){_0x50e694[_0x9bd9('0x77')](function(_0x15f68e){if(_0x15f68e===_0x9bd9('0x80')){_0x503198['where'](_0x9bd9('0x81'),[][_0x9bd9('0x82')](_0x9c69a0['query'][_0x15f68e]));}else if(_0x15f68e===_0x9bd9('0x83')){var _0x4edf7a=JSON[_0x9bd9('0x84')](_0x9c69a0[_0x9bd9('0x44')][_0x15f68e])[_0x9bd9('0x85')];var _0x3f4cf7=JSON[_0x9bd9('0x84')](_0x9c69a0['query'][_0x15f68e])['$lte'];_0x503198[_0x9bd9('0x4e')](_0x9bd9('0x86'),_0x4edf7a,_0x3f4cf7);}else{if(_0x9c69a0['query'][_0x15f68e]===_0x9bd9('0x87')){_0x503198['where']('i.'+_0x15f68e+'\x20IS\x20NULL');}else{_0x503198[_0x9bd9('0x4e')]('i.'+_0x15f68e+_0x9bd9('0x88'),_0x9c69a0[_0x9bd9('0x44')][_0x15f68e]);}}});}if(_0x9c69a0[_0x9bd9('0x44')]['read']){if(_0x9c69a0['query'][_0x9bd9('0x89')]==0x1){_0x503198[_0x9bd9('0x6a')](_0x9bd9('0x8a'));}else{_0x503198[_0x9bd9('0x6a')](_0x9bd9('0x8b'));}}if(_0x9c69a0['query']['tag']){_0x4fe177=_[_0x9bd9('0x8c')](_0x9c69a0['query'][_0x9bd9('0x8d')])?_0x9c69a0[_0x9bd9('0x44')][_0x9bd9('0x8d')]:new Array(_0x9c69a0[_0x9bd9('0x44')][_0x9bd9('0x8d')]);_0x4fe177[_0x9bd9('0x77')](function(_0x4fe3e1){_0x4df5dd['or'](_0x9bd9('0x78'),'%,'+_0x4fe3e1+',%');});}if(_0x9c69a0[_0x9bd9('0x44')]['filter']){var _0x49c720=_0x9c69a0['query'][_0x9bd9('0x8e')][_0x9bd9('0x8f')]('\x5c','\x5c\x5c')[_0x9bd9('0x8f')](/'/g,'\x27\x27');if(qs[_0x9bd9('0x90')](_0x49c720)){_0x4dda2e['or']('i.id\x20LIKE\x20?',_0x49c720+'%');}else if(qs['isEmail'](_0x49c720)){_0x4dda2e['or'](_0x9bd9('0x91'),_0x49c720+'%');}else{_0x4dda2e['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9bd9('0x72')](_0x49c720))['or'](_0x9bd9('0x92'),qs[_0x9bd9('0x72')](_0x49c720));}}}_0x503198[_0x9bd9('0x4e')](_0x4dda2e);_0x503198[_0x9bd9('0x93')](_0x9bd9('0x94'));var _0x5ddae9={'type':db[_0x9bd9('0x95')][_0x9bd9('0x96')][_0x9bd9('0x97')],'raw':!![]};var _0x17fab0=_0x503198[_0x9bd9('0x98')]();_0x17fab0[_0x9bd9('0x50')](_0x9bd9('0x94'));_0x17fab0[_0x9bd9('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9bd9('0x69'));if(_0x2f285a['order']){_0x2f285a['order'][_0x9bd9('0x77')](function(_0x398d13){var _0x8bc086=_0x398d13[0x0]==='contactName'?_0x398d13[0x0]:'i.'+_0x398d13[0x0];_0x503198[_0x9bd9('0x99')](_0x8bc086,_0x398d13[0x1]===_0x9bd9('0x9a')?![]:!![]);});}if(!_['isEmpty'](_0x4fe177)){_0x503198['having'](_0x4df5dd);_0x17fab0['where'](_0x9bd9('0x9b'),_0x4fe177);}BPromise[_0x9bd9('0x9c')]()['then'](function(){if(!_0x4a4cf9){if(_0x9c69a0[_0x9bd9('0x44')][_0x9bd9('0x80')])return;_0x17fab0[_0x9bd9('0x4e')](_0x9bd9('0x9d'));_0x503198[_0x9bd9('0x4e')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x9c69a0[_0x9bd9('0x9e')][_0x9bd9('0x9f')]!==_0x9bd9('0xa0'))return;return _0x9c69a0[_0x9bd9('0x9e')][_0x9bd9('0xa1')]({'attributes':['id'],'raw':!![]})[_0x9bd9('0x2a')](function(_0x171874){if(_[_0x9bd9('0x7f')](_0x171874)){_0x17fab0[_0x9bd9('0x4e')](_0x9bd9('0xa2'));_0x503198['where'](_0x9bd9('0xa2'));}else{_0x17fab0[_0x9bd9('0x4e')]('i.MailAccountId\x20IN\x20?',_[_0x9bd9('0x42')](_0x171874,'id'));_0x503198[_0x9bd9('0x4e')](_0x9bd9('0x81'),_[_0x9bd9('0x42')](_0x171874,'id'));}});})[_0x9bd9('0x2a')](function(){if(_0x9c69a0[_0x9bd9('0x9e')]['role']===_0x9bd9('0xa0')&&!_0x4a4cf9&&!_0x9c69a0[_0x9bd9('0x44')][_0x9bd9('0x80')])return[];return db[_0x9bd9('0xa3')]['query'](_0x17fab0[_0x9bd9('0xa4')](),_0x5ddae9);})[_0x9bd9('0x2a')](function(_0x300e8e){_0x313fc0[_0x9bd9('0x23')]=_0x300e8e[_0x9bd9('0x4a')];if(_0x313fc0[_0x9bd9('0x23')]===0x0)return[];return db[_0x9bd9('0xa3')][_0x9bd9('0x44')](_0x2751c9[_0x9bd9('0xa4')](),_0x5ddae9)['then'](function(_0x357ec9){_0x3bc80b=_[_0x9bd9('0xa5')](_0x357ec9,'id');_0x5ddae9=_[_0x9bd9('0xa6')](_0x5ddae9,{'model':db[_0x9bd9('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9c69a0[_0x9bd9('0x44')]['fields']){_0x2f285a['attributes'][_0x9bd9('0x77')](function(_0x12db51){_0x503198[_0x9bd9('0x50')]('i.'+_0x12db51);});}else{_0x503198[_0x9bd9('0x50')](_0x9bd9('0xa7'),_0x9bd9('0x69'));_0x503198[_0x9bd9('0x50')]('a.key','Account.key');_0x503198[_0x9bd9('0x50')](_0x9bd9('0xa8'),_0x9bd9('0xa9'));_0x503198['field'](_0x9bd9('0xaa'),_0x9bd9('0xab'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0x94'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xac'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xad'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xae'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xaf'));_0x503198[_0x9bd9('0x50')]('i.attach');_0x503198[_0x9bd9('0x50')]('i.lastMsgAt');_0x503198[_0x9bd9('0x50')]('i.lastMsgDirection');_0x503198[_0x9bd9('0x50')](_0x9bd9('0xb0'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xb1'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xb2'));_0x503198['field'](_0x9bd9('0xb3'));_0x503198[_0x9bd9('0x50')]('i.substatus');_0x503198['field'](_0x9bd9('0xb4'));_0x503198[_0x9bd9('0x50')]('i.ContactId');_0x503198['field'](_0x9bd9('0xb5'));_0x503198[_0x9bd9('0x50')]('i.UserId');_0x503198['field'](_0x9bd9('0xb6'),'Contact.firstName');_0x503198[_0x9bd9('0x50')](_0x9bd9('0xb7'),_0x9bd9('0xb8'));_0x503198['field'](_0x9bd9('0xb9'),_0x9bd9('0xba'));_0x503198['field'](_0x9bd9('0xbb'),_0x9bd9('0xbc'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xbd'),_0x9bd9('0xbe'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xbf'),'Contact.fax');_0x503198['field'](_0x9bd9('0xc0'),_0x9bd9('0xc1'));_0x503198[_0x9bd9('0x50')]('o.internal',_0x9bd9('0xc2'));_0x503198[_0x9bd9('0x50')](_0x9bd9('0xc3'),_0x9bd9('0x32'));}if(_0x2f285a[_0x9bd9('0x25')])_0x503198[_0x9bd9('0x25')](_0x2f285a[_0x9bd9('0x25')]);if(_0x2f285a['offset'])_0x503198['offset'](_0x2f285a[_0x9bd9('0x24')]);return db[_0x9bd9('0xa3')][_0x9bd9('0x44')](_0x503198[_0x9bd9('0xa4')](),_0x5ddae9);})['then'](function(_0xccd01a){_0x366b7f['where'](_0x9bd9('0xc4'),_[_0x9bd9('0x42')](_0xccd01a,'id'));return db['sequelize'][_0x9bd9('0x44')](_0x366b7f[_0x9bd9('0xa4')](),_0x5ddae9)['then'](function(_0x6fac1d){var _0x5cff65=_[_0x9bd9('0xc5')](_0x6fac1d,_0x9bd9('0xc6'));var _0x31e74a=[];return db[_0x9bd9('0xc7')]['findOne']({'attributes':[_0x9bd9('0xc8')],'raw':!![]})[_0x9bd9('0x2a')](function(_0x5b9ef0){var _0xafba32=_0x5b9ef0[_0x9bd9('0xc8')];_0xccd01a[_0x9bd9('0x77')](function(_0x5066ea){_0x31e74a['push'](updateMailInteraction(_0x5066ea,_0x3bc80b,_0x5cff65,_0xafba32));});return BPromise[_0x9bd9('0xc9')](_0x31e74a);});});});})[_0x9bd9('0x2a')](function(_0x356c09){_0x313fc0[_0x9bd9('0xca')]=_0x356c09;return _0x313fc0;})['then'](respondWithFilteredResult(_0x31bf2f,_0x2f285a))[_0x9bd9('0x3a')](handleError(_0x31bf2f,null));};exports[_0x9bd9('0xcb')]=function(_0x45b83d,_0x121e44){var _0x15056e={'raw':![],'where':{'id':_0x45b83d[_0x9bd9('0xcc')]['id']}},_0x4ffc30={};_0x4ffc30[_0x9bd9('0x41')]=_['keys'](db[_0x9bd9('0x3c')][_0x9bd9('0x3d')]);_0x4ffc30[_0x9bd9('0x44')]=_[_0x9bd9('0x45')](_0x45b83d[_0x9bd9('0x44')]);_0x4ffc30[_0x9bd9('0x46')]=_['intersection'](_0x4ffc30[_0x9bd9('0x41')],_0x4ffc30[_0x9bd9('0x44')]);_0x15056e[_0x9bd9('0x49')]=_[_0x9bd9('0x47')](_0x4ffc30['model'],qs[_0x9bd9('0x48')](_0x45b83d[_0x9bd9('0x44')][_0x9bd9('0x48')]));_0x15056e[_0x9bd9('0x49')]=_0x15056e[_0x9bd9('0x49')]['length']?_0x15056e[_0x9bd9('0x49')]:_0x4ffc30[_0x9bd9('0x41')];if(_0x45b83d[_0x9bd9('0x44')][_0x9bd9('0xcd')]){_0x15056e[_0x9bd9('0xce')]=[{'all':!![]}];}_0x15056e=_['merge']({},_0x15056e,_0x45b83d[_0x9bd9('0xcf')]);return db[_0x9bd9('0x3c')][_0x9bd9('0x7b')](_0x15056e)[_0x9bd9('0x2a')](handleEntityNotFound(_0x121e44,null))[_0x9bd9('0x2a')](respondWithResult(_0x121e44,null))[_0x9bd9('0x3a')](handleError(_0x121e44,null));};exports[_0x9bd9('0xd0')]=function(_0x2a6b86,_0x2c8ee3){return db[_0x9bd9('0x3c')]['create'](_0x2a6b86[_0x9bd9('0xd1')],{})[_0x9bd9('0x2a')](respondWithResult(_0x2c8ee3,0xc9))[_0x9bd9('0x3a')](handleError(_0x2c8ee3,null));};exports[_0x9bd9('0xd2')]=function(_0x3712f5,_0x456718){if(_0x3712f5[_0x9bd9('0xd1')]['id']){delete _0x3712f5[_0x9bd9('0xd1')]['id'];}return db[_0x9bd9('0x3c')][_0x9bd9('0x7b')]({'where':{'id':_0x3712f5[_0x9bd9('0xcc')]['id']}})[_0x9bd9('0x2a')](handleEntityNotFound(_0x456718,null))[_0x9bd9('0x2a')](saveUpdates(_0x3712f5[_0x9bd9('0xd1')],null))[_0x9bd9('0x2a')](respondWithResult(_0x456718,null))[_0x9bd9('0x3a')](handleError(_0x456718,null));};exports[_0x9bd9('0x2b')]=function(_0x299521,_0x6c3236){return db[_0x9bd9('0x3c')][_0x9bd9('0x7b')]({'where':{'id':_0x299521[_0x9bd9('0xcc')]['id']}})[_0x9bd9('0x2a')](handleEntityNotFound(_0x6c3236,null))[_0x9bd9('0x2a')](removeEntity(_0x6c3236,null))['catch'](handleError(_0x6c3236,null));};exports[_0x9bd9('0xd3')]=function(_0x25d861,_0x1e498c){return db[_0x9bd9('0x3c')][_0x9bd9('0xd3')]()[_0x9bd9('0x2a')](respondWithResult(_0x1e498c,null))[_0x9bd9('0x3a')](handleError(_0x1e498c,null));};exports[_0x9bd9('0xd4')]=function(_0x7906a9,_0x4d6c85,_0x5b11f2){return db[_0x9bd9('0xd5')][_0x9bd9('0x7b')]({'where':{'id':_0x7906a9[_0x9bd9('0xcc')]['id']}})[_0x9bd9('0x2a')](handleEntityNotFound(_0x4d6c85,null))[_0x9bd9('0x2a')](function(_0x3333ed){if(_0x3333ed){return _0x3333ed[_0x9bd9('0xd4')](_0x7906a9[_0x9bd9('0xd1')][_0x9bd9('0xd6')],_['omit'](_0x7906a9['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4d6c85,null))['catch'](handleError(_0x4d6c85,null));};exports[_0x9bd9('0xd7')]=function(_0x32d340,_0xc0cbe,_0x5068d9){var _0x536781={'raw':![],'where':{}};var _0x467d75={};var _0xc2f888={'count':0x0,'rows':[]};return db[_0x9bd9('0x3c')][_0x9bd9('0x35')]({'where':{'id':_0x32d340[_0x9bd9('0xcc')]['id']}})[_0x9bd9('0x2a')](handleEntityNotFound(_0xc0cbe,null))[_0x9bd9('0x2a')](function(_0x504a93){if(_0x504a93){_0x467d75[_0x9bd9('0x41')]=_[_0x9bd9('0x45')](db[_0x9bd9('0xd5')][_0x9bd9('0x3d')]);_0x467d75[_0x9bd9('0x44')]=_['keys'](_0x32d340[_0x9bd9('0x44')]);_0x467d75[_0x9bd9('0x46')]=_[_0x9bd9('0x47')](_0x467d75['model'],_0x467d75[_0x9bd9('0x44')]);_0x536781[_0x9bd9('0x49')]=_['intersection'](_0x467d75[_0x9bd9('0x41')],qs['fields'](_0x32d340[_0x9bd9('0x44')][_0x9bd9('0x48')]));_0x536781[_0x9bd9('0x49')]=_0x536781[_0x9bd9('0x49')][_0x9bd9('0x4a')]?_0x536781[_0x9bd9('0x49')]:_0x467d75['model'];if(!_0x32d340[_0x9bd9('0x44')]['hasOwnProperty'](_0x9bd9('0x4c'))){_0x536781[_0x9bd9('0x25')]=qs[_0x9bd9('0x25')](_0x32d340[_0x9bd9('0x44')][_0x9bd9('0x25')]);_0x536781[_0x9bd9('0x24')]=qs['offset'](_0x32d340[_0x9bd9('0x44')][_0x9bd9('0x24')]);}_0x536781['order']=qs[_0x9bd9('0x4d')](_0x32d340[_0x9bd9('0x44')][_0x9bd9('0x4d')]);_0x536781[_0x9bd9('0x4e')]=qs[_0x9bd9('0x46')](_[_0x9bd9('0xd8')](_0x32d340[_0x9bd9('0x44')],_0x467d75[_0x9bd9('0x46')]));_0x536781[_0x9bd9('0x4e')]['MailInteractionId']=_0x504a93['id'];if(_0x32d340[_0x9bd9('0x44')][_0x9bd9('0x8e')]){_0x536781[_0x9bd9('0x4e')]=_[_0x9bd9('0xa6')](_0x536781[_0x9bd9('0x4e')],{'$or':_[_0x9bd9('0x42')](_0x536781['attributes'],function(_0x2351f9){var _0x3acd7c={};_0x3acd7c[_0x2351f9]={'$like':'%'+_0x32d340['query']['filter']+'%'};return _0x3acd7c;})});}if(_0x32d340[_0x9bd9('0x44')][_0x9bd9('0x85')]){var _0x36cef2=_0x32d340[_0x9bd9('0x44')][_0x9bd9('0x85')][_0x9bd9('0x71')](',');var _0x32782a={};_0x32782a[_0x36cef2[0x0]]={'$gte':moment(_0x36cef2[0x1])[_0x9bd9('0xd9')](_0x9bd9('0xda'))};_0x536781['where']=_['merge'](_0x536781['where'],_0x32782a);}_0x536781=_['merge']({},_0x536781,_0x32d340[_0x9bd9('0xcf')]);return db[_0x9bd9('0xd5')][_0x9bd9('0x23')]({'where':_0x536781[_0x9bd9('0x4e')]})['then'](function(_0x3166e3){_0xc2f888[_0x9bd9('0x23')]=_0x3166e3;if(_0x32d340[_0x9bd9('0x44')][_0x9bd9('0xcd')]){_0x536781[_0x9bd9('0xce')]=[{'all':!![]}];}return db[_0x9bd9('0xd5')][_0x9bd9('0xdb')](_0x536781);})[_0x9bd9('0x2a')](function(_0x357741){if(_0x32d340['query'][_0x9bd9('0xdc')]===_0x9bd9('0xdd')){for(var _0x1a2cc9=0x0;_0x1a2cc9<_0x357741[_0x9bd9('0x4a')];_0x1a2cc9++){_0x357741[_0x1a2cc9][_0x9bd9('0xd1')]=juice(_0x357741[_0x1a2cc9]['body']);}}_0xc2f888[_0x9bd9('0xca')]=_0x357741;return _0xc2f888;});}})[_0x9bd9('0x2a')](respondWithFilteredResult(_0xc0cbe,_0x536781))[_0x9bd9('0x3a')](handleError(_0xc0cbe,null));};exports['addTags']=function(_0x47fc05,_0x49f9b8,_0xc3e71d){return db[_0x9bd9('0x3c')]['find']({'where':{'id':_0x47fc05[_0x9bd9('0xcc')]['id']}})[_0x9bd9('0x2a')](handleEntityNotFound(_0x49f9b8,null))[_0x9bd9('0x2a')](function(_0x269b52){if(_0x269b52){return _0x269b52[_0x9bd9('0xde')](_0x47fc05[_0x9bd9('0xd1')]['ids'],_['omit'](_0x47fc05[_0x9bd9('0xd1')],[_0x9bd9('0xd6'),'id'])||{})[_0x9bd9('0xdf')](function(){return db[_0x9bd9('0x76')][_0x9bd9('0xdb')]({'attributes':['id','name','color'],'where':{'id':_0x47fc05['body'][_0x9bd9('0xd6')]}});})[_0x9bd9('0x2a')](function(_0x4b9b5d){socket[_0x9bd9('0xe0')](_0x9bd9('0xe1'),{'id':Number(_0x47fc05[_0x9bd9('0xcc')]['id']),'tags':_0x4b9b5d||[]});return{'id':Number(_0x47fc05[_0x9bd9('0xcc')]['id']),'tags':_0x4b9b5d||[]};});}})[_0x9bd9('0x2a')](respondWithResult(_0x49f9b8,null))[_0x9bd9('0x3a')](handleError(_0x49f9b8,null));};exports['removeTags']=function(_0xfb163,_0x2347d6,_0xe863c5){return db['MailInteraction']['find']({'where':{'id':_0xfb163[_0x9bd9('0xcc')]['id']}})['then'](handleEntityNotFound(_0x2347d6,null))['then'](function(_0x1f787c){if(_0x1f787c){return _0x1f787c[_0x9bd9('0xe2')](_0xfb163[_0x9bd9('0x44')][_0x9bd9('0xd6')]);}})[_0x9bd9('0x2a')](respondWithStatusCode(_0x2347d6,null))[_0x9bd9('0x3a')](handleError(_0x2347d6,null));};exports[_0x9bd9('0xe3')]=function(_0x588935,_0x28759c){var _0x534ccf=moment()[_0x9bd9('0xe4')]()[_0x9bd9('0xa4')]();var _0x3746ac=path[_0x9bd9('0xe5')](config['root'],_0x9bd9('0xe6'),_0x9bd9('0xe7'),_0x9bd9('0xe8'));var _0x1355ba=path['join'](config['root'],_0x9bd9('0xe6'),_0x9bd9('0xe7'),'attachments');var _0x13c14f=path[_0x9bd9('0xe5')](_0x3746ac,_0x534ccf);var _0x267b49=util['format'](_0x9bd9('0xe9'),_0x588935[_0x9bd9('0xcc')]['id'],_0x534ccf);var _0x52770e=path[_0x9bd9('0xe5')](_0x3746ac,_0x267b49);var _0x1aab97=[];if(_0x588935[_0x9bd9('0x44')]['attachments']){_0x1aab97[_0x9bd9('0x34')]({'model':db[_0x9bd9('0xea')],'as':'Attachments','raw':!![]});}var _0x506fbf=[{'model':db[_0x9bd9('0xd5')],'as':_0x9bd9('0xeb'),'attributes':['id',_0x9bd9('0xd1'),_0x9bd9('0x52'),'to','cc',_0x9bd9('0xec'),'subject',_0x9bd9('0x83')],'where':{'secret':![]},'order':qs[_0x9bd9('0x4d')]('id'),'include':_0x1aab97}];return db['MailInteraction'][_0x9bd9('0x7b')]({'where':{'id':_0x588935[_0x9bd9('0xcc')]['id']},'include':_0x506fbf})[_0x9bd9('0x2a')](handleEntityNotFound(_0x28759c,null))[_0x9bd9('0x2a')](function(_0x4ce004){if(_0x4ce004&&_0x4ce004[_0x9bd9('0xeb')]){var _0x2dc0b2=_0x4ce004[_0x9bd9('0xed')]({'plain':!![]});fs['mkdirSync'](_0x13c14f);return BPromise[_0x9bd9('0xee')](_0x2dc0b2[_0x9bd9('0xeb')],function(_0x3af1,_0x5f3021){var _0xec0d23={'from':_0x3af1[_0x9bd9('0x52')],'to':_0x3af1['to'],'subject':_0x3af1[_0x9bd9('0xef')],'html':_0x3af1[_0x9bd9('0xd1')],'headers':{'Date':moment(_0x3af1[_0x9bd9('0x83')])['format'](_0x9bd9('0xf0'))},'attachments':[]};if(_0x3af1['cc']){_0xec0d23['headers']['Cc']=_0x3af1['cc'];}if(_0x3af1[_0x9bd9('0xec')]){_0xec0d23[_0x9bd9('0xf1')][_0x9bd9('0xf2')]=_0x3af1[_0x9bd9('0xec')];}return new BPromise(function(_0x14d64c,_0x2427fd){if(_0x3af1[_0x9bd9('0xf3')]){for(var _0x34e31d=0x0;_0x34e31d<_0x3af1['Attachments'][_0x9bd9('0x4a')];_0x34e31d++){var _0x33aedc=_0x3af1[_0x9bd9('0xf3')][_0x34e31d];var _0x1845fb=path[_0x9bd9('0xe5')](_0x1355ba,_0x33aedc[_0x9bd9('0xf4')]);if(fs[_0x9bd9('0xf5')](_0x1845fb)){_0xec0d23['attachments'][_0x9bd9('0x34')]({'name':_0x33aedc['name'],'contentType':_0x33aedc[_0x9bd9('0x3f')],'data':fs[_0x9bd9('0xf6')](_0x1845fb)});}}}emlformat['build'](_0xec0d23,function(_0x408133,_0xb632){if(_0x408133)return _0x2427fd(_0x408133);fs[_0x9bd9('0xf7')](path[_0x9bd9('0xe5')](_0x13c14f,util[_0x9bd9('0xd9')](_0x9bd9('0xf8'),_0x5f3021)),_0xb632);return _0x14d64c(_0xb632);});});})[_0x9bd9('0x2a')](function(){return new BPromise(function(_0x1b1f44,_0x32582f){zipdir(_0x13c14f,{'saveTo':_0x52770e},function(_0x51e616,_0x1f6d18){if(_0x51e616)return _0x32582f(_0x51e616);return _0x1b1f44(_0x1f6d18);});})['then'](function(){return new BPromise(function(_0x230ddd,_0x5e1898){rimraf(_0x13c14f,function(_0x639c8a){if(_0x639c8a)_0x5e1898(_0x639c8a);return _0x230ddd();});});})[_0x9bd9('0x2a')](function(){return _0x28759c[_0x9bd9('0xe3')](_0x52770e,_0x267b49,function(_0x25a261){if(_0x25a261){console[_0x9bd9('0xf9')]('err',_0x25a261);}else{fs[_0x9bd9('0xfa')](_0x52770e);}});});});}else{return _0x28759c[_0x9bd9('0x20')](0xc8);}})[_0x9bd9('0x3a')](handleError(_0x28759c,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 275caec..04a8229 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 _0x1447=['MailInteraction','MailMessage','save','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x5ef7b8,_0x15cc07){var _0x2c7148=function(_0x398519){while(--_0x398519){_0x5ef7b8['push'](_0x5ef7b8['shift']());}};_0x2c7148(++_0x15cc07);}(_0x1447,0x64));var _0x7144=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1447[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x7144('0x0'));var MailInteraction=require(_0x7144('0x1'))['db'][_0x7144('0x2')];var MailMessage=require(_0x7144('0x1'))['db'][_0x7144('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7144('0x4'),'afterUpdate':_0x7144('0x5'),'afterDestroy':_0x7144('0x6')};function emitEvent(_0x4e5dad){return function(_0x168077,_0x4ff6b0,_0x1d8396){_0x168077['getUsers']({'attributes':['id'],'raw':!![]})[_0x7144('0x7')](function(_0x29516d){_0x168077[_0x7144('0x8')]('Users',_0x29516d[_0x7144('0x9')](function(_0x22f9b9){return{'id':_0x22f9b9['id']};}));return MailMessage[_0x7144('0xa')]({'where':{'MailInteractionId':_0x168077['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7144('0x7')](function(_0x19df2d){_0x168077[_0x7144('0x8')](_0x7144('0xb'),_0x19df2d[_0x7144('0xc')]);MailInteractionEvents[_0x7144('0xd')](_0x4e5dad+':'+_0x168077['id'],_0x168077);MailInteractionEvents[_0x7144('0xd')](_0x4e5dad,_0x168077);_0x1d8396(null);})[_0x7144('0xe')](_0x1d8396(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x7144('0xf')](e,emitEvent(event));}}module[_0x7144('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x6515=['Users','then','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x6515,0x108));var _0x5651=function(_0x4503e4,_0x52c6ee){_0x4503e4=_0x4503e4-0x0;var _0x27d546=_0x6515[_0x4503e4];return _0x27d546;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x5651('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x5651('0x0'))['db'][_0x5651('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5651('0x2')](0x0);var events={'afterCreate':_0x5651('0x3'),'afterUpdate':_0x5651('0x4'),'afterDestroy':_0x5651('0x5')};function emitEvent(_0x4ac05b){return function(_0x458c70,_0x293d0e,_0x4f060b){_0x458c70[_0x5651('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21542b){_0x458c70[_0x5651('0x7')](_0x5651('0x8'),_0x21542b['map'](function(_0x22cb1f){return{'id':_0x22cb1f['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x458c70['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5651('0x9')](function(_0x4ea8aa){_0x458c70[_0x5651('0x7')]('unreadMessages',_0x4ea8aa[_0x5651('0xa')]);MailInteractionEvents[_0x5651('0xb')](_0x4ac05b+':'+_0x458c70['id'],_0x458c70);MailInteractionEvents['emit'](_0x4ac05b,_0x458c70);_0x4f060b(null);})[_0x5651('0xc')](_0x4f060b(null));};}for(var e in events){if(events[_0x5651('0xd')](e)){var event=events[e];MailInteraction[_0x5651('0xe')](e,emitEvent(event));}}module[_0x5651('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c926686..5c9c8ab 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 _0xa4de=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','catch','utf8mb4','lodash'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xa4de,0x10d));var _0xea4d=function(_0xf3af93,_0x40fcb6){_0xf3af93=_0xf3af93-0x0;var _0x19a5b9=_0xa4de[_0xf3af93];return _0x19a5b9;};'use strict';var _=require(_0xea4d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xea4d('0x1'));var moment=require(_0xea4d('0x2'));var BPromise=require(_0xea4d('0x3'));var rp=require(_0xea4d('0x4'));var fs=require('fs');var path=require(_0xea4d('0x5'));var rimraf=require(_0xea4d('0x6'));var config=require(_0xea4d('0x7'));var attributes=require(_0xea4d('0x8'));module[_0xea4d('0x9')]=function(_0x24d5fe,_0x604a6a){return _0x24d5fe[_0xea4d('0xa')]('MailInteraction',attributes,{'tableName':_0xea4d('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xea4d('0xc'),'to'],'type':_0xea4d('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x8820aa,_0x1d58bb,_0x1be67b){if(_0x8820aa[_0xea4d('0xe')]){_0x8820aa[_0xea4d('0xf')]=moment()[_0xea4d('0x10')](_0xea4d('0x11'));}if(_0x8820aa[_0xea4d('0x12')]){_0x8820aa[_0xea4d('0x13')]=moment()[_0xea4d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1be67b(null,_0x1d58bb);},'beforeUpdate':function(_0x36196f,_0x252729,_0x2c4651){if(_0x36196f[_0xea4d('0x14')](_0xea4d('0xe'))){_0x36196f['substatusAt']=_0x36196f[_0xea4d('0xe')]?moment()[_0xea4d('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x36196f['changed'](_0xea4d('0x12'))){_0x36196f[_0xea4d('0x13')]=moment()[_0xea4d('0x10')](_0xea4d('0x11'));_0x36196f[_0xea4d('0xe')]=null;_0x36196f[_0xea4d('0xf')]=null;}_0x2c4651(null,_0x36196f);},'afterUpdate':function(_0x1f725f,_0x540814,_0x1fe57e){var _0x5bdbc0=_0x24d5fe[_0xea4d('0x15')];var _0xe9925d=_0x1f725f[_0xea4d('0x16')]({'plain':!![]});if(_0xe9925d[_0xea4d('0x12')]){return _0x5bdbc0[_0xea4d('0x17')][_0xea4d('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0xe9925d['id']}})['then'](function(){_0x1fe57e();})[_0xea4d('0x19')](function(_0x4c24b4){_0x1fe57e(_0x4c24b4);});}else{_0x1fe57e();}}},'charset':_0xea4d('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf45e=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf45e,0x115));var _0xef45=function(_0x5ea981,_0x26680c){_0x5ea981=_0x5ea981-0x0;var _0x5f4eb4=_0xf45e[_0x5ea981];return _0x5f4eb4;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var logger=require(_0xef45('0x1'))('api');var moment=require(_0xef45('0x2'));var BPromise=require(_0xef45('0x3'));var rp=require(_0xef45('0x4'));var fs=require('fs');var path=require(_0xef45('0x5'));var rimraf=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var attributes=require(_0xef45('0x8'));module[_0xef45('0x9')]=function(_0x338960,_0x315b84){return _0x338960[_0xef45('0xa')](_0xef45('0xb'),attributes,{'tableName':_0xef45('0xc'),'paranoid':![],'indexes':[{'name':_0xef45('0xd'),'fields':[_0xef45('0xe'),'to'],'type':_0xef45('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x134c86,_0x158a0b,_0xdac512){if(_0x134c86['substatus']){_0x134c86[_0xef45('0x10')]=moment()[_0xef45('0x11')](_0xef45('0x12'));}if(_0x134c86[_0xef45('0x13')]){_0x134c86[_0xef45('0x14')]=moment()[_0xef45('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0xdac512(null,_0x158a0b);},'beforeUpdate':function(_0x14d870,_0x3c43bb,_0x30babb){if(_0x14d870[_0xef45('0x15')](_0xef45('0x16'))){_0x14d870['substatusAt']=_0x14d870['substatus']?moment()[_0xef45('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x14d870[_0xef45('0x15')](_0xef45('0x13'))){_0x14d870[_0xef45('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x14d870[_0xef45('0x16')]=null;_0x14d870['substatusAt']=null;}_0x30babb(null,_0x14d870);},'afterUpdate':function(_0x11cd3a,_0x2a342e,_0x1068a1){var _0x3f40e5=_0x338960['models'];var _0x560b2f=_0x11cd3a[_0xef45('0x17')]({'plain':!![]});if(_0x560b2f[_0xef45('0x13')]){return _0x3f40e5[_0xef45('0x18')][_0xef45('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x560b2f['id']}})['then'](function(){_0x1068a1();})['catch'](function(_0x2c57fc){_0x1068a1(_0x2c57fc);});}else{_0x1068a1();}}},'charset':_0xef45('0x1a'),'collate':_0xef45('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8a38427..0bf088f 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 _0x7cda=['register','info','request\x20sent','debug','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','update','options','attributes','limit','catch','AddTagsToMailInteraction','find','where','then','body','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./mailInteraction.socket'];(function(_0x1717f5,_0x17ec76){var _0x2ba043=function(_0x76acac){while(--_0x76acac){_0x1717f5['push'](_0x1717f5['shift']());}};_0x2ba043(++_0x17ec76);}(_0x7cda,0xf6));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa7cd('0x0'));var moment=require(_0xa7cd('0x1'));var BPromise=require(_0xa7cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7cd('0x3'));var db=require(_0xa7cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7cd('0x5'))(_0xa7cd('0x6'));var config=require(_0xa7cd('0x7'));var jayson=require(_0xa7cd('0x8'));var client=jayson['client'][_0xa7cd('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa7cd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7cd('0xb'))(new Redis(config[_0xa7cd('0xa')]));require(_0xa7cd('0xc'))[_0xa7cd('0xd')](socket);function respondWithRpcPromise(_0x31879f,_0x372273,_0x39d8c4){return new BPromise(function(_0x1a66f7,_0xd20e5d){return client['request'](_0x31879f,_0x39d8c4)['then'](function(_0x3c38a4){logger[_0xa7cd('0xe')]('MailInteraction,\x20%s,\x20%s',_0x372273,_0xa7cd('0xf'));logger[_0xa7cd('0x10')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x372273,_0xa7cd('0xf'),JSON[_0xa7cd('0x11')](_0x3c38a4));if(_0x3c38a4[_0xa7cd('0x12')]){if(_0x3c38a4['error'][_0xa7cd('0x13')]===0x1f4){logger[_0xa7cd('0x12')](_0xa7cd('0x14'),_0x372273,_0x3c38a4[_0xa7cd('0x12')][_0xa7cd('0x15')]);return _0xd20e5d(_0x3c38a4[_0xa7cd('0x12')]['message']);}logger['error'](_0xa7cd('0x14'),_0x372273,_0x3c38a4[_0xa7cd('0x12')][_0xa7cd('0x15')]);return _0x1a66f7(_0x3c38a4['error'][_0xa7cd('0x15')]);}else{logger[_0xa7cd('0xe')]('MailInteraction,\x20%s,\x20%s',_0x372273,_0xa7cd('0xf'));_0x1a66f7(_0x3c38a4[_0xa7cd('0x16')][_0xa7cd('0x15')]);}})['catch'](function(_0x111774){logger[_0xa7cd('0x12')]('MailInteraction,\x20%s,\x20%s',_0x372273,_0x111774);_0xd20e5d(_0x111774);});});}exports[_0xa7cd('0x17')]=function(_0x7eab17){var _0x14305a=this;return new Promise(function(_0x5224b0,_0x4c601c){return db['MailInteraction'][_0xa7cd('0x18')](_0x7eab17['body'],{'raw':_0x7eab17['options']?_0x7eab17[_0xa7cd('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7eab17[_0xa7cd('0x19')]?_0x7eab17[_0xa7cd('0x19')]['where']||null:null,'attributes':_0x7eab17['options']?_0x7eab17['options'][_0xa7cd('0x1a')]||null:null,'limit':_0x7eab17['options']?_0x7eab17[_0xa7cd('0x19')][_0xa7cd('0x1b')]||null:null})['then'](function(_0x39f093){logger['info'](_0xa7cd('0x17'),_0x7eab17);logger[_0xa7cd('0x10')]('UpdateMailInteraction',_0x7eab17,JSON[_0xa7cd('0x11')](_0x39f093));_0x5224b0(_0x39f093);})[_0xa7cd('0x1c')](function(_0x53d3b7){logger['error'](_0xa7cd('0x17'),_0x53d3b7['message'],_0x7eab17);_0x4c601c(_0x14305a[_0xa7cd('0x12')](0x1f4,_0x53d3b7['message']));});});};exports[_0xa7cd('0x1d')]=function(_0x2b1b0a){return new Promise(function(_0x58bd0c,_0x484fdc){return db['MailInteraction'][_0xa7cd('0x1e')]({'where':_0x2b1b0a['options']?_0x2b1b0a[_0xa7cd('0x19')][_0xa7cd('0x1f')]||null:null})[_0xa7cd('0x20')](function(_0x4531b4){if(_0x4531b4){return _0x4531b4['addTags'](_0x2b1b0a[_0xa7cd('0x21')]['ids'],_[_0xa7cd('0x22')](_0x2b1b0a[_0xa7cd('0x21')],['ids','id'])||{});}})[_0xa7cd('0x23')](function(_0x2407ff){logger[_0xa7cd('0xe')](_0xa7cd('0x24'),_0x2b1b0a);logger[_0xa7cd('0x10')](_0xa7cd('0x24'),_0x2b1b0a,JSON[_0xa7cd('0x11')](_0x2407ff));_0x58bd0c(_0x2407ff);})[_0xa7cd('0x1c')](function(_0x2db7e3){logger[_0xa7cd('0x12')]('AddTags',_0x2db7e3[_0xa7cd('0x15')],_0x2b1b0a);_0x484fdc(_this[_0xa7cd('0x12')](0x1f4,_0x2db7e3['message']));});});}; \ No newline at end of file +var _0x1020=['error','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','limit','then','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x337d8d,_0x363c66){var _0x5cdcbf=function(_0xb2e653){while(--_0xb2e653){_0x337d8d['push'](_0x337d8d['shift']());}};_0x5cdcbf(++_0x363c66);}(_0x1020,0x1a4));var _0x0102=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x1020[_0x10c16d];return _0x5896f4;};'use strict';var _=require(_0x0102('0x0'));var util=require('util');var moment=require(_0x0102('0x1'));var BPromise=require(_0x0102('0x2'));var rs=require(_0x0102('0x3'));var fs=require('fs');var Redis=require(_0x0102('0x4'));var db=require(_0x0102('0x5'))['db'];var utils=require(_0x0102('0x6'));var logger=require(_0x0102('0x7'))(_0x0102('0x8'));var config=require(_0x0102('0x9'));var jayson=require(_0x0102('0xa'));var client=jayson[_0x0102('0xb')][_0x0102('0xc')]({'port':0x232a});config['redis']=_[_0x0102('0xd')](config[_0x0102('0xe')],{'host':_0x0102('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0102('0x10'))['register'](socket);function respondWithRpcPromise(_0x47fac0,_0x184782,_0x345729){return new BPromise(function(_0xf82693,_0x376bea){return client[_0x0102('0x11')](_0x47fac0,_0x345729)['then'](function(_0x74fe25){logger[_0x0102('0x12')](_0x0102('0x13'),_0x184782,_0x0102('0x14'));logger[_0x0102('0x15')](_0x0102('0x16'),_0x184782,_0x0102('0x14'),JSON[_0x0102('0x17')](_0x74fe25));if(_0x74fe25[_0x0102('0x18')]){if(_0x74fe25['error']['code']===0x1f4){logger[_0x0102('0x18')](_0x0102('0x13'),_0x184782,_0x74fe25[_0x0102('0x18')][_0x0102('0x19')]);return _0x376bea(_0x74fe25[_0x0102('0x18')][_0x0102('0x19')]);}logger[_0x0102('0x18')](_0x0102('0x13'),_0x184782,_0x74fe25[_0x0102('0x18')][_0x0102('0x19')]);return _0xf82693(_0x74fe25[_0x0102('0x18')]['message']);}else{logger[_0x0102('0x12')]('MailInteraction,\x20%s,\x20%s',_0x184782,'request\x20sent');_0xf82693(_0x74fe25['result'][_0x0102('0x19')]);}})[_0x0102('0x1a')](function(_0x41c0a1){logger[_0x0102('0x18')](_0x0102('0x13'),_0x184782,_0x41c0a1);_0x376bea(_0x41c0a1);});});}exports[_0x0102('0x1b')]=function(_0x74533b){var _0x2fba8b=this;return new Promise(function(_0x3da475,_0x43eb89){return db[_0x0102('0x1c')][_0x0102('0x1d')](_0x74533b[_0x0102('0x1e')],{'raw':_0x74533b[_0x0102('0x1f')]?_0x74533b[_0x0102('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x74533b[_0x0102('0x1f')]?_0x74533b[_0x0102('0x1f')][_0x0102('0x20')]||null:null,'attributes':_0x74533b[_0x0102('0x1f')]?_0x74533b[_0x0102('0x1f')]['attributes']||null:null,'limit':_0x74533b[_0x0102('0x1f')]?_0x74533b[_0x0102('0x1f')][_0x0102('0x21')]||null:null})[_0x0102('0x22')](function(_0x130f92){logger[_0x0102('0x12')]('UpdateMailInteraction',_0x74533b);logger[_0x0102('0x15')](_0x0102('0x1b'),_0x74533b,JSON[_0x0102('0x17')](_0x130f92));_0x3da475(_0x130f92);})[_0x0102('0x1a')](function(_0x563f44){logger[_0x0102('0x18')](_0x0102('0x1b'),_0x563f44[_0x0102('0x19')],_0x74533b);_0x43eb89(_0x2fba8b[_0x0102('0x18')](0x1f4,_0x563f44[_0x0102('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x2e01c7){return new Promise(function(_0xae6964,_0x5a3850){return db[_0x0102('0x1c')]['find']({'where':_0x2e01c7[_0x0102('0x1f')]?_0x2e01c7[_0x0102('0x1f')][_0x0102('0x20')]||null:null})['then'](function(_0x51ee86){if(_0x51ee86){return _0x51ee86['addTags'](_0x2e01c7[_0x0102('0x1e')][_0x0102('0x23')],_['omit'](_0x2e01c7[_0x0102('0x1e')],[_0x0102('0x23'),'id'])||{});}})['spread'](function(_0x59a8ab){logger['info'](_0x0102('0x24'),_0x2e01c7);logger[_0x0102('0x15')](_0x0102('0x24'),_0x2e01c7,JSON[_0x0102('0x17')](_0x59a8ab));_0xae6964(_0x59a8ab);})[_0x0102('0x1a')](function(_0x1fc0bc){logger[_0x0102('0x18')](_0x0102('0x24'),_0x1fc0bc[_0x0102('0x19')],_0x2e01c7);_0x5a3850(_this[_0x0102('0x18')](0x1f4,_0x1fc0bc[_0x0102('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ec3a5e6..2b2a6b3 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 _0x250f=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','update'];(function(_0x177f7d,_0x4e3330){var _0x50383b=function(_0x5013a9){while(--_0x5013a9){_0x177f7d['push'](_0x177f7d['shift']());}};_0x50383b(++_0x4e3330);}(_0x250f,0x1ac));var _0xf250=function(_0x26d182,_0x1a480e){_0x26d182=_0x26d182-0x0;var _0x5efbe6=_0x250f[_0x26d182];return _0x5efbe6;};'use strict';var MailInteractionEvents=require(_0xf250('0x0'));var events=[_0xf250('0x1'),_0xf250('0x2'),_0xf250('0x3')];function createListener(_0x43577d,_0x5e40af){return function(_0x3aeb8b){_0x5e40af['emit'](_0x43577d,_0x3aeb8b);};}function removeListener(_0x3481da,_0x10a86a){return function(){MailInteractionEvents[_0xf250('0x4')](_0x3481da,_0x10a86a);};}exports[_0xf250('0x5')]=function(_0x5dcc12){for(var _0x34e8bf=0x0,_0x3f2720=events[_0xf250('0x6')];_0x34e8bf<_0x3f2720;_0x34e8bf++){var _0x3704ab=events[_0x34e8bf];var _0x2c435d=createListener(_0xf250('0x7')+_0x3704ab,_0x5dcc12);MailInteractionEvents['on'](_0x3704ab,_0x2c435d);}}; \ No newline at end of file +var _0xa9bb=['register','length','mailInteraction:','./mailInteraction.events','remove','update','emit','removeListener'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xa9bb,0x6b));var _0xba9b=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xa9bb[_0x8a969d];return _0x1d8dc7;};'use strict';var MailInteractionEvents=require(_0xba9b('0x0'));var events=['save',_0xba9b('0x1'),_0xba9b('0x2')];function createListener(_0x2513d5,_0x3ed5b7){return function(_0x5589f4){_0x3ed5b7[_0xba9b('0x3')](_0x2513d5,_0x5589f4);};}function removeListener(_0x593745,_0x581c3a){return function(){MailInteractionEvents[_0xba9b('0x4')](_0x593745,_0x581c3a);};}exports[_0xba9b('0x5')]=function(_0x58c2ad){for(var _0x2a4e21=0x0,_0x116a46=events[_0xba9b('0x6')];_0x2a4e21<_0x116a46;_0x2a4e21++){var _0x212361=events[_0x2a4e21];var _0x3b0854=createListener(_0xba9b('0x7')+_0x212361,_0x58c2ad);MailInteractionEvents['on'](_0x212361,_0x3b0854);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f462c55..e1ad813 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 _0x4771=['mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','index','get','/describe','describe','/:id','isAuthenticated','show','download','post','mail'];(function(_0xc80702,_0x18ef50){var _0x4c4c76=function(_0x24ee31){while(--_0x24ee31){_0xc80702['push'](_0xc80702['shift']());}};_0x4c4c76(++_0x18ef50);}(_0x4771,0x185));var _0x1477=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4771[_0x178e48];return _0x440d7e;};'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[_0x1477('0x0')]();var fs_extra=require(_0x1477('0x1'));var auth=require(_0x1477('0x2'));var interaction=require(_0x1477('0x3'));var config=require(_0x1477('0x4'));var controller=require(_0x1477('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x1477('0x6')]);router[_0x1477('0x7')](_0x1477('0x8'),auth['isAuthenticated'](),controller[_0x1477('0x9')]);router['get'](_0x1477('0xa'),auth[_0x1477('0xb')](),controller[_0x1477('0xc')]);router[_0x1477('0x7')]('/:id/download',auth[_0x1477('0xb')](),controller[_0x1477('0xd')]);router[_0x1477('0xe')]('/',auth[_0x1477('0xb')](),interaction['tracked'](_0x1477('0xf'),_0x1477('0x10')),controller[_0x1477('0x11')]);router[_0x1477('0x12')](_0x1477('0xa'),auth[_0x1477('0xb')](),controller[_0x1477('0x13')]);router[_0x1477('0x12')](_0x1477('0x14'),auth[_0x1477('0xb')](),controller[_0x1477('0x15')]);router[_0x1477('0x12')](_0x1477('0x16'),auth['isAuthenticated'](),controller[_0x1477('0x17')]);router[_0x1477('0x18')]('/:id',auth[_0x1477('0xb')](),controller[_0x1477('0x19')]);module[_0x1477('0x1a')]=router; \ No newline at end of file +var _0x5ec4=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x269d98,_0x844513){var _0x1a9725=function(_0x37de60){while(--_0x37de60){_0x269d98['push'](_0x269d98['shift']());}};_0x1a9725(++_0x844513);}(_0x5ec4,0x19d));var _0x45ec=function(_0x1e28e8,_0x4980db){_0x1e28e8=_0x1e28e8-0x0;var _0x1ed4bf=_0x5ec4[_0x1e28e8];return _0x1ed4bf;};'use strict';var multer=require(_0x45ec('0x0'));var util=require(_0x45ec('0x1'));var path=require(_0x45ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x45ec('0x3'));var router=express[_0x45ec('0x4')]();var fs_extra=require(_0x45ec('0x5'));var auth=require(_0x45ec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x45ec('0x7'));var controller=require('./mailMessage.controller');router[_0x45ec('0x8')]('/',auth[_0x45ec('0x9')](),controller[_0x45ec('0xa')]);router[_0x45ec('0x8')](_0x45ec('0xb'),auth[_0x45ec('0x9')](),controller[_0x45ec('0xc')]);router[_0x45ec('0x8')](_0x45ec('0xd'),auth[_0x45ec('0x9')](),controller[_0x45ec('0xe')]);router[_0x45ec('0x8')](_0x45ec('0xf'),auth[_0x45ec('0x9')](),controller[_0x45ec('0x10')]);router[_0x45ec('0x11')]('/',auth[_0x45ec('0x9')](),interaction[_0x45ec('0x12')](_0x45ec('0x13'),'mailmessage:create'),controller['create']);router['put']('/:id',auth[_0x45ec('0x9')](),controller[_0x45ec('0x14')]);router[_0x45ec('0x15')](_0x45ec('0x16'),auth[_0x45ec('0x9')](),controller[_0x45ec('0x17')]);router[_0x45ec('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0x45ec('0x18')]);router[_0x45ec('0x19')](_0x45ec('0xd'),auth['isAuthenticated'](),controller[_0x45ec('0x1a')]);module[_0x45ec('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 06c8eed..0e1a518 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 _0x4ccd=['TEXT','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','lodash','exports'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x4ccd,0x174));var _0xd4cc=function(_0x3f4315,_0xd6ec89){_0x3f4315=_0x3f4315-0x0;var _0x5842e3=_0x4ccd[_0x3f4315];return _0x5842e3;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd4cc('0x0'));module[_0xd4cc('0x1')]={'body':{'type':Sequelize[_0xd4cc('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd4cc('0x2')]('medium')},'read':{'type':Sequelize[_0xd4cc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd4cc('0x4')]('in','out'),'defaultValue':_0xd4cc('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd4cc('0x6')](0x1fe)},'from':{'type':Sequelize[_0xd4cc('0x6')]},'to':{'type':Sequelize[_0xd4cc('0x2')](_0xd4cc('0x7'))},'cc':{'type':Sequelize['TEXT'](_0xd4cc('0x7'))},'bcc':{'type':Sequelize['TEXT'](_0xd4cc('0x7'))},'subject':{'type':Sequelize[_0xd4cc('0x2')]},'sentAt':{'type':Sequelize[_0xd4cc('0x8')]},'attach':{'type':Sequelize[_0xd4cc('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xd4cc('0x8')]},'originTo':{'type':Sequelize[_0xd4cc('0x2')]('long')},'originCc':{'type':Sequelize[_0xd4cc('0x2')](_0xd4cc('0x7'))},'originChannel':{'type':Sequelize['ENUM'](_0xd4cc('0xa'),'Chat'),'defaultValue':_0xd4cc('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x4832=['ENUM','out','STRING','DATE','BOOLEAN','Email','Chat','sequelize','lodash','exports','TEXT','long','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4832,0x6f));var _0x2483=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x4832[_0x506d83];return _0x335e8b;};'use strict';var Sequelize=require(_0x2483('0x0'));var _=require(_0x2483('0x1'));module[_0x2483('0x2')]={'body':{'type':Sequelize[_0x2483('0x3')](_0x2483('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2483('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2483('0x6')]('in','out'),'defaultValue':_0x2483('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2483('0x8')](0x1fe)},'from':{'type':Sequelize[_0x2483('0x8')]},'to':{'type':Sequelize[_0x2483('0x3')](_0x2483('0x4'))},'cc':{'type':Sequelize[_0x2483('0x3')](_0x2483('0x4'))},'bcc':{'type':Sequelize[_0x2483('0x3')]('long')},'subject':{'type':Sequelize[_0x2483('0x3')]},'sentAt':{'type':Sequelize[_0x2483('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2483('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x2483('0x3')](_0x2483('0x4'))},'originCc':{'type':Sequelize[_0x2483('0x3')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x2483('0xb'),_0x2483('0xc')),'defaultValue':_0x2483('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index a65257d..24bd310 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 _0x33af=['moment','util','path','ejs','fs-extra','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/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','MailMessage','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','sort','filters','pick','filter','where','merge','map','options','count','includeAll','findAll','rows','catch','show','params','include','find','body','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','pass','user','attachments','join','root','server/files/attachments','defaults','ListId','List\x20not\x20found','sendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','accept','read','readAt','UserId','agent','CmContact','get','MailInteraction','read1stAt','role','null','acceptMessage','manual','channel','event','EventManager','acceptmessage','MailInteractionId','interaction','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','download','unix','toString','server','tmp','files','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','build','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x432af8,_0x477b3d){var _0x228f4f=function(_0x2110c0){while(--_0x2110c0){_0x432af8['push'](_0x432af8['shift']());}};_0x228f4f(++_0x477b3d);}(_0x33af,0xa6));var _0xf33a=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0x33af[_0x1b5a05];return _0x347931;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf33a('0x0'));var rimraf=require(_0xf33a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x2'));var rp=require(_0xf33a('0x3'));var moment=require(_0xf33a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf33a('0x5'));var path=require(_0xf33a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf33a('0x7'));var fs=require('fs');var fs_extra=require(_0xf33a('0x8'));var _=require(_0xf33a('0x9'));var squel=require(_0xf33a('0xa'));var crypto=require(_0xf33a('0xb'));var jsforce=require(_0xf33a('0xc'));var deskjs=require(_0xf33a('0xd'));var toCsv=require(_0xf33a('0xe'));var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require(_0xf33a('0x15'));var logger=require('../../config/logger')(_0xf33a('0x16'));var utils=require('../../config/utils');var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];config[_0xf33a('0x1a')]=_['defaults'](config[_0xf33a('0x1a')],{'host':_0xf33a('0x1b'),'port':0x18eb});var socket=require(_0xf33a('0x1c'))(new Redis(config[_0xf33a('0x1a')]));require(_0xf33a('0x1d'))['register'](socket);var jayson=require(_0xf33a('0x1e'));var client=jayson[_0xf33a('0x1f')][_0xf33a('0x20')]({'port':0x232c});var client9003=jayson[_0xf33a('0x1f')][_0xf33a('0x20')]({'port':0x232b});var client9002=jayson[_0xf33a('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2553a1,_0x31c2c3,_0x42bf18,_0x5f5626){return new BPromise(function(_0x1ce179,_0x8cb941){var _0x4a9935=_0x5f5626||client;return _0x4a9935['request'](_0x2553a1,_0x42bf18)[_0xf33a('0x21')](function(_0x53b631){logger[_0xf33a('0x22')]('MailMessage,\x20%s,\x20%s',_0x31c2c3,_0xf33a('0x23'));logger[_0xf33a('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x31c2c3,'request\x20sent',JSON[_0xf33a('0x25')](_0x53b631));if(_0x53b631[_0xf33a('0x26')]){if(_0x53b631[_0xf33a('0x26')][_0xf33a('0x27')]===0x1f4){logger[_0xf33a('0x26')](_0xf33a('0x28'),_0x31c2c3,_0x53b631['error'][_0xf33a('0x29')]);return _0x8cb941(_0x53b631[_0xf33a('0x26')]['message']);}logger[_0xf33a('0x26')]('MailMessage,\x20%s,\x20%s',_0x31c2c3,_0x53b631[_0xf33a('0x26')][_0xf33a('0x29')]);return _0x1ce179(_0x53b631[_0xf33a('0x26')][_0xf33a('0x29')]);}else{logger[_0xf33a('0x22')](_0xf33a('0x28'),_0x31c2c3,_0xf33a('0x23'));_0x1ce179(_0x53b631[_0xf33a('0x2a')][_0xf33a('0x29')]);}})['catch'](function(_0x4b08da){logger[_0xf33a('0x26')](_0xf33a('0x28'),_0x31c2c3,_0x4b08da);_0x8cb941(_0x4b08da);});});}function respondWithStatusCode(_0x58b284,_0x8d3d4b){_0x8d3d4b=_0x8d3d4b||0xcc;return function(_0x304a54){if(_0x304a54){return _0x58b284[_0xf33a('0x2b')](_0x8d3d4b);}return _0x58b284[_0xf33a('0x2c')](_0x8d3d4b)[_0xf33a('0x2d')]();};}function respondWithResult(_0x5d4aca,_0x413aaa){_0x413aaa=_0x413aaa||0xc8;return function(_0x121f72){if(_0x121f72){return _0x5d4aca[_0xf33a('0x2c')](_0x413aaa)['json'](_0x121f72);}};}function respondWithFilteredResult(_0x3514b9,_0x2686f7){return function(_0x1b56fe){if(_0x1b56fe){var _0x5208d9=_0x1b56fe['count'],_0x28eb6c=_0x2686f7[_0xf33a('0x2e')],_0x9b530d=_0x2686f7[_0xf33a('0x2e')]+_0x2686f7['limit'],_0x254d5c;if(_0x9b530d>=_0x5208d9){_0x9b530d=_0x5208d9;_0x254d5c=0xc8;}else{_0x254d5c=0xce;}_0x3514b9[_0xf33a('0x2c')](_0x254d5c);return _0x3514b9[_0xf33a('0x2f')](_0xf33a('0x30'),_0x28eb6c+'-'+_0x9b530d+'/'+_0x5208d9)[_0xf33a('0x31')](_0x1b56fe);}return null;};}function patchUpdates(_0x2fb24c){return function(_0x430354){try{jsonpatch[_0xf33a('0x32')](_0x430354,_0x2fb24c,!![]);}catch(_0x5d0309){return BPromise[_0xf33a('0x33')](_0x5d0309);}return _0x430354[_0xf33a('0x34')]();};}function saveUpdates(_0x9ca6dd,_0x3d66c4){return function(_0x308d15){if(_0x308d15){return _0x308d15['update'](_0x9ca6dd)['then'](function(_0x427e8b){return _0x427e8b;});}return null;};}function removeEntity(_0x46e790,_0x179cc5){return function(_0x452469){if(_0x452469){return _0x452469[_0xf33a('0x35')]()[_0xf33a('0x21')](function(){_0x46e790['status'](0xcc)[_0xf33a('0x2d')]();});}};}function handleEntityNotFound(_0x2b8103,_0x3826dd){return function(_0x129eec){if(!_0x129eec){_0x2b8103[_0xf33a('0x2b')](0x194);}return _0x129eec;};}function handleError(_0x16bbc3,_0x5e3582){_0x5e3582=_0x5e3582||0x1f4;return function(_0x5b3a93){logger[_0xf33a('0x26')](_0x5b3a93[_0xf33a('0x36')]);if(_0x5b3a93[_0xf33a('0x37')]){delete _0x5b3a93[_0xf33a('0x37')];}_0x16bbc3[_0xf33a('0x2c')](_0x5e3582)[_0xf33a('0x38')](_0x5b3a93);};}exports['index']=function(_0x118203,_0x2ff98d){var _0x319619={},_0xd0566e={},_0x5fe3cb={'count':0x0,'rows':[]};var _0x108279=_['map'](db[_0xf33a('0x39')][_0xf33a('0x3a')],function(_0x5d03ef){return{'name':_0x5d03ef[_0xf33a('0x3b')],'type':_0x5d03ef['type'][_0xf33a('0x3c')]};});_0xd0566e[_0xf33a('0x3d')]=_['map'](_0x108279,_0xf33a('0x37'));_0xd0566e[_0xf33a('0x3e')]=_[_0xf33a('0x3f')](_0x118203[_0xf33a('0x3e')]);_0xd0566e['filters']=_[_0xf33a('0x40')](_0xd0566e[_0xf33a('0x3d')],_0xd0566e['query']);_0x319619['attributes']=_[_0xf33a('0x40')](_0xd0566e[_0xf33a('0x3d')],qs[_0xf33a('0x41')](_0x118203[_0xf33a('0x3e')][_0xf33a('0x41')]));_0x319619[_0xf33a('0x42')]=_0x319619[_0xf33a('0x42')][_0xf33a('0x43')]?_0x319619[_0xf33a('0x42')]:_0xd0566e[_0xf33a('0x3d')];if(!_0x118203[_0xf33a('0x3e')][_0xf33a('0x44')]('nolimit')){_0x319619[_0xf33a('0x45')]=qs[_0xf33a('0x45')](_0x118203['query'][_0xf33a('0x45')]);_0x319619[_0xf33a('0x2e')]=qs['offset'](_0x118203[_0xf33a('0x3e')][_0xf33a('0x2e')]);}_0x319619['order']=qs['sort'](_0x118203[_0xf33a('0x3e')][_0xf33a('0x46')]);_0x319619['where']=qs[_0xf33a('0x47')](_[_0xf33a('0x48')](_0x118203[_0xf33a('0x3e')],_0xd0566e[_0xf33a('0x47')]),_0x108279);if(_0x118203['query'][_0xf33a('0x49')]){_0x319619[_0xf33a('0x4a')]=_[_0xf33a('0x4b')](_0x319619[_0xf33a('0x4a')],{'$or':_[_0xf33a('0x4c')](_0x108279,function(_0x43e339){if(_0x43e339['type']!=='VIRTUAL'){var _0x23f3d9={};_0x23f3d9[_0x43e339[_0xf33a('0x37')]]={'$like':'%'+_0x118203[_0xf33a('0x3e')][_0xf33a('0x49')]+'%'};return _0x23f3d9;}})});}_0x319619=_['merge']({},_0x319619,_0x118203[_0xf33a('0x4d')]);var _0x2ece81={'where':_0x319619['where']};return db[_0xf33a('0x39')][_0xf33a('0x4e')](_0x2ece81)[_0xf33a('0x21')](function(_0x1117bb){_0x5fe3cb[_0xf33a('0x4e')]=_0x1117bb;if(_0x118203[_0xf33a('0x3e')][_0xf33a('0x4f')]){_0x319619['include']=[{'all':!![]}];}return db[_0xf33a('0x39')][_0xf33a('0x50')](_0x319619);})[_0xf33a('0x21')](function(_0x4d11d5){_0x5fe3cb[_0xf33a('0x51')]=_0x4d11d5;return _0x5fe3cb;})[_0xf33a('0x21')](respondWithFilteredResult(_0x2ff98d,_0x319619))[_0xf33a('0x52')](handleError(_0x2ff98d,null));};exports[_0xf33a('0x53')]=function(_0x1c06ef,_0x473099){var _0x24ce87={'raw':!![],'where':{'id':_0x1c06ef[_0xf33a('0x54')]['id']}},_0x1900eb={};_0x1900eb['model']=_[_0xf33a('0x3f')](db[_0xf33a('0x39')][_0xf33a('0x3a')]);_0x1900eb[_0xf33a('0x3e')]=_[_0xf33a('0x3f')](_0x1c06ef['query']);_0x1900eb[_0xf33a('0x47')]=_[_0xf33a('0x40')](_0x1900eb[_0xf33a('0x3d')],_0x1900eb[_0xf33a('0x3e')]);_0x24ce87[_0xf33a('0x42')]=_[_0xf33a('0x40')](_0x1900eb['model'],qs[_0xf33a('0x41')](_0x1c06ef[_0xf33a('0x3e')]['fields']));_0x24ce87[_0xf33a('0x42')]=_0x24ce87[_0xf33a('0x42')][_0xf33a('0x43')]?_0x24ce87[_0xf33a('0x42')]:_0x1900eb[_0xf33a('0x3d')];if(_0x1c06ef[_0xf33a('0x3e')]['includeAll']){_0x24ce87[_0xf33a('0x55')]=[{'all':!![]}];}_0x24ce87=_['merge']({},_0x24ce87,_0x1c06ef[_0xf33a('0x4d')]);return db[_0xf33a('0x39')][_0xf33a('0x56')](_0x24ce87)[_0xf33a('0x21')](handleEntityNotFound(_0x473099,null))['then'](respondWithResult(_0x473099,null))[_0xf33a('0x52')](handleError(_0x473099,null));};exports['update']=function(_0x293bfa,_0x3e66f4){if(_0x293bfa[_0xf33a('0x57')]['id']){delete _0x293bfa[_0xf33a('0x57')]['id'];}return db[_0xf33a('0x39')][_0xf33a('0x56')]({'where':{'id':_0x293bfa[_0xf33a('0x54')]['id']}})[_0xf33a('0x21')](handleEntityNotFound(_0x3e66f4,null))[_0xf33a('0x21')](saveUpdates(_0x293bfa[_0xf33a('0x57')],null))[_0xf33a('0x21')](respondWithResult(_0x3e66f4,null))[_0xf33a('0x52')](handleError(_0x3e66f4,null));};exports[_0xf33a('0x35')]=function(_0x30bb2d,_0x46538c){return db[_0xf33a('0x39')][_0xf33a('0x56')]({'where':{'id':_0x30bb2d['params']['id']}})[_0xf33a('0x21')](handleEntityNotFound(_0x46538c,null))['then'](removeEntity(_0x46538c,null))[_0xf33a('0x52')](handleError(_0x46538c,null));};exports[_0xf33a('0x58')]=function(_0x572a62,_0xe1146b){return db[_0xf33a('0x39')][_0xf33a('0x58')]()[_0xf33a('0x21')](respondWithResult(_0xe1146b,null))['catch'](handleError(_0xe1146b,null));};exports[_0xf33a('0x59')]=function(_0x5b5bc0,_0x5e9577){return db['MailMessage'][_0xf33a('0x59')](_0x5b5bc0['body'])[_0xf33a('0x21')](function(_0x2d6080){if(_0x2d6080){if(_0x2d6080['direction']===_0xf33a('0x5a')&&!_0x2d6080[_0xf33a('0x5b')]){var _0xc3d11b,_0x26562b,_0x173db8;if(_0x5b5bc0[_0xf33a('0x57')]['to']){_0x26562b=_0x5b5bc0['body']['to'][_0xf33a('0x5c')](',')[0x0];}return db[_0xf33a('0x5d')][_0xf33a('0x5e')]({'where':{'id':_0x2d6080[_0xf33a('0x5f')]},'include':[{'model':db[_0xf33a('0x60')],'as':_0xf33a('0x61'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x26562b},'limit':0x1,'order':[[_0xf33a('0x62'),_0xf33a('0x63')]]}]},{'model':db[_0xf33a('0x64')],'as':_0xf33a('0x65'),'raw':!![]}]})['then'](function(_0x1af94d){_0xc3d11b=_0x1af94d;if(_0xc3d11b&&_0xc3d11b[_0xf33a('0x65')]){var _0xa6410a={'tls':{'rejectUnauthorized':![]}};if(_[_0xf33a('0x66')](_0xc3d11b[_0xf33a('0x65')][_0xf33a('0x67')])){_0xa6410a[_0xf33a('0x68')]=_0xc3d11b[_0xf33a('0x65')]['host'];_0xa6410a[_0xf33a('0x69')]=_0xc3d11b[_0xf33a('0x65')][_0xf33a('0x69')];_0xa6410a['secure']=_0xc3d11b[_0xf33a('0x65')][_0xf33a('0x6a')];if(_0xc3d11b[_0xf33a('0x65')][_0xf33a('0x6b')]){_0xa6410a[_0xf33a('0x6c')]={'user':_0xc3d11b[_0xf33a('0x65')]['user'],'pass':_0xc3d11b[_0xf33a('0x65')][_0xf33a('0x6d')]};}}else{_0xa6410a[_0xf33a('0x67')]=_0xc3d11b[_0xf33a('0x65')]['service'];_0xa6410a[_0xf33a('0x6c')]={'user':_0xc3d11b['Smtp'][_0xf33a('0x6e')],'pass':_0xc3d11b['Smtp'][_0xf33a('0x6d')]};_0xa6410a['secure']=_0xc3d11b['Smtp'][_0xf33a('0x6a')];}if(_0x5b5bc0[_0xf33a('0x57')]['attachments']&&_0x5b5bc0['body'][_0xf33a('0x6f')][_0xf33a('0x43')]){for(var _0x3db791=0x0;_0x3db791<_0x5b5bc0[_0xf33a('0x57')]['attachments'][_0xf33a('0x43')];_0x3db791+=0x1){_0x5b5bc0[_0xf33a('0x57')][_0xf33a('0x6f')][_0x3db791]={'filename':_0x5b5bc0['body'][_0xf33a('0x6f')][_0x3db791][_0xf33a('0x37')],'path':path[_0xf33a('0x70')](config[_0xf33a('0x71')],_0xf33a('0x72'),_0x5b5bc0[_0xf33a('0x57')][_0xf33a('0x6f')][_0x3db791]['basename'])};}}_0x173db8={'account':_0xa6410a,'message':_0x5b5bc0[_0xf33a('0x57')]};return;}})[_0xf33a('0x21')](function(){if(_0xc3d11b[_0xf33a('0x61')]){if(_0xc3d11b['List']['Contacts'][_0xf33a('0x43')]){return _0xc3d11b[_0xf33a('0x61')]['Contacts'][0x0];}else{return db['CmContact'][_0xf33a('0x59')](_[_0xf33a('0x73')](_0x5b5bc0['body'],{'firstName':_0x5b5bc0[_0xf33a('0x57')]['to'],'email':_0x5b5bc0['body']['to'],'phone':_0x5b5bc0[_0xf33a('0x57')]['to'],'ListId':_0xc3d11b[_0xf33a('0x74')]}));}}else{throw new Error(_0xf33a('0x75'));}})[_0xf33a('0x21')](function(){if(_0x173db8){return respondWithRpcPromise('SendMail',_0xf33a('0x76'),_0x173db8,client9003)[_0xf33a('0x21')](function(_0x578d22){return _0x2d6080[_0xf33a('0x77')]({'read':!![],'messageId':_0x578d22[_0xf33a('0x78')],'sentAt':moment()[_0xf33a('0x79')](_0xf33a('0x7a'))});})[_0xf33a('0x52')](function(_0x7f8685){logger['error']('%s',JSON[_0xf33a('0x25')](_0x7f8685));return _0x2d6080;});}return _0x2d6080;});}return _0x2d6080;}})[_0xf33a('0x21')](respondWithResult(_0x5e9577,0xc9))[_0xf33a('0x52')](handleError(_0x5e9577,null));};var interaction_log=require(_0xf33a('0x7b'))(_0xf33a('0x7c'));exports[_0xf33a('0x7d')]=function(_0x3e0de5,_0xda83d1,_0x48bcc6){var _0x26b165={'agent':{},'channel':'mail'};if(_0x3e0de5[_0xf33a('0x57')]['id']){delete _0x3e0de5['body']['id'];}_0x3e0de5['body'][_0xf33a('0x7e')]=!![];_0x3e0de5[_0xf33a('0x57')][_0xf33a('0x7f')]=moment()[_0xf33a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e0de5[_0xf33a('0x57')][_0xf33a('0x80')]=_0x3e0de5['body'][_0xf33a('0x80')]||_0x3e0de5[_0xf33a('0x6e')]['id'];_0x26b165[_0xf33a('0x81')]['id']=_0x3e0de5[_0xf33a('0x57')][_0xf33a('0x80')];return db[_0xf33a('0x39')][_0xf33a('0x56')]({'where':{'id':_0x3e0de5[_0xf33a('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xf33a('0x82')],'as':'Contact'}]})[_0xf33a('0x21')](handleEntityNotFound(_0xda83d1,null))[_0xf33a('0x21')](saveUpdates(_0x3e0de5[_0xf33a('0x57')],null))[_0xf33a('0x21')](function(_0x219c46){if(_0x219c46){_0x26b165[_0xf33a('0x29')]=_0x219c46[_0xf33a('0x83')]({'plain':!![]});return db[_0xf33a('0x84')][_0xf33a('0x56')]({'where':{'id':_0x219c46['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xda83d1,null))[_0xf33a('0x21')](function(_0x33a232){if(_0x33a232){return _0x33a232['update']({'UserId':_0x3e0de5[_0xf33a('0x57')]['UserId'],'read1stAt':_[_0xf33a('0x66')](_0x33a232[_0xf33a('0x85')])?moment()[_0xf33a('0x79')](_0xf33a('0x7a')):undefined});}return null;})[_0xf33a('0x21')](function(_0x19534e){if(_0x19534e){_0x26b165['interaction']=_0x19534e[_0xf33a('0x83')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e0de5[_0xf33a('0x6e')]['id'],_0x3e0de5['user'][_0xf33a('0x37')],_0x3e0de5[_0xf33a('0x6e')][_0xf33a('0x86')],_0x26b165['interaction']['id'],_0x3e0de5[_0xf33a('0x57')]?JSON['stringify'](_0x3e0de5[_0xf33a('0x57')]):_0xf33a('0x87'));return respondWithRpcPromise('AcceptMessage',_0xf33a('0x88'),_0x26b165);}return null;})[_0xf33a('0x21')](function(_0x50d7ca){if(_0x50d7ca){if(_0x3e0de5['body'][_0xf33a('0x89')]){_0x26b165[_0xf33a('0x29')]['interface']=util[_0xf33a('0x79')]('SIP/%s',_0x3e0de5[_0xf33a('0x6e')][_0xf33a('0x37')]);_0x26b165[_0xf33a('0x29')][_0xf33a('0x8a')]=_0x26b165[_0xf33a('0x8a')];_0x26b165['message'][_0xf33a('0x8b')]='accept';return respondWithRpcPromise(_0xf33a('0x8c'),'EventManager',{'event':_0xf33a('0x8d'),'message':_0x26b165['message']},client9002)[_0xf33a('0x21')](function(){return _0x26b165;});}return _0x26b165;}return null;})[_0xf33a('0x21')](respondWithResult(_0xda83d1,null))['catch'](handleError(_0xda83d1,null));};var interaction_log=require(_0xf33a('0x7b'))(_0xf33a('0x7c'));exports[_0xf33a('0x33')]=function(_0x27298f,_0x4e5aed,_0x3c2c32){var _0x578e0f={'agent':{},'channel':'mail'};if(_0x27298f[_0xf33a('0x57')]['id']){delete _0x27298f[_0xf33a('0x57')]['id'];}_0x27298f[_0xf33a('0x57')][_0xf33a('0x80')]=_0x27298f[_0xf33a('0x57')][_0xf33a('0x80')]||_0x27298f[_0xf33a('0x6e')]['id'];_0x578e0f[_0xf33a('0x81')]['id']=_0x27298f[_0xf33a('0x57')][_0xf33a('0x80')];return db[_0xf33a('0x39')]['find']({'where':{'id':_0x27298f[_0xf33a('0x54')]['id'],'UserId':null}})[_0xf33a('0x21')](handleEntityNotFound(_0x4e5aed,null))[_0xf33a('0x21')](function(_0x15dcdc){if(_0x15dcdc){_0x578e0f[_0xf33a('0x29')]=_0x15dcdc[_0xf33a('0x83')]({'plain':!![]});return db[_0xf33a('0x84')][_0xf33a('0x56')]({'where':{'id':_0x15dcdc[_0xf33a('0x8e')]}});}return null;})[_0xf33a('0x21')](handleEntityNotFound(_0x4e5aed,null))[_0xf33a('0x21')](function(_0x269750){if(_0x269750){_0x578e0f[_0xf33a('0x8f')]=_0x269750[_0xf33a('0x83')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x27298f['user']['id'],_0x27298f[_0xf33a('0x6e')][_0xf33a('0x37')],_0x27298f[_0xf33a('0x6e')][_0xf33a('0x86')],_0x578e0f['interaction']['id'],_0x27298f[_0xf33a('0x57')]?JSON[_0xf33a('0x25')](_0x27298f[_0xf33a('0x57')]):_0xf33a('0x87'));return respondWithRpcPromise(_0xf33a('0x90'),_0xf33a('0x91'),_0x578e0f);}return null;})[_0xf33a('0x21')](function(_0x2f71d1){if(_0x2f71d1){_0x2f71d1[_0xf33a('0x29')][_0xf33a('0x92')]=util[_0xf33a('0x79')](_0xf33a('0x93'),_0x27298f['user']['name']);_0x2f71d1[_0xf33a('0x29')]['channel']=_0x578e0f['channel'];_0x2f71d1[_0xf33a('0x29')][_0xf33a('0x8b')]=_0xf33a('0x33');respondWithRpcPromise(_0xf33a('0x8c'),_0xf33a('0x8c'),{'event':_0xf33a('0x94'),'message':_0x2f71d1[_0xf33a('0x29')]},client9002);return _0x578e0f;}return null;})[_0xf33a('0x21')](respondWithResult(_0x4e5aed,null))['catch'](handleError(_0x4e5aed,null));};exports[_0xf33a('0x95')]=function(_0x4a9827,_0x48c537){var _0x2f13c6=moment()[_0xf33a('0x96')]()[_0xf33a('0x97')]();var _0x38a499=path['join'](config[_0xf33a('0x71')],_0xf33a('0x98'),'files',_0xf33a('0x99'));var _0x3193af=path[_0xf33a('0x70')](config[_0xf33a('0x71')],_0xf33a('0x98'),_0xf33a('0x9a'),_0xf33a('0x6f'));var _0x4264c3=util[_0xf33a('0x79')](_0xf33a('0x9b'),_0x2f13c6);return db[_0xf33a('0x39')][_0xf33a('0x56')]({'where':{'id':_0x4a9827[_0xf33a('0x54')]['id']},'attributes':['id',_0xf33a('0x57'),_0xf33a('0x9c'),'to','cc',_0xf33a('0x9d'),'subject',_0xf33a('0x9e')],'include':_0x4a9827[_0xf33a('0x3e')]['attachments']?[{'model':db[_0xf33a('0x9f')],'as':_0xf33a('0xa0')}]:undefined})[_0xf33a('0x21')](handleEntityNotFound(_0x48c537,null))[_0xf33a('0x21')](function(_0x63969a){if(_0x63969a){var _0x2236e2=_0x63969a;var _0x22d918={'from':_0x2236e2['from'],'to':_0x2236e2['to'],'subject':_0x2236e2[_0xf33a('0xa1')],'html':_0x2236e2[_0xf33a('0x57')],'headers':{'Date':moment(_0x2236e2['createdAt'])['format'](_0xf33a('0xa2'))},'attachments':[]};if(_0x63969a['cc']){_0x22d918[_0xf33a('0xa3')]['Cc']=_0x63969a['cc'];}if(_0x63969a['bcc']){_0x22d918['headers'][_0xf33a('0xa4')]=_0x63969a[_0xf33a('0x9d')];}return new BPromise(function(_0x4933b5,_0x299147){if(_0x63969a[_0xf33a('0xa0')]){for(var _0x3a39dd=0x0;_0x3a39dd<_0x63969a[_0xf33a('0xa0')][_0xf33a('0x43')];_0x3a39dd++){var _0x27a5ed=_0x63969a[_0xf33a('0xa0')][_0x3a39dd];var _0x5d0b8f=path['join'](_0x3193af,_0x27a5ed['basename']);if(fs['existsSync'](_0x5d0b8f)){_0x22d918[_0xf33a('0x6f')][_0xf33a('0xa5')]({'name':_0x27a5ed[_0xf33a('0x37')],'contentType':_0x27a5ed['type'],'data':fs['readFileSync'](_0x5d0b8f)});}}}emlformat[_0xf33a('0xa6')](_0x22d918,function(_0x41103f,_0x5a4154){if(_0x41103f)return _0x299147(_0x41103f);fs['writeFileSync'](path[_0xf33a('0x70')](_0x38a499,_0x4264c3),_0x5a4154);return _0x4933b5(_0x5a4154);});});}})['then'](function(_0x4cf7a5){if(_0x4cf7a5){return _0x48c537[_0xf33a('0x95')](path[_0xf33a('0x70')](_0x38a499,_0x4264c3),_0x4264c3,function(_0x349943){if(_0x349943){console[_0xf33a('0xa7')](_0xf33a('0xa8'),_0x349943);}else{fs[_0xf33a('0xa9')](path[_0xf33a('0x70')](_0x38a499,_0x4264c3));}});}})[_0xf33a('0x52')](handleError(_0x48c537,null));}; \ No newline at end of file +var _0x7f19=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','jayson/promise','client','http','request','request\x20sent','stringify','error','message','MailMessage,\x20%s,\x20%s','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','stack','name','send','map','MailMessage','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','includeAll','find','update','body','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','port','secure','authentication','auth','pass','user','attachments','join','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','agent','Contact','get','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','manual','interface','channel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','rejectmessage','unix','toString','server','files','message-%s.eml','from','bcc','subject','Attachment','Attachments','createdAt','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','log','err','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis'];(function(_0x21f02f,_0x3fa84d){var _0x56cccc=function(_0x4aab2e){while(--_0x4aab2e){_0x21f02f['push'](_0x21f02f['shift']());}};_0x56cccc(++_0x3fa84d);}(_0x7f19,0x96));var _0x97f1=function(_0x3020a5,_0x33a4bc){_0x3020a5=_0x3020a5-0x0;var _0x2ff197=_0x7f19[_0x3020a5];return _0x2ff197;};'use strict';var pdf=require(_0x97f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x97f1('0x1'));var zipdir=require(_0x97f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97f1('0x3'));var moment=require(_0x97f1('0x4'));var BPromise=require(_0x97f1('0x5'));var Mustache=require(_0x97f1('0x6'));var util=require(_0x97f1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x97f1('0x8'));var ejs=require(_0x97f1('0x9'));var fs=require('fs');var fs_extra=require(_0x97f1('0xa'));var _=require(_0x97f1('0xb'));var squel=require(_0x97f1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x97f1('0x8'));var querystring=require(_0x97f1('0xd'));var Papa=require(_0x97f1('0xe'));var Redis=require(_0x97f1('0xf'));var authService=require(_0x97f1('0x10'));var qs=require(_0x97f1('0x11'));var as=require(_0x97f1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97f1('0x13'))(_0x97f1('0x14'));var utils=require(_0x97f1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x97f1('0x16'));var db=require(_0x97f1('0x17'))['db'];config['redis']=_[_0x97f1('0x18')](config['redis'],{'host':_0x97f1('0x19'),'port':0x18eb});var socket=require(_0x97f1('0x1a'))(new Redis(config[_0x97f1('0x1b')]));require(_0x97f1('0x1c'))[_0x97f1('0x1d')](socket);var jayson=require(_0x97f1('0x1e'));var client=jayson[_0x97f1('0x1f')]['http']({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson['client'][_0x97f1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x30269e,_0x52cfc6,_0x67d032,_0x535934){return new BPromise(function(_0x181a6f,_0x10190a){var _0x57a660=_0x535934||client;return _0x57a660[_0x97f1('0x21')](_0x30269e,_0x67d032)['then'](function(_0x4d7c25){logger['info']('MailMessage,\x20%s,\x20%s',_0x52cfc6,_0x97f1('0x22'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x52cfc6,'request\x20sent',JSON[_0x97f1('0x23')](_0x4d7c25));if(_0x4d7c25[_0x97f1('0x24')]){if(_0x4d7c25[_0x97f1('0x24')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x52cfc6,_0x4d7c25[_0x97f1('0x24')][_0x97f1('0x25')]);return _0x10190a(_0x4d7c25[_0x97f1('0x24')][_0x97f1('0x25')]);}logger['error'](_0x97f1('0x26'),_0x52cfc6,_0x4d7c25['error'][_0x97f1('0x25')]);return _0x181a6f(_0x4d7c25['error'][_0x97f1('0x25')]);}else{logger[_0x97f1('0x27')](_0x97f1('0x26'),_0x52cfc6,'request\x20sent');_0x181a6f(_0x4d7c25[_0x97f1('0x28')][_0x97f1('0x25')]);}})['catch'](function(_0x5da36e){logger[_0x97f1('0x24')]('MailMessage,\x20%s,\x20%s',_0x52cfc6,_0x5da36e);_0x10190a(_0x5da36e);});});}function respondWithStatusCode(_0x335aef,_0x412d15){_0x412d15=_0x412d15||0xcc;return function(_0x178671){if(_0x178671){return _0x335aef[_0x97f1('0x29')](_0x412d15);}return _0x335aef[_0x97f1('0x2a')](_0x412d15)[_0x97f1('0x2b')]();};}function respondWithResult(_0x5f3d64,_0x147084){_0x147084=_0x147084||0xc8;return function(_0x473c52){if(_0x473c52){return _0x5f3d64[_0x97f1('0x2a')](_0x147084)[_0x97f1('0x2c')](_0x473c52);}};}function respondWithFilteredResult(_0x39b9eb,_0x273527){return function(_0x4b5c77){if(_0x4b5c77){var _0xe6e3e3=_0x4b5c77[_0x97f1('0x2d')],_0x1cae64=_0x273527[_0x97f1('0x2e')],_0xe1c02c=_0x273527[_0x97f1('0x2e')]+_0x273527['limit'],_0x5eb1c4;if(_0xe1c02c>=_0xe6e3e3){_0xe1c02c=_0xe6e3e3;_0x5eb1c4=0xc8;}else{_0x5eb1c4=0xce;}_0x39b9eb[_0x97f1('0x2a')](_0x5eb1c4);return _0x39b9eb[_0x97f1('0x2f')](_0x97f1('0x30'),_0x1cae64+'-'+_0xe1c02c+'/'+_0xe6e3e3)[_0x97f1('0x2c')](_0x4b5c77);}return null;};}function patchUpdates(_0x8d209c){return function(_0x1bf43b){try{jsonpatch[_0x97f1('0x31')](_0x1bf43b,_0x8d209c,!![]);}catch(_0x56d779){return BPromise[_0x97f1('0x32')](_0x56d779);}return _0x1bf43b['save']();};}function saveUpdates(_0x3e61ea,_0x5558d0){return function(_0x4db260){if(_0x4db260){return _0x4db260['update'](_0x3e61ea)['then'](function(_0x1b22cd){return _0x1b22cd;});}return null;};}function removeEntity(_0x4c6394,_0x21e84f){return function(_0x1e88b3){if(_0x1e88b3){return _0x1e88b3[_0x97f1('0x33')]()['then'](function(){_0x4c6394[_0x97f1('0x2a')](0xcc)[_0x97f1('0x2b')]();});}};}function handleEntityNotFound(_0x383d84,_0x402c14){return function(_0x5d20da){if(!_0x5d20da){_0x383d84[_0x97f1('0x29')](0x194);}return _0x5d20da;};}function handleError(_0xebb59d,_0x148824){_0x148824=_0x148824||0x1f4;return function(_0x171f39){logger[_0x97f1('0x24')](_0x171f39[_0x97f1('0x34')]);if(_0x171f39[_0x97f1('0x35')]){delete _0x171f39[_0x97f1('0x35')];}_0xebb59d[_0x97f1('0x2a')](_0x148824)[_0x97f1('0x36')](_0x171f39);};}exports['index']=function(_0xe501b1,_0x4ba50f){var _0x38559c={},_0x89b4f4={},_0x2c5b84={'count':0x0,'rows':[]};var _0x51bdfa=_[_0x97f1('0x37')](db[_0x97f1('0x38')][_0x97f1('0x39')],function(_0x51faba){return{'name':_0x51faba['fieldName'],'type':_0x51faba[_0x97f1('0x3a')][_0x97f1('0x3b')]};});_0x89b4f4[_0x97f1('0x3c')]=_[_0x97f1('0x37')](_0x51bdfa,'name');_0x89b4f4[_0x97f1('0x3d')]=_['keys'](_0xe501b1[_0x97f1('0x3d')]);_0x89b4f4[_0x97f1('0x3e')]=_['intersection'](_0x89b4f4[_0x97f1('0x3c')],_0x89b4f4['query']);_0x38559c[_0x97f1('0x3f')]=_[_0x97f1('0x40')](_0x89b4f4[_0x97f1('0x3c')],qs['fields'](_0xe501b1['query'][_0x97f1('0x41')]));_0x38559c[_0x97f1('0x3f')]=_0x38559c[_0x97f1('0x3f')][_0x97f1('0x42')]?_0x38559c[_0x97f1('0x3f')]:_0x89b4f4[_0x97f1('0x3c')];if(!_0xe501b1[_0x97f1('0x3d')]['hasOwnProperty'](_0x97f1('0x43'))){_0x38559c[_0x97f1('0x44')]=qs[_0x97f1('0x44')](_0xe501b1[_0x97f1('0x3d')][_0x97f1('0x44')]);_0x38559c[_0x97f1('0x2e')]=qs[_0x97f1('0x2e')](_0xe501b1[_0x97f1('0x3d')]['offset']);}_0x38559c[_0x97f1('0x45')]=qs[_0x97f1('0x46')](_0xe501b1[_0x97f1('0x3d')][_0x97f1('0x46')]);_0x38559c[_0x97f1('0x47')]=qs[_0x97f1('0x3e')](_[_0x97f1('0x48')](_0xe501b1[_0x97f1('0x3d')],_0x89b4f4[_0x97f1('0x3e')]),_0x51bdfa);if(_0xe501b1[_0x97f1('0x3d')][_0x97f1('0x49')]){_0x38559c[_0x97f1('0x47')]=_[_0x97f1('0x4a')](_0x38559c[_0x97f1('0x47')],{'$or':_[_0x97f1('0x37')](_0x51bdfa,function(_0x4fdecd){if(_0x4fdecd['type']!==_0x97f1('0x4b')){var _0xee5fab={};_0xee5fab[_0x4fdecd[_0x97f1('0x35')]]={'$like':'%'+_0xe501b1[_0x97f1('0x3d')]['filter']+'%'};return _0xee5fab;}})});}_0x38559c=_['merge']({},_0x38559c,_0xe501b1[_0x97f1('0x4c')]);var _0x15b80b={'where':_0x38559c[_0x97f1('0x47')]};return db[_0x97f1('0x38')][_0x97f1('0x2d')](_0x15b80b)[_0x97f1('0x4d')](function(_0xe03c24){_0x2c5b84[_0x97f1('0x2d')]=_0xe03c24;if(_0xe501b1['query']['includeAll']){_0x38559c[_0x97f1('0x4e')]=[{'all':!![]}];}return db[_0x97f1('0x38')][_0x97f1('0x4f')](_0x38559c);})[_0x97f1('0x4d')](function(_0x3dc041){_0x2c5b84[_0x97f1('0x50')]=_0x3dc041;return _0x2c5b84;})[_0x97f1('0x4d')](respondWithFilteredResult(_0x4ba50f,_0x38559c))[_0x97f1('0x51')](handleError(_0x4ba50f,null));};exports['show']=function(_0x11d235,_0x224558){var _0x2f343c={'raw':!![],'where':{'id':_0x11d235[_0x97f1('0x52')]['id']}},_0x7a9419={};_0x7a9419['model']=_['keys'](db[_0x97f1('0x38')][_0x97f1('0x39')]);_0x7a9419[_0x97f1('0x3d')]=_['keys'](_0x11d235[_0x97f1('0x3d')]);_0x7a9419[_0x97f1('0x3e')]=_['intersection'](_0x7a9419[_0x97f1('0x3c')],_0x7a9419[_0x97f1('0x3d')]);_0x2f343c[_0x97f1('0x3f')]=_[_0x97f1('0x40')](_0x7a9419[_0x97f1('0x3c')],qs[_0x97f1('0x41')](_0x11d235[_0x97f1('0x3d')][_0x97f1('0x41')]));_0x2f343c[_0x97f1('0x3f')]=_0x2f343c[_0x97f1('0x3f')][_0x97f1('0x42')]?_0x2f343c[_0x97f1('0x3f')]:_0x7a9419[_0x97f1('0x3c')];if(_0x11d235[_0x97f1('0x3d')][_0x97f1('0x53')]){_0x2f343c[_0x97f1('0x4e')]=[{'all':!![]}];}_0x2f343c=_['merge']({},_0x2f343c,_0x11d235['options']);return db[_0x97f1('0x38')][_0x97f1('0x54')](_0x2f343c)[_0x97f1('0x4d')](handleEntityNotFound(_0x224558,null))['then'](respondWithResult(_0x224558,null))[_0x97f1('0x51')](handleError(_0x224558,null));};exports[_0x97f1('0x55')]=function(_0x5d3dd6,_0x29734c){if(_0x5d3dd6[_0x97f1('0x56')]['id']){delete _0x5d3dd6[_0x97f1('0x56')]['id'];}return db[_0x97f1('0x38')][_0x97f1('0x54')]({'where':{'id':_0x5d3dd6[_0x97f1('0x52')]['id']}})['then'](handleEntityNotFound(_0x29734c,null))[_0x97f1('0x4d')](saveUpdates(_0x5d3dd6[_0x97f1('0x56')],null))[_0x97f1('0x4d')](respondWithResult(_0x29734c,null))[_0x97f1('0x51')](handleError(_0x29734c,null));};exports['destroy']=function(_0x3953cd,_0x37e671){return db[_0x97f1('0x38')][_0x97f1('0x54')]({'where':{'id':_0x3953cd['params']['id']}})[_0x97f1('0x4d')](handleEntityNotFound(_0x37e671,null))[_0x97f1('0x4d')](removeEntity(_0x37e671,null))[_0x97f1('0x51')](handleError(_0x37e671,null));};exports[_0x97f1('0x57')]=function(_0x59d179,_0xc61a60){return db[_0x97f1('0x38')]['describe']()[_0x97f1('0x4d')](respondWithResult(_0xc61a60,null))['catch'](handleError(_0xc61a60,null));};exports[_0x97f1('0x58')]=function(_0xc6ee87,_0x17ff6f){return db['MailMessage'][_0x97f1('0x58')](_0xc6ee87[_0x97f1('0x56')])[_0x97f1('0x4d')](function(_0x215223){if(_0x215223){if(_0x215223[_0x97f1('0x59')]==='out'&&!_0x215223[_0x97f1('0x5a')]){var _0x426209,_0x414818,_0x35bdfd;if(_0xc6ee87[_0x97f1('0x56')]['to']){_0x414818=_0xc6ee87['body']['to'][_0x97f1('0x5b')](',')[0x0];}return db[_0x97f1('0x5c')][_0x97f1('0x5d')]({'where':{'id':_0x215223[_0x97f1('0x5e')]},'include':[{'model':db[_0x97f1('0x5f')],'as':_0x97f1('0x60'),'include':[{'model':db[_0x97f1('0x61')],'as':_0x97f1('0x62'),'where':{'email':_0x414818},'limit':0x1,'order':[[_0x97f1('0x63'),'DESC']]}]},{'model':db[_0x97f1('0x64')],'as':_0x97f1('0x65'),'raw':!![]}]})[_0x97f1('0x4d')](function(_0x495e1a){_0x426209=_0x495e1a;if(_0x426209&&_0x426209[_0x97f1('0x65')]){var _0x46f4ff={'tls':{'rejectUnauthorized':![]}};if(_[_0x97f1('0x66')](_0x426209[_0x97f1('0x65')][_0x97f1('0x67')])){_0x46f4ff['host']=_0x426209['Smtp']['host'];_0x46f4ff['port']=_0x426209['Smtp'][_0x97f1('0x68')];_0x46f4ff[_0x97f1('0x69')]=_0x426209[_0x97f1('0x65')][_0x97f1('0x69')];if(_0x426209[_0x97f1('0x65')][_0x97f1('0x6a')]){_0x46f4ff[_0x97f1('0x6b')]={'user':_0x426209[_0x97f1('0x65')]['user'],'pass':_0x426209[_0x97f1('0x65')][_0x97f1('0x6c')]};}}else{_0x46f4ff[_0x97f1('0x67')]=_0x426209['Smtp'][_0x97f1('0x67')];_0x46f4ff['auth']={'user':_0x426209['Smtp'][_0x97f1('0x6d')],'pass':_0x426209[_0x97f1('0x65')][_0x97f1('0x6c')]};_0x46f4ff[_0x97f1('0x69')]=_0x426209[_0x97f1('0x65')][_0x97f1('0x69')];}if(_0xc6ee87[_0x97f1('0x56')][_0x97f1('0x6e')]&&_0xc6ee87['body'][_0x97f1('0x6e')]['length']){for(var _0x13366e=0x0;_0x13366e<_0xc6ee87[_0x97f1('0x56')]['attachments'][_0x97f1('0x42')];_0x13366e+=0x1){_0xc6ee87[_0x97f1('0x56')]['attachments'][_0x13366e]={'filename':_0xc6ee87[_0x97f1('0x56')][_0x97f1('0x6e')][_0x13366e][_0x97f1('0x35')],'path':path[_0x97f1('0x6f')](config['root'],_0x97f1('0x70'),_0xc6ee87[_0x97f1('0x56')][_0x97f1('0x6e')][_0x13366e][_0x97f1('0x71')])};}}_0x35bdfd={'account':_0x46f4ff,'message':_0xc6ee87[_0x97f1('0x56')]};return;}})['then'](function(){if(_0x426209['List']){if(_0x426209[_0x97f1('0x60')][_0x97f1('0x62')][_0x97f1('0x42')]){return _0x426209[_0x97f1('0x60')]['Contacts'][0x0];}else{return db[_0x97f1('0x61')][_0x97f1('0x58')](_[_0x97f1('0x18')](_0xc6ee87[_0x97f1('0x56')],{'firstName':_0xc6ee87[_0x97f1('0x56')]['to'],'email':_0xc6ee87[_0x97f1('0x56')]['to'],'phone':_0xc6ee87[_0x97f1('0x56')]['to'],'ListId':_0x426209['ListId']}));}}else{throw new Error(_0x97f1('0x72'));}})['then'](function(){if(_0x35bdfd){return respondWithRpcPromise(_0x97f1('0x73'),_0x97f1('0x74'),_0x35bdfd,client9003)[_0x97f1('0x4d')](function(_0x4fabff){return _0x215223['update']({'read':!![],'messageId':_0x4fabff[_0x97f1('0x75')],'sentAt':moment()[_0x97f1('0x76')](_0x97f1('0x77'))});})[_0x97f1('0x51')](function(_0x5cdcb7){logger[_0x97f1('0x24')]('%s',JSON[_0x97f1('0x23')](_0x5cdcb7));return _0x215223;});}return _0x215223;});}return _0x215223;}})[_0x97f1('0x4d')](respondWithResult(_0x17ff6f,0xc9))[_0x97f1('0x51')](handleError(_0x17ff6f,null));};var interaction_log=require(_0x97f1('0x13'))(_0x97f1('0x78'));exports[_0x97f1('0x79')]=function(_0x448aca,_0x111eae,_0x2f0b26){var _0x2cc472={'agent':{},'channel':_0x97f1('0x7a')};if(_0x448aca[_0x97f1('0x56')]['id']){delete _0x448aca['body']['id'];}_0x448aca[_0x97f1('0x56')][_0x97f1('0x7b')]=!![];_0x448aca[_0x97f1('0x56')][_0x97f1('0x7c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x448aca[_0x97f1('0x56')][_0x97f1('0x7d')]=_0x448aca['body'][_0x97f1('0x7d')]||_0x448aca[_0x97f1('0x6d')]['id'];_0x2cc472[_0x97f1('0x7e')]['id']=_0x448aca[_0x97f1('0x56')][_0x97f1('0x7d')];return db['MailMessage'][_0x97f1('0x54')]({'where':{'id':_0x448aca[_0x97f1('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x97f1('0x61')],'as':_0x97f1('0x7f')}]})[_0x97f1('0x4d')](handleEntityNotFound(_0x111eae,null))['then'](saveUpdates(_0x448aca[_0x97f1('0x56')],null))[_0x97f1('0x4d')](function(_0x49bbb3){if(_0x49bbb3){_0x2cc472[_0x97f1('0x25')]=_0x49bbb3[_0x97f1('0x80')]({'plain':!![]});return db[_0x97f1('0x81')][_0x97f1('0x54')]({'where':{'id':_0x49bbb3[_0x97f1('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x111eae,null))[_0x97f1('0x4d')](function(_0xacdb9a){if(_0xacdb9a){return _0xacdb9a[_0x97f1('0x55')]({'UserId':_0x448aca['body'][_0x97f1('0x7d')],'read1stAt':_[_0x97f1('0x66')](_0xacdb9a[_0x97f1('0x83')])?moment()[_0x97f1('0x76')](_0x97f1('0x77')):undefined});}return null;})[_0x97f1('0x4d')](function(_0x21ced0){if(_0x21ced0){_0x2cc472['interaction']=_0x21ced0[_0x97f1('0x80')]({'plain':!![]});interaction_log['info'](_0x97f1('0x84'),_0x448aca[_0x97f1('0x6d')]['id'],_0x448aca[_0x97f1('0x6d')][_0x97f1('0x35')],_0x448aca[_0x97f1('0x6d')][_0x97f1('0x85')],_0x2cc472[_0x97f1('0x86')]['id'],_0x448aca[_0x97f1('0x56')]?JSON['stringify'](_0x448aca['body']):_0x97f1('0x87'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2cc472);}return null;})['then'](function(_0x441c71){if(_0x441c71){if(_0x448aca[_0x97f1('0x56')][_0x97f1('0x88')]){_0x2cc472['message'][_0x97f1('0x89')]=util['format']('SIP/%s',_0x448aca[_0x97f1('0x6d')][_0x97f1('0x35')]);_0x2cc472[_0x97f1('0x25')][_0x97f1('0x8a')]=_0x2cc472[_0x97f1('0x8a')];_0x2cc472[_0x97f1('0x25')][_0x97f1('0x8b')]=_0x97f1('0x79');return respondWithRpcPromise('EventManager',_0x97f1('0x8c'),{'event':_0x97f1('0x8d'),'message':_0x2cc472[_0x97f1('0x25')]},client9002)[_0x97f1('0x4d')](function(){return _0x2cc472;});}return _0x2cc472;}return null;})[_0x97f1('0x4d')](respondWithResult(_0x111eae,null))[_0x97f1('0x51')](handleError(_0x111eae,null));};var interaction_log=require(_0x97f1('0x13'))('mail-interactions');exports['reject']=function(_0x2ac300,_0x1d0a3f,_0x2368b4){var _0x121bdc={'agent':{},'channel':_0x97f1('0x7a')};if(_0x2ac300[_0x97f1('0x56')]['id']){delete _0x2ac300['body']['id'];}_0x2ac300[_0x97f1('0x56')]['UserId']=_0x2ac300['body'][_0x97f1('0x7d')]||_0x2ac300['user']['id'];_0x121bdc[_0x97f1('0x7e')]['id']=_0x2ac300[_0x97f1('0x56')][_0x97f1('0x7d')];return db[_0x97f1('0x38')][_0x97f1('0x54')]({'where':{'id':_0x2ac300[_0x97f1('0x52')]['id'],'UserId':null}})[_0x97f1('0x4d')](handleEntityNotFound(_0x1d0a3f,null))['then'](function(_0x58017d){if(_0x58017d){_0x121bdc[_0x97f1('0x25')]=_0x58017d['get']({'plain':!![]});return db[_0x97f1('0x81')]['find']({'where':{'id':_0x58017d[_0x97f1('0x82')]}});}return null;})[_0x97f1('0x4d')](handleEntityNotFound(_0x1d0a3f,null))['then'](function(_0x1d54ed){if(_0x1d54ed){_0x121bdc[_0x97f1('0x86')]=_0x1d54ed['get']({'plain':!![]});interaction_log[_0x97f1('0x27')](_0x97f1('0x8e'),_0x2ac300[_0x97f1('0x6d')]['id'],_0x2ac300['user'][_0x97f1('0x35')],_0x2ac300[_0x97f1('0x6d')][_0x97f1('0x85')],_0x121bdc[_0x97f1('0x86')]['id'],_0x2ac300['body']?JSON[_0x97f1('0x23')](_0x2ac300[_0x97f1('0x56')]):_0x97f1('0x87'));return respondWithRpcPromise(_0x97f1('0x8f'),'rejectMessage',_0x121bdc);}return null;})[_0x97f1('0x4d')](function(_0x459f67){if(_0x459f67){_0x459f67['message']['interface']=util[_0x97f1('0x76')](_0x97f1('0x90'),_0x2ac300[_0x97f1('0x6d')]['name']);_0x459f67[_0x97f1('0x25')][_0x97f1('0x8a')]=_0x121bdc[_0x97f1('0x8a')];_0x459f67[_0x97f1('0x25')][_0x97f1('0x8b')]=_0x97f1('0x32');respondWithRpcPromise(_0x97f1('0x8c'),_0x97f1('0x8c'),{'event':_0x97f1('0x91'),'message':_0x459f67[_0x97f1('0x25')]},client9002);return _0x121bdc;}return null;})[_0x97f1('0x4d')](respondWithResult(_0x1d0a3f,null))[_0x97f1('0x51')](handleError(_0x1d0a3f,null));};exports['download']=function(_0x5ca012,_0x51fcf5){var _0x3cc032=moment()[_0x97f1('0x92')]()[_0x97f1('0x93')]();var _0x298bf7=path[_0x97f1('0x6f')](config['root'],_0x97f1('0x94'),_0x97f1('0x95'),'tmp');var _0x30846c=path[_0x97f1('0x6f')](config['root'],_0x97f1('0x94'),'files',_0x97f1('0x6e'));var _0x201ef5=util['format'](_0x97f1('0x96'),_0x3cc032);return db[_0x97f1('0x38')][_0x97f1('0x54')]({'where':{'id':_0x5ca012[_0x97f1('0x52')]['id']},'attributes':['id',_0x97f1('0x56'),_0x97f1('0x97'),'to','cc',_0x97f1('0x98'),_0x97f1('0x99'),'createdAt'],'include':_0x5ca012['query'][_0x97f1('0x6e')]?[{'model':db[_0x97f1('0x9a')],'as':_0x97f1('0x9b')}]:undefined})[_0x97f1('0x4d')](handleEntityNotFound(_0x51fcf5,null))[_0x97f1('0x4d')](function(_0x235c53){if(_0x235c53){var _0x537037=_0x235c53;var _0x315f07={'from':_0x537037[_0x97f1('0x97')],'to':_0x537037['to'],'subject':_0x537037['subject'],'html':_0x537037[_0x97f1('0x56')],'headers':{'Date':moment(_0x537037[_0x97f1('0x9c')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x235c53['cc']){_0x315f07[_0x97f1('0x9d')]['Cc']=_0x235c53['cc'];}if(_0x235c53['bcc']){_0x315f07['headers'][_0x97f1('0x9e')]=_0x235c53[_0x97f1('0x98')];}return new BPromise(function(_0x5d0f8d,_0x3e6d26){if(_0x235c53[_0x97f1('0x9b')]){for(var _0x122725=0x0;_0x122725<_0x235c53['Attachments'][_0x97f1('0x42')];_0x122725++){var _0x81ee85=_0x235c53['Attachments'][_0x122725];var _0x1b4238=path[_0x97f1('0x6f')](_0x30846c,_0x81ee85['basename']);if(fs[_0x97f1('0x9f')](_0x1b4238)){_0x315f07[_0x97f1('0x6e')][_0x97f1('0xa0')]({'name':_0x81ee85[_0x97f1('0x35')],'contentType':_0x81ee85[_0x97f1('0x3a')],'data':fs[_0x97f1('0xa1')](_0x1b4238)});}}}emlformat[_0x97f1('0xa2')](_0x315f07,function(_0x4b0879,_0x5eb0f0){if(_0x4b0879)return _0x3e6d26(_0x4b0879);fs[_0x97f1('0xa3')](path['join'](_0x298bf7,_0x201ef5),_0x5eb0f0);return _0x5d0f8d(_0x5eb0f0);});});}})[_0x97f1('0x4d')](function(_0x53a8d6){if(_0x53a8d6){return _0x51fcf5['download'](path[_0x97f1('0x6f')](_0x298bf7,_0x201ef5),_0x201ef5,function(_0xbe16a5){if(_0xbe16a5){console[_0x97f1('0xa4')](_0x97f1('0xa5'),_0xbe16a5);}else{fs['unlinkSync'](path[_0x97f1('0x6f')](_0x298bf7,_0x201ef5));}});}})[_0x97f1('0x51')](handleError(_0x51fcf5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index c412c49..fd32ac9 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 _0x7eaa=['events','../../mysqldb','update','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7eaa,0x70));var _0xa7ea=function(_0x59c959,_0x21588f){_0x59c959=_0x59c959-0x0;var _0x58c537=_0x7eaa[_0x59c959];return _0x58c537;};'use strict';var EventEmitter=require(_0xa7ea('0x0'));var MailMessage=require(_0xa7ea('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa7ea('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5e0d99){return function(_0x5ab7dc,_0x34f742,_0x3682b1){MailMessageEvents[_0xa7ea('0x3')](_0x5e0d99+':'+_0x5ab7dc['id'],_0x5ab7dc);MailMessageEvents[_0xa7ea('0x3')](_0x5e0d99,_0x5ab7dc);_0x3682b1(null);};}for(var e in events){if(events[_0xa7ea('0x4')](e)){var event=events[e];MailMessage[_0xa7ea('0x5')](e,emitEvent(event));}}module[_0xa7ea('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x393b=['exports','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x4f153b,_0x39818f){var _0x4e0cf8=function(_0x5a2236){while(--_0x5a2236){_0x4f153b['push'](_0x4f153b['shift']());}};_0x4e0cf8(++_0x39818f);}(_0x393b,0x197));var _0xb393=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x393b[_0x4ed1d4];return _0x28e363;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xb393('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb393('0x1'),'afterDestroy':_0xb393('0x2')};function emitEvent(_0xe91b6f){return function(_0x1d41d3,_0x3f8abd,_0x589aa5){MailMessageEvents[_0xb393('0x3')](_0xe91b6f+':'+_0x1d41d3['id'],_0x1d41d3);MailMessageEvents[_0xb393('0x3')](_0xe91b6f,_0x1d41d3);_0x589aa5(null);};}for(var e in events){if(events[_0xb393('0x4')](e)){var event=events[e];MailMessage[_0xb393('0x5')](e,emitEvent(event));}}module[_0xb393('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 0977c9f..47171f0 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 _0x3d55=['./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','isNil','UserId','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf'];(function(_0x1bd839,_0x390f3a){var _0x4ea74d=function(_0x348e92){while(--_0x348e92){_0x1bd839['push'](_0x1bd839['shift']());}};_0x4ea74d(++_0x390f3a);}(_0x3d55,0x141));var _0x53d5=function(_0x43fda2,_0x1c5662){_0x43fda2=_0x43fda2-0x0;var _0xa492a2=_0x3d55[_0x43fda2];return _0xa492a2;};'use strict';var _=require(_0x53d5('0x0'));var util=require(_0x53d5('0x1'));var logger=require(_0x53d5('0x2'))(_0x53d5('0x3'));var moment=require(_0x53d5('0x4'));var BPromise=require(_0x53d5('0x5'));var rp=require('request-promise');var htmlToText=require(_0x53d5('0x6'));var fs=require('fs');var path=require(_0x53d5('0x7'));var rimraf=require(_0x53d5('0x8'));var config=require('../../config/environment');var attributes=require(_0x53d5('0x9'));module[_0x53d5('0xa')]=function(_0x14b38c,_0x4a7757){return _0x14b38c['define'](_0x53d5('0xb'),attributes,{'tableName':_0x53d5('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x53d5('0xd')]},{'name':_0x53d5('0xe'),'fields':['plainBody','subject'],'type':_0x53d5('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x550e47,_0x5f0d4a,_0x5c449b){if(_0x550e47[_0x53d5('0x10')]){_0x550e47[_0x53d5('0x11')]=htmlToText[_0x53d5('0x12')](_0x550e47[_0x53d5('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5c449b(null,_0x5f0d4a);},'afterCreate':function(_0x39ad16,_0x5a98d1,_0x26d976){var _0x528256=_0x14b38c[_0x53d5('0x13')];var _0x12a659=_0x39ad16[_0x53d5('0x14')]({'plain':!![]});if(_0x12a659[_0x53d5('0x15')][_0x53d5('0x16')]()==='in'||_0x12a659[_0x53d5('0x15')][_0x53d5('0x16')]()===_0x53d5('0x17')&&!_0x12a659['secret']&&!_[_0x53d5('0x18')](_0x12a659[_0x53d5('0x19')])){_0x528256['MailInteraction'][_0x53d5('0x1a')]({'where':{'id':_0x12a659['MailInteractionId']}})['then'](function(_0x5c7049){if(_0x5c7049){_0x5c7049[_0x53d5('0x1b')]({'lastMsgAt':_0x12a659[_0x53d5('0x1c')],'lastMsgDirection':_0x12a659['direction']['toLowerCase']()});}})[_0x53d5('0x1d')](function(_0xbf905f){console[_0x53d5('0x1e')](_0xbf905f);});}_0x26d976();}},'charset':_0x53d5('0x1f'),'collate':_0x53d5('0x20')});}; \ No newline at end of file +var _0xce3a=['define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','createdAt','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes'];(function(_0x1c3291,_0x40ac11){var _0x5c1d59=function(_0x4268e5){while(--_0x4268e5){_0x1c3291['push'](_0x1c3291['shift']());}};_0x5c1d59(++_0x40ac11);}(_0xce3a,0x194));var _0xace3=function(_0x5d3a9e,_0x92921){_0x5d3a9e=_0x5d3a9e-0x0;var _0xe6ca06=_0xce3a[_0x5d3a9e];return _0xe6ca06;};'use strict';var _=require(_0xace3('0x0'));var util=require(_0xace3('0x1'));var logger=require(_0xace3('0x2'))(_0xace3('0x3'));var moment=require(_0xace3('0x4'));var BPromise=require(_0xace3('0x5'));var rp=require(_0xace3('0x6'));var htmlToText=require(_0xace3('0x7'));var fs=require('fs');var path=require(_0xace3('0x8'));var rimraf=require(_0xace3('0x9'));var config=require(_0xace3('0xa'));var attributes=require(_0xace3('0xb'));module['exports']=function(_0x3ee264,_0x3d4ebc){return _0x3ee264[_0xace3('0xc')](_0xace3('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xace3('0xe'),'fields':['messageId']},{'name':_0xace3('0xf'),'fields':[_0xace3('0x10'),_0xace3('0x11')],'type':_0xace3('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x259407,_0x44aa51,_0x125f11){if(_0x259407[_0xace3('0x13')]){_0x259407['plainBody']=htmlToText['fromString'](_0x259407['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x125f11(null,_0x44aa51);},'afterCreate':function(_0xa4ea87,_0x5b416a,_0x4be1f1){var _0x3566ad=_0x3ee264['models'];var _0x17bc3e=_0xa4ea87['get']({'plain':!![]});if(_0x17bc3e[_0xace3('0x14')][_0xace3('0x15')]()==='in'||_0x17bc3e[_0xace3('0x14')]['toLowerCase']()===_0xace3('0x16')&&!_0x17bc3e[_0xace3('0x17')]&&!_[_0xace3('0x18')](_0x17bc3e[_0xace3('0x19')])){_0x3566ad['MailInteraction'][_0xace3('0x1a')]({'where':{'id':_0x17bc3e[_0xace3('0x1b')]}})[_0xace3('0x1c')](function(_0x142bb6){if(_0x142bb6){_0x142bb6['update']({'lastMsgAt':_0x17bc3e[_0xace3('0x1d')],'lastMsgDirection':_0x17bc3e[_0xace3('0x14')][_0xace3('0x15')]()});}})[_0xace3('0x1e')](function(_0x2ef370){console[_0xace3('0x1f')](_0x2ef370);});}_0x4be1f1();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e905733..9c11a8a 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 _0x4a77=['./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateMailMessage','body','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x206a3c,_0x2c2f57){var _0x3e0f8d=function(_0x2edcb9){while(--_0x2edcb9){_0x206a3c['push'](_0x206a3c['shift']());}};_0x3e0f8d(++_0x2c2f57);}(_0x4a77,0x1ee));var _0x74a7=function(_0x465e35,_0x19f5c3){_0x465e35=_0x465e35-0x0;var _0x5eba07=_0x4a77[_0x465e35];return _0x5eba07;};'use strict';var _=require(_0x74a7('0x0'));var util=require(_0x74a7('0x1'));var moment=require(_0x74a7('0x2'));var BPromise=require(_0x74a7('0x3'));var rs=require(_0x74a7('0x4'));var fs=require('fs');var Redis=require(_0x74a7('0x5'));var db=require(_0x74a7('0x6'))['db'];var utils=require(_0x74a7('0x7'));var logger=require('../../config/logger')(_0x74a7('0x8'));var config=require(_0x74a7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x74a7('0xa')][_0x74a7('0xb')]({'port':0x232a});config[_0x74a7('0xc')]=_[_0x74a7('0xd')](config[_0x74a7('0xc')],{'host':_0x74a7('0xe'),'port':0x18eb});var socket=require(_0x74a7('0xf'))(new Redis(config[_0x74a7('0xc')]));require(_0x74a7('0x10'))[_0x74a7('0x11')](socket);function respondWithRpcPromise(_0xfde49b,_0x2835a3,_0x54c68f){return new BPromise(function(_0x210ea7,_0x56da5e){return client[_0x74a7('0x12')](_0xfde49b,_0x54c68f)[_0x74a7('0x13')](function(_0x520f1c){logger['info'](_0x74a7('0x14'),_0x2835a3,'request\x20sent');logger[_0x74a7('0x15')](_0x74a7('0x16'),_0x2835a3,_0x74a7('0x17'),JSON[_0x74a7('0x18')](_0x520f1c));if(_0x520f1c[_0x74a7('0x19')]){if(_0x520f1c[_0x74a7('0x19')]['code']===0x1f4){logger['error'](_0x74a7('0x14'),_0x2835a3,_0x520f1c[_0x74a7('0x19')][_0x74a7('0x1a')]);return _0x56da5e(_0x520f1c[_0x74a7('0x19')][_0x74a7('0x1a')]);}logger[_0x74a7('0x19')](_0x74a7('0x14'),_0x2835a3,_0x520f1c[_0x74a7('0x19')][_0x74a7('0x1a')]);return _0x210ea7(_0x520f1c[_0x74a7('0x19')][_0x74a7('0x1a')]);}else{logger['info'](_0x74a7('0x14'),_0x2835a3,_0x74a7('0x17'));_0x210ea7(_0x520f1c[_0x74a7('0x1b')][_0x74a7('0x1a')]);}})[_0x74a7('0x1c')](function(_0x5402e8){logger['error'](_0x74a7('0x14'),_0x2835a3,_0x5402e8);_0x56da5e(_0x5402e8);});});}exports[_0x74a7('0x1d')]=function(_0x2db359){var _0xa35eab=this;return new Promise(function(_0x5591dc,_0x46cdbf){return db['MailMessage']['create'](_0x2db359[_0x74a7('0x1e')],{'raw':_0x2db359[_0x74a7('0x1f')]?_0x2db359[_0x74a7('0x1f')][_0x74a7('0x20')]===undefined?!![]:![]:!![]})[_0x74a7('0x13')](function(_0x1a9707){logger[_0x74a7('0x21')](_0x74a7('0x1d'),_0x2db359);logger[_0x74a7('0x15')](_0x74a7('0x1d'),_0x2db359,JSON[_0x74a7('0x18')](_0x1a9707));_0x5591dc(_0x1a9707);})[_0x74a7('0x1c')](function(_0x2ab07d){logger[_0x74a7('0x19')]('CreateMailMessage',_0x2ab07d['message'],_0x2db359);_0x46cdbf(_0xa35eab[_0x74a7('0x19')](0x1f4,_0x2ab07d['message']));});});}; \ No newline at end of file +var _0xc01b=['code','error','message','result','CreateMailMessage','MailMessage','create','body','then','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x385e50,_0x5f5d85){var _0x42102b=function(_0x5767f9){while(--_0x5767f9){_0x385e50['push'](_0x385e50['shift']());}};_0x42102b(++_0x5f5d85);}(_0xc01b,0x74));var _0xbc01=function(_0x488aad,_0x59b996){_0x488aad=_0x488aad-0x0;var _0x91d0c5=_0xc01b[_0x488aad];return _0x91d0c5;};'use strict';var _=require(_0xbc01('0x0'));var util=require(_0xbc01('0x1'));var moment=require(_0xbc01('0x2'));var BPromise=require(_0xbc01('0x3'));var rs=require(_0xbc01('0x4'));var fs=require('fs');var Redis=require(_0xbc01('0x5'));var db=require(_0xbc01('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc01('0x7'))(_0xbc01('0x8'));var config=require(_0xbc01('0x9'));var jayson=require(_0xbc01('0xa'));var client=jayson[_0xbc01('0xb')][_0xbc01('0xc')]({'port':0x232a});config[_0xbc01('0xd')]=_[_0xbc01('0xe')](config[_0xbc01('0xd')],{'host':_0xbc01('0xf'),'port':0x18eb});var socket=require(_0xbc01('0x10'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xbc01('0x11')](socket);function respondWithRpcPromise(_0x19ddb6,_0x40205f,_0x294e04){return new BPromise(function(_0x3e50aa,_0x2dac2c){return client[_0xbc01('0x12')](_0x19ddb6,_0x294e04)['then'](function(_0x373e99){logger[_0xbc01('0x13')](_0xbc01('0x14'),_0x40205f,'request\x20sent');logger[_0xbc01('0x15')](_0xbc01('0x16'),_0x40205f,_0xbc01('0x17'),JSON['stringify'](_0x373e99));if(_0x373e99['error']){if(_0x373e99['error'][_0xbc01('0x18')]===0x1f4){logger[_0xbc01('0x19')](_0xbc01('0x14'),_0x40205f,_0x373e99[_0xbc01('0x19')]['message']);return _0x2dac2c(_0x373e99[_0xbc01('0x19')][_0xbc01('0x1a')]);}logger[_0xbc01('0x19')](_0xbc01('0x14'),_0x40205f,_0x373e99[_0xbc01('0x19')][_0xbc01('0x1a')]);return _0x3e50aa(_0x373e99[_0xbc01('0x19')][_0xbc01('0x1a')]);}else{logger[_0xbc01('0x13')](_0xbc01('0x14'),_0x40205f,_0xbc01('0x17'));_0x3e50aa(_0x373e99[_0xbc01('0x1b')][_0xbc01('0x1a')]);}})['catch'](function(_0x344e70){logger[_0xbc01('0x19')]('MailMessage,\x20%s,\x20%s',_0x40205f,_0x344e70);_0x2dac2c(_0x344e70);});});}exports[_0xbc01('0x1c')]=function(_0x277de3){var _0x1c72f6=this;return new Promise(function(_0x46faec,_0x40be78){return db[_0xbc01('0x1d')][_0xbc01('0x1e')](_0x277de3[_0xbc01('0x1f')],{'raw':_0x277de3['options']?_0x277de3['options']['raw']===undefined?!![]:![]:!![]})[_0xbc01('0x20')](function(_0x120e3b){logger[_0xbc01('0x13')](_0xbc01('0x1c'),_0x277de3);logger[_0xbc01('0x15')](_0xbc01('0x1c'),_0x277de3,JSON[_0xbc01('0x21')](_0x120e3b));_0x46faec(_0x120e3b);})[_0xbc01('0x22')](function(_0x41eb75){logger[_0xbc01('0x19')]('CreateMailMessage',_0x41eb75[_0xbc01('0x1a')],_0x277de3);_0x40be78(_0x1c72f6[_0xbc01('0x19')](0x1f4,_0x41eb75[_0xbc01('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ecb875d..6dde873 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 _0xd609=['remove','emit','register'];(function(_0x2c6a0d,_0x28a135){var _0x4f9bde=function(_0x2e0f3d){while(--_0x2e0f3d){_0x2c6a0d['push'](_0x2c6a0d['shift']());}};_0x4f9bde(++_0x28a135);}(_0xd609,0x10b));var _0x9d60=function(_0x430cb3,_0x558637){_0x430cb3=_0x430cb3-0x0;var _0x47f555=_0xd609[_0x430cb3];return _0x47f555;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x9d60('0x0'),'update'];function createListener(_0x49275c,_0x3d8e85){return function(_0x184c6c){_0x3d8e85[_0x9d60('0x1')](_0x49275c,_0x184c6c);};}function removeListener(_0xe14029,_0x35ea05){return function(){MailMessageEvents['removeListener'](_0xe14029,_0x35ea05);};}exports[_0x9d60('0x2')]=function(_0x43cabe){for(var _0x43e863=0x0,_0x25bc0d=events['length'];_0x43e863<_0x25bc0d;_0x43e863++){var _0x23a69b=events[_0x43e863];var _0xd41110=createListener('mailMessage:'+_0x23a69b,_0x43cabe);MailMessageEvents['on'](_0x23a69b,_0xd41110);}}; \ No newline at end of file +var _0x5793=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x5096dd,_0x2f74d3){var _0xa7a6a1=function(_0x53ad87){while(--_0x53ad87){_0x5096dd['push'](_0x5096dd['shift']());}};_0xa7a6a1(++_0x2f74d3);}(_0x5793,0xb1));var _0x3579=function(_0x4ad561,_0x31a137){_0x4ad561=_0x4ad561-0x0;var _0x336445=_0x5793[_0x4ad561];return _0x336445;};'use strict';var MailMessageEvents=require(_0x3579('0x0'));var events=[_0x3579('0x1'),_0x3579('0x2'),_0x3579('0x3')];function createListener(_0x506d6e,_0x5f505f){return function(_0x5ac908){_0x5f505f[_0x3579('0x4')](_0x506d6e,_0x5ac908);};}function removeListener(_0x45c4bc,_0x165417){return function(){MailMessageEvents[_0x3579('0x5')](_0x45c4bc,_0x165417);};}exports[_0x3579('0x6')]=function(_0x52d718){for(var _0xf67978=0x0,_0x5dd3ae=events[_0x3579('0x7')];_0xf67978<_0x5dd3ae;_0xf67978++){var _0x346e12=events[_0xf67978];var _0x2c3f1c=createListener(_0x3579('0x8')+_0x346e12,_0x52d718);MailMessageEvents['on'](_0x346e12,_0x2c3f1c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 1a81fa4..3a28ffe 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 _0x5507=['express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5507,0x17c));var _0x7550=function(_0x2ef185,_0x1fb978){_0x2ef185=_0x2ef185-0x0;var _0x5e343c=_0x5507[_0x2ef185];return _0x5e343c;};'use strict';var multer=require(_0x7550('0x0'));var util=require(_0x7550('0x1'));var path=require(_0x7550('0x2'));var timeout=require(_0x7550('0x3'));var express=require(_0x7550('0x4'));var router=express[_0x7550('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7550('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7550('0x7'));var controller=require(_0x7550('0x8'));router[_0x7550('0x9')]('/',auth[_0x7550('0xa')](),controller[_0x7550('0xb')]);router[_0x7550('0x9')](_0x7550('0xc'),auth[_0x7550('0xa')](),controller['describe']);router['get'](_0x7550('0xd'),auth['isAuthenticated'](),controller[_0x7550('0xe')]);router[_0x7550('0x9')](_0x7550('0xf'),auth[_0x7550('0xa')](),controller[_0x7550('0x10')]);router[_0x7550('0x9')](_0x7550('0x11'),auth[_0x7550('0xa')](),controller[_0x7550('0x12')]);router['get'](_0x7550('0x13'),auth['isAuthenticated'](),controller[_0x7550('0x14')]);router['post']('/',auth[_0x7550('0xa')](),controller[_0x7550('0x15')]);router[_0x7550('0x16')](_0x7550('0x11'),auth['isAuthenticated'](),controller[_0x7550('0x17')]);router[_0x7550('0x16')](_0x7550('0x13'),auth[_0x7550('0xa')](),controller[_0x7550('0x18')]);router[_0x7550('0x19')](_0x7550('0xd'),auth[_0x7550('0xa')](),controller[_0x7550('0x1a')]);router[_0x7550('0x1b')]('/:id',auth[_0x7550('0xa')](),controller[_0x7550('0x1c')]);router[_0x7550('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7550('0x1d')]);router[_0x7550('0x1b')]('/:id/users',auth[_0x7550('0xa')](),controller[_0x7550('0x1e')]);module[_0x7550('0x1f')]=router; \ No newline at end of file +var _0xfea2=['removeTeams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','get','/describe','describe','/:id','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','delete','destroy'];(function(_0x537b79,_0x4256cd){var _0x37ea53=function(_0x44718b){while(--_0x44718b){_0x537b79['push'](_0x537b79['shift']());}};_0x37ea53(++_0x4256cd);}(_0xfea2,0x153));var _0x2fea=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xfea2[_0x38c632];return _0x12737e;};'use strict';var multer=require('multer');var util=require(_0x2fea('0x0'));var path=require(_0x2fea('0x1'));var timeout=require(_0x2fea('0x2'));var express=require('express');var router=express[_0x2fea('0x3')]();var fs_extra=require(_0x2fea('0x4'));var auth=require(_0x2fea('0x5'));var interaction=require(_0x2fea('0x6'));var config=require(_0x2fea('0x7'));var controller=require(_0x2fea('0x8'));router['get']('/',auth[_0x2fea('0x9')](),controller['index']);router[_0x2fea('0xa')](_0x2fea('0xb'),auth[_0x2fea('0x9')](),controller[_0x2fea('0xc')]);router[_0x2fea('0xa')](_0x2fea('0xd'),auth[_0x2fea('0x9')](),controller['show']);router[_0x2fea('0xa')](_0x2fea('0xe'),auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x2fea('0xf')]);router['get'](_0x2fea('0x10'),auth[_0x2fea('0x9')](),controller[_0x2fea('0x11')]);router[_0x2fea('0x12')]('/',auth[_0x2fea('0x9')](),controller[_0x2fea('0x13')]);router[_0x2fea('0x12')](_0x2fea('0x14'),auth['isAuthenticated'](),controller[_0x2fea('0x15')]);router[_0x2fea('0x12')](_0x2fea('0x10'),auth['isAuthenticated'](),controller[_0x2fea('0x16')]);router['put']('/:id',auth[_0x2fea('0x9')](),controller['update']);router[_0x2fea('0x17')](_0x2fea('0xd'),auth[_0x2fea('0x9')](),controller[_0x2fea('0x18')]);router[_0x2fea('0x17')](_0x2fea('0x14'),auth[_0x2fea('0x9')](),controller[_0x2fea('0x19')]);router['delete'](_0x2fea('0x10'),auth[_0x2fea('0x9')](),controller[_0x2fea('0x1a')]);module[_0x2fea('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f434abe..18fd3b4 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 _0x4c41=['ENUM','rrmemory','roundrobin','exports'];(function(_0x4495ca,_0x570651){var _0x4637c0=function(_0x409b84){while(--_0x409b84){_0x4495ca['push'](_0x4495ca['shift']());}};_0x4637c0(++_0x570651);}(_0x4c41,0xf7));var _0x14c4=function(_0x5d0f02,_0x35b9de){_0x5d0f02=_0x5d0f02-0x0;var _0x40e39b=_0x4c41[_0x5d0f02];return _0x40e39b;};'use strict';var Sequelize=require('sequelize');module[_0x14c4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x14c4('0x1')](_0x14c4('0x2'),'beepall',_0x14c4('0x3'))}}; \ No newline at end of file +var _0xef66=['exports','STRING','name','rrmemory','beepall','roundrobin','sequelize'];(function(_0x519950,_0x4634bd){var _0x566c5a=function(_0x207d2a){while(--_0x207d2a){_0x519950['push'](_0x519950['shift']());}};_0x566c5a(++_0x4634bd);}(_0xef66,0x1db));var _0x6ef6=function(_0x61876e,_0x231f99){_0x61876e=_0x61876e-0x0;var _0xade794=_0xef66[_0x61876e];return _0xade794;};'use strict';var Sequelize=require(_0x6ef6('0x0'));module[_0x6ef6('0x1')]={'name':{'type':Sequelize[_0x6ef6('0x2')],'unique':_0x6ef6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6ef6('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6ef6('0x4'),_0x6ef6('0x5'),_0x6ef6('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 15a1e77..290f55f 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 _0xa9e0=['all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','json','count','offset','limit','status','set','apply','save','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','pick','User','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','flatMap','Agents','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','includes'];(function(_0x1ce144,_0x1b1f4e){var _0x1cfa63=function(_0x41f533){while(--_0x41f533){_0x1ce144['push'](_0x1ce144['shift']());}};_0x1cfa63(++_0x1b1f4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=_0x478723[_0x0a9e('0x1e')],_0x205fd6=_0x459eb1[_0x0a9e('0x1f')],_0x31b1ca=_0x459eb1[_0x0a9e('0x1f')]+_0x459eb1[_0x0a9e('0x20')],_0x2eb11f;if(_0x31b1ca>=_0x106033){_0x31b1ca=_0x106033;_0x2eb11f=0xc8;}else{_0x2eb11f=0xce;}_0x5a0a06[_0x0a9e('0x21')](_0x2eb11f);return _0x5a0a06[_0x0a9e('0x22')]('Content-Range',_0x205fd6+'-'+_0x31b1ca+'/'+_0x106033)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x155cce){return function(_0x53682f){try{jsonpatch[_0x0a9e('0x23')](_0x53682f,_0x155cce,!![]);}catch(_0x5a09ef){return BPromise['reject'](_0x5a09ef);}return _0x53682f[_0x0a9e('0x24')]();};}function saveUpdates(_0x432e56,_0x38e7c4){return function(_0x30bae6){if(_0x30bae6){return _0x30bae6['update'](_0x432e56)[_0x0a9e('0x25')](function(_0x2fb0e4){return _0x2fb0e4;});}return null;};}function removeEntity(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')]()[_0x0a9e('0x25')](function(){var _0x5ea472=_0x370d86['get']({'plain':!![]});var _0x197ec0=_0x0a9e('0x27');return db[_0x0a9e('0x28')][_0x0a9e('0x26')]({'where':{'type':_0x197ec0,'resourceId':_0x5ea472['id']}})['then'](function(){return _0x370d86;});})[_0x0a9e('0x25')](function(){_0x3b45bc['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x5bfb33,_0x1dc186){return function(_0x34dc65){if(!_0x34dc65){_0x5bfb33[_0x0a9e('0x1b')](0x194);}return _0x34dc65;};}function handleError(_0x14433c,_0x140511){_0x140511=_0x140511||0x1f4;return function(_0x1538a4){logger[_0x0a9e('0x29')](_0x1538a4[_0x0a9e('0x2a')]);if(_0x1538a4['name']){delete _0x1538a4[_0x0a9e('0x2b')];}_0x14433c[_0x0a9e('0x21')](_0x140511)[_0x0a9e('0x2c')](_0x1538a4);};}exports[_0x0a9e('0x2d')]=function(_0x5c877d,_0x15b200){var _0x40e7a3={},_0x1843b2={},_0x824a4f={'count':0x0,'rows':[]};var _0x58b06f=_[_0x0a9e('0x2e')](db[_0x0a9e('0x2f')][_0x0a9e('0x30')],function(_0x1dbde2){return{'name':_0x1dbde2['fieldName'],'type':_0x1dbde2[_0x0a9e('0x31')]['key']};});_0x1843b2[_0x0a9e('0x32')]=_[_0x0a9e('0x2e')](_0x58b06f,_0x0a9e('0x2b'));_0x1843b2[_0x0a9e('0x33')]=_[_0x0a9e('0x34')](_0x5c877d['query']);_0x1843b2[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x1843b2[_0x0a9e('0x32')],_0x1843b2[_0x0a9e('0x33')]);_0x40e7a3[_0x0a9e('0x37')]=_[_0x0a9e('0x36')](_0x1843b2[_0x0a9e('0x32')],qs[_0x0a9e('0x38')](_0x5c877d['query'][_0x0a9e('0x38')]));_0x40e7a3['attributes']=_0x40e7a3[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x40e7a3[_0x0a9e('0x37')]:_0x1843b2[_0x0a9e('0x32')];if(!_0x5c877d['query'][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x40e7a3[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5c877d['query']['limit']);_0x40e7a3[_0x0a9e('0x1f')]=qs['offset'](_0x5c877d[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x40e7a3[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x5c877d['query'][_0x0a9e('0x3d')]);_0x40e7a3[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_['pick'](_0x5c877d[_0x0a9e('0x33')],_0x1843b2[_0x0a9e('0x35')]),_0x58b06f);if(_0x5c877d[_0x0a9e('0x33')]['filter']){_0x40e7a3['where']=_[_0x0a9e('0x3f')](_0x40e7a3[_0x0a9e('0x3e')],{'$or':_['map'](_0x58b06f,function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x31')]!==_0x0a9e('0x40')){var _0x148f55={};_0x148f55[_0x2b814e['name']]={'$like':'%'+_0x5c877d['query'][_0x0a9e('0x41')]+'%'};return _0x148f55;}})});}_0x40e7a3=_[_0x0a9e('0x3f')]({},_0x40e7a3,_0x5c877d['options']);var _0x183991={'where':_0x40e7a3[_0x0a9e('0x3e')]};return db[_0x0a9e('0x2f')]['count'](_0x183991)[_0x0a9e('0x25')](function(_0x2cfea9){_0x824a4f[_0x0a9e('0x1e')]=_0x2cfea9;if(_0x5c877d[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x40e7a3[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2f')][_0x0a9e('0x44')](_0x40e7a3);})[_0x0a9e('0x25')](function(_0x3da2cd){_0x824a4f[_0x0a9e('0x45')]=_0x3da2cd;return _0x824a4f;})[_0x0a9e('0x25')](respondWithFilteredResult(_0x15b200,_0x40e7a3))[_0x0a9e('0x46')](handleError(_0x15b200,null));};exports[_0x0a9e('0x47')]=function(_0x37f6cc,_0x4d04c8){var _0x52628e={'raw':!![],'where':{'id':_0x37f6cc[_0x0a9e('0x48')]['id']}},_0x473fdc={};_0x473fdc[_0x0a9e('0x32')]=_[_0x0a9e('0x34')](db[_0x0a9e('0x2f')][_0x0a9e('0x30')]);_0x473fdc[_0x0a9e('0x33')]=_[_0x0a9e('0x34')](_0x37f6cc[_0x0a9e('0x33')]);_0x473fdc[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x473fdc[_0x0a9e('0x32')],_0x473fdc['query']);_0x52628e[_0x0a9e('0x37')]=_[_0x0a9e('0x36')](_0x473fdc[_0x0a9e('0x32')],qs[_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x33')][_0x0a9e('0x38')]));_0x52628e[_0x0a9e('0x37')]=_0x52628e[_0x0a9e('0x37')]['length']?_0x52628e[_0x0a9e('0x37')]:_0x473fdc['model'];if(_0x37f6cc[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x52628e[_0x0a9e('0x43')]=[{'all':!![]}];}_0x52628e=_['merge']({},_0x52628e,_0x37f6cc[_0x0a9e('0x49')]);return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')](_0x52628e)[_0x0a9e('0x25')](handleEntityNotFound(_0x4d04c8,null))[_0x0a9e('0x25')](respondWithResult(_0x4d04c8,null))[_0x0a9e('0x46')](handleError(_0x4d04c8,null));};exports[_0x0a9e('0x4b')]=function(_0x5bbcde,_0x13f44d){return db[_0x0a9e('0x2f')][_0x0a9e('0x4b')](_0x5bbcde[_0x0a9e('0x4c')],{})[_0x0a9e('0x25')](function(_0x992c77){var _0x6054ee=_0x5bbcde[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'plain':!![]});if(!_0x6054ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6054ee[_0x0a9e('0x4f')]===_0x0a9e('0x4d')){var _0x4f7240=_0x992c77['get']({'plain':!![]});var _0x5ddf84=_0x0a9e('0x27');return db[_0x0a9e('0x50')][_0x0a9e('0x4a')]({'where':{'name':_0x5ddf84,'userProfileId':_0x6054ee[_0x0a9e('0x51')]},'raw':!![]})[_0x0a9e('0x25')](function(_0x30decb){if(_0x30decb&&_0x30decb[_0x0a9e('0x52')]===0x0){return db[_0x0a9e('0x28')]['create']({'name':_0x4f7240['name'],'resourceId':_0x4f7240['id'],'type':_0x30decb['name'],'sectionId':_0x30decb['id']},{})[_0x0a9e('0x25')](function(){return _0x992c77;});}else{return _0x992c77;}})[_0x0a9e('0x46')](function(_0x14d602){logger['error'](_0x0a9e('0x53'),_0x14d602);throw _0x14d602;});}return _0x992c77;})[_0x0a9e('0x25')](respondWithResult(_0x13f44d,0xc9))['catch'](handleError(_0x13f44d,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x4c')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x2ef381[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x25')](saveUpdates(_0x2ef381[_0x0a9e('0x4c')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x26')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x2f')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x25')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['describe']=function(_0x5df0ad,_0x2da03c){return db['MailQueue'][_0x0a9e('0x54')]()[_0x0a9e('0x25')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x46')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x55')]=function(_0x232830,_0x272738,_0xd10662){var _0x28d814={'raw':!![],'where':{}},_0x4e67ab={},_0x1c693e;return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x232830[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x25')](function(_0x5d86e9){if(_0x5d86e9){_0x1c693e=_0x5d86e9[_0x0a9e('0x4e')]({'plain':!![]});_0x4e67ab[_0x0a9e('0x32')]=_['keys'](db[_0x0a9e('0x57')]['rawAttributes']);_0x4e67ab[_0x0a9e('0x33')]=_['keys'](_0x232830['query']);_0x4e67ab['filters']=_[_0x0a9e('0x36')](_0x4e67ab['model'],_0x4e67ab[_0x0a9e('0x33')]);_0x28d814[_0x0a9e('0x37')]=_[_0x0a9e('0x36')](_0x4e67ab[_0x0a9e('0x32')],qs[_0x0a9e('0x38')](_0x232830[_0x0a9e('0x33')]['fields']));_0x28d814[_0x0a9e('0x37')]=_0x28d814['attributes'][_0x0a9e('0x39')]?_0x28d814[_0x0a9e('0x37')]:_0x4e67ab[_0x0a9e('0x32')];if(!_0x232830['query'][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x28d814[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x232830['query'][_0x0a9e('0x20')]);_0x28d814[_0x0a9e('0x1f')]=qs['offset'](_0x232830[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x28d814[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x232830[_0x0a9e('0x33')]['sort']);_0x28d814[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_[_0x0a9e('0x58')](_0x232830['query'],_0x4e67ab[_0x0a9e('0x35')]));_0x28d814['where']['MailQueueId']=_0x5d86e9['id'];if(_0x232830[_0x0a9e('0x33')][_0x0a9e('0x41')]){_0x28d814[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x28d814[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2e')](_0x28d814[_0x0a9e('0x37')],function(_0x54a37d){var _0x2d7205={};_0x2d7205[_0x54a37d]={'$like':'%'+_0x232830[_0x0a9e('0x33')][_0x0a9e('0x41')]+'%'};return _0x2d7205;})});}_0x28d814=_[_0x0a9e('0x3f')]({},_0x28d814,_0x232830[_0x0a9e('0x49')]);return db[_0x0a9e('0x57')][_0x0a9e('0x44')](_0x28d814);}})[_0x0a9e('0x25')](function(_0x2a28c0){if(_0x2a28c0){return db[_0x0a9e('0x59')]['findAndCountAll']({'where':{'id':_[_0x0a9e('0x2e')](_0x2a28c0,_0x0a9e('0x5a')),'role':_0x0a9e('0x5b')},'attributes':['id','name',_0x0a9e('0x5c'),_0x0a9e('0x5d'),'createdAt']});}})[_0x0a9e('0x25')](function(_0x56e31e){if(_0x56e31e){return{'count':_0x56e31e[_0x0a9e('0x1e')],'rows':_[_0x0a9e('0x2e')](_0x56e31e[_0x0a9e('0x45')],function(_0x4a43a8){return{'membername':_0x4a43a8['name'],'UserId':_0x4a43a8['id'],'queue_name':_0x1c693e['name'],'MailQueueId':_0x1c693e['id'],'interface':util[_0x0a9e('0x5e')](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x4a43a8[_0x0a9e('0x2b')]),'penalty':0x0,'paused':_0x4a43a8[_0x0a9e('0x5c')],'createdAt':_0x4a43a8[_0x0a9e('0x61')],'updatedAt':_0x4a43a8[_0x0a9e('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a9e('0x25')](respondWithFilteredResult(_0x272738,_0x28d814))['catch'](handleError(_0x272738,null));};exports[_0x0a9e('0x62')]=function(_0xcbc8b2,_0x12ccdb,_0x4a4fc7){var _0x2bdc44={};var _0x583b2e={};var _0x4437ff;var _0x44351d;return db['MailQueue'][_0x0a9e('0x56')]({'where':{'id':_0xcbc8b2[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x12ccdb,null))[_0x0a9e('0x25')](function(_0x542ece){if(_0x542ece){_0x4437ff=_0x542ece;_0x583b2e[_0x0a9e('0x32')]=_[_0x0a9e('0x34')](db[_0x0a9e('0x63')][_0x0a9e('0x30')]);_0x583b2e['query']=_[_0x0a9e('0x34')](_0xcbc8b2[_0x0a9e('0x33')]);_0x583b2e[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x583b2e['model'],_0x583b2e[_0x0a9e('0x33')]);_0x2bdc44[_0x0a9e('0x37')]=_[_0x0a9e('0x36')](_0x583b2e[_0x0a9e('0x32')],qs[_0x0a9e('0x38')](_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x38')]));_0x2bdc44[_0x0a9e('0x37')]=_0x2bdc44[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x2bdc44[_0x0a9e('0x37')]:_0x583b2e[_0x0a9e('0x32')];_0x2bdc44[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0xcbc8b2['query'][_0x0a9e('0x3d')]);_0x2bdc44[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_['pick'](_0xcbc8b2[_0x0a9e('0x33')],_0x583b2e[_0x0a9e('0x35')]));if(_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x41')]){_0x2bdc44['where']=_['merge'](_0x2bdc44[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2e')](_0x2bdc44['attributes'],function(_0x45108c){var _0x53a6a1={};_0x53a6a1[_0x45108c]={'$like':'%'+_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x41')]+'%'};return _0x53a6a1;})});}_0x2bdc44=_['merge']({},_0x2bdc44,_0xcbc8b2[_0x0a9e('0x49')]);return _0x4437ff[_0x0a9e('0x62')](_0x2bdc44);}})[_0x0a9e('0x25')](function(_0x42b959){if(_0x42b959){_0x44351d=_0x42b959[_0x0a9e('0x39')];if(!_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x3a')]('nolimit')){_0x2bdc44[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x20')]);_0x2bdc44['offset']=qs[_0x0a9e('0x1f')](_0xcbc8b2[_0x0a9e('0x33')]['offset']);}return _0x4437ff[_0x0a9e('0x62')](_0x2bdc44);}})['then'](function(_0x163710){if(_0x163710){return _0x163710?{'count':_0x44351d,'rows':_0x163710}:null;}})[_0x0a9e('0x25')](respondWithResult(_0x12ccdb,null))[_0x0a9e('0x46')](handleError(_0x12ccdb,null));};exports[_0x0a9e('0x64')]=function(_0x5af453,_0x51ccd7,_0x353384){var _0x2b9c01=_0x5af453[_0x0a9e('0x4c')]['ids'];return db[_0x0a9e('0x63')][_0x0a9e('0x44')]({'where':{'id':_0x2b9c01},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0a9e('0x2b'),'online','voicePause','interface'],'raw':!![]}]})[_0x0a9e('0x25')](function(_0xf3601c){if(_0xf3601c){var _0x9044fe=_[_0x0a9e('0x65')](_0xf3601c,function(_0x3c6dd6){var _0x2600de=_0x3c6dd6['get']({'plain':!![]});return _0x2600de[_0x0a9e('0x66')];});return db['MailQueue'][_0x0a9e('0x4a')]({'where':{'id':_0x5af453[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](function(_0x4566b0){return db['sequelize'][_0x0a9e('0x67')](function(_0x32f761){return _0x4566b0[_0x0a9e('0x64')](_0x2b9c01,{'transaction':_0x32f761})['then'](function(){return BPromise[_0x0a9e('0x68')](_0x9044fe,function(_0x21e592){return db[_0x0a9e('0x57')][_0x0a9e('0x69')]({'where':{'UserId':_0x21e592['id'],'MailQueueId':_0x5af453[_0x0a9e('0x48')]['id']},'transaction':_0x32f761});});})[_0x0a9e('0x25')](function(){_0x9044fe[_0x0a9e('0x6a')](function(_0x11ac43){socket['emit'](_0x0a9e('0x6b'),{'UserId':_0x11ac43['id'],'MailQueueId':_0x4566b0['id']});});});});});}})[_0x0a9e('0x25')](respondWithStatusCode(_0x51ccd7,null))['catch'](handleError(_0x51ccd7,null));};exports[_0x0a9e('0x6c')]=function(_0x982340,_0x3a1974,_0x5a26c8){return db[_0x0a9e('0x63')]['findAll']({'where':{'id':_0x982340[_0x0a9e('0x33')][_0x0a9e('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x59')],'as':_0x0a9e('0x66'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x25')](handleEntityNotFound(_0x3a1974,null))[_0x0a9e('0x25')](function(_0x16a039){var _0x3a9a85=_['map'](_0x16a039,'id');var _0x329d88=[];var _0x31d25a=[];var _0x17f692=squel[_0x0a9e('0x6e')]();_0x17f692[_0x0a9e('0x6f')](_0x0a9e('0x70'))[_0x0a9e('0x71')](_0x0a9e('0x72'),'tq')[_0x0a9e('0x73')](_0x0a9e('0x74'),'ut',_0x0a9e('0x75'))[_0x0a9e('0x3e')](_0x0a9e('0x76'),_0x982340['params']['id']);for(var _0xc81b64=0x0;_0xc81b64<_0x16a039[_0x0a9e('0x39')];_0xc81b64+=0x1){let _0x12843d=_0x16a039[_0xc81b64];for(var _0x2ed526=0x0;_0x2ed526<_0x12843d[_0x0a9e('0x66')]['length'];_0x2ed526+=0x1){let _0x3afc8c=_0x12843d[_0x0a9e('0x66')][_0x2ed526];var _0x5ce99d=_0x17f692[_0x0a9e('0x77')]();_0x5ce99d['where'](_0x0a9e('0x78'),_0x3afc8c['id']);_0x31d25a[_0x0a9e('0x79')](db[_0x0a9e('0x7a')][_0x0a9e('0x33')](_0x5ce99d['toString'](),{'type':db[_0x0a9e('0x7a')]['QueryTypes'][_0x0a9e('0x7b')]})[_0x0a9e('0x25')](function(_0x5e5b89){if(_0x5e5b89[_0x0a9e('0x39')]===0x1){return _0x3afc8c['id'];}else{var _0x63c9f7=_[_0x0a9e('0x7c')](_['map'](_0x5e5b89,'TeamId'),function(_0x1b82b7){return _[_0x0a9e('0x7d')](_0x3a9a85,_0x1b82b7);});if(_0x63c9f7){return _0x3afc8c['id'];}}}));}}return BPromise[_0x0a9e('0x7e')](_0x31d25a)[_0x0a9e('0x25')](function(_0x3f2f40){_0x329d88=_(_0x329d88)[_0x0a9e('0x7f')](_0x3f2f40)[_0x0a9e('0x80')]()[_0x0a9e('0x81')]();return db[_0x0a9e('0x2f')]['find']({'where':{'id':_0x982340[_0x0a9e('0x48')]['id']}})['then'](function(_0x287324){return db[_0x0a9e('0x7a')][_0x0a9e('0x67')](function(_0x28ce92){return _0x287324[_0x0a9e('0x6c')](_0x982340['query'][_0x0a9e('0x6d')],{'transaction':_0x28ce92})[_0x0a9e('0x25')](function(){if(!_[_0x0a9e('0x82')](_0x329d88)){return _0x287324[_0x0a9e('0x83')](_0x329d88,{'transaction':_0x28ce92});}})[_0x0a9e('0x25')](function(){_0x329d88['forEach'](function(_0x4f074c){socket[_0x0a9e('0x84')]('userMailQueue:remove',{'UserId':_0x4f074c,'MailQueueId':_0x287324['id']});});});});});});})[_0x0a9e('0x25')](respondWithStatusCode(_0x3a1974,null))[_0x0a9e('0x46')](handleError(_0x3a1974,null));};exports[_0x0a9e('0x85')]=function(_0x16313e,_0x2ad54b,_0x213e5d){return db['MailQueue']['find']({'where':{'id':_0x16313e[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2ad54b,null))[_0x0a9e('0x25')](function(_0x5c689c){if(_0x5c689c){return _0x5c689c[_0x0a9e('0x85')](_0x16313e['body']['ids'],_[_0x0a9e('0x86')](_0x16313e[_0x0a9e('0x4c')],['ids','id'])||{})[_0x0a9e('0x87')](function(_0x17cb30){for(var _0x15c6b9=0x0;_0x15c6b9<_0x16313e[_0x0a9e('0x4c')][_0x0a9e('0x6d')]['length'];_0x15c6b9+=0x1){socket['emit'](_0x0a9e('0x6b'),{'UserId':_0x16313e[_0x0a9e('0x4c')][_0x0a9e('0x6d')][_0x15c6b9],'MailQueueId':_0x16313e[_0x0a9e('0x48')]['id']});}return _0x17cb30;});}})[_0x0a9e('0x25')](respondWithResult(_0x2ad54b,null))['catch'](handleError(_0x2ad54b,null));};exports[_0x0a9e('0x83')]=function(_0xadce3d,_0x5416a9,_0x3c313d){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0xadce3d[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x5416a9,null))[_0x0a9e('0x25')](function(_0x1ef1b0){if(_0x1ef1b0){return _0x1ef1b0[_0x0a9e('0x83')](_0xadce3d[_0x0a9e('0x33')][_0x0a9e('0x6d')])['then'](function(){if(_[_0x0a9e('0x88')](_0xadce3d[_0x0a9e('0x33')][_0x0a9e('0x6d')])){for(var _0x1c4232=0x0;_0x1c4232<_0xadce3d[_0x0a9e('0x33')]['ids']['length'];_0x1c4232+=0x1){socket[_0x0a9e('0x84')](_0x0a9e('0x89'),{'UserId':Number(_0xadce3d[_0x0a9e('0x33')][_0x0a9e('0x6d')][_0x1c4232]),'MailQueueId':Number(_0xadce3d[_0x0a9e('0x48')]['id'])});}}else{socket['emit'](_0x0a9e('0x89'),{'UserId':Number(_0xadce3d[_0x0a9e('0x33')][_0x0a9e('0x6d')]),'MailQueueId':Number(_0xadce3d['params']['id'])});}});}})[_0x0a9e('0x25')](respondWithStatusCode(_0x5416a9,null))['catch'](handleError(_0x5416a9,null));};exports[_0x0a9e('0x8a')]=function(_0x4799d4,_0x25b745,_0x42b833){var _0xe339b1={};var _0x5c500c={};var _0xc9529d;var _0x5ed560;return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x4799d4[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x25b745,null))[_0x0a9e('0x25')](function(_0x1bee04){if(_0x1bee04){_0xc9529d=_0x1bee04;_0x5c500c[_0x0a9e('0x32')]=_[_0x0a9e('0x34')](db[_0x0a9e('0x59')][_0x0a9e('0x30')]);_0x5c500c[_0x0a9e('0x33')]=_[_0x0a9e('0x34')](_0x4799d4[_0x0a9e('0x33')]);_0x5c500c[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x5c500c[_0x0a9e('0x32')],_0x5c500c['query']);_0xe339b1['attributes']=_[_0x0a9e('0x36')](_0x5c500c['model'],qs[_0x0a9e('0x38')](_0x4799d4[_0x0a9e('0x33')]['fields']));_0xe339b1[_0x0a9e('0x37')]=_0xe339b1[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0xe339b1[_0x0a9e('0x37')]:_0x5c500c['model'];_0xe339b1[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x4799d4[_0x0a9e('0x33')][_0x0a9e('0x3d')]);_0xe339b1['where']=qs[_0x0a9e('0x35')](_[_0x0a9e('0x58')](_0x4799d4[_0x0a9e('0x33')],_0x5c500c['filters']));if(_0x4799d4[_0x0a9e('0x33')][_0x0a9e('0x41')]){_0xe339b1[_0x0a9e('0x3e')]=_['merge'](_0xe339b1[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2e')](_0xe339b1[_0x0a9e('0x37')],function(_0x1a7f58){var _0x2394d3={};_0x2394d3[_0x1a7f58]={'$like':'%'+_0x4799d4['query'][_0x0a9e('0x41')]+'%'};return _0x2394d3;})});}_0xe339b1=_[_0x0a9e('0x3f')]({},_0xe339b1,_0x4799d4['options']);return _0xc9529d[_0x0a9e('0x8a')](_0xe339b1);}})[_0x0a9e('0x25')](function(_0x1f6f1c){if(_0x1f6f1c){_0x5ed560=_0x1f6f1c['length'];if(!_0x4799d4['query']['hasOwnProperty'](_0x0a9e('0x3b'))){_0xe339b1[_0x0a9e('0x20')]=qs['limit'](_0x4799d4[_0x0a9e('0x33')][_0x0a9e('0x20')]);_0xe339b1[_0x0a9e('0x1f')]=qs['offset'](_0x4799d4[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}return _0xc9529d[_0x0a9e('0x8a')](_0xe339b1);}})[_0x0a9e('0x25')](function(_0x46956b){if(_0x46956b){return _0x46956b?{'count':_0x5ed560,'rows':_0x46956b}:null;}})[_0x0a9e('0x25')](respondWithResult(_0x25b745,null))[_0x0a9e('0x46')](handleError(_0x25b745,null));}; \ No newline at end of file +var _0xa9e0=['all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','json','count','offset','limit','status','set','apply','save','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','pick','User','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','flatMap','Agents','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','includes'];(function(_0x475421,_0x49f93b){var _0xc17842=function(_0x4e6c75){while(--_0x4e6c75){_0x475421['push'](_0x475421['shift']());}};_0xc17842(++_0x49f93b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=_0x478723[_0x0a9e('0x1e')],_0x205fd6=_0x459eb1[_0x0a9e('0x1f')],_0x31b1ca=_0x459eb1[_0x0a9e('0x1f')]+_0x459eb1[_0x0a9e('0x20')],_0x2eb11f;if(_0x31b1ca>=_0x106033){_0x31b1ca=_0x106033;_0x2eb11f=0xc8;}else{_0x2eb11f=0xce;}_0x5a0a06[_0x0a9e('0x21')](_0x2eb11f);return _0x5a0a06[_0x0a9e('0x22')]('Content-Range',_0x205fd6+'-'+_0x31b1ca+'/'+_0x106033)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x155cce){return function(_0x53682f){try{jsonpatch[_0x0a9e('0x23')](_0x53682f,_0x155cce,!![]);}catch(_0x5a09ef){return BPromise['reject'](_0x5a09ef);}return _0x53682f[_0x0a9e('0x24')]();};}function saveUpdates(_0x432e56,_0x38e7c4){return function(_0x30bae6){if(_0x30bae6){return _0x30bae6['update'](_0x432e56)[_0x0a9e('0x25')](function(_0x2fb0e4){return _0x2fb0e4;});}return null;};}function removeEntity(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')]()[_0x0a9e('0x25')](function(){var _0x5ea472=_0x370d86['get']({'plain':!![]});var _0x197ec0=_0x0a9e('0x27');return db[_0x0a9e('0x28')][_0x0a9e('0x26')]({'where':{'type':_0x197ec0,'resourceId':_0x5ea472['id']}})['then'](function(){return _0x370d86;});})[_0x0a9e('0x25')](function(){_0x3b45bc['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x5bfb33,_0x1dc186){return function(_0x34dc65){if(!_0x34dc65){_0x5bfb33[_0x0a9e('0x1b')](0x194);}return _0x34dc65;};}function handleError(_0x14433c,_0x140511){_0x140511=_0x140511||0x1f4;return function(_0x1538a4){logger[_0x0a9e('0x29')](_0x1538a4[_0x0a9e('0x2a')]);if(_0x1538a4['name']){delete _0x1538a4[_0x0a9e('0x2b')];}_0x14433c[_0x0a9e('0x21')](_0x140511)[_0x0a9e('0x2c')](_0x1538a4);};}exports[_0x0a9e('0x2d')]=function(_0x5c877d,_0x15b200){var _0x40e7a3={},_0x1843b2={},_0x824a4f={'count':0x0,'rows':[]};var _0x58b06f=_[_0x0a9e('0x2e')](db[_0x0a9e('0x2f')][_0x0a9e('0x30')],function(_0x1dbde2){return{'name':_0x1dbde2['fieldName'],'type':_0x1dbde2[_0x0a9e('0x31')]['key']};});_0x1843b2[_0x0a9e('0x32')]=_[_0x0a9e('0x2e')](_0x58b06f,_0x0a9e('0x2b'));_0x1843b2[_0x0a9e('0x33')]=_[_0x0a9e('0x34')](_0x5c877d['query']);_0x1843b2[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x1843b2[_0x0a9e('0x32')],_0x1843b2[_0x0a9e('0x33')]);_0x40e7a3[_0x0a9e('0x37')]=_[_0x0a9e('0x36')](_0x1843b2[_0x0a9e('0x32')],qs[_0x0a9e('0x38')](_0x5c877d['query'][_0x0a9e('0x38')]));_0x40e7a3['attributes']=_0x40e7a3[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x40e7a3[_0x0a9e('0x37')]:_0x1843b2[_0x0a9e('0x32')];if(!_0x5c877d['query'][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x40e7a3[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5c877d['query']['limit']);_0x40e7a3[_0x0a9e('0x1f')]=qs['offset'](_0x5c877d[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x40e7a3[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x5c877d['query'][_0x0a9e('0x3d')]);_0x40e7a3[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_['pick'](_0x5c877d[_0x0a9e('0x33')],_0x1843b2[_0x0a9e('0x35')]),_0x58b06f);if(_0x5c877d[_0x0a9e('0x33')]['filter']){_0x40e7a3['where']=_[_0x0a9e('0x3f')](_0x40e7a3[_0x0a9e('0x3e')],{'$or':_['map'](_0x58b06f,function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x31')]!==_0x0a9e('0x40')){var _0x148f55={};_0x148f55[_0x2b814e['name']]={'$like':'%'+_0x5c877d['query'][_0x0a9e('0x41')]+'%'};return _0x148f55;}})});}_0x40e7a3=_[_0x0a9e('0x3f')]({},_0x40e7a3,_0x5c877d['options']);var _0x183991={'where':_0x40e7a3[_0x0a9e('0x3e')]};return db[_0x0a9e('0x2f')]['count'](_0x183991)[_0x0a9e('0x25')](function(_0x2cfea9){_0x824a4f[_0x0a9e('0x1e')]=_0x2cfea9;if(_0x5c877d[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x40e7a3[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2f')][_0x0a9e('0x44')](_0x40e7a3);})[_0x0a9e('0x25')](function(_0x3da2cd){_0x824a4f[_0x0a9e('0x45')]=_0x3da2cd;return _0x824a4f;})[_0x0a9e('0x25')](respondWithFilteredResult(_0x15b200,_0x40e7a3))[_0x0a9e('0x46')](handleError(_0x15b200,null));};exports[_0x0a9e('0x47')]=function(_0x37f6cc,_0x4d04c8){var _0x52628e={'raw':!![],'where':{'id':_0x37f6cc[_0x0a9e('0x48')]['id']}},_0x473fdc={};_0x473fdc[_0x0a9e('0x32')]=_[_0x0a9e('0x34')](db[_0x0a9e('0x2f')][_0x0a9e('0x30')]);_0x473fdc[_0x0a9e('0x33')]=_[_0x0a9e('0x34')](_0x37f6cc[_0x0a9e('0x33')]);_0x473fdc[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x473fdc[_0x0a9e('0x32')],_0x473fdc['query']);_0x52628e[_0x0a9e('0x37')]=_[_0x0a9e('0x36')](_0x473fdc[_0x0a9e('0x32')],qs[_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x33')][_0x0a9e('0x38')]));_0x52628e[_0x0a9e('0x37')]=_0x52628e[_0x0a9e('0x37')]['length']?_0x52628e[_0x0a9e('0x37')]:_0x473fdc['model'];if(_0x37f6cc[_0x0a9e('0x33')][_0x0a9e('0x42')]){_0x52628e[_0x0a9e('0x43')]=[{'all':!![]}];}_0x52628e=_['merge']({},_0x52628e,_0x37f6cc[_0x0a9e('0x49')]);return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')](_0x52628e)[_0x0a9e('0x25')](handleEntityNotFound(_0x4d04c8,null))[_0x0a9e('0x25')](respondWithResult(_0x4d04c8,null))[_0x0a9e('0x46')](handleError(_0x4d04c8,null));};exports[_0x0a9e('0x4b')]=function(_0x5bbcde,_0x13f44d){return db[_0x0a9e('0x2f')][_0x0a9e('0x4b')](_0x5bbcde[_0x0a9e('0x4c')],{})[_0x0a9e('0x25')](function(_0x992c77){var _0x6054ee=_0x5bbcde[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'plain':!![]});if(!_0x6054ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6054ee[_0x0a9e('0x4f')]===_0x0a9e('0x4d')){var _0x4f7240=_0x992c77['get']({'plain':!![]});var _0x5ddf84=_0x0a9e('0x27');return db[_0x0a9e('0x50')][_0x0a9e('0x4a')]({'where':{'name':_0x5ddf84,'userProfileId':_0x6054ee[_0x0a9e('0x51')]},'raw':!![]})[_0x0a9e('0x25')](function(_0x30decb){if(_0x30decb&&_0x30decb[_0x0a9e('0x52')]===0x0){return db[_0x0a9e('0x28')]['create']({'name':_0x4f7240['name'],'resourceId':_0x4f7240['id'],'type':_0x30decb['name'],'sectionId':_0x30decb['id']},{})[_0x0a9e('0x25')](function(){return _0x992c77;});}else{return _0x992c77;}})[_0x0a9e('0x46')](function(_0x14d602){logger['error'](_0x0a9e('0x53'),_0x14d602);throw _0x14d602;});}return _0x992c77;})[_0x0a9e('0x25')](respondWithResult(_0x13f44d,0xc9))['catch'](handleError(_0x13f44d,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x4c')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0x2ef381[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x25')](saveUpdates(_0x2ef381[_0x0a9e('0x4c')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x26')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x2f')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x25')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['describe']=function(_0x5df0ad,_0x2da03c){return db['MailQueue'][_0x0a9e('0x54')]()[_0x0a9e('0x25')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x46')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x55')]=function(_0x232830,_0x272738,_0xd10662){var _0x28d814={'raw':!![],'where':{}},_0x4e67ab={},_0x1c693e;return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x232830[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x25')](function(_0x5d86e9){if(_0x5d86e9){_0x1c693e=_0x5d86e9[_0x0a9e('0x4e')]({'plain':!![]});_0x4e67ab[_0x0a9e('0x32')]=_['keys'](db[_0x0a9e('0x57')]['rawAttributes']);_0x4e67ab[_0x0a9e('0x33')]=_['keys'](_0x232830['query']);_0x4e67ab['filters']=_[_0x0a9e('0x36')](_0x4e67ab['model'],_0x4e67ab[_0x0a9e('0x33')]);_0x28d814[_0x0a9e('0x37')]=_[_0x0a9e('0x36')](_0x4e67ab[_0x0a9e('0x32')],qs[_0x0a9e('0x38')](_0x232830[_0x0a9e('0x33')]['fields']));_0x28d814[_0x0a9e('0x37')]=_0x28d814['attributes'][_0x0a9e('0x39')]?_0x28d814[_0x0a9e('0x37')]:_0x4e67ab[_0x0a9e('0x32')];if(!_0x232830['query'][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x28d814[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x232830['query'][_0x0a9e('0x20')]);_0x28d814[_0x0a9e('0x1f')]=qs['offset'](_0x232830[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}_0x28d814[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x232830[_0x0a9e('0x33')]['sort']);_0x28d814[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_[_0x0a9e('0x58')](_0x232830['query'],_0x4e67ab[_0x0a9e('0x35')]));_0x28d814['where']['MailQueueId']=_0x5d86e9['id'];if(_0x232830[_0x0a9e('0x33')][_0x0a9e('0x41')]){_0x28d814[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x28d814[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2e')](_0x28d814[_0x0a9e('0x37')],function(_0x54a37d){var _0x2d7205={};_0x2d7205[_0x54a37d]={'$like':'%'+_0x232830[_0x0a9e('0x33')][_0x0a9e('0x41')]+'%'};return _0x2d7205;})});}_0x28d814=_[_0x0a9e('0x3f')]({},_0x28d814,_0x232830[_0x0a9e('0x49')]);return db[_0x0a9e('0x57')][_0x0a9e('0x44')](_0x28d814);}})[_0x0a9e('0x25')](function(_0x2a28c0){if(_0x2a28c0){return db[_0x0a9e('0x59')]['findAndCountAll']({'where':{'id':_[_0x0a9e('0x2e')](_0x2a28c0,_0x0a9e('0x5a')),'role':_0x0a9e('0x5b')},'attributes':['id','name',_0x0a9e('0x5c'),_0x0a9e('0x5d'),'createdAt']});}})[_0x0a9e('0x25')](function(_0x56e31e){if(_0x56e31e){return{'count':_0x56e31e[_0x0a9e('0x1e')],'rows':_[_0x0a9e('0x2e')](_0x56e31e[_0x0a9e('0x45')],function(_0x4a43a8){return{'membername':_0x4a43a8['name'],'UserId':_0x4a43a8['id'],'queue_name':_0x1c693e['name'],'MailQueueId':_0x1c693e['id'],'interface':util[_0x0a9e('0x5e')](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x4a43a8[_0x0a9e('0x2b')]),'penalty':0x0,'paused':_0x4a43a8[_0x0a9e('0x5c')],'createdAt':_0x4a43a8[_0x0a9e('0x61')],'updatedAt':_0x4a43a8[_0x0a9e('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a9e('0x25')](respondWithFilteredResult(_0x272738,_0x28d814))['catch'](handleError(_0x272738,null));};exports[_0x0a9e('0x62')]=function(_0xcbc8b2,_0x12ccdb,_0x4a4fc7){var _0x2bdc44={};var _0x583b2e={};var _0x4437ff;var _0x44351d;return db['MailQueue'][_0x0a9e('0x56')]({'where':{'id':_0xcbc8b2[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x12ccdb,null))[_0x0a9e('0x25')](function(_0x542ece){if(_0x542ece){_0x4437ff=_0x542ece;_0x583b2e[_0x0a9e('0x32')]=_[_0x0a9e('0x34')](db[_0x0a9e('0x63')][_0x0a9e('0x30')]);_0x583b2e['query']=_[_0x0a9e('0x34')](_0xcbc8b2[_0x0a9e('0x33')]);_0x583b2e[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x583b2e['model'],_0x583b2e[_0x0a9e('0x33')]);_0x2bdc44[_0x0a9e('0x37')]=_[_0x0a9e('0x36')](_0x583b2e[_0x0a9e('0x32')],qs[_0x0a9e('0x38')](_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x38')]));_0x2bdc44[_0x0a9e('0x37')]=_0x2bdc44[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x2bdc44[_0x0a9e('0x37')]:_0x583b2e[_0x0a9e('0x32')];_0x2bdc44[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0xcbc8b2['query'][_0x0a9e('0x3d')]);_0x2bdc44[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_['pick'](_0xcbc8b2[_0x0a9e('0x33')],_0x583b2e[_0x0a9e('0x35')]));if(_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x41')]){_0x2bdc44['where']=_['merge'](_0x2bdc44[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2e')](_0x2bdc44['attributes'],function(_0x45108c){var _0x53a6a1={};_0x53a6a1[_0x45108c]={'$like':'%'+_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x41')]+'%'};return _0x53a6a1;})});}_0x2bdc44=_['merge']({},_0x2bdc44,_0xcbc8b2[_0x0a9e('0x49')]);return _0x4437ff[_0x0a9e('0x62')](_0x2bdc44);}})[_0x0a9e('0x25')](function(_0x42b959){if(_0x42b959){_0x44351d=_0x42b959[_0x0a9e('0x39')];if(!_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x3a')]('nolimit')){_0x2bdc44[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0xcbc8b2[_0x0a9e('0x33')][_0x0a9e('0x20')]);_0x2bdc44['offset']=qs[_0x0a9e('0x1f')](_0xcbc8b2[_0x0a9e('0x33')]['offset']);}return _0x4437ff[_0x0a9e('0x62')](_0x2bdc44);}})['then'](function(_0x163710){if(_0x163710){return _0x163710?{'count':_0x44351d,'rows':_0x163710}:null;}})[_0x0a9e('0x25')](respondWithResult(_0x12ccdb,null))[_0x0a9e('0x46')](handleError(_0x12ccdb,null));};exports[_0x0a9e('0x64')]=function(_0x5af453,_0x51ccd7,_0x353384){var _0x2b9c01=_0x5af453[_0x0a9e('0x4c')]['ids'];return db[_0x0a9e('0x63')][_0x0a9e('0x44')]({'where':{'id':_0x2b9c01},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0a9e('0x2b'),'online','voicePause','interface'],'raw':!![]}]})[_0x0a9e('0x25')](function(_0xf3601c){if(_0xf3601c){var _0x9044fe=_[_0x0a9e('0x65')](_0xf3601c,function(_0x3c6dd6){var _0x2600de=_0x3c6dd6['get']({'plain':!![]});return _0x2600de[_0x0a9e('0x66')];});return db['MailQueue'][_0x0a9e('0x4a')]({'where':{'id':_0x5af453[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](function(_0x4566b0){return db['sequelize'][_0x0a9e('0x67')](function(_0x32f761){return _0x4566b0[_0x0a9e('0x64')](_0x2b9c01,{'transaction':_0x32f761})['then'](function(){return BPromise[_0x0a9e('0x68')](_0x9044fe,function(_0x21e592){return db[_0x0a9e('0x57')][_0x0a9e('0x69')]({'where':{'UserId':_0x21e592['id'],'MailQueueId':_0x5af453[_0x0a9e('0x48')]['id']},'transaction':_0x32f761});});})[_0x0a9e('0x25')](function(){_0x9044fe[_0x0a9e('0x6a')](function(_0x11ac43){socket['emit'](_0x0a9e('0x6b'),{'UserId':_0x11ac43['id'],'MailQueueId':_0x4566b0['id']});});});});});}})[_0x0a9e('0x25')](respondWithStatusCode(_0x51ccd7,null))['catch'](handleError(_0x51ccd7,null));};exports[_0x0a9e('0x6c')]=function(_0x982340,_0x3a1974,_0x5a26c8){return db[_0x0a9e('0x63')]['findAll']({'where':{'id':_0x982340[_0x0a9e('0x33')][_0x0a9e('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x59')],'as':_0x0a9e('0x66'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x25')](handleEntityNotFound(_0x3a1974,null))[_0x0a9e('0x25')](function(_0x16a039){var _0x3a9a85=_['map'](_0x16a039,'id');var _0x329d88=[];var _0x31d25a=[];var _0x17f692=squel[_0x0a9e('0x6e')]();_0x17f692[_0x0a9e('0x6f')](_0x0a9e('0x70'))[_0x0a9e('0x71')](_0x0a9e('0x72'),'tq')[_0x0a9e('0x73')](_0x0a9e('0x74'),'ut',_0x0a9e('0x75'))[_0x0a9e('0x3e')](_0x0a9e('0x76'),_0x982340['params']['id']);for(var _0xc81b64=0x0;_0xc81b64<_0x16a039[_0x0a9e('0x39')];_0xc81b64+=0x1){let _0x12843d=_0x16a039[_0xc81b64];for(var _0x2ed526=0x0;_0x2ed526<_0x12843d[_0x0a9e('0x66')]['length'];_0x2ed526+=0x1){let _0x3afc8c=_0x12843d[_0x0a9e('0x66')][_0x2ed526];var _0x5ce99d=_0x17f692[_0x0a9e('0x77')]();_0x5ce99d['where'](_0x0a9e('0x78'),_0x3afc8c['id']);_0x31d25a[_0x0a9e('0x79')](db[_0x0a9e('0x7a')][_0x0a9e('0x33')](_0x5ce99d['toString'](),{'type':db[_0x0a9e('0x7a')]['QueryTypes'][_0x0a9e('0x7b')]})[_0x0a9e('0x25')](function(_0x5e5b89){if(_0x5e5b89[_0x0a9e('0x39')]===0x1){return _0x3afc8c['id'];}else{var _0x63c9f7=_[_0x0a9e('0x7c')](_['map'](_0x5e5b89,'TeamId'),function(_0x1b82b7){return _[_0x0a9e('0x7d')](_0x3a9a85,_0x1b82b7);});if(_0x63c9f7){return _0x3afc8c['id'];}}}));}}return BPromise[_0x0a9e('0x7e')](_0x31d25a)[_0x0a9e('0x25')](function(_0x3f2f40){_0x329d88=_(_0x329d88)[_0x0a9e('0x7f')](_0x3f2f40)[_0x0a9e('0x80')]()[_0x0a9e('0x81')]();return db[_0x0a9e('0x2f')]['find']({'where':{'id':_0x982340[_0x0a9e('0x48')]['id']}})['then'](function(_0x287324){return db[_0x0a9e('0x7a')][_0x0a9e('0x67')](function(_0x28ce92){return _0x287324[_0x0a9e('0x6c')](_0x982340['query'][_0x0a9e('0x6d')],{'transaction':_0x28ce92})[_0x0a9e('0x25')](function(){if(!_[_0x0a9e('0x82')](_0x329d88)){return _0x287324[_0x0a9e('0x83')](_0x329d88,{'transaction':_0x28ce92});}})[_0x0a9e('0x25')](function(){_0x329d88['forEach'](function(_0x4f074c){socket[_0x0a9e('0x84')]('userMailQueue:remove',{'UserId':_0x4f074c,'MailQueueId':_0x287324['id']});});});});});});})[_0x0a9e('0x25')](respondWithStatusCode(_0x3a1974,null))[_0x0a9e('0x46')](handleError(_0x3a1974,null));};exports[_0x0a9e('0x85')]=function(_0x16313e,_0x2ad54b,_0x213e5d){return db['MailQueue']['find']({'where':{'id':_0x16313e[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2ad54b,null))[_0x0a9e('0x25')](function(_0x5c689c){if(_0x5c689c){return _0x5c689c[_0x0a9e('0x85')](_0x16313e['body']['ids'],_[_0x0a9e('0x86')](_0x16313e[_0x0a9e('0x4c')],['ids','id'])||{})[_0x0a9e('0x87')](function(_0x17cb30){for(var _0x15c6b9=0x0;_0x15c6b9<_0x16313e[_0x0a9e('0x4c')][_0x0a9e('0x6d')]['length'];_0x15c6b9+=0x1){socket['emit'](_0x0a9e('0x6b'),{'UserId':_0x16313e[_0x0a9e('0x4c')][_0x0a9e('0x6d')][_0x15c6b9],'MailQueueId':_0x16313e[_0x0a9e('0x48')]['id']});}return _0x17cb30;});}})[_0x0a9e('0x25')](respondWithResult(_0x2ad54b,null))['catch'](handleError(_0x2ad54b,null));};exports[_0x0a9e('0x83')]=function(_0xadce3d,_0x5416a9,_0x3c313d){return db[_0x0a9e('0x2f')][_0x0a9e('0x4a')]({'where':{'id':_0xadce3d[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x5416a9,null))[_0x0a9e('0x25')](function(_0x1ef1b0){if(_0x1ef1b0){return _0x1ef1b0[_0x0a9e('0x83')](_0xadce3d[_0x0a9e('0x33')][_0x0a9e('0x6d')])['then'](function(){if(_[_0x0a9e('0x88')](_0xadce3d[_0x0a9e('0x33')][_0x0a9e('0x6d')])){for(var _0x1c4232=0x0;_0x1c4232<_0xadce3d[_0x0a9e('0x33')]['ids']['length'];_0x1c4232+=0x1){socket[_0x0a9e('0x84')](_0x0a9e('0x89'),{'UserId':Number(_0xadce3d[_0x0a9e('0x33')][_0x0a9e('0x6d')][_0x1c4232]),'MailQueueId':Number(_0xadce3d[_0x0a9e('0x48')]['id'])});}}else{socket['emit'](_0x0a9e('0x89'),{'UserId':Number(_0xadce3d[_0x0a9e('0x33')][_0x0a9e('0x6d')]),'MailQueueId':Number(_0xadce3d['params']['id'])});}});}})[_0x0a9e('0x25')](respondWithStatusCode(_0x5416a9,null))['catch'](handleError(_0x5416a9,null));};exports[_0x0a9e('0x8a')]=function(_0x4799d4,_0x25b745,_0x42b833){var _0xe339b1={};var _0x5c500c={};var _0xc9529d;var _0x5ed560;return db[_0x0a9e('0x2f')][_0x0a9e('0x56')]({'where':{'id':_0x4799d4[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x25b745,null))[_0x0a9e('0x25')](function(_0x1bee04){if(_0x1bee04){_0xc9529d=_0x1bee04;_0x5c500c[_0x0a9e('0x32')]=_[_0x0a9e('0x34')](db[_0x0a9e('0x59')][_0x0a9e('0x30')]);_0x5c500c[_0x0a9e('0x33')]=_[_0x0a9e('0x34')](_0x4799d4[_0x0a9e('0x33')]);_0x5c500c[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x5c500c[_0x0a9e('0x32')],_0x5c500c['query']);_0xe339b1['attributes']=_[_0x0a9e('0x36')](_0x5c500c['model'],qs[_0x0a9e('0x38')](_0x4799d4[_0x0a9e('0x33')]['fields']));_0xe339b1[_0x0a9e('0x37')]=_0xe339b1[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0xe339b1[_0x0a9e('0x37')]:_0x5c500c['model'];_0xe339b1[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x4799d4[_0x0a9e('0x33')][_0x0a9e('0x3d')]);_0xe339b1['where']=qs[_0x0a9e('0x35')](_[_0x0a9e('0x58')](_0x4799d4[_0x0a9e('0x33')],_0x5c500c['filters']));if(_0x4799d4[_0x0a9e('0x33')][_0x0a9e('0x41')]){_0xe339b1[_0x0a9e('0x3e')]=_['merge'](_0xe339b1[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2e')](_0xe339b1[_0x0a9e('0x37')],function(_0x1a7f58){var _0x2394d3={};_0x2394d3[_0x1a7f58]={'$like':'%'+_0x4799d4['query'][_0x0a9e('0x41')]+'%'};return _0x2394d3;})});}_0xe339b1=_[_0x0a9e('0x3f')]({},_0xe339b1,_0x4799d4['options']);return _0xc9529d[_0x0a9e('0x8a')](_0xe339b1);}})[_0x0a9e('0x25')](function(_0x1f6f1c){if(_0x1f6f1c){_0x5ed560=_0x1f6f1c['length'];if(!_0x4799d4['query']['hasOwnProperty'](_0x0a9e('0x3b'))){_0xe339b1[_0x0a9e('0x20')]=qs['limit'](_0x4799d4[_0x0a9e('0x33')][_0x0a9e('0x20')]);_0xe339b1[_0x0a9e('0x1f')]=qs['offset'](_0x4799d4[_0x0a9e('0x33')][_0x0a9e('0x1f')]);}return _0xc9529d[_0x0a9e('0x8a')](_0xe339b1);}})[_0x0a9e('0x25')](function(_0x46956b){if(_0x46956b){return _0x46956b?{'count':_0x5ed560,'rows':_0x46956b}:null;}})[_0x0a9e('0x25')](respondWithResult(_0x25b745,null))[_0x0a9e('0x46')](handleError(_0x25b745,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 8bb6b6a..2490885 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 _0x1e19=['emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove'];(function(_0x467374,_0x368744){var _0x5b7738=function(_0x560568){while(--_0x560568){_0x467374['push'](_0x467374['shift']());}};_0x5b7738(++_0x368744);}(_0x1e19,0x1e3));var _0x91e1=function(_0x5daade,_0x3d79b1){_0x5daade=_0x5daade-0x0;var _0x2c5cb5=_0x1e19[_0x5daade];return _0x2c5cb5;};'use strict';var EventEmitter=require(_0x91e1('0x0'));var MailQueue=require(_0x91e1('0x1'))['db'][_0x91e1('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x91e1('0x3')](0x0);var events={'afterCreate':_0x91e1('0x4'),'afterUpdate':_0x91e1('0x5'),'afterDestroy':_0x91e1('0x6')};function emitEvent(_0x42a151){return function(_0x33fa61,_0x4103ae,_0x1f6cb9){MailQueueEvents[_0x91e1('0x7')](_0x42a151+':'+_0x33fa61['id'],_0x33fa61);MailQueueEvents[_0x91e1('0x7')](_0x42a151,_0x33fa61);_0x1f6cb9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x91e1('0x8')](e,emitEvent(event));}}module[_0x91e1('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x54cc=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x54cc,0x15e));var _0xc54c=function(_0x24fcbe,_0x446aa3){_0x24fcbe=_0x24fcbe-0x0;var _0x40cd86=_0x54cc[_0x24fcbe];return _0x40cd86;};'use strict';var EventEmitter=require(_0xc54c('0x0'));var MailQueue=require(_0xc54c('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc54c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc54c('0x3'),'afterDestroy':_0xc54c('0x4')};function emitEvent(_0x50549e){return function(_0x10ebbf,_0x13197b,_0x567a08){MailQueueEvents[_0xc54c('0x5')](_0x50549e+':'+_0x10ebbf['id'],_0x10ebbf);MailQueueEvents[_0xc54c('0x5')](_0x50549e,_0x10ebbf);_0x567a08(null);};}for(var e in events){if(events[_0xc54c('0x6')](e)){var event=events[e];MailQueue[_0xc54c('0x7')](e,emitEvent(event));}}module[_0xc54c('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 23c77b6..01e3344 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 _0x1b90=['bluebird','request-promise','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0x4f934e,_0x4f3636){var _0x556c8a=function(_0x506ce7){while(--_0x506ce7){_0x4f934e['push'](_0x4f934e['shift']());}};_0x556c8a(++_0x4f3636);}(_0x1b90,0x17e));var _0x01b9=function(_0x3c7f77,_0x50b2a2){_0x3c7f77=_0x3c7f77-0x0;var _0x7f4d0=_0x1b90[_0x3c7f77];return _0x7f4d0;};'use strict';var _=require(_0x01b9('0x0'));var util=require(_0x01b9('0x1'));var logger=require(_0x01b9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x01b9('0x3'));var rp=require(_0x01b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01b9('0x5'));var config=require(_0x01b9('0x6'));var attributes=require('./mailQueue.attributes');module[_0x01b9('0x7')]=function(_0x26e54c,_0x4b18f8){return _0x26e54c[_0x01b9('0x8')](_0x01b9('0x9'),attributes,{'tableName':_0x01b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a80=['./mailQueue.attributes','define','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4a80,0x6e));var _0x04a8=function(_0x20fdb8,_0x247255){_0x20fdb8=_0x20fdb8-0x0;var _0x1d554a=_0x4a80[_0x20fdb8];return _0x1d554a;};'use strict';var _=require(_0x04a8('0x0'));var util=require(_0x04a8('0x1'));var logger=require('../../config/logger')(_0x04a8('0x2'));var moment=require('moment');var BPromise=require(_0x04a8('0x3'));var rp=require(_0x04a8('0x4'));var fs=require('fs');var path=require(_0x04a8('0x5'));var rimraf=require(_0x04a8('0x6'));var config=require('../../config/environment');var attributes=require(_0x04a8('0x7'));module['exports']=function(_0x539d2f,_0x41e8dd){return _0x539d2f[_0x04a8('0x8')]('MailQueue',attributes,{'tableName':'mail_queues','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 2a2ea29..f85eb62 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 _0x2e96=['result','catch','GetMailQueue','options','raw','where','limit','include','model','attributes','map','ShowMailQueue','MailQueue','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x9f2ec,_0x9f02e3){var _0x2e61c6=function(_0x4ab7ed){while(--_0x4ab7ed){_0x9f2ec['push'](_0x9f2ec['shift']());}};_0x2e61c6(++_0x9f02e3);}(_0x2e96,0x1dc));var _0x62e9=function(_0x1cf367,_0x2ae40b){_0x1cf367=_0x1cf367-0x0;var _0x3d7f24=_0x2e96[_0x1cf367];return _0x3d7f24;};'use strict';var _=require(_0x62e9('0x0'));var util=require(_0x62e9('0x1'));var moment=require(_0x62e9('0x2'));var BPromise=require(_0x62e9('0x3'));var rs=require(_0x62e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62e9('0x5'));var logger=require(_0x62e9('0x6'))(_0x62e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x62e9('0x8'));var client=jayson[_0x62e9('0x9')][_0x62e9('0xa')]({'port':0x232a});config[_0x62e9('0xb')]=_[_0x62e9('0xc')](config['redis'],{'host':_0x62e9('0xd'),'port':0x18eb});var socket=require(_0x62e9('0xe'))(new Redis(config['redis']));require(_0x62e9('0xf'))[_0x62e9('0x10')](socket);function respondWithRpcPromise(_0x1a4c69,_0x285ca2,_0x1d73a4){return new BPromise(function(_0x5122a3,_0x8fedd6){return client[_0x62e9('0x11')](_0x1a4c69,_0x1d73a4)[_0x62e9('0x12')](function(_0x59547e){logger[_0x62e9('0x13')](_0x62e9('0x14'),_0x285ca2,_0x62e9('0x15'));logger[_0x62e9('0x16')](_0x62e9('0x17'),_0x285ca2,_0x62e9('0x15'),JSON[_0x62e9('0x18')](_0x59547e));if(_0x59547e[_0x62e9('0x19')]){if(_0x59547e[_0x62e9('0x19')][_0x62e9('0x1a')]===0x1f4){logger['error'](_0x62e9('0x14'),_0x285ca2,_0x59547e[_0x62e9('0x19')]['message']);return _0x8fedd6(_0x59547e[_0x62e9('0x19')][_0x62e9('0x1b')]);}logger[_0x62e9('0x19')](_0x62e9('0x14'),_0x285ca2,_0x59547e[_0x62e9('0x19')][_0x62e9('0x1b')]);return _0x5122a3(_0x59547e[_0x62e9('0x19')][_0x62e9('0x1b')]);}else{logger['info'](_0x62e9('0x14'),_0x285ca2,_0x62e9('0x15'));_0x5122a3(_0x59547e[_0x62e9('0x1c')][_0x62e9('0x1b')]);}})[_0x62e9('0x1d')](function(_0x29fe3b){logger[_0x62e9('0x19')](_0x62e9('0x14'),_0x285ca2,_0x29fe3b);_0x8fedd6(_0x29fe3b);});});}exports[_0x62e9('0x1e')]=function(_0x554334){var _0x1c4042=this;return new Promise(function(_0x319a1e,_0x257465){return db['MailQueue']['findAll']({'raw':_0x554334[_0x62e9('0x1f')]?_0x554334['options'][_0x62e9('0x20')]===undefined?!![]:![]:!![],'where':_0x554334[_0x62e9('0x1f')]?_0x554334[_0x62e9('0x1f')][_0x62e9('0x21')]||null:null,'attributes':_0x554334[_0x62e9('0x1f')]?_0x554334[_0x62e9('0x1f')]['attributes']||null:null,'limit':_0x554334[_0x62e9('0x1f')]?_0x554334['options'][_0x62e9('0x22')]||null:null,'include':_0x554334[_0x62e9('0x1f')]?_0x554334[_0x62e9('0x1f')][_0x62e9('0x23')]?_['map'](_0x554334[_0x62e9('0x1f')][_0x62e9('0x23')],function(_0x3b2688){return{'model':db[_0x3b2688[_0x62e9('0x24')]],'as':_0x3b2688['as'],'attributes':_0x3b2688['attributes'],'include':_0x3b2688[_0x62e9('0x23')]?_['map'](_0x3b2688[_0x62e9('0x23')],function(_0x918b07){return{'model':db[_0x918b07['model']],'as':_0x918b07['as'],'attributes':_0x918b07[_0x62e9('0x25')],'include':_0x918b07[_0x62e9('0x23')]?_[_0x62e9('0x26')](_0x918b07[_0x62e9('0x23')],function(_0x52e329){return{'model':db[_0x52e329[_0x62e9('0x24')]],'as':_0x52e329['as'],'attributes':_0x52e329[_0x62e9('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17f4d){logger[_0x62e9('0x13')](_0x62e9('0x1e'),_0x554334);logger[_0x62e9('0x16')]('GetMailQueue',_0x554334,JSON[_0x62e9('0x18')](_0x17f4d));_0x319a1e(_0x17f4d);})[_0x62e9('0x1d')](function(_0x19aaa6){logger[_0x62e9('0x19')]('GetMailQueue',_0x19aaa6[_0x62e9('0x1b')],_0x554334);_0x257465(_0x1c4042[_0x62e9('0x19')](0x1f4,_0x19aaa6['message']));});});};exports[_0x62e9('0x27')]=function(_0x540483){var _0x13a91e=this;return new Promise(function(_0x3e4d0d,_0x4a6441){return db[_0x62e9('0x28')][_0x62e9('0x29')]({'raw':_0x540483[_0x62e9('0x1f')]?_0x540483[_0x62e9('0x1f')][_0x62e9('0x20')]===undefined?!![]:![]:!![],'where':_0x540483[_0x62e9('0x1f')]?_0x540483[_0x62e9('0x1f')][_0x62e9('0x21')]||null:null,'attributes':_0x540483[_0x62e9('0x1f')]?_0x540483['options'][_0x62e9('0x25')]||null:null,'include':_0x540483['options']?_0x540483['options'][_0x62e9('0x23')]?_[_0x62e9('0x26')](_0x540483[_0x62e9('0x1f')][_0x62e9('0x23')],function(_0x148bc6){return{'model':db[_0x148bc6[_0x62e9('0x24')]],'as':_0x148bc6['as'],'attributes':_0x148bc6[_0x62e9('0x25')],'include':_0x148bc6[_0x62e9('0x23')]?_[_0x62e9('0x26')](_0x148bc6[_0x62e9('0x23')],function(_0x39f568){return{'model':db[_0x39f568[_0x62e9('0x24')]],'as':_0x39f568['as'],'attributes':_0x39f568[_0x62e9('0x25')],'include':_0x39f568[_0x62e9('0x23')]?_[_0x62e9('0x26')](_0x39f568[_0x62e9('0x23')],function(_0x15964b){return{'model':db[_0x15964b[_0x62e9('0x24')]],'as':_0x15964b['as'],'attributes':_0x15964b[_0x62e9('0x25')]};}):[]};}):[]};}):[]:[]})[_0x62e9('0x12')](function(_0xe05d6f){logger['info'](_0x62e9('0x27'),_0x540483);logger[_0x62e9('0x16')](_0x62e9('0x27'),_0x540483,JSON[_0x62e9('0x18')](_0xe05d6f));_0x3e4d0d(_0xe05d6f);})['catch'](function(_0x4b1c52){logger['error'](_0x62e9('0x27'),_0x4b1c52[_0x62e9('0x1b')],_0x540483);_0x4a6441(_0x13a91e[_0x62e9('0x19')](0x1f4,_0x4b1c52[_0x62e9('0x1b')]));});});}; \ No newline at end of file +var _0xd9c8=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','MailQueue,\x20%s,\x20%s','result','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetMailQueue','catch','ShowMailQueue','stringify','lodash','moment','bluebird'];(function(_0x24c971,_0x48698c){var _0x13f5f2=function(_0xdd971){while(--_0xdd971){_0x24c971['push'](_0x24c971['shift']());}};_0x13f5f2(++_0x48698c);}(_0xd9c8,0x11c));var _0x8d9c=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd9c8[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x8d9c('0x0'));var util=require('util');var moment=require(_0x8d9c('0x1'));var BPromise=require(_0x8d9c('0x2'));var rs=require(_0x8d9c('0x3'));var fs=require('fs');var Redis=require(_0x8d9c('0x4'));var db=require(_0x8d9c('0x5'))['db'];var utils=require(_0x8d9c('0x6'));var logger=require('../../config/logger')(_0x8d9c('0x7'));var config=require(_0x8d9c('0x8'));var jayson=require(_0x8d9c('0x9'));var client=jayson[_0x8d9c('0xa')]['http']({'port':0x232a});config[_0x8d9c('0xb')]=_[_0x8d9c('0xc')](config[_0x8d9c('0xb')],{'host':_0x8d9c('0xd'),'port':0x18eb});var socket=require(_0x8d9c('0xe'))(new Redis(config[_0x8d9c('0xb')]));require(_0x8d9c('0xf'))['register'](socket);function respondWithRpcPromise(_0x3bce6d,_0x5f0777,_0x219794){return new BPromise(function(_0x5ec982,_0x3918d0){return client[_0x8d9c('0x10')](_0x3bce6d,_0x219794)[_0x8d9c('0x11')](function(_0x15b029){logger[_0x8d9c('0x12')]('MailQueue,\x20%s,\x20%s',_0x5f0777,_0x8d9c('0x13'));logger[_0x8d9c('0x14')](_0x8d9c('0x15'),_0x5f0777,_0x8d9c('0x13'),JSON['stringify'](_0x15b029));if(_0x15b029[_0x8d9c('0x16')]){if(_0x15b029[_0x8d9c('0x16')][_0x8d9c('0x17')]===0x1f4){logger[_0x8d9c('0x16')]('MailQueue,\x20%s,\x20%s',_0x5f0777,_0x15b029['error'][_0x8d9c('0x18')]);return _0x3918d0(_0x15b029[_0x8d9c('0x16')][_0x8d9c('0x18')]);}logger['error'](_0x8d9c('0x19'),_0x5f0777,_0x15b029[_0x8d9c('0x16')][_0x8d9c('0x18')]);return _0x5ec982(_0x15b029['error'][_0x8d9c('0x18')]);}else{logger[_0x8d9c('0x12')]('MailQueue,\x20%s,\x20%s',_0x5f0777,_0x8d9c('0x13'));_0x5ec982(_0x15b029[_0x8d9c('0x1a')][_0x8d9c('0x18')]);}})['catch'](function(_0x4fa439){logger[_0x8d9c('0x16')](_0x8d9c('0x19'),_0x5f0777,_0x4fa439);_0x3918d0(_0x4fa439);});});}exports['GetMailQueue']=function(_0x53da7e){var _0x3e4c43=this;return new Promise(function(_0x43347f,_0x13b9b2){return db[_0x8d9c('0x1b')][_0x8d9c('0x1c')]({'raw':_0x53da7e[_0x8d9c('0x1d')]?_0x53da7e[_0x8d9c('0x1d')][_0x8d9c('0x1e')]===undefined?!![]:![]:!![],'where':_0x53da7e['options']?_0x53da7e[_0x8d9c('0x1d')][_0x8d9c('0x1f')]||null:null,'attributes':_0x53da7e[_0x8d9c('0x1d')]?_0x53da7e[_0x8d9c('0x1d')][_0x8d9c('0x20')]||null:null,'limit':_0x53da7e[_0x8d9c('0x1d')]?_0x53da7e[_0x8d9c('0x1d')][_0x8d9c('0x21')]||null:null,'include':_0x53da7e[_0x8d9c('0x1d')]?_0x53da7e[_0x8d9c('0x1d')]['include']?_[_0x8d9c('0x22')](_0x53da7e['options'][_0x8d9c('0x23')],function(_0xb9d5d){return{'model':db[_0xb9d5d[_0x8d9c('0x24')]],'as':_0xb9d5d['as'],'attributes':_0xb9d5d[_0x8d9c('0x20')],'include':_0xb9d5d[_0x8d9c('0x23')]?_[_0x8d9c('0x22')](_0xb9d5d[_0x8d9c('0x23')],function(_0x19e743){return{'model':db[_0x19e743[_0x8d9c('0x24')]],'as':_0x19e743['as'],'attributes':_0x19e743[_0x8d9c('0x20')],'include':_0x19e743[_0x8d9c('0x23')]?_[_0x8d9c('0x22')](_0x19e743['include'],function(_0x450e42){return{'model':db[_0x450e42[_0x8d9c('0x24')]],'as':_0x450e42['as'],'attributes':_0x450e42['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d9c('0x11')](function(_0x518054){logger[_0x8d9c('0x12')](_0x8d9c('0x25'),_0x53da7e);logger[_0x8d9c('0x14')](_0x8d9c('0x25'),_0x53da7e,JSON['stringify'](_0x518054));_0x43347f(_0x518054);})[_0x8d9c('0x26')](function(_0x4a32b2){logger[_0x8d9c('0x16')](_0x8d9c('0x25'),_0x4a32b2[_0x8d9c('0x18')],_0x53da7e);_0x13b9b2(_0x3e4c43[_0x8d9c('0x16')](0x1f4,_0x4a32b2[_0x8d9c('0x18')]));});});};exports['ShowMailQueue']=function(_0x54b14a){var _0x1dd210=this;return new Promise(function(_0x973f1a,_0x32478d){return db['MailQueue']['find']({'raw':_0x54b14a['options']?_0x54b14a['options'][_0x8d9c('0x1e')]===undefined?!![]:![]:!![],'where':_0x54b14a[_0x8d9c('0x1d')]?_0x54b14a[_0x8d9c('0x1d')][_0x8d9c('0x1f')]||null:null,'attributes':_0x54b14a[_0x8d9c('0x1d')]?_0x54b14a[_0x8d9c('0x1d')][_0x8d9c('0x20')]||null:null,'include':_0x54b14a[_0x8d9c('0x1d')]?_0x54b14a['options'][_0x8d9c('0x23')]?_[_0x8d9c('0x22')](_0x54b14a['options']['include'],function(_0x299b78){return{'model':db[_0x299b78['model']],'as':_0x299b78['as'],'attributes':_0x299b78['attributes'],'include':_0x299b78[_0x8d9c('0x23')]?_[_0x8d9c('0x22')](_0x299b78[_0x8d9c('0x23')],function(_0x3fc50c){return{'model':db[_0x3fc50c['model']],'as':_0x3fc50c['as'],'attributes':_0x3fc50c[_0x8d9c('0x20')],'include':_0x3fc50c[_0x8d9c('0x23')]?_[_0x8d9c('0x22')](_0x3fc50c[_0x8d9c('0x23')],function(_0x267686){return{'model':db[_0x267686['model']],'as':_0x267686['as'],'attributes':_0x267686[_0x8d9c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5371fe){logger['info'](_0x8d9c('0x27'),_0x54b14a);logger[_0x8d9c('0x14')]('ShowMailQueue',_0x54b14a,JSON[_0x8d9c('0x28')](_0x5371fe));_0x973f1a(_0x5371fe);})[_0x8d9c('0x26')](function(_0x546f25){logger[_0x8d9c('0x16')]('ShowMailQueue',_0x546f25['message'],_0x54b14a);_0x32478d(_0x1dd210[_0x8d9c('0x16')](0x1f4,_0x546f25['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3edcba9..4136acc 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 _0x50fd=['emit','removeListener','length','./mailQueue.events','save','remove'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x50fd,0x189));var _0xd50f=function(_0x2365ff,_0x114866){_0x2365ff=_0x2365ff-0x0;var _0x5a788b=_0x50fd[_0x2365ff];return _0x5a788b;};'use strict';var MailQueueEvents=require(_0xd50f('0x0'));var events=[_0xd50f('0x1'),_0xd50f('0x2'),'update'];function createListener(_0x1e2f74,_0x419c4c){return function(_0x237b43){_0x419c4c[_0xd50f('0x3')](_0x1e2f74,_0x237b43);};}function removeListener(_0x285dd6,_0x2a780f){return function(){MailQueueEvents[_0xd50f('0x4')](_0x285dd6,_0x2a780f);};}exports['register']=function(_0x183654){for(var _0x11bc7c=0x0,_0x12a93a=events[_0xd50f('0x5')];_0x11bc7c<_0x12a93a;_0x11bc7c++){var _0xca7aad=events[_0x11bc7c];var _0x3b5534=createListener('mailQueue:'+_0xca7aad,_0x183654);MailQueueEvents['on'](_0xca7aad,_0x3b5534);}}; \ No newline at end of file +var _0x779e=['length','./mailQueue.events','save','remove','update','removeListener','register'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x779e,0xe1));var _0xe779=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x779e[_0x2dea24];return _0x309d58;};'use strict';var MailQueueEvents=require(_0xe779('0x0'));var events=[_0xe779('0x1'),_0xe779('0x2'),_0xe779('0x3')];function createListener(_0x48291e,_0x384f51){return function(_0xb5c81a){_0x384f51['emit'](_0x48291e,_0xb5c81a);};}function removeListener(_0x57e138,_0x99ba65){return function(){MailQueueEvents[_0xe779('0x4')](_0x57e138,_0x99ba65);};}exports[_0xe779('0x5')]=function(_0x4b5a24){for(var _0x2b65a1=0x0,_0x288693=events[_0xe779('0x6')];_0x2b65a1<_0x288693;_0x2b65a1++){var _0x2b5597=events[_0x2b65a1];var _0xb92199=createListener('mailQueue:'+_0x2b5597,_0x4b5a24);MailQueueEvents['on'](_0x2b5597,_0xb92199);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8ac3cf8..8392b03 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 _0x4e70=['show','post','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x394ad5,_0x1120d7){var _0x3158f8=function(_0x4b1dce){while(--_0x4b1dce){_0x394ad5['push'](_0x394ad5['shift']());}};_0x3158f8(++_0x1120d7);}(_0x4e70,0x69));var _0x04e7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x4e70[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0x04e7('0x0'));var util=require(_0x04e7('0x1'));var path=require(_0x04e7('0x2'));var timeout=require(_0x04e7('0x3'));var express=require('express');var router=express[_0x04e7('0x4')]();var fs_extra=require(_0x04e7('0x5'));var auth=require(_0x04e7('0x6'));var interaction=require(_0x04e7('0x7'));var config=require(_0x04e7('0x8'));var controller=require(_0x04e7('0x9'));router[_0x04e7('0xa')]('/',auth[_0x04e7('0xb')](),controller[_0x04e7('0xc')]);router[_0x04e7('0xa')]('/describe',auth[_0x04e7('0xb')](),controller[_0x04e7('0xd')]);router[_0x04e7('0xa')](_0x04e7('0xe'),auth[_0x04e7('0xb')](),controller[_0x04e7('0xf')]);router[_0x04e7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x04e7('0x11')](_0x04e7('0xe'),auth[_0x04e7('0xb')](),controller['update']);router[_0x04e7('0x12')](_0x04e7('0xe'),auth[_0x04e7('0xb')](),controller[_0x04e7('0x13')]);module['exports']=router; \ No newline at end of file +var _0xed8a=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','exports','multer','util','path'];(function(_0x4f96a3,_0xe68556){var _0x44529e=function(_0x2522f7){while(--_0x2522f7){_0x4f96a3['push'](_0x4f96a3['shift']());}};_0x44529e(++_0xe68556);}(_0xed8a,0xc5));var _0xaed8=function(_0x19c38b,_0x3cda86){_0x19c38b=_0x19c38b-0x0;var _0x37297e=_0xed8a[_0x19c38b];return _0x37297e;};'use strict';var multer=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var path=require(_0xaed8('0x2'));var timeout=require(_0xaed8('0x3'));var express=require('express');var router=express[_0xaed8('0x4')]();var fs_extra=require(_0xaed8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaed8('0x6'));var config=require(_0xaed8('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0xaed8('0x8')](),controller[_0xaed8('0x9')]);router[_0xaed8('0xa')](_0xaed8('0xb'),auth[_0xaed8('0x8')](),controller[_0xaed8('0xc')]);router[_0xaed8('0xa')]('/:id',auth[_0xaed8('0x8')](),controller[_0xaed8('0xd')]);router[_0xaed8('0xe')]('/',auth['isAuthenticated'](),controller[_0xaed8('0xf')]);router[_0xaed8('0x10')](_0xaed8('0x11'),auth[_0xaed8('0x8')](),controller[_0xaed8('0x12')]);router['delete']('/:id',auth[_0xaed8('0x8')](),controller['destroy']);module[_0xaed8('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 06583e8..a2f00be 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 _0xc84a=['DATE','moment','sequelize'];(function(_0x1bc635,_0x4a1b08){var _0x1179e0=function(_0x48b2ed){while(--_0x48b2ed){_0x1bc635['push'](_0x1bc635['shift']());}};_0x1179e0(++_0x4a1b08);}(_0xc84a,0xd3));var _0xac84=function(_0x447752,_0x3e28b1){_0x447752=_0x447752-0x0;var _0x4e083b=_0xc84a[_0x447752];return _0x4e083b;};'use strict';var moment=require(_0xac84('0x0'));var Sequelize=require(_0xac84('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xac84('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c38=['sequelize','STRING','DATE','moment'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x8c38,0xa7));var _0x88c3=function(_0x44ca69,_0x3d8e3a){_0x44ca69=_0x44ca69-0x0;var _0x558525=_0x8c38[_0x44ca69];return _0x558525;};'use strict';var moment=require(_0x88c3('0x0'));var Sequelize=require(_0x88c3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x88c3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x88c3('0x2')]},'joinAt':{'type':Sequelize[_0x88c3('0x3')]},'leaveAt':{'type':Sequelize[_0x88c3('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x88c3('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 463cb5e..3fb0cff 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 _0xb00b=['intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','MailQueueReport','key','model','query','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb00b,0x1e3));var _0xbb00=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb00b[_0x16d10f];return _0x50c823;};'use strict';var pdf=require(_0xbb00('0x0'));var emlformat=require(_0xbb00('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb00('0x2'));var jsonpatch=require(_0xbb00('0x3'));var rp=require('request-promise');var moment=require(_0xbb00('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbb00('0x5'));var path=require(_0xbb00('0x6'));var sox=require(_0xbb00('0x7'));var csv=require(_0xbb00('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb00('0x9'));var _=require(_0xbb00('0xa'));var squel=require(_0xbb00('0xb'));var crypto=require(_0xbb00('0xc'));var jsforce=require(_0xbb00('0xd'));var deskjs=require(_0xbb00('0xe'));var toCsv=require(_0xbb00('0x8'));var querystring=require(_0xbb00('0xf'));var Papa=require(_0xbb00('0x10'));var Redis=require(_0xbb00('0x11'));var authService=require(_0xbb00('0x12'));var qs=require(_0xbb00('0x13'));var as=require(_0xbb00('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbb00('0x15'));var utils=require(_0xbb00('0x16'));var config=require(_0xbb00('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3719f8,_0x5e936f){_0x5e936f=_0x5e936f||0xcc;return function(_0x452e60){if(_0x452e60){return _0x3719f8[_0xbb00('0x18')](_0x5e936f);}return _0x3719f8[_0xbb00('0x19')](_0x5e936f)[_0xbb00('0x1a')]();};}function respondWithResult(_0x41ba3c,_0x4787c4){_0x4787c4=_0x4787c4||0xc8;return function(_0x3f4e5a){if(_0x3f4e5a){return _0x41ba3c[_0xbb00('0x19')](_0x4787c4)['json'](_0x3f4e5a);}};}function respondWithFilteredResult(_0x6bc5b,_0x418b93){return function(_0x374f2a){if(_0x374f2a){var _0x248461=_0x374f2a[_0xbb00('0x1b')],_0x2662fb=_0x418b93[_0xbb00('0x1c')],_0x5afb65=_0x418b93['offset']+_0x418b93[_0xbb00('0x1d')],_0x579e67;if(_0x5afb65>=_0x248461){_0x5afb65=_0x248461;_0x579e67=0xc8;}else{_0x579e67=0xce;}_0x6bc5b['status'](_0x579e67);return _0x6bc5b[_0xbb00('0x1e')](_0xbb00('0x1f'),_0x2662fb+'-'+_0x5afb65+'/'+_0x248461)[_0xbb00('0x20')](_0x374f2a);}return null;};}function patchUpdates(_0x4b3083){return function(_0x1205d5){try{jsonpatch[_0xbb00('0x21')](_0x1205d5,_0x4b3083,!![]);}catch(_0x46cbc5){return BPromise[_0xbb00('0x22')](_0x46cbc5);}return _0x1205d5[_0xbb00('0x23')]();};}function saveUpdates(_0x4904b0,_0x18b47b){return function(_0xe312b4){if(_0xe312b4){return _0xe312b4[_0xbb00('0x24')](_0x4904b0)['then'](function(_0x1351db){return _0x1351db;});}return null;};}function removeEntity(_0x38d398,_0x2fa218){return function(_0x35be3b){if(_0x35be3b){return _0x35be3b[_0xbb00('0x25')]()['then'](function(){_0x38d398['status'](0xcc)[_0xbb00('0x1a')]();});}};}function handleEntityNotFound(_0x515bce,_0x4e09a2){return function(_0xfe2bdd){if(!_0xfe2bdd){_0x515bce['sendStatus'](0x194);}return _0xfe2bdd;};}function handleError(_0x45e5ba,_0x1ce080){_0x1ce080=_0x1ce080||0x1f4;return function(_0x23a909){logger[_0xbb00('0x26')](_0x23a909[_0xbb00('0x27')]);if(_0x23a909[_0xbb00('0x28')]){delete _0x23a909[_0xbb00('0x28')];}_0x45e5ba[_0xbb00('0x19')](_0x1ce080)[_0xbb00('0x29')](_0x23a909);};}exports[_0xbb00('0x2a')]=function(_0x309539,_0x16a98e){var _0x2eefab={},_0x4e614a={},_0x1942a9={'count':0x0,'rows':[]};var _0x53d720=_[_0xbb00('0x2b')](db[_0xbb00('0x2c')]['rawAttributes'],function(_0x298287){return{'name':_0x298287['fieldName'],'type':_0x298287['type'][_0xbb00('0x2d')]};});_0x4e614a[_0xbb00('0x2e')]=_['map'](_0x53d720,_0xbb00('0x28'));_0x4e614a[_0xbb00('0x2f')]=_[_0xbb00('0x30')](_0x309539['query']);_0x4e614a['filters']=_[_0xbb00('0x31')](_0x4e614a['model'],_0x4e614a[_0xbb00('0x2f')]);_0x2eefab[_0xbb00('0x32')]=_[_0xbb00('0x31')](_0x4e614a[_0xbb00('0x2e')],qs[_0xbb00('0x33')](_0x309539['query'][_0xbb00('0x33')]));_0x2eefab[_0xbb00('0x32')]=_0x2eefab[_0xbb00('0x32')][_0xbb00('0x34')]?_0x2eefab[_0xbb00('0x32')]:_0x4e614a['model'];if(!_0x309539[_0xbb00('0x2f')][_0xbb00('0x35')]('nolimit')){_0x2eefab['limit']=qs[_0xbb00('0x1d')](_0x309539[_0xbb00('0x2f')][_0xbb00('0x1d')]);_0x2eefab[_0xbb00('0x1c')]=qs[_0xbb00('0x1c')](_0x309539['query'][_0xbb00('0x1c')]);}_0x2eefab[_0xbb00('0x36')]=qs[_0xbb00('0x37')](_0x309539[_0xbb00('0x2f')][_0xbb00('0x37')]);_0x2eefab['where']=qs[_0xbb00('0x38')](_[_0xbb00('0x39')](_0x309539[_0xbb00('0x2f')],_0x4e614a[_0xbb00('0x38')]),_0x53d720);if(_0x309539[_0xbb00('0x2f')][_0xbb00('0x3a')]){_0x2eefab['where']=_[_0xbb00('0x3b')](_0x2eefab[_0xbb00('0x3c')],{'$or':_[_0xbb00('0x2b')](_0x53d720,function(_0x4ef2c0){if(_0x4ef2c0[_0xbb00('0x3d')]!==_0xbb00('0x3e')){var _0x158a35={};_0x158a35[_0x4ef2c0[_0xbb00('0x28')]]={'$like':'%'+_0x309539['query'][_0xbb00('0x3a')]+'%'};return _0x158a35;}})});}_0x2eefab=_['merge']({},_0x2eefab,_0x309539[_0xbb00('0x3f')]);var _0x16c702={'where':_0x2eefab[_0xbb00('0x3c')]};return db[_0xbb00('0x2c')][_0xbb00('0x1b')](_0x16c702)['then'](function(_0x4a441b){_0x1942a9[_0xbb00('0x1b')]=_0x4a441b;if(_0x309539[_0xbb00('0x2f')][_0xbb00('0x40')]){_0x2eefab[_0xbb00('0x41')]=[{'all':!![]}];}return db[_0xbb00('0x2c')][_0xbb00('0x42')](_0x2eefab);})[_0xbb00('0x43')](function(_0x41da04){_0x1942a9[_0xbb00('0x44')]=_0x41da04;return _0x1942a9;})[_0xbb00('0x43')](respondWithFilteredResult(_0x16a98e,_0x2eefab))[_0xbb00('0x45')](handleError(_0x16a98e,null));};exports[_0xbb00('0x46')]=function(_0x4041a2,_0x58093c){var _0x5f1f55={'raw':!![],'where':{'id':_0x4041a2[_0xbb00('0x47')]['id']}},_0x1b46f8={};_0x1b46f8[_0xbb00('0x2e')]=_['keys'](db[_0xbb00('0x2c')]['rawAttributes']);_0x1b46f8[_0xbb00('0x2f')]=_[_0xbb00('0x30')](_0x4041a2[_0xbb00('0x2f')]);_0x1b46f8[_0xbb00('0x38')]=_[_0xbb00('0x31')](_0x1b46f8['model'],_0x1b46f8[_0xbb00('0x2f')]);_0x5f1f55[_0xbb00('0x32')]=_[_0xbb00('0x31')](_0x1b46f8['model'],qs['fields'](_0x4041a2[_0xbb00('0x2f')][_0xbb00('0x33')]));_0x5f1f55[_0xbb00('0x32')]=_0x5f1f55['attributes'][_0xbb00('0x34')]?_0x5f1f55[_0xbb00('0x32')]:_0x1b46f8[_0xbb00('0x2e')];if(_0x4041a2[_0xbb00('0x2f')]['includeAll']){_0x5f1f55['include']=[{'all':!![]}];}_0x5f1f55=_['merge']({},_0x5f1f55,_0x4041a2[_0xbb00('0x3f')]);return db[_0xbb00('0x2c')][_0xbb00('0x48')](_0x5f1f55)[_0xbb00('0x43')](handleEntityNotFound(_0x58093c,null))[_0xbb00('0x43')](respondWithResult(_0x58093c,null))[_0xbb00('0x45')](handleError(_0x58093c,null));};exports[_0xbb00('0x49')]=function(_0x30b699,_0x18f98e){return db[_0xbb00('0x2c')]['create'](_0x30b699['body'],{})[_0xbb00('0x43')](respondWithResult(_0x18f98e,0xc9))[_0xbb00('0x45')](handleError(_0x18f98e,null));};exports[_0xbb00('0x24')]=function(_0x5a0899,_0xe2751d){if(_0x5a0899[_0xbb00('0x4a')]['id']){delete _0x5a0899[_0xbb00('0x4a')]['id'];}return db[_0xbb00('0x2c')][_0xbb00('0x48')]({'where':{'id':_0x5a0899['params']['id']}})[_0xbb00('0x43')](handleEntityNotFound(_0xe2751d,null))['then'](saveUpdates(_0x5a0899['body'],null))[_0xbb00('0x43')](respondWithResult(_0xe2751d,null))[_0xbb00('0x45')](handleError(_0xe2751d,null));};exports[_0xbb00('0x25')]=function(_0x235f12,_0x281902){return db[_0xbb00('0x2c')]['find']({'where':{'id':_0x235f12[_0xbb00('0x47')]['id']}})[_0xbb00('0x43')](handleEntityNotFound(_0x281902,null))['then'](removeEntity(_0x281902,null))[_0xbb00('0x45')](handleError(_0x281902,null));};exports[_0xbb00('0x4b')]=function(_0x4ab2d6,_0x5a619a){return db[_0xbb00('0x2c')][_0xbb00('0x4b')]()['then'](respondWithResult(_0x5a619a,null))[_0xbb00('0x45')](handleError(_0x5a619a,null));}; \ No newline at end of file +var _0x41d2=['send','index','MailQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','find','catch','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','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','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','error','stack','name'];(function(_0x1d0374,_0x5b6bb0){var _0x55b65a=function(_0x36ebb7){while(--_0x36ebb7){_0x1d0374['push'](_0x1d0374['shift']());}};_0x55b65a(++_0x5b6bb0);}(_0x41d2,0x150));var _0x241d=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x41d2[_0x1d6a82];return _0x5834ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x241d('0x0'));var rimraf=require(_0x241d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x241d('0x2'));var rp=require(_0x241d('0x3'));var moment=require(_0x241d('0x4'));var BPromise=require(_0x241d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x241d('0x6'));var sox=require(_0x241d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x241d('0x8'));var _=require(_0x241d('0x9'));var squel=require(_0x241d('0xa'));var crypto=require('crypto');var jsforce=require(_0x241d('0xb'));var deskjs=require(_0x241d('0xc'));var toCsv=require(_0x241d('0xd'));var querystring=require(_0x241d('0xe'));var Papa=require(_0x241d('0xf'));var Redis=require(_0x241d('0x10'));var authService=require(_0x241d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x241d('0x12'));var hardwareService=require(_0x241d('0x13'));var logger=require(_0x241d('0x14'))(_0x241d('0x15'));var utils=require(_0x241d('0x16'));var config=require(_0x241d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x204799,_0x3a1aff){_0x3a1aff=_0x3a1aff||0xcc;return function(_0x238aa1){if(_0x238aa1){return _0x204799[_0x241d('0x18')](_0x3a1aff);}return _0x204799[_0x241d('0x19')](_0x3a1aff)[_0x241d('0x1a')]();};}function respondWithResult(_0x4b8939,_0x23d079){_0x23d079=_0x23d079||0xc8;return function(_0x2e649e){if(_0x2e649e){return _0x4b8939[_0x241d('0x19')](_0x23d079)['json'](_0x2e649e);}};}function respondWithFilteredResult(_0x515acf,_0x4cc387){return function(_0x146a92){if(_0x146a92){var _0x1076d0=_0x146a92[_0x241d('0x1b')],_0x4d713b=_0x4cc387[_0x241d('0x1c')],_0x8375f1=_0x4cc387[_0x241d('0x1c')]+_0x4cc387[_0x241d('0x1d')],_0x446adb;if(_0x8375f1>=_0x1076d0){_0x8375f1=_0x1076d0;_0x446adb=0xc8;}else{_0x446adb=0xce;}_0x515acf[_0x241d('0x19')](_0x446adb);return _0x515acf[_0x241d('0x1e')](_0x241d('0x1f'),_0x4d713b+'-'+_0x8375f1+'/'+_0x1076d0)[_0x241d('0x20')](_0x146a92);}return null;};}function patchUpdates(_0x23d4db){return function(_0x1984ff){try{jsonpatch['apply'](_0x1984ff,_0x23d4db,!![]);}catch(_0x10952e){return BPromise[_0x241d('0x21')](_0x10952e);}return _0x1984ff[_0x241d('0x22')]();};}function saveUpdates(_0x4ed26d,_0xd9428){return function(_0x43d271){if(_0x43d271){return _0x43d271['update'](_0x4ed26d)[_0x241d('0x23')](function(_0x37db91){return _0x37db91;});}return null;};}function removeEntity(_0x45d534,_0x542719){return function(_0x420619){if(_0x420619){return _0x420619['destroy']()['then'](function(){_0x45d534[_0x241d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x70b665,_0x1ae047){return function(_0x174760){if(!_0x174760){_0x70b665['sendStatus'](0x194);}return _0x174760;};}function handleError(_0x50a089,_0x518210){_0x518210=_0x518210||0x1f4;return function(_0x9ecf11){logger[_0x241d('0x24')](_0x9ecf11[_0x241d('0x25')]);if(_0x9ecf11[_0x241d('0x26')]){delete _0x9ecf11['name'];}_0x50a089['status'](_0x518210)[_0x241d('0x27')](_0x9ecf11);};}exports[_0x241d('0x28')]=function(_0x3b0861,_0x5950e3){var _0x396831={},_0x1b95e9={},_0x1a4230={'count':0x0,'rows':[]};var _0x176496=_['map'](db[_0x241d('0x29')][_0x241d('0x2a')],function(_0x35fd07){return{'name':_0x35fd07['fieldName'],'type':_0x35fd07[_0x241d('0x2b')][_0x241d('0x2c')]};});_0x1b95e9[_0x241d('0x2d')]=_[_0x241d('0x2e')](_0x176496,'name');_0x1b95e9[_0x241d('0x2f')]=_[_0x241d('0x30')](_0x3b0861[_0x241d('0x2f')]);_0x1b95e9[_0x241d('0x31')]=_[_0x241d('0x32')](_0x1b95e9['model'],_0x1b95e9[_0x241d('0x2f')]);_0x396831[_0x241d('0x33')]=_[_0x241d('0x32')](_0x1b95e9[_0x241d('0x2d')],qs[_0x241d('0x34')](_0x3b0861['query'][_0x241d('0x34')]));_0x396831[_0x241d('0x33')]=_0x396831['attributes'][_0x241d('0x35')]?_0x396831[_0x241d('0x33')]:_0x1b95e9[_0x241d('0x2d')];if(!_0x3b0861[_0x241d('0x2f')][_0x241d('0x36')](_0x241d('0x37'))){_0x396831['limit']=qs[_0x241d('0x1d')](_0x3b0861[_0x241d('0x2f')][_0x241d('0x1d')]);_0x396831[_0x241d('0x1c')]=qs[_0x241d('0x1c')](_0x3b0861[_0x241d('0x2f')]['offset']);}_0x396831[_0x241d('0x38')]=qs[_0x241d('0x39')](_0x3b0861['query'][_0x241d('0x39')]);_0x396831[_0x241d('0x3a')]=qs[_0x241d('0x31')](_[_0x241d('0x3b')](_0x3b0861['query'],_0x1b95e9[_0x241d('0x31')]),_0x176496);if(_0x3b0861['query'][_0x241d('0x3c')]){_0x396831[_0x241d('0x3a')]=_[_0x241d('0x3d')](_0x396831[_0x241d('0x3a')],{'$or':_[_0x241d('0x2e')](_0x176496,function(_0x2bc2b4){if(_0x2bc2b4[_0x241d('0x2b')]!==_0x241d('0x3e')){var _0xe42d5e={};_0xe42d5e[_0x2bc2b4[_0x241d('0x26')]]={'$like':'%'+_0x3b0861[_0x241d('0x2f')]['filter']+'%'};return _0xe42d5e;}})});}_0x396831=_[_0x241d('0x3d')]({},_0x396831,_0x3b0861[_0x241d('0x3f')]);var _0x5b804c={'where':_0x396831[_0x241d('0x3a')]};return db[_0x241d('0x29')][_0x241d('0x1b')](_0x5b804c)[_0x241d('0x23')](function(_0x13e3b9){_0x1a4230[_0x241d('0x1b')]=_0x13e3b9;if(_0x3b0861['query'][_0x241d('0x40')]){_0x396831[_0x241d('0x41')]=[{'all':!![]}];}return db[_0x241d('0x29')]['findAll'](_0x396831);})[_0x241d('0x23')](function(_0x13cfad){_0x1a4230['rows']=_0x13cfad;return _0x1a4230;})[_0x241d('0x23')](respondWithFilteredResult(_0x5950e3,_0x396831))['catch'](handleError(_0x5950e3,null));};exports[_0x241d('0x42')]=function(_0x311c40,_0x358af6){var _0x571fe2={'raw':!![],'where':{'id':_0x311c40[_0x241d('0x43')]['id']}},_0x2f34bc={};_0x2f34bc[_0x241d('0x2d')]=_[_0x241d('0x30')](db[_0x241d('0x29')][_0x241d('0x2a')]);_0x2f34bc[_0x241d('0x2f')]=_['keys'](_0x311c40['query']);_0x2f34bc[_0x241d('0x31')]=_[_0x241d('0x32')](_0x2f34bc[_0x241d('0x2d')],_0x2f34bc[_0x241d('0x2f')]);_0x571fe2['attributes']=_[_0x241d('0x32')](_0x2f34bc[_0x241d('0x2d')],qs[_0x241d('0x34')](_0x311c40[_0x241d('0x2f')][_0x241d('0x34')]));_0x571fe2[_0x241d('0x33')]=_0x571fe2[_0x241d('0x33')][_0x241d('0x35')]?_0x571fe2[_0x241d('0x33')]:_0x2f34bc[_0x241d('0x2d')];if(_0x311c40[_0x241d('0x2f')][_0x241d('0x40')]){_0x571fe2[_0x241d('0x41')]=[{'all':!![]}];}_0x571fe2=_['merge']({},_0x571fe2,_0x311c40['options']);return db[_0x241d('0x29')][_0x241d('0x44')](_0x571fe2)[_0x241d('0x23')](handleEntityNotFound(_0x358af6,null))['then'](respondWithResult(_0x358af6,null))[_0x241d('0x45')](handleError(_0x358af6,null));};exports[_0x241d('0x46')]=function(_0x555c07,_0x4a080c){return db[_0x241d('0x29')]['create'](_0x555c07[_0x241d('0x47')],{})['then'](respondWithResult(_0x4a080c,0xc9))[_0x241d('0x45')](handleError(_0x4a080c,null));};exports[_0x241d('0x48')]=function(_0x431bc6,_0x1c4cf1){if(_0x431bc6['body']['id']){delete _0x431bc6[_0x241d('0x47')]['id'];}return db[_0x241d('0x29')]['find']({'where':{'id':_0x431bc6[_0x241d('0x43')]['id']}})[_0x241d('0x23')](handleEntityNotFound(_0x1c4cf1,null))['then'](saveUpdates(_0x431bc6[_0x241d('0x47')],null))[_0x241d('0x23')](respondWithResult(_0x1c4cf1,null))[_0x241d('0x45')](handleError(_0x1c4cf1,null));};exports[_0x241d('0x49')]=function(_0x2b54eb,_0x4f35be){return db[_0x241d('0x29')]['find']({'where':{'id':_0x2b54eb[_0x241d('0x43')]['id']}})[_0x241d('0x23')](handleEntityNotFound(_0x4f35be,null))[_0x241d('0x23')](removeEntity(_0x4f35be,null))[_0x241d('0x45')](handleError(_0x4f35be,null));};exports[_0x241d('0x4a')]=function(_0x5d01cf,_0x1cb59e){return db[_0x241d('0x29')][_0x241d('0x4a')]()['then'](respondWithResult(_0x1cb59e,null))['catch'](handleError(_0x1cb59e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 9fb7ae5..9197777 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 _0xaf43=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xaf43,0x182));var _0x3af4=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xaf43[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x3af4('0x0'));var logger=require(_0x3af4('0x1'))(_0x3af4('0x2'));var moment=require(_0x3af4('0x3'));var BPromise=require(_0x3af4('0x4'));var rp=require(_0x3af4('0x5'));var fs=require('fs');var path=require(_0x3af4('0x6'));var rimraf=require(_0x3af4('0x7'));var config=require(_0x3af4('0x8'));var attributes=require(_0x3af4('0x9'));module[_0x3af4('0xa')]=function(_0x47d8da,_0x199ee7){return _0x47d8da[_0x3af4('0xb')](_0x3af4('0xc'),attributes,{'tableName':_0x3af4('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x541a=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','util','../../config/logger'];(function(_0x4c4664,_0x506a85){var _0x2920cf=function(_0x54a19d){while(--_0x54a19d){_0x4c4664['push'](_0x4c4664['shift']());}};_0x2920cf(++_0x506a85);}(_0x541a,0xdb));var _0xa541=function(_0x1d0e5e,_0x596f00){_0x1d0e5e=_0x1d0e5e-0x0;var _0x3ba445=_0x541a[_0x1d0e5e];return _0x3ba445;};'use strict';var _=require('lodash');var util=require(_0xa541('0x0'));var logger=require(_0xa541('0x1'))(_0xa541('0x2'));var moment=require(_0xa541('0x3'));var BPromise=require(_0xa541('0x4'));var rp=require(_0xa541('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa541('0x6'));var config=require(_0xa541('0x7'));var attributes=require(_0xa541('0x8'));module[_0xa541('0x9')]=function(_0x4a5329,_0x48a6f0){return _0x4a5329[_0xa541('0xa')]('MailQueueReport',attributes,{'tableName':_0xa541('0xb'),'paranoid':![],'indexes':[{'name':_0xa541('0xc'),'fields':[_0xa541('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c607160..bd88bc9 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 _0xc0f7=['then','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','create','options','raw','info','update','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x2477b2,_0x67ec34){var _0x2eb311=function(_0x4dc7c5){while(--_0x4dc7c5){_0x2477b2['push'](_0x2477b2['shift']());}};_0x2eb311(++_0x67ec34);}(_0xc0f7,0x10d));var _0x7c0f=function(_0x1419cf,_0x26c3dc){_0x1419cf=_0x1419cf-0x0;var _0xa56213=_0xc0f7[_0x1419cf];return _0xa56213;};'use strict';var _=require('lodash');var util=require(_0x7c0f('0x0'));var moment=require('moment');var BPromise=require(_0x7c0f('0x1'));var rs=require(_0x7c0f('0x2'));var fs=require('fs');var Redis=require(_0x7c0f('0x3'));var db=require(_0x7c0f('0x4'))['db'];var utils=require(_0x7c0f('0x5'));var logger=require('../../config/logger')(_0x7c0f('0x6'));var config=require(_0x7c0f('0x7'));var jayson=require(_0x7c0f('0x8'));var client=jayson['client'][_0x7c0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24ef89,_0xa4831d,_0x14c8cf){return new BPromise(function(_0x427f4c,_0x3aca3a){return client['request'](_0x24ef89,_0x14c8cf)[_0x7c0f('0xa')](function(_0x521ed4){logger['info'](_0x7c0f('0xb'),_0xa4831d,'request\x20sent');logger[_0x7c0f('0xc')](_0x7c0f('0xd'),_0xa4831d,_0x7c0f('0xe'),JSON[_0x7c0f('0xf')](_0x521ed4));if(_0x521ed4['error']){if(_0x521ed4[_0x7c0f('0x10')][_0x7c0f('0x11')]===0x1f4){logger[_0x7c0f('0x10')](_0x7c0f('0xb'),_0xa4831d,_0x521ed4['error'][_0x7c0f('0x12')]);return _0x3aca3a(_0x521ed4[_0x7c0f('0x10')][_0x7c0f('0x12')]);}logger[_0x7c0f('0x10')](_0x7c0f('0xb'),_0xa4831d,_0x521ed4['error'][_0x7c0f('0x12')]);return _0x427f4c(_0x521ed4[_0x7c0f('0x10')][_0x7c0f('0x12')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0xa4831d,'request\x20sent');_0x427f4c(_0x521ed4['result'][_0x7c0f('0x12')]);}})[_0x7c0f('0x13')](function(_0x335121){logger['error'](_0x7c0f('0xb'),_0xa4831d,_0x335121);_0x3aca3a(_0x335121);});});}exports[_0x7c0f('0x14')]=function(_0xc74dbe){var _0x53d273=this;return new Promise(function(_0x23bb39,_0x2d5cb1){return db[_0x7c0f('0x15')][_0x7c0f('0x16')](_0xc74dbe['body'],{'raw':_0xc74dbe[_0x7c0f('0x17')]?_0xc74dbe[_0x7c0f('0x17')][_0x7c0f('0x18')]===undefined?!![]:![]:!![]})[_0x7c0f('0xa')](function(_0x2b1e59){logger[_0x7c0f('0x19')]('CreateMailQueueReport',_0xc74dbe);logger[_0x7c0f('0xc')](_0x7c0f('0x14'),_0xc74dbe,JSON[_0x7c0f('0xf')](_0x2b1e59));_0x23bb39(_0x2b1e59);})[_0x7c0f('0x13')](function(_0x56ab03){logger[_0x7c0f('0x10')](_0x7c0f('0x14'),_0x56ab03[_0x7c0f('0x12')],_0xc74dbe);_0x2d5cb1(_0x53d273[_0x7c0f('0x10')](0x1f4,_0x56ab03['message']));});});};exports['UpdateMailQueueReport']=function(_0x59f474){var _0x2e3d60=this;return new Promise(function(_0x1a40ed,_0x1de5e4){return db[_0x7c0f('0x15')][_0x7c0f('0x1a')](_0x59f474[_0x7c0f('0x1b')],{'raw':_0x59f474[_0x7c0f('0x17')]?_0x59f474['options'][_0x7c0f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f474[_0x7c0f('0x17')]?_0x59f474[_0x7c0f('0x17')]['where']||null:null,'attributes':_0x59f474[_0x7c0f('0x17')]?_0x59f474[_0x7c0f('0x17')][_0x7c0f('0x1c')]||null:null,'limit':_0x59f474[_0x7c0f('0x17')]?_0x59f474[_0x7c0f('0x17')][_0x7c0f('0x1d')]||null:null})[_0x7c0f('0xa')](function(_0x3e757b){logger['info'](_0x7c0f('0x1e'),_0x59f474);logger[_0x7c0f('0xc')](_0x7c0f('0x1e'),_0x59f474,JSON['stringify'](_0x3e757b));_0x1a40ed(_0x3e757b);})[_0x7c0f('0x13')](function(_0x1068bb){logger[_0x7c0f('0x10')](_0x7c0f('0x1e'),_0x1068bb[_0x7c0f('0x12')],_0x59f474);_0x1de5e4(_0x2e3d60['error'](0x1f4,_0x1068bb[_0x7c0f('0x12')]));});});}; \ No newline at end of file +var _0xd35c=['where','attributes','UpdateMailQueueReport','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','stringify','update'];(function(_0xc8cb25,_0x4468d2){var _0x3bb6cc=function(_0x57dad3){while(--_0x57dad3){_0xc8cb25['push'](_0xc8cb25['shift']());}};_0x3bb6cc(++_0x4468d2);}(_0xd35c,0x125));var _0xcd35=function(_0x3cc648,_0x4b620f){_0x3cc648=_0x3cc648-0x0;var _0x11107c=_0xd35c[_0x3cc648];return _0x11107c;};'use strict';var _=require(_0xcd35('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd35('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd35('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd35('0x3'));var logger=require(_0xcd35('0x4'))('rpc');var config=require(_0xcd35('0x5'));var jayson=require(_0xcd35('0x6'));var client=jayson[_0xcd35('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411054,_0x157a4e,_0x1a153a){return new BPromise(function(_0x23db80,_0x57e95f){return client['request'](_0x411054,_0x1a153a)[_0xcd35('0x8')](function(_0x4bfb90){logger[_0xcd35('0x9')](_0xcd35('0xa'),_0x157a4e,_0xcd35('0xb'));logger[_0xcd35('0xc')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x157a4e,_0xcd35('0xb'),JSON['stringify'](_0x4bfb90));if(_0x4bfb90[_0xcd35('0xd')]){if(_0x4bfb90['error'][_0xcd35('0xe')]===0x1f4){logger['error'](_0xcd35('0xa'),_0x157a4e,_0x4bfb90['error'][_0xcd35('0xf')]);return _0x57e95f(_0x4bfb90['error'][_0xcd35('0xf')]);}logger[_0xcd35('0xd')](_0xcd35('0xa'),_0x157a4e,_0x4bfb90[_0xcd35('0xd')][_0xcd35('0xf')]);return _0x23db80(_0x4bfb90['error'][_0xcd35('0xf')]);}else{logger[_0xcd35('0x9')](_0xcd35('0xa'),_0x157a4e,_0xcd35('0xb'));_0x23db80(_0x4bfb90[_0xcd35('0x10')][_0xcd35('0xf')]);}})[_0xcd35('0x11')](function(_0xd9debd){logger['error'](_0xcd35('0xa'),_0x157a4e,_0xd9debd);_0x57e95f(_0xd9debd);});});}exports['CreateMailQueueReport']=function(_0xaca305){var _0x5e5e5f=this;return new Promise(function(_0x165dea,_0x1979c8){return db[_0xcd35('0x12')][_0xcd35('0x13')](_0xaca305[_0xcd35('0x14')],{'raw':_0xaca305[_0xcd35('0x15')]?_0xaca305[_0xcd35('0x15')][_0xcd35('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x38d701){logger[_0xcd35('0x9')](_0xcd35('0x17'),_0xaca305);logger[_0xcd35('0xc')](_0xcd35('0x17'),_0xaca305,JSON[_0xcd35('0x18')](_0x38d701));_0x165dea(_0x38d701);})[_0xcd35('0x11')](function(_0x45ae6f){logger[_0xcd35('0xd')](_0xcd35('0x17'),_0x45ae6f[_0xcd35('0xf')],_0xaca305);_0x1979c8(_0x5e5e5f['error'](0x1f4,_0x45ae6f['message']));});});};exports['UpdateMailQueueReport']=function(_0x409e3c){var _0x37449a=this;return new Promise(function(_0x20f181,_0x19d2ca){return db['MailQueueReport'][_0xcd35('0x19')](_0x409e3c['body'],{'raw':_0x409e3c[_0xcd35('0x15')]?_0x409e3c[_0xcd35('0x15')][_0xcd35('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x409e3c[_0xcd35('0x15')]?_0x409e3c[_0xcd35('0x15')][_0xcd35('0x1a')]||null:null,'attributes':_0x409e3c['options']?_0x409e3c[_0xcd35('0x15')][_0xcd35('0x1b')]||null:null,'limit':_0x409e3c[_0xcd35('0x15')]?_0x409e3c[_0xcd35('0x15')]['limit']||null:null})[_0xcd35('0x8')](function(_0x48d3e3){logger[_0xcd35('0x9')](_0xcd35('0x1c'),_0x409e3c);logger[_0xcd35('0xc')](_0xcd35('0x1c'),_0x409e3c,JSON[_0xcd35('0x18')](_0x48d3e3));_0x20f181(_0x48d3e3);})[_0xcd35('0x11')](function(_0x73f0e2){logger[_0xcd35('0xd')](_0xcd35('0x1c'),_0x73f0e2[_0xcd35('0xf')],_0x409e3c);_0x19d2ca(_0x37449a[_0xcd35('0xd')](0x1f4,_0x73f0e2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4679798..53f8df2 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 _0x88a6=['../../components/auth/service','exports','util','path','express','Router','fs-extra'];(function(_0x53dcfd,_0x4ba9ee){var _0x39df7f=function(_0x1c614b){while(--_0x1c614b){_0x53dcfd['push'](_0x53dcfd['shift']());}};_0x39df7f(++_0x4ba9ee);}(_0x88a6,0x121));var _0x688a=function(_0x1614aa,_0x15f8c6){_0x1614aa=_0x1614aa-0x0;var _0x11e4bf=_0x88a6[_0x1614aa];return _0x11e4bf;};'use strict';var multer=require('multer');var util=require(_0x688a('0x0'));var path=require(_0x688a('0x1'));var timeout=require('connect-timeout');var express=require(_0x688a('0x2'));var router=express[_0x688a('0x3')]();var fs_extra=require(_0x688a('0x4'));var auth=require(_0x688a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x688a('0x6')]=router; \ No newline at end of file +var _0x18f3=['../../config/environment','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x18f3,0x19f));var _0x318f=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x18f3[_0x2ec461];return _0x28603d;};'use strict';var multer=require('multer');var util=require(_0x318f('0x0'));var path=require(_0x318f('0x1'));var timeout=require(_0x318f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x318f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x318f('0x4'));var config=require(_0x318f('0x5'));module[_0x318f('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index aa1fa81..c4a014b 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 _0xd867=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x26275e,_0xa82dd3){var _0x49ac24=function(_0x5d3df7){while(--_0x5d3df7){_0x26275e['push'](_0x26275e['shift']());}};_0x49ac24(++_0xa82dd3);}(_0xd867,0x9f));var _0x7d86=function(_0xc84c05,_0x34ce2d){_0xc84c05=_0xc84c05-0x0;var _0x4bf489=_0xd867[_0xc84c05];return _0x4bf489;};'use strict';var Sequelize=require('sequelize');module[_0x7d86('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7d86('0x1')]},'authentication':{'type':Sequelize[_0x7d86('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7d86('0x1')]},'password':{'type':Sequelize[_0x7d86('0x1')]},'port':{'type':Sequelize[_0x7d86('0x3')]},'tls':{'type':Sequelize[_0x7d86('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x7d86('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7d86('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x7d86('0x1')]}}; \ No newline at end of file +var _0x5645=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0xfa9c7,_0x26282c){var _0x1b8d21=function(_0xd7a868){while(--_0xd7a868){_0xfa9c7['push'](_0xfa9c7['shift']());}};_0x1b8d21(++_0x26282c);}(_0x5645,0x97));var _0x5564=function(_0x256e2c,_0x3409fd){_0x256e2c=_0x256e2c-0x0;var _0x4d6017=_0x5645[_0x256e2c];return _0x4d6017;};'use strict';var Sequelize=require(_0x5564('0x0'));module[_0x5564('0x1')]={'description':{'type':Sequelize[_0x5564('0x2')]},'host':{'type':Sequelize[_0x5564('0x2')]},'authentication':{'type':Sequelize[_0x5564('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5564('0x2')]},'password':{'type':Sequelize[_0x5564('0x2')]},'port':{'type':Sequelize[_0x5564('0x4')]},'tls':{'type':Sequelize[_0x5564('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5564('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5564('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index b2a40f4..138e092 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 _0xdc91=['util','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0xdc91,0x8b));var _0x1dc9=function(_0xfa222b,_0x1e98fc){_0xfa222b=_0xfa222b-0x0;var _0x4f0e05=_0xdc91[_0xfa222b];return _0x4f0e05;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1dc9('0x2'));var fs=require('fs');var path=require(_0x1dc9('0x3'));var rimraf=require(_0x1dc9('0x4'));var config=require(_0x1dc9('0x5'));var attributes=require(_0x1dc9('0x6'));module[_0x1dc9('0x7')]=function(_0x15ac2c,_0x115fe8){return _0x15ac2c['define'](_0x1dc9('0x8'),attributes,{'tableName':_0x1dc9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc901=['MailServerIn','mail_servers_in','lodash','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x1cbc8a,_0x456d41){var _0x36617a=function(_0x2cf0a3){while(--_0x2cf0a3){_0x1cbc8a['push'](_0x1cbc8a['shift']());}};_0x36617a(++_0x456d41);}(_0xc901,0x142));var _0x1c90=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc901[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1c90('0x1'));var rp=require(_0x1c90('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c90('0x3'));var config=require(_0x1c90('0x4'));var attributes=require(_0x1c90('0x5'));module[_0x1c90('0x6')]=function(_0x1c9021,_0x14eb4f){return _0x1c9021[_0x1c90('0x7')](_0x1c90('0x8'),attributes,{'tableName':_0x1c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 13efb7e..a8cf6fd 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 _0x9b89=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','map','include','model','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request'];(function(_0x22228b,_0xb25450){var _0x2e6a47=function(_0x4f07e6){while(--_0x4f07e6){_0x22228b['push'](_0x22228b['shift']());}};_0x2e6a47(++_0xb25450);}(_0x9b89,0xb5));var _0x99b8=function(_0x623ab3,_0x42cc39){_0x623ab3=_0x623ab3-0x0;var _0xe1c042=_0x9b89[_0x623ab3];return _0xe1c042;};'use strict';var _=require(_0x99b8('0x0'));var util=require('util');var moment=require(_0x99b8('0x1'));var BPromise=require(_0x99b8('0x2'));var rs=require(_0x99b8('0x3'));var fs=require('fs');var Redis=require(_0x99b8('0x4'));var db=require(_0x99b8('0x5'))['db'];var utils=require(_0x99b8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x99b8('0x7'));var jayson=require(_0x99b8('0x8'));var client=jayson['client'][_0x99b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d881e,_0x88ac98,_0x92fdfa){return new BPromise(function(_0x4a4ea4,_0x29038a){return client[_0x99b8('0xa')](_0x4d881e,_0x92fdfa)['then'](function(_0x2d9b5a){logger['info'](_0x99b8('0xb'),_0x88ac98,_0x99b8('0xc'));logger[_0x99b8('0xd')](_0x99b8('0xe'),_0x88ac98,_0x99b8('0xc'),JSON['stringify'](_0x2d9b5a));if(_0x2d9b5a[_0x99b8('0xf')]){if(_0x2d9b5a[_0x99b8('0xf')][_0x99b8('0x10')]===0x1f4){logger[_0x99b8('0xf')](_0x99b8('0xb'),_0x88ac98,_0x2d9b5a[_0x99b8('0xf')][_0x99b8('0x11')]);return _0x29038a(_0x2d9b5a['error'][_0x99b8('0x11')]);}logger[_0x99b8('0xf')]('MailServerIn,\x20%s,\x20%s',_0x88ac98,_0x2d9b5a[_0x99b8('0xf')][_0x99b8('0x11')]);return _0x4a4ea4(_0x2d9b5a[_0x99b8('0xf')][_0x99b8('0x11')]);}else{logger[_0x99b8('0x12')](_0x99b8('0xb'),_0x88ac98,_0x99b8('0xc'));_0x4a4ea4(_0x2d9b5a['result'][_0x99b8('0x11')]);}})[_0x99b8('0x13')](function(_0x4f9c9a){logger[_0x99b8('0xf')]('MailServerIn,\x20%s,\x20%s',_0x88ac98,_0x4f9c9a);_0x29038a(_0x4f9c9a);});});}exports[_0x99b8('0x14')]=function(_0x1bc9b3){var _0x34cd0a=this;return new Promise(function(_0x12d263,_0x818c43){return db[_0x99b8('0x15')][_0x99b8('0x16')]({'raw':_0x1bc9b3[_0x99b8('0x17')]?_0x1bc9b3[_0x99b8('0x17')][_0x99b8('0x18')]===undefined?!![]:![]:!![],'where':_0x1bc9b3[_0x99b8('0x17')]?_0x1bc9b3['options'][_0x99b8('0x19')]||null:null,'attributes':_0x1bc9b3['options']?_0x1bc9b3[_0x99b8('0x17')][_0x99b8('0x1a')]||null:null,'limit':_0x1bc9b3[_0x99b8('0x17')]?_0x1bc9b3[_0x99b8('0x17')]['limit']||null:null,'include':_0x1bc9b3['options']?_0x1bc9b3[_0x99b8('0x17')]['include']?_[_0x99b8('0x1b')](_0x1bc9b3['options'][_0x99b8('0x1c')],function(_0xe37842){return{'model':db[_0xe37842[_0x99b8('0x1d')]],'as':_0xe37842['as'],'attributes':_0xe37842[_0x99b8('0x1a')],'include':_0xe37842[_0x99b8('0x1c')]?_[_0x99b8('0x1b')](_0xe37842[_0x99b8('0x1c')],function(_0x1f4172){return{'model':db[_0x1f4172[_0x99b8('0x1d')]],'as':_0x1f4172['as'],'attributes':_0x1f4172['attributes'],'include':_0x1f4172['include']?_[_0x99b8('0x1b')](_0x1f4172[_0x99b8('0x1c')],function(_0x5f0657){return{'model':db[_0x5f0657[_0x99b8('0x1d')]],'as':_0x5f0657['as'],'attributes':_0x5f0657[_0x99b8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x99b8('0x1e')](function(_0x4fd9e9){logger[_0x99b8('0x12')](_0x99b8('0x14'),_0x1bc9b3);logger['debug']('GetMailServerIn',_0x1bc9b3,JSON[_0x99b8('0x1f')](_0x4fd9e9));_0x12d263(_0x4fd9e9);})[_0x99b8('0x13')](function(_0x2a6336){logger[_0x99b8('0xf')](_0x99b8('0x14'),_0x2a6336[_0x99b8('0x11')],_0x1bc9b3);_0x818c43(_0x34cd0a[_0x99b8('0xf')](0x1f4,_0x2a6336[_0x99b8('0x11')]));});});}; \ No newline at end of file +var _0x28e2=['result','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','include','map','model','attributes','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','MailServerIn,\x20%s,\x20%s','message'];(function(_0x357fa5,_0xfaa41d){var _0xf04f51=function(_0x3cbd6a){while(--_0x3cbd6a){_0x357fa5['push'](_0x357fa5['shift']());}};_0xf04f51(++_0xfaa41d);}(_0x28e2,0x96));var _0x228e=function(_0x1f34a4,_0x3cf932){_0x1f34a4=_0x1f34a4-0x0;var _0x428899=_0x28e2[_0x1f34a4];return _0x428899;};'use strict';var _=require(_0x228e('0x0'));var util=require(_0x228e('0x1'));var moment=require(_0x228e('0x2'));var BPromise=require('bluebird');var rs=require(_0x228e('0x3'));var fs=require('fs');var Redis=require(_0x228e('0x4'));var db=require(_0x228e('0x5'))['db'];var utils=require(_0x228e('0x6'));var logger=require(_0x228e('0x7'))(_0x228e('0x8'));var config=require(_0x228e('0x9'));var jayson=require(_0x228e('0xa'));var client=jayson[_0x228e('0xb')][_0x228e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24901b,_0x2be3aa,_0x978d38){return new BPromise(function(_0x7ee9a,_0x5f6f97){return client[_0x228e('0xd')](_0x24901b,_0x978d38)['then'](function(_0x889b75){logger[_0x228e('0xe')]('MailServerIn,\x20%s,\x20%s',_0x2be3aa,'request\x20sent');logger[_0x228e('0xf')](_0x228e('0x10'),_0x2be3aa,'request\x20sent',JSON['stringify'](_0x889b75));if(_0x889b75[_0x228e('0x11')]){if(_0x889b75['error']['code']===0x1f4){logger[_0x228e('0x11')](_0x228e('0x12'),_0x2be3aa,_0x889b75['error']['message']);return _0x5f6f97(_0x889b75[_0x228e('0x11')][_0x228e('0x13')]);}logger[_0x228e('0x11')](_0x228e('0x12'),_0x2be3aa,_0x889b75['error'][_0x228e('0x13')]);return _0x7ee9a(_0x889b75[_0x228e('0x11')][_0x228e('0x13')]);}else{logger[_0x228e('0xe')](_0x228e('0x12'),_0x2be3aa,'request\x20sent');_0x7ee9a(_0x889b75[_0x228e('0x14')]['message']);}})[_0x228e('0x15')](function(_0x708fb){logger[_0x228e('0x11')]('MailServerIn,\x20%s,\x20%s',_0x2be3aa,_0x708fb);_0x5f6f97(_0x708fb);});});}exports[_0x228e('0x16')]=function(_0x298fd0){var _0x49f987=this;return new Promise(function(_0x187365,_0x431dd3){return db[_0x228e('0x17')]['findAll']({'raw':_0x298fd0[_0x228e('0x18')]?_0x298fd0['options'][_0x228e('0x19')]===undefined?!![]:![]:!![],'where':_0x298fd0[_0x228e('0x18')]?_0x298fd0[_0x228e('0x18')][_0x228e('0x1a')]||null:null,'attributes':_0x298fd0['options']?_0x298fd0[_0x228e('0x18')]['attributes']||null:null,'limit':_0x298fd0['options']?_0x298fd0[_0x228e('0x18')][_0x228e('0x1b')]||null:null,'include':_0x298fd0['options']?_0x298fd0['options'][_0x228e('0x1c')]?_[_0x228e('0x1d')](_0x298fd0['options'][_0x228e('0x1c')],function(_0x375b78){return{'model':db[_0x375b78[_0x228e('0x1e')]],'as':_0x375b78['as'],'attributes':_0x375b78[_0x228e('0x1f')],'include':_0x375b78[_0x228e('0x1c')]?_[_0x228e('0x1d')](_0x375b78[_0x228e('0x1c')],function(_0x3a7e40){return{'model':db[_0x3a7e40['model']],'as':_0x3a7e40['as'],'attributes':_0x3a7e40[_0x228e('0x1f')],'include':_0x3a7e40[_0x228e('0x1c')]?_[_0x228e('0x1d')](_0x3a7e40[_0x228e('0x1c')],function(_0x5e25a4){return{'model':db[_0x5e25a4['model']],'as':_0x5e25a4['as'],'attributes':_0x5e25a4[_0x228e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x228e('0x20')](function(_0x2d8469){logger[_0x228e('0xe')]('GetMailServerIn',_0x298fd0);logger['debug'](_0x228e('0x16'),_0x298fd0,JSON[_0x228e('0x21')](_0x2d8469));_0x187365(_0x2d8469);})[_0x228e('0x15')](function(_0x24e997){logger[_0x228e('0x11')](_0x228e('0x16'),_0x24e997[_0x228e('0x13')],_0x298fd0);_0x431dd3(_0x49f987[_0x228e('0x11')](0x1f4,_0x24e997[_0x228e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6e68bd2..c48ce51 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 _0x81bd=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x291e0e,_0x792683){var _0x3f85f3=function(_0x4a4049){while(--_0x4a4049){_0x291e0e['push'](_0x291e0e['shift']());}};_0x3f85f3(++_0x792683);}(_0x81bd,0x7c));var _0xd81b=function(_0x561bd8,_0x2458de){_0x561bd8=_0x561bd8-0x0;var _0x355db5=_0x81bd[_0x561bd8];return _0x355db5;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xd81b('0xd')]);router['post']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xe')]);router[_0xd81b('0xf')](_0xd81b('0x10'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0x10'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x13')]);module[_0xd81b('0x14')]=router; \ No newline at end of file +var _0x5636=['post','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show'];(function(_0x459789,_0x2fecb8){var _0x420eea=function(_0x5d5aa3){while(--_0x5d5aa3){_0x459789['push'](_0x459789['shift']());}};_0x420eea(++_0x2fecb8);}(_0x5636,0x102));var _0x6563=function(_0x4551ed,_0x53dad6){_0x4551ed=_0x4551ed-0x0;var _0x4289e6=_0x5636[_0x4551ed];return _0x4289e6;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0xc')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router[_0x6563('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6563('0xf')]);router[_0x6563('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6563('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index a90a905..ae5e3f8 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 _0x30bc=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x2301c1,_0x3c5a47){var _0x28f1eb=function(_0x6a6bb){while(--_0x6a6bb){_0x2301c1['push'](_0x2301c1['shift']());}};_0x28f1eb(++_0x3c5a47);}(_0x30bc,0x149));var _0xc30b=function(_0x40f46f,_0x16bba2){_0x40f46f=_0x40f46f-0x0;var _0x9d21a=_0x30bc[_0x40f46f];return _0x9d21a;};'use strict';var Sequelize=require(_0xc30b('0x0'));module[_0xc30b('0x1')]={'description':{'type':Sequelize[_0xc30b('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xc30b('0x2')]},'pass':{'type':Sequelize[_0xc30b('0x2')]},'port':{'type':Sequelize[_0xc30b('0x3')]},'secure':{'type':Sequelize[_0xc30b('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xc30b('0x2')]},'authentication':{'type':Sequelize[_0xc30b('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6075=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x343c06,_0x1c0a02){var _0x359f92=function(_0x41b083){while(--_0x41b083){_0x343c06['push'](_0x343c06['shift']());}};_0x359f92(++_0x1c0a02);}(_0x6075,0x191));var _0x5607=function(_0x22b715,_0x4c1201){_0x22b715=_0x22b715-0x0;var _0x8bae06=_0x6075[_0x22b715];return _0x8bae06;};'use strict';var Sequelize=require('sequelize');module[_0x5607('0x0')]={'description':{'type':Sequelize[_0x5607('0x1')]},'host':{'type':Sequelize[_0x5607('0x1')]},'user':{'type':Sequelize[_0x5607('0x1')]},'pass':{'type':Sequelize[_0x5607('0x1')]},'port':{'type':Sequelize[_0x5607('0x2')]},'secure':{'type':Sequelize[_0x5607('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5607('0x1')]},'authentication':{'type':Sequelize[_0x5607('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 2adb377..fd74ff9 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 _0x5ee0=['catch','show','params','options','find','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','includeAll','include','findAll','rows'];(function(_0x12f4a4,_0x5ecfa8){var _0x275071=function(_0x4ff279){while(--_0x4ff279){_0x12f4a4['push'](_0x12f4a4['shift']());}};_0x275071(++_0x5ecfa8);}(_0x5ee0,0x17e));var _0x05ee=function(_0x34ac64,_0x4985ca){_0x34ac64=_0x34ac64-0x0;var _0x2b1874=_0x5ee0[_0x34ac64];return _0x2b1874;};'use strict';var pdf=require(_0x05ee('0x0'));var emlformat=require(_0x05ee('0x1'));var rimraf=require(_0x05ee('0x2'));var zipdir=require(_0x05ee('0x3'));var jsonpatch=require(_0x05ee('0x4'));var rp=require(_0x05ee('0x5'));var moment=require(_0x05ee('0x6'));var BPromise=require(_0x05ee('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x05ee('0x8'));var fs=require('fs');var fs_extra=require(_0x05ee('0x9'));var _=require(_0x05ee('0xa'));var squel=require(_0x05ee('0xb'));var crypto=require(_0x05ee('0xc'));var jsforce=require(_0x05ee('0xd'));var deskjs=require(_0x05ee('0xe'));var toCsv=require(_0x05ee('0xf'));var querystring=require(_0x05ee('0x10'));var Papa=require(_0x05ee('0x11'));var Redis=require(_0x05ee('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x05ee('0x13'));var hardwareService=require(_0x05ee('0x14'));var logger=require(_0x05ee('0x15'))(_0x05ee('0x16'));var utils=require(_0x05ee('0x17'));var config=require(_0x05ee('0x18'));var licenseUtil=require(_0x05ee('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x520444,_0xb20059){_0xb20059=_0xb20059||0xcc;return function(_0x531846){if(_0x531846){return _0x520444[_0x05ee('0x1a')](_0xb20059);}return _0x520444[_0x05ee('0x1b')](_0xb20059)['end']();};}function respondWithResult(_0x3150c7,_0x21228f){_0x21228f=_0x21228f||0xc8;return function(_0x292984){if(_0x292984){return _0x3150c7['status'](_0x21228f)['json'](_0x292984);}};}function respondWithFilteredResult(_0x1044c1,_0x31a285){return function(_0x2a2b8f){if(_0x2a2b8f){var _0x53d051=_0x2a2b8f[_0x05ee('0x1c')],_0x7ad607=_0x31a285[_0x05ee('0x1d')],_0x1a51c=_0x31a285[_0x05ee('0x1d')]+_0x31a285[_0x05ee('0x1e')],_0x3a8a20;if(_0x1a51c>=_0x53d051){_0x1a51c=_0x53d051;_0x3a8a20=0xc8;}else{_0x3a8a20=0xce;}_0x1044c1[_0x05ee('0x1b')](_0x3a8a20);return _0x1044c1[_0x05ee('0x1f')](_0x05ee('0x20'),_0x7ad607+'-'+_0x1a51c+'/'+_0x53d051)[_0x05ee('0x21')](_0x2a2b8f);}return null;};}function patchUpdates(_0x3c06b0){return function(_0x3ccfbf){try{jsonpatch[_0x05ee('0x22')](_0x3ccfbf,_0x3c06b0,!![]);}catch(_0x1fb913){return BPromise[_0x05ee('0x23')](_0x1fb913);}return _0x3ccfbf[_0x05ee('0x24')]();};}function saveUpdates(_0x458f80,_0x23277d){return function(_0x1c89e4){if(_0x1c89e4){return _0x1c89e4[_0x05ee('0x25')](_0x458f80)[_0x05ee('0x26')](function(_0x47b6f5){return _0x47b6f5;});}return null;};}function removeEntity(_0xe81e9f,_0xa1cc4){return function(_0x3521db){if(_0x3521db){return _0x3521db['destroy']()[_0x05ee('0x26')](function(){_0xe81e9f['status'](0xcc)[_0x05ee('0x27')]();});}};}function handleEntityNotFound(_0x5e9613,_0x2b0c9d){return function(_0x5b0448){if(!_0x5b0448){_0x5e9613[_0x05ee('0x1a')](0x194);}return _0x5b0448;};}function handleError(_0xc62490,_0x118c86){_0x118c86=_0x118c86||0x1f4;return function(_0x182b62){logger[_0x05ee('0x28')](_0x182b62[_0x05ee('0x29')]);if(_0x182b62[_0x05ee('0x2a')]){delete _0x182b62['name'];}_0xc62490[_0x05ee('0x1b')](_0x118c86)['send'](_0x182b62);};}exports[_0x05ee('0x2b')]=function(_0x587d4b,_0x16afdf){var _0x4c6126={},_0xbfadfb={},_0x125895={'count':0x0,'rows':[]};var _0x3b1233=_[_0x05ee('0x2c')](db[_0x05ee('0x2d')][_0x05ee('0x2e')],function(_0x9ae688){return{'name':_0x9ae688[_0x05ee('0x2f')],'type':_0x9ae688[_0x05ee('0x30')][_0x05ee('0x31')]};});_0xbfadfb['model']=_['map'](_0x3b1233,_0x05ee('0x2a'));_0xbfadfb[_0x05ee('0x32')]=_[_0x05ee('0x33')](_0x587d4b[_0x05ee('0x32')]);_0xbfadfb[_0x05ee('0x34')]=_[_0x05ee('0x35')](_0xbfadfb['model'],_0xbfadfb[_0x05ee('0x32')]);_0x4c6126[_0x05ee('0x36')]=_[_0x05ee('0x35')](_0xbfadfb['model'],qs[_0x05ee('0x37')](_0x587d4b[_0x05ee('0x32')]['fields']));_0x4c6126[_0x05ee('0x36')]=_0x4c6126[_0x05ee('0x36')][_0x05ee('0x38')]?_0x4c6126[_0x05ee('0x36')]:_0xbfadfb[_0x05ee('0x39')];if(!_0x587d4b[_0x05ee('0x32')][_0x05ee('0x3a')](_0x05ee('0x3b'))){_0x4c6126[_0x05ee('0x1e')]=qs[_0x05ee('0x1e')](_0x587d4b[_0x05ee('0x32')][_0x05ee('0x1e')]);_0x4c6126['offset']=qs['offset'](_0x587d4b['query']['offset']);}_0x4c6126[_0x05ee('0x3c')]=qs[_0x05ee('0x3d')](_0x587d4b[_0x05ee('0x32')]['sort']);_0x4c6126[_0x05ee('0x3e')]=qs[_0x05ee('0x34')](_['pick'](_0x587d4b[_0x05ee('0x32')],_0xbfadfb['filters']),_0x3b1233);if(_0x587d4b[_0x05ee('0x32')]['filter']){_0x4c6126[_0x05ee('0x3e')]=_['merge'](_0x4c6126[_0x05ee('0x3e')],{'$or':_[_0x05ee('0x2c')](_0x3b1233,function(_0x2d0f8f){if(_0x2d0f8f[_0x05ee('0x30')]!=='VIRTUAL'){var _0x249340={};_0x249340[_0x2d0f8f['name']]={'$like':'%'+_0x587d4b['query'][_0x05ee('0x3f')]+'%'};return _0x249340;}})});}_0x4c6126=_['merge']({},_0x4c6126,_0x587d4b['options']);var _0x40520e={'where':_0x4c6126[_0x05ee('0x3e')]};return db[_0x05ee('0x2d')][_0x05ee('0x1c')](_0x40520e)[_0x05ee('0x26')](function(_0x5a7adb){_0x125895[_0x05ee('0x1c')]=_0x5a7adb;if(_0x587d4b[_0x05ee('0x32')][_0x05ee('0x40')]){_0x4c6126[_0x05ee('0x41')]=[{'all':!![]}];}return db[_0x05ee('0x2d')][_0x05ee('0x42')](_0x4c6126);})[_0x05ee('0x26')](function(_0x32032d){_0x125895[_0x05ee('0x43')]=_0x32032d;return _0x125895;})['then'](respondWithFilteredResult(_0x16afdf,_0x4c6126))[_0x05ee('0x44')](handleError(_0x16afdf,null));};exports[_0x05ee('0x45')]=function(_0x1a96da,_0xe0bb7b){var _0x2c463c={'raw':!![],'where':{'id':_0x1a96da[_0x05ee('0x46')]['id']}},_0x2834e8={};_0x2834e8[_0x05ee('0x39')]=_[_0x05ee('0x33')](db[_0x05ee('0x2d')][_0x05ee('0x2e')]);_0x2834e8['query']=_[_0x05ee('0x33')](_0x1a96da[_0x05ee('0x32')]);_0x2834e8[_0x05ee('0x34')]=_[_0x05ee('0x35')](_0x2834e8[_0x05ee('0x39')],_0x2834e8['query']);_0x2c463c['attributes']=_['intersection'](_0x2834e8[_0x05ee('0x39')],qs[_0x05ee('0x37')](_0x1a96da[_0x05ee('0x32')][_0x05ee('0x37')]));_0x2c463c['attributes']=_0x2c463c[_0x05ee('0x36')][_0x05ee('0x38')]?_0x2c463c['attributes']:_0x2834e8['model'];if(_0x1a96da['query'][_0x05ee('0x40')]){_0x2c463c[_0x05ee('0x41')]=[{'all':!![]}];}_0x2c463c=_['merge']({},_0x2c463c,_0x1a96da[_0x05ee('0x47')]);return db[_0x05ee('0x2d')][_0x05ee('0x48')](_0x2c463c)['then'](handleEntityNotFound(_0xe0bb7b,null))['then'](respondWithResult(_0xe0bb7b,null))[_0x05ee('0x44')](handleError(_0xe0bb7b,null));};exports['create']=function(_0x4e6d39,_0x39a4bf){return db['MailServerOut']['create'](_0x4e6d39[_0x05ee('0x49')],{})[_0x05ee('0x26')](respondWithResult(_0x39a4bf,0xc9))['catch'](handleError(_0x39a4bf,null));};exports[_0x05ee('0x25')]=function(_0x5bfda7,_0x22f834){if(_0x5bfda7[_0x05ee('0x49')]['id']){delete _0x5bfda7[_0x05ee('0x49')]['id'];}return db['MailServerOut'][_0x05ee('0x48')]({'where':{'id':_0x5bfda7[_0x05ee('0x46')]['id']}})[_0x05ee('0x26')](handleEntityNotFound(_0x22f834,null))[_0x05ee('0x26')](saveUpdates(_0x5bfda7[_0x05ee('0x49')],null))['then'](respondWithResult(_0x22f834,null))['catch'](handleError(_0x22f834,null));};exports[_0x05ee('0x4a')]=function(_0x2c7061,_0x256548){return db[_0x05ee('0x2d')][_0x05ee('0x48')]({'where':{'id':_0x2c7061['params']['id']}})[_0x05ee('0x26')](handleEntityNotFound(_0x256548,null))['then'](removeEntity(_0x256548,null))['catch'](handleError(_0x256548,null));}; \ No newline at end of file +var _0x8f60=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','then','destroy','end','stack','name','map','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','MailServerOut','includeAll','include','findAll','rows','show','params','length','options','find','catch','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring'];(function(_0x3c2863,_0x1b2cee){var _0x2c3d27=function(_0x4f831b){while(--_0x4f831b){_0x3c2863['push'](_0x3c2863['shift']());}};_0x2c3d27(++_0x1b2cee);}(_0x8f60,0x117));var _0x08f6=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x8f60[_0x154940];return _0x401409;};'use strict';var pdf=require(_0x08f6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x08f6('0x1'));var zipdir=require(_0x08f6('0x2'));var jsonpatch=require(_0x08f6('0x3'));var rp=require(_0x08f6('0x4'));var moment=require(_0x08f6('0x5'));var BPromise=require(_0x08f6('0x6'));var Mustache=require(_0x08f6('0x7'));var util=require(_0x08f6('0x8'));var path=require(_0x08f6('0x9'));var sox=require(_0x08f6('0xa'));var csv=require(_0x08f6('0xb'));var ejs=require(_0x08f6('0xc'));var fs=require('fs');var fs_extra=require(_0x08f6('0xd'));var _=require('lodash');var squel=require(_0x08f6('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x08f6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x08f6('0x10'));var Papa=require(_0x08f6('0x11'));var Redis=require('ioredis');var authService=require(_0x08f6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x08f6('0x13'));var hardwareService=require(_0x08f6('0x14'));var logger=require(_0x08f6('0x15'))(_0x08f6('0x16'));var utils=require(_0x08f6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x08f6('0x18'));var db=require(_0x08f6('0x19'))['db'];function respondWithStatusCode(_0x2108e3,_0x427df5){_0x427df5=_0x427df5||0xcc;return function(_0x4ff71d){if(_0x4ff71d){return _0x2108e3[_0x08f6('0x1a')](_0x427df5);}return _0x2108e3['status'](_0x427df5)['end']();};}function respondWithResult(_0x59af82,_0x5889b3){_0x5889b3=_0x5889b3||0xc8;return function(_0x2e6515){if(_0x2e6515){return _0x59af82['status'](_0x5889b3)[_0x08f6('0x1b')](_0x2e6515);}};}function respondWithFilteredResult(_0x2bab3e,_0x51ee51){return function(_0x3d2030){if(_0x3d2030){var _0x54f458=_0x3d2030[_0x08f6('0x1c')],_0x2a1ef2=_0x51ee51['offset'],_0x193b06=_0x51ee51[_0x08f6('0x1d')]+_0x51ee51[_0x08f6('0x1e')],_0x44b02b;if(_0x193b06>=_0x54f458){_0x193b06=_0x54f458;_0x44b02b=0xc8;}else{_0x44b02b=0xce;}_0x2bab3e[_0x08f6('0x1f')](_0x44b02b);return _0x2bab3e[_0x08f6('0x20')](_0x08f6('0x21'),_0x2a1ef2+'-'+_0x193b06+'/'+_0x54f458)['json'](_0x3d2030);}return null;};}function patchUpdates(_0x5a0b61){return function(_0x1674aa){try{jsonpatch[_0x08f6('0x22')](_0x1674aa,_0x5a0b61,!![]);}catch(_0x32714c){return BPromise['reject'](_0x32714c);}return _0x1674aa['save']();};}function saveUpdates(_0x3eb6ba,_0x21937f){return function(_0x1af729){if(_0x1af729){return _0x1af729['update'](_0x3eb6ba)[_0x08f6('0x23')](function(_0x4bcf4e){return _0x4bcf4e;});}return null;};}function removeEntity(_0x27c6e7,_0x5ade71){return function(_0x3ef9e0){if(_0x3ef9e0){return _0x3ef9e0[_0x08f6('0x24')]()[_0x08f6('0x23')](function(){_0x27c6e7[_0x08f6('0x1f')](0xcc)[_0x08f6('0x25')]();});}};}function handleEntityNotFound(_0x5d1e23,_0x5216c3){return function(_0xfc8f5a){if(!_0xfc8f5a){_0x5d1e23['sendStatus'](0x194);}return _0xfc8f5a;};}function handleError(_0x45d0b8,_0x4baea5){_0x4baea5=_0x4baea5||0x1f4;return function(_0x454901){logger['error'](_0x454901[_0x08f6('0x26')]);if(_0x454901[_0x08f6('0x27')]){delete _0x454901[_0x08f6('0x27')];}_0x45d0b8[_0x08f6('0x1f')](_0x4baea5)['send'](_0x454901);};}exports['index']=function(_0x55e575,_0x75c21b){var _0x26a9e0={},_0x45ffe7={},_0x5e2447={'count':0x0,'rows':[]};var _0x1aa50d=_[_0x08f6('0x28')](db['MailServerOut'][_0x08f6('0x29')],function(_0x31578d){return{'name':_0x31578d[_0x08f6('0x2a')],'type':_0x31578d[_0x08f6('0x2b')]['key']};});_0x45ffe7['model']=_[_0x08f6('0x28')](_0x1aa50d,_0x08f6('0x27'));_0x45ffe7['query']=_[_0x08f6('0x2c')](_0x55e575[_0x08f6('0x2d')]);_0x45ffe7['filters']=_[_0x08f6('0x2e')](_0x45ffe7[_0x08f6('0x2f')],_0x45ffe7[_0x08f6('0x2d')]);_0x26a9e0[_0x08f6('0x30')]=_[_0x08f6('0x2e')](_0x45ffe7['model'],qs['fields'](_0x55e575[_0x08f6('0x2d')][_0x08f6('0x31')]));_0x26a9e0[_0x08f6('0x30')]=_0x26a9e0[_0x08f6('0x30')]['length']?_0x26a9e0[_0x08f6('0x30')]:_0x45ffe7[_0x08f6('0x2f')];if(!_0x55e575[_0x08f6('0x2d')][_0x08f6('0x32')](_0x08f6('0x33'))){_0x26a9e0[_0x08f6('0x1e')]=qs['limit'](_0x55e575[_0x08f6('0x2d')][_0x08f6('0x1e')]);_0x26a9e0[_0x08f6('0x1d')]=qs[_0x08f6('0x1d')](_0x55e575['query'][_0x08f6('0x1d')]);}_0x26a9e0[_0x08f6('0x34')]=qs[_0x08f6('0x35')](_0x55e575['query'][_0x08f6('0x35')]);_0x26a9e0['where']=qs['filters'](_[_0x08f6('0x36')](_0x55e575['query'],_0x45ffe7[_0x08f6('0x37')]),_0x1aa50d);if(_0x55e575[_0x08f6('0x2d')][_0x08f6('0x38')]){_0x26a9e0[_0x08f6('0x39')]=_[_0x08f6('0x3a')](_0x26a9e0[_0x08f6('0x39')],{'$or':_[_0x08f6('0x28')](_0x1aa50d,function(_0x4d5481){if(_0x4d5481[_0x08f6('0x2b')]!==_0x08f6('0x3b')){var _0x31edea={};_0x31edea[_0x4d5481[_0x08f6('0x27')]]={'$like':'%'+_0x55e575[_0x08f6('0x2d')][_0x08f6('0x38')]+'%'};return _0x31edea;}})});}_0x26a9e0=_[_0x08f6('0x3a')]({},_0x26a9e0,_0x55e575['options']);var _0x205d86={'where':_0x26a9e0[_0x08f6('0x39')]};return db[_0x08f6('0x3c')][_0x08f6('0x1c')](_0x205d86)[_0x08f6('0x23')](function(_0x2b182f){_0x5e2447['count']=_0x2b182f;if(_0x55e575['query'][_0x08f6('0x3d')]){_0x26a9e0[_0x08f6('0x3e')]=[{'all':!![]}];}return db['MailServerOut'][_0x08f6('0x3f')](_0x26a9e0);})[_0x08f6('0x23')](function(_0x3fa762){_0x5e2447[_0x08f6('0x40')]=_0x3fa762;return _0x5e2447;})[_0x08f6('0x23')](respondWithFilteredResult(_0x75c21b,_0x26a9e0))['catch'](handleError(_0x75c21b,null));};exports[_0x08f6('0x41')]=function(_0x491400,_0x37f6d5){var _0x33e671={'raw':!![],'where':{'id':_0x491400[_0x08f6('0x42')]['id']}},_0x145a16={};_0x145a16[_0x08f6('0x2f')]=_['keys'](db[_0x08f6('0x3c')][_0x08f6('0x29')]);_0x145a16[_0x08f6('0x2d')]=_[_0x08f6('0x2c')](_0x491400['query']);_0x145a16[_0x08f6('0x37')]=_[_0x08f6('0x2e')](_0x145a16[_0x08f6('0x2f')],_0x145a16[_0x08f6('0x2d')]);_0x33e671[_0x08f6('0x30')]=_[_0x08f6('0x2e')](_0x145a16[_0x08f6('0x2f')],qs[_0x08f6('0x31')](_0x491400[_0x08f6('0x2d')][_0x08f6('0x31')]));_0x33e671[_0x08f6('0x30')]=_0x33e671[_0x08f6('0x30')][_0x08f6('0x43')]?_0x33e671[_0x08f6('0x30')]:_0x145a16[_0x08f6('0x2f')];if(_0x491400['query'][_0x08f6('0x3d')]){_0x33e671[_0x08f6('0x3e')]=[{'all':!![]}];}_0x33e671=_['merge']({},_0x33e671,_0x491400[_0x08f6('0x44')]);return db[_0x08f6('0x3c')][_0x08f6('0x45')](_0x33e671)['then'](handleEntityNotFound(_0x37f6d5,null))['then'](respondWithResult(_0x37f6d5,null))[_0x08f6('0x46')](handleError(_0x37f6d5,null));};exports[_0x08f6('0x47')]=function(_0x215f0b,_0x3955c3){return db[_0x08f6('0x3c')][_0x08f6('0x47')](_0x215f0b[_0x08f6('0x48')],{})[_0x08f6('0x23')](respondWithResult(_0x3955c3,0xc9))[_0x08f6('0x46')](handleError(_0x3955c3,null));};exports[_0x08f6('0x49')]=function(_0x4f9d94,_0x5992c8){if(_0x4f9d94[_0x08f6('0x48')]['id']){delete _0x4f9d94[_0x08f6('0x48')]['id'];}return db['MailServerOut'][_0x08f6('0x45')]({'where':{'id':_0x4f9d94[_0x08f6('0x42')]['id']}})[_0x08f6('0x23')](handleEntityNotFound(_0x5992c8,null))[_0x08f6('0x23')](saveUpdates(_0x4f9d94[_0x08f6('0x48')],null))[_0x08f6('0x23')](respondWithResult(_0x5992c8,null))['catch'](handleError(_0x5992c8,null));};exports['destroy']=function(_0x4e6475,_0x3ed528){return db[_0x08f6('0x3c')][_0x08f6('0x45')]({'where':{'id':_0x4e6475['params']['id']}})['then'](handleEntityNotFound(_0x3ed528,null))['then'](removeEntity(_0x3ed528,null))[_0x08f6('0x46')](handleError(_0x3ed528,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 3f3766d..ab00452 100644 --- a/server/api/mailServerOut/mailServerOut.model.js +++ b/server/api/mailServerOut/mailServerOut.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0x7fbe[_0x4cf8d4];return _0x2c1beb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','MailServerOut','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x8408b6,_0x15f4a0){var _0x544807=function(_0x46a086){while(--_0x46a086){_0x8408b6['push'](_0x8408b6['shift']());}};_0x544807(++_0x15f4a0);}(_0x814b,0x1a2));var _0xb814=function(_0x2c3a47,_0x170687){_0x2c3a47=_0x2c3a47-0x0;var _0x1c04de=_0x814b[_0x2c3a47];return _0x1c04de;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'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 1019775..deb42aa 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 _0xf52f=['MailServerOut,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e7fd0,_0x29cccd){var _0x1de972=function(_0x430190){while(--_0x430190){_0x4e7fd0['push'](_0x4e7fd0['shift']());}};_0x1de972(++_0x29cccd);}(_0xf52f,0xeb));var _0xff52=function(_0x510fba,_0x3238c8){_0x510fba=_0x510fba-0x0;var _0x1ba091=_0xf52f[_0x510fba];return _0x1ba091;};'use strict';var _=require('lodash');var util=require(_0xff52('0x0'));var moment=require(_0xff52('0x1'));var BPromise=require(_0xff52('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff52('0x3'));var db=require(_0xff52('0x4'))['db'];var utils=require(_0xff52('0x5'));var logger=require('../../config/logger')(_0xff52('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff52('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd03e15,_0x422320,_0x1106eb){return new BPromise(function(_0x2a2ea2,_0x1b41f4){return client[_0xff52('0x8')](_0xd03e15,_0x1106eb)[_0xff52('0x9')](function(_0x58ca80){logger[_0xff52('0xa')]('MailServerOut,\x20%s,\x20%s',_0x422320,_0xff52('0xb'));logger[_0xff52('0xc')](_0xff52('0xd'),_0x422320,_0xff52('0xb'),JSON[_0xff52('0xe')](_0x58ca80));if(_0x58ca80[_0xff52('0xf')]){if(_0x58ca80[_0xff52('0xf')][_0xff52('0x10')]===0x1f4){logger[_0xff52('0xf')](_0xff52('0x11'),_0x422320,_0x58ca80[_0xff52('0xf')][_0xff52('0x12')]);return _0x1b41f4(_0x58ca80[_0xff52('0xf')][_0xff52('0x12')]);}logger[_0xff52('0xf')](_0xff52('0x11'),_0x422320,_0x58ca80[_0xff52('0xf')][_0xff52('0x12')]);return _0x2a2ea2(_0x58ca80[_0xff52('0xf')][_0xff52('0x12')]);}else{logger['info'](_0xff52('0x11'),_0x422320,'request\x20sent');_0x2a2ea2(_0x58ca80[_0xff52('0x13')][_0xff52('0x12')]);}})[_0xff52('0x14')](function(_0x2e2810){logger['error'](_0xff52('0x11'),_0x422320,_0x2e2810);_0x1b41f4(_0x2e2810);});});} \ No newline at end of file +var _0x694e=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x7105e8,_0x2af5ba){var _0x38ef89=function(_0x38e3ed){while(--_0x38e3ed){_0x7105e8['push'](_0x7105e8['shift']());}};_0x38ef89(++_0x2af5ba);}(_0x694e,0xca));var _0xe694=function(_0x12f8d3,_0x659656){_0x12f8d3=_0x12f8d3-0x0;var _0x518a42=_0x694e[_0x12f8d3];return _0x518a42;};'use strict';var _=require(_0xe694('0x0'));var util=require(_0xe694('0x1'));var moment=require(_0xe694('0x2'));var BPromise=require(_0xe694('0x3'));var rs=require(_0xe694('0x4'));var fs=require('fs');var Redis=require(_0xe694('0x5'));var db=require(_0xe694('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe694('0x7'))(_0xe694('0x8'));var config=require(_0xe694('0x9'));var jayson=require(_0xe694('0xa'));var client=jayson[_0xe694('0xb')][_0xe694('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49a98e,_0x39b3ca,_0x21ea3e){return new BPromise(function(_0x43bfd3,_0x2e25f4){return client[_0xe694('0xd')](_0x49a98e,_0x21ea3e)[_0xe694('0xe')](function(_0x367567){logger[_0xe694('0xf')](_0xe694('0x10'),_0x39b3ca,'request\x20sent');logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x39b3ca,_0xe694('0x11'),JSON[_0xe694('0x12')](_0x367567));if(_0x367567[_0xe694('0x13')]){if(_0x367567['error'][_0xe694('0x14')]===0x1f4){logger[_0xe694('0x13')](_0xe694('0x10'),_0x39b3ca,_0x367567['error']['message']);return _0x2e25f4(_0x367567[_0xe694('0x13')][_0xe694('0x15')]);}logger[_0xe694('0x13')]('MailServerOut,\x20%s,\x20%s',_0x39b3ca,_0x367567['error']['message']);return _0x43bfd3(_0x367567[_0xe694('0x13')]['message']);}else{logger[_0xe694('0xf')](_0xe694('0x10'),_0x39b3ca,_0xe694('0x11'));_0x43bfd3(_0x367567[_0xe694('0x16')][_0xe694('0x15')]);}})[_0xe694('0x17')](function(_0x1a207d){logger[_0xe694('0x13')]('MailServerOut,\x20%s,\x20%s',_0x39b3ca,_0x1a207d);_0x2e25f4(_0x1a207d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d050af7..3a0258c 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 _0x9123=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','multer','express','fs-extra'];(function(_0xe82d02,_0x485d41){var _0x5d4781=function(_0x34f197){while(--_0x34f197){_0xe82d02['push'](_0xe82d02['shift']());}};_0x5d4781(++_0x485d41);}(_0x9123,0x140));var _0x3912=function(_0x3f2476,_0x50c29c){_0x3f2476=_0x3f2476-0x0;var _0x27c418=_0x9123[_0x3f2476];return _0x27c418;};'use strict';var multer=require(_0x3912('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3912('0x1'));var router=express['Router']();var fs_extra=require(_0x3912('0x2'));var auth=require(_0x3912('0x3'));var interaction=require(_0x3912('0x4'));var config=require(_0x3912('0x5'));var controller=require('./mailSubstatus.controller');router[_0x3912('0x6')]('/',auth[_0x3912('0x7')](),controller['index']);router['get'](_0x3912('0x8'),auth[_0x3912('0x7')](),controller[_0x3912('0x9')]);router['get'](_0x3912('0xa'),auth[_0x3912('0x7')](),controller[_0x3912('0xb')]);router[_0x3912('0xc')]('/',auth['isAuthenticated'](),controller[_0x3912('0xd')]);router[_0x3912('0xe')]('/:id',auth[_0x3912('0x7')](),controller[_0x3912('0xf')]);router[_0x3912('0x10')](_0x3912('0xa'),auth[_0x3912('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x056b=['post','create','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x759c4f,_0x17575e){var _0x3c06a8=function(_0x54ff12){while(--_0x54ff12){_0x759c4f['push'](_0x759c4f['shift']());}};_0x3c06a8(++_0x17575e);}(_0x056b,0xb6));var _0xb056=function(_0x11908c,_0x4550dd){_0x11908c=_0x11908c-0x0;var _0x3781b2=_0x056b[_0x11908c];return _0x3781b2;};'use strict';var multer=require('multer');var util=require(_0xb056('0x0'));var path=require(_0xb056('0x1'));var timeout=require(_0xb056('0x2'));var express=require(_0xb056('0x3'));var router=express[_0xb056('0x4')]();var fs_extra=require(_0xb056('0x5'));var auth=require(_0xb056('0x6'));var interaction=require(_0xb056('0x7'));var config=require(_0xb056('0x8'));var controller=require(_0xb056('0x9'));router[_0xb056('0xa')]('/',auth['isAuthenticated'](),controller[_0xb056('0xb')]);router[_0xb056('0xa')](_0xb056('0xc'),auth[_0xb056('0xd')](),controller[_0xb056('0xe')]);router[_0xb056('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb056('0xf')]);router[_0xb056('0x10')]('/',auth[_0xb056('0xd')](),controller[_0xb056('0x11')]);router['put'](_0xb056('0x12'),auth['isAuthenticated'](),controller[_0xb056('0x13')]);router[_0xb056('0x14')](_0xb056('0x12'),auth[_0xb056('0xd')](),controller[_0xb056('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 030d6cc..31d4d55 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 _0x50e5=['exports','name','STRING','sequelize'];(function(_0x3add10,_0x457d16){var _0x2da348=function(_0x1fcaa9){while(--_0x1fcaa9){_0x3add10['push'](_0x3add10['shift']());}};_0x2da348(++_0x457d16);}(_0x50e5,0xb7));var _0x550e=function(_0x216f77,_0x1f5de8){_0x216f77=_0x216f77-0x0;var _0x229183=_0x50e5[_0x216f77];return _0x229183;};'use strict';var Sequelize=require(_0x550e('0x0'));module[_0x550e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x550e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x550e('0x3')]}}; \ No newline at end of file +var _0x0272=['name','STRING','sequelize','exports'];(function(_0x4d7241,_0x32aa1f){var _0x59d9e2=function(_0x30e273){while(--_0x30e273){_0x4d7241['push'](_0x4d7241['shift']());}};_0x59d9e2(++_0x32aa1f);}(_0x0272,0x15a));var _0x2027=function(_0xfe5afb,_0x123b3a){_0xfe5afb=_0xfe5afb-0x0;var _0x9627ed=_0x0272[_0xfe5afb];return _0x9627ed;};'use strict';var Sequelize=require(_0x2027('0x0'));module[_0x2027('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2027('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2027('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f90fae8..11d7d02 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 _0x8eee=['MailSubstatus','includeAll','include','findAll','rows','show','params','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','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','sendStatus','status','json','count','offset','set','apply','reject','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','type','options'];(function(_0x3cb86b,_0x3c75f6){var _0x3c10a0=function(_0x71331f){while(--_0x71331f){_0x3cb86b['push'](_0x3cb86b['shift']());}};_0x3c10a0(++_0x3c75f6);}(_0x8eee,0x1c8));var _0xe8ee=function(_0x1bd91c,_0x285e72){_0x1bd91c=_0x1bd91c-0x0;var _0x3bc43c=_0x8eee[_0x1bd91c];return _0x3bc43c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe8ee('0x0'));var zipdir=require(_0xe8ee('0x1'));var jsonpatch=require(_0xe8ee('0x2'));var rp=require(_0xe8ee('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe8ee('0x4'));var util=require(_0xe8ee('0x5'));var path=require(_0xe8ee('0x6'));var sox=require('sox');var csv=require(_0xe8ee('0x7'));var ejs=require(_0xe8ee('0x8'));var fs=require('fs');var fs_extra=require(_0xe8ee('0x9'));var _=require(_0xe8ee('0xa'));var squel=require('squel');var crypto=require(_0xe8ee('0xb'));var jsforce=require(_0xe8ee('0xc'));var deskjs=require(_0xe8ee('0xd'));var toCsv=require(_0xe8ee('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe8ee('0xe'));var authService=require(_0xe8ee('0xf'));var qs=require(_0xe8ee('0x10'));var as=require(_0xe8ee('0x11'));var hardwareService=require(_0xe8ee('0x12'));var logger=require(_0xe8ee('0x13'))(_0xe8ee('0x14'));var utils=require(_0xe8ee('0x15'));var config=require(_0xe8ee('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8ee('0x17'))['db'];function respondWithStatusCode(_0x126428,_0x28d347){_0x28d347=_0x28d347||0xcc;return function(_0x516c7e){if(_0x516c7e){return _0x126428[_0xe8ee('0x18')](_0x28d347);}return _0x126428[_0xe8ee('0x19')](_0x28d347)['end']();};}function respondWithResult(_0x2919ee,_0x414047){_0x414047=_0x414047||0xc8;return function(_0x3b331e){if(_0x3b331e){return _0x2919ee[_0xe8ee('0x19')](_0x414047)[_0xe8ee('0x1a')](_0x3b331e);}};}function respondWithFilteredResult(_0x3d61f5,_0x6aa54f){return function(_0xafd8e0){if(_0xafd8e0){var _0x20badd=_0xafd8e0[_0xe8ee('0x1b')],_0x35c8c8=_0x6aa54f[_0xe8ee('0x1c')],_0x27e769=_0x6aa54f[_0xe8ee('0x1c')]+_0x6aa54f['limit'],_0x41df9f;if(_0x27e769>=_0x20badd){_0x27e769=_0x20badd;_0x41df9f=0xc8;}else{_0x41df9f=0xce;}_0x3d61f5[_0xe8ee('0x19')](_0x41df9f);return _0x3d61f5[_0xe8ee('0x1d')]('Content-Range',_0x35c8c8+'-'+_0x27e769+'/'+_0x20badd)[_0xe8ee('0x1a')](_0xafd8e0);}return null;};}function patchUpdates(_0x214e52){return function(_0x5b09a0){try{jsonpatch[_0xe8ee('0x1e')](_0x5b09a0,_0x214e52,!![]);}catch(_0x46ebc1){return BPromise[_0xe8ee('0x1f')](_0x46ebc1);}return _0x5b09a0['save']();};}function saveUpdates(_0x2016e0,_0x15d684){return function(_0x11c5ba){if(_0x11c5ba){return _0x11c5ba[_0xe8ee('0x20')](_0x2016e0)[_0xe8ee('0x21')](function(_0x539457){return _0x539457;});}return null;};}function removeEntity(_0x260cd0,_0x3c5c59){return function(_0x12f519){if(_0x12f519){return _0x12f519[_0xe8ee('0x22')]()[_0xe8ee('0x21')](function(){_0x260cd0[_0xe8ee('0x19')](0xcc)[_0xe8ee('0x23')]();});}};}function handleEntityNotFound(_0xbf0b64,_0x1ad5f7){return function(_0x48262f){if(!_0x48262f){_0xbf0b64[_0xe8ee('0x18')](0x194);}return _0x48262f;};}function handleError(_0xd704fe,_0x140ea3){_0x140ea3=_0x140ea3||0x1f4;return function(_0x5d5ed3){logger[_0xe8ee('0x24')](_0x5d5ed3[_0xe8ee('0x25')]);if(_0x5d5ed3['name']){delete _0x5d5ed3[_0xe8ee('0x26')];}_0xd704fe[_0xe8ee('0x19')](_0x140ea3)['send'](_0x5d5ed3);};}exports[_0xe8ee('0x27')]=function(_0x5a52ac,_0x333ab7){var _0x57fb9f={},_0x21d90b={},_0x168e40={'count':0x0,'rows':[]};var _0x2f085a=_['map'](db['MailSubstatus'][_0xe8ee('0x28')],function(_0x5a0b1b){return{'name':_0x5a0b1b[_0xe8ee('0x29')],'type':_0x5a0b1b['type'][_0xe8ee('0x2a')]};});_0x21d90b[_0xe8ee('0x2b')]=_['map'](_0x2f085a,_0xe8ee('0x26'));_0x21d90b[_0xe8ee('0x2c')]=_[_0xe8ee('0x2d')](_0x5a52ac[_0xe8ee('0x2c')]);_0x21d90b[_0xe8ee('0x2e')]=_[_0xe8ee('0x2f')](_0x21d90b[_0xe8ee('0x2b')],_0x21d90b[_0xe8ee('0x2c')]);_0x57fb9f[_0xe8ee('0x30')]=_[_0xe8ee('0x2f')](_0x21d90b['model'],qs['fields'](_0x5a52ac[_0xe8ee('0x2c')][_0xe8ee('0x31')]));_0x57fb9f[_0xe8ee('0x30')]=_0x57fb9f[_0xe8ee('0x30')][_0xe8ee('0x32')]?_0x57fb9f[_0xe8ee('0x30')]:_0x21d90b['model'];if(!_0x5a52ac['query'][_0xe8ee('0x33')](_0xe8ee('0x34'))){_0x57fb9f[_0xe8ee('0x35')]=qs[_0xe8ee('0x35')](_0x5a52ac[_0xe8ee('0x2c')]['limit']);_0x57fb9f[_0xe8ee('0x1c')]=qs[_0xe8ee('0x1c')](_0x5a52ac['query'][_0xe8ee('0x1c')]);}_0x57fb9f['order']=qs[_0xe8ee('0x36')](_0x5a52ac[_0xe8ee('0x2c')][_0xe8ee('0x36')]);_0x57fb9f[_0xe8ee('0x37')]=qs['filters'](_[_0xe8ee('0x38')](_0x5a52ac[_0xe8ee('0x2c')],_0x21d90b[_0xe8ee('0x2e')]),_0x2f085a);if(_0x5a52ac['query'][_0xe8ee('0x39')]){_0x57fb9f[_0xe8ee('0x37')]=_[_0xe8ee('0x3a')](_0x57fb9f[_0xe8ee('0x37')],{'$or':_[_0xe8ee('0x3b')](_0x2f085a,function(_0x1472f7){if(_0x1472f7[_0xe8ee('0x3c')]!=='VIRTUAL'){var _0x49e617={};_0x49e617[_0x1472f7['name']]={'$like':'%'+_0x5a52ac['query'][_0xe8ee('0x39')]+'%'};return _0x49e617;}})});}_0x57fb9f=_[_0xe8ee('0x3a')]({},_0x57fb9f,_0x5a52ac[_0xe8ee('0x3d')]);var _0x4483e9={'where':_0x57fb9f[_0xe8ee('0x37')]};return db[_0xe8ee('0x3e')][_0xe8ee('0x1b')](_0x4483e9)['then'](function(_0x3c44cb){_0x168e40[_0xe8ee('0x1b')]=_0x3c44cb;if(_0x5a52ac[_0xe8ee('0x2c')][_0xe8ee('0x3f')]){_0x57fb9f[_0xe8ee('0x40')]=[{'all':!![]}];}return db[_0xe8ee('0x3e')][_0xe8ee('0x41')](_0x57fb9f);})[_0xe8ee('0x21')](function(_0x395b1a){_0x168e40[_0xe8ee('0x42')]=_0x395b1a;return _0x168e40;})[_0xe8ee('0x21')](respondWithFilteredResult(_0x333ab7,_0x57fb9f))['catch'](handleError(_0x333ab7,null));};exports[_0xe8ee('0x43')]=function(_0x1e1125,_0x5ae7e2){var _0x2ae8be={'raw':!![],'where':{'id':_0x1e1125[_0xe8ee('0x44')]['id']}},_0x4b94af={};_0x4b94af[_0xe8ee('0x2b')]=_['keys'](db[_0xe8ee('0x3e')][_0xe8ee('0x28')]);_0x4b94af[_0xe8ee('0x2c')]=_['keys'](_0x1e1125['query']);_0x4b94af[_0xe8ee('0x2e')]=_[_0xe8ee('0x2f')](_0x4b94af[_0xe8ee('0x2b')],_0x4b94af[_0xe8ee('0x2c')]);_0x2ae8be[_0xe8ee('0x30')]=_[_0xe8ee('0x2f')](_0x4b94af['model'],qs[_0xe8ee('0x31')](_0x1e1125[_0xe8ee('0x2c')][_0xe8ee('0x31')]));_0x2ae8be['attributes']=_0x2ae8be['attributes']['length']?_0x2ae8be[_0xe8ee('0x30')]:_0x4b94af['model'];if(_0x1e1125[_0xe8ee('0x2c')][_0xe8ee('0x3f')]){_0x2ae8be['include']=[{'all':!![]}];}_0x2ae8be=_[_0xe8ee('0x3a')]({},_0x2ae8be,_0x1e1125[_0xe8ee('0x3d')]);return db[_0xe8ee('0x3e')][_0xe8ee('0x45')](_0x2ae8be)[_0xe8ee('0x21')](handleEntityNotFound(_0x5ae7e2,null))[_0xe8ee('0x21')](respondWithResult(_0x5ae7e2,null))['catch'](handleError(_0x5ae7e2,null));};exports[_0xe8ee('0x46')]=function(_0xdc5285,_0x118e5f){return db[_0xe8ee('0x3e')][_0xe8ee('0x46')](_0xdc5285['body'],{})['then'](respondWithResult(_0x118e5f,0xc9))[_0xe8ee('0x47')](handleError(_0x118e5f,null));};exports[_0xe8ee('0x20')]=function(_0x4514bd,_0x2ce3a9){if(_0x4514bd[_0xe8ee('0x48')]['id']){delete _0x4514bd[_0xe8ee('0x48')]['id'];}return db['MailSubstatus'][_0xe8ee('0x45')]({'where':{'id':_0x4514bd[_0xe8ee('0x44')]['id']}})[_0xe8ee('0x21')](handleEntityNotFound(_0x2ce3a9,null))[_0xe8ee('0x21')](saveUpdates(_0x4514bd[_0xe8ee('0x48')],null))[_0xe8ee('0x21')](respondWithResult(_0x2ce3a9,null))[_0xe8ee('0x47')](handleError(_0x2ce3a9,null));};exports[_0xe8ee('0x22')]=function(_0x5527e2,_0x234caf){return db[_0xe8ee('0x3e')][_0xe8ee('0x45')]({'where':{'id':_0x5527e2[_0xe8ee('0x44')]['id']}})[_0xe8ee('0x21')](handleEntityNotFound(_0x234caf,null))[_0xe8ee('0x21')](removeEntity(_0x234caf,null))[_0xe8ee('0x47')](handleError(_0x234caf,null));};exports[_0xe8ee('0x49')]=function(_0x42deda,_0x7251a5){return db[_0xe8ee('0x3e')][_0xe8ee('0x49')]()[_0xe8ee('0x21')](respondWithResult(_0x7251a5,null))[_0xe8ee('0x47')](handleError(_0x7251a5,null));}; \ No newline at end of file +var _0x0cc7=['count','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','name','map','MailSubstatus','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x0cc7,0x78));var _0x70cc=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x0cc7[_0x58dc25];return _0x21b0a7;};'use strict';var pdf=require(_0x70cc('0x0'));var emlformat=require(_0x70cc('0x1'));var rimraf=require(_0x70cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70cc('0x3'));var rp=require(_0x70cc('0x4'));var moment=require(_0x70cc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x70cc('0x6'));var util=require(_0x70cc('0x7'));var path=require('path');var sox=require(_0x70cc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70cc('0x9'));var _=require(_0x70cc('0xa'));var squel=require(_0x70cc('0xb'));var crypto=require(_0x70cc('0xc'));var jsforce=require(_0x70cc('0xd'));var deskjs=require(_0x70cc('0xe'));var toCsv=require(_0x70cc('0xf'));var querystring=require(_0x70cc('0x10'));var Papa=require(_0x70cc('0x11'));var Redis=require(_0x70cc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x70cc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70cc('0x14'));var logger=require(_0x70cc('0x15'))(_0x70cc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70cc('0x17'));var db=require(_0x70cc('0x18'))['db'];function respondWithStatusCode(_0x5a5416,_0x12af82){_0x12af82=_0x12af82||0xcc;return function(_0x3a5f9c){if(_0x3a5f9c){return _0x5a5416[_0x70cc('0x19')](_0x12af82);}return _0x5a5416['status'](_0x12af82)[_0x70cc('0x1a')]();};}function respondWithResult(_0x4a77d8,_0x54f73d){_0x54f73d=_0x54f73d||0xc8;return function(_0x13cf8f){if(_0x13cf8f){return _0x4a77d8[_0x70cc('0x1b')](_0x54f73d)['json'](_0x13cf8f);}};}function respondWithFilteredResult(_0x4f6bba,_0x5116d4){return function(_0x99fa81){if(_0x99fa81){var _0x56419e=_0x99fa81[_0x70cc('0x1c')],_0x220106=_0x5116d4['offset'],_0x4bee78=_0x5116d4['offset']+_0x5116d4[_0x70cc('0x1d')],_0x52c58b;if(_0x4bee78>=_0x56419e){_0x4bee78=_0x56419e;_0x52c58b=0xc8;}else{_0x52c58b=0xce;}_0x4f6bba[_0x70cc('0x1b')](_0x52c58b);return _0x4f6bba[_0x70cc('0x1e')](_0x70cc('0x1f'),_0x220106+'-'+_0x4bee78+'/'+_0x56419e)[_0x70cc('0x20')](_0x99fa81);}return null;};}function patchUpdates(_0x6e3f2d){return function(_0x277ca5){try{jsonpatch[_0x70cc('0x21')](_0x277ca5,_0x6e3f2d,!![]);}catch(_0x44633a){return BPromise['reject'](_0x44633a);}return _0x277ca5[_0x70cc('0x22')]();};}function saveUpdates(_0x295826,_0x45370f){return function(_0x291c07){if(_0x291c07){return _0x291c07[_0x70cc('0x23')](_0x295826)[_0x70cc('0x24')](function(_0x1f404c){return _0x1f404c;});}return null;};}function removeEntity(_0x33193f,_0x240527){return function(_0x25e003){if(_0x25e003){return _0x25e003[_0x70cc('0x25')]()[_0x70cc('0x24')](function(){_0x33193f['status'](0xcc)[_0x70cc('0x1a')]();});}};}function handleEntityNotFound(_0x53624d,_0x5302a3){return function(_0x139eca){if(!_0x139eca){_0x53624d[_0x70cc('0x19')](0x194);}return _0x139eca;};}function handleError(_0x1428bb,_0x421c81){_0x421c81=_0x421c81||0x1f4;return function(_0x53cc6a){logger['error'](_0x53cc6a[_0x70cc('0x26')]);if(_0x53cc6a['name']){delete _0x53cc6a[_0x70cc('0x27')];}_0x1428bb['status'](_0x421c81)['send'](_0x53cc6a);};}exports['index']=function(_0x4bd8d0,_0x237c14){var _0xb5c635={},_0x6813e1={},_0x1f94e2={'count':0x0,'rows':[]};var _0x293835=_[_0x70cc('0x28')](db[_0x70cc('0x29')][_0x70cc('0x2a')],function(_0x38c8b4){return{'name':_0x38c8b4[_0x70cc('0x2b')],'type':_0x38c8b4['type']['key']};});_0x6813e1[_0x70cc('0x2c')]=_[_0x70cc('0x28')](_0x293835,_0x70cc('0x27'));_0x6813e1['query']=_[_0x70cc('0x2d')](_0x4bd8d0[_0x70cc('0x2e')]);_0x6813e1['filters']=_[_0x70cc('0x2f')](_0x6813e1['model'],_0x6813e1[_0x70cc('0x2e')]);_0xb5c635[_0x70cc('0x30')]=_[_0x70cc('0x2f')](_0x6813e1['model'],qs[_0x70cc('0x31')](_0x4bd8d0[_0x70cc('0x2e')][_0x70cc('0x31')]));_0xb5c635[_0x70cc('0x30')]=_0xb5c635['attributes'][_0x70cc('0x32')]?_0xb5c635[_0x70cc('0x30')]:_0x6813e1[_0x70cc('0x2c')];if(!_0x4bd8d0[_0x70cc('0x2e')][_0x70cc('0x33')](_0x70cc('0x34'))){_0xb5c635['limit']=qs[_0x70cc('0x1d')](_0x4bd8d0[_0x70cc('0x2e')][_0x70cc('0x1d')]);_0xb5c635[_0x70cc('0x35')]=qs[_0x70cc('0x35')](_0x4bd8d0['query'][_0x70cc('0x35')]);}_0xb5c635[_0x70cc('0x36')]=qs['sort'](_0x4bd8d0[_0x70cc('0x2e')][_0x70cc('0x37')]);_0xb5c635[_0x70cc('0x38')]=qs[_0x70cc('0x39')](_[_0x70cc('0x3a')](_0x4bd8d0[_0x70cc('0x2e')],_0x6813e1[_0x70cc('0x39')]),_0x293835);if(_0x4bd8d0['query'][_0x70cc('0x3b')]){_0xb5c635[_0x70cc('0x38')]=_[_0x70cc('0x3c')](_0xb5c635[_0x70cc('0x38')],{'$or':_[_0x70cc('0x28')](_0x293835,function(_0x144b25){if(_0x144b25[_0x70cc('0x3d')]!=='VIRTUAL'){var _0x2e16ea={};_0x2e16ea[_0x144b25['name']]={'$like':'%'+_0x4bd8d0['query'][_0x70cc('0x3b')]+'%'};return _0x2e16ea;}})});}_0xb5c635=_['merge']({},_0xb5c635,_0x4bd8d0[_0x70cc('0x3e')]);var _0x4cc690={'where':_0xb5c635['where']};return db['MailSubstatus'][_0x70cc('0x1c')](_0x4cc690)['then'](function(_0x119bf3){_0x1f94e2[_0x70cc('0x1c')]=_0x119bf3;if(_0x4bd8d0[_0x70cc('0x2e')][_0x70cc('0x3f')]){_0xb5c635[_0x70cc('0x40')]=[{'all':!![]}];}return db[_0x70cc('0x29')][_0x70cc('0x41')](_0xb5c635);})['then'](function(_0x5b40f0){_0x1f94e2[_0x70cc('0x42')]=_0x5b40f0;return _0x1f94e2;})['then'](respondWithFilteredResult(_0x237c14,_0xb5c635))['catch'](handleError(_0x237c14,null));};exports[_0x70cc('0x43')]=function(_0x79c449,_0xa0afcb){var _0x23fd8a={'raw':!![],'where':{'id':_0x79c449[_0x70cc('0x44')]['id']}},_0xc8e115={};_0xc8e115[_0x70cc('0x2c')]=_[_0x70cc('0x2d')](db['MailSubstatus'][_0x70cc('0x2a')]);_0xc8e115[_0x70cc('0x2e')]=_[_0x70cc('0x2d')](_0x79c449[_0x70cc('0x2e')]);_0xc8e115[_0x70cc('0x39')]=_['intersection'](_0xc8e115[_0x70cc('0x2c')],_0xc8e115[_0x70cc('0x2e')]);_0x23fd8a[_0x70cc('0x30')]=_['intersection'](_0xc8e115[_0x70cc('0x2c')],qs[_0x70cc('0x31')](_0x79c449[_0x70cc('0x2e')][_0x70cc('0x31')]));_0x23fd8a[_0x70cc('0x30')]=_0x23fd8a[_0x70cc('0x30')][_0x70cc('0x32')]?_0x23fd8a[_0x70cc('0x30')]:_0xc8e115[_0x70cc('0x2c')];if(_0x79c449['query'][_0x70cc('0x3f')]){_0x23fd8a[_0x70cc('0x40')]=[{'all':!![]}];}_0x23fd8a=_[_0x70cc('0x3c')]({},_0x23fd8a,_0x79c449[_0x70cc('0x3e')]);return db[_0x70cc('0x29')]['find'](_0x23fd8a)['then'](handleEntityNotFound(_0xa0afcb,null))['then'](respondWithResult(_0xa0afcb,null))[_0x70cc('0x45')](handleError(_0xa0afcb,null));};exports[_0x70cc('0x46')]=function(_0x35cd72,_0x260155){return db[_0x70cc('0x29')][_0x70cc('0x46')](_0x35cd72[_0x70cc('0x47')],{})['then'](respondWithResult(_0x260155,0xc9))[_0x70cc('0x45')](handleError(_0x260155,null));};exports[_0x70cc('0x23')]=function(_0x577e07,_0xad51e2){if(_0x577e07[_0x70cc('0x47')]['id']){delete _0x577e07['body']['id'];}return db[_0x70cc('0x29')][_0x70cc('0x48')]({'where':{'id':_0x577e07[_0x70cc('0x44')]['id']}})[_0x70cc('0x24')](handleEntityNotFound(_0xad51e2,null))[_0x70cc('0x24')](saveUpdates(_0x577e07[_0x70cc('0x47')],null))[_0x70cc('0x24')](respondWithResult(_0xad51e2,null))[_0x70cc('0x45')](handleError(_0xad51e2,null));};exports['destroy']=function(_0x4e684c,_0x1bba03){return db[_0x70cc('0x29')][_0x70cc('0x48')]({'where':{'id':_0x4e684c[_0x70cc('0x44')]['id']}})[_0x70cc('0x24')](handleEntityNotFound(_0x1bba03,null))[_0x70cc('0x24')](removeEntity(_0x1bba03,null))[_0x70cc('0x45')](handleError(_0x1bba03,null));};exports[_0x70cc('0x49')]=function(_0x3fd14d,_0x57d225){return db[_0x70cc('0x29')][_0x70cc('0x49')]()[_0x70cc('0x24')](respondWithResult(_0x57d225,null))['catch'](handleError(_0x57d225,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index bb92bed..5cbe31d 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 _0x7916=['../../config/logger','api','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','MailSubstatus','lodash'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x7916,0x128));var _0x6791=function(_0x1cacfe,_0x413c4b){_0x1cacfe=_0x1cacfe-0x0;var _0x10a65f=_0x7916[_0x1cacfe];return _0x10a65f;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7462=['path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','moment'];(function(_0x5d0c92,_0x3fbf14){var _0x3139cb=function(_0x4ea378){while(--_0x4ea378){_0x5d0c92['push'](_0x5d0c92['shift']());}};_0x3139cb(++_0x3fbf14);}(_0x7462,0x165));var _0x2746=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x7462[_0x59162a];return _0x35e50d;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2746('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2746('0x3'));var rimraf=require(_0x2746('0x4'));var config=require('../../config/environment');var attributes=require(_0x2746('0x5'));module[_0x2746('0x6')]=function(_0x1c3371,_0x280dfb){return _0x1c3371[_0x2746('0x7')](_0x2746('0x8'),attributes,{'tableName':_0x2746('0x9'),'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 ae1302a..8e2b397 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 _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15df01,_0x296bde){var _0x52022e=function(_0x1112cc){while(--_0x1112cc){_0x15df01['push'](_0x15df01['shift']());}};_0x52022e(++_0x296bde);}(_0x878f,0x173));var _0xf878=function(_0x592fed,_0x4f1150){_0x592fed=_0x592fed-0x0;var _0x10bfb3=_0x878f[_0x592fed];return _0x10bfb3;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file +var _0x4522=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x388bff,_0xa1e64d){var _0x3c4946=function(_0x40c4bf){while(--_0x40c4bf){_0x388bff['push'](_0x388bff['shift']());}};_0x3c4946(++_0xa1e64d);}(_0x4522,0x1a0));var _0x2452=function(_0x44e407,_0x4de7b8){_0x44e407=_0x44e407-0x0;var _0x442fdd=_0x4522[_0x44e407];return _0x442fdd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fb1f85b..c389cc6 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 _0x9780=['describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x3c3aba,_0x5a8871){var _0x4ea747=function(_0x5c369f){while(--_0x5c369f){_0x3c3aba['push'](_0x3c3aba['shift']());}};_0x4ea747(++_0x5a8871);}(_0x9780,0x1d4));var _0x0978=function(_0x30bf81,_0x4c00c5){_0x30bf81=_0x30bf81-0x0;var _0x148a30=_0x9780[_0x30bf81];return _0x148a30;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0978('0x0'));var timeout=require(_0x0978('0x1'));var express=require(_0x0978('0x2'));var router=express[_0x0978('0x3')]();var fs_extra=require(_0x0978('0x4'));var auth=require(_0x0978('0x5'));var interaction=require(_0x0978('0x6'));var config=require(_0x0978('0x7'));var controller=require(_0x0978('0x8'));router[_0x0978('0x9')]('/',auth[_0x0978('0xa')](),controller['index']);router[_0x0978('0x9')](_0x0978('0xb'),auth[_0x0978('0xa')](),controller[_0x0978('0xc')]);router[_0x0978('0x9')](_0x0978('0xd'),auth[_0x0978('0xa')](),controller[_0x0978('0xe')]);router[_0x0978('0xf')]('/',auth[_0x0978('0xa')](),controller[_0x0978('0x10')]);router['put'](_0x0978('0xd'),auth['isAuthenticated'](),controller[_0x0978('0x11')]);router[_0x0978('0x12')](_0x0978('0xd'),auth[_0x0978('0xa')](),controller['destroy']);module[_0x0978('0x13')]=router; \ No newline at end of file +var _0x5f6a=['fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','/:id','destroy','multer','connect-timeout','express','Router'];(function(_0x31097a,_0x205d4e){var _0xfe400e=function(_0x30b2b6){while(--_0x30b2b6){_0x31097a['push'](_0x31097a['shift']());}};_0xfe400e(++_0x205d4e);}(_0x5f6a,0xc4));var _0xa5f6=function(_0xcce0c,_0x236901){_0xcce0c=_0xcce0c-0x0;var _0x107dc4=_0x5f6a[_0xcce0c];return _0x107dc4;};'use strict';var multer=require(_0xa5f6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa5f6('0x1'));var express=require(_0xa5f6('0x2'));var router=express[_0xa5f6('0x3')]();var fs_extra=require(_0xa5f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa5f6('0x5'));var config=require(_0xa5f6('0x6'));var controller=require(_0xa5f6('0x7'));router[_0xa5f6('0x8')]('/',auth[_0xa5f6('0x9')](),controller[_0xa5f6('0xa')]);router[_0xa5f6('0x8')](_0xa5f6('0xb'),auth[_0xa5f6('0x9')](),controller[_0xa5f6('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa5f6('0xd')]);router[_0xa5f6('0xe')]('/',auth[_0xa5f6('0x9')](),controller[_0xa5f6('0xf')]);router[_0xa5f6('0x10')]('/:id',auth[_0xa5f6('0x9')](),controller[_0xa5f6('0x11')]);router['delete'](_0xa5f6('0x12'),auth['isAuthenticated'](),controller[_0xa5f6('0x13')]);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 f2c1f13..737944e 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 _0x996f=['DATE','NOW','moment','STRING','ENUM','account','queue'];(function(_0x53c5cf,_0x3ef208){var _0x3261aa=function(_0x69b1d){while(--_0x69b1d){_0x53c5cf['push'](_0x53c5cf['shift']());}};_0x3261aa(++_0x3ef208);}(_0x996f,0xb1));var _0xf996=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x996f[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require(_0xf996('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf996('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf996('0x2')](_0xf996('0x3'),'agent',_0xf996('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xf996('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xf996('0x6')]}}; \ No newline at end of file +var _0x047f=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','sequelize'];(function(_0x179d20,_0xb51ff9){var _0x47328e=function(_0xdbf306){while(--_0xdbf306){_0x179d20['push'](_0x179d20['shift']());}};_0x47328e(++_0xb51ff9);}(_0x047f,0xa1));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0xf047('0x0'));module[_0xf047('0x1')]={'uniqueid':{'type':Sequelize[_0xf047('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf047('0x3')](_0xf047('0x4'),_0xf047('0x5'),'queue'),'allowNull':![],'defaultValue':_0xf047('0x6')},'transferredAt':{'type':Sequelize[_0xf047('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf047('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 3e11843..d4c23e7 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 _0xeca5=['jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','then','includeAll','include','rows','catch','params','keys','length','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x5cb06c,_0x17850f){var _0x24dee4=function(_0x58a47a){while(--_0x58a47a){_0x5cb06c['push'](_0x5cb06c['shift']());}};_0x24dee4(++_0x17850f);}(_0xeca5,0x1f0));var _0x5eca=function(_0x19bd32,_0x2ad416){_0x19bd32=_0x19bd32-0x0;var _0x5da11f=_0xeca5[_0x19bd32];return _0x5da11f;};'use strict';var pdf=require(_0x5eca('0x0'));var emlformat=require(_0x5eca('0x1'));var rimraf=require(_0x5eca('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5eca('0x3'));var rp=require(_0x5eca('0x4'));var moment=require(_0x5eca('0x5'));var BPromise=require(_0x5eca('0x6'));var Mustache=require(_0x5eca('0x7'));var util=require('util');var path=require(_0x5eca('0x8'));var sox=require(_0x5eca('0x9'));var csv=require('to-csv');var ejs=require(_0x5eca('0xa'));var fs=require('fs');var fs_extra=require(_0x5eca('0xb'));var _=require(_0x5eca('0xc'));var squel=require(_0x5eca('0xd'));var crypto=require(_0x5eca('0xe'));var jsforce=require(_0x5eca('0xf'));var deskjs=require(_0x5eca('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5eca('0x11'));var Papa=require('papaparse');var Redis=require(_0x5eca('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5eca('0x13'));var hardwareService=require(_0x5eca('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5eca('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5eca('0x16'));var db=require(_0x5eca('0x17'))['db'];function respondWithStatusCode(_0x40cf56,_0x5482dc){_0x5482dc=_0x5482dc||0xcc;return function(_0x559c91){if(_0x559c91){return _0x40cf56[_0x5eca('0x18')](_0x5482dc);}return _0x40cf56[_0x5eca('0x19')](_0x5482dc)[_0x5eca('0x1a')]();};}function respondWithResult(_0x1a8d38,_0x414e18){_0x414e18=_0x414e18||0xc8;return function(_0x16962b){if(_0x16962b){return _0x1a8d38[_0x5eca('0x19')](_0x414e18)[_0x5eca('0x1b')](_0x16962b);}};}function respondWithFilteredResult(_0x148fa7,_0x1f1066){return function(_0xf40999){if(_0xf40999){var _0x55b1f4=_0xf40999[_0x5eca('0x1c')],_0x43d666=_0x1f1066['offset'],_0x404bbe=_0x1f1066[_0x5eca('0x1d')]+_0x1f1066['limit'],_0xbbbaf;if(_0x404bbe>=_0x55b1f4){_0x404bbe=_0x55b1f4;_0xbbbaf=0xc8;}else{_0xbbbaf=0xce;}_0x148fa7[_0x5eca('0x19')](_0xbbbaf);return _0x148fa7[_0x5eca('0x1e')](_0x5eca('0x1f'),_0x43d666+'-'+_0x404bbe+'/'+_0x55b1f4)[_0x5eca('0x1b')](_0xf40999);}return null;};}function patchUpdates(_0xccfe72){return function(_0x17e7a7){try{jsonpatch[_0x5eca('0x20')](_0x17e7a7,_0xccfe72,!![]);}catch(_0x4f461b){return BPromise[_0x5eca('0x21')](_0x4f461b);}return _0x17e7a7[_0x5eca('0x22')]();};}function saveUpdates(_0x4b0d1f,_0x4319b3){return function(_0x648da4){if(_0x648da4){return _0x648da4[_0x5eca('0x23')](_0x4b0d1f)['then'](function(_0x407a6c){return _0x407a6c;});}return null;};}function removeEntity(_0x17aa9d,_0x1497b0){return function(_0x29726f){if(_0x29726f){return _0x29726f['destroy']()['then'](function(){_0x17aa9d[_0x5eca('0x19')](0xcc)[_0x5eca('0x1a')]();});}};}function handleEntityNotFound(_0x49c824,_0x4dae82){return function(_0x3581f7){if(!_0x3581f7){_0x49c824[_0x5eca('0x18')](0x194);}return _0x3581f7;};}function handleError(_0x4e6041,_0x3932ce){_0x3932ce=_0x3932ce||0x1f4;return function(_0x3e18c4){logger['error'](_0x3e18c4[_0x5eca('0x24')]);if(_0x3e18c4['name']){delete _0x3e18c4[_0x5eca('0x25')];}_0x4e6041[_0x5eca('0x19')](_0x3932ce)[_0x5eca('0x26')](_0x3e18c4);};}exports[_0x5eca('0x27')]=function(_0x1e9653,_0x42c472){var _0x428226={},_0x31b81f={},_0x2d3675={'count':0x0,'rows':[]};var _0x595b41=_[_0x5eca('0x28')](db[_0x5eca('0x29')][_0x5eca('0x2a')],function(_0x2c3a0a){return{'name':_0x2c3a0a[_0x5eca('0x2b')],'type':_0x2c3a0a['type'][_0x5eca('0x2c')]};});_0x31b81f[_0x5eca('0x2d')]=_[_0x5eca('0x28')](_0x595b41,_0x5eca('0x25'));_0x31b81f[_0x5eca('0x2e')]=_['keys'](_0x1e9653[_0x5eca('0x2e')]);_0x31b81f['filters']=_['intersection'](_0x31b81f[_0x5eca('0x2d')],_0x31b81f['query']);_0x428226['attributes']=_[_0x5eca('0x2f')](_0x31b81f[_0x5eca('0x2d')],qs[_0x5eca('0x30')](_0x1e9653[_0x5eca('0x2e')][_0x5eca('0x30')]));_0x428226[_0x5eca('0x31')]=_0x428226[_0x5eca('0x31')]['length']?_0x428226[_0x5eca('0x31')]:_0x31b81f[_0x5eca('0x2d')];if(!_0x1e9653[_0x5eca('0x2e')][_0x5eca('0x32')](_0x5eca('0x33'))){_0x428226[_0x5eca('0x34')]=qs[_0x5eca('0x34')](_0x1e9653[_0x5eca('0x2e')][_0x5eca('0x34')]);_0x428226[_0x5eca('0x1d')]=qs[_0x5eca('0x1d')](_0x1e9653['query'][_0x5eca('0x1d')]);}_0x428226[_0x5eca('0x35')]=qs[_0x5eca('0x36')](_0x1e9653[_0x5eca('0x2e')][_0x5eca('0x36')]);_0x428226[_0x5eca('0x37')]=qs[_0x5eca('0x38')](_[_0x5eca('0x39')](_0x1e9653[_0x5eca('0x2e')],_0x31b81f[_0x5eca('0x38')]),_0x595b41);if(_0x1e9653['query'][_0x5eca('0x3a')]){_0x428226[_0x5eca('0x37')]=_[_0x5eca('0x3b')](_0x428226[_0x5eca('0x37')],{'$or':_[_0x5eca('0x28')](_0x595b41,function(_0x4bcec2){if(_0x4bcec2['type']!=='VIRTUAL'){var _0x40dec1={};_0x40dec1[_0x4bcec2[_0x5eca('0x25')]]={'$like':'%'+_0x1e9653['query'][_0x5eca('0x3a')]+'%'};return _0x40dec1;}})});}_0x428226=_['merge']({},_0x428226,_0x1e9653['options']);var _0x430a1f={'where':_0x428226[_0x5eca('0x37')]};return db[_0x5eca('0x29')][_0x5eca('0x1c')](_0x430a1f)[_0x5eca('0x3c')](function(_0x5558fc){_0x2d3675[_0x5eca('0x1c')]=_0x5558fc;if(_0x1e9653[_0x5eca('0x2e')][_0x5eca('0x3d')]){_0x428226[_0x5eca('0x3e')]=[{'all':!![]}];}return db[_0x5eca('0x29')]['findAll'](_0x428226);})[_0x5eca('0x3c')](function(_0x442648){_0x2d3675[_0x5eca('0x3f')]=_0x442648;return _0x2d3675;})[_0x5eca('0x3c')](respondWithFilteredResult(_0x42c472,_0x428226))[_0x5eca('0x40')](handleError(_0x42c472,null));};exports['show']=function(_0x380d7d,_0x52f588){var _0xf18079={'raw':!![],'where':{'id':_0x380d7d[_0x5eca('0x41')]['id']}},_0x15b37f={};_0x15b37f['model']=_[_0x5eca('0x42')](db[_0x5eca('0x29')][_0x5eca('0x2a')]);_0x15b37f['query']=_[_0x5eca('0x42')](_0x380d7d[_0x5eca('0x2e')]);_0x15b37f[_0x5eca('0x38')]=_[_0x5eca('0x2f')](_0x15b37f['model'],_0x15b37f[_0x5eca('0x2e')]);_0xf18079[_0x5eca('0x31')]=_[_0x5eca('0x2f')](_0x15b37f['model'],qs[_0x5eca('0x30')](_0x380d7d[_0x5eca('0x2e')][_0x5eca('0x30')]));_0xf18079[_0x5eca('0x31')]=_0xf18079[_0x5eca('0x31')][_0x5eca('0x43')]?_0xf18079[_0x5eca('0x31')]:_0x15b37f[_0x5eca('0x2d')];if(_0x380d7d['query'][_0x5eca('0x3d')]){_0xf18079[_0x5eca('0x3e')]=[{'all':!![]}];}_0xf18079=_[_0x5eca('0x3b')]({},_0xf18079,_0x380d7d[_0x5eca('0x44')]);return db[_0x5eca('0x29')][_0x5eca('0x45')](_0xf18079)[_0x5eca('0x3c')](handleEntityNotFound(_0x52f588,null))['then'](respondWithResult(_0x52f588,null))['catch'](handleError(_0x52f588,null));};exports[_0x5eca('0x46')]=function(_0x2492c7,_0x36680a){return db[_0x5eca('0x29')][_0x5eca('0x46')](_0x2492c7[_0x5eca('0x47')],{})[_0x5eca('0x3c')](respondWithResult(_0x36680a,0xc9))[_0x5eca('0x40')](handleError(_0x36680a,null));};exports['update']=function(_0x206e10,_0x28bb60){if(_0x206e10[_0x5eca('0x47')]['id']){delete _0x206e10[_0x5eca('0x47')]['id'];}return db['MailTransferReport'][_0x5eca('0x45')]({'where':{'id':_0x206e10[_0x5eca('0x41')]['id']}})['then'](handleEntityNotFound(_0x28bb60,null))[_0x5eca('0x3c')](saveUpdates(_0x206e10['body'],null))['then'](respondWithResult(_0x28bb60,null))[_0x5eca('0x40')](handleError(_0x28bb60,null));};exports['destroy']=function(_0x3e5fd5,_0x5a3f15){return db[_0x5eca('0x29')]['find']({'where':{'id':_0x3e5fd5[_0x5eca('0x41')]['id']}})[_0x5eca('0x3c')](handleEntityNotFound(_0x5a3f15,null))['then'](removeEntity(_0x5a3f15,null))[_0x5eca('0x40')](handleError(_0x5a3f15,null));};exports['describe']=function(_0x3ac620,_0x4f387e){return db[_0x5eca('0x29')][_0x5eca('0x48')]()[_0x5eca('0x3c')](respondWithResult(_0x4f387e,null))[_0x5eca('0x40')](handleError(_0x4f387e,null));}; \ No newline at end of file +var _0xe67b=['options','includeAll','include','rows','show','keys','catch','create','body','find','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge'];(function(_0x55172a,_0x41b407){var _0x263083=function(_0x1ed59a){while(--_0x1ed59a){_0x55172a['push'](_0x55172a['shift']());}};_0x263083(++_0x41b407);}(_0xe67b,0x183));var _0xbe67=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0xe67b[_0x5f46e7];return _0x567e95;};'use strict';var pdf=require(_0xbe67('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbe67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe67('0x2'));var rp=require(_0xbe67('0x3'));var moment=require(_0xbe67('0x4'));var BPromise=require(_0xbe67('0x5'));var Mustache=require(_0xbe67('0x6'));var util=require('util');var path=require(_0xbe67('0x7'));var sox=require(_0xbe67('0x8'));var csv=require('to-csv');var ejs=require(_0xbe67('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe67('0xa'));var squel=require(_0xbe67('0xb'));var crypto=require(_0xbe67('0xc'));var jsforce=require(_0xbe67('0xd'));var deskjs=require(_0xbe67('0xe'));var toCsv=require(_0xbe67('0xf'));var querystring=require('querystring');var Papa=require(_0xbe67('0x10'));var Redis=require(_0xbe67('0x11'));var authService=require(_0xbe67('0x12'));var qs=require(_0xbe67('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe67('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbe67('0x15'));var config=require(_0xbe67('0x16'));var licenseUtil=require(_0xbe67('0x17'));var db=require(_0xbe67('0x18'))['db'];function respondWithStatusCode(_0x43cc94,_0x8c1c67){_0x8c1c67=_0x8c1c67||0xcc;return function(_0x50cfde){if(_0x50cfde){return _0x43cc94['sendStatus'](_0x8c1c67);}return _0x43cc94['status'](_0x8c1c67)[_0xbe67('0x19')]();};}function respondWithResult(_0x19e690,_0x252df5){_0x252df5=_0x252df5||0xc8;return function(_0x51d233){if(_0x51d233){return _0x19e690[_0xbe67('0x1a')](_0x252df5)[_0xbe67('0x1b')](_0x51d233);}};}function respondWithFilteredResult(_0x209b32,_0x20606c){return function(_0x7c9c5c){if(_0x7c9c5c){var _0x1fbdac=_0x7c9c5c[_0xbe67('0x1c')],_0x27ef29=_0x20606c[_0xbe67('0x1d')],_0x165797=_0x20606c[_0xbe67('0x1d')]+_0x20606c[_0xbe67('0x1e')],_0x3b45bf;if(_0x165797>=_0x1fbdac){_0x165797=_0x1fbdac;_0x3b45bf=0xc8;}else{_0x3b45bf=0xce;}_0x209b32['status'](_0x3b45bf);return _0x209b32['set']('Content-Range',_0x27ef29+'-'+_0x165797+'/'+_0x1fbdac)[_0xbe67('0x1b')](_0x7c9c5c);}return null;};}function patchUpdates(_0x5586e9){return function(_0x3979b3){try{jsonpatch[_0xbe67('0x1f')](_0x3979b3,_0x5586e9,!![]);}catch(_0x3b2cae){return BPromise[_0xbe67('0x20')](_0x3b2cae);}return _0x3979b3['save']();};}function saveUpdates(_0x121aea,_0x4bdcbe){return function(_0x20d936){if(_0x20d936){return _0x20d936[_0xbe67('0x21')](_0x121aea)[_0xbe67('0x22')](function(_0x5b55b8){return _0x5b55b8;});}return null;};}function removeEntity(_0x2ef49a,_0x4ecfdb){return function(_0x4cc48b){if(_0x4cc48b){return _0x4cc48b[_0xbe67('0x23')]()[_0xbe67('0x22')](function(){_0x2ef49a[_0xbe67('0x1a')](0xcc)[_0xbe67('0x19')]();});}};}function handleEntityNotFound(_0x48f30e,_0x4afc7d){return function(_0x199c4a){if(!_0x199c4a){_0x48f30e['sendStatus'](0x194);}return _0x199c4a;};}function handleError(_0x212fe2,_0x26a63d){_0x26a63d=_0x26a63d||0x1f4;return function(_0x32a98f){logger[_0xbe67('0x24')](_0x32a98f[_0xbe67('0x25')]);if(_0x32a98f[_0xbe67('0x26')]){delete _0x32a98f['name'];}_0x212fe2[_0xbe67('0x1a')](_0x26a63d)[_0xbe67('0x27')](_0x32a98f);};}exports[_0xbe67('0x28')]=function(_0x3b562e,_0x382432){var _0x32533f={},_0x45ec9e={},_0x5f417f={'count':0x0,'rows':[]};var _0xa82b93=_[_0xbe67('0x29')](db[_0xbe67('0x2a')][_0xbe67('0x2b')],function(_0x55cb70){return{'name':_0x55cb70[_0xbe67('0x2c')],'type':_0x55cb70[_0xbe67('0x2d')][_0xbe67('0x2e')]};});_0x45ec9e[_0xbe67('0x2f')]=_['map'](_0xa82b93,_0xbe67('0x26'));_0x45ec9e[_0xbe67('0x30')]=_['keys'](_0x3b562e[_0xbe67('0x30')]);_0x45ec9e[_0xbe67('0x31')]=_[_0xbe67('0x32')](_0x45ec9e[_0xbe67('0x2f')],_0x45ec9e[_0xbe67('0x30')]);_0x32533f['attributes']=_[_0xbe67('0x32')](_0x45ec9e['model'],qs['fields'](_0x3b562e[_0xbe67('0x30')][_0xbe67('0x33')]));_0x32533f[_0xbe67('0x34')]=_0x32533f[_0xbe67('0x34')][_0xbe67('0x35')]?_0x32533f['attributes']:_0x45ec9e['model'];if(!_0x3b562e['query'][_0xbe67('0x36')](_0xbe67('0x37'))){_0x32533f[_0xbe67('0x1e')]=qs[_0xbe67('0x1e')](_0x3b562e[_0xbe67('0x30')][_0xbe67('0x1e')]);_0x32533f['offset']=qs[_0xbe67('0x1d')](_0x3b562e[_0xbe67('0x30')]['offset']);}_0x32533f[_0xbe67('0x38')]=qs[_0xbe67('0x39')](_0x3b562e[_0xbe67('0x30')]['sort']);_0x32533f['where']=qs[_0xbe67('0x31')](_[_0xbe67('0x3a')](_0x3b562e[_0xbe67('0x30')],_0x45ec9e[_0xbe67('0x31')]),_0xa82b93);if(_0x3b562e[_0xbe67('0x30')]['filter']){_0x32533f[_0xbe67('0x3b')]=_['merge'](_0x32533f[_0xbe67('0x3b')],{'$or':_[_0xbe67('0x29')](_0xa82b93,function(_0x3e721c){if(_0x3e721c['type']!==_0xbe67('0x3c')){var _0x28690e={};_0x28690e[_0x3e721c[_0xbe67('0x26')]]={'$like':'%'+_0x3b562e['query'][_0xbe67('0x3d')]+'%'};return _0x28690e;}})});}_0x32533f=_[_0xbe67('0x3e')]({},_0x32533f,_0x3b562e[_0xbe67('0x3f')]);var _0x19ab7d={'where':_0x32533f[_0xbe67('0x3b')]};return db[_0xbe67('0x2a')][_0xbe67('0x1c')](_0x19ab7d)[_0xbe67('0x22')](function(_0x25f6b7){_0x5f417f[_0xbe67('0x1c')]=_0x25f6b7;if(_0x3b562e['query'][_0xbe67('0x40')]){_0x32533f[_0xbe67('0x41')]=[{'all':!![]}];}return db[_0xbe67('0x2a')]['findAll'](_0x32533f);})[_0xbe67('0x22')](function(_0x1c5328){_0x5f417f[_0xbe67('0x42')]=_0x1c5328;return _0x5f417f;})[_0xbe67('0x22')](respondWithFilteredResult(_0x382432,_0x32533f))['catch'](handleError(_0x382432,null));};exports[_0xbe67('0x43')]=function(_0x4262f9,_0xd9127b){var _0x36ad4e={'raw':!![],'where':{'id':_0x4262f9['params']['id']}},_0x689d8d={};_0x689d8d[_0xbe67('0x2f')]=_[_0xbe67('0x44')](db[_0xbe67('0x2a')][_0xbe67('0x2b')]);_0x689d8d[_0xbe67('0x30')]=_[_0xbe67('0x44')](_0x4262f9[_0xbe67('0x30')]);_0x689d8d[_0xbe67('0x31')]=_[_0xbe67('0x32')](_0x689d8d[_0xbe67('0x2f')],_0x689d8d[_0xbe67('0x30')]);_0x36ad4e['attributes']=_['intersection'](_0x689d8d[_0xbe67('0x2f')],qs['fields'](_0x4262f9[_0xbe67('0x30')]['fields']));_0x36ad4e[_0xbe67('0x34')]=_0x36ad4e[_0xbe67('0x34')][_0xbe67('0x35')]?_0x36ad4e[_0xbe67('0x34')]:_0x689d8d[_0xbe67('0x2f')];if(_0x4262f9[_0xbe67('0x30')]['includeAll']){_0x36ad4e[_0xbe67('0x41')]=[{'all':!![]}];}_0x36ad4e=_['merge']({},_0x36ad4e,_0x4262f9[_0xbe67('0x3f')]);return db[_0xbe67('0x2a')]['find'](_0x36ad4e)['then'](handleEntityNotFound(_0xd9127b,null))[_0xbe67('0x22')](respondWithResult(_0xd9127b,null))[_0xbe67('0x45')](handleError(_0xd9127b,null));};exports[_0xbe67('0x46')]=function(_0x2129c4,_0x98a632){return db[_0xbe67('0x2a')]['create'](_0x2129c4[_0xbe67('0x47')],{})[_0xbe67('0x22')](respondWithResult(_0x98a632,0xc9))[_0xbe67('0x45')](handleError(_0x98a632,null));};exports[_0xbe67('0x21')]=function(_0x15659a,_0x48ec10){if(_0x15659a[_0xbe67('0x47')]['id']){delete _0x15659a[_0xbe67('0x47')]['id'];}return db[_0xbe67('0x2a')][_0xbe67('0x48')]({'where':{'id':_0x15659a[_0xbe67('0x49')]['id']}})['then'](handleEntityNotFound(_0x48ec10,null))[_0xbe67('0x22')](saveUpdates(_0x15659a[_0xbe67('0x47')],null))[_0xbe67('0x22')](respondWithResult(_0x48ec10,null))['catch'](handleError(_0x48ec10,null));};exports[_0xbe67('0x23')]=function(_0x3e8b46,_0x12cb53){return db[_0xbe67('0x2a')][_0xbe67('0x48')]({'where':{'id':_0x3e8b46[_0xbe67('0x49')]['id']}})[_0xbe67('0x22')](handleEntityNotFound(_0x12cb53,null))['then'](removeEntity(_0x12cb53,null))[_0xbe67('0x45')](handleError(_0x12cb53,null));};exports['describe']=function(_0x34bd95,_0x459367){return db[_0xbe67('0x2a')][_0xbe67('0x4a')]()[_0xbe67('0x22')](respondWithResult(_0x459367,null))[_0xbe67('0x45')](handleError(_0x459367,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 6e93ea5..9dad5ea 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 _0xef89=['./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xef89,0x9f));var _0x9ef8=function(_0x4b65c7,_0x205a14){_0x4b65c7=_0x4b65c7-0x0;var _0x53073c=_0xef89[_0x4b65c7];return _0x53073c;};'use strict';var _=require('lodash');var util=require(_0x9ef8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9ef8('0x1'));var BPromise=require('bluebird');var rp=require(_0x9ef8('0x2'));var fs=require('fs');var path=require(_0x9ef8('0x3'));var rimraf=require(_0x9ef8('0x4'));var config=require(_0x9ef8('0x5'));var attributes=require(_0x9ef8('0x6'));module[_0x9ef8('0x7')]=function(_0x385d18,_0x2f1f22){return _0x385d18[_0x9ef8('0x8')](_0x9ef8('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x9ef8('0xa'),'fields':[_0x9ef8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9a3=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x367c1f,_0x1dc4f1){var _0x18b0da=function(_0x3722bb){while(--_0x3722bb){_0x367c1f['push'](_0x367c1f['shift']());}};_0x18b0da(++_0x1dc4f1);}(_0xa9a3,0x13e));var _0x3a9a=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9a3[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x3a9a('0x0'));var util=require(_0x3a9a('0x1'));var logger=require(_0x3a9a('0x2'))('api');var moment=require(_0x3a9a('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a9a('0x4'));var fs=require('fs');var path=require(_0x3a9a('0x5'));var rimraf=require(_0x3a9a('0x6'));var config=require(_0x3a9a('0x7'));var attributes=require(_0x3a9a('0x8'));module[_0x3a9a('0x9')]=function(_0x59daf6,_0x4d3ad7){return _0x59daf6[_0x3a9a('0xa')](_0x3a9a('0xb'),attributes,{'tableName':_0x3a9a('0xc'),'paranoid':![],'indexes':[{'name':_0x3a9a('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8578860..e88d0a0 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 _0x30cd=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1db39d,_0x28b123){var _0x2f4e9e=function(_0x5d6a21){while(--_0x5d6a21){_0x1db39d['push'](_0x1db39d['shift']());}};_0x2f4e9e(++_0x28b123);}(_0x30cd,0x171));var _0xd30c=function(_0x5b882c,_0x261582){_0x5b882c=_0x5b882c-0x0;var _0x3c3247=_0x30cd[_0x5b882c];return _0x3c3247;};'use strict';var _=require(_0xd30c('0x0'));var util=require(_0xd30c('0x1'));var moment=require(_0xd30c('0x2'));var BPromise=require(_0xd30c('0x3'));var rs=require(_0xd30c('0x4'));var fs=require('fs');var Redis=require(_0xd30c('0x5'));var db=require(_0xd30c('0x6'))['db'];var utils=require(_0xd30c('0x7'));var logger=require(_0xd30c('0x8'))(_0xd30c('0x9'));var config=require(_0xd30c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd30c('0xb')][_0xd30c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56c036,_0x48ba2c,_0x108d97){return new BPromise(function(_0x189eb8,_0x406535){return client[_0xd30c('0xd')](_0x56c036,_0x108d97)[_0xd30c('0xe')](function(_0x29bcdf){logger[_0xd30c('0xf')](_0xd30c('0x10'),_0x48ba2c,_0xd30c('0x11'));logger[_0xd30c('0x12')](_0xd30c('0x13'),_0x48ba2c,_0xd30c('0x11'),JSON[_0xd30c('0x14')](_0x29bcdf));if(_0x29bcdf[_0xd30c('0x15')]){if(_0x29bcdf['error'][_0xd30c('0x16')]===0x1f4){logger['error'](_0xd30c('0x10'),_0x48ba2c,_0x29bcdf[_0xd30c('0x15')][_0xd30c('0x17')]);return _0x406535(_0x29bcdf[_0xd30c('0x15')]['message']);}logger['error'](_0xd30c('0x10'),_0x48ba2c,_0x29bcdf[_0xd30c('0x15')][_0xd30c('0x17')]);return _0x189eb8(_0x29bcdf[_0xd30c('0x15')]['message']);}else{logger[_0xd30c('0xf')](_0xd30c('0x10'),_0x48ba2c,_0xd30c('0x11'));_0x189eb8(_0x29bcdf[_0xd30c('0x18')][_0xd30c('0x17')]);}})[_0xd30c('0x19')](function(_0x2909e0){logger[_0xd30c('0x15')](_0xd30c('0x10'),_0x48ba2c,_0x2909e0);_0x406535(_0x2909e0);});});} \ No newline at end of file +var _0x7b00=['rpc','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x41007d,_0x3a338e){var _0x51c71d=function(_0x4255d4){while(--_0x4255d4){_0x41007d['push'](_0x41007d['shift']());}};_0x51c71d(++_0x3a338e);}(_0x7b00,0x1f3));var _0x07b0=function(_0x14ca73,_0x52a55b){_0x14ca73=_0x14ca73-0x0;var _0x38b40b=_0x7b00[_0x14ca73];return _0x38b40b;};'use strict';var _=require('lodash');var util=require(_0x07b0('0x0'));var moment=require(_0x07b0('0x1'));var BPromise=require('bluebird');var rs=require(_0x07b0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07b0('0x3'))['db'];var utils=require(_0x07b0('0x4'));var logger=require('../../config/logger')(_0x07b0('0x5'));var config=require(_0x07b0('0x6'));var jayson=require(_0x07b0('0x7'));var client=jayson[_0x07b0('0x8')][_0x07b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cb9e1,_0x3e393b,_0x310f70){return new BPromise(function(_0x49ce48,_0x2241ac){return client['request'](_0x3cb9e1,_0x310f70)[_0x07b0('0xa')](function(_0xdf1774){logger[_0x07b0('0xb')](_0x07b0('0xc'),_0x3e393b,_0x07b0('0xd'));logger[_0x07b0('0xe')](_0x07b0('0xf'),_0x3e393b,_0x07b0('0xd'),JSON['stringify'](_0xdf1774));if(_0xdf1774[_0x07b0('0x10')]){if(_0xdf1774[_0x07b0('0x10')][_0x07b0('0x11')]===0x1f4){logger[_0x07b0('0x10')](_0x07b0('0xc'),_0x3e393b,_0xdf1774[_0x07b0('0x10')][_0x07b0('0x12')]);return _0x2241ac(_0xdf1774[_0x07b0('0x10')][_0x07b0('0x12')]);}logger[_0x07b0('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x3e393b,_0xdf1774['error'][_0x07b0('0x12')]);return _0x49ce48(_0xdf1774[_0x07b0('0x10')]['message']);}else{logger['info'](_0x07b0('0xc'),_0x3e393b,_0x07b0('0xd'));_0x49ce48(_0xdf1774[_0x07b0('0x13')][_0x07b0('0x12')]);}})[_0x07b0('0x14')](function(_0x21bf0b){logger[_0x07b0('0x10')](_0x07b0('0xc'),_0x3e393b,_0x21bf0b);_0x2241ac(_0x21bf0b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 3da8adb..e578800 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 _0x8bdf=['path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x8bdf,0xfe));var _0xf8bd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x8bdf[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xf8bd('0x0'));var util=require('util');var path=require(_0xf8bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8bd('0x2'));var router=express['Router']();var fs_extra=require(_0xf8bd('0x3'));var auth=require(_0xf8bd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf8bd('0x5'));var controller=require('./memberReport.controller');router[_0xf8bd('0x6')]('/',auth[_0xf8bd('0x7')](),controller[_0xf8bd('0x8')]);router[_0xf8bd('0x6')]('/describe',auth[_0xf8bd('0x7')](),controller[_0xf8bd('0x9')]);router['get'](_0xf8bd('0xa'),auth['isAuthenticated'](),controller[_0xf8bd('0xb')]);router['post']('/',auth[_0xf8bd('0x7')](),controller[_0xf8bd('0xc')]);router[_0xf8bd('0xd')](_0xf8bd('0xa'),auth[_0xf8bd('0x7')](),controller[_0xf8bd('0xe')]);router[_0xf8bd('0xf')](_0xf8bd('0xa'),auth[_0xf8bd('0x7')](),controller[_0xf8bd('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbee9=['destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete'];(function(_0x355790,_0x4f436b){var _0x1478fd=function(_0x42c7ee){while(--_0x42c7ee){_0x355790['push'](_0x355790['shift']());}};_0x1478fd(++_0x4f436b);}(_0xbee9,0x1c9));var _0x9bee=function(_0x298a48,_0x59dad2){_0x298a48=_0x298a48-0x0;var _0x230078=_0xbee9[_0x298a48];return _0x230078;};'use strict';var multer=require(_0x9bee('0x0'));var util=require('util');var path=require(_0x9bee('0x1'));var timeout=require(_0x9bee('0x2'));var express=require('express');var router=express[_0x9bee('0x3')]();var fs_extra=require(_0x9bee('0x4'));var auth=require(_0x9bee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9bee('0x6'));var controller=require(_0x9bee('0x7'));router[_0x9bee('0x8')]('/',auth[_0x9bee('0x9')](),controller[_0x9bee('0xa')]);router[_0x9bee('0x8')](_0x9bee('0xb'),auth[_0x9bee('0x9')](),controller[_0x9bee('0xc')]);router['get']('/:id',auth[_0x9bee('0x9')](),controller['show']);router[_0x9bee('0xd')]('/',auth[_0x9bee('0x9')](),controller['create']);router[_0x9bee('0xe')](_0x9bee('0xf'),auth[_0x9bee('0x9')](),controller[_0x9bee('0x10')]);router[_0x9bee('0x11')]('/:id',auth[_0x9bee('0x9')](),controller[_0x9bee('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c4feccd..313821f 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 _0x2f47=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds'];(function(_0x430977,_0x202636){var _0x2897a0=function(_0x3d14a5){while(--_0x3d14a5){_0x430977['push'](_0x430977['shift']());}};_0x2897a0(++_0x202636);}(_0x2f47,0x9b));var _0x72f4=function(_0xfbf22b,_0x28d5d4){_0xfbf22b=_0xfbf22b-0x0;var _0x427c65=_0x2f47[_0xfbf22b];return _0x427c65;};'use strict';var Sequelize=require(_0x72f4('0x0'));var moment=require(_0x72f4('0x1'));module[_0x72f4('0x2')]={'channel':{'type':Sequelize[_0x72f4('0x3')]},'membername':{'type':Sequelize[_0x72f4('0x3')]},'interface':{'type':Sequelize[_0x72f4('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x72f4('0x4')},'duration':{'type':Sequelize[_0x72f4('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x72f4('0x6')],'set':function(_0x2b20ba){var _0x5e04af=moment(_0x2b20ba);var _0x7d454e=moment(this[_0x72f4('0x7')](_0x72f4('0x8')));var _0x503723=_0x5e04af['diff'](_0x7d454e,_0x72f4('0x9'));this['setDataValue']('exitAt',_0x2b20ba);this['setDataValue']('duration',_0x503723||null);}},'data1':{'type':Sequelize[_0x72f4('0x3')],'comment':_0x72f4('0xa')},'data2':{'type':Sequelize[_0x72f4('0x3')],'comment':_0x72f4('0xb')},'data3':{'type':Sequelize[_0x72f4('0x3')],'comment':_0x72f4('0xc')},'data4':{'type':Sequelize[_0x72f4('0x3')],'comment':_0x72f4('0xd')},'data5':{'type':Sequelize[_0x72f4('0x3')],'comment':_0x72f4('0xe')},'role':{'type':Sequelize[_0x72f4('0x3')]},'internal':{'type':Sequelize[_0x72f4('0x5')]},'uniqueid':{'type':Sequelize[_0x72f4('0x3')]}}; \ No newline at end of file +var _0xf7f6=['STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x5b9553,_0x1c6171){var _0x2b1b6f=function(_0x21d013){while(--_0x21d013){_0x5b9553['push'](_0x5b9553['shift']());}};_0x2b1b6f(++_0x1c6171);}(_0xf7f6,0x12a));var _0x6f7f=function(_0x51b095,_0x1c9cf4){_0x51b095=_0x51b095-0x0;var _0x181c56=_0xf7f6[_0x51b095];return _0x181c56;};'use strict';var Sequelize=require(_0x6f7f('0x0'));var moment=require(_0x6f7f('0x1'));module['exports']={'channel':{'type':Sequelize[_0x6f7f('0x2')]},'membername':{'type':Sequelize[_0x6f7f('0x2')]},'interface':{'type':Sequelize[_0x6f7f('0x2')]},'type':{'type':Sequelize[_0x6f7f('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x6f7f('0x3')},'duration':{'type':Sequelize[_0x6f7f('0x4')]},'enterAt':{'type':Sequelize[_0x6f7f('0x5')]},'exitAt':{'type':Sequelize[_0x6f7f('0x5')],'set':function(_0x111125){var _0x235008=moment(_0x111125);var _0x30a019=moment(this[_0x6f7f('0x6')](_0x6f7f('0x7')));var _0x10fdc5=_0x235008[_0x6f7f('0x8')](_0x30a019,'seconds');this[_0x6f7f('0x9')]('exitAt',_0x111125);this['setDataValue'](_0x6f7f('0xa'),_0x10fdc5||null);}},'data1':{'type':Sequelize[_0x6f7f('0x2')],'comment':_0x6f7f('0xb')},'data2':{'type':Sequelize[_0x6f7f('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x6f7f('0x2')],'comment':_0x6f7f('0xc')},'data4':{'type':Sequelize[_0x6f7f('0x2')],'comment':_0x6f7f('0xd')},'data5':{'type':Sequelize[_0x6f7f('0x2')],'comment':_0x6f7f('0xe')},'role':{'type':Sequelize[_0x6f7f('0x2')]},'internal':{'type':Sequelize[_0x6f7f('0x4')]},'uniqueid':{'type':Sequelize[_0x6f7f('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0c4530d..aa7b4f6 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 _0xc8a4=['MemberReport','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','destroy','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','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','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options'];(function(_0x4729cd,_0x3402ae){var _0x9e0580=function(_0x548226){while(--_0x548226){_0x4729cd['push'](_0x4729cd['shift']());}};_0x9e0580(++_0x3402ae);}(_0xc8a4,0x1b8));var _0x4c8a=function(_0x59060b,_0x3358a6){_0x59060b=_0x59060b-0x0;var _0x1325a0=_0xc8a4[_0x59060b];return _0x1325a0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c8a('0x0'));var jsonpatch=require(_0x4c8a('0x1'));var rp=require('request-promise');var moment=require(_0x4c8a('0x2'));var BPromise=require(_0x4c8a('0x3'));var Mustache=require(_0x4c8a('0x4'));var util=require(_0x4c8a('0x5'));var path=require(_0x4c8a('0x6'));var sox=require(_0x4c8a('0x7'));var csv=require('to-csv');var ejs=require(_0x4c8a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c8a('0x9'));var squel=require(_0x4c8a('0xa'));var crypto=require('crypto');var jsforce=require(_0x4c8a('0xb'));var deskjs=require(_0x4c8a('0xc'));var toCsv=require(_0x4c8a('0xd'));var querystring=require('querystring');var Papa=require(_0x4c8a('0xe'));var Redis=require('ioredis');var authService=require(_0x4c8a('0xf'));var qs=require(_0x4c8a('0x10'));var as=require(_0x4c8a('0x11'));var hardwareService=require(_0x4c8a('0x12'));var logger=require(_0x4c8a('0x13'))(_0x4c8a('0x14'));var utils=require(_0x4c8a('0x15'));var config=require(_0x4c8a('0x16'));var licenseUtil=require(_0x4c8a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x595315,_0x12b3cf){_0x12b3cf=_0x12b3cf||0xcc;return function(_0x3c2edf){if(_0x3c2edf){return _0x595315[_0x4c8a('0x18')](_0x12b3cf);}return _0x595315[_0x4c8a('0x19')](_0x12b3cf)[_0x4c8a('0x1a')]();};}function respondWithResult(_0x3923b4,_0x57e47a){_0x57e47a=_0x57e47a||0xc8;return function(_0x1c52bb){if(_0x1c52bb){return _0x3923b4[_0x4c8a('0x19')](_0x57e47a)[_0x4c8a('0x1b')](_0x1c52bb);}};}function respondWithFilteredResult(_0x3814bb,_0x29727a){return function(_0x25fa5f){if(_0x25fa5f){var _0x17a5d9=_0x25fa5f['count'],_0xa1e828=_0x29727a['offset'],_0x4e63bb=_0x29727a[_0x4c8a('0x1c')]+_0x29727a[_0x4c8a('0x1d')],_0x1c7e25;if(_0x4e63bb>=_0x17a5d9){_0x4e63bb=_0x17a5d9;_0x1c7e25=0xc8;}else{_0x1c7e25=0xce;}_0x3814bb[_0x4c8a('0x19')](_0x1c7e25);return _0x3814bb[_0x4c8a('0x1e')](_0x4c8a('0x1f'),_0xa1e828+'-'+_0x4e63bb+'/'+_0x17a5d9)[_0x4c8a('0x1b')](_0x25fa5f);}return null;};}function patchUpdates(_0x589b14){return function(_0x335567){try{jsonpatch[_0x4c8a('0x20')](_0x335567,_0x589b14,!![]);}catch(_0x4a7524){return BPromise['reject'](_0x4a7524);}return _0x335567[_0x4c8a('0x21')]();};}function saveUpdates(_0x1b27e2,_0x513442){return function(_0x2cc5d9){if(_0x2cc5d9){return _0x2cc5d9['update'](_0x1b27e2)[_0x4c8a('0x22')](function(_0x3343d6){return _0x3343d6;});}return null;};}function removeEntity(_0x226fbe,_0x2535ba){return function(_0x49847f){if(_0x49847f){return _0x49847f['destroy']()['then'](function(){_0x226fbe['status'](0xcc)[_0x4c8a('0x1a')]();});}};}function handleEntityNotFound(_0xdb767e,_0x37cbdf){return function(_0x1f6882){if(!_0x1f6882){_0xdb767e[_0x4c8a('0x18')](0x194);}return _0x1f6882;};}function handleError(_0x226adb,_0x4d3f9c){_0x4d3f9c=_0x4d3f9c||0x1f4;return function(_0x446deb){logger['error'](_0x446deb[_0x4c8a('0x23')]);if(_0x446deb['name']){delete _0x446deb[_0x4c8a('0x24')];}_0x226adb[_0x4c8a('0x19')](_0x4d3f9c)[_0x4c8a('0x25')](_0x446deb);};}exports['index']=function(_0x19bac5,_0x3a5bc2){var _0x9425ff={},_0xb524a9={},_0x58275c={'count':0x0,'rows':[]};var _0x4337bd=_[_0x4c8a('0x26')](db['MemberReport'][_0x4c8a('0x27')],function(_0x2adc6e){return{'name':_0x2adc6e[_0x4c8a('0x28')],'type':_0x2adc6e['type'][_0x4c8a('0x29')]};});_0xb524a9[_0x4c8a('0x2a')]=_[_0x4c8a('0x26')](_0x4337bd,_0x4c8a('0x24'));_0xb524a9[_0x4c8a('0x2b')]=_[_0x4c8a('0x2c')](_0x19bac5[_0x4c8a('0x2b')]);_0xb524a9[_0x4c8a('0x2d')]=_[_0x4c8a('0x2e')](_0xb524a9[_0x4c8a('0x2a')],_0xb524a9['query']);_0x9425ff['attributes']=_['intersection'](_0xb524a9[_0x4c8a('0x2a')],qs['fields'](_0x19bac5[_0x4c8a('0x2b')][_0x4c8a('0x2f')]));_0x9425ff['attributes']=_0x9425ff[_0x4c8a('0x30')]['length']?_0x9425ff['attributes']:_0xb524a9['model'];if(!_0x19bac5[_0x4c8a('0x2b')][_0x4c8a('0x31')]('nolimit')){_0x9425ff['limit']=qs[_0x4c8a('0x1d')](_0x19bac5['query'][_0x4c8a('0x1d')]);_0x9425ff[_0x4c8a('0x1c')]=qs[_0x4c8a('0x1c')](_0x19bac5[_0x4c8a('0x2b')][_0x4c8a('0x1c')]);}_0x9425ff[_0x4c8a('0x32')]=qs[_0x4c8a('0x33')](_0x19bac5[_0x4c8a('0x2b')][_0x4c8a('0x33')]);_0x9425ff['where']=qs['filters'](_['pick'](_0x19bac5[_0x4c8a('0x2b')],_0xb524a9['filters']),_0x4337bd);if(_0x19bac5[_0x4c8a('0x2b')][_0x4c8a('0x34')]){_0x9425ff['where']=_['merge'](_0x9425ff[_0x4c8a('0x35')],{'$or':_['map'](_0x4337bd,function(_0x23feda){if(_0x23feda['type']!==_0x4c8a('0x36')){var _0x3890a7={};_0x3890a7[_0x23feda[_0x4c8a('0x24')]]={'$like':'%'+_0x19bac5['query'][_0x4c8a('0x34')]+'%'};return _0x3890a7;}})});}_0x9425ff=_[_0x4c8a('0x37')]({},_0x9425ff,_0x19bac5[_0x4c8a('0x38')]);var _0x5de519={'where':_0x9425ff[_0x4c8a('0x35')]};return db[_0x4c8a('0x39')]['count'](_0x5de519)['then'](function(_0x4149c5){_0x58275c['count']=_0x4149c5;if(_0x19bac5[_0x4c8a('0x2b')][_0x4c8a('0x3a')]){_0x9425ff[_0x4c8a('0x3b')]=[{'all':!![]}];}return db[_0x4c8a('0x39')][_0x4c8a('0x3c')](_0x9425ff);})['then'](function(_0x428e86){_0x58275c[_0x4c8a('0x3d')]=_0x428e86;return _0x58275c;})[_0x4c8a('0x22')](respondWithFilteredResult(_0x3a5bc2,_0x9425ff))[_0x4c8a('0x3e')](handleError(_0x3a5bc2,null));};exports['show']=function(_0x167f13,_0xe8e8be){var _0x4ff121={'raw':!![],'where':{'id':_0x167f13[_0x4c8a('0x3f')]['id']}},_0x159ded={};_0x159ded['model']=_['keys'](db[_0x4c8a('0x39')][_0x4c8a('0x27')]);_0x159ded[_0x4c8a('0x2b')]=_['keys'](_0x167f13[_0x4c8a('0x2b')]);_0x159ded[_0x4c8a('0x2d')]=_['intersection'](_0x159ded[_0x4c8a('0x2a')],_0x159ded[_0x4c8a('0x2b')]);_0x4ff121['attributes']=_[_0x4c8a('0x2e')](_0x159ded[_0x4c8a('0x2a')],qs['fields'](_0x167f13[_0x4c8a('0x2b')]['fields']));_0x4ff121[_0x4c8a('0x30')]=_0x4ff121[_0x4c8a('0x30')][_0x4c8a('0x40')]?_0x4ff121[_0x4c8a('0x30')]:_0x159ded[_0x4c8a('0x2a')];if(_0x167f13[_0x4c8a('0x2b')][_0x4c8a('0x3a')]){_0x4ff121[_0x4c8a('0x3b')]=[{'all':!![]}];}_0x4ff121=_['merge']({},_0x4ff121,_0x167f13[_0x4c8a('0x38')]);return db[_0x4c8a('0x39')][_0x4c8a('0x41')](_0x4ff121)[_0x4c8a('0x22')](handleEntityNotFound(_0xe8e8be,null))[_0x4c8a('0x22')](respondWithResult(_0xe8e8be,null))[_0x4c8a('0x3e')](handleError(_0xe8e8be,null));};exports[_0x4c8a('0x42')]=function(_0x488af2,_0x3ec6d6){return db[_0x4c8a('0x39')][_0x4c8a('0x42')](_0x488af2[_0x4c8a('0x43')],{})[_0x4c8a('0x22')](respondWithResult(_0x3ec6d6,0xc9))[_0x4c8a('0x3e')](handleError(_0x3ec6d6,null));};exports[_0x4c8a('0x44')]=function(_0x7781e6,_0x34b06c){if(_0x7781e6[_0x4c8a('0x43')]['id']){delete _0x7781e6['body']['id'];}return db[_0x4c8a('0x39')]['find']({'where':{'id':_0x7781e6[_0x4c8a('0x3f')]['id']}})[_0x4c8a('0x22')](handleEntityNotFound(_0x34b06c,null))['then'](saveUpdates(_0x7781e6[_0x4c8a('0x43')],null))[_0x4c8a('0x22')](respondWithResult(_0x34b06c,null))[_0x4c8a('0x3e')](handleError(_0x34b06c,null));};exports[_0x4c8a('0x45')]=function(_0x17096b,_0x2def54){return db['MemberReport'][_0x4c8a('0x41')]({'where':{'id':_0x17096b[_0x4c8a('0x3f')]['id']}})[_0x4c8a('0x22')](handleEntityNotFound(_0x2def54,null))[_0x4c8a('0x22')](removeEntity(_0x2def54,null))[_0x4c8a('0x3e')](handleError(_0x2def54,null));};exports[_0x4c8a('0x46')]=function(_0x510fd5,_0x50443e){return db[_0x4c8a('0x39')]['describe']()[_0x4c8a('0x22')](respondWithResult(_0x50443e,null))['catch'](handleError(_0x50443e,null));}; \ No newline at end of file +var _0x1e15=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x4a541b,_0x358d97){var _0x292cd8=function(_0x22600){while(--_0x22600){_0x4a541b['push'](_0x4a541b['shift']());}};_0x292cd8(++_0x358d97);}(_0x1e15,0x137));var _0x51e1=function(_0x3982c3,_0x30b9c5){_0x3982c3=_0x3982c3-0x0;var _0x5f14c6=_0x1e15[_0x3982c3];return _0x5f14c6;};'use strict';var pdf=require(_0x51e1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x51e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51e1('0x2'));var rp=require('request-promise');var moment=require(_0x51e1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x51e1('0x4'));var util=require(_0x51e1('0x5'));var path=require(_0x51e1('0x6'));var sox=require(_0x51e1('0x7'));var csv=require('to-csv');var ejs=require(_0x51e1('0x8'));var fs=require('fs');var fs_extra=require(_0x51e1('0x9'));var _=require(_0x51e1('0xa'));var squel=require('squel');var crypto=require(_0x51e1('0xb'));var jsforce=require(_0x51e1('0xc'));var deskjs=require(_0x51e1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x51e1('0xe'));var Papa=require(_0x51e1('0xf'));var Redis=require('ioredis');var authService=require(_0x51e1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51e1('0x11'));var logger=require(_0x51e1('0x12'))(_0x51e1('0x13'));var utils=require(_0x51e1('0x14'));var config=require(_0x51e1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x51e1('0x16'))['db'];function respondWithStatusCode(_0x407427,_0x54754f){_0x54754f=_0x54754f||0xcc;return function(_0x4bb95c){if(_0x4bb95c){return _0x407427[_0x51e1('0x17')](_0x54754f);}return _0x407427[_0x51e1('0x18')](_0x54754f)['end']();};}function respondWithResult(_0x379ba1,_0x4bcf87){_0x4bcf87=_0x4bcf87||0xc8;return function(_0xe3f480){if(_0xe3f480){return _0x379ba1[_0x51e1('0x18')](_0x4bcf87)[_0x51e1('0x19')](_0xe3f480);}};}function respondWithFilteredResult(_0x5bd7a8,_0x2080f2){return function(_0x455675){if(_0x455675){var _0x27c7f2=_0x455675[_0x51e1('0x1a')],_0x25cd9f=_0x2080f2[_0x51e1('0x1b')],_0x399fbf=_0x2080f2[_0x51e1('0x1b')]+_0x2080f2[_0x51e1('0x1c')],_0x46beaf;if(_0x399fbf>=_0x27c7f2){_0x399fbf=_0x27c7f2;_0x46beaf=0xc8;}else{_0x46beaf=0xce;}_0x5bd7a8['status'](_0x46beaf);return _0x5bd7a8[_0x51e1('0x1d')](_0x51e1('0x1e'),_0x25cd9f+'-'+_0x399fbf+'/'+_0x27c7f2)[_0x51e1('0x19')](_0x455675);}return null;};}function patchUpdates(_0x48ad3e){return function(_0x111209){try{jsonpatch[_0x51e1('0x1f')](_0x111209,_0x48ad3e,!![]);}catch(_0x245ae7){return BPromise[_0x51e1('0x20')](_0x245ae7);}return _0x111209[_0x51e1('0x21')]();};}function saveUpdates(_0x54db25,_0x2b3209){return function(_0x12e3dc){if(_0x12e3dc){return _0x12e3dc[_0x51e1('0x22')](_0x54db25)[_0x51e1('0x23')](function(_0x368825){return _0x368825;});}return null;};}function removeEntity(_0x1115c0,_0x2904e5){return function(_0x1648d4){if(_0x1648d4){return _0x1648d4[_0x51e1('0x24')]()[_0x51e1('0x23')](function(){_0x1115c0[_0x51e1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b76ad,_0x1e951a){return function(_0x20bf64){if(!_0x20bf64){_0x9b76ad[_0x51e1('0x17')](0x194);}return _0x20bf64;};}function handleError(_0x4b7864,_0x51bd5a){_0x51bd5a=_0x51bd5a||0x1f4;return function(_0x1b553e){logger['error'](_0x1b553e[_0x51e1('0x25')]);if(_0x1b553e[_0x51e1('0x26')]){delete _0x1b553e[_0x51e1('0x26')];}_0x4b7864['status'](_0x51bd5a)[_0x51e1('0x27')](_0x1b553e);};}exports[_0x51e1('0x28')]=function(_0x33e287,_0x1eefcc){var _0x4f324a={},_0x2dc199={},_0x3c2025={'count':0x0,'rows':[]};var _0x53b620=_[_0x51e1('0x29')](db[_0x51e1('0x2a')][_0x51e1('0x2b')],function(_0x288adc){return{'name':_0x288adc[_0x51e1('0x2c')],'type':_0x288adc[_0x51e1('0x2d')][_0x51e1('0x2e')]};});_0x2dc199[_0x51e1('0x2f')]=_[_0x51e1('0x29')](_0x53b620,_0x51e1('0x26'));_0x2dc199[_0x51e1('0x30')]=_[_0x51e1('0x31')](_0x33e287[_0x51e1('0x30')]);_0x2dc199[_0x51e1('0x32')]=_['intersection'](_0x2dc199[_0x51e1('0x2f')],_0x2dc199['query']);_0x4f324a['attributes']=_[_0x51e1('0x33')](_0x2dc199[_0x51e1('0x2f')],qs[_0x51e1('0x34')](_0x33e287[_0x51e1('0x30')]['fields']));_0x4f324a[_0x51e1('0x35')]=_0x4f324a[_0x51e1('0x35')]['length']?_0x4f324a[_0x51e1('0x35')]:_0x2dc199[_0x51e1('0x2f')];if(!_0x33e287[_0x51e1('0x30')][_0x51e1('0x36')](_0x51e1('0x37'))){_0x4f324a['limit']=qs[_0x51e1('0x1c')](_0x33e287[_0x51e1('0x30')]['limit']);_0x4f324a['offset']=qs[_0x51e1('0x1b')](_0x33e287['query'][_0x51e1('0x1b')]);}_0x4f324a[_0x51e1('0x38')]=qs[_0x51e1('0x39')](_0x33e287[_0x51e1('0x30')][_0x51e1('0x39')]);_0x4f324a[_0x51e1('0x3a')]=qs['filters'](_[_0x51e1('0x3b')](_0x33e287[_0x51e1('0x30')],_0x2dc199['filters']),_0x53b620);if(_0x33e287[_0x51e1('0x30')][_0x51e1('0x3c')]){_0x4f324a[_0x51e1('0x3a')]=_[_0x51e1('0x3d')](_0x4f324a[_0x51e1('0x3a')],{'$or':_[_0x51e1('0x29')](_0x53b620,function(_0x2fc362){if(_0x2fc362[_0x51e1('0x2d')]!=='VIRTUAL'){var _0x4cc8c7={};_0x4cc8c7[_0x2fc362[_0x51e1('0x26')]]={'$like':'%'+_0x33e287[_0x51e1('0x30')][_0x51e1('0x3c')]+'%'};return _0x4cc8c7;}})});}_0x4f324a=_[_0x51e1('0x3d')]({},_0x4f324a,_0x33e287[_0x51e1('0x3e')]);var _0x4fc25a={'where':_0x4f324a[_0x51e1('0x3a')]};return db[_0x51e1('0x2a')][_0x51e1('0x1a')](_0x4fc25a)[_0x51e1('0x23')](function(_0x4049a5){_0x3c2025[_0x51e1('0x1a')]=_0x4049a5;if(_0x33e287['query']['includeAll']){_0x4f324a[_0x51e1('0x3f')]=[{'all':!![]}];}return db[_0x51e1('0x2a')][_0x51e1('0x40')](_0x4f324a);})[_0x51e1('0x23')](function(_0x42d56e){_0x3c2025[_0x51e1('0x41')]=_0x42d56e;return _0x3c2025;})[_0x51e1('0x23')](respondWithFilteredResult(_0x1eefcc,_0x4f324a))[_0x51e1('0x42')](handleError(_0x1eefcc,null));};exports[_0x51e1('0x43')]=function(_0x136816,_0x121545){var _0x269c6f={'raw':!![],'where':{'id':_0x136816[_0x51e1('0x44')]['id']}},_0x5af14e={};_0x5af14e[_0x51e1('0x2f')]=_[_0x51e1('0x31')](db[_0x51e1('0x2a')][_0x51e1('0x2b')]);_0x5af14e[_0x51e1('0x30')]=_[_0x51e1('0x31')](_0x136816[_0x51e1('0x30')]);_0x5af14e[_0x51e1('0x32')]=_[_0x51e1('0x33')](_0x5af14e['model'],_0x5af14e[_0x51e1('0x30')]);_0x269c6f[_0x51e1('0x35')]=_[_0x51e1('0x33')](_0x5af14e[_0x51e1('0x2f')],qs[_0x51e1('0x34')](_0x136816[_0x51e1('0x30')][_0x51e1('0x34')]));_0x269c6f['attributes']=_0x269c6f[_0x51e1('0x35')]['length']?_0x269c6f[_0x51e1('0x35')]:_0x5af14e[_0x51e1('0x2f')];if(_0x136816[_0x51e1('0x30')]['includeAll']){_0x269c6f['include']=[{'all':!![]}];}_0x269c6f=_['merge']({},_0x269c6f,_0x136816['options']);return db[_0x51e1('0x2a')][_0x51e1('0x45')](_0x269c6f)['then'](handleEntityNotFound(_0x121545,null))[_0x51e1('0x23')](respondWithResult(_0x121545,null))['catch'](handleError(_0x121545,null));};exports[_0x51e1('0x46')]=function(_0x72c60c,_0x47ac72){return db['MemberReport'][_0x51e1('0x46')](_0x72c60c['body'],{})[_0x51e1('0x23')](respondWithResult(_0x47ac72,0xc9))[_0x51e1('0x42')](handleError(_0x47ac72,null));};exports[_0x51e1('0x22')]=function(_0x33ed11,_0x497465){if(_0x33ed11[_0x51e1('0x47')]['id']){delete _0x33ed11['body']['id'];}return db[_0x51e1('0x2a')][_0x51e1('0x45')]({'where':{'id':_0x33ed11[_0x51e1('0x44')]['id']}})[_0x51e1('0x23')](handleEntityNotFound(_0x497465,null))[_0x51e1('0x23')](saveUpdates(_0x33ed11[_0x51e1('0x47')],null))[_0x51e1('0x23')](respondWithResult(_0x497465,null))[_0x51e1('0x42')](handleError(_0x497465,null));};exports['destroy']=function(_0x297f69,_0x38d8fb){return db[_0x51e1('0x2a')]['find']({'where':{'id':_0x297f69[_0x51e1('0x44')]['id']}})['then'](handleEntityNotFound(_0x38d8fb,null))[_0x51e1('0x23')](removeEntity(_0x38d8fb,null))[_0x51e1('0x42')](handleError(_0x38d8fb,null));};exports[_0x51e1('0x48')]=function(_0x4fbb44,_0xabf01f){return db['MemberReport'][_0x51e1('0x48')]()['then'](respondWithResult(_0xabf01f,null))[_0x51e1('0x42')](handleError(_0xabf01f,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6931a70..3d8c72c 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 _0xdb90=['request-promise','rimraf','../../config/environment','./memberReport.attributes','define','report_member','membername','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xedeb81,_0x2cedb3){var _0xc5d4ee=function(_0xe9fb79){while(--_0xe9fb79){_0xedeb81['push'](_0xedeb81['shift']());}};_0xc5d4ee(++_0x2cedb3);}(_0xdb90,0x125));var _0x0db9=function(_0x2d2f17,_0x2bd8a9){_0x2d2f17=_0x2d2f17-0x0;var _0x5a49ae=_0xdb90[_0x2d2f17];return _0x5a49ae;};'use strict';var _=require(_0x0db9('0x0'));var util=require(_0x0db9('0x1'));var logger=require(_0x0db9('0x2'))(_0x0db9('0x3'));var moment=require(_0x0db9('0x4'));var BPromise=require(_0x0db9('0x5'));var rp=require(_0x0db9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0db9('0x7'));var config=require(_0x0db9('0x8'));var attributes=require(_0x0db9('0x9'));module['exports']=function(_0xe0dd42,_0x19dd9d){return _0xe0dd42[_0x0db9('0xa')]('MemberReport',attributes,{'tableName':_0x0db9('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x0db9('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash','util','bluebird'];(function(_0x33a1c1,_0x28b6b3){var _0x34fbc6=function(_0xc05e22){while(--_0xc05e22){_0x33a1c1['push'](_0x33a1c1['shift']());}};_0x34fbc6(++_0x28b6b3);}(_0xa46e,0x1d9));var _0xea46=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xa46e[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rp=require(_0xea46('0x3'));var fs=require('fs');var path=require(_0xea46('0x4'));var rimraf=require(_0xea46('0x5'));var config=require(_0xea46('0x6'));var attributes=require(_0xea46('0x7'));module[_0xea46('0x8')]=function(_0x5a2ebf,_0x13bea7){return _0x5a2ebf[_0xea46('0x9')]('MemberReport',attributes,{'tableName':_0xea46('0xa'),'paranoid':![],'indexes':[{'name':_0xea46('0xb'),'fields':[_0xea46('0xc'),_0xea46('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 60ab12f..36c0126 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 _0xc61b=['rpc','jayson/promise','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMemberReport','findAll','options','raw','where','attributes','include','map','model','CreateMemberReport','MemberReport','create','update','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4dc1cf,_0x89ae61){var _0x3f4efb=function(_0x37c028){while(--_0x37c028){_0x4dc1cf['push'](_0x4dc1cf['shift']());}};_0x3f4efb(++_0x89ae61);}(_0xc61b,0x65));var _0xbc61=function(_0x23c6fd,_0x4b0f37){_0x23c6fd=_0x23c6fd-0x0;var _0x203f4a=_0xc61b[_0x23c6fd];return _0x203f4a;};'use strict';var _=require(_0xbc61('0x0'));var util=require(_0xbc61('0x1'));var moment=require(_0xbc61('0x2'));var BPromise=require(_0xbc61('0x3'));var rs=require(_0xbc61('0x4'));var fs=require('fs');var Redis=require(_0xbc61('0x5'));var db=require(_0xbc61('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbc61('0x7'));var config=require('../../config/environment');var jayson=require(_0xbc61('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fee93,_0x5f1443,_0x2bf6f8){return new BPromise(function(_0x5bac13,_0x405c0){return client[_0xbc61('0x9')](_0x3fee93,_0x2bf6f8)[_0xbc61('0xa')](function(_0x535a11){logger[_0xbc61('0xb')](_0xbc61('0xc'),_0x5f1443,_0xbc61('0xd'));logger[_0xbc61('0xe')](_0xbc61('0xf'),_0x5f1443,_0xbc61('0xd'),JSON[_0xbc61('0x10')](_0x535a11));if(_0x535a11[_0xbc61('0x11')]){if(_0x535a11[_0xbc61('0x11')][_0xbc61('0x12')]===0x1f4){logger[_0xbc61('0x11')](_0xbc61('0xc'),_0x5f1443,_0x535a11[_0xbc61('0x11')]['message']);return _0x405c0(_0x535a11['error']['message']);}logger['error'](_0xbc61('0xc'),_0x5f1443,_0x535a11['error'][_0xbc61('0x13')]);return _0x5bac13(_0x535a11['error'][_0xbc61('0x13')]);}else{logger[_0xbc61('0xb')](_0xbc61('0xc'),_0x5f1443,_0xbc61('0xd'));_0x5bac13(_0x535a11['result'][_0xbc61('0x13')]);}})[_0xbc61('0x14')](function(_0x475a18){logger[_0xbc61('0x11')](_0xbc61('0xc'),_0x5f1443,_0x475a18);_0x405c0(_0x475a18);});});}exports[_0xbc61('0x15')]=function(_0x37964b){var _0x49e9bc=this;return new Promise(function(_0x57304d,_0x2633f3){return db['MemberReport'][_0xbc61('0x16')]({'raw':_0x37964b[_0xbc61('0x17')]?_0x37964b[_0xbc61('0x17')][_0xbc61('0x18')]===undefined?!![]:![]:!![],'where':_0x37964b['options']?_0x37964b[_0xbc61('0x17')][_0xbc61('0x19')]||null:null,'attributes':_0x37964b[_0xbc61('0x17')]?_0x37964b[_0xbc61('0x17')][_0xbc61('0x1a')]||null:null,'limit':_0x37964b['options']?_0x37964b[_0xbc61('0x17')]['limit']||null:null,'include':_0x37964b[_0xbc61('0x17')]?_0x37964b['options'][_0xbc61('0x1b')]?_[_0xbc61('0x1c')](_0x37964b[_0xbc61('0x17')][_0xbc61('0x1b')],function(_0x37bbec){return{'model':db[_0x37bbec[_0xbc61('0x1d')]],'as':_0x37bbec['as'],'attributes':_0x37bbec[_0xbc61('0x1a')],'include':_0x37bbec[_0xbc61('0x1b')]?_[_0xbc61('0x1c')](_0x37bbec[_0xbc61('0x1b')],function(_0x28b540){return{'model':db[_0x28b540[_0xbc61('0x1d')]],'as':_0x28b540['as'],'attributes':_0x28b540['attributes'],'include':_0x28b540[_0xbc61('0x1b')]?_[_0xbc61('0x1c')](_0x28b540[_0xbc61('0x1b')],function(_0x5d67ab){return{'model':db[_0x5d67ab[_0xbc61('0x1d')]],'as':_0x5d67ab['as'],'attributes':_0x5d67ab[_0xbc61('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbc61('0xa')](function(_0x1a52d9){logger[_0xbc61('0xb')](_0xbc61('0x15'),_0x37964b);logger[_0xbc61('0xe')](_0xbc61('0x15'),_0x37964b,JSON[_0xbc61('0x10')](_0x1a52d9));_0x57304d(_0x1a52d9);})[_0xbc61('0x14')](function(_0x2347c){logger[_0xbc61('0x11')](_0xbc61('0x15'),_0x2347c[_0xbc61('0x13')],_0x37964b);_0x2633f3(_0x49e9bc[_0xbc61('0x11')](0x1f4,_0x2347c[_0xbc61('0x13')]));});});};exports[_0xbc61('0x1e')]=function(_0x19b4d2){var _0x2e0d79=this;return new Promise(function(_0xc62bce,_0x45688e){return db[_0xbc61('0x1f')][_0xbc61('0x20')](_0x19b4d2['body'],{'raw':_0x19b4d2[_0xbc61('0x17')]?_0x19b4d2[_0xbc61('0x17')][_0xbc61('0x18')]===undefined?!![]:![]:!![]})[_0xbc61('0xa')](function(_0x6e07b9){logger['info']('CreateMemberReport',_0x19b4d2);logger[_0xbc61('0xe')](_0xbc61('0x1e'),_0x19b4d2,JSON['stringify'](_0x6e07b9));_0xc62bce(_0x6e07b9);})['catch'](function(_0x59b45c){logger['error'](_0xbc61('0x1e'),_0x59b45c[_0xbc61('0x13')],_0x19b4d2);_0x45688e(_0x2e0d79[_0xbc61('0x11')](0x1f4,_0x59b45c[_0xbc61('0x13')]));});});};exports['UpdateMemberReport']=function(_0x2a1654){var _0xfa342e=this;return new Promise(function(_0x371263,_0x38fe86){return db['MemberReport'][_0xbc61('0x21')](_0x2a1654[_0xbc61('0x22')],{'raw':_0x2a1654[_0xbc61('0x17')]?_0x2a1654[_0xbc61('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a1654[_0xbc61('0x17')]?_0x2a1654['options'][_0xbc61('0x19')]||null:null,'attributes':_0x2a1654[_0xbc61('0x17')]?_0x2a1654['options'][_0xbc61('0x1a')]||null:null,'limit':_0x2a1654[_0xbc61('0x17')]?_0x2a1654[_0xbc61('0x17')]['limit']||null:null})[_0xbc61('0xa')](function(_0x38e905){logger[_0xbc61('0xb')](_0xbc61('0x23'),_0x2a1654);logger['debug'](_0xbc61('0x23'),_0x2a1654,JSON[_0xbc61('0x10')](_0x38e905));_0x371263(_0x38e905);})[_0xbc61('0x14')](function(_0x4e192c){logger[_0xbc61('0x11')](_0xbc61('0x23'),_0x4e192c[_0xbc61('0x13')],_0x2a1654);_0x38fe86(_0xfa342e[_0xbc61('0x11')](0x1f4,_0x4e192c[_0xbc61('0x13')]));});});}; \ No newline at end of file +var _0xcb11=['include','map','model','then','CreateMemberReport','create','body','raw','UpdateMemberReport','MemberReport','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetMemberReport','options','where','attributes','limit'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0xcb11,0x1c4));var _0x1cb1=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xcb11[_0x5d225a];return _0x1e7761;};'use strict';var _=require(_0x1cb1('0x0'));var util=require(_0x1cb1('0x1'));var moment=require(_0x1cb1('0x2'));var BPromise=require('bluebird');var rs=require(_0x1cb1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1cb1('0x4'));var logger=require(_0x1cb1('0x5'))(_0x1cb1('0x6'));var config=require(_0x1cb1('0x7'));var jayson=require(_0x1cb1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2868c0,_0x30eb81,_0x449d29){return new BPromise(function(_0x5cfe03,_0x31f5e9){return client['request'](_0x2868c0,_0x449d29)['then'](function(_0x270fac){logger[_0x1cb1('0x9')](_0x1cb1('0xa'),_0x30eb81,'request\x20sent');logger[_0x1cb1('0xb')](_0x1cb1('0xc'),_0x30eb81,'request\x20sent',JSON[_0x1cb1('0xd')](_0x270fac));if(_0x270fac[_0x1cb1('0xe')]){if(_0x270fac['error']['code']===0x1f4){logger[_0x1cb1('0xe')]('MemberReport,\x20%s,\x20%s',_0x30eb81,_0x270fac[_0x1cb1('0xe')][_0x1cb1('0xf')]);return _0x31f5e9(_0x270fac[_0x1cb1('0xe')]['message']);}logger[_0x1cb1('0xe')](_0x1cb1('0xa'),_0x30eb81,_0x270fac[_0x1cb1('0xe')][_0x1cb1('0xf')]);return _0x5cfe03(_0x270fac[_0x1cb1('0xe')]['message']);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x30eb81,_0x1cb1('0x10'));_0x5cfe03(_0x270fac[_0x1cb1('0x11')]['message']);}})[_0x1cb1('0x12')](function(_0x18cc94){logger['error']('MemberReport,\x20%s,\x20%s',_0x30eb81,_0x18cc94);_0x31f5e9(_0x18cc94);});});}exports[_0x1cb1('0x13')]=function(_0x3aae9a){var _0x1b8379=this;return new Promise(function(_0x45e36a,_0x394fc1){return db['MemberReport']['findAll']({'raw':_0x3aae9a[_0x1cb1('0x14')]?_0x3aae9a['options']['raw']===undefined?!![]:![]:!![],'where':_0x3aae9a['options']?_0x3aae9a[_0x1cb1('0x14')][_0x1cb1('0x15')]||null:null,'attributes':_0x3aae9a[_0x1cb1('0x14')]?_0x3aae9a[_0x1cb1('0x14')][_0x1cb1('0x16')]||null:null,'limit':_0x3aae9a[_0x1cb1('0x14')]?_0x3aae9a[_0x1cb1('0x14')][_0x1cb1('0x17')]||null:null,'include':_0x3aae9a['options']?_0x3aae9a[_0x1cb1('0x14')][_0x1cb1('0x18')]?_[_0x1cb1('0x19')](_0x3aae9a[_0x1cb1('0x14')]['include'],function(_0x523e02){return{'model':db[_0x523e02[_0x1cb1('0x1a')]],'as':_0x523e02['as'],'attributes':_0x523e02[_0x1cb1('0x16')],'include':_0x523e02[_0x1cb1('0x18')]?_[_0x1cb1('0x19')](_0x523e02[_0x1cb1('0x18')],function(_0x127a24){return{'model':db[_0x127a24[_0x1cb1('0x1a')]],'as':_0x127a24['as'],'attributes':_0x127a24[_0x1cb1('0x16')],'include':_0x127a24[_0x1cb1('0x18')]?_[_0x1cb1('0x19')](_0x127a24[_0x1cb1('0x18')],function(_0x3a47ec){return{'model':db[_0x3a47ec[_0x1cb1('0x1a')]],'as':_0x3a47ec['as'],'attributes':_0x3a47ec[_0x1cb1('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1cb1('0x1b')](function(_0x447b4a){logger[_0x1cb1('0x9')](_0x1cb1('0x13'),_0x3aae9a);logger[_0x1cb1('0xb')]('GetMemberReport',_0x3aae9a,JSON[_0x1cb1('0xd')](_0x447b4a));_0x45e36a(_0x447b4a);})[_0x1cb1('0x12')](function(_0x149946){logger[_0x1cb1('0xe')]('GetMemberReport',_0x149946[_0x1cb1('0xf')],_0x3aae9a);_0x394fc1(_0x1b8379[_0x1cb1('0xe')](0x1f4,_0x149946[_0x1cb1('0xf')]));});});};exports[_0x1cb1('0x1c')]=function(_0x4017ac){var _0x6f3d42=this;return new Promise(function(_0x54a31a,_0x1a6dc8){return db['MemberReport'][_0x1cb1('0x1d')](_0x4017ac[_0x1cb1('0x1e')],{'raw':_0x4017ac[_0x1cb1('0x14')]?_0x4017ac[_0x1cb1('0x14')][_0x1cb1('0x1f')]===undefined?!![]:![]:!![]})[_0x1cb1('0x1b')](function(_0x4a6e72){logger['info']('CreateMemberReport',_0x4017ac);logger[_0x1cb1('0xb')](_0x1cb1('0x1c'),_0x4017ac,JSON['stringify'](_0x4a6e72));_0x54a31a(_0x4a6e72);})['catch'](function(_0x54f23e){logger[_0x1cb1('0xe')](_0x1cb1('0x1c'),_0x54f23e[_0x1cb1('0xf')],_0x4017ac);_0x1a6dc8(_0x6f3d42[_0x1cb1('0xe')](0x1f4,_0x54f23e['message']));});});};exports[_0x1cb1('0x20')]=function(_0x175606){var _0x51f329=this;return new Promise(function(_0x3e18ff,_0x4df0a0){return db[_0x1cb1('0x21')]['update'](_0x175606['body'],{'raw':_0x175606['options']?_0x175606['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175606[_0x1cb1('0x14')]?_0x175606[_0x1cb1('0x14')]['where']||null:null,'attributes':_0x175606['options']?_0x175606[_0x1cb1('0x14')][_0x1cb1('0x16')]||null:null,'limit':_0x175606[_0x1cb1('0x14')]?_0x175606[_0x1cb1('0x14')]['limit']||null:null})[_0x1cb1('0x1b')](function(_0x2b324f){logger[_0x1cb1('0x9')]('UpdateMemberReport',_0x175606);logger[_0x1cb1('0xb')](_0x1cb1('0x20'),_0x175606,JSON['stringify'](_0x2b324f));_0x3e18ff(_0x2b324f);})['catch'](function(_0x31823b){logger[_0x1cb1('0xe')](_0x1cb1('0x20'),_0x31823b[_0x1cb1('0xf')],_0x175606);_0x4df0a0(_0x51f329['error'](0x1f4,_0x31823b[_0x1cb1('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c19568a..3e0dbd6 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 _0xe0ae=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','exports'];(function(_0x37aa21,_0x33035d){var _0x5d32bb=function(_0x3a62c2){while(--_0x3a62c2){_0x37aa21['push'](_0x37aa21['shift']());}};_0x5d32bb(++_0x33035d);}(_0xe0ae,0xa1));var _0xee0a=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0xe0ae[_0xe1b5f6];return _0x44636e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',controller['index']);module[_0xee0a('0x6')]=router; \ No newline at end of file +var _0x5075=['fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2ef1b8,_0x5a2c50){var _0x9e5bca=function(_0x4b27d2){while(--_0x4b27d2){_0x2ef1b8['push'](_0x2ef1b8['shift']());}};_0x9e5bca(++_0x5a2c50);}(_0x5075,0x73));var _0x5507=function(_0x29de96,_0x42cc38){_0x29de96=_0x29de96-0x0;var _0x1b9352=_0x5075[_0x29de96];return _0x1b9352;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/',controller['index']);module[_0x5507('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 21559b6..2eee311 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 _0x4d27=['exports','STRING','version'];(function(_0x29c008,_0x4eb448){var _0x5acdd6=function(_0x1af7d9){while(--_0x1af7d9){_0x29c008['push'](_0x29c008['shift']());}};_0x5acdd6(++_0x4eb448);}(_0x4d27,0x1dd));var _0x74d2=function(_0x5ad326,_0x5eff6e){_0x5ad326=_0x5ad326-0x0;var _0x5111b6=_0x4d27[_0x5ad326];return _0x5111b6;};'use strict';var Sequelize=require('sequelize');module[_0x74d2('0x0')]={'version':{'type':Sequelize[_0x74d2('0x1')],'unique':_0x74d2('0x2')}}; \ No newline at end of file +var _0x92bf=['version','sequelize','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x92bf,0x19f));var _0xf92b=function(_0x137b4f,_0x3336b1){_0x137b4f=_0x137b4f-0x0;var _0x51a2dd=_0x92bf[_0x137b4f];return _0x51a2dd;};'use strict';var Sequelize=require(_0xf92b('0x0'));module['exports']={'version':{'type':Sequelize[_0xf92b('0x1')],'unique':_0xf92b('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 5078b76..7baea73 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 _0x747a=['Content-Range','apply','reject','update','destroy','then','end','sendStatus','error','stack','index','map','type','key','model','name','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','Migration','include','rows','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','count','offset','limit','set'];(function(_0x12a024,_0x5e97e3){var _0x36efad=function(_0x1a6c14){while(--_0x1a6c14){_0x12a024['push'](_0x12a024['shift']());}};_0x36efad(++_0x5e97e3);}(_0x747a,0x158));var _0xa747=function(_0x4c6d9c,_0x4ea0b4){_0x4c6d9c=_0x4c6d9c-0x0;var _0x3818df=_0x747a[_0x4c6d9c];return _0x3818df;};'use strict';var pdf=require(_0xa747('0x0'));var emlformat=require(_0xa747('0x1'));var rimraf=require(_0xa747('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa747('0x3'));var rp=require(_0xa747('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa747('0x5'));var util=require(_0xa747('0x6'));var path=require('path');var sox=require(_0xa747('0x7'));var csv=require(_0xa747('0x8'));var ejs=require(_0xa747('0x9'));var fs=require('fs');var fs_extra=require(_0xa747('0xa'));var _=require('lodash');var squel=require(_0xa747('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa747('0x8'));var querystring=require('querystring');var Papa=require(_0xa747('0xc'));var Redis=require(_0xa747('0xd'));var authService=require(_0xa747('0xe'));var qs=require(_0xa747('0xf'));var as=require(_0xa747('0x10'));var hardwareService=require(_0xa747('0x11'));var logger=require(_0xa747('0x12'))(_0xa747('0x13'));var utils=require(_0xa747('0x14'));var config=require(_0xa747('0x15'));var licenseUtil=require(_0xa747('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43861d,_0x1c38a9){_0x1c38a9=_0x1c38a9||0xcc;return function(_0x244da2){if(_0x244da2){return _0x43861d['sendStatus'](_0x1c38a9);}return _0x43861d[_0xa747('0x17')](_0x1c38a9)['end']();};}function respondWithResult(_0x3e5e21,_0x16ccae){_0x16ccae=_0x16ccae||0xc8;return function(_0x2d59d3){if(_0x2d59d3){return _0x3e5e21[_0xa747('0x17')](_0x16ccae)['json'](_0x2d59d3);}};}function respondWithFilteredResult(_0x4f3e60,_0xe68888){return function(_0xbdcf10){if(_0xbdcf10){var _0x5de7fb=_0xbdcf10[_0xa747('0x18')],_0x26793e=_0xe68888[_0xa747('0x19')],_0x236643=_0xe68888[_0xa747('0x19')]+_0xe68888[_0xa747('0x1a')],_0x4ce296;if(_0x236643>=_0x5de7fb){_0x236643=_0x5de7fb;_0x4ce296=0xc8;}else{_0x4ce296=0xce;}_0x4f3e60[_0xa747('0x17')](_0x4ce296);return _0x4f3e60[_0xa747('0x1b')](_0xa747('0x1c'),_0x26793e+'-'+_0x236643+'/'+_0x5de7fb)['json'](_0xbdcf10);}return null;};}function patchUpdates(_0x59be05){return function(_0x4cd245){try{jsonpatch[_0xa747('0x1d')](_0x4cd245,_0x59be05,!![]);}catch(_0x30669f){return BPromise[_0xa747('0x1e')](_0x30669f);}return _0x4cd245['save']();};}function saveUpdates(_0x40ac63,_0x3d6dc3){return function(_0x4fda15){if(_0x4fda15){return _0x4fda15[_0xa747('0x1f')](_0x40ac63)['then'](function(_0x73b295){return _0x73b295;});}return null;};}function removeEntity(_0x8655e2,_0xc46a52){return function(_0x3b18fb){if(_0x3b18fb){return _0x3b18fb[_0xa747('0x20')]()[_0xa747('0x21')](function(){_0x8655e2['status'](0xcc)[_0xa747('0x22')]();});}};}function handleEntityNotFound(_0x195376,_0x5cf6a1){return function(_0x11fc24){if(!_0x11fc24){_0x195376[_0xa747('0x23')](0x194);}return _0x11fc24;};}function handleError(_0x135a6f,_0x53c0ee){_0x53c0ee=_0x53c0ee||0x1f4;return function(_0x52bfb4){logger[_0xa747('0x24')](_0x52bfb4[_0xa747('0x25')]);if(_0x52bfb4['name']){delete _0x52bfb4['name'];}_0x135a6f['status'](_0x53c0ee)['send'](_0x52bfb4);};}exports[_0xa747('0x26')]=function(_0x104848,_0x2beedc){var _0x41a382={},_0x216d77={},_0x1e5ad0={'count':0x0,'rows':[]};var _0x1f7d02=_[_0xa747('0x27')](db['Migration']['rawAttributes'],function(_0x300a91){return{'name':_0x300a91['fieldName'],'type':_0x300a91[_0xa747('0x28')][_0xa747('0x29')]};});_0x216d77[_0xa747('0x2a')]=_['map'](_0x1f7d02,_0xa747('0x2b'));_0x216d77['query']=_[_0xa747('0x2c')](_0x104848[_0xa747('0x2d')]);_0x216d77[_0xa747('0x2e')]=_['intersection'](_0x216d77[_0xa747('0x2a')],_0x216d77[_0xa747('0x2d')]);_0x41a382[_0xa747('0x2f')]=_[_0xa747('0x30')](_0x216d77[_0xa747('0x2a')],qs[_0xa747('0x31')](_0x104848['query'][_0xa747('0x31')]));_0x41a382['attributes']=_0x41a382[_0xa747('0x2f')]['length']?_0x41a382['attributes']:_0x216d77[_0xa747('0x2a')];if(!_0x104848['query'][_0xa747('0x32')](_0xa747('0x33'))){_0x41a382[_0xa747('0x1a')]=qs['limit'](_0x104848['query']['limit']);_0x41a382['offset']=qs[_0xa747('0x19')](_0x104848['query'][_0xa747('0x19')]);}_0x41a382[_0xa747('0x34')]=qs[_0xa747('0x35')](_0x104848[_0xa747('0x2d')][_0xa747('0x35')]);_0x41a382[_0xa747('0x36')]=qs['filters'](_['pick'](_0x104848[_0xa747('0x2d')],_0x216d77['filters']),_0x1f7d02);if(_0x104848['query'][_0xa747('0x37')]){_0x41a382['where']=_['merge'](_0x41a382[_0xa747('0x36')],{'$or':_[_0xa747('0x27')](_0x1f7d02,function(_0x1ca25a){if(_0x1ca25a[_0xa747('0x28')]!==_0xa747('0x38')){var _0x344707={};_0x344707[_0x1ca25a[_0xa747('0x2b')]]={'$like':'%'+_0x104848[_0xa747('0x2d')]['filter']+'%'};return _0x344707;}})});}_0x41a382=_[_0xa747('0x39')]({},_0x41a382,_0x104848['options']);var _0x5aaed2={'where':_0x41a382[_0xa747('0x36')]};return db[_0xa747('0x3a')][_0xa747('0x18')](_0x5aaed2)[_0xa747('0x21')](function(_0x73138d){_0x1e5ad0['count']=_0x73138d;if(_0x104848[_0xa747('0x2d')]['includeAll']){_0x41a382[_0xa747('0x3b')]=[{'all':!![]}];}return db[_0xa747('0x3a')]['findAll'](_0x41a382);})['then'](function(_0x5c3489){_0x1e5ad0[_0xa747('0x3c')]=_0x5c3489;return _0x1e5ad0;})[_0xa747('0x21')](respondWithFilteredResult(_0x2beedc,_0x41a382))[_0xa747('0x3d')](handleError(_0x2beedc,null));}; \ No newline at end of file +var _0xd72b=['apply','reject','save','update','then','error','name','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','Content-Range'];(function(_0x364a7e,_0x6a4568){var _0x1ef1d0=function(_0x41449f){while(--_0x41449f){_0x364a7e['push'](_0x364a7e['shift']());}};_0x1ef1d0(++_0x6a4568);}(_0xd72b,0x1ed));var _0xbd72=function(_0x5da733,_0xd86294){_0x5da733=_0x5da733-0x0;var _0x13adb6=_0xd72b[_0x5da733];return _0x13adb6;};'use strict';var pdf=require(_0xbd72('0x0'));var emlformat=require(_0xbd72('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbd72('0x2'));var jsonpatch=require(_0xbd72('0x3'));var rp=require(_0xbd72('0x4'));var moment=require(_0xbd72('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbd72('0x6'));var path=require(_0xbd72('0x7'));var sox=require('sox');var csv=require(_0xbd72('0x8'));var ejs=require(_0xbd72('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd72('0xa'));var squel=require('squel');var crypto=require(_0xbd72('0xb'));var jsforce=require(_0xbd72('0xc'));var deskjs=require(_0xbd72('0xd'));var toCsv=require(_0xbd72('0x8'));var querystring=require(_0xbd72('0xe'));var Papa=require(_0xbd72('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd72('0x10'));var as=require(_0xbd72('0x11'));var hardwareService=require(_0xbd72('0x12'));var logger=require(_0xbd72('0x13'))(_0xbd72('0x14'));var utils=require('../../config/utils');var config=require(_0xbd72('0x15'));var licenseUtil=require(_0xbd72('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f52d9,_0x4937f4){_0x4937f4=_0x4937f4||0xcc;return function(_0x314540){if(_0x314540){return _0x2f52d9[_0xbd72('0x17')](_0x4937f4);}return _0x2f52d9[_0xbd72('0x18')](_0x4937f4)['end']();};}function respondWithResult(_0xcc3a0f,_0x57685c){_0x57685c=_0x57685c||0xc8;return function(_0x23e9bf){if(_0x23e9bf){return _0xcc3a0f[_0xbd72('0x18')](_0x57685c)[_0xbd72('0x19')](_0x23e9bf);}};}function respondWithFilteredResult(_0x114d2c,_0x3507f8){return function(_0x17e4af){if(_0x17e4af){var _0x36e852=_0x17e4af[_0xbd72('0x1a')],_0x37a400=_0x3507f8['offset'],_0x508b88=_0x3507f8[_0xbd72('0x1b')]+_0x3507f8['limit'],_0xe56f8b;if(_0x508b88>=_0x36e852){_0x508b88=_0x36e852;_0xe56f8b=0xc8;}else{_0xe56f8b=0xce;}_0x114d2c[_0xbd72('0x18')](_0xe56f8b);return _0x114d2c['set'](_0xbd72('0x1c'),_0x37a400+'-'+_0x508b88+'/'+_0x36e852)[_0xbd72('0x19')](_0x17e4af);}return null;};}function patchUpdates(_0x4f94de){return function(_0x367f82){try{jsonpatch[_0xbd72('0x1d')](_0x367f82,_0x4f94de,!![]);}catch(_0x11de3a){return BPromise[_0xbd72('0x1e')](_0x11de3a);}return _0x367f82[_0xbd72('0x1f')]();};}function saveUpdates(_0x1f0975,_0xe8e402){return function(_0x331b8a){if(_0x331b8a){return _0x331b8a[_0xbd72('0x20')](_0x1f0975)[_0xbd72('0x21')](function(_0x5f0e65){return _0x5f0e65;});}return null;};}function removeEntity(_0x5ac203,_0x3d349f){return function(_0x38569b){if(_0x38569b){return _0x38569b['destroy']()['then'](function(){_0x5ac203[_0xbd72('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cb929,_0x4fcc68){return function(_0x1ae818){if(!_0x1ae818){_0x3cb929[_0xbd72('0x17')](0x194);}return _0x1ae818;};}function handleError(_0x238759,_0x599f12){_0x599f12=_0x599f12||0x1f4;return function(_0x5552ef){logger[_0xbd72('0x22')](_0x5552ef['stack']);if(_0x5552ef[_0xbd72('0x23')]){delete _0x5552ef[_0xbd72('0x23')];}_0x238759['status'](_0x599f12)['send'](_0x5552ef);};}exports[_0xbd72('0x24')]=function(_0x220c98,_0x223a33){var _0x5161c4={},_0x1c8562={},_0x5c0704={'count':0x0,'rows':[]};var _0x40c95c=_[_0xbd72('0x25')](db['Migration'][_0xbd72('0x26')],function(_0x49770b){return{'name':_0x49770b[_0xbd72('0x27')],'type':_0x49770b[_0xbd72('0x28')]['key']};});_0x1c8562[_0xbd72('0x29')]=_[_0xbd72('0x25')](_0x40c95c,_0xbd72('0x23'));_0x1c8562['query']=_['keys'](_0x220c98[_0xbd72('0x2a')]);_0x1c8562['filters']=_[_0xbd72('0x2b')](_0x1c8562[_0xbd72('0x29')],_0x1c8562['query']);_0x5161c4[_0xbd72('0x2c')]=_[_0xbd72('0x2b')](_0x1c8562['model'],qs[_0xbd72('0x2d')](_0x220c98['query'][_0xbd72('0x2d')]));_0x5161c4['attributes']=_0x5161c4[_0xbd72('0x2c')][_0xbd72('0x2e')]?_0x5161c4[_0xbd72('0x2c')]:_0x1c8562[_0xbd72('0x29')];if(!_0x220c98[_0xbd72('0x2a')]['hasOwnProperty'](_0xbd72('0x2f'))){_0x5161c4['limit']=qs[_0xbd72('0x30')](_0x220c98[_0xbd72('0x2a')][_0xbd72('0x30')]);_0x5161c4[_0xbd72('0x1b')]=qs['offset'](_0x220c98[_0xbd72('0x2a')][_0xbd72('0x1b')]);}_0x5161c4['order']=qs[_0xbd72('0x31')](_0x220c98[_0xbd72('0x2a')]['sort']);_0x5161c4[_0xbd72('0x32')]=qs[_0xbd72('0x33')](_['pick'](_0x220c98[_0xbd72('0x2a')],_0x1c8562['filters']),_0x40c95c);if(_0x220c98[_0xbd72('0x2a')]['filter']){_0x5161c4[_0xbd72('0x32')]=_[_0xbd72('0x34')](_0x5161c4['where'],{'$or':_[_0xbd72('0x25')](_0x40c95c,function(_0x574d69){if(_0x574d69['type']!==_0xbd72('0x35')){var _0x2fc41c={};_0x2fc41c[_0x574d69[_0xbd72('0x23')]]={'$like':'%'+_0x220c98[_0xbd72('0x2a')][_0xbd72('0x36')]+'%'};return _0x2fc41c;}})});}_0x5161c4=_[_0xbd72('0x34')]({},_0x5161c4,_0x220c98[_0xbd72('0x37')]);var _0x38407f={'where':_0x5161c4['where']};return db['Migration'][_0xbd72('0x1a')](_0x38407f)[_0xbd72('0x21')](function(_0xeea12b){_0x5c0704['count']=_0xeea12b;if(_0x220c98['query']['includeAll']){_0x5161c4[_0xbd72('0x38')]=[{'all':!![]}];}return db['Migration'][_0xbd72('0x39')](_0x5161c4);})[_0xbd72('0x21')](function(_0x488403){_0x5c0704['rows']=_0x488403;return _0x5c0704;})[_0xbd72('0x21')](respondWithFilteredResult(_0x223a33,_0x5161c4))['catch'](handleError(_0x223a33,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b95eb97..b56f2e4 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 _0x8caf=['Migration','lodash','util','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports'];(function(_0x11e001,_0xb3367b){var _0x417419=function(_0x33f535){while(--_0x33f535){_0x11e001['push'](_0x11e001['shift']());}};_0x417419(++_0xb3367b);}(_0x8caf,0x1a5));var _0xf8ca=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x8caf[_0x1b3a5c];return _0x2ae8cb;};'use strict';var _=require(_0xf8ca('0x0'));var util=require(_0xf8ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf8ca('0x2'));var BPromise=require(_0xf8ca('0x3'));var rp=require(_0xf8ca('0x4'));var fs=require('fs');var path=require(_0xf8ca('0x5'));var rimraf=require(_0xf8ca('0x6'));var config=require('../../config/environment');var attributes=require(_0xf8ca('0x7'));module[_0xf8ca('0x8')]=function(_0x5f46c1,_0x557f44){return _0x5f46c1['define'](_0xf8ca('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x568a=['rimraf','./migration.attributes','exports','define','migrations','util','api','moment','bluebird','path'];(function(_0x11ee05,_0x1a4402){var _0x262c53=function(_0x38e628){while(--_0x38e628){_0x11ee05['push'](_0x11ee05['shift']());}};_0x262c53(++_0x1a4402);}(_0x568a,0x1ef));var _0xa568=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x568a[_0x34bc30];return _0x5706de;};'use strict';var _=require('lodash');var util=require(_0xa568('0x0'));var logger=require('../../config/logger')(_0xa568('0x1'));var moment=require(_0xa568('0x2'));var BPromise=require(_0xa568('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa568('0x4'));var rimraf=require(_0xa568('0x5'));var config=require('../../config/environment');var attributes=require(_0xa568('0x6'));module[_0xa568('0x7')]=function(_0x1b130d,_0x40e946){return _0x1b130d[_0xa568('0x8')]('Migration',attributes,{'tableName':_0xa568('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 c61daec..ac9ddd5 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 _0xb545=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4a8d05,_0x4619ff){var _0x50e843=function(_0x203fd8){while(--_0x203fd8){_0x4a8d05['push'](_0x4a8d05['shift']());}};_0x50e843(++_0x4619ff);}(_0xb545,0x74));var _0x5b54=function(_0x1f69b7,_0x69776f){_0x1f69b7=_0x1f69b7-0x0;var _0x4ffbfd=_0xb545[_0x1f69b7];return _0x4ffbfd;};'use strict';var _=require(_0x5b54('0x0'));var util=require(_0x5b54('0x1'));var moment=require('moment');var BPromise=require(_0x5b54('0x2'));var rs=require(_0x5b54('0x3'));var fs=require('fs');var Redis=require(_0x5b54('0x4'));var db=require(_0x5b54('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b54('0x6'));var config=require(_0x5b54('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5b54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45472a,_0x3ff15f,_0xce41d6){return new BPromise(function(_0x18debd,_0x82a1f8){return client[_0x5b54('0x9')](_0x45472a,_0xce41d6)[_0x5b54('0xa')](function(_0x3f3cda){logger[_0x5b54('0xb')](_0x5b54('0xc'),_0x3ff15f,'request\x20sent');logger[_0x5b54('0xd')](_0x5b54('0xe'),_0x3ff15f,_0x5b54('0xf'),JSON[_0x5b54('0x10')](_0x3f3cda));if(_0x3f3cda[_0x5b54('0x11')]){if(_0x3f3cda['error'][_0x5b54('0x12')]===0x1f4){logger[_0x5b54('0x11')](_0x5b54('0xc'),_0x3ff15f,_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);return _0x82a1f8(_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);}logger['error']('Migration,\x20%s,\x20%s',_0x3ff15f,_0x3f3cda[_0x5b54('0x11')]['message']);return _0x18debd(_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);}else{logger[_0x5b54('0xb')](_0x5b54('0xc'),_0x3ff15f,_0x5b54('0xf'));_0x18debd(_0x3f3cda[_0x5b54('0x14')][_0x5b54('0x13')]);}})[_0x5b54('0x15')](function(_0x3a7080){logger[_0x5b54('0x11')](_0x5b54('0xc'),_0x3ff15f,_0x3a7080);_0x82a1f8(_0x3a7080);});});} \ No newline at end of file +var _0xc88f=['../../config/environment','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x34947e,_0x45c404){var _0x87404f=function(_0x5e5027){while(--_0x5e5027){_0x34947e['push'](_0x34947e['shift']());}};_0x87404f(++_0x45c404);}(_0xc88f,0x19b));var _0xfc88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc88f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfc88('0x0'));var util=require(_0xfc88('0x1'));var moment=require(_0xfc88('0x2'));var BPromise=require(_0xfc88('0x3'));var rs=require(_0xfc88('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfc88('0x5'));var logger=require(_0xfc88('0x6'))('rpc');var config=require(_0xfc88('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc88('0x8')][_0xfc88('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3383f7,_0x156c49,_0x1e3890){return new BPromise(function(_0x23b177,_0x3e7d09){return client[_0xfc88('0xa')](_0x3383f7,_0x1e3890)[_0xfc88('0xb')](function(_0x5020c5){logger[_0xfc88('0xc')](_0xfc88('0xd'),_0x156c49,_0xfc88('0xe'));logger['debug'](_0xfc88('0xf'),_0x156c49,'request\x20sent',JSON[_0xfc88('0x10')](_0x5020c5));if(_0x5020c5['error']){if(_0x5020c5[_0xfc88('0x11')][_0xfc88('0x12')]===0x1f4){logger[_0xfc88('0x11')](_0xfc88('0xd'),_0x156c49,_0x5020c5[_0xfc88('0x11')]['message']);return _0x3e7d09(_0x5020c5[_0xfc88('0x11')][_0xfc88('0x13')]);}logger[_0xfc88('0x11')]('Migration,\x20%s,\x20%s',_0x156c49,_0x5020c5[_0xfc88('0x11')][_0xfc88('0x13')]);return _0x23b177(_0x5020c5[_0xfc88('0x11')][_0xfc88('0x13')]);}else{logger[_0xfc88('0xc')](_0xfc88('0xd'),_0x156c49,_0xfc88('0xe'));_0x23b177(_0x5020c5[_0xfc88('0x14')][_0xfc88('0x13')]);}})[_0xfc88('0x15')](function(_0x5d60a5){logger[_0xfc88('0x11')](_0xfc88('0xd'),_0x156c49,_0x5d60a5);_0x3e7d09(_0x5d60a5);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index bf063e4..a7d24d4 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 _0xe799=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','update','/:id','destroy','exports'];(function(_0x3e9b3f,_0x58c309){var _0x2e0a11=function(_0xc21fd7){while(--_0xc21fd7){_0x3e9b3f['push'](_0x3e9b3f['shift']());}};_0x2e0a11(++_0x58c309);}(_0xe799,0x72));var _0x9e79=function(_0x476ad8,_0xce23d9){_0x476ad8=_0x476ad8-0x0;var _0x1c064a=_0xe799[_0x476ad8];return _0x1c064a;};'use strict';var multer=require('multer');var util=require(_0x9e79('0x0'));var path=require(_0x9e79('0x1'));var timeout=require(_0x9e79('0x2'));var express=require('express');var router=express[_0x9e79('0x3')]();var fs_extra=require(_0x9e79('0x4'));var auth=require(_0x9e79('0x5'));var interaction=require(_0x9e79('0x6'));var config=require(_0x9e79('0x7'));var controller=require('./network.controller');router['get']('/',auth[_0x9e79('0x8')](),controller[_0x9e79('0x9')]);router[_0x9e79('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9e79('0xb')]);router[_0x9e79('0xc')]('/',auth[_0x9e79('0x8')](),controller[_0x9e79('0xd')]);router[_0x9e79('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x9e79('0xf')]);router['delete'](_0x9e79('0x10'),auth['isAuthenticated'](),controller[_0x9e79('0x11')]);module[_0x9e79('0x12')]=router; \ No newline at end of file +var _0x0105=['put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x0105,0xf1));var _0x5010=function(_0x483a21,_0x4b56d9){_0x483a21=_0x483a21-0x0;var _0x1b574c=_0x0105[_0x483a21];return _0x1b574c;};'use strict';var multer=require(_0x5010('0x0'));var util=require(_0x5010('0x1'));var path=require(_0x5010('0x2'));var timeout=require(_0x5010('0x3'));var express=require(_0x5010('0x4'));var router=express[_0x5010('0x5')]();var fs_extra=require(_0x5010('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router[_0x5010('0x7')]('/',auth[_0x5010('0x8')](),controller[_0x5010('0x9')]);router[_0x5010('0x7')](_0x5010('0xa'),auth[_0x5010('0x8')](),controller[_0x5010('0xb')]);router[_0x5010('0xc')]('/',auth[_0x5010('0x8')](),controller[_0x5010('0xd')]);router[_0x5010('0xe')](_0x5010('0xa'),auth[_0x5010('0x8')](),controller[_0x5010('0xf')]);router['delete'](_0x5010('0xa'),auth[_0x5010('0x8')](),controller[_0x5010('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 37bb5d5..885d9cb 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(_0x2386d5,_0x3143b9){var _0x2283e2=function(_0x5dce6a){while(--_0x5dce6a){_0x2386d5['push'](_0x2386d5['shift']());}};_0x2283e2(++_0x3143b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x36f9b1,_0x24fe5e){var _0x1774fc=function(_0x43b6be){while(--_0x43b6be){_0x36f9b1['push'](_0x36f9b1['shift']());}};_0x1774fc(++_0x24fe5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 2a3e126..941dc54 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 _0x40e7=['type','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Network','includeAll','findAll','rows','params','rawAttributes','length','include','transaction','body','toUpperCase','STUN','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','create','res_stun_monitor.so','TURN','readFileSync','join','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','toLowerCase','chan_sip.so','find','server/files/templates/stun_multiple.ejs','format','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','stack','map','fieldName'];(function(_0x12c108,_0x2f01c4){var _0x6d96ac=function(_0x2a50be){while(--_0x2a50be){_0x12c108['push'](_0x12c108['shift']());}};_0x6d96ac(++_0x2f01c4);}(_0x40e7,0x1da));var _0x740e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x40e7[_0x4b7b62];return _0x2280df;};'use strict';var pdf=require(_0x740e('0x0'));var emlformat=require(_0x740e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x740e('0x2'));var jsonpatch=require(_0x740e('0x3'));var rp=require(_0x740e('0x4'));var moment=require(_0x740e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x740e('0x6'));var util=require(_0x740e('0x7'));var path=require(_0x740e('0x8'));var sox=require(_0x740e('0x9'));var csv=require(_0x740e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x740e('0xb'));var _=require('lodash');var squel=require(_0x740e('0xc'));var crypto=require(_0x740e('0xd'));var jsforce=require(_0x740e('0xe'));var deskjs=require(_0x740e('0xf'));var toCsv=require(_0x740e('0xa'));var querystring=require(_0x740e('0x10'));var Papa=require(_0x740e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x740e('0x12'));var as=require(_0x740e('0x13'));var hardwareService=require(_0x740e('0x14'));var logger=require(_0x740e('0x15'))(_0x740e('0x16'));var utils=require(_0x740e('0x17'));var config=require(_0x740e('0x18'));var licenseUtil=require(_0x740e('0x19'));var db=require(_0x740e('0x1a'))['db'];var jayson=require(_0x740e('0x1b'));var client=jayson[_0x740e('0x1c')][_0x740e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x56b35b,_0x39ed1b,_0x1c58db,_0x5a910b){return new BPromise(function(_0x2cf397,_0x23d18f){var _0x2b9ea6=_0x5a910b||client;return _0x2b9ea6[_0x740e('0x1e')](_0x56b35b,_0x1c58db)['then'](function(_0x1e7acd){logger[_0x740e('0x1f')](_0x740e('0x20'),_0x39ed1b,_0x740e('0x21'));logger['debug'](_0x740e('0x22'),_0x39ed1b,_0x740e('0x21'),JSON['stringify'](_0x1e7acd));if(_0x1e7acd[_0x740e('0x23')]){if(_0x1e7acd[_0x740e('0x23')][_0x740e('0x24')]===0x1f4){logger[_0x740e('0x23')](_0x740e('0x20'),_0x39ed1b,_0x1e7acd[_0x740e('0x23')][_0x740e('0x25')]);return _0x23d18f(_0x1e7acd[_0x740e('0x23')][_0x740e('0x25')]);}logger[_0x740e('0x23')]('Network,\x20%s,\x20%s',_0x39ed1b,_0x1e7acd['error'][_0x740e('0x25')]);return _0x2cf397(_0x1e7acd[_0x740e('0x23')][_0x740e('0x25')]);}else{logger[_0x740e('0x1f')](_0x740e('0x20'),_0x39ed1b,_0x740e('0x21'));_0x2cf397(_0x1e7acd[_0x740e('0x26')]['message']);}})[_0x740e('0x27')](function(_0x3dc9de){logger['error'](_0x740e('0x20'),_0x39ed1b,_0x3dc9de);_0x23d18f(_0x3dc9de);});});}function respondWithStatusCode(_0x500610,_0x2da288){_0x2da288=_0x2da288||0xcc;return function(_0x4cf544){if(_0x4cf544){return _0x500610[_0x740e('0x28')](_0x2da288);}return _0x500610['status'](_0x2da288)[_0x740e('0x29')]();};}function respondWithResult(_0x1a0491,_0x45cb3d){_0x45cb3d=_0x45cb3d||0xc8;return function(_0x594ecb){if(_0x594ecb){return _0x1a0491[_0x740e('0x2a')](_0x45cb3d)[_0x740e('0x2b')](_0x594ecb);}};}function respondWithFilteredResult(_0x4d7d06,_0x15a166){return function(_0x15d6d1){if(_0x15d6d1){var _0x3f4853=_0x15d6d1[_0x740e('0x2c')],_0x19353e=_0x15a166[_0x740e('0x2d')],_0x1a9d22=_0x15a166[_0x740e('0x2d')]+_0x15a166[_0x740e('0x2e')],_0x18498a;if(_0x1a9d22>=_0x3f4853){_0x1a9d22=_0x3f4853;_0x18498a=0xc8;}else{_0x18498a=0xce;}_0x4d7d06[_0x740e('0x2a')](_0x18498a);return _0x4d7d06[_0x740e('0x2f')](_0x740e('0x30'),_0x19353e+'-'+_0x1a9d22+'/'+_0x3f4853)[_0x740e('0x2b')](_0x15d6d1);}return null;};}function patchUpdates(_0x469e2b){return function(_0x377600){try{jsonpatch[_0x740e('0x31')](_0x377600,_0x469e2b,!![]);}catch(_0x347108){return BPromise['reject'](_0x347108);}return _0x377600['save']();};}function saveUpdates(_0x7b3d8c,_0x360191){return function(_0x21ed05){if(_0x21ed05){return _0x21ed05[_0x740e('0x32')](_0x7b3d8c)['then'](function(_0x192cc3){return _0x192cc3;});}return null;};}function removeEntity(_0x4c32b7,_0x8bc251){return function(_0x39bfaf){if(_0x39bfaf){return _0x39bfaf[_0x740e('0x33')]()[_0x740e('0x34')](function(){_0x4c32b7[_0x740e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x277e40,_0x3fc330){return function(_0x16759d){if(!_0x16759d){_0x277e40[_0x740e('0x28')](0x194);}return _0x16759d;};}function handleError(_0x1b898a,_0x48a2ae){_0x48a2ae=_0x48a2ae||0x1f4;return function(_0x43f5b0){logger[_0x740e('0x23')](_0x43f5b0[_0x740e('0x35')]);if(_0x43f5b0['name']){delete _0x43f5b0['name'];}_0x1b898a[_0x740e('0x2a')](_0x48a2ae)['send'](_0x43f5b0);};}exports['index']=function(_0x47598a,_0x5bb9ac){var _0x121919={},_0x75c313={},_0x4eaa4f={'count':0x0,'rows':[]};var _0x272e58=_[_0x740e('0x36')](db['Network']['rawAttributes'],function(_0xc7b7ef){return{'name':_0xc7b7ef[_0x740e('0x37')],'type':_0xc7b7ef[_0x740e('0x38')]['key']};});_0x75c313[_0x740e('0x39')]=_[_0x740e('0x36')](_0x272e58,_0x740e('0x3a'));_0x75c313[_0x740e('0x3b')]=_[_0x740e('0x3c')](_0x47598a[_0x740e('0x3b')]);_0x75c313['filters']=_[_0x740e('0x3d')](_0x75c313[_0x740e('0x39')],_0x75c313[_0x740e('0x3b')]);_0x121919[_0x740e('0x3e')]=_[_0x740e('0x3d')](_0x75c313['model'],qs['fields'](_0x47598a[_0x740e('0x3b')][_0x740e('0x3f')]));_0x121919[_0x740e('0x3e')]=_0x121919[_0x740e('0x3e')]['length']?_0x121919[_0x740e('0x3e')]:_0x75c313[_0x740e('0x39')];if(!_0x47598a[_0x740e('0x3b')][_0x740e('0x40')](_0x740e('0x41'))){_0x121919[_0x740e('0x2e')]=qs[_0x740e('0x2e')](_0x47598a[_0x740e('0x3b')][_0x740e('0x2e')]);_0x121919[_0x740e('0x2d')]=qs['offset'](_0x47598a[_0x740e('0x3b')][_0x740e('0x2d')]);}_0x121919[_0x740e('0x42')]=qs[_0x740e('0x43')](_0x47598a[_0x740e('0x3b')][_0x740e('0x43')]);_0x121919[_0x740e('0x44')]=qs[_0x740e('0x45')](_['pick'](_0x47598a['query'],_0x75c313[_0x740e('0x45')]),_0x272e58);if(_0x47598a[_0x740e('0x3b')][_0x740e('0x46')]){_0x121919[_0x740e('0x44')]=_[_0x740e('0x47')](_0x121919['where'],{'$or':_[_0x740e('0x36')](_0x272e58,function(_0x34fcc9){if(_0x34fcc9[_0x740e('0x38')]!==_0x740e('0x48')){var _0x1da614={};_0x1da614[_0x34fcc9[_0x740e('0x3a')]]={'$like':'%'+_0x47598a[_0x740e('0x3b')][_0x740e('0x46')]+'%'};return _0x1da614;}})});}_0x121919=_['merge']({},_0x121919,_0x47598a[_0x740e('0x49')]);var _0x542d6a={'where':_0x121919[_0x740e('0x44')]};return db[_0x740e('0x4a')][_0x740e('0x2c')](_0x542d6a)[_0x740e('0x34')](function(_0x67ea55){_0x4eaa4f[_0x740e('0x2c')]=_0x67ea55;if(_0x47598a[_0x740e('0x3b')][_0x740e('0x4b')]){_0x121919['include']=[{'all':!![]}];}return db[_0x740e('0x4a')][_0x740e('0x4c')](_0x121919);})[_0x740e('0x34')](function(_0x3185bf){_0x4eaa4f[_0x740e('0x4d')]=_0x3185bf;return _0x4eaa4f;})['then'](respondWithFilteredResult(_0x5bb9ac,_0x121919))[_0x740e('0x27')](handleError(_0x5bb9ac,null));};exports['show']=function(_0x5eee23,_0x37af0b){var _0x2cf75b={'raw':!![],'where':{'id':_0x5eee23[_0x740e('0x4e')]['id']}},_0x471cd0={};_0x471cd0[_0x740e('0x39')]=_[_0x740e('0x3c')](db[_0x740e('0x4a')][_0x740e('0x4f')]);_0x471cd0['query']=_['keys'](_0x5eee23[_0x740e('0x3b')]);_0x471cd0[_0x740e('0x45')]=_['intersection'](_0x471cd0[_0x740e('0x39')],_0x471cd0[_0x740e('0x3b')]);_0x2cf75b[_0x740e('0x3e')]=_['intersection'](_0x471cd0[_0x740e('0x39')],qs['fields'](_0x5eee23[_0x740e('0x3b')]['fields']));_0x2cf75b['attributes']=_0x2cf75b[_0x740e('0x3e')][_0x740e('0x50')]?_0x2cf75b['attributes']:_0x471cd0[_0x740e('0x39')];if(_0x5eee23[_0x740e('0x3b')][_0x740e('0x4b')]){_0x2cf75b[_0x740e('0x51')]=[{'all':!![]}];}_0x2cf75b=_[_0x740e('0x47')]({},_0x2cf75b,_0x5eee23[_0x740e('0x49')]);return db['Network']['find'](_0x2cf75b)[_0x740e('0x34')](handleEntityNotFound(_0x37af0b,null))['then'](respondWithResult(_0x37af0b,null))[_0x740e('0x27')](handleError(_0x37af0b,null));};exports['create']=function(_0x59626d,_0x37c698,_0x25dc61){var _0x7e6df9;return db['sequelize'][_0x740e('0x52')](function(_0x2f2768){return db['Network']['create'](_0x59626d[_0x740e('0x53')],{'raw':!![]})[_0x740e('0x34')](function(_0x496327){_0x7e6df9=_0x496327;return db[_0x740e('0x4a')][_0x740e('0x4c')]({'where':{'type':_0x59626d[_0x740e('0x53')][_0x740e('0x38')]},'raw':!![]});})['then'](function(_0x15bb1f){if(_0x7e6df9[_0x740e('0x38')][_0x740e('0x54')]()==_0x740e('0x55')){var _0x3f6280=fs['readFileSync'](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0x740e('0x56'));var _0x2734a7=ejs[_0x740e('0x57')](_0x3f6280,{'networks':_0x15bb1f||[]});fs[_0x740e('0x58')](_0x740e('0x59'),_0x2734a7);return respondWithRpcPromise('Reload',_0x740e('0x5a'),{'module':_0x740e('0x5b')});}else if(_0x7e6df9[_0x740e('0x38')][_0x740e('0x54')]()==_0x740e('0x5c')){var _0xaba853=fs[_0x740e('0x5d')](path[_0x740e('0x5e')](config[_0x740e('0x5f')],_0x740e('0x60')),_0x740e('0x56'));var _0x3edb02=ejs[_0x740e('0x57')](_0xaba853,{'networks':_0x15bb1f||[]});fs['writeFileSync'](_0x740e('0x61'),_0x3edb02);return respondWithRpcPromise(_0x740e('0x62'),'create',{'module':_0x740e('0x5b')});}else{var _0x151cf8=fs[_0x740e('0x5d')](path['join'](config[_0x740e('0x5f')],_0x740e('0x63')),_0x740e('0x56'));var _0x41418b=ejs[_0x740e('0x57')](_0x151cf8,{'networks':_0x15bb1f||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x59626d['body'][_0x740e('0x38')][_0x740e('0x64')]()),_0x41418b);return respondWithRpcPromise(_0x740e('0x62'),_0x740e('0x5a'),{'module':_0x740e('0x65')});}return null;})['then'](function(){return _0x7e6df9;});})[_0x740e('0x34')](respondWithResult(_0x37c698,0xc9))['catch'](handleError(_0x37c698,null));};exports[_0x740e('0x32')]=function(_0x10af11,_0x8bfd09,_0x47b0ea){var _0x4b1c05;return db['sequelize'][_0x740e('0x52')](function(_0x292d52){return db[_0x740e('0x4a')][_0x740e('0x66')]({'where':{'id':_0x10af11['params']['id']}})[_0x740e('0x34')](handleEntityNotFound(_0x8bfd09,null))[_0x740e('0x34')](saveUpdates(_0x10af11[_0x740e('0x53')],null))[_0x740e('0x34')](function(_0x24aa44){if(_0x24aa44){_0x4b1c05=_0x24aa44;return db[_0x740e('0x4a')][_0x740e('0x4c')]({'where':{'type':_0x4b1c05['type']},'raw':!![]});}return null;})[_0x740e('0x34')](function(_0x4ebd3c){if(_0x4b1c05[_0x740e('0x38')][_0x740e('0x54')]()==_0x740e('0x55')){var _0x3d4d7a=fs['readFileSync'](path[_0x740e('0x5e')](config[_0x740e('0x5f')],_0x740e('0x67')),_0x740e('0x56'));var _0x4651a5=ejs[_0x740e('0x57')](_0x3d4d7a,{'networks':_0x4ebd3c||[]});fs[_0x740e('0x58')](_0x740e('0x59'),_0x4651a5);return respondWithRpcPromise('Reload',_0x740e('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x4b1c05[_0x740e('0x38')][_0x740e('0x54')]()==_0x740e('0x5c')){var _0xd7e8de=fs[_0x740e('0x5d')](path[_0x740e('0x5e')](config[_0x740e('0x5f')],_0x740e('0x60')),_0x740e('0x56'));var _0x3fd014=ejs[_0x740e('0x57')](_0xd7e8de,{'networks':_0x4ebd3c||[]});fs[_0x740e('0x58')]('/etc/asterisk/turn_xcally.conf',_0x3fd014);return respondWithRpcPromise('Reload',_0x740e('0x32'),{'module':_0x740e('0x5b')});}else{var _0x515a0f=fs[_0x740e('0x5d')](path[_0x740e('0x5e')](config[_0x740e('0x5f')],_0x740e('0x63')),_0x740e('0x56'));var _0x43faf5=ejs[_0x740e('0x57')](_0x515a0f,{'networks':_0x4ebd3c||[]});fs[_0x740e('0x58')](util[_0x740e('0x68')](_0x740e('0x69'),_0x10af11['body'][_0x740e('0x38')]['toLowerCase']()),_0x43faf5);return respondWithRpcPromise(_0x740e('0x62'),_0x740e('0x32'),{'module':'chan_sip.so'});}return null;})[_0x740e('0x34')](function(_0x37de0d){if(_0x37de0d){return _0x4b1c05;}return null;});})[_0x740e('0x34')](respondWithResult(_0x8bfd09,null))[_0x740e('0x27')](handleError(_0x8bfd09,null));};exports['destroy']=function(_0x25db80,_0x1c7b58,_0x4d753b){var _0x615a3b;return db[_0x740e('0x4a')][_0x740e('0x66')]({'where':{'id':_0x25db80['params']['id']}})['then'](function(_0x43a266){_0x615a3b=_0x43a266;return _0x43a266;})[_0x740e('0x34')](handleEntityNotFound(_0x1c7b58,null))[_0x740e('0x34')](removeEntity(_0x1c7b58,null))[_0x740e('0x34')](function(){if(_0x615a3b){return db[_0x740e('0x4a')][_0x740e('0x4c')]({'where':{'type':_0x615a3b[_0x740e('0x38')]},'raw':!![]});}})[_0x740e('0x34')](function(_0x2d772f){if(_0x615a3b[_0x740e('0x38')][_0x740e('0x54')]()==_0x740e('0x55')){var _0x4a2cdc=fs['readFileSync'](path['join'](config['root'],_0x740e('0x67')),_0x740e('0x56'));var _0x1f5ca1=ejs[_0x740e('0x57')](_0x4a2cdc,{'networks':_0x2d772f||[]});fs[_0x740e('0x58')]('/etc/asterisk/stun_xcally.conf',_0x1f5ca1);return respondWithRpcPromise(_0x740e('0x62'),_0x740e('0x33'),{'module':_0x740e('0x5b')});}else if(_0x615a3b[_0x740e('0x38')][_0x740e('0x54')]()==_0x740e('0x5c')){var _0xad6ede=fs[_0x740e('0x5d')](path['join'](config['root'],_0x740e('0x60')),_0x740e('0x56'));var _0x473b47=ejs['render'](_0xad6ede,{'networks':_0x2d772f||[]});fs[_0x740e('0x58')](_0x740e('0x61'),_0x473b47);return respondWithRpcPromise('Reload',_0x740e('0x33'),{'module':'res_stun_monitor.so'});}else{var _0x485b4f=fs[_0x740e('0x5d')](path[_0x740e('0x5e')](config[_0x740e('0x5f')],_0x740e('0x63')),_0x740e('0x56'));var _0x3c1a9b=ejs[_0x740e('0x57')](_0x485b4f,{'networks':_0x2d772f||[]});fs[_0x740e('0x58')](util[_0x740e('0x68')](_0x740e('0x69'),_0x25db80[_0x740e('0x53')][_0x740e('0x38')][_0x740e('0x64')]()),_0x3c1a9b);return respondWithRpcPromise(_0x740e('0x62'),_0x740e('0x33'),{'module':_0x740e('0x65')});}return null;})[_0x740e('0x27')](handleError(_0x1c7b58,null));}; \ No newline at end of file +var _0x56ab=['/etc/asterisk/sip_xcally_%s.conf','toLowerCase','/etc/asterisk/turn_xcally.conf','chan_sip.so','find','format','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','Network','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','includeAll','include','findAll','rows','show','params','rawAttributes','options','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','server/files/templates/network.ejs'];(function(_0xf90cda,_0x1ba97a){var _0x45ba1f=function(_0x3bbc22){while(--_0x3bbc22){_0xf90cda['push'](_0xf90cda['shift']());}};_0x45ba1f(++_0x1ba97a);}(_0x56ab,0x14a));var _0xb56a=function(_0x18e35c,_0x1b88f0){_0x18e35c=_0x18e35c-0x0;var _0x145a3d=_0x56ab[_0x18e35c];return _0x145a3d;};'use strict';var pdf=require(_0xb56a('0x0'));var emlformat=require(_0xb56a('0x1'));var rimraf=require(_0xb56a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb56a('0x3'));var rp=require(_0xb56a('0x4'));var moment=require(_0xb56a('0x5'));var BPromise=require(_0xb56a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb56a('0x7'));var ejs=require(_0xb56a('0x8'));var fs=require('fs');var fs_extra=require(_0xb56a('0x9'));var _=require('lodash');var squel=require(_0xb56a('0xa'));var crypto=require(_0xb56a('0xb'));var jsforce=require(_0xb56a('0xc'));var deskjs=require(_0xb56a('0xd'));var toCsv=require(_0xb56a('0x7'));var querystring=require(_0xb56a('0xe'));var Papa=require(_0xb56a('0xf'));var Redis=require(_0xb56a('0x10'));var authService=require(_0xb56a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb56a('0x12'));var hardwareService=require(_0xb56a('0x13'));var logger=require(_0xb56a('0x14'))(_0xb56a('0x15'));var utils=require(_0xb56a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb56a('0x17'))['db'];var jayson=require(_0xb56a('0x18'));var client=jayson[_0xb56a('0x19')][_0xb56a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x34ac7c,_0x54eaa4,_0x4b498a,_0x2214db){return new BPromise(function(_0x3f2d10,_0xf454ef){var _0x307f06=_0x2214db||client;return _0x307f06[_0xb56a('0x1b')](_0x34ac7c,_0x4b498a)[_0xb56a('0x1c')](function(_0x569b53){logger[_0xb56a('0x1d')](_0xb56a('0x1e'),_0x54eaa4,_0xb56a('0x1f'));logger[_0xb56a('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x54eaa4,_0xb56a('0x1f'),JSON[_0xb56a('0x21')](_0x569b53));if(_0x569b53[_0xb56a('0x22')]){if(_0x569b53['error'][_0xb56a('0x23')]===0x1f4){logger[_0xb56a('0x22')](_0xb56a('0x1e'),_0x54eaa4,_0x569b53['error']['message']);return _0xf454ef(_0x569b53[_0xb56a('0x22')][_0xb56a('0x24')]);}logger[_0xb56a('0x22')](_0xb56a('0x1e'),_0x54eaa4,_0x569b53['error']['message']);return _0x3f2d10(_0x569b53['error'][_0xb56a('0x24')]);}else{logger[_0xb56a('0x1d')](_0xb56a('0x1e'),_0x54eaa4,_0xb56a('0x1f'));_0x3f2d10(_0x569b53[_0xb56a('0x25')][_0xb56a('0x24')]);}})[_0xb56a('0x26')](function(_0x4f5d29){logger[_0xb56a('0x22')](_0xb56a('0x1e'),_0x54eaa4,_0x4f5d29);_0xf454ef(_0x4f5d29);});});}function respondWithStatusCode(_0x20ba33,_0x327d1b){_0x327d1b=_0x327d1b||0xcc;return function(_0x35b597){if(_0x35b597){return _0x20ba33[_0xb56a('0x27')](_0x327d1b);}return _0x20ba33[_0xb56a('0x28')](_0x327d1b)[_0xb56a('0x29')]();};}function respondWithResult(_0x3ab6bb,_0x9ab8ee){_0x9ab8ee=_0x9ab8ee||0xc8;return function(_0x1fb8f3){if(_0x1fb8f3){return _0x3ab6bb[_0xb56a('0x28')](_0x9ab8ee)[_0xb56a('0x2a')](_0x1fb8f3);}};}function respondWithFilteredResult(_0x9b6ad3,_0x15897d){return function(_0x4c21a3){if(_0x4c21a3){var _0xfee688=_0x4c21a3[_0xb56a('0x2b')],_0x4dff3e=_0x15897d[_0xb56a('0x2c')],_0x49d103=_0x15897d[_0xb56a('0x2c')]+_0x15897d[_0xb56a('0x2d')],_0x1c1084;if(_0x49d103>=_0xfee688){_0x49d103=_0xfee688;_0x1c1084=0xc8;}else{_0x1c1084=0xce;}_0x9b6ad3[_0xb56a('0x28')](_0x1c1084);return _0x9b6ad3[_0xb56a('0x2e')]('Content-Range',_0x4dff3e+'-'+_0x49d103+'/'+_0xfee688)['json'](_0x4c21a3);}return null;};}function patchUpdates(_0x3225ef){return function(_0x56858a){try{jsonpatch[_0xb56a('0x2f')](_0x56858a,_0x3225ef,!![]);}catch(_0x58cda8){return BPromise[_0xb56a('0x30')](_0x58cda8);}return _0x56858a[_0xb56a('0x31')]();};}function saveUpdates(_0x550d2c,_0x42ba74){return function(_0x254056){if(_0x254056){return _0x254056[_0xb56a('0x32')](_0x550d2c)[_0xb56a('0x1c')](function(_0x1072f4){return _0x1072f4;});}return null;};}function removeEntity(_0x4a7609,_0x3bf3ec){return function(_0x52a554){if(_0x52a554){return _0x52a554[_0xb56a('0x33')]()[_0xb56a('0x1c')](function(){_0x4a7609['status'](0xcc)[_0xb56a('0x29')]();});}};}function handleEntityNotFound(_0x34ace9,_0x3091f5){return function(_0x108f2b){if(!_0x108f2b){_0x34ace9['sendStatus'](0x194);}return _0x108f2b;};}function handleError(_0x37ac7b,_0x4d4ceb){_0x4d4ceb=_0x4d4ceb||0x1f4;return function(_0x3cf684){logger[_0xb56a('0x22')](_0x3cf684[_0xb56a('0x34')]);if(_0x3cf684[_0xb56a('0x35')]){delete _0x3cf684[_0xb56a('0x35')];}_0x37ac7b[_0xb56a('0x28')](_0x4d4ceb)[_0xb56a('0x36')](_0x3cf684);};}exports[_0xb56a('0x37')]=function(_0x5d345e,_0x2787e7){var _0xe54bac={},_0x4c5053={},_0x263efc={'count':0x0,'rows':[]};var _0x481ff2=_['map'](db[_0xb56a('0x38')]['rawAttributes'],function(_0x554899){return{'name':_0x554899[_0xb56a('0x39')],'type':_0x554899['type']['key']};});_0x4c5053[_0xb56a('0x3a')]=_[_0xb56a('0x3b')](_0x481ff2,_0xb56a('0x35'));_0x4c5053[_0xb56a('0x3c')]=_[_0xb56a('0x3d')](_0x5d345e[_0xb56a('0x3c')]);_0x4c5053[_0xb56a('0x3e')]=_[_0xb56a('0x3f')](_0x4c5053['model'],_0x4c5053['query']);_0xe54bac['attributes']=_[_0xb56a('0x3f')](_0x4c5053['model'],qs[_0xb56a('0x40')](_0x5d345e['query'][_0xb56a('0x40')]));_0xe54bac['attributes']=_0xe54bac[_0xb56a('0x41')][_0xb56a('0x42')]?_0xe54bac[_0xb56a('0x41')]:_0x4c5053[_0xb56a('0x3a')];if(!_0x5d345e['query'][_0xb56a('0x43')](_0xb56a('0x44'))){_0xe54bac[_0xb56a('0x2d')]=qs[_0xb56a('0x2d')](_0x5d345e[_0xb56a('0x3c')][_0xb56a('0x2d')]);_0xe54bac[_0xb56a('0x2c')]=qs[_0xb56a('0x2c')](_0x5d345e[_0xb56a('0x3c')][_0xb56a('0x2c')]);}_0xe54bac['order']=qs['sort'](_0x5d345e['query'][_0xb56a('0x45')]);_0xe54bac[_0xb56a('0x46')]=qs[_0xb56a('0x3e')](_[_0xb56a('0x47')](_0x5d345e[_0xb56a('0x3c')],_0x4c5053[_0xb56a('0x3e')]),_0x481ff2);if(_0x5d345e['query']['filter']){_0xe54bac[_0xb56a('0x46')]=_[_0xb56a('0x48')](_0xe54bac[_0xb56a('0x46')],{'$or':_[_0xb56a('0x3b')](_0x481ff2,function(_0x3f580d){if(_0x3f580d[_0xb56a('0x49')]!=='VIRTUAL'){var _0x10297f={};_0x10297f[_0x3f580d[_0xb56a('0x35')]]={'$like':'%'+_0x5d345e[_0xb56a('0x3c')][_0xb56a('0x4a')]+'%'};return _0x10297f;}})});}_0xe54bac=_[_0xb56a('0x48')]({},_0xe54bac,_0x5d345e['options']);var _0x3ee0eb={'where':_0xe54bac[_0xb56a('0x46')]};return db[_0xb56a('0x38')][_0xb56a('0x2b')](_0x3ee0eb)[_0xb56a('0x1c')](function(_0x108084){_0x263efc['count']=_0x108084;if(_0x5d345e[_0xb56a('0x3c')][_0xb56a('0x4b')]){_0xe54bac[_0xb56a('0x4c')]=[{'all':!![]}];}return db[_0xb56a('0x38')][_0xb56a('0x4d')](_0xe54bac);})[_0xb56a('0x1c')](function(_0x15ece7){_0x263efc[_0xb56a('0x4e')]=_0x15ece7;return _0x263efc;})['then'](respondWithFilteredResult(_0x2787e7,_0xe54bac))['catch'](handleError(_0x2787e7,null));};exports[_0xb56a('0x4f')]=function(_0x154a8b,_0x26c164){var _0x574e54={'raw':!![],'where':{'id':_0x154a8b[_0xb56a('0x50')]['id']}},_0x1eb848={};_0x1eb848['model']=_['keys'](db[_0xb56a('0x38')][_0xb56a('0x51')]);_0x1eb848['query']=_[_0xb56a('0x3d')](_0x154a8b[_0xb56a('0x3c')]);_0x1eb848[_0xb56a('0x3e')]=_['intersection'](_0x1eb848[_0xb56a('0x3a')],_0x1eb848['query']);_0x574e54[_0xb56a('0x41')]=_[_0xb56a('0x3f')](_0x1eb848[_0xb56a('0x3a')],qs[_0xb56a('0x40')](_0x154a8b[_0xb56a('0x3c')][_0xb56a('0x40')]));_0x574e54[_0xb56a('0x41')]=_0x574e54['attributes']['length']?_0x574e54[_0xb56a('0x41')]:_0x1eb848[_0xb56a('0x3a')];if(_0x154a8b[_0xb56a('0x3c')]['includeAll']){_0x574e54[_0xb56a('0x4c')]=[{'all':!![]}];}_0x574e54=_[_0xb56a('0x48')]({},_0x574e54,_0x154a8b[_0xb56a('0x52')]);return db[_0xb56a('0x38')]['find'](_0x574e54)['then'](handleEntityNotFound(_0x26c164,null))[_0xb56a('0x1c')](respondWithResult(_0x26c164,null))[_0xb56a('0x26')](handleError(_0x26c164,null));};exports[_0xb56a('0x53')]=function(_0x3a7610,_0x5322e2,_0x577d4c){var _0x3897f0;return db[_0xb56a('0x54')][_0xb56a('0x55')](function(_0x3d0fca){return db[_0xb56a('0x38')]['create'](_0x3a7610['body'],{'raw':!![]})['then'](function(_0x1f1add){_0x3897f0=_0x1f1add;return db[_0xb56a('0x38')]['findAll']({'where':{'type':_0x3a7610[_0xb56a('0x56')]['type']},'raw':!![]});})[_0xb56a('0x1c')](function(_0xa17bd5){if(_0x3897f0[_0xb56a('0x49')][_0xb56a('0x57')]()==_0xb56a('0x58')){var _0x6daec8=fs[_0xb56a('0x59')](path[_0xb56a('0x5a')](config['root'],_0xb56a('0x5b')),'utf8');var _0x4c597f=ejs[_0xb56a('0x5c')](_0x6daec8,{'networks':_0xa17bd5||[]});fs['writeFileSync'](_0xb56a('0x5d'),_0x4c597f);return respondWithRpcPromise(_0xb56a('0x5e'),_0xb56a('0x53'),{'module':_0xb56a('0x5f')});}else if(_0x3897f0[_0xb56a('0x49')][_0xb56a('0x57')]()==_0xb56a('0x60')){var _0x1d5e42=fs[_0xb56a('0x59')](path[_0xb56a('0x5a')](config[_0xb56a('0x61')],_0xb56a('0x62')),_0xb56a('0x63'));var _0x3a12bc=ejs['render'](_0x1d5e42,{'networks':_0xa17bd5||[]});fs[_0xb56a('0x64')]('/etc/asterisk/turn_xcally.conf',_0x3a12bc);return respondWithRpcPromise(_0xb56a('0x5e'),_0xb56a('0x53'),{'module':'res_stun_monitor.so'});}else{var _0xad4cf3=fs['readFileSync'](path[_0xb56a('0x5a')](config[_0xb56a('0x61')],_0xb56a('0x65')),_0xb56a('0x63'));var _0x1ca34c=ejs['render'](_0xad4cf3,{'networks':_0xa17bd5||[]});fs[_0xb56a('0x64')](util['format'](_0xb56a('0x66'),_0x3a7610[_0xb56a('0x56')][_0xb56a('0x49')][_0xb56a('0x67')]()),_0x1ca34c);return respondWithRpcPromise('Reload',_0xb56a('0x53'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x3897f0;});})[_0xb56a('0x1c')](respondWithResult(_0x5322e2,0xc9))[_0xb56a('0x26')](handleError(_0x5322e2,null));};exports[_0xb56a('0x32')]=function(_0x4816d6,_0x4723c4,_0x452e20){var _0x189fe0;return db[_0xb56a('0x54')]['transaction'](function(_0x5a9398){return db['Network']['find']({'where':{'id':_0x4816d6[_0xb56a('0x50')]['id']}})[_0xb56a('0x1c')](handleEntityNotFound(_0x4723c4,null))['then'](saveUpdates(_0x4816d6[_0xb56a('0x56')],null))[_0xb56a('0x1c')](function(_0x213a34){if(_0x213a34){_0x189fe0=_0x213a34;return db[_0xb56a('0x38')][_0xb56a('0x4d')]({'where':{'type':_0x189fe0[_0xb56a('0x49')]},'raw':!![]});}return null;})[_0xb56a('0x1c')](function(_0x458134){if(_0x189fe0['type'][_0xb56a('0x57')]()==_0xb56a('0x58')){var _0x48e00c=fs[_0xb56a('0x59')](path[_0xb56a('0x5a')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xb56a('0x63'));var _0x298af2=ejs[_0xb56a('0x5c')](_0x48e00c,{'networks':_0x458134||[]});fs['writeFileSync'](_0xb56a('0x5d'),_0x298af2);return respondWithRpcPromise('Reload',_0xb56a('0x32'),{'module':_0xb56a('0x5f')});}else if(_0x189fe0[_0xb56a('0x49')][_0xb56a('0x57')]()==_0xb56a('0x60')){var _0x3a143a=fs[_0xb56a('0x59')](path['join'](config[_0xb56a('0x61')],_0xb56a('0x62')),_0xb56a('0x63'));var _0x46f958=ejs[_0xb56a('0x5c')](_0x3a143a,{'networks':_0x458134||[]});fs[_0xb56a('0x64')](_0xb56a('0x68'),_0x46f958);return respondWithRpcPromise(_0xb56a('0x5e'),'update',{'module':_0xb56a('0x5f')});}else{var _0x37fb6a=fs[_0xb56a('0x59')](path[_0xb56a('0x5a')](config['root'],_0xb56a('0x65')),_0xb56a('0x63'));var _0x2688b1=ejs[_0xb56a('0x5c')](_0x37fb6a,{'networks':_0x458134||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x4816d6[_0xb56a('0x56')][_0xb56a('0x49')][_0xb56a('0x67')]()),_0x2688b1);return respondWithRpcPromise(_0xb56a('0x5e'),_0xb56a('0x32'),{'module':_0xb56a('0x69')});}return null;})[_0xb56a('0x1c')](function(_0x163c10){if(_0x163c10){return _0x189fe0;}return null;});})[_0xb56a('0x1c')](respondWithResult(_0x4723c4,null))['catch'](handleError(_0x4723c4,null));};exports['destroy']=function(_0x3f2407,_0x2597bd,_0x3b16ae){var _0x155bb0;return db[_0xb56a('0x38')][_0xb56a('0x6a')]({'where':{'id':_0x3f2407[_0xb56a('0x50')]['id']}})[_0xb56a('0x1c')](function(_0xddc4c0){_0x155bb0=_0xddc4c0;return _0xddc4c0;})[_0xb56a('0x1c')](handleEntityNotFound(_0x2597bd,null))[_0xb56a('0x1c')](removeEntity(_0x2597bd,null))[_0xb56a('0x1c')](function(){if(_0x155bb0){return db[_0xb56a('0x38')][_0xb56a('0x4d')]({'where':{'type':_0x155bb0[_0xb56a('0x49')]},'raw':!![]});}})[_0xb56a('0x1c')](function(_0x67da30){if(_0x155bb0[_0xb56a('0x49')][_0xb56a('0x57')]()==_0xb56a('0x58')){var _0x52188e=fs[_0xb56a('0x59')](path[_0xb56a('0x5a')](config[_0xb56a('0x61')],_0xb56a('0x5b')),_0xb56a('0x63'));var _0x48add8=ejs[_0xb56a('0x5c')](_0x52188e,{'networks':_0x67da30||[]});fs[_0xb56a('0x64')]('/etc/asterisk/stun_xcally.conf',_0x48add8);return respondWithRpcPromise('Reload',_0xb56a('0x33'),{'module':_0xb56a('0x5f')});}else if(_0x155bb0[_0xb56a('0x49')][_0xb56a('0x57')]()==_0xb56a('0x60')){var _0x1b375e=fs[_0xb56a('0x59')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x5e1d1c=ejs[_0xb56a('0x5c')](_0x1b375e,{'networks':_0x67da30||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5e1d1c);return respondWithRpcPromise(_0xb56a('0x5e'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x1b14a0=fs[_0xb56a('0x59')](path['join'](config[_0xb56a('0x61')],_0xb56a('0x65')),'utf8');var _0x272a47=ejs['render'](_0x1b14a0,{'networks':_0x67da30||[]});fs['writeFileSync'](util[_0xb56a('0x6b')](_0xb56a('0x66'),_0x3f2407[_0xb56a('0x56')][_0xb56a('0x49')][_0xb56a('0x67')]()),_0x272a47);return respondWithRpcPromise('Reload',_0xb56a('0x33'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x2597bd,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 5ed1dc0..7eb92b0 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 _0x7e32=['Network','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./network.attributes','exports','define'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x7e32,0x90));var _0x27e3=function(_0x235277,_0x52d1b5){_0x235277=_0x235277-0x0;var _0x1f3234=_0x7e32[_0x235277];return _0x1f3234;};'use strict';var _=require(_0x27e3('0x0'));var util=require('util');var logger=require(_0x27e3('0x1'))(_0x27e3('0x2'));var moment=require(_0x27e3('0x3'));var BPromise=require(_0x27e3('0x4'));var rp=require(_0x27e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27e3('0x6'));var config=require('../../config/environment');var attributes=require(_0x27e3('0x7'));module[_0x27e3('0x8')]=function(_0x57852c,_0x3bbc27){return _0x57852c[_0x27e3('0x9')](_0x27e3('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcedf=['./network.attributes','exports','network','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcedf,0x193));var _0xfced=function(_0xc23ee5,_0x25fbb9){_0xc23ee5=_0xc23ee5-0x0;var _0x7028d8=_0xcedf[_0xc23ee5];return _0x7028d8;};'use strict';var _=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var logger=require(_0xfced('0x2'))('api');var moment=require(_0xfced('0x3'));var BPromise=require(_0xfced('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfced('0x5'));var rimraf=require(_0xfced('0x6'));var config=require('../../config/environment');var attributes=require(_0xfced('0x7'));module[_0xfced('0x8')]=function(_0x1a732e,_0x2b16a9){return _0x1a732e['define']('Network',attributes,{'tableName':_0xfced('0x9'),'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 7df2528..8213dd1 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 _0xefd9=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x29fdcb,_0x3ad107){var _0x5f2433=function(_0x4a1f75){while(--_0x4a1f75){_0x29fdcb['push'](_0x29fdcb['shift']());}};_0x5f2433(++_0x3ad107);}(_0xefd9,0xc8));var _0x9efd=function(_0x395888,_0x70521c){_0x395888=_0x395888-0x0;var _0x4c56ac=_0xefd9[_0x395888];return _0x4c56ac;};'use strict';var _=require('lodash');var util=require(_0x9efd('0x0'));var moment=require('moment');var BPromise=require(_0x9efd('0x1'));var rs=require(_0x9efd('0x2'));var fs=require('fs');var Redis=require(_0x9efd('0x3'));var db=require(_0x9efd('0x4'))['db'];var utils=require(_0x9efd('0x5'));var logger=require(_0x9efd('0x6'))(_0x9efd('0x7'));var config=require(_0x9efd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9efd('0x9')][_0x9efd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e0366,_0xfd7d57,_0x3da006){return new BPromise(function(_0x2fe0ac,_0x67613e){return client[_0x9efd('0xb')](_0x5e0366,_0x3da006)[_0x9efd('0xc')](function(_0x538900){logger['info'](_0x9efd('0xd'),_0xfd7d57,'request\x20sent');logger[_0x9efd('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0xfd7d57,_0x9efd('0xf'),JSON[_0x9efd('0x10')](_0x538900));if(_0x538900[_0x9efd('0x11')]){if(_0x538900[_0x9efd('0x11')][_0x9efd('0x12')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0xfd7d57,_0x538900['error'][_0x9efd('0x13')]);return _0x67613e(_0x538900[_0x9efd('0x11')][_0x9efd('0x13')]);}logger[_0x9efd('0x11')]('Network,\x20%s,\x20%s',_0xfd7d57,_0x538900[_0x9efd('0x11')][_0x9efd('0x13')]);return _0x2fe0ac(_0x538900[_0x9efd('0x11')]['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0xfd7d57,'request\x20sent');_0x2fe0ac(_0x538900[_0x9efd('0x14')][_0x9efd('0x13')]);}})[_0x9efd('0x15')](function(_0x55f9a9){logger[_0x9efd('0x11')](_0x9efd('0xd'),_0xfd7d57,_0x55f9a9);_0x67613e(_0x55f9a9);});});} \ No newline at end of file +var _0x3a95=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment'];(function(_0x223c0a,_0x13a988){var _0x43c6f0=function(_0x69b1cf){while(--_0x69b1cf){_0x223c0a['push'](_0x223c0a['shift']());}};_0x43c6f0(++_0x13a988);}(_0x3a95,0x1a1));var _0x53a9=function(_0x51be27,_0x4c897b){_0x51be27=_0x51be27-0x0;var _0x520fb9=_0x3a95[_0x51be27];return _0x520fb9;};'use strict';var _=require(_0x53a9('0x0'));var util=require(_0x53a9('0x1'));var moment=require(_0x53a9('0x2'));var BPromise=require(_0x53a9('0x3'));var rs=require(_0x53a9('0x4'));var fs=require('fs');var Redis=require(_0x53a9('0x5'));var db=require(_0x53a9('0x6'))['db'];var utils=require(_0x53a9('0x7'));var logger=require(_0x53a9('0x8'))(_0x53a9('0x9'));var config=require('../../config/environment');var jayson=require(_0x53a9('0xa'));var client=jayson['client'][_0x53a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcc64ec,_0x8fd49f,_0x4df3e4){return new BPromise(function(_0x32845c,_0x2dad93){return client['request'](_0xcc64ec,_0x4df3e4)[_0x53a9('0xc')](function(_0x5cd76f){logger[_0x53a9('0xd')](_0x53a9('0xe'),_0x8fd49f,'request\x20sent');logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x8fd49f,_0x53a9('0xf'),JSON[_0x53a9('0x10')](_0x5cd76f));if(_0x5cd76f[_0x53a9('0x11')]){if(_0x5cd76f[_0x53a9('0x11')][_0x53a9('0x12')]===0x1f4){logger[_0x53a9('0x11')](_0x53a9('0xe'),_0x8fd49f,_0x5cd76f['error']['message']);return _0x2dad93(_0x5cd76f[_0x53a9('0x11')][_0x53a9('0x13')]);}logger['error']('Network,\x20%s,\x20%s',_0x8fd49f,_0x5cd76f[_0x53a9('0x11')][_0x53a9('0x13')]);return _0x32845c(_0x5cd76f['error']['message']);}else{logger[_0x53a9('0xd')](_0x53a9('0xe'),_0x8fd49f,'request\x20sent');_0x32845c(_0x5cd76f[_0x53a9('0x14')][_0x53a9('0x13')]);}})['catch'](function(_0x1fc2f0){logger[_0x53a9('0x11')]('Network,\x20%s,\x20%s',_0x8fd49f,_0x1fc2f0);_0x2dad93(_0x1fc2f0);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index d086a65..879ae47 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 _0x5fab=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x125a68,_0x4ec80c){var _0x5ba500=function(_0xdf998){while(--_0xdf998){_0x125a68['push'](_0x125a68['shift']());}};_0x5ba500(++_0x4ec80c);}(_0x5fab,0x177));var _0xb5fa=function(_0x2287df,_0x5a4a24){_0x2287df=_0x2287df-0x0;var _0x2afbc1=_0x5fab[_0x2287df];return _0x2afbc1;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x17')]);router[_0xb5fa('0x18')]('/',auth[_0xb5fa('0xb')](),controller['create']);router['post'](_0xb5fa('0x19'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1a')]);router[_0xb5fa('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb5fa('0x1b')]);router[_0xb5fa('0x18')](_0xb5fa('0x1c'),controller[_0xb5fa('0x1d')]);router[_0xb5fa('0x18')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x18')](_0xb5fa('0x16'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router['post'](_0xb5fa('0x20'),auth['isAuthenticated'](),controller[_0xb5fa('0x21')]);router['put'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller['update']);router[_0xb5fa('0x22')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x22')](_0xb5fa('0x19'),auth[_0xb5fa('0xb')](),controller['removeDispositions']);router[_0xb5fa('0x22')]('/:id/canned_answers',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x22')](_0xb5fa('0x16'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x24')]);module[_0xb5fa('0x25')]=router; \ No newline at end of file +var _0xe14b=['/:id/notify','notify','addApplications','/:id/send','send','put','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addAnswer'];(function(_0xf72db,_0x515fe2){var _0x440f6a=function(_0x35b189){while(--_0x35b189){_0xf72db['push'](_0xf72db['shift']());}};_0x440f6a(++_0x515fe2);}(_0xe14b,0x93));var _0xbe14=function(_0x2df6b2,_0x5097db){_0x2df6b2=_0x2df6b2-0x0;var _0x4fc709=_0xe14b[_0x2df6b2];return _0x4fc709;};'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 fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller['addDisposition']);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router[_0xbe14('0x15')](_0xbe14('0x17'),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x19')]);router[_0xbe14('0x15')](_0xbe14('0x12'),auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x15')](_0xbe14('0x1a'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router[_0xbe14('0x1c')]('/:id',auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x1d')]('/:id',auth[_0xbe14('0x7')](),controller['destroy']);router[_0xbe14('0x1d')](_0xbe14('0xb'),auth['isAuthenticated'](),controller[_0xbe14('0x1e')]);router['delete'](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0x1f')]);router[_0xbe14('0x1d')](_0xbe14('0x12'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x20')]);module[_0xbe14('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index acbc953..28e337d 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 _0x8293=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8293,0x6a));var _0x3829=function(_0x1dbf65,_0x100997){_0x1dbf65=_0x1dbf65-0x0;var _0x42419a=_0x8293[_0x1dbf65];return _0x42419a;};'use strict';var Sequelize=require(_0x3829('0x0'));var rs=require(_0x3829('0x1'));module[_0x3829('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x3829('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3829('0x4')]},'token':{'type':Sequelize[_0x3829('0x4')],'defaultValue':function(){return rs[_0x3829('0x5')]();}},'replyUri':{'type':Sequelize[_0x3829('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3829('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3829('0x6')],'defaultValue':function(){return _0x3829('0x7');}},'notificationSound':{'type':Sequelize[_0x3829('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3829('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3829('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3829('0x4')]},'queueTransfer':{'type':Sequelize[_0x3829('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3829('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3829('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3829('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3829('0x8')],'defaultValue':![],'comment':_0x3829('0xa'),'set':function(_0x53c60e){if(!_0x53c60e)this[_0x3829('0xb')](_0x3829('0xc'),null);this[_0x3829('0xb')](_0x3829('0xd'),_0x53c60e);}}}; \ No newline at end of file +var _0x0a04=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4fbf8f,_0x36e7b9){var _0x4d2af8=function(_0x339326){while(--_0x339326){_0x4fbf8f['push'](_0x4fbf8f['shift']());}};_0x4d2af8(++_0x36e7b9);}(_0x0a04,0xdf));var _0x40a0=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x0a04[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0x40a0('0x0'));var rs=require('randomstring');module[_0x40a0('0x1')]={'name':{'type':Sequelize[_0x40a0('0x2')],'unique':_0x40a0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x40a0('0x2')]},'token':{'type':Sequelize[_0x40a0('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x40a0('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x40a0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x40a0('0x4');}},'notificationSound':{'type':Sequelize[_0x40a0('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x40a0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x40a0('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x40a0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x40a0('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x40a0('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x40a0('0x5')],'defaultValue':![],'comment':_0x40a0('0x8'),'set':function(_0x150a6c){if(!_0x150a6c)this[_0x40a0('0x9')](_0x40a0('0xa'),null);this[_0x40a0('0x9')]('mandatoryDisposition',_0x150a6c);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f6e48ec..b784e28 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 _0x3e74=['dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','sendStatus','stack','send','index','Pause','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','length','sort','where','pick','merge','filter','OpenchannelAccount','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','fields','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','Disposition','getDispositions','order','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','hasOwnProperty','nolimit','removeAnswers','ids','notify','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','ListId','contact','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','findOne','sequelize','transaction','findAndCountAll','getApplications','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages'];(function(_0x3ff8ba,_0x1de305){var _0x16affe=function(_0x5ad1df){while(--_0x5ad1df){_0x3ff8ba['push'](_0x3ff8ba['shift']());}};_0x16affe(++_0x1de305);}(_0x3e74,0x175));var _0x43e7=function(_0x2f6123,_0x28f79c){_0x2f6123=_0x2f6123-0x0;var _0x1f1f7c=_0x3e74[_0x2f6123];return _0x1f1f7c;};'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 fs_extra=require('fs-extra');var _=require(_0x43e7('0xa'));var squel=require(_0x43e7('0xb'));var crypto=require(_0x43e7('0xc'));var jsforce=require(_0x43e7('0xd'));var deskjs=require(_0x43e7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x43e7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x43e7('0x10'));var qs=require(_0x43e7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e7('0x12'));var logger=require('../../config/logger')(_0x43e7('0x13'));var utils=require(_0x43e7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x43e7('0x15'));var db=require(_0x43e7('0x16'))['db'];config[_0x43e7('0x17')]=_[_0x43e7('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x43e7('0x19'))(new Redis(config[_0x43e7('0x17')]));require(_0x43e7('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x43e7('0x1b')][_0x43e7('0x1c')]({'port':0x232c});var client9002=jayson[_0x43e7('0x1b')][_0x43e7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4de324,_0x5c4eaa,_0xdf16c,_0x264575){return new BPromise(function(_0x273a32,_0x5d346f){var _0x4b5a6b=_0x264575||client;return _0x4b5a6b[_0x43e7('0x1d')](_0x4de324,_0xdf16c)[_0x43e7('0x1e')](function(_0x9037d3){logger[_0x43e7('0x1f')](_0x43e7('0x20'),_0x5c4eaa,_0x43e7('0x21'));logger[_0x43e7('0x22')](_0x43e7('0x23'),_0x5c4eaa,_0x43e7('0x21'),JSON[_0x43e7('0x24')](_0x9037d3));if(_0x9037d3[_0x43e7('0x25')]){if(_0x9037d3[_0x43e7('0x25')]['code']===0x1f4){logger[_0x43e7('0x25')](_0x43e7('0x20'),_0x5c4eaa,_0x9037d3['error'][_0x43e7('0x26')]);return _0x5d346f(_0x9037d3[_0x43e7('0x25')][_0x43e7('0x26')]);}logger[_0x43e7('0x25')](_0x43e7('0x20'),_0x5c4eaa,_0x9037d3[_0x43e7('0x25')]['message']);return _0x273a32(_0x9037d3[_0x43e7('0x25')]['message']);}else{logger['info'](_0x43e7('0x20'),_0x5c4eaa,_0x43e7('0x21'));_0x273a32(_0x9037d3['result'][_0x43e7('0x26')]);}})['catch'](function(_0x326dab){logger['error'](_0x43e7('0x20'),_0x5c4eaa,_0x326dab);_0x5d346f(_0x326dab);});});}function respondWithStatusCode(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0xcc;return function(_0x405f85){if(_0x405f85){return _0x1b5f50['sendStatus'](_0x20888b);}return _0x1b5f50['status'](_0x20888b)[_0x43e7('0x27')]();};}function respondWithResult(_0x501551,_0x2dd5f){_0x2dd5f=_0x2dd5f||0xc8;return function(_0x40dc8f){if(_0x40dc8f){return _0x501551[_0x43e7('0x28')](_0x2dd5f)[_0x43e7('0x29')](_0x40dc8f);}};}function respondWithFilteredResult(_0x5087d7,_0x33a1a5){return function(_0x4690a6){if(_0x4690a6){var _0x45b675=_0x4690a6[_0x43e7('0x2a')],_0x50f9f5=_0x33a1a5[_0x43e7('0x2b')],_0x442c3b=_0x33a1a5[_0x43e7('0x2b')]+_0x33a1a5[_0x43e7('0x2c')],_0x84dd4d;if(_0x442c3b>=_0x45b675){_0x442c3b=_0x45b675;_0x84dd4d=0xc8;}else{_0x84dd4d=0xce;}_0x5087d7[_0x43e7('0x28')](_0x84dd4d);return _0x5087d7[_0x43e7('0x2d')](_0x43e7('0x2e'),_0x50f9f5+'-'+_0x442c3b+'/'+_0x45b675)[_0x43e7('0x29')](_0x4690a6);}return null;};}function patchUpdates(_0x4bdb17){return function(_0x238321){try{jsonpatch[_0x43e7('0x2f')](_0x238321,_0x4bdb17,!![]);}catch(_0x3b8f78){return BPromise[_0x43e7('0x30')](_0x3b8f78);}return _0x238321[_0x43e7('0x31')]();};}function saveUpdates(_0x4c8650,_0x1eba65){return function(_0x49b83d){if(_0x49b83d){return _0x49b83d[_0x43e7('0x32')](_0x4c8650)[_0x43e7('0x1e')](function(_0x4c61b9){return _0x4c61b9;});}return null;};}function removeEntity(_0x5a7342,_0x5e203f){return function(_0xf8320){if(_0xf8320){return _0xf8320[_0x43e7('0x33')]()[_0x43e7('0x1e')](function(){var _0x234fe6=_0xf8320[_0x43e7('0x34')]({'plain':!![]});var _0xde7ed='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0xde7ed,'resourceId':_0x234fe6['id']}})['then'](function(){return _0xf8320;});})['then'](function(){_0x5a7342['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14d888,_0x49cda6){return function(_0x2b4bfd){if(!_0x2b4bfd){_0x14d888[_0x43e7('0x35')](0x194);}return _0x2b4bfd;};}function handleError(_0x31bc78,_0x50a2d0){_0x50a2d0=_0x50a2d0||0x1f4;return function(_0x40f72f){logger[_0x43e7('0x25')](_0x40f72f[_0x43e7('0x36')]);if(_0x40f72f['name']){delete _0x40f72f['name'];}_0x31bc78['status'](_0x50a2d0)[_0x43e7('0x37')](_0x40f72f);};}exports[_0x43e7('0x38')]=function(_0x199ff6,_0x16cdba){var _0x1b1440={'include':[{'model':db[_0x43e7('0x39')],'as':'mandatoryDispositionPause'}]},_0x1ed538={},_0x1d4589={'count':0x0,'rows':[]};var _0x61ed8e=_[_0x43e7('0x3a')](db['OpenchannelAccount'][_0x43e7('0x3b')],function(_0x4c0c7a){return{'name':_0x4c0c7a[_0x43e7('0x3c')],'type':_0x4c0c7a[_0x43e7('0x3d')][_0x43e7('0x3e')]};});_0x1ed538[_0x43e7('0x3f')]=_[_0x43e7('0x3a')](_0x61ed8e,_0x43e7('0x40'));_0x1ed538['query']=_['keys'](_0x199ff6[_0x43e7('0x41')]);_0x1ed538[_0x43e7('0x42')]=_[_0x43e7('0x43')](_0x1ed538[_0x43e7('0x3f')],_0x1ed538[_0x43e7('0x41')]);_0x1b1440['attributes']=_[_0x43e7('0x43')](_0x1ed538[_0x43e7('0x3f')],qs['fields'](_0x199ff6[_0x43e7('0x41')]['fields']));_0x1b1440[_0x43e7('0x44')]=_0x1b1440['attributes'][_0x43e7('0x45')]?_0x1b1440[_0x43e7('0x44')]:_0x1ed538[_0x43e7('0x3f')];if(!_0x199ff6[_0x43e7('0x41')]['hasOwnProperty']('nolimit')){_0x1b1440[_0x43e7('0x2c')]=qs[_0x43e7('0x2c')](_0x199ff6[_0x43e7('0x41')][_0x43e7('0x2c')]);_0x1b1440['offset']=qs['offset'](_0x199ff6['query'][_0x43e7('0x2b')]);}_0x1b1440['order']=qs[_0x43e7('0x46')](_0x199ff6['query']['sort']);_0x1b1440[_0x43e7('0x47')]=qs['filters'](_[_0x43e7('0x48')](_0x199ff6[_0x43e7('0x41')],_0x1ed538[_0x43e7('0x42')]),_0x61ed8e);if(_0x199ff6[_0x43e7('0x41')]['filter']){_0x1b1440[_0x43e7('0x47')]=_[_0x43e7('0x49')](_0x1b1440[_0x43e7('0x47')],{'$or':_[_0x43e7('0x3a')](_0x61ed8e,function(_0x296dc8){if(_0x296dc8[_0x43e7('0x3d')]!=='VIRTUAL'){var _0x4930a2={};_0x4930a2[_0x296dc8[_0x43e7('0x40')]]={'$like':'%'+_0x199ff6[_0x43e7('0x41')][_0x43e7('0x4a')]+'%'};return _0x4930a2;}})});}_0x1b1440=_['merge']({},_0x1b1440,_0x199ff6['options']);var _0x56489b={'where':_0x1b1440[_0x43e7('0x47')]};return db[_0x43e7('0x4b')]['count'](_0x56489b)[_0x43e7('0x1e')](function(_0x47686e){_0x1d4589[_0x43e7('0x2a')]=_0x47686e;if(_0x199ff6['query']['includeAll']){_0x1b1440['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x43e7('0x4c')](_0x1b1440);})[_0x43e7('0x1e')](function(_0x52fea5){_0x1d4589[_0x43e7('0x4d')]=_0x52fea5;return _0x1d4589;})[_0x43e7('0x1e')](respondWithFilteredResult(_0x16cdba,_0x1b1440))[_0x43e7('0x4e')](handleError(_0x16cdba,null));};exports[_0x43e7('0x4f')]=function(_0x4a0ce5,_0x2718d5){var _0x483f20={'raw':![],'where':{'id':_0x4a0ce5[_0x43e7('0x50')]['id']},'include':[{'model':db[_0x43e7('0x39')],'as':_0x43e7('0x51')}]},_0x4bebd4={};_0x4bebd4[_0x43e7('0x3f')]=_[_0x43e7('0x52')](db[_0x43e7('0x4b')][_0x43e7('0x3b')]);_0x4bebd4[_0x43e7('0x41')]=_[_0x43e7('0x52')](_0x4a0ce5[_0x43e7('0x41')]);_0x4bebd4['filters']=_[_0x43e7('0x43')](_0x4bebd4[_0x43e7('0x3f')],_0x4bebd4['query']);_0x483f20[_0x43e7('0x44')]=_['intersection'](_0x4bebd4[_0x43e7('0x3f')],qs[_0x43e7('0x53')](_0x4a0ce5[_0x43e7('0x41')][_0x43e7('0x53')]));_0x483f20[_0x43e7('0x44')]=_0x483f20['attributes']['length']?_0x483f20[_0x43e7('0x44')]:_0x4bebd4[_0x43e7('0x3f')];if(_0x4a0ce5[_0x43e7('0x41')][_0x43e7('0x54')]){_0x483f20[_0x43e7('0x55')]=[{'all':!![]}];}_0x483f20=_[_0x43e7('0x49')]({},_0x483f20,_0x4a0ce5[_0x43e7('0x56')]);return db[_0x43e7('0x4b')][_0x43e7('0x57')](_0x483f20)[_0x43e7('0x1e')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x1e')](respondWithResult(_0x2718d5,null))['catch'](handleError(_0x2718d5,null));};exports[_0x43e7('0x58')]=function(_0x2da2f3,_0x50a3fa){return db[_0x43e7('0x4b')][_0x43e7('0x58')](_0x2da2f3[_0x43e7('0x59')],{})['then'](function(_0x5d63c6){var _0x459c13=_0x2da2f3[_0x43e7('0x5a')]['get']({'plain':!![]});if(!_0x459c13)throw new Error(_0x43e7('0x5b'));if(_0x459c13['role']==='user'){var _0x1fa3f6=_0x5d63c6[_0x43e7('0x34')]({'plain':!![]});var _0x1f7c02=_0x43e7('0x5c');return db[_0x43e7('0x5d')]['find']({'where':{'name':_0x1f7c02,'userProfileId':_0x459c13[_0x43e7('0x5e')]},'raw':!![]})[_0x43e7('0x1e')](function(_0x4d89bd){if(_0x4d89bd&&_0x4d89bd[_0x43e7('0x5f')]===0x0){return db[_0x43e7('0x60')][_0x43e7('0x58')]({'name':_0x1fa3f6['name'],'resourceId':_0x1fa3f6['id'],'type':_0x4d89bd['name'],'sectionId':_0x4d89bd['id']},{})['then'](function(){return _0x5d63c6;});}else{return _0x5d63c6;}})[_0x43e7('0x4e')](function(_0x4058ce){logger[_0x43e7('0x25')](_0x43e7('0x61'),_0x4058ce);throw _0x4058ce;});}return _0x5d63c6;})['then'](respondWithResult(_0x50a3fa,0xc9))['catch'](handleError(_0x50a3fa,null));};exports[_0x43e7('0x32')]=function(_0x8b50bb,_0x140438){if(_0x8b50bb[_0x43e7('0x59')]['id']){delete _0x8b50bb['body']['id'];}return db[_0x43e7('0x4b')][_0x43e7('0x57')]({'where':{'id':_0x8b50bb[_0x43e7('0x50')]['id']},'include':[{'model':db[_0x43e7('0x39')],'as':_0x43e7('0x51')}]})[_0x43e7('0x1e')](handleEntityNotFound(_0x140438,null))[_0x43e7('0x1e')](saveUpdates(_0x8b50bb[_0x43e7('0x59')],null))[_0x43e7('0x1e')](respondWithResult(_0x140438,null))[_0x43e7('0x4e')](handleError(_0x140438,null));};exports[_0x43e7('0x33')]=function(_0x57fdfe,_0x5f3824){return db[_0x43e7('0x4b')]['find']({'where':{'id':_0x57fdfe['params']['id']}})['then'](handleEntityNotFound(_0x5f3824,null))[_0x43e7('0x1e')](removeEntity(_0x5f3824,null))[_0x43e7('0x4e')](handleError(_0x5f3824,null));};exports['describe']=function(_0xfe5a8d,_0x135791){return db[_0x43e7('0x4b')]['describe']()[_0x43e7('0x1e')](respondWithResult(_0x135791,null))[_0x43e7('0x4e')](handleError(_0x135791,null));};exports[_0x43e7('0x62')]=function(_0xc9723,_0x2f43d7,_0x472a19){if(_0xc9723[_0x43e7('0x59')]['id']){delete _0xc9723['body']['id'];}return db[_0x43e7('0x4b')][_0x43e7('0x57')]({'where':{'id':_0xc9723[_0x43e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f43d7,null))['then'](function(_0x30377a){if(_0x30377a){_0xc9723['body']['OpenchannelAccountId']=_0x30377a['id'];return db[_0x43e7('0x63')][_0x43e7('0x58')](_0xc9723['body']);}})[_0x43e7('0x1e')](respondWithResult(_0x2f43d7,null))[_0x43e7('0x4e')](handleError(_0x2f43d7,null));};exports[_0x43e7('0x64')]=function(_0x3401ec,_0x16499c,_0x13ef5c){var _0x398a78={'raw':![],'where':{}};var _0x4ce33c={};var _0x10cf5d={'count':0x0,'rows':[]};return db[_0x43e7('0x4b')]['findOne']({'where':{'id':_0x3401ec[_0x43e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x16499c,null))[_0x43e7('0x1e')](function(_0x248936){if(_0x248936){_0x4ce33c[_0x43e7('0x3f')]=_[_0x43e7('0x52')](db['Disposition'][_0x43e7('0x3b')]);_0x4ce33c[_0x43e7('0x41')]=_[_0x43e7('0x52')](_0x3401ec['query']);_0x4ce33c[_0x43e7('0x42')]=_[_0x43e7('0x43')](_0x4ce33c[_0x43e7('0x3f')],_0x4ce33c[_0x43e7('0x41')]);_0x398a78[_0x43e7('0x44')]=_['intersection'](_0x4ce33c[_0x43e7('0x3f')],qs[_0x43e7('0x53')](_0x3401ec[_0x43e7('0x41')][_0x43e7('0x53')]));_0x398a78[_0x43e7('0x44')]=_0x398a78[_0x43e7('0x44')][_0x43e7('0x45')]?_0x398a78['attributes']:_0x4ce33c['model'];if(!_0x3401ec[_0x43e7('0x41')]['hasOwnProperty']('nolimit')){_0x398a78['limit']=qs[_0x43e7('0x2c')](_0x3401ec[_0x43e7('0x41')][_0x43e7('0x2c')]);_0x398a78[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x3401ec[_0x43e7('0x41')]['offset']);}_0x398a78[_0x43e7('0x65')]=qs[_0x43e7('0x46')](_0x3401ec[_0x43e7('0x41')]['sort']);_0x398a78[_0x43e7('0x47')]=qs[_0x43e7('0x42')](_[_0x43e7('0x48')](_0x3401ec[_0x43e7('0x41')],_0x4ce33c[_0x43e7('0x42')]));_0x398a78[_0x43e7('0x47')][_0x43e7('0x66')]=_0x248936['id'];if(_0x3401ec[_0x43e7('0x41')]['filter']){_0x398a78['where']=_['merge'](_0x398a78[_0x43e7('0x47')],{'$or':_[_0x43e7('0x3a')](_0x398a78['attributes'],function(_0x3fe23f){var _0x39a787={};_0x39a787[_0x3fe23f]={'$like':'%'+_0x3401ec[_0x43e7('0x41')][_0x43e7('0x4a')]+'%'};return _0x39a787;})});}_0x398a78=_['merge']({},_0x398a78,_0x3401ec['options']);return db['Disposition'][_0x43e7('0x2a')]({'where':_0x398a78[_0x43e7('0x47')]})['then'](function(_0x58cbb7){_0x10cf5d[_0x43e7('0x2a')]=_0x58cbb7;if(_0x3401ec[_0x43e7('0x41')][_0x43e7('0x54')]){_0x398a78['include']=[{'all':!![]}];}return db[_0x43e7('0x63')][_0x43e7('0x4c')](_0x398a78);})[_0x43e7('0x1e')](function(_0xb04082){_0x10cf5d['rows']=_0xb04082;return _0x10cf5d;});}})[_0x43e7('0x1e')](respondWithFilteredResult(_0x16499c,_0x398a78))['catch'](handleError(_0x16499c,null));};exports[_0x43e7('0x67')]=function(_0x3ab790,_0x24a168,_0x90667c){return db[_0x43e7('0x4b')][_0x43e7('0x57')]({'where':{'id':_0x3ab790[_0x43e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x24a168,null))[_0x43e7('0x1e')](function(_0x40257e){if(_0x40257e){return _0x40257e[_0x43e7('0x67')](_0x3ab790[_0x43e7('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x24a168,null))['catch'](handleError(_0x24a168,null));};exports[_0x43e7('0x68')]=function(_0x5f5901,_0x240f0d,_0x36b768){if(_0x5f5901[_0x43e7('0x59')]['id']){delete _0x5f5901[_0x43e7('0x59')]['id'];}return db[_0x43e7('0x4b')][_0x43e7('0x57')]({'where':{'id':_0x5f5901[_0x43e7('0x50')]['id']}})[_0x43e7('0x1e')](handleEntityNotFound(_0x240f0d,null))[_0x43e7('0x1e')](function(_0xe82b9d){if(_0xe82b9d){_0x5f5901[_0x43e7('0x59')]['OpenchannelAccountId']=_0xe82b9d['id'];return db[_0x43e7('0x69')][_0x43e7('0x58')](_0x5f5901[_0x43e7('0x59')]);}})[_0x43e7('0x1e')](respondWithResult(_0x240f0d,null))[_0x43e7('0x4e')](handleError(_0x240f0d,null));};exports['getAnswers']=function(_0x5e04ec,_0x162a27,_0x3e3c82){var _0x5c7f0a={'raw':![],'where':{}};var _0x100c4d={};var _0x3339ac={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5e04ec[_0x43e7('0x50')]['id']}})[_0x43e7('0x1e')](handleEntityNotFound(_0x162a27,null))[_0x43e7('0x1e')](function(_0x1c0a84){if(_0x1c0a84){_0x100c4d[_0x43e7('0x3f')]=_['keys'](db['CannedAnswer'][_0x43e7('0x3b')]);_0x100c4d[_0x43e7('0x41')]=_[_0x43e7('0x52')](_0x5e04ec[_0x43e7('0x41')]);_0x100c4d['filters']=_[_0x43e7('0x43')](_0x100c4d[_0x43e7('0x3f')],_0x100c4d[_0x43e7('0x41')]);_0x5c7f0a[_0x43e7('0x44')]=_['intersection'](_0x100c4d[_0x43e7('0x3f')],qs[_0x43e7('0x53')](_0x5e04ec[_0x43e7('0x41')][_0x43e7('0x53')]));_0x5c7f0a[_0x43e7('0x44')]=_0x5c7f0a['attributes'][_0x43e7('0x45')]?_0x5c7f0a[_0x43e7('0x44')]:_0x100c4d['model'];if(!_0x5e04ec[_0x43e7('0x41')][_0x43e7('0x6a')](_0x43e7('0x6b'))){_0x5c7f0a[_0x43e7('0x2c')]=qs['limit'](_0x5e04ec[_0x43e7('0x41')]['limit']);_0x5c7f0a[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x5e04ec[_0x43e7('0x41')][_0x43e7('0x2b')]);}_0x5c7f0a[_0x43e7('0x65')]=qs[_0x43e7('0x46')](_0x5e04ec[_0x43e7('0x41')][_0x43e7('0x46')]);_0x5c7f0a[_0x43e7('0x47')]=qs['filters'](_[_0x43e7('0x48')](_0x5e04ec[_0x43e7('0x41')],_0x100c4d[_0x43e7('0x42')]));_0x5c7f0a[_0x43e7('0x47')]['OpenchannelAccountId']=_0x1c0a84['id'];if(_0x5e04ec['query'][_0x43e7('0x4a')]){_0x5c7f0a[_0x43e7('0x47')]=_[_0x43e7('0x49')](_0x5c7f0a['where'],{'$or':_[_0x43e7('0x3a')](_0x5c7f0a['attributes'],function(_0x48783a){var _0x545f2a={};_0x545f2a[_0x48783a]={'$like':'%'+_0x5e04ec[_0x43e7('0x41')]['filter']+'%'};return _0x545f2a;})});}_0x5c7f0a=_[_0x43e7('0x49')]({},_0x5c7f0a,_0x5e04ec[_0x43e7('0x56')]);return db[_0x43e7('0x69')][_0x43e7('0x2a')]({'where':_0x5c7f0a[_0x43e7('0x47')]})['then'](function(_0x4d64c9){_0x3339ac[_0x43e7('0x2a')]=_0x4d64c9;if(_0x5e04ec[_0x43e7('0x41')]['includeAll']){_0x5c7f0a[_0x43e7('0x55')]=[{'all':!![]}];}return db[_0x43e7('0x69')][_0x43e7('0x4c')](_0x5c7f0a);})[_0x43e7('0x1e')](function(_0xc83a14){_0x3339ac[_0x43e7('0x4d')]=_0xc83a14;return _0x3339ac;});}})[_0x43e7('0x1e')](respondWithFilteredResult(_0x162a27,_0x5c7f0a))[_0x43e7('0x4e')](handleError(_0x162a27,null));};exports[_0x43e7('0x6c')]=function(_0x284617,_0x610819,_0x1e4383){return db[_0x43e7('0x4b')][_0x43e7('0x57')]({'where':{'id':_0x284617[_0x43e7('0x50')]['id']}})[_0x43e7('0x1e')](handleEntityNotFound(_0x610819,null))[_0x43e7('0x1e')](function(_0x3036ff){if(_0x3036ff){return _0x3036ff[_0x43e7('0x6c')](_0x284617[_0x43e7('0x41')][_0x43e7('0x6d')]);}})[_0x43e7('0x1e')](respondWithStatusCode(_0x610819,null))['catch'](handleError(_0x610819,null));};exports[_0x43e7('0x6e')]=function(_0x3c8b27,_0x3a81fc,_0x282401){var _0x5c2866={'body':_0x3c8b27[_0x43e7('0x59')],'channel':'openchannel'};var _0x3f99a7=[];var _0x42413e=[];var _0x328646={};var _0x35c3cc=![];return db[_0x43e7('0x6f')][_0x43e7('0x70')]()['then'](function(_0x1e7fbe){if(!_0x1e7fbe){throw new db[(_0x43e7('0x71'))][(_0x43e7('0x72'))](_0x43e7('0x73'));}_0x3f99a7=_[_0x43e7('0x74')](_['keys'](_0x1e7fbe),['createdAt',_0x43e7('0x75')]);_0x42413e=_['difference'](_[_0x43e7('0x52')](_0x1e7fbe),[_0x43e7('0x76'),_0x43e7('0x75'),_0x43e7('0x77'),'ListId']);if(_0x3c8b27['body']['id']){delete _0x3c8b27['body']['id'];}if(_[_0x43e7('0x78')](_0x3c8b27['body']['from'])){throw new db['Sequelize'][(_0x43e7('0x72'))](_0x43e7('0x79'));}if(_['isNil'](_0x3c8b27[_0x43e7('0x59')]['body'])||_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x59')]===''){throw new db[(_0x43e7('0x71'))][(_0x43e7('0x72'))](_0x43e7('0x7a'));}if(_['isNil'](_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x7b')])){throw new db[(_0x43e7('0x71'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x42413e);}if(!_[_0x43e7('0x7c')](_0x42413e,_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x7b')])){throw new db[(_0x43e7('0x71'))]['ValidationError'](_0x43e7('0x7d')+_0x42413e);}_0x328646[_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x7b')]]=_0x3c8b27['body'][_0x43e7('0x7e')];})[_0x43e7('0x1e')](function(){return db[_0x43e7('0x4b')][_0x43e7('0x57')]({'where':{'id':_0x3c8b27['params']['id']},'include':[{'model':db[_0x43e7('0x7f')],'as':'List','include':[{'model':db[_0x43e7('0x6f')],'as':_0x43e7('0x80'),'where':_0x328646,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x43e7('0x81')],'as':_0x43e7('0x82')}]});})[_0x43e7('0x1e')](handleEntityNotFound(_0x3a81fc,null))[_0x43e7('0x1e')](function(_0x309fde){if(_0x309fde&&_0x309fde[_0x43e7('0x83')]){_0x5c2866[_0x43e7('0x84')]=_0x309fde;_0x5c2866[_0x43e7('0x85')]=_0x309fde[_0x43e7('0x82')];_0x5c2866[_0x43e7('0x86')]=_0x309fde[_0x43e7('0x83')];_0x5c2866['applications']=_[_0x43e7('0x87')](_0x5c2866['applications'],[_0x43e7('0x88')],[_0x43e7('0x89')]);if(_0x5c2866[_0x43e7('0x84')]['Applications']){delete _0x5c2866[_0x43e7('0x84')][_0x43e7('0x82')];}if(_0x5c2866[_0x43e7('0x84')][_0x43e7('0x83')]&&_0x5c2866['account'][_0x43e7('0x83')][_0x43e7('0x80')]['length']){return _0x5c2866['account']['List'][_0x43e7('0x80')][0x0];}var _0x261b6f=_[_0x43e7('0x18')](_0x3c8b27[_0x43e7('0x59')],{'firstName':_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x7e')],'ListId':_0x309fde[_0x43e7('0x8a')]});_0x261b6f[_0x3c8b27[_0x43e7('0x59')]['mapKey']]=_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x7e')];return db[_0x43e7('0x6f')][_0x43e7('0x58')](_0x261b6f,{'fields':_0x3f99a7,'raw':!![]});}})['then'](handleEntityNotFound(_0x3a81fc,null))['then'](function(_0x4123b8){_0x5c2866[_0x43e7('0x8b')]=_0x4123b8;if(_0x4123b8){var _0x31ce6e={'ContactId':_0x4123b8['id'],'OpenchannelAccountId':_0x3c8b27[_0x43e7('0x50')]['id'],'from':(_0x4123b8['firstName']||'')+'\x20'+(_0x4123b8[_0x43e7('0x8c')]||'')};var _0x427cec={'OpenchannelAccountId':_0x3c8b27[_0x43e7('0x50')]['id'],'closed':![]};if(_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x8d')]){_0x427cec[_0x43e7('0x8d')]=_0x3c8b27['body'][_0x43e7('0x8d')];return db['OpenchannelInteraction']['find']({'where':_0x427cec})[_0x43e7('0x1e')](function(_0x2dcabe){if(_0x2dcabe){return[_0x2dcabe,![]];}_0x31ce6e['threadId']=_0x3c8b27['body'][_0x43e7('0x8d')];_0x31ce6e[_0x43e7('0x8e')]=_0x3c8b27['body'][_0x43e7('0x8e')];return db[_0x43e7('0x8f')][_0x43e7('0x58')](_0x31ce6e)[_0x43e7('0x1e')](function(_0x4cb1c5){return[_0x4cb1c5,!![]];});});}else{_0x427cec['threadId']=null;}_0x427cec[_0x43e7('0x90')]=_0x4123b8['id'];return db[_0x43e7('0x8f')][_0x43e7('0x57')]({'where':_0x427cec})['then'](function(_0x49de67){if(_0x49de67){return[_0x49de67,![]];}return db[_0x43e7('0x8f')][_0x43e7('0x58')](_0x31ce6e)[_0x43e7('0x1e')](function(_0x423346){return[_0x423346,!![]];});});}})[_0x43e7('0x91')](function(_0x1dd175,_0x20bfa0){if(_0x1dd175){_0x35c3cc=_0x20bfa0;if(!_0x20bfa0){var _0x3c081d={'from':(_0x5c2866['contact']['firstName']||'')+'\x20'+(_0x5c2866['contact'][_0x43e7('0x8c')]||'')};if(_0x3c8b27['body'][_0x43e7('0x8d')]&&_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x92')]&&_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x8d')]!=_0x3c8b27['body'][_0x43e7('0x92')]){_0x3c081d[_0x43e7('0x8d')]=_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x92')];}return _0x1dd175['update'](_0x3c081d);}else{return _0x1dd175;}}})[_0x43e7('0x1e')](function(_0x126af5){_0x5c2866[_0x43e7('0x93')]=_0x126af5[_0x43e7('0x34')]({'plain':!![]});_0x5c2866[_0x43e7('0x93')][_0x43e7('0x94')]=_0x35c3cc;if(_0x5c2866[_0x43e7('0x93')]['created']){if(_0x5c2866[_0x43e7('0x84')][_0x43e7('0x95')]){_0x5c2866[_0x43e7('0x85')][_0x43e7('0x96')]({'id':0x0,'priority':_0x5c2866[_0x43e7('0x85')]['length']+0x1,'app':_0x43e7('0x97'),'appdata':_0x43e7('0x98'),'interval':'*,*,*,*'});}}return db[_0x43e7('0x99')][_0x43e7('0x58')]({'body':_0x3c8b27['body'][_0x43e7('0x59')],'OpenchannelAccountId':_0x3c8b27[_0x43e7('0x50')]['id'],'OpenchannelInteractionId':_0x126af5['id'],'direction':'in','ContactId':_0x5c2866[_0x43e7('0x8b')]['id'],'AttachmentId':_0x3c8b27[_0x43e7('0x59')][_0x43e7('0x9a')]});})['then'](function(_0x1b8ef3){_0x5c2866[_0x43e7('0x26')]=_0x1b8ef3;if(_0x5c2866[_0x43e7('0x93')]['UserId']){return db[_0x43e7('0x9b')][_0x43e7('0x57')]({'attributes':['id','name'],'where':{'id':_0x5c2866[_0x43e7('0x93')][_0x43e7('0x9c')]}})[_0x43e7('0x1e')](function(_0x2dc13d){if(_0x2dc13d){_0x5c2866[_0x43e7('0x85')][_0x43e7('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2dc13d[_0x43e7('0x40')]+','+(_0x5c2866[_0x43e7('0x84')][_0x43e7('0x9e')]||0xa),'interval':'*,*,*,*'});_0x5c2866[_0x43e7('0x9f')]=![];}return respondWithRpcPromise(_0x43e7('0xa0'),_0x43e7('0xa1'),_0x5c2866);});}return respondWithRpcPromise(_0x43e7('0xa0'),_0x43e7('0xa1'),_0x5c2866);})[_0x43e7('0x1e')](function(_0x512f61){respondWithRpcPromise(_0x43e7('0xa2'),_0x43e7('0xa2'),{'event':'notify','message':_0x512f61},client9002);return _0x512f61;})[_0x43e7('0x1e')](respondWithResult(_0x3a81fc,null))[_0x43e7('0x4e')](handleError(_0x3a81fc,null));};exports[_0x43e7('0xa3')]=function(_0x21bc7e,_0x33175f,_0x114e00){return db[_0x43e7('0x4b')][_0x43e7('0xa4')]({'where':{'id':_0x21bc7e['params']['id']}})[_0x43e7('0x1e')](handleEntityNotFound(_0x33175f,null))[_0x43e7('0x1e')](function(_0xd0dca2){if(_0xd0dca2){return db[_0x43e7('0xa5')][_0x43e7('0xa6')](function(_0x582077){return db[_0x43e7('0x81')][_0x43e7('0x33')]({'where':{'OpenchannelAccountId':_0x21bc7e[_0x43e7('0x50')]['id']},'transaction':_0x582077})[_0x43e7('0x1e')](function(_0x2e807){var _0x4ebbfa=_[_0x43e7('0x3a')](_0x21bc7e['body'],function(_0x2c9718){_0x2c9718[_0x43e7('0x66')]=_0x21bc7e[_0x43e7('0x50')]['id'];return _0x2c9718;});return db[_0x43e7('0x81')]['bulkCreate'](_0x4ebbfa,{'transaction':_0x582077});});})[_0x43e7('0x1e')](function(){return db[_0x43e7('0x81')][_0x43e7('0xa7')]({'where':{'OpenchannelAccountId':_0x21bc7e[_0x43e7('0x50')]['id']},'order':_0x43e7('0x88')});});}})[_0x43e7('0x1e')](respondWithResult(_0x33175f,null))[_0x43e7('0x4e')](handleError(_0x33175f,null));};exports[_0x43e7('0xa8')]=function(_0x16a213,_0x33fb62,_0x2fbbc4){var _0x5cb92a={};var _0x531133={};var _0x2e1460;var _0x548fd0;return db['OpenchannelAccount'][_0x43e7('0xa4')]({'where':{'id':_0x16a213[_0x43e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x33fb62,null))[_0x43e7('0x1e')](function(_0x5b851d){if(_0x5b851d){_0x2e1460=_0x5b851d;_0x531133['model']=_['keys'](db[_0x43e7('0x81')][_0x43e7('0x3b')]);_0x531133[_0x43e7('0x41')]=_[_0x43e7('0x52')](_0x16a213[_0x43e7('0x41')]);_0x531133[_0x43e7('0x42')]=_[_0x43e7('0x43')](_0x531133[_0x43e7('0x3f')],_0x531133[_0x43e7('0x41')]);_0x5cb92a[_0x43e7('0x44')]=_[_0x43e7('0x43')](_0x531133[_0x43e7('0x3f')],qs[_0x43e7('0x53')](_0x16a213[_0x43e7('0x41')][_0x43e7('0x53')]));_0x5cb92a[_0x43e7('0x44')]=_0x5cb92a[_0x43e7('0x44')][_0x43e7('0x45')]?_0x5cb92a[_0x43e7('0x44')]:_0x531133[_0x43e7('0x3f')];_0x5cb92a['order']=qs[_0x43e7('0x46')](_0x16a213[_0x43e7('0x41')]['sort']);_0x5cb92a[_0x43e7('0x47')]=qs[_0x43e7('0x42')](_[_0x43e7('0x48')](_0x16a213[_0x43e7('0x41')],_0x531133['filters']));if(_0x16a213[_0x43e7('0x41')][_0x43e7('0x4a')]){_0x5cb92a['where']=_[_0x43e7('0x49')](_0x5cb92a[_0x43e7('0x47')],{'$or':_[_0x43e7('0x3a')](_0x5cb92a['attributes'],function(_0x22b824){var _0x420fc3={};_0x420fc3[_0x22b824]={'$like':'%'+_0x16a213[_0x43e7('0x41')][_0x43e7('0x4a')]+'%'};return _0x420fc3;})});}_0x5cb92a=_[_0x43e7('0x49')]({},_0x5cb92a,_0x16a213['options']);return _0x2e1460[_0x43e7('0xa8')](_0x5cb92a);}})[_0x43e7('0x1e')](function(_0x547373){if(_0x547373){_0x548fd0=_0x547373[_0x43e7('0x45')];if(!_0x16a213['query']['hasOwnProperty']('nolimit')){_0x5cb92a['limit']=qs[_0x43e7('0x2c')](_0x16a213[_0x43e7('0x41')][_0x43e7('0x2c')]);_0x5cb92a[_0x43e7('0x2b')]=qs['offset'](_0x16a213['query'][_0x43e7('0x2b')]);}return _0x2e1460['getApplications'](_0x5cb92a);}})[_0x43e7('0x1e')](function(_0x50e4c0){if(_0x50e4c0){return _0x50e4c0?{'count':_0x548fd0,'rows':_0x50e4c0}:null;}})[_0x43e7('0x1e')](respondWithResult(_0x33fb62,null))['catch'](handleError(_0x33fb62,null));};exports['getInteractions']=function(_0x516abb,_0x5653b0,_0xc9bc7e){var _0xb01723={'raw':![],'where':{}};var _0x574658={};var _0x4cddda={'count':0x0,'rows':[]};return db[_0x43e7('0x4b')][_0x43e7('0xa4')]({'where':{'id':_0x516abb[_0x43e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x5653b0,null))[_0x43e7('0x1e')](function(_0xb2aca0){if(_0xb2aca0){_0x574658[_0x43e7('0x3f')]=_[_0x43e7('0x52')](db['OpenchannelInteraction'][_0x43e7('0x3b')]);_0x574658['query']=_[_0x43e7('0x52')](_0x516abb[_0x43e7('0x41')]);_0x574658[_0x43e7('0x42')]=_[_0x43e7('0x43')](_0x574658[_0x43e7('0x3f')],_0x574658[_0x43e7('0x41')]);_0xb01723[_0x43e7('0x44')]=_['intersection'](_0x574658[_0x43e7('0x3f')],qs[_0x43e7('0x53')](_0x516abb['query'][_0x43e7('0x53')]));_0xb01723[_0x43e7('0x44')]=_0xb01723[_0x43e7('0x44')][_0x43e7('0x45')]?_0xb01723[_0x43e7('0x44')]:_0x574658['model'];if(!_0x516abb[_0x43e7('0x41')]['hasOwnProperty'](_0x43e7('0x6b'))){_0xb01723['limit']=qs[_0x43e7('0x2c')](_0x516abb[_0x43e7('0x41')][_0x43e7('0x2c')]);_0xb01723[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x516abb['query'][_0x43e7('0x2b')]);}_0xb01723['order']=qs[_0x43e7('0x46')](_0x516abb[_0x43e7('0x41')][_0x43e7('0x46')]);_0xb01723['where']=qs[_0x43e7('0x42')](_[_0x43e7('0x48')](_0x516abb[_0x43e7('0x41')],_0x574658[_0x43e7('0x42')]));_0xb01723[_0x43e7('0x47')]['OpenchannelAccountId']=_0xb2aca0['id'];if(_0x516abb[_0x43e7('0x41')]['filter']){_0xb01723[_0x43e7('0x47')]=_[_0x43e7('0x49')](_0xb01723[_0x43e7('0x47')],{'$or':_[_0x43e7('0x3a')](_0xb01723[_0x43e7('0x44')],function(_0x34ed9e){var _0x233031={};_0x233031[_0x34ed9e]={'$like':'%'+_0x516abb['query'][_0x43e7('0x4a')]+'%'};return _0x233031;})});}_0xb01723=_['merge']({},_0xb01723,_0x516abb[_0x43e7('0x56')]);return db[_0x43e7('0x8f')][_0x43e7('0x2a')]({'where':_0xb01723[_0x43e7('0x47')]})[_0x43e7('0x1e')](function(_0xf9178f){_0x4cddda[_0x43e7('0x2a')]=_0xf9178f;if(_0x516abb[_0x43e7('0x41')][_0x43e7('0x54')]){_0xb01723['include']=[{'model':db[_0x43e7('0x6f')],'as':'Contact','required':![]},{'model':db[_0x43e7('0x9b')],'as':_0x43e7('0xa9'),'attributes':['name',_0x43e7('0xaa'),_0x43e7('0xab')],'required':![]},{'model':db['Tag'],'as':_0x43e7('0xac'),'attributes':['id',_0x43e7('0x40'),_0x43e7('0xad')],'where':_0x516abb[_0x43e7('0x41')][_0x43e7('0xae')]?{'id':_0x516abb[_0x43e7('0x41')][_0x43e7('0xae')]}:undefined,'required':_0x516abb[_0x43e7('0x41')]['tag']?!![]:![]}];}return db[_0x43e7('0x8f')][_0x43e7('0x4c')](_0xb01723);})[_0x43e7('0x1e')](function(_0x5c9bc5){_0x4cddda[_0x43e7('0x4d')]=_0x5c9bc5;return _0x4cddda;});}})[_0x43e7('0x1e')](respondWithFilteredResult(_0x5653b0,_0xb01723))['catch'](handleError(_0x5653b0,null));};exports[_0x43e7('0xaf')]=function(_0x1ed3a1,_0x49612a,_0x25e6bd){return db[_0x43e7('0x4b')][_0x43e7('0x57')]({'where':{'id':_0x1ed3a1['params']['id']}})[_0x43e7('0x1e')](handleEntityNotFound(_0x49612a,null))[_0x43e7('0x1e')](function(_0x557015){if(_0x557015){return _0x557015[_0x43e7('0xaf')](_0x1ed3a1[_0x43e7('0x59')][_0x43e7('0x6d')],_[_0x43e7('0xb0')](_0x1ed3a1['body'],['ids','id'])||{})[_0x43e7('0x91')](function(_0x3fccc0){for(var _0x1142a3=0x0;_0x1142a3<_0x1ed3a1[_0x43e7('0x59')]['ids'][_0x43e7('0x45')];_0x1142a3+=0x1){socket[_0x43e7('0xb1')](_0x43e7('0xb2'),{'UserId':_0x1ed3a1[_0x43e7('0x59')]['ids'][_0x1142a3],'OpenchannelAccountId':_0x1ed3a1[_0x43e7('0x50')]['id']});}return _0x3fccc0;});}})[_0x43e7('0x1e')](respondWithResult(_0x49612a,null))[_0x43e7('0x4e')](handleError(_0x49612a,null));};exports[_0x43e7('0xb3')]=function(_0x26f072,_0x4bbd29,_0x557df8){return db['OpenchannelAccount'][_0x43e7('0x57')]({'where':{'id':_0x26f072[_0x43e7('0x50')]['id']}})[_0x43e7('0x1e')](handleEntityNotFound(_0x4bbd29,null))['then'](function(_0x1e11bb){if(_0x1e11bb){return _0x1e11bb['removeAgents'](_0x26f072[_0x43e7('0x41')][_0x43e7('0x6d')])[_0x43e7('0x1e')](function(){if(_[_0x43e7('0xb4')](_0x26f072[_0x43e7('0x41')][_0x43e7('0x6d')])){for(var _0x57d856=0x0;_0x57d856<_0x26f072[_0x43e7('0x41')][_0x43e7('0x6d')][_0x43e7('0x45')];_0x57d856+=0x1){socket[_0x43e7('0xb1')](_0x43e7('0xb5'),{'UserId':Number(_0x26f072[_0x43e7('0x41')][_0x43e7('0x6d')][_0x57d856]),'OpenchannelAccountId':Number(_0x26f072[_0x43e7('0x50')]['id'])});}}else{socket[_0x43e7('0xb1')](_0x43e7('0xb5'),{'UserId':Number(_0x26f072[_0x43e7('0x41')][_0x43e7('0x6d')]),'OpenchannelAccountId':Number(_0x26f072[_0x43e7('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x4bbd29,null))[_0x43e7('0x4e')](handleError(_0x4bbd29,null));};exports[_0x43e7('0xb6')]=function(_0x4cc5dd,_0x21a06a,_0x2c5e64){var _0x4aaf17={};var _0x331a72={};var _0x211c37;var _0x2b9cf9;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4cc5dd[_0x43e7('0x50')]['id']}})[_0x43e7('0x1e')](handleEntityNotFound(_0x21a06a,null))[_0x43e7('0x1e')](function(_0x765825){if(_0x765825){_0x211c37=_0x765825;_0x331a72[_0x43e7('0x3f')]=_[_0x43e7('0x52')](db[_0x43e7('0x9b')][_0x43e7('0x3b')]);_0x331a72['query']=_[_0x43e7('0x52')](_0x4cc5dd[_0x43e7('0x41')]);_0x331a72[_0x43e7('0x42')]=_[_0x43e7('0x43')](_0x331a72[_0x43e7('0x3f')],_0x331a72[_0x43e7('0x41')]);_0x4aaf17[_0x43e7('0x44')]=_[_0x43e7('0x43')](_0x331a72[_0x43e7('0x3f')],qs[_0x43e7('0x53')](_0x4cc5dd[_0x43e7('0x41')][_0x43e7('0x53')]));_0x4aaf17['attributes']=_0x4aaf17[_0x43e7('0x44')][_0x43e7('0x45')]?_0x4aaf17[_0x43e7('0x44')]:_0x331a72[_0x43e7('0x3f')];_0x4aaf17[_0x43e7('0x65')]=qs[_0x43e7('0x46')](_0x4cc5dd['query'][_0x43e7('0x46')]);_0x4aaf17['where']=qs[_0x43e7('0x42')](_[_0x43e7('0x48')](_0x4cc5dd[_0x43e7('0x41')],_0x331a72['filters']));if(_0x4cc5dd[_0x43e7('0x41')][_0x43e7('0x4a')]){_0x4aaf17['where']=_[_0x43e7('0x49')](_0x4aaf17['where'],{'$or':_[_0x43e7('0x3a')](_0x4aaf17[_0x43e7('0x44')],function(_0x2849c0){var _0x563e05={};_0x563e05[_0x2849c0]={'$like':'%'+_0x4cc5dd['query'][_0x43e7('0x4a')]+'%'};return _0x563e05;})});}_0x4aaf17=_[_0x43e7('0x49')]({},_0x4aaf17,_0x4cc5dd[_0x43e7('0x56')]);return _0x211c37['getAgents'](_0x4aaf17);}})[_0x43e7('0x1e')](function(_0x1e1da9){if(_0x1e1da9){_0x2b9cf9=_0x1e1da9[_0x43e7('0x45')];if(!_0x4cc5dd[_0x43e7('0x41')][_0x43e7('0x6a')](_0x43e7('0x6b'))){_0x4aaf17['limit']=qs[_0x43e7('0x2c')](_0x4cc5dd['query'][_0x43e7('0x2c')]);_0x4aaf17[_0x43e7('0x2b')]=qs['offset'](_0x4cc5dd[_0x43e7('0x41')][_0x43e7('0x2b')]);}return _0x211c37['getAgents'](_0x4aaf17);}})[_0x43e7('0x1e')](function(_0x3de230){if(_0x3de230){return _0x3de230?{'count':_0x2b9cf9,'rows':_0x3de230}:null;}})[_0x43e7('0x1e')](respondWithResult(_0x21a06a,null))[_0x43e7('0x4e')](handleError(_0x21a06a,null));};exports['send']=function(_0x5e9b40,_0x2abcf3,_0x2815ad){var _0x3aa5e1,_0x29acba,_0xa64f2b;if(_[_0x43e7('0x78')](_0x5e9b40[_0x43e7('0x59')][_0x43e7('0x59')])||_0x5e9b40['body'][_0x43e7('0x59')]===''){throw new db[(_0x43e7('0x71'))]['ValidationError'](_0x43e7('0x7a'));}if(_[_0x43e7('0x78')](_0x5e9b40[_0x43e7('0x59')]['to'])){}_0x3aa5e1=_0x5e9b40[_0x43e7('0x59')]['to'];return db[_0x43e7('0x4b')][_0x43e7('0xa4')]({'where':{'id':_0x5e9b40[_0x43e7('0x50')]['id']}})['then'](handleEntityNotFound(_0x2abcf3,null))[_0x43e7('0x1e')](function(_0x5d7517){if(_0x5d7517){return db[_0x43e7('0x4b')][_0x43e7('0x57')]({'where':{'id':_0x5d7517['id']},'include':[{'model':db['CmList'],'as':_0x43e7('0x83'),'include':[{'model':db['CmContact'],'as':_0x43e7('0x80'),'where':{[_0x5d7517[_0x43e7('0x7b')]]:_0x3aa5e1},'limit':0x1,'order':[[_0x43e7('0x75'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2abcf3,null))[_0x43e7('0x1e')](function(_0xcfecd2){if(_0xcfecd2&&_0xcfecd2['List']){_0x29acba=_0xcfecd2[_0x43e7('0x34')]({'plain':!![]});if(_0x29acba[_0x43e7('0x83')]&&_0x29acba[_0x43e7('0x83')]['Contacts'][_0x43e7('0x45')]){return _0x29acba[_0x43e7('0x83')][_0x43e7('0x80')][0x0];}return db['CmContact'][_0x43e7('0x58')](_[_0x43e7('0x18')](_0x5e9b40[_0x43e7('0x59')],{'firstName':_0x3aa5e1,[_0xcfecd2[_0x43e7('0x7b')]]:_0x3aa5e1,'phone':_0x3aa5e1,'ListId':_0x29acba[_0x43e7('0x8a')]}));}})[_0x43e7('0x1e')](handleEntityNotFound(_0x2abcf3,null))['then'](function(_0x2e07a2){if(_0x2e07a2){_0xa64f2b=_0x2e07a2;return db[_0x43e7('0x8f')][_0x43e7('0x57')]({'where':{'ContactId':_0xa64f2b['id'],'closed':![],'OpenchannelAccountId':_0x29acba['id']}})[_0x43e7('0x1e')](function(_0xc2b4){if(_0xc2b4){return[_0xc2b4,![]];}return db[_0x43e7('0x8f')][_0x43e7('0x58')]({'UserId':_0x5e9b40[_0x43e7('0x5a')]['id'],'ContactId':_0xa64f2b['id'],'OpenchannelAccountId':_0x29acba['id'],'lastMsgDirection':_0x43e7('0xb7'),'Messages':[_[_0x43e7('0x49')](_0x5e9b40[_0x43e7('0x59')],{'read':![],'body':_0x5e9b40[_0x43e7('0x59')]['body'],'OpenchannelAccountId':_0x29acba['id'],'UserId':_0x5e9b40['user']['id'],'ContactId':_0xa64f2b['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x43e7('0x1e')](function(_0x20eef6){return[_0x20eef6,!![]];});});}})[_0x43e7('0x91')](function(_0x36ca29,_0x70377d){if(_0x70377d){return _0x36ca29;}return db[_0x43e7('0x99')]['create'](_['merge'](_0x5e9b40[_0x43e7('0x59')],{'read':![],'body':_0x5e9b40[_0x43e7('0x59')]['body'],'OpenchannelAccountId':_0x29acba['id'],'OpenchannelInteractionId':_0x36ca29['id'],'UserId':_0x5e9b40['user']['id'],'ContactId':_0xa64f2b['id']}))[_0x43e7('0x1e')](function(_0x26dbf1){_0x36ca29['dataValues'][_0x43e7('0xb8')]=[];_0x36ca29['dataValues']['Messages'][_0x43e7('0x96')](_0x26dbf1[_0x43e7('0xb9')]);return _0x36ca29;});});}})['then'](respondWithResult(_0x2abcf3,null))['catch'](handleError(_0x2abcf3,null));}; \ No newline at end of file +var _0x34e8=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','Pause','mandatoryDispositionPause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','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','from','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','asc','firstName','threadId','OpenchannelInteraction','externalUrl','spread','contact','lastName','messageId','interaction','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','priority','Contact','Owner','fullname','internal','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','CmList','defaults','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','stack','name','send','index','OpenchannelAccount','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x34e8,0x12c));var _0x834e=function(_0x1a1ee2,_0xae2bfb){_0x1a1ee2=_0x1a1ee2-0x0;var _0x5370a3=_0x34e8[_0x1a1ee2];return _0x5370a3;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x834e('0xc'));var squel=require(_0x834e('0xd'));var crypto=require(_0x834e('0xe'));var jsforce=require(_0x834e('0xf'));var deskjs=require(_0x834e('0x10'));var toCsv=require(_0x834e('0x11'));var querystring=require(_0x834e('0x12'));var Papa=require(_0x834e('0x13'));var Redis=require(_0x834e('0x14'));var authService=require(_0x834e('0x15'));var qs=require(_0x834e('0x16'));var as=require(_0x834e('0x17'));var hardwareService=require(_0x834e('0x18'));var logger=require(_0x834e('0x19'))(_0x834e('0x1a'));var utils=require(_0x834e('0x1b'));var config=require(_0x834e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x834e('0x1d'))['db'];config[_0x834e('0x1e')]=_['defaults'](config[_0x834e('0x1e')],{'host':_0x834e('0x1f'),'port':0x18eb});var socket=require(_0x834e('0x20'))(new Redis(config[_0x834e('0x1e')]));require('./openchannelAccount.socket')[_0x834e('0x21')](socket);var jayson=require(_0x834e('0x22'));var client=jayson['client'][_0x834e('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x834e('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x36d443,_0x478afe,_0x43ac41,_0x22106e){return new BPromise(function(_0x370fb5,_0x50b3f6){var _0x283e56=_0x22106e||client;return _0x283e56[_0x834e('0x24')](_0x36d443,_0x43ac41)[_0x834e('0x25')](function(_0xb993a1){logger[_0x834e('0x26')](_0x834e('0x27'),_0x478afe,_0x834e('0x28'));logger['debug'](_0x834e('0x29'),_0x478afe,_0x834e('0x28'),JSON[_0x834e('0x2a')](_0xb993a1));if(_0xb993a1[_0x834e('0x2b')]){if(_0xb993a1['error'][_0x834e('0x2c')]===0x1f4){logger[_0x834e('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x478afe,_0xb993a1[_0x834e('0x2b')][_0x834e('0x2d')]);return _0x50b3f6(_0xb993a1[_0x834e('0x2b')]['message']);}logger['error'](_0x834e('0x27'),_0x478afe,_0xb993a1[_0x834e('0x2b')]['message']);return _0x370fb5(_0xb993a1[_0x834e('0x2b')][_0x834e('0x2d')]);}else{logger['info'](_0x834e('0x27'),_0x478afe,_0x834e('0x28'));_0x370fb5(_0xb993a1[_0x834e('0x2e')]['message']);}})[_0x834e('0x2f')](function(_0x3e310f){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x478afe,_0x3e310f);_0x50b3f6(_0x3e310f);});});}function respondWithStatusCode(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0xcc;return function(_0x2826ec){if(_0x2826ec){return _0x1e713a[_0x834e('0x30')](_0x508a1d);}return _0x1e713a[_0x834e('0x31')](_0x508a1d)[_0x834e('0x32')]();};}function respondWithResult(_0x3cd928,_0x130cc5){_0x130cc5=_0x130cc5||0xc8;return function(_0x491919){if(_0x491919){return _0x3cd928['status'](_0x130cc5)['json'](_0x491919);}};}function respondWithFilteredResult(_0x58c1d7,_0x2c7a8d){return function(_0x567cea){if(_0x567cea){var _0x106d6a=_0x567cea[_0x834e('0x33')],_0x5dacc1=_0x2c7a8d[_0x834e('0x34')],_0xb5bc06=_0x2c7a8d[_0x834e('0x34')]+_0x2c7a8d[_0x834e('0x35')],_0x11f1ce;if(_0xb5bc06>=_0x106d6a){_0xb5bc06=_0x106d6a;_0x11f1ce=0xc8;}else{_0x11f1ce=0xce;}_0x58c1d7[_0x834e('0x31')](_0x11f1ce);return _0x58c1d7[_0x834e('0x36')](_0x834e('0x37'),_0x5dacc1+'-'+_0xb5bc06+'/'+_0x106d6a)['json'](_0x567cea);}return null;};}function patchUpdates(_0xef9ec2){return function(_0x5cad11){try{jsonpatch[_0x834e('0x38')](_0x5cad11,_0xef9ec2,!![]);}catch(_0x3787b0){return BPromise[_0x834e('0x39')](_0x3787b0);}return _0x5cad11[_0x834e('0x3a')]();};}function saveUpdates(_0x444366,_0x4689c2){return function(_0x4696a1){if(_0x4696a1){return _0x4696a1[_0x834e('0x3b')](_0x444366)[_0x834e('0x25')](function(_0x12b2bc){return _0x12b2bc;});}return null;};}function removeEntity(_0x5bd232,_0x2a3c7f){return function(_0x2f408a){if(_0x2f408a){return _0x2f408a[_0x834e('0x3c')]()[_0x834e('0x25')](function(){var _0x595cc0=_0x2f408a[_0x834e('0x3d')]({'plain':!![]});var _0x379d60='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x379d60,'resourceId':_0x595cc0['id']}})[_0x834e('0x25')](function(){return _0x2f408a;});})[_0x834e('0x25')](function(){_0x5bd232[_0x834e('0x31')](0xcc)[_0x834e('0x32')]();});}};}function handleEntityNotFound(_0x339e28,_0x1b76dd){return function(_0x4c2ef6){if(!_0x4c2ef6){_0x339e28[_0x834e('0x30')](0x194);}return _0x4c2ef6;};}function handleError(_0x513f36,_0xe103fe){_0xe103fe=_0xe103fe||0x1f4;return function(_0x6a3ac){logger['error'](_0x6a3ac[_0x834e('0x3e')]);if(_0x6a3ac[_0x834e('0x3f')]){delete _0x6a3ac['name'];}_0x513f36['status'](_0xe103fe)[_0x834e('0x40')](_0x6a3ac);};}exports[_0x834e('0x41')]=function(_0x2e9383,_0x130c23){var _0x3c49bd={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4ca43c={},_0x1c5ed6={'count':0x0,'rows':[]};var _0x1b2edf=_['map'](db[_0x834e('0x42')][_0x834e('0x43')],function(_0x16aea6){return{'name':_0x16aea6[_0x834e('0x44')],'type':_0x16aea6[_0x834e('0x45')]['key']};});_0x4ca43c[_0x834e('0x46')]=_[_0x834e('0x47')](_0x1b2edf,_0x834e('0x3f'));_0x4ca43c['query']=_[_0x834e('0x48')](_0x2e9383[_0x834e('0x49')]);_0x4ca43c['filters']=_[_0x834e('0x4a')](_0x4ca43c['model'],_0x4ca43c[_0x834e('0x49')]);_0x3c49bd[_0x834e('0x4b')]=_['intersection'](_0x4ca43c['model'],qs[_0x834e('0x4c')](_0x2e9383[_0x834e('0x49')][_0x834e('0x4c')]));_0x3c49bd[_0x834e('0x4b')]=_0x3c49bd[_0x834e('0x4b')][_0x834e('0x4d')]?_0x3c49bd[_0x834e('0x4b')]:_0x4ca43c['model'];if(!_0x2e9383[_0x834e('0x49')]['hasOwnProperty'](_0x834e('0x4e'))){_0x3c49bd['limit']=qs[_0x834e('0x35')](_0x2e9383['query'][_0x834e('0x35')]);_0x3c49bd[_0x834e('0x34')]=qs['offset'](_0x2e9383[_0x834e('0x49')][_0x834e('0x34')]);}_0x3c49bd[_0x834e('0x4f')]=qs[_0x834e('0x50')](_0x2e9383[_0x834e('0x49')][_0x834e('0x50')]);_0x3c49bd[_0x834e('0x51')]=qs[_0x834e('0x52')](_[_0x834e('0x53')](_0x2e9383[_0x834e('0x49')],_0x4ca43c['filters']),_0x1b2edf);if(_0x2e9383[_0x834e('0x49')][_0x834e('0x54')]){_0x3c49bd['where']=_[_0x834e('0x55')](_0x3c49bd[_0x834e('0x51')],{'$or':_[_0x834e('0x47')](_0x1b2edf,function(_0x2112d5){if(_0x2112d5[_0x834e('0x45')]!==_0x834e('0x56')){var _0x4eab06={};_0x4eab06[_0x2112d5['name']]={'$like':'%'+_0x2e9383[_0x834e('0x49')][_0x834e('0x54')]+'%'};return _0x4eab06;}})});}_0x3c49bd=_[_0x834e('0x55')]({},_0x3c49bd,_0x2e9383[_0x834e('0x57')]);var _0x3da408={'where':_0x3c49bd[_0x834e('0x51')]};return db[_0x834e('0x42')][_0x834e('0x33')](_0x3da408)[_0x834e('0x25')](function(_0x390c45){_0x1c5ed6[_0x834e('0x33')]=_0x390c45;if(_0x2e9383[_0x834e('0x49')][_0x834e('0x58')]){_0x3c49bd[_0x834e('0x59')]=[{'all':!![]}];}return db[_0x834e('0x42')][_0x834e('0x5a')](_0x3c49bd);})[_0x834e('0x25')](function(_0x32b8f7){_0x1c5ed6[_0x834e('0x5b')]=_0x32b8f7;return _0x1c5ed6;})[_0x834e('0x25')](respondWithFilteredResult(_0x130c23,_0x3c49bd))['catch'](handleError(_0x130c23,null));};exports[_0x834e('0x5c')]=function(_0x1f08b9,_0x4e73e0){var _0x3c00a3={'raw':![],'where':{'id':_0x1f08b9['params']['id']},'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e')}]},_0x3b0988={};_0x3b0988[_0x834e('0x46')]=_[_0x834e('0x48')](db[_0x834e('0x42')][_0x834e('0x43')]);_0x3b0988[_0x834e('0x49')]=_['keys'](_0x1f08b9[_0x834e('0x49')]);_0x3b0988[_0x834e('0x52')]=_[_0x834e('0x4a')](_0x3b0988[_0x834e('0x46')],_0x3b0988[_0x834e('0x49')]);_0x3c00a3[_0x834e('0x4b')]=_[_0x834e('0x4a')](_0x3b0988[_0x834e('0x46')],qs['fields'](_0x1f08b9[_0x834e('0x49')]['fields']));_0x3c00a3[_0x834e('0x4b')]=_0x3c00a3['attributes'][_0x834e('0x4d')]?_0x3c00a3['attributes']:_0x3b0988['model'];if(_0x1f08b9[_0x834e('0x49')][_0x834e('0x58')]){_0x3c00a3['include']=[{'all':!![]}];}_0x3c00a3=_['merge']({},_0x3c00a3,_0x1f08b9[_0x834e('0x57')]);return db[_0x834e('0x42')][_0x834e('0x5f')](_0x3c00a3)[_0x834e('0x25')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x25')](respondWithResult(_0x4e73e0,null))[_0x834e('0x2f')](handleError(_0x4e73e0,null));};exports[_0x834e('0x60')]=function(_0x4273f1,_0x528e66){return db[_0x834e('0x42')][_0x834e('0x60')](_0x4273f1['body'],{})[_0x834e('0x25')](function(_0x4e2b22){var _0x3e58ef=_0x4273f1[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x3e58ef)throw new Error(_0x834e('0x62'));if(_0x3e58ef[_0x834e('0x63')]===_0x834e('0x61')){var _0x25f720=_0x4e2b22['get']({'plain':!![]});var _0xe35ded=_0x834e('0x64');return db[_0x834e('0x65')]['find']({'where':{'name':_0xe35ded,'userProfileId':_0x3e58ef[_0x834e('0x66')]},'raw':!![]})[_0x834e('0x25')](function(_0x3a7683){if(_0x3a7683&&_0x3a7683[_0x834e('0x67')]===0x0){return db[_0x834e('0x68')][_0x834e('0x60')]({'name':_0x25f720[_0x834e('0x3f')],'resourceId':_0x25f720['id'],'type':_0x3a7683[_0x834e('0x3f')],'sectionId':_0x3a7683['id']},{})[_0x834e('0x25')](function(){return _0x4e2b22;});}else{return _0x4e2b22;}})[_0x834e('0x2f')](function(_0x1e4310){logger[_0x834e('0x2b')](_0x834e('0x69'),_0x1e4310);throw _0x1e4310;});}return _0x4e2b22;})[_0x834e('0x25')](respondWithResult(_0x528e66,0xc9))[_0x834e('0x2f')](handleError(_0x528e66,null));};exports[_0x834e('0x3b')]=function(_0x297cce,_0x14ed83){if(_0x297cce[_0x834e('0x6a')]['id']){delete _0x297cce[_0x834e('0x6a')]['id'];}return db[_0x834e('0x42')][_0x834e('0x5f')]({'where':{'id':_0x297cce['params']['id']},'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e')}]})[_0x834e('0x25')](handleEntityNotFound(_0x14ed83,null))[_0x834e('0x25')](saveUpdates(_0x297cce['body'],null))[_0x834e('0x25')](respondWithResult(_0x14ed83,null))['catch'](handleError(_0x14ed83,null));};exports['destroy']=function(_0x2fdb1b,_0x2b1ec7){return db[_0x834e('0x42')][_0x834e('0x5f')]({'where':{'id':_0x2fdb1b[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x2b1ec7,null))[_0x834e('0x25')](removeEntity(_0x2b1ec7,null))[_0x834e('0x2f')](handleError(_0x2b1ec7,null));};exports['describe']=function(_0xdef8c4,_0x5a99e6){return db[_0x834e('0x42')][_0x834e('0x6c')]()['then'](respondWithResult(_0x5a99e6,null))['catch'](handleError(_0x5a99e6,null));};exports[_0x834e('0x6d')]=function(_0x82f2a7,_0x363cc2,_0x2cca07){if(_0x82f2a7[_0x834e('0x6a')]['id']){delete _0x82f2a7['body']['id'];}return db[_0x834e('0x42')][_0x834e('0x5f')]({'where':{'id':_0x82f2a7[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x363cc2,null))[_0x834e('0x25')](function(_0x28b5c9){if(_0x28b5c9){_0x82f2a7[_0x834e('0x6a')][_0x834e('0x6e')]=_0x28b5c9['id'];return db[_0x834e('0x6f')][_0x834e('0x60')](_0x82f2a7['body']);}})[_0x834e('0x25')](respondWithResult(_0x363cc2,null))[_0x834e('0x2f')](handleError(_0x363cc2,null));};exports[_0x834e('0x70')]=function(_0x5b5d6f,_0x51cfab,_0x46fa0d){var _0x4ac5f2={'raw':![],'where':{}};var _0x5ce8b0={};var _0x55d7ae={'count':0x0,'rows':[]};return db[_0x834e('0x42')][_0x834e('0x71')]({'where':{'id':_0x5b5d6f['params']['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x51cfab,null))[_0x834e('0x25')](function(_0x4d4477){if(_0x4d4477){_0x5ce8b0[_0x834e('0x46')]=_[_0x834e('0x48')](db['Disposition']['rawAttributes']);_0x5ce8b0[_0x834e('0x49')]=_[_0x834e('0x48')](_0x5b5d6f[_0x834e('0x49')]);_0x5ce8b0[_0x834e('0x52')]=_[_0x834e('0x4a')](_0x5ce8b0['model'],_0x5ce8b0[_0x834e('0x49')]);_0x4ac5f2['attributes']=_[_0x834e('0x4a')](_0x5ce8b0[_0x834e('0x46')],qs[_0x834e('0x4c')](_0x5b5d6f['query'][_0x834e('0x4c')]));_0x4ac5f2[_0x834e('0x4b')]=_0x4ac5f2['attributes'][_0x834e('0x4d')]?_0x4ac5f2[_0x834e('0x4b')]:_0x5ce8b0[_0x834e('0x46')];if(!_0x5b5d6f['query'][_0x834e('0x72')](_0x834e('0x4e'))){_0x4ac5f2[_0x834e('0x35')]=qs[_0x834e('0x35')](_0x5b5d6f[_0x834e('0x49')][_0x834e('0x35')]);_0x4ac5f2[_0x834e('0x34')]=qs[_0x834e('0x34')](_0x5b5d6f[_0x834e('0x49')][_0x834e('0x34')]);}_0x4ac5f2['order']=qs['sort'](_0x5b5d6f['query'][_0x834e('0x50')]);_0x4ac5f2[_0x834e('0x51')]=qs[_0x834e('0x52')](_[_0x834e('0x53')](_0x5b5d6f[_0x834e('0x49')],_0x5ce8b0['filters']));_0x4ac5f2['where'][_0x834e('0x6e')]=_0x4d4477['id'];if(_0x5b5d6f[_0x834e('0x49')][_0x834e('0x54')]){_0x4ac5f2[_0x834e('0x51')]=_[_0x834e('0x55')](_0x4ac5f2['where'],{'$or':_[_0x834e('0x47')](_0x4ac5f2[_0x834e('0x4b')],function(_0x113714){var _0x4e1735={};_0x4e1735[_0x113714]={'$like':'%'+_0x5b5d6f[_0x834e('0x49')][_0x834e('0x54')]+'%'};return _0x4e1735;})});}_0x4ac5f2=_[_0x834e('0x55')]({},_0x4ac5f2,_0x5b5d6f[_0x834e('0x57')]);return db[_0x834e('0x6f')]['count']({'where':_0x4ac5f2['where']})[_0x834e('0x25')](function(_0x40a872){_0x55d7ae['count']=_0x40a872;if(_0x5b5d6f[_0x834e('0x49')]['includeAll']){_0x4ac5f2[_0x834e('0x59')]=[{'all':!![]}];}return db[_0x834e('0x6f')][_0x834e('0x5a')](_0x4ac5f2);})['then'](function(_0x155c0f){_0x55d7ae['rows']=_0x155c0f;return _0x55d7ae;});}})['then'](respondWithFilteredResult(_0x51cfab,_0x4ac5f2))['catch'](handleError(_0x51cfab,null));};exports[_0x834e('0x73')]=function(_0x4627ac,_0x1d7bab,_0x1d76c6){return db[_0x834e('0x42')][_0x834e('0x5f')]({'where':{'id':_0x4627ac[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x1d7bab,null))[_0x834e('0x25')](function(_0x53f6e3){if(_0x53f6e3){return _0x53f6e3[_0x834e('0x73')](_0x4627ac['query'][_0x834e('0x74')]);}})[_0x834e('0x25')](respondWithStatusCode(_0x1d7bab,null))[_0x834e('0x2f')](handleError(_0x1d7bab,null));};exports[_0x834e('0x75')]=function(_0x1d1877,_0x116830,_0x567992){if(_0x1d1877['body']['id']){delete _0x1d1877[_0x834e('0x6a')]['id'];}return db[_0x834e('0x42')]['find']({'where':{'id':_0x1d1877[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x116830,null))[_0x834e('0x25')](function(_0x1e225f){if(_0x1e225f){_0x1d1877[_0x834e('0x6a')]['OpenchannelAccountId']=_0x1e225f['id'];return db[_0x834e('0x76')][_0x834e('0x60')](_0x1d1877['body']);}})['then'](respondWithResult(_0x116830,null))['catch'](handleError(_0x116830,null));};exports[_0x834e('0x77')]=function(_0x1f3e26,_0x4f716d,_0x23ce49){var _0x1f053f={'raw':![],'where':{}};var _0x49b480={};var _0xfb93b1={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1f3e26[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x4f716d,null))[_0x834e('0x25')](function(_0xe28851){if(_0xe28851){_0x49b480['model']=_[_0x834e('0x48')](db[_0x834e('0x76')][_0x834e('0x43')]);_0x49b480[_0x834e('0x49')]=_[_0x834e('0x48')](_0x1f3e26[_0x834e('0x49')]);_0x49b480[_0x834e('0x52')]=_[_0x834e('0x4a')](_0x49b480[_0x834e('0x46')],_0x49b480[_0x834e('0x49')]);_0x1f053f[_0x834e('0x4b')]=_[_0x834e('0x4a')](_0x49b480[_0x834e('0x46')],qs[_0x834e('0x4c')](_0x1f3e26[_0x834e('0x49')][_0x834e('0x4c')]));_0x1f053f[_0x834e('0x4b')]=_0x1f053f[_0x834e('0x4b')][_0x834e('0x4d')]?_0x1f053f[_0x834e('0x4b')]:_0x49b480[_0x834e('0x46')];if(!_0x1f3e26[_0x834e('0x49')]['hasOwnProperty'](_0x834e('0x4e'))){_0x1f053f[_0x834e('0x35')]=qs[_0x834e('0x35')](_0x1f3e26[_0x834e('0x49')][_0x834e('0x35')]);_0x1f053f[_0x834e('0x34')]=qs[_0x834e('0x34')](_0x1f3e26[_0x834e('0x49')][_0x834e('0x34')]);}_0x1f053f['order']=qs['sort'](_0x1f3e26['query'][_0x834e('0x50')]);_0x1f053f['where']=qs[_0x834e('0x52')](_[_0x834e('0x53')](_0x1f3e26[_0x834e('0x49')],_0x49b480['filters']));_0x1f053f[_0x834e('0x51')][_0x834e('0x6e')]=_0xe28851['id'];if(_0x1f3e26[_0x834e('0x49')][_0x834e('0x54')]){_0x1f053f[_0x834e('0x51')]=_[_0x834e('0x55')](_0x1f053f['where'],{'$or':_[_0x834e('0x47')](_0x1f053f[_0x834e('0x4b')],function(_0x24ff45){var _0x430973={};_0x430973[_0x24ff45]={'$like':'%'+_0x1f3e26[_0x834e('0x49')]['filter']+'%'};return _0x430973;})});}_0x1f053f=_['merge']({},_0x1f053f,_0x1f3e26['options']);return db['CannedAnswer'][_0x834e('0x33')]({'where':_0x1f053f[_0x834e('0x51')]})['then'](function(_0x3bd1e7){_0xfb93b1[_0x834e('0x33')]=_0x3bd1e7;if(_0x1f3e26['query'][_0x834e('0x58')]){_0x1f053f[_0x834e('0x59')]=[{'all':!![]}];}return db[_0x834e('0x76')][_0x834e('0x5a')](_0x1f053f);})[_0x834e('0x25')](function(_0x404bab){_0xfb93b1['rows']=_0x404bab;return _0xfb93b1;});}})['then'](respondWithFilteredResult(_0x4f716d,_0x1f053f))[_0x834e('0x2f')](handleError(_0x4f716d,null));};exports[_0x834e('0x78')]=function(_0x1d2e12,_0x58bdd6,_0x34fb30){return db[_0x834e('0x42')]['find']({'where':{'id':_0x1d2e12[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x58bdd6,null))[_0x834e('0x25')](function(_0x30e3aa){if(_0x30e3aa){return _0x30e3aa['removeAnswers'](_0x1d2e12[_0x834e('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x58bdd6,null))[_0x834e('0x2f')](handleError(_0x58bdd6,null));};exports[_0x834e('0x79')]=function(_0x24dcd0,_0x3fde89,_0x2426f2){var _0x1e850a={'body':_0x24dcd0['body'],'channel':'openchannel'};var _0x1b7bfc=[];var _0x2e040e=[];var _0x321c4f={};var _0x1421b3=![];return db[_0x834e('0x7a')][_0x834e('0x6c')]()[_0x834e('0x25')](function(_0x596031){if(!_0x596031){throw new db[(_0x834e('0x7b'))][(_0x834e('0x7c'))]('no\x20available\x20attributes');}_0x1b7bfc=_[_0x834e('0x7d')](_[_0x834e('0x48')](_0x596031),[_0x834e('0x7e'),_0x834e('0x7f')]);_0x2e040e=_[_0x834e('0x7d')](_[_0x834e('0x48')](_0x596031),[_0x834e('0x7e'),_0x834e('0x7f'),_0x834e('0x80'),_0x834e('0x81')]);if(_0x24dcd0[_0x834e('0x6a')]['id']){delete _0x24dcd0[_0x834e('0x6a')]['id'];}if(_[_0x834e('0x82')](_0x24dcd0[_0x834e('0x6a')]['from'])){throw new db[(_0x834e('0x7b'))][(_0x834e('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x834e('0x82')](_0x24dcd0['body'][_0x834e('0x6a')])||_0x24dcd0['body'][_0x834e('0x6a')]===''){throw new db['Sequelize'][(_0x834e('0x7c'))](_0x834e('0x83'));}if(_[_0x834e('0x82')](_0x24dcd0[_0x834e('0x6a')]['mapKey'])){throw new db[(_0x834e('0x7b'))][(_0x834e('0x7c'))](_0x834e('0x84')+_0x2e040e);}if(!_[_0x834e('0x85')](_0x2e040e,_0x24dcd0[_0x834e('0x6a')][_0x834e('0x86')])){throw new db[(_0x834e('0x7b'))][(_0x834e('0x7c'))](_0x834e('0x87')+_0x2e040e);}_0x321c4f[_0x24dcd0[_0x834e('0x6a')][_0x834e('0x86')]]=_0x24dcd0[_0x834e('0x6a')][_0x834e('0x88')];})[_0x834e('0x25')](function(){return db[_0x834e('0x42')][_0x834e('0x5f')]({'where':{'id':_0x24dcd0[_0x834e('0x6b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x834e('0x7a')],'as':_0x834e('0x89'),'where':_0x321c4f,'limit':0x1,'order':[[_0x834e('0x7f'),_0x834e('0x8a')]]}]},{'model':db[_0x834e('0x8b')],'as':_0x834e('0x8c')}]});})[_0x834e('0x25')](handleEntityNotFound(_0x3fde89,null))[_0x834e('0x25')](function(_0x3ef7af){if(_0x3ef7af&&_0x3ef7af[_0x834e('0x8d')]){_0x1e850a[_0x834e('0x8e')]=_0x3ef7af;_0x1e850a[_0x834e('0x8f')]=_0x3ef7af['Applications'];_0x1e850a[_0x834e('0x90')]=_0x3ef7af['List'];_0x1e850a[_0x834e('0x8f')]=_[_0x834e('0x91')](_0x1e850a[_0x834e('0x8f')],['priority'],[_0x834e('0x92')]);if(_0x1e850a[_0x834e('0x8e')]['Applications']){delete _0x1e850a['account'][_0x834e('0x8c')];}if(_0x1e850a[_0x834e('0x8e')]['List']&&_0x1e850a[_0x834e('0x8e')][_0x834e('0x8d')][_0x834e('0x89')][_0x834e('0x4d')]){return _0x1e850a[_0x834e('0x8e')]['List']['Contacts'][0x0];}var _0x453e58=_['defaults'](_0x24dcd0['body'],{'firstName':_0x24dcd0['body'][_0x834e('0x88')],'ListId':_0x3ef7af[_0x834e('0x81')]});_0x453e58[_0x24dcd0['body'][_0x834e('0x86')]]=_0x24dcd0[_0x834e('0x6a')][_0x834e('0x88')];return db[_0x834e('0x7a')]['create'](_0x453e58,{'fields':_0x1b7bfc,'raw':!![]});}})[_0x834e('0x25')](handleEntityNotFound(_0x3fde89,null))[_0x834e('0x25')](function(_0x117196){_0x1e850a['contact']=_0x117196;if(_0x117196){var _0x3d8af7={'ContactId':_0x117196['id'],'OpenchannelAccountId':_0x24dcd0['params']['id'],'from':(_0x117196[_0x834e('0x93')]||'')+'\x20'+(_0x117196['lastName']||'')};var _0x461420={'OpenchannelAccountId':_0x24dcd0[_0x834e('0x6b')]['id'],'closed':![]};if(_0x24dcd0['body'][_0x834e('0x94')]){_0x461420[_0x834e('0x94')]=_0x24dcd0[_0x834e('0x6a')][_0x834e('0x94')];return db[_0x834e('0x95')][_0x834e('0x5f')]({'where':_0x461420})['then'](function(_0x2d4b29){if(_0x2d4b29){return[_0x2d4b29,![]];}_0x3d8af7[_0x834e('0x94')]=_0x24dcd0[_0x834e('0x6a')][_0x834e('0x94')];_0x3d8af7[_0x834e('0x96')]=_0x24dcd0[_0x834e('0x6a')]['externalUrl'];return db[_0x834e('0x95')]['create'](_0x3d8af7)['then'](function(_0x17eb13){return[_0x17eb13,!![]];});});}else{_0x461420['threadId']=null;}_0x461420['ContactId']=_0x117196['id'];return db[_0x834e('0x95')][_0x834e('0x5f')]({'where':_0x461420})[_0x834e('0x25')](function(_0x2e5886){if(_0x2e5886){return[_0x2e5886,![]];}return db[_0x834e('0x95')][_0x834e('0x60')](_0x3d8af7)[_0x834e('0x25')](function(_0x155f2d){return[_0x155f2d,!![]];});});}})[_0x834e('0x97')](function(_0x1ce252,_0x38df5f){if(_0x1ce252){_0x1421b3=_0x38df5f;if(!_0x38df5f){var _0x7cec1d={'from':(_0x1e850a[_0x834e('0x98')][_0x834e('0x93')]||'')+'\x20'+(_0x1e850a['contact'][_0x834e('0x99')]||'')};if(_0x24dcd0['body'][_0x834e('0x94')]&&_0x24dcd0[_0x834e('0x6a')][_0x834e('0x9a')]&&_0x24dcd0[_0x834e('0x6a')]['threadId']!=_0x24dcd0['body'][_0x834e('0x9a')]){_0x7cec1d[_0x834e('0x94')]=_0x24dcd0['body'][_0x834e('0x9a')];}return _0x1ce252[_0x834e('0x3b')](_0x7cec1d);}else{return _0x1ce252;}}})['then'](function(_0x231970){_0x1e850a[_0x834e('0x9b')]=_0x231970[_0x834e('0x3d')]({'plain':!![]});_0x1e850a[_0x834e('0x9b')]['created']=_0x1421b3;if(_0x1e850a['interaction']['created']){if(_0x1e850a['account'][_0x834e('0x9c')]){_0x1e850a[_0x834e('0x8f')]['push']({'id':0x0,'priority':_0x1e850a[_0x834e('0x8f')]['length']+0x1,'app':_0x834e('0x9d'),'appdata':_0x834e('0x9e'),'interval':_0x834e('0x9f')});}}return db[_0x834e('0xa0')][_0x834e('0x60')]({'body':_0x24dcd0[_0x834e('0x6a')][_0x834e('0x6a')],'OpenchannelAccountId':_0x24dcd0['params']['id'],'OpenchannelInteractionId':_0x231970['id'],'direction':'in','ContactId':_0x1e850a[_0x834e('0x98')]['id'],'AttachmentId':_0x24dcd0[_0x834e('0x6a')]['AttachmentId']});})[_0x834e('0x25')](function(_0x4551cb){_0x1e850a['message']=_0x4551cb;if(_0x1e850a['interaction']['UserId']){return db[_0x834e('0xa1')][_0x834e('0x5f')]({'attributes':['id',_0x834e('0x3f')],'where':{'id':_0x1e850a['interaction'][_0x834e('0xa2')]}})[_0x834e('0x25')](function(_0xbd0346){if(_0xbd0346){_0x1e850a[_0x834e('0x8f')][_0x834e('0xa3')]({'id':0x0,'priority':0x0,'app':_0x834e('0xa4'),'appdata':_0xbd0346[_0x834e('0x3f')]+','+(_0x1e850a[_0x834e('0x8e')][_0x834e('0xa5')]||0xa),'interval':_0x834e('0x9f')});_0x1e850a['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x834e('0xa6'),_0x1e850a);});}return respondWithRpcPromise(_0x834e('0xa7'),_0x834e('0xa6'),_0x1e850a);})[_0x834e('0x25')](function(_0x4303a6){respondWithRpcPromise(_0x834e('0xa8'),_0x834e('0xa8'),{'event':_0x834e('0x79'),'message':_0x4303a6},client9002);return _0x4303a6;})[_0x834e('0x25')](respondWithResult(_0x3fde89,null))[_0x834e('0x2f')](handleError(_0x3fde89,null));};exports[_0x834e('0xa9')]=function(_0x406c7a,_0x13b354,_0x4b12cd){return db[_0x834e('0x42')][_0x834e('0x71')]({'where':{'id':_0x406c7a[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x13b354,null))['then'](function(_0x5943a3){if(_0x5943a3){return db['sequelize'][_0x834e('0xaa')](function(_0xf98fb4){return db[_0x834e('0x8b')][_0x834e('0x3c')]({'where':{'OpenchannelAccountId':_0x406c7a[_0x834e('0x6b')]['id']},'transaction':_0xf98fb4})[_0x834e('0x25')](function(_0x2a1f87){var _0x3144d7=_['map'](_0x406c7a['body'],function(_0x4a0be3){_0x4a0be3['OpenchannelAccountId']=_0x406c7a[_0x834e('0x6b')]['id'];return _0x4a0be3;});return db[_0x834e('0x8b')][_0x834e('0xab')](_0x3144d7,{'transaction':_0xf98fb4});});})[_0x834e('0x25')](function(){return db[_0x834e('0x8b')][_0x834e('0xac')]({'where':{'OpenchannelAccountId':_0x406c7a[_0x834e('0x6b')]['id']},'order':_0x834e('0xad')});});}})[_0x834e('0x25')](respondWithResult(_0x13b354,null))['catch'](handleError(_0x13b354,null));};exports['getApplications']=function(_0x4d1545,_0x5dc651,_0x11aff8){var _0x17025e={};var _0x284183={};var _0x11caf7;var _0x862ba0;return db[_0x834e('0x42')][_0x834e('0x71')]({'where':{'id':_0x4d1545[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x5dc651,null))[_0x834e('0x25')](function(_0x44911c){if(_0x44911c){_0x11caf7=_0x44911c;_0x284183[_0x834e('0x46')]=_[_0x834e('0x48')](db[_0x834e('0x8b')][_0x834e('0x43')]);_0x284183[_0x834e('0x49')]=_['keys'](_0x4d1545[_0x834e('0x49')]);_0x284183['filters']=_[_0x834e('0x4a')](_0x284183[_0x834e('0x46')],_0x284183[_0x834e('0x49')]);_0x17025e['attributes']=_[_0x834e('0x4a')](_0x284183[_0x834e('0x46')],qs['fields'](_0x4d1545['query'][_0x834e('0x4c')]));_0x17025e[_0x834e('0x4b')]=_0x17025e[_0x834e('0x4b')][_0x834e('0x4d')]?_0x17025e[_0x834e('0x4b')]:_0x284183[_0x834e('0x46')];_0x17025e[_0x834e('0x4f')]=qs[_0x834e('0x50')](_0x4d1545['query'][_0x834e('0x50')]);_0x17025e[_0x834e('0x51')]=qs[_0x834e('0x52')](_[_0x834e('0x53')](_0x4d1545[_0x834e('0x49')],_0x284183[_0x834e('0x52')]));if(_0x4d1545[_0x834e('0x49')]['filter']){_0x17025e[_0x834e('0x51')]=_['merge'](_0x17025e['where'],{'$or':_[_0x834e('0x47')](_0x17025e[_0x834e('0x4b')],function(_0x4b16fa){var _0x3ce91b={};_0x3ce91b[_0x4b16fa]={'$like':'%'+_0x4d1545[_0x834e('0x49')]['filter']+'%'};return _0x3ce91b;})});}_0x17025e=_[_0x834e('0x55')]({},_0x17025e,_0x4d1545[_0x834e('0x57')]);return _0x11caf7['getApplications'](_0x17025e);}})['then'](function(_0xbb0217){if(_0xbb0217){_0x862ba0=_0xbb0217[_0x834e('0x4d')];if(!_0x4d1545['query']['hasOwnProperty'](_0x834e('0x4e'))){_0x17025e[_0x834e('0x35')]=qs['limit'](_0x4d1545['query']['limit']);_0x17025e['offset']=qs[_0x834e('0x34')](_0x4d1545['query'][_0x834e('0x34')]);}return _0x11caf7['getApplications'](_0x17025e);}})[_0x834e('0x25')](function(_0x168d21){if(_0x168d21){return _0x168d21?{'count':_0x862ba0,'rows':_0x168d21}:null;}})[_0x834e('0x25')](respondWithResult(_0x5dc651,null))[_0x834e('0x2f')](handleError(_0x5dc651,null));};exports['getInteractions']=function(_0x387ff8,_0x446d89,_0x39a075){var _0x37bb7b={'raw':![],'where':{}};var _0x3a3a6c={};var _0x469352={'count':0x0,'rows':[]};return db[_0x834e('0x42')][_0x834e('0x71')]({'where':{'id':_0x387ff8[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x446d89,null))['then'](function(_0x40e12e){if(_0x40e12e){_0x3a3a6c['model']=_[_0x834e('0x48')](db[_0x834e('0x95')][_0x834e('0x43')]);_0x3a3a6c[_0x834e('0x49')]=_[_0x834e('0x48')](_0x387ff8['query']);_0x3a3a6c[_0x834e('0x52')]=_['intersection'](_0x3a3a6c['model'],_0x3a3a6c[_0x834e('0x49')]);_0x37bb7b[_0x834e('0x4b')]=_[_0x834e('0x4a')](_0x3a3a6c['model'],qs[_0x834e('0x4c')](_0x387ff8[_0x834e('0x49')][_0x834e('0x4c')]));_0x37bb7b[_0x834e('0x4b')]=_0x37bb7b[_0x834e('0x4b')][_0x834e('0x4d')]?_0x37bb7b[_0x834e('0x4b')]:_0x3a3a6c[_0x834e('0x46')];if(!_0x387ff8[_0x834e('0x49')][_0x834e('0x72')](_0x834e('0x4e'))){_0x37bb7b['limit']=qs[_0x834e('0x35')](_0x387ff8[_0x834e('0x49')][_0x834e('0x35')]);_0x37bb7b[_0x834e('0x34')]=qs[_0x834e('0x34')](_0x387ff8[_0x834e('0x49')]['offset']);}_0x37bb7b[_0x834e('0x4f')]=qs[_0x834e('0x50')](_0x387ff8[_0x834e('0x49')][_0x834e('0x50')]);_0x37bb7b[_0x834e('0x51')]=qs[_0x834e('0x52')](_[_0x834e('0x53')](_0x387ff8[_0x834e('0x49')],_0x3a3a6c[_0x834e('0x52')]));_0x37bb7b[_0x834e('0x51')]['OpenchannelAccountId']=_0x40e12e['id'];if(_0x387ff8['query'][_0x834e('0x54')]){_0x37bb7b['where']=_[_0x834e('0x55')](_0x37bb7b[_0x834e('0x51')],{'$or':_[_0x834e('0x47')](_0x37bb7b[_0x834e('0x4b')],function(_0x1daa58){var _0x1d53c6={};_0x1d53c6[_0x1daa58]={'$like':'%'+_0x387ff8['query'][_0x834e('0x54')]+'%'};return _0x1d53c6;})});}_0x37bb7b=_['merge']({},_0x37bb7b,_0x387ff8['options']);return db['OpenchannelInteraction'][_0x834e('0x33')]({'where':_0x37bb7b[_0x834e('0x51')]})['then'](function(_0x5cb379){_0x469352['count']=_0x5cb379;if(_0x387ff8[_0x834e('0x49')][_0x834e('0x58')]){_0x37bb7b[_0x834e('0x59')]=[{'model':db['CmContact'],'as':_0x834e('0xae'),'required':![]},{'model':db[_0x834e('0xa1')],'as':_0x834e('0xaf'),'attributes':[_0x834e('0x3f'),_0x834e('0xb0'),_0x834e('0xb1')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x387ff8[_0x834e('0x49')][_0x834e('0xb2')]?{'id':_0x387ff8[_0x834e('0x49')][_0x834e('0xb2')]}:undefined,'required':_0x387ff8[_0x834e('0x49')][_0x834e('0xb2')]?!![]:![]}];}return db[_0x834e('0x95')][_0x834e('0x5a')](_0x37bb7b);})[_0x834e('0x25')](function(_0x40f17e){_0x469352[_0x834e('0x5b')]=_0x40f17e;return _0x469352;});}})[_0x834e('0x25')](respondWithFilteredResult(_0x446d89,_0x37bb7b))[_0x834e('0x2f')](handleError(_0x446d89,null));};exports[_0x834e('0xb3')]=function(_0x38796c,_0x59bd0e,_0x4f46bf){return db[_0x834e('0x42')][_0x834e('0x5f')]({'where':{'id':_0x38796c[_0x834e('0x6b')]['id']}})['then'](handleEntityNotFound(_0x59bd0e,null))[_0x834e('0x25')](function(_0x234d8f){if(_0x234d8f){return _0x234d8f[_0x834e('0xb3')](_0x38796c[_0x834e('0x6a')][_0x834e('0x74')],_[_0x834e('0xb4')](_0x38796c[_0x834e('0x6a')],[_0x834e('0x74'),'id'])||{})[_0x834e('0x97')](function(_0x53850c){for(var _0x1785ca=0x0;_0x1785ca<_0x38796c[_0x834e('0x6a')][_0x834e('0x74')][_0x834e('0x4d')];_0x1785ca+=0x1){socket['emit'](_0x834e('0xb5'),{'UserId':_0x38796c[_0x834e('0x6a')][_0x834e('0x74')][_0x1785ca],'OpenchannelAccountId':_0x38796c[_0x834e('0x6b')]['id']});}return _0x53850c;});}})[_0x834e('0x25')](respondWithResult(_0x59bd0e,null))[_0x834e('0x2f')](handleError(_0x59bd0e,null));};exports[_0x834e('0xb6')]=function(_0x2a6e9a,_0xf6c11d,_0x57ed6b){return db[_0x834e('0x42')]['find']({'where':{'id':_0x2a6e9a[_0x834e('0x6b')]['id']}})['then'](handleEntityNotFound(_0xf6c11d,null))[_0x834e('0x25')](function(_0x32f2f0){if(_0x32f2f0){return _0x32f2f0[_0x834e('0xb6')](_0x2a6e9a[_0x834e('0x49')][_0x834e('0x74')])['then'](function(){if(_[_0x834e('0xb7')](_0x2a6e9a[_0x834e('0x49')]['ids'])){for(var _0x5b891e=0x0;_0x5b891e<_0x2a6e9a[_0x834e('0x49')]['ids']['length'];_0x5b891e+=0x1){socket['emit'](_0x834e('0xb8'),{'UserId':Number(_0x2a6e9a[_0x834e('0x49')][_0x834e('0x74')][_0x5b891e]),'OpenchannelAccountId':Number(_0x2a6e9a[_0x834e('0x6b')]['id'])});}}else{socket[_0x834e('0xb9')](_0x834e('0xb8'),{'UserId':Number(_0x2a6e9a[_0x834e('0x49')]['ids']),'OpenchannelAccountId':Number(_0x2a6e9a[_0x834e('0x6b')]['id'])});}});}})[_0x834e('0x25')](respondWithStatusCode(_0xf6c11d,null))['catch'](handleError(_0xf6c11d,null));};exports['getAgents']=function(_0x29f45b,_0x17e62c,_0x50d3f5){var _0x5920f3={};var _0x3a7b1c={};var _0xbcf1d2;var _0x42305c;return db['OpenchannelAccount'][_0x834e('0x71')]({'where':{'id':_0x29f45b[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x17e62c,null))['then'](function(_0x24570f){if(_0x24570f){_0xbcf1d2=_0x24570f;_0x3a7b1c['model']=_[_0x834e('0x48')](db[_0x834e('0xa1')][_0x834e('0x43')]);_0x3a7b1c[_0x834e('0x49')]=_[_0x834e('0x48')](_0x29f45b['query']);_0x3a7b1c[_0x834e('0x52')]=_[_0x834e('0x4a')](_0x3a7b1c[_0x834e('0x46')],_0x3a7b1c[_0x834e('0x49')]);_0x5920f3[_0x834e('0x4b')]=_['intersection'](_0x3a7b1c['model'],qs[_0x834e('0x4c')](_0x29f45b[_0x834e('0x49')][_0x834e('0x4c')]));_0x5920f3['attributes']=_0x5920f3[_0x834e('0x4b')][_0x834e('0x4d')]?_0x5920f3[_0x834e('0x4b')]:_0x3a7b1c[_0x834e('0x46')];_0x5920f3['order']=qs[_0x834e('0x50')](_0x29f45b[_0x834e('0x49')]['sort']);_0x5920f3[_0x834e('0x51')]=qs[_0x834e('0x52')](_[_0x834e('0x53')](_0x29f45b[_0x834e('0x49')],_0x3a7b1c['filters']));if(_0x29f45b[_0x834e('0x49')]['filter']){_0x5920f3[_0x834e('0x51')]=_[_0x834e('0x55')](_0x5920f3[_0x834e('0x51')],{'$or':_[_0x834e('0x47')](_0x5920f3[_0x834e('0x4b')],function(_0x153d4c){var _0x56cce4={};_0x56cce4[_0x153d4c]={'$like':'%'+_0x29f45b['query'][_0x834e('0x54')]+'%'};return _0x56cce4;})});}_0x5920f3=_[_0x834e('0x55')]({},_0x5920f3,_0x29f45b['options']);return _0xbcf1d2[_0x834e('0xba')](_0x5920f3);}})['then'](function(_0x64469c){if(_0x64469c){_0x42305c=_0x64469c[_0x834e('0x4d')];if(!_0x29f45b[_0x834e('0x49')][_0x834e('0x72')](_0x834e('0x4e'))){_0x5920f3[_0x834e('0x35')]=qs[_0x834e('0x35')](_0x29f45b['query'][_0x834e('0x35')]);_0x5920f3[_0x834e('0x34')]=qs[_0x834e('0x34')](_0x29f45b[_0x834e('0x49')][_0x834e('0x34')]);}return _0xbcf1d2['getAgents'](_0x5920f3);}})[_0x834e('0x25')](function(_0x12f019){if(_0x12f019){return _0x12f019?{'count':_0x42305c,'rows':_0x12f019}:null;}})[_0x834e('0x25')](respondWithResult(_0x17e62c,null))['catch'](handleError(_0x17e62c,null));};exports['send']=function(_0x4fb3d0,_0x2f05b6,_0x2cad75){var _0x431bd3,_0xd6f2cc,_0x23118f;if(_[_0x834e('0x82')](_0x4fb3d0[_0x834e('0x6a')][_0x834e('0x6a')])||_0x4fb3d0[_0x834e('0x6a')][_0x834e('0x6a')]===''){throw new db[(_0x834e('0x7b'))]['ValidationError'](_0x834e('0x83'));}if(_[_0x834e('0x82')](_0x4fb3d0[_0x834e('0x6a')]['to'])){}_0x431bd3=_0x4fb3d0[_0x834e('0x6a')]['to'];return db[_0x834e('0x42')][_0x834e('0x71')]({'where':{'id':_0x4fb3d0[_0x834e('0x6b')]['id']}})[_0x834e('0x25')](handleEntityNotFound(_0x2f05b6,null))['then'](function(_0x24f79d){if(_0x24f79d){return db[_0x834e('0x42')]['find']({'where':{'id':_0x24f79d['id']},'include':[{'model':db[_0x834e('0xbb')],'as':_0x834e('0x8d'),'include':[{'model':db[_0x834e('0x7a')],'as':_0x834e('0x89'),'where':{[_0x24f79d['mapKey']]:_0x431bd3},'limit':0x1,'order':[['updatedAt',_0x834e('0x8a')]]}]}]})['then'](handleEntityNotFound(_0x2f05b6,null))[_0x834e('0x25')](function(_0x433cb4){if(_0x433cb4&&_0x433cb4[_0x834e('0x8d')]){_0xd6f2cc=_0x433cb4[_0x834e('0x3d')]({'plain':!![]});if(_0xd6f2cc[_0x834e('0x8d')]&&_0xd6f2cc['List'][_0x834e('0x89')]['length']){return _0xd6f2cc['List'][_0x834e('0x89')][0x0];}return db[_0x834e('0x7a')][_0x834e('0x60')](_[_0x834e('0xbc')](_0x4fb3d0[_0x834e('0x6a')],{'firstName':_0x431bd3,[_0x433cb4[_0x834e('0x86')]]:_0x431bd3,'phone':_0x431bd3,'ListId':_0xd6f2cc['ListId']}));}})[_0x834e('0x25')](handleEntityNotFound(_0x2f05b6,null))[_0x834e('0x25')](function(_0x58443a){if(_0x58443a){_0x23118f=_0x58443a;return db[_0x834e('0x95')][_0x834e('0x5f')]({'where':{'ContactId':_0x23118f['id'],'closed':![],'OpenchannelAccountId':_0xd6f2cc['id']}})['then'](function(_0x2d4cd7){if(_0x2d4cd7){return[_0x2d4cd7,![]];}return db[_0x834e('0x95')]['create']({'UserId':_0x4fb3d0[_0x834e('0x61')]['id'],'ContactId':_0x23118f['id'],'OpenchannelAccountId':_0xd6f2cc['id'],'lastMsgDirection':_0x834e('0xbd'),'Messages':[_[_0x834e('0x55')](_0x4fb3d0[_0x834e('0x6a')],{'read':![],'body':_0x4fb3d0[_0x834e('0x6a')][_0x834e('0x6a')],'OpenchannelAccountId':_0xd6f2cc['id'],'UserId':_0x4fb3d0[_0x834e('0x61')]['id'],'ContactId':_0x23118f['id']})]},{'include':[{'model':db[_0x834e('0xa0')],'as':_0x834e('0xbe')}]})[_0x834e('0x25')](function(_0x5944e1){return[_0x5944e1,!![]];});});}})[_0x834e('0x97')](function(_0x1e3168,_0x1ab510){if(_0x1ab510){return _0x1e3168;}return db[_0x834e('0xa0')][_0x834e('0x60')](_[_0x834e('0x55')](_0x4fb3d0[_0x834e('0x6a')],{'read':![],'body':_0x4fb3d0[_0x834e('0x6a')][_0x834e('0x6a')],'OpenchannelAccountId':_0xd6f2cc['id'],'OpenchannelInteractionId':_0x1e3168['id'],'UserId':_0x4fb3d0[_0x834e('0x61')]['id'],'ContactId':_0x23118f['id']}))[_0x834e('0x25')](function(_0x30eb5e){_0x1e3168['dataValues'][_0x834e('0xbe')]=[];_0x1e3168[_0x834e('0xbf')]['Messages']['push'](_0x30eb5e['dataValues']);return _0x1e3168;});});}})[_0x834e('0x25')](respondWithResult(_0x2f05b6,null))[_0x834e('0x2f')](handleError(_0x2f05b6,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 31c38b3..f09a820 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 _0x13bb=['emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x486d42,_0x297d26){var _0x9547bd=function(_0x18b115){while(--_0x18b115){_0x486d42['push'](_0x486d42['shift']());}};_0x9547bd(++_0x297d26);}(_0x13bb,0xd4));var _0xb13b=function(_0x27ed06,_0x390241){_0x27ed06=_0x27ed06-0x0;var _0x49079a=_0x13bb[_0x27ed06];return _0x49079a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xb13b('0x0'))['db'][_0xb13b('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb13b('0x2')](0x0);var events={'afterCreate':_0xb13b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1daf87){return function(_0x950008,_0x464490,_0x25a5a1){OpenchannelAccountEvents[_0xb13b('0x4')](_0x1daf87+':'+_0x950008['id'],_0x950008);OpenchannelAccountEvents[_0xb13b('0x4')](_0x1daf87,_0x950008);_0x25a5a1(null);};}for(var e in events){if(events[_0xb13b('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb13b('0x6')](e,emitEvent(event));}}module[_0xb13b('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x4a82=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x125ec3,_0x3ad786){var _0x3ba96=function(_0x2f3b14){while(--_0x2f3b14){_0x125ec3['push'](_0x125ec3['shift']());}};_0x3ba96(++_0x3ad786);}(_0x4a82,0xcf));var _0x24a8=function(_0x58784f,_0x11333d){_0x58784f=_0x58784f-0x0;var _0x3b1d4f=_0x4a82[_0x58784f];return _0x3b1d4f;};'use strict';var EventEmitter=require(_0x24a8('0x0'));var OpenchannelAccount=require(_0x24a8('0x1'))['db'][_0x24a8('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x24a8('0x3')](0x0);var events={'afterCreate':_0x24a8('0x4'),'afterUpdate':_0x24a8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3f7b72){return function(_0x230131,_0x5d7cad,_0x4c2407){OpenchannelAccountEvents[_0x24a8('0x6')](_0x3f7b72+':'+_0x230131['id'],_0x230131);OpenchannelAccountEvents[_0x24a8('0x6')](_0x3f7b72,_0x230131);_0x4c2407(null);};}for(var e in events){if(events[_0x24a8('0x7')](e)){var event=events[e];OpenchannelAccount[_0x24a8('0x8')](e,emitEvent(event));}}module[_0x24a8('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 91a4e36..1970c6f 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 _0xcc3b=['bluebird','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','openchannel_accounts','lodash','util','../../config/logger','api','moment'];(function(_0xde2cd2,_0x5f24fd){var _0x1dbc5b=function(_0x54d143){while(--_0x54d143){_0xde2cd2['push'](_0xde2cd2['shift']());}};_0x1dbc5b(++_0x5f24fd);}(_0xcc3b,0x119));var _0xbcc3=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xcc3b[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xbcc3('0x0'));var util=require(_0xbcc3('0x1'));var logger=require(_0xbcc3('0x2'))(_0xbcc3('0x3'));var moment=require(_0xbcc3('0x4'));var BPromise=require(_0xbcc3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcc3('0x6'));var rimraf=require(_0xbcc3('0x7'));var config=require(_0xbcc3('0x8'));var attributes=require(_0xbcc3('0x9'));module[_0xbcc3('0xa')]=function(_0x4e6c92,_0x3a1f9d){return _0x4e6c92[_0xbcc3('0xb')]('OpenchannelAccount',attributes,{'tableName':_0xbcc3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f37=['lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','openchannel_accounts'];(function(_0x7eb583,_0x48d77c){var _0x57c962=function(_0x155035){while(--_0x155035){_0x7eb583['push'](_0x7eb583['shift']());}};_0x57c962(++_0x48d77c);}(_0x8f37,0x190));var _0x78f3=function(_0x2a66ce,_0xaba482){_0x2a66ce=_0x2a66ce-0x0;var _0x5d526c=_0x8f37[_0x2a66ce];return _0x5d526c;};'use strict';var _=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var logger=require(_0x78f3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x78f3('0x3'));var rp=require(_0x78f3('0x4'));var fs=require('fs');var path=require(_0x78f3('0x5'));var rimraf=require('rimraf');var config=require(_0x78f3('0x6'));var attributes=require('./openchannelAccount.attributes');module[_0x78f3('0x7')]=function(_0x597b85,_0x11c6ad){return _0x597b85[_0x78f3('0x8')]('OpenchannelAccount',attributes,{'tableName':_0x78f3('0x9'),'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 3748f39..13a44f1 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 _0x1269=['OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','localhost','socket.io-emitter','register','request','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x22bff1,_0x1d964a){var _0x279396=function(_0x2573c7){while(--_0x2573c7){_0x22bff1['push'](_0x22bff1['shift']());}};_0x279396(++_0x1d964a);}(_0x1269,0x12c));var _0x9126=function(_0x587845,_0x3115b9){_0x587845=_0x587845-0x0;var _0x1c2292=_0x1269[_0x587845];return _0x1c2292;};'use strict';var _=require(_0x9126('0x0'));var util=require(_0x9126('0x1'));var moment=require('moment');var BPromise=require(_0x9126('0x2'));var rs=require(_0x9126('0x3'));var fs=require('fs');var Redis=require(_0x9126('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9126('0x5'));var logger=require('../../config/logger')(_0x9126('0x6'));var config=require('../../config/environment');var jayson=require(_0x9126('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9126('0x8')],{'host':_0x9126('0x9'),'port':0x18eb});var socket=require(_0x9126('0xa'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x9126('0xb')](socket);function respondWithRpcPromise(_0x2ae18d,_0x10be28,_0x3f5ea4){return new BPromise(function(_0x1d3d01,_0x3f931e){return client[_0x9126('0xc')](_0x2ae18d,_0x3f5ea4)['then'](function(_0x1ed217){logger[_0x9126('0xd')](_0x9126('0xe'),_0x10be28,'request\x20sent');logger['debug'](_0x9126('0xf'),_0x10be28,'request\x20sent',JSON[_0x9126('0x10')](_0x1ed217));if(_0x1ed217[_0x9126('0x11')]){if(_0x1ed217[_0x9126('0x11')]['code']===0x1f4){logger[_0x9126('0x11')](_0x9126('0xe'),_0x10be28,_0x1ed217['error'][_0x9126('0x12')]);return _0x3f931e(_0x1ed217[_0x9126('0x11')][_0x9126('0x12')]);}logger[_0x9126('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x10be28,_0x1ed217[_0x9126('0x11')][_0x9126('0x12')]);return _0x1d3d01(_0x1ed217[_0x9126('0x11')][_0x9126('0x12')]);}else{logger[_0x9126('0xd')](_0x9126('0xe'),_0x10be28,_0x9126('0x13'));_0x1d3d01(_0x1ed217['result'][_0x9126('0x12')]);}})[_0x9126('0x14')](function(_0x52eb4d){logger['error'](_0x9126('0xe'),_0x10be28,_0x52eb4d);_0x3f931e(_0x52eb4d);});});} \ No newline at end of file +var _0x7e63=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','error','message','info','request\x20sent','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7e63,0x1f0));var _0x37e6=function(_0x5d205e,_0x59e450){_0x5d205e=_0x5d205e-0x0;var _0x3d0285=_0x7e63[_0x5d205e];return _0x3d0285;};'use strict';var _=require(_0x37e6('0x0'));var util=require(_0x37e6('0x1'));var moment=require('moment');var BPromise=require(_0x37e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37e6('0x3'))['db'];var utils=require(_0x37e6('0x4'));var logger=require('../../config/logger')(_0x37e6('0x5'));var config=require(_0x37e6('0x6'));var jayson=require(_0x37e6('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x37e6('0x8')]=_[_0x37e6('0x9')](config[_0x37e6('0x8')],{'host':_0x37e6('0xa'),'port':0x18eb});var socket=require(_0x37e6('0xb'))(new Redis(config[_0x37e6('0x8')]));require(_0x37e6('0xc'))[_0x37e6('0xd')](socket);function respondWithRpcPromise(_0x39e3c4,_0x30b585,_0x1180a0){return new BPromise(function(_0x4eaa16,_0xc02d15){return client[_0x37e6('0xe')](_0x39e3c4,_0x1180a0)[_0x37e6('0xf')](function(_0x4d0110){logger['info'](_0x37e6('0x10'),_0x30b585,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x30b585,'request\x20sent',JSON['stringify'](_0x4d0110));if(_0x4d0110[_0x37e6('0x11')]){if(_0x4d0110['error']['code']===0x1f4){logger[_0x37e6('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x30b585,_0x4d0110[_0x37e6('0x11')][_0x37e6('0x12')]);return _0xc02d15(_0x4d0110[_0x37e6('0x11')][_0x37e6('0x12')]);}logger[_0x37e6('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x30b585,_0x4d0110[_0x37e6('0x11')][_0x37e6('0x12')]);return _0x4eaa16(_0x4d0110['error']['message']);}else{logger[_0x37e6('0x13')](_0x37e6('0x10'),_0x30b585,_0x37e6('0x14'));_0x4eaa16(_0x4d0110['result'][_0x37e6('0x12')]);}})[_0x37e6('0x15')](function(_0x2a96a8){logger['error'](_0x37e6('0x10'),_0x30b585,_0x2a96a8);_0xc02d15(_0x2a96a8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index bdd8d8a..22a9bf6 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 _0xac1d=['emit','./openchannelAccount.events','remove','update'];(function(_0x3232cd,_0x202b9b){var _0x3635a4=function(_0x1e9525){while(--_0x1e9525){_0x3232cd['push'](_0x3232cd['shift']());}};_0x3635a4(++_0x202b9b);}(_0xac1d,0x141));var _0xdac1=function(_0x47c5f0,_0x233a94){_0x47c5f0=_0x47c5f0-0x0;var _0x5beba1=_0xac1d[_0x47c5f0];return _0x5beba1;};'use strict';var OpenchannelAccountEvents=require(_0xdac1('0x0'));var events=['save',_0xdac1('0x1'),_0xdac1('0x2')];function createListener(_0x4cdf97,_0x33c1f8){return function(_0x560434){_0x33c1f8[_0xdac1('0x3')](_0x4cdf97,_0x560434);};}function removeListener(_0x4bc3de,_0x1e2080){return function(){OpenchannelAccountEvents['removeListener'](_0x4bc3de,_0x1e2080);};}exports['register']=function(_0xd58e48){for(var _0x3ff821=0x0,_0x1569dc=events['length'];_0x3ff821<_0x1569dc;_0x3ff821++){var _0x6be6fc=events[_0x3ff821];var _0x318446=createListener('openchannelAccount:'+_0x6be6fc,_0xd58e48);OpenchannelAccountEvents['on'](_0x6be6fc,_0x318446);}}; \ No newline at end of file +var _0x78fc=['register','length','openchannelAccount:','save'];(function(_0x44f918,_0x50d9fe){var _0x329284=function(_0x23225e){while(--_0x23225e){_0x44f918['push'](_0x44f918['shift']());}};_0x329284(++_0x50d9fe);}(_0x78fc,0x1bb));var _0xc78f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x78fc[_0x9cd4c3];return _0x4c9025;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xc78f('0x0'),'remove','update'];function createListener(_0x453998,_0x1025ea){return function(_0x575cf2){_0x1025ea['emit'](_0x453998,_0x575cf2);};}function removeListener(_0x56e6ad,_0x9db9cd){return function(){OpenchannelAccountEvents['removeListener'](_0x56e6ad,_0x9db9cd);};}exports[_0xc78f('0x1')]=function(_0x59f6ec){for(var _0xae017c=0x0,_0x50f57c=events[_0xc78f('0x2')];_0xae017c<_0x50f57c;_0xae017c++){var _0x1af376=events[_0xae017c];var _0x93aeb3=createListener(_0xc78f('0x3')+_0x1af376,_0x59f6ec);OpenchannelAccountEvents['on'](_0x1af376,_0x93aeb3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index be2223c..fdc0444 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 _0x14b2=['./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x47f028,_0x2ebddc){var _0x4cd711=function(_0x1a76d4){while(--_0x1a76d4){_0x47f028['push'](_0x47f028['shift']());}};_0x4cd711(++_0x2ebddc);}(_0x14b2,0xc7));var _0x214b=function(_0x2e7eaa,_0x3f1067){_0x2e7eaa=_0x2e7eaa-0x0;var _0x12763a=_0x14b2[_0x2e7eaa];return _0x12763a;};'use strict';var multer=require('multer');var util=require(_0x214b('0x0'));var path=require(_0x214b('0x1'));var timeout=require(_0x214b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x214b('0x3'));var interaction=require(_0x214b('0x4'));var config=require('../../config/environment');var controller=require(_0x214b('0x5'));router[_0x214b('0x6')]('/',auth['isAuthenticated'](),controller[_0x214b('0x7')]);router[_0x214b('0x6')](_0x214b('0x8'),auth[_0x214b('0x9')](),controller[_0x214b('0xa')]);router['post']('/',auth[_0x214b('0x9')](),controller[_0x214b('0xb')]);router[_0x214b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x214b('0xd')]);router[_0x214b('0xe')](_0x214b('0x8'),auth[_0x214b('0x9')](),controller[_0x214b('0xf')]);module[_0x214b('0x10')]=router; \ No newline at end of file +var _0xc2cd=['create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1ce52f,_0x31b031){var _0x15a9a8=function(_0x2ee486){while(--_0x2ee486){_0x1ce52f['push'](_0x1ce52f['shift']());}};_0x15a9a8(++_0x31b031);}(_0xc2cd,0x16e));var _0xdc2c=function(_0x208220,_0x249394){_0x208220=_0x208220-0x0;var _0x40dfb3=_0xc2cd[_0x208220];return _0x40dfb3;};'use strict';var multer=require(_0xdc2c('0x0'));var util=require(_0xdc2c('0x1'));var path=require('path');var timeout=require(_0xdc2c('0x2'));var express=require(_0xdc2c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdc2c('0x4'));var interaction=require(_0xdc2c('0x5'));var config=require(_0xdc2c('0x6'));var controller=require(_0xdc2c('0x7'));router[_0xdc2c('0x8')]('/',auth[_0xdc2c('0x9')](),controller[_0xdc2c('0xa')]);router[_0xdc2c('0x8')](_0xdc2c('0xb'),auth['isAuthenticated'](),controller[_0xdc2c('0xc')]);router[_0xdc2c('0xd')]('/',auth[_0xdc2c('0x9')](),controller[_0xdc2c('0xe')]);router[_0xdc2c('0xf')](_0xdc2c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xdc2c('0x10')](_0xdc2c('0xb'),auth[_0xdc2c('0x9')](),controller[_0xdc2c('0x11')]);module[_0xdc2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index aaa673f..9b7bf78 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 _0x9f7a=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x105bc6,_0x8598c0){var _0x350778=function(_0x405509){while(--_0x405509){_0x105bc6['push'](_0x105bc6['shift']());}};_0x350778(++_0x8598c0);}(_0x9f7a,0xa9));var _0xa9f7=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x9f7a[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require('sequelize');module[_0xa9f7('0x0')]={'priority':{'type':Sequelize[_0xa9f7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa9f7('0x2')],'allowNull':![],'defaultValue':_0xa9f7('0x3')},'appdata':{'type':Sequelize[_0xa9f7('0x4')]()},'description':{'type':Sequelize[_0xa9f7('0x2')]},'interval':{'type':Sequelize[_0xa9f7('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6c2b=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x6c2b,0x6c));var _0xb6c2=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x6c2b[_0x3c81b5];return _0x5888c4;};'use strict';var Sequelize=require(_0xb6c2('0x0'));module[_0xb6c2('0x1')]={'priority':{'type':Sequelize[_0xb6c2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb6c2('0x3')],'allowNull':![],'defaultValue':_0xb6c2('0x4')},'appdata':{'type':Sequelize[_0xb6c2('0x5')]()},'description':{'type':Sequelize[_0xb6c2('0x3')]},'interval':{'type':Sequelize[_0xb6c2('0x3')],'defaultValue':_0xb6c2('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index c77aee3..222f7cd 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 _0xbfa6=['key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','OpenchannelApplication','rawAttributes','type'];(function(_0x147bb0,_0x5b749f){var _0x414be2=function(_0x394d61){while(--_0x394d61){_0x147bb0['push'](_0x147bb0['shift']());}};_0x414be2(++_0x5b749f);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0xbfa6[_0x2d48fa];return _0x4645b7;};'use strict';var pdf=require(_0x6bfa('0x0'));var emlformat=require(_0x6bfa('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bfa('0x2'));var moment=require(_0x6bfa('0x3'));var BPromise=require(_0x6bfa('0x4'));var Mustache=require('mustache');var util=require(_0x6bfa('0x5'));var path=require(_0x6bfa('0x6'));var sox=require(_0x6bfa('0x7'));var csv=require(_0x6bfa('0x8'));var ejs=require(_0x6bfa('0x9'));var fs=require('fs');var fs_extra=require(_0x6bfa('0xa'));var _=require(_0x6bfa('0xb'));var squel=require('squel');var crypto=require(_0x6bfa('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6bfa('0xd'));var toCsv=require(_0x6bfa('0x8'));var querystring=require(_0x6bfa('0xe'));var Papa=require(_0x6bfa('0xf'));var Redis=require(_0x6bfa('0x10'));var authService=require(_0x6bfa('0x11'));var qs=require(_0x6bfa('0x12'));var as=require(_0x6bfa('0x13'));var hardwareService=require(_0x6bfa('0x14'));var logger=require(_0x6bfa('0x15'))('api');var utils=require(_0x6bfa('0x16'));var config=require(_0x6bfa('0x17'));var licenseUtil=require(_0x6bfa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39cc55,_0x1a4c63){_0x1a4c63=_0x1a4c63||0xcc;return function(_0x2fb3e6){if(_0x2fb3e6){return _0x39cc55[_0x6bfa('0x19')](_0x1a4c63);}return _0x39cc55[_0x6bfa('0x1a')](_0x1a4c63)['end']();};}function respondWithResult(_0x33a3fc,_0x581c13){_0x581c13=_0x581c13||0xc8;return function(_0x1385b8){if(_0x1385b8){return _0x33a3fc[_0x6bfa('0x1a')](_0x581c13)[_0x6bfa('0x1b')](_0x1385b8);}};}function respondWithFilteredResult(_0x305210,_0x2c4944){return function(_0x2a11ac){if(_0x2a11ac){var _0x331351=_0x2a11ac[_0x6bfa('0x1c')],_0x1c82da=_0x2c4944['offset'],_0x118f06=_0x2c4944[_0x6bfa('0x1d')]+_0x2c4944[_0x6bfa('0x1e')],_0x5e8b88;if(_0x118f06>=_0x331351){_0x118f06=_0x331351;_0x5e8b88=0xc8;}else{_0x5e8b88=0xce;}_0x305210[_0x6bfa('0x1a')](_0x5e8b88);return _0x305210[_0x6bfa('0x1f')]('Content-Range',_0x1c82da+'-'+_0x118f06+'/'+_0x331351)['json'](_0x2a11ac);}return null;};}function patchUpdates(_0x569f86){return function(_0x5a0657){try{jsonpatch[_0x6bfa('0x20')](_0x5a0657,_0x569f86,!![]);}catch(_0x5f27b6){return BPromise[_0x6bfa('0x21')](_0x5f27b6);}return _0x5a0657[_0x6bfa('0x22')]();};}function saveUpdates(_0x26f925,_0x1745bf){return function(_0x237712){if(_0x237712){return _0x237712[_0x6bfa('0x23')](_0x26f925)[_0x6bfa('0x24')](function(_0x241318){return _0x241318;});}return null;};}function removeEntity(_0x35a6ad,_0x3e71b8){return function(_0x3728fa){if(_0x3728fa){return _0x3728fa[_0x6bfa('0x25')]()[_0x6bfa('0x24')](function(){_0x35a6ad[_0x6bfa('0x1a')](0xcc)[_0x6bfa('0x26')]();});}};}function handleEntityNotFound(_0x2903cc,_0x4db75d){return function(_0x41345d){if(!_0x41345d){_0x2903cc[_0x6bfa('0x19')](0x194);}return _0x41345d;};}function handleError(_0x596ae9,_0x2c388b){_0x2c388b=_0x2c388b||0x1f4;return function(_0x1e5507){logger[_0x6bfa('0x27')](_0x1e5507[_0x6bfa('0x28')]);if(_0x1e5507[_0x6bfa('0x29')]){delete _0x1e5507[_0x6bfa('0x29')];}_0x596ae9['status'](_0x2c388b)['send'](_0x1e5507);};}exports[_0x6bfa('0x2a')]=function(_0x3d4d2b,_0xcf2b43){var _0x2b0171={},_0x4291e6={},_0xca2028={'count':0x0,'rows':[]};var _0x40f66c=_[_0x6bfa('0x2b')](db[_0x6bfa('0x2c')][_0x6bfa('0x2d')],function(_0x2a550b){return{'name':_0x2a550b['fieldName'],'type':_0x2a550b[_0x6bfa('0x2e')][_0x6bfa('0x2f')]};});_0x4291e6['model']=_[_0x6bfa('0x2b')](_0x40f66c,'name');_0x4291e6[_0x6bfa('0x30')]=_[_0x6bfa('0x31')](_0x3d4d2b[_0x6bfa('0x30')]);_0x4291e6[_0x6bfa('0x32')]=_[_0x6bfa('0x33')](_0x4291e6[_0x6bfa('0x34')],_0x4291e6['query']);_0x2b0171[_0x6bfa('0x35')]=_[_0x6bfa('0x33')](_0x4291e6[_0x6bfa('0x34')],qs[_0x6bfa('0x36')](_0x3d4d2b[_0x6bfa('0x30')][_0x6bfa('0x36')]));_0x2b0171[_0x6bfa('0x35')]=_0x2b0171[_0x6bfa('0x35')][_0x6bfa('0x37')]?_0x2b0171['attributes']:_0x4291e6[_0x6bfa('0x34')];if(!_0x3d4d2b[_0x6bfa('0x30')]['hasOwnProperty'](_0x6bfa('0x38'))){_0x2b0171['limit']=qs[_0x6bfa('0x1e')](_0x3d4d2b[_0x6bfa('0x30')][_0x6bfa('0x1e')]);_0x2b0171['offset']=qs[_0x6bfa('0x1d')](_0x3d4d2b[_0x6bfa('0x30')][_0x6bfa('0x1d')]);}_0x2b0171[_0x6bfa('0x39')]=qs['sort'](_0x3d4d2b[_0x6bfa('0x30')][_0x6bfa('0x3a')]);_0x2b0171[_0x6bfa('0x3b')]=qs[_0x6bfa('0x32')](_[_0x6bfa('0x3c')](_0x3d4d2b[_0x6bfa('0x30')],_0x4291e6['filters']),_0x40f66c);if(_0x3d4d2b[_0x6bfa('0x30')][_0x6bfa('0x3d')]){_0x2b0171[_0x6bfa('0x3b')]=_[_0x6bfa('0x3e')](_0x2b0171[_0x6bfa('0x3b')],{'$or':_[_0x6bfa('0x2b')](_0x40f66c,function(_0x235b45){if(_0x235b45['type']!=='VIRTUAL'){var _0x496295={};_0x496295[_0x235b45[_0x6bfa('0x29')]]={'$like':'%'+_0x3d4d2b['query'][_0x6bfa('0x3d')]+'%'};return _0x496295;}})});}_0x2b0171=_[_0x6bfa('0x3e')]({},_0x2b0171,_0x3d4d2b[_0x6bfa('0x3f')]);var _0x4a72a9={'where':_0x2b0171[_0x6bfa('0x3b')]};return db[_0x6bfa('0x2c')][_0x6bfa('0x1c')](_0x4a72a9)['then'](function(_0x232e60){_0xca2028[_0x6bfa('0x1c')]=_0x232e60;if(_0x3d4d2b[_0x6bfa('0x30')][_0x6bfa('0x40')]){_0x2b0171[_0x6bfa('0x41')]=[{'all':!![]}];}return db[_0x6bfa('0x2c')][_0x6bfa('0x42')](_0x2b0171);})[_0x6bfa('0x24')](function(_0x192acc){_0xca2028['rows']=_0x192acc;return _0xca2028;})[_0x6bfa('0x24')](respondWithFilteredResult(_0xcf2b43,_0x2b0171))[_0x6bfa('0x43')](handleError(_0xcf2b43,null));};exports[_0x6bfa('0x44')]=function(_0x25b71d,_0x58bc58){var _0x1fa551={'raw':!![],'where':{'id':_0x25b71d['params']['id']}},_0x3def7e={};_0x3def7e[_0x6bfa('0x34')]=_['keys'](db[_0x6bfa('0x2c')]['rawAttributes']);_0x3def7e[_0x6bfa('0x30')]=_['keys'](_0x25b71d[_0x6bfa('0x30')]);_0x3def7e[_0x6bfa('0x32')]=_[_0x6bfa('0x33')](_0x3def7e['model'],_0x3def7e[_0x6bfa('0x30')]);_0x1fa551['attributes']=_[_0x6bfa('0x33')](_0x3def7e[_0x6bfa('0x34')],qs['fields'](_0x25b71d[_0x6bfa('0x30')]['fields']));_0x1fa551[_0x6bfa('0x35')]=_0x1fa551[_0x6bfa('0x35')][_0x6bfa('0x37')]?_0x1fa551[_0x6bfa('0x35')]:_0x3def7e[_0x6bfa('0x34')];if(_0x25b71d[_0x6bfa('0x30')][_0x6bfa('0x40')]){_0x1fa551[_0x6bfa('0x41')]=[{'all':!![]}];}_0x1fa551=_[_0x6bfa('0x3e')]({},_0x1fa551,_0x25b71d[_0x6bfa('0x3f')]);return db[_0x6bfa('0x2c')][_0x6bfa('0x45')](_0x1fa551)['then'](handleEntityNotFound(_0x58bc58,null))['then'](respondWithResult(_0x58bc58,null))['catch'](handleError(_0x58bc58,null));};exports[_0x6bfa('0x46')]=function(_0x246c94,_0x335a81){return db['OpenchannelApplication'][_0x6bfa('0x46')](_0x246c94[_0x6bfa('0x47')],{})[_0x6bfa('0x24')](respondWithResult(_0x335a81,0xc9))['catch'](handleError(_0x335a81,null));};exports[_0x6bfa('0x23')]=function(_0x39c81e,_0x5529aa){if(_0x39c81e['body']['id']){delete _0x39c81e[_0x6bfa('0x47')]['id'];}return db[_0x6bfa('0x2c')][_0x6bfa('0x45')]({'where':{'id':_0x39c81e[_0x6bfa('0x48')]['id']}})[_0x6bfa('0x24')](handleEntityNotFound(_0x5529aa,null))[_0x6bfa('0x24')](saveUpdates(_0x39c81e[_0x6bfa('0x47')],null))[_0x6bfa('0x24')](respondWithResult(_0x5529aa,null))[_0x6bfa('0x43')](handleError(_0x5529aa,null));};exports[_0x6bfa('0x25')]=function(_0xcd961d,_0x234f7e){return db[_0x6bfa('0x2c')][_0x6bfa('0x45')]({'where':{'id':_0xcd961d[_0x6bfa('0x48')]['id']}})[_0x6bfa('0x24')](handleEntityNotFound(_0x234f7e,null))[_0x6bfa('0x24')](removeEntity(_0x234f7e,null))[_0x6bfa('0x43')](handleError(_0x234f7e,null));}; \ No newline at end of file +var _0x0627=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','model','query','filters','intersection','fields'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x0627,0x1d8));var _0x7062=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0627[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0x7062('0x0'));var emlformat=require(_0x7062('0x1'));var rimraf=require(_0x7062('0x2'));var zipdir=require(_0x7062('0x3'));var jsonpatch=require(_0x7062('0x4'));var rp=require(_0x7062('0x5'));var moment=require(_0x7062('0x6'));var BPromise=require(_0x7062('0x7'));var Mustache=require(_0x7062('0x8'));var util=require(_0x7062('0x9'));var path=require(_0x7062('0xa'));var sox=require('sox');var csv=require(_0x7062('0xb'));var ejs=require(_0x7062('0xc'));var fs=require('fs');var fs_extra=require(_0x7062('0xd'));var _=require(_0x7062('0xe'));var squel=require(_0x7062('0xf'));var crypto=require('crypto');var jsforce=require(_0x7062('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7062('0xb'));var querystring=require(_0x7062('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7062('0x12'));var qs=require(_0x7062('0x13'));var as=require(_0x7062('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7062('0x15'))(_0x7062('0x16'));var utils=require(_0x7062('0x17'));var config=require(_0x7062('0x18'));var licenseUtil=require(_0x7062('0x19'));var db=require(_0x7062('0x1a'))['db'];function respondWithStatusCode(_0x2dcc41,_0x2ba2ef){_0x2ba2ef=_0x2ba2ef||0xcc;return function(_0x2c56bc){if(_0x2c56bc){return _0x2dcc41[_0x7062('0x1b')](_0x2ba2ef);}return _0x2dcc41['status'](_0x2ba2ef)[_0x7062('0x1c')]();};}function respondWithResult(_0x4d19e5,_0x58caa4){_0x58caa4=_0x58caa4||0xc8;return function(_0x1e90e6){if(_0x1e90e6){return _0x4d19e5['status'](_0x58caa4)[_0x7062('0x1d')](_0x1e90e6);}};}function respondWithFilteredResult(_0x1a9f63,_0x340df3){return function(_0x4d113c){if(_0x4d113c){var _0x313588=_0x4d113c[_0x7062('0x1e')],_0x43ab68=_0x340df3['offset'],_0x57a136=_0x340df3[_0x7062('0x1f')]+_0x340df3[_0x7062('0x20')],_0x23f7c0;if(_0x57a136>=_0x313588){_0x57a136=_0x313588;_0x23f7c0=0xc8;}else{_0x23f7c0=0xce;}_0x1a9f63[_0x7062('0x21')](_0x23f7c0);return _0x1a9f63[_0x7062('0x22')](_0x7062('0x23'),_0x43ab68+'-'+_0x57a136+'/'+_0x313588)[_0x7062('0x1d')](_0x4d113c);}return null;};}function patchUpdates(_0xbaa8d8){return function(_0x206eb0){try{jsonpatch['apply'](_0x206eb0,_0xbaa8d8,!![]);}catch(_0x427d02){return BPromise[_0x7062('0x24')](_0x427d02);}return _0x206eb0[_0x7062('0x25')]();};}function saveUpdates(_0x5931df,_0x45b0de){return function(_0x48b6bd){if(_0x48b6bd){return _0x48b6bd[_0x7062('0x26')](_0x5931df)[_0x7062('0x27')](function(_0x5b4ddc){return _0x5b4ddc;});}return null;};}function removeEntity(_0x271105,_0x31a0ca){return function(_0x404b95){if(_0x404b95){return _0x404b95['destroy']()[_0x7062('0x27')](function(){_0x271105[_0x7062('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1afd78,_0x5cdfec){return function(_0x30ceaf){if(!_0x30ceaf){_0x1afd78['sendStatus'](0x194);}return _0x30ceaf;};}function handleError(_0x38976d,_0x45efaa){_0x45efaa=_0x45efaa||0x1f4;return function(_0x54ff49){logger[_0x7062('0x28')](_0x54ff49[_0x7062('0x29')]);if(_0x54ff49[_0x7062('0x2a')]){delete _0x54ff49[_0x7062('0x2a')];}_0x38976d[_0x7062('0x21')](_0x45efaa)[_0x7062('0x2b')](_0x54ff49);};}exports['index']=function(_0x591cd9,_0x3a9181){var _0x4e5233={},_0xd0a9de={},_0x5b075e={'count':0x0,'rows':[]};var _0x2e7ff2=_[_0x7062('0x2c')](db[_0x7062('0x2d')][_0x7062('0x2e')],function(_0x3c5a77){return{'name':_0x3c5a77[_0x7062('0x2f')],'type':_0x3c5a77['type']['key']};});_0xd0a9de[_0x7062('0x30')]=_[_0x7062('0x2c')](_0x2e7ff2,_0x7062('0x2a'));_0xd0a9de['query']=_['keys'](_0x591cd9[_0x7062('0x31')]);_0xd0a9de[_0x7062('0x32')]=_[_0x7062('0x33')](_0xd0a9de[_0x7062('0x30')],_0xd0a9de[_0x7062('0x31')]);_0x4e5233['attributes']=_[_0x7062('0x33')](_0xd0a9de[_0x7062('0x30')],qs['fields'](_0x591cd9[_0x7062('0x31')][_0x7062('0x34')]));_0x4e5233[_0x7062('0x35')]=_0x4e5233[_0x7062('0x35')][_0x7062('0x36')]?_0x4e5233[_0x7062('0x35')]:_0xd0a9de[_0x7062('0x30')];if(!_0x591cd9[_0x7062('0x31')][_0x7062('0x37')](_0x7062('0x38'))){_0x4e5233[_0x7062('0x20')]=qs['limit'](_0x591cd9[_0x7062('0x31')][_0x7062('0x20')]);_0x4e5233[_0x7062('0x1f')]=qs[_0x7062('0x1f')](_0x591cd9[_0x7062('0x31')][_0x7062('0x1f')]);}_0x4e5233[_0x7062('0x39')]=qs[_0x7062('0x3a')](_0x591cd9[_0x7062('0x31')]['sort']);_0x4e5233[_0x7062('0x3b')]=qs[_0x7062('0x32')](_[_0x7062('0x3c')](_0x591cd9[_0x7062('0x31')],_0xd0a9de[_0x7062('0x32')]),_0x2e7ff2);if(_0x591cd9['query'][_0x7062('0x3d')]){_0x4e5233[_0x7062('0x3b')]=_[_0x7062('0x3e')](_0x4e5233[_0x7062('0x3b')],{'$or':_[_0x7062('0x2c')](_0x2e7ff2,function(_0x4783e3){if(_0x4783e3[_0x7062('0x3f')]!==_0x7062('0x40')){var _0x10b636={};_0x10b636[_0x4783e3[_0x7062('0x2a')]]={'$like':'%'+_0x591cd9[_0x7062('0x31')][_0x7062('0x3d')]+'%'};return _0x10b636;}})});}_0x4e5233=_[_0x7062('0x3e')]({},_0x4e5233,_0x591cd9[_0x7062('0x41')]);var _0x3307f9={'where':_0x4e5233[_0x7062('0x3b')]};return db['OpenchannelApplication'][_0x7062('0x1e')](_0x3307f9)[_0x7062('0x27')](function(_0x1e5387){_0x5b075e['count']=_0x1e5387;if(_0x591cd9['query']['includeAll']){_0x4e5233[_0x7062('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x7062('0x43')](_0x4e5233);})['then'](function(_0x210d8d){_0x5b075e[_0x7062('0x44')]=_0x210d8d;return _0x5b075e;})[_0x7062('0x27')](respondWithFilteredResult(_0x3a9181,_0x4e5233))[_0x7062('0x45')](handleError(_0x3a9181,null));};exports[_0x7062('0x46')]=function(_0x5235e2,_0x3ddaeb){var _0x381e54={'raw':!![],'where':{'id':_0x5235e2['params']['id']}},_0x2f68c5={};_0x2f68c5[_0x7062('0x30')]=_['keys'](db['OpenchannelApplication'][_0x7062('0x2e')]);_0x2f68c5[_0x7062('0x31')]=_['keys'](_0x5235e2[_0x7062('0x31')]);_0x2f68c5[_0x7062('0x32')]=_['intersection'](_0x2f68c5[_0x7062('0x30')],_0x2f68c5['query']);_0x381e54['attributes']=_[_0x7062('0x33')](_0x2f68c5['model'],qs[_0x7062('0x34')](_0x5235e2[_0x7062('0x31')][_0x7062('0x34')]));_0x381e54['attributes']=_0x381e54['attributes'][_0x7062('0x36')]?_0x381e54[_0x7062('0x35')]:_0x2f68c5['model'];if(_0x5235e2[_0x7062('0x31')]['includeAll']){_0x381e54['include']=[{'all':!![]}];}_0x381e54=_[_0x7062('0x3e')]({},_0x381e54,_0x5235e2[_0x7062('0x41')]);return db[_0x7062('0x2d')][_0x7062('0x47')](_0x381e54)['then'](handleEntityNotFound(_0x3ddaeb,null))[_0x7062('0x27')](respondWithResult(_0x3ddaeb,null))[_0x7062('0x45')](handleError(_0x3ddaeb,null));};exports[_0x7062('0x48')]=function(_0x5a1625,_0x379238){return db[_0x7062('0x2d')][_0x7062('0x48')](_0x5a1625[_0x7062('0x49')],{})[_0x7062('0x27')](respondWithResult(_0x379238,0xc9))[_0x7062('0x45')](handleError(_0x379238,null));};exports[_0x7062('0x26')]=function(_0x3011e2,_0x535eab){if(_0x3011e2[_0x7062('0x49')]['id']){delete _0x3011e2['body']['id'];}return db['OpenchannelApplication'][_0x7062('0x47')]({'where':{'id':_0x3011e2[_0x7062('0x4a')]['id']}})[_0x7062('0x27')](handleEntityNotFound(_0x535eab,null))[_0x7062('0x27')](saveUpdates(_0x3011e2['body'],null))['then'](respondWithResult(_0x535eab,null))[_0x7062('0x45')](handleError(_0x535eab,null));};exports['destroy']=function(_0x451d0e,_0x10a64c){return db[_0x7062('0x2d')][_0x7062('0x47')]({'where':{'id':_0x451d0e[_0x7062('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10a64c,null))[_0x7062('0x27')](removeEntity(_0x10a64c,null))[_0x7062('0x45')](handleError(_0x10a64c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 008613a..d5a970e 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 _0x06d7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x06d7,0x165));var _0x706d=function(_0x687128,_0x296746){_0x687128=_0x687128-0x0;var _0x3f1848=_0x06d7[_0x687128];return _0x3f1848;};'use strict';var _=require(_0x706d('0x0'));var util=require('util');var logger=require(_0x706d('0x1'))(_0x706d('0x2'));var moment=require(_0x706d('0x3'));var BPromise=require(_0x706d('0x4'));var rp=require(_0x706d('0x5'));var fs=require('fs');var path=require(_0x706d('0x6'));var rimraf=require(_0x706d('0x7'));var config=require(_0x706d('0x8'));var attributes=require(_0x706d('0x9'));module['exports']=function(_0x376d39,_0x35e47f){return _0x376d39[_0x706d('0xa')](_0x706d('0xb'),attributes,{'tableName':_0x706d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x706d('0xd'),'collate':_0x706d('0xe')});}; \ No newline at end of file +var _0xc75d=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xc75d,0x70));var _0xdc75=function(_0x317bfb,_0x23497d){_0x317bfb=_0x317bfb-0x0;var _0x528636=_0xc75d[_0x317bfb];return _0x528636;};'use strict';var _=require(_0xdc75('0x0'));var util=require(_0xdc75('0x1'));var logger=require(_0xdc75('0x2'))('api');var moment=require(_0xdc75('0x3'));var BPromise=require(_0xdc75('0x4'));var rp=require(_0xdc75('0x5'));var fs=require('fs');var path=require(_0xdc75('0x6'));var rimraf=require(_0xdc75('0x7'));var config=require(_0xdc75('0x8'));var attributes=require(_0xdc75('0x9'));module[_0xdc75('0xa')]=function(_0x9eaffc,_0x24f1a0){return _0x9eaffc[_0xdc75('0xb')](_0xdc75('0xc'),attributes,{'tableName':_0xdc75('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdc75('0xe'),'collate':_0xdc75('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b0c2bcb..7c28d07 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x5c4444,_0x119726){var _0x20d93d=function(_0x326a33){while(--_0x326a33){_0x5c4444['push'](_0x5c4444['shift']());}};_0x20d93d(++_0x119726);}(_0x5f2f,0x73));var _0xf5f2=function(_0x118ee2,_0x5c7c23){_0x118ee2=_0x118ee2-0x0;var _0x141253=_0x5f2f[_0x118ee2];return _0x141253;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9b73fd1..aa1b707 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 _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 36ae366..4caf446 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 _0x64c2=['ENUM','sequelize','BOOLEAN','DATE','STRING'];(function(_0x311bfe,_0x2a5794){var _0x2b59a2=function(_0x21d508){while(--_0x21d508){_0x311bfe['push'](_0x311bfe['shift']());}};_0x2b59a2(++_0x2a5794);}(_0x64c2,0x178));var _0x264c=function(_0x1ff274,_0x10e914){_0x1ff274=_0x1ff274-0x0;var _0x289f33=_0x64c2[_0x1ff274];return _0x289f33;};'use strict';var Sequelize=require(_0x264c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x264c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x264c('0x2')]},'disposition':{'type':Sequelize[_0x264c('0x3')]},'secondDisposition':{'type':Sequelize[_0x264c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x264c('0x3')]},'note':{'type':Sequelize[_0x264c('0x3')]},'read1stAt':{'type':Sequelize[_0x264c('0x2')]},'threadId':{'type':Sequelize[_0x264c('0x3')]},'externalUrl':{'type':Sequelize[_0x264c('0x3')]},'lastMsgAt':{'type':Sequelize[_0x264c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x264c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2750=['sequelize','BOOLEAN','DATE','STRING','out'];(function(_0x3c0edc,_0x4ba422){var _0x1fa59d=function(_0x5aadf6){while(--_0x5aadf6){_0x3c0edc['push'](_0x3c0edc['shift']());}};_0x1fa59d(++_0x4ba422);}(_0x2750,0x13b));var _0x0275=function(_0x57629d,_0x169e21){_0x57629d=_0x57629d-0x0;var _0x2b794f=_0x2750[_0x57629d];return _0x2b794f;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'closed':{'type':Sequelize[_0x0275('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0275('0x2')]},'disposition':{'type':Sequelize[_0x0275('0x3')]},'secondDisposition':{'type':Sequelize[_0x0275('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0275('0x3')]},'note':{'type':Sequelize[_0x0275('0x3')]},'read1stAt':{'type':Sequelize[_0x0275('0x2')]},'threadId':{'type':Sequelize[_0x0275('0x3')]},'externalUrl':{'type':Sequelize[_0x0275('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0275('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0275('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0275('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 56ea27c..afdd8db 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 _0xc8e9=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','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?','find','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','agent','toString','sequelize','keyBy','merge','unreadMessages','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','all','rows','catch','show','params','includeAll','include','options','create','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','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','%s\x20#%d','YYYY-MM-DD','Openchannel','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','out','System','renderFile','server','views','toFile','transcript-','.pdf','download','log','err','unlinkSync','sendStatus','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','OpenchannelInteraction','rawAttributes','fieldName','type'];(function(_0x3d823b,_0x245c0d){var _0x1c23cd=function(_0x179b18){while(--_0x179b18){_0x3d823b['push'](_0x3d823b['shift']());}};_0x1c23cd(++_0x245c0d);}(_0xc8e9,0x1b7));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9c8e('0x0'));var emlformat=require(_0x9c8e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9c8e('0x2'));var rp=require(_0x9c8e('0x3'));var moment=require(_0x9c8e('0x4'));var BPromise=require(_0x9c8e('0x5'));var Mustache=require(_0x9c8e('0x6'));var util=require('util');var path=require(_0x9c8e('0x7'));var sox=require(_0x9c8e('0x8'));var csv=require('to-csv');var ejs=require(_0x9c8e('0x9'));var fs=require('fs');var fs_extra=require(_0x9c8e('0xa'));var _=require('lodash');var squel=require(_0x9c8e('0xb'));var crypto=require(_0x9c8e('0xc'));var jsforce=require(_0x9c8e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9c8e('0xe'));var Papa=require(_0x9c8e('0xf'));var Redis=require('ioredis');var authService=require(_0x9c8e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9c8e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c8e('0x12'))(_0x9c8e('0x13'));var utils=require(_0x9c8e('0x14'));var config=require(_0x9c8e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c8e('0x16'))['db'];config['redis']=_[_0x9c8e('0x17')](config[_0x9c8e('0x18')],{'host':_0x9c8e('0x19'),'port':0x18eb});var socket=require(_0x9c8e('0x1a'))(new Redis(config[_0x9c8e('0x18')]));require(_0x9c8e('0x1b'))[_0x9c8e('0x1c')](socket);function respondWithStatusCode(_0x1f9f26,_0x46f77e){_0x46f77e=_0x46f77e||0xcc;return function(_0x3a53d8){if(_0x3a53d8){return _0x1f9f26['sendStatus'](_0x46f77e);}return _0x1f9f26[_0x9c8e('0x1d')](_0x46f77e)['end']();};}function respondWithResult(_0x2ca0b8,_0x1e3a2f){_0x1e3a2f=_0x1e3a2f||0xc8;return function(_0x589fb1){if(_0x589fb1){return _0x2ca0b8[_0x9c8e('0x1d')](_0x1e3a2f)['json'](_0x589fb1);}};}function respondWithFilteredResult(_0x1a6a9f,_0x49618a){return function(_0x559b6a){if(_0x559b6a){var _0x47cd90=_0x559b6a[_0x9c8e('0x1e')],_0x4465c6=_0x49618a[_0x9c8e('0x1f')],_0x3493f5=_0x49618a[_0x9c8e('0x1f')]+_0x49618a[_0x9c8e('0x20')],_0x658dd3;if(_0x3493f5>=_0x47cd90){_0x3493f5=_0x47cd90;_0x658dd3=0xc8;}else{_0x658dd3=0xce;}_0x1a6a9f[_0x9c8e('0x1d')](_0x658dd3);return _0x1a6a9f[_0x9c8e('0x21')](_0x9c8e('0x22'),_0x4465c6+'-'+_0x3493f5+'/'+_0x47cd90)[_0x9c8e('0x23')](_0x559b6a);}return null;};}function patchUpdates(_0xaf1eac){return function(_0x46c9ee){try{jsonpatch[_0x9c8e('0x24')](_0x46c9ee,_0xaf1eac,!![]);}catch(_0x19ccf6){return BPromise[_0x9c8e('0x25')](_0x19ccf6);}return _0x46c9ee[_0x9c8e('0x26')]();};}function saveUpdates(_0x51cd1c,_0x41b4aa){return function(_0x1773c9){if(_0x1773c9){return _0x1773c9[_0x9c8e('0x27')](_0x51cd1c)[_0x9c8e('0x28')](function(_0x710d4b){return _0x710d4b;});}return null;};}function removeEntity(_0x5bfe84,_0x4e7149){return function(_0x4545fc){if(_0x4545fc){return _0x4545fc['destroy']()[_0x9c8e('0x28')](function(){_0x5bfe84[_0x9c8e('0x1d')](0xcc)[_0x9c8e('0x29')]();});}};}function handleEntityNotFound(_0x5b58a8,_0x4a7e6a){return function(_0x58bbbd){if(!_0x58bbbd){_0x5b58a8['sendStatus'](0x194);}return _0x58bbbd;};}function handleError(_0xc03cb4,_0x35dbaf){_0x35dbaf=_0x35dbaf||0x1f4;return function(_0x5b476b){logger[_0x9c8e('0x2a')](_0x5b476b[_0x9c8e('0x2b')]);if(_0x5b476b[_0x9c8e('0x2c')]){delete _0x5b476b[_0x9c8e('0x2c')];}_0xc03cb4[_0x9c8e('0x1d')](_0x35dbaf)[_0x9c8e('0x2d')](_0x5b476b);};}function getInteractionUsers(_0x51e258,_0x391005){return new BPromise(function(_0x4a7d18,_0x25261a){try{if(_0x391005[_0x51e258['id']]){_0x51e258[_0x9c8e('0x2e')]=_[_0x9c8e('0x2f')](_0x391005[_0x51e258['id']],function(_0x35194f){return{'id':_0x35194f['id'],'fullname':_0x35194f[_0x9c8e('0x30')]};});}}catch(_0x516351){_0x25261a(_0x516351);}_0x4a7d18(_0x51e258);});}function getInteractionTags(_0x441e7c,_0x44be09){return new BPromise(function(_0x3dc302,_0x14906e){try{if(_0x441e7c[_0x9c8e('0x31')]){_0x441e7c[_0x9c8e('0x32')]=[];_0x441e7c['TagIds'][_0x9c8e('0x33')](',')[_0x9c8e('0x34')](function(_0x24eb06){_0x441e7c[_0x9c8e('0x32')][_0x9c8e('0x35')](_0x44be09[_0x24eb06]);});}delete _0x441e7c['TagIds'];}catch(_0x57ff26){_0x14906e(_0x57ff26);}_0x3dc302(_0x441e7c);});}function updateOpenchannelInteraction(_0x2d0dbc,_0x59f0cd,_0x3b12e0){return new BPromise(function(_0x193ff4,_0x1dd9c4){return getInteractionUsers(_0x2d0dbc,_0x3b12e0)[_0x9c8e('0x28')](function(_0x3e73b9){return getInteractionTags(_0x3e73b9,_0x59f0cd);})[_0x9c8e('0x28')](function(_0x2adf8d){_0x193ff4(_0x2adf8d);})['catch'](function(_0x48ce92){_0x1dd9c4(_0x48ce92);});});}exports[_0x9c8e('0x36')]=function(_0x3f3826,_0x24195e){var _0x369b04={},_0x891c28={},_0x5e097d={'count':0x0,'rows':[]};var _0x1f558d=_[_0x9c8e('0x2f')](db[_0x9c8e('0x37')][_0x9c8e('0x38')],function(_0x445a2a){return{'name':_0x445a2a[_0x9c8e('0x39')],'type':_0x445a2a[_0x9c8e('0x3a')][_0x9c8e('0x3b')]};});_0x891c28[_0x9c8e('0x3c')]=_[_0x9c8e('0x2f')](_0x1f558d,'name');_0x891c28[_0x9c8e('0x3d')]=_[_0x9c8e('0x3e')](_0x3f3826[_0x9c8e('0x3d')]);_0x891c28[_0x9c8e('0x3f')]=_[_0x9c8e('0x40')](_0x891c28[_0x9c8e('0x3c')],_0x891c28[_0x9c8e('0x3d')]);_0x369b04[_0x9c8e('0x41')]=_[_0x9c8e('0x40')](_0x891c28[_0x9c8e('0x3c')],qs[_0x9c8e('0x42')](_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x42')]));_0x369b04[_0x9c8e('0x41')]=_0x369b04[_0x9c8e('0x41')][_0x9c8e('0x43')]?_0x369b04[_0x9c8e('0x41')]:_0x891c28[_0x9c8e('0x3c')];if(!_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x44')]('nolimit')){_0x369b04[_0x9c8e('0x20')]=qs[_0x9c8e('0x20')](_0x3f3826['query'][_0x9c8e('0x20')]);_0x369b04[_0x9c8e('0x1f')]=qs['offset'](_0x3f3826['query'][_0x9c8e('0x1f')]);}_0x369b04['order']=qs[_0x9c8e('0x45')](_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x45')]);_0x369b04[_0x9c8e('0x46')]=qs[_0x9c8e('0x3f')](_[_0x9c8e('0x47')](_0x3f3826[_0x9c8e('0x3d')],_0x891c28[_0x9c8e('0x3f')]),_0x1f558d);var _0x27db59=[];var _0x199d08=squel['select']()['field']('id')[_0x9c8e('0x48')](_0x9c8e('0x2c'))[_0x9c8e('0x48')]('color')[_0x9c8e('0x49')](_0x9c8e('0x4a'));var _0x5c27bb=squel[_0x9c8e('0x4b')]()[_0x9c8e('0x48')](_0x9c8e('0x4c'))[_0x9c8e('0x48')](_0x9c8e('0x4d'))[_0x9c8e('0x48')](_0x9c8e('0x4e'))[_0x9c8e('0x49')](_0x9c8e('0x4f'),'ui')[_0x9c8e('0x50')](_0x9c8e('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x38cbb1=squel[_0x9c8e('0x4b')]()[_0x9c8e('0x49')]('openchannel_interactions','i')['left_join'](_0x9c8e('0x52'),'c',_0x9c8e('0x53'))['left_join'](_0x9c8e('0x51'),'o',_0x9c8e('0x54'))[_0x9c8e('0x50')](_0x9c8e('0x55'),'a',_0x9c8e('0x56'))[_0x9c8e('0x50')]('openchannel_messages','me',_0x9c8e('0x57'))[_0x9c8e('0x50')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x9c8e('0x50')](_0x9c8e('0x4a'),'t',_0x9c8e('0x58'));var _0x4cc2ec=squel[_0x9c8e('0x59')]();var _0x4ac37b=[];var _0x3e6ebf=squel[_0x9c8e('0x59')]();var _0xef8039;if(_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x5a')]){_0xef8039=as[_0x9c8e('0x5b')](_0x3f3826['query'][_0x9c8e('0x5a')]);var _0x3b02e0=_0xef8039[_0x9c8e('0x5c')];for(var _0xb55c75=0x0;_0xb55c75<_0xef8039[_0x9c8e('0x5d')][_0x9c8e('0x43')];_0xb55c75++){var _0x1c4bd8=_0xef8039[_0x9c8e('0x5d')][_0xb55c75];var _0xc69b9a='i';var _0x5e0c97=_['find'](_0x1f558d,[_0x9c8e('0x2c'),_0x1c4bd8[_0x9c8e('0x48')]]);if(!_0x5e0c97){switch(_0x1c4bd8[_0x9c8e('0x48')]){case'unreadMessages':if(_0x1c4bd8[_0x9c8e('0x5e')]==0x1){_0x38cbb1[_0x9c8e('0x5f')]('`'+_0x1c4bd8[_0x9c8e('0x48')]+_0x9c8e('0x60'));}else{_0x38cbb1[_0x9c8e('0x5f')]('`'+_0x1c4bd8[_0x9c8e('0x48')]+_0x9c8e('0x61'));}break;case _0x9c8e('0x62'):if(_0x1c4bd8[_0x9c8e('0x63')]===_0x9c8e('0x64')){if(_0x1c4bd8[_0x9c8e('0x5e')]['split']('\x20')[_0x9c8e('0x43')]>0x1){_0x4cc2ec[_0x3b02e0](_0x9c8e('0x65'),qs[_0x9c8e('0x66')](_0x1c4bd8[_0x9c8e('0x5e')]),null);}else{var _0x1714cd='%'+_0x1c4bd8[_0x9c8e('0x5e')]+'%';_0x4cc2ec[_0x3b02e0](_0x9c8e('0x67'),_0x1714cd,_0x1714cd,_0x1714cd);}}else{_0x5e0c97=_[_0x9c8e('0x68')](_0x1f558d,['name',_0x9c8e('0x69')]);_0x1c4bd8[_0x9c8e('0x48')]=_0x9c8e('0x69');_0x1af748=as[_0x9c8e('0x6a')](_0xc69b9a,_0x5e0c97[_0x9c8e('0x3a')],_0x1c4bd8);_0x4cc2ec[_0x3b02e0](_0x1af748[_0x9c8e('0x6b')],_0x1af748['value']['start'],_0x1af748[_0x9c8e('0x5e')][_0x9c8e('0x29')]);}break;case'Tag':var _0x37122a=_0x1c4bd8['value'][_0x9c8e('0x33')](',')['map'](function(_0x298e8c){return Number(_0x298e8c);});_0x37122a['forEach'](function(_0x24a446){_0x3e6ebf['or'](_0x9c8e('0x6c'),'%,'+_0x24a446+',%');});_0x4ac37b=_[_0x9c8e('0x6d')](_0x4ac37b,_0x37122a);break;case _0x9c8e('0x6e'):if(_0x1c4bd8[_0x9c8e('0x63')]===_0x9c8e('0x64')){_0x4cc2ec[_0x3b02e0](_0x9c8e('0x6f'),'%'+_0x1c4bd8[_0x9c8e('0x5e')]+'%',null);}else{_0x5e0c97=_[_0x9c8e('0x68')](_0x1f558d,[_0x9c8e('0x2c'),'UserId']);_0x1c4bd8[_0x9c8e('0x48')]='UserId';_0x1af748=as[_0x9c8e('0x6a')](_0xc69b9a,_0x5e0c97[_0x9c8e('0x3a')],_0x1c4bd8);_0x4cc2ec[_0x3b02e0](_0x1af748[_0x9c8e('0x6b')],_0x1af748['value']['start'],_0x1af748['value'][_0x9c8e('0x29')]);}break;case _0x9c8e('0x70'):_0x1af748=as[_0x9c8e('0x6a')]('me',null,_0x1c4bd8);_0x4cc2ec[_0x3b02e0](_0x1af748[_0x9c8e('0x6b')],_0x1af748['value'][_0x9c8e('0x71')],_0x1af748[_0x9c8e('0x5e')]['end']);break;}}else{var _0x1af748=as[_0x9c8e('0x6a')](_0xc69b9a,_0x5e0c97[_0x9c8e('0x3a')],_0x1c4bd8);_0x4cc2ec[_0x3b02e0](_0x1af748[_0x9c8e('0x6b')],_0x1af748[_0x9c8e('0x5e')]['start'],_0x1af748['value'][_0x9c8e('0x29')]);}}}else{var _0x4748f1=_(_0x3f3826['query'])[_0x9c8e('0x3e')]()[_0x9c8e('0x2f')](function(_0x35b616){return _['some'](_0x1f558d,['name',_0x35b616])?_0x35b616:undefined;})[_0x9c8e('0x72')]()[_0x9c8e('0x5e')]();if(!_['isEmpty'](_0x4748f1)){_0x4748f1[_0x9c8e('0x34')](function(_0x3e5c64){if(_0x3e5c64===_0x9c8e('0x73')){_0x38cbb1['where'](_0x9c8e('0x74'),[][_0x9c8e('0x75')](_0x3f3826[_0x9c8e('0x3d')][_0x3e5c64]));}else if(_0x3e5c64===_0x9c8e('0x76')){var _0x5660c4=JSON['parse'](_0x3f3826[_0x9c8e('0x3d')][_0x3e5c64])[_0x9c8e('0x77')];var _0x202498=JSON['parse'](_0x3f3826[_0x9c8e('0x3d')][_0x3e5c64])[_0x9c8e('0x78')];_0x38cbb1['where'](_0x9c8e('0x79'),_0x5660c4,_0x202498);}else{if(_0x3f3826[_0x9c8e('0x3d')][_0x3e5c64]===_0x9c8e('0x7a')){_0x38cbb1[_0x9c8e('0x46')]('i.'+_0x3e5c64+_0x9c8e('0x7b'));}else{_0x38cbb1['where']('i.'+_0x3e5c64+_0x9c8e('0x7c'),_0x3f3826['query'][_0x3e5c64]);}}});}if(_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x7d')]){if(_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x7d')]==0x1){_0x38cbb1[_0x9c8e('0x5f')](_0x9c8e('0x7e'));}else{_0x38cbb1[_0x9c8e('0x5f')](_0x9c8e('0x7f'));}}if(_0x3f3826[_0x9c8e('0x3d')]['tag']){_0x4ac37b=_[_0x9c8e('0x80')](_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x81')])?_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x81')]:new Array(_0x3f3826['query']['tag']);_0x4ac37b['forEach'](function(_0x339117){_0x3e6ebf['or'](_0x9c8e('0x6c'),'%,'+_0x339117+',%');});}if(_0x3f3826['query'][_0x9c8e('0x82')]){var _0x3a9ac5=_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x82')][_0x9c8e('0x83')]('\x5c','\x5c\x5c')[_0x9c8e('0x83')](/'/g,'\x27\x27');if(qs[_0x9c8e('0x84')](_0x3a9ac5)){_0x4cc2ec['or'](_0x9c8e('0x85'),_0x3a9ac5+'%');}else{_0x4cc2ec['or'](_0x9c8e('0x86'),qs[_0x9c8e('0x66')](_0x3a9ac5))['or'](_0x9c8e('0x87'),_0x3a9ac5+'%')['or'](_0x9c8e('0x88'),_0x3a9ac5+'%');}}}_0x38cbb1[_0x9c8e('0x46')](_0x4cc2ec);_0x38cbb1['group'](_0x9c8e('0x89'));var _0x12bd5a={'type':db[_0x9c8e('0x8a')][_0x9c8e('0x8b')][_0x9c8e('0x8c')],'raw':!![]};var _0xb9be8b=_0x38cbb1[_0x9c8e('0x8d')]();_0xb9be8b[_0x9c8e('0x48')](_0x9c8e('0x89'));_0xb9be8b[_0x9c8e('0x48')](_0x9c8e('0x8e'),'unreadMessages');if(_0x369b04[_0x9c8e('0x8f')]){_0x369b04[_0x9c8e('0x8f')][_0x9c8e('0x34')](function(_0x2db675){var _0x52ba6a=_0x2db675[0x0]===_0x9c8e('0x90')?_0x2db675[0x0]:'i.'+_0x2db675[0x0];_0x38cbb1[_0x9c8e('0x8f')](_0x52ba6a,_0x2db675[0x1]===_0x9c8e('0x91')?![]:!![]);});}if(!_[_0x9c8e('0x92')](_0x4ac37b)){_0x38cbb1['having'](_0x3e6ebf);_0xb9be8b['where'](_0x9c8e('0x93'),_0x4ac37b);}BPromise[_0x9c8e('0x94')]()[_0x9c8e('0x28')](function(){if(!_0xef8039){if(_0x3f3826[_0x9c8e('0x3d')]['OpenchannelAccountId'])return;_0xb9be8b[_0x9c8e('0x46')](_0x9c8e('0x95'));_0x38cbb1[_0x9c8e('0x46')](_0x9c8e('0x95'));return;}if(_0x3f3826['user'][_0x9c8e('0x96')]!=='agent')return;return _0x3f3826[_0x9c8e('0x97')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x9c8e('0x28')](function(_0x417b73){if(_[_0x9c8e('0x92')](_0x417b73)){_0xb9be8b['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x38cbb1[_0x9c8e('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0xb9be8b[_0x9c8e('0x46')](_0x9c8e('0x74'),_[_0x9c8e('0x2f')](_0x417b73,'id'));_0x38cbb1[_0x9c8e('0x46')](_0x9c8e('0x74'),_[_0x9c8e('0x2f')](_0x417b73,'id'));}});})[_0x9c8e('0x28')](function(){if(_0x3f3826['user'][_0x9c8e('0x96')]===_0x9c8e('0x98')&&!_0xef8039&&!_0x3f3826[_0x9c8e('0x3d')][_0x9c8e('0x73')])return[];return db['sequelize']['query'](_0xb9be8b[_0x9c8e('0x99')](),_0x12bd5a);})[_0x9c8e('0x28')](function(_0x241bc1){_0x5e097d[_0x9c8e('0x1e')]=_0x241bc1[_0x9c8e('0x43')];if(_0x5e097d[_0x9c8e('0x1e')]===0x0)return[];return db[_0x9c8e('0x9a')][_0x9c8e('0x3d')](_0x199d08[_0x9c8e('0x99')](),_0x12bd5a)[_0x9c8e('0x28')](function(_0x1e5b61){_0x27db59=_[_0x9c8e('0x9b')](_0x1e5b61,'id');_0x12bd5a=_[_0x9c8e('0x9c')](_0x12bd5a,{'model':db[_0x9c8e('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f3826['query']['fields']){_0x369b04['attributes']['forEach'](function(_0x4b948b){_0x38cbb1[_0x9c8e('0x48')]('i.'+_0x4b948b);});}else{_0x38cbb1[_0x9c8e('0x48')](_0x9c8e('0x8e'),_0x9c8e('0x9d'));_0x38cbb1['field'](_0x9c8e('0x9e'),'Account.key');_0x38cbb1['field']('a.mandatoryDisposition',_0x9c8e('0x9f'));_0x38cbb1['field'](_0x9c8e('0xa0'),_0x9c8e('0x90'));_0x38cbb1[_0x9c8e('0x48')](_0x9c8e('0xa1'));_0x38cbb1[_0x9c8e('0x48')](_0x9c8e('0xa2'),_0x9c8e('0xa3'));_0x38cbb1[_0x9c8e('0x48')](_0x9c8e('0xa4'),_0x9c8e('0xa5'));_0x38cbb1[_0x9c8e('0x48')](_0x9c8e('0xa6'),'Contact.email');_0x38cbb1[_0x9c8e('0x48')]('c.phone','Contact.phone');_0x38cbb1[_0x9c8e('0x48')]('c.mobile',_0x9c8e('0xa7'));_0x38cbb1['field'](_0x9c8e('0xa8'),_0x9c8e('0xa9'));_0x38cbb1[_0x9c8e('0x48')](_0x9c8e('0xaa'),'Owner.fullname');_0x38cbb1[_0x9c8e('0x48')]('o.internal',_0x9c8e('0xab'));_0x38cbb1[_0x9c8e('0x48')](_0x9c8e('0xac'),_0x9c8e('0x31'));}if(_0x369b04[_0x9c8e('0x20')])_0x38cbb1[_0x9c8e('0x20')](_0x369b04[_0x9c8e('0x20')]);if(_0x369b04[_0x9c8e('0x1f')])_0x38cbb1['offset'](_0x369b04[_0x9c8e('0x1f')]);return db[_0x9c8e('0x9a')][_0x9c8e('0x3d')](_0x38cbb1['toString'](),_0x12bd5a);})[_0x9c8e('0x28')](function(_0x97fd5d){_0x5c27bb[_0x9c8e('0x46')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x9c8e('0x2f')](_0x97fd5d,'id'));return db[_0x9c8e('0x9a')][_0x9c8e('0x3d')](_0x5c27bb[_0x9c8e('0x99')](),_0x12bd5a)[_0x9c8e('0x28')](function(_0x3e9e5b){var _0x351ee3=_['groupBy'](_0x3e9e5b,_0x9c8e('0xad'));var _0x301455=[];_0x97fd5d[_0x9c8e('0x34')](function(_0x176864){_0x301455[_0x9c8e('0x35')](updateOpenchannelInteraction(_0x176864,_0x27db59,_0x351ee3));});return BPromise[_0x9c8e('0xae')](_0x301455);});});})['then'](function(_0x47ae59){_0x5e097d[_0x9c8e('0xaf')]=_0x47ae59;return _0x5e097d;})[_0x9c8e('0x28')](respondWithFilteredResult(_0x24195e,_0x369b04))[_0x9c8e('0xb0')](handleError(_0x24195e,null));};exports[_0x9c8e('0xb1')]=function(_0x568e4f,_0x112774){var _0x57bd6a={};if(_0x568e4f[_0x9c8e('0x3d')][_0x9c8e('0x3a')]&&_0x568e4f[_0x9c8e('0x3d')][_0x9c8e('0x3a')]===_0x9c8e('0x49')){_0x57bd6a[_0x9c8e('0x49')]=_0x568e4f['params']['id'];}else{_0x57bd6a['id']=_0x568e4f[_0x9c8e('0xb2')]['id'];}var _0x1cd22d={'raw':![],'where':_0x57bd6a},_0x4092f5={};_0x4092f5[_0x9c8e('0x3c')]=_[_0x9c8e('0x3e')](db[_0x9c8e('0x37')][_0x9c8e('0x38')]);_0x4092f5['query']=_[_0x9c8e('0x3e')](_0x568e4f['query']);_0x4092f5[_0x9c8e('0x3f')]=_[_0x9c8e('0x40')](_0x4092f5[_0x9c8e('0x3c')],_0x4092f5['query']);_0x1cd22d[_0x9c8e('0x41')]=_['intersection'](_0x4092f5[_0x9c8e('0x3c')],qs[_0x9c8e('0x42')](_0x568e4f[_0x9c8e('0x3d')][_0x9c8e('0x42')]));_0x1cd22d[_0x9c8e('0x41')]=_0x1cd22d[_0x9c8e('0x41')]['length']?_0x1cd22d[_0x9c8e('0x41')]:_0x4092f5['model'];if(_0x568e4f[_0x9c8e('0x3d')][_0x9c8e('0xb3')]){_0x1cd22d[_0x9c8e('0xb4')]=[{'all':!![]}];}_0x1cd22d=_[_0x9c8e('0x9c')]({},_0x1cd22d,_0x568e4f[_0x9c8e('0xb5')]);return db[_0x9c8e('0x37')]['find'](_0x1cd22d)[_0x9c8e('0x28')](handleEntityNotFound(_0x112774,null))[_0x9c8e('0x28')](respondWithResult(_0x112774,null))[_0x9c8e('0xb0')](handleError(_0x112774,null));};exports['create']=function(_0x2e604a,_0x3431dc){return db[_0x9c8e('0x37')][_0x9c8e('0xb6')](_0x2e604a['body'],{})[_0x9c8e('0x28')](respondWithResult(_0x3431dc,0xc9))['catch'](handleError(_0x3431dc,null));};exports[_0x9c8e('0x27')]=function(_0x492602,_0x301049){if(_0x492602[_0x9c8e('0x70')]['id']){delete _0x492602[_0x9c8e('0x70')]['id'];}return db[_0x9c8e('0x37')]['find']({'where':{'id':_0x492602['params']['id']}})['then'](handleEntityNotFound(_0x301049,null))[_0x9c8e('0x28')](saveUpdates(_0x492602['body'],null))[_0x9c8e('0x28')](respondWithResult(_0x301049,null))[_0x9c8e('0xb0')](handleError(_0x301049,null));};exports[_0x9c8e('0xb7')]=function(_0x11eb80,_0x48777b){return db[_0x9c8e('0x37')][_0x9c8e('0x68')]({'where':{'id':_0x11eb80['params']['id']}})[_0x9c8e('0x28')](handleEntityNotFound(_0x48777b,null))['then'](removeEntity(_0x48777b,null))[_0x9c8e('0xb0')](handleError(_0x48777b,null));};exports[_0x9c8e('0xb8')]=function(_0x4cd2ad,_0x2562fe){return db[_0x9c8e('0x37')][_0x9c8e('0xb8')]()[_0x9c8e('0x28')](respondWithResult(_0x2562fe,null))['catch'](handleError(_0x2562fe,null));};exports[_0x9c8e('0xb9')]=function(_0x4b766f,_0x30aada,_0x20e5d4){return db[_0x9c8e('0xba')][_0x9c8e('0x68')]({'where':{'id':_0x4b766f[_0x9c8e('0xb2')]['id']}})[_0x9c8e('0x28')](handleEntityNotFound(_0x30aada,null))[_0x9c8e('0x28')](function(_0x3f5ddf){if(_0x3f5ddf){return _0x3f5ddf[_0x9c8e('0xb9')](_0x4b766f[_0x9c8e('0x70')][_0x9c8e('0xbb')],_[_0x9c8e('0xbc')](_0x4b766f[_0x9c8e('0x70')],[_0x9c8e('0xbb'),'id'])||{});}})[_0x9c8e('0x28')](respondWithResult(_0x30aada,null))[_0x9c8e('0xb0')](handleError(_0x30aada,null));};exports[_0x9c8e('0xbd')]=function(_0xca56a1,_0x2f2500,_0x5e0a3e){var _0x1eb33d={'raw':![],'where':{}};var _0x35390c={};var _0x1970bd={'count':0x0,'rows':[]};return db[_0x9c8e('0x37')][_0x9c8e('0xbe')]({'where':{'id':_0xca56a1[_0x9c8e('0xb2')]['id']}})[_0x9c8e('0x28')](handleEntityNotFound(_0x2f2500,null))[_0x9c8e('0x28')](function(_0x2af45b){if(_0x2af45b){_0x35390c[_0x9c8e('0x3c')]=_['keys'](db[_0x9c8e('0xba')][_0x9c8e('0x38')]);_0x35390c['query']=_[_0x9c8e('0x3e')](_0xca56a1[_0x9c8e('0x3d')]);_0x35390c[_0x9c8e('0x3f')]=_[_0x9c8e('0x40')](_0x35390c[_0x9c8e('0x3c')],_0x35390c['query']);_0x1eb33d['attributes']=_[_0x9c8e('0x40')](_0x35390c[_0x9c8e('0x3c')],qs[_0x9c8e('0x42')](_0xca56a1[_0x9c8e('0x3d')][_0x9c8e('0x42')]));_0x1eb33d[_0x9c8e('0x41')]=_0x1eb33d['attributes']['length']?_0x1eb33d[_0x9c8e('0x41')]:_0x35390c[_0x9c8e('0x3c')];if(!_0xca56a1[_0x9c8e('0x3d')][_0x9c8e('0x44')]('nolimit')){_0x1eb33d[_0x9c8e('0x20')]=qs[_0x9c8e('0x20')](_0xca56a1['query'][_0x9c8e('0x20')]);_0x1eb33d[_0x9c8e('0x1f')]=qs[_0x9c8e('0x1f')](_0xca56a1[_0x9c8e('0x3d')]['offset']);}_0x1eb33d[_0x9c8e('0x8f')]=qs[_0x9c8e('0x45')](_0xca56a1[_0x9c8e('0x3d')]['sort']);_0x1eb33d[_0x9c8e('0x46')]=qs[_0x9c8e('0x3f')](_['pick'](_0xca56a1[_0x9c8e('0x3d')],_0x35390c[_0x9c8e('0x3f')]));_0x1eb33d['where']['OpenchannelInteractionId']=_0x2af45b['id'];if(_0xca56a1[_0x9c8e('0x3d')][_0x9c8e('0x82')]){_0x1eb33d[_0x9c8e('0x46')]=_['merge'](_0x1eb33d[_0x9c8e('0x46')],{'$or':_[_0x9c8e('0x2f')](_0x1eb33d[_0x9c8e('0x41')],function(_0x3bba97){var _0x142576={};_0x142576[_0x3bba97]={'$like':'%'+_0xca56a1[_0x9c8e('0x3d')][_0x9c8e('0x82')]+'%'};return _0x142576;})});}if(_0xca56a1[_0x9c8e('0x3d')]['$gte']){var _0x4d0878=_0xca56a1[_0x9c8e('0x3d')][_0x9c8e('0x77')][_0x9c8e('0x33')](',');var _0x195a79={};_0x195a79[_0x4d0878[0x0]]={'$gte':moment(_0x4d0878[0x1])[_0x9c8e('0xbf')](_0x9c8e('0xc0'))};_0x1eb33d['where']=_[_0x9c8e('0x9c')](_0x1eb33d[_0x9c8e('0x46')],_0x195a79);}_0x1eb33d=_[_0x9c8e('0x9c')]({},_0x1eb33d,_0xca56a1[_0x9c8e('0xb5')]);return db[_0x9c8e('0xba')][_0x9c8e('0x1e')]({'where':_0x1eb33d[_0x9c8e('0x46')]})[_0x9c8e('0x28')](function(_0x5db287){_0x1970bd[_0x9c8e('0x1e')]=_0x5db287;if(_0xca56a1[_0x9c8e('0x3d')][_0x9c8e('0xb3')]){_0x1eb33d[_0x9c8e('0xb4')]=[{'all':!![]}];}return db[_0x9c8e('0xba')][_0x9c8e('0xc1')](_0x1eb33d);})[_0x9c8e('0x28')](function(_0x7de875){_0x1970bd['rows']=_0x7de875;return _0x1970bd;});}})[_0x9c8e('0x28')](respondWithFilteredResult(_0x2f2500,_0x1eb33d))[_0x9c8e('0xb0')](handleError(_0x2f2500,null));};exports[_0x9c8e('0xc2')]=function(_0x7dfa0f,_0x34b5e0,_0xf3350e){return db[_0x9c8e('0x37')][_0x9c8e('0x68')]({'where':{'id':_0x7dfa0f[_0x9c8e('0xb2')]['id']}})[_0x9c8e('0x28')](handleEntityNotFound(_0x34b5e0,null))[_0x9c8e('0x28')](function(_0x3609b8){if(_0x3609b8){return _0x3609b8['setTags'](_0x7dfa0f[_0x9c8e('0x70')][_0x9c8e('0xbb')],_['omit'](_0x7dfa0f[_0x9c8e('0x70')],['ids','id'])||{})[_0x9c8e('0xc3')](function(){return db[_0x9c8e('0xc4')][_0x9c8e('0xc1')]({'attributes':['id',_0x9c8e('0x2c'),_0x9c8e('0xc5')],'where':{'id':_0x7dfa0f[_0x9c8e('0x70')][_0x9c8e('0xbb')]}});})['then'](function(_0x2cfce3){socket[_0x9c8e('0xc6')](_0x9c8e('0xc7'),{'id':Number(_0x7dfa0f[_0x9c8e('0xb2')]['id']),'tags':_0x2cfce3||[]});return{'id':Number(_0x7dfa0f[_0x9c8e('0xb2')]['id']),'tags':_0x2cfce3||[]};});}})[_0x9c8e('0x28')](respondWithResult(_0x34b5e0,null))['catch'](handleError(_0x34b5e0,null));};exports['removeTags']=function(_0x5d8af1,_0x324597,_0x18b974){return db['OpenchannelInteraction'][_0x9c8e('0x68')]({'where':{'id':_0x5d8af1[_0x9c8e('0xb2')]['id']}})['then'](handleEntityNotFound(_0x324597,null))[_0x9c8e('0x28')](function(_0x48e840){if(_0x48e840){return _0x48e840[_0x9c8e('0xc8')](_0x5d8af1[_0x9c8e('0x3d')][_0x9c8e('0xbb')]);}})[_0x9c8e('0x28')](respondWithStatusCode(_0x324597,null))[_0x9c8e('0xb0')](handleError(_0x324597,null));};exports['download']=function(_0x2dca4e,_0x1f3e08){var _0x51a3bd=moment()[_0x9c8e('0xc9')]()['toString']();var _0x995158=path[_0x9c8e('0xca')](config[_0x9c8e('0xcb')],'server',_0x9c8e('0xcc'),_0x9c8e('0xcd'));var _0x361659=path[_0x9c8e('0xca')](config[_0x9c8e('0xcb')],'server','files',_0x9c8e('0xce'));var _0x3703a7=path['join'](_0x995158,_0x51a3bd);var _0x140d6b=util[_0x9c8e('0xbf')](_0x9c8e('0xcf'),_0x2dca4e[_0x9c8e('0xb2')]['id'],_0x51a3bd);var _0x312971=path['join'](_0x995158,_0x140d6b);var _0x252921=[];_0x252921[_0x9c8e('0x35')]({'model':db[_0x9c8e('0x6e')],'as':_0x9c8e('0x6e'),'attributes':['id',_0x9c8e('0x30')],'raw':!![]});_0x252921[_0x9c8e('0x35')]({'model':db[_0x9c8e('0xd0')],'as':_0x9c8e('0x62'),'attributes':['id',_0x9c8e('0xd1'),_0x9c8e('0xd2')],'raw':!![]});if(_0x2dca4e[_0x9c8e('0x3d')]['attachments']){_0x252921['push']({'model':db[_0x9c8e('0xd3')],'as':'Attachment','raw':!![]});}var _0x1ad9ad=[{'model':db[_0x9c8e('0xba')],'as':_0x9c8e('0xd4'),'attributes':['id',_0x9c8e('0x70'),_0x9c8e('0x76'),_0x9c8e('0xd5'),_0x9c8e('0xd6'),'read'],'include':_0x252921}];_0x1ad9ad[_0x9c8e('0x35')]({'model':db[_0x9c8e('0xd7')],'as':_0x9c8e('0xd8'),'attributes':['id',_0x9c8e('0x2c')]});_0x1ad9ad[_0x9c8e('0x35')]({'model':db[_0x9c8e('0x6e')],'as':'Owner','attributes':['id','fullname']});return db[_0x9c8e('0x37')][_0x9c8e('0x68')]({'where':{'id':_0x2dca4e[_0x9c8e('0xb2')]['id']},'include':_0x1ad9ad})[_0x9c8e('0x28')](handleEntityNotFound(_0x1f3e08,null))[_0x9c8e('0x28')](function(_0x34f122){if(_0x34f122){var _0x2199de=_0x34f122[_0x9c8e('0xd9')]({'plain':!![]});fs[_0x9c8e('0xda')](_0x3703a7);var _0x527e74={'format':'A4','border':'10px','header':{'height':_0x9c8e('0xdb'),'contents':{'first':_0x9c8e('0xdc')}},'footer':{'height':_0x9c8e('0xdd'),'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[_0x9c8e('0xbf')](_0x9c8e('0xde'),'Openchannel',_0x2199de['id']),moment()[_0x9c8e('0xbf')](_0x9c8e('0xdf'))[_0x9c8e('0x99')]())}}};var _0x1fb549={'channel':_0x9c8e('0xe0'),'account':_0x2199de[_0x9c8e('0xd8')]['name'],'agent':_0x2199de['Owner']?_0x2199de['Owner'][_0x9c8e('0x30')]:_0x9c8e('0xe1'),'createdAt':moment(_0x2199de[_0x9c8e('0x76')])[_0x9c8e('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9c8e('0x99')](),'closedAt':_0x2199de[_0x9c8e('0xe2')]?moment(_0x2199de[_0x9c8e('0xe3')])[_0x9c8e('0xbf')](_0x9c8e('0xc0'))[_0x9c8e('0x99')]():'','disposition':_0x2199de[_0x9c8e('0xe4')],'visibility':_0x2199de[_0x9c8e('0xe5')]?_0x9c8e('0xe6'):_0x9c8e('0xe7'),'messages':_(_0x2199de['Messages'])[_0x9c8e('0x82')]({'secret':![]})[_0x9c8e('0x2f')](function(_0x11f481){if(_0x11f481[_0x9c8e('0xd3')]){var _0x47a8de=path['join'](_0x361659,_0x11f481[_0x9c8e('0xd3')][_0x9c8e('0xe8')]);if(fs['existsSync'](_0x47a8de)){fs[_0x9c8e('0xe9')](_0x47a8de)[_0x9c8e('0xea')](fs[_0x9c8e('0xeb')](path[_0x9c8e('0xca')](_0x3703a7,_0x11f481['Attachment'][_0x9c8e('0xe8')])));}}return{'date':moment(_0x11f481[_0x9c8e('0x76')])[_0x9c8e('0xbf')](_0x9c8e('0xc0'))[_0x9c8e('0x99')](),'sender':_0x11f481[_0x9c8e('0xd5')]===_0x9c8e('0xec')?_0x11f481[_0x9c8e('0x6e')]?_0x11f481['User'][_0x9c8e('0x30')]:_0x9c8e('0xed'):_0x11f481[_0x9c8e('0x62')][_0x9c8e('0xd1')]+(_0x11f481['Contact'][_0x9c8e('0xd2')]?'\x20'+_0x11f481['Contact'][_0x9c8e('0xd2')]:''),'body':_0x11f481['Attachment']?_0x11f481['Attachment'][_0x9c8e('0xe8')]:_0x11f481[_0x9c8e('0x70')],'direction':_0x11f481[_0x9c8e('0xd5')]===_0x9c8e('0xec')?'A':'C','secret':_0x11f481[_0x9c8e('0xd6')],'read':_0x11f481['read'],'attachment':_0x11f481[_0x9c8e('0xd3')]};})['value']()};return ejs[_0x9c8e('0xee')](path[_0x9c8e('0xca')](config['root'],_0x9c8e('0xef'),_0x9c8e('0xf0'),'downloadInteraction.html'),{'interaction':_0x1fb549})['then'](function(_0x3229c3){return new BPromise(function(_0x2d5579,_0x4db825){pdf[_0x9c8e('0xb6')](_0x3229c3,_0x527e74)[_0x9c8e('0xf1')](path[_0x9c8e('0xca')](_0x3703a7,_0x9c8e('0xf2')+_0x2199de['id']+'-'+_0x51a3bd+_0x9c8e('0xf3')),function(_0x578c6e,_0x3d138f){if(_0x578c6e)return _0x4db825(_0x578c6e);_0x2d5579(_0x3d138f);});});})[_0x9c8e('0x28')](function(){return new BPromise(function(_0x1683c8,_0xf00c1c){zipdir(_0x3703a7,{'saveTo':_0x312971},function(_0x58ed4d,_0x3f5730){if(_0x58ed4d)return _0xf00c1c(_0x58ed4d);return _0x1683c8(_0x3f5730);});})[_0x9c8e('0x28')](function(){return new BPromise(function(_0x2daef3,_0x4bee15){rimraf(_0x3703a7,function(_0x4e4f43){if(_0x4e4f43)_0x4bee15(_0x4e4f43);return _0x2daef3();});});})[_0x9c8e('0x28')](function(){return _0x1f3e08[_0x9c8e('0xf4')](_0x312971,_0x140d6b,function(_0x423407){if(_0x423407){console[_0x9c8e('0xf5')](_0x9c8e('0xf6'),_0x423407);}else{fs[_0x9c8e('0xf7')](_0x312971);}});});});}else{return _0x1f3e08[_0x9c8e('0xf8')](0xc8);}})[_0x9c8e('0xb0')](handleError(_0x1f3e08,null));}; \ No newline at end of file +var _0xc2ce=['../../config/license/util','redis','./openchannelInteraction.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','error','name','send','Users','fullname','TagIds','split','forEach','Tags','push','catch','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','tools_tags','u.id','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','value','`\x20=\x200','having','`\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','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','start','body','some','isEmpty','OpenchannelAccountId','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','count','sequelize','keyBy','merge','unreadMessages','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','OpenchannelInteraction','includeAll','include','options','create','destroy','describe','addMessage','OpenchannelMessage','ids','omit','findOne','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','direction','secret','OpenchannelAccount','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.','closedAt','disposition','Messages','basename','existsSync','pipe','createWriteStream','out','System','Contact','lastName','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x5c2e23,_0x39ed39){var _0x2280f2=function(_0x4f2b9c){while(--_0x4f2b9c){_0x5c2e23['push'](_0x5c2e23['shift']());}};_0x2280f2(++_0x39ed39);}(_0xc2ce,0x1c0));var _0xec2c=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0xc2ce[_0x46a38b];return _0x346e75;};'use strict';var pdf=require(_0xec2c('0x0'));var emlformat=require(_0xec2c('0x1'));var rimraf=require(_0xec2c('0x2'));var zipdir=require(_0xec2c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xec2c('0x4'));var BPromise=require(_0xec2c('0x5'));var Mustache=require(_0xec2c('0x6'));var util=require('util');var path=require(_0xec2c('0x7'));var sox=require(_0xec2c('0x8'));var csv=require(_0xec2c('0x9'));var ejs=require(_0xec2c('0xa'));var fs=require('fs');var fs_extra=require(_0xec2c('0xb'));var _=require('lodash');var squel=require(_0xec2c('0xc'));var crypto=require('crypto');var jsforce=require(_0xec2c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xec2c('0xe'));var Papa=require(_0xec2c('0xf'));var Redis=require(_0xec2c('0x10'));var authService=require(_0xec2c('0x11'));var qs=require(_0xec2c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec2c('0x13'))(_0xec2c('0x14'));var utils=require(_0xec2c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xec2c('0x16'));var db=require('../../mysqldb')['db'];config[_0xec2c('0x17')]=_['defaults'](config[_0xec2c('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec2c('0x17')]));require(_0xec2c('0x18'))['register'](socket);function respondWithStatusCode(_0x4b9d36,_0x1e0550){_0x1e0550=_0x1e0550||0xcc;return function(_0x344e5e){if(_0x344e5e){return _0x4b9d36[_0xec2c('0x19')](_0x1e0550);}return _0x4b9d36[_0xec2c('0x1a')](_0x1e0550)[_0xec2c('0x1b')]();};}function respondWithResult(_0x2bb473,_0x1a740e){_0x1a740e=_0x1a740e||0xc8;return function(_0x4c404c){if(_0x4c404c){return _0x2bb473[_0xec2c('0x1a')](_0x1a740e)[_0xec2c('0x1c')](_0x4c404c);}};}function respondWithFilteredResult(_0x3cfd01,_0x5b7633){return function(_0x4b40f7){if(_0x4b40f7){var _0x478107=_0x4b40f7['count'],_0x48b5f4=_0x5b7633[_0xec2c('0x1d')],_0x1eb89d=_0x5b7633['offset']+_0x5b7633[_0xec2c('0x1e')],_0x27a98b;if(_0x1eb89d>=_0x478107){_0x1eb89d=_0x478107;_0x27a98b=0xc8;}else{_0x27a98b=0xce;}_0x3cfd01[_0xec2c('0x1a')](_0x27a98b);return _0x3cfd01[_0xec2c('0x1f')](_0xec2c('0x20'),_0x48b5f4+'-'+_0x1eb89d+'/'+_0x478107)[_0xec2c('0x1c')](_0x4b40f7);}return null;};}function patchUpdates(_0x44bbff){return function(_0x44565f){try{jsonpatch[_0xec2c('0x21')](_0x44565f,_0x44bbff,!![]);}catch(_0x322bd4){return BPromise[_0xec2c('0x22')](_0x322bd4);}return _0x44565f[_0xec2c('0x23')]();};}function saveUpdates(_0x59c267,_0x590aef){return function(_0x32afd0){if(_0x32afd0){return _0x32afd0['update'](_0x59c267)['then'](function(_0x57dea0){return _0x57dea0;});}return null;};}function removeEntity(_0x158e6f,_0x1a1106){return function(_0xd774c7){if(_0xd774c7){return _0xd774c7['destroy']()[_0xec2c('0x24')](function(){_0x158e6f[_0xec2c('0x1a')](0xcc)[_0xec2c('0x1b')]();});}};}function handleEntityNotFound(_0x31ef12,_0x4c6a18){return function(_0x272cbb){if(!_0x272cbb){_0x31ef12['sendStatus'](0x194);}return _0x272cbb;};}function handleError(_0x4f86d1,_0x2b05f0){_0x2b05f0=_0x2b05f0||0x1f4;return function(_0x4dfea5){logger[_0xec2c('0x25')](_0x4dfea5['stack']);if(_0x4dfea5[_0xec2c('0x26')]){delete _0x4dfea5['name'];}_0x4f86d1[_0xec2c('0x1a')](_0x2b05f0)[_0xec2c('0x27')](_0x4dfea5);};}function getInteractionUsers(_0x12c4a5,_0x25e801){return new BPromise(function(_0x2b304c,_0x35b27b){try{if(_0x25e801[_0x12c4a5['id']]){_0x12c4a5[_0xec2c('0x28')]=_['map'](_0x25e801[_0x12c4a5['id']],function(_0x3b3803){return{'id':_0x3b3803['id'],'fullname':_0x3b3803[_0xec2c('0x29')]};});}}catch(_0x3ff424){_0x35b27b(_0x3ff424);}_0x2b304c(_0x12c4a5);});}function getInteractionTags(_0x2821a5,_0x5db305){return new BPromise(function(_0x4d8ee4,_0x3fd891){try{if(_0x2821a5['TagIds']){_0x2821a5['Tags']=[];_0x2821a5[_0xec2c('0x2a')][_0xec2c('0x2b')](',')[_0xec2c('0x2c')](function(_0x26ed88){_0x2821a5[_0xec2c('0x2d')][_0xec2c('0x2e')](_0x5db305[_0x26ed88]);});}delete _0x2821a5[_0xec2c('0x2a')];}catch(_0x22f839){_0x3fd891(_0x22f839);}_0x4d8ee4(_0x2821a5);});}function updateOpenchannelInteraction(_0x24b4f7,_0x4f3c98,_0x203258){return new BPromise(function(_0x24cf55,_0x1c5bc3){return getInteractionUsers(_0x24b4f7,_0x203258)['then'](function(_0x21e8a6){return getInteractionTags(_0x21e8a6,_0x4f3c98);})[_0xec2c('0x24')](function(_0x3f61c7){_0x24cf55(_0x3f61c7);})[_0xec2c('0x2f')](function(_0x4388ac){_0x1c5bc3(_0x4388ac);});});}exports['index']=function(_0x7b7745,_0x2f6eeb){var _0x27c715={},_0x15e2e3={},_0x541ee7={'count':0x0,'rows':[]};var _0x2372a3=_['map'](db['OpenchannelInteraction'][_0xec2c('0x30')],function(_0x2aff84){return{'name':_0x2aff84['fieldName'],'type':_0x2aff84[_0xec2c('0x31')]['key']};});_0x15e2e3[_0xec2c('0x32')]=_[_0xec2c('0x33')](_0x2372a3,_0xec2c('0x26'));_0x15e2e3[_0xec2c('0x34')]=_[_0xec2c('0x35')](_0x7b7745[_0xec2c('0x34')]);_0x15e2e3[_0xec2c('0x36')]=_[_0xec2c('0x37')](_0x15e2e3['model'],_0x15e2e3[_0xec2c('0x34')]);_0x27c715[_0xec2c('0x38')]=_[_0xec2c('0x37')](_0x15e2e3[_0xec2c('0x32')],qs[_0xec2c('0x39')](_0x7b7745[_0xec2c('0x34')][_0xec2c('0x39')]));_0x27c715[_0xec2c('0x38')]=_0x27c715[_0xec2c('0x38')][_0xec2c('0x3a')]?_0x27c715[_0xec2c('0x38')]:_0x15e2e3[_0xec2c('0x32')];if(!_0x7b7745[_0xec2c('0x34')][_0xec2c('0x3b')](_0xec2c('0x3c'))){_0x27c715[_0xec2c('0x1e')]=qs[_0xec2c('0x1e')](_0x7b7745[_0xec2c('0x34')][_0xec2c('0x1e')]);_0x27c715[_0xec2c('0x1d')]=qs[_0xec2c('0x1d')](_0x7b7745[_0xec2c('0x34')][_0xec2c('0x1d')]);}_0x27c715[_0xec2c('0x3d')]=qs[_0xec2c('0x3e')](_0x7b7745['query']['sort']);_0x27c715[_0xec2c('0x3f')]=qs[_0xec2c('0x36')](_['pick'](_0x7b7745[_0xec2c('0x34')],_0x15e2e3[_0xec2c('0x36')]),_0x2372a3);var _0x3e4228=[];var _0x45ef17=squel[_0xec2c('0x40')]()['field']('id')['field'](_0xec2c('0x26'))[_0xec2c('0x41')]('color')['from'](_0xec2c('0x42'));var _0x13d3d9=squel[_0xec2c('0x40')]()['field'](_0xec2c('0x43'))[_0xec2c('0x41')]('u.fullname')[_0xec2c('0x41')]('ui.OpenchannelInteractionId')[_0xec2c('0x44')](_0xec2c('0x45'),'ui')[_0xec2c('0x46')](_0xec2c('0x47'),'u',_0xec2c('0x48'));var _0x348ed7=squel[_0xec2c('0x40')]()[_0xec2c('0x44')](_0xec2c('0x49'),'i')[_0xec2c('0x46')](_0xec2c('0x4a'),'c',_0xec2c('0x4b'))[_0xec2c('0x46')](_0xec2c('0x47'),'o',_0xec2c('0x4c'))[_0xec2c('0x46')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0xec2c('0x46')](_0xec2c('0x4d'),'me',_0xec2c('0x4e'))[_0xec2c('0x46')](_0xec2c('0x4f'),'it',_0xec2c('0x50'))[_0xec2c('0x46')](_0xec2c('0x42'),'t','t.id\x20=\x20it.TagId');var _0x4583cc=squel['expr']();var _0x3b5b7d=[];var _0x3f2286=squel[_0xec2c('0x51')]();var _0x5de054;if(_0x7b7745[_0xec2c('0x34')]['search']){_0x5de054=as['parseSearch'](_0x7b7745['query'][_0xec2c('0x52')]);var _0x23d932=_0x5de054[_0xec2c('0x53')];for(var _0x5adac8=0x0;_0x5adac8<_0x5de054[_0xec2c('0x54')][_0xec2c('0x3a')];_0x5adac8++){var _0x2d0f92=_0x5de054['conditions'][_0x5adac8];var _0x3ada54='i';var _0x43a021=_[_0xec2c('0x55')](_0x2372a3,[_0xec2c('0x26'),_0x2d0f92[_0xec2c('0x41')]]);if(!_0x43a021){switch(_0x2d0f92[_0xec2c('0x41')]){case'unreadMessages':if(_0x2d0f92[_0xec2c('0x56')]==0x1){_0x348ed7['having']('`'+_0x2d0f92['field']+_0xec2c('0x57'));}else{_0x348ed7[_0xec2c('0x58')]('`'+_0x2d0f92[_0xec2c('0x41')]+_0xec2c('0x59'));}break;case'Contact':if(_0x2d0f92[_0xec2c('0x5a')]===_0xec2c('0x5b')){if(_0x2d0f92['value'][_0xec2c('0x2b')]('\x20')[_0xec2c('0x3a')]>0x1){_0x4583cc[_0x23d932](_0xec2c('0x5c'),qs[_0xec2c('0x5d')](_0x2d0f92[_0xec2c('0x56')]),null);}else{var _0x4fb547='%'+_0x2d0f92[_0xec2c('0x56')]+'%';_0x4583cc[_0x23d932](_0xec2c('0x5e'),_0x4fb547,_0x4fb547,_0x4fb547);}}else{_0x43a021=_[_0xec2c('0x55')](_0x2372a3,[_0xec2c('0x26'),'ContactId']);_0x2d0f92[_0xec2c('0x41')]=_0xec2c('0x5f');_0x51def8=as['buildExpression'](_0x3ada54,_0x43a021[_0xec2c('0x31')],_0x2d0f92);_0x4583cc[_0x23d932](_0x51def8[_0xec2c('0x60')],_0x51def8[_0xec2c('0x56')]['start'],_0x51def8[_0xec2c('0x56')][_0xec2c('0x1b')]);}break;case _0xec2c('0x61'):var _0x5259df=_0x2d0f92['value'][_0xec2c('0x2b')](',')[_0xec2c('0x33')](function(_0x54ea6a){return Number(_0x54ea6a);});_0x5259df['forEach'](function(_0x175ddb){_0x3f2286['or'](_0xec2c('0x62'),'%,'+_0x175ddb+',%');});_0x3b5b7d=_[_0xec2c('0x63')](_0x3b5b7d,_0x5259df);break;case _0xec2c('0x64'):if(_0x2d0f92[_0xec2c('0x5a')]===_0xec2c('0x5b')){_0x4583cc[_0x23d932]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2d0f92[_0xec2c('0x56')]+'%',null);}else{_0x43a021=_[_0xec2c('0x55')](_0x2372a3,[_0xec2c('0x26'),_0xec2c('0x65')]);_0x2d0f92[_0xec2c('0x41')]=_0xec2c('0x65');_0x51def8=as[_0xec2c('0x66')](_0x3ada54,_0x43a021[_0xec2c('0x31')],_0x2d0f92);_0x4583cc[_0x23d932](_0x51def8[_0xec2c('0x60')],_0x51def8[_0xec2c('0x56')][_0xec2c('0x67')],_0x51def8[_0xec2c('0x56')][_0xec2c('0x1b')]);}break;case _0xec2c('0x68'):_0x51def8=as['buildExpression']('me',null,_0x2d0f92);_0x4583cc[_0x23d932](_0x51def8['text'],_0x51def8['value'][_0xec2c('0x67')],_0x51def8['value'][_0xec2c('0x1b')]);break;}}else{var _0x51def8=as['buildExpression'](_0x3ada54,_0x43a021[_0xec2c('0x31')],_0x2d0f92);_0x4583cc[_0x23d932](_0x51def8[_0xec2c('0x60')],_0x51def8[_0xec2c('0x56')]['start'],_0x51def8[_0xec2c('0x56')][_0xec2c('0x1b')]);}}}else{var _0x1c7bc0=_(_0x7b7745[_0xec2c('0x34')])[_0xec2c('0x35')]()[_0xec2c('0x33')](function(_0x1060dc){return _[_0xec2c('0x69')](_0x2372a3,[_0xec2c('0x26'),_0x1060dc])?_0x1060dc:undefined;})['compact']()[_0xec2c('0x56')]();if(!_[_0xec2c('0x6a')](_0x1c7bc0)){_0x1c7bc0[_0xec2c('0x2c')](function(_0x3c925d){if(_0x3c925d===_0xec2c('0x6b')){_0x348ed7[_0xec2c('0x3f')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x7b7745[_0xec2c('0x34')][_0x3c925d]));}else if(_0x3c925d===_0xec2c('0x6c')){var _0x1cb33b=JSON['parse'](_0x7b7745[_0xec2c('0x34')][_0x3c925d])['$gte'];var _0x3a6820=JSON['parse'](_0x7b7745['query'][_0x3c925d])[_0xec2c('0x6d')];_0x348ed7[_0xec2c('0x3f')](_0xec2c('0x6e'),_0x1cb33b,_0x3a6820);}else{if(_0x7b7745[_0xec2c('0x34')][_0x3c925d]==='null'){_0x348ed7['where']('i.'+_0x3c925d+_0xec2c('0x6f'));}else{_0x348ed7[_0xec2c('0x3f')]('i.'+_0x3c925d+'\x20=\x20?',_0x7b7745['query'][_0x3c925d]);}}});}if(_0x7b7745['query'][_0xec2c('0x70')]){if(_0x7b7745[_0xec2c('0x34')][_0xec2c('0x70')]==0x1){_0x348ed7[_0xec2c('0x58')](_0xec2c('0x71'));}else{_0x348ed7[_0xec2c('0x58')](_0xec2c('0x72'));}}if(_0x7b7745[_0xec2c('0x34')][_0xec2c('0x73')]){_0x3b5b7d=_[_0xec2c('0x74')](_0x7b7745[_0xec2c('0x34')][_0xec2c('0x73')])?_0x7b7745['query'][_0xec2c('0x73')]:new Array(_0x7b7745['query'][_0xec2c('0x73')]);_0x3b5b7d[_0xec2c('0x2c')](function(_0x3e2c37){_0x3f2286['or'](_0xec2c('0x62'),'%,'+_0x3e2c37+',%');});}if(_0x7b7745['query'][_0xec2c('0x75')]){var _0xc12258=_0x7b7745[_0xec2c('0x34')][_0xec2c('0x75')][_0xec2c('0x76')]('\x5c','\x5c\x5c')[_0xec2c('0x76')](/'/g,'\x27\x27');if(qs[_0xec2c('0x77')](_0xc12258)){_0x4583cc['or'](_0xec2c('0x78'),_0xc12258+'%');}else{_0x4583cc['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xec2c('0x5d')](_0xc12258))['or'](_0xec2c('0x79'),_0xc12258+'%')['or'](_0xec2c('0x7a'),_0xc12258+'%');}}}_0x348ed7[_0xec2c('0x3f')](_0x4583cc);_0x348ed7[_0xec2c('0x7b')](_0xec2c('0x7c'));var _0x1808b3={'type':db[_0xec2c('0x7d')][_0xec2c('0x7e')][_0xec2c('0x7f')],'raw':!![]};var _0x2f035c=_0x348ed7[_0xec2c('0x80')]();_0x2f035c[_0xec2c('0x41')]('i.id');_0x2f035c[_0xec2c('0x41')](_0xec2c('0x81'),'unreadMessages');if(_0x27c715[_0xec2c('0x3d')]){_0x27c715[_0xec2c('0x3d')][_0xec2c('0x2c')](function(_0x2a1b9a){var _0xd9251c=_0x2a1b9a[0x0]==='contactName'?_0x2a1b9a[0x0]:'i.'+_0x2a1b9a[0x0];_0x348ed7[_0xec2c('0x3d')](_0xd9251c,_0x2a1b9a[0x1]===_0xec2c('0x82')?![]:!![]);});}if(!_[_0xec2c('0x6a')](_0x3b5b7d)){_0x348ed7[_0xec2c('0x58')](_0x3f2286);_0x2f035c[_0xec2c('0x3f')](_0xec2c('0x83'),_0x3b5b7d);}BPromise['resolve']()['then'](function(){if(!_0x5de054){if(_0x7b7745['query'][_0xec2c('0x6b')])return;_0x2f035c[_0xec2c('0x3f')](_0xec2c('0x84'));_0x348ed7[_0xec2c('0x3f')](_0xec2c('0x84'));return;}if(_0x7b7745[_0xec2c('0x85')][_0xec2c('0x86')]!==_0xec2c('0x87'))return;return _0x7b7745['user'][_0xec2c('0x88')]({'attributes':['id'],'raw':!![]})[_0xec2c('0x24')](function(_0x3760c7){if(_[_0xec2c('0x6a')](_0x3760c7)){_0x2f035c[_0xec2c('0x3f')](_0xec2c('0x89'));_0x348ed7['where'](_0xec2c('0x89'));}else{_0x2f035c[_0xec2c('0x3f')](_0xec2c('0x8a'),_['map'](_0x3760c7,'id'));_0x348ed7[_0xec2c('0x3f')](_0xec2c('0x8a'),_[_0xec2c('0x33')](_0x3760c7,'id'));}});})[_0xec2c('0x24')](function(){if(_0x7b7745[_0xec2c('0x85')]['role']===_0xec2c('0x87')&&!_0x5de054&&!_0x7b7745[_0xec2c('0x34')]['OpenchannelAccountId'])return[];return db['sequelize'][_0xec2c('0x34')](_0x2f035c[_0xec2c('0x8b')](),_0x1808b3);})[_0xec2c('0x24')](function(_0xd0ffe7){_0x541ee7[_0xec2c('0x8c')]=_0xd0ffe7[_0xec2c('0x3a')];if(_0x541ee7[_0xec2c('0x8c')]===0x0)return[];return db[_0xec2c('0x8d')]['query'](_0x45ef17[_0xec2c('0x8b')](),_0x1808b3)[_0xec2c('0x24')](function(_0x1ce8d2){_0x3e4228=_[_0xec2c('0x8e')](_0x1ce8d2,'id');_0x1808b3=_[_0xec2c('0x8f')](_0x1808b3,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7b7745['query']['fields']){_0x27c715[_0xec2c('0x38')][_0xec2c('0x2c')](function(_0x57dc53){_0x348ed7[_0xec2c('0x41')]('i.'+_0x57dc53);});}else{_0x348ed7[_0xec2c('0x41')](_0xec2c('0x81'),_0xec2c('0x90'));_0x348ed7['field']('a.key',_0xec2c('0x91'));_0x348ed7[_0xec2c('0x41')]('a.mandatoryDisposition',_0xec2c('0x92'));_0x348ed7[_0xec2c('0x41')](_0xec2c('0x93'),_0xec2c('0x94'));_0x348ed7[_0xec2c('0x41')](_0xec2c('0x95'));_0x348ed7[_0xec2c('0x41')]('c.firstName','Contact.firstName');_0x348ed7[_0xec2c('0x41')](_0xec2c('0x96'),_0xec2c('0x97'));_0x348ed7['field'](_0xec2c('0x98'),_0xec2c('0x99'));_0x348ed7['field'](_0xec2c('0x9a'),'Contact.phone');_0x348ed7['field'](_0xec2c('0x9b'),_0xec2c('0x9c'));_0x348ed7[_0xec2c('0x41')](_0xec2c('0x9d'),'Contact.fax');_0x348ed7[_0xec2c('0x41')](_0xec2c('0x9e'),'Owner.fullname');_0x348ed7['field'](_0xec2c('0x9f'),'Owner.internal');_0x348ed7[_0xec2c('0x41')](_0xec2c('0xa0'),_0xec2c('0x2a'));}if(_0x27c715[_0xec2c('0x1e')])_0x348ed7['limit'](_0x27c715[_0xec2c('0x1e')]);if(_0x27c715['offset'])_0x348ed7[_0xec2c('0x1d')](_0x27c715[_0xec2c('0x1d')]);return db[_0xec2c('0x8d')]['query'](_0x348ed7[_0xec2c('0x8b')](),_0x1808b3);})['then'](function(_0x416f42){_0x13d3d9[_0xec2c('0x3f')](_0xec2c('0xa1'),_['map'](_0x416f42,'id'));return db['sequelize'][_0xec2c('0x34')](_0x13d3d9[_0xec2c('0x8b')](),_0x1808b3)[_0xec2c('0x24')](function(_0x2e8619){var _0x5a618a=_[_0xec2c('0xa2')](_0x2e8619,_0xec2c('0xa3'));var _0x1ca11b=[];_0x416f42[_0xec2c('0x2c')](function(_0x28a0da){_0x1ca11b[_0xec2c('0x2e')](updateOpenchannelInteraction(_0x28a0da,_0x3e4228,_0x5a618a));});return BPromise[_0xec2c('0xa4')](_0x1ca11b);});});})[_0xec2c('0x24')](function(_0x2b077b){_0x541ee7[_0xec2c('0xa5')]=_0x2b077b;return _0x541ee7;})[_0xec2c('0x24')](respondWithFilteredResult(_0x2f6eeb,_0x27c715))[_0xec2c('0x2f')](handleError(_0x2f6eeb,null));};exports[_0xec2c('0xa6')]=function(_0x4d1c22,_0x58e36b){var _0x5d990c={};if(_0x4d1c22[_0xec2c('0x34')][_0xec2c('0x31')]&&_0x4d1c22[_0xec2c('0x34')]['type']===_0xec2c('0x44')){_0x5d990c[_0xec2c('0x44')]=_0x4d1c22[_0xec2c('0xa7')]['id'];}else{_0x5d990c['id']=_0x4d1c22[_0xec2c('0xa7')]['id'];}var _0x708248={'raw':![],'where':_0x5d990c},_0x1e6abd={};_0x1e6abd[_0xec2c('0x32')]=_['keys'](db[_0xec2c('0xa8')]['rawAttributes']);_0x1e6abd[_0xec2c('0x34')]=_['keys'](_0x4d1c22['query']);_0x1e6abd[_0xec2c('0x36')]=_['intersection'](_0x1e6abd['model'],_0x1e6abd[_0xec2c('0x34')]);_0x708248[_0xec2c('0x38')]=_[_0xec2c('0x37')](_0x1e6abd[_0xec2c('0x32')],qs['fields'](_0x4d1c22['query'][_0xec2c('0x39')]));_0x708248[_0xec2c('0x38')]=_0x708248[_0xec2c('0x38')][_0xec2c('0x3a')]?_0x708248[_0xec2c('0x38')]:_0x1e6abd['model'];if(_0x4d1c22[_0xec2c('0x34')][_0xec2c('0xa9')]){_0x708248[_0xec2c('0xaa')]=[{'all':!![]}];}_0x708248=_[_0xec2c('0x8f')]({},_0x708248,_0x4d1c22[_0xec2c('0xab')]);return db[_0xec2c('0xa8')][_0xec2c('0x55')](_0x708248)[_0xec2c('0x24')](handleEntityNotFound(_0x58e36b,null))['then'](respondWithResult(_0x58e36b,null))[_0xec2c('0x2f')](handleError(_0x58e36b,null));};exports[_0xec2c('0xac')]=function(_0x17a6c8,_0x23ea1d){return db[_0xec2c('0xa8')][_0xec2c('0xac')](_0x17a6c8[_0xec2c('0x68')],{})[_0xec2c('0x24')](respondWithResult(_0x23ea1d,0xc9))[_0xec2c('0x2f')](handleError(_0x23ea1d,null));};exports['update']=function(_0x23e8ee,_0x51afa3){if(_0x23e8ee[_0xec2c('0x68')]['id']){delete _0x23e8ee[_0xec2c('0x68')]['id'];}return db['OpenchannelInteraction'][_0xec2c('0x55')]({'where':{'id':_0x23e8ee[_0xec2c('0xa7')]['id']}})['then'](handleEntityNotFound(_0x51afa3,null))[_0xec2c('0x24')](saveUpdates(_0x23e8ee[_0xec2c('0x68')],null))[_0xec2c('0x24')](respondWithResult(_0x51afa3,null))[_0xec2c('0x2f')](handleError(_0x51afa3,null));};exports[_0xec2c('0xad')]=function(_0x2e4362,_0x56bd16){return db[_0xec2c('0xa8')][_0xec2c('0x55')]({'where':{'id':_0x2e4362[_0xec2c('0xa7')]['id']}})['then'](handleEntityNotFound(_0x56bd16,null))[_0xec2c('0x24')](removeEntity(_0x56bd16,null))[_0xec2c('0x2f')](handleError(_0x56bd16,null));};exports['describe']=function(_0x58a225,_0x5bb253){return db[_0xec2c('0xa8')][_0xec2c('0xae')]()[_0xec2c('0x24')](respondWithResult(_0x5bb253,null))[_0xec2c('0x2f')](handleError(_0x5bb253,null));};exports[_0xec2c('0xaf')]=function(_0x13eacb,_0x52f90c,_0x4d9bc5){return db[_0xec2c('0xb0')][_0xec2c('0x55')]({'where':{'id':_0x13eacb[_0xec2c('0xa7')]['id']}})['then'](handleEntityNotFound(_0x52f90c,null))['then'](function(_0x53a5b2){if(_0x53a5b2){return _0x53a5b2[_0xec2c('0xaf')](_0x13eacb[_0xec2c('0x68')][_0xec2c('0xb1')],_[_0xec2c('0xb2')](_0x13eacb[_0xec2c('0x68')],[_0xec2c('0xb1'),'id'])||{});}})['then'](respondWithResult(_0x52f90c,null))[_0xec2c('0x2f')](handleError(_0x52f90c,null));};exports['getMessages']=function(_0x1be091,_0x1bcf3e,_0x387ef0){var _0x1b5eca={'raw':![],'where':{}};var _0x36e642={};var _0x5012fa={'count':0x0,'rows':[]};return db[_0xec2c('0xa8')][_0xec2c('0xb3')]({'where':{'id':_0x1be091[_0xec2c('0xa7')]['id']}})[_0xec2c('0x24')](handleEntityNotFound(_0x1bcf3e,null))[_0xec2c('0x24')](function(_0xfdf500){if(_0xfdf500){_0x36e642[_0xec2c('0x32')]=_[_0xec2c('0x35')](db['OpenchannelMessage'][_0xec2c('0x30')]);_0x36e642[_0xec2c('0x34')]=_[_0xec2c('0x35')](_0x1be091[_0xec2c('0x34')]);_0x36e642[_0xec2c('0x36')]=_[_0xec2c('0x37')](_0x36e642[_0xec2c('0x32')],_0x36e642[_0xec2c('0x34')]);_0x1b5eca[_0xec2c('0x38')]=_[_0xec2c('0x37')](_0x36e642[_0xec2c('0x32')],qs[_0xec2c('0x39')](_0x1be091[_0xec2c('0x34')]['fields']));_0x1b5eca[_0xec2c('0x38')]=_0x1b5eca[_0xec2c('0x38')][_0xec2c('0x3a')]?_0x1b5eca[_0xec2c('0x38')]:_0x36e642['model'];if(!_0x1be091[_0xec2c('0x34')][_0xec2c('0x3b')](_0xec2c('0x3c'))){_0x1b5eca[_0xec2c('0x1e')]=qs['limit'](_0x1be091['query'][_0xec2c('0x1e')]);_0x1b5eca[_0xec2c('0x1d')]=qs[_0xec2c('0x1d')](_0x1be091['query'][_0xec2c('0x1d')]);}_0x1b5eca[_0xec2c('0x3d')]=qs[_0xec2c('0x3e')](_0x1be091['query'][_0xec2c('0x3e')]);_0x1b5eca[_0xec2c('0x3f')]=qs['filters'](_[_0xec2c('0xb4')](_0x1be091[_0xec2c('0x34')],_0x36e642[_0xec2c('0x36')]));_0x1b5eca[_0xec2c('0x3f')][_0xec2c('0xa3')]=_0xfdf500['id'];if(_0x1be091[_0xec2c('0x34')]['filter']){_0x1b5eca[_0xec2c('0x3f')]=_[_0xec2c('0x8f')](_0x1b5eca['where'],{'$or':_['map'](_0x1b5eca[_0xec2c('0x38')],function(_0x37c6d2){var _0x39f6cf={};_0x39f6cf[_0x37c6d2]={'$like':'%'+_0x1be091[_0xec2c('0x34')]['filter']+'%'};return _0x39f6cf;})});}if(_0x1be091[_0xec2c('0x34')][_0xec2c('0xb5')]){var _0x33e9ef=_0x1be091[_0xec2c('0x34')][_0xec2c('0xb5')][_0xec2c('0x2b')](',');var _0x420e6c={};_0x420e6c[_0x33e9ef[0x0]]={'$gte':moment(_0x33e9ef[0x1])[_0xec2c('0xb6')](_0xec2c('0xb7'))};_0x1b5eca[_0xec2c('0x3f')]=_[_0xec2c('0x8f')](_0x1b5eca[_0xec2c('0x3f')],_0x420e6c);}_0x1b5eca=_[_0xec2c('0x8f')]({},_0x1b5eca,_0x1be091[_0xec2c('0xab')]);return db['OpenchannelMessage']['count']({'where':_0x1b5eca[_0xec2c('0x3f')]})[_0xec2c('0x24')](function(_0x19533c){_0x5012fa[_0xec2c('0x8c')]=_0x19533c;if(_0x1be091[_0xec2c('0x34')][_0xec2c('0xa9')]){_0x1b5eca[_0xec2c('0xaa')]=[{'all':!![]}];}return db[_0xec2c('0xb0')][_0xec2c('0xb8')](_0x1b5eca);})['then'](function(_0x107148){_0x5012fa['rows']=_0x107148;return _0x5012fa;});}})[_0xec2c('0x24')](respondWithFilteredResult(_0x1bcf3e,_0x1b5eca))['catch'](handleError(_0x1bcf3e,null));};exports[_0xec2c('0xb9')]=function(_0x267749,_0x1337ba,_0x3ed3f9){return db['OpenchannelInteraction'][_0xec2c('0x55')]({'where':{'id':_0x267749[_0xec2c('0xa7')]['id']}})['then'](handleEntityNotFound(_0x1337ba,null))[_0xec2c('0x24')](function(_0x57cad1){if(_0x57cad1){return _0x57cad1[_0xec2c('0xba')](_0x267749[_0xec2c('0x68')][_0xec2c('0xb1')],_[_0xec2c('0xb2')](_0x267749[_0xec2c('0x68')],['ids','id'])||{})[_0xec2c('0xbb')](function(){return db[_0xec2c('0x61')][_0xec2c('0xb8')]({'attributes':['id',_0xec2c('0x26'),_0xec2c('0xbc')],'where':{'id':_0x267749[_0xec2c('0x68')][_0xec2c('0xb1')]}});})[_0xec2c('0x24')](function(_0x17b115){socket[_0xec2c('0xbd')]('openchannelInteractionTags:save',{'id':Number(_0x267749[_0xec2c('0xa7')]['id']),'tags':_0x17b115||[]});return{'id':Number(_0x267749[_0xec2c('0xa7')]['id']),'tags':_0x17b115||[]};});}})['then'](respondWithResult(_0x1337ba,null))[_0xec2c('0x2f')](handleError(_0x1337ba,null));};exports[_0xec2c('0xbe')]=function(_0x1b0ef6,_0x3c1ea7,_0x27b451){return db[_0xec2c('0xa8')][_0xec2c('0x55')]({'where':{'id':_0x1b0ef6[_0xec2c('0xa7')]['id']}})['then'](handleEntityNotFound(_0x3c1ea7,null))[_0xec2c('0x24')](function(_0x4e34ff){if(_0x4e34ff){return _0x4e34ff['removeTags'](_0x1b0ef6['query'][_0xec2c('0xb1')]);}})[_0xec2c('0x24')](respondWithStatusCode(_0x3c1ea7,null))[_0xec2c('0x2f')](handleError(_0x3c1ea7,null));};exports[_0xec2c('0xbf')]=function(_0x4cce65,_0x384479){var _0x2ff907=moment()[_0xec2c('0xc0')]()['toString']();var _0x1f230a=path[_0xec2c('0xc1')](config[_0xec2c('0xc2')],_0xec2c('0xc3'),_0xec2c('0xc4'),_0xec2c('0xc5'));var _0xd837f3=path[_0xec2c('0xc1')](config[_0xec2c('0xc2')],_0xec2c('0xc3'),'files',_0xec2c('0xc6'));var _0x4a430f=path['join'](_0x1f230a,_0x2ff907);var _0x3d1e07=util['format'](_0xec2c('0xc7'),_0x4cce65['params']['id'],_0x2ff907);var _0x11cb25=path[_0xec2c('0xc1')](_0x1f230a,_0x3d1e07);var _0x16e8c7=[];_0x16e8c7[_0xec2c('0x2e')]({'model':db[_0xec2c('0x64')],'as':_0xec2c('0x64'),'attributes':['id',_0xec2c('0x29')],'raw':!![]});_0x16e8c7[_0xec2c('0x2e')]({'model':db[_0xec2c('0xc8')],'as':'Contact','attributes':['id',_0xec2c('0xc9'),'lastName'],'raw':!![]});if(_0x4cce65['query'][_0xec2c('0xc6')]){_0x16e8c7[_0xec2c('0x2e')]({'model':db[_0xec2c('0xca')],'as':'Attachment','raw':!![]});}var _0x35a6d9=[{'model':db[_0xec2c('0xb0')],'as':'Messages','attributes':['id',_0xec2c('0x68'),_0xec2c('0x6c'),_0xec2c('0xcb'),_0xec2c('0xcc'),_0xec2c('0x70')],'include':_0x16e8c7}];_0x35a6d9[_0xec2c('0x2e')]({'model':db[_0xec2c('0xcd')],'as':_0xec2c('0xce'),'attributes':['id',_0xec2c('0x26')]});_0x35a6d9['push']({'model':db[_0xec2c('0x64')],'as':_0xec2c('0xcf'),'attributes':['id',_0xec2c('0x29')]});return db[_0xec2c('0xa8')][_0xec2c('0x55')]({'where':{'id':_0x4cce65[_0xec2c('0xa7')]['id']},'include':_0x35a6d9})[_0xec2c('0x24')](handleEntityNotFound(_0x384479,null))[_0xec2c('0x24')](function(_0x159130){if(_0x159130){var _0x125391=_0x159130[_0xec2c('0xd0')]({'plain':!![]});fs[_0xec2c('0xd1')](_0x4a430f);var _0x26aa85={'format':'A4','border':_0xec2c('0xd2'),'header':{'height':_0xec2c('0xd3'),'contents':{'first':_0xec2c('0xd4')}},'footer':{'height':_0xec2c('0xd5'),'contents':{'default':util[_0xec2c('0xb6')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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'](_0xec2c('0xd6'),_0xec2c('0xd7'),_0x125391['id']),moment()[_0xec2c('0xb6')](_0xec2c('0xd8'))[_0xec2c('0x8b')]())}}};var _0x16db44={'channel':_0xec2c('0xd7'),'account':_0x125391[_0xec2c('0xce')][_0xec2c('0x26')],'agent':_0x125391[_0xec2c('0xcf')]?_0x125391['Owner'][_0xec2c('0x29')]:_0xec2c('0xd9'),'createdAt':moment(_0x125391[_0xec2c('0x6c')])[_0xec2c('0xb6')](_0xec2c('0xb7'))[_0xec2c('0x8b')](),'closedAt':_0x125391['closed']?moment(_0x125391[_0xec2c('0xda')])[_0xec2c('0xb6')](_0xec2c('0xb7'))['toString']():'','disposition':_0x125391[_0xec2c('0xdb')],'visibility':_0x125391['threadId']?'Public':'Private','messages':_(_0x125391[_0xec2c('0xdc')])['filter']({'secret':![]})[_0xec2c('0x33')](function(_0x1cf237){if(_0x1cf237[_0xec2c('0xca')]){var _0x573a26=path['join'](_0xd837f3,_0x1cf237[_0xec2c('0xca')][_0xec2c('0xdd')]);if(fs[_0xec2c('0xde')](_0x573a26)){fs['createReadStream'](_0x573a26)[_0xec2c('0xdf')](fs[_0xec2c('0xe0')](path[_0xec2c('0xc1')](_0x4a430f,_0x1cf237[_0xec2c('0xca')][_0xec2c('0xdd')])));}}return{'date':moment(_0x1cf237[_0xec2c('0x6c')])[_0xec2c('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')[_0xec2c('0x8b')](),'sender':_0x1cf237[_0xec2c('0xcb')]===_0xec2c('0xe1')?_0x1cf237[_0xec2c('0x64')]?_0x1cf237[_0xec2c('0x64')][_0xec2c('0x29')]:_0xec2c('0xe2'):_0x1cf237[_0xec2c('0xe3')][_0xec2c('0xc9')]+(_0x1cf237[_0xec2c('0xe3')][_0xec2c('0xe4')]?'\x20'+_0x1cf237[_0xec2c('0xe3')][_0xec2c('0xe4')]:''),'body':_0x1cf237[_0xec2c('0xca')]?_0x1cf237[_0xec2c('0xca')][_0xec2c('0xdd')]:_0x1cf237[_0xec2c('0x68')],'direction':_0x1cf237[_0xec2c('0xcb')]===_0xec2c('0xe1')?'A':'C','secret':_0x1cf237[_0xec2c('0xcc')],'read':_0x1cf237[_0xec2c('0x70')],'attachment':_0x1cf237[_0xec2c('0xca')]};})[_0xec2c('0x56')]()};return ejs['renderFile'](path[_0xec2c('0xc1')](config[_0xec2c('0xc2')],_0xec2c('0xc3'),'views',_0xec2c('0xe5')),{'interaction':_0x16db44})[_0xec2c('0x24')](function(_0x2d4918){return new BPromise(function(_0xc50530,_0x37f10d){pdf[_0xec2c('0xac')](_0x2d4918,_0x26aa85)['toFile'](path[_0xec2c('0xc1')](_0x4a430f,_0xec2c('0xe6')+_0x125391['id']+'-'+_0x2ff907+_0xec2c('0xe7')),function(_0x42aa9f,_0x232c60){if(_0x42aa9f)return _0x37f10d(_0x42aa9f);_0xc50530(_0x232c60);});});})[_0xec2c('0x24')](function(){return new BPromise(function(_0x48ca88,_0x563b08){zipdir(_0x4a430f,{'saveTo':_0x11cb25},function(_0xd20320,_0x1f26ac){if(_0xd20320)return _0x563b08(_0xd20320);return _0x48ca88(_0x1f26ac);});})[_0xec2c('0x24')](function(){return new BPromise(function(_0x29e9c7,_0x3ac2b1){rimraf(_0x4a430f,function(_0x5c96a7){if(_0x5c96a7)_0x3ac2b1(_0x5c96a7);return _0x29e9c7();});});})[_0xec2c('0x24')](function(){return _0x384479[_0xec2c('0xbf')](_0x11cb25,_0x3d1e07,function(_0x2c468f){if(_0x2c468f){console[_0xec2c('0xe8')](_0xec2c('0xe9'),_0x2c468f);}else{fs[_0xec2c('0xea')](_0x11cb25);}});});});}else{return _0x384479[_0xec2c('0x19')](0xc8);}})['catch'](handleError(_0x384479,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7e9f1c0..0736aa1 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 _0xc990=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xc990,0x141));var _0x0c99=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xc990[_0x1762b4];return _0x29beda;};'use strict';var EventEmitter=require(_0x0c99('0x0'));var OpenchannelInteraction=require(_0x0c99('0x1'))['db'][_0x0c99('0x2')];var OpenchannelMessage=require(_0x0c99('0x1'))['db'][_0x0c99('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0c99('0x4')](0x0);var events={'afterCreate':_0x0c99('0x5'),'afterUpdate':_0x0c99('0x6'),'afterDestroy':_0x0c99('0x7')};function emitEvent(_0x11fe38){return function(_0x48b2ab,_0x3ddaac,_0x182695){_0x48b2ab[_0x0c99('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21aeb9){_0x48b2ab['setDataValue'](_0x0c99('0x9'),_0x21aeb9[_0x0c99('0xa')](function(_0x1725c1){return{'id':_0x1725c1['id']};}));return OpenchannelMessage[_0x0c99('0xb')]({'where':{'OpenchannelInteractionId':_0x48b2ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0c99('0xc')](function(_0x395943){_0x48b2ab['setDataValue']('unreadMessages',_0x395943[_0x0c99('0xd')]);OpenchannelInteractionEvents[_0x0c99('0xe')](_0x11fe38+':'+_0x48b2ab['id'],_0x48b2ab);OpenchannelInteractionEvents['emit'](_0x11fe38,_0x48b2ab);_0x182695(null);})[_0x0c99('0xf')](_0x182695(null));};}for(var e in events){if(events[_0x0c99('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x0c99('0x11')](e,emitEvent(event));}}module[_0x0c99('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x682c=['getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1cac3b,_0x344896){var _0x36c22b=function(_0x24ef81){while(--_0x24ef81){_0x1cac3b['push'](_0x1cac3b['shift']());}};_0x36c22b(++_0x344896);}(_0x682c,0xfb));var _0xc682=function(_0xed3572,_0xd871f3){_0xed3572=_0xed3572-0x0;var _0x225b94=_0x682c[_0xed3572];return _0x225b94;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xc682('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc682('0x1')](0x0);var events={'afterCreate':_0xc682('0x2'),'afterUpdate':_0xc682('0x3'),'afterDestroy':_0xc682('0x4')};function emitEvent(_0x3029ca){return function(_0x14a4c2,_0x5c1c4,_0x10f0c2){_0x14a4c2[_0xc682('0x5')]({'attributes':['id'],'raw':!![]})[_0xc682('0x6')](function(_0x494fc5){_0x14a4c2[_0xc682('0x7')](_0xc682('0x8'),_0x494fc5[_0xc682('0x9')](function(_0x4c4b7b){return{'id':_0x4c4b7b['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x14a4c2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc682('0x6')](function(_0x311899){_0x14a4c2['setDataValue'](_0xc682('0xa'),_0x311899['length']);OpenchannelInteractionEvents[_0xc682('0xb')](_0x3029ca+':'+_0x14a4c2['id'],_0x14a4c2);OpenchannelInteractionEvents[_0xc682('0xb')](_0x3029ca,_0x14a4c2);_0x10f0c2(null);})[_0xc682('0xc')](_0x10f0c2(null));};}for(var e in events){if(events[_0xc682('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xc682('0xe')](e,emitEvent(event));}}module[_0xc682('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0203749..de9e93c 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 _0x5e0e=['../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xc342a9,_0x2128e5){var _0x1a0231=function(_0x31c16c){while(--_0x31c16c){_0xc342a9['push'](_0xc342a9['shift']());}};_0x1a0231(++_0x2128e5);}(_0x5e0e,0x89));var _0xe5e0=function(_0x279614,_0x4cce43){_0x279614=_0x279614-0x0;var _0x2a331c=_0x5e0e[_0x279614];return _0x2a331c;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var logger=require('../../config/logger')(_0xe5e0('0x2'));var moment=require(_0xe5e0('0x3'));var BPromise=require(_0xe5e0('0x4'));var rp=require(_0xe5e0('0x5'));var fs=require('fs');var path=require(_0xe5e0('0x6'));var rimraf=require('rimraf');var config=require(_0xe5e0('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xe5e0('0x8')]=function(_0x3e564e,_0x2ff9ac){return _0x3e564e[_0xe5e0('0x9')](_0xe5e0('0xa'),attributes,{'tableName':_0xe5e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59a81f,_0x4059cf,_0x29199a){if(_0x59a81f['changed'](_0xe5e0('0xc'))){_0x59a81f[_0xe5e0('0xd')]=moment()[_0xe5e0('0xe')](_0xe5e0('0xf'));}_0x29199a(null,_0x59a81f);}}});}; \ No newline at end of file +var _0x1cb9=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x56c596,_0x4ead18){var _0x3350b5=function(_0x35a488){while(--_0x35a488){_0x56c596['push'](_0x56c596['shift']());}};_0x3350b5(++_0x4ead18);}(_0x1cb9,0x14e));var _0x91cb=function(_0x41d572,_0x114a59){_0x41d572=_0x41d572-0x0;var _0x3f2d03=_0x1cb9[_0x41d572];return _0x3f2d03;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15c517,_0x5bda2f,_0x2fdfce){if(_0x15c517['changed'](_0x91cb('0xb'))){_0x15c517[_0x91cb('0xc')]=moment()[_0x91cb('0xd')](_0x91cb('0xe'));}_0x2fdfce(null,_0x15c517);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index de8c573..ef10bf4 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 _0xf857=['client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','where','attributes','limit','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xf857,0x1d8));var _0x7f85=function(_0x1ffe76,_0x552dad){_0x1ffe76=_0x1ffe76-0x0;var _0x17a24e=_0xf857[_0x1ffe76];return _0x17a24e;};'use strict';var _=require(_0x7f85('0x0'));var util=require(_0x7f85('0x1'));var moment=require(_0x7f85('0x2'));var BPromise=require(_0x7f85('0x3'));var rs=require(_0x7f85('0x4'));var fs=require('fs');var Redis=require(_0x7f85('0x5'));var db=require(_0x7f85('0x6'))['db'];var utils=require(_0x7f85('0x7'));var logger=require(_0x7f85('0x8'))(_0x7f85('0x9'));var config=require(_0x7f85('0xa'));var jayson=require(_0x7f85('0xb'));var client=jayson[_0x7f85('0xc')][_0x7f85('0xd')]({'port':0x232a});config['redis']=_[_0x7f85('0xe')](config[_0x7f85('0xf')],{'host':_0x7f85('0x10'),'port':0x18eb});var socket=require(_0x7f85('0x11'))(new Redis(config[_0x7f85('0xf')]));require(_0x7f85('0x12'))['register'](socket);function respondWithRpcPromise(_0x31f2a1,_0x25bc69,_0x38cb06){return new BPromise(function(_0x44c5bc,_0x932477){return client[_0x7f85('0x13')](_0x31f2a1,_0x38cb06)[_0x7f85('0x14')](function(_0x4b694a){logger[_0x7f85('0x15')](_0x7f85('0x16'),_0x25bc69,_0x7f85('0x17'));logger[_0x7f85('0x18')](_0x7f85('0x19'),_0x25bc69,'request\x20sent',JSON[_0x7f85('0x1a')](_0x4b694a));if(_0x4b694a[_0x7f85('0x1b')]){if(_0x4b694a[_0x7f85('0x1b')]['code']===0x1f4){logger['error'](_0x7f85('0x16'),_0x25bc69,_0x4b694a[_0x7f85('0x1b')][_0x7f85('0x1c')]);return _0x932477(_0x4b694a[_0x7f85('0x1b')][_0x7f85('0x1c')]);}logger[_0x7f85('0x1b')]('OpenchannelInteraction,\x20%s,\x20%s',_0x25bc69,_0x4b694a[_0x7f85('0x1b')][_0x7f85('0x1c')]);return _0x44c5bc(_0x4b694a[_0x7f85('0x1b')][_0x7f85('0x1c')]);}else{logger['info'](_0x7f85('0x16'),_0x25bc69,'request\x20sent');_0x44c5bc(_0x4b694a['result']['message']);}})[_0x7f85('0x1d')](function(_0x2b9987){logger[_0x7f85('0x1b')](_0x7f85('0x16'),_0x25bc69,_0x2b9987);_0x932477(_0x2b9987);});});}exports[_0x7f85('0x1e')]=function(_0x194aed){var _0x64764=this;return new Promise(function(_0x236059,_0xc5abb9){return db[_0x7f85('0x1f')][_0x7f85('0x20')](_0x194aed[_0x7f85('0x21')],{'raw':_0x194aed['options']?_0x194aed['options'][_0x7f85('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194aed[_0x7f85('0x23')]?_0x194aed[_0x7f85('0x23')][_0x7f85('0x24')]||null:null,'attributes':_0x194aed[_0x7f85('0x23')]?_0x194aed['options'][_0x7f85('0x25')]||null:null,'limit':_0x194aed[_0x7f85('0x23')]?_0x194aed['options'][_0x7f85('0x26')]||null:null})[_0x7f85('0x14')](function(_0x189e44){logger[_0x7f85('0x15')](_0x7f85('0x1e'),_0x194aed);logger[_0x7f85('0x18')](_0x7f85('0x1e'),_0x194aed,JSON[_0x7f85('0x1a')](_0x189e44));_0x236059(_0x189e44);})['catch'](function(_0x6e6c37){logger[_0x7f85('0x1b')]('UpdateOpenchannelInteraction',_0x6e6c37[_0x7f85('0x1c')],_0x194aed);_0xc5abb9(_0x64764['error'](0x1f4,_0x6e6c37[_0x7f85('0x1c')]));});});};exports[_0x7f85('0x27')]=function(_0x42f03c){return new Promise(function(_0x1ddf29,_0x2b0806){return db[_0x7f85('0x1f')]['find']({'where':_0x42f03c[_0x7f85('0x23')]?_0x42f03c['options'][_0x7f85('0x24')]||null:null})[_0x7f85('0x14')](function(_0x356933){if(_0x356933){return _0x356933[_0x7f85('0x28')](_0x42f03c[_0x7f85('0x21')][_0x7f85('0x29')],_[_0x7f85('0x2a')](_0x42f03c[_0x7f85('0x21')],[_0x7f85('0x29'),'id'])||{});}})['spread'](function(_0x52ddbf){logger[_0x7f85('0x15')](_0x7f85('0x2b'),_0x42f03c);logger[_0x7f85('0x18')](_0x7f85('0x2b'),_0x42f03c,JSON['stringify'](_0x52ddbf));_0x1ddf29(_0x52ddbf);})[_0x7f85('0x1d')](function(_0x1400f5){logger[_0x7f85('0x1b')](_0x7f85('0x2b'),_0x1400f5[_0x7f85('0x1c')],_0x42f03c);_0x2b0806(_this[_0x7f85('0x1b')](0x1f4,_0x1400f5[_0x7f85('0x1c')]));});});}; \ No newline at end of file +var _0x3e68=['register','request','then','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','info','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','AddTagsToOpenchannelInteraction','where','addTags','ids','spread','AddTags','debug','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket'];(function(_0x4a462e,_0x37c629){var _0x4c88c6=function(_0x2e9d0d){while(--_0x2e9d0d){_0x4a462e['push'](_0x4a462e['shift']());}};_0x4c88c6(++_0x37c629);}(_0x3e68,0x15a));var _0x83e6=function(_0x1a6277,_0x308c41){_0x1a6277=_0x1a6277-0x0;var _0x55cb62=_0x3e68[_0x1a6277];return _0x55cb62;};'use strict';var _=require('lodash');var util=require(_0x83e6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x83e6('0x1'));var fs=require('fs');var Redis=require(_0x83e6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x83e6('0x3'));var logger=require(_0x83e6('0x4'))('rpc');var config=require(_0x83e6('0x5'));var jayson=require(_0x83e6('0x6'));var client=jayson[_0x83e6('0x7')][_0x83e6('0x8')]({'port':0x232a});config[_0x83e6('0x9')]=_[_0x83e6('0xa')](config[_0x83e6('0x9')],{'host':_0x83e6('0xb'),'port':0x18eb});var socket=require(_0x83e6('0xc'))(new Redis(config[_0x83e6('0x9')]));require(_0x83e6('0xd'))[_0x83e6('0xe')](socket);function respondWithRpcPromise(_0x34079c,_0x462500,_0x48e8f1){return new BPromise(function(_0x3613b4,_0x3b5b8b){return client[_0x83e6('0xf')](_0x34079c,_0x48e8f1)[_0x83e6('0x10')](function(_0x4c9be2){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x462500,_0x83e6('0x11'));logger['debug'](_0x83e6('0x12'),_0x462500,_0x83e6('0x11'),JSON[_0x83e6('0x13')](_0x4c9be2));if(_0x4c9be2[_0x83e6('0x14')]){if(_0x4c9be2[_0x83e6('0x14')][_0x83e6('0x15')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x462500,_0x4c9be2[_0x83e6('0x14')][_0x83e6('0x16')]);return _0x3b5b8b(_0x4c9be2[_0x83e6('0x14')][_0x83e6('0x16')]);}logger[_0x83e6('0x14')](_0x83e6('0x17'),_0x462500,_0x4c9be2['error'][_0x83e6('0x16')]);return _0x3613b4(_0x4c9be2[_0x83e6('0x14')][_0x83e6('0x16')]);}else{logger[_0x83e6('0x18')](_0x83e6('0x17'),_0x462500,'request\x20sent');_0x3613b4(_0x4c9be2['result'][_0x83e6('0x16')]);}})[_0x83e6('0x19')](function(_0xe02485){logger[_0x83e6('0x14')](_0x83e6('0x17'),_0x462500,_0xe02485);_0x3b5b8b(_0xe02485);});});}exports[_0x83e6('0x1a')]=function(_0x11c3fc){var _0x24a24f=this;return new Promise(function(_0x58f79e,_0xc38e55){return db[_0x83e6('0x1b')][_0x83e6('0x1c')](_0x11c3fc[_0x83e6('0x1d')],{'raw':_0x11c3fc[_0x83e6('0x1e')]?_0x11c3fc[_0x83e6('0x1e')][_0x83e6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c3fc[_0x83e6('0x1e')]?_0x11c3fc[_0x83e6('0x1e')]['where']||null:null,'attributes':_0x11c3fc['options']?_0x11c3fc[_0x83e6('0x1e')][_0x83e6('0x20')]||null:null,'limit':_0x11c3fc['options']?_0x11c3fc[_0x83e6('0x1e')]['limit']||null:null})[_0x83e6('0x10')](function(_0x3e641b){logger[_0x83e6('0x18')](_0x83e6('0x1a'),_0x11c3fc);logger['debug']('UpdateOpenchannelInteraction',_0x11c3fc,JSON[_0x83e6('0x13')](_0x3e641b));_0x58f79e(_0x3e641b);})[_0x83e6('0x19')](function(_0x527f59){logger[_0x83e6('0x14')]('UpdateOpenchannelInteraction',_0x527f59['message'],_0x11c3fc);_0xc38e55(_0x24a24f[_0x83e6('0x14')](0x1f4,_0x527f59[_0x83e6('0x16')]));});});};exports[_0x83e6('0x21')]=function(_0x553464){return new Promise(function(_0x51c172,_0x424c66){return db['OpenchannelInteraction']['find']({'where':_0x553464[_0x83e6('0x1e')]?_0x553464[_0x83e6('0x1e')][_0x83e6('0x22')]||null:null})[_0x83e6('0x10')](function(_0x4fee2e){if(_0x4fee2e){return _0x4fee2e[_0x83e6('0x23')](_0x553464[_0x83e6('0x1d')]['ids'],_['omit'](_0x553464[_0x83e6('0x1d')],[_0x83e6('0x24'),'id'])||{});}})[_0x83e6('0x25')](function(_0x1c2c27){logger[_0x83e6('0x18')](_0x83e6('0x26'),_0x553464);logger[_0x83e6('0x27')](_0x83e6('0x26'),_0x553464,JSON[_0x83e6('0x13')](_0x1c2c27));_0x51c172(_0x1c2c27);})[_0x83e6('0x19')](function(_0x3f71b2){logger['error'](_0x83e6('0x26'),_0x3f71b2[_0x83e6('0x16')],_0x553464);_0x424c66(_this[_0x83e6('0x14')](0x1f4,_0x3f71b2[_0x83e6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 97b694c..6db3f8b 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 _0x9171=['update','emit','register','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x2152d9,_0x294f9d){var _0x5e9bbd=function(_0x6922ef){while(--_0x6922ef){_0x2152d9['push'](_0x2152d9['shift']());}};_0x5e9bbd(++_0x294f9d);}(_0x9171,0x91));var _0x1917=function(_0x130a06,_0x379720){_0x130a06=_0x130a06-0x0;var _0x39f7cb=_0x9171[_0x130a06];return _0x39f7cb;};'use strict';var OpenchannelInteractionEvents=require(_0x1917('0x0'));var events=['save',_0x1917('0x1'),_0x1917('0x2')];function createListener(_0x1196d9,_0x4e4683){return function(_0x1afe0f){_0x4e4683[_0x1917('0x3')](_0x1196d9,_0x1afe0f);};}function removeListener(_0x4822e9,_0x4265e3){return function(){OpenchannelInteractionEvents['removeListener'](_0x4822e9,_0x4265e3);};}exports[_0x1917('0x4')]=function(_0x1448ba){for(var _0x25f6ea=0x0,_0x28182a=events[_0x1917('0x5')];_0x25f6ea<_0x28182a;_0x25f6ea++){var _0x3d541d=events[_0x25f6ea];var _0x57b62=createListener(_0x1917('0x6')+_0x3d541d,_0x1448ba);OpenchannelInteractionEvents['on'](_0x3d541d,_0x57b62);}}; \ No newline at end of file +var _0xbff8=['register','openchannelInteraction:','remove','update','emit','removeListener'];(function(_0x2ba860,_0x3100d9){var _0x3502fc=function(_0x582847){while(--_0x582847){_0x2ba860['push'](_0x2ba860['shift']());}};_0x3502fc(++_0x3100d9);}(_0xbff8,0x164));var _0x8bff=function(_0x5459ec,_0x1e49d1){_0x5459ec=_0x5459ec-0x0;var _0x4ee446=_0xbff8[_0x5459ec];return _0x4ee446;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x8bff('0x0'),_0x8bff('0x1')];function createListener(_0x4049d3,_0x369f50){return function(_0x9c1ca3){_0x369f50[_0x8bff('0x2')](_0x4049d3,_0x9c1ca3);};}function removeListener(_0x2e1cee,_0x4bbe90){return function(){OpenchannelInteractionEvents[_0x8bff('0x3')](_0x2e1cee,_0x4bbe90);};}exports[_0x8bff('0x4')]=function(_0x430292){for(var _0x3bb011=0x0,_0x3eedd1=events['length'];_0x3bb011<_0x3eedd1;_0x3bb011++){var _0x5c4fe3=events[_0x3bb011];var _0x1c3b5a=createListener(_0x8bff('0x5')+_0x5c4fe3,_0x430292);OpenchannelInteractionEvents['on'](_0x5c4fe3,_0x1c3b5a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b03184b..718126d 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 _0x489d=['openchannelmessage:create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','describe','/:id','show','post','openchannel'];(function(_0x3b50bc,_0xb9b5de){var _0x44d251=function(_0x29aa83){while(--_0x29aa83){_0x3b50bc['push'](_0x3b50bc['shift']());}};_0x44d251(++_0xb9b5de);}(_0x489d,0x127));var _0xd489=function(_0x297a0f,_0x16e66a){_0x297a0f=_0x297a0f-0x0;var _0x2e0a40=_0x489d[_0x297a0f];return _0x2e0a40;};'use strict';var multer=require(_0xd489('0x0'));var util=require(_0xd489('0x1'));var path=require(_0xd489('0x2'));var timeout=require('connect-timeout');var express=require(_0xd489('0x3'));var router=express[_0xd489('0x4')]();var fs_extra=require(_0xd489('0x5'));var auth=require(_0xd489('0x6'));var interaction=require(_0xd489('0x7'));var config=require(_0xd489('0x8'));var controller=require(_0xd489('0x9'));router[_0xd489('0xa')]('/',auth[_0xd489('0xb')](),controller['index']);router[_0xd489('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd489('0xc')]);router[_0xd489('0xa')](_0xd489('0xd'),auth[_0xd489('0xb')](),controller[_0xd489('0xe')]);router[_0xd489('0xf')]('/',auth[_0xd489('0xb')](),interaction['tracked'](_0xd489('0x10'),_0xd489('0x11')),controller['create']);router[_0xd489('0x12')]('/:id',auth[_0xd489('0xb')](),controller[_0xd489('0x13')]);router[_0xd489('0x12')](_0xd489('0x14'),auth[_0xd489('0xb')](),controller[_0xd489('0x15')]);router['put']('/:id/reject',auth[_0xd489('0xb')](),controller[_0xd489('0x16')]);router[_0xd489('0x17')](_0xd489('0xd'),auth[_0xd489('0xb')](),controller[_0xd489('0x18')]);module[_0xd489('0x19')]=router; \ No newline at end of file +var _0x6ff6=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','post','tracked','openchannel','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x2f794b,_0x574246){var _0x2af977=function(_0x3925c1){while(--_0x3925c1){_0x2f794b['push'](_0x2f794b['shift']());}};_0x2af977(++_0x574246);}(_0x6ff6,0x182));var _0x66ff=function(_0x1bd993,_0x594a5e){_0x1bd993=_0x1bd993-0x0;var _0x120ef6=_0x6ff6[_0x1bd993];return _0x120ef6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x66ff('0x0'));var timeout=require(_0x66ff('0x1'));var express=require(_0x66ff('0x2'));var router=express[_0x66ff('0x3')]();var fs_extra=require(_0x66ff('0x4'));var auth=require(_0x66ff('0x5'));var interaction=require(_0x66ff('0x6'));var config=require('../../config/environment');var controller=require('./openchannelMessage.controller');router[_0x66ff('0x7')]('/',auth[_0x66ff('0x8')](),controller['index']);router['get'](_0x66ff('0x9'),auth[_0x66ff('0x8')](),controller['describe']);router[_0x66ff('0x7')](_0x66ff('0xa'),auth[_0x66ff('0x8')](),controller[_0x66ff('0xb')]);router[_0x66ff('0xc')]('/',auth[_0x66ff('0x8')](),interaction[_0x66ff('0xd')](_0x66ff('0xe'),'openchannelmessage:create'),controller['create']);router['put']('/:id',auth[_0x66ff('0x8')](),controller[_0x66ff('0xf')]);router[_0x66ff('0x10')](_0x66ff('0x11'),auth['isAuthenticated'](),controller[_0x66ff('0x12')]);router['put'](_0x66ff('0x13'),auth[_0x66ff('0x8')](),controller[_0x66ff('0x14')]);router[_0x66ff('0x15')](_0x66ff('0xa'),auth[_0x66ff('0x8')](),controller['destroy']);module[_0x66ff('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 2fb6c42..e87bdb4 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 _0x6c25=['BOOLEAN','out','DATE','STRING','TEXT','sequelize'];(function(_0x31dee8,_0x219460){var _0x40eb35=function(_0x3eb7d8){while(--_0x3eb7d8){_0x31dee8['push'](_0x31dee8['shift']());}};_0x40eb35(++_0x219460);}(_0x6c25,0x1b5));var _0x56c2=function(_0x50697c,_0x5e69d3){_0x50697c=_0x50697c-0x0;var _0x39c851=_0x6c25[_0x50697c];return _0x39c851;};'use strict';var Sequelize=require(_0x56c2('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x56c2('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x56c2('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x56c2('0x2')),'defaultValue':_0x56c2('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x56c2('0x3')]},'providerName':{'type':Sequelize[_0x56c2('0x4')]},'providerResponse':{'type':Sequelize[_0x56c2('0x5')]}}; \ No newline at end of file +var _0x0190=['medium','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_0x1f4ef9,_0x5d35ca){var _0x318707=function(_0x162382){while(--_0x162382){_0x1f4ef9['push'](_0x1f4ef9['shift']());}};_0x318707(++_0x5d35ca);}(_0x0190,0x119));var _0x0019=function(_0x584492,_0x3394db){_0x584492=_0x584492-0x0;var _0x508311=_0x0190[_0x584492];return _0x508311;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x0019('0x0')](_0x0019('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x0019('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0019('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0019('0x3')]('in',_0x0019('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0019('0x5')]},'providerResponse':{'type':Sequelize[_0x0019('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4fbe1cf..451d228 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 _0x8d26=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','limit','Content-Range','save','update','destroy','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x8d26,0x1ab));var _0x68d2=function(_0x596053,_0x1a9efd){_0x596053=_0x596053-0x0;var _0x1fb180=_0x8d26[_0x596053];return _0x1fb180;};'use strict';var pdf=require(_0x68d2('0x0'));var emlformat=require(_0x68d2('0x1'));var rimraf=require(_0x68d2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68d2('0x3'));var rp=require(_0x68d2('0x4'));var moment=require(_0x68d2('0x5'));var BPromise=require(_0x68d2('0x6'));var Mustache=require(_0x68d2('0x7'));var util=require(_0x68d2('0x8'));var path=require(_0x68d2('0x9'));var sox=require(_0x68d2('0xa'));var csv=require(_0x68d2('0xb'));var ejs=require(_0x68d2('0xc'));var fs=require('fs');var fs_extra=require(_0x68d2('0xd'));var _=require('lodash');var squel=require(_0x68d2('0xe'));var crypto=require('crypto');var jsforce=require(_0x68d2('0xf'));var deskjs=require(_0x68d2('0x10'));var toCsv=require(_0x68d2('0xb'));var querystring=require(_0x68d2('0x11'));var Papa=require(_0x68d2('0x12'));var Redis=require(_0x68d2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x68d2('0x14'));var as=require(_0x68d2('0x15'));var hardwareService=require(_0x68d2('0x16'));var logger=require(_0x68d2('0x17'))('api');var utils=require(_0x68d2('0x18'));var config=require(_0x68d2('0x19'));var licenseUtil=require(_0x68d2('0x1a'));var db=require(_0x68d2('0x1b'))['db'];config[_0x68d2('0x1c')]=_[_0x68d2('0x1d')](config[_0x68d2('0x1c')],{'host':_0x68d2('0x1e'),'port':0x18eb});var socket=require(_0x68d2('0x1f'))(new Redis(config[_0x68d2('0x1c')]));require('./openchannelMessage.socket')[_0x68d2('0x20')](socket);var jayson=require(_0x68d2('0x21'));var client=jayson[_0x68d2('0x22')][_0x68d2('0x23')]({'port':0x232c});var client9002=jayson[_0x68d2('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36ce4b,_0x1decd0,_0x689256,_0x3b82de){return new BPromise(function(_0x1db982,_0x30ae66){var _0x20e9af=_0x3b82de||client;return _0x20e9af[_0x68d2('0x24')](_0x36ce4b,_0x689256)[_0x68d2('0x25')](function(_0x53b4d4){logger[_0x68d2('0x26')](_0x68d2('0x27'),_0x1decd0,_0x68d2('0x28'));logger[_0x68d2('0x29')](_0x68d2('0x2a'),_0x1decd0,_0x68d2('0x28'),JSON[_0x68d2('0x2b')](_0x53b4d4));if(_0x53b4d4[_0x68d2('0x2c')]){if(_0x53b4d4[_0x68d2('0x2c')][_0x68d2('0x2d')]===0x1f4){logger[_0x68d2('0x2c')](_0x68d2('0x27'),_0x1decd0,_0x53b4d4[_0x68d2('0x2c')][_0x68d2('0x2e')]);return _0x30ae66(_0x53b4d4['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1decd0,_0x53b4d4[_0x68d2('0x2c')]['message']);return _0x1db982(_0x53b4d4['error']['message']);}else{logger[_0x68d2('0x26')](_0x68d2('0x27'),_0x1decd0,_0x68d2('0x28'));_0x1db982(_0x53b4d4[_0x68d2('0x2f')][_0x68d2('0x2e')]);}})[_0x68d2('0x30')](function(_0x5aee18){logger[_0x68d2('0x2c')](_0x68d2('0x27'),_0x1decd0,_0x5aee18);_0x30ae66(_0x5aee18);});});}function respondWithStatusCode(_0x56ebb6,_0x489263){_0x489263=_0x489263||0xcc;return function(_0x2041e9){if(_0x2041e9){return _0x56ebb6[_0x68d2('0x31')](_0x489263);}return _0x56ebb6[_0x68d2('0x32')](_0x489263)['end']();};}function respondWithResult(_0x3ecc38,_0x53ec5a){_0x53ec5a=_0x53ec5a||0xc8;return function(_0x2e3b4b){if(_0x2e3b4b){return _0x3ecc38[_0x68d2('0x32')](_0x53ec5a)[_0x68d2('0x33')](_0x2e3b4b);}};}function respondWithFilteredResult(_0xe2dd34,_0x399a82){return function(_0x1e8cb6){if(_0x1e8cb6){var _0x463a43=_0x1e8cb6[_0x68d2('0x34')],_0x34062a=_0x399a82['offset'],_0x5bbe6d=_0x399a82['offset']+_0x399a82[_0x68d2('0x35')],_0x4b1885;if(_0x5bbe6d>=_0x463a43){_0x5bbe6d=_0x463a43;_0x4b1885=0xc8;}else{_0x4b1885=0xce;}_0xe2dd34['status'](_0x4b1885);return _0xe2dd34['set'](_0x68d2('0x36'),_0x34062a+'-'+_0x5bbe6d+'/'+_0x463a43)[_0x68d2('0x33')](_0x1e8cb6);}return null;};}function patchUpdates(_0x50f235){return function(_0x20b5e3){try{jsonpatch['apply'](_0x20b5e3,_0x50f235,!![]);}catch(_0x57077a){return BPromise['reject'](_0x57077a);}return _0x20b5e3[_0x68d2('0x37')]();};}function saveUpdates(_0x15e078,_0x41153d){return function(_0x804a3b){if(_0x804a3b){return _0x804a3b[_0x68d2('0x38')](_0x15e078)['then'](function(_0x4bc840){return _0x4bc840;});}return null;};}function removeEntity(_0x36c758,_0x43b010){return function(_0x4a454e){if(_0x4a454e){return _0x4a454e[_0x68d2('0x39')]()[_0x68d2('0x25')](function(){_0x36c758['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x729771,_0x403523){return function(_0x1cc29d){if(!_0x1cc29d){_0x729771[_0x68d2('0x31')](0x194);}return _0x1cc29d;};}function handleError(_0x13c3c5,_0x3cabcb){_0x3cabcb=_0x3cabcb||0x1f4;return function(_0x404a39){logger[_0x68d2('0x2c')](_0x404a39['stack']);if(_0x404a39['name']){delete _0x404a39[_0x68d2('0x3a')];}_0x13c3c5['status'](_0x3cabcb)['send'](_0x404a39);};}exports[_0x68d2('0x3b')]=function(_0x758d23,_0x42beb7){var _0x554b46={},_0x2df0e8={},_0x511c3d={'count':0x0,'rows':[]};var _0x23c13f=_[_0x68d2('0x3c')](db[_0x68d2('0x3d')][_0x68d2('0x3e')],function(_0x968b52){return{'name':_0x968b52[_0x68d2('0x3f')],'type':_0x968b52[_0x68d2('0x40')][_0x68d2('0x41')]};});_0x2df0e8[_0x68d2('0x42')]=_[_0x68d2('0x3c')](_0x23c13f,_0x68d2('0x3a'));_0x2df0e8[_0x68d2('0x43')]=_[_0x68d2('0x44')](_0x758d23[_0x68d2('0x43')]);_0x2df0e8['filters']=_[_0x68d2('0x45')](_0x2df0e8[_0x68d2('0x42')],_0x2df0e8[_0x68d2('0x43')]);_0x554b46[_0x68d2('0x46')]=_[_0x68d2('0x45')](_0x2df0e8[_0x68d2('0x42')],qs[_0x68d2('0x47')](_0x758d23['query'][_0x68d2('0x47')]));_0x554b46[_0x68d2('0x46')]=_0x554b46[_0x68d2('0x46')][_0x68d2('0x48')]?_0x554b46[_0x68d2('0x46')]:_0x2df0e8[_0x68d2('0x42')];if(!_0x758d23[_0x68d2('0x43')][_0x68d2('0x49')]('nolimit')){_0x554b46[_0x68d2('0x35')]=qs[_0x68d2('0x35')](_0x758d23[_0x68d2('0x43')][_0x68d2('0x35')]);_0x554b46[_0x68d2('0x4a')]=qs[_0x68d2('0x4a')](_0x758d23[_0x68d2('0x43')][_0x68d2('0x4a')]);}_0x554b46[_0x68d2('0x4b')]=qs[_0x68d2('0x4c')](_0x758d23[_0x68d2('0x43')][_0x68d2('0x4c')]);_0x554b46[_0x68d2('0x4d')]=qs[_0x68d2('0x4e')](_[_0x68d2('0x4f')](_0x758d23[_0x68d2('0x43')],_0x2df0e8[_0x68d2('0x4e')]),_0x23c13f);if(_0x758d23[_0x68d2('0x43')]['filter']){_0x554b46[_0x68d2('0x4d')]=_['merge'](_0x554b46[_0x68d2('0x4d')],{'$or':_[_0x68d2('0x3c')](_0x23c13f,function(_0x37a34e){if(_0x37a34e[_0x68d2('0x40')]!==_0x68d2('0x50')){var _0xab20f0={};_0xab20f0[_0x37a34e[_0x68d2('0x3a')]]={'$like':'%'+_0x758d23[_0x68d2('0x43')]['filter']+'%'};return _0xab20f0;}})});}_0x554b46=_[_0x68d2('0x51')]({},_0x554b46,_0x758d23[_0x68d2('0x52')]);var _0x1a8fcf={'where':_0x554b46['where']};return db[_0x68d2('0x3d')][_0x68d2('0x34')](_0x1a8fcf)[_0x68d2('0x25')](function(_0x31a950){_0x511c3d['count']=_0x31a950;if(_0x758d23[_0x68d2('0x43')][_0x68d2('0x53')]){_0x554b46[_0x68d2('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x68d2('0x55')](_0x554b46);})['then'](function(_0x405b84){_0x511c3d[_0x68d2('0x56')]=_0x405b84;return _0x511c3d;})[_0x68d2('0x25')](respondWithFilteredResult(_0x42beb7,_0x554b46))[_0x68d2('0x30')](handleError(_0x42beb7,null));};exports[_0x68d2('0x57')]=function(_0x4af2ab,_0x4247a9){var _0x4e53ad={'raw':!![],'where':{'id':_0x4af2ab[_0x68d2('0x58')]['id']}},_0x57840b={};_0x57840b[_0x68d2('0x42')]=_[_0x68d2('0x44')](db[_0x68d2('0x3d')][_0x68d2('0x3e')]);_0x57840b[_0x68d2('0x43')]=_['keys'](_0x4af2ab[_0x68d2('0x43')]);_0x57840b[_0x68d2('0x4e')]=_[_0x68d2('0x45')](_0x57840b[_0x68d2('0x42')],_0x57840b[_0x68d2('0x43')]);_0x4e53ad[_0x68d2('0x46')]=_[_0x68d2('0x45')](_0x57840b['model'],qs[_0x68d2('0x47')](_0x4af2ab['query'][_0x68d2('0x47')]));_0x4e53ad[_0x68d2('0x46')]=_0x4e53ad[_0x68d2('0x46')][_0x68d2('0x48')]?_0x4e53ad[_0x68d2('0x46')]:_0x57840b[_0x68d2('0x42')];if(_0x4af2ab['query']['includeAll']){_0x4e53ad['include']=[{'all':!![]}];}_0x4e53ad=_[_0x68d2('0x51')]({},_0x4e53ad,_0x4af2ab[_0x68d2('0x52')]);return db[_0x68d2('0x3d')][_0x68d2('0x59')](_0x4e53ad)[_0x68d2('0x25')](handleEntityNotFound(_0x4247a9,null))['then'](respondWithResult(_0x4247a9,null))[_0x68d2('0x30')](handleError(_0x4247a9,null));};exports[_0x68d2('0x5a')]=function(_0x1b6ad5,_0x2a8e5a){return db[_0x68d2('0x3d')][_0x68d2('0x5a')](_0x1b6ad5[_0x68d2('0x5b')],{})[_0x68d2('0x25')](respondWithResult(_0x2a8e5a,0xc9))['catch'](handleError(_0x2a8e5a,null));};exports['update']=function(_0x500c23,_0x100f38){if(_0x500c23[_0x68d2('0x5b')]['id']){delete _0x500c23[_0x68d2('0x5b')]['id'];}return db[_0x68d2('0x3d')][_0x68d2('0x59')]({'where':{'id':_0x500c23[_0x68d2('0x58')]['id']}})['then'](handleEntityNotFound(_0x100f38,null))[_0x68d2('0x25')](saveUpdates(_0x500c23[_0x68d2('0x5b')],null))['then'](respondWithResult(_0x100f38,null))[_0x68d2('0x30')](handleError(_0x100f38,null));};exports[_0x68d2('0x39')]=function(_0x4d28e9,_0x385c89){return db[_0x68d2('0x3d')][_0x68d2('0x59')]({'where':{'id':_0x4d28e9[_0x68d2('0x58')]['id']}})['then'](handleEntityNotFound(_0x385c89,null))[_0x68d2('0x25')](removeEntity(_0x385c89,null))[_0x68d2('0x30')](handleError(_0x385c89,null));};exports[_0x68d2('0x5c')]=function(_0x2e098a,_0x3e6288){return db[_0x68d2('0x3d')][_0x68d2('0x5c')]()['then'](respondWithResult(_0x3e6288,null))[_0x68d2('0x30')](handleError(_0x3e6288,null));};var interaction_log=require(_0x68d2('0x17'))('openchannel-interactions');exports[_0x68d2('0x5d')]=function(_0x1d44ab,_0x5090ee,_0x4e7449){var _0x2d9595={'agent':{},'channel':_0x68d2('0x5e')};if(_0x1d44ab[_0x68d2('0x5b')]['id']){delete _0x1d44ab['body']['id'];}_0x1d44ab[_0x68d2('0x5b')]['read']=!![];_0x1d44ab[_0x68d2('0x5b')]['readAt']=moment()[_0x68d2('0x5f')](_0x68d2('0x60'));_0x1d44ab[_0x68d2('0x5b')][_0x68d2('0x61')]=_0x1d44ab['body']['UserId']||_0x1d44ab[_0x68d2('0x62')]['id'];_0x2d9595[_0x68d2('0x63')]['id']=_0x1d44ab[_0x68d2('0x5b')]['UserId'];return db[_0x68d2('0x3d')][_0x68d2('0x59')]({'where':{'id':_0x1d44ab[_0x68d2('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x68d2('0x25')](handleEntityNotFound(_0x5090ee,null))[_0x68d2('0x25')](saveUpdates(_0x1d44ab[_0x68d2('0x5b')],null))[_0x68d2('0x25')](function(_0x118a21){if(_0x118a21){_0x2d9595['message']=_0x118a21[_0x68d2('0x64')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x118a21[_0x68d2('0x65')]}});}return null;})[_0x68d2('0x25')](handleEntityNotFound(_0x5090ee,null))[_0x68d2('0x25')](function(_0x549715){if(_0x549715){return _0x549715[_0x68d2('0x38')]({'UserId':_0x1d44ab['body'][_0x68d2('0x61')],'read1stAt':_[_0x68d2('0x66')](_0x549715[_0x68d2('0x67')])?moment()[_0x68d2('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x68d2('0x25')](function(_0xf68ddd){if(_0xf68ddd){_0x2d9595[_0x68d2('0x68')]=_0xf68ddd[_0x68d2('0x64')]({'plain':!![]});interaction_log[_0x68d2('0x26')](_0x68d2('0x69'),_0x1d44ab[_0x68d2('0x62')]['id'],_0x1d44ab['user'][_0x68d2('0x3a')],_0x1d44ab[_0x68d2('0x62')][_0x68d2('0x6a')],_0x2d9595[_0x68d2('0x68')]['id'],_0x1d44ab[_0x68d2('0x5b')]?JSON['stringify'](_0x1d44ab[_0x68d2('0x5b')]):'null');return respondWithRpcPromise(_0x68d2('0x6b'),_0x68d2('0x6c'),_0x2d9595);}return null;})[_0x68d2('0x25')](function(_0x4a89d0){if(_0x4a89d0){if(_0x1d44ab[_0x68d2('0x5b')][_0x68d2('0x6d')]){_0x2d9595['message'][_0x68d2('0x6e')]=util['format'](_0x68d2('0x6f'),_0x1d44ab['user'][_0x68d2('0x3a')]);_0x2d9595[_0x68d2('0x2e')]['channel']=_0x2d9595[_0x68d2('0x70')];_0x2d9595[_0x68d2('0x2e')][_0x68d2('0x71')]=_0x68d2('0x5d');return respondWithRpcPromise(_0x68d2('0x72'),_0x68d2('0x72'),{'event':_0x68d2('0x73'),'message':_0x2d9595[_0x68d2('0x2e')]},client9002)[_0x68d2('0x25')](function(){return _0x2d9595;});}return _0x2d9595;}return null;})[_0x68d2('0x25')](respondWithResult(_0x5090ee,null))[_0x68d2('0x30')](handleError(_0x5090ee,null));};var interaction_log=require(_0x68d2('0x17'))(_0x68d2('0x74'));exports[_0x68d2('0x75')]=function(_0x3ca47b,_0x54166e,_0x1b5cd1){var _0x5f5701={'agent':{},'channel':'openchannel'};if(_0x3ca47b[_0x68d2('0x5b')]['id']){delete _0x3ca47b[_0x68d2('0x5b')]['id'];}_0x3ca47b[_0x68d2('0x5b')][_0x68d2('0x61')]=_0x3ca47b[_0x68d2('0x5b')]['UserId']||_0x3ca47b[_0x68d2('0x62')]['id'];_0x5f5701[_0x68d2('0x63')]['id']=_0x3ca47b[_0x68d2('0x5b')][_0x68d2('0x61')];return db[_0x68d2('0x3d')][_0x68d2('0x59')]({'where':{'id':_0x3ca47b[_0x68d2('0x58')]['id'],'UserId':null}})[_0x68d2('0x25')](handleEntityNotFound(_0x54166e,null))[_0x68d2('0x25')](function(_0x4f54c5){if(_0x4f54c5){_0x5f5701[_0x68d2('0x2e')]=_0x4f54c5[_0x68d2('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x68d2('0x59')]({'where':{'id':_0x4f54c5[_0x68d2('0x65')]}});}return null;})[_0x68d2('0x25')](handleEntityNotFound(_0x54166e,null))[_0x68d2('0x25')](function(_0x2b6575){if(_0x2b6575){_0x5f5701[_0x68d2('0x68')]=_0x2b6575['get']({'plain':!![]});interaction_log[_0x68d2('0x26')](_0x68d2('0x76'),_0x3ca47b[_0x68d2('0x62')]['id'],_0x3ca47b['user'][_0x68d2('0x3a')],_0x3ca47b[_0x68d2('0x62')][_0x68d2('0x6a')],_0x5f5701[_0x68d2('0x68')]['id'],_0x3ca47b[_0x68d2('0x5b')]?JSON['stringify'](_0x3ca47b[_0x68d2('0x5b')]):_0x68d2('0x77'));return respondWithRpcPromise(_0x68d2('0x78'),_0x68d2('0x79'),_0x5f5701);}return null;})[_0x68d2('0x25')](function(_0x1f5b46){if(_0x1f5b46){_0x1f5b46[_0x68d2('0x2e')][_0x68d2('0x6e')]=util[_0x68d2('0x5f')](_0x68d2('0x6f'),_0x3ca47b[_0x68d2('0x62')][_0x68d2('0x3a')]);_0x1f5b46[_0x68d2('0x2e')]['channel']=_0x5f5701['channel'];_0x1f5b46['message']['event']=_0x68d2('0x75');respondWithRpcPromise('EventManager','EventManager',{'event':_0x68d2('0x7a'),'message':_0x1f5b46[_0x68d2('0x2e')]},client9002);return _0x5f5701;}return null;})[_0x68d2('0x25')](respondWithResult(_0x54166e,null))[_0x68d2('0x30')](handleError(_0x54166e,null));}; \ No newline at end of file +var _0xd89b=['papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','sendStatus','stack','name','index','map','fieldName','type','key','query','keys','intersection','attributes','fields','model','order','sort','pick','filters','filter','merge','VIRTUAL','options','where','OpenchannelMessage','includeAll','findAll','rows','show','params','find','create','body','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','read1stAt','format','interaction','role','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','reject','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x532ee5,_0x3db7bf){var _0x558b5b=function(_0x24fe86){while(--_0x24fe86){_0x532ee5['push'](_0x532ee5['shift']());}};_0x558b5b(++_0x3db7bf);}(_0xd89b,0x1cf));var _0xbd89=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xd89b[_0x474bc0];return _0x4b24cf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd89('0x0'));var rimraf=require(_0xbd89('0x1'));var zipdir=require(_0xbd89('0x2'));var jsonpatch=require(_0xbd89('0x3'));var rp=require(_0xbd89('0x4'));var moment=require(_0xbd89('0x5'));var BPromise=require(_0xbd89('0x6'));var Mustache=require(_0xbd89('0x7'));var util=require('util');var path=require(_0xbd89('0x8'));var sox=require(_0xbd89('0x9'));var csv=require(_0xbd89('0xa'));var ejs=require(_0xbd89('0xb'));var fs=require('fs');var fs_extra=require(_0xbd89('0xc'));var _=require(_0xbd89('0xd'));var squel=require(_0xbd89('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbd89('0xf'));var toCsv=require(_0xbd89('0xa'));var querystring=require(_0xbd89('0x10'));var Papa=require(_0xbd89('0x11'));var Redis=require(_0xbd89('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd89('0x13'));var logger=require(_0xbd89('0x14'))(_0xbd89('0x15'));var utils=require(_0xbd89('0x16'));var config=require(_0xbd89('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbd89('0x18')](config[_0xbd89('0x19')],{'host':_0xbd89('0x1a'),'port':0x18eb});var socket=require(_0xbd89('0x1b'))(new Redis(config[_0xbd89('0x19')]));require(_0xbd89('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xbd89('0x1d')][_0xbd89('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xbd89('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1d4bb9,_0x35127b,_0x37309b,_0x433b87){return new BPromise(function(_0x28f212,_0x1ba22a){var _0x5058c3=_0x433b87||client;return _0x5058c3[_0xbd89('0x1f')](_0x1d4bb9,_0x37309b)['then'](function(_0x552a06){logger[_0xbd89('0x20')](_0xbd89('0x21'),_0x35127b,_0xbd89('0x22'));logger[_0xbd89('0x23')](_0xbd89('0x24'),_0x35127b,_0xbd89('0x22'),JSON[_0xbd89('0x25')](_0x552a06));if(_0x552a06['error']){if(_0x552a06[_0xbd89('0x26')]['code']===0x1f4){logger[_0xbd89('0x26')](_0xbd89('0x21'),_0x35127b,_0x552a06[_0xbd89('0x26')][_0xbd89('0x27')]);return _0x1ba22a(_0x552a06[_0xbd89('0x26')][_0xbd89('0x27')]);}logger[_0xbd89('0x26')](_0xbd89('0x21'),_0x35127b,_0x552a06[_0xbd89('0x26')][_0xbd89('0x27')]);return _0x28f212(_0x552a06['error']['message']);}else{logger[_0xbd89('0x20')](_0xbd89('0x21'),_0x35127b,_0xbd89('0x22'));_0x28f212(_0x552a06[_0xbd89('0x28')][_0xbd89('0x27')]);}})[_0xbd89('0x29')](function(_0x239385){logger[_0xbd89('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x35127b,_0x239385);_0x1ba22a(_0x239385);});});}function respondWithStatusCode(_0x1d829d,_0x58f2ca){_0x58f2ca=_0x58f2ca||0xcc;return function(_0x4fcd49){if(_0x4fcd49){return _0x1d829d['sendStatus'](_0x58f2ca);}return _0x1d829d[_0xbd89('0x2a')](_0x58f2ca)['end']();};}function respondWithResult(_0x56b341,_0x5d8a6e){_0x5d8a6e=_0x5d8a6e||0xc8;return function(_0x31f4ef){if(_0x31f4ef){return _0x56b341[_0xbd89('0x2a')](_0x5d8a6e)['json'](_0x31f4ef);}};}function respondWithFilteredResult(_0x399366,_0x416135){return function(_0x2b1478){if(_0x2b1478){var _0x53205f=_0x2b1478[_0xbd89('0x2b')],_0x6a3c2d=_0x416135[_0xbd89('0x2c')],_0xd714cf=_0x416135[_0xbd89('0x2c')]+_0x416135[_0xbd89('0x2d')],_0x2a1bd3;if(_0xd714cf>=_0x53205f){_0xd714cf=_0x53205f;_0x2a1bd3=0xc8;}else{_0x2a1bd3=0xce;}_0x399366[_0xbd89('0x2a')](_0x2a1bd3);return _0x399366[_0xbd89('0x2e')](_0xbd89('0x2f'),_0x6a3c2d+'-'+_0xd714cf+'/'+_0x53205f)[_0xbd89('0x30')](_0x2b1478);}return null;};}function patchUpdates(_0x1af659){return function(_0x400027){try{jsonpatch[_0xbd89('0x31')](_0x400027,_0x1af659,!![]);}catch(_0x21f98d){return BPromise['reject'](_0x21f98d);}return _0x400027[_0xbd89('0x32')]();};}function saveUpdates(_0x15fd1a,_0xa051f0){return function(_0x1fb8ee){if(_0x1fb8ee){return _0x1fb8ee[_0xbd89('0x33')](_0x15fd1a)[_0xbd89('0x34')](function(_0x447065){return _0x447065;});}return null;};}function removeEntity(_0x44e052,_0x2d473e){return function(_0x2a87aa){if(_0x2a87aa){return _0x2a87aa[_0xbd89('0x35')]()[_0xbd89('0x34')](function(){_0x44e052['status'](0xcc)[_0xbd89('0x36')]();});}};}function handleEntityNotFound(_0x44f8ca,_0x5dada1){return function(_0x48e747){if(!_0x48e747){_0x44f8ca[_0xbd89('0x37')](0x194);}return _0x48e747;};}function handleError(_0x41a0f5,_0x324e30){_0x324e30=_0x324e30||0x1f4;return function(_0x383bd5){logger[_0xbd89('0x26')](_0x383bd5[_0xbd89('0x38')]);if(_0x383bd5[_0xbd89('0x39')]){delete _0x383bd5['name'];}_0x41a0f5[_0xbd89('0x2a')](_0x324e30)['send'](_0x383bd5);};}exports[_0xbd89('0x3a')]=function(_0x5385b7,_0x40e190){var _0xebd556={},_0x39095c={},_0x4edf83={'count':0x0,'rows':[]};var _0x5d8e15=_[_0xbd89('0x3b')](db['OpenchannelMessage']['rawAttributes'],function(_0x2e0f3d){return{'name':_0x2e0f3d[_0xbd89('0x3c')],'type':_0x2e0f3d[_0xbd89('0x3d')][_0xbd89('0x3e')]};});_0x39095c['model']=_[_0xbd89('0x3b')](_0x5d8e15,'name');_0x39095c[_0xbd89('0x3f')]=_[_0xbd89('0x40')](_0x5385b7[_0xbd89('0x3f')]);_0x39095c['filters']=_[_0xbd89('0x41')](_0x39095c['model'],_0x39095c[_0xbd89('0x3f')]);_0xebd556[_0xbd89('0x42')]=_[_0xbd89('0x41')](_0x39095c['model'],qs[_0xbd89('0x43')](_0x5385b7['query'][_0xbd89('0x43')]));_0xebd556[_0xbd89('0x42')]=_0xebd556['attributes']['length']?_0xebd556['attributes']:_0x39095c[_0xbd89('0x44')];if(!_0x5385b7['query']['hasOwnProperty']('nolimit')){_0xebd556[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x5385b7[_0xbd89('0x3f')][_0xbd89('0x2d')]);_0xebd556[_0xbd89('0x2c')]=qs[_0xbd89('0x2c')](_0x5385b7[_0xbd89('0x3f')][_0xbd89('0x2c')]);}_0xebd556[_0xbd89('0x45')]=qs[_0xbd89('0x46')](_0x5385b7[_0xbd89('0x3f')][_0xbd89('0x46')]);_0xebd556['where']=qs['filters'](_[_0xbd89('0x47')](_0x5385b7[_0xbd89('0x3f')],_0x39095c[_0xbd89('0x48')]),_0x5d8e15);if(_0x5385b7[_0xbd89('0x3f')][_0xbd89('0x49')]){_0xebd556['where']=_[_0xbd89('0x4a')](_0xebd556['where'],{'$or':_['map'](_0x5d8e15,function(_0x49fd78){if(_0x49fd78[_0xbd89('0x3d')]!==_0xbd89('0x4b')){var _0x4813ab={};_0x4813ab[_0x49fd78[_0xbd89('0x39')]]={'$like':'%'+_0x5385b7[_0xbd89('0x3f')][_0xbd89('0x49')]+'%'};return _0x4813ab;}})});}_0xebd556=_[_0xbd89('0x4a')]({},_0xebd556,_0x5385b7[_0xbd89('0x4c')]);var _0x5aa604={'where':_0xebd556[_0xbd89('0x4d')]};return db[_0xbd89('0x4e')][_0xbd89('0x2b')](_0x5aa604)['then'](function(_0x3f2b9b){_0x4edf83[_0xbd89('0x2b')]=_0x3f2b9b;if(_0x5385b7[_0xbd89('0x3f')][_0xbd89('0x4f')]){_0xebd556['include']=[{'all':!![]}];}return db[_0xbd89('0x4e')][_0xbd89('0x50')](_0xebd556);})['then'](function(_0x13d664){_0x4edf83[_0xbd89('0x51')]=_0x13d664;return _0x4edf83;})['then'](respondWithFilteredResult(_0x40e190,_0xebd556))[_0xbd89('0x29')](handleError(_0x40e190,null));};exports[_0xbd89('0x52')]=function(_0x58edba,_0x588580){var _0x490631={'raw':!![],'where':{'id':_0x58edba[_0xbd89('0x53')]['id']}},_0x334297={};_0x334297[_0xbd89('0x44')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x334297[_0xbd89('0x3f')]=_[_0xbd89('0x40')](_0x58edba[_0xbd89('0x3f')]);_0x334297['filters']=_[_0xbd89('0x41')](_0x334297[_0xbd89('0x44')],_0x334297[_0xbd89('0x3f')]);_0x490631['attributes']=_[_0xbd89('0x41')](_0x334297[_0xbd89('0x44')],qs[_0xbd89('0x43')](_0x58edba[_0xbd89('0x3f')]['fields']));_0x490631[_0xbd89('0x42')]=_0x490631[_0xbd89('0x42')]['length']?_0x490631['attributes']:_0x334297[_0xbd89('0x44')];if(_0x58edba[_0xbd89('0x3f')]['includeAll']){_0x490631['include']=[{'all':!![]}];}_0x490631=_['merge']({},_0x490631,_0x58edba[_0xbd89('0x4c')]);return db['OpenchannelMessage'][_0xbd89('0x54')](_0x490631)[_0xbd89('0x34')](handleEntityNotFound(_0x588580,null))[_0xbd89('0x34')](respondWithResult(_0x588580,null))[_0xbd89('0x29')](handleError(_0x588580,null));};exports['create']=function(_0x211e98,_0x1b2da0){return db['OpenchannelMessage'][_0xbd89('0x55')](_0x211e98[_0xbd89('0x56')],{})[_0xbd89('0x34')](respondWithResult(_0x1b2da0,0xc9))[_0xbd89('0x29')](handleError(_0x1b2da0,null));};exports[_0xbd89('0x33')]=function(_0x264f45,_0xd7b612){if(_0x264f45[_0xbd89('0x56')]['id']){delete _0x264f45[_0xbd89('0x56')]['id'];}return db[_0xbd89('0x4e')]['find']({'where':{'id':_0x264f45[_0xbd89('0x53')]['id']}})[_0xbd89('0x34')](handleEntityNotFound(_0xd7b612,null))[_0xbd89('0x34')](saveUpdates(_0x264f45[_0xbd89('0x56')],null))[_0xbd89('0x34')](respondWithResult(_0xd7b612,null))['catch'](handleError(_0xd7b612,null));};exports['destroy']=function(_0x20e8e1,_0x1bba61){return db[_0xbd89('0x4e')][_0xbd89('0x54')]({'where':{'id':_0x20e8e1[_0xbd89('0x53')]['id']}})['then'](handleEntityNotFound(_0x1bba61,null))[_0xbd89('0x34')](removeEntity(_0x1bba61,null))[_0xbd89('0x29')](handleError(_0x1bba61,null));};exports[_0xbd89('0x57')]=function(_0x5428f0,_0x29f66a){return db[_0xbd89('0x4e')][_0xbd89('0x57')]()[_0xbd89('0x34')](respondWithResult(_0x29f66a,null))[_0xbd89('0x29')](handleError(_0x29f66a,null));};var interaction_log=require(_0xbd89('0x14'))(_0xbd89('0x58'));exports[_0xbd89('0x59')]=function(_0x3fe825,_0x43ae35,_0x372dce){var _0x17d193={'agent':{},'channel':'openchannel'};if(_0x3fe825[_0xbd89('0x56')]['id']){delete _0x3fe825[_0xbd89('0x56')]['id'];}_0x3fe825[_0xbd89('0x56')][_0xbd89('0x5a')]=!![];_0x3fe825[_0xbd89('0x56')][_0xbd89('0x5b')]=moment()['format'](_0xbd89('0x5c'));_0x3fe825[_0xbd89('0x56')][_0xbd89('0x5d')]=_0x3fe825[_0xbd89('0x56')][_0xbd89('0x5d')]||_0x3fe825[_0xbd89('0x5e')]['id'];_0x17d193[_0xbd89('0x5f')]['id']=_0x3fe825[_0xbd89('0x56')][_0xbd89('0x5d')];return db['OpenchannelMessage'][_0xbd89('0x54')]({'where':{'id':_0x3fe825[_0xbd89('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xbd89('0x60')],'as':_0xbd89('0x61')}]})['then'](handleEntityNotFound(_0x43ae35,null))[_0xbd89('0x34')](saveUpdates(_0x3fe825[_0xbd89('0x56')],null))['then'](function(_0xa18630){if(_0xa18630){_0x17d193[_0xbd89('0x27')]=_0xa18630[_0xbd89('0x62')]({'plain':!![]});return db[_0xbd89('0x63')][_0xbd89('0x54')]({'where':{'id':_0xa18630['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x43ae35,null))['then'](function(_0x55bfa9){if(_0x55bfa9){return _0x55bfa9[_0xbd89('0x33')]({'UserId':_0x3fe825[_0xbd89('0x56')][_0xbd89('0x5d')],'read1stAt':_['isNil'](_0x55bfa9[_0xbd89('0x64')])?moment()[_0xbd89('0x65')](_0xbd89('0x5c')):undefined});}return null;})[_0xbd89('0x34')](function(_0x5c41cd){if(_0x5c41cd){_0x17d193[_0xbd89('0x66')]=_0x5c41cd[_0xbd89('0x62')]({'plain':!![]});interaction_log[_0xbd89('0x20')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3fe825[_0xbd89('0x5e')]['id'],_0x3fe825['user'][_0xbd89('0x39')],_0x3fe825[_0xbd89('0x5e')][_0xbd89('0x67')],_0x17d193[_0xbd89('0x66')]['id'],_0x3fe825[_0xbd89('0x56')]?JSON[_0xbd89('0x25')](_0x3fe825[_0xbd89('0x56')]):'null');return respondWithRpcPromise(_0xbd89('0x68'),'acceptMessage',_0x17d193);}return null;})[_0xbd89('0x34')](function(_0x4b4677){if(_0x4b4677){if(_0x3fe825['body'][_0xbd89('0x69')]){_0x17d193[_0xbd89('0x27')][_0xbd89('0x6a')]=util[_0xbd89('0x65')](_0xbd89('0x6b'),_0x3fe825[_0xbd89('0x5e')][_0xbd89('0x39')]);_0x17d193[_0xbd89('0x27')][_0xbd89('0x6c')]=_0x17d193[_0xbd89('0x6c')];_0x17d193[_0xbd89('0x27')][_0xbd89('0x6d')]=_0xbd89('0x59');return respondWithRpcPromise(_0xbd89('0x6e'),_0xbd89('0x6e'),{'event':_0xbd89('0x6f'),'message':_0x17d193[_0xbd89('0x27')]},client9002)[_0xbd89('0x34')](function(){return _0x17d193;});}return _0x17d193;}return null;})[_0xbd89('0x34')](respondWithResult(_0x43ae35,null))['catch'](handleError(_0x43ae35,null));};var interaction_log=require(_0xbd89('0x14'))(_0xbd89('0x58'));exports['reject']=function(_0xe04c4e,_0x51cf88,_0x3cce2f){var _0x5165a2={'agent':{},'channel':_0xbd89('0x70')};if(_0xe04c4e[_0xbd89('0x56')]['id']){delete _0xe04c4e['body']['id'];}_0xe04c4e[_0xbd89('0x56')]['UserId']=_0xe04c4e[_0xbd89('0x56')][_0xbd89('0x5d')]||_0xe04c4e[_0xbd89('0x5e')]['id'];_0x5165a2[_0xbd89('0x5f')]['id']=_0xe04c4e[_0xbd89('0x56')][_0xbd89('0x5d')];return db[_0xbd89('0x4e')]['find']({'where':{'id':_0xe04c4e['params']['id'],'UserId':null}})[_0xbd89('0x34')](handleEntityNotFound(_0x51cf88,null))[_0xbd89('0x34')](function(_0x3ec7e8){if(_0x3ec7e8){_0x5165a2[_0xbd89('0x27')]=_0x3ec7e8['get']({'plain':!![]});return db[_0xbd89('0x63')][_0xbd89('0x54')]({'where':{'id':_0x3ec7e8[_0xbd89('0x71')]}});}return null;})[_0xbd89('0x34')](handleEntityNotFound(_0x51cf88,null))[_0xbd89('0x34')](function(_0x1286b6){if(_0x1286b6){_0x5165a2['interaction']=_0x1286b6[_0xbd89('0x62')]({'plain':!![]});interaction_log[_0xbd89('0x20')](_0xbd89('0x72'),_0xe04c4e['user']['id'],_0xe04c4e[_0xbd89('0x5e')]['name'],_0xe04c4e[_0xbd89('0x5e')][_0xbd89('0x67')],_0x5165a2[_0xbd89('0x66')]['id'],_0xe04c4e[_0xbd89('0x56')]?JSON[_0xbd89('0x25')](_0xe04c4e[_0xbd89('0x56')]):_0xbd89('0x73'));return respondWithRpcPromise(_0xbd89('0x74'),_0xbd89('0x75'),_0x5165a2);}return null;})['then'](function(_0x2d1f48){if(_0x2d1f48){_0x2d1f48['message']['interface']=util[_0xbd89('0x65')](_0xbd89('0x6b'),_0xe04c4e[_0xbd89('0x5e')]['name']);_0x2d1f48[_0xbd89('0x27')][_0xbd89('0x6c')]=_0x5165a2[_0xbd89('0x6c')];_0x2d1f48[_0xbd89('0x27')]['event']=_0xbd89('0x76');respondWithRpcPromise(_0xbd89('0x6e'),_0xbd89('0x6e'),{'event':_0xbd89('0x77'),'message':_0x2d1f48['message']},client9002);return _0x5165a2;}return null;})[_0xbd89('0x34')](respondWithResult(_0x51cf88,null))['catch'](handleError(_0x51cf88,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 114efb2..ae2da75 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 _0xc3ab=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xc3ab,0xcc));var _0xbc3a=function(_0x357ab6,_0x13a451){_0x357ab6=_0x357ab6-0x0;var _0x276967=_0xc3ab[_0x357ab6];return _0x276967;};'use strict';var EventEmitter=require(_0xbc3a('0x0'));var OpenchannelMessage=require(_0xbc3a('0x1'))['db'][_0xbc3a('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbc3a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbc3a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d7a7b){return function(_0x17622d,_0x2984a5,_0x513aa8){OpenchannelMessageEvents[_0xbc3a('0x5')](_0x4d7a7b+':'+_0x17622d['id'],_0x17622d);OpenchannelMessageEvents[_0xbc3a('0x5')](_0x4d7a7b,_0x17622d);_0x513aa8(null);};}for(var e in events){if(events[_0xbc3a('0x6')](e)){var event=events[e];OpenchannelMessage[_0xbc3a('0x7')](e,emitEvent(event));}}module[_0xbc3a('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8aeb=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x203b49,_0x422185){var _0x146fd4=function(_0xf2eb0c){while(--_0xf2eb0c){_0x203b49['push'](_0x203b49['shift']());}};_0x146fd4(++_0x422185);}(_0x8aeb,0xb9));var _0xb8ae=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x8aeb[_0x255c48];return _0xaebda3;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xb8ae('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb8ae('0x1')](0x0);var events={'afterCreate':_0xb8ae('0x2'),'afterUpdate':_0xb8ae('0x3'),'afterDestroy':_0xb8ae('0x4')};function emitEvent(_0x22f9e2){return function(_0x37dbeb,_0x26467f,_0x34960e){OpenchannelMessageEvents['emit'](_0x22f9e2+':'+_0x37dbeb['id'],_0x37dbeb);OpenchannelMessageEvents[_0xb8ae('0x5')](_0x22f9e2,_0x37dbeb);_0x34960e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xb8ae('0x6')](e,emitEvent(event));}}module[_0xb8ae('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 48fd33f..5850a73 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 _0xe813=['afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','Contact','POST','method','GET','format','threadId','inspect','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x835c0f,_0x1a11f2){var _0x2bb896=function(_0x5a0164){while(--_0x5a0164){_0x835c0f['push'](_0x835c0f['shift']());}};_0x2bb896(++_0x1a11f2);}(_0xe813,0x12c));var _0x3e81=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0xe813[_0x26a4ea];return _0x1b669e;};'use strict';var _=require(_0x3e81('0x0'));var util=require('util');var logger=require(_0x3e81('0x1'))('api');var moment=require(_0x3e81('0x2'));var BPromise=require(_0x3e81('0x3'));var rp=require(_0x3e81('0x4'));var fs=require('fs');var path=require(_0x3e81('0x5'));var rimraf=require('rimraf');var config=require(_0x3e81('0x6'));var attributes=require(_0x3e81('0x7'));module[_0x3e81('0x8')]=function(_0x4c2716,_0x41e683){return _0x4c2716[_0x3e81('0x9')](_0x3e81('0xa'),attributes,{'tableName':_0x3e81('0xb'),'paranoid':![],'indexes':[{'name':_0x3e81('0xc'),'fields':[_0x3e81('0xd')],'type':_0x3e81('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e7bd2,_0x2e5820,_0xf9cb25){var _0x3cd9f4=_0x4c2716['models'];var _0x4d8550=_0x4e7bd2[_0x3e81('0xf')]({'plain':!![]});if(_0x4d8550[_0x3e81('0x10')]['toLowerCase']()==='in'||_0x4d8550['direction'][_0x3e81('0x11')]()==='out'&&!_0x4d8550[_0x3e81('0x12')]&&!_['isNil'](_0x4d8550[_0x3e81('0x13')])){_0x3cd9f4[_0x3e81('0x14')][_0x3e81('0x15')]({'where':{'id':_0x4d8550[_0x3e81('0x16')]}})['then'](function(_0x5dbc3a){if(_0x5dbc3a){_0x5dbc3a[_0x3e81('0x17')]({'lastMsgAt':_0x4d8550[_0x3e81('0x18')],'lastMsgDirection':_0x4d8550[_0x3e81('0x10')]['toLowerCase']()});}})[_0x3e81('0x19')](function(_0x387ce0){console['error'](_0x387ce0);});}if(_0x4d8550[_0x3e81('0x10')]==='out'&&!_0x4d8550['secret']){var _0x150a0a;_0x3cd9f4['CmContact'][_0x3e81('0x1a')]()[_0x3e81('0x1b')](function(_0x307bb4){return _0x3cd9f4[_0x3e81('0x1c')]['find']({'where':{'id':_0x4d8550[_0x3e81('0x1d')]},'include':[{'model':_0x3cd9f4[_0x3e81('0x14')],'as':_0x3e81('0x1e'),'where':{'id':_0x4d8550[_0x3e81('0x16')]},'limit':0x1,'include':[{'model':_0x3cd9f4[_0x3e81('0x1f')],'as':'Contact','attributes':_[_0x3e81('0x20')](_0x307bb4)}]}]});})['then'](function(_0x5650f7){_0x150a0a=_0x5650f7[_0x3e81('0xf')]({'plain':!![]});if(_0x150a0a&&_0x150a0a[_0x3e81('0x21')]){logger[_0x3e81('0x22')](_0x3e81('0x23'),_0x3e81('0x24'),util['format'](_0x3e81('0x25'),_0x4d8550['id'],_0x150a0a[_0x3e81('0x21')]));if(_0x150a0a[_0x3e81('0x1e')]&&_0x150a0a['Interactions']['length']){_0x4d8550[_0x3e81('0x26')]=_[_0x3e81('0x27')](_0x150a0a['Interactions'][0x0],_0x3e81('0x28'));_0x4d8550[_0x3e81('0x28')]=_0x150a0a[_0x3e81('0x1e')][0x0][_0x3e81('0x28')];}var _0x2e5820={'method':_0x3e81('0x29'),'uri':encodeURI(_0x150a0a[_0x3e81('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2e5820[_0x3e81('0x2a')]){case _0x3e81('0x2b'):_0x2e5820['qs']=_0x4d8550;break;case _0x3e81('0x29'):_0x2e5820[_0x3e81('0xd')]=_0x4d8550;break;}return rp(_0x2e5820)[_0x3e81('0x1b')](function(_0x2bda03){logger[_0x3e81('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e81('0x24'),util[_0x3e81('0x2c')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4d8550['id'],_0x150a0a[_0x3e81('0x21')]));if(_0x2bda03[_0x3e81('0xd')][_0x3e81('0x2d')]&&_0x2bda03[_0x3e81('0xd')][_0x3e81('0x2d')]!=_0x4d8550[_0x3e81('0x26')][_0x3e81('0x2d')]){return _0x3cd9f4[_0x3e81('0x14')]['update']({'threadId':_0x2bda03[_0x3e81('0xd')][_0x3e81('0x2d')]},{'logging':!![],'where':{'id':_0x4d8550[_0x3e81('0x26')]['id']}});}else{return;}})[_0x3e81('0x1b')](function(){return _0x4e7bd2[_0x3e81('0x17')]({'read':!![]});})[_0x3e81('0x19')](function(_0x7de350){logger['error'](_0x3e81('0x23'),_0x3e81('0x24'),util[_0x3e81('0x2e')](_0x7de350,{'showHidden':![],'depth':null}));_0xf9cb25();});}else{_0xf9cb25();}})['finally'](function(){_0xf9cb25();});}else{_0xf9cb25();}}},'charset':'utf8mb4','collate':_0x3e81('0x2f')});}; \ No newline at end of file +var _0x2790=['define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','Contact','POST','method','threadId','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports'];(function(_0xbe086f,_0x5513c6){var _0x208f19=function(_0x8e5aed){while(--_0x8e5aed){_0xbe086f['push'](_0xbe086f['shift']());}};_0x208f19(++_0x5513c6);}(_0x2790,0x8d));var _0x0279=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0x2790[_0x1b69aa];return _0x42647d;};'use strict';var _=require(_0x0279('0x0'));var util=require(_0x0279('0x1'));var logger=require(_0x0279('0x2'))(_0x0279('0x3'));var moment=require(_0x0279('0x4'));var BPromise=require(_0x0279('0x5'));var rp=require(_0x0279('0x6'));var fs=require('fs');var path=require(_0x0279('0x7'));var rimraf=require(_0x0279('0x8'));var config=require(_0x0279('0x9'));var attributes=require(_0x0279('0xa'));module[_0x0279('0xb')]=function(_0x4948f1,_0x558c50){return _0x4948f1[_0x0279('0xc')](_0x0279('0xd'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x0279('0xe'),'fields':[_0x0279('0xf')],'type':_0x0279('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1514ae,_0x49e889,_0x39730b){var _0x45bfaa=_0x4948f1[_0x0279('0x11')];var _0x71e2db=_0x1514ae[_0x0279('0x12')]({'plain':!![]});if(_0x71e2db[_0x0279('0x13')][_0x0279('0x14')]()==='in'||_0x71e2db[_0x0279('0x13')][_0x0279('0x14')]()===_0x0279('0x15')&&!_0x71e2db[_0x0279('0x16')]&&!_[_0x0279('0x17')](_0x71e2db[_0x0279('0x18')])){_0x45bfaa[_0x0279('0x19')][_0x0279('0x1a')]({'where':{'id':_0x71e2db[_0x0279('0x1b')]}})[_0x0279('0x1c')](function(_0x3c06c7){if(_0x3c06c7){_0x3c06c7[_0x0279('0x1d')]({'lastMsgAt':_0x71e2db[_0x0279('0x1e')],'lastMsgDirection':_0x71e2db['direction'][_0x0279('0x14')]()});}})[_0x0279('0x1f')](function(_0x31931d){console['error'](_0x31931d);});}if(_0x71e2db[_0x0279('0x13')]===_0x0279('0x15')&&!_0x71e2db[_0x0279('0x16')]){var _0x5173f0;_0x45bfaa['CmContact']['describe']()[_0x0279('0x1c')](function(_0x459e92){return _0x45bfaa[_0x0279('0x20')][_0x0279('0x21')]({'where':{'id':_0x71e2db[_0x0279('0x22')]},'include':[{'model':_0x45bfaa[_0x0279('0x19')],'as':_0x0279('0x23'),'where':{'id':_0x71e2db[_0x0279('0x1b')]},'limit':0x1,'include':[{'model':_0x45bfaa[_0x0279('0x24')],'as':'Contact','attributes':_[_0x0279('0x25')](_0x459e92)}]}]});})['then'](function(_0x510fdf){_0x5173f0=_0x510fdf[_0x0279('0x12')]({'plain':!![]});if(_0x5173f0&&_0x5173f0[_0x0279('0x26')]){logger['info'](_0x0279('0x27'),'afterCreate',util['format'](_0x0279('0x28'),_0x71e2db['id'],_0x5173f0[_0x0279('0x26')]));if(_0x5173f0[_0x0279('0x23')]&&_0x5173f0[_0x0279('0x23')]['length']){_0x71e2db[_0x0279('0x29')]=_[_0x0279('0x2a')](_0x5173f0[_0x0279('0x23')][0x0],_0x0279('0x2b'));_0x71e2db[_0x0279('0x2b')]=_0x5173f0[_0x0279('0x23')][0x0][_0x0279('0x2b')];}var _0x49e889={'method':_0x0279('0x2c'),'uri':encodeURI(_0x5173f0[_0x0279('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x49e889[_0x0279('0x2d')]){case'GET':_0x49e889['qs']=_0x71e2db;break;case _0x0279('0x2c'):_0x49e889[_0x0279('0xf')]=_0x71e2db;break;}return rp(_0x49e889)[_0x0279('0x1c')](function(_0x9cc797){logger['info'](_0x0279('0x27'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x71e2db['id'],_0x5173f0[_0x0279('0x26')]));if(_0x9cc797[_0x0279('0xf')][_0x0279('0x2e')]&&_0x9cc797[_0x0279('0xf')]['threadId']!=_0x71e2db[_0x0279('0x29')]['threadId']){return _0x45bfaa[_0x0279('0x19')][_0x0279('0x1d')]({'threadId':_0x9cc797[_0x0279('0xf')][_0x0279('0x2e')]},{'logging':!![],'where':{'id':_0x71e2db[_0x0279('0x29')]['id']}});}else{return;}})[_0x0279('0x1c')](function(){return _0x1514ae[_0x0279('0x1d')]({'read':!![]});})[_0x0279('0x1f')](function(_0x1bb66e){logger['error'](_0x0279('0x27'),_0x0279('0x2f'),util['inspect'](_0x1bb66e,{'showHidden':![],'depth':null}));_0x39730b();});}else{_0x39730b();}})[_0x0279('0x30')](function(){_0x39730b();});}else{_0x39730b();}}},'charset':_0x0279('0x31'),'collate':_0x0279('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 41d5648..da1f4fa 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x211d41,_0x496467){var _0x39f43f=function(_0x52bc05){while(--_0x52bc05){_0x211d41['push'](_0x211d41['shift']());}};_0x39f43f(++_0x496467);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f109c,_0xd9952e){_0x1f109c=_0x1f109c-0x0;var _0x3984e8=_0xb10b[_0x1f109c];return _0x3984e8;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3030d7,_0x25d1be){var _0x2689ad=function(_0x5a0027){while(--_0x5a0027){_0x3030d7['push'](_0x3030d7['shift']());}};_0x2689ad(++_0x25d1be);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12e58d,_0x546c38){_0x12e58d=_0x12e58d-0x0;var _0x584d91=_0x5f2f[_0x12e58d];return _0x584d91;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 5409706..cfe0448 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 _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4d257d,_0x8734a2){_0x4d257d=_0x4d257d-0x0;var _0x58fb8d=_0x9bde[_0x4d257d];return _0x58fb8d;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file +var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x6505c,_0x5329a7){var _0x1a7a96=function(_0x5bb1c6){while(--_0x5bb1c6){_0x6505c['push'](_0x6505c['shift']());}};_0x1a7a96(++_0x5329a7);}(_0xac4a,0x13f));var _0xaac4=function(_0x22e67b,_0x222f66){_0x22e67b=_0x22e67b-0x0;var _0x1e7afe=_0xac4a[_0x22e67b];return _0x1e7afe;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 81f142c..c561ef2 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 _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x225670,_0x30dc5b){var _0x2e8d01=function(_0x1ebaef){while(--_0x1ebaef){_0x225670['push'](_0x225670['shift']());}};_0x2e8d01(++_0x30dc5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x39029b,_0x59793c){var _0x47bdda=function(_0x5c6729){while(--_0x5c6729){_0x39029b['push'](_0x39029b['shift']());}};_0x47bdda(++_0x59793c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 30241b6..aa307dc 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 _0x08e2=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x9f12a7,_0x5cccb6){var _0x2ed407=function(_0x5a8b65){while(--_0x5a8b65){_0x9f12a7['push'](_0x9f12a7['shift']());}};_0x2ed407(++_0x5cccb6);}(_0x08e2,0x8c));var _0x208e=function(_0x3e26d0,_0x2c23c0){_0x3e26d0=_0x3e26d0-0x0;var _0x834695=_0x08e2[_0x3e26d0];return _0x834695;};'use strict';var Sequelize=require(_0x208e('0x0'));module[_0x208e('0x1')]={'name':{'type':Sequelize[_0x208e('0x2')],'unique':_0x208e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x208e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x208e('0x4')](_0x208e('0x5'),_0x208e('0x6'),_0x208e('0x7'))}}; \ No newline at end of file +var _0x060b=['exports','STRING','rrmemory','sequelize'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0x060b,0x1b3));var _0xb060=function(_0x4f4761,_0x2f6644){_0x4f4761=_0x4f4761-0x0;var _0x432e18=_0x060b[_0x4f4761];return _0x432e18;};'use strict';var Sequelize=require(_0xb060('0x0'));module[_0xb060('0x1')]={'name':{'type':Sequelize[_0xb060('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb060('0x3'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index f2cce4e..02788fe 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 _0xbe5b=['destroy','error','stack','name','send','index','map','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','OpenchannelQueue','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','filter','findAndCountAll','UserId','agent','openchannelPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','nolimit','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0xbe5b,0x66));var _0xbbe5=function(_0x4075f2,_0x6715a2){_0x4075f2=_0x4075f2-0x0;var _0x456b2a=_0xbe5b[_0x4075f2];return _0x456b2a;};'use strict';var pdf=require(_0xbbe5('0x0'));var emlformat=require(_0xbbe5('0x1'));var rimraf=require(_0xbbe5('0x2'));var zipdir=require(_0xbbe5('0x3'));var jsonpatch=require(_0xbbe5('0x4'));var rp=require('request-promise');var moment=require(_0xbbe5('0x5'));var BPromise=require(_0xbbe5('0x6'));var Mustache=require(_0xbbe5('0x7'));var util=require('util');var path=require('path');var sox=require(_0xbbe5('0x8'));var csv=require(_0xbbe5('0x9'));var ejs=require(_0xbbe5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbe5('0xb'));var squel=require(_0xbbe5('0xc'));var crypto=require(_0xbbe5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbbe5('0xe'));var Papa=require('papaparse');var Redis=require(_0xbbe5('0xf'));var authService=require(_0xbbe5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbbe5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbe5('0x12'))(_0xbbe5('0x13'));var utils=require('../../config/utils');var config=require(_0xbbe5('0x14'));var licenseUtil=require(_0xbbe5('0x15'));var db=require(_0xbbe5('0x16'))['db'];config[_0xbbe5('0x17')]=_[_0xbbe5('0x18')](config[_0xbbe5('0x17')],{'host':_0xbbe5('0x19'),'port':0x18eb});var socket=require(_0xbbe5('0x1a'))(new Redis(config[_0xbbe5('0x17')]));require('./openchannelQueue.socket')[_0xbbe5('0x1b')](socket);function respondWithStatusCode(_0x435b39,_0x128c80){_0x128c80=_0x128c80||0xcc;return function(_0x2b8734){if(_0x2b8734){return _0x435b39[_0xbbe5('0x1c')](_0x128c80);}return _0x435b39[_0xbbe5('0x1d')](_0x128c80)[_0xbbe5('0x1e')]();};}function respondWithResult(_0x5549a3,_0x45b099){_0x45b099=_0x45b099||0xc8;return function(_0x258ff5){if(_0x258ff5){return _0x5549a3[_0xbbe5('0x1d')](_0x45b099)[_0xbbe5('0x1f')](_0x258ff5);}};}function respondWithFilteredResult(_0x241ddf,_0x43d134){return function(_0x58bdf2){if(_0x58bdf2){var _0x474930=_0x58bdf2[_0xbbe5('0x20')],_0x223f5c=_0x43d134[_0xbbe5('0x21')],_0x1e566c=_0x43d134[_0xbbe5('0x21')]+_0x43d134[_0xbbe5('0x22')],_0x5377a9;if(_0x1e566c>=_0x474930){_0x1e566c=_0x474930;_0x5377a9=0xc8;}else{_0x5377a9=0xce;}_0x241ddf[_0xbbe5('0x1d')](_0x5377a9);return _0x241ddf['set'](_0xbbe5('0x23'),_0x223f5c+'-'+_0x1e566c+'/'+_0x474930)[_0xbbe5('0x1f')](_0x58bdf2);}return null;};}function patchUpdates(_0x38591b){return function(_0x6d9ab6){try{jsonpatch[_0xbbe5('0x24')](_0x6d9ab6,_0x38591b,!![]);}catch(_0x5d9f71){return BPromise[_0xbbe5('0x25')](_0x5d9f71);}return _0x6d9ab6[_0xbbe5('0x26')]();};}function saveUpdates(_0x2f62fb,_0x172f08){return function(_0x47361e){if(_0x47361e){return _0x47361e[_0xbbe5('0x27')](_0x2f62fb)[_0xbbe5('0x28')](function(_0x41f631){return _0x41f631;});}return null;};}function removeEntity(_0x1f52a5,_0x4eee94){return function(_0x89e2d7){if(_0x89e2d7){return _0x89e2d7['destroy']()['then'](function(){var _0x3b15fa=_0x89e2d7[_0xbbe5('0x29')]({'plain':!![]});var _0x42095f=_0xbbe5('0x2a');return db['UserProfileResource'][_0xbbe5('0x2b')]({'where':{'type':_0x42095f,'resourceId':_0x3b15fa['id']}})[_0xbbe5('0x28')](function(){return _0x89e2d7;});})[_0xbbe5('0x28')](function(){_0x1f52a5[_0xbbe5('0x1d')](0xcc)[_0xbbe5('0x1e')]();});}};}function handleEntityNotFound(_0x1e3a61,_0x4f29fc){return function(_0x563cdf){if(!_0x563cdf){_0x1e3a61[_0xbbe5('0x1c')](0x194);}return _0x563cdf;};}function handleError(_0x1e242b,_0x10a633){_0x10a633=_0x10a633||0x1f4;return function(_0x2a0466){logger[_0xbbe5('0x2c')](_0x2a0466[_0xbbe5('0x2d')]);if(_0x2a0466[_0xbbe5('0x2e')]){delete _0x2a0466['name'];}_0x1e242b[_0xbbe5('0x1d')](_0x10a633)[_0xbbe5('0x2f')](_0x2a0466);};}exports[_0xbbe5('0x30')]=function(_0x1665ca,_0x469566){var _0x379d1d={},_0x190d50={},_0x5e2310={'count':0x0,'rows':[]};var _0x4686ce=_[_0xbbe5('0x31')](db['OpenchannelQueue']['rawAttributes'],function(_0x2ddb50){return{'name':_0x2ddb50['fieldName'],'type':_0x2ddb50[_0xbbe5('0x32')][_0xbbe5('0x33')]};});_0x190d50[_0xbbe5('0x34')]=_[_0xbbe5('0x31')](_0x4686ce,_0xbbe5('0x2e'));_0x190d50[_0xbbe5('0x35')]=_[_0xbbe5('0x36')](_0x1665ca[_0xbbe5('0x35')]);_0x190d50['filters']=_['intersection'](_0x190d50[_0xbbe5('0x34')],_0x190d50['query']);_0x379d1d[_0xbbe5('0x37')]=_[_0xbbe5('0x38')](_0x190d50[_0xbbe5('0x34')],qs[_0xbbe5('0x39')](_0x1665ca[_0xbbe5('0x35')][_0xbbe5('0x39')]));_0x379d1d[_0xbbe5('0x37')]=_0x379d1d[_0xbbe5('0x37')][_0xbbe5('0x3a')]?_0x379d1d[_0xbbe5('0x37')]:_0x190d50[_0xbbe5('0x34')];if(!_0x1665ca[_0xbbe5('0x35')][_0xbbe5('0x3b')]('nolimit')){_0x379d1d[_0xbbe5('0x22')]=qs[_0xbbe5('0x22')](_0x1665ca[_0xbbe5('0x35')][_0xbbe5('0x22')]);_0x379d1d[_0xbbe5('0x21')]=qs[_0xbbe5('0x21')](_0x1665ca[_0xbbe5('0x35')][_0xbbe5('0x21')]);}_0x379d1d[_0xbbe5('0x3c')]=qs['sort'](_0x1665ca[_0xbbe5('0x35')][_0xbbe5('0x3d')]);_0x379d1d[_0xbbe5('0x3e')]=qs[_0xbbe5('0x3f')](_[_0xbbe5('0x40')](_0x1665ca[_0xbbe5('0x35')],_0x190d50['filters']),_0x4686ce);if(_0x1665ca[_0xbbe5('0x35')]['filter']){_0x379d1d[_0xbbe5('0x3e')]=_[_0xbbe5('0x41')](_0x379d1d[_0xbbe5('0x3e')],{'$or':_[_0xbbe5('0x31')](_0x4686ce,function(_0x44e68a){if(_0x44e68a[_0xbbe5('0x32')]!==_0xbbe5('0x42')){var _0x4bdc91={};_0x4bdc91[_0x44e68a[_0xbbe5('0x2e')]]={'$like':'%'+_0x1665ca[_0xbbe5('0x35')]['filter']+'%'};return _0x4bdc91;}})});}_0x379d1d=_[_0xbbe5('0x41')]({},_0x379d1d,_0x1665ca[_0xbbe5('0x43')]);var _0x2c9b6b={'where':_0x379d1d[_0xbbe5('0x3e')]};return db[_0xbbe5('0x44')][_0xbbe5('0x20')](_0x2c9b6b)[_0xbbe5('0x28')](function(_0xdb5ed6){_0x5e2310[_0xbbe5('0x20')]=_0xdb5ed6;if(_0x1665ca['query'][_0xbbe5('0x45')]){_0x379d1d[_0xbbe5('0x46')]=[{'all':!![]}];}return db[_0xbbe5('0x44')][_0xbbe5('0x47')](_0x379d1d);})[_0xbbe5('0x28')](function(_0x437afe){_0x5e2310['rows']=_0x437afe;return _0x5e2310;})[_0xbbe5('0x28')](respondWithFilteredResult(_0x469566,_0x379d1d))[_0xbbe5('0x48')](handleError(_0x469566,null));};exports[_0xbbe5('0x49')]=function(_0x2de3e4,_0x16dafe){var _0x515684={'raw':!![],'where':{'id':_0x2de3e4[_0xbbe5('0x4a')]['id']}},_0x2abc69={};_0x2abc69[_0xbbe5('0x34')]=_['keys'](db[_0xbbe5('0x44')][_0xbbe5('0x4b')]);_0x2abc69[_0xbbe5('0x35')]=_[_0xbbe5('0x36')](_0x2de3e4[_0xbbe5('0x35')]);_0x2abc69['filters']=_[_0xbbe5('0x38')](_0x2abc69[_0xbbe5('0x34')],_0x2abc69['query']);_0x515684[_0xbbe5('0x37')]=_[_0xbbe5('0x38')](_0x2abc69[_0xbbe5('0x34')],qs[_0xbbe5('0x39')](_0x2de3e4[_0xbbe5('0x35')][_0xbbe5('0x39')]));_0x515684['attributes']=_0x515684[_0xbbe5('0x37')]['length']?_0x515684[_0xbbe5('0x37')]:_0x2abc69[_0xbbe5('0x34')];if(_0x2de3e4[_0xbbe5('0x35')]['includeAll']){_0x515684[_0xbbe5('0x46')]=[{'all':!![]}];}_0x515684=_[_0xbbe5('0x41')]({},_0x515684,_0x2de3e4['options']);return db[_0xbbe5('0x44')][_0xbbe5('0x4c')](_0x515684)[_0xbbe5('0x28')](handleEntityNotFound(_0x16dafe,null))[_0xbbe5('0x28')](respondWithResult(_0x16dafe,null))[_0xbbe5('0x48')](handleError(_0x16dafe,null));};exports[_0xbbe5('0x4d')]=function(_0x12b34e,_0x34876c){return db[_0xbbe5('0x44')]['create'](_0x12b34e[_0xbbe5('0x4e')],{})['then'](function(_0xf28565){var _0x362958=_0x12b34e[_0xbbe5('0x4f')]['get']({'plain':!![]});if(!_0x362958)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x362958[_0xbbe5('0x50')]===_0xbbe5('0x4f')){var _0x5af7c5=_0xf28565[_0xbbe5('0x29')]({'plain':!![]});var _0x4ec2e0=_0xbbe5('0x2a');return db[_0xbbe5('0x51')][_0xbbe5('0x4c')]({'where':{'name':_0x4ec2e0,'userProfileId':_0x362958[_0xbbe5('0x52')]},'raw':!![]})[_0xbbe5('0x28')](function(_0x20e157){if(_0x20e157&&_0x20e157[_0xbbe5('0x53')]===0x0){return db[_0xbbe5('0x54')][_0xbbe5('0x4d')]({'name':_0x5af7c5[_0xbbe5('0x2e')],'resourceId':_0x5af7c5['id'],'type':_0x20e157[_0xbbe5('0x2e')],'sectionId':_0x20e157['id']},{})[_0xbbe5('0x28')](function(){return _0xf28565;});}else{return _0xf28565;}})[_0xbbe5('0x48')](function(_0x5652ae){logger['error'](_0xbbe5('0x55'),_0x5652ae);throw _0x5652ae;});}return _0xf28565;})[_0xbbe5('0x28')](respondWithResult(_0x34876c,0xc9))[_0xbbe5('0x48')](handleError(_0x34876c,null));};exports[_0xbbe5('0x27')]=function(_0x4337be,_0x15ac60){if(_0x4337be[_0xbbe5('0x4e')]['id']){delete _0x4337be[_0xbbe5('0x4e')]['id'];}return db[_0xbbe5('0x44')][_0xbbe5('0x4c')]({'where':{'id':_0x4337be['params']['id']}})[_0xbbe5('0x28')](handleEntityNotFound(_0x15ac60,null))['then'](saveUpdates(_0x4337be[_0xbbe5('0x4e')],null))['then'](respondWithResult(_0x15ac60,null))[_0xbbe5('0x48')](handleError(_0x15ac60,null));};exports[_0xbbe5('0x2b')]=function(_0x1f93a8,_0x4ebc06){return db['OpenchannelQueue']['find']({'where':{'id':_0x1f93a8[_0xbbe5('0x4a')]['id']}})[_0xbbe5('0x28')](handleEntityNotFound(_0x4ebc06,null))[_0xbbe5('0x28')](removeEntity(_0x4ebc06,null))[_0xbbe5('0x48')](handleError(_0x4ebc06,null));};exports[_0xbbe5('0x56')]=function(_0x3aabfc,_0x32b162){return db[_0xbbe5('0x44')][_0xbbe5('0x56')]()['then'](respondWithResult(_0x32b162,null))[_0xbbe5('0x48')](handleError(_0x32b162,null));};exports[_0xbbe5('0x57')]=function(_0x31a113,_0x180330,_0x37b4d3){var _0x529e27={'raw':!![],'where':{}},_0x5e5a6f={},_0x7ce109;return db['OpenchannelQueue'][_0xbbe5('0x58')]({'where':{'id':_0x31a113['params']['id']}})[_0xbbe5('0x28')](handleEntityNotFound(_0x180330,null))[_0xbbe5('0x28')](function(_0x1b8bcb){if(_0x1b8bcb){_0x7ce109=_0x1b8bcb[_0xbbe5('0x29')]({'plain':!![]});_0x5e5a6f[_0xbbe5('0x34')]=_[_0xbbe5('0x36')](db[_0xbbe5('0x59')][_0xbbe5('0x4b')]);_0x5e5a6f[_0xbbe5('0x35')]=_[_0xbbe5('0x36')](_0x31a113['query']);_0x5e5a6f[_0xbbe5('0x3f')]=_['intersection'](_0x5e5a6f[_0xbbe5('0x34')],_0x5e5a6f[_0xbbe5('0x35')]);_0x529e27['attributes']=_[_0xbbe5('0x38')](_0x5e5a6f[_0xbbe5('0x34')],qs[_0xbbe5('0x39')](_0x31a113[_0xbbe5('0x35')][_0xbbe5('0x39')]));_0x529e27[_0xbbe5('0x37')]=_0x529e27[_0xbbe5('0x37')][_0xbbe5('0x3a')]?_0x529e27['attributes']:_0x5e5a6f['model'];if(!_0x31a113[_0xbbe5('0x35')][_0xbbe5('0x3b')]('nolimit')){_0x529e27[_0xbbe5('0x22')]=qs['limit'](_0x31a113['query'][_0xbbe5('0x22')]);_0x529e27['offset']=qs[_0xbbe5('0x21')](_0x31a113[_0xbbe5('0x35')][_0xbbe5('0x21')]);}_0x529e27[_0xbbe5('0x3c')]=qs[_0xbbe5('0x3d')](_0x31a113[_0xbbe5('0x35')][_0xbbe5('0x3d')]);_0x529e27[_0xbbe5('0x3e')]=qs[_0xbbe5('0x3f')](_[_0xbbe5('0x40')](_0x31a113[_0xbbe5('0x35')],_0x5e5a6f[_0xbbe5('0x3f')]));_0x529e27[_0xbbe5('0x3e')][_0xbbe5('0x5a')]=_0x1b8bcb['id'];if(_0x31a113[_0xbbe5('0x35')][_0xbbe5('0x5b')]){_0x529e27['where']=_[_0xbbe5('0x41')](_0x529e27['where'],{'$or':_['map'](_0x529e27[_0xbbe5('0x37')],function(_0x499fc6){var _0xf7f731={};_0xf7f731[_0x499fc6]={'$like':'%'+_0x31a113[_0xbbe5('0x35')][_0xbbe5('0x5b')]+'%'};return _0xf7f731;})});}_0x529e27=_[_0xbbe5('0x41')]({},_0x529e27,_0x31a113[_0xbbe5('0x43')]);return db[_0xbbe5('0x59')][_0xbbe5('0x47')](_0x529e27);}})['then'](function(_0x175451){if(_0x175451){return db['User'][_0xbbe5('0x5c')]({'where':{'id':_[_0xbbe5('0x31')](_0x175451,_0xbbe5('0x5d')),'role':_0xbbe5('0x5e')},'attributes':['id',_0xbbe5('0x2e'),_0xbbe5('0x5f'),'updatedAt',_0xbbe5('0x60')]});}})[_0xbbe5('0x28')](function(_0x5c0036){if(_0x5c0036){return{'count':_0x5c0036['count'],'rows':_[_0xbbe5('0x31')](_0x5c0036[_0xbbe5('0x61')],function(_0x408e87){return{'membername':_0x408e87['name'],'UserId':_0x408e87['id'],'queue_name':_0x7ce109['name'],'OpenchannelQueueId':_0x7ce109['id'],'interface':util[_0xbbe5('0x62')](_0xbbe5('0x63'),_0xbbe5('0x64'),_0x408e87[_0xbbe5('0x2e')]),'penalty':0x0,'paused':_0x408e87[_0xbbe5('0x5f')],'createdAt':_0x408e87[_0xbbe5('0x60')],'updatedAt':_0x408e87[_0xbbe5('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbbe5('0x28')](respondWithFilteredResult(_0x180330,_0x529e27))[_0xbbe5('0x48')](handleError(_0x180330,null));};exports[_0xbbe5('0x66')]=function(_0xfabe41,_0x2f6aa3,_0x2e5797){var _0x2cdf59={};var _0x27a08c={};var _0x11c748;var _0x13bf11;return db[_0xbbe5('0x44')]['findOne']({'where':{'id':_0xfabe41['params']['id']}})['then'](handleEntityNotFound(_0x2f6aa3,null))[_0xbbe5('0x28')](function(_0x573dcb){if(_0x573dcb){_0x11c748=_0x573dcb;_0x27a08c[_0xbbe5('0x34')]=_['keys'](db[_0xbbe5('0x67')][_0xbbe5('0x4b')]);_0x27a08c[_0xbbe5('0x35')]=_[_0xbbe5('0x36')](_0xfabe41[_0xbbe5('0x35')]);_0x27a08c[_0xbbe5('0x3f')]=_['intersection'](_0x27a08c['model'],_0x27a08c[_0xbbe5('0x35')]);_0x2cdf59[_0xbbe5('0x37')]=_[_0xbbe5('0x38')](_0x27a08c[_0xbbe5('0x34')],qs['fields'](_0xfabe41[_0xbbe5('0x35')][_0xbbe5('0x39')]));_0x2cdf59[_0xbbe5('0x37')]=_0x2cdf59[_0xbbe5('0x37')]['length']?_0x2cdf59[_0xbbe5('0x37')]:_0x27a08c[_0xbbe5('0x34')];_0x2cdf59[_0xbbe5('0x3c')]=qs[_0xbbe5('0x3d')](_0xfabe41[_0xbbe5('0x35')][_0xbbe5('0x3d')]);_0x2cdf59[_0xbbe5('0x3e')]=qs[_0xbbe5('0x3f')](_[_0xbbe5('0x40')](_0xfabe41[_0xbbe5('0x35')],_0x27a08c[_0xbbe5('0x3f')]));if(_0xfabe41[_0xbbe5('0x35')][_0xbbe5('0x5b')]){_0x2cdf59[_0xbbe5('0x3e')]=_[_0xbbe5('0x41')](_0x2cdf59[_0xbbe5('0x3e')],{'$or':_[_0xbbe5('0x31')](_0x2cdf59[_0xbbe5('0x37')],function(_0xd2f5d4){var _0x2e8824={};_0x2e8824[_0xd2f5d4]={'$like':'%'+_0xfabe41[_0xbbe5('0x35')]['filter']+'%'};return _0x2e8824;})});}_0x2cdf59=_['merge']({},_0x2cdf59,_0xfabe41[_0xbbe5('0x43')]);return _0x11c748[_0xbbe5('0x66')](_0x2cdf59);}})[_0xbbe5('0x28')](function(_0xfb449d){if(_0xfb449d){_0x13bf11=_0xfb449d['length'];if(!_0xfabe41[_0xbbe5('0x35')][_0xbbe5('0x3b')](_0xbbe5('0x68'))){_0x2cdf59['limit']=qs[_0xbbe5('0x22')](_0xfabe41[_0xbbe5('0x35')][_0xbbe5('0x22')]);_0x2cdf59['offset']=qs[_0xbbe5('0x21')](_0xfabe41[_0xbbe5('0x35')][_0xbbe5('0x21')]);}return _0x11c748['getTeams'](_0x2cdf59);}})[_0xbbe5('0x28')](function(_0x1d624f){if(_0x1d624f){return _0x1d624f?{'count':_0x13bf11,'rows':_0x1d624f}:null;}})[_0xbbe5('0x28')](respondWithResult(_0x2f6aa3,null))[_0xbbe5('0x48')](handleError(_0x2f6aa3,null));};exports[_0xbbe5('0x69')]=function(_0x3830a0,_0x30bb27,_0x23fbdf){var _0x56ff18=_0x3830a0[_0xbbe5('0x4e')][_0xbbe5('0x6a')];return db[_0xbbe5('0x67')][_0xbbe5('0x47')]({'where':{'id':_0x56ff18},'attributes':['id'],'include':[{'model':db[_0xbbe5('0x6b')],'as':_0xbbe5('0x6c'),'attributes':['id',_0xbbe5('0x2e'),_0xbbe5('0x6d'),'voicePause',_0xbbe5('0x6e')],'raw':!![]}]})[_0xbbe5('0x28')](function(_0x354f74){if(_0x354f74){var _0x53febc=_[_0xbbe5('0x6f')](_0x354f74,function(_0x2f0909){var _0x425e54=_0x2f0909[_0xbbe5('0x29')]({'plain':!![]});return _0x425e54[_0xbbe5('0x6c')];});return db[_0xbbe5('0x44')][_0xbbe5('0x4c')]({'where':{'id':_0x3830a0[_0xbbe5('0x4a')]['id']}})['then'](function(_0x1cbefe){return db[_0xbbe5('0x70')][_0xbbe5('0x71')](function(_0x27c9b4){return _0x1cbefe['addTeams'](_0x56ff18,{'transaction':_0x27c9b4})[_0xbbe5('0x28')](function(){return BPromise['each'](_0x53febc,function(_0x3ee2a8){return db[_0xbbe5('0x59')][_0xbbe5('0x72')]({'where':{'UserId':_0x3ee2a8['id'],'OpenchannelQueueId':_0x3830a0['params']['id']},'transaction':_0x27c9b4});});})[_0xbbe5('0x28')](function(){_0x53febc[_0xbbe5('0x73')](function(_0xb3d925){socket[_0xbbe5('0x74')](_0xbbe5('0x75'),{'UserId':_0xb3d925['id'],'OpenchannelQueueId':_0x1cbefe['id']});});});});});}})[_0xbbe5('0x28')](respondWithStatusCode(_0x30bb27,null))[_0xbbe5('0x48')](handleError(_0x30bb27,null));};exports[_0xbbe5('0x76')]=function(_0x48e09c,_0x4819e5,_0x737c93){return db[_0xbbe5('0x67')][_0xbbe5('0x47')]({'where':{'id':_0x48e09c[_0xbbe5('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbbe5('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbbe5('0x28')](handleEntityNotFound(_0x4819e5,null))[_0xbbe5('0x28')](function(_0x4297ff){var _0xf8aedc=_[_0xbbe5('0x31')](_0x4297ff,'id');var _0x1a7219=[];var _0x151cd=[];var _0x5aa35e=squel[_0xbbe5('0x77')]();_0x5aa35e['field'](_0xbbe5('0x78'))[_0xbbe5('0x79')](_0xbbe5('0x7a'),'tq')[_0xbbe5('0x7b')](_0xbbe5('0x7c'),'ut',_0xbbe5('0x7d'))[_0xbbe5('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x48e09c[_0xbbe5('0x4a')]['id']);for(var _0x3e6b1a=0x0;_0x3e6b1a<_0x4297ff[_0xbbe5('0x3a')];_0x3e6b1a+=0x1){let _0x3e5367=_0x4297ff[_0x3e6b1a];for(var _0x1f497a=0x0;_0x1f497a<_0x3e5367['Agents'][_0xbbe5('0x3a')];_0x1f497a+=0x1){let _0x4e864f=_0x3e5367['Agents'][_0x1f497a];var _0x3a2bab=_0x5aa35e[_0xbbe5('0x7e')]();_0x3a2bab['where']('ut.UserId\x20=\x20?',_0x4e864f['id']);_0x151cd[_0xbbe5('0x7f')](db[_0xbbe5('0x70')]['query'](_0x3a2bab['toString'](),{'type':db['sequelize'][_0xbbe5('0x80')][_0xbbe5('0x81')]})[_0xbbe5('0x28')](function(_0x5416bc){if(_0x5416bc[_0xbbe5('0x3a')]===0x1){return _0x4e864f['id'];}else{var _0x54b8bf=_[_0xbbe5('0x82')](_[_0xbbe5('0x31')](_0x5416bc,_0xbbe5('0x83')),function(_0xe1641e){return _[_0xbbe5('0x84')](_0xf8aedc,_0xe1641e);});if(_0x54b8bf){return _0x4e864f['id'];}}}));}}return BPromise[_0xbbe5('0x85')](_0x151cd)[_0xbbe5('0x28')](function(_0x19c528){_0x1a7219=_(_0x1a7219)[_0xbbe5('0x86')](_0x19c528)[_0xbbe5('0x87')]()[_0xbbe5('0x88')]();return db[_0xbbe5('0x44')][_0xbbe5('0x4c')]({'where':{'id':_0x48e09c[_0xbbe5('0x4a')]['id']}})[_0xbbe5('0x28')](function(_0x45ba5a){return db['sequelize'][_0xbbe5('0x71')](function(_0x5ac772){return _0x45ba5a[_0xbbe5('0x76')](_0x48e09c[_0xbbe5('0x35')][_0xbbe5('0x6a')],{'transaction':_0x5ac772})[_0xbbe5('0x28')](function(){if(!_[_0xbbe5('0x89')](_0x1a7219)){return _0x45ba5a['removeAgents'](_0x1a7219,{'transaction':_0x5ac772});}})[_0xbbe5('0x28')](function(){_0x1a7219['forEach'](function(_0x14a5ff){socket['emit'](_0xbbe5('0x8a'),{'UserId':_0x14a5ff,'OpenchannelQueueId':_0x45ba5a['id']});});});});});});})[_0xbbe5('0x28')](respondWithStatusCode(_0x4819e5,null))[_0xbbe5('0x48')](handleError(_0x4819e5,null));};exports[_0xbbe5('0x8b')]=function(_0x243c94,_0x4d83fe,_0x35b985){return db['OpenchannelQueue'][_0xbbe5('0x4c')]({'where':{'id':_0x243c94['params']['id']}})[_0xbbe5('0x28')](handleEntityNotFound(_0x4d83fe,null))[_0xbbe5('0x28')](function(_0x585f20){if(_0x585f20){return _0x585f20[_0xbbe5('0x8b')](_0x243c94[_0xbbe5('0x4e')][_0xbbe5('0x6a')],_[_0xbbe5('0x8c')](_0x243c94[_0xbbe5('0x4e')],[_0xbbe5('0x6a'),'id'])||{})[_0xbbe5('0x8d')](function(_0x19e1f6){for(var _0x2c0985=0x0;_0x2c0985<_0x243c94[_0xbbe5('0x4e')][_0xbbe5('0x6a')]['length'];_0x2c0985+=0x1){socket[_0xbbe5('0x74')]('userOpenchannelQueue:save',{'UserId':_0x243c94['body']['ids'][_0x2c0985],'OpenchannelQueueId':_0x243c94[_0xbbe5('0x4a')]['id']});}return _0x19e1f6;});}})[_0xbbe5('0x28')](respondWithResult(_0x4d83fe,null))['catch'](handleError(_0x4d83fe,null));};exports[_0xbbe5('0x8e')]=function(_0x22dbb3,_0x1e8c86,_0x2d7a56){return db[_0xbbe5('0x44')][_0xbbe5('0x4c')]({'where':{'id':_0x22dbb3[_0xbbe5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e8c86,null))[_0xbbe5('0x28')](function(_0x448958){if(_0x448958){return _0x448958['removeAgents'](_0x22dbb3[_0xbbe5('0x35')]['ids'])[_0xbbe5('0x28')](function(){if(_[_0xbbe5('0x8f')](_0x22dbb3[_0xbbe5('0x35')][_0xbbe5('0x6a')])){for(var _0x525740=0x0;_0x525740<_0x22dbb3[_0xbbe5('0x35')][_0xbbe5('0x6a')][_0xbbe5('0x3a')];_0x525740+=0x1){socket[_0xbbe5('0x74')](_0xbbe5('0x8a'),{'UserId':Number(_0x22dbb3[_0xbbe5('0x35')][_0xbbe5('0x6a')][_0x525740]),'OpenchannelQueueId':Number(_0x22dbb3[_0xbbe5('0x4a')]['id'])});}}else{socket[_0xbbe5('0x74')](_0xbbe5('0x8a'),{'UserId':Number(_0x22dbb3['query'][_0xbbe5('0x6a')]),'OpenchannelQueueId':Number(_0x22dbb3[_0xbbe5('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e8c86,null))['catch'](handleError(_0x1e8c86,null));};exports['getAgents']=function(_0x1cb119,_0x3cfbf7,_0x4e1a3){var _0x3d4de8={};var _0xd009ac={};var _0x23f9aa;var _0x320c98;return db[_0xbbe5('0x44')][_0xbbe5('0x58')]({'where':{'id':_0x1cb119[_0xbbe5('0x4a')]['id']}})[_0xbbe5('0x28')](handleEntityNotFound(_0x3cfbf7,null))[_0xbbe5('0x28')](function(_0x12342){if(_0x12342){_0x23f9aa=_0x12342;_0xd009ac[_0xbbe5('0x34')]=_[_0xbbe5('0x36')](db[_0xbbe5('0x6b')]['rawAttributes']);_0xd009ac[_0xbbe5('0x35')]=_[_0xbbe5('0x36')](_0x1cb119[_0xbbe5('0x35')]);_0xd009ac['filters']=_[_0xbbe5('0x38')](_0xd009ac[_0xbbe5('0x34')],_0xd009ac[_0xbbe5('0x35')]);_0x3d4de8[_0xbbe5('0x37')]=_[_0xbbe5('0x38')](_0xd009ac[_0xbbe5('0x34')],qs['fields'](_0x1cb119[_0xbbe5('0x35')][_0xbbe5('0x39')]));_0x3d4de8[_0xbbe5('0x37')]=_0x3d4de8[_0xbbe5('0x37')][_0xbbe5('0x3a')]?_0x3d4de8[_0xbbe5('0x37')]:_0xd009ac['model'];_0x3d4de8[_0xbbe5('0x3c')]=qs['sort'](_0x1cb119['query'][_0xbbe5('0x3d')]);_0x3d4de8[_0xbbe5('0x3e')]=qs[_0xbbe5('0x3f')](_[_0xbbe5('0x40')](_0x1cb119[_0xbbe5('0x35')],_0xd009ac['filters']));if(_0x1cb119[_0xbbe5('0x35')][_0xbbe5('0x5b')]){_0x3d4de8['where']=_[_0xbbe5('0x41')](_0x3d4de8['where'],{'$or':_[_0xbbe5('0x31')](_0x3d4de8[_0xbbe5('0x37')],function(_0x1725bb){var _0x2a2b74={};_0x2a2b74[_0x1725bb]={'$like':'%'+_0x1cb119[_0xbbe5('0x35')][_0xbbe5('0x5b')]+'%'};return _0x2a2b74;})});}_0x3d4de8=_['merge']({},_0x3d4de8,_0x1cb119[_0xbbe5('0x43')]);return _0x23f9aa['getAgents'](_0x3d4de8);}})['then'](function(_0x42e109){if(_0x42e109){_0x320c98=_0x42e109[_0xbbe5('0x3a')];if(!_0x1cb119[_0xbbe5('0x35')][_0xbbe5('0x3b')](_0xbbe5('0x68'))){_0x3d4de8[_0xbbe5('0x22')]=qs[_0xbbe5('0x22')](_0x1cb119['query'][_0xbbe5('0x22')]);_0x3d4de8[_0xbbe5('0x21')]=qs[_0xbbe5('0x21')](_0x1cb119[_0xbbe5('0x35')][_0xbbe5('0x21')]);}return _0x23f9aa[_0xbbe5('0x90')](_0x3d4de8);}})[_0xbbe5('0x28')](function(_0x7b014){if(_0x7b014){return _0x7b014?{'count':_0x320c98,'rows':_0x7b014}:null;}})['then'](respondWithResult(_0x3cfbf7,null))[_0xbbe5('0x48')](handleError(_0x3cfbf7,null));}; \ No newline at end of file +var _0x7a45=['userOpenchannelQueue:remove','addAgents','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','get','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','getTeams','order','addTeams','ids','Team','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','User','select','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','removeTeams','removeAgents'];(function(_0x4b8fc7,_0x5022fc){var _0x249f4a=function(_0x1b25d4){while(--_0x1b25d4){_0x4b8fc7['push'](_0x4b8fc7['shift']());}};_0x249f4a(++_0x5022fc);}(_0x7a45,0x12a));var _0x57a4=function(_0x54daef,_0x262043){_0x54daef=_0x54daef-0x0;var _0x14026e=_0x7a45[_0x54daef];return _0x14026e;};'use strict';var pdf=require(_0x57a4('0x0'));var emlformat=require(_0x57a4('0x1'));var rimraf=require(_0x57a4('0x2'));var zipdir=require(_0x57a4('0x3'));var jsonpatch=require(_0x57a4('0x4'));var rp=require(_0x57a4('0x5'));var moment=require(_0x57a4('0x6'));var BPromise=require(_0x57a4('0x7'));var Mustache=require('mustache');var util=require(_0x57a4('0x8'));var path=require('path');var sox=require(_0x57a4('0x9'));var csv=require(_0x57a4('0xa'));var ejs=require(_0x57a4('0xb'));var fs=require('fs');var fs_extra=require(_0x57a4('0xc'));var _=require(_0x57a4('0xd'));var squel=require(_0x57a4('0xe'));var crypto=require(_0x57a4('0xf'));var jsforce=require(_0x57a4('0x10'));var deskjs=require(_0x57a4('0x11'));var toCsv=require(_0x57a4('0xa'));var querystring=require(_0x57a4('0x12'));var Papa=require(_0x57a4('0x13'));var Redis=require('ioredis');var authService=require(_0x57a4('0x14'));var qs=require(_0x57a4('0x15'));var as=require(_0x57a4('0x16'));var hardwareService=require(_0x57a4('0x17'));var logger=require(_0x57a4('0x18'))(_0x57a4('0x19'));var utils=require(_0x57a4('0x1a'));var config=require(_0x57a4('0x1b'));var licenseUtil=require(_0x57a4('0x1c'));var db=require(_0x57a4('0x1d'))['db'];config[_0x57a4('0x1e')]=_[_0x57a4('0x1f')](config['redis'],{'host':_0x57a4('0x20'),'port':0x18eb});var socket=require(_0x57a4('0x21'))(new Redis(config[_0x57a4('0x1e')]));require(_0x57a4('0x22'))['register'](socket);function respondWithStatusCode(_0x4ce2b8,_0x330c34){_0x330c34=_0x330c34||0xcc;return function(_0x34be99){if(_0x34be99){return _0x4ce2b8[_0x57a4('0x23')](_0x330c34);}return _0x4ce2b8[_0x57a4('0x24')](_0x330c34)[_0x57a4('0x25')]();};}function respondWithResult(_0x43be02,_0x21b2f9){_0x21b2f9=_0x21b2f9||0xc8;return function(_0x387830){if(_0x387830){return _0x43be02[_0x57a4('0x24')](_0x21b2f9)['json'](_0x387830);}};}function respondWithFilteredResult(_0x363141,_0x3630b7){return function(_0x59c5d8){if(_0x59c5d8){var _0x205979=_0x59c5d8['count'],_0x358b09=_0x3630b7[_0x57a4('0x26')],_0x4f610f=_0x3630b7['offset']+_0x3630b7['limit'],_0x2a8a8f;if(_0x4f610f>=_0x205979){_0x4f610f=_0x205979;_0x2a8a8f=0xc8;}else{_0x2a8a8f=0xce;}_0x363141[_0x57a4('0x24')](_0x2a8a8f);return _0x363141[_0x57a4('0x27')](_0x57a4('0x28'),_0x358b09+'-'+_0x4f610f+'/'+_0x205979)[_0x57a4('0x29')](_0x59c5d8);}return null;};}function patchUpdates(_0x5db288){return function(_0x269180){try{jsonpatch[_0x57a4('0x2a')](_0x269180,_0x5db288,!![]);}catch(_0x147c9c){return BPromise[_0x57a4('0x2b')](_0x147c9c);}return _0x269180[_0x57a4('0x2c')]();};}function saveUpdates(_0x47aa4e,_0x176478){return function(_0x376b95){if(_0x376b95){return _0x376b95[_0x57a4('0x2d')](_0x47aa4e)[_0x57a4('0x2e')](function(_0x521c14){return _0x521c14;});}return null;};}function removeEntity(_0x532a23,_0x3b3ed7){return function(_0x593bc4){if(_0x593bc4){return _0x593bc4[_0x57a4('0x2f')]()['then'](function(){var _0x97e839=_0x593bc4['get']({'plain':!![]});var _0x64fe90=_0x57a4('0x30');return db[_0x57a4('0x31')]['destroy']({'where':{'type':_0x64fe90,'resourceId':_0x97e839['id']}})[_0x57a4('0x2e')](function(){return _0x593bc4;});})[_0x57a4('0x2e')](function(){_0x532a23['status'](0xcc)[_0x57a4('0x25')]();});}};}function handleEntityNotFound(_0x22fd62,_0x2ac718){return function(_0x3bdfbb){if(!_0x3bdfbb){_0x22fd62[_0x57a4('0x23')](0x194);}return _0x3bdfbb;};}function handleError(_0x4ae4a6,_0x255839){_0x255839=_0x255839||0x1f4;return function(_0x3a2eee){logger['error'](_0x3a2eee[_0x57a4('0x32')]);if(_0x3a2eee['name']){delete _0x3a2eee[_0x57a4('0x33')];}_0x4ae4a6[_0x57a4('0x24')](_0x255839)[_0x57a4('0x34')](_0x3a2eee);};}exports[_0x57a4('0x35')]=function(_0xed236c,_0x35b74c){var _0x25421e={},_0x1ea3d1={},_0x59b033={'count':0x0,'rows':[]};var _0x51efea=_[_0x57a4('0x36')](db[_0x57a4('0x37')][_0x57a4('0x38')],function(_0x4e6e25){return{'name':_0x4e6e25[_0x57a4('0x39')],'type':_0x4e6e25['type'][_0x57a4('0x3a')]};});_0x1ea3d1[_0x57a4('0x3b')]=_['map'](_0x51efea,_0x57a4('0x33'));_0x1ea3d1[_0x57a4('0x3c')]=_[_0x57a4('0x3d')](_0xed236c[_0x57a4('0x3c')]);_0x1ea3d1[_0x57a4('0x3e')]=_[_0x57a4('0x3f')](_0x1ea3d1[_0x57a4('0x3b')],_0x1ea3d1[_0x57a4('0x3c')]);_0x25421e[_0x57a4('0x40')]=_['intersection'](_0x1ea3d1[_0x57a4('0x3b')],qs[_0x57a4('0x41')](_0xed236c[_0x57a4('0x3c')][_0x57a4('0x41')]));_0x25421e[_0x57a4('0x40')]=_0x25421e[_0x57a4('0x40')][_0x57a4('0x42')]?_0x25421e[_0x57a4('0x40')]:_0x1ea3d1[_0x57a4('0x3b')];if(!_0xed236c[_0x57a4('0x3c')][_0x57a4('0x43')](_0x57a4('0x44'))){_0x25421e[_0x57a4('0x45')]=qs[_0x57a4('0x45')](_0xed236c[_0x57a4('0x3c')][_0x57a4('0x45')]);_0x25421e[_0x57a4('0x26')]=qs[_0x57a4('0x26')](_0xed236c[_0x57a4('0x3c')][_0x57a4('0x26')]);}_0x25421e['order']=qs[_0x57a4('0x46')](_0xed236c[_0x57a4('0x3c')][_0x57a4('0x46')]);_0x25421e['where']=qs['filters'](_[_0x57a4('0x47')](_0xed236c[_0x57a4('0x3c')],_0x1ea3d1['filters']),_0x51efea);if(_0xed236c[_0x57a4('0x3c')][_0x57a4('0x48')]){_0x25421e[_0x57a4('0x49')]=_[_0x57a4('0x4a')](_0x25421e[_0x57a4('0x49')],{'$or':_[_0x57a4('0x36')](_0x51efea,function(_0x3d66b7){if(_0x3d66b7[_0x57a4('0x4b')]!==_0x57a4('0x4c')){var _0x45c8be={};_0x45c8be[_0x3d66b7[_0x57a4('0x33')]]={'$like':'%'+_0xed236c[_0x57a4('0x3c')][_0x57a4('0x48')]+'%'};return _0x45c8be;}})});}_0x25421e=_[_0x57a4('0x4a')]({},_0x25421e,_0xed236c[_0x57a4('0x4d')]);var _0x3c43b5={'where':_0x25421e[_0x57a4('0x49')]};return db[_0x57a4('0x37')]['count'](_0x3c43b5)[_0x57a4('0x2e')](function(_0x49f6de){_0x59b033[_0x57a4('0x4e')]=_0x49f6de;if(_0xed236c[_0x57a4('0x3c')][_0x57a4('0x4f')]){_0x25421e[_0x57a4('0x50')]=[{'all':!![]}];}return db[_0x57a4('0x37')][_0x57a4('0x51')](_0x25421e);})[_0x57a4('0x2e')](function(_0x144628){_0x59b033[_0x57a4('0x52')]=_0x144628;return _0x59b033;})[_0x57a4('0x2e')](respondWithFilteredResult(_0x35b74c,_0x25421e))[_0x57a4('0x53')](handleError(_0x35b74c,null));};exports['show']=function(_0x49d413,_0x1c9ae3){var _0x3d6a9d={'raw':!![],'where':{'id':_0x49d413[_0x57a4('0x54')]['id']}},_0x3d4466={};_0x3d4466[_0x57a4('0x3b')]=_[_0x57a4('0x3d')](db[_0x57a4('0x37')][_0x57a4('0x38')]);_0x3d4466[_0x57a4('0x3c')]=_[_0x57a4('0x3d')](_0x49d413['query']);_0x3d4466[_0x57a4('0x3e')]=_[_0x57a4('0x3f')](_0x3d4466['model'],_0x3d4466['query']);_0x3d6a9d['attributes']=_[_0x57a4('0x3f')](_0x3d4466[_0x57a4('0x3b')],qs[_0x57a4('0x41')](_0x49d413[_0x57a4('0x3c')][_0x57a4('0x41')]));_0x3d6a9d[_0x57a4('0x40')]=_0x3d6a9d[_0x57a4('0x40')]['length']?_0x3d6a9d[_0x57a4('0x40')]:_0x3d4466[_0x57a4('0x3b')];if(_0x49d413[_0x57a4('0x3c')]['includeAll']){_0x3d6a9d[_0x57a4('0x50')]=[{'all':!![]}];}_0x3d6a9d=_[_0x57a4('0x4a')]({},_0x3d6a9d,_0x49d413[_0x57a4('0x4d')]);return db[_0x57a4('0x37')][_0x57a4('0x55')](_0x3d6a9d)[_0x57a4('0x2e')](handleEntityNotFound(_0x1c9ae3,null))[_0x57a4('0x2e')](respondWithResult(_0x1c9ae3,null))['catch'](handleError(_0x1c9ae3,null));};exports[_0x57a4('0x56')]=function(_0x437087,_0x186ebc){return db[_0x57a4('0x37')]['create'](_0x437087[_0x57a4('0x57')],{})[_0x57a4('0x2e')](function(_0x4d52d0){var _0x1c75ee=_0x437087[_0x57a4('0x58')]['get']({'plain':!![]});if(!_0x1c75ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c75ee[_0x57a4('0x59')]==='user'){var _0x2340d7=_0x4d52d0['get']({'plain':!![]});var _0x16486a='OpenchannelQueues';return db[_0x57a4('0x5a')][_0x57a4('0x55')]({'where':{'name':_0x16486a,'userProfileId':_0x1c75ee[_0x57a4('0x5b')]},'raw':!![]})[_0x57a4('0x2e')](function(_0x5b6d55){if(_0x5b6d55&&_0x5b6d55[_0x57a4('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x2340d7[_0x57a4('0x33')],'resourceId':_0x2340d7['id'],'type':_0x5b6d55[_0x57a4('0x33')],'sectionId':_0x5b6d55['id']},{})['then'](function(){return _0x4d52d0;});}else{return _0x4d52d0;}})[_0x57a4('0x53')](function(_0x437adf){logger[_0x57a4('0x5d')](_0x57a4('0x5e'),_0x437adf);throw _0x437adf;});}return _0x4d52d0;})[_0x57a4('0x2e')](respondWithResult(_0x186ebc,0xc9))[_0x57a4('0x53')](handleError(_0x186ebc,null));};exports[_0x57a4('0x2d')]=function(_0x29e602,_0xa04885){if(_0x29e602['body']['id']){delete _0x29e602['body']['id'];}return db[_0x57a4('0x37')]['find']({'where':{'id':_0x29e602[_0x57a4('0x54')]['id']}})['then'](handleEntityNotFound(_0xa04885,null))[_0x57a4('0x2e')](saveUpdates(_0x29e602[_0x57a4('0x57')],null))['then'](respondWithResult(_0xa04885,null))[_0x57a4('0x53')](handleError(_0xa04885,null));};exports[_0x57a4('0x2f')]=function(_0x4aae03,_0x174516){return db[_0x57a4('0x37')][_0x57a4('0x55')]({'where':{'id':_0x4aae03[_0x57a4('0x54')]['id']}})[_0x57a4('0x2e')](handleEntityNotFound(_0x174516,null))[_0x57a4('0x2e')](removeEntity(_0x174516,null))[_0x57a4('0x53')](handleError(_0x174516,null));};exports[_0x57a4('0x5f')]=function(_0x1ed10d,_0x2ce38e){return db[_0x57a4('0x37')][_0x57a4('0x5f')]()[_0x57a4('0x2e')](respondWithResult(_0x2ce38e,null))[_0x57a4('0x53')](handleError(_0x2ce38e,null));};exports[_0x57a4('0x60')]=function(_0x2aed96,_0x46cd80,_0x5b2da7){var _0x2d8e2e={'raw':!![],'where':{}},_0x231c92={},_0x3dc2cc;return db[_0x57a4('0x37')][_0x57a4('0x61')]({'where':{'id':_0x2aed96[_0x57a4('0x54')]['id']}})[_0x57a4('0x2e')](handleEntityNotFound(_0x46cd80,null))[_0x57a4('0x2e')](function(_0x432570){if(_0x432570){_0x3dc2cc=_0x432570[_0x57a4('0x62')]({'plain':!![]});_0x231c92[_0x57a4('0x3b')]=_[_0x57a4('0x3d')](db[_0x57a4('0x63')][_0x57a4('0x38')]);_0x231c92[_0x57a4('0x3c')]=_[_0x57a4('0x3d')](_0x2aed96[_0x57a4('0x3c')]);_0x231c92[_0x57a4('0x3e')]=_['intersection'](_0x231c92['model'],_0x231c92['query']);_0x2d8e2e[_0x57a4('0x40')]=_['intersection'](_0x231c92[_0x57a4('0x3b')],qs[_0x57a4('0x41')](_0x2aed96[_0x57a4('0x3c')][_0x57a4('0x41')]));_0x2d8e2e[_0x57a4('0x40')]=_0x2d8e2e[_0x57a4('0x40')][_0x57a4('0x42')]?_0x2d8e2e[_0x57a4('0x40')]:_0x231c92[_0x57a4('0x3b')];if(!_0x2aed96[_0x57a4('0x3c')][_0x57a4('0x43')](_0x57a4('0x44'))){_0x2d8e2e[_0x57a4('0x45')]=qs[_0x57a4('0x45')](_0x2aed96[_0x57a4('0x3c')][_0x57a4('0x45')]);_0x2d8e2e['offset']=qs[_0x57a4('0x26')](_0x2aed96[_0x57a4('0x3c')][_0x57a4('0x26')]);}_0x2d8e2e['order']=qs[_0x57a4('0x46')](_0x2aed96[_0x57a4('0x3c')]['sort']);_0x2d8e2e['where']=qs['filters'](_[_0x57a4('0x47')](_0x2aed96[_0x57a4('0x3c')],_0x231c92[_0x57a4('0x3e')]));_0x2d8e2e[_0x57a4('0x49')][_0x57a4('0x64')]=_0x432570['id'];if(_0x2aed96[_0x57a4('0x3c')][_0x57a4('0x48')]){_0x2d8e2e[_0x57a4('0x49')]=_[_0x57a4('0x4a')](_0x2d8e2e[_0x57a4('0x49')],{'$or':_['map'](_0x2d8e2e[_0x57a4('0x40')],function(_0xfe09b){var _0xa148d={};_0xa148d[_0xfe09b]={'$like':'%'+_0x2aed96['query'][_0x57a4('0x48')]+'%'};return _0xa148d;})});}_0x2d8e2e=_[_0x57a4('0x4a')]({},_0x2d8e2e,_0x2aed96['options']);return db[_0x57a4('0x63')][_0x57a4('0x51')](_0x2d8e2e);}})[_0x57a4('0x2e')](function(_0x122388){if(_0x122388){return db['User'][_0x57a4('0x65')]({'where':{'id':_[_0x57a4('0x36')](_0x122388,_0x57a4('0x66')),'role':_0x57a4('0x67')},'attributes':['id','name',_0x57a4('0x68'),'updatedAt',_0x57a4('0x69')]});}})[_0x57a4('0x2e')](function(_0x3fbdac){if(_0x3fbdac){return{'count':_0x3fbdac[_0x57a4('0x4e')],'rows':_['map'](_0x3fbdac[_0x57a4('0x52')],function(_0x5c902f){return{'membername':_0x5c902f[_0x57a4('0x33')],'UserId':_0x5c902f['id'],'queue_name':_0x3dc2cc['name'],'OpenchannelQueueId':_0x3dc2cc['id'],'interface':util[_0x57a4('0x6a')](_0x57a4('0x6b'),'SIP',_0x5c902f[_0x57a4('0x33')]),'penalty':0x0,'paused':_0x5c902f[_0x57a4('0x68')],'createdAt':_0x5c902f['createdAt'],'updatedAt':_0x5c902f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x57a4('0x2e')](respondWithFilteredResult(_0x46cd80,_0x2d8e2e))[_0x57a4('0x53')](handleError(_0x46cd80,null));};exports[_0x57a4('0x6c')]=function(_0x516bb9,_0x1a63f1,_0x3fe286){var _0x1165e7={};var _0x17f1ce={};var _0xa828e8;var _0x32dfc1;return db[_0x57a4('0x37')][_0x57a4('0x61')]({'where':{'id':_0x516bb9[_0x57a4('0x54')]['id']}})[_0x57a4('0x2e')](handleEntityNotFound(_0x1a63f1,null))[_0x57a4('0x2e')](function(_0x39e0ba){if(_0x39e0ba){_0xa828e8=_0x39e0ba;_0x17f1ce[_0x57a4('0x3b')]=_['keys'](db['Team'][_0x57a4('0x38')]);_0x17f1ce[_0x57a4('0x3c')]=_[_0x57a4('0x3d')](_0x516bb9[_0x57a4('0x3c')]);_0x17f1ce[_0x57a4('0x3e')]=_[_0x57a4('0x3f')](_0x17f1ce['model'],_0x17f1ce[_0x57a4('0x3c')]);_0x1165e7[_0x57a4('0x40')]=_[_0x57a4('0x3f')](_0x17f1ce[_0x57a4('0x3b')],qs[_0x57a4('0x41')](_0x516bb9[_0x57a4('0x3c')][_0x57a4('0x41')]));_0x1165e7[_0x57a4('0x40')]=_0x1165e7[_0x57a4('0x40')][_0x57a4('0x42')]?_0x1165e7['attributes']:_0x17f1ce[_0x57a4('0x3b')];_0x1165e7[_0x57a4('0x6d')]=qs[_0x57a4('0x46')](_0x516bb9[_0x57a4('0x3c')][_0x57a4('0x46')]);_0x1165e7[_0x57a4('0x49')]=qs['filters'](_[_0x57a4('0x47')](_0x516bb9[_0x57a4('0x3c')],_0x17f1ce[_0x57a4('0x3e')]));if(_0x516bb9[_0x57a4('0x3c')][_0x57a4('0x48')]){_0x1165e7['where']=_[_0x57a4('0x4a')](_0x1165e7['where'],{'$or':_[_0x57a4('0x36')](_0x1165e7[_0x57a4('0x40')],function(_0x5e9f11){var _0x13abff={};_0x13abff[_0x5e9f11]={'$like':'%'+_0x516bb9[_0x57a4('0x3c')][_0x57a4('0x48')]+'%'};return _0x13abff;})});}_0x1165e7=_[_0x57a4('0x4a')]({},_0x1165e7,_0x516bb9[_0x57a4('0x4d')]);return _0xa828e8['getTeams'](_0x1165e7);}})[_0x57a4('0x2e')](function(_0x45ba6d){if(_0x45ba6d){_0x32dfc1=_0x45ba6d[_0x57a4('0x42')];if(!_0x516bb9[_0x57a4('0x3c')]['hasOwnProperty'](_0x57a4('0x44'))){_0x1165e7[_0x57a4('0x45')]=qs[_0x57a4('0x45')](_0x516bb9[_0x57a4('0x3c')][_0x57a4('0x45')]);_0x1165e7[_0x57a4('0x26')]=qs[_0x57a4('0x26')](_0x516bb9[_0x57a4('0x3c')]['offset']);}return _0xa828e8[_0x57a4('0x6c')](_0x1165e7);}})['then'](function(_0x97595e){if(_0x97595e){return _0x97595e?{'count':_0x32dfc1,'rows':_0x97595e}:null;}})[_0x57a4('0x2e')](respondWithResult(_0x1a63f1,null))['catch'](handleError(_0x1a63f1,null));};exports[_0x57a4('0x6e')]=function(_0x2430ba,_0x5800f2,_0x56f1f7){var _0x12768a=_0x2430ba[_0x57a4('0x57')][_0x57a4('0x6f')];return db[_0x57a4('0x70')]['findAll']({'where':{'id':_0x12768a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x57a4('0x33'),_0x57a4('0x71'),_0x57a4('0x72'),_0x57a4('0x73')],'raw':!![]}]})[_0x57a4('0x2e')](function(_0x4c731f){if(_0x4c731f){var _0x1b711b=_['flatMap'](_0x4c731f,function(_0x5de650){var _0x3bd1ac=_0x5de650['get']({'plain':!![]});return _0x3bd1ac[_0x57a4('0x74')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x2430ba['params']['id']}})['then'](function(_0x51bbf6){return db[_0x57a4('0x75')][_0x57a4('0x76')](function(_0x308bf3){return _0x51bbf6[_0x57a4('0x6e')](_0x12768a,{'transaction':_0x308bf3})[_0x57a4('0x2e')](function(){return BPromise[_0x57a4('0x77')](_0x1b711b,function(_0x99e147){return db[_0x57a4('0x63')][_0x57a4('0x78')]({'where':{'UserId':_0x99e147['id'],'OpenchannelQueueId':_0x2430ba[_0x57a4('0x54')]['id']},'transaction':_0x308bf3});});})['then'](function(){_0x1b711b[_0x57a4('0x79')](function(_0x5accbe){socket[_0x57a4('0x7a')](_0x57a4('0x7b'),{'UserId':_0x5accbe['id'],'OpenchannelQueueId':_0x51bbf6['id']});});});});});}})['then'](respondWithStatusCode(_0x5800f2,null))[_0x57a4('0x53')](handleError(_0x5800f2,null));};exports['removeTeams']=function(_0x38eea4,_0x548121,_0x3b3139){return db['Team'][_0x57a4('0x51')]({'where':{'id':_0x38eea4['query'][_0x57a4('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x57a4('0x7c')],'as':_0x57a4('0x74'),'attributes':['id'],'raw':!![]}]})[_0x57a4('0x2e')](handleEntityNotFound(_0x548121,null))[_0x57a4('0x2e')](function(_0x30fc35){var _0x16c25d=_[_0x57a4('0x36')](_0x30fc35,'id');var _0xd96b16=[];var _0x15e734=[];var _0x536f80=squel[_0x57a4('0x7d')]();_0x536f80['field']('tq.TeamId')['from'](_0x57a4('0x7e'),'tq')[_0x57a4('0x7f')](_0x57a4('0x80'),'ut',_0x57a4('0x81'))[_0x57a4('0x49')](_0x57a4('0x82'),_0x38eea4[_0x57a4('0x54')]['id']);for(var _0x204e68=0x0;_0x204e68<_0x30fc35[_0x57a4('0x42')];_0x204e68+=0x1){let _0x252dae=_0x30fc35[_0x204e68];for(var _0x5e599f=0x0;_0x5e599f<_0x252dae[_0x57a4('0x74')][_0x57a4('0x42')];_0x5e599f+=0x1){let _0x3b9620=_0x252dae[_0x57a4('0x74')][_0x5e599f];var _0xb1d8d3=_0x536f80[_0x57a4('0x83')]();_0xb1d8d3[_0x57a4('0x49')](_0x57a4('0x84'),_0x3b9620['id']);_0x15e734[_0x57a4('0x85')](db[_0x57a4('0x75')][_0x57a4('0x3c')](_0xb1d8d3['toString'](),{'type':db['sequelize'][_0x57a4('0x86')]['SELECT']})['then'](function(_0x11c44a){if(_0x11c44a[_0x57a4('0x42')]===0x1){return _0x3b9620['id'];}else{var _0x3138cb=_[_0x57a4('0x87')](_['map'](_0x11c44a,_0x57a4('0x88')),function(_0x137d72){return _[_0x57a4('0x89')](_0x16c25d,_0x137d72);});if(_0x3138cb){return _0x3b9620['id'];}}}));}}return BPromise[_0x57a4('0x8a')](_0x15e734)['then'](function(_0x3a1dae){_0xd96b16=_(_0xd96b16)[_0x57a4('0x8b')](_0x3a1dae)[_0x57a4('0x8c')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x38eea4[_0x57a4('0x54')]['id']}})[_0x57a4('0x2e')](function(_0x555b6a){return db[_0x57a4('0x75')]['transaction'](function(_0x5b7150){return _0x555b6a[_0x57a4('0x8d')](_0x38eea4[_0x57a4('0x3c')][_0x57a4('0x6f')],{'transaction':_0x5b7150})['then'](function(){if(!_['isEmpty'](_0xd96b16)){return _0x555b6a[_0x57a4('0x8e')](_0xd96b16,{'transaction':_0x5b7150});}})['then'](function(){_0xd96b16[_0x57a4('0x79')](function(_0x93cde0){socket[_0x57a4('0x7a')](_0x57a4('0x8f'),{'UserId':_0x93cde0,'OpenchannelQueueId':_0x555b6a['id']});});});});});});})[_0x57a4('0x2e')](respondWithStatusCode(_0x548121,null))[_0x57a4('0x53')](handleError(_0x548121,null));};exports['addAgents']=function(_0x59967b,_0x20f4f1,_0x13d58e){return db[_0x57a4('0x37')]['find']({'where':{'id':_0x59967b[_0x57a4('0x54')]['id']}})[_0x57a4('0x2e')](handleEntityNotFound(_0x20f4f1,null))[_0x57a4('0x2e')](function(_0x531e5c){if(_0x531e5c){return _0x531e5c[_0x57a4('0x90')](_0x59967b[_0x57a4('0x57')][_0x57a4('0x6f')],_['omit'](_0x59967b[_0x57a4('0x57')],[_0x57a4('0x6f'),'id'])||{})[_0x57a4('0x91')](function(_0x362acc){for(var _0xb8b7d9=0x0;_0xb8b7d9<_0x59967b[_0x57a4('0x57')][_0x57a4('0x6f')][_0x57a4('0x42')];_0xb8b7d9+=0x1){socket[_0x57a4('0x7a')](_0x57a4('0x7b'),{'UserId':_0x59967b[_0x57a4('0x57')][_0x57a4('0x6f')][_0xb8b7d9],'OpenchannelQueueId':_0x59967b['params']['id']});}return _0x362acc;});}})['then'](respondWithResult(_0x20f4f1,null))[_0x57a4('0x53')](handleError(_0x20f4f1,null));};exports[_0x57a4('0x8e')]=function(_0x37eed6,_0x56bd25,_0x107fa6){return db['OpenchannelQueue'][_0x57a4('0x55')]({'where':{'id':_0x37eed6[_0x57a4('0x54')]['id']}})[_0x57a4('0x2e')](handleEntityNotFound(_0x56bd25,null))['then'](function(_0x33ce95){if(_0x33ce95){return _0x33ce95[_0x57a4('0x8e')](_0x37eed6[_0x57a4('0x3c')]['ids'])['then'](function(){if(_['isArray'](_0x37eed6[_0x57a4('0x3c')][_0x57a4('0x6f')])){for(var _0x478d60=0x0;_0x478d60<_0x37eed6[_0x57a4('0x3c')]['ids']['length'];_0x478d60+=0x1){socket[_0x57a4('0x7a')](_0x57a4('0x8f'),{'UserId':Number(_0x37eed6['query'][_0x57a4('0x6f')][_0x478d60]),'OpenchannelQueueId':Number(_0x37eed6[_0x57a4('0x54')]['id'])});}}else{socket[_0x57a4('0x7a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x37eed6[_0x57a4('0x3c')][_0x57a4('0x6f')]),'OpenchannelQueueId':Number(_0x37eed6[_0x57a4('0x54')]['id'])});}});}})[_0x57a4('0x2e')](respondWithStatusCode(_0x56bd25,null))[_0x57a4('0x53')](handleError(_0x56bd25,null));};exports[_0x57a4('0x92')]=function(_0x11185c,_0x5298c8,_0x3d7878){var _0x173104={};var _0x40af3f={};var _0x511ea8;var _0x33a09a;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x11185c[_0x57a4('0x54')]['id']}})[_0x57a4('0x2e')](handleEntityNotFound(_0x5298c8,null))['then'](function(_0x111286){if(_0x111286){_0x511ea8=_0x111286;_0x40af3f[_0x57a4('0x3b')]=_[_0x57a4('0x3d')](db[_0x57a4('0x7c')]['rawAttributes']);_0x40af3f[_0x57a4('0x3c')]=_[_0x57a4('0x3d')](_0x11185c[_0x57a4('0x3c')]);_0x40af3f['filters']=_[_0x57a4('0x3f')](_0x40af3f[_0x57a4('0x3b')],_0x40af3f[_0x57a4('0x3c')]);_0x173104[_0x57a4('0x40')]=_['intersection'](_0x40af3f['model'],qs[_0x57a4('0x41')](_0x11185c[_0x57a4('0x3c')][_0x57a4('0x41')]));_0x173104[_0x57a4('0x40')]=_0x173104[_0x57a4('0x40')][_0x57a4('0x42')]?_0x173104[_0x57a4('0x40')]:_0x40af3f[_0x57a4('0x3b')];_0x173104['order']=qs['sort'](_0x11185c['query'][_0x57a4('0x46')]);_0x173104[_0x57a4('0x49')]=qs[_0x57a4('0x3e')](_['pick'](_0x11185c[_0x57a4('0x3c')],_0x40af3f[_0x57a4('0x3e')]));if(_0x11185c[_0x57a4('0x3c')]['filter']){_0x173104['where']=_[_0x57a4('0x4a')](_0x173104[_0x57a4('0x49')],{'$or':_['map'](_0x173104[_0x57a4('0x40')],function(_0x28f731){var _0x109235={};_0x109235[_0x28f731]={'$like':'%'+_0x11185c[_0x57a4('0x3c')][_0x57a4('0x48')]+'%'};return _0x109235;})});}_0x173104=_[_0x57a4('0x4a')]({},_0x173104,_0x11185c[_0x57a4('0x4d')]);return _0x511ea8['getAgents'](_0x173104);}})['then'](function(_0x558a1f){if(_0x558a1f){_0x33a09a=_0x558a1f[_0x57a4('0x42')];if(!_0x11185c['query'][_0x57a4('0x43')](_0x57a4('0x44'))){_0x173104[_0x57a4('0x45')]=qs['limit'](_0x11185c[_0x57a4('0x3c')][_0x57a4('0x45')]);_0x173104['offset']=qs[_0x57a4('0x26')](_0x11185c['query'][_0x57a4('0x26')]);}return _0x511ea8['getAgents'](_0x173104);}})[_0x57a4('0x2e')](function(_0x49f848){if(_0x49f848){return _0x49f848?{'count':_0x33a09a,'rows':_0x49f848}:null;}})[_0x57a4('0x2e')](respondWithResult(_0x5298c8,null))[_0x57a4('0x53')](handleError(_0x5298c8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 481b71d..8d2221a 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 _0xf6c9=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2f0cd5,_0x586f30){var _0x145f7b=function(_0xc75c71){while(--_0xc75c71){_0x2f0cd5['push'](_0x2f0cd5['shift']());}};_0x145f7b(++_0x586f30);}(_0xf6c9,0x78));var _0x9f6c=function(_0x19b675,_0x37ef76){_0x19b675=_0x19b675-0x0;var _0x449e4b=_0xf6c9[_0x19b675];return _0x449e4b;};'use strict';var EventEmitter=require(_0x9f6c('0x0'));var OpenchannelQueue=require(_0x9f6c('0x1'))['db'][_0x9f6c('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9f6c('0x3')](0x0);var events={'afterCreate':_0x9f6c('0x4'),'afterUpdate':_0x9f6c('0x5'),'afterDestroy':_0x9f6c('0x6')};function emitEvent(_0x1025c1){return function(_0x3ad069,_0x43d511,_0x252d1a){OpenchannelQueueEvents[_0x9f6c('0x7')](_0x1025c1+':'+_0x3ad069['id'],_0x3ad069);OpenchannelQueueEvents[_0x9f6c('0x7')](_0x1025c1,_0x3ad069);_0x252d1a(null);};}for(var e in events){if(events[_0x9f6c('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x9f6c('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xe2f6=['save','remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x2904a8,_0x73180){var _0x4aae50=function(_0x491df9){while(--_0x491df9){_0x2904a8['push'](_0x2904a8['shift']());}};_0x4aae50(++_0x73180);}(_0xe2f6,0x83));var _0x6e2f=function(_0x266c40,_0x284502){_0x266c40=_0x266c40-0x0;var _0x35aa8a=_0xe2f6[_0x266c40];return _0x35aa8a;};'use strict';var EventEmitter=require(_0x6e2f('0x0'));var OpenchannelQueue=require(_0x6e2f('0x1'))['db'][_0x6e2f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6e2f('0x3')](0x0);var events={'afterCreate':_0x6e2f('0x4'),'afterUpdate':'update','afterDestroy':_0x6e2f('0x5')};function emitEvent(_0x79c611){return function(_0x4eb1cd,_0x43c1cd,_0x2fb7dd){OpenchannelQueueEvents[_0x6e2f('0x6')](_0x79c611+':'+_0x4eb1cd['id'],_0x4eb1cd);OpenchannelQueueEvents[_0x6e2f('0x6')](_0x79c611,_0x4eb1cd);_0x2fb7dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x6e2f('0x7')](e,emitEvent(event));}}module[_0x6e2f('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 8a3bd40..31bd589 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 _0xe6fa=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','openchannel_queues'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xe6fa,0x154));var _0xae6f=function(_0x271089,_0x38fc51){_0x271089=_0x271089-0x0;var _0x5eeb64=_0xe6fa[_0x271089];return _0x5eeb64;};'use strict';var _=require(_0xae6f('0x0'));var util=require(_0xae6f('0x1'));var logger=require('../../config/logger')(_0xae6f('0x2'));var moment=require(_0xae6f('0x3'));var BPromise=require(_0xae6f('0x4'));var rp=require(_0xae6f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae6f('0x6'));var config=require(_0xae6f('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x3c9b76,_0x410f34){return _0x3c9b76[_0xae6f('0x8')]('OpenchannelQueue',attributes,{'tableName':_0xae6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb11=['lodash','util','../../config/logger','api','moment','request-promise','path','exports','define','OpenchannelQueue'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xcb11,0x1a4));var _0x1cb1=function(_0x30505a,_0x4d35c0){_0x30505a=_0x30505a-0x0;var _0x1c664b=_0xcb11[_0x30505a];return _0x1c664b;};'use strict';var _=require(_0x1cb1('0x0'));var util=require(_0x1cb1('0x1'));var logger=require(_0x1cb1('0x2'))(_0x1cb1('0x3'));var moment=require(_0x1cb1('0x4'));var BPromise=require('bluebird');var rp=require(_0x1cb1('0x5'));var fs=require('fs');var path=require(_0x1cb1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x1cb1('0x7')]=function(_0x33112d,_0x22c556){return _0x33112d[_0x1cb1('0x8')](_0x1cb1('0x9'),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 b13fa85..3910c51 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 _0x5626=['include','model','map','find','ShowOpenchannelQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x5626,0x1e5));var _0x6562=function(_0x3bbdb9,_0xb684b2){_0x3bbdb9=_0x3bbdb9-0x0;var _0x3c2000=_0x5626[_0x3bbdb9];return _0x3c2000;};'use strict';var _=require(_0x6562('0x0'));var util=require(_0x6562('0x1'));var moment=require(_0x6562('0x2'));var BPromise=require('bluebird');var rs=require(_0x6562('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6562('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6562('0x5'))(_0x6562('0x6'));var config=require(_0x6562('0x7'));var jayson=require(_0x6562('0x8'));var client=jayson[_0x6562('0x9')][_0x6562('0xa')]({'port':0x232a});config[_0x6562('0xb')]=_[_0x6562('0xc')](config['redis'],{'host':_0x6562('0xd'),'port':0x18eb});var socket=require(_0x6562('0xe'))(new Redis(config[_0x6562('0xb')]));require(_0x6562('0xf'))[_0x6562('0x10')](socket);function respondWithRpcPromise(_0x383714,_0x5413a3,_0xae1c01){return new BPromise(function(_0xc19928,_0x4248c3){return client[_0x6562('0x11')](_0x383714,_0xae1c01)[_0x6562('0x12')](function(_0x5853fa){logger[_0x6562('0x13')](_0x6562('0x14'),_0x5413a3,'request\x20sent');logger[_0x6562('0x15')](_0x6562('0x16'),_0x5413a3,'request\x20sent',JSON[_0x6562('0x17')](_0x5853fa));if(_0x5853fa['error']){if(_0x5853fa[_0x6562('0x18')]['code']===0x1f4){logger[_0x6562('0x18')](_0x6562('0x14'),_0x5413a3,_0x5853fa[_0x6562('0x18')][_0x6562('0x19')]);return _0x4248c3(_0x5853fa[_0x6562('0x18')]['message']);}logger[_0x6562('0x18')](_0x6562('0x14'),_0x5413a3,_0x5853fa[_0x6562('0x18')][_0x6562('0x19')]);return _0xc19928(_0x5853fa['error'][_0x6562('0x19')]);}else{logger[_0x6562('0x13')](_0x6562('0x14'),_0x5413a3,_0x6562('0x1a'));_0xc19928(_0x5853fa['result'][_0x6562('0x19')]);}})['catch'](function(_0x416dd5){logger[_0x6562('0x18')](_0x6562('0x14'),_0x5413a3,_0x416dd5);_0x4248c3(_0x416dd5);});});}exports[_0x6562('0x1b')]=function(_0x81d2d){var _0x8cda71=this;return new Promise(function(_0x49068c,_0x533118){return db[_0x6562('0x1c')][_0x6562('0x1d')]({'raw':_0x81d2d['options']?_0x81d2d[_0x6562('0x1e')][_0x6562('0x1f')]===undefined?!![]:![]:!![],'where':_0x81d2d['options']?_0x81d2d[_0x6562('0x1e')][_0x6562('0x20')]||null:null,'attributes':_0x81d2d[_0x6562('0x1e')]?_0x81d2d[_0x6562('0x1e')][_0x6562('0x21')]||null:null,'limit':_0x81d2d[_0x6562('0x1e')]?_0x81d2d[_0x6562('0x1e')][_0x6562('0x22')]||null:null,'include':_0x81d2d['options']?_0x81d2d[_0x6562('0x1e')][_0x6562('0x23')]?_['map'](_0x81d2d['options'][_0x6562('0x23')],function(_0x2e5878){return{'model':db[_0x2e5878[_0x6562('0x24')]],'as':_0x2e5878['as'],'attributes':_0x2e5878[_0x6562('0x21')],'include':_0x2e5878[_0x6562('0x23')]?_[_0x6562('0x25')](_0x2e5878[_0x6562('0x23')],function(_0x1b1e6b){return{'model':db[_0x1b1e6b['model']],'as':_0x1b1e6b['as'],'attributes':_0x1b1e6b['attributes'],'include':_0x1b1e6b['include']?_[_0x6562('0x25')](_0x1b1e6b[_0x6562('0x23')],function(_0x481708){return{'model':db[_0x481708[_0x6562('0x24')]],'as':_0x481708['as'],'attributes':_0x481708['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x425dde){logger[_0x6562('0x13')](_0x6562('0x1b'),_0x81d2d);logger[_0x6562('0x15')](_0x6562('0x1b'),_0x81d2d,JSON[_0x6562('0x17')](_0x425dde));_0x49068c(_0x425dde);})['catch'](function(_0x1ba2ac){logger[_0x6562('0x18')]('GetOpenchannelQueue',_0x1ba2ac[_0x6562('0x19')],_0x81d2d);_0x533118(_0x8cda71[_0x6562('0x18')](0x1f4,_0x1ba2ac['message']));});});};exports['ShowOpenchannelQueue']=function(_0x2701cd){var _0x502b68=this;return new Promise(function(_0x244f12,_0x4ab4a1){return db[_0x6562('0x1c')][_0x6562('0x26')]({'raw':_0x2701cd['options']?_0x2701cd[_0x6562('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2701cd[_0x6562('0x1e')]?_0x2701cd[_0x6562('0x1e')][_0x6562('0x20')]||null:null,'attributes':_0x2701cd[_0x6562('0x1e')]?_0x2701cd[_0x6562('0x1e')][_0x6562('0x21')]||null:null,'include':_0x2701cd[_0x6562('0x1e')]?_0x2701cd[_0x6562('0x1e')][_0x6562('0x23')]?_[_0x6562('0x25')](_0x2701cd[_0x6562('0x1e')]['include'],function(_0x41f31e){return{'model':db[_0x41f31e[_0x6562('0x24')]],'as':_0x41f31e['as'],'attributes':_0x41f31e[_0x6562('0x21')],'include':_0x41f31e[_0x6562('0x23')]?_[_0x6562('0x25')](_0x41f31e['include'],function(_0x3fb09f){return{'model':db[_0x3fb09f[_0x6562('0x24')]],'as':_0x3fb09f['as'],'attributes':_0x3fb09f[_0x6562('0x21')],'include':_0x3fb09f['include']?_[_0x6562('0x25')](_0x3fb09f[_0x6562('0x23')],function(_0x598dda){return{'model':db[_0x598dda['model']],'as':_0x598dda['as'],'attributes':_0x598dda[_0x6562('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48075b){logger[_0x6562('0x13')]('ShowOpenchannelQueue',_0x2701cd);logger[_0x6562('0x15')](_0x6562('0x27'),_0x2701cd,JSON[_0x6562('0x17')](_0x48075b));_0x244f12(_0x48075b);})['catch'](function(_0x5eaab9){logger[_0x6562('0x18')]('ShowOpenchannelQueue',_0x5eaab9['message'],_0x2701cd);_0x4ab4a1(_0x502b68[_0x6562('0x18')](0x1f4,_0x5eaab9[_0x6562('0x19')]));});});}; \ No newline at end of file +var _0xf97a=['catch','OpenchannelQueue','findAll','options','raw','where','limit','include','model','attributes','map','GetOpenchannelQueue','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x9311b3,_0x97f597){var _0x1ddbca=function(_0x59c01f){while(--_0x59c01f){_0x9311b3['push'](_0x9311b3['shift']());}};_0x1ddbca(++_0x97f597);}(_0xf97a,0xba));var _0xaf97=function(_0x20be4e,_0x197bc8){_0x20be4e=_0x20be4e-0x0;var _0x351c6f=_0xf97a[_0x20be4e];return _0x351c6f;};'use strict';var _=require(_0xaf97('0x0'));var util=require('util');var moment=require(_0xaf97('0x1'));var BPromise=require(_0xaf97('0x2'));var rs=require(_0xaf97('0x3'));var fs=require('fs');var Redis=require(_0xaf97('0x4'));var db=require(_0xaf97('0x5'))['db'];var utils=require(_0xaf97('0x6'));var logger=require(_0xaf97('0x7'))(_0xaf97('0x8'));var config=require(_0xaf97('0x9'));var jayson=require(_0xaf97('0xa'));var client=jayson[_0xaf97('0xb')][_0xaf97('0xc')]({'port':0x232a});config[_0xaf97('0xd')]=_[_0xaf97('0xe')](config[_0xaf97('0xd')],{'host':_0xaf97('0xf'),'port':0x18eb});var socket=require(_0xaf97('0x10'))(new Redis(config['redis']));require(_0xaf97('0x11'))['register'](socket);function respondWithRpcPromise(_0x2be20c,_0x2367bd,_0x47828d){return new BPromise(function(_0x48e6f1,_0x271c4f){return client['request'](_0x2be20c,_0x47828d)[_0xaf97('0x12')](function(_0x6d42cb){logger[_0xaf97('0x13')](_0xaf97('0x14'),_0x2367bd,_0xaf97('0x15'));logger[_0xaf97('0x16')](_0xaf97('0x17'),_0x2367bd,_0xaf97('0x15'),JSON[_0xaf97('0x18')](_0x6d42cb));if(_0x6d42cb[_0xaf97('0x19')]){if(_0x6d42cb[_0xaf97('0x19')][_0xaf97('0x1a')]===0x1f4){logger['error'](_0xaf97('0x14'),_0x2367bd,_0x6d42cb[_0xaf97('0x19')]['message']);return _0x271c4f(_0x6d42cb['error'][_0xaf97('0x1b')]);}logger[_0xaf97('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x2367bd,_0x6d42cb[_0xaf97('0x19')]['message']);return _0x48e6f1(_0x6d42cb[_0xaf97('0x19')][_0xaf97('0x1b')]);}else{logger[_0xaf97('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x2367bd,'request\x20sent');_0x48e6f1(_0x6d42cb[_0xaf97('0x1c')]['message']);}})[_0xaf97('0x1d')](function(_0x127e65){logger[_0xaf97('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x2367bd,_0x127e65);_0x271c4f(_0x127e65);});});}exports['GetOpenchannelQueue']=function(_0x128ec1){var _0x5a720a=this;return new Promise(function(_0x245b93,_0x1c13e6){return db[_0xaf97('0x1e')][_0xaf97('0x1f')]({'raw':_0x128ec1['options']?_0x128ec1[_0xaf97('0x20')][_0xaf97('0x21')]===undefined?!![]:![]:!![],'where':_0x128ec1[_0xaf97('0x20')]?_0x128ec1[_0xaf97('0x20')][_0xaf97('0x22')]||null:null,'attributes':_0x128ec1[_0xaf97('0x20')]?_0x128ec1[_0xaf97('0x20')]['attributes']||null:null,'limit':_0x128ec1['options']?_0x128ec1[_0xaf97('0x20')][_0xaf97('0x23')]||null:null,'include':_0x128ec1[_0xaf97('0x20')]?_0x128ec1[_0xaf97('0x20')][_0xaf97('0x24')]?_['map'](_0x128ec1[_0xaf97('0x20')][_0xaf97('0x24')],function(_0x27e333){return{'model':db[_0x27e333[_0xaf97('0x25')]],'as':_0x27e333['as'],'attributes':_0x27e333[_0xaf97('0x26')],'include':_0x27e333[_0xaf97('0x24')]?_[_0xaf97('0x27')](_0x27e333['include'],function(_0x3c83aa){return{'model':db[_0x3c83aa[_0xaf97('0x25')]],'as':_0x3c83aa['as'],'attributes':_0x3c83aa[_0xaf97('0x26')],'include':_0x3c83aa['include']?_[_0xaf97('0x27')](_0x3c83aa['include'],function(_0x598a2a){return{'model':db[_0x598a2a[_0xaf97('0x25')]],'as':_0x598a2a['as'],'attributes':_0x598a2a[_0xaf97('0x26')]};}):[]};}):[]};}):[]:[]})[_0xaf97('0x12')](function(_0xa71d7b){logger[_0xaf97('0x13')]('GetOpenchannelQueue',_0x128ec1);logger[_0xaf97('0x16')](_0xaf97('0x28'),_0x128ec1,JSON[_0xaf97('0x18')](_0xa71d7b));_0x245b93(_0xa71d7b);})[_0xaf97('0x1d')](function(_0x5746c6){logger[_0xaf97('0x19')](_0xaf97('0x28'),_0x5746c6[_0xaf97('0x1b')],_0x128ec1);_0x1c13e6(_0x5a720a[_0xaf97('0x19')](0x1f4,_0x5746c6[_0xaf97('0x1b')]));});});};exports[_0xaf97('0x29')]=function(_0x1babb2){var _0x27ed53=this;return new Promise(function(_0x4e3419,_0x3ed7c8){return db[_0xaf97('0x1e')][_0xaf97('0x2a')]({'raw':_0x1babb2[_0xaf97('0x20')]?_0x1babb2[_0xaf97('0x20')][_0xaf97('0x21')]===undefined?!![]:![]:!![],'where':_0x1babb2[_0xaf97('0x20')]?_0x1babb2[_0xaf97('0x20')][_0xaf97('0x22')]||null:null,'attributes':_0x1babb2[_0xaf97('0x20')]?_0x1babb2[_0xaf97('0x20')][_0xaf97('0x26')]||null:null,'include':_0x1babb2['options']?_0x1babb2[_0xaf97('0x20')][_0xaf97('0x24')]?_['map'](_0x1babb2[_0xaf97('0x20')][_0xaf97('0x24')],function(_0x568fd6){return{'model':db[_0x568fd6[_0xaf97('0x25')]],'as':_0x568fd6['as'],'attributes':_0x568fd6[_0xaf97('0x26')],'include':_0x568fd6[_0xaf97('0x24')]?_[_0xaf97('0x27')](_0x568fd6[_0xaf97('0x24')],function(_0x8f2ab4){return{'model':db[_0x8f2ab4[_0xaf97('0x25')]],'as':_0x8f2ab4['as'],'attributes':_0x8f2ab4[_0xaf97('0x26')],'include':_0x8f2ab4[_0xaf97('0x24')]?_['map'](_0x8f2ab4[_0xaf97('0x24')],function(_0x278831){return{'model':db[_0x278831['model']],'as':_0x278831['as'],'attributes':_0x278831[_0xaf97('0x26')]};}):[]};}):[]};}):[]:[]})[_0xaf97('0x12')](function(_0x447709){logger[_0xaf97('0x13')](_0xaf97('0x29'),_0x1babb2);logger[_0xaf97('0x16')](_0xaf97('0x29'),_0x1babb2,JSON[_0xaf97('0x18')](_0x447709));_0x4e3419(_0x447709);})[_0xaf97('0x1d')](function(_0x33689e){logger['error']('ShowOpenchannelQueue',_0x33689e[_0xaf97('0x1b')],_0x1babb2);_0x3ed7c8(_0x27ed53[_0xaf97('0x19')](0x1f4,_0x33689e[_0xaf97('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index abefb92..0ebe7c0 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 _0x1c97=['openchannelQueue:','./openchannelQueue.events','update','emit','register','length'];(function(_0x6dea9f,_0x5a12a2){var _0x16b14e=function(_0xe49055){while(--_0xe49055){_0x6dea9f['push'](_0x6dea9f['shift']());}};_0x16b14e(++_0x5a12a2);}(_0x1c97,0x199));var _0x71c9=function(_0x587c9d,_0x5e7121){_0x587c9d=_0x587c9d-0x0;var _0x190a78=_0x1c97[_0x587c9d];return _0x190a78;};'use strict';var OpenchannelQueueEvents=require(_0x71c9('0x0'));var events=['save','remove',_0x71c9('0x1')];function createListener(_0x3ef773,_0xaf8614){return function(_0x34ce8f){_0xaf8614[_0x71c9('0x2')](_0x3ef773,_0x34ce8f);};}function removeListener(_0x451b6c,_0x72f66e){return function(){OpenchannelQueueEvents['removeListener'](_0x451b6c,_0x72f66e);};}exports[_0x71c9('0x3')]=function(_0x276846){for(var _0x1050b1=0x0,_0xb9c230=events[_0x71c9('0x4')];_0x1050b1<_0xb9c230;_0x1050b1++){var _0x3d2eb8=events[_0x1050b1];var _0x2f6dc0=createListener(_0x71c9('0x5')+_0x3d2eb8,_0x276846);OpenchannelQueueEvents['on'](_0x3d2eb8,_0x2f6dc0);}}; \ No newline at end of file +var _0x212e=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','removeListener'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x212e,0x15a));var _0xe212=function(_0x5b9d3a,_0x1f1842){_0x5b9d3a=_0x5b9d3a-0x0;var _0x383375=_0x212e[_0x5b9d3a];return _0x383375;};'use strict';var OpenchannelQueueEvents=require(_0xe212('0x0'));var events=[_0xe212('0x1'),_0xe212('0x2'),'update'];function createListener(_0x36eca6,_0x3babca){return function(_0x36b667){_0x3babca['emit'](_0x36eca6,_0x36b667);};}function removeListener(_0x56ebd0,_0x2d900b){return function(){OpenchannelQueueEvents[_0xe212('0x3')](_0x56ebd0,_0x2d900b);};}exports[_0xe212('0x4')]=function(_0x194ca9){for(var _0x1f3537=0x0,_0x38d8c1=events[_0xe212('0x5')];_0x1f3537<_0x38d8c1;_0x1f3537++){var _0x4c39dd=events[_0x1f3537];var _0x5d2dc6=createListener(_0xe212('0x6')+_0x4c39dd,_0x194ca9);OpenchannelQueueEvents['on'](_0x4c39dd,_0x5d2dc6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 21f9670..4c2a935 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 _0x84b5=['index','describe','get','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated'];(function(_0x4c25b3,_0x4feb29){var _0x5a261b=function(_0x371637){while(--_0x371637){_0x4c25b3['push'](_0x4c25b3['shift']());}};_0x5a261b(++_0x4feb29);}(_0x84b5,0x101));var _0x584b=function(_0x11e12b,_0x279c89){_0x11e12b=_0x11e12b-0x0;var _0x3450d5=_0x84b5[_0x11e12b];return _0x3450d5;};'use strict';var multer=require(_0x584b('0x0'));var util=require(_0x584b('0x1'));var path=require('path');var timeout=require(_0x584b('0x2'));var express=require('express');var router=express[_0x584b('0x3')]();var fs_extra=require(_0x584b('0x4'));var auth=require(_0x584b('0x5'));var interaction=require(_0x584b('0x6'));var config=require('../../config/environment');var controller=require(_0x584b('0x7'));router['get']('/',auth[_0x584b('0x8')](),controller[_0x584b('0x9')]);router['get']('/describe',auth[_0x584b('0x8')](),controller[_0x584b('0xa')]);router[_0x584b('0xb')]('/:id',auth[_0x584b('0x8')](),controller[_0x584b('0xc')]);router[_0x584b('0xd')]('/',auth['isAuthenticated'](),controller[_0x584b('0xe')]);router[_0x584b('0xf')]('/:id',auth[_0x584b('0x8')](),controller['update']);router[_0x584b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x584b('0x11')]);module[_0x584b('0x12')]=router; \ No newline at end of file +var _0x4f85=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','destroy','exports'];(function(_0x12b756,_0x43f6f3){var _0x40cc2e=function(_0x4cbae3){while(--_0x4cbae3){_0x12b756['push'](_0x12b756['shift']());}};_0x40cc2e(++_0x43f6f3);}(_0x4f85,0xbe));var _0x54f8=function(_0x71e45c,_0x10ed83){_0x71e45c=_0x71e45c-0x0;var _0x222130=_0x4f85[_0x71e45c];return _0x222130;};'use strict';var multer=require(_0x54f8('0x0'));var util=require(_0x54f8('0x1'));var path=require('path');var timeout=require(_0x54f8('0x2'));var express=require(_0x54f8('0x3'));var router=express[_0x54f8('0x4')]();var fs_extra=require(_0x54f8('0x5'));var auth=require(_0x54f8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x54f8('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x54f8('0x8')]('/',auth[_0x54f8('0x9')](),controller[_0x54f8('0xa')]);router[_0x54f8('0x8')](_0x54f8('0xb'),auth[_0x54f8('0x9')](),controller[_0x54f8('0xc')]);router[_0x54f8('0x8')]('/:id',auth[_0x54f8('0x9')](),controller[_0x54f8('0xd')]);router[_0x54f8('0xe')]('/',auth[_0x54f8('0x9')](),controller['create']);router[_0x54f8('0xf')]('/:id',auth[_0x54f8('0x9')](),controller['update']);router['delete'](_0x54f8('0x10'),auth[_0x54f8('0x9')](),controller[_0x54f8('0x11')]);module[_0x54f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 2bde5db..3f30113 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 _0x4613=['sequelize','exports','STRING','DATE','moment'];(function(_0xdbb6c2,_0x434b67){var _0x4b3587=function(_0x4452a0){while(--_0x4452a0){_0xdbb6c2['push'](_0xdbb6c2['shift']());}};_0x4b3587(++_0x434b67);}(_0x4613,0x112));var _0x3461=function(_0x27ae7e,_0x243846){_0x27ae7e=_0x27ae7e-0x0;var _0x512a62=_0x4613[_0x27ae7e];return _0x512a62;};'use strict';var moment=require(_0x3461('0x0'));var Sequelize=require(_0x3461('0x1'));module[_0x3461('0x2')]={'uniqueid':{'type':Sequelize[_0x3461('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3461('0x3')]},'joinAt':{'type':Sequelize[_0x3461('0x4')]},'leaveAt':{'type':Sequelize[_0x3461('0x4')]},'acceptAt':{'type':Sequelize[_0x3461('0x4')]},'exitAt':{'type':Sequelize[_0x3461('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x25df=['STRING','DATE','moment','exports'];(function(_0x424a54,_0x8edfb7){var _0x58c227=function(_0x4e9019){while(--_0x4e9019){_0x424a54['push'](_0x424a54['shift']());}};_0x58c227(++_0x8edfb7);}(_0x25df,0x82));var _0xf25d=function(_0x5568f5,_0x554f1a){_0x5568f5=_0x5568f5-0x0;var _0x5ae328=_0x25df[_0x5568f5];return _0x5ae328;};'use strict';var moment=require(_0xf25d('0x0'));var Sequelize=require('sequelize');module[_0xf25d('0x1')]={'uniqueid':{'type':Sequelize[_0xf25d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf25d('0x2')]},'joinAt':{'type':Sequelize[_0xf25d('0x3')]},'leaveAt':{'type':Sequelize[_0xf25d('0x3')]},'acceptAt':{'type':Sequelize[_0xf25d('0x3')]},'exitAt':{'type':Sequelize[_0xf25d('0x3')]},'reason':{'type':Sequelize[_0xf25d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index feeeb5a..8827872 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 _0xb03e=['merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','filters','pick','where'];(function(_0x5995a0,_0x355345){var _0x572598=function(_0x2f8088){while(--_0x2f8088){_0x5995a0['push'](_0x5995a0['shift']());}};_0x572598(++_0x355345);}(_0xb03e,0x1eb));var _0xeb03=function(_0x43c4dd,_0x5e5c25){_0x43c4dd=_0x43c4dd-0x0;var _0x594aee=_0xb03e[_0x43c4dd];return _0x594aee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb03('0x0'));var rimraf=require(_0xeb03('0x1'));var zipdir=require(_0xeb03('0x2'));var jsonpatch=require(_0xeb03('0x3'));var rp=require(_0xeb03('0x4'));var moment=require(_0xeb03('0x5'));var BPromise=require(_0xeb03('0x6'));var Mustache=require(_0xeb03('0x7'));var util=require(_0xeb03('0x8'));var path=require(_0xeb03('0x9'));var sox=require(_0xeb03('0xa'));var csv=require(_0xeb03('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb03('0xc'));var _=require(_0xeb03('0xd'));var squel=require(_0xeb03('0xe'));var crypto=require(_0xeb03('0xf'));var jsforce=require(_0xeb03('0x10'));var deskjs=require(_0xeb03('0x11'));var toCsv=require('to-csv');var querystring=require(_0xeb03('0x12'));var Papa=require(_0xeb03('0x13'));var Redis=require(_0xeb03('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xeb03('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb03('0x16'));var logger=require(_0xeb03('0x17'))(_0xeb03('0x18'));var utils=require(_0xeb03('0x19'));var config=require(_0xeb03('0x1a'));var licenseUtil=require(_0xeb03('0x1b'));var db=require(_0xeb03('0x1c'))['db'];function respondWithStatusCode(_0x384cbe,_0x97f46d){_0x97f46d=_0x97f46d||0xcc;return function(_0x2422fd){if(_0x2422fd){return _0x384cbe[_0xeb03('0x1d')](_0x97f46d);}return _0x384cbe[_0xeb03('0x1e')](_0x97f46d)['end']();};}function respondWithResult(_0x212082,_0x100bef){_0x100bef=_0x100bef||0xc8;return function(_0x372c71){if(_0x372c71){return _0x212082[_0xeb03('0x1e')](_0x100bef)['json'](_0x372c71);}};}function respondWithFilteredResult(_0x15f4fe,_0x36f5d8){return function(_0x3f26ef){if(_0x3f26ef){var _0x478989=_0x3f26ef[_0xeb03('0x1f')],_0x7ce874=_0x36f5d8[_0xeb03('0x20')],_0x46dd1b=_0x36f5d8[_0xeb03('0x20')]+_0x36f5d8[_0xeb03('0x21')],_0x4095c3;if(_0x46dd1b>=_0x478989){_0x46dd1b=_0x478989;_0x4095c3=0xc8;}else{_0x4095c3=0xce;}_0x15f4fe[_0xeb03('0x1e')](_0x4095c3);return _0x15f4fe[_0xeb03('0x22')](_0xeb03('0x23'),_0x7ce874+'-'+_0x46dd1b+'/'+_0x478989)[_0xeb03('0x24')](_0x3f26ef);}return null;};}function patchUpdates(_0x2c238d){return function(_0x2443d9){try{jsonpatch[_0xeb03('0x25')](_0x2443d9,_0x2c238d,!![]);}catch(_0x4d307c){return BPromise[_0xeb03('0x26')](_0x4d307c);}return _0x2443d9[_0xeb03('0x27')]();};}function saveUpdates(_0x413d3e,_0x391729){return function(_0xe5a1c2){if(_0xe5a1c2){return _0xe5a1c2[_0xeb03('0x28')](_0x413d3e)[_0xeb03('0x29')](function(_0x2c795b){return _0x2c795b;});}return null;};}function removeEntity(_0x3c3d09,_0x5a704b){return function(_0x712ac2){if(_0x712ac2){return _0x712ac2[_0xeb03('0x2a')]()[_0xeb03('0x29')](function(){_0x3c3d09[_0xeb03('0x1e')](0xcc)[_0xeb03('0x2b')]();});}};}function handleEntityNotFound(_0x5dcda3,_0x638353){return function(_0x406864){if(!_0x406864){_0x5dcda3[_0xeb03('0x1d')](0x194);}return _0x406864;};}function handleError(_0x20efa8,_0x3f276a){_0x3f276a=_0x3f276a||0x1f4;return function(_0x119697){logger[_0xeb03('0x2c')](_0x119697[_0xeb03('0x2d')]);if(_0x119697[_0xeb03('0x2e')]){delete _0x119697['name'];}_0x20efa8[_0xeb03('0x1e')](_0x3f276a)[_0xeb03('0x2f')](_0x119697);};}exports[_0xeb03('0x30')]=function(_0x1ada2e,_0x4cdea6){var _0x581685={},_0x1064a5={},_0x49e449={'count':0x0,'rows':[]};var _0x31a622=_[_0xeb03('0x31')](db[_0xeb03('0x32')]['rawAttributes'],function(_0xd4c8ec){return{'name':_0xd4c8ec['fieldName'],'type':_0xd4c8ec['type']['key']};});_0x1064a5['model']=_[_0xeb03('0x31')](_0x31a622,_0xeb03('0x2e'));_0x1064a5['query']=_['keys'](_0x1ada2e['query']);_0x1064a5['filters']=_[_0xeb03('0x33')](_0x1064a5[_0xeb03('0x34')],_0x1064a5[_0xeb03('0x35')]);_0x581685[_0xeb03('0x36')]=_[_0xeb03('0x33')](_0x1064a5['model'],qs[_0xeb03('0x37')](_0x1ada2e['query'][_0xeb03('0x37')]));_0x581685[_0xeb03('0x36')]=_0x581685[_0xeb03('0x36')][_0xeb03('0x38')]?_0x581685[_0xeb03('0x36')]:_0x1064a5[_0xeb03('0x34')];if(!_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x39')]('nolimit')){_0x581685[_0xeb03('0x21')]=qs['limit'](_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x21')]);_0x581685[_0xeb03('0x20')]=qs[_0xeb03('0x20')](_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x20')]);}_0x581685['order']=qs[_0xeb03('0x3a')](_0x1ada2e['query']['sort']);_0x581685['where']=qs[_0xeb03('0x3b')](_[_0xeb03('0x3c')](_0x1ada2e[_0xeb03('0x35')],_0x1064a5[_0xeb03('0x3b')]),_0x31a622);if(_0x1ada2e[_0xeb03('0x35')]['filter']){_0x581685[_0xeb03('0x3d')]=_[_0xeb03('0x3e')](_0x581685[_0xeb03('0x3d')],{'$or':_['map'](_0x31a622,function(_0x4efbb7){if(_0x4efbb7[_0xeb03('0x3f')]!==_0xeb03('0x40')){var _0x47118d={};_0x47118d[_0x4efbb7['name']]={'$like':'%'+_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x41')]+'%'};return _0x47118d;}})});}_0x581685=_['merge']({},_0x581685,_0x1ada2e['options']);var _0x4621da={'where':_0x581685[_0xeb03('0x3d')]};return db['OpenchannelQueueReport'][_0xeb03('0x1f')](_0x4621da)[_0xeb03('0x29')](function(_0x3fa3de){_0x49e449[_0xeb03('0x1f')]=_0x3fa3de;if(_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x42')]){_0x581685[_0xeb03('0x43')]=[{'all':!![]}];}return db[_0xeb03('0x32')][_0xeb03('0x44')](_0x581685);})[_0xeb03('0x29')](function(_0x367d19){_0x49e449[_0xeb03('0x45')]=_0x367d19;return _0x49e449;})[_0xeb03('0x29')](respondWithFilteredResult(_0x4cdea6,_0x581685))[_0xeb03('0x46')](handleError(_0x4cdea6,null));};exports[_0xeb03('0x47')]=function(_0x6b95dd,_0x407f0b){var _0x3f93ef={'raw':!![],'where':{'id':_0x6b95dd[_0xeb03('0x48')]['id']}},_0x35e53d={};_0x35e53d[_0xeb03('0x34')]=_[_0xeb03('0x49')](db[_0xeb03('0x32')]['rawAttributes']);_0x35e53d['query']=_[_0xeb03('0x49')](_0x6b95dd[_0xeb03('0x35')]);_0x35e53d[_0xeb03('0x3b')]=_[_0xeb03('0x33')](_0x35e53d[_0xeb03('0x34')],_0x35e53d[_0xeb03('0x35')]);_0x3f93ef[_0xeb03('0x36')]=_[_0xeb03('0x33')](_0x35e53d['model'],qs[_0xeb03('0x37')](_0x6b95dd[_0xeb03('0x35')][_0xeb03('0x37')]));_0x3f93ef[_0xeb03('0x36')]=_0x3f93ef[_0xeb03('0x36')]['length']?_0x3f93ef['attributes']:_0x35e53d[_0xeb03('0x34')];if(_0x6b95dd['query']['includeAll']){_0x3f93ef['include']=[{'all':!![]}];}_0x3f93ef=_[_0xeb03('0x3e')]({},_0x3f93ef,_0x6b95dd[_0xeb03('0x4a')]);return db[_0xeb03('0x32')][_0xeb03('0x4b')](_0x3f93ef)[_0xeb03('0x29')](handleEntityNotFound(_0x407f0b,null))[_0xeb03('0x29')](respondWithResult(_0x407f0b,null))['catch'](handleError(_0x407f0b,null));};exports[_0xeb03('0x4c')]=function(_0x4bf739,_0x5c4fac){return db[_0xeb03('0x32')][_0xeb03('0x4c')](_0x4bf739[_0xeb03('0x4d')],{})['then'](respondWithResult(_0x5c4fac,0xc9))[_0xeb03('0x46')](handleError(_0x5c4fac,null));};exports[_0xeb03('0x28')]=function(_0x351055,_0x8d7308){if(_0x351055[_0xeb03('0x4d')]['id']){delete _0x351055['body']['id'];}return db[_0xeb03('0x32')]['find']({'where':{'id':_0x351055[_0xeb03('0x48')]['id']}})[_0xeb03('0x29')](handleEntityNotFound(_0x8d7308,null))[_0xeb03('0x29')](saveUpdates(_0x351055[_0xeb03('0x4d')],null))[_0xeb03('0x29')](respondWithResult(_0x8d7308,null))[_0xeb03('0x46')](handleError(_0x8d7308,null));};exports[_0xeb03('0x2a')]=function(_0x292319,_0x38c993){return db[_0xeb03('0x32')][_0xeb03('0x4b')]({'where':{'id':_0x292319[_0xeb03('0x48')]['id']}})[_0xeb03('0x29')](handleEntityNotFound(_0x38c993,null))[_0xeb03('0x29')](removeEntity(_0x38c993,null))[_0xeb03('0x46')](handleError(_0x38c993,null));};exports[_0xeb03('0x4e')]=function(_0xf5c1ab,_0x79b7c6){return db[_0xeb03('0x32')][_0xeb03('0x4e')]()[_0xeb03('0x29')](respondWithResult(_0x79b7c6,null))[_0xeb03('0x46')](handleError(_0x79b7c6,null));}; \ No newline at end of file +var _0xb03e=['merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','filters','pick','where'];(function(_0x340365,_0x336db2){var _0x116e0e=function(_0x2f0298){while(--_0x2f0298){_0x340365['push'](_0x340365['shift']());}};_0x116e0e(++_0x336db2);}(_0xb03e,0x1eb));var _0xeb03=function(_0x5e7c46,_0x2d349b){_0x5e7c46=_0x5e7c46-0x0;var _0x58f795=_0xb03e[_0x5e7c46];return _0x58f795;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb03('0x0'));var rimraf=require(_0xeb03('0x1'));var zipdir=require(_0xeb03('0x2'));var jsonpatch=require(_0xeb03('0x3'));var rp=require(_0xeb03('0x4'));var moment=require(_0xeb03('0x5'));var BPromise=require(_0xeb03('0x6'));var Mustache=require(_0xeb03('0x7'));var util=require(_0xeb03('0x8'));var path=require(_0xeb03('0x9'));var sox=require(_0xeb03('0xa'));var csv=require(_0xeb03('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb03('0xc'));var _=require(_0xeb03('0xd'));var squel=require(_0xeb03('0xe'));var crypto=require(_0xeb03('0xf'));var jsforce=require(_0xeb03('0x10'));var deskjs=require(_0xeb03('0x11'));var toCsv=require('to-csv');var querystring=require(_0xeb03('0x12'));var Papa=require(_0xeb03('0x13'));var Redis=require(_0xeb03('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xeb03('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb03('0x16'));var logger=require(_0xeb03('0x17'))(_0xeb03('0x18'));var utils=require(_0xeb03('0x19'));var config=require(_0xeb03('0x1a'));var licenseUtil=require(_0xeb03('0x1b'));var db=require(_0xeb03('0x1c'))['db'];function respondWithStatusCode(_0x384cbe,_0x97f46d){_0x97f46d=_0x97f46d||0xcc;return function(_0x2422fd){if(_0x2422fd){return _0x384cbe[_0xeb03('0x1d')](_0x97f46d);}return _0x384cbe[_0xeb03('0x1e')](_0x97f46d)['end']();};}function respondWithResult(_0x212082,_0x100bef){_0x100bef=_0x100bef||0xc8;return function(_0x372c71){if(_0x372c71){return _0x212082[_0xeb03('0x1e')](_0x100bef)['json'](_0x372c71);}};}function respondWithFilteredResult(_0x15f4fe,_0x36f5d8){return function(_0x3f26ef){if(_0x3f26ef){var _0x478989=_0x3f26ef[_0xeb03('0x1f')],_0x7ce874=_0x36f5d8[_0xeb03('0x20')],_0x46dd1b=_0x36f5d8[_0xeb03('0x20')]+_0x36f5d8[_0xeb03('0x21')],_0x4095c3;if(_0x46dd1b>=_0x478989){_0x46dd1b=_0x478989;_0x4095c3=0xc8;}else{_0x4095c3=0xce;}_0x15f4fe[_0xeb03('0x1e')](_0x4095c3);return _0x15f4fe[_0xeb03('0x22')](_0xeb03('0x23'),_0x7ce874+'-'+_0x46dd1b+'/'+_0x478989)[_0xeb03('0x24')](_0x3f26ef);}return null;};}function patchUpdates(_0x2c238d){return function(_0x2443d9){try{jsonpatch[_0xeb03('0x25')](_0x2443d9,_0x2c238d,!![]);}catch(_0x4d307c){return BPromise[_0xeb03('0x26')](_0x4d307c);}return _0x2443d9[_0xeb03('0x27')]();};}function saveUpdates(_0x413d3e,_0x391729){return function(_0xe5a1c2){if(_0xe5a1c2){return _0xe5a1c2[_0xeb03('0x28')](_0x413d3e)[_0xeb03('0x29')](function(_0x2c795b){return _0x2c795b;});}return null;};}function removeEntity(_0x3c3d09,_0x5a704b){return function(_0x712ac2){if(_0x712ac2){return _0x712ac2[_0xeb03('0x2a')]()[_0xeb03('0x29')](function(){_0x3c3d09[_0xeb03('0x1e')](0xcc)[_0xeb03('0x2b')]();});}};}function handleEntityNotFound(_0x5dcda3,_0x638353){return function(_0x406864){if(!_0x406864){_0x5dcda3[_0xeb03('0x1d')](0x194);}return _0x406864;};}function handleError(_0x20efa8,_0x3f276a){_0x3f276a=_0x3f276a||0x1f4;return function(_0x119697){logger[_0xeb03('0x2c')](_0x119697[_0xeb03('0x2d')]);if(_0x119697[_0xeb03('0x2e')]){delete _0x119697['name'];}_0x20efa8[_0xeb03('0x1e')](_0x3f276a)[_0xeb03('0x2f')](_0x119697);};}exports[_0xeb03('0x30')]=function(_0x1ada2e,_0x4cdea6){var _0x581685={},_0x1064a5={},_0x49e449={'count':0x0,'rows':[]};var _0x31a622=_[_0xeb03('0x31')](db[_0xeb03('0x32')]['rawAttributes'],function(_0xd4c8ec){return{'name':_0xd4c8ec['fieldName'],'type':_0xd4c8ec['type']['key']};});_0x1064a5['model']=_[_0xeb03('0x31')](_0x31a622,_0xeb03('0x2e'));_0x1064a5['query']=_['keys'](_0x1ada2e['query']);_0x1064a5['filters']=_[_0xeb03('0x33')](_0x1064a5[_0xeb03('0x34')],_0x1064a5[_0xeb03('0x35')]);_0x581685[_0xeb03('0x36')]=_[_0xeb03('0x33')](_0x1064a5['model'],qs[_0xeb03('0x37')](_0x1ada2e['query'][_0xeb03('0x37')]));_0x581685[_0xeb03('0x36')]=_0x581685[_0xeb03('0x36')][_0xeb03('0x38')]?_0x581685[_0xeb03('0x36')]:_0x1064a5[_0xeb03('0x34')];if(!_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x39')]('nolimit')){_0x581685[_0xeb03('0x21')]=qs['limit'](_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x21')]);_0x581685[_0xeb03('0x20')]=qs[_0xeb03('0x20')](_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x20')]);}_0x581685['order']=qs[_0xeb03('0x3a')](_0x1ada2e['query']['sort']);_0x581685['where']=qs[_0xeb03('0x3b')](_[_0xeb03('0x3c')](_0x1ada2e[_0xeb03('0x35')],_0x1064a5[_0xeb03('0x3b')]),_0x31a622);if(_0x1ada2e[_0xeb03('0x35')]['filter']){_0x581685[_0xeb03('0x3d')]=_[_0xeb03('0x3e')](_0x581685[_0xeb03('0x3d')],{'$or':_['map'](_0x31a622,function(_0x4efbb7){if(_0x4efbb7[_0xeb03('0x3f')]!==_0xeb03('0x40')){var _0x47118d={};_0x47118d[_0x4efbb7['name']]={'$like':'%'+_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x41')]+'%'};return _0x47118d;}})});}_0x581685=_['merge']({},_0x581685,_0x1ada2e['options']);var _0x4621da={'where':_0x581685[_0xeb03('0x3d')]};return db['OpenchannelQueueReport'][_0xeb03('0x1f')](_0x4621da)[_0xeb03('0x29')](function(_0x3fa3de){_0x49e449[_0xeb03('0x1f')]=_0x3fa3de;if(_0x1ada2e[_0xeb03('0x35')][_0xeb03('0x42')]){_0x581685[_0xeb03('0x43')]=[{'all':!![]}];}return db[_0xeb03('0x32')][_0xeb03('0x44')](_0x581685);})[_0xeb03('0x29')](function(_0x367d19){_0x49e449[_0xeb03('0x45')]=_0x367d19;return _0x49e449;})[_0xeb03('0x29')](respondWithFilteredResult(_0x4cdea6,_0x581685))[_0xeb03('0x46')](handleError(_0x4cdea6,null));};exports[_0xeb03('0x47')]=function(_0x6b95dd,_0x407f0b){var _0x3f93ef={'raw':!![],'where':{'id':_0x6b95dd[_0xeb03('0x48')]['id']}},_0x35e53d={};_0x35e53d[_0xeb03('0x34')]=_[_0xeb03('0x49')](db[_0xeb03('0x32')]['rawAttributes']);_0x35e53d['query']=_[_0xeb03('0x49')](_0x6b95dd[_0xeb03('0x35')]);_0x35e53d[_0xeb03('0x3b')]=_[_0xeb03('0x33')](_0x35e53d[_0xeb03('0x34')],_0x35e53d[_0xeb03('0x35')]);_0x3f93ef[_0xeb03('0x36')]=_[_0xeb03('0x33')](_0x35e53d['model'],qs[_0xeb03('0x37')](_0x6b95dd[_0xeb03('0x35')][_0xeb03('0x37')]));_0x3f93ef[_0xeb03('0x36')]=_0x3f93ef[_0xeb03('0x36')]['length']?_0x3f93ef['attributes']:_0x35e53d[_0xeb03('0x34')];if(_0x6b95dd['query']['includeAll']){_0x3f93ef['include']=[{'all':!![]}];}_0x3f93ef=_[_0xeb03('0x3e')]({},_0x3f93ef,_0x6b95dd[_0xeb03('0x4a')]);return db[_0xeb03('0x32')][_0xeb03('0x4b')](_0x3f93ef)[_0xeb03('0x29')](handleEntityNotFound(_0x407f0b,null))[_0xeb03('0x29')](respondWithResult(_0x407f0b,null))['catch'](handleError(_0x407f0b,null));};exports[_0xeb03('0x4c')]=function(_0x4bf739,_0x5c4fac){return db[_0xeb03('0x32')][_0xeb03('0x4c')](_0x4bf739[_0xeb03('0x4d')],{})['then'](respondWithResult(_0x5c4fac,0xc9))[_0xeb03('0x46')](handleError(_0x5c4fac,null));};exports[_0xeb03('0x28')]=function(_0x351055,_0x8d7308){if(_0x351055[_0xeb03('0x4d')]['id']){delete _0x351055['body']['id'];}return db[_0xeb03('0x32')]['find']({'where':{'id':_0x351055[_0xeb03('0x48')]['id']}})[_0xeb03('0x29')](handleEntityNotFound(_0x8d7308,null))[_0xeb03('0x29')](saveUpdates(_0x351055[_0xeb03('0x4d')],null))[_0xeb03('0x29')](respondWithResult(_0x8d7308,null))[_0xeb03('0x46')](handleError(_0x8d7308,null));};exports[_0xeb03('0x2a')]=function(_0x292319,_0x38c993){return db[_0xeb03('0x32')][_0xeb03('0x4b')]({'where':{'id':_0x292319[_0xeb03('0x48')]['id']}})[_0xeb03('0x29')](handleEntityNotFound(_0x38c993,null))[_0xeb03('0x29')](removeEntity(_0x38c993,null))[_0xeb03('0x46')](handleError(_0x38c993,null));};exports[_0xeb03('0x4e')]=function(_0xf5c1ab,_0x79b7c6){return db[_0xeb03('0x32')][_0xeb03('0x4e')]()[_0xeb03('0x29')](respondWithResult(_0x79b7c6,null))[_0xeb03('0x46')](handleError(_0x79b7c6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 16038d2..e600c0f 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 _0x5089=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x53b93b,_0x524311){var _0x4c04bf=function(_0x2d8dbe){while(--_0x2d8dbe){_0x53b93b['push'](_0x53b93b['shift']());}};_0x4c04bf(++_0x524311);}(_0x5089,0x1bb));var _0x9508=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x5089[_0x50cfc3];return _0x5c11ef;};'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('./openchannelQueueReport.attributes');module[_0x9508('0x8')]=function(_0x4538dd,_0x257318){return _0x4538dd['define'](_0x9508('0x9'),attributes,{'tableName':_0x9508('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9508('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa947=['api','moment','bluebird','request-promise','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x562365,_0x4b9eaa){var _0x2b3595=function(_0x2596c1){while(--_0x2596c1){_0x562365['push'](_0x562365['shift']());}};_0x2b3595(++_0x4b9eaa);}(_0xa947,0x11d));var _0x7a94=function(_0x5a39ab,_0x59cc58){_0x5a39ab=_0x5a39ab-0x0;var _0xb4e161=_0xa947[_0x5a39ab];return _0xb4e161;};'use strict';var _=require(_0x7a94('0x0'));var util=require(_0x7a94('0x1'));var logger=require(_0x7a94('0x2'))(_0x7a94('0x3'));var moment=require(_0x7a94('0x4'));var BPromise=require(_0x7a94('0x5'));var rp=require(_0x7a94('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a94('0x7'));module['exports']=function(_0x2ea02c,_0x281dc9){return _0x2ea02c[_0x7a94('0x8')](_0x7a94('0x9'),attributes,{'tableName':_0x7a94('0xa'),'paranoid':![],'indexes':[{'name':_0x7a94('0xb'),'fields':[_0x7a94('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index e0b6cc1..1003060 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 _0xda16=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x1f6e37,_0x560390){var _0x3d17ad=function(_0x23a623){while(--_0x23a623){_0x1f6e37['push'](_0x1f6e37['shift']());}};_0x3d17ad(++_0x560390);}(_0xda16,0x11b));var _0x6da1=function(_0x25de09,_0x96ed5a){_0x25de09=_0x25de09-0x0;var _0x3eda1e=_0xda16[_0x25de09];return _0x3eda1e;};'use strict';var _=require(_0x6da1('0x0'));var util=require('util');var moment=require(_0x6da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x6da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6da1('0x3'))['db'];var utils=require(_0x6da1('0x4'));var logger=require(_0x6da1('0x5'))(_0x6da1('0x6'));var config=require(_0x6da1('0x7'));var jayson=require(_0x6da1('0x8'));var client=jayson[_0x6da1('0x9')][_0x6da1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa99eb5,_0x5d4118,_0x324db7){return new BPromise(function(_0x146152,_0x6fc59){return client['request'](_0xa99eb5,_0x324db7)[_0x6da1('0xb')](function(_0x211dba){logger[_0x6da1('0xc')](_0x6da1('0xd'),_0x5d4118,_0x6da1('0xe'));logger[_0x6da1('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5d4118,'request\x20sent',JSON['stringify'](_0x211dba));if(_0x211dba[_0x6da1('0x10')]){if(_0x211dba[_0x6da1('0x10')][_0x6da1('0x11')]===0x1f4){logger[_0x6da1('0x10')](_0x6da1('0xd'),_0x5d4118,_0x211dba['error']['message']);return _0x6fc59(_0x211dba[_0x6da1('0x10')]['message']);}logger['error'](_0x6da1('0xd'),_0x5d4118,_0x211dba['error'][_0x6da1('0x12')]);return _0x146152(_0x211dba[_0x6da1('0x10')]['message']);}else{logger['info'](_0x6da1('0xd'),_0x5d4118,'request\x20sent');_0x146152(_0x211dba[_0x6da1('0x13')][_0x6da1('0x12')]);}})[_0x6da1('0x14')](function(_0x3db8f4){logger[_0x6da1('0x10')](_0x6da1('0xd'),_0x5d4118,_0x3db8f4);_0x6fc59(_0x3db8f4);});});}exports[_0x6da1('0x15')]=function(_0x10b497){var _0x469a82=this;return new Promise(function(_0x1114ae,_0x5699dc){return db[_0x6da1('0x16')][_0x6da1('0x17')](_0x10b497[_0x6da1('0x18')],{'raw':_0x10b497[_0x6da1('0x19')]?_0x10b497[_0x6da1('0x19')][_0x6da1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3d9eae){logger[_0x6da1('0xc')](_0x6da1('0x15'),_0x10b497);logger[_0x6da1('0xf')](_0x6da1('0x15'),_0x10b497,JSON[_0x6da1('0x1b')](_0x3d9eae));_0x1114ae(_0x3d9eae);})[_0x6da1('0x14')](function(_0xd1fff8){logger['error'](_0x6da1('0x15'),_0xd1fff8[_0x6da1('0x12')],_0x10b497);_0x5699dc(_0x469a82[_0x6da1('0x10')](0x1f4,_0xd1fff8[_0x6da1('0x12')]));});});};exports[_0x6da1('0x1c')]=function(_0xd2168d){var _0x1a6ff6=this;return new Promise(function(_0x3803a9,_0xce965e){return db[_0x6da1('0x16')][_0x6da1('0x1d')](_0xd2168d[_0x6da1('0x18')],{'raw':_0xd2168d['options']?_0xd2168d[_0x6da1('0x19')][_0x6da1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd2168d['options']?_0xd2168d[_0x6da1('0x19')]['where']||null:null,'attributes':_0xd2168d[_0x6da1('0x19')]?_0xd2168d[_0x6da1('0x19')][_0x6da1('0x1e')]||null:null,'limit':_0xd2168d[_0x6da1('0x19')]?_0xd2168d['options'][_0x6da1('0x1f')]||null:null})['then'](function(_0x125f95){logger[_0x6da1('0xc')](_0x6da1('0x1c'),_0xd2168d);logger[_0x6da1('0xf')](_0x6da1('0x1c'),_0xd2168d,JSON[_0x6da1('0x1b')](_0x125f95));_0x3803a9(_0x125f95);})[_0x6da1('0x14')](function(_0x52dfa2){logger[_0x6da1('0x10')](_0x6da1('0x1c'),_0x52dfa2[_0x6da1('0x12')],_0xd2168d);_0xce965e(_0x1a6ff6['error'](0x1f4,_0x52dfa2[_0x6da1('0x12')]));});});}; \ No newline at end of file +var _0xcd8e=['info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','stringify','UpdateOpenchannelQueueReport','update','body','where','limit','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x22ec4d,_0x148416){var _0x51df9c=function(_0x53ec58){while(--_0x53ec58){_0x22ec4d['push'](_0x22ec4d['shift']());}};_0x51df9c(++_0x148416);}(_0xcd8e,0x19a));var _0xecd8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcd8e[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xecd8('0x0'));var moment=require(_0xecd8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecd8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xecd8('0x3'));var logger=require('../../config/logger')(_0xecd8('0x4'));var config=require(_0xecd8('0x5'));var jayson=require(_0xecd8('0x6'));var client=jayson[_0xecd8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d3edf,_0x10b2a8,_0x51fb3e){return new BPromise(function(_0x4e96bd,_0x5344f6){return client[_0xecd8('0x8')](_0x3d3edf,_0x51fb3e)[_0xecd8('0x9')](function(_0x423b50){logger[_0xecd8('0xa')](_0xecd8('0xb'),_0x10b2a8,_0xecd8('0xc'));logger[_0xecd8('0xd')](_0xecd8('0xe'),_0x10b2a8,_0xecd8('0xc'),JSON['stringify'](_0x423b50));if(_0x423b50[_0xecd8('0xf')]){if(_0x423b50['error'][_0xecd8('0x10')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x10b2a8,_0x423b50['error']['message']);return _0x5344f6(_0x423b50[_0xecd8('0xf')][_0xecd8('0x11')]);}logger[_0xecd8('0xf')](_0xecd8('0xb'),_0x10b2a8,_0x423b50['error'][_0xecd8('0x11')]);return _0x4e96bd(_0x423b50[_0xecd8('0xf')][_0xecd8('0x11')]);}else{logger[_0xecd8('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x10b2a8,_0xecd8('0xc'));_0x4e96bd(_0x423b50[_0xecd8('0x12')]['message']);}})[_0xecd8('0x13')](function(_0x196f49){logger['error'](_0xecd8('0xb'),_0x10b2a8,_0x196f49);_0x5344f6(_0x196f49);});});}exports[_0xecd8('0x14')]=function(_0xc0b76d){var _0x1c286c=this;return new Promise(function(_0x1f5cdb,_0x13f832){return db[_0xecd8('0x15')][_0xecd8('0x16')](_0xc0b76d['body'],{'raw':_0xc0b76d[_0xecd8('0x17')]?_0xc0b76d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c2b1c){logger[_0xecd8('0xa')]('CreateOpenchannelQueueReport',_0xc0b76d);logger['debug'](_0xecd8('0x14'),_0xc0b76d,JSON[_0xecd8('0x18')](_0x4c2b1c));_0x1f5cdb(_0x4c2b1c);})[_0xecd8('0x13')](function(_0x4c2c95){logger[_0xecd8('0xf')](_0xecd8('0x14'),_0x4c2c95[_0xecd8('0x11')],_0xc0b76d);_0x13f832(_0x1c286c['error'](0x1f4,_0x4c2c95[_0xecd8('0x11')]));});});};exports[_0xecd8('0x19')]=function(_0x2a0ff0){var _0x3e0a94=this;return new Promise(function(_0x39c2cd,_0x1eb909){return db[_0xecd8('0x15')][_0xecd8('0x1a')](_0x2a0ff0[_0xecd8('0x1b')],{'raw':_0x2a0ff0[_0xecd8('0x17')]?_0x2a0ff0['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0ff0[_0xecd8('0x17')]?_0x2a0ff0[_0xecd8('0x17')][_0xecd8('0x1c')]||null:null,'attributes':_0x2a0ff0[_0xecd8('0x17')]?_0x2a0ff0[_0xecd8('0x17')]['attributes']||null:null,'limit':_0x2a0ff0['options']?_0x2a0ff0['options'][_0xecd8('0x1d')]||null:null})[_0xecd8('0x9')](function(_0x318f94){logger['info'](_0xecd8('0x19'),_0x2a0ff0);logger[_0xecd8('0xd')]('UpdateOpenchannelQueueReport',_0x2a0ff0,JSON[_0xecd8('0x18')](_0x318f94));_0x39c2cd(_0x318f94);})['catch'](function(_0xdfc6e0){logger[_0xecd8('0xf')](_0xecd8('0x19'),_0xdfc6e0[_0xecd8('0x11')],_0x2a0ff0);_0x1eb909(_0x3e0a94['error'](0x1f4,_0xdfc6e0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f8c2bed..d169997 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 _0x8ce7=['isAuthenticated','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id'];(function(_0x59a2b1,_0x7eeff0){var _0x18b559=function(_0x15075c){while(--_0x15075c){_0x59a2b1['push'](_0x59a2b1['shift']());}};_0x18b559(++_0x7eeff0);}(_0x8ce7,0x182));var _0x78ce=function(_0x1311e5,_0x3ec7c1){_0x1311e5=_0x1311e5-0x0;var _0x5e6d41=_0x8ce7[_0x1311e5];return _0x5e6d41;};'use strict';var multer=require(_0x78ce('0x0'));var util=require(_0x78ce('0x1'));var path=require(_0x78ce('0x2'));var timeout=require(_0x78ce('0x3'));var express=require(_0x78ce('0x4'));var router=express[_0x78ce('0x5')]();var fs_extra=require(_0x78ce('0x6'));var auth=require(_0x78ce('0x7'));var interaction=require(_0x78ce('0x8'));var config=require(_0x78ce('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0x78ce('0xa')]('/',auth['isAuthenticated'](),controller[_0x78ce('0xb')]);router[_0x78ce('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x78ce('0xc')]);router[_0x78ce('0xa')](_0x78ce('0xd'),auth[_0x78ce('0xe')](),controller['show']);router[_0x78ce('0xf')]('/',auth['isAuthenticated'](),controller[_0x78ce('0x10')]);router[_0x78ce('0x11')](_0x78ce('0xd'),auth[_0x78ce('0xe')](),controller['update']);router['delete']('/:id',auth[_0x78ce('0xe')](),controller[_0x78ce('0x12')]);module[_0x78ce('0x13')]=router; \ No newline at end of file +var _0x9e68=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x410b94,_0x5c9ef1){var _0x344cf8=function(_0x36be1f){while(--_0x36be1f){_0x410b94['push'](_0x410b94['shift']());}};_0x344cf8(++_0x5c9ef1);}(_0x9e68,0xa9));var _0x89e6=function(_0x270cf5,_0x202744){_0x270cf5=_0x270cf5-0x0;var _0x17f154=_0x9e68[_0x270cf5];return _0x17f154;};'use strict';var multer=require(_0x89e6('0x0'));var util=require(_0x89e6('0x1'));var path=require(_0x89e6('0x2'));var timeout=require(_0x89e6('0x3'));var express=require(_0x89e6('0x4'));var router=express[_0x89e6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x89e6('0x6'));var interaction=require(_0x89e6('0x7'));var config=require(_0x89e6('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x89e6('0x9')]('/',auth[_0x89e6('0xa')](),controller[_0x89e6('0xb')]);router['get'](_0x89e6('0xc'),auth[_0x89e6('0xa')](),controller[_0x89e6('0xd')]);router[_0x89e6('0x9')](_0x89e6('0xe'),auth[_0x89e6('0xa')](),controller[_0x89e6('0xf')]);router[_0x89e6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x89e6('0x11')]('/:id',auth[_0x89e6('0xa')](),controller[_0x89e6('0x12')]);router[_0x89e6('0x13')](_0x89e6('0xe'),auth[_0x89e6('0xa')](),controller[_0x89e6('0x14')]);module[_0x89e6('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 33ed32b..492f4b6 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 _0x83c5=['agent','queue','NOW','moment','sequelize','STRING','ENUM','account'];(function(_0x8870c,_0x45f009){var _0x68f21c=function(_0x24d914){while(--_0x24d914){_0x8870c['push'](_0x8870c['shift']());}};_0x68f21c(++_0x45f009);}(_0x83c5,0xbb));var _0x583c=function(_0x5e4a13,_0x36ac4d){_0x5e4a13=_0x5e4a13-0x0;var _0x9fffe3=_0x83c5[_0x5e4a13];return _0x9fffe3;};'use strict';var moment=require(_0x583c('0x0'));var Sequelize=require(_0x583c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x583c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x583c('0x3')](_0x583c('0x4'),_0x583c('0x5'),_0x583c('0x6')),'allowNull':![],'defaultValue':_0x583c('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x583c('0x7')]}}; \ No newline at end of file +var _0x830c=['NOW','moment','sequelize','STRING','ENUM','account','agent','queue','DATE'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x830c,0xfd));var _0xc830=function(_0x3d274e,_0x3eab1c){_0x3d274e=_0x3d274e-0x0;var _0xaf9cfa=_0x830c[_0x3d274e];return _0xaf9cfa;};'use strict';var moment=require(_0xc830('0x0'));var Sequelize=require(_0xc830('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc830('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc830('0x3')](_0xc830('0x4'),_0xc830('0x5'),_0xc830('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xc830('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc830('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5b51e5c..068a210 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 _0x6464=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','model','query','keys','filters'];(function(_0x405d4a,_0x10c228){var _0x5a85f1=function(_0x4147e8){while(--_0x4147e8){_0x405d4a['push'](_0x405d4a['shift']());}};_0x5a85f1(++_0x10c228);}(_0x6464,0x16f));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4646('0x0'));var emlformat=require(_0x4646('0x1'));var rimraf=require(_0x4646('0x2'));var zipdir=require(_0x4646('0x3'));var jsonpatch=require(_0x4646('0x4'));var rp=require(_0x4646('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4646('0x6'));var sox=require('sox');var csv=require(_0x4646('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4646('0x8'));var _=require(_0x4646('0x9'));var squel=require(_0x4646('0xa'));var crypto=require(_0x4646('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4646('0xc'));var Redis=require(_0x4646('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4646('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4646('0xf'));var utils=require(_0x4646('0x10'));var config=require(_0x4646('0x11'));var licenseUtil=require(_0x4646('0x12'));var db=require(_0x4646('0x13'))['db'];function respondWithStatusCode(_0x5c1bd2,_0x42611e){_0x42611e=_0x42611e||0xcc;return function(_0x3a7b47){if(_0x3a7b47){return _0x5c1bd2['sendStatus'](_0x42611e);}return _0x5c1bd2[_0x4646('0x14')](_0x42611e)[_0x4646('0x15')]();};}function respondWithResult(_0x1940f0,_0x9225d3){_0x9225d3=_0x9225d3||0xc8;return function(_0x426c90){if(_0x426c90){return _0x1940f0[_0x4646('0x14')](_0x9225d3)[_0x4646('0x16')](_0x426c90);}};}function respondWithFilteredResult(_0x11ed69,_0x3fbc62){return function(_0x12c72a){if(_0x12c72a){var _0x428611=_0x12c72a[_0x4646('0x17')],_0xb46d9c=_0x3fbc62[_0x4646('0x18')],_0x5aca48=_0x3fbc62[_0x4646('0x18')]+_0x3fbc62[_0x4646('0x19')],_0x13db9f;if(_0x5aca48>=_0x428611){_0x5aca48=_0x428611;_0x13db9f=0xc8;}else{_0x13db9f=0xce;}_0x11ed69[_0x4646('0x14')](_0x13db9f);return _0x11ed69[_0x4646('0x1a')](_0x4646('0x1b'),_0xb46d9c+'-'+_0x5aca48+'/'+_0x428611)[_0x4646('0x16')](_0x12c72a);}return null;};}function patchUpdates(_0x508cbf){return function(_0x43da31){try{jsonpatch[_0x4646('0x1c')](_0x43da31,_0x508cbf,!![]);}catch(_0x52b76c){return BPromise['reject'](_0x52b76c);}return _0x43da31[_0x4646('0x1d')]();};}function saveUpdates(_0x5e9908,_0x2e300e){return function(_0x2c75c5){if(_0x2c75c5){return _0x2c75c5[_0x4646('0x1e')](_0x5e9908)['then'](function(_0x428318){return _0x428318;});}return null;};}function removeEntity(_0x26211f,_0x48da93){return function(_0x4ca546){if(_0x4ca546){return _0x4ca546[_0x4646('0x1f')]()[_0x4646('0x20')](function(){_0x26211f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31224d,_0x49f312){return function(_0x3f151f){if(!_0x3f151f){_0x31224d[_0x4646('0x21')](0x194);}return _0x3f151f;};}function handleError(_0x4b090b,_0x4a347f){_0x4a347f=_0x4a347f||0x1f4;return function(_0x4d340e){logger[_0x4646('0x22')](_0x4d340e[_0x4646('0x23')]);if(_0x4d340e[_0x4646('0x24')]){delete _0x4d340e['name'];}_0x4b090b[_0x4646('0x14')](_0x4a347f)[_0x4646('0x25')](_0x4d340e);};}exports[_0x4646('0x26')]=function(_0x468c9a,_0x3e58c0){var _0xa7c288={},_0x220450={},_0x49cfbc={'count':0x0,'rows':[]};var _0x13588c=_[_0x4646('0x27')](db[_0x4646('0x28')][_0x4646('0x29')],function(_0x4c8395){return{'name':_0x4c8395['fieldName'],'type':_0x4c8395[_0x4646('0x2a')]['key']};});_0x220450[_0x4646('0x2b')]=_[_0x4646('0x27')](_0x13588c,'name');_0x220450[_0x4646('0x2c')]=_[_0x4646('0x2d')](_0x468c9a['query']);_0x220450[_0x4646('0x2e')]=_[_0x4646('0x2f')](_0x220450['model'],_0x220450['query']);_0xa7c288[_0x4646('0x30')]=_['intersection'](_0x220450[_0x4646('0x2b')],qs[_0x4646('0x31')](_0x468c9a[_0x4646('0x2c')][_0x4646('0x31')]));_0xa7c288[_0x4646('0x30')]=_0xa7c288[_0x4646('0x30')][_0x4646('0x32')]?_0xa7c288[_0x4646('0x30')]:_0x220450['model'];if(!_0x468c9a[_0x4646('0x2c')][_0x4646('0x33')](_0x4646('0x34'))){_0xa7c288[_0x4646('0x19')]=qs[_0x4646('0x19')](_0x468c9a[_0x4646('0x2c')]['limit']);_0xa7c288[_0x4646('0x18')]=qs[_0x4646('0x18')](_0x468c9a[_0x4646('0x2c')][_0x4646('0x18')]);}_0xa7c288[_0x4646('0x35')]=qs[_0x4646('0x36')](_0x468c9a[_0x4646('0x2c')][_0x4646('0x36')]);_0xa7c288['where']=qs[_0x4646('0x2e')](_[_0x4646('0x37')](_0x468c9a[_0x4646('0x2c')],_0x220450[_0x4646('0x2e')]),_0x13588c);if(_0x468c9a[_0x4646('0x2c')][_0x4646('0x38')]){_0xa7c288[_0x4646('0x39')]=_[_0x4646('0x3a')](_0xa7c288[_0x4646('0x39')],{'$or':_[_0x4646('0x27')](_0x13588c,function(_0x1c581d){if(_0x1c581d[_0x4646('0x2a')]!==_0x4646('0x3b')){var _0x54e49f={};_0x54e49f[_0x1c581d[_0x4646('0x24')]]={'$like':'%'+_0x468c9a[_0x4646('0x2c')]['filter']+'%'};return _0x54e49f;}})});}_0xa7c288=_['merge']({},_0xa7c288,_0x468c9a['options']);var _0x4d8b9c={'where':_0xa7c288[_0x4646('0x39')]};return db[_0x4646('0x28')][_0x4646('0x17')](_0x4d8b9c)[_0x4646('0x20')](function(_0x521d95){_0x49cfbc[_0x4646('0x17')]=_0x521d95;if(_0x468c9a[_0x4646('0x2c')][_0x4646('0x3c')]){_0xa7c288['include']=[{'all':!![]}];}return db[_0x4646('0x28')]['findAll'](_0xa7c288);})['then'](function(_0x54bbe2){_0x49cfbc[_0x4646('0x3d')]=_0x54bbe2;return _0x49cfbc;})[_0x4646('0x20')](respondWithFilteredResult(_0x3e58c0,_0xa7c288))[_0x4646('0x3e')](handleError(_0x3e58c0,null));};exports[_0x4646('0x3f')]=function(_0x5cb244,_0x360ed3){var _0x3076fe={'raw':!![],'where':{'id':_0x5cb244['params']['id']}},_0x18a0e2={};_0x18a0e2[_0x4646('0x2b')]=_['keys'](db[_0x4646('0x28')]['rawAttributes']);_0x18a0e2['query']=_['keys'](_0x5cb244[_0x4646('0x2c')]);_0x18a0e2[_0x4646('0x2e')]=_['intersection'](_0x18a0e2['model'],_0x18a0e2[_0x4646('0x2c')]);_0x3076fe[_0x4646('0x30')]=_['intersection'](_0x18a0e2[_0x4646('0x2b')],qs[_0x4646('0x31')](_0x5cb244[_0x4646('0x2c')][_0x4646('0x31')]));_0x3076fe['attributes']=_0x3076fe[_0x4646('0x30')][_0x4646('0x32')]?_0x3076fe[_0x4646('0x30')]:_0x18a0e2['model'];if(_0x5cb244[_0x4646('0x2c')][_0x4646('0x3c')]){_0x3076fe['include']=[{'all':!![]}];}_0x3076fe=_['merge']({},_0x3076fe,_0x5cb244['options']);return db[_0x4646('0x28')]['find'](_0x3076fe)[_0x4646('0x20')](handleEntityNotFound(_0x360ed3,null))[_0x4646('0x20')](respondWithResult(_0x360ed3,null))['catch'](handleError(_0x360ed3,null));};exports[_0x4646('0x40')]=function(_0x1bc1d0,_0x35d656){return db[_0x4646('0x28')]['create'](_0x1bc1d0[_0x4646('0x41')],{})[_0x4646('0x20')](respondWithResult(_0x35d656,0xc9))[_0x4646('0x3e')](handleError(_0x35d656,null));};exports['update']=function(_0x27bafd,_0x20fb5f){if(_0x27bafd[_0x4646('0x41')]['id']){delete _0x27bafd['body']['id'];}return db['OpenchannelTransferReport'][_0x4646('0x42')]({'where':{'id':_0x27bafd[_0x4646('0x43')]['id']}})['then'](handleEntityNotFound(_0x20fb5f,null))[_0x4646('0x20')](saveUpdates(_0x27bafd['body'],null))[_0x4646('0x20')](respondWithResult(_0x20fb5f,null))[_0x4646('0x3e')](handleError(_0x20fb5f,null));};exports[_0x4646('0x1f')]=function(_0x30b076,_0xd9f259){return db[_0x4646('0x28')]['find']({'where':{'id':_0x30b076[_0x4646('0x43')]['id']}})['then'](handleEntityNotFound(_0xd9f259,null))[_0x4646('0x20')](removeEntity(_0xd9f259,null))[_0x4646('0x3e')](handleError(_0xd9f259,null));};exports['describe']=function(_0x4574a7,_0x13fc5e){return db[_0x4646('0x28')][_0x4646('0x44')]()[_0x4646('0x20')](respondWithResult(_0x13fc5e,null))[_0x4646('0x3e')](handleError(_0x13fc5e,null));}; \ No newline at end of file +var _0xbb98=['fs-extra','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelTransferReport','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','length','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs'];(function(_0x1aafc8,_0x58ea6b){var _0x4ba395=function(_0x17ecf6){while(--_0x17ecf6){_0x1aafc8['push'](_0x1aafc8['shift']());}};_0x4ba395(++_0x58ea6b);}(_0xbb98,0x140));var _0x8bb9=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0xbb98[_0x4d7a70];return _0x3aafbb;};'use strict';var pdf=require(_0x8bb9('0x0'));var emlformat=require(_0x8bb9('0x1'));var rimraf=require(_0x8bb9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8bb9('0x3'));var moment=require(_0x8bb9('0x4'));var BPromise=require(_0x8bb9('0x5'));var Mustache=require('mustache');var util=require(_0x8bb9('0x6'));var path=require('path');var sox=require(_0x8bb9('0x7'));var csv=require(_0x8bb9('0x8'));var ejs=require(_0x8bb9('0x9'));var fs=require('fs');var fs_extra=require(_0x8bb9('0xa'));var _=require(_0x8bb9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8bb9('0xc'));var deskjs=require(_0x8bb9('0xd'));var toCsv=require(_0x8bb9('0x8'));var querystring=require(_0x8bb9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8bb9('0xf'));var as=require(_0x8bb9('0x10'));var hardwareService=require(_0x8bb9('0x11'));var logger=require(_0x8bb9('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x8bb9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bb9('0x14'))['db'];function respondWithStatusCode(_0x26448a,_0x498d60){_0x498d60=_0x498d60||0xcc;return function(_0x61bf4a){if(_0x61bf4a){return _0x26448a[_0x8bb9('0x15')](_0x498d60);}return _0x26448a[_0x8bb9('0x16')](_0x498d60)[_0x8bb9('0x17')]();};}function respondWithResult(_0x3f3519,_0x16098a){_0x16098a=_0x16098a||0xc8;return function(_0x2b6017){if(_0x2b6017){return _0x3f3519[_0x8bb9('0x16')](_0x16098a)[_0x8bb9('0x18')](_0x2b6017);}};}function respondWithFilteredResult(_0x42b990,_0x54cf2f){return function(_0x202527){if(_0x202527){var _0x53df39=_0x202527[_0x8bb9('0x19')],_0x324c73=_0x54cf2f[_0x8bb9('0x1a')],_0x27f732=_0x54cf2f[_0x8bb9('0x1a')]+_0x54cf2f[_0x8bb9('0x1b')],_0x22690a;if(_0x27f732>=_0x53df39){_0x27f732=_0x53df39;_0x22690a=0xc8;}else{_0x22690a=0xce;}_0x42b990[_0x8bb9('0x16')](_0x22690a);return _0x42b990[_0x8bb9('0x1c')]('Content-Range',_0x324c73+'-'+_0x27f732+'/'+_0x53df39)[_0x8bb9('0x18')](_0x202527);}return null;};}function patchUpdates(_0x1b0ad8){return function(_0x4806be){try{jsonpatch[_0x8bb9('0x1d')](_0x4806be,_0x1b0ad8,!![]);}catch(_0x46ac17){return BPromise[_0x8bb9('0x1e')](_0x46ac17);}return _0x4806be[_0x8bb9('0x1f')]();};}function saveUpdates(_0x2d5035,_0x31509d){return function(_0x2cd9c3){if(_0x2cd9c3){return _0x2cd9c3[_0x8bb9('0x20')](_0x2d5035)[_0x8bb9('0x21')](function(_0x168f0c){return _0x168f0c;});}return null;};}function removeEntity(_0x22688d,_0x24d33a){return function(_0x5092d7){if(_0x5092d7){return _0x5092d7['destroy']()['then'](function(){_0x22688d[_0x8bb9('0x16')](0xcc)[_0x8bb9('0x17')]();});}};}function handleEntityNotFound(_0x361da8,_0x5d604b){return function(_0x2c5321){if(!_0x2c5321){_0x361da8['sendStatus'](0x194);}return _0x2c5321;};}function handleError(_0x118238,_0x22ae53){_0x22ae53=_0x22ae53||0x1f4;return function(_0x200e83){logger[_0x8bb9('0x22')](_0x200e83[_0x8bb9('0x23')]);if(_0x200e83['name']){delete _0x200e83[_0x8bb9('0x24')];}_0x118238[_0x8bb9('0x16')](_0x22ae53)[_0x8bb9('0x25')](_0x200e83);};}exports[_0x8bb9('0x26')]=function(_0x4575a7,_0x255d18){var _0x1ec4d2={},_0x34d466={},_0x1f9b1b={'count':0x0,'rows':[]};var _0x23bccb=_[_0x8bb9('0x27')](db[_0x8bb9('0x28')]['rawAttributes'],function(_0x3c4522){return{'name':_0x3c4522['fieldName'],'type':_0x3c4522['type'][_0x8bb9('0x29')]};});_0x34d466[_0x8bb9('0x2a')]=_['map'](_0x23bccb,_0x8bb9('0x24'));_0x34d466['query']=_[_0x8bb9('0x2b')](_0x4575a7[_0x8bb9('0x2c')]);_0x34d466[_0x8bb9('0x2d')]=_[_0x8bb9('0x2e')](_0x34d466[_0x8bb9('0x2a')],_0x34d466[_0x8bb9('0x2c')]);_0x1ec4d2[_0x8bb9('0x2f')]=_[_0x8bb9('0x2e')](_0x34d466[_0x8bb9('0x2a')],qs[_0x8bb9('0x30')](_0x4575a7[_0x8bb9('0x2c')][_0x8bb9('0x30')]));_0x1ec4d2['attributes']=_0x1ec4d2['attributes']['length']?_0x1ec4d2['attributes']:_0x34d466[_0x8bb9('0x2a')];if(!_0x4575a7[_0x8bb9('0x2c')][_0x8bb9('0x31')]('nolimit')){_0x1ec4d2[_0x8bb9('0x1b')]=qs['limit'](_0x4575a7[_0x8bb9('0x2c')][_0x8bb9('0x1b')]);_0x1ec4d2[_0x8bb9('0x1a')]=qs[_0x8bb9('0x1a')](_0x4575a7[_0x8bb9('0x2c')][_0x8bb9('0x1a')]);}_0x1ec4d2['order']=qs[_0x8bb9('0x32')](_0x4575a7['query'][_0x8bb9('0x32')]);_0x1ec4d2[_0x8bb9('0x33')]=qs[_0x8bb9('0x2d')](_['pick'](_0x4575a7[_0x8bb9('0x2c')],_0x34d466[_0x8bb9('0x2d')]),_0x23bccb);if(_0x4575a7[_0x8bb9('0x2c')]['filter']){_0x1ec4d2['where']=_[_0x8bb9('0x34')](_0x1ec4d2[_0x8bb9('0x33')],{'$or':_[_0x8bb9('0x27')](_0x23bccb,function(_0x475e33){if(_0x475e33['type']!==_0x8bb9('0x35')){var _0x52b2c5={};_0x52b2c5[_0x475e33[_0x8bb9('0x24')]]={'$like':'%'+_0x4575a7[_0x8bb9('0x2c')]['filter']+'%'};return _0x52b2c5;}})});}_0x1ec4d2=_[_0x8bb9('0x34')]({},_0x1ec4d2,_0x4575a7[_0x8bb9('0x36')]);var _0x4cfb52={'where':_0x1ec4d2[_0x8bb9('0x33')]};return db['OpenchannelTransferReport'][_0x8bb9('0x19')](_0x4cfb52)[_0x8bb9('0x21')](function(_0x1d64d0){_0x1f9b1b[_0x8bb9('0x19')]=_0x1d64d0;if(_0x4575a7['query'][_0x8bb9('0x37')]){_0x1ec4d2[_0x8bb9('0x38')]=[{'all':!![]}];}return db[_0x8bb9('0x28')]['findAll'](_0x1ec4d2);})[_0x8bb9('0x21')](function(_0xc8aeda){_0x1f9b1b['rows']=_0xc8aeda;return _0x1f9b1b;})[_0x8bb9('0x21')](respondWithFilteredResult(_0x255d18,_0x1ec4d2))[_0x8bb9('0x39')](handleError(_0x255d18,null));};exports[_0x8bb9('0x3a')]=function(_0x324ed5,_0x5eae81){var _0x41115c={'raw':!![],'where':{'id':_0x324ed5[_0x8bb9('0x3b')]['id']}},_0x244b1c={};_0x244b1c[_0x8bb9('0x2a')]=_[_0x8bb9('0x2b')](db['OpenchannelTransferReport'][_0x8bb9('0x3c')]);_0x244b1c[_0x8bb9('0x2c')]=_[_0x8bb9('0x2b')](_0x324ed5[_0x8bb9('0x2c')]);_0x244b1c[_0x8bb9('0x2d')]=_[_0x8bb9('0x2e')](_0x244b1c[_0x8bb9('0x2a')],_0x244b1c[_0x8bb9('0x2c')]);_0x41115c[_0x8bb9('0x2f')]=_[_0x8bb9('0x2e')](_0x244b1c[_0x8bb9('0x2a')],qs[_0x8bb9('0x30')](_0x324ed5[_0x8bb9('0x2c')][_0x8bb9('0x30')]));_0x41115c[_0x8bb9('0x2f')]=_0x41115c[_0x8bb9('0x2f')][_0x8bb9('0x3d')]?_0x41115c['attributes']:_0x244b1c[_0x8bb9('0x2a')];if(_0x324ed5[_0x8bb9('0x2c')]['includeAll']){_0x41115c[_0x8bb9('0x38')]=[{'all':!![]}];}_0x41115c=_['merge']({},_0x41115c,_0x324ed5[_0x8bb9('0x36')]);return db[_0x8bb9('0x28')][_0x8bb9('0x3e')](_0x41115c)[_0x8bb9('0x21')](handleEntityNotFound(_0x5eae81,null))[_0x8bb9('0x21')](respondWithResult(_0x5eae81,null))['catch'](handleError(_0x5eae81,null));};exports['create']=function(_0x56698a,_0x39e6cb){return db['OpenchannelTransferReport'][_0x8bb9('0x3f')](_0x56698a[_0x8bb9('0x40')],{})[_0x8bb9('0x21')](respondWithResult(_0x39e6cb,0xc9))['catch'](handleError(_0x39e6cb,null));};exports['update']=function(_0x427360,_0x1bf448){if(_0x427360[_0x8bb9('0x40')]['id']){delete _0x427360['body']['id'];}return db[_0x8bb9('0x28')]['find']({'where':{'id':_0x427360['params']['id']}})['then'](handleEntityNotFound(_0x1bf448,null))[_0x8bb9('0x21')](saveUpdates(_0x427360[_0x8bb9('0x40')],null))[_0x8bb9('0x21')](respondWithResult(_0x1bf448,null))[_0x8bb9('0x39')](handleError(_0x1bf448,null));};exports['destroy']=function(_0x1b3239,_0x395f42){return db[_0x8bb9('0x28')][_0x8bb9('0x3e')]({'where':{'id':_0x1b3239['params']['id']}})[_0x8bb9('0x21')](handleEntityNotFound(_0x395f42,null))[_0x8bb9('0x21')](removeEntity(_0x395f42,null))[_0x8bb9('0x39')](handleError(_0x395f42,null));};exports['describe']=function(_0x560320,_0x4ced80){return db[_0x8bb9('0x28')][_0x8bb9('0x41')]()[_0x8bb9('0x21')](respondWithResult(_0x4ced80,null))[_0x8bb9('0x39')](handleError(_0x4ced80,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 622d2db..55febb7 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 _0x2e17=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x259d21,_0x5d61f3){var _0x224a43=function(_0x36262e){while(--_0x36262e){_0x259d21['push'](_0x259d21['shift']());}};_0x224a43(++_0x5d61f3);}(_0x2e17,0x1f2));var _0x72e1=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x2e17[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x72e1('0x0'));var util=require(_0x72e1('0x1'));var logger=require(_0x72e1('0x2'))(_0x72e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x72e1('0x4'));var fs=require('fs');var path=require(_0x72e1('0x5'));var rimraf=require(_0x72e1('0x6'));var config=require(_0x72e1('0x7'));var attributes=require(_0x72e1('0x8'));module['exports']=function(_0xc78396,_0x40f7a6){return _0xc78396[_0x72e1('0x9')](_0x72e1('0xa'),attributes,{'tableName':_0x72e1('0xb'),'paranoid':![],'indexes':[{'name':_0x72e1('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4dde=['uniqueid','lodash','util','../../config/logger','api','moment','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport'];(function(_0x3a678a,_0x61219){var _0x3141a6=function(_0xe0aa21){while(--_0xe0aa21){_0x3a678a['push'](_0x3a678a['shift']());}};_0x3141a6(++_0x61219);}(_0x4dde,0x65));var _0xe4dd=function(_0x449804,_0x40498e){_0x449804=_0x449804-0x0;var _0x5b49b0=_0x4dde[_0x449804];return _0x5b49b0;};'use strict';var _=require(_0xe4dd('0x0'));var util=require(_0xe4dd('0x1'));var logger=require(_0xe4dd('0x2'))(_0xe4dd('0x3'));var moment=require(_0xe4dd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe4dd('0x5'));var config=require('../../config/environment');var attributes=require(_0xe4dd('0x6'));module['exports']=function(_0x3c5323,_0x74b465){return _0x3c5323[_0xe4dd('0x7')](_0xe4dd('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xe4dd('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index be63ecf..e48f606 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 _0xc409=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xc409,0xc6));var _0x9c40=function(_0x411356,_0x32d6c4){_0x411356=_0x411356-0x0;var _0x2d914c=_0xc409[_0x411356];return _0x2d914c;};'use strict';var _=require(_0x9c40('0x0'));var util=require(_0x9c40('0x1'));var moment=require(_0x9c40('0x2'));var BPromise=require(_0x9c40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c40('0x5'));var logger=require(_0x9c40('0x6'))(_0x9c40('0x7'));var config=require(_0x9c40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9c40('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x211744,_0x20f7ea,_0x16bb9d){return new BPromise(function(_0x47b333,_0x8b7d1){return client[_0x9c40('0xa')](_0x211744,_0x16bb9d)['then'](function(_0x2f7752){logger[_0x9c40('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x20f7ea,'request\x20sent');logger[_0x9c40('0xc')](_0x9c40('0xd'),_0x20f7ea,_0x9c40('0xe'),JSON[_0x9c40('0xf')](_0x2f7752));if(_0x2f7752['error']){if(_0x2f7752[_0x9c40('0x10')][_0x9c40('0x11')]===0x1f4){logger[_0x9c40('0x10')](_0x9c40('0x12'),_0x20f7ea,_0x2f7752['error'][_0x9c40('0x13')]);return _0x8b7d1(_0x2f7752['error'][_0x9c40('0x13')]);}logger[_0x9c40('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x20f7ea,_0x2f7752[_0x9c40('0x10')][_0x9c40('0x13')]);return _0x47b333(_0x2f7752[_0x9c40('0x10')][_0x9c40('0x13')]);}else{logger[_0x9c40('0xb')](_0x9c40('0x12'),_0x20f7ea,_0x9c40('0xe'));_0x47b333(_0x2f7752[_0x9c40('0x14')][_0x9c40('0x13')]);}})[_0x9c40('0x15')](function(_0x3d6ebe){logger[_0x9c40('0x10')](_0x9c40('0x12'),_0x20f7ea,_0x3d6ebe);_0x8b7d1(_0x3d6ebe);});});} \ No newline at end of file +var _0x00b3=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x4edf35,_0x570962){var _0x1a35fe=function(_0x591aec){while(--_0x591aec){_0x4edf35['push'](_0x4edf35['shift']());}};_0x1a35fe(++_0x570962);}(_0x00b3,0x97));var _0x300b=function(_0x7df1b3,_0x58f155){_0x7df1b3=_0x7df1b3-0x0;var _0x52da4d=_0x00b3[_0x7df1b3];return _0x52da4d;};'use strict';var _=require(_0x300b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x300b('0x1'));var rs=require(_0x300b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x300b('0x3'));var logger=require(_0x300b('0x4'))(_0x300b('0x5'));var config=require('../../config/environment');var jayson=require(_0x300b('0x6'));var client=jayson[_0x300b('0x7')][_0x300b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4294fe,_0x643a7b,_0x2cf1c5){return new BPromise(function(_0x103922,_0xcd2a68){return client[_0x300b('0x9')](_0x4294fe,_0x2cf1c5)[_0x300b('0xa')](function(_0x1b9048){logger[_0x300b('0xb')](_0x300b('0xc'),_0x643a7b,'request\x20sent');logger[_0x300b('0xd')](_0x300b('0xe'),_0x643a7b,_0x300b('0xf'),JSON['stringify'](_0x1b9048));if(_0x1b9048[_0x300b('0x10')]){if(_0x1b9048[_0x300b('0x10')]['code']===0x1f4){logger['error'](_0x300b('0xc'),_0x643a7b,_0x1b9048['error'][_0x300b('0x11')]);return _0xcd2a68(_0x1b9048[_0x300b('0x10')][_0x300b('0x11')]);}logger[_0x300b('0x10')](_0x300b('0xc'),_0x643a7b,_0x1b9048[_0x300b('0x10')]['message']);return _0x103922(_0x1b9048['error'][_0x300b('0x11')]);}else{logger[_0x300b('0xb')](_0x300b('0xc'),_0x643a7b,_0x300b('0xf'));_0x103922(_0x1b9048[_0x300b('0x12')][_0x300b('0x11')]);}})[_0x300b('0x13')](function(_0x3e1dbd){logger['error'](_0x300b('0xc'),_0x643a7b,_0x3e1dbd);_0xcd2a68(_0x3e1dbd);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d2193ec..b36cba5 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 _0x2930=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x32dd20,_0x7ed214){var _0x51bf47=function(_0x3ccc82){while(--_0x3ccc82){_0x32dd20['push'](_0x32dd20['shift']());}};_0x51bf47(++_0x7ed214);}(_0x2930,0x168));var _0x0293=function(_0x21ad7e,_0x5cc9fd){_0x21ad7e=_0x21ad7e-0x0;var _0x279d88=_0x2930[_0x21ad7e];return _0x279d88;};'use strict';var multer=require(_0x0293('0x0'));var util=require(_0x0293('0x1'));var path=require('path');var timeout=require(_0x0293('0x2'));var express=require('express');var router=express[_0x0293('0x3')]();var fs_extra=require(_0x0293('0x4'));var auth=require(_0x0293('0x5'));var interaction=require(_0x0293('0x6'));var config=require('../../config/environment');var controller=require(_0x0293('0x7'));router[_0x0293('0x8')]('/',auth['isAuthenticated'](),controller[_0x0293('0x9')]);router[_0x0293('0x8')]('/:id',auth[_0x0293('0xa')](),controller[_0x0293('0xb')]);router[_0x0293('0xc')]('/',auth[_0x0293('0xa')](),controller[_0x0293('0xd')]);router[_0x0293('0xe')](_0x0293('0xf'),auth[_0x0293('0xa')](),controller[_0x0293('0x10')]);router[_0x0293('0x11')](_0x0293('0xf'),auth['isAuthenticated'](),controller[_0x0293('0x12')]);module[_0x0293('0x13')]=router; \ No newline at end of file +var _0x674e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xea0de2,_0x4af541){var _0x61223e=function(_0x1d6407){while(--_0x1d6407){_0xea0de2['push'](_0xea0de2['shift']());}};_0x61223e(++_0x4af541);}(_0x674e,0x115));var _0xe674=function(_0x36eaba,_0x53d885){_0x36eaba=_0x36eaba-0x0;var _0xa24bf1=_0x674e[_0x36eaba];return _0xa24bf1;};'use strict';var multer=require(_0xe674('0x0'));var util=require(_0xe674('0x1'));var path=require(_0xe674('0x2'));var timeout=require(_0xe674('0x3'));var express=require(_0xe674('0x4'));var router=express[_0xe674('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe674('0x6'));var interaction=require(_0xe674('0x7'));var config=require(_0xe674('0x8'));var controller=require('./pause.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe674('0x9')]);router[_0xe674('0xa')](_0xe674('0xb'),auth[_0xe674('0xc')](),controller[_0xe674('0xd')]);router['post']('/',auth[_0xe674('0xc')](),controller[_0xe674('0xe')]);router[_0xe674('0xf')](_0xe674('0xb'),auth[_0xe674('0xc')](),controller[_0xe674('0x10')]);router[_0xe674('0x11')](_0xe674('0xb'),auth['isAuthenticated'](),controller[_0xe674('0x12')]);module[_0xe674('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index bb47ff8..af49eb8 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 _0x9851=['STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9851,0xbf));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1985('0x0'));module['exports']={'name':{'type':Sequelize[_0x1985('0x1')],'unique':_0x1985('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1985('0x1')]}}; \ No newline at end of file +var _0x7f27=['STRING','name','exports'];(function(_0x555f24,_0x4dc956){var _0x205aee=function(_0x30230d){while(--_0x30230d){_0x555f24['push'](_0x555f24['shift']());}};_0x205aee(++_0x4dc956);}(_0x7f27,0x80));var _0x77f2=function(_0x419480,_0x2df6fd){_0x419480=_0x419480-0x0;var _0x31edee=_0x7f27[_0x419480];return _0x31edee;};'use strict';var Sequelize=require('sequelize');module[_0x77f2('0x0')]={'name':{'type':Sequelize[_0x77f2('0x1')],'unique':_0x77f2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x77f2('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3d8fdf9..d1074b0 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 _0xf155=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','map','Pause','fieldName','type','key'];(function(_0x5c17e6,_0x24949c){var _0x16a6b1=function(_0xca0014){while(--_0xca0014){_0x5c17e6['push'](_0x5c17e6['shift']());}};_0x16a6b1(++_0x24949c);}(_0xf155,0x117));var _0x5f15=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0xf155[_0x47242d];return _0x30273a;};'use strict';var pdf=require(_0x5f15('0x0'));var emlformat=require(_0x5f15('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f15('0x2'));var jsonpatch=require(_0x5f15('0x3'));var rp=require(_0x5f15('0x4'));var moment=require('moment');var BPromise=require(_0x5f15('0x5'));var Mustache=require(_0x5f15('0x6'));var util=require(_0x5f15('0x7'));var path=require('path');var sox=require(_0x5f15('0x8'));var csv=require(_0x5f15('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f15('0xa'));var _=require(_0x5f15('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5f15('0xc'));var deskjs=require(_0x5f15('0xd'));var toCsv=require(_0x5f15('0x9'));var querystring=require(_0x5f15('0xe'));var Papa=require(_0x5f15('0xf'));var Redis=require(_0x5f15('0x10'));var authService=require(_0x5f15('0x11'));var qs=require(_0x5f15('0x12'));var as=require(_0x5f15('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5f15('0x14'));var licenseUtil=require(_0x5f15('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd6e073,_0x4c4532){_0x4c4532=_0x4c4532||0xcc;return function(_0x54c3ff){if(_0x54c3ff){return _0xd6e073[_0x5f15('0x16')](_0x4c4532);}return _0xd6e073[_0x5f15('0x17')](_0x4c4532)['end']();};}function respondWithResult(_0x3476ce,_0x3f2325){_0x3f2325=_0x3f2325||0xc8;return function(_0x48082b){if(_0x48082b){return _0x3476ce['status'](_0x3f2325)[_0x5f15('0x18')](_0x48082b);}};}function respondWithFilteredResult(_0x46fdc4,_0x471b20){return function(_0x3388c0){if(_0x3388c0){var _0x1fa45b=_0x3388c0[_0x5f15('0x19')],_0x27c343=_0x471b20[_0x5f15('0x1a')],_0x1f9f0a=_0x471b20['offset']+_0x471b20['limit'],_0x1a1bc2;if(_0x1f9f0a>=_0x1fa45b){_0x1f9f0a=_0x1fa45b;_0x1a1bc2=0xc8;}else{_0x1a1bc2=0xce;}_0x46fdc4[_0x5f15('0x17')](_0x1a1bc2);return _0x46fdc4['set'](_0x5f15('0x1b'),_0x27c343+'-'+_0x1f9f0a+'/'+_0x1fa45b)['json'](_0x3388c0);}return null;};}function patchUpdates(_0x514d3e){return function(_0x33fc3f){try{jsonpatch[_0x5f15('0x1c')](_0x33fc3f,_0x514d3e,!![]);}catch(_0xb48ef8){return BPromise['reject'](_0xb48ef8);}return _0x33fc3f[_0x5f15('0x1d')]();};}function saveUpdates(_0x35931c,_0x2210f8){return function(_0x2cbe16){if(_0x2cbe16){return _0x2cbe16[_0x5f15('0x1e')](_0x35931c)[_0x5f15('0x1f')](function(_0x10c9d0){return _0x10c9d0;});}return null;};}function removeEntity(_0x17a6c2,_0x2ed9e1){return function(_0x3db85b){if(_0x3db85b){return _0x3db85b[_0x5f15('0x20')]()[_0x5f15('0x1f')](function(){var _0x2f9487=_0x3db85b['get']({'plain':!![]});var _0x414809='Pauses';return db[_0x5f15('0x21')][_0x5f15('0x20')]({'where':{'type':_0x414809,'resourceId':_0x2f9487['id']}})[_0x5f15('0x1f')](function(){return _0x3db85b;});})['then'](function(){_0x17a6c2['status'](0xcc)[_0x5f15('0x22')]();});}};}function handleEntityNotFound(_0x51763e,_0x112097){return function(_0x38d481){if(!_0x38d481){_0x51763e['sendStatus'](0x194);}return _0x38d481;};}function handleError(_0xf6dba8,_0x1a5832){_0x1a5832=_0x1a5832||0x1f4;return function(_0x43df4a){logger[_0x5f15('0x23')](_0x43df4a[_0x5f15('0x24')]);if(_0x43df4a[_0x5f15('0x25')]){delete _0x43df4a[_0x5f15('0x25')];}_0xf6dba8[_0x5f15('0x17')](_0x1a5832)[_0x5f15('0x26')](_0x43df4a);};}exports[_0x5f15('0x27')]=function(_0x581e7a,_0x492d1c){var _0x92a0e2={},_0xb55b89={},_0x3a4d06={'count':0x0,'rows':[]};var _0x12ffa7=_[_0x5f15('0x28')](db[_0x5f15('0x29')]['rawAttributes'],function(_0x16b51b){return{'name':_0x16b51b[_0x5f15('0x2a')],'type':_0x16b51b[_0x5f15('0x2b')][_0x5f15('0x2c')]};});_0xb55b89[_0x5f15('0x2d')]=_[_0x5f15('0x28')](_0x12ffa7,'name');_0xb55b89[_0x5f15('0x2e')]=_['keys'](_0x581e7a['query']);_0xb55b89[_0x5f15('0x2f')]=_['intersection'](_0xb55b89[_0x5f15('0x2d')],_0xb55b89[_0x5f15('0x2e')]);_0x92a0e2['attributes']=_[_0x5f15('0x30')](_0xb55b89[_0x5f15('0x2d')],qs[_0x5f15('0x31')](_0x581e7a[_0x5f15('0x2e')][_0x5f15('0x31')]));_0x92a0e2[_0x5f15('0x32')]=_0x92a0e2[_0x5f15('0x32')][_0x5f15('0x33')]?_0x92a0e2['attributes']:_0xb55b89[_0x5f15('0x2d')];if(!_0x581e7a['query'][_0x5f15('0x34')](_0x5f15('0x35'))){_0x92a0e2[_0x5f15('0x36')]=qs[_0x5f15('0x36')](_0x581e7a[_0x5f15('0x2e')][_0x5f15('0x36')]);_0x92a0e2[_0x5f15('0x1a')]=qs[_0x5f15('0x1a')](_0x581e7a[_0x5f15('0x2e')][_0x5f15('0x1a')]);}_0x92a0e2['order']=qs[_0x5f15('0x37')](_0x581e7a['query'][_0x5f15('0x37')]);_0x92a0e2['where']=qs[_0x5f15('0x2f')](_[_0x5f15('0x38')](_0x581e7a[_0x5f15('0x2e')],_0xb55b89[_0x5f15('0x2f')]),_0x12ffa7);if(_0x581e7a['query']['filter']){_0x92a0e2[_0x5f15('0x39')]=_['merge'](_0x92a0e2[_0x5f15('0x39')],{'$or':_[_0x5f15('0x28')](_0x12ffa7,function(_0x12d69f){if(_0x12d69f[_0x5f15('0x2b')]!==_0x5f15('0x3a')){var _0x5c0b34={};_0x5c0b34[_0x12d69f[_0x5f15('0x25')]]={'$like':'%'+_0x581e7a[_0x5f15('0x2e')][_0x5f15('0x3b')]+'%'};return _0x5c0b34;}})});}_0x92a0e2=_[_0x5f15('0x3c')]({},_0x92a0e2,_0x581e7a[_0x5f15('0x3d')]);var _0x75bb02={'where':_0x92a0e2['where']};return db[_0x5f15('0x29')]['count'](_0x75bb02)[_0x5f15('0x1f')](function(_0x14b97b){_0x3a4d06[_0x5f15('0x19')]=_0x14b97b;if(_0x581e7a[_0x5f15('0x2e')][_0x5f15('0x3e')]){_0x92a0e2[_0x5f15('0x3f')]=[{'all':!![]}];}return db['Pause'][_0x5f15('0x40')](_0x92a0e2);})[_0x5f15('0x1f')](function(_0x2ec841){_0x3a4d06[_0x5f15('0x41')]=_0x2ec841;return _0x3a4d06;})[_0x5f15('0x1f')](respondWithFilteredResult(_0x492d1c,_0x92a0e2))[_0x5f15('0x42')](handleError(_0x492d1c,null));};exports[_0x5f15('0x43')]=function(_0x3a8b6d,_0x28a690){var _0x1e6a76={'raw':!![],'where':{'id':_0x3a8b6d[_0x5f15('0x44')]['id']}},_0x4ccae1={};_0x4ccae1[_0x5f15('0x2d')]=_[_0x5f15('0x45')](db[_0x5f15('0x29')][_0x5f15('0x46')]);_0x4ccae1[_0x5f15('0x2e')]=_['keys'](_0x3a8b6d['query']);_0x4ccae1[_0x5f15('0x2f')]=_[_0x5f15('0x30')](_0x4ccae1['model'],_0x4ccae1['query']);_0x1e6a76['attributes']=_['intersection'](_0x4ccae1[_0x5f15('0x2d')],qs['fields'](_0x3a8b6d[_0x5f15('0x2e')]['fields']));_0x1e6a76[_0x5f15('0x32')]=_0x1e6a76[_0x5f15('0x32')][_0x5f15('0x33')]?_0x1e6a76[_0x5f15('0x32')]:_0x4ccae1['model'];if(_0x3a8b6d[_0x5f15('0x2e')]['includeAll']){_0x1e6a76[_0x5f15('0x3f')]=[{'all':!![]}];}_0x1e6a76=_[_0x5f15('0x3c')]({},_0x1e6a76,_0x3a8b6d[_0x5f15('0x3d')]);return db['Pause'][_0x5f15('0x47')](_0x1e6a76)['then'](handleEntityNotFound(_0x28a690,null))[_0x5f15('0x1f')](respondWithResult(_0x28a690,null))[_0x5f15('0x42')](handleError(_0x28a690,null));};exports[_0x5f15('0x48')]=function(_0x2ac00f,_0x5d797e){return db[_0x5f15('0x29')][_0x5f15('0x48')](_0x2ac00f['body'],{})[_0x5f15('0x1f')](function(_0x11f393){var _0xbe52c7=_0x2ac00f[_0x5f15('0x49')]['get']({'plain':!![]});if(!_0xbe52c7)throw new Error(_0x5f15('0x4a'));if(_0xbe52c7['role']===_0x5f15('0x49')){var _0x55f637=_0x11f393['get']({'plain':!![]});var _0x2e969c=_0x5f15('0x4b');return db[_0x5f15('0x4c')][_0x5f15('0x47')]({'where':{'name':_0x2e969c,'userProfileId':_0xbe52c7[_0x5f15('0x4d')]},'raw':!![]})[_0x5f15('0x1f')](function(_0x1941e6){if(_0x1941e6&&_0x1941e6[_0x5f15('0x4e')]===0x0){return db[_0x5f15('0x21')][_0x5f15('0x48')]({'name':_0x55f637[_0x5f15('0x25')],'resourceId':_0x55f637['id'],'type':_0x1941e6[_0x5f15('0x25')],'sectionId':_0x1941e6['id']},{})[_0x5f15('0x1f')](function(){return _0x11f393;});}else{return _0x11f393;}})[_0x5f15('0x42')](function(_0x398637){logger['error'](_0x5f15('0x4f'),_0x398637);throw _0x398637;});}return _0x11f393;})[_0x5f15('0x1f')](respondWithResult(_0x5d797e,0xc9))[_0x5f15('0x42')](handleError(_0x5d797e,null));};exports['update']=function(_0x444339,_0x231d68){if(_0x444339[_0x5f15('0x50')]['id']){delete _0x444339[_0x5f15('0x50')]['id'];}return db['Pause'][_0x5f15('0x47')]({'where':{'id':_0x444339[_0x5f15('0x44')]['id']}})['then'](handleEntityNotFound(_0x231d68,null))['then'](saveUpdates(_0x444339[_0x5f15('0x50')],null))[_0x5f15('0x1f')](respondWithResult(_0x231d68,null))[_0x5f15('0x42')](handleError(_0x231d68,null));};exports[_0x5f15('0x20')]=function(_0x3560cf,_0x393a3a){return db[_0x5f15('0x29')][_0x5f15('0x47')]({'where':{'id':_0x3560cf[_0x5f15('0x44')]['id']}})['then'](handleEntityNotFound(_0x393a3a,null))[_0x5f15('0x1f')](removeEntity(_0x393a3a,null))[_0x5f15('0x42')](handleError(_0x393a3a,null));}; \ No newline at end of file +var _0xd845=['count','offset','limit','set','Content-Range','apply','update','then','get','Pauses','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','Pause','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x5531e8,_0x5c5f1b){var _0x2b9372=function(_0x468b35){while(--_0x468b35){_0x5531e8['push'](_0x5531e8['shift']());}};_0x2b9372(++_0x5c5f1b);}(_0xd845,0x12e));var _0x5d84=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xd845[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require(_0x5d84('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5d84('0x1'));var zipdir=require(_0x5d84('0x2'));var jsonpatch=require(_0x5d84('0x3'));var rp=require('request-promise');var moment=require(_0x5d84('0x4'));var BPromise=require(_0x5d84('0x5'));var Mustache=require(_0x5d84('0x6'));var util=require(_0x5d84('0x7'));var path=require(_0x5d84('0x8'));var sox=require(_0x5d84('0x9'));var csv=require(_0x5d84('0xa'));var ejs=require(_0x5d84('0xb'));var fs=require('fs');var fs_extra=require(_0x5d84('0xc'));var _=require(_0x5d84('0xd'));var squel=require(_0x5d84('0xe'));var crypto=require('crypto');var jsforce=require(_0x5d84('0xf'));var deskjs=require(_0x5d84('0x10'));var toCsv=require(_0x5d84('0xa'));var querystring=require(_0x5d84('0x11'));var Papa=require(_0x5d84('0x12'));var Redis=require(_0x5d84('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5d84('0x14'));var as=require(_0x5d84('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d84('0x16'))(_0x5d84('0x17'));var utils=require(_0x5d84('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5d84('0x19'));var db=require(_0x5d84('0x1a'))['db'];function respondWithStatusCode(_0x5cd879,_0xe08536){_0xe08536=_0xe08536||0xcc;return function(_0x17747c){if(_0x17747c){return _0x5cd879[_0x5d84('0x1b')](_0xe08536);}return _0x5cd879['status'](_0xe08536)[_0x5d84('0x1c')]();};}function respondWithResult(_0x50bf78,_0x228b0c){_0x228b0c=_0x228b0c||0xc8;return function(_0x5d6ec0){if(_0x5d6ec0){return _0x50bf78[_0x5d84('0x1d')](_0x228b0c)['json'](_0x5d6ec0);}};}function respondWithFilteredResult(_0x1f990a,_0x5735b8){return function(_0x3fd196){if(_0x3fd196){var _0x3a3f60=_0x3fd196[_0x5d84('0x1e')],_0x5ea502=_0x5735b8['offset'],_0x59b8f3=_0x5735b8[_0x5d84('0x1f')]+_0x5735b8[_0x5d84('0x20')],_0x57f8c0;if(_0x59b8f3>=_0x3a3f60){_0x59b8f3=_0x3a3f60;_0x57f8c0=0xc8;}else{_0x57f8c0=0xce;}_0x1f990a[_0x5d84('0x1d')](_0x57f8c0);return _0x1f990a[_0x5d84('0x21')](_0x5d84('0x22'),_0x5ea502+'-'+_0x59b8f3+'/'+_0x3a3f60)['json'](_0x3fd196);}return null;};}function patchUpdates(_0x3dbcc4){return function(_0x2fb154){try{jsonpatch[_0x5d84('0x23')](_0x2fb154,_0x3dbcc4,!![]);}catch(_0x37ea3d){return BPromise['reject'](_0x37ea3d);}return _0x2fb154['save']();};}function saveUpdates(_0x22f9be,_0x178a54){return function(_0x515f87){if(_0x515f87){return _0x515f87[_0x5d84('0x24')](_0x22f9be)[_0x5d84('0x25')](function(_0x2f36ca){return _0x2f36ca;});}return null;};}function removeEntity(_0x514736,_0x21d645){return function(_0x55cd84){if(_0x55cd84){return _0x55cd84['destroy']()[_0x5d84('0x25')](function(){var _0xd12b2c=_0x55cd84[_0x5d84('0x26')]({'plain':!![]});var _0x995f8a=_0x5d84('0x27');return db[_0x5d84('0x28')][_0x5d84('0x29')]({'where':{'type':_0x995f8a,'resourceId':_0xd12b2c['id']}})['then'](function(){return _0x55cd84;});})[_0x5d84('0x25')](function(){_0x514736['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xde5c14,_0x348d01){return function(_0x36032a){if(!_0x36032a){_0xde5c14['sendStatus'](0x194);}return _0x36032a;};}function handleError(_0x51e623,_0x30d76b){_0x30d76b=_0x30d76b||0x1f4;return function(_0x229729){logger[_0x5d84('0x2a')](_0x229729[_0x5d84('0x2b')]);if(_0x229729['name']){delete _0x229729[_0x5d84('0x2c')];}_0x51e623[_0x5d84('0x1d')](_0x30d76b)[_0x5d84('0x2d')](_0x229729);};}exports[_0x5d84('0x2e')]=function(_0x260efc,_0xfda24){var _0x307897={},_0x12dece={},_0x373e86={'count':0x0,'rows':[]};var _0x26cde7=_[_0x5d84('0x2f')](db['Pause'][_0x5d84('0x30')],function(_0x1c5b3a){return{'name':_0x1c5b3a[_0x5d84('0x31')],'type':_0x1c5b3a[_0x5d84('0x32')][_0x5d84('0x33')]};});_0x12dece[_0x5d84('0x34')]=_[_0x5d84('0x2f')](_0x26cde7,_0x5d84('0x2c'));_0x12dece['query']=_[_0x5d84('0x35')](_0x260efc[_0x5d84('0x36')]);_0x12dece[_0x5d84('0x37')]=_[_0x5d84('0x38')](_0x12dece[_0x5d84('0x34')],_0x12dece['query']);_0x307897[_0x5d84('0x39')]=_['intersection'](_0x12dece[_0x5d84('0x34')],qs[_0x5d84('0x3a')](_0x260efc[_0x5d84('0x36')][_0x5d84('0x3a')]));_0x307897[_0x5d84('0x39')]=_0x307897[_0x5d84('0x39')]['length']?_0x307897[_0x5d84('0x39')]:_0x12dece[_0x5d84('0x34')];if(!_0x260efc['query'][_0x5d84('0x3b')]('nolimit')){_0x307897[_0x5d84('0x20')]=qs[_0x5d84('0x20')](_0x260efc[_0x5d84('0x36')][_0x5d84('0x20')]);_0x307897[_0x5d84('0x1f')]=qs['offset'](_0x260efc[_0x5d84('0x36')][_0x5d84('0x1f')]);}_0x307897[_0x5d84('0x3c')]=qs[_0x5d84('0x3d')](_0x260efc[_0x5d84('0x36')][_0x5d84('0x3d')]);_0x307897[_0x5d84('0x3e')]=qs[_0x5d84('0x37')](_[_0x5d84('0x3f')](_0x260efc[_0x5d84('0x36')],_0x12dece[_0x5d84('0x37')]),_0x26cde7);if(_0x260efc[_0x5d84('0x36')][_0x5d84('0x40')]){_0x307897[_0x5d84('0x3e')]=_['merge'](_0x307897['where'],{'$or':_[_0x5d84('0x2f')](_0x26cde7,function(_0x3e1631){if(_0x3e1631[_0x5d84('0x32')]!==_0x5d84('0x41')){var _0x403afc={};_0x403afc[_0x3e1631[_0x5d84('0x2c')]]={'$like':'%'+_0x260efc['query'][_0x5d84('0x40')]+'%'};return _0x403afc;}})});}_0x307897=_[_0x5d84('0x42')]({},_0x307897,_0x260efc['options']);var _0x324e15={'where':_0x307897['where']};return db['Pause'][_0x5d84('0x1e')](_0x324e15)['then'](function(_0xfc593d){_0x373e86[_0x5d84('0x1e')]=_0xfc593d;if(_0x260efc[_0x5d84('0x36')][_0x5d84('0x43')]){_0x307897['include']=[{'all':!![]}];}return db['Pause']['findAll'](_0x307897);})[_0x5d84('0x25')](function(_0x153a07){_0x373e86[_0x5d84('0x44')]=_0x153a07;return _0x373e86;})['then'](respondWithFilteredResult(_0xfda24,_0x307897))[_0x5d84('0x45')](handleError(_0xfda24,null));};exports[_0x5d84('0x46')]=function(_0x2959dc,_0x3e01c6){var _0x46300d={'raw':!![],'where':{'id':_0x2959dc[_0x5d84('0x47')]['id']}},_0x1a6003={};_0x1a6003[_0x5d84('0x34')]=_[_0x5d84('0x35')](db[_0x5d84('0x48')][_0x5d84('0x30')]);_0x1a6003['query']=_['keys'](_0x2959dc[_0x5d84('0x36')]);_0x1a6003['filters']=_[_0x5d84('0x38')](_0x1a6003['model'],_0x1a6003['query']);_0x46300d[_0x5d84('0x39')]=_[_0x5d84('0x38')](_0x1a6003['model'],qs[_0x5d84('0x3a')](_0x2959dc[_0x5d84('0x36')][_0x5d84('0x3a')]));_0x46300d[_0x5d84('0x39')]=_0x46300d[_0x5d84('0x39')]['length']?_0x46300d[_0x5d84('0x39')]:_0x1a6003[_0x5d84('0x34')];if(_0x2959dc['query'][_0x5d84('0x43')]){_0x46300d[_0x5d84('0x49')]=[{'all':!![]}];}_0x46300d=_[_0x5d84('0x42')]({},_0x46300d,_0x2959dc['options']);return db[_0x5d84('0x48')]['find'](_0x46300d)[_0x5d84('0x25')](handleEntityNotFound(_0x3e01c6,null))[_0x5d84('0x25')](respondWithResult(_0x3e01c6,null))[_0x5d84('0x45')](handleError(_0x3e01c6,null));};exports[_0x5d84('0x4a')]=function(_0x392ffc,_0x1f5879){return db[_0x5d84('0x48')][_0x5d84('0x4a')](_0x392ffc[_0x5d84('0x4b')],{})[_0x5d84('0x25')](function(_0x5e4008){var _0x45389e=_0x392ffc[_0x5d84('0x4c')][_0x5d84('0x26')]({'plain':!![]});if(!_0x45389e)throw new Error(_0x5d84('0x4d'));if(_0x45389e[_0x5d84('0x4e')]===_0x5d84('0x4c')){var _0x357db0=_0x5e4008[_0x5d84('0x26')]({'plain':!![]});var _0x7c8c4=_0x5d84('0x27');return db[_0x5d84('0x4f')][_0x5d84('0x50')]({'where':{'name':_0x7c8c4,'userProfileId':_0x45389e['userProfileId']},'raw':!![]})[_0x5d84('0x25')](function(_0x94a239){if(_0x94a239&&_0x94a239[_0x5d84('0x51')]===0x0){return db[_0x5d84('0x28')][_0x5d84('0x4a')]({'name':_0x357db0['name'],'resourceId':_0x357db0['id'],'type':_0x94a239[_0x5d84('0x2c')],'sectionId':_0x94a239['id']},{})[_0x5d84('0x25')](function(){return _0x5e4008;});}else{return _0x5e4008;}})['catch'](function(_0x1f24bd){logger[_0x5d84('0x2a')](_0x5d84('0x52'),_0x1f24bd);throw _0x1f24bd;});}return _0x5e4008;})[_0x5d84('0x25')](respondWithResult(_0x1f5879,0xc9))[_0x5d84('0x45')](handleError(_0x1f5879,null));};exports['update']=function(_0x3f1b69,_0x31fb0e){if(_0x3f1b69[_0x5d84('0x4b')]['id']){delete _0x3f1b69[_0x5d84('0x4b')]['id'];}return db[_0x5d84('0x48')][_0x5d84('0x50')]({'where':{'id':_0x3f1b69[_0x5d84('0x47')]['id']}})[_0x5d84('0x25')](handleEntityNotFound(_0x31fb0e,null))[_0x5d84('0x25')](saveUpdates(_0x3f1b69['body'],null))[_0x5d84('0x25')](respondWithResult(_0x31fb0e,null))[_0x5d84('0x45')](handleError(_0x31fb0e,null));};exports[_0x5d84('0x29')]=function(_0x5ceeb3,_0x4bfa04){return db[_0x5d84('0x48')]['find']({'where':{'id':_0x5ceeb3[_0x5d84('0x47')]['id']}})[_0x5d84('0x25')](handleEntityNotFound(_0x4bfa04,null))[_0x5d84('0x25')](removeEntity(_0x4bfa04,null))['catch'](handleError(_0x4bfa04,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 43abb6d..18e2cd3 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 _0x594d=['define','Pause','tools_pauses','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes'];(function(_0x13accf,_0x5710d6){var _0x3c9c70=function(_0x3036a4){while(--_0x3036a4){_0x13accf['push'](_0x13accf['shift']());}};_0x3c9c70(++_0x5710d6);}(_0x594d,0x92));var _0xd594=function(_0x3aef1d,_0x55eca1){_0x3aef1d=_0x3aef1d-0x0;var _0x276cbc=_0x594d[_0x3aef1d];return _0x276cbc;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd594('0x1'));var moment=require(_0xd594('0x2'));var BPromise=require(_0xd594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd594('0x4'));var rimraf=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module['exports']=function(_0x3347cd,_0x498ef4){return _0x3347cd[_0xd594('0x8')](_0xd594('0x9'),attributes,{'tableName':_0xd594('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','tools_pauses','lodash','../../config/logger'];(function(_0x4ca796,_0x10dc47){var _0x171f87=function(_0x198d29){while(--_0x198d29){_0x4ca796['push'](_0x4ca796['shift']());}};_0x171f87(++_0x10dc47);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cdb2d,_0x8f1f76){_0x1cdb2d=_0x1cdb2d-0x0;var _0x4dafe3=_0xb10b[_0x1cdb2d];return _0x4dafe3;};'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')]('Pause',attributes,{'tableName':_0xbb10('0xb'),'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 b8cb127..4c5a1aa 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 _0x8cb4=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','ShowPause','Pause','find','options','where','include','model','map','attributes','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x171285,_0x51a294){var _0x458e6b=function(_0x2c1e2e){while(--_0x2c1e2e){_0x171285['push'](_0x171285['shift']());}};_0x458e6b(++_0x51a294);}(_0x8cb4,0xf3));var _0x48cb=function(_0x2b7b6d,_0x334ee5){_0x2b7b6d=_0x2b7b6d-0x0;var _0x285c35=_0x8cb4[_0x2b7b6d];return _0x285c35;};'use strict';var _=require(_0x48cb('0x0'));var util=require(_0x48cb('0x1'));var moment=require(_0x48cb('0x2'));var BPromise=require('bluebird');var rs=require(_0x48cb('0x3'));var fs=require('fs');var Redis=require(_0x48cb('0x4'));var db=require(_0x48cb('0x5'))['db'];var utils=require(_0x48cb('0x6'));var logger=require(_0x48cb('0x7'))(_0x48cb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x48cb('0x9')][_0x48cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3471c5,_0x44205d,_0x3c7f76){return new BPromise(function(_0x55c457,_0x4f8a75){return client[_0x48cb('0xb')](_0x3471c5,_0x3c7f76)[_0x48cb('0xc')](function(_0x37aee9){logger[_0x48cb('0xd')](_0x48cb('0xe'),_0x44205d,_0x48cb('0xf'));logger[_0x48cb('0x10')](_0x48cb('0x11'),_0x44205d,_0x48cb('0xf'),JSON[_0x48cb('0x12')](_0x37aee9));if(_0x37aee9[_0x48cb('0x13')]){if(_0x37aee9[_0x48cb('0x13')]['code']===0x1f4){logger[_0x48cb('0x13')]('Pause,\x20%s,\x20%s',_0x44205d,_0x37aee9[_0x48cb('0x13')][_0x48cb('0x14')]);return _0x4f8a75(_0x37aee9[_0x48cb('0x13')][_0x48cb('0x14')]);}logger[_0x48cb('0x13')](_0x48cb('0xe'),_0x44205d,_0x37aee9[_0x48cb('0x13')][_0x48cb('0x14')]);return _0x55c457(_0x37aee9['error']['message']);}else{logger['info'](_0x48cb('0xe'),_0x44205d,_0x48cb('0xf'));_0x55c457(_0x37aee9['result']['message']);}})['catch'](function(_0x7fe84e){logger[_0x48cb('0x13')](_0x48cb('0xe'),_0x44205d,_0x7fe84e);_0x4f8a75(_0x7fe84e);});});}exports[_0x48cb('0x15')]=function(_0x4c7711){var _0x17dcce=this;return new Promise(function(_0x3b85a5,_0x5b7ee9){return db[_0x48cb('0x16')][_0x48cb('0x17')]({'raw':_0x4c7711[_0x48cb('0x18')]?_0x4c7711[_0x48cb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c7711['options']?_0x4c7711[_0x48cb('0x18')][_0x48cb('0x19')]||null:null,'attributes':_0x4c7711[_0x48cb('0x18')]?_0x4c7711[_0x48cb('0x18')]['attributes']||null:null,'include':_0x4c7711['options']?_0x4c7711[_0x48cb('0x18')][_0x48cb('0x1a')]?_['map'](_0x4c7711[_0x48cb('0x18')]['include'],function(_0x1e8303){return{'model':db[_0x1e8303[_0x48cb('0x1b')]],'as':_0x1e8303['as'],'attributes':_0x1e8303['attributes'],'include':_0x1e8303['include']?_[_0x48cb('0x1c')](_0x1e8303['include'],function(_0x29962f){return{'model':db[_0x29962f['model']],'as':_0x29962f['as'],'attributes':_0x29962f[_0x48cb('0x1d')],'include':_0x29962f[_0x48cb('0x1a')]?_['map'](_0x29962f['include'],function(_0x4ac281){return{'model':db[_0x4ac281[_0x48cb('0x1b')]],'as':_0x4ac281['as'],'attributes':_0x4ac281[_0x48cb('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x159c1f){logger[_0x48cb('0xd')]('ShowPause',_0x4c7711);logger[_0x48cb('0x10')]('ShowPause',_0x4c7711,JSON[_0x48cb('0x12')](_0x159c1f));_0x3b85a5(_0x159c1f);})[_0x48cb('0x1e')](function(_0x466fd8){logger['error'](_0x48cb('0x15'),_0x466fd8[_0x48cb('0x14')],_0x4c7711);_0x5b7ee9(_0x17dcce['error'](0x1f4,_0x466fd8[_0x48cb('0x14')]));});});}; \ No newline at end of file +var _0x8f69=['model','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowPause','Pause','options','raw','where','attributes','include'];(function(_0x1432ea,_0x307900){var _0x105a27=function(_0x397c1e){while(--_0x397c1e){_0x1432ea['push'](_0x1432ea['shift']());}};_0x105a27(++_0x307900);}(_0x8f69,0xfa));var _0x98f6=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x8f69[_0x367e5b];return _0x4b909e;};'use strict';var _=require(_0x98f6('0x0'));var util=require(_0x98f6('0x1'));var moment=require(_0x98f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x98f6('0x3'));var fs=require('fs');var Redis=require(_0x98f6('0x4'));var db=require(_0x98f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x98f6('0x7'));var client=jayson[_0x98f6('0x8')][_0x98f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a37fc,_0x4ccadc,_0x319ffd){return new BPromise(function(_0x1d1630,_0x247de7){return client[_0x98f6('0xa')](_0x1a37fc,_0x319ffd)[_0x98f6('0xb')](function(_0x5926fb){logger[_0x98f6('0xc')](_0x98f6('0xd'),_0x4ccadc,_0x98f6('0xe'));logger[_0x98f6('0xf')]('Pause,\x20%s,\x20%s,\x20%s',_0x4ccadc,_0x98f6('0xe'),JSON[_0x98f6('0x10')](_0x5926fb));if(_0x5926fb[_0x98f6('0x11')]){if(_0x5926fb['error'][_0x98f6('0x12')]===0x1f4){logger['error'](_0x98f6('0xd'),_0x4ccadc,_0x5926fb['error'][_0x98f6('0x13')]);return _0x247de7(_0x5926fb[_0x98f6('0x11')][_0x98f6('0x13')]);}logger['error']('Pause,\x20%s,\x20%s',_0x4ccadc,_0x5926fb['error'][_0x98f6('0x13')]);return _0x1d1630(_0x5926fb[_0x98f6('0x11')][_0x98f6('0x13')]);}else{logger[_0x98f6('0xc')](_0x98f6('0xd'),_0x4ccadc,_0x98f6('0xe'));_0x1d1630(_0x5926fb[_0x98f6('0x14')][_0x98f6('0x13')]);}})[_0x98f6('0x15')](function(_0x2a7ded){logger[_0x98f6('0x11')](_0x98f6('0xd'),_0x4ccadc,_0x2a7ded);_0x247de7(_0x2a7ded);});});}exports[_0x98f6('0x16')]=function(_0x2b585a){var _0x2ea8d4=this;return new Promise(function(_0x48b83c,_0x135b61){return db[_0x98f6('0x17')]['find']({'raw':_0x2b585a['options']?_0x2b585a[_0x98f6('0x18')][_0x98f6('0x19')]===undefined?!![]:![]:!![],'where':_0x2b585a[_0x98f6('0x18')]?_0x2b585a[_0x98f6('0x18')][_0x98f6('0x1a')]||null:null,'attributes':_0x2b585a[_0x98f6('0x18')]?_0x2b585a['options'][_0x98f6('0x1b')]||null:null,'include':_0x2b585a[_0x98f6('0x18')]?_0x2b585a[_0x98f6('0x18')]['include']?_['map'](_0x2b585a[_0x98f6('0x18')][_0x98f6('0x1c')],function(_0x5b1190){return{'model':db[_0x5b1190[_0x98f6('0x1d')]],'as':_0x5b1190['as'],'attributes':_0x5b1190[_0x98f6('0x1b')],'include':_0x5b1190[_0x98f6('0x1c')]?_[_0x98f6('0x1e')](_0x5b1190[_0x98f6('0x1c')],function(_0x2d97a3){return{'model':db[_0x2d97a3[_0x98f6('0x1d')]],'as':_0x2d97a3['as'],'attributes':_0x2d97a3[_0x98f6('0x1b')],'include':_0x2d97a3['include']?_[_0x98f6('0x1e')](_0x2d97a3[_0x98f6('0x1c')],function(_0xff481e){return{'model':db[_0xff481e[_0x98f6('0x1d')]],'as':_0xff481e['as'],'attributes':_0xff481e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d0289){logger['info'](_0x98f6('0x16'),_0x2b585a);logger['debug'](_0x98f6('0x16'),_0x2b585a,JSON[_0x98f6('0x10')](_0x5d0289));_0x48b83c(_0x5d0289);})[_0x98f6('0x15')](function(_0x417e47){logger[_0x98f6('0x11')](_0x98f6('0x16'),_0x417e47[_0x98f6('0x13')],_0x2b585a);_0x135b61(_0x2ea8d4['error'](0x1f4,_0x417e47[_0x98f6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 4649fe8..482beff 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 _0x261a=['index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x1be3b3,_0x4335ee){var _0x4f8b2d=function(_0x1d955f){while(--_0x1d955f){_0x1be3b3['push'](_0x1be3b3['shift']());}};_0x4f8b2d(++_0x4335ee);}(_0x261a,0xb8));var _0xa261=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x261a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa261('0x0'));var timeout=require(_0xa261('0x1'));var express=require(_0xa261('0x2'));var router=express[_0xa261('0x3')]();var fs_extra=require(_0xa261('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa261('0x5'));var controller=require('./plugin.controller');router[_0xa261('0x6')]('/',auth[_0xa261('0x7')](),controller[_0xa261('0x8')]);router[_0xa261('0x6')](_0xa261('0x9'),controller[_0xa261('0xa')]);router['get'](_0xa261('0xb'),auth['isAuthenticated'](),controller[_0xa261('0xc')]);router['get'](_0xa261('0xd'),auth[_0xa261('0x7')](),controller[_0xa261('0xe')]);var upload=multer({'storage':multer[_0xa261('0xf')]({'destination':function(_0x4597ab,_0x5cd530,_0x2acc15){_0x2acc15(null,path['join'](config[_0xa261('0x10')],'server/files/plugins'));},'filename':function(_0xd7a9f8,_0x11b9d9,_0x4d83b6){_0x11b9d9[_0xa261('0x11')]=_0x11b9d9['originalname'][_0xa261('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d83b6(null,util[_0xa261('0x13')](_0xa261('0x14'),path[_0xa261('0x15')](_0x11b9d9['originalname'],path[_0xa261('0x16')](_0x11b9d9[_0xa261('0x11')])),Date[_0xa261('0x17')](),path['extname'](_0x11b9d9[_0xa261('0x11')])));}})});router[_0xa261('0x18')]('/',upload[_0xa261('0x19')](_0xa261('0x1a')),controller[_0xa261('0x1b')]);router[_0xa261('0x18')]('/webhook',controller[_0xa261('0x1c')]);router[_0xa261('0x1d')](_0xa261('0xb'),auth[_0xa261('0x7')](),controller[_0xa261('0x1e')]);router[_0xa261('0x1f')](_0xa261('0xb'),auth[_0xa261('0x7')](),controller[_0xa261('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x5a53=['upload','webhookPost','put','update','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','single','file'];(function(_0x47b6ff,_0xc8344a){var _0x306227=function(_0x35f0e0){while(--_0x35f0e0){_0x47b6ff['push'](_0x47b6ff['shift']());}};_0x306227(++_0xc8344a);}(_0x5a53,0xf6));var _0x35a5=function(_0x42b684,_0x4bd015){_0x42b684=_0x42b684-0x0;var _0x1b2a6=_0x5a53[_0x42b684];return _0x1b2a6;};'use strict';var multer=require('multer');var util=require(_0x35a5('0x0'));var path=require('path');var timeout=require(_0x35a5('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x35a5('0x2'));var interaction=require(_0x35a5('0x3'));var config=require('../../config/environment');var controller=require(_0x35a5('0x4'));router[_0x35a5('0x5')]('/',auth[_0x35a5('0x6')](),controller['index']);router[_0x35a5('0x5')](_0x35a5('0x7'),controller[_0x35a5('0x8')]);router[_0x35a5('0x5')](_0x35a5('0x9'),auth[_0x35a5('0x6')](),controller[_0x35a5('0xa')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x35a5('0xb')]);var upload=multer({'storage':multer[_0x35a5('0xc')]({'destination':function(_0x349024,_0x1b113c,_0x3db9ef){_0x3db9ef(null,path[_0x35a5('0xd')](config[_0x35a5('0xe')],_0x35a5('0xf')));},'filename':function(_0x9082fc,_0x4f1785,_0xcd4f17){_0x4f1785[_0x35a5('0x10')]=_0x4f1785[_0x35a5('0x10')][_0x35a5('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xcd4f17(null,util['format'](_0x35a5('0x12'),path[_0x35a5('0x13')](_0x4f1785[_0x35a5('0x10')],path[_0x35a5('0x14')](_0x4f1785[_0x35a5('0x10')])),Date['now'](),path['extname'](_0x4f1785['originalname'])));}})});router[_0x35a5('0x15')]('/',upload[_0x35a5('0x16')](_0x35a5('0x17')),controller[_0x35a5('0x18')]);router[_0x35a5('0x15')](_0x35a5('0x7'),controller[_0x35a5('0x19')]);router[_0x35a5('0x1a')](_0x35a5('0x9'),auth[_0x35a5('0x6')](),controller[_0x35a5('0x1b')]);router['delete']('/:id',auth[_0x35a5('0x6')](),controller[_0x35a5('0x1c')]);module[_0x35a5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 0abceed..095065d 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 _0x9c48=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9c48,0xb1));var _0x89c4=function(_0x33c02a,_0x45a1e4){_0x33c02a=_0x33c02a-0x0;var _0xce3d6e=_0x9c48[_0x33c02a];return _0xce3d6e;};'use strict';var Sequelize=require(_0x89c4('0x0'));module['exports']={'name':{'type':Sequelize[_0x89c4('0x1')]},'type':{'type':Sequelize[_0x89c4('0x2')](_0x89c4('0x3'),_0x89c4('0x4'))},'description':{'type':Sequelize[_0x89c4('0x5')]},'version':{'type':Sequelize[_0x89c4('0x5')]},'path':{'type':Sequelize[_0x89c4('0x1')],'comment':_0x89c4('0x6')},'active':{'type':Sequelize[_0x89c4('0x7')],'defaultValue':0x0,'comment':_0x89c4('0x8')},'sidebar':{'type':Sequelize[_0x89c4('0x2')](_0x89c4('0x9'),_0x89c4('0xa'),_0x89c4('0xb'),'never'),'defaultValue':_0x89c4('0xb'),'comment':_0x89c4('0xc')},'icon':{'type':Sequelize[_0x89c4('0x1')]},'adminUrl':{'type':Sequelize[_0x89c4('0x1')]},'agentUrl':{'type':Sequelize[_0x89c4('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd2c8=['adminOnly','agentOnly','never','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x5ac696,_0x5c29cf){var _0xd568cd=function(_0xdff965){while(--_0xdff965){_0x5ac696['push'](_0x5ac696['shift']());}};_0xd568cd(++_0x5c29cf);}(_0xd2c8,0x1a5));var _0x8d2c=function(_0x10487f,_0x474af6){_0x10487f=_0x10487f-0x0;var _0x2b5173=_0xd2c8[_0x10487f];return _0x2b5173;};'use strict';var Sequelize=require(_0x8d2c('0x0'));module[_0x8d2c('0x1')]={'name':{'type':Sequelize[_0x8d2c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x8d2c('0x3'),_0x8d2c('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x8d2c('0x5')]},'path':{'type':Sequelize[_0x8d2c('0x2')],'comment':_0x8d2c('0x6')},'active':{'type':Sequelize[_0x8d2c('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x8d2c('0x8'),_0x8d2c('0x9'),'always',_0x8d2c('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x8d2c('0x2')]},'adminUrl':{'type':Sequelize[_0x8d2c('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x8d2c('0x2')]},'scriptPath':{'type':Sequelize[_0x8d2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2534f81..755a46e 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 _0x1a72=['createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','join','path','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','name','undefined','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','UserProfileResource','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','html-pdf','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','end','sendStatus','error','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','download','root','server/files/plugins','format','basename'];(function(_0x4e1528,_0x505cd3){var _0x5ef6b2=function(_0x56f849){while(--_0x56f849){_0x4e1528['push'](_0x4e1528['shift']());}};_0x5ef6b2(++_0x505cd3);}(_0x1a72,0x1b8));var _0x21a7=function(_0xd4b314,_0x3fce9d){_0xd4b314=_0xd4b314-0x0;var _0x429ddf=_0x1a72[_0xd4b314];return _0x429ddf;};'use strict';var pdf=require(_0x21a7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x21a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x21a7('0x2'));var BPromise=require(_0x21a7('0x3'));var Mustache=require(_0x21a7('0x4'));var util=require(_0x21a7('0x5'));var path=require('path');var sox=require(_0x21a7('0x6'));var csv=require(_0x21a7('0x7'));var ejs=require(_0x21a7('0x8'));var fs=require('fs');var fs_extra=require(_0x21a7('0x9'));var _=require(_0x21a7('0xa'));var squel=require(_0x21a7('0xb'));var crypto=require(_0x21a7('0xc'));var jsforce=require(_0x21a7('0xd'));var deskjs=require(_0x21a7('0xe'));var toCsv=require(_0x21a7('0x7'));var querystring=require(_0x21a7('0xf'));var Papa=require(_0x21a7('0x10'));var extract=require(_0x21a7('0x11'));var rimraf=require(_0x21a7('0x1'));var archiver=require('archiver');var Redis=require(_0x21a7('0x12'));var authService=require(_0x21a7('0x13'));var qs=require(_0x21a7('0x14'));var as=require(_0x21a7('0x15'));var hardwareService=require(_0x21a7('0x16'));var logger=require(_0x21a7('0x17'))(_0x21a7('0x18'));var utils=require(_0x21a7('0x19'));var config=require(_0x21a7('0x1a'));var licenseUtil=require(_0x21a7('0x1b'));var db=require(_0x21a7('0x1c'))['db'];config['redis']=_[_0x21a7('0x1d')](config['redis'],{'host':_0x21a7('0x1e'),'port':0x18eb});var socket=require(_0x21a7('0x1f'))(new Redis(config[_0x21a7('0x20')]));require(_0x21a7('0x21'))[_0x21a7('0x22')](socket);function respondWithStatusCode(_0x108220,_0x12fbea){_0x12fbea=_0x12fbea||0xcc;return function(_0x4629b8){if(_0x4629b8){return _0x108220['sendStatus'](_0x12fbea);}return _0x108220['status'](_0x12fbea)['end']();};}function respondWithResult(_0x1acdd8,_0x2b39b7){_0x2b39b7=_0x2b39b7||0xc8;return function(_0x3b2962){if(_0x3b2962){return _0x1acdd8[_0x21a7('0x23')](_0x2b39b7)[_0x21a7('0x24')](_0x3b2962);}};}function respondWithFilteredResult(_0x5a56c7,_0x3b0d78){return function(_0x34aa0c){if(_0x34aa0c){var _0x8d3ad5=_0x34aa0c[_0x21a7('0x25')],_0xa07051=_0x3b0d78['offset'],_0x2cf304=_0x3b0d78['offset']+_0x3b0d78[_0x21a7('0x26')],_0x31013d;if(_0x2cf304>=_0x8d3ad5){_0x2cf304=_0x8d3ad5;_0x31013d=0xc8;}else{_0x31013d=0xce;}_0x5a56c7['status'](_0x31013d);return _0x5a56c7[_0x21a7('0x27')](_0x21a7('0x28'),_0xa07051+'-'+_0x2cf304+'/'+_0x8d3ad5)[_0x21a7('0x24')](_0x34aa0c);}return null;};}function patchUpdates(_0x4f4c26){return function(_0x5ad74f){try{jsonpatch[_0x21a7('0x29')](_0x5ad74f,_0x4f4c26,!![]);}catch(_0x3ed1bf){return BPromise[_0x21a7('0x2a')](_0x3ed1bf);}return _0x5ad74f[_0x21a7('0x2b')]();};}function saveUpdates(_0x2ad124,_0x27c897){return function(_0x327bd7){if(_0x327bd7){return _0x327bd7[_0x21a7('0x2c')](_0x2ad124)[_0x21a7('0x2d')](function(_0x418205){return _0x418205;});}return null;};}function removeEntity(_0xd5e130,_0x13ca81){return function(_0x1eb929){if(_0x1eb929){return _0x1eb929['destroy']()['then'](function(){var _0x3b4e2e=_0x1eb929[_0x21a7('0x2e')]({'plain':!![]});var _0x2cdff9='Plugins';return db['UserProfileResource'][_0x21a7('0x2f')]({'where':{'type':_0x2cdff9,'resourceId':_0x3b4e2e['id']}})['then'](function(){return _0x1eb929;});})[_0x21a7('0x2d')](function(){_0xd5e130['status'](0xcc)[_0x21a7('0x30')]();});}};}function handleEntityNotFound(_0x53b7bc,_0x1f8279){return function(_0x4e8957){if(!_0x4e8957){_0x53b7bc[_0x21a7('0x31')](0x194);}return _0x4e8957;};}function handleError(_0x3b48a9,_0x11177c){_0x11177c=_0x11177c||0x1f4;return function(_0x4d42ea){logger[_0x21a7('0x32')](_0x4d42ea['stack']);if(_0x4d42ea['name']){delete _0x4d42ea['name'];}_0x3b48a9[_0x21a7('0x23')](_0x11177c)[_0x21a7('0x33')](_0x4d42ea);};}exports['index']=function(_0x4e8110,_0x1e0262){var _0x28c341={},_0x15e6c6={},_0x22430c={'count':0x0,'rows':[]};var _0x41ef53=_[_0x21a7('0x34')](db[_0x21a7('0x35')][_0x21a7('0x36')],function(_0x3ba6de){return{'name':_0x3ba6de[_0x21a7('0x37')],'type':_0x3ba6de[_0x21a7('0x38')][_0x21a7('0x39')]};});_0x15e6c6[_0x21a7('0x3a')]=_[_0x21a7('0x34')](_0x41ef53,'name');_0x15e6c6[_0x21a7('0x3b')]=_[_0x21a7('0x3c')](_0x4e8110['query']);_0x15e6c6[_0x21a7('0x3d')]=_[_0x21a7('0x3e')](_0x15e6c6[_0x21a7('0x3a')],_0x15e6c6[_0x21a7('0x3b')]);_0x28c341[_0x21a7('0x3f')]=_[_0x21a7('0x3e')](_0x15e6c6['model'],qs[_0x21a7('0x40')](_0x4e8110[_0x21a7('0x3b')][_0x21a7('0x40')]));_0x28c341['attributes']=_0x28c341[_0x21a7('0x3f')][_0x21a7('0x41')]?_0x28c341['attributes']:_0x15e6c6[_0x21a7('0x3a')];if(!_0x4e8110[_0x21a7('0x3b')][_0x21a7('0x42')]('nolimit')){_0x28c341[_0x21a7('0x26')]=qs[_0x21a7('0x26')](_0x4e8110['query'][_0x21a7('0x26')]);_0x28c341[_0x21a7('0x43')]=qs['offset'](_0x4e8110[_0x21a7('0x3b')][_0x21a7('0x43')]);}_0x28c341['order']=qs[_0x21a7('0x44')](_0x4e8110[_0x21a7('0x3b')][_0x21a7('0x44')]);_0x28c341[_0x21a7('0x45')]=qs[_0x21a7('0x3d')](_[_0x21a7('0x46')](_0x4e8110['query'],_0x15e6c6['filters']),_0x41ef53);if(_0x4e8110[_0x21a7('0x3b')][_0x21a7('0x47')]){_0x28c341['where']=_[_0x21a7('0x48')](_0x28c341['where'],{'$or':_[_0x21a7('0x34')](_0x41ef53,function(_0xdaf82f){if(_0xdaf82f[_0x21a7('0x38')]!==_0x21a7('0x49')){var _0x94fe0f={};_0x94fe0f[_0xdaf82f['name']]={'$like':'%'+_0x4e8110[_0x21a7('0x3b')][_0x21a7('0x47')]+'%'};return _0x94fe0f;}})});}_0x28c341=_[_0x21a7('0x48')]({},_0x28c341,_0x4e8110[_0x21a7('0x4a')]);var _0x17a989={'where':_0x28c341['where']};return db[_0x21a7('0x35')]['count'](_0x17a989)[_0x21a7('0x2d')](function(_0x55c5b7){_0x22430c[_0x21a7('0x25')]=_0x55c5b7;if(_0x4e8110[_0x21a7('0x3b')][_0x21a7('0x4b')]){_0x28c341[_0x21a7('0x4c')]=[{'all':!![]}];}return db['Plugin'][_0x21a7('0x4d')](_0x28c341);})[_0x21a7('0x2d')](function(_0xd78997){_0x22430c[_0x21a7('0x4e')]=_0xd78997;return _0x22430c;})[_0x21a7('0x2d')](respondWithFilteredResult(_0x1e0262,_0x28c341))[_0x21a7('0x4f')](handleError(_0x1e0262,null));};exports[_0x21a7('0x50')]=function(_0x34508f,_0x486b9d){var _0x1f0de9={'raw':!![],'where':{'id':_0x34508f[_0x21a7('0x51')]['id']}},_0xb580ed={};_0xb580ed[_0x21a7('0x3a')]=_['keys'](db['Plugin']['rawAttributes']);_0xb580ed[_0x21a7('0x3b')]=_[_0x21a7('0x3c')](_0x34508f[_0x21a7('0x3b')]);_0xb580ed[_0x21a7('0x3d')]=_[_0x21a7('0x3e')](_0xb580ed[_0x21a7('0x3a')],_0xb580ed[_0x21a7('0x3b')]);_0x1f0de9['attributes']=_[_0x21a7('0x3e')](_0xb580ed['model'],qs[_0x21a7('0x40')](_0x34508f[_0x21a7('0x3b')][_0x21a7('0x40')]));_0x1f0de9['attributes']=_0x1f0de9['attributes'][_0x21a7('0x41')]?_0x1f0de9['attributes']:_0xb580ed['model'];if(_0x34508f[_0x21a7('0x3b')][_0x21a7('0x4b')]){_0x1f0de9[_0x21a7('0x4c')]=[{'all':!![]}];}_0x1f0de9=_[_0x21a7('0x48')]({},_0x1f0de9,_0x34508f[_0x21a7('0x4a')]);return db[_0x21a7('0x35')][_0x21a7('0x52')](_0x1f0de9)[_0x21a7('0x2d')](handleEntityNotFound(_0x486b9d,null))['then'](respondWithResult(_0x486b9d,null))['catch'](handleError(_0x486b9d,null));};exports[_0x21a7('0x53')]=function(_0x2b27cc,_0x2f64ae,_0x97c925){return db[_0x21a7('0x35')][_0x21a7('0x52')]({'where':{'id':_0x2b27cc[_0x21a7('0x51')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0x2f64ae,null))[_0x21a7('0x2d')](function(_0x57fd8b){if(_0x57fd8b){var _0x2a59cd=path['join'](config[_0x21a7('0x54')],_0x21a7('0x55'),util[_0x21a7('0x56')]('%s.zip',path[_0x21a7('0x57')](_0x57fd8b['path'])));var _0x426f71=fs[_0x21a7('0x58')](_0x2a59cd);var _0x103c0b=archiver(_0x21a7('0x59'),{'zlib':{'level':0x9}});_0x103c0b['on'](_0x21a7('0x5a'),function(_0x1f8b39){if(_0x1f8b39[_0x21a7('0x5b')]===_0x21a7('0x5c')){logger['error'](_0x1f8b39);}else{throw new db[(_0x21a7('0x5d'))][(_0x21a7('0x5e'))](_0x21a7('0x5f'));}});_0x103c0b['on'](_0x21a7('0x32'),function(_0x1c868c){throw new db[(_0x21a7('0x5d'))][(_0x21a7('0x5e'))](_0x21a7('0x5f'));});_0x103c0b[_0x21a7('0x60')](_0x426f71);_0x103c0b[_0x21a7('0x61')]('**/*',{'cwd':path[_0x21a7('0x62')](config[_0x21a7('0x54')],_0x21a7('0x55'),path['dirname'](_0x57fd8b['path'])),'ignore':[path['join'](path[_0x21a7('0x57')](_0x57fd8b['path']),'node_modules/**/*'),path[_0x21a7('0x62')](path['basename'](_0x57fd8b[_0x21a7('0x63')]),_0x21a7('0x64'))],'nodir':!![]})[_0x21a7('0x65')]();_0x426f71['on'](_0x21a7('0x66'),function(){if(!fs[_0x21a7('0x67')](_0x2a59cd)){throw new db[(_0x21a7('0x5d'))][(_0x21a7('0x5e'))](_0x21a7('0x68'));}return _0x2f64ae['download'](_0x2a59cd,util[_0x21a7('0x56')]('%s.zip',path[_0x21a7('0x57')](_0x57fd8b[_0x21a7('0x63')])),function(_0x282639){if(_0x282639){throw new db[(_0x21a7('0x5d'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x21a7('0x69')](_0x2a59cd);logger[_0x21a7('0x6a')](_0x21a7('0x6b'));logger[_0x21a7('0x6a')](_0x21a7('0x6c'));});});}return null;})[_0x21a7('0x4f')](handleError(_0x2f64ae,null));};exports[_0x21a7('0x6d')]=function(_0x5c9d90,_0x6e359c,_0x30439d){var _0x22dd79=path[_0x21a7('0x57')](_0x5c9d90['file']['filename'],path[_0x21a7('0x6e')](_0x5c9d90[_0x21a7('0x6f')][_0x21a7('0x70')]));var _0x1544a2=path[_0x21a7('0x62')](config[_0x21a7('0x54')],_0x21a7('0x55'),_0x5c9d90['file'][_0x21a7('0x70')]);var _0x385f37=path[_0x21a7('0x62')](config[_0x21a7('0x54')],'server/files/plugins',_0x22dd79);logger[_0x21a7('0x6a')](_0x21a7('0x71'),_0x1544a2);logger[_0x21a7('0x6a')](_0x21a7('0x72'),_0x385f37);try{fs[_0x21a7('0x73')](_0x1544a2,parseInt(_0x21a7('0x74'),0x8));extract(_0x1544a2,{'dir':_0x385f37},function(_0x5c9600){if(_0x5c9600){logger[_0x21a7('0x32')](_0x5c9600);handleError(_0x5c9600,!![]);};var _0x3f32b2=fs[_0x21a7('0x75')](_0x385f37);if(_0x3f32b2[_0x21a7('0x41')]>0x1){removeReferences(_0x1544a2,_0x385f37);logger[_0x21a7('0x32')](_0x21a7('0x76'));return _0x30439d(new Error(_0x21a7('0x76')));}var _0x24e6d9=fs[_0x21a7('0x77')](path['join'](_0x385f37,_0x3f32b2[0x0]));if(_0x24e6d9[_0x21a7('0x78')]()){removeReferences(_0x1544a2,_0x385f37);logger[_0x21a7('0x32')](_0x21a7('0x76'));return _0x30439d(new Error(_0x21a7('0x76')));}if(_0x24e6d9[_0x21a7('0x79')]()){var _0x490dd0=fs[_0x21a7('0x75')](path[_0x21a7('0x62')](_0x385f37,_0x3f32b2[0x0]));if(_0x490dd0[_0x21a7('0x41')]===0x0){removeReferences(_0x1544a2,_0x385f37);logger[_0x21a7('0x32')]('Invalid\x20plugin\x20structure');return _0x30439d(new Error(_0x21a7('0x76')));}var _0xe30013=_0x490dd0[_0x21a7('0x7a')](function(_0x2cd1ed){return _0x2cd1ed===_0x21a7('0x7b');});if(!_0xe30013){return _0x30439d(new Error(_0x21a7('0x7c')));}var _0x16c0fd=fs[_0x21a7('0x7d')](path[_0x21a7('0x62')](_0x385f37,_0x3f32b2[0x0],_0x21a7('0x7b')));var _0x478f16=JSON[_0x21a7('0x7e')](_0x16c0fd);if('undefined'==typeof _0x478f16[_0x21a7('0x7f')]){return _0x30439d(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x21a7('0x80')==typeof _0x478f16[_0x21a7('0x38')]){return _0x30439d(new Error(_0x21a7('0x81')));}if(_0x21a7('0x80')==typeof _0x478f16[_0x21a7('0x82')]){return _0x30439d(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x478f16[_0x21a7('0x83')]){return _0x30439d(new Error(_0x21a7('0x84')));}if(_0x478f16['type']===_0x21a7('0x85')){if(_0x21a7('0x80')==typeof _0x478f16[_0x21a7('0x83')]['views']){return _0x30439d(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x478f16[_0x21a7('0x83')][_0x21a7('0x86')][_0x21a7('0x87')]&&_0x21a7('0x80')==typeof _0x478f16[_0x21a7('0x83')][_0x21a7('0x86')]['agent']){return _0x30439d(new Error(_0x21a7('0x88')));}}else if(_0x478f16['type']==='script'){if(_0x21a7('0x80')==typeof _0x478f16[_0x21a7('0x83')][_0x21a7('0x89')]){return _0x30439d(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x21a7('0x80')==typeof _0x478f16['parameters'][_0x21a7('0x8a')]){return _0x30439d(new Error(_0x21a7('0x8b')));}}else{return _0x30439d(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x20b7c2=_0x478f16[_0x21a7('0x7f')];var _0x4bafe9=_0x478f16[_0x21a7('0x8c')];var _0x17f8b9=_0x478f16[_0x21a7('0x38')];var _0x3e8084=_0x478f16[_0x21a7('0x8d')]?_0x478f16[_0x21a7('0x8d')]:'always';var _0x2984ac=_0x478f16[_0x21a7('0x8e')]?_0x478f16[_0x21a7('0x8e')]:_0x21a7('0x8f');var _0x57992a='';var _0x1b7e1a='';var _0x4448f0='';var _0x24dce0='';var _0xd39f94=_0x478f16['version'];if(_0x17f8b9===_0x21a7('0x85')){if('undefined'!=typeof _0x478f16['parameters'][_0x21a7('0x86')][_0x21a7('0x87')]){var _0x481a94=_0x478f16[_0x21a7('0x83')][_0x21a7('0x86')][_0x21a7('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x21a7('0x90')](_0x481a94)){_0x57992a=path[_0x21a7('0x62')](_0x21a7('0x91'),_0x22dd79,_0x3f32b2[0x0],_0x481a94);}else{_0x57992a=_0x481a94;}}else{logger[_0x21a7('0x6a')](_0x21a7('0x92'));}if(_0x21a7('0x80')!=typeof _0x478f16[_0x21a7('0x83')][_0x21a7('0x86')][_0x21a7('0x93')]){var _0x430138=_0x478f16['parameters'][_0x21a7('0x86')][_0x21a7('0x93')];if(!/^(f|ht)tps?:\/\//i[_0x21a7('0x90')](_0x430138)){_0x1b7e1a=path[_0x21a7('0x62')](_0x21a7('0x91'),_0x22dd79,_0x3f32b2[0x0],_0x430138);}else{_0x1b7e1a=_0x430138;}}else{logger[_0x21a7('0x6a')](_0x21a7('0x94'));}}else if(_0x17f8b9===_0x21a7('0x95')){_0x4448f0=_0x478f16[_0x21a7('0x83')][_0x21a7('0x89')];_0x24dce0=_0x478f16[_0x21a7('0x83')][_0x21a7('0x8a')];if('undefined'!=typeof _0x478f16['parameters'][_0x21a7('0x86')]){if(_0x21a7('0x80')!=typeof _0x478f16[_0x21a7('0x83')]['views'][_0x21a7('0x87')]){var _0x481a94=_0x478f16[_0x21a7('0x83')][_0x21a7('0x86')][_0x21a7('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x481a94)){_0x57992a=path[_0x21a7('0x62')](_0x21a7('0x91'),_0x22dd79,_0x3f32b2[0x0],_0x481a94);}else{_0x57992a=_0x481a94;}}if(_0x21a7('0x80')!=typeof _0x478f16[_0x21a7('0x83')][_0x21a7('0x86')][_0x21a7('0x93')]){var _0x430138=_0x478f16[_0x21a7('0x83')][_0x21a7('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x21a7('0x90')](_0x430138)){_0x1b7e1a=path[_0x21a7('0x62')](_0x21a7('0x91'),_0x22dd79,_0x3f32b2[0x0],_0x430138);}else{_0x1b7e1a=_0x430138;}}}}var _0xaea5d9={'name':_0x20b7c2,'description':_0x4bafe9,'path':path['join'](_0x22dd79,_0x3f32b2[0x0]),'type':_0x17f8b9,'sidebar':_0x3e8084,'icon':_0x2984ac,'adminUrl':_0x57992a,'agentUrl':_0x1b7e1a,'scriptName':_0x4448f0,'scriptPath':_0x24dce0,'version':_0xd39f94};removeReferences(_0x1544a2,null);return db[_0x21a7('0x35')][_0x21a7('0x96')](_0xaea5d9)[_0x21a7('0x2d')](function(_0x96523){var _0x30cd64={'role':_0x5c9d90[_0x21a7('0x97')][_0x21a7('0x98')],'userProfileId':_0x5c9d90['body'][_0x21a7('0x99')]};if(!_0x30cd64)throw new Error(_0x21a7('0x9a'));if(_0x30cd64[_0x21a7('0x98')]==='user'){var _0x320835=_0x96523[_0x21a7('0x2e')]({'plain':!![]});return db[_0x21a7('0x9b')][_0x21a7('0x52')]({'where':{'name':_0x21a7('0x9c'),'userProfileId':_0x30cd64['userProfileId']},'raw':!![]})[_0x21a7('0x2d')](function(_0x4a9137){if(_0x4a9137&&_0x4a9137['autoAssociation']===0x0){return db[_0x21a7('0x9d')][_0x21a7('0x96')]({'name':_0x320835[_0x21a7('0x7f')],'resourceId':_0x320835['id'],'type':_0x4a9137[_0x21a7('0x7f')],'sectionId':_0x4a9137['id']},{})[_0x21a7('0x2d')](function(){return _0x96523;});}else{return _0x96523;}})[_0x21a7('0x4f')](function(_0x4121ec){logger[_0x21a7('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4121ec);throw _0x4121ec;});}return _0x96523;})[_0x21a7('0x2d')](respondWithResult(_0x6e359c,null))[_0x21a7('0x4f')](handleError(_0x6e359c,null));}});}catch(_0x4f2c12){_0x6e359c[_0x21a7('0x23')](0x1f4)[_0x21a7('0x33')](_0x4f2c12);}};function removeReferences(_0x1d0d22,_0x559fe0){try{if(_0x1d0d22){fs['unlinkSync'](_0x1d0d22);logger[_0x21a7('0x6a')](_0x21a7('0x9e'));}if(_0x559fe0){rimraf(_0x559fe0,function(){});logger[_0x21a7('0x6a')](_0x21a7('0x9f'));}}catch(_0x569517){logger[_0x21a7('0x32')](_0x569517);}}exports['update']=function(_0x5ccda8,_0x18b832,_0x4c8406){return db[_0x21a7('0x35')][_0x21a7('0x52')]({'where':{'id':_0x5ccda8[_0x21a7('0x51')]['id']}})[_0x21a7('0x2d')](handleEntityNotFound(_0x18b832,null))[_0x21a7('0x2d')](saveUpdates(_0x5ccda8[_0x21a7('0x97')],null))['then'](respondWithResult(_0x18b832,null))['catch'](handleError(_0x18b832,null));};exports[_0x21a7('0xa0')]=function(_0x4d55c0,_0x139f35,_0x2c4473){return db[_0x21a7('0x35')]['find']({'where':{'id':_0x4d55c0[_0x21a7('0x51')]['id']}})[_0x21a7('0x2d')](function(_0x123ad8){if(_0x123ad8){return _0x123ad8[_0x21a7('0x2f')]();}})['then'](function(_0x442325){rimraf(path['join'](config[_0x21a7('0x54')],_0x21a7('0x55'),path['dirname'](_0x442325['path'])),function(){});return _0x442325;})[_0x21a7('0x2d')](handleEntityNotFound(_0x139f35,null))[_0x21a7('0x2d')](respondWithStatusCode(_0x139f35,null))[_0x21a7('0x4f')](handleError(_0x139f35,null));};exports[_0x21a7('0xa1')]=function(_0x3f6754,_0x2dc22e,_0x203b9d){return BPromise[_0x21a7('0xa2')]()['then'](function(){if(!_0x3f6754[_0x21a7('0x3b')][_0x21a7('0x63')]){throw new Error(_0x21a7('0xa3'));}if(!_0x3f6754['query'][_0x21a7('0xa4')]){throw new Error(_0x21a7('0xa5'));}var _0x4845eb=_0x3f6754[_0x21a7('0x3b')][_0x21a7('0xa6')]?_0x3f6754[_0x21a7('0x3b')][_0x21a7('0xa6')]+':'+_0x3f6754[_0x21a7('0x3b')][_0x21a7('0xa4')]:_0x21a7('0xa7')+_0x3f6754['query'][_0x21a7('0xa4')];var _0x2124da=_0x3f6754['query']['json']?_0x3f6754[_0x21a7('0x3b')][_0x21a7('0x24')]:!![];var _0x26e559=_0x3f6754[_0x21a7('0x3b')][_0x21a7('0xa8')]?_0x3f6754['query'][_0x21a7('0xa8')]:null;var _0x2cc90c={'method':_0x3f6754['method'],'uri':util[_0x21a7('0x56')](_0x21a7('0xa9'),_0x4845eb,_0x3f6754[_0x21a7('0x3b')][_0x21a7('0x63')]),'json':_0x2124da,'resolveWithFullResponse':!![],'encoding':_0x26e559,'qs':_0x3f6754[_0x21a7('0x3b')]};if(_0x3f6754[_0x21a7('0xaa')]){_0x2cc90c['headers']=_0x3f6754[_0x21a7('0xaa')];if(_0x2cc90c[_0x21a7('0xaa')][_0x21a7('0xab')]){delete _0x2cc90c[_0x21a7('0xaa')][_0x21a7('0xab')];}}if(_0x2cc90c['headers'][_0x21a7('0xac')]){delete _0x2cc90c[_0x21a7('0xaa')]['content-type'];}return rp(_0x2cc90c);})[_0x21a7('0x2d')](function(_0x98d8c2){if(_0x98d8c2){_0x2dc22e[_0x21a7('0x27')](_0x98d8c2[_0x21a7('0xaa')]);logger[_0x21a7('0x6a')](_0x98d8c2['body']);if(_[_0x21a7('0xad')](_0x3f6754[_0x21a7('0x3b')][_0x21a7('0x63')],_0x21a7('0x53'))&&_0x98d8c2[_0x21a7('0xae')]==0x1f4){return _0x2dc22e[_0x21a7('0x31')](_0x98d8c2['statusCode']);}else{return _0x2dc22e[_0x21a7('0x23')](_0x98d8c2[_0x21a7('0xae')])[_0x21a7('0x33')](_0x98d8c2['body']);}}else{return _0x2dc22e[_0x21a7('0x31')](0xc8);}})['catch'](handleError(_0x2dc22e,null));};exports[_0x21a7('0xaf')]=function(_0x599c1f,_0x4241a8,_0x13e0d1){return BPromise[_0x21a7('0xa2')]()[_0x21a7('0x2d')](function(){if(!_0x599c1f[_0x21a7('0x3b')][_0x21a7('0x63')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x599c1f['query'][_0x21a7('0xa4')]){throw new Error(_0x21a7('0xa5'));}var _0xd257ad=_0x599c1f[_0x21a7('0x3b')][_0x21a7('0xa6')]?_0x599c1f[_0x21a7('0x3b')][_0x21a7('0xa6')]+':'+_0x599c1f[_0x21a7('0x3b')][_0x21a7('0xa4')]:_0x21a7('0xa7')+_0x599c1f[_0x21a7('0x3b')][_0x21a7('0xa4')];var _0x25fa59=_0x599c1f[_0x21a7('0x3b')][_0x21a7('0x24')]?_0x599c1f[_0x21a7('0x3b')]['json']:!![];var _0x969092=_0x599c1f['query']['encoding']?_0x599c1f[_0x21a7('0x3b')]['encoding']:null;var _0x502290={'method':_0x599c1f['method'],'uri':util[_0x21a7('0x56')]('%s%s',_0xd257ad,_0x599c1f[_0x21a7('0x3b')][_0x21a7('0x63')]),'json':_0x25fa59,'resolveWithFullResponse':!![],'encoding':_0x969092,'body':_0x599c1f[_0x21a7('0x97')]};if(_0x599c1f[_0x21a7('0xaa')]){_0x502290[_0x21a7('0xaa')]=_0x599c1f[_0x21a7('0xaa')];if(_0x502290[_0x21a7('0xaa')]['content-length']){delete _0x502290[_0x21a7('0xaa')][_0x21a7('0xab')];}}if(_0x502290[_0x21a7('0xaa')][_0x21a7('0xac')]){delete _0x502290[_0x21a7('0xaa')]['content-type'];}return rp(_0x502290);})[_0x21a7('0x2d')](function(_0x3e1dc1){if(_0x3e1dc1){_0x4241a8[_0x21a7('0x27')](_0x3e1dc1['headers']);logger['info'](_0x3e1dc1[_0x21a7('0x97')]);return _0x4241a8[_0x21a7('0x23')](_0x3e1dc1[_0x21a7('0xae')])['send'](_0x3e1dc1[_0x21a7('0x97')]);}else{return _0x4241a8['sendStatus'](0xc8);}})[_0x21a7('0x4f')](handleError(_0x4241a8,null));}; \ No newline at end of file +var _0x9404=['include','rows','catch','show','params','merge','download','join','format','%s.zip','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','server/files/plugins','dirname','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptPath','test','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Plugins','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','rimraf','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','end','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','count','includeAll'];(function(_0x160893,_0xf5583d){var _0x2ade9e=function(_0x38d6de){while(--_0x38d6de){_0x160893['push'](_0x160893['shift']());}};_0x2ade9e(++_0xf5583d);}(_0x9404,0x10e));var _0x4940=function(_0x25febb,_0x5514c9){_0x25febb=_0x25febb-0x0;var _0x3ac976=_0x9404[_0x25febb];return _0x3ac976;};'use strict';var pdf=require(_0x4940('0x0'));var emlformat=require(_0x4940('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4940('0x2'));var rp=require(_0x4940('0x3'));var moment=require(_0x4940('0x4'));var BPromise=require(_0x4940('0x5'));var Mustache=require(_0x4940('0x6'));var util=require(_0x4940('0x7'));var path=require(_0x4940('0x8'));var sox=require(_0x4940('0x9'));var csv=require('to-csv');var ejs=require(_0x4940('0xa'));var fs=require('fs');var fs_extra=require(_0x4940('0xb'));var _=require(_0x4940('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4940('0xd'));var toCsv=require(_0x4940('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x4940('0xf'));var archiver=require(_0x4940('0x10'));var Redis=require(_0x4940('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4940('0x12'));var as=require(_0x4940('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4940('0x14'))('api');var utils=require(_0x4940('0x15'));var config=require(_0x4940('0x16'));var licenseUtil=require(_0x4940('0x17'));var db=require(_0x4940('0x18'))['db'];config[_0x4940('0x19')]=_[_0x4940('0x1a')](config[_0x4940('0x19')],{'host':_0x4940('0x1b'),'port':0x18eb});var socket=require(_0x4940('0x1c'))(new Redis(config[_0x4940('0x19')]));require(_0x4940('0x1d'))[_0x4940('0x1e')](socket);function respondWithStatusCode(_0x7e0867,_0x1b0581){_0x1b0581=_0x1b0581||0xcc;return function(_0x1cb412){if(_0x1cb412){return _0x7e0867['sendStatus'](_0x1b0581);}return _0x7e0867['status'](_0x1b0581)[_0x4940('0x1f')]();};}function respondWithResult(_0x11e835,_0x98b946){_0x98b946=_0x98b946||0xc8;return function(_0x4b9e57){if(_0x4b9e57){return _0x11e835['status'](_0x98b946)[_0x4940('0x20')](_0x4b9e57);}};}function respondWithFilteredResult(_0x13cf5b,_0x22b7fd){return function(_0x1dc14e){if(_0x1dc14e){var _0xeb0bfc=_0x1dc14e['count'],_0x2d348e=_0x22b7fd[_0x4940('0x21')],_0x36a199=_0x22b7fd['offset']+_0x22b7fd[_0x4940('0x22')],_0x3d828f;if(_0x36a199>=_0xeb0bfc){_0x36a199=_0xeb0bfc;_0x3d828f=0xc8;}else{_0x3d828f=0xce;}_0x13cf5b[_0x4940('0x23')](_0x3d828f);return _0x13cf5b[_0x4940('0x24')](_0x4940('0x25'),_0x2d348e+'-'+_0x36a199+'/'+_0xeb0bfc)[_0x4940('0x20')](_0x1dc14e);}return null;};}function patchUpdates(_0x5265a4){return function(_0xdcc546){try{jsonpatch[_0x4940('0x26')](_0xdcc546,_0x5265a4,!![]);}catch(_0x1dcab7){return BPromise[_0x4940('0x27')](_0x1dcab7);}return _0xdcc546['save']();};}function saveUpdates(_0x22beec,_0x491a4f){return function(_0x469e0c){if(_0x469e0c){return _0x469e0c[_0x4940('0x28')](_0x22beec)['then'](function(_0x3b0eaf){return _0x3b0eaf;});}return null;};}function removeEntity(_0x142aa6,_0x289886){return function(_0x558546){if(_0x558546){return _0x558546['destroy']()[_0x4940('0x29')](function(){var _0x21d00a=_0x558546['get']({'plain':!![]});var _0x33327b='Plugins';return db['UserProfileResource'][_0x4940('0x2a')]({'where':{'type':_0x33327b,'resourceId':_0x21d00a['id']}})[_0x4940('0x29')](function(){return _0x558546;});})[_0x4940('0x29')](function(){_0x142aa6[_0x4940('0x23')](0xcc)[_0x4940('0x1f')]();});}};}function handleEntityNotFound(_0x54a3db,_0x1cd61e){return function(_0x183f5e){if(!_0x183f5e){_0x54a3db[_0x4940('0x2b')](0x194);}return _0x183f5e;};}function handleError(_0x1ea141,_0x3f0c53){_0x3f0c53=_0x3f0c53||0x1f4;return function(_0x3b71d6){logger[_0x4940('0x2c')](_0x3b71d6[_0x4940('0x2d')]);if(_0x3b71d6[_0x4940('0x2e')]){delete _0x3b71d6['name'];}_0x1ea141['status'](_0x3f0c53)[_0x4940('0x2f')](_0x3b71d6);};}exports[_0x4940('0x30')]=function(_0x8cfa26,_0x11374c){var _0x5782d6={},_0x10a5a5={},_0x4864cd={'count':0x0,'rows':[]};var _0xc6c82=_[_0x4940('0x31')](db[_0x4940('0x32')][_0x4940('0x33')],function(_0x3a8034){return{'name':_0x3a8034['fieldName'],'type':_0x3a8034['type'][_0x4940('0x34')]};});_0x10a5a5[_0x4940('0x35')]=_[_0x4940('0x31')](_0xc6c82,'name');_0x10a5a5[_0x4940('0x36')]=_[_0x4940('0x37')](_0x8cfa26[_0x4940('0x36')]);_0x10a5a5[_0x4940('0x38')]=_['intersection'](_0x10a5a5[_0x4940('0x35')],_0x10a5a5['query']);_0x5782d6['attributes']=_[_0x4940('0x39')](_0x10a5a5[_0x4940('0x35')],qs[_0x4940('0x3a')](_0x8cfa26[_0x4940('0x36')][_0x4940('0x3a')]));_0x5782d6['attributes']=_0x5782d6[_0x4940('0x3b')][_0x4940('0x3c')]?_0x5782d6[_0x4940('0x3b')]:_0x10a5a5[_0x4940('0x35')];if(!_0x8cfa26['query'][_0x4940('0x3d')](_0x4940('0x3e'))){_0x5782d6[_0x4940('0x22')]=qs[_0x4940('0x22')](_0x8cfa26[_0x4940('0x36')][_0x4940('0x22')]);_0x5782d6['offset']=qs[_0x4940('0x21')](_0x8cfa26[_0x4940('0x36')][_0x4940('0x21')]);}_0x5782d6['order']=qs[_0x4940('0x3f')](_0x8cfa26[_0x4940('0x36')][_0x4940('0x3f')]);_0x5782d6[_0x4940('0x40')]=qs['filters'](_[_0x4940('0x41')](_0x8cfa26[_0x4940('0x36')],_0x10a5a5[_0x4940('0x38')]),_0xc6c82);if(_0x8cfa26[_0x4940('0x36')][_0x4940('0x42')]){_0x5782d6[_0x4940('0x40')]=_['merge'](_0x5782d6[_0x4940('0x40')],{'$or':_[_0x4940('0x31')](_0xc6c82,function(_0x699e91){if(_0x699e91[_0x4940('0x43')]!==_0x4940('0x44')){var _0x11f143={};_0x11f143[_0x699e91[_0x4940('0x2e')]]={'$like':'%'+_0x8cfa26[_0x4940('0x36')][_0x4940('0x42')]+'%'};return _0x11f143;}})});}_0x5782d6=_['merge']({},_0x5782d6,_0x8cfa26[_0x4940('0x45')]);var _0x372342={'where':_0x5782d6[_0x4940('0x40')]};return db['Plugin'][_0x4940('0x46')](_0x372342)['then'](function(_0x1d09fd){_0x4864cd[_0x4940('0x46')]=_0x1d09fd;if(_0x8cfa26[_0x4940('0x36')][_0x4940('0x47')]){_0x5782d6[_0x4940('0x48')]=[{'all':!![]}];}return db[_0x4940('0x32')]['findAll'](_0x5782d6);})[_0x4940('0x29')](function(_0x162950){_0x4864cd[_0x4940('0x49')]=_0x162950;return _0x4864cd;})[_0x4940('0x29')](respondWithFilteredResult(_0x11374c,_0x5782d6))[_0x4940('0x4a')](handleError(_0x11374c,null));};exports[_0x4940('0x4b')]=function(_0x5791c5,_0x8e1720){var _0x27b114={'raw':!![],'where':{'id':_0x5791c5[_0x4940('0x4c')]['id']}},_0x5557c5={};_0x5557c5[_0x4940('0x35')]=_[_0x4940('0x37')](db[_0x4940('0x32')][_0x4940('0x33')]);_0x5557c5[_0x4940('0x36')]=_['keys'](_0x5791c5[_0x4940('0x36')]);_0x5557c5[_0x4940('0x38')]=_[_0x4940('0x39')](_0x5557c5['model'],_0x5557c5[_0x4940('0x36')]);_0x27b114[_0x4940('0x3b')]=_[_0x4940('0x39')](_0x5557c5[_0x4940('0x35')],qs[_0x4940('0x3a')](_0x5791c5[_0x4940('0x36')][_0x4940('0x3a')]));_0x27b114[_0x4940('0x3b')]=_0x27b114['attributes'][_0x4940('0x3c')]?_0x27b114[_0x4940('0x3b')]:_0x5557c5['model'];if(_0x5791c5[_0x4940('0x36')][_0x4940('0x47')]){_0x27b114[_0x4940('0x48')]=[{'all':!![]}];}_0x27b114=_[_0x4940('0x4d')]({},_0x27b114,_0x5791c5[_0x4940('0x45')]);return db[_0x4940('0x32')]['find'](_0x27b114)[_0x4940('0x29')](handleEntityNotFound(_0x8e1720,null))[_0x4940('0x29')](respondWithResult(_0x8e1720,null))[_0x4940('0x4a')](handleError(_0x8e1720,null));};exports[_0x4940('0x4e')]=function(_0x49c4b0,_0xb6196,_0x55aa7e){return db[_0x4940('0x32')]['find']({'where':{'id':_0x49c4b0[_0x4940('0x4c')]['id']},'attributes':[_0x4940('0x2e'),_0x4940('0x8')],'raw':!![]})[_0x4940('0x29')](handleEntityNotFound(_0xb6196,null))[_0x4940('0x29')](function(_0x362630){if(_0x362630){var _0x2ae962=path[_0x4940('0x4f')](config['root'],'server/files/plugins',util[_0x4940('0x50')](_0x4940('0x51'),path['basename'](_0x362630[_0x4940('0x8')])));var _0x948e40=fs['createWriteStream'](_0x2ae962);var _0x30c19d=archiver(_0x4940('0x52'),{'zlib':{'level':0x9}});_0x30c19d['on']('warning',function(_0x41368f){if(_0x41368f[_0x4940('0x53')]==='ENOENT'){logger[_0x4940('0x2c')](_0x41368f);}else{throw new db[(_0x4940('0x54'))][(_0x4940('0x55'))](_0x4940('0x56'));}});_0x30c19d['on'](_0x4940('0x2c'),function(_0x1f3d1c){throw new db[(_0x4940('0x54'))]['Error'](_0x4940('0x56'));});_0x30c19d[_0x4940('0x57')](_0x948e40);_0x30c19d[_0x4940('0x58')](_0x4940('0x59'),{'cwd':path[_0x4940('0x4f')](config[_0x4940('0x5a')],_0x4940('0x5b'),path[_0x4940('0x5c')](_0x362630[_0x4940('0x8')])),'ignore':[path[_0x4940('0x4f')](path[_0x4940('0x5d')](_0x362630[_0x4940('0x8')]),'node_modules/**/*'),path['join'](path[_0x4940('0x5d')](_0x362630[_0x4940('0x8')]),_0x4940('0x5e'))],'nodir':!![]})[_0x4940('0x5f')]();_0x948e40['on'](_0x4940('0x60'),function(){if(!fs[_0x4940('0x61')](_0x2ae962)){throw new db[(_0x4940('0x54'))][(_0x4940('0x55'))](_0x4940('0x62'));}return _0xb6196[_0x4940('0x4e')](_0x2ae962,util[_0x4940('0x50')]('%s.zip',path[_0x4940('0x5d')](_0x362630[_0x4940('0x8')])),function(_0x3e9f3a){if(_0x3e9f3a){throw new db[(_0x4940('0x54'))][(_0x4940('0x55'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x4940('0x63')](_0x2ae962);logger[_0x4940('0x64')](_0x4940('0x65'));logger[_0x4940('0x64')]('Temporary\x20file\x20removed');});});}return null;})[_0x4940('0x4a')](handleError(_0xb6196,null));};exports[_0x4940('0x66')]=function(_0x595716,_0x5b97fb,_0x44f6f6){var _0x1f8a58=path['basename'](_0x595716[_0x4940('0x67')][_0x4940('0x68')],path[_0x4940('0x69')](_0x595716[_0x4940('0x67')][_0x4940('0x68')]));var _0x214ad7=path[_0x4940('0x4f')](config[_0x4940('0x5a')],_0x4940('0x5b'),_0x595716[_0x4940('0x67')]['filename']);var _0x29c2ea=path['join'](config[_0x4940('0x5a')],'server/files/plugins',_0x1f8a58);logger[_0x4940('0x64')](_0x4940('0x6a'),_0x214ad7);logger[_0x4940('0x64')](_0x4940('0x6b'),_0x29c2ea);try{fs[_0x4940('0x6c')](_0x214ad7,parseInt(_0x4940('0x6d'),0x8));extract(_0x214ad7,{'dir':_0x29c2ea},function(_0x44ef79){if(_0x44ef79){logger[_0x4940('0x2c')](_0x44ef79);handleError(_0x44ef79,!![]);};var _0xbd0989=fs[_0x4940('0x6e')](_0x29c2ea);if(_0xbd0989[_0x4940('0x3c')]>0x1){removeReferences(_0x214ad7,_0x29c2ea);logger[_0x4940('0x2c')](_0x4940('0x6f'));return _0x44f6f6(new Error(_0x4940('0x6f')));}var _0xfdccec=fs[_0x4940('0x70')](path['join'](_0x29c2ea,_0xbd0989[0x0]));if(_0xfdccec[_0x4940('0x71')]()){removeReferences(_0x214ad7,_0x29c2ea);logger['error'](_0x4940('0x6f'));return _0x44f6f6(new Error(_0x4940('0x6f')));}if(_0xfdccec['isDirectory']()){var _0x44dad1=fs['readdirSync'](path['join'](_0x29c2ea,_0xbd0989[0x0]));if(_0x44dad1[_0x4940('0x3c')]===0x0){removeReferences(_0x214ad7,_0x29c2ea);logger[_0x4940('0x2c')](_0x4940('0x6f'));return _0x44f6f6(new Error(_0x4940('0x6f')));}var _0x450c1e=_0x44dad1[_0x4940('0x72')](function(_0x1bb188){return _0x1bb188==='manifest.json';});if(!_0x450c1e){return _0x44f6f6(new Error(_0x4940('0x73')));}var _0x3fcca7=fs[_0x4940('0x74')](path[_0x4940('0x4f')](_0x29c2ea,_0xbd0989[0x0],'manifest.json'));var _0x2f56fa=JSON[_0x4940('0x75')](_0x3fcca7);if('undefined'==typeof _0x2f56fa[_0x4940('0x2e')]){return _0x44f6f6(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x4940('0x76')==typeof _0x2f56fa['type']){return _0x44f6f6(new Error(_0x4940('0x77')));}if(_0x4940('0x76')==typeof _0x2f56fa['version']){return _0x44f6f6(new Error(_0x4940('0x78')));}if(_0x4940('0x76')==typeof _0x2f56fa[_0x4940('0x79')]){return _0x44f6f6(new Error(_0x4940('0x7a')));}if(_0x2f56fa['type']===_0x4940('0x7b')){if(_0x4940('0x76')==typeof _0x2f56fa['parameters']['views']){return _0x44f6f6(new Error(_0x4940('0x7c')));}if(_0x4940('0x76')==typeof _0x2f56fa[_0x4940('0x79')][_0x4940('0x7d')][_0x4940('0x7e')]&&'undefined'==typeof _0x2f56fa[_0x4940('0x79')][_0x4940('0x7d')][_0x4940('0x7f')]){return _0x44f6f6(new Error(_0x4940('0x80')));}}else if(_0x2f56fa[_0x4940('0x43')]===_0x4940('0x81')){if(_0x4940('0x76')==typeof _0x2f56fa['parameters'][_0x4940('0x82')]){return _0x44f6f6(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x2f56fa[_0x4940('0x79')]['scriptPath']){return _0x44f6f6(new Error(_0x4940('0x83')));}}else{return _0x44f6f6(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4b4708=_0x2f56fa[_0x4940('0x2e')];var _0x3dc892=_0x2f56fa['description'];var _0x30fc5d=_0x2f56fa[_0x4940('0x43')];var _0x3ade81=_0x2f56fa['sidebar']?_0x2f56fa[_0x4940('0x84')]:_0x4940('0x85');var _0x5b0cbd=_0x2f56fa[_0x4940('0x86')]?_0x2f56fa[_0x4940('0x86')]:_0x4940('0x87');var _0xc9733e='';var _0x321dcc='';var _0xd08e03='';var _0x25391b='';var _0x5af6c2=_0x2f56fa[_0x4940('0x88')];if(_0x30fc5d==='html'){if(_0x4940('0x76')!=typeof _0x2f56fa[_0x4940('0x79')][_0x4940('0x7d')][_0x4940('0x7e')]){var _0x2be13c=_0x2f56fa[_0x4940('0x79')][_0x4940('0x7d')][_0x4940('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2be13c)){_0xc9733e=path[_0x4940('0x4f')](_0x4940('0x89'),_0x1f8a58,_0xbd0989[0x0],_0x2be13c);}else{_0xc9733e=_0x2be13c;}}else{logger['info'](_0x4940('0x8a'));}if(_0x4940('0x76')!=typeof _0x2f56fa['parameters'][_0x4940('0x7d')][_0x4940('0x7f')]){var _0x135f3c=_0x2f56fa[_0x4940('0x79')][_0x4940('0x7d')][_0x4940('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x135f3c)){_0x321dcc=path['join'](_0x4940('0x89'),_0x1f8a58,_0xbd0989[0x0],_0x135f3c);}else{_0x321dcc=_0x135f3c;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x30fc5d===_0x4940('0x81')){_0xd08e03=_0x2f56fa[_0x4940('0x79')]['scriptName'];_0x25391b=_0x2f56fa[_0x4940('0x79')][_0x4940('0x8b')];if(_0x4940('0x76')!=typeof _0x2f56fa['parameters'][_0x4940('0x7d')]){if(_0x4940('0x76')!=typeof _0x2f56fa[_0x4940('0x79')][_0x4940('0x7d')]['admin']){var _0x2be13c=_0x2f56fa[_0x4940('0x79')][_0x4940('0x7d')][_0x4940('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x4940('0x8c')](_0x2be13c)){_0xc9733e=path[_0x4940('0x4f')](_0x4940('0x89'),_0x1f8a58,_0xbd0989[0x0],_0x2be13c);}else{_0xc9733e=_0x2be13c;}}if('undefined'!=typeof _0x2f56fa['parameters'][_0x4940('0x7d')][_0x4940('0x7f')]){var _0x135f3c=_0x2f56fa[_0x4940('0x79')][_0x4940('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4940('0x8c')](_0x135f3c)){_0x321dcc=path[_0x4940('0x4f')](_0x4940('0x89'),_0x1f8a58,_0xbd0989[0x0],_0x135f3c);}else{_0x321dcc=_0x135f3c;}}}}var _0x3cea15={'name':_0x4b4708,'description':_0x3dc892,'path':path[_0x4940('0x4f')](_0x1f8a58,_0xbd0989[0x0]),'type':_0x30fc5d,'sidebar':_0x3ade81,'icon':_0x5b0cbd,'adminUrl':_0xc9733e,'agentUrl':_0x321dcc,'scriptName':_0xd08e03,'scriptPath':_0x25391b,'version':_0x5af6c2};removeReferences(_0x214ad7,null);return db[_0x4940('0x32')][_0x4940('0x8d')](_0x3cea15)['then'](function(_0x1a72f8){var _0x5c4128={'role':_0x595716[_0x4940('0x8e')][_0x4940('0x8f')],'userProfileId':_0x595716['body'][_0x4940('0x90')]};if(!_0x5c4128)throw new Error(_0x4940('0x91'));if(_0x5c4128['role']===_0x4940('0x92')){var _0x856dde=_0x1a72f8[_0x4940('0x93')]({'plain':!![]});return db[_0x4940('0x94')]['find']({'where':{'name':_0x4940('0x95'),'userProfileId':_0x5c4128[_0x4940('0x90')]},'raw':!![]})['then'](function(_0x435c69){if(_0x435c69&&_0x435c69[_0x4940('0x96')]===0x0){return db[_0x4940('0x97')][_0x4940('0x8d')]({'name':_0x856dde[_0x4940('0x2e')],'resourceId':_0x856dde['id'],'type':_0x435c69[_0x4940('0x2e')],'sectionId':_0x435c69['id']},{})[_0x4940('0x29')](function(){return _0x1a72f8;});}else{return _0x1a72f8;}})[_0x4940('0x4a')](function(_0x750058){logger[_0x4940('0x2c')](_0x4940('0x98'),_0x750058);throw _0x750058;});}return _0x1a72f8;})[_0x4940('0x29')](respondWithResult(_0x5b97fb,null))[_0x4940('0x4a')](handleError(_0x5b97fb,null));}});}catch(_0x4e5bbc){_0x5b97fb[_0x4940('0x23')](0x1f4)[_0x4940('0x2f')](_0x4e5bbc);}};function removeReferences(_0x61a45c,_0x531deb){try{if(_0x61a45c){fs['unlinkSync'](_0x61a45c);logger[_0x4940('0x64')](_0x4940('0x99'));}if(_0x531deb){rimraf(_0x531deb,function(){});logger[_0x4940('0x64')](_0x4940('0x9a'));}}catch(_0x3e5a4d){logger[_0x4940('0x2c')](_0x3e5a4d);}}exports[_0x4940('0x28')]=function(_0x595718,_0x283ff6,_0x4f9138){return db[_0x4940('0x32')]['find']({'where':{'id':_0x595718[_0x4940('0x4c')]['id']}})[_0x4940('0x29')](handleEntityNotFound(_0x283ff6,null))[_0x4940('0x29')](saveUpdates(_0x595718[_0x4940('0x8e')],null))[_0x4940('0x29')](respondWithResult(_0x283ff6,null))[_0x4940('0x4a')](handleError(_0x283ff6,null));};exports[_0x4940('0x9b')]=function(_0x3be83f,_0x2a0387,_0xc0f78f){return db['Plugin']['find']({'where':{'id':_0x3be83f['params']['id']}})['then'](function(_0x575823){if(_0x575823){return _0x575823['destroy']();}})['then'](function(_0x40d123){rimraf(path['join'](config['root'],'server/files/plugins',path[_0x4940('0x5c')](_0x40d123[_0x4940('0x8')])),function(){});return _0x40d123;})[_0x4940('0x29')](handleEntityNotFound(_0x2a0387,null))[_0x4940('0x29')](respondWithStatusCode(_0x2a0387,null))[_0x4940('0x4a')](handleError(_0x2a0387,null));};exports['webhookGet']=function(_0x2d66c6,_0x297a82,_0x53c13d){return BPromise[_0x4940('0x9c')]()[_0x4940('0x29')](function(){if(!_0x2d66c6['query'][_0x4940('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2d66c6[_0x4940('0x36')][_0x4940('0x9d')]){throw new Error(_0x4940('0x9e'));}var _0x80ce8a=_0x2d66c6[_0x4940('0x36')][_0x4940('0x9f')]?_0x2d66c6['query']['hostname']+':'+_0x2d66c6['query']['port']:_0x4940('0xa0')+_0x2d66c6[_0x4940('0x36')][_0x4940('0x9d')];var _0x2df455=_0x2d66c6[_0x4940('0x36')]['json']?_0x2d66c6[_0x4940('0x36')]['json']:!![];var _0x2bae23=_0x2d66c6[_0x4940('0x36')]['encoding']?_0x2d66c6[_0x4940('0x36')][_0x4940('0xa1')]:null;var _0x46aeb3={'method':_0x2d66c6[_0x4940('0xa2')],'uri':util[_0x4940('0x50')](_0x4940('0xa3'),_0x80ce8a,_0x2d66c6[_0x4940('0x36')][_0x4940('0x8')]),'json':_0x2df455,'resolveWithFullResponse':!![],'encoding':_0x2bae23,'qs':_0x2d66c6['query']};if(_0x2d66c6['headers']){_0x46aeb3[_0x4940('0xa4')]=_0x2d66c6[_0x4940('0xa4')];if(_0x46aeb3[_0x4940('0xa4')]['content-length']){delete _0x46aeb3[_0x4940('0xa4')][_0x4940('0xa5')];}}if(_0x46aeb3[_0x4940('0xa4')]['content-type']){delete _0x46aeb3[_0x4940('0xa4')][_0x4940('0xa6')];}return rp(_0x46aeb3);})[_0x4940('0x29')](function(_0x58738c){if(_0x58738c){_0x297a82['set'](_0x58738c[_0x4940('0xa4')]);logger[_0x4940('0x64')](_0x58738c['body']);if(_[_0x4940('0xa7')](_0x2d66c6['query']['path'],_0x4940('0x4e'))&&_0x58738c[_0x4940('0xa8')]==0x1f4){return _0x297a82[_0x4940('0x2b')](_0x58738c[_0x4940('0xa8')]);}else{return _0x297a82['status'](_0x58738c['statusCode'])[_0x4940('0x2f')](_0x58738c[_0x4940('0x8e')]);}}else{return _0x297a82[_0x4940('0x2b')](0xc8);}})[_0x4940('0x4a')](handleError(_0x297a82,null));};exports[_0x4940('0xa9')]=function(_0x59318b,_0x4fccf4,_0x4ca934){return BPromise[_0x4940('0x9c')]()[_0x4940('0x29')](function(){if(!_0x59318b[_0x4940('0x36')]['path']){throw new Error(_0x4940('0xaa'));}if(!_0x59318b[_0x4940('0x36')][_0x4940('0x9d')]){throw new Error(_0x4940('0x9e'));}var _0x34d195=_0x59318b[_0x4940('0x36')][_0x4940('0x9f')]?_0x59318b[_0x4940('0x36')][_0x4940('0x9f')]+':'+_0x59318b[_0x4940('0x36')]['port']:_0x4940('0xa0')+_0x59318b[_0x4940('0x36')]['port'];var _0x1d5fec=_0x59318b[_0x4940('0x36')][_0x4940('0x20')]?_0x59318b[_0x4940('0x36')][_0x4940('0x20')]:!![];var _0x52a8da=_0x59318b[_0x4940('0x36')][_0x4940('0xa1')]?_0x59318b[_0x4940('0x36')][_0x4940('0xa1')]:null;var _0x8389b9={'method':_0x59318b[_0x4940('0xa2')],'uri':util[_0x4940('0x50')](_0x4940('0xa3'),_0x34d195,_0x59318b['query']['path']),'json':_0x1d5fec,'resolveWithFullResponse':!![],'encoding':_0x52a8da,'body':_0x59318b['body']};if(_0x59318b[_0x4940('0xa4')]){_0x8389b9['headers']=_0x59318b[_0x4940('0xa4')];if(_0x8389b9[_0x4940('0xa4')]['content-length']){delete _0x8389b9[_0x4940('0xa4')]['content-length'];}}if(_0x8389b9['headers'][_0x4940('0xa6')]){delete _0x8389b9[_0x4940('0xa4')][_0x4940('0xa6')];}return rp(_0x8389b9);})[_0x4940('0x29')](function(_0x15bd9b){if(_0x15bd9b){_0x4fccf4[_0x4940('0x24')](_0x15bd9b['headers']);logger[_0x4940('0x64')](_0x15bd9b[_0x4940('0x8e')]);return _0x4fccf4[_0x4940('0x23')](_0x15bd9b[_0x4940('0xa8')])[_0x4940('0x2f')](_0x15bd9b['body']);}else{return _0x4fccf4[_0x4940('0x2b')](0xc8);}})[_0x4940('0x4a')](handleError(_0x4fccf4,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a2bd534..2e65d00 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 _0x6a95=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x97dee5,_0x2758ce){var _0x334f5e=function(_0x55316e){while(--_0x55316e){_0x97dee5['push'](_0x97dee5['shift']());}};_0x334f5e(++_0x2758ce);}(_0x6a95,0x1db));var _0x56a9=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x6a95[_0x34021d];return _0x16597b;};'use strict';var EventEmitter=require(_0x56a9('0x0'));var Plugin=require(_0x56a9('0x1'))['db'][_0x56a9('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x56a9('0x3')](0x0);var events={'afterCreate':_0x56a9('0x4'),'afterUpdate':_0x56a9('0x5'),'afterDestroy':_0x56a9('0x6')};function emitEvent(_0x58e4a4){return function(_0x512f52,_0x12cd60,_0x83f534){PluginEvents[_0x56a9('0x7')](_0x58e4a4+':'+_0x512f52['id'],_0x512f52);PluginEvents[_0x56a9('0x7')](_0x58e4a4,_0x512f52);_0x83f534(null);};}for(var e in events){if(events[_0x56a9('0x8')](e)){var event=events[e];Plugin[_0x56a9('0x9')](e,emitEvent(event));}}module[_0x56a9('0xa')]=PluginEvents; \ No newline at end of file +var _0xfff0=['hook','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x158d44,_0x330e20){var _0x477bc0=function(_0x4f1b33){while(--_0x4f1b33){_0x158d44['push'](_0x158d44['shift']());}};_0x477bc0(++_0x330e20);}(_0xfff0,0x139));var _0x0fff=function(_0x2f7de1,_0x36ec15){_0x2f7de1=_0x2f7de1-0x0;var _0x50ff62=_0xfff0[_0x2f7de1];return _0x50ff62;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x0fff('0x0'))['db'][_0x0fff('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x0fff('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0fff('0x3'),'afterDestroy':_0x0fff('0x4')};function emitEvent(_0x266f43){return function(_0x4bec60,_0x2cd3d5,_0x17911e){PluginEvents['emit'](_0x266f43+':'+_0x4bec60['id'],_0x4bec60);PluginEvents[_0x0fff('0x5')](_0x266f43,_0x4bec60);_0x17911e(null);};}for(var e in events){if(events[_0x0fff('0x6')](e)){var event=events[e];Plugin[_0x0fff('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 2502a4a..bd63ff8 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x53d816,_0x1d1594){_0x53d816=_0x53d816-0x0;var _0x17c9ed=_0x7fbe[_0x53d816];return _0x17c9ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x3031d7,_0x3f22b5){var _0xe3650b=function(_0x43a878){while(--_0x43a878){_0x3031d7['push'](_0x3031d7['shift']());}};_0xe3650b(++_0x3f22b5);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));module[_0xd7df('0xb')]=function(_0x36cf0f,_0x39ce98){return _0x36cf0f[_0xd7df('0xc')](_0xd7df('0xd'),attributes,{'tableName':_0xd7df('0xe'),'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 08bade2..b768db8 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 _0x4714=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Plugin','create','body','options','catch','CreatePlugin','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request'];(function(_0x332403,_0x324a97){var _0x53b8bd=function(_0xbf4cd7){while(--_0xbf4cd7){_0x332403['push'](_0x332403['shift']());}};_0x53b8bd(++_0x324a97);}(_0x4714,0x1b0));var _0x4471=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4714[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4471('0x0'));var util=require(_0x4471('0x1'));var moment=require('moment');var BPromise=require(_0x4471('0x2'));var rs=require(_0x4471('0x3'));var fs=require('fs');var Redis=require(_0x4471('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4471('0x5'));var logger=require(_0x4471('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4471('0x7'));var client=jayson[_0x4471('0x8')][_0x4471('0x9')]({'port':0x232a});config[_0x4471('0xa')]=_[_0x4471('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4471('0xc'))(new Redis(config[_0x4471('0xa')]));require(_0x4471('0xd'))[_0x4471('0xe')](socket);function respondWithRpcPromise(_0x5c3fa8,_0x2e5f7e,_0x4d9e40){return new BPromise(function(_0x226b30,_0x382a63){return client[_0x4471('0xf')](_0x5c3fa8,_0x4d9e40)[_0x4471('0x10')](function(_0x30ba96){logger[_0x4471('0x11')](_0x4471('0x12'),_0x2e5f7e,_0x4471('0x13'));logger[_0x4471('0x14')](_0x4471('0x15'),_0x2e5f7e,'request\x20sent',JSON[_0x4471('0x16')](_0x30ba96));if(_0x30ba96['error']){if(_0x30ba96['error']['code']===0x1f4){logger['error'](_0x4471('0x12'),_0x2e5f7e,_0x30ba96[_0x4471('0x17')][_0x4471('0x18')]);return _0x382a63(_0x30ba96['error'][_0x4471('0x18')]);}logger[_0x4471('0x17')](_0x4471('0x12'),_0x2e5f7e,_0x30ba96[_0x4471('0x17')][_0x4471('0x18')]);return _0x226b30(_0x30ba96['error']['message']);}else{logger['info'](_0x4471('0x12'),_0x2e5f7e,_0x4471('0x13'));_0x226b30(_0x30ba96[_0x4471('0x19')][_0x4471('0x18')]);}})['catch'](function(_0x5c842a){logger[_0x4471('0x17')](_0x4471('0x12'),_0x2e5f7e,_0x5c842a);_0x382a63(_0x5c842a);});});}exports['CreatePlugin']=function(_0x140f9d){var _0x4e4f5b=this;return new Promise(function(_0x13e181,_0x528e0b){return db[_0x4471('0x1a')][_0x4471('0x1b')](_0x140f9d[_0x4471('0x1c')],{'raw':_0x140f9d[_0x4471('0x1d')]?_0x140f9d[_0x4471('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x9c5590){logger[_0x4471('0x11')]('CreatePlugin',_0x140f9d);logger[_0x4471('0x14')]('CreatePlugin',_0x140f9d,JSON[_0x4471('0x16')](_0x9c5590));_0x13e181(_0x9c5590);})[_0x4471('0x1e')](function(_0x2c50d8){logger[_0x4471('0x17')](_0x4471('0x1f'),_0x2c50d8[_0x4471('0x18')],_0x140f9d);_0x528e0b(_0x4e4f5b[_0x4471('0x17')](0x1f4,_0x2c50d8['message']));});});}; \ No newline at end of file +var _0xbc10=['Plugin,\x20%s,\x20%s','request\x20sent','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','stringify','error','code','message'];(function(_0x5ef94c,_0xbec26a){var _0x4dd2fe=function(_0x597c5e){while(--_0x597c5e){_0x5ef94c['push'](_0x5ef94c['shift']());}};_0x4dd2fe(++_0xbec26a);}(_0xbc10,0x15d));var _0x0bc1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbc10[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0bc1('0x0'));var util=require(_0x0bc1('0x1'));var moment=require(_0x0bc1('0x2'));var BPromise=require(_0x0bc1('0x3'));var rs=require(_0x0bc1('0x4'));var fs=require('fs');var Redis=require(_0x0bc1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bc1('0x6'));var logger=require(_0x0bc1('0x7'))(_0x0bc1('0x8'));var config=require(_0x0bc1('0x9'));var jayson=require(_0x0bc1('0xa'));var client=jayson['client'][_0x0bc1('0xb')]({'port':0x232a});config[_0x0bc1('0xc')]=_[_0x0bc1('0xd')](config['redis'],{'host':_0x0bc1('0xe'),'port':0x18eb});var socket=require(_0x0bc1('0xf'))(new Redis(config['redis']));require('./plugin.socket')[_0x0bc1('0x10')](socket);function respondWithRpcPromise(_0x503101,_0x41e903,_0x43fa7a){return new BPromise(function(_0x5990d3,_0x382723){return client[_0x0bc1('0x11')](_0x503101,_0x43fa7a)[_0x0bc1('0x12')](function(_0x148471){logger[_0x0bc1('0x13')]('Plugin,\x20%s,\x20%s',_0x41e903,'request\x20sent');logger[_0x0bc1('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x41e903,'request\x20sent',JSON[_0x0bc1('0x15')](_0x148471));if(_0x148471[_0x0bc1('0x16')]){if(_0x148471[_0x0bc1('0x16')][_0x0bc1('0x17')]===0x1f4){logger[_0x0bc1('0x16')]('Plugin,\x20%s,\x20%s',_0x41e903,_0x148471[_0x0bc1('0x16')]['message']);return _0x382723(_0x148471[_0x0bc1('0x16')][_0x0bc1('0x18')]);}logger[_0x0bc1('0x16')](_0x0bc1('0x19'),_0x41e903,_0x148471[_0x0bc1('0x16')][_0x0bc1('0x18')]);return _0x5990d3(_0x148471['error'][_0x0bc1('0x18')]);}else{logger[_0x0bc1('0x13')]('Plugin,\x20%s,\x20%s',_0x41e903,_0x0bc1('0x1a'));_0x5990d3(_0x148471[_0x0bc1('0x1b')][_0x0bc1('0x18')]);}})[_0x0bc1('0x1c')](function(_0x261644){logger['error'](_0x0bc1('0x19'),_0x41e903,_0x261644);_0x382723(_0x261644);});});}exports[_0x0bc1('0x1d')]=function(_0x11eeed){var _0x457fd2=this;return new Promise(function(_0x1bb82f,_0x6721d8){return db[_0x0bc1('0x1e')][_0x0bc1('0x1f')](_0x11eeed['body'],{'raw':_0x11eeed[_0x0bc1('0x20')]?_0x11eeed[_0x0bc1('0x20')][_0x0bc1('0x21')]===undefined?!![]:![]:!![]})[_0x0bc1('0x12')](function(_0x464772){logger[_0x0bc1('0x13')]('CreatePlugin',_0x11eeed);logger[_0x0bc1('0x14')]('CreatePlugin',_0x11eeed,JSON[_0x0bc1('0x15')](_0x464772));_0x1bb82f(_0x464772);})['catch'](function(_0xec1bee){logger[_0x0bc1('0x16')](_0x0bc1('0x1d'),_0xec1bee[_0x0bc1('0x18')],_0x11eeed);_0x6721d8(_0x457fd2[_0x0bc1('0x16')](0x1f4,_0xec1bee[_0x0bc1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 58511f3..4c243ec 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 _0x287b=['register','length','plugin:','./plugin.events','remove','update','emit'];(function(_0x292081,_0x56f787){var _0x425af0=function(_0x18094a){while(--_0x18094a){_0x292081['push'](_0x292081['shift']());}};_0x425af0(++_0x56f787);}(_0x287b,0x96));var _0xb287=function(_0x4ec42,_0x36177b){_0x4ec42=_0x4ec42-0x0;var _0x385e11=_0x287b[_0x4ec42];return _0x385e11;};'use strict';var PluginEvents=require(_0xb287('0x0'));var events=['save',_0xb287('0x1'),_0xb287('0x2')];function createListener(_0xd029b9,_0x5bd0fc){return function(_0x485a03){_0x5bd0fc[_0xb287('0x3')](_0xd029b9,_0x485a03);};}function removeListener(_0x5a5711,_0x37b46a){return function(){PluginEvents['removeListener'](_0x5a5711,_0x37b46a);};}exports[_0xb287('0x4')]=function(_0xc6c172){for(var _0x130648=0x0,_0x3b442a=events[_0xb287('0x5')];_0x130648<_0x3b442a;_0x130648++){var _0x1fcbd7=events[_0x130648];var _0x2a5111=createListener(_0xb287('0x6')+_0x1fcbd7,_0xc6c172);PluginEvents['on'](_0x1fcbd7,_0x2a5111);}}; \ No newline at end of file +var _0x0e80=['removeListener','register','plugin:','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e80,0x1ad));var _0x00e8=function(_0x38ee44,_0x40f7e7){_0x38ee44=_0x38ee44-0x0;var _0x247768=_0x0e80[_0x38ee44];return _0x247768;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x00e8('0x0'),_0x00e8('0x1')];function createListener(_0x3f5edc,_0x2f6a65){return function(_0x46158b){_0x2f6a65[_0x00e8('0x2')](_0x3f5edc,_0x46158b);};}function removeListener(_0x6b94cb,_0xdfa62d){return function(){PluginEvents[_0x00e8('0x3')](_0x6b94cb,_0xdfa62d);};}exports[_0x00e8('0x4')]=function(_0x256805){for(var _0x437a3c=0x0,_0x1f8e9d=events['length'];_0x437a3c<_0x1f8e9d;_0x437a3c++){var _0x3b90b4=events[_0x437a3c];var _0x118fc6=createListener(_0x00e8('0x5')+_0x3b90b4,_0x256805);PluginEvents['on'](_0x3b90b4,_0x118fc6);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 29f0dca..18d5820 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 _0xd51b=['../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','express','Router'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xd51b,0xee));var _0xbd51=function(_0xd1a845,_0x1146d){_0xd1a845=_0xd1a845-0x0;var _0x109f9c=_0xd51b[_0xd1a845];return _0x109f9c;};'use strict';var express=require(_0xbd51('0x0'));var router=express[_0xbd51('0x1')]();var auth=require(_0xbd51('0x2'));var controller=require(_0xbd51('0x3'));router[_0xbd51('0x4')]('/',auth[_0xbd51('0x5')](),controller[_0xbd51('0x6')]);router[_0xbd51('0x4')](_0xbd51('0x7'),auth[_0xbd51('0x5')](),controller['show']);router[_0xbd51('0x8')]('/',auth[_0xbd51('0x5')](),controller[_0xbd51('0x9')]);router[_0xbd51('0xa')](_0xbd51('0x7'),auth[_0xbd51('0x5')](),controller[_0xbd51('0xb')]);router[_0xbd51('0xc')](_0xbd51('0x7'),auth['isAuthenticated'](),controller[_0xbd51('0xd')]);module[_0xbd51('0xe')]=router; \ No newline at end of file +var _0xbd74=['/:id','post','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xbd74,0xe7));var _0x4bd7=function(_0x16c417,_0x1755d4){_0x16c417=_0x16c417-0x0;var _0x2c4d77=_0xbd74[_0x16c417];return _0x2c4d77;};'use strict';var express=require(_0x4bd7('0x0'));var router=express[_0x4bd7('0x1')]();var auth=require(_0x4bd7('0x2'));var controller=require(_0x4bd7('0x3'));router[_0x4bd7('0x4')]('/',auth[_0x4bd7('0x5')](),controller[_0x4bd7('0x6')]);router[_0x4bd7('0x4')](_0x4bd7('0x7'),auth[_0x4bd7('0x5')](),controller['show']);router[_0x4bd7('0x8')]('/',auth[_0x4bd7('0x5')](),controller['create']);router[_0x4bd7('0x9')](_0x4bd7('0x7'),auth['isAuthenticated'](),controller[_0x4bd7('0xa')]);router[_0x4bd7('0xb')]('/:id',auth[_0x4bd7('0x5')](),controller[_0x4bd7('0xc')]);module[_0x4bd7('0xd')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index f9f185f..ac9c8d7 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 _0x1f22=['error','stack','name','send','npm\x20install','info','list','then','express','length','catch','create','body','script','join','../../files/plugins','chdir','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','params','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json'];(function(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0x1f22,0x128));var _0x21f2=function(_0x57b8da,_0x350ec1){_0x57b8da=_0x57b8da-0x0;var _0x202387=_0x1f22[_0x57b8da];return _0x202387;};'use strict';var _=require(_0x21f2('0x0'));var pm2=require(_0x21f2('0x1'));var logger=require(_0x21f2('0x2'))(_0x21f2('0x3'));var path=require(_0x21f2('0x4'));var exec=require(_0x21f2('0x5'))[_0x21f2('0x6')];var BPromise=require(_0x21f2('0x7'));function handleEntityNotFound(_0x2d9f90,_0x5dd5c2){return function(_0x277133){if(!_0x277133){_0x2d9f90['sendStatus'](0x194);;}return _0x277133;};}function respondWithResult(_0x55f456,_0x59dc86){_0x59dc86=_0x59dc86||0xc8;return function(_0x86a44b){if(_0x86a44b){return _0x55f456[_0x21f2('0x8')](_0x59dc86)[_0x21f2('0x9')](_0x86a44b);}return null;};}function handleError(_0x45716a,_0x338e87){_0x338e87=_0x338e87||0x1f4;return function(_0x49a2a3){logger[_0x21f2('0xa')](_0x49a2a3[_0x21f2('0xb')]);if(_0x49a2a3[_0x21f2('0xc')]){delete _0x49a2a3[_0x21f2('0xc')];}_0x45716a[_0x21f2('0x8')](_0x338e87)[_0x21f2('0xd')](_0x49a2a3);};}function execChildProcess(){return new BPromise(function(_0x1c3e32,_0x308a3f){exec(_0x21f2('0xe'),function(_0x401721,_0x9fac84,_0x1b1326){logger[_0x21f2('0xf')](_0x9fac84);logger[_0x21f2('0xf')](_0x1b1326);if(_0x401721){logger[_0x21f2('0xa')](_0x401721);return _0x308a3f(_0x401721);}return _0x1c3e32(_0x9fac84);});});}exports['index']=function(_0x20adc0,_0x4fe8b0){return pm2[_0x21f2('0x10')]()[_0x21f2('0x11')](function(_0x2540df){if(_0x2540df){var _0x2d4539=_['reject'](_0x2540df,function(_0x4679cb){return _0x4679cb[_0x21f2('0xc')]===_0x21f2('0x12')||_0x4679cb[_0x21f2('0xc')]==='motion2';});return{'rows':_0x2d4539,'count':_0x2d4539[_0x21f2('0x13')]};}return null;})[_0x21f2('0x11')](respondWithResult(_0x4fe8b0,null))[_0x21f2('0x14')](handleError(_0x4fe8b0,null));};exports['show']=function(_0x3fa3d0,_0x3c02cd){return pm2['describe'](_0x3fa3d0['params']['id'])['then'](respondWithResult(_0x3c02cd,null))[_0x21f2('0x11')](handleEntityNotFound(_0x3c02cd,null))[_0x21f2('0x14')](handleError(_0x3c02cd,null));};exports[_0x21f2('0x15')]=function(_0xe1bc4d,_0x2e19d8){if(_0xe1bc4d[_0x21f2('0x16')][_0x21f2('0xc')]&&_0xe1bc4d[_0x21f2('0x16')][_0x21f2('0x17')]){var _0x5b214a=path[_0x21f2('0x18')](__dirname,_0x21f2('0x19'),_0xe1bc4d['body'][_0x21f2('0x17')]);var _0x1992f5=process['cwd']();process[_0x21f2('0x1a')](path['dirname'](_0x5b214a));return execChildProcess()['then'](function(_0x3b7b7a){process[_0x21f2('0x1a')](_0x1992f5);return pm2['start']({'name':_0xe1bc4d[_0x21f2('0x16')][_0x21f2('0xc')],'script':_0x5b214a});})[_0x21f2('0x11')](function(_0xb557ff){pm2[_0x21f2('0x1b')]();return _0xb557ff[0x0];})[_0x21f2('0x11')](respondWithResult(_0x2e19d8,0xc9))['catch'](handleError(_0x2e19d8,null));}else{return _0x2e19d8[_0x21f2('0x8')](0x1f4)[_0x21f2('0xd')]({'message':_0x21f2('0x1c')});}};exports[_0x21f2('0x1d')]=function(_0x1f8165,_0x5debeb){if(_0x1f8165['body']['id']){delete _0x1f8165[_0x21f2('0x16')]['id'];}var _0x13d818={'online':'restart','stopped':'stop'};if(_0x13d818[_0x21f2('0x1e')](_0x1f8165[_0x21f2('0x16')][_0x21f2('0x8')])){return pm2[_0x13d818[_0x1f8165[_0x21f2('0x16')][_0x21f2('0x8')]]](_0x1f8165[_0x21f2('0x1f')]['id'])[_0x21f2('0x11')](respondWithResult(_0x5debeb,0xc8))[_0x21f2('0x14')](handleError(_0x5debeb,null));}else{return _0x5debeb[_0x21f2('0x8')](0x1f4)[_0x21f2('0xd')]({'message':_0x21f2('0x20')});}};exports['destroy']=function(_0x328f86,_0x3da60d){if(_0x328f86['body']['id']){delete _0x328f86[_0x21f2('0x16')]['id'];}if(_0x328f86[_0x21f2('0x1f')]['id']){return pm2['delete'](_0x328f86['params']['id'])[_0x21f2('0x11')](function(_0x1ff50f){pm2[_0x21f2('0x1b')]();return _0x1ff50f[0x0];})[_0x21f2('0x11')](respondWithResult(_0x3da60d,null))[_0x21f2('0x14')](handleError(_0x3da60d,null));}else{return _0x3da60d[_0x21f2('0x8')](0x1f4)['send']({'message':_0x21f2('0x21')});}}; \ No newline at end of file +var _0x8595=['length','catch','show','describe','create','script','join','../../files/plugins','body','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','child_process','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','error','index','then','reject','express','motion2'];(function(_0x94f3e2,_0x5907c9){var _0x44c000=function(_0x5e9791){while(--_0x5e9791){_0x94f3e2['push'](_0x94f3e2['shift']());}};_0x44c000(++_0x5907c9);}(_0x8595,0x12e));var _0x5859=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x8595[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x5859('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0x5859('0x1'))[_0x5859('0x2')];var BPromise=require(_0x5859('0x3'));function handleEntityNotFound(_0x349056,_0x5c2b64){return function(_0x5e5e53){if(!_0x5e5e53){_0x349056[_0x5859('0x4')](0x194);;}return _0x5e5e53;};}function respondWithResult(_0xad7d99,_0x1ef680){_0x1ef680=_0x1ef680||0xc8;return function(_0x2cf1d3){if(_0x2cf1d3){return _0xad7d99[_0x5859('0x5')](_0x1ef680)[_0x5859('0x6')](_0x2cf1d3);}return null;};}function handleError(_0xa20c0d,_0x286948){_0x286948=_0x286948||0x1f4;return function(_0x1781de){logger['error'](_0x1781de[_0x5859('0x7')]);if(_0x1781de[_0x5859('0x8')]){delete _0x1781de[_0x5859('0x8')];}_0xa20c0d[_0x5859('0x5')](_0x286948)[_0x5859('0x9')](_0x1781de);};}function execChildProcess(){return new BPromise(function(_0x482698,_0x2ed530){exec(_0x5859('0xa'),function(_0x3fcf4b,_0x90b49b,_0x57549e){logger[_0x5859('0xb')](_0x90b49b);logger['info'](_0x57549e);if(_0x3fcf4b){logger[_0x5859('0xc')](_0x3fcf4b);return _0x2ed530(_0x3fcf4b);}return _0x482698(_0x90b49b);});});}exports[_0x5859('0xd')]=function(_0x178649,_0x22cbe6){return pm2['list']()[_0x5859('0xe')](function(_0x1eaaa8){if(_0x1eaaa8){var _0x1d60b2=_[_0x5859('0xf')](_0x1eaaa8,function(_0x2b4dc1){return _0x2b4dc1[_0x5859('0x8')]===_0x5859('0x10')||_0x2b4dc1[_0x5859('0x8')]===_0x5859('0x11');});return{'rows':_0x1d60b2,'count':_0x1d60b2[_0x5859('0x12')]};}return null;})[_0x5859('0xe')](respondWithResult(_0x22cbe6,null))[_0x5859('0x13')](handleError(_0x22cbe6,null));};exports[_0x5859('0x14')]=function(_0x7784f0,_0x369b16){return pm2[_0x5859('0x15')](_0x7784f0['params']['id'])[_0x5859('0xe')](respondWithResult(_0x369b16,null))[_0x5859('0xe')](handleEntityNotFound(_0x369b16,null))[_0x5859('0x13')](handleError(_0x369b16,null));};exports[_0x5859('0x16')]=function(_0x25d241,_0x53f1d6){if(_0x25d241['body']['name']&&_0x25d241['body'][_0x5859('0x17')]){var _0x50d640=path[_0x5859('0x18')](__dirname,_0x5859('0x19'),_0x25d241[_0x5859('0x1a')][_0x5859('0x17')]);var _0x59ca70=process['cwd']();process[_0x5859('0x1b')](path[_0x5859('0x1c')](_0x50d640));return execChildProcess()[_0x5859('0xe')](function(_0x515925){process['chdir'](_0x59ca70);return pm2[_0x5859('0x1d')]({'name':_0x25d241[_0x5859('0x1a')][_0x5859('0x8')],'script':_0x50d640});})[_0x5859('0xe')](function(_0x35a92a){pm2[_0x5859('0x1e')]();return _0x35a92a[0x0];})[_0x5859('0xe')](respondWithResult(_0x53f1d6,0xc9))[_0x5859('0x13')](handleError(_0x53f1d6,null));}else{return _0x53f1d6[_0x5859('0x5')](0x1f4)[_0x5859('0x9')]({'message':_0x5859('0x1f')});}};exports['update']=function(_0x3df2bb,_0x4c60f9){if(_0x3df2bb[_0x5859('0x1a')]['id']){delete _0x3df2bb[_0x5859('0x1a')]['id'];}var _0x4e2051={'online':_0x5859('0x20'),'stopped':_0x5859('0x21')};if(_0x4e2051[_0x5859('0x22')](_0x3df2bb[_0x5859('0x1a')][_0x5859('0x5')])){return pm2[_0x4e2051[_0x3df2bb[_0x5859('0x1a')][_0x5859('0x5')]]](_0x3df2bb[_0x5859('0x23')]['id'])[_0x5859('0xe')](respondWithResult(_0x4c60f9,0xc8))[_0x5859('0x13')](handleError(_0x4c60f9,null));}else{return _0x4c60f9[_0x5859('0x5')](0x1f4)[_0x5859('0x9')]({'message':_0x5859('0x24')});}};exports[_0x5859('0x25')]=function(_0x53e12f,_0x33f4d6){if(_0x53e12f['body']['id']){delete _0x53e12f[_0x5859('0x1a')]['id'];}if(_0x53e12f[_0x5859('0x23')]['id']){return pm2[_0x5859('0x26')](_0x53e12f[_0x5859('0x23')]['id'])['then'](function(_0x5e19c5){pm2[_0x5859('0x1e')]();return _0x5e19c5[0x0];})['then'](respondWithResult(_0x33f4d6,null))[_0x5859('0x13')](handleError(_0x33f4d6,null));}else{return _0x33f4d6[_0x5859('0x5')](0x1f4)[_0x5859('0x9')]({'message':_0x5859('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 679c4d0..45df57d 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 _0x3a79=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','express','Router','fs-extra'];(function(_0x3da22c,_0xe11946){var _0x16405e=function(_0x53d621){while(--_0x53d621){_0x3da22c['push'](_0x3da22c['shift']());}};_0x16405e(++_0xe11946);}(_0x3a79,0xca));var _0x93a7=function(_0x483cc4,_0x2b5434){_0x483cc4=_0x483cc4-0x0;var _0x16f8ed=_0x3a79[_0x483cc4];return _0x16f8ed;};'use strict';var multer=require('multer');var util=require(_0x93a7('0x0'));var path=require(_0x93a7('0x1'));var timeout=require('connect-timeout');var express=require(_0x93a7('0x2'));var router=express[_0x93a7('0x3')]();var fs_extra=require(_0x93a7('0x4'));var auth=require(_0x93a7('0x5'));var interaction=require(_0x93a7('0x6'));var config=require(_0x93a7('0x7'));module[_0x93a7('0x8')]=router; \ No newline at end of file +var _0x4e65=['Router','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express'];(function(_0x78bde2,_0x477c10){var _0x2575a0=function(_0x451d53){while(--_0x451d53){_0x78bde2['push'](_0x78bde2['shift']());}};_0x2575a0(++_0x477c10);}(_0x4e65,0xc4));var _0x54e6=function(_0x9d4d31,_0x40dd2c){_0x9d4d31=_0x9d4d31-0x0;var _0x1d7a1f=_0x4e65[_0x9d4d31];return _0x1d7a1f;};'use strict';var multer=require('multer');var util=require(_0x54e6('0x0'));var path=require(_0x54e6('0x1'));var timeout=require(_0x54e6('0x2'));var express=require(_0x54e6('0x3'));var router=express[_0x54e6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x54e6('0x5'));var config=require(_0x54e6('0x6'));module[_0x54e6('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2e7feef..052487d 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 _0xbd6e=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xbd6e,0x74));var _0xebd6=function(_0x38dc72,_0x44be77){_0x38dc72=_0x38dc72-0x0;var _0x15048b=_0xbd6e[_0x38dc72];return _0x15048b;};'use strict';var Sequelize=require(_0xebd6('0x0'));module[_0xebd6('0x1')]={'state':{'type':Sequelize[_0xebd6('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xebd6('0x3')]},'uniqueid':{'type':Sequelize[_0xebd6('0x4')]},'starttime':{'type':Sequelize[_0xebd6('0x3')]},'responsetime':{'type':Sequelize[_0xebd6('0x3')]},'ringtime':{'type':Sequelize[_0xebd6('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xebd6('0x4')]},'campaigntype':{'type':Sequelize[_0xebd6('0x4')]},'membername':{'type':Sequelize[_0xebd6('0x4')]}}; \ No newline at end of file +var _0xd7ae=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x5df302,_0x41cfa2){var _0x20c65b=function(_0x1862ac){while(--_0x1862ac){_0x5df302['push'](_0x5df302['shift']());}};_0x20c65b(++_0x41cfa2);}(_0xd7ae,0x9f));var _0xed7a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd7ae[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0xed7a('0x0'));module[_0xed7a('0x1')]={'state':{'type':Sequelize[_0xed7a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xed7a('0x3')]},'scheduledat':{'type':Sequelize[_0xed7a('0x4')]},'uniqueid':{'type':Sequelize[_0xed7a('0x3')]},'starttime':{'type':Sequelize[_0xed7a('0x4')]},'responsetime':{'type':Sequelize[_0xed7a('0x4')]},'ringtime':{'type':Sequelize[_0xed7a('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xed7a('0x3')]},'campaigntype':{'type':Sequelize[_0xed7a('0x3')]},'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 3f77f36..b158cf0 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 _0xc82d=['../../config/environment','define','ReportAgentPreview','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xc82d,0x1ed));var _0xdc82=function(_0x367825,_0xba445e){_0x367825=_0x367825-0x0;var _0x17e0c2=_0xc82d[_0x367825];return _0x17e0c2;};'use strict';var _=require(_0xdc82('0x0'));var util=require(_0xdc82('0x1'));var logger=require('../../config/logger')(_0xdc82('0x2'));var moment=require(_0xdc82('0x3'));var BPromise=require(_0xdc82('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc82('0x5'));var rimraf=require(_0xdc82('0x6'));var config=require(_0xdc82('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x587e84,_0x3e056f){return _0x587e84[_0xdc82('0x8')](_0xdc82('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7457=['util','api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x25fb7d,_0x496100){var _0x552143=function(_0x34ca7a){while(--_0x34ca7a){_0x25fb7d['push'](_0x25fb7d['shift']());}};_0x552143(++_0x496100);}(_0x7457,0x1e3));var _0x7745=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x7457[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x7745('0x0'));var util=require(_0x7745('0x1'));var logger=require('../../config/logger')(_0x7745('0x2'));var moment=require(_0x7745('0x3'));var BPromise=require(_0x7745('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7745('0x5'));var config=require(_0x7745('0x6'));var attributes=require(_0x7745('0x7'));module[_0x7745('0x8')]=function(_0x1e9883,_0x3c8380){return _0x1e9883['define'](_0x7745('0x9'),attributes,{'tableName':_0x7745('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 8805a96..1bca58a 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 _0xdff8=['ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x121f61,_0x5174fc){var _0x393306=function(_0xc9dfde){while(--_0xc9dfde){_0x121f61['push'](_0x121f61['shift']());}};_0x393306(++_0x5174fc);}(_0xdff8,0x18c));var _0x8dff=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xdff8[_0x9b2bb0];return _0x2cdb3b;};'use strict';var _=require(_0x8dff('0x0'));var util=require(_0x8dff('0x1'));var moment=require(_0x8dff('0x2'));var BPromise=require(_0x8dff('0x3'));var rs=require(_0x8dff('0x4'));var fs=require('fs');var Redis=require(_0x8dff('0x5'));var db=require(_0x8dff('0x6'))['db'];var utils=require(_0x8dff('0x7'));var logger=require(_0x8dff('0x8'))('rpc');var config=require(_0x8dff('0x9'));var jayson=require(_0x8dff('0xa'));var client=jayson[_0x8dff('0xb')][_0x8dff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1754b3,_0x3dd0c6,_0x2bcd29){return new BPromise(function(_0x47e9f3,_0x515376){return client[_0x8dff('0xd')](_0x1754b3,_0x2bcd29)[_0x8dff('0xe')](function(_0x2c047f){logger['info'](_0x8dff('0xf'),_0x3dd0c6,'request\x20sent');logger[_0x8dff('0x10')](_0x8dff('0x11'),_0x3dd0c6,_0x8dff('0x12'),JSON[_0x8dff('0x13')](_0x2c047f));if(_0x2c047f[_0x8dff('0x14')]){if(_0x2c047f[_0x8dff('0x14')][_0x8dff('0x15')]===0x1f4){logger['error'](_0x8dff('0xf'),_0x3dd0c6,_0x2c047f[_0x8dff('0x14')][_0x8dff('0x16')]);return _0x515376(_0x2c047f['error'][_0x8dff('0x16')]);}logger[_0x8dff('0x14')](_0x8dff('0xf'),_0x3dd0c6,_0x2c047f[_0x8dff('0x14')][_0x8dff('0x16')]);return _0x47e9f3(_0x2c047f['error'][_0x8dff('0x16')]);}else{logger['info'](_0x8dff('0xf'),_0x3dd0c6,_0x8dff('0x12'));_0x47e9f3(_0x2c047f['result'][_0x8dff('0x16')]);}})[_0x8dff('0x17')](function(_0x20aad1){logger[_0x8dff('0x14')](_0x8dff('0xf'),_0x3dd0c6,_0x20aad1);_0x515376(_0x20aad1);});});}exports['CreateReportAgentPreview']=function(_0x450ab4){var _0x19f079=this;return new Promise(function(_0x21692d,_0x493ea8){return db[_0x8dff('0x18')][_0x8dff('0x19')](_0x450ab4[_0x8dff('0x1a')],{'raw':_0x450ab4[_0x8dff('0x1b')]?_0x450ab4[_0x8dff('0x1b')][_0x8dff('0x1c')]===undefined?!![]:![]:!![]})[_0x8dff('0xe')](function(_0x4917ac){logger['info'](_0x8dff('0x1d'),_0x450ab4);logger[_0x8dff('0x10')](_0x8dff('0x1d'),_0x450ab4,JSON[_0x8dff('0x13')](_0x4917ac));_0x21692d(_0x4917ac);})[_0x8dff('0x17')](function(_0x542597){logger[_0x8dff('0x14')](_0x8dff('0x1d'),_0x542597[_0x8dff('0x16')],_0x450ab4);_0x493ea8(_0x19f079['error'](0x1f4,_0x542597[_0x8dff('0x16')]));});});}; \ No newline at end of file +var _0x2444=['util','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','create','options','raw'];(function(_0x5d2fce,_0x42ddba){var _0x2b6f53=function(_0x4b1f2c){while(--_0x4b1f2c){_0x5d2fce['push'](_0x5d2fce['shift']());}};_0x2b6f53(++_0x42ddba);}(_0x2444,0xe6));var _0x4244=function(_0x3bf03b,_0x423a9d){_0x3bf03b=_0x3bf03b-0x0;var _0x452589=_0x2444[_0x3bf03b];return _0x452589;};'use strict';var _=require('lodash');var util=require(_0x4244('0x0'));var moment=require('moment');var BPromise=require(_0x4244('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4244('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4244('0x3'));var config=require(_0x4244('0x4'));var jayson=require(_0x4244('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51854d,_0x2c7284,_0x2cb711){return new BPromise(function(_0x4fb95a,_0x50a0b2){return client[_0x4244('0x6')](_0x51854d,_0x2cb711)[_0x4244('0x7')](function(_0x12b4d6){logger['info'](_0x4244('0x8'),_0x2c7284,_0x4244('0x9'));logger[_0x4244('0xa')](_0x4244('0xb'),_0x2c7284,_0x4244('0x9'),JSON[_0x4244('0xc')](_0x12b4d6));if(_0x12b4d6[_0x4244('0xd')]){if(_0x12b4d6[_0x4244('0xd')][_0x4244('0xe')]===0x1f4){logger[_0x4244('0xd')](_0x4244('0x8'),_0x2c7284,_0x12b4d6[_0x4244('0xd')][_0x4244('0xf')]);return _0x50a0b2(_0x12b4d6[_0x4244('0xd')][_0x4244('0xf')]);}logger[_0x4244('0xd')](_0x4244('0x8'),_0x2c7284,_0x12b4d6[_0x4244('0xd')][_0x4244('0xf')]);return _0x4fb95a(_0x12b4d6[_0x4244('0xd')][_0x4244('0xf')]);}else{logger[_0x4244('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x2c7284,_0x4244('0x9'));_0x4fb95a(_0x12b4d6[_0x4244('0x11')][_0x4244('0xf')]);}})[_0x4244('0x12')](function(_0x37c1a3){logger[_0x4244('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x2c7284,_0x37c1a3);_0x50a0b2(_0x37c1a3);});});}exports[_0x4244('0x13')]=function(_0x421130){var _0x49b9e0=this;return new Promise(function(_0x3f12cf,_0x77c9da){return db['ReportAgentPreview'][_0x4244('0x14')](_0x421130['body'],{'raw':_0x421130[_0x4244('0x15')]?_0x421130[_0x4244('0x15')][_0x4244('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x41ed3c){logger[_0x4244('0x10')](_0x4244('0x13'),_0x421130);logger[_0x4244('0xa')](_0x4244('0x13'),_0x421130,JSON['stringify'](_0x41ed3c));_0x3f12cf(_0x41ed3c);})['catch'](function(_0x42f9f0){logger['error'](_0x4244('0x13'),_0x42f9f0[_0x4244('0xf')],_0x421130);_0x77c9da(_0x49b9e0[_0x4244('0xd')](0x1f4,_0x42f9f0[_0x4244('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0b1357b..55934f2 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 _0x2744=['/agents','agents','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','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','/openchannel/queues/:id','showOpenchannelQueues','sms','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels'];(function(_0x255ca1,_0x19ca97){var _0x5d4ce0=function(_0x194c6d){while(--_0x194c6d){_0x255ca1['push'](_0x255ca1['shift']());}};_0x5d4ce0(++_0x19ca97);}(_0x2744,0x78));var _0x4274=function(_0x320978,_0x5316a1){_0x320978=_0x320978-0x0;var _0x3f67b1=_0x2744[_0x320978];return _0x3f67b1;};'use strict';var multer=require(_0x4274('0x0'));var util=require(_0x4274('0x1'));var path=require(_0x4274('0x2'));var express=require(_0x4274('0x3'));var router=express[_0x4274('0x4')]();var auth=require(_0x4274('0x5'));var controller=require(_0x4274('0x6'));router[_0x4274('0x7')](_0x4274('0x8'),auth[_0x4274('0x9')](),controller['voiceChannels']);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x4274('0x9')](),controller[_0x4274('0xa')]);router[_0x4274('0x7')](_0x4274('0xb'),auth[_0x4274('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0x4274('0x7')](_0x4274('0xc'),auth[_0x4274('0x9')](),controller[_0x4274('0xd')]);router[_0x4274('0x7')](_0x4274('0xe'),auth[_0x4274('0x9')](),controller['chatQueues']);router['get'](_0x4274('0xf'),auth[_0x4274('0x9')](),controller[_0x4274('0x10')]);router[_0x4274('0x7')]('/mail/accounts',auth[_0x4274('0x9')](),controller['mailAccounts']);router[_0x4274('0x7')](_0x4274('0x11'),auth[_0x4274('0x9')](),controller[_0x4274('0x12')]);router['get']('/sms/queues',auth[_0x4274('0x9')](),controller['smsQueues']);router[_0x4274('0x7')](_0x4274('0x13'),auth['isAuthenticated'](),controller[_0x4274('0x14')]);router[_0x4274('0x7')](_0x4274('0x15'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x4274('0x7')](_0x4274('0x16'),auth[_0x4274('0x9')](),controller[_0x4274('0x17')]);router[_0x4274('0x7')](_0x4274('0x18'),auth['isAuthenticated'](),controller[_0x4274('0x19')]);router[_0x4274('0x7')](_0x4274('0x1a'),auth[_0x4274('0x9')](),controller[_0x4274('0x1b')]);router[_0x4274('0x7')](_0x4274('0x1c'),auth['isAuthenticated'](),controller[_0x4274('0x1d')]);router[_0x4274('0x7')](_0x4274('0x1e'),auth[_0x4274('0x9')](),controller[_0x4274('0x1f')]);router[_0x4274('0x7')](_0x4274('0x20'),auth['isAuthenticated'](),controller[_0x4274('0x21')]);router[_0x4274('0x22')](_0x4274('0x20'),auth[_0x4274('0x9')](),controller[_0x4274('0x23')]);router[_0x4274('0x7')](_0x4274('0x24'),auth[_0x4274('0x9')](),controller[_0x4274('0x25')]);router['get'](_0x4274('0x26'),auth[_0x4274('0x9')](),controller[_0x4274('0x27')]);router['get'](_0x4274('0x28'),auth[_0x4274('0x9')](),controller[_0x4274('0x29')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x4274('0x2a')]);router['get'](_0x4274('0x2b'),auth[_0x4274('0x9')](),controller[_0x4274('0x2c')]);router['get'](_0x4274('0x2d'),auth[_0x4274('0x9')](),controller['trunks']);router[_0x4274('0x7')](_0x4274('0x2e'),auth[_0x4274('0x9')](),controller[_0x4274('0x2f')]);router[_0x4274('0x7')](_0x4274('0x30'),auth[_0x4274('0x9')](),controller[_0x4274('0x31')]);router[_0x4274('0x7')](_0x4274('0x32'),auth[_0x4274('0x9')](),controller[_0x4274('0x33')]);router[_0x4274('0x7')](_0x4274('0x34'),auth[_0x4274('0x9')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x4274('0x35'),auth['isAuthenticated'](),controller[_0x4274('0x36')]);router[_0x4274('0x7')](_0x4274('0x37'),auth[_0x4274('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x4274('0x7')]('/sms/queues/waitinginteractions',auth[_0x4274('0x9')](),controller[_0x4274('0x38')]);router['get'](_0x4274('0x39'),auth[_0x4274('0x9')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x4274('0x3a'),auth[_0x4274('0x9')](),controller[_0x4274('0x3b')]);router[_0x4274('0x3c')]('/mail/queues/:id/notify',auth[_0x4274('0x9')](),controller[_0x4274('0x3d')](_0x4274('0x3e')));router[_0x4274('0x7')](_0x4274('0x3f'),auth[_0x4274('0x9')](),controller['showMailQueues']);router[_0x4274('0x3c')](_0x4274('0x40'),auth[_0x4274('0x9')](),controller['queueNotify'](_0x4274('0x41')));router[_0x4274('0x7')](_0x4274('0x42'),auth[_0x4274('0x9')](),controller[_0x4274('0x43')]);router['post']('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x4274('0x3d')](_0x4274('0x44')));router[_0x4274('0x7')](_0x4274('0x45'),auth[_0x4274('0x9')](),controller[_0x4274('0x46')]);router[_0x4274('0x3c')](_0x4274('0x47'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router[_0x4274('0x7')](_0x4274('0x48'),auth[_0x4274('0x9')](),controller[_0x4274('0x49')]);router[_0x4274('0x3c')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x4274('0x3d')](_0x4274('0x4a')));router[_0x4274('0x3c')]('/whatsapp/queues/:id/notify',auth[_0x4274('0x9')](),controller['queueNotify']('whatsapp'));router[_0x4274('0x7')]('/sms/queues/:id',auth[_0x4274('0x9')](),controller[_0x4274('0x4b')]);router[_0x4274('0x7')](_0x4274('0x4c'),auth[_0x4274('0x9')](),controller[_0x4274('0x4d')]);router[_0x4274('0x3c')]('/agents/:id/notify',auth[_0x4274('0x9')](),controller[_0x4274('0x4e')]);module[_0x4274('0x4f')]=router; \ No newline at end of file +var _0xf990=['outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','post','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','Router','../../components/auth/service','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound'];(function(_0x38ae89,_0x55175c){var _0x1d4118=function(_0x18f5bd){while(--_0x18f5bd){_0x38ae89['push'](_0x38ae89['shift']());}};_0x1d4118(++_0x55175c);}(_0xf990,0x75));var _0x0f99=function(_0x1a0620,_0x4f40c3){_0x1a0620=_0x1a0620-0x0;var _0x475abc=_0xf990[_0x1a0620];return _0x475abc;};'use strict';var multer=require(_0x0f99('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0x0f99('0x1')]();var auth=require(_0x0f99('0x2'));var controller=require('./rpc.controller');router[_0x0f99('0x3')]('/voice/channels',auth[_0x0f99('0x4')](),controller[_0x0f99('0x5')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x0f99('0x4')](),controller[_0x0f99('0x6')]);router[_0x0f99('0x3')](_0x0f99('0x7'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x8')]);router[_0x0f99('0x3')](_0x0f99('0x9'),auth['isAuthenticated'](),controller[_0x0f99('0xa')]);router[_0x0f99('0x3')](_0x0f99('0xb'),auth[_0x0f99('0x4')](),controller['chatQueues']);router[_0x0f99('0x3')](_0x0f99('0xc'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x0f99('0x3')](_0x0f99('0xd'),auth[_0x0f99('0x4')](),controller[_0x0f99('0xe')]);router[_0x0f99('0x3')]('/openchannel/queues',auth[_0x0f99('0x4')](),controller[_0x0f99('0xf')]);router[_0x0f99('0x3')](_0x0f99('0x10'),auth[_0x0f99('0x4')](),controller['smsQueues']);router['get'](_0x0f99('0x11'),auth[_0x0f99('0x4')](),controller['whatsappQueues']);router['get'](_0x0f99('0x12'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x13')]);router['get'](_0x0f99('0x14'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x15')]);router['get'](_0x0f99('0x16'),auth[_0x0f99('0x4')](),controller['voiceQueuesChannels']);router[_0x0f99('0x3')]('/voice/queues/channels/:uniqueid',auth[_0x0f99('0x4')](),controller[_0x0f99('0x17')]);router[_0x0f99('0x3')](_0x0f99('0x18'),auth[_0x0f99('0x4')](),controller['voiceQueuesChannelHangup']);router[_0x0f99('0x3')](_0x0f99('0x19'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x1a')]);router[_0x0f99('0x3')]('/voice/queues/:id',auth[_0x0f99('0x4')](),controller[_0x0f99('0x1b')]);router[_0x0f99('0x1c')](_0x0f99('0x1d'),auth['isAuthenticated'](),controller[_0x0f99('0x1e')]);router[_0x0f99('0x3')](_0x0f99('0x1f'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x20')]);router['get']('/outbound/channels',auth[_0x0f99('0x4')](),controller[_0x0f99('0x21')]);router[_0x0f99('0x3')](_0x0f99('0x22'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x23')]);router[_0x0f99('0x1c')](_0x0f99('0x24'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x25')]);router[_0x0f99('0x3')](_0x0f99('0x26'),auth['isAuthenticated'](),controller[_0x0f99('0x27')]);router[_0x0f99('0x3')](_0x0f99('0x28'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x29')]);router[_0x0f99('0x3')]('/campaigns',auth[_0x0f99('0x4')](),controller['campaigns']);router[_0x0f99('0x3')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x0f99('0x3')](_0x0f99('0x2a'),auth['isAuthenticated'](),controller[_0x0f99('0x2b')]);router[_0x0f99('0x3')]('/mail/queues/waitinginteractions',auth[_0x0f99('0x4')](),controller[_0x0f99('0x2c')]);router[_0x0f99('0x3')](_0x0f99('0x2d'),auth['isAuthenticated'](),controller[_0x0f99('0x2e')]);router[_0x0f99('0x3')](_0x0f99('0x2f'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x30')]);router[_0x0f99('0x3')]('/sms/queues/waitinginteractions',auth[_0x0f99('0x4')](),controller[_0x0f99('0x31')]);router[_0x0f99('0x3')]('/whatsapp/queues/waitinginteractions',auth[_0x0f99('0x4')](),controller[_0x0f99('0x32')]);router['get'](_0x0f99('0x33'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x34')]);router['post'](_0x0f99('0x35'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x36')](_0x0f99('0x37')));router[_0x0f99('0x3')]('/mail/queues/:id',auth['isAuthenticated'](),controller[_0x0f99('0x38')]);router['post'](_0x0f99('0x39'),auth['isAuthenticated'](),controller[_0x0f99('0x36')](_0x0f99('0x3a')));router[_0x0f99('0x3')](_0x0f99('0x3b'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x3c')]);router['post']('/fax/queues/:id/notify',auth[_0x0f99('0x4')](),controller[_0x0f99('0x36')](_0x0f99('0x3d')));router[_0x0f99('0x3')](_0x0f99('0x3e'),auth[_0x0f99('0x4')](),controller['showFaxQueues']);router[_0x0f99('0x3f')](_0x0f99('0x40'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x36')](_0x0f99('0x41')));router[_0x0f99('0x3')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x0f99('0x3f')](_0x0f99('0x42'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x36')](_0x0f99('0x43')));router[_0x0f99('0x3f')](_0x0f99('0x44'),auth[_0x0f99('0x4')](),controller['queueNotify']('whatsapp'));router[_0x0f99('0x3')](_0x0f99('0x45'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x46')]);router[_0x0f99('0x3')]('/whatsapp/queues/:id',auth[_0x0f99('0x4')](),controller[_0x0f99('0x47')]);router[_0x0f99('0x3f')](_0x0f99('0x48'),auth[_0x0f99('0x4')](),controller[_0x0f99('0x49')]);module[_0x0f99('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 70bf6d5..9119638 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 _0x9515=['MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','queue_id','value','filter','indexOf','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','\x20Message\x20not\x20found','queue','MessageId','InteractionId','TransferReport','create','Interaction','*,*,*,*','agentNotify','channel','User','agent','Agent\x20not\x20found','From','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','api','client','http','request','then','error','message','result','catch','status','json','sendStatus','stack','name','isNil','find','rows','voiceChannels','VoiceChannels','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','SIP/%s','interface','INTERACTION','internal','AgentCapacity','Telephones','trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x51d2bc,_0x10c01d){var _0xadaae0=function(_0x435ad6){while(--_0x435ad6){_0x51d2bc['push'](_0x51d2bc['shift']());}};_0xadaae0(++_0x10c01d);}(_0x9515,0x98));var _0x5951=function(_0x2e254c,_0x4dada0){_0x2e254c=_0x2e254c-0x0;var _0x579ab3=_0x9515[_0x2e254c];return _0x579ab3;};'use strict';var BPromise=require(_0x5951('0x0'));var moment=require(_0x5951('0x1'));var _=require(_0x5951('0x2'));var util=require('util');var db=require(_0x5951('0x3'))['db'];var logger=require('../../config/logger')(_0x5951('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x5951('0x5')][_0x5951('0x6')]({'port':0x232a});var mailClient=jayson[_0x5951('0x5')][_0x5951('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x5951('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x13980a,_0x329810,_0x49b8eb){return new BPromise(function(_0x9be70c,_0x2392f8){var _0x1c96ba=_0x49b8eb?_0x49b8eb:amiClient;return _0x1c96ba[_0x5951('0x7')](_0x13980a,_0x329810)[_0x5951('0x8')](function(_0x4e129b){if(_0x4e129b['error']){if(_0x4e129b[_0x5951('0x9')]['code']===0x1f4){return _0x2392f8(_0x4e129b[_0x5951('0x9')][_0x5951('0xa')]);}return _0x9be70c(_0x4e129b[_0x5951('0x9')][_0x5951('0xa')]);}else{_0x9be70c(_0x4e129b[_0x5951('0xb')]);}})[_0x5951('0xc')](function(_0xf1e921){_0x2392f8(_0xf1e921);});});}function respondWithResult(_0x426c76,_0x387948){_0x387948=_0x387948||0xc8;return function(_0x5e82e8){if(_0x5e82e8){return _0x426c76[_0x5951('0xd')](_0x387948)[_0x5951('0xe')](_0x5e82e8);}return _0x426c76[_0x5951('0xf')](0x194);};}function handleError(_0x2db7cf,_0x4b9b70){_0x4b9b70=_0x4b9b70||0x1f4;return function(_0x9dcff3){logger[_0x5951('0x9')](_0x9dcff3[_0x5951('0x10')]);if(_0x9dcff3['name']){delete _0x9dcff3[_0x5951('0x11')];}_0x2db7cf['status'](_0x4b9b70)['send'](_0x9dcff3);};}function findById(_0x20eead){return function(_0x1a9e0c){if(!_[_0x5951('0x12')](_0x20eead)&&!_['isNil'](_0x1a9e0c)&&!_[_0x5951('0x12')](_0x1a9e0c['rows'])){return _[_0x5951('0x13')](_0x1a9e0c[_0x5951('0x14')],function(_0x3f30f3){return _0x3f30f3['id']==_0x20eead;});}return null;};}exports[_0x5951('0x15')]=function(_0x5212e9,_0x483314){return respondWithRpcPromise(_0x5951('0x16'),_0x5212e9['query'])[_0x5951('0x8')](respondWithResult(_0x483314,null))[_0x5951('0xc')](handleError(_0x483314,null));};exports['voiceChannelMixMonitor']=function(_0x177e8b,_0xbab1e3){return respondWithRpcPromise(_0x5951('0x17'),_[_0x5951('0x18')](_0x177e8b[_0x5951('0x19')],_0x177e8b[_0x5951('0x1a')]))[_0x5951('0x8')](respondWithResult(_0xbab1e3,null))[_0x5951('0xc')](handleError(_0xbab1e3,null));};exports[_0x5951('0x1b')]=function(_0x4a1721,_0x469a04){return respondWithRpcPromise(_0x5951('0x1c'),_[_0x5951('0x18')](_0x4a1721[_0x5951('0x19')],_0x4a1721[_0x5951('0x1a')]))[_0x5951('0x8')](respondWithResult(_0x469a04,null))[_0x5951('0xc')](handleError(_0x469a04,null));};exports[_0x5951('0x1d')]=function(_0x212570,_0x5f127c){return respondWithRpcPromise(_0x5951('0x1e'),_0x212570[_0x5951('0x19')])['then'](respondWithResult(_0x5f127c,null))[_0x5951('0xc')](handleError(_0x5f127c,null));};exports[_0x5951('0x1f')]=function(_0x4261bf,_0x39849e){return respondWithRpcPromise(_0x5951('0x1e'),_0x4261bf[_0x5951('0x19')])[_0x5951('0x8')](findById(_0x4261bf[_0x5951('0x1a')]['id']))[_0x5951('0x8')](respondWithResult(_0x39849e,null))[_0x5951('0xc')](handleError(_0x39849e,null));};exports[_0x5951('0x20')]=function(_0x295ebb,_0x2d7ca6){return respondWithRpcPromise(_0x5951('0x21'),_[_0x5951('0x18')](_0x295ebb[_0x5951('0x22')],_0x295ebb[_0x5951('0x1a')]))[_0x5951('0x8')](respondWithResult(_0x2d7ca6,null))[_0x5951('0xc')](handleError(_0x2d7ca6,null));};exports[_0x5951('0x23')]=function(_0x549db6,_0x42ca3a){return respondWithRpcPromise(_0x5951('0x24'),_[_0x5951('0x18')](_0x549db6[_0x5951('0x19')],_0x549db6['params']))[_0x5951('0x8')](respondWithResult(_0x42ca3a,null))[_0x5951('0xc')](handleError(_0x42ca3a,null));};exports[_0x5951('0x25')]=function(_0x439603,_0x10eed9){return respondWithRpcPromise(_0x5951('0x26'),_0x439603[_0x5951('0x19')])[_0x5951('0x8')](respondWithResult(_0x10eed9,null))[_0x5951('0xc')](handleError(_0x10eed9,null));};exports['voiceQueuesChannel']=function(_0x3078ee,_0x594f7c){return respondWithRpcPromise(_0x5951('0x27'),_[_0x5951('0x18')](_0x3078ee[_0x5951('0x19')],_0x3078ee[_0x5951('0x1a')]))[_0x5951('0x8')](respondWithResult(_0x594f7c,null))['catch'](handleError(_0x594f7c,null));};exports[_0x5951('0x28')]=function(_0x4a2142,_0x40ba14){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x5951('0x18')](_0x4a2142['query'],_0x4a2142['params']))[_0x5951('0x8')](respondWithResult(_0x40ba14,null))[_0x5951('0xc')](handleError(_0x40ba14,null));};exports[_0x5951('0x29')]=function(_0x1464a2,_0x23f94e){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x1464a2[_0x5951('0x19')],_0x1464a2[_0x5951('0x1a')]))['then'](respondWithResult(_0x23f94e,null))['catch'](handleError(_0x23f94e,null));};exports[_0x5951('0x2a')]=function(_0xa8b9bf,_0x24973b){return respondWithRpcPromise(_0x5951('0x2b'),_0xa8b9bf[_0x5951('0x19')])[_0x5951('0x8')](respondWithResult(_0x24973b,null))['catch'](handleError(_0x24973b,null));};exports[_0x5951('0x2c')]=function(_0x4f3296,_0x1288ab){return respondWithRpcPromise(_0x5951('0x2d'),_0x4f3296['query'])[_0x5951('0x8')](respondWithResult(_0x1288ab,null))[_0x5951('0xc')](handleError(_0x1288ab,null));};exports['agents']=function(_0x5c700f,_0x3f2ee5){var _0x1b79a3;return respondWithRpcPromise(_0x5951('0x2e'),_0x5c700f[_0x5951('0x19')])['then'](function(_0x57c64a){_0x1b79a3=_0x57c64a;return respondWithRpcPromise('Agents',_0x5c700f['query'],routingClient);})['then'](function(_0x370465){return _[_0x5951('0x18')]({},_0x370465,_0x1b79a3);})[_0x5951('0x8')](respondWithResult(_0x3f2ee5,null))[_0x5951('0xc')](handleError(_0x3f2ee5,null));};exports[_0x5951('0x2f')]=function(_0x163355,_0x25c899){if(_0x163355[_0x5951('0x22')]&&_0x163355[_0x5951('0x22')][_0x5951('0x30')]&&_0x163355[_0x5951('0x31')]&&_0x163355[_0x5951('0x31')]['name']){for(var _0x2988ff in _0x163355[_0x5951('0x22')][_0x5951('0x30')]){if(_0x163355['body'][_0x5951('0x30')][_0x5951('0x32')](_0x2988ff)){db[_0x5951('0x33')]['findAll']({'where':{'channel':_0x2988ff,'membername':_0x163355[_0x5951('0x31')][_0x5951('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x163355[_0x5951('0x22')]['interaction'][_0x2988ff]&&_0x163355[_0x5951('0x22')][_0x5951('0x30')][_0x2988ff][_0x5951('0x34')]?{'$notIn':_0x163355[_0x5951('0x22')]['interaction'][_0x2988ff]}:{'$ne':null}}})['then'](function(_0x3e7592){var _0x124704=moment()[_0x5951('0x35')](_0x5951('0x36'));for(var _0x15c3a1=0x0,_0x539972=_0x3e7592[_0x5951('0x34')];_0x15c3a1<_0x539972;_0x15c3a1+=0x1){_0x3e7592[_0x15c3a1]['updateAttributes']({'exitAt':_0x124704});}});for(var _0x13cb1a=0x0;_0x13cb1a<_0x163355['body'][_0x5951('0x30')][_0x2988ff][_0x5951('0x34')];_0x13cb1a+=0x1){db[_0x5951('0x33')][_0x5951('0x37')]({'where':{'channel':_0x2988ff,'membername':_0x163355['user']['name'],'type':'INTERACTION','uniqueid':_0x163355[_0x5951('0x22')][_0x5951('0x30')][_0x2988ff][_0x13cb1a],'exitAt':null},'defaults':{'channel':_0x2988ff,'membername':_0x163355['user'][_0x5951('0x11')],'interface':_[_0x5951('0x12')](_0x163355[_0x5951('0x31')]['interface'])?util[_0x5951('0x35')](_0x5951('0x38'),_0x163355[_0x5951('0x31')]['name']):_0x163355[_0x5951('0x31')][_0x5951('0x39')],'type':_0x5951('0x3a'),'enterAt':moment()[_0x5951('0x35')](_0x5951('0x36')),'role':'agent','internal':_0x163355['user'][_0x5951('0x3b')],'uniqueid':_0x163355[_0x5951('0x22')][_0x5951('0x30')][_0x2988ff][_0x13cb1a]}});}}}}return respondWithRpcPromise(_0x5951('0x3c'),{'id':_0x163355[_0x5951('0x1a')]['id'],'capacity':_0x163355['body']['capacity']},routingClient)[_0x5951('0x8')](respondWithResult(_0x25c899,null))[_0x5951('0xc')](handleError(_0x25c899,null));};exports['telephones']=function(_0x1bd64b,_0x417132){return respondWithRpcPromise(_0x5951('0x3d'),_0x1bd64b[_0x5951('0x19')])[_0x5951('0x8')](respondWithResult(_0x417132,null))['catch'](handleError(_0x417132,null));};exports[_0x5951('0x3e')]=function(_0x1576d8,_0xb249d8){return respondWithRpcPromise('Trunks',_0x1576d8[_0x5951('0x19')])[_0x5951('0x8')](respondWithResult(_0xb249d8,null))['catch'](handleError(_0xb249d8,null));};exports[_0x5951('0x3f')]=function(_0x43986d,_0x314f5a){return respondWithRpcPromise('Campaigns',_0x43986d['query'])[_0x5951('0x8')](respondWithResult(_0x314f5a,null))['catch'](handleError(_0x314f5a,null));};exports[_0x5951('0x40')]=function(_0x8d6a1f,_0x5885a){return respondWithRpcPromise(_0x5951('0x41'),_0x8d6a1f[_0x5951('0x19')],routingClient)[_0x5951('0x8')](respondWithResult(_0x5885a,null))[_0x5951('0xc')](handleError(_0x5885a,null));};exports[_0x5951('0x42')]=function(_0x464887,_0x9fb8f9){return respondWithRpcPromise('ChatQueues',_0x464887[_0x5951('0x19')],routingClient)[_0x5951('0x8')](findById(_0x464887[_0x5951('0x1a')]['id']))[_0x5951('0x8')](respondWithResult(_0x9fb8f9,null))['catch'](handleError(_0x9fb8f9,null));};exports[_0x5951('0x43')]=function(_0x15ba8c,_0x50098f){return respondWithRpcPromise(_0x5951('0x44'),_0x15ba8c[_0x5951('0x19')],routingClient)['then'](respondWithResult(_0x50098f,null))[_0x5951('0xc')](handleError(_0x50098f,null));};exports[_0x5951('0x45')]=function(_0x11cfb8,_0x46a124){return respondWithRpcPromise('MailQueues',_0x11cfb8['query'],routingClient)[_0x5951('0x8')](findById(_0x11cfb8['params']['id']))[_0x5951('0x8')](respondWithResult(_0x46a124,null))[_0x5951('0xc')](handleError(_0x46a124,null));};exports['mailAccounts']=function(_0x490b65,_0x3d4910){return respondWithRpcPromise(_0x5951('0x46'),_0x490b65[_0x5951('0x19')],mailClient)[_0x5951('0x8')](respondWithResult(_0x3d4910,null))[_0x5951('0xc')](handleError(_0x3d4910,null));};exports[_0x5951('0x47')]=function(_0x41ae54,_0x18b205){return respondWithRpcPromise(_0x5951('0x48'),_0x41ae54[_0x5951('0x19')],routingClient)[_0x5951('0x8')](respondWithResult(_0x18b205,null))[_0x5951('0xc')](handleError(_0x18b205,null));};exports[_0x5951('0x49')]=function(_0x292230,_0x2db786){return respondWithRpcPromise(_0x5951('0x48'),_0x292230[_0x5951('0x19')],routingClient)[_0x5951('0x8')](findById(_0x292230[_0x5951('0x1a')]['id']))[_0x5951('0x8')](respondWithResult(_0x2db786,null))['catch'](handleError(_0x2db786,null));};exports[_0x5951('0x4a')]=function(_0x11df2e,_0x356a8f){return respondWithRpcPromise(_0x5951('0x4b'),_0x11df2e[_0x5951('0x19')],routingClient)[_0x5951('0x8')](respondWithResult(_0x356a8f,null))[_0x5951('0xc')](handleError(_0x356a8f,null));};exports[_0x5951('0x4c')]=function(_0x1dcf1c,_0x173ac3){return respondWithRpcPromise(_0x5951('0x4b'),_0x1dcf1c[_0x5951('0x19')],routingClient)[_0x5951('0x8')](findById(_0x1dcf1c[_0x5951('0x1a')]['id']))[_0x5951('0x8')](respondWithResult(_0x173ac3,null))[_0x5951('0xc')](handleError(_0x173ac3,null));};exports[_0x5951('0x4d')]=function(_0x129ff1,_0x419ea7){return respondWithRpcPromise(_0x5951('0x4e'),_0x129ff1[_0x5951('0x19')],routingClient)[_0x5951('0x8')](respondWithResult(_0x419ea7,null))[_0x5951('0xc')](handleError(_0x419ea7,null));};exports[_0x5951('0x4f')]=function(_0x224d35,_0x254ebd){return respondWithRpcPromise('WhatsappQueues',_0x224d35[_0x5951('0x19')],routingClient)[_0x5951('0x8')](findById(_0x224d35[_0x5951('0x1a')]['id']))['then'](respondWithResult(_0x254ebd,null))[_0x5951('0xc')](handleError(_0x254ebd,null));};exports[_0x5951('0x50')]=function(_0x123184,_0x44f551){return respondWithRpcPromise('FaxQueues',_0x123184[_0x5951('0x19')],routingClient)[_0x5951('0x8')](respondWithResult(_0x44f551,null))[_0x5951('0xc')](handleError(_0x44f551,null));};exports[_0x5951('0x51')]=function(_0x17d270,_0x994a53){return respondWithRpcPromise('FaxQueues',_0x17d270['query'],routingClient)[_0x5951('0x8')](findById(_0x17d270['params']['id']))['then'](respondWithResult(_0x994a53,null))[_0x5951('0xc')](handleError(_0x994a53,null));};exports['faxAccounts']=function(_0x432c19,_0x5c8b32){return respondWithRpcPromise(_0x5951('0x52'),_0x432c19[_0x5951('0x19')])[_0x5951('0x8')](respondWithResult(_0x5c8b32,null))['catch'](handleError(_0x5c8b32,null));};exports[_0x5951('0x53')]=function(_0x5b0118,_0x11c424){return respondWithRpcPromise(_0x5951('0x54'),_0x5b0118[_0x5951('0x19')],routingClient)[_0x5951('0x8')](respondWithResult(_0x11c424,null))[_0x5951('0xc')](handleError(_0x11c424,null));};exports[_0x5951('0x55')]=function(_0x380e1b,_0x329100){return respondWithRpcPromise(_0x5951('0x56'),_0x380e1b['query'],routingClient)['then'](respondWithResult(_0x329100,null))[_0x5951('0xc')](handleError(_0x329100,null));};exports[_0x5951('0x57')]=function(_0x2be5e4,_0x5f3a39){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2be5e4[_0x5951('0x19')],routingClient)[_0x5951('0x8')](respondWithResult(_0x5f3a39,null))[_0x5951('0xc')](handleError(_0x5f3a39,null));};exports[_0x5951('0x58')]=function(_0x467c03,_0x2f3f68){return respondWithRpcPromise(_0x5951('0x59'),_0x467c03[_0x5951('0x19')],routingClient)[_0x5951('0x8')](function(_0x547595){if(_0x467c03[_0x5951('0x19')]['type']!==undefined){var _0x59823f=_(_0x547595[_0x5951('0x14')])['filter']([_0x467c03[_0x5951('0x19')]['type'],_0x467c03[_0x5951('0x1a')]['id']])['map'](_0x5951('0x5a'))['uniq']()[_0x5951('0x5b')]();return _0x547595[_0x5951('0x14')][_0x5951('0x5c')](function(_0x496755){return _0x59823f[_0x5951('0x5d')](_0x496755[_0x5951('0x5a')])>-0x1;});}else{return _0x547595[_0x5951('0x14')]['filter'](function(_0x1f105d){return _0x1f105d['queue_id']===parseInt(_0x467c03[_0x5951('0x1a')]['id']);});}})['then'](respondWithResult(_0x2f3f68,null))[_0x5951('0xc')](handleError(_0x2f3f68,null));};exports['smsQueuesWaitingInteractions']=function(_0x192c50,_0x5cbe0d){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x192c50[_0x5951('0x19')],routingClient)[_0x5951('0x8')](respondWithResult(_0x5cbe0d,null))[_0x5951('0xc')](handleError(_0x5cbe0d,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x55c7b2,_0x51ac8b){return respondWithRpcPromise(_0x5951('0x5e'),_0x55c7b2['query'],routingClient)[_0x5951('0x8')](respondWithResult(_0x51ac8b,null))[_0x5951('0xc')](handleError(_0x51ac8b,null));};exports['faxQueuesWaitingInteractions']=function(_0x2851de,_0x4a85c8){return respondWithRpcPromise(_0x5951('0x5f'),_0x2851de['query'],routingClient)['then'](respondWithResult(_0x4a85c8,null))[_0x5951('0xc')](handleError(_0x4a85c8,null));};exports[_0x5951('0x60')]=function(_0x292953){return function(_0x15f652,_0x2da6b1){var _0x2229e9,_0x291cad;var _0x5caff3=_[_0x5951('0x61')](_0x292953);var _0x4f6f73=_0x292953===_0x5951('0x62')?_0x5951('0x63'):_0x5951('0x64');return db[_0x5caff3+_0x5951('0x65')]['findOne']({'raw':!![],'where':{'id':_0x15f652['params']['id']}})['then'](function(_0x15aece){if(_[_0x5951('0x12')](_0x15aece)){throw new Error(_0x5caff3+'\x20Queue\x20not\x20found');}_0x2229e9=_0x15aece;return db[_0x5caff3+'Message'][_0x5951('0x66')]({'where':{'id':_0x15f652[_0x5951('0x22')][_0x5951('0x67')]},'include':[{'model':db[_0x5caff3+'Interaction'],'as':'Interaction'},{'model':db[_0x5caff3+_0x4f6f73],'as':_0x5951('0x64')}]});})[_0x5951('0x8')](function(_0xd26e8f){if(_[_0x5951('0x12')](_0xd26e8f)){throw new Error(_0x5caff3+_0x5951('0x68'));}_0x291cad=_0xd26e8f;return _0xd26e8f['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5951('0x8')](function(){var _0x21689f={'uniqueid':_0x292953+'.'+_0x291cad['id']+'.'+_0x291cad['Interaction']['id'],'FromUserId':_0x15f652[_0x5951('0x31')]['id'],'type':_0x5951('0x69')};_0x21689f[_0x5caff3+_0x5951('0x6a')]=_0x291cad['id'];_0x21689f[_0x5caff3+_0x5951('0x6b')]=_0x291cad['Interaction']['id'];_0x21689f['From'+_0x5caff3+_0x4f6f73+'Id']=_0x291cad['Account']['id'];_0x21689f['To'+_0x5caff3+'QueueId']=_0x2229e9['id'];return db[_0x5caff3+_0x5951('0x6c')][_0x5951('0x6d')](_0x21689f);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x292953,'interaction':_0x291cad[_0x5951('0x6e')],'message':_0x291cad,'account':_0x291cad['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2229e9[_0x5951('0x11')]+','+(_0x291cad[_0x5951('0x64')]['queueTransferTimeout']||0x12c),'interval':_0x5951('0x6f')}]},routingClient);})[_0x5951('0x8')](respondWithResult(_0x2da6b1,null))[_0x5951('0xc')](handleError(_0x2da6b1,null));};};exports[_0x5951('0x70')]=function(_0x50e4ac,_0x58d36f){var _0xa3165b,_0x1bfe6c;if(_[_0x5951('0x12')](_0x50e4ac[_0x5951('0x22')][_0x5951('0x71')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x8469f8=_0x50e4ac[_0x5951('0x22')]['channel'];var _0x240607=_[_0x5951('0x61')](_0x8469f8);var _0x3760e7=_0x8469f8===_0x5951('0x62')?'Website':'Account';return db[_0x5951('0x72')]['findOne']({'raw':!![],'where':{'id':_0x50e4ac['params']['id'],'role':_0x5951('0x73')}})[_0x5951('0x8')](function(_0x44aab9){if(_['isNil'](_0x44aab9)){throw new Error(_0x5951('0x74'));}_0xa3165b=_0x44aab9;return db[_0x240607+'Message'][_0x5951('0x66')]({'where':{'id':_0x50e4ac['body'][_0x5951('0x67')]},'include':[{'model':db[_0x240607+'Interaction'],'as':'Interaction'},{'model':db[_0x240607+_0x3760e7],'as':_0x5951('0x64')}]});})[_0x5951('0x8')](function(_0x32cb73){if(_[_0x5951('0x12')](_0x32cb73)){throw new Error(_0x240607+_0x5951('0x68'));}_0x1bfe6c=_0x32cb73;return _0x32cb73['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5951('0x8')](function(){var _0x3f70cf={'uniqueid':_0x8469f8+'.'+_0x1bfe6c['id']+'.'+_0x1bfe6c[_0x5951('0x6e')]['id'],'FromUserId':_0x50e4ac[_0x5951('0x31')]['id'],'type':_0x5951('0x69'),'ToUserId':_0xa3165b['id']};_0x3f70cf[_0x240607+_0x5951('0x6a')]=_0x1bfe6c['id'];_0x3f70cf[_0x240607+_0x5951('0x6b')]=_0x1bfe6c['Interaction']['id'];_0x3f70cf[_0x5951('0x75')+_0x240607+_0x3760e7+'Id']=_0x1bfe6c[_0x5951('0x64')]['id'];return db[_0x240607+_0x5951('0x6c')]['create'](_0x3f70cf);})[_0x5951('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x8469f8,'interaction':_0x1bfe6c[_0x5951('0x6e')],'message':_0x1bfe6c,'account':_0x1bfe6c[_0x5951('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5951('0x73'),'appdata':_0xa3165b[_0x5951('0x11')]+','+(_0x1bfe6c[_0x5951('0x64')][_0x5951('0x76')]||0x12c),'interval':_0x5951('0x6f')}]},routingClient);})[_0x5951('0x8')](respondWithResult(_0x58d36f,null))[_0x5951('0xc')](handleError(_0x58d36f,null));}; \ No newline at end of file +var _0xeff1=['FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','Channel\x20field\x20is\x20mandatory','chat','Website','Agent\x20not\x20found','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','http','client','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','interaction','user','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0xeff1,0x198));var _0x1eff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeff1[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x1eff('0x0'));var moment=require('moment');var _=require(_0x1eff('0x1'));var util=require(_0x1eff('0x2'));var db=require(_0x1eff('0x3'))['db'];var logger=require('../../config/logger')(_0x1eff('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x1eff('0x5')]({'port':0x232a});var mailClient=jayson['client'][_0x1eff('0x5')]({'port':0x232b});var routingClient=jayson[_0x1eff('0x6')][_0x1eff('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x59421c,_0x1ae531,_0x12ca61){return new BPromise(function(_0x5b4d38,_0x41c656){var _0x1342ae=_0x12ca61?_0x12ca61:amiClient;return _0x1342ae[_0x1eff('0x7')](_0x59421c,_0x1ae531)[_0x1eff('0x8')](function(_0x5d1a2c){if(_0x5d1a2c[_0x1eff('0x9')]){if(_0x5d1a2c[_0x1eff('0x9')][_0x1eff('0xa')]===0x1f4){return _0x41c656(_0x5d1a2c[_0x1eff('0x9')][_0x1eff('0xb')]);}return _0x5b4d38(_0x5d1a2c[_0x1eff('0x9')][_0x1eff('0xb')]);}else{_0x5b4d38(_0x5d1a2c[_0x1eff('0xc')]);}})[_0x1eff('0xd')](function(_0x447f8a){_0x41c656(_0x447f8a);});});}function respondWithResult(_0x3c394c,_0x5cc042){_0x5cc042=_0x5cc042||0xc8;return function(_0x5a5c35){if(_0x5a5c35){return _0x3c394c[_0x1eff('0xe')](_0x5cc042)['json'](_0x5a5c35);}return _0x3c394c[_0x1eff('0xf')](0x194);};}function handleError(_0x4cf7ed,_0x41f75f){_0x41f75f=_0x41f75f||0x1f4;return function(_0x1f0de4){logger['error'](_0x1f0de4[_0x1eff('0x10')]);if(_0x1f0de4[_0x1eff('0x11')]){delete _0x1f0de4['name'];}_0x4cf7ed['status'](_0x41f75f)[_0x1eff('0x12')](_0x1f0de4);};}function findById(_0x3e1867){return function(_0x184a0b){if(!_[_0x1eff('0x13')](_0x3e1867)&&!_[_0x1eff('0x13')](_0x184a0b)&&!_[_0x1eff('0x13')](_0x184a0b[_0x1eff('0x14')])){return _['find'](_0x184a0b['rows'],function(_0x3abfb3){return _0x3abfb3['id']==_0x3e1867;});}return null;};}exports[_0x1eff('0x15')]=function(_0x5889a8,_0x38a9cc){return respondWithRpcPromise(_0x1eff('0x16'),_0x5889a8[_0x1eff('0x17')])[_0x1eff('0x8')](respondWithResult(_0x38a9cc,null))['catch'](handleError(_0x38a9cc,null));};exports[_0x1eff('0x18')]=function(_0x3b1e0a,_0x36e8d4){return respondWithRpcPromise(_0x1eff('0x19'),_['merge'](_0x3b1e0a['query'],_0x3b1e0a['params']))[_0x1eff('0x8')](respondWithResult(_0x36e8d4,null))[_0x1eff('0xd')](handleError(_0x36e8d4,null));};exports[_0x1eff('0x1a')]=function(_0x2cee09,_0xa0964d){return respondWithRpcPromise(_0x1eff('0x1b'),_[_0x1eff('0x1c')](_0x2cee09[_0x1eff('0x17')],_0x2cee09[_0x1eff('0x1d')]))[_0x1eff('0x8')](respondWithResult(_0xa0964d,null))[_0x1eff('0xd')](handleError(_0xa0964d,null));};exports[_0x1eff('0x1e')]=function(_0x2a721a,_0x38197e){return respondWithRpcPromise(_0x1eff('0x1f'),_0x2a721a['query'])[_0x1eff('0x8')](respondWithResult(_0x38197e,null))[_0x1eff('0xd')](handleError(_0x38197e,null));};exports[_0x1eff('0x20')]=function(_0x4ab014,_0x3b40cb){return respondWithRpcPromise(_0x1eff('0x1f'),_0x4ab014[_0x1eff('0x17')])[_0x1eff('0x8')](findById(_0x4ab014[_0x1eff('0x1d')]['id']))[_0x1eff('0x8')](respondWithResult(_0x3b40cb,null))[_0x1eff('0xd')](handleError(_0x3b40cb,null));};exports['updateVoiceQueue']=function(_0x225b93,_0x49601c){return respondWithRpcPromise(_0x1eff('0x21'),_[_0x1eff('0x1c')](_0x225b93[_0x1eff('0x22')],_0x225b93[_0x1eff('0x1d')]))[_0x1eff('0x8')](respondWithResult(_0x49601c,null))['catch'](handleError(_0x49601c,null));};exports[_0x1eff('0x23')]=function(_0x50211f,_0x12b150){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x1eff('0x1c')](_0x50211f[_0x1eff('0x17')],_0x50211f[_0x1eff('0x1d')]))[_0x1eff('0x8')](respondWithResult(_0x12b150,null))[_0x1eff('0xd')](handleError(_0x12b150,null));};exports['voiceQueuesChannels']=function(_0x2b4ab8,_0x1ec7e9){return respondWithRpcPromise(_0x1eff('0x24'),_0x2b4ab8['query'])['then'](respondWithResult(_0x1ec7e9,null))['catch'](handleError(_0x1ec7e9,null));};exports[_0x1eff('0x25')]=function(_0x25f268,_0x50a831){return respondWithRpcPromise(_0x1eff('0x26'),_[_0x1eff('0x1c')](_0x25f268['query'],_0x25f268['params']))[_0x1eff('0x8')](respondWithResult(_0x50a831,null))[_0x1eff('0xd')](handleError(_0x50a831,null));};exports[_0x1eff('0x27')]=function(_0x38ce5a,_0x596cde){return respondWithRpcPromise(_0x1eff('0x28'),_[_0x1eff('0x1c')](_0x38ce5a[_0x1eff('0x17')],_0x38ce5a[_0x1eff('0x1d')]))[_0x1eff('0x8')](respondWithResult(_0x596cde,null))['catch'](handleError(_0x596cde,null));};exports[_0x1eff('0x29')]=function(_0x50fb39,_0x349933){return respondWithRpcPromise(_0x1eff('0x2a'),_['merge'](_0x50fb39['query'],_0x50fb39[_0x1eff('0x1d')]))[_0x1eff('0x8')](respondWithResult(_0x349933,null))[_0x1eff('0xd')](handleError(_0x349933,null));};exports[_0x1eff('0x2b')]=function(_0x4dcb79,_0x36ff74){return respondWithRpcPromise(_0x1eff('0x2c'),_0x4dcb79[_0x1eff('0x17')])[_0x1eff('0x8')](respondWithResult(_0x36ff74,null))['catch'](handleError(_0x36ff74,null));};exports['outboundChannels']=function(_0x2736bd,_0x5dc283){return respondWithRpcPromise(_0x1eff('0x2d'),_0x2736bd[_0x1eff('0x17')])['then'](respondWithResult(_0x5dc283,null))['catch'](handleError(_0x5dc283,null));};exports[_0x1eff('0x2e')]=function(_0x5a508a,_0x52f8e6){var _0x5aff5b;return respondWithRpcPromise('Agents',_0x5a508a[_0x1eff('0x17')])[_0x1eff('0x8')](function(_0x21f667){_0x5aff5b=_0x21f667;return respondWithRpcPromise(_0x1eff('0x2f'),_0x5a508a[_0x1eff('0x17')],routingClient);})['then'](function(_0x22325d){return _[_0x1eff('0x1c')]({},_0x22325d,_0x5aff5b);})['then'](respondWithResult(_0x52f8e6,null))[_0x1eff('0xd')](handleError(_0x52f8e6,null));};exports['agentCapacity']=function(_0x27c298,_0x125209){if(_0x27c298['body']&&_0x27c298[_0x1eff('0x22')][_0x1eff('0x30')]&&_0x27c298[_0x1eff('0x31')]&&_0x27c298['user'][_0x1eff('0x11')]){for(var _0x31e649 in _0x27c298[_0x1eff('0x22')]['interaction']){if(_0x27c298['body'][_0x1eff('0x30')][_0x1eff('0x32')](_0x31e649)){db['MemberReport'][_0x1eff('0x33')]({'where':{'channel':_0x31e649,'membername':_0x27c298['user'][_0x1eff('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x27c298[_0x1eff('0x22')][_0x1eff('0x30')][_0x31e649]&&_0x27c298[_0x1eff('0x22')][_0x1eff('0x30')][_0x31e649][_0x1eff('0x34')]?{'$notIn':_0x27c298[_0x1eff('0x22')][_0x1eff('0x30')][_0x31e649]}:{'$ne':null}}})[_0x1eff('0x8')](function(_0xc77f37){var _0x460dab=moment()[_0x1eff('0x35')](_0x1eff('0x36'));for(var _0x45532e=0x0,_0x48e81a=_0xc77f37[_0x1eff('0x34')];_0x45532e<_0x48e81a;_0x45532e+=0x1){_0xc77f37[_0x45532e][_0x1eff('0x37')]({'exitAt':_0x460dab});}});for(var _0x18e6dc=0x0;_0x18e6dc<_0x27c298['body'][_0x1eff('0x30')][_0x31e649]['length'];_0x18e6dc+=0x1){db['MemberReport'][_0x1eff('0x38')]({'where':{'channel':_0x31e649,'membername':_0x27c298[_0x1eff('0x31')]['name'],'type':_0x1eff('0x39'),'uniqueid':_0x27c298['body'][_0x1eff('0x30')][_0x31e649][_0x18e6dc],'exitAt':null},'defaults':{'channel':_0x31e649,'membername':_0x27c298[_0x1eff('0x31')][_0x1eff('0x11')],'interface':_[_0x1eff('0x13')](_0x27c298['user'][_0x1eff('0x3a')])?util[_0x1eff('0x35')]('SIP/%s',_0x27c298[_0x1eff('0x31')][_0x1eff('0x11')]):_0x27c298[_0x1eff('0x31')][_0x1eff('0x3a')],'type':_0x1eff('0x39'),'enterAt':moment()[_0x1eff('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1eff('0x3b'),'internal':_0x27c298[_0x1eff('0x31')][_0x1eff('0x3c')],'uniqueid':_0x27c298[_0x1eff('0x22')][_0x1eff('0x30')][_0x31e649][_0x18e6dc]}});}}}}return respondWithRpcPromise(_0x1eff('0x3d'),{'id':_0x27c298[_0x1eff('0x1d')]['id'],'capacity':_0x27c298[_0x1eff('0x22')][_0x1eff('0x3e')]},routingClient)['then'](respondWithResult(_0x125209,null))[_0x1eff('0xd')](handleError(_0x125209,null));};exports[_0x1eff('0x3f')]=function(_0xd8755b,_0x3fb272){return respondWithRpcPromise(_0x1eff('0x40'),_0xd8755b['query'])['then'](respondWithResult(_0x3fb272,null))['catch'](handleError(_0x3fb272,null));};exports[_0x1eff('0x41')]=function(_0x1f74bc,_0x51a824){return respondWithRpcPromise(_0x1eff('0x42'),_0x1f74bc[_0x1eff('0x17')])[_0x1eff('0x8')](respondWithResult(_0x51a824,null))[_0x1eff('0xd')](handleError(_0x51a824,null));};exports[_0x1eff('0x43')]=function(_0x22a045,_0x362ded){return respondWithRpcPromise(_0x1eff('0x44'),_0x22a045[_0x1eff('0x17')])[_0x1eff('0x8')](respondWithResult(_0x362ded,null))[_0x1eff('0xd')](handleError(_0x362ded,null));};exports[_0x1eff('0x45')]=function(_0x534ad8,_0x111458){return respondWithRpcPromise('ChatQueues',_0x534ad8[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](respondWithResult(_0x111458,null))['catch'](handleError(_0x111458,null));};exports['showChatQueues']=function(_0x922736,_0x4741af){return respondWithRpcPromise(_0x1eff('0x46'),_0x922736[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](findById(_0x922736['params']['id']))[_0x1eff('0x8')](respondWithResult(_0x4741af,null))[_0x1eff('0xd')](handleError(_0x4741af,null));};exports['mailQueues']=function(_0x18275a,_0x25b503){return respondWithRpcPromise('MailQueues',_0x18275a['query'],routingClient)[_0x1eff('0x8')](respondWithResult(_0x25b503,null))[_0x1eff('0xd')](handleError(_0x25b503,null));};exports[_0x1eff('0x47')]=function(_0x167821,_0x2dce07){return respondWithRpcPromise(_0x1eff('0x48'),_0x167821[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](findById(_0x167821['params']['id']))['then'](respondWithResult(_0x2dce07,null))[_0x1eff('0xd')](handleError(_0x2dce07,null));};exports[_0x1eff('0x49')]=function(_0x209da5,_0x26b987){return respondWithRpcPromise(_0x1eff('0x4a'),_0x209da5[_0x1eff('0x17')],mailClient)[_0x1eff('0x8')](respondWithResult(_0x26b987,null))['catch'](handleError(_0x26b987,null));};exports[_0x1eff('0x4b')]=function(_0x3f6f69,_0x3a148c){return respondWithRpcPromise('OpenchannelQueues',_0x3f6f69['query'],routingClient)['then'](respondWithResult(_0x3a148c,null))[_0x1eff('0xd')](handleError(_0x3a148c,null));};exports[_0x1eff('0x4c')]=function(_0x8d8254,_0x1a4e62){return respondWithRpcPromise('OpenchannelQueues',_0x8d8254[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](findById(_0x8d8254[_0x1eff('0x1d')]['id']))[_0x1eff('0x8')](respondWithResult(_0x1a4e62,null))[_0x1eff('0xd')](handleError(_0x1a4e62,null));};exports[_0x1eff('0x4d')]=function(_0x324255,_0x4d6a69){return respondWithRpcPromise(_0x1eff('0x4e'),_0x324255[_0x1eff('0x17')],routingClient)['then'](respondWithResult(_0x4d6a69,null))[_0x1eff('0xd')](handleError(_0x4d6a69,null));};exports['showSmsQueues']=function(_0x4b7309,_0x56736e){return respondWithRpcPromise(_0x1eff('0x4e'),_0x4b7309[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](findById(_0x4b7309['params']['id']))[_0x1eff('0x8')](respondWithResult(_0x56736e,null))[_0x1eff('0xd')](handleError(_0x56736e,null));};exports['whatsappQueues']=function(_0x42eebf,_0x8d21e4){return respondWithRpcPromise('WhatsappQueues',_0x42eebf['query'],routingClient)['then'](respondWithResult(_0x8d21e4,null))['catch'](handleError(_0x8d21e4,null));};exports[_0x1eff('0x4f')]=function(_0x349d6e,_0xbb1a){return respondWithRpcPromise('WhatsappQueues',_0x349d6e[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](findById(_0x349d6e['params']['id']))[_0x1eff('0x8')](respondWithResult(_0xbb1a,null))[_0x1eff('0xd')](handleError(_0xbb1a,null));};exports[_0x1eff('0x50')]=function(_0x2d6518,_0x57bc9f){return respondWithRpcPromise(_0x1eff('0x51'),_0x2d6518[_0x1eff('0x17')],routingClient)['then'](respondWithResult(_0x57bc9f,null))[_0x1eff('0xd')](handleError(_0x57bc9f,null));};exports[_0x1eff('0x52')]=function(_0x56164b,_0x561169){return respondWithRpcPromise(_0x1eff('0x51'),_0x56164b[_0x1eff('0x17')],routingClient)['then'](findById(_0x56164b[_0x1eff('0x1d')]['id']))[_0x1eff('0x8')](respondWithResult(_0x561169,null))['catch'](handleError(_0x561169,null));};exports[_0x1eff('0x53')]=function(_0x1cc57f,_0x3e747f){return respondWithRpcPromise(_0x1eff('0x54'),_0x1cc57f[_0x1eff('0x17')])[_0x1eff('0x8')](respondWithResult(_0x3e747f,null))[_0x1eff('0xd')](handleError(_0x3e747f,null));};exports[_0x1eff('0x55')]=function(_0xeba95,_0x4f416a){return respondWithRpcPromise(_0x1eff('0x56'),_0xeba95[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](respondWithResult(_0x4f416a,null))['catch'](handleError(_0x4f416a,null));};exports[_0x1eff('0x57')]=function(_0x211000,_0x21a78b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x211000[_0x1eff('0x17')],routingClient)['then'](respondWithResult(_0x21a78b,null))['catch'](handleError(_0x21a78b,null));};exports[_0x1eff('0x58')]=function(_0x3c03bf,_0x4f69dd){return respondWithRpcPromise(_0x1eff('0x59'),_0x3c03bf['query'],routingClient)[_0x1eff('0x8')](respondWithResult(_0x4f69dd,null))[_0x1eff('0xd')](handleError(_0x4f69dd,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4a2d93,_0x2fea71){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4a2d93[_0x1eff('0x17')],routingClient)['then'](function(_0x3075df){if(_0x4a2d93[_0x1eff('0x17')][_0x1eff('0x5a')]!==undefined){var _0x521c22=_(_0x3075df[_0x1eff('0x14')])[_0x1eff('0x5b')]([_0x4a2d93[_0x1eff('0x17')]['type'],_0x4a2d93[_0x1eff('0x1d')]['id']])['map']('queue_id')['uniq']()['value']();return _0x3075df[_0x1eff('0x14')]['filter'](function(_0x9a9593){return _0x521c22[_0x1eff('0x5c')](_0x9a9593[_0x1eff('0x5d')])>-0x1;});}else{return _0x3075df[_0x1eff('0x14')][_0x1eff('0x5b')](function(_0x5f411c){return _0x5f411c[_0x1eff('0x5d')]===parseInt(_0x4a2d93[_0x1eff('0x1d')]['id']);});}})[_0x1eff('0x8')](respondWithResult(_0x2fea71,null))[_0x1eff('0xd')](handleError(_0x2fea71,null));};exports[_0x1eff('0x5e')]=function(_0x4e694b,_0x409506){return respondWithRpcPromise(_0x1eff('0x5f'),_0x4e694b['query'],routingClient)[_0x1eff('0x8')](respondWithResult(_0x409506,null))['catch'](handleError(_0x409506,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2348a0,_0xbb91bc){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2348a0[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](respondWithResult(_0xbb91bc,null))[_0x1eff('0xd')](handleError(_0xbb91bc,null));};exports[_0x1eff('0x60')]=function(_0x307e19,_0x4ef25f){return respondWithRpcPromise(_0x1eff('0x61'),_0x307e19[_0x1eff('0x17')],routingClient)[_0x1eff('0x8')](respondWithResult(_0x4ef25f,null))[_0x1eff('0xd')](handleError(_0x4ef25f,null));};exports[_0x1eff('0x62')]=function(_0x53406a){return function(_0x3c2a5c,_0x1533c2){var _0xd05a51,_0xdc9af7;var _0x522f1d=_[_0x1eff('0x63')](_0x53406a);var _0x5b9068=_0x53406a==='chat'?'Website':_0x1eff('0x64');return db[_0x522f1d+_0x1eff('0x65')][_0x1eff('0x66')]({'raw':!![],'where':{'id':_0x3c2a5c[_0x1eff('0x1d')]['id']}})['then'](function(_0x206e5d){if(_['isNil'](_0x206e5d)){throw new Error(_0x522f1d+_0x1eff('0x67'));}_0xd05a51=_0x206e5d;return db[_0x522f1d+_0x1eff('0x68')]['findOne']({'where':{'id':_0x3c2a5c[_0x1eff('0x22')]['messageId']},'include':[{'model':db[_0x522f1d+_0x1eff('0x69')],'as':'Interaction'},{'model':db[_0x522f1d+_0x5b9068],'as':_0x1eff('0x64')}]});})[_0x1eff('0x8')](function(_0x4e0dbb){if(_[_0x1eff('0x13')](_0x4e0dbb)){throw new Error(_0x522f1d+'\x20Message\x20not\x20found');}_0xdc9af7=_0x4e0dbb;return _0x4e0dbb[_0x1eff('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1eff('0x8')](function(){var _0x351fcb={'uniqueid':_0x53406a+'.'+_0xdc9af7['id']+'.'+_0xdc9af7[_0x1eff('0x69')]['id'],'FromUserId':_0x3c2a5c['user']['id'],'type':_0x1eff('0x6b')};_0x351fcb[_0x522f1d+_0x1eff('0x6c')]=_0xdc9af7['id'];_0x351fcb[_0x522f1d+_0x1eff('0x6d')]=_0xdc9af7[_0x1eff('0x69')]['id'];_0x351fcb[_0x1eff('0x6e')+_0x522f1d+_0x5b9068+'Id']=_0xdc9af7[_0x1eff('0x64')]['id'];_0x351fcb['To'+_0x522f1d+_0x1eff('0x6f')]=_0xd05a51['id'];return db[_0x522f1d+_0x1eff('0x70')][_0x1eff('0x71')](_0x351fcb);})[_0x1eff('0x8')](function(){return respondWithRpcPromise(_0x1eff('0x72'),{'channel':_0x53406a,'interaction':_0xdc9af7[_0x1eff('0x69')],'message':_0xdc9af7,'account':_0xdc9af7['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1eff('0x6b'),'appdata':_0xd05a51[_0x1eff('0x11')]+','+(_0xdc9af7['Account'][_0x1eff('0x73')]||0x12c),'interval':_0x1eff('0x74')}]},routingClient);})['then'](respondWithResult(_0x1533c2,null))[_0x1eff('0xd')](handleError(_0x1533c2,null));};};exports['agentNotify']=function(_0x1a1662,_0x3e08e4){var _0x119f5e,_0x2eee85;if(_[_0x1eff('0x13')](_0x1a1662[_0x1eff('0x22')]['channel'])){throw new Error(_0x1eff('0x75'));}var _0x58d21f=_0x1a1662[_0x1eff('0x22')]['channel'];var _0x59c1f9=_[_0x1eff('0x63')](_0x58d21f);var _0xb8d78d=_0x58d21f===_0x1eff('0x76')?_0x1eff('0x77'):_0x1eff('0x64');return db['User'][_0x1eff('0x66')]({'raw':!![],'where':{'id':_0x1a1662[_0x1eff('0x1d')]['id'],'role':_0x1eff('0x3b')}})[_0x1eff('0x8')](function(_0x26ba60){if(_[_0x1eff('0x13')](_0x26ba60)){throw new Error(_0x1eff('0x78'));}_0x119f5e=_0x26ba60;return db[_0x59c1f9+_0x1eff('0x68')]['findOne']({'where':{'id':_0x1a1662['body']['messageId']},'include':[{'model':db[_0x59c1f9+_0x1eff('0x69')],'as':_0x1eff('0x69')},{'model':db[_0x59c1f9+_0xb8d78d],'as':_0x1eff('0x64')}]});})[_0x1eff('0x8')](function(_0x56c92f){if(_[_0x1eff('0x13')](_0x56c92f)){throw new Error(_0x59c1f9+_0x1eff('0x79'));}_0x2eee85=_0x56c92f;return _0x56c92f[_0x1eff('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1eff('0x8')](function(){var _0x364dfe={'uniqueid':_0x58d21f+'.'+_0x2eee85['id']+'.'+_0x2eee85['Interaction']['id'],'FromUserId':_0x1a1662['user']['id'],'type':_0x1eff('0x6b'),'ToUserId':_0x119f5e['id']};_0x364dfe[_0x59c1f9+_0x1eff('0x6c')]=_0x2eee85['id'];_0x364dfe[_0x59c1f9+_0x1eff('0x6d')]=_0x2eee85[_0x1eff('0x69')]['id'];_0x364dfe[_0x1eff('0x6e')+_0x59c1f9+_0xb8d78d+'Id']=_0x2eee85[_0x1eff('0x64')]['id'];return db[_0x59c1f9+_0x1eff('0x70')][_0x1eff('0x71')](_0x364dfe);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x58d21f,'interaction':_0x2eee85[_0x1eff('0x69')],'message':_0x2eee85,'account':_0x2eee85[_0x1eff('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1eff('0x3b'),'appdata':_0x119f5e[_0x1eff('0x11')]+','+(_0x2eee85['Account'][_0x1eff('0x7a')]||0x12c),'interval':_0x1eff('0x74')}]},routingClient);})[_0x1eff('0x8')](respondWithResult(_0x3e08e4,null))[_0x1eff('0xd')](handleError(_0x3e08e4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index fde8961..8a76b79 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 _0x1a3c=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','run','create','put'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0x1a3c,0x1a6));var _0xc1a3=function(_0x4aa400,_0x359bfc){_0x4aa400=_0x4aa400-0x0;var _0x51118b=_0x1a3c[_0x4aa400];return _0x51118b;};'use strict';var multer=require(_0xc1a3('0x0'));var util=require(_0xc1a3('0x1'));var path=require(_0xc1a3('0x2'));var timeout=require(_0xc1a3('0x3'));var express=require('express');var router=express[_0xc1a3('0x4')]();var fs_extra=require(_0xc1a3('0x5'));var auth=require(_0xc1a3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xc1a3('0x7')]('/',auth[_0xc1a3('0x8')](),controller[_0xc1a3('0x9')]);router[_0xc1a3('0x7')](_0xc1a3('0xa'),auth[_0xc1a3('0x8')](),controller[_0xc1a3('0xb')]);router[_0xc1a3('0x7')]('/:id/run',auth[_0xc1a3('0x8')](),controller[_0xc1a3('0xc')]);router['post']('/',auth[_0xc1a3('0x8')](),controller[_0xc1a3('0xd')]);router[_0xc1a3('0xe')](_0xc1a3('0xa'),auth['isAuthenticated'](),controller[_0xc1a3('0xf')]);router[_0xc1a3('0x10')](_0xc1a3('0xa'),auth[_0xc1a3('0x8')](),controller[_0xc1a3('0x11')]);module[_0xc1a3('0x12')]=router; \ No newline at end of file +var _0x01c4=['run','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id/run'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x01c4,0x197));var _0x401c=function(_0x3274b8,_0x4b1656){_0x3274b8=_0x3274b8-0x0;var _0x5a017c=_0x01c4[_0x3274b8];return _0x5a017c;};'use strict';var multer=require('multer');var util=require(_0x401c('0x0'));var path=require(_0x401c('0x1'));var timeout=require(_0x401c('0x2'));var express=require(_0x401c('0x3'));var router=express[_0x401c('0x4')]();var fs_extra=require(_0x401c('0x5'));var auth=require(_0x401c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x401c('0x7'));var controller=require(_0x401c('0x8'));router[_0x401c('0x9')]('/',auth[_0x401c('0xa')](),controller[_0x401c('0xb')]);router[_0x401c('0x9')]('/:id',auth[_0x401c('0xa')](),controller['show']);router['get'](_0x401c('0xc'),auth[_0x401c('0xa')](),controller[_0x401c('0xd')]);router['post']('/',auth[_0x401c('0xa')](),controller[_0x401c('0xe')]);router[_0x401c('0xf')](_0x401c('0x10'),auth[_0x401c('0xa')](),controller['update']);router[_0x401c('0x11')]('/:id',auth[_0x401c('0xa')](),controller[_0x401c('0x12')]);module[_0x401c('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a6391dc..555227f 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 _0x9c63=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','days','minutes','csv','pdf','custom','TEXT','sequelize','exports'];(function(_0x2cfe1c,_0x13c614){var _0x311361=function(_0x56c611){while(--_0x56c611){_0x2cfe1c['push'](_0x2cfe1c['shift']());}};_0x311361(++_0x13c614);}(_0x9c63,0x1a7));var _0x39c6=function(_0xb6f143,_0x288ff0){_0xb6f143=_0xb6f143-0x0;var _0x18728f=_0x9c63[_0xb6f143];return _0x18728f;};'use strict';var Sequelize=require(_0x39c6('0x0'));module[_0x39c6('0x1')]={'name':{'type':Sequelize[_0x39c6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x39c6('0x2')]},'active':{'type':Sequelize[_0x39c6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x39c6('0x4')},'startAt':{'type':Sequelize[_0x39c6('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x39c6('0x6')](_0x39c6('0x7'),_0x39c6('0x8'),_0x39c6('0x9'),_0x39c6('0xa'),_0x39c6('0xb'),'hours',_0x39c6('0xc')),'allowNull':![],'defaultValue':_0x39c6('0xb')},'output':{'type':Sequelize[_0x39c6('0x6')](_0x39c6('0xd'),_0x39c6('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x39c6('0xd')},'type':{'type':Sequelize['ENUM'](_0x39c6('0xf'),'default'),'allowNull':![],'defaultValue':_0x39c6('0xf')},'sendMail':{'type':Sequelize[_0x39c6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x39c6('0x2')]},'cc':{'type':Sequelize[_0x39c6('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x39c6('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2eb2=['TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','weeks','days','hours','minutes','ENUM','csv','pdf','xlsx','custom'];(function(_0x2f099f,_0x1eb70a){var _0x46f714=function(_0x54572e){while(--_0x54572e){_0x2f099f['push'](_0x2f099f['shift']());}};_0x46f714(++_0x1eb70a);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x2eb2[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'active':{'type':Sequelize[_0x22eb('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![],'defaultValue':_0x22eb('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x22eb('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x22eb('0x5'),_0x22eb('0x6'),_0x22eb('0x7'),_0x22eb('0x8'),_0x22eb('0x9'),_0x22eb('0xa'),_0x22eb('0xb')),'allowNull':![],'defaultValue':_0x22eb('0x9')},'output':{'type':Sequelize[_0x22eb('0xc')](_0x22eb('0xd'),_0x22eb('0xe'),_0x22eb('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x22eb('0xc')]('custom','default'),'allowNull':![],'defaultValue':_0x22eb('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x22eb('0x1')]},'cc':{'type':Sequelize[_0x22eb('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8a90d52..5754a75 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 _0x7ce0=['get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','rows','show','includeAll','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy'];(function(_0xe106ac,_0x71fd15){var _0x4ed807=function(_0x214c61){while(--_0x214c61){_0xe106ac['push'](_0xe106ac['shift']());}};_0x4ed807(++_0x71fd15);}(_0x7ce0,0xdc));var _0x07ce=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x7ce0[_0x420b24];return _0x4da552;};'use strict';var pdf=require(_0x07ce('0x0'));var emlformat=require(_0x07ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x07ce('0x2'));var jsonpatch=require(_0x07ce('0x3'));var rp=require(_0x07ce('0x4'));var moment=require(_0x07ce('0x5'));var BPromise=require(_0x07ce('0x6'));var Mustache=require(_0x07ce('0x7'));var util=require('util');var path=require(_0x07ce('0x8'));var sox=require(_0x07ce('0x9'));var csv=require(_0x07ce('0xa'));var ejs=require(_0x07ce('0xb'));var fs=require('fs');var fs_extra=require(_0x07ce('0xc'));var _=require(_0x07ce('0xd'));var squel=require(_0x07ce('0xe'));var crypto=require('crypto');var jsforce=require(_0x07ce('0xf'));var deskjs=require(_0x07ce('0x10'));var toCsv=require('to-csv');var querystring=require(_0x07ce('0x11'));var Papa=require(_0x07ce('0x12'));var Redis=require(_0x07ce('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x07ce('0x14'));var as=require(_0x07ce('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07ce('0x16'))(_0x07ce('0x17'));var utils=require(_0x07ce('0x18'));var config=require(_0x07ce('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x07ce('0x1a'))['db'];function respondWithStatusCode(_0x1da3e7,_0x566bfc){_0x566bfc=_0x566bfc||0xcc;return function(_0x23ecf9){if(_0x23ecf9){return _0x1da3e7[_0x07ce('0x1b')](_0x566bfc);}return _0x1da3e7[_0x07ce('0x1c')](_0x566bfc)[_0x07ce('0x1d')]();};}function respondWithResult(_0x5e0dbf,_0x383bc1){_0x383bc1=_0x383bc1||0xc8;return function(_0x5b299a){if(_0x5b299a){return _0x5e0dbf[_0x07ce('0x1c')](_0x383bc1)[_0x07ce('0x1e')](_0x5b299a);}};}function respondWithFilteredResult(_0x367f88,_0x4f2af0){return function(_0x921f92){if(_0x921f92){var _0x46c715=_0x921f92[_0x07ce('0x1f')],_0x5b96b0=_0x4f2af0[_0x07ce('0x20')],_0x33864b=_0x4f2af0[_0x07ce('0x20')]+_0x4f2af0[_0x07ce('0x21')],_0x5ae6c8;if(_0x33864b>=_0x46c715){_0x33864b=_0x46c715;_0x5ae6c8=0xc8;}else{_0x5ae6c8=0xce;}_0x367f88[_0x07ce('0x1c')](_0x5ae6c8);return _0x367f88[_0x07ce('0x22')]('Content-Range',_0x5b96b0+'-'+_0x33864b+'/'+_0x46c715)[_0x07ce('0x1e')](_0x921f92);}return null;};}function patchUpdates(_0xce37c9){return function(_0x484ae3){try{jsonpatch[_0x07ce('0x23')](_0x484ae3,_0xce37c9,!![]);}catch(_0x251143){return BPromise[_0x07ce('0x24')](_0x251143);}return _0x484ae3[_0x07ce('0x25')]();};}function saveUpdates(_0x5c9dea,_0x804223){return function(_0x2d03d2){if(_0x2d03d2){return _0x2d03d2[_0x07ce('0x26')](_0x5c9dea)[_0x07ce('0x27')](function(_0x194d9b){return _0x194d9b;});}return null;};}function removeEntity(_0x2dc79d,_0x597266){return function(_0x23e7e3){if(_0x23e7e3){return _0x23e7e3[_0x07ce('0x28')]()[_0x07ce('0x27')](function(){var _0x293309=_0x23e7e3[_0x07ce('0x29')]({'plain':!![]});var _0x233d23=_0x07ce('0x2a');return db[_0x07ce('0x2b')][_0x07ce('0x28')]({'where':{'type':_0x233d23,'resourceId':_0x293309['id']}})['then'](function(){return _0x23e7e3;});})[_0x07ce('0x27')](function(){_0x2dc79d[_0x07ce('0x1c')](0xcc)[_0x07ce('0x1d')]();});}};}function handleEntityNotFound(_0x463ac2,_0x351f28){return function(_0x870f3d){if(!_0x870f3d){_0x463ac2[_0x07ce('0x1b')](0x194);}return _0x870f3d;};}function handleError(_0x4e97b9,_0x136ac1){_0x136ac1=_0x136ac1||0x1f4;return function(_0x4c4b7a){logger[_0x07ce('0x2c')](_0x4c4b7a[_0x07ce('0x2d')]);if(_0x4c4b7a[_0x07ce('0x2e')]){delete _0x4c4b7a['name'];}_0x4e97b9[_0x07ce('0x1c')](_0x136ac1)[_0x07ce('0x2f')](_0x4c4b7a);};}exports[_0x07ce('0x30')]=function(_0x100d7b,_0x539036){var _0x142c8d={},_0xab9dce={},_0x22d2c1={'count':0x0,'rows':[]};var _0x525eca=_[_0x07ce('0x31')](db[_0x07ce('0x32')][_0x07ce('0x33')],function(_0x3dd5de){return{'name':_0x3dd5de[_0x07ce('0x34')],'type':_0x3dd5de[_0x07ce('0x35')][_0x07ce('0x36')]};});_0xab9dce[_0x07ce('0x37')]=_[_0x07ce('0x31')](_0x525eca,_0x07ce('0x2e'));_0xab9dce['query']=_[_0x07ce('0x38')](_0x100d7b[_0x07ce('0x39')]);_0xab9dce[_0x07ce('0x3a')]=_['intersection'](_0xab9dce[_0x07ce('0x37')],_0xab9dce[_0x07ce('0x39')]);_0x142c8d[_0x07ce('0x3b')]=_[_0x07ce('0x3c')](_0xab9dce['model'],qs[_0x07ce('0x3d')](_0x100d7b['query'][_0x07ce('0x3d')]));_0x142c8d[_0x07ce('0x3b')]=_0x142c8d[_0x07ce('0x3b')][_0x07ce('0x3e')]?_0x142c8d[_0x07ce('0x3b')]:_0xab9dce['model'];if(!_0x100d7b[_0x07ce('0x39')][_0x07ce('0x3f')](_0x07ce('0x40'))){_0x142c8d[_0x07ce('0x21')]=qs[_0x07ce('0x21')](_0x100d7b[_0x07ce('0x39')][_0x07ce('0x21')]);_0x142c8d[_0x07ce('0x20')]=qs[_0x07ce('0x20')](_0x100d7b[_0x07ce('0x39')][_0x07ce('0x20')]);}_0x142c8d[_0x07ce('0x41')]=qs[_0x07ce('0x42')](_0x100d7b['query'][_0x07ce('0x42')]);_0x142c8d[_0x07ce('0x43')]=qs[_0x07ce('0x3a')](_[_0x07ce('0x44')](_0x100d7b['query'],_0xab9dce[_0x07ce('0x3a')]),_0x525eca);if(_0x100d7b['query']['filter']){_0x142c8d[_0x07ce('0x43')]=_[_0x07ce('0x45')](_0x142c8d[_0x07ce('0x43')],{'$or':_[_0x07ce('0x31')](_0x525eca,function(_0x458263){if(_0x458263[_0x07ce('0x35')]!=='VIRTUAL'){var _0x3376c2={};_0x3376c2[_0x458263[_0x07ce('0x2e')]]={'$like':'%'+_0x100d7b[_0x07ce('0x39')]['filter']+'%'};return _0x3376c2;}})});}_0x142c8d=_[_0x07ce('0x45')]({},_0x142c8d,_0x100d7b[_0x07ce('0x46')]);var _0x401ad6={'where':_0x142c8d[_0x07ce('0x43')]};return db['Schedule'][_0x07ce('0x1f')](_0x401ad6)['then'](function(_0x39e863){_0x22d2c1['count']=_0x39e863;if(_0x100d7b['query']['includeAll']){_0x142c8d[_0x07ce('0x47')]=[{'all':!![]}];}return db[_0x07ce('0x32')]['findAll'](_0x142c8d);})[_0x07ce('0x27')](function(_0x275596){_0x22d2c1[_0x07ce('0x48')]=_0x275596;return _0x22d2c1;})[_0x07ce('0x27')](respondWithFilteredResult(_0x539036,_0x142c8d))['catch'](handleError(_0x539036,null));};exports[_0x07ce('0x49')]=function(_0x3ccc2f,_0xc13f84){var _0x428a2c={'raw':![],'where':{'id':_0x3ccc2f['params']['id']}},_0x57fa30={};_0x57fa30['model']=_[_0x07ce('0x38')](db['Schedule'][_0x07ce('0x33')]);_0x57fa30[_0x07ce('0x39')]=_[_0x07ce('0x38')](_0x3ccc2f[_0x07ce('0x39')]);_0x57fa30[_0x07ce('0x3a')]=_['intersection'](_0x57fa30[_0x07ce('0x37')],_0x57fa30[_0x07ce('0x39')]);_0x428a2c[_0x07ce('0x3b')]=_['intersection'](_0x57fa30['model'],qs[_0x07ce('0x3d')](_0x3ccc2f[_0x07ce('0x39')][_0x07ce('0x3d')]));_0x428a2c[_0x07ce('0x3b')]=_0x428a2c[_0x07ce('0x3b')]['length']?_0x428a2c['attributes']:_0x57fa30[_0x07ce('0x37')];if(_0x3ccc2f[_0x07ce('0x39')][_0x07ce('0x4a')]){_0x428a2c[_0x07ce('0x47')]=[{'all':!![]}];}_0x428a2c=_[_0x07ce('0x45')]({},_0x428a2c,_0x3ccc2f['options']);return db[_0x07ce('0x32')][_0x07ce('0x4b')](_0x428a2c)[_0x07ce('0x27')](handleEntityNotFound(_0xc13f84,null))[_0x07ce('0x27')](respondWithResult(_0xc13f84,null))[_0x07ce('0x4c')](handleError(_0xc13f84,null));};exports['create']=function(_0x1fe6e3,_0xd2ef3a){return db['Schedule'][_0x07ce('0x4d')](_0x1fe6e3[_0x07ce('0x4e')],{})[_0x07ce('0x27')](function(_0x42bb8c){var _0x426d75=_0x1fe6e3[_0x07ce('0x4f')][_0x07ce('0x29')]({'plain':!![]});if(!_0x426d75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x426d75['role']===_0x07ce('0x4f')){var _0x4cbf7a=_0x42bb8c['get']({'plain':!![]});var _0x6b288f=_0x07ce('0x2a');return db[_0x07ce('0x50')][_0x07ce('0x4b')]({'where':{'name':_0x6b288f,'userProfileId':_0x426d75[_0x07ce('0x51')]},'raw':!![]})[_0x07ce('0x27')](function(_0x4ca420){if(_0x4ca420&&_0x4ca420[_0x07ce('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x4cbf7a[_0x07ce('0x2e')],'resourceId':_0x4cbf7a['id'],'type':_0x4ca420[_0x07ce('0x2e')],'sectionId':_0x4ca420['id']},{})['then'](function(){return _0x42bb8c;});}else{return _0x42bb8c;}})[_0x07ce('0x4c')](function(_0x33487e){logger['error'](_0x07ce('0x53'),_0x33487e);throw _0x33487e;});}return _0x42bb8c;})['then'](respondWithResult(_0xd2ef3a,0xc9))[_0x07ce('0x4c')](handleError(_0xd2ef3a,null));};exports['update']=function(_0x4f1f11,_0x5dbd2f){if(_0x4f1f11[_0x07ce('0x4e')]['id']){delete _0x4f1f11['body']['id'];}return db[_0x07ce('0x32')][_0x07ce('0x4b')]({'where':{'id':_0x4f1f11['params']['id']}})[_0x07ce('0x27')](handleEntityNotFound(_0x5dbd2f,null))[_0x07ce('0x27')](saveUpdates(_0x4f1f11['body'],null))[_0x07ce('0x27')](respondWithResult(_0x5dbd2f,null))[_0x07ce('0x4c')](handleError(_0x5dbd2f,null));};exports[_0x07ce('0x28')]=function(_0x4b53fb,_0x173e7c){return db['Schedule'][_0x07ce('0x4b')]({'where':{'id':_0x4b53fb[_0x07ce('0x54')]['id']}})[_0x07ce('0x27')](handleEntityNotFound(_0x173e7c,null))[_0x07ce('0x27')](removeEntity(_0x173e7c,null))[_0x07ce('0x4c')](handleError(_0x173e7c,null));};exports[_0x07ce('0x55')]=function(_0x1a29e3,_0x4fccb0,_0x19cd2b){var _0x471d91=require(_0x07ce('0x56'));return db[_0x07ce('0x32')][_0x07ce('0x4b')]({'where':{'id':_0x1a29e3[_0x07ce('0x54')]['id']},'raw':!![]})[_0x07ce('0x27')](handleEntityNotFound(_0x4fccb0,null))[_0x07ce('0x27')](function(){_0x471d91[_0x07ce('0x55')](_0x1a29e3[_0x07ce('0x54')]['id']);})[_0x07ce('0x27')](respondWithStatusCode(_0x4fccb0,null))[_0x07ce('0x4c')](handleError(_0x4fccb0,null));}; \ No newline at end of file +var _0x2180=['create','body','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','run','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','get','UserProfileResource','error','stack','name','send','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','catch','show','params','rawAttributes','find'];(function(_0x213ae7,_0x3c3772){var _0x272956=function(_0xed3b57){while(--_0xed3b57){_0x213ae7['push'](_0x213ae7['shift']());}};_0x272956(++_0x3c3772);}(_0x2180,0xfb));var _0x0218=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0x2180[_0x35d59c];return _0x18cd27;};'use strict';var pdf=require(_0x0218('0x0'));var emlformat=require(_0x0218('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0218('0x2'));var jsonpatch=require(_0x0218('0x3'));var rp=require(_0x0218('0x4'));var moment=require(_0x0218('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0218('0x6'));var util=require(_0x0218('0x7'));var path=require(_0x0218('0x8'));var sox=require(_0x0218('0x9'));var csv=require('to-csv');var ejs=require(_0x0218('0xa'));var fs=require('fs');var fs_extra=require(_0x0218('0xb'));var _=require('lodash');var squel=require(_0x0218('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0218('0xd'));var toCsv=require(_0x0218('0xe'));var querystring=require(_0x0218('0xf'));var Papa=require(_0x0218('0x10'));var Redis=require(_0x0218('0x11'));var authService=require(_0x0218('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0218('0x13'));var hardwareService=require(_0x0218('0x14'));var logger=require(_0x0218('0x15'))(_0x0218('0x16'));var utils=require('../../config/utils');var config=require(_0x0218('0x17'));var licenseUtil=require(_0x0218('0x18'));var db=require(_0x0218('0x19'))['db'];function respondWithStatusCode(_0x3874b0,_0x2d79ac){_0x2d79ac=_0x2d79ac||0xcc;return function(_0x2abf09){if(_0x2abf09){return _0x3874b0[_0x0218('0x1a')](_0x2d79ac);}return _0x3874b0[_0x0218('0x1b')](_0x2d79ac)[_0x0218('0x1c')]();};}function respondWithResult(_0x406b68,_0x3dc49d){_0x3dc49d=_0x3dc49d||0xc8;return function(_0x1a53c7){if(_0x1a53c7){return _0x406b68['status'](_0x3dc49d)[_0x0218('0x1d')](_0x1a53c7);}};}function respondWithFilteredResult(_0x4df8c8,_0xea3aa2){return function(_0x1809d6){if(_0x1809d6){var _0x35011c=_0x1809d6[_0x0218('0x1e')],_0x1f3f04=_0xea3aa2[_0x0218('0x1f')],_0x285b2a=_0xea3aa2[_0x0218('0x1f')]+_0xea3aa2[_0x0218('0x20')],_0x3d8fbb;if(_0x285b2a>=_0x35011c){_0x285b2a=_0x35011c;_0x3d8fbb=0xc8;}else{_0x3d8fbb=0xce;}_0x4df8c8[_0x0218('0x1b')](_0x3d8fbb);return _0x4df8c8[_0x0218('0x21')](_0x0218('0x22'),_0x1f3f04+'-'+_0x285b2a+'/'+_0x35011c)[_0x0218('0x1d')](_0x1809d6);}return null;};}function patchUpdates(_0x2bbab6){return function(_0x35dc1a){try{jsonpatch['apply'](_0x35dc1a,_0x2bbab6,!![]);}catch(_0x1f0de9){return BPromise['reject'](_0x1f0de9);}return _0x35dc1a[_0x0218('0x23')]();};}function saveUpdates(_0x408acc,_0x5c1d1c){return function(_0x2d0c70){if(_0x2d0c70){return _0x2d0c70['update'](_0x408acc)[_0x0218('0x24')](function(_0x229245){return _0x229245;});}return null;};}function removeEntity(_0x4d7bf1,_0x164f22){return function(_0x3d40ff){if(_0x3d40ff){return _0x3d40ff['destroy']()[_0x0218('0x24')](function(){var _0x1ee344=_0x3d40ff[_0x0218('0x25')]({'plain':!![]});var _0x38a0fc='Scheduler';return db[_0x0218('0x26')]['destroy']({'where':{'type':_0x38a0fc,'resourceId':_0x1ee344['id']}})[_0x0218('0x24')](function(){return _0x3d40ff;});})[_0x0218('0x24')](function(){_0x4d7bf1[_0x0218('0x1b')](0xcc)[_0x0218('0x1c')]();});}};}function handleEntityNotFound(_0x2548e9,_0x3ca6f0){return function(_0x1c05c1){if(!_0x1c05c1){_0x2548e9[_0x0218('0x1a')](0x194);}return _0x1c05c1;};}function handleError(_0x381616,_0x1a77ba){_0x1a77ba=_0x1a77ba||0x1f4;return function(_0x5bfda1){logger[_0x0218('0x27')](_0x5bfda1[_0x0218('0x28')]);if(_0x5bfda1[_0x0218('0x29')]){delete _0x5bfda1[_0x0218('0x29')];}_0x381616[_0x0218('0x1b')](_0x1a77ba)[_0x0218('0x2a')](_0x5bfda1);};}exports['index']=function(_0x32ea7a,_0x506031){var _0x3044dd={},_0x46196e={},_0x1454f5={'count':0x0,'rows':[]};var _0x504d8a=_['map'](db['Schedule']['rawAttributes'],function(_0x53a715){return{'name':_0x53a715[_0x0218('0x2b')],'type':_0x53a715[_0x0218('0x2c')][_0x0218('0x2d')]};});_0x46196e['model']=_[_0x0218('0x2e')](_0x504d8a,_0x0218('0x29'));_0x46196e[_0x0218('0x2f')]=_[_0x0218('0x30')](_0x32ea7a[_0x0218('0x2f')]);_0x46196e[_0x0218('0x31')]=_[_0x0218('0x32')](_0x46196e[_0x0218('0x33')],_0x46196e['query']);_0x3044dd[_0x0218('0x34')]=_['intersection'](_0x46196e[_0x0218('0x33')],qs[_0x0218('0x35')](_0x32ea7a[_0x0218('0x2f')]['fields']));_0x3044dd[_0x0218('0x34')]=_0x3044dd['attributes'][_0x0218('0x36')]?_0x3044dd[_0x0218('0x34')]:_0x46196e[_0x0218('0x33')];if(!_0x32ea7a[_0x0218('0x2f')][_0x0218('0x37')](_0x0218('0x38'))){_0x3044dd[_0x0218('0x20')]=qs[_0x0218('0x20')](_0x32ea7a[_0x0218('0x2f')]['limit']);_0x3044dd['offset']=qs[_0x0218('0x1f')](_0x32ea7a[_0x0218('0x2f')][_0x0218('0x1f')]);}_0x3044dd[_0x0218('0x39')]=qs['sort'](_0x32ea7a[_0x0218('0x2f')]['sort']);_0x3044dd[_0x0218('0x3a')]=qs['filters'](_[_0x0218('0x3b')](_0x32ea7a[_0x0218('0x2f')],_0x46196e[_0x0218('0x31')]),_0x504d8a);if(_0x32ea7a[_0x0218('0x2f')][_0x0218('0x3c')]){_0x3044dd[_0x0218('0x3a')]=_[_0x0218('0x3d')](_0x3044dd[_0x0218('0x3a')],{'$or':_['map'](_0x504d8a,function(_0x175b25){if(_0x175b25[_0x0218('0x2c')]!==_0x0218('0x3e')){var _0x485f0b={};_0x485f0b[_0x175b25[_0x0218('0x29')]]={'$like':'%'+_0x32ea7a[_0x0218('0x2f')][_0x0218('0x3c')]+'%'};return _0x485f0b;}})});}_0x3044dd=_['merge']({},_0x3044dd,_0x32ea7a[_0x0218('0x3f')]);var _0x4db0f0={'where':_0x3044dd[_0x0218('0x3a')]};return db[_0x0218('0x40')][_0x0218('0x1e')](_0x4db0f0)[_0x0218('0x24')](function(_0x378988){_0x1454f5[_0x0218('0x1e')]=_0x378988;if(_0x32ea7a[_0x0218('0x2f')][_0x0218('0x41')]){_0x3044dd[_0x0218('0x42')]=[{'all':!![]}];}return db['Schedule'][_0x0218('0x43')](_0x3044dd);})[_0x0218('0x24')](function(_0x3d164f){_0x1454f5['rows']=_0x3d164f;return _0x1454f5;})['then'](respondWithFilteredResult(_0x506031,_0x3044dd))[_0x0218('0x44')](handleError(_0x506031,null));};exports[_0x0218('0x45')]=function(_0x369460,_0x5ed016){var _0x3c65ec={'raw':![],'where':{'id':_0x369460[_0x0218('0x46')]['id']}},_0xc8052={};_0xc8052[_0x0218('0x33')]=_[_0x0218('0x30')](db[_0x0218('0x40')][_0x0218('0x47')]);_0xc8052[_0x0218('0x2f')]=_[_0x0218('0x30')](_0x369460[_0x0218('0x2f')]);_0xc8052[_0x0218('0x31')]=_[_0x0218('0x32')](_0xc8052[_0x0218('0x33')],_0xc8052[_0x0218('0x2f')]);_0x3c65ec[_0x0218('0x34')]=_[_0x0218('0x32')](_0xc8052[_0x0218('0x33')],qs[_0x0218('0x35')](_0x369460[_0x0218('0x2f')]['fields']));_0x3c65ec[_0x0218('0x34')]=_0x3c65ec[_0x0218('0x34')][_0x0218('0x36')]?_0x3c65ec[_0x0218('0x34')]:_0xc8052[_0x0218('0x33')];if(_0x369460['query'][_0x0218('0x41')]){_0x3c65ec[_0x0218('0x42')]=[{'all':!![]}];}_0x3c65ec=_['merge']({},_0x3c65ec,_0x369460['options']);return db['Schedule'][_0x0218('0x48')](_0x3c65ec)[_0x0218('0x24')](handleEntityNotFound(_0x5ed016,null))[_0x0218('0x24')](respondWithResult(_0x5ed016,null))[_0x0218('0x44')](handleError(_0x5ed016,null));};exports[_0x0218('0x49')]=function(_0x50240e,_0x5562ee){return db[_0x0218('0x40')][_0x0218('0x49')](_0x50240e[_0x0218('0x4a')],{})[_0x0218('0x24')](function(_0x41db37){var _0x47ff54=_0x50240e['user'][_0x0218('0x25')]({'plain':!![]});if(!_0x47ff54)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47ff54['role']===_0x0218('0x4b')){var _0x4cfe9a=_0x41db37[_0x0218('0x25')]({'plain':!![]});var _0x249a28='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x249a28,'userProfileId':_0x47ff54['userProfileId']},'raw':!![]})[_0x0218('0x24')](function(_0x3894b5){if(_0x3894b5&&_0x3894b5[_0x0218('0x4c')]===0x0){return db[_0x0218('0x26')][_0x0218('0x49')]({'name':_0x4cfe9a[_0x0218('0x29')],'resourceId':_0x4cfe9a['id'],'type':_0x3894b5[_0x0218('0x29')],'sectionId':_0x3894b5['id']},{})[_0x0218('0x24')](function(){return _0x41db37;});}else{return _0x41db37;}})[_0x0218('0x44')](function(_0x162b7a){logger['error'](_0x0218('0x4d'),_0x162b7a);throw _0x162b7a;});}return _0x41db37;})[_0x0218('0x24')](respondWithResult(_0x5562ee,0xc9))[_0x0218('0x44')](handleError(_0x5562ee,null));};exports[_0x0218('0x4e')]=function(_0x3f3bdd,_0x5c0ae5){if(_0x3f3bdd[_0x0218('0x4a')]['id']){delete _0x3f3bdd[_0x0218('0x4a')]['id'];}return db[_0x0218('0x40')][_0x0218('0x48')]({'where':{'id':_0x3f3bdd[_0x0218('0x46')]['id']}})[_0x0218('0x24')](handleEntityNotFound(_0x5c0ae5,null))[_0x0218('0x24')](saveUpdates(_0x3f3bdd[_0x0218('0x4a')],null))[_0x0218('0x24')](respondWithResult(_0x5c0ae5,null))[_0x0218('0x44')](handleError(_0x5c0ae5,null));};exports[_0x0218('0x4f')]=function(_0x51d467,_0x106b62){return db[_0x0218('0x40')][_0x0218('0x48')]({'where':{'id':_0x51d467['params']['id']}})[_0x0218('0x24')](handleEntityNotFound(_0x106b62,null))[_0x0218('0x24')](removeEntity(_0x106b62,null))['catch'](handleError(_0x106b62,null));};exports[_0x0218('0x50')]=function(_0x4f9574,_0xf53654,_0x3f2840){var _0x30cb42=require('../../config/schedule');return db[_0x0218('0x40')][_0x0218('0x48')]({'where':{'id':_0x4f9574[_0x0218('0x46')]['id']},'raw':!![]})[_0x0218('0x24')](handleEntityNotFound(_0xf53654,null))['then'](function(){_0x30cb42[_0x0218('0x50')](_0x4f9574[_0x0218('0x46')]['id']);})[_0x0218('0x24')](respondWithStatusCode(_0xf53654,null))[_0x0218('0x44')](handleError(_0xf53654,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ce6414c..e307af8 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 _0x94cb=['rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','../../config/logger','api','moment','request-promise','path'];(function(_0x4b1da4,_0x3f1155){var _0x2d3eaa=function(_0x1c2f50){while(--_0x1c2f50){_0x4b1da4['push'](_0x4b1da4['shift']());}};_0x2d3eaa(++_0x3f1155);}(_0x94cb,0x12f));var _0xb94c=function(_0x4483f8,_0x369eaf){_0x4483f8=_0x4483f8-0x0;var _0x55db2f=_0x94cb[_0x4483f8];return _0x55db2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb94c('0x0'))(_0xb94c('0x1'));var moment=require(_0xb94c('0x2'));var BPromise=require('bluebird');var rp=require(_0xb94c('0x3'));var fs=require('fs');var path=require(_0xb94c('0x4'));var rimraf=require(_0xb94c('0x5'));var config=require(_0xb94c('0x6'));var attributes=require(_0xb94c('0x7'));module[_0xb94c('0x8')]=function(_0x56b5f4,_0x72ae06){return _0x56b5f4[_0xb94c('0x9')]('Schedule',attributes,{'tableName':_0xb94c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c91=['../../config/logger','api','request-promise','path','rimraf','./schedule.attributes','exports','Schedule','tools_schedules','lodash','util'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x7c91,0x15e));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x17c9('0x0'));var util=require(_0x17c9('0x1'));var logger=require(_0x17c9('0x2'))(_0x17c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x17c9('0x4'));var fs=require('fs');var path=require(_0x17c9('0x5'));var rimraf=require(_0x17c9('0x6'));var config=require('../../config/environment');var attributes=require(_0x17c9('0x7'));module[_0x17c9('0x8')]=function(_0x29c392,_0x587b96){return _0x29c392['define'](_0x17c9('0x9'),attributes,{'tableName':_0x17c9('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 8de2e3d..10d1e10 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 _0x2697=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1ee99a,_0x242d0c){var _0x260772=function(_0x2ee261){while(--_0x2ee261){_0x1ee99a['push'](_0x1ee99a['shift']());}};_0x260772(++_0x242d0c);}(_0x2697,0xd7));var _0x7269=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x2697[_0x141e03];return _0x2074e3;};'use strict';var _=require(_0x7269('0x0'));var util=require('util');var moment=require(_0x7269('0x1'));var BPromise=require(_0x7269('0x2'));var rs=require(_0x7269('0x3'));var fs=require('fs');var Redis=require(_0x7269('0x4'));var db=require(_0x7269('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7269('0x6'));var config=require(_0x7269('0x7'));var jayson=require(_0x7269('0x8'));var client=jayson[_0x7269('0x9')][_0x7269('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49534c,_0x494527,_0x4cbcba){return new BPromise(function(_0x3477f0,_0x4b30a8){return client[_0x7269('0xb')](_0x49534c,_0x4cbcba)[_0x7269('0xc')](function(_0x4416cc){logger[_0x7269('0xd')]('Schedule,\x20%s,\x20%s',_0x494527,_0x7269('0xe'));logger['debug'](_0x7269('0xf'),_0x494527,_0x7269('0xe'),JSON[_0x7269('0x10')](_0x4416cc));if(_0x4416cc[_0x7269('0x11')]){if(_0x4416cc['error'][_0x7269('0x12')]===0x1f4){logger[_0x7269('0x11')]('Schedule,\x20%s,\x20%s',_0x494527,_0x4416cc[_0x7269('0x11')][_0x7269('0x13')]);return _0x4b30a8(_0x4416cc[_0x7269('0x11')][_0x7269('0x13')]);}logger[_0x7269('0x11')](_0x7269('0x14'),_0x494527,_0x4416cc[_0x7269('0x11')][_0x7269('0x13')]);return _0x3477f0(_0x4416cc[_0x7269('0x11')][_0x7269('0x13')]);}else{logger[_0x7269('0xd')](_0x7269('0x14'),_0x494527,_0x7269('0xe'));_0x3477f0(_0x4416cc[_0x7269('0x15')][_0x7269('0x13')]);}})[_0x7269('0x16')](function(_0x41f3bd){logger[_0x7269('0x11')](_0x7269('0x14'),_0x494527,_0x41f3bd);_0x4b30a8(_0x41f3bd);});});} \ No newline at end of file +var _0x0b2d=['../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1f55f3,_0xdca5fd){var _0x5e106e=function(_0x557012){while(--_0x557012){_0x1f55f3['push'](_0x1f55f3['shift']());}};_0x5e106e(++_0xdca5fd);}(_0x0b2d,0x12f));var _0xd0b2=function(_0x1f9a99,_0x616aed){_0x1f9a99=_0x1f9a99-0x0;var _0x59f6be=_0x0b2d[_0x1f9a99];return _0x59f6be;};'use strict';var _=require(_0xd0b2('0x0'));var util=require(_0xd0b2('0x1'));var moment=require(_0xd0b2('0x2'));var BPromise=require(_0xd0b2('0x3'));var rs=require(_0xd0b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0b2('0x5'))['db'];var utils=require(_0xd0b2('0x6'));var logger=require(_0xd0b2('0x7'))(_0xd0b2('0x8'));var config=require(_0xd0b2('0x9'));var jayson=require(_0xd0b2('0xa'));var client=jayson[_0xd0b2('0xb')][_0xd0b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27f097,_0xe6d7a0,_0x5880d5){return new BPromise(function(_0x42f6e6,_0x48a867){return client[_0xd0b2('0xd')](_0x27f097,_0x5880d5)[_0xd0b2('0xe')](function(_0x62e29f){logger['info'](_0xd0b2('0xf'),_0xe6d7a0,_0xd0b2('0x10'));logger[_0xd0b2('0x11')](_0xd0b2('0x12'),_0xe6d7a0,'request\x20sent',JSON[_0xd0b2('0x13')](_0x62e29f));if(_0x62e29f[_0xd0b2('0x14')]){if(_0x62e29f[_0xd0b2('0x14')][_0xd0b2('0x15')]===0x1f4){logger[_0xd0b2('0x14')](_0xd0b2('0xf'),_0xe6d7a0,_0x62e29f[_0xd0b2('0x14')][_0xd0b2('0x16')]);return _0x48a867(_0x62e29f['error'][_0xd0b2('0x16')]);}logger[_0xd0b2('0x14')]('Schedule,\x20%s,\x20%s',_0xe6d7a0,_0x62e29f[_0xd0b2('0x14')][_0xd0b2('0x16')]);return _0x42f6e6(_0x62e29f['error'][_0xd0b2('0x16')]);}else{logger[_0xd0b2('0x17')](_0xd0b2('0xf'),_0xe6d7a0,_0xd0b2('0x10'));_0x42f6e6(_0x62e29f['result'][_0xd0b2('0x16')]);}})['catch'](function(_0x419db7){logger[_0xd0b2('0x14')](_0xd0b2('0xf'),_0xe6d7a0,_0x419db7);_0x48a867(_0x419db7);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 941875f..f6f454a 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 _0xf064=['isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf064,0x169));var _0x4f06=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0xf064[_0x95411e];return _0x2c8718;};'use strict';var multer=require(_0x4f06('0x0'));var util=require(_0x4f06('0x1'));var path=require(_0x4f06('0x2'));var timeout=require(_0x4f06('0x3'));var express=require(_0x4f06('0x4'));var router=express[_0x4f06('0x5')]();var fs_extra=require(_0x4f06('0x6'));var auth=require(_0x4f06('0x7'));var interaction=require(_0x4f06('0x8'));var config=require(_0x4f06('0x9'));var controller=require(_0x4f06('0xa'));router[_0x4f06('0xb')]('/',auth['isAuthenticated'](),controller[_0x4f06('0xc')]);router[_0x4f06('0xb')](_0x4f06('0xd'),auth[_0x4f06('0xe')](),controller['describe']);router['get'](_0x4f06('0xf'),auth[_0x4f06('0xe')](),controller[_0x4f06('0x10')]);router[_0x4f06('0xb')](_0x4f06('0x11'),auth[_0x4f06('0xe')](),controller[_0x4f06('0x12')]);router[_0x4f06('0x13')]('/',auth[_0x4f06('0xe')](),controller[_0x4f06('0x14')]);router[_0x4f06('0x15')]('/:id',auth[_0x4f06('0xe')](),controller['update']);router[_0x4f06('0x16')](_0x4f06('0xf'),auth[_0x4f06('0xe')](),controller[_0x4f06('0x17')]);module[_0x4f06('0x18')]=router; \ No newline at end of file +var _0x7a0e=['/:id/download','download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a0e,0x167));var _0xe7a0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7a0e[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xe7a0('0x0'));var util=require(_0xe7a0('0x1'));var path=require(_0xe7a0('0x2'));var timeout=require(_0xe7a0('0x3'));var express=require(_0xe7a0('0x4'));var router=express[_0xe7a0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe7a0('0x6'));var interaction=require(_0xe7a0('0x7'));var config=require(_0xe7a0('0x8'));var controller=require('./screenRecording.controller');router[_0xe7a0('0x9')]('/',auth[_0xe7a0('0xa')](),controller[_0xe7a0('0xb')]);router['get'](_0xe7a0('0xc'),auth[_0xe7a0('0xa')](),controller[_0xe7a0('0xd')]);router[_0xe7a0('0x9')](_0xe7a0('0xe'),auth[_0xe7a0('0xa')](),controller['show']);router['get'](_0xe7a0('0xf'),auth['isAuthenticated'](),controller[_0xe7a0('0x10')]);router[_0xe7a0('0x11')]('/',auth[_0xe7a0('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe7a0('0x12')]);router[_0xe7a0('0x13')](_0xe7a0('0xe'),auth['isAuthenticated'](),controller[_0xe7a0('0x14')]);module[_0xe7a0('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index b8ddcfa..85efddf 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17ba=['MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format'];(function(_0x133a4b,_0x34d477){var _0x1bfbce=function(_0x4512f4){while(--_0x4512f4){_0x133a4b['push'](_0x133a4b['shift']());}};_0x1bfbce(++_0x34d477);}(_0x17ba,0xab));var _0xa17b=function(_0x449b8e,_0x587bc8){_0x449b8e=_0x449b8e-0x0;var _0x31f4ea=_0x17ba[_0x449b8e];return _0x31f4ea;};'use strict';var Sequelize=require(_0xa17b('0x0'));var moment=require(_0xa17b('0x1'));var path=require('path');var config=require(_0xa17b('0x2'));module[_0xa17b('0x3')]={'format':{'type':Sequelize[_0xa17b('0x4')],'get':function(){return this[_0xa17b('0x5')](_0xa17b('0x6'))?path[_0xa17b('0x7')](this[_0xa17b('0x5')](_0xa17b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa17b('0x8')]},'channel':{'type':Sequelize[_0xa17b('0x8')]},'value':{'type':Sequelize[_0xa17b('0x8')],'set':function(_0x2e3d43){var _0x1957be=_0x2e3d43[_0xa17b('0x9')](/\\/g,'/');this[_0xa17b('0xa')](_0xa17b('0x6'),_0x1957be);}},'rating':{'type':Sequelize[_0xa17b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa17b('0xb')],'set':function(_0x15bdfc){this['setDataValue'](_0xa17b('0xc'),moment()[_0xa17b('0xd')](_0x15bdfc,'ms'));this[_0xa17b('0xa')](_0xa17b('0xe'),moment());this[_0xa17b('0xa')](_0xa17b('0xf'),_0x15bdfc);}},'startedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this['getDataValue'](_0xa17b('0xc')))[_0xa17b('0x11')](_0xa17b('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0xe')))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xa17b('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0x14')))['format'](_0xa17b('0x12'))[_0xa17b('0x13')]();}},'updatedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')]('updatedAt'))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0xb138=['extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xb138,0x1dd));var _0x8b13=function(_0x42bf88,_0x267a83){_0x42bf88=_0x42bf88-0x0;var _0x1034e1=_0xb138[_0x42bf88];return _0x1034e1;};'use strict';var Sequelize=require(_0x8b13('0x0'));var moment=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var config=require(_0x8b13('0x3'));module[_0x8b13('0x4')]={'format':{'type':Sequelize[_0x8b13('0x5')],'get':function(){return this[_0x8b13('0x6')]('value')?path[_0x8b13('0x7')](this[_0x8b13('0x6')](_0x8b13('0x8'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8b13('0x9')]},'value':{'type':Sequelize[_0x8b13('0x9')],'set':function(_0x5d51b1){var _0x3fdf4d=_0x5d51b1[_0x8b13('0xa')](/\\/g,'/');this[_0x8b13('0xb')]('value',_0x3fdf4d);}},'rating':{'type':Sequelize[_0x8b13('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8b13('0xc')],'set':function(_0x58683a){this['setDataValue'](_0x8b13('0xd'),moment()[_0x8b13('0xe')](_0x58683a,'ms'));this[_0x8b13('0xb')](_0x8b13('0xf'),moment());this[_0x8b13('0xb')]('duration',_0x58683a);}},'startedAt':{'type':Sequelize[_0x8b13('0x10')],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0xd')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b13('0xf')))[_0x8b13('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0x14')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0x15')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 92b4265..a90d137 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 _0xfaa5=['catch','create','body','duration','createdAt','closedAt','describe','uniqueid','value','join','root','%s.cypher','existsSync','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','status','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','include','findAll','show','params','length','find'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xfaa5,0x157));var _0x5faa=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xfaa5[_0x1778e1];return _0x2bc4c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5faa('0x0'));var rimraf=require(_0x5faa('0x1'));var zipdir=require(_0x5faa('0x2'));var jsonpatch=require(_0x5faa('0x3'));var rp=require(_0x5faa('0x4'));var moment=require(_0x5faa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5faa('0x6'));var util=require(_0x5faa('0x7'));var path=require(_0x5faa('0x8'));var sox=require(_0x5faa('0x9'));var csv=require(_0x5faa('0xa'));var ejs=require(_0x5faa('0xb'));var fs=require('fs');var fs_extra=require(_0x5faa('0xc'));var _=require('lodash');var squel=require(_0x5faa('0xd'));var crypto=require(_0x5faa('0xe'));var jsforce=require(_0x5faa('0xf'));var deskjs=require(_0x5faa('0x10'));var toCsv=require(_0x5faa('0xa'));var querystring=require(_0x5faa('0x11'));var Papa=require(_0x5faa('0x12'));var Redis=require(_0x5faa('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5faa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5faa('0x15'))(_0x5faa('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5faa('0x17'));var db=require(_0x5faa('0x18'))['db'];function respondWithStatusCode(_0x3f0cbf,_0x48f5e5){_0x48f5e5=_0x48f5e5||0xcc;return function(_0x5ec7e9){if(_0x5ec7e9){return _0x3f0cbf['sendStatus'](_0x48f5e5);}return _0x3f0cbf[_0x5faa('0x19')](_0x48f5e5)['end']();};}function respondWithResult(_0x20da5c,_0x508222){_0x508222=_0x508222||0xc8;return function(_0x178bf5){if(_0x178bf5){return _0x20da5c[_0x5faa('0x19')](_0x508222)['json'](_0x178bf5);}};}function respondWithFilteredResult(_0x5c62c3,_0x345ecf){return function(_0x3f965b){if(_0x3f965b){var _0x328dff=_0x3f965b[_0x5faa('0x1a')],_0x545440=_0x345ecf[_0x5faa('0x1b')],_0x2f0052=_0x345ecf['offset']+_0x345ecf[_0x5faa('0x1c')],_0x5b280a;if(_0x2f0052>=_0x328dff){_0x2f0052=_0x328dff;_0x5b280a=0xc8;}else{_0x5b280a=0xce;}_0x5c62c3[_0x5faa('0x19')](_0x5b280a);return _0x5c62c3['set'](_0x5faa('0x1d'),_0x545440+'-'+_0x2f0052+'/'+_0x328dff)[_0x5faa('0x1e')](_0x3f965b);}return null;};}function patchUpdates(_0x1820b1){return function(_0x5ce50d){try{jsonpatch[_0x5faa('0x1f')](_0x5ce50d,_0x1820b1,!![]);}catch(_0x1fe6fa){return BPromise['reject'](_0x1fe6fa);}return _0x5ce50d[_0x5faa('0x20')]();};}function saveUpdates(_0x56b0c6,_0x3bdf8a){return function(_0x36f477){if(_0x36f477){return _0x36f477[_0x5faa('0x21')](_0x56b0c6)[_0x5faa('0x22')](function(_0x33cd65){return _0x33cd65;});}return null;};}function removeEntity(_0x5e6764,_0x56a503){return function(_0x4edb07){if(_0x4edb07){return _0x4edb07[_0x5faa('0x23')]()['then'](function(){_0x5e6764['status'](0xcc)[_0x5faa('0x24')]();});}};}function handleEntityNotFound(_0x5a81f5,_0x2a6d50){return function(_0x1ba288){if(!_0x1ba288){_0x5a81f5[_0x5faa('0x25')](0x194);}return _0x1ba288;};}function handleError(_0x2335ca,_0x4c7e0b){_0x4c7e0b=_0x4c7e0b||0x1f4;return function(_0x3b6482){logger[_0x5faa('0x26')](_0x3b6482[_0x5faa('0x27')]);if(_0x3b6482[_0x5faa('0x28')]){delete _0x3b6482['name'];}_0x2335ca['status'](_0x4c7e0b)[_0x5faa('0x29')](_0x3b6482);};}exports['index']=function(_0x20fbf3,_0x5d967d){var _0x3567a2={},_0x177927={},_0x5d14e6={'count':0x0,'rows':[]};var _0x1fccdc=_[_0x5faa('0x2a')](db['ScreenRecording'][_0x5faa('0x2b')],function(_0x1c36b9){return{'name':_0x1c36b9[_0x5faa('0x2c')],'type':_0x1c36b9[_0x5faa('0x2d')][_0x5faa('0x2e')]};});_0x177927[_0x5faa('0x2f')]=_[_0x5faa('0x30')](_[_0x5faa('0x2a')](_0x1fccdc,_0x5faa('0x28')),[_0x5faa('0x31')]);_0x177927['query']=_[_0x5faa('0x32')](_0x20fbf3[_0x5faa('0x33')]);_0x177927[_0x5faa('0x34')]=_[_0x5faa('0x35')](_0x177927[_0x5faa('0x2f')],_0x177927[_0x5faa('0x33')]);_0x3567a2[_0x5faa('0x36')]=_[_0x5faa('0x35')](_0x177927['model'],qs[_0x5faa('0x37')](_0x20fbf3[_0x5faa('0x33')]['fields']));_0x3567a2['attributes']=_0x3567a2[_0x5faa('0x36')]['length']?_0x3567a2[_0x5faa('0x36')]:_0x177927['model'];if(!_0x20fbf3[_0x5faa('0x33')][_0x5faa('0x38')](_0x5faa('0x39'))){_0x3567a2[_0x5faa('0x1c')]=qs[_0x5faa('0x1c')](_0x20fbf3['query']['limit']);_0x3567a2[_0x5faa('0x1b')]=qs[_0x5faa('0x1b')](_0x20fbf3[_0x5faa('0x33')][_0x5faa('0x1b')]);}_0x3567a2[_0x5faa('0x3a')]=qs[_0x5faa('0x3b')](_0x20fbf3[_0x5faa('0x33')]['sort']);_0x3567a2[_0x5faa('0x3c')]=qs[_0x5faa('0x34')](_[_0x5faa('0x3d')](_0x20fbf3[_0x5faa('0x33')],_0x177927['filters']),_0x1fccdc);if(_0x20fbf3[_0x5faa('0x33')][_0x5faa('0x3e')]){_0x3567a2['where']=_[_0x5faa('0x3f')](_0x3567a2[_0x5faa('0x3c')],{'$or':_[_0x5faa('0x2a')](_0x1fccdc,function(_0x48e492){if(_0x48e492[_0x5faa('0x2d')]!==_0x5faa('0x40')){var _0x249ecf={};_0x249ecf[_0x48e492['name']]={'$like':'%'+_0x20fbf3[_0x5faa('0x33')][_0x5faa('0x3e')]+'%'};return _0x249ecf;}})});}_0x3567a2=_[_0x5faa('0x3f')]({},_0x3567a2,_0x20fbf3[_0x5faa('0x41')]);var _0x957361={'where':_0x3567a2[_0x5faa('0x3c')]};return db[_0x5faa('0x42')][_0x5faa('0x1a')](_0x957361)[_0x5faa('0x22')](function(_0x1fcd5b){_0x5d14e6[_0x5faa('0x1a')]=_0x1fcd5b;if(_0x20fbf3['query']['includeAll']){_0x3567a2[_0x5faa('0x43')]=[{'all':!![]}];}return db[_0x5faa('0x42')][_0x5faa('0x44')](_0x3567a2);})[_0x5faa('0x22')](function(_0x3bf5a8){_0x5d14e6['rows']=_0x3bf5a8;return _0x5d14e6;})[_0x5faa('0x22')](respondWithFilteredResult(_0x5d967d,_0x3567a2))['catch'](handleError(_0x5d967d,null));};exports[_0x5faa('0x45')]=function(_0x566f89,_0x596a32){var _0x149388={'raw':![],'where':{'id':_0x566f89[_0x5faa('0x46')]['id']}},_0x569c02={};_0x569c02[_0x5faa('0x2f')]=_[_0x5faa('0x32')](db[_0x5faa('0x42')][_0x5faa('0x2b')]);_0x569c02['query']=_[_0x5faa('0x32')](_0x566f89[_0x5faa('0x33')]);_0x569c02['filters']=_[_0x5faa('0x35')](_0x569c02[_0x5faa('0x2f')],_0x569c02['query']);_0x149388[_0x5faa('0x36')]=_[_0x5faa('0x35')](_0x569c02[_0x5faa('0x2f')],qs[_0x5faa('0x37')](_0x566f89[_0x5faa('0x33')][_0x5faa('0x37')]));_0x149388[_0x5faa('0x36')]=_0x149388[_0x5faa('0x36')][_0x5faa('0x47')]?_0x149388[_0x5faa('0x36')]:_0x569c02[_0x5faa('0x2f')];if(_0x566f89[_0x5faa('0x33')]['includeAll']){_0x149388[_0x5faa('0x43')]=[{'all':!![]}];}_0x149388=_[_0x5faa('0x3f')]({},_0x149388,_0x566f89[_0x5faa('0x41')]);return db['ScreenRecording'][_0x5faa('0x48')](_0x149388)[_0x5faa('0x22')](handleEntityNotFound(_0x596a32,null))[_0x5faa('0x22')](respondWithResult(_0x596a32,null))[_0x5faa('0x49')](handleError(_0x596a32,null));};exports[_0x5faa('0x4a')]=function(_0x32ca3f,_0x33ec18){return db['ScreenRecording'][_0x5faa('0x4a')](_0x32ca3f['body'],{})[_0x5faa('0x22')](respondWithResult(_0x33ec18,0xc9))[_0x5faa('0x49')](handleError(_0x33ec18,null));};exports['update']=function(_0xe48057,_0x2fb5dd){if(_0xe48057[_0x5faa('0x4b')]['id']){delete _0xe48057['body']['id'];}delete _0xe48057[_0x5faa('0x4b')][_0x5faa('0x4c')];delete _0xe48057['body'][_0x5faa('0x4d')];delete _0xe48057[_0x5faa('0x4b')][_0x5faa('0x4e')];delete _0xe48057['body']['value'];return db[_0x5faa('0x42')][_0x5faa('0x48')]({'where':{'id':_0xe48057[_0x5faa('0x46')]['id']}})[_0x5faa('0x22')](handleEntityNotFound(_0x2fb5dd,null))[_0x5faa('0x22')](saveUpdates(_0xe48057[_0x5faa('0x4b')],null))[_0x5faa('0x22')](respondWithResult(_0x2fb5dd,null))[_0x5faa('0x49')](handleError(_0x2fb5dd,null));};exports['describe']=function(_0x4a163c,_0x1b6a28){return db['ScreenRecording'][_0x5faa('0x4f')]()[_0x5faa('0x22')](respondWithResult(_0x1b6a28,null))[_0x5faa('0x49')](handleError(_0x1b6a28,null));};exports['download']=function(_0x567c45,_0x3a4f19,_0x4b6b66){var _0x582a5a=require('../../components/encryptor');var _0x4f2ec4=![];var _0x338af7={};if(_0x567c45[_0x5faa('0x33')]['type']&&_0x567c45[_0x5faa('0x33')][_0x5faa('0x2d')]===_0x5faa('0x50')){_0x338af7['uniqueid']=_0x567c45[_0x5faa('0x46')]['id'];}else{_0x338af7['id']=_0x567c45[_0x5faa('0x46')]['id'];}return db[_0x5faa('0x42')][_0x5faa('0x48')]({'where':_0x338af7,'attributes':['id',_0x5faa('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x3a4f19,null))[_0x5faa('0x22')](function(_0x23bdd3){if(_0x23bdd3){var _0x45a038=path[_0x5faa('0x52')](config[_0x5faa('0x53')],'server/files/screen_recordings',_0x23bdd3[_0x5faa('0x51')]);var _0x25cdb8=util[_0x5faa('0x31')](_0x5faa('0x54'),_0x45a038);if(fs[_0x5faa('0x55')](_0x25cdb8)){_0x4f2ec4=!![];return _0x582a5a['decryptFile'](_0x25cdb8,_0x45a038,config['secrets'][_0x5faa('0x56')])[_0x5faa('0x22')](function(){return _0x23bdd3;});}return _0x23bdd3;}})[_0x5faa('0x22')](function(_0xb44367){if(_0xb44367){var _0x19f97f=path[_0x5faa('0x52')](config[_0x5faa('0x53')],_0x5faa('0x57'),_0xb44367[_0x5faa('0x51')]);if(!fs['existsSync'](_0x19f97f)){throw new db[(_0x5faa('0x58'))][(_0x5faa('0x59'))](_0x5faa('0x5a'));}if(_0xb44367[_0x5faa('0x5b')]){return _0x3a4f19[_0x5faa('0x5c')](_0x19f97f,_0xb44367[_0x5faa('0x5b')]+path[_0x5faa('0x5d')](_0x19f97f),function(){if(_0x4f2ec4){fs[_0x5faa('0x5e')](_0x19f97f);}});}else{return _0x3a4f19[_0x5faa('0x5c')](_0x19f97f,function(_0x33db6d){if(_0x4f2ec4){fs[_0x5faa('0x5e')](_0x19f97f);}});}}})['catch'](function(_0xd7e110){if(_0xd7e110[_0x5faa('0x5f')]==='ScreenRecording\x20not\x20found'){_0x3a4f19[_0x5faa('0x19')](0x194)[_0x5faa('0x29')](_0x5faa('0x60'));}else{return handleError(_0x3a4f19,null);}});};exports[_0x5faa('0x23')]=function(_0x19fcb3,_0x12f36a){return db[_0x5faa('0x42')]['find']({'where':{'id':_0x19fcb3[_0x5faa('0x46')]['id']}})[_0x5faa('0x22')](function(_0xca8b53){if(!_0xca8b53)throw new ReferenceError('Entity\x20not\x20found');return _0xca8b53;})[_0x5faa('0x22')](function(_0x7a77eb){var _0x3c4fc6=path['join'](config['root'],_0x5faa('0x57'),_0x7a77eb[_0x5faa('0x51')]);logger['info'](_0x5faa('0x61'),_0x3c4fc6);if(!_[_0x5faa('0x62')](_0x7a77eb[_0x5faa('0x51')])&&fs[_0x5faa('0x55')](_0x3c4fc6)){logger[_0x5faa('0x63')](_0x5faa('0x64')+_0x3c4fc6+_0x5faa('0x65'));fs[_0x5faa('0x66')](_0x3c4fc6);}_0x3c4fc6=_0x3c4fc6+_0x5faa('0x67');if(!_[_0x5faa('0x62')](_0x7a77eb['value'])&&fs[_0x5faa('0x55')](_0x3c4fc6)){logger[_0x5faa('0x63')]('File:\x20\x22'+_0x3c4fc6+_0x5faa('0x65'));fs[_0x5faa('0x66')](_0x3c4fc6);}return _0x7a77eb;})[_0x5faa('0x22')](function(_0x217d06){if(!_0x217d06)throw new InternalError();return _0x217d06['destroy']();})[_0x5faa('0x22')](function(){_0x12f36a['status'](0xcc)[_0x5faa('0x24')]();})[_0x5faa('0x49')](handleError(_0x12f36a,null));}; \ No newline at end of file +var _0x199c=['differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','ScreenRecording','include','findAll','rows','catch','params','includeAll','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x1aa3b6,_0x38dcc7){var _0x541e1a=function(_0x1f6fe7){while(--_0x1f6fe7){_0x1aa3b6['push'](_0x1aa3b6['shift']());}};_0x541e1a(++_0x38dcc7);}(_0x199c,0x174));var _0xc199=function(_0x3a5de3,_0x141221){_0x3a5de3=_0x3a5de3-0x0;var _0x3d3f68=_0x199c[_0x3a5de3];return _0x3d3f68;};'use strict';var pdf=require(_0xc199('0x0'));var emlformat=require(_0xc199('0x1'));var rimraf=require(_0xc199('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc199('0x3'));var BPromise=require(_0xc199('0x4'));var Mustache=require(_0xc199('0x5'));var util=require('util');var path=require(_0xc199('0x6'));var sox=require(_0xc199('0x7'));var csv=require('to-csv');var ejs=require(_0xc199('0x8'));var fs=require('fs');var fs_extra=require(_0xc199('0x9'));var _=require('lodash');var squel=require(_0xc199('0xa'));var crypto=require('crypto');var jsforce=require(_0xc199('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc199('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc199('0xd'));var as=require(_0xc199('0xe'));var hardwareService=require(_0xc199('0xf'));var logger=require(_0xc199('0x10'))(_0xc199('0x11'));var utils=require(_0xc199('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x250620,_0x130bc3){_0x130bc3=_0x130bc3||0xcc;return function(_0x46ef08){if(_0x46ef08){return _0x250620[_0xc199('0x13')](_0x130bc3);}return _0x250620[_0xc199('0x14')](_0x130bc3)[_0xc199('0x15')]();};}function respondWithResult(_0x478a2a,_0x5a1b0b){_0x5a1b0b=_0x5a1b0b||0xc8;return function(_0x2b9fd6){if(_0x2b9fd6){return _0x478a2a['status'](_0x5a1b0b)[_0xc199('0x16')](_0x2b9fd6);}};}function respondWithFilteredResult(_0x6e57c0,_0x125f30){return function(_0x14e437){if(_0x14e437){var _0x48072d=_0x14e437[_0xc199('0x17')],_0x27fd9b=_0x125f30[_0xc199('0x18')],_0x173253=_0x125f30[_0xc199('0x18')]+_0x125f30[_0xc199('0x19')],_0x50ced8;if(_0x173253>=_0x48072d){_0x173253=_0x48072d;_0x50ced8=0xc8;}else{_0x50ced8=0xce;}_0x6e57c0['status'](_0x50ced8);return _0x6e57c0[_0xc199('0x1a')](_0xc199('0x1b'),_0x27fd9b+'-'+_0x173253+'/'+_0x48072d)[_0xc199('0x16')](_0x14e437);}return null;};}function patchUpdates(_0x345646){return function(_0x38b47b){try{jsonpatch[_0xc199('0x1c')](_0x38b47b,_0x345646,!![]);}catch(_0x2f6a46){return BPromise[_0xc199('0x1d')](_0x2f6a46);}return _0x38b47b[_0xc199('0x1e')]();};}function saveUpdates(_0x4229aa,_0x425dcd){return function(_0x2e7072){if(_0x2e7072){return _0x2e7072[_0xc199('0x1f')](_0x4229aa)['then'](function(_0x5b4d1a){return _0x5b4d1a;});}return null;};}function removeEntity(_0x37be34,_0x262493){return function(_0x18971f){if(_0x18971f){return _0x18971f[_0xc199('0x20')]()[_0xc199('0x21')](function(){_0x37be34[_0xc199('0x14')](0xcc)[_0xc199('0x15')]();});}};}function handleEntityNotFound(_0x2827f0,_0x112613){return function(_0x15d491){if(!_0x15d491){_0x2827f0['sendStatus'](0x194);}return _0x15d491;};}function handleError(_0x369aab,_0x25a53a){_0x25a53a=_0x25a53a||0x1f4;return function(_0x1e03f2){logger[_0xc199('0x22')](_0x1e03f2['stack']);if(_0x1e03f2[_0xc199('0x23')]){delete _0x1e03f2[_0xc199('0x23')];}_0x369aab[_0xc199('0x14')](_0x25a53a)[_0xc199('0x24')](_0x1e03f2);};}exports[_0xc199('0x25')]=function(_0x350d98,_0x58b729){var _0x3c7b85={},_0x49cf40={},_0x19a86b={'count':0x0,'rows':[]};var _0x23cfd8=_[_0xc199('0x26')](db['ScreenRecording'][_0xc199('0x27')],function(_0x4d6f1e){return{'name':_0x4d6f1e[_0xc199('0x28')],'type':_0x4d6f1e[_0xc199('0x29')][_0xc199('0x2a')]};});_0x49cf40[_0xc199('0x2b')]=_[_0xc199('0x2c')](_[_0xc199('0x26')](_0x23cfd8,_0xc199('0x23')),['format']);_0x49cf40[_0xc199('0x2d')]=_[_0xc199('0x2e')](_0x350d98[_0xc199('0x2d')]);_0x49cf40[_0xc199('0x2f')]=_[_0xc199('0x30')](_0x49cf40['model'],_0x49cf40[_0xc199('0x2d')]);_0x3c7b85[_0xc199('0x31')]=_['intersection'](_0x49cf40[_0xc199('0x2b')],qs[_0xc199('0x32')](_0x350d98[_0xc199('0x2d')][_0xc199('0x32')]));_0x3c7b85[_0xc199('0x31')]=_0x3c7b85['attributes'][_0xc199('0x33')]?_0x3c7b85['attributes']:_0x49cf40[_0xc199('0x2b')];if(!_0x350d98[_0xc199('0x2d')][_0xc199('0x34')](_0xc199('0x35'))){_0x3c7b85[_0xc199('0x19')]=qs[_0xc199('0x19')](_0x350d98['query']['limit']);_0x3c7b85[_0xc199('0x18')]=qs[_0xc199('0x18')](_0x350d98[_0xc199('0x2d')][_0xc199('0x18')]);}_0x3c7b85[_0xc199('0x36')]=qs[_0xc199('0x37')](_0x350d98[_0xc199('0x2d')][_0xc199('0x37')]);_0x3c7b85[_0xc199('0x38')]=qs['filters'](_[_0xc199('0x39')](_0x350d98[_0xc199('0x2d')],_0x49cf40[_0xc199('0x2f')]),_0x23cfd8);if(_0x350d98['query']['filter']){_0x3c7b85[_0xc199('0x38')]=_['merge'](_0x3c7b85['where'],{'$or':_[_0xc199('0x26')](_0x23cfd8,function(_0x4eb578){if(_0x4eb578[_0xc199('0x29')]!==_0xc199('0x3a')){var _0x5789ea={};_0x5789ea[_0x4eb578[_0xc199('0x23')]]={'$like':'%'+_0x350d98[_0xc199('0x2d')][_0xc199('0x3b')]+'%'};return _0x5789ea;}})});}_0x3c7b85=_[_0xc199('0x3c')]({},_0x3c7b85,_0x350d98[_0xc199('0x3d')]);var _0x58dd00={'where':_0x3c7b85[_0xc199('0x38')]};return db[_0xc199('0x3e')]['count'](_0x58dd00)[_0xc199('0x21')](function(_0x481827){_0x19a86b[_0xc199('0x17')]=_0x481827;if(_0x350d98[_0xc199('0x2d')]['includeAll']){_0x3c7b85[_0xc199('0x3f')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc199('0x40')](_0x3c7b85);})[_0xc199('0x21')](function(_0x588952){_0x19a86b[_0xc199('0x41')]=_0x588952;return _0x19a86b;})[_0xc199('0x21')](respondWithFilteredResult(_0x58b729,_0x3c7b85))[_0xc199('0x42')](handleError(_0x58b729,null));};exports['show']=function(_0x1ad572,_0x3cf87f){var _0x28abcf={'raw':![],'where':{'id':_0x1ad572[_0xc199('0x43')]['id']}},_0x209f49={};_0x209f49[_0xc199('0x2b')]=_[_0xc199('0x2e')](db['ScreenRecording']['rawAttributes']);_0x209f49[_0xc199('0x2d')]=_[_0xc199('0x2e')](_0x1ad572[_0xc199('0x2d')]);_0x209f49[_0xc199('0x2f')]=_[_0xc199('0x30')](_0x209f49[_0xc199('0x2b')],_0x209f49[_0xc199('0x2d')]);_0x28abcf[_0xc199('0x31')]=_[_0xc199('0x30')](_0x209f49[_0xc199('0x2b')],qs['fields'](_0x1ad572[_0xc199('0x2d')]['fields']));_0x28abcf['attributes']=_0x28abcf['attributes']['length']?_0x28abcf[_0xc199('0x31')]:_0x209f49[_0xc199('0x2b')];if(_0x1ad572[_0xc199('0x2d')][_0xc199('0x44')]){_0x28abcf['include']=[{'all':!![]}];}_0x28abcf=_[_0xc199('0x3c')]({},_0x28abcf,_0x1ad572[_0xc199('0x3d')]);return db['ScreenRecording'][_0xc199('0x45')](_0x28abcf)[_0xc199('0x21')](handleEntityNotFound(_0x3cf87f,null))['then'](respondWithResult(_0x3cf87f,null))[_0xc199('0x42')](handleError(_0x3cf87f,null));};exports[_0xc199('0x46')]=function(_0x4fef15,_0x2eed43){return db['ScreenRecording'][_0xc199('0x46')](_0x4fef15[_0xc199('0x47')],{})['then'](respondWithResult(_0x2eed43,0xc9))['catch'](handleError(_0x2eed43,null));};exports[_0xc199('0x1f')]=function(_0x5492d2,_0x5c0531){if(_0x5492d2[_0xc199('0x47')]['id']){delete _0x5492d2['body']['id'];}delete _0x5492d2[_0xc199('0x47')][_0xc199('0x48')];delete _0x5492d2[_0xc199('0x47')][_0xc199('0x49')];delete _0x5492d2[_0xc199('0x47')][_0xc199('0x4a')];delete _0x5492d2[_0xc199('0x47')][_0xc199('0x4b')];return db[_0xc199('0x3e')][_0xc199('0x45')]({'where':{'id':_0x5492d2[_0xc199('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c0531,null))[_0xc199('0x21')](saveUpdates(_0x5492d2['body'],null))['then'](respondWithResult(_0x5c0531,null))[_0xc199('0x42')](handleError(_0x5c0531,null));};exports['describe']=function(_0x1d3289,_0x406fdd){return db[_0xc199('0x3e')][_0xc199('0x4c')]()[_0xc199('0x21')](respondWithResult(_0x406fdd,null))[_0xc199('0x42')](handleError(_0x406fdd,null));};exports['download']=function(_0x36d133,_0x33d0bc,_0x4371fe){var _0x3810cd=require(_0xc199('0x4d'));var _0x482eb5=![];var _0x58171b={};if(_0x36d133[_0xc199('0x2d')][_0xc199('0x29')]&&_0x36d133[_0xc199('0x2d')][_0xc199('0x29')]===_0xc199('0x4e')){_0x58171b[_0xc199('0x4e')]=_0x36d133[_0xc199('0x43')]['id'];}else{_0x58171b['id']=_0x36d133['params']['id'];}return db['ScreenRecording'][_0xc199('0x45')]({'where':_0x58171b,'attributes':['id',_0xc199('0x4b')],'raw':!![]})[_0xc199('0x21')](handleEntityNotFound(_0x33d0bc,null))['then'](function(_0x5134b9){if(_0x5134b9){var _0x37a440=path[_0xc199('0x4f')](config[_0xc199('0x50')],_0xc199('0x51'),_0x5134b9[_0xc199('0x4b')]);var _0x4c70f2=util[_0xc199('0x52')](_0xc199('0x53'),_0x37a440);if(fs['existsSync'](_0x4c70f2)){_0x482eb5=!![];return _0x3810cd[_0xc199('0x54')](_0x4c70f2,_0x37a440,config[_0xc199('0x55')]['recording'])[_0xc199('0x21')](function(){return _0x5134b9;});}return _0x5134b9;}})[_0xc199('0x21')](function(_0xe872e9){if(_0xe872e9){var _0x1f3c8e=path['join'](config[_0xc199('0x50')],'server/files/screen_recordings',_0xe872e9[_0xc199('0x4b')]);if(!fs['existsSync'](_0x1f3c8e)){throw new db[(_0xc199('0x56'))][(_0xc199('0x57'))](_0xc199('0x58'));}if(_0xe872e9[_0xc199('0x59')]){return _0x33d0bc[_0xc199('0x5a')](_0x1f3c8e,_0xe872e9[_0xc199('0x59')]+path[_0xc199('0x5b')](_0x1f3c8e),function(){if(_0x482eb5){fs[_0xc199('0x5c')](_0x1f3c8e);}});}else{return _0x33d0bc[_0xc199('0x5a')](_0x1f3c8e,function(_0x3e72ce){if(_0x482eb5){fs[_0xc199('0x5c')](_0x1f3c8e);}});}}})[_0xc199('0x42')](function(_0x2ec837){if(_0x2ec837[_0xc199('0x5d')]===_0xc199('0x58')){_0x33d0bc[_0xc199('0x14')](0x194)[_0xc199('0x24')](_0xc199('0x5e'));}else{return handleError(_0x33d0bc,null);}});};exports[_0xc199('0x20')]=function(_0x13d7f9,_0x27a1eb){return db['ScreenRecording'][_0xc199('0x45')]({'where':{'id':_0x13d7f9['params']['id']}})[_0xc199('0x21')](function(_0x36fe95){if(!_0x36fe95)throw new ReferenceError(_0xc199('0x5f'));return _0x36fe95;})[_0xc199('0x21')](function(_0x9f7519){var _0x237586=path['join'](config[_0xc199('0x50')],_0xc199('0x51'),_0x9f7519[_0xc199('0x4b')]);logger['info'](_0xc199('0x60'),_0x237586);if(!_[_0xc199('0x61')](_0x9f7519['value'])&&fs[_0xc199('0x62')](_0x237586)){logger[_0xc199('0x63')](_0xc199('0x64')+_0x237586+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc199('0x65')](_0x237586);}_0x237586=_0x237586+_0xc199('0x66');if(!_[_0xc199('0x61')](_0x9f7519[_0xc199('0x4b')])&&fs[_0xc199('0x62')](_0x237586)){logger[_0xc199('0x63')]('File:\x20\x22'+_0x237586+_0xc199('0x67'));fs['unlinkSync'](_0x237586);}return _0x9f7519;})['then'](function(_0x2efad9){if(!_0x2efad9)throw new InternalError();return _0x2efad9['destroy']();})[_0xc199('0x21')](function(){_0x27a1eb['status'](0xcc)[_0xc199('0x15')]();})[_0xc199('0x42')](handleError(_0x27a1eb,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 4efc8eb..704daea 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 _0x884c=['../../config/environment','exports','ScreenRecording','screen_recordings','interactionid','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4380c0,_0x12ed8f){var _0x260f24=function(_0x193370){while(--_0x193370){_0x4380c0['push'](_0x4380c0['shift']());}};_0x260f24(++_0x12ed8f);}(_0x884c,0x191));var _0xc884=function(_0x5d7eb3,_0x4a2806){_0x5d7eb3=_0x5d7eb3-0x0;var _0x4b08e1=_0x884c[_0x5d7eb3];return _0x4b08e1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc884('0x0'))('api');var moment=require(_0xc884('0x1'));var BPromise=require(_0xc884('0x2'));var rp=require(_0xc884('0x3'));var fs=require('fs');var path=require(_0xc884('0x4'));var rimraf=require(_0xc884('0x5'));var config=require(_0xc884('0x6'));var attributes=require('./screenRecording.attributes');module[_0xc884('0x7')]=function(_0x4963fb,_0x5f5269){return _0x4963fb['define'](_0xc884('0x8'),attributes,{'tableName':_0xc884('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xc884('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba2e=['define','screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xba2e,0xf1));var _0xeba2=function(_0x103219,_0xe4e538){_0x103219=_0x103219-0x0;var _0x587d26=_0xba2e[_0x103219];return _0x587d26;};'use strict';var _=require(_0xeba2('0x0'));var util=require(_0xeba2('0x1'));var logger=require(_0xeba2('0x2'))('api');var moment=require(_0xeba2('0x3'));var BPromise=require(_0xeba2('0x4'));var rp=require(_0xeba2('0x5'));var fs=require('fs');var path=require(_0xeba2('0x6'));var rimraf=require(_0xeba2('0x7'));var config=require(_0xeba2('0x8'));var attributes=require(_0xeba2('0x9'));module[_0xeba2('0xa')]=function(_0x5d71cf,_0x4174b7){return _0x5d71cf[_0xeba2('0xb')]('ScreenRecording',attributes,{'tableName':_0xeba2('0xc'),'paranoid':![],'indexes':[{'name':_0xeba2('0xd'),'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 2f64bf6..c43ee8a 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(_0x2182be,_0x2f270f){var _0x5cd552=function(_0x39f900){while(--_0x39f900){_0x2182be['push'](_0x2182be['shift']());}};_0x5cd552(++_0x2f270f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x216eee,_0x4dc1b3){var _0x194696=function(_0x261e4f){while(--_0x261e4f){_0x216eee['push'](_0x216eee['shift']());}};_0x194696(++_0x4dc1b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 2a2864d..4b38a74 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 _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x1b51f9,_0x46240e){var _0x46cf16=function(_0x3034c3){while(--_0x3034c3){_0x1b51f9['push'](_0x1b51f9['shift']());}};_0x46cf16(++_0x46240e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x1255f5,_0x31549f){var _0x533430=function(_0x3682b6){while(--_0x3682b6){_0x1255f5['push'](_0x1255f5['shift']());}};_0x533430(++_0x31549f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 715642e..1aef063 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 _0x9fe8=['sequelize','exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fe8,0x1ea));var _0x89fe=function(_0x86d7f3,_0x38f21a){_0x86d7f3=_0x86d7f3-0x0;var _0x554694=_0x9fe8[_0x86d7f3];return _0x554694;};'use strict';var Sequelize=require(_0x89fe('0x0'));module[_0x89fe('0x1')]={'min_internal':{'type':Sequelize[_0x89fe('0x2')](0xb),'unique':_0x89fe('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x89fe('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x89fe('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x89fe('0x4')],'defaultValue':_0x89fe('0x5')},'logo':{'type':Sequelize[_0x89fe('0x4')]},'defaultLogo':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x89fe('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x89fe('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x89fe('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x89fe('0x4')]},'pageTitle':{'type':Sequelize[_0x89fe('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x89fe('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x89fe('0x4')],'defaultValue':_0x89fe('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x89fe('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x89fe('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x89fe('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x89fe('0x4')],'defaultValue':_0x89fe('0x8')},'chatTimeout':{'type':Sequelize[_0x89fe('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x89fe('0x4')]},'defaultPreferred':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x89fe('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x89fe('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x89fe('0x4')]},'defaultFavicon':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x89fe('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x89fe('0x4')]},'sentiment':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x89fe('0x2')]},'sentimentRegion':{'type':Sequelize[_0x89fe('0x4')]},'language':{'type':Sequelize[_0x89fe('0x4')]},'bucket':{'type':Sequelize[_0x89fe('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x89fe('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x89fe('0x2')](0x2)[_0x89fe('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x89fe('0x2')](0x2)[_0x89fe('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x89fe('0x2')](0x2)[_0x89fe('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x89fe('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x89fe('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x89fe('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcf0e=['UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x767582,_0x30d2f1){var _0x28df3b=function(_0x188443){while(--_0x188443){_0x767582['push'](_0x767582['shift']());}};_0x28df3b(++_0x30d2f1);}(_0xcf0e,0xe8));var _0xecf0=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xcf0e[_0x3a7a9c];return _0x59156e;};'use strict';var Sequelize=require(_0xecf0('0x0'));module[_0xecf0('0x1')]={'min_internal':{'type':Sequelize[_0xecf0('0x2')](0xb),'unique':_0xecf0('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xecf0('0x2')](0xb),'unique':_0xecf0('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xecf0('0x5')],'defaultValue':_0xecf0('0x6')},'logo':{'type':Sequelize[_0xecf0('0x5')]},'defaultLogo':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xecf0('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xecf0('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xecf0('0x5')]},'turnpassword':{'type':Sequelize[_0xecf0('0x5')]},'pageTitle':{'type':Sequelize[_0xecf0('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xecf0('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xecf0('0x5')],'defaultValue':_0xecf0('0x8')},'enableEmailPreview':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xecf0('0x5')],'defaultValue':_0xecf0('0x9')},'chatTimeout':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xecf0('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xecf0('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xecf0('0x5')]},'sentiment':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xecf0('0x2')]},'sentimentRegion':{'type':Sequelize[_0xecf0('0x5')]},'language':{'type':Sequelize[_0xecf0('0x5')]},'bucket':{'type':Sequelize[_0xecf0('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xecf0('0x2')](0x2)[_0xecf0('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xecf0('0x2')](0x2)[_0xecf0('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xecf0('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xecf0('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index d1e4cb9..d27b1da 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 _0xfdda=['getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','apply','reject','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','Setting','count','include','findAll','rows','params','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','root','join','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfdda,0xf8));var _0xafdd=function(_0x5b87ce,_0x20b7f6){_0x5b87ce=_0x5b87ce-0x0;var _0x597aa7=_0xfdda[_0x5b87ce];return _0x597aa7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xafdd('0x0'));var rimraf=require(_0xafdd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xafdd('0x2'));var rp=require(_0xafdd('0x3'));var moment=require(_0xafdd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xafdd('0x5'));var util=require(_0xafdd('0x6'));var path=require(_0xafdd('0x7'));var sox=require(_0xafdd('0x8'));var csv=require(_0xafdd('0x9'));var ejs=require(_0xafdd('0xa'));var fs=require('fs');var fs_extra=require(_0xafdd('0xb'));var _=require('lodash');var squel=require(_0xafdd('0xc'));var crypto=require('crypto');var jsforce=require(_0xafdd('0xd'));var deskjs=require(_0xafdd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xafdd('0xf'));var Papa=require(_0xafdd('0x10'));var Redis=require(_0xafdd('0x11'));var authService=require(_0xafdd('0x12'));var qs=require(_0xafdd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xafdd('0x14'))(_0xafdd('0x15'));var utils=require(_0xafdd('0x16'));var config=require(_0xafdd('0x17'));var licenseUtil=require(_0xafdd('0x18'));var db=require(_0xafdd('0x19'))['db'];var jayson=require(_0xafdd('0x1a'));var client=jayson[_0xafdd('0x1b')][_0xafdd('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x417aae,_0x41518e,_0x3f7812,_0xcf8ae2){return new BPromise(function(_0x82d09e,_0x34b4f0){var _0x24e7b0=_0xcf8ae2||client;return _0x24e7b0[_0xafdd('0x1d')](_0x417aae,_0x3f7812)[_0xafdd('0x1e')](function(_0x1f157a){logger['info']('Setting,\x20%s,\x20%s',_0x41518e,_0xafdd('0x1f'));logger[_0xafdd('0x20')](_0xafdd('0x21'),_0x41518e,'request\x20sent',JSON[_0xafdd('0x22')](_0x1f157a));if(_0x1f157a['error']){if(_0x1f157a[_0xafdd('0x23')][_0xafdd('0x24')]===0x1f4){logger['error'](_0xafdd('0x25'),_0x41518e,_0x1f157a['error']['message']);return _0x34b4f0(_0x1f157a[_0xafdd('0x23')][_0xafdd('0x26')]);}logger[_0xafdd('0x23')](_0xafdd('0x25'),_0x41518e,_0x1f157a['error'][_0xafdd('0x26')]);return _0x82d09e(_0x1f157a[_0xafdd('0x23')][_0xafdd('0x26')]);}else{logger[_0xafdd('0x27')](_0xafdd('0x25'),_0x41518e,_0xafdd('0x1f'));_0x82d09e(_0x1f157a[_0xafdd('0x28')][_0xafdd('0x26')]);}})[_0xafdd('0x29')](function(_0x165111){logger[_0xafdd('0x23')](_0xafdd('0x25'),_0x41518e,_0x165111);_0x34b4f0(_0x165111);});});}function respondWithStatusCode(_0x13354a,_0x10f4e6){_0x10f4e6=_0x10f4e6||0xcc;return function(_0x272108){if(_0x272108){return _0x13354a[_0xafdd('0x2a')](_0x10f4e6);}return _0x13354a[_0xafdd('0x2b')](_0x10f4e6)[_0xafdd('0x2c')]();};}function respondWithResult(_0xf19a4e,_0x3df725){_0x3df725=_0x3df725||0xc8;return function(_0x2c071b){if(_0x2c071b){return _0xf19a4e['status'](_0x3df725)[_0xafdd('0x2d')](_0x2c071b);}};}function respondWithFilteredResult(_0x479399,_0x502601){return function(_0x301cf8){if(_0x301cf8){var _0x376a6e=_0x301cf8['count'],_0x16eadd=_0x502601[_0xafdd('0x2e')],_0x389599=_0x502601['offset']+_0x502601['limit'],_0xe519da;if(_0x389599>=_0x376a6e){_0x389599=_0x376a6e;_0xe519da=0xc8;}else{_0xe519da=0xce;}_0x479399[_0xafdd('0x2b')](_0xe519da);return _0x479399['set']('Content-Range',_0x16eadd+'-'+_0x389599+'/'+_0x376a6e)['json'](_0x301cf8);}return null;};}function patchUpdates(_0x2499e6){return function(_0xec60a2){try{jsonpatch[_0xafdd('0x2f')](_0xec60a2,_0x2499e6,!![]);}catch(_0x568c77){return BPromise[_0xafdd('0x30')](_0x568c77);}return _0xec60a2['save']();};}function saveUpdates(_0x5dacd8,_0x101093){return function(_0x3df270){if(_0x3df270){return _0x3df270[_0xafdd('0x31')](_0x5dacd8)[_0xafdd('0x1e')](function(_0x1759f3){return _0x1759f3;});}return null;};}function removeEntity(_0x4522d1,_0x76efa1){return function(_0x4b7840){if(_0x4b7840){return _0x4b7840[_0xafdd('0x32')]()[_0xafdd('0x1e')](function(){_0x4522d1[_0xafdd('0x2b')](0xcc)[_0xafdd('0x2c')]();});}};}function handleEntityNotFound(_0x23121f,_0x1e325a){return function(_0x5edba0){if(!_0x5edba0){_0x23121f['sendStatus'](0x194);}return _0x5edba0;};}function handleError(_0x5cccdd,_0x27f847){_0x27f847=_0x27f847||0x1f4;return function(_0x3b508b){logger[_0xafdd('0x23')](_0x3b508b['stack']);if(_0x3b508b[_0xafdd('0x33')]){delete _0x3b508b[_0xafdd('0x33')];}_0x5cccdd[_0xafdd('0x2b')](_0x27f847)[_0xafdd('0x34')](_0x3b508b);};}exports[_0xafdd('0x35')]=function(_0x2fb68a,_0x164c2e){var _0x4bc8a7={},_0xdf1597={},_0x322fa7={'count':0x0,'rows':[]};var _0x14ae3f=_[_0xafdd('0x36')](db['Setting'][_0xafdd('0x37')],function(_0x5510d4){return{'name':_0x5510d4[_0xafdd('0x38')],'type':_0x5510d4[_0xafdd('0x39')][_0xafdd('0x3a')]};});_0xdf1597[_0xafdd('0x3b')]=_[_0xafdd('0x36')](_0x14ae3f,'name');_0xdf1597[_0xafdd('0x3c')]=_[_0xafdd('0x3d')](_0x2fb68a['query']);_0xdf1597[_0xafdd('0x3e')]=_[_0xafdd('0x3f')](_0xdf1597[_0xafdd('0x3b')],_0xdf1597[_0xafdd('0x3c')]);_0x4bc8a7[_0xafdd('0x40')]=_[_0xafdd('0x3f')](_0xdf1597[_0xafdd('0x3b')],qs[_0xafdd('0x41')](_0x2fb68a[_0xafdd('0x3c')][_0xafdd('0x41')]));_0x4bc8a7[_0xafdd('0x40')]=_0x4bc8a7[_0xafdd('0x40')][_0xafdd('0x42')]?_0x4bc8a7[_0xafdd('0x40')]:_0xdf1597[_0xafdd('0x3b')];if(!_0x2fb68a['query'][_0xafdd('0x43')](_0xafdd('0x44'))){_0x4bc8a7['limit']=qs[_0xafdd('0x45')](_0x2fb68a['query'][_0xafdd('0x45')]);_0x4bc8a7['offset']=qs[_0xafdd('0x2e')](_0x2fb68a[_0xafdd('0x3c')][_0xafdd('0x2e')]);}_0x4bc8a7['order']=qs[_0xafdd('0x46')](_0x2fb68a['query'][_0xafdd('0x46')]);_0x4bc8a7[_0xafdd('0x47')]=qs[_0xafdd('0x3e')](_[_0xafdd('0x48')](_0x2fb68a[_0xafdd('0x3c')],_0xdf1597[_0xafdd('0x3e')]),_0x14ae3f);if(_0x2fb68a[_0xafdd('0x3c')]['filter']){_0x4bc8a7[_0xafdd('0x47')]=_[_0xafdd('0x49')](_0x4bc8a7[_0xafdd('0x47')],{'$or':_[_0xafdd('0x36')](_0x14ae3f,function(_0x550fd7){if(_0x550fd7['type']!==_0xafdd('0x4a')){var _0x318025={};_0x318025[_0x550fd7[_0xafdd('0x33')]]={'$like':'%'+_0x2fb68a[_0xafdd('0x3c')]['filter']+'%'};return _0x318025;}})});}_0x4bc8a7=_[_0xafdd('0x49')]({},_0x4bc8a7,_0x2fb68a[_0xafdd('0x4b')]);var _0x2154fa={'where':_0x4bc8a7[_0xafdd('0x47')]};return db[_0xafdd('0x4c')][_0xafdd('0x4d')](_0x2154fa)[_0xafdd('0x1e')](function(_0x487dd7){_0x322fa7['count']=_0x487dd7;if(_0x2fb68a[_0xafdd('0x3c')]['includeAll']){_0x4bc8a7[_0xafdd('0x4e')]=[{'all':!![]}];}return db[_0xafdd('0x4c')][_0xafdd('0x4f')](_0x4bc8a7);})['then'](function(_0x3083dc){_0x322fa7[_0xafdd('0x50')]=_0x3083dc;return _0x322fa7;})[_0xafdd('0x1e')](respondWithFilteredResult(_0x164c2e,_0x4bc8a7))['catch'](handleError(_0x164c2e,null));};exports['show']=function(_0x5bed7b,_0x53be6a){var _0x117ab1={'raw':![],'where':{'id':_0x5bed7b[_0xafdd('0x51')]['id']}},_0x2f3922={};_0x2f3922[_0xafdd('0x3b')]=_[_0xafdd('0x3d')](db[_0xafdd('0x4c')][_0xafdd('0x37')]);_0x2f3922['query']=_[_0xafdd('0x3d')](_0x5bed7b[_0xafdd('0x3c')]);_0x2f3922[_0xafdd('0x3e')]=_['intersection'](_0x2f3922[_0xafdd('0x3b')],_0x2f3922[_0xafdd('0x3c')]);_0x117ab1[_0xafdd('0x40')]=_[_0xafdd('0x3f')](_0x2f3922[_0xafdd('0x3b')],qs[_0xafdd('0x41')](_0x5bed7b['query'][_0xafdd('0x41')]));_0x117ab1[_0xafdd('0x40')]=_0x117ab1[_0xafdd('0x40')][_0xafdd('0x42')]?_0x117ab1[_0xafdd('0x40')]:_0x2f3922[_0xafdd('0x3b')];if(_0x5bed7b[_0xafdd('0x3c')]['includeAll']){_0x117ab1['include']=[{'all':!![]}];}_0x117ab1=_[_0xafdd('0x49')]({},_0x117ab1,_0x5bed7b['options']);return db[_0xafdd('0x4c')][_0xafdd('0x52')](_0x117ab1)[_0xafdd('0x1e')](handleEntityNotFound(_0x53be6a,null))['then'](respondWithResult(_0x53be6a,null))[_0xafdd('0x29')](handleError(_0x53be6a,null));};exports['update']=function(_0x2a7130,_0x287569){if(_0x2a7130[_0xafdd('0x53')]['id']){delete _0x2a7130['body']['id'];}return db[_0xafdd('0x4c')][_0xafdd('0x52')]({'where':{'id':_0x2a7130[_0xafdd('0x51')]['id']}})[_0xafdd('0x1e')](handleEntityNotFound(_0x287569,null))['then'](saveUpdates(_0x2a7130['body'],null))[_0xafdd('0x1e')](respondWithResult(_0x287569,null))[_0xafdd('0x29')](handleError(_0x287569,null));};exports[_0xafdd('0x54')]=function(_0x584291,_0x34c2af,_0x3b858b){if(_0x584291[_0xafdd('0x55')]&&_0x584291[_0xafdd('0x55')][_0xafdd('0x56')]){_0x584291[_0xafdd('0x53')]['logo']=_0x584291[_0xafdd('0x55')][_0xafdd('0x56')];}return db['Setting'][_0xafdd('0x52')]({'where':{'id':_0x584291[_0xafdd('0x51')]['id']}})[_0xafdd('0x1e')](handleEntityNotFound(_0x34c2af,null))[_0xafdd('0x1e')](saveUpdates(_0x584291[_0xafdd('0x53')],null))['then'](respondWithResult(_0x34c2af,null))[_0xafdd('0x29')](handleError(_0x34c2af,null));};exports[_0xafdd('0x57')]=function(_0x2cfd1d,_0x15c292,_0x477699){if(_0x2cfd1d[_0xafdd('0x55')]&&_0x2cfd1d[_0xafdd('0x55')][_0xafdd('0x56')]){_0x2cfd1d['body'][_0xafdd('0x58')]=_0x2cfd1d[_0xafdd('0x55')][_0xafdd('0x56')];}return db[_0xafdd('0x4c')][_0xafdd('0x52')]({'where':{'id':_0x2cfd1d[_0xafdd('0x51')]['id']}})[_0xafdd('0x1e')](handleEntityNotFound(_0x15c292,null))['then'](saveUpdates(_0x2cfd1d[_0xafdd('0x53')],null))[_0xafdd('0x1e')](respondWithResult(_0x15c292,null))[_0xafdd('0x29')](handleError(_0x15c292,null));};var utilLicense=require(_0xafdd('0x18'));exports[_0xafdd('0x59')]=function(_0x1ac49b,_0x8d2eac,_0x5f1055){var _0x43c944=_0xafdd('0x5a');var _0x28c8f2={'custom':![]};return utilLicense[_0xafdd('0x5b')]()[_0xafdd('0x1e')](function(_0xdd51f6){if(_0xdd51f6){_0x28c8f2=_0xdd51f6;}return db[_0xafdd('0x4c')]['find']({'where':{'id':_0x1ac49b[_0xafdd('0x51')]['id']},'attributes':[_0xafdd('0x5c'),_0xafdd('0x58'),_0xafdd('0x5d'),_0xafdd('0x5e'),_0xafdd('0x5f'),_0xafdd('0x60'),'defaultPreferred',_0xafdd('0x61')],'raw':!![]});})[_0xafdd('0x1e')](handleEntityNotFound(_0x8d2eac,null))[_0xafdd('0x1e')](function(_0x45eede){if(_0x45eede){var _0x14077a=_0x45eede[_0xafdd('0x5c')]&&fs[_0xafdd('0x62')](path['join'](config[_0xafdd('0x63')],_0x43c944,_['toLower'](_0x45eede['logo'])))?path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0x43c944,_[_0xafdd('0x65')](_0x45eede['logo'])):path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0x43c944,_['toLower'](_0xafdd('0x66')));var _0x5406fe=_0xafdd('0x67')+_[_0xafdd('0x68')](_0xafdd('0x5c'));if(_0x45eede[_0x5406fe]||!_0x28c8f2[_0xafdd('0x69')]){_0x14077a=path['join'](config[_0xafdd('0x63')],_0x43c944,_[_0xafdd('0x65')]('default_logo.svg'));}if(!fs['existsSync'](_0x14077a)){throw new db[(_0xafdd('0x6a'))][(_0xafdd('0x6b'))](_['upperFirst'](_0xafdd('0x5c'))+_0xafdd('0x6c'));}return _0x8d2eac[_0xafdd('0x6d')](_0x14077a);}})[_0xafdd('0x29')](handleError(_0x8d2eac,null));};var utilLicense=require(_0xafdd('0x18'));exports['getLogoLogin']=function(_0x58564f,_0xba2072,_0x41de12){var _0xf8a051='server/files/images/logos';var _0x5a1eca={'custom':![]};return utilLicense[_0xafdd('0x5b')]()[_0xafdd('0x1e')](function(_0xbd6047){if(_0xbd6047){_0x5a1eca=_0xbd6047;}return db[_0xafdd('0x4c')][_0xafdd('0x52')]({'where':{'id':_0x58564f[_0xafdd('0x51')]['id']},'attributes':[_0xafdd('0x5c'),_0xafdd('0x58'),'preferred','favicon',_0xafdd('0x5f'),'defaultLoginLogo',_0xafdd('0x6e'),'defaultFavicon'],'raw':!![]});})[_0xafdd('0x1e')](handleEntityNotFound(_0xba2072,null))[_0xafdd('0x1e')](function(_0x52e00b){if(_0x52e00b){var _0x3d1c8a=_0x52e00b[_0xafdd('0x58')]&&fs[_0xafdd('0x62')](path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0xf8a051,_['toLower'](_0x52e00b['loginLogo'])))?path['join'](config[_0xafdd('0x63')],_0xf8a051,_[_0xafdd('0x65')](_0x52e00b['loginLogo'])):path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0xf8a051,_[_0xafdd('0x65')]('default_loginLogo.svg'));var _0x6a56da=_0xafdd('0x67')+_[_0xafdd('0x68')](_0xafdd('0x58'));if(_0x52e00b[_0x6a56da]||!_0x5a1eca[_0xafdd('0x69')]){_0x3d1c8a=path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0xf8a051,_[_0xafdd('0x65')](_0xafdd('0x6f')));}if(!fs[_0xafdd('0x62')](_0x3d1c8a)){throw new db[(_0xafdd('0x6a'))][(_0xafdd('0x6b'))](_[_0xafdd('0x68')](_0xafdd('0x58'))+'\x20not\x20found');}return _0xba2072[_0xafdd('0x6d')](_0x3d1c8a);}})[_0xafdd('0x29')](handleError(_0xba2072,null));};exports[_0xafdd('0x70')]=function(_0x2ceb0c,_0x48c56d){return db[_0xafdd('0x4c')][_0xafdd('0x52')]({'where':{'id':_0x2ceb0c['params']['id']},'attributes':[_0xafdd('0x71')]})[_0xafdd('0x1e')](respondWithResult(_0x48c56d,null))[_0xafdd('0x29')](handleError(_0x48c56d,null));};exports['addPreferred']=function(_0x432cb0,_0x5ec5c2,_0x139d62){if(_0x432cb0[_0xafdd('0x55')]&&_0x432cb0[_0xafdd('0x55')][_0xafdd('0x56')]){_0x432cb0['body'][_0xafdd('0x5d')]=_0x432cb0[_0xafdd('0x55')][_0xafdd('0x56')];}return db[_0xafdd('0x4c')][_0xafdd('0x52')]({'where':{'id':_0x432cb0[_0xafdd('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ec5c2,null))['then'](saveUpdates(_0x432cb0[_0xafdd('0x53')],null))[_0xafdd('0x1e')](respondWithResult(_0x5ec5c2,null))[_0xafdd('0x29')](handleError(_0x5ec5c2,null));};var utilLicense=require(_0xafdd('0x18'));exports['getPreferred']=function(_0x16a0d3,_0x4d9a6b,_0x32232e){var _0x41b990='server/files/images/logos';var _0xd728d={'custom':![]};return utilLicense[_0xafdd('0x5b')]()[_0xafdd('0x1e')](function(_0x184d5c){if(_0x184d5c){_0xd728d=_0x184d5c;}return db[_0xafdd('0x4c')][_0xafdd('0x52')]({'where':{'id':_0x16a0d3['params']['id']},'attributes':[_0xafdd('0x5c'),_0xafdd('0x58'),'preferred',_0xafdd('0x5e'),'defaultLogo',_0xafdd('0x60'),_0xafdd('0x6e'),_0xafdd('0x61')],'raw':!![]});})[_0xafdd('0x1e')](handleEntityNotFound(_0x4d9a6b,null))['then'](function(_0x453559){if(_0x453559){var _0xb0891c=_0x453559['preferred']&&fs[_0xafdd('0x62')](path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0x41b990,_[_0xafdd('0x65')](_0x453559[_0xafdd('0x5d')])))?path['join'](config[_0xafdd('0x63')],_0x41b990,_[_0xafdd('0x65')](_0x453559['preferred'])):path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0x41b990,_['toLower'](_0xafdd('0x72')));var _0x4785c4=_0xafdd('0x67')+_['upperFirst'](_0xafdd('0x5d'));if(_0x453559[_0x4785c4]||!_0xd728d['custom']||!_0xd728d[_0xafdd('0x5d')]){_0xb0891c=path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0x41b990,_[_0xafdd('0x65')](_0xafdd('0x72')));}if(!fs[_0xafdd('0x62')](_0xb0891c)){throw new db[(_0xafdd('0x6a'))][(_0xafdd('0x6b'))](_[_0xafdd('0x68')](_0xafdd('0x5d'))+_0xafdd('0x6c'));}return _0x4d9a6b[_0xafdd('0x6d')](_0xb0891c);}})[_0xafdd('0x29')](handleError(_0x4d9a6b,null));};exports[_0xafdd('0x73')]=function(_0x17ad7a,_0x10f8e1,_0x4ac362){if(_0x17ad7a[_0xafdd('0x55')]&&_0x17ad7a['file'][_0xafdd('0x56')]){_0x17ad7a['body']['favicon']=_0x17ad7a[_0xafdd('0x55')][_0xafdd('0x56')];}return db[_0xafdd('0x4c')][_0xafdd('0x52')]({'where':{'id':_0x17ad7a[_0xafdd('0x51')]['id']}})['then'](handleEntityNotFound(_0x10f8e1,null))['then'](saveUpdates(_0x17ad7a[_0xafdd('0x53')],null))['then'](respondWithResult(_0x10f8e1,null))['catch'](handleError(_0x10f8e1,null));};var utilLicense=require('../../config/license/util');exports[_0xafdd('0x74')]=function(_0x47af48,_0x57985e,_0x300ad9){var _0x18a401=_0xafdd('0x5a');var _0x384050={'custom':![]};return utilLicense['getLicense']()[_0xafdd('0x1e')](function(_0x52c7d1){if(_0x52c7d1){_0x384050=_0x52c7d1;}return db[_0xafdd('0x4c')][_0xafdd('0x52')]({'where':{'id':_0x47af48[_0xafdd('0x51')]['id']},'attributes':[_0xafdd('0x5c'),_0xafdd('0x58'),_0xafdd('0x5d'),_0xafdd('0x5e'),_0xafdd('0x5f'),'defaultLoginLogo',_0xafdd('0x6e'),'defaultFavicon'],'raw':!![]});})[_0xafdd('0x1e')](handleEntityNotFound(_0x57985e,null))[_0xafdd('0x1e')](function(_0x49d346){if(_0x49d346){var _0x4affc2=_0x49d346[_0xafdd('0x5e')]&&fs[_0xafdd('0x62')](path['join'](config[_0xafdd('0x63')],_0x18a401,_[_0xafdd('0x65')](_0x49d346[_0xafdd('0x5e')])))?path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0x18a401,_[_0xafdd('0x65')](_0x49d346[_0xafdd('0x5e')])):path[_0xafdd('0x64')](config[_0xafdd('0x63')],_0x18a401,_['toLower'](_0xafdd('0x75')));var _0x436da6=_0xafdd('0x67')+_[_0xafdd('0x68')](_0xafdd('0x5e'));if(_0x49d346[_0x436da6]||!_0x384050[_0xafdd('0x69')]){_0x4affc2=path[_0xafdd('0x64')](config['root'],_0x18a401,_['toLower'](_0xafdd('0x75')));}if(!fs[_0xafdd('0x62')](_0x4affc2)){throw new db['Sequelize'][(_0xafdd('0x6b'))](_['upperFirst']('favicon')+_0xafdd('0x6c'));}return _0x57985e[_0xafdd('0x6d')](_0x4affc2);}})[_0xafdd('0x29')](handleError(_0x57985e,null));};exports[_0xafdd('0x76')]=function(_0x27598e,_0x1bc406){var _0x4312e2={'offset':moment()[_0xafdd('0x77')]()};_0x4312e2[_0xafdd('0x78')]=moment()[_0xafdd('0x77')](_0x4312e2['offset'])['format'](_0xafdd('0x79'));return _0x1bc406[_0xafdd('0x2b')](0xc8)[_0xafdd('0x34')](_0x4312e2);}; \ No newline at end of file +var _0x1abd=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','end','stack','name','send','index','map','Setting','rawAttributes','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','ValidationError','download','getLogoLogin','favicon','default_loginLogo.svg','upperFirst','Sequelize','\x20not\x20found','getPreferred','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x1ff3a4,_0x22e667){var _0x20d6cb=function(_0x17fd63){while(--_0x17fd63){_0x1ff3a4['push'](_0x1ff3a4['shift']());}};_0x20d6cb(++_0x22e667);}(_0x1abd,0x1e0));var _0xd1ab=function(_0x5734e1,_0x3e1d75){_0x5734e1=_0x5734e1-0x0;var _0x22c784=_0x1abd[_0x5734e1];return _0x22c784;};'use strict';var pdf=require(_0xd1ab('0x0'));var emlformat=require(_0xd1ab('0x1'));var rimraf=require(_0xd1ab('0x2'));var zipdir=require(_0xd1ab('0x3'));var jsonpatch=require(_0xd1ab('0x4'));var rp=require(_0xd1ab('0x5'));var moment=require(_0xd1ab('0x6'));var BPromise=require(_0xd1ab('0x7'));var Mustache=require(_0xd1ab('0x8'));var util=require(_0xd1ab('0x9'));var path=require(_0xd1ab('0xa'));var sox=require(_0xd1ab('0xb'));var csv=require(_0xd1ab('0xc'));var ejs=require(_0xd1ab('0xd'));var fs=require('fs');var fs_extra=require(_0xd1ab('0xe'));var _=require(_0xd1ab('0xf'));var squel=require(_0xd1ab('0x10'));var crypto=require(_0xd1ab('0x11'));var jsforce=require(_0xd1ab('0x12'));var deskjs=require(_0xd1ab('0x13'));var toCsv=require(_0xd1ab('0xc'));var querystring=require(_0xd1ab('0x14'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd1ab('0x15'));var qs=require(_0xd1ab('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1ab('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xd1ab('0x18'));var config=require(_0xd1ab('0x19'));var licenseUtil=require(_0xd1ab('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd1ab('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57dcbe,_0x5eb478,_0x2c643b,_0x1f8f6e){return new BPromise(function(_0x1424f7,_0x2fc831){var _0x10335b=_0x1f8f6e||client;return _0x10335b['request'](_0x57dcbe,_0x2c643b)[_0xd1ab('0x1c')](function(_0x5d42d4){logger[_0xd1ab('0x1d')](_0xd1ab('0x1e'),_0x5eb478,_0xd1ab('0x1f'));logger[_0xd1ab('0x20')](_0xd1ab('0x21'),_0x5eb478,_0xd1ab('0x1f'),JSON[_0xd1ab('0x22')](_0x5d42d4));if(_0x5d42d4[_0xd1ab('0x23')]){if(_0x5d42d4[_0xd1ab('0x23')][_0xd1ab('0x24')]===0x1f4){logger['error'](_0xd1ab('0x1e'),_0x5eb478,_0x5d42d4[_0xd1ab('0x23')]['message']);return _0x2fc831(_0x5d42d4[_0xd1ab('0x23')][_0xd1ab('0x25')]);}logger['error'](_0xd1ab('0x1e'),_0x5eb478,_0x5d42d4[_0xd1ab('0x23')][_0xd1ab('0x25')]);return _0x1424f7(_0x5d42d4[_0xd1ab('0x23')][_0xd1ab('0x25')]);}else{logger['info'](_0xd1ab('0x1e'),_0x5eb478,'request\x20sent');_0x1424f7(_0x5d42d4[_0xd1ab('0x26')][_0xd1ab('0x25')]);}})['catch'](function(_0x9ba923){logger[_0xd1ab('0x23')](_0xd1ab('0x1e'),_0x5eb478,_0x9ba923);_0x2fc831(_0x9ba923);});});}function respondWithStatusCode(_0x1c5fcd,_0x7f48ac){_0x7f48ac=_0x7f48ac||0xcc;return function(_0xf70b64){if(_0xf70b64){return _0x1c5fcd[_0xd1ab('0x27')](_0x7f48ac);}return _0x1c5fcd[_0xd1ab('0x28')](_0x7f48ac)['end']();};}function respondWithResult(_0x3ffeec,_0x3147b0){_0x3147b0=_0x3147b0||0xc8;return function(_0x569895){if(_0x569895){return _0x3ffeec[_0xd1ab('0x28')](_0x3147b0)['json'](_0x569895);}};}function respondWithFilteredResult(_0x5a3c8a,_0x2c284d){return function(_0x471aa9){if(_0x471aa9){var _0xa05169=_0x471aa9[_0xd1ab('0x29')],_0x45ebce=_0x2c284d['offset'],_0x2d7bf6=_0x2c284d[_0xd1ab('0x2a')]+_0x2c284d[_0xd1ab('0x2b')],_0x36069e;if(_0x2d7bf6>=_0xa05169){_0x2d7bf6=_0xa05169;_0x36069e=0xc8;}else{_0x36069e=0xce;}_0x5a3c8a[_0xd1ab('0x28')](_0x36069e);return _0x5a3c8a[_0xd1ab('0x2c')](_0xd1ab('0x2d'),_0x45ebce+'-'+_0x2d7bf6+'/'+_0xa05169)[_0xd1ab('0x2e')](_0x471aa9);}return null;};}function patchUpdates(_0x5841cc){return function(_0x56a5e0){try{jsonpatch[_0xd1ab('0x2f')](_0x56a5e0,_0x5841cc,!![]);}catch(_0x1ca905){return BPromise[_0xd1ab('0x30')](_0x1ca905);}return _0x56a5e0[_0xd1ab('0x31')]();};}function saveUpdates(_0x3753d2,_0x5cf975){return function(_0x1d32db){if(_0x1d32db){return _0x1d32db['update'](_0x3753d2)[_0xd1ab('0x1c')](function(_0x210d3a){return _0x210d3a;});}return null;};}function removeEntity(_0x4d47b9,_0x3e4b96){return function(_0x465d93){if(_0x465d93){return _0x465d93['destroy']()[_0xd1ab('0x1c')](function(){_0x4d47b9['status'](0xcc)[_0xd1ab('0x32')]();});}};}function handleEntityNotFound(_0x5066eb,_0x458df4){return function(_0x22a267){if(!_0x22a267){_0x5066eb[_0xd1ab('0x27')](0x194);}return _0x22a267;};}function handleError(_0x3bc6ae,_0x2a8eaf){_0x2a8eaf=_0x2a8eaf||0x1f4;return function(_0x85ba2f){logger[_0xd1ab('0x23')](_0x85ba2f[_0xd1ab('0x33')]);if(_0x85ba2f[_0xd1ab('0x34')]){delete _0x85ba2f[_0xd1ab('0x34')];}_0x3bc6ae['status'](_0x2a8eaf)[_0xd1ab('0x35')](_0x85ba2f);};}exports[_0xd1ab('0x36')]=function(_0x166f5d,_0x53bbbd){var _0x39e4c6={},_0x2f849b={},_0x3ace5f={'count':0x0,'rows':[]};var _0x4e4051=_[_0xd1ab('0x37')](db[_0xd1ab('0x38')][_0xd1ab('0x39')],function(_0x542679){return{'name':_0x542679['fieldName'],'type':_0x542679['type']['key']};});_0x2f849b[_0xd1ab('0x3a')]=_[_0xd1ab('0x37')](_0x4e4051,_0xd1ab('0x34'));_0x2f849b[_0xd1ab('0x3b')]=_[_0xd1ab('0x3c')](_0x166f5d[_0xd1ab('0x3b')]);_0x2f849b['filters']=_[_0xd1ab('0x3d')](_0x2f849b['model'],_0x2f849b[_0xd1ab('0x3b')]);_0x39e4c6['attributes']=_[_0xd1ab('0x3d')](_0x2f849b[_0xd1ab('0x3a')],qs['fields'](_0x166f5d[_0xd1ab('0x3b')][_0xd1ab('0x3e')]));_0x39e4c6[_0xd1ab('0x3f')]=_0x39e4c6[_0xd1ab('0x3f')][_0xd1ab('0x40')]?_0x39e4c6[_0xd1ab('0x3f')]:_0x2f849b[_0xd1ab('0x3a')];if(!_0x166f5d[_0xd1ab('0x3b')][_0xd1ab('0x41')](_0xd1ab('0x42'))){_0x39e4c6[_0xd1ab('0x2b')]=qs[_0xd1ab('0x2b')](_0x166f5d[_0xd1ab('0x3b')]['limit']);_0x39e4c6[_0xd1ab('0x2a')]=qs['offset'](_0x166f5d[_0xd1ab('0x3b')][_0xd1ab('0x2a')]);}_0x39e4c6['order']=qs[_0xd1ab('0x43')](_0x166f5d[_0xd1ab('0x3b')][_0xd1ab('0x43')]);_0x39e4c6[_0xd1ab('0x44')]=qs[_0xd1ab('0x45')](_[_0xd1ab('0x46')](_0x166f5d[_0xd1ab('0x3b')],_0x2f849b[_0xd1ab('0x45')]),_0x4e4051);if(_0x166f5d[_0xd1ab('0x3b')]['filter']){_0x39e4c6[_0xd1ab('0x44')]=_[_0xd1ab('0x47')](_0x39e4c6[_0xd1ab('0x44')],{'$or':_[_0xd1ab('0x37')](_0x4e4051,function(_0x2936d2){if(_0x2936d2['type']!==_0xd1ab('0x48')){var _0x944c07={};_0x944c07[_0x2936d2[_0xd1ab('0x34')]]={'$like':'%'+_0x166f5d['query'][_0xd1ab('0x49')]+'%'};return _0x944c07;}})});}_0x39e4c6=_[_0xd1ab('0x47')]({},_0x39e4c6,_0x166f5d[_0xd1ab('0x4a')]);var _0x5b3874={'where':_0x39e4c6['where']};return db['Setting'][_0xd1ab('0x29')](_0x5b3874)[_0xd1ab('0x1c')](function(_0x5091c4){_0x3ace5f[_0xd1ab('0x29')]=_0x5091c4;if(_0x166f5d['query'][_0xd1ab('0x4b')]){_0x39e4c6[_0xd1ab('0x4c')]=[{'all':!![]}];}return db[_0xd1ab('0x38')][_0xd1ab('0x4d')](_0x39e4c6);})[_0xd1ab('0x1c')](function(_0x48533c){_0x3ace5f[_0xd1ab('0x4e')]=_0x48533c;return _0x3ace5f;})[_0xd1ab('0x1c')](respondWithFilteredResult(_0x53bbbd,_0x39e4c6))['catch'](handleError(_0x53bbbd,null));};exports[_0xd1ab('0x4f')]=function(_0x434a97,_0x3e64bf){var _0x397238={'raw':![],'where':{'id':_0x434a97[_0xd1ab('0x50')]['id']}},_0x501219={};_0x501219[_0xd1ab('0x3a')]=_['keys'](db[_0xd1ab('0x38')][_0xd1ab('0x39')]);_0x501219[_0xd1ab('0x3b')]=_[_0xd1ab('0x3c')](_0x434a97[_0xd1ab('0x3b')]);_0x501219[_0xd1ab('0x45')]=_['intersection'](_0x501219['model'],_0x501219['query']);_0x397238['attributes']=_['intersection'](_0x501219[_0xd1ab('0x3a')],qs[_0xd1ab('0x3e')](_0x434a97['query']['fields']));_0x397238['attributes']=_0x397238[_0xd1ab('0x3f')][_0xd1ab('0x40')]?_0x397238[_0xd1ab('0x3f')]:_0x501219[_0xd1ab('0x3a')];if(_0x434a97['query'][_0xd1ab('0x4b')]){_0x397238[_0xd1ab('0x4c')]=[{'all':!![]}];}_0x397238=_[_0xd1ab('0x47')]({},_0x397238,_0x434a97[_0xd1ab('0x4a')]);return db[_0xd1ab('0x38')][_0xd1ab('0x51')](_0x397238)[_0xd1ab('0x1c')](handleEntityNotFound(_0x3e64bf,null))['then'](respondWithResult(_0x3e64bf,null))[_0xd1ab('0x52')](handleError(_0x3e64bf,null));};exports['update']=function(_0x38578d,_0x3f696c){if(_0x38578d[_0xd1ab('0x53')]['id']){delete _0x38578d[_0xd1ab('0x53')]['id'];}return db[_0xd1ab('0x38')][_0xd1ab('0x51')]({'where':{'id':_0x38578d[_0xd1ab('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f696c,null))[_0xd1ab('0x1c')](saveUpdates(_0x38578d[_0xd1ab('0x53')],null))['then'](respondWithResult(_0x3f696c,null))[_0xd1ab('0x52')](handleError(_0x3f696c,null));};exports[_0xd1ab('0x54')]=function(_0x1a7be8,_0x213c18,_0x16764d){if(_0x1a7be8[_0xd1ab('0x55')]&&_0x1a7be8[_0xd1ab('0x55')][_0xd1ab('0x56')]){_0x1a7be8[_0xd1ab('0x53')][_0xd1ab('0x57')]=_0x1a7be8[_0xd1ab('0x55')][_0xd1ab('0x56')];}return db[_0xd1ab('0x38')]['find']({'where':{'id':_0x1a7be8[_0xd1ab('0x50')]['id']}})[_0xd1ab('0x1c')](handleEntityNotFound(_0x213c18,null))['then'](saveUpdates(_0x1a7be8[_0xd1ab('0x53')],null))[_0xd1ab('0x1c')](respondWithResult(_0x213c18,null))[_0xd1ab('0x52')](handleError(_0x213c18,null));};exports[_0xd1ab('0x58')]=function(_0x1b63ac,_0x57298c,_0x32b459){if(_0x1b63ac[_0xd1ab('0x55')]&&_0x1b63ac[_0xd1ab('0x55')]['filename']){_0x1b63ac[_0xd1ab('0x53')][_0xd1ab('0x59')]=_0x1b63ac[_0xd1ab('0x55')]['filename'];}return db['Setting'][_0xd1ab('0x51')]({'where':{'id':_0x1b63ac['params']['id']}})[_0xd1ab('0x1c')](handleEntityNotFound(_0x57298c,null))[_0xd1ab('0x1c')](saveUpdates(_0x1b63ac[_0xd1ab('0x53')],null))[_0xd1ab('0x1c')](respondWithResult(_0x57298c,null))['catch'](handleError(_0x57298c,null));};var utilLicense=require(_0xd1ab('0x1a'));exports[_0xd1ab('0x5a')]=function(_0x48e0ef,_0x193806,_0x2e68db){var _0x3d5e28=_0xd1ab('0x5b');var _0xaec055={'custom':![]};return utilLicense[_0xd1ab('0x5c')]()[_0xd1ab('0x1c')](function(_0x993427){if(_0x993427){_0xaec055=_0x993427;}return db[_0xd1ab('0x38')][_0xd1ab('0x51')]({'where':{'id':_0x48e0ef[_0xd1ab('0x50')]['id']},'attributes':[_0xd1ab('0x57'),_0xd1ab('0x59'),_0xd1ab('0x5d'),'favicon',_0xd1ab('0x5e'),_0xd1ab('0x5f'),_0xd1ab('0x60'),_0xd1ab('0x61')],'raw':!![]});})[_0xd1ab('0x1c')](handleEntityNotFound(_0x193806,null))['then'](function(_0x1c2504){if(_0x1c2504){var _0x50936b=_0x1c2504['logo']&&fs[_0xd1ab('0x62')](path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x3d5e28,_['toLower'](_0x1c2504['logo'])))?path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x3d5e28,_[_0xd1ab('0x65')](_0x1c2504['logo'])):path['join'](config[_0xd1ab('0x64')],_0x3d5e28,_[_0xd1ab('0x65')](_0xd1ab('0x66')));var _0x1ff8ef=_0xd1ab('0x67')+_['upperFirst'](_0xd1ab('0x57'));if(_0x1c2504[_0x1ff8ef]||!_0xaec055[_0xd1ab('0x68')]){_0x50936b=path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x3d5e28,_[_0xd1ab('0x65')]('default_logo.svg'));}if(!fs['existsSync'](_0x50936b)){throw new db['Sequelize'][(_0xd1ab('0x69'))](_['upperFirst'](_0xd1ab('0x57'))+'\x20not\x20found');}return _0x193806[_0xd1ab('0x6a')](_0x50936b);}})['catch'](handleError(_0x193806,null));};var utilLicense=require(_0xd1ab('0x1a'));exports[_0xd1ab('0x6b')]=function(_0x476988,_0x67fd7a,_0x43904b){var _0x5885e3=_0xd1ab('0x5b');var _0x14e266={'custom':![]};return utilLicense[_0xd1ab('0x5c')]()[_0xd1ab('0x1c')](function(_0xe06208){if(_0xe06208){_0x14e266=_0xe06208;}return db[_0xd1ab('0x38')][_0xd1ab('0x51')]({'where':{'id':_0x476988[_0xd1ab('0x50')]['id']},'attributes':[_0xd1ab('0x57'),_0xd1ab('0x59'),_0xd1ab('0x5d'),_0xd1ab('0x6c'),_0xd1ab('0x5e'),'defaultLoginLogo',_0xd1ab('0x60'),'defaultFavicon'],'raw':!![]});})[_0xd1ab('0x1c')](handleEntityNotFound(_0x67fd7a,null))['then'](function(_0x45407b){if(_0x45407b){var _0x1aa18c=_0x45407b[_0xd1ab('0x59')]&&fs[_0xd1ab('0x62')](path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x5885e3,_[_0xd1ab('0x65')](_0x45407b[_0xd1ab('0x59')])))?path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x5885e3,_[_0xd1ab('0x65')](_0x45407b[_0xd1ab('0x59')])):path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x5885e3,_['toLower'](_0xd1ab('0x6d')));var _0x1c738d=_0xd1ab('0x67')+_[_0xd1ab('0x6e')](_0xd1ab('0x59'));if(_0x45407b[_0x1c738d]||!_0x14e266[_0xd1ab('0x68')]){_0x1aa18c=path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x5885e3,_[_0xd1ab('0x65')]('default_loginLogo.svg'));}if(!fs[_0xd1ab('0x62')](_0x1aa18c)){throw new db[(_0xd1ab('0x6f'))]['ValidationError'](_['upperFirst'](_0xd1ab('0x59'))+_0xd1ab('0x70'));}return _0x67fd7a[_0xd1ab('0x6a')](_0x1aa18c);}})[_0xd1ab('0x52')](handleError(_0x67fd7a,null));};exports['gdpr']=function(_0x2adb4f,_0x1c0da1){return db[_0xd1ab('0x38')][_0xd1ab('0x51')]({'where':{'id':_0x2adb4f[_0xd1ab('0x50')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x1c0da1,null))['catch'](handleError(_0x1c0da1,null));};exports['addPreferred']=function(_0x46bee8,_0x1ae123,_0x56c57a){if(_0x46bee8[_0xd1ab('0x55')]&&_0x46bee8[_0xd1ab('0x55')][_0xd1ab('0x56')]){_0x46bee8[_0xd1ab('0x53')][_0xd1ab('0x5d')]=_0x46bee8[_0xd1ab('0x55')][_0xd1ab('0x56')];}return db[_0xd1ab('0x38')][_0xd1ab('0x51')]({'where':{'id':_0x46bee8[_0xd1ab('0x50')]['id']}})[_0xd1ab('0x1c')](handleEntityNotFound(_0x1ae123,null))[_0xd1ab('0x1c')](saveUpdates(_0x46bee8[_0xd1ab('0x53')],null))[_0xd1ab('0x1c')](respondWithResult(_0x1ae123,null))['catch'](handleError(_0x1ae123,null));};var utilLicense=require(_0xd1ab('0x1a'));exports[_0xd1ab('0x71')]=function(_0x2dd87e,_0x36c5eb,_0x392ce2){var _0x30a528=_0xd1ab('0x5b');var _0x14aa31={'custom':![]};return utilLicense[_0xd1ab('0x5c')]()[_0xd1ab('0x1c')](function(_0x132a1c){if(_0x132a1c){_0x14aa31=_0x132a1c;}return db[_0xd1ab('0x38')][_0xd1ab('0x51')]({'where':{'id':_0x2dd87e['params']['id']},'attributes':[_0xd1ab('0x57'),_0xd1ab('0x59'),_0xd1ab('0x5d'),'favicon',_0xd1ab('0x5e'),_0xd1ab('0x5f'),_0xd1ab('0x60'),_0xd1ab('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x36c5eb,null))[_0xd1ab('0x1c')](function(_0x513b26){if(_0x513b26){var _0x5ddb06=_0x513b26[_0xd1ab('0x5d')]&&fs[_0xd1ab('0x62')](path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x30a528,_[_0xd1ab('0x65')](_0x513b26[_0xd1ab('0x5d')])))?path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x30a528,_['toLower'](_0x513b26[_0xd1ab('0x5d')])):path['join'](config[_0xd1ab('0x64')],_0x30a528,_[_0xd1ab('0x65')]('default_preferred.png'));var _0x2c6614=_0xd1ab('0x67')+_[_0xd1ab('0x6e')]('preferred');if(_0x513b26[_0x2c6614]||!_0x14aa31[_0xd1ab('0x68')]||!_0x14aa31[_0xd1ab('0x5d')]){_0x5ddb06=path['join'](config[_0xd1ab('0x64')],_0x30a528,_['toLower']('default_preferred.png'));}if(!fs[_0xd1ab('0x62')](_0x5ddb06)){throw new db[(_0xd1ab('0x6f'))]['ValidationError'](_[_0xd1ab('0x6e')](_0xd1ab('0x5d'))+_0xd1ab('0x70'));}return _0x36c5eb[_0xd1ab('0x6a')](_0x5ddb06);}})[_0xd1ab('0x52')](handleError(_0x36c5eb,null));};exports[_0xd1ab('0x72')]=function(_0x2fe23f,_0x469af2,_0x25b689){if(_0x2fe23f['file']&&_0x2fe23f[_0xd1ab('0x55')][_0xd1ab('0x56')]){_0x2fe23f[_0xd1ab('0x53')][_0xd1ab('0x6c')]=_0x2fe23f['file'][_0xd1ab('0x56')];}return db['Setting']['find']({'where':{'id':_0x2fe23f[_0xd1ab('0x50')]['id']}})[_0xd1ab('0x1c')](handleEntityNotFound(_0x469af2,null))['then'](saveUpdates(_0x2fe23f['body'],null))['then'](respondWithResult(_0x469af2,null))[_0xd1ab('0x52')](handleError(_0x469af2,null));};var utilLicense=require(_0xd1ab('0x1a'));exports[_0xd1ab('0x73')]=function(_0x5a6666,_0xaa321e,_0x1bc835){var _0x569cbe='server/files/images/logos';var _0x4e4c69={'custom':![]};return utilLicense[_0xd1ab('0x5c')]()[_0xd1ab('0x1c')](function(_0x8bfcef){if(_0x8bfcef){_0x4e4c69=_0x8bfcef;}return db['Setting']['find']({'where':{'id':_0x5a6666['params']['id']},'attributes':[_0xd1ab('0x57'),_0xd1ab('0x59'),_0xd1ab('0x5d'),_0xd1ab('0x6c'),_0xd1ab('0x5e'),'defaultLoginLogo',_0xd1ab('0x60'),'defaultFavicon'],'raw':!![]});})[_0xd1ab('0x1c')](handleEntityNotFound(_0xaa321e,null))[_0xd1ab('0x1c')](function(_0x3b8e1c){if(_0x3b8e1c){var _0x4bcf0d=_0x3b8e1c[_0xd1ab('0x6c')]&&fs['existsSync'](path['join'](config[_0xd1ab('0x64')],_0x569cbe,_[_0xd1ab('0x65')](_0x3b8e1c[_0xd1ab('0x6c')])))?path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x569cbe,_[_0xd1ab('0x65')](_0x3b8e1c['favicon'])):path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x569cbe,_[_0xd1ab('0x65')](_0xd1ab('0x74')));var _0x3f8e53=_0xd1ab('0x67')+_[_0xd1ab('0x6e')](_0xd1ab('0x6c'));if(_0x3b8e1c[_0x3f8e53]||!_0x4e4c69[_0xd1ab('0x68')]){_0x4bcf0d=path[_0xd1ab('0x63')](config[_0xd1ab('0x64')],_0x569cbe,_[_0xd1ab('0x65')]('default_favicon.ico'));}if(!fs[_0xd1ab('0x62')](_0x4bcf0d)){throw new db['Sequelize'][(_0xd1ab('0x69'))](_['upperFirst']('favicon')+_0xd1ab('0x70'));}return _0xaa321e['download'](_0x4bcf0d);}})[_0xd1ab('0x52')](handleError(_0xaa321e,null));};exports['getDate']=function(_0x3d3063,_0x590c38){var _0x21175a={'offset':moment()[_0xd1ab('0x75')]()};_0x21175a[_0xd1ab('0x76')]=moment()[_0xd1ab('0x75')](_0x21175a['offset'])[_0xd1ab('0x77')](_0xd1ab('0x78'));return _0x590c38[_0xd1ab('0x28')](0xc8)[_0xd1ab('0x35')](_0x21175a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 21e554e..929f44c 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 _0x4ae8=['rimraf','../../config/environment','exports','define','Setting','settings','util','../../config/logger','moment','bluebird','path'];(function(_0x59bfc9,_0x566409){var _0x352f1b=function(_0x51762b){while(--_0x51762b){_0x59bfc9['push'](_0x59bfc9['shift']());}};_0x352f1b(++_0x566409);}(_0x4ae8,0x1be));var _0x84ae=function(_0x556e54,_0x2807f6){_0x556e54=_0x556e54-0x0;var _0x66c5f9=_0x4ae8[_0x556e54];return _0x66c5f9;};'use strict';var _=require('lodash');var util=require(_0x84ae('0x0'));var logger=require(_0x84ae('0x1'))('api');var moment=require(_0x84ae('0x2'));var BPromise=require(_0x84ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84ae('0x4'));var rimraf=require(_0x84ae('0x5'));var config=require(_0x84ae('0x6'));var attributes=require('./setting.attributes');module[_0x84ae('0x7')]=function(_0x1950f2,_0xaa0ce4){return _0x1950f2[_0x84ae('0x8')](_0x84ae('0x9'),attributes,{'tableName':_0x84ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaae6=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x291b8c,_0x6b7ed8){var _0x22ba34=function(_0x250020){while(--_0x250020){_0x291b8c['push'](_0x291b8c['shift']());}};_0x22ba34(++_0x6b7ed8);}(_0xaae6,0xd3));var _0x6aae=function(_0x40d61b,_0x48ae88){_0x40d61b=_0x40d61b-0x0;var _0x40d2ef=_0xaae6[_0x40d61b];return _0x40d2ef;};'use strict';var _=require(_0x6aae('0x0'));var util=require(_0x6aae('0x1'));var logger=require(_0x6aae('0x2'))(_0x6aae('0x3'));var moment=require(_0x6aae('0x4'));var BPromise=require(_0x6aae('0x5'));var rp=require(_0x6aae('0x6'));var fs=require('fs');var path=require(_0x6aae('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./setting.attributes');module[_0x6aae('0x8')]=function(_0x5e8ad6,_0x56bb82){return _0x5e8ad6[_0x6aae('0x9')]('Setting',attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3533196..d798210 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 _0xf3f1=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','Setting','find','options','raw','where','attributes','map','include','model','ShowSetting','debug','lodash','bluebird','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x57b563,_0x3347ed){var _0x1f0752=function(_0x366220){while(--_0x366220){_0x57b563['push'](_0x57b563['shift']());}};_0x1f0752(++_0x3347ed);}(_0xf3f1,0x1c5));var _0x1f3f=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0xf3f1[_0x4b6778];return _0x22dbb9;};'use strict';var _=require(_0x1f3f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1f3f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f3f('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x1f3f('0x3'));var jayson=require(_0x1f3f('0x4'));var client=jayson['client'][_0x1f3f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4d7a05,_0x3460bb,_0xa5d0f3){return new BPromise(function(_0xb8f2ff,_0x159fd7){return client[_0x1f3f('0x6')](_0x4d7a05,_0xa5d0f3)[_0x1f3f('0x7')](function(_0x39ed15){logger[_0x1f3f('0x8')](_0x1f3f('0x9'),_0x3460bb,_0x1f3f('0xa'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x3460bb,_0x1f3f('0xa'),JSON[_0x1f3f('0xb')](_0x39ed15));if(_0x39ed15[_0x1f3f('0xc')]){if(_0x39ed15[_0x1f3f('0xc')][_0x1f3f('0xd')]===0x1f4){logger['error'](_0x1f3f('0x9'),_0x3460bb,_0x39ed15[_0x1f3f('0xc')][_0x1f3f('0xe')]);return _0x159fd7(_0x39ed15[_0x1f3f('0xc')][_0x1f3f('0xe')]);}logger['error'](_0x1f3f('0x9'),_0x3460bb,_0x39ed15[_0x1f3f('0xc')][_0x1f3f('0xe')]);return _0xb8f2ff(_0x39ed15[_0x1f3f('0xc')][_0x1f3f('0xe')]);}else{logger[_0x1f3f('0x8')]('Setting,\x20%s,\x20%s',_0x3460bb,_0x1f3f('0xa'));_0xb8f2ff(_0x39ed15[_0x1f3f('0xf')]['message']);}})['catch'](function(_0x1584e2){logger[_0x1f3f('0xc')](_0x1f3f('0x9'),_0x3460bb,_0x1584e2);_0x159fd7(_0x1584e2);});});}exports['ShowSetting']=function(_0x5f59c7){var _0x516ed9=this;return new Promise(function(_0x566114,_0x435469){return db[_0x1f3f('0x10')][_0x1f3f('0x11')]({'raw':_0x5f59c7[_0x1f3f('0x12')]?_0x5f59c7[_0x1f3f('0x12')][_0x1f3f('0x13')]===undefined?!![]:![]:!![],'where':_0x5f59c7[_0x1f3f('0x12')]?_0x5f59c7[_0x1f3f('0x12')][_0x1f3f('0x14')]||null:null,'attributes':_0x5f59c7[_0x1f3f('0x12')]?_0x5f59c7[_0x1f3f('0x12')][_0x1f3f('0x15')]||null:null,'include':_0x5f59c7[_0x1f3f('0x12')]?_0x5f59c7[_0x1f3f('0x12')]['include']?_[_0x1f3f('0x16')](_0x5f59c7[_0x1f3f('0x12')][_0x1f3f('0x17')],function(_0x47aefc){return{'model':db[_0x47aefc[_0x1f3f('0x18')]],'as':_0x47aefc['as'],'attributes':_0x47aefc[_0x1f3f('0x15')],'include':_0x47aefc[_0x1f3f('0x17')]?_[_0x1f3f('0x16')](_0x47aefc[_0x1f3f('0x17')],function(_0x3061da){return{'model':db[_0x3061da['model']],'as':_0x3061da['as'],'attributes':_0x3061da[_0x1f3f('0x15')],'include':_0x3061da[_0x1f3f('0x17')]?_[_0x1f3f('0x16')](_0x3061da[_0x1f3f('0x17')],function(_0x5dde21){return{'model':db[_0x5dde21[_0x1f3f('0x18')]],'as':_0x5dde21['as'],'attributes':_0x5dde21[_0x1f3f('0x15')]};}):[]};}):[]};}):[]:[]})[_0x1f3f('0x7')](function(_0x3bbc50){logger[_0x1f3f('0x8')](_0x1f3f('0x19'),_0x5f59c7);logger[_0x1f3f('0x1a')](_0x1f3f('0x19'),_0x5f59c7,JSON['stringify'](_0x3bbc50));_0x566114(_0x3bbc50);})['catch'](function(_0x464e1a){logger['error'](_0x1f3f('0x19'),_0x464e1a[_0x1f3f('0xe')],_0x5f59c7);_0x435469(_0x516ed9['error'](0x1f4,_0x464e1a[_0x1f3f('0xe')]));});});}; \ No newline at end of file +var _0x8e1e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x173af1,_0x535ff4){var _0x44e325=function(_0x49aaa4){while(--_0x49aaa4){_0x173af1['push'](_0x173af1['shift']());}};_0x44e325(++_0x535ff4);}(_0x8e1e,0x123));var _0xe8e1=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x8e1e[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0xe8e1('0x0'));var util=require(_0xe8e1('0x1'));var moment=require(_0xe8e1('0x2'));var BPromise=require(_0xe8e1('0x3'));var rs=require(_0xe8e1('0x4'));var fs=require('fs');var Redis=require(_0xe8e1('0x5'));var db=require(_0xe8e1('0x6'))['db'];var utils=require(_0xe8e1('0x7'));var logger=require(_0xe8e1('0x8'))('rpc');var config=require(_0xe8e1('0x9'));var jayson=require(_0xe8e1('0xa'));var client=jayson[_0xe8e1('0xb')][_0xe8e1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cccc7,_0x520f4d,_0x662163){return new BPromise(function(_0x3b5aee,_0x227ebe){return client[_0xe8e1('0xd')](_0x4cccc7,_0x662163)['then'](function(_0x461918){logger[_0xe8e1('0xe')](_0xe8e1('0xf'),_0x520f4d,'request\x20sent');logger[_0xe8e1('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x520f4d,_0xe8e1('0x11'),JSON[_0xe8e1('0x12')](_0x461918));if(_0x461918['error']){if(_0x461918[_0xe8e1('0x13')]['code']===0x1f4){logger[_0xe8e1('0x13')](_0xe8e1('0xf'),_0x520f4d,_0x461918[_0xe8e1('0x13')][_0xe8e1('0x14')]);return _0x227ebe(_0x461918['error'][_0xe8e1('0x14')]);}logger[_0xe8e1('0x13')](_0xe8e1('0xf'),_0x520f4d,_0x461918['error'][_0xe8e1('0x14')]);return _0x3b5aee(_0x461918[_0xe8e1('0x13')][_0xe8e1('0x14')]);}else{logger[_0xe8e1('0xe')](_0xe8e1('0xf'),_0x520f4d,_0xe8e1('0x11'));_0x3b5aee(_0x461918[_0xe8e1('0x15')]['message']);}})[_0xe8e1('0x16')](function(_0x27f30a){logger[_0xe8e1('0x13')]('Setting,\x20%s,\x20%s',_0x520f4d,_0x27f30a);_0x227ebe(_0x27f30a);});});}exports[_0xe8e1('0x17')]=function(_0x7e8280){var _0x348e08=this;return new Promise(function(_0x35ef25,_0x15fdb9){return db[_0xe8e1('0x18')][_0xe8e1('0x19')]({'raw':_0x7e8280[_0xe8e1('0x1a')]?_0x7e8280['options'][_0xe8e1('0x1b')]===undefined?!![]:![]:!![],'where':_0x7e8280[_0xe8e1('0x1a')]?_0x7e8280['options'][_0xe8e1('0x1c')]||null:null,'attributes':_0x7e8280[_0xe8e1('0x1a')]?_0x7e8280[_0xe8e1('0x1a')][_0xe8e1('0x1d')]||null:null,'include':_0x7e8280[_0xe8e1('0x1a')]?_0x7e8280['options'][_0xe8e1('0x1e')]?_[_0xe8e1('0x1f')](_0x7e8280[_0xe8e1('0x1a')][_0xe8e1('0x1e')],function(_0x486c7d){return{'model':db[_0x486c7d[_0xe8e1('0x20')]],'as':_0x486c7d['as'],'attributes':_0x486c7d[_0xe8e1('0x1d')],'include':_0x486c7d['include']?_['map'](_0x486c7d[_0xe8e1('0x1e')],function(_0x3fea6d){return{'model':db[_0x3fea6d[_0xe8e1('0x20')]],'as':_0x3fea6d['as'],'attributes':_0x3fea6d['attributes'],'include':_0x3fea6d[_0xe8e1('0x1e')]?_[_0xe8e1('0x1f')](_0x3fea6d[_0xe8e1('0x1e')],function(_0x42c9fe){return{'model':db[_0x42c9fe[_0xe8e1('0x20')]],'as':_0x42c9fe['as'],'attributes':_0x42c9fe[_0xe8e1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfbb3c8){logger[_0xe8e1('0xe')]('ShowSetting',_0x7e8280);logger[_0xe8e1('0x10')](_0xe8e1('0x17'),_0x7e8280,JSON[_0xe8e1('0x12')](_0xfbb3c8));_0x35ef25(_0xfbb3c8);})['catch'](function(_0x4cf629){logger[_0xe8e1('0x13')](_0xe8e1('0x17'),_0x4cf629['message'],_0x7e8280);_0x15fdb9(_0x348e08[_0xe8e1('0x13')](0x1f4,_0x4cf629[_0xe8e1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7a23954..0d234e9 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 _0x2a87=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','index','get','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','/:id/status','status','put','update','removeDispositions','delete','removeAnswers','removeAgents','multer'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2a87,0x11e));var _0x72a8=function(_0x42508b,_0x693bd2){_0x42508b=_0x42508b-0x0;var _0x4739b6=_0x2a87[_0x42508b];return _0x4739b6;};'use strict';var multer=require(_0x72a8('0x0'));var util=require(_0x72a8('0x1'));var path=require(_0x72a8('0x2'));var timeout=require(_0x72a8('0x3'));var express=require(_0x72a8('0x4'));var router=express['Router']();var fs_extra=require(_0x72a8('0x5'));var auth=require(_0x72a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x72a8('0x7'));var controller=require(_0x72a8('0x8'));router['get']('/',auth[_0x72a8('0x9')](),controller[_0x72a8('0xa')]);router[_0x72a8('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x72a8('0xc'),auth['isAuthenticated'](),controller[_0x72a8('0xd')]);router[_0x72a8('0xb')](_0x72a8('0xe'),auth[_0x72a8('0x9')](),controller['getDispositions']);router[_0x72a8('0xb')](_0x72a8('0xf'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x10')]);router[_0x72a8('0xb')](_0x72a8('0x11'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x12')]);router[_0x72a8('0xb')](_0x72a8('0x13'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x14')]);router[_0x72a8('0xb')]('/:id/status',controller[_0x72a8('0x15')]);router[_0x72a8('0xb')](_0x72a8('0x16'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x17')]);router['post']('/',auth[_0x72a8('0x9')](),controller[_0x72a8('0x18')]);router[_0x72a8('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x72a8('0x1a')]);router['post'](_0x72a8('0xf'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x1b')]);router[_0x72a8('0x19')](_0x72a8('0x1c'),controller[_0x72a8('0x1d')]);router['post'](_0x72a8('0x11'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x1e')]);router[_0x72a8('0x19')](_0x72a8('0x1f'),auth['isAuthenticated'](),controller[_0x72a8('0x20')]);router[_0x72a8('0x19')](_0x72a8('0x21'),controller[_0x72a8('0x22')]);router[_0x72a8('0x19')]('/:id/users',auth[_0x72a8('0x9')](),controller['addAgents']);router[_0x72a8('0x23')](_0x72a8('0xc'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x24')]);router['delete'](_0x72a8('0xc'),auth[_0x72a8('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x72a8('0x25')]);router[_0x72a8('0x26')](_0x72a8('0xf'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x27')]);router['delete'](_0x72a8('0x16'),auth[_0x72a8('0x9')](),controller[_0x72a8('0x28')]);module['exports']=router; \ No newline at end of file +var _0x0a0a=['create','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','/:id/users','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','getAgents'];(function(_0x528b1b,_0x160186){var _0x5958c5=function(_0x12cb30){while(--_0x12cb30){_0x528b1b['push'](_0x528b1b['shift']());}};_0x5958c5(++_0x160186);}(_0x0a0a,0x17c));var _0xa0a0=function(_0x64cf12,_0x3812fc){_0x64cf12=_0x64cf12-0x0;var _0x4787e2=_0x0a0a[_0x64cf12];return _0x4787e2;};'use strict';var multer=require(_0xa0a0('0x0'));var util=require(_0xa0a0('0x1'));var path=require(_0xa0a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa0a0('0x3'));var router=express[_0xa0a0('0x4')]();var fs_extra=require(_0xa0a0('0x5'));var auth=require(_0xa0a0('0x6'));var interaction=require(_0xa0a0('0x7'));var config=require(_0xa0a0('0x8'));var controller=require(_0xa0a0('0x9'));router[_0xa0a0('0xa')]('/',auth['isAuthenticated'](),controller[_0xa0a0('0xb')]);router[_0xa0a0('0xa')](_0xa0a0('0xc'),auth[_0xa0a0('0xd')](),controller['describe']);router['get'](_0xa0a0('0xe'),auth['isAuthenticated'](),controller[_0xa0a0('0xf')]);router['get'](_0xa0a0('0x10'),auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x11')]);router[_0xa0a0('0xa')](_0xa0a0('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xa0a0('0xa')](_0xa0a0('0x13'),auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x14')]);router[_0xa0a0('0xa')]('/:id/interactions',auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x15')]);router[_0xa0a0('0xa')](_0xa0a0('0x16'),controller[_0xa0a0('0x17')]);router['get']('/:id/users',auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x18')]);router['post']('/',auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x19')]);router[_0xa0a0('0x1a')](_0xa0a0('0x10'),auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x1b')]);router[_0xa0a0('0x1a')](_0xa0a0('0x12'),auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x1c')]);router[_0xa0a0('0x1a')](_0xa0a0('0x1d'),controller[_0xa0a0('0x1e')]);router['post'](_0xa0a0('0x13'),auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x1f')]);router['post'](_0xa0a0('0x20'),auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x21')]);router[_0xa0a0('0x1a')](_0xa0a0('0x16'),controller[_0xa0a0('0x22')]);router[_0xa0a0('0x1a')](_0xa0a0('0x23'),auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x24')]);router[_0xa0a0('0x25')](_0xa0a0('0xe'),auth['isAuthenticated'](),controller[_0xa0a0('0x26')]);router['delete']('/:id',auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x27')]);router[_0xa0a0('0x28')]('/:id/dispositions',auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x29')]);router[_0xa0a0('0x28')](_0xa0a0('0x12'),auth['isAuthenticated'](),controller[_0xa0a0('0x2a')]);router[_0xa0a0('0x28')](_0xa0a0('0x23'),auth[_0xa0a0('0xd')](),controller[_0xa0a0('0x2b')]);module[_0xa0a0('0x2c')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e6a2aa9..5252025 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 _0x32d5=['csc','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','plivo'];(function(_0x2894c2,_0x5f5da6){var _0x3cfe38=function(_0x634b7){while(--_0x634b7){_0x2894c2['push'](_0x2894c2['shift']());}};_0x3cfe38(++_0x5f5da6);}(_0x32d5,0x1aa));var _0x532d=function(_0x4c8b67,_0x110993){_0x4c8b67=_0x4c8b67-0x0;var _0x7c52c1=_0x32d5[_0x4c8b67];return _0x7c52c1;};'use strict';var Sequelize=require(_0x532d('0x0'));var rs=require(_0x532d('0x1'));module[_0x532d('0x2')]={'name':{'type':Sequelize[_0x532d('0x3')],'unique':_0x532d('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x532d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x532d('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x532d('0x5')]();}},'phone':{'type':Sequelize[_0x532d('0x3')]},'type':{'type':Sequelize['ENUM'](_0x532d('0x6'),_0x532d('0x7'),_0x532d('0x8'),_0x532d('0x9'),_0x532d('0xa'),'clickatell','bandwidth',_0x532d('0xb'),'infobip',_0x532d('0xc'))},'accountSid':{'type':Sequelize[_0x532d('0x3')]},'authId':{'type':Sequelize[_0x532d('0x3')]},'authToken':{'type':Sequelize[_0x532d('0x3')]},'smsMethod':{'type':Sequelize[_0x532d('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x532d('0x3')]},'password':{'type':Sequelize[_0x532d('0x3')]},'apiKey':{'type':Sequelize[_0x532d('0x3')]},'applicationId':{'type':Sequelize[_0x532d('0x3')]},'accountId':{'type':Sequelize[_0x532d('0x3')]},'senderString':{'type':Sequelize[_0x532d('0x3')]},'deliveryReport':{'type':Sequelize[_0x532d('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x532d('0xf')],'defaultValue':function(){return _0x532d('0x10');}},'notificationSound':{'type':Sequelize[_0x532d('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x532d('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x532d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x532d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x532d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x532d('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x532d('0x11')],'comment':_0x532d('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x532d('0xe')],'defaultValue':![],'comment':_0x532d('0x13'),'set':function(_0x3747e4){if(!_0x3747e4)this[_0x532d('0x14')](_0x532d('0x15'),null);this['setDataValue'](_0x532d('0x16'),_0x3747e4);}}}; \ No newline at end of file +var _0xaa7c=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xaa7c,0x18e));var _0xcaa7=function(_0x45abcb,_0x1a03bc){_0x45abcb=_0x45abcb-0x0;var _0x1650c1=_0xaa7c[_0x45abcb];return _0x1650c1;};'use strict';var Sequelize=require(_0xcaa7('0x0'));var rs=require(_0xcaa7('0x1'));module[_0xcaa7('0x2')]={'name':{'type':Sequelize[_0xcaa7('0x3')],'unique':_0xcaa7('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xcaa7('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xcaa7('0x3')],'defaultValue':function(){return rs[_0xcaa7('0x5')]();}},'phone':{'type':Sequelize[_0xcaa7('0x3')]},'type':{'type':Sequelize[_0xcaa7('0x6')](_0xcaa7('0x7'),'skebby',_0xcaa7('0x8'),'clicksend',_0xcaa7('0x9'),_0xcaa7('0xa'),_0xcaa7('0xb'),'csc',_0xcaa7('0xc'),_0xcaa7('0xd'))},'accountSid':{'type':Sequelize[_0xcaa7('0x3')]},'authId':{'type':Sequelize[_0xcaa7('0x3')]},'authToken':{'type':Sequelize[_0xcaa7('0x3')]},'smsMethod':{'type':Sequelize[_0xcaa7('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xcaa7('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xcaa7('0x3')]},'applicationId':{'type':Sequelize[_0xcaa7('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xcaa7('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xcaa7('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcaa7('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xcaa7('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcaa7('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcaa7('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xcaa7('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcaa7('0x10')],'comment':_0xcaa7('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xcaa7('0xe')],'defaultValue':![],'comment':_0xcaa7('0x12'),'set':function(_0x15d730){if(!_0x15d730)this['setDataValue'](_0xcaa7('0x13'),null);this[_0xcaa7('0x14')](_0xcaa7('0x15'),_0x15d730);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1bb63d3..ddd3169 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 _0x5d95=['findAll','rows','show','params','keys','find','create','role','SmsAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','Disposition','findOne','nolimit','count','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','skebby','from','text','connectel','messageId','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','intelepeer','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','\x0a','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','User','Owner','internal','Tag','Tags','color','tag','List','out','user','Messages','SmsMessage','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','clickatell','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','end','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x306409,_0x9c38b4){var _0x5a179b=function(_0x5a62e5){while(--_0x5a62e5){_0x306409['push'](_0x306409['shift']());}};_0x5a179b(++_0x9c38b4);}(_0x5d95,0x161));var _0x55d9=function(_0x4120a7,_0x209c12){_0x4120a7=_0x4120a7-0x0;var _0x362588=_0x5d95[_0x4120a7];return _0x362588;};'use strict';var pdf=require(_0x55d9('0x0'));var emlformat=require(_0x55d9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x55d9('0x2'));var jsonpatch=require(_0x55d9('0x3'));var rp=require(_0x55d9('0x4'));var moment=require(_0x55d9('0x5'));var BPromise=require(_0x55d9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x55d9('0x7'));var csv=require(_0x55d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55d9('0x9'));var squel=require(_0x55d9('0xa'));var crypto=require('crypto');var jsforce=require(_0x55d9('0xb'));var deskjs=require(_0x55d9('0xc'));var toCsv=require(_0x55d9('0x8'));var querystring=require('querystring');var Papa=require(_0x55d9('0xd'));var Redis=require(_0x55d9('0xe'));var authService=require(_0x55d9('0xf'));var qs=require(_0x55d9('0x10'));var as=require(_0x55d9('0x11'));var hardwareService=require(_0x55d9('0x12'));var logger=require(_0x55d9('0x13'))(_0x55d9('0x14'));var utils=require(_0x55d9('0x15'));var config=require(_0x55d9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x55d9('0x17'))['db'];config['redis']=_[_0x55d9('0x18')](config[_0x55d9('0x19')],{'host':_0x55d9('0x1a'),'port':0x18eb});var socket=require(_0x55d9('0x1b'))(new Redis(config[_0x55d9('0x19')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x55d9('0x1c'));var client=jayson[_0x55d9('0x1d')][_0x55d9('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3fdd4b,_0x1b6ff2,_0x46ae90,_0x5a46dd){return new BPromise(function(_0x531646,_0x373947){var _0xb32b23=_0x5a46dd||client;return _0xb32b23['request'](_0x3fdd4b,_0x46ae90)[_0x55d9('0x1f')](function(_0x161c8d){logger[_0x55d9('0x20')](_0x55d9('0x21'),_0x1b6ff2,_0x55d9('0x22'));logger[_0x55d9('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b6ff2,_0x55d9('0x22'),JSON['stringify'](_0x161c8d));if(_0x161c8d[_0x55d9('0x24')]){if(_0x161c8d['error']['code']===0x1f4){logger[_0x55d9('0x24')](_0x55d9('0x21'),_0x1b6ff2,_0x161c8d[_0x55d9('0x24')][_0x55d9('0x25')]);return _0x373947(_0x161c8d[_0x55d9('0x24')]['message']);}logger['error'](_0x55d9('0x21'),_0x1b6ff2,_0x161c8d[_0x55d9('0x24')][_0x55d9('0x25')]);return _0x531646(_0x161c8d[_0x55d9('0x24')]['message']);}else{logger['info'](_0x55d9('0x21'),_0x1b6ff2,_0x55d9('0x22'));_0x531646(_0x161c8d['result'][_0x55d9('0x25')]);}})[_0x55d9('0x26')](function(_0x51b3f2){logger[_0x55d9('0x24')](_0x55d9('0x21'),_0x1b6ff2,_0x51b3f2);_0x373947(_0x51b3f2);});});}function respondWithStatusCode(_0x39690a,_0x475882){_0x475882=_0x475882||0xcc;return function(_0x20eb2b){if(_0x20eb2b){return _0x39690a[_0x55d9('0x27')](_0x475882);}return _0x39690a[_0x55d9('0x28')](_0x475882)['end']();};}function respondWithResult(_0x389e3b,_0xe1394){_0xe1394=_0xe1394||0xc8;return function(_0x2615d7){if(_0x2615d7){return _0x389e3b[_0x55d9('0x28')](_0xe1394)['json'](_0x2615d7);}};}function respondWithFilteredResult(_0x471f96,_0x167928){return function(_0x675956){if(_0x675956){var _0xf54c5c=_0x675956['count'],_0x9c267a=_0x167928[_0x55d9('0x29')],_0x29008b=_0x167928[_0x55d9('0x29')]+_0x167928[_0x55d9('0x2a')],_0x3170db;if(_0x29008b>=_0xf54c5c){_0x29008b=_0xf54c5c;_0x3170db=0xc8;}else{_0x3170db=0xce;}_0x471f96[_0x55d9('0x28')](_0x3170db);return _0x471f96[_0x55d9('0x2b')](_0x55d9('0x2c'),_0x9c267a+'-'+_0x29008b+'/'+_0xf54c5c)[_0x55d9('0x2d')](_0x675956);}return null;};}function patchUpdates(_0x56aee9){return function(_0x44f80b){try{jsonpatch[_0x55d9('0x2e')](_0x44f80b,_0x56aee9,!![]);}catch(_0xb71384){return BPromise[_0x55d9('0x2f')](_0xb71384);}return _0x44f80b[_0x55d9('0x30')]();};}function saveUpdates(_0x15a9af,_0x16883e){return function(_0x1f1c88){if(_0x1f1c88){return _0x1f1c88[_0x55d9('0x31')](_0x15a9af)[_0x55d9('0x1f')](function(_0x3ae419){return _0x3ae419;});}return null;};}function removeEntity(_0x54ec01,_0x17a8b8){return function(_0x2bbe84){if(_0x2bbe84){return _0x2bbe84[_0x55d9('0x32')]()[_0x55d9('0x1f')](function(){var _0x4feb82=_0x2bbe84[_0x55d9('0x33')]({'plain':!![]});var _0x1c7f84='SmsAccounts';return db[_0x55d9('0x34')][_0x55d9('0x32')]({'where':{'type':_0x1c7f84,'resourceId':_0x4feb82['id']}})[_0x55d9('0x1f')](function(){return _0x2bbe84;});})['then'](function(){_0x54ec01[_0x55d9('0x28')](0xcc)[_0x55d9('0x35')]();});}};}function handleEntityNotFound(_0x2278a8,_0x342cc8){return function(_0x522325){if(!_0x522325){_0x2278a8[_0x55d9('0x27')](0x194);}return _0x522325;};}function handleError(_0x584382,_0x496b12){_0x496b12=_0x496b12||0x1f4;return function(_0x151320){logger[_0x55d9('0x24')](_0x151320['stack']);if(_0x151320[_0x55d9('0x36')]){delete _0x151320[_0x55d9('0x36')];}_0x584382['status'](_0x496b12)[_0x55d9('0x37')](_0x151320);};}exports[_0x55d9('0x38')]=function(_0x316905,_0x395865){var _0x2df899={'include':[{'model':db['Pause'],'as':_0x55d9('0x39')}]},_0x53f890={},_0x14bbef={'count':0x0,'rows':[]};var _0x334e06=_[_0x55d9('0x3a')](db[_0x55d9('0x3b')][_0x55d9('0x3c')],function(_0x3b1a7c){return{'name':_0x3b1a7c[_0x55d9('0x3d')],'type':_0x3b1a7c[_0x55d9('0x3e')][_0x55d9('0x3f')]};});_0x53f890[_0x55d9('0x40')]=_[_0x55d9('0x3a')](_0x334e06,'name');_0x53f890[_0x55d9('0x41')]=_['keys'](_0x316905[_0x55d9('0x41')]);_0x53f890[_0x55d9('0x42')]=_[_0x55d9('0x43')](_0x53f890[_0x55d9('0x40')],_0x53f890['query']);_0x2df899[_0x55d9('0x44')]=_[_0x55d9('0x43')](_0x53f890[_0x55d9('0x40')],qs[_0x55d9('0x45')](_0x316905[_0x55d9('0x41')][_0x55d9('0x45')]));_0x2df899[_0x55d9('0x44')]=_0x2df899[_0x55d9('0x44')][_0x55d9('0x46')]?_0x2df899[_0x55d9('0x44')]:_0x53f890[_0x55d9('0x40')];if(!_0x316905['query'][_0x55d9('0x47')]('nolimit')){_0x2df899[_0x55d9('0x2a')]=qs[_0x55d9('0x2a')](_0x316905['query'][_0x55d9('0x2a')]);_0x2df899[_0x55d9('0x29')]=qs[_0x55d9('0x29')](_0x316905[_0x55d9('0x41')][_0x55d9('0x29')]);}_0x2df899[_0x55d9('0x48')]=qs[_0x55d9('0x49')](_0x316905[_0x55d9('0x41')][_0x55d9('0x49')]);_0x2df899[_0x55d9('0x4a')]=qs['filters'](_[_0x55d9('0x4b')](_0x316905['query'],_0x53f890['filters']),_0x334e06);if(_0x316905[_0x55d9('0x41')][_0x55d9('0x4c')]){_0x2df899['where']=_[_0x55d9('0x4d')](_0x2df899[_0x55d9('0x4a')],{'$or':_[_0x55d9('0x3a')](_0x334e06,function(_0x56448b){if(_0x56448b['type']!=='VIRTUAL'){var _0xd73220={};_0xd73220[_0x56448b[_0x55d9('0x36')]]={'$like':'%'+_0x316905[_0x55d9('0x41')]['filter']+'%'};return _0xd73220;}})});}_0x2df899=_['merge']({},_0x2df899,_0x316905[_0x55d9('0x4e')]);var _0x33accb={'where':_0x2df899[_0x55d9('0x4a')]};return db[_0x55d9('0x3b')]['count'](_0x33accb)['then'](function(_0x17f92d){_0x14bbef['count']=_0x17f92d;if(_0x316905[_0x55d9('0x41')][_0x55d9('0x4f')]){_0x2df899[_0x55d9('0x50')]=[{'all':!![]}];}return db[_0x55d9('0x3b')][_0x55d9('0x51')](_0x2df899);})['then'](function(_0x1cad47){_0x14bbef[_0x55d9('0x52')]=_0x1cad47;return _0x14bbef;})[_0x55d9('0x1f')](respondWithFilteredResult(_0x395865,_0x2df899))['catch'](handleError(_0x395865,null));};exports[_0x55d9('0x53')]=function(_0x13536a,_0x206700){var _0x4dcb23={'raw':![],'where':{'id':_0x13536a[_0x55d9('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x55d9('0x39')}]},_0x3734c5={};_0x3734c5[_0x55d9('0x40')]=_[_0x55d9('0x55')](db[_0x55d9('0x3b')][_0x55d9('0x3c')]);_0x3734c5[_0x55d9('0x41')]=_[_0x55d9('0x55')](_0x13536a[_0x55d9('0x41')]);_0x3734c5[_0x55d9('0x42')]=_[_0x55d9('0x43')](_0x3734c5[_0x55d9('0x40')],_0x3734c5['query']);_0x4dcb23[_0x55d9('0x44')]=_[_0x55d9('0x43')](_0x3734c5['model'],qs[_0x55d9('0x45')](_0x13536a[_0x55d9('0x41')][_0x55d9('0x45')]));_0x4dcb23[_0x55d9('0x44')]=_0x4dcb23['attributes']['length']?_0x4dcb23[_0x55d9('0x44')]:_0x3734c5[_0x55d9('0x40')];if(_0x13536a[_0x55d9('0x41')][_0x55d9('0x4f')]){_0x4dcb23[_0x55d9('0x50')]=[{'all':!![]}];}_0x4dcb23=_[_0x55d9('0x4d')]({},_0x4dcb23,_0x13536a['options']);return db['SmsAccount'][_0x55d9('0x56')](_0x4dcb23)['then'](handleEntityNotFound(_0x206700,null))['then'](respondWithResult(_0x206700,null))[_0x55d9('0x26')](handleError(_0x206700,null));};exports['create']=function(_0x3bfd8c,_0x32ad39){return db[_0x55d9('0x3b')][_0x55d9('0x57')](_0x3bfd8c['body'],{})[_0x55d9('0x1f')](function(_0x3e4212){var _0x573685=_0x3bfd8c['user']['get']({'plain':!![]});if(!_0x573685)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x573685[_0x55d9('0x58')]==='user'){var _0x4313f1=_0x3e4212[_0x55d9('0x33')]({'plain':!![]});var _0x51eb5c=_0x55d9('0x59');return db[_0x55d9('0x5a')]['find']({'where':{'name':_0x51eb5c,'userProfileId':_0x573685[_0x55d9('0x5b')]},'raw':!![]})['then'](function(_0x27fe28){if(_0x27fe28&&_0x27fe28['autoAssociation']===0x0){return db[_0x55d9('0x34')][_0x55d9('0x57')]({'name':_0x4313f1[_0x55d9('0x36')],'resourceId':_0x4313f1['id'],'type':_0x27fe28[_0x55d9('0x36')],'sectionId':_0x27fe28['id']},{})['then'](function(){return _0x3e4212;});}else{return _0x3e4212;}})[_0x55d9('0x26')](function(_0x1e92d5){logger['error'](_0x55d9('0x5c'),_0x1e92d5);throw _0x1e92d5;});}return _0x3e4212;})[_0x55d9('0x1f')](respondWithResult(_0x32ad39,0xc9))[_0x55d9('0x26')](handleError(_0x32ad39,null));};exports[_0x55d9('0x31')]=function(_0x2af172,_0x5bad39){if(_0x2af172[_0x55d9('0x5d')]['id']){delete _0x2af172[_0x55d9('0x5d')]['id'];}return db[_0x55d9('0x3b')][_0x55d9('0x56')]({'where':{'id':_0x2af172[_0x55d9('0x54')]['id']},'include':[{'model':db[_0x55d9('0x5e')],'as':_0x55d9('0x39')}]})[_0x55d9('0x1f')](handleEntityNotFound(_0x5bad39,null))[_0x55d9('0x1f')](saveUpdates(_0x2af172[_0x55d9('0x5d')],null))[_0x55d9('0x1f')](respondWithResult(_0x5bad39,null))[_0x55d9('0x26')](handleError(_0x5bad39,null));};exports[_0x55d9('0x32')]=function(_0x5d91c2,_0x4bda28){return db['SmsAccount'][_0x55d9('0x56')]({'where':{'id':_0x5d91c2[_0x55d9('0x54')]['id']}})['then'](handleEntityNotFound(_0x4bda28,null))[_0x55d9('0x1f')](removeEntity(_0x4bda28,null))[_0x55d9('0x26')](handleError(_0x4bda28,null));};exports['describe']=function(_0x32b37e,_0x146c17){return db[_0x55d9('0x3b')][_0x55d9('0x5f')]()['then'](respondWithResult(_0x146c17,null))[_0x55d9('0x26')](handleError(_0x146c17,null));};exports['addDisposition']=function(_0x2ebe92,_0x574691,_0x3ca6f4){if(_0x2ebe92[_0x55d9('0x5d')]['id']){delete _0x2ebe92['body']['id'];}return db[_0x55d9('0x3b')]['find']({'where':{'id':_0x2ebe92[_0x55d9('0x54')]['id']}})['then'](handleEntityNotFound(_0x574691,null))['then'](function(_0x52dea1){if(_0x52dea1){_0x2ebe92['body']['SmsAccountId']=_0x52dea1['id'];return db[_0x55d9('0x60')][_0x55d9('0x57')](_0x2ebe92[_0x55d9('0x5d')]);}})[_0x55d9('0x1f')](respondWithResult(_0x574691,null))[_0x55d9('0x26')](handleError(_0x574691,null));};exports['getDispositions']=function(_0x49cf29,_0xa50383,_0x428a3e){var _0x1288ca={'raw':![],'where':{}};var _0x2be787={};var _0x2dc6f5={'count':0x0,'rows':[]};return db['SmsAccount'][_0x55d9('0x61')]({'where':{'id':_0x49cf29[_0x55d9('0x54')]['id']}})['then'](handleEntityNotFound(_0xa50383,null))[_0x55d9('0x1f')](function(_0x412489){if(_0x412489){_0x2be787[_0x55d9('0x40')]=_['keys'](db[_0x55d9('0x60')][_0x55d9('0x3c')]);_0x2be787[_0x55d9('0x41')]=_['keys'](_0x49cf29[_0x55d9('0x41')]);_0x2be787[_0x55d9('0x42')]=_[_0x55d9('0x43')](_0x2be787[_0x55d9('0x40')],_0x2be787[_0x55d9('0x41')]);_0x1288ca[_0x55d9('0x44')]=_[_0x55d9('0x43')](_0x2be787[_0x55d9('0x40')],qs['fields'](_0x49cf29[_0x55d9('0x41')]['fields']));_0x1288ca['attributes']=_0x1288ca[_0x55d9('0x44')]['length']?_0x1288ca[_0x55d9('0x44')]:_0x2be787[_0x55d9('0x40')];if(!_0x49cf29[_0x55d9('0x41')][_0x55d9('0x47')](_0x55d9('0x62'))){_0x1288ca['limit']=qs[_0x55d9('0x2a')](_0x49cf29[_0x55d9('0x41')][_0x55d9('0x2a')]);_0x1288ca[_0x55d9('0x29')]=qs[_0x55d9('0x29')](_0x49cf29[_0x55d9('0x41')][_0x55d9('0x29')]);}_0x1288ca[_0x55d9('0x48')]=qs[_0x55d9('0x49')](_0x49cf29[_0x55d9('0x41')][_0x55d9('0x49')]);_0x1288ca[_0x55d9('0x4a')]=qs['filters'](_['pick'](_0x49cf29[_0x55d9('0x41')],_0x2be787[_0x55d9('0x42')]));_0x1288ca['where']['SmsAccountId']=_0x412489['id'];if(_0x49cf29[_0x55d9('0x41')][_0x55d9('0x4c')]){_0x1288ca[_0x55d9('0x4a')]=_[_0x55d9('0x4d')](_0x1288ca[_0x55d9('0x4a')],{'$or':_[_0x55d9('0x3a')](_0x1288ca['attributes'],function(_0x570def){var _0x1311ec={};_0x1311ec[_0x570def]={'$like':'%'+_0x49cf29[_0x55d9('0x41')]['filter']+'%'};return _0x1311ec;})});}_0x1288ca=_['merge']({},_0x1288ca,_0x49cf29[_0x55d9('0x4e')]);return db[_0x55d9('0x60')][_0x55d9('0x63')]({'where':_0x1288ca[_0x55d9('0x4a')]})[_0x55d9('0x1f')](function(_0x272d66){_0x2dc6f5[_0x55d9('0x63')]=_0x272d66;if(_0x49cf29[_0x55d9('0x41')][_0x55d9('0x4f')]){_0x1288ca['include']=[{'all':!![]}];}return db[_0x55d9('0x60')][_0x55d9('0x51')](_0x1288ca);})['then'](function(_0x2702a9){_0x2dc6f5['rows']=_0x2702a9;return _0x2dc6f5;});}})[_0x55d9('0x1f')](respondWithFilteredResult(_0xa50383,_0x1288ca))[_0x55d9('0x26')](handleError(_0xa50383,null));};exports[_0x55d9('0x64')]=function(_0x1edb38,_0x518121,_0x30d098){return db['SmsAccount']['find']({'where':{'id':_0x1edb38[_0x55d9('0x54')]['id']}})['then'](handleEntityNotFound(_0x518121,null))[_0x55d9('0x1f')](function(_0xb8c07b){if(_0xb8c07b){return _0xb8c07b[_0x55d9('0x64')](_0x1edb38[_0x55d9('0x41')][_0x55d9('0x65')]);}})[_0x55d9('0x1f')](respondWithStatusCode(_0x518121,null))[_0x55d9('0x26')](handleError(_0x518121,null));};exports[_0x55d9('0x66')]=function(_0x280ec7,_0x1d97eb,_0x4ac5f7){if(_0x280ec7[_0x55d9('0x5d')]['id']){delete _0x280ec7['body']['id'];}return db['SmsAccount'][_0x55d9('0x56')]({'where':{'id':_0x280ec7[_0x55d9('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d97eb,null))[_0x55d9('0x1f')](function(_0x358bdc){if(_0x358bdc){_0x280ec7[_0x55d9('0x5d')][_0x55d9('0x67')]=_0x358bdc['id'];return db['CannedAnswer'][_0x55d9('0x57')](_0x280ec7['body']);}})[_0x55d9('0x1f')](respondWithResult(_0x1d97eb,null))[_0x55d9('0x26')](handleError(_0x1d97eb,null));};exports['getAnswers']=function(_0x4c0aa6,_0x51d038,_0x4ff59f){var _0x3bd588={'raw':![],'where':{}};var _0x1d6578={};var _0x8a5846={'count':0x0,'rows':[]};return db[_0x55d9('0x3b')]['findOne']({'where':{'id':_0x4c0aa6['params']['id']}})['then'](handleEntityNotFound(_0x51d038,null))[_0x55d9('0x1f')](function(_0x1f0ff1){if(_0x1f0ff1){_0x1d6578[_0x55d9('0x40')]=_[_0x55d9('0x55')](db['CannedAnswer']['rawAttributes']);_0x1d6578[_0x55d9('0x41')]=_[_0x55d9('0x55')](_0x4c0aa6['query']);_0x1d6578[_0x55d9('0x42')]=_[_0x55d9('0x43')](_0x1d6578[_0x55d9('0x40')],_0x1d6578[_0x55d9('0x41')]);_0x3bd588[_0x55d9('0x44')]=_['intersection'](_0x1d6578[_0x55d9('0x40')],qs[_0x55d9('0x45')](_0x4c0aa6[_0x55d9('0x41')]['fields']));_0x3bd588[_0x55d9('0x44')]=_0x3bd588['attributes'][_0x55d9('0x46')]?_0x3bd588[_0x55d9('0x44')]:_0x1d6578['model'];if(!_0x4c0aa6[_0x55d9('0x41')]['hasOwnProperty'](_0x55d9('0x62'))){_0x3bd588[_0x55d9('0x2a')]=qs['limit'](_0x4c0aa6['query'][_0x55d9('0x2a')]);_0x3bd588[_0x55d9('0x29')]=qs[_0x55d9('0x29')](_0x4c0aa6[_0x55d9('0x41')][_0x55d9('0x29')]);}_0x3bd588[_0x55d9('0x48')]=qs[_0x55d9('0x49')](_0x4c0aa6['query']['sort']);_0x3bd588[_0x55d9('0x4a')]=qs['filters'](_[_0x55d9('0x4b')](_0x4c0aa6['query'],_0x1d6578[_0x55d9('0x42')]));_0x3bd588[_0x55d9('0x4a')][_0x55d9('0x67')]=_0x1f0ff1['id'];if(_0x4c0aa6[_0x55d9('0x41')][_0x55d9('0x4c')]){_0x3bd588[_0x55d9('0x4a')]=_[_0x55d9('0x4d')](_0x3bd588[_0x55d9('0x4a')],{'$or':_[_0x55d9('0x3a')](_0x3bd588[_0x55d9('0x44')],function(_0x2b09b6){var _0x284f9e={};_0x284f9e[_0x2b09b6]={'$like':'%'+_0x4c0aa6[_0x55d9('0x41')][_0x55d9('0x4c')]+'%'};return _0x284f9e;})});}_0x3bd588=_['merge']({},_0x3bd588,_0x4c0aa6[_0x55d9('0x4e')]);return db[_0x55d9('0x68')][_0x55d9('0x63')]({'where':_0x3bd588['where']})['then'](function(_0x2089de){_0x8a5846[_0x55d9('0x63')]=_0x2089de;if(_0x4c0aa6[_0x55d9('0x41')]['includeAll']){_0x3bd588[_0x55d9('0x50')]=[{'all':!![]}];}return db[_0x55d9('0x68')][_0x55d9('0x51')](_0x3bd588);})['then'](function(_0xce1936){_0x8a5846[_0x55d9('0x52')]=_0xce1936;return _0x8a5846;});}})[_0x55d9('0x1f')](respondWithFilteredResult(_0x51d038,_0x3bd588))[_0x55d9('0x26')](handleError(_0x51d038,null));};exports['removeAnswers']=function(_0x2710cf,_0x15fe79,_0x5143ca){return db[_0x55d9('0x3b')][_0x55d9('0x56')]({'where':{'id':_0x2710cf[_0x55d9('0x54')]['id']}})[_0x55d9('0x1f')](handleEntityNotFound(_0x15fe79,null))[_0x55d9('0x1f')](function(_0x142a6d){if(_0x142a6d){return _0x142a6d['removeAnswers'](_0x2710cf[_0x55d9('0x41')][_0x55d9('0x65')]);}})['then'](respondWithStatusCode(_0x15fe79,null))[_0x55d9('0x26')](handleError(_0x15fe79,null));};exports[_0x55d9('0x69')]=function(_0x1242b5,_0x3dbb6b,_0x3edb5a){var _0x101a27={'channel':_0x55d9('0x6a')};var _0x5b5785=[];var _0x2a04ff=[];var _0x58aadc={};return db['SmsAccount'][_0x55d9('0x56')]({'where':{'id':_0x1242b5[_0x55d9('0x54')]['id']},'include':[{'model':db[_0x55d9('0x6b')],'as':_0x55d9('0x6c')}]})[_0x55d9('0x1f')](handleEntityNotFound(_0x3dbb6b,null))[_0x55d9('0x1f')](function(_0x5c89bb){_0x101a27[_0x55d9('0x6d')]=_0x5c89bb;_0x101a27[_0x55d9('0x6e')]=_[_0x55d9('0x6f')](_0x5c89bb[_0x55d9('0x6c')],[_0x55d9('0x70')],[_0x55d9('0x71')]);if(_0x101a27['account'][_0x55d9('0x6c')]){delete _0x101a27['account']['Applications'];}return db['CmContact']['describe']();})['then'](function(_0x22372a){if(!_0x22372a){throw new db[(_0x55d9('0x72'))][(_0x55d9('0x73'))](_0x55d9('0x74'));}_0x5b5785=_[_0x55d9('0x75')](_[_0x55d9('0x55')](_0x22372a),[_0x55d9('0x76'),_0x55d9('0x77')]);_0x2a04ff=_[_0x55d9('0x75')](_[_0x55d9('0x55')](_0x22372a),[_0x55d9('0x76'),_0x55d9('0x77'),_0x55d9('0x78'),_0x55d9('0x79')]);_0x101a27[_0x55d9('0x5d')]={'mapKey':_0x55d9('0x7a')};if(_0x101a27[_0x55d9('0x6d')]['type']){switch(_0x101a27[_0x55d9('0x6d')][_0x55d9('0x3e')]){case _0x55d9('0x7b'):_0x101a27['body']['from']=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x7c')];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x5d')]=_0x1242b5['body'][_0x55d9('0x7d')];_0x101a27['body']['messageId']=_0x1242b5['body']['MessageSid'];break;case _0x55d9('0x7e'):_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')]='+'+_0x1242b5[_0x55d9('0x5d')]['sender'];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x5d')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x80')];break;case _0x55d9('0x81'):_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x7f')];_0x101a27['body'][_0x55d9('0x5d')]=_0x1242b5[_0x55d9('0x5d')]['message'];break;case'clicksend':_0x101a27['body'][_0x55d9('0x7f')]=_0x1242b5['body']['from'];_0x101a27['body'][_0x55d9('0x5d')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x5d')];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x82')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x83')];break;case _0x55d9('0x84'):_0x101a27['body'][_0x55d9('0x7f')]=_0x1242b5['body'][_0x55d9('0x7c')];_0x101a27['body'][_0x55d9('0x5d')]=_0x1242b5['body']['Text'];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x82')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x85')];break;case _0x55d9('0x86'):_0x101a27[_0x55d9('0x5d')]['from']='+'+_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x87')][0x0][_0x55d9('0x7f')];_0x101a27[_0x55d9('0x5d')]['body']=_0x1242b5['body'][_0x55d9('0x87')][0x0][_0x55d9('0x80')];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x82')]=_0x1242b5['body'][_0x55d9('0x87')][0x0][_0x55d9('0x82')];break;case _0x55d9('0x88'):_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x89')];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x5d')]=_0x1242b5['body'][_0x55d9('0x8a')][_0x55d9('0x25')];break;case'clickatell':_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')]=_0x1242b5['body'][_0x55d9('0x8b')];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x5d')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x80')];_0x101a27['body'][_0x55d9('0x82')]=_0x1242b5[_0x55d9('0x5d')]['replyMessageId'];break;case'bandwidth':_0x101a27[_0x55d9('0x5d')][_0x55d9('0x82')]=_0x1242b5['body'][0x0][_0x55d9('0x25')]['id'];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')]=_0x1242b5['body'][0x0]['message'][_0x55d9('0x7f')];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x5d')]=_0x1242b5['body'][0x0][_0x55d9('0x25')][_0x55d9('0x80')];break;case _0x55d9('0x8c'):_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x7f')];_0x101a27[_0x55d9('0x5d')][_0x55d9('0x5d')]=_0x1242b5[_0x55d9('0x5d')][_0x55d9('0x25')];_0x101a27['body']['messageId']=_0x1242b5[_0x55d9('0x5d')]['refid'];break;}}if(_0x101a27[_0x55d9('0x5d')]['id']){delete _0x101a27[_0x55d9('0x5d')]['id'];}if(_['isNil'](_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')])){throw new db[(_0x55d9('0x72'))][(_0x55d9('0x73'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x101a27[_0x55d9('0x5d')][_0x55d9('0x5d')])||_0x101a27[_0x55d9('0x5d')][_0x55d9('0x5d')]===''){throw new db[(_0x55d9('0x72'))][(_0x55d9('0x73'))](_0x55d9('0x8d'));}if(_[_0x55d9('0x8e')](_0x101a27['body'][_0x55d9('0x8f')])){throw new db[(_0x55d9('0x72'))]['ValidationError'](_0x55d9('0x90')+_0x2a04ff);}if(!_[_0x55d9('0x91')](_0x2a04ff,_0x101a27[_0x55d9('0x5d')][_0x55d9('0x8f')])){throw new db['Sequelize'][(_0x55d9('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a04ff);}_0x58aadc[_0x101a27[_0x55d9('0x5d')][_0x55d9('0x8f')]]=_0x101a27[_0x55d9('0x5d')]['from'];return db[_0x55d9('0x92')][_0x55d9('0x56')]({'where':{'id':_0x101a27[_0x55d9('0x6d')][_0x55d9('0x79')]},'include':[{'model':db[_0x55d9('0x93')],'as':_0x55d9('0x94'),'where':_0x58aadc,'limit':0x1,'order':[[_0x55d9('0x77'),_0x55d9('0x95')]]}]});})[_0x55d9('0x1f')](handleEntityNotFound(_0x3dbb6b,null))['then'](function(_0x4c830e){if(_0x4c830e){_0x101a27[_0x55d9('0x96')]=_[_0x55d9('0x97')](_0x4c830e,[_0x55d9('0x94')]);if(_0x4c830e['Contacts'][_0x55d9('0x46')]){return _0x4c830e[_0x55d9('0x94')][0x0];}var _0x3d71ec=_[_0x55d9('0x18')](_0x101a27[_0x55d9('0x5d')],{'firstName':_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')],'ListId':_0x4c830e['id']});_0x3d71ec[_0x101a27[_0x55d9('0x5d')][_0x55d9('0x8f')]]=_0x101a27[_0x55d9('0x5d')]['from'];return db[_0x55d9('0x93')]['create'](_0x3d71ec,{'fields':_0x5b5785,'raw':!![]});}})['then'](handleEntityNotFound(_0x3dbb6b,null))[_0x55d9('0x1f')](function(_0x5871d5){if(_0x5871d5){_0x101a27[_0x55d9('0x98')]=_0x5871d5;var _0x1cbb2c={'ContactId':_0x5871d5['id'],'phone':_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')],'SmsAccountId':_0x1242b5[_0x55d9('0x54')]['id']};var _0x1b338b={'ContactId':_0x5871d5['id'],'SmsAccountId':_0x1242b5[_0x55d9('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0x55d9('0x56')]({'where':_0x1b338b})[_0x55d9('0x1f')](function(_0x1e0256){if(_0x1e0256){return[_0x1e0256,![]];}return db[_0x55d9('0x99')][_0x55d9('0x57')](_0x1cbb2c)[_0x55d9('0x1f')](function(_0x4fcb94){return[_0x4fcb94,!![]];});});}})[_0x55d9('0x9a')](function(_0x4398cd,_0x449ecb){_0x101a27['interaction']=_0x4398cd[_0x55d9('0x33')]({'plain':!![]});_0x101a27[_0x55d9('0x9b')]['created']=![];if(_0x449ecb){if(_0x101a27[_0x55d9('0x6d')][_0x55d9('0x9c')]){_0x101a27[_0x55d9('0x6e')][_0x55d9('0x9d')]({'id':0x0,'priority':_0x101a27[_0x55d9('0x6e')][_0x55d9('0x46')]+0x1,'app':_0x55d9('0x9e'),'appdata':_0x55d9('0x9f'),'interval':_0x55d9('0xa0')});}_0x101a27[_0x55d9('0x9b')][_0x55d9('0xa1')]=!![];}return db['SmsMessage'][_0x55d9('0x57')]({'phone':_0x101a27[_0x55d9('0x5d')][_0x55d9('0x7f')],'messageId':_0x101a27['body'][_0x55d9('0x82')],'body':_0x101a27['body'][_0x55d9('0x5d')],'SmsAccountId':_0x1242b5['params']['id'],'SmsInteractionId':_0x4398cd['id'],'direction':'in','ContactId':_0x4398cd[_0x55d9('0xa2')],'AttachmentId':_0x101a27[_0x55d9('0x5d')][_0x55d9('0xa3')]});})[_0x55d9('0x1f')](function(_0x307558){_0x101a27['message']=_0x307558;if(_0x101a27[_0x55d9('0x9b')][_0x55d9('0xa4')]){return db['User'][_0x55d9('0x56')]({'attributes':['id',_0x55d9('0x36')],'where':{'id':_0x101a27[_0x55d9('0x9b')][_0x55d9('0xa4')]}})['then'](function(_0x1c1367){if(_0x1c1367){_0x101a27[_0x55d9('0x6e')][_0x55d9('0xa5')]({'id':0x0,'priority':0x0,'app':_0x55d9('0xa6'),'appdata':_0x1c1367[_0x55d9('0x36')]+','+(_0x101a27['account']['waitForTheAssignedAgent']||0xa),'interval':_0x55d9('0xa0')});}return respondWithRpcPromise(_0x55d9('0xa7'),_0x55d9('0xa8'),_0x101a27);});}return respondWithRpcPromise(_0x55d9('0xa7'),_0x55d9('0xa8'),_0x101a27);})[_0x55d9('0x1f')](function(_0x21b324){if(_0x21b324){var _0x3e7461=0xc8;var _0x134b17=_0x55d9('0xa9');logger['info'](_0x55d9('0xaa'),_0x134b17,_0x3e7461,_0x55d9('0xab'));logger['debug'](_0x55d9('0xac'),_0x134b17,_0x3e7461,_0x55d9('0xab'),JSON[_0x55d9('0xad')](_0x21b324));if(_0x101a27[_0x55d9('0x6d')][_0x55d9('0x3e')]===_0x55d9('0x7b')){return _0x3dbb6b['status'](_0x3e7461)[_0x55d9('0x2b')]('Content-Type','text/xml')['send'](_0x55d9('0xae'));}else{return _0x3dbb6b[_0x55d9('0x28')](_0x3e7461)['json'](_0x21b324);}}})['catch'](handleError(_0x3dbb6b,null));};exports[_0x55d9('0xaf')]=function(_0x3ffb19,_0x2d283c,_0x380168){return db[_0x55d9('0x3b')][_0x55d9('0x61')]({'where':{'id':_0x3ffb19[_0x55d9('0x54')]['id']}})[_0x55d9('0x1f')](handleEntityNotFound(_0x2d283c,null))[_0x55d9('0x1f')](function(_0x25c08d){if(_0x25c08d){return db[_0x55d9('0xb0')]['transaction'](function(_0x39b64d){return db[_0x55d9('0x6b')][_0x55d9('0x32')]({'where':{'SmsAccountId':_0x3ffb19['params']['id']},'transaction':_0x39b64d})[_0x55d9('0x1f')](function(_0x2b3751){var _0x4b12ea=_[_0x55d9('0x3a')](_0x3ffb19[_0x55d9('0x5d')],function(_0x3a6955){_0x3a6955['SmsAccountId']=_0x3ffb19[_0x55d9('0x54')]['id'];return _0x3a6955;});return db['SmsApplication'][_0x55d9('0xb1')](_0x4b12ea,{'transaction':_0x39b64d});});})['then'](function(){return db[_0x55d9('0x6b')][_0x55d9('0xb2')]({'where':{'SmsAccountId':_0x3ffb19[_0x55d9('0x54')]['id']},'order':_0x55d9('0x70')});});}})[_0x55d9('0x1f')](respondWithResult(_0x2d283c,null))[_0x55d9('0x26')](handleError(_0x2d283c,null));};exports[_0x55d9('0xb3')]=function(_0x3025c1,_0x1c1614,_0x48f10e){var _0x4f4f27={};var _0x5f45a0={};var _0x1d9cef;var _0x2646a1;return db[_0x55d9('0x3b')][_0x55d9('0x61')]({'where':{'id':_0x3025c1[_0x55d9('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c1614,null))[_0x55d9('0x1f')](function(_0x613100){if(_0x613100){_0x1d9cef=_0x613100;_0x5f45a0[_0x55d9('0x40')]=_['keys'](db['SmsApplication'][_0x55d9('0x3c')]);_0x5f45a0['query']=_['keys'](_0x3025c1[_0x55d9('0x41')]);_0x5f45a0[_0x55d9('0x42')]=_[_0x55d9('0x43')](_0x5f45a0['model'],_0x5f45a0[_0x55d9('0x41')]);_0x4f4f27[_0x55d9('0x44')]=_['intersection'](_0x5f45a0['model'],qs[_0x55d9('0x45')](_0x3025c1['query'][_0x55d9('0x45')]));_0x4f4f27[_0x55d9('0x44')]=_0x4f4f27[_0x55d9('0x44')]['length']?_0x4f4f27[_0x55d9('0x44')]:_0x5f45a0[_0x55d9('0x40')];_0x4f4f27[_0x55d9('0x48')]=qs[_0x55d9('0x49')](_0x3025c1[_0x55d9('0x41')]['sort']);_0x4f4f27[_0x55d9('0x4a')]=qs[_0x55d9('0x42')](_[_0x55d9('0x4b')](_0x3025c1[_0x55d9('0x41')],_0x5f45a0[_0x55d9('0x42')]));if(_0x3025c1[_0x55d9('0x41')][_0x55d9('0x4c')]){_0x4f4f27[_0x55d9('0x4a')]=_[_0x55d9('0x4d')](_0x4f4f27['where'],{'$or':_[_0x55d9('0x3a')](_0x4f4f27[_0x55d9('0x44')],function(_0x1b8690){var _0x587713={};_0x587713[_0x1b8690]={'$like':'%'+_0x3025c1['query'][_0x55d9('0x4c')]+'%'};return _0x587713;})});}_0x4f4f27=_[_0x55d9('0x4d')]({},_0x4f4f27,_0x3025c1[_0x55d9('0x4e')]);return _0x1d9cef[_0x55d9('0xb3')](_0x4f4f27);}})['then'](function(_0x5661bc){if(_0x5661bc){_0x2646a1=_0x5661bc[_0x55d9('0x46')];if(!_0x3025c1[_0x55d9('0x41')]['hasOwnProperty'](_0x55d9('0x62'))){_0x4f4f27[_0x55d9('0x2a')]=qs[_0x55d9('0x2a')](_0x3025c1[_0x55d9('0x41')][_0x55d9('0x2a')]);_0x4f4f27[_0x55d9('0x29')]=qs[_0x55d9('0x29')](_0x3025c1['query']['offset']);}return _0x1d9cef[_0x55d9('0xb3')](_0x4f4f27);}})[_0x55d9('0x1f')](function(_0x28f1ae){if(_0x28f1ae){return _0x28f1ae?{'count':_0x2646a1,'rows':_0x28f1ae}:null;}})['then'](respondWithResult(_0x1c1614,null))[_0x55d9('0x26')](handleError(_0x1c1614,null));};exports[_0x55d9('0xb4')]=function(_0x5e7d71,_0xc26780,_0x1cc0a9){var _0x5af30f={'raw':![],'where':{}};var _0x18ed20={};var _0x51f406={'count':0x0,'rows':[]};return db[_0x55d9('0x3b')][_0x55d9('0x61')]({'where':{'id':_0x5e7d71[_0x55d9('0x54')]['id']}})[_0x55d9('0x1f')](handleEntityNotFound(_0xc26780,null))[_0x55d9('0x1f')](function(_0x3ef533){if(_0x3ef533){_0x18ed20[_0x55d9('0x40')]=_[_0x55d9('0x55')](db[_0x55d9('0x99')][_0x55d9('0x3c')]);_0x18ed20[_0x55d9('0x41')]=_[_0x55d9('0x55')](_0x5e7d71[_0x55d9('0x41')]);_0x18ed20[_0x55d9('0x42')]=_[_0x55d9('0x43')](_0x18ed20['model'],_0x18ed20[_0x55d9('0x41')]);_0x5af30f[_0x55d9('0x44')]=_[_0x55d9('0x43')](_0x18ed20['model'],qs['fields'](_0x5e7d71[_0x55d9('0x41')][_0x55d9('0x45')]));_0x5af30f[_0x55d9('0x44')]=_0x5af30f['attributes'][_0x55d9('0x46')]?_0x5af30f['attributes']:_0x18ed20[_0x55d9('0x40')];if(!_0x5e7d71[_0x55d9('0x41')]['hasOwnProperty'](_0x55d9('0x62'))){_0x5af30f[_0x55d9('0x2a')]=qs[_0x55d9('0x2a')](_0x5e7d71[_0x55d9('0x41')][_0x55d9('0x2a')]);_0x5af30f[_0x55d9('0x29')]=qs['offset'](_0x5e7d71['query'][_0x55d9('0x29')]);}_0x5af30f[_0x55d9('0x48')]=qs[_0x55d9('0x49')](_0x5e7d71[_0x55d9('0x41')]['sort']);_0x5af30f[_0x55d9('0x4a')]=qs['filters'](_[_0x55d9('0x4b')](_0x5e7d71[_0x55d9('0x41')],_0x18ed20[_0x55d9('0x42')]));_0x5af30f[_0x55d9('0x4a')][_0x55d9('0x67')]=_0x3ef533['id'];if(_0x5e7d71['query']['filter']){_0x5af30f['where']=_[_0x55d9('0x4d')](_0x5af30f[_0x55d9('0x4a')],{'$or':_['map'](_0x5af30f[_0x55d9('0x44')],function(_0x3ba93e){var _0x17ee62={};_0x17ee62[_0x3ba93e]={'$like':'%'+_0x5e7d71[_0x55d9('0x41')][_0x55d9('0x4c')]+'%'};return _0x17ee62;})});}_0x5af30f=_[_0x55d9('0x4d')]({},_0x5af30f,_0x5e7d71[_0x55d9('0x4e')]);return db[_0x55d9('0x99')][_0x55d9('0x63')]({'where':_0x5af30f[_0x55d9('0x4a')]})[_0x55d9('0x1f')](function(_0x4ee1bb){_0x51f406[_0x55d9('0x63')]=_0x4ee1bb;if(_0x5e7d71[_0x55d9('0x41')][_0x55d9('0x4f')]){_0x5af30f[_0x55d9('0x50')]=[{'model':db[_0x55d9('0x93')],'as':'Contact','required':![]},{'model':db[_0x55d9('0xb5')],'as':_0x55d9('0xb6'),'attributes':[_0x55d9('0x36'),'fullname',_0x55d9('0xb7')],'required':![]},{'model':db[_0x55d9('0xb8')],'as':_0x55d9('0xb9'),'attributes':['id','name',_0x55d9('0xba')],'where':_0x5e7d71[_0x55d9('0x41')][_0x55d9('0xbb')]?{'id':_0x5e7d71[_0x55d9('0x41')][_0x55d9('0xbb')]}:undefined,'required':_0x5e7d71[_0x55d9('0x41')]['tag']?!![]:![]}];}return db[_0x55d9('0x99')][_0x55d9('0x51')](_0x5af30f);})[_0x55d9('0x1f')](function(_0x10a2ca){_0x51f406[_0x55d9('0x52')]=_0x10a2ca;return _0x51f406;});}})[_0x55d9('0x1f')](respondWithFilteredResult(_0xc26780,_0x5af30f))[_0x55d9('0x26')](handleError(_0xc26780,null));};exports[_0x55d9('0x37')]=function(_0x16f5ca,_0xbd8075,_0x3f991c){var _0x2fd957,_0x3fdfd3,_0x4554a9;if(_[_0x55d9('0x8e')](_0x16f5ca['body'][_0x55d9('0x5d')])||_0x16f5ca[_0x55d9('0x5d')][_0x55d9('0x5d')]===''){throw new db[(_0x55d9('0x72'))][(_0x55d9('0x73'))](_0x55d9('0x8d'));}if(_[_0x55d9('0x8e')](_0x16f5ca['body']['to'])){throw new db[(_0x55d9('0x72'))][(_0x55d9('0x73'))]('to\x20is\x20mandatory');}_0x2fd957=_0x16f5ca[_0x55d9('0x5d')]['to'];return db[_0x55d9('0x3b')][_0x55d9('0x56')]({'where':{'id':_0x16f5ca[_0x55d9('0x54')]['id']},'include':[{'model':db[_0x55d9('0x92')],'as':_0x55d9('0xbc'),'include':[{'model':db[_0x55d9('0x93')],'as':_0x55d9('0x94'),'where':{'mobile':_0x2fd957},'limit':0x1,'order':[[_0x55d9('0x77'),_0x55d9('0x95')]]}]}]})[_0x55d9('0x1f')](handleEntityNotFound(_0xbd8075,null))[_0x55d9('0x1f')](function(_0x33ce0f){if(_0x33ce0f&&_0x33ce0f['List']){_0x3fdfd3=_0x33ce0f[_0x55d9('0x33')]({'plain':!![]});if(_0x3fdfd3['List']&&_0x3fdfd3['List'][_0x55d9('0x94')][_0x55d9('0x46')]){return _0x3fdfd3[_0x55d9('0xbc')]['Contacts'][0x0];}return db[_0x55d9('0x93')][_0x55d9('0x57')](_[_0x55d9('0x18')](_0x16f5ca[_0x55d9('0x5d')],{'firstName':_0x2fd957,'mobile':_0x2fd957,'phone':_0x2fd957,'ListId':_0x3fdfd3[_0x55d9('0x79')]}));}})['then'](handleEntityNotFound(_0xbd8075,null))['then'](function(_0x541a87){if(_0x541a87){_0x4554a9=_0x541a87;return db[_0x55d9('0x99')][_0x55d9('0x56')]({'where':{'ContactId':_0x4554a9['id'],'closed':![],'SmsAccountId':_0x3fdfd3['id']}})['then'](function(_0x4c5510){if(_0x4c5510){return[_0x4c5510,![]];}return db['SmsInteraction'][_0x55d9('0x57')]({'UserId':_0x16f5ca['user']['id'],'ContactId':_0x4554a9['id'],'SmsAccountId':_0x3fdfd3['id'],'phone':_0x2fd957,'firstMsgDirection':_0x55d9('0xbd'),'Messages':[_[_0x55d9('0x4d')](_0x16f5ca['body'],{'read':![],'body':_0x16f5ca[_0x55d9('0x5d')][_0x55d9('0x5d')],'phone':_0x2fd957,'SmsAccountId':_0x3fdfd3['id'],'UserId':_0x16f5ca[_0x55d9('0xbe')]['id'],'ContactId':_0x4554a9['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x55d9('0xbf')}]})[_0x55d9('0x1f')](function(_0x290192){return[_0x290192,!![]];});});}})[_0x55d9('0x9a')](function(_0x5a2cb1,_0x31c81d){if(_0x31c81d){return _0x5a2cb1;}return db[_0x55d9('0xc0')][_0x55d9('0x57')](_[_0x55d9('0x4d')](_0x16f5ca['body'],{'read':![],'body':_0x16f5ca[_0x55d9('0x5d')][_0x55d9('0x5d')],'phone':_0x2fd957,'SmsAccountId':_0x3fdfd3['id'],'SmsInteractionId':_0x5a2cb1['id'],'UserId':_0x16f5ca['user']['id'],'ContactId':_0x4554a9['id']}))[_0x55d9('0x1f')](function(_0x462cc2){_0x5a2cb1['dataValues'][_0x55d9('0xbf')]=[];_0x5a2cb1['dataValues']['Messages']['push'](_0x462cc2['dataValues']);return _0x5a2cb1;});})['then'](respondWithResult(_0xbd8075,null))['catch'](handleError(_0xbd8075,null));};exports[_0x55d9('0x28')]=function(_0xed10c0,_0x46f900,_0x581911){if(_0xed10c0[_0x55d9('0x5d')]['id']){delete _0xed10c0[_0x55d9('0x5d')]['id'];}var _0x5ba227,_0x797ede,_0x3bb933;return db[_0x55d9('0x3b')][_0x55d9('0x56')]({'where':{'id':_0xed10c0[_0x55d9('0x54')]['id']}})[_0x55d9('0x1f')](handleEntityNotFound(_0x46f900,null))[_0x55d9('0x1f')](function(_0x309229){if(_0x309229){_0x3bb933=_0x309229;logger[_0x55d9('0x23')](_0x55d9('0xaa'),_0x55d9('0x28'),_0x55d9('0xc1'),_0x309229[_0x55d9('0x3e')],util[_0x55d9('0xc2')](_0xed10c0[_0x55d9('0x5d')],{'showHidden':![],'depth':null}));switch(_0x309229[_0x55d9('0x3e')]){case _0x55d9('0x7e'):if(_0xed10c0[_0x55d9('0x5d')][_0x55d9('0xc3')]&&_0xed10c0['body'][_0x55d9('0x28')]){_0x797ede=_0xed10c0[_0x55d9('0x5d')][_0x55d9('0x28')];return db[_0x55d9('0xc0')][_0x55d9('0x56')]({'where':{'messageId':_0xed10c0['body'][_0x55d9('0xc3')]}});}break;case _0x55d9('0x81'):if(_0xed10c0[_0x55d9('0x5d')][_0x55d9('0xc4')]&&_0xed10c0[_0x55d9('0x5d')]['statusInt']){_0x797ede=_0xed10c0[_0x55d9('0x5d')][_0x55d9('0xc5')];return db[_0x55d9('0xc0')][_0x55d9('0x56')]({'where':{'messageId':_0xed10c0[_0x55d9('0x5d')][_0x55d9('0xc4')]}});}break;case _0x55d9('0xc6'):if(_0xed10c0[_0x55d9('0x5d')][_0x55d9('0x83')]&&_0xed10c0[_0x55d9('0x5d')][_0x55d9('0xc7')]){_0x797ede=_0xed10c0[_0x55d9('0x5d')]['status_code'];return db['SmsMessage'][_0x55d9('0x56')]({'where':{'messageId':_0xed10c0[_0x55d9('0x5d')][_0x55d9('0x83')]}});}break;case _0x55d9('0x86'):var _0x2aa319=_0xed10c0[_0x55d9('0x5d')][_0x55d9('0x87')][0x0];if(_0x2aa319[_0x55d9('0x82')]&&_0x2aa319[_0x55d9('0x28')][_0x55d9('0xc8')]==='DELIVERED'){_0x797ede=_0x2aa319[_0x55d9('0x28')][_0x55d9('0xc8')];return db[_0x55d9('0xc0')][_0x55d9('0x56')]({'where':{'messageId':_0x2aa319[_0x55d9('0x82')]}});}break;case _0x55d9('0xc9'):if(_0xed10c0[_0x55d9('0x5d')][_0x55d9('0x82')]&&_0xed10c0[_0x55d9('0x5d')]['status']){_0x797ede=_0xed10c0[_0x55d9('0x5d')][_0x55d9('0x28')];return db[_0x55d9('0xc0')][_0x55d9('0x56')]({'where':{'messageId':_0xed10c0[_0x55d9('0x5d')]['messageId']}});}break;case'bandwidth':if(_0xed10c0[_0x55d9('0x5d')][0x0]['message']['id']){_0x797ede=_0xed10c0['body'][0x0][_0x55d9('0x3e')];return db[_0x55d9('0xc0')]['find']({'where':{'messageId':_0xed10c0[_0x55d9('0x5d')][0x0][_0x55d9('0x25')]['id']}});}break;case _0x55d9('0x8c'):if(_0xed10c0[_0x55d9('0x5d')][_0x55d9('0xca')]&&_0xed10c0[_0x55d9('0x5d')][_0x55d9('0x28')]){_0x797ede=_0xed10c0[_0x55d9('0x5d')]['status'];return db[_0x55d9('0xc0')][_0x55d9('0x56')]({'where':{'messageId':_0xed10c0[_0x55d9('0x5d')][_0x55d9('0xca')]}});}break;}}})[_0x55d9('0x1f')](handleEntityNotFound(_0x46f900,null))[_0x55d9('0x1f')](function(_0x187c9a){if(_0x187c9a){_0x5ba227=_0x187c9a;switch(_0x3bb933[_0x55d9('0x3e')]){case _0x55d9('0x7e'):if(_0x797ede===_0x55d9('0xcb')){return _0x5ba227[_0x55d9('0x31')]({'read':!![]});}else{logger[_0x55d9('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x55d9('0x28'),'skebby',util[_0x55d9('0xc2')](_0xed10c0[_0x55d9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x55d9('0x81'):if(_0x797ede==='1'){return _0x5ba227[_0x55d9('0x31')]({'read':!![]});}else{logger[_0x55d9('0x24')](_0x55d9('0xaa'),'status',_0x55d9('0x7e'),util['inspect'](_0xed10c0[_0x55d9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x55d9('0xc6'):if(!_0xed10c0[_0x55d9('0x5d')][_0x55d9('0xcc')]&&_0x797ede>=0xc8&&_0x797ede<=0xce){return _0x5ba227[_0x55d9('0x31')]({'read':!![]});}else{logger[_0x55d9('0x24')](_0x55d9('0xaa'),_0x55d9('0x28'),_0x55d9('0xc6'),util[_0x55d9('0xc2')](_0xed10c0[_0x55d9('0x5d')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5aa8b0=_0xed10c0[_0x55d9('0x5d')][_0x55d9('0x87')][0x0];if(_0x5aa8b0['status'][_0x55d9('0xc8')]==='DELIVERED'){return _0x5ba227[_0x55d9('0x31')]({'read':!![]});}else{logger['error'](_0x55d9('0xaa'),_0x55d9('0x28'),'infobip',util[_0x55d9('0xc2')](_0xed10c0[_0x55d9('0x5d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x797ede==_0x55d9('0xcd')||_0x797ede==_0x55d9('0xce')){return _0x5ba227[_0x55d9('0x31')]({'read':!![]});}else{logger[_0x55d9('0x24')](_0x55d9('0xaa'),_0x55d9('0x28'),'clickatell',util[_0x55d9('0xc2')](_0xed10c0[_0x55d9('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x797ede==_0x55d9('0xcf')){return _0x5ba227[_0x55d9('0x31')]({'read':!![]});}else{logger[_0x55d9('0x24')](_0x55d9('0xaa'),_0x55d9('0x28'),'bandwidth',util[_0x55d9('0xc2')](_0xed10c0['body'],{'showHidden':![],'depth':null}));}break;case _0x55d9('0x8c'):if(_0x797ede===_0x55d9('0xd0')||_0x797ede==='ACCEPTD'){return _0x5ba227[_0x55d9('0x31')]({'read':!![]});}else{logger['error'](_0x55d9('0xaa'),'status','intelepeer',util[_0x55d9('0xc2')](_0xed10c0['body'],{'showHidden':![],'depth':null}));}break;}return _0x5ba227;}})[_0x55d9('0x1f')](respondWithResult(_0x46f900,null))[_0x55d9('0x26')](handleError(_0x46f900,null));};exports['statusGet']=function(_0x14536c,_0x15ca86,_0x522233){var _0x471a8a,_0x168887,_0x532561;return db[_0x55d9('0x3b')][_0x55d9('0x56')]({'where':{'id':_0x14536c[_0x55d9('0x54')]['id']}})[_0x55d9('0x1f')](handleEntityNotFound(_0x15ca86,null))[_0x55d9('0x1f')](function(_0x3910b2){if(_0x3910b2){_0x532561=_0x3910b2;logger[_0x55d9('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x55d9('0x28'),_0x55d9('0xc1'),_0x3910b2[_0x55d9('0x3e')],util[_0x55d9('0xc2')](_0x14536c[_0x55d9('0x41')],{'showHidden':![],'depth':null}));switch(_0x3910b2[_0x55d9('0x3e')]){case _0x55d9('0x88'):if(_0x14536c['query'][_0x55d9('0xd1')]&&_0x14536c[_0x55d9('0x41')]['state']){_0x168887=_0x14536c[_0x55d9('0x41')][_0x55d9('0xd2')];return db[_0x55d9('0xc0')][_0x55d9('0x56')]({'where':{'messageId':_0x14536c[_0x55d9('0x41')][_0x55d9('0xd1')]}});}break;}}})[_0x55d9('0x1f')](handleEntityNotFound(_0x15ca86,null))[_0x55d9('0x1f')](function(_0x4b7a6b){if(_0x4b7a6b){_0x471a8a=_0x4b7a6b;switch(_0x532561[_0x55d9('0x3e')]){case _0x55d9('0x88'):if(_0x168887==='2'||_0x168887==='6'){return _0x471a8a['update']({'read':!![]});}else{logger[_0x55d9('0x24')](_0x55d9('0xaa'),'status',_0x55d9('0x88'),util[_0x55d9('0xc2')](_0x14536c[_0x55d9('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x471a8a;}})[_0x55d9('0x1f')](respondWithResult(_0x15ca86,null))[_0x55d9('0x26')](handleError(_0x15ca86,null));};exports['addAgents']=function(_0x14bf16,_0x45838d,_0x3f1d87){return db[_0x55d9('0x3b')][_0x55d9('0x56')]({'where':{'id':_0x14bf16[_0x55d9('0x54')]['id']}})['then'](handleEntityNotFound(_0x45838d,null))[_0x55d9('0x1f')](function(_0x21d622){if(_0x21d622){return _0x21d622['addAgents'](_0x14bf16[_0x55d9('0x5d')][_0x55d9('0x65')],_[_0x55d9('0x97')](_0x14bf16['body'],[_0x55d9('0x65'),'id'])||{})[_0x55d9('0x9a')](function(_0x3a1ad1){for(var _0x1b57c3=0x0;_0x1b57c3<_0x14bf16[_0x55d9('0x5d')][_0x55d9('0x65')][_0x55d9('0x46')];_0x1b57c3+=0x1){socket[_0x55d9('0xd3')](_0x55d9('0xd4'),{'UserId':_0x14bf16[_0x55d9('0x5d')][_0x55d9('0x65')][_0x1b57c3],'SmsAccountId':_0x14bf16[_0x55d9('0x54')]['id']});}return _0x3a1ad1;});}})[_0x55d9('0x1f')](respondWithResult(_0x45838d,null))[_0x55d9('0x26')](handleError(_0x45838d,null));};exports[_0x55d9('0xd5')]=function(_0x435048,_0x1bbbb2,_0x4caeba){return db[_0x55d9('0x3b')]['find']({'where':{'id':_0x435048[_0x55d9('0x54')]['id']}})['then'](handleEntityNotFound(_0x1bbbb2,null))[_0x55d9('0x1f')](function(_0x28ac41){if(_0x28ac41){return _0x28ac41[_0x55d9('0xd5')](_0x435048['query'][_0x55d9('0x65')])[_0x55d9('0x1f')](function(){if(_[_0x55d9('0xd6')](_0x435048[_0x55d9('0x41')][_0x55d9('0x65')])){for(var _0x4e0927=0x0;_0x4e0927<_0x435048[_0x55d9('0x41')][_0x55d9('0x65')][_0x55d9('0x46')];_0x4e0927+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x435048[_0x55d9('0x41')][_0x55d9('0x65')][_0x4e0927]),'SmsAccountId':Number(_0x435048[_0x55d9('0x54')]['id'])});}}else{socket[_0x55d9('0xd3')](_0x55d9('0xd7'),{'UserId':Number(_0x435048[_0x55d9('0x41')][_0x55d9('0x65')]),'SmsAccountId':Number(_0x435048[_0x55d9('0x54')]['id'])});}});}})[_0x55d9('0x1f')](respondWithStatusCode(_0x1bbbb2,null))[_0x55d9('0x26')](handleError(_0x1bbbb2,null));};exports['getAgents']=function(_0x3e5ef6,_0x3bb927,_0x8bbea2){var _0x26e31e={};var _0x4c5194={};var _0x2f71e9;var _0x2d8801;return db[_0x55d9('0x3b')]['findOne']({'where':{'id':_0x3e5ef6['params']['id']}})[_0x55d9('0x1f')](handleEntityNotFound(_0x3bb927,null))[_0x55d9('0x1f')](function(_0x4a06bf){if(_0x4a06bf){_0x2f71e9=_0x4a06bf;_0x4c5194[_0x55d9('0x40')]=_['keys'](db[_0x55d9('0xb5')][_0x55d9('0x3c')]);_0x4c5194['query']=_[_0x55d9('0x55')](_0x3e5ef6[_0x55d9('0x41')]);_0x4c5194[_0x55d9('0x42')]=_[_0x55d9('0x43')](_0x4c5194[_0x55d9('0x40')],_0x4c5194[_0x55d9('0x41')]);_0x26e31e['attributes']=_[_0x55d9('0x43')](_0x4c5194[_0x55d9('0x40')],qs[_0x55d9('0x45')](_0x3e5ef6[_0x55d9('0x41')]['fields']));_0x26e31e[_0x55d9('0x44')]=_0x26e31e[_0x55d9('0x44')][_0x55d9('0x46')]?_0x26e31e[_0x55d9('0x44')]:_0x4c5194[_0x55d9('0x40')];_0x26e31e[_0x55d9('0x48')]=qs['sort'](_0x3e5ef6[_0x55d9('0x41')][_0x55d9('0x49')]);_0x26e31e[_0x55d9('0x4a')]=qs['filters'](_[_0x55d9('0x4b')](_0x3e5ef6['query'],_0x4c5194[_0x55d9('0x42')]));if(_0x3e5ef6[_0x55d9('0x41')][_0x55d9('0x4c')]){_0x26e31e[_0x55d9('0x4a')]=_[_0x55d9('0x4d')](_0x26e31e['where'],{'$or':_[_0x55d9('0x3a')](_0x26e31e['attributes'],function(_0x1aad2a){var _0x1f974a={};_0x1f974a[_0x1aad2a]={'$like':'%'+_0x3e5ef6[_0x55d9('0x41')][_0x55d9('0x4c')]+'%'};return _0x1f974a;})});}_0x26e31e=_[_0x55d9('0x4d')]({},_0x26e31e,_0x3e5ef6[_0x55d9('0x4e')]);return _0x2f71e9[_0x55d9('0xd8')](_0x26e31e);}})['then'](function(_0x4500d4){if(_0x4500d4){_0x2d8801=_0x4500d4['length'];if(!_0x3e5ef6[_0x55d9('0x41')]['hasOwnProperty'](_0x55d9('0x62'))){_0x26e31e[_0x55d9('0x2a')]=qs[_0x55d9('0x2a')](_0x3e5ef6[_0x55d9('0x41')][_0x55d9('0x2a')]);_0x26e31e[_0x55d9('0x29')]=qs['offset'](_0x3e5ef6[_0x55d9('0x41')][_0x55d9('0x29')]);}return _0x2f71e9['getAgents'](_0x26e31e);}})[_0x55d9('0x1f')](function(_0x318f43){if(_0x318f43){return _0x318f43?{'count':_0x2d8801,'rows':_0x318f43}:null;}})['then'](respondWithResult(_0x3bb927,null))[_0x55d9('0x26')](handleError(_0x3bb927,null));}; \ No newline at end of file +var _0x837b=['querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','set','apply','reject','save','update','then','get','SmsAccounts','destroy','stack','name','send','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','offset','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','describe','addDisposition','SmsAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','twilio','from','From','Body','messageId','sender','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','push','close','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x837b,0xd5));var _0xb837=function(_0x5f2afa,_0x3d2cd2){_0x5f2afa=_0x5f2afa-0x0;var _0xc21b56=_0x837b[_0x5f2afa];return _0xc21b56;};'use strict';var pdf=require(_0xb837('0x0'));var emlformat=require(_0xb837('0x1'));var rimraf=require(_0xb837('0x2'));var zipdir=require(_0xb837('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb837('0x4'));var moment=require('moment');var BPromise=require(_0xb837('0x5'));var Mustache=require(_0xb837('0x6'));var util=require(_0xb837('0x7'));var path=require('path');var sox=require(_0xb837('0x8'));var csv=require(_0xb837('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb837('0xa'));var _=require(_0xb837('0xb'));var squel=require(_0xb837('0xc'));var crypto=require('crypto');var jsforce=require(_0xb837('0xd'));var deskjs=require(_0xb837('0xe'));var toCsv=require(_0xb837('0x9'));var querystring=require(_0xb837('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb837('0x10'));var as=require(_0xb837('0x11'));var hardwareService=require(_0xb837('0x12'));var logger=require('../../config/logger')(_0xb837('0x13'));var utils=require(_0xb837('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb837('0x15'));var db=require(_0xb837('0x16'))['db'];config[_0xb837('0x17')]=_[_0xb837('0x18')](config[_0xb837('0x17')],{'host':_0xb837('0x19'),'port':0x18eb});var socket=require(_0xb837('0x1a'))(new Redis(config['redis']));require(_0xb837('0x1b'))[_0xb837('0x1c')](socket);var jayson=require(_0xb837('0x1d'));var client=jayson['client'][_0xb837('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x159fdd,_0x30d4fc,_0x49a806,_0x1804c2){return new BPromise(function(_0x25dafc,_0x4103d2){var _0xf845b7=_0x1804c2||client;return _0xf845b7[_0xb837('0x1f')](_0x159fdd,_0x49a806)['then'](function(_0x33212e){logger[_0xb837('0x20')](_0xb837('0x21'),_0x30d4fc,_0xb837('0x22'));logger['debug'](_0xb837('0x23'),_0x30d4fc,_0xb837('0x22'),JSON[_0xb837('0x24')](_0x33212e));if(_0x33212e[_0xb837('0x25')]){if(_0x33212e[_0xb837('0x25')][_0xb837('0x26')]===0x1f4){logger[_0xb837('0x25')](_0xb837('0x21'),_0x30d4fc,_0x33212e[_0xb837('0x25')][_0xb837('0x27')]);return _0x4103d2(_0x33212e[_0xb837('0x25')][_0xb837('0x27')]);}logger[_0xb837('0x25')]('SmsAccount,\x20%s,\x20%s',_0x30d4fc,_0x33212e[_0xb837('0x25')][_0xb837('0x27')]);return _0x25dafc(_0x33212e[_0xb837('0x25')][_0xb837('0x27')]);}else{logger[_0xb837('0x20')](_0xb837('0x21'),_0x30d4fc,'request\x20sent');_0x25dafc(_0x33212e[_0xb837('0x28')][_0xb837('0x27')]);}})[_0xb837('0x29')](function(_0x1656ee){logger[_0xb837('0x25')](_0xb837('0x21'),_0x30d4fc,_0x1656ee);_0x4103d2(_0x1656ee);});});}function respondWithStatusCode(_0x1e49c7,_0x32edc6){_0x32edc6=_0x32edc6||0xcc;return function(_0x5e7182){if(_0x5e7182){return _0x1e49c7[_0xb837('0x2a')](_0x32edc6);}return _0x1e49c7['status'](_0x32edc6)[_0xb837('0x2b')]();};}function respondWithResult(_0x10e6f3,_0x90ad01){_0x90ad01=_0x90ad01||0xc8;return function(_0x580e3f){if(_0x580e3f){return _0x10e6f3[_0xb837('0x2c')](_0x90ad01)[_0xb837('0x2d')](_0x580e3f);}};}function respondWithFilteredResult(_0x31e7b5,_0x44a39b){return function(_0x5d94e5){if(_0x5d94e5){var _0x5d99ff=_0x5d94e5['count'],_0xf5f1bd=_0x44a39b['offset'],_0x5a538a=_0x44a39b['offset']+_0x44a39b['limit'],_0x3f8fc1;if(_0x5a538a>=_0x5d99ff){_0x5a538a=_0x5d99ff;_0x3f8fc1=0xc8;}else{_0x3f8fc1=0xce;}_0x31e7b5[_0xb837('0x2c')](_0x3f8fc1);return _0x31e7b5[_0xb837('0x2e')]('Content-Range',_0xf5f1bd+'-'+_0x5a538a+'/'+_0x5d99ff)[_0xb837('0x2d')](_0x5d94e5);}return null;};}function patchUpdates(_0x3d3cbf){return function(_0x4b0152){try{jsonpatch[_0xb837('0x2f')](_0x4b0152,_0x3d3cbf,!![]);}catch(_0x2e45fd){return BPromise[_0xb837('0x30')](_0x2e45fd);}return _0x4b0152[_0xb837('0x31')]();};}function saveUpdates(_0x3289b7,_0x17f109){return function(_0x540618){if(_0x540618){return _0x540618[_0xb837('0x32')](_0x3289b7)[_0xb837('0x33')](function(_0x4b150f){return _0x4b150f;});}return null;};}function removeEntity(_0x3b171f,_0x478b7b){return function(_0x147793){if(_0x147793){return _0x147793['destroy']()[_0xb837('0x33')](function(){var _0x52ced4=_0x147793[_0xb837('0x34')]({'plain':!![]});var _0x282516=_0xb837('0x35');return db['UserProfileResource'][_0xb837('0x36')]({'where':{'type':_0x282516,'resourceId':_0x52ced4['id']}})['then'](function(){return _0x147793;});})[_0xb837('0x33')](function(){_0x3b171f[_0xb837('0x2c')](0xcc)[_0xb837('0x2b')]();});}};}function handleEntityNotFound(_0x3f7be3,_0x491cdf){return function(_0x3ab7f2){if(!_0x3ab7f2){_0x3f7be3[_0xb837('0x2a')](0x194);}return _0x3ab7f2;};}function handleError(_0x8e5ceb,_0x4374b0){_0x4374b0=_0x4374b0||0x1f4;return function(_0x57625e){logger[_0xb837('0x25')](_0x57625e[_0xb837('0x37')]);if(_0x57625e[_0xb837('0x38')]){delete _0x57625e[_0xb837('0x38')];}_0x8e5ceb[_0xb837('0x2c')](_0x4374b0)[_0xb837('0x39')](_0x57625e);};}exports['index']=function(_0x485686,_0x2cc36e){var _0x5afb68={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5c22c8={},_0x3c6f70={'count':0x0,'rows':[]};var _0x3ea807=_[_0xb837('0x3a')](db[_0xb837('0x3b')][_0xb837('0x3c')],function(_0xccaebc){return{'name':_0xccaebc[_0xb837('0x3d')],'type':_0xccaebc[_0xb837('0x3e')][_0xb837('0x3f')]};});_0x5c22c8[_0xb837('0x40')]=_[_0xb837('0x3a')](_0x3ea807,'name');_0x5c22c8[_0xb837('0x41')]=_[_0xb837('0x42')](_0x485686['query']);_0x5c22c8['filters']=_[_0xb837('0x43')](_0x5c22c8[_0xb837('0x40')],_0x5c22c8[_0xb837('0x41')]);_0x5afb68[_0xb837('0x44')]=_[_0xb837('0x43')](_0x5c22c8[_0xb837('0x40')],qs[_0xb837('0x45')](_0x485686[_0xb837('0x41')]['fields']));_0x5afb68[_0xb837('0x44')]=_0x5afb68[_0xb837('0x44')][_0xb837('0x46')]?_0x5afb68[_0xb837('0x44')]:_0x5c22c8[_0xb837('0x40')];if(!_0x485686[_0xb837('0x41')]['hasOwnProperty'](_0xb837('0x47'))){_0x5afb68[_0xb837('0x48')]=qs[_0xb837('0x48')](_0x485686['query'][_0xb837('0x48')]);_0x5afb68[_0xb837('0x49')]=qs[_0xb837('0x49')](_0x485686[_0xb837('0x41')][_0xb837('0x49')]);}_0x5afb68['order']=qs[_0xb837('0x4a')](_0x485686[_0xb837('0x41')]['sort']);_0x5afb68[_0xb837('0x4b')]=qs[_0xb837('0x4c')](_[_0xb837('0x4d')](_0x485686[_0xb837('0x41')],_0x5c22c8[_0xb837('0x4c')]),_0x3ea807);if(_0x485686[_0xb837('0x41')]['filter']){_0x5afb68['where']=_['merge'](_0x5afb68[_0xb837('0x4b')],{'$or':_[_0xb837('0x3a')](_0x3ea807,function(_0x591717){if(_0x591717['type']!==_0xb837('0x4e')){var _0x1dba8a={};_0x1dba8a[_0x591717[_0xb837('0x38')]]={'$like':'%'+_0x485686[_0xb837('0x41')][_0xb837('0x4f')]+'%'};return _0x1dba8a;}})});}_0x5afb68=_[_0xb837('0x50')]({},_0x5afb68,_0x485686[_0xb837('0x51')]);var _0x255e46={'where':_0x5afb68[_0xb837('0x4b')]};return db[_0xb837('0x3b')][_0xb837('0x52')](_0x255e46)[_0xb837('0x33')](function(_0x514fb7){_0x3c6f70['count']=_0x514fb7;if(_0x485686[_0xb837('0x41')][_0xb837('0x53')]){_0x5afb68[_0xb837('0x54')]=[{'all':!![]}];}return db[_0xb837('0x3b')][_0xb837('0x55')](_0x5afb68);})[_0xb837('0x33')](function(_0x613eef){_0x3c6f70[_0xb837('0x56')]=_0x613eef;return _0x3c6f70;})[_0xb837('0x33')](respondWithFilteredResult(_0x2cc36e,_0x5afb68))[_0xb837('0x29')](handleError(_0x2cc36e,null));};exports[_0xb837('0x57')]=function(_0x5b5a96,_0x4e5517){var _0x37cc0e={'raw':![],'where':{'id':_0x5b5a96[_0xb837('0x58')]['id']},'include':[{'model':db[_0xb837('0x59')],'as':_0xb837('0x5a')}]},_0xbdadc9={};_0xbdadc9[_0xb837('0x40')]=_[_0xb837('0x42')](db[_0xb837('0x3b')][_0xb837('0x3c')]);_0xbdadc9[_0xb837('0x41')]=_['keys'](_0x5b5a96[_0xb837('0x41')]);_0xbdadc9[_0xb837('0x4c')]=_[_0xb837('0x43')](_0xbdadc9['model'],_0xbdadc9['query']);_0x37cc0e[_0xb837('0x44')]=_[_0xb837('0x43')](_0xbdadc9['model'],qs['fields'](_0x5b5a96['query'][_0xb837('0x45')]));_0x37cc0e[_0xb837('0x44')]=_0x37cc0e[_0xb837('0x44')][_0xb837('0x46')]?_0x37cc0e['attributes']:_0xbdadc9[_0xb837('0x40')];if(_0x5b5a96[_0xb837('0x41')][_0xb837('0x53')]){_0x37cc0e[_0xb837('0x54')]=[{'all':!![]}];}_0x37cc0e=_[_0xb837('0x50')]({},_0x37cc0e,_0x5b5a96[_0xb837('0x51')]);return db['SmsAccount'][_0xb837('0x5b')](_0x37cc0e)[_0xb837('0x33')](handleEntityNotFound(_0x4e5517,null))[_0xb837('0x33')](respondWithResult(_0x4e5517,null))[_0xb837('0x29')](handleError(_0x4e5517,null));};exports['create']=function(_0x13dd7f,_0xe6acca){return db[_0xb837('0x3b')][_0xb837('0x5c')](_0x13dd7f[_0xb837('0x5d')],{})[_0xb837('0x33')](function(_0x40a196){var _0x147fad=_0x13dd7f['user'][_0xb837('0x34')]({'plain':!![]});if(!_0x147fad)throw new Error(_0xb837('0x5e'));if(_0x147fad[_0xb837('0x5f')]===_0xb837('0x60')){var _0x3dd661=_0x40a196[_0xb837('0x34')]({'plain':!![]});var _0x4546aa=_0xb837('0x35');return db[_0xb837('0x61')]['find']({'where':{'name':_0x4546aa,'userProfileId':_0x147fad[_0xb837('0x62')]},'raw':!![]})[_0xb837('0x33')](function(_0x8564c5){if(_0x8564c5&&_0x8564c5['autoAssociation']===0x0){return db[_0xb837('0x63')][_0xb837('0x5c')]({'name':_0x3dd661[_0xb837('0x38')],'resourceId':_0x3dd661['id'],'type':_0x8564c5[_0xb837('0x38')],'sectionId':_0x8564c5['id']},{})[_0xb837('0x33')](function(){return _0x40a196;});}else{return _0x40a196;}})[_0xb837('0x29')](function(_0x277b06){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x277b06);throw _0x277b06;});}return _0x40a196;})[_0xb837('0x33')](respondWithResult(_0xe6acca,0xc9))[_0xb837('0x29')](handleError(_0xe6acca,null));};exports['update']=function(_0x485fa0,_0x486ced){if(_0x485fa0[_0xb837('0x5d')]['id']){delete _0x485fa0[_0xb837('0x5d')]['id'];}return db[_0xb837('0x3b')][_0xb837('0x5b')]({'where':{'id':_0x485fa0[_0xb837('0x58')]['id']},'include':[{'model':db[_0xb837('0x59')],'as':'mandatoryDispositionPause'}]})[_0xb837('0x33')](handleEntityNotFound(_0x486ced,null))['then'](saveUpdates(_0x485fa0[_0xb837('0x5d')],null))[_0xb837('0x33')](respondWithResult(_0x486ced,null))['catch'](handleError(_0x486ced,null));};exports[_0xb837('0x36')]=function(_0x48b8c5,_0x369a98){return db['SmsAccount'][_0xb837('0x5b')]({'where':{'id':_0x48b8c5[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x369a98,null))[_0xb837('0x33')](removeEntity(_0x369a98,null))[_0xb837('0x29')](handleError(_0x369a98,null));};exports['describe']=function(_0x388fea,_0x57860d){return db[_0xb837('0x3b')][_0xb837('0x64')]()['then'](respondWithResult(_0x57860d,null))[_0xb837('0x29')](handleError(_0x57860d,null));};exports[_0xb837('0x65')]=function(_0x270f06,_0x2f10f8,_0x4a0495){if(_0x270f06[_0xb837('0x5d')]['id']){delete _0x270f06[_0xb837('0x5d')]['id'];}return db[_0xb837('0x3b')][_0xb837('0x5b')]({'where':{'id':_0x270f06[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x2f10f8,null))[_0xb837('0x33')](function(_0xeb49b6){if(_0xeb49b6){_0x270f06[_0xb837('0x5d')][_0xb837('0x66')]=_0xeb49b6['id'];return db[_0xb837('0x67')][_0xb837('0x5c')](_0x270f06[_0xb837('0x5d')]);}})['then'](respondWithResult(_0x2f10f8,null))[_0xb837('0x29')](handleError(_0x2f10f8,null));};exports[_0xb837('0x68')]=function(_0xb1823,_0x1f8816,_0x5a2d93){var _0x1fd503={'raw':![],'where':{}};var _0x3548ea={};var _0x35e4bd={'count':0x0,'rows':[]};return db[_0xb837('0x3b')]['findOne']({'where':{'id':_0xb1823[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x1f8816,null))[_0xb837('0x33')](function(_0x40d2a9){if(_0x40d2a9){_0x3548ea[_0xb837('0x40')]=_[_0xb837('0x42')](db['Disposition'][_0xb837('0x3c')]);_0x3548ea['query']=_[_0xb837('0x42')](_0xb1823['query']);_0x3548ea[_0xb837('0x4c')]=_[_0xb837('0x43')](_0x3548ea['model'],_0x3548ea['query']);_0x1fd503[_0xb837('0x44')]=_[_0xb837('0x43')](_0x3548ea[_0xb837('0x40')],qs[_0xb837('0x45')](_0xb1823[_0xb837('0x41')][_0xb837('0x45')]));_0x1fd503['attributes']=_0x1fd503[_0xb837('0x44')][_0xb837('0x46')]?_0x1fd503[_0xb837('0x44')]:_0x3548ea[_0xb837('0x40')];if(!_0xb1823[_0xb837('0x41')]['hasOwnProperty'](_0xb837('0x47'))){_0x1fd503[_0xb837('0x48')]=qs[_0xb837('0x48')](_0xb1823['query']['limit']);_0x1fd503[_0xb837('0x49')]=qs[_0xb837('0x49')](_0xb1823[_0xb837('0x41')]['offset']);}_0x1fd503[_0xb837('0x69')]=qs[_0xb837('0x4a')](_0xb1823[_0xb837('0x41')]['sort']);_0x1fd503[_0xb837('0x4b')]=qs['filters'](_[_0xb837('0x4d')](_0xb1823['query'],_0x3548ea[_0xb837('0x4c')]));_0x1fd503[_0xb837('0x4b')][_0xb837('0x66')]=_0x40d2a9['id'];if(_0xb1823['query'][_0xb837('0x4f')]){_0x1fd503[_0xb837('0x4b')]=_['merge'](_0x1fd503[_0xb837('0x4b')],{'$or':_[_0xb837('0x3a')](_0x1fd503[_0xb837('0x44')],function(_0xddd158){var _0x4e1af6={};_0x4e1af6[_0xddd158]={'$like':'%'+_0xb1823[_0xb837('0x41')][_0xb837('0x4f')]+'%'};return _0x4e1af6;})});}_0x1fd503=_[_0xb837('0x50')]({},_0x1fd503,_0xb1823[_0xb837('0x51')]);return db[_0xb837('0x67')][_0xb837('0x52')]({'where':_0x1fd503[_0xb837('0x4b')]})[_0xb837('0x33')](function(_0x4f2192){_0x35e4bd['count']=_0x4f2192;if(_0xb1823[_0xb837('0x41')][_0xb837('0x53')]){_0x1fd503[_0xb837('0x54')]=[{'all':!![]}];}return db[_0xb837('0x67')][_0xb837('0x55')](_0x1fd503);})['then'](function(_0x26f070){_0x35e4bd[_0xb837('0x56')]=_0x26f070;return _0x35e4bd;});}})[_0xb837('0x33')](respondWithFilteredResult(_0x1f8816,_0x1fd503))['catch'](handleError(_0x1f8816,null));};exports[_0xb837('0x6a')]=function(_0x2e5fdb,_0x5dbeb6,_0x4993c1){return db['SmsAccount'][_0xb837('0x5b')]({'where':{'id':_0x2e5fdb[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x5dbeb6,null))[_0xb837('0x33')](function(_0x256199){if(_0x256199){return _0x256199[_0xb837('0x6a')](_0x2e5fdb[_0xb837('0x41')][_0xb837('0x6b')]);}})[_0xb837('0x33')](respondWithStatusCode(_0x5dbeb6,null))[_0xb837('0x29')](handleError(_0x5dbeb6,null));};exports[_0xb837('0x6c')]=function(_0x4f25d1,_0x465ef6,_0x336163){if(_0x4f25d1[_0xb837('0x5d')]['id']){delete _0x4f25d1[_0xb837('0x5d')]['id'];}return db[_0xb837('0x3b')]['find']({'where':{'id':_0x4f25d1[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x465ef6,null))[_0xb837('0x33')](function(_0x478f02){if(_0x478f02){_0x4f25d1['body']['SmsAccountId']=_0x478f02['id'];return db[_0xb837('0x6d')][_0xb837('0x5c')](_0x4f25d1['body']);}})['then'](respondWithResult(_0x465ef6,null))['catch'](handleError(_0x465ef6,null));};exports[_0xb837('0x6e')]=function(_0x58ee1d,_0x47cae1,_0x122a22){var _0xc9e961={'raw':![],'where':{}};var _0x10f145={};var _0x324950={'count':0x0,'rows':[]};return db['SmsAccount'][_0xb837('0x6f')]({'where':{'id':_0x58ee1d['params']['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x47cae1,null))[_0xb837('0x33')](function(_0x258a57){if(_0x258a57){_0x10f145[_0xb837('0x40')]=_[_0xb837('0x42')](db[_0xb837('0x6d')][_0xb837('0x3c')]);_0x10f145[_0xb837('0x41')]=_['keys'](_0x58ee1d[_0xb837('0x41')]);_0x10f145[_0xb837('0x4c')]=_['intersection'](_0x10f145[_0xb837('0x40')],_0x10f145[_0xb837('0x41')]);_0xc9e961[_0xb837('0x44')]=_[_0xb837('0x43')](_0x10f145['model'],qs['fields'](_0x58ee1d[_0xb837('0x41')][_0xb837('0x45')]));_0xc9e961['attributes']=_0xc9e961[_0xb837('0x44')]['length']?_0xc9e961[_0xb837('0x44')]:_0x10f145[_0xb837('0x40')];if(!_0x58ee1d['query'][_0xb837('0x70')](_0xb837('0x47'))){_0xc9e961[_0xb837('0x48')]=qs['limit'](_0x58ee1d['query'][_0xb837('0x48')]);_0xc9e961[_0xb837('0x49')]=qs[_0xb837('0x49')](_0x58ee1d['query'][_0xb837('0x49')]);}_0xc9e961[_0xb837('0x69')]=qs['sort'](_0x58ee1d[_0xb837('0x41')]['sort']);_0xc9e961['where']=qs[_0xb837('0x4c')](_[_0xb837('0x4d')](_0x58ee1d[_0xb837('0x41')],_0x10f145[_0xb837('0x4c')]));_0xc9e961[_0xb837('0x4b')][_0xb837('0x66')]=_0x258a57['id'];if(_0x58ee1d[_0xb837('0x41')][_0xb837('0x4f')]){_0xc9e961[_0xb837('0x4b')]=_['merge'](_0xc9e961[_0xb837('0x4b')],{'$or':_[_0xb837('0x3a')](_0xc9e961['attributes'],function(_0x32cb1a){var _0x18238a={};_0x18238a[_0x32cb1a]={'$like':'%'+_0x58ee1d[_0xb837('0x41')][_0xb837('0x4f')]+'%'};return _0x18238a;})});}_0xc9e961=_[_0xb837('0x50')]({},_0xc9e961,_0x58ee1d['options']);return db[_0xb837('0x6d')][_0xb837('0x52')]({'where':_0xc9e961['where']})['then'](function(_0x2f2615){_0x324950['count']=_0x2f2615;if(_0x58ee1d[_0xb837('0x41')]['includeAll']){_0xc9e961[_0xb837('0x54')]=[{'all':!![]}];}return db[_0xb837('0x6d')][_0xb837('0x55')](_0xc9e961);})[_0xb837('0x33')](function(_0x3d9825){_0x324950[_0xb837('0x56')]=_0x3d9825;return _0x324950;});}})[_0xb837('0x33')](respondWithFilteredResult(_0x47cae1,_0xc9e961))['catch'](handleError(_0x47cae1,null));};exports[_0xb837('0x71')]=function(_0xa5a120,_0x5e7a1b,_0x18905e){return db[_0xb837('0x3b')]['find']({'where':{'id':_0xa5a120[_0xb837('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e7a1b,null))['then'](function(_0x1f616e){if(_0x1f616e){return _0x1f616e['removeAnswers'](_0xa5a120[_0xb837('0x41')][_0xb837('0x6b')]);}})['then'](respondWithStatusCode(_0x5e7a1b,null))[_0xb837('0x29')](handleError(_0x5e7a1b,null));};exports[_0xb837('0x72')]=function(_0x55b140,_0x14d9e4,_0xfadc71){var _0x53a695={'channel':_0xb837('0x73')};var _0x475da6=[];var _0xd4b934=[];var _0x2581d3={};return db[_0xb837('0x3b')]['find']({'where':{'id':_0x55b140['params']['id']},'include':[{'model':db[_0xb837('0x74')],'as':'Applications'}]})[_0xb837('0x33')](handleEntityNotFound(_0x14d9e4,null))[_0xb837('0x33')](function(_0x13ee34){_0x53a695['account']=_0x13ee34;_0x53a695[_0xb837('0x75')]=_[_0xb837('0x76')](_0x13ee34[_0xb837('0x77')],[_0xb837('0x78')],[_0xb837('0x79')]);if(_0x53a695[_0xb837('0x7a')][_0xb837('0x77')]){delete _0x53a695[_0xb837('0x7a')]['Applications'];}return db[_0xb837('0x7b')][_0xb837('0x64')]();})['then'](function(_0x80e4d){if(!_0x80e4d){throw new db[(_0xb837('0x7c'))][(_0xb837('0x7d'))](_0xb837('0x7e'));}_0x475da6=_['difference'](_['keys'](_0x80e4d),[_0xb837('0x7f'),'updatedAt']);_0xd4b934=_[_0xb837('0x80')](_[_0xb837('0x42')](_0x80e4d),['createdAt',_0xb837('0x81'),_0xb837('0x82'),'ListId']);_0x53a695[_0xb837('0x5d')]={'mapKey':'mobile'};if(_0x53a695[_0xb837('0x7a')]['type']){switch(_0x53a695[_0xb837('0x7a')]['type']){case _0xb837('0x83'):_0x53a695[_0xb837('0x5d')][_0xb837('0x84')]=_0x55b140['body'][_0xb837('0x85')];_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]=_0x55b140[_0xb837('0x5d')][_0xb837('0x86')];_0x53a695[_0xb837('0x5d')][_0xb837('0x87')]=_0x55b140[_0xb837('0x5d')]['MessageSid'];break;case'skebby':_0x53a695['body']['from']='+'+_0x55b140[_0xb837('0x5d')][_0xb837('0x88')];_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]=_0x55b140['body'][_0xb837('0x89')];break;case _0xb837('0x8a'):_0x53a695[_0xb837('0x5d')][_0xb837('0x84')]=_0x55b140[_0xb837('0x5d')][_0xb837('0x84')];_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]=_0x55b140[_0xb837('0x5d')][_0xb837('0x27')];break;case _0xb837('0x8b'):_0x53a695[_0xb837('0x5d')]['from']=_0x55b140['body'][_0xb837('0x84')];_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]=_0x55b140[_0xb837('0x5d')]['body'];_0x53a695[_0xb837('0x5d')]['messageId']=_0x55b140[_0xb837('0x5d')]['message_id'];break;case _0xb837('0x8c'):_0x53a695[_0xb837('0x5d')][_0xb837('0x84')]=_0x55b140[_0xb837('0x5d')][_0xb837('0x85')];_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]=_0x55b140['body'][_0xb837('0x8d')];_0x53a695['body'][_0xb837('0x87')]=_0x55b140['body'][_0xb837('0x8e')];break;case _0xb837('0x8f'):_0x53a695[_0xb837('0x5d')][_0xb837('0x84')]='+'+_0x55b140[_0xb837('0x5d')][_0xb837('0x90')][0x0][_0xb837('0x84')];_0x53a695[_0xb837('0x5d')]['body']=_0x55b140['body'][_0xb837('0x90')][0x0]['text'];_0x53a695[_0xb837('0x5d')][_0xb837('0x87')]=_0x55b140['body'][_0xb837('0x90')][0x0][_0xb837('0x87')];break;case _0xb837('0x91'):_0x53a695[_0xb837('0x5d')]['from']=_0x55b140[_0xb837('0x5d')][_0xb837('0x92')];_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]=_0x55b140[_0xb837('0x5d')][_0xb837('0x93')][_0xb837('0x27')];break;case _0xb837('0x94'):_0x53a695[_0xb837('0x5d')][_0xb837('0x84')]=_0x55b140[_0xb837('0x5d')][_0xb837('0x95')];_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]=_0x55b140[_0xb837('0x5d')]['text'];_0x53a695[_0xb837('0x5d')][_0xb837('0x87')]=_0x55b140['body'][_0xb837('0x96')];break;case _0xb837('0x97'):_0x53a695['body'][_0xb837('0x87')]=_0x55b140['body'][0x0][_0xb837('0x27')]['id'];_0x53a695['body'][_0xb837('0x84')]=_0x55b140[_0xb837('0x5d')][0x0]['message'][_0xb837('0x84')];_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]=_0x55b140[_0xb837('0x5d')][0x0][_0xb837('0x27')]['text'];break;case _0xb837('0x98'):_0x53a695[_0xb837('0x5d')][_0xb837('0x84')]=_0x55b140[_0xb837('0x5d')][_0xb837('0x84')];_0x53a695[_0xb837('0x5d')]['body']=_0x55b140[_0xb837('0x5d')][_0xb837('0x27')];_0x53a695['body'][_0xb837('0x87')]=_0x55b140[_0xb837('0x5d')]['refid'];break;}}if(_0x53a695[_0xb837('0x5d')]['id']){delete _0x53a695[_0xb837('0x5d')]['id'];}if(_['isNil'](_0x53a695[_0xb837('0x5d')][_0xb837('0x84')])){throw new db[(_0xb837('0x7c'))][(_0xb837('0x7d'))](_0xb837('0x99'));}if(_[_0xb837('0x9a')](_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')])||_0x53a695[_0xb837('0x5d')][_0xb837('0x5d')]===''){throw new db[(_0xb837('0x7c'))][(_0xb837('0x7d'))](_0xb837('0x9b'));}if(_[_0xb837('0x9a')](_0x53a695[_0xb837('0x5d')][_0xb837('0x9c')])){throw new db[(_0xb837('0x7c'))][(_0xb837('0x7d'))](_0xb837('0x9d')+_0xd4b934);}if(!_[_0xb837('0x9e')](_0xd4b934,_0x53a695[_0xb837('0x5d')]['mapKey'])){throw new db[(_0xb837('0x7c'))][(_0xb837('0x7d'))](_0xb837('0x9f')+_0xd4b934);}_0x2581d3[_0x53a695['body'][_0xb837('0x9c')]]=_0x53a695[_0xb837('0x5d')][_0xb837('0x84')];return db['CmList'][_0xb837('0x5b')]({'where':{'id':_0x53a695[_0xb837('0x7a')][_0xb837('0xa0')]},'include':[{'model':db[_0xb837('0x7b')],'as':_0xb837('0xa1'),'where':_0x2581d3,'limit':0x1,'order':[['updatedAt',_0xb837('0xa2')]]}]});})[_0xb837('0x33')](handleEntityNotFound(_0x14d9e4,null))[_0xb837('0x33')](function(_0x51e740){if(_0x51e740){_0x53a695[_0xb837('0xa3')]=_[_0xb837('0xa4')](_0x51e740,[_0xb837('0xa1')]);if(_0x51e740[_0xb837('0xa1')][_0xb837('0x46')]){return _0x51e740[_0xb837('0xa1')][0x0];}var _0x4424dc=_['defaults'](_0x53a695['body'],{'firstName':_0x53a695[_0xb837('0x5d')]['from'],'ListId':_0x51e740['id']});_0x4424dc[_0x53a695[_0xb837('0x5d')][_0xb837('0x9c')]]=_0x53a695[_0xb837('0x5d')][_0xb837('0x84')];return db[_0xb837('0x7b')][_0xb837('0x5c')](_0x4424dc,{'fields':_0x475da6,'raw':!![]});}})[_0xb837('0x33')](handleEntityNotFound(_0x14d9e4,null))[_0xb837('0x33')](function(_0x1afb0e){if(_0x1afb0e){_0x53a695[_0xb837('0xa5')]=_0x1afb0e;var _0x1e1fd6={'ContactId':_0x1afb0e['id'],'phone':_0x53a695[_0xb837('0x5d')][_0xb837('0x84')],'SmsAccountId':_0x55b140[_0xb837('0x58')]['id']};var _0x50092c={'ContactId':_0x1afb0e['id'],'SmsAccountId':_0x55b140[_0xb837('0x58')]['id'],'closed':![]};return db[_0xb837('0xa6')]['find']({'where':_0x50092c})[_0xb837('0x33')](function(_0x593765){if(_0x593765){return[_0x593765,![]];}return db['SmsInteraction']['create'](_0x1e1fd6)[_0xb837('0x33')](function(_0x44993c){return[_0x44993c,!![]];});});}})[_0xb837('0xa7')](function(_0x127a23,_0x3e7d58){_0x53a695[_0xb837('0xa8')]=_0x127a23[_0xb837('0x34')]({'plain':!![]});_0x53a695[_0xb837('0xa8')][_0xb837('0xa9')]=![];if(_0x3e7d58){if(_0x53a695[_0xb837('0x7a')]['autoclose']){_0x53a695[_0xb837('0x75')][_0xb837('0xaa')]({'id':0x0,'priority':_0x53a695[_0xb837('0x75')][_0xb837('0x46')]+0x1,'app':_0xb837('0xab'),'appdata':'unmanaged','interval':_0xb837('0xac')});}_0x53a695['interaction']['created']=!![];}return db[_0xb837('0xad')]['create']({'phone':_0x53a695[_0xb837('0x5d')][_0xb837('0x84')],'messageId':_0x53a695['body']['messageId'],'body':_0x53a695[_0xb837('0x5d')]['body'],'SmsAccountId':_0x55b140['params']['id'],'SmsInteractionId':_0x127a23['id'],'direction':'in','ContactId':_0x127a23['ContactId'],'AttachmentId':_0x53a695[_0xb837('0x5d')][_0xb837('0xae')]});})[_0xb837('0x33')](function(_0xd32e30){_0x53a695[_0xb837('0x27')]=_0xd32e30;if(_0x53a695[_0xb837('0xa8')][_0xb837('0xaf')]){return db[_0xb837('0xb0')]['find']({'attributes':['id',_0xb837('0x38')],'where':{'id':_0x53a695[_0xb837('0xa8')]['UserId']}})[_0xb837('0x33')](function(_0x7f21ec){if(_0x7f21ec){_0x53a695['applications'][_0xb837('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x7f21ec[_0xb837('0x38')]+','+(_0x53a695['account'][_0xb837('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb837('0xb3'),_0xb837('0xb4'),_0x53a695);});}return respondWithRpcPromise('Start','startRouting',_0x53a695);})[_0xb837('0x33')](function(_0x11bbac){if(_0x11bbac){var _0x322663=0xc8;var _0x50d8c9='receiveMessage';logger['info'](_0xb837('0x23'),_0x50d8c9,_0x322663,_0xb837('0xb5'));logger[_0xb837('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x50d8c9,_0x322663,_0xb837('0xb5'),JSON[_0xb837('0x24')](_0x11bbac));if(_0x53a695[_0xb837('0x7a')]['type']===_0xb837('0x83')){return _0x14d9e4[_0xb837('0x2c')](_0x322663)['set'](_0xb837('0xb7'),_0xb837('0xb8'))[_0xb837('0x39')](_0xb837('0xb9'));}else{return _0x14d9e4[_0xb837('0x2c')](_0x322663)[_0xb837('0x2d')](_0x11bbac);}}})[_0xb837('0x29')](handleError(_0x14d9e4,null));};exports[_0xb837('0xba')]=function(_0x5a8e69,_0x3bb007,_0x4d8c25){return db[_0xb837('0x3b')][_0xb837('0x6f')]({'where':{'id':_0x5a8e69[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x3bb007,null))['then'](function(_0x506857){if(_0x506857){return db[_0xb837('0xbb')][_0xb837('0xbc')](function(_0x166989){return db[_0xb837('0x74')]['destroy']({'where':{'SmsAccountId':_0x5a8e69[_0xb837('0x58')]['id']},'transaction':_0x166989})['then'](function(_0x26f9b0){var _0x1fe1a2=_[_0xb837('0x3a')](_0x5a8e69[_0xb837('0x5d')],function(_0x12bebd){_0x12bebd[_0xb837('0x66')]=_0x5a8e69[_0xb837('0x58')]['id'];return _0x12bebd;});return db['SmsApplication']['bulkCreate'](_0x1fe1a2,{'transaction':_0x166989});});})[_0xb837('0x33')](function(){return db['SmsApplication'][_0xb837('0xbd')]({'where':{'SmsAccountId':_0x5a8e69[_0xb837('0x58')]['id']},'order':_0xb837('0x78')});});}})[_0xb837('0x33')](respondWithResult(_0x3bb007,null))['catch'](handleError(_0x3bb007,null));};exports[_0xb837('0xbe')]=function(_0xc3f5fd,_0x38d4fe,_0x1d54ee){var _0x412cdb={};var _0x56ec5a={};var _0x58e35d;var _0x4f333f;return db[_0xb837('0x3b')][_0xb837('0x6f')]({'where':{'id':_0xc3f5fd['params']['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x38d4fe,null))['then'](function(_0x7a6324){if(_0x7a6324){_0x58e35d=_0x7a6324;_0x56ec5a[_0xb837('0x40')]=_[_0xb837('0x42')](db[_0xb837('0x74')][_0xb837('0x3c')]);_0x56ec5a[_0xb837('0x41')]=_[_0xb837('0x42')](_0xc3f5fd[_0xb837('0x41')]);_0x56ec5a['filters']=_[_0xb837('0x43')](_0x56ec5a[_0xb837('0x40')],_0x56ec5a[_0xb837('0x41')]);_0x412cdb[_0xb837('0x44')]=_[_0xb837('0x43')](_0x56ec5a[_0xb837('0x40')],qs['fields'](_0xc3f5fd[_0xb837('0x41')]['fields']));_0x412cdb[_0xb837('0x44')]=_0x412cdb[_0xb837('0x44')][_0xb837('0x46')]?_0x412cdb[_0xb837('0x44')]:_0x56ec5a[_0xb837('0x40')];_0x412cdb[_0xb837('0x69')]=qs[_0xb837('0x4a')](_0xc3f5fd[_0xb837('0x41')][_0xb837('0x4a')]);_0x412cdb[_0xb837('0x4b')]=qs[_0xb837('0x4c')](_[_0xb837('0x4d')](_0xc3f5fd[_0xb837('0x41')],_0x56ec5a['filters']));if(_0xc3f5fd[_0xb837('0x41')][_0xb837('0x4f')]){_0x412cdb[_0xb837('0x4b')]=_['merge'](_0x412cdb[_0xb837('0x4b')],{'$or':_[_0xb837('0x3a')](_0x412cdb['attributes'],function(_0x58c666){var _0x1dcd91={};_0x1dcd91[_0x58c666]={'$like':'%'+_0xc3f5fd['query'][_0xb837('0x4f')]+'%'};return _0x1dcd91;})});}_0x412cdb=_['merge']({},_0x412cdb,_0xc3f5fd[_0xb837('0x51')]);return _0x58e35d[_0xb837('0xbe')](_0x412cdb);}})['then'](function(_0x52d510){if(_0x52d510){_0x4f333f=_0x52d510['length'];if(!_0xc3f5fd[_0xb837('0x41')][_0xb837('0x70')](_0xb837('0x47'))){_0x412cdb[_0xb837('0x48')]=qs[_0xb837('0x48')](_0xc3f5fd['query']['limit']);_0x412cdb[_0xb837('0x49')]=qs[_0xb837('0x49')](_0xc3f5fd[_0xb837('0x41')][_0xb837('0x49')]);}return _0x58e35d[_0xb837('0xbe')](_0x412cdb);}})[_0xb837('0x33')](function(_0x577c07){if(_0x577c07){return _0x577c07?{'count':_0x4f333f,'rows':_0x577c07}:null;}})[_0xb837('0x33')](respondWithResult(_0x38d4fe,null))['catch'](handleError(_0x38d4fe,null));};exports[_0xb837('0xbf')]=function(_0x3abe31,_0x488f21,_0x1ad9c5){var _0x8fedfd={'raw':![],'where':{}};var _0x523f33={};var _0x5b1b03={'count':0x0,'rows':[]};return db[_0xb837('0x3b')][_0xb837('0x6f')]({'where':{'id':_0x3abe31[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x488f21,null))[_0xb837('0x33')](function(_0x473245){if(_0x473245){_0x523f33[_0xb837('0x40')]=_['keys'](db[_0xb837('0xa6')]['rawAttributes']);_0x523f33[_0xb837('0x41')]=_[_0xb837('0x42')](_0x3abe31[_0xb837('0x41')]);_0x523f33[_0xb837('0x4c')]=_[_0xb837('0x43')](_0x523f33[_0xb837('0x40')],_0x523f33[_0xb837('0x41')]);_0x8fedfd['attributes']=_[_0xb837('0x43')](_0x523f33[_0xb837('0x40')],qs[_0xb837('0x45')](_0x3abe31[_0xb837('0x41')][_0xb837('0x45')]));_0x8fedfd['attributes']=_0x8fedfd[_0xb837('0x44')][_0xb837('0x46')]?_0x8fedfd[_0xb837('0x44')]:_0x523f33[_0xb837('0x40')];if(!_0x3abe31[_0xb837('0x41')][_0xb837('0x70')](_0xb837('0x47'))){_0x8fedfd[_0xb837('0x48')]=qs[_0xb837('0x48')](_0x3abe31[_0xb837('0x41')][_0xb837('0x48')]);_0x8fedfd[_0xb837('0x49')]=qs['offset'](_0x3abe31[_0xb837('0x41')]['offset']);}_0x8fedfd[_0xb837('0x69')]=qs[_0xb837('0x4a')](_0x3abe31[_0xb837('0x41')][_0xb837('0x4a')]);_0x8fedfd[_0xb837('0x4b')]=qs[_0xb837('0x4c')](_[_0xb837('0x4d')](_0x3abe31[_0xb837('0x41')],_0x523f33[_0xb837('0x4c')]));_0x8fedfd['where'][_0xb837('0x66')]=_0x473245['id'];if(_0x3abe31['query'][_0xb837('0x4f')]){_0x8fedfd[_0xb837('0x4b')]=_[_0xb837('0x50')](_0x8fedfd[_0xb837('0x4b')],{'$or':_[_0xb837('0x3a')](_0x8fedfd[_0xb837('0x44')],function(_0x1570ab){var _0x30538a={};_0x30538a[_0x1570ab]={'$like':'%'+_0x3abe31['query'][_0xb837('0x4f')]+'%'};return _0x30538a;})});}_0x8fedfd=_['merge']({},_0x8fedfd,_0x3abe31[_0xb837('0x51')]);return db[_0xb837('0xa6')][_0xb837('0x52')]({'where':_0x8fedfd['where']})[_0xb837('0x33')](function(_0xd5ef7c){_0x5b1b03[_0xb837('0x52')]=_0xd5ef7c;if(_0x3abe31['query'][_0xb837('0x53')]){_0x8fedfd[_0xb837('0x54')]=[{'model':db[_0xb837('0x7b')],'as':_0xb837('0xc0'),'required':![]},{'model':db[_0xb837('0xb0')],'as':_0xb837('0xc1'),'attributes':[_0xb837('0x38'),_0xb837('0xc2'),_0xb837('0xc3')],'required':![]},{'model':db[_0xb837('0xc4')],'as':'Tags','attributes':['id',_0xb837('0x38'),'color'],'where':_0x3abe31[_0xb837('0x41')][_0xb837('0xc5')]?{'id':_0x3abe31[_0xb837('0x41')][_0xb837('0xc5')]}:undefined,'required':_0x3abe31[_0xb837('0x41')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0xb837('0x55')](_0x8fedfd);})[_0xb837('0x33')](function(_0x5ddb9d){_0x5b1b03['rows']=_0x5ddb9d;return _0x5b1b03;});}})[_0xb837('0x33')](respondWithFilteredResult(_0x488f21,_0x8fedfd))['catch'](handleError(_0x488f21,null));};exports[_0xb837('0x39')]=function(_0x5e8bcc,_0x222650,_0x3e4cf3){var _0x45ff2c,_0x34a408,_0x85a095;if(_[_0xb837('0x9a')](_0x5e8bcc[_0xb837('0x5d')][_0xb837('0x5d')])||_0x5e8bcc['body'][_0xb837('0x5d')]===''){throw new db[(_0xb837('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb837('0x9a')](_0x5e8bcc['body']['to'])){throw new db[(_0xb837('0x7c'))][(_0xb837('0x7d'))](_0xb837('0xc6'));}_0x45ff2c=_0x5e8bcc[_0xb837('0x5d')]['to'];return db['SmsAccount'][_0xb837('0x5b')]({'where':{'id':_0x5e8bcc[_0xb837('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb837('0x7b')],'as':_0xb837('0xa1'),'where':{'mobile':_0x45ff2c},'limit':0x1,'order':[[_0xb837('0x81'),_0xb837('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x222650,null))[_0xb837('0x33')](function(_0x2ca050){if(_0x2ca050&&_0x2ca050[_0xb837('0xc7')]){_0x34a408=_0x2ca050[_0xb837('0x34')]({'plain':!![]});if(_0x34a408[_0xb837('0xc7')]&&_0x34a408['List'][_0xb837('0xa1')][_0xb837('0x46')]){return _0x34a408[_0xb837('0xc7')][_0xb837('0xa1')][0x0];}return db[_0xb837('0x7b')][_0xb837('0x5c')](_[_0xb837('0x18')](_0x5e8bcc[_0xb837('0x5d')],{'firstName':_0x45ff2c,'mobile':_0x45ff2c,'phone':_0x45ff2c,'ListId':_0x34a408[_0xb837('0xa0')]}));}})[_0xb837('0x33')](handleEntityNotFound(_0x222650,null))['then'](function(_0x23436b){if(_0x23436b){_0x85a095=_0x23436b;return db[_0xb837('0xa6')][_0xb837('0x5b')]({'where':{'ContactId':_0x85a095['id'],'closed':![],'SmsAccountId':_0x34a408['id']}})[_0xb837('0x33')](function(_0x3f82d2){if(_0x3f82d2){return[_0x3f82d2,![]];}return db[_0xb837('0xa6')][_0xb837('0x5c')]({'UserId':_0x5e8bcc[_0xb837('0x60')]['id'],'ContactId':_0x85a095['id'],'SmsAccountId':_0x34a408['id'],'phone':_0x45ff2c,'firstMsgDirection':_0xb837('0xc8'),'Messages':[_[_0xb837('0x50')](_0x5e8bcc['body'],{'read':![],'body':_0x5e8bcc[_0xb837('0x5d')][_0xb837('0x5d')],'phone':_0x45ff2c,'SmsAccountId':_0x34a408['id'],'UserId':_0x5e8bcc[_0xb837('0x60')]['id'],'ContactId':_0x85a095['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xb837('0xc9')}]})[_0xb837('0x33')](function(_0x2d00ff){return[_0x2d00ff,!![]];});});}})[_0xb837('0xa7')](function(_0x420102,_0x3d464b){if(_0x3d464b){return _0x420102;}return db[_0xb837('0xad')]['create'](_[_0xb837('0x50')](_0x5e8bcc['body'],{'read':![],'body':_0x5e8bcc['body']['body'],'phone':_0x45ff2c,'SmsAccountId':_0x34a408['id'],'SmsInteractionId':_0x420102['id'],'UserId':_0x5e8bcc[_0xb837('0x60')]['id'],'ContactId':_0x85a095['id']}))['then'](function(_0xa4b1f0){_0x420102[_0xb837('0xca')][_0xb837('0xc9')]=[];_0x420102[_0xb837('0xca')][_0xb837('0xc9')][_0xb837('0xaa')](_0xa4b1f0['dataValues']);return _0x420102;});})[_0xb837('0x33')](respondWithResult(_0x222650,null))['catch'](handleError(_0x222650,null));};exports[_0xb837('0x2c')]=function(_0x24dcd9,_0x409105,_0x14b250){if(_0x24dcd9[_0xb837('0x5d')]['id']){delete _0x24dcd9[_0xb837('0x5d')]['id'];}var _0x38ddbe,_0x45460f,_0x397821;return db[_0xb837('0x3b')][_0xb837('0x5b')]({'where':{'id':_0x24dcd9[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x409105,null))[_0xb837('0x33')](function(_0x4d6a6c){if(_0x4d6a6c){_0x397821=_0x4d6a6c;logger['debug'](_0xb837('0x23'),_0xb837('0x2c'),_0xb837('0xcb'),_0x4d6a6c[_0xb837('0x3e')],util[_0xb837('0xcc')](_0x24dcd9[_0xb837('0x5d')],{'showHidden':![],'depth':null}));switch(_0x4d6a6c[_0xb837('0x3e')]){case _0xb837('0xcd'):if(_0x24dcd9[_0xb837('0x5d')][_0xb837('0xce')]&&_0x24dcd9[_0xb837('0x5d')]['status']){_0x45460f=_0x24dcd9['body']['status'];return db[_0xb837('0xad')][_0xb837('0x5b')]({'where':{'messageId':_0x24dcd9[_0xb837('0x5d')][_0xb837('0xce')]}});}break;case'connectel':if(_0x24dcd9[_0xb837('0x5d')][_0xb837('0xcf')]&&_0x24dcd9[_0xb837('0x5d')][_0xb837('0xd0')]){_0x45460f=_0x24dcd9['body'][_0xb837('0xd0')];return db[_0xb837('0xad')][_0xb837('0x5b')]({'where':{'messageId':_0x24dcd9[_0xb837('0x5d')][_0xb837('0xcf')]}});}break;case _0xb837('0x8b'):if(_0x24dcd9[_0xb837('0x5d')]['message_id']&&_0x24dcd9[_0xb837('0x5d')][_0xb837('0xd1')]){_0x45460f=_0x24dcd9[_0xb837('0x5d')]['status_code'];return db[_0xb837('0xad')][_0xb837('0x5b')]({'where':{'messageId':_0x24dcd9[_0xb837('0x5d')]['message_id']}});}break;case _0xb837('0x8f'):var _0x4f2359=_0x24dcd9[_0xb837('0x5d')][_0xb837('0x90')][0x0];if(_0x4f2359[_0xb837('0x87')]&&_0x4f2359[_0xb837('0x2c')][_0xb837('0xd2')]==='DELIVERED'){_0x45460f=_0x4f2359[_0xb837('0x2c')][_0xb837('0xd2')];return db[_0xb837('0xad')][_0xb837('0x5b')]({'where':{'messageId':_0x4f2359[_0xb837('0x87')]}});}break;case _0xb837('0x94'):if(_0x24dcd9[_0xb837('0x5d')][_0xb837('0x87')]&&_0x24dcd9['body'][_0xb837('0x2c')]){_0x45460f=_0x24dcd9[_0xb837('0x5d')][_0xb837('0x2c')];return db[_0xb837('0xad')]['find']({'where':{'messageId':_0x24dcd9[_0xb837('0x5d')][_0xb837('0x87')]}});}break;case _0xb837('0x97'):if(_0x24dcd9[_0xb837('0x5d')][0x0][_0xb837('0x27')]['id']){_0x45460f=_0x24dcd9['body'][0x0][_0xb837('0x3e')];return db[_0xb837('0xad')][_0xb837('0x5b')]({'where':{'messageId':_0x24dcd9[_0xb837('0x5d')][0x0][_0xb837('0x27')]['id']}});}break;case _0xb837('0x98'):if(_0x24dcd9[_0xb837('0x5d')]['redif']&&_0x24dcd9['body'][_0xb837('0x2c')]){_0x45460f=_0x24dcd9[_0xb837('0x5d')][_0xb837('0x2c')];return db[_0xb837('0xad')]['find']({'where':{'messageId':_0x24dcd9[_0xb837('0x5d')][_0xb837('0xd3')]}});}break;}}})[_0xb837('0x33')](handleEntityNotFound(_0x409105,null))[_0xb837('0x33')](function(_0x19c703){if(_0x19c703){_0x38ddbe=_0x19c703;switch(_0x397821[_0xb837('0x3e')]){case _0xb837('0xcd'):if(_0x45460f===_0xb837('0xd4')){return _0x38ddbe[_0xb837('0x32')]({'read':!![]});}else{logger[_0xb837('0x25')](_0xb837('0x23'),'status',_0xb837('0xcd'),util[_0xb837('0xcc')](_0x24dcd9[_0xb837('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xb837('0x8a'):if(_0x45460f==='1'){return _0x38ddbe[_0xb837('0x32')]({'read':!![]});}else{logger['error'](_0xb837('0x23'),_0xb837('0x2c'),_0xb837('0xcd'),util[_0xb837('0xcc')](_0x24dcd9[_0xb837('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xb837('0x8b'):if(!_0x24dcd9[_0xb837('0x5d')]['error_code']&&_0x45460f>=0xc8&&_0x45460f<=0xce){return _0x38ddbe[_0xb837('0x32')]({'read':!![]});}else{logger[_0xb837('0x25')](_0xb837('0x23'),'status',_0xb837('0x8b'),util['inspect'](_0x24dcd9[_0xb837('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xb837('0x8f'):var _0x587fbb=_0x24dcd9['body'][_0xb837('0x90')][0x0];if(_0x587fbb[_0xb837('0x2c')][_0xb837('0xd2')]===_0xb837('0xd4')){return _0x38ddbe['update']({'read':!![]});}else{logger[_0xb837('0x25')](_0xb837('0x23'),_0xb837('0x2c'),'infobip',util['inspect'](_0x24dcd9[_0xb837('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xb837('0x94'):if(_0x45460f==_0xb837('0xd5')||_0x45460f==_0xb837('0xd6')){return _0x38ddbe[_0xb837('0x32')]({'read':!![]});}else{logger['error'](_0xb837('0x23'),_0xb837('0x2c'),'clickatell',util['inspect'](_0x24dcd9['body'],{'showHidden':![],'depth':null}));}break;case _0xb837('0x97'):if(_0x45460f==_0xb837('0xd7')){return _0x38ddbe['update']({'read':!![]});}else{logger[_0xb837('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb837('0x2c'),_0xb837('0x97'),util[_0xb837('0xcc')](_0x24dcd9[_0xb837('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xb837('0x98'):if(_0x45460f===_0xb837('0xd8')||_0x45460f===_0xb837('0xd9')){return _0x38ddbe[_0xb837('0x32')]({'read':!![]});}else{logger[_0xb837('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb837('0x2c'),_0xb837('0x98'),util['inspect'](_0x24dcd9[_0xb837('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x38ddbe;}})[_0xb837('0x33')](respondWithResult(_0x409105,null))['catch'](handleError(_0x409105,null));};exports[_0xb837('0xda')]=function(_0x8e1e02,_0x313b47,_0x3f4a28){var _0x51c016,_0x879d90,_0x5b809a;return db[_0xb837('0x3b')][_0xb837('0x5b')]({'where':{'id':_0x8e1e02['params']['id']}})['then'](handleEntityNotFound(_0x313b47,null))[_0xb837('0x33')](function(_0x15b461){if(_0x15b461){_0x5b809a=_0x15b461;logger['debug'](_0xb837('0x23'),_0xb837('0x2c'),_0xb837('0xcb'),_0x15b461['type'],util['inspect'](_0x8e1e02[_0xb837('0x41')],{'showHidden':![],'depth':null}));switch(_0x15b461['type']){case _0xb837('0x91'):if(_0x8e1e02[_0xb837('0x41')][_0xb837('0xdb')]&&_0x8e1e02[_0xb837('0x41')][_0xb837('0xdc')]){_0x879d90=_0x8e1e02[_0xb837('0x41')]['state'];return db[_0xb837('0xad')]['find']({'where':{'messageId':_0x8e1e02[_0xb837('0x41')][_0xb837('0xdb')]}});}break;}}})[_0xb837('0x33')](handleEntityNotFound(_0x313b47,null))['then'](function(_0x44f160){if(_0x44f160){_0x51c016=_0x44f160;switch(_0x5b809a[_0xb837('0x3e')]){case _0xb837('0x91'):if(_0x879d90==='2'||_0x879d90==='6'){return _0x51c016[_0xb837('0x32')]({'read':!![]});}else{logger[_0xb837('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb837('0x2c'),_0xb837('0x91'),util[_0xb837('0xcc')](_0x8e1e02['query'],{'showHidden':![],'depth':null}));};break;}return _0x51c016;}})['then'](respondWithResult(_0x313b47,null))[_0xb837('0x29')](handleError(_0x313b47,null));};exports[_0xb837('0xdd')]=function(_0x4d9c16,_0x15db37,_0x37fffa){return db[_0xb837('0x3b')]['find']({'where':{'id':_0x4d9c16[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x15db37,null))[_0xb837('0x33')](function(_0x1e8f82){if(_0x1e8f82){return _0x1e8f82['addAgents'](_0x4d9c16[_0xb837('0x5d')][_0xb837('0x6b')],_['omit'](_0x4d9c16[_0xb837('0x5d')],['ids','id'])||{})[_0xb837('0xa7')](function(_0x271e6d){for(var _0x3feef4=0x0;_0x3feef4<_0x4d9c16[_0xb837('0x5d')]['ids'][_0xb837('0x46')];_0x3feef4+=0x1){socket['emit'](_0xb837('0xde'),{'UserId':_0x4d9c16['body']['ids'][_0x3feef4],'SmsAccountId':_0x4d9c16['params']['id']});}return _0x271e6d;});}})[_0xb837('0x33')](respondWithResult(_0x15db37,null))[_0xb837('0x29')](handleError(_0x15db37,null));};exports[_0xb837('0xdf')]=function(_0x1c5bb3,_0x3a5cc7,_0x1a72b1){return db[_0xb837('0x3b')][_0xb837('0x5b')]({'where':{'id':_0x1c5bb3[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0x3a5cc7,null))[_0xb837('0x33')](function(_0x27fc69){if(_0x27fc69){return _0x27fc69['removeAgents'](_0x1c5bb3['query'][_0xb837('0x6b')])[_0xb837('0x33')](function(){if(_[_0xb837('0xe0')](_0x1c5bb3[_0xb837('0x41')][_0xb837('0x6b')])){for(var _0x441fae=0x0;_0x441fae<_0x1c5bb3['query'][_0xb837('0x6b')][_0xb837('0x46')];_0x441fae+=0x1){socket[_0xb837('0xe1')](_0xb837('0xe2'),{'UserId':Number(_0x1c5bb3[_0xb837('0x41')][_0xb837('0x6b')][_0x441fae]),'SmsAccountId':Number(_0x1c5bb3[_0xb837('0x58')]['id'])});}}else{socket[_0xb837('0xe1')](_0xb837('0xe2'),{'UserId':Number(_0x1c5bb3['query'][_0xb837('0x6b')]),'SmsAccountId':Number(_0x1c5bb3[_0xb837('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a5cc7,null))['catch'](handleError(_0x3a5cc7,null));};exports[_0xb837('0xe3')]=function(_0x3a294b,_0xccf7bf,_0x4c2518){var _0x38c811={};var _0x23e3c8={};var _0x4d8db7;var _0x54cb94;return db[_0xb837('0x3b')][_0xb837('0x6f')]({'where':{'id':_0x3a294b[_0xb837('0x58')]['id']}})[_0xb837('0x33')](handleEntityNotFound(_0xccf7bf,null))[_0xb837('0x33')](function(_0x46ccd9){if(_0x46ccd9){_0x4d8db7=_0x46ccd9;_0x23e3c8['model']=_[_0xb837('0x42')](db['User'][_0xb837('0x3c')]);_0x23e3c8[_0xb837('0x41')]=_['keys'](_0x3a294b[_0xb837('0x41')]);_0x23e3c8[_0xb837('0x4c')]=_[_0xb837('0x43')](_0x23e3c8[_0xb837('0x40')],_0x23e3c8[_0xb837('0x41')]);_0x38c811['attributes']=_[_0xb837('0x43')](_0x23e3c8[_0xb837('0x40')],qs[_0xb837('0x45')](_0x3a294b[_0xb837('0x41')]['fields']));_0x38c811['attributes']=_0x38c811[_0xb837('0x44')]['length']?_0x38c811[_0xb837('0x44')]:_0x23e3c8[_0xb837('0x40')];_0x38c811[_0xb837('0x69')]=qs[_0xb837('0x4a')](_0x3a294b[_0xb837('0x41')][_0xb837('0x4a')]);_0x38c811[_0xb837('0x4b')]=qs[_0xb837('0x4c')](_[_0xb837('0x4d')](_0x3a294b[_0xb837('0x41')],_0x23e3c8[_0xb837('0x4c')]));if(_0x3a294b['query']['filter']){_0x38c811[_0xb837('0x4b')]=_['merge'](_0x38c811[_0xb837('0x4b')],{'$or':_[_0xb837('0x3a')](_0x38c811[_0xb837('0x44')],function(_0x130530){var _0x5368d6={};_0x5368d6[_0x130530]={'$like':'%'+_0x3a294b[_0xb837('0x41')][_0xb837('0x4f')]+'%'};return _0x5368d6;})});}_0x38c811=_[_0xb837('0x50')]({},_0x38c811,_0x3a294b[_0xb837('0x51')]);return _0x4d8db7[_0xb837('0xe3')](_0x38c811);}})['then'](function(_0x4716ba){if(_0x4716ba){_0x54cb94=_0x4716ba[_0xb837('0x46')];if(!_0x3a294b[_0xb837('0x41')][_0xb837('0x70')]('nolimit')){_0x38c811[_0xb837('0x48')]=qs[_0xb837('0x48')](_0x3a294b[_0xb837('0x41')][_0xb837('0x48')]);_0x38c811[_0xb837('0x49')]=qs[_0xb837('0x49')](_0x3a294b[_0xb837('0x41')][_0xb837('0x49')]);}return _0x4d8db7[_0xb837('0xe3')](_0x38c811);}})[_0xb837('0x33')](function(_0x37a2dc){if(_0x37a2dc){return _0x37a2dc?{'count':_0x54cb94,'rows':_0x37a2dc}:null;}})[_0xb837('0x33')](respondWithResult(_0xccf7bf,null))[_0xb837('0x29')](handleError(_0xccf7bf,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 021cc8f..4e409da 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 _0x4054=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x237cc0,_0x16f1c0){var _0x269736=function(_0x4a1f3d){while(--_0x4a1f3d){_0x237cc0['push'](_0x237cc0['shift']());}};_0x269736(++_0x16f1c0);}(_0x4054,0x1c3));var _0x4405=function(_0x29c4d6,_0x4a87d9){_0x29c4d6=_0x29c4d6-0x0;var _0x3e7437=_0x4054[_0x29c4d6];return _0x3e7437;};'use strict';var EventEmitter=require(_0x4405('0x0'));var SmsAccount=require(_0x4405('0x1'))['db'][_0x4405('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4405('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4405('0x4'),'afterDestroy':_0x4405('0x5')};function emitEvent(_0x46d381){return function(_0x4236b2,_0x5d5949,_0x3223fd){SmsAccountEvents[_0x4405('0x6')](_0x46d381+':'+_0x4236b2['id'],_0x4236b2);SmsAccountEvents[_0x4405('0x6')](_0x46d381,_0x4236b2);_0x3223fd(null);};}for(var e in events){if(events[_0x4405('0x7')](e)){var event=events[e];SmsAccount[_0x4405('0x8')](e,emitEvent(event));}}module[_0x4405('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xe77d=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','emit','hook'];(function(_0x41a0d1,_0x37a1dc){var _0x2cc124=function(_0x51b0ea){while(--_0x51b0ea){_0x41a0d1['push'](_0x41a0d1['shift']());}};_0x2cc124(++_0x37a1dc);}(_0xe77d,0x179));var _0xde77=function(_0x157c61,_0x30bd32){_0x157c61=_0x157c61-0x0;var _0x2da230=_0xe77d[_0x157c61];return _0x2da230;};'use strict';var EventEmitter=require(_0xde77('0x0'));var SmsAccount=require(_0xde77('0x1'))['db'][_0xde77('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xde77('0x3')](0x0);var events={'afterCreate':_0xde77('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x204989){return function(_0x378e81,_0xd50b2e,_0xdf9df6){SmsAccountEvents[_0xde77('0x5')](_0x204989+':'+_0x378e81['id'],_0x378e81);SmsAccountEvents[_0xde77('0x5')](_0x204989,_0x378e81);_0xdf9df6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xde77('0x6')](e,emitEvent(event));}}module[_0xde77('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d20ff84..483e149 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 _0x46d9=['api','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','util','../../config/logger'];(function(_0x318706,_0x13b0b9){var _0x3447d4=function(_0x5aef20){while(--_0x5aef20){_0x318706['push'](_0x318706['shift']());}};_0x3447d4(++_0x13b0b9);}(_0x46d9,0x97));var _0x946d=function(_0x6e7687,_0x163e3b){_0x6e7687=_0x6e7687-0x0;var _0x1614e2=_0x46d9[_0x6e7687];return _0x1614e2;};'use strict';var _=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var logger=require(_0x946d('0x2'))(_0x946d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x946d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x946d('0x5'));var config=require(_0x946d('0x6'));var attributes=require(_0x946d('0x7'));module[_0x946d('0x8')]=function(_0xe907a0,_0x24775e){return _0xe907a0[_0x946d('0x9')]('SmsAccount',attributes,{'tableName':_0x946d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x513f=['../../config/environment','exports','define','SmsAccount','sms_accounts','util','../../config/logger','api','path'];(function(_0x441a98,_0x16f540){var _0xec0906=function(_0x2edcea){while(--_0x2edcea){_0x441a98['push'](_0x441a98['shift']());}};_0xec0906(++_0x16f540);}(_0x513f,0x16d));var _0xf513=function(_0x1bd854,_0x36046c){_0x1bd854=_0x1bd854-0x0;var _0x18624a=_0x513f[_0x1bd854];return _0x18624a;};'use strict';var _=require('lodash');var util=require(_0xf513('0x0'));var logger=require(_0xf513('0x1'))(_0xf513('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf513('0x3'));var rimraf=require('rimraf');var config=require(_0xf513('0x4'));var attributes=require('./smsAccount.attributes');module[_0xf513('0x5')]=function(_0x2481b0,_0x1a4f45){return _0x2481b0[_0xf513('0x6')](_0xf513('0x7'),attributes,{'tableName':_0xf513('0x8'),'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 4e17641..e9ba029 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 _0x725c=['request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount,\x20%s,\x20%s','info','result','ShowSmsAccount','SmsAccount','options','raw','where','include','map','model','attributes','then','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','request'];(function(_0x497393,_0x962359){var _0x2d8920=function(_0x2272ae){while(--_0x2272ae){_0x497393['push'](_0x497393['shift']());}};_0x2d8920(++_0x962359);}(_0x725c,0x110));var _0xc725=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x725c[_0x43444b];return _0x392fe5;};'use strict';var _=require(_0xc725('0x0'));var util=require('util');var moment=require(_0xc725('0x1'));var BPromise=require(_0xc725('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc725('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc725('0x4'));var logger=require(_0xc725('0x5'))('rpc');var config=require(_0xc725('0x6'));var jayson=require(_0xc725('0x7'));var client=jayson[_0xc725('0x8')][_0xc725('0x9')]({'port':0x232a});config[_0xc725('0xa')]=_[_0xc725('0xb')](config[_0xc725('0xa')],{'host':_0xc725('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc725('0xa')]));require(_0xc725('0xd'))[_0xc725('0xe')](socket);function respondWithRpcPromise(_0x2c0b42,_0x3e2d53,_0x3f53c5){return new BPromise(function(_0x9c207f,_0x4cd831){return client[_0xc725('0xf')](_0x2c0b42,_0x3f53c5)['then'](function(_0x294c48){logger['info']('SmsAccount,\x20%s,\x20%s',_0x3e2d53,_0xc725('0x10'));logger[_0xc725('0x11')](_0xc725('0x12'),_0x3e2d53,_0xc725('0x10'),JSON[_0xc725('0x13')](_0x294c48));if(_0x294c48[_0xc725('0x14')]){if(_0x294c48[_0xc725('0x14')]['code']===0x1f4){logger[_0xc725('0x14')]('SmsAccount,\x20%s,\x20%s',_0x3e2d53,_0x294c48[_0xc725('0x14')][_0xc725('0x15')]);return _0x4cd831(_0x294c48[_0xc725('0x14')]['message']);}logger['error'](_0xc725('0x16'),_0x3e2d53,_0x294c48[_0xc725('0x14')][_0xc725('0x15')]);return _0x9c207f(_0x294c48[_0xc725('0x14')][_0xc725('0x15')]);}else{logger[_0xc725('0x17')](_0xc725('0x16'),_0x3e2d53,_0xc725('0x10'));_0x9c207f(_0x294c48[_0xc725('0x18')]['message']);}})['catch'](function(_0x31e67){logger['error'](_0xc725('0x16'),_0x3e2d53,_0x31e67);_0x4cd831(_0x31e67);});});}exports[_0xc725('0x19')]=function(_0x50600d){var _0x5a7703=this;return new Promise(function(_0x1da522,_0x5f230d){return db[_0xc725('0x1a')]['find']({'raw':_0x50600d['options']?_0x50600d[_0xc725('0x1b')][_0xc725('0x1c')]===undefined?!![]:![]:!![],'where':_0x50600d[_0xc725('0x1b')]?_0x50600d[_0xc725('0x1b')][_0xc725('0x1d')]||null:null,'attributes':_0x50600d[_0xc725('0x1b')]?_0x50600d[_0xc725('0x1b')]['attributes']||null:null,'include':_0x50600d['options']?_0x50600d[_0xc725('0x1b')][_0xc725('0x1e')]?_[_0xc725('0x1f')](_0x50600d[_0xc725('0x1b')][_0xc725('0x1e')],function(_0x559562){return{'model':db[_0x559562[_0xc725('0x20')]],'as':_0x559562['as'],'attributes':_0x559562[_0xc725('0x21')],'include':_0x559562[_0xc725('0x1e')]?_[_0xc725('0x1f')](_0x559562[_0xc725('0x1e')],function(_0x2d1a3e){return{'model':db[_0x2d1a3e[_0xc725('0x20')]],'as':_0x2d1a3e['as'],'attributes':_0x2d1a3e['attributes'],'include':_0x2d1a3e[_0xc725('0x1e')]?_[_0xc725('0x1f')](_0x2d1a3e['include'],function(_0x384099){return{'model':db[_0x384099[_0xc725('0x20')]],'as':_0x384099['as'],'attributes':_0x384099['attributes']};}):[]};}):[]};}):[]:[]})[_0xc725('0x22')](function(_0x42772e){logger[_0xc725('0x17')]('ShowSmsAccount',_0x50600d);logger['debug'](_0xc725('0x19'),_0x50600d,JSON['stringify'](_0x42772e));_0x1da522(_0x42772e);})[_0xc725('0x23')](function(_0x5623e7){logger['error'](_0xc725('0x19'),_0x5623e7[_0xc725('0x15')],_0x50600d);_0x5f230d(_0x5a7703['error'](0x1f4,_0x5623e7[_0xc725('0x15')]));});});}; \ No newline at end of file +var _0xbbc4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment'];(function(_0x50978c,_0xb7fdf8){var _0x5b012d=function(_0x5c8b15){while(--_0x5c8b15){_0x50978c['push'](_0x50978c['shift']());}};_0x5b012d(++_0xb7fdf8);}(_0xbbc4,0x1c4));var _0x4bbc=function(_0x2c5472,_0x4a04c2){_0x2c5472=_0x2c5472-0x0;var _0x4d511c=_0xbbc4[_0x2c5472];return _0x4d511c;};'use strict';var _=require(_0x4bbc('0x0'));var util=require(_0x4bbc('0x1'));var moment=require(_0x4bbc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bbc('0x3'));var db=require(_0x4bbc('0x4'))['db'];var utils=require(_0x4bbc('0x5'));var logger=require(_0x4bbc('0x6'))('rpc');var config=require(_0x4bbc('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4bbc('0x8')]=_['defaults'](config[_0x4bbc('0x8')],{'host':_0x4bbc('0x9'),'port':0x18eb});var socket=require(_0x4bbc('0xa'))(new Redis(config[_0x4bbc('0x8')]));require('./smsAccount.socket')[_0x4bbc('0xb')](socket);function respondWithRpcPromise(_0x5f34eb,_0xfd7c06,_0x2566f6){return new BPromise(function(_0x329d8e,_0x5449ad){return client[_0x4bbc('0xc')](_0x5f34eb,_0x2566f6)[_0x4bbc('0xd')](function(_0x290014){logger[_0x4bbc('0xe')](_0x4bbc('0xf'),_0xfd7c06,_0x4bbc('0x10'));logger[_0x4bbc('0x11')](_0x4bbc('0x12'),_0xfd7c06,_0x4bbc('0x10'),JSON[_0x4bbc('0x13')](_0x290014));if(_0x290014[_0x4bbc('0x14')]){if(_0x290014[_0x4bbc('0x14')][_0x4bbc('0x15')]===0x1f4){logger[_0x4bbc('0x14')](_0x4bbc('0xf'),_0xfd7c06,_0x290014[_0x4bbc('0x14')][_0x4bbc('0x16')]);return _0x5449ad(_0x290014[_0x4bbc('0x14')][_0x4bbc('0x16')]);}logger[_0x4bbc('0x14')](_0x4bbc('0xf'),_0xfd7c06,_0x290014[_0x4bbc('0x14')][_0x4bbc('0x16')]);return _0x329d8e(_0x290014[_0x4bbc('0x14')][_0x4bbc('0x16')]);}else{logger[_0x4bbc('0xe')](_0x4bbc('0xf'),_0xfd7c06,_0x4bbc('0x10'));_0x329d8e(_0x290014[_0x4bbc('0x17')]['message']);}})[_0x4bbc('0x18')](function(_0x377f20){logger[_0x4bbc('0x14')](_0x4bbc('0xf'),_0xfd7c06,_0x377f20);_0x5449ad(_0x377f20);});});}exports[_0x4bbc('0x19')]=function(_0x4df37c){var _0x250641=this;return new Promise(function(_0x466a7d,_0x43c67a){return db[_0x4bbc('0x1a')][_0x4bbc('0x1b')]({'raw':_0x4df37c[_0x4bbc('0x1c')]?_0x4df37c['options'][_0x4bbc('0x1d')]===undefined?!![]:![]:!![],'where':_0x4df37c[_0x4bbc('0x1c')]?_0x4df37c[_0x4bbc('0x1c')][_0x4bbc('0x1e')]||null:null,'attributes':_0x4df37c['options']?_0x4df37c[_0x4bbc('0x1c')][_0x4bbc('0x1f')]||null:null,'include':_0x4df37c['options']?_0x4df37c['options'][_0x4bbc('0x20')]?_[_0x4bbc('0x21')](_0x4df37c[_0x4bbc('0x1c')][_0x4bbc('0x20')],function(_0x511097){return{'model':db[_0x511097[_0x4bbc('0x22')]],'as':_0x511097['as'],'attributes':_0x511097['attributes'],'include':_0x511097[_0x4bbc('0x20')]?_[_0x4bbc('0x21')](_0x511097[_0x4bbc('0x20')],function(_0x507224){return{'model':db[_0x507224['model']],'as':_0x507224['as'],'attributes':_0x507224[_0x4bbc('0x1f')],'include':_0x507224[_0x4bbc('0x20')]?_['map'](_0x507224[_0x4bbc('0x20')],function(_0x14108e){return{'model':db[_0x14108e[_0x4bbc('0x22')]],'as':_0x14108e['as'],'attributes':_0x14108e[_0x4bbc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4bbc('0xd')](function(_0x10d253){logger[_0x4bbc('0xe')]('ShowSmsAccount',_0x4df37c);logger[_0x4bbc('0x11')]('ShowSmsAccount',_0x4df37c,JSON[_0x4bbc('0x13')](_0x10d253));_0x466a7d(_0x10d253);})[_0x4bbc('0x18')](function(_0x11940a){logger[_0x4bbc('0x14')](_0x4bbc('0x19'),_0x11940a[_0x4bbc('0x16')],_0x4df37c);_0x43c67a(_0x250641['error'](0x1f4,_0x11940a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 96371b3..9ae60c0 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 _0x6d0c=['emit','removeListener','length','smsAccount:','./smsAccount.events','save','remove','update'];(function(_0x3f82db,_0x233db8){var _0x1d4d61=function(_0x3a2005){while(--_0x3a2005){_0x3f82db['push'](_0x3f82db['shift']());}};_0x1d4d61(++_0x233db8);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x236bc3,_0x5af813){_0x236bc3=_0x236bc3-0x0;var _0x1dd82e=_0x6d0c[_0x236bc3];return _0x1dd82e;};'use strict';var SmsAccountEvents=require(_0xc6d0('0x0'));var events=[_0xc6d0('0x1'),_0xc6d0('0x2'),_0xc6d0('0x3')];function createListener(_0xc8bedb,_0x350d3a){return function(_0x487187){_0x350d3a[_0xc6d0('0x4')](_0xc8bedb,_0x487187);};}function removeListener(_0x5e2eb1,_0x5e5db2){return function(){SmsAccountEvents[_0xc6d0('0x5')](_0x5e2eb1,_0x5e5db2);};}exports['register']=function(_0x589214){for(var _0xdae4c3=0x0,_0x40ba33=events[_0xc6d0('0x6')];_0xdae4c3<_0x40ba33;_0xdae4c3++){var _0x39e8be=events[_0xdae4c3];var _0xbd2213=createListener(_0xc6d0('0x7')+_0x39e8be,_0x589214);SmsAccountEvents['on'](_0x39e8be,_0xbd2213);}}; \ No newline at end of file +var _0x91ed=['register','length','smsAccount:','remove','update','emit'];(function(_0x32ff8e,_0x416a97){var _0x545d38=function(_0x3016a1){while(--_0x3016a1){_0x32ff8e['push'](_0x32ff8e['shift']());}};_0x545d38(++_0x416a97);}(_0x91ed,0x99));var _0xd91e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x91ed[_0x1928c9];return _0x51b5fb;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0xd91e('0x0'),_0xd91e('0x1')];function createListener(_0x4846b8,_0x26d121){return function(_0x1e28e2){_0x26d121[_0xd91e('0x2')](_0x4846b8,_0x1e28e2);};}function removeListener(_0x5a32d1,_0x21476f){return function(){SmsAccountEvents['removeListener'](_0x5a32d1,_0x21476f);};}exports[_0xd91e('0x3')]=function(_0x35c75f){for(var _0x334ed1=0x0,_0x51509a=events[_0xd91e('0x4')];_0x334ed1<_0x51509a;_0x334ed1++){var _0x464dd0=events[_0x334ed1];var _0x2586bb=createListener(_0xd91e('0x5')+_0x464dd0,_0x35c75f);SmsAccountEvents['on'](_0x464dd0,_0x2586bb);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index b38d1e5..56b5765 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 _0xb571=['isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x22eb5d,_0x2e519d){var _0x4a39ad=function(_0x4a1206){while(--_0x4a1206){_0x22eb5d['push'](_0x22eb5d['shift']());}};_0x4a39ad(++_0x2e519d);}(_0xb571,0x1c2));var _0x1b57=function(_0x2726aa,_0xa06b6){_0x2726aa=_0x2726aa-0x0;var _0x183d0e=_0xb571[_0x2726aa];return _0x183d0e;};'use strict';var multer=require(_0x1b57('0x0'));var util=require('util');var path=require(_0x1b57('0x1'));var timeout=require(_0x1b57('0x2'));var express=require('express');var router=express[_0x1b57('0x3')]();var fs_extra=require(_0x1b57('0x4'));var auth=require(_0x1b57('0x5'));var interaction=require(_0x1b57('0x6'));var config=require(_0x1b57('0x7'));var controller=require('./smsApplication.controller');router[_0x1b57('0x8')]('/',auth[_0x1b57('0x9')](),controller['index']);router[_0x1b57('0x8')](_0x1b57('0xa'),auth[_0x1b57('0x9')](),controller[_0x1b57('0xb')]);router['post']('/',auth[_0x1b57('0x9')](),controller['create']);router[_0x1b57('0xc')](_0x1b57('0xa'),auth[_0x1b57('0x9')](),controller[_0x1b57('0xd')]);router[_0x1b57('0xe')](_0x1b57('0xa'),auth[_0x1b57('0x9')](),controller[_0x1b57('0xf')]);module[_0x1b57('0x10')]=router; \ No newline at end of file +var _0x1b27=['./smsApplication.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f2e25,_0x386353){var _0x673f52=function(_0x5552e0){while(--_0x5552e0){_0x4f2e25['push'](_0x4f2e25['shift']());}};_0x673f52(++_0x386353);}(_0x1b27,0x6a));var _0x71b2=function(_0x66d371,_0x2f9a41){_0x66d371=_0x66d371-0x0;var _0x2b0eb7=_0x1b27[_0x66d371];return _0x2b0eb7;};'use strict';var multer=require('multer');var util=require(_0x71b2('0x0'));var path=require(_0x71b2('0x1'));var timeout=require(_0x71b2('0x2'));var express=require(_0x71b2('0x3'));var router=express[_0x71b2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x71b2('0x5'));var interaction=require(_0x71b2('0x6'));var config=require(_0x71b2('0x7'));var controller=require(_0x71b2('0x8'));router['get']('/',auth[_0x71b2('0x9')](),controller['index']);router[_0x71b2('0xa')](_0x71b2('0xb'),auth[_0x71b2('0x9')](),controller[_0x71b2('0xc')]);router[_0x71b2('0xd')]('/',auth[_0x71b2('0x9')](),controller[_0x71b2('0xe')]);router[_0x71b2('0xf')](_0x71b2('0xb'),auth[_0x71b2('0x9')](),controller[_0x71b2('0x10')]);router['delete'](_0x71b2('0xb'),auth['isAuthenticated'](),controller[_0x71b2('0x11')]);module[_0x71b2('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 58a4c85..fa21a7c 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 _0x6f5d=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x2f79c7,_0x127592){var _0xd61478=function(_0x19d2cc){while(--_0x19d2cc){_0x2f79c7['push'](_0x2f79c7['shift']());}};_0xd61478(++_0x127592);}(_0x6f5d,0xad));var _0xd6f5=function(_0x2d72e2,_0x587f2c){_0x2d72e2=_0x2d72e2-0x0;var _0x4d6943=_0x6f5d[_0x2d72e2];return _0x4d6943;};'use strict';var Sequelize=require(_0xd6f5('0x0'));module[_0xd6f5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd6f5('0x2')],'allowNull':![],'defaultValue':_0xd6f5('0x3')},'appdata':{'type':Sequelize[_0xd6f5('0x4')]()},'description':{'type':Sequelize[_0xd6f5('0x2')]},'interval':{'type':Sequelize[_0xd6f5('0x2')],'defaultValue':_0xd6f5('0x5')}}; \ No newline at end of file +var _0xdbeb=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xdbeb,0x76));var _0xbdbe=function(_0x5ed794,_0x4c839e){_0x5ed794=_0x5ed794-0x0;var _0xcb440b=_0xdbeb[_0x5ed794];return _0xcb440b;};'use strict';var Sequelize=require(_0xbdbe('0x0'));module[_0xbdbe('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbdbe('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbdbe('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbdbe('0x2')],'defaultValue':_0xbdbe('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b3e8eae..cd7282b 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 _0xafac=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','then','destroy','end','stack','name','index','map','type','key','model','query','attributes','fields','length','order','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','SmsApplication','findAll','catch','show','keys','rawAttributes','find','body','update','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafac,0xb8));var _0xcafa=function(_0x45f0a7,_0x458e86){_0x45f0a7=_0x45f0a7-0x0;var _0x6d70f6=_0xafac[_0x45f0a7];return _0x6d70f6;};'use strict';var pdf=require(_0xcafa('0x0'));var emlformat=require(_0xcafa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcafa('0x2'));var jsonpatch=require(_0xcafa('0x3'));var rp=require(_0xcafa('0x4'));var moment=require('moment');var BPromise=require(_0xcafa('0x5'));var Mustache=require(_0xcafa('0x6'));var util=require(_0xcafa('0x7'));var path=require(_0xcafa('0x8'));var sox=require(_0xcafa('0x9'));var csv=require(_0xcafa('0xa'));var ejs=require(_0xcafa('0xb'));var fs=require('fs');var fs_extra=require(_0xcafa('0xc'));var _=require(_0xcafa('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcafa('0xe'));var deskjs=require(_0xcafa('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcafa('0x10'));var Papa=require(_0xcafa('0x11'));var Redis=require(_0xcafa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcafa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcafa('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xcafa('0x15'));var config=require(_0xcafa('0x16'));var licenseUtil=require(_0xcafa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39245b,_0x2d598f){_0x2d598f=_0x2d598f||0xcc;return function(_0x1bf677){if(_0x1bf677){return _0x39245b[_0xcafa('0x18')](_0x2d598f);}return _0x39245b[_0xcafa('0x19')](_0x2d598f)['end']();};}function respondWithResult(_0x532bba,_0x515ef9){_0x515ef9=_0x515ef9||0xc8;return function(_0x1d9640){if(_0x1d9640){return _0x532bba[_0xcafa('0x19')](_0x515ef9)[_0xcafa('0x1a')](_0x1d9640);}};}function respondWithFilteredResult(_0x4b1e6c,_0x19d06a){return function(_0x2a9502){if(_0x2a9502){var _0x197980=_0x2a9502['count'],_0xe1667=_0x19d06a[_0xcafa('0x1b')],_0x378fbf=_0x19d06a[_0xcafa('0x1b')]+_0x19d06a[_0xcafa('0x1c')],_0x5eb83b;if(_0x378fbf>=_0x197980){_0x378fbf=_0x197980;_0x5eb83b=0xc8;}else{_0x5eb83b=0xce;}_0x4b1e6c[_0xcafa('0x19')](_0x5eb83b);return _0x4b1e6c[_0xcafa('0x1d')](_0xcafa('0x1e'),_0xe1667+'-'+_0x378fbf+'/'+_0x197980)[_0xcafa('0x1a')](_0x2a9502);}return null;};}function patchUpdates(_0x4f74b){return function(_0x15f5df){try{jsonpatch[_0xcafa('0x1f')](_0x15f5df,_0x4f74b,!![]);}catch(_0x2ddbe4){return BPromise['reject'](_0x2ddbe4);}return _0x15f5df[_0xcafa('0x20')]();};}function saveUpdates(_0x36b726,_0x19d8da){return function(_0x1e6c09){if(_0x1e6c09){return _0x1e6c09['update'](_0x36b726)[_0xcafa('0x21')](function(_0x659482){return _0x659482;});}return null;};}function removeEntity(_0xb1a4b5,_0x9d2e99){return function(_0x2c2ae5){if(_0x2c2ae5){return _0x2c2ae5[_0xcafa('0x22')]()['then'](function(){_0xb1a4b5[_0xcafa('0x19')](0xcc)[_0xcafa('0x23')]();});}};}function handleEntityNotFound(_0xe94291,_0x3c6207){return function(_0x2ab844){if(!_0x2ab844){_0xe94291[_0xcafa('0x18')](0x194);}return _0x2ab844;};}function handleError(_0x5dec02,_0xdcdd69){_0xdcdd69=_0xdcdd69||0x1f4;return function(_0x32a0c6){logger['error'](_0x32a0c6[_0xcafa('0x24')]);if(_0x32a0c6[_0xcafa('0x25')]){delete _0x32a0c6[_0xcafa('0x25')];}_0x5dec02[_0xcafa('0x19')](_0xdcdd69)['send'](_0x32a0c6);};}exports[_0xcafa('0x26')]=function(_0x56d1e6,_0x515380){var _0x46dfae={},_0x3c670b={},_0x15c078={'count':0x0,'rows':[]};var _0x2ed67c=_[_0xcafa('0x27')](db['SmsApplication']['rawAttributes'],function(_0x2d9877){return{'name':_0x2d9877['fieldName'],'type':_0x2d9877[_0xcafa('0x28')][_0xcafa('0x29')]};});_0x3c670b[_0xcafa('0x2a')]=_[_0xcafa('0x27')](_0x2ed67c,_0xcafa('0x25'));_0x3c670b[_0xcafa('0x2b')]=_['keys'](_0x56d1e6[_0xcafa('0x2b')]);_0x3c670b['filters']=_['intersection'](_0x3c670b[_0xcafa('0x2a')],_0x3c670b['query']);_0x46dfae[_0xcafa('0x2c')]=_['intersection'](_0x3c670b[_0xcafa('0x2a')],qs[_0xcafa('0x2d')](_0x56d1e6[_0xcafa('0x2b')][_0xcafa('0x2d')]));_0x46dfae['attributes']=_0x46dfae[_0xcafa('0x2c')][_0xcafa('0x2e')]?_0x46dfae[_0xcafa('0x2c')]:_0x3c670b[_0xcafa('0x2a')];if(!_0x56d1e6[_0xcafa('0x2b')]['hasOwnProperty']('nolimit')){_0x46dfae[_0xcafa('0x1c')]=qs[_0xcafa('0x1c')](_0x56d1e6[_0xcafa('0x2b')][_0xcafa('0x1c')]);_0x46dfae[_0xcafa('0x1b')]=qs['offset'](_0x56d1e6[_0xcafa('0x2b')][_0xcafa('0x1b')]);}_0x46dfae[_0xcafa('0x2f')]=qs['sort'](_0x56d1e6[_0xcafa('0x2b')]['sort']);_0x46dfae['where']=qs['filters'](_['pick'](_0x56d1e6[_0xcafa('0x2b')],_0x3c670b[_0xcafa('0x30')]),_0x2ed67c);if(_0x56d1e6['query'][_0xcafa('0x31')]){_0x46dfae[_0xcafa('0x32')]=_[_0xcafa('0x33')](_0x46dfae[_0xcafa('0x32')],{'$or':_[_0xcafa('0x27')](_0x2ed67c,function(_0x30263f){if(_0x30263f[_0xcafa('0x28')]!==_0xcafa('0x34')){var _0x413b4b={};_0x413b4b[_0x30263f['name']]={'$like':'%'+_0x56d1e6[_0xcafa('0x2b')][_0xcafa('0x31')]+'%'};return _0x413b4b;}})});}_0x46dfae=_[_0xcafa('0x33')]({},_0x46dfae,_0x56d1e6[_0xcafa('0x35')]);var _0x37fd4a={'where':_0x46dfae['where']};return db['SmsApplication']['count'](_0x37fd4a)[_0xcafa('0x21')](function(_0x1c92de){_0x15c078[_0xcafa('0x36')]=_0x1c92de;if(_0x56d1e6['query'][_0xcafa('0x37')]){_0x46dfae[_0xcafa('0x38')]=[{'all':!![]}];}return db[_0xcafa('0x39')][_0xcafa('0x3a')](_0x46dfae);})['then'](function(_0x256e81){_0x15c078['rows']=_0x256e81;return _0x15c078;})[_0xcafa('0x21')](respondWithFilteredResult(_0x515380,_0x46dfae))[_0xcafa('0x3b')](handleError(_0x515380,null));};exports[_0xcafa('0x3c')]=function(_0x4559a3,_0x2f5b58){var _0x406f04={'raw':!![],'where':{'id':_0x4559a3['params']['id']}},_0x5ac086={};_0x5ac086['model']=_[_0xcafa('0x3d')](db['SmsApplication'][_0xcafa('0x3e')]);_0x5ac086[_0xcafa('0x2b')]=_[_0xcafa('0x3d')](_0x4559a3[_0xcafa('0x2b')]);_0x5ac086[_0xcafa('0x30')]=_['intersection'](_0x5ac086[_0xcafa('0x2a')],_0x5ac086[_0xcafa('0x2b')]);_0x406f04[_0xcafa('0x2c')]=_['intersection'](_0x5ac086[_0xcafa('0x2a')],qs[_0xcafa('0x2d')](_0x4559a3[_0xcafa('0x2b')][_0xcafa('0x2d')]));_0x406f04['attributes']=_0x406f04[_0xcafa('0x2c')][_0xcafa('0x2e')]?_0x406f04[_0xcafa('0x2c')]:_0x5ac086['model'];if(_0x4559a3[_0xcafa('0x2b')][_0xcafa('0x37')]){_0x406f04[_0xcafa('0x38')]=[{'all':!![]}];}_0x406f04=_[_0xcafa('0x33')]({},_0x406f04,_0x4559a3['options']);return db[_0xcafa('0x39')][_0xcafa('0x3f')](_0x406f04)['then'](handleEntityNotFound(_0x2f5b58,null))[_0xcafa('0x21')](respondWithResult(_0x2f5b58,null))[_0xcafa('0x3b')](handleError(_0x2f5b58,null));};exports['create']=function(_0x283652,_0x5dfccc){return db[_0xcafa('0x39')]['create'](_0x283652[_0xcafa('0x40')],{})[_0xcafa('0x21')](respondWithResult(_0x5dfccc,0xc9))[_0xcafa('0x3b')](handleError(_0x5dfccc,null));};exports[_0xcafa('0x41')]=function(_0x35bc76,_0xa0f1f6){if(_0x35bc76[_0xcafa('0x40')]['id']){delete _0x35bc76[_0xcafa('0x40')]['id'];}return db[_0xcafa('0x39')]['find']({'where':{'id':_0x35bc76[_0xcafa('0x42')]['id']}})[_0xcafa('0x21')](handleEntityNotFound(_0xa0f1f6,null))['then'](saveUpdates(_0x35bc76[_0xcafa('0x40')],null))[_0xcafa('0x21')](respondWithResult(_0xa0f1f6,null))['catch'](handleError(_0xa0f1f6,null));};exports['destroy']=function(_0x57844b,_0x56490d){return db[_0xcafa('0x39')][_0xcafa('0x3f')]({'where':{'id':_0x57844b['params']['id']}})[_0xcafa('0x21')](handleEntityNotFound(_0x56490d,null))[_0xcafa('0x21')](removeEntity(_0x56490d,null))[_0xcafa('0x3b')](handleError(_0x56490d,null));}; \ No newline at end of file +var _0x38c0=['catch','show','params','keys','length','include','merge','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','apply','reject','update','then','destroy','end','sendStatus','stack','name','send','SmsApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','map','VIRTUAL','filter','options','includeAll','rows'];(function(_0x3e280,_0x2fb5d8){var _0x4b9cee=function(_0x43602a){while(--_0x43602a){_0x3e280['push'](_0x3e280['shift']());}};_0x4b9cee(++_0x2fb5d8);}(_0x38c0,0x15e));var _0x038c=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x38c0[_0x8a7e38];return _0x228609;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x038c('0x0'));var rimraf=require(_0x038c('0x1'));var zipdir=require(_0x038c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x038c('0x3'));var moment=require(_0x038c('0x4'));var BPromise=require(_0x038c('0x5'));var Mustache=require(_0x038c('0x6'));var util=require(_0x038c('0x7'));var path=require(_0x038c('0x8'));var sox=require('sox');var csv=require(_0x038c('0x9'));var ejs=require(_0x038c('0xa'));var fs=require('fs');var fs_extra=require(_0x038c('0xb'));var _=require(_0x038c('0xc'));var squel=require('squel');var crypto=require(_0x038c('0xd'));var jsforce=require(_0x038c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x038c('0x9'));var querystring=require('querystring');var Papa=require(_0x038c('0xf'));var Redis=require('ioredis');var authService=require(_0x038c('0x10'));var qs=require(_0x038c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x038c('0x12'));var logger=require(_0x038c('0x13'))('api');var utils=require(_0x038c('0x14'));var config=require(_0x038c('0x15'));var licenseUtil=require(_0x038c('0x16'));var db=require(_0x038c('0x17'))['db'];function respondWithStatusCode(_0x37bf18,_0x5f1156){_0x5f1156=_0x5f1156||0xcc;return function(_0xd5ab2){if(_0xd5ab2){return _0x37bf18['sendStatus'](_0x5f1156);}return _0x37bf18[_0x038c('0x18')](_0x5f1156)['end']();};}function respondWithResult(_0x5a0015,_0x385595){_0x385595=_0x385595||0xc8;return function(_0x1dd3ec){if(_0x1dd3ec){return _0x5a0015[_0x038c('0x18')](_0x385595)['json'](_0x1dd3ec);}};}function respondWithFilteredResult(_0xe4393e,_0x12adde){return function(_0x588f69){if(_0x588f69){var _0x111c49=_0x588f69[_0x038c('0x19')],_0x5085e6=_0x12adde[_0x038c('0x1a')],_0xf213b8=_0x12adde[_0x038c('0x1a')]+_0x12adde['limit'],_0x4c0d43;if(_0xf213b8>=_0x111c49){_0xf213b8=_0x111c49;_0x4c0d43=0xc8;}else{_0x4c0d43=0xce;}_0xe4393e[_0x038c('0x18')](_0x4c0d43);return _0xe4393e['set']('Content-Range',_0x5085e6+'-'+_0xf213b8+'/'+_0x111c49)['json'](_0x588f69);}return null;};}function patchUpdates(_0x4626c7){return function(_0x64e77e){try{jsonpatch[_0x038c('0x1b')](_0x64e77e,_0x4626c7,!![]);}catch(_0x2419ee){return BPromise[_0x038c('0x1c')](_0x2419ee);}return _0x64e77e['save']();};}function saveUpdates(_0x27d909,_0x22bdd4){return function(_0x440d3d){if(_0x440d3d){return _0x440d3d[_0x038c('0x1d')](_0x27d909)[_0x038c('0x1e')](function(_0x5c2f2b){return _0x5c2f2b;});}return null;};}function removeEntity(_0x590e8c,_0x337881){return function(_0x4771bd){if(_0x4771bd){return _0x4771bd[_0x038c('0x1f')]()[_0x038c('0x1e')](function(){_0x590e8c[_0x038c('0x18')](0xcc)[_0x038c('0x20')]();});}};}function handleEntityNotFound(_0x1910bd,_0x3860d9){return function(_0x5d795c){if(!_0x5d795c){_0x1910bd[_0x038c('0x21')](0x194);}return _0x5d795c;};}function handleError(_0x4a85c6,_0x217490){_0x217490=_0x217490||0x1f4;return function(_0x41ea29){logger['error'](_0x41ea29[_0x038c('0x22')]);if(_0x41ea29[_0x038c('0x23')]){delete _0x41ea29['name'];}_0x4a85c6[_0x038c('0x18')](_0x217490)[_0x038c('0x24')](_0x41ea29);};}exports['index']=function(_0x21dad6,_0x20ff21){var _0x34fe83={},_0x3f3cdc={},_0xd5fe42={'count':0x0,'rows':[]};var _0x53f71c=_['map'](db[_0x038c('0x25')][_0x038c('0x26')],function(_0x1bc70a){return{'name':_0x1bc70a[_0x038c('0x27')],'type':_0x1bc70a[_0x038c('0x28')]['key']};});_0x3f3cdc[_0x038c('0x29')]=_['map'](_0x53f71c,_0x038c('0x23'));_0x3f3cdc[_0x038c('0x2a')]=_['keys'](_0x21dad6[_0x038c('0x2a')]);_0x3f3cdc[_0x038c('0x2b')]=_[_0x038c('0x2c')](_0x3f3cdc[_0x038c('0x29')],_0x3f3cdc[_0x038c('0x2a')]);_0x34fe83[_0x038c('0x2d')]=_['intersection'](_0x3f3cdc[_0x038c('0x29')],qs['fields'](_0x21dad6[_0x038c('0x2a')][_0x038c('0x2e')]));_0x34fe83['attributes']=_0x34fe83[_0x038c('0x2d')]['length']?_0x34fe83['attributes']:_0x3f3cdc[_0x038c('0x29')];if(!_0x21dad6[_0x038c('0x2a')]['hasOwnProperty'](_0x038c('0x2f'))){_0x34fe83['limit']=qs[_0x038c('0x30')](_0x21dad6[_0x038c('0x2a')]['limit']);_0x34fe83[_0x038c('0x1a')]=qs['offset'](_0x21dad6['query']['offset']);}_0x34fe83[_0x038c('0x31')]=qs[_0x038c('0x32')](_0x21dad6[_0x038c('0x2a')][_0x038c('0x32')]);_0x34fe83['where']=qs['filters'](_['pick'](_0x21dad6['query'],_0x3f3cdc['filters']),_0x53f71c);if(_0x21dad6[_0x038c('0x2a')]['filter']){_0x34fe83[_0x038c('0x33')]=_['merge'](_0x34fe83[_0x038c('0x33')],{'$or':_[_0x038c('0x34')](_0x53f71c,function(_0x2af9b8){if(_0x2af9b8[_0x038c('0x28')]!==_0x038c('0x35')){var _0x261a70={};_0x261a70[_0x2af9b8[_0x038c('0x23')]]={'$like':'%'+_0x21dad6[_0x038c('0x2a')][_0x038c('0x36')]+'%'};return _0x261a70;}})});}_0x34fe83=_['merge']({},_0x34fe83,_0x21dad6[_0x038c('0x37')]);var _0x26fd38={'where':_0x34fe83[_0x038c('0x33')]};return db[_0x038c('0x25')][_0x038c('0x19')](_0x26fd38)[_0x038c('0x1e')](function(_0xfebb80){_0xd5fe42[_0x038c('0x19')]=_0xfebb80;if(_0x21dad6[_0x038c('0x2a')][_0x038c('0x38')]){_0x34fe83['include']=[{'all':!![]}];}return db[_0x038c('0x25')]['findAll'](_0x34fe83);})[_0x038c('0x1e')](function(_0x232cca){_0xd5fe42[_0x038c('0x39')]=_0x232cca;return _0xd5fe42;})[_0x038c('0x1e')](respondWithFilteredResult(_0x20ff21,_0x34fe83))[_0x038c('0x3a')](handleError(_0x20ff21,null));};exports[_0x038c('0x3b')]=function(_0x4a18e4,_0x441fc9){var _0x40a7e1={'raw':!![],'where':{'id':_0x4a18e4[_0x038c('0x3c')]['id']}},_0x407f72={};_0x407f72[_0x038c('0x29')]=_[_0x038c('0x3d')](db[_0x038c('0x25')][_0x038c('0x26')]);_0x407f72['query']=_[_0x038c('0x3d')](_0x4a18e4['query']);_0x407f72['filters']=_[_0x038c('0x2c')](_0x407f72['model'],_0x407f72[_0x038c('0x2a')]);_0x40a7e1[_0x038c('0x2d')]=_[_0x038c('0x2c')](_0x407f72[_0x038c('0x29')],qs['fields'](_0x4a18e4[_0x038c('0x2a')][_0x038c('0x2e')]));_0x40a7e1[_0x038c('0x2d')]=_0x40a7e1[_0x038c('0x2d')][_0x038c('0x3e')]?_0x40a7e1[_0x038c('0x2d')]:_0x407f72['model'];if(_0x4a18e4['query']['includeAll']){_0x40a7e1[_0x038c('0x3f')]=[{'all':!![]}];}_0x40a7e1=_[_0x038c('0x40')]({},_0x40a7e1,_0x4a18e4[_0x038c('0x37')]);return db[_0x038c('0x25')]['find'](_0x40a7e1)[_0x038c('0x1e')](handleEntityNotFound(_0x441fc9,null))['then'](respondWithResult(_0x441fc9,null))[_0x038c('0x3a')](handleError(_0x441fc9,null));};exports['create']=function(_0x2fd4bd,_0x17eefc){return db[_0x038c('0x25')][_0x038c('0x41')](_0x2fd4bd[_0x038c('0x42')],{})[_0x038c('0x1e')](respondWithResult(_0x17eefc,0xc9))['catch'](handleError(_0x17eefc,null));};exports[_0x038c('0x1d')]=function(_0x1923a3,_0x568221){if(_0x1923a3[_0x038c('0x42')]['id']){delete _0x1923a3['body']['id'];}return db['SmsApplication'][_0x038c('0x43')]({'where':{'id':_0x1923a3[_0x038c('0x3c')]['id']}})[_0x038c('0x1e')](handleEntityNotFound(_0x568221,null))[_0x038c('0x1e')](saveUpdates(_0x1923a3[_0x038c('0x42')],null))[_0x038c('0x1e')](respondWithResult(_0x568221,null))[_0x038c('0x3a')](handleError(_0x568221,null));};exports[_0x038c('0x1f')]=function(_0x277d2d,_0x2e444c){return db['SmsApplication']['find']({'where':{'id':_0x277d2d[_0x038c('0x3c')]['id']}})[_0x038c('0x1e')](handleEntityNotFound(_0x2e444c,null))['then'](removeEntity(_0x2e444c,null))['catch'](handleError(_0x2e444c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 41c0bf2..cb4e5ae 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 _0x847a=['moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x51b66f,_0x23c9b0){var _0x545f8f=function(_0x175d84){while(--_0x175d84){_0x51b66f['push'](_0x51b66f['shift']());}};_0x545f8f(++_0x23c9b0);}(_0x847a,0x1e7));var _0xa847=function(_0x118b05,_0x467fb1){_0x118b05=_0x118b05-0x0;var _0x4a50fc=_0x847a[_0x118b05];return _0x4a50fc;};'use strict';var _=require(_0xa847('0x0'));var util=require('util');var logger=require(_0xa847('0x1'))(_0xa847('0x2'));var moment=require(_0xa847('0x3'));var BPromise=require(_0xa847('0x4'));var rp=require(_0xa847('0x5'));var fs=require('fs');var path=require(_0xa847('0x6'));var rimraf=require(_0xa847('0x7'));var config=require('../../config/environment');var attributes=require(_0xa847('0x8'));module[_0xa847('0x9')]=function(_0x1db7d2,_0x1b4626){return _0x1db7d2[_0xa847('0xa')]('SmsApplication',attributes,{'tableName':_0xa847('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa847('0xc'),'collate':_0xa847('0xd')});}; \ No newline at end of file +var _0x8321=['moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x510cd9,_0x551300){var _0x2b1f61=function(_0x345249){while(--_0x345249){_0x510cd9['push'](_0x510cd9['shift']());}};_0x2b1f61(++_0x551300);}(_0x8321,0x1ec));var _0x1832=function(_0x36369e,_0x23583c){_0x36369e=_0x36369e-0x0;var _0x36c3bc=_0x8321[_0x36369e];return _0x36c3bc;};'use strict';var _=require(_0x1832('0x0'));var util=require('util');var logger=require(_0x1832('0x1'))(_0x1832('0x2'));var moment=require(_0x1832('0x3'));var BPromise=require('bluebird');var rp=require(_0x1832('0x4'));var fs=require('fs');var path=require(_0x1832('0x5'));var rimraf=require(_0x1832('0x6'));var config=require(_0x1832('0x7'));var attributes=require(_0x1832('0x8'));module[_0x1832('0x9')]=function(_0x59c324,_0x233c96){return _0x59c324[_0x1832('0xa')](_0x1832('0xb'),attributes,{'tableName':_0x1832('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1832('0xd'),'collate':_0x1832('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2235a68..e2896f9 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 _0x1561=['request\x20sent','debug','error','code','message','result','catch','SmsApplication,\x20%s,\x20%s','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3d87ad,_0x118690){var _0xbadd7e=function(_0x1b9e9b){while(--_0x1b9e9b){_0x3d87ad['push'](_0x3d87ad['shift']());}};_0xbadd7e(++_0x118690);}(_0x1561,0x1bd));var _0x1156=function(_0x7b81e2,_0x3ecde5){_0x7b81e2=_0x7b81e2-0x0;var _0x5675ca=_0x1561[_0x7b81e2];return _0x5675ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1156('0x0'));var BPromise=require(_0x1156('0x1'));var rs=require(_0x1156('0x2'));var fs=require('fs');var Redis=require(_0x1156('0x3'));var db=require(_0x1156('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1156('0x5'))(_0x1156('0x6'));var config=require(_0x1156('0x7'));var jayson=require(_0x1156('0x8'));var client=jayson['client'][_0x1156('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a7048,_0x372fe0,_0x6c3476){return new BPromise(function(_0x273b53,_0x2a7693){return client[_0x1156('0xa')](_0x4a7048,_0x6c3476)['then'](function(_0x2a5914){logger['info']('SmsApplication,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'));logger[_0x1156('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'),JSON['stringify'](_0x2a5914));if(_0x2a5914[_0x1156('0xd')]){if(_0x2a5914['error'][_0x1156('0xe')]===0x1f4){logger[_0x1156('0xd')]('SmsApplication,\x20%s,\x20%s',_0x372fe0,_0x2a5914['error'][_0x1156('0xf')]);return _0x2a7693(_0x2a5914['error'][_0x1156('0xf')]);}logger[_0x1156('0xd')]('SmsApplication,\x20%s,\x20%s',_0x372fe0,_0x2a5914['error'][_0x1156('0xf')]);return _0x273b53(_0x2a5914[_0x1156('0xd')][_0x1156('0xf')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'));_0x273b53(_0x2a5914[_0x1156('0x10')][_0x1156('0xf')]);}})[_0x1156('0x11')](function(_0x6889c9){logger[_0x1156('0xd')](_0x1156('0x12'),_0x372fe0,_0x6889c9);_0x2a7693(_0x6889c9);});});} \ No newline at end of file +var _0x37c5=['../../config/environment','client','http','request','info','SmsApplication,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1323af,_0x38397f){var _0x4b94c0=function(_0x33688f){while(--_0x33688f){_0x1323af['push'](_0x1323af['shift']());}};_0x4b94c0(++_0x38397f);}(_0x37c5,0xa7));var _0x537c=function(_0x17b394,_0x51b761){_0x17b394=_0x17b394-0x0;var _0x54ab16=_0x37c5[_0x17b394];return _0x54ab16;};'use strict';var _=require('lodash');var util=require(_0x537c('0x0'));var moment=require(_0x537c('0x1'));var BPromise=require(_0x537c('0x2'));var rs=require(_0x537c('0x3'));var fs=require('fs');var Redis=require(_0x537c('0x4'));var db=require(_0x537c('0x5'))['db'];var utils=require(_0x537c('0x6'));var logger=require(_0x537c('0x7'))(_0x537c('0x8'));var config=require(_0x537c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x537c('0xa')][_0x537c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x336920,_0x57666f,_0x36bf4a){return new BPromise(function(_0x67f986,_0x32b9c7){return client[_0x537c('0xc')](_0x336920,_0x36bf4a)['then'](function(_0x2c2f06){logger[_0x537c('0xd')](_0x537c('0xe'),_0x57666f,'request\x20sent');logger[_0x537c('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x57666f,'request\x20sent',JSON[_0x537c('0x10')](_0x2c2f06));if(_0x2c2f06['error']){if(_0x2c2f06[_0x537c('0x11')][_0x537c('0x12')]===0x1f4){logger[_0x537c('0x11')](_0x537c('0xe'),_0x57666f,_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);return _0x32b9c7(_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);}logger[_0x537c('0x11')]('SmsApplication,\x20%s,\x20%s',_0x57666f,_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);return _0x67f986(_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);}else{logger[_0x537c('0xd')](_0x537c('0xe'),_0x57666f,_0x537c('0x14'));_0x67f986(_0x2c2f06[_0x537c('0x15')][_0x537c('0x13')]);}})['catch'](function(_0x3ae729){logger['error']('SmsApplication,\x20%s,\x20%s',_0x57666f,_0x3ae729);_0x32b9c7(_0x3ae729);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index d127c0d..eb36f37 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 _0xbedb=['/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','/:id/download','download','post','addMessage'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbbed('0x0'));var util=require('util');var path=require(_0xbbed('0x1'));var timeout=require(_0xbbed('0x2'));var express=require(_0xbbed('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbbed('0x4'));var interaction=require(_0xbbed('0x5'));var config=require(_0xbbed('0x6'));var controller=require(_0xbbed('0x7'));router[_0xbbed('0x8')]('/',auth[_0xbbed('0x9')](),controller[_0xbbed('0xa')]);router[_0xbbed('0x8')](_0xbbed('0xb'),auth[_0xbbed('0x9')](),controller['describe']);router[_0xbbed('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbbed('0xc')]);router[_0xbbed('0x8')](_0xbbed('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbbed('0x8')](_0xbbed('0xe'),auth[_0xbbed('0x9')](),controller[_0xbbed('0xf')]);router[_0xbbed('0x10')]('/',auth[_0xbbed('0x9')](),controller['create']);router[_0xbbed('0x10')]('/:id/messages',auth[_0xbbed('0x9')](),controller[_0xbbed('0x11')]);router[_0xbbed('0x10')](_0xbbed('0x12'),auth[_0xbbed('0x9')](),interaction[_0xbbed('0x13')](_0xbbed('0x14'),_0xbbed('0x15')),controller[_0xbbed('0x16')]);router[_0xbbed('0x17')]('/:id',auth[_0xbbed('0x9')](),interaction['tracked'](_0xbbed('0x14'),_0xbbed('0x18')),controller[_0xbbed('0x19')]);router[_0xbbed('0x1a')](_0xbbed('0x1b'),auth['isAuthenticated'](),interaction[_0xbbed('0x13')](_0xbbed('0x14'),_0xbbed('0x1c')),controller[_0xbbed('0x1d')]);router[_0xbbed('0x1a')](_0xbbed('0x12'),auth[_0xbbed('0x9')](),controller[_0xbbed('0x1e')]);module[_0xbbed('0x1f')]=router; \ No newline at end of file +var _0x1883=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','smsinteraction:addtags','tracked','sms','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags'];(function(_0x2f9aa4,_0x271029){var _0x238054=function(_0x4d2dd6){while(--_0x4d2dd6){_0x2f9aa4['push'](_0x2f9aa4['shift']());}};_0x238054(++_0x271029);}(_0x1883,0xab));var _0x3188=function(_0x3cdc20,_0xe82773){_0x3cdc20=_0x3cdc20-0x0;var _0x40f4db=_0x1883[_0x3cdc20];return _0x40f4db;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['describe']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['get'](_0x3188('0x11'),auth[_0x3188('0xc')](),controller[_0x3188('0x12')]);router[_0x3188('0xb')]('/:id/download',auth[_0x3188('0xc')](),controller[_0x3188('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3188('0x14')]);router[_0x3188('0x15')](_0x3188('0x11'),auth[_0x3188('0xc')](),controller[_0x3188('0x16')]);router[_0x3188('0x15')]('/:id/tags',auth[_0x3188('0xc')](),interaction['tracked']('sms',_0x3188('0x17')),controller['addTags']);router['put'](_0x3188('0xf'),auth[_0x3188('0xc')](),interaction[_0x3188('0x18')](_0x3188('0x19'),_0x3188('0x1a')),controller[_0x3188('0x1b')]);router['delete'](_0x3188('0xf'),auth[_0x3188('0xc')](),interaction[_0x3188('0x18')](_0x3188('0x19'),_0x3188('0x1c')),controller[_0x3188('0x1d')]);router[_0x3188('0x1e')](_0x3188('0x1f'),auth['isAuthenticated'](),controller[_0x3188('0x20')]);module[_0x3188('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 30d4290..52b7305 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 _0x2fa2=['out','sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x2fa2,0x6a));var _0x22fa=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x2fa2[_0x28578d];return _0x524826;};'use strict';var Sequelize=require(_0x22fa('0x0'));var moment=require(_0x22fa('0x1'));module['exports']={'closed':{'type':Sequelize[_0x22fa('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x22fa('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x22fa('0x4')]},'thirdDisposition':{'type':Sequelize[_0x22fa('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x22fa('0x4')]},'read1stAt':{'type':Sequelize[_0x22fa('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x22fa('0x5')]('in',_0x22fa('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x22fa('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x22fa('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0ce7=['out','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x18b584,_0x500f59){var _0x27205d=function(_0x21adfb){while(--_0x21adfb){_0x18b584['push'](_0x18b584['shift']());}};_0x27205d(++_0x500f59);}(_0x0ce7,0x9d));var _0x70ce=function(_0x8a37b3,_0x35aae4){_0x8a37b3=_0x8a37b3-0x0;var _0x59f3f5=_0x0ce7[_0x8a37b3];return _0x59f3f5;};'use strict';var Sequelize=require(_0x70ce('0x0'));var moment=require(_0x70ce('0x1'));module['exports']={'closed':{'type':Sequelize[_0x70ce('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x70ce('0x3')]},'disposition':{'type':Sequelize[_0x70ce('0x4')]},'secondDisposition':{'type':Sequelize[_0x70ce('0x4')]},'thirdDisposition':{'type':Sequelize[_0x70ce('0x4')]},'note':{'type':Sequelize[_0x70ce('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x70ce('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x70ce('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 168d58d..56866bb 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 _0x502a=['./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','rawAttributes','type','key','keys','intersection','model','query','attributes','fields','length','limit','order','sort','where','filters','field','color','tools_tags','select','u.id','u.fullname','user_has_sms_interactions','left_join','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','i.SmsAccountId\x20IS\x20NULL','agent','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','toString','groupBy','SmsInteractionId','all','rows','show','SmsInteraction','includeAll','options','create','params','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','closed','closedAt','disposition','out','System','renderFile','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x502a,0xd8));var _0xa502=function(_0x34bcc9,_0x645375){_0x34bcc9=_0x34bcc9-0x0;var _0x44f1df=_0x502a[_0x34bcc9];return _0x44f1df;};'use strict';var pdf=require(_0xa502('0x0'));var emlformat=require(_0xa502('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa502('0x2'));var jsonpatch=require(_0xa502('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa502('0x4'));var Mustache=require('mustache');var util=require(_0xa502('0x5'));var path=require(_0xa502('0x6'));var sox=require(_0xa502('0x7'));var csv=require(_0xa502('0x8'));var ejs=require(_0xa502('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa502('0xa'));var squel=require(_0xa502('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa502('0xc'));var toCsv=require(_0xa502('0x8'));var querystring=require('querystring');var Papa=require(_0xa502('0xd'));var Redis=require(_0xa502('0xe'));var authService=require(_0xa502('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa502('0x10'));var hardwareService=require(_0xa502('0x11'));var logger=require(_0xa502('0x12'))('api');var utils=require(_0xa502('0x13'));var config=require(_0xa502('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa502('0x15'))['db'];config[_0xa502('0x16')]=_['defaults'](config[_0xa502('0x16')],{'host':_0xa502('0x17'),'port':0x18eb});var socket=require(_0xa502('0x18'))(new Redis(config['redis']));require(_0xa502('0x19'))[_0xa502('0x1a')](socket);function respondWithStatusCode(_0x234c56,_0x491822){_0x491822=_0x491822||0xcc;return function(_0x2db786){if(_0x2db786){return _0x234c56[_0xa502('0x1b')](_0x491822);}return _0x234c56[_0xa502('0x1c')](_0x491822)[_0xa502('0x1d')]();};}function respondWithResult(_0x15b8d8,_0x1e6823){_0x1e6823=_0x1e6823||0xc8;return function(_0x3107a0){if(_0x3107a0){return _0x15b8d8[_0xa502('0x1c')](_0x1e6823)[_0xa502('0x1e')](_0x3107a0);}};}function respondWithFilteredResult(_0x2e87fe,_0x1445ec){return function(_0x315455){if(_0x315455){var _0x1d2f3d=_0x315455[_0xa502('0x1f')],_0x166453=_0x1445ec[_0xa502('0x20')],_0x11645d=_0x1445ec['offset']+_0x1445ec['limit'],_0x13bf82;if(_0x11645d>=_0x1d2f3d){_0x11645d=_0x1d2f3d;_0x13bf82=0xc8;}else{_0x13bf82=0xce;}_0x2e87fe[_0xa502('0x1c')](_0x13bf82);return _0x2e87fe[_0xa502('0x21')](_0xa502('0x22'),_0x166453+'-'+_0x11645d+'/'+_0x1d2f3d)[_0xa502('0x1e')](_0x315455);}return null;};}function patchUpdates(_0x3cd020){return function(_0x404d39){try{jsonpatch[_0xa502('0x23')](_0x404d39,_0x3cd020,!![]);}catch(_0x75c45c){return BPromise[_0xa502('0x24')](_0x75c45c);}return _0x404d39[_0xa502('0x25')]();};}function saveUpdates(_0x35c50b,_0x1d40e1){return function(_0x565564){if(_0x565564){return _0x565564[_0xa502('0x26')](_0x35c50b)[_0xa502('0x27')](function(_0x28bc20){return _0x28bc20;});}return null;};}function removeEntity(_0x1fd61d,_0x570f23){return function(_0x10f7e8){if(_0x10f7e8){return _0x10f7e8[_0xa502('0x28')]()['then'](function(){_0x1fd61d['status'](0xcc)[_0xa502('0x1d')]();});}};}function handleEntityNotFound(_0x5e3694,_0xe7bf2){return function(_0x387ab5){if(!_0x387ab5){_0x5e3694['sendStatus'](0x194);}return _0x387ab5;};}function handleError(_0x2e9811,_0x1fa8ff){_0x1fa8ff=_0x1fa8ff||0x1f4;return function(_0x576609){logger[_0xa502('0x29')](_0x576609[_0xa502('0x2a')]);if(_0x576609[_0xa502('0x2b')]){delete _0x576609['name'];}_0x2e9811['status'](_0x1fa8ff)['send'](_0x576609);};}function getInteractionUsers(_0x1fcede,_0x34f7fa){return new BPromise(function(_0x5da3c1,_0x595e57){try{if(_0x34f7fa[_0x1fcede['id']]){_0x1fcede[_0xa502('0x2c')]=_[_0xa502('0x2d')](_0x34f7fa[_0x1fcede['id']],function(_0x4fccea){return{'id':_0x4fccea['id'],'fullname':_0x4fccea[_0xa502('0x2e')]};});}}catch(_0x1f56be){_0x595e57(_0x1f56be);}_0x5da3c1(_0x1fcede);});}function getInteractionTags(_0x5e56b6,_0xd1e939){return new BPromise(function(_0x3e4a98,_0x377596){try{if(_0x5e56b6[_0xa502('0x2f')]){_0x5e56b6['Tags']=[];_0x5e56b6['TagIds'][_0xa502('0x30')](',')[_0xa502('0x31')](function(_0x2489bd){_0x5e56b6[_0xa502('0x32')][_0xa502('0x33')](_0xd1e939[_0x2489bd]);});}delete _0x5e56b6[_0xa502('0x2f')];}catch(_0x2bbfed){_0x377596(_0x2bbfed);}_0x3e4a98(_0x5e56b6);});}function updateSmsInteraction(_0x546166,_0x552bb9,_0x3ef456){return new BPromise(function(_0x566b20,_0x174b7c){return getInteractionUsers(_0x546166,_0x3ef456)[_0xa502('0x27')](function(_0x2dc5c8){return getInteractionTags(_0x2dc5c8,_0x552bb9);})[_0xa502('0x27')](function(_0x57ed1d){_0x566b20(_0x57ed1d);})[_0xa502('0x34')](function(_0x10cf39){_0x174b7c(_0x10cf39);});});}exports[_0xa502('0x35')]=function(_0x21ce73,_0x54310f){var _0x4c7a64={},_0xa90496={},_0x1a3ef1={'count':0x0,'rows':[]};var _0x396496=_[_0xa502('0x2d')](db['SmsInteraction'][_0xa502('0x36')],function(_0x411a1a){return{'name':_0x411a1a['fieldName'],'type':_0x411a1a[_0xa502('0x37')][_0xa502('0x38')]};});_0xa90496['model']=_[_0xa502('0x2d')](_0x396496,_0xa502('0x2b'));_0xa90496['query']=_[_0xa502('0x39')](_0x21ce73['query']);_0xa90496['filters']=_[_0xa502('0x3a')](_0xa90496[_0xa502('0x3b')],_0xa90496[_0xa502('0x3c')]);_0x4c7a64[_0xa502('0x3d')]=_[_0xa502('0x3a')](_0xa90496['model'],qs[_0xa502('0x3e')](_0x21ce73[_0xa502('0x3c')][_0xa502('0x3e')]));_0x4c7a64[_0xa502('0x3d')]=_0x4c7a64['attributes'][_0xa502('0x3f')]?_0x4c7a64[_0xa502('0x3d')]:_0xa90496[_0xa502('0x3b')];if(!_0x21ce73[_0xa502('0x3c')]['hasOwnProperty']('nolimit')){_0x4c7a64[_0xa502('0x40')]=qs[_0xa502('0x40')](_0x21ce73[_0xa502('0x3c')]['limit']);_0x4c7a64[_0xa502('0x20')]=qs['offset'](_0x21ce73['query'][_0xa502('0x20')]);}_0x4c7a64[_0xa502('0x41')]=qs[_0xa502('0x42')](_0x21ce73[_0xa502('0x3c')][_0xa502('0x42')]);_0x4c7a64[_0xa502('0x43')]=qs['filters'](_['pick'](_0x21ce73[_0xa502('0x3c')],_0xa90496[_0xa502('0x44')]),_0x396496);var _0x34e057=[];var _0x542abc=squel['select']()[_0xa502('0x45')]('id')[_0xa502('0x45')](_0xa502('0x2b'))[_0xa502('0x45')](_0xa502('0x46'))['from'](_0xa502('0x47'));var _0x4f6afe=squel[_0xa502('0x48')]()['field'](_0xa502('0x49'))[_0xa502('0x45')](_0xa502('0x4a'))[_0xa502('0x45')]('ui.SmsInteractionId')['from'](_0xa502('0x4b'),'ui')[_0xa502('0x4c')]('users','u','u.id\x20=\x20ui.UserId');var _0x1b2bba=squel[_0xa502('0x48')]()['from'](_0xa502('0x4d'),'i')[_0xa502('0x4c')]('cm_contacts','c',_0xa502('0x4e'))[_0xa502('0x4c')](_0xa502('0x4f'),'o',_0xa502('0x50'))[_0xa502('0x4c')]('sms_accounts','a',_0xa502('0x51'))[_0xa502('0x4c')](_0xa502('0x52'),'me','me.SmsInteractionId\x20=\x20i.id')['left_join']('sms_interaction_has_tags','it',_0xa502('0x53'))[_0xa502('0x4c')](_0xa502('0x47'),'t',_0xa502('0x54'));var _0x5b729f=squel[_0xa502('0x55')]();var _0x1e459c=[];var _0x7105b3=squel[_0xa502('0x55')]();var _0x1de7c5;if(_0x21ce73['query'][_0xa502('0x56')]){_0x1de7c5=as[_0xa502('0x57')](_0x21ce73['query'][_0xa502('0x56')]);var _0x57de8c=_0x1de7c5[_0xa502('0x58')];for(var _0x9328e9=0x0;_0x9328e9<_0x1de7c5[_0xa502('0x59')][_0xa502('0x3f')];_0x9328e9++){var _0x3017b5=_0x1de7c5[_0xa502('0x59')][_0x9328e9];var _0x1adb4e='i';var _0x297323=_[_0xa502('0x5a')](_0x396496,['name',_0x3017b5['field']]);if(!_0x297323){switch(_0x3017b5['field']){case _0xa502('0x5b'):if(_0x3017b5['value']==0x1){_0x1b2bba[_0xa502('0x5c')]('`'+_0x3017b5[_0xa502('0x45')]+'`\x20=\x200');}else{_0x1b2bba[_0xa502('0x5c')]('`'+_0x3017b5[_0xa502('0x45')]+_0xa502('0x5d'));}break;case _0xa502('0x5e'):if(_0x3017b5[_0xa502('0x5f')]===_0xa502('0x60')){if(_0x3017b5[_0xa502('0x61')][_0xa502('0x30')]('\x20')[_0xa502('0x3f')]>0x1){_0x5b729f[_0x57de8c](_0xa502('0x62'),qs[_0xa502('0x63')](_0x3017b5[_0xa502('0x61')]),null);}else{var _0x513331='%'+_0x3017b5[_0xa502('0x61')]+'%';_0x5b729f[_0x57de8c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x513331,_0x513331,_0x513331);}}else{_0x297323=_[_0xa502('0x5a')](_0x396496,[_0xa502('0x2b'),_0xa502('0x64')]);_0x3017b5['field']=_0xa502('0x64');_0x3593f8=as[_0xa502('0x65')](_0x1adb4e,_0x297323[_0xa502('0x37')],_0x3017b5);_0x5b729f[_0x57de8c](_0x3593f8[_0xa502('0x66')],_0x3593f8[_0xa502('0x61')][_0xa502('0x67')],_0x3593f8[_0xa502('0x61')][_0xa502('0x1d')]);}break;case _0xa502('0x68'):var _0x4a65fa=_0x3017b5[_0xa502('0x61')][_0xa502('0x30')](',')[_0xa502('0x2d')](function(_0x40420b){return Number(_0x40420b);});_0x4a65fa[_0xa502('0x31')](function(_0x2ffb0e){_0x7105b3['or'](_0xa502('0x69'),'%,'+_0x2ffb0e+',%');});_0x1e459c=_[_0xa502('0x6a')](_0x1e459c,_0x4a65fa);break;case _0xa502('0x6b'):if(_0x3017b5['operator']==='$substring'){_0x5b729f[_0x57de8c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3017b5[_0xa502('0x61')]+'%',null);}else{_0x297323=_[_0xa502('0x5a')](_0x396496,[_0xa502('0x2b'),'UserId']);_0x3017b5[_0xa502('0x45')]=_0xa502('0x6c');_0x3593f8=as[_0xa502('0x65')](_0x1adb4e,_0x297323[_0xa502('0x37')],_0x3017b5);_0x5b729f[_0x57de8c](_0x3593f8[_0xa502('0x66')],_0x3593f8[_0xa502('0x61')][_0xa502('0x67')],_0x3593f8[_0xa502('0x61')][_0xa502('0x1d')]);}break;case _0xa502('0x6d'):_0x3593f8=as[_0xa502('0x65')]('me',null,_0x3017b5);_0x5b729f[_0x57de8c](_0x3593f8['text'],_0x3593f8[_0xa502('0x61')]['start'],_0x3593f8['value'][_0xa502('0x1d')]);break;}}else{var _0x3593f8=as[_0xa502('0x65')](_0x1adb4e,_0x297323['type'],_0x3017b5);_0x5b729f[_0x57de8c](_0x3593f8['text'],_0x3593f8[_0xa502('0x61')][_0xa502('0x67')],_0x3593f8[_0xa502('0x61')][_0xa502('0x1d')]);}}}else{var _0x1c65a0=_(_0x21ce73[_0xa502('0x3c')])[_0xa502('0x39')]()[_0xa502('0x2d')](function(_0x35ae17){return _[_0xa502('0x6e')](_0x396496,[_0xa502('0x2b'),_0x35ae17])?_0x35ae17:undefined;})[_0xa502('0x6f')]()[_0xa502('0x61')]();if(!_['isEmpty'](_0x1c65a0)){_0x1c65a0[_0xa502('0x31')](function(_0x29dc38){if(_0x29dc38===_0xa502('0x70')){_0x1b2bba[_0xa502('0x43')](_0xa502('0x71'),[]['concat'](_0x21ce73[_0xa502('0x3c')][_0x29dc38]));}else if(_0x29dc38===_0xa502('0x72')){var _0x2b011f=JSON['parse'](_0x21ce73['query'][_0x29dc38])['$gte'];var _0x3c7222=JSON[_0xa502('0x73')](_0x21ce73['query'][_0x29dc38])[_0xa502('0x74')];_0x1b2bba[_0xa502('0x43')](_0xa502('0x75'),_0x2b011f,_0x3c7222);}else{if(_0x21ce73[_0xa502('0x3c')][_0x29dc38]===_0xa502('0x76')){_0x1b2bba[_0xa502('0x43')]('i.'+_0x29dc38+'\x20IS\x20NULL');}else{_0x1b2bba['where']('i.'+_0x29dc38+_0xa502('0x77'),_0x21ce73[_0xa502('0x3c')][_0x29dc38]);}}});}if(_0x21ce73[_0xa502('0x3c')][_0xa502('0x78')]){if(_0x21ce73['query'][_0xa502('0x78')]==0x1){_0x1b2bba[_0xa502('0x5c')](_0xa502('0x79'));}else{_0x1b2bba[_0xa502('0x5c')](_0xa502('0x7a'));}}if(_0x21ce73['query']['tag']){_0x1e459c=_[_0xa502('0x7b')](_0x21ce73[_0xa502('0x3c')][_0xa502('0x7c')])?_0x21ce73['query']['tag']:new Array(_0x21ce73[_0xa502('0x3c')][_0xa502('0x7c')]);_0x1e459c['forEach'](function(_0x24086e){_0x7105b3['or'](_0xa502('0x69'),'%,'+_0x24086e+',%');});}if(_0x21ce73[_0xa502('0x3c')][_0xa502('0x7d')]){var _0x66ad37=_0x21ce73['query'][_0xa502('0x7d')][_0xa502('0x7e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x66ad37)){_0x5b729f['or'](_0xa502('0x7f'),_0x66ad37+'%')['or']('i.phone\x20LIKE\x20?',_0x66ad37+'%');}else{_0x5b729f['or'](_0xa502('0x80'),qs['getFullTextValue'](_0x66ad37))['or'](_0xa502('0x81'),_0x66ad37+'%');}}}_0x1b2bba[_0xa502('0x43')](_0x5b729f);_0x1b2bba[_0xa502('0x82')](_0xa502('0x83'));var _0x467b13={'type':db[_0xa502('0x84')][_0xa502('0x85')][_0xa502('0x86')],'raw':!![]};var _0x3d8433=_0x1b2bba['clone']();_0x3d8433['field'](_0xa502('0x83'));_0x3d8433[_0xa502('0x45')](_0xa502('0x87'),_0xa502('0x5b'));if(_0x4c7a64[_0xa502('0x41')]){_0x4c7a64[_0xa502('0x41')][_0xa502('0x31')](function(_0x4be11d){var _0x18ced7=_0x4be11d[0x0]===_0xa502('0x88')?_0x4be11d[0x0]:'i.'+_0x4be11d[0x0];_0x1b2bba[_0xa502('0x41')](_0x18ced7,_0x4be11d[0x1]===_0xa502('0x89')?![]:!![]);});}if(!_[_0xa502('0x8a')](_0x1e459c)){_0x1b2bba[_0xa502('0x5c')](_0x7105b3);_0x3d8433[_0xa502('0x43')](_0xa502('0x8b'),_0x1e459c);}BPromise[_0xa502('0x8c')]()['then'](function(){if(!_0x1de7c5){if(_0x21ce73[_0xa502('0x3c')][_0xa502('0x70')])return;_0x3d8433['where'](_0xa502('0x8d'));_0x1b2bba[_0xa502('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x21ce73[_0xa502('0x8e')][_0xa502('0x8f')]!=='agent')return;return _0x21ce73[_0xa502('0x8e')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xa502('0x27')](function(_0x47accf){if(_[_0xa502('0x8a')](_0x47accf)){_0x3d8433[_0xa502('0x43')](_0xa502('0x90'));_0x1b2bba[_0xa502('0x43')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x3d8433['where'](_0xa502('0x71'),_['map'](_0x47accf,'id'));_0x1b2bba['where'](_0xa502('0x71'),_['map'](_0x47accf,'id'));}});})[_0xa502('0x27')](function(){if(_0x21ce73[_0xa502('0x8e')][_0xa502('0x8f')]===_0xa502('0x91')&&!_0x1de7c5&&!_0x21ce73[_0xa502('0x3c')][_0xa502('0x70')])return[];return db['sequelize']['query'](_0x3d8433['toString'](),_0x467b13);})[_0xa502('0x27')](function(_0x1c9aef){_0x1a3ef1[_0xa502('0x1f')]=_0x1c9aef[_0xa502('0x3f')];if(_0x1a3ef1['count']===0x0)return[];return db['sequelize'][_0xa502('0x3c')](_0x542abc['toString'](),_0x467b13)[_0xa502('0x27')](function(_0x3143ce){_0x34e057=_[_0xa502('0x92')](_0x3143ce,'id');_0x467b13=_[_0xa502('0x93')](_0x467b13,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21ce73[_0xa502('0x3c')][_0xa502('0x3e')]){_0x4c7a64['attributes'][_0xa502('0x31')](function(_0x1ad53b){_0x1b2bba[_0xa502('0x45')]('i.'+_0x1ad53b);});}else{_0x1b2bba[_0xa502('0x45')](_0xa502('0x87'),_0xa502('0x5b'));_0x1b2bba[_0xa502('0x45')](_0xa502('0x94'),_0xa502('0x95'));_0x1b2bba[_0xa502('0x45')](_0xa502('0x96'),_0xa502('0x97'));_0x1b2bba['field'](_0xa502('0x98'),_0xa502('0x88'));_0x1b2bba[_0xa502('0x45')](_0xa502('0x99'));_0x1b2bba[_0xa502('0x45')](_0xa502('0x9a'),_0xa502('0x9b'));_0x1b2bba[_0xa502('0x45')](_0xa502('0x9c'),_0xa502('0x9d'));_0x1b2bba['field'](_0xa502('0x9e'),_0xa502('0x9f'));_0x1b2bba[_0xa502('0x45')](_0xa502('0xa0'),_0xa502('0xa1'));_0x1b2bba[_0xa502('0x45')](_0xa502('0xa2'),_0xa502('0xa3'));_0x1b2bba[_0xa502('0x45')](_0xa502('0xa4'),'Contact.fax');_0x1b2bba[_0xa502('0x45')](_0xa502('0xa5'),_0xa502('0xa6'));_0x1b2bba[_0xa502('0x45')](_0xa502('0xa7'),_0xa502('0xa8'));_0x1b2bba[_0xa502('0x45')](_0xa502('0xa9'),_0xa502('0x2f'));}if(_0x4c7a64[_0xa502('0x40')])_0x1b2bba['limit'](_0x4c7a64[_0xa502('0x40')]);if(_0x4c7a64['offset'])_0x1b2bba['offset'](_0x4c7a64[_0xa502('0x20')]);return db[_0xa502('0xaa')]['query'](_0x1b2bba[_0xa502('0xab')](),_0x467b13);})[_0xa502('0x27')](function(_0x3445a3){_0x4f6afe['where']('ui.SmsInteractionId\x20IN\x20?',_[_0xa502('0x2d')](_0x3445a3,'id'));return db['sequelize'][_0xa502('0x3c')](_0x4f6afe['toString'](),_0x467b13)['then'](function(_0x133328){var _0x3b9d43=_[_0xa502('0xac')](_0x133328,_0xa502('0xad'));var _0x43df47=[];_0x3445a3[_0xa502('0x31')](function(_0x123688){_0x43df47[_0xa502('0x33')](updateSmsInteraction(_0x123688,_0x34e057,_0x3b9d43));});return BPromise[_0xa502('0xae')](_0x43df47);});});})[_0xa502('0x27')](function(_0x1e9dea){_0x1a3ef1[_0xa502('0xaf')]=_0x1e9dea;return _0x1a3ef1;})[_0xa502('0x27')](respondWithFilteredResult(_0x54310f,_0x4c7a64))[_0xa502('0x34')](handleError(_0x54310f,null));};exports[_0xa502('0xb0')]=function(_0x6a306b,_0x2ebe9f){var _0x155965={'raw':![],'where':{'id':_0x6a306b['params']['id']}},_0xc01c1b={};_0xc01c1b[_0xa502('0x3b')]=_['keys'](db[_0xa502('0xb1')][_0xa502('0x36')]);_0xc01c1b[_0xa502('0x3c')]=_[_0xa502('0x39')](_0x6a306b['query']);_0xc01c1b[_0xa502('0x44')]=_[_0xa502('0x3a')](_0xc01c1b[_0xa502('0x3b')],_0xc01c1b[_0xa502('0x3c')]);_0x155965[_0xa502('0x3d')]=_['intersection'](_0xc01c1b[_0xa502('0x3b')],qs[_0xa502('0x3e')](_0x6a306b[_0xa502('0x3c')]['fields']));_0x155965[_0xa502('0x3d')]=_0x155965[_0xa502('0x3d')][_0xa502('0x3f')]?_0x155965[_0xa502('0x3d')]:_0xc01c1b[_0xa502('0x3b')];if(_0x6a306b[_0xa502('0x3c')][_0xa502('0xb2')]){_0x155965['include']=[{'all':!![]}];}_0x155965=_[_0xa502('0x93')]({},_0x155965,_0x6a306b[_0xa502('0xb3')]);return db['SmsInteraction'][_0xa502('0x5a')](_0x155965)[_0xa502('0x27')](handleEntityNotFound(_0x2ebe9f,null))[_0xa502('0x27')](respondWithResult(_0x2ebe9f,null))['catch'](handleError(_0x2ebe9f,null));};exports[_0xa502('0xb4')]=function(_0xe35b35,_0x6728){return db[_0xa502('0xb1')]['create'](_0xe35b35[_0xa502('0x6d')],{})['then'](respondWithResult(_0x6728,0xc9))['catch'](handleError(_0x6728,null));};exports['update']=function(_0xd7118,_0x468242){if(_0xd7118[_0xa502('0x6d')]['id']){delete _0xd7118[_0xa502('0x6d')]['id'];}return db['SmsInteraction'][_0xa502('0x5a')]({'where':{'id':_0xd7118[_0xa502('0xb5')]['id']}})[_0xa502('0x27')](handleEntityNotFound(_0x468242,null))['then'](saveUpdates(_0xd7118['body'],null))['then'](respondWithResult(_0x468242,null))[_0xa502('0x34')](handleError(_0x468242,null));};exports[_0xa502('0x28')]=function(_0x44da68,_0x7a5539){return db['SmsInteraction'][_0xa502('0x5a')]({'where':{'id':_0x44da68[_0xa502('0xb5')]['id']}})['then'](handleEntityNotFound(_0x7a5539,null))[_0xa502('0x27')](removeEntity(_0x7a5539,null))[_0xa502('0x34')](handleError(_0x7a5539,null));};exports[_0xa502('0xb6')]=function(_0x21b94b,_0x119320){return db['SmsInteraction'][_0xa502('0xb6')]()[_0xa502('0x27')](respondWithResult(_0x119320,null))[_0xa502('0x34')](handleError(_0x119320,null));};exports[_0xa502('0xb7')]=function(_0x4a9501,_0x234349,_0x9329c0){return db[_0xa502('0xb8')][_0xa502('0x5a')]({'where':{'id':_0x4a9501[_0xa502('0xb5')]['id']}})[_0xa502('0x27')](handleEntityNotFound(_0x234349,null))[_0xa502('0x27')](function(_0xc8e486){if(_0xc8e486){return _0xc8e486[_0xa502('0xb7')](_0x4a9501['body'][_0xa502('0xb9')],_[_0xa502('0xba')](_0x4a9501['body'],[_0xa502('0xb9'),'id'])||{});}})[_0xa502('0x27')](respondWithResult(_0x234349,null))['catch'](handleError(_0x234349,null));};exports['getMessages']=function(_0x345af0,_0x4d629b,_0x8790e){var _0x4077f9={'raw':![],'where':{}};var _0xcc4eab={};var _0x2a4788={'count':0x0,'rows':[]};return db[_0xa502('0xb1')][_0xa502('0xbb')]({'where':{'id':_0x345af0['params']['id']}})[_0xa502('0x27')](handleEntityNotFound(_0x4d629b,null))[_0xa502('0x27')](function(_0x2d9c07){if(_0x2d9c07){_0xcc4eab[_0xa502('0x3b')]=_['keys'](db['SmsMessage'][_0xa502('0x36')]);_0xcc4eab[_0xa502('0x3c')]=_['keys'](_0x345af0[_0xa502('0x3c')]);_0xcc4eab[_0xa502('0x44')]=_[_0xa502('0x3a')](_0xcc4eab[_0xa502('0x3b')],_0xcc4eab['query']);_0x4077f9['attributes']=_['intersection'](_0xcc4eab['model'],qs[_0xa502('0x3e')](_0x345af0[_0xa502('0x3c')][_0xa502('0x3e')]));_0x4077f9[_0xa502('0x3d')]=_0x4077f9[_0xa502('0x3d')][_0xa502('0x3f')]?_0x4077f9[_0xa502('0x3d')]:_0xcc4eab[_0xa502('0x3b')];if(!_0x345af0[_0xa502('0x3c')][_0xa502('0xbc')](_0xa502('0xbd'))){_0x4077f9[_0xa502('0x40')]=qs[_0xa502('0x40')](_0x345af0[_0xa502('0x3c')]['limit']);_0x4077f9[_0xa502('0x20')]=qs[_0xa502('0x20')](_0x345af0[_0xa502('0x3c')][_0xa502('0x20')]);}_0x4077f9[_0xa502('0x41')]=qs[_0xa502('0x42')](_0x345af0[_0xa502('0x3c')]['sort']);_0x4077f9['where']=qs[_0xa502('0x44')](_[_0xa502('0xbe')](_0x345af0[_0xa502('0x3c')],_0xcc4eab[_0xa502('0x44')]));_0x4077f9[_0xa502('0x43')]['SmsInteractionId']=_0x2d9c07['id'];if(_0x345af0['query'][_0xa502('0x7d')]){_0x4077f9[_0xa502('0x43')]=_[_0xa502('0x93')](_0x4077f9['where'],{'$or':_['map'](_0x4077f9['attributes'],function(_0x5dade4){var _0xb97819={};_0xb97819[_0x5dade4]={'$like':'%'+_0x345af0['query']['filter']+'%'};return _0xb97819;})});}if(_0x345af0[_0xa502('0x3c')]['$gte']){var _0x394040=_0x345af0[_0xa502('0x3c')][_0xa502('0xbf')]['split'](',');var _0x497b13={};_0x497b13[_0x394040[0x0]]={'$gte':moment(_0x394040[0x1])[_0xa502('0xc0')](_0xa502('0xc1'))};_0x4077f9[_0xa502('0x43')]=_[_0xa502('0x93')](_0x4077f9[_0xa502('0x43')],_0x497b13);}_0x4077f9=_[_0xa502('0x93')]({},_0x4077f9,_0x345af0['options']);return db[_0xa502('0xb8')][_0xa502('0x1f')]({'where':_0x4077f9['where']})[_0xa502('0x27')](function(_0x5de407){_0x2a4788['count']=_0x5de407;if(_0x345af0['query']['includeAll']){_0x4077f9[_0xa502('0xc2')]=[{'all':!![]}];}return db[_0xa502('0xb8')][_0xa502('0xc3')](_0x4077f9);})[_0xa502('0x27')](function(_0xec4cc){_0x2a4788[_0xa502('0xaf')]=_0xec4cc;return _0x2a4788;});}})[_0xa502('0x27')](respondWithFilteredResult(_0x4d629b,_0x4077f9))[_0xa502('0x34')](handleError(_0x4d629b,null));};exports[_0xa502('0xc4')]=function(_0x5a0d79,_0x38bb39,_0x4665dd){return db[_0xa502('0xb1')]['find']({'where':{'id':_0x5a0d79[_0xa502('0xb5')]['id']}})[_0xa502('0x27')](handleEntityNotFound(_0x38bb39,null))[_0xa502('0x27')](function(_0x27954a){if(_0x27954a){return _0x27954a[_0xa502('0xc5')](_0x5a0d79[_0xa502('0x6d')]['ids'],_['omit'](_0x5a0d79['body'],[_0xa502('0xb9'),'id'])||{})['spread'](function(){return db[_0xa502('0x68')][_0xa502('0xc3')]({'attributes':['id',_0xa502('0x2b'),_0xa502('0x46')],'where':{'id':_0x5a0d79[_0xa502('0x6d')][_0xa502('0xb9')]}});})[_0xa502('0x27')](function(_0x3d9733){socket[_0xa502('0xc6')]('smsInteractionTags:save',{'id':Number(_0x5a0d79[_0xa502('0xb5')]['id']),'tags':_0x3d9733||[]});return{'id':Number(_0x5a0d79[_0xa502('0xb5')]['id']),'tags':_0x3d9733||[]};});}})[_0xa502('0x27')](respondWithResult(_0x38bb39,null))['catch'](handleError(_0x38bb39,null));};exports['removeTags']=function(_0x363361,_0x3bb6e8,_0x5c0878){return db[_0xa502('0xb1')][_0xa502('0x5a')]({'where':{'id':_0x363361[_0xa502('0xb5')]['id']}})['then'](handleEntityNotFound(_0x3bb6e8,null))[_0xa502('0x27')](function(_0x1ef72f){if(_0x1ef72f){return _0x1ef72f[_0xa502('0xc7')](_0x363361[_0xa502('0x3c')][_0xa502('0xb9')]);}})[_0xa502('0x27')](respondWithStatusCode(_0x3bb6e8,null))['catch'](handleError(_0x3bb6e8,null));};exports[_0xa502('0xc8')]=function(_0x24d002,_0x691874){var _0x49eb42=moment()[_0xa502('0xc9')]()[_0xa502('0xab')]();var _0x5b6d44=path[_0xa502('0xca')](config[_0xa502('0xcb')],_0xa502('0xcc'),_0xa502('0xcd'),_0xa502('0xce'));var _0x6463bc=path[_0xa502('0xca')](config[_0xa502('0xcb')],_0xa502('0xcc'),_0xa502('0xcd'),_0xa502('0xcf'));var _0x46bb63=path[_0xa502('0xca')](_0x5b6d44,_0x49eb42);var _0x286892=util[_0xa502('0xc0')](_0xa502('0xd0'),_0x24d002[_0xa502('0xb5')]['id'],_0x49eb42);var _0x58cc67=path[_0xa502('0xca')](_0x5b6d44,_0x286892);var _0xa9fab6=[];_0xa9fab6[_0xa502('0x33')]({'model':db['User'],'as':_0xa502('0x6b'),'attributes':['id',_0xa502('0x2e')],'raw':!![]});_0xa9fab6[_0xa502('0x33')]({'model':db[_0xa502('0xd1')],'as':_0xa502('0x5e'),'attributes':['id',_0xa502('0xd2'),_0xa502('0xd3')],'raw':!![]});var _0x511ce0=[{'model':db['SmsMessage'],'as':_0xa502('0xd4'),'attributes':['id',_0xa502('0x6d'),_0xa502('0x72'),_0xa502('0xd5'),_0xa502('0xd6'),_0xa502('0x78')],'include':_0xa9fab6}];_0x511ce0['push']({'model':db[_0xa502('0xd7')],'as':_0xa502('0xd8'),'attributes':['id',_0xa502('0x2b')]});_0x511ce0[_0xa502('0x33')]({'model':db['User'],'as':_0xa502('0xd9'),'attributes':['id','fullname']});return db[_0xa502('0xb1')][_0xa502('0x5a')]({'where':{'id':_0x24d002[_0xa502('0xb5')]['id']},'include':_0x511ce0})['then'](handleEntityNotFound(_0x691874,null))['then'](function(_0x263818){if(_0x263818){var _0x1470a9=_0x263818[_0xa502('0xda')]({'plain':!![]});fs[_0xa502('0xdb')](_0x46bb63);var _0x2055f5={'format':'A4','border':_0xa502('0xdc'),'header':{'height':_0xa502('0xdd'),'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':_0xa502('0xde'),'contents':{'default':util[_0xa502('0xc0')](_0xa502('0xdf'),util[_0xa502('0xc0')](_0xa502('0xe0'),_0xa502('0xe1'),_0x1470a9['id']),moment()[_0xa502('0xc0')](_0xa502('0xe2'))[_0xa502('0xab')]())}}};var _0x517c4e={'channel':'Sms','account':_0x1470a9[_0xa502('0xd8')][_0xa502('0x2b')],'agent':_0x1470a9[_0xa502('0xd9')]?_0x1470a9[_0xa502('0xd9')][_0xa502('0x2e')]:_0xa502('0xe3'),'createdAt':moment(_0x1470a9['createdAt'])[_0xa502('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa502('0xab')](),'closedAt':_0x1470a9[_0xa502('0xe4')]?moment(_0x1470a9[_0xa502('0xe5')])[_0xa502('0xc0')](_0xa502('0xc1'))[_0xa502('0xab')]():'','disposition':_0x1470a9[_0xa502('0xe6')],'messages':_(_0x1470a9[_0xa502('0xd4')])[_0xa502('0x7d')]({'secret':![]})[_0xa502('0x2d')](function(_0x33e745){return{'date':moment(_0x33e745[_0xa502('0x72')])[_0xa502('0xc0')](_0xa502('0xc1'))['toString'](),'sender':_0x33e745[_0xa502('0xd5')]===_0xa502('0xe7')?_0x33e745[_0xa502('0x6b')]?_0x33e745[_0xa502('0x6b')][_0xa502('0x2e')]:_0xa502('0xe8'):_0x33e745[_0xa502('0x5e')][_0xa502('0xd2')]+(_0x33e745[_0xa502('0x5e')][_0xa502('0xd3')]?'\x20'+_0x33e745[_0xa502('0x5e')][_0xa502('0xd3')]:''),'body':_0x33e745[_0xa502('0x6d')],'direction':_0x33e745[_0xa502('0xd5')]==='out'?'A':'C','secret':_0x33e745[_0xa502('0xd6')],'read':_0x33e745['read']};})[_0xa502('0x61')]()};return ejs[_0xa502('0xe9')](path[_0xa502('0xca')](config[_0xa502('0xcb')],_0xa502('0xcc'),_0xa502('0xea'),'downloadInteraction.html'),{'interaction':_0x517c4e})['then'](function(_0x336903){return new BPromise(function(_0xd2baca,_0x20ada5){pdf['create'](_0x336903,_0x2055f5)[_0xa502('0xeb')](path[_0xa502('0xca')](_0x46bb63,_0xa502('0xec')+_0x1470a9['id']+'-'+_0x49eb42+_0xa502('0xed')),function(_0x25759e,_0x36d7e3){if(_0x25759e)return _0x20ada5(_0x25759e);_0xd2baca(_0x36d7e3);});});})[_0xa502('0x27')](function(){return new BPromise(function(_0x4321de,_0xdf6da5){zipdir(_0x46bb63,{'saveTo':_0x58cc67},function(_0x3ff831,_0x26226a){if(_0x3ff831)return _0xdf6da5(_0x3ff831);return _0x4321de(_0x26226a);});})[_0xa502('0x27')](function(){return new BPromise(function(_0x18c3a9,_0x1a848b){rimraf(_0x46bb63,function(_0xae82da){if(_0xae82da)_0x1a848b(_0xae82da);return _0x18c3a9();});});})[_0xa502('0x27')](function(){return _0x691874[_0xa502('0xc8')](_0x58cc67,_0x286892,function(_0x4abd8b){if(_0x4abd8b){console[_0xa502('0xee')](_0xa502('0xef'),_0x4abd8b);}else{fs[_0xa502('0xf0')](_0x58cc67);}});});});}else{return _0x691874[_0xa502('0x1b')](0xc8);}})[_0xa502('0x34')](handleError(_0x691874,null));}; \ No newline at end of file +var _0x20a8=['SmsMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','addTags','omit','Tag','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','SmsAccount','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','N.A.','closed','disposition','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','push','catch','index','SmsInteraction','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','keys','some','isEmpty','forEach','SmsAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','includeAll','include','options','create','body','params','describe','addMessage'];(function(_0x114ed1,_0x1a60d3){var _0xc1a58=function(_0x3afd63){while(--_0x3afd63){_0x114ed1['push'](_0x114ed1['shift']());}};_0xc1a58(++_0x1a60d3);}(_0x20a8,0x115));var _0x820a=function(_0x44f805,_0x1faf63){_0x44f805=_0x44f805-0x0;var _0x71419e=_0x20a8[_0x44f805];return _0x71419e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x820a('0x0'));var jsonpatch=require(_0x820a('0x1'));var rp=require(_0x820a('0x2'));var moment=require(_0x820a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x820a('0x4'));var util=require(_0x820a('0x5'));var path=require('path');var sox=require(_0x820a('0x6'));var csv=require(_0x820a('0x7'));var ejs=require(_0x820a('0x8'));var fs=require('fs');var fs_extra=require(_0x820a('0x9'));var _=require(_0x820a('0xa'));var squel=require(_0x820a('0xb'));var crypto=require(_0x820a('0xc'));var jsforce=require(_0x820a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x820a('0x7'));var querystring=require(_0x820a('0xe'));var Papa=require(_0x820a('0xf'));var Redis=require(_0x820a('0x10'));var authService=require(_0x820a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x820a('0x12'));var logger=require(_0x820a('0x13'))('api');var utils=require(_0x820a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x820a('0x15'));var db=require(_0x820a('0x16'))['db'];config['redis']=_['defaults'](config[_0x820a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x820a('0x18'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2ad20c,_0x547067){_0x547067=_0x547067||0xcc;return function(_0x5930e6){if(_0x5930e6){return _0x2ad20c[_0x820a('0x19')](_0x547067);}return _0x2ad20c[_0x820a('0x1a')](_0x547067)[_0x820a('0x1b')]();};}function respondWithResult(_0x52697b,_0x4b828e){_0x4b828e=_0x4b828e||0xc8;return function(_0xcf1e10){if(_0xcf1e10){return _0x52697b['status'](_0x4b828e)[_0x820a('0x1c')](_0xcf1e10);}};}function respondWithFilteredResult(_0x204f81,_0x1e633d){return function(_0x28e792){if(_0x28e792){var _0x1b4e63=_0x28e792[_0x820a('0x1d')],_0x225564=_0x1e633d['offset'],_0x587608=_0x1e633d[_0x820a('0x1e')]+_0x1e633d[_0x820a('0x1f')],_0x4a3411;if(_0x587608>=_0x1b4e63){_0x587608=_0x1b4e63;_0x4a3411=0xc8;}else{_0x4a3411=0xce;}_0x204f81[_0x820a('0x1a')](_0x4a3411);return _0x204f81[_0x820a('0x20')]('Content-Range',_0x225564+'-'+_0x587608+'/'+_0x1b4e63)[_0x820a('0x1c')](_0x28e792);}return null;};}function patchUpdates(_0x2f7773){return function(_0x270f24){try{jsonpatch[_0x820a('0x21')](_0x270f24,_0x2f7773,!![]);}catch(_0x15204e){return BPromise[_0x820a('0x22')](_0x15204e);}return _0x270f24[_0x820a('0x23')]();};}function saveUpdates(_0x24ef35,_0x3a4a2c){return function(_0x13966d){if(_0x13966d){return _0x13966d[_0x820a('0x24')](_0x24ef35)['then'](function(_0x2a509a){return _0x2a509a;});}return null;};}function removeEntity(_0x116224,_0x4f0b7b){return function(_0x1e5891){if(_0x1e5891){return _0x1e5891[_0x820a('0x25')]()[_0x820a('0x26')](function(){_0x116224[_0x820a('0x1a')](0xcc)[_0x820a('0x1b')]();});}};}function handleEntityNotFound(_0x45b65f,_0x3063f4){return function(_0x2bb0a9){if(!_0x2bb0a9){_0x45b65f[_0x820a('0x19')](0x194);}return _0x2bb0a9;};}function handleError(_0x4ef0eb,_0x42af10){_0x42af10=_0x42af10||0x1f4;return function(_0x59160e){logger[_0x820a('0x27')](_0x59160e[_0x820a('0x28')]);if(_0x59160e[_0x820a('0x29')]){delete _0x59160e[_0x820a('0x29')];}_0x4ef0eb[_0x820a('0x1a')](_0x42af10)[_0x820a('0x2a')](_0x59160e);};}function getInteractionUsers(_0x1ff836,_0x57027b){return new BPromise(function(_0x2a7833,_0x47d5b4){try{if(_0x57027b[_0x1ff836['id']]){_0x1ff836['Users']=_['map'](_0x57027b[_0x1ff836['id']],function(_0x4cd356){return{'id':_0x4cd356['id'],'fullname':_0x4cd356[_0x820a('0x2b')]};});}}catch(_0x23d345){_0x47d5b4(_0x23d345);}_0x2a7833(_0x1ff836);});}function getInteractionTags(_0xfc09f1,_0xb67fe8){return new BPromise(function(_0x1d2da3,_0x7383e4){try{if(_0xfc09f1[_0x820a('0x2c')]){_0xfc09f1[_0x820a('0x2d')]=[];_0xfc09f1[_0x820a('0x2c')][_0x820a('0x2e')](',')['forEach'](function(_0xaa7329){_0xfc09f1[_0x820a('0x2d')][_0x820a('0x2f')](_0xb67fe8[_0xaa7329]);});}delete _0xfc09f1[_0x820a('0x2c')];}catch(_0x2b0cc6){_0x7383e4(_0x2b0cc6);}_0x1d2da3(_0xfc09f1);});}function updateSmsInteraction(_0xbec609,_0x5b22e7,_0x5abb03){return new BPromise(function(_0x137c33,_0x10c15a){return getInteractionUsers(_0xbec609,_0x5abb03)['then'](function(_0x4e11eb){return getInteractionTags(_0x4e11eb,_0x5b22e7);})[_0x820a('0x26')](function(_0x24de54){_0x137c33(_0x24de54);})[_0x820a('0x30')](function(_0x293042){_0x10c15a(_0x293042);});});}exports[_0x820a('0x31')]=function(_0x5f065d,_0x184560){var _0x16476a={},_0x46e5bf={},_0x27e006={'count':0x0,'rows':[]};var _0x451e9f=_['map'](db[_0x820a('0x32')][_0x820a('0x33')],function(_0x5a6c4b){return{'name':_0x5a6c4b['fieldName'],'type':_0x5a6c4b[_0x820a('0x34')][_0x820a('0x35')]};});_0x46e5bf[_0x820a('0x36')]=_[_0x820a('0x37')](_0x451e9f,'name');_0x46e5bf['query']=_['keys'](_0x5f065d[_0x820a('0x38')]);_0x46e5bf['filters']=_[_0x820a('0x39')](_0x46e5bf['model'],_0x46e5bf['query']);_0x16476a[_0x820a('0x3a')]=_['intersection'](_0x46e5bf['model'],qs[_0x820a('0x3b')](_0x5f065d[_0x820a('0x38')][_0x820a('0x3b')]));_0x16476a[_0x820a('0x3a')]=_0x16476a['attributes'][_0x820a('0x3c')]?_0x16476a[_0x820a('0x3a')]:_0x46e5bf[_0x820a('0x36')];if(!_0x5f065d['query'][_0x820a('0x3d')](_0x820a('0x3e'))){_0x16476a[_0x820a('0x1f')]=qs[_0x820a('0x1f')](_0x5f065d[_0x820a('0x38')]['limit']);_0x16476a[_0x820a('0x1e')]=qs['offset'](_0x5f065d[_0x820a('0x38')][_0x820a('0x1e')]);}_0x16476a[_0x820a('0x3f')]=qs[_0x820a('0x40')](_0x5f065d[_0x820a('0x38')][_0x820a('0x40')]);_0x16476a[_0x820a('0x41')]=qs[_0x820a('0x42')](_[_0x820a('0x43')](_0x5f065d['query'],_0x46e5bf[_0x820a('0x42')]),_0x451e9f);var _0x296c17=[];var _0x4548c4=squel[_0x820a('0x44')]()[_0x820a('0x45')]('id')[_0x820a('0x45')](_0x820a('0x29'))[_0x820a('0x45')]('color')[_0x820a('0x46')](_0x820a('0x47'));var _0x31d6fc=squel['select']()[_0x820a('0x45')](_0x820a('0x48'))[_0x820a('0x45')](_0x820a('0x49'))[_0x820a('0x45')](_0x820a('0x4a'))['from']('user_has_sms_interactions','ui')[_0x820a('0x4b')](_0x820a('0x4c'),'u',_0x820a('0x4d'));var _0x219fc8=squel[_0x820a('0x44')]()[_0x820a('0x46')]('sms_interactions','i')[_0x820a('0x4b')](_0x820a('0x4e'),'c',_0x820a('0x4f'))['left_join'](_0x820a('0x4c'),'o',_0x820a('0x50'))[_0x820a('0x4b')](_0x820a('0x51'),'a',_0x820a('0x52'))[_0x820a('0x4b')]('sms_messages','me',_0x820a('0x53'))['left_join'](_0x820a('0x54'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x820a('0x4b')](_0x820a('0x47'),'t',_0x820a('0x55'));var _0x1f88b3=squel[_0x820a('0x56')]();var _0x2e4098=[];var _0x59388d=squel['expr']();var _0x1714ca;if(_0x5f065d[_0x820a('0x38')]['search']){_0x1714ca=as[_0x820a('0x57')](_0x5f065d['query'][_0x820a('0x58')]);var _0x4018d6=_0x1714ca[_0x820a('0x59')];for(var _0x3fc5bd=0x0;_0x3fc5bd<_0x1714ca[_0x820a('0x5a')][_0x820a('0x3c')];_0x3fc5bd++){var _0x72c793=_0x1714ca[_0x820a('0x5a')][_0x3fc5bd];var _0x2e1ded='i';var _0x496fe9=_['find'](_0x451e9f,[_0x820a('0x29'),_0x72c793[_0x820a('0x45')]]);if(!_0x496fe9){switch(_0x72c793[_0x820a('0x45')]){case _0x820a('0x5b'):if(_0x72c793['value']==0x1){_0x219fc8[_0x820a('0x5c')]('`'+_0x72c793[_0x820a('0x45')]+_0x820a('0x5d'));}else{_0x219fc8[_0x820a('0x5c')]('`'+_0x72c793[_0x820a('0x45')]+'`\x20>\x200');}break;case _0x820a('0x5e'):if(_0x72c793[_0x820a('0x5f')]===_0x820a('0x60')){if(_0x72c793[_0x820a('0x61')]['split']('\x20')[_0x820a('0x3c')]>0x1){_0x1f88b3[_0x4018d6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x72c793[_0x820a('0x61')]),null);}else{var _0x347dcc='%'+_0x72c793['value']+'%';_0x1f88b3[_0x4018d6](_0x820a('0x62'),_0x347dcc,_0x347dcc,_0x347dcc);}}else{_0x496fe9=_[_0x820a('0x63')](_0x451e9f,[_0x820a('0x29'),_0x820a('0x64')]);_0x72c793[_0x820a('0x45')]=_0x820a('0x64');_0xcbb99f=as[_0x820a('0x65')](_0x2e1ded,_0x496fe9[_0x820a('0x34')],_0x72c793);_0x1f88b3[_0x4018d6](_0xcbb99f[_0x820a('0x66')],_0xcbb99f[_0x820a('0x61')][_0x820a('0x67')],_0xcbb99f[_0x820a('0x61')][_0x820a('0x1b')]);}break;case'Tag':var _0x208dfd=_0x72c793[_0x820a('0x61')]['split'](',')[_0x820a('0x37')](function(_0x15a2bf){return Number(_0x15a2bf);});_0x208dfd['forEach'](function(_0x4c650c){_0x59388d['or'](_0x820a('0x68'),'%,'+_0x4c650c+',%');});_0x2e4098=_['union'](_0x2e4098,_0x208dfd);break;case _0x820a('0x69'):if(_0x72c793[_0x820a('0x5f')]==='$substring'){_0x1f88b3[_0x4018d6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x72c793['value']+'%',null);}else{_0x496fe9=_[_0x820a('0x63')](_0x451e9f,[_0x820a('0x29'),'UserId']);_0x72c793[_0x820a('0x45')]=_0x820a('0x6a');_0xcbb99f=as[_0x820a('0x65')](_0x2e1ded,_0x496fe9['type'],_0x72c793);_0x1f88b3[_0x4018d6](_0xcbb99f['text'],_0xcbb99f['value'][_0x820a('0x67')],_0xcbb99f['value'][_0x820a('0x1b')]);}break;case'body':_0xcbb99f=as[_0x820a('0x65')]('me',null,_0x72c793);_0x1f88b3[_0x4018d6](_0xcbb99f['text'],_0xcbb99f[_0x820a('0x61')][_0x820a('0x67')],_0xcbb99f[_0x820a('0x61')]['end']);break;}}else{var _0xcbb99f=as[_0x820a('0x65')](_0x2e1ded,_0x496fe9['type'],_0x72c793);_0x1f88b3[_0x4018d6](_0xcbb99f[_0x820a('0x66')],_0xcbb99f[_0x820a('0x61')][_0x820a('0x67')],_0xcbb99f['value'][_0x820a('0x1b')]);}}}else{var _0x1f6677=_(_0x5f065d[_0x820a('0x38')])[_0x820a('0x6b')]()[_0x820a('0x37')](function(_0x4cca4e){return _[_0x820a('0x6c')](_0x451e9f,['name',_0x4cca4e])?_0x4cca4e:undefined;})['compact']()['value']();if(!_[_0x820a('0x6d')](_0x1f6677)){_0x1f6677[_0x820a('0x6e')](function(_0x38618c){if(_0x38618c===_0x820a('0x6f')){_0x219fc8[_0x820a('0x41')]('i.SmsAccountId\x20IN\x20?',[][_0x820a('0x70')](_0x5f065d['query'][_0x38618c]));}else if(_0x38618c===_0x820a('0x71')){var _0x2268ed=JSON['parse'](_0x5f065d[_0x820a('0x38')][_0x38618c])[_0x820a('0x72')];var _0x8e6f17=JSON[_0x820a('0x73')](_0x5f065d[_0x820a('0x38')][_0x38618c])[_0x820a('0x74')];_0x219fc8['where'](_0x820a('0x75'),_0x2268ed,_0x8e6f17);}else{if(_0x5f065d[_0x820a('0x38')][_0x38618c]===_0x820a('0x76')){_0x219fc8[_0x820a('0x41')]('i.'+_0x38618c+'\x20IS\x20NULL');}else{_0x219fc8[_0x820a('0x41')]('i.'+_0x38618c+'\x20=\x20?',_0x5f065d['query'][_0x38618c]);}}});}if(_0x5f065d[_0x820a('0x38')][_0x820a('0x77')]){if(_0x5f065d[_0x820a('0x38')][_0x820a('0x77')]==0x1){_0x219fc8[_0x820a('0x5c')](_0x820a('0x78'));}else{_0x219fc8[_0x820a('0x5c')]('`unreadMessages`\x20>\x200');}}if(_0x5f065d[_0x820a('0x38')][_0x820a('0x79')]){_0x2e4098=_['isArray'](_0x5f065d[_0x820a('0x38')]['tag'])?_0x5f065d[_0x820a('0x38')]['tag']:new Array(_0x5f065d['query'][_0x820a('0x79')]);_0x2e4098[_0x820a('0x6e')](function(_0x10c31c){_0x59388d['or'](_0x820a('0x68'),'%,'+_0x10c31c+',%');});}if(_0x5f065d[_0x820a('0x38')]['filter']){var _0x58b971=_0x5f065d[_0x820a('0x38')][_0x820a('0x7a')][_0x820a('0x7b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x820a('0x7c')](_0x58b971)){_0x1f88b3['or'](_0x820a('0x7d'),_0x58b971+'%')['or'](_0x820a('0x7e'),_0x58b971+'%');}else{_0x1f88b3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x820a('0x7f')](_0x58b971))['or'](_0x820a('0x80'),_0x58b971+'%');}}}_0x219fc8[_0x820a('0x41')](_0x1f88b3);_0x219fc8[_0x820a('0x81')]('i.id');var _0x4bc4e7={'type':db[_0x820a('0x82')][_0x820a('0x83')]['SELECT'],'raw':!![]};var _0x4c401f=_0x219fc8['clone']();_0x4c401f[_0x820a('0x45')]('i.id');_0x4c401f['field'](_0x820a('0x84'),_0x820a('0x5b'));if(_0x16476a[_0x820a('0x3f')]){_0x16476a['order']['forEach'](function(_0x316cf7){var _0x3ac51d=_0x316cf7[0x0]==='contactName'?_0x316cf7[0x0]:'i.'+_0x316cf7[0x0];_0x219fc8[_0x820a('0x3f')](_0x3ac51d,_0x316cf7[0x1]===_0x820a('0x85')?![]:!![]);});}if(!_[_0x820a('0x6d')](_0x2e4098)){_0x219fc8[_0x820a('0x5c')](_0x59388d);_0x4c401f[_0x820a('0x41')](_0x820a('0x86'),_0x2e4098);}BPromise[_0x820a('0x87')]()[_0x820a('0x26')](function(){if(!_0x1714ca){if(_0x5f065d[_0x820a('0x38')][_0x820a('0x6f')])return;_0x4c401f['where'](_0x820a('0x88'));_0x219fc8[_0x820a('0x41')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5f065d[_0x820a('0x89')]['role']!==_0x820a('0x8a'))return;return _0x5f065d[_0x820a('0x89')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x820a('0x26')](function(_0x471f19){if(_[_0x820a('0x6d')](_0x471f19)){_0x4c401f[_0x820a('0x41')](_0x820a('0x8b'));_0x219fc8[_0x820a('0x41')](_0x820a('0x8b'));}else{_0x4c401f[_0x820a('0x41')](_0x820a('0x8c'),_[_0x820a('0x37')](_0x471f19,'id'));_0x219fc8[_0x820a('0x41')](_0x820a('0x8c'),_[_0x820a('0x37')](_0x471f19,'id'));}});})['then'](function(){if(_0x5f065d['user']['role']===_0x820a('0x8a')&&!_0x1714ca&&!_0x5f065d['query'][_0x820a('0x6f')])return[];return db[_0x820a('0x8d')]['query'](_0x4c401f[_0x820a('0x8e')](),_0x4bc4e7);})[_0x820a('0x26')](function(_0x14aaa0){_0x27e006[_0x820a('0x1d')]=_0x14aaa0[_0x820a('0x3c')];if(_0x27e006['count']===0x0)return[];return db[_0x820a('0x8d')][_0x820a('0x38')](_0x4548c4[_0x820a('0x8e')](),_0x4bc4e7)[_0x820a('0x26')](function(_0xc6a2f1){_0x296c17=_['keyBy'](_0xc6a2f1,'id');_0x4bc4e7=_[_0x820a('0x8f')](_0x4bc4e7,{'model':db[_0x820a('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5f065d[_0x820a('0x38')][_0x820a('0x3b')]){_0x16476a[_0x820a('0x3a')][_0x820a('0x6e')](function(_0x522ac7){_0x219fc8[_0x820a('0x45')]('i.'+_0x522ac7);});}else{_0x219fc8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x219fc8[_0x820a('0x45')]('a.key',_0x820a('0x90'));_0x219fc8[_0x820a('0x45')](_0x820a('0x91'),_0x820a('0x92'));_0x219fc8[_0x820a('0x45')](_0x820a('0x93'),_0x820a('0x94'));_0x219fc8[_0x820a('0x45')]('i.*');_0x219fc8[_0x820a('0x45')](_0x820a('0x95'),_0x820a('0x96'));_0x219fc8[_0x820a('0x45')](_0x820a('0x97'),'Contact.lastName');_0x219fc8[_0x820a('0x45')]('c.email',_0x820a('0x98'));_0x219fc8[_0x820a('0x45')](_0x820a('0x99'),_0x820a('0x9a'));_0x219fc8[_0x820a('0x45')](_0x820a('0x9b'),'Contact.mobile');_0x219fc8[_0x820a('0x45')](_0x820a('0x9c'),_0x820a('0x9d'));_0x219fc8[_0x820a('0x45')]('o.fullname',_0x820a('0x9e'));_0x219fc8[_0x820a('0x45')](_0x820a('0x9f'),_0x820a('0xa0'));_0x219fc8[_0x820a('0x45')](_0x820a('0xa1'),_0x820a('0x2c'));}if(_0x16476a[_0x820a('0x1f')])_0x219fc8[_0x820a('0x1f')](_0x16476a[_0x820a('0x1f')]);if(_0x16476a[_0x820a('0x1e')])_0x219fc8[_0x820a('0x1e')](_0x16476a[_0x820a('0x1e')]);return db[_0x820a('0x8d')][_0x820a('0x38')](_0x219fc8[_0x820a('0x8e')](),_0x4bc4e7);})['then'](function(_0x168f1b){_0x31d6fc[_0x820a('0x41')]('ui.SmsInteractionId\x20IN\x20?',_[_0x820a('0x37')](_0x168f1b,'id'));return db[_0x820a('0x8d')][_0x820a('0x38')](_0x31d6fc['toString'](),_0x4bc4e7)['then'](function(_0xa5307){var _0x363de7=_[_0x820a('0xa2')](_0xa5307,_0x820a('0xa3'));var _0x320f68=[];_0x168f1b[_0x820a('0x6e')](function(_0xc50ffe){_0x320f68[_0x820a('0x2f')](updateSmsInteraction(_0xc50ffe,_0x296c17,_0x363de7));});return BPromise['all'](_0x320f68);});});})[_0x820a('0x26')](function(_0x24c73c){_0x27e006[_0x820a('0xa4')]=_0x24c73c;return _0x27e006;})['then'](respondWithFilteredResult(_0x184560,_0x16476a))[_0x820a('0x30')](handleError(_0x184560,null));};exports['show']=function(_0x47a786,_0x410d14){var _0x206f6b={'raw':![],'where':{'id':_0x47a786['params']['id']}},_0x2d80f6={};_0x2d80f6[_0x820a('0x36')]=_[_0x820a('0x6b')](db['SmsInteraction']['rawAttributes']);_0x2d80f6[_0x820a('0x38')]=_[_0x820a('0x6b')](_0x47a786[_0x820a('0x38')]);_0x2d80f6[_0x820a('0x42')]=_[_0x820a('0x39')](_0x2d80f6[_0x820a('0x36')],_0x2d80f6[_0x820a('0x38')]);_0x206f6b[_0x820a('0x3a')]=_[_0x820a('0x39')](_0x2d80f6['model'],qs[_0x820a('0x3b')](_0x47a786[_0x820a('0x38')][_0x820a('0x3b')]));_0x206f6b['attributes']=_0x206f6b[_0x820a('0x3a')][_0x820a('0x3c')]?_0x206f6b['attributes']:_0x2d80f6[_0x820a('0x36')];if(_0x47a786['query'][_0x820a('0xa5')]){_0x206f6b[_0x820a('0xa6')]=[{'all':!![]}];}_0x206f6b=_[_0x820a('0x8f')]({},_0x206f6b,_0x47a786[_0x820a('0xa7')]);return db[_0x820a('0x32')][_0x820a('0x63')](_0x206f6b)[_0x820a('0x26')](handleEntityNotFound(_0x410d14,null))[_0x820a('0x26')](respondWithResult(_0x410d14,null))[_0x820a('0x30')](handleError(_0x410d14,null));};exports[_0x820a('0xa8')]=function(_0x3748a4,_0x5b2250){return db[_0x820a('0x32')]['create'](_0x3748a4['body'],{})[_0x820a('0x26')](respondWithResult(_0x5b2250,0xc9))[_0x820a('0x30')](handleError(_0x5b2250,null));};exports[_0x820a('0x24')]=function(_0x30c96d,_0x58530e){if(_0x30c96d[_0x820a('0xa9')]['id']){delete _0x30c96d[_0x820a('0xa9')]['id'];}return db[_0x820a('0x32')][_0x820a('0x63')]({'where':{'id':_0x30c96d[_0x820a('0xaa')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x58530e,null))[_0x820a('0x26')](saveUpdates(_0x30c96d['body'],null))[_0x820a('0x26')](respondWithResult(_0x58530e,null))[_0x820a('0x30')](handleError(_0x58530e,null));};exports[_0x820a('0x25')]=function(_0x2614d2,_0xf0c8bd){return db[_0x820a('0x32')]['find']({'where':{'id':_0x2614d2[_0x820a('0xaa')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0xf0c8bd,null))[_0x820a('0x26')](removeEntity(_0xf0c8bd,null))['catch'](handleError(_0xf0c8bd,null));};exports['describe']=function(_0x128754,_0x433770){return db[_0x820a('0x32')][_0x820a('0xab')]()['then'](respondWithResult(_0x433770,null))[_0x820a('0x30')](handleError(_0x433770,null));};exports[_0x820a('0xac')]=function(_0x81d8d8,_0x4f677f,_0x2a085f){return db[_0x820a('0xad')][_0x820a('0x63')]({'where':{'id':_0x81d8d8[_0x820a('0xaa')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x4f677f,null))[_0x820a('0x26')](function(_0x1c615e){if(_0x1c615e){return _0x1c615e[_0x820a('0xac')](_0x81d8d8[_0x820a('0xa9')]['ids'],_['omit'](_0x81d8d8['body'],[_0x820a('0xae'),'id'])||{});}})[_0x820a('0x26')](respondWithResult(_0x4f677f,null))[_0x820a('0x30')](handleError(_0x4f677f,null));};exports[_0x820a('0xaf')]=function(_0x248898,_0x5e0ba6,_0x228b5d){var _0x39cf65={'raw':![],'where':{}};var _0x3274c6={};var _0x2eca95={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x820a('0xb0')]({'where':{'id':_0x248898[_0x820a('0xaa')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x5e0ba6,null))[_0x820a('0x26')](function(_0x555550){if(_0x555550){_0x3274c6[_0x820a('0x36')]=_[_0x820a('0x6b')](db['SmsMessage']['rawAttributes']);_0x3274c6[_0x820a('0x38')]=_[_0x820a('0x6b')](_0x248898[_0x820a('0x38')]);_0x3274c6['filters']=_[_0x820a('0x39')](_0x3274c6[_0x820a('0x36')],_0x3274c6[_0x820a('0x38')]);_0x39cf65[_0x820a('0x3a')]=_[_0x820a('0x39')](_0x3274c6[_0x820a('0x36')],qs[_0x820a('0x3b')](_0x248898['query']['fields']));_0x39cf65['attributes']=_0x39cf65[_0x820a('0x3a')][_0x820a('0x3c')]?_0x39cf65[_0x820a('0x3a')]:_0x3274c6[_0x820a('0x36')];if(!_0x248898[_0x820a('0x38')]['hasOwnProperty'](_0x820a('0x3e'))){_0x39cf65[_0x820a('0x1f')]=qs['limit'](_0x248898[_0x820a('0x38')][_0x820a('0x1f')]);_0x39cf65['offset']=qs[_0x820a('0x1e')](_0x248898[_0x820a('0x38')]['offset']);}_0x39cf65['order']=qs[_0x820a('0x40')](_0x248898[_0x820a('0x38')]['sort']);_0x39cf65[_0x820a('0x41')]=qs[_0x820a('0x42')](_['pick'](_0x248898['query'],_0x3274c6['filters']));_0x39cf65[_0x820a('0x41')]['SmsInteractionId']=_0x555550['id'];if(_0x248898[_0x820a('0x38')][_0x820a('0x7a')]){_0x39cf65['where']=_['merge'](_0x39cf65[_0x820a('0x41')],{'$or':_['map'](_0x39cf65['attributes'],function(_0xde9f39){var _0x92947a={};_0x92947a[_0xde9f39]={'$like':'%'+_0x248898[_0x820a('0x38')][_0x820a('0x7a')]+'%'};return _0x92947a;})});}if(_0x248898[_0x820a('0x38')][_0x820a('0x72')]){var _0x140be2=_0x248898['query'][_0x820a('0x72')][_0x820a('0x2e')](',');var _0x17c96d={};_0x17c96d[_0x140be2[0x0]]={'$gte':moment(_0x140be2[0x1])['format'](_0x820a('0xb1'))};_0x39cf65['where']=_[_0x820a('0x8f')](_0x39cf65[_0x820a('0x41')],_0x17c96d);}_0x39cf65=_[_0x820a('0x8f')]({},_0x39cf65,_0x248898[_0x820a('0xa7')]);return db['SmsMessage'][_0x820a('0x1d')]({'where':_0x39cf65[_0x820a('0x41')]})[_0x820a('0x26')](function(_0x30b21b){_0x2eca95[_0x820a('0x1d')]=_0x30b21b;if(_0x248898['query']['includeAll']){_0x39cf65[_0x820a('0xa6')]=[{'all':!![]}];}return db[_0x820a('0xad')]['findAll'](_0x39cf65);})['then'](function(_0x91178c){_0x2eca95[_0x820a('0xa4')]=_0x91178c;return _0x2eca95;});}})[_0x820a('0x26')](respondWithFilteredResult(_0x5e0ba6,_0x39cf65))[_0x820a('0x30')](handleError(_0x5e0ba6,null));};exports[_0x820a('0xb2')]=function(_0x23ecdf,_0x2ca809,_0xf05906){return db[_0x820a('0x32')]['find']({'where':{'id':_0x23ecdf[_0x820a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x2ca809,null))[_0x820a('0x26')](function(_0x59fc8e){if(_0x59fc8e){return _0x59fc8e['setTags'](_0x23ecdf[_0x820a('0xa9')]['ids'],_[_0x820a('0xb3')](_0x23ecdf[_0x820a('0xa9')],['ids','id'])||{})['spread'](function(){return db[_0x820a('0xb4')][_0x820a('0xb5')]({'attributes':['id','name',_0x820a('0xb6')],'where':{'id':_0x23ecdf[_0x820a('0xa9')][_0x820a('0xae')]}});})['then'](function(_0x2dce9d){socket[_0x820a('0xb7')](_0x820a('0xb8'),{'id':Number(_0x23ecdf['params']['id']),'tags':_0x2dce9d||[]});return{'id':Number(_0x23ecdf[_0x820a('0xaa')]['id']),'tags':_0x2dce9d||[]};});}})[_0x820a('0x26')](respondWithResult(_0x2ca809,null))[_0x820a('0x30')](handleError(_0x2ca809,null));};exports[_0x820a('0xb9')]=function(_0x6c73f6,_0x4ed094,_0x5ada16){return db[_0x820a('0x32')][_0x820a('0x63')]({'where':{'id':_0x6c73f6[_0x820a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x4ed094,null))[_0x820a('0x26')](function(_0x15983){if(_0x15983){return _0x15983[_0x820a('0xb9')](_0x6c73f6['query'][_0x820a('0xae')]);}})['then'](respondWithStatusCode(_0x4ed094,null))[_0x820a('0x30')](handleError(_0x4ed094,null));};exports[_0x820a('0xba')]=function(_0x35afa9,_0x5537d9){var _0x14d144=moment()[_0x820a('0xbb')]()[_0x820a('0x8e')]();var _0x39a9c0=path[_0x820a('0xbc')](config[_0x820a('0xbd')],_0x820a('0xbe'),_0x820a('0xbf'),_0x820a('0xc0'));var _0x355d87=path[_0x820a('0xbc')](config[_0x820a('0xbd')],_0x820a('0xbe'),'files',_0x820a('0xc1'));var _0x5e42b8=path[_0x820a('0xbc')](_0x39a9c0,_0x14d144);var _0x18ff59=util[_0x820a('0xc2')](_0x820a('0xc3'),_0x35afa9['params']['id'],_0x14d144);var _0x333d13=path[_0x820a('0xbc')](_0x39a9c0,_0x18ff59);var _0x224355=[];_0x224355[_0x820a('0x2f')]({'model':db[_0x820a('0x69')],'as':_0x820a('0x69'),'attributes':['id',_0x820a('0x2b')],'raw':!![]});_0x224355[_0x820a('0x2f')]({'model':db[_0x820a('0xc4')],'as':_0x820a('0x5e'),'attributes':['id',_0x820a('0xc5'),_0x820a('0xc6')],'raw':!![]});var _0x5810e1=[{'model':db[_0x820a('0xad')],'as':_0x820a('0xc7'),'attributes':['id',_0x820a('0xa9'),_0x820a('0x71'),_0x820a('0xc8'),'secret',_0x820a('0x77')],'include':_0x224355}];_0x5810e1[_0x820a('0x2f')]({'model':db[_0x820a('0xc9')],'as':'Account','attributes':['id',_0x820a('0x29')]});_0x5810e1[_0x820a('0x2f')]({'model':db[_0x820a('0x69')],'as':_0x820a('0xca'),'attributes':['id','fullname']});return db[_0x820a('0x32')][_0x820a('0x63')]({'where':{'id':_0x35afa9['params']['id']},'include':_0x5810e1})[_0x820a('0x26')](handleEntityNotFound(_0x5537d9,null))['then'](function(_0x12453f){if(_0x12453f){var _0x56fbab=_0x12453f[_0x820a('0xcb')]({'plain':!![]});fs[_0x820a('0xcc')](_0x5e42b8);var _0x11d8d9={'format':'A4','border':_0x820a('0xcd'),'header':{'height':_0x820a('0xce'),'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':_0x820a('0xcf'),'contents':{'default':util[_0x820a('0xc2')](_0x820a('0xd0'),util[_0x820a('0xc2')]('%s\x20#%d',_0x820a('0xd1'),_0x56fbab['id']),moment()['format'](_0x820a('0xd2'))[_0x820a('0x8e')]())}}};var _0x572ec3={'channel':'Sms','account':_0x56fbab['Account']['name'],'agent':_0x56fbab[_0x820a('0xca')]?_0x56fbab[_0x820a('0xca')][_0x820a('0x2b')]:_0x820a('0xd3'),'createdAt':moment(_0x56fbab[_0x820a('0x71')])[_0x820a('0xc2')](_0x820a('0xb1'))['toString'](),'closedAt':_0x56fbab[_0x820a('0xd4')]?moment(_0x56fbab['closedAt'])[_0x820a('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x820a('0x8e')]():'','disposition':_0x56fbab[_0x820a('0xd5')],'messages':_(_0x56fbab['Messages'])[_0x820a('0x7a')]({'secret':![]})[_0x820a('0x37')](function(_0x53e095){return{'date':moment(_0x53e095['createdAt'])['format'](_0x820a('0xb1'))['toString'](),'sender':_0x53e095['direction']===_0x820a('0xd6')?_0x53e095[_0x820a('0x69')]?_0x53e095[_0x820a('0x69')][_0x820a('0x2b')]:_0x820a('0xd7'):_0x53e095[_0x820a('0x5e')][_0x820a('0xc5')]+(_0x53e095[_0x820a('0x5e')][_0x820a('0xc6')]?'\x20'+_0x53e095[_0x820a('0x5e')]['lastName']:''),'body':_0x53e095[_0x820a('0xa9')],'direction':_0x53e095[_0x820a('0xc8')]===_0x820a('0xd6')?'A':'C','secret':_0x53e095[_0x820a('0xd8')],'read':_0x53e095[_0x820a('0x77')]};})['value']()};return ejs[_0x820a('0xd9')](path[_0x820a('0xbc')](config[_0x820a('0xbd')],'server',_0x820a('0xda'),_0x820a('0xdb')),{'interaction':_0x572ec3})[_0x820a('0x26')](function(_0x466b38){return new BPromise(function(_0x25d679,_0x4107a4){pdf['create'](_0x466b38,_0x11d8d9)[_0x820a('0xdc')](path[_0x820a('0xbc')](_0x5e42b8,_0x820a('0xdd')+_0x56fbab['id']+'-'+_0x14d144+_0x820a('0xde')),function(_0x50dab2,_0x3049e8){if(_0x50dab2)return _0x4107a4(_0x50dab2);_0x25d679(_0x3049e8);});});})[_0x820a('0x26')](function(){return new BPromise(function(_0x21c793,_0xda97aa){zipdir(_0x5e42b8,{'saveTo':_0x333d13},function(_0x224500,_0x31ffe7){if(_0x224500)return _0xda97aa(_0x224500);return _0x21c793(_0x31ffe7);});})[_0x820a('0x26')](function(){return new BPromise(function(_0x2cc75f,_0x9b7e35){rimraf(_0x5e42b8,function(_0x4b2878){if(_0x4b2878)_0x9b7e35(_0x4b2878);return _0x2cc75f();});});})[_0x820a('0x26')](function(){return _0x5537d9[_0x820a('0xba')](_0x333d13,_0x18ff59,function(_0x218bed){if(_0x218bed){console['log'](_0x820a('0xdf'),_0x218bed);}else{fs[_0x820a('0xe0')](_0x333d13);}});});});}else{return _0x5537d9[_0x820a('0x19')](0xc8);}})[_0x820a('0x30')](handleError(_0x5537d9,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index b2a7415..62265ed 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 _0xc03e=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove','getUsers','then','Users','map','findAll','setDataValue'];(function(_0x19f451,_0x4b5e9b){var _0x376db5=function(_0x29b5d6){while(--_0x29b5d6){_0x19f451['push'](_0x19f451['shift']());}};_0x376db5(++_0x4b5e9b);}(_0xc03e,0x15a));var _0xec03=function(_0x493c8c,_0x470567){_0x493c8c=_0x493c8c-0x0;var _0x17344b=_0xc03e[_0x493c8c];return _0x17344b;};'use strict';var EventEmitter=require(_0xec03('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0xec03('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xec03('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xec03('0x3'),'afterDestroy':_0xec03('0x4')};function emitEvent(_0x3e3a78){return function(_0x194e54,_0xeb6c4d,_0x1ce78a){_0x194e54[_0xec03('0x5')]({'attributes':['id'],'raw':!![]})[_0xec03('0x6')](function(_0x278f90){_0x194e54['setDataValue'](_0xec03('0x7'),_0x278f90[_0xec03('0x8')](function(_0xde3f78){return{'id':_0xde3f78['id']};}));return SmsMessage[_0xec03('0x9')]({'where':{'SmsInteractionId':_0x194e54['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x375e4a){_0x194e54[_0xec03('0xa')](_0xec03('0xb'),_0x375e4a[_0xec03('0xc')]);SmsInteractionEvents[_0xec03('0xd')](_0x3e3a78+':'+_0x194e54['id'],_0x194e54);SmsInteractionEvents[_0xec03('0xd')](_0x3e3a78,_0x194e54);_0x1ce78a(null);})[_0xec03('0xe')](_0x1ce78a(null));};}for(var e in events){if(events[_0xec03('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xec03('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xe5d5=['length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','SmsMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0xe5d5,0x156));var _0x5e5d=function(_0x113deb,_0x3c7ccc){_0x113deb=_0x113deb-0x0;var _0x1bf0cd=_0xe5d5[_0x113deb];return _0x1bf0cd;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x5e5d('0x0')];var SmsMessage=require('../../mysqldb')['db'][_0x5e5d('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e5d('0x2'),'afterUpdate':'update','afterDestroy':_0x5e5d('0x3')};function emitEvent(_0x191980){return function(_0x32c471,_0x3d014f,_0x13bcb7){_0x32c471[_0x5e5d('0x4')]({'attributes':['id'],'raw':!![]})[_0x5e5d('0x5')](function(_0xab446c){_0x32c471[_0x5e5d('0x6')](_0x5e5d('0x7'),_0xab446c[_0x5e5d('0x8')](function(_0x1fdb77){return{'id':_0x1fdb77['id']};}));return SmsMessage[_0x5e5d('0x9')]({'where':{'SmsInteractionId':_0x32c471['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5e5d('0x5')](function(_0x59917b){_0x32c471[_0x5e5d('0x6')]('unreadMessages',_0x59917b[_0x5e5d('0xa')]);SmsInteractionEvents[_0x5e5d('0xb')](_0x191980+':'+_0x32c471['id'],_0x32c471);SmsInteractionEvents['emit'](_0x191980,_0x32c471);_0x13bcb7(null);})[_0x5e5d('0xc')](_0x13bcb7(null));};}for(var e in events){if(events[_0x5e5d('0xd')](e)){var event=events[e];SmsInteraction[_0x5e5d('0xe')](e,emitEvent(event));}}module[_0x5e5d('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0aa6d83..0d6e980 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 _0x4e45=['SmsInteraction','sms_interactions','closed','closedAt','format','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x4ca677,_0x448f71){var _0x3f12e0=function(_0x1f1fff){while(--_0x1f1fff){_0x4ca677['push'](_0x4ca677['shift']());}};_0x3f12e0(++_0x448f71);}(_0x4e45,0x6e));var _0x54e4=function(_0x465ed5,_0x3f7019){_0x465ed5=_0x465ed5-0x0;var _0x1ae374=_0x4e45[_0x465ed5];return _0x1ae374;};'use strict';var _=require(_0x54e4('0x0'));var util=require(_0x54e4('0x1'));var logger=require(_0x54e4('0x2'))(_0x54e4('0x3'));var moment=require(_0x54e4('0x4'));var BPromise=require('bluebird');var rp=require(_0x54e4('0x5'));var fs=require('fs');var path=require(_0x54e4('0x6'));var rimraf=require(_0x54e4('0x7'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x54e4('0x8')]=function(_0xbe9caa,_0x236236){return _0xbe9caa[_0x54e4('0x9')](_0x54e4('0xa'),attributes,{'tableName':_0x54e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c4feb,_0x4414e0,_0xdaf0d7){if(_0x1c4feb['changed'](_0x54e4('0xc'))){_0x1c4feb[_0x54e4('0xd')]=moment()[_0x54e4('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xdaf0d7(null,_0x1c4feb);}}});}; \ No newline at end of file +var _0xa21a=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions'];(function(_0x43af0d,_0x39a52f){var _0x3f0f2e=function(_0x1b3cab){while(--_0x1b3cab){_0x43af0d['push'](_0x43af0d['shift']());}};_0x3f0f2e(++_0x39a52f);}(_0xa21a,0xf4));var _0xaa21=function(_0xbc33de,_0x1d476b){_0xbc33de=_0xbc33de-0x0;var _0x24a3cc=_0xa21a[_0xbc33de];return _0x24a3cc;};'use strict';var _=require(_0xaa21('0x0'));var util=require(_0xaa21('0x1'));var logger=require(_0xaa21('0x2'))('api');var moment=require(_0xaa21('0x3'));var BPromise=require(_0xaa21('0x4'));var rp=require(_0xaa21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa21('0x6'));var config=require(_0xaa21('0x7'));var attributes=require(_0xaa21('0x8'));module[_0xaa21('0x9')]=function(_0x528a23,_0x5763da){return _0x528a23[_0xaa21('0xa')]('SmsInteraction',attributes,{'tableName':_0xaa21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1fdd9a,_0x83a55f,_0x37faf5){if(_0x1fdd9a['changed'](_0xaa21('0xc'))){_0x1fdd9a[_0xaa21('0xd')]=moment()[_0xaa21('0xe')](_0xaa21('0xf'));}_0x37faf5(null,_0x1fdd9a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4d1d7c3..1cb9101 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 _0x7689=['defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','debug','stringify','AddTagsToSmsInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis'];(function(_0x35d658,_0x34165a){var _0x2f95f4=function(_0x5acccf){while(--_0x5acccf){_0x35d658['push'](_0x35d658['shift']());}};_0x2f95f4(++_0x34165a);}(_0x7689,0x1ac));var _0x9768=function(_0x56f651,_0x31c4d5){_0x56f651=_0x56f651-0x0;var _0x34b880=_0x7689[_0x56f651];return _0x34b880;};'use strict';var _=require(_0x9768('0x0'));var util=require(_0x9768('0x1'));var moment=require(_0x9768('0x2'));var BPromise=require(_0x9768('0x3'));var rs=require(_0x9768('0x4'));var fs=require('fs');var Redis=require(_0x9768('0x5'));var db=require(_0x9768('0x6'))['db'];var utils=require(_0x9768('0x7'));var logger=require('../../config/logger')(_0x9768('0x8'));var config=require(_0x9768('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9768('0xa')]['http']({'port':0x232a});config[_0x9768('0xb')]=_[_0x9768('0xc')](config[_0x9768('0xb')],{'host':_0x9768('0xd'),'port':0x18eb});var socket=require(_0x9768('0xe'))(new Redis(config[_0x9768('0xb')]));require(_0x9768('0xf'))[_0x9768('0x10')](socket);function respondWithRpcPromise(_0x3c5a94,_0x4b6b38,_0x3d49da){return new BPromise(function(_0x4b4154,_0x5e24be){return client[_0x9768('0x11')](_0x3c5a94,_0x3d49da)[_0x9768('0x12')](function(_0xb61813){logger[_0x9768('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x4b6b38,_0x9768('0x14'));logger['debug'](_0x9768('0x15'),_0x4b6b38,'request\x20sent',JSON['stringify'](_0xb61813));if(_0xb61813[_0x9768('0x16')]){if(_0xb61813[_0x9768('0x16')][_0x9768('0x17')]===0x1f4){logger[_0x9768('0x16')](_0x9768('0x18'),_0x4b6b38,_0xb61813[_0x9768('0x16')][_0x9768('0x19')]);return _0x5e24be(_0xb61813[_0x9768('0x16')]['message']);}logger['error'](_0x9768('0x18'),_0x4b6b38,_0xb61813[_0x9768('0x16')][_0x9768('0x19')]);return _0x4b4154(_0xb61813[_0x9768('0x16')][_0x9768('0x19')]);}else{logger[_0x9768('0x13')](_0x9768('0x18'),_0x4b6b38,_0x9768('0x14'));_0x4b4154(_0xb61813[_0x9768('0x1a')][_0x9768('0x19')]);}})[_0x9768('0x1b')](function(_0x375b1a){logger[_0x9768('0x16')](_0x9768('0x18'),_0x4b6b38,_0x375b1a);_0x5e24be(_0x375b1a);});});}exports['UpdateSmsInteraction']=function(_0x3e215c){var _0x36a429=this;return new Promise(function(_0x145b6b,_0x1b706f){return db[_0x9768('0x1c')][_0x9768('0x1d')](_0x3e215c[_0x9768('0x1e')],{'raw':_0x3e215c[_0x9768('0x1f')]?_0x3e215c[_0x9768('0x1f')][_0x9768('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e215c[_0x9768('0x1f')]?_0x3e215c[_0x9768('0x1f')][_0x9768('0x21')]||null:null,'attributes':_0x3e215c[_0x9768('0x1f')]?_0x3e215c[_0x9768('0x1f')][_0x9768('0x22')]||null:null,'limit':_0x3e215c[_0x9768('0x1f')]?_0x3e215c[_0x9768('0x1f')][_0x9768('0x23')]||null:null})[_0x9768('0x12')](function(_0x1d09d7){logger[_0x9768('0x13')](_0x9768('0x24'),_0x3e215c);logger[_0x9768('0x25')]('UpdateSmsInteraction',_0x3e215c,JSON[_0x9768('0x26')](_0x1d09d7));_0x145b6b(_0x1d09d7);})[_0x9768('0x1b')](function(_0x111a3c){logger['error']('UpdateSmsInteraction',_0x111a3c['message'],_0x3e215c);_0x1b706f(_0x36a429['error'](0x1f4,_0x111a3c[_0x9768('0x19')]));});});};exports[_0x9768('0x27')]=function(_0xdb90d3){return new Promise(function(_0x3be6e2,_0x5e237b){return db[_0x9768('0x1c')][_0x9768('0x28')]({'where':_0xdb90d3[_0x9768('0x1f')]?_0xdb90d3[_0x9768('0x1f')][_0x9768('0x21')]||null:null})[_0x9768('0x12')](function(_0x521200){if(_0x521200){return _0x521200[_0x9768('0x29')](_0xdb90d3[_0x9768('0x1e')][_0x9768('0x2a')],_['omit'](_0xdb90d3[_0x9768('0x1e')],[_0x9768('0x2a'),'id'])||{});}})['spread'](function(_0x45b277){logger[_0x9768('0x13')]('AddTags',_0xdb90d3);logger[_0x9768('0x25')]('AddTags',_0xdb90d3,JSON['stringify'](_0x45b277));_0x3be6e2(_0x45b277);})[_0x9768('0x1b')](function(_0x2ed914){logger[_0x9768('0x16')](_0x9768('0x2b'),_0x2ed914[_0x9768('0x19')],_0xdb90d3);_0x5e237b(_this['error'](0x1f4,_0x2ed914[_0x9768('0x19')]));});});}; \ No newline at end of file +var _0x30f4=['options','raw','limit','AddTagsToSmsInteraction','where','addTags','body','ids','omit','spread','AddTags','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateSmsInteraction','update'];(function(_0x461598,_0x4c9a58){var _0x97a7b5=function(_0x2a3404){while(--_0x2a3404){_0x461598['push'](_0x461598['shift']());}};_0x97a7b5(++_0x4c9a58);}(_0x30f4,0xce));var _0x430f=function(_0x300ba2,_0xe84fce){_0x300ba2=_0x300ba2-0x0;var _0x4c780d=_0x30f4[_0x300ba2];return _0x4c780d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x430f('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x430f('0x1'));var db=require(_0x430f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x430f('0x3'))(_0x430f('0x4'));var config=require(_0x430f('0x5'));var jayson=require(_0x430f('0x6'));var client=jayson[_0x430f('0x7')][_0x430f('0x8')]({'port':0x232a});config[_0x430f('0x9')]=_[_0x430f('0xa')](config[_0x430f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x430f('0xb'))(new Redis(config[_0x430f('0x9')]));require(_0x430f('0xc'))[_0x430f('0xd')](socket);function respondWithRpcPromise(_0x2dd8c2,_0x277891,_0x293108){return new BPromise(function(_0x3dc883,_0x19cbbf){return client[_0x430f('0xe')](_0x2dd8c2,_0x293108)[_0x430f('0xf')](function(_0x4b7dcd){logger['info'](_0x430f('0x10'),_0x277891,_0x430f('0x11'));logger[_0x430f('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x277891,_0x430f('0x11'),JSON[_0x430f('0x13')](_0x4b7dcd));if(_0x4b7dcd[_0x430f('0x14')]){if(_0x4b7dcd[_0x430f('0x14')][_0x430f('0x15')]===0x1f4){logger[_0x430f('0x14')](_0x430f('0x10'),_0x277891,_0x4b7dcd[_0x430f('0x14')][_0x430f('0x16')]);return _0x19cbbf(_0x4b7dcd[_0x430f('0x14')][_0x430f('0x16')]);}logger[_0x430f('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x277891,_0x4b7dcd[_0x430f('0x14')][_0x430f('0x16')]);return _0x3dc883(_0x4b7dcd[_0x430f('0x14')][_0x430f('0x16')]);}else{logger[_0x430f('0x17')](_0x430f('0x10'),_0x277891,_0x430f('0x11'));_0x3dc883(_0x4b7dcd[_0x430f('0x18')]['message']);}})[_0x430f('0x19')](function(_0x187418){logger[_0x430f('0x14')](_0x430f('0x10'),_0x277891,_0x187418);_0x19cbbf(_0x187418);});});}exports[_0x430f('0x1a')]=function(_0x61eeda){var _0x212a7d=this;return new Promise(function(_0x64b2b3,_0x1e6227){return db['SmsInteraction'][_0x430f('0x1b')](_0x61eeda['body'],{'raw':_0x61eeda[_0x430f('0x1c')]?_0x61eeda[_0x430f('0x1c')][_0x430f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x61eeda[_0x430f('0x1c')]?_0x61eeda[_0x430f('0x1c')]['where']||null:null,'attributes':_0x61eeda[_0x430f('0x1c')]?_0x61eeda[_0x430f('0x1c')]['attributes']||null:null,'limit':_0x61eeda[_0x430f('0x1c')]?_0x61eeda['options'][_0x430f('0x1e')]||null:null})['then'](function(_0x1b3121){logger[_0x430f('0x17')](_0x430f('0x1a'),_0x61eeda);logger[_0x430f('0x12')](_0x430f('0x1a'),_0x61eeda,JSON[_0x430f('0x13')](_0x1b3121));_0x64b2b3(_0x1b3121);})['catch'](function(_0x3ba01f){logger[_0x430f('0x14')](_0x430f('0x1a'),_0x3ba01f[_0x430f('0x16')],_0x61eeda);_0x1e6227(_0x212a7d['error'](0x1f4,_0x3ba01f[_0x430f('0x16')]));});});};exports[_0x430f('0x1f')]=function(_0x5a8fe4){return new Promise(function(_0x5599c9,_0x528fd2){return db['SmsInteraction']['find']({'where':_0x5a8fe4['options']?_0x5a8fe4[_0x430f('0x1c')][_0x430f('0x20')]||null:null})[_0x430f('0xf')](function(_0x5db7ef){if(_0x5db7ef){return _0x5db7ef[_0x430f('0x21')](_0x5a8fe4[_0x430f('0x22')][_0x430f('0x23')],_[_0x430f('0x24')](_0x5a8fe4['body'],[_0x430f('0x23'),'id'])||{});}})[_0x430f('0x25')](function(_0x56755a){logger[_0x430f('0x17')]('AddTags',_0x5a8fe4);logger[_0x430f('0x12')](_0x430f('0x26'),_0x5a8fe4,JSON['stringify'](_0x56755a));_0x5599c9(_0x56755a);})['catch'](function(_0xd14933){logger[_0x430f('0x14')](_0x430f('0x26'),_0xd14933[_0x430f('0x16')],_0x5a8fe4);_0x528fd2(_this[_0x430f('0x14')](0x1f4,_0xd14933[_0x430f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d8ebfd4..246c8ea 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 _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x2aa35a,_0x5d2b0f){var _0x252fdb=function(_0x4e2dc7){while(--_0x4e2dc7){_0x2aa35a['push'](_0x2aa35a['shift']());}};_0x252fdb(++_0x5d2b0f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0xe933df,_0x115b0d){var _0x5a08a3=function(_0x489ccc){while(--_0x489ccc){_0xe933df['push'](_0xe933df['shift']());}};_0x5a08a3(++_0x115b0d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 10693f9..6e00120 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 _0xda04=['isAuthenticated','/describe','describe','/:id','post','tracked','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xda04,0x7e));var _0x4da0=function(_0x2c9e54,_0x178247){_0x2c9e54=_0x2c9e54-0x0;var _0x25d074=_0xda04[_0x2c9e54];return _0x25d074;};'use strict';var multer=require('multer');var util=require(_0x4da0('0x0'));var path=require(_0x4da0('0x1'));var timeout=require(_0x4da0('0x2'));var express=require(_0x4da0('0x3'));var router=express[_0x4da0('0x4')]();var fs_extra=require(_0x4da0('0x5'));var auth=require(_0x4da0('0x6'));var interaction=require(_0x4da0('0x7'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x4da0('0x8')]('/',auth[_0x4da0('0x9')](),controller['index']);router[_0x4da0('0x8')](_0x4da0('0xa'),auth[_0x4da0('0x9')](),controller[_0x4da0('0xb')]);router[_0x4da0('0x8')](_0x4da0('0xc'),auth[_0x4da0('0x9')](),controller['show']);router[_0x4da0('0xd')]('/',auth[_0x4da0('0x9')](),interaction[_0x4da0('0xe')]('sms','smsmessage:create'),controller[_0x4da0('0xf')]);router[_0x4da0('0xd')](_0x4da0('0x10'),controller[_0x4da0('0x11')]);router[_0x4da0('0x12')](_0x4da0('0xc'),auth[_0x4da0('0x9')](),controller[_0x4da0('0x13')]);router[_0x4da0('0x12')](_0x4da0('0x14'),auth[_0x4da0('0x9')](),controller[_0x4da0('0x15')]);router['put'](_0x4da0('0x16'),auth['isAuthenticated'](),controller[_0x4da0('0x17')]);router[_0x4da0('0x18')](_0x4da0('0xc'),auth['isAuthenticated'](),controller[_0x4da0('0x19')]);module[_0x4da0('0x1a')]=router; \ No newline at end of file +var _0x9d4e=['reject','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','tracked','status','put','/:id','update','accept'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9d4e,0x1ba));var _0xe9d4=function(_0x2806f6,_0x294105){_0x2806f6=_0x2806f6-0x0;var _0x32ebb1=_0x9d4e[_0x2806f6];return _0x32ebb1;};'use strict';var multer=require(_0xe9d4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe9d4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9d4('0x2'));var interaction=require(_0xe9d4('0x3'));var config=require(_0xe9d4('0x4'));var controller=require('./smsMessage.controller');router[_0xe9d4('0x5')]('/',auth[_0xe9d4('0x6')](),controller[_0xe9d4('0x7')]);router[_0xe9d4('0x5')](_0xe9d4('0x8'),auth[_0xe9d4('0x6')](),controller[_0xe9d4('0x9')]);router[_0xe9d4('0x5')]('/:id',auth[_0xe9d4('0x6')](),controller[_0xe9d4('0xa')]);router[_0xe9d4('0xb')]('/',auth[_0xe9d4('0x6')](),interaction[_0xe9d4('0xc')]('sms','smsmessage:create'),controller['create']);router[_0xe9d4('0xb')]('/:id/status',controller[_0xe9d4('0xd')]);router[_0xe9d4('0xe')](_0xe9d4('0xf'),auth['isAuthenticated'](),controller[_0xe9d4('0x10')]);router[_0xe9d4('0xe')]('/:id/accept',auth['isAuthenticated'](),controller[_0xe9d4('0x11')]);router[_0xe9d4('0xe')]('/:id/reject',auth[_0xe9d4('0x6')](),controller[_0xe9d4('0x12')]);router['delete'](_0xe9d4('0xf'),auth[_0xe9d4('0x6')](),controller['destroy']);module[_0xe9d4('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2449d9f..2e674fb 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 _0x1d69=['TEXT','medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x158dd7,_0x1f5f90){var _0x1772ba=function(_0x20cbf1){while(--_0x20cbf1){_0x158dd7['push'](_0x158dd7['shift']());}};_0x1772ba(++_0x1f5f90);}(_0x1d69,0x127));var _0x91d6=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x1d69[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0x91d6('0x0'));module['exports']={'body':{'type':Sequelize[_0x91d6('0x1')](_0x91d6('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x91d6('0x3')]('in','out'),'defaultValue':_0x91d6('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x91d6('0x5')](0xbe)},'phone':{'type':Sequelize[_0x91d6('0x5')]},'readAt':{'type':Sequelize[_0x91d6('0x6')]},'secret':{'type':Sequelize[_0x91d6('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x91d6('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7685=['out','STRING','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7685,0x193));var _0x5768=function(_0x23d461,_0x2521c4){_0x23d461=_0x23d461-0x0;var _0x3cf1f1=_0x7685[_0x23d461];return _0x3cf1f1;};'use strict';var Sequelize=require(_0x5768('0x0'));module[_0x5768('0x1')]={'body':{'type':Sequelize[_0x5768('0x2')](_0x5768('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5768('0x4')]('in',_0x5768('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5768('0x6')](0xbe)},'phone':{'type':Sequelize[_0x5768('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5768('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5768('0x6')]},'providerResponse':{'type':Sequelize[_0x5768('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 99bcb1a..cf8e212 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 _0x1db6=['status','json','offset','limit','set','reject','save','update','sendStatus','stack','name','send','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','count','includeAll','include','findAll','rows','params','find','create','body','destroy','describe','sms-interactions','accept','sms','readAt','UserId','user','agent','Contact','SmsInteraction','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','EventManager','acceptmessage','get','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','channel','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','Status','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end'];(function(_0x28306d,_0x1acc31){var _0x4d113f=function(_0x1b29fa){while(--_0x1b29fa){_0x28306d['push'](_0x28306d['shift']());}};_0x4d113f(++_0x1acc31);}(_0x1db6,0x1f1));var _0x61db=function(_0x23f3d7,_0x380b98){_0x23f3d7=_0x23f3d7-0x0;var _0x128e8a=_0x1db6[_0x23f3d7];return _0x128e8a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x61db('0x0'));var rimraf=require(_0x61db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61db('0x2'));var rp=require(_0x61db('0x3'));var moment=require(_0x61db('0x4'));var BPromise=require(_0x61db('0x5'));var Mustache=require('mustache');var util=require(_0x61db('0x6'));var path=require(_0x61db('0x7'));var sox=require(_0x61db('0x8'));var csv=require(_0x61db('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61db('0xa'));var _=require('lodash');var squel=require(_0x61db('0xb'));var crypto=require(_0x61db('0xc'));var jsforce=require(_0x61db('0xd'));var deskjs=require(_0x61db('0xe'));var toCsv=require('to-csv');var querystring=require(_0x61db('0xf'));var Papa=require(_0x61db('0x10'));var Redis=require(_0x61db('0x11'));var authService=require(_0x61db('0x12'));var qs=require(_0x61db('0x13'));var as=require(_0x61db('0x14'));var hardwareService=require(_0x61db('0x15'));var logger=require(_0x61db('0x16'))(_0x61db('0x17'));var utils=require('../../config/utils');var config=require(_0x61db('0x18'));var licenseUtil=require(_0x61db('0x19'));var db=require(_0x61db('0x1a'))['db'];config[_0x61db('0x1b')]=_[_0x61db('0x1c')](config[_0x61db('0x1b')],{'host':_0x61db('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61db('0x1b')]));require(_0x61db('0x1e'))[_0x61db('0x1f')](socket);var jayson=require(_0x61db('0x20'));var client=jayson['client'][_0x61db('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e6658,_0x11cfde,_0x356557,_0x1b4ab7){return new BPromise(function(_0x25089c,_0x32eabf){var _0x258195=_0x1b4ab7||client;return _0x258195['request'](_0x5e6658,_0x356557)[_0x61db('0x22')](function(_0x410753){logger[_0x61db('0x23')](_0x61db('0x24'),_0x11cfde,_0x61db('0x25'));logger[_0x61db('0x26')](_0x61db('0x27'),_0x11cfde,_0x61db('0x25'),JSON[_0x61db('0x28')](_0x410753));if(_0x410753[_0x61db('0x29')]){if(_0x410753[_0x61db('0x29')][_0x61db('0x2a')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x11cfde,_0x410753[_0x61db('0x29')][_0x61db('0x2b')]);return _0x32eabf(_0x410753[_0x61db('0x29')][_0x61db('0x2b')]);}logger[_0x61db('0x29')]('SmsMessage,\x20%s,\x20%s',_0x11cfde,_0x410753[_0x61db('0x29')][_0x61db('0x2b')]);return _0x25089c(_0x410753[_0x61db('0x29')][_0x61db('0x2b')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x11cfde,_0x61db('0x25'));_0x25089c(_0x410753[_0x61db('0x2c')][_0x61db('0x2b')]);}})[_0x61db('0x2d')](function(_0x5b9542){logger['error'](_0x61db('0x24'),_0x11cfde,_0x5b9542);_0x32eabf(_0x5b9542);});});}function respondWithStatusCode(_0x23556a,_0x35d9d1){_0x35d9d1=_0x35d9d1||0xcc;return function(_0x5d383e){if(_0x5d383e){return _0x23556a['sendStatus'](_0x35d9d1);}return _0x23556a['status'](_0x35d9d1)[_0x61db('0x2e')]();};}function respondWithResult(_0x76daf9,_0x15d7c7){_0x15d7c7=_0x15d7c7||0xc8;return function(_0x583ff5){if(_0x583ff5){return _0x76daf9[_0x61db('0x2f')](_0x15d7c7)[_0x61db('0x30')](_0x583ff5);}};}function respondWithFilteredResult(_0x43db53,_0x393347){return function(_0x5130c0){if(_0x5130c0){var _0x35aa9d=_0x5130c0['count'],_0x5c71e5=_0x393347[_0x61db('0x31')],_0x4d4144=_0x393347[_0x61db('0x31')]+_0x393347[_0x61db('0x32')],_0x441e25;if(_0x4d4144>=_0x35aa9d){_0x4d4144=_0x35aa9d;_0x441e25=0xc8;}else{_0x441e25=0xce;}_0x43db53[_0x61db('0x2f')](_0x441e25);return _0x43db53[_0x61db('0x33')]('Content-Range',_0x5c71e5+'-'+_0x4d4144+'/'+_0x35aa9d)[_0x61db('0x30')](_0x5130c0);}return null;};}function patchUpdates(_0x130470){return function(_0x12584e){try{jsonpatch['apply'](_0x12584e,_0x130470,!![]);}catch(_0xe8556c){return BPromise[_0x61db('0x34')](_0xe8556c);}return _0x12584e[_0x61db('0x35')]();};}function saveUpdates(_0x3ac866,_0x464a01){return function(_0x4ed06b){if(_0x4ed06b){return _0x4ed06b[_0x61db('0x36')](_0x3ac866)['then'](function(_0x418688){return _0x418688;});}return null;};}function removeEntity(_0x4fda58,_0x347c3b){return function(_0x3154dd){if(_0x3154dd){return _0x3154dd['destroy']()[_0x61db('0x22')](function(){_0x4fda58[_0x61db('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49d68e,_0x93c7b8){return function(_0x59a9d3){if(!_0x59a9d3){_0x49d68e[_0x61db('0x37')](0x194);}return _0x59a9d3;};}function handleError(_0x5591b7,_0x5919bf){_0x5919bf=_0x5919bf||0x1f4;return function(_0x1b4c7f){logger['error'](_0x1b4c7f[_0x61db('0x38')]);if(_0x1b4c7f[_0x61db('0x39')]){delete _0x1b4c7f[_0x61db('0x39')];}_0x5591b7['status'](_0x5919bf)[_0x61db('0x3a')](_0x1b4c7f);};}exports['index']=function(_0x3f9655,_0x21c049){var _0x2b9ef8={},_0x4c7c28={},_0x253ac7={'count':0x0,'rows':[]};var _0x343d82=_['map'](db[_0x61db('0x3b')][_0x61db('0x3c')],function(_0xe25a76){return{'name':_0xe25a76[_0x61db('0x3d')],'type':_0xe25a76[_0x61db('0x3e')][_0x61db('0x3f')]};});_0x4c7c28[_0x61db('0x40')]=_[_0x61db('0x41')](_0x343d82,_0x61db('0x39'));_0x4c7c28[_0x61db('0x42')]=_[_0x61db('0x43')](_0x3f9655[_0x61db('0x42')]);_0x4c7c28[_0x61db('0x44')]=_[_0x61db('0x45')](_0x4c7c28[_0x61db('0x40')],_0x4c7c28[_0x61db('0x42')]);_0x2b9ef8[_0x61db('0x46')]=_[_0x61db('0x45')](_0x4c7c28[_0x61db('0x40')],qs[_0x61db('0x47')](_0x3f9655[_0x61db('0x42')][_0x61db('0x47')]));_0x2b9ef8[_0x61db('0x46')]=_0x2b9ef8[_0x61db('0x46')][_0x61db('0x48')]?_0x2b9ef8[_0x61db('0x46')]:_0x4c7c28['model'];if(!_0x3f9655['query'][_0x61db('0x49')](_0x61db('0x4a'))){_0x2b9ef8[_0x61db('0x32')]=qs[_0x61db('0x32')](_0x3f9655[_0x61db('0x42')][_0x61db('0x32')]);_0x2b9ef8[_0x61db('0x31')]=qs[_0x61db('0x31')](_0x3f9655[_0x61db('0x42')][_0x61db('0x31')]);}_0x2b9ef8[_0x61db('0x4b')]=qs[_0x61db('0x4c')](_0x3f9655[_0x61db('0x42')]['sort']);_0x2b9ef8['where']=qs[_0x61db('0x44')](_['pick'](_0x3f9655['query'],_0x4c7c28['filters']),_0x343d82);if(_0x3f9655['query'][_0x61db('0x4d')]){_0x2b9ef8[_0x61db('0x4e')]=_[_0x61db('0x4f')](_0x2b9ef8[_0x61db('0x4e')],{'$or':_['map'](_0x343d82,function(_0x4002fd){if(_0x4002fd[_0x61db('0x3e')]!=='VIRTUAL'){var _0x34c464={};_0x34c464[_0x4002fd['name']]={'$like':'%'+_0x3f9655[_0x61db('0x42')][_0x61db('0x4d')]+'%'};return _0x34c464;}})});}_0x2b9ef8=_[_0x61db('0x4f')]({},_0x2b9ef8,_0x3f9655[_0x61db('0x50')]);var _0x25e4ca={'where':_0x2b9ef8['where']};return db[_0x61db('0x3b')][_0x61db('0x51')](_0x25e4ca)[_0x61db('0x22')](function(_0x43b91b){_0x253ac7['count']=_0x43b91b;if(_0x3f9655['query'][_0x61db('0x52')]){_0x2b9ef8[_0x61db('0x53')]=[{'all':!![]}];}return db[_0x61db('0x3b')][_0x61db('0x54')](_0x2b9ef8);})[_0x61db('0x22')](function(_0x508a6a){_0x253ac7[_0x61db('0x55')]=_0x508a6a;return _0x253ac7;})[_0x61db('0x22')](respondWithFilteredResult(_0x21c049,_0x2b9ef8))['catch'](handleError(_0x21c049,null));};exports['show']=function(_0x5b9688,_0x444c9c){var _0x4e39eb={'raw':!![],'where':{'id':_0x5b9688[_0x61db('0x56')]['id']}},_0x2c5c20={};_0x2c5c20[_0x61db('0x40')]=_[_0x61db('0x43')](db['SmsMessage'][_0x61db('0x3c')]);_0x2c5c20[_0x61db('0x42')]=_[_0x61db('0x43')](_0x5b9688[_0x61db('0x42')]);_0x2c5c20[_0x61db('0x44')]=_['intersection'](_0x2c5c20[_0x61db('0x40')],_0x2c5c20[_0x61db('0x42')]);_0x4e39eb[_0x61db('0x46')]=_['intersection'](_0x2c5c20[_0x61db('0x40')],qs[_0x61db('0x47')](_0x5b9688['query']['fields']));_0x4e39eb[_0x61db('0x46')]=_0x4e39eb[_0x61db('0x46')][_0x61db('0x48')]?_0x4e39eb[_0x61db('0x46')]:_0x2c5c20[_0x61db('0x40')];if(_0x5b9688[_0x61db('0x42')][_0x61db('0x52')]){_0x4e39eb[_0x61db('0x53')]=[{'all':!![]}];}_0x4e39eb=_[_0x61db('0x4f')]({},_0x4e39eb,_0x5b9688[_0x61db('0x50')]);return db[_0x61db('0x3b')][_0x61db('0x57')](_0x4e39eb)[_0x61db('0x22')](handleEntityNotFound(_0x444c9c,null))[_0x61db('0x22')](respondWithResult(_0x444c9c,null))[_0x61db('0x2d')](handleError(_0x444c9c,null));};exports['create']=function(_0x44c92a,_0x49cd7c){return db[_0x61db('0x3b')][_0x61db('0x58')](_0x44c92a[_0x61db('0x59')],{})[_0x61db('0x22')](respondWithResult(_0x49cd7c,0xc9))[_0x61db('0x2d')](handleError(_0x49cd7c,null));};exports[_0x61db('0x36')]=function(_0x1e0d36,_0x42edcc){if(_0x1e0d36[_0x61db('0x59')]['id']){delete _0x1e0d36['body']['id'];}return db[_0x61db('0x3b')][_0x61db('0x57')]({'where':{'id':_0x1e0d36[_0x61db('0x56')]['id']}})[_0x61db('0x22')](handleEntityNotFound(_0x42edcc,null))['then'](saveUpdates(_0x1e0d36['body'],null))['then'](respondWithResult(_0x42edcc,null))[_0x61db('0x2d')](handleError(_0x42edcc,null));};exports[_0x61db('0x5a')]=function(_0x4197cb,_0x15a905){return db[_0x61db('0x3b')]['find']({'where':{'id':_0x4197cb[_0x61db('0x56')]['id']}})[_0x61db('0x22')](handleEntityNotFound(_0x15a905,null))[_0x61db('0x22')](removeEntity(_0x15a905,null))[_0x61db('0x2d')](handleError(_0x15a905,null));};exports['describe']=function(_0x4239d1,_0x48eca7){return db[_0x61db('0x3b')][_0x61db('0x5b')]()[_0x61db('0x22')](respondWithResult(_0x48eca7,null))['catch'](handleError(_0x48eca7,null));};var interaction_log=require(_0x61db('0x16'))(_0x61db('0x5c'));exports[_0x61db('0x5d')]=function(_0x58e888,_0x21ce7f,_0x4dd50){var _0x2db2a3={'agent':{},'channel':_0x61db('0x5e')};if(_0x58e888[_0x61db('0x59')]['id']){delete _0x58e888[_0x61db('0x59')]['id'];}_0x58e888['body']['read']=!![];_0x58e888['body'][_0x61db('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58e888[_0x61db('0x59')][_0x61db('0x60')]=_0x58e888[_0x61db('0x59')][_0x61db('0x60')]||_0x58e888[_0x61db('0x61')]['id'];_0x2db2a3[_0x61db('0x62')]['id']=_0x58e888[_0x61db('0x59')][_0x61db('0x60')];return db['SmsMessage'][_0x61db('0x57')]({'where':{'id':_0x58e888['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x61db('0x63')}]})['then'](handleEntityNotFound(_0x21ce7f,null))['then'](saveUpdates(_0x58e888['body'],null))[_0x61db('0x22')](function(_0x50b175){if(_0x50b175){_0x2db2a3[_0x61db('0x2b')]=_0x50b175['get']({'plain':!![]});return db[_0x61db('0x64')]['find']({'where':{'id':_0x50b175['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x21ce7f,null))[_0x61db('0x22')](function(_0x3ad071){if(_0x3ad071){return _0x3ad071[_0x61db('0x36')]({'UserId':_0x58e888['body'][_0x61db('0x60')],'read1stAt':_[_0x61db('0x65')](_0x3ad071[_0x61db('0x66')])?moment()[_0x61db('0x67')](_0x61db('0x68')):undefined});}return null;})[_0x61db('0x22')](function(_0x4bf7f3){if(_0x4bf7f3){_0x2db2a3['interaction']=_0x4bf7f3['get']({'plain':!![]});interaction_log[_0x61db('0x23')](_0x61db('0x69'),_0x58e888[_0x61db('0x61')]['id'],_0x58e888[_0x61db('0x61')][_0x61db('0x39')],_0x58e888[_0x61db('0x61')][_0x61db('0x6a')],_0x2db2a3['interaction']['id'],_0x58e888[_0x61db('0x59')]?JSON[_0x61db('0x28')](_0x58e888[_0x61db('0x59')]):_0x61db('0x6b'));return respondWithRpcPromise(_0x61db('0x6c'),_0x61db('0x6d'),_0x2db2a3);}return null;})[_0x61db('0x22')](function(_0x482eac){if(_0x482eac){if(_0x58e888[_0x61db('0x59')]['manual']){_0x2db2a3['message'][_0x61db('0x6e')]=util[_0x61db('0x67')]('SIP/%s',_0x58e888[_0x61db('0x61')][_0x61db('0x39')]);_0x2db2a3[_0x61db('0x2b')]['channel']=_0x2db2a3['channel'];_0x2db2a3['message']['event']='accept';return respondWithRpcPromise(_0x61db('0x6f'),'EventManager',{'event':_0x61db('0x70'),'message':_0x2db2a3[_0x61db('0x2b')]},client9002)[_0x61db('0x22')](function(){return _0x2db2a3;});}return _0x2db2a3;}return null;})[_0x61db('0x22')](respondWithResult(_0x21ce7f,null))[_0x61db('0x2d')](handleError(_0x21ce7f,null));};var interaction_log=require('../../config/logger')(_0x61db('0x5c'));exports[_0x61db('0x34')]=function(_0x3758e7,_0x513c8f,_0x282975){var _0x28bbc6={'agent':{},'channel':_0x61db('0x5e')};if(_0x3758e7[_0x61db('0x59')]['id']){delete _0x3758e7['body']['id'];}_0x3758e7['body'][_0x61db('0x60')]=_0x3758e7['body']['UserId']||_0x3758e7['user']['id'];_0x28bbc6[_0x61db('0x62')]['id']=_0x3758e7['body'][_0x61db('0x60')];return db[_0x61db('0x3b')][_0x61db('0x57')]({'where':{'id':_0x3758e7[_0x61db('0x56')]['id'],'UserId':null}})[_0x61db('0x22')](handleEntityNotFound(_0x513c8f,null))[_0x61db('0x22')](function(_0x391bc6){if(_0x391bc6){_0x28bbc6[_0x61db('0x2b')]=_0x391bc6[_0x61db('0x71')]({'plain':!![]});return db['SmsInteraction'][_0x61db('0x57')]({'where':{'id':_0x391bc6[_0x61db('0x72')]}});}return null;})[_0x61db('0x22')](handleEntityNotFound(_0x513c8f,null))['then'](function(_0x4c66f3){if(_0x4c66f3){_0x28bbc6[_0x61db('0x73')]=_0x4c66f3[_0x61db('0x71')]({'plain':!![]});interaction_log[_0x61db('0x23')](_0x61db('0x74'),_0x3758e7[_0x61db('0x61')]['id'],_0x3758e7[_0x61db('0x61')][_0x61db('0x39')],_0x3758e7[_0x61db('0x61')]['role'],_0x28bbc6['interaction']['id'],_0x3758e7[_0x61db('0x59')]?JSON[_0x61db('0x28')](_0x3758e7[_0x61db('0x59')]):_0x61db('0x6b'));return respondWithRpcPromise(_0x61db('0x75'),_0x61db('0x76'),_0x28bbc6);}return null;})[_0x61db('0x22')](function(_0x1d0445){if(_0x1d0445){_0x1d0445['message'][_0x61db('0x6e')]=util['format'](_0x61db('0x77'),_0x3758e7[_0x61db('0x61')][_0x61db('0x39')]);_0x1d0445[_0x61db('0x2b')][_0x61db('0x78')]=_0x28bbc6[_0x61db('0x78')];_0x1d0445[_0x61db('0x2b')]['event']=_0x61db('0x34');respondWithRpcPromise(_0x61db('0x6f'),'EventManager',{'event':'rejectmessage','message':_0x1d0445[_0x61db('0x2b')]},client9002);return _0x28bbc6;}return null;})[_0x61db('0x22')](respondWithResult(_0x513c8f,null))[_0x61db('0x2d')](handleError(_0x513c8f,null));};exports[_0x61db('0x2f')]=function(_0x46de55,_0x597e06,_0x517269){if(_0x46de55[_0x61db('0x59')]['id']){delete _0x46de55['body']['id'];}var _0x2a304b;return db[_0x61db('0x3b')][_0x61db('0x57')]({'where':{'id':_0x46de55[_0x61db('0x56')]['id']}})[_0x61db('0x22')](handleEntityNotFound(_0x597e06,null))[_0x61db('0x22')](function(_0x543d2d){if(_0x543d2d){_0x2a304b=_0x543d2d;return db['SmsAccount']['find']({'where':{'id':_0x543d2d[_0x61db('0x79')]}});}})[_0x61db('0x22')](handleEntityNotFound(_0x597e06,null))['then'](function(_0x6a57ab){if(_0x6a57ab){logger[_0x61db('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x61db('0x2f'),_0x61db('0x7a'),_0x6a57ab[_0x61db('0x3e')],util[_0x61db('0x7b')](_0x46de55[_0x61db('0x59')],{'showHidden':![],'depth':null}));switch(_0x6a57ab[_0x61db('0x3e')]){case _0x61db('0x7c'):if(_0x46de55[_0x61db('0x59')][_0x61db('0x7d')]&&_0x46de55[_0x61db('0x59')][_0x61db('0x7d')]===_0x2a304b[_0x61db('0x7e')]){return _0x2a304b[_0x61db('0x36')]({'read':!![]});}else{logger[_0x61db('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x61db('0x2f'),_0x61db('0x7c'),util[_0x61db('0x7b')](_0x46de55[_0x61db('0x59')],{'showHidden':![],'depth':null}));}break;case _0x61db('0x7f'):if(_0x46de55[_0x61db('0x59')]['MessageUUID']&&_0x46de55[_0x61db('0x59')][_0x61db('0x80')]===_0x2a304b[_0x61db('0x7e')]&&_[_0x61db('0x81')](['sent','delivered'],_0x46de55[_0x61db('0x59')][_0x61db('0x82')])>=0x0){return _0x2a304b['update']({'read':!![]});}else{logger['error'](_0x61db('0x83'),_0x61db('0x2f'),'plivio',util[_0x61db('0x7b')](_0x46de55[_0x61db('0x59')],{'showHidden':![],'depth':null}));}break;case _0x61db('0x84'):var _0x3fb5ba=_0x46de55[_0x61db('0x59')][_0x61db('0x85')][0x0];if(_0x3fb5ba['status'][_0x61db('0x86')]===_0x61db('0x87')){return _0x2a304b[_0x61db('0x36')]({'read':!![]});}else{logger['error'](_0x61db('0x83'),_0x61db('0x2f'),_0x61db('0x84'),util[_0x61db('0x7b')](_0x46de55[_0x61db('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2a304b;}})[_0x61db('0x22')](respondWithResult(_0x597e06,null))[_0x61db('0x2d')](handleError(_0x597e06,null));}; \ No newline at end of file +var _0x28e1=['update','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','SmsInteraction','isNil','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','SmsInteractionId','stringify','rejectMessage','reject','rejectmessage','SmsAccount','SmsAccountId','debug','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','results','groupName','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','end','status','json','count','set','save','destroy','sendStatus','stack','name','index','SmsMessage','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','length','find','create','body'];(function(_0x23c217,_0x3aee12){var _0x53fcf8=function(_0x133202){while(--_0x133202){_0x23c217['push'](_0x23c217['shift']());}};_0x53fcf8(++_0x3aee12);}(_0x28e1,0x1cd));var _0x128e=function(_0x2a2608,_0x446c76){_0x2a2608=_0x2a2608-0x0;var _0x51953f=_0x28e1[_0x2a2608];return _0x51953f;};'use strict';var pdf=require(_0x128e('0x0'));var emlformat=require(_0x128e('0x1'));var rimraf=require(_0x128e('0x2'));var zipdir=require(_0x128e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x128e('0x4'));var moment=require('moment');var BPromise=require(_0x128e('0x5'));var Mustache=require(_0x128e('0x6'));var util=require(_0x128e('0x7'));var path=require(_0x128e('0x8'));var sox=require(_0x128e('0x9'));var csv=require('to-csv');var ejs=require(_0x128e('0xa'));var fs=require('fs');var fs_extra=require(_0x128e('0xb'));var _=require(_0x128e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x128e('0xd'));var deskjs=require(_0x128e('0xe'));var toCsv=require(_0x128e('0xf'));var querystring=require(_0x128e('0x10'));var Papa=require(_0x128e('0x11'));var Redis=require(_0x128e('0x12'));var authService=require(_0x128e('0x13'));var qs=require(_0x128e('0x14'));var as=require(_0x128e('0x15'));var hardwareService=require(_0x128e('0x16'));var logger=require(_0x128e('0x17'))(_0x128e('0x18'));var utils=require(_0x128e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x128e('0x1a'))['db'];config[_0x128e('0x1b')]=_['defaults'](config[_0x128e('0x1b')],{'host':_0x128e('0x1c'),'port':0x18eb});var socket=require(_0x128e('0x1d'))(new Redis(config[_0x128e('0x1b')]));require(_0x128e('0x1e'))[_0x128e('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x128e('0x20')][_0x128e('0x21')]({'port':0x232c});var client9002=jayson[_0x128e('0x20')][_0x128e('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4dc9f6,_0x49843,_0xe9e40e,_0x3c4e5b){return new BPromise(function(_0x53b1ef,_0x3dd38){var _0x266187=_0x3c4e5b||client;return _0x266187['request'](_0x4dc9f6,_0xe9e40e)[_0x128e('0x22')](function(_0x1b5824){logger[_0x128e('0x23')](_0x128e('0x24'),_0x49843,_0x128e('0x25'));logger['debug'](_0x128e('0x26'),_0x49843,_0x128e('0x25'),JSON['stringify'](_0x1b5824));if(_0x1b5824['error']){if(_0x1b5824['error'][_0x128e('0x27')]===0x1f4){logger[_0x128e('0x28')](_0x128e('0x24'),_0x49843,_0x1b5824[_0x128e('0x28')][_0x128e('0x29')]);return _0x3dd38(_0x1b5824[_0x128e('0x28')]['message']);}logger[_0x128e('0x28')](_0x128e('0x24'),_0x49843,_0x1b5824[_0x128e('0x28')][_0x128e('0x29')]);return _0x53b1ef(_0x1b5824[_0x128e('0x28')][_0x128e('0x29')]);}else{logger[_0x128e('0x23')](_0x128e('0x24'),_0x49843,_0x128e('0x25'));_0x53b1ef(_0x1b5824[_0x128e('0x2a')]['message']);}})[_0x128e('0x2b')](function(_0x416aa4){logger['error'](_0x128e('0x24'),_0x49843,_0x416aa4);_0x3dd38(_0x416aa4);});});}function respondWithStatusCode(_0x57a668,_0x1b2bb4){_0x1b2bb4=_0x1b2bb4||0xcc;return function(_0x2d1bac){if(_0x2d1bac){return _0x57a668['sendStatus'](_0x1b2bb4);}return _0x57a668['status'](_0x1b2bb4)[_0x128e('0x2c')]();};}function respondWithResult(_0x53192f,_0x4316b3){_0x4316b3=_0x4316b3||0xc8;return function(_0x3b97ea){if(_0x3b97ea){return _0x53192f[_0x128e('0x2d')](_0x4316b3)[_0x128e('0x2e')](_0x3b97ea);}};}function respondWithFilteredResult(_0x48d006,_0x1b3b4d){return function(_0x1b4223){if(_0x1b4223){var _0x492ed0=_0x1b4223[_0x128e('0x2f')],_0xf6fb17=_0x1b3b4d['offset'],_0x47375d=_0x1b3b4d['offset']+_0x1b3b4d['limit'],_0x1d350d;if(_0x47375d>=_0x492ed0){_0x47375d=_0x492ed0;_0x1d350d=0xc8;}else{_0x1d350d=0xce;}_0x48d006[_0x128e('0x2d')](_0x1d350d);return _0x48d006[_0x128e('0x30')]('Content-Range',_0xf6fb17+'-'+_0x47375d+'/'+_0x492ed0)['json'](_0x1b4223);}return null;};}function patchUpdates(_0x4f6179){return function(_0x19414e){try{jsonpatch['apply'](_0x19414e,_0x4f6179,!![]);}catch(_0x4fcff2){return BPromise['reject'](_0x4fcff2);}return _0x19414e[_0x128e('0x31')]();};}function saveUpdates(_0x3223df,_0x2d7063){return function(_0x230a1e){if(_0x230a1e){return _0x230a1e['update'](_0x3223df)[_0x128e('0x22')](function(_0x28c306){return _0x28c306;});}return null;};}function removeEntity(_0x1d13e9,_0x23e1a6){return function(_0x3c7982){if(_0x3c7982){return _0x3c7982[_0x128e('0x32')]()[_0x128e('0x22')](function(){_0x1d13e9[_0x128e('0x2d')](0xcc)[_0x128e('0x2c')]();});}};}function handleEntityNotFound(_0x3c0f4d,_0xe6ac6a){return function(_0x79134b){if(!_0x79134b){_0x3c0f4d[_0x128e('0x33')](0x194);}return _0x79134b;};}function handleError(_0x26dc5a,_0x563aba){_0x563aba=_0x563aba||0x1f4;return function(_0xeae946){logger[_0x128e('0x28')](_0xeae946[_0x128e('0x34')]);if(_0xeae946['name']){delete _0xeae946[_0x128e('0x35')];}_0x26dc5a[_0x128e('0x2d')](_0x563aba)['send'](_0xeae946);};}exports[_0x128e('0x36')]=function(_0x14ca2d,_0xa9d4c1){var _0x4a83d1={},_0x5a7877={},_0x500544={'count':0x0,'rows':[]};var _0x1a8ff=_['map'](db[_0x128e('0x37')][_0x128e('0x38')],function(_0x51141c){return{'name':_0x51141c['fieldName'],'type':_0x51141c[_0x128e('0x39')]['key']};});_0x5a7877[_0x128e('0x3a')]=_['map'](_0x1a8ff,_0x128e('0x35'));_0x5a7877[_0x128e('0x3b')]=_[_0x128e('0x3c')](_0x14ca2d['query']);_0x5a7877[_0x128e('0x3d')]=_['intersection'](_0x5a7877['model'],_0x5a7877['query']);_0x4a83d1[_0x128e('0x3e')]=_[_0x128e('0x3f')](_0x5a7877['model'],qs[_0x128e('0x40')](_0x14ca2d['query'][_0x128e('0x40')]));_0x4a83d1[_0x128e('0x3e')]=_0x4a83d1['attributes']['length']?_0x4a83d1[_0x128e('0x3e')]:_0x5a7877[_0x128e('0x3a')];if(!_0x14ca2d[_0x128e('0x3b')][_0x128e('0x41')](_0x128e('0x42'))){_0x4a83d1['limit']=qs[_0x128e('0x43')](_0x14ca2d[_0x128e('0x3b')][_0x128e('0x43')]);_0x4a83d1['offset']=qs[_0x128e('0x44')](_0x14ca2d[_0x128e('0x3b')][_0x128e('0x44')]);}_0x4a83d1[_0x128e('0x45')]=qs[_0x128e('0x46')](_0x14ca2d[_0x128e('0x3b')][_0x128e('0x46')]);_0x4a83d1[_0x128e('0x47')]=qs['filters'](_[_0x128e('0x48')](_0x14ca2d[_0x128e('0x3b')],_0x5a7877[_0x128e('0x3d')]),_0x1a8ff);if(_0x14ca2d[_0x128e('0x3b')][_0x128e('0x49')]){_0x4a83d1[_0x128e('0x47')]=_['merge'](_0x4a83d1[_0x128e('0x47')],{'$or':_[_0x128e('0x4a')](_0x1a8ff,function(_0x581153){if(_0x581153['type']!==_0x128e('0x4b')){var _0xd6825d={};_0xd6825d[_0x581153['name']]={'$like':'%'+_0x14ca2d[_0x128e('0x3b')][_0x128e('0x49')]+'%'};return _0xd6825d;}})});}_0x4a83d1=_[_0x128e('0x4c')]({},_0x4a83d1,_0x14ca2d[_0x128e('0x4d')]);var _0x53542f={'where':_0x4a83d1['where']};return db['SmsMessage'][_0x128e('0x2f')](_0x53542f)[_0x128e('0x22')](function(_0x43a33e){_0x500544[_0x128e('0x2f')]=_0x43a33e;if(_0x14ca2d['query'][_0x128e('0x4e')]){_0x4a83d1[_0x128e('0x4f')]=[{'all':!![]}];}return db[_0x128e('0x37')][_0x128e('0x50')](_0x4a83d1);})[_0x128e('0x22')](function(_0x2d3451){_0x500544[_0x128e('0x51')]=_0x2d3451;return _0x500544;})['then'](respondWithFilteredResult(_0xa9d4c1,_0x4a83d1))[_0x128e('0x2b')](handleError(_0xa9d4c1,null));};exports['show']=function(_0x55c6fd,_0x510251){var _0xc3ed09={'raw':!![],'where':{'id':_0x55c6fd[_0x128e('0x52')]['id']}},_0x3c0dea={};_0x3c0dea['model']=_[_0x128e('0x3c')](db[_0x128e('0x37')]['rawAttributes']);_0x3c0dea[_0x128e('0x3b')]=_['keys'](_0x55c6fd[_0x128e('0x3b')]);_0x3c0dea['filters']=_[_0x128e('0x3f')](_0x3c0dea[_0x128e('0x3a')],_0x3c0dea[_0x128e('0x3b')]);_0xc3ed09[_0x128e('0x3e')]=_[_0x128e('0x3f')](_0x3c0dea['model'],qs[_0x128e('0x40')](_0x55c6fd[_0x128e('0x3b')][_0x128e('0x40')]));_0xc3ed09[_0x128e('0x3e')]=_0xc3ed09[_0x128e('0x3e')][_0x128e('0x53')]?_0xc3ed09[_0x128e('0x3e')]:_0x3c0dea[_0x128e('0x3a')];if(_0x55c6fd['query'][_0x128e('0x4e')]){_0xc3ed09[_0x128e('0x4f')]=[{'all':!![]}];}_0xc3ed09=_[_0x128e('0x4c')]({},_0xc3ed09,_0x55c6fd[_0x128e('0x4d')]);return db[_0x128e('0x37')][_0x128e('0x54')](_0xc3ed09)['then'](handleEntityNotFound(_0x510251,null))['then'](respondWithResult(_0x510251,null))[_0x128e('0x2b')](handleError(_0x510251,null));};exports[_0x128e('0x55')]=function(_0x5e2def,_0x466a37){return db[_0x128e('0x37')]['create'](_0x5e2def[_0x128e('0x56')],{})['then'](respondWithResult(_0x466a37,0xc9))[_0x128e('0x2b')](handleError(_0x466a37,null));};exports[_0x128e('0x57')]=function(_0x39c12e,_0x3813aa){if(_0x39c12e['body']['id']){delete _0x39c12e[_0x128e('0x56')]['id'];}return db[_0x128e('0x37')][_0x128e('0x54')]({'where':{'id':_0x39c12e[_0x128e('0x52')]['id']}})[_0x128e('0x22')](handleEntityNotFound(_0x3813aa,null))[_0x128e('0x22')](saveUpdates(_0x39c12e[_0x128e('0x56')],null))[_0x128e('0x22')](respondWithResult(_0x3813aa,null))['catch'](handleError(_0x3813aa,null));};exports[_0x128e('0x32')]=function(_0x367705,_0x1f273e){return db['SmsMessage']['find']({'where':{'id':_0x367705[_0x128e('0x52')]['id']}})[_0x128e('0x22')](handleEntityNotFound(_0x1f273e,null))[_0x128e('0x22')](removeEntity(_0x1f273e,null))[_0x128e('0x2b')](handleError(_0x1f273e,null));};exports[_0x128e('0x58')]=function(_0x599946,_0x47fa2a){return db[_0x128e('0x37')]['describe']()[_0x128e('0x22')](respondWithResult(_0x47fa2a,null))[_0x128e('0x2b')](handleError(_0x47fa2a,null));};var interaction_log=require(_0x128e('0x17'))(_0x128e('0x59'));exports[_0x128e('0x5a')]=function(_0x176a45,_0x238c24,_0x4c1c61){var _0x5884ff={'agent':{},'channel':_0x128e('0x5b')};if(_0x176a45[_0x128e('0x56')]['id']){delete _0x176a45['body']['id'];}_0x176a45[_0x128e('0x56')][_0x128e('0x5c')]=!![];_0x176a45[_0x128e('0x56')][_0x128e('0x5d')]=moment()[_0x128e('0x5e')](_0x128e('0x5f'));_0x176a45[_0x128e('0x56')][_0x128e('0x60')]=_0x176a45['body'][_0x128e('0x60')]||_0x176a45['user']['id'];_0x5884ff['agent']['id']=_0x176a45['body'][_0x128e('0x60')];return db['SmsMessage']['find']({'where':{'id':_0x176a45[_0x128e('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x128e('0x61')],'as':_0x128e('0x62')}]})['then'](handleEntityNotFound(_0x238c24,null))[_0x128e('0x22')](saveUpdates(_0x176a45[_0x128e('0x56')],null))[_0x128e('0x22')](function(_0x47e5b2){if(_0x47e5b2){_0x5884ff[_0x128e('0x29')]=_0x47e5b2[_0x128e('0x63')]({'plain':!![]});return db[_0x128e('0x64')][_0x128e('0x54')]({'where':{'id':_0x47e5b2['SmsInteractionId']}});}return null;})[_0x128e('0x22')](handleEntityNotFound(_0x238c24,null))[_0x128e('0x22')](function(_0x3be897){if(_0x3be897){return _0x3be897['update']({'UserId':_0x176a45[_0x128e('0x56')][_0x128e('0x60')],'read1stAt':_[_0x128e('0x65')](_0x3be897['read1stAt'])?moment()[_0x128e('0x5e')](_0x128e('0x5f')):undefined});}return null;})[_0x128e('0x22')](function(_0x2a93af){if(_0x2a93af){_0x5884ff['interaction']=_0x2a93af['get']({'plain':!![]});interaction_log[_0x128e('0x23')](_0x128e('0x66'),_0x176a45['user']['id'],_0x176a45[_0x128e('0x67')][_0x128e('0x35')],_0x176a45[_0x128e('0x67')][_0x128e('0x68')],_0x5884ff[_0x128e('0x69')]['id'],_0x176a45[_0x128e('0x56')]?JSON['stringify'](_0x176a45[_0x128e('0x56')]):_0x128e('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x128e('0x6b'),_0x5884ff);}return null;})[_0x128e('0x22')](function(_0x56aac5){if(_0x56aac5){if(_0x176a45['body'][_0x128e('0x6c')]){_0x5884ff[_0x128e('0x29')][_0x128e('0x6d')]=util[_0x128e('0x5e')](_0x128e('0x6e'),_0x176a45[_0x128e('0x67')][_0x128e('0x35')]);_0x5884ff[_0x128e('0x29')][_0x128e('0x6f')]=_0x5884ff['channel'];_0x5884ff['message'][_0x128e('0x70')]='accept';return respondWithRpcPromise('EventManager',_0x128e('0x71'),{'event':_0x128e('0x72'),'message':_0x5884ff[_0x128e('0x29')]},client9002)[_0x128e('0x22')](function(){return _0x5884ff;});}return _0x5884ff;}return null;})['then'](respondWithResult(_0x238c24,null))['catch'](handleError(_0x238c24,null));};var interaction_log=require('../../config/logger')(_0x128e('0x59'));exports['reject']=function(_0x4a7c12,_0x540f79,_0x3fee8e){var _0x195798={'agent':{},'channel':_0x128e('0x5b')};if(_0x4a7c12[_0x128e('0x56')]['id']){delete _0x4a7c12['body']['id'];}_0x4a7c12[_0x128e('0x56')][_0x128e('0x60')]=_0x4a7c12[_0x128e('0x56')][_0x128e('0x60')]||_0x4a7c12[_0x128e('0x67')]['id'];_0x195798[_0x128e('0x73')]['id']=_0x4a7c12[_0x128e('0x56')]['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x4a7c12[_0x128e('0x52')]['id'],'UserId':null}})[_0x128e('0x22')](handleEntityNotFound(_0x540f79,null))[_0x128e('0x22')](function(_0x55bbe6){if(_0x55bbe6){_0x195798[_0x128e('0x29')]=_0x55bbe6[_0x128e('0x63')]({'plain':!![]});return db[_0x128e('0x64')][_0x128e('0x54')]({'where':{'id':_0x55bbe6[_0x128e('0x74')]}});}return null;})[_0x128e('0x22')](handleEntityNotFound(_0x540f79,null))[_0x128e('0x22')](function(_0x211025){if(_0x211025){_0x195798[_0x128e('0x69')]=_0x211025[_0x128e('0x63')]({'plain':!![]});interaction_log[_0x128e('0x23')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a7c12[_0x128e('0x67')]['id'],_0x4a7c12[_0x128e('0x67')][_0x128e('0x35')],_0x4a7c12['user'][_0x128e('0x68')],_0x195798[_0x128e('0x69')]['id'],_0x4a7c12[_0x128e('0x56')]?JSON[_0x128e('0x75')](_0x4a7c12[_0x128e('0x56')]):_0x128e('0x6a'));return respondWithRpcPromise('RejectMessage',_0x128e('0x76'),_0x195798);}return null;})['then'](function(_0x564127){if(_0x564127){_0x564127[_0x128e('0x29')][_0x128e('0x6d')]=util[_0x128e('0x5e')](_0x128e('0x6e'),_0x4a7c12[_0x128e('0x67')][_0x128e('0x35')]);_0x564127['message'][_0x128e('0x6f')]=_0x195798[_0x128e('0x6f')];_0x564127[_0x128e('0x29')][_0x128e('0x70')]=_0x128e('0x77');respondWithRpcPromise(_0x128e('0x71'),_0x128e('0x71'),{'event':_0x128e('0x78'),'message':_0x564127[_0x128e('0x29')]},client9002);return _0x195798;}return null;})[_0x128e('0x22')](respondWithResult(_0x540f79,null))[_0x128e('0x2b')](handleError(_0x540f79,null));};exports['status']=function(_0x547e81,_0x1a0b99,_0x3e5d2a){if(_0x547e81[_0x128e('0x56')]['id']){delete _0x547e81[_0x128e('0x56')]['id'];}var _0x191c92;return db['SmsMessage'][_0x128e('0x54')]({'where':{'id':_0x547e81[_0x128e('0x52')]['id']}})[_0x128e('0x22')](handleEntityNotFound(_0x1a0b99,null))[_0x128e('0x22')](function(_0x4cb450){if(_0x4cb450){_0x191c92=_0x4cb450;return db[_0x128e('0x79')][_0x128e('0x54')]({'where':{'id':_0x4cb450[_0x128e('0x7a')]}});}})[_0x128e('0x22')](handleEntityNotFound(_0x1a0b99,null))[_0x128e('0x22')](function(_0x315306){if(_0x315306){logger[_0x128e('0x7b')](_0x128e('0x26'),_0x128e('0x2d'),'received\x20delivery\x20report\x20from',_0x315306[_0x128e('0x39')],util[_0x128e('0x7c')](_0x547e81[_0x128e('0x56')],{'showHidden':![],'depth':null}));switch(_0x315306[_0x128e('0x39')]){case'twilio':if(_0x547e81[_0x128e('0x56')][_0x128e('0x7d')]&&_0x547e81['body'][_0x128e('0x7d')]===_0x191c92[_0x128e('0x7e')]){return _0x191c92[_0x128e('0x57')]({'read':!![]});}else{logger[_0x128e('0x28')](_0x128e('0x7f'),_0x128e('0x2d'),'twilio',util[_0x128e('0x7c')](_0x547e81[_0x128e('0x56')],{'showHidden':![],'depth':null}));}break;case _0x128e('0x80'):if(_0x547e81[_0x128e('0x56')][_0x128e('0x81')]&&_0x547e81['body'][_0x128e('0x81')]===_0x191c92['messageId']&&_[_0x128e('0x82')]([_0x128e('0x83'),'delivered'],_0x547e81[_0x128e('0x56')][_0x128e('0x84')])>=0x0){return _0x191c92[_0x128e('0x57')]({'read':!![]});}else{logger[_0x128e('0x28')](_0x128e('0x7f'),_0x128e('0x2d'),_0x128e('0x85'),util[_0x128e('0x7c')](_0x547e81[_0x128e('0x56')],{'showHidden':![],'depth':null}));}break;case _0x128e('0x86'):var _0x36ae88=_0x547e81[_0x128e('0x56')][_0x128e('0x87')][0x0];if(_0x36ae88[_0x128e('0x2d')][_0x128e('0x88')]==='DELIVERED'){return _0x191c92[_0x128e('0x57')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util['inspect'](_0x547e81[_0x128e('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x191c92;}})['then'](respondWithResult(_0x1a0b99,null))['catch'](handleError(_0x1a0b99,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ace1583..18ddca9 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 _0x88e4=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','update'];(function(_0x60ec44,_0x59ff7a){var _0x150e6b=function(_0x4f86b6){while(--_0x4f86b6){_0x60ec44['push'](_0x60ec44['shift']());}};_0x150e6b(++_0x59ff7a);}(_0x88e4,0x1ea));var _0x488e=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x88e4[_0x4c5c97];return _0xd5d2cb;};'use strict';var EventEmitter=require(_0x488e('0x0'));var SmsMessage=require(_0x488e('0x1'))['db'][_0x488e('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x488e('0x3'),'afterUpdate':_0x488e('0x4'),'afterDestroy':'remove'};function emitEvent(_0xef1179){return function(_0x18df13,_0x5508dd,_0x26836a){SmsMessageEvents[_0x488e('0x5')](_0xef1179+':'+_0x18df13['id'],_0x18df13);SmsMessageEvents[_0x488e('0x5')](_0xef1179,_0x18df13);_0x26836a(null);};}for(var e in events){if(events[_0x488e('0x6')](e)){var event=events[e];SmsMessage[_0x488e('0x7')](e,emitEvent(event));}}module[_0x488e('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xf0ad=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xf0ad,0xb3));var _0xdf0a=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xf0ad[_0x1c34e7];return _0x378cb1;};'use strict';var EventEmitter=require(_0xdf0a('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xdf0a('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xdf0a('0x2')](0x0);var events={'afterCreate':_0xdf0a('0x3'),'afterUpdate':_0xdf0a('0x4'),'afterDestroy':_0xdf0a('0x5')};function emitEvent(_0x3d2dc7){return function(_0x59d011,_0xd4995f,_0x7c3d7a){SmsMessageEvents[_0xdf0a('0x6')](_0x3d2dc7+':'+_0x59d011['id'],_0x59d011);SmsMessageEvents[_0xdf0a('0x6')](_0x3d2dc7,_0x59d011);_0x7c3d7a(null);};}for(var e in events){if(events[_0xdf0a('0x7')](e)){var event=events[e];SmsMessage[_0xdf0a('0x8')](e,emitEvent(event));}}module[_0xdf0a('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1496c3d..c627e7d 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 _0x07d7=['connectel','https://smsapi.connectel.se/api/v2/send/','requestid','read','catch','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','baseUrl','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','skebby','inspect','Missing\x20parameters:\x20username,\x20password'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x07d7,0xbe));var _0x707d=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0x07d7[_0x5c7a85];return _0x35290f;};'use strict';var _=require(_0x707d('0x0'));var util=require('util');var logger=require(_0x707d('0x1'))(_0x707d('0x2'));var moment=require(_0x707d('0x3'));var BPromise=require(_0x707d('0x4'));var rp=require(_0x707d('0x5'));var fs=require('fs');var path=require(_0x707d('0x6'));var rimraf=require(_0x707d('0x7'));var config=require(_0x707d('0x8'));var attributes=require(_0x707d('0x9'));module[_0x707d('0xa')]=function(_0x22643f,_0x4cf3ac){return _0x22643f['define'](_0x707d('0xb'),attributes,{'tableName':_0x707d('0xc'),'paranoid':![],'indexes':[{'name':_0x707d('0xd'),'fields':[_0x707d('0xd')]},{'name':_0x707d('0xe'),'fields':[_0x707d('0xf')],'type':_0x707d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5db581,_0x215b87,_0x2430d4){var _0xae1fa=_0x22643f[_0x707d('0x11')];var _0x16955a=_0x5db581[_0x707d('0x12')]({'plain':!![]});if(_0x16955a[_0x707d('0x13')][_0x707d('0x14')]()==='in'||_0x16955a['direction'][_0x707d('0x14')]()===_0x707d('0x15')&&!_0x16955a['secret']&&!_[_0x707d('0x16')](_0x16955a[_0x707d('0x17')])){_0xae1fa[_0x707d('0x18')]['findOne']({'where':{'id':_0x16955a[_0x707d('0x19')]}})[_0x707d('0x1a')](function(_0x5ad716){if(_0x5ad716){_0x5ad716[_0x707d('0x1b')]({'lastMsgAt':_0x16955a[_0x707d('0x1c')],'lastMsgDirection':_0x16955a[_0x707d('0x13')]['toLowerCase']()});}})['catch'](function(_0x13c64b){console['error'](_0x13c64b);});}if(_0x16955a['direction']===_0x707d('0x15')&&!_0x16955a[_0x707d('0x1d')]){var _0x10c9b0;_0xae1fa[_0x707d('0x1e')][_0x707d('0x1f')]({'where':{'id':_0x16955a[_0x707d('0x20')]},'raw':!![]})[_0x707d('0x1a')](function(_0x5effc6){_0x10c9b0=_0x5effc6;if(_0x10c9b0&&_0x10c9b0[_0x707d('0x21')]){switch(_0x10c9b0[_0x707d('0x21')]){case _0x707d('0x22'):var _0x3ea752=require('twilio');if(_0x10c9b0[_0x707d('0x23')]&&_0x10c9b0[_0x707d('0x24')]&&_0x10c9b0['phone']){var _0x4519fa=new _0x3ea752(_0x10c9b0['accountSid'],_0x10c9b0[_0x707d('0x24')]);_0x4519fa[_0x707d('0x25')][_0x707d('0x26')]({'body':_0x16955a[_0x707d('0xf')],'to':_0x16955a[_0x707d('0x27')],'from':_0x10c9b0[_0x707d('0x27')],'statusCallback':_0x10c9b0[_0x707d('0x28')]+_0x707d('0x29')+_0x16955a['id']+_0x707d('0x2a')+_0x10c9b0[_0x707d('0x2b')]})[_0x707d('0x1a')](function(_0x1aa429){if(_0x1aa429[_0x707d('0x2c')]){return _0x5db581[_0x707d('0x1b')]({'messageId':_0x1aa429['sid']});}})['catch'](function(_0x134010){logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),'twilio',util['inspect'](_0x134010,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x707d('0x2f'),_0x707d('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x5e67a9=_0x707d('0x30');if(_0x10c9b0[_0x707d('0x31')]&&_0x10c9b0[_0x707d('0x32')]){var _0x6551e0={'recipient':[_0x16955a[_0x707d('0x27')]],'message':_0x16955a[_0x707d('0xf')],'message_type':_0x10c9b0[_0x707d('0x33')]};if(_0x10c9b0['smsMethod']&&_0x10c9b0[_0x707d('0x33')]!=='SI'){_0x6551e0[_0x707d('0x34')]=_0x10c9b0[_0x707d('0x27')];}var _0xa53190={'url':_0x5e67a9+_0x707d('0x35')+_0x10c9b0['username']+_0x707d('0x36')+_0x10c9b0[_0x707d('0x32')],'method':'GET'};rp(_0xa53190)[_0x707d('0x1a')](function(_0x27388e){var _0x574b61=_0x27388e['split'](';');var _0x35b415={'user_key':_0x574b61[0x0],'session_key':_0x574b61[0x1]};_0xa53190={'url':_0x5e67a9+'sms','method':_0x707d('0x37'),'headers':{'user_key':_0x35b415[_0x707d('0x38')],'Session_key':_0x35b415[_0x707d('0x39')]},'json':!![],'body':_0x6551e0};return rp(_0xa53190);})[_0x707d('0x1a')](function(_0x11aa48){if(_0x11aa48[_0x707d('0x3a')]>=0x1){var _0x3e4ba7={'messageId':_0x11aa48[_0x707d('0x3b')]};if(_0x10c9b0[_0x707d('0x33')]!=='GP'||!_0x10c9b0[_0x707d('0x3c')]){_0x3e4ba7['read']=!![];}return _0x5db581[_0x707d('0x1b')](_0x3e4ba7);}else{return logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x3d'),util[_0x707d('0x3e')](_0x11aa48,{'showHidden':![],'depth':null}));}})['catch'](function(_0x51b329){return logger['error'](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x3d'),util[_0x707d('0x3e')](_0x51b329,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),'skebby',_0x707d('0x3f'));}break;case _0x707d('0x40'):if(_0x10c9b0[_0x707d('0x24')]){var _0x475298={'recipient':_0x16955a[_0x707d('0x27')],'message':_0x16955a[_0x707d('0xf')],'sender':_0x10c9b0['senderString']||_0x10c9b0[_0x707d('0x27')],'authorization':_0x10c9b0[_0x707d('0x24')]};var _0x215b87={'method':_0x707d('0x37'),'uri':_0x707d('0x41'),'body':_0x475298,'json':!![]};rp(_0x215b87)['then'](function(_0x4646dc){var _0x3b0c94={'messageId':_0x4646dc[_0x707d('0x42')]};if(!_0x10c9b0['deliveryReport']){_0x3b0c94[_0x707d('0x43')]=!![];}return _0x5db581['update'](_0x3b0c94);})[_0x707d('0x44')](function(_0x492b9b){logger[_0x707d('0x2d')](_0x707d('0x2e'),'afterCreate',_0x707d('0x40'),util[_0x707d('0x3e')](_0x492b9b,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x707d('0x40'),_0x707d('0x45'));}break;case _0x707d('0x46'):if(_0x10c9b0[_0x707d('0x31')]&&_0x10c9b0[_0x707d('0x32')]){var _0x475298={'messages':[{'source':_0x707d('0x47'),'to':_0x16955a[_0x707d('0x27')],'body':_0x16955a['body'],'from':_0x10c9b0[_0x707d('0x48')]||_0x10c9b0[_0x707d('0x27')]}]};var _0x24000a=util['format']('%s:%s',_0x10c9b0[_0x707d('0x31')],_0x10c9b0['password']);var _0x215b87={'method':_0x707d('0x37'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x475298,'headers':{'Authorization':util[_0x707d('0x49')](_0x707d('0x4a'),new Buffer(_0x24000a)[_0x707d('0x4b')](_0x707d('0x4c')))},'json':!![]};rp(_0x215b87)['then'](function(_0x5b5214){if(_0x5b5214[_0x707d('0x4d')]>=0xc8&&_0x5b5214['http_code']<=0xce){if(_0x5b5214['data']&&_0x5b5214[_0x707d('0x4e')][_0x707d('0x4f')]>0x0){var _0x4fa1a7=_[_0x707d('0x50')](_0x5b5214[_0x707d('0x4e')]['messages']);var _0x1d863b={'messageId':_0x4fa1a7[_0x707d('0x51')]};if(!_0x10c9b0[_0x707d('0x3c')]){_0x1d863b[_0x707d('0x43')]=!![];}return _0x5db581['update'](_0x1d863b);}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x52'),util[_0x707d('0x3e')](_0x5b5214,{'showHidden':![],'depth':null}));}}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),'clickSend',util[_0x707d('0x3e')](_0x5b5214,{'showHidden':![],'depth':null}));}})['catch'](function(_0x47d2e6){logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x52'),util[_0x707d('0x3e')](_0x47d2e6,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x707d('0x53'):if(_0x10c9b0[_0x707d('0x54')]&&_0x10c9b0[_0x707d('0x24')]){var _0x475298={'dst':_0x16955a[_0x707d('0x27')],'text':_0x16955a['body'],'src':_0x10c9b0['senderString']||_0x10c9b0[_0x707d('0x27')],'url':_0x10c9b0[_0x707d('0x28')]+_0x707d('0x29')+_0x16955a['id']+_0x707d('0x2a')+_0x10c9b0[_0x707d('0x2b')]};var _0x24000a=util[_0x707d('0x49')](_0x707d('0x55'),_0x10c9b0['authId'],_0x10c9b0[_0x707d('0x24')]);var _0x215b87={'method':_0x707d('0x37'),'uri':util[_0x707d('0x49')](_0x707d('0x56'),_0x10c9b0[_0x707d('0x54')]),'body':_0x475298,'headers':{'Authorization':util[_0x707d('0x49')]('Basic\x20%s',new Buffer(_0x24000a)[_0x707d('0x4b')](_0x707d('0x4c')))},'json':!![]};rp(_0x215b87)[_0x707d('0x1a')](function(_0x49f0ca){var _0x31c08f={'messageId':_0x49f0ca[_0x707d('0x57')][0x0]};return _0x5db581[_0x707d('0x1b')](_0x31c08f);})[_0x707d('0x44')](function(_0x2afc3c){logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x53'),util[_0x707d('0x3e')](_0x2afc3c,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),'afterCreate',_0x707d('0x53'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x10c9b0[_0x707d('0x31')]&&_0x10c9b0['password']){if(_0x10c9b0[_0x707d('0x58')]){var _0xc67d90={'method':'POST','uri':_0x10c9b0[_0x707d('0x58')]+'/auth/1/session','body':{'username':_0x10c9b0[_0x707d('0x31')],'password':_0x10c9b0[_0x707d('0x32')]},'json':!![]};return rp(_0xc67d90)[_0x707d('0x1a')](function(_0x478806){var _0x2c6b09={'method':_0x707d('0x37'),'uri':_0x10c9b0[_0x707d('0x58')]+_0x707d('0x59'),'body':{'messages':[{'from':_0x10c9b0[_0x707d('0x27')],'destinations':[{'to':_0x16955a[_0x707d('0x27')]}],'text':_0x16955a[_0x707d('0xf')],'notifyUrl':_0x10c9b0[_0x707d('0x28')]+'/api/sms/messages/'+_0x16955a['id']+'/status?token='+_0x10c9b0['token'],'notifyContentType':'application/json','callbackData':_0x10c9b0[_0x707d('0x27')]+';'+_0x16955a[_0x707d('0xf')]}]},'headers':{'Authorization':_0x707d('0x5a')+_0x478806['token']},'json':!![]};return rp(_0x2c6b09)['then'](function(_0xb35bf3){if(_0xb35bf3['messages']){var _0x30aade={'messageId':_0xb35bf3['messages'][0x0][_0x707d('0xd')]};if(!_0x10c9b0[_0x707d('0x3c')]){_0x30aade['read']=!![];}return _0x5db581['update'](_0x30aade);}else{return logger['error'](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x5b'),util[_0x707d('0x3e')](_0xb35bf3,{'showHidden':![],'depth':null}));}});})[_0x707d('0x44')](function(_0x59f7e5){return logger[_0x707d('0x2d')](_0x707d('0x2e'),'afterCreate',_0x707d('0x5b'),util[_0x707d('0x3e')](_0x59f7e5,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x5b'),_0x707d('0x5c'));}}else{logger['error'](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x5b'),_0x707d('0x3f'));}break;case _0x707d('0x5d'):var _0x182169=require('crypto');if(_0x10c9b0[_0x707d('0x5e')]){var _0x22d322={};_0x22d322['login']=_0x10c9b0[_0x707d('0x31')];_0x22d322['phone']=_0x16955a[_0x707d('0x27')];_0x22d322[_0x707d('0x34')]=_0x10c9b0[_0x707d('0x27')];_0x22d322[_0x707d('0x5f')]=_0x16955a[_0x707d('0xf')];_0x22d322[_0x707d('0x60')]=+new Date();var _0x166a52='';var _0x4743a9='';var _0x5db2af=Object[_0x707d('0x61')](_0x22d322);_0x5db2af[_0x707d('0x62')]();for(var _0x8db39d=0x0;_0x8db39d<_0x5db2af[_0x707d('0x63')];_0x8db39d++){if(_0x166a52!=''){_0x166a52+='&';}_0x166a52+=_0x5db2af[_0x8db39d]+'='+encodeURIComponent(_0x22d322[_0x5db2af[_0x8db39d]]);_0x4743a9+=_0x22d322[_0x5db2af[_0x8db39d]];}_0x4743a9+=_0x10c9b0[_0x707d('0x5e')];_0x4743a9=_0x182169[_0x707d('0x64')](_0x707d('0x65'))['update'](_0x4743a9)[_0x707d('0x66')](_0x707d('0x67'));if(_0x166a52!==''){_0x166a52+='&';}_0x166a52+=_0x707d('0x68')+_0x4743a9;var _0xa53190={'method':_0x707d('0x69'),'uri':_0x10c9b0[_0x707d('0x58')]+_0x707d('0x6a')+_0x166a52,'json':!![]};return rp(_0xa53190)[_0x707d('0x1a')](function(_0x3c22c4){var _0x3d6a13=Object[_0x707d('0x61')](_0x3c22c4);if(_0x3c22c4[_0x3d6a13[0x0]][_0x707d('0x2d')]&&parseInt(_0x3c22c4[_0x3d6a13[0x0]][_0x707d('0x2d')])===0x0){var _0x2cf054={'messageId':_0x3c22c4[_0x3d6a13[0x0]]['id_sms']};if(!_0x10c9b0['deliveryReport']){_0x2cf054[_0x707d('0x43')]=!![];}return _0x5db581[_0x707d('0x1b')](_0x2cf054);}else{return logger[_0x707d('0x2d')](_0x707d('0x2e'),'afterCreate',_0x707d('0x5d'),util['inspect'](_0x3c22c4[_0x707d('0x2d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x40f546){return logger['error'](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x5d'),util[_0x707d('0x3e')](_0x40f546,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),'afterCreate',_0x707d('0x5d'),_0x707d('0x6b'));}break;case _0x707d('0x6c'):if(_0x10c9b0[_0x707d('0x5e')]){var _0x1cec7e={'method':_0x707d('0x37'),'uri':_0x707d('0x6d'),'headers':{'Authorization':_0x10c9b0[_0x707d('0x5e')]},'body':{'content':_0x16955a[_0x707d('0xf')],'to':[_0x16955a[_0x707d('0x27')]],'from':_0x10c9b0[_0x707d('0x27')],'binary':![],'clientMessageId':'uuid','charset':_0x707d('0x6e')},'json':!![]};rp(_0x1cec7e)[_0x707d('0x1a')](function(_0x214a20){if(!_0x214a20['error']){var _0x333a83={'messageId':_0x214a20['messages'][0x0][_0x707d('0x6f')]};if(!_0x10c9b0[_0x707d('0x3c')]){_0x333a83[_0x707d('0x43')]=!![];}return _0x5db581[_0x707d('0x1b')](_0x333a83);}else{return logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x6c'),util['inspect'](_0x214a20['error'],{'showHidden':![],'depth':null}));}})[_0x707d('0x44')](function(_0x1d5741){return logger['error'](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x6c'),util[_0x707d('0x3e')](_0x1d5741,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),'clickatell',_0x707d('0x6b'));}break;case'bandwidth':if(_0x10c9b0['username']&&_0x10c9b0[_0x707d('0x32')]){var _0x24000a=util[_0x707d('0x49')](_0x707d('0x55'),_0x10c9b0[_0x707d('0x31')],_0x10c9b0['password']);var _0x215b87={'method':'POST','uri':_0x707d('0x70')+_0x10c9b0[_0x707d('0x71')]+_0x707d('0x72'),'body':{'to':[_0x16955a['phone']],'text':_0x16955a['body'],'from':_0x10c9b0['phone'],'applicationId':_0x10c9b0['applicationId']},'headers':{'Authorization':util[_0x707d('0x49')](_0x707d('0x4a'),new Buffer(_0x24000a)[_0x707d('0x4b')]('base64'))},'json':!![]};rp(_0x215b87)[_0x707d('0x1a')](function(_0x495d74){if(_0x495d74['id']){var _0x22c6a8={'messageId':_0x495d74['id']};return _0x5db581['update'](_0x22c6a8);}else{logger['error'](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x73'),util['inspect'](_0x495d74,{'showHidden':![],'depth':null}));}})[_0x707d('0x44')](function(_0x3b80a9){logger[_0x707d('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x707d('0x73'),util[_0x707d('0x3e')](_0x3b80a9,{'showHidden':![],'depth':null}));});}else{logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x73'),_0x707d('0x3f'));}break;case _0x707d('0x74'):if(_0x10c9b0[_0x707d('0x5e')]){var _0x4702be={};var _0xa53190={'method':_0x707d('0x37'),'uri':_0x707d('0x75'),'headers':{'Authorization':_0x707d('0x76')+_0x10c9b0[_0x707d('0x5e')],'Content-Type':_0x707d('0x77')},'body':{'from':_0x10c9b0[_0x707d('0x27')],'to':_0x16955a[_0x707d('0x27')],'text':_0x16955a['body']},'json':!![]};return rp(_0xa53190)['then'](function(_0x3544ab){if(_0x3544ab[_0x707d('0x78')]==0xca){_0x4702be[_0x707d('0x79')]=_0x3544ab;var _0xe258ee={'method':'POST','uri':_0x707d('0x7a'),'headers':{'Authorization':_0x707d('0x76')+_0x10c9b0[_0x707d('0x5e')],'Content-Type':_0x707d('0x77')},'body':{'refid':_0x4702be[_0x707d('0x79')][_0x707d('0x7b')]},'json':!![]};return rp(_0xe258ee)[_0x707d('0x1a')](function(_0x27be1b){_0x4702be[_0x707d('0x7c')]=_0x27be1b;var _0x185eb0={'messageId':_0x4702be[_0x707d('0x79')][_0x707d('0x7b')],'read':!![]};return _0x5db581[_0x707d('0x1b')](_0x185eb0);});}else{return logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x74'),util[_0x707d('0x3e')](_0x3544ab,{'showHidden':![],'depth':null}));}})[_0x707d('0x44')](function(_0x339814){return logger[_0x707d('0x2d')](_0x707d('0x2e'),_0x707d('0x2f'),_0x707d('0x74'),util[_0x707d('0x3e')](_0x339814,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x707d('0x74'),'Token\x20not\x20received');}break;}}})[_0x707d('0x7d')](function(){_0x2430d4();});}else{_0x2430d4();}}},'charset':_0x707d('0x7e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9c4c=['uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsMessage.attributes','exports','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','SmsInteraction','SmsInteractionId','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','authId','/api/sms/messages/','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','messageId','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','createHash','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell'];(function(_0x4734b7,_0x2ba847){var _0x2dd9a5=function(_0x170809){while(--_0x170809){_0x4734b7['push'](_0x4734b7['shift']());}};_0x2dd9a5(++_0x2ba847);}(_0x9c4c,0xf6));var _0xc9c4=function(_0xe61843,_0x22e495){_0xe61843=_0xe61843-0x0;var _0x330240=_0x9c4c[_0xe61843];return _0x330240;};'use strict';var _=require('lodash');var util=require(_0xc9c4('0x0'));var logger=require(_0xc9c4('0x1'))(_0xc9c4('0x2'));var moment=require(_0xc9c4('0x3'));var BPromise=require(_0xc9c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc9c4('0x5'));var config=require(_0xc9c4('0x6'));var attributes=require(_0xc9c4('0x7'));module[_0xc9c4('0x8')]=function(_0x1a498b,_0x4a7e26){return _0x1a498b['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xc9c4('0x9'),'fields':[_0xc9c4('0xa')],'type':_0xc9c4('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8a9b64,_0x119ced,_0x5a8148){var _0x1fe877=_0x1a498b['models'];var _0x15755a=_0x8a9b64[_0xc9c4('0xc')]({'plain':!![]});if(_0x15755a[_0xc9c4('0xd')][_0xc9c4('0xe')]()==='in'||_0x15755a[_0xc9c4('0xd')][_0xc9c4('0xe')]()===_0xc9c4('0xf')&&!_0x15755a['secret']&&!_[_0xc9c4('0x10')](_0x15755a['UserId'])){_0x1fe877[_0xc9c4('0x11')]['findOne']({'where':{'id':_0x15755a[_0xc9c4('0x12')]}})[_0xc9c4('0x13')](function(_0x2e9a42){if(_0x2e9a42){_0x2e9a42[_0xc9c4('0x14')]({'lastMsgAt':_0x15755a['createdAt'],'lastMsgDirection':_0x15755a['direction']['toLowerCase']()});}})[_0xc9c4('0x15')](function(_0x46eec3){console[_0xc9c4('0x16')](_0x46eec3);});}if(_0x15755a['direction']===_0xc9c4('0xf')&&!_0x15755a['secret']){var _0x431bd9;_0x1fe877[_0xc9c4('0x17')][_0xc9c4('0x18')]({'where':{'id':_0x15755a[_0xc9c4('0x19')]},'raw':!![]})['then'](function(_0x45f504){_0x431bd9=_0x45f504;if(_0x431bd9&&_0x431bd9[_0xc9c4('0x1a')]){switch(_0x431bd9[_0xc9c4('0x1a')]){case _0xc9c4('0x1b'):var _0x2e9798=require(_0xc9c4('0x1b'));if(_0x431bd9[_0xc9c4('0x1c')]&&_0x431bd9['authToken']&&_0x431bd9[_0xc9c4('0x1d')]){var _0x3e4586=new _0x2e9798(_0x431bd9[_0xc9c4('0x1c')],_0x431bd9[_0xc9c4('0x1e')]);_0x3e4586[_0xc9c4('0x1f')][_0xc9c4('0x20')]({'body':_0x15755a['body'],'to':_0x15755a[_0xc9c4('0x1d')],'from':_0x431bd9[_0xc9c4('0x1d')],'statusCallback':_0x431bd9[_0xc9c4('0x21')]+'/api/sms/messages/'+_0x15755a['id']+_0xc9c4('0x22')+_0x431bd9[_0xc9c4('0x23')]})[_0xc9c4('0x13')](function(_0xcb919c){if(_0xcb919c[_0xc9c4('0x24')]){return _0x8a9b64[_0xc9c4('0x14')]({'messageId':_0xcb919c[_0xc9c4('0x24')]});}})[_0xc9c4('0x15')](function(_0x2d47cf){logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x1b'),util[_0xc9c4('0x27')](_0x2d47cf,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc9c4('0x26'),_0xc9c4('0x1b'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc9c4('0x28'):var _0x4e6473=_0xc9c4('0x29');if(_0x431bd9[_0xc9c4('0x2a')]&&_0x431bd9[_0xc9c4('0x2b')]){var _0x392015={'recipient':[_0x15755a[_0xc9c4('0x1d')]],'message':_0x15755a['body'],'message_type':_0x431bd9[_0xc9c4('0x2c')]};if(_0x431bd9[_0xc9c4('0x2c')]&&_0x431bd9[_0xc9c4('0x2c')]!=='SI'){_0x392015[_0xc9c4('0x2d')]=_0x431bd9[_0xc9c4('0x1d')];}var _0x4c6746={'url':_0x4e6473+'login?username='+_0x431bd9[_0xc9c4('0x2a')]+_0xc9c4('0x2e')+_0x431bd9[_0xc9c4('0x2b')],'method':_0xc9c4('0x2f')};rp(_0x4c6746)[_0xc9c4('0x13')](function(_0x1acba8){var _0x21b9df=_0x1acba8[_0xc9c4('0x30')](';');var _0x9799b4={'user_key':_0x21b9df[0x0],'session_key':_0x21b9df[0x1]};_0x4c6746={'url':_0x4e6473+'sms','method':_0xc9c4('0x31'),'headers':{'user_key':_0x9799b4[_0xc9c4('0x32')],'Session_key':_0x9799b4[_0xc9c4('0x33')]},'json':!![],'body':_0x392015};return rp(_0x4c6746);})[_0xc9c4('0x13')](function(_0x27e68f){if(_0x27e68f[_0xc9c4('0x34')]>=0x1){var _0x4c0d3f={'messageId':_0x27e68f[_0xc9c4('0x35')]};if(_0x431bd9[_0xc9c4('0x2c')]!=='GP'||!_0x431bd9[_0xc9c4('0x36')]){_0x4c0d3f[_0xc9c4('0x37')]=!![];}return _0x8a9b64[_0xc9c4('0x14')](_0x4c0d3f);}else{return logger[_0xc9c4('0x16')](_0xc9c4('0x25'),'afterCreate','skebby',util['inspect'](_0x27e68f,{'showHidden':![],'depth':null}));}})[_0xc9c4('0x15')](function(_0x300f13){return logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x28'),util['inspect'](_0x300f13,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x28'),_0xc9c4('0x38'));}break;case _0xc9c4('0x39'):if(_0x431bd9['authToken']){var _0xa28233={'recipient':_0x15755a[_0xc9c4('0x1d')],'message':_0x15755a[_0xc9c4('0xa')],'sender':_0x431bd9[_0xc9c4('0x3a')]||_0x431bd9[_0xc9c4('0x1d')],'authorization':_0x431bd9[_0xc9c4('0x1e')]};var _0x119ced={'method':_0xc9c4('0x31'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xa28233,'json':!![]};rp(_0x119ced)[_0xc9c4('0x13')](function(_0x2827d5){var _0x3c7f23={'messageId':_0x2827d5[_0xc9c4('0x3b')]};if(!_0x431bd9[_0xc9c4('0x36')]){_0x3c7f23[_0xc9c4('0x37')]=!![];}return _0x8a9b64['update'](_0x3c7f23);})[_0xc9c4('0x15')](function(_0x231ab7){logger[_0xc9c4('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc9c4('0x26'),_0xc9c4('0x39'),util[_0xc9c4('0x27')](_0x231ab7,{'showHidden':![],'depth':null}));});}else{logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x39'),_0xc9c4('0x3c'));}break;case _0xc9c4('0x3d'):if(_0x431bd9[_0xc9c4('0x2a')]&&_0x431bd9[_0xc9c4('0x2b')]){var _0xa28233={'messages':[{'source':_0xc9c4('0x3e'),'to':_0x15755a[_0xc9c4('0x1d')],'body':_0x15755a[_0xc9c4('0xa')],'from':_0x431bd9[_0xc9c4('0x3a')]||_0x431bd9['phone']}]};var _0x517491=util[_0xc9c4('0x3f')](_0xc9c4('0x40'),_0x431bd9[_0xc9c4('0x2a')],_0x431bd9[_0xc9c4('0x2b')]);var _0x119ced={'method':_0xc9c4('0x31'),'uri':_0xc9c4('0x41'),'body':_0xa28233,'headers':{'Authorization':util['format'](_0xc9c4('0x42'),new Buffer(_0x517491)[_0xc9c4('0x43')](_0xc9c4('0x44')))},'json':!![]};rp(_0x119ced)[_0xc9c4('0x13')](function(_0x3710d6){if(_0x3710d6[_0xc9c4('0x45')]>=0xc8&&_0x3710d6[_0xc9c4('0x45')]<=0xce){if(_0x3710d6['data']&&_0x3710d6[_0xc9c4('0x46')][_0xc9c4('0x47')]>0x0){var _0x20446f=_['head'](_0x3710d6[_0xc9c4('0x46')]['messages']);var _0x30991d={'messageId':_0x20446f[_0xc9c4('0x48')]};if(!_0x431bd9[_0xc9c4('0x36')]){_0x30991d[_0xc9c4('0x37')]=!![];}return _0x8a9b64[_0xc9c4('0x14')](_0x30991d);}else{logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),'clickSend',util[_0xc9c4('0x27')](_0x3710d6,{'showHidden':![],'depth':null}));}}else{logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x49'),util[_0xc9c4('0x27')](_0x3710d6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c4972){logger[_0xc9c4('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc9c4('0x49'),util['inspect'](_0x3c4972,{'showHidden':![],'depth':null}));});}else{logger[_0xc9c4('0x16')](_0xc9c4('0x25'),'afterCreate',_0xc9c4('0x49'),_0xc9c4('0x38'));}break;case'plivo':if(_0x431bd9[_0xc9c4('0x4a')]&&_0x431bd9[_0xc9c4('0x1e')]){var _0xa28233={'dst':_0x15755a[_0xc9c4('0x1d')],'text':_0x15755a['body'],'src':_0x431bd9[_0xc9c4('0x3a')]||_0x431bd9[_0xc9c4('0x1d')],'url':_0x431bd9[_0xc9c4('0x21')]+_0xc9c4('0x4b')+_0x15755a['id']+'/status?token='+_0x431bd9[_0xc9c4('0x23')]};var _0x517491=util[_0xc9c4('0x3f')](_0xc9c4('0x40'),_0x431bd9[_0xc9c4('0x4a')],_0x431bd9[_0xc9c4('0x1e')]);var _0x119ced={'method':_0xc9c4('0x31'),'uri':util[_0xc9c4('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x431bd9['authId']),'body':_0xa28233,'headers':{'Authorization':util[_0xc9c4('0x3f')](_0xc9c4('0x42'),new Buffer(_0x517491)['toString'](_0xc9c4('0x44')))},'json':!![]};rp(_0x119ced)['then'](function(_0x4b9022){var _0x24d720={'messageId':_0x4b9022['message_uuid'][0x0]};return _0x8a9b64[_0xc9c4('0x14')](_0x24d720);})['catch'](function(_0x150468){logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),'plivo',util['inspect'](_0x150468,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x4c'),_0xc9c4('0x4d'));}break;case _0xc9c4('0x4e'):if(_0x431bd9[_0xc9c4('0x2a')]&&_0x431bd9[_0xc9c4('0x2b')]){if(_0x431bd9[_0xc9c4('0x4f')]){var _0x279c39={'method':_0xc9c4('0x31'),'uri':_0x431bd9[_0xc9c4('0x4f')]+_0xc9c4('0x50'),'body':{'username':_0x431bd9[_0xc9c4('0x2a')],'password':_0x431bd9['password']},'json':!![]};return rp(_0x279c39)[_0xc9c4('0x13')](function(_0x2bdf01){var _0x854ec0={'method':_0xc9c4('0x31'),'uri':_0x431bd9[_0xc9c4('0x4f')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x431bd9['phone'],'destinations':[{'to':_0x15755a[_0xc9c4('0x1d')]}],'text':_0x15755a[_0xc9c4('0xa')],'notifyUrl':_0x431bd9['remote']+'/api/sms/messages/'+_0x15755a['id']+_0xc9c4('0x22')+_0x431bd9[_0xc9c4('0x23')],'notifyContentType':_0xc9c4('0x51'),'callbackData':_0x431bd9[_0xc9c4('0x1d')]+';'+_0x15755a[_0xc9c4('0xa')]}]},'headers':{'Authorization':_0xc9c4('0x52')+_0x2bdf01[_0xc9c4('0x23')]},'json':!![]};return rp(_0x854ec0)[_0xc9c4('0x13')](function(_0x5a8cea){if(_0x5a8cea[_0xc9c4('0x1f')]){var _0x257a37={'messageId':_0x5a8cea[_0xc9c4('0x1f')][0x0][_0xc9c4('0x53')]};if(!_0x431bd9[_0xc9c4('0x36')]){_0x257a37[_0xc9c4('0x37')]=!![];}return _0x8a9b64[_0xc9c4('0x14')](_0x257a37);}else{return logger['error'](_0xc9c4('0x25'),'afterCreate',_0xc9c4('0x4e'),util[_0xc9c4('0x27')](_0x5a8cea,{'showHidden':![],'depth':null}));}});})[_0xc9c4('0x15')](function(_0x219cc5){return logger[_0xc9c4('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc9c4('0x26'),_0xc9c4('0x4e'),util[_0xc9c4('0x27')](_0x219cc5,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc9c4('0x26'),'infobip',_0xc9c4('0x54'));}}else{logger['error'](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x4e'),_0xc9c4('0x38'));}break;case _0xc9c4('0x55'):var _0x2abc0e=require(_0xc9c4('0x56'));if(_0x431bd9[_0xc9c4('0x57')]){var _0x5f4c7f={};_0x5f4c7f[_0xc9c4('0x58')]=_0x431bd9['username'];_0x5f4c7f[_0xc9c4('0x1d')]=_0x15755a[_0xc9c4('0x1d')];_0x5f4c7f[_0xc9c4('0x2d')]=_0x431bd9[_0xc9c4('0x1d')];_0x5f4c7f['text']=_0x15755a[_0xc9c4('0xa')];_0x5f4c7f[_0xc9c4('0x59')]=+new Date();var _0x52d625='';var _0x22f38d='';var _0x2f04d5=Object['keys'](_0x5f4c7f);_0x2f04d5['sort']();for(var _0x4653fa=0x0;_0x4653fa<_0x2f04d5['length'];_0x4653fa++){if(_0x52d625!=''){_0x52d625+='&';}_0x52d625+=_0x2f04d5[_0x4653fa]+'='+encodeURIComponent(_0x5f4c7f[_0x2f04d5[_0x4653fa]]);_0x22f38d+=_0x5f4c7f[_0x2f04d5[_0x4653fa]];}_0x22f38d+=_0x431bd9['apiKey'];_0x22f38d=_0x2abc0e[_0xc9c4('0x5a')]('md5')[_0xc9c4('0x14')](_0x22f38d)[_0xc9c4('0x5b')]('hex');if(_0x52d625!==''){_0x52d625+='&';}_0x52d625+=_0xc9c4('0x5c')+_0x22f38d;var _0x4c6746={'method':'GET','uri':_0x431bd9['baseUrl']+_0xc9c4('0x5d')+_0x52d625,'json':!![]};return rp(_0x4c6746)['then'](function(_0x58597b){var _0x45ac18=Object['keys'](_0x58597b);if(_0x58597b[_0x45ac18[0x0]][_0xc9c4('0x16')]&&parseInt(_0x58597b[_0x45ac18[0x0]][_0xc9c4('0x16')])===0x0){var _0x55f33a={'messageId':_0x58597b[_0x45ac18[0x0]]['id_sms']};if(!_0x431bd9[_0xc9c4('0x36')]){_0x55f33a['read']=!![];}return _0x8a9b64[_0xc9c4('0x14')](_0x55f33a);}else{return logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x55'),util[_0xc9c4('0x27')](_0x58597b[_0xc9c4('0x16')],{'showHidden':![],'depth':null}));}})[_0xc9c4('0x15')](function(_0x2c919b){return logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x55'),util[_0xc9c4('0x27')](_0x2c919b,{'showHidden':![],'depth':null}));});}else{logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x55'),_0xc9c4('0x5e'));}break;case _0xc9c4('0x5f'):if(_0x431bd9[_0xc9c4('0x57')]){var _0xfd77ef={'method':_0xc9c4('0x31'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x431bd9[_0xc9c4('0x57')]},'body':{'content':_0x15755a[_0xc9c4('0xa')],'to':[_0x15755a[_0xc9c4('0x1d')]],'from':_0x431bd9[_0xc9c4('0x1d')],'binary':![],'clientMessageId':_0xc9c4('0x60'),'charset':_0xc9c4('0x61')},'json':!![]};rp(_0xfd77ef)['then'](function(_0x28013f){if(!_0x28013f[_0xc9c4('0x16')]){var _0x1783c9={'messageId':_0x28013f[_0xc9c4('0x1f')][0x0][_0xc9c4('0x62')]};if(!_0x431bd9[_0xc9c4('0x36')]){_0x1783c9[_0xc9c4('0x37')]=!![];}return _0x8a9b64[_0xc9c4('0x14')](_0x1783c9);}else{return logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x5f'),util[_0xc9c4('0x27')](_0x28013f[_0xc9c4('0x16')],{'showHidden':![],'depth':null}));}})[_0xc9c4('0x15')](function(_0x4c2f8d){return logger['error'](_0xc9c4('0x25'),'afterCreate',_0xc9c4('0x5f'),util[_0xc9c4('0x27')](_0x4c2f8d,{'showHidden':![],'depth':null}));});}else{logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0xc9c4('0x63'):if(_0x431bd9['username']&&_0x431bd9[_0xc9c4('0x2b')]){var _0x517491=util[_0xc9c4('0x3f')]('%s:%s',_0x431bd9[_0xc9c4('0x2a')],_0x431bd9[_0xc9c4('0x2b')]);var _0x119ced={'method':_0xc9c4('0x31'),'uri':_0xc9c4('0x64')+_0x431bd9[_0xc9c4('0x65')]+_0xc9c4('0x66'),'body':{'to':[_0x15755a[_0xc9c4('0x1d')]],'text':_0x15755a['body'],'from':_0x431bd9[_0xc9c4('0x1d')],'applicationId':_0x431bd9[_0xc9c4('0x67')]},'headers':{'Authorization':util[_0xc9c4('0x3f')](_0xc9c4('0x42'),new Buffer(_0x517491)['toString'](_0xc9c4('0x44')))},'json':!![]};rp(_0x119ced)[_0xc9c4('0x13')](function(_0x30fdf4){if(_0x30fdf4['id']){var _0x4211c7={'messageId':_0x30fdf4['id']};return _0x8a9b64[_0xc9c4('0x14')](_0x4211c7);}else{logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x63'),util[_0xc9c4('0x27')](_0x30fdf4,{'showHidden':![],'depth':null}));}})[_0xc9c4('0x15')](function(_0x46b131){logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x63'),util['inspect'](_0x46b131,{'showHidden':![],'depth':null}));});}else{logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xc9c4('0x68'):if(_0x431bd9[_0xc9c4('0x57')]){var _0x26e0e2={};var _0x4c6746={'method':_0xc9c4('0x31'),'uri':_0xc9c4('0x69'),'headers':{'Authorization':_0xc9c4('0x6a')+_0x431bd9[_0xc9c4('0x57')],'Content-Type':'application/json'},'body':{'from':_0x431bd9[_0xc9c4('0x1d')],'to':_0x15755a[_0xc9c4('0x1d')],'text':_0x15755a['body']},'json':!![]};return rp(_0x4c6746)[_0xc9c4('0x13')](function(_0x86de5e){if(_0x86de5e[_0xc9c4('0x6b')]==0xca){_0x26e0e2[_0xc9c4('0x6c')]=_0x86de5e;var _0x2a30e2={'method':_0xc9c4('0x31'),'uri':_0xc9c4('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x431bd9[_0xc9c4('0x57')],'Content-Type':'application/json'},'body':{'refid':_0x26e0e2[_0xc9c4('0x6c')][_0xc9c4('0x6e')]},'json':!![]};return rp(_0x2a30e2)[_0xc9c4('0x13')](function(_0x28d975){_0x26e0e2[_0xc9c4('0x6f')]=_0x28d975;var _0x3fad64={'messageId':_0x26e0e2[_0xc9c4('0x6c')]['refid'],'read':!![]};return _0x8a9b64[_0xc9c4('0x14')](_0x3fad64);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc9c4('0x68'),util[_0xc9c4('0x27')](_0x86de5e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x53deec){return logger[_0xc9c4('0x16')](_0xc9c4('0x25'),_0xc9c4('0x26'),_0xc9c4('0x68'),util[_0xc9c4('0x27')](_0x53deec,{'showHidden':![],'depth':null}));});}else{return logger[_0xc9c4('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc9c4('0x26'),_0xc9c4('0x68'),_0xc9c4('0x70'));}break;}}})['finally'](function(){_0x5a8148();});}else{_0x5a8148();}}},'charset':_0xc9c4('0x71'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c0d6566..0708fb2 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 _0x9af2=['register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket'];(function(_0x117ccb,_0x442fb4){var _0x41677b=function(_0x14205e){while(--_0x14205e){_0x117ccb['push'](_0x117ccb['shift']());}};_0x41677b(++_0x442fb4);}(_0x9af2,0x13c));var _0x29af=function(_0x3917ab,_0x30a055){_0x3917ab=_0x3917ab-0x0;var _0x46f4fe=_0x9af2[_0x3917ab];return _0x46f4fe;};'use strict';var _=require('lodash');var util=require(_0x29af('0x0'));var moment=require(_0x29af('0x1'));var BPromise=require(_0x29af('0x2'));var rs=require(_0x29af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x29af('0x4'));var logger=require('../../config/logger')(_0x29af('0x5'));var config=require(_0x29af('0x6'));var jayson=require(_0x29af('0x7'));var client=jayson['client'][_0x29af('0x8')]({'port':0x232a});config['redis']=_[_0x29af('0x9')](config[_0x29af('0xa')],{'host':_0x29af('0xb'),'port':0x18eb});var socket=require(_0x29af('0xc'))(new Redis(config['redis']));require(_0x29af('0xd'))[_0x29af('0xe')](socket);function respondWithRpcPromise(_0x1349b4,_0x14d3a4,_0x2ac600){return new BPromise(function(_0x53913f,_0x41c6c6){return client[_0x29af('0xf')](_0x1349b4,_0x2ac600)[_0x29af('0x10')](function(_0x150def){logger[_0x29af('0x11')](_0x29af('0x12'),_0x14d3a4,_0x29af('0x13'));logger[_0x29af('0x14')](_0x29af('0x15'),_0x14d3a4,_0x29af('0x13'),JSON[_0x29af('0x16')](_0x150def));if(_0x150def[_0x29af('0x17')]){if(_0x150def[_0x29af('0x17')][_0x29af('0x18')]===0x1f4){logger[_0x29af('0x17')](_0x29af('0x12'),_0x14d3a4,_0x150def[_0x29af('0x17')][_0x29af('0x19')]);return _0x41c6c6(_0x150def[_0x29af('0x17')][_0x29af('0x19')]);}logger[_0x29af('0x17')](_0x29af('0x12'),_0x14d3a4,_0x150def[_0x29af('0x17')]['message']);return _0x53913f(_0x150def[_0x29af('0x17')]['message']);}else{logger['info'](_0x29af('0x12'),_0x14d3a4,_0x29af('0x13'));_0x53913f(_0x150def[_0x29af('0x1a')][_0x29af('0x19')]);}})[_0x29af('0x1b')](function(_0x173f75){logger[_0x29af('0x17')](_0x29af('0x12'),_0x14d3a4,_0x173f75);_0x41c6c6(_0x173f75);});});}exports[_0x29af('0x1c')]=function(_0x83ee78){var _0xe22dac=this;return new Promise(function(_0x1b217e,_0x3fba80){return db[_0x29af('0x1d')]['create'](_0x83ee78[_0x29af('0x1e')],{'raw':_0x83ee78[_0x29af('0x1f')]?_0x83ee78[_0x29af('0x1f')][_0x29af('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x15a4db){logger[_0x29af('0x11')](_0x29af('0x1c'),_0x83ee78);logger[_0x29af('0x14')]('CreateSmsMessage',_0x83ee78,JSON[_0x29af('0x16')](_0x15a4db));_0x1b217e(_0x15a4db);})[_0x29af('0x1b')](function(_0x36fe6b){logger[_0x29af('0x17')](_0x29af('0x1c'),_0x36fe6b[_0x29af('0x19')],_0x83ee78);_0x3fba80(_0xe22dac[_0x29af('0x17')](0x1f4,_0x36fe6b[_0x29af('0x19')]));});});}; \ No newline at end of file +var _0x89c7=['raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','SmsMessage','create','body'];(function(_0xae91ca,_0x1cac2a){var _0x545f87=function(_0x39b1ff){while(--_0x39b1ff){_0xae91ca['push'](_0xae91ca['shift']());}};_0x545f87(++_0x1cac2a);}(_0x89c7,0xa7));var _0x789c=function(_0x1a58a9,_0xe32406){_0x1a58a9=_0x1a58a9-0x0;var _0x45449b=_0x89c7[_0x1a58a9];return _0x45449b;};'use strict';var _=require(_0x789c('0x0'));var util=require(_0x789c('0x1'));var moment=require(_0x789c('0x2'));var BPromise=require(_0x789c('0x3'));var rs=require(_0x789c('0x4'));var fs=require('fs');var Redis=require(_0x789c('0x5'));var db=require(_0x789c('0x6'))['db'];var utils=require(_0x789c('0x7'));var logger=require(_0x789c('0x8'))(_0x789c('0x9'));var config=require('../../config/environment');var jayson=require(_0x789c('0xa'));var client=jayson[_0x789c('0xb')][_0x789c('0xc')]({'port':0x232a});config[_0x789c('0xd')]=_['defaults'](config[_0x789c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x789c('0xe'))(new Redis(config['redis']));require(_0x789c('0xf'))[_0x789c('0x10')](socket);function respondWithRpcPromise(_0x4e7696,_0xaeb9d1,_0x3d2644){return new BPromise(function(_0x56d703,_0x4df617){return client[_0x789c('0x11')](_0x4e7696,_0x3d2644)[_0x789c('0x12')](function(_0x1263cf){logger[_0x789c('0x13')]('SmsMessage,\x20%s,\x20%s',_0xaeb9d1,_0x789c('0x14'));logger[_0x789c('0x15')](_0x789c('0x16'),_0xaeb9d1,_0x789c('0x14'),JSON[_0x789c('0x17')](_0x1263cf));if(_0x1263cf[_0x789c('0x18')]){if(_0x1263cf[_0x789c('0x18')]['code']===0x1f4){logger[_0x789c('0x18')](_0x789c('0x19'),_0xaeb9d1,_0x1263cf[_0x789c('0x18')]['message']);return _0x4df617(_0x1263cf[_0x789c('0x18')][_0x789c('0x1a')]);}logger[_0x789c('0x18')](_0x789c('0x19'),_0xaeb9d1,_0x1263cf[_0x789c('0x18')][_0x789c('0x1a')]);return _0x56d703(_0x1263cf['error'][_0x789c('0x1a')]);}else{logger[_0x789c('0x13')](_0x789c('0x19'),_0xaeb9d1,'request\x20sent');_0x56d703(_0x1263cf[_0x789c('0x1b')][_0x789c('0x1a')]);}})['catch'](function(_0x34673c){logger[_0x789c('0x18')]('SmsMessage,\x20%s,\x20%s',_0xaeb9d1,_0x34673c);_0x4df617(_0x34673c);});});}exports['CreateSmsMessage']=function(_0x4d32dd){var _0x1e2f82=this;return new Promise(function(_0x2866c3,_0x45598a){return db[_0x789c('0x1c')][_0x789c('0x1d')](_0x4d32dd[_0x789c('0x1e')],{'raw':_0x4d32dd['options']?_0x4d32dd['options'][_0x789c('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x5ea5eb){logger[_0x789c('0x13')](_0x789c('0x20'),_0x4d32dd);logger[_0x789c('0x15')]('CreateSmsMessage',_0x4d32dd,JSON['stringify'](_0x5ea5eb));_0x2866c3(_0x5ea5eb);})['catch'](function(_0x43284f){logger[_0x789c('0x18')](_0x789c('0x20'),_0x43284f[_0x789c('0x1a')],_0x4d32dd);_0x45598a(_0x1e2f82[_0x789c('0x18')](0x1f4,_0x43284f[_0x789c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d914b2f..8079f00 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 _0x4d2c=['remove','removeListener','register','length','./smsMessage.events','save'];(function(_0x3c4077,_0x1a8d67){var _0x596908=function(_0x4630e2){while(--_0x4630e2){_0x3c4077['push'](_0x3c4077['shift']());}};_0x596908(++_0x1a8d67);}(_0x4d2c,0x11e));var _0xc4d2=function(_0x590972,_0x4dd46f){_0x590972=_0x590972-0x0;var _0x273346=_0x4d2c[_0x590972];return _0x273346;};'use strict';var SmsMessageEvents=require(_0xc4d2('0x0'));var events=[_0xc4d2('0x1'),_0xc4d2('0x2'),'update'];function createListener(_0x38a7b9,_0x43c4ad){return function(_0x4164f9){_0x43c4ad['emit'](_0x38a7b9,_0x4164f9);};}function removeListener(_0x457f0b,_0x1df3f4){return function(){SmsMessageEvents[_0xc4d2('0x3')](_0x457f0b,_0x1df3f4);};}exports[_0xc4d2('0x4')]=function(_0x5c8428){for(var _0x26e07b=0x0,_0x357954=events[_0xc4d2('0x5')];_0x26e07b<_0x357954;_0x26e07b++){var _0x248571=events[_0x26e07b];var _0x2aadc3=createListener('smsMessage:'+_0x248571,_0x5c8428);SmsMessageEvents['on'](_0x248571,_0x2aadc3);}}; \ No newline at end of file +var _0x57d1=['update','emit','removeListener','length','smsMessage:','./smsMessage.events'];(function(_0x2a825a,_0x2ef4d6){var _0x26cda4=function(_0x5340fc){while(--_0x5340fc){_0x2a825a['push'](_0x2a825a['shift']());}};_0x26cda4(++_0x2ef4d6);}(_0x57d1,0x1af));var _0x157d=function(_0x38f532,_0x5317ed){_0x38f532=_0x38f532-0x0;var _0x12be51=_0x57d1[_0x38f532];return _0x12be51;};'use strict';var SmsMessageEvents=require(_0x157d('0x0'));var events=['save','remove',_0x157d('0x1')];function createListener(_0x4a2cba,_0x376bdc){return function(_0x58b95a){_0x376bdc[_0x157d('0x2')](_0x4a2cba,_0x58b95a);};}function removeListener(_0x16558a,_0x3d26e4){return function(){SmsMessageEvents[_0x157d('0x3')](_0x16558a,_0x3d26e4);};}exports['register']=function(_0x37efb1){for(var _0x5addac=0x0,_0x3dc30d=events[_0x157d('0x4')];_0x5addac<_0x3dc30d;_0x5addac++){var _0x26841=events[_0x5addac];var _0x32315f=createListener(_0x157d('0x5')+_0x26841,_0x37efb1);SmsMessageEvents['on'](_0x26841,_0x32315f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b101067..e141e9a 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 _0xf952=['getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','get','/:id/members'];(function(_0xd30e43,_0x4dacb2){var _0x39cfe1=function(_0x4457d8){while(--_0x4457d8){_0xd30e43['push'](_0xd30e43['shift']());}};_0x39cfe1(++_0x4dacb2);}(_0xf952,0x158));var _0x2f95=function(_0x5ebc27,_0x6dfad){_0x5ebc27=_0x5ebc27-0x0;var _0x3ef87f=_0xf952[_0x5ebc27];return _0x3ef87f;};'use strict';var multer=require(_0x2f95('0x0'));var util=require(_0x2f95('0x1'));var path=require(_0x2f95('0x2'));var timeout=require(_0x2f95('0x3'));var express=require('express');var router=express[_0x2f95('0x4')]();var fs_extra=require(_0x2f95('0x5'));var auth=require(_0x2f95('0x6'));var interaction=require(_0x2f95('0x7'));var config=require(_0x2f95('0x8'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x2f95('0x9')](),controller[_0x2f95('0xa')]);router['get'](_0x2f95('0xb'),auth[_0x2f95('0x9')](),controller[_0x2f95('0xc')]);router['get'](_0x2f95('0xd'),auth[_0x2f95('0x9')](),controller['show']);router[_0x2f95('0xe')](_0x2f95('0xf'),auth[_0x2f95('0x9')](),controller[_0x2f95('0x10')]);router[_0x2f95('0xe')]('/:id/teams',auth[_0x2f95('0x9')](),controller[_0x2f95('0x11')]);router[_0x2f95('0xe')](_0x2f95('0x12'),auth[_0x2f95('0x9')](),controller[_0x2f95('0x13')]);router[_0x2f95('0x14')]('/',auth[_0x2f95('0x9')](),controller[_0x2f95('0x15')]);router[_0x2f95('0x14')](_0x2f95('0x16'),auth[_0x2f95('0x9')](),controller['addTeams']);router['post'](_0x2f95('0x12'),auth[_0x2f95('0x9')](),controller[_0x2f95('0x17')]);router[_0x2f95('0x18')](_0x2f95('0xd'),auth[_0x2f95('0x9')](),controller['update']);router[_0x2f95('0x19')](_0x2f95('0xd'),auth[_0x2f95('0x9')](),controller[_0x2f95('0x1a')]);router['delete'](_0x2f95('0x16'),auth['isAuthenticated'](),controller[_0x2f95('0x1b')]);router[_0x2f95('0x19')](_0x2f95('0x12'),auth[_0x2f95('0x9')](),controller[_0x2f95('0x1c')]);module[_0x2f95('0x1d')]=router; \ No newline at end of file +var _0x9d50=['show','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe'];(function(_0x44497f,_0x528bdc){var _0x37a190=function(_0x2d4df7){while(--_0x2d4df7){_0x44497f['push'](_0x44497f['shift']());}};_0x37a190(++_0x528bdc);}(_0x9d50,0xf7));var _0x09d5=function(_0x92c2a2,_0xf2c3f8){_0x92c2a2=_0x92c2a2-0x0;var _0x52a367=_0x9d50[_0x92c2a2];return _0x52a367;};'use strict';var multer=require(_0x09d5('0x0'));var util=require(_0x09d5('0x1'));var path=require(_0x09d5('0x2'));var timeout=require(_0x09d5('0x3'));var express=require(_0x09d5('0x4'));var router=express['Router']();var fs_extra=require(_0x09d5('0x5'));var auth=require(_0x09d5('0x6'));var interaction=require(_0x09d5('0x7'));var config=require(_0x09d5('0x8'));var controller=require(_0x09d5('0x9'));router[_0x09d5('0xa')]('/',auth[_0x09d5('0xb')](),controller[_0x09d5('0xc')]);router[_0x09d5('0xa')]('/describe',auth[_0x09d5('0xb')](),controller[_0x09d5('0xd')]);router[_0x09d5('0xa')]('/:id',auth[_0x09d5('0xb')](),controller[_0x09d5('0xe')]);router[_0x09d5('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x09d5('0xf')]);router[_0x09d5('0xa')](_0x09d5('0x10'),auth[_0x09d5('0xb')](),controller[_0x09d5('0x11')]);router['get'](_0x09d5('0x12'),auth[_0x09d5('0xb')](),controller['getAgents']);router[_0x09d5('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x09d5('0x13')](_0x09d5('0x10'),auth[_0x09d5('0xb')](),controller['addTeams']);router[_0x09d5('0x13')](_0x09d5('0x12'),auth[_0x09d5('0xb')](),controller[_0x09d5('0x14')]);router[_0x09d5('0x15')](_0x09d5('0x16'),auth[_0x09d5('0xb')](),controller[_0x09d5('0x17')]);router[_0x09d5('0x18')](_0x09d5('0x16'),auth[_0x09d5('0xb')](),controller[_0x09d5('0x19')]);router[_0x09d5('0x18')](_0x09d5('0x10'),auth['isAuthenticated'](),controller[_0x09d5('0x1a')]);router[_0x09d5('0x18')](_0x09d5('0x12'),auth[_0x09d5('0xb')](),controller[_0x09d5('0x1b')]);module[_0x09d5('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 f91921b..4d06e63 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 _0x8d24=['STRING','INTEGER','ENUM','beepall','sequelize','exports'];(function(_0x5e2831,_0x15d0d8){var _0x428f12=function(_0x48ffa9){while(--_0x48ffa9){_0x5e2831['push'](_0x5e2831['shift']());}};_0x428f12(++_0x15d0d8);}(_0x8d24,0xb8));var _0x48d2=function(_0x2a97f7,_0x465e0c){_0x2a97f7=_0x2a97f7-0x0;var _0x13c258=_0x8d24[_0x2a97f7];return _0x13c258;};'use strict';var Sequelize=require(_0x48d2('0x0'));module[_0x48d2('0x1')]={'name':{'type':Sequelize[_0x48d2('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x48d2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48d2('0x4')]('rrmemory',_0x48d2('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x64be=['rrmemory','roundrobin','sequelize','name','STRING','INTEGER','ENUM'];(function(_0x2d2124,_0xb2fb80){var _0x162b2d=function(_0x28ced4){while(--_0x28ced4){_0x2d2124['push'](_0x2d2124['shift']());}};_0x162b2d(++_0xb2fb80);}(_0x64be,0xa3));var _0xe64b=function(_0x2b8b00,_0x221147){_0x2b8b00=_0x2b8b00-0x0;var _0x4573ad=_0x64be[_0x2b8b00];return _0x4573ad;};'use strict';var Sequelize=require(_0xe64b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe64b('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe64b('0x2')]},'timeout':{'type':Sequelize[_0xe64b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe64b('0x4')](_0xe64b('0x5'),'beepall',_0xe64b('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index afc9d50..013506a 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 _0x57ee=['to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsQueue.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','SmsQueues','UserProfileResource','error','name','send','index','map','SmsQueue','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','filter','merge','options','where','includeAll','findAll','rows','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','every','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x57ee,0x1a1));var _0xe57e=function(_0xdc0a8f,_0x23bd25){_0xdc0a8f=_0xdc0a8f-0x0;var _0x458850=_0x57ee[_0xdc0a8f];return _0x458850;};'use strict';var pdf=require(_0xe57e('0x0'));var emlformat=require(_0xe57e('0x1'));var rimraf=require(_0xe57e('0x2'));var zipdir=require(_0xe57e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe57e('0x4'));var moment=require(_0xe57e('0x5'));var BPromise=require(_0xe57e('0x6'));var Mustache=require(_0xe57e('0x7'));var util=require('util');var path=require(_0xe57e('0x8'));var sox=require('sox');var csv=require(_0xe57e('0x9'));var ejs=require(_0xe57e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe57e('0xb'));var crypto=require(_0xe57e('0xc'));var jsforce=require(_0xe57e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe57e('0x9'));var querystring=require(_0xe57e('0xe'));var Papa=require('papaparse');var Redis=require(_0xe57e('0xf'));var authService=require(_0xe57e('0x10'));var qs=require(_0xe57e('0x11'));var as=require(_0xe57e('0x12'));var hardwareService=require(_0xe57e('0x13'));var logger=require(_0xe57e('0x14'))(_0xe57e('0x15'));var utils=require(_0xe57e('0x16'));var config=require(_0xe57e('0x17'));var licenseUtil=require(_0xe57e('0x18'));var db=require(_0xe57e('0x19'))['db'];config['redis']=_[_0xe57e('0x1a')](config[_0xe57e('0x1b')],{'host':_0xe57e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe57e('0x1b')]));require(_0xe57e('0x1d'))[_0xe57e('0x1e')](socket);function respondWithStatusCode(_0x476d6a,_0x399ada){_0x399ada=_0x399ada||0xcc;return function(_0x22a482){if(_0x22a482){return _0x476d6a[_0xe57e('0x1f')](_0x399ada);}return _0x476d6a['status'](_0x399ada)[_0xe57e('0x20')]();};}function respondWithResult(_0x4f71f7,_0x477b55){_0x477b55=_0x477b55||0xc8;return function(_0x338119){if(_0x338119){return _0x4f71f7[_0xe57e('0x21')](_0x477b55)[_0xe57e('0x22')](_0x338119);}};}function respondWithFilteredResult(_0x4ce149,_0x522cf1){return function(_0x4d3aa1){if(_0x4d3aa1){var _0x151191=_0x4d3aa1[_0xe57e('0x23')],_0x1b2572=_0x522cf1[_0xe57e('0x24')],_0x4f4986=_0x522cf1[_0xe57e('0x24')]+_0x522cf1['limit'],_0x14f006;if(_0x4f4986>=_0x151191){_0x4f4986=_0x151191;_0x14f006=0xc8;}else{_0x14f006=0xce;}_0x4ce149[_0xe57e('0x21')](_0x14f006);return _0x4ce149[_0xe57e('0x25')](_0xe57e('0x26'),_0x1b2572+'-'+_0x4f4986+'/'+_0x151191)['json'](_0x4d3aa1);}return null;};}function patchUpdates(_0x2f4d02){return function(_0x11e6aa){try{jsonpatch[_0xe57e('0x27')](_0x11e6aa,_0x2f4d02,!![]);}catch(_0x5b021e){return BPromise[_0xe57e('0x28')](_0x5b021e);}return _0x11e6aa[_0xe57e('0x29')]();};}function saveUpdates(_0xc35ecb,_0x7abbe2){return function(_0x512ba0){if(_0x512ba0){return _0x512ba0[_0xe57e('0x2a')](_0xc35ecb)['then'](function(_0x164fd3){return _0x164fd3;});}return null;};}function removeEntity(_0x2a9fd6,_0x49fdc2){return function(_0x2fe5bd){if(_0x2fe5bd){return _0x2fe5bd[_0xe57e('0x2b')]()[_0xe57e('0x2c')](function(){var _0x2b5ac3=_0x2fe5bd['get']({'plain':!![]});var _0xdaf424=_0xe57e('0x2d');return db[_0xe57e('0x2e')][_0xe57e('0x2b')]({'where':{'type':_0xdaf424,'resourceId':_0x2b5ac3['id']}})['then'](function(){return _0x2fe5bd;});})[_0xe57e('0x2c')](function(){_0x2a9fd6[_0xe57e('0x21')](0xcc)[_0xe57e('0x20')]();});}};}function handleEntityNotFound(_0x539fbf,_0x6755fa){return function(_0x107b2d){if(!_0x107b2d){_0x539fbf['sendStatus'](0x194);}return _0x107b2d;};}function handleError(_0x4326f3,_0x5f4579){_0x5f4579=_0x5f4579||0x1f4;return function(_0x21b2c2){logger[_0xe57e('0x2f')](_0x21b2c2['stack']);if(_0x21b2c2[_0xe57e('0x30')]){delete _0x21b2c2[_0xe57e('0x30')];}_0x4326f3[_0xe57e('0x21')](_0x5f4579)[_0xe57e('0x31')](_0x21b2c2);};}exports[_0xe57e('0x32')]=function(_0x36c63a,_0x5955b2){var _0x1a9a84={},_0x496cdc={},_0x45256c={'count':0x0,'rows':[]};var _0x243dd4=_[_0xe57e('0x33')](db[_0xe57e('0x34')]['rawAttributes'],function(_0x58378b){return{'name':_0x58378b[_0xe57e('0x35')],'type':_0x58378b[_0xe57e('0x36')]['key']};});_0x496cdc[_0xe57e('0x37')]=_[_0xe57e('0x33')](_0x243dd4,_0xe57e('0x30'));_0x496cdc[_0xe57e('0x38')]=_[_0xe57e('0x39')](_0x36c63a['query']);_0x496cdc[_0xe57e('0x3a')]=_[_0xe57e('0x3b')](_0x496cdc['model'],_0x496cdc['query']);_0x1a9a84['attributes']=_[_0xe57e('0x3b')](_0x496cdc['model'],qs[_0xe57e('0x3c')](_0x36c63a['query'][_0xe57e('0x3c')]));_0x1a9a84[_0xe57e('0x3d')]=_0x1a9a84[_0xe57e('0x3d')]['length']?_0x1a9a84[_0xe57e('0x3d')]:_0x496cdc[_0xe57e('0x37')];if(!_0x36c63a[_0xe57e('0x38')]['hasOwnProperty'](_0xe57e('0x3e'))){_0x1a9a84['limit']=qs[_0xe57e('0x3f')](_0x36c63a['query'][_0xe57e('0x3f')]);_0x1a9a84[_0xe57e('0x24')]=qs[_0xe57e('0x24')](_0x36c63a[_0xe57e('0x38')][_0xe57e('0x24')]);}_0x1a9a84[_0xe57e('0x40')]=qs[_0xe57e('0x41')](_0x36c63a[_0xe57e('0x38')]['sort']);_0x1a9a84['where']=qs[_0xe57e('0x3a')](_['pick'](_0x36c63a['query'],_0x496cdc[_0xe57e('0x3a')]),_0x243dd4);if(_0x36c63a[_0xe57e('0x38')][_0xe57e('0x42')]){_0x1a9a84['where']=_[_0xe57e('0x43')](_0x1a9a84['where'],{'$or':_['map'](_0x243dd4,function(_0x583afa){if(_0x583afa['type']!=='VIRTUAL'){var _0x4f79ac={};_0x4f79ac[_0x583afa[_0xe57e('0x30')]]={'$like':'%'+_0x36c63a['query']['filter']+'%'};return _0x4f79ac;}})});}_0x1a9a84=_[_0xe57e('0x43')]({},_0x1a9a84,_0x36c63a[_0xe57e('0x44')]);var _0x10d799={'where':_0x1a9a84[_0xe57e('0x45')]};return db[_0xe57e('0x34')][_0xe57e('0x23')](_0x10d799)[_0xe57e('0x2c')](function(_0x1733e9){_0x45256c[_0xe57e('0x23')]=_0x1733e9;if(_0x36c63a[_0xe57e('0x38')][_0xe57e('0x46')]){_0x1a9a84['include']=[{'all':!![]}];}return db[_0xe57e('0x34')][_0xe57e('0x47')](_0x1a9a84);})[_0xe57e('0x2c')](function(_0x5aca31){_0x45256c[_0xe57e('0x48')]=_0x5aca31;return _0x45256c;})[_0xe57e('0x2c')](respondWithFilteredResult(_0x5955b2,_0x1a9a84))[_0xe57e('0x49')](handleError(_0x5955b2,null));};exports['show']=function(_0x36b2d5,_0x2b3205){var _0x56d7ff={'raw':!![],'where':{'id':_0x36b2d5[_0xe57e('0x4a')]['id']}},_0x2fa0a1={};_0x2fa0a1[_0xe57e('0x37')]=_[_0xe57e('0x39')](db['SmsQueue'][_0xe57e('0x4b')]);_0x2fa0a1['query']=_[_0xe57e('0x39')](_0x36b2d5[_0xe57e('0x38')]);_0x2fa0a1[_0xe57e('0x3a')]=_[_0xe57e('0x3b')](_0x2fa0a1[_0xe57e('0x37')],_0x2fa0a1['query']);_0x56d7ff[_0xe57e('0x3d')]=_[_0xe57e('0x3b')](_0x2fa0a1[_0xe57e('0x37')],qs[_0xe57e('0x3c')](_0x36b2d5['query']['fields']));_0x56d7ff['attributes']=_0x56d7ff[_0xe57e('0x3d')][_0xe57e('0x4c')]?_0x56d7ff[_0xe57e('0x3d')]:_0x2fa0a1['model'];if(_0x36b2d5[_0xe57e('0x38')][_0xe57e('0x46')]){_0x56d7ff['include']=[{'all':!![]}];}_0x56d7ff=_[_0xe57e('0x43')]({},_0x56d7ff,_0x36b2d5[_0xe57e('0x44')]);return db[_0xe57e('0x34')][_0xe57e('0x4d')](_0x56d7ff)[_0xe57e('0x2c')](handleEntityNotFound(_0x2b3205,null))[_0xe57e('0x2c')](respondWithResult(_0x2b3205,null))[_0xe57e('0x49')](handleError(_0x2b3205,null));};exports[_0xe57e('0x4e')]=function(_0xe8813f,_0x530584){return db[_0xe57e('0x34')][_0xe57e('0x4e')](_0xe8813f[_0xe57e('0x4f')],{})[_0xe57e('0x2c')](function(_0x3159b9){var _0x1db716=_0xe8813f[_0xe57e('0x50')]['get']({'plain':!![]});if(!_0x1db716)throw new Error(_0xe57e('0x51'));if(_0x1db716[_0xe57e('0x52')]==='user'){var _0x378da1=_0x3159b9[_0xe57e('0x53')]({'plain':!![]});var _0x1c0f6c=_0xe57e('0x2d');return db[_0xe57e('0x54')][_0xe57e('0x4d')]({'where':{'name':_0x1c0f6c,'userProfileId':_0x1db716[_0xe57e('0x55')]},'raw':!![]})[_0xe57e('0x2c')](function(_0x43fa6a){if(_0x43fa6a&&_0x43fa6a[_0xe57e('0x56')]===0x0){return db[_0xe57e('0x2e')][_0xe57e('0x4e')]({'name':_0x378da1[_0xe57e('0x30')],'resourceId':_0x378da1['id'],'type':_0x43fa6a[_0xe57e('0x30')],'sectionId':_0x43fa6a['id']},{})['then'](function(){return _0x3159b9;});}else{return _0x3159b9;}})[_0xe57e('0x49')](function(_0x11c25c){logger[_0xe57e('0x2f')](_0xe57e('0x57'),_0x11c25c);throw _0x11c25c;});}return _0x3159b9;})[_0xe57e('0x2c')](respondWithResult(_0x530584,0xc9))['catch'](handleError(_0x530584,null));};exports[_0xe57e('0x2a')]=function(_0x17a7ab,_0x1331ac){if(_0x17a7ab[_0xe57e('0x4f')]['id']){delete _0x17a7ab[_0xe57e('0x4f')]['id'];}return db[_0xe57e('0x34')][_0xe57e('0x4d')]({'where':{'id':_0x17a7ab[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](handleEntityNotFound(_0x1331ac,null))[_0xe57e('0x2c')](saveUpdates(_0x17a7ab[_0xe57e('0x4f')],null))[_0xe57e('0x2c')](respondWithResult(_0x1331ac,null))[_0xe57e('0x49')](handleError(_0x1331ac,null));};exports[_0xe57e('0x2b')]=function(_0x17763d,_0x35a760){return db[_0xe57e('0x34')][_0xe57e('0x4d')]({'where':{'id':_0x17763d[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](handleEntityNotFound(_0x35a760,null))[_0xe57e('0x2c')](removeEntity(_0x35a760,null))[_0xe57e('0x49')](handleError(_0x35a760,null));};exports[_0xe57e('0x58')]=function(_0x171df4,_0xa4ce0d){return db[_0xe57e('0x34')]['describe']()[_0xe57e('0x2c')](respondWithResult(_0xa4ce0d,null))['catch'](handleError(_0xa4ce0d,null));};exports[_0xe57e('0x59')]=function(_0x5c231d,_0x46429a,_0x5987cd){var _0x4c4da1={'raw':!![],'where':{}},_0x2eb31b={},_0xaa1e8d;return db['SmsQueue'][_0xe57e('0x5a')]({'where':{'id':_0x5c231d[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](handleEntityNotFound(_0x46429a,null))[_0xe57e('0x2c')](function(_0x44708){if(_0x44708){_0xaa1e8d=_0x44708['get']({'plain':!![]});_0x2eb31b['model']=_[_0xe57e('0x39')](db[_0xe57e('0x5b')][_0xe57e('0x4b')]);_0x2eb31b[_0xe57e('0x38')]=_[_0xe57e('0x39')](_0x5c231d[_0xe57e('0x38')]);_0x2eb31b[_0xe57e('0x3a')]=_['intersection'](_0x2eb31b['model'],_0x2eb31b[_0xe57e('0x38')]);_0x4c4da1[_0xe57e('0x3d')]=_['intersection'](_0x2eb31b[_0xe57e('0x37')],qs[_0xe57e('0x3c')](_0x5c231d[_0xe57e('0x38')][_0xe57e('0x3c')]));_0x4c4da1[_0xe57e('0x3d')]=_0x4c4da1[_0xe57e('0x3d')][_0xe57e('0x4c')]?_0x4c4da1[_0xe57e('0x3d')]:_0x2eb31b[_0xe57e('0x37')];if(!_0x5c231d[_0xe57e('0x38')][_0xe57e('0x5c')](_0xe57e('0x3e'))){_0x4c4da1[_0xe57e('0x3f')]=qs[_0xe57e('0x3f')](_0x5c231d[_0xe57e('0x38')][_0xe57e('0x3f')]);_0x4c4da1[_0xe57e('0x24')]=qs[_0xe57e('0x24')](_0x5c231d['query'][_0xe57e('0x24')]);}_0x4c4da1[_0xe57e('0x40')]=qs['sort'](_0x5c231d[_0xe57e('0x38')][_0xe57e('0x41')]);_0x4c4da1[_0xe57e('0x45')]=qs[_0xe57e('0x3a')](_[_0xe57e('0x5d')](_0x5c231d[_0xe57e('0x38')],_0x2eb31b[_0xe57e('0x3a')]));_0x4c4da1[_0xe57e('0x45')][_0xe57e('0x5e')]=_0x44708['id'];if(_0x5c231d[_0xe57e('0x38')][_0xe57e('0x42')]){_0x4c4da1[_0xe57e('0x45')]=_[_0xe57e('0x43')](_0x4c4da1['where'],{'$or':_[_0xe57e('0x33')](_0x4c4da1['attributes'],function(_0x4a56ee){var _0x55494d={};_0x55494d[_0x4a56ee]={'$like':'%'+_0x5c231d[_0xe57e('0x38')]['filter']+'%'};return _0x55494d;})});}_0x4c4da1=_[_0xe57e('0x43')]({},_0x4c4da1,_0x5c231d[_0xe57e('0x44')]);return db[_0xe57e('0x5b')][_0xe57e('0x47')](_0x4c4da1);}})[_0xe57e('0x2c')](function(_0x26f906){if(_0x26f906){return db[_0xe57e('0x5f')][_0xe57e('0x60')]({'where':{'id':_[_0xe57e('0x33')](_0x26f906,_0xe57e('0x61')),'role':_0xe57e('0x62')},'attributes':['id',_0xe57e('0x30'),_0xe57e('0x63'),_0xe57e('0x64'),_0xe57e('0x65')]});}})[_0xe57e('0x2c')](function(_0x565806){if(_0x565806){return{'count':_0x565806['count'],'rows':_[_0xe57e('0x33')](_0x565806['rows'],function(_0x267e9f){return{'membername':_0x267e9f[_0xe57e('0x30')],'UserId':_0x267e9f['id'],'queue_name':_0xaa1e8d[_0xe57e('0x30')],'SmsQueueId':_0xaa1e8d['id'],'interface':util[_0xe57e('0x66')](_0xe57e('0x67'),'SIP',_0x267e9f[_0xe57e('0x30')]),'penalty':0x0,'paused':_0x267e9f['smsPause'],'createdAt':_0x267e9f[_0xe57e('0x65')],'updatedAt':_0x267e9f[_0xe57e('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe57e('0x2c')](respondWithFilteredResult(_0x46429a,_0x4c4da1))[_0xe57e('0x49')](handleError(_0x46429a,null));};exports[_0xe57e('0x68')]=function(_0x45c95b,_0x235441,_0x2cab78){var _0x34a706={};var _0x4e83cd={};var _0x4d6409;var _0x4a44c4;return db[_0xe57e('0x34')][_0xe57e('0x5a')]({'where':{'id':_0x45c95b[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](handleEntityNotFound(_0x235441,null))['then'](function(_0x2f2279){if(_0x2f2279){_0x4d6409=_0x2f2279;_0x4e83cd[_0xe57e('0x37')]=_[_0xe57e('0x39')](db[_0xe57e('0x69')][_0xe57e('0x4b')]);_0x4e83cd[_0xe57e('0x38')]=_[_0xe57e('0x39')](_0x45c95b['query']);_0x4e83cd[_0xe57e('0x3a')]=_[_0xe57e('0x3b')](_0x4e83cd[_0xe57e('0x37')],_0x4e83cd[_0xe57e('0x38')]);_0x34a706['attributes']=_['intersection'](_0x4e83cd[_0xe57e('0x37')],qs['fields'](_0x45c95b[_0xe57e('0x38')]['fields']));_0x34a706['attributes']=_0x34a706['attributes'][_0xe57e('0x4c')]?_0x34a706[_0xe57e('0x3d')]:_0x4e83cd[_0xe57e('0x37')];_0x34a706['order']=qs['sort'](_0x45c95b[_0xe57e('0x38')][_0xe57e('0x41')]);_0x34a706[_0xe57e('0x45')]=qs[_0xe57e('0x3a')](_[_0xe57e('0x5d')](_0x45c95b[_0xe57e('0x38')],_0x4e83cd[_0xe57e('0x3a')]));if(_0x45c95b['query'][_0xe57e('0x42')]){_0x34a706[_0xe57e('0x45')]=_['merge'](_0x34a706['where'],{'$or':_[_0xe57e('0x33')](_0x34a706[_0xe57e('0x3d')],function(_0x1cd149){var _0x4650f9={};_0x4650f9[_0x1cd149]={'$like':'%'+_0x45c95b[_0xe57e('0x38')]['filter']+'%'};return _0x4650f9;})});}_0x34a706=_[_0xe57e('0x43')]({},_0x34a706,_0x45c95b[_0xe57e('0x44')]);return _0x4d6409[_0xe57e('0x68')](_0x34a706);}})[_0xe57e('0x2c')](function(_0xb34da){if(_0xb34da){_0x4a44c4=_0xb34da[_0xe57e('0x4c')];if(!_0x45c95b[_0xe57e('0x38')][_0xe57e('0x5c')]('nolimit')){_0x34a706['limit']=qs[_0xe57e('0x3f')](_0x45c95b[_0xe57e('0x38')]['limit']);_0x34a706[_0xe57e('0x24')]=qs[_0xe57e('0x24')](_0x45c95b['query'][_0xe57e('0x24')]);}return _0x4d6409['getTeams'](_0x34a706);}})[_0xe57e('0x2c')](function(_0x323d8b){if(_0x323d8b){return _0x323d8b?{'count':_0x4a44c4,'rows':_0x323d8b}:null;}})[_0xe57e('0x2c')](respondWithResult(_0x235441,null))[_0xe57e('0x49')](handleError(_0x235441,null));};exports[_0xe57e('0x6a')]=function(_0x3eaf92,_0x49f13f,_0x413c74){var _0x4e39a1=_0x3eaf92[_0xe57e('0x4f')][_0xe57e('0x6b')];return db[_0xe57e('0x69')][_0xe57e('0x47')]({'where':{'id':_0x4e39a1},'attributes':['id'],'include':[{'model':db[_0xe57e('0x5f')],'as':_0xe57e('0x6c'),'attributes':['id',_0xe57e('0x30'),'online',_0xe57e('0x6d'),_0xe57e('0x6e')],'raw':!![]}]})[_0xe57e('0x2c')](function(_0x2f41c6){if(_0x2f41c6){var _0x155a71=_[_0xe57e('0x6f')](_0x2f41c6,function(_0x10350a){var _0x4ea56b=_0x10350a[_0xe57e('0x53')]({'plain':!![]});return _0x4ea56b[_0xe57e('0x6c')];});return db['SmsQueue'][_0xe57e('0x4d')]({'where':{'id':_0x3eaf92[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](function(_0x54427d){return db[_0xe57e('0x70')][_0xe57e('0x71')](function(_0x3e6173){return _0x54427d[_0xe57e('0x6a')](_0x4e39a1,{'transaction':_0x3e6173})[_0xe57e('0x2c')](function(){return BPromise[_0xe57e('0x72')](_0x155a71,function(_0x306f5a){return db[_0xe57e('0x5b')][_0xe57e('0x73')]({'where':{'UserId':_0x306f5a['id'],'SmsQueueId':_0x3eaf92[_0xe57e('0x4a')]['id']},'transaction':_0x3e6173});});})[_0xe57e('0x2c')](function(){_0x155a71[_0xe57e('0x74')](function(_0x10d0fb){socket[_0xe57e('0x75')](_0xe57e('0x76'),{'UserId':_0x10d0fb['id'],'SmsQueueId':_0x54427d['id']});});});});});}})['then'](respondWithStatusCode(_0x49f13f,null))[_0xe57e('0x49')](handleError(_0x49f13f,null));};exports[_0xe57e('0x77')]=function(_0x3e1c93,_0x567534,_0x579cf1){return db[_0xe57e('0x69')]['findAll']({'where':{'id':_0x3e1c93['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe57e('0x5f')],'as':_0xe57e('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xe57e('0x2c')](handleEntityNotFound(_0x567534,null))['then'](function(_0x1b2aa2){var _0x5406ca=_[_0xe57e('0x33')](_0x1b2aa2,'id');var _0x2630b5=[];var _0x1cdfa5=[];var _0x41a066=squel[_0xe57e('0x78')]();_0x41a066[_0xe57e('0x79')]('tq.TeamId')['from'](_0xe57e('0x7a'),'tq')['join'](_0xe57e('0x7b'),'ut',_0xe57e('0x7c'))[_0xe57e('0x45')](_0xe57e('0x7d'),_0x3e1c93[_0xe57e('0x4a')]['id']);for(var _0x1c51ab=0x0;_0x1c51ab<_0x1b2aa2[_0xe57e('0x4c')];_0x1c51ab+=0x1){let _0x1eb05c=_0x1b2aa2[_0x1c51ab];for(var _0x431ee8=0x0;_0x431ee8<_0x1eb05c['Agents'][_0xe57e('0x4c')];_0x431ee8+=0x1){let _0x2c4c10=_0x1eb05c[_0xe57e('0x6c')][_0x431ee8];var _0x556426=_0x41a066[_0xe57e('0x7e')]();_0x556426[_0xe57e('0x45')]('ut.UserId\x20=\x20?',_0x2c4c10['id']);_0x1cdfa5[_0xe57e('0x7f')](db[_0xe57e('0x70')][_0xe57e('0x38')](_0x556426[_0xe57e('0x80')](),{'type':db[_0xe57e('0x70')]['QueryTypes'][_0xe57e('0x81')]})[_0xe57e('0x2c')](function(_0x1e738d){if(_0x1e738d[_0xe57e('0x4c')]===0x1){return _0x2c4c10['id'];}else{var _0xdf85a=_[_0xe57e('0x82')](_[_0xe57e('0x33')](_0x1e738d,'TeamId'),function(_0xa01913){return _['includes'](_0x5406ca,_0xa01913);});if(_0xdf85a){return _0x2c4c10['id'];}}}));}}return BPromise[_0xe57e('0x83')](_0x1cdfa5)[_0xe57e('0x2c')](function(_0x4e697f){_0x2630b5=_(_0x2630b5)[_0xe57e('0x84')](_0x4e697f)[_0xe57e('0x85')]()[_0xe57e('0x86')]();return db[_0xe57e('0x34')][_0xe57e('0x4d')]({'where':{'id':_0x3e1c93[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](function(_0x1223b7){return db[_0xe57e('0x70')][_0xe57e('0x71')](function(_0x57f8af){return _0x1223b7[_0xe57e('0x77')](_0x3e1c93[_0xe57e('0x38')][_0xe57e('0x6b')],{'transaction':_0x57f8af})[_0xe57e('0x2c')](function(){if(!_[_0xe57e('0x87')](_0x2630b5)){return _0x1223b7[_0xe57e('0x88')](_0x2630b5,{'transaction':_0x57f8af});}})[_0xe57e('0x2c')](function(){_0x2630b5[_0xe57e('0x74')](function(_0x2c8294){socket[_0xe57e('0x75')](_0xe57e('0x89'),{'UserId':_0x2c8294,'SmsQueueId':_0x1223b7['id']});});});});});});})['then'](respondWithStatusCode(_0x567534,null))[_0xe57e('0x49')](handleError(_0x567534,null));};exports['addAgents']=function(_0x38350c,_0x17a663,_0x3f2113){return db[_0xe57e('0x34')][_0xe57e('0x4d')]({'where':{'id':_0x38350c[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](handleEntityNotFound(_0x17a663,null))[_0xe57e('0x2c')](function(_0x31bacf){if(_0x31bacf){return _0x31bacf[_0xe57e('0x8a')](_0x38350c[_0xe57e('0x4f')][_0xe57e('0x6b')],_['omit'](_0x38350c[_0xe57e('0x4f')],[_0xe57e('0x6b'),'id'])||{})[_0xe57e('0x8b')](function(_0x3403a6){for(var _0x115a23=0x0;_0x115a23<_0x38350c[_0xe57e('0x4f')]['ids'][_0xe57e('0x4c')];_0x115a23+=0x1){socket[_0xe57e('0x75')](_0xe57e('0x76'),{'UserId':_0x38350c[_0xe57e('0x4f')][_0xe57e('0x6b')][_0x115a23],'SmsQueueId':_0x38350c[_0xe57e('0x4a')]['id']});}return _0x3403a6;});}})[_0xe57e('0x2c')](respondWithResult(_0x17a663,null))['catch'](handleError(_0x17a663,null));};exports[_0xe57e('0x88')]=function(_0x131bfb,_0x5749a5,_0x465400){return db[_0xe57e('0x34')][_0xe57e('0x4d')]({'where':{'id':_0x131bfb[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](handleEntityNotFound(_0x5749a5,null))[_0xe57e('0x2c')](function(_0x539dbb){if(_0x539dbb){return _0x539dbb[_0xe57e('0x88')](_0x131bfb[_0xe57e('0x38')][_0xe57e('0x6b')])[_0xe57e('0x2c')](function(){if(_[_0xe57e('0x8c')](_0x131bfb[_0xe57e('0x38')][_0xe57e('0x6b')])){for(var _0x48055a=0x0;_0x48055a<_0x131bfb[_0xe57e('0x38')][_0xe57e('0x6b')]['length'];_0x48055a+=0x1){socket['emit'](_0xe57e('0x89'),{'UserId':Number(_0x131bfb['query'][_0xe57e('0x6b')][_0x48055a]),'SmsQueueId':Number(_0x131bfb[_0xe57e('0x4a')]['id'])});}}else{socket[_0xe57e('0x75')](_0xe57e('0x89'),{'UserId':Number(_0x131bfb[_0xe57e('0x38')][_0xe57e('0x6b')]),'SmsQueueId':Number(_0x131bfb[_0xe57e('0x4a')]['id'])});}});}})[_0xe57e('0x2c')](respondWithStatusCode(_0x5749a5,null))[_0xe57e('0x49')](handleError(_0x5749a5,null));};exports[_0xe57e('0x8d')]=function(_0x4765cf,_0x45985f,_0x32c0b8){var _0x58eb95={};var _0x18ef7e={};var _0x5a9e14;var _0x3cf3bf;return db[_0xe57e('0x34')][_0xe57e('0x5a')]({'where':{'id':_0x4765cf[_0xe57e('0x4a')]['id']}})[_0xe57e('0x2c')](handleEntityNotFound(_0x45985f,null))['then'](function(_0x2d85c1){if(_0x2d85c1){_0x5a9e14=_0x2d85c1;_0x18ef7e['model']=_[_0xe57e('0x39')](db['User']['rawAttributes']);_0x18ef7e[_0xe57e('0x38')]=_[_0xe57e('0x39')](_0x4765cf[_0xe57e('0x38')]);_0x18ef7e['filters']=_[_0xe57e('0x3b')](_0x18ef7e[_0xe57e('0x37')],_0x18ef7e[_0xe57e('0x38')]);_0x58eb95[_0xe57e('0x3d')]=_[_0xe57e('0x3b')](_0x18ef7e['model'],qs[_0xe57e('0x3c')](_0x4765cf['query'][_0xe57e('0x3c')]));_0x58eb95[_0xe57e('0x3d')]=_0x58eb95[_0xe57e('0x3d')][_0xe57e('0x4c')]?_0x58eb95[_0xe57e('0x3d')]:_0x18ef7e[_0xe57e('0x37')];_0x58eb95[_0xe57e('0x40')]=qs['sort'](_0x4765cf[_0xe57e('0x38')]['sort']);_0x58eb95[_0xe57e('0x45')]=qs['filters'](_[_0xe57e('0x5d')](_0x4765cf[_0xe57e('0x38')],_0x18ef7e[_0xe57e('0x3a')]));if(_0x4765cf[_0xe57e('0x38')][_0xe57e('0x42')]){_0x58eb95[_0xe57e('0x45')]=_[_0xe57e('0x43')](_0x58eb95[_0xe57e('0x45')],{'$or':_[_0xe57e('0x33')](_0x58eb95[_0xe57e('0x3d')],function(_0x1ae269){var _0x24b884={};_0x24b884[_0x1ae269]={'$like':'%'+_0x4765cf[_0xe57e('0x38')][_0xe57e('0x42')]+'%'};return _0x24b884;})});}_0x58eb95=_[_0xe57e('0x43')]({},_0x58eb95,_0x4765cf[_0xe57e('0x44')]);return _0x5a9e14['getAgents'](_0x58eb95);}})['then'](function(_0x63f0a2){if(_0x63f0a2){_0x3cf3bf=_0x63f0a2[_0xe57e('0x4c')];if(!_0x4765cf['query']['hasOwnProperty'](_0xe57e('0x3e'))){_0x58eb95[_0xe57e('0x3f')]=qs[_0xe57e('0x3f')](_0x4765cf[_0xe57e('0x38')][_0xe57e('0x3f')]);_0x58eb95[_0xe57e('0x24')]=qs[_0xe57e('0x24')](_0x4765cf[_0xe57e('0x38')][_0xe57e('0x24')]);}return _0x5a9e14[_0xe57e('0x8d')](_0x58eb95);}})[_0xe57e('0x2c')](function(_0x28376c){if(_0x28376c){return _0x28376c?{'count':_0x3cf3bf,'rows':_0x28376c}:null;}})[_0xe57e('0x2c')](respondWithResult(_0x45985f,null))[_0xe57e('0x49')](handleError(_0x45985f,null));}; \ No newline at end of file +var _0x491f=['catch','show','params','include','find','create','body','user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserSmsQueue','User','UserId','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','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?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsQueue.socket','status','end','json','count','offset','Content-Range','apply','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','findAll'];(function(_0x503675,_0x3d5381){var _0x277481=function(_0x1713d5){while(--_0x1713d5){_0x503675['push'](_0x503675['shift']());}};_0x277481(++_0x3d5381);}(_0x491f,0x157));var _0xf491=function(_0x14cb58,_0x214d62){_0x14cb58=_0x14cb58-0x0;var _0x5f097e=_0x491f[_0x14cb58];return _0x5f097e;};'use strict';var pdf=require(_0xf491('0x0'));var emlformat=require(_0xf491('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf491('0x2'));var jsonpatch=require(_0xf491('0x3'));var rp=require(_0xf491('0x4'));var moment=require(_0xf491('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf491('0x6'));var util=require(_0xf491('0x7'));var path=require(_0xf491('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf491('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf491('0xa'));var crypto=require(_0xf491('0xb'));var jsforce=require(_0xf491('0xc'));var deskjs=require(_0xf491('0xd'));var toCsv=require(_0xf491('0xe'));var querystring=require(_0xf491('0xf'));var Papa=require('papaparse');var Redis=require(_0xf491('0x10'));var authService=require(_0xf491('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf491('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf491('0x13'))(_0xf491('0x14'));var utils=require(_0xf491('0x15'));var config=require(_0xf491('0x16'));var licenseUtil=require(_0xf491('0x17'));var db=require('../../mysqldb')['db'];config[_0xf491('0x18')]=_[_0xf491('0x19')](config[_0xf491('0x18')],{'host':_0xf491('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf491('0x18')]));require(_0xf491('0x1b'))['register'](socket);function respondWithStatusCode(_0x3aa2f1,_0x58b65f){_0x58b65f=_0x58b65f||0xcc;return function(_0x412151){if(_0x412151){return _0x3aa2f1['sendStatus'](_0x58b65f);}return _0x3aa2f1[_0xf491('0x1c')](_0x58b65f)[_0xf491('0x1d')]();};}function respondWithResult(_0x4eba15,_0x2049ad){_0x2049ad=_0x2049ad||0xc8;return function(_0x313a70){if(_0x313a70){return _0x4eba15[_0xf491('0x1c')](_0x2049ad)[_0xf491('0x1e')](_0x313a70);}};}function respondWithFilteredResult(_0x409d70,_0xdf02af){return function(_0x1fbaa1){if(_0x1fbaa1){var _0xdaecba=_0x1fbaa1[_0xf491('0x1f')],_0x48e2fe=_0xdf02af['offset'],_0x7af07=_0xdf02af[_0xf491('0x20')]+_0xdf02af['limit'],_0x4f7a81;if(_0x7af07>=_0xdaecba){_0x7af07=_0xdaecba;_0x4f7a81=0xc8;}else{_0x4f7a81=0xce;}_0x409d70['status'](_0x4f7a81);return _0x409d70['set'](_0xf491('0x21'),_0x48e2fe+'-'+_0x7af07+'/'+_0xdaecba)[_0xf491('0x1e')](_0x1fbaa1);}return null;};}function patchUpdates(_0x573667){return function(_0x4fd9c4){try{jsonpatch[_0xf491('0x22')](_0x4fd9c4,_0x573667,!![]);}catch(_0xcaf778){return BPromise['reject'](_0xcaf778);}return _0x4fd9c4[_0xf491('0x23')]();};}function saveUpdates(_0x363eb9,_0x5e5851){return function(_0x3ebc4c){if(_0x3ebc4c){return _0x3ebc4c['update'](_0x363eb9)[_0xf491('0x24')](function(_0x195eb8){return _0x195eb8;});}return null;};}function removeEntity(_0x505b52,_0x3fdac3){return function(_0x19fe28){if(_0x19fe28){return _0x19fe28[_0xf491('0x25')]()['then'](function(){var _0x5dedde=_0x19fe28[_0xf491('0x26')]({'plain':!![]});var _0x115674='SmsQueues';return db[_0xf491('0x27')][_0xf491('0x25')]({'where':{'type':_0x115674,'resourceId':_0x5dedde['id']}})[_0xf491('0x24')](function(){return _0x19fe28;});})['then'](function(){_0x505b52['status'](0xcc)[_0xf491('0x1d')]();});}};}function handleEntityNotFound(_0x2275d2,_0x4bc6d5){return function(_0x279a09){if(!_0x279a09){_0x2275d2[_0xf491('0x28')](0x194);}return _0x279a09;};}function handleError(_0x34903c,_0x4ac270){_0x4ac270=_0x4ac270||0x1f4;return function(_0x11e969){logger[_0xf491('0x29')](_0x11e969[_0xf491('0x2a')]);if(_0x11e969['name']){delete _0x11e969[_0xf491('0x2b')];}_0x34903c[_0xf491('0x1c')](_0x4ac270)[_0xf491('0x2c')](_0x11e969);};}exports[_0xf491('0x2d')]=function(_0x5bab43,_0x5ef612){var _0x22ad06={},_0x313be2={},_0x353bd4={'count':0x0,'rows':[]};var _0x6ed6a7=_[_0xf491('0x2e')](db[_0xf491('0x2f')][_0xf491('0x30')],function(_0x499448){return{'name':_0x499448[_0xf491('0x31')],'type':_0x499448[_0xf491('0x32')][_0xf491('0x33')]};});_0x313be2[_0xf491('0x34')]=_['map'](_0x6ed6a7,_0xf491('0x2b'));_0x313be2[_0xf491('0x35')]=_[_0xf491('0x36')](_0x5bab43[_0xf491('0x35')]);_0x313be2['filters']=_[_0xf491('0x37')](_0x313be2[_0xf491('0x34')],_0x313be2[_0xf491('0x35')]);_0x22ad06[_0xf491('0x38')]=_['intersection'](_0x313be2[_0xf491('0x34')],qs[_0xf491('0x39')](_0x5bab43[_0xf491('0x35')][_0xf491('0x39')]));_0x22ad06['attributes']=_0x22ad06[_0xf491('0x38')][_0xf491('0x3a')]?_0x22ad06[_0xf491('0x38')]:_0x313be2[_0xf491('0x34')];if(!_0x5bab43['query'][_0xf491('0x3b')](_0xf491('0x3c'))){_0x22ad06[_0xf491('0x3d')]=qs[_0xf491('0x3d')](_0x5bab43[_0xf491('0x35')][_0xf491('0x3d')]);_0x22ad06[_0xf491('0x20')]=qs[_0xf491('0x20')](_0x5bab43[_0xf491('0x35')][_0xf491('0x20')]);}_0x22ad06[_0xf491('0x3e')]=qs[_0xf491('0x3f')](_0x5bab43[_0xf491('0x35')][_0xf491('0x3f')]);_0x22ad06[_0xf491('0x40')]=qs[_0xf491('0x41')](_['pick'](_0x5bab43[_0xf491('0x35')],_0x313be2[_0xf491('0x41')]),_0x6ed6a7);if(_0x5bab43['query'][_0xf491('0x42')]){_0x22ad06['where']=_[_0xf491('0x43')](_0x22ad06[_0xf491('0x40')],{'$or':_[_0xf491('0x2e')](_0x6ed6a7,function(_0x2d48d5){if(_0x2d48d5[_0xf491('0x32')]!=='VIRTUAL'){var _0x10a3c3={};_0x10a3c3[_0x2d48d5[_0xf491('0x2b')]]={'$like':'%'+_0x5bab43[_0xf491('0x35')][_0xf491('0x42')]+'%'};return _0x10a3c3;}})});}_0x22ad06=_[_0xf491('0x43')]({},_0x22ad06,_0x5bab43[_0xf491('0x44')]);var _0x4fab43={'where':_0x22ad06[_0xf491('0x40')]};return db['SmsQueue'][_0xf491('0x1f')](_0x4fab43)[_0xf491('0x24')](function(_0xb3a8fc){_0x353bd4[_0xf491('0x1f')]=_0xb3a8fc;if(_0x5bab43[_0xf491('0x35')][_0xf491('0x45')]){_0x22ad06['include']=[{'all':!![]}];}return db[_0xf491('0x2f')][_0xf491('0x46')](_0x22ad06);})[_0xf491('0x24')](function(_0x59f044){_0x353bd4['rows']=_0x59f044;return _0x353bd4;})[_0xf491('0x24')](respondWithFilteredResult(_0x5ef612,_0x22ad06))[_0xf491('0x47')](handleError(_0x5ef612,null));};exports[_0xf491('0x48')]=function(_0xff4156,_0x2fbad2){var _0x2fd184={'raw':!![],'where':{'id':_0xff4156[_0xf491('0x49')]['id']}},_0x16a65={};_0x16a65[_0xf491('0x34')]=_[_0xf491('0x36')](db[_0xf491('0x2f')]['rawAttributes']);_0x16a65[_0xf491('0x35')]=_['keys'](_0xff4156[_0xf491('0x35')]);_0x16a65[_0xf491('0x41')]=_[_0xf491('0x37')](_0x16a65[_0xf491('0x34')],_0x16a65['query']);_0x2fd184[_0xf491('0x38')]=_[_0xf491('0x37')](_0x16a65[_0xf491('0x34')],qs[_0xf491('0x39')](_0xff4156['query']['fields']));_0x2fd184[_0xf491('0x38')]=_0x2fd184[_0xf491('0x38')]['length']?_0x2fd184[_0xf491('0x38')]:_0x16a65[_0xf491('0x34')];if(_0xff4156[_0xf491('0x35')][_0xf491('0x45')]){_0x2fd184[_0xf491('0x4a')]=[{'all':!![]}];}_0x2fd184=_['merge']({},_0x2fd184,_0xff4156['options']);return db[_0xf491('0x2f')][_0xf491('0x4b')](_0x2fd184)[_0xf491('0x24')](handleEntityNotFound(_0x2fbad2,null))[_0xf491('0x24')](respondWithResult(_0x2fbad2,null))[_0xf491('0x47')](handleError(_0x2fbad2,null));};exports[_0xf491('0x4c')]=function(_0x1a83bb,_0x3f9d4e){return db[_0xf491('0x2f')][_0xf491('0x4c')](_0x1a83bb[_0xf491('0x4d')],{})[_0xf491('0x24')](function(_0x66361a){var _0x23d2dd=_0x1a83bb[_0xf491('0x4e')][_0xf491('0x26')]({'plain':!![]});if(!_0x23d2dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23d2dd[_0xf491('0x4f')]==='user'){var _0x32d550=_0x66361a[_0xf491('0x26')]({'plain':!![]});var _0xcb2f5a=_0xf491('0x50');return db[_0xf491('0x51')][_0xf491('0x4b')]({'where':{'name':_0xcb2f5a,'userProfileId':_0x23d2dd[_0xf491('0x52')]},'raw':!![]})[_0xf491('0x24')](function(_0x44788b){if(_0x44788b&&_0x44788b[_0xf491('0x53')]===0x0){return db['UserProfileResource'][_0xf491('0x4c')]({'name':_0x32d550[_0xf491('0x2b')],'resourceId':_0x32d550['id'],'type':_0x44788b[_0xf491('0x2b')],'sectionId':_0x44788b['id']},{})[_0xf491('0x24')](function(){return _0x66361a;});}else{return _0x66361a;}})[_0xf491('0x47')](function(_0xaf0c5){logger[_0xf491('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaf0c5);throw _0xaf0c5;});}return _0x66361a;})[_0xf491('0x24')](respondWithResult(_0x3f9d4e,0xc9))[_0xf491('0x47')](handleError(_0x3f9d4e,null));};exports['update']=function(_0x24b4b0,_0x2cb042){if(_0x24b4b0[_0xf491('0x4d')]['id']){delete _0x24b4b0[_0xf491('0x4d')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x24b4b0['params']['id']}})[_0xf491('0x24')](handleEntityNotFound(_0x2cb042,null))['then'](saveUpdates(_0x24b4b0[_0xf491('0x4d')],null))[_0xf491('0x24')](respondWithResult(_0x2cb042,null))[_0xf491('0x47')](handleError(_0x2cb042,null));};exports[_0xf491('0x25')]=function(_0x18f189,_0x35f122){return db[_0xf491('0x2f')][_0xf491('0x4b')]({'where':{'id':_0x18f189['params']['id']}})[_0xf491('0x24')](handleEntityNotFound(_0x35f122,null))['then'](removeEntity(_0x35f122,null))[_0xf491('0x47')](handleError(_0x35f122,null));};exports[_0xf491('0x54')]=function(_0x1c7062,_0x49c909){return db[_0xf491('0x2f')]['describe']()[_0xf491('0x24')](respondWithResult(_0x49c909,null))[_0xf491('0x47')](handleError(_0x49c909,null));};exports[_0xf491('0x55')]=function(_0x331b53,_0x134ad0,_0x165139){var _0x3950c6={'raw':!![],'where':{}},_0x49ef5b={},_0x4ba2fc;return db[_0xf491('0x2f')][_0xf491('0x56')]({'where':{'id':_0x331b53[_0xf491('0x49')]['id']}})['then'](handleEntityNotFound(_0x134ad0,null))['then'](function(_0x1584f5){if(_0x1584f5){_0x4ba2fc=_0x1584f5[_0xf491('0x26')]({'plain':!![]});_0x49ef5b[_0xf491('0x34')]=_[_0xf491('0x36')](db[_0xf491('0x57')][_0xf491('0x30')]);_0x49ef5b[_0xf491('0x35')]=_[_0xf491('0x36')](_0x331b53[_0xf491('0x35')]);_0x49ef5b[_0xf491('0x41')]=_[_0xf491('0x37')](_0x49ef5b[_0xf491('0x34')],_0x49ef5b[_0xf491('0x35')]);_0x3950c6['attributes']=_[_0xf491('0x37')](_0x49ef5b['model'],qs[_0xf491('0x39')](_0x331b53[_0xf491('0x35')][_0xf491('0x39')]));_0x3950c6[_0xf491('0x38')]=_0x3950c6[_0xf491('0x38')][_0xf491('0x3a')]?_0x3950c6[_0xf491('0x38')]:_0x49ef5b[_0xf491('0x34')];if(!_0x331b53[_0xf491('0x35')][_0xf491('0x3b')]('nolimit')){_0x3950c6[_0xf491('0x3d')]=qs['limit'](_0x331b53[_0xf491('0x35')][_0xf491('0x3d')]);_0x3950c6['offset']=qs[_0xf491('0x20')](_0x331b53['query'][_0xf491('0x20')]);}_0x3950c6[_0xf491('0x3e')]=qs['sort'](_0x331b53[_0xf491('0x35')][_0xf491('0x3f')]);_0x3950c6[_0xf491('0x40')]=qs[_0xf491('0x41')](_['pick'](_0x331b53[_0xf491('0x35')],_0x49ef5b[_0xf491('0x41')]));_0x3950c6[_0xf491('0x40')]['SmsQueueId']=_0x1584f5['id'];if(_0x331b53[_0xf491('0x35')][_0xf491('0x42')]){_0x3950c6[_0xf491('0x40')]=_[_0xf491('0x43')](_0x3950c6[_0xf491('0x40')],{'$or':_['map'](_0x3950c6[_0xf491('0x38')],function(_0x535202){var _0x5a8c61={};_0x5a8c61[_0x535202]={'$like':'%'+_0x331b53['query'][_0xf491('0x42')]+'%'};return _0x5a8c61;})});}_0x3950c6=_[_0xf491('0x43')]({},_0x3950c6,_0x331b53[_0xf491('0x44')]);return db[_0xf491('0x57')][_0xf491('0x46')](_0x3950c6);}})[_0xf491('0x24')](function(_0x2e5504){if(_0x2e5504){return db[_0xf491('0x58')]['findAndCountAll']({'where':{'id':_['map'](_0x2e5504,_0xf491('0x59')),'role':_0xf491('0x5a')},'attributes':['id',_0xf491('0x2b'),_0xf491('0x5b'),'updatedAt',_0xf491('0x5c')]});}})[_0xf491('0x24')](function(_0xa2dccb){if(_0xa2dccb){return{'count':_0xa2dccb[_0xf491('0x1f')],'rows':_['map'](_0xa2dccb['rows'],function(_0x55ec38){return{'membername':_0x55ec38[_0xf491('0x2b')],'UserId':_0x55ec38['id'],'queue_name':_0x4ba2fc[_0xf491('0x2b')],'SmsQueueId':_0x4ba2fc['id'],'interface':util[_0xf491('0x5d')](_0xf491('0x5e'),_0xf491('0x5f'),_0x55ec38[_0xf491('0x2b')]),'penalty':0x0,'paused':_0x55ec38[_0xf491('0x5b')],'createdAt':_0x55ec38[_0xf491('0x5c')],'updatedAt':_0x55ec38[_0xf491('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf491('0x24')](respondWithFilteredResult(_0x134ad0,_0x3950c6))[_0xf491('0x47')](handleError(_0x134ad0,null));};exports[_0xf491('0x61')]=function(_0x4bf16e,_0x5d61a8,_0x50dffe){var _0x290832={};var _0x403969={};var _0x46e9de;var _0x518e3e;return db['SmsQueue'][_0xf491('0x56')]({'where':{'id':_0x4bf16e[_0xf491('0x49')]['id']}})['then'](handleEntityNotFound(_0x5d61a8,null))[_0xf491('0x24')](function(_0x5289de){if(_0x5289de){_0x46e9de=_0x5289de;_0x403969[_0xf491('0x34')]=_[_0xf491('0x36')](db[_0xf491('0x62')]['rawAttributes']);_0x403969[_0xf491('0x35')]=_[_0xf491('0x36')](_0x4bf16e[_0xf491('0x35')]);_0x403969[_0xf491('0x41')]=_[_0xf491('0x37')](_0x403969[_0xf491('0x34')],_0x403969[_0xf491('0x35')]);_0x290832[_0xf491('0x38')]=_['intersection'](_0x403969[_0xf491('0x34')],qs['fields'](_0x4bf16e['query'][_0xf491('0x39')]));_0x290832['attributes']=_0x290832[_0xf491('0x38')][_0xf491('0x3a')]?_0x290832[_0xf491('0x38')]:_0x403969[_0xf491('0x34')];_0x290832[_0xf491('0x3e')]=qs[_0xf491('0x3f')](_0x4bf16e[_0xf491('0x35')][_0xf491('0x3f')]);_0x290832[_0xf491('0x40')]=qs['filters'](_[_0xf491('0x63')](_0x4bf16e[_0xf491('0x35')],_0x403969[_0xf491('0x41')]));if(_0x4bf16e[_0xf491('0x35')][_0xf491('0x42')]){_0x290832[_0xf491('0x40')]=_[_0xf491('0x43')](_0x290832[_0xf491('0x40')],{'$or':_[_0xf491('0x2e')](_0x290832[_0xf491('0x38')],function(_0x5df670){var _0x4179a3={};_0x4179a3[_0x5df670]={'$like':'%'+_0x4bf16e[_0xf491('0x35')][_0xf491('0x42')]+'%'};return _0x4179a3;})});}_0x290832=_[_0xf491('0x43')]({},_0x290832,_0x4bf16e['options']);return _0x46e9de[_0xf491('0x61')](_0x290832);}})['then'](function(_0x447da0){if(_0x447da0){_0x518e3e=_0x447da0[_0xf491('0x3a')];if(!_0x4bf16e[_0xf491('0x35')]['hasOwnProperty'](_0xf491('0x3c'))){_0x290832[_0xf491('0x3d')]=qs[_0xf491('0x3d')](_0x4bf16e[_0xf491('0x35')]['limit']);_0x290832[_0xf491('0x20')]=qs[_0xf491('0x20')](_0x4bf16e['query'][_0xf491('0x20')]);}return _0x46e9de[_0xf491('0x61')](_0x290832);}})[_0xf491('0x24')](function(_0xa83977){if(_0xa83977){return _0xa83977?{'count':_0x518e3e,'rows':_0xa83977}:null;}})[_0xf491('0x24')](respondWithResult(_0x5d61a8,null))[_0xf491('0x47')](handleError(_0x5d61a8,null));};exports['addTeams']=function(_0xf87027,_0x3fd3b9,_0x52d73f){var _0x1a34fa=_0xf87027[_0xf491('0x4d')][_0xf491('0x64')];return db['Team'][_0xf491('0x46')]({'where':{'id':_0x1a34fa},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf491('0x65'),'attributes':['id',_0xf491('0x2b'),_0xf491('0x66'),_0xf491('0x67'),_0xf491('0x68')],'raw':!![]}]})['then'](function(_0x2bc3e4){if(_0x2bc3e4){var _0x182353=_['flatMap'](_0x2bc3e4,function(_0x585594){var _0x492c95=_0x585594['get']({'plain':!![]});return _0x492c95[_0xf491('0x65')];});return db[_0xf491('0x2f')][_0xf491('0x4b')]({'where':{'id':_0xf87027['params']['id']}})['then'](function(_0x3b8d86){return db[_0xf491('0x69')][_0xf491('0x6a')](function(_0x1e0533){return _0x3b8d86['addTeams'](_0x1a34fa,{'transaction':_0x1e0533})[_0xf491('0x24')](function(){return BPromise[_0xf491('0x6b')](_0x182353,function(_0x215814){return db[_0xf491('0x57')]['findOrCreate']({'where':{'UserId':_0x215814['id'],'SmsQueueId':_0xf87027[_0xf491('0x49')]['id']},'transaction':_0x1e0533});});})[_0xf491('0x24')](function(){_0x182353[_0xf491('0x6c')](function(_0x5832b9){socket[_0xf491('0x6d')](_0xf491('0x6e'),{'UserId':_0x5832b9['id'],'SmsQueueId':_0x3b8d86['id']});});});});});}})[_0xf491('0x24')](respondWithStatusCode(_0x3fd3b9,null))[_0xf491('0x47')](handleError(_0x3fd3b9,null));};exports[_0xf491('0x6f')]=function(_0x24654d,_0x115b9b,_0x313e36){return db[_0xf491('0x62')][_0xf491('0x46')]({'where':{'id':_0x24654d[_0xf491('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf491('0x58')],'as':_0xf491('0x65'),'attributes':['id'],'raw':!![]}]})[_0xf491('0x24')](handleEntityNotFound(_0x115b9b,null))['then'](function(_0x139656){var _0x569fed=_['map'](_0x139656,'id');var _0x1bc17c=[];var _0x9e1309=[];var _0x5109c8=squel[_0xf491('0x70')]();_0x5109c8[_0xf491('0x71')](_0xf491('0x72'))[_0xf491('0x73')](_0xf491('0x74'),'tq')[_0xf491('0x75')](_0xf491('0x76'),'ut',_0xf491('0x77'))['where'](_0xf491('0x78'),_0x24654d['params']['id']);for(var _0x2daee8=0x0;_0x2daee8<_0x139656[_0xf491('0x3a')];_0x2daee8+=0x1){let _0x59a41f=_0x139656[_0x2daee8];for(var _0x24581b=0x0;_0x24581b<_0x59a41f[_0xf491('0x65')][_0xf491('0x3a')];_0x24581b+=0x1){let _0x42d59e=_0x59a41f[_0xf491('0x65')][_0x24581b];var _0x19d0eb=_0x5109c8[_0xf491('0x79')]();_0x19d0eb[_0xf491('0x40')](_0xf491('0x7a'),_0x42d59e['id']);_0x9e1309[_0xf491('0x7b')](db['sequelize'][_0xf491('0x35')](_0x19d0eb[_0xf491('0x7c')](),{'type':db['sequelize'][_0xf491('0x7d')]['SELECT']})[_0xf491('0x24')](function(_0x5b6293){if(_0x5b6293[_0xf491('0x3a')]===0x1){return _0x42d59e['id'];}else{var _0x5216ea=_[_0xf491('0x7e')](_[_0xf491('0x2e')](_0x5b6293,_0xf491('0x7f')),function(_0x2eda08){return _[_0xf491('0x80')](_0x569fed,_0x2eda08);});if(_0x5216ea){return _0x42d59e['id'];}}}));}}return BPromise[_0xf491('0x81')](_0x9e1309)[_0xf491('0x24')](function(_0x438059){_0x1bc17c=_(_0x1bc17c)['union'](_0x438059)[_0xf491('0x82')]()[_0xf491('0x83')]();return db['SmsQueue'][_0xf491('0x4b')]({'where':{'id':_0x24654d[_0xf491('0x49')]['id']}})[_0xf491('0x24')](function(_0x5468c0){return db[_0xf491('0x69')][_0xf491('0x6a')](function(_0x25d7ca){return _0x5468c0[_0xf491('0x6f')](_0x24654d[_0xf491('0x35')]['ids'],{'transaction':_0x25d7ca})[_0xf491('0x24')](function(){if(!_[_0xf491('0x84')](_0x1bc17c)){return _0x5468c0[_0xf491('0x85')](_0x1bc17c,{'transaction':_0x25d7ca});}})['then'](function(){_0x1bc17c[_0xf491('0x6c')](function(_0x4a006a){socket[_0xf491('0x6d')](_0xf491('0x86'),{'UserId':_0x4a006a,'SmsQueueId':_0x5468c0['id']});});});});});});})['then'](respondWithStatusCode(_0x115b9b,null))[_0xf491('0x47')](handleError(_0x115b9b,null));};exports[_0xf491('0x87')]=function(_0x318f55,_0x304eb8,_0x5b998f){return db['SmsQueue'][_0xf491('0x4b')]({'where':{'id':_0x318f55[_0xf491('0x49')]['id']}})[_0xf491('0x24')](handleEntityNotFound(_0x304eb8,null))[_0xf491('0x24')](function(_0x19f130){if(_0x19f130){return _0x19f130[_0xf491('0x87')](_0x318f55[_0xf491('0x4d')][_0xf491('0x64')],_[_0xf491('0x88')](_0x318f55[_0xf491('0x4d')],[_0xf491('0x64'),'id'])||{})['spread'](function(_0x4fed65){for(var _0xb1150e=0x0;_0xb1150e<_0x318f55['body'][_0xf491('0x64')][_0xf491('0x3a')];_0xb1150e+=0x1){socket[_0xf491('0x6d')](_0xf491('0x6e'),{'UserId':_0x318f55[_0xf491('0x4d')][_0xf491('0x64')][_0xb1150e],'SmsQueueId':_0x318f55[_0xf491('0x49')]['id']});}return _0x4fed65;});}})[_0xf491('0x24')](respondWithResult(_0x304eb8,null))[_0xf491('0x47')](handleError(_0x304eb8,null));};exports[_0xf491('0x85')]=function(_0x4e8516,_0x16e8cf,_0x17114c){return db[_0xf491('0x2f')][_0xf491('0x4b')]({'where':{'id':_0x4e8516[_0xf491('0x49')]['id']}})[_0xf491('0x24')](handleEntityNotFound(_0x16e8cf,null))['then'](function(_0x4b5972){if(_0x4b5972){return _0x4b5972['removeAgents'](_0x4e8516[_0xf491('0x35')]['ids'])[_0xf491('0x24')](function(){if(_[_0xf491('0x89')](_0x4e8516[_0xf491('0x35')][_0xf491('0x64')])){for(var _0x3b547d=0x0;_0x3b547d<_0x4e8516[_0xf491('0x35')]['ids'][_0xf491('0x3a')];_0x3b547d+=0x1){socket[_0xf491('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x4e8516[_0xf491('0x35')][_0xf491('0x64')][_0x3b547d]),'SmsQueueId':Number(_0x4e8516[_0xf491('0x49')]['id'])});}}else{socket[_0xf491('0x6d')](_0xf491('0x86'),{'UserId':Number(_0x4e8516[_0xf491('0x35')]['ids']),'SmsQueueId':Number(_0x4e8516['params']['id'])});}});}})[_0xf491('0x24')](respondWithStatusCode(_0x16e8cf,null))['catch'](handleError(_0x16e8cf,null));};exports['getAgents']=function(_0x41af33,_0x5b983f,_0x29afea){var _0x1200e0={};var _0x454f30={};var _0x4a4307;var _0x283db6;return db[_0xf491('0x2f')][_0xf491('0x56')]({'where':{'id':_0x41af33[_0xf491('0x49')]['id']}})[_0xf491('0x24')](handleEntityNotFound(_0x5b983f,null))[_0xf491('0x24')](function(_0x414db7){if(_0x414db7){_0x4a4307=_0x414db7;_0x454f30[_0xf491('0x34')]=_[_0xf491('0x36')](db['User'][_0xf491('0x30')]);_0x454f30[_0xf491('0x35')]=_[_0xf491('0x36')](_0x41af33['query']);_0x454f30['filters']=_['intersection'](_0x454f30[_0xf491('0x34')],_0x454f30[_0xf491('0x35')]);_0x1200e0[_0xf491('0x38')]=_[_0xf491('0x37')](_0x454f30[_0xf491('0x34')],qs['fields'](_0x41af33[_0xf491('0x35')][_0xf491('0x39')]));_0x1200e0['attributes']=_0x1200e0[_0xf491('0x38')][_0xf491('0x3a')]?_0x1200e0[_0xf491('0x38')]:_0x454f30[_0xf491('0x34')];_0x1200e0[_0xf491('0x3e')]=qs[_0xf491('0x3f')](_0x41af33[_0xf491('0x35')][_0xf491('0x3f')]);_0x1200e0['where']=qs['filters'](_[_0xf491('0x63')](_0x41af33[_0xf491('0x35')],_0x454f30[_0xf491('0x41')]));if(_0x41af33[_0xf491('0x35')][_0xf491('0x42')]){_0x1200e0[_0xf491('0x40')]=_[_0xf491('0x43')](_0x1200e0[_0xf491('0x40')],{'$or':_['map'](_0x1200e0[_0xf491('0x38')],function(_0x3b823e){var _0x2118a0={};_0x2118a0[_0x3b823e]={'$like':'%'+_0x41af33[_0xf491('0x35')]['filter']+'%'};return _0x2118a0;})});}_0x1200e0=_[_0xf491('0x43')]({},_0x1200e0,_0x41af33[_0xf491('0x44')]);return _0x4a4307['getAgents'](_0x1200e0);}})[_0xf491('0x24')](function(_0x79eb25){if(_0x79eb25){_0x283db6=_0x79eb25[_0xf491('0x3a')];if(!_0x41af33[_0xf491('0x35')]['hasOwnProperty']('nolimit')){_0x1200e0[_0xf491('0x3d')]=qs[_0xf491('0x3d')](_0x41af33['query'][_0xf491('0x3d')]);_0x1200e0[_0xf491('0x20')]=qs[_0xf491('0x20')](_0x41af33[_0xf491('0x35')][_0xf491('0x20')]);}return _0x4a4307['getAgents'](_0x1200e0);}})[_0xf491('0x24')](function(_0x10bb32){if(_0x10bb32){return _0x10bb32?{'count':_0x283db6,'rows':_0x10bb32}:null;}})['then'](respondWithResult(_0x5b983f,null))[_0xf491('0x47')](handleError(_0x5b983f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2d68583..4b44056 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 _0x7383=['SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0x7383,0x18a));var _0x3738=function(_0x5b740d,_0x89abbe){_0x5b740d=_0x5b740d-0x0;var _0x46b17c=_0x7383[_0x5b740d];return _0x46b17c;};'use strict';var EventEmitter=require(_0x3738('0x0'));var SmsQueue=require(_0x3738('0x1'))['db'][_0x3738('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3738('0x3')](0x0);var events={'afterCreate':_0x3738('0x4'),'afterUpdate':_0x3738('0x5'),'afterDestroy':_0x3738('0x6')};function emitEvent(_0x15682b){return function(_0x49f0f1,_0xbaf41c,_0x4a3f67){SmsQueueEvents['emit'](_0x15682b+':'+_0x49f0f1['id'],_0x49f0f1);SmsQueueEvents[_0x3738('0x7')](_0x15682b,_0x49f0f1);_0x4a3f67(null);};}for(var e in events){if(events[_0x3738('0x8')](e)){var event=events[e];SmsQueue[_0x3738('0x9')](e,emitEvent(event));}}module[_0x3738('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0x4a15=['emit','hasOwnProperty','exports','events','SmsQueue','save','update','remove'];(function(_0x4355f9,_0x39cd52){var _0x20eca7=function(_0x2bd6f5){while(--_0x2bd6f5){_0x4355f9['push'](_0x4355f9['shift']());}};_0x20eca7(++_0x39cd52);}(_0x4a15,0x18b));var _0x54a1=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0x4a15[_0x80f51a];return _0x327148;};'use strict';var EventEmitter=require(_0x54a1('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x54a1('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x54a1('0x2'),'afterUpdate':_0x54a1('0x3'),'afterDestroy':_0x54a1('0x4')};function emitEvent(_0x541a68){return function(_0x2fbae1,_0x46e4a0,_0x4bf3eb){SmsQueueEvents[_0x54a1('0x5')](_0x541a68+':'+_0x2fbae1['id'],_0x2fbae1);SmsQueueEvents['emit'](_0x541a68,_0x2fbae1);_0x4bf3eb(null);};}for(var e in events){if(events[_0x54a1('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x54a1('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8942d77..17c8b20 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 _0x325e=['define','SmsQueue','sms_queues','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x12c263,_0x2d9bce){var _0x192cd7=function(_0x3a1fc0){while(--_0x3a1fc0){_0x12c263['push'](_0x12c263['shift']());}};_0x192cd7(++_0x2d9bce);}(_0x325e,0xc1));var _0xe325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x325e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe325('0x0'));var util=require(_0xe325('0x1'));var logger=require('../../config/logger')(_0xe325('0x2'));var moment=require(_0xe325('0x3'));var BPromise=require('bluebird');var rp=require(_0xe325('0x4'));var fs=require('fs');var path=require(_0xe325('0x5'));var rimraf=require(_0xe325('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0x3fc509,_0x1110e8){return _0x3fc509[_0xe325('0x7')](_0xe325('0x8'),attributes,{'tableName':_0xe325('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7840=['rimraf','../../config/environment','exports','define','sms_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x7840,0x68));var _0x0784=function(_0x542de9,_0xe07c65){_0x542de9=_0x542de9-0x0;var _0x10b064=_0x7840[_0x542de9];return _0x10b064;};'use strict';var _=require('lodash');var util=require(_0x0784('0x0'));var logger=require(_0x0784('0x1'))(_0x0784('0x2'));var moment=require(_0x0784('0x3'));var BPromise=require('bluebird');var rp=require(_0x0784('0x4'));var fs=require('fs');var path=require(_0x0784('0x5'));var rimraf=require(_0x0784('0x6'));var config=require(_0x0784('0x7'));var attributes=require('./smsQueue.attributes');module[_0x0784('0x8')]=function(_0xb47c80,_0x3958e){return _0xb47c80[_0x0784('0x9')]('SmsQueue',attributes,{'tableName':_0x0784('0xa'),'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 5daddd6..00fe23b 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 _0xc6f3=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowSmsQueue','find','where','lodash','util','moment','../../config/utils','../../config/logger'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0xc6f3,0x1e7));var _0x3c6f=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xc6f3[_0x22e47a];return _0x15a12a;};'use strict';var _=require(_0x3c6f('0x0'));var util=require(_0x3c6f('0x1'));var moment=require(_0x3c6f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3c6f('0x3'));var logger=require(_0x3c6f('0x4'))(_0x3c6f('0x5'));var config=require(_0x3c6f('0x6'));var jayson=require(_0x3c6f('0x7'));var client=jayson[_0x3c6f('0x8')][_0x3c6f('0x9')]({'port':0x232a});config[_0x3c6f('0xa')]=_[_0x3c6f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3c6f('0xc'))(new Redis(config[_0x3c6f('0xa')]));require(_0x3c6f('0xd'))[_0x3c6f('0xe')](socket);function respondWithRpcPromise(_0x3369a8,_0x37a0ad,_0x2d8e0f){return new BPromise(function(_0x59ff60,_0x1c581d){return client[_0x3c6f('0xf')](_0x3369a8,_0x2d8e0f)[_0x3c6f('0x10')](function(_0x12ae83){logger[_0x3c6f('0x11')](_0x3c6f('0x12'),_0x37a0ad,_0x3c6f('0x13'));logger['debug'](_0x3c6f('0x14'),_0x37a0ad,_0x3c6f('0x13'),JSON[_0x3c6f('0x15')](_0x12ae83));if(_0x12ae83['error']){if(_0x12ae83[_0x3c6f('0x16')][_0x3c6f('0x17')]===0x1f4){logger[_0x3c6f('0x16')](_0x3c6f('0x12'),_0x37a0ad,_0x12ae83[_0x3c6f('0x16')]['message']);return _0x1c581d(_0x12ae83['error'][_0x3c6f('0x18')]);}logger[_0x3c6f('0x16')](_0x3c6f('0x12'),_0x37a0ad,_0x12ae83['error'][_0x3c6f('0x18')]);return _0x59ff60(_0x12ae83[_0x3c6f('0x16')]['message']);}else{logger['info'](_0x3c6f('0x12'),_0x37a0ad,'request\x20sent');_0x59ff60(_0x12ae83[_0x3c6f('0x19')][_0x3c6f('0x18')]);}})[_0x3c6f('0x1a')](function(_0x32f12c){logger[_0x3c6f('0x16')](_0x3c6f('0x12'),_0x37a0ad,_0x32f12c);_0x1c581d(_0x32f12c);});});}exports[_0x3c6f('0x1b')]=function(_0x5d8749){var _0x36091c=this;return new Promise(function(_0x1fb143,_0x4752f0){return db[_0x3c6f('0x1c')][_0x3c6f('0x1d')]({'raw':_0x5d8749[_0x3c6f('0x1e')]?_0x5d8749[_0x3c6f('0x1e')][_0x3c6f('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d8749[_0x3c6f('0x1e')]?_0x5d8749['options']['where']||null:null,'attributes':_0x5d8749[_0x3c6f('0x1e')]?_0x5d8749[_0x3c6f('0x1e')][_0x3c6f('0x20')]||null:null,'limit':_0x5d8749[_0x3c6f('0x1e')]?_0x5d8749[_0x3c6f('0x1e')][_0x3c6f('0x21')]||null:null,'include':_0x5d8749['options']?_0x5d8749['options'][_0x3c6f('0x22')]?_[_0x3c6f('0x23')](_0x5d8749[_0x3c6f('0x1e')][_0x3c6f('0x22')],function(_0x50f8ff){return{'model':db[_0x50f8ff[_0x3c6f('0x24')]],'as':_0x50f8ff['as'],'attributes':_0x50f8ff['attributes'],'include':_0x50f8ff[_0x3c6f('0x22')]?_[_0x3c6f('0x23')](_0x50f8ff[_0x3c6f('0x22')],function(_0x184877){return{'model':db[_0x184877[_0x3c6f('0x24')]],'as':_0x184877['as'],'attributes':_0x184877[_0x3c6f('0x20')],'include':_0x184877[_0x3c6f('0x22')]?_['map'](_0x184877['include'],function(_0x293e73){return{'model':db[_0x293e73[_0x3c6f('0x24')]],'as':_0x293e73['as'],'attributes':_0x293e73[_0x3c6f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3c6f('0x10')](function(_0x5109c0){logger['info'](_0x3c6f('0x1b'),_0x5d8749);logger[_0x3c6f('0x25')](_0x3c6f('0x1b'),_0x5d8749,JSON['stringify'](_0x5109c0));_0x1fb143(_0x5109c0);})[_0x3c6f('0x1a')](function(_0xd41b43){logger[_0x3c6f('0x16')](_0x3c6f('0x1b'),_0xd41b43[_0x3c6f('0x18')],_0x5d8749);_0x4752f0(_0x36091c[_0x3c6f('0x16')](0x1f4,_0xd41b43[_0x3c6f('0x18')]));});});};exports[_0x3c6f('0x26')]=function(_0x20b32a){var _0x3c7862=this;return new Promise(function(_0x154815,_0x14cdd9){return db['SmsQueue'][_0x3c6f('0x27')]({'raw':_0x20b32a[_0x3c6f('0x1e')]?_0x20b32a[_0x3c6f('0x1e')][_0x3c6f('0x1f')]===undefined?!![]:![]:!![],'where':_0x20b32a[_0x3c6f('0x1e')]?_0x20b32a[_0x3c6f('0x1e')][_0x3c6f('0x28')]||null:null,'attributes':_0x20b32a['options']?_0x20b32a[_0x3c6f('0x1e')][_0x3c6f('0x20')]||null:null,'include':_0x20b32a[_0x3c6f('0x1e')]?_0x20b32a[_0x3c6f('0x1e')][_0x3c6f('0x22')]?_[_0x3c6f('0x23')](_0x20b32a[_0x3c6f('0x1e')][_0x3c6f('0x22')],function(_0x4abb18){return{'model':db[_0x4abb18[_0x3c6f('0x24')]],'as':_0x4abb18['as'],'attributes':_0x4abb18[_0x3c6f('0x20')],'include':_0x4abb18['include']?_[_0x3c6f('0x23')](_0x4abb18[_0x3c6f('0x22')],function(_0xfb2d20){return{'model':db[_0xfb2d20[_0x3c6f('0x24')]],'as':_0xfb2d20['as'],'attributes':_0xfb2d20[_0x3c6f('0x20')],'include':_0xfb2d20[_0x3c6f('0x22')]?_[_0x3c6f('0x23')](_0xfb2d20[_0x3c6f('0x22')],function(_0x3402af){return{'model':db[_0x3402af['model']],'as':_0x3402af['as'],'attributes':_0x3402af[_0x3c6f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40f199){logger[_0x3c6f('0x11')](_0x3c6f('0x26'),_0x20b32a);logger[_0x3c6f('0x25')](_0x3c6f('0x26'),_0x20b32a,JSON[_0x3c6f('0x15')](_0x40f199));_0x154815(_0x40f199);})[_0x3c6f('0x1a')](function(_0x4830c2){logger['error'](_0x3c6f('0x26'),_0x4830c2[_0x3c6f('0x18')],_0x20b32a);_0x14cdd9(_0x3c7862['error'](0x1f4,_0x4830c2[_0x3c6f('0x18')]));});});}; \ No newline at end of file +var _0xad4c=['localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x17b3b8,_0xbb0af3){var _0x326e08=function(_0x25ffca){while(--_0x25ffca){_0x17b3b8['push'](_0x17b3b8['shift']());}};_0x326e08(++_0xbb0af3);}(_0xad4c,0xc1));var _0xcad4=function(_0x52a4c8,_0x1a3340){_0x52a4c8=_0x52a4c8-0x0;var _0x1a86f4=_0xad4c[_0x52a4c8];return _0x1a86f4;};'use strict';var _=require(_0xcad4('0x0'));var util=require(_0xcad4('0x1'));var moment=require(_0xcad4('0x2'));var BPromise=require(_0xcad4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcad4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcad4('0x5'));var logger=require(_0xcad4('0x6'))(_0xcad4('0x7'));var config=require(_0xcad4('0x8'));var jayson=require(_0xcad4('0x9'));var client=jayson[_0xcad4('0xa')]['http']({'port':0x232a});config[_0xcad4('0xb')]=_['defaults'](config[_0xcad4('0xb')],{'host':_0xcad4('0xc'),'port':0x18eb});var socket=require(_0xcad4('0xd'))(new Redis(config[_0xcad4('0xb')]));require(_0xcad4('0xe'))[_0xcad4('0xf')](socket);function respondWithRpcPromise(_0x38c539,_0x2082ac,_0x36490b){return new BPromise(function(_0x2e1ed5,_0x56ff11){return client[_0xcad4('0x10')](_0x38c539,_0x36490b)[_0xcad4('0x11')](function(_0x2d1e63){logger[_0xcad4('0x12')](_0xcad4('0x13'),_0x2082ac,_0xcad4('0x14'));logger[_0xcad4('0x15')](_0xcad4('0x16'),_0x2082ac,_0xcad4('0x14'),JSON[_0xcad4('0x17')](_0x2d1e63));if(_0x2d1e63['error']){if(_0x2d1e63[_0xcad4('0x18')][_0xcad4('0x19')]===0x1f4){logger[_0xcad4('0x18')]('SmsQueue,\x20%s,\x20%s',_0x2082ac,_0x2d1e63[_0xcad4('0x18')][_0xcad4('0x1a')]);return _0x56ff11(_0x2d1e63[_0xcad4('0x18')][_0xcad4('0x1a')]);}logger[_0xcad4('0x18')](_0xcad4('0x13'),_0x2082ac,_0x2d1e63[_0xcad4('0x18')][_0xcad4('0x1a')]);return _0x2e1ed5(_0x2d1e63[_0xcad4('0x18')][_0xcad4('0x1a')]);}else{logger[_0xcad4('0x12')](_0xcad4('0x13'),_0x2082ac,_0xcad4('0x14'));_0x2e1ed5(_0x2d1e63['result'][_0xcad4('0x1a')]);}})[_0xcad4('0x1b')](function(_0x10be3b){logger[_0xcad4('0x18')](_0xcad4('0x13'),_0x2082ac,_0x10be3b);_0x56ff11(_0x10be3b);});});}exports[_0xcad4('0x1c')]=function(_0x4ed3f6){var _0x349490=this;return new Promise(function(_0x486b78,_0x397164){return db[_0xcad4('0x1d')][_0xcad4('0x1e')]({'raw':_0x4ed3f6[_0xcad4('0x1f')]?_0x4ed3f6[_0xcad4('0x1f')][_0xcad4('0x20')]===undefined?!![]:![]:!![],'where':_0x4ed3f6[_0xcad4('0x1f')]?_0x4ed3f6[_0xcad4('0x1f')][_0xcad4('0x21')]||null:null,'attributes':_0x4ed3f6['options']?_0x4ed3f6['options'][_0xcad4('0x22')]||null:null,'limit':_0x4ed3f6[_0xcad4('0x1f')]?_0x4ed3f6['options'][_0xcad4('0x23')]||null:null,'include':_0x4ed3f6[_0xcad4('0x1f')]?_0x4ed3f6[_0xcad4('0x1f')][_0xcad4('0x24')]?_[_0xcad4('0x25')](_0x4ed3f6['options'][_0xcad4('0x24')],function(_0x272b32){return{'model':db[_0x272b32['model']],'as':_0x272b32['as'],'attributes':_0x272b32[_0xcad4('0x22')],'include':_0x272b32[_0xcad4('0x24')]?_[_0xcad4('0x25')](_0x272b32['include'],function(_0x1e4a4b){return{'model':db[_0x1e4a4b[_0xcad4('0x26')]],'as':_0x1e4a4b['as'],'attributes':_0x1e4a4b[_0xcad4('0x22')],'include':_0x1e4a4b['include']?_[_0xcad4('0x25')](_0x1e4a4b[_0xcad4('0x24')],function(_0x3f7b23){return{'model':db[_0x3f7b23[_0xcad4('0x26')]],'as':_0x3f7b23['as'],'attributes':_0x3f7b23[_0xcad4('0x22')]};}):[]};}):[]};}):[]:[]})[_0xcad4('0x11')](function(_0x46f9fd){logger[_0xcad4('0x12')]('GetSmsQueue',_0x4ed3f6);logger[_0xcad4('0x15')](_0xcad4('0x1c'),_0x4ed3f6,JSON[_0xcad4('0x17')](_0x46f9fd));_0x486b78(_0x46f9fd);})[_0xcad4('0x1b')](function(_0x633e6b){logger[_0xcad4('0x18')](_0xcad4('0x1c'),_0x633e6b[_0xcad4('0x1a')],_0x4ed3f6);_0x397164(_0x349490['error'](0x1f4,_0x633e6b[_0xcad4('0x1a')]));});});};exports[_0xcad4('0x27')]=function(_0x3134c2){var _0x2acb98=this;return new Promise(function(_0x55f270,_0x3191f7){return db[_0xcad4('0x1d')][_0xcad4('0x28')]({'raw':_0x3134c2[_0xcad4('0x1f')]?_0x3134c2[_0xcad4('0x1f')][_0xcad4('0x20')]===undefined?!![]:![]:!![],'where':_0x3134c2[_0xcad4('0x1f')]?_0x3134c2['options'][_0xcad4('0x21')]||null:null,'attributes':_0x3134c2['options']?_0x3134c2[_0xcad4('0x1f')][_0xcad4('0x22')]||null:null,'include':_0x3134c2[_0xcad4('0x1f')]?_0x3134c2[_0xcad4('0x1f')][_0xcad4('0x24')]?_['map'](_0x3134c2['options']['include'],function(_0x24f01c){return{'model':db[_0x24f01c[_0xcad4('0x26')]],'as':_0x24f01c['as'],'attributes':_0x24f01c['attributes'],'include':_0x24f01c['include']?_['map'](_0x24f01c[_0xcad4('0x24')],function(_0xcdffc0){return{'model':db[_0xcdffc0[_0xcad4('0x26')]],'as':_0xcdffc0['as'],'attributes':_0xcdffc0[_0xcad4('0x22')],'include':_0xcdffc0[_0xcad4('0x24')]?_[_0xcad4('0x25')](_0xcdffc0[_0xcad4('0x24')],function(_0x2dcacb){return{'model':db[_0x2dcacb[_0xcad4('0x26')]],'as':_0x2dcacb['as'],'attributes':_0x2dcacb[_0xcad4('0x22')]};}):[]};}):[]};}):[]:[]})[_0xcad4('0x11')](function(_0x28bc54){logger[_0xcad4('0x12')](_0xcad4('0x27'),_0x3134c2);logger[_0xcad4('0x15')]('ShowSmsQueue',_0x3134c2,JSON[_0xcad4('0x17')](_0x28bc54));_0x55f270(_0x28bc54);})[_0xcad4('0x1b')](function(_0x5f4679){logger[_0xcad4('0x18')](_0xcad4('0x27'),_0x5f4679[_0xcad4('0x1a')],_0x3134c2);_0x3191f7(_0x2acb98[_0xcad4('0x18')](0x1f4,_0x5f4679[_0xcad4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2676057..edaa2ac 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 _0xfb41=['register','length','smsQueue:','save','update','emit','removeListener'];(function(_0x25948f,_0x4ac7e4){var _0x2b1976=function(_0x1ee63a){while(--_0x1ee63a){_0x25948f['push'](_0x25948f['shift']());}};_0x2b1976(++_0x4ac7e4);}(_0xfb41,0x1ed));var _0x1fb4=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xfb41[_0x54c9dd];return _0x855156;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x1fb4('0x0'),'remove',_0x1fb4('0x1')];function createListener(_0x5f1d8e,_0x515dd1){return function(_0x4c3bb2){_0x515dd1[_0x1fb4('0x2')](_0x5f1d8e,_0x4c3bb2);};}function removeListener(_0x19f2f3,_0x2adc6c){return function(){SmsQueueEvents[_0x1fb4('0x3')](_0x19f2f3,_0x2adc6c);};}exports[_0x1fb4('0x4')]=function(_0x1f27e3){for(var _0x3531d8=0x0,_0x2466e5=events[_0x1fb4('0x5')];_0x3531d8<_0x2466e5;_0x3531d8++){var _0x58f8e8=events[_0x3531d8];var _0x21de87=createListener(_0x1fb4('0x6')+_0x58f8e8,_0x1f27e3);SmsQueueEvents['on'](_0x58f8e8,_0x21de87);}}; \ No newline at end of file +var _0x0ef1=['length','./smsQueue.events','save','remove','update','removeListener'];(function(_0x59349b,_0x299c19){var _0x3a6cd5=function(_0x31ae50){while(--_0x31ae50){_0x59349b['push'](_0x59349b['shift']());}};_0x3a6cd5(++_0x299c19);}(_0x0ef1,0x1a5));var _0x10ef=function(_0x518b7d,_0x27385e){_0x518b7d=_0x518b7d-0x0;var _0x5cc3d5=_0x0ef1[_0x518b7d];return _0x5cc3d5;};'use strict';var SmsQueueEvents=require(_0x10ef('0x0'));var events=[_0x10ef('0x1'),_0x10ef('0x2'),_0x10ef('0x3')];function createListener(_0x18a921,_0x4c8d62){return function(_0x15e3f1){_0x4c8d62['emit'](_0x18a921,_0x15e3f1);};}function removeListener(_0x4d5542,_0x21c4d2){return function(){SmsQueueEvents[_0x10ef('0x4')](_0x4d5542,_0x21c4d2);};}exports['register']=function(_0x1ffee0){for(var _0x273a9a=0x0,_0x8bd64b=events[_0x10ef('0x5')];_0x273a9a<_0x8bd64b;_0x273a9a++){var _0x3fc55f=events[_0x273a9a];var _0x255474=createListener('smsQueue:'+_0x3fc55f,_0x1ffee0);SmsQueueEvents['on'](_0x3fc55f,_0x255474);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 0142734..6dcd0d2 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 _0xd223=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports'];(function(_0x5e094f,_0x2d70f0){var _0x3949d9=function(_0x490726){while(--_0x490726){_0x5e094f['push'](_0x5e094f['shift']());}};_0x3949d9(++_0x2d70f0);}(_0xd223,0x10e));var _0x3d22=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0xd223[_0x1fb1c1];return _0x1622df;};'use strict';var multer=require(_0x3d22('0x0'));var util=require(_0x3d22('0x1'));var path=require(_0x3d22('0x2'));var timeout=require(_0x3d22('0x3'));var express=require('express');var router=express[_0x3d22('0x4')]();var fs_extra=require(_0x3d22('0x5'));var auth=require(_0x3d22('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d22('0x7'));var controller=require('./smsQueueReport.controller');router[_0x3d22('0x8')]('/',auth[_0x3d22('0x9')](),controller[_0x3d22('0xa')]);router['get']('/describe',auth[_0x3d22('0x9')](),controller['describe']);router['get'](_0x3d22('0xb'),auth[_0x3d22('0x9')](),controller[_0x3d22('0xc')]);router[_0x3d22('0xd')]('/',auth[_0x3d22('0x9')](),controller[_0x3d22('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3d22('0xf')](_0x3d22('0xb'),auth[_0x3d22('0x9')](),controller[_0x3d22('0x10')]);module[_0x3d22('0x11')]=router; \ No newline at end of file +var _0x1d55=['post','create','put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x5d6794,_0x18936a){var _0x2d4866=function(_0x46283f){while(--_0x46283f){_0x5d6794['push'](_0x5d6794['shift']());}};_0x2d4866(++_0x18936a);}(_0x1d55,0x78));var _0x51d5=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x1d55[_0x2d2ca2];return _0x48489d;};'use strict';var multer=require(_0x51d5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x51d5('0x1'));var router=express[_0x51d5('0x2')]();var fs_extra=require(_0x51d5('0x3'));var auth=require(_0x51d5('0x4'));var interaction=require(_0x51d5('0x5'));var config=require(_0x51d5('0x6'));var controller=require(_0x51d5('0x7'));router[_0x51d5('0x8')]('/',auth[_0x51d5('0x9')](),controller['index']);router['get'](_0x51d5('0xa'),auth[_0x51d5('0x9')](),controller[_0x51d5('0xb')]);router[_0x51d5('0x8')](_0x51d5('0xc'),auth[_0x51d5('0x9')](),controller['show']);router[_0x51d5('0xd')]('/',auth[_0x51d5('0x9')](),controller[_0x51d5('0xe')]);router[_0x51d5('0xf')](_0x51d5('0xc'),auth[_0x51d5('0x9')](),controller['update']);router[_0x51d5('0x10')](_0x51d5('0xc'),auth['isAuthenticated'](),controller[_0x51d5('0x11')]);module[_0x51d5('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 4b3ef9d..beda4d2 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 _0xfb58=['STRING','DATE','moment','sequelize','exports'];(function(_0x18b637,_0x5be24d){var _0x354352=function(_0x16ac68){while(--_0x16ac68){_0x18b637['push'](_0x18b637['shift']());}};_0x354352(++_0x5be24d);}(_0xfb58,0x160));var _0x8fb5=function(_0x556642,_0x4b48a6){_0x556642=_0x556642-0x0;var _0x469db1=_0xfb58[_0x556642];return _0x469db1;};'use strict';var moment=require(_0x8fb5('0x0'));var Sequelize=require(_0x8fb5('0x1'));module[_0x8fb5('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8fb5('0x3')]},'joinAt':{'type':Sequelize[_0x8fb5('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8fb5('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8fb5('0x3')]}}; \ No newline at end of file +var _0x1426=['DATE','exports','STRING'];(function(_0x5ee9c0,_0x622fe0){var _0x43aa29=function(_0x5cd079){while(--_0x5cd079){_0x5ee9c0['push'](_0x5ee9c0['shift']());}};_0x43aa29(++_0x622fe0);}(_0x1426,0xeb));var _0x6142=function(_0x5cd353,_0x5aada3){_0x5cd353=_0x5cd353-0x0;var _0x25cba8=_0x1426[_0x5cd353];return _0x25cba8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x6142('0x0')]={'uniqueid':{'type':Sequelize[_0x6142('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x6142('0x1')]},'joinAt':{'type':Sequelize[_0x6142('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6142('0x2')]},'exitAt':{'type':Sequelize[_0x6142('0x2')]},'reason':{'type':Sequelize[_0x6142('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 8ec4d2c..7504566 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 _0xc81c=['nolimit','order','sort','where','pick','merge','VIRTUAL','options','then','include','findAll','catch','show','params','length','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xc81c,0xee));var _0xcc81=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xc81c[_0x565c49];return _0x20ca34;};'use strict';var pdf=require(_0xcc81('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcc81('0x1'));var jsonpatch=require(_0xcc81('0x2'));var rp=require(_0xcc81('0x3'));var moment=require(_0xcc81('0x4'));var BPromise=require(_0xcc81('0x5'));var Mustache=require(_0xcc81('0x6'));var util=require(_0xcc81('0x7'));var path=require(_0xcc81('0x8'));var sox=require(_0xcc81('0x9'));var csv=require(_0xcc81('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc81('0xb'));var _=require(_0xcc81('0xc'));var squel=require('squel');var crypto=require(_0xcc81('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcc81('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc81('0xf'));var Redis=require(_0xcc81('0x10'));var authService=require(_0xcc81('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcc81('0x12'));var hardwareService=require(_0xcc81('0x13'));var logger=require(_0xcc81('0x14'))(_0xcc81('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc81('0x16'));var db=require(_0xcc81('0x17'))['db'];function respondWithStatusCode(_0x1e8653,_0x266296){_0x266296=_0x266296||0xcc;return function(_0x5c8897){if(_0x5c8897){return _0x1e8653['sendStatus'](_0x266296);}return _0x1e8653[_0xcc81('0x18')](_0x266296)[_0xcc81('0x19')]();};}function respondWithResult(_0x2aff4c,_0x19976f){_0x19976f=_0x19976f||0xc8;return function(_0xae18b9){if(_0xae18b9){return _0x2aff4c[_0xcc81('0x18')](_0x19976f)[_0xcc81('0x1a')](_0xae18b9);}};}function respondWithFilteredResult(_0x3bd089,_0x2b857e){return function(_0x4396d8){if(_0x4396d8){var _0x1f3339=_0x4396d8[_0xcc81('0x1b')],_0x1be796=_0x2b857e['offset'],_0x4a5f8a=_0x2b857e[_0xcc81('0x1c')]+_0x2b857e[_0xcc81('0x1d')],_0x5e8d76;if(_0x4a5f8a>=_0x1f3339){_0x4a5f8a=_0x1f3339;_0x5e8d76=0xc8;}else{_0x5e8d76=0xce;}_0x3bd089[_0xcc81('0x18')](_0x5e8d76);return _0x3bd089[_0xcc81('0x1e')](_0xcc81('0x1f'),_0x1be796+'-'+_0x4a5f8a+'/'+_0x1f3339)['json'](_0x4396d8);}return null;};}function patchUpdates(_0x43019c){return function(_0xf535d8){try{jsonpatch[_0xcc81('0x20')](_0xf535d8,_0x43019c,!![]);}catch(_0x11d315){return BPromise[_0xcc81('0x21')](_0x11d315);}return _0xf535d8[_0xcc81('0x22')]();};}function saveUpdates(_0x1cc199,_0x596aa7){return function(_0x15bc4d){if(_0x15bc4d){return _0x15bc4d['update'](_0x1cc199)['then'](function(_0x5b1d76){return _0x5b1d76;});}return null;};}function removeEntity(_0x54fc77,_0x1fe118){return function(_0x14b8e6){if(_0x14b8e6){return _0x14b8e6[_0xcc81('0x23')]()['then'](function(){_0x54fc77[_0xcc81('0x18')](0xcc)[_0xcc81('0x19')]();});}};}function handleEntityNotFound(_0x2dd6e0,_0x4cdcee){return function(_0x57c930){if(!_0x57c930){_0x2dd6e0['sendStatus'](0x194);}return _0x57c930;};}function handleError(_0x103b51,_0x361f4e){_0x361f4e=_0x361f4e||0x1f4;return function(_0x5ea2ea){logger[_0xcc81('0x24')](_0x5ea2ea[_0xcc81('0x25')]);if(_0x5ea2ea[_0xcc81('0x26')]){delete _0x5ea2ea['name'];}_0x103b51[_0xcc81('0x18')](_0x361f4e)[_0xcc81('0x27')](_0x5ea2ea);};}exports[_0xcc81('0x28')]=function(_0x1e6a80,_0x2cfa44){var _0x1df1d1={},_0x301972={},_0x474041={'count':0x0,'rows':[]};var _0x41f59d=_[_0xcc81('0x29')](db[_0xcc81('0x2a')][_0xcc81('0x2b')],function(_0x58102d){return{'name':_0x58102d[_0xcc81('0x2c')],'type':_0x58102d[_0xcc81('0x2d')][_0xcc81('0x2e')]};});_0x301972['model']=_[_0xcc81('0x29')](_0x41f59d,_0xcc81('0x26'));_0x301972[_0xcc81('0x2f')]=_[_0xcc81('0x30')](_0x1e6a80['query']);_0x301972[_0xcc81('0x31')]=_[_0xcc81('0x32')](_0x301972[_0xcc81('0x33')],_0x301972[_0xcc81('0x2f')]);_0x1df1d1[_0xcc81('0x34')]=_['intersection'](_0x301972['model'],qs[_0xcc81('0x35')](_0x1e6a80['query'][_0xcc81('0x35')]));_0x1df1d1[_0xcc81('0x34')]=_0x1df1d1[_0xcc81('0x34')]['length']?_0x1df1d1[_0xcc81('0x34')]:_0x301972[_0xcc81('0x33')];if(!_0x1e6a80[_0xcc81('0x2f')]['hasOwnProperty'](_0xcc81('0x36'))){_0x1df1d1['limit']=qs[_0xcc81('0x1d')](_0x1e6a80['query'][_0xcc81('0x1d')]);_0x1df1d1[_0xcc81('0x1c')]=qs['offset'](_0x1e6a80[_0xcc81('0x2f')]['offset']);}_0x1df1d1[_0xcc81('0x37')]=qs[_0xcc81('0x38')](_0x1e6a80['query']['sort']);_0x1df1d1[_0xcc81('0x39')]=qs[_0xcc81('0x31')](_[_0xcc81('0x3a')](_0x1e6a80[_0xcc81('0x2f')],_0x301972['filters']),_0x41f59d);if(_0x1e6a80['query']['filter']){_0x1df1d1[_0xcc81('0x39')]=_[_0xcc81('0x3b')](_0x1df1d1[_0xcc81('0x39')],{'$or':_[_0xcc81('0x29')](_0x41f59d,function(_0x4a80ae){if(_0x4a80ae[_0xcc81('0x2d')]!==_0xcc81('0x3c')){var _0x1a6060={};_0x1a6060[_0x4a80ae[_0xcc81('0x26')]]={'$like':'%'+_0x1e6a80['query']['filter']+'%'};return _0x1a6060;}})});}_0x1df1d1=_[_0xcc81('0x3b')]({},_0x1df1d1,_0x1e6a80[_0xcc81('0x3d')]);var _0x41de7b={'where':_0x1df1d1[_0xcc81('0x39')]};return db[_0xcc81('0x2a')][_0xcc81('0x1b')](_0x41de7b)[_0xcc81('0x3e')](function(_0x38e1ff){_0x474041[_0xcc81('0x1b')]=_0x38e1ff;if(_0x1e6a80['query']['includeAll']){_0x1df1d1[_0xcc81('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xcc81('0x40')](_0x1df1d1);})['then'](function(_0x4573f4){_0x474041['rows']=_0x4573f4;return _0x474041;})[_0xcc81('0x3e')](respondWithFilteredResult(_0x2cfa44,_0x1df1d1))[_0xcc81('0x41')](handleError(_0x2cfa44,null));};exports[_0xcc81('0x42')]=function(_0x4e5dc3,_0x2ad878){var _0x408034={'raw':!![],'where':{'id':_0x4e5dc3[_0xcc81('0x43')]['id']}},_0x44b629={};_0x44b629[_0xcc81('0x33')]=_[_0xcc81('0x30')](db[_0xcc81('0x2a')]['rawAttributes']);_0x44b629['query']=_[_0xcc81('0x30')](_0x4e5dc3[_0xcc81('0x2f')]);_0x44b629['filters']=_[_0xcc81('0x32')](_0x44b629[_0xcc81('0x33')],_0x44b629[_0xcc81('0x2f')]);_0x408034[_0xcc81('0x34')]=_['intersection'](_0x44b629[_0xcc81('0x33')],qs[_0xcc81('0x35')](_0x4e5dc3[_0xcc81('0x2f')][_0xcc81('0x35')]));_0x408034[_0xcc81('0x34')]=_0x408034[_0xcc81('0x34')][_0xcc81('0x44')]?_0x408034[_0xcc81('0x34')]:_0x44b629[_0xcc81('0x33')];if(_0x4e5dc3[_0xcc81('0x2f')]['includeAll']){_0x408034['include']=[{'all':!![]}];}_0x408034=_[_0xcc81('0x3b')]({},_0x408034,_0x4e5dc3[_0xcc81('0x3d')]);return db['SmsQueueReport'][_0xcc81('0x45')](_0x408034)['then'](handleEntityNotFound(_0x2ad878,null))[_0xcc81('0x3e')](respondWithResult(_0x2ad878,null))[_0xcc81('0x41')](handleError(_0x2ad878,null));};exports[_0xcc81('0x46')]=function(_0xd7d7a3,_0x1fc4f4){return db[_0xcc81('0x2a')][_0xcc81('0x46')](_0xd7d7a3[_0xcc81('0x47')],{})[_0xcc81('0x3e')](respondWithResult(_0x1fc4f4,0xc9))['catch'](handleError(_0x1fc4f4,null));};exports['update']=function(_0x250fd4,_0x1e9484){if(_0x250fd4['body']['id']){delete _0x250fd4[_0xcc81('0x47')]['id'];}return db['SmsQueueReport'][_0xcc81('0x45')]({'where':{'id':_0x250fd4[_0xcc81('0x43')]['id']}})[_0xcc81('0x3e')](handleEntityNotFound(_0x1e9484,null))['then'](saveUpdates(_0x250fd4[_0xcc81('0x47')],null))[_0xcc81('0x3e')](respondWithResult(_0x1e9484,null))[_0xcc81('0x41')](handleError(_0x1e9484,null));};exports[_0xcc81('0x23')]=function(_0x182fe7,_0x145612){return db[_0xcc81('0x2a')]['find']({'where':{'id':_0x182fe7[_0xcc81('0x43')]['id']}})['then'](handleEntityNotFound(_0x145612,null))[_0xcc81('0x3e')](removeEntity(_0x145612,null))[_0xcc81('0x41')](handleError(_0x145612,null));};exports[_0xcc81('0x48')]=function(_0x35218d,_0x379277){return db[_0xcc81('0x2a')][_0xcc81('0x48')]()['then'](respondWithResult(_0x379277,null))[_0xcc81('0x41')](handleError(_0x379277,null));}; \ No newline at end of file +var _0x43b6=['attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','keys','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','query','filters','intersection','fields'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x43b6,0x148));var _0x643b=function(_0x1591a0,_0x110161){_0x1591a0=_0x1591a0-0x0;var _0x16590b=_0x43b6[_0x1591a0];return _0x16590b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x643b('0x0'));var rimraf=require(_0x643b('0x1'));var zipdir=require(_0x643b('0x2'));var jsonpatch=require(_0x643b('0x3'));var rp=require(_0x643b('0x4'));var moment=require('moment');var BPromise=require(_0x643b('0x5'));var Mustache=require(_0x643b('0x6'));var util=require(_0x643b('0x7'));var path=require(_0x643b('0x8'));var sox=require(_0x643b('0x9'));var csv=require(_0x643b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x643b('0xb'));var _=require(_0x643b('0xc'));var squel=require('squel');var crypto=require(_0x643b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x643b('0xa'));var querystring=require(_0x643b('0xe'));var Papa=require(_0x643b('0xf'));var Redis=require(_0x643b('0x10'));var authService=require(_0x643b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x643b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x643b('0x13'));var utils=require('../../config/utils');var config=require(_0x643b('0x14'));var licenseUtil=require(_0x643b('0x15'));var db=require(_0x643b('0x16'))['db'];function respondWithStatusCode(_0x48f8a6,_0x40dbf2){_0x40dbf2=_0x40dbf2||0xcc;return function(_0x4c2775){if(_0x4c2775){return _0x48f8a6[_0x643b('0x17')](_0x40dbf2);}return _0x48f8a6[_0x643b('0x18')](_0x40dbf2)[_0x643b('0x19')]();};}function respondWithResult(_0x48f0a4,_0x5226be){_0x5226be=_0x5226be||0xc8;return function(_0x18b897){if(_0x18b897){return _0x48f0a4['status'](_0x5226be)['json'](_0x18b897);}};}function respondWithFilteredResult(_0x42f02e,_0x167ec7){return function(_0x1225b1){if(_0x1225b1){var _0x3d7acc=_0x1225b1[_0x643b('0x1a')],_0x29a818=_0x167ec7['offset'],_0x34035b=_0x167ec7['offset']+_0x167ec7[_0x643b('0x1b')],_0x5b13d5;if(_0x34035b>=_0x3d7acc){_0x34035b=_0x3d7acc;_0x5b13d5=0xc8;}else{_0x5b13d5=0xce;}_0x42f02e['status'](_0x5b13d5);return _0x42f02e[_0x643b('0x1c')](_0x643b('0x1d'),_0x29a818+'-'+_0x34035b+'/'+_0x3d7acc)[_0x643b('0x1e')](_0x1225b1);}return null;};}function patchUpdates(_0x513676){return function(_0x279fa3){try{jsonpatch[_0x643b('0x1f')](_0x279fa3,_0x513676,!![]);}catch(_0x2b6e98){return BPromise[_0x643b('0x20')](_0x2b6e98);}return _0x279fa3[_0x643b('0x21')]();};}function saveUpdates(_0x52ca6e,_0x3a998d){return function(_0x5f3c77){if(_0x5f3c77){return _0x5f3c77[_0x643b('0x22')](_0x52ca6e)[_0x643b('0x23')](function(_0x29c16b){return _0x29c16b;});}return null;};}function removeEntity(_0x11a9c6,_0x18bd59){return function(_0x4f90a1){if(_0x4f90a1){return _0x4f90a1[_0x643b('0x24')]()[_0x643b('0x23')](function(){_0x11a9c6['status'](0xcc)[_0x643b('0x19')]();});}};}function handleEntityNotFound(_0x47116a,_0x512a23){return function(_0x1a93fb){if(!_0x1a93fb){_0x47116a[_0x643b('0x17')](0x194);}return _0x1a93fb;};}function handleError(_0x255b25,_0x4e3664){_0x4e3664=_0x4e3664||0x1f4;return function(_0xa9c224){logger[_0x643b('0x25')](_0xa9c224[_0x643b('0x26')]);if(_0xa9c224[_0x643b('0x27')]){delete _0xa9c224[_0x643b('0x27')];}_0x255b25['status'](_0x4e3664)[_0x643b('0x28')](_0xa9c224);};}exports[_0x643b('0x29')]=function(_0x323ed9,_0x37eb75){var _0x11dc6c={},_0x10419a={},_0x56b520={'count':0x0,'rows':[]};var _0x47ecaf=_[_0x643b('0x2a')](db[_0x643b('0x2b')][_0x643b('0x2c')],function(_0x25991e){return{'name':_0x25991e['fieldName'],'type':_0x25991e[_0x643b('0x2d')][_0x643b('0x2e')]};});_0x10419a[_0x643b('0x2f')]=_[_0x643b('0x2a')](_0x47ecaf,_0x643b('0x27'));_0x10419a[_0x643b('0x30')]=_['keys'](_0x323ed9['query']);_0x10419a[_0x643b('0x31')]=_[_0x643b('0x32')](_0x10419a[_0x643b('0x2f')],_0x10419a[_0x643b('0x30')]);_0x11dc6c['attributes']=_[_0x643b('0x32')](_0x10419a['model'],qs[_0x643b('0x33')](_0x323ed9[_0x643b('0x30')][_0x643b('0x33')]));_0x11dc6c['attributes']=_0x11dc6c[_0x643b('0x34')][_0x643b('0x35')]?_0x11dc6c[_0x643b('0x34')]:_0x10419a['model'];if(!_0x323ed9[_0x643b('0x30')][_0x643b('0x36')](_0x643b('0x37'))){_0x11dc6c[_0x643b('0x1b')]=qs[_0x643b('0x1b')](_0x323ed9['query'][_0x643b('0x1b')]);_0x11dc6c[_0x643b('0x38')]=qs['offset'](_0x323ed9[_0x643b('0x30')][_0x643b('0x38')]);}_0x11dc6c[_0x643b('0x39')]=qs[_0x643b('0x3a')](_0x323ed9[_0x643b('0x30')][_0x643b('0x3a')]);_0x11dc6c[_0x643b('0x3b')]=qs[_0x643b('0x31')](_[_0x643b('0x3c')](_0x323ed9['query'],_0x10419a[_0x643b('0x31')]),_0x47ecaf);if(_0x323ed9['query'][_0x643b('0x3d')]){_0x11dc6c[_0x643b('0x3b')]=_[_0x643b('0x3e')](_0x11dc6c[_0x643b('0x3b')],{'$or':_[_0x643b('0x2a')](_0x47ecaf,function(_0x371df2){if(_0x371df2[_0x643b('0x2d')]!==_0x643b('0x3f')){var _0x3eb41b={};_0x3eb41b[_0x371df2['name']]={'$like':'%'+_0x323ed9[_0x643b('0x30')]['filter']+'%'};return _0x3eb41b;}})});}_0x11dc6c=_['merge']({},_0x11dc6c,_0x323ed9[_0x643b('0x40')]);var _0x246702={'where':_0x11dc6c['where']};return db[_0x643b('0x2b')]['count'](_0x246702)[_0x643b('0x23')](function(_0x576931){_0x56b520[_0x643b('0x1a')]=_0x576931;if(_0x323ed9[_0x643b('0x30')]['includeAll']){_0x11dc6c['include']=[{'all':!![]}];}return db[_0x643b('0x2b')]['findAll'](_0x11dc6c);})[_0x643b('0x23')](function(_0x4664f2){_0x56b520[_0x643b('0x41')]=_0x4664f2;return _0x56b520;})[_0x643b('0x23')](respondWithFilteredResult(_0x37eb75,_0x11dc6c))[_0x643b('0x42')](handleError(_0x37eb75,null));};exports[_0x643b('0x43')]=function(_0x134dcd,_0x35c5d7){var _0x20e395={'raw':!![],'where':{'id':_0x134dcd['params']['id']}},_0x4c7e4b={};_0x4c7e4b[_0x643b('0x2f')]=_['keys'](db[_0x643b('0x2b')][_0x643b('0x2c')]);_0x4c7e4b['query']=_[_0x643b('0x44')](_0x134dcd[_0x643b('0x30')]);_0x4c7e4b[_0x643b('0x31')]=_[_0x643b('0x32')](_0x4c7e4b[_0x643b('0x2f')],_0x4c7e4b[_0x643b('0x30')]);_0x20e395[_0x643b('0x34')]=_[_0x643b('0x32')](_0x4c7e4b[_0x643b('0x2f')],qs[_0x643b('0x33')](_0x134dcd['query'][_0x643b('0x33')]));_0x20e395[_0x643b('0x34')]=_0x20e395['attributes'][_0x643b('0x35')]?_0x20e395['attributes']:_0x4c7e4b[_0x643b('0x2f')];if(_0x134dcd[_0x643b('0x30')][_0x643b('0x45')]){_0x20e395[_0x643b('0x46')]=[{'all':!![]}];}_0x20e395=_['merge']({},_0x20e395,_0x134dcd['options']);return db['SmsQueueReport'][_0x643b('0x47')](_0x20e395)[_0x643b('0x23')](handleEntityNotFound(_0x35c5d7,null))[_0x643b('0x23')](respondWithResult(_0x35c5d7,null))[_0x643b('0x42')](handleError(_0x35c5d7,null));};exports['create']=function(_0x5986fc,_0x1cc519){return db[_0x643b('0x2b')][_0x643b('0x48')](_0x5986fc[_0x643b('0x49')],{})['then'](respondWithResult(_0x1cc519,0xc9))[_0x643b('0x42')](handleError(_0x1cc519,null));};exports[_0x643b('0x22')]=function(_0x1cae5d,_0x37054e){if(_0x1cae5d['body']['id']){delete _0x1cae5d[_0x643b('0x49')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x1cae5d[_0x643b('0x4a')]['id']}})[_0x643b('0x23')](handleEntityNotFound(_0x37054e,null))[_0x643b('0x23')](saveUpdates(_0x1cae5d[_0x643b('0x49')],null))[_0x643b('0x23')](respondWithResult(_0x37054e,null))[_0x643b('0x42')](handleError(_0x37054e,null));};exports[_0x643b('0x24')]=function(_0x56a82e,_0x1e6aca){return db[_0x643b('0x2b')]['find']({'where':{'id':_0x56a82e[_0x643b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e6aca,null))['then'](removeEntity(_0x1e6aca,null))[_0x643b('0x42')](handleError(_0x1e6aca,null));};exports[_0x643b('0x4b')]=function(_0xca2d6f,_0x2665f5){return db[_0x643b('0x2b')][_0x643b('0x4b')]()[_0x643b('0x23')](respondWithResult(_0x2665f5,null))['catch'](handleError(_0x2665f5,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 64e327b..359caf9 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 _0x2e31=['rimraf','../../config/environment','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x2e31,0x145));var _0x12e3=function(_0x4e107a,_0x171cac){_0x4e107a=_0x4e107a-0x0;var _0x27f433=_0x2e31[_0x4e107a];return _0x27f433;};'use strict';var _=require(_0x12e3('0x0'));var util=require(_0x12e3('0x1'));var logger=require(_0x12e3('0x2'))('api');var moment=require(_0x12e3('0x3'));var BPromise=require(_0x12e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x12e3('0x5'));var config=require(_0x12e3('0x6'));var attributes=require(_0x12e3('0x7'));module['exports']=function(_0x3173f9,_0x16ed6b){return _0x3173f9['define']('SmsQueueReport',attributes,{'tableName':_0x12e3('0x8'),'paranoid':![],'indexes':[{'name':_0x12e3('0x9'),'fields':[_0x12e3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x795a=['uniqueid','lodash','util','api','moment','request-promise','path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue'];(function(_0x3f8590,_0xb7631b){var _0x2064c5=function(_0x517fb3){while(--_0x517fb3){_0x3f8590['push'](_0x3f8590['shift']());}};_0x2064c5(++_0xb7631b);}(_0x795a,0x79));var _0xa795=function(_0x3105fe,_0x1e098a){_0x3105fe=_0x3105fe-0x0;var _0x3cd82f=_0x795a[_0x3105fe];return _0x3cd82f;};'use strict';var _=require(_0xa795('0x0'));var util=require(_0xa795('0x1'));var logger=require('../../config/logger')(_0xa795('0x2'));var moment=require(_0xa795('0x3'));var BPromise=require('bluebird');var rp=require(_0xa795('0x4'));var fs=require('fs');var path=require(_0xa795('0x5'));var rimraf=require(_0xa795('0x6'));var config=require('../../config/environment');var attributes=require(_0xa795('0x7'));module[_0xa795('0x8')]=function(_0x53c75f,_0x243b17){return _0x53c75f[_0xa795('0x9')]('SmsQueueReport',attributes,{'tableName':_0xa795('0xa'),'paranoid':![],'indexes':[{'name':_0xa795('0xb'),'fields':[_0xa795('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 fe44557..84e13d0 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 _0xe689=['moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util'];(function(_0x4ea4b4,_0x43a469){var _0x3dd444=function(_0x4ad7c7){while(--_0x4ad7c7){_0x4ea4b4['push'](_0x4ea4b4['shift']());}};_0x3dd444(++_0x43a469);}(_0xe689,0x174));var _0x9e68=function(_0x38604b,_0x385759){_0x38604b=_0x38604b-0x0;var _0x477d21=_0xe689[_0x38604b];return _0x477d21;};'use strict';var _=require(_0x9e68('0x0'));var util=require(_0x9e68('0x1'));var moment=require(_0x9e68('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e68('0x3'));var fs=require('fs');var Redis=require(_0x9e68('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e68('0x5'))(_0x9e68('0x6'));var config=require(_0x9e68('0x7'));var jayson=require(_0x9e68('0x8'));var client=jayson['client'][_0x9e68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x533cd5,_0x254924,_0x2cee57){return new BPromise(function(_0x5586ac,_0x4bcf30){return client[_0x9e68('0xa')](_0x533cd5,_0x2cee57)[_0x9e68('0xb')](function(_0x571c29){logger[_0x9e68('0xc')](_0x9e68('0xd'),_0x254924,'request\x20sent');logger['debug'](_0x9e68('0xe'),_0x254924,_0x9e68('0xf'),JSON[_0x9e68('0x10')](_0x571c29));if(_0x571c29[_0x9e68('0x11')]){if(_0x571c29[_0x9e68('0x11')][_0x9e68('0x12')]===0x1f4){logger[_0x9e68('0x11')](_0x9e68('0xd'),_0x254924,_0x571c29[_0x9e68('0x11')][_0x9e68('0x13')]);return _0x4bcf30(_0x571c29[_0x9e68('0x11')][_0x9e68('0x13')]);}logger[_0x9e68('0x11')](_0x9e68('0xd'),_0x254924,_0x571c29[_0x9e68('0x11')][_0x9e68('0x13')]);return _0x5586ac(_0x571c29[_0x9e68('0x11')][_0x9e68('0x13')]);}else{logger[_0x9e68('0xc')](_0x9e68('0xd'),_0x254924,_0x9e68('0xf'));_0x5586ac(_0x571c29[_0x9e68('0x14')][_0x9e68('0x13')]);}})[_0x9e68('0x15')](function(_0x455988){logger[_0x9e68('0x11')](_0x9e68('0xd'),_0x254924,_0x455988);_0x4bcf30(_0x455988);});});}exports[_0x9e68('0x16')]=function(_0x1e25eb){var _0x5b85e6=this;return new Promise(function(_0x35de2a,_0x5cfe44){return db[_0x9e68('0x17')][_0x9e68('0x18')](_0x1e25eb[_0x9e68('0x19')],{'raw':_0x1e25eb[_0x9e68('0x1a')]?_0x1e25eb[_0x9e68('0x1a')][_0x9e68('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x580c8f){logger[_0x9e68('0xc')](_0x9e68('0x16'),_0x1e25eb);logger[_0x9e68('0x1c')](_0x9e68('0x16'),_0x1e25eb,JSON[_0x9e68('0x10')](_0x580c8f));_0x35de2a(_0x580c8f);})[_0x9e68('0x15')](function(_0x316f55){logger[_0x9e68('0x11')]('CreateSmsQueueReport',_0x316f55['message'],_0x1e25eb);_0x5cfe44(_0x5b85e6[_0x9e68('0x11')](0x1f4,_0x316f55['message']));});});};exports[_0x9e68('0x1d')]=function(_0x4e5d2e){var _0x18df8a=this;return new Promise(function(_0x3c46c4,_0x3d474d){return db[_0x9e68('0x17')][_0x9e68('0x1e')](_0x4e5d2e['body'],{'raw':_0x4e5d2e['options']?_0x4e5d2e[_0x9e68('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5d2e[_0x9e68('0x1a')]?_0x4e5d2e[_0x9e68('0x1a')][_0x9e68('0x1f')]||null:null,'attributes':_0x4e5d2e[_0x9e68('0x1a')]?_0x4e5d2e[_0x9e68('0x1a')][_0x9e68('0x20')]||null:null,'limit':_0x4e5d2e[_0x9e68('0x1a')]?_0x4e5d2e['options'][_0x9e68('0x21')]||null:null})[_0x9e68('0xb')](function(_0xd74002){logger[_0x9e68('0xc')](_0x9e68('0x1d'),_0x4e5d2e);logger[_0x9e68('0x1c')]('UpdateSmsQueueReport',_0x4e5d2e,JSON[_0x9e68('0x10')](_0xd74002));_0x3c46c4(_0xd74002);})[_0x9e68('0x15')](function(_0x391c7c){logger['error']('UpdateSmsQueueReport',_0x391c7c[_0x9e68('0x13')],_0x4e5d2e);_0x3d474d(_0x18df8a[_0x9e68('0x11')](0x1f4,_0x391c7c[_0x9e68('0x13')]));});});}; \ No newline at end of file +var _0x9a00=['then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport','body','where','attributes','UpdateSmsQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9a00,0x113));var _0x09a0=function(_0x2acacb,_0x4836f2){_0x2acacb=_0x2acacb-0x0;var _0x146500=_0x9a00[_0x2acacb];return _0x146500;};'use strict';var _=require('lodash');var util=require(_0x09a0('0x0'));var moment=require(_0x09a0('0x1'));var BPromise=require(_0x09a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09a0('0x3'));var db=require(_0x09a0('0x4'))['db'];var utils=require(_0x09a0('0x5'));var logger=require(_0x09a0('0x6'))(_0x09a0('0x7'));var config=require(_0x09a0('0x8'));var jayson=require(_0x09a0('0x9'));var client=jayson[_0x09a0('0xa')][_0x09a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ea74e,_0x1bf276,_0x177dd7){return new BPromise(function(_0x1a69e5,_0x212bcb){return client[_0x09a0('0xc')](_0x1ea74e,_0x177dd7)[_0x09a0('0xd')](function(_0x59d75d){logger[_0x09a0('0xe')](_0x09a0('0xf'),_0x1bf276,_0x09a0('0x10'));logger[_0x09a0('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1bf276,_0x09a0('0x10'),JSON[_0x09a0('0x12')](_0x59d75d));if(_0x59d75d[_0x09a0('0x13')]){if(_0x59d75d[_0x09a0('0x13')]['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1bf276,_0x59d75d[_0x09a0('0x13')][_0x09a0('0x14')]);return _0x212bcb(_0x59d75d['error'][_0x09a0('0x14')]);}logger[_0x09a0('0x13')](_0x09a0('0xf'),_0x1bf276,_0x59d75d[_0x09a0('0x13')][_0x09a0('0x14')]);return _0x1a69e5(_0x59d75d['error'][_0x09a0('0x14')]);}else{logger[_0x09a0('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x1bf276,_0x09a0('0x10'));_0x1a69e5(_0x59d75d[_0x09a0('0x15')]['message']);}})[_0x09a0('0x16')](function(_0x22558d){logger[_0x09a0('0x13')](_0x09a0('0xf'),_0x1bf276,_0x22558d);_0x212bcb(_0x22558d);});});}exports['CreateSmsQueueReport']=function(_0x177ff7){var _0x1e4d33=this;return new Promise(function(_0x1d9b53,_0x5cf34e){return db[_0x09a0('0x17')][_0x09a0('0x18')](_0x177ff7['body'],{'raw':_0x177ff7['options']?_0x177ff7[_0x09a0('0x19')][_0x09a0('0x1a')]===undefined?!![]:![]:!![]})[_0x09a0('0xd')](function(_0x13e4c7){logger['info'](_0x09a0('0x1b'),_0x177ff7);logger[_0x09a0('0x11')](_0x09a0('0x1b'),_0x177ff7,JSON[_0x09a0('0x12')](_0x13e4c7));_0x1d9b53(_0x13e4c7);})[_0x09a0('0x16')](function(_0xa9b4be){logger[_0x09a0('0x13')](_0x09a0('0x1b'),_0xa9b4be[_0x09a0('0x14')],_0x177ff7);_0x5cf34e(_0x1e4d33['error'](0x1f4,_0xa9b4be[_0x09a0('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x5e3c49){var _0x3e134b=this;return new Promise(function(_0xc0dfc2,_0x26a4c4){return db[_0x09a0('0x17')]['update'](_0x5e3c49[_0x09a0('0x1c')],{'raw':_0x5e3c49[_0x09a0('0x19')]?_0x5e3c49['options'][_0x09a0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3c49[_0x09a0('0x19')]?_0x5e3c49[_0x09a0('0x19')][_0x09a0('0x1d')]||null:null,'attributes':_0x5e3c49[_0x09a0('0x19')]?_0x5e3c49['options'][_0x09a0('0x1e')]||null:null,'limit':_0x5e3c49[_0x09a0('0x19')]?_0x5e3c49['options']['limit']||null:null})[_0x09a0('0xd')](function(_0x8ca2ef){logger[_0x09a0('0xe')](_0x09a0('0x1f'),_0x5e3c49);logger['debug'](_0x09a0('0x1f'),_0x5e3c49,JSON[_0x09a0('0x12')](_0x8ca2ef));_0xc0dfc2(_0x8ca2ef);})[_0x09a0('0x16')](function(_0x107ad7){logger['error']('UpdateSmsQueueReport',_0x107ad7[_0x09a0('0x14')],_0x5e3c49);_0x26a4c4(_0x3e134b['error'](0x1f4,_0x107ad7[_0x09a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2057a8b..59221f2 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 _0x5688=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','/:id','post','create','update','delete','multer','util','path','connect-timeout'];(function(_0x4e8d5a,_0x9f48f6){var _0x17e104=function(_0x253080){while(--_0x253080){_0x4e8d5a['push'](_0x4e8d5a['shift']());}};_0x17e104(++_0x9f48f6);}(_0x5688,0x7a));var _0x8568=function(_0x388caa,_0x7bc7b8){_0x388caa=_0x388caa-0x0;var _0x5ecbe6=_0x5688[_0x388caa];return _0x5ecbe6;};'use strict';var multer=require(_0x8568('0x0'));var util=require(_0x8568('0x1'));var path=require(_0x8568('0x2'));var timeout=require(_0x8568('0x3'));var express=require(_0x8568('0x4'));var router=express[_0x8568('0x5')]();var fs_extra=require(_0x8568('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8568('0x7'));var config=require(_0x8568('0x8'));var controller=require(_0x8568('0x9'));router[_0x8568('0xa')]('/',auth['isAuthenticated'](),controller[_0x8568('0xb')]);router['get']('/describe',auth[_0x8568('0xc')](),controller['describe']);router[_0x8568('0xa')](_0x8568('0xd'),auth[_0x8568('0xc')](),controller['show']);router[_0x8568('0xe')]('/',auth[_0x8568('0xc')](),controller[_0x8568('0xf')]);router['put'](_0x8568('0xd'),auth[_0x8568('0xc')](),controller[_0x8568('0x10')]);router[_0x8568('0x11')](_0x8568('0xd'),auth[_0x8568('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc38e=['multer','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x28c6c9,_0x3d21a5){var _0x3f46f2=function(_0x389a87){while(--_0x389a87){_0x28c6c9['push'](_0x28c6c9['shift']());}};_0x3f46f2(++_0x3d21a5);}(_0xc38e,0x1d0));var _0xec38=function(_0x3d229c,_0x1411ff){_0x3d229c=_0x3d229c-0x0;var _0x50e526=_0xc38e[_0x3d229c];return _0x50e526;};'use strict';var multer=require(_0xec38('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xec38('0x1'));var router=express[_0xec38('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec38('0x3'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0xec38('0x4')]('/',auth[_0xec38('0x5')](),controller[_0xec38('0x6')]);router[_0xec38('0x4')]('/describe',auth[_0xec38('0x5')](),controller['describe']);router[_0xec38('0x4')](_0xec38('0x7'),auth['isAuthenticated'](),controller[_0xec38('0x8')]);router[_0xec38('0x9')]('/',auth[_0xec38('0x5')](),controller[_0xec38('0xa')]);router[_0xec38('0xb')](_0xec38('0x7'),auth[_0xec38('0x5')](),controller[_0xec38('0xc')]);router[_0xec38('0xd')](_0xec38('0x7'),auth['isAuthenticated'](),controller[_0xec38('0xe')]);module[_0xec38('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2728b4c..7e2f54d 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 _0x7436=['STRING','account','agent','queue','DATE','NOW','sequelize','exports'];(function(_0x4f5fbc,_0x74cb4e){var _0x486e0e=function(_0x306829){while(--_0x306829){_0x4f5fbc['push'](_0x4f5fbc['shift']());}};_0x486e0e(++_0x74cb4e);}(_0x7436,0x146));var _0x6743=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x7436[_0x36ed48];return _0x51c63a;};'use strict';var moment=require('moment');var Sequelize=require(_0x6743('0x0'));module[_0x6743('0x1')]={'uniqueid':{'type':Sequelize[_0x6743('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6743('0x3'),_0x6743('0x4'),_0x6743('0x5')),'allowNull':![],'defaultValue':_0x6743('0x5')},'transferredAt':{'type':Sequelize[_0x6743('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x6743('0x7')]}}; \ No newline at end of file +var _0x6db4=['STRING','ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x6db4,0x1ce));var _0x46db=function(_0x4c1688,_0x189d4b){_0x4c1688=_0x4c1688-0x0;var _0x1fabd8=_0x6db4[_0x4c1688];return _0x1fabd8;};'use strict';var moment=require(_0x46db('0x0'));var Sequelize=require(_0x46db('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x46db('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x46db('0x3')]('account',_0x46db('0x4'),_0x46db('0x5')),'allowNull':![],'defaultValue':_0x46db('0x5')},'transferredAt':{'type':Sequelize[_0x46db('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x46db('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c3bfecc..ac2b89d 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 _0x032e=['sox','to-csv','ejs','fs-extra','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','end','json','offset','limit','set','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x2ec9b,_0x278c7f){var _0xabb054=function(_0x2cf83f){while(--_0x2cf83f){_0x2ec9b['push'](_0x2ec9b['shift']());}};_0xabb054(++_0x278c7f);}(_0x032e,0x124));var _0xe032=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x032e[_0x33032e];return _0x13316b;};'use strict';var pdf=require(_0xe032('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe032('0x1'));var zipdir=require(_0xe032('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var Mustache=require(_0xe032('0x5'));var util=require(_0xe032('0x6'));var path=require(_0xe032('0x7'));var sox=require(_0xe032('0x8'));var csv=require(_0xe032('0x9'));var ejs=require(_0xe032('0xa'));var fs=require('fs');var fs_extra=require(_0xe032('0xb'));var _=require(_0xe032('0xc'));var squel=require(_0xe032('0xd'));var crypto=require(_0xe032('0xe'));var jsforce=require(_0xe032('0xf'));var deskjs=require(_0xe032('0x10'));var toCsv=require(_0xe032('0x9'));var querystring=require(_0xe032('0x11'));var Papa=require(_0xe032('0x12'));var Redis=require(_0xe032('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe032('0x14'));var as=require(_0xe032('0x15'));var hardwareService=require(_0xe032('0x16'));var logger=require(_0xe032('0x17'))(_0xe032('0x18'));var utils=require(_0xe032('0x19'));var config=require(_0xe032('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe032('0x1b'))['db'];function respondWithStatusCode(_0x266d71,_0x28c2b6){_0x28c2b6=_0x28c2b6||0xcc;return function(_0x1a53ab){if(_0x1a53ab){return _0x266d71['sendStatus'](_0x28c2b6);}return _0x266d71[_0xe032('0x1c')](_0x28c2b6)[_0xe032('0x1d')]();};}function respondWithResult(_0x176547,_0x422e96){_0x422e96=_0x422e96||0xc8;return function(_0x17b3aa){if(_0x17b3aa){return _0x176547[_0xe032('0x1c')](_0x422e96)[_0xe032('0x1e')](_0x17b3aa);}};}function respondWithFilteredResult(_0x4da5b7,_0x231c35){return function(_0x749018){if(_0x749018){var _0x36fb7c=_0x749018['count'],_0x3b57d3=_0x231c35[_0xe032('0x1f')],_0x1938c4=_0x231c35[_0xe032('0x1f')]+_0x231c35[_0xe032('0x20')],_0x208b00;if(_0x1938c4>=_0x36fb7c){_0x1938c4=_0x36fb7c;_0x208b00=0xc8;}else{_0x208b00=0xce;}_0x4da5b7[_0xe032('0x1c')](_0x208b00);return _0x4da5b7[_0xe032('0x21')]('Content-Range',_0x3b57d3+'-'+_0x1938c4+'/'+_0x36fb7c)['json'](_0x749018);}return null;};}function patchUpdates(_0x484e6c){return function(_0x15475c){try{jsonpatch['apply'](_0x15475c,_0x484e6c,!![]);}catch(_0x46dc27){return BPromise[_0xe032('0x22')](_0x46dc27);}return _0x15475c[_0xe032('0x23')]();};}function saveUpdates(_0x2aa342,_0x288d91){return function(_0x256f71){if(_0x256f71){return _0x256f71[_0xe032('0x24')](_0x2aa342)['then'](function(_0x32f8b6){return _0x32f8b6;});}return null;};}function removeEntity(_0x866c81,_0x232e8f){return function(_0x2be433){if(_0x2be433){return _0x2be433[_0xe032('0x25')]()[_0xe032('0x26')](function(){_0x866c81[_0xe032('0x1c')](0xcc)[_0xe032('0x1d')]();});}};}function handleEntityNotFound(_0x499da5,_0x4f1aa3){return function(_0x4d8ded){if(!_0x4d8ded){_0x499da5[_0xe032('0x27')](0x194);}return _0x4d8ded;};}function handleError(_0x2568ce,_0x302559){_0x302559=_0x302559||0x1f4;return function(_0x2a56e5){logger[_0xe032('0x28')](_0x2a56e5[_0xe032('0x29')]);if(_0x2a56e5[_0xe032('0x2a')]){delete _0x2a56e5[_0xe032('0x2a')];}_0x2568ce[_0xe032('0x1c')](_0x302559)[_0xe032('0x2b')](_0x2a56e5);};}exports['index']=function(_0x189ed4,_0x1af097){var _0x3106aa={},_0x2a521b={},_0x5cc95d={'count':0x0,'rows':[]};var _0x5573e4=_[_0xe032('0x2c')](db[_0xe032('0x2d')][_0xe032('0x2e')],function(_0xae116e){return{'name':_0xae116e['fieldName'],'type':_0xae116e['type']['key']};});_0x2a521b[_0xe032('0x2f')]=_[_0xe032('0x2c')](_0x5573e4,_0xe032('0x2a'));_0x2a521b[_0xe032('0x30')]=_['keys'](_0x189ed4[_0xe032('0x30')]);_0x2a521b[_0xe032('0x31')]=_[_0xe032('0x32')](_0x2a521b[_0xe032('0x2f')],_0x2a521b[_0xe032('0x30')]);_0x3106aa['attributes']=_[_0xe032('0x32')](_0x2a521b[_0xe032('0x2f')],qs[_0xe032('0x33')](_0x189ed4[_0xe032('0x30')]['fields']));_0x3106aa[_0xe032('0x34')]=_0x3106aa['attributes'][_0xe032('0x35')]?_0x3106aa['attributes']:_0x2a521b[_0xe032('0x2f')];if(!_0x189ed4['query'][_0xe032('0x36')]('nolimit')){_0x3106aa[_0xe032('0x20')]=qs[_0xe032('0x20')](_0x189ed4['query'][_0xe032('0x20')]);_0x3106aa[_0xe032('0x1f')]=qs[_0xe032('0x1f')](_0x189ed4[_0xe032('0x30')]['offset']);}_0x3106aa[_0xe032('0x37')]=qs['sort'](_0x189ed4[_0xe032('0x30')][_0xe032('0x38')]);_0x3106aa['where']=qs[_0xe032('0x31')](_[_0xe032('0x39')](_0x189ed4['query'],_0x2a521b[_0xe032('0x31')]),_0x5573e4);if(_0x189ed4[_0xe032('0x30')][_0xe032('0x3a')]){_0x3106aa[_0xe032('0x3b')]=_[_0xe032('0x3c')](_0x3106aa[_0xe032('0x3b')],{'$or':_[_0xe032('0x2c')](_0x5573e4,function(_0x239c58){if(_0x239c58[_0xe032('0x3d')]!==_0xe032('0x3e')){var _0x450322={};_0x450322[_0x239c58[_0xe032('0x2a')]]={'$like':'%'+_0x189ed4[_0xe032('0x30')][_0xe032('0x3a')]+'%'};return _0x450322;}})});}_0x3106aa=_[_0xe032('0x3c')]({},_0x3106aa,_0x189ed4[_0xe032('0x3f')]);var _0x2d3d0b={'where':_0x3106aa['where']};return db[_0xe032('0x2d')]['count'](_0x2d3d0b)[_0xe032('0x26')](function(_0x2bcfb4){_0x5cc95d[_0xe032('0x40')]=_0x2bcfb4;if(_0x189ed4[_0xe032('0x30')][_0xe032('0x41')]){_0x3106aa['include']=[{'all':!![]}];}return db[_0xe032('0x2d')]['findAll'](_0x3106aa);})[_0xe032('0x26')](function(_0x590be2){_0x5cc95d[_0xe032('0x42')]=_0x590be2;return _0x5cc95d;})[_0xe032('0x26')](respondWithFilteredResult(_0x1af097,_0x3106aa))[_0xe032('0x43')](handleError(_0x1af097,null));};exports[_0xe032('0x44')]=function(_0x4dc836,_0x477360){var _0x5a6450={'raw':!![],'where':{'id':_0x4dc836[_0xe032('0x45')]['id']}},_0x2b9664={};_0x2b9664[_0xe032('0x2f')]=_[_0xe032('0x46')](db['SmsTransferReport']['rawAttributes']);_0x2b9664[_0xe032('0x30')]=_[_0xe032('0x46')](_0x4dc836['query']);_0x2b9664[_0xe032('0x31')]=_[_0xe032('0x32')](_0x2b9664[_0xe032('0x2f')],_0x2b9664[_0xe032('0x30')]);_0x5a6450[_0xe032('0x34')]=_['intersection'](_0x2b9664[_0xe032('0x2f')],qs[_0xe032('0x33')](_0x4dc836[_0xe032('0x30')][_0xe032('0x33')]));_0x5a6450[_0xe032('0x34')]=_0x5a6450[_0xe032('0x34')][_0xe032('0x35')]?_0x5a6450[_0xe032('0x34')]:_0x2b9664['model'];if(_0x4dc836['query'][_0xe032('0x41')]){_0x5a6450['include']=[{'all':!![]}];}_0x5a6450=_[_0xe032('0x3c')]({},_0x5a6450,_0x4dc836[_0xe032('0x3f')]);return db[_0xe032('0x2d')][_0xe032('0x47')](_0x5a6450)[_0xe032('0x26')](handleEntityNotFound(_0x477360,null))[_0xe032('0x26')](respondWithResult(_0x477360,null))[_0xe032('0x43')](handleError(_0x477360,null));};exports[_0xe032('0x48')]=function(_0x26206e,_0x5a4a19){return db[_0xe032('0x2d')]['create'](_0x26206e['body'],{})[_0xe032('0x26')](respondWithResult(_0x5a4a19,0xc9))[_0xe032('0x43')](handleError(_0x5a4a19,null));};exports[_0xe032('0x24')]=function(_0x1e54d3,_0x54b3d6){if(_0x1e54d3[_0xe032('0x49')]['id']){delete _0x1e54d3[_0xe032('0x49')]['id'];}return db[_0xe032('0x2d')][_0xe032('0x47')]({'where':{'id':_0x1e54d3[_0xe032('0x45')]['id']}})[_0xe032('0x26')](handleEntityNotFound(_0x54b3d6,null))[_0xe032('0x26')](saveUpdates(_0x1e54d3['body'],null))[_0xe032('0x26')](respondWithResult(_0x54b3d6,null))[_0xe032('0x43')](handleError(_0x54b3d6,null));};exports['destroy']=function(_0x39c554,_0x421d04){return db[_0xe032('0x2d')][_0xe032('0x47')]({'where':{'id':_0x39c554[_0xe032('0x45')]['id']}})[_0xe032('0x26')](handleEntityNotFound(_0x421d04,null))[_0xe032('0x26')](removeEntity(_0x421d04,null))[_0xe032('0x43')](handleError(_0x421d04,null));};exports[_0xe032('0x4a')]=function(_0x3bfd80,_0x3a0253){return db[_0xe032('0x2d')][_0xe032('0x4a')]()[_0xe032('0x26')](respondWithResult(_0x3a0253,null))['catch'](handleError(_0x3a0253,null));}; \ No newline at end of file +var _0x2bd8=['hasOwnProperty','nolimit','order','sort','filter','type','VIRTUAL','merge','where','includeAll','include','catch','show','params','keys','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','key','model','query','filters','intersection','attributes','fields'];(function(_0x4e902c,_0x259800){var _0x42dc51=function(_0x394027){while(--_0x394027){_0x4e902c['push'](_0x4e902c['shift']());}};_0x42dc51(++_0x259800);}(_0x2bd8,0x130));var _0x82bd=function(_0x1977af,_0x222957){_0x1977af=_0x1977af-0x0;var _0x28f0df=_0x2bd8[_0x1977af];return _0x28f0df;};'use strict';var pdf=require(_0x82bd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x82bd('0x1'));var zipdir=require(_0x82bd('0x2'));var jsonpatch=require(_0x82bd('0x3'));var rp=require(_0x82bd('0x4'));var moment=require(_0x82bd('0x5'));var BPromise=require(_0x82bd('0x6'));var Mustache=require(_0x82bd('0x7'));var util=require('util');var path=require(_0x82bd('0x8'));var sox=require(_0x82bd('0x9'));var csv=require(_0x82bd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82bd('0xb'));var _=require(_0x82bd('0xc'));var squel=require(_0x82bd('0xd'));var crypto=require(_0x82bd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x82bd('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x82bd('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x82bd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x82bd('0x12'));var utils=require(_0x82bd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x82bd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfaccf7,_0x51e17e){_0x51e17e=_0x51e17e||0xcc;return function(_0x338bb4){if(_0x338bb4){return _0xfaccf7[_0x82bd('0x15')](_0x51e17e);}return _0xfaccf7[_0x82bd('0x16')](_0x51e17e)[_0x82bd('0x17')]();};}function respondWithResult(_0x58d82b,_0x446ffc){_0x446ffc=_0x446ffc||0xc8;return function(_0xd43e79){if(_0xd43e79){return _0x58d82b['status'](_0x446ffc)[_0x82bd('0x18')](_0xd43e79);}};}function respondWithFilteredResult(_0x4db39d,_0x35dd09){return function(_0x433e7d){if(_0x433e7d){var _0x2c5155=_0x433e7d[_0x82bd('0x19')],_0x300982=_0x35dd09[_0x82bd('0x1a')],_0x209081=_0x35dd09[_0x82bd('0x1a')]+_0x35dd09[_0x82bd('0x1b')],_0x10c5b4;if(_0x209081>=_0x2c5155){_0x209081=_0x2c5155;_0x10c5b4=0xc8;}else{_0x10c5b4=0xce;}_0x4db39d[_0x82bd('0x16')](_0x10c5b4);return _0x4db39d[_0x82bd('0x1c')](_0x82bd('0x1d'),_0x300982+'-'+_0x209081+'/'+_0x2c5155)[_0x82bd('0x18')](_0x433e7d);}return null;};}function patchUpdates(_0x4a1e62){return function(_0x5688ed){try{jsonpatch[_0x82bd('0x1e')](_0x5688ed,_0x4a1e62,!![]);}catch(_0x3eb844){return BPromise[_0x82bd('0x1f')](_0x3eb844);}return _0x5688ed[_0x82bd('0x20')]();};}function saveUpdates(_0x34899b,_0x28a706){return function(_0x2c1810){if(_0x2c1810){return _0x2c1810[_0x82bd('0x21')](_0x34899b)[_0x82bd('0x22')](function(_0x3291cd){return _0x3291cd;});}return null;};}function removeEntity(_0x2caa29,_0x177025){return function(_0x1ca91f){if(_0x1ca91f){return _0x1ca91f[_0x82bd('0x23')]()[_0x82bd('0x22')](function(){_0x2caa29[_0x82bd('0x16')](0xcc)[_0x82bd('0x17')]();});}};}function handleEntityNotFound(_0x3b6b93,_0x673943){return function(_0x547e45){if(!_0x547e45){_0x3b6b93['sendStatus'](0x194);}return _0x547e45;};}function handleError(_0x4248be,_0x436ecd){_0x436ecd=_0x436ecd||0x1f4;return function(_0x1cb292){logger[_0x82bd('0x24')](_0x1cb292[_0x82bd('0x25')]);if(_0x1cb292[_0x82bd('0x26')]){delete _0x1cb292[_0x82bd('0x26')];}_0x4248be[_0x82bd('0x16')](_0x436ecd)[_0x82bd('0x27')](_0x1cb292);};}exports[_0x82bd('0x28')]=function(_0x53a2a6,_0x5bd22f){var _0x5609b7={},_0x5d1015={},_0x714d70={'count':0x0,'rows':[]};var _0x52bcd8=_[_0x82bd('0x29')](db[_0x82bd('0x2a')][_0x82bd('0x2b')],function(_0x50585e){return{'name':_0x50585e['fieldName'],'type':_0x50585e['type'][_0x82bd('0x2c')]};});_0x5d1015[_0x82bd('0x2d')]=_[_0x82bd('0x29')](_0x52bcd8,'name');_0x5d1015[_0x82bd('0x2e')]=_['keys'](_0x53a2a6[_0x82bd('0x2e')]);_0x5d1015[_0x82bd('0x2f')]=_[_0x82bd('0x30')](_0x5d1015[_0x82bd('0x2d')],_0x5d1015[_0x82bd('0x2e')]);_0x5609b7[_0x82bd('0x31')]=_['intersection'](_0x5d1015[_0x82bd('0x2d')],qs[_0x82bd('0x32')](_0x53a2a6[_0x82bd('0x2e')]['fields']));_0x5609b7[_0x82bd('0x31')]=_0x5609b7['attributes']['length']?_0x5609b7[_0x82bd('0x31')]:_0x5d1015[_0x82bd('0x2d')];if(!_0x53a2a6[_0x82bd('0x2e')][_0x82bd('0x33')](_0x82bd('0x34'))){_0x5609b7[_0x82bd('0x1b')]=qs[_0x82bd('0x1b')](_0x53a2a6[_0x82bd('0x2e')][_0x82bd('0x1b')]);_0x5609b7[_0x82bd('0x1a')]=qs[_0x82bd('0x1a')](_0x53a2a6[_0x82bd('0x2e')][_0x82bd('0x1a')]);}_0x5609b7[_0x82bd('0x35')]=qs[_0x82bd('0x36')](_0x53a2a6[_0x82bd('0x2e')][_0x82bd('0x36')]);_0x5609b7['where']=qs['filters'](_['pick'](_0x53a2a6[_0x82bd('0x2e')],_0x5d1015[_0x82bd('0x2f')]),_0x52bcd8);if(_0x53a2a6['query'][_0x82bd('0x37')]){_0x5609b7['where']=_['merge'](_0x5609b7['where'],{'$or':_[_0x82bd('0x29')](_0x52bcd8,function(_0x293116){if(_0x293116[_0x82bd('0x38')]!==_0x82bd('0x39')){var _0xb1d39c={};_0xb1d39c[_0x293116['name']]={'$like':'%'+_0x53a2a6['query']['filter']+'%'};return _0xb1d39c;}})});}_0x5609b7=_[_0x82bd('0x3a')]({},_0x5609b7,_0x53a2a6['options']);var _0x5d09f7={'where':_0x5609b7[_0x82bd('0x3b')]};return db[_0x82bd('0x2a')][_0x82bd('0x19')](_0x5d09f7)[_0x82bd('0x22')](function(_0x3ff054){_0x714d70[_0x82bd('0x19')]=_0x3ff054;if(_0x53a2a6[_0x82bd('0x2e')][_0x82bd('0x3c')]){_0x5609b7[_0x82bd('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x5609b7);})[_0x82bd('0x22')](function(_0x689b3c){_0x714d70['rows']=_0x689b3c;return _0x714d70;})['then'](respondWithFilteredResult(_0x5bd22f,_0x5609b7))[_0x82bd('0x3e')](handleError(_0x5bd22f,null));};exports[_0x82bd('0x3f')]=function(_0x4d310b,_0x121f1f){var _0x21868d={'raw':!![],'where':{'id':_0x4d310b[_0x82bd('0x40')]['id']}},_0x42aa82={};_0x42aa82[_0x82bd('0x2d')]=_[_0x82bd('0x41')](db[_0x82bd('0x2a')][_0x82bd('0x2b')]);_0x42aa82[_0x82bd('0x2e')]=_[_0x82bd('0x41')](_0x4d310b[_0x82bd('0x2e')]);_0x42aa82[_0x82bd('0x2f')]=_['intersection'](_0x42aa82[_0x82bd('0x2d')],_0x42aa82[_0x82bd('0x2e')]);_0x21868d['attributes']=_['intersection'](_0x42aa82[_0x82bd('0x2d')],qs[_0x82bd('0x32')](_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x32')]));_0x21868d[_0x82bd('0x31')]=_0x21868d['attributes']['length']?_0x21868d[_0x82bd('0x31')]:_0x42aa82[_0x82bd('0x2d')];if(_0x4d310b['query'][_0x82bd('0x3c')]){_0x21868d['include']=[{'all':!![]}];}_0x21868d=_[_0x82bd('0x3a')]({},_0x21868d,_0x4d310b[_0x82bd('0x42')]);return db['SmsTransferReport'][_0x82bd('0x43')](_0x21868d)[_0x82bd('0x22')](handleEntityNotFound(_0x121f1f,null))['then'](respondWithResult(_0x121f1f,null))['catch'](handleError(_0x121f1f,null));};exports[_0x82bd('0x44')]=function(_0x54f690,_0x1ab0b1){return db[_0x82bd('0x2a')][_0x82bd('0x44')](_0x54f690[_0x82bd('0x45')],{})['then'](respondWithResult(_0x1ab0b1,0xc9))['catch'](handleError(_0x1ab0b1,null));};exports[_0x82bd('0x21')]=function(_0x5a0ca6,_0x4fed9c){if(_0x5a0ca6[_0x82bd('0x45')]['id']){delete _0x5a0ca6[_0x82bd('0x45')]['id'];}return db[_0x82bd('0x2a')]['find']({'where':{'id':_0x5a0ca6[_0x82bd('0x40')]['id']}})[_0x82bd('0x22')](handleEntityNotFound(_0x4fed9c,null))[_0x82bd('0x22')](saveUpdates(_0x5a0ca6[_0x82bd('0x45')],null))[_0x82bd('0x22')](respondWithResult(_0x4fed9c,null))[_0x82bd('0x3e')](handleError(_0x4fed9c,null));};exports[_0x82bd('0x23')]=function(_0xfd1c61,_0x32f54a){return db[_0x82bd('0x2a')][_0x82bd('0x43')]({'where':{'id':_0xfd1c61[_0x82bd('0x40')]['id']}})[_0x82bd('0x22')](handleEntityNotFound(_0x32f54a,null))['then'](removeEntity(_0x32f54a,null))[_0x82bd('0x3e')](handleError(_0x32f54a,null));};exports[_0x82bd('0x46')]=function(_0x504cbc,_0x2949bb){return db[_0x82bd('0x2a')][_0x82bd('0x46')]()[_0x82bd('0x22')](respondWithResult(_0x2949bb,null))['catch'](handleError(_0x2949bb,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b4a75ae..b9e82d2 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 _0x9536=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x9536,0x179));var _0x6953=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x9536[_0x40be86];return _0xda3c3b;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xeda8=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x11a566,_0x4b82c5){var _0x2395ac=function(_0x2344ef){while(--_0x2344ef){_0x11a566['push'](_0x11a566['shift']());}};_0x2395ac(++_0x4b82c5);}(_0xeda8,0x104));var _0x8eda=function(_0x45363f,_0x4c3922){_0x45363f=_0x45363f-0x0;var _0x28b6b9=_0xeda8[_0x45363f];return _0x28b6b9;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('SmsTransferReport',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[{'name':_0x8eda('0xd'),'fields':[_0x8eda('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 6786b29..2c9746a 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 _0x72ba=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x72ba,0x19a));var _0xa72b=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x72ba[_0x934425];return _0x31d596;};'use strict';var _=require(_0xa72b('0x0'));var util=require(_0xa72b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa72b('0x2'));var fs=require('fs');var Redis=require(_0xa72b('0x3'));var db=require(_0xa72b('0x4'))['db'];var utils=require(_0xa72b('0x5'));var logger=require(_0xa72b('0x6'))(_0xa72b('0x7'));var config=require('../../config/environment');var jayson=require(_0xa72b('0x8'));var client=jayson[_0xa72b('0x9')][_0xa72b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6564,_0x1e066f,_0x4239a3){return new BPromise(function(_0x522730,_0x58857d){return client[_0xa72b('0xb')](_0x1f6564,_0x4239a3)[_0xa72b('0xc')](function(_0x52f688){logger[_0xa72b('0xd')](_0xa72b('0xe'),_0x1e066f,'request\x20sent');logger[_0xa72b('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1e066f,_0xa72b('0x10'),JSON['stringify'](_0x52f688));if(_0x52f688[_0xa72b('0x11')]){if(_0x52f688[_0xa72b('0x11')][_0xa72b('0x12')]===0x1f4){logger[_0xa72b('0x11')](_0xa72b('0xe'),_0x1e066f,_0x52f688['error'][_0xa72b('0x13')]);return _0x58857d(_0x52f688['error'][_0xa72b('0x13')]);}logger[_0xa72b('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x1e066f,_0x52f688[_0xa72b('0x11')][_0xa72b('0x13')]);return _0x522730(_0x52f688[_0xa72b('0x11')][_0xa72b('0x13')]);}else{logger[_0xa72b('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x1e066f,_0xa72b('0x10'));_0x522730(_0x52f688[_0xa72b('0x14')][_0xa72b('0x13')]);}})['catch'](function(_0x5f54c9){logger[_0xa72b('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x1e066f,_0x5f54c9);_0x58857d(_0x5f54c9);});});} \ No newline at end of file +var _0x83a2=['stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5a77a2,_0x2c06df){var _0x348e42=function(_0x3a5fff){while(--_0x3a5fff){_0x5a77a2['push'](_0x5a77a2['shift']());}};_0x348e42(++_0x2c06df);}(_0x83a2,0xb2));var _0x283a=function(_0xc93a4e,_0x30f16c){_0xc93a4e=_0xc93a4e-0x0;var _0x109c19=_0x83a2[_0xc93a4e];return _0x109c19;};'use strict';var _=require('lodash');var util=require(_0x283a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x283a('0x1'));var fs=require('fs');var Redis=require(_0x283a('0x2'));var db=require(_0x283a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x283a('0x4'))(_0x283a('0x5'));var config=require(_0x283a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x283a('0x7')][_0x283a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5da440,_0x35a628,_0x3c40db){return new BPromise(function(_0x11a949,_0xd141e3){return client['request'](_0x5da440,_0x3c40db)['then'](function(_0x314c6d){logger['info'](_0x283a('0x9'),_0x35a628,_0x283a('0xa'));logger[_0x283a('0xb')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x35a628,_0x283a('0xa'),JSON[_0x283a('0xc')](_0x314c6d));if(_0x314c6d[_0x283a('0xd')]){if(_0x314c6d[_0x283a('0xd')][_0x283a('0xe')]===0x1f4){logger[_0x283a('0xd')](_0x283a('0x9'),_0x35a628,_0x314c6d[_0x283a('0xd')]['message']);return _0xd141e3(_0x314c6d[_0x283a('0xd')][_0x283a('0xf')]);}logger[_0x283a('0xd')](_0x283a('0x9'),_0x35a628,_0x314c6d[_0x283a('0xd')][_0x283a('0xf')]);return _0x11a949(_0x314c6d['error']['message']);}else{logger[_0x283a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x35a628,_0x283a('0xa'));_0x11a949(_0x314c6d[_0x283a('0x11')][_0x283a('0xf')]);}})[_0x283a('0x12')](function(_0x595ddc){logger['error'](_0x283a('0x9'),_0x35a628,_0x595ddc);_0xd141e3(_0x595ddc);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index dcbdc5b..392222b 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 _0xdb17=['isAuthenticated','show','download','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','index','get','/:id'];(function(_0x4b0ec6,_0x20ca44){var _0x40044a=function(_0x251124){while(--_0x251124){_0x4b0ec6['push'](_0x4b0ec6['shift']());}};_0x40044a(++_0x20ca44);}(_0xdb17,0xeb));var _0x7db1=function(_0xfff28b,_0x204443){_0xfff28b=_0xfff28b-0x0;var _0x13c9f0=_0xdb17[_0xfff28b];return _0x13c9f0;};'use strict';var multer=require(_0x7db1('0x0'));var util=require(_0x7db1('0x1'));var path=require(_0x7db1('0x2'));var timeout=require(_0x7db1('0x3'));var express=require(_0x7db1('0x4'));var router=express[_0x7db1('0x5')]();var fs_extra=require(_0x7db1('0x6'));var auth=require(_0x7db1('0x7'));var interaction=require(_0x7db1('0x8'));var config=require('../../config/environment');var controller=require(_0x7db1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7db1('0xa')]);router[_0x7db1('0xb')](_0x7db1('0xc'),auth[_0x7db1('0xd')](),controller[_0x7db1('0xe')]);router['get']('/:id/download',auth[_0x7db1('0xd')](),controller[_0x7db1('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4074a1,_0x5cb11c,_0x32ac59){_0x32ac59(null,path['join'](config[_0x7db1('0x10')],'server/files/sounds/original/'));},'filename':function(_0x2003a3,_0x13afd0,_0x5a170b){_0x13afd0[_0x7db1('0x11')]=_0x13afd0['originalname'][_0x7db1('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5a170b(null,util[_0x7db1('0x13')](_0x7db1('0x14'),path[_0x7db1('0x15')](_0x13afd0[_0x7db1('0x11')],path[_0x7db1('0x16')](_0x13afd0[_0x7db1('0x11')])),Date[_0x7db1('0x17')](),path[_0x7db1('0x16')](_0x13afd0['originalname'])));}})});router[_0x7db1('0x18')]('/',upload[_0x7db1('0x19')](_0x7db1('0x1a')),controller['create']);router[_0x7db1('0x1b')](_0x7db1('0xc'),auth[_0x7db1('0xd')](),controller[_0x7db1('0x1c')]);router[_0x7db1('0x1d')](_0x7db1('0xc'),auth[_0x7db1('0xd')](),controller[_0x7db1('0x1d')]);module[_0x7db1('0x1e')]=router; \ No newline at end of file +var _0xc8ca=['isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root','originalname','replace','%s-%s%s','extname','now','single','create','put','update','delete','multer','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x295143,_0x105ade){var _0x7982e4=function(_0x210cc7){while(--_0x210cc7){_0x295143['push'](_0x295143['shift']());}};_0x7982e4(++_0x105ade);}(_0xc8ca,0xa8));var _0xac8c=function(_0x5a9205,_0x23a272){_0x5a9205=_0x5a9205-0x0;var _0x42f51d=_0xc8ca[_0x5a9205];return _0x42f51d;};'use strict';var multer=require(_0xac8c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac8c('0x1')]();var fs_extra=require(_0xac8c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xac8c('0x3'));var config=require(_0xac8c('0x4'));var controller=require(_0xac8c('0x5'));router[_0xac8c('0x6')]('/',auth[_0xac8c('0x7')](),controller[_0xac8c('0x8')]);router['get'](_0xac8c('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xac8c('0x6')](_0xac8c('0xa'),auth[_0xac8c('0x7')](),controller[_0xac8c('0xb')]);var upload=multer({'storage':multer[_0xac8c('0xc')]({'destination':function(_0x5956c8,_0x528016,_0x39d83b){_0x39d83b(null,path[_0xac8c('0xd')](config[_0xac8c('0xe')],'server/files/sounds/original/'));},'filename':function(_0x1877bc,_0x32bf74,_0x1cf362){_0x32bf74[_0xac8c('0xf')]=_0x32bf74[_0xac8c('0xf')][_0xac8c('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1cf362(null,util['format'](_0xac8c('0x11'),path['basename'](_0x32bf74[_0xac8c('0xf')],path[_0xac8c('0x12')](_0x32bf74[_0xac8c('0xf')])),Date[_0xac8c('0x13')](),path[_0xac8c('0x12')](_0x32bf74['originalname'])));}})});router['post']('/',upload[_0xac8c('0x14')]('file'),controller[_0xac8c('0x15')]);router[_0xac8c('0x16')]('/:id',auth[_0xac8c('0x7')](),controller[_0xac8c('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xac8c('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5936675..7d7c7e1 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 _0xd315=['BIGINT','INTEGER','FLOAT','sequelize','exports','STRING'];(function(_0x172a82,_0x31347d){var _0x285e23=function(_0x5ebbfd){while(--_0x5ebbfd){_0x172a82['push'](_0x172a82['shift']());}};_0x285e23(++_0x31347d);}(_0xd315,0xf9));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5d31('0x0'));module[_0x5d31('0x1')]={'name':{'type':Sequelize[_0x5d31('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x5d31('0x2')]},'display_name':{'type':Sequelize[_0x5d31('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x5d31('0x2')]},'original_format':{'type':Sequelize[_0x5d31('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x5d31('0x3')]},'original_channelCount':{'type':Sequelize[_0x5d31('0x4')]},'original_bitRate':{'type':Sequelize[_0x5d31('0x3')]},'original_sampleRate':{'type':Sequelize[_0x5d31('0x4')]},'converted_format':{'type':Sequelize[_0x5d31('0x2')]},'converted_duration':{'type':Sequelize[_0x5d31('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x5d31('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x5d31('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x5d31('0x4')]}}; \ No newline at end of file +var _0xde74=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xde74,0x127));var _0x4de7=function(_0x3b1b81,_0x1b6593){_0x3b1b81=_0x3b1b81-0x0;var _0x229998=_0xde74[_0x3b1b81];return _0x229998;};'use strict';var Sequelize=require(_0x4de7('0x0'));module[_0x4de7('0x1')]={'name':{'type':Sequelize[_0x4de7('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x4de7('0x2')]},'display_name':{'type':Sequelize[_0x4de7('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x4de7('0x2')]},'original_duration':{'type':Sequelize[_0x4de7('0x3')]},'original_sampleCount':{'type':Sequelize[_0x4de7('0x4')]},'original_channelCount':{'type':Sequelize[_0x4de7('0x5')]},'original_bitRate':{'type':Sequelize[_0x4de7('0x4')]},'original_sampleRate':{'type':Sequelize[_0x4de7('0x5')]},'converted_format':{'type':Sequelize[_0x4de7('0x2')]},'converted_duration':{'type':Sequelize[_0x4de7('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x4de7('0x5')]},'converted_bitRate':{'type':Sequelize[_0x4de7('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x4de7('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6720b78..2b3534a 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 _0xc647=['converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','params','description','root','original_format','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','json','offset','limit','Content-Range','apply','reject','save','then','destroy','get','Sounds','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Sound','count','includeAll','include','find','catch','download','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','join','format','%s.%s','create','file','basename','filename','extname','originalname','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest'];(function(_0x5859df,_0x1bd70f){var _0x70526f=function(_0x3aa4ae){while(--_0x3aa4ae){_0x5859df['push'](_0x5859df['shift']());}};_0x70526f(++_0x1bd70f);}(_0xc647,0x92));var _0x7c64=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xc647[_0x117f4c];return _0x2b24e9;};'use strict';var pdf=require(_0x7c64('0x0'));var emlformat=require(_0x7c64('0x1'));var rimraf=require(_0x7c64('0x2'));var zipdir=require(_0x7c64('0x3'));var jsonpatch=require(_0x7c64('0x4'));var rp=require(_0x7c64('0x5'));var moment=require('moment');var BPromise=require(_0x7c64('0x6'));var Mustache=require(_0x7c64('0x7'));var util=require(_0x7c64('0x8'));var path=require(_0x7c64('0x9'));var sox=require(_0x7c64('0xa'));var csv=require(_0x7c64('0xb'));var ejs=require(_0x7c64('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c64('0xd'));var squel=require(_0x7c64('0xe'));var crypto=require(_0x7c64('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7c64('0x10'));var toCsv=require(_0x7c64('0xb'));var querystring=require(_0x7c64('0x11'));var Papa=require(_0x7c64('0x12'));var Redis=require(_0x7c64('0x13'));var authService=require(_0x7c64('0x14'));var qs=require(_0x7c64('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c64('0x16'));var logger=require(_0x7c64('0x17'))('api');var utils=require(_0x7c64('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7c64('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x412062,_0x5cdb24){_0x5cdb24=_0x5cdb24||0xcc;return function(_0x5bb1df){if(_0x5bb1df){return _0x412062['sendStatus'](_0x5cdb24);}return _0x412062[_0x7c64('0x1a')](_0x5cdb24)['end']();};}function respondWithResult(_0x312d7f,_0x1a1732){_0x1a1732=_0x1a1732||0xc8;return function(_0x20ac71){if(_0x20ac71){return _0x312d7f['status'](_0x1a1732)[_0x7c64('0x1b')](_0x20ac71);}};}function respondWithFilteredResult(_0x562bae,_0x3f96ca){return function(_0x555631){if(_0x555631){var _0x41957c=_0x555631['count'],_0x107ffb=_0x3f96ca[_0x7c64('0x1c')],_0x58d3da=_0x3f96ca['offset']+_0x3f96ca[_0x7c64('0x1d')],_0x43b588;if(_0x58d3da>=_0x41957c){_0x58d3da=_0x41957c;_0x43b588=0xc8;}else{_0x43b588=0xce;}_0x562bae[_0x7c64('0x1a')](_0x43b588);return _0x562bae['set'](_0x7c64('0x1e'),_0x107ffb+'-'+_0x58d3da+'/'+_0x41957c)[_0x7c64('0x1b')](_0x555631);}return null;};}function patchUpdates(_0x306d66){return function(_0x18506d){try{jsonpatch[_0x7c64('0x1f')](_0x18506d,_0x306d66,!![]);}catch(_0x2726fb){return BPromise[_0x7c64('0x20')](_0x2726fb);}return _0x18506d[_0x7c64('0x21')]();};}function saveUpdates(_0x312181,_0x315734){return function(_0x288a0f){if(_0x288a0f){return _0x288a0f['update'](_0x312181)[_0x7c64('0x22')](function(_0x17b133){return _0x17b133;});}return null;};}function removeEntity(_0x384615,_0x112bd0){return function(_0x1badcf){if(_0x1badcf){return _0x1badcf[_0x7c64('0x23')]()['then'](function(){var _0x3545fe=_0x1badcf[_0x7c64('0x24')]({'plain':!![]});var _0x263871=_0x7c64('0x25');return db['UserProfileResource'][_0x7c64('0x23')]({'where':{'type':_0x263871,'resourceId':_0x3545fe['id']}})[_0x7c64('0x22')](function(){return _0x1badcf;});})[_0x7c64('0x22')](function(){_0x384615[_0x7c64('0x1a')](0xcc)[_0x7c64('0x26')]();});}};}function handleEntityNotFound(_0xb677c2,_0x4b0a9b){return function(_0xfa16a0){if(!_0xfa16a0){_0xb677c2[_0x7c64('0x27')](0x194);}return _0xfa16a0;};}function handleError(_0x51f487,_0x251ba3){_0x251ba3=_0x251ba3||0x1f4;return function(_0x7de972){logger[_0x7c64('0x28')](_0x7de972[_0x7c64('0x29')]);if(_0x7de972[_0x7c64('0x2a')]){delete _0x7de972[_0x7c64('0x2a')];}_0x51f487[_0x7c64('0x1a')](_0x251ba3)[_0x7c64('0x2b')](_0x7de972);};}exports[_0x7c64('0x2c')]=function(_0x1e5da1,_0xb74463){var _0xca61f2={},_0x187702={},_0x2f5425={'count':0x0,'rows':[]};var _0x2af3e6=_[_0x7c64('0x2d')](db['Sound'][_0x7c64('0x2e')],function(_0x5918c8){return{'name':_0x5918c8[_0x7c64('0x2f')],'type':_0x5918c8[_0x7c64('0x30')][_0x7c64('0x31')]};});_0x187702[_0x7c64('0x32')]=_['map'](_0x2af3e6,_0x7c64('0x2a'));_0x187702[_0x7c64('0x33')]=_[_0x7c64('0x34')](_0x1e5da1[_0x7c64('0x33')]);_0x187702[_0x7c64('0x35')]=_[_0x7c64('0x36')](_0x187702[_0x7c64('0x32')],_0x187702[_0x7c64('0x33')]);_0xca61f2[_0x7c64('0x37')]=_['intersection'](_0x187702[_0x7c64('0x32')],qs[_0x7c64('0x38')](_0x1e5da1[_0x7c64('0x33')][_0x7c64('0x38')]));_0xca61f2[_0x7c64('0x37')]=_0xca61f2[_0x7c64('0x37')][_0x7c64('0x39')]?_0xca61f2[_0x7c64('0x37')]:_0x187702[_0x7c64('0x32')];if(!_0x1e5da1['query'][_0x7c64('0x3a')](_0x7c64('0x3b'))){_0xca61f2[_0x7c64('0x1d')]=qs[_0x7c64('0x1d')](_0x1e5da1[_0x7c64('0x33')]['limit']);_0xca61f2['offset']=qs[_0x7c64('0x1c')](_0x1e5da1[_0x7c64('0x33')][_0x7c64('0x1c')]);}_0xca61f2['order']=qs[_0x7c64('0x3c')](_0x1e5da1[_0x7c64('0x33')][_0x7c64('0x3c')]);_0xca61f2[_0x7c64('0x3d')]=qs[_0x7c64('0x35')](_[_0x7c64('0x3e')](_0x1e5da1[_0x7c64('0x33')],_0x187702[_0x7c64('0x35')]),_0x2af3e6);if(_0x1e5da1['query'][_0x7c64('0x3f')]){_0xca61f2['where']=_[_0x7c64('0x40')](_0xca61f2[_0x7c64('0x3d')],{'$or':_[_0x7c64('0x2d')](_0x2af3e6,function(_0x139094){if(_0x139094[_0x7c64('0x30')]!==_0x7c64('0x41')){var _0x5609ad={};_0x5609ad[_0x139094[_0x7c64('0x2a')]]={'$like':'%'+_0x1e5da1['query'][_0x7c64('0x3f')]+'%'};return _0x5609ad;}})});}_0xca61f2=_['merge']({},_0xca61f2,_0x1e5da1[_0x7c64('0x42')]);var _0x291be9={'where':_0xca61f2['where']};return db[_0x7c64('0x43')][_0x7c64('0x44')](_0x291be9)['then'](function(_0x3c7c06){_0x2f5425['count']=_0x3c7c06;if(_0x1e5da1[_0x7c64('0x33')][_0x7c64('0x45')]){_0xca61f2['include']=[{'all':!![]}];}return db[_0x7c64('0x43')]['findAll'](_0xca61f2);})[_0x7c64('0x22')](function(_0x2c417f){_0x2f5425['rows']=_0x2c417f;return _0x2f5425;})[_0x7c64('0x22')](respondWithFilteredResult(_0xb74463,_0xca61f2))['catch'](handleError(_0xb74463,null));};exports['show']=function(_0x40700b,_0x563ecc){var _0x49fd27={'raw':!![],'where':{'id':_0x40700b['params']['id']}},_0x56a0b2={};_0x56a0b2[_0x7c64('0x32')]=_[_0x7c64('0x34')](db[_0x7c64('0x43')][_0x7c64('0x2e')]);_0x56a0b2[_0x7c64('0x33')]=_[_0x7c64('0x34')](_0x40700b[_0x7c64('0x33')]);_0x56a0b2['filters']=_['intersection'](_0x56a0b2[_0x7c64('0x32')],_0x56a0b2[_0x7c64('0x33')]);_0x49fd27[_0x7c64('0x37')]=_[_0x7c64('0x36')](_0x56a0b2[_0x7c64('0x32')],qs[_0x7c64('0x38')](_0x40700b[_0x7c64('0x33')][_0x7c64('0x38')]));_0x49fd27[_0x7c64('0x37')]=_0x49fd27['attributes'][_0x7c64('0x39')]?_0x49fd27[_0x7c64('0x37')]:_0x56a0b2[_0x7c64('0x32')];if(_0x40700b[_0x7c64('0x33')]['includeAll']){_0x49fd27[_0x7c64('0x46')]=[{'all':!![]}];}_0x49fd27=_[_0x7c64('0x40')]({},_0x49fd27,_0x40700b[_0x7c64('0x42')]);return db[_0x7c64('0x43')][_0x7c64('0x47')](_0x49fd27)[_0x7c64('0x22')](handleEntityNotFound(_0x563ecc,null))[_0x7c64('0x22')](respondWithResult(_0x563ecc,null))[_0x7c64('0x48')](handleError(_0x563ecc,null));};exports[_0x7c64('0x49')]=function(_0x42b9fd,_0x5b5ad0,_0x51bbb8){return db['Sound'][_0x7c64('0x47')]({'where':{'id':_0x42b9fd['params']['id']},'attributes':[_0x7c64('0x2a'),_0x7c64('0x4a'),_0x7c64('0x4b')],'raw':!![]})[_0x7c64('0x22')](handleEntityNotFound(_0x5b5ad0,null))[_0x7c64('0x22')](function(_0x532122){if(_0x532122){if(!fs[_0x7c64('0x4c')](path['join'](config['root'],_0x7c64('0x4d'),_0x532122['save_name']+'.'+_0x532122[_0x7c64('0x4b')]))){throw new db[(_0x7c64('0x4e'))][(_0x7c64('0x4f'))]('Sound\x20not\x20found');}return _0x5b5ad0[_0x7c64('0x49')](path[_0x7c64('0x50')](config['root'],_0x7c64('0x4d'),util[_0x7c64('0x51')](_0x7c64('0x52'),_0x532122[_0x7c64('0x4a')],_0x532122[_0x7c64('0x4b')])),util[_0x7c64('0x51')](_0x7c64('0x52'),_0x532122[_0x7c64('0x2a')],_0x532122[_0x7c64('0x4b')]));}return null;})[_0x7c64('0x48')](handleError(_0x5b5ad0,null));};exports[_0x7c64('0x53')]=function(_0x34ed70,_0x19d277,_0x360bf5){var _0x4f62b6={'name':path['basename'](_0x34ed70[_0x7c64('0x54')]['originalname'],path['extname'](_0x34ed70[_0x7c64('0x54')]['originalname'])),'save_name':path[_0x7c64('0x55')](_0x34ed70[_0x7c64('0x54')][_0x7c64('0x56')],path[_0x7c64('0x57')](_0x34ed70[_0x7c64('0x54')][_0x7c64('0x56')])),'original_format':path[_0x7c64('0x57')](_0x34ed70[_0x7c64('0x54')][_0x7c64('0x58')])['substring'](0x1),'converted_format':_0x7c64('0x59')};var _0xc7e98c=path[_0x7c64('0x50')](config['root'],_0x7c64('0x5a'),_0x34ed70[_0x7c64('0x54')][_0x7c64('0x56')]);var _0x5246c6=path['join'](config['root'],_0x7c64('0x4d'),util[_0x7c64('0x51')](_0x7c64('0x52'),path[_0x7c64('0x55')](_0x34ed70['file'][_0x7c64('0x56')],path[_0x7c64('0x57')](_0x34ed70['file']['filename'])),_0x4f62b6['converted_format']));logger[_0x7c64('0x5b')]('Sound\x20upload\x20filepath:\x20%s',_0xc7e98c);logger[_0x7c64('0x5b')](_0x7c64('0x5c'),_0x5246c6);try{fs['chmodSync'](_0xc7e98c,parseInt(_0x7c64('0x5d'),0x8));var _0x575acb=sox[_0x7c64('0x5e')](_0xc7e98c,_0x5246c6,{'sampleRate':0x1f40,'format':_0x7c64('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x575acb['on']('error',function(_0x468e31){fs['unlinkSync'](_0xc7e98c);_0x19d277[_0x7c64('0x1a')](0x1f4)[_0x7c64('0x2b')](_0x468e31);});_0x575acb['on'](_0x7c64('0x5f'),function(_0x221de1){_0x4f62b6[_0x7c64('0x60')]=isNaN(_0x221de1[_0x7c64('0x61')])?null:_0x221de1[_0x7c64('0x61')]*0x3e8;_0x4f62b6['original_sampleCount']=isNaN(_0x221de1[_0x7c64('0x62')])?null:_0x221de1[_0x7c64('0x62')];_0x4f62b6['original_channelCount']=isNaN(_0x221de1[_0x7c64('0x63')])?null:_0x221de1[_0x7c64('0x63')];_0x4f62b6[_0x7c64('0x64')]=isNaN(_0x221de1[_0x7c64('0x65')])?null:_0x221de1['bitRate'];_0x4f62b6['original_sampleRate']=isNaN(_0x221de1[_0x7c64('0x66')])?null:_0x221de1[_0x7c64('0x66')];});_0x575acb['on'](_0x7c64('0x67'),function(_0x3308f5){_0x4f62b6[_0x7c64('0x68')]=isNaN(_0x3308f5[_0x7c64('0x61')])?null:_0x3308f5[_0x7c64('0x61')]*0x3e8;_0x4f62b6[_0x7c64('0x69')]=isNaN(_0x3308f5[_0x7c64('0x62')])?null:_0x3308f5[_0x7c64('0x62')];_0x4f62b6[_0x7c64('0x6a')]=isNaN(_0x3308f5[_0x7c64('0x63')])?null:_0x3308f5[_0x7c64('0x63')];_0x4f62b6[_0x7c64('0x6b')]=isNaN(_0x3308f5[_0x7c64('0x65')])?null:_0x3308f5['bitRate'];_0x4f62b6[_0x7c64('0x6c')]=isNaN(_0x3308f5[_0x7c64('0x66')])?null:_0x3308f5[_0x7c64('0x66')];});_0x575acb['on']('end',function(){fs[_0x7c64('0x6d')](_0x5246c6,parseInt('0777',0x8));return db[_0x7c64('0x43')][_0x7c64('0x53')](_0x4f62b6)['then'](function(_0x4cc0e){var _0x2289d2={'role':_0x34ed70[_0x7c64('0x6e')][_0x7c64('0x6f')],'userProfileId':_0x34ed70[_0x7c64('0x6e')][_0x7c64('0x70')]};if(!_0x2289d2)throw new Error(_0x7c64('0x71'));if(_0x2289d2[_0x7c64('0x6f')]==='user'){var _0x104e27=_0x4cc0e[_0x7c64('0x24')]({'plain':!![]});return db[_0x7c64('0x72')][_0x7c64('0x47')]({'where':{'name':'Sounds','userProfileId':_0x2289d2[_0x7c64('0x70')]},'raw':!![]})[_0x7c64('0x22')](function(_0x4116fe){if(_0x4116fe&&_0x4116fe[_0x7c64('0x73')]===0x0){return db[_0x7c64('0x74')]['create']({'name':_0x104e27['name'],'resourceId':_0x104e27['id'],'type':_0x4116fe[_0x7c64('0x2a')],'sectionId':_0x4116fe['id']},{})['then'](function(){return _0x4cc0e;});}else{return _0x4cc0e;}})[_0x7c64('0x48')](function(_0x2973aa){logger[_0x7c64('0x28')](_0x7c64('0x75'),_0x2973aa);throw _0x2973aa;});}return _0x4cc0e;})[_0x7c64('0x22')](respondWithResult(_0x19d277,null))[_0x7c64('0x48')](handleError(_0x19d277,null));});_0x575acb[_0x7c64('0x76')]();}catch(_0x16a1c0){_0x19d277[_0x7c64('0x1a')](0x1f4)[_0x7c64('0x2b')](_0x16a1c0);}};exports[_0x7c64('0x77')]=function(_0x503915,_0x278ba9,_0x270b02){return db['Sound'][_0x7c64('0x47')]({'where':{'id':_0x503915[_0x7c64('0x78')]['id']}})['then'](handleEntityNotFound(_0x278ba9,null))['then'](saveUpdates(_[_0x7c64('0x3e')](_0x503915[_0x7c64('0x6e')],['name',_0x7c64('0x79')]),null))[_0x7c64('0x22')](respondWithResult(_0x278ba9,null))['catch'](handleError(_0x278ba9,null));};exports['delete']=function(_0x10f662,_0x562f5a,_0x51229f){return db[_0x7c64('0x43')][_0x7c64('0x47')]({'where':{'id':_0x10f662[_0x7c64('0x78')]['id']}})[_0x7c64('0x22')](function(_0x11908f){if(_0x11908f){return _0x11908f[_0x7c64('0x23')]();}})[_0x7c64('0x22')](function(_0x33066a){var _0x2473d5=path[_0x7c64('0x50')](config[_0x7c64('0x7a')],'server/files/sounds/original',util[_0x7c64('0x51')](_0x7c64('0x52'),_0x33066a['save_name'],_0x33066a[_0x7c64('0x7b')]));var _0x5c9842=path[_0x7c64('0x50')](config[_0x7c64('0x7a')],_0x7c64('0x4d'),util[_0x7c64('0x51')](_0x7c64('0x52'),_0x33066a['save_name'],_0x33066a[_0x7c64('0x4b')]));fs[_0x7c64('0x7c')](_0x2473d5);fs[_0x7c64('0x7c')](_0x5c9842);return _0x33066a;})['then'](function(_0x376646){if(_0x376646){return _0x562f5a[_0x7c64('0x1a')](0xcc)[_0x7c64('0x26')]();}})[_0x7c64('0x22')](handleEntityNotFound(_0x562f5a,null))['catch'](handleError(_0x562f5a,null));}; \ No newline at end of file +var _0xe887=['end','json','count','offset','set','Content-Range','apply','update','then','get','Sounds','destroy','sendStatus','error','stack','name','map','Sound','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','file','originalname','extname','substring','root','server/files/sounds/original','filename','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe887,0x1e5));var _0x7e88=function(_0x3a12d3,_0x499e67){_0x3a12d3=_0x3a12d3-0x0;var _0x1dbb45=_0xe887[_0x3a12d3];return _0x1dbb45;};'use strict';var pdf=require(_0x7e88('0x0'));var emlformat=require(_0x7e88('0x1'));var rimraf=require(_0x7e88('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e88('0x3'));var rp=require('request-promise');var moment=require(_0x7e88('0x4'));var BPromise=require(_0x7e88('0x5'));var Mustache=require(_0x7e88('0x6'));var util=require(_0x7e88('0x7'));var path=require(_0x7e88('0x8'));var sox=require(_0x7e88('0x9'));var csv=require(_0x7e88('0xa'));var ejs=require(_0x7e88('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e88('0xc'));var squel=require(_0x7e88('0xd'));var crypto=require(_0x7e88('0xe'));var jsforce=require(_0x7e88('0xf'));var deskjs=require(_0x7e88('0x10'));var toCsv=require(_0x7e88('0xa'));var querystring=require(_0x7e88('0x11'));var Papa=require(_0x7e88('0x12'));var Redis=require('ioredis');var authService=require(_0x7e88('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7e88('0x14'));var hardwareService=require(_0x7e88('0x15'));var logger=require(_0x7e88('0x16'))(_0x7e88('0x17'));var utils=require('../../config/utils');var config=require(_0x7e88('0x18'));var licenseUtil=require(_0x7e88('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21fd57,_0x2b5835){_0x2b5835=_0x2b5835||0xcc;return function(_0x295c93){if(_0x295c93){return _0x21fd57['sendStatus'](_0x2b5835);}return _0x21fd57[_0x7e88('0x1a')](_0x2b5835)[_0x7e88('0x1b')]();};}function respondWithResult(_0x1174bd,_0x3204c2){_0x3204c2=_0x3204c2||0xc8;return function(_0x11068e){if(_0x11068e){return _0x1174bd[_0x7e88('0x1a')](_0x3204c2)[_0x7e88('0x1c')](_0x11068e);}};}function respondWithFilteredResult(_0x52ffc0,_0x16d555){return function(_0x2ea120){if(_0x2ea120){var _0x535e93=_0x2ea120[_0x7e88('0x1d')],_0x42a79a=_0x16d555[_0x7e88('0x1e')],_0x5af67b=_0x16d555['offset']+_0x16d555['limit'],_0x338ba1;if(_0x5af67b>=_0x535e93){_0x5af67b=_0x535e93;_0x338ba1=0xc8;}else{_0x338ba1=0xce;}_0x52ffc0['status'](_0x338ba1);return _0x52ffc0[_0x7e88('0x1f')](_0x7e88('0x20'),_0x42a79a+'-'+_0x5af67b+'/'+_0x535e93)[_0x7e88('0x1c')](_0x2ea120);}return null;};}function patchUpdates(_0x30f4ee){return function(_0xa68bfb){try{jsonpatch[_0x7e88('0x21')](_0xa68bfb,_0x30f4ee,!![]);}catch(_0x455cb7){return BPromise['reject'](_0x455cb7);}return _0xa68bfb['save']();};}function saveUpdates(_0x5e793d,_0x214aa0){return function(_0x4c8cd9){if(_0x4c8cd9){return _0x4c8cd9[_0x7e88('0x22')](_0x5e793d)[_0x7e88('0x23')](function(_0x2498bb){return _0x2498bb;});}return null;};}function removeEntity(_0x3c5871,_0x55e389){return function(_0xe05af2){if(_0xe05af2){return _0xe05af2['destroy']()[_0x7e88('0x23')](function(){var _0x291937=_0xe05af2[_0x7e88('0x24')]({'plain':!![]});var _0x1e7e7a=_0x7e88('0x25');return db['UserProfileResource'][_0x7e88('0x26')]({'where':{'type':_0x1e7e7a,'resourceId':_0x291937['id']}})[_0x7e88('0x23')](function(){return _0xe05af2;});})['then'](function(){_0x3c5871[_0x7e88('0x1a')](0xcc)[_0x7e88('0x1b')]();});}};}function handleEntityNotFound(_0x47102e,_0x42e4a0){return function(_0x5b2bcf){if(!_0x5b2bcf){_0x47102e[_0x7e88('0x27')](0x194);}return _0x5b2bcf;};}function handleError(_0x28c958,_0xdcb12e){_0xdcb12e=_0xdcb12e||0x1f4;return function(_0x5bb549){logger[_0x7e88('0x28')](_0x5bb549[_0x7e88('0x29')]);if(_0x5bb549['name']){delete _0x5bb549[_0x7e88('0x2a')];}_0x28c958[_0x7e88('0x1a')](_0xdcb12e)['send'](_0x5bb549);};}exports['index']=function(_0x26b97c,_0x180628){var _0x2e5998={},_0x1b6210={},_0x302663={'count':0x0,'rows':[]};var _0x1d8689=_[_0x7e88('0x2b')](db[_0x7e88('0x2c')][_0x7e88('0x2d')],function(_0x45e3d7){return{'name':_0x45e3d7['fieldName'],'type':_0x45e3d7[_0x7e88('0x2e')][_0x7e88('0x2f')]};});_0x1b6210[_0x7e88('0x30')]=_[_0x7e88('0x2b')](_0x1d8689,'name');_0x1b6210[_0x7e88('0x31')]=_[_0x7e88('0x32')](_0x26b97c[_0x7e88('0x31')]);_0x1b6210['filters']=_[_0x7e88('0x33')](_0x1b6210['model'],_0x1b6210['query']);_0x2e5998[_0x7e88('0x34')]=_['intersection'](_0x1b6210[_0x7e88('0x30')],qs[_0x7e88('0x35')](_0x26b97c['query'][_0x7e88('0x35')]));_0x2e5998[_0x7e88('0x34')]=_0x2e5998[_0x7e88('0x34')][_0x7e88('0x36')]?_0x2e5998['attributes']:_0x1b6210['model'];if(!_0x26b97c[_0x7e88('0x31')][_0x7e88('0x37')]('nolimit')){_0x2e5998[_0x7e88('0x38')]=qs[_0x7e88('0x38')](_0x26b97c[_0x7e88('0x31')][_0x7e88('0x38')]);_0x2e5998['offset']=qs[_0x7e88('0x1e')](_0x26b97c['query'][_0x7e88('0x1e')]);}_0x2e5998[_0x7e88('0x39')]=qs[_0x7e88('0x3a')](_0x26b97c[_0x7e88('0x31')][_0x7e88('0x3a')]);_0x2e5998[_0x7e88('0x3b')]=qs[_0x7e88('0x3c')](_[_0x7e88('0x3d')](_0x26b97c['query'],_0x1b6210[_0x7e88('0x3c')]),_0x1d8689);if(_0x26b97c[_0x7e88('0x31')][_0x7e88('0x3e')]){_0x2e5998['where']=_['merge'](_0x2e5998[_0x7e88('0x3b')],{'$or':_[_0x7e88('0x2b')](_0x1d8689,function(_0x4c0f30){if(_0x4c0f30['type']!==_0x7e88('0x3f')){var _0x250013={};_0x250013[_0x4c0f30[_0x7e88('0x2a')]]={'$like':'%'+_0x26b97c[_0x7e88('0x31')][_0x7e88('0x3e')]+'%'};return _0x250013;}})});}_0x2e5998=_['merge']({},_0x2e5998,_0x26b97c[_0x7e88('0x40')]);var _0x59fa2e={'where':_0x2e5998['where']};return db['Sound'][_0x7e88('0x1d')](_0x59fa2e)[_0x7e88('0x23')](function(_0x51b3da){_0x302663[_0x7e88('0x1d')]=_0x51b3da;if(_0x26b97c[_0x7e88('0x31')][_0x7e88('0x41')]){_0x2e5998[_0x7e88('0x42')]=[{'all':!![]}];}return db[_0x7e88('0x2c')][_0x7e88('0x43')](_0x2e5998);})[_0x7e88('0x23')](function(_0x346eef){_0x302663[_0x7e88('0x44')]=_0x346eef;return _0x302663;})[_0x7e88('0x23')](respondWithFilteredResult(_0x180628,_0x2e5998))[_0x7e88('0x45')](handleError(_0x180628,null));};exports[_0x7e88('0x46')]=function(_0xdd9473,_0x5b8aca){var _0x53b059={'raw':!![],'where':{'id':_0xdd9473[_0x7e88('0x47')]['id']}},_0x1c93e6={};_0x1c93e6['model']=_['keys'](db[_0x7e88('0x2c')][_0x7e88('0x2d')]);_0x1c93e6[_0x7e88('0x31')]=_['keys'](_0xdd9473[_0x7e88('0x31')]);_0x1c93e6[_0x7e88('0x3c')]=_[_0x7e88('0x33')](_0x1c93e6[_0x7e88('0x30')],_0x1c93e6['query']);_0x53b059[_0x7e88('0x34')]=_[_0x7e88('0x33')](_0x1c93e6[_0x7e88('0x30')],qs[_0x7e88('0x35')](_0xdd9473[_0x7e88('0x31')]['fields']));_0x53b059[_0x7e88('0x34')]=_0x53b059['attributes'][_0x7e88('0x36')]?_0x53b059[_0x7e88('0x34')]:_0x1c93e6[_0x7e88('0x30')];if(_0xdd9473[_0x7e88('0x31')]['includeAll']){_0x53b059[_0x7e88('0x42')]=[{'all':!![]}];}_0x53b059=_[_0x7e88('0x48')]({},_0x53b059,_0xdd9473['options']);return db[_0x7e88('0x2c')][_0x7e88('0x49')](_0x53b059)[_0x7e88('0x23')](handleEntityNotFound(_0x5b8aca,null))[_0x7e88('0x23')](respondWithResult(_0x5b8aca,null))[_0x7e88('0x45')](handleError(_0x5b8aca,null));};exports[_0x7e88('0x4a')]=function(_0x3790f5,_0x1fdc1b,_0x145377){return db[_0x7e88('0x2c')]['find']({'where':{'id':_0x3790f5[_0x7e88('0x47')]['id']},'attributes':[_0x7e88('0x2a'),_0x7e88('0x4b'),_0x7e88('0x4c')],'raw':!![]})[_0x7e88('0x23')](handleEntityNotFound(_0x1fdc1b,null))['then'](function(_0x59ba54){if(_0x59ba54){if(!fs['existsSync'](path[_0x7e88('0x4d')](config['root'],_0x7e88('0x4e'),_0x59ba54['save_name']+'.'+_0x59ba54[_0x7e88('0x4c')]))){throw new db[(_0x7e88('0x4f'))][(_0x7e88('0x50'))](_0x7e88('0x51'));}return _0x1fdc1b[_0x7e88('0x4a')](path[_0x7e88('0x4d')](config['root'],_0x7e88('0x4e'),util['format'](_0x7e88('0x52'),_0x59ba54['save_name'],_0x59ba54[_0x7e88('0x4c')])),util[_0x7e88('0x53')]('%s.%s',_0x59ba54[_0x7e88('0x2a')],_0x59ba54[_0x7e88('0x4c')]));}return null;})['catch'](handleError(_0x1fdc1b,null));};exports['create']=function(_0x50e9c6,_0x2909a8,_0x447ec5){var _0xf7613f={'name':path['basename'](_0x50e9c6[_0x7e88('0x54')][_0x7e88('0x55')],path[_0x7e88('0x56')](_0x50e9c6[_0x7e88('0x54')][_0x7e88('0x55')])),'save_name':path['basename'](_0x50e9c6[_0x7e88('0x54')]['filename'],path['extname'](_0x50e9c6[_0x7e88('0x54')]['filename'])),'original_format':path[_0x7e88('0x56')](_0x50e9c6[_0x7e88('0x54')]['originalname'])[_0x7e88('0x57')](0x1),'converted_format':'wav'};var _0x4c6c34=path[_0x7e88('0x4d')](config[_0x7e88('0x58')],_0x7e88('0x59'),_0x50e9c6[_0x7e88('0x54')][_0x7e88('0x5a')]);var _0x102581=path[_0x7e88('0x4d')](config['root'],'server/files/sounds/converted',util[_0x7e88('0x53')]('%s.%s',path[_0x7e88('0x5b')](_0x50e9c6['file'][_0x7e88('0x5a')],path['extname'](_0x50e9c6[_0x7e88('0x54')]['filename'])),_0xf7613f[_0x7e88('0x4c')]));logger[_0x7e88('0x5c')](_0x7e88('0x5d'),_0x4c6c34);logger[_0x7e88('0x5c')](_0x7e88('0x5e'),_0x102581);try{fs[_0x7e88('0x5f')](_0x4c6c34,parseInt(_0x7e88('0x60'),0x8));var _0x59a9e9=sox['transcode'](_0x4c6c34,_0x102581,{'sampleRate':0x1f40,'format':_0x7e88('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x59a9e9['on'](_0x7e88('0x28'),function(_0x24bc0f){fs[_0x7e88('0x62')](_0x4c6c34);_0x2909a8[_0x7e88('0x1a')](0x1f4)[_0x7e88('0x63')](_0x24bc0f);});_0x59a9e9['on'](_0x7e88('0x64'),function(_0x99c08){_0xf7613f[_0x7e88('0x65')]=isNaN(_0x99c08['duration'])?null:_0x99c08[_0x7e88('0x66')]*0x3e8;_0xf7613f[_0x7e88('0x67')]=isNaN(_0x99c08[_0x7e88('0x68')])?null:_0x99c08[_0x7e88('0x68')];_0xf7613f[_0x7e88('0x69')]=isNaN(_0x99c08['channelCount'])?null:_0x99c08['channelCount'];_0xf7613f[_0x7e88('0x6a')]=isNaN(_0x99c08['bitRate'])?null:_0x99c08[_0x7e88('0x6b')];_0xf7613f[_0x7e88('0x6c')]=isNaN(_0x99c08[_0x7e88('0x6d')])?null:_0x99c08[_0x7e88('0x6d')];});_0x59a9e9['on'](_0x7e88('0x6e'),function(_0x594155){_0xf7613f['converted_duration']=isNaN(_0x594155[_0x7e88('0x66')])?null:_0x594155['duration']*0x3e8;_0xf7613f[_0x7e88('0x6f')]=isNaN(_0x594155['sampleCount'])?null:_0x594155['sampleCount'];_0xf7613f[_0x7e88('0x70')]=isNaN(_0x594155[_0x7e88('0x71')])?null:_0x594155['channelCount'];_0xf7613f[_0x7e88('0x72')]=isNaN(_0x594155[_0x7e88('0x6b')])?null:_0x594155['bitRate'];_0xf7613f[_0x7e88('0x73')]=isNaN(_0x594155[_0x7e88('0x6d')])?null:_0x594155['sampleRate'];});_0x59a9e9['on'](_0x7e88('0x1b'),function(){fs[_0x7e88('0x5f')](_0x102581,parseInt(_0x7e88('0x60'),0x8));return db[_0x7e88('0x2c')][_0x7e88('0x74')](_0xf7613f)[_0x7e88('0x23')](function(_0x4ee21b){var _0x8197d={'role':_0x50e9c6[_0x7e88('0x75')][_0x7e88('0x76')],'userProfileId':_0x50e9c6[_0x7e88('0x75')][_0x7e88('0x77')]};if(!_0x8197d)throw new Error(_0x7e88('0x78'));if(_0x8197d[_0x7e88('0x76')]===_0x7e88('0x79')){var _0x4d916e=_0x4ee21b['get']({'plain':!![]});return db['UserProfileSection'][_0x7e88('0x49')]({'where':{'name':'Sounds','userProfileId':_0x8197d['userProfileId']},'raw':!![]})[_0x7e88('0x23')](function(_0x5f439a){if(_0x5f439a&&_0x5f439a[_0x7e88('0x7a')]===0x0){return db[_0x7e88('0x7b')]['create']({'name':_0x4d916e[_0x7e88('0x2a')],'resourceId':_0x4d916e['id'],'type':_0x5f439a[_0x7e88('0x2a')],'sectionId':_0x5f439a['id']},{})[_0x7e88('0x23')](function(){return _0x4ee21b;});}else{return _0x4ee21b;}})[_0x7e88('0x45')](function(_0x2d9708){logger[_0x7e88('0x28')](_0x7e88('0x7c'),_0x2d9708);throw _0x2d9708;});}return _0x4ee21b;})[_0x7e88('0x23')](respondWithResult(_0x2909a8,null))[_0x7e88('0x45')](handleError(_0x2909a8,null));});_0x59a9e9[_0x7e88('0x7d')]();}catch(_0x5b8d3c){_0x2909a8[_0x7e88('0x1a')](0x1f4)[_0x7e88('0x63')](_0x5b8d3c);}};exports['update']=function(_0x9ddabc,_0x4633af,_0x5175ed){return db['Sound'][_0x7e88('0x49')]({'where':{'id':_0x9ddabc['params']['id']}})[_0x7e88('0x23')](handleEntityNotFound(_0x4633af,null))[_0x7e88('0x23')](saveUpdates(_[_0x7e88('0x3d')](_0x9ddabc[_0x7e88('0x75')],[_0x7e88('0x2a'),'description']),null))[_0x7e88('0x23')](respondWithResult(_0x4633af,null))[_0x7e88('0x45')](handleError(_0x4633af,null));};exports[_0x7e88('0x7e')]=function(_0x4f0a72,_0x5d73e9,_0x29dd75){return db[_0x7e88('0x2c')][_0x7e88('0x49')]({'where':{'id':_0x4f0a72[_0x7e88('0x47')]['id']}})[_0x7e88('0x23')](function(_0x31fa4f){if(_0x31fa4f){return _0x31fa4f[_0x7e88('0x26')]();}})[_0x7e88('0x23')](function(_0x543d41){var _0x5bb494=path['join'](config[_0x7e88('0x58')],_0x7e88('0x59'),util[_0x7e88('0x53')](_0x7e88('0x52'),_0x543d41[_0x7e88('0x4b')],_0x543d41[_0x7e88('0x7f')]));var _0x59f16f=path['join'](config['root'],'server/files/sounds/converted',util[_0x7e88('0x53')](_0x7e88('0x52'),_0x543d41['save_name'],_0x543d41[_0x7e88('0x4c')]));fs[_0x7e88('0x62')](_0x5bb494);fs[_0x7e88('0x62')](_0x59f16f);return _0x543d41;})[_0x7e88('0x23')](function(_0x11b7e2){if(_0x11b7e2){return _0x5d73e9[_0x7e88('0x1a')](0xcc)[_0x7e88('0x1b')]();}})[_0x7e88('0x23')](handleEntityNotFound(_0x5d73e9,null))[_0x7e88('0x45')](handleError(_0x5d73e9,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 720eb8b..a6dde9b 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 _0xbfc9=['rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','moment','bluebird','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbfc9,0xff));var _0x9bfc=function(_0x3b6deb,_0x2c6252){_0x3b6deb=_0x3b6deb-0x0;var _0x5ed15b=_0xbfc9[_0x3b6deb];return _0x5ed15b;};'use strict';var _=require(_0x9bfc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9bfc('0x1'));var BPromise=require(_0x9bfc('0x2'));var rp=require(_0x9bfc('0x3'));var fs=require('fs');var path=require(_0x9bfc('0x4'));var rimraf=require(_0x9bfc('0x5'));var config=require(_0x9bfc('0x6'));var attributes=require('./sound.attributes');module[_0x9bfc('0x7')]=function(_0x5844d8,_0x4e0055){return _0x5844d8['define'](_0x9bfc('0x8'),attributes,{'tableName':_0x9bfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29f9=['rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x29f9,0x69));var _0x929f=function(_0x2a141b,_0x5f2e82){_0x2a141b=_0x2a141b-0x0;var _0x2ffaaf=_0x29f9[_0x2a141b];return _0x2ffaaf;};'use strict';var _=require(_0x929f('0x0'));var util=require(_0x929f('0x1'));var logger=require(_0x929f('0x2'))(_0x929f('0x3'));var moment=require(_0x929f('0x4'));var BPromise=require('bluebird');var rp=require(_0x929f('0x5'));var fs=require('fs');var path=require(_0x929f('0x6'));var rimraf=require(_0x929f('0x7'));var config=require(_0x929f('0x8'));var attributes=require(_0x929f('0x9'));module[_0x929f('0xa')]=function(_0x51216f,_0x2087e9){return _0x51216f[_0x929f('0xb')](_0x929f('0xc'),attributes,{'tableName':_0x929f('0xd'),'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 0bc5d3b..7fb4225 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 _0x4c7b=['error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','then','debug','lodash','util','../../mysqldb','rpc','jayson/promise','client','http','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c7b,0xbf));var _0xb4c7=function(_0x19b329,_0x50cb04){_0x19b329=_0x19b329-0x0;var _0x5ce0b7=_0x4c7b[_0x19b329];return _0x5ce0b7;};'use strict';var _=require(_0xb4c7('0x0'));var util=require(_0xb4c7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4c7('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb4c7('0x3'));var config=require('../../config/environment');var jayson=require(_0xb4c7('0x4'));var client=jayson[_0xb4c7('0x5')][_0xb4c7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x474610,_0x512c3f,_0xbd0afc){return new BPromise(function(_0x52baee,_0x5dea5b){return client['request'](_0x474610,_0xbd0afc)['then'](function(_0xfa92d4){logger[_0xb4c7('0x7')](_0xb4c7('0x8'),_0x512c3f,_0xb4c7('0x9'));logger['debug'](_0xb4c7('0xa'),_0x512c3f,_0xb4c7('0x9'),JSON[_0xb4c7('0xb')](_0xfa92d4));if(_0xfa92d4['error']){if(_0xfa92d4[_0xb4c7('0xc')][_0xb4c7('0xd')]===0x1f4){logger[_0xb4c7('0xc')](_0xb4c7('0x8'),_0x512c3f,_0xfa92d4[_0xb4c7('0xc')][_0xb4c7('0xe')]);return _0x5dea5b(_0xfa92d4['error'][_0xb4c7('0xe')]);}logger['error'](_0xb4c7('0x8'),_0x512c3f,_0xfa92d4[_0xb4c7('0xc')][_0xb4c7('0xe')]);return _0x52baee(_0xfa92d4['error']['message']);}else{logger['info'](_0xb4c7('0x8'),_0x512c3f,_0xb4c7('0x9'));_0x52baee(_0xfa92d4[_0xb4c7('0xf')]['message']);}})[_0xb4c7('0x10')](function(_0x5c8081){logger[_0xb4c7('0xc')](_0xb4c7('0x8'),_0x512c3f,_0x5c8081);_0x5dea5b(_0x5c8081);});});}exports[_0xb4c7('0x11')]=function(_0x158c52){var _0x88808b=this;return new Promise(function(_0x563845,_0x264e35){return db[_0xb4c7('0x12')][_0xb4c7('0x13')]({'raw':_0x158c52[_0xb4c7('0x14')]?_0x158c52[_0xb4c7('0x14')][_0xb4c7('0x15')]===undefined?!![]:![]:!![],'where':_0x158c52[_0xb4c7('0x14')]?_0x158c52['options'][_0xb4c7('0x16')]||null:null,'attributes':_0x158c52['options']?_0x158c52[_0xb4c7('0x14')][_0xb4c7('0x17')]||null:null,'include':_0x158c52['options']?_0x158c52['options'][_0xb4c7('0x18')]?_[_0xb4c7('0x19')](_0x158c52['options'][_0xb4c7('0x18')],function(_0x424ff1){return{'model':db[_0x424ff1[_0xb4c7('0x1a')]],'as':_0x424ff1['as'],'attributes':_0x424ff1['attributes'],'include':_0x424ff1[_0xb4c7('0x18')]?_[_0xb4c7('0x19')](_0x424ff1[_0xb4c7('0x18')],function(_0x2fdf10){return{'model':db[_0x2fdf10[_0xb4c7('0x1a')]],'as':_0x2fdf10['as'],'attributes':_0x2fdf10[_0xb4c7('0x17')],'include':_0x2fdf10['include']?_[_0xb4c7('0x19')](_0x2fdf10[_0xb4c7('0x18')],function(_0x23cae2){return{'model':db[_0x23cae2[_0xb4c7('0x1a')]],'as':_0x23cae2['as'],'attributes':_0x23cae2[_0xb4c7('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb4c7('0x1b')](function(_0x1d5415){logger['info'](_0xb4c7('0x11'),_0x158c52);logger[_0xb4c7('0x1c')](_0xb4c7('0x11'),_0x158c52,JSON[_0xb4c7('0xb')](_0x1d5415));_0x563845(_0x1d5415);})['catch'](function(_0x43d83e){logger['error'](_0xb4c7('0x11'),_0x43d83e[_0xb4c7('0xe')],_0x158c52);_0x264e35(_0x88808b[_0xb4c7('0xc')](0x1f4,_0x43d83e[_0xb4c7('0xe')]));});});}; \ No newline at end of file +var _0xa4c9=['then','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','Sound,\x20%s,\x20%s','message','result','ShowSound','Sound','find','options','raw','where','map','include','attributes','model','info','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa4c9,0x78));var _0x9a4c=function(_0x102a36,_0x576780){_0x102a36=_0x102a36-0x0;var _0x4e11e6=_0xa4c9[_0x102a36];return _0x4e11e6;};'use strict';var _=require(_0x9a4c('0x0'));var util=require(_0x9a4c('0x1'));var moment=require(_0x9a4c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a4c('0x3'));var db=require(_0x9a4c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a4c('0x5'))(_0x9a4c('0x6'));var config=require(_0x9a4c('0x7'));var jayson=require(_0x9a4c('0x8'));var client=jayson[_0x9a4c('0x9')][_0x9a4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197c38,_0x42a452,_0x1322bf){return new BPromise(function(_0x5742da,_0x5cc8b4){return client[_0x9a4c('0xb')](_0x197c38,_0x1322bf)[_0x9a4c('0xc')](function(_0x13c567){logger['info']('Sound,\x20%s,\x20%s',_0x42a452,_0x9a4c('0xd'));logger[_0x9a4c('0xe')](_0x9a4c('0xf'),_0x42a452,_0x9a4c('0xd'),JSON['stringify'](_0x13c567));if(_0x13c567[_0x9a4c('0x10')]){if(_0x13c567[_0x9a4c('0x10')]['code']===0x1f4){logger[_0x9a4c('0x10')](_0x9a4c('0x11'),_0x42a452,_0x13c567[_0x9a4c('0x10')][_0x9a4c('0x12')]);return _0x5cc8b4(_0x13c567['error']['message']);}logger[_0x9a4c('0x10')](_0x9a4c('0x11'),_0x42a452,_0x13c567[_0x9a4c('0x10')][_0x9a4c('0x12')]);return _0x5742da(_0x13c567[_0x9a4c('0x10')][_0x9a4c('0x12')]);}else{logger['info'](_0x9a4c('0x11'),_0x42a452,_0x9a4c('0xd'));_0x5742da(_0x13c567[_0x9a4c('0x13')]['message']);}})['catch'](function(_0x2e9402){logger[_0x9a4c('0x10')](_0x9a4c('0x11'),_0x42a452,_0x2e9402);_0x5cc8b4(_0x2e9402);});});}exports[_0x9a4c('0x14')]=function(_0x191534){var _0x3af115=this;return new Promise(function(_0x14b16a,_0x282f5a){return db[_0x9a4c('0x15')][_0x9a4c('0x16')]({'raw':_0x191534[_0x9a4c('0x17')]?_0x191534[_0x9a4c('0x17')][_0x9a4c('0x18')]===undefined?!![]:![]:!![],'where':_0x191534[_0x9a4c('0x17')]?_0x191534[_0x9a4c('0x17')][_0x9a4c('0x19')]||null:null,'attributes':_0x191534[_0x9a4c('0x17')]?_0x191534['options']['attributes']||null:null,'include':_0x191534[_0x9a4c('0x17')]?_0x191534[_0x9a4c('0x17')]['include']?_[_0x9a4c('0x1a')](_0x191534[_0x9a4c('0x17')][_0x9a4c('0x1b')],function(_0x1a294d){return{'model':db[_0x1a294d['model']],'as':_0x1a294d['as'],'attributes':_0x1a294d[_0x9a4c('0x1c')],'include':_0x1a294d[_0x9a4c('0x1b')]?_[_0x9a4c('0x1a')](_0x1a294d['include'],function(_0x5c5ea2){return{'model':db[_0x5c5ea2[_0x9a4c('0x1d')]],'as':_0x5c5ea2['as'],'attributes':_0x5c5ea2[_0x9a4c('0x1c')],'include':_0x5c5ea2[_0x9a4c('0x1b')]?_[_0x9a4c('0x1a')](_0x5c5ea2[_0x9a4c('0x1b')],function(_0x4a8d31){return{'model':db[_0x4a8d31[_0x9a4c('0x1d')]],'as':_0x4a8d31['as'],'attributes':_0x4a8d31[_0x9a4c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f3a0){logger[_0x9a4c('0x1e')](_0x9a4c('0x14'),_0x191534);logger[_0x9a4c('0xe')](_0x9a4c('0x14'),_0x191534,JSON[_0x9a4c('0x1f')](_0x4f3a0));_0x14b16a(_0x4f3a0);})[_0x9a4c('0x20')](function(_0x9e1a45){logger['error'](_0x9a4c('0x14'),_0x9e1a45[_0x9a4c('0x12')],_0x191534);_0x282f5a(_0x3af115[_0x9a4c('0x10')](0x1f4,_0x9e1a45[_0x9a4c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 966e000..224a14b 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 _0xed49=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4de31f,_0x5118c4){var _0x2477d3=function(_0x324ab2){while(--_0x324ab2){_0x4de31f['push'](_0x4de31f['shift']());}};_0x2477d3(++_0x5118c4);}(_0xed49,0x8f));var _0x9ed4=function(_0x4d6f08,_0x512ca3){_0x4d6f08=_0x4d6f08-0x0;var _0x2badde=_0xed49[_0x4d6f08];return _0x2badde;};'use strict';var multer=require(_0x9ed4('0x0'));var util=require(_0x9ed4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9ed4('0x2'));var router=express[_0x9ed4('0x3')]();var fs_extra=require(_0x9ed4('0x4'));var auth=require(_0x9ed4('0x5'));var interaction=require(_0x9ed4('0x6'));var config=require(_0x9ed4('0x7'));var controller=require(_0x9ed4('0x8'));router[_0x9ed4('0x9')]('/',auth[_0x9ed4('0xa')](),controller['index']);router['get']('/:id',auth[_0x9ed4('0xa')](),controller['show']);router[_0x9ed4('0xb')]('/',auth[_0x9ed4('0xa')](),controller['create']);router[_0x9ed4('0xc')](_0x9ed4('0xd'),auth[_0x9ed4('0xa')](),controller[_0x9ed4('0xe')]);router[_0x9ed4('0xf')](_0x9ed4('0xd'),auth[_0x9ed4('0xa')](),controller[_0x9ed4('0x10')]);module[_0x9ed4('0x11')]=router; \ No newline at end of file +var _0x7623=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','post','isAuthenticated','create','put','/:id'];(function(_0x15eedc,_0x59cbb5){var _0xcbc94f=function(_0x24b291){while(--_0x24b291){_0x15eedc['push'](_0x15eedc['shift']());}};_0xcbc94f(++_0x59cbb5);}(_0x7623,0x9c));var _0x3762=function(_0x89cb3a,_0x385fd1){_0x89cb3a=_0x89cb3a-0x0;var _0x407cf1=_0x7623[_0x89cb3a];return _0x407cf1;};'use strict';var multer=require(_0x3762('0x0'));var util=require(_0x3762('0x1'));var path=require('path');var timeout=require(_0x3762('0x2'));var express=require('express');var router=express[_0x3762('0x3')]();var fs_extra=require(_0x3762('0x4'));var auth=require(_0x3762('0x5'));var interaction=require(_0x3762('0x6'));var config=require(_0x3762('0x7'));var controller=require(_0x3762('0x8'));router[_0x3762('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3762('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3762('0xa')]('/',auth[_0x3762('0xb')](),controller[_0x3762('0xc')]);router[_0x3762('0xd')](_0x3762('0xe'),auth[_0x3762('0xb')](),controller[_0x3762('0xf')]);router[_0x3762('0x10')](_0x3762('0xe'),auth[_0x3762('0xb')](),controller[_0x3762('0x11')]);module[_0x3762('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 aaae9d1..09f5d0b 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 _0x44e8=['TEXT','medium','ENUM','out','STRING','sequelize'];(function(_0x429586,_0x3735ec){var _0x8f1053=function(_0x1a3dcb){while(--_0x1a3dcb){_0x429586['push'](_0x429586['shift']());}};_0x8f1053(++_0x3735ec);}(_0x44e8,0xd7));var _0x844e=function(_0x26d9ce,_0x126a0e){_0x26d9ce=_0x26d9ce-0x0;var _0x187bb3=_0x44e8[_0x26d9ce];return _0x187bb3;};'use strict';var Sequelize=require(_0x844e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x844e('0x1')](_0x844e('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x844e('0x3')]('in',_0x844e('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x844e('0x5')]},'providerResponse':{'type':Sequelize[_0x844e('0x1')]}}; \ No newline at end of file +var _0x98a8=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x32882c,_0x45ad14){var _0x5f3c9f=function(_0x23088e){while(--_0x23088e){_0x32882c['push'](_0x32882c['shift']());}};_0x5f3c9f(++_0x45ad14);}(_0x98a8,0x12c));var _0x898a=function(_0x57a753,_0xb8aebd){_0x57a753=_0x57a753-0x0;var _0x3a73ea=_0x98a8[_0x57a753];return _0x3a73ea;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'uniqueid':{'type':Sequelize[_0x898a('0x2')]},'body':{'type':Sequelize[_0x898a('0x3')](_0x898a('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x898a('0x5')]('in',_0x898a('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x898a('0x2')]},'providerResponse':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 13d7fca..6c219d2 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 _0xe40c=['pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','create','body','update','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','set','reject','save','then','sendStatus','error','stack','name','index','SquareMessage','rawAttributes','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x3b5462,_0x7ede10){var _0x6616a1=function(_0x19553e){while(--_0x19553e){_0x3b5462['push'](_0x3b5462['shift']());}};_0x6616a1(++_0x7ede10);}(_0xe40c,0x1cd));var _0xce40=function(_0x50b16c,_0x5e9cce){_0x50b16c=_0x50b16c-0x0;var _0x4e939a=_0xe40c[_0x50b16c];return _0x4e939a;};'use strict';var pdf=require(_0xce40('0x0'));var emlformat=require(_0xce40('0x1'));var rimraf=require(_0xce40('0x2'));var zipdir=require(_0xce40('0x3'));var jsonpatch=require(_0xce40('0x4'));var rp=require(_0xce40('0x5'));var moment=require(_0xce40('0x6'));var BPromise=require(_0xce40('0x7'));var Mustache=require(_0xce40('0x8'));var util=require(_0xce40('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xce40('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce40('0xb'));var _=require('lodash');var squel=require(_0xce40('0xc'));var crypto=require(_0xce40('0xd'));var jsforce=require(_0xce40('0xe'));var deskjs=require(_0xce40('0xf'));var toCsv=require(_0xce40('0xa'));var querystring=require(_0xce40('0x10'));var Papa=require(_0xce40('0x11'));var Redis=require(_0xce40('0x12'));var authService=require(_0xce40('0x13'));var qs=require(_0xce40('0x14'));var as=require(_0xce40('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xce40('0x16'));var utils=require(_0xce40('0x17'));var config=require(_0xce40('0x18'));var licenseUtil=require(_0xce40('0x19'));var db=require(_0xce40('0x1a'))['db'];function respondWithStatusCode(_0x1cec77,_0x244f5f){_0x244f5f=_0x244f5f||0xcc;return function(_0x1f00e2){if(_0x1f00e2){return _0x1cec77['sendStatus'](_0x244f5f);}return _0x1cec77[_0xce40('0x1b')](_0x244f5f)['end']();};}function respondWithResult(_0xcf99b4,_0x2f4a38){_0x2f4a38=_0x2f4a38||0xc8;return function(_0x4b1e06){if(_0x4b1e06){return _0xcf99b4[_0xce40('0x1b')](_0x2f4a38)[_0xce40('0x1c')](_0x4b1e06);}};}function respondWithFilteredResult(_0x3a1001,_0x10e466){return function(_0x5644da){if(_0x5644da){var _0x1b6283=_0x5644da[_0xce40('0x1d')],_0x2931fb=_0x10e466[_0xce40('0x1e')],_0x51505f=_0x10e466[_0xce40('0x1e')]+_0x10e466['limit'],_0x1cb78b;if(_0x51505f>=_0x1b6283){_0x51505f=_0x1b6283;_0x1cb78b=0xc8;}else{_0x1cb78b=0xce;}_0x3a1001[_0xce40('0x1b')](_0x1cb78b);return _0x3a1001[_0xce40('0x1f')]('Content-Range',_0x2931fb+'-'+_0x51505f+'/'+_0x1b6283)['json'](_0x5644da);}return null;};}function patchUpdates(_0x2b5c0b){return function(_0x516985){try{jsonpatch['apply'](_0x516985,_0x2b5c0b,!![]);}catch(_0xe2b15c){return BPromise[_0xce40('0x20')](_0xe2b15c);}return _0x516985[_0xce40('0x21')]();};}function saveUpdates(_0x16cbfc,_0x454df6){return function(_0x2589f1){if(_0x2589f1){return _0x2589f1['update'](_0x16cbfc)['then'](function(_0x29d7e4){return _0x29d7e4;});}return null;};}function removeEntity(_0x2b5fcf,_0x36488f){return function(_0x23e097){if(_0x23e097){return _0x23e097['destroy']()[_0xce40('0x22')](function(){_0x2b5fcf[_0xce40('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dff3f,_0x5b9a59){return function(_0x2c328d){if(!_0x2c328d){_0x2dff3f[_0xce40('0x23')](0x194);}return _0x2c328d;};}function handleError(_0x16f09d,_0x4a3321){_0x4a3321=_0x4a3321||0x1f4;return function(_0x115408){logger[_0xce40('0x24')](_0x115408[_0xce40('0x25')]);if(_0x115408[_0xce40('0x26')]){delete _0x115408[_0xce40('0x26')];}_0x16f09d[_0xce40('0x1b')](_0x4a3321)['send'](_0x115408);};}exports[_0xce40('0x27')]=function(_0x43b6a0,_0x14abf6){var _0x50efa7={},_0xeb97c8={},_0x504be1={'count':0x0,'rows':[]};var _0x2ba171=_['map'](db[_0xce40('0x28')][_0xce40('0x29')],function(_0x4ddf48){return{'name':_0x4ddf48['fieldName'],'type':_0x4ddf48[_0xce40('0x2a')]['key']};});_0xeb97c8[_0xce40('0x2b')]=_[_0xce40('0x2c')](_0x2ba171,'name');_0xeb97c8['query']=_['keys'](_0x43b6a0[_0xce40('0x2d')]);_0xeb97c8[_0xce40('0x2e')]=_['intersection'](_0xeb97c8[_0xce40('0x2b')],_0xeb97c8[_0xce40('0x2d')]);_0x50efa7['attributes']=_[_0xce40('0x2f')](_0xeb97c8[_0xce40('0x2b')],qs[_0xce40('0x30')](_0x43b6a0[_0xce40('0x2d')][_0xce40('0x30')]));_0x50efa7['attributes']=_0x50efa7[_0xce40('0x31')][_0xce40('0x32')]?_0x50efa7[_0xce40('0x31')]:_0xeb97c8[_0xce40('0x2b')];if(!_0x43b6a0[_0xce40('0x2d')][_0xce40('0x33')](_0xce40('0x34'))){_0x50efa7['limit']=qs[_0xce40('0x35')](_0x43b6a0[_0xce40('0x2d')]['limit']);_0x50efa7[_0xce40('0x1e')]=qs['offset'](_0x43b6a0[_0xce40('0x2d')][_0xce40('0x1e')]);}_0x50efa7[_0xce40('0x36')]=qs[_0xce40('0x37')](_0x43b6a0['query'][_0xce40('0x37')]);_0x50efa7[_0xce40('0x38')]=qs[_0xce40('0x2e')](_[_0xce40('0x39')](_0x43b6a0['query'],_0xeb97c8[_0xce40('0x2e')]),_0x2ba171);if(_0x43b6a0[_0xce40('0x2d')][_0xce40('0x3a')]){_0x50efa7[_0xce40('0x38')]=_[_0xce40('0x3b')](_0x50efa7[_0xce40('0x38')],{'$or':_[_0xce40('0x2c')](_0x2ba171,function(_0x324a3d){if(_0x324a3d[_0xce40('0x2a')]!==_0xce40('0x3c')){var _0x164ec9={};_0x164ec9[_0x324a3d['name']]={'$like':'%'+_0x43b6a0[_0xce40('0x2d')]['filter']+'%'};return _0x164ec9;}})});}_0x50efa7=_['merge']({},_0x50efa7,_0x43b6a0['options']);var _0x139664={'where':_0x50efa7['where']};return db[_0xce40('0x28')]['count'](_0x139664)[_0xce40('0x22')](function(_0x448465){_0x504be1[_0xce40('0x1d')]=_0x448465;if(_0x43b6a0['query'][_0xce40('0x3d')]){_0x50efa7[_0xce40('0x3e')]=[{'all':!![]}];}return db[_0xce40('0x28')][_0xce40('0x3f')](_0x50efa7);})['then'](function(_0x2c555e){_0x504be1['rows']=_0x2c555e;return _0x504be1;})[_0xce40('0x22')](respondWithFilteredResult(_0x14abf6,_0x50efa7))[_0xce40('0x40')](handleError(_0x14abf6,null));};exports[_0xce40('0x41')]=function(_0x9171a4,_0x6b5695){var _0x2ad83b={'raw':!![],'where':{'id':_0x9171a4[_0xce40('0x42')]['id']}},_0x451be3={};_0x451be3[_0xce40('0x2b')]=_[_0xce40('0x43')](db[_0xce40('0x28')]['rawAttributes']);_0x451be3['query']=_[_0xce40('0x43')](_0x9171a4[_0xce40('0x2d')]);_0x451be3[_0xce40('0x2e')]=_[_0xce40('0x2f')](_0x451be3[_0xce40('0x2b')],_0x451be3[_0xce40('0x2d')]);_0x2ad83b['attributes']=_[_0xce40('0x2f')](_0x451be3[_0xce40('0x2b')],qs[_0xce40('0x30')](_0x9171a4[_0xce40('0x2d')]['fields']));_0x2ad83b['attributes']=_0x2ad83b[_0xce40('0x31')][_0xce40('0x32')]?_0x2ad83b[_0xce40('0x31')]:_0x451be3[_0xce40('0x2b')];if(_0x9171a4['query']['includeAll']){_0x2ad83b[_0xce40('0x3e')]=[{'all':!![]}];}_0x2ad83b=_[_0xce40('0x3b')]({},_0x2ad83b,_0x9171a4[_0xce40('0x44')]);return db[_0xce40('0x28')]['find'](_0x2ad83b)[_0xce40('0x22')](handleEntityNotFound(_0x6b5695,null))[_0xce40('0x22')](respondWithResult(_0x6b5695,null))[_0xce40('0x40')](handleError(_0x6b5695,null));};exports['create']=function(_0x1b20a1,_0x1c664b){return db[_0xce40('0x28')][_0xce40('0x45')](_0x1b20a1[_0xce40('0x46')],{})[_0xce40('0x22')](respondWithResult(_0x1c664b,0xc9))[_0xce40('0x40')](handleError(_0x1c664b,null));};exports[_0xce40('0x47')]=function(_0x59088d,_0xdb8234){if(_0x59088d[_0xce40('0x46')]['id']){delete _0x59088d[_0xce40('0x46')]['id'];}return db['SquareMessage'][_0xce40('0x48')]({'where':{'id':_0x59088d[_0xce40('0x42')]['id']}})['then'](handleEntityNotFound(_0xdb8234,null))['then'](saveUpdates(_0x59088d[_0xce40('0x46')],null))[_0xce40('0x22')](respondWithResult(_0xdb8234,null))[_0xce40('0x40')](handleError(_0xdb8234,null));};exports[_0xce40('0x49')]=function(_0x5e0da1,_0x5dbba1){return db[_0xce40('0x28')][_0xce40('0x48')]({'where':{'id':_0x5e0da1[_0xce40('0x42')]['id']}})['then'](handleEntityNotFound(_0x5dbba1,null))['then'](removeEntity(_0x5dbba1,null))[_0xce40('0x40')](handleError(_0x5dbba1,null));}; \ No newline at end of file +var _0x3b00=['set','reject','save','update','then','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x1cef4b,_0x4afe55){var _0xeac263=function(_0x35192c){while(--_0x35192c){_0x1cef4b['push'](_0x1cef4b['shift']());}};_0xeac263(++_0x4afe55);}(_0x3b00,0x1d2));var _0x03b0=function(_0x4d0cac,_0x5c93be){_0x4d0cac=_0x4d0cac-0x0;var _0x19dcf1=_0x3b00[_0x4d0cac];return _0x19dcf1;};'use strict';var pdf=require(_0x03b0('0x0'));var emlformat=require(_0x03b0('0x1'));var rimraf=require(_0x03b0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03b0('0x3'));var rp=require('request-promise');var moment=require(_0x03b0('0x4'));var BPromise=require(_0x03b0('0x5'));var Mustache=require(_0x03b0('0x6'));var util=require('util');var path=require(_0x03b0('0x7'));var sox=require(_0x03b0('0x8'));var csv=require(_0x03b0('0x9'));var ejs=require(_0x03b0('0xa'));var fs=require('fs');var fs_extra=require(_0x03b0('0xb'));var _=require('lodash');var squel=require(_0x03b0('0xc'));var crypto=require(_0x03b0('0xd'));var jsforce=require(_0x03b0('0xe'));var deskjs=require(_0x03b0('0xf'));var toCsv=require(_0x03b0('0x9'));var querystring=require(_0x03b0('0x10'));var Papa=require(_0x03b0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x03b0('0x12'));var as=require(_0x03b0('0x13'));var hardwareService=require(_0x03b0('0x14'));var logger=require('../../config/logger')(_0x03b0('0x15'));var utils=require(_0x03b0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x03b0('0x17'))['db'];function respondWithStatusCode(_0x462c71,_0x3751db){_0x3751db=_0x3751db||0xcc;return function(_0xbc7f61){if(_0xbc7f61){return _0x462c71[_0x03b0('0x18')](_0x3751db);}return _0x462c71[_0x03b0('0x19')](_0x3751db)[_0x03b0('0x1a')]();};}function respondWithResult(_0x234ff7,_0x3b29fe){_0x3b29fe=_0x3b29fe||0xc8;return function(_0x3fe29e){if(_0x3fe29e){return _0x234ff7[_0x03b0('0x19')](_0x3b29fe)[_0x03b0('0x1b')](_0x3fe29e);}};}function respondWithFilteredResult(_0x12ed9d,_0x50f56d){return function(_0x2ea87d){if(_0x2ea87d){var _0x37c26c=_0x2ea87d[_0x03b0('0x1c')],_0x2409ce=_0x50f56d['offset'],_0x744c1b=_0x50f56d[_0x03b0('0x1d')]+_0x50f56d[_0x03b0('0x1e')],_0xe7d7e7;if(_0x744c1b>=_0x37c26c){_0x744c1b=_0x37c26c;_0xe7d7e7=0xc8;}else{_0xe7d7e7=0xce;}_0x12ed9d[_0x03b0('0x19')](_0xe7d7e7);return _0x12ed9d[_0x03b0('0x1f')]('Content-Range',_0x2409ce+'-'+_0x744c1b+'/'+_0x37c26c)[_0x03b0('0x1b')](_0x2ea87d);}return null;};}function patchUpdates(_0x49ffed){return function(_0x52cdae){try{jsonpatch['apply'](_0x52cdae,_0x49ffed,!![]);}catch(_0x54be17){return BPromise[_0x03b0('0x20')](_0x54be17);}return _0x52cdae[_0x03b0('0x21')]();};}function saveUpdates(_0x21d9bb,_0x36c61c){return function(_0x30b6c6){if(_0x30b6c6){return _0x30b6c6[_0x03b0('0x22')](_0x21d9bb)[_0x03b0('0x23')](function(_0x7ac652){return _0x7ac652;});}return null;};}function removeEntity(_0x20499a,_0x4ff127){return function(_0x14ce3b){if(_0x14ce3b){return _0x14ce3b['destroy']()[_0x03b0('0x23')](function(){_0x20499a[_0x03b0('0x19')](0xcc)[_0x03b0('0x1a')]();});}};}function handleEntityNotFound(_0x3e06b7,_0x29436b){return function(_0x1b5c31){if(!_0x1b5c31){_0x3e06b7[_0x03b0('0x18')](0x194);}return _0x1b5c31;};}function handleError(_0x400a46,_0x4be820){_0x4be820=_0x4be820||0x1f4;return function(_0x58935f){logger[_0x03b0('0x24')](_0x58935f['stack']);if(_0x58935f['name']){delete _0x58935f[_0x03b0('0x25')];}_0x400a46[_0x03b0('0x19')](_0x4be820)[_0x03b0('0x26')](_0x58935f);};}exports[_0x03b0('0x27')]=function(_0x51690f,_0x96c391){var _0x4502ac={},_0x4dfa05={},_0x5aee7e={'count':0x0,'rows':[]};var _0x1adc75=_[_0x03b0('0x28')](db[_0x03b0('0x29')][_0x03b0('0x2a')],function(_0x31c034){return{'name':_0x31c034[_0x03b0('0x2b')],'type':_0x31c034['type'][_0x03b0('0x2c')]};});_0x4dfa05[_0x03b0('0x2d')]=_[_0x03b0('0x28')](_0x1adc75,_0x03b0('0x25'));_0x4dfa05[_0x03b0('0x2e')]=_[_0x03b0('0x2f')](_0x51690f[_0x03b0('0x2e')]);_0x4dfa05[_0x03b0('0x30')]=_[_0x03b0('0x31')](_0x4dfa05['model'],_0x4dfa05[_0x03b0('0x2e')]);_0x4502ac['attributes']=_[_0x03b0('0x31')](_0x4dfa05[_0x03b0('0x2d')],qs['fields'](_0x51690f['query'][_0x03b0('0x32')]));_0x4502ac[_0x03b0('0x33')]=_0x4502ac[_0x03b0('0x33')][_0x03b0('0x34')]?_0x4502ac[_0x03b0('0x33')]:_0x4dfa05[_0x03b0('0x2d')];if(!_0x51690f[_0x03b0('0x2e')][_0x03b0('0x35')](_0x03b0('0x36'))){_0x4502ac[_0x03b0('0x1e')]=qs[_0x03b0('0x1e')](_0x51690f[_0x03b0('0x2e')]['limit']);_0x4502ac[_0x03b0('0x1d')]=qs[_0x03b0('0x1d')](_0x51690f[_0x03b0('0x2e')][_0x03b0('0x1d')]);}_0x4502ac['order']=qs['sort'](_0x51690f[_0x03b0('0x2e')]['sort']);_0x4502ac[_0x03b0('0x37')]=qs[_0x03b0('0x30')](_[_0x03b0('0x38')](_0x51690f['query'],_0x4dfa05[_0x03b0('0x30')]),_0x1adc75);if(_0x51690f[_0x03b0('0x2e')][_0x03b0('0x39')]){_0x4502ac['where']=_[_0x03b0('0x3a')](_0x4502ac['where'],{'$or':_[_0x03b0('0x28')](_0x1adc75,function(_0x3a87e6){if(_0x3a87e6[_0x03b0('0x3b')]!=='VIRTUAL'){var _0x14e655={};_0x14e655[_0x3a87e6['name']]={'$like':'%'+_0x51690f[_0x03b0('0x2e')][_0x03b0('0x39')]+'%'};return _0x14e655;}})});}_0x4502ac=_[_0x03b0('0x3a')]({},_0x4502ac,_0x51690f[_0x03b0('0x3c')]);var _0x4663ad={'where':_0x4502ac[_0x03b0('0x37')]};return db[_0x03b0('0x29')]['count'](_0x4663ad)[_0x03b0('0x23')](function(_0x90ecde){_0x5aee7e[_0x03b0('0x1c')]=_0x90ecde;if(_0x51690f[_0x03b0('0x2e')][_0x03b0('0x3d')]){_0x4502ac[_0x03b0('0x3e')]=[{'all':!![]}];}return db[_0x03b0('0x29')][_0x03b0('0x3f')](_0x4502ac);})[_0x03b0('0x23')](function(_0x595594){_0x5aee7e[_0x03b0('0x40')]=_0x595594;return _0x5aee7e;})['then'](respondWithFilteredResult(_0x96c391,_0x4502ac))[_0x03b0('0x41')](handleError(_0x96c391,null));};exports[_0x03b0('0x42')]=function(_0x1f2ede,_0x15ebde){var _0x5c65f0={'raw':!![],'where':{'id':_0x1f2ede['params']['id']}},_0x259789={};_0x259789['model']=_[_0x03b0('0x2f')](db['SquareMessage'][_0x03b0('0x2a')]);_0x259789['query']=_[_0x03b0('0x2f')](_0x1f2ede[_0x03b0('0x2e')]);_0x259789['filters']=_[_0x03b0('0x31')](_0x259789[_0x03b0('0x2d')],_0x259789[_0x03b0('0x2e')]);_0x5c65f0[_0x03b0('0x33')]=_['intersection'](_0x259789[_0x03b0('0x2d')],qs[_0x03b0('0x32')](_0x1f2ede[_0x03b0('0x2e')][_0x03b0('0x32')]));_0x5c65f0[_0x03b0('0x33')]=_0x5c65f0['attributes'][_0x03b0('0x34')]?_0x5c65f0[_0x03b0('0x33')]:_0x259789[_0x03b0('0x2d')];if(_0x1f2ede['query'][_0x03b0('0x3d')]){_0x5c65f0[_0x03b0('0x3e')]=[{'all':!![]}];}_0x5c65f0=_[_0x03b0('0x3a')]({},_0x5c65f0,_0x1f2ede[_0x03b0('0x3c')]);return db[_0x03b0('0x29')][_0x03b0('0x43')](_0x5c65f0)[_0x03b0('0x23')](handleEntityNotFound(_0x15ebde,null))[_0x03b0('0x23')](respondWithResult(_0x15ebde,null))[_0x03b0('0x41')](handleError(_0x15ebde,null));};exports['create']=function(_0x1c54f5,_0x330d42){return db['SquareMessage'][_0x03b0('0x44')](_0x1c54f5[_0x03b0('0x45')],{})[_0x03b0('0x23')](respondWithResult(_0x330d42,0xc9))[_0x03b0('0x41')](handleError(_0x330d42,null));};exports[_0x03b0('0x22')]=function(_0x43d8e5,_0x4886a2){if(_0x43d8e5['body']['id']){delete _0x43d8e5['body']['id'];}return db['SquareMessage'][_0x03b0('0x43')]({'where':{'id':_0x43d8e5[_0x03b0('0x46')]['id']}})[_0x03b0('0x23')](handleEntityNotFound(_0x4886a2,null))[_0x03b0('0x23')](saveUpdates(_0x43d8e5['body'],null))[_0x03b0('0x23')](respondWithResult(_0x4886a2,null))[_0x03b0('0x41')](handleError(_0x4886a2,null));};exports['destroy']=function(_0x8dfdb,_0x40efd2){return db[_0x03b0('0x29')][_0x03b0('0x43')]({'where':{'id':_0x8dfdb[_0x03b0('0x46')]['id']}})[_0x03b0('0x23')](handleEntityNotFound(_0x40efd2,null))[_0x03b0('0x23')](removeEntity(_0x40efd2,null))['catch'](handleError(_0x40efd2,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 2b6c1fd..41651df 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 _0xaffb=['exports','define','SquareMessage','square_messages','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x1e8bce,_0x4bf67d){var _0x4b0dec=function(_0x3bcc62){while(--_0x3bcc62){_0x1e8bce['push'](_0x1e8bce['shift']());}};_0x4b0dec(++_0x4bf67d);}(_0xaffb,0x122));var _0xbaff=function(_0x97c6ea,_0x4cffce){_0x97c6ea=_0x97c6ea-0x0;var _0x2d7f50=_0xaffb[_0x97c6ea];return _0x2d7f50;};'use strict';var _=require(_0xbaff('0x0'));var util=require(_0xbaff('0x1'));var logger=require('../../config/logger')(_0xbaff('0x2'));var moment=require(_0xbaff('0x3'));var BPromise=require('bluebird');var rp=require(_0xbaff('0x4'));var fs=require('fs');var path=require(_0xbaff('0x5'));var rimraf=require(_0xbaff('0x6'));var config=require(_0xbaff('0x7'));var attributes=require(_0xbaff('0x8'));module[_0xbaff('0x9')]=function(_0x3e8b64,_0x5b22a5){return _0x3e8b64[_0xbaff('0xa')](_0xbaff('0xb'),attributes,{'tableName':_0xbaff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf144=['./squareMessage.attributes','define','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x569eb1,_0x170ea4){var _0x50578f=function(_0x57d0f3){while(--_0x57d0f3){_0x569eb1['push'](_0x569eb1['shift']());}};_0x50578f(++_0x170ea4);}(_0xf144,0x130));var _0x4f14=function(_0x9f6378,_0x4d586a){_0x9f6378=_0x9f6378-0x0;var _0x3793bb=_0xf144[_0x9f6378];return _0x3793bb;};'use strict';var _=require(_0x4f14('0x0'));var util=require('util');var logger=require(_0x4f14('0x1'))(_0x4f14('0x2'));var moment=require(_0x4f14('0x3'));var BPromise=require(_0x4f14('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f14('0x5'));var rimraf=require(_0x4f14('0x6'));var config=require(_0x4f14('0x7'));var attributes=require(_0x4f14('0x8'));module['exports']=function(_0x46d8e4,_0x514627){return _0x46d8e4[_0x4f14('0x9')](_0x4f14('0xa'),attributes,{'tableName':_0x4f14('0xb'),'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 5155bc4..589d613 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x36c8f0,_0x134fef){var _0x46e036=function(_0x3796ac){while(--_0x3796ac){_0x36c8f0['push'](_0x36c8f0['shift']());}};_0x46e036(++_0x134fef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=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?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x333921,_0x1e3fef){var _0x2d3980=function(_0x43a858){while(--_0x43a858){_0x333921['push'](_0x333921['shift']());}};_0x2d3980(++_0x1e3fef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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['CreateSquareMessage']=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?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 58d1036..a83831f 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 _0x7333=['create','put','/:id','update','delete','destroy','multer','path','express','Router','fs-extra','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','post'];(function(_0x54bd81,_0x448ee5){var _0x5f08af=function(_0x54f02a){while(--_0x54f02a){_0x54bd81['push'](_0x54bd81['shift']());}};_0x5f08af(++_0x448ee5);}(_0x7333,0x65));var _0x3733=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7333[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x3733('0x0'));var util=require('util');var path=require(_0x3733('0x1'));var timeout=require('connect-timeout');var express=require(_0x3733('0x2'));var router=express[_0x3733('0x3')]();var fs_extra=require(_0x3733('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3733('0x5'));var controller=require(_0x3733('0x6'));router[_0x3733('0x7')]('/',auth[_0x3733('0x8')](),controller[_0x3733('0x9')]);router[_0x3733('0x7')]('/:id',auth[_0x3733('0x8')](),controller[_0x3733('0xa')]);router[_0x3733('0x7')](_0x3733('0xb'),auth[_0x3733('0x8')](),timeout('15s'),controller['test']);router[_0x3733('0xc')]('/',auth[_0x3733('0x8')](),controller[_0x3733('0xd')]);router[_0x3733('0xe')](_0x3733('0xf'),auth[_0x3733('0x8')](),controller[_0x3733('0x10')]);router[_0x3733('0x11')](_0x3733('0xf'),auth[_0x3733('0x8')](),controller[_0x3733('0x12')]);module['exports']=router; \ No newline at end of file +var _0x31be=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s'];(function(_0x444f91,_0x2a61f2){var _0x3248ab=function(_0x2b2279){while(--_0x2b2279){_0x444f91['push'](_0x444f91['shift']());}};_0x3248ab(++_0x2a61f2);}(_0x31be,0x18d));var _0xe31b=function(_0x2557f6,_0x42487f){_0x2557f6=_0x2557f6-0x0;var _0x144ee0=_0x31be[_0x2557f6];return _0x144ee0;};'use strict';var multer=require(_0xe31b('0x0'));var util=require(_0xe31b('0x1'));var path=require(_0xe31b('0x2'));var timeout=require(_0xe31b('0x3'));var express=require(_0xe31b('0x4'));var router=express[_0xe31b('0x5')]();var fs_extra=require(_0xe31b('0x6'));var auth=require(_0xe31b('0x7'));var interaction=require(_0xe31b('0x8'));var config=require('../../config/environment');var controller=require(_0xe31b('0x9'));router[_0xe31b('0xa')]('/',auth[_0xe31b('0xb')](),controller[_0xe31b('0xc')]);router['get'](_0xe31b('0xd'),auth['isAuthenticated'](),controller[_0xe31b('0xe')]);router[_0xe31b('0xa')](_0xe31b('0xf'),auth[_0xe31b('0xb')](),timeout(_0xe31b('0x10')),controller['test']);router[_0xe31b('0x11')]('/',auth[_0xe31b('0xb')](),controller[_0xe31b('0x12')]);router[_0xe31b('0x13')](_0xe31b('0xd'),auth[_0xe31b('0xb')](),controller[_0xe31b('0x14')]);router[_0xe31b('0x15')](_0xe31b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xe31b('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 6d7b8d2..e8ddf38 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 _0xb0be=['exports','STRING','name','sequelize'];(function(_0x4fc702,_0x590060){var _0x1357d3=function(_0x45a119){while(--_0x45a119){_0x4fc702['push'](_0x4fc702['shift']());}};_0x1357d3(++_0x590060);}(_0xb0be,0xb3));var _0xeb0b=function(_0x43329e,_0x3cf69c){_0x43329e=_0x43329e-0x0;var _0x3fafef=_0xb0be[_0x43329e];return _0x3fafef;};'use strict';var Sequelize=require(_0xeb0b('0x0'));module[_0xeb0b('0x1')]={'name':{'type':Sequelize[_0xeb0b('0x2')],'unique':_0xeb0b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xeb0b('0x2')]},'description':{'type':Sequelize[_0xeb0b('0x2')]}}; \ No newline at end of file +var _0xacf9=['sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacf9,0xf8));var _0x9acf=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xacf9[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0x9acf('0x0'));module[_0x9acf('0x1')]={'name':{'type':Sequelize[_0x9acf('0x2')],'unique':_0x9acf('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9acf('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 8834f24..2c6184f 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 _0x4979=['get','ODBC','error','stack','name','send','index','map','SquareOdbc','type','model','query','keys','filters','fields','attributes','length','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','merge','find','create','body','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','openSync','dsn','closeSync','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','status','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x24fac0,_0x442261){var _0x2d4737=function(_0x25084e){while(--_0x25084e){_0x24fac0['push'](_0x24fac0['shift']());}};_0x2d4737(++_0x442261);}(_0x4979,0xd6));var _0x9497=function(_0xefef6f,_0x5f9f66){_0xefef6f=_0xefef6f-0x0;var _0x454173=_0x4979[_0xefef6f];return _0x454173;};'use strict';var pdf=require(_0x9497('0x0'));var emlformat=require(_0x9497('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9497('0x2'));var rp=require('request-promise');var moment=require(_0x9497('0x3'));var BPromise=require(_0x9497('0x4'));var Mustache=require(_0x9497('0x5'));var util=require('util');var path=require(_0x9497('0x6'));var sox=require('sox');var csv=require(_0x9497('0x7'));var ejs=require(_0x9497('0x8'));var fs=require('fs');var fs_extra=require(_0x9497('0x9'));var _=require('lodash');var squel=require(_0x9497('0xa'));var crypto=require(_0x9497('0xb'));var jsforce=require(_0x9497('0xc'));var deskjs=require(_0x9497('0xd'));var toCsv=require(_0x9497('0x7'));var querystring=require('querystring');var Papa=require(_0x9497('0xe'));var Redis=require(_0x9497('0xf'));var authService=require(_0x9497('0x10'));var qs=require(_0x9497('0x11'));var as=require(_0x9497('0x12'));var hardwareService=require(_0x9497('0x13'));var logger=require(_0x9497('0x14'))(_0x9497('0x15'));var utils=require(_0x9497('0x16'));var config=require(_0x9497('0x17'));var licenseUtil=require(_0x9497('0x18'));var db=require(_0x9497('0x19'))['db'];function respondWithStatusCode(_0x29d0c6,_0x5737b8){_0x5737b8=_0x5737b8||0xcc;return function(_0x3451b5){if(_0x3451b5){return _0x29d0c6['sendStatus'](_0x5737b8);}return _0x29d0c6['status'](_0x5737b8)[_0x9497('0x1a')]();};}function respondWithResult(_0x16c510,_0x40f81f){_0x40f81f=_0x40f81f||0xc8;return function(_0x2560c8){if(_0x2560c8){return _0x16c510['status'](_0x40f81f)[_0x9497('0x1b')](_0x2560c8);}};}function respondWithFilteredResult(_0x36ebe1,_0x151fd6){return function(_0x22af0a){if(_0x22af0a){var _0x330208=_0x22af0a[_0x9497('0x1c')],_0x2b2776=_0x151fd6[_0x9497('0x1d')],_0x142f26=_0x151fd6[_0x9497('0x1d')]+_0x151fd6['limit'],_0x3d963a;if(_0x142f26>=_0x330208){_0x142f26=_0x330208;_0x3d963a=0xc8;}else{_0x3d963a=0xce;}_0x36ebe1[_0x9497('0x1e')](_0x3d963a);return _0x36ebe1[_0x9497('0x1f')](_0x9497('0x20'),_0x2b2776+'-'+_0x142f26+'/'+_0x330208)[_0x9497('0x1b')](_0x22af0a);}return null;};}function patchUpdates(_0xc93692){return function(_0x3c44f8){try{jsonpatch[_0x9497('0x21')](_0x3c44f8,_0xc93692,!![]);}catch(_0x1b1a31){return BPromise[_0x9497('0x22')](_0x1b1a31);}return _0x3c44f8[_0x9497('0x23')]();};}function saveUpdates(_0x114c3e,_0x2a87bb){return function(_0x42e3ff){if(_0x42e3ff){return _0x42e3ff['update'](_0x114c3e)[_0x9497('0x24')](function(_0x242b16){return _0x242b16;});}return null;};}function removeEntity(_0x32d271,_0x4a44d5){return function(_0x337cfe){if(_0x337cfe){return _0x337cfe[_0x9497('0x25')]()[_0x9497('0x24')](function(){var _0x24ae2c=_0x337cfe[_0x9497('0x26')]({'plain':!![]});var _0x2589b2=_0x9497('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x2589b2,'resourceId':_0x24ae2c['id']}})['then'](function(){return _0x337cfe;});})['then'](function(){_0x32d271[_0x9497('0x1e')](0xcc)[_0x9497('0x1a')]();});}};}function handleEntityNotFound(_0x4f4fcb,_0x377bbb){return function(_0xddff9){if(!_0xddff9){_0x4f4fcb['sendStatus'](0x194);}return _0xddff9;};}function handleError(_0x74a00f,_0x34e37b){_0x34e37b=_0x34e37b||0x1f4;return function(_0x47fa8b){logger[_0x9497('0x28')](_0x47fa8b[_0x9497('0x29')]);if(_0x47fa8b['name']){delete _0x47fa8b[_0x9497('0x2a')];}_0x74a00f[_0x9497('0x1e')](_0x34e37b)[_0x9497('0x2b')](_0x47fa8b);};}exports[_0x9497('0x2c')]=function(_0xd3cc46,_0x117b4a){var _0x41faa3={},_0x29ac81={},_0x56e4cd={'count':0x0,'rows':[]};var _0x974ad9=_[_0x9497('0x2d')](db[_0x9497('0x2e')]['rawAttributes'],function(_0x59a93a){return{'name':_0x59a93a['fieldName'],'type':_0x59a93a[_0x9497('0x2f')]['key']};});_0x29ac81[_0x9497('0x30')]=_[_0x9497('0x2d')](_0x974ad9,_0x9497('0x2a'));_0x29ac81[_0x9497('0x31')]=_[_0x9497('0x32')](_0xd3cc46[_0x9497('0x31')]);_0x29ac81[_0x9497('0x33')]=_['intersection'](_0x29ac81['model'],_0x29ac81['query']);_0x41faa3['attributes']=_['intersection'](_0x29ac81[_0x9497('0x30')],qs[_0x9497('0x34')](_0xd3cc46[_0x9497('0x31')]['fields']));_0x41faa3[_0x9497('0x35')]=_0x41faa3[_0x9497('0x35')][_0x9497('0x36')]?_0x41faa3[_0x9497('0x35')]:_0x29ac81[_0x9497('0x30')];if(!_0xd3cc46[_0x9497('0x31')]['hasOwnProperty'](_0x9497('0x37'))){_0x41faa3[_0x9497('0x38')]=qs[_0x9497('0x38')](_0xd3cc46['query'][_0x9497('0x38')]);_0x41faa3[_0x9497('0x1d')]=qs[_0x9497('0x1d')](_0xd3cc46['query'][_0x9497('0x1d')]);}_0x41faa3[_0x9497('0x39')]=qs[_0x9497('0x3a')](_0xd3cc46[_0x9497('0x31')][_0x9497('0x3a')]);_0x41faa3['where']=qs['filters'](_[_0x9497('0x3b')](_0xd3cc46[_0x9497('0x31')],_0x29ac81['filters']),_0x974ad9);if(_0xd3cc46[_0x9497('0x31')]['filter']){_0x41faa3[_0x9497('0x3c')]=_['merge'](_0x41faa3['where'],{'$or':_['map'](_0x974ad9,function(_0x33c3c6){if(_0x33c3c6[_0x9497('0x2f')]!==_0x9497('0x3d')){var _0x2c4d36={};_0x2c4d36[_0x33c3c6[_0x9497('0x2a')]]={'$like':'%'+_0xd3cc46[_0x9497('0x31')][_0x9497('0x3e')]+'%'};return _0x2c4d36;}})});}_0x41faa3=_['merge']({},_0x41faa3,_0xd3cc46[_0x9497('0x3f')]);var _0x157a13={'where':_0x41faa3['where']};return db[_0x9497('0x2e')][_0x9497('0x1c')](_0x157a13)[_0x9497('0x24')](function(_0x1fc13a){_0x56e4cd[_0x9497('0x1c')]=_0x1fc13a;if(_0xd3cc46['query'][_0x9497('0x40')]){_0x41faa3[_0x9497('0x41')]=[{'all':!![]}];}return db[_0x9497('0x2e')][_0x9497('0x42')](_0x41faa3);})[_0x9497('0x24')](function(_0x1bba5a){_0x56e4cd['rows']=_0x1bba5a;return _0x56e4cd;})[_0x9497('0x24')](respondWithFilteredResult(_0x117b4a,_0x41faa3))[_0x9497('0x43')](handleError(_0x117b4a,null));};exports[_0x9497('0x44')]=function(_0x2531a6,_0x2148df){var _0x4cb48b={'raw':!![],'where':{'id':_0x2531a6[_0x9497('0x45')]['id']}},_0x4840e1={};_0x4840e1['model']=_[_0x9497('0x32')](db[_0x9497('0x2e')]['rawAttributes']);_0x4840e1[_0x9497('0x31')]=_[_0x9497('0x32')](_0x2531a6[_0x9497('0x31')]);_0x4840e1['filters']=_['intersection'](_0x4840e1['model'],_0x4840e1[_0x9497('0x31')]);_0x4cb48b[_0x9497('0x35')]=_[_0x9497('0x46')](_0x4840e1['model'],qs['fields'](_0x2531a6[_0x9497('0x31')][_0x9497('0x34')]));_0x4cb48b[_0x9497('0x35')]=_0x4cb48b[_0x9497('0x35')][_0x9497('0x36')]?_0x4cb48b[_0x9497('0x35')]:_0x4840e1[_0x9497('0x30')];if(_0x2531a6[_0x9497('0x31')][_0x9497('0x40')]){_0x4cb48b['include']=[{'all':!![]}];}_0x4cb48b=_[_0x9497('0x47')]({},_0x4cb48b,_0x2531a6[_0x9497('0x3f')]);return db[_0x9497('0x2e')][_0x9497('0x48')](_0x4cb48b)['then'](handleEntityNotFound(_0x2148df,null))[_0x9497('0x24')](respondWithResult(_0x2148df,null))['catch'](handleError(_0x2148df,null));};exports[_0x9497('0x49')]=function(_0x1b9f2d,_0x4917cc){return db[_0x9497('0x2e')][_0x9497('0x49')](_0x1b9f2d[_0x9497('0x4a')],{})[_0x9497('0x24')](function(_0x1d657f){var _0x561993=_0x1b9f2d['user'][_0x9497('0x26')]({'plain':!![]});if(!_0x561993)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x561993[_0x9497('0x4b')]==='user'){var _0x5e3f04=_0x1d657f[_0x9497('0x26')]({'plain':!![]});var _0x10697f=_0x9497('0x27');return db[_0x9497('0x4c')][_0x9497('0x48')]({'where':{'name':_0x10697f,'userProfileId':_0x561993[_0x9497('0x4d')]},'raw':!![]})['then'](function(_0x419c19){if(_0x419c19&&_0x419c19['autoAssociation']===0x0){return db['UserProfileResource'][_0x9497('0x49')]({'name':_0x5e3f04[_0x9497('0x2a')],'resourceId':_0x5e3f04['id'],'type':_0x419c19[_0x9497('0x2a')],'sectionId':_0x419c19['id']},{})[_0x9497('0x24')](function(){return _0x1d657f;});}else{return _0x1d657f;}})[_0x9497('0x43')](function(_0x1acf64){logger['error'](_0x9497('0x4e'),_0x1acf64);throw _0x1acf64;});}return _0x1d657f;})['then'](respondWithResult(_0x4917cc,0xc9))[_0x9497('0x43')](handleError(_0x4917cc,null));};exports[_0x9497('0x4f')]=function(_0x55fd04,_0x305b7e){if(_0x55fd04[_0x9497('0x4a')]['id']){delete _0x55fd04[_0x9497('0x4a')]['id'];}return db[_0x9497('0x2e')]['find']({'where':{'id':_0x55fd04[_0x9497('0x45')]['id']}})[_0x9497('0x24')](handleEntityNotFound(_0x305b7e,null))[_0x9497('0x24')](saveUpdates(_0x55fd04[_0x9497('0x4a')],null))['then'](respondWithResult(_0x305b7e,null))[_0x9497('0x43')](handleError(_0x305b7e,null));};exports[_0x9497('0x25')]=function(_0x4503c4,_0x476b64){return db['SquareOdbc']['find']({'where':{'id':_0x4503c4[_0x9497('0x45')]['id']}})[_0x9497('0x24')](handleEntityNotFound(_0x476b64,null))['then'](removeEntity(_0x476b64,null))[_0x9497('0x43')](handleError(_0x476b64,null));};exports[_0x9497('0x50')]=function(_0x31f999,_0x2a1df5,_0x33d1ab){var _0x38d115;return db[_0x9497('0x2e')][_0x9497('0x48')]({'where':{'id':_0x31f999[_0x9497('0x45')]['id']},'attributes':['id','dsn']})[_0x9497('0x24')](handleEntityNotFound(_0x2a1df5,null))[_0x9497('0x24')](function(_0x51d727){if(_0x51d727){var _0x554dd6=require('odbc')();_0x554dd6[_0x9497('0x51')](_0x51d727[_0x9497('0x52')]);_0x554dd6[_0x9497('0x53')]();return _0x51d727;}})[_0x9497('0x24')](respondWithResult(_0x2a1df5,null))['catch'](handleError(_0x2a1df5,null));}; \ No newline at end of file +var _0x7ff6=['apply','reject','save','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareOdbc','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7ff6,0xea));var _0x67ff=function(_0x1ed47d,_0x1f8eec){_0x1ed47d=_0x1ed47d-0x0;var _0x3272de=_0x7ff6[_0x1ed47d];return _0x3272de;};'use strict';var pdf=require(_0x67ff('0x0'));var emlformat=require(_0x67ff('0x1'));var rimraf=require(_0x67ff('0x2'));var zipdir=require(_0x67ff('0x3'));var jsonpatch=require(_0x67ff('0x4'));var rp=require('request-promise');var moment=require(_0x67ff('0x5'));var BPromise=require(_0x67ff('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x67ff('0x7'));var sox=require(_0x67ff('0x8'));var csv=require(_0x67ff('0x9'));var ejs=require(_0x67ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67ff('0xb'));var squel=require(_0x67ff('0xc'));var crypto=require(_0x67ff('0xd'));var jsforce=require(_0x67ff('0xe'));var deskjs=require(_0x67ff('0xf'));var toCsv=require(_0x67ff('0x9'));var querystring=require('querystring');var Papa=require(_0x67ff('0x10'));var Redis=require(_0x67ff('0x11'));var authService=require(_0x67ff('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x67ff('0x13'));var hardwareService=require(_0x67ff('0x14'));var logger=require(_0x67ff('0x15'))(_0x67ff('0x16'));var utils=require('../../config/utils');var config=require(_0x67ff('0x17'));var licenseUtil=require(_0x67ff('0x18'));var db=require(_0x67ff('0x19'))['db'];function respondWithStatusCode(_0x9a80db,_0x290981){_0x290981=_0x290981||0xcc;return function(_0x5553b2){if(_0x5553b2){return _0x9a80db['sendStatus'](_0x290981);}return _0x9a80db[_0x67ff('0x1a')](_0x290981)[_0x67ff('0x1b')]();};}function respondWithResult(_0x44c6f9,_0x561dd2){_0x561dd2=_0x561dd2||0xc8;return function(_0x753b25){if(_0x753b25){return _0x44c6f9[_0x67ff('0x1a')](_0x561dd2)[_0x67ff('0x1c')](_0x753b25);}};}function respondWithFilteredResult(_0x3a5e25,_0x23c132){return function(_0x31f472){if(_0x31f472){var _0x3960ae=_0x31f472[_0x67ff('0x1d')],_0x4e14c6=_0x23c132['offset'],_0x3ba1cc=_0x23c132[_0x67ff('0x1e')]+_0x23c132[_0x67ff('0x1f')],_0x323317;if(_0x3ba1cc>=_0x3960ae){_0x3ba1cc=_0x3960ae;_0x323317=0xc8;}else{_0x323317=0xce;}_0x3a5e25[_0x67ff('0x1a')](_0x323317);return _0x3a5e25[_0x67ff('0x20')]('Content-Range',_0x4e14c6+'-'+_0x3ba1cc+'/'+_0x3960ae)[_0x67ff('0x1c')](_0x31f472);}return null;};}function patchUpdates(_0xa472c3){return function(_0xf89e87){try{jsonpatch[_0x67ff('0x21')](_0xf89e87,_0xa472c3,!![]);}catch(_0x47f464){return BPromise[_0x67ff('0x22')](_0x47f464);}return _0xf89e87[_0x67ff('0x23')]();};}function saveUpdates(_0x1e2cec,_0x2f8895){return function(_0x556c66){if(_0x556c66){return _0x556c66['update'](_0x1e2cec)[_0x67ff('0x24')](function(_0x5c1c0f){return _0x5c1c0f;});}return null;};}function removeEntity(_0x201f87,_0x1c147e){return function(_0x2b43bf){if(_0x2b43bf){return _0x2b43bf[_0x67ff('0x25')]()[_0x67ff('0x24')](function(){var _0x3b977e=_0x2b43bf[_0x67ff('0x26')]({'plain':!![]});var _0x22c833=_0x67ff('0x27');return db[_0x67ff('0x28')][_0x67ff('0x25')]({'where':{'type':_0x22c833,'resourceId':_0x3b977e['id']}})[_0x67ff('0x24')](function(){return _0x2b43bf;});})['then'](function(){_0x201f87[_0x67ff('0x1a')](0xcc)[_0x67ff('0x1b')]();});}};}function handleEntityNotFound(_0x403a77,_0x42c7ce){return function(_0x546f21){if(!_0x546f21){_0x403a77[_0x67ff('0x29')](0x194);}return _0x546f21;};}function handleError(_0x3bb5b5,_0x2d01cd){_0x2d01cd=_0x2d01cd||0x1f4;return function(_0x3ec44f){logger[_0x67ff('0x2a')](_0x3ec44f[_0x67ff('0x2b')]);if(_0x3ec44f[_0x67ff('0x2c')]){delete _0x3ec44f[_0x67ff('0x2c')];}_0x3bb5b5[_0x67ff('0x1a')](_0x2d01cd)[_0x67ff('0x2d')](_0x3ec44f);};}exports[_0x67ff('0x2e')]=function(_0x3d6ac2,_0x4c3446){var _0x3c0507={},_0x59d660={},_0x3ce4a7={'count':0x0,'rows':[]};var _0x4462fb=_[_0x67ff('0x2f')](db[_0x67ff('0x30')]['rawAttributes'],function(_0x2e59c2){return{'name':_0x2e59c2[_0x67ff('0x31')],'type':_0x2e59c2[_0x67ff('0x32')]['key']};});_0x59d660[_0x67ff('0x33')]=_['map'](_0x4462fb,_0x67ff('0x2c'));_0x59d660['query']=_[_0x67ff('0x34')](_0x3d6ac2[_0x67ff('0x35')]);_0x59d660[_0x67ff('0x36')]=_[_0x67ff('0x37')](_0x59d660['model'],_0x59d660[_0x67ff('0x35')]);_0x3c0507[_0x67ff('0x38')]=_['intersection'](_0x59d660[_0x67ff('0x33')],qs[_0x67ff('0x39')](_0x3d6ac2['query'][_0x67ff('0x39')]));_0x3c0507['attributes']=_0x3c0507['attributes'][_0x67ff('0x3a')]?_0x3c0507[_0x67ff('0x38')]:_0x59d660[_0x67ff('0x33')];if(!_0x3d6ac2[_0x67ff('0x35')][_0x67ff('0x3b')](_0x67ff('0x3c'))){_0x3c0507[_0x67ff('0x1f')]=qs['limit'](_0x3d6ac2[_0x67ff('0x35')]['limit']);_0x3c0507[_0x67ff('0x1e')]=qs['offset'](_0x3d6ac2[_0x67ff('0x35')][_0x67ff('0x1e')]);}_0x3c0507['order']=qs[_0x67ff('0x3d')](_0x3d6ac2[_0x67ff('0x35')][_0x67ff('0x3d')]);_0x3c0507[_0x67ff('0x3e')]=qs[_0x67ff('0x36')](_[_0x67ff('0x3f')](_0x3d6ac2[_0x67ff('0x35')],_0x59d660[_0x67ff('0x36')]),_0x4462fb);if(_0x3d6ac2[_0x67ff('0x35')]['filter']){_0x3c0507[_0x67ff('0x3e')]=_['merge'](_0x3c0507['where'],{'$or':_[_0x67ff('0x2f')](_0x4462fb,function(_0x3ebec5){if(_0x3ebec5[_0x67ff('0x32')]!==_0x67ff('0x40')){var _0x1eecea={};_0x1eecea[_0x3ebec5[_0x67ff('0x2c')]]={'$like':'%'+_0x3d6ac2[_0x67ff('0x35')][_0x67ff('0x41')]+'%'};return _0x1eecea;}})});}_0x3c0507=_['merge']({},_0x3c0507,_0x3d6ac2[_0x67ff('0x42')]);var _0x53e1c9={'where':_0x3c0507[_0x67ff('0x3e')]};return db[_0x67ff('0x30')]['count'](_0x53e1c9)[_0x67ff('0x24')](function(_0x3c20e0){_0x3ce4a7['count']=_0x3c20e0;if(_0x3d6ac2[_0x67ff('0x35')][_0x67ff('0x43')]){_0x3c0507[_0x67ff('0x44')]=[{'all':!![]}];}return db[_0x67ff('0x30')][_0x67ff('0x45')](_0x3c0507);})['then'](function(_0x578032){_0x3ce4a7[_0x67ff('0x46')]=_0x578032;return _0x3ce4a7;})[_0x67ff('0x24')](respondWithFilteredResult(_0x4c3446,_0x3c0507))[_0x67ff('0x47')](handleError(_0x4c3446,null));};exports[_0x67ff('0x48')]=function(_0x23242b,_0xdfb733){var _0x252d1e={'raw':!![],'where':{'id':_0x23242b['params']['id']}},_0x2d2673={};_0x2d2673['model']=_[_0x67ff('0x34')](db[_0x67ff('0x30')][_0x67ff('0x49')]);_0x2d2673[_0x67ff('0x35')]=_['keys'](_0x23242b['query']);_0x2d2673[_0x67ff('0x36')]=_[_0x67ff('0x37')](_0x2d2673[_0x67ff('0x33')],_0x2d2673[_0x67ff('0x35')]);_0x252d1e[_0x67ff('0x38')]=_['intersection'](_0x2d2673[_0x67ff('0x33')],qs['fields'](_0x23242b[_0x67ff('0x35')][_0x67ff('0x39')]));_0x252d1e[_0x67ff('0x38')]=_0x252d1e[_0x67ff('0x38')]['length']?_0x252d1e[_0x67ff('0x38')]:_0x2d2673['model'];if(_0x23242b[_0x67ff('0x35')][_0x67ff('0x43')]){_0x252d1e[_0x67ff('0x44')]=[{'all':!![]}];}_0x252d1e=_[_0x67ff('0x4a')]({},_0x252d1e,_0x23242b['options']);return db[_0x67ff('0x30')][_0x67ff('0x4b')](_0x252d1e)['then'](handleEntityNotFound(_0xdfb733,null))[_0x67ff('0x24')](respondWithResult(_0xdfb733,null))['catch'](handleError(_0xdfb733,null));};exports[_0x67ff('0x4c')]=function(_0x7fa842,_0x566969){return db[_0x67ff('0x30')][_0x67ff('0x4c')](_0x7fa842['body'],{})[_0x67ff('0x24')](function(_0x25043b){var _0x1fe614=_0x7fa842[_0x67ff('0x4d')][_0x67ff('0x26')]({'plain':!![]});if(!_0x1fe614)throw new Error(_0x67ff('0x4e'));if(_0x1fe614['role']==='user'){var _0x4973c0=_0x25043b[_0x67ff('0x26')]({'plain':!![]});var _0x1ab65f='ODBC';return db[_0x67ff('0x4f')]['find']({'where':{'name':_0x1ab65f,'userProfileId':_0x1fe614['userProfileId']},'raw':!![]})[_0x67ff('0x24')](function(_0x16eeea){if(_0x16eeea&&_0x16eeea[_0x67ff('0x50')]===0x0){return db[_0x67ff('0x28')][_0x67ff('0x4c')]({'name':_0x4973c0[_0x67ff('0x2c')],'resourceId':_0x4973c0['id'],'type':_0x16eeea[_0x67ff('0x2c')],'sectionId':_0x16eeea['id']},{})[_0x67ff('0x24')](function(){return _0x25043b;});}else{return _0x25043b;}})[_0x67ff('0x47')](function(_0x27f61d){logger['error'](_0x67ff('0x51'),_0x27f61d);throw _0x27f61d;});}return _0x25043b;})[_0x67ff('0x24')](respondWithResult(_0x566969,0xc9))[_0x67ff('0x47')](handleError(_0x566969,null));};exports['update']=function(_0x41a4da,_0x159ef4){if(_0x41a4da[_0x67ff('0x52')]['id']){delete _0x41a4da['body']['id'];}return db[_0x67ff('0x30')][_0x67ff('0x4b')]({'where':{'id':_0x41a4da['params']['id']}})[_0x67ff('0x24')](handleEntityNotFound(_0x159ef4,null))['then'](saveUpdates(_0x41a4da[_0x67ff('0x52')],null))['then'](respondWithResult(_0x159ef4,null))[_0x67ff('0x47')](handleError(_0x159ef4,null));};exports[_0x67ff('0x25')]=function(_0x214e43,_0x233360){return db[_0x67ff('0x30')][_0x67ff('0x4b')]({'where':{'id':_0x214e43[_0x67ff('0x53')]['id']}})['then'](handleEntityNotFound(_0x233360,null))[_0x67ff('0x24')](removeEntity(_0x233360,null))[_0x67ff('0x47')](handleError(_0x233360,null));};exports[_0x67ff('0x54')]=function(_0x504ee8,_0x26c166,_0x182d83){var _0x91d9ad;return db[_0x67ff('0x30')][_0x67ff('0x4b')]({'where':{'id':_0x504ee8[_0x67ff('0x53')]['id']},'attributes':['id',_0x67ff('0x55')]})[_0x67ff('0x24')](handleEntityNotFound(_0x26c166,null))[_0x67ff('0x24')](function(_0x239c01){if(_0x239c01){var _0x150440=require(_0x67ff('0x56'))();_0x150440[_0x67ff('0x57')](_0x239c01[_0x67ff('0x55')]);_0x150440[_0x67ff('0x58')]();return _0x239c01;}})[_0x67ff('0x24')](respondWithResult(_0x26c166,null))[_0x67ff('0x47')](handleError(_0x26c166,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 82116d7..e1e9814 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 _0xecbd=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1f6abe,_0x453fc8){var _0x313776=function(_0x59c992){while(--_0x59c992){_0x1f6abe['push'](_0x1f6abe['shift']());}};_0x313776(++_0x453fc8);}(_0xecbd,0x1a7));var _0xdecb=function(_0xa337c5,_0x48da48){_0xa337c5=_0xa337c5-0x0;var _0x3f4331=_0xecbd[_0xa337c5];return _0x3f4331;};'use strict';var _=require(_0xdecb('0x0'));var util=require(_0xdecb('0x1'));var logger=require(_0xdecb('0x2'))(_0xdecb('0x3'));var moment=require(_0xdecb('0x4'));var BPromise=require('bluebird');var rp=require(_0xdecb('0x5'));var fs=require('fs');var path=require(_0xdecb('0x6'));var rimraf=require(_0xdecb('0x7'));var config=require(_0xdecb('0x8'));var attributes=require(_0xdecb('0x9'));module[_0xdecb('0xa')]=function(_0xc25456,_0x1ca6a6){return _0xc25456[_0xdecb('0xb')]('SquareOdbc',attributes,{'tableName':_0xdecb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfde3=['request-promise','path','../../config/environment','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xfde3,0x19f));var _0x3fde=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfde3[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x3fde('0x0'));var util=require(_0x3fde('0x1'));var logger=require(_0x3fde('0x2'))(_0x3fde('0x3'));var moment=require('moment');var BPromise=require(_0x3fde('0x4'));var rp=require(_0x3fde('0x5'));var fs=require('fs');var path=require(_0x3fde('0x6'));var rimraf=require('rimraf');var config=require(_0x3fde('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x249eb7,_0x278d6e){return _0x249eb7['define'](_0x3fde('0x8'),attributes,{'tableName':_0x3fde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index ad1b21f..2dd8bed 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x4db502,_0x366254){var _0x4ba3b5=function(_0x4080d1){while(--_0x4080d1){_0x4db502['push'](_0x4db502['shift']());}};_0x4ba3b5(++_0x366254);}(_0x7217,0x19e));var _0x7721=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7217[_0x934425];return _0x31d596;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0x3e74,0x175));var _0x43e7=function(_0x1ae046,_0x3ccb20){_0x1ae046=_0x1ae046-0x0;var _0xe47abd=_0x3e74[_0x1ae046];return _0xe47abd;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index bf31c39..930a639 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 _0xffc1=['delete','/:id','destroy','/:id/users','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','show','isAuthenticated','getUsers','post','put'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0xffc1,0x13e));var _0x1ffc=function(_0x5d4797,_0x10abd3){_0x5d4797=_0x5d4797-0x0;var _0x516c6f=_0xffc1[_0x5d4797];return _0x516c6f;};'use strict';var multer=require(_0x1ffc('0x0'));var util=require(_0x1ffc('0x1'));var path=require(_0x1ffc('0x2'));var timeout=require(_0x1ffc('0x3'));var express=require(_0x1ffc('0x4'));var router=express[_0x1ffc('0x5')]();var fs_extra=require(_0x1ffc('0x6'));var auth=require(_0x1ffc('0x7'));var interaction=require(_0x1ffc('0x8'));var config=require(_0x1ffc('0x9'));var controller=require(_0x1ffc('0xa'));router[_0x1ffc('0xb')]('/',auth['isAuthenticated'](),controller[_0x1ffc('0xc')]);router[_0x1ffc('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1ffc('0xd')]);router['get']('/:id/users',auth[_0x1ffc('0xe')](),controller[_0x1ffc('0xf')]);router[_0x1ffc('0x10')]('/',auth[_0x1ffc('0xe')](),controller['create']);router[_0x1ffc('0x10')]('/:id/users',auth['isAuthenticated'](),controller['addUsers']);router[_0x1ffc('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1ffc('0x12')](_0x1ffc('0x13'),auth[_0x1ffc('0xe')](),controller[_0x1ffc('0x14')]);router['delete'](_0x1ffc('0x15'),auth[_0x1ffc('0xe')](),controller[_0x1ffc('0x16')]);module[_0x1ffc('0x17')]=router; \ No newline at end of file +var _0x33f0=['/:id/users','getUsers','create','post','put','update','destroy','delete','removeUsers','exports','multer','util','express','Router','fs-extra','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2e04b1,_0x2292e5){var _0x4fb005=function(_0x242e16){while(--_0x242e16){_0x2e04b1['push'](_0x2e04b1['shift']());}};_0x4fb005(++_0x2292e5);}(_0x33f0,0xba));var _0x033f=function(_0x2f68c1,_0x34964d){_0x2f68c1=_0x2f68c1-0x0;var _0x1597be=_0x33f0[_0x2f68c1];return _0x1597be;};'use strict';var multer=require(_0x033f('0x0'));var util=require(_0x033f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x033f('0x2'));var router=express[_0x033f('0x3')]();var fs_extra=require(_0x033f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x033f('0x5'));var controller=require(_0x033f('0x6'));router[_0x033f('0x7')]('/',auth['isAuthenticated'](),controller[_0x033f('0x8')]);router[_0x033f('0x7')](_0x033f('0x9'),auth[_0x033f('0xa')](),controller[_0x033f('0xb')]);router[_0x033f('0x7')](_0x033f('0xc'),auth[_0x033f('0xa')](),controller[_0x033f('0xd')]);router['post']('/',auth[_0x033f('0xa')](),controller[_0x033f('0xe')]);router[_0x033f('0xf')](_0x033f('0xc'),auth[_0x033f('0xa')](),controller['addUsers']);router[_0x033f('0x10')](_0x033f('0x9'),auth[_0x033f('0xa')](),controller[_0x033f('0x11')]);router['delete'](_0x033f('0x9'),auth['isAuthenticated'](),controller[_0x033f('0x12')]);router[_0x033f('0x13')]('/:id/users',auth[_0x033f('0xa')](),controller[_0x033f('0x14')]);module[_0x033f('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 2bf6adc..cf7d8c1 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 _0xb36c=['toString','utf8','DATE','sequelize','STRING','name','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x318afb,_0x3a3213){var _0x1eb818=function(_0x516a4d){while(--_0x516a4d){_0x318afb['push'](_0x318afb['shift']());}};_0x1eb818(++_0x3a3213);}(_0xb36c,0x1bb));var _0xcb36=function(_0x2d9aed,_0x47cd1f){_0x2d9aed=_0x2d9aed-0x0;var _0x4d1a6d=_0xb36c[_0x2d9aed];return _0x4d1a6d;};'use strict';var Sequelize=require(_0xcb36('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb36('0x1')],'unique':_0xcb36('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xcb36('0x1')]},'notes':{'type':Sequelize[_0xcb36('0x3')]},'preproduction':{'type':Sequelize[_0xcb36('0x4')](_0xcb36('0x5')),'get':function(){if(this[_0xcb36('0x6')]('preproduction')){return this[_0xcb36('0x6')](_0xcb36('0x7'))[_0xcb36('0x8')](_0xcb36('0x9'));}}},'production':{'type':Sequelize[_0xcb36('0x4')](_0xcb36('0x5')),'get':function(){if(this['getDataValue']('production')){return this['getDataValue']('production')[_0xcb36('0x8')](_0xcb36('0x9'));}}},'savedAt':{'type':Sequelize[_0xcb36('0xa')]},'publishedAt':{'type':Sequelize[_0xcb36('0xa')]}}; \ No newline at end of file +var _0x4134=['toString','BLOB','production','DATE','exports','STRING','TEXT','long','getDataValue'];(function(_0x55aec7,_0x5228fc){var _0x36c668=function(_0x1a613d){while(--_0x1a613d){_0x55aec7['push'](_0x55aec7['shift']());}};_0x36c668(++_0x5228fc);}(_0x4134,0x1c6));var _0x4413=function(_0x4ed703,_0x33a4bd){_0x4ed703=_0x4ed703-0x0;var _0xf9bfe2=_0x4134[_0x4ed703];return _0xf9bfe2;};'use strict';var Sequelize=require('sequelize');module[_0x4413('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x4413('0x1')]},'notes':{'type':Sequelize[_0x4413('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0x4413('0x3')),'get':function(){if(this[_0x4413('0x4')]('preproduction')){return this['getDataValue']('preproduction')[_0x4413('0x5')]('utf8');}}},'production':{'type':Sequelize[_0x4413('0x6')](_0x4413('0x3')),'get':function(){if(this['getDataValue']('production')){return this[_0x4413('0x4')](_0x4413('0x7'))[_0x4413('0x5')]('utf8');}}},'savedAt':{'type':Sequelize[_0x4413('0x8')]},'publishedAt':{'type':Sequelize[_0x4413('0x8')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index dbd3fb0..6fc508d 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 _0x11d3=['destroy','SquareProjects','end','error','name','send','SquareProject','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','params','addUsers','ids','isArray','userSquareProject:remove','emit','getUsers','findOne','User','pick','filter','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','count','offset','limit','Content-Range','json','update','then'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x11d3,0x1ac));var _0x311d=function(_0x249005,_0x5047ac){_0x249005=_0x249005-0x0;var _0x21b286=_0x11d3[_0x249005];return _0x21b286;};'use strict';var pdf=require(_0x311d('0x0'));var emlformat=require(_0x311d('0x1'));var rimraf=require(_0x311d('0x2'));var zipdir=require(_0x311d('0x3'));var jsonpatch=require(_0x311d('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x311d('0x5'));var Mustache=require(_0x311d('0x6'));var util=require(_0x311d('0x7'));var path=require(_0x311d('0x8'));var sox=require(_0x311d('0x9'));var csv=require(_0x311d('0xa'));var ejs=require(_0x311d('0xb'));var fs=require('fs');var fs_extra=require(_0x311d('0xc'));var _=require(_0x311d('0xd'));var squel=require('squel');var crypto=require(_0x311d('0xe'));var jsforce=require(_0x311d('0xf'));var deskjs=require(_0x311d('0x10'));var toCsv=require(_0x311d('0xa'));var querystring=require('querystring');var Papa=require(_0x311d('0x11'));var Redis=require(_0x311d('0x12'));var authService=require(_0x311d('0x13'));var qs=require(_0x311d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x311d('0x15'));var logger=require(_0x311d('0x16'))(_0x311d('0x17'));var utils=require(_0x311d('0x18'));var config=require(_0x311d('0x19'));var licenseUtil=require(_0x311d('0x1a'));var db=require(_0x311d('0x1b'))['db'];config[_0x311d('0x1c')]=_[_0x311d('0x1d')](config[_0x311d('0x1c')],{'host':_0x311d('0x1e'),'port':0x18eb});var socket=require(_0x311d('0x1f'))(new Redis(config[_0x311d('0x1c')]));require(_0x311d('0x20'))['register'](socket);function respondWithStatusCode(_0x24a823,_0xc8d97a){_0xc8d97a=_0xc8d97a||0xcc;return function(_0x53ccf2){if(_0x53ccf2){return _0x24a823[_0x311d('0x21')](_0xc8d97a);}return _0x24a823[_0x311d('0x22')](_0xc8d97a)['end']();};}function respondWithResult(_0xe93dbc,_0x50b87d){_0x50b87d=_0x50b87d||0xc8;return function(_0xe833d0){if(_0xe833d0){return _0xe93dbc[_0x311d('0x22')](_0x50b87d)['json'](_0xe833d0);}};}function respondWithFilteredResult(_0x4124ea,_0x3a020d){return function(_0xf3a84a){if(_0xf3a84a){var _0x130a85=_0xf3a84a[_0x311d('0x23')],_0x1d31da=_0x3a020d[_0x311d('0x24')],_0x75882e=_0x3a020d[_0x311d('0x24')]+_0x3a020d[_0x311d('0x25')],_0x234a42;if(_0x75882e>=_0x130a85){_0x75882e=_0x130a85;_0x234a42=0xc8;}else{_0x234a42=0xce;}_0x4124ea[_0x311d('0x22')](_0x234a42);return _0x4124ea['set'](_0x311d('0x26'),_0x1d31da+'-'+_0x75882e+'/'+_0x130a85)[_0x311d('0x27')](_0xf3a84a);}return null;};}function patchUpdates(_0x800ad4){return function(_0x15a40a){try{jsonpatch['apply'](_0x15a40a,_0x800ad4,!![]);}catch(_0x4a6bb2){return BPromise['reject'](_0x4a6bb2);}return _0x15a40a['save']();};}function saveUpdates(_0x2f0f47,_0x87c5e2){return function(_0x4283c2){if(_0x4283c2){return _0x4283c2[_0x311d('0x28')](_0x2f0f47)[_0x311d('0x29')](function(_0x284a55){return _0x284a55;});}return null;};}function removeEntity(_0x4182dc,_0x8f3151){return function(_0x26b104){if(_0x26b104){return _0x26b104[_0x311d('0x2a')]()['then'](function(){var _0x1ff9f6=_0x26b104['get']({'plain':!![]});var _0x2bd5d2=_0x311d('0x2b');return db['UserProfileResource'][_0x311d('0x2a')]({'where':{'type':_0x2bd5d2,'resourceId':_0x1ff9f6['id']}})['then'](function(){return _0x26b104;});})[_0x311d('0x29')](function(){_0x4182dc[_0x311d('0x22')](0xcc)[_0x311d('0x2c')]();});}};}function handleEntityNotFound(_0x740861,_0x455f24){return function(_0x15cbaf){if(!_0x15cbaf){_0x740861['sendStatus'](0x194);}return _0x15cbaf;};}function handleError(_0x1f7464,_0x1473a3){_0x1473a3=_0x1473a3||0x1f4;return function(_0x5afbbb){logger[_0x311d('0x2d')](_0x5afbbb['stack']);if(_0x5afbbb[_0x311d('0x2e')]){delete _0x5afbbb[_0x311d('0x2e')];}_0x1f7464['status'](_0x1473a3)[_0x311d('0x2f')](_0x5afbbb);};}exports['index']=function(_0x56a14a,_0x28a064){var _0x5ab125={},_0x36d1ef={},_0xfd5a7c={'count':0x0,'rows':[]};var _0x366df6=_['map'](db[_0x311d('0x30')]['rawAttributes'],function(_0x113eaf){return{'name':_0x113eaf[_0x311d('0x31')],'type':_0x113eaf[_0x311d('0x32')][_0x311d('0x33')]};});_0x36d1ef['model']=_[_0x311d('0x34')](_0x366df6,_0x311d('0x2e'));_0x36d1ef[_0x311d('0x35')]=_['keys'](_0x56a14a[_0x311d('0x35')]);_0x36d1ef[_0x311d('0x36')]=_[_0x311d('0x37')](_0x36d1ef[_0x311d('0x38')],_0x36d1ef[_0x311d('0x35')]);_0x5ab125[_0x311d('0x39')]=_[_0x311d('0x37')](_0x36d1ef[_0x311d('0x38')],qs[_0x311d('0x3a')](_0x56a14a[_0x311d('0x35')][_0x311d('0x3a')]));_0x5ab125[_0x311d('0x39')]=_0x5ab125[_0x311d('0x39')]['length']?_0x5ab125[_0x311d('0x39')]:_0x36d1ef[_0x311d('0x38')];if(!_0x56a14a['query'][_0x311d('0x3b')](_0x311d('0x3c'))){_0x5ab125[_0x311d('0x25')]=qs[_0x311d('0x25')](_0x56a14a[_0x311d('0x35')][_0x311d('0x25')]);_0x5ab125['offset']=qs['offset'](_0x56a14a['query'][_0x311d('0x24')]);}_0x5ab125[_0x311d('0x3d')]=qs[_0x311d('0x3e')](_0x56a14a[_0x311d('0x35')]['sort']);_0x5ab125[_0x311d('0x3f')]=qs[_0x311d('0x36')](_['pick'](_0x56a14a[_0x311d('0x35')],_0x36d1ef[_0x311d('0x36')]),_0x366df6);if(_0x56a14a[_0x311d('0x35')]['filter']){_0x5ab125['where']=_[_0x311d('0x40')](_0x5ab125[_0x311d('0x3f')],{'$or':_[_0x311d('0x34')](_0x366df6,function(_0x4d82bd){if(_0x4d82bd[_0x311d('0x32')]!==_0x311d('0x41')){var _0x20f1d5={};_0x20f1d5[_0x4d82bd[_0x311d('0x2e')]]={'$like':'%'+_0x56a14a['query']['filter']+'%'};return _0x20f1d5;}})});}_0x5ab125=_[_0x311d('0x40')]({},_0x5ab125,_0x56a14a[_0x311d('0x42')]);var _0x370fad={'where':_0x5ab125[_0x311d('0x3f')]};return db[_0x311d('0x30')][_0x311d('0x23')](_0x370fad)[_0x311d('0x29')](function(_0xa41efa){_0xfd5a7c[_0x311d('0x23')]=_0xa41efa;if(_0x56a14a[_0x311d('0x35')][_0x311d('0x43')]){_0x5ab125[_0x311d('0x44')]=[{'all':!![]}];}return db[_0x311d('0x30')]['findAll'](_0x5ab125);})[_0x311d('0x29')](function(_0x48f52c){_0xfd5a7c[_0x311d('0x45')]=_0x48f52c;return _0xfd5a7c;})[_0x311d('0x29')](respondWithFilteredResult(_0x28a064,_0x5ab125))[_0x311d('0x46')](handleError(_0x28a064,null));};exports[_0x311d('0x47')]=function(_0x2ec39d,_0x96dcb){var _0x488e7f={'raw':![],'where':{'id':_0x2ec39d['params']['id']}},_0x53f498={};_0x53f498[_0x311d('0x38')]=_[_0x311d('0x48')](db[_0x311d('0x30')][_0x311d('0x49')]);_0x53f498[_0x311d('0x35')]=_['keys'](_0x2ec39d[_0x311d('0x35')]);_0x53f498[_0x311d('0x36')]=_['intersection'](_0x53f498['model'],_0x53f498['query']);_0x488e7f['attributes']=_['intersection'](_0x53f498['model'],qs[_0x311d('0x3a')](_0x2ec39d[_0x311d('0x35')][_0x311d('0x3a')]));_0x488e7f['attributes']=_0x488e7f[_0x311d('0x39')][_0x311d('0x4a')]?_0x488e7f[_0x311d('0x39')]:_0x53f498[_0x311d('0x38')];if(_0x2ec39d[_0x311d('0x35')][_0x311d('0x43')]){_0x488e7f[_0x311d('0x44')]=[{'all':!![]}];}_0x488e7f=_[_0x311d('0x40')]({},_0x488e7f,_0x2ec39d[_0x311d('0x42')]);return db[_0x311d('0x30')][_0x311d('0x4b')](_0x488e7f)[_0x311d('0x29')](handleEntityNotFound(_0x96dcb,null))[_0x311d('0x29')](respondWithResult(_0x96dcb,null))['catch'](handleError(_0x96dcb,null));};exports['create']=function(_0xf5288d,_0x4ff1df){return db['SquareProject'][_0x311d('0x4c')](_0xf5288d[_0x311d('0x4d')],{})[_0x311d('0x29')](function(_0x3aa923){var _0x23cd89=_0xf5288d[_0x311d('0x4e')]['get']({'plain':!![]});if(!_0x23cd89)throw new Error(_0x311d('0x4f'));if(_0x23cd89['role']===_0x311d('0x4e')){var _0x33f565=_0x3aa923[_0x311d('0x50')]({'plain':!![]});var _0x23a66a=_0x311d('0x2b');return db[_0x311d('0x51')][_0x311d('0x4b')]({'where':{'name':_0x23a66a,'userProfileId':_0x23cd89[_0x311d('0x52')]},'raw':!![]})[_0x311d('0x29')](function(_0x266d5a){if(_0x266d5a&&_0x266d5a['autoAssociation']===0x0){return db['UserProfileResource'][_0x311d('0x4c')]({'name':_0x33f565[_0x311d('0x2e')],'resourceId':_0x33f565['id'],'type':_0x266d5a[_0x311d('0x2e')],'sectionId':_0x266d5a['id']},{})[_0x311d('0x29')](function(){return _0x3aa923;});}else{return _0x3aa923;}})[_0x311d('0x46')](function(_0x21197c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21197c);throw _0x21197c;});}return _0x3aa923;})[_0x311d('0x29')](respondWithResult(_0x4ff1df,0xc9))[_0x311d('0x46')](handleError(_0x4ff1df,null));};exports[_0x311d('0x28')]=function(_0x163c10,_0x263f30){if(_0x163c10[_0x311d('0x4d')]['id']){delete _0x163c10['body']['id'];}return db['SquareProject'][_0x311d('0x4b')]({'where':{'id':_0x163c10[_0x311d('0x53')]['id']}})['then'](handleEntityNotFound(_0x263f30,null))[_0x311d('0x29')](saveUpdates(_0x163c10[_0x311d('0x4d')],null))[_0x311d('0x29')](respondWithResult(_0x263f30,null))[_0x311d('0x46')](handleError(_0x263f30,null));};exports['destroy']=function(_0x5a61f8,_0x385345){return db[_0x311d('0x30')]['find']({'where':{'id':_0x5a61f8[_0x311d('0x53')]['id']}})[_0x311d('0x29')](handleEntityNotFound(_0x385345,null))[_0x311d('0x29')](removeEntity(_0x385345,null))['catch'](handleError(_0x385345,null));};exports[_0x311d('0x54')]=function(_0x187301,_0x478c10,_0x36b6ed){return db[_0x311d('0x30')][_0x311d('0x4b')]({'where':{'id':_0x187301[_0x311d('0x53')]['id']}})[_0x311d('0x29')](handleEntityNotFound(_0x478c10,null))[_0x311d('0x29')](function(_0x6efa87){if(_0x6efa87){return _0x6efa87['addUsers'](_0x187301[_0x311d('0x4d')][_0x311d('0x55')],_['omit'](_0x187301[_0x311d('0x4d')],[_0x311d('0x55'),'id'])||{});}})[_0x311d('0x29')](respondWithResult(_0x478c10,null))[_0x311d('0x46')](handleError(_0x478c10,null));};exports['removeUsers']=function(_0x349361,_0x482563,_0x4acfe5){return db[_0x311d('0x30')][_0x311d('0x4b')]({'where':{'id':_0x349361[_0x311d('0x53')]['id']}})[_0x311d('0x29')](handleEntityNotFound(_0x482563,null))['then'](function(_0x3db2ec){if(_0x3db2ec){return _0x3db2ec['removeUsers'](_0x349361[_0x311d('0x35')][_0x311d('0x55')])['then'](function(){if(_[_0x311d('0x56')](_0x349361[_0x311d('0x35')][_0x311d('0x55')])){for(var _0x4bccf1=0x0;_0x4bccf1<_0x349361['query']['ids']['length'];_0x4bccf1+=0x1){socket['emit'](_0x311d('0x57'),{'UserId':Number(_0x349361[_0x311d('0x35')][_0x311d('0x55')][_0x4bccf1]),'SquareProjectId':Number(_0x349361['params']['id'])});}}else{socket[_0x311d('0x58')](_0x311d('0x57'),{'UserId':Number(_0x349361[_0x311d('0x35')][_0x311d('0x55')]),'SquareProjectId':Number(_0x349361[_0x311d('0x53')]['id'])});}});}})[_0x311d('0x29')](respondWithStatusCode(_0x482563,null))[_0x311d('0x46')](handleError(_0x482563,null));};exports[_0x311d('0x59')]=function(_0x5d2645,_0x123ef4,_0x2a7a45){var _0xa55471={};var _0x476cf={};var _0x236bce;var _0xd2581f;return db['SquareProject'][_0x311d('0x5a')]({'where':{'id':_0x5d2645[_0x311d('0x53')]['id']}})['then'](handleEntityNotFound(_0x123ef4,null))['then'](function(_0x1e3c1b){if(_0x1e3c1b){_0x236bce=_0x1e3c1b;_0x476cf[_0x311d('0x38')]=_['keys'](db[_0x311d('0x5b')][_0x311d('0x49')]);_0x476cf[_0x311d('0x35')]=_['keys'](_0x5d2645[_0x311d('0x35')]);_0x476cf[_0x311d('0x36')]=_[_0x311d('0x37')](_0x476cf[_0x311d('0x38')],_0x476cf[_0x311d('0x35')]);_0xa55471[_0x311d('0x39')]=_[_0x311d('0x37')](_0x476cf[_0x311d('0x38')],qs[_0x311d('0x3a')](_0x5d2645[_0x311d('0x35')]['fields']));_0xa55471[_0x311d('0x39')]=_0xa55471[_0x311d('0x39')][_0x311d('0x4a')]?_0xa55471[_0x311d('0x39')]:_0x476cf[_0x311d('0x38')];_0xa55471[_0x311d('0x3d')]=qs['sort'](_0x5d2645[_0x311d('0x35')][_0x311d('0x3e')]);_0xa55471['where']=qs['filters'](_[_0x311d('0x5c')](_0x5d2645[_0x311d('0x35')],_0x476cf['filters']));if(_0x5d2645[_0x311d('0x35')]['filter']){_0xa55471['where']=_[_0x311d('0x40')](_0xa55471[_0x311d('0x3f')],{'$or':_[_0x311d('0x34')](_0xa55471['attributes'],function(_0xf23364){var _0x26af4a={};_0x26af4a[_0xf23364]={'$like':'%'+_0x5d2645[_0x311d('0x35')][_0x311d('0x5d')]+'%'};return _0x26af4a;})});}_0xa55471=_[_0x311d('0x40')]({},_0xa55471,_0x5d2645[_0x311d('0x42')]);return _0x236bce[_0x311d('0x59')](_0xa55471);}})[_0x311d('0x29')](function(_0x5e8091){if(_0x5e8091){_0xd2581f=_0x5e8091['length'];if(!_0x5d2645['query']['hasOwnProperty']('nolimit')){_0xa55471[_0x311d('0x25')]=qs[_0x311d('0x25')](_0x5d2645['query']['limit']);_0xa55471[_0x311d('0x24')]=qs[_0x311d('0x24')](_0x5d2645[_0x311d('0x35')][_0x311d('0x24')]);}return _0x236bce[_0x311d('0x59')](_0xa55471);}})[_0x311d('0x29')](function(_0x4e8b33){if(_0x4e8b33){return _0x4e8b33?{'count':_0xd2581f,'rows':_0x4e8b33}:null;}})[_0x311d('0x29')](respondWithResult(_0x123ef4,null))[_0x311d('0x46')](handleError(_0x123ef4,null));}; \ No newline at end of file +var _0x6829=['offset','Content-Range','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','name','send','map','SquareProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','params','addUsers','omit','ids','isArray','emit','userSquareProject:remove','getUsers','findOne','User','merge','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','status','json','count'];(function(_0x35c923,_0x2d150b){var _0x142a94=function(_0x1de3b6){while(--_0x1de3b6){_0x35c923['push'](_0x35c923['shift']());}};_0x142a94(++_0x2d150b);}(_0x6829,0x14c));var _0x9682=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6829[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0x9682('0x0'));var emlformat=require(_0x9682('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9682('0x2'));var moment=require(_0x9682('0x3'));var BPromise=require(_0x9682('0x4'));var Mustache=require(_0x9682('0x5'));var util=require(_0x9682('0x6'));var path=require(_0x9682('0x7'));var sox=require(_0x9682('0x8'));var csv=require(_0x9682('0x9'));var ejs=require(_0x9682('0xa'));var fs=require('fs');var fs_extra=require(_0x9682('0xb'));var _=require(_0x9682('0xc'));var squel=require(_0x9682('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9682('0x9'));var querystring=require(_0x9682('0xe'));var Papa=require('papaparse');var Redis=require(_0x9682('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9682('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9682('0x11'));var logger=require(_0x9682('0x12'))(_0x9682('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9682('0x14'));var db=require(_0x9682('0x15'))['db'];config['redis']=_[_0x9682('0x16')](config['redis'],{'host':_0x9682('0x17'),'port':0x18eb});var socket=require(_0x9682('0x18'))(new Redis(config[_0x9682('0x19')]));require(_0x9682('0x1a'))[_0x9682('0x1b')](socket);function respondWithStatusCode(_0x161717,_0x73f6c6){_0x73f6c6=_0x73f6c6||0xcc;return function(_0xa26517){if(_0xa26517){return _0x161717[_0x9682('0x1c')](_0x73f6c6);}return _0x161717[_0x9682('0x1d')](_0x73f6c6)['end']();};}function respondWithResult(_0x3935c2,_0x567127){_0x567127=_0x567127||0xc8;return function(_0x23eef6){if(_0x23eef6){return _0x3935c2[_0x9682('0x1d')](_0x567127)[_0x9682('0x1e')](_0x23eef6);}};}function respondWithFilteredResult(_0x5de0e0,_0x1c73ee){return function(_0x4e0dfb){if(_0x4e0dfb){var _0x107291=_0x4e0dfb[_0x9682('0x1f')],_0x51c1a8=_0x1c73ee[_0x9682('0x20')],_0x263e4b=_0x1c73ee[_0x9682('0x20')]+_0x1c73ee['limit'],_0x1273f5;if(_0x263e4b>=_0x107291){_0x263e4b=_0x107291;_0x1273f5=0xc8;}else{_0x1273f5=0xce;}_0x5de0e0['status'](_0x1273f5);return _0x5de0e0['set'](_0x9682('0x21'),_0x51c1a8+'-'+_0x263e4b+'/'+_0x107291)['json'](_0x4e0dfb);}return null;};}function patchUpdates(_0x36230c){return function(_0x24beb9){try{jsonpatch['apply'](_0x24beb9,_0x36230c,!![]);}catch(_0x4650c9){return BPromise[_0x9682('0x22')](_0x4650c9);}return _0x24beb9[_0x9682('0x23')]();};}function saveUpdates(_0xe3e8eb,_0x1e018e){return function(_0x1c2eaf){if(_0x1c2eaf){return _0x1c2eaf[_0x9682('0x24')](_0xe3e8eb)[_0x9682('0x25')](function(_0x107352){return _0x107352;});}return null;};}function removeEntity(_0x2bede7,_0x5cb1dc){return function(_0x19f872){if(_0x19f872){return _0x19f872[_0x9682('0x26')]()[_0x9682('0x25')](function(){var _0x21a10b=_0x19f872[_0x9682('0x27')]({'plain':!![]});var _0x5319f2=_0x9682('0x28');return db[_0x9682('0x29')][_0x9682('0x26')]({'where':{'type':_0x5319f2,'resourceId':_0x21a10b['id']}})[_0x9682('0x25')](function(){return _0x19f872;});})[_0x9682('0x25')](function(){_0x2bede7[_0x9682('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a62ba,_0x2ae6aa){return function(_0x27dc9e){if(!_0x27dc9e){_0x2a62ba[_0x9682('0x1c')](0x194);}return _0x27dc9e;};}function handleError(_0x9e3d59,_0x1fdb4d){_0x1fdb4d=_0x1fdb4d||0x1f4;return function(_0x176624){logger[_0x9682('0x2a')](_0x176624['stack']);if(_0x176624[_0x9682('0x2b')]){delete _0x176624['name'];}_0x9e3d59[_0x9682('0x1d')](_0x1fdb4d)[_0x9682('0x2c')](_0x176624);};}exports['index']=function(_0x54c860,_0x4b4c5d){var _0x5a2ad3={},_0x27439f={},_0x53f7ab={'count':0x0,'rows':[]};var _0x1b4b1e=_[_0x9682('0x2d')](db[_0x9682('0x2e')][_0x9682('0x2f')],function(_0x5ac30f){return{'name':_0x5ac30f['fieldName'],'type':_0x5ac30f[_0x9682('0x30')][_0x9682('0x31')]};});_0x27439f[_0x9682('0x32')]=_[_0x9682('0x2d')](_0x1b4b1e,_0x9682('0x2b'));_0x27439f['query']=_['keys'](_0x54c860[_0x9682('0x33')]);_0x27439f[_0x9682('0x34')]=_[_0x9682('0x35')](_0x27439f[_0x9682('0x32')],_0x27439f[_0x9682('0x33')]);_0x5a2ad3[_0x9682('0x36')]=_[_0x9682('0x35')](_0x27439f['model'],qs[_0x9682('0x37')](_0x54c860[_0x9682('0x33')][_0x9682('0x37')]));_0x5a2ad3[_0x9682('0x36')]=_0x5a2ad3[_0x9682('0x36')]['length']?_0x5a2ad3[_0x9682('0x36')]:_0x27439f['model'];if(!_0x54c860[_0x9682('0x33')][_0x9682('0x38')](_0x9682('0x39'))){_0x5a2ad3[_0x9682('0x3a')]=qs[_0x9682('0x3a')](_0x54c860[_0x9682('0x33')][_0x9682('0x3a')]);_0x5a2ad3['offset']=qs[_0x9682('0x20')](_0x54c860['query'][_0x9682('0x20')]);}_0x5a2ad3['order']=qs[_0x9682('0x3b')](_0x54c860[_0x9682('0x33')][_0x9682('0x3b')]);_0x5a2ad3[_0x9682('0x3c')]=qs[_0x9682('0x34')](_[_0x9682('0x3d')](_0x54c860[_0x9682('0x33')],_0x27439f[_0x9682('0x34')]),_0x1b4b1e);if(_0x54c860[_0x9682('0x33')][_0x9682('0x3e')]){_0x5a2ad3[_0x9682('0x3c')]=_['merge'](_0x5a2ad3[_0x9682('0x3c')],{'$or':_[_0x9682('0x2d')](_0x1b4b1e,function(_0xd4bc5b){if(_0xd4bc5b[_0x9682('0x30')]!==_0x9682('0x3f')){var _0x479ac7={};_0x479ac7[_0xd4bc5b[_0x9682('0x2b')]]={'$like':'%'+_0x54c860[_0x9682('0x33')][_0x9682('0x3e')]+'%'};return _0x479ac7;}})});}_0x5a2ad3=_['merge']({},_0x5a2ad3,_0x54c860[_0x9682('0x40')]);var _0x37311d={'where':_0x5a2ad3[_0x9682('0x3c')]};return db[_0x9682('0x2e')][_0x9682('0x1f')](_0x37311d)[_0x9682('0x25')](function(_0x8c7065){_0x53f7ab[_0x9682('0x1f')]=_0x8c7065;if(_0x54c860[_0x9682('0x33')][_0x9682('0x41')]){_0x5a2ad3[_0x9682('0x42')]=[{'all':!![]}];}return db[_0x9682('0x2e')][_0x9682('0x43')](_0x5a2ad3);})[_0x9682('0x25')](function(_0x1a973c){_0x53f7ab[_0x9682('0x44')]=_0x1a973c;return _0x53f7ab;})['then'](respondWithFilteredResult(_0x4b4c5d,_0x5a2ad3))[_0x9682('0x45')](handleError(_0x4b4c5d,null));};exports['show']=function(_0xbb8fb5,_0x34b682){var _0x28803={'raw':![],'where':{'id':_0xbb8fb5['params']['id']}},_0x51a631={};_0x51a631[_0x9682('0x32')]=_[_0x9682('0x46')](db[_0x9682('0x2e')][_0x9682('0x2f')]);_0x51a631[_0x9682('0x33')]=_[_0x9682('0x46')](_0xbb8fb5[_0x9682('0x33')]);_0x51a631['filters']=_[_0x9682('0x35')](_0x51a631['model'],_0x51a631[_0x9682('0x33')]);_0x28803[_0x9682('0x36')]=_[_0x9682('0x35')](_0x51a631[_0x9682('0x32')],qs[_0x9682('0x37')](_0xbb8fb5[_0x9682('0x33')][_0x9682('0x37')]));_0x28803[_0x9682('0x36')]=_0x28803['attributes'][_0x9682('0x47')]?_0x28803[_0x9682('0x36')]:_0x51a631[_0x9682('0x32')];if(_0xbb8fb5[_0x9682('0x33')][_0x9682('0x41')]){_0x28803[_0x9682('0x42')]=[{'all':!![]}];}_0x28803=_['merge']({},_0x28803,_0xbb8fb5[_0x9682('0x40')]);return db[_0x9682('0x2e')][_0x9682('0x48')](_0x28803)[_0x9682('0x25')](handleEntityNotFound(_0x34b682,null))[_0x9682('0x25')](respondWithResult(_0x34b682,null))[_0x9682('0x45')](handleError(_0x34b682,null));};exports[_0x9682('0x49')]=function(_0x14b4df,_0xe4bf52){return db[_0x9682('0x2e')]['create'](_0x14b4df['body'],{})['then'](function(_0x49d948){var _0x520538=_0x14b4df[_0x9682('0x4a')][_0x9682('0x27')]({'plain':!![]});if(!_0x520538)throw new Error(_0x9682('0x4b'));if(_0x520538['role']===_0x9682('0x4a')){var _0x328a15=_0x49d948[_0x9682('0x27')]({'plain':!![]});var _0x582380=_0x9682('0x28');return db[_0x9682('0x4c')][_0x9682('0x48')]({'where':{'name':_0x582380,'userProfileId':_0x520538[_0x9682('0x4d')]},'raw':!![]})[_0x9682('0x25')](function(_0xc373d6){if(_0xc373d6&&_0xc373d6[_0x9682('0x4e')]===0x0){return db['UserProfileResource'][_0x9682('0x49')]({'name':_0x328a15[_0x9682('0x2b')],'resourceId':_0x328a15['id'],'type':_0xc373d6[_0x9682('0x2b')],'sectionId':_0xc373d6['id']},{})[_0x9682('0x25')](function(){return _0x49d948;});}else{return _0x49d948;}})[_0x9682('0x45')](function(_0xd1a6a5){logger[_0x9682('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd1a6a5);throw _0xd1a6a5;});}return _0x49d948;})['then'](respondWithResult(_0xe4bf52,0xc9))[_0x9682('0x45')](handleError(_0xe4bf52,null));};exports[_0x9682('0x24')]=function(_0x47a8d9,_0xe01cd5){if(_0x47a8d9[_0x9682('0x4f')]['id']){delete _0x47a8d9[_0x9682('0x4f')]['id'];}return db[_0x9682('0x2e')][_0x9682('0x48')]({'where':{'id':_0x47a8d9['params']['id']}})[_0x9682('0x25')](handleEntityNotFound(_0xe01cd5,null))[_0x9682('0x25')](saveUpdates(_0x47a8d9[_0x9682('0x4f')],null))[_0x9682('0x25')](respondWithResult(_0xe01cd5,null))[_0x9682('0x45')](handleError(_0xe01cd5,null));};exports[_0x9682('0x26')]=function(_0x57217d,_0x2f9dc9){return db[_0x9682('0x2e')][_0x9682('0x48')]({'where':{'id':_0x57217d[_0x9682('0x50')]['id']}})[_0x9682('0x25')](handleEntityNotFound(_0x2f9dc9,null))[_0x9682('0x25')](removeEntity(_0x2f9dc9,null))[_0x9682('0x45')](handleError(_0x2f9dc9,null));};exports[_0x9682('0x51')]=function(_0x124ccb,_0x2db484,_0x298726){return db[_0x9682('0x2e')]['find']({'where':{'id':_0x124ccb[_0x9682('0x50')]['id']}})[_0x9682('0x25')](handleEntityNotFound(_0x2db484,null))[_0x9682('0x25')](function(_0x44ecc4){if(_0x44ecc4){return _0x44ecc4[_0x9682('0x51')](_0x124ccb['body']['ids'],_[_0x9682('0x52')](_0x124ccb[_0x9682('0x4f')],[_0x9682('0x53'),'id'])||{});}})[_0x9682('0x25')](respondWithResult(_0x2db484,null))[_0x9682('0x45')](handleError(_0x2db484,null));};exports['removeUsers']=function(_0x58f9e1,_0x54636e,_0x23bf9f){return db[_0x9682('0x2e')]['find']({'where':{'id':_0x58f9e1[_0x9682('0x50')]['id']}})[_0x9682('0x25')](handleEntityNotFound(_0x54636e,null))[_0x9682('0x25')](function(_0x1aed62){if(_0x1aed62){return _0x1aed62['removeUsers'](_0x58f9e1[_0x9682('0x33')][_0x9682('0x53')])[_0x9682('0x25')](function(){if(_[_0x9682('0x54')](_0x58f9e1[_0x9682('0x33')][_0x9682('0x53')])){for(var _0x52ae64=0x0;_0x52ae64<_0x58f9e1['query']['ids'][_0x9682('0x47')];_0x52ae64+=0x1){socket[_0x9682('0x55')]('userSquareProject:remove',{'UserId':Number(_0x58f9e1[_0x9682('0x33')]['ids'][_0x52ae64]),'SquareProjectId':Number(_0x58f9e1[_0x9682('0x50')]['id'])});}}else{socket[_0x9682('0x55')](_0x9682('0x56'),{'UserId':Number(_0x58f9e1[_0x9682('0x33')][_0x9682('0x53')]),'SquareProjectId':Number(_0x58f9e1[_0x9682('0x50')]['id'])});}});}})[_0x9682('0x25')](respondWithStatusCode(_0x54636e,null))[_0x9682('0x45')](handleError(_0x54636e,null));};exports[_0x9682('0x57')]=function(_0x5a9c20,_0x7f2b4e,_0x21dad4){var _0x144d5b={};var _0x233d3e={};var _0x3d800e;var _0x31239b;return db['SquareProject'][_0x9682('0x58')]({'where':{'id':_0x5a9c20[_0x9682('0x50')]['id']}})[_0x9682('0x25')](handleEntityNotFound(_0x7f2b4e,null))[_0x9682('0x25')](function(_0x85c6a0){if(_0x85c6a0){_0x3d800e=_0x85c6a0;_0x233d3e[_0x9682('0x32')]=_[_0x9682('0x46')](db[_0x9682('0x59')]['rawAttributes']);_0x233d3e[_0x9682('0x33')]=_['keys'](_0x5a9c20[_0x9682('0x33')]);_0x233d3e['filters']=_[_0x9682('0x35')](_0x233d3e[_0x9682('0x32')],_0x233d3e[_0x9682('0x33')]);_0x144d5b[_0x9682('0x36')]=_[_0x9682('0x35')](_0x233d3e[_0x9682('0x32')],qs['fields'](_0x5a9c20[_0x9682('0x33')][_0x9682('0x37')]));_0x144d5b[_0x9682('0x36')]=_0x144d5b[_0x9682('0x36')][_0x9682('0x47')]?_0x144d5b['attributes']:_0x233d3e[_0x9682('0x32')];_0x144d5b['order']=qs['sort'](_0x5a9c20['query']['sort']);_0x144d5b[_0x9682('0x3c')]=qs[_0x9682('0x34')](_[_0x9682('0x3d')](_0x5a9c20[_0x9682('0x33')],_0x233d3e[_0x9682('0x34')]));if(_0x5a9c20[_0x9682('0x33')][_0x9682('0x3e')]){_0x144d5b[_0x9682('0x3c')]=_[_0x9682('0x5a')](_0x144d5b[_0x9682('0x3c')],{'$or':_['map'](_0x144d5b['attributes'],function(_0x430fe4){var _0x2b34ec={};_0x2b34ec[_0x430fe4]={'$like':'%'+_0x5a9c20['query']['filter']+'%'};return _0x2b34ec;})});}_0x144d5b=_[_0x9682('0x5a')]({},_0x144d5b,_0x5a9c20[_0x9682('0x40')]);return _0x3d800e[_0x9682('0x57')](_0x144d5b);}})[_0x9682('0x25')](function(_0x1328d9){if(_0x1328d9){_0x31239b=_0x1328d9[_0x9682('0x47')];if(!_0x5a9c20[_0x9682('0x33')][_0x9682('0x38')](_0x9682('0x39'))){_0x144d5b[_0x9682('0x3a')]=qs[_0x9682('0x3a')](_0x5a9c20[_0x9682('0x33')][_0x9682('0x3a')]);_0x144d5b[_0x9682('0x20')]=qs[_0x9682('0x20')](_0x5a9c20[_0x9682('0x33')][_0x9682('0x20')]);}return _0x3d800e[_0x9682('0x57')](_0x144d5b);}})[_0x9682('0x25')](function(_0xfb405a){if(_0xfb405a){return _0xfb405a?{'count':_0x31239b,'rows':_0xfb405a}:null;}})['then'](respondWithResult(_0x7f2b4e,null))[_0x9682('0x45')](handleError(_0x7f2b4e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f0e9ac7..7229ff7 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 _0x5e87=['events','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x10ad8b,_0xfa25de){var _0x2b7be9=function(_0x4897c9){while(--_0x4897c9){_0x10ad8b['push'](_0x10ad8b['shift']());}};_0x2b7be9(++_0xfa25de);}(_0x5e87,0x8c));var _0x75e8=function(_0x1bfc73,_0x1354d5){_0x1bfc73=_0x1bfc73-0x0;var _0x58e230=_0x5e87[_0x1bfc73];return _0x58e230;};'use strict';var EventEmitter=require(_0x75e8('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x75e8('0x1'),'afterUpdate':_0x75e8('0x2'),'afterDestroy':_0x75e8('0x3')};function emitEvent(_0x121373){return function(_0x43dfdc,_0x32ce94,_0x39a7a3){SquareProjectEvents['emit'](_0x121373+':'+_0x43dfdc['id'],_0x43dfdc);SquareProjectEvents[_0x75e8('0x4')](_0x121373,_0x43dfdc);_0x39a7a3(null);};}for(var e in events){if(events[_0x75e8('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x75e8('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x8e37=['events','../../mysqldb','SquareProject','setMaxListeners','remove','emit','hook','exports'];(function(_0x5365b9,_0x56fb8d){var _0x5e977e=function(_0x2945bc){while(--_0x2945bc){_0x5365b9['push'](_0x5365b9['shift']());}};_0x5e977e(++_0x56fb8d);}(_0x8e37,0x98));var _0x78e3=function(_0x151ec9,_0x3d974f){_0x151ec9=_0x151ec9-0x0;var _0x1af291=_0x8e37[_0x151ec9];return _0x1af291;};'use strict';var EventEmitter=require(_0x78e3('0x0'));var SquareProject=require(_0x78e3('0x1'))['db'][_0x78e3('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x78e3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x78e3('0x4')};function emitEvent(_0x12b795){return function(_0x2ee0fc,_0x4031b9,_0x110f37){SquareProjectEvents[_0x78e3('0x5')](_0x12b795+':'+_0x2ee0fc['id'],_0x2ee0fc);SquareProjectEvents[_0x78e3('0x5')](_0x12b795,_0x2ee0fc);_0x110f37(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x78e3('0x6')](e,emitEvent(event));}}module[_0x78e3('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 732fd20..2c1a855 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 _0x90ae=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction'];(function(_0x54902b,_0x37ee79){var _0x3c0121=function(_0x23ffd6){while(--_0x23ffd6){_0x54902b['push'](_0x54902b['shift']());}};_0x3c0121(++_0x37ee79);}(_0x90ae,0x195));var _0xe90a=function(_0x52514e,_0x101e24){_0x52514e=_0x52514e-0x0;var _0x5b903b=_0x90ae[_0x52514e];return _0x5b903b;};'use strict';var _=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var logger=require(_0xe90a('0x2'))('api');var moment=require(_0xe90a('0x3'));var BPromise=require(_0xe90a('0x4'));var rp=require(_0xe90a('0x5'));var fs=require('fs');var path=require(_0xe90a('0x6'));var rimraf=require(_0xe90a('0x7'));var config=require(_0xe90a('0x8'));var attributes=require(_0xe90a('0x9'));module[_0xe90a('0xa')]=function(_0x30cb7b,_0x5c3573){return _0x30cb7b[_0xe90a('0xb')](_0xe90a('0xc'),attributes,{'tableName':_0xe90a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42fb64,_0x11cd54,_0x2602fa){if(_0x42fb64['changed'](_0xe90a('0xe'))){_0x42fb64[_0xe90a('0xf')]=moment()[_0xe90a('0x10')](_0xe90a('0x11'));}if(_0x42fb64[_0xe90a('0x12')](_0xe90a('0x13'))){_0x42fb64[_0xe90a('0x14')]=moment()['format'](_0xe90a('0x11'));}_0x2602fa(null,_0x42fb64);}}});}; \ No newline at end of file +var _0x8128=['publishedAt','lodash','api','moment','path','rimraf','../../config/environment','exports','define','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production'];(function(_0x3b1095,_0x315f33){var _0x1e328c=function(_0x1f51b8){while(--_0x1f51b8){_0x3b1095['push'](_0x3b1095['shift']());}};_0x1e328c(++_0x315f33);}(_0x8128,0x1b1));var _0x8812=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8128[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8812('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8812('0x1'));var moment=require(_0x8812('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8812('0x3'));var rimraf=require(_0x8812('0x4'));var config=require(_0x8812('0x5'));var attributes=require('./squareProject.attributes');module[_0x8812('0x6')]=function(_0x2f4af9,_0x2b43c6){return _0x2f4af9[_0x8812('0x7')]('SquareProject',attributes,{'tableName':_0x8812('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d030b,_0x4e5012,_0x51ad6b){if(_0x3d030b['changed'](_0x8812('0x9'))){_0x3d030b[_0x8812('0xa')]=moment()[_0x8812('0xb')](_0x8812('0xc'));}if(_0x3d030b[_0x8812('0xd')](_0x8812('0xe'))){_0x3d030b[_0x8812('0xf')]=moment()[_0x8812('0xb')](_0x8812('0xc'));}_0x51ad6b(null,_0x3d030b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index cbcffc9..12e94da 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 _0x3e10=['register','request','then','info','request\x20sent','debug','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x2bb12b,_0xc7818d){var _0x43ecfd=function(_0x397da8){while(--_0x397da8){_0x2bb12b['push'](_0x2bb12b['shift']());}};_0x43ecfd(++_0xc7818d);}(_0x3e10,0xa6));var _0x03e1=function(_0x4c43b1,_0x976cfb){_0x4c43b1=_0x4c43b1-0x0;var _0x4c9b8e=_0x3e10[_0x4c43b1];return _0x4c9b8e;};'use strict';var _=require(_0x03e1('0x0'));var util=require(_0x03e1('0x1'));var moment=require('moment');var BPromise=require(_0x03e1('0x2'));var rs=require(_0x03e1('0x3'));var fs=require('fs');var Redis=require(_0x03e1('0x4'));var db=require(_0x03e1('0x5'))['db'];var utils=require(_0x03e1('0x6'));var logger=require(_0x03e1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x03e1('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x03e1('0x9')]=_[_0x03e1('0xa')](config[_0x03e1('0x9')],{'host':_0x03e1('0xb'),'port':0x18eb});var socket=require(_0x03e1('0xc'))(new Redis(config[_0x03e1('0x9')]));require(_0x03e1('0xd'))[_0x03e1('0xe')](socket);function respondWithRpcPromise(_0x3d274f,_0x89eb67,_0x3b6e74){return new BPromise(function(_0x2d50ce,_0x1b155b){return client[_0x03e1('0xf')](_0x3d274f,_0x3b6e74)[_0x03e1('0x10')](function(_0x5a3594){logger[_0x03e1('0x11')]('SquareProject,\x20%s,\x20%s',_0x89eb67,_0x03e1('0x12'));logger[_0x03e1('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x89eb67,_0x03e1('0x12'),JSON[_0x03e1('0x14')](_0x5a3594));if(_0x5a3594[_0x03e1('0x15')]){if(_0x5a3594[_0x03e1('0x15')][_0x03e1('0x16')]===0x1f4){logger[_0x03e1('0x15')](_0x03e1('0x17'),_0x89eb67,_0x5a3594[_0x03e1('0x15')][_0x03e1('0x18')]);return _0x1b155b(_0x5a3594[_0x03e1('0x15')][_0x03e1('0x18')]);}logger[_0x03e1('0x15')](_0x03e1('0x17'),_0x89eb67,_0x5a3594['error'][_0x03e1('0x18')]);return _0x2d50ce(_0x5a3594[_0x03e1('0x15')][_0x03e1('0x18')]);}else{logger['info'](_0x03e1('0x17'),_0x89eb67,_0x03e1('0x12'));_0x2d50ce(_0x5a3594[_0x03e1('0x19')][_0x03e1('0x18')]);}})[_0x03e1('0x1a')](function(_0xdd6e4a){logger['error'](_0x03e1('0x17'),_0x89eb67,_0xdd6e4a);_0x1b155b(_0xdd6e4a);});});}exports[_0x03e1('0x1b')]=function(_0x3270fb){var _0x5932ae=this;return new Promise(function(_0x34e2c5,_0x164afd){return db[_0x03e1('0x1c')][_0x03e1('0x1d')]({'raw':_0x3270fb[_0x03e1('0x1e')]?_0x3270fb[_0x03e1('0x1e')][_0x03e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x3270fb['options']?_0x3270fb[_0x03e1('0x1e')]['where']||null:null,'attributes':_0x3270fb[_0x03e1('0x1e')]?_0x3270fb[_0x03e1('0x1e')][_0x03e1('0x20')]||null:null,'include':_0x3270fb[_0x03e1('0x1e')]?_0x3270fb[_0x03e1('0x1e')][_0x03e1('0x21')]?_['map'](_0x3270fb['options']['include'],function(_0x46e36a){return{'model':db[_0x46e36a[_0x03e1('0x22')]],'as':_0x46e36a['as'],'attributes':_0x46e36a['attributes'],'include':_0x46e36a[_0x03e1('0x21')]?_[_0x03e1('0x23')](_0x46e36a[_0x03e1('0x21')],function(_0x2a4c4c){return{'model':db[_0x2a4c4c[_0x03e1('0x22')]],'as':_0x2a4c4c['as'],'attributes':_0x2a4c4c[_0x03e1('0x20')],'include':_0x2a4c4c[_0x03e1('0x21')]?_[_0x03e1('0x23')](_0x2a4c4c[_0x03e1('0x21')],function(_0x264658){return{'model':db[_0x264658[_0x03e1('0x22')]],'as':_0x264658['as'],'attributes':_0x264658[_0x03e1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x03e1('0x10')](function(_0x1e9097){logger['info'](_0x03e1('0x1b'),_0x3270fb);logger[_0x03e1('0x13')](_0x03e1('0x1b'),_0x3270fb,JSON[_0x03e1('0x14')](_0x1e9097));_0x34e2c5(_0x1e9097);})['catch'](function(_0x4307ea){logger[_0x03e1('0x15')](_0x03e1('0x1b'),_0x4307ea[_0x03e1('0x18')],_0x3270fb);_0x164afd(_0x5932ae[_0x03e1('0x15')](0x1f4,_0x4307ea['message']));});});}; \ No newline at end of file +var _0x74ca=['socket.io-emitter','./squareProject.socket','register','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x5f9809,_0x1c7acc){var _0x4e981b=function(_0x3a3c95){while(--_0x3a3c95){_0x5f9809['push'](_0x5f9809['shift']());}};_0x4e981b(++_0x1c7acc);}(_0x74ca,0x154));var _0xa74c=function(_0x45d9d0,_0x3d0340){_0x45d9d0=_0x45d9d0-0x0;var _0x151f72=_0x74ca[_0x45d9d0];return _0x151f72;};'use strict';var _=require(_0xa74c('0x0'));var util=require(_0xa74c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa74c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa74c('0x3'));var logger=require(_0xa74c('0x4'))('rpc');var config=require(_0xa74c('0x5'));var jayson=require(_0xa74c('0x6'));var client=jayson['client'][_0xa74c('0x7')]({'port':0x232a});config[_0xa74c('0x8')]=_['defaults'](config[_0xa74c('0x8')],{'host':_0xa74c('0x9'),'port':0x18eb});var socket=require(_0xa74c('0xa'))(new Redis(config[_0xa74c('0x8')]));require(_0xa74c('0xb'))[_0xa74c('0xc')](socket);function respondWithRpcPromise(_0x363639,_0xd7fb51,_0x103f0b){return new BPromise(function(_0x1592cf,_0xd2152d){return client['request'](_0x363639,_0x103f0b)[_0xa74c('0xd')](function(_0xec8f64){logger[_0xa74c('0xe')]('SquareProject,\x20%s,\x20%s',_0xd7fb51,'request\x20sent');logger[_0xa74c('0xf')](_0xa74c('0x10'),_0xd7fb51,_0xa74c('0x11'),JSON[_0xa74c('0x12')](_0xec8f64));if(_0xec8f64[_0xa74c('0x13')]){if(_0xec8f64[_0xa74c('0x13')][_0xa74c('0x14')]===0x1f4){logger[_0xa74c('0x13')](_0xa74c('0x15'),_0xd7fb51,_0xec8f64['error'][_0xa74c('0x16')]);return _0xd2152d(_0xec8f64[_0xa74c('0x13')][_0xa74c('0x16')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0xd7fb51,_0xec8f64[_0xa74c('0x13')][_0xa74c('0x16')]);return _0x1592cf(_0xec8f64[_0xa74c('0x13')][_0xa74c('0x16')]);}else{logger[_0xa74c('0xe')](_0xa74c('0x15'),_0xd7fb51,_0xa74c('0x11'));_0x1592cf(_0xec8f64[_0xa74c('0x17')][_0xa74c('0x16')]);}})[_0xa74c('0x18')](function(_0x57460c){logger[_0xa74c('0x13')](_0xa74c('0x15'),_0xd7fb51,_0x57460c);_0xd2152d(_0x57460c);});});}exports[_0xa74c('0x19')]=function(_0x20b5da){var _0x5455f1=this;return new Promise(function(_0x2df187,_0x3dc6d1){return db[_0xa74c('0x1a')][_0xa74c('0x1b')]({'raw':_0x20b5da[_0xa74c('0x1c')]?_0x20b5da[_0xa74c('0x1c')][_0xa74c('0x1d')]===undefined?!![]:![]:!![],'where':_0x20b5da['options']?_0x20b5da[_0xa74c('0x1c')][_0xa74c('0x1e')]||null:null,'attributes':_0x20b5da[_0xa74c('0x1c')]?_0x20b5da[_0xa74c('0x1c')][_0xa74c('0x1f')]||null:null,'include':_0x20b5da[_0xa74c('0x1c')]?_0x20b5da[_0xa74c('0x1c')][_0xa74c('0x20')]?_[_0xa74c('0x21')](_0x20b5da[_0xa74c('0x1c')][_0xa74c('0x20')],function(_0x418ee8){return{'model':db[_0x418ee8[_0xa74c('0x22')]],'as':_0x418ee8['as'],'attributes':_0x418ee8[_0xa74c('0x1f')],'include':_0x418ee8[_0xa74c('0x20')]?_[_0xa74c('0x21')](_0x418ee8['include'],function(_0x339d16){return{'model':db[_0x339d16[_0xa74c('0x22')]],'as':_0x339d16['as'],'attributes':_0x339d16[_0xa74c('0x1f')],'include':_0x339d16[_0xa74c('0x20')]?_[_0xa74c('0x21')](_0x339d16[_0xa74c('0x20')],function(_0x28e207){return{'model':db[_0x28e207['model']],'as':_0x28e207['as'],'attributes':_0x28e207[_0xa74c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa74c('0xd')](function(_0x2e85df){logger[_0xa74c('0xe')](_0xa74c('0x19'),_0x20b5da);logger[_0xa74c('0xf')]('ShowSquareProject',_0x20b5da,JSON['stringify'](_0x2e85df));_0x2df187(_0x2e85df);})[_0xa74c('0x18')](function(_0x37df46){logger[_0xa74c('0x13')](_0xa74c('0x19'),_0x37df46[_0xa74c('0x16')],_0x20b5da);_0x3dc6d1(_0x5455f1[_0xa74c('0x13')](0x1f4,_0x37df46['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 8459fdf..e871674 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['emit','removeListener','register','length','./squareProject.events','save','update'];(function(_0x5641a3,_0x1112d6){var _0x57d032=function(_0x4a8285){while(--_0x4a8285){_0x5641a3['push'](_0x5641a3['shift']());}};_0x57d032(++_0x1112d6);}(_0x5fab,0x177));var _0xb5fa=function(_0x344357,_0x484651){_0x344357=_0x344357-0x0;var _0x1aaa49=_0x5fab[_0x344357];return _0x1aaa49;};'use strict';var SquareProjectEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){SquareProjectEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('squareProject:'+_0x1aec3e,_0x44df89);SquareProjectEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x90b1=['save','remove','emit','length','squareProject:','./squareProject.events'];(function(_0x5dda4a,_0xdbef6e){var _0x21f6a8=function(_0x2e974b){while(--_0x2e974b){_0x5dda4a['push'](_0x5dda4a['shift']());}};_0x21f6a8(++_0xdbef6e);}(_0x90b1,0x1bb));var _0x190b=function(_0x17b680,_0x46e290){_0x17b680=_0x17b680-0x0;var _0x5caa7c=_0x90b1[_0x17b680];return _0x5caa7c;};'use strict';var SquareProjectEvents=require(_0x190b('0x0'));var events=[_0x190b('0x1'),_0x190b('0x2'),'update'];function createListener(_0x487731,_0x1e5984){return function(_0x44ca85){_0x1e5984[_0x190b('0x3')](_0x487731,_0x44ca85);};}function removeListener(_0x120ddc,_0x4fbcad){return function(){SquareProjectEvents['removeListener'](_0x120ddc,_0x4fbcad);};}exports['register']=function(_0x5da9c1){for(var _0x27ff8c=0x0,_0x34a689=events[_0x190b('0x4')];_0x27ff8c<_0x34a689;_0x27ff8c++){var _0x626aa1=events[_0x27ff8c];var _0x311161=createListener(_0x190b('0x5')+_0x626aa1,_0x5da9c1);SquareProjectEvents['on'](_0x626aa1,_0x311161);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e9a446e..4fe69d6 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 _0x9172=['get','show','/:id/download','isAuthenticated','download','post','create','put','/:id','delete','/:id/delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index'];(function(_0x500ec5,_0x24242f){var _0x3564ec=function(_0x1f9839){while(--_0x1f9839){_0x500ec5['push'](_0x500ec5['shift']());}};_0x3564ec(++_0x24242f);}(_0x9172,0x91));var _0x2917=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x9172[_0x341e0f];return _0x59555a;};'use strict';var multer=require('multer');var util=require(_0x2917('0x0'));var path=require('path');var timeout=require(_0x2917('0x1'));var express=require(_0x2917('0x2'));var router=express['Router']();var fs_extra=require(_0x2917('0x3'));var auth=require(_0x2917('0x4'));var interaction=require(_0x2917('0x5'));var config=require(_0x2917('0x6'));var controller=require(_0x2917('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2917('0x8')]);router[_0x2917('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2917('0xa')]);router[_0x2917('0x9')](_0x2917('0xb'),auth[_0x2917('0xc')](),controller[_0x2917('0xd')]);router[_0x2917('0xe')]('/',auth[_0x2917('0xc')](),controller[_0x2917('0xf')]);router[_0x2917('0x10')](_0x2917('0x11'),auth[_0x2917('0xc')](),controller['update']);router[_0x2917('0x12')](_0x2917('0x13'),auth[_0x2917('0xc')](),controller[_0x2917('0x14')]);module[_0x2917('0x15')]=router; \ No newline at end of file +var _0x387d=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','/:id/delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x1eac9b,_0x24bf2f){var _0x33dfd6=function(_0x5ba3bc){while(--_0x5ba3bc){_0x1eac9b['push'](_0x1eac9b['shift']());}};_0x33dfd6(++_0x24bf2f);}(_0x387d,0x125));var _0xd387=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x387d[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xd387('0x0'));var util=require(_0xd387('0x1'));var path=require('path');var timeout=require(_0xd387('0x2'));var express=require(_0xd387('0x3'));var router=express[_0xd387('0x4')]();var fs_extra=require(_0xd387('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd387('0x6'));var controller=require(_0xd387('0x7'));router[_0xd387('0x8')]('/',auth[_0xd387('0x9')](),controller[_0xd387('0xa')]);router[_0xd387('0x8')](_0xd387('0xb'),auth[_0xd387('0x9')](),controller[_0xd387('0xc')]);router['get'](_0xd387('0xd'),auth[_0xd387('0x9')](),controller[_0xd387('0xe')]);router[_0xd387('0xf')]('/',auth[_0xd387('0x9')](),controller[_0xd387('0x10')]);router[_0xd387('0x11')](_0xd387('0xb'),auth['isAuthenticated'](),controller[_0xd387('0x12')]);router[_0xd387('0x13')](_0xd387('0x14'),auth[_0xd387('0x9')](),controller[_0xd387('0x15')]);module[_0xd387('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8355630..7c03b57 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 _0x3fdb=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3fdb,0x89));var _0xb3fd=function(_0x413185,_0x3ece43){_0x413185=_0x413185-0x0;var _0x56b367=_0x3fdb[_0x413185];return _0x56b367;};'use strict';var Sequelize=require(_0xb3fd('0x0'));module[_0xb3fd('0x1')]={'uniqueid':{'type':Sequelize[_0xb3fd('0x2')]},'callerid':{'type':Sequelize[_0xb3fd('0x2')]},'calleridname':{'type':Sequelize[_0xb3fd('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xb3fd('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xb3fd('0x2')]},'projectName':{'type':Sequelize[_0xb3fd('0x2')]},'saveName':{'type':Sequelize[_0xb3fd('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb3fd('0x3')],'get':function(){var _0x2f81f8='';var _0x206967=this[_0xb3fd('0x4')](_0xb3fd('0x5'));if(_0x206967){_0x2f81f8=_0x206967['substring'](_0x206967[_0xb3fd('0x6')]('.'));}return _0x2f81f8;}}}; \ No newline at end of file +var _0x25f2=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize','exports'];(function(_0x10c8d4,_0x45a4fc){var _0x54be50=function(_0x294491){while(--_0x294491){_0x10c8d4['push'](_0x10c8d4['shift']());}};_0x54be50(++_0x45a4fc);}(_0x25f2,0x1c5));var _0x225f=function(_0x3b4755,_0xadaac){_0x3b4755=_0x3b4755-0x0;var _0x1983c=_0x25f2[_0x3b4755];return _0x1983c;};'use strict';var Sequelize=require(_0x225f('0x0'));module[_0x225f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x225f('0x2')]},'calleridname':{'type':Sequelize[_0x225f('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x225f('0x2')]},'priority':{'type':Sequelize[_0x225f('0x2')]},'accountcode':{'type':Sequelize[_0x225f('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x225f('0x2')]},'saveName':{'type':Sequelize[_0x225f('0x2')]},'filename':{'type':Sequelize[_0x225f('0x2')]},'savePath':{'type':Sequelize[_0x225f('0x2')]},'format':{'type':Sequelize[_0x225f('0x3')],'get':function(){var _0xb3cd33='';var _0x14f5ee=this[_0x225f('0x4')](_0x225f('0x5'));if(_0x14f5ee){_0xb3cd33=_0x14f5ee[_0x225f('0x6')](_0x14f5ee['lastIndexOf']('.'));}return _0xb3cd33;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c80ec98..2f3612f 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 _0xda04=['request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xda04,0x128));var _0x4da0=function(_0xd46227,_0x18477f){_0xd46227=_0xd46227-0x0;var _0x2a980d=_0xda04[_0xd46227];return _0x2a980d;};'use strict';var pdf=require(_0x4da0('0x0'));var emlformat=require(_0x4da0('0x1'));var rimraf=require(_0x4da0('0x2'));var zipdir=require(_0x4da0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4da0('0x4'));var moment=require('moment');var BPromise=require(_0x4da0('0x5'));var Mustache=require(_0x4da0('0x6'));var util=require(_0x4da0('0x7'));var path=require('path');var sox=require(_0x4da0('0x8'));var csv=require(_0x4da0('0x9'));var ejs=require(_0x4da0('0xa'));var fs=require('fs');var fs_extra=require(_0x4da0('0xb'));var _=require('lodash');var squel=require(_0x4da0('0xc'));var crypto=require(_0x4da0('0xd'));var jsforce=require(_0x4da0('0xe'));var deskjs=require(_0x4da0('0xf'));var toCsv=require(_0x4da0('0x9'));var querystring=require(_0x4da0('0x10'));var Papa=require(_0x4da0('0x11'));var Redis=require(_0x4da0('0x12'));var authService=require(_0x4da0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4da0('0x14'));var hardwareService=require(_0x4da0('0x15'));var logger=require(_0x4da0('0x16'))(_0x4da0('0x17'));var utils=require(_0x4da0('0x18'));var config=require(_0x4da0('0x19'));var licenseUtil=require(_0x4da0('0x1a'));var db=require(_0x4da0('0x1b'))['db'];function respondWithStatusCode(_0x34af1e,_0x4467f4){_0x4467f4=_0x4467f4||0xcc;return function(_0x179688){if(_0x179688){return _0x34af1e[_0x4da0('0x1c')](_0x4467f4);}return _0x34af1e[_0x4da0('0x1d')](_0x4467f4)[_0x4da0('0x1e')]();};}function respondWithResult(_0x1a5203,_0x153325){_0x153325=_0x153325||0xc8;return function(_0x3a90b1){if(_0x3a90b1){return _0x1a5203[_0x4da0('0x1d')](_0x153325)['json'](_0x3a90b1);}};}function respondWithFilteredResult(_0x52519f,_0x44e74e){return function(_0x2db4c9){if(_0x2db4c9){var _0x113f75=_0x2db4c9[_0x4da0('0x1f')],_0x11464d=_0x44e74e[_0x4da0('0x20')],_0x5398c7=_0x44e74e[_0x4da0('0x20')]+_0x44e74e['limit'],_0x16ec6f;if(_0x5398c7>=_0x113f75){_0x5398c7=_0x113f75;_0x16ec6f=0xc8;}else{_0x16ec6f=0xce;}_0x52519f[_0x4da0('0x1d')](_0x16ec6f);return _0x52519f[_0x4da0('0x21')]('Content-Range',_0x11464d+'-'+_0x5398c7+'/'+_0x113f75)[_0x4da0('0x22')](_0x2db4c9);}return null;};}function patchUpdates(_0x31f5db){return function(_0x1389b5){try{jsonpatch[_0x4da0('0x23')](_0x1389b5,_0x31f5db,!![]);}catch(_0x4d7ee7){return BPromise[_0x4da0('0x24')](_0x4d7ee7);}return _0x1389b5['save']();};}function saveUpdates(_0x116572,_0x27788d){return function(_0x13d626){if(_0x13d626){return _0x13d626[_0x4da0('0x25')](_0x116572)['then'](function(_0x35cf15){return _0x35cf15;});}return null;};}function removeEntity(_0x354bf2,_0x5cf5f8){return function(_0x4b2423){if(_0x4b2423){return _0x4b2423['destroy']()[_0x4da0('0x26')](function(){_0x354bf2[_0x4da0('0x1d')](0xcc)[_0x4da0('0x1e')]();});}};}function handleEntityNotFound(_0x1b64a5,_0x24789c){return function(_0x2fc4d5){if(!_0x2fc4d5){_0x1b64a5['sendStatus'](0x194);}return _0x2fc4d5;};}function handleError(_0x5af358,_0x2c1994){_0x2c1994=_0x2c1994||0x1f4;return function(_0x255e45){logger[_0x4da0('0x27')](_0x255e45[_0x4da0('0x28')]);if(_0x255e45[_0x4da0('0x29')]){delete _0x255e45[_0x4da0('0x29')];}_0x5af358['status'](_0x2c1994)[_0x4da0('0x2a')](_0x255e45);};}exports[_0x4da0('0x2b')]=function(_0x578481,_0x438734){var _0x9dd40b={},_0x2c22a7={},_0xeb42f5={'count':0x0,'rows':[]};var _0x130405=_[_0x4da0('0x2c')](db['SquareRecording'][_0x4da0('0x2d')],function(_0x49cef2){return{'name':_0x49cef2[_0x4da0('0x2e')],'type':_0x49cef2[_0x4da0('0x2f')]['key']};});_0x2c22a7['model']=_[_0x4da0('0x2c')](_0x130405,_0x4da0('0x29'));_0x2c22a7[_0x4da0('0x30')]=_[_0x4da0('0x31')](_0x578481['query']);_0x2c22a7[_0x4da0('0x32')]=_[_0x4da0('0x33')](_0x2c22a7['model'],_0x2c22a7['query']);_0x9dd40b[_0x4da0('0x34')]=_[_0x4da0('0x33')](_0x2c22a7[_0x4da0('0x35')],qs[_0x4da0('0x36')](_0x578481['query']['fields']));_0x9dd40b[_0x4da0('0x34')]=_0x9dd40b[_0x4da0('0x34')][_0x4da0('0x37')]?_0x9dd40b['attributes']:_0x2c22a7['model'];if(!_0x578481['query'][_0x4da0('0x38')](_0x4da0('0x39'))){_0x9dd40b['limit']=qs[_0x4da0('0x3a')](_0x578481[_0x4da0('0x30')][_0x4da0('0x3a')]);_0x9dd40b['offset']=qs[_0x4da0('0x20')](_0x578481[_0x4da0('0x30')][_0x4da0('0x20')]);}_0x9dd40b[_0x4da0('0x3b')]=qs[_0x4da0('0x3c')](_0x578481['query']['sort']);_0x9dd40b['where']=qs[_0x4da0('0x32')](_[_0x4da0('0x3d')](_0x578481[_0x4da0('0x30')],_0x2c22a7[_0x4da0('0x32')]),_0x130405);if(_0x578481['query'][_0x4da0('0x3e')]){_0x9dd40b[_0x4da0('0x3f')]=_[_0x4da0('0x40')](_0x9dd40b[_0x4da0('0x3f')],{'$or':_['map'](_0x130405,function(_0x518378){if(_0x518378[_0x4da0('0x2f')]!=='VIRTUAL'){var _0x42dbf3={};_0x42dbf3[_0x518378['name']]={'$like':'%'+_0x578481[_0x4da0('0x30')][_0x4da0('0x3e')]+'%'};return _0x42dbf3;}})});}_0x9dd40b=_[_0x4da0('0x40')]({},_0x9dd40b,_0x578481[_0x4da0('0x41')]);var _0x57f3b6={'where':_0x9dd40b[_0x4da0('0x3f')]};return db[_0x4da0('0x42')][_0x4da0('0x1f')](_0x57f3b6)[_0x4da0('0x26')](function(_0x310bbc){_0xeb42f5['count']=_0x310bbc;if(_0x578481[_0x4da0('0x30')][_0x4da0('0x43')]){_0x9dd40b[_0x4da0('0x44')]=[{'all':!![]}];}return db[_0x4da0('0x42')][_0x4da0('0x45')](_0x9dd40b);})[_0x4da0('0x26')](function(_0x89f81d){_0xeb42f5[_0x4da0('0x46')]=_0x89f81d;return _0xeb42f5;})[_0x4da0('0x26')](respondWithFilteredResult(_0x438734,_0x9dd40b))[_0x4da0('0x47')](handleError(_0x438734,null));};exports[_0x4da0('0x48')]=function(_0x42905b,_0x1e59ab){var _0x1a3781={'raw':!![],'where':{'id':_0x42905b[_0x4da0('0x49')]['id']}},_0x4825c6={};_0x4825c6[_0x4da0('0x35')]=_['keys'](db[_0x4da0('0x42')][_0x4da0('0x2d')]);_0x4825c6[_0x4da0('0x30')]=_['keys'](_0x42905b['query']);_0x4825c6[_0x4da0('0x32')]=_[_0x4da0('0x33')](_0x4825c6[_0x4da0('0x35')],_0x4825c6[_0x4da0('0x30')]);_0x1a3781[_0x4da0('0x34')]=_[_0x4da0('0x33')](_0x4825c6[_0x4da0('0x35')],qs[_0x4da0('0x36')](_0x42905b[_0x4da0('0x30')][_0x4da0('0x36')]));_0x1a3781['attributes']=_0x1a3781[_0x4da0('0x34')][_0x4da0('0x37')]?_0x1a3781[_0x4da0('0x34')]:_0x4825c6[_0x4da0('0x35')];if(_0x42905b[_0x4da0('0x30')][_0x4da0('0x43')]){_0x1a3781[_0x4da0('0x44')]=[{'all':!![]}];}_0x1a3781=_[_0x4da0('0x40')]({},_0x1a3781,_0x42905b[_0x4da0('0x41')]);return db[_0x4da0('0x42')][_0x4da0('0x4a')](_0x1a3781)[_0x4da0('0x26')](handleEntityNotFound(_0x1e59ab,null))[_0x4da0('0x26')](respondWithResult(_0x1e59ab,null))[_0x4da0('0x47')](handleError(_0x1e59ab,null));};exports[_0x4da0('0x4b')]=function(_0x2aef51,_0xd95a50){return db[_0x4da0('0x42')]['create'](_0x2aef51['body'],{})[_0x4da0('0x26')](respondWithResult(_0xd95a50,0xc9))[_0x4da0('0x47')](handleError(_0xd95a50,null));};exports[_0x4da0('0x25')]=function(_0x852aac,_0x2f54c5){if(_0x852aac[_0x4da0('0x4c')]['id']){delete _0x852aac[_0x4da0('0x4c')]['id'];}return db[_0x4da0('0x42')][_0x4da0('0x4a')]({'where':{'id':_0x852aac[_0x4da0('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f54c5,null))['then'](saveUpdates(_0x852aac[_0x4da0('0x4c')],null))[_0x4da0('0x26')](respondWithResult(_0x2f54c5,null))['catch'](handleError(_0x2f54c5,null));};exports[_0x4da0('0x4d')]=function(_0x5953b6,_0x7f928a,_0x305b2d){var _0x1106da=require(_0x4da0('0x4e'));var _0x492b06=![];var _0x543ea5={};if(_0x5953b6['query'][_0x4da0('0x2f')]&&_0x5953b6[_0x4da0('0x30')][_0x4da0('0x2f')]===_0x4da0('0x4f')){_0x543ea5[_0x4da0('0x4f')]=_0x5953b6['params']['id'];}else{_0x543ea5['id']=_0x5953b6[_0x4da0('0x49')]['id'];}return db['SquareRecording'][_0x4da0('0x4a')]({'where':_0x543ea5,'attributes':['id',_0x4da0('0x50'),_0x4da0('0x51')],'raw':!![]})[_0x4da0('0x26')](handleEntityNotFound(_0x7f928a,null))[_0x4da0('0x26')](function(_0x39e1d6){if(_0x39e1d6){var _0x424647=_0x39e1d6[_0x4da0('0x50')];var _0x161661=util[_0x4da0('0x52')](_0x4da0('0x53'),_0x424647);if(fs[_0x4da0('0x54')](_0x161661)){_0x492b06=!![];return _0x1106da[_0x4da0('0x55')](_0x161661,_0x424647,config[_0x4da0('0x56')][_0x4da0('0x57')])[_0x4da0('0x26')](function(){return _0x39e1d6;});}return _0x39e1d6;}})[_0x4da0('0x26')](function(_0x24f5b3){if(_0x24f5b3){var _0x27c1d0=_0x24f5b3[_0x4da0('0x50')];if(!fs['existsSync'](_0x27c1d0)){throw new db[(_0x4da0('0x58'))]['ValidationError'](_0x4da0('0x59'));}if(_0x24f5b3[_0x4da0('0x51')]){return _0x7f928a[_0x4da0('0x4d')](_0x27c1d0,_0x24f5b3[_0x4da0('0x51')]+path[_0x4da0('0x5a')](_0x27c1d0),function(){if(_0x492b06){fs[_0x4da0('0x5b')](_0x27c1d0);}});}else{return _0x7f928a[_0x4da0('0x4d')](_0x27c1d0,function(_0x396aea){if(_0x492b06){fs[_0x4da0('0x5b')](_0x27c1d0);}});}}})['catch'](function(_0x558587){if(_0x558587['message']===_0x4da0('0x59')){_0x7f928a['status'](0x194)['send'](_0x4da0('0x5c'));}else{return handleError(_0x7f928a,null);}});};exports[_0x4da0('0x5d')]=function(_0x1d138b,_0x36bee4){return db[_0x4da0('0x42')][_0x4da0('0x4a')]({'where':{'id':_0x1d138b['params']['id']}})[_0x4da0('0x26')](function(_0x2a7398){if(!_0x2a7398)throw new ReferenceError('Entity\x20not\x20found');return _0x2a7398;})[_0x4da0('0x26')](function(_0x32d195){var _0x2679e3=_0x32d195[_0x4da0('0x50')];logger[_0x4da0('0x5e')](_0x4da0('0x5f'),_0x2679e3);if(!_['isNil'](_0x32d195[_0x4da0('0x50')])&&fs[_0x4da0('0x54')](_0x2679e3)){logger[_0x4da0('0x5e')](_0x4da0('0x60')+_0x2679e3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4da0('0x61')](_0x2679e3);}_0x2679e3=_0x2679e3+_0x4da0('0x62');if(!_['isNil'](_0x32d195[_0x4da0('0x50')])&&fs[_0x4da0('0x54')](_0x2679e3)){logger[_0x4da0('0x5e')](_0x4da0('0x60')+_0x2679e3+_0x4da0('0x63'));fs[_0x4da0('0x61')](_0x2679e3);}return _0x32d195;})[_0x4da0('0x26')](function(_0x534723){if(!_0x534723)throw new InternalError();return _0x534723[_0x4da0('0x5d')]();})[_0x4da0('0x26')](function(){_0x36bee4[_0x4da0('0x1d')](0xcc)[_0x4da0('0x1e')]();})[_0x4da0('0x47')](handleError(_0x36bee4,null));}; \ No newline at end of file +var _0x7255=['request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','end','error','stack','name','send','index','SquareRecording','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','then','include','findAll','show','params','rawAttributes','includeAll','find','create','body','catch','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7255,0x1e1));var _0x5725=function(_0x39c4d8,_0x5b71d3){_0x39c4d8=_0x39c4d8-0x0;var _0x262245=_0x7255[_0x39c4d8];return _0x262245;};'use strict';var pdf=require(_0x5725('0x0'));var emlformat=require(_0x5725('0x1'));var rimraf=require(_0x5725('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5725('0x3'));var rp=require(_0x5725('0x4'));var moment=require('moment');var BPromise=require(_0x5725('0x5'));var Mustache=require('mustache');var util=require(_0x5725('0x6'));var path=require(_0x5725('0x7'));var sox=require(_0x5725('0x8'));var csv=require(_0x5725('0x9'));var ejs=require(_0x5725('0xa'));var fs=require('fs');var fs_extra=require(_0x5725('0xb'));var _=require(_0x5725('0xc'));var squel=require('squel');var crypto=require(_0x5725('0xd'));var jsforce=require(_0x5725('0xe'));var deskjs=require(_0x5725('0xf'));var toCsv=require(_0x5725('0x9'));var querystring=require('querystring');var Papa=require(_0x5725('0x10'));var Redis=require(_0x5725('0x11'));var authService=require(_0x5725('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5725('0x13'));var logger=require(_0x5725('0x14'))(_0x5725('0x15'));var utils=require('../../config/utils');var config=require(_0x5725('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c2b2f,_0x1265d7){_0x1265d7=_0x1265d7||0xcc;return function(_0x58ecf7){if(_0x58ecf7){return _0x1c2b2f[_0x5725('0x17')](_0x1265d7);}return _0x1c2b2f[_0x5725('0x18')](_0x1265d7)['end']();};}function respondWithResult(_0x38603d,_0x2f558f){_0x2f558f=_0x2f558f||0xc8;return function(_0x231c1d){if(_0x231c1d){return _0x38603d['status'](_0x2f558f)[_0x5725('0x19')](_0x231c1d);}};}function respondWithFilteredResult(_0x508584,_0x390849){return function(_0x53f960){if(_0x53f960){var _0x202ef2=_0x53f960[_0x5725('0x1a')],_0x513227=_0x390849[_0x5725('0x1b')],_0x40befd=_0x390849[_0x5725('0x1b')]+_0x390849[_0x5725('0x1c')],_0x29cd6e;if(_0x40befd>=_0x202ef2){_0x40befd=_0x202ef2;_0x29cd6e=0xc8;}else{_0x29cd6e=0xce;}_0x508584[_0x5725('0x18')](_0x29cd6e);return _0x508584[_0x5725('0x1d')](_0x5725('0x1e'),_0x513227+'-'+_0x40befd+'/'+_0x202ef2)[_0x5725('0x19')](_0x53f960);}return null;};}function patchUpdates(_0x4f93b7){return function(_0x1b099c){try{jsonpatch[_0x5725('0x1f')](_0x1b099c,_0x4f93b7,!![]);}catch(_0x4e1f3c){return BPromise['reject'](_0x4e1f3c);}return _0x1b099c['save']();};}function saveUpdates(_0x393932,_0x2d13d4){return function(_0x2ec2bc){if(_0x2ec2bc){return _0x2ec2bc[_0x5725('0x20')](_0x393932)['then'](function(_0x4c5018){return _0x4c5018;});}return null;};}function removeEntity(_0x3823af,_0x1f31c7){return function(_0x1724fd){if(_0x1724fd){return _0x1724fd[_0x5725('0x21')]()['then'](function(){_0x3823af[_0x5725('0x18')](0xcc)[_0x5725('0x22')]();});}};}function handleEntityNotFound(_0x51dd96,_0x47488b){return function(_0x2a1d33){if(!_0x2a1d33){_0x51dd96[_0x5725('0x17')](0x194);}return _0x2a1d33;};}function handleError(_0x4888c5,_0xd876a9){_0xd876a9=_0xd876a9||0x1f4;return function(_0x14f077){logger[_0x5725('0x23')](_0x14f077[_0x5725('0x24')]);if(_0x14f077[_0x5725('0x25')]){delete _0x14f077[_0x5725('0x25')];}_0x4888c5[_0x5725('0x18')](_0xd876a9)[_0x5725('0x26')](_0x14f077);};}exports[_0x5725('0x27')]=function(_0x3ee388,_0x5cd3f3){var _0xb2cb57={},_0x23642a={},_0x28ca81={'count':0x0,'rows':[]};var _0x146597=_['map'](db[_0x5725('0x28')]['rawAttributes'],function(_0x573ed5){return{'name':_0x573ed5['fieldName'],'type':_0x573ed5['type']['key']};});_0x23642a[_0x5725('0x29')]=_[_0x5725('0x2a')](_0x146597,'name');_0x23642a[_0x5725('0x2b')]=_[_0x5725('0x2c')](_0x3ee388[_0x5725('0x2b')]);_0x23642a[_0x5725('0x2d')]=_['intersection'](_0x23642a[_0x5725('0x29')],_0x23642a[_0x5725('0x2b')]);_0xb2cb57['attributes']=_[_0x5725('0x2e')](_0x23642a[_0x5725('0x29')],qs[_0x5725('0x2f')](_0x3ee388[_0x5725('0x2b')][_0x5725('0x2f')]));_0xb2cb57[_0x5725('0x30')]=_0xb2cb57[_0x5725('0x30')][_0x5725('0x31')]?_0xb2cb57[_0x5725('0x30')]:_0x23642a[_0x5725('0x29')];if(!_0x3ee388['query'][_0x5725('0x32')](_0x5725('0x33'))){_0xb2cb57['limit']=qs[_0x5725('0x1c')](_0x3ee388['query']['limit']);_0xb2cb57[_0x5725('0x1b')]=qs['offset'](_0x3ee388['query'][_0x5725('0x1b')]);}_0xb2cb57[_0x5725('0x34')]=qs[_0x5725('0x35')](_0x3ee388[_0x5725('0x2b')][_0x5725('0x35')]);_0xb2cb57[_0x5725('0x36')]=qs[_0x5725('0x2d')](_[_0x5725('0x37')](_0x3ee388[_0x5725('0x2b')],_0x23642a[_0x5725('0x2d')]),_0x146597);if(_0x3ee388[_0x5725('0x2b')][_0x5725('0x38')]){_0xb2cb57[_0x5725('0x36')]=_['merge'](_0xb2cb57['where'],{'$or':_[_0x5725('0x2a')](_0x146597,function(_0x16f94d){if(_0x16f94d[_0x5725('0x39')]!==_0x5725('0x3a')){var _0x59ed03={};_0x59ed03[_0x16f94d[_0x5725('0x25')]]={'$like':'%'+_0x3ee388[_0x5725('0x2b')][_0x5725('0x38')]+'%'};return _0x59ed03;}})});}_0xb2cb57=_[_0x5725('0x3b')]({},_0xb2cb57,_0x3ee388[_0x5725('0x3c')]);var _0x2e00e1={'where':_0xb2cb57[_0x5725('0x36')]};return db[_0x5725('0x28')][_0x5725('0x1a')](_0x2e00e1)[_0x5725('0x3d')](function(_0x215a60){_0x28ca81['count']=_0x215a60;if(_0x3ee388[_0x5725('0x2b')]['includeAll']){_0xb2cb57[_0x5725('0x3e')]=[{'all':!![]}];}return db[_0x5725('0x28')][_0x5725('0x3f')](_0xb2cb57);})['then'](function(_0x4b36ac){_0x28ca81['rows']=_0x4b36ac;return _0x28ca81;})[_0x5725('0x3d')](respondWithFilteredResult(_0x5cd3f3,_0xb2cb57))['catch'](handleError(_0x5cd3f3,null));};exports[_0x5725('0x40')]=function(_0x3be316,_0x5a6078){var _0x1c4f17={'raw':!![],'where':{'id':_0x3be316[_0x5725('0x41')]['id']}},_0x37311e={};_0x37311e[_0x5725('0x29')]=_[_0x5725('0x2c')](db[_0x5725('0x28')][_0x5725('0x42')]);_0x37311e['query']=_['keys'](_0x3be316[_0x5725('0x2b')]);_0x37311e[_0x5725('0x2d')]=_[_0x5725('0x2e')](_0x37311e['model'],_0x37311e['query']);_0x1c4f17[_0x5725('0x30')]=_['intersection'](_0x37311e[_0x5725('0x29')],qs['fields'](_0x3be316['query'][_0x5725('0x2f')]));_0x1c4f17[_0x5725('0x30')]=_0x1c4f17[_0x5725('0x30')][_0x5725('0x31')]?_0x1c4f17['attributes']:_0x37311e[_0x5725('0x29')];if(_0x3be316['query'][_0x5725('0x43')]){_0x1c4f17[_0x5725('0x3e')]=[{'all':!![]}];}_0x1c4f17=_[_0x5725('0x3b')]({},_0x1c4f17,_0x3be316[_0x5725('0x3c')]);return db['SquareRecording'][_0x5725('0x44')](_0x1c4f17)[_0x5725('0x3d')](handleEntityNotFound(_0x5a6078,null))[_0x5725('0x3d')](respondWithResult(_0x5a6078,null))['catch'](handleError(_0x5a6078,null));};exports[_0x5725('0x45')]=function(_0x2a5cbd,_0x3dce86){return db['SquareRecording'][_0x5725('0x45')](_0x2a5cbd[_0x5725('0x46')],{})[_0x5725('0x3d')](respondWithResult(_0x3dce86,0xc9))[_0x5725('0x47')](handleError(_0x3dce86,null));};exports[_0x5725('0x20')]=function(_0x13a07c,_0x192254){if(_0x13a07c['body']['id']){delete _0x13a07c['body']['id'];}return db[_0x5725('0x28')][_0x5725('0x44')]({'where':{'id':_0x13a07c[_0x5725('0x41')]['id']}})[_0x5725('0x3d')](handleEntityNotFound(_0x192254,null))[_0x5725('0x3d')](saveUpdates(_0x13a07c[_0x5725('0x46')],null))[_0x5725('0x3d')](respondWithResult(_0x192254,null))['catch'](handleError(_0x192254,null));};exports[_0x5725('0x48')]=function(_0x1ef08c,_0x26c157,_0xd1d27b){var _0xc4b8b4=require('../../components/encryptor');var _0x494ccd=![];var _0x59a62d={};if(_0x1ef08c[_0x5725('0x2b')][_0x5725('0x39')]&&_0x1ef08c[_0x5725('0x2b')][_0x5725('0x39')]==='uniqueid'){_0x59a62d[_0x5725('0x49')]=_0x1ef08c['params']['id'];}else{_0x59a62d['id']=_0x1ef08c[_0x5725('0x41')]['id'];}return db[_0x5725('0x28')][_0x5725('0x44')]({'where':_0x59a62d,'attributes':['id',_0x5725('0x4a'),_0x5725('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x26c157,null))[_0x5725('0x3d')](function(_0x28f3ac){if(_0x28f3ac){var _0x208656=_0x28f3ac[_0x5725('0x4a')];var _0x402637=util[_0x5725('0x4c')](_0x5725('0x4d'),_0x208656);if(fs[_0x5725('0x4e')](_0x402637)){_0x494ccd=!![];return _0xc4b8b4[_0x5725('0x4f')](_0x402637,_0x208656,config[_0x5725('0x50')][_0x5725('0x51')])[_0x5725('0x3d')](function(){return _0x28f3ac;});}return _0x28f3ac;}})[_0x5725('0x3d')](function(_0xae9939){if(_0xae9939){var _0x2adb1a=_0xae9939[_0x5725('0x4a')];if(!fs[_0x5725('0x4e')](_0x2adb1a)){throw new db[(_0x5725('0x52'))][(_0x5725('0x53'))](_0x5725('0x54'));}if(_0xae9939[_0x5725('0x4b')]){return _0x26c157['download'](_0x2adb1a,_0xae9939[_0x5725('0x4b')]+path[_0x5725('0x55')](_0x2adb1a),function(){if(_0x494ccd){fs[_0x5725('0x56')](_0x2adb1a);}});}else{return _0x26c157[_0x5725('0x48')](_0x2adb1a,function(_0x519bce){if(_0x494ccd){fs[_0x5725('0x56')](_0x2adb1a);}});}}})[_0x5725('0x47')](function(_0x3ba8b5){if(_0x3ba8b5[_0x5725('0x57')]===_0x5725('0x54')){_0x26c157['status'](0x194)['send'](_0x5725('0x58'));}else{return handleError(_0x26c157,null);}});};exports[_0x5725('0x21')]=function(_0x5e7c42,_0x162807){return db[_0x5725('0x28')][_0x5725('0x44')]({'where':{'id':_0x5e7c42[_0x5725('0x41')]['id']}})[_0x5725('0x3d')](function(_0x2ac5fa){if(!_0x2ac5fa)throw new ReferenceError(_0x5725('0x59'));return _0x2ac5fa;})['then'](function(_0xb7b08){var _0xb8f1b1=_0xb7b08[_0x5725('0x4a')];logger[_0x5725('0x5a')](_0x5725('0x5b'),_0xb8f1b1);if(!_[_0x5725('0x5c')](_0xb7b08['savePath'])&&fs['existsSync'](_0xb8f1b1)){logger['info'](_0x5725('0x5d')+_0xb8f1b1+_0x5725('0x5e'));fs[_0x5725('0x5f')](_0xb8f1b1);}_0xb8f1b1=_0xb8f1b1+_0x5725('0x60');if(!_[_0x5725('0x5c')](_0xb7b08[_0x5725('0x4a')])&&fs[_0x5725('0x4e')](_0xb8f1b1)){logger['info']('File:\x20\x22'+_0xb8f1b1+_0x5725('0x5e'));fs[_0x5725('0x5f')](_0xb8f1b1);}return _0xb7b08;})[_0x5725('0x3d')](function(_0x3c91aa){if(!_0x3c91aa)throw new InternalError();return _0x3c91aa[_0x5725('0x21')]();})['then'](function(){_0x162807[_0x5725('0x18')](0xcc)['end']();})[_0x5725('0x47')](handleError(_0x162807,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a411cd8..e541da0 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 _0xbc87=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x334c50,_0x1f11d0){var _0x524766=function(_0x5066de){while(--_0x5066de){_0x334c50['push'](_0x334c50['shift']());}};_0x524766(++_0x1f11d0);}(_0xbc87,0x144));var _0x7bc8=function(_0x311d91,_0x4b9dc9){_0x311d91=_0x311d91-0x0;var _0x3705e1=_0xbc87[_0x311d91];return _0x3705e1;};'use strict';var _=require(_0x7bc8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7bc8('0x1'));var moment=require(_0x7bc8('0x2'));var BPromise=require(_0x7bc8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7bc8('0x4'));var config=require(_0x7bc8('0x5'));var attributes=require(_0x7bc8('0x6'));module[_0x7bc8('0x7')]=function(_0x489d0b,_0x184610){return _0x489d0b[_0x7bc8('0x8')](_0x7bc8('0x9'),attributes,{'tableName':_0x7bc8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3014=['define','SquareRecording','square_recordings','lodash','util','api','moment','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3014,0x1d7));var _0x4301=function(_0x2f1822,_0x28d914){_0x2f1822=_0x2f1822-0x0;var _0x3f58b5=_0x3014[_0x2f1822];return _0x3f58b5;};'use strict';var _=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var logger=require('../../config/logger')(_0x4301('0x2'));var moment=require(_0x4301('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4301('0x4'));var rimraf=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var attributes=require(_0x4301('0x7'));module[_0x4301('0x8')]=function(_0x42ced6,_0x42ac4b){return _0x42ced6[_0x4301('0x9')](_0x4301('0xa'),attributes,{'tableName':_0x4301('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 76efbe8..8072961 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 _0x2c0c=['info','result','CreateSquareRecording','SquareRecording','create','body','options','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x2f3b38,_0x124a76){var _0x576a57=function(_0x319f21){while(--_0x319f21){_0x2f3b38['push'](_0x2f3b38['shift']());}};_0x576a57(++_0x124a76);}(_0x2c0c,0x13c));var _0xc2c0=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x2c0c[_0x2353fe];return _0x4d43f6;};'use strict';var _=require(_0xc2c0('0x0'));var util=require(_0xc2c0('0x1'));var moment=require(_0xc2c0('0x2'));var BPromise=require(_0xc2c0('0x3'));var rs=require(_0xc2c0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2c0('0x5'))['db'];var utils=require(_0xc2c0('0x6'));var logger=require(_0xc2c0('0x7'))(_0xc2c0('0x8'));var config=require(_0xc2c0('0x9'));var jayson=require(_0xc2c0('0xa'));var client=jayson['client'][_0xc2c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5022c3,_0xdaf1ca,_0x31fdbc){return new BPromise(function(_0x3c5b45,_0x389e26){return client['request'](_0x5022c3,_0x31fdbc)[_0xc2c0('0xc')](function(_0x3eda20){logger['info'](_0xc2c0('0xd'),_0xdaf1ca,'request\x20sent');logger[_0xc2c0('0xe')](_0xc2c0('0xf'),_0xdaf1ca,_0xc2c0('0x10'),JSON[_0xc2c0('0x11')](_0x3eda20));if(_0x3eda20[_0xc2c0('0x12')]){if(_0x3eda20[_0xc2c0('0x12')]['code']===0x1f4){logger[_0xc2c0('0x12')](_0xc2c0('0xd'),_0xdaf1ca,_0x3eda20[_0xc2c0('0x12')]['message']);return _0x389e26(_0x3eda20[_0xc2c0('0x12')][_0xc2c0('0x13')]);}logger['error'](_0xc2c0('0xd'),_0xdaf1ca,_0x3eda20[_0xc2c0('0x12')][_0xc2c0('0x13')]);return _0x3c5b45(_0x3eda20[_0xc2c0('0x12')]['message']);}else{logger[_0xc2c0('0x14')](_0xc2c0('0xd'),_0xdaf1ca,'request\x20sent');_0x3c5b45(_0x3eda20[_0xc2c0('0x15')]['message']);}})['catch'](function(_0x128307){logger['error'](_0xc2c0('0xd'),_0xdaf1ca,_0x128307);_0x389e26(_0x128307);});});}exports[_0xc2c0('0x16')]=function(_0x265e6c){var _0x19a902=this;return new Promise(function(_0x3094ab,_0x4d4db9){return db[_0xc2c0('0x17')][_0xc2c0('0x18')](_0x265e6c[_0xc2c0('0x19')],{'raw':_0x265e6c[_0xc2c0('0x1a')]?_0x265e6c[_0xc2c0('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xc2c0('0xc')](function(_0x26c502){logger['info'](_0xc2c0('0x16'),_0x265e6c);logger['debug']('CreateSquareRecording',_0x265e6c,JSON[_0xc2c0('0x11')](_0x26c502));_0x3094ab(_0x26c502);})[_0xc2c0('0x1b')](function(_0x4d24d9){logger[_0xc2c0('0x12')]('CreateSquareRecording',_0x4d24d9[_0xc2c0('0x13')],_0x265e6c);_0x4d4db9(_0x19a902[_0xc2c0('0x12')](0x1f4,_0x4d24d9['message']));});});}; \ No newline at end of file +var _0xb52f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0xb52f,0x109));var _0xfb52=function(_0x1d9a1d,_0x491c27){_0x1d9a1d=_0x1d9a1d-0x0;var _0x4bfe30=_0xb52f[_0x1d9a1d];return _0x4bfe30;};'use strict';var _=require(_0xfb52('0x0'));var util=require(_0xfb52('0x1'));var moment=require(_0xfb52('0x2'));var BPromise=require(_0xfb52('0x3'));var rs=require(_0xfb52('0x4'));var fs=require('fs');var Redis=require(_0xfb52('0x5'));var db=require(_0xfb52('0x6'))['db'];var utils=require(_0xfb52('0x7'));var logger=require(_0xfb52('0x8'))('rpc');var config=require(_0xfb52('0x9'));var jayson=require(_0xfb52('0xa'));var client=jayson[_0xfb52('0xb')][_0xfb52('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bd42e,_0x2dd434,_0x56219f){return new BPromise(function(_0x3555f1,_0x1ac36b){return client[_0xfb52('0xd')](_0x5bd42e,_0x56219f)[_0xfb52('0xe')](function(_0x419eca){logger[_0xfb52('0xf')](_0xfb52('0x10'),_0x2dd434,'request\x20sent');logger[_0xfb52('0x11')](_0xfb52('0x12'),_0x2dd434,_0xfb52('0x13'),JSON[_0xfb52('0x14')](_0x419eca));if(_0x419eca[_0xfb52('0x15')]){if(_0x419eca['error'][_0xfb52('0x16')]===0x1f4){logger[_0xfb52('0x15')](_0xfb52('0x10'),_0x2dd434,_0x419eca[_0xfb52('0x15')]['message']);return _0x1ac36b(_0x419eca[_0xfb52('0x15')][_0xfb52('0x17')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x2dd434,_0x419eca[_0xfb52('0x15')]['message']);return _0x3555f1(_0x419eca[_0xfb52('0x15')]['message']);}else{logger['info'](_0xfb52('0x10'),_0x2dd434,'request\x20sent');_0x3555f1(_0x419eca['result']['message']);}})[_0xfb52('0x18')](function(_0x3a6828){logger[_0xfb52('0x15')](_0xfb52('0x10'),_0x2dd434,_0x3a6828);_0x1ac36b(_0x3a6828);});});}exports[_0xfb52('0x19')]=function(_0x25e672){var _0x1a5f67=this;return new Promise(function(_0x2f6787,_0x1c9aa1){return db[_0xfb52('0x1a')][_0xfb52('0x1b')](_0x25e672['body'],{'raw':_0x25e672['options']?_0x25e672[_0xfb52('0x1c')][_0xfb52('0x1d')]===undefined?!![]:![]:!![]})[_0xfb52('0xe')](function(_0x533f3c){logger[_0xfb52('0xf')](_0xfb52('0x19'),_0x25e672);logger[_0xfb52('0x11')](_0xfb52('0x19'),_0x25e672,JSON[_0xfb52('0x14')](_0x533f3c));_0x2f6787(_0x533f3c);})[_0xfb52('0x18')](function(_0x39007f){logger['error'](_0xfb52('0x19'),_0x39007f[_0xfb52('0x17')],_0x25e672);_0x1c9aa1(_0x1a5f67[_0xfb52('0x15')](0x1f4,_0x39007f[_0xfb52('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8fd94b4..64f164b 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 _0x988c=['isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','multer','express','Router','fs-extra','./squareReport.controller','get'];(function(_0x173a01,_0x5cd741){var _0x1f7968=function(_0x68dd81){while(--_0x68dd81){_0x173a01['push'](_0x173a01['shift']());}};_0x1f7968(++_0x5cd741);}(_0x988c,0x19e));var _0xc988=function(_0x258c17,_0x191833){_0x258c17=_0x258c17-0x0;var _0x17929b=_0x988c[_0x258c17];return _0x17929b;};'use strict';var multer=require(_0xc988('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc988('0x1'));var router=express[_0xc988('0x2')]();var fs_extra=require(_0xc988('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc988('0x4'));router[_0xc988('0x5')]('/',auth[_0xc988('0x6')](),controller['index']);router[_0xc988('0x5')](_0xc988('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xc988('0x5')](_0xc988('0x8'),auth[_0xc988('0x6')](),controller[_0xc988('0x9')]);router[_0xc988('0xa')]('/',auth['isAuthenticated'](),controller[_0xc988('0xb')]);router[_0xc988('0xc')](_0xc988('0x8'),auth[_0xc988('0x6')](),controller[_0xc988('0xd')]);router['delete'](_0xc988('0x8'),auth[_0xc988('0x6')](),controller[_0xc988('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5fbd=['/:id','show','post','isAuthenticated','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get'];(function(_0x5734ab,_0x537b83){var _0x4b862e=function(_0x1619a1){while(--_0x1619a1){_0x5734ab['push'](_0x5734ab['shift']());}};_0x4b862e(++_0x537b83);}(_0x5fbd,0x104));var _0xd5fb=function(_0x147124,_0xe6edd7){_0x147124=_0x147124-0x0;var _0x476987=_0x5fbd[_0x147124];return _0x476987;};'use strict';var multer=require(_0xd5fb('0x0'));var util=require(_0xd5fb('0x1'));var path=require(_0xd5fb('0x2'));var timeout=require(_0xd5fb('0x3'));var express=require('express');var router=express[_0xd5fb('0x4')]();var fs_extra=require(_0xd5fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd5fb('0x6'));var config=require(_0xd5fb('0x7'));var controller=require(_0xd5fb('0x8'));router[_0xd5fb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd5fb('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd5fb('0x9')](_0xd5fb('0xa'),auth['isAuthenticated'](),controller[_0xd5fb('0xb')]);router[_0xd5fb('0xc')]('/',auth[_0xd5fb('0xd')](),controller['create']);router[_0xd5fb('0xe')](_0xd5fb('0xa'),auth[_0xd5fb('0xd')](),controller[_0xd5fb('0xf')]);router[_0xd5fb('0x10')](_0xd5fb('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd5fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 533eb3b..0826d5a 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 _0x6211=['STRING','DATE','BOOLEAN','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6211,0xa7));var _0x1621=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6211[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x1621('0x0')]={'network':{'type':Sequelize[_0x1621('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x1621('0x1')]},'channel':{'type':Sequelize[_0x1621('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1621('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x1621('0x1')]},'callerid':{'type':Sequelize[_0x1621('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x1621('0x1')]},'callingani2':{'type':Sequelize[_0x1621('0x1')]},'callington':{'type':Sequelize[_0x1621('0x1')]},'callingtns':{'type':Sequelize[_0x1621('0x1')]},'dnid':{'type':Sequelize[_0x1621('0x1')]},'rdnis':{'type':Sequelize[_0x1621('0x1')]},'context':{'type':Sequelize[_0x1621('0x1')]},'extension':{'type':Sequelize[_0x1621('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x1621('0x1')]},'accountcode':{'type':Sequelize[_0x1621('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1621('0x2')]},'leaveAt':{'type':Sequelize[_0x1621('0x2')]},'bot':{'type':Sequelize[_0x1621('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7b9b=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x1b0b37,_0x47de7c){var _0x30d2c3=function(_0x2e5c07){while(--_0x2e5c07){_0x1b0b37['push'](_0x1b0b37['shift']());}};_0x30d2c3(++_0x47de7c);}(_0x7b9b,0x1a5));var _0xb7b9=function(_0x16dfb3,_0x1613fc){_0x16dfb3=_0x16dfb3-0x0;var _0x1d8030=_0x7b9b[_0x16dfb3];return _0x1d8030;};'use strict';var Sequelize=require(_0xb7b9('0x0'));module[_0xb7b9('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xb7b9('0x2')]},'channel':{'type':Sequelize[_0xb7b9('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb7b9('0x2')]},'version':{'type':Sequelize[_0xb7b9('0x2')]},'callerid':{'type':Sequelize[_0xb7b9('0x2')]},'calleridname':{'type':Sequelize[_0xb7b9('0x2')]},'callingpres':{'type':Sequelize[_0xb7b9('0x2')]},'callingani2':{'type':Sequelize[_0xb7b9('0x2')]},'callington':{'type':Sequelize[_0xb7b9('0x2')]},'callingtns':{'type':Sequelize[_0xb7b9('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xb7b9('0x2')]},'context':{'type':Sequelize[_0xb7b9('0x2')]},'extension':{'type':Sequelize[_0xb7b9('0x2')]},'priority':{'type':Sequelize[_0xb7b9('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb7b9('0x2')]},'threadid':{'type':Sequelize[_0xb7b9('0x2')]},'project_name':{'type':Sequelize[_0xb7b9('0x2')]},'joinAt':{'type':Sequelize[_0xb7b9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xb7b9('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 1704405..81ca582 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 _0xb286=['../../config/license/util','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','SquareReport','intersection','length','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','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'];(function(_0x49098b,_0x6f7b12){var _0x3d35c6=function(_0x13c3f1){while(--_0x13c3f1){_0x49098b['push'](_0x49098b['shift']());}};_0x3d35c6(++_0x6f7b12);}(_0xb286,0x1aa));var _0x6b28=function(_0x302415,_0x793b99){_0x302415=_0x302415-0x0;var _0x197d39=_0xb286[_0x302415];return _0x197d39;};'use strict';var pdf=require(_0x6b28('0x0'));var emlformat=require(_0x6b28('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6b28('0x2'));var jsonpatch=require(_0x6b28('0x3'));var rp=require(_0x6b28('0x4'));var moment=require(_0x6b28('0x5'));var BPromise=require(_0x6b28('0x6'));var Mustache=require(_0x6b28('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6b28('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b28('0x9'));var _=require(_0x6b28('0xa'));var squel=require(_0x6b28('0xb'));var crypto=require(_0x6b28('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6b28('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b28('0xe'));var Papa=require(_0x6b28('0xf'));var Redis=require(_0x6b28('0x10'));var authService=require(_0x6b28('0x11'));var qs=require(_0x6b28('0x12'));var as=require(_0x6b28('0x13'));var hardwareService=require(_0x6b28('0x14'));var logger=require('../../config/logger')(_0x6b28('0x15'));var utils=require(_0x6b28('0x16'));var config=require(_0x6b28('0x17'));var licenseUtil=require(_0x6b28('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47a15f,_0x30f55e){_0x30f55e=_0x30f55e||0xcc;return function(_0x2101ad){if(_0x2101ad){return _0x47a15f[_0x6b28('0x19')](_0x30f55e);}return _0x47a15f[_0x6b28('0x1a')](_0x30f55e)[_0x6b28('0x1b')]();};}function respondWithResult(_0x401281,_0x2dbe8a){_0x2dbe8a=_0x2dbe8a||0xc8;return function(_0x61a5cd){if(_0x61a5cd){return _0x401281[_0x6b28('0x1a')](_0x2dbe8a)['json'](_0x61a5cd);}};}function respondWithFilteredResult(_0x2a8d2c,_0xb89799){return function(_0x5c7684){if(_0x5c7684){var _0x194f4a=_0x5c7684[_0x6b28('0x1c')],_0x3ca608=_0xb89799[_0x6b28('0x1d')],_0xcba804=_0xb89799['offset']+_0xb89799[_0x6b28('0x1e')],_0x1f6331;if(_0xcba804>=_0x194f4a){_0xcba804=_0x194f4a;_0x1f6331=0xc8;}else{_0x1f6331=0xce;}_0x2a8d2c[_0x6b28('0x1a')](_0x1f6331);return _0x2a8d2c['set'](_0x6b28('0x1f'),_0x3ca608+'-'+_0xcba804+'/'+_0x194f4a)[_0x6b28('0x20')](_0x5c7684);}return null;};}function patchUpdates(_0x40c41d){return function(_0x393ed6){try{jsonpatch[_0x6b28('0x21')](_0x393ed6,_0x40c41d,!![]);}catch(_0x172e69){return BPromise[_0x6b28('0x22')](_0x172e69);}return _0x393ed6['save']();};}function saveUpdates(_0x3ae01e,_0x49ac6c){return function(_0xc8300d){if(_0xc8300d){return _0xc8300d[_0x6b28('0x23')](_0x3ae01e)[_0x6b28('0x24')](function(_0x4a0f52){return _0x4a0f52;});}return null;};}function removeEntity(_0x473994,_0x11d479){return function(_0xb0a273){if(_0xb0a273){return _0xb0a273[_0x6b28('0x25')]()[_0x6b28('0x24')](function(){_0x473994[_0x6b28('0x1a')](0xcc)[_0x6b28('0x1b')]();});}};}function handleEntityNotFound(_0x41bb4f,_0x25086c){return function(_0x35781e){if(!_0x35781e){_0x41bb4f[_0x6b28('0x19')](0x194);}return _0x35781e;};}function handleError(_0x45937b,_0x3c09ef){_0x3c09ef=_0x3c09ef||0x1f4;return function(_0x178cf6){logger[_0x6b28('0x26')](_0x178cf6[_0x6b28('0x27')]);if(_0x178cf6[_0x6b28('0x28')]){delete _0x178cf6['name'];}_0x45937b['status'](_0x3c09ef)[_0x6b28('0x29')](_0x178cf6);};}exports[_0x6b28('0x2a')]=function(_0x35a669,_0x2f1be6){var _0x1667db={},_0x1ee85f={},_0x19314d={'count':0x0,'rows':[]};var _0x36124f=_[_0x6b28('0x2b')](db['SquareReport'][_0x6b28('0x2c')],function(_0x5ee155){return{'name':_0x5ee155[_0x6b28('0x2d')],'type':_0x5ee155[_0x6b28('0x2e')][_0x6b28('0x2f')]};});_0x1ee85f[_0x6b28('0x30')]=_[_0x6b28('0x2b')](_0x36124f,_0x6b28('0x28'));_0x1ee85f['query']=_[_0x6b28('0x31')](_0x35a669[_0x6b28('0x32')]);_0x1ee85f[_0x6b28('0x33')]=_['intersection'](_0x1ee85f[_0x6b28('0x30')],_0x1ee85f[_0x6b28('0x32')]);_0x1667db[_0x6b28('0x34')]=_['intersection'](_0x1ee85f[_0x6b28('0x30')],qs['fields'](_0x35a669['query'][_0x6b28('0x35')]));_0x1667db[_0x6b28('0x34')]=_0x1667db[_0x6b28('0x34')]['length']?_0x1667db[_0x6b28('0x34')]:_0x1ee85f['model'];if(!_0x35a669[_0x6b28('0x32')][_0x6b28('0x36')](_0x6b28('0x37'))){_0x1667db[_0x6b28('0x1e')]=qs[_0x6b28('0x1e')](_0x35a669['query'][_0x6b28('0x1e')]);_0x1667db['offset']=qs[_0x6b28('0x1d')](_0x35a669['query'][_0x6b28('0x1d')]);}_0x1667db[_0x6b28('0x38')]=qs['sort'](_0x35a669[_0x6b28('0x32')]['sort']);_0x1667db['where']=qs[_0x6b28('0x33')](_['pick'](_0x35a669['query'],_0x1ee85f[_0x6b28('0x33')]),_0x36124f);if(_0x35a669[_0x6b28('0x32')][_0x6b28('0x39')]){_0x1667db[_0x6b28('0x3a')]=_['merge'](_0x1667db['where'],{'$or':_[_0x6b28('0x2b')](_0x36124f,function(_0x349543){if(_0x349543['type']!==_0x6b28('0x3b')){var _0x45720a={};_0x45720a[_0x349543[_0x6b28('0x28')]]={'$like':'%'+_0x35a669['query'][_0x6b28('0x39')]+'%'};return _0x45720a;}})});}_0x1667db=_[_0x6b28('0x3c')]({},_0x1667db,_0x35a669[_0x6b28('0x3d')]);var _0x25180b={'where':_0x1667db[_0x6b28('0x3a')]};return db['SquareReport']['count'](_0x25180b)[_0x6b28('0x24')](function(_0x435177){_0x19314d['count']=_0x435177;if(_0x35a669[_0x6b28('0x32')][_0x6b28('0x3e')]){_0x1667db[_0x6b28('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0x6b28('0x40')](_0x1667db);})[_0x6b28('0x24')](function(_0x33160a){_0x19314d[_0x6b28('0x41')]=_0x33160a;return _0x19314d;})[_0x6b28('0x24')](respondWithFilteredResult(_0x2f1be6,_0x1667db))[_0x6b28('0x42')](handleError(_0x2f1be6,null));};exports['show']=function(_0x17d232,_0x187248){var _0x8307e0={'raw':!![],'where':{'id':_0x17d232[_0x6b28('0x43')]['id']}},_0x3724db={};_0x3724db[_0x6b28('0x30')]=_[_0x6b28('0x31')](db[_0x6b28('0x44')][_0x6b28('0x2c')]);_0x3724db[_0x6b28('0x32')]=_[_0x6b28('0x31')](_0x17d232[_0x6b28('0x32')]);_0x3724db[_0x6b28('0x33')]=_[_0x6b28('0x45')](_0x3724db[_0x6b28('0x30')],_0x3724db[_0x6b28('0x32')]);_0x8307e0[_0x6b28('0x34')]=_[_0x6b28('0x45')](_0x3724db[_0x6b28('0x30')],qs['fields'](_0x17d232[_0x6b28('0x32')][_0x6b28('0x35')]));_0x8307e0[_0x6b28('0x34')]=_0x8307e0[_0x6b28('0x34')][_0x6b28('0x46')]?_0x8307e0[_0x6b28('0x34')]:_0x3724db[_0x6b28('0x30')];if(_0x17d232['query']['includeAll']){_0x8307e0[_0x6b28('0x3f')]=[{'all':!![]}];}_0x8307e0=_[_0x6b28('0x3c')]({},_0x8307e0,_0x17d232[_0x6b28('0x3d')]);return db[_0x6b28('0x44')][_0x6b28('0x47')](_0x8307e0)[_0x6b28('0x24')](handleEntityNotFound(_0x187248,null))[_0x6b28('0x24')](respondWithResult(_0x187248,null))[_0x6b28('0x42')](handleError(_0x187248,null));};exports[_0x6b28('0x48')]=function(_0x4f6064,_0x88d467){return db['SquareReport'][_0x6b28('0x48')](_0x4f6064['body'],{})[_0x6b28('0x24')](respondWithResult(_0x88d467,0xc9))[_0x6b28('0x42')](handleError(_0x88d467,null));};exports[_0x6b28('0x23')]=function(_0x2a3d5c,_0x5ea530){if(_0x2a3d5c['body']['id']){delete _0x2a3d5c[_0x6b28('0x49')]['id'];}return db[_0x6b28('0x44')][_0x6b28('0x47')]({'where':{'id':_0x2a3d5c['params']['id']}})[_0x6b28('0x24')](handleEntityNotFound(_0x5ea530,null))[_0x6b28('0x24')](saveUpdates(_0x2a3d5c['body'],null))[_0x6b28('0x24')](respondWithResult(_0x5ea530,null))[_0x6b28('0x42')](handleError(_0x5ea530,null));};exports[_0x6b28('0x25')]=function(_0x17db9c,_0x97d3cd){return db[_0x6b28('0x44')][_0x6b28('0x47')]({'where':{'id':_0x17db9c[_0x6b28('0x43')]['id']}})['then'](handleEntityNotFound(_0x97d3cd,null))[_0x6b28('0x24')](removeEntity(_0x97d3cd,null))[_0x6b28('0x42')](handleError(_0x97d3cd,null));};exports[_0x6b28('0x4a')]=function(_0x2a7bf3,_0x179193){return db['SquareReport']['describe']()[_0x6b28('0x24')](respondWithResult(_0x179193,null))['catch'](handleError(_0x179193,null));}; \ No newline at end of file +var _0x3f03=['findAll','rows','params','attributes','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','SquareReport','includeAll','include'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3f03,0xe5));var _0x33f0=function(_0x431a2e,_0x127483){_0x431a2e=_0x431a2e-0x0;var _0x9e443f=_0x3f03[_0x431a2e];return _0x9e443f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x33f0('0x0'));var rimraf=require(_0x33f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33f0('0x2'));var rp=require(_0x33f0('0x3'));var moment=require('moment');var BPromise=require(_0x33f0('0x4'));var Mustache=require(_0x33f0('0x5'));var util=require('util');var path=require(_0x33f0('0x6'));var sox=require(_0x33f0('0x7'));var csv=require(_0x33f0('0x8'));var ejs=require(_0x33f0('0x9'));var fs=require('fs');var fs_extra=require(_0x33f0('0xa'));var _=require(_0x33f0('0xb'));var squel=require('squel');var crypto=require(_0x33f0('0xc'));var jsforce=require(_0x33f0('0xd'));var deskjs=require(_0x33f0('0xe'));var toCsv=require(_0x33f0('0x8'));var querystring=require(_0x33f0('0xf'));var Papa=require(_0x33f0('0x10'));var Redis=require(_0x33f0('0x11'));var authService=require(_0x33f0('0x12'));var qs=require(_0x33f0('0x13'));var as=require(_0x33f0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33f0('0x15'))(_0x33f0('0x16'));var utils=require('../../config/utils');var config=require(_0x33f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x33f0('0x18'))['db'];function respondWithStatusCode(_0x119256,_0x26f8be){_0x26f8be=_0x26f8be||0xcc;return function(_0xb0232f){if(_0xb0232f){return _0x119256[_0x33f0('0x19')](_0x26f8be);}return _0x119256[_0x33f0('0x1a')](_0x26f8be)['end']();};}function respondWithResult(_0x155259,_0x5ecf79){_0x5ecf79=_0x5ecf79||0xc8;return function(_0x1e1afe){if(_0x1e1afe){return _0x155259['status'](_0x5ecf79)[_0x33f0('0x1b')](_0x1e1afe);}};}function respondWithFilteredResult(_0x3b88cf,_0x27377a){return function(_0x5a1c92){if(_0x5a1c92){var _0xaf7d92=_0x5a1c92[_0x33f0('0x1c')],_0x480cce=_0x27377a[_0x33f0('0x1d')],_0xafcff3=_0x27377a[_0x33f0('0x1d')]+_0x27377a[_0x33f0('0x1e')],_0x8415e0;if(_0xafcff3>=_0xaf7d92){_0xafcff3=_0xaf7d92;_0x8415e0=0xc8;}else{_0x8415e0=0xce;}_0x3b88cf[_0x33f0('0x1a')](_0x8415e0);return _0x3b88cf[_0x33f0('0x1f')](_0x33f0('0x20'),_0x480cce+'-'+_0xafcff3+'/'+_0xaf7d92)[_0x33f0('0x1b')](_0x5a1c92);}return null;};}function patchUpdates(_0x164f20){return function(_0x10bc23){try{jsonpatch[_0x33f0('0x21')](_0x10bc23,_0x164f20,!![]);}catch(_0x52fd77){return BPromise[_0x33f0('0x22')](_0x52fd77);}return _0x10bc23[_0x33f0('0x23')]();};}function saveUpdates(_0x189723,_0x5d42c4){return function(_0xcf07d4){if(_0xcf07d4){return _0xcf07d4['update'](_0x189723)[_0x33f0('0x24')](function(_0x12a6a9){return _0x12a6a9;});}return null;};}function removeEntity(_0x573d4d,_0x489777){return function(_0x88a799){if(_0x88a799){return _0x88a799[_0x33f0('0x25')]()[_0x33f0('0x24')](function(){_0x573d4d[_0x33f0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x581dee,_0x3c4fda){return function(_0x3f96f0){if(!_0x3f96f0){_0x581dee['sendStatus'](0x194);}return _0x3f96f0;};}function handleError(_0x20e538,_0x295d39){_0x295d39=_0x295d39||0x1f4;return function(_0x2fa86e){logger[_0x33f0('0x26')](_0x2fa86e[_0x33f0('0x27')]);if(_0x2fa86e[_0x33f0('0x28')]){delete _0x2fa86e[_0x33f0('0x28')];}_0x20e538[_0x33f0('0x1a')](_0x295d39)['send'](_0x2fa86e);};}exports['index']=function(_0x288efa,_0x3fcb4d){var _0x2ad33e={},_0x2bc333={},_0x286f0f={'count':0x0,'rows':[]};var _0x1ac3fc=_[_0x33f0('0x29')](db['SquareReport'][_0x33f0('0x2a')],function(_0x40bd9f){return{'name':_0x40bd9f['fieldName'],'type':_0x40bd9f[_0x33f0('0x2b')][_0x33f0('0x2c')]};});_0x2bc333[_0x33f0('0x2d')]=_['map'](_0x1ac3fc,'name');_0x2bc333[_0x33f0('0x2e')]=_[_0x33f0('0x2f')](_0x288efa[_0x33f0('0x2e')]);_0x2bc333[_0x33f0('0x30')]=_[_0x33f0('0x31')](_0x2bc333[_0x33f0('0x2d')],_0x2bc333[_0x33f0('0x2e')]);_0x2ad33e['attributes']=_[_0x33f0('0x31')](_0x2bc333[_0x33f0('0x2d')],qs[_0x33f0('0x32')](_0x288efa['query'][_0x33f0('0x32')]));_0x2ad33e['attributes']=_0x2ad33e['attributes'][_0x33f0('0x33')]?_0x2ad33e['attributes']:_0x2bc333[_0x33f0('0x2d')];if(!_0x288efa['query'][_0x33f0('0x34')]('nolimit')){_0x2ad33e[_0x33f0('0x1e')]=qs[_0x33f0('0x1e')](_0x288efa[_0x33f0('0x2e')][_0x33f0('0x1e')]);_0x2ad33e[_0x33f0('0x1d')]=qs[_0x33f0('0x1d')](_0x288efa[_0x33f0('0x2e')][_0x33f0('0x1d')]);}_0x2ad33e[_0x33f0('0x35')]=qs['sort'](_0x288efa[_0x33f0('0x2e')][_0x33f0('0x36')]);_0x2ad33e['where']=qs['filters'](_['pick'](_0x288efa[_0x33f0('0x2e')],_0x2bc333['filters']),_0x1ac3fc);if(_0x288efa[_0x33f0('0x2e')][_0x33f0('0x37')]){_0x2ad33e[_0x33f0('0x38')]=_[_0x33f0('0x39')](_0x2ad33e[_0x33f0('0x38')],{'$or':_[_0x33f0('0x29')](_0x1ac3fc,function(_0x32e1a8){if(_0x32e1a8['type']!==_0x33f0('0x3a')){var _0x5d4ac5={};_0x5d4ac5[_0x32e1a8[_0x33f0('0x28')]]={'$like':'%'+_0x288efa['query']['filter']+'%'};return _0x5d4ac5;}})});}_0x2ad33e=_[_0x33f0('0x39')]({},_0x2ad33e,_0x288efa[_0x33f0('0x3b')]);var _0x254e0f={'where':_0x2ad33e['where']};return db[_0x33f0('0x3c')][_0x33f0('0x1c')](_0x254e0f)[_0x33f0('0x24')](function(_0x110727){_0x286f0f[_0x33f0('0x1c')]=_0x110727;if(_0x288efa[_0x33f0('0x2e')][_0x33f0('0x3d')]){_0x2ad33e[_0x33f0('0x3e')]=[{'all':!![]}];}return db[_0x33f0('0x3c')][_0x33f0('0x3f')](_0x2ad33e);})['then'](function(_0x5b445e){_0x286f0f[_0x33f0('0x40')]=_0x5b445e;return _0x286f0f;})['then'](respondWithFilteredResult(_0x3fcb4d,_0x2ad33e))['catch'](handleError(_0x3fcb4d,null));};exports['show']=function(_0x23428e,_0x110917){var _0x1bf89c={'raw':!![],'where':{'id':_0x23428e[_0x33f0('0x41')]['id']}},_0x686405={};_0x686405[_0x33f0('0x2d')]=_[_0x33f0('0x2f')](db[_0x33f0('0x3c')]['rawAttributes']);_0x686405['query']=_[_0x33f0('0x2f')](_0x23428e[_0x33f0('0x2e')]);_0x686405[_0x33f0('0x30')]=_[_0x33f0('0x31')](_0x686405['model'],_0x686405[_0x33f0('0x2e')]);_0x1bf89c['attributes']=_[_0x33f0('0x31')](_0x686405[_0x33f0('0x2d')],qs[_0x33f0('0x32')](_0x23428e[_0x33f0('0x2e')]['fields']));_0x1bf89c[_0x33f0('0x42')]=_0x1bf89c[_0x33f0('0x42')][_0x33f0('0x33')]?_0x1bf89c[_0x33f0('0x42')]:_0x686405[_0x33f0('0x2d')];if(_0x23428e[_0x33f0('0x2e')][_0x33f0('0x3d')]){_0x1bf89c[_0x33f0('0x3e')]=[{'all':!![]}];}_0x1bf89c=_[_0x33f0('0x39')]({},_0x1bf89c,_0x23428e[_0x33f0('0x3b')]);return db[_0x33f0('0x3c')][_0x33f0('0x43')](_0x1bf89c)['then'](handleEntityNotFound(_0x110917,null))[_0x33f0('0x24')](respondWithResult(_0x110917,null))[_0x33f0('0x44')](handleError(_0x110917,null));};exports[_0x33f0('0x45')]=function(_0x81302,_0x2998f8){return db[_0x33f0('0x3c')][_0x33f0('0x45')](_0x81302[_0x33f0('0x46')],{})[_0x33f0('0x24')](respondWithResult(_0x2998f8,0xc9))[_0x33f0('0x44')](handleError(_0x2998f8,null));};exports[_0x33f0('0x47')]=function(_0x4ff706,_0xc8fbce){if(_0x4ff706['body']['id']){delete _0x4ff706[_0x33f0('0x46')]['id'];}return db[_0x33f0('0x3c')]['find']({'where':{'id':_0x4ff706[_0x33f0('0x41')]['id']}})[_0x33f0('0x24')](handleEntityNotFound(_0xc8fbce,null))['then'](saveUpdates(_0x4ff706['body'],null))[_0x33f0('0x24')](respondWithResult(_0xc8fbce,null))[_0x33f0('0x44')](handleError(_0xc8fbce,null));};exports['destroy']=function(_0x4750c6,_0x2cb2bf){return db[_0x33f0('0x3c')][_0x33f0('0x43')]({'where':{'id':_0x4750c6['params']['id']}})[_0x33f0('0x24')](handleEntityNotFound(_0x2cb2bf,null))[_0x33f0('0x24')](removeEntity(_0x2cb2bf,null))[_0x33f0('0x44')](handleError(_0x2cb2bf,null));};exports[_0x33f0('0x48')]=function(_0x282005,_0x45d6fc){return db[_0x33f0('0x3c')]['describe']()[_0x33f0('0x24')](respondWithResult(_0x45d6fc,null))[_0x33f0('0x44')](handleError(_0x45d6fc,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1db218b..1d53d41 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 _0xf4af=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger'];(function(_0x48583f,_0x25262a){var _0x28080e=function(_0x94c082){while(--_0x94c082){_0x48583f['push'](_0x48583f['shift']());}};_0x28080e(++_0x25262a);}(_0xf4af,0x1ea));var _0xff4a=function(_0x427bc1,_0x46698c){_0x427bc1=_0x427bc1-0x0;var _0x293edc=_0xf4af[_0x427bc1];return _0x293edc;};'use strict';var _=require(_0xff4a('0x0'));var util=require(_0xff4a('0x1'));var logger=require(_0xff4a('0x2'))(_0xff4a('0x3'));var moment=require(_0xff4a('0x4'));var BPromise=require(_0xff4a('0x5'));var rp=require(_0xff4a('0x6'));var fs=require('fs');var path=require(_0xff4a('0x7'));var rimraf=require(_0xff4a('0x8'));var config=require(_0xff4a('0x9'));var attributes=require(_0xff4a('0xa'));module[_0xff4a('0xb')]=function(_0x50a77c,_0x1d0526){return _0x50a77c[_0xff4a('0xc')]('SquareReport',attributes,{'tableName':_0xff4a('0xd'),'paranoid':![],'indexes':[{'name':_0xff4a('0xe'),'fields':[_0xff4a('0xf'),'project_name']},{'name':_0xff4a('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1c2=['define','SquareReport','uniqueid','leaveAt','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x97f332,_0x46a577){var _0x319d07=function(_0x4bb517){while(--_0x4bb517){_0x97f332['push'](_0x97f332['shift']());}};_0x319d07(++_0x46a577);}(_0xb1c2,0xeb));var _0x2b1c=function(_0x4f5fbc,_0x74cb4e){_0x4f5fbc=_0x4f5fbc-0x0;var _0x486e0e=_0xb1c2[_0x4f5fbc];return _0x486e0e;};'use strict';var _=require('lodash');var util=require(_0x2b1c('0x0'));var logger=require(_0x2b1c('0x1'))('api');var moment=require(_0x2b1c('0x2'));var BPromise=require(_0x2b1c('0x3'));var rp=require(_0x2b1c('0x4'));var fs=require('fs');var path=require(_0x2b1c('0x5'));var rimraf=require(_0x2b1c('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module['exports']=function(_0x36e97f,_0x28ecfb){return _0x36e97f[_0x2b1c('0x7')](_0x2b1c('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x2b1c('0x9'),'project_name']},{'name':_0x2b1c('0xa'),'fields':[_0x2b1c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 28ec7bb..5fed5aa 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 _0x9c5a=['stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4235b3,_0x4295b9){var _0x5a6cc9=function(_0x3cd80d){while(--_0x3cd80d){_0x4235b3['push'](_0x4235b3['shift']());}};_0x5a6cc9(++_0x4295b9);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x14837b,_0x588340){_0x14837b=_0x14837b-0x0;var _0x4a43b8=_0x9c5a[_0x14837b];return _0x4a43b8;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('SquareReport,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});}exports[_0xa9c5('0x14')]=function(_0x1142d9){var _0x2b9ac5=this;return new Promise(function(_0x3b8cf7,_0x452a9b){return db[_0xa9c5('0x15')][_0xa9c5('0x16')](_0x1142d9[_0xa9c5('0x17')],{'raw':_0x1142d9[_0xa9c5('0x18')]?_0x1142d9[_0xa9c5('0x18')][_0xa9c5('0x19')]===undefined?!![]:![]:!![]})[_0xa9c5('0xa')](function(_0x54f8b9){logger[_0xa9c5('0x11')](_0xa9c5('0x14'),_0x1142d9);logger['debug']('CreateSquareReport',_0x1142d9,JSON[_0xa9c5('0xd')](_0x54f8b9));_0x3b8cf7(_0x54f8b9);})[_0xa9c5('0x13')](function(_0x10b208){logger[_0xa9c5('0xe')](_0xa9c5('0x14'),_0x10b208[_0xa9c5('0x10')],_0x1142d9);_0x452a9b(_0x2b9ac5['error'](0x1f4,_0x10b208['message']));});});};exports[_0xa9c5('0x1a')]=function(_0x11d395){var _0x4b0f05=this;return new Promise(function(_0x6819b3,_0x424b4c){return db[_0xa9c5('0x15')][_0xa9c5('0x1b')](_0x11d395[_0xa9c5('0x17')],{'raw':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d395['options']?_0x11d395[_0xa9c5('0x18')]['where']||null:null,'attributes':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['attributes']||null:null,'limit':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['limit']||null:null})[_0xa9c5('0xa')](function(_0x32baf9){logger[_0xa9c5('0x11')](_0xa9c5('0x1a'),_0x11d395);logger[_0xa9c5('0x1c')]('UpdateSquareReport',_0x11d395,JSON[_0xa9c5('0xd')](_0x32baf9));_0x6819b3(_0x32baf9);})['catch'](function(_0x3c3da7){logger[_0xa9c5('0xe')](_0xa9c5('0x1a'),_0x3c3da7['message'],_0x11d395);_0x424b4c(_0x4b0f05[_0xa9c5('0xe')](0x1f4,_0x3c3da7[_0xa9c5('0x10')]));});});}; \ No newline at end of file +var _0xdc97=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x5545f7,_0x570414){var _0x52a979=function(_0x28eb97){while(--_0x28eb97){_0x5545f7['push'](_0x5545f7['shift']());}};_0x52a979(++_0x570414);}(_0xdc97,0x13b));var _0x7dc9=function(_0x54e27d,_0x2a330a){_0x54e27d=_0x54e27d-0x0;var _0x45c222=_0xdc97[_0x54e27d];return _0x45c222;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){return client[_0x7dc9('0xa')](_0x2636ef,_0x4b3229)[_0x7dc9('0xb')](function(_0x3dd07e){logger['info'](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x4f91c7,_0x7dc9('0xd'),JSON[_0x7dc9('0x10')](_0x3dd07e));if(_0x3dd07e[_0x7dc9('0x11')]){if(_0x3dd07e['error']['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x23737d(_0x3dd07e['error'][_0x7dc9('0x12')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x2ff923(_0x3dd07e[_0x7dc9('0x11')]['message']);}else{logger[_0x7dc9('0x13')](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));_0x2ff923(_0x3dd07e[_0x7dc9('0x14')][_0x7dc9('0x12')]);}})[_0x7dc9('0x15')](function(_0x45698c){logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x45698c);_0x23737d(_0x45698c);});});}exports['CreateSquareReport']=function(_0x22577e){var _0x4afb47=this;return new Promise(function(_0x1f5906,_0x1cc237){return db['SquareReport'][_0x7dc9('0x16')](_0x22577e[_0x7dc9('0x17')],{'raw':_0x22577e[_0x7dc9('0x18')]?_0x22577e[_0x7dc9('0x18')][_0x7dc9('0x19')]===undefined?!![]:![]:!![]})[_0x7dc9('0xb')](function(_0x2dad65){logger[_0x7dc9('0x13')](_0x7dc9('0x1a'),_0x22577e);logger[_0x7dc9('0xe')]('CreateSquareReport',_0x22577e,JSON['stringify'](_0x2dad65));_0x1f5906(_0x2dad65);})[_0x7dc9('0x15')](function(_0x5981e2){logger['error'](_0x7dc9('0x1a'),_0x5981e2[_0x7dc9('0x12')],_0x22577e);_0x1cc237(_0x4afb47['error'](0x1f4,_0x5981e2[_0x7dc9('0x12')]));});});};exports[_0x7dc9('0x1b')]=function(_0x41110a){var _0x4906b1=this;return new Promise(function(_0x424763,_0x1e3a8d){return db[_0x7dc9('0x1c')]['update'](_0x41110a['body'],{'raw':_0x41110a['options']?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41110a['options']?_0x41110a['options'][_0x7dc9('0x1d')]||null:null,'attributes':_0x41110a['options']?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x1e')]||null:null,'limit':_0x41110a[_0x7dc9('0x18')]?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x1f')]||null:null})[_0x7dc9('0xb')](function(_0x236d42){logger[_0x7dc9('0x13')](_0x7dc9('0x1b'),_0x41110a);logger[_0x7dc9('0xe')](_0x7dc9('0x1b'),_0x41110a,JSON[_0x7dc9('0x10')](_0x236d42));_0x424763(_0x236d42);})['catch'](function(_0x4e929c){logger['error']('UpdateSquareReport',_0x4e929c['message'],_0x41110a);_0x1e3a8d(_0x4906b1['error'](0x1f4,_0x4e929c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7c44233..6f5113a 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 _0x3a9f=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','destroy','multer','util','connect-timeout'];(function(_0x54d102,_0x4ec82a){var _0x428c90=function(_0x34533e){while(--_0x34533e){_0x54d102['push'](_0x54d102['shift']());}};_0x428c90(++_0x4ec82a);}(_0x3a9f,0x140));var _0xf3a9=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0x3a9f[_0x22663b];return _0x310d0a;};'use strict';var multer=require(_0xf3a9('0x0'));var util=require(_0xf3a9('0x1'));var path=require('path');var timeout=require(_0xf3a9('0x2'));var express=require(_0xf3a9('0x3'));var router=express[_0xf3a9('0x4')]();var fs_extra=require(_0xf3a9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf3a9('0x6'));var controller=require('./squareReportDetail.controller');router[_0xf3a9('0x7')]('/',auth[_0xf3a9('0x8')](),controller[_0xf3a9('0x9')]);router[_0xf3a9('0x7')]('/describe',auth[_0xf3a9('0x8')](),controller[_0xf3a9('0xa')]);router[_0xf3a9('0x7')](_0xf3a9('0xb'),auth[_0xf3a9('0x8')](),controller[_0xf3a9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf3a9('0xd')]);router[_0xf3a9('0xe')](_0xf3a9('0xb'),auth[_0xf3a9('0x8')](),controller[_0xf3a9('0xf')]);router['delete'](_0xf3a9('0xb'),auth['isAuthenticated'](),controller[_0xf3a9('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8071=['fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','express'];(function(_0x164bfa,_0x39536e){var _0x550977=function(_0x4ea1ee){while(--_0x4ea1ee){_0x164bfa['push'](_0x164bfa['shift']());}};_0x550977(++_0x39536e);}(_0x8071,0x12f));var _0x1807=function(_0x50dc62,_0x2acea9){_0x50dc62=_0x50dc62-0x0;var _0x321771=_0x8071[_0x50dc62];return _0x321771;};'use strict';var multer=require(_0x1807('0x0'));var util=require(_0x1807('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1807('0x2'));var router=express['Router']();var fs_extra=require(_0x1807('0x3'));var auth=require(_0x1807('0x4'));var interaction=require(_0x1807('0x5'));var config=require('../../config/environment');var controller=require(_0x1807('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1807('0x7')](_0x1807('0x8'),auth[_0x1807('0x9')](),controller['describe']);router[_0x1807('0x7')](_0x1807('0xa'),auth[_0x1807('0x9')](),controller[_0x1807('0xb')]);router[_0x1807('0xc')]('/',auth[_0x1807('0x9')](),controller[_0x1807('0xd')]);router[_0x1807('0xe')](_0x1807('0xa'),auth['isAuthenticated'](),controller[_0x1807('0xf')]);router['delete'](_0x1807('0xa'),auth[_0x1807('0x9')](),controller[_0x1807('0x10')]);module[_0x1807('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 12c222e..441d185 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 _0x5841=['exports','STRING','TEXT','sequelize'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0x5841,0xcb));var _0x1584=function(_0x16d109,_0x28ef14){_0x16d109=_0x16d109-0x0;var _0x2f15ba=_0x5841[_0x16d109];return _0x2f15ba;};'use strict';var Sequelize=require(_0x1584('0x0'));module[_0x1584('0x1')]={'uniqueid':{'type':Sequelize[_0x1584('0x2')]},'node':{'type':Sequelize[_0x1584('0x2')]},'application':{'type':Sequelize[_0x1584('0x2')]},'data':{'type':Sequelize[_0x1584('0x3')]},'project_name':{'type':Sequelize[_0x1584('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf336=['sequelize','exports','STRING','TEXT'];(function(_0x2087a9,_0x4181f9){var _0x18b82c=function(_0x51334e){while(--_0x51334e){_0x2087a9['push'](_0x2087a9['shift']());}};_0x18b82c(++_0x4181f9);}(_0xf336,0x114));var _0x6f33=function(_0x4da97f,_0x43442c){_0x4da97f=_0x4da97f-0x0;var _0x1d4902=_0xf336[_0x4da97f];return _0x1d4902;};'use strict';var Sequelize=require(_0x6f33('0x0'));module[_0x6f33('0x1')]={'uniqueid':{'type':Sequelize[_0x6f33('0x2')]},'node':{'type':Sequelize[_0x6f33('0x2')]},'application':{'type':Sequelize[_0x6f33('0x2')]},'data':{'type':Sequelize[_0x6f33('0x3')]},'project_name':{'type':Sequelize[_0x6f33('0x2')]},'callerid':{'type':Sequelize[_0x6f33('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 638434d..954e0c2 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 _0x2c02=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','catch','show','params','includeAll','options','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','keys','query'];(function(_0x39e2d7,_0x1b15f6){var _0x413d0d=function(_0x3af71d){while(--_0x3af71d){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x413d0d(++_0x1b15f6);}(_0x2c02,0xfa));var _0x22c0=function(_0x53018b,_0x456e23){_0x53018b=_0x53018b-0x0;var _0x4a9271=_0x2c02[_0x53018b];return _0x4a9271;};'use strict';var pdf=require(_0x22c0('0x0'));var emlformat=require(_0x22c0('0x1'));var rimraf=require(_0x22c0('0x2'));var zipdir=require(_0x22c0('0x3'));var jsonpatch=require(_0x22c0('0x4'));var rp=require(_0x22c0('0x5'));var moment=require('moment');var BPromise=require(_0x22c0('0x6'));var Mustache=require(_0x22c0('0x7'));var util=require(_0x22c0('0x8'));var path=require('path');var sox=require(_0x22c0('0x9'));var csv=require('to-csv');var ejs=require(_0x22c0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22c0('0xb'));var squel=require(_0x22c0('0xc'));var crypto=require(_0x22c0('0xd'));var jsforce=require(_0x22c0('0xe'));var deskjs=require(_0x22c0('0xf'));var toCsv=require(_0x22c0('0x10'));var querystring=require(_0x22c0('0x11'));var Papa=require('papaparse');var Redis=require(_0x22c0('0x12'));var authService=require(_0x22c0('0x13'));var qs=require(_0x22c0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x22c0('0x15'));var utils=require('../../config/utils');var config=require(_0x22c0('0x16'));var licenseUtil=require(_0x22c0('0x17'));var db=require(_0x22c0('0x18'))['db'];function respondWithStatusCode(_0x17fe0f,_0x44e261){_0x44e261=_0x44e261||0xcc;return function(_0xfa1487){if(_0xfa1487){return _0x17fe0f[_0x22c0('0x19')](_0x44e261);}return _0x17fe0f[_0x22c0('0x1a')](_0x44e261)[_0x22c0('0x1b')]();};}function respondWithResult(_0x49d282,_0x807d35){_0x807d35=_0x807d35||0xc8;return function(_0x5f0352){if(_0x5f0352){return _0x49d282[_0x22c0('0x1a')](_0x807d35)['json'](_0x5f0352);}};}function respondWithFilteredResult(_0x1db556,_0xa4f787){return function(_0x49f203){if(_0x49f203){var _0xc3df68=_0x49f203[_0x22c0('0x1c')],_0x1ea6c6=_0xa4f787[_0x22c0('0x1d')],_0x373e83=_0xa4f787['offset']+_0xa4f787[_0x22c0('0x1e')],_0x5532dc;if(_0x373e83>=_0xc3df68){_0x373e83=_0xc3df68;_0x5532dc=0xc8;}else{_0x5532dc=0xce;}_0x1db556['status'](_0x5532dc);return _0x1db556['set'](_0x22c0('0x1f'),_0x1ea6c6+'-'+_0x373e83+'/'+_0xc3df68)[_0x22c0('0x20')](_0x49f203);}return null;};}function patchUpdates(_0x52360e){return function(_0x1f7c57){try{jsonpatch[_0x22c0('0x21')](_0x1f7c57,_0x52360e,!![]);}catch(_0x4ef545){return BPromise[_0x22c0('0x22')](_0x4ef545);}return _0x1f7c57[_0x22c0('0x23')]();};}function saveUpdates(_0x5bd2db,_0x126f54){return function(_0x327412){if(_0x327412){return _0x327412['update'](_0x5bd2db)[_0x22c0('0x24')](function(_0x3bd4cc){return _0x3bd4cc;});}return null;};}function removeEntity(_0x5b1773,_0x3f6f41){return function(_0x55c2a4){if(_0x55c2a4){return _0x55c2a4[_0x22c0('0x25')]()[_0x22c0('0x24')](function(){_0x5b1773['status'](0xcc)[_0x22c0('0x1b')]();});}};}function handleEntityNotFound(_0x84ac51,_0x47a75){return function(_0x2656cc){if(!_0x2656cc){_0x84ac51[_0x22c0('0x19')](0x194);}return _0x2656cc;};}function handleError(_0x1cc74b,_0x333192){_0x333192=_0x333192||0x1f4;return function(_0x4fa175){logger[_0x22c0('0x26')](_0x4fa175['stack']);if(_0x4fa175[_0x22c0('0x27')]){delete _0x4fa175[_0x22c0('0x27')];}_0x1cc74b[_0x22c0('0x1a')](_0x333192)[_0x22c0('0x28')](_0x4fa175);};}exports[_0x22c0('0x29')]=function(_0xe807c,_0x58bcb3){var _0x163dbc={},_0x3eedfd={},_0x38ab9e={'count':0x0,'rows':[]};var _0x4ea1fe=_[_0x22c0('0x2a')](db[_0x22c0('0x2b')][_0x22c0('0x2c')],function(_0x2d7404){return{'name':_0x2d7404['fieldName'],'type':_0x2d7404[_0x22c0('0x2d')][_0x22c0('0x2e')]};});_0x3eedfd[_0x22c0('0x2f')]=_['map'](_0x4ea1fe,_0x22c0('0x27'));_0x3eedfd['query']=_[_0x22c0('0x30')](_0xe807c[_0x22c0('0x31')]);_0x3eedfd[_0x22c0('0x32')]=_[_0x22c0('0x33')](_0x3eedfd[_0x22c0('0x2f')],_0x3eedfd['query']);_0x163dbc['attributes']=_[_0x22c0('0x33')](_0x3eedfd[_0x22c0('0x2f')],qs[_0x22c0('0x34')](_0xe807c[_0x22c0('0x31')][_0x22c0('0x34')]));_0x163dbc[_0x22c0('0x35')]=_0x163dbc['attributes'][_0x22c0('0x36')]?_0x163dbc[_0x22c0('0x35')]:_0x3eedfd[_0x22c0('0x2f')];if(!_0xe807c[_0x22c0('0x31')][_0x22c0('0x37')](_0x22c0('0x38'))){_0x163dbc[_0x22c0('0x1e')]=qs[_0x22c0('0x1e')](_0xe807c['query']['limit']);_0x163dbc[_0x22c0('0x1d')]=qs['offset'](_0xe807c[_0x22c0('0x31')][_0x22c0('0x1d')]);}_0x163dbc['order']=qs[_0x22c0('0x39')](_0xe807c[_0x22c0('0x31')][_0x22c0('0x39')]);_0x163dbc[_0x22c0('0x3a')]=qs[_0x22c0('0x32')](_[_0x22c0('0x3b')](_0xe807c[_0x22c0('0x31')],_0x3eedfd[_0x22c0('0x32')]),_0x4ea1fe);if(_0xe807c['query']['filter']){_0x163dbc[_0x22c0('0x3a')]=_[_0x22c0('0x3c')](_0x163dbc[_0x22c0('0x3a')],{'$or':_[_0x22c0('0x2a')](_0x4ea1fe,function(_0x52966c){if(_0x52966c['type']!==_0x22c0('0x3d')){var _0x50d0d9={};_0x50d0d9[_0x52966c['name']]={'$like':'%'+_0xe807c['query'][_0x22c0('0x3e')]+'%'};return _0x50d0d9;}})});}_0x163dbc=_[_0x22c0('0x3c')]({},_0x163dbc,_0xe807c['options']);var _0x280cde={'where':_0x163dbc[_0x22c0('0x3a')]};return db[_0x22c0('0x2b')]['count'](_0x280cde)[_0x22c0('0x24')](function(_0xaf7df2){_0x38ab9e['count']=_0xaf7df2;if(_0xe807c['query']['includeAll']){_0x163dbc[_0x22c0('0x3f')]=[{'all':!![]}];}return db[_0x22c0('0x2b')][_0x22c0('0x40')](_0x163dbc);})[_0x22c0('0x24')](function(_0x22d516){_0x38ab9e['rows']=_0x22d516;return _0x38ab9e;})[_0x22c0('0x24')](respondWithFilteredResult(_0x58bcb3,_0x163dbc))[_0x22c0('0x41')](handleError(_0x58bcb3,null));};exports[_0x22c0('0x42')]=function(_0x45b7c4,_0x58570a){var _0x56a898={'raw':!![],'where':{'id':_0x45b7c4[_0x22c0('0x43')]['id']}},_0x4d079a={};_0x4d079a[_0x22c0('0x2f')]=_[_0x22c0('0x30')](db[_0x22c0('0x2b')][_0x22c0('0x2c')]);_0x4d079a[_0x22c0('0x31')]=_['keys'](_0x45b7c4[_0x22c0('0x31')]);_0x4d079a[_0x22c0('0x32')]=_[_0x22c0('0x33')](_0x4d079a[_0x22c0('0x2f')],_0x4d079a[_0x22c0('0x31')]);_0x56a898[_0x22c0('0x35')]=_[_0x22c0('0x33')](_0x4d079a['model'],qs[_0x22c0('0x34')](_0x45b7c4[_0x22c0('0x31')][_0x22c0('0x34')]));_0x56a898[_0x22c0('0x35')]=_0x56a898['attributes'][_0x22c0('0x36')]?_0x56a898[_0x22c0('0x35')]:_0x4d079a['model'];if(_0x45b7c4[_0x22c0('0x31')][_0x22c0('0x44')]){_0x56a898[_0x22c0('0x3f')]=[{'all':!![]}];}_0x56a898=_['merge']({},_0x56a898,_0x45b7c4[_0x22c0('0x45')]);return db[_0x22c0('0x2b')][_0x22c0('0x46')](_0x56a898)[_0x22c0('0x24')](handleEntityNotFound(_0x58570a,null))[_0x22c0('0x24')](respondWithResult(_0x58570a,null))[_0x22c0('0x41')](handleError(_0x58570a,null));};exports[_0x22c0('0x47')]=function(_0x49e9e3,_0x509a52){return db['SquareDetailsReport'][_0x22c0('0x47')](_0x49e9e3['body'],{})['then'](respondWithResult(_0x509a52,0xc9))['catch'](handleError(_0x509a52,null));};exports[_0x22c0('0x48')]=function(_0x1a0a2f,_0x307179){if(_0x1a0a2f[_0x22c0('0x49')]['id']){delete _0x1a0a2f['body']['id'];}return db[_0x22c0('0x2b')][_0x22c0('0x46')]({'where':{'id':_0x1a0a2f['params']['id']}})[_0x22c0('0x24')](handleEntityNotFound(_0x307179,null))['then'](saveUpdates(_0x1a0a2f[_0x22c0('0x49')],null))[_0x22c0('0x24')](respondWithResult(_0x307179,null))[_0x22c0('0x41')](handleError(_0x307179,null));};exports[_0x22c0('0x25')]=function(_0x558776,_0x4f8e99){return db[_0x22c0('0x2b')]['find']({'where':{'id':_0x558776[_0x22c0('0x43')]['id']}})[_0x22c0('0x24')](handleEntityNotFound(_0x4f8e99,null))[_0x22c0('0x24')](removeEntity(_0x4f8e99,null))[_0x22c0('0x41')](handleError(_0x4f8e99,null));};exports[_0x22c0('0x4a')]=function(_0x493386,_0x2bd168){return db[_0x22c0('0x2b')][_0x22c0('0x4a')]()[_0x22c0('0x24')](respondWithResult(_0x2bd168,null))[_0x22c0('0x41')](handleError(_0x2bd168,null));}; \ No newline at end of file +var _0x72de=['where','filter','VIRTUAL','merge','options','includeAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort'];(function(_0xc8944f,_0x41da59){var _0x2d29ca=function(_0x48d4fc){while(--_0x48d4fc){_0xc8944f['push'](_0xc8944f['shift']());}};_0x2d29ca(++_0x41da59);}(_0x72de,0x18a));var _0xe72d=function(_0x4ffe80,_0x37740d){_0x4ffe80=_0x4ffe80-0x0;var _0x1cea8e=_0x72de[_0x4ffe80];return _0x1cea8e;};'use strict';var pdf=require(_0xe72d('0x0'));var emlformat=require(_0xe72d('0x1'));var rimraf=require(_0xe72d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe72d('0x3'));var moment=require(_0xe72d('0x4'));var BPromise=require(_0xe72d('0x5'));var Mustache=require(_0xe72d('0x6'));var util=require(_0xe72d('0x7'));var path=require(_0xe72d('0x8'));var sox=require(_0xe72d('0x9'));var csv=require(_0xe72d('0xa'));var ejs=require(_0xe72d('0xb'));var fs=require('fs');var fs_extra=require(_0xe72d('0xc'));var _=require(_0xe72d('0xd'));var squel=require(_0xe72d('0xe'));var crypto=require(_0xe72d('0xf'));var jsforce=require(_0xe72d('0x10'));var deskjs=require(_0xe72d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe72d('0x12'));var Redis=require(_0xe72d('0x13'));var authService=require(_0xe72d('0x14'));var qs=require(_0xe72d('0x15'));var as=require(_0xe72d('0x16'));var hardwareService=require(_0xe72d('0x17'));var logger=require(_0xe72d('0x18'))(_0xe72d('0x19'));var utils=require(_0xe72d('0x1a'));var config=require(_0xe72d('0x1b'));var licenseUtil=require(_0xe72d('0x1c'));var db=require(_0xe72d('0x1d'))['db'];function respondWithStatusCode(_0x4b3166,_0x30f23f){_0x30f23f=_0x30f23f||0xcc;return function(_0x174c59){if(_0x174c59){return _0x4b3166['sendStatus'](_0x30f23f);}return _0x4b3166[_0xe72d('0x1e')](_0x30f23f)[_0xe72d('0x1f')]();};}function respondWithResult(_0x5ba74a,_0x27f34f){_0x27f34f=_0x27f34f||0xc8;return function(_0x96d242){if(_0x96d242){return _0x5ba74a[_0xe72d('0x1e')](_0x27f34f)[_0xe72d('0x20')](_0x96d242);}};}function respondWithFilteredResult(_0x15b04d,_0x401ece){return function(_0x9bc07b){if(_0x9bc07b){var _0x3db200=_0x9bc07b[_0xe72d('0x21')],_0x7f56d5=_0x401ece['offset'],_0x417b3e=_0x401ece['offset']+_0x401ece[_0xe72d('0x22')],_0x42916d;if(_0x417b3e>=_0x3db200){_0x417b3e=_0x3db200;_0x42916d=0xc8;}else{_0x42916d=0xce;}_0x15b04d[_0xe72d('0x1e')](_0x42916d);return _0x15b04d[_0xe72d('0x23')]('Content-Range',_0x7f56d5+'-'+_0x417b3e+'/'+_0x3db200)[_0xe72d('0x20')](_0x9bc07b);}return null;};}function patchUpdates(_0x589ec5){return function(_0x4ba137){try{jsonpatch[_0xe72d('0x24')](_0x4ba137,_0x589ec5,!![]);}catch(_0x27e325){return BPromise[_0xe72d('0x25')](_0x27e325);}return _0x4ba137[_0xe72d('0x26')]();};}function saveUpdates(_0xef2975,_0x56f832){return function(_0x21741b){if(_0x21741b){return _0x21741b[_0xe72d('0x27')](_0xef2975)[_0xe72d('0x28')](function(_0x590865){return _0x590865;});}return null;};}function removeEntity(_0x40900c,_0x29cdba){return function(_0x7af86c){if(_0x7af86c){return _0x7af86c[_0xe72d('0x29')]()[_0xe72d('0x28')](function(){_0x40900c[_0xe72d('0x1e')](0xcc)[_0xe72d('0x1f')]();});}};}function handleEntityNotFound(_0x197df3,_0x2550f2){return function(_0x260d07){if(!_0x260d07){_0x197df3['sendStatus'](0x194);}return _0x260d07;};}function handleError(_0x4668ac,_0x11b436){_0x11b436=_0x11b436||0x1f4;return function(_0x325092){logger['error'](_0x325092[_0xe72d('0x2a')]);if(_0x325092['name']){delete _0x325092[_0xe72d('0x2b')];}_0x4668ac[_0xe72d('0x1e')](_0x11b436)[_0xe72d('0x2c')](_0x325092);};}exports[_0xe72d('0x2d')]=function(_0x900d75,_0x57aa0d){var _0x3e4eac={},_0x205207={},_0x1a5212={'count':0x0,'rows':[]};var _0x24260e=_[_0xe72d('0x2e')](db[_0xe72d('0x2f')][_0xe72d('0x30')],function(_0x1f5013){return{'name':_0x1f5013['fieldName'],'type':_0x1f5013['type']['key']};});_0x205207['model']=_[_0xe72d('0x2e')](_0x24260e,'name');_0x205207['query']=_[_0xe72d('0x31')](_0x900d75[_0xe72d('0x32')]);_0x205207[_0xe72d('0x33')]=_['intersection'](_0x205207[_0xe72d('0x34')],_0x205207[_0xe72d('0x32')]);_0x3e4eac['attributes']=_[_0xe72d('0x35')](_0x205207[_0xe72d('0x34')],qs['fields'](_0x900d75[_0xe72d('0x32')][_0xe72d('0x36')]));_0x3e4eac['attributes']=_0x3e4eac[_0xe72d('0x37')][_0xe72d('0x38')]?_0x3e4eac[_0xe72d('0x37')]:_0x205207[_0xe72d('0x34')];if(!_0x900d75[_0xe72d('0x32')][_0xe72d('0x39')](_0xe72d('0x3a'))){_0x3e4eac[_0xe72d('0x22')]=qs['limit'](_0x900d75[_0xe72d('0x32')][_0xe72d('0x22')]);_0x3e4eac[_0xe72d('0x3b')]=qs['offset'](_0x900d75[_0xe72d('0x32')][_0xe72d('0x3b')]);}_0x3e4eac[_0xe72d('0x3c')]=qs[_0xe72d('0x3d')](_0x900d75[_0xe72d('0x32')]['sort']);_0x3e4eac[_0xe72d('0x3e')]=qs['filters'](_['pick'](_0x900d75[_0xe72d('0x32')],_0x205207[_0xe72d('0x33')]),_0x24260e);if(_0x900d75['query'][_0xe72d('0x3f')]){_0x3e4eac[_0xe72d('0x3e')]=_['merge'](_0x3e4eac[_0xe72d('0x3e')],{'$or':_['map'](_0x24260e,function(_0x855e7c){if(_0x855e7c['type']!==_0xe72d('0x40')){var _0x2ad07e={};_0x2ad07e[_0x855e7c[_0xe72d('0x2b')]]={'$like':'%'+_0x900d75[_0xe72d('0x32')]['filter']+'%'};return _0x2ad07e;}})});}_0x3e4eac=_[_0xe72d('0x41')]({},_0x3e4eac,_0x900d75[_0xe72d('0x42')]);var _0x115b4e={'where':_0x3e4eac[_0xe72d('0x3e')]};return db['SquareDetailsReport'][_0xe72d('0x21')](_0x115b4e)['then'](function(_0x5901f5){_0x1a5212[_0xe72d('0x21')]=_0x5901f5;if(_0x900d75[_0xe72d('0x32')][_0xe72d('0x43')]){_0x3e4eac['include']=[{'all':!![]}];}return db[_0xe72d('0x2f')]['findAll'](_0x3e4eac);})[_0xe72d('0x28')](function(_0x3f030e){_0x1a5212[_0xe72d('0x44')]=_0x3f030e;return _0x1a5212;})[_0xe72d('0x28')](respondWithFilteredResult(_0x57aa0d,_0x3e4eac))['catch'](handleError(_0x57aa0d,null));};exports[_0xe72d('0x45')]=function(_0x467271,_0x34af0a){var _0x8b6b0={'raw':!![],'where':{'id':_0x467271[_0xe72d('0x46')]['id']}},_0x3e007d={};_0x3e007d['model']=_[_0xe72d('0x31')](db[_0xe72d('0x2f')]['rawAttributes']);_0x3e007d[_0xe72d('0x32')]=_['keys'](_0x467271[_0xe72d('0x32')]);_0x3e007d[_0xe72d('0x33')]=_['intersection'](_0x3e007d[_0xe72d('0x34')],_0x3e007d['query']);_0x8b6b0[_0xe72d('0x37')]=_[_0xe72d('0x35')](_0x3e007d[_0xe72d('0x34')],qs[_0xe72d('0x36')](_0x467271[_0xe72d('0x32')][_0xe72d('0x36')]));_0x8b6b0['attributes']=_0x8b6b0[_0xe72d('0x37')]['length']?_0x8b6b0[_0xe72d('0x37')]:_0x3e007d['model'];if(_0x467271[_0xe72d('0x32')][_0xe72d('0x43')]){_0x8b6b0['include']=[{'all':!![]}];}_0x8b6b0=_[_0xe72d('0x41')]({},_0x8b6b0,_0x467271['options']);return db['SquareDetailsReport'][_0xe72d('0x47')](_0x8b6b0)[_0xe72d('0x28')](handleEntityNotFound(_0x34af0a,null))[_0xe72d('0x28')](respondWithResult(_0x34af0a,null))[_0xe72d('0x48')](handleError(_0x34af0a,null));};exports[_0xe72d('0x49')]=function(_0x1a7170,_0x38d27d){return db['SquareDetailsReport'][_0xe72d('0x49')](_0x1a7170[_0xe72d('0x4a')],{})['then'](respondWithResult(_0x38d27d,0xc9))[_0xe72d('0x48')](handleError(_0x38d27d,null));};exports[_0xe72d('0x27')]=function(_0xe6b5fc,_0x3b6c0c){if(_0xe6b5fc[_0xe72d('0x4a')]['id']){delete _0xe6b5fc[_0xe72d('0x4a')]['id'];}return db['SquareDetailsReport'][_0xe72d('0x47')]({'where':{'id':_0xe6b5fc[_0xe72d('0x46')]['id']}})[_0xe72d('0x28')](handleEntityNotFound(_0x3b6c0c,null))[_0xe72d('0x28')](saveUpdates(_0xe6b5fc[_0xe72d('0x4a')],null))[_0xe72d('0x28')](respondWithResult(_0x3b6c0c,null))[_0xe72d('0x48')](handleError(_0x3b6c0c,null));};exports[_0xe72d('0x29')]=function(_0x17d716,_0x526e9b){return db[_0xe72d('0x2f')]['find']({'where':{'id':_0x17d716[_0xe72d('0x46')]['id']}})[_0xe72d('0x28')](handleEntityNotFound(_0x526e9b,null))['then'](removeEntity(_0x526e9b,null))[_0xe72d('0x48')](handleError(_0x526e9b,null));};exports[_0xe72d('0x4b')]=function(_0x52feab,_0x540cca){return db[_0xe72d('0x2f')][_0xe72d('0x4b')]()[_0xe72d('0x28')](respondWithResult(_0x540cca,null))[_0xe72d('0x48')](handleError(_0x540cca,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 04446b3..1f89777 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 _0x616f=['rimraf','../../config/environment','./squareReportDetail.attributes','exports','report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x45f632,_0x1e1a1f){var _0x427cd4=function(_0x11a776){while(--_0x11a776){_0x45f632['push'](_0x45f632['shift']());}};_0x427cd4(++_0x1e1a1f);}(_0x616f,0xcb));var _0xf616=function(_0x216e72,_0x5cd161){_0x216e72=_0x216e72-0x0;var _0x2ff28d=_0x616f[_0x216e72];return _0x2ff28d;};'use strict';var _=require(_0xf616('0x0'));var util=require(_0xf616('0x1'));var logger=require(_0xf616('0x2'))(_0xf616('0x3'));var moment=require('moment');var BPromise=require(_0xf616('0x4'));var rp=require(_0xf616('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf616('0x6'));var config=require(_0xf616('0x7'));var attributes=require(_0xf616('0x8'));module[_0xf616('0x9')]=function(_0x4e45e8,_0x43d9b1){return _0x4e45e8['define']('SquareDetailsReport',attributes,{'tableName':_0xf616('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x090c=['rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','moment','bluebird'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x090c,0xb6));var _0xc090=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x090c[_0xda464c];return _0x19e222;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc090('0x0'));var BPromise=require(_0xc090('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc090('0x2'));var config=require(_0xc090('0x3'));var attributes=require(_0xc090('0x4'));module['exports']=function(_0x467998,_0x5d9dab){return _0x467998[_0xc090('0x5')](_0xc090('0x6'),attributes,{'tableName':_0xc090('0x7'),'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 705aaef..28fd901 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 _0x55d5=['rpc','jayson/promise','client','http','request','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55d5,0x142));var _0x555d=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x55d5[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x555d('0x0'));var util=require(_0x555d('0x1'));var moment=require(_0x555d('0x2'));var BPromise=require(_0x555d('0x3'));var rs=require(_0x555d('0x4'));var fs=require('fs');var Redis=require(_0x555d('0x5'));var db=require(_0x555d('0x6'))['db'];var utils=require(_0x555d('0x7'));var logger=require('../../config/logger')(_0x555d('0x8'));var config=require('../../config/environment');var jayson=require(_0x555d('0x9'));var client=jayson[_0x555d('0xa')][_0x555d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c3447,_0x491358,_0x40daee){return new BPromise(function(_0x287687,_0x39adbd){return client[_0x555d('0xc')](_0x1c3447,_0x40daee)['then'](function(_0x1a8f8a){logger['info'](_0x555d('0xd'),_0x491358,'request\x20sent');logger[_0x555d('0xe')](_0x555d('0xf'),_0x491358,'request\x20sent',JSON[_0x555d('0x10')](_0x1a8f8a));if(_0x1a8f8a[_0x555d('0x11')]){if(_0x1a8f8a[_0x555d('0x11')]['code']===0x1f4){logger[_0x555d('0x11')](_0x555d('0xd'),_0x491358,_0x1a8f8a[_0x555d('0x11')][_0x555d('0x12')]);return _0x39adbd(_0x1a8f8a['error'][_0x555d('0x12')]);}logger[_0x555d('0x11')](_0x555d('0xd'),_0x491358,_0x1a8f8a['error']['message']);return _0x287687(_0x1a8f8a['error'][_0x555d('0x12')]);}else{logger[_0x555d('0x13')](_0x555d('0xd'),_0x491358,_0x555d('0x14'));_0x287687(_0x1a8f8a[_0x555d('0x15')][_0x555d('0x12')]);}})[_0x555d('0x16')](function(_0x1e39c1){logger[_0x555d('0x11')](_0x555d('0xd'),_0x491358,_0x1e39c1);_0x39adbd(_0x1e39c1);});});}exports[_0x555d('0x17')]=function(_0xdbeba3){var _0x4b68bb=this;return new Promise(function(_0x1f4149,_0x38d22b){return db[_0x555d('0x18')][_0x555d('0x19')](_0xdbeba3[_0x555d('0x1a')],{'raw':_0xdbeba3[_0x555d('0x1b')]?_0xdbeba3['options'][_0x555d('0x1c')]===undefined?!![]:![]:!![]})[_0x555d('0x1d')](function(_0x3b36bb){logger['info']('CreateSquareDetailsReport',_0xdbeba3);logger[_0x555d('0xe')](_0x555d('0x17'),_0xdbeba3,JSON['stringify'](_0x3b36bb));_0x1f4149(_0x3b36bb);})[_0x555d('0x16')](function(_0xe12c7b){logger[_0x555d('0x11')]('CreateSquareDetailsReport',_0xe12c7b['message'],_0xdbeba3);_0x38d22b(_0x4b68bb[_0x555d('0x11')](0x1f4,_0xe12c7b[_0x555d('0x12')]));});});}; \ No newline at end of file +var _0x85d0=['jayson/promise','client','http','request','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','util','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x427684,_0xe4532e){var _0x452b66=function(_0x38f06d){while(--_0x38f06d){_0x427684['push'](_0x427684['shift']());}};_0x452b66(++_0xe4532e);}(_0x85d0,0x134));var _0x085d=function(_0x572747,_0x72990b){_0x572747=_0x572747-0x0;var _0x35c3df=_0x85d0[_0x572747];return _0x35c3df;};'use strict';var _=require('lodash');var util=require(_0x085d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x085d('0x1'))['db'];var utils=require(_0x085d('0x2'));var logger=require(_0x085d('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x085d('0x4'));var client=jayson[_0x085d('0x5')][_0x085d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x149764,_0x1c2ec3,_0x745980){return new BPromise(function(_0x4bfe24,_0x22f07b){return client[_0x085d('0x7')](_0x149764,_0x745980)['then'](function(_0x581f2a){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1c2ec3,_0x085d('0x8'));logger[_0x085d('0x9')](_0x085d('0xa'),_0x1c2ec3,_0x085d('0x8'),JSON[_0x085d('0xb')](_0x581f2a));if(_0x581f2a[_0x085d('0xc')]){if(_0x581f2a[_0x085d('0xc')]['code']===0x1f4){logger[_0x085d('0xc')](_0x085d('0xd'),_0x1c2ec3,_0x581f2a['error'][_0x085d('0xe')]);return _0x22f07b(_0x581f2a[_0x085d('0xc')][_0x085d('0xe')]);}logger['error'](_0x085d('0xd'),_0x1c2ec3,_0x581f2a[_0x085d('0xc')]['message']);return _0x4bfe24(_0x581f2a[_0x085d('0xc')][_0x085d('0xe')]);}else{logger[_0x085d('0xf')](_0x085d('0xd'),_0x1c2ec3,_0x085d('0x8'));_0x4bfe24(_0x581f2a['result'][_0x085d('0xe')]);}})[_0x085d('0x10')](function(_0x2cbe5b){logger[_0x085d('0xc')](_0x085d('0xd'),_0x1c2ec3,_0x2cbe5b);_0x22f07b(_0x2cbe5b);});});}exports[_0x085d('0x11')]=function(_0x45c4e0){var _0xcba67=this;return new Promise(function(_0x1f26b2,_0x22846c){return db[_0x085d('0x12')][_0x085d('0x13')](_0x45c4e0[_0x085d('0x14')],{'raw':_0x45c4e0[_0x085d('0x15')]?_0x45c4e0[_0x085d('0x15')][_0x085d('0x16')]===undefined?!![]:![]:!![]})[_0x085d('0x17')](function(_0x3bad8b){logger[_0x085d('0xf')]('CreateSquareDetailsReport',_0x45c4e0);logger['debug']('CreateSquareDetailsReport',_0x45c4e0,JSON['stringify'](_0x3bad8b));_0x1f26b2(_0x3bad8b);})['catch'](function(_0x5d81bd){logger[_0x085d('0xc')](_0x085d('0x11'),_0x5d81bd[_0x085d('0xe')],_0x45c4e0);_0x22846c(_0xcba67[_0x085d('0xc')](0x1f4,_0x5d81bd[_0x085d('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index bdfa3eb..3be67d1 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 _0xd470=['get','isAuthenticated','index','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x1c1e42,_0xe5f871){var _0x103632=function(_0x2f9048){while(--_0x2f9048){_0x1c1e42['push'](_0x1c1e42['shift']());}};_0x103632(++_0xe5f871);}(_0xd470,0x1bc));var _0x0d47=function(_0x4719ba,_0xc979f0){_0x4719ba=_0x4719ba-0x0;var _0x3f99b9=_0xd470[_0x4719ba];return _0x3f99b9;};'use strict';var express=require(_0x0d47('0x0'));var router=express[_0x0d47('0x1')]();var auth=require(_0x0d47('0x2'));var controller=require(_0x0d47('0x3'));router[_0x0d47('0x4')]('/',auth[_0x0d47('0x5')](),controller[_0x0d47('0x6')]);router['get']('/process/:pid/kill',auth[_0x0d47('0x5')](),controller['killProcess']);module[_0x0d47('0x7')]=router; \ No newline at end of file +var _0xeaec=['./system.controller','get','/process/:pid/kill','isAuthenticated','killProcess','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeaec,0x191));var _0xceae=function(_0x22e526,_0x130035){_0x22e526=_0x22e526-0x0;var _0x58c4b7=_0xeaec[_0x22e526];return _0x58c4b7;};'use strict';var express=require(_0xceae('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xceae('0x1'));router[_0xceae('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0xceae('0x2')](_0xceae('0x3'),auth[_0xceae('0x4')](),controller[_0xceae('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 2f7d8ae..e13dd82 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 _0x48a5=['util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','systeminformation','child_process','exec','../../config/logger','api'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x48a5,0xcb));var _0x548a=function(_0x19c3fe,_0x11cbca){_0x19c3fe=_0x19c3fe-0x0;var _0x244da1=_0x48a5[_0x19c3fe];return _0x244da1;};'use strict';var info=require(_0x548a('0x0'));var exec=require(_0x548a('0x1'))[_0x548a('0x2')];var logger=require(_0x548a('0x3'))(_0x548a('0x4'));var util=require(_0x548a('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x6d1557,_0xc9b4bb,_0x252b1f){_0xc9b4bb=_0xc9b4bb||0x1f4;return function(_0x5927e9){logger[_0x548a('0x6')](_0x548a('0x7'),_0x252b1f,_0xc9b4bb,util[_0x548a('0x8')](_0x5927e9,{'showHidden':![],'depth':null}));delete _0x5927e9[_0x548a('0x9')];_0x6d1557[_0x548a('0xa')](_0xc9b4bb)[_0x548a('0xb')](_0x5927e9);};}exports[_0x548a('0xc')]=function(_0x15077c,_0xcd7897){return info[_0x548a('0xd')]()[_0x548a('0xe')](function(_0x140248){return _0xcd7897['status'](0xc8)[_0x548a('0xf')](_0x140248);})[_0x548a('0x10')](function(_0x5f3265){return _0xcd7897['status'](0x1f4)['json'](_0x5f3265);});};exports[_0x548a('0x11')]=function(_0x10748b,_0x431fa0){var _0x53afe8=[_0x548a('0x12')];return new BPromise(function(_0x1a4e2d,_0x5d163b){return exec(util[_0x548a('0x13')](_0x548a('0x14'),_0x10748b[_0x548a('0x15')][_0x548a('0x16')]),function(_0x3be8cb,_0x2d1d11,_0x2d892b){if(_0x3be8cb){return _0x5d163b(_0x3be8cb);}return _0x1a4e2d(_0x2d1d11);});})[_0x548a('0xe')](function(_0x3e6ee9){var _0x502bfe=![];var _0xd2da34=_0x3e6ee9['split'](/\n/);for(var _0x55e087=0x0,_0x2f3657=_0x53afe8['length'];_0x55e087<_0x2f3657,_0x502bfe===![];_0x55e087+=0x1){if(_0x3e6ee9[_0x548a('0x17')](_0x53afe8[_0x55e087])>=0x0){_0x502bfe=!![];}}if(!_0x502bfe){throw new Error(util['format'](_0x548a('0x18'),_0x10748b['params'][_0x548a('0x16')]));}process[_0x548a('0x19')](_0x10748b[_0x548a('0x15')][_0x548a('0x16')],'SIGINT');return _0x431fa0[_0x548a('0xa')](0xc8)[_0x548a('0xf')]({'message':util[_0x548a('0x13')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x10748b['params'][_0x548a('0x16')])});})['catch'](handleError(_0x431fa0,null,_0x548a('0x11')));}; \ No newline at end of file +var _0xe8bf=['exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process'];(function(_0x40bb97,_0xca83a9){var _0x26a5f4=function(_0x2fc772){while(--_0x2fc772){_0x40bb97['push'](_0x40bb97['shift']());}};_0x26a5f4(++_0xca83a9);}(_0xe8bf,0x1ae));var _0xfe8b=function(_0x63adb2,_0x4c52f8){_0x63adb2=_0x63adb2-0x0;var _0x57a8a0=_0xe8bf[_0x63adb2];return _0x57a8a0;};'use strict';var info=require(_0xfe8b('0x0'));var exec=require(_0xfe8b('0x1'))[_0xfe8b('0x2')];var logger=require(_0xfe8b('0x3'))(_0xfe8b('0x4'));var util=require(_0xfe8b('0x5'));var BPromise=require(_0xfe8b('0x6'));var _=require(_0xfe8b('0x7'));function handleError(_0x512c0d,_0x40f476,_0x537645){_0x40f476=_0x40f476||0x1f4;return function(_0x31a4e5){logger[_0xfe8b('0x8')](_0xfe8b('0x9'),_0x537645,_0x40f476,util[_0xfe8b('0xa')](_0x31a4e5,{'showHidden':![],'depth':null}));delete _0x31a4e5[_0xfe8b('0xb')];_0x512c0d[_0xfe8b('0xc')](_0x40f476)['send'](_0x31a4e5);};}exports['index']=function(_0x1daf85,_0x3e6d40){return info['getAllData']()[_0xfe8b('0xd')](function(_0x429efd){return _0x3e6d40[_0xfe8b('0xc')](0xc8)[_0xfe8b('0xe')](_0x429efd);})[_0xfe8b('0xf')](function(_0x176eb4){return _0x3e6d40[_0xfe8b('0xc')](0x1f4)[_0xfe8b('0xe')](_0x176eb4);});};exports[_0xfe8b('0x10')]=function(_0x5bc7f8,_0xc13874){var _0x94fb82=[_0xfe8b('0x11')];return new BPromise(function(_0x5c754b,_0x37089a){return exec(util['format'](_0xfe8b('0x12'),_0x5bc7f8[_0xfe8b('0x13')][_0xfe8b('0x14')]),function(_0x284a55,_0x227a70,_0x2c4f54){if(_0x284a55){return _0x37089a(_0x284a55);}return _0x5c754b(_0x227a70);});})[_0xfe8b('0xd')](function(_0x49ea2c){var _0x91434=![];var _0x82f68=_0x49ea2c['split'](/\n/);for(var _0x13e6ff=0x0,_0x4f6237=_0x94fb82[_0xfe8b('0x15')];_0x13e6ff<_0x4f6237,_0x91434===![];_0x13e6ff+=0x1){if(_0x49ea2c['indexOf'](_0x94fb82[_0x13e6ff])>=0x0){_0x91434=!![];}}if(!_0x91434){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5bc7f8[_0xfe8b('0x13')][_0xfe8b('0x14')]));}process['kill'](_0x5bc7f8[_0xfe8b('0x13')][_0xfe8b('0x14')],_0xfe8b('0x16'));return _0xc13874[_0xfe8b('0xc')](0xc8)[_0xfe8b('0xe')]({'message':util['format'](_0xfe8b('0x17'),_0x5bc7f8[_0xfe8b('0x13')][_0xfe8b('0x14')])});})[_0xfe8b('0xf')](handleError(_0xc13874,null,_0xfe8b('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a7940ca..a8485f9 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 _0x8c77=['get','index','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller'];(function(_0x5bb44e,_0x43cee8){var _0x5775c=function(_0x30ce26){while(--_0x30ce26){_0x5bb44e['push'](_0x5bb44e['shift']());}};_0x5775c(++_0x43cee8);}(_0x8c77,0x1d6));var _0x78c7=function(_0x524230,_0x3afbd2){_0x524230=_0x524230-0x0;var _0x33fdf1=_0x8c77[_0x524230];return _0x33fdf1;};'use strict';var multer=require(_0x78c7('0x0'));var util=require(_0x78c7('0x1'));var path=require('path');var timeout=require(_0x78c7('0x2'));var express=require(_0x78c7('0x3'));var router=express[_0x78c7('0x4')]();var fs_extra=require(_0x78c7('0x5'));var auth=require(_0x78c7('0x6'));var interaction=require(_0x78c7('0x7'));var config=require(_0x78c7('0x8'));var controller=require(_0x78c7('0x9'));router[_0x78c7('0xa')]('/',auth['isAuthenticated'](),controller[_0x78c7('0xb')]);router[_0x78c7('0xa')](_0x78c7('0xc'),auth[_0x78c7('0xd')](),controller[_0x78c7('0xe')]);router[_0x78c7('0xf')]('/',auth['isAuthenticated'](),controller[_0x78c7('0x10')]);router['put'](_0x78c7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x78c7('0x11')](_0x78c7('0xc'),auth[_0x78c7('0xd')](),controller[_0x78c7('0x12')]);module[_0x78c7('0x13')]=router; \ No newline at end of file +var _0x47c2=['./tag.controller','get','isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47c2,0x1ae));var _0x247c=function(_0x5c7a3c,_0x5334d4){_0x5c7a3c=_0x5c7a3c-0x0;var _0xebfcc5=_0x47c2[_0x5c7a3c];return _0xebfcc5;};'use strict';var multer=require(_0x247c('0x0'));var util=require(_0x247c('0x1'));var path=require(_0x247c('0x2'));var timeout=require(_0x247c('0x3'));var express=require(_0x247c('0x4'));var router=express[_0x247c('0x5')]();var fs_extra=require(_0x247c('0x6'));var auth=require(_0x247c('0x7'));var interaction=require(_0x247c('0x8'));var config=require(_0x247c('0x9'));var controller=require(_0x247c('0xa'));router[_0x247c('0xb')]('/',auth[_0x247c('0xc')](),controller[_0x247c('0xd')]);router[_0x247c('0xb')](_0x247c('0xe'),auth['isAuthenticated'](),controller[_0x247c('0xf')]);router['post']('/',auth[_0x247c('0xc')](),controller[_0x247c('0x10')]);router['put'](_0x247c('0xe'),auth[_0x247c('0xc')](),controller['update']);router[_0x247c('0x11')](_0x247c('0xe'),auth[_0x247c('0xc')](),controller[_0x247c('0x12')]);module[_0x247c('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 2374757..676c3a4 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 _0x878f=['STRING','name','#0091EA','exports'];(function(_0x26e30d,_0x4f93c0){var _0x2c5f95=function(_0x5c9678){while(--_0x5c9678){_0x26e30d['push'](_0x26e30d['shift']());}};_0x2c5f95(++_0x4f93c0);}(_0x878f,0x173));var _0xf878=function(_0x3e36bd,_0xc9356b){_0x3e36bd=_0x3e36bd-0x0;var _0x55bc0b=_0x878f[_0x3e36bd];return _0x55bc0b;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0xb688=['STRING','name','#0091EA','exports'];(function(_0x1db6c1,_0x53b49a){var _0x3f5648=function(_0x3ae33){while(--_0x3ae33){_0x1db6c1['push'](_0x1db6c1['shift']());}};_0x3f5648(++_0x53b49a);}(_0xb688,0xcf));var _0x8b68=function(_0x568b36,_0x171bb1){_0x568b36=_0x568b36-0x0;var _0x437f5f=_0xb688[_0x568b36];return _0x437f5f;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'unique':_0x8b68('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x3')},'description':{'type':Sequelize[_0x8b68('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 1a492e1..2a806ea 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 _0xb48f=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','sendStatus','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','params','keys','attributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash'];(function(_0x1cb574,_0x54ed8a){var _0x1c918e=function(_0x29240b){while(--_0x29240b){_0x1cb574['push'](_0x1cb574['shift']());}};_0x1c918e(++_0x54ed8a);}(_0xb48f,0x1ea));var _0xfb48=function(_0x5f3730,_0x968294){_0x5f3730=_0x5f3730-0x0;var _0x387506=_0xb48f[_0x5f3730];return _0x387506;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfb48('0x0'));var rp=require(_0xfb48('0x1'));var moment=require('moment');var BPromise=require(_0xfb48('0x2'));var Mustache=require(_0xfb48('0x3'));var util=require('util');var path=require(_0xfb48('0x4'));var sox=require(_0xfb48('0x5'));var csv=require('to-csv');var ejs=require(_0xfb48('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb48('0x7'));var squel=require(_0xfb48('0x8'));var crypto=require(_0xfb48('0x9'));var jsforce=require(_0xfb48('0xa'));var deskjs=require(_0xfb48('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfb48('0xc'));var Redis=require(_0xfb48('0xd'));var authService=require(_0xfb48('0xe'));var qs=require(_0xfb48('0xf'));var as=require(_0xfb48('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb48('0x11'))(_0xfb48('0x12'));var utils=require(_0xfb48('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfb48('0x14'));var db=require(_0xfb48('0x15'))['db'];function respondWithStatusCode(_0x388044,_0x4a58a0){_0x4a58a0=_0x4a58a0||0xcc;return function(_0x18cd81){if(_0x18cd81){return _0x388044['sendStatus'](_0x4a58a0);}return _0x388044[_0xfb48('0x16')](_0x4a58a0)[_0xfb48('0x17')]();};}function respondWithResult(_0x5212c9,_0x4b8fc2){_0x4b8fc2=_0x4b8fc2||0xc8;return function(_0x15c7b3){if(_0x15c7b3){return _0x5212c9[_0xfb48('0x16')](_0x4b8fc2)[_0xfb48('0x18')](_0x15c7b3);}};}function respondWithFilteredResult(_0xce06af,_0x17dc13){return function(_0x59acfa){if(_0x59acfa){var _0x11e80a=_0x59acfa[_0xfb48('0x19')],_0x2602b8=_0x17dc13[_0xfb48('0x1a')],_0x48b006=_0x17dc13[_0xfb48('0x1a')]+_0x17dc13['limit'],_0x294088;if(_0x48b006>=_0x11e80a){_0x48b006=_0x11e80a;_0x294088=0xc8;}else{_0x294088=0xce;}_0xce06af[_0xfb48('0x16')](_0x294088);return _0xce06af[_0xfb48('0x1b')](_0xfb48('0x1c'),_0x2602b8+'-'+_0x48b006+'/'+_0x11e80a)['json'](_0x59acfa);}return null;};}function patchUpdates(_0x3553aa){return function(_0x4ea8da){try{jsonpatch[_0xfb48('0x1d')](_0x4ea8da,_0x3553aa,!![]);}catch(_0x222cbd){return BPromise[_0xfb48('0x1e')](_0x222cbd);}return _0x4ea8da[_0xfb48('0x1f')]();};}function saveUpdates(_0x454271,_0x38414f){return function(_0x64e5b6){if(_0x64e5b6){return _0x64e5b6[_0xfb48('0x20')](_0x454271)['then'](function(_0x4c7694){return _0x4c7694;});}return null;};}function removeEntity(_0x327331,_0x58def6){return function(_0x59b2f0){if(_0x59b2f0){return _0x59b2f0[_0xfb48('0x21')]()[_0xfb48('0x22')](function(){var _0x9a9f55=_0x59b2f0[_0xfb48('0x23')]({'plain':!![]});var _0xd4b43=_0xfb48('0x24');return db[_0xfb48('0x25')]['destroy']({'where':{'type':_0xd4b43,'resourceId':_0x9a9f55['id']}})[_0xfb48('0x22')](function(){return _0x59b2f0;});})[_0xfb48('0x22')](function(){_0x327331[_0xfb48('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b336,_0x2513d7){return function(_0x2436fa){if(!_0x2436fa){_0x45b336[_0xfb48('0x26')](0x194);}return _0x2436fa;};}function handleError(_0x50ffa9,_0x2ca9d7){_0x2ca9d7=_0x2ca9d7||0x1f4;return function(_0xef36f5){logger['error'](_0xef36f5[_0xfb48('0x27')]);if(_0xef36f5['name']){delete _0xef36f5[_0xfb48('0x28')];}_0x50ffa9[_0xfb48('0x16')](_0x2ca9d7)[_0xfb48('0x29')](_0xef36f5);};}exports[_0xfb48('0x2a')]=function(_0x5bbad6,_0x494900){var _0x53f868={},_0x2a864f={},_0x4b5ec1={'count':0x0,'rows':[]};var _0x236e53=_[_0xfb48('0x2b')](db[_0xfb48('0x2c')][_0xfb48('0x2d')],function(_0x292e04){return{'name':_0x292e04[_0xfb48('0x2e')],'type':_0x292e04[_0xfb48('0x2f')][_0xfb48('0x30')]};});_0x2a864f['model']=_['map'](_0x236e53,_0xfb48('0x28'));_0x2a864f[_0xfb48('0x31')]=_['keys'](_0x5bbad6[_0xfb48('0x31')]);_0x2a864f[_0xfb48('0x32')]=_[_0xfb48('0x33')](_0x2a864f[_0xfb48('0x34')],_0x2a864f[_0xfb48('0x31')]);_0x53f868['attributes']=_[_0xfb48('0x33')](_0x2a864f[_0xfb48('0x34')],qs['fields'](_0x5bbad6['query'][_0xfb48('0x35')]));_0x53f868['attributes']=_0x53f868['attributes'][_0xfb48('0x36')]?_0x53f868['attributes']:_0x2a864f[_0xfb48('0x34')];if(!_0x5bbad6[_0xfb48('0x31')]['hasOwnProperty'](_0xfb48('0x37'))){_0x53f868[_0xfb48('0x38')]=qs[_0xfb48('0x38')](_0x5bbad6['query'][_0xfb48('0x38')]);_0x53f868['offset']=qs[_0xfb48('0x1a')](_0x5bbad6[_0xfb48('0x31')]['offset']);}_0x53f868[_0xfb48('0x39')]=qs[_0xfb48('0x3a')](_0x5bbad6[_0xfb48('0x31')][_0xfb48('0x3a')]);_0x53f868[_0xfb48('0x3b')]=qs[_0xfb48('0x32')](_[_0xfb48('0x3c')](_0x5bbad6['query'],_0x2a864f[_0xfb48('0x32')]),_0x236e53);if(_0x5bbad6[_0xfb48('0x31')]['filter']){_0x53f868[_0xfb48('0x3b')]=_['merge'](_0x53f868[_0xfb48('0x3b')],{'$or':_['map'](_0x236e53,function(_0x38c7dc){if(_0x38c7dc[_0xfb48('0x2f')]!==_0xfb48('0x3d')){var _0x310ef0={};_0x310ef0[_0x38c7dc[_0xfb48('0x28')]]={'$like':'%'+_0x5bbad6[_0xfb48('0x31')][_0xfb48('0x3e')]+'%'};return _0x310ef0;}})});}_0x53f868=_[_0xfb48('0x3f')]({},_0x53f868,_0x5bbad6['options']);var _0x3838bc={'where':_0x53f868[_0xfb48('0x3b')]};return db[_0xfb48('0x2c')][_0xfb48('0x19')](_0x3838bc)['then'](function(_0x2ea9be){_0x4b5ec1['count']=_0x2ea9be;if(_0x5bbad6['query'][_0xfb48('0x40')]){_0x53f868['include']=[{'all':!![]}];}return db[_0xfb48('0x2c')][_0xfb48('0x41')](_0x53f868);})[_0xfb48('0x22')](function(_0x419b1d){_0x4b5ec1[_0xfb48('0x42')]=_0x419b1d;return _0x4b5ec1;})[_0xfb48('0x22')](respondWithFilteredResult(_0x494900,_0x53f868))[_0xfb48('0x43')](handleError(_0x494900,null));};exports['show']=function(_0x28c956,_0x350dca){var _0x1265c3={'raw':!![],'where':{'id':_0x28c956[_0xfb48('0x44')]['id']}},_0x57a78b={};_0x57a78b[_0xfb48('0x34')]=_[_0xfb48('0x45')](db[_0xfb48('0x2c')]['rawAttributes']);_0x57a78b[_0xfb48('0x31')]=_[_0xfb48('0x45')](_0x28c956[_0xfb48('0x31')]);_0x57a78b[_0xfb48('0x32')]=_[_0xfb48('0x33')](_0x57a78b[_0xfb48('0x34')],_0x57a78b[_0xfb48('0x31')]);_0x1265c3[_0xfb48('0x46')]=_[_0xfb48('0x33')](_0x57a78b[_0xfb48('0x34')],qs['fields'](_0x28c956[_0xfb48('0x31')][_0xfb48('0x35')]));_0x1265c3[_0xfb48('0x46')]=_0x1265c3[_0xfb48('0x46')][_0xfb48('0x36')]?_0x1265c3[_0xfb48('0x46')]:_0x57a78b['model'];if(_0x28c956['query'][_0xfb48('0x40')]){_0x1265c3[_0xfb48('0x47')]=[{'all':!![]}];}_0x1265c3=_['merge']({},_0x1265c3,_0x28c956['options']);return db['Tag']['find'](_0x1265c3)[_0xfb48('0x22')](handleEntityNotFound(_0x350dca,null))['then'](respondWithResult(_0x350dca,null))[_0xfb48('0x43')](handleError(_0x350dca,null));};exports[_0xfb48('0x48')]=function(_0x400588,_0x43e727){return db[_0xfb48('0x2c')][_0xfb48('0x48')](_0x400588[_0xfb48('0x49')],{})[_0xfb48('0x22')](function(_0x2648e2){var _0x466404=_0x400588[_0xfb48('0x4a')][_0xfb48('0x23')]({'plain':!![]});if(!_0x466404)throw new Error(_0xfb48('0x4b'));if(_0x466404[_0xfb48('0x4c')]==='user'){var _0x969045=_0x2648e2[_0xfb48('0x23')]({'plain':!![]});var _0x2e98e2=_0xfb48('0x24');return db[_0xfb48('0x4d')][_0xfb48('0x4e')]({'where':{'name':_0x2e98e2,'userProfileId':_0x466404[_0xfb48('0x4f')]},'raw':!![]})['then'](function(_0x3faff4){if(_0x3faff4&&_0x3faff4[_0xfb48('0x50')]===0x0){return db[_0xfb48('0x25')][_0xfb48('0x48')]({'name':_0x969045[_0xfb48('0x28')],'resourceId':_0x969045['id'],'type':_0x3faff4[_0xfb48('0x28')],'sectionId':_0x3faff4['id']},{})['then'](function(){return _0x2648e2;});}else{return _0x2648e2;}})[_0xfb48('0x43')](function(_0x5d9892){logger[_0xfb48('0x51')](_0xfb48('0x52'),_0x5d9892);throw _0x5d9892;});}return _0x2648e2;})[_0xfb48('0x22')](respondWithResult(_0x43e727,0xc9))[_0xfb48('0x43')](handleError(_0x43e727,null));};exports['update']=function(_0x482b16,_0x3a298b){if(_0x482b16[_0xfb48('0x49')]['id']){delete _0x482b16['body']['id'];}return db[_0xfb48('0x2c')][_0xfb48('0x4e')]({'where':{'id':_0x482b16[_0xfb48('0x44')]['id']}})[_0xfb48('0x22')](handleEntityNotFound(_0x3a298b,null))[_0xfb48('0x22')](saveUpdates(_0x482b16['body'],null))[_0xfb48('0x22')](respondWithResult(_0x3a298b,null))[_0xfb48('0x43')](handleError(_0x3a298b,null));};exports['destroy']=function(_0x1e755a,_0xebc664){return db[_0xfb48('0x2c')][_0xfb48('0x4e')]({'where':{'id':_0x1e755a[_0xfb48('0x44')]['id']}})[_0xfb48('0x22')](handleEntityNotFound(_0xebc664,null))[_0xfb48('0x22')](removeEntity(_0xebc664,null))[_0xfb48('0x43')](handleError(_0xebc664,null));}; \ No newline at end of file +var _0x35ec=['../../mysqldb','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error','stack','name','send','index','Tag','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x345e3a,_0x44d927){var _0x3d570b=function(_0x196ca2){while(--_0x196ca2){_0x345e3a['push'](_0x345e3a['shift']());}};_0x3d570b(++_0x44d927);}(_0x35ec,0x13c));var _0xc35e=function(_0x12a686,_0x27ca19){_0x12a686=_0x12a686-0x0;var _0x246845=_0x35ec[_0x12a686];return _0x246845;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc35e('0x0'));var rimraf=require(_0xc35e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc35e('0x2'));var rp=require('request-promise');var moment=require(_0xc35e('0x3'));var BPromise=require(_0xc35e('0x4'));var Mustache=require(_0xc35e('0x5'));var util=require(_0xc35e('0x6'));var path=require(_0xc35e('0x7'));var sox=require(_0xc35e('0x8'));var csv=require(_0xc35e('0x9'));var ejs=require(_0xc35e('0xa'));var fs=require('fs');var fs_extra=require(_0xc35e('0xb'));var _=require(_0xc35e('0xc'));var squel=require(_0xc35e('0xd'));var crypto=require(_0xc35e('0xe'));var jsforce=require(_0xc35e('0xf'));var deskjs=require(_0xc35e('0x10'));var toCsv=require(_0xc35e('0x9'));var querystring=require(_0xc35e('0x11'));var Papa=require(_0xc35e('0x12'));var Redis=require(_0xc35e('0x13'));var authService=require(_0xc35e('0x14'));var qs=require(_0xc35e('0x15'));var as=require(_0xc35e('0x16'));var hardwareService=require(_0xc35e('0x17'));var logger=require(_0xc35e('0x18'))(_0xc35e('0x19'));var utils=require(_0xc35e('0x1a'));var config=require(_0xc35e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xc35e('0x1c'))['db'];function respondWithStatusCode(_0x3e0481,_0x1efb8f){_0x1efb8f=_0x1efb8f||0xcc;return function(_0x5f1ffc){if(_0x5f1ffc){return _0x3e0481['sendStatus'](_0x1efb8f);}return _0x3e0481[_0xc35e('0x1d')](_0x1efb8f)[_0xc35e('0x1e')]();};}function respondWithResult(_0x3793da,_0x1a2e95){_0x1a2e95=_0x1a2e95||0xc8;return function(_0xd25cd8){if(_0xd25cd8){return _0x3793da['status'](_0x1a2e95)['json'](_0xd25cd8);}};}function respondWithFilteredResult(_0x3697ea,_0x33dd93){return function(_0x3fe12a){if(_0x3fe12a){var _0x2d4cee=_0x3fe12a[_0xc35e('0x1f')],_0x3df189=_0x33dd93[_0xc35e('0x20')],_0x4c8e7b=_0x33dd93[_0xc35e('0x20')]+_0x33dd93[_0xc35e('0x21')],_0x471b80;if(_0x4c8e7b>=_0x2d4cee){_0x4c8e7b=_0x2d4cee;_0x471b80=0xc8;}else{_0x471b80=0xce;}_0x3697ea[_0xc35e('0x1d')](_0x471b80);return _0x3697ea[_0xc35e('0x22')](_0xc35e('0x23'),_0x3df189+'-'+_0x4c8e7b+'/'+_0x2d4cee)['json'](_0x3fe12a);}return null;};}function patchUpdates(_0x55fb14){return function(_0x5e3453){try{jsonpatch['apply'](_0x5e3453,_0x55fb14,!![]);}catch(_0x546b78){return BPromise[_0xc35e('0x24')](_0x546b78);}return _0x5e3453[_0xc35e('0x25')]();};}function saveUpdates(_0x429f1a,_0x53fdba){return function(_0xbf8b97){if(_0xbf8b97){return _0xbf8b97[_0xc35e('0x26')](_0x429f1a)[_0xc35e('0x27')](function(_0x2bb100){return _0x2bb100;});}return null;};}function removeEntity(_0x3c8d00,_0xee2a77){return function(_0x3a288e){if(_0x3a288e){return _0x3a288e[_0xc35e('0x28')]()[_0xc35e('0x27')](function(){var _0x483b81=_0x3a288e[_0xc35e('0x29')]({'plain':!![]});var _0x5b1e7b=_0xc35e('0x2a');return db[_0xc35e('0x2b')][_0xc35e('0x28')]({'where':{'type':_0x5b1e7b,'resourceId':_0x483b81['id']}})[_0xc35e('0x27')](function(){return _0x3a288e;});})[_0xc35e('0x27')](function(){_0x3c8d00[_0xc35e('0x1d')](0xcc)[_0xc35e('0x1e')]();});}};}function handleEntityNotFound(_0x462b7c,_0x5c41f2){return function(_0x2ea160){if(!_0x2ea160){_0x462b7c[_0xc35e('0x2c')](0x194);}return _0x2ea160;};}function handleError(_0x575e6c,_0x38baf8){_0x38baf8=_0x38baf8||0x1f4;return function(_0x26c452){logger[_0xc35e('0x2d')](_0x26c452[_0xc35e('0x2e')]);if(_0x26c452[_0xc35e('0x2f')]){delete _0x26c452['name'];}_0x575e6c['status'](_0x38baf8)[_0xc35e('0x30')](_0x26c452);};}exports[_0xc35e('0x31')]=function(_0x445835,_0x44babe){var _0x3d8525={},_0x2c981b={},_0x272072={'count':0x0,'rows':[]};var _0x38e530=_['map'](db[_0xc35e('0x32')]['rawAttributes'],function(_0x1336d2){return{'name':_0x1336d2[_0xc35e('0x33')],'type':_0x1336d2['type'][_0xc35e('0x34')]};});_0x2c981b['model']=_['map'](_0x38e530,_0xc35e('0x2f'));_0x2c981b['query']=_[_0xc35e('0x35')](_0x445835[_0xc35e('0x36')]);_0x2c981b[_0xc35e('0x37')]=_[_0xc35e('0x38')](_0x2c981b[_0xc35e('0x39')],_0x2c981b[_0xc35e('0x36')]);_0x3d8525['attributes']=_[_0xc35e('0x38')](_0x2c981b[_0xc35e('0x39')],qs[_0xc35e('0x3a')](_0x445835[_0xc35e('0x36')][_0xc35e('0x3a')]));_0x3d8525['attributes']=_0x3d8525[_0xc35e('0x3b')][_0xc35e('0x3c')]?_0x3d8525[_0xc35e('0x3b')]:_0x2c981b['model'];if(!_0x445835[_0xc35e('0x36')][_0xc35e('0x3d')]('nolimit')){_0x3d8525['limit']=qs[_0xc35e('0x21')](_0x445835[_0xc35e('0x36')][_0xc35e('0x21')]);_0x3d8525[_0xc35e('0x20')]=qs[_0xc35e('0x20')](_0x445835[_0xc35e('0x36')][_0xc35e('0x20')]);}_0x3d8525['order']=qs['sort'](_0x445835[_0xc35e('0x36')][_0xc35e('0x3e')]);_0x3d8525[_0xc35e('0x3f')]=qs[_0xc35e('0x37')](_[_0xc35e('0x40')](_0x445835[_0xc35e('0x36')],_0x2c981b[_0xc35e('0x37')]),_0x38e530);if(_0x445835[_0xc35e('0x36')][_0xc35e('0x41')]){_0x3d8525[_0xc35e('0x3f')]=_['merge'](_0x3d8525[_0xc35e('0x3f')],{'$or':_['map'](_0x38e530,function(_0x3cf5e5){if(_0x3cf5e5[_0xc35e('0x42')]!==_0xc35e('0x43')){var _0x5bd260={};_0x5bd260[_0x3cf5e5[_0xc35e('0x2f')]]={'$like':'%'+_0x445835[_0xc35e('0x36')][_0xc35e('0x41')]+'%'};return _0x5bd260;}})});}_0x3d8525=_[_0xc35e('0x44')]({},_0x3d8525,_0x445835[_0xc35e('0x45')]);var _0x5904d7={'where':_0x3d8525[_0xc35e('0x3f')]};return db[_0xc35e('0x32')][_0xc35e('0x1f')](_0x5904d7)[_0xc35e('0x27')](function(_0x2dfe32){_0x272072[_0xc35e('0x1f')]=_0x2dfe32;if(_0x445835[_0xc35e('0x36')][_0xc35e('0x46')]){_0x3d8525[_0xc35e('0x47')]=[{'all':!![]}];}return db[_0xc35e('0x32')][_0xc35e('0x48')](_0x3d8525);})[_0xc35e('0x27')](function(_0x56ceeb){_0x272072[_0xc35e('0x49')]=_0x56ceeb;return _0x272072;})[_0xc35e('0x27')](respondWithFilteredResult(_0x44babe,_0x3d8525))[_0xc35e('0x4a')](handleError(_0x44babe,null));};exports['show']=function(_0x2e4166,_0x65bba1){var _0x2f1930={'raw':!![],'where':{'id':_0x2e4166[_0xc35e('0x4b')]['id']}},_0x496717={};_0x496717[_0xc35e('0x39')]=_[_0xc35e('0x35')](db[_0xc35e('0x32')][_0xc35e('0x4c')]);_0x496717[_0xc35e('0x36')]=_['keys'](_0x2e4166[_0xc35e('0x36')]);_0x496717['filters']=_[_0xc35e('0x38')](_0x496717[_0xc35e('0x39')],_0x496717[_0xc35e('0x36')]);_0x2f1930['attributes']=_[_0xc35e('0x38')](_0x496717['model'],qs['fields'](_0x2e4166['query'][_0xc35e('0x3a')]));_0x2f1930[_0xc35e('0x3b')]=_0x2f1930[_0xc35e('0x3b')][_0xc35e('0x3c')]?_0x2f1930[_0xc35e('0x3b')]:_0x496717['model'];if(_0x2e4166[_0xc35e('0x36')][_0xc35e('0x46')]){_0x2f1930[_0xc35e('0x47')]=[{'all':!![]}];}_0x2f1930=_[_0xc35e('0x44')]({},_0x2f1930,_0x2e4166['options']);return db['Tag'][_0xc35e('0x4d')](_0x2f1930)[_0xc35e('0x27')](handleEntityNotFound(_0x65bba1,null))[_0xc35e('0x27')](respondWithResult(_0x65bba1,null))['catch'](handleError(_0x65bba1,null));};exports[_0xc35e('0x4e')]=function(_0x291c7d,_0x55fb5d){return db[_0xc35e('0x32')][_0xc35e('0x4e')](_0x291c7d[_0xc35e('0x4f')],{})[_0xc35e('0x27')](function(_0x117a7d){var _0x59c71a=_0x291c7d[_0xc35e('0x50')][_0xc35e('0x29')]({'plain':!![]});if(!_0x59c71a)throw new Error(_0xc35e('0x51'));if(_0x59c71a[_0xc35e('0x52')]===_0xc35e('0x50')){var _0x2d559e=_0x117a7d[_0xc35e('0x29')]({'plain':!![]});var _0x1c8a25=_0xc35e('0x2a');return db[_0xc35e('0x53')][_0xc35e('0x4d')]({'where':{'name':_0x1c8a25,'userProfileId':_0x59c71a[_0xc35e('0x54')]},'raw':!![]})['then'](function(_0x209049){if(_0x209049&&_0x209049[_0xc35e('0x55')]===0x0){return db[_0xc35e('0x2b')][_0xc35e('0x4e')]({'name':_0x2d559e[_0xc35e('0x2f')],'resourceId':_0x2d559e['id'],'type':_0x209049[_0xc35e('0x2f')],'sectionId':_0x209049['id']},{})[_0xc35e('0x27')](function(){return _0x117a7d;});}else{return _0x117a7d;}})[_0xc35e('0x4a')](function(_0x59f293){logger[_0xc35e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59f293);throw _0x59f293;});}return _0x117a7d;})[_0xc35e('0x27')](respondWithResult(_0x55fb5d,0xc9))[_0xc35e('0x4a')](handleError(_0x55fb5d,null));};exports[_0xc35e('0x26')]=function(_0x101d4e,_0x510b24){if(_0x101d4e['body']['id']){delete _0x101d4e[_0xc35e('0x4f')]['id'];}return db[_0xc35e('0x32')][_0xc35e('0x4d')]({'where':{'id':_0x101d4e[_0xc35e('0x4b')]['id']}})[_0xc35e('0x27')](handleEntityNotFound(_0x510b24,null))[_0xc35e('0x27')](saveUpdates(_0x101d4e[_0xc35e('0x4f')],null))[_0xc35e('0x27')](respondWithResult(_0x510b24,null))[_0xc35e('0x4a')](handleError(_0x510b24,null));};exports['destroy']=function(_0x210054,_0x3e0d82){return db['Tag'][_0xc35e('0x4d')]({'where':{'id':_0x210054[_0xc35e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e0d82,null))['then'](removeEntity(_0x3e0d82,null))['catch'](handleError(_0x3e0d82,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e0e4c50..e110494 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 _0x3dd7=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x3dd7,0xe9));var _0x73dd=function(_0x5c4bab,_0x6178e){_0x5c4bab=_0x5c4bab-0x0;var _0x198aef=_0x3dd7[_0x5c4bab];return _0x198aef;};'use strict';var _=require(_0x73dd('0x0'));var util=require(_0x73dd('0x1'));var logger=require(_0x73dd('0x2'))(_0x73dd('0x3'));var moment=require('moment');var BPromise=require(_0x73dd('0x4'));var rp=require(_0x73dd('0x5'));var fs=require('fs');var path=require(_0x73dd('0x6'));var rimraf=require('rimraf');var config=require(_0x73dd('0x7'));var attributes=require(_0x73dd('0x8'));module[_0x73dd('0x9')]=function(_0x57a7bc,_0x3eb0f3){return _0x57a7bc[_0x73dd('0xa')](_0x73dd('0xb'),attributes,{'tableName':_0x73dd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bd5=['tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag'];(function(_0x574bc3,_0x3a5d6e){var _0x54be20=function(_0x35b682){while(--_0x35b682){_0x574bc3['push'](_0x574bc3['shift']());}};_0x54be20(++_0x3a5d6e);}(_0x0bd5,0x189));var _0x50bd=function(_0xe91f70,_0x26324e){_0xe91f70=_0xe91f70-0x0;var _0x4162cf=_0x0bd5[_0xe91f70];return _0x4162cf;};'use strict';var _=require(_0x50bd('0x0'));var util=require(_0x50bd('0x1'));var logger=require(_0x50bd('0x2'))(_0x50bd('0x3'));var moment=require(_0x50bd('0x4'));var BPromise=require(_0x50bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50bd('0x6'));var rimraf=require(_0x50bd('0x7'));var config=require(_0x50bd('0x8'));var attributes=require(_0x50bd('0x9'));module[_0x50bd('0xa')]=function(_0x229135,_0x125e42){return _0x229135[_0x50bd('0xb')](_0x50bd('0xc'),attributes,{'tableName':_0x50bd('0xd'),'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 d3afa7c..a499683 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 _0xc874=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment'];(function(_0x38cdf5,_0x7e33a8){var _0x1d070e=function(_0x3193c7){while(--_0x3193c7){_0x38cdf5['push'](_0x38cdf5['shift']());}};_0x1d070e(++_0x7e33a8);}(_0xc874,0x154));var _0x4c87=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0xc874[_0x39e164];return _0x13fa6b;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});} \ No newline at end of file +var _0xb903=['http','request','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','Tag,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x260599,_0xbf728c){var _0x4f253d=function(_0xaa8bc5){while(--_0xaa8bc5){_0x260599['push'](_0x260599['shift']());}};_0x4f253d(++_0xbf728c);}(_0xb903,0x185));var _0x3b90=function(_0xe5b25f,_0xd0c1db){_0xe5b25f=_0xe5b25f-0x0;var _0x2b5402=_0xb903[_0xe5b25f];return _0x2b5402;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('Tag,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('Tag,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 31aec67..18205d1 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 _0xdbda=['get','/:id','getQueues','getAgents','post','create','/:id/queues','addQueues','/:id/users','put','update','delete','destroy','removeQueues','removeAgents','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xdbda,0x10a));var _0xadbd=function(_0x45bb55,_0x15d4bb){_0x45bb55=_0x45bb55-0x0;var _0x5a82d1=_0xdbda[_0x45bb55];return _0x5a82d1;};'use strict';var multer=require(_0xadbd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xadbd('0x1'));var router=express[_0xadbd('0x2')]();var fs_extra=require(_0xadbd('0x3'));var auth=require(_0xadbd('0x4'));var interaction=require(_0xadbd('0x5'));var config=require(_0xadbd('0x6'));var controller=require('./team.controller');router['get']('/',auth[_0xadbd('0x7')](),controller[_0xadbd('0x8')]);router[_0xadbd('0x9')](_0xadbd('0xa'),auth[_0xadbd('0x7')](),controller['show']);router[_0xadbd('0x9')]('/:id/queues',auth[_0xadbd('0x7')](),controller[_0xadbd('0xb')]);router[_0xadbd('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xadbd('0xc')]);router[_0xadbd('0xd')]('/',auth['isAuthenticated'](),controller[_0xadbd('0xe')]);router['post'](_0xadbd('0xf'),auth[_0xadbd('0x7')](),controller[_0xadbd('0x10')]);router[_0xadbd('0xd')](_0xadbd('0x11'),auth[_0xadbd('0x7')](),controller['addAgents']);router[_0xadbd('0x12')](_0xadbd('0xa'),auth[_0xadbd('0x7')](),controller[_0xadbd('0x13')]);router[_0xadbd('0x14')]('/:id',auth[_0xadbd('0x7')](),controller[_0xadbd('0x15')]);router[_0xadbd('0x14')]('/:id/queues',auth[_0xadbd('0x7')](),controller[_0xadbd('0x16')]);router[_0xadbd('0x14')](_0xadbd('0x11'),auth[_0xadbd('0x7')](),controller[_0xadbd('0x17')]);module[_0xadbd('0x18')]=router; \ No newline at end of file +var _0xaaf3=['/:id/queues','isAuthenticated','getAgents','create','post','addQueues','put','/:id','delete','removeQueues','/:id/users','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index','get'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0xaaf3,0xa6));var _0x3aaf=function(_0x169b43,_0x2af50f){_0x169b43=_0x169b43-0x0;var _0x2df67f=_0xaaf3[_0x169b43];return _0x2df67f;};'use strict';var multer=require(_0x3aaf('0x0'));var util=require(_0x3aaf('0x1'));var path=require(_0x3aaf('0x2'));var timeout=require(_0x3aaf('0x3'));var express=require(_0x3aaf('0x4'));var router=express[_0x3aaf('0x5')]();var fs_extra=require(_0x3aaf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3aaf('0x7'));var config=require('../../config/environment');var controller=require('./team.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3aaf('0x8')]);router[_0x3aaf('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x3aaf('0xa'),auth[_0x3aaf('0xb')](),controller['getQueues']);router[_0x3aaf('0x9')]('/:id/users',auth[_0x3aaf('0xb')](),controller[_0x3aaf('0xc')]);router['post']('/',auth[_0x3aaf('0xb')](),controller[_0x3aaf('0xd')]);router[_0x3aaf('0xe')](_0x3aaf('0xa'),auth[_0x3aaf('0xb')](),controller[_0x3aaf('0xf')]);router[_0x3aaf('0xe')]('/:id/users',auth[_0x3aaf('0xb')](),controller['addAgents']);router[_0x3aaf('0x10')]('/:id',auth[_0x3aaf('0xb')](),controller['update']);router['delete'](_0x3aaf('0x11'),auth[_0x3aaf('0xb')](),controller['destroy']);router[_0x3aaf('0x12')](_0x3aaf('0xa'),auth[_0x3aaf('0xb')](),controller[_0x3aaf('0x13')]);router[_0x3aaf('0x12')](_0x3aaf('0x14'),auth[_0x3aaf('0xb')](),controller[_0x3aaf('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index e761237..00ff28e 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 _0xab3e=['name','sequelize','STRING'];(function(_0x59c233,_0xe0627e){var _0x26e0ef=function(_0x553d84){while(--_0x553d84){_0x59c233['push'](_0x59c233['shift']());}};_0x26e0ef(++_0xe0627e);}(_0xab3e,0x88));var _0xeab3=function(_0x1555f2,_0x4fa120){_0x1555f2=_0x1555f2-0x0;var _0x5f2f4c=_0xab3e[_0x1555f2];return _0x5f2f4c;};'use strict';var Sequelize=require(_0xeab3('0x0'));module['exports']={'name':{'type':Sequelize[_0xeab3('0x1')],'allowNull':![],'unique':_0xeab3('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb1d5=['sequelize','exports','STRING','name'];(function(_0x401e83,_0xc6d9c5){var _0x3cc505=function(_0xa53231){while(--_0xa53231){_0x401e83['push'](_0x401e83['shift']());}};_0x3cc505(++_0xc6d9c5);}(_0xb1d5,0x16c));var _0x5b1d=function(_0x395c56,_0x3d667f){_0x395c56=_0x395c56-0x0;var _0x435770=_0xb1d5[_0x395c56];return _0x435770;};'use strict';var Sequelize=require(_0x5b1d('0x0'));module[_0x5b1d('0x1')]={'name':{'type':Sequelize[_0x5b1d('0x2')],'allowNull':![],'unique':_0x5b1d('0x3')},'description':{'type':Sequelize[_0x5b1d('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b7991d7..a5befcc 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 _0xcd4e=['to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','Teams','UserProfileResource','destroy','stack','name','send','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','length','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','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','params','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','addQueues','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Fax','Openchannel','Whatsapp','sequelize','transaction','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','upsert','isNil','interface','format','SIP/%s','all','spread','removeAgents','Mail','parse','emit','Queue:remove','UserVoiceQueueRt','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x3ed74c,_0x2c643a){var _0x4fd79a=function(_0xa2e87e){while(--_0xa2e87e){_0x3ed74c['push'](_0x3ed74c['shift']());}};_0x4fd79a(++_0x2c643a);}(_0xcd4e,0x187));var _0xecd4=function(_0x19ef51,_0x4aeb96){_0x19ef51=_0x19ef51-0x0;var _0x483db8=_0xcd4e[_0x19ef51];return _0x483db8;};'use strict';var pdf=require(_0xecd4('0x0'));var emlformat=require(_0xecd4('0x1'));var rimraf=require(_0xecd4('0x2'));var zipdir=require(_0xecd4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xecd4('0x4'));var BPromise=require(_0xecd4('0x5'));var Mustache=require('mustache');var util=require(_0xecd4('0x6'));var path=require('path');var sox=require(_0xecd4('0x7'));var csv=require('to-csv');var ejs=require(_0xecd4('0x8'));var fs=require('fs');var fs_extra=require(_0xecd4('0x9'));var _=require(_0xecd4('0xa'));var squel=require(_0xecd4('0xb'));var crypto=require(_0xecd4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xecd4('0xd'));var toCsv=require(_0xecd4('0xe'));var querystring=require('querystring');var Papa=require(_0xecd4('0xf'));var Redis=require('ioredis');var authService=require(_0xecd4('0x10'));var qs=require(_0xecd4('0x11'));var as=require(_0xecd4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecd4('0x13'))(_0xecd4('0x14'));var utils=require('../../config/utils');var config=require(_0xecd4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xecd4('0x16'))['db'];config[_0xecd4('0x17')]=_[_0xecd4('0x18')](config[_0xecd4('0x17')],{'host':_0xecd4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecd4('0x17')]));require(_0xecd4('0x1a'))[_0xecd4('0x1b')](socket);function respondWithStatusCode(_0x23312a,_0x387bac){_0x387bac=_0x387bac||0xcc;return function(_0x1b69a2){if(_0x1b69a2){return _0x23312a[_0xecd4('0x1c')](_0x387bac);}return _0x23312a[_0xecd4('0x1d')](_0x387bac)[_0xecd4('0x1e')]();};}function respondWithResult(_0x48291b,_0x3f75a8){_0x3f75a8=_0x3f75a8||0xc8;return function(_0x10d1e7){if(_0x10d1e7){return _0x48291b[_0xecd4('0x1d')](_0x3f75a8)[_0xecd4('0x1f')](_0x10d1e7);}};}function respondWithFilteredResult(_0x3eb6d0,_0x2470ec){return function(_0x4e11f3){if(_0x4e11f3){var _0x703bb4=_0x4e11f3[_0xecd4('0x20')],_0x5c95f0=_0x2470ec[_0xecd4('0x21')],_0xf4ef28=_0x2470ec[_0xecd4('0x21')]+_0x2470ec[_0xecd4('0x22')],_0x3ebb0a;if(_0xf4ef28>=_0x703bb4){_0xf4ef28=_0x703bb4;_0x3ebb0a=0xc8;}else{_0x3ebb0a=0xce;}_0x3eb6d0[_0xecd4('0x1d')](_0x3ebb0a);return _0x3eb6d0[_0xecd4('0x23')](_0xecd4('0x24'),_0x5c95f0+'-'+_0xf4ef28+'/'+_0x703bb4)[_0xecd4('0x1f')](_0x4e11f3);}return null;};}function patchUpdates(_0x14d24c){return function(_0x5c10d6){try{jsonpatch[_0xecd4('0x25')](_0x5c10d6,_0x14d24c,!![]);}catch(_0x353f13){return BPromise[_0xecd4('0x26')](_0x353f13);}return _0x5c10d6['save']();};}function saveUpdates(_0x13dce6,_0x567356){return function(_0x57ae55){if(_0x57ae55){return _0x57ae55[_0xecd4('0x27')](_0x13dce6)[_0xecd4('0x28')](function(_0x104507){return _0x104507;});}return null;};}function removeEntity(_0xc12506,_0x353d08){return function(_0x3bc04e){if(_0x3bc04e){return _0x3bc04e['destroy']()[_0xecd4('0x28')](function(){var _0x38b6da=_0x3bc04e[_0xecd4('0x29')]({'plain':!![]});var _0x51a2df=_0xecd4('0x2a');return db[_0xecd4('0x2b')][_0xecd4('0x2c')]({'where':{'type':_0x51a2df,'resourceId':_0x38b6da['id']}})['then'](function(){return _0x3bc04e;});})[_0xecd4('0x28')](function(){_0xc12506[_0xecd4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2afa05,_0x5420c0){return function(_0x1bc49a){if(!_0x1bc49a){_0x2afa05[_0xecd4('0x1c')](0x194);}return _0x1bc49a;};}function handleError(_0x40d0a2,_0x5e509a){_0x5e509a=_0x5e509a||0x1f4;return function(_0x3b1ef0){logger['error'](_0x3b1ef0[_0xecd4('0x2d')]);if(_0x3b1ef0[_0xecd4('0x2e')]){delete _0x3b1ef0['name'];}_0x40d0a2[_0xecd4('0x1d')](_0x5e509a)[_0xecd4('0x2f')](_0x3b1ef0);};}exports[_0xecd4('0x30')]=function(_0x1b847b,_0x5817ca){var _0x1f08b9={},_0x47fd18={},_0x12a48f={'count':0x0,'rows':[]};var _0xd287de=_['map'](db[_0xecd4('0x31')][_0xecd4('0x32')],function(_0x5358d3){return{'name':_0x5358d3[_0xecd4('0x33')],'type':_0x5358d3[_0xecd4('0x34')][_0xecd4('0x35')]};});_0x47fd18[_0xecd4('0x36')]=_[_0xecd4('0x37')](_0xd287de,_0xecd4('0x2e'));_0x47fd18[_0xecd4('0x38')]=_[_0xecd4('0x39')](_0x1b847b[_0xecd4('0x38')]);_0x47fd18['filters']=_[_0xecd4('0x3a')](_0x47fd18[_0xecd4('0x36')],_0x47fd18[_0xecd4('0x38')]);_0x1f08b9['attributes']=_[_0xecd4('0x3a')](_0x47fd18[_0xecd4('0x36')],qs['fields'](_0x1b847b['query'][_0xecd4('0x3b')]));_0x1f08b9['attributes']=_0x1f08b9['attributes'][_0xecd4('0x3c')]?_0x1f08b9[_0xecd4('0x3d')]:_0x47fd18[_0xecd4('0x36')];if(!_0x1b847b['query']['hasOwnProperty'](_0xecd4('0x3e'))){_0x1f08b9[_0xecd4('0x22')]=qs[_0xecd4('0x22')](_0x1b847b[_0xecd4('0x38')][_0xecd4('0x22')]);_0x1f08b9[_0xecd4('0x21')]=qs['offset'](_0x1b847b['query'][_0xecd4('0x21')]);}_0x1f08b9[_0xecd4('0x3f')]=qs['sort'](_0x1b847b[_0xecd4('0x38')][_0xecd4('0x40')]);_0x1f08b9[_0xecd4('0x41')]=qs[_0xecd4('0x42')](_['pick'](_0x1b847b['query'],_0x47fd18[_0xecd4('0x42')]),_0xd287de);if(_0x1b847b[_0xecd4('0x38')][_0xecd4('0x43')]){_0x1f08b9[_0xecd4('0x41')]=_[_0xecd4('0x44')](_0x1f08b9[_0xecd4('0x41')],{'$or':_['map'](_0xd287de,function(_0x5590e6){if(_0x5590e6['type']!==_0xecd4('0x45')){var _0x4a0009={};_0x4a0009[_0x5590e6[_0xecd4('0x2e')]]={'$like':'%'+_0x1b847b['query'][_0xecd4('0x43')]+'%'};return _0x4a0009;}})});}_0x1f08b9=_[_0xecd4('0x44')]({},_0x1f08b9,_0x1b847b['options']);var _0x5c779e={'where':_0x1f08b9[_0xecd4('0x41')]};return db[_0xecd4('0x31')][_0xecd4('0x20')](_0x5c779e)['then'](function(_0x127feb){_0x12a48f[_0xecd4('0x20')]=_0x127feb;if(_0x1b847b[_0xecd4('0x38')]['includeAll']){_0x1f08b9[_0xecd4('0x46')]=[{'all':!![]}];}return db[_0xecd4('0x31')][_0xecd4('0x47')](_0x1f08b9);})[_0xecd4('0x28')](function(_0x3f64e){_0x12a48f[_0xecd4('0x48')]=_0x3f64e;return _0x12a48f;})['then'](respondWithFilteredResult(_0x5817ca,_0x1f08b9))[_0xecd4('0x49')](handleError(_0x5817ca,null));};exports[_0xecd4('0x4a')]=function(_0x30a29b,_0x527fab){var _0x754d58={'raw':![],'where':{'id':_0x30a29b['params']['id']}},_0x14ac07={};_0x14ac07[_0xecd4('0x36')]=_['keys'](db[_0xecd4('0x31')][_0xecd4('0x32')]);_0x14ac07[_0xecd4('0x38')]=_[_0xecd4('0x39')](_0x30a29b[_0xecd4('0x38')]);_0x14ac07[_0xecd4('0x42')]=_[_0xecd4('0x3a')](_0x14ac07[_0xecd4('0x36')],_0x14ac07['query']);_0x754d58['attributes']=_[_0xecd4('0x3a')](_0x14ac07[_0xecd4('0x36')],qs[_0xecd4('0x3b')](_0x30a29b[_0xecd4('0x38')][_0xecd4('0x3b')]));_0x754d58[_0xecd4('0x3d')]=_0x754d58[_0xecd4('0x3d')][_0xecd4('0x3c')]?_0x754d58[_0xecd4('0x3d')]:_0x14ac07[_0xecd4('0x36')];if(_0x30a29b[_0xecd4('0x38')][_0xecd4('0x4b')]){_0x754d58['include']=[{'all':!![]}];}_0x754d58=_['merge']({},_0x754d58,_0x30a29b[_0xecd4('0x4c')]);return db[_0xecd4('0x31')][_0xecd4('0x4d')](_0x754d58)[_0xecd4('0x28')](handleEntityNotFound(_0x527fab,null))[_0xecd4('0x28')](respondWithResult(_0x527fab,null))[_0xecd4('0x49')](handleError(_0x527fab,null));};exports[_0xecd4('0x4e')]=function(_0x58281c,_0x36d75c){return db['Team']['create'](_0x58281c[_0xecd4('0x4f')],{})[_0xecd4('0x28')](function(_0xf70c1d){var _0x43bd91=_0x58281c[_0xecd4('0x50')]['get']({'plain':!![]});if(!_0x43bd91)throw new Error(_0xecd4('0x51'));if(_0x43bd91[_0xecd4('0x52')]===_0xecd4('0x50')){var _0x4344e4=_0xf70c1d[_0xecd4('0x29')]({'plain':!![]});var _0x589995='Teams';return db['UserProfileSection']['find']({'where':{'name':_0x589995,'userProfileId':_0x43bd91[_0xecd4('0x53')]},'raw':!![]})['then'](function(_0x1af2ab){if(_0x1af2ab&&_0x1af2ab[_0xecd4('0x54')]===0x0){return db[_0xecd4('0x2b')][_0xecd4('0x4e')]({'name':_0x4344e4['name'],'resourceId':_0x4344e4['id'],'type':_0x1af2ab[_0xecd4('0x2e')],'sectionId':_0x1af2ab['id']},{})[_0xecd4('0x28')](function(){return _0xf70c1d;});}else{return _0xf70c1d;}})[_0xecd4('0x49')](function(_0x12ec95){logger[_0xecd4('0x55')](_0xecd4('0x56'),_0x12ec95);throw _0x12ec95;});}return _0xf70c1d;})[_0xecd4('0x28')](respondWithResult(_0x36d75c,0xc9))['catch'](handleError(_0x36d75c,null));};exports[_0xecd4('0x27')]=function(_0x547688,_0x5c7fb2){if(_0x547688[_0xecd4('0x4f')]['id']){delete _0x547688[_0xecd4('0x4f')]['id'];}return db[_0xecd4('0x31')]['find']({'where':{'id':_0x547688[_0xecd4('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c7fb2,null))[_0xecd4('0x28')](saveUpdates(_0x547688['body'],null))[_0xecd4('0x28')](respondWithResult(_0x5c7fb2,null))[_0xecd4('0x49')](handleError(_0x5c7fb2,null));};exports['destroy']=function(_0x563973,_0x1a6bc9){return db['Team'][_0xecd4('0x4d')]({'where':{'id':_0x563973[_0xecd4('0x57')]['id']}})[_0xecd4('0x28')](handleEntityNotFound(_0x1a6bc9,null))['then'](removeEntity(_0x1a6bc9,null))[_0xecd4('0x49')](handleError(_0x1a6bc9,null));};exports[_0xecd4('0x58')]=function(_0x14907f,_0x145602,_0x526cc9){return db[_0xecd4('0x31')][_0xecd4('0x59')]({'where':{'id':_0x14907f[_0xecd4('0x57')]['id']}})[_0xecd4('0x28')](handleEntityNotFound(_0x145602,null))['then'](function(_0x374ce0){if(!_0x14907f['query'][_0xecd4('0x5a')]||!utils[_0xecd4('0x5b')](_0x14907f['query'][_0xecd4('0x5a')])){throw new db[(_0xecd4('0x5c'))][(_0xecd4('0x5d'))](_0xecd4('0x5e'));}var _0x55975a={};var _0x209dbe={};_0x209dbe[_0xecd4('0x36')]=_['keys'](db[_[_0xecd4('0x5f')](_0x14907f[_0xecd4('0x38')][_0xecd4('0x5a')][_0xecd4('0x60')]())+_0xecd4('0x61')][_0xecd4('0x32')]);_0x209dbe[_0xecd4('0x38')]=_[_0xecd4('0x39')](_0x14907f[_0xecd4('0x38')]);_0x209dbe[_0xecd4('0x42')]=_[_0xecd4('0x3a')](_0x209dbe[_0xecd4('0x36')],_0x209dbe[_0xecd4('0x38')]);_0x55975a['attributes']=_['intersection'](_0x209dbe[_0xecd4('0x36')],qs[_0xecd4('0x3b')](_0x14907f[_0xecd4('0x38')]['fields']));_0x55975a[_0xecd4('0x3d')]=_0x55975a[_0xecd4('0x3d')]['length']?_0x55975a['attributes']:_0x209dbe[_0xecd4('0x36')];_0x55975a[_0xecd4('0x22')]=qs[_0xecd4('0x22')](_0x14907f[_0xecd4('0x38')]['limit']);_0x55975a[_0xecd4('0x21')]=qs[_0xecd4('0x21')](_0x14907f[_0xecd4('0x38')][_0xecd4('0x21')]);_0x55975a[_0xecd4('0x3f')]=qs[_0xecd4('0x40')](_0x14907f['query'][_0xecd4('0x40')]);_0x55975a[_0xecd4('0x41')]=qs[_0xecd4('0x42')](_[_0xecd4('0x62')](_0x14907f[_0xecd4('0x38')],_0x209dbe[_0xecd4('0x42')]));_0x55975a=_[_0xecd4('0x44')]({},_0x55975a,_0x14907f[_0xecd4('0x4c')]);return _0x374ce0['get'+_[_0xecd4('0x5f')](_0x14907f[_0xecd4('0x38')][_0xecd4('0x5a')][_0xecd4('0x60')]())+'Queues'](_0x55975a);})['then'](respondWithResult(_0x145602,null))['catch'](handleError(_0x145602,null));};exports[_0xecd4('0x63')]=function(_0x26b5a1,_0x1ed8fb,_0x5de466){return db[_0xecd4('0x31')][_0xecd4('0x59')]({'where':{'id':_0x26b5a1[_0xecd4('0x57')]['id']}})[_0xecd4('0x28')](function(_0x56777b){if(_0x56777b){if(!_0x26b5a1[_0xecd4('0x4f')][_0xecd4('0x5a')]||!utils[_0xecd4('0x5b')](_0x26b5a1[_0xecd4('0x4f')][_0xecd4('0x5a')])){throw new db['Sequelize']['ValidationError'](_0xecd4('0x5e'));}return _0x56777b['add'+_[_0xecd4('0x5f')](_0x26b5a1['body'][_0xecd4('0x5a')][_0xecd4('0x60')]())+_0xecd4('0x64')](_0x26b5a1[_0xecd4('0x4f')][_0xecd4('0x65')]);}return null;})[_0xecd4('0x28')](handleEntityNotFound(_0x1ed8fb,null))['then'](respondWithStatusCode(_0x1ed8fb,null))[_0xecd4('0x49')](handleError(_0x1ed8fb,null));};exports[_0xecd4('0x66')]=function(_0x639098,_0x154a43,_0x2ca8d7){return db[_0xecd4('0x31')]['findOne']({'where':{'id':_0x639098[_0xecd4('0x57')]['id']}})[_0xecd4('0x28')](function(_0x41e2ed){if(_0x41e2ed){if(!_0x639098['query'][_0xecd4('0x5a')]||!utils[_0xecd4('0x5b')](_0x639098[_0xecd4('0x38')][_0xecd4('0x5a')])){throw new db[(_0xecd4('0x5c'))][(_0xecd4('0x5d'))](_0xecd4('0x5e'));}return _0x41e2ed[_0xecd4('0x67')+_[_0xecd4('0x5f')](_0x639098[_0xecd4('0x38')][_0xecd4('0x5a')][_0xecd4('0x60')]())+_0xecd4('0x64')](_0x639098[_0xecd4('0x38')][_0xecd4('0x65')]);}return null;})[_0xecd4('0x28')](handleEntityNotFound(_0x154a43,null))[_0xecd4('0x28')](respondWithStatusCode(_0x154a43,null))[_0xecd4('0x49')](handleError(_0x154a43,null));};exports[_0xecd4('0x68')]=function(_0x8ffd7,_0x193cef){return db[_0xecd4('0x31')][_0xecd4('0x4d')]({'where':{'id':_0x8ffd7['params']['id']}})[_0xecd4('0x28')](handleEntityNotFound(_0x193cef,null))[_0xecd4('0x28')](function(_0x32e6df){if(_0x32e6df){var _0x3782d7=[_0xecd4('0x69'),_0xecd4('0x6a'),'Mail','Sms',_0xecd4('0x6b'),_0xecd4('0x6c'),_0xecd4('0x6d')];return db[_0xecd4('0x6e')][_0xecd4('0x6f')](function(_0x5b3a6c){var _0x280ac7=_[_0xecd4('0x37')](_0x3782d7,function(_0x2b6537){var _0x50e9c8={'attributes':['id','name']};if(_0x2b6537==='Voice'){_0x50e9c8['through']={'attributes':[_0xecd4('0x70')]};}return _0x32e6df['get'+_0x2b6537+_0xecd4('0x64')](_0x50e9c8)[_0xecd4('0x28')](function(_0x245702){var _0x539e0e=_[_0xecd4('0x37')](_0x245702,function(_0x21d290){var _0x838c6e=_[_0xecd4('0x37')](_0x8ffd7[_0xecd4('0x4f')][_0xecd4('0x65')],function(_0x47ade6){var _0x4b1345={'where':{'UserId':_0x47ade6,[_0x2b6537+_0xecd4('0x71')]:_0x21d290['id']},'transaction':_0x5b3a6c};if(_0x2b6537==='Voice'){_0x4b1345[_0xecd4('0x18')]={'penalty':_0x21d290[_0xecd4('0x72')][_0xecd4('0x70')]};}return db[_0xecd4('0x73')+_0x2b6537+_0xecd4('0x61')][_0xecd4('0x74')](_0x4b1345)[_0xecd4('0x28')](function(){socket['emit'](_0xecd4('0x50')+_0x2b6537+_0xecd4('0x75'),{'UserId':_0x47ade6,[_0x2b6537+_0xecd4('0x71')]:_0x21d290['id']});if(_0x2b6537!==_0xecd4('0x69'))return;return db[_0xecd4('0x73')][_0xecd4('0x47')]({'where':{'id':_0x8ffd7[_0xecd4('0x4f')][_0xecd4('0x65')],'online':0x1},'attributes':['id',_0xecd4('0x2e'),_0xecd4('0x76'),_0xecd4('0x77'),'interface'],'raw':!![]})[_0xecd4('0x28')](function(_0x387447){var _0x2b4546=_[_0xecd4('0x37')](_0x387447,function(_0x3be776){return db['UserVoiceQueueRt'][_0xecd4('0x78')]({'membername':_0x3be776[_0xecd4('0x2e')],'UserId':_0x3be776['id'],'queue_name':_0x21d290[_0xecd4('0x2e')],'VoiceQueueId':_0x21d290['id'],'interface':_[_0xecd4('0x79')](_0x3be776[_0xecd4('0x7a')])?util[_0xecd4('0x7b')](_0xecd4('0x7c'),_0x3be776['name']):_0x3be776['interface'],'paused':_0x3be776[_0xecd4('0x77')]||![],'penalty':_0x21d290['TeamVoiceQueue']['penalty']},{'transaction':_0x5b3a6c});});return Promise[_0xecd4('0x7d')](_0x2b4546);});});});return Promise[_0xecd4('0x7d')](_0x838c6e);});return Promise[_0xecd4('0x7d')](_0x539e0e);});});return Promise['all'](_0x280ac7)['then'](function(){return _0x32e6df[_0xecd4('0x68')](_0x8ffd7[_0xecd4('0x4f')][_0xecd4('0x65')],{'transaction':_0x5b3a6c})[_0xecd4('0x7e')](function(_0x17ea7d){return _0x17ea7d;});});});}})[_0xecd4('0x28')](respondWithResult(_0x193cef,null))[_0xecd4('0x49')](handleError(_0x193cef,null));};exports[_0xecd4('0x7f')]=function(_0x3d75af,_0x46a9d5){return db['Team'][_0xecd4('0x4d')]({'where':{'id':_0x3d75af[_0xecd4('0x57')]['id']}})[_0xecd4('0x28')](handleEntityNotFound(_0x46a9d5,null))[_0xecd4('0x28')](function(_0x418a94){if(_0x418a94){var _0x2d4560=['Voice',_0xecd4('0x6a'),_0xecd4('0x80'),'Sms','Fax',_0xecd4('0x6c'),_0xecd4('0x6d')];return db['sequelize']['transaction'](function(_0x2ffc32){var _0x18888e=_[_0xecd4('0x37')](_0x2d4560,function(_0x3ee751){var _0x4240ad={'attributes':['id','name']};return _0x418a94[_0xecd4('0x29')+_0x3ee751+_0xecd4('0x64')](_0x4240ad)[_0xecd4('0x28')](function(_0x174591){var _0x2f6b92=_[_0xecd4('0x37')](_0x174591,function(_0xbefb6a){return _0xbefb6a['removeAgents'](_0x3d75af[_0xecd4('0x38')][_0xecd4('0x65')],{'transaction':_0x2ffc32})[_0xecd4('0x28')](function(){var _0x4e6459=JSON[_0xecd4('0x81')]('['+_0x3d75af['query']['ids']+']');var _0x24a991=_['map'](_0x4e6459,function(_0x2fab9a){socket[_0xecd4('0x82')](_0xecd4('0x50')+_0x3ee751+_0xecd4('0x83'),{'UserId':Number(_0x2fab9a),[_0x3ee751+'QueueId']:_0xbefb6a['id']});if(_0x3ee751!=='Voice')return;return db[_0xecd4('0x84')][_0xecd4('0x2c')]({'where':{'VoiceQueueId':_0xbefb6a['id'],'UserId':_0x2fab9a},'transaction':_0x2ffc32});});return Promise[_0xecd4('0x7d')](_0x24a991);});});return Promise[_0xecd4('0x7d')](_0x2f6b92);});});return Promise[_0xecd4('0x7d')](_0x18888e)[_0xecd4('0x28')](function(){return _0x418a94[_0xecd4('0x7f')](_0x3d75af['query'][_0xecd4('0x65')],{'transaction':_0x2ffc32});});});}})[_0xecd4('0x28')](respondWithStatusCode(_0x46a9d5,null))[_0xecd4('0x49')](handleError(_0x46a9d5,null));};exports['getAgents']=function(_0x3c2a56,_0x2dfde3,_0x3afffe){var _0x1b7ccd={};var _0x5f228a={};var _0x16f50a;var _0x27ae1e;return db[_0xecd4('0x31')][_0xecd4('0x59')]({'where':{'id':_0x3c2a56[_0xecd4('0x57')]['id']}})[_0xecd4('0x28')](handleEntityNotFound(_0x2dfde3,null))[_0xecd4('0x28')](function(_0x8ab7d8){if(_0x8ab7d8){_0x16f50a=_0x8ab7d8;_0x5f228a[_0xecd4('0x36')]=_['keys'](db['User']['rawAttributes']);_0x5f228a[_0xecd4('0x38')]=_[_0xecd4('0x39')](_0x3c2a56[_0xecd4('0x38')]);_0x5f228a[_0xecd4('0x42')]=_[_0xecd4('0x3a')](_0x5f228a[_0xecd4('0x36')],_0x5f228a[_0xecd4('0x38')]);_0x1b7ccd['attributes']=_[_0xecd4('0x3a')](_0x5f228a['model'],qs[_0xecd4('0x3b')](_0x3c2a56[_0xecd4('0x38')][_0xecd4('0x3b')]));_0x1b7ccd[_0xecd4('0x3d')]=_0x1b7ccd[_0xecd4('0x3d')][_0xecd4('0x3c')]?_0x1b7ccd[_0xecd4('0x3d')]:_0x5f228a[_0xecd4('0x36')];_0x1b7ccd['order']=qs['sort'](_0x3c2a56[_0xecd4('0x38')][_0xecd4('0x40')]);_0x1b7ccd['where']=qs[_0xecd4('0x42')](_[_0xecd4('0x62')](_0x3c2a56[_0xecd4('0x38')],_0x5f228a[_0xecd4('0x42')]));if(_0x3c2a56['query'][_0xecd4('0x43')]){_0x1b7ccd[_0xecd4('0x41')]=_['merge'](_0x1b7ccd[_0xecd4('0x41')],{'$or':_[_0xecd4('0x37')](_0x1b7ccd[_0xecd4('0x3d')],function(_0x57b884){var _0x2b67ba={};_0x2b67ba[_0x57b884]={'$like':'%'+_0x3c2a56['query'][_0xecd4('0x43')]+'%'};return _0x2b67ba;})});}_0x1b7ccd=_[_0xecd4('0x44')]({},_0x1b7ccd,_0x3c2a56['options']);return _0x16f50a[_0xecd4('0x85')](_0x1b7ccd);}})[_0xecd4('0x28')](function(_0x5ba44e){if(_0x5ba44e){_0x27ae1e=_0x5ba44e[_0xecd4('0x3c')];if(!_0x3c2a56['query'][_0xecd4('0x86')](_0xecd4('0x3e'))){_0x1b7ccd[_0xecd4('0x22')]=qs['limit'](_0x3c2a56[_0xecd4('0x38')][_0xecd4('0x22')]);_0x1b7ccd[_0xecd4('0x21')]=qs[_0xecd4('0x21')](_0x3c2a56[_0xecd4('0x38')][_0xecd4('0x21')]);}return _0x16f50a[_0xecd4('0x85')](_0x1b7ccd);}})[_0xecd4('0x28')](function(_0x10336e){if(_0x10336e){return _0x10336e?{'count':_0x27ae1e,'rows':_0x10336e}:null;}})[_0xecd4('0x28')](respondWithResult(_0x2dfde3,null))[_0xecd4('0x49')](handleError(_0x2dfde3,null));}; \ No newline at end of file +var _0xa9e5=['spread','removeAgents','Mail','Openchannel','parse','Queue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','get','error','stack','name','send','index','Team','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','rows','catch','keys','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','getQueues','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queue','options','Queues','addQueues','findOne','Unknown\x20channel','remove','ids','addAgents','Sms','Fax','Whatsapp','sequelize','transaction','Voice','penalty','QueueId','User','findOrCreate','emit','Queue:save','interface','UserVoiceQueueRt','isNil','SIP/%s','voicePause','all'];(function(_0x21d5ce,_0x1badf0){var _0x4f8435=function(_0x2a7b27){while(--_0x2a7b27){_0x21d5ce['push'](_0x21d5ce['shift']());}};_0x4f8435(++_0x1badf0);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x8494a6,_0x3c498a){_0x8494a6=_0x8494a6-0x0;var _0x4b44ef=_0xa9e5[_0x8494a6];return _0x4b44ef;};'use strict';var pdf=require(_0x5a9e('0x0'));var emlformat=require(_0x5a9e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5a9e('0x2'));var jsonpatch=require(_0x5a9e('0x3'));var rp=require(_0x5a9e('0x4'));var moment=require(_0x5a9e('0x5'));var BPromise=require(_0x5a9e('0x6'));var Mustache=require(_0x5a9e('0x7'));var util=require(_0x5a9e('0x8'));var path=require(_0x5a9e('0x9'));var sox=require(_0x5a9e('0xa'));var csv=require(_0x5a9e('0xb'));var ejs=require(_0x5a9e('0xc'));var fs=require('fs');var fs_extra=require(_0x5a9e('0xd'));var _=require(_0x5a9e('0xe'));var squel=require(_0x5a9e('0xf'));var crypto=require('crypto');var jsforce=require(_0x5a9e('0x10'));var deskjs=require(_0x5a9e('0x11'));var toCsv=require(_0x5a9e('0xb'));var querystring=require(_0x5a9e('0x12'));var Papa=require('papaparse');var Redis=require(_0x5a9e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5a9e('0x14'));var as=require(_0x5a9e('0x15'));var hardwareService=require(_0x5a9e('0x16'));var logger=require(_0x5a9e('0x17'))(_0x5a9e('0x18'));var utils=require(_0x5a9e('0x19'));var config=require(_0x5a9e('0x1a'));var licenseUtil=require(_0x5a9e('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5a9e('0x1c')](config[_0x5a9e('0x1d')],{'host':_0x5a9e('0x1e'),'port':0x18eb});var socket=require(_0x5a9e('0x1f'))(new Redis(config['redis']));require(_0x5a9e('0x20'))['register'](socket);function respondWithStatusCode(_0x8e9e63,_0x298236){_0x298236=_0x298236||0xcc;return function(_0x526a10){if(_0x526a10){return _0x8e9e63[_0x5a9e('0x21')](_0x298236);}return _0x8e9e63[_0x5a9e('0x22')](_0x298236)[_0x5a9e('0x23')]();};}function respondWithResult(_0x2e9dd4,_0x6eb39c){_0x6eb39c=_0x6eb39c||0xc8;return function(_0x732c43){if(_0x732c43){return _0x2e9dd4[_0x5a9e('0x22')](_0x6eb39c)[_0x5a9e('0x24')](_0x732c43);}};}function respondWithFilteredResult(_0x54dee9,_0x4e3b60){return function(_0x24f639){if(_0x24f639){var _0x326b61=_0x24f639[_0x5a9e('0x25')],_0xadf203=_0x4e3b60[_0x5a9e('0x26')],_0x555e69=_0x4e3b60[_0x5a9e('0x26')]+_0x4e3b60[_0x5a9e('0x27')],_0x457c3b;if(_0x555e69>=_0x326b61){_0x555e69=_0x326b61;_0x457c3b=0xc8;}else{_0x457c3b=0xce;}_0x54dee9['status'](_0x457c3b);return _0x54dee9[_0x5a9e('0x28')](_0x5a9e('0x29'),_0xadf203+'-'+_0x555e69+'/'+_0x326b61)[_0x5a9e('0x24')](_0x24f639);}return null;};}function patchUpdates(_0x40bff7){return function(_0x4bb589){try{jsonpatch[_0x5a9e('0x2a')](_0x4bb589,_0x40bff7,!![]);}catch(_0x1b34aa){return BPromise[_0x5a9e('0x2b')](_0x1b34aa);}return _0x4bb589['save']();};}function saveUpdates(_0x5659a4,_0xa76768){return function(_0x35aec2){if(_0x35aec2){return _0x35aec2['update'](_0x5659a4)['then'](function(_0x3f8e00){return _0x3f8e00;});}return null;};}function removeEntity(_0x60c8a0,_0xfb4173){return function(_0x3e72a9){if(_0x3e72a9){return _0x3e72a9[_0x5a9e('0x2c')]()[_0x5a9e('0x2d')](function(){var _0x4f5c58=_0x3e72a9[_0x5a9e('0x2e')]({'plain':!![]});var _0x1d3807='Teams';return db['UserProfileResource'][_0x5a9e('0x2c')]({'where':{'type':_0x1d3807,'resourceId':_0x4f5c58['id']}})[_0x5a9e('0x2d')](function(){return _0x3e72a9;});})['then'](function(){_0x60c8a0[_0x5a9e('0x22')](0xcc)[_0x5a9e('0x23')]();});}};}function handleEntityNotFound(_0x2448e7,_0x345c60){return function(_0x3163ae){if(!_0x3163ae){_0x2448e7[_0x5a9e('0x21')](0x194);}return _0x3163ae;};}function handleError(_0x303b3f,_0x170e9f){_0x170e9f=_0x170e9f||0x1f4;return function(_0x5177fb){logger[_0x5a9e('0x2f')](_0x5177fb[_0x5a9e('0x30')]);if(_0x5177fb[_0x5a9e('0x31')]){delete _0x5177fb[_0x5a9e('0x31')];}_0x303b3f[_0x5a9e('0x22')](_0x170e9f)[_0x5a9e('0x32')](_0x5177fb);};}exports[_0x5a9e('0x33')]=function(_0x31334c,_0x531f33){var _0xbc160c={},_0x3d4659={},_0x4823fd={'count':0x0,'rows':[]};var _0x326787=_['map'](db[_0x5a9e('0x34')][_0x5a9e('0x35')],function(_0xa3557b){return{'name':_0xa3557b[_0x5a9e('0x36')],'type':_0xa3557b[_0x5a9e('0x37')]['key']};});_0x3d4659[_0x5a9e('0x38')]=_[_0x5a9e('0x39')](_0x326787,_0x5a9e('0x31'));_0x3d4659[_0x5a9e('0x3a')]=_['keys'](_0x31334c[_0x5a9e('0x3a')]);_0x3d4659[_0x5a9e('0x3b')]=_[_0x5a9e('0x3c')](_0x3d4659[_0x5a9e('0x38')],_0x3d4659[_0x5a9e('0x3a')]);_0xbc160c[_0x5a9e('0x3d')]=_[_0x5a9e('0x3c')](_0x3d4659[_0x5a9e('0x38')],qs[_0x5a9e('0x3e')](_0x31334c[_0x5a9e('0x3a')][_0x5a9e('0x3e')]));_0xbc160c[_0x5a9e('0x3d')]=_0xbc160c[_0x5a9e('0x3d')][_0x5a9e('0x3f')]?_0xbc160c[_0x5a9e('0x3d')]:_0x3d4659['model'];if(!_0x31334c[_0x5a9e('0x3a')][_0x5a9e('0x40')](_0x5a9e('0x41'))){_0xbc160c[_0x5a9e('0x27')]=qs[_0x5a9e('0x27')](_0x31334c['query']['limit']);_0xbc160c[_0x5a9e('0x26')]=qs[_0x5a9e('0x26')](_0x31334c['query'][_0x5a9e('0x26')]);}_0xbc160c[_0x5a9e('0x42')]=qs[_0x5a9e('0x43')](_0x31334c[_0x5a9e('0x3a')][_0x5a9e('0x43')]);_0xbc160c[_0x5a9e('0x44')]=qs[_0x5a9e('0x3b')](_[_0x5a9e('0x45')](_0x31334c[_0x5a9e('0x3a')],_0x3d4659[_0x5a9e('0x3b')]),_0x326787);if(_0x31334c['query'][_0x5a9e('0x46')]){_0xbc160c[_0x5a9e('0x44')]=_[_0x5a9e('0x47')](_0xbc160c[_0x5a9e('0x44')],{'$or':_[_0x5a9e('0x39')](_0x326787,function(_0x306a18){if(_0x306a18['type']!=='VIRTUAL'){var _0x4c3a59={};_0x4c3a59[_0x306a18[_0x5a9e('0x31')]]={'$like':'%'+_0x31334c[_0x5a9e('0x3a')][_0x5a9e('0x46')]+'%'};return _0x4c3a59;}})});}_0xbc160c=_[_0x5a9e('0x47')]({},_0xbc160c,_0x31334c['options']);var _0x254878={'where':_0xbc160c[_0x5a9e('0x44')]};return db[_0x5a9e('0x34')][_0x5a9e('0x25')](_0x254878)['then'](function(_0x155bda){_0x4823fd[_0x5a9e('0x25')]=_0x155bda;if(_0x31334c[_0x5a9e('0x3a')]['includeAll']){_0xbc160c['include']=[{'all':!![]}];}return db[_0x5a9e('0x34')][_0x5a9e('0x48')](_0xbc160c);})[_0x5a9e('0x2d')](function(_0x20a808){_0x4823fd[_0x5a9e('0x49')]=_0x20a808;return _0x4823fd;})[_0x5a9e('0x2d')](respondWithFilteredResult(_0x531f33,_0xbc160c))[_0x5a9e('0x4a')](handleError(_0x531f33,null));};exports['show']=function(_0x3c0220,_0x3237a1){var _0x2f9ae6={'raw':![],'where':{'id':_0x3c0220['params']['id']}},_0x3a1088={};_0x3a1088[_0x5a9e('0x38')]=_[_0x5a9e('0x4b')](db[_0x5a9e('0x34')][_0x5a9e('0x35')]);_0x3a1088['query']=_[_0x5a9e('0x4b')](_0x3c0220['query']);_0x3a1088[_0x5a9e('0x3b')]=_['intersection'](_0x3a1088['model'],_0x3a1088[_0x5a9e('0x3a')]);_0x2f9ae6[_0x5a9e('0x3d')]=_[_0x5a9e('0x3c')](_0x3a1088['model'],qs[_0x5a9e('0x3e')](_0x3c0220[_0x5a9e('0x3a')][_0x5a9e('0x3e')]));_0x2f9ae6[_0x5a9e('0x3d')]=_0x2f9ae6['attributes'][_0x5a9e('0x3f')]?_0x2f9ae6[_0x5a9e('0x3d')]:_0x3a1088[_0x5a9e('0x38')];if(_0x3c0220['query'][_0x5a9e('0x4c')]){_0x2f9ae6[_0x5a9e('0x4d')]=[{'all':!![]}];}_0x2f9ae6=_[_0x5a9e('0x47')]({},_0x2f9ae6,_0x3c0220['options']);return db[_0x5a9e('0x34')][_0x5a9e('0x4e')](_0x2f9ae6)[_0x5a9e('0x2d')](handleEntityNotFound(_0x3237a1,null))['then'](respondWithResult(_0x3237a1,null))[_0x5a9e('0x4a')](handleError(_0x3237a1,null));};exports[_0x5a9e('0x4f')]=function(_0x550bc9,_0x29e9be){return db['Team']['create'](_0x550bc9['body'],{})['then'](function(_0x196fc2){var _0xa95c14=_0x550bc9[_0x5a9e('0x50')]['get']({'plain':!![]});if(!_0xa95c14)throw new Error(_0x5a9e('0x51'));if(_0xa95c14['role']==='user'){var _0x40a547=_0x196fc2[_0x5a9e('0x2e')]({'plain':!![]});var _0x4a39b7=_0x5a9e('0x52');return db[_0x5a9e('0x53')][_0x5a9e('0x4e')]({'where':{'name':_0x4a39b7,'userProfileId':_0xa95c14[_0x5a9e('0x54')]},'raw':!![]})[_0x5a9e('0x2d')](function(_0x83f42a){if(_0x83f42a&&_0x83f42a[_0x5a9e('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x40a547['name'],'resourceId':_0x40a547['id'],'type':_0x83f42a[_0x5a9e('0x31')],'sectionId':_0x83f42a['id']},{})['then'](function(){return _0x196fc2;});}else{return _0x196fc2;}})[_0x5a9e('0x4a')](function(_0x3598ad){logger[_0x5a9e('0x2f')](_0x5a9e('0x56'),_0x3598ad);throw _0x3598ad;});}return _0x196fc2;})[_0x5a9e('0x2d')](respondWithResult(_0x29e9be,0xc9))[_0x5a9e('0x4a')](handleError(_0x29e9be,null));};exports[_0x5a9e('0x57')]=function(_0x3a33c2,_0x3cb75f){if(_0x3a33c2[_0x5a9e('0x58')]['id']){delete _0x3a33c2[_0x5a9e('0x58')]['id'];}return db[_0x5a9e('0x34')][_0x5a9e('0x4e')]({'where':{'id':_0x3a33c2['params']['id']}})[_0x5a9e('0x2d')](handleEntityNotFound(_0x3cb75f,null))[_0x5a9e('0x2d')](saveUpdates(_0x3a33c2[_0x5a9e('0x58')],null))[_0x5a9e('0x2d')](respondWithResult(_0x3cb75f,null))[_0x5a9e('0x4a')](handleError(_0x3cb75f,null));};exports[_0x5a9e('0x2c')]=function(_0x3f748,_0x5a0338){return db['Team'][_0x5a9e('0x4e')]({'where':{'id':_0x3f748[_0x5a9e('0x59')]['id']}})[_0x5a9e('0x2d')](handleEntityNotFound(_0x5a0338,null))[_0x5a9e('0x2d')](removeEntity(_0x5a0338,null))['catch'](handleError(_0x5a0338,null));};exports[_0x5a9e('0x5a')]=function(_0x1683cd,_0x33435a,_0x43cbd7){return db[_0x5a9e('0x34')]['findOne']({'where':{'id':_0x1683cd[_0x5a9e('0x59')]['id']}})[_0x5a9e('0x2d')](handleEntityNotFound(_0x33435a,null))[_0x5a9e('0x2d')](function(_0x15dfb8){if(!_0x1683cd[_0x5a9e('0x3a')][_0x5a9e('0x5b')]||!utils[_0x5a9e('0x5c')](_0x1683cd['query']['channel'])){throw new db[(_0x5a9e('0x5d'))][(_0x5a9e('0x5e'))]('Unknown\x20channel');}var _0x48ea89={};var _0x2abdac={};_0x2abdac[_0x5a9e('0x38')]=_[_0x5a9e('0x4b')](db[_[_0x5a9e('0x5f')](_0x1683cd['query'][_0x5a9e('0x5b')][_0x5a9e('0x60')]())+_0x5a9e('0x61')]['rawAttributes']);_0x2abdac[_0x5a9e('0x3a')]=_[_0x5a9e('0x4b')](_0x1683cd['query']);_0x2abdac['filters']=_['intersection'](_0x2abdac['model'],_0x2abdac[_0x5a9e('0x3a')]);_0x48ea89[_0x5a9e('0x3d')]=_[_0x5a9e('0x3c')](_0x2abdac[_0x5a9e('0x38')],qs[_0x5a9e('0x3e')](_0x1683cd[_0x5a9e('0x3a')][_0x5a9e('0x3e')]));_0x48ea89[_0x5a9e('0x3d')]=_0x48ea89[_0x5a9e('0x3d')][_0x5a9e('0x3f')]?_0x48ea89[_0x5a9e('0x3d')]:_0x2abdac['model'];_0x48ea89['limit']=qs[_0x5a9e('0x27')](_0x1683cd[_0x5a9e('0x3a')][_0x5a9e('0x27')]);_0x48ea89[_0x5a9e('0x26')]=qs[_0x5a9e('0x26')](_0x1683cd[_0x5a9e('0x3a')][_0x5a9e('0x26')]);_0x48ea89[_0x5a9e('0x42')]=qs['sort'](_0x1683cd[_0x5a9e('0x3a')][_0x5a9e('0x43')]);_0x48ea89[_0x5a9e('0x44')]=qs[_0x5a9e('0x3b')](_[_0x5a9e('0x45')](_0x1683cd[_0x5a9e('0x3a')],_0x2abdac[_0x5a9e('0x3b')]));_0x48ea89=_[_0x5a9e('0x47')]({},_0x48ea89,_0x1683cd[_0x5a9e('0x62')]);return _0x15dfb8[_0x5a9e('0x2e')+_[_0x5a9e('0x5f')](_0x1683cd[_0x5a9e('0x3a')][_0x5a9e('0x5b')][_0x5a9e('0x60')]())+_0x5a9e('0x63')](_0x48ea89);})[_0x5a9e('0x2d')](respondWithResult(_0x33435a,null))['catch'](handleError(_0x33435a,null));};exports[_0x5a9e('0x64')]=function(_0xbbb9ea,_0x152bea,_0x37b788){return db['Team'][_0x5a9e('0x65')]({'where':{'id':_0xbbb9ea[_0x5a9e('0x59')]['id']}})['then'](function(_0x359cba){if(_0x359cba){if(!_0xbbb9ea[_0x5a9e('0x58')][_0x5a9e('0x5b')]||!utils[_0x5a9e('0x5c')](_0xbbb9ea[_0x5a9e('0x58')]['channel'])){throw new db[(_0x5a9e('0x5d'))][(_0x5a9e('0x5e'))](_0x5a9e('0x66'));}return _0x359cba['add'+_['capitalize'](_0xbbb9ea[_0x5a9e('0x58')][_0x5a9e('0x5b')]['toLowerCase']())+'Queues'](_0xbbb9ea[_0x5a9e('0x58')]['ids']);}return null;})[_0x5a9e('0x2d')](handleEntityNotFound(_0x152bea,null))[_0x5a9e('0x2d')](respondWithStatusCode(_0x152bea,null))['catch'](handleError(_0x152bea,null));};exports['removeQueues']=function(_0x5a7395,_0x334377,_0x212fbe){return db[_0x5a9e('0x34')]['findOne']({'where':{'id':_0x5a7395[_0x5a9e('0x59')]['id']}})[_0x5a9e('0x2d')](function(_0x4e1d24){if(_0x4e1d24){if(!_0x5a7395['query']['channel']||!utils[_0x5a9e('0x5c')](_0x5a7395[_0x5a9e('0x3a')][_0x5a9e('0x5b')])){throw new db[(_0x5a9e('0x5d'))]['ValidationError'](_0x5a9e('0x66'));}return _0x4e1d24[_0x5a9e('0x67')+_['capitalize'](_0x5a7395['query'][_0x5a9e('0x5b')][_0x5a9e('0x60')]())+_0x5a9e('0x63')](_0x5a7395[_0x5a9e('0x3a')][_0x5a9e('0x68')]);}return null;})[_0x5a9e('0x2d')](handleEntityNotFound(_0x334377,null))[_0x5a9e('0x2d')](respondWithStatusCode(_0x334377,null))[_0x5a9e('0x4a')](handleError(_0x334377,null));};exports[_0x5a9e('0x69')]=function(_0xc290b5,_0x3b67c7){return db[_0x5a9e('0x34')][_0x5a9e('0x4e')]({'where':{'id':_0xc290b5[_0x5a9e('0x59')]['id']}})[_0x5a9e('0x2d')](handleEntityNotFound(_0x3b67c7,null))['then'](function(_0x1bfac9){if(_0x1bfac9){var _0xb827d5=['Voice','Chat','Mail',_0x5a9e('0x6a'),_0x5a9e('0x6b'),'Openchannel',_0x5a9e('0x6c')];return db[_0x5a9e('0x6d')][_0x5a9e('0x6e')](function(_0x1a341c){var _0x29a631=_['map'](_0xb827d5,function(_0xee3c16){var _0x1fc509={'attributes':['id',_0x5a9e('0x31')]};if(_0xee3c16===_0x5a9e('0x6f')){_0x1fc509['through']={'attributes':[_0x5a9e('0x70')]};}return _0x1bfac9['get'+_0xee3c16+_0x5a9e('0x63')](_0x1fc509)[_0x5a9e('0x2d')](function(_0x63d7ef){var _0xafb32e=_['map'](_0x63d7ef,function(_0x3543ed){var _0x5d7648=_[_0x5a9e('0x39')](_0xc290b5[_0x5a9e('0x58')]['ids'],function(_0x388cd0){var _0x15e912={'where':{'UserId':_0x388cd0,[_0xee3c16+_0x5a9e('0x71')]:_0x3543ed['id']},'transaction':_0x1a341c};if(_0xee3c16===_0x5a9e('0x6f')){_0x15e912[_0x5a9e('0x1c')]={'penalty':_0x3543ed['TeamVoiceQueue']['penalty']};}return db[_0x5a9e('0x72')+_0xee3c16+_0x5a9e('0x61')][_0x5a9e('0x73')](_0x15e912)[_0x5a9e('0x2d')](function(){socket[_0x5a9e('0x74')](_0x5a9e('0x50')+_0xee3c16+_0x5a9e('0x75'),{'UserId':_0x388cd0,[_0xee3c16+_0x5a9e('0x71')]:_0x3543ed['id']});if(_0xee3c16!=='Voice')return;return db[_0x5a9e('0x72')][_0x5a9e('0x48')]({'where':{'id':_0xc290b5[_0x5a9e('0x58')]['ids'],'online':0x1},'attributes':['id','name','online','voicePause',_0x5a9e('0x76')],'raw':!![]})[_0x5a9e('0x2d')](function(_0x14e0f7){var _0x39f104=_[_0x5a9e('0x39')](_0x14e0f7,function(_0x493485){return db[_0x5a9e('0x77')]['upsert']({'membername':_0x493485[_0x5a9e('0x31')],'UserId':_0x493485['id'],'queue_name':_0x3543ed[_0x5a9e('0x31')],'VoiceQueueId':_0x3543ed['id'],'interface':_[_0x5a9e('0x78')](_0x493485[_0x5a9e('0x76')])?util['format'](_0x5a9e('0x79'),_0x493485[_0x5a9e('0x31')]):_0x493485[_0x5a9e('0x76')],'paused':_0x493485[_0x5a9e('0x7a')]||![],'penalty':_0x3543ed['TeamVoiceQueue'][_0x5a9e('0x70')]},{'transaction':_0x1a341c});});return Promise[_0x5a9e('0x7b')](_0x39f104);});});});return Promise[_0x5a9e('0x7b')](_0x5d7648);});return Promise[_0x5a9e('0x7b')](_0xafb32e);});});return Promise[_0x5a9e('0x7b')](_0x29a631)[_0x5a9e('0x2d')](function(){return _0x1bfac9[_0x5a9e('0x69')](_0xc290b5['body'][_0x5a9e('0x68')],{'transaction':_0x1a341c})[_0x5a9e('0x7c')](function(_0x17042c){return _0x17042c;});});});}})[_0x5a9e('0x2d')](respondWithResult(_0x3b67c7,null))[_0x5a9e('0x4a')](handleError(_0x3b67c7,null));};exports[_0x5a9e('0x7d')]=function(_0x4bd4e4,_0x25b8b1){return db[_0x5a9e('0x34')][_0x5a9e('0x4e')]({'where':{'id':_0x4bd4e4['params']['id']}})['then'](handleEntityNotFound(_0x25b8b1,null))['then'](function(_0x155f18){if(_0x155f18){var _0x3d4319=[_0x5a9e('0x6f'),'Chat',_0x5a9e('0x7e'),'Sms',_0x5a9e('0x6b'),_0x5a9e('0x7f'),_0x5a9e('0x6c')];return db['sequelize'][_0x5a9e('0x6e')](function(_0x483197){var _0x1ac111=_[_0x5a9e('0x39')](_0x3d4319,function(_0x4b34a1){var _0x3f700d={'attributes':['id',_0x5a9e('0x31')]};return _0x155f18['get'+_0x4b34a1+_0x5a9e('0x63')](_0x3f700d)[_0x5a9e('0x2d')](function(_0x583f0e){var _0x4a730c=_[_0x5a9e('0x39')](_0x583f0e,function(_0x18cbdf){return _0x18cbdf[_0x5a9e('0x7d')](_0x4bd4e4['query'][_0x5a9e('0x68')],{'transaction':_0x483197})[_0x5a9e('0x2d')](function(){var _0xb1c78c=JSON[_0x5a9e('0x80')]('['+_0x4bd4e4[_0x5a9e('0x3a')][_0x5a9e('0x68')]+']');var _0x27e6a0=_[_0x5a9e('0x39')](_0xb1c78c,function(_0x1d75b7){socket[_0x5a9e('0x74')](_0x5a9e('0x50')+_0x4b34a1+_0x5a9e('0x81'),{'UserId':Number(_0x1d75b7),[_0x4b34a1+_0x5a9e('0x71')]:_0x18cbdf['id']});if(_0x4b34a1!==_0x5a9e('0x6f'))return;return db[_0x5a9e('0x77')][_0x5a9e('0x2c')]({'where':{'VoiceQueueId':_0x18cbdf['id'],'UserId':_0x1d75b7},'transaction':_0x483197});});return Promise[_0x5a9e('0x7b')](_0x27e6a0);});});return Promise[_0x5a9e('0x7b')](_0x4a730c);});});return Promise[_0x5a9e('0x7b')](_0x1ac111)[_0x5a9e('0x2d')](function(){return _0x155f18[_0x5a9e('0x7d')](_0x4bd4e4[_0x5a9e('0x3a')][_0x5a9e('0x68')],{'transaction':_0x483197});});});}})[_0x5a9e('0x2d')](respondWithStatusCode(_0x25b8b1,null))[_0x5a9e('0x4a')](handleError(_0x25b8b1,null));};exports['getAgents']=function(_0x3514cb,_0x7934ab,_0x56f418){var _0x2a3914={};var _0x1846b4={};var _0x27e88d;var _0x5c5a3f;return db['Team'][_0x5a9e('0x65')]({'where':{'id':_0x3514cb['params']['id']}})['then'](handleEntityNotFound(_0x7934ab,null))[_0x5a9e('0x2d')](function(_0x4c53ac){if(_0x4c53ac){_0x27e88d=_0x4c53ac;_0x1846b4['model']=_[_0x5a9e('0x4b')](db[_0x5a9e('0x72')][_0x5a9e('0x35')]);_0x1846b4[_0x5a9e('0x3a')]=_[_0x5a9e('0x4b')](_0x3514cb[_0x5a9e('0x3a')]);_0x1846b4[_0x5a9e('0x3b')]=_[_0x5a9e('0x3c')](_0x1846b4['model'],_0x1846b4['query']);_0x2a3914[_0x5a9e('0x3d')]=_[_0x5a9e('0x3c')](_0x1846b4[_0x5a9e('0x38')],qs[_0x5a9e('0x3e')](_0x3514cb['query']['fields']));_0x2a3914[_0x5a9e('0x3d')]=_0x2a3914[_0x5a9e('0x3d')]['length']?_0x2a3914[_0x5a9e('0x3d')]:_0x1846b4[_0x5a9e('0x38')];_0x2a3914['order']=qs['sort'](_0x3514cb[_0x5a9e('0x3a')][_0x5a9e('0x43')]);_0x2a3914[_0x5a9e('0x44')]=qs['filters'](_[_0x5a9e('0x45')](_0x3514cb[_0x5a9e('0x3a')],_0x1846b4['filters']));if(_0x3514cb[_0x5a9e('0x3a')][_0x5a9e('0x46')]){_0x2a3914[_0x5a9e('0x44')]=_['merge'](_0x2a3914[_0x5a9e('0x44')],{'$or':_[_0x5a9e('0x39')](_0x2a3914[_0x5a9e('0x3d')],function(_0x2e656c){var _0x40a464={};_0x40a464[_0x2e656c]={'$like':'%'+_0x3514cb[_0x5a9e('0x3a')][_0x5a9e('0x46')]+'%'};return _0x40a464;})});}_0x2a3914=_[_0x5a9e('0x47')]({},_0x2a3914,_0x3514cb[_0x5a9e('0x62')]);return _0x27e88d[_0x5a9e('0x82')](_0x2a3914);}})['then'](function(_0x41c9cc){if(_0x41c9cc){_0x5c5a3f=_0x41c9cc['length'];if(!_0x3514cb[_0x5a9e('0x3a')][_0x5a9e('0x40')](_0x5a9e('0x41'))){_0x2a3914[_0x5a9e('0x27')]=qs[_0x5a9e('0x27')](_0x3514cb[_0x5a9e('0x3a')]['limit']);_0x2a3914[_0x5a9e('0x26')]=qs[_0x5a9e('0x26')](_0x3514cb['query'][_0x5a9e('0x26')]);}return _0x27e88d[_0x5a9e('0x82')](_0x2a3914);}})[_0x5a9e('0x2d')](function(_0x42e661){if(_0x42e661){return _0x42e661?{'count':_0x5c5a3f,'rows':_0x42e661}:null;}})[_0x5a9e('0x2d')](respondWithResult(_0x7934ab,null))['catch'](handleError(_0x7934ab,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b4fad3e..0de4bdc 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 _0x844f=['update','emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners','save'];(function(_0xbafd5f,_0x27cabb){var _0x148fad=function(_0x449f61){while(--_0x449f61){_0xbafd5f['push'](_0xbafd5f['shift']());}};_0x148fad(++_0x27cabb);}(_0x844f,0x68));var _0xf844=function(_0x484195,_0x25a4d2){_0x484195=_0x484195-0x0;var _0xd057ff=_0x844f[_0x484195];return _0xd057ff;};'use strict';var EventEmitter=require(_0xf844('0x0'));var Team=require('../../mysqldb')['db'][_0xf844('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xf844('0x2')](0x0);var events={'afterCreate':_0xf844('0x3'),'afterUpdate':_0xf844('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53b57f){return function(_0x6e2fdc,_0x484d2d,_0x4580bd){TeamEvents[_0xf844('0x5')](_0x53b57f+':'+_0x6e2fdc['id'],_0x6e2fdc);TeamEvents['emit'](_0x53b57f,_0x6e2fdc);_0x4580bd(null);};}for(var e in events){if(events[_0xf844('0x6')](e)){var event=events[e];Team[_0xf844('0x7')](e,emitEvent(event));}}module[_0xf844('0x8')]=TeamEvents; \ No newline at end of file +var _0xe95a=['../../mysqldb','update','remove','emit','exports'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xe95a,0xb9));var _0xae95=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xe95a[_0x5416db];return _0x243e35;};'use strict';var EventEmitter=require('events');var Team=require(_0xae95('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xae95('0x1'),'afterDestroy':_0xae95('0x2')};function emitEvent(_0x438d6d){return function(_0x3fe795,_0x2755db,_0x26a6a6){TeamEvents[_0xae95('0x3')](_0x438d6d+':'+_0x3fe795['id'],_0x3fe795);TeamEvents['emit'](_0x438d6d,_0x3fe795);_0x26a6a6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xae95('0x4')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index b54a284..7736959 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 _0x5018=['teams','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./team.attributes','exports','define'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x5018,0x169));var _0x8501=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0x5018[_0x208d75];return _0x382d27;};'use strict';var _=require(_0x8501('0x0'));var util=require('util');var logger=require(_0x8501('0x1'))(_0x8501('0x2'));var moment=require(_0x8501('0x3'));var BPromise=require(_0x8501('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8501('0x5'));var rimraf=require(_0x8501('0x6'));var config=require(_0x8501('0x7'));var attributes=require(_0x8501('0x8'));module[_0x8501('0x9')]=function(_0x2eff79,_0x2e3a2f){return _0x2eff79[_0x8501('0xa')]('Team',attributes,{'tableName':_0x8501('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8578=['bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','lodash','api','moment'];(function(_0x2d4c77,_0x270657){var _0x14e8cd=function(_0x22e62d){while(--_0x22e62d){_0x2d4c77['push'](_0x2d4c77['shift']());}};_0x14e8cd(++_0x270657);}(_0x8578,0x110));var _0x8857=function(_0x30e78c,_0x2b7f98){_0x30e78c=_0x30e78c-0x0;var _0x7f5dd2=_0x8578[_0x30e78c];return _0x7f5dd2;};'use strict';var _=require(_0x8857('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8857('0x1'));var moment=require(_0x8857('0x2'));var BPromise=require(_0x8857('0x3'));var rp=require(_0x8857('0x4'));var fs=require('fs');var path=require(_0x8857('0x5'));var rimraf=require(_0x8857('0x6'));var config=require(_0x8857('0x7'));var attributes=require(_0x8857('0x8'));module[_0x8857('0x9')]=function(_0x543c65,_0x9b3638){return _0x543c65[_0x8857('0xa')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8997a2d..30b450a 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 _0x5a24=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x48aba2,_0x27ec73){var _0x1cdbcb=function(_0x2d38c0){while(--_0x2d38c0){_0x48aba2['push'](_0x48aba2['shift']());}};_0x1cdbcb(++_0x27ec73);}(_0x5a24,0x1a7));var _0x45a2=function(_0x55462c,_0xc5b09d){_0x55462c=_0x55462c-0x0;var _0x178291=_0x5a24[_0x55462c];return _0x178291;};'use strict';var _=require(_0x45a2('0x0'));var util=require(_0x45a2('0x1'));var moment=require('moment');var BPromise=require(_0x45a2('0x2'));var rs=require(_0x45a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x45a2('0x4'));var logger=require(_0x45a2('0x5'))(_0x45a2('0x6'));var config=require('../../config/environment');var jayson=require(_0x45a2('0x7'));var client=jayson[_0x45a2('0x8')][_0x45a2('0x9')]({'port':0x232a});config[_0x45a2('0xa')]=_[_0x45a2('0xb')](config[_0x45a2('0xa')],{'host':_0x45a2('0xc'),'port':0x18eb});var socket=require(_0x45a2('0xd'))(new Redis(config[_0x45a2('0xa')]));require(_0x45a2('0xe'))[_0x45a2('0xf')](socket);function respondWithRpcPromise(_0x5891a1,_0x2bb9c6,_0x45cbdc){return new BPromise(function(_0x5dd9ca,_0x45333c){return client['request'](_0x5891a1,_0x45cbdc)[_0x45a2('0x10')](function(_0x24dc2f){logger[_0x45a2('0x11')](_0x45a2('0x12'),_0x2bb9c6,_0x45a2('0x13'));logger[_0x45a2('0x14')](_0x45a2('0x15'),_0x2bb9c6,'request\x20sent',JSON[_0x45a2('0x16')](_0x24dc2f));if(_0x24dc2f[_0x45a2('0x17')]){if(_0x24dc2f[_0x45a2('0x17')][_0x45a2('0x18')]===0x1f4){logger[_0x45a2('0x17')](_0x45a2('0x12'),_0x2bb9c6,_0x24dc2f[_0x45a2('0x17')]['message']);return _0x45333c(_0x24dc2f[_0x45a2('0x17')]['message']);}logger[_0x45a2('0x17')](_0x45a2('0x12'),_0x2bb9c6,_0x24dc2f[_0x45a2('0x17')]['message']);return _0x5dd9ca(_0x24dc2f[_0x45a2('0x17')][_0x45a2('0x19')]);}else{logger[_0x45a2('0x11')](_0x45a2('0x12'),_0x2bb9c6,_0x45a2('0x13'));_0x5dd9ca(_0x24dc2f['result'][_0x45a2('0x19')]);}})[_0x45a2('0x1a')](function(_0x3e3ebd){logger[_0x45a2('0x17')]('Team,\x20%s,\x20%s',_0x2bb9c6,_0x3e3ebd);_0x45333c(_0x3e3ebd);});});} \ No newline at end of file +var _0x1514=['register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket'];(function(_0x16afc9,_0x47b2e2){var _0x191bc9=function(_0x296960){while(--_0x296960){_0x16afc9['push'](_0x16afc9['shift']());}};_0x191bc9(++_0x47b2e2);}(_0x1514,0x1d2));var _0x4151=function(_0xa9b3a2,_0x272e5b){_0xa9b3a2=_0xa9b3a2-0x0;var _0x47b799=_0x1514[_0xa9b3a2];return _0x47b799;};'use strict';var _=require(_0x4151('0x0'));var util=require('util');var moment=require(_0x4151('0x1'));var BPromise=require('bluebird');var rs=require(_0x4151('0x2'));var fs=require('fs');var Redis=require(_0x4151('0x3'));var db=require(_0x4151('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4151('0x5'));var config=require('../../config/environment');var jayson=require(_0x4151('0x6'));var client=jayson[_0x4151('0x7')][_0x4151('0x8')]({'port':0x232a});config[_0x4151('0x9')]=_[_0x4151('0xa')](config[_0x4151('0x9')],{'host':_0x4151('0xb'),'port':0x18eb});var socket=require(_0x4151('0xc'))(new Redis(config[_0x4151('0x9')]));require(_0x4151('0xd'))[_0x4151('0xe')](socket);function respondWithRpcPromise(_0x6a0c46,_0x3dad29,_0x7164f1){return new BPromise(function(_0x9eb4ff,_0x5a3578){return client[_0x4151('0xf')](_0x6a0c46,_0x7164f1)[_0x4151('0x10')](function(_0x47f758){logger[_0x4151('0x11')](_0x4151('0x12'),_0x3dad29,_0x4151('0x13'));logger[_0x4151('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x3dad29,_0x4151('0x13'),JSON['stringify'](_0x47f758));if(_0x47f758[_0x4151('0x15')]){if(_0x47f758[_0x4151('0x15')]['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x3dad29,_0x47f758['error'][_0x4151('0x16')]);return _0x5a3578(_0x47f758[_0x4151('0x15')][_0x4151('0x16')]);}logger['error'](_0x4151('0x12'),_0x3dad29,_0x47f758[_0x4151('0x15')][_0x4151('0x16')]);return _0x9eb4ff(_0x47f758['error']['message']);}else{logger[_0x4151('0x11')]('Team,\x20%s,\x20%s',_0x3dad29,_0x4151('0x13'));_0x9eb4ff(_0x47f758['result'][_0x4151('0x16')]);}})[_0x4151('0x17')](function(_0x2a9e8e){logger[_0x4151('0x15')](_0x4151('0x12'),_0x3dad29,_0x2a9e8e);_0x5a3578(_0x2a9e8e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 91d55da..dc201fe 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 _0x0a6b=['removeListener','length','./team.events','emit'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x5d2f39,_0x11e2f4){_0x5d2f39=_0x5d2f39-0x0;var _0x3df8f6=_0x0a6b[_0x5d2f39];return _0x3df8f6;};'use strict';var TeamEvents=require(_0xb0a6('0x0'));var events=['save','remove','update'];function createListener(_0x16a15d,_0x50d3d5){return function(_0x2245d7){_0x50d3d5[_0xb0a6('0x1')](_0x16a15d,_0x2245d7);};}function removeListener(_0x1d3b78,_0x544a64){return function(){TeamEvents[_0xb0a6('0x2')](_0x1d3b78,_0x544a64);};}exports['register']=function(_0xbbdf89){for(var _0x415e9e=0x0,_0x5e2d2d=events[_0xb0a6('0x3')];_0x415e9e<_0x5e2d2d;_0x415e9e++){var _0x24515c=events[_0x415e9e];var _0x2a8516=createListener('team:'+_0x24515c,_0xbbdf89);TeamEvents['on'](_0x24515c,_0x2a8516);}}; \ No newline at end of file +var _0x1a44=['./team.events','remove','update','emit','removeListener','register','team:'];(function(_0x4fff92,_0xb8ab82){var _0x574587=function(_0x2e8ce9){while(--_0x2e8ce9){_0x4fff92['push'](_0x4fff92['shift']());}};_0x574587(++_0xb8ab82);}(_0x1a44,0xc4));var _0x41a4=function(_0x1d271f,_0xc1ae26){_0x1d271f=_0x1d271f-0x0;var _0x1f4989=_0x1a44[_0x1d271f];return _0x1f4989;};'use strict';var TeamEvents=require(_0x41a4('0x0'));var events=['save',_0x41a4('0x1'),_0x41a4('0x2')];function createListener(_0x306334,_0xb7b167){return function(_0x308968){_0xb7b167[_0x41a4('0x3')](_0x306334,_0x308968);};}function removeListener(_0x397cb2,_0x529244){return function(){TeamEvents[_0x41a4('0x4')](_0x397cb2,_0x529244);};}exports[_0x41a4('0x5')]=function(_0xb62f3c){for(var _0x412bd8=0x0,_0x599ccc=events['length'];_0x412bd8<_0x599ccc;_0x412bd8++){var _0x2e523b=events[_0x412bd8];var _0x141ae3=createListener(_0x41a4('0x6')+_0x2e523b,_0xb62f3c);TeamEvents['on'](_0x2e523b,_0x141ae3);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d8c9f6a..621c95a 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2977=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x1597e8,_0x2af30b){var _0x21edfe=function(_0x293017){while(--_0x293017){_0x1597e8['push'](_0x1597e8['shift']());}};_0x21edfe(++_0x2af30b);}(_0x2977,0xa5));var _0x7297=function(_0x50ac2e,_0x316214){_0x50ac2e=_0x50ac2e-0x0;var _0x1c7984=_0x2977[_0x50ac2e];return _0x1c7984;};'use strict';var multer=require(_0x7297('0x0'));var util=require('util');var path=require(_0x7297('0x1'));var timeout=require(_0x7297('0x2'));var express=require(_0x7297('0x3'));var router=express[_0x7297('0x4')]();var fs_extra=require(_0x7297('0x5'));var auth=require(_0x7297('0x6'));var interaction=require(_0x7297('0x7'));var config=require(_0x7297('0x8'));module[_0x7297('0x9')]=router; \ No newline at end of file +var _0x570f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','Router'];(function(_0x15f232,_0x2ee42b){var _0x3bf2a7=function(_0x64eaf0){while(--_0x64eaf0){_0x15f232['push'](_0x15f232['shift']());}};_0x3bf2a7(++_0x2ee42b);}(_0x570f,0x152));var _0xf570=function(_0x4c5e74,_0x319d00){_0x4c5e74=_0x4c5e74-0x0;var _0x48b7f6=_0x570f[_0x4c5e74];return _0x48b7f6;};'use strict';var multer=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var path=require(_0xf570('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf570('0x3')]();var fs_extra=require(_0xf570('0x4'));var auth=require(_0xf570('0x5'));var interaction=require(_0xf570('0x6'));var config=require(_0xf570('0x7'));module[_0xf570('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index d8504ae..d4d39bf 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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(_0x104857,_0x34844c){var _0x5c7d6d=function(_0x1aa95f){while(--_0x1aa95f){_0x104857['push'](_0x104857['shift']());}};_0x5c7d6d(++_0x34844c);}(_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/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 1d44284..0f32097 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e73=['define','TeamVoiceQueue','lodash','util','bluebird','request-promise','path','../../config/environment'];(function(_0x578113,_0x3486b4){var _0x132f97=function(_0x10ad63){while(--_0x10ad63){_0x578113['push'](_0x578113['shift']());}};_0x132f97(++_0x3486b4);}(_0x7e73,0x15a));var _0x37e7=function(_0x5d2c4b,_0x174014){_0x5d2c4b=_0x5d2c4b-0x0;var _0x5268c9=_0x7e73[_0x5d2c4b];return _0x5268c9;};'use strict';var _=require(_0x37e7('0x0'));var util=require(_0x37e7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x37e7('0x2'));var rp=require(_0x37e7('0x3'));var fs=require('fs');var path=require(_0x37e7('0x4'));var rimraf=require('rimraf');var config=require(_0x37e7('0x5'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x391446,_0x28db5a){return _0x391446[_0x37e7('0x6')](_0x37e7('0x7'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x109b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','TeamVoiceQueue','util','../../config/logger','api'];(function(_0x47cb96,_0x5a3cb4){var _0x1bf0c2=function(_0x2f44b8){while(--_0x2f44b8){_0x47cb96['push'](_0x47cb96['shift']());}};_0x1bf0c2(++_0x5a3cb4);}(_0x109b,0x131));var _0xb109=function(_0x95e21d,_0x36861e){_0x95e21d=_0x95e21d-0x0;var _0x3fd266=_0x109b[_0x95e21d];return _0x3fd266;};'use strict';var _=require('lodash');var util=require(_0xb109('0x0'));var logger=require(_0xb109('0x1'))(_0xb109('0x2'));var moment=require(_0xb109('0x3'));var BPromise=require(_0xb109('0x4'));var rp=require(_0xb109('0x5'));var fs=require('fs');var path=require(_0xb109('0x6'));var rimraf=require(_0xb109('0x7'));var config=require(_0xb109('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0xb109('0x9')]=function(_0x4ea88b,_0x7bd55f){return _0x4ea88b['define'](_0xb109('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 63ee603..3ea067b 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x704f=['result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x704f,0x80));var _0xf704=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x704f[_0x466247];return _0x4b352e;};'use strict';var _=require(_0xf704('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf704('0x1'));var rs=require(_0xf704('0x2'));var fs=require('fs');var Redis=require(_0xf704('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf704('0x4'));var logger=require(_0xf704('0x5'))(_0xf704('0x6'));var config=require(_0xf704('0x7'));var jayson=require(_0xf704('0x8'));var client=jayson['client'][_0xf704('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ddb8c,_0x583327,_0x55a36b){return new BPromise(function(_0x53e8a7,_0x28b34f){return client[_0xf704('0xa')](_0x1ddb8c,_0x55a36b)[_0xf704('0xb')](function(_0x3566cb){logger[_0xf704('0xc')](_0xf704('0xd'),_0x583327,'request\x20sent');logger[_0xf704('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x583327,_0xf704('0xf'),JSON[_0xf704('0x10')](_0x3566cb));if(_0x3566cb[_0xf704('0x11')]){if(_0x3566cb[_0xf704('0x11')]['code']===0x1f4){logger['error'](_0xf704('0xd'),_0x583327,_0x3566cb[_0xf704('0x11')][_0xf704('0x12')]);return _0x28b34f(_0x3566cb[_0xf704('0x11')][_0xf704('0x12')]);}logger[_0xf704('0x11')](_0xf704('0xd'),_0x583327,_0x3566cb['error'][_0xf704('0x12')]);return _0x53e8a7(_0x3566cb[_0xf704('0x11')]['message']);}else{logger[_0xf704('0xc')](_0xf704('0xd'),_0x583327,_0xf704('0xf'));_0x53e8a7(_0x3566cb[_0xf704('0x13')][_0xf704('0x12')]);}})[_0xf704('0x14')](function(_0x452ee4){logger['error'](_0xf704('0xd'),_0x583327,_0x452ee4);_0x28b34f(_0x452ee4);});});} \ No newline at end of file +var _0x2c1b=['debug','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','request\x20sent'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2c1b,0x96));var _0xb2c1=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2c1b[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xb2c1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb2c1('0x1'));var rs=require(_0xb2c1('0x2'));var fs=require('fs');var Redis=require(_0xb2c1('0x3'));var db=require(_0xb2c1('0x4'))['db'];var utils=require(_0xb2c1('0x5'));var logger=require('../../config/logger')(_0xb2c1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2c1('0x7')][_0xb2c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa79758,_0x3798a5,_0x35aa84){return new BPromise(function(_0xfc5f5f,_0x2bf123){return client['request'](_0xa79758,_0x35aa84)[_0xb2c1('0x9')](function(_0x508cb1){logger[_0xb2c1('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3798a5,_0xb2c1('0xb'));logger[_0xb2c1('0xc')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3798a5,'request\x20sent',JSON['stringify'](_0x508cb1));if(_0x508cb1[_0xb2c1('0xd')]){if(_0x508cb1['error'][_0xb2c1('0xe')]===0x1f4){logger[_0xb2c1('0xd')](_0xb2c1('0xf'),_0x3798a5,_0x508cb1[_0xb2c1('0xd')][_0xb2c1('0x10')]);return _0x2bf123(_0x508cb1[_0xb2c1('0xd')][_0xb2c1('0x10')]);}logger[_0xb2c1('0xd')](_0xb2c1('0xf'),_0x3798a5,_0x508cb1['error'][_0xb2c1('0x10')]);return _0xfc5f5f(_0x508cb1['error'][_0xb2c1('0x10')]);}else{logger[_0xb2c1('0xa')](_0xb2c1('0xf'),_0x3798a5,'request\x20sent');_0xfc5f5f(_0x508cb1['result'][_0xb2c1('0x10')]);}})[_0xb2c1('0x11')](function(_0x23c4bd){logger[_0xb2c1('0xd')](_0xb2c1('0xf'),_0x3798a5,_0x23c4bd);_0x2bf123(_0x23c4bd);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 9ce1ca4..3c7d44b 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 _0xf2ca=['/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','put','update','delete'];(function(_0x2c9103,_0x2adf48){var _0x514234=function(_0x11672b){while(--_0x11672b){_0x2c9103['push'](_0x2c9103['shift']());}};_0x514234(++_0x2adf48);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x5e3bb1,_0x3cfe7c){_0x5e3bb1=_0x5e3bb1-0x0;var _0x4c1278=_0xf2ca[_0x5e3bb1];return _0x4c1278;};'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 fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./template.controller');router[_0xaf2c('0x9')]('/',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0x9')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xa')](),controller['create']);router[_0xaf2c('0xd')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xe')]);router[_0xaf2c('0xf')](_0xaf2c('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf2c('0x11')]=router; \ No newline at end of file +var _0xb138=['./template.controller','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2a0c7f,_0x559044){var _0x1e727a=function(_0xc7d76){while(--_0xc7d76){_0x2a0c7f['push'](_0x2a0c7f['shift']());}};_0x1e727a(++_0x559044);}(_0xb138,0x1dd));var _0x8b13=function(_0x4ca740,_0x11b0a1){_0x4ca740=_0x4ca740-0x0;var _0x406ef9=_0xb138[_0x4ca740];return _0x406ef9;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['post']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xe')]);router['put']('/:id',auth[_0x8b13('0xa')](),controller[_0x8b13('0xf')]);router[_0x8b13('0x10')](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller['destroy']);module[_0x8b13('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8d8418e..8b2ea92 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 _0x1667=['sequelize'];(function(_0xa49d14,_0x1e7251){var _0x1dd411=function(_0x2d6db7){while(--_0x2d6db7){_0xa49d14['push'](_0xa49d14['shift']());}};_0x1dd411(++_0x1e7251);}(_0x1667,0x8c));var _0x7166=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x1667[_0x1a89a1];return _0x3d5b46;};'use strict';var Sequelize=require(_0x7166('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2558=['STRING','TEXT','exports'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x2558,0x1a0));var _0x8255=function(_0x2a7de3,_0x4d956b){_0x2a7de3=_0x2a7de3-0x0;var _0x42ddeb=_0x2558[_0x2a7de3];return _0x42ddeb;};'use strict';var Sequelize=require('sequelize');module[_0x8255('0x0')]={'name':{'type':Sequelize[_0x8255('0x1')]},'description':{'type':Sequelize[_0x8255('0x1')]},'html':{'type':Sequelize[_0x8255('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 13cd0d0..886d92a 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 _0xa7fa=['body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Templates','UserProfileResource','stack','name','send','map','Template','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','length','find','catch','create'];(function(_0x175f54,_0x407b70){var _0x4df2c1=function(_0x8520e3){while(--_0x8520e3){_0x175f54['push'](_0x175f54['shift']());}};_0x4df2c1(++_0x407b70);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xaa7f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa7f('0x1'));var jsonpatch=require(_0xaa7f('0x2'));var rp=require(_0xaa7f('0x3'));var moment=require(_0xaa7f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa7f('0x5'));var util=require(_0xaa7f('0x6'));var path=require(_0xaa7f('0x7'));var sox=require(_0xaa7f('0x8'));var csv=require('to-csv');var ejs=require(_0xaa7f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaa7f('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa7f('0xb'));var deskjs=require(_0xaa7f('0xc'));var toCsv=require(_0xaa7f('0xd'));var querystring=require(_0xaa7f('0xe'));var Papa=require('papaparse');var Redis=require(_0xaa7f('0xf'));var authService=require(_0xaa7f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaa7f('0x11'));var hardwareService=require(_0xaa7f('0x12'));var logger=require(_0xaa7f('0x13'))(_0xaa7f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaa7f('0x15'));var db=require(_0xaa7f('0x16'))['db'];function respondWithStatusCode(_0x2d03f3,_0x8c42d8){_0x8c42d8=_0x8c42d8||0xcc;return function(_0x7484d8){if(_0x7484d8){return _0x2d03f3[_0xaa7f('0x17')](_0x8c42d8);}return _0x2d03f3[_0xaa7f('0x18')](_0x8c42d8)[_0xaa7f('0x19')]();};}function respondWithResult(_0x992494,_0x4dfb46){_0x4dfb46=_0x4dfb46||0xc8;return function(_0x11436b){if(_0x11436b){return _0x992494['status'](_0x4dfb46)[_0xaa7f('0x1a')](_0x11436b);}};}function respondWithFilteredResult(_0x6ba90d,_0x470c74){return function(_0x48844f){if(_0x48844f){var _0x7276be=_0x48844f[_0xaa7f('0x1b')],_0x9a6745=_0x470c74[_0xaa7f('0x1c')],_0x1bd3f9=_0x470c74[_0xaa7f('0x1c')]+_0x470c74['limit'],_0x2f09e1;if(_0x1bd3f9>=_0x7276be){_0x1bd3f9=_0x7276be;_0x2f09e1=0xc8;}else{_0x2f09e1=0xce;}_0x6ba90d[_0xaa7f('0x18')](_0x2f09e1);return _0x6ba90d[_0xaa7f('0x1d')](_0xaa7f('0x1e'),_0x9a6745+'-'+_0x1bd3f9+'/'+_0x7276be)[_0xaa7f('0x1a')](_0x48844f);}return null;};}function patchUpdates(_0x4d1119){return function(_0x5d60b5){try{jsonpatch[_0xaa7f('0x1f')](_0x5d60b5,_0x4d1119,!![]);}catch(_0x4cded6){return BPromise[_0xaa7f('0x20')](_0x4cded6);}return _0x5d60b5[_0xaa7f('0x21')]();};}function saveUpdates(_0x4eac0b,_0x25cce3){return function(_0x489b56){if(_0x489b56){return _0x489b56[_0xaa7f('0x22')](_0x4eac0b)[_0xaa7f('0x23')](function(_0x3e203b){return _0x3e203b;});}return null;};}function removeEntity(_0x516d7e,_0x1436f7){return function(_0x34ff2e){if(_0x34ff2e){return _0x34ff2e[_0xaa7f('0x24')]()[_0xaa7f('0x23')](function(){var _0x55363c=_0x34ff2e['get']({'plain':!![]});var _0x28d627=_0xaa7f('0x25');return db[_0xaa7f('0x26')][_0xaa7f('0x24')]({'where':{'type':_0x28d627,'resourceId':_0x55363c['id']}})[_0xaa7f('0x23')](function(){return _0x34ff2e;});})[_0xaa7f('0x23')](function(){_0x516d7e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x525df7,_0x40d7f4){return function(_0x4fb956){if(!_0x4fb956){_0x525df7[_0xaa7f('0x17')](0x194);}return _0x4fb956;};}function handleError(_0x23bd9e,_0x4c79fa){_0x4c79fa=_0x4c79fa||0x1f4;return function(_0x46c83e){logger['error'](_0x46c83e[_0xaa7f('0x27')]);if(_0x46c83e[_0xaa7f('0x28')]){delete _0x46c83e[_0xaa7f('0x28')];}_0x23bd9e[_0xaa7f('0x18')](_0x4c79fa)[_0xaa7f('0x29')](_0x46c83e);};}exports['index']=function(_0x1541e1,_0x3e0223){var _0x35034b={},_0x5a8e2c={},_0x3da7={'count':0x0,'rows':[]};var _0x1b17e2=_[_0xaa7f('0x2a')](db[_0xaa7f('0x2b')][_0xaa7f('0x2c')],function(_0x432c39){return{'name':_0x432c39['fieldName'],'type':_0x432c39[_0xaa7f('0x2d')][_0xaa7f('0x2e')]};});_0x5a8e2c['model']=_[_0xaa7f('0x2a')](_0x1b17e2,_0xaa7f('0x28'));_0x5a8e2c[_0xaa7f('0x2f')]=_[_0xaa7f('0x30')](_0x1541e1[_0xaa7f('0x2f')]);_0x5a8e2c[_0xaa7f('0x31')]=_[_0xaa7f('0x32')](_0x5a8e2c[_0xaa7f('0x33')],_0x5a8e2c[_0xaa7f('0x2f')]);_0x35034b[_0xaa7f('0x34')]=_[_0xaa7f('0x32')](_0x5a8e2c[_0xaa7f('0x33')],qs[_0xaa7f('0x35')](_0x1541e1[_0xaa7f('0x2f')][_0xaa7f('0x35')]));_0x35034b['attributes']=_0x35034b[_0xaa7f('0x34')]['length']?_0x35034b[_0xaa7f('0x34')]:_0x5a8e2c[_0xaa7f('0x33')];if(!_0x1541e1['query'][_0xaa7f('0x36')](_0xaa7f('0x37'))){_0x35034b['limit']=qs[_0xaa7f('0x38')](_0x1541e1[_0xaa7f('0x2f')]['limit']);_0x35034b['offset']=qs[_0xaa7f('0x1c')](_0x1541e1[_0xaa7f('0x2f')][_0xaa7f('0x1c')]);}_0x35034b[_0xaa7f('0x39')]=qs[_0xaa7f('0x3a')](_0x1541e1['query']['sort']);_0x35034b[_0xaa7f('0x3b')]=qs[_0xaa7f('0x31')](_[_0xaa7f('0x3c')](_0x1541e1[_0xaa7f('0x2f')],_0x5a8e2c[_0xaa7f('0x31')]),_0x1b17e2);if(_0x1541e1[_0xaa7f('0x2f')][_0xaa7f('0x3d')]){_0x35034b['where']=_[_0xaa7f('0x3e')](_0x35034b[_0xaa7f('0x3b')],{'$or':_[_0xaa7f('0x2a')](_0x1b17e2,function(_0x109084){if(_0x109084[_0xaa7f('0x2d')]!==_0xaa7f('0x3f')){var _0x18d786={};_0x18d786[_0x109084[_0xaa7f('0x28')]]={'$like':'%'+_0x1541e1[_0xaa7f('0x2f')][_0xaa7f('0x3d')]+'%'};return _0x18d786;}})});}_0x35034b=_[_0xaa7f('0x3e')]({},_0x35034b,_0x1541e1[_0xaa7f('0x40')]);var _0x89c016={'where':_0x35034b[_0xaa7f('0x3b')]};return db['Template'][_0xaa7f('0x1b')](_0x89c016)[_0xaa7f('0x23')](function(_0x406bd0){_0x3da7[_0xaa7f('0x1b')]=_0x406bd0;if(_0x1541e1[_0xaa7f('0x2f')][_0xaa7f('0x41')]){_0x35034b[_0xaa7f('0x42')]=[{'all':!![]}];}return db[_0xaa7f('0x2b')]['findAll'](_0x35034b);})[_0xaa7f('0x23')](function(_0x1e95df){_0x3da7[_0xaa7f('0x43')]=_0x1e95df;return _0x3da7;})[_0xaa7f('0x23')](respondWithFilteredResult(_0x3e0223,_0x35034b))['catch'](handleError(_0x3e0223,null));};exports['show']=function(_0x132cee,_0x548500){var _0x4bba4b={'raw':!![],'where':{'id':_0x132cee['params']['id']}},_0x5d2ed3={};_0x5d2ed3[_0xaa7f('0x33')]=_[_0xaa7f('0x30')](db[_0xaa7f('0x2b')][_0xaa7f('0x2c')]);_0x5d2ed3[_0xaa7f('0x2f')]=_[_0xaa7f('0x30')](_0x132cee[_0xaa7f('0x2f')]);_0x5d2ed3[_0xaa7f('0x31')]=_['intersection'](_0x5d2ed3[_0xaa7f('0x33')],_0x5d2ed3['query']);_0x4bba4b['attributes']=_['intersection'](_0x5d2ed3[_0xaa7f('0x33')],qs[_0xaa7f('0x35')](_0x132cee[_0xaa7f('0x2f')][_0xaa7f('0x35')]));_0x4bba4b[_0xaa7f('0x34')]=_0x4bba4b['attributes'][_0xaa7f('0x44')]?_0x4bba4b[_0xaa7f('0x34')]:_0x5d2ed3[_0xaa7f('0x33')];if(_0x132cee['query'][_0xaa7f('0x41')]){_0x4bba4b[_0xaa7f('0x42')]=[{'all':!![]}];}_0x4bba4b=_[_0xaa7f('0x3e')]({},_0x4bba4b,_0x132cee['options']);return db[_0xaa7f('0x2b')][_0xaa7f('0x45')](_0x4bba4b)[_0xaa7f('0x23')](handleEntityNotFound(_0x548500,null))[_0xaa7f('0x23')](respondWithResult(_0x548500,null))[_0xaa7f('0x46')](handleError(_0x548500,null));};exports['create']=function(_0x851a8e,_0x1b70ea){return db['Template'][_0xaa7f('0x47')](_0x851a8e[_0xaa7f('0x48')],{})[_0xaa7f('0x23')](function(_0x406f7f){var _0x1dd222=_0x851a8e[_0xaa7f('0x49')][_0xaa7f('0x4a')]({'plain':!![]});if(!_0x1dd222)throw new Error(_0xaa7f('0x4b'));if(_0x1dd222['role']==='user'){var _0x3e6644=_0x406f7f[_0xaa7f('0x4a')]({'plain':!![]});var _0x4751c9=_0xaa7f('0x25');return db[_0xaa7f('0x4c')]['find']({'where':{'name':_0x4751c9,'userProfileId':_0x1dd222[_0xaa7f('0x4d')]},'raw':!![]})['then'](function(_0x387a8d){if(_0x387a8d&&_0x387a8d['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa7f('0x47')]({'name':_0x3e6644[_0xaa7f('0x28')],'resourceId':_0x3e6644['id'],'type':_0x387a8d[_0xaa7f('0x28')],'sectionId':_0x387a8d['id']},{})['then'](function(){return _0x406f7f;});}else{return _0x406f7f;}})[_0xaa7f('0x46')](function(_0x20180a){logger[_0xaa7f('0x4e')](_0xaa7f('0x4f'),_0x20180a);throw _0x20180a;});}return _0x406f7f;})[_0xaa7f('0x23')](respondWithResult(_0x1b70ea,0xc9))[_0xaa7f('0x46')](handleError(_0x1b70ea,null));};exports[_0xaa7f('0x22')]=function(_0x5a8df3,_0x39ce8d){if(_0x5a8df3[_0xaa7f('0x48')]['id']){delete _0x5a8df3[_0xaa7f('0x48')]['id'];}return db['Template']['find']({'where':{'id':_0x5a8df3[_0xaa7f('0x50')]['id']}})[_0xaa7f('0x23')](handleEntityNotFound(_0x39ce8d,null))[_0xaa7f('0x23')](saveUpdates(_0x5a8df3['body'],null))['then'](respondWithResult(_0x39ce8d,null))[_0xaa7f('0x46')](handleError(_0x39ce8d,null));};exports[_0xaa7f('0x24')]=function(_0x34d884,_0x273a7c){return db['Template'][_0xaa7f('0x45')]({'where':{'id':_0x34d884['params']['id']}})[_0xaa7f('0x23')](handleEntityNotFound(_0x273a7c,null))[_0xaa7f('0x23')](removeEntity(_0x273a7c,null))[_0xaa7f('0x46')](handleError(_0x273a7c,null));}; \ No newline at end of file +var _0xcd6f=['bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','name','index','map','Template','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','limit','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5cf3c0,_0x4363c1){var _0x39a680=function(_0x2a10f1){while(--_0x2a10f1){_0x5cf3c0['push'](_0x5cf3c0['shift']());}};_0x39a680(++_0x4363c1);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x4018c5,_0x4a60ac){_0x4018c5=_0x4018c5-0x0;var _0x532d25=_0xcd6f[_0x4018c5];return _0x532d25;};'use strict';var pdf=require(_0xfcd6('0x0'));var emlformat=require(_0xfcd6('0x1'));var rimraf=require(_0xfcd6('0x2'));var zipdir=require(_0xfcd6('0x3'));var jsonpatch=require(_0xfcd6('0x4'));var rp=require(_0xfcd6('0x5'));var moment=require('moment');var BPromise=require(_0xfcd6('0x6'));var Mustache=require(_0xfcd6('0x7'));var util=require(_0xfcd6('0x8'));var path=require(_0xfcd6('0x9'));var sox=require('sox');var csv=require(_0xfcd6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcd6('0xb'));var _=require('lodash');var squel=require(_0xfcd6('0xc'));var crypto=require(_0xfcd6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfcd6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfcd6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfcd6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcd6('0x11'))(_0xfcd6('0x12'));var utils=require('../../config/utils');var config=require(_0xfcd6('0x13'));var licenseUtil=require(_0xfcd6('0x14'));var db=require(_0xfcd6('0x15'))['db'];function respondWithStatusCode(_0x1ccc39,_0x3d08ac){_0x3d08ac=_0x3d08ac||0xcc;return function(_0x3278ae){if(_0x3278ae){return _0x1ccc39[_0xfcd6('0x16')](_0x3d08ac);}return _0x1ccc39[_0xfcd6('0x17')](_0x3d08ac)[_0xfcd6('0x18')]();};}function respondWithResult(_0x203d5a,_0x19d98e){_0x19d98e=_0x19d98e||0xc8;return function(_0x2b4344){if(_0x2b4344){return _0x203d5a[_0xfcd6('0x17')](_0x19d98e)[_0xfcd6('0x19')](_0x2b4344);}};}function respondWithFilteredResult(_0x47ff00,_0x4da943){return function(_0xc53a5c){if(_0xc53a5c){var _0x2ae7f4=_0xc53a5c[_0xfcd6('0x1a')],_0x56756f=_0x4da943[_0xfcd6('0x1b')],_0x29d25d=_0x4da943['offset']+_0x4da943['limit'],_0x3bb44a;if(_0x29d25d>=_0x2ae7f4){_0x29d25d=_0x2ae7f4;_0x3bb44a=0xc8;}else{_0x3bb44a=0xce;}_0x47ff00[_0xfcd6('0x17')](_0x3bb44a);return _0x47ff00[_0xfcd6('0x1c')](_0xfcd6('0x1d'),_0x56756f+'-'+_0x29d25d+'/'+_0x2ae7f4)[_0xfcd6('0x19')](_0xc53a5c);}return null;};}function patchUpdates(_0x5969ca){return function(_0x123131){try{jsonpatch['apply'](_0x123131,_0x5969ca,!![]);}catch(_0x1176c6){return BPromise[_0xfcd6('0x1e')](_0x1176c6);}return _0x123131[_0xfcd6('0x1f')]();};}function saveUpdates(_0x2792e4,_0x42d685){return function(_0x3affd6){if(_0x3affd6){return _0x3affd6[_0xfcd6('0x20')](_0x2792e4)[_0xfcd6('0x21')](function(_0x44bbb3){return _0x44bbb3;});}return null;};}function removeEntity(_0x4b2d32,_0x3d5cdf){return function(_0x58feb1){if(_0x58feb1){return _0x58feb1[_0xfcd6('0x22')]()[_0xfcd6('0x21')](function(){var _0x47b880=_0x58feb1[_0xfcd6('0x23')]({'plain':!![]});var _0x44bc67=_0xfcd6('0x24');return db[_0xfcd6('0x25')][_0xfcd6('0x22')]({'where':{'type':_0x44bc67,'resourceId':_0x47b880['id']}})[_0xfcd6('0x21')](function(){return _0x58feb1;});})['then'](function(){_0x4b2d32[_0xfcd6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ec43,_0x1d46f3){return function(_0x1e576a){if(!_0x1e576a){_0x24ec43[_0xfcd6('0x16')](0x194);}return _0x1e576a;};}function handleError(_0x54ca23,_0x4af752){_0x4af752=_0x4af752||0x1f4;return function(_0x57582a){logger['error'](_0x57582a['stack']);if(_0x57582a[_0xfcd6('0x26')]){delete _0x57582a[_0xfcd6('0x26')];}_0x54ca23['status'](_0x4af752)['send'](_0x57582a);};}exports[_0xfcd6('0x27')]=function(_0x150c63,_0x17e235){var _0xf2c98f={},_0x17f229={},_0x15e459={'count':0x0,'rows':[]};var _0x49dc2d=_[_0xfcd6('0x28')](db[_0xfcd6('0x29')][_0xfcd6('0x2a')],function(_0x110b51){return{'name':_0x110b51[_0xfcd6('0x2b')],'type':_0x110b51['type']['key']};});_0x17f229[_0xfcd6('0x2c')]=_[_0xfcd6('0x28')](_0x49dc2d,_0xfcd6('0x26'));_0x17f229[_0xfcd6('0x2d')]=_[_0xfcd6('0x2e')](_0x150c63['query']);_0x17f229['filters']=_[_0xfcd6('0x2f')](_0x17f229[_0xfcd6('0x2c')],_0x17f229['query']);_0xf2c98f[_0xfcd6('0x30')]=_[_0xfcd6('0x2f')](_0x17f229[_0xfcd6('0x2c')],qs[_0xfcd6('0x31')](_0x150c63[_0xfcd6('0x2d')][_0xfcd6('0x31')]));_0xf2c98f[_0xfcd6('0x30')]=_0xf2c98f['attributes']['length']?_0xf2c98f[_0xfcd6('0x30')]:_0x17f229[_0xfcd6('0x2c')];if(!_0x150c63['query']['hasOwnProperty']('nolimit')){_0xf2c98f[_0xfcd6('0x32')]=qs[_0xfcd6('0x32')](_0x150c63['query']['limit']);_0xf2c98f[_0xfcd6('0x1b')]=qs[_0xfcd6('0x1b')](_0x150c63[_0xfcd6('0x2d')][_0xfcd6('0x1b')]);}_0xf2c98f['order']=qs[_0xfcd6('0x33')](_0x150c63[_0xfcd6('0x2d')][_0xfcd6('0x33')]);_0xf2c98f[_0xfcd6('0x34')]=qs['filters'](_[_0xfcd6('0x35')](_0x150c63[_0xfcd6('0x2d')],_0x17f229[_0xfcd6('0x36')]),_0x49dc2d);if(_0x150c63[_0xfcd6('0x2d')][_0xfcd6('0x37')]){_0xf2c98f[_0xfcd6('0x34')]=_['merge'](_0xf2c98f[_0xfcd6('0x34')],{'$or':_[_0xfcd6('0x28')](_0x49dc2d,function(_0x55d8b5){if(_0x55d8b5[_0xfcd6('0x38')]!==_0xfcd6('0x39')){var _0x5b539c={};_0x5b539c[_0x55d8b5['name']]={'$like':'%'+_0x150c63[_0xfcd6('0x2d')][_0xfcd6('0x37')]+'%'};return _0x5b539c;}})});}_0xf2c98f=_[_0xfcd6('0x3a')]({},_0xf2c98f,_0x150c63[_0xfcd6('0x3b')]);var _0x4400eb={'where':_0xf2c98f[_0xfcd6('0x34')]};return db['Template'][_0xfcd6('0x1a')](_0x4400eb)[_0xfcd6('0x21')](function(_0x4d8a07){_0x15e459[_0xfcd6('0x1a')]=_0x4d8a07;if(_0x150c63['query']['includeAll']){_0xf2c98f[_0xfcd6('0x3c')]=[{'all':!![]}];}return db[_0xfcd6('0x29')][_0xfcd6('0x3d')](_0xf2c98f);})[_0xfcd6('0x21')](function(_0x787732){_0x15e459[_0xfcd6('0x3e')]=_0x787732;return _0x15e459;})[_0xfcd6('0x21')](respondWithFilteredResult(_0x17e235,_0xf2c98f))[_0xfcd6('0x3f')](handleError(_0x17e235,null));};exports[_0xfcd6('0x40')]=function(_0xceca99,_0x1cb53d){var _0x57b860={'raw':!![],'where':{'id':_0xceca99[_0xfcd6('0x41')]['id']}},_0x106522={};_0x106522[_0xfcd6('0x2c')]=_['keys'](db['Template'][_0xfcd6('0x2a')]);_0x106522[_0xfcd6('0x2d')]=_[_0xfcd6('0x2e')](_0xceca99[_0xfcd6('0x2d')]);_0x106522[_0xfcd6('0x36')]=_['intersection'](_0x106522[_0xfcd6('0x2c')],_0x106522[_0xfcd6('0x2d')]);_0x57b860['attributes']=_[_0xfcd6('0x2f')](_0x106522[_0xfcd6('0x2c')],qs[_0xfcd6('0x31')](_0xceca99['query']['fields']));_0x57b860[_0xfcd6('0x30')]=_0x57b860['attributes'][_0xfcd6('0x42')]?_0x57b860[_0xfcd6('0x30')]:_0x106522[_0xfcd6('0x2c')];if(_0xceca99['query'][_0xfcd6('0x43')]){_0x57b860[_0xfcd6('0x3c')]=[{'all':!![]}];}_0x57b860=_[_0xfcd6('0x3a')]({},_0x57b860,_0xceca99[_0xfcd6('0x3b')]);return db['Template'][_0xfcd6('0x44')](_0x57b860)[_0xfcd6('0x21')](handleEntityNotFound(_0x1cb53d,null))[_0xfcd6('0x21')](respondWithResult(_0x1cb53d,null))[_0xfcd6('0x3f')](handleError(_0x1cb53d,null));};exports[_0xfcd6('0x45')]=function(_0x1307ce,_0xddd44){return db[_0xfcd6('0x29')][_0xfcd6('0x45')](_0x1307ce[_0xfcd6('0x46')],{})[_0xfcd6('0x21')](function(_0x5690ca){var _0xbd9ad6=_0x1307ce[_0xfcd6('0x47')][_0xfcd6('0x23')]({'plain':!![]});if(!_0xbd9ad6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbd9ad6[_0xfcd6('0x48')]===_0xfcd6('0x47')){var _0x45928a=_0x5690ca[_0xfcd6('0x23')]({'plain':!![]});var _0x2ed2e7=_0xfcd6('0x24');return db[_0xfcd6('0x49')][_0xfcd6('0x44')]({'where':{'name':_0x2ed2e7,'userProfileId':_0xbd9ad6[_0xfcd6('0x4a')]},'raw':!![]})[_0xfcd6('0x21')](function(_0x109974){if(_0x109974&&_0x109974[_0xfcd6('0x4b')]===0x0){return db['UserProfileResource'][_0xfcd6('0x45')]({'name':_0x45928a[_0xfcd6('0x26')],'resourceId':_0x45928a['id'],'type':_0x109974['name'],'sectionId':_0x109974['id']},{})[_0xfcd6('0x21')](function(){return _0x5690ca;});}else{return _0x5690ca;}})[_0xfcd6('0x3f')](function(_0x454298){logger['error'](_0xfcd6('0x4c'),_0x454298);throw _0x454298;});}return _0x5690ca;})[_0xfcd6('0x21')](respondWithResult(_0xddd44,0xc9))[_0xfcd6('0x3f')](handleError(_0xddd44,null));};exports['update']=function(_0xc13a33,_0x516a66){if(_0xc13a33['body']['id']){delete _0xc13a33[_0xfcd6('0x46')]['id'];}return db[_0xfcd6('0x29')]['find']({'where':{'id':_0xc13a33[_0xfcd6('0x41')]['id']}})[_0xfcd6('0x21')](handleEntityNotFound(_0x516a66,null))[_0xfcd6('0x21')](saveUpdates(_0xc13a33[_0xfcd6('0x46')],null))[_0xfcd6('0x21')](respondWithResult(_0x516a66,null))['catch'](handleError(_0x516a66,null));};exports[_0xfcd6('0x22')]=function(_0x2a6925,_0x513671){return db[_0xfcd6('0x29')]['find']({'where':{'id':_0x2a6925[_0xfcd6('0x41')]['id']}})[_0xfcd6('0x21')](handleEntityNotFound(_0x513671,null))[_0xfcd6('0x21')](removeEntity(_0x513671,null))[_0xfcd6('0x3f')](handleError(_0x513671,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 86a7e3b..b0461aa 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 _0xce4f=['rimraf','exports','define','Template','tools_templates','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3e1108,_0x19e97f){var _0xd6b331=function(_0x561460){while(--_0x561460){_0x3e1108['push'](_0x3e1108['shift']());}};_0xd6b331(++_0x19e97f);}(_0xce4f,0x102));var _0xfce4=function(_0x18b5fc,_0x18f99f){_0x18b5fc=_0x18b5fc-0x0;var _0x30e957=_0xce4f[_0x18b5fc];return _0x30e957;};'use strict';var _=require('lodash');var util=require(_0xfce4('0x0'));var logger=require(_0xfce4('0x1'))(_0xfce4('0x2'));var moment=require(_0xfce4('0x3'));var BPromise=require(_0xfce4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfce4('0x5'));var rimraf=require(_0xfce4('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xfce4('0x7')]=function(_0x2124d1,_0x2a1c4a){return _0x2124d1[_0xfce4('0x8')](_0xfce4('0x9'),attributes,{'tableName':_0xfce4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dd0=['api','moment','bluebird','path','rimraf','./template.attributes','exports','define','Template','lodash','util','../../config/logger'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x6dd0,0x135));var _0x06dd=function(_0x2bcb63,_0x5d0e4a){_0x2bcb63=_0x2bcb63-0x0;var _0xe808ef=_0x6dd0[_0x2bcb63];return _0xe808ef;};'use strict';var _=require(_0x06dd('0x0'));var util=require(_0x06dd('0x1'));var logger=require(_0x06dd('0x2'))(_0x06dd('0x3'));var moment=require(_0x06dd('0x4'));var BPromise=require(_0x06dd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06dd('0x6'));var rimraf=require(_0x06dd('0x7'));var config=require('../../config/environment');var attributes=require(_0x06dd('0x8'));module[_0x06dd('0x9')]=function(_0x12bb89,_0xbd9a29){return _0x12bb89[_0x06dd('0xa')](_0x06dd('0xb'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index debeae6..dfe9b8b 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 _0xd875=['error','code','message','info','catch','GetTemplate','Template','options','raw','where','attributes','include','map','model','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s'];(function(_0x14a4c1,_0x102b1c){var _0x38ee5f=function(_0x2fbb56){while(--_0x2fbb56){_0x14a4c1['push'](_0x14a4c1['shift']());}};_0x38ee5f(++_0x102b1c);}(_0xd875,0xba));var _0x5d87=function(_0x3d0ffa,_0x2c71a7){_0x3d0ffa=_0x3d0ffa-0x0;var _0x249d3b=_0xd875[_0x3d0ffa];return _0x249d3b;};'use strict';var _=require(_0x5d87('0x0'));var util=require(_0x5d87('0x1'));var moment=require('moment');var BPromise=require(_0x5d87('0x2'));var rs=require(_0x5d87('0x3'));var fs=require('fs');var Redis=require(_0x5d87('0x4'));var db=require(_0x5d87('0x5'))['db'];var utils=require(_0x5d87('0x6'));var logger=require(_0x5d87('0x7'))(_0x5d87('0x8'));var config=require(_0x5d87('0x9'));var jayson=require(_0x5d87('0xa'));var client=jayson[_0x5d87('0xb')][_0x5d87('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b162c,_0x44348d,_0x5183f6){return new BPromise(function(_0x30d155,_0x4a247a){return client[_0x5d87('0xd')](_0x1b162c,_0x5183f6)['then'](function(_0x3f6431){logger['info'](_0x5d87('0xe'),_0x44348d,_0x5d87('0xf'));logger[_0x5d87('0x10')](_0x5d87('0x11'),_0x44348d,_0x5d87('0xf'),JSON['stringify'](_0x3f6431));if(_0x3f6431['error']){if(_0x3f6431[_0x5d87('0x12')][_0x5d87('0x13')]===0x1f4){logger[_0x5d87('0x12')](_0x5d87('0xe'),_0x44348d,_0x3f6431[_0x5d87('0x12')][_0x5d87('0x14')]);return _0x4a247a(_0x3f6431['error']['message']);}logger[_0x5d87('0x12')](_0x5d87('0xe'),_0x44348d,_0x3f6431[_0x5d87('0x12')][_0x5d87('0x14')]);return _0x30d155(_0x3f6431[_0x5d87('0x12')][_0x5d87('0x14')]);}else{logger[_0x5d87('0x15')](_0x5d87('0xe'),_0x44348d,_0x5d87('0xf'));_0x30d155(_0x3f6431['result'][_0x5d87('0x14')]);}})[_0x5d87('0x16')](function(_0x21911a){logger[_0x5d87('0x12')]('Template,\x20%s,\x20%s',_0x44348d,_0x21911a);_0x4a247a(_0x21911a);});});}exports[_0x5d87('0x17')]=function(_0x508d80){var _0x20e80b=this;return new Promise(function(_0x4a0685,_0x1e00ee){return db[_0x5d87('0x18')]['findAll']({'raw':_0x508d80[_0x5d87('0x19')]?_0x508d80['options'][_0x5d87('0x1a')]===undefined?!![]:![]:!![],'where':_0x508d80[_0x5d87('0x19')]?_0x508d80[_0x5d87('0x19')][_0x5d87('0x1b')]||null:null,'attributes':_0x508d80[_0x5d87('0x19')]?_0x508d80[_0x5d87('0x19')][_0x5d87('0x1c')]||null:null,'limit':_0x508d80['options']?_0x508d80[_0x5d87('0x19')]['limit']||null:null,'include':_0x508d80[_0x5d87('0x19')]?_0x508d80[_0x5d87('0x19')][_0x5d87('0x1d')]?_[_0x5d87('0x1e')](_0x508d80[_0x5d87('0x19')][_0x5d87('0x1d')],function(_0x532a0d){return{'model':db[_0x532a0d[_0x5d87('0x1f')]],'as':_0x532a0d['as'],'attributes':_0x532a0d[_0x5d87('0x1c')],'include':_0x532a0d[_0x5d87('0x1d')]?_['map'](_0x532a0d['include'],function(_0x4f5759){return{'model':db[_0x4f5759['model']],'as':_0x4f5759['as'],'attributes':_0x4f5759[_0x5d87('0x1c')],'include':_0x4f5759[_0x5d87('0x1d')]?_[_0x5d87('0x1e')](_0x4f5759[_0x5d87('0x1d')],function(_0x508ddc){return{'model':db[_0x508ddc[_0x5d87('0x1f')]],'as':_0x508ddc['as'],'attributes':_0x508ddc['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d87('0x20')](function(_0x3611ac){logger[_0x5d87('0x15')](_0x5d87('0x17'),_0x508d80);logger[_0x5d87('0x10')](_0x5d87('0x17'),_0x508d80,JSON[_0x5d87('0x21')](_0x3611ac));_0x4a0685(_0x3611ac);})[_0x5d87('0x16')](function(_0x1a6ed6){logger[_0x5d87('0x12')]('GetTemplate',_0x1a6ed6[_0x5d87('0x14')],_0x508d80);_0x1e00ee(_0x20e80b[_0x5d87('0x12')](0x1f4,_0x1a6ed6['message']));});});}; \ No newline at end of file +var _0x0891=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetTemplate','findAll','raw','options','where','attributes','limit','include','map','model','stringify','lodash'];(function(_0xd94e7f,_0x25b4d9){var _0x4344f4=function(_0x87fcb){while(--_0x87fcb){_0xd94e7f['push'](_0xd94e7f['shift']());}};_0x4344f4(++_0x25b4d9);}(_0x0891,0x1ee));var _0x1089=function(_0xe6bbe6,_0x372a76){_0xe6bbe6=_0xe6bbe6-0x0;var _0x58625d=_0x0891[_0xe6bbe6];return _0x58625d;};'use strict';var _=require(_0x1089('0x0'));var util=require(_0x1089('0x1'));var moment=require(_0x1089('0x2'));var BPromise=require(_0x1089('0x3'));var rs=require(_0x1089('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1089('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1089('0x6'))(_0x1089('0x7'));var config=require(_0x1089('0x8'));var jayson=require(_0x1089('0x9'));var client=jayson[_0x1089('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ce467,_0x1adb9a,_0x445ed8){return new BPromise(function(_0x50224f,_0x5e3168){return client['request'](_0x5ce467,_0x445ed8)[_0x1089('0xb')](function(_0x14f346){logger['info'](_0x1089('0xc'),_0x1adb9a,'request\x20sent');logger[_0x1089('0xd')](_0x1089('0xe'),_0x1adb9a,_0x1089('0xf'),JSON['stringify'](_0x14f346));if(_0x14f346[_0x1089('0x10')]){if(_0x14f346[_0x1089('0x10')][_0x1089('0x11')]===0x1f4){logger[_0x1089('0x10')](_0x1089('0xc'),_0x1adb9a,_0x14f346[_0x1089('0x10')][_0x1089('0x12')]);return _0x5e3168(_0x14f346[_0x1089('0x10')]['message']);}logger[_0x1089('0x10')](_0x1089('0xc'),_0x1adb9a,_0x14f346[_0x1089('0x10')][_0x1089('0x12')]);return _0x50224f(_0x14f346[_0x1089('0x10')][_0x1089('0x12')]);}else{logger[_0x1089('0x13')](_0x1089('0xc'),_0x1adb9a,'request\x20sent');_0x50224f(_0x14f346[_0x1089('0x14')][_0x1089('0x12')]);}})[_0x1089('0x15')](function(_0x427a24){logger[_0x1089('0x10')](_0x1089('0xc'),_0x1adb9a,_0x427a24);_0x5e3168(_0x427a24);});});}exports[_0x1089('0x16')]=function(_0x5590e0){var _0x5c732a=this;return new Promise(function(_0x15713f,_0x31bebf){return db['Template'][_0x1089('0x17')]({'raw':_0x5590e0['options']?_0x5590e0['options'][_0x1089('0x18')]===undefined?!![]:![]:!![],'where':_0x5590e0['options']?_0x5590e0[_0x1089('0x19')][_0x1089('0x1a')]||null:null,'attributes':_0x5590e0[_0x1089('0x19')]?_0x5590e0[_0x1089('0x19')][_0x1089('0x1b')]||null:null,'limit':_0x5590e0[_0x1089('0x19')]?_0x5590e0[_0x1089('0x19')][_0x1089('0x1c')]||null:null,'include':_0x5590e0['options']?_0x5590e0[_0x1089('0x19')][_0x1089('0x1d')]?_[_0x1089('0x1e')](_0x5590e0['options']['include'],function(_0x40ae40){return{'model':db[_0x40ae40[_0x1089('0x1f')]],'as':_0x40ae40['as'],'attributes':_0x40ae40[_0x1089('0x1b')],'include':_0x40ae40[_0x1089('0x1d')]?_['map'](_0x40ae40[_0x1089('0x1d')],function(_0x45a9dc){return{'model':db[_0x45a9dc[_0x1089('0x1f')]],'as':_0x45a9dc['as'],'attributes':_0x45a9dc[_0x1089('0x1b')],'include':_0x45a9dc[_0x1089('0x1d')]?_['map'](_0x45a9dc[_0x1089('0x1d')],function(_0x5b365e){return{'model':db[_0x5b365e[_0x1089('0x1f')]],'as':_0x5b365e['as'],'attributes':_0x5b365e[_0x1089('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1089('0xb')](function(_0x4c61dd){logger[_0x1089('0x13')](_0x1089('0x16'),_0x5590e0);logger[_0x1089('0xd')](_0x1089('0x16'),_0x5590e0,JSON[_0x1089('0x20')](_0x4c61dd));_0x15713f(_0x4c61dd);})[_0x1089('0x15')](function(_0x2d7966){logger[_0x1089('0x10')](_0x1089('0x16'),_0x2d7966[_0x1089('0x12')],_0x5590e0);_0x31bebf(_0x5c732a['error'](0x1f4,_0x2d7966[_0x1089('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 05cbb30..a47cee7 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 _0x7efc=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAction','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions'];(function(_0x48fc23,_0x4b282d){var _0x512eaf=function(_0x2fd3fe){while(--_0x2fd3fe){_0x48fc23['push'](_0x48fc23['shift']());}};_0x512eaf(++_0x4b282d);}(_0x7efc,0x177));var _0xc7ef=function(_0x15f724,_0x2794ef){_0x15f724=_0x15f724-0x0;var _0x49b152=_0x7efc[_0x15f724];return _0x49b152;};'use strict';var multer=require('multer');var util=require(_0xc7ef('0x0'));var path=require(_0xc7ef('0x1'));var timeout=require(_0xc7ef('0x2'));var express=require(_0xc7ef('0x3'));var router=express[_0xc7ef('0x4')]();var fs_extra=require(_0xc7ef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc7ef('0x6'));var config=require(_0xc7ef('0x7'));var controller=require(_0xc7ef('0x8'));router[_0xc7ef('0x9')]('/',auth[_0xc7ef('0xa')](),controller[_0xc7ef('0xb')]);router[_0xc7ef('0x9')](_0xc7ef('0xc'),auth[_0xc7ef('0xa')](),controller['show']);router['get'](_0xc7ef('0xd'),auth[_0xc7ef('0xa')](),controller[_0xc7ef('0xe')]);router['get'](_0xc7ef('0xf'),auth['isAuthenticated'](),controller[_0xc7ef('0x10')]);router[_0xc7ef('0x9')](_0xc7ef('0x11'),auth[_0xc7ef('0xa')](),controller[_0xc7ef('0x12')]);router[_0xc7ef('0x13')]('/',auth[_0xc7ef('0xa')](),controller[_0xc7ef('0x14')]);router[_0xc7ef('0x13')](_0xc7ef('0xd'),auth[_0xc7ef('0xa')](),controller['addAllCondition']);router[_0xc7ef('0x13')](_0xc7ef('0xf'),auth[_0xc7ef('0xa')](),controller['addAnyCondition']);router[_0xc7ef('0x13')](_0xc7ef('0x11'),auth[_0xc7ef('0xa')](),controller[_0xc7ef('0x15')]);router[_0xc7ef('0x16')](_0xc7ef('0xc'),auth[_0xc7ef('0xa')](),controller['update']);router[_0xc7ef('0x17')](_0xc7ef('0xc'),auth[_0xc7ef('0xa')](),controller[_0xc7ef('0x18')]);module[_0xc7ef('0x19')]=router; \ No newline at end of file +var _0xa1d3=['../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAction','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1d3,0x16c));var _0x3a1d=function(_0x44d28c,_0x3a197b){_0x44d28c=_0x44d28c-0x0;var _0x754673=_0xa1d3[_0x44d28c];return _0x754673;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3a1d('0x0'));var timeout=require(_0x3a1d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3a1d('0x2'));var auth=require(_0x3a1d('0x3'));var interaction=require(_0x3a1d('0x4'));var config=require(_0x3a1d('0x5'));var controller=require(_0x3a1d('0x6'));router[_0x3a1d('0x7')]('/',auth[_0x3a1d('0x8')](),controller['index']);router['get'](_0x3a1d('0x9'),auth[_0x3a1d('0x8')](),controller[_0x3a1d('0xa')]);router[_0x3a1d('0x7')](_0x3a1d('0xb'),auth[_0x3a1d('0x8')](),controller[_0x3a1d('0xc')]);router['get'](_0x3a1d('0xd'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x3a1d('0x7')](_0x3a1d('0xe'),auth[_0x3a1d('0x8')](),controller[_0x3a1d('0xf')]);router[_0x3a1d('0x10')]('/',auth['isAuthenticated'](),controller[_0x3a1d('0x11')]);router[_0x3a1d('0x10')](_0x3a1d('0xb'),auth[_0x3a1d('0x8')](),controller['addAllCondition']);router['post']('/:id/any_conditions',auth[_0x3a1d('0x8')](),controller['addAnyCondition']);router[_0x3a1d('0x10')](_0x3a1d('0xe'),auth[_0x3a1d('0x8')](),controller[_0x3a1d('0x12')]);router['put']('/:id',auth[_0x3a1d('0x8')](),controller[_0x3a1d('0x13')]);router[_0x3a1d('0x14')](_0x3a1d('0x9'),auth[_0x3a1d('0x8')](),controller[_0x3a1d('0x15')]);module[_0x3a1d('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 ef3e565..8adbf0a 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 _0x680f=['STRING','BOOLEAN','sequelize'];(function(_0x41db1f,_0x268c5b){var _0x411a55=function(_0x5e24ff){while(--_0x5e24ff){_0x41db1f['push'](_0x41db1f['shift']());}};_0x411a55(++_0x268c5b);}(_0x680f,0xd7));var _0xf680=function(_0x35c022,_0x2eecb0){_0x35c022=_0x35c022-0x0;var _0x191c01=_0x680f[_0x35c022];return _0x191c01;};'use strict';var Sequelize=require(_0xf680('0x0'));module['exports']={'name':{'type':Sequelize[_0xf680('0x1')]},'channel':{'type':Sequelize[_0xf680('0x1')]},'description':{'type':Sequelize[_0xf680('0x1')]},'status':{'type':Sequelize[_0xf680('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x986a=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4b05b8,_0x19cc49){var _0x1314e7=function(_0x1fe58f){while(--_0x1fe58f){_0x4b05b8['push'](_0x4b05b8['shift']());}};_0x1314e7(++_0x19cc49);}(_0x986a,0x16b));var _0xa986=function(_0x13310c,_0x1efe01){_0x13310c=_0x13310c-0x0;var _0x149348=_0x986a[_0x13310c];return _0x149348;};'use strict';var Sequelize=require(_0xa986('0x0'));module[_0xa986('0x1')]={'name':{'type':Sequelize[_0xa986('0x2')]},'channel':{'type':Sequelize[_0xa986('0x2')]},'description':{'type':Sequelize[_0xa986('0x2')]},'status':{'type':Sequelize[_0xa986('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index e2e2e8d..a872e03 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 _0x9a60=['sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','index','map','Trigger','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','TriggerAnyId','getAllConditions','rawAttributes','getAnyConditions','findOne','nolimit','addAction','Action','pick','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0xc69642,_0x1985ee){var _0xd562=function(_0x1cb79c){while(--_0x1cb79c){_0xc69642['push'](_0xc69642['shift']());}};_0xd562(++_0x1985ee);}(_0x9a60,0x10c));var _0x09a6=function(_0x601e0b,_0x180bda){_0x601e0b=_0x601e0b-0x0;var _0x1d9770=_0x9a60[_0x601e0b];return _0x1d9770;};'use strict';var pdf=require(_0x09a6('0x0'));var emlformat=require(_0x09a6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x09a6('0x2'));var jsonpatch=require(_0x09a6('0x3'));var rp=require('request-promise');var moment=require(_0x09a6('0x4'));var BPromise=require(_0x09a6('0x5'));var Mustache=require(_0x09a6('0x6'));var util=require(_0x09a6('0x7'));var path=require('path');var sox=require(_0x09a6('0x8'));var csv=require(_0x09a6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09a6('0xa'));var _=require('lodash');var squel=require(_0x09a6('0xb'));var crypto=require(_0x09a6('0xc'));var jsforce=require(_0x09a6('0xd'));var deskjs=require(_0x09a6('0xe'));var toCsv=require(_0x09a6('0x9'));var querystring=require(_0x09a6('0xf'));var Papa=require(_0x09a6('0x10'));var Redis=require(_0x09a6('0x11'));var authService=require(_0x09a6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x09a6('0x13'));var hardwareService=require(_0x09a6('0x14'));var logger=require(_0x09a6('0x15'))(_0x09a6('0x16'));var utils=require('../../config/utils');var config=require(_0x09a6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x09a6('0x18'))['db'];function respondWithStatusCode(_0xbb3bff,_0x1144fe){_0x1144fe=_0x1144fe||0xcc;return function(_0x1fc928){if(_0x1fc928){return _0xbb3bff[_0x09a6('0x19')](_0x1144fe);}return _0xbb3bff[_0x09a6('0x1a')](_0x1144fe)[_0x09a6('0x1b')]();};}function respondWithResult(_0x16b543,_0x284cc4){_0x284cc4=_0x284cc4||0xc8;return function(_0x344396){if(_0x344396){return _0x16b543[_0x09a6('0x1a')](_0x284cc4)[_0x09a6('0x1c')](_0x344396);}};}function respondWithFilteredResult(_0x32c422,_0x59c5d1){return function(_0x196a55){if(_0x196a55){var _0xf475e3=_0x196a55[_0x09a6('0x1d')],_0x57cf00=_0x59c5d1[_0x09a6('0x1e')],_0xea0ebb=_0x59c5d1[_0x09a6('0x1e')]+_0x59c5d1['limit'],_0x1cb24e;if(_0xea0ebb>=_0xf475e3){_0xea0ebb=_0xf475e3;_0x1cb24e=0xc8;}else{_0x1cb24e=0xce;}_0x32c422[_0x09a6('0x1a')](_0x1cb24e);return _0x32c422[_0x09a6('0x1f')]('Content-Range',_0x57cf00+'-'+_0xea0ebb+'/'+_0xf475e3)[_0x09a6('0x1c')](_0x196a55);}return null;};}function patchUpdates(_0x538e68){return function(_0x544c7d){try{jsonpatch['apply'](_0x544c7d,_0x538e68,!![]);}catch(_0x497d36){return BPromise[_0x09a6('0x20')](_0x497d36);}return _0x544c7d['save']();};}function saveUpdates(_0x3023f7,_0x3f624b){return function(_0xcc3f7e){if(_0xcc3f7e){return _0xcc3f7e[_0x09a6('0x21')](_0x3023f7)[_0x09a6('0x22')](function(_0x157dc7){return _0x157dc7;});}return null;};}function removeEntity(_0x42d077,_0x2a0501){return function(_0x52a903){if(_0x52a903){return _0x52a903[_0x09a6('0x23')]()[_0x09a6('0x22')](function(){var _0x5a8f12=_0x52a903[_0x09a6('0x24')]({'plain':!![]});var _0x3825c5=_0x09a6('0x25');return db[_0x09a6('0x26')][_0x09a6('0x23')]({'where':{'type':_0x3825c5,'resourceId':_0x5a8f12['id']}})[_0x09a6('0x22')](function(){return _0x52a903;});})[_0x09a6('0x22')](function(){_0x42d077['status'](0xcc)[_0x09a6('0x1b')]();});}};}function handleEntityNotFound(_0x5d904f,_0x29051b){return function(_0x364b34){if(!_0x364b34){_0x5d904f[_0x09a6('0x19')](0x194);}return _0x364b34;};}function handleError(_0x3b9d65,_0x2821fa){_0x2821fa=_0x2821fa||0x1f4;return function(_0x1c06b3){logger[_0x09a6('0x27')](_0x1c06b3['stack']);if(_0x1c06b3[_0x09a6('0x28')]){delete _0x1c06b3[_0x09a6('0x28')];}_0x3b9d65['status'](_0x2821fa)[_0x09a6('0x29')](_0x1c06b3);};}exports[_0x09a6('0x2a')]=function(_0x1c9280,_0x13a4ab){var _0x3a98ed={},_0x34ead2={},_0x15aefd={'count':0x0,'rows':[]};var _0x2a9b0e=_[_0x09a6('0x2b')](db[_0x09a6('0x2c')]['rawAttributes'],function(_0x53cd36){return{'name':_0x53cd36[_0x09a6('0x2d')],'type':_0x53cd36[_0x09a6('0x2e')][_0x09a6('0x2f')]};});_0x34ead2[_0x09a6('0x30')]=_[_0x09a6('0x2b')](_0x2a9b0e,'name');_0x34ead2['query']=_[_0x09a6('0x31')](_0x1c9280['query']);_0x34ead2[_0x09a6('0x32')]=_[_0x09a6('0x33')](_0x34ead2[_0x09a6('0x30')],_0x34ead2[_0x09a6('0x34')]);_0x3a98ed['attributes']=_[_0x09a6('0x33')](_0x34ead2[_0x09a6('0x30')],qs[_0x09a6('0x35')](_0x1c9280[_0x09a6('0x34')][_0x09a6('0x35')]));_0x3a98ed[_0x09a6('0x36')]=_0x3a98ed[_0x09a6('0x36')][_0x09a6('0x37')]?_0x3a98ed[_0x09a6('0x36')]:_0x34ead2[_0x09a6('0x30')];if(!_0x1c9280[_0x09a6('0x34')][_0x09a6('0x38')]('nolimit')){_0x3a98ed[_0x09a6('0x39')]=qs['limit'](_0x1c9280[_0x09a6('0x34')][_0x09a6('0x39')]);_0x3a98ed[_0x09a6('0x1e')]=qs[_0x09a6('0x1e')](_0x1c9280[_0x09a6('0x34')]['offset']);}_0x3a98ed[_0x09a6('0x3a')]=qs[_0x09a6('0x3b')](_0x1c9280[_0x09a6('0x34')]['sort']);_0x3a98ed[_0x09a6('0x3c')]=qs[_0x09a6('0x32')](_['pick'](_0x1c9280[_0x09a6('0x34')],_0x34ead2[_0x09a6('0x32')]),_0x2a9b0e);if(_0x1c9280[_0x09a6('0x34')][_0x09a6('0x3d')]){_0x3a98ed[_0x09a6('0x3c')]=_['merge'](_0x3a98ed[_0x09a6('0x3c')],{'$or':_[_0x09a6('0x2b')](_0x2a9b0e,function(_0x64dd1){if(_0x64dd1[_0x09a6('0x2e')]!==_0x09a6('0x3e')){var _0x8ccb6a={};_0x8ccb6a[_0x64dd1['name']]={'$like':'%'+_0x1c9280[_0x09a6('0x34')][_0x09a6('0x3d')]+'%'};return _0x8ccb6a;}})});}_0x3a98ed=_[_0x09a6('0x3f')]({},_0x3a98ed,_0x1c9280[_0x09a6('0x40')]);var _0xaebf18={'where':_0x3a98ed['where']};return db[_0x09a6('0x2c')][_0x09a6('0x1d')](_0xaebf18)['then'](function(_0x4b4be2){_0x15aefd['count']=_0x4b4be2;if(_0x1c9280[_0x09a6('0x34')]['includeAll']){_0x3a98ed[_0x09a6('0x41')]=[{'all':!![]}];}return db[_0x09a6('0x2c')][_0x09a6('0x42')](_0x3a98ed);})[_0x09a6('0x22')](function(_0x4a5740){_0x15aefd[_0x09a6('0x43')]=_0x4a5740;return _0x15aefd;})[_0x09a6('0x22')](respondWithFilteredResult(_0x13a4ab,_0x3a98ed))[_0x09a6('0x44')](handleError(_0x13a4ab,null));};exports[_0x09a6('0x45')]=function(_0x69c672,_0x29f9fc){var _0xc49e1d={'raw':![],'where':{'id':_0x69c672[_0x09a6('0x46')]['id']}},_0x5605ff={};_0x5605ff['model']=_[_0x09a6('0x31')](db[_0x09a6('0x2c')]['rawAttributes']);_0x5605ff[_0x09a6('0x34')]=_[_0x09a6('0x31')](_0x69c672[_0x09a6('0x34')]);_0x5605ff[_0x09a6('0x32')]=_[_0x09a6('0x33')](_0x5605ff[_0x09a6('0x30')],_0x5605ff[_0x09a6('0x34')]);_0xc49e1d[_0x09a6('0x36')]=_[_0x09a6('0x33')](_0x5605ff['model'],qs[_0x09a6('0x35')](_0x69c672['query']['fields']));_0xc49e1d[_0x09a6('0x36')]=_0xc49e1d[_0x09a6('0x36')][_0x09a6('0x37')]?_0xc49e1d['attributes']:_0x5605ff[_0x09a6('0x30')];if(_0x69c672['query'][_0x09a6('0x47')]){_0xc49e1d[_0x09a6('0x41')]=[{'all':!![]}];}_0xc49e1d=_['merge']({},_0xc49e1d,_0x69c672['options']);return db['Trigger']['find'](_0xc49e1d)[_0x09a6('0x22')](handleEntityNotFound(_0x29f9fc,null))[_0x09a6('0x22')](respondWithResult(_0x29f9fc,null))['catch'](handleError(_0x29f9fc,null));};exports[_0x09a6('0x48')]=function(_0x2281ee,_0x4f5fb1){return db[_0x09a6('0x2c')][_0x09a6('0x48')](_0x2281ee[_0x09a6('0x49')],{})[_0x09a6('0x22')](function(_0x5e41bf){var _0x5ebaa6=_0x2281ee[_0x09a6('0x4a')][_0x09a6('0x24')]({'plain':!![]});if(!_0x5ebaa6)throw new Error(_0x09a6('0x4b'));if(_0x5ebaa6['role']===_0x09a6('0x4a')){var _0x419c6d=_0x5e41bf[_0x09a6('0x24')]({'plain':!![]});var _0x1b8384='Triggers';return db[_0x09a6('0x4c')][_0x09a6('0x4d')]({'where':{'name':_0x1b8384,'userProfileId':_0x5ebaa6[_0x09a6('0x4e')]},'raw':!![]})['then'](function(_0x3a2614){if(_0x3a2614&&_0x3a2614['autoAssociation']===0x0){return db[_0x09a6('0x26')]['create']({'name':_0x419c6d[_0x09a6('0x28')],'resourceId':_0x419c6d['id'],'type':_0x3a2614['name'],'sectionId':_0x3a2614['id']},{})[_0x09a6('0x22')](function(){return _0x5e41bf;});}else{return _0x5e41bf;}})[_0x09a6('0x44')](function(_0x30ba22){logger[_0x09a6('0x27')](_0x09a6('0x4f'),_0x30ba22);throw _0x30ba22;});}return _0x5e41bf;})[_0x09a6('0x22')](respondWithResult(_0x4f5fb1,0xc9))[_0x09a6('0x44')](handleError(_0x4f5fb1,null));};exports['update']=function(_0x13a550,_0xfb38e5){if(_0x13a550[_0x09a6('0x49')]['id']){delete _0x13a550['body']['id'];}return db[_0x09a6('0x2c')][_0x09a6('0x4d')]({'where':{'id':_0x13a550[_0x09a6('0x46')]['id']}})['then'](handleEntityNotFound(_0xfb38e5,null))['then'](saveUpdates(_0x13a550[_0x09a6('0x49')],null))[_0x09a6('0x22')](respondWithResult(_0xfb38e5,null))[_0x09a6('0x44')](handleError(_0xfb38e5,null));};exports[_0x09a6('0x23')]=function(_0x794017,_0x190d2c){return db['Trigger'][_0x09a6('0x4d')]({'where':{'id':_0x794017[_0x09a6('0x46')]['id']}})[_0x09a6('0x22')](handleEntityNotFound(_0x190d2c,null))[_0x09a6('0x22')](removeEntity(_0x190d2c,null))[_0x09a6('0x44')](handleError(_0x190d2c,null));};exports['addAllCondition']=function(_0x198cb,_0x303840,_0x23ce3a){if(_0x198cb[_0x09a6('0x49')]['id']){delete _0x198cb[_0x09a6('0x49')]['id'];}return db[_0x09a6('0x2c')]['find']({'where':{'id':_0x198cb[_0x09a6('0x46')]['id']}})[_0x09a6('0x22')](handleEntityNotFound(_0x303840,null))['then'](function(_0xddcd75){if(_0xddcd75){_0x198cb[_0x09a6('0x49')][_0x09a6('0x50')]=_0xddcd75['id'];return db[_0x09a6('0x51')][_0x09a6('0x48')](_0x198cb[_0x09a6('0x49')]);}})[_0x09a6('0x22')](respondWithResult(_0x303840,null))[_0x09a6('0x44')](handleError(_0x303840,null));};exports['addAnyCondition']=function(_0x1e4b13,_0x5c3129,_0x405b11){if(_0x1e4b13['body']['id']){delete _0x1e4b13[_0x09a6('0x49')]['id'];}return db[_0x09a6('0x2c')][_0x09a6('0x4d')]({'where':{'id':_0x1e4b13[_0x09a6('0x46')]['id']}})[_0x09a6('0x22')](handleEntityNotFound(_0x5c3129,null))[_0x09a6('0x22')](function(_0x64fabd){if(_0x64fabd){_0x1e4b13[_0x09a6('0x49')][_0x09a6('0x52')]=_0x64fabd['id'];return db[_0x09a6('0x51')][_0x09a6('0x48')](_0x1e4b13[_0x09a6('0x49')]);}})[_0x09a6('0x22')](respondWithResult(_0x5c3129,null))['catch'](handleError(_0x5c3129,null));};exports[_0x09a6('0x53')]=function(_0x28cca8,_0x254f72,_0x4f8b23){var _0x35bd7f={};var _0x318779={};var _0x3537d2;var _0x59c94b;return db[_0x09a6('0x2c')]['findOne']({'where':{'id':_0x28cca8[_0x09a6('0x46')]['id']}})[_0x09a6('0x22')](handleEntityNotFound(_0x254f72,null))[_0x09a6('0x22')](function(_0x2669db){if(_0x2669db){_0x3537d2=_0x2669db;_0x318779[_0x09a6('0x30')]=_[_0x09a6('0x31')](db[_0x09a6('0x51')][_0x09a6('0x54')]);_0x318779['query']=_[_0x09a6('0x31')](_0x28cca8[_0x09a6('0x34')]);_0x318779[_0x09a6('0x32')]=_[_0x09a6('0x33')](_0x318779['model'],_0x318779['query']);_0x35bd7f[_0x09a6('0x36')]=_['intersection'](_0x318779[_0x09a6('0x30')],qs['fields'](_0x28cca8['query']['fields']));_0x35bd7f[_0x09a6('0x36')]=_0x35bd7f[_0x09a6('0x36')][_0x09a6('0x37')]?_0x35bd7f[_0x09a6('0x36')]:_0x318779[_0x09a6('0x30')];_0x35bd7f['order']=qs[_0x09a6('0x3b')](_0x28cca8[_0x09a6('0x34')][_0x09a6('0x3b')]);_0x35bd7f['where']=qs[_0x09a6('0x32')](_['pick'](_0x28cca8[_0x09a6('0x34')],_0x318779[_0x09a6('0x32')]));if(_0x28cca8['query'][_0x09a6('0x3d')]){_0x35bd7f[_0x09a6('0x3c')]=_['merge'](_0x35bd7f['where'],{'$or':_[_0x09a6('0x2b')](_0x35bd7f[_0x09a6('0x36')],function(_0x2bb0ca){var _0xb88cea={};_0xb88cea[_0x2bb0ca]={'$like':'%'+_0x28cca8[_0x09a6('0x34')]['filter']+'%'};return _0xb88cea;})});}_0x35bd7f=_[_0x09a6('0x3f')]({},_0x35bd7f,_0x28cca8['options']);return _0x3537d2[_0x09a6('0x53')](_0x35bd7f);}})['then'](function(_0x4b2d09){if(_0x4b2d09){_0x59c94b=_0x4b2d09[_0x09a6('0x37')];if(!_0x28cca8['query'][_0x09a6('0x38')]('nolimit')){_0x35bd7f[_0x09a6('0x39')]=qs[_0x09a6('0x39')](_0x28cca8[_0x09a6('0x34')][_0x09a6('0x39')]);_0x35bd7f[_0x09a6('0x1e')]=qs[_0x09a6('0x1e')](_0x28cca8[_0x09a6('0x34')][_0x09a6('0x1e')]);}return _0x3537d2[_0x09a6('0x53')](_0x35bd7f);}})[_0x09a6('0x22')](function(_0x250e77){if(_0x250e77){return _0x250e77?{'count':_0x59c94b,'rows':_0x250e77}:null;}})[_0x09a6('0x22')](respondWithResult(_0x254f72,null))[_0x09a6('0x44')](handleError(_0x254f72,null));};exports[_0x09a6('0x55')]=function(_0x51004b,_0x3ecd15,_0x4e3e14){var _0x125cdc={};var _0x3a45af={};var _0x2fc7db;var _0x8eb75a;return db['Trigger'][_0x09a6('0x56')]({'where':{'id':_0x51004b[_0x09a6('0x46')]['id']}})[_0x09a6('0x22')](handleEntityNotFound(_0x3ecd15,null))[_0x09a6('0x22')](function(_0x3cf9dc){if(_0x3cf9dc){_0x2fc7db=_0x3cf9dc;_0x3a45af['model']=_[_0x09a6('0x31')](db['Condition'][_0x09a6('0x54')]);_0x3a45af[_0x09a6('0x34')]=_['keys'](_0x51004b[_0x09a6('0x34')]);_0x3a45af[_0x09a6('0x32')]=_[_0x09a6('0x33')](_0x3a45af[_0x09a6('0x30')],_0x3a45af[_0x09a6('0x34')]);_0x125cdc[_0x09a6('0x36')]=_['intersection'](_0x3a45af[_0x09a6('0x30')],qs[_0x09a6('0x35')](_0x51004b[_0x09a6('0x34')][_0x09a6('0x35')]));_0x125cdc[_0x09a6('0x36')]=_0x125cdc['attributes'][_0x09a6('0x37')]?_0x125cdc['attributes']:_0x3a45af[_0x09a6('0x30')];_0x125cdc[_0x09a6('0x3a')]=qs['sort'](_0x51004b[_0x09a6('0x34')][_0x09a6('0x3b')]);_0x125cdc['where']=qs['filters'](_['pick'](_0x51004b[_0x09a6('0x34')],_0x3a45af[_0x09a6('0x32')]));if(_0x51004b['query'][_0x09a6('0x3d')]){_0x125cdc['where']=_[_0x09a6('0x3f')](_0x125cdc['where'],{'$or':_[_0x09a6('0x2b')](_0x125cdc[_0x09a6('0x36')],function(_0x21ba80){var _0x4271da={};_0x4271da[_0x21ba80]={'$like':'%'+_0x51004b['query'][_0x09a6('0x3d')]+'%'};return _0x4271da;})});}_0x125cdc=_[_0x09a6('0x3f')]({},_0x125cdc,_0x51004b['options']);return _0x2fc7db[_0x09a6('0x55')](_0x125cdc);}})[_0x09a6('0x22')](function(_0x5dbd36){if(_0x5dbd36){_0x8eb75a=_0x5dbd36['length'];if(!_0x51004b[_0x09a6('0x34')][_0x09a6('0x38')](_0x09a6('0x57'))){_0x125cdc['limit']=qs[_0x09a6('0x39')](_0x51004b[_0x09a6('0x34')]['limit']);_0x125cdc['offset']=qs[_0x09a6('0x1e')](_0x51004b[_0x09a6('0x34')][_0x09a6('0x1e')]);}return _0x2fc7db[_0x09a6('0x55')](_0x125cdc);}})[_0x09a6('0x22')](function(_0x3fc51a){if(_0x3fc51a){return _0x3fc51a?{'count':_0x8eb75a,'rows':_0x3fc51a}:null;}})[_0x09a6('0x22')](respondWithResult(_0x3ecd15,null))[_0x09a6('0x44')](handleError(_0x3ecd15,null));};exports[_0x09a6('0x58')]=function(_0x1916fc,_0x3d1384,_0x4d853f){if(_0x1916fc[_0x09a6('0x49')]['id']){delete _0x1916fc[_0x09a6('0x49')]['id'];}return db[_0x09a6('0x2c')][_0x09a6('0x4d')]({'where':{'id':_0x1916fc[_0x09a6('0x46')]['id']}})[_0x09a6('0x22')](handleEntityNotFound(_0x3d1384,null))['then'](function(_0x4edac5){if(_0x4edac5){_0x1916fc['body']['TriggerId']=_0x4edac5['id'];return db[_0x09a6('0x59')][_0x09a6('0x48')](_0x1916fc[_0x09a6('0x49')]);}})[_0x09a6('0x22')](respondWithResult(_0x3d1384,null))['catch'](handleError(_0x3d1384,null));};exports['getActions']=function(_0x32aec4,_0x80e47c,_0xa8bfe){var _0x4a4d24={};var _0xbf5f65={};var _0x3a357a;var _0x3cfbdb;return db[_0x09a6('0x2c')]['findOne']({'where':{'id':_0x32aec4[_0x09a6('0x46')]['id']}})[_0x09a6('0x22')](handleEntityNotFound(_0x80e47c,null))[_0x09a6('0x22')](function(_0xe05549){if(_0xe05549){_0x3a357a=_0xe05549;_0xbf5f65['model']=_[_0x09a6('0x31')](db['Action'][_0x09a6('0x54')]);_0xbf5f65[_0x09a6('0x34')]=_['keys'](_0x32aec4['query']);_0xbf5f65['filters']=_[_0x09a6('0x33')](_0xbf5f65[_0x09a6('0x30')],_0xbf5f65[_0x09a6('0x34')]);_0x4a4d24[_0x09a6('0x36')]=_['intersection'](_0xbf5f65[_0x09a6('0x30')],qs['fields'](_0x32aec4[_0x09a6('0x34')]['fields']));_0x4a4d24[_0x09a6('0x36')]=_0x4a4d24['attributes']['length']?_0x4a4d24[_0x09a6('0x36')]:_0xbf5f65['model'];_0x4a4d24['order']=qs[_0x09a6('0x3b')](_0x32aec4[_0x09a6('0x34')][_0x09a6('0x3b')]);_0x4a4d24[_0x09a6('0x3c')]=qs[_0x09a6('0x32')](_[_0x09a6('0x5a')](_0x32aec4['query'],_0xbf5f65[_0x09a6('0x32')]));if(_0x32aec4[_0x09a6('0x34')][_0x09a6('0x3d')]){_0x4a4d24[_0x09a6('0x3c')]=_[_0x09a6('0x3f')](_0x4a4d24[_0x09a6('0x3c')],{'$or':_['map'](_0x4a4d24[_0x09a6('0x36')],function(_0x55b286){var _0xbbcb88={};_0xbbcb88[_0x55b286]={'$like':'%'+_0x32aec4['query']['filter']+'%'};return _0xbbcb88;})});}_0x4a4d24=_[_0x09a6('0x3f')]({},_0x4a4d24,_0x32aec4[_0x09a6('0x40')]);return _0x3a357a[_0x09a6('0x5b')](_0x4a4d24);}})[_0x09a6('0x22')](function(_0x1279ef){if(_0x1279ef){_0x3cfbdb=_0x1279ef[_0x09a6('0x37')];if(!_0x32aec4[_0x09a6('0x34')]['hasOwnProperty']('nolimit')){_0x4a4d24['limit']=qs['limit'](_0x32aec4[_0x09a6('0x34')]['limit']);_0x4a4d24[_0x09a6('0x1e')]=qs['offset'](_0x32aec4['query'][_0x09a6('0x1e')]);}return _0x3a357a[_0x09a6('0x5b')](_0x4a4d24);}})[_0x09a6('0x22')](function(_0x31b7ba){if(_0x31b7ba){return _0x31b7ba?{'count':_0x3cfbdb,'rows':_0x31b7ba}:null;}})[_0x09a6('0x22')](respondWithResult(_0x80e47c,null))['catch'](handleError(_0x80e47c,null));}; \ No newline at end of file +var _0xc426=['show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','merge','nolimit','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','destroy','get','Triggers','error','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0xbbe1a5,_0x361460){var _0x193d39=function(_0x155a8d){while(--_0x155a8d){_0xbbe1a5['push'](_0xbbe1a5['shift']());}};_0x193d39(++_0x361460);}(_0xc426,0x1f3));var _0x6c42=function(_0x6e1aaf,_0x1c0898){_0x6e1aaf=_0x6e1aaf-0x0;var _0x5026a1=_0xc426[_0x6e1aaf];return _0x5026a1;};'use strict';var pdf=require(_0x6c42('0x0'));var emlformat=require(_0x6c42('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6c42('0x2'));var jsonpatch=require(_0x6c42('0x3'));var rp=require(_0x6c42('0x4'));var moment=require(_0x6c42('0x5'));var BPromise=require(_0x6c42('0x6'));var Mustache=require(_0x6c42('0x7'));var util=require(_0x6c42('0x8'));var path=require('path');var sox=require(_0x6c42('0x9'));var csv=require(_0x6c42('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c42('0xb'));var squel=require(_0x6c42('0xc'));var crypto=require(_0x6c42('0xd'));var jsforce=require(_0x6c42('0xe'));var deskjs=require(_0x6c42('0xf'));var toCsv=require(_0x6c42('0xa'));var querystring=require(_0x6c42('0x10'));var Papa=require(_0x6c42('0x11'));var Redis=require('ioredis');var authService=require(_0x6c42('0x12'));var qs=require(_0x6c42('0x13'));var as=require(_0x6c42('0x14'));var hardwareService=require(_0x6c42('0x15'));var logger=require(_0x6c42('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x6c42('0x17'));var licenseUtil=require(_0x6c42('0x18'));var db=require(_0x6c42('0x19'))['db'];function respondWithStatusCode(_0x244bc7,_0xae542e){_0xae542e=_0xae542e||0xcc;return function(_0x14d877){if(_0x14d877){return _0x244bc7[_0x6c42('0x1a')](_0xae542e);}return _0x244bc7[_0x6c42('0x1b')](_0xae542e)[_0x6c42('0x1c')]();};}function respondWithResult(_0x1779b0,_0x5003f0){_0x5003f0=_0x5003f0||0xc8;return function(_0x308891){if(_0x308891){return _0x1779b0[_0x6c42('0x1b')](_0x5003f0)[_0x6c42('0x1d')](_0x308891);}};}function respondWithFilteredResult(_0x12c995,_0x3693ee){return function(_0x54e922){if(_0x54e922){var _0x5845e1=_0x54e922[_0x6c42('0x1e')],_0x3eeafe=_0x3693ee['offset'],_0xfbdf5c=_0x3693ee[_0x6c42('0x1f')]+_0x3693ee[_0x6c42('0x20')],_0x426e04;if(_0xfbdf5c>=_0x5845e1){_0xfbdf5c=_0x5845e1;_0x426e04=0xc8;}else{_0x426e04=0xce;}_0x12c995[_0x6c42('0x1b')](_0x426e04);return _0x12c995[_0x6c42('0x21')](_0x6c42('0x22'),_0x3eeafe+'-'+_0xfbdf5c+'/'+_0x5845e1)[_0x6c42('0x1d')](_0x54e922);}return null;};}function patchUpdates(_0x243f72){return function(_0xced796){try{jsonpatch['apply'](_0xced796,_0x243f72,!![]);}catch(_0x53f8d1){return BPromise[_0x6c42('0x23')](_0x53f8d1);}return _0xced796['save']();};}function saveUpdates(_0x423593,_0x3618aa){return function(_0x1085c2){if(_0x1085c2){return _0x1085c2['update'](_0x423593)[_0x6c42('0x24')](function(_0x26af52){return _0x26af52;});}return null;};}function removeEntity(_0x2f504d,_0x41861b){return function(_0x2239d6){if(_0x2239d6){return _0x2239d6[_0x6c42('0x25')]()[_0x6c42('0x24')](function(){var _0x2ccd38=_0x2239d6[_0x6c42('0x26')]({'plain':!![]});var _0x4cb516=_0x6c42('0x27');return db['UserProfileResource'][_0x6c42('0x25')]({'where':{'type':_0x4cb516,'resourceId':_0x2ccd38['id']}})[_0x6c42('0x24')](function(){return _0x2239d6;});})[_0x6c42('0x24')](function(){_0x2f504d[_0x6c42('0x1b')](0xcc)[_0x6c42('0x1c')]();});}};}function handleEntityNotFound(_0x2a03f0,_0x287a74){return function(_0x48b54e){if(!_0x48b54e){_0x2a03f0[_0x6c42('0x1a')](0x194);}return _0x48b54e;};}function handleError(_0x78f764,_0x5befc4){_0x5befc4=_0x5befc4||0x1f4;return function(_0x8d33c5){logger[_0x6c42('0x28')](_0x8d33c5['stack']);if(_0x8d33c5['name']){delete _0x8d33c5[_0x6c42('0x29')];}_0x78f764[_0x6c42('0x1b')](_0x5befc4)[_0x6c42('0x2a')](_0x8d33c5);};}exports[_0x6c42('0x2b')]=function(_0x1a69bd,_0xd5eb6c){var _0xf78c50={},_0x9ed2a0={},_0x35076e={'count':0x0,'rows':[]};var _0x5b66bf=_[_0x6c42('0x2c')](db[_0x6c42('0x2d')][_0x6c42('0x2e')],function(_0x51d562){return{'name':_0x51d562[_0x6c42('0x2f')],'type':_0x51d562['type'][_0x6c42('0x30')]};});_0x9ed2a0[_0x6c42('0x31')]=_[_0x6c42('0x2c')](_0x5b66bf,_0x6c42('0x29'));_0x9ed2a0['query']=_[_0x6c42('0x32')](_0x1a69bd[_0x6c42('0x33')]);_0x9ed2a0[_0x6c42('0x34')]=_[_0x6c42('0x35')](_0x9ed2a0[_0x6c42('0x31')],_0x9ed2a0['query']);_0xf78c50['attributes']=_[_0x6c42('0x35')](_0x9ed2a0[_0x6c42('0x31')],qs[_0x6c42('0x36')](_0x1a69bd[_0x6c42('0x33')][_0x6c42('0x36')]));_0xf78c50[_0x6c42('0x37')]=_0xf78c50['attributes'][_0x6c42('0x38')]?_0xf78c50[_0x6c42('0x37')]:_0x9ed2a0[_0x6c42('0x31')];if(!_0x1a69bd[_0x6c42('0x33')][_0x6c42('0x39')]('nolimit')){_0xf78c50[_0x6c42('0x20')]=qs[_0x6c42('0x20')](_0x1a69bd['query']['limit']);_0xf78c50[_0x6c42('0x1f')]=qs['offset'](_0x1a69bd[_0x6c42('0x33')][_0x6c42('0x1f')]);}_0xf78c50[_0x6c42('0x3a')]=qs[_0x6c42('0x3b')](_0x1a69bd[_0x6c42('0x33')]['sort']);_0xf78c50[_0x6c42('0x3c')]=qs['filters'](_[_0x6c42('0x3d')](_0x1a69bd['query'],_0x9ed2a0[_0x6c42('0x34')]),_0x5b66bf);if(_0x1a69bd[_0x6c42('0x33')][_0x6c42('0x3e')]){_0xf78c50[_0x6c42('0x3c')]=_['merge'](_0xf78c50[_0x6c42('0x3c')],{'$or':_[_0x6c42('0x2c')](_0x5b66bf,function(_0x38a62b){if(_0x38a62b[_0x6c42('0x3f')]!==_0x6c42('0x40')){var _0x2b33b6={};_0x2b33b6[_0x38a62b[_0x6c42('0x29')]]={'$like':'%'+_0x1a69bd['query']['filter']+'%'};return _0x2b33b6;}})});}_0xf78c50=_['merge']({},_0xf78c50,_0x1a69bd[_0x6c42('0x41')]);var _0x45608d={'where':_0xf78c50[_0x6c42('0x3c')]};return db[_0x6c42('0x2d')][_0x6c42('0x1e')](_0x45608d)[_0x6c42('0x24')](function(_0x150ae0){_0x35076e[_0x6c42('0x1e')]=_0x150ae0;if(_0x1a69bd[_0x6c42('0x33')][_0x6c42('0x42')]){_0xf78c50[_0x6c42('0x43')]=[{'all':!![]}];}return db['Trigger'][_0x6c42('0x44')](_0xf78c50);})[_0x6c42('0x24')](function(_0x588503){_0x35076e[_0x6c42('0x45')]=_0x588503;return _0x35076e;})['then'](respondWithFilteredResult(_0xd5eb6c,_0xf78c50))[_0x6c42('0x46')](handleError(_0xd5eb6c,null));};exports[_0x6c42('0x47')]=function(_0x1fd6a7,_0x3ed63c){var _0x5eb155={'raw':![],'where':{'id':_0x1fd6a7[_0x6c42('0x48')]['id']}},_0x566b63={};_0x566b63[_0x6c42('0x31')]=_['keys'](db[_0x6c42('0x2d')][_0x6c42('0x2e')]);_0x566b63[_0x6c42('0x33')]=_[_0x6c42('0x32')](_0x1fd6a7['query']);_0x566b63['filters']=_[_0x6c42('0x35')](_0x566b63[_0x6c42('0x31')],_0x566b63[_0x6c42('0x33')]);_0x5eb155[_0x6c42('0x37')]=_[_0x6c42('0x35')](_0x566b63['model'],qs['fields'](_0x1fd6a7[_0x6c42('0x33')][_0x6c42('0x36')]));_0x5eb155[_0x6c42('0x37')]=_0x5eb155[_0x6c42('0x37')][_0x6c42('0x38')]?_0x5eb155[_0x6c42('0x37')]:_0x566b63[_0x6c42('0x31')];if(_0x1fd6a7[_0x6c42('0x33')][_0x6c42('0x42')]){_0x5eb155[_0x6c42('0x43')]=[{'all':!![]}];}_0x5eb155=_['merge']({},_0x5eb155,_0x1fd6a7[_0x6c42('0x41')]);return db['Trigger']['find'](_0x5eb155)[_0x6c42('0x24')](handleEntityNotFound(_0x3ed63c,null))[_0x6c42('0x24')](respondWithResult(_0x3ed63c,null))['catch'](handleError(_0x3ed63c,null));};exports[_0x6c42('0x49')]=function(_0x5c3871,_0x1cdce8){return db[_0x6c42('0x2d')]['create'](_0x5c3871[_0x6c42('0x4a')],{})[_0x6c42('0x24')](function(_0x4c494e){var _0x32a890=_0x5c3871[_0x6c42('0x4b')]['get']({'plain':!![]});if(!_0x32a890)throw new Error(_0x6c42('0x4c'));if(_0x32a890[_0x6c42('0x4d')]===_0x6c42('0x4b')){var _0x2a1cc8=_0x4c494e[_0x6c42('0x26')]({'plain':!![]});var _0x3e3bf0=_0x6c42('0x27');return db['UserProfileSection'][_0x6c42('0x4e')]({'where':{'name':_0x3e3bf0,'userProfileId':_0x32a890[_0x6c42('0x4f')]},'raw':!![]})[_0x6c42('0x24')](function(_0x12b01b){if(_0x12b01b&&_0x12b01b['autoAssociation']===0x0){return db['UserProfileResource'][_0x6c42('0x49')]({'name':_0x2a1cc8[_0x6c42('0x29')],'resourceId':_0x2a1cc8['id'],'type':_0x12b01b[_0x6c42('0x29')],'sectionId':_0x12b01b['id']},{})['then'](function(){return _0x4c494e;});}else{return _0x4c494e;}})['catch'](function(_0x4492d2){logger[_0x6c42('0x28')](_0x6c42('0x50'),_0x4492d2);throw _0x4492d2;});}return _0x4c494e;})[_0x6c42('0x24')](respondWithResult(_0x1cdce8,0xc9))[_0x6c42('0x46')](handleError(_0x1cdce8,null));};exports[_0x6c42('0x51')]=function(_0x3d7aaa,_0x367153){if(_0x3d7aaa[_0x6c42('0x4a')]['id']){delete _0x3d7aaa[_0x6c42('0x4a')]['id'];}return db[_0x6c42('0x2d')][_0x6c42('0x4e')]({'where':{'id':_0x3d7aaa['params']['id']}})[_0x6c42('0x24')](handleEntityNotFound(_0x367153,null))[_0x6c42('0x24')](saveUpdates(_0x3d7aaa['body'],null))['then'](respondWithResult(_0x367153,null))[_0x6c42('0x46')](handleError(_0x367153,null));};exports[_0x6c42('0x25')]=function(_0x3f5c5e,_0x5d52e7){return db[_0x6c42('0x2d')][_0x6c42('0x4e')]({'where':{'id':_0x3f5c5e[_0x6c42('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d52e7,null))[_0x6c42('0x24')](removeEntity(_0x5d52e7,null))[_0x6c42('0x46')](handleError(_0x5d52e7,null));};exports[_0x6c42('0x52')]=function(_0x479a4f,_0x2f18f2,_0x41e321){if(_0x479a4f[_0x6c42('0x4a')]['id']){delete _0x479a4f['body']['id'];}return db[_0x6c42('0x2d')]['find']({'where':{'id':_0x479a4f['params']['id']}})['then'](handleEntityNotFound(_0x2f18f2,null))[_0x6c42('0x24')](function(_0x37f086){if(_0x37f086){_0x479a4f['body'][_0x6c42('0x53')]=_0x37f086['id'];return db[_0x6c42('0x54')][_0x6c42('0x49')](_0x479a4f[_0x6c42('0x4a')]);}})[_0x6c42('0x24')](respondWithResult(_0x2f18f2,null))[_0x6c42('0x46')](handleError(_0x2f18f2,null));};exports[_0x6c42('0x55')]=function(_0x640fd,_0x474c30,_0x21ef5a){if(_0x640fd[_0x6c42('0x4a')]['id']){delete _0x640fd[_0x6c42('0x4a')]['id'];}return db['Trigger'][_0x6c42('0x4e')]({'where':{'id':_0x640fd['params']['id']}})['then'](handleEntityNotFound(_0x474c30,null))[_0x6c42('0x24')](function(_0x4a3f4c){if(_0x4a3f4c){_0x640fd[_0x6c42('0x4a')][_0x6c42('0x56')]=_0x4a3f4c['id'];return db[_0x6c42('0x54')][_0x6c42('0x49')](_0x640fd[_0x6c42('0x4a')]);}})[_0x6c42('0x24')](respondWithResult(_0x474c30,null))[_0x6c42('0x46')](handleError(_0x474c30,null));};exports[_0x6c42('0x57')]=function(_0xc3d5c,_0x1df17b,_0x571518){var _0x4df0d5={};var _0x366fdf={};var _0x18282c;var _0xd0f475;return db[_0x6c42('0x2d')][_0x6c42('0x58')]({'where':{'id':_0xc3d5c[_0x6c42('0x48')]['id']}})[_0x6c42('0x24')](handleEntityNotFound(_0x1df17b,null))[_0x6c42('0x24')](function(_0x4e1e27){if(_0x4e1e27){_0x18282c=_0x4e1e27;_0x366fdf[_0x6c42('0x31')]=_[_0x6c42('0x32')](db[_0x6c42('0x54')][_0x6c42('0x2e')]);_0x366fdf[_0x6c42('0x33')]=_['keys'](_0xc3d5c[_0x6c42('0x33')]);_0x366fdf[_0x6c42('0x34')]=_[_0x6c42('0x35')](_0x366fdf[_0x6c42('0x31')],_0x366fdf[_0x6c42('0x33')]);_0x4df0d5['attributes']=_[_0x6c42('0x35')](_0x366fdf[_0x6c42('0x31')],qs['fields'](_0xc3d5c['query']['fields']));_0x4df0d5['attributes']=_0x4df0d5[_0x6c42('0x37')][_0x6c42('0x38')]?_0x4df0d5[_0x6c42('0x37')]:_0x366fdf['model'];_0x4df0d5[_0x6c42('0x3a')]=qs[_0x6c42('0x3b')](_0xc3d5c[_0x6c42('0x33')][_0x6c42('0x3b')]);_0x4df0d5[_0x6c42('0x3c')]=qs[_0x6c42('0x34')](_[_0x6c42('0x3d')](_0xc3d5c[_0x6c42('0x33')],_0x366fdf[_0x6c42('0x34')]));if(_0xc3d5c[_0x6c42('0x33')][_0x6c42('0x3e')]){_0x4df0d5[_0x6c42('0x3c')]=_[_0x6c42('0x59')](_0x4df0d5[_0x6c42('0x3c')],{'$or':_['map'](_0x4df0d5[_0x6c42('0x37')],function(_0x43f027){var _0x4b4115={};_0x4b4115[_0x43f027]={'$like':'%'+_0xc3d5c['query'][_0x6c42('0x3e')]+'%'};return _0x4b4115;})});}_0x4df0d5=_[_0x6c42('0x59')]({},_0x4df0d5,_0xc3d5c[_0x6c42('0x41')]);return _0x18282c[_0x6c42('0x57')](_0x4df0d5);}})[_0x6c42('0x24')](function(_0x1672b1){if(_0x1672b1){_0xd0f475=_0x1672b1[_0x6c42('0x38')];if(!_0xc3d5c[_0x6c42('0x33')][_0x6c42('0x39')](_0x6c42('0x5a'))){_0x4df0d5[_0x6c42('0x20')]=qs[_0x6c42('0x20')](_0xc3d5c[_0x6c42('0x33')]['limit']);_0x4df0d5[_0x6c42('0x1f')]=qs[_0x6c42('0x1f')](_0xc3d5c[_0x6c42('0x33')][_0x6c42('0x1f')]);}return _0x18282c[_0x6c42('0x57')](_0x4df0d5);}})[_0x6c42('0x24')](function(_0x153065){if(_0x153065){return _0x153065?{'count':_0xd0f475,'rows':_0x153065}:null;}})[_0x6c42('0x24')](respondWithResult(_0x1df17b,null))[_0x6c42('0x46')](handleError(_0x1df17b,null));};exports[_0x6c42('0x5b')]=function(_0x2215cb,_0x5987f7,_0x432b12){var _0x69e5dc={};var _0x5339c3={};var _0x127148;var _0x3c42c1;return db[_0x6c42('0x2d')][_0x6c42('0x58')]({'where':{'id':_0x2215cb[_0x6c42('0x48')]['id']}})['then'](handleEntityNotFound(_0x5987f7,null))['then'](function(_0x3cc4a){if(_0x3cc4a){_0x127148=_0x3cc4a;_0x5339c3[_0x6c42('0x31')]=_['keys'](db[_0x6c42('0x54')][_0x6c42('0x2e')]);_0x5339c3['query']=_[_0x6c42('0x32')](_0x2215cb[_0x6c42('0x33')]);_0x5339c3[_0x6c42('0x34')]=_[_0x6c42('0x35')](_0x5339c3[_0x6c42('0x31')],_0x5339c3[_0x6c42('0x33')]);_0x69e5dc[_0x6c42('0x37')]=_[_0x6c42('0x35')](_0x5339c3[_0x6c42('0x31')],qs['fields'](_0x2215cb[_0x6c42('0x33')]['fields']));_0x69e5dc[_0x6c42('0x37')]=_0x69e5dc[_0x6c42('0x37')][_0x6c42('0x38')]?_0x69e5dc[_0x6c42('0x37')]:_0x5339c3['model'];_0x69e5dc[_0x6c42('0x3a')]=qs[_0x6c42('0x3b')](_0x2215cb['query'][_0x6c42('0x3b')]);_0x69e5dc['where']=qs[_0x6c42('0x34')](_[_0x6c42('0x3d')](_0x2215cb[_0x6c42('0x33')],_0x5339c3[_0x6c42('0x34')]));if(_0x2215cb[_0x6c42('0x33')]['filter']){_0x69e5dc[_0x6c42('0x3c')]=_['merge'](_0x69e5dc[_0x6c42('0x3c')],{'$or':_['map'](_0x69e5dc[_0x6c42('0x37')],function(_0x2d3c04){var _0x1d9728={};_0x1d9728[_0x2d3c04]={'$like':'%'+_0x2215cb[_0x6c42('0x33')][_0x6c42('0x3e')]+'%'};return _0x1d9728;})});}_0x69e5dc=_[_0x6c42('0x59')]({},_0x69e5dc,_0x2215cb[_0x6c42('0x41')]);return _0x127148['getAnyConditions'](_0x69e5dc);}})[_0x6c42('0x24')](function(_0x1b4e7a){if(_0x1b4e7a){_0x3c42c1=_0x1b4e7a[_0x6c42('0x38')];if(!_0x2215cb[_0x6c42('0x33')][_0x6c42('0x39')](_0x6c42('0x5a'))){_0x69e5dc[_0x6c42('0x20')]=qs['limit'](_0x2215cb['query'][_0x6c42('0x20')]);_0x69e5dc[_0x6c42('0x1f')]=qs[_0x6c42('0x1f')](_0x2215cb[_0x6c42('0x33')][_0x6c42('0x1f')]);}return _0x127148['getAnyConditions'](_0x69e5dc);}})[_0x6c42('0x24')](function(_0x11b404){if(_0x11b404){return _0x11b404?{'count':_0x3c42c1,'rows':_0x11b404}:null;}})[_0x6c42('0x24')](respondWithResult(_0x5987f7,null))[_0x6c42('0x46')](handleError(_0x5987f7,null));};exports[_0x6c42('0x5c')]=function(_0x573fb8,_0x30972d,_0x24a2db){if(_0x573fb8[_0x6c42('0x4a')]['id']){delete _0x573fb8[_0x6c42('0x4a')]['id'];}return db[_0x6c42('0x2d')][_0x6c42('0x4e')]({'where':{'id':_0x573fb8[_0x6c42('0x48')]['id']}})[_0x6c42('0x24')](handleEntityNotFound(_0x30972d,null))[_0x6c42('0x24')](function(_0x5b0351){if(_0x5b0351){_0x573fb8['body']['TriggerId']=_0x5b0351['id'];return db[_0x6c42('0x5d')][_0x6c42('0x49')](_0x573fb8[_0x6c42('0x4a')]);}})[_0x6c42('0x24')](respondWithResult(_0x30972d,null))['catch'](handleError(_0x30972d,null));};exports[_0x6c42('0x5e')]=function(_0x18c0bb,_0x363732,_0x3c06a0){var _0x516148={};var _0x2c5d80={};var _0x2e9363;var _0x50ac49;return db[_0x6c42('0x2d')]['findOne']({'where':{'id':_0x18c0bb[_0x6c42('0x48')]['id']}})[_0x6c42('0x24')](handleEntityNotFound(_0x363732,null))[_0x6c42('0x24')](function(_0x3ec0be){if(_0x3ec0be){_0x2e9363=_0x3ec0be;_0x2c5d80[_0x6c42('0x31')]=_[_0x6c42('0x32')](db['Action'][_0x6c42('0x2e')]);_0x2c5d80[_0x6c42('0x33')]=_[_0x6c42('0x32')](_0x18c0bb[_0x6c42('0x33')]);_0x2c5d80['filters']=_['intersection'](_0x2c5d80[_0x6c42('0x31')],_0x2c5d80[_0x6c42('0x33')]);_0x516148[_0x6c42('0x37')]=_['intersection'](_0x2c5d80[_0x6c42('0x31')],qs['fields'](_0x18c0bb[_0x6c42('0x33')][_0x6c42('0x36')]));_0x516148[_0x6c42('0x37')]=_0x516148[_0x6c42('0x37')][_0x6c42('0x38')]?_0x516148[_0x6c42('0x37')]:_0x2c5d80[_0x6c42('0x31')];_0x516148[_0x6c42('0x3a')]=qs[_0x6c42('0x3b')](_0x18c0bb[_0x6c42('0x33')][_0x6c42('0x3b')]);_0x516148[_0x6c42('0x3c')]=qs['filters'](_[_0x6c42('0x3d')](_0x18c0bb[_0x6c42('0x33')],_0x2c5d80[_0x6c42('0x34')]));if(_0x18c0bb[_0x6c42('0x33')]['filter']){_0x516148[_0x6c42('0x3c')]=_[_0x6c42('0x59')](_0x516148['where'],{'$or':_[_0x6c42('0x2c')](_0x516148[_0x6c42('0x37')],function(_0x4002f3){var _0x4b41e4={};_0x4b41e4[_0x4002f3]={'$like':'%'+_0x18c0bb[_0x6c42('0x33')][_0x6c42('0x3e')]+'%'};return _0x4b41e4;})});}_0x516148=_[_0x6c42('0x59')]({},_0x516148,_0x18c0bb['options']);return _0x2e9363[_0x6c42('0x5e')](_0x516148);}})['then'](function(_0x245c3a){if(_0x245c3a){_0x50ac49=_0x245c3a['length'];if(!_0x18c0bb[_0x6c42('0x33')][_0x6c42('0x39')](_0x6c42('0x5a'))){_0x516148[_0x6c42('0x20')]=qs['limit'](_0x18c0bb['query'][_0x6c42('0x20')]);_0x516148['offset']=qs['offset'](_0x18c0bb['query'][_0x6c42('0x1f')]);}return _0x2e9363[_0x6c42('0x5e')](_0x516148);}})[_0x6c42('0x24')](function(_0x57d60a){if(_0x57d60a){return _0x57d60a?{'count':_0x50ac49,'rows':_0x57d60a}:null;}})[_0x6c42('0x24')](respondWithResult(_0x363732,null))[_0x6c42('0x46')](handleError(_0x363732,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c818df4..7a64744 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 _0x2ab6=['moment','bluebird','request-promise','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api'];(function(_0x55695d,_0x155f5e){var _0xf353bf=function(_0x4ac0d3){while(--_0x4ac0d3){_0x55695d['push'](_0x55695d['shift']());}};_0xf353bf(++_0x155f5e);}(_0x2ab6,0xe1));var _0x62ab=function(_0x6e5bc6,_0x94c684){_0x6e5bc6=_0x6e5bc6-0x0;var _0x5c2b09=_0x2ab6[_0x6e5bc6];return _0x5c2b09;};'use strict';var _=require(_0x62ab('0x0'));var util=require('util');var logger=require(_0x62ab('0x1'))(_0x62ab('0x2'));var moment=require(_0x62ab('0x3'));var BPromise=require(_0x62ab('0x4'));var rp=require(_0x62ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x62ab('0x6'));var attributes=require(_0x62ab('0x7'));module[_0x62ab('0x8')]=function(_0x42bf18,_0x2e774b){return _0x42bf18[_0x62ab('0x9')](_0x62ab('0xa'),attributes,{'tableName':_0x62ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ec7=['rimraf','exports','Trigger','tools_triggers','util','api','moment','bluebird','request-promise'];(function(_0x5a53fb,_0x222490){var _0x2d2fd8=function(_0x4561f7){while(--_0x4561f7){_0x5a53fb['push'](_0x5a53fb['shift']());}};_0x2d2fd8(++_0x222490);}(_0x8ec7,0x112));var _0x78ec=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x8ec7[_0x34bc6c];return _0x168820;};'use strict';var _=require('lodash');var util=require(_0x78ec('0x0'));var logger=require('../../config/logger')(_0x78ec('0x1'));var moment=require(_0x78ec('0x2'));var BPromise=require(_0x78ec('0x3'));var rp=require(_0x78ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x78ec('0x5'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x78ec('0x6')]=function(_0x3f0cce,_0x254af1){return _0x3f0cce['define'](_0x78ec('0x7'),attributes,{'tableName':_0x78ec('0x8'),'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 fd00f3c..07cbfff 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 _0xe5b5=['GetTrigger','Trigger','options','where','attributes','include','map','model','debug','ShowTrigger','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch'];(function(_0x572438,_0x1b94fe){var _0xc6e9a7=function(_0x5b25a7){while(--_0x5b25a7){_0x572438['push'](_0x572438['shift']());}};_0xc6e9a7(++_0x1b94fe);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xe5b5[_0x432fca];return _0x3adba4;};'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')]('Trigger,\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')]('Trigger,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('Trigger,\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')]['findAll']({'raw':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1c')]||null:null,'attributes':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1d')]||null:null,'limit':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['limit']||null:null,'include':_0x45a091['options']?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x28cd95){return{'model':db[_0x28cd95[_0x5e5b('0x20')]],'as':_0x28cd95['as'],'attributes':_0x28cd95[_0x5e5b('0x1d')],'include':_0x28cd95[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x28cd95[_0x5e5b('0x1e')],function(_0x4da321){return{'model':db[_0x4da321[_0x5e5b('0x20')]],'as':_0x4da321['as'],'attributes':_0x4da321[_0x5e5b('0x1d')],'include':_0x4da321[_0x5e5b('0x1e')]?_['map'](_0x4da321[_0x5e5b('0x1e')],function(_0xdb2863){return{'model':db[_0xdb2863['model']],'as':_0xdb2863['as'],'attributes':_0xdb2863[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x39ce16){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x21')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x39ce16));_0xe5aa6b(_0x39ce16);})[_0x5e5b('0x18')](function(_0x42da3b){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x42da3b['message'],_0x45a091);_0x1560e1(_0x4c5f9a['error'](0x1f4,_0x42da3b[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x22')]=function(_0xb68419){var _0x3dcdab=this;return new Promise(function(_0x12f1ee,_0x4b9be8){return db[_0x5e5b('0x1a')]['find']({'raw':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1c')]||null:null,'attributes':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1d')]||null:null,'include':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x317451){return{'model':db[_0x317451['model']],'as':_0x317451['as'],'attributes':_0x317451[_0x5e5b('0x1d')],'include':_0x317451[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x317451[_0x5e5b('0x1e')],function(_0x7da7a5){return{'model':db[_0x7da7a5[_0x5e5b('0x20')]],'as':_0x7da7a5['as'],'attributes':_0x7da7a5['attributes'],'include':_0x7da7a5['include']?_[_0x5e5b('0x1f')](_0x7da7a5[_0x5e5b('0x1e')],function(_0x8ec651){return{'model':db[_0x8ec651['model']],'as':_0x8ec651['as'],'attributes':_0x8ec651[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x18f5ba){logger[_0x5e5b('0x10')]('ShowTrigger',_0xb68419);logger[_0x5e5b('0x21')](_0x5e5b('0x22'),_0xb68419,JSON['stringify'](_0x18f5ba));_0x12f1ee(_0x18f5ba);})['catch'](function(_0xe9c586){logger[_0x5e5b('0x14')](_0x5e5b('0x22'),_0xe9c586['message'],_0xb68419);_0x4b9be8(_0x3dcdab[_0x5e5b('0x14')](0x1f4,_0xe9c586['message']));});});}; \ No newline at end of file +var _0xf45e=['options','raw','where','attributes','limit','include','model','map','Trigger','find','ShowTrigger','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll'];(function(_0x2358a6,_0x5a6447){var _0x4e4f73=function(_0x32586b){while(--_0x32586b){_0x2358a6['push'](_0x2358a6['shift']());}};_0x4e4f73(++_0x5a6447);}(_0xf45e,0x115));var _0xef45=function(_0x4f8600,_0x1ead5d){_0x4f8600=_0x4f8600-0x0;var _0x333816=_0xf45e[_0x4f8600];return _0x333816;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('Trigger,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['Trigger'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetTrigger',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetTrigger',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowTrigger']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 39b32f9..965637f 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 _0x12b0=['post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/clone'];(function(_0xf26dc3,_0x26e701){var _0x374051=function(_0xae9b19){while(--_0xae9b19){_0xf26dc3['push'](_0xf26dc3['shift']());}};_0x374051(++_0x26e701);}(_0x12b0,0x191));var _0x012b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x12b0[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x012b('0x0'));var util=require(_0x012b('0x1'));var path=require(_0x012b('0x2'));var timeout=require(_0x012b('0x3'));var express=require(_0x012b('0x4'));var router=express[_0x012b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x012b('0x6'));var config=require(_0x012b('0x7'));var controller=require('./trunk.controller');router[_0x012b('0x8')]('/',auth[_0x012b('0x9')](),controller[_0x012b('0xa')]);router[_0x012b('0x8')](_0x012b('0xb'),auth['isAuthenticated'](),controller['show']);router['post'](_0x012b('0xc'),auth[_0x012b('0x9')](),controller['clone']);router[_0x012b('0xd')]('/',auth[_0x012b('0x9')](),controller[_0x012b('0xe')]);router[_0x012b('0xf')](_0x012b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x012b('0x10')]('/:id',auth[_0x012b('0x9')](),controller['destroy']);module[_0x012b('0x11')]=router; \ No newline at end of file +var _0xbd6e=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','delete','destroy','exports'];(function(_0x479389,_0x2ced84){var _0x1a5c77=function(_0x1e1f7e){while(--_0x1e1f7e){_0x479389['push'](_0x479389['shift']());}};_0x1a5c77(++_0x2ced84);}(_0xbd6e,0x1c2));var _0xebd6=function(_0x31fc10,_0x25dd5f){_0x31fc10=_0x31fc10-0x0;var _0x388fea=_0xbd6e[_0x31fc10];return _0x388fea;};'use strict';var multer=require('multer');var util=require(_0xebd6('0x0'));var path=require('path');var timeout=require(_0xebd6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xebd6('0x2'));var auth=require(_0xebd6('0x3'));var interaction=require(_0xebd6('0x4'));var config=require(_0xebd6('0x5'));var controller=require(_0xebd6('0x6'));router[_0xebd6('0x7')]('/',auth[_0xebd6('0x8')](),controller[_0xebd6('0x9')]);router[_0xebd6('0x7')](_0xebd6('0xa'),auth['isAuthenticated'](),controller[_0xebd6('0xb')]);router[_0xebd6('0xc')](_0xebd6('0xd'),auth[_0xebd6('0x8')](),controller[_0xebd6('0xe')]);router['post']('/',auth[_0xebd6('0x8')](),controller['create']);router['put'](_0xebd6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xebd6('0xf')](_0xebd6('0xa'),auth[_0xebd6('0x8')](),controller[_0xebd6('0x10')]);module[_0xebd6('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index fc27a34..245596d 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 _0x4937=['update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','nonat','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','yes','never','INTEGER','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update'];(function(_0x5d9a63,_0xeee450){var _0x412418=function(_0x5469cb){while(--_0x5469cb){_0x5d9a63['push'](_0x5d9a63['shift']());}};_0x412418(++_0xeee450);}(_0x4937,0x1a2));var _0x7493=function(_0x1a433d,_0x1d1761){_0x1a433d=_0x1a433d-0x0;var _0x47e407=_0x4937[_0x1a433d];return _0x47e407;};'use strict';var Sequelize=require(_0x7493('0x0'));module[_0x7493('0x1')]={'name':{'type':Sequelize[_0x7493('0x2')],'allowNull':![],'unique':_0x7493('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x5'),_0x7493('0x6'),_0x7493('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7493('0x2')],'allowNull':![],'defaultValue':_0x7493('0x8')},'callingpres':{'type':Sequelize[_0x7493('0x4')]('ALLOWED_NOT_SCREENED',_0x7493('0x9'),_0x7493('0xa'),'ALLOWED',_0x7493('0xb'),_0x7493('0xc'),_0x7493('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x7493('0x2')]},'permit':{'type':Sequelize[_0x7493('0x2')]},'secret':{'type':Sequelize[_0x7493('0x2')]},'md5secret':{'type':Sequelize[_0x7493('0x2')]},'remotesecret':{'type':Sequelize[_0x7493('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7493('0xe'),'set':function(_0xefb5f1){this[_0x7493('0xf')](_0x7493('0x10'),_0xefb5f1?_0xefb5f1[_0x7493('0x11')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0x7493('0x10'))[_0x7493('0x12')](','):null;},'comment':_0x7493('0x13')},'dtmfmode':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x14'),_0x7493('0x15'),_0x7493('0x16'),_0x7493('0x17'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x7493('0x18'),'update',_0x7493('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7493('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x7493('0x2')]},'nat':{'type':Sequelize[_0x7493('0x2')],'defaultValue':_0x7493('0x1a'),'set':function(_0x120c6c){this['setDataValue'](_0x7493('0x1b'),_0x120c6c?_0x120c6c[_0x7493('0x11')](','):null);},'get':function(){return this[_0x7493('0x1c')](_0x7493('0x1b'))?this[_0x7493('0x1c')](_0x7493('0x1b'))[_0x7493('0x12')](','):null;},'comment':_0x7493('0x1d')},'callgroup':{'type':Sequelize[_0x7493('0x2')]},'namedcallgroup':{'type':Sequelize[_0x7493('0x2')]},'pickupgroup':{'type':Sequelize[_0x7493('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x7493('0x2')]},'language':{'type':Sequelize[_0x7493('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7493('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7493('0x2')],'defaultValue':_0x7493('0x1e')},'allow':{'type':Sequelize[_0x7493('0x2')],'allowNull':![],'defaultValue':_0x7493('0x1f'),'set':function(_0x542b76){this[_0x7493('0xf')](_0x7493('0x20'),_0x542b76?_0x542b76[_0x7493('0x11')](';'):_0x7493('0x1f'));},'get':function(){return this[_0x7493('0x1c')](_0x7493('0x20'))?this[_0x7493('0x1c')](_0x7493('0x20'))[_0x7493('0x12')](';'):null;},'comment':_0x7493('0x21')},'autoframing':{'type':Sequelize[_0x7493('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x7493('0x2')],'defaultValue':_0x7493('0x22'),'set':function(_0x1065fc){this[_0x7493('0xf')](_0x7493('0x23'),_0x1065fc?_0x1065fc[_0x7493('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x7493('0x23'))?this[_0x7493('0x1c')](_0x7493('0x23'))[_0x7493('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7493('0x4')]('yes','no',_0x7493('0x25'))},'promiscredir':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'useclientcode':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'accountcode':{'type':Sequelize[_0x7493('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7493('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x7493('0x2')]},'callcounter':{'type':Sequelize[_0x7493('0x4')]('yes','no'),'defaultValue':_0x7493('0x24')},'busylevel':{'type':Sequelize[_0x7493('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x7493('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x7493('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'subscribecontext':{'type':Sequelize[_0x7493('0x2')]},'template':{'type':Sequelize[_0x7493('0x2')]},'videosupport':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7493('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'mailbox':{'type':Sequelize[_0x7493('0x2')]},'session_timers':{'type':Sequelize[_0x7493('0x4')]('accept',_0x7493('0x27'),_0x7493('0x28'))},'session_expires':{'type':Sequelize[_0x7493('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x29'),_0x7493('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x7493('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x7493('0x2')]},'port':{'type':Sequelize[_0x7493('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x7493('0x24'),'no'),'defaultValue':_0x7493('0x24')},'keepalive':{'type':Sequelize[_0x7493('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x7493('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x7493('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7493('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7493('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x7493('0x24'),'no',_0x7493('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x7493('0x2')]},'timert1':{'type':Sequelize[_0x7493('0x26')](0xb)},'timerb':{'type':Sequelize[_0x7493('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x7493('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7493('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x7493('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x7493('0x24'),'no')},'icesupport':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'dtlsenable':{'type':Sequelize[_0x7493('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no',_0x7493('0x2c'),_0x7493('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x7493('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7493('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x7493('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7493('0x2')]},'dtlscapath':{'type':Sequelize[_0x7493('0x2')]},'dtlssetup':{'type':Sequelize[_0x7493('0x4')]('active',_0x7493('0x2e'),_0x7493('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7493('0x2')]},'usereqphone':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7493('0x2')]},'recordofffeature':{'type':Sequelize[_0x7493('0x2')]},'call_limit':{'type':Sequelize[_0x7493('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'subscribemwi':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no')},'vmexten':{'type':Sequelize[_0x7493('0x2')]},'mohinterpret':{'type':Sequelize[_0x7493('0x2')]},'mohsuggest':{'type':Sequelize[_0x7493('0x2')]},'parkinglot':{'type':Sequelize[_0x7493('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7493('0x2')],'defaultValue':_0x7493('0x30')},'canreinvite':{'type':Sequelize[_0x7493('0x4')](_0x7493('0x24'),'no','nonat',_0x7493('0x31'),_0x7493('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7493('0x2')]},'otherFields':{'type':Sequelize[_0x7493('0x2')]},'active':{'type':Sequelize[_0x7493('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7493('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7344=['insecure','split','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','outgoing','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x7344,0x79));var _0x4734=function(_0x12cfe0,_0x202b95){_0x12cfe0=_0x12cfe0-0x0;var _0x24d01e=_0x7344[_0x12cfe0];return _0x24d01e;};'use strict';var Sequelize=require(_0x4734('0x0'));module['exports']={'name':{'type':Sequelize[_0x4734('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x3'),_0x4734('0x4'),_0x4734('0x5')),'allowNull':![],'defaultValue':_0x4734('0x3')},'context':{'type':Sequelize[_0x4734('0x1')],'allowNull':![],'defaultValue':_0x4734('0x6')},'callingpres':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x7'),_0x4734('0x8'),_0x4734('0x9'),_0x4734('0xa'),'PROHIB_NOT_SCREENED',_0x4734('0xb'),_0x4734('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x4734('0x1')]},'permit':{'type':Sequelize[_0x4734('0x1')]},'secret':{'type':Sequelize[_0x4734('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x4734('0x1')]},'transport':{'type':Sequelize[_0x4734('0x1')],'defaultValue':'udp','set':function(_0x3615e4){this[_0x4734('0xd')](_0x4734('0xe'),_0x3615e4?_0x3615e4[_0x4734('0xf')](','):null);},'get':function(){return this[_0x4734('0x10')](_0x4734('0xe'))?this[_0x4734('0x10')](_0x4734('0xe'))['split'](','):null;},'comment':_0x4734('0x11')},'dtmfmode':{'type':Sequelize[_0x4734('0x2')]('rfc2833',_0x4734('0x12'),_0x4734('0x13'),_0x4734('0x14'),_0x4734('0x15')),'defaultValue':_0x4734('0x16')},'directmedia':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no',_0x4734('0x18'),'update',_0x4734('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4734('0x1')]},'directmediadeny':{'type':Sequelize[_0x4734('0x1')]},'nat':{'type':Sequelize[_0x4734('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x35c761){this['setDataValue']('nat',_0x35c761?_0x35c761[_0x4734('0xf')](','):null);},'get':function(){return this[_0x4734('0x10')](_0x4734('0x1a'))?this[_0x4734('0x10')](_0x4734('0x1a'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4734('0x1')]},'namedcallgroup':{'type':Sequelize[_0x4734('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x4734('0x1')]},'language':{'type':Sequelize[_0x4734('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4734('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4734('0x1')],'defaultValue':_0x4734('0x1b')},'allow':{'type':Sequelize[_0x4734('0x1')],'allowNull':![],'defaultValue':_0x4734('0x1c'),'set':function(_0x96d0b8){this['setDataValue'](_0x4734('0x1d'),_0x96d0b8?_0x96d0b8['join'](';'):_0x4734('0x1c'));},'get':function(){return this[_0x4734('0x10')](_0x4734('0x1d'))?this[_0x4734('0x10')](_0x4734('0x1d'))['split'](';'):null;},'comment':_0x4734('0x1e')},'autoframing':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'insecure':{'type':Sequelize[_0x4734('0x1')],'defaultValue':_0x4734('0x1f'),'set':function(_0x3247a8){this[_0x4734('0xd')](_0x4734('0x20'),_0x3247a8?_0x3247a8[_0x4734('0xf')](','):null);},'get':function(){return this[_0x4734('0x10')](_0x4734('0x20'))?this[_0x4734('0x10')]('insecure')[_0x4734('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x4734('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no',_0x4734('0x22'))},'promiscredir':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'accountcode':{'type':Sequelize[_0x4734('0x23')](0xb)},'setvar':{'type':Sequelize[_0x4734('0x1')]},'callerid':{'type':Sequelize[_0x4734('0x1')],'defaultValue':_0x4734('0x24')},'amaflags':{'type':Sequelize[_0x4734('0x1')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x4734('0x17')},'busylevel':{'type':Sequelize[_0x4734('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4734('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4734('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x4734('0x1')]},'template':{'type':Sequelize[_0x4734('0x1')]},'videosupport':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no',_0x4734('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4734('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x26'),_0x4734('0x27'),_0x4734('0x28'))},'session_expires':{'type':Sequelize[_0x4734('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x29'),_0x4734('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x4734('0x1')]},'regexten':{'type':Sequelize[_0x4734('0x1')]},'fromdomain':{'type':Sequelize[_0x4734('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4734('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x4734('0x17')},'keepalive':{'type':Sequelize[_0x4734('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x4734('0x1')]},'defaultuser':{'type':Sequelize[_0x4734('0x1')]},'rtptimeout':{'type':Sequelize[_0x4734('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4734('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4734('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x4734('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x4734('0x23')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x4734('0x1')]},'contactacl':{'type':Sequelize[_0x4734('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x4734('0x1')]},'use_q850_reason':{'type':Sequelize[_0x4734('0x1')]},'maxforwards':{'type':Sequelize[_0x4734('0x23')](0xb)},'encryption':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'force_avp':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'icesupport':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x4734('0x17'),'no',_0x4734('0x2b'),_0x4734('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x4734('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x4734('0x1')]},'dtlscipher':{'type':Sequelize[_0x4734('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x4734('0x2')]('active',_0x4734('0x2d'),_0x4734('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4734('0x1')]},'usereqphone':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4734('0x1')]},'recordofffeature':{'type':Sequelize[_0x4734('0x1')]},'call_limit':{'type':Sequelize[_0x4734('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4734('0x2')](_0x4734('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x4734('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x4734('0x1')]},'mohinterpret':{'type':Sequelize[_0x4734('0x1')]},'mohsuggest':{'type':Sequelize[_0x4734('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4734('0x1')]},'host':{'type':Sequelize[_0x4734('0x1')],'defaultValue':_0x4734('0x2f')},'canreinvite':{'type':Sequelize[_0x4734('0x2')]('yes','no',_0x4734('0x18'),_0x4734('0x30'),_0x4734('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x4734('0x1')]},'active':{'type':Sequelize[_0x4734('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5592c28..8ac3010 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 _0xf1ab=['includeAll','include','rows','catch','options','find','clone','params','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','render','registry','writeFileSync','chan_sip.so','role','UserProfileSection','autoAssociation','utf8','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','end','status','json','count','offset','set','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','Trunk','rawAttributes','keys','query','attributes','intersection','fields','length','model','hasOwnProperty','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge'];(function(_0x18b2a3,_0x2a639b){var _0x50659f=function(_0x6cb26e){while(--_0x6cb26e){_0x18b2a3['push'](_0x18b2a3['shift']());}};_0x50659f(++_0x2a639b);}(_0xf1ab,0x1d4));var _0xbf1a=function(_0x54f8f9,_0x185389){_0x54f8f9=_0x54f8f9-0x0;var _0x4b46fe=_0xf1ab[_0x54f8f9];return _0x4b46fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf1a('0x0'));var rimraf=require(_0xbf1a('0x1'));var zipdir=require(_0xbf1a('0x2'));var jsonpatch=require(_0xbf1a('0x3'));var rp=require(_0xbf1a('0x4'));var moment=require(_0xbf1a('0x5'));var BPromise=require(_0xbf1a('0x6'));var Mustache=require(_0xbf1a('0x7'));var util=require(_0xbf1a('0x8'));var path=require(_0xbf1a('0x9'));var sox=require('sox');var csv=require(_0xbf1a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf1a('0xb'));var _=require('lodash');var squel=require(_0xbf1a('0xc'));var crypto=require(_0xbf1a('0xd'));var jsforce=require(_0xbf1a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbf1a('0xa'));var querystring=require('querystring');var Papa=require(_0xbf1a('0xf'));var Redis=require('ioredis');var authService=require(_0xbf1a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbf1a('0x11'));var hardwareService=require(_0xbf1a('0x12'));var logger=require(_0xbf1a('0x13'))(_0xbf1a('0x14'));var utils=require(_0xbf1a('0x15'));var config=require(_0xbf1a('0x16'));var licenseUtil=require(_0xbf1a('0x17'));var db=require(_0xbf1a('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xbf1a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x911cea,_0xf044a2,_0x23cb06,_0x1319e4){return new BPromise(function(_0x30a866,_0x3a2013){var _0xd4964a=_0x1319e4||client;return _0xd4964a[_0xbf1a('0x1a')](_0x911cea,_0x23cb06)[_0xbf1a('0x1b')](function(_0xbd2381){logger[_0xbf1a('0x1c')](_0xbf1a('0x1d'),_0xf044a2,'request\x20sent');logger[_0xbf1a('0x1e')](_0xbf1a('0x1f'),_0xf044a2,_0xbf1a('0x20'),JSON[_0xbf1a('0x21')](_0xbd2381));if(_0xbd2381[_0xbf1a('0x22')]){if(_0xbd2381[_0xbf1a('0x22')][_0xbf1a('0x23')]===0x1f4){logger[_0xbf1a('0x22')](_0xbf1a('0x1d'),_0xf044a2,_0xbd2381[_0xbf1a('0x22')][_0xbf1a('0x24')]);return _0x3a2013(_0xbd2381[_0xbf1a('0x22')][_0xbf1a('0x24')]);}logger[_0xbf1a('0x22')]('Trunk,\x20%s,\x20%s',_0xf044a2,_0xbd2381[_0xbf1a('0x22')][_0xbf1a('0x24')]);return _0x30a866(_0xbd2381['error'][_0xbf1a('0x24')]);}else{logger[_0xbf1a('0x1c')](_0xbf1a('0x1d'),_0xf044a2,_0xbf1a('0x20'));_0x30a866(_0xbd2381[_0xbf1a('0x25')][_0xbf1a('0x24')]);}})['catch'](function(_0x4d3c60){logger[_0xbf1a('0x22')](_0xbf1a('0x1d'),_0xf044a2,_0x4d3c60);_0x3a2013(_0x4d3c60);});});}function respondWithStatusCode(_0x112a4b,_0x45c268){_0x45c268=_0x45c268||0xcc;return function(_0x261695){if(_0x261695){return _0x112a4b['sendStatus'](_0x45c268);}return _0x112a4b['status'](_0x45c268)[_0xbf1a('0x26')]();};}function respondWithResult(_0x29ea00,_0x201359){_0x201359=_0x201359||0xc8;return function(_0x2ea9e0){if(_0x2ea9e0){return _0x29ea00[_0xbf1a('0x27')](_0x201359)[_0xbf1a('0x28')](_0x2ea9e0);}};}function respondWithFilteredResult(_0x413535,_0x55359c){return function(_0x4b5b08){if(_0x4b5b08){var _0x12c572=_0x4b5b08[_0xbf1a('0x29')],_0x1a17b4=_0x55359c[_0xbf1a('0x2a')],_0xb7d3ea=_0x55359c[_0xbf1a('0x2a')]+_0x55359c['limit'],_0x29da65;if(_0xb7d3ea>=_0x12c572){_0xb7d3ea=_0x12c572;_0x29da65=0xc8;}else{_0x29da65=0xce;}_0x413535[_0xbf1a('0x27')](_0x29da65);return _0x413535[_0xbf1a('0x2b')]('Content-Range',_0x1a17b4+'-'+_0xb7d3ea+'/'+_0x12c572)[_0xbf1a('0x28')](_0x4b5b08);}return null;};}function patchUpdates(_0x36e590){return function(_0x18ed2c){try{jsonpatch['apply'](_0x18ed2c,_0x36e590,!![]);}catch(_0x4cc9ca){return BPromise[_0xbf1a('0x2c')](_0x4cc9ca);}return _0x18ed2c[_0xbf1a('0x2d')]();};}function saveUpdates(_0x409d52,_0x35ec42){return function(_0x1ad831){if(_0x1ad831){return _0x1ad831[_0xbf1a('0x2e')](_0x409d52)[_0xbf1a('0x1b')](function(_0x300fd5){return _0x300fd5;});}return null;};}function removeEntity(_0x2807cc,_0x1cc49e){return function(_0x48c89d){if(_0x48c89d){return _0x48c89d[_0xbf1a('0x2f')]()[_0xbf1a('0x1b')](function(){var _0x2b41da=_0x48c89d[_0xbf1a('0x30')]({'plain':!![]});var _0x44e88c=_0xbf1a('0x31');return db[_0xbf1a('0x32')][_0xbf1a('0x2f')]({'where':{'type':_0x44e88c,'resourceId':_0x2b41da['id']}})[_0xbf1a('0x1b')](function(){return _0x48c89d;});})[_0xbf1a('0x1b')](function(){_0x2807cc[_0xbf1a('0x27')](0xcc)[_0xbf1a('0x26')]();});}};}function handleEntityNotFound(_0x497eed,_0x3f207d){return function(_0x277289){if(!_0x277289){_0x497eed[_0xbf1a('0x33')](0x194);}return _0x277289;};}function handleError(_0x1285d2,_0x2b953f){_0x2b953f=_0x2b953f||0x1f4;return function(_0x5c1d75){logger['error'](_0x5c1d75[_0xbf1a('0x34')]);if(_0x5c1d75[_0xbf1a('0x35')]){delete _0x5c1d75['name'];}_0x1285d2[_0xbf1a('0x27')](_0x2b953f)[_0xbf1a('0x36')](_0x5c1d75);};}exports[_0xbf1a('0x37')]=function(_0x729344,_0x56c021){var _0x4cae91={},_0xb4445d={},_0x52bf9f={'count':0x0,'rows':[]};var _0x22db52=_[_0xbf1a('0x38')](db[_0xbf1a('0x39')][_0xbf1a('0x3a')],function(_0x1d469a){return{'name':_0x1d469a['fieldName'],'type':_0x1d469a['type']['key']};});_0xb4445d['model']=_[_0xbf1a('0x38')](_0x22db52,_0xbf1a('0x35'));_0xb4445d['query']=_[_0xbf1a('0x3b')](_0x729344[_0xbf1a('0x3c')]);_0xb4445d['filters']=_['intersection'](_0xb4445d['model'],_0xb4445d[_0xbf1a('0x3c')]);_0x4cae91[_0xbf1a('0x3d')]=_[_0xbf1a('0x3e')](_0xb4445d['model'],qs[_0xbf1a('0x3f')](_0x729344[_0xbf1a('0x3c')][_0xbf1a('0x3f')]));_0x4cae91['attributes']=_0x4cae91[_0xbf1a('0x3d')][_0xbf1a('0x40')]?_0x4cae91[_0xbf1a('0x3d')]:_0xb4445d[_0xbf1a('0x41')];if(!_0x729344[_0xbf1a('0x3c')][_0xbf1a('0x42')]('nolimit')){_0x4cae91[_0xbf1a('0x43')]=qs[_0xbf1a('0x43')](_0x729344['query']['limit']);_0x4cae91[_0xbf1a('0x2a')]=qs['offset'](_0x729344['query'][_0xbf1a('0x2a')]);}_0x4cae91[_0xbf1a('0x44')]=qs[_0xbf1a('0x45')](_0x729344['query'][_0xbf1a('0x45')]);_0x4cae91[_0xbf1a('0x46')]=qs[_0xbf1a('0x47')](_[_0xbf1a('0x48')](_0x729344[_0xbf1a('0x3c')],_0xb4445d['filters']),_0x22db52);if(_0x729344[_0xbf1a('0x3c')][_0xbf1a('0x49')]){_0x4cae91[_0xbf1a('0x46')]=_['merge'](_0x4cae91['where'],{'$or':_[_0xbf1a('0x38')](_0x22db52,function(_0x116ecb){if(_0x116ecb[_0xbf1a('0x4a')]!==_0xbf1a('0x4b')){var _0x5ea689={};_0x5ea689[_0x116ecb[_0xbf1a('0x35')]]={'$like':'%'+_0x729344['query'][_0xbf1a('0x49')]+'%'};return _0x5ea689;}})});}_0x4cae91=_[_0xbf1a('0x4c')]({},_0x4cae91,_0x729344['options']);var _0x5cf78a={'where':_0x4cae91['where']};return db['Trunk'][_0xbf1a('0x29')](_0x5cf78a)[_0xbf1a('0x1b')](function(_0x299e67){_0x52bf9f[_0xbf1a('0x29')]=_0x299e67;if(_0x729344[_0xbf1a('0x3c')][_0xbf1a('0x4d')]){_0x4cae91[_0xbf1a('0x4e')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x4cae91);})[_0xbf1a('0x1b')](function(_0x29155d){_0x52bf9f[_0xbf1a('0x4f')]=_0x29155d;return _0x52bf9f;})[_0xbf1a('0x1b')](respondWithFilteredResult(_0x56c021,_0x4cae91))[_0xbf1a('0x50')](handleError(_0x56c021,null));};exports['show']=function(_0x2d0b8d,_0x54001b){var _0x180a3e={'raw':![],'where':{'id':_0x2d0b8d['params']['id']}},_0x59d881={};_0x59d881[_0xbf1a('0x41')]=_[_0xbf1a('0x3b')](db['Trunk']['rawAttributes']);_0x59d881[_0xbf1a('0x3c')]=_[_0xbf1a('0x3b')](_0x2d0b8d[_0xbf1a('0x3c')]);_0x59d881[_0xbf1a('0x47')]=_[_0xbf1a('0x3e')](_0x59d881[_0xbf1a('0x41')],_0x59d881[_0xbf1a('0x3c')]);_0x180a3e[_0xbf1a('0x3d')]=_['intersection'](_0x59d881[_0xbf1a('0x41')],qs[_0xbf1a('0x3f')](_0x2d0b8d[_0xbf1a('0x3c')]['fields']));_0x180a3e[_0xbf1a('0x3d')]=_0x180a3e['attributes'][_0xbf1a('0x40')]?_0x180a3e[_0xbf1a('0x3d')]:_0x59d881['model'];if(_0x2d0b8d['query'][_0xbf1a('0x4d')]){_0x180a3e[_0xbf1a('0x4e')]=[{'all':!![]}];}_0x180a3e=_[_0xbf1a('0x4c')]({},_0x180a3e,_0x2d0b8d[_0xbf1a('0x51')]);return db[_0xbf1a('0x39')][_0xbf1a('0x52')](_0x180a3e)[_0xbf1a('0x1b')](handleEntityNotFound(_0x54001b,null))[_0xbf1a('0x1b')](respondWithResult(_0x54001b,null))[_0xbf1a('0x50')](handleError(_0x54001b,null));};exports[_0xbf1a('0x53')]=function(_0x5c732a,_0x38551a){var _0x25fc80={'where':{'id':_0x5c732a[_0xbf1a('0x54')]['id']}},_0x1ffbab={};_0x1ffbab[_0xbf1a('0x41')]=_['keys'](db['Trunk'][_0xbf1a('0x3a')]);_0x25fc80['attributes']=_['intersection'](_0x1ffbab[_0xbf1a('0x41')],qs[_0xbf1a('0x3f')](_0x5c732a[_0xbf1a('0x3c')][_0xbf1a('0x3f')]));_0x25fc80[_0xbf1a('0x3d')]=_0x25fc80[_0xbf1a('0x3d')][_0xbf1a('0x40')]?_0x25fc80[_0xbf1a('0x3d')]:_0x1ffbab[_0xbf1a('0x41')];if(_0x5c732a[_0xbf1a('0x3c')][_0xbf1a('0x4d')]){_0x25fc80[_0xbf1a('0x4e')]=[{'all':!![]}];}_0x25fc80=_['merge']({},_0x25fc80,_0x5c732a[_0xbf1a('0x51')]);return db[_0xbf1a('0x39')][_0xbf1a('0x52')](_0x25fc80)[_0xbf1a('0x1b')](handleEntityNotFound(_0x38551a,null))[_0xbf1a('0x1b')](function(_0x877f63){if(_0x877f63){var _0x3c2a1d=_0x877f63[_0xbf1a('0x30')]({'plain':!![]});_0x3c2a1d=qs['omit'](_0x3c2a1d,['id',_0xbf1a('0x55'),'updatedAt']);_0x5c732a[_0xbf1a('0x56')]=_[_0xbf1a('0x57')](_0x5c732a[_0xbf1a('0x56')],['id',_0xbf1a('0x55'),_0xbf1a('0x58')]);return db[_0xbf1a('0x39')][_0xbf1a('0x59')](_['merge'](_0x3c2a1d,_0x5c732a[_0xbf1a('0x56')]),{'include':_0x5c732a[_0xbf1a('0x3c')][_0xbf1a('0x4d')]?[{'all':!![]}]:undefined})[_0xbf1a('0x1b')](function(_0x29c35d){var _0x53d706=_0x5c732a[_0xbf1a('0x5a')][_0xbf1a('0x30')]({'plain':!![]});if(!_0x53d706)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53d706['role']===_0xbf1a('0x5a')){var _0x136240=_0x29c35d[_0xbf1a('0x30')]({'plain':!![]});var _0xb13777=_0xbf1a('0x31');return db['UserProfileSection'][_0xbf1a('0x52')]({'where':{'name':_0xb13777,'userProfileId':_0x53d706['userProfileId']},'raw':!![]})[_0xbf1a('0x1b')](function(_0x265599){if(_0x265599&&_0x265599['autoAssociation']===0x0){return db[_0xbf1a('0x32')][_0xbf1a('0x59')]({'name':_0x136240['name'],'resourceId':_0x136240['id'],'type':_0x265599['name'],'sectionId':_0x265599['id']},{})[_0xbf1a('0x1b')](function(){return _0x29c35d;});}else{return _0x29c35d;}})[_0xbf1a('0x50')](function(_0xf80a90){logger['error'](_0xbf1a('0x5b'),_0xf80a90);throw _0xf80a90;});}return _0x29c35d;});}})[_0xbf1a('0x1b')](respondWithResult(_0x38551a,0xc9))['catch'](handleError(_0x38551a,null));};exports['create']=function(_0x54295b,_0x18eafa,_0x2930d3){var _0x11b52a;return db[_0xbf1a('0x39')][_0xbf1a('0x59')](_0x54295b['body'],{'raw':!![]})['then'](function(_0x552eb3){_0x11b52a=_0x552eb3;return db['Trunk'][_0xbf1a('0x5c')]({'raw':!![]});})['then'](function(_0x1a5b33){var _0x2acc4b=fs[_0xbf1a('0x5d')](path[_0xbf1a('0x5e')](config[_0xbf1a('0x5f')],_0xbf1a('0x60')),'utf8');var _0x518638=fs['readFileSync'](path[_0xbf1a('0x5e')](config[_0xbf1a('0x5f')],_0xbf1a('0x61')),'utf8');var _0x536b7d=ejs[_0xbf1a('0x62')](_0x2acc4b,{'trunks':_0x1a5b33||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x536b7d);if(_0x11b52a[_0xbf1a('0x63')]){var _0x1ae9ba=ejs[_0xbf1a('0x62')](_0x518638,{'trunks':_0x1a5b33||[]});fs[_0xbf1a('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1ae9ba);}})[_0xbf1a('0x1b')](function(){return respondWithRpcPromise('Reload','create',{'module':_0xbf1a('0x65')});})['then'](function(){var _0x2925d6=_0x54295b[_0xbf1a('0x5a')][_0xbf1a('0x30')]({'plain':!![]});if(!_0x2925d6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2925d6[_0xbf1a('0x66')]===_0xbf1a('0x5a')){var _0x107442=_0x11b52a[_0xbf1a('0x30')]({'plain':!![]});return db[_0xbf1a('0x67')][_0xbf1a('0x52')]({'where':{'name':_0xbf1a('0x31'),'userProfileId':_0x2925d6['userProfileId']},'raw':!![]})[_0xbf1a('0x1b')](function(_0x15d7cd){if(_0x15d7cd&&_0x15d7cd[_0xbf1a('0x68')]===0x0){return db[_0xbf1a('0x32')][_0xbf1a('0x59')]({'name':_0x107442[_0xbf1a('0x35')],'resourceId':_0x107442['id'],'type':_0x15d7cd[_0xbf1a('0x35')],'sectionId':_0x15d7cd['id']},{})[_0xbf1a('0x1b')](function(){return _0x11b52a;});}else{return _0x11b52a;}})[_0xbf1a('0x50')](function(_0x1dcddc){logger[_0xbf1a('0x22')](_0xbf1a('0x5b'),_0x1dcddc);throw _0x1dcddc;});}return _0x11b52a;})[_0xbf1a('0x1b')](respondWithResult(_0x18eafa,0xc9))['catch'](handleError(_0x18eafa,null));};exports[_0xbf1a('0x2e')]=function(_0x41fff2,_0x92b340,_0x16caec){var _0x704565;return db[_0xbf1a('0x39')][_0xbf1a('0x52')]({'where':{'id':_0x41fff2[_0xbf1a('0x54')]['id']}})[_0xbf1a('0x1b')](handleEntityNotFound(_0x92b340,null))[_0xbf1a('0x1b')](saveUpdates(_0x41fff2['body'],null))[_0xbf1a('0x1b')](function(_0x527069){if(_0x527069){_0x704565=_0x527069;return db[_0xbf1a('0x39')][_0xbf1a('0x5c')]({'raw':!![]});}})[_0xbf1a('0x1b')](function(_0x271916){if(_0x271916){var _0x228539=fs[_0xbf1a('0x5d')](path[_0xbf1a('0x5e')](config[_0xbf1a('0x5f')],'server/files/templates/trunk.ejs'),'utf8');var _0x3fb365=fs[_0xbf1a('0x5d')](path[_0xbf1a('0x5e')](config[_0xbf1a('0x5f')],'server/files/templates/registry.ejs'),_0xbf1a('0x69'));var _0xe6f344=ejs[_0xbf1a('0x62')](_0x228539,{'trunks':_0x271916||[]});fs[_0xbf1a('0x64')](_0xbf1a('0x6a'),_0xe6f344);var _0x3dfdb9=ejs[_0xbf1a('0x62')](_0x3fb365,{'trunks':_0x271916||[]});fs[_0xbf1a('0x64')](_0xbf1a('0x6b'),_0x3dfdb9);return respondWithRpcPromise(_0xbf1a('0x6c'),_0xbf1a('0x2e'),{'module':_0xbf1a('0x65')});}return null;})[_0xbf1a('0x1b')](function(_0x97dbab){if(_0x97dbab){return _0x704565;}})['then'](respondWithResult(_0x92b340,null))[_0xbf1a('0x50')](handleError(_0x92b340,null));};exports['destroy']=function(_0x5acf82,_0x5e4ff3,_0x1c3c4f){var _0x2ed0e8;return db[_0xbf1a('0x39')][_0xbf1a('0x52')]({'where':{'id':_0x5acf82['params']['id']}})[_0xbf1a('0x1b')](handleEntityNotFound(_0x5e4ff3,null))['then'](removeEntity(_0x5e4ff3,null))[_0xbf1a('0x1b')](function(){return db['Trunk'][_0xbf1a('0x5c')]({'raw':!![]});})[_0xbf1a('0x1b')](function(_0x10efc8){var _0xc42e70=fs[_0xbf1a('0x5d')](path[_0xbf1a('0x5e')](config[_0xbf1a('0x5f')],_0xbf1a('0x60')),_0xbf1a('0x69'));var _0x2c9d68=fs['readFileSync'](path[_0xbf1a('0x5e')](config[_0xbf1a('0x5f')],_0xbf1a('0x61')),_0xbf1a('0x69'));var _0x1634de=ejs[_0xbf1a('0x62')](_0xc42e70,{'trunks':_0x10efc8});var _0x46fce6=ejs[_0xbf1a('0x62')](_0x2c9d68,{'trunks':_0x10efc8});fs['writeFileSync'](_0xbf1a('0x6a'),_0x1634de);fs[_0xbf1a('0x64')](_0xbf1a('0x6b'),_0x46fce6);return respondWithRpcPromise(_0xbf1a('0x6c'),'destroy',{'module':_0xbf1a('0x65')});})[_0xbf1a('0x50')](handleError(_0x5e4ff3,null));}; \ No newline at end of file +var _0x4dbc=['key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','includeAll','include','rows','show','keys','rawAttributes','find','clone','params','options','omit','createdAt','body','updatedAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','writeFileSync','Reload','chan_sip.so','UserProfileSection','/etc/asterisk/sip_xcally_registers.conf','server/files/templates/registry.ejs','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','then','get','Trunks','stack','name','send','index','map','Trunk','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4dbc,0x178));var _0xc4db=function(_0x48bceb,_0x3658d8){_0x48bceb=_0x48bceb-0x0;var _0x274484=_0x4dbc[_0x48bceb];return _0x274484;};'use strict';var pdf=require(_0xc4db('0x0'));var emlformat=require(_0xc4db('0x1'));var rimraf=require(_0xc4db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4db('0x3'));var moment=require('moment');var BPromise=require(_0xc4db('0x4'));var Mustache=require('mustache');var util=require(_0xc4db('0x5'));var path=require(_0xc4db('0x6'));var sox=require(_0xc4db('0x7'));var csv=require(_0xc4db('0x8'));var ejs=require(_0xc4db('0x9'));var fs=require('fs');var fs_extra=require(_0xc4db('0xa'));var _=require(_0xc4db('0xb'));var squel=require(_0xc4db('0xc'));var crypto=require(_0xc4db('0xd'));var jsforce=require(_0xc4db('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4db('0xf'));var Redis=require('ioredis');var authService=require(_0xc4db('0x10'));var qs=require(_0xc4db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc4db('0x12'))(_0xc4db('0x13'));var utils=require(_0xc4db('0x14'));var config=require(_0xc4db('0x15'));var licenseUtil=require(_0xc4db('0x16'));var db=require(_0xc4db('0x17'))['db'];var jayson=require(_0xc4db('0x18'));var client=jayson[_0xc4db('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3548a6,_0x41dc34,_0x549906,_0x50d188){return new BPromise(function(_0x1446e6,_0x5e5e6c){var _0x490485=_0x50d188||client;return _0x490485[_0xc4db('0x1a')](_0x3548a6,_0x549906)['then'](function(_0x5eb543){logger['info'](_0xc4db('0x1b'),_0x41dc34,_0xc4db('0x1c'));logger[_0xc4db('0x1d')](_0xc4db('0x1e'),_0x41dc34,'request\x20sent',JSON['stringify'](_0x5eb543));if(_0x5eb543[_0xc4db('0x1f')]){if(_0x5eb543[_0xc4db('0x1f')][_0xc4db('0x20')]===0x1f4){logger[_0xc4db('0x1f')](_0xc4db('0x1b'),_0x41dc34,_0x5eb543[_0xc4db('0x1f')][_0xc4db('0x21')]);return _0x5e5e6c(_0x5eb543[_0xc4db('0x1f')]['message']);}logger[_0xc4db('0x1f')]('Trunk,\x20%s,\x20%s',_0x41dc34,_0x5eb543[_0xc4db('0x1f')][_0xc4db('0x21')]);return _0x1446e6(_0x5eb543[_0xc4db('0x1f')]['message']);}else{logger[_0xc4db('0x22')](_0xc4db('0x1b'),_0x41dc34,_0xc4db('0x1c'));_0x1446e6(_0x5eb543[_0xc4db('0x23')][_0xc4db('0x21')]);}})[_0xc4db('0x24')](function(_0x14a4ed){logger['error'](_0xc4db('0x1b'),_0x41dc34,_0x14a4ed);_0x5e5e6c(_0x14a4ed);});});}function respondWithStatusCode(_0x17b0c0,_0x1f6f45){_0x1f6f45=_0x1f6f45||0xcc;return function(_0x397571){if(_0x397571){return _0x17b0c0[_0xc4db('0x25')](_0x1f6f45);}return _0x17b0c0[_0xc4db('0x26')](_0x1f6f45)[_0xc4db('0x27')]();};}function respondWithResult(_0x4074c4,_0x459c24){_0x459c24=_0x459c24||0xc8;return function(_0x30fff2){if(_0x30fff2){return _0x4074c4[_0xc4db('0x26')](_0x459c24)['json'](_0x30fff2);}};}function respondWithFilteredResult(_0x9e2b16,_0xe08e00){return function(_0x1b54a8){if(_0x1b54a8){var _0x11e5b9=_0x1b54a8[_0xc4db('0x28')],_0x3bb6a8=_0xe08e00['offset'],_0x93d5d9=_0xe08e00[_0xc4db('0x29')]+_0xe08e00[_0xc4db('0x2a')],_0x3c1574;if(_0x93d5d9>=_0x11e5b9){_0x93d5d9=_0x11e5b9;_0x3c1574=0xc8;}else{_0x3c1574=0xce;}_0x9e2b16[_0xc4db('0x26')](_0x3c1574);return _0x9e2b16[_0xc4db('0x2b')](_0xc4db('0x2c'),_0x3bb6a8+'-'+_0x93d5d9+'/'+_0x11e5b9)[_0xc4db('0x2d')](_0x1b54a8);}return null;};}function patchUpdates(_0x371865){return function(_0x5007b8){try{jsonpatch['apply'](_0x5007b8,_0x371865,!![]);}catch(_0x1e771a){return BPromise[_0xc4db('0x2e')](_0x1e771a);}return _0x5007b8['save']();};}function saveUpdates(_0x5651d5,_0x1e2a79){return function(_0x3da530){if(_0x3da530){return _0x3da530[_0xc4db('0x2f')](_0x5651d5)['then'](function(_0x42f6a7){return _0x42f6a7;});}return null;};}function removeEntity(_0x11f66a,_0x301ebb){return function(_0x3d9a54){if(_0x3d9a54){return _0x3d9a54[_0xc4db('0x30')]()[_0xc4db('0x31')](function(){var _0x25d20d=_0x3d9a54[_0xc4db('0x32')]({'plain':!![]});var _0x2c9b3c=_0xc4db('0x33');return db['UserProfileResource']['destroy']({'where':{'type':_0x2c9b3c,'resourceId':_0x25d20d['id']}})[_0xc4db('0x31')](function(){return _0x3d9a54;});})['then'](function(){_0x11f66a[_0xc4db('0x26')](0xcc)[_0xc4db('0x27')]();});}};}function handleEntityNotFound(_0x25ac97,_0x3bb5e7){return function(_0x37a918){if(!_0x37a918){_0x25ac97[_0xc4db('0x25')](0x194);}return _0x37a918;};}function handleError(_0x1ca689,_0x361760){_0x361760=_0x361760||0x1f4;return function(_0x84d883){logger[_0xc4db('0x1f')](_0x84d883[_0xc4db('0x34')]);if(_0x84d883[_0xc4db('0x35')]){delete _0x84d883[_0xc4db('0x35')];}_0x1ca689[_0xc4db('0x26')](_0x361760)[_0xc4db('0x36')](_0x84d883);};}exports[_0xc4db('0x37')]=function(_0x14e0de,_0x4a73b1){var _0x18b521={},_0x566dfa={},_0x18d753={'count':0x0,'rows':[]};var _0x3abd87=_[_0xc4db('0x38')](db[_0xc4db('0x39')]['rawAttributes'],function(_0x4d8634){return{'name':_0x4d8634[_0xc4db('0x3a')],'type':_0x4d8634[_0xc4db('0x3b')][_0xc4db('0x3c')]};});_0x566dfa[_0xc4db('0x3d')]=_[_0xc4db('0x38')](_0x3abd87,_0xc4db('0x35'));_0x566dfa[_0xc4db('0x3e')]=_['keys'](_0x14e0de[_0xc4db('0x3e')]);_0x566dfa[_0xc4db('0x3f')]=_[_0xc4db('0x40')](_0x566dfa[_0xc4db('0x3d')],_0x566dfa[_0xc4db('0x3e')]);_0x18b521['attributes']=_[_0xc4db('0x40')](_0x566dfa[_0xc4db('0x3d')],qs[_0xc4db('0x41')](_0x14e0de[_0xc4db('0x3e')][_0xc4db('0x41')]));_0x18b521[_0xc4db('0x42')]=_0x18b521[_0xc4db('0x42')][_0xc4db('0x43')]?_0x18b521[_0xc4db('0x42')]:_0x566dfa['model'];if(!_0x14e0de[_0xc4db('0x3e')][_0xc4db('0x44')]('nolimit')){_0x18b521[_0xc4db('0x2a')]=qs[_0xc4db('0x2a')](_0x14e0de['query'][_0xc4db('0x2a')]);_0x18b521[_0xc4db('0x29')]=qs[_0xc4db('0x29')](_0x14e0de['query'][_0xc4db('0x29')]);}_0x18b521['order']=qs['sort'](_0x14e0de[_0xc4db('0x3e')][_0xc4db('0x45')]);_0x18b521[_0xc4db('0x46')]=qs['filters'](_[_0xc4db('0x47')](_0x14e0de[_0xc4db('0x3e')],_0x566dfa['filters']),_0x3abd87);if(_0x14e0de['query']['filter']){_0x18b521[_0xc4db('0x46')]=_[_0xc4db('0x48')](_0x18b521[_0xc4db('0x46')],{'$or':_[_0xc4db('0x38')](_0x3abd87,function(_0x29ab9d){if(_0x29ab9d[_0xc4db('0x3b')]!=='VIRTUAL'){var _0x11f9ff={};_0x11f9ff[_0x29ab9d[_0xc4db('0x35')]]={'$like':'%'+_0x14e0de['query'][_0xc4db('0x49')]+'%'};return _0x11f9ff;}})});}_0x18b521=_[_0xc4db('0x48')]({},_0x18b521,_0x14e0de['options']);var _0x287ca7={'where':_0x18b521[_0xc4db('0x46')]};return db[_0xc4db('0x39')][_0xc4db('0x28')](_0x287ca7)['then'](function(_0x485ff8){_0x18d753[_0xc4db('0x28')]=_0x485ff8;if(_0x14e0de[_0xc4db('0x3e')][_0xc4db('0x4a')]){_0x18b521[_0xc4db('0x4b')]=[{'all':!![]}];}return db[_0xc4db('0x39')]['findAll'](_0x18b521);})['then'](function(_0x24d549){_0x18d753[_0xc4db('0x4c')]=_0x24d549;return _0x18d753;})[_0xc4db('0x31')](respondWithFilteredResult(_0x4a73b1,_0x18b521))[_0xc4db('0x24')](handleError(_0x4a73b1,null));};exports[_0xc4db('0x4d')]=function(_0x2952a7,_0x1f6fc8){var _0x4dd60b={'raw':![],'where':{'id':_0x2952a7['params']['id']}},_0x127612={};_0x127612['model']=_[_0xc4db('0x4e')](db['Trunk'][_0xc4db('0x4f')]);_0x127612['query']=_[_0xc4db('0x4e')](_0x2952a7[_0xc4db('0x3e')]);_0x127612[_0xc4db('0x3f')]=_[_0xc4db('0x40')](_0x127612['model'],_0x127612['query']);_0x4dd60b[_0xc4db('0x42')]=_['intersection'](_0x127612[_0xc4db('0x3d')],qs[_0xc4db('0x41')](_0x2952a7['query'][_0xc4db('0x41')]));_0x4dd60b[_0xc4db('0x42')]=_0x4dd60b['attributes'][_0xc4db('0x43')]?_0x4dd60b['attributes']:_0x127612[_0xc4db('0x3d')];if(_0x2952a7[_0xc4db('0x3e')]['includeAll']){_0x4dd60b[_0xc4db('0x4b')]=[{'all':!![]}];}_0x4dd60b=_[_0xc4db('0x48')]({},_0x4dd60b,_0x2952a7['options']);return db['Trunk'][_0xc4db('0x50')](_0x4dd60b)[_0xc4db('0x31')](handleEntityNotFound(_0x1f6fc8,null))[_0xc4db('0x31')](respondWithResult(_0x1f6fc8,null))[_0xc4db('0x24')](handleError(_0x1f6fc8,null));};exports[_0xc4db('0x51')]=function(_0x394db8,_0x5550a2){var _0x9475d3={'where':{'id':_0x394db8[_0xc4db('0x52')]['id']}},_0x4e9428={};_0x4e9428[_0xc4db('0x3d')]=_[_0xc4db('0x4e')](db[_0xc4db('0x39')][_0xc4db('0x4f')]);_0x9475d3['attributes']=_[_0xc4db('0x40')](_0x4e9428[_0xc4db('0x3d')],qs[_0xc4db('0x41')](_0x394db8[_0xc4db('0x3e')][_0xc4db('0x41')]));_0x9475d3[_0xc4db('0x42')]=_0x9475d3[_0xc4db('0x42')][_0xc4db('0x43')]?_0x9475d3[_0xc4db('0x42')]:_0x4e9428[_0xc4db('0x3d')];if(_0x394db8[_0xc4db('0x3e')][_0xc4db('0x4a')]){_0x9475d3[_0xc4db('0x4b')]=[{'all':!![]}];}_0x9475d3=_[_0xc4db('0x48')]({},_0x9475d3,_0x394db8[_0xc4db('0x53')]);return db[_0xc4db('0x39')][_0xc4db('0x50')](_0x9475d3)[_0xc4db('0x31')](handleEntityNotFound(_0x5550a2,null))[_0xc4db('0x31')](function(_0x488d01){if(_0x488d01){var _0x4f09cd=_0x488d01['get']({'plain':!![]});_0x4f09cd=qs[_0xc4db('0x54')](_0x4f09cd,['id',_0xc4db('0x55'),'updatedAt']);_0x394db8[_0xc4db('0x56')]=_[_0xc4db('0x54')](_0x394db8[_0xc4db('0x56')],['id',_0xc4db('0x55'),_0xc4db('0x57')]);return db[_0xc4db('0x39')][_0xc4db('0x58')](_[_0xc4db('0x48')](_0x4f09cd,_0x394db8[_0xc4db('0x56')]),{'include':_0x394db8[_0xc4db('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xc4db('0x31')](function(_0x761c83){var _0x59615b=_0x394db8['user']['get']({'plain':!![]});if(!_0x59615b)throw new Error(_0xc4db('0x59'));if(_0x59615b['role']===_0xc4db('0x5a')){var _0x3221b6=_0x761c83[_0xc4db('0x32')]({'plain':!![]});var _0x1c2d76=_0xc4db('0x33');return db['UserProfileSection'][_0xc4db('0x50')]({'where':{'name':_0x1c2d76,'userProfileId':_0x59615b[_0xc4db('0x5b')]},'raw':!![]})[_0xc4db('0x31')](function(_0x59009f){if(_0x59009f&&_0x59009f[_0xc4db('0x5c')]===0x0){return db[_0xc4db('0x5d')][_0xc4db('0x58')]({'name':_0x3221b6[_0xc4db('0x35')],'resourceId':_0x3221b6['id'],'type':_0x59009f[_0xc4db('0x35')],'sectionId':_0x59009f['id']},{})['then'](function(){return _0x761c83;});}else{return _0x761c83;}})[_0xc4db('0x24')](function(_0x57b958){logger[_0xc4db('0x1f')](_0xc4db('0x5e'),_0x57b958);throw _0x57b958;});}return _0x761c83;});}})[_0xc4db('0x31')](respondWithResult(_0x5550a2,0xc9))['catch'](handleError(_0x5550a2,null));};exports[_0xc4db('0x58')]=function(_0xadc50,_0x40b489,_0x56ca1a){var _0x23ee95;return db[_0xc4db('0x39')][_0xc4db('0x58')](_0xadc50[_0xc4db('0x56')],{'raw':!![]})[_0xc4db('0x31')](function(_0x552a81){_0x23ee95=_0x552a81;return db[_0xc4db('0x39')][_0xc4db('0x5f')]({'raw':!![]});})[_0xc4db('0x31')](function(_0x2b29f0){var _0x223177=fs[_0xc4db('0x60')](path[_0xc4db('0x61')](config[_0xc4db('0x62')],_0xc4db('0x63')),'utf8');var _0x53c27c=fs[_0xc4db('0x60')](path[_0xc4db('0x61')](config['root'],'server/files/templates/registry.ejs'),_0xc4db('0x64'));var _0x5aa547=ejs[_0xc4db('0x65')](_0x223177,{'trunks':_0x2b29f0||[]});fs['writeFileSync'](_0xc4db('0x66'),_0x5aa547);if(_0x23ee95['registry']){var _0x501863=ejs[_0xc4db('0x65')](_0x53c27c,{'trunks':_0x2b29f0||[]});fs[_0xc4db('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x501863);}})[_0xc4db('0x31')](function(){return respondWithRpcPromise(_0xc4db('0x68'),'create',{'module':_0xc4db('0x69')});})['then'](function(){var _0x3f489c=_0xadc50[_0xc4db('0x5a')]['get']({'plain':!![]});if(!_0x3f489c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f489c['role']===_0xc4db('0x5a')){var _0x2fba31=_0x23ee95[_0xc4db('0x32')]({'plain':!![]});return db[_0xc4db('0x6a')][_0xc4db('0x50')]({'where':{'name':_0xc4db('0x33'),'userProfileId':_0x3f489c[_0xc4db('0x5b')]},'raw':!![]})[_0xc4db('0x31')](function(_0x38d8d6){if(_0x38d8d6&&_0x38d8d6[_0xc4db('0x5c')]===0x0){return db[_0xc4db('0x5d')][_0xc4db('0x58')]({'name':_0x2fba31['name'],'resourceId':_0x2fba31['id'],'type':_0x38d8d6[_0xc4db('0x35')],'sectionId':_0x38d8d6['id']},{})[_0xc4db('0x31')](function(){return _0x23ee95;});}else{return _0x23ee95;}})[_0xc4db('0x24')](function(_0x1d3344){logger[_0xc4db('0x1f')](_0xc4db('0x5e'),_0x1d3344);throw _0x1d3344;});}return _0x23ee95;})[_0xc4db('0x31')](respondWithResult(_0x40b489,0xc9))[_0xc4db('0x24')](handleError(_0x40b489,null));};exports[_0xc4db('0x2f')]=function(_0x5c63c3,_0x500abe,_0x3a86b2){var _0x1ddd98;return db[_0xc4db('0x39')]['find']({'where':{'id':_0x5c63c3[_0xc4db('0x52')]['id']}})['then'](handleEntityNotFound(_0x500abe,null))[_0xc4db('0x31')](saveUpdates(_0x5c63c3[_0xc4db('0x56')],null))[_0xc4db('0x31')](function(_0x1659fe){if(_0x1659fe){_0x1ddd98=_0x1659fe;return db[_0xc4db('0x39')][_0xc4db('0x5f')]({'raw':!![]});}})[_0xc4db('0x31')](function(_0x31bf4b){if(_0x31bf4b){var _0x458acf=fs[_0xc4db('0x60')](path[_0xc4db('0x61')](config[_0xc4db('0x62')],_0xc4db('0x63')),_0xc4db('0x64'));var _0x596a32=fs[_0xc4db('0x60')](path[_0xc4db('0x61')](config['root'],'server/files/templates/registry.ejs'),_0xc4db('0x64'));var _0x6c7b61=ejs[_0xc4db('0x65')](_0x458acf,{'trunks':_0x31bf4b||[]});fs['writeFileSync'](_0xc4db('0x66'),_0x6c7b61);var _0x24d148=ejs['render'](_0x596a32,{'trunks':_0x31bf4b||[]});fs[_0xc4db('0x67')](_0xc4db('0x6b'),_0x24d148);return respondWithRpcPromise(_0xc4db('0x68'),_0xc4db('0x2f'),{'module':'chan_sip.so'});}return null;})[_0xc4db('0x31')](function(_0x568679){if(_0x568679){return _0x1ddd98;}})['then'](respondWithResult(_0x500abe,null))['catch'](handleError(_0x500abe,null));};exports[_0xc4db('0x30')]=function(_0xb0dee,_0x1d2e96,_0x1fa0c4){var _0x44bddf;return db[_0xc4db('0x39')][_0xc4db('0x50')]({'where':{'id':_0xb0dee[_0xc4db('0x52')]['id']}})['then'](handleEntityNotFound(_0x1d2e96,null))[_0xc4db('0x31')](removeEntity(_0x1d2e96,null))[_0xc4db('0x31')](function(){return db['Trunk'][_0xc4db('0x5f')]({'raw':!![]});})[_0xc4db('0x31')](function(_0xb9db2e){var _0x48e82a=fs['readFileSync'](path[_0xc4db('0x61')](config[_0xc4db('0x62')],_0xc4db('0x63')),_0xc4db('0x64'));var _0x3b97bc=fs[_0xc4db('0x60')](path[_0xc4db('0x61')](config[_0xc4db('0x62')],_0xc4db('0x6c')),_0xc4db('0x64'));var _0x327477=ejs[_0xc4db('0x65')](_0x48e82a,{'trunks':_0xb9db2e});var _0x54287b=ejs['render'](_0x3b97bc,{'trunks':_0xb9db2e});fs[_0xc4db('0x67')](_0xc4db('0x66'),_0x327477);fs[_0xc4db('0x67')](_0xc4db('0x6b'),_0x54287b);return respondWithRpcPromise(_0xc4db('0x68'),_0xc4db('0x30'),{'module':'chan_sip.so'});})[_0xc4db('0x24')](handleError(_0x1d2e96,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 90de79b..3a0f35f 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 _0xb5b1=['api','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xb5b1,0x99));var _0x1b5b=function(_0xbb6c22,_0x229ed1){_0xbb6c22=_0xbb6c22-0x0;var _0x2a48d5=_0xb5b1[_0xbb6c22];return _0x2a48d5;};'use strict';var _=require(_0x1b5b('0x0'));var util=require(_0x1b5b('0x1'));var logger=require(_0x1b5b('0x2'))(_0x1b5b('0x3'));var moment=require(_0x1b5b('0x4'));var BPromise=require(_0x1b5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b5b('0x6'));var rimraf=require(_0x1b5b('0x7'));var config=require(_0x1b5b('0x8'));var attributes=require(_0x1b5b('0x9'));module['exports']=function(_0x390eb9,_0x204d34){return _0x390eb9[_0x1b5b('0xa')](_0x1b5b('0xb'),attributes,{'tableName':_0x1b5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bc3=['tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x49a91f,_0x32339c){var _0x45243c=function(_0x192477){while(--_0x192477){_0x49a91f['push'](_0x49a91f['shift']());}};_0x45243c(++_0x32339c);}(_0x9bc3,0x146));var _0x39bc=function(_0x39f861,_0x1d4050){_0x39f861=_0x39f861-0x0;var _0x4582bf=_0x9bc3[_0x39f861];return _0x4582bf;};'use strict';var _=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var logger=require(_0x39bc('0x2'))(_0x39bc('0x3'));var moment=require('moment');var BPromise=require(_0x39bc('0x4'));var rp=require(_0x39bc('0x5'));var fs=require('fs');var path=require(_0x39bc('0x6'));var rimraf=require(_0x39bc('0x7'));var config=require(_0x39bc('0x8'));var attributes=require(_0x39bc('0x9'));module[_0x39bc('0xa')]=function(_0x26bdd2,_0x1cbb80){return _0x26bdd2[_0x39bc('0xb')]('Trunk',attributes,{'tableName':_0x39bc('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 201d897..2a0ca01 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 _0xda2d=['../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowTrunk','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x10cac9,_0x5a16fe){var _0x422a09=function(_0x569364){while(--_0x569364){_0x10cac9['push'](_0x10cac9['shift']());}};_0x422a09(++_0x5a16fe);}(_0xda2d,0x102));var _0xdda2=function(_0x57328c,_0x4ca673){_0x57328c=_0x57328c-0x0;var _0x71785a=_0xda2d[_0x57328c];return _0x71785a;};'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']('Trunk,\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')]('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowTrunk']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['Trunk'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowTrunk',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file +var _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowTrunk','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5903b8,_0x43fe8d){var _0x1c255b=function(_0xb6ca5a){while(--_0xb6ca5a){_0x5903b8['push'](_0x5903b8['shift']());}};_0x1c255b(++_0x43fe8d);}(_0xb10b,0x12a));var _0xbb10=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xb10b[_0x22ffbf];return _0x360c17;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetTrunk',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowTrunk']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowTrunk',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 20919b9..90d85c4 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 _0x6611=['/presence','getPresence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','put','/:id','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami'];(function(_0x45abc8,_0x204450){var _0x1f7aea=function(_0x575cdc){while(--_0x575cdc){_0x45abc8['push'](_0x45abc8['shift']());}};_0x1f7aea(++_0x204450);}(_0x6611,0xdd));var _0x1661=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6611[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x1661('0x0'));var path=require(_0x1661('0x1'));var timeout=require(_0x1661('0x2'));var express=require(_0x1661('0x3'));var router=express[_0x1661('0x4')]();var fs_extra=require(_0x1661('0x5'));var auth=require(_0x1661('0x6'));var interaction=require(_0x1661('0x7'));var config=require(_0x1661('0x8'));var controller=require(_0x1661('0x9'));router[_0x1661('0xa')]('/',auth[_0x1661('0xb')](),controller['index']);router['get'](_0x1661('0xc'),auth[_0x1661('0xb')](),controller['describe']);router['get'](_0x1661('0xd'),auth[_0x1661('0xb')](),controller[_0x1661('0xe')]);router[_0x1661('0xa')](_0x1661('0xf'),auth[_0x1661('0xb')](),controller[_0x1661('0x10')]);router[_0x1661('0xa')]('/:id',auth[_0x1661('0xb')](),controller[_0x1661('0x11')]);router['get'](_0x1661('0x12'),controller['getAvatar']);router[_0x1661('0xa')](_0x1661('0x13'),auth[_0x1661('0xb')](),controller[_0x1661('0x14')]);router[_0x1661('0xa')](_0x1661('0x15'),auth[_0x1661('0xb')](),controller[_0x1661('0x16')]);router[_0x1661('0xa')](_0x1661('0x17'),auth[_0x1661('0xb')](),controller[_0x1661('0x18')]);router[_0x1661('0xa')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x1661('0x19')]);router[_0x1661('0xa')]('/:id/groups',auth[_0x1661('0xb')](),controller[_0x1661('0x1a')]);router[_0x1661('0xa')](_0x1661('0x1b'),auth['isAuthenticated'](),controller[_0x1661('0x1c')]);router['get'](_0x1661('0x1d'),auth['isAuthenticated'](),controller[_0x1661('0x1e')]);router[_0x1661('0xa')]('/:id/chat/interactions',auth[_0x1661('0xb')](),controller['getChatInteractions']);router[_0x1661('0xa')](_0x1661('0x1f'),auth[_0x1661('0xb')](),controller[_0x1661('0x20')]);router[_0x1661('0xa')](_0x1661('0x21'),auth[_0x1661('0xb')](),controller['getMailInteractions']);router['get'](_0x1661('0x22'),auth[_0x1661('0xb')](),controller[_0x1661('0x23')]);router[_0x1661('0xa')](_0x1661('0x24'),auth['isAuthenticated'](),controller[_0x1661('0x25')]);router['get'](_0x1661('0x26'),auth[_0x1661('0xb')](),controller[_0x1661('0x27')]);router[_0x1661('0xa')]('/:id/teams',auth[_0x1661('0xb')](),controller[_0x1661('0x28')]);router[_0x1661('0xa')]('/:id/lists',auth[_0x1661('0xb')](),controller[_0x1661('0x29')]);router['get'](_0x1661('0x2a'),auth['isAuthenticated'](),controller[_0x1661('0x2b')]);router[_0x1661('0xa')](_0x1661('0x2c'),auth[_0x1661('0xb')](),controller[_0x1661('0x2d')]);router[_0x1661('0xa')](_0x1661('0x2e'),auth[_0x1661('0xb')](),controller['getFaxAccounts']);router[_0x1661('0xa')](_0x1661('0x2f'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x1661('0xa')]('/:id/openchannel_accounts',auth[_0x1661('0xb')](),controller[_0x1661('0x30')]);router['get'](_0x1661('0x31'),auth[_0x1661('0xb')](),controller[_0x1661('0x32')]);router[_0x1661('0xa')](_0x1661('0x33'),auth[_0x1661('0xb')](),controller['getChatWebsites']);router[_0x1661('0xa')](_0x1661('0x34'),auth['isAuthenticated'](),controller[_0x1661('0x35')]);router[_0x1661('0xa')]('/:id/square_projects',auth[_0x1661('0xb')](),controller['getSquareProjects']);router[_0x1661('0xa')](_0x1661('0x36'),auth[_0x1661('0xb')](),controller[_0x1661('0x37')]);router[_0x1661('0xa')](_0x1661('0x38'),auth[_0x1661('0xb')](),controller['getApiKey']);router[_0x1661('0x39')](_0x1661('0x15'),auth[_0x1661('0xb')](),controller[_0x1661('0x3a')]);router['post']('/',auth[_0x1661('0xb')](),controller[_0x1661('0x3b')]);router[_0x1661('0x39')]('/create_many',auth[_0x1661('0xb')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0x1661('0xb')](),controller[_0x1661('0x3c')]);var upload=multer({'storage':multer[_0x1661('0x3d')]({'destination':function(_0x349cde,_0x3ee199,_0x339864){_0x339864(null,path['join'](config[_0x1661('0x3e')],_0x1661('0x3f')));},'filename':function(_0x21f793,_0x502647,_0x3a24e4){_0x3a24e4(null,util[_0x1661('0x40')](_0x1661('0x41'),Date[_0x1661('0x42')](),_0x502647[_0x1661('0x43')]));}})});router['post']('/:id/avatar',upload['single'](_0x1661('0x44')),controller[_0x1661('0x45')]);router[_0x1661('0x39')](_0x1661('0x46'),auth[_0x1661('0xb')](),controller[_0x1661('0x47')]);router[_0x1661('0x39')](_0x1661('0x48'),auth[_0x1661('0xb')](),controller['logout']);router['post'](_0x1661('0x49'),auth['isAuthenticated'](),controller[_0x1661('0x4a')]);router[_0x1661('0x39')](_0x1661('0x4b'),auth['isAuthenticated'](),controller[_0x1661('0x4c')]);router[_0x1661('0x39')](_0x1661('0x4d'),auth[_0x1661('0xb')](),controller['addTeams']);router['post'](_0x1661('0x4e'),auth[_0x1661('0xb')](),controller[_0x1661('0x4f')]);router['post'](_0x1661('0x50'),auth[_0x1661('0xb')](),controller[_0x1661('0x51')]);router[_0x1661('0x39')](_0x1661('0x52'),auth[_0x1661('0xb')](),controller['addFaxInteractions']);router[_0x1661('0x39')](_0x1661('0x53'),auth[_0x1661('0xb')](),controller[_0x1661('0x54')]);router[_0x1661('0x39')](_0x1661('0x55'),auth[_0x1661('0xb')](),controller[_0x1661('0x56')]);router['post'](_0x1661('0x57'),auth[_0x1661('0xb')](),controller[_0x1661('0x58')]);router[_0x1661('0x39')]('/:id/fax_accounts',auth[_0x1661('0xb')](),controller[_0x1661('0x59')]);router[_0x1661('0x39')](_0x1661('0x2f'),auth[_0x1661('0xb')](),controller[_0x1661('0x5a')]);router[_0x1661('0x39')]('/:id/openchannel_accounts',auth[_0x1661('0xb')](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x1661('0xb')](),controller[_0x1661('0x5b')]);router[_0x1661('0x39')](_0x1661('0x33'),auth['isAuthenticated'](),controller[_0x1661('0x5c')]);router[_0x1661('0x39')](_0x1661('0x34'),auth[_0x1661('0xb')](),controller[_0x1661('0x5d')]);router['post'](_0x1661('0x5e'),auth[_0x1661('0xb')](),controller[_0x1661('0x5f')]);router[_0x1661('0x39')](_0x1661('0x38'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x1661('0x60')](_0x1661('0x61'),auth[_0x1661('0xb')](),controller[_0x1661('0x62')]);router[_0x1661('0x60')](_0x1661('0x63'),auth[_0x1661('0xb')](),controller[_0x1661('0x64')]);router['delete'](_0x1661('0x17'),auth['isAuthenticated'](),controller[_0x1661('0x65')]);router[_0x1661('0x66')](_0x1661('0x4d'),auth[_0x1661('0xb')](),controller[_0x1661('0x67')]);router[_0x1661('0x66')](_0x1661('0x61'),auth[_0x1661('0xb')](),controller[_0x1661('0x68')]);router[_0x1661('0x66')](_0x1661('0x4e'),auth[_0x1661('0xb')](),controller[_0x1661('0x69')]);router[_0x1661('0x66')](_0x1661('0x50'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x1661('0x66')](_0x1661('0x52'),auth[_0x1661('0xb')](),controller[_0x1661('0x6a')]);router['delete']('/:id/sms_interactions',auth[_0x1661('0xb')](),controller[_0x1661('0x6b')]);router[_0x1661('0x66')](_0x1661('0x55'),auth[_0x1661('0xb')](),controller[_0x1661('0x6c')]);router[_0x1661('0x66')](_0x1661('0x57'),auth[_0x1661('0xb')](),controller[_0x1661('0x6d')]);router[_0x1661('0x66')]('/:id/fax_accounts',auth[_0x1661('0xb')](),controller[_0x1661('0x6e')]);router[_0x1661('0x66')](_0x1661('0x2f'),auth[_0x1661('0xb')](),controller[_0x1661('0x6f')]);router[_0x1661('0x66')](_0x1661('0x70'),auth[_0x1661('0xb')](),controller[_0x1661('0x71')]);router[_0x1661('0x66')](_0x1661('0x31'),auth[_0x1661('0xb')](),controller[_0x1661('0x72')]);router[_0x1661('0x66')](_0x1661('0x33'),auth[_0x1661('0xb')](),controller[_0x1661('0x73')]);router['delete'](_0x1661('0x34'),auth['isAuthenticated'](),controller[_0x1661('0x74')]);router[_0x1661('0x66')]('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);router['delete'](_0x1661('0x38'),auth[_0x1661('0xb')](),controller[_0x1661('0x75')]);module['exports']=router; \ No newline at end of file +var _0xbd50=['getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','create','/create_many','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','delete','removeQueues','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeSquareProjects','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups'];(function(_0x109edf,_0x1d18b5){var _0x4040ac=function(_0xf4b332){while(--_0xf4b332){_0x109edf['push'](_0x109edf['shift']());}};_0x4040ac(++_0x1d18b5);}(_0xbd50,0x196));var _0x0bd5=function(_0x34bd11,_0x322433){_0x34bd11=_0x34bd11-0x0;var _0x2a4f5c=_0xbd50[_0x34bd11];return _0x2a4f5c;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['get'](_0x0bd5('0xe'),auth[_0x0bd5('0x8')](),controller['getPresence']);router[_0x0bd5('0xa')](_0x0bd5('0xf'),auth['isAuthenticated'](),controller[_0x0bd5('0x10')]);router[_0x0bd5('0xa')](_0x0bd5('0x11'),controller['getAvatar']);router[_0x0bd5('0xa')](_0x0bd5('0x12'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x13')]);router[_0x0bd5('0xa')](_0x0bd5('0x14'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x15')]);router['get'](_0x0bd5('0x16'),auth[_0x0bd5('0x8')](),controller['getQueues']);router[_0x0bd5('0xa')](_0x0bd5('0x17'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x18')]);router['get'](_0x0bd5('0x19'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1a')]);router[_0x0bd5('0xa')](_0x0bd5('0x1b'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1c')]);router[_0x0bd5('0xa')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1e')]);router[_0x0bd5('0xa')](_0x0bd5('0x1f'),auth[_0x0bd5('0x8')](),controller['getChatInteractions']);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x0bd5('0xa')](_0x0bd5('0x20'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x21')]);router[_0x0bd5('0xa')]('/:id/sms/interactions',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x22')]);router[_0x0bd5('0xa')]('/:id/fax/interactions',auth[_0x0bd5('0x8')](),controller['getFaxInteractions']);router['get'](_0x0bd5('0x23'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x24')]);router['get'](_0x0bd5('0x25'),auth['isAuthenticated'](),controller[_0x0bd5('0x26')]);router[_0x0bd5('0xa')](_0x0bd5('0x27'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x28')]);router[_0x0bd5('0xa')](_0x0bd5('0x29'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x2a')]);router[_0x0bd5('0xa')](_0x0bd5('0x2b'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x2c')]);router[_0x0bd5('0xa')]('/:id/fax_accounts',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x2d')]);router['get'](_0x0bd5('0x2e'),auth[_0x0bd5('0x8')](),controller['getMailAccounts']);router[_0x0bd5('0xa')](_0x0bd5('0x2f'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x30')]);router['get'](_0x0bd5('0x31'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x32')]);router[_0x0bd5('0xa')](_0x0bd5('0x33'),auth[_0x0bd5('0x8')](),controller['getChatWebsites']);router[_0x0bd5('0xa')]('/:id/whatsapp_accounts',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x34')]);router[_0x0bd5('0xa')](_0x0bd5('0x35'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x36')]);router[_0x0bd5('0xa')](_0x0bd5('0x37'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x38')]);router[_0x0bd5('0xa')](_0x0bd5('0x39'),auth[_0x0bd5('0x8')](),controller['getApiKey']);router[_0x0bd5('0x3a')](_0x0bd5('0x14'),auth['isAuthenticated'](),controller['addContacts']);router[_0x0bd5('0x3a')]('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x3b')]);router[_0x0bd5('0x3a')](_0x0bd5('0x3c'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x3d')]);router[_0x0bd5('0x3a')](_0x0bd5('0x16'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x3e')]);var upload=multer({'storage':multer[_0x0bd5('0x3f')]({'destination':function(_0x427de9,_0x4c4fd4,_0x109f54){_0x109f54(null,path['join'](config[_0x0bd5('0x40')],_0x0bd5('0x41')));},'filename':function(_0x30f9da,_0x1fcc49,_0x3fdc95){_0x3fdc95(null,util[_0x0bd5('0x42')]('%s-%s',Date[_0x0bd5('0x43')](),_0x1fcc49[_0x0bd5('0x44')]));}})});router[_0x0bd5('0x3a')](_0x0bd5('0x11'),upload[_0x0bd5('0x45')](_0x0bd5('0x46')),controller[_0x0bd5('0x47')]);router[_0x0bd5('0x3a')](_0x0bd5('0x48'),auth['isAuthenticated'](),controller[_0x0bd5('0x49')]);router['post'](_0x0bd5('0x4a'),auth[_0x0bd5('0x8')](),controller['logout']);router[_0x0bd5('0x3a')](_0x0bd5('0x4b'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x4c')]);router[_0x0bd5('0x3a')](_0x0bd5('0x4d'),auth[_0x0bd5('0x8')](),controller['unpause']);router['post'](_0x0bd5('0x25'),auth['isAuthenticated'](),controller['addTeams']);router[_0x0bd5('0x3a')](_0x0bd5('0x4e'),auth['isAuthenticated'](),controller['addChatInteractions']);router['post'](_0x0bd5('0x4f'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x0bd5('0x3a')](_0x0bd5('0x50'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x0bd5('0x3a')](_0x0bd5('0x51'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x52')]);router['post'](_0x0bd5('0x53'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x54')]);router[_0x0bd5('0x3a')](_0x0bd5('0x55'),auth[_0x0bd5('0x8')](),controller['addWhatsappInteractions']);router[_0x0bd5('0x3a')](_0x0bd5('0x56'),auth[_0x0bd5('0x8')](),controller['addFaxAccounts']);router[_0x0bd5('0x3a')](_0x0bd5('0x2e'),auth[_0x0bd5('0x8')](),controller['addMailAccounts']);router[_0x0bd5('0x3a')](_0x0bd5('0x2f'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x57')]);router[_0x0bd5('0x3a')]('/:id/sms_accounts',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x58')]);router['post'](_0x0bd5('0x33'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x59')]);router[_0x0bd5('0x3a')](_0x0bd5('0x5a'),auth['isAuthenticated'](),controller[_0x0bd5('0x5b')]);router[_0x0bd5('0x3a')]('/:id/square_projects',auth[_0x0bd5('0x8')](),controller['addSquareProjects']);router[_0x0bd5('0x3a')](_0x0bd5('0x39'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x5c')]);router['put'](_0x0bd5('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x0bd5('0x5d')](_0x0bd5('0x5e'),auth[_0x0bd5('0x8')](),controller['changePassword']);router[_0x0bd5('0x5f')]('/:id/queues',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x60')]);router[_0x0bd5('0x5f')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x0bd5('0x5f')](_0x0bd5('0xf'),auth[_0x0bd5('0x8')](),controller['destroy']);router[_0x0bd5('0x5f')](_0x0bd5('0x4e'),auth['isAuthenticated'](),controller[_0x0bd5('0x61')]);router['delete']('/:id/mail_interactions',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x62')]);router[_0x0bd5('0x5f')](_0x0bd5('0x50'),auth['isAuthenticated'](),controller[_0x0bd5('0x63')]);router[_0x0bd5('0x5f')](_0x0bd5('0x51'),auth['isAuthenticated'](),controller[_0x0bd5('0x64')]);router[_0x0bd5('0x5f')](_0x0bd5('0x53'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x0bd5('0x5f')]('/:id/whatsapp_interactions',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x65')]);router[_0x0bd5('0x5f')]('/:id/fax_accounts',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x66')]);router[_0x0bd5('0x5f')](_0x0bd5('0x2e'),auth['isAuthenticated'](),controller[_0x0bd5('0x67')]);router[_0x0bd5('0x5f')](_0x0bd5('0x2f'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x68')]);router['delete'](_0x0bd5('0x31'),auth['isAuthenticated'](),controller[_0x0bd5('0x69')]);router['delete']('/:id/chat_websites',auth[_0x0bd5('0x8')](),controller['removeChatWebsites']);router[_0x0bd5('0x5f')](_0x0bd5('0x5a'),auth[_0x0bd5('0x8')](),controller['removeWhatsappAccounts']);router[_0x0bd5('0x5f')](_0x0bd5('0x35'),auth['isAuthenticated'](),controller[_0x0bd5('0x6a')]);router[_0x0bd5('0x5f')]('/:id/api_key',auth[_0x0bd5('0x8')](),controller['removeApiKey']);module[_0x0bd5('0x6b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 370ddf7..fcc4498 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 _0x2442=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','showWebBar','isArray','udp','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','avpf','dtlscertfile','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x2442,0xe9));var _0x2244=function(_0x392dc2,_0x47c3f3){_0x392dc2=_0x392dc2-0x0;var _0x14150f=_0x2442[_0x392dc2];return _0x14150f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x2244('0x0'));module[_0x2244('0x1')]={'name':{'type':Sequelize[_0x2244('0x2')],'allowNull':![],'unique':_0x2244('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x395672){this[_0x2244('0x4')](_0x2244('0x3'),_0x395672);this['setDataValue']('defaultuser',_0x395672);},'comment':_0x2244('0x5')},'fullname':{'type':Sequelize[_0x2244('0x2')],'allowNull':![],'set':function(_0x4c875a){this[_0x2244('0x4')](_0x2244('0x6'),_0x4c875a);this['setDataValue'](_0x2244('0x7'),util[_0x2244('0x8')](_0x2244('0x9'),_0x4c875a,this[_0x2244('0xa')](_0x2244('0xb'))));}},'alias':{'type':Sequelize[_0x2244('0x2')]},'email':{'type':Sequelize[_0x2244('0x2')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x5b0afd){if(_0x5b0afd){this[_0x2244('0x4')](_0x2244('0xc'),_0x5b0afd[_0x2244('0xd')]());}}},'role':{'type':Sequelize[_0x2244('0xe')](_0x2244('0xf'),_0x2244('0x10'),_0x2244('0x11'),_0x2244('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x2244('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x2244('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x2244('0xb'),'set':function(_0x372302){this[_0x2244('0x4')](_0x2244('0xb'),_0x372302);this[_0x2244('0x4')](_0x2244('0x14'),_0x372302);this[_0x2244('0x4')](_0x2244('0x7'),util[_0x2244('0x8')](_0x2244('0x9'),this[_0x2244('0xa')](_0x2244('0x6')),_0x372302));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2244('0x2')]},'mobile':{'type':Sequelize[_0x2244('0x2')]},'address':{'type':Sequelize[_0x2244('0x2')]},'zipcode':{'type':Sequelize[_0x2244('0x2')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2244('0x2')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2244('0x15')]},'voicePause':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2244('0x2')],'defaultValue':_0x2244('0x17')},'lastPauseAt':{'type':Sequelize[_0x2244('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2244('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2244('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2244('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2244('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2244('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2244('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![],'defaultValue':_0x2244('0x19')},'ipaddr':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x1a'),_0x2244('0x10'),_0x2244('0x1b')),'allowNull':!![],'defaultValue':_0x2244('0x1a')},'context':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x1c'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x2244('0x1d'),_0x2244('0x1e'),_0x2244('0x1f'),_0x2244('0x20'),_0x2244('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1228cc){this['setDataValue'](_0x2244('0x22'),_0x1228cc?_0x1228cc[_0x2244('0x23')](','):null);},'get':function(){return this[_0x2244('0xa')]('transport')?this[_0x2244('0xa')](_0x2244('0x22'))[_0x2244('0x24')](','):null;},'comment':_0x2244('0x25')},'dtmfmode':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x26'),'info',_0x2244('0x27'),'inband',_0x2244('0x28')),'allowNull':!![],'defaultValue':_0x2244('0x26')},'directmedia':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no','nonat',_0x2244('0x2a'),_0x2244('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![],'defaultValue':_0x2244('0x2c'),'set':function(_0x361d51){this[_0x2244('0x4')](_0x2244('0x2d'),_0x361d51?_0x361d51[_0x2244('0x23')](','):null);},'get':function(){return this[_0x2244('0xa')](_0x2244('0x2d'))?this[_0x2244('0xa')](_0x2244('0x2d'))[_0x2244('0x24')](','):null;},'comment':_0x2244('0x2e')},'callgroup':{'type':Sequelize[_0x2244('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2244('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2244('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x2244('0x2')],'allowNull':![],'defaultValue':_0x2244('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2244('0x30'),'set':function(_0x50fb8d){this[_0x2244('0x4')](_0x2244('0x31'),_0x50fb8d?_0x50fb8d[_0x2244('0x23')](';'):_0x2244('0x30'));},'get':function(){return this['getDataValue'](_0x2244('0x31'))?this[_0x2244('0xa')]('allow')['split'](';'):null;},'comment':_0x2244('0x32')},'autoframing':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![],'set':function(_0x184cfb){this[_0x2244('0x4')](_0x2244('0x33'),_0x184cfb?_0x184cfb[_0x2244('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x2244('0x33'))?this[_0x2244('0xa')](_0x2244('0x33'))[_0x2244('0x24')](','):null;},'comment':_0x2244('0x34')},'trustrpid':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2244('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no',_0x2244('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![],'defaultValue':_0x2244('0x29')},'busylevel':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2244('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2244('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2244('0xe')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no',_0x2244('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2244('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2244('0xe')]('accept',_0x2244('0x37'),_0x2244('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x39'),_0x2244('0x3a')),'allowNull':!![],'defaultValue':_0x2244('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![],'defaultValue':_0x2244('0x29')},'keepalive':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2244('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2244('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no',_0x2244('0x3b'),_0x2244('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x3d'),_0x2244('0x3e'),_0x2244('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2244('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2244('0xe')]('yes','no',_0x2244('0x40'),_0x2244('0x2a'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x2244('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0x2244('0x18')],'defaultValue':0x0,'set':function(_0x59b5c7){this['setDataValue'](_0x2244('0x41'),_0x59b5c7);var _0x87fa84=this['get']({'plain':!![]});switch(_0x59b5c7){case 0x0:case 0x1:var _0x251abb=_0x87fa84[_0x2244('0x22')]?_[_0x2244('0x42')](_0x87fa84['transport'])?_0x87fa84[_0x2244('0x22')][_0x2244('0x23')]():_0x87fa84[_0x2244('0x22')]:_0x2244('0x43');if(_0x251abb===_0x2244('0x44')){_0x251abb='udp';}this[_0x2244('0x4')]('transport',_0x251abb);this[_0x2244('0x4')](_0x2244('0x45'),'no');this[_0x2244('0x4')]('avpf',null);this['setDataValue'](_0x2244('0x46'),null);this[_0x2244('0x4')](_0x2244('0x47'),null);this[_0x2244('0x4')](_0x2244('0x48'),null);this[_0x2244('0x4')](_0x2244('0x49'),null);this['setDataValue'](_0x2244('0x4a'),null);this['setDataValue']('dtlscertfile',null);this[_0x2244('0x4')](_0x2244('0x4b'),null);this[_0x2244('0x4')](_0x2244('0x4c'),'no');break;case 0x2:this[_0x2244('0x4')](_0x2244('0x22'),'wss');this[_0x2244('0x4')](_0x2244('0x45'),'yes');this[_0x2244('0x4')](_0x2244('0x4d'),_0x2244('0x29'));this[_0x2244('0x4')](_0x2244('0x46'),'yes');this[_0x2244('0x4')](_0x2244('0x47'),_0x2244('0x29'));this[_0x2244('0x4')](_0x2244('0x48'),'yes');this[_0x2244('0x4')](_0x2244('0x49'),'no');this[_0x2244('0x4')](_0x2244('0x4a'),_0x2244('0x3f'));this[_0x2244('0x4')](_0x2244('0x4e'),_0x87fa84[_0x2244('0x4e')]||'/etc/pki/tls/certs/motion.crt');this[_0x2244('0x4')](_0x2244('0x4b'),_0x87fa84['dtlsprivatekey']||_0x2244('0x4f'));this[_0x2244('0x4')]('rtcp_mux',_0x2244('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x2244('0x50')],'set':function(_0x41795e){this[_0x2244('0x4')](_0x2244('0x51'),_0x41795e?_0x41795e[_0x2244('0x23')](','):[]);},'get':function(){return this[_0x2244('0xa')](_0x2244('0x51'))?_[_0x2244('0x52')](this[_0x2244('0xa')](_0x2244('0x51'))[_0x2244('0x24')](','),function(_0x1de083){return parseInt(_0x1de083,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2244('0x2')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2244('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2244('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2244('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2244('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2244('0xe')](_0x2244('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2244('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2244('0x53')],'get':function(){return this[_0x2244('0xa')](_0x2244('0x54'))?this[_0x2244('0xa')](_0x2244('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x2244('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2244('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x30d6fd){if(typeof _0x30d6fd==='string'){var _0x26cc30=_0x30d6fd==='1'?!![]:_0x30d6fd==='0'?![]:_0x30d6fd===_0x2244('0x55')?!![]:_0x30d6fd===_0x2244('0x56')?![]:![];this[_0x2244('0x4')](_0x2244('0x57'),_0x26cc30);}else{this['setDataValue']('screenrecording',_0x30d6fd);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x22ad3a){this[_0x2244('0x4')](_0x2244('0x58'),_0x22ad3a);if(_0x22ad3a===!![]){this['setDataValue'](_0x2244('0x59'),moment());this[_0x2244('0x4')]('loginAttempts',0x0);}else{this[_0x2244('0x4')](_0x2244('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2244('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2244('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2244('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7f50=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','get','isArray','wss','encryption','avpf','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','moment','util','lodash','exports','name','setDataValue','STRING','fullname','callerid','format','getDataValue','internal','email','toLowerCase','admin','agent','local','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED'];(function(_0x294bf3,_0x54a948){var _0x56a8dc=function(_0x2088fb){while(--_0x2088fb){_0x294bf3['push'](_0x294bf3['shift']());}};_0x56a8dc(++_0x54a948);}(_0x7f50,0xf3));var _0x07f5=function(_0x4d9f9a,_0x255bed){_0x4d9f9a=_0x4d9f9a-0x0;var _0x12db25=_0x7f50[_0x4d9f9a];return _0x12db25;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x07f5('0x0'));var util=require(_0x07f5('0x1'));var _=require(_0x07f5('0x2'));module[_0x07f5('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x07f5('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1e4a0c){this['setDataValue'](_0x07f5('0x4'),_0x1e4a0c);this[_0x07f5('0x5')]('defaultuser',_0x1e4a0c);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x07f5('0x6')],'allowNull':![],'set':function(_0x3064a7){this[_0x07f5('0x5')](_0x07f5('0x7'),_0x3064a7);this['setDataValue'](_0x07f5('0x8'),util[_0x07f5('0x9')]('\x22%s\x22\x20<%s>',_0x3064a7,this[_0x07f5('0xa')](_0x07f5('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x07f5('0xc'),'validate':{'isEmail':!![]},'set':function(_0x590d71){if(_0x590d71){this[_0x07f5('0x5')](_0x07f5('0xc'),_0x590d71[_0x07f5('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x07f5('0xe'),'user',_0x07f5('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x07f5('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x07f5('0x6')],'defaultValue':_0x07f5('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x07f5('0xb'),'set':function(_0x1b9c3b){this['setDataValue'](_0x07f5('0xb'),_0x1b9c3b);this[_0x07f5('0x5')](_0x07f5('0x11'),_0x1b9c3b);this[_0x07f5('0x5')](_0x07f5('0x8'),util[_0x07f5('0x9')](_0x07f5('0x12'),this[_0x07f5('0xa')]('fullname'),_0x1b9c3b));}},'salt':{'type':Sequelize[_0x07f5('0x6')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x07f5('0x6')]},'address':{'type':Sequelize[_0x07f5('0x6')]},'zipcode':{'type':Sequelize[_0x07f5('0x6')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x07f5('0x6')]},'online':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x07f5('0x14')]},'voicePause':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x07f5('0x6')],'defaultValue':_0x07f5('0x15')},'lastPauseAt':{'type':Sequelize[_0x07f5('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x07f5('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x07f5('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![],'defaultValue':_0x07f5('0x17')},'ipaddr':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0x07f5('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x19'),'user',_0x07f5('0x1a')),'allowNull':!![],'defaultValue':_0x07f5('0x19')},'context':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![],'defaultValue':_0x07f5('0x1b')},'callingpres':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x1c'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x07f5('0x1d'),_0x07f5('0x1e'),_0x07f5('0x1f'),'PROHIB_FAILED_SCREEN',_0x07f5('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![],'defaultValue':_0x07f5('0x21'),'set':function(_0x3491c9){this[_0x07f5('0x5')]('transport',_0x3491c9?_0x3491c9[_0x07f5('0x22')](','):null);},'get':function(){return this[_0x07f5('0xa')](_0x07f5('0x23'))?this['getDataValue'](_0x07f5('0x23'))[_0x07f5('0x24')](','):null;},'comment':_0x07f5('0x25')},'dtmfmode':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x26'),_0x07f5('0x27'),_0x07f5('0x28'),'inband',_0x07f5('0x29')),'allowNull':!![],'defaultValue':_0x07f5('0x26')},'directmedia':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no',_0x07f5('0x2b'),_0x07f5('0x2c'),_0x07f5('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![],'defaultValue':_0x07f5('0x2e'),'set':function(_0x311e07){this[_0x07f5('0x5')](_0x07f5('0x2f'),_0x311e07?_0x311e07[_0x07f5('0x22')](','):null);},'get':function(){return this[_0x07f5('0xa')](_0x07f5('0x2f'))?this[_0x07f5('0xa')](_0x07f5('0x2f'))[_0x07f5('0x24')](','):null;},'comment':_0x07f5('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x07f5('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x07f5('0x6')]},'disallow':{'type':Sequelize[_0x07f5('0x6')],'allowNull':![],'defaultValue':_0x07f5('0x31')},'allow':{'type':Sequelize[_0x07f5('0x6')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x27e911){this['setDataValue'](_0x07f5('0x32'),_0x27e911?_0x27e911[_0x07f5('0x22')](';'):_0x07f5('0x33'));},'get':function(){return this['getDataValue']('allow')?this[_0x07f5('0xa')]('allow')[_0x07f5('0x24')](';'):null;},'comment':_0x07f5('0x34')},'autoframing':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![],'set':function(_0x114b27){this[_0x07f5('0x5')](_0x07f5('0x35'),_0x114b27?_0x114b27[_0x07f5('0x22')](','):null);},'get':function(){return this[_0x07f5('0xa')](_0x07f5('0x35'))?this[_0x07f5('0xa')](_0x07f5('0x35'))[_0x07f5('0x24')](','):null;},'comment':_0x07f5('0x36')},'trustrpid':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x07f5('0x2a'),'no',_0x07f5('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x07f5('0x38')},'amaflags':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x07f5('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no',_0x07f5('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x3a'),_0x07f5('0x3b'),_0x07f5('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x3d'),_0x07f5('0x3e')),'allowNull':!![],'defaultValue':_0x07f5('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x07f5('0x2a')},'keepalive':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x07f5('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x07f5('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x07f5('0x18')]('yes','no','fingerprint',_0x07f5('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x07f5('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x07f5('0x40'),_0x07f5('0x41'),_0x07f5('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x07f5('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x07f5('0x18')](_0x07f5('0x2a'),'no',_0x07f5('0x2b'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x07f5('0x6')]},'resetPasswordExpires':{'type':Sequelize[_0x07f5('0x14')]},'passwordResetAt':{'type':Sequelize[_0x07f5('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x0,'set':function(_0x49343d){this['setDataValue']('showWebBar',_0x49343d);var _0x285e64=this[_0x07f5('0x43')]({'plain':!![]});switch(_0x49343d){case 0x0:case 0x1:var _0x33ea81=_0x285e64[_0x07f5('0x23')]?_[_0x07f5('0x44')](_0x285e64[_0x07f5('0x23')])?_0x285e64[_0x07f5('0x23')][_0x07f5('0x22')]():_0x285e64[_0x07f5('0x23')]:_0x07f5('0x21');if(_0x33ea81===_0x07f5('0x45')){_0x33ea81='udp';}this['setDataValue'](_0x07f5('0x23'),_0x33ea81);this[_0x07f5('0x5')](_0x07f5('0x46'),'no');this['setDataValue'](_0x07f5('0x47'),null);this['setDataValue']('force_avp',null);this[_0x07f5('0x5')]('icesupport',null);this[_0x07f5('0x5')](_0x07f5('0x48'),null);this[_0x07f5('0x5')](_0x07f5('0x49'),null);this[_0x07f5('0x5')](_0x07f5('0x4a'),null);this['setDataValue'](_0x07f5('0x4b'),null);this[_0x07f5('0x5')](_0x07f5('0x4c'),null);this['setDataValue'](_0x07f5('0x4d'),'no');break;case 0x2:this[_0x07f5('0x5')](_0x07f5('0x23'),_0x07f5('0x45'));this[_0x07f5('0x5')](_0x07f5('0x46'),_0x07f5('0x2a'));this[_0x07f5('0x5')]('avpf',_0x07f5('0x2a'));this[_0x07f5('0x5')]('force_avp',_0x07f5('0x2a'));this[_0x07f5('0x5')](_0x07f5('0x4e'),_0x07f5('0x2a'));this['setDataValue']('dtlsenable','yes');this['setDataValue'](_0x07f5('0x49'),'no');this['setDataValue'](_0x07f5('0x4a'),_0x07f5('0x42'));this[_0x07f5('0x5')](_0x07f5('0x4b'),_0x285e64['dtlscertfile']||_0x07f5('0x4f'));this[_0x07f5('0x5')]('dtlsprivatekey',_0x285e64[_0x07f5('0x4c')]||_0x07f5('0x50'));this[_0x07f5('0x5')](_0x07f5('0x4d'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x07f5('0x51')],'set':function(_0xf682af){this[_0x07f5('0x5')]('permissions',_0xf682af?_0xf682af['join'](','):[]);},'get':function(){return this['getDataValue'](_0x07f5('0x52'))?_[_0x07f5('0x53')](this[_0x07f5('0xa')](_0x07f5('0x52'))[_0x07f5('0x24')](','),function(_0x4264e9){return parseInt(_0x4264e9,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x07f5('0x6')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x07f5('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x07f5('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x07f5('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x07f5('0x54')],'get':function(){return this[_0x07f5('0xa')](_0x07f5('0x55'))?this[_0x07f5('0xa')](_0x07f5('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x07f5('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x07f5('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![],'set':function(_0x44b020){if(typeof _0x44b020===_0x07f5('0x56')){var _0xa90f0a=_0x44b020==='1'?!![]:_0x44b020==='0'?![]:_0x44b020==='true'?!![]:_0x44b020==='false'?![]:![];this[_0x07f5('0x5')]('screenrecording',_0xa90f0a);}else{this[_0x07f5('0x5')](_0x07f5('0x57'),_0x44b020);}}},'blocked':{'type':Sequelize[_0x07f5('0x13')],'defaultValue':![],'set':function(_0x139d19){this[_0x07f5('0x5')](_0x07f5('0x58'),_0x139d19);if(_0x139d19===!![]){this[_0x07f5('0x5')](_0x07f5('0x59'),moment());this[_0x07f5('0x5')](_0x07f5('0x5a'),0x0);}else{this[_0x07f5('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x07f5('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x07f5('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 82b67ea..b2d1fe1 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 _0xb1b0=['ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','previousPasswords','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','UserVoiceQueueRt','upsert','remove','Queue:remove','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','order','List','Tag','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','emit','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','MemberReport','concat','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','pauseType','manual','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','QueueId','removeTeams','getMailQueues','Fax','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','omit','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','removeSquareProjects','$gt','$eq','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','firstName','lastName','CmContact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','isEmpty','teams','queues','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','request','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','catch','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','get','admin','Users','user','agent','telephone','filter','map','value','includes','role','name','UserProfileResource','sendStatus','stack','send','index','rawAttributes','fieldName','type','model','password','salt','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','sequelize','lower','col','options','User','includeAll','include','findAll','rows','chat','push','sms','fax','dataValues','mail','openchannel','all','params','differenceBy','intersection','find','whatsapp','body','describe','addContacts','ids','Setting','findById','securePassword','validatePasswordPattern','max','internal','min_internal','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','VoiceMail','fullname','permissions','101','103','113','110','104','106','107','108','109','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','UserProfileSection','Agents','Telephones','userProfileId','autoAssociation','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','each','some','changePassword','oldPassword','newPassword','Sequelize'];(function(_0x47a17c,_0x41af77){var _0x3f4e88=function(_0x321a01){while(--_0x321a01){_0x47a17c['push'](_0x47a17c['shift']());}};_0x3f4e88(++_0x41af77);}(_0xb1b0,0x100));var _0x0b1b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb1b0[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0x0b1b('0x0'));var emlformat=require(_0x0b1b('0x1'));var rimraf=require(_0x0b1b('0x2'));var zipdir=require(_0x0b1b('0x3'));var jsonpatch=require(_0x0b1b('0x4'));var rp=require(_0x0b1b('0x5'));var moment=require(_0x0b1b('0x6'));var BPromise=require(_0x0b1b('0x7'));var Mustache=require(_0x0b1b('0x8'));var util=require(_0x0b1b('0x9'));var path=require(_0x0b1b('0xa'));var sox=require(_0x0b1b('0xb'));var csv=require(_0x0b1b('0xc'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b1b('0xd'));var _=require(_0x0b1b('0xe'));var squel=require(_0x0b1b('0xf'));var crypto=require(_0x0b1b('0x10'));var jsforce=require(_0x0b1b('0x11'));var deskjs=require(_0x0b1b('0x12'));var toCsv=require(_0x0b1b('0xc'));var querystring=require('querystring');var Papa=require(_0x0b1b('0x13'));var Redis=require(_0x0b1b('0x14'));var values;var authService=require(_0x0b1b('0x15'));var qs=require(_0x0b1b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b1b('0x17'));var logger=require(_0x0b1b('0x18'))(_0x0b1b('0x19'));var utils=require(_0x0b1b('0x1a'));var config=require(_0x0b1b('0x1b'));var licenseUtil=require(_0x0b1b('0x1c'));var db=require('../../mysqldb')['db'];config[_0x0b1b('0x1d')]=_[_0x0b1b('0x1e')](config[_0x0b1b('0x1d')],{'host':_0x0b1b('0x1f'),'port':0x18eb});var socket=require(_0x0b1b('0x20'))(new Redis(config[_0x0b1b('0x1d')]));require(_0x0b1b('0x21'))[_0x0b1b('0x22')](socket);var jayson=require(_0x0b1b('0x23'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a895a,_0x5609e4,_0x593253,_0xc6acc4){return new BPromise(function(_0x3b013c,_0x1c1ee5){var _0x21608e=_0xc6acc4||client;return _0x21608e[_0x0b1b('0x24')](_0x5a895a,_0x593253)['then'](function(_0x3c45b7){logger[_0x0b1b('0x25')]('User,\x20%s,\x20%s',_0x5609e4,_0x0b1b('0x26'));logger[_0x0b1b('0x27')](_0x0b1b('0x28'),_0x5609e4,_0x0b1b('0x26'),JSON[_0x0b1b('0x29')](_0x3c45b7));if(_0x3c45b7[_0x0b1b('0x2a')]){if(_0x3c45b7[_0x0b1b('0x2a')][_0x0b1b('0x2b')]===0x1f4){logger[_0x0b1b('0x2a')](_0x0b1b('0x2c'),_0x5609e4,_0x3c45b7[_0x0b1b('0x2a')][_0x0b1b('0x2d')]);return _0x1c1ee5(_0x3c45b7[_0x0b1b('0x2a')][_0x0b1b('0x2d')]);}logger[_0x0b1b('0x2a')](_0x0b1b('0x2c'),_0x5609e4,_0x3c45b7[_0x0b1b('0x2a')][_0x0b1b('0x2d')]);return _0x3b013c(_0x3c45b7[_0x0b1b('0x2a')][_0x0b1b('0x2d')]);}else{logger['info'](_0x0b1b('0x2c'),_0x5609e4,'request\x20sent');_0x3b013c(_0x3c45b7['result'][_0x0b1b('0x2d')]);}})[_0x0b1b('0x2e')](function(_0x3a62c4){logger[_0x0b1b('0x2a')]('User,\x20%s,\x20%s',_0x5609e4,_0x3a62c4);_0x1c1ee5(_0x3a62c4);});});}function respondWithStatusCode(_0x4256e6,_0xb9f492){_0xb9f492=_0xb9f492||0xcc;return function(_0x465503){if(_0x465503){return _0x4256e6['sendStatus'](_0xb9f492);}return _0x4256e6[_0x0b1b('0x2f')](_0xb9f492)[_0x0b1b('0x30')]();};}function respondWithResult(_0x173a7b,_0x549e1e){_0x549e1e=_0x549e1e||0xc8;return function(_0x4039b6){if(_0x4039b6){return _0x173a7b[_0x0b1b('0x2f')](_0x549e1e)['json'](_0x4039b6);}};}function respondWithFilteredResult(_0x155ac1,_0x4c95ea){return function(_0x34159c){if(_0x34159c){var _0x1fb9b8=_0x34159c[_0x0b1b('0x31')],_0x1f7e33=_0x4c95ea[_0x0b1b('0x32')],_0x476d0d=_0x4c95ea[_0x0b1b('0x32')]+_0x4c95ea['limit'],_0x2b7704;if(_0x476d0d>=_0x1fb9b8){_0x476d0d=_0x1fb9b8;_0x2b7704=0xc8;}else{_0x2b7704=0xce;}_0x155ac1[_0x0b1b('0x2f')](_0x2b7704);return _0x155ac1[_0x0b1b('0x33')]('Content-Range',_0x1f7e33+'-'+_0x476d0d+'/'+_0x1fb9b8)[_0x0b1b('0x34')](_0x34159c);}return null;};}function patchUpdates(_0x1628d5){return function(_0x226f59){try{jsonpatch[_0x0b1b('0x35')](_0x226f59,_0x1628d5,!![]);}catch(_0x1c694d){return BPromise[_0x0b1b('0x36')](_0x1c694d);}return _0x226f59[_0x0b1b('0x37')]();};}function saveUpdates(_0x45a4ba,_0xb4cc2b){return function(_0x33ca21){if(_0x33ca21){return _0x33ca21[_0x0b1b('0x38')](_0x45a4ba)[_0x0b1b('0x39')](function(_0x265e3e){return _0x265e3e;});}return null;};}function removeEntity(_0x3560a4,_0xee7bb0){return function(_0x303a1f){if(_0x303a1f){return _0x303a1f[_0x0b1b('0x3a')]()[_0x0b1b('0x39')](function(){var _0x270726=_0x303a1f[_0x0b1b('0x3b')]({'plain':!![]});if(_0x270726['role']===_0x0b1b('0x3c'))return;var _0x5b21bc=[{'name':_0x0b1b('0x3d'),'value':_0x0b1b('0x3e'),'ignore':!![]},{'name':'Agents','value':_0x0b1b('0x3f'),'ignore':![]},{'name':'Telephones','value':_0x0b1b('0x40'),'ignore':![]}];var _0x39b49e=_(_0x5b21bc)[_0x0b1b('0x41')]('ignore')[_0x0b1b('0x42')](_0x0b1b('0x43'))[_0x0b1b('0x43')]();if(_[_0x0b1b('0x44')](_0x39b49e,_0x270726['role'])){return;}var _0x40c103=_['find'](_0x5b21bc,[_0x0b1b('0x43'),_0x270726[_0x0b1b('0x45')]])[_0x0b1b('0x46')];return db[_0x0b1b('0x47')][_0x0b1b('0x3a')]({'where':{'type':_0x40c103,'resourceId':_0x270726['id']}})[_0x0b1b('0x39')](function(){return _0x303a1f;});})[_0x0b1b('0x39')](function(){_0x3560a4[_0x0b1b('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14bdaf,_0x4eb761){return function(_0x5f4076){if(!_0x5f4076){_0x14bdaf[_0x0b1b('0x48')](0x194);}return _0x5f4076;};}function handleError(_0x512d06,_0x51ee95){_0x51ee95=_0x51ee95||0x1f4;return function(_0x5b9356){logger[_0x0b1b('0x2a')](_0x5b9356[_0x0b1b('0x49')]);if(_0x5b9356[_0x0b1b('0x46')]){delete _0x5b9356[_0x0b1b('0x46')];}_0x512d06[_0x0b1b('0x2f')](_0x51ee95)[_0x0b1b('0x4a')](_0x5b9356);};}exports[_0x0b1b('0x4b')]=function(_0x2547eb,_0x1cb94f){var _0x50b227={},_0x1bf3b1={},_0x35ad1f={'count':0x0,'rows':[]};var _0xbd5fb=_['map'](db['User'][_0x0b1b('0x4c')],function(_0x4934a6){return{'name':_0x4934a6[_0x0b1b('0x4d')],'type':_0x4934a6[_0x0b1b('0x4e')]['key']};});_0x1bf3b1[_0x0b1b('0x4f')]=_['differenceBy'](_[_0x0b1b('0x42')](_0xbd5fb,_0x0b1b('0x46')),[_0x0b1b('0x50'),_0x0b1b('0x51')]);_0x1bf3b1[_0x0b1b('0x52')]=_[_0x0b1b('0x53')](_0x2547eb['query']);_0x1bf3b1[_0x0b1b('0x54')]=_['intersection'](_0x1bf3b1[_0x0b1b('0x4f')],_0x1bf3b1[_0x0b1b('0x52')]);_0x50b227[_0x0b1b('0x55')]=_['intersection'](_0x1bf3b1[_0x0b1b('0x4f')],qs[_0x0b1b('0x56')](_0x2547eb[_0x0b1b('0x52')][_0x0b1b('0x56')]));_0x50b227[_0x0b1b('0x55')]=_0x50b227[_0x0b1b('0x55')][_0x0b1b('0x57')]?_0x50b227[_0x0b1b('0x55')]:_0x1bf3b1['model'];if(!_0x2547eb[_0x0b1b('0x52')][_0x0b1b('0x58')]('nolimit')){_0x50b227[_0x0b1b('0x59')]=qs['limit'](_0x2547eb[_0x0b1b('0x52')][_0x0b1b('0x59')]);_0x50b227[_0x0b1b('0x32')]=qs[_0x0b1b('0x32')](_0x2547eb['query'][_0x0b1b('0x32')]);}_0x50b227['order']=qs[_0x0b1b('0x5a')](_0x2547eb[_0x0b1b('0x52')][_0x0b1b('0x5a')]);_0x50b227[_0x0b1b('0x5b')]=qs['filters'](_[_0x0b1b('0x5c')](_0x2547eb[_0x0b1b('0x52')],_0x1bf3b1[_0x0b1b('0x54')]),_0xbd5fb);if(_0x2547eb[_0x0b1b('0x52')]['filter']){_0x50b227[_0x0b1b('0x5b')]=_[_0x0b1b('0x5d')](_0x50b227[_0x0b1b('0x5b')],{'$or':_[_0x0b1b('0x42')](_0xbd5fb,function(_0x445069){if(_0x445069[_0x0b1b('0x4e')]!==_0x0b1b('0x5e')){return db['sequelize'][_0x0b1b('0x5b')](db[_0x0b1b('0x5f')]['fn'](_0x0b1b('0x60'),db['sequelize'][_0x0b1b('0x61')](_0x445069[_0x0b1b('0x46')])),{'$like':db[_0x0b1b('0x5f')]['fn']('lower','%'+_0x2547eb[_0x0b1b('0x52')][_0x0b1b('0x41')]+'%')});}})});}_0x50b227=_['merge']({},_0x50b227,_0x2547eb[_0x0b1b('0x62')]);var _0x2fd765={'where':_0x50b227['where']};return db[_0x0b1b('0x63')][_0x0b1b('0x31')](_0x2fd765)[_0x0b1b('0x39')](function(_0xc6020a){_0x35ad1f[_0x0b1b('0x31')]=_0xc6020a;if(_0x2547eb[_0x0b1b('0x52')][_0x0b1b('0x64')]){_0x50b227[_0x0b1b('0x65')]=[{'all':!![]}];}return db[_0x0b1b('0x63')][_0x0b1b('0x66')](_0x50b227);})['then'](function(_0x4bb345){_0x35ad1f[_0x0b1b('0x67')]=_0x4bb345;var _0x4cba0a=[];for(var _0x4c33d4=0x0;_0x4c33d4<_0x35ad1f[_0x0b1b('0x67')][_0x0b1b('0x57')];_0x4c33d4++){_0x4cba0a['push'](get_open_tabs(_0x0b1b('0x68'),_0x35ad1f[_0x0b1b('0x67')][_0x4c33d4]['dataValues']));_0x4cba0a[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x6a'),_0x35ad1f[_0x0b1b('0x67')][_0x4c33d4]['dataValues']));_0x4cba0a['push'](get_open_tabs(_0x0b1b('0x6b'),_0x35ad1f[_0x0b1b('0x67')][_0x4c33d4][_0x0b1b('0x6c')]));_0x4cba0a[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x6d'),_0x35ad1f[_0x0b1b('0x67')][_0x4c33d4]['dataValues']));_0x4cba0a['push'](get_open_tabs(_0x0b1b('0x6e'),_0x35ad1f['rows'][_0x4c33d4][_0x0b1b('0x6c')]));_0x4cba0a[_0x0b1b('0x69')](get_open_tabs('whatsapp',_0x35ad1f[_0x0b1b('0x67')][_0x4c33d4][_0x0b1b('0x6c')]));}return BPromise[_0x0b1b('0x6f')](_0x4cba0a)['then'](function(_0x5325f6){return _0x35ad1f;});})[_0x0b1b('0x39')](respondWithFilteredResult(_0x1cb94f,_0x50b227))[_0x0b1b('0x2e')](handleError(_0x1cb94f,null));};exports['show']=function(_0x2e11d0,_0x47b7a0){var _0x3a4716={'raw':![],'where':{'id':_0x2e11d0[_0x0b1b('0x70')]['id']}},_0x48d8cf={};_0x48d8cf[_0x0b1b('0x4f')]=_[_0x0b1b('0x71')](_['keys'](db['User']['rawAttributes']),[_0x0b1b('0x50'),_0x0b1b('0x51')]);_0x48d8cf[_0x0b1b('0x52')]=_[_0x0b1b('0x53')](_0x2e11d0[_0x0b1b('0x52')]);_0x48d8cf[_0x0b1b('0x54')]=_[_0x0b1b('0x72')](_0x48d8cf[_0x0b1b('0x4f')],_0x48d8cf['query']);_0x3a4716[_0x0b1b('0x55')]=_['intersection'](_0x48d8cf['model'],qs[_0x0b1b('0x56')](_0x2e11d0[_0x0b1b('0x52')][_0x0b1b('0x56')]));_0x3a4716[_0x0b1b('0x55')]=_0x3a4716[_0x0b1b('0x55')][_0x0b1b('0x57')]?_0x3a4716[_0x0b1b('0x55')]:_0x48d8cf['model'];if(_0x2e11d0['query'][_0x0b1b('0x64')]){_0x3a4716[_0x0b1b('0x65')]=[{'all':!![]}];}_0x3a4716=_['merge']({},_0x3a4716,_0x2e11d0[_0x0b1b('0x62')]);return db['User'][_0x0b1b('0x73')](_0x3a4716)['then'](handleEntityNotFound(_0x47b7a0,null))[_0x0b1b('0x39')](function(_0xa91ccf){var _0x3e6788=[];values=_0xa91ccf;_0x3e6788['push'](get_open_tabs(_0x0b1b('0x68'),_0xa91ccf['dataValues']));_0x3e6788['push'](get_open_tabs(_0x0b1b('0x6a'),_0xa91ccf[_0x0b1b('0x6c')]));_0x3e6788[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x6e'),_0xa91ccf[_0x0b1b('0x6c')]));_0x3e6788[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x74'),_0xa91ccf[_0x0b1b('0x6c')]));_0x3e6788[_0x0b1b('0x69')](get_open_tabs('fax',_0xa91ccf['dataValues']));_0x3e6788[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x6d'),_0xa91ccf[_0x0b1b('0x6c')]));return BPromise['all'](_0x3e6788);})['then'](function(_0x1b0703){return values;})[_0x0b1b('0x39')](respondWithResult(_0x47b7a0,null))[_0x0b1b('0x2e')](handleError(_0x47b7a0,null));};exports[_0x0b1b('0x38')]=function(_0xfa1b1e,_0x15cb41){if(_0xfa1b1e[_0x0b1b('0x75')]['id']){delete _0xfa1b1e[_0x0b1b('0x75')]['id'];}delete _0xfa1b1e[_0x0b1b('0x75')][_0x0b1b('0x45')];return db[_0x0b1b('0x63')][_0x0b1b('0x73')]({'where':{'id':_0xfa1b1e['params']['id']}})['then'](handleEntityNotFound(_0x15cb41,null))[_0x0b1b('0x39')](saveUpdates(_0xfa1b1e['body'],null))['then'](respondWithResult(_0x15cb41,null))[_0x0b1b('0x2e')](handleError(_0x15cb41,null));};exports['describe']=function(_0x1325c2,_0x57cf62){return db[_0x0b1b('0x63')][_0x0b1b('0x76')]()[_0x0b1b('0x39')](respondWithResult(_0x57cf62,null))[_0x0b1b('0x2e')](handleError(_0x57cf62,null));};exports[_0x0b1b('0x77')]=function(_0x4ef837,_0x4a465f,_0x3c626e){return db['User'][_0x0b1b('0x73')]({'where':{'id':_0x4ef837[_0x0b1b('0x70')]['id']}})[_0x0b1b('0x39')](handleEntityNotFound(_0x4a465f,null))['then'](function(_0x1ccaba){if(_0x1ccaba){return _0x1ccaba[_0x0b1b('0x77')](_0x4ef837[_0x0b1b('0x75')][_0x0b1b('0x78')],_['omit'](_0x4ef837[_0x0b1b('0x75')],[_0x0b1b('0x78'),'id'])||{});}})[_0x0b1b('0x39')](respondWithResult(_0x4a465f,null))['catch'](handleError(_0x4a465f,null));};function validateUser(_0x5eaf44){return new BPromise(function(_0x24a52c,_0x505180){if(_0x5eaf44['internal'])return _0x24a52c(_0x5eaf44);return db[_0x0b1b('0x79')][_0x0b1b('0x7a')](0x1)[_0x0b1b('0x39')](function(_0x5015a2){if(_0x5015a2[_0x0b1b('0x7b')])authService[_0x0b1b('0x7c')](_0x5eaf44[_0x0b1b('0x50')]);db['User'][_0x0b1b('0x7d')](_0x0b1b('0x7e'))[_0x0b1b('0x39')](function(_0x147f6b){if(_['isNil'](_0x147f6b)){_0x5eaf44['internal']=_0x5015a2[_0x0b1b('0x7f')]||0x1;return;}if(_[_0x0b1b('0x80')](_0x5015a2[_0x0b1b('0x7f')])||_0x5015a2[_0x0b1b('0x7f')]===_0x147f6b){_0x5eaf44[_0x0b1b('0x7e')]=_0x147f6b+0x1;return;}if(_0x5015a2['min_internal']>_0x147f6b){_0x5eaf44[_0x0b1b('0x7e')]=_0x5015a2[_0x0b1b('0x7f')];return;}return db['sequelize'][_0x0b1b('0x52')](_0x0b1b('0x81'),{'type':db[_0x0b1b('0x5f')][_0x0b1b('0x82')][_0x0b1b('0x83')]})['then'](function(_0x362a1c){if(_0x362a1c&&_0x362a1c[_0x0b1b('0x57')]){for(var _0x1acc80=0x0,_0x4b7a9b=_0x362a1c[_0x0b1b('0x57')];_0x1acc80<_0x4b7a9b&&_[_0x0b1b('0x80')](_0x5eaf44[_0x0b1b('0x7e')]);_0x1acc80++){if(_0x5015a2['min_internal']<=_0x362a1c[_0x1acc80][_0x0b1b('0x84')]){_0x5eaf44[_0x0b1b('0x7e')]=_0x362a1c[_0x1acc80][_0x0b1b('0x84')];}else if(_0x5015a2['min_internal']>_0x362a1c[_0x1acc80][_0x0b1b('0x84')]&&_0x5015a2[_0x0b1b('0x7f')]<=_0x362a1c[_0x1acc80]['to']){_0x5eaf44[_0x0b1b('0x7e')]=_0x5015a2[_0x0b1b('0x7f')];}}}if(_[_0x0b1b('0x80')](_0x5eaf44[_0x0b1b('0x7e')])){_0x5eaf44[_0x0b1b('0x7e')]=_0x147f6b+0x1;}return _0x24a52c(_0x5eaf44);});});})['catch'](function(_0x364230){_0x505180(_0x364230);});});}function updateUser(_0x5308ed){return new BPromise(function(_0x47f26c,_0x22b52d){try{if(_0x5308ed['voicemail']){_0x5308ed['mailbox']=_0x5308ed[_0x0b1b('0x7e')];_0x5308ed[_0x0b1b('0x85')]={'mailbox':_0x5308ed[_0x0b1b('0x7e')],'password':_0x5308ed[_0x0b1b('0x50')],'fullname':_0x5308ed[_0x0b1b('0x86')],'email':_0x5308ed['email']};}if(_0x5308ed[_0x0b1b('0x45')]==='agent'){if(!_0x5308ed[_0x0b1b('0x87')])_0x5308ed[_0x0b1b('0x87')]=[_0x0b1b('0x88'),'102',_0x0b1b('0x89'),_0x0b1b('0x8a'),_0x0b1b('0x8b'),_0x0b1b('0x8c'),'105',_0x0b1b('0x8d'),_0x0b1b('0x8e'),_0x0b1b('0x8f'),_0x0b1b('0x90'),'100','111',_0x0b1b('0x91'),'115'];}_0x47f26c(_0x5308ed);}catch(_0x2f101b){_0x22b52d(_0x2f101b);}});}exports[_0x0b1b('0x92')]=function(_0x76407c,_0x578623){if(_0x76407c[_0x0b1b('0x3e')][_0x0b1b('0x45')]===_0x0b1b('0x3f'))throw new Error(_0x0b1b('0x93'));if(_0x76407c['body'][_0x0b1b('0x45')]===_0x0b1b('0x3e')&&_0x76407c[_0x0b1b('0x3e')][_0x0b1b('0x45')]!=='admin'){throw new Error(_0x0b1b('0x94'));}if(_0x76407c[_0x0b1b('0x75')][_0x0b1b('0x45')]===_0x0b1b('0x3c')&&_0x76407c[_0x0b1b('0x3e')]['role']!==_0x0b1b('0x3c')){throw new Error(_0x0b1b('0x95'));}return licenseUtil['checkUserLimits']([_0x76407c[_0x0b1b('0x75')]])[_0x0b1b('0x39')](function(){return validateUser(_0x76407c[_0x0b1b('0x75')]);})[_0x0b1b('0x39')](function(_0x47d9f4){return updateUser(_0x47d9f4)['then'](function(_0x5ae2eb){if(_0x5ae2eb['role']===_0x0b1b('0x3c')){_0x5ae2eb[_0x0b1b('0x96')]=_0x76407c['user']['settingsEnabled'];delete _0x5ae2eb['userProfileId'];}return _0x5ae2eb;});})['then'](function(_0x5ed94f){return db[_0x0b1b('0x63')][_0x0b1b('0x92')](_0x5ed94f,{'include':[{'model':db[_0x0b1b('0x85')],'as':_0x0b1b('0x85')}]});})[_0x0b1b('0x39')](function(_0x132db9){if(_0x76407c[_0x0b1b('0x75')][_0x0b1b('0x45')]===_0x0b1b('0x3e'))return _0x132db9;if(_0x76407c['user'][_0x0b1b('0x45')]!==_0x0b1b('0x3e'))return _0x132db9;return db[_0x0b1b('0x97')][_0x0b1b('0x73')]({'where':{'name':_0x132db9[_0x0b1b('0x45')]==='agent'?_0x0b1b('0x98'):_0x0b1b('0x99'),'userProfileId':_0x76407c[_0x0b1b('0x3e')][_0x0b1b('0x9a')]},'raw':!![]})[_0x0b1b('0x39')](function(_0xeca6d2){if(!_0xeca6d2||_0xeca6d2[_0x0b1b('0x9b')]!=0x0)return _0x132db9;return db[_0x0b1b('0x47')][_0x0b1b('0x92')]({'name':_0x132db9[_0x0b1b('0x46')],'resourceId':_0x132db9['id'],'type':_0xeca6d2[_0x0b1b('0x46')],'sectionId':_0xeca6d2['id']},{})[_0x0b1b('0x39')](function(){return _0x132db9;});})[_0x0b1b('0x2e')](function(_0x131bb8){logger[_0x0b1b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x131bb8);throw _0x131bb8;});})[_0x0b1b('0x39')](respondWithResult(_0x578623,0xc9))['catch'](handleError(_0x578623,null));};exports[_0x0b1b('0x9c')]=function(_0x46df7d,_0x5aa2a0){var _0x497331=_0x46df7d[_0x0b1b('0x75')];var _0x59ca9f=[];if(_0x46df7d[_0x0b1b('0x3e')][_0x0b1b('0x45')]===_0x0b1b('0x3f'))throw new Error(_0x0b1b('0x93'));if(_['some'](_0x497331,[_0x0b1b('0x45'),_0x0b1b('0x3e')])&&_0x46df7d['user']['role']!=='admin'){throw new Error(_0x0b1b('0x94'));}if(_['some'](_0x497331,[_0x0b1b('0x45'),_0x0b1b('0x3c')])&&_0x46df7d[_0x0b1b('0x3e')][_0x0b1b('0x45')]!==_0x0b1b('0x3c')){throw new Error(_0x0b1b('0x9d'));}return licenseUtil[_0x0b1b('0x9e')](_0x497331)['then'](function(){return validateUser(_0x497331[0x0]);})['then'](function(){for(var _0x429a14=0x1;_0x429a14<_0x497331[_0x0b1b('0x57')];_0x429a14++){var _0x4da98c=_0x497331[_0x429a14-0x1][_0x0b1b('0x7e')];if(!_0x497331[_0x429a14][_0x0b1b('0x7e')])_0x497331[_0x429a14][_0x0b1b('0x7e')]=_0x4da98c+0x1;_0x59ca9f[_0x0b1b('0x69')](validateUser(_0x497331[_0x429a14]));}return BPromise[_0x0b1b('0x6f')](_0x59ca9f);})['then'](function(){_0x59ca9f=[];for(var _0xc57103=0x0;_0xc57103<_0x497331[_0x0b1b('0x57')];_0xc57103++){_0x59ca9f[_0x0b1b('0x69')](updateUser(_0x497331[_0xc57103]));}return BPromise[_0x0b1b('0x6f')](_0x59ca9f);})[_0x0b1b('0x39')](function(){return BPromise[_0x0b1b('0x9f')](_0x497331,function(_0x39cd2c){return db[_0x0b1b('0x63')][_0x0b1b('0x92')](_0x39cd2c,{'include':[{'model':db[_0x0b1b('0x85')],'as':_0x0b1b('0x85')}]})[_0x0b1b('0x39')](function(_0x231bb1){_0x39cd2c['id']=_0x231bb1['id'];return _0x39cd2c;});});})[_0x0b1b('0x39')](function(_0x24c5c8){if(_0x46df7d[_0x0b1b('0x75')][_0x0b1b('0x45')]===_0x0b1b('0x3e'))return _0x24c5c8;if(_0x46df7d[_0x0b1b('0x3e')][_0x0b1b('0x45')]!=='user')return _0x24c5c8;var _0x4d20db=_[_0x0b1b('0xa0')](_0x24c5c8,function(_0x1b1cce){return _0x1b1cce['role']==='agent'||_0x1b1cce[_0x0b1b('0x45')]===_0x0b1b('0x40');});if(!_0x4d20db)return _0x24c5c8;return db[_0x0b1b('0x97')][_0x0b1b('0x66')]({'where':{'name':{'$or':[_0x0b1b('0x98'),_0x0b1b('0x99')]},'userProfileId':_0x46df7d[_0x0b1b('0x3e')][_0x0b1b('0x9a')]},'raw':!![]})[_0x0b1b('0x39')](function(_0x2c85a9){if(_['isEmpty'](_0x2c85a9)||!_[_0x0b1b('0xa0')](_0x2c85a9,['autoAssociation',0x0]))return _0x24c5c8;_0x59ca9f=[];var _0x586b42=_(_0x2c85a9)[_0x0b1b('0x42')](function(_0x38f442){if(_0x38f442['autoAssociation']===0x1)return;return _0x38f442[_0x0b1b('0x46')]===_0x0b1b('0x98')?_0x0b1b('0x3f'):_0x0b1b('0x40');})['compact']()[_0x0b1b('0x43')]();for(var _0x3d7c84=0x0;_0x3d7c84<_0x24c5c8['length'];_0x3d7c84++){if(!_[_0x0b1b('0x44')](_0x586b42,_0x24c5c8[_0x3d7c84][_0x0b1b('0x45')]))return;var _0x48cda8=_0x24c5c8[_0x3d7c84][_0x0b1b('0x45')]===_0x0b1b('0x3f')?'Agents':_0x0b1b('0x99');_0x59ca9f[_0x0b1b('0x69')](db[_0x0b1b('0x47')]['create']({'name':_0x24c5c8[_0x3d7c84][_0x0b1b('0x46')],'resourceId':_0x24c5c8[_0x3d7c84]['id'],'type':_0x48cda8,'sectionId':_['find'](_0x2c85a9,['name',_0x48cda8])['id']},{}));}return BPromise[_0x0b1b('0x6f')](_0x59ca9f);});})[_0x0b1b('0x39')](respondWithResult(_0x5aa2a0,0xc9))['catch'](handleError(_0x5aa2a0,null));};exports[_0x0b1b('0xa1')]=function(_0x598545,_0x28f27a,_0x1d6a44){if(_0x598545['body']['id']){delete _0x598545[_0x0b1b('0x75')]['id'];}return db[_0x0b1b('0x63')][_0x0b1b('0x73')]({'where':{'id':_0x598545[_0x0b1b('0x70')]['id']}})[_0x0b1b('0x39')](function(_0x28d578){if(!_0x28d578)return null;if(_0x28d578['id']===_0x598545[_0x0b1b('0x3e')]['id']){if(!_0x598545[_0x0b1b('0x75')][_0x0b1b('0xa2')]||!_0x598545[_0x0b1b('0x75')][_0x0b1b('0xa3')]){throw new db[(_0x0b1b('0xa4'))][(_0x0b1b('0xa5'))](_0x0b1b('0xa6'));}if(!_0x28d578['authenticate'](_0x598545[_0x0b1b('0x75')][_0x0b1b('0xa2')])){throw new db[(_0x0b1b('0xa4'))][(_0x0b1b('0xa5'))](_0x0b1b('0xa7'));}if(_0x598545[_0x0b1b('0x75')]['oldPassword']===_0x598545[_0x0b1b('0x75')][_0x0b1b('0xa3')]){throw new db['Sequelize'][(_0x0b1b('0xa5'))](_0x0b1b('0xa8'));}}else if(_0x598545[_0x0b1b('0x3e')][_0x0b1b('0x45')]===_0x0b1b('0x3c')){if(!_0x598545[_0x0b1b('0x75')][_0x0b1b('0xa3')]){throw new db[(_0x0b1b('0xa4'))][(_0x0b1b('0xa5'))](_0x0b1b('0xa9'));}}else if(_0x598545[_0x0b1b('0x3e')][_0x0b1b('0x45')]===_0x0b1b('0x3e')){if(!_0x598545['body']['newPassword']){throw new db['Sequelize'][(_0x0b1b('0xa5'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x28d578[_0x0b1b('0x45')]!=='agent'){throw new db[(_0x0b1b('0xa4'))][(_0x0b1b('0xa5'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x0b1b('0xa5'))]('Unauthorized');}return _0x28d578;})['then'](handleEntityNotFound(_0x28f27a,null))[_0x0b1b('0x39')](function(_0x1d9ccf){return db[_0x0b1b('0x79')][_0x0b1b('0xaa')]({'attributes':['id',_0x0b1b('0x7b'),_0x0b1b('0xab'),_0x0b1b('0xac')]})['then'](function(_0x36d3a6){if(_0x36d3a6[_0x0b1b('0x7b')])authService[_0x0b1b('0x7c')](_0x598545['body'][_0x0b1b('0xa3')]);if(!_0x36d3a6[_0x0b1b('0xab')]||!_0x1d9ccf['previousPasswords'])return _0x1d9ccf;authService['validatePasswordHistory'](_0x598545[_0x0b1b('0x75')][_0x0b1b('0xa3')],_0x1d9ccf['previousPasswords'],_0x36d3a6[_0x0b1b('0xac')]);return _0x1d9ccf;})[_0x0b1b('0x39')](saveUpdates({'password':_0x598545[_0x0b1b('0x75')][_0x0b1b('0xa3')],'passwordResetAt':_0x598545['user']['id']==_0x598545['params']['id']?moment():null,'previousPasswords':authService[_0x0b1b('0xad')](_0x598545['body'][_0x0b1b('0xa3')],_0x1d9ccf[_0x0b1b('0xae')])},null));})['then'](respondWithResult(_0x28f27a,null))[_0x0b1b('0x2e')](handleError(_0x28f27a,null));};exports[_0x0b1b('0xaf')]=function(_0x28d39d,_0x178ecf,_0x19d754){var _0x735b4a=_0x28d39d['body'][_0x0b1b('0xb0')];return db[_0x0b1b('0x63')]['find']({'where':{'id':_0x28d39d[_0x0b1b('0x70')]['id']},'attributes':['id',_0x0b1b('0x46'),_0x0b1b('0x45'),_0x0b1b('0xb1'),_0x0b1b('0xb2'),'voicePause',_0x0b1b('0xb3')]})[_0x0b1b('0x39')](handleEntityNotFound(_0x178ecf,null))['then'](function(_0x571b4d){if(_0x571b4d){if(!utils[_0x0b1b('0xb4')](_0x735b4a)){throw new db['Sequelize'][(_0x0b1b('0xa5'))](_0x0b1b('0xb5'));}return _0x571b4d[_0x0b1b('0xb6')+_[_0x0b1b('0xb7')](_0x735b4a[_0x0b1b('0xb8')]())+_0x0b1b('0xb9')](_0x28d39d[_0x0b1b('0x75')]['ids'],{'penalty':_0x28d39d[_0x0b1b('0x75')]['penalty']||0x0})[_0x0b1b('0xba')](function(_0x4f71c5){for(var _0x464625=0x0;_0x464625<_0x28d39d['body'][_0x0b1b('0x78')][_0x0b1b('0x57')];_0x464625+=0x1){var _0x5d77c5={'UserId':_0x28d39d['params']['id']};_0x5d77c5[_[_0x0b1b('0xb7')](_0x735b4a[_0x0b1b('0xb8')]())+'QueueId']=_0x28d39d[_0x0b1b('0x75')][_0x0b1b('0x78')][_0x464625];socket['emit'](_0x0b1b('0x3e')+_[_0x0b1b('0xb7')](_0x735b4a[_0x0b1b('0xb8')]())+_0x0b1b('0xbb'),_0x5d77c5);}return _0x4f71c5;})['then'](function(){if(_0x735b4a===_0x0b1b('0xbc')){return db[_0x0b1b('0xbd')][_0x0b1b('0x66')]({'where':{'id':_0x28d39d[_0x0b1b('0x75')][_0x0b1b('0x78')]||[]},'raw':!![],'attributes':['id',_0x0b1b('0x46')]});}})[_0x0b1b('0x39')](function(_0x597be9){var _0x2ad17b=_0x571b4d['get']({'plain':!![]});var _0xe8431a=[];if(_0x735b4a===_0x0b1b('0xbc')&&_0x2ad17b[_0x0b1b('0x45')]==='agent'&&_0x2ad17b[_0x0b1b('0xb1')]){for(var _0x9ae17b=0x0;_0x9ae17b<_0x597be9[_0x0b1b('0x57')];_0x9ae17b+=0x1){_0xe8431a['push']({'membername':_0x2ad17b[_0x0b1b('0x46')],'UserId':_0x2ad17b['id'],'queue_name':_0x597be9[_0x9ae17b][_0x0b1b('0x46')],'VoiceQueueId':_0x597be9[_0x9ae17b]['id'],'interface':_['isNil'](_0x2ad17b[_0x0b1b('0xb3')])?util[_0x0b1b('0xbe')](_0x0b1b('0xbf'),_0x2ad17b[_0x0b1b('0x46')]):_0x2ad17b[_0x0b1b('0xb3')],'paused':_0x2ad17b[_0x0b1b('0xc0')]||![],'penalty':_0x28d39d['body']['penalty']||0x0});}return BPromise[_0x0b1b('0x9f')](_0xe8431a,function(_0x36de94){return db[_0x0b1b('0xc1')][_0x0b1b('0xc2')](_0x36de94);});}return _0x571b4d;});}})[_0x0b1b('0x39')](respondWithStatusCode(_0x178ecf,null))[_0x0b1b('0x2e')](handleError(_0x178ecf,null));};exports['removeQueues']=function(_0x1e397c,_0x368b91,_0x24b2f9){var _0x11943d;return db[_0x0b1b('0x63')][_0x0b1b('0x73')]({'where':{'id':_0x1e397c[_0x0b1b('0x70')]['id']},'attributes':['id',_0x0b1b('0x46'),'role']})[_0x0b1b('0x39')](handleEntityNotFound(_0x368b91,null))[_0x0b1b('0x39')](function(_0x60be6b){if(_0x60be6b){_0x11943d=_0x60be6b;if(!_0x1e397c['query'][_0x0b1b('0xb0')]||!utils['isValidChannel'](_0x1e397c[_0x0b1b('0x52')][_0x0b1b('0xb0')])){throw new db[(_0x0b1b('0xa4'))][(_0x0b1b('0xa5'))](_0x0b1b('0xb5'));}return _0x60be6b[_0x0b1b('0xc3')+_['capitalize'](_0x1e397c[_0x0b1b('0x52')][_0x0b1b('0xb0')][_0x0b1b('0xb8')]())+_0x0b1b('0xb9')](_0x1e397c[_0x0b1b('0x52')][_0x0b1b('0x78')]);}})['then'](function(_0x1dd16c){for(var _0xfa23da=0x0;_0xfa23da<_0x1e397c[_0x0b1b('0x52')][_0x0b1b('0x78')][_0x0b1b('0x57')];_0xfa23da+=0x1){var _0x2f4a78={'UserId':_0x1e397c['params']['id']};_0x2f4a78[_[_0x0b1b('0xb7')](_0x1e397c[_0x0b1b('0x52')][_0x0b1b('0xb0')][_0x0b1b('0xb8')]())+'QueueId']=_0x1e397c[_0x0b1b('0x52')][_0x0b1b('0x78')][_0xfa23da];socket['emit'](_0x0b1b('0x3e')+_[_0x0b1b('0xb7')](_0x1e397c[_0x0b1b('0x52')]['channel']['toLowerCase']())+_0x0b1b('0xc4'),_0x2f4a78);}return _0x1dd16c;})[_0x0b1b('0x39')](function(){if(_0x1e397c[_0x0b1b('0x52')][_0x0b1b('0xb0')]===_0x0b1b('0xbc')){return db[_0x0b1b('0xc1')][_0x0b1b('0x3a')]({'where':{'UserId':_0x1e397c['params']['id'],'VoiceQueueId':_0x1e397c[_0x0b1b('0x52')][_0x0b1b('0x78')]},'individualHooks':!![]})[_0x0b1b('0x39')](function(){return _0x11943d;});}return _0x11943d;})['then'](respondWithStatusCode(_0x368b91,null))[_0x0b1b('0x2e')](handleError(_0x368b91,null));};exports[_0x0b1b('0xc5')]=function(_0x2ee9ec,_0x77c897,_0x53c5a9){_0x2ee9ec[_0x0b1b('0x75')][_0x0b1b('0xc6')]=_0x2ee9ec['file'][_0x0b1b('0xc7')];return db[_0x0b1b('0x63')][_0x0b1b('0x73')]({'where':{'id':_0x2ee9ec[_0x0b1b('0x70')]['id']}})[_0x0b1b('0x39')](handleEntityNotFound(_0x77c897,null))['then'](saveUpdates(_0x2ee9ec[_0x0b1b('0x75')],null))[_0x0b1b('0x39')](respondWithResult(_0x77c897,null))[_0x0b1b('0x2e')](handleError(_0x77c897,null));};exports[_0x0b1b('0xc8')]=function(_0x14ae33,_0xa5e2f,_0x4ec81f){var _0x5d61a9=path[_0x0b1b('0xc9')](config[_0x0b1b('0xca')],_0x0b1b('0xcb'));return db[_0x0b1b('0x63')][_0x0b1b('0x73')]({'where':{'id':_0x14ae33['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x0b1b('0x39')](handleEntityNotFound(_0xa5e2f,null))[_0x0b1b('0x39')](function(_0x47eb91){if(_0x47eb91){if(_[_0x0b1b('0x80')](_0x47eb91[_0x0b1b('0xc6')])){return _0xa5e2f['download'](_0x5d61a9);}else{if(!fs[_0x0b1b('0xcc')](path[_0x0b1b('0xc9')](config['root'],_0x0b1b('0xcd'),_0x47eb91[_0x0b1b('0xc6')]))){return _0xa5e2f['download'](_0x5d61a9);}return _0xa5e2f['download'](path[_0x0b1b('0xc9')](config['root'],_0x0b1b('0xcd'),_0x47eb91[_0x0b1b('0xc6')]));}}})[_0x0b1b('0x2e')](handleError(_0xa5e2f,null));};exports[_0x0b1b('0xce')]=function(_0x8a5437,_0x36ae2f,_0xcc93d2){return db[_0x0b1b('0x63')][_0x0b1b('0x73')]({'where':{'id':_0x8a5437['params']['id']},'attributes':['id']})[_0x0b1b('0x39')](handleEntityNotFound(_0x36ae2f,null))[_0x0b1b('0x39')](function(_0x213176){var _0x6a982b=[];values=_0x213176[_0x0b1b('0x6c')];_0x6a982b[_0x0b1b('0x69')](get_open_tabs('chat',_0x213176['dataValues']));_0x6a982b['push'](get_open_tabs(_0x0b1b('0x6a'),_0x213176[_0x0b1b('0x6c')]));_0x6a982b[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x6e'),_0x213176[_0x0b1b('0x6c')]));_0x6a982b[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x74'),_0x213176[_0x0b1b('0x6c')]));_0x6a982b[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x6b'),_0x213176[_0x0b1b('0x6c')]));_0x6a982b[_0x0b1b('0x69')](get_open_tabs(_0x0b1b('0x6d'),_0x213176[_0x0b1b('0x6c')]));return BPromise[_0x0b1b('0x6f')](_0x6a982b);})[_0x0b1b('0x39')](function(_0x3621ea){var _0x195fa3=[];if(_0x3621ea){for(var _0x54e988=0x0;_0x54e988=_0x21c723){_0x3e638c=_0x21c723;_0x1aada1=0xc8;}else{_0x1aada1=0xce;}_0x27ace6[_0x5f66('0x29')](_0x1aada1);return _0x27ace6[_0x5f66('0x2c')](_0x5f66('0x2d'),_0x442e3f+'-'+_0x3e638c+'/'+_0x21c723)[_0x5f66('0x2e')](_0x2ee622);}return null;};}function patchUpdates(_0x582af0){return function(_0x48d2f8){try{jsonpatch[_0x5f66('0x2f')](_0x48d2f8,_0x582af0,!![]);}catch(_0x59543f){return BPromise['reject'](_0x59543f);}return _0x48d2f8[_0x5f66('0x30')]();};}function saveUpdates(_0x574c10,_0x270a9b){return function(_0xe9df37){if(_0xe9df37){return _0xe9df37[_0x5f66('0x31')](_0x574c10)[_0x5f66('0x32')](function(_0x6726fa){return _0x6726fa;});}return null;};}function removeEntity(_0x1837b7,_0x455577){return function(_0x389dbe){if(_0x389dbe){return _0x389dbe['destroy']()[_0x5f66('0x32')](function(){var _0x124084=_0x389dbe[_0x5f66('0x33')]({'plain':!![]});if(_0x124084[_0x5f66('0x34')]==='admin')return;var _0x2212cb=[{'name':_0x5f66('0x35'),'value':'user','ignore':!![]},{'name':_0x5f66('0x36'),'value':_0x5f66('0x37'),'ignore':![]},{'name':_0x5f66('0x38'),'value':'telephone','ignore':![]}];var _0x44ea06=_(_0x2212cb)[_0x5f66('0x39')](_0x5f66('0x3a'))['map']('value')[_0x5f66('0x3b')]();if(_[_0x5f66('0x3c')](_0x44ea06,_0x124084[_0x5f66('0x34')])){return;}var _0x2550e6=_[_0x5f66('0x3d')](_0x2212cb,[_0x5f66('0x3b'),_0x124084['role']])['name'];return db[_0x5f66('0x3e')][_0x5f66('0x3f')]({'where':{'type':_0x2550e6,'resourceId':_0x124084['id']}})[_0x5f66('0x32')](function(){return _0x389dbe;});})['then'](function(){_0x1837b7[_0x5f66('0x29')](0xcc)[_0x5f66('0x40')]();});}};}function handleEntityNotFound(_0xe1bcab,_0x2ecaaf){return function(_0x102357){if(!_0x102357){_0xe1bcab[_0x5f66('0x28')](0x194);}return _0x102357;};}function handleError(_0x2c05ea,_0x5d13ab){_0x5d13ab=_0x5d13ab||0x1f4;return function(_0x76589b){logger[_0x5f66('0x22')](_0x76589b['stack']);if(_0x76589b[_0x5f66('0x41')]){delete _0x76589b[_0x5f66('0x41')];}_0x2c05ea[_0x5f66('0x29')](_0x5d13ab)['send'](_0x76589b);};}exports['index']=function(_0x3d4b0f,_0x3c4726){var _0x7f932b={},_0x3ff5b3={},_0x3d64a7={'count':0x0,'rows':[]};var _0x5d1588=_[_0x5f66('0x42')](db['User']['rawAttributes'],function(_0x5e11c5){return{'name':_0x5e11c5['fieldName'],'type':_0x5e11c5[_0x5f66('0x43')][_0x5f66('0x44')]};});_0x3ff5b3[_0x5f66('0x45')]=_[_0x5f66('0x46')](_[_0x5f66('0x42')](_0x5d1588,_0x5f66('0x41')),['password',_0x5f66('0x47')]);_0x3ff5b3[_0x5f66('0x48')]=_[_0x5f66('0x49')](_0x3d4b0f[_0x5f66('0x48')]);_0x3ff5b3['filters']=_[_0x5f66('0x4a')](_0x3ff5b3['model'],_0x3ff5b3[_0x5f66('0x48')]);_0x7f932b[_0x5f66('0x4b')]=_[_0x5f66('0x4a')](_0x3ff5b3[_0x5f66('0x45')],qs[_0x5f66('0x4c')](_0x3d4b0f[_0x5f66('0x48')][_0x5f66('0x4c')]));_0x7f932b['attributes']=_0x7f932b[_0x5f66('0x4b')][_0x5f66('0x4d')]?_0x7f932b[_0x5f66('0x4b')]:_0x3ff5b3['model'];if(!_0x3d4b0f[_0x5f66('0x48')][_0x5f66('0x4e')]('nolimit')){_0x7f932b['limit']=qs[_0x5f66('0x2b')](_0x3d4b0f[_0x5f66('0x48')][_0x5f66('0x2b')]);_0x7f932b['offset']=qs[_0x5f66('0x2a')](_0x3d4b0f[_0x5f66('0x48')][_0x5f66('0x2a')]);}_0x7f932b[_0x5f66('0x4f')]=qs[_0x5f66('0x50')](_0x3d4b0f['query'][_0x5f66('0x50')]);_0x7f932b[_0x5f66('0x51')]=qs[_0x5f66('0x52')](_[_0x5f66('0x53')](_0x3d4b0f[_0x5f66('0x48')],_0x3ff5b3[_0x5f66('0x52')]),_0x5d1588);if(_0x3d4b0f['query']['filter']){_0x7f932b[_0x5f66('0x51')]=_[_0x5f66('0x54')](_0x7f932b[_0x5f66('0x51')],{'$or':_[_0x5f66('0x42')](_0x5d1588,function(_0x3566a3){if(_0x3566a3[_0x5f66('0x43')]!==_0x5f66('0x55')){return db[_0x5f66('0x56')][_0x5f66('0x51')](db[_0x5f66('0x56')]['fn'](_0x5f66('0x57'),db[_0x5f66('0x56')][_0x5f66('0x58')](_0x3566a3[_0x5f66('0x41')])),{'$like':db[_0x5f66('0x56')]['fn'](_0x5f66('0x57'),'%'+_0x3d4b0f[_0x5f66('0x48')][_0x5f66('0x39')]+'%')});}})});}_0x7f932b=_['merge']({},_0x7f932b,_0x3d4b0f[_0x5f66('0x59')]);var _0x1f3047={'where':_0x7f932b['where']};return db[_0x5f66('0x5a')][_0x5f66('0x5b')](_0x1f3047)['then'](function(_0x2e4959){_0x3d64a7['count']=_0x2e4959;if(_0x3d4b0f[_0x5f66('0x48')][_0x5f66('0x5c')]){_0x7f932b[_0x5f66('0x5d')]=[{'all':!![]}];}return db['User']['findAll'](_0x7f932b);})[_0x5f66('0x32')](function(_0x5662f3){_0x3d64a7['rows']=_0x5662f3;var _0x12664b=[];for(var _0x59bace=0x0;_0x59bace<_0x3d64a7['rows'][_0x5f66('0x4d')];_0x59bace++){_0x12664b['push'](get_open_tabs(_0x5f66('0x5e'),_0x3d64a7[_0x5f66('0x5f')][_0x59bace][_0x5f66('0x60')]));_0x12664b['push'](get_open_tabs(_0x5f66('0x61'),_0x3d64a7[_0x5f66('0x5f')][_0x59bace][_0x5f66('0x60')]));_0x12664b[_0x5f66('0x62')](get_open_tabs('fax',_0x3d64a7[_0x5f66('0x5f')][_0x59bace][_0x5f66('0x60')]));_0x12664b['push'](get_open_tabs(_0x5f66('0x63'),_0x3d64a7[_0x5f66('0x5f')][_0x59bace][_0x5f66('0x60')]));_0x12664b['push'](get_open_tabs(_0x5f66('0x64'),_0x3d64a7[_0x5f66('0x5f')][_0x59bace][_0x5f66('0x60')]));_0x12664b['push'](get_open_tabs(_0x5f66('0x65'),_0x3d64a7[_0x5f66('0x5f')][_0x59bace]['dataValues']));}return BPromise[_0x5f66('0x66')](_0x12664b)[_0x5f66('0x32')](function(_0x23ac0c){return _0x3d64a7;});})[_0x5f66('0x32')](respondWithFilteredResult(_0x3c4726,_0x7f932b))['catch'](handleError(_0x3c4726,null));};exports[_0x5f66('0x67')]=function(_0x422787,_0x165bd7){var _0x156340={'raw':![],'where':{'id':_0x422787[_0x5f66('0x68')]['id']}},_0x41bb89={};_0x41bb89[_0x5f66('0x45')]=_[_0x5f66('0x46')](_[_0x5f66('0x49')](db[_0x5f66('0x5a')]['rawAttributes']),[_0x5f66('0x69'),_0x5f66('0x47')]);_0x41bb89[_0x5f66('0x48')]=_[_0x5f66('0x49')](_0x422787[_0x5f66('0x48')]);_0x41bb89['filters']=_[_0x5f66('0x4a')](_0x41bb89[_0x5f66('0x45')],_0x41bb89[_0x5f66('0x48')]);_0x156340[_0x5f66('0x4b')]=_[_0x5f66('0x4a')](_0x41bb89[_0x5f66('0x45')],qs[_0x5f66('0x4c')](_0x422787[_0x5f66('0x48')][_0x5f66('0x4c')]));_0x156340[_0x5f66('0x4b')]=_0x156340['attributes'][_0x5f66('0x4d')]?_0x156340['attributes']:_0x41bb89['model'];if(_0x422787['query'][_0x5f66('0x5c')]){_0x156340[_0x5f66('0x5d')]=[{'all':!![]}];}_0x156340=_[_0x5f66('0x54')]({},_0x156340,_0x422787[_0x5f66('0x59')]);return db[_0x5f66('0x5a')][_0x5f66('0x3d')](_0x156340)['then'](handleEntityNotFound(_0x165bd7,null))['then'](function(_0x3ec8bf){var _0x247023=[];values=_0x3ec8bf;_0x247023[_0x5f66('0x62')](get_open_tabs(_0x5f66('0x5e'),_0x3ec8bf[_0x5f66('0x60')]));_0x247023[_0x5f66('0x62')](get_open_tabs(_0x5f66('0x61'),_0x3ec8bf[_0x5f66('0x60')]));_0x247023['push'](get_open_tabs(_0x5f66('0x64'),_0x3ec8bf['dataValues']));_0x247023['push'](get_open_tabs(_0x5f66('0x65'),_0x3ec8bf[_0x5f66('0x60')]));_0x247023[_0x5f66('0x62')](get_open_tabs(_0x5f66('0x6a'),_0x3ec8bf[_0x5f66('0x60')]));_0x247023[_0x5f66('0x62')](get_open_tabs(_0x5f66('0x63'),_0x3ec8bf[_0x5f66('0x60')]));return BPromise[_0x5f66('0x66')](_0x247023);})[_0x5f66('0x32')](function(_0x426c19){return values;})[_0x5f66('0x32')](respondWithResult(_0x165bd7,null))[_0x5f66('0x27')](handleError(_0x165bd7,null));};exports[_0x5f66('0x31')]=function(_0x49c91e,_0x3d3911){if(_0x49c91e[_0x5f66('0x6b')]['id']){delete _0x49c91e['body']['id'];}delete _0x49c91e[_0x5f66('0x6b')][_0x5f66('0x34')];return db[_0x5f66('0x5a')][_0x5f66('0x3d')]({'where':{'id':_0x49c91e[_0x5f66('0x68')]['id']}})[_0x5f66('0x32')](handleEntityNotFound(_0x3d3911,null))[_0x5f66('0x32')](saveUpdates(_0x49c91e['body'],null))['then'](respondWithResult(_0x3d3911,null))[_0x5f66('0x27')](handleError(_0x3d3911,null));};exports[_0x5f66('0x6c')]=function(_0x81b05b,_0x285438){return db[_0x5f66('0x5a')][_0x5f66('0x6c')]()[_0x5f66('0x32')](respondWithResult(_0x285438,null))['catch'](handleError(_0x285438,null));};exports['addContacts']=function(_0x332988,_0x4c402b,_0x43be3d){return db[_0x5f66('0x5a')][_0x5f66('0x3d')]({'where':{'id':_0x332988['params']['id']}})['then'](handleEntityNotFound(_0x4c402b,null))[_0x5f66('0x32')](function(_0x48dd7c){if(_0x48dd7c){return _0x48dd7c[_0x5f66('0x6d')](_0x332988[_0x5f66('0x6b')][_0x5f66('0x6e')],_[_0x5f66('0x6f')](_0x332988[_0x5f66('0x6b')],[_0x5f66('0x6e'),'id'])||{});}})[_0x5f66('0x32')](respondWithResult(_0x4c402b,null))[_0x5f66('0x27')](handleError(_0x4c402b,null));};function validateUser(_0x108573){return new BPromise(function(_0x1ded1f,_0x1ac2fe){if(_0x108573['internal'])return _0x1ded1f(_0x108573);return db['Setting'][_0x5f66('0x70')](0x1)[_0x5f66('0x32')](function(_0xa6b38b){if(_0xa6b38b[_0x5f66('0x71')])authService[_0x5f66('0x72')](_0x108573[_0x5f66('0x69')]);db[_0x5f66('0x5a')][_0x5f66('0x73')](_0x5f66('0x74'))[_0x5f66('0x32')](function(_0x1e4050){if(_[_0x5f66('0x75')](_0x1e4050)){_0x108573[_0x5f66('0x74')]=_0xa6b38b[_0x5f66('0x76')]||0x1;return;}if(_[_0x5f66('0x75')](_0xa6b38b[_0x5f66('0x76')])||_0xa6b38b[_0x5f66('0x76')]===_0x1e4050){_0x108573[_0x5f66('0x74')]=_0x1e4050+0x1;return;}if(_0xa6b38b['min_internal']>_0x1e4050){_0x108573[_0x5f66('0x74')]=_0xa6b38b[_0x5f66('0x76')];return;}return db[_0x5f66('0x56')]['query'](_0x5f66('0x77'),{'type':db['sequelize'][_0x5f66('0x78')][_0x5f66('0x79')]})[_0x5f66('0x32')](function(_0x10546e){if(_0x10546e&&_0x10546e[_0x5f66('0x4d')]){for(var _0xf12e90=0x0,_0x191504=_0x10546e['length'];_0xf12e90<_0x191504&&_['isNil'](_0x108573[_0x5f66('0x74')]);_0xf12e90++){if(_0xa6b38b[_0x5f66('0x76')]<=_0x10546e[_0xf12e90][_0x5f66('0x7a')]){_0x108573['internal']=_0x10546e[_0xf12e90][_0x5f66('0x7a')];}else if(_0xa6b38b[_0x5f66('0x76')]>_0x10546e[_0xf12e90][_0x5f66('0x7a')]&&_0xa6b38b['min_internal']<=_0x10546e[_0xf12e90]['to']){_0x108573[_0x5f66('0x74')]=_0xa6b38b[_0x5f66('0x76')];}}}if(_[_0x5f66('0x75')](_0x108573[_0x5f66('0x74')])){_0x108573[_0x5f66('0x74')]=_0x1e4050+0x1;}return _0x1ded1f(_0x108573);});});})[_0x5f66('0x27')](function(_0x12bf2a){_0x1ac2fe(_0x12bf2a);});});}function updateUser(_0x41080c){return new BPromise(function(_0x14a1f4,_0x4732c1){try{if(_0x41080c[_0x5f66('0x7b')]){_0x41080c['mailbox']=_0x41080c[_0x5f66('0x74')];_0x41080c['VoiceMail']={'mailbox':_0x41080c[_0x5f66('0x74')],'password':_0x41080c[_0x5f66('0x69')],'fullname':_0x41080c[_0x5f66('0x7c')],'email':_0x41080c[_0x5f66('0x7d')]};}if(_0x41080c[_0x5f66('0x34')]===_0x5f66('0x37')){if(!_0x41080c[_0x5f66('0x7e')])_0x41080c[_0x5f66('0x7e')]=[_0x5f66('0x7f'),'102',_0x5f66('0x80'),_0x5f66('0x81'),_0x5f66('0x82'),_0x5f66('0x83'),_0x5f66('0x84'),'106',_0x5f66('0x85'),'108',_0x5f66('0x86'),_0x5f66('0x87'),_0x5f66('0x88'),_0x5f66('0x89'),_0x5f66('0x8a')];}_0x14a1f4(_0x41080c);}catch(_0x45c14d){_0x4732c1(_0x45c14d);}});}exports[_0x5f66('0x8b')]=function(_0x1e7423,_0x249c6f){if(_0x1e7423[_0x5f66('0x8c')][_0x5f66('0x34')]===_0x5f66('0x37'))throw new Error('Unauthorized');if(_0x1e7423[_0x5f66('0x6b')][_0x5f66('0x34')]===_0x5f66('0x8c')&&_0x1e7423['user']['role']!=='admin'){throw new Error(_0x5f66('0x8d'));}if(_0x1e7423[_0x5f66('0x6b')][_0x5f66('0x34')]==='admin'&&_0x1e7423['user'][_0x5f66('0x34')]!=='admin'){throw new Error(_0x5f66('0x8e'));}return licenseUtil[_0x5f66('0x8f')]([_0x1e7423[_0x5f66('0x6b')]])['then'](function(){return validateUser(_0x1e7423[_0x5f66('0x6b')]);})['then'](function(_0x2c00ab){return updateUser(_0x2c00ab)[_0x5f66('0x32')](function(_0x1c86c9){if(_0x1c86c9['role']===_0x5f66('0x90')){_0x1c86c9[_0x5f66('0x91')]=_0x1e7423[_0x5f66('0x8c')][_0x5f66('0x91')];delete _0x1c86c9[_0x5f66('0x92')];}return _0x1c86c9;});})[_0x5f66('0x32')](function(_0x2be1c7){return db['User'][_0x5f66('0x8b')](_0x2be1c7,{'include':[{'model':db[_0x5f66('0x93')],'as':_0x5f66('0x93')}]});})['then'](function(_0x276569){if(_0x1e7423[_0x5f66('0x6b')][_0x5f66('0x34')]===_0x5f66('0x8c'))return _0x276569;if(_0x1e7423[_0x5f66('0x8c')][_0x5f66('0x34')]!==_0x5f66('0x8c'))return _0x276569;return db[_0x5f66('0x94')][_0x5f66('0x3d')]({'where':{'name':_0x276569[_0x5f66('0x34')]==='agent'?_0x5f66('0x36'):_0x5f66('0x38'),'userProfileId':_0x1e7423[_0x5f66('0x8c')][_0x5f66('0x92')]},'raw':!![]})['then'](function(_0x50f239){if(!_0x50f239||_0x50f239['autoAssociation']!=0x0)return _0x276569;return db[_0x5f66('0x3e')][_0x5f66('0x8b')]({'name':_0x276569['name'],'resourceId':_0x276569['id'],'type':_0x50f239['name'],'sectionId':_0x50f239['id']},{})[_0x5f66('0x32')](function(){return _0x276569;});})[_0x5f66('0x27')](function(_0x4519fd){logger['error'](_0x5f66('0x95'),_0x4519fd);throw _0x4519fd;});})[_0x5f66('0x32')](respondWithResult(_0x249c6f,0xc9))[_0x5f66('0x27')](handleError(_0x249c6f,null));};exports['bulkCreate']=function(_0x3d92b0,_0x10d0a0){var _0x1a5c64=_0x3d92b0[_0x5f66('0x6b')];var _0x5db772=[];if(_0x3d92b0[_0x5f66('0x8c')][_0x5f66('0x34')]==='agent')throw new Error(_0x5f66('0x96'));if(_[_0x5f66('0x97')](_0x1a5c64,[_0x5f66('0x34'),_0x5f66('0x8c')])&&_0x3d92b0[_0x5f66('0x8c')][_0x5f66('0x34')]!=='admin'){throw new Error(_0x5f66('0x8d'));}if(_[_0x5f66('0x97')](_0x1a5c64,['role',_0x5f66('0x90')])&&_0x3d92b0[_0x5f66('0x8c')][_0x5f66('0x34')]!==_0x5f66('0x90')){throw new Error(_0x5f66('0x98'));}return licenseUtil['checkUserLimits'](_0x1a5c64)[_0x5f66('0x32')](function(){return validateUser(_0x1a5c64[0x0]);})[_0x5f66('0x32')](function(){for(var _0x2bd838=0x1;_0x2bd838<_0x1a5c64[_0x5f66('0x4d')];_0x2bd838++){var _0x19b7cf=_0x1a5c64[_0x2bd838-0x1]['internal'];if(!_0x1a5c64[_0x2bd838][_0x5f66('0x74')])_0x1a5c64[_0x2bd838][_0x5f66('0x74')]=_0x19b7cf+0x1;_0x5db772['push'](validateUser(_0x1a5c64[_0x2bd838]));}return BPromise['all'](_0x5db772);})[_0x5f66('0x32')](function(){_0x5db772=[];for(var _0x398983=0x0;_0x398983<_0x1a5c64[_0x5f66('0x4d')];_0x398983++){_0x5db772[_0x5f66('0x62')](updateUser(_0x1a5c64[_0x398983]));}return BPromise[_0x5f66('0x66')](_0x5db772);})[_0x5f66('0x32')](function(){return BPromise['each'](_0x1a5c64,function(_0xcce867){return db[_0x5f66('0x5a')][_0x5f66('0x8b')](_0xcce867,{'include':[{'model':db[_0x5f66('0x93')],'as':_0x5f66('0x93')}]})[_0x5f66('0x32')](function(_0x17fa72){_0xcce867['id']=_0x17fa72['id'];return _0xcce867;});});})[_0x5f66('0x32')](function(_0x230bdc){if(_0x3d92b0['body'][_0x5f66('0x34')]==='user')return _0x230bdc;if(_0x3d92b0['user'][_0x5f66('0x34')]!==_0x5f66('0x8c'))return _0x230bdc;var _0x4fb33a=_[_0x5f66('0x97')](_0x230bdc,function(_0x440cff){return _0x440cff[_0x5f66('0x34')]===_0x5f66('0x37')||_0x440cff[_0x5f66('0x34')]===_0x5f66('0x99');});if(!_0x4fb33a)return _0x230bdc;return db[_0x5f66('0x94')][_0x5f66('0x9a')]({'where':{'name':{'$or':['Agents',_0x5f66('0x38')]},'userProfileId':_0x3d92b0[_0x5f66('0x8c')][_0x5f66('0x92')]},'raw':!![]})[_0x5f66('0x32')](function(_0x249674){if(_[_0x5f66('0x9b')](_0x249674)||!_[_0x5f66('0x97')](_0x249674,[_0x5f66('0x9c'),0x0]))return _0x230bdc;_0x5db772=[];var _0x3cdb2c=_(_0x249674)[_0x5f66('0x42')](function(_0xac513d){if(_0xac513d[_0x5f66('0x9c')]===0x1)return;return _0xac513d[_0x5f66('0x41')]===_0x5f66('0x36')?_0x5f66('0x37'):_0x5f66('0x99');})['compact']()[_0x5f66('0x3b')]();for(var _0x127e34=0x0;_0x127e34<_0x230bdc[_0x5f66('0x4d')];_0x127e34++){if(!_[_0x5f66('0x3c')](_0x3cdb2c,_0x230bdc[_0x127e34][_0x5f66('0x34')]))return;var _0x3993dc=_0x230bdc[_0x127e34]['role']===_0x5f66('0x37')?_0x5f66('0x36'):'Telephones';_0x5db772['push'](db['UserProfileResource']['create']({'name':_0x230bdc[_0x127e34][_0x5f66('0x41')],'resourceId':_0x230bdc[_0x127e34]['id'],'type':_0x3993dc,'sectionId':_[_0x5f66('0x3d')](_0x249674,['name',_0x3993dc])['id']},{}));}return BPromise[_0x5f66('0x66')](_0x5db772);});})[_0x5f66('0x32')](respondWithResult(_0x10d0a0,0xc9))[_0x5f66('0x27')](handleError(_0x10d0a0,null));};exports[_0x5f66('0x9d')]=function(_0x4e29df,_0xb96d2b,_0x57459c){if(_0x4e29df['body']['id']){delete _0x4e29df[_0x5f66('0x6b')]['id'];}return db[_0x5f66('0x5a')][_0x5f66('0x3d')]({'where':{'id':_0x4e29df[_0x5f66('0x68')]['id']}})[_0x5f66('0x32')](function(_0x29af64){if(!_0x29af64)return null;if(_0x29af64['id']===_0x4e29df[_0x5f66('0x8c')]['id']){if(!_0x4e29df[_0x5f66('0x6b')]['oldPassword']||!_0x4e29df[_0x5f66('0x6b')][_0x5f66('0x9e')]){throw new db[(_0x5f66('0x9f'))]['ValidationError'](_0x5f66('0xa0'));}if(!_0x29af64[_0x5f66('0xa1')](_0x4e29df[_0x5f66('0x6b')][_0x5f66('0xa2')])){throw new db[(_0x5f66('0x9f'))][(_0x5f66('0xa3'))](_0x5f66('0xa4'));}if(_0x4e29df[_0x5f66('0x6b')][_0x5f66('0xa2')]===_0x4e29df[_0x5f66('0x6b')][_0x5f66('0x9e')]){throw new db[(_0x5f66('0x9f'))][(_0x5f66('0xa3'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4e29df[_0x5f66('0x8c')]['role']===_0x5f66('0x90')){if(!_0x4e29df[_0x5f66('0x6b')][_0x5f66('0x9e')]){throw new db['Sequelize'][(_0x5f66('0xa3'))](_0x5f66('0xa5'));}}else if(_0x4e29df[_0x5f66('0x8c')][_0x5f66('0x34')]===_0x5f66('0x8c')){if(!_0x4e29df[_0x5f66('0x6b')][_0x5f66('0x9e')]){throw new db['Sequelize'][(_0x5f66('0xa3'))](_0x5f66('0xa5'));}if(_0x29af64[_0x5f66('0x34')]!==_0x5f66('0x37')){throw new db[(_0x5f66('0x9f'))][(_0x5f66('0xa3'))](_0x5f66('0x96'));}}else{throw new db[(_0x5f66('0x9f'))][(_0x5f66('0xa3'))]('Unauthorized');}return _0x29af64;})[_0x5f66('0x32')](handleEntityNotFound(_0xb96d2b,null))[_0x5f66('0x32')](function(_0x3cf7ae){return db[_0x5f66('0xa6')][_0x5f66('0xa7')]({'attributes':['id',_0x5f66('0x71'),_0x5f66('0xa8'),_0x5f66('0xa9')]})[_0x5f66('0x32')](function(_0x2a6ac3){if(_0x2a6ac3['securePassword'])authService['validatePasswordPattern'](_0x4e29df[_0x5f66('0x6b')]['newPassword']);if(!_0x2a6ac3[_0x5f66('0xa8')]||!_0x3cf7ae[_0x5f66('0xaa')])return _0x3cf7ae;authService[_0x5f66('0xab')](_0x4e29df[_0x5f66('0x6b')]['newPassword'],_0x3cf7ae[_0x5f66('0xaa')],_0x2a6ac3[_0x5f66('0xa9')]);return _0x3cf7ae;})[_0x5f66('0x32')](saveUpdates({'password':_0x4e29df[_0x5f66('0x6b')][_0x5f66('0x9e')],'passwordResetAt':_0x4e29df[_0x5f66('0x8c')]['id']==_0x4e29df['params']['id']?moment():null,'previousPasswords':authService[_0x5f66('0xac')](_0x4e29df[_0x5f66('0x6b')][_0x5f66('0x9e')],_0x3cf7ae[_0x5f66('0xaa')])},null));})[_0x5f66('0x32')](respondWithResult(_0xb96d2b,null))['catch'](handleError(_0xb96d2b,null));};exports[_0x5f66('0xad')]=function(_0x125d05,_0xbdc308,_0x8846cb){var _0xf8837a=_0x125d05['body'][_0x5f66('0xae')];return db[_0x5f66('0x5a')][_0x5f66('0x3d')]({'where':{'id':_0x125d05[_0x5f66('0x68')]['id']},'attributes':['id','name',_0x5f66('0x34'),_0x5f66('0xaf'),_0x5f66('0xb0'),'voicePause',_0x5f66('0xb1')]})[_0x5f66('0x32')](handleEntityNotFound(_0xbdc308,null))[_0x5f66('0x32')](function(_0x2d4ca6){if(_0x2d4ca6){if(!utils['isValidChannel'](_0xf8837a)){throw new db[(_0x5f66('0x9f'))][(_0x5f66('0xa3'))](_0x5f66('0xb2'));}return _0x2d4ca6[_0x5f66('0xb3')+_[_0x5f66('0xb4')](_0xf8837a[_0x5f66('0xb5')]())+_0x5f66('0xb6')](_0x125d05['body'][_0x5f66('0x6e')],{'penalty':_0x125d05[_0x5f66('0x6b')]['penalty']||0x0})['spread'](function(_0xf1df37){for(var _0x177b8e=0x0;_0x177b8e<_0x125d05['body']['ids'][_0x5f66('0x4d')];_0x177b8e+=0x1){var _0x30a78b={'UserId':_0x125d05['params']['id']};_0x30a78b[_['capitalize'](_0xf8837a[_0x5f66('0xb5')]())+_0x5f66('0xb7')]=_0x125d05[_0x5f66('0x6b')]['ids'][_0x177b8e];socket[_0x5f66('0xb8')](_0x5f66('0x8c')+_[_0x5f66('0xb4')](_0xf8837a[_0x5f66('0xb5')]())+_0x5f66('0xb9'),_0x30a78b);}return _0xf1df37;})[_0x5f66('0x32')](function(){if(_0xf8837a===_0x5f66('0xba')){return db[_0x5f66('0xbb')]['findAll']({'where':{'id':_0x125d05['body'][_0x5f66('0x6e')]||[]},'raw':!![],'attributes':['id',_0x5f66('0x41')]});}})[_0x5f66('0x32')](function(_0x32cf56){var _0x4c30ce=_0x2d4ca6[_0x5f66('0x33')]({'plain':!![]});var _0x2e4c5a=[];if(_0xf8837a===_0x5f66('0xba')&&_0x4c30ce[_0x5f66('0x34')]==='agent'&&_0x4c30ce[_0x5f66('0xaf')]){for(var _0x332d01=0x0;_0x332d01<_0x32cf56['length'];_0x332d01+=0x1){_0x2e4c5a['push']({'membername':_0x4c30ce[_0x5f66('0x41')],'UserId':_0x4c30ce['id'],'queue_name':_0x32cf56[_0x332d01][_0x5f66('0x41')],'VoiceQueueId':_0x32cf56[_0x332d01]['id'],'interface':_['isNil'](_0x4c30ce[_0x5f66('0xb1')])?util['format'](_0x5f66('0xbc'),_0x4c30ce[_0x5f66('0x41')]):_0x4c30ce[_0x5f66('0xb1')],'paused':_0x4c30ce['voicePause']||![],'penalty':_0x125d05['body'][_0x5f66('0xbd')]||0x0});}return BPromise['each'](_0x2e4c5a,function(_0x5dcc3c){return db['UserVoiceQueueRt']['upsert'](_0x5dcc3c);});}return _0x2d4ca6;});}})['then'](respondWithStatusCode(_0xbdc308,null))[_0x5f66('0x27')](handleError(_0xbdc308,null));};exports['removeQueues']=function(_0x357513,_0x272afa,_0x35c9f9){var _0xd314a0;return db[_0x5f66('0x5a')][_0x5f66('0x3d')]({'where':{'id':_0x357513['params']['id']},'attributes':['id',_0x5f66('0x41'),_0x5f66('0x34')]})[_0x5f66('0x32')](handleEntityNotFound(_0x272afa,null))[_0x5f66('0x32')](function(_0x23b64c){if(_0x23b64c){_0xd314a0=_0x23b64c;if(!_0x357513[_0x5f66('0x48')][_0x5f66('0xae')]||!utils['isValidChannel'](_0x357513[_0x5f66('0x48')][_0x5f66('0xae')])){throw new db[(_0x5f66('0x9f'))]['ValidationError'](_0x5f66('0xb2'));}return _0x23b64c[_0x5f66('0xbe')+_[_0x5f66('0xb4')](_0x357513[_0x5f66('0x48')][_0x5f66('0xae')][_0x5f66('0xb5')]())+'Queues'](_0x357513[_0x5f66('0x48')][_0x5f66('0x6e')]);}})[_0x5f66('0x32')](function(_0xae51ad){for(var _0x36d0dc=0x0;_0x36d0dc<_0x357513[_0x5f66('0x48')][_0x5f66('0x6e')]['length'];_0x36d0dc+=0x1){var _0x2eec3f={'UserId':_0x357513[_0x5f66('0x68')]['id']};_0x2eec3f[_['capitalize'](_0x357513[_0x5f66('0x48')][_0x5f66('0xae')]['toLowerCase']())+_0x5f66('0xb7')]=_0x357513['query'][_0x5f66('0x6e')][_0x36d0dc];socket[_0x5f66('0xb8')]('user'+_[_0x5f66('0xb4')](_0x357513[_0x5f66('0x48')][_0x5f66('0xae')][_0x5f66('0xb5')]())+_0x5f66('0xbf'),_0x2eec3f);}return _0xae51ad;})['then'](function(){if(_0x357513['query']['channel']===_0x5f66('0xba')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x357513[_0x5f66('0x68')]['id'],'VoiceQueueId':_0x357513[_0x5f66('0x48')][_0x5f66('0x6e')]},'individualHooks':!![]})[_0x5f66('0x32')](function(){return _0xd314a0;});}return _0xd314a0;})[_0x5f66('0x32')](respondWithStatusCode(_0x272afa,null))[_0x5f66('0x27')](handleError(_0x272afa,null));};exports[_0x5f66('0xc0')]=function(_0x220bd6,_0x51686b,_0x497b57){_0x220bd6[_0x5f66('0x6b')][_0x5f66('0xc1')]=_0x220bd6[_0x5f66('0xc2')][_0x5f66('0xc3')];return db['User'][_0x5f66('0x3d')]({'where':{'id':_0x220bd6[_0x5f66('0x68')]['id']}})[_0x5f66('0x32')](handleEntityNotFound(_0x51686b,null))[_0x5f66('0x32')](saveUpdates(_0x220bd6[_0x5f66('0x6b')],null))[_0x5f66('0x32')](respondWithResult(_0x51686b,null))['catch'](handleError(_0x51686b,null));};exports[_0x5f66('0xc4')]=function(_0x45aa8e,_0x2ab0f7,_0x59d8b9){var _0x104477=path[_0x5f66('0xc5')](config[_0x5f66('0xc6')],_0x5f66('0xc7'));return db['User']['find']({'where':{'id':_0x45aa8e['params']['id']},'attributes':['id',_0x5f66('0xc1')],'raw':!![]})[_0x5f66('0x32')](handleEntityNotFound(_0x2ab0f7,null))[_0x5f66('0x32')](function(_0x3b009d){if(_0x3b009d){if(_[_0x5f66('0x75')](_0x3b009d['userpic'])){return _0x2ab0f7[_0x5f66('0xc8')](_0x104477);}else{if(!fs[_0x5f66('0xc9')](path['join'](config['root'],_0x5f66('0xca'),_0x3b009d[_0x5f66('0xc1')]))){return _0x2ab0f7['download'](_0x104477);}return _0x2ab0f7[_0x5f66('0xc8')](path[_0x5f66('0xc5')](config[_0x5f66('0xc6')],_0x5f66('0xca'),_0x3b009d[_0x5f66('0xc1')]));}}})[_0x5f66('0x27')](handleError(_0x2ab0f7,null));};exports[_0x5f66('0xcb')]=function(_0x5dc340,_0x154086,_0x183f38){return db[_0x5f66('0x5a')][_0x5f66('0x3d')]({'where':{'id':_0x5dc340['params']['id']},'attributes':['id']})[_0x5f66('0x32')](handleEntityNotFound(_0x154086,null))[_0x5f66('0x32')](function(_0x365ff9){var _0x249e78=[];values=_0x365ff9[_0x5f66('0x60')];_0x249e78[_0x5f66('0x62')](get_open_tabs('chat',_0x365ff9[_0x5f66('0x60')]));_0x249e78[_0x5f66('0x62')](get_open_tabs(_0x5f66('0x61'),_0x365ff9[_0x5f66('0x60')]));_0x249e78['push'](get_open_tabs(_0x5f66('0x64'),_0x365ff9[_0x5f66('0x60')]));_0x249e78[_0x5f66('0x62')](get_open_tabs(_0x5f66('0x65'),_0x365ff9[_0x5f66('0x60')]));_0x249e78[_0x5f66('0x62')](get_open_tabs(_0x5f66('0x6a'),_0x365ff9[_0x5f66('0x60')]));_0x249e78[_0x5f66('0x62')](get_open_tabs(_0x5f66('0x63'),_0x365ff9[_0x5f66('0x60')]));return BPromise['all'](_0x249e78);})[_0x5f66('0x32')](function(_0x1afe92){var _0x514c88=[];if(_0x1afe92){for(var _0x48ee76=0x0;_0x48ee76=_0x48ae9e[_0x6229('0x50')]){throw new Error(_0x6229('0x51'));}})[_0x6229('0x10')](function(){if(_0x57109f){return db[_0x6229('0x2c')][_0x6229('0x52')]({'where':{'membername':_0x57109f[_0x6229('0x29')]},'individualHooks':!![]});}})[_0x6229('0x10')](function(){if(_0x57109f){return _0x57109f['getVoiceQueues']({'raw':!![]});}})[_0x6229('0x10')](function(_0x5b76c5){if(_0x57109f){if(_0x5b76c5){var _0x2825fe=[];_0x310c34=_0x5b76c5;if(_0x310c34[_0x6229('0x2f')]){for(var _0x17c65a=0x0;_0x17c65a<_0x310c34['length'];_0x17c65a++){_0x2825fe[_0x6229('0x34')](db[_0x6229('0x2c')][_0x6229('0x53')]({'membername':_0x57109f[_0x6229('0x29')],'UserId':_0x57109f['id'],'queue_name':_0x310c34[_0x17c65a][_0x6229('0x29')],'VoiceQueueId':_0x310c34[_0x17c65a]['id'],'interface':_0x2e4fb4,'paused':_0x57109f[_0x6229('0x4b')]||![],'penalty':_0x310c34[_0x17c65a][_0x6229('0x54')]||0x0}));}return BPromise[_0x6229('0x55')](_0x2825fe);}}}})[_0x6229('0x10')](function(){if(_0x57109f){return db[_0x6229('0x2e')][_0x6229('0x1a')]({'where':{'membername':_0x57109f[_0x6229('0x29')],'exitAt':null}});}})[_0x6229('0x10')](function(_0x195889){if(_0x57109f){if(_0x195889&&_0x195889['length']){var _0x4dc015=[];_0x195889[_0x6229('0x33')](function(_0x266b04){_0x4dc015[_0x6229('0x34')](_0x266b04[_0x6229('0x2d')]({'exitAt':moment()[_0x6229('0x37')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4dc015);}}})[_0x6229('0x10')](function(_0x33b202){if(_0x57109f){var _0x262914=[];var _0x238e9e=[];var _0x22dc3e=utils[_0x6229('0x32')]();var _0x1e8af0={'membername':_0x57109f[_0x6229('0x29')],'interface':_0x2e4fb4,'enterAt':moment()['format'](_0x6229('0x30')),'role':_0x57109f[_0x6229('0x2a')],'internal':_0x57109f['internal']};_0x22dc3e['forEach'](function(_0x339323){_0x262914['push'](_[_0x6229('0x56')]({'channel':_0x339323,'type':_0x6229('0x57'),'data1':_0x6229('0x58'),'data2':_0x2e4fb4},_0x1e8af0));if(_0x57109f[_0x6229('0x4b')]){_0x238e9e[_0x6229('0x34')](_['merge']({'channel':_0x339323,'type':_0x6229('0x38'),'data1':'LOGININPAUSE'},_0x1e8af0));}});return db[_0x6229('0x2e')]['bulkCreate'](_0x262914[_0x6229('0x59')](_0x238e9e),{'individualHooks':!![]});}})[_0x6229('0x10')](function(){if(_0x57109f){return _0x57109f[_0x6229('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x6229('0x37')](_0x6229('0x30')),'voicePause':_0x57109f[_0x6229('0x4b')]||![],'mailPause':_0x57109f[_0x6229('0x4b')]||![],'chatPause':_0x57109f[_0x6229('0x4b')]||![],'faxPause':_0x57109f[_0x6229('0x4b')]||![],'smsPause':_0x57109f[_0x6229('0x4b')]||![],'openchannelPause':_0x57109f[_0x6229('0x4b')]||![],'pauseType':_0x57109f[_0x6229('0x4b')]?_0x6229('0x5a'):null,'lastPauseAt':moment()[_0x6229('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2e4fb4});}})[_0x6229('0x10')](function(_0x46359e){_0x2ca3b2(_0x46359e);})[_0x6229('0x24')](function(_0x103f18){_0x2833e8(_0x39cfdf[_0x6229('0x14')](0x1f4,_0x103f18[_0x6229('0x16')]));});});}; \ No newline at end of file +var _0x0f5d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetUser','User','find','ShowUser','role','internal','interface','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','name','isNil','PAUSE','body','type','UnpauseUser','findOne','isValidChannel','channel','voice','system','mail','fax','sms','openchannel','set','Pause','push','all','LogoutUser','destroy','LoginUser','mobile','phone','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','callysquare','bulkCreate','concat','lodash','util'];(function(_0x1a123f,_0x56e61b){var _0x127902=function(_0x1bf382){while(--_0x1bf382){_0x1a123f['push'](_0x1a123f['shift']());}};_0x127902(++_0x56e61b);}(_0x0f5d,0x166));var _0xd0f5=function(_0x45f26f,_0x4ae89f){_0x45f26f=_0x45f26f-0x0;var _0x5253dc=_0x0f5d[_0x45f26f];return _0x5253dc;};'use strict';var _=require(_0xd0f5('0x0'));var util=require(_0xd0f5('0x1'));var moment=require(_0xd0f5('0x2'));var BPromise=require(_0xd0f5('0x3'));var rs=require(_0xd0f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0f5('0x5'))['db'];var utils=require(_0xd0f5('0x6'));var logger=require(_0xd0f5('0x7'))(_0xd0f5('0x8'));var config=require(_0xd0f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd0f5('0xa')]['http']({'port':0x232a});config[_0xd0f5('0xb')]=_[_0xd0f5('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd0f5('0xd'))(new Redis(config['redis']));require(_0xd0f5('0xe'))[_0xd0f5('0xf')](socket);function respondWithRpcPromise(_0x17e728,_0x17b0b8,_0x2b601c){return new BPromise(function(_0x1fa60d,_0x2c6c64){return client['request'](_0x17e728,_0x2b601c)[_0xd0f5('0x10')](function(_0xc97a4b){logger[_0xd0f5('0x11')](_0xd0f5('0x12'),_0x17b0b8,_0xd0f5('0x13'));logger[_0xd0f5('0x14')](_0xd0f5('0x15'),_0x17b0b8,'request\x20sent',JSON[_0xd0f5('0x16')](_0xc97a4b));if(_0xc97a4b['error']){if(_0xc97a4b[_0xd0f5('0x17')][_0xd0f5('0x18')]===0x1f4){logger[_0xd0f5('0x17')](_0xd0f5('0x12'),_0x17b0b8,_0xc97a4b[_0xd0f5('0x17')]['message']);return _0x2c6c64(_0xc97a4b[_0xd0f5('0x17')][_0xd0f5('0x19')]);}logger[_0xd0f5('0x17')]('User,\x20%s,\x20%s',_0x17b0b8,_0xc97a4b[_0xd0f5('0x17')][_0xd0f5('0x19')]);return _0x1fa60d(_0xc97a4b[_0xd0f5('0x17')]['message']);}else{logger[_0xd0f5('0x11')]('User,\x20%s,\x20%s',_0x17b0b8,_0xd0f5('0x13'));_0x1fa60d(_0xc97a4b[_0xd0f5('0x1a')][_0xd0f5('0x19')]);}})[_0xd0f5('0x1b')](function(_0x1ca9ae){logger[_0xd0f5('0x17')](_0xd0f5('0x12'),_0x17b0b8,_0x1ca9ae);_0x2c6c64(_0x1ca9ae);});});}exports['GetUser']=function(_0x41d00b){var _0x37a167=this;return new Promise(function(_0x441b9b,_0x3161d1){return db['User'][_0xd0f5('0x1c')]({'raw':_0x41d00b['options']?_0x41d00b[_0xd0f5('0x1d')][_0xd0f5('0x1e')]===undefined?!![]:![]:!![],'where':_0x41d00b[_0xd0f5('0x1d')]?_0x41d00b[_0xd0f5('0x1d')][_0xd0f5('0x1f')]||null:null,'attributes':_0x41d00b[_0xd0f5('0x1d')]?_0x41d00b[_0xd0f5('0x1d')][_0xd0f5('0x20')]||null:null,'limit':_0x41d00b[_0xd0f5('0x1d')]?_0x41d00b[_0xd0f5('0x1d')][_0xd0f5('0x21')]||null:null,'include':_0x41d00b[_0xd0f5('0x1d')]?_0x41d00b[_0xd0f5('0x1d')][_0xd0f5('0x22')]?_[_0xd0f5('0x23')](_0x41d00b[_0xd0f5('0x1d')][_0xd0f5('0x22')],function(_0x2c40f1){return{'model':db[_0x2c40f1['model']],'as':_0x2c40f1['as'],'attributes':_0x2c40f1[_0xd0f5('0x20')],'include':_0x2c40f1[_0xd0f5('0x22')]?_[_0xd0f5('0x23')](_0x2c40f1[_0xd0f5('0x22')],function(_0x479a5d){return{'model':db[_0x479a5d[_0xd0f5('0x24')]],'as':_0x479a5d['as'],'attributes':_0x479a5d['attributes'],'include':_0x479a5d[_0xd0f5('0x22')]?_[_0xd0f5('0x23')](_0x479a5d['include'],function(_0x4d498d){return{'model':db[_0x4d498d[_0xd0f5('0x24')]],'as':_0x4d498d['as'],'attributes':_0x4d498d[_0xd0f5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x297a99){logger[_0xd0f5('0x11')](_0xd0f5('0x25'),_0x41d00b);logger['debug'](_0xd0f5('0x25'),_0x41d00b,JSON['stringify'](_0x297a99));_0x441b9b(_0x297a99);})[_0xd0f5('0x1b')](function(_0x298e5e){logger[_0xd0f5('0x17')](_0xd0f5('0x25'),_0x298e5e[_0xd0f5('0x19')],_0x41d00b);_0x3161d1(_0x37a167[_0xd0f5('0x17')](0x1f4,_0x298e5e[_0xd0f5('0x19')]));});});};exports['ShowUser']=function(_0x107a90){var _0x463216=this;return new Promise(function(_0x3810ac,_0x59c0ba){return db[_0xd0f5('0x26')][_0xd0f5('0x27')]({'raw':_0x107a90['options']?_0x107a90[_0xd0f5('0x1d')][_0xd0f5('0x1e')]===undefined?!![]:![]:!![],'where':_0x107a90['options']?_0x107a90['options']['where']||null:null,'attributes':_0x107a90[_0xd0f5('0x1d')]?_0x107a90[_0xd0f5('0x1d')][_0xd0f5('0x20')]||null:null,'include':_0x107a90[_0xd0f5('0x1d')]?_0x107a90['options'][_0xd0f5('0x22')]?_[_0xd0f5('0x23')](_0x107a90[_0xd0f5('0x1d')][_0xd0f5('0x22')],function(_0x4f26f6){return{'model':db[_0x4f26f6[_0xd0f5('0x24')]],'as':_0x4f26f6['as'],'attributes':_0x4f26f6['attributes'],'include':_0x4f26f6[_0xd0f5('0x22')]?_['map'](_0x4f26f6['include'],function(_0x5be860){return{'model':db[_0x5be860['model']],'as':_0x5be860['as'],'attributes':_0x5be860['attributes'],'include':_0x5be860['include']?_['map'](_0x5be860[_0xd0f5('0x22')],function(_0x175ab2){return{'model':db[_0x175ab2[_0xd0f5('0x24')]],'as':_0x175ab2['as'],'attributes':_0x175ab2['attributes']};}):[]};}):[]};}):[]:[]})[_0xd0f5('0x10')](function(_0x1109e0){logger[_0xd0f5('0x11')](_0xd0f5('0x28'),_0x107a90);logger[_0xd0f5('0x14')]('ShowUser',_0x107a90,JSON[_0xd0f5('0x16')](_0x1109e0));_0x3810ac(_0x1109e0);})['catch'](function(_0x64c61f){logger[_0xd0f5('0x17')](_0xd0f5('0x28'),_0x64c61f[_0xd0f5('0x19')],_0x107a90);_0x59c0ba(_0x463216[_0xd0f5('0x17')](0x1f4,_0x64c61f[_0xd0f5('0x19')]));});});};exports['PauseUser']=function(_0x1cdc29){var _0xd2b461=this;return new Promise(function(_0x58158e,_0x34c978){var _0x1da62a;return db[_0xd0f5('0x26')][_0xd0f5('0x27')]({'where':_0x1cdc29[_0xd0f5('0x1d')][_0xd0f5('0x1f')]||{},'attributes':['id','name',_0xd0f5('0x29'),_0xd0f5('0x2a'),_0xd0f5('0x2b')]})['then'](function(_0x49b183){if(_0x49b183){_0x1da62a=_0x49b183;return db[_0xd0f5('0x2c')][_0xd0f5('0x2d')]({'paused':0x1},{'where':{'UserId':_0x1da62a['id']},'individualHooks':!![]});}})['then'](function(){if(_0x1da62a){return db[_0xd0f5('0x2e')][_0xd0f5('0x1c')]({'where':{'membername':_0x1da62a['name'],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x1e16ca){if(_0x1da62a){if(_0x1e16ca&&_0x1e16ca[_0xd0f5('0x2f')]){var _0x515444=moment()[_0xd0f5('0x30')](_0xd0f5('0x31'));for(var _0x4cf5a4=0x0,_0x12ecbb=_0x1e16ca[_0xd0f5('0x2f')];_0x4cf5a4<_0x12ecbb;_0x4cf5a4++){_0x1e16ca[_0x4cf5a4][_0xd0f5('0x32')]({'exitAt':_0x515444});}}}})['then'](function(){if(_0x1da62a){var _0x576f28=[];var _0x3ba799=utils[_0xd0f5('0x33')]();_0x3ba799[_0xd0f5('0x34')](function(_0x3c93ac){_0x576f28['push']({'channel':_0x3c93ac,'membername':_0x1da62a[_0xd0f5('0x35')],'interface':_[_0xd0f5('0x36')](_0x1da62a[_0xd0f5('0x2b')])?util[_0xd0f5('0x30')]('SIP/%s',_0x1da62a['name']):_0x1da62a[_0xd0f5('0x2b')],'type':_0xd0f5('0x37'),'enterAt':moment()['format'](_0xd0f5('0x31')),'data1':_0x1cdc29[_0xd0f5('0x38')][_0xd0f5('0x39')]||'DEFAULT\x20PAUSE','role':_0x1da62a[_0xd0f5('0x29')],'internal':_0x1da62a['internal'],'uniqueid':_0x1cdc29[_0xd0f5('0x38')]['uniqueid']||null});});return db[_0xd0f5('0x2e')]['bulkCreate'](_0x576f28,{'individualHooks':!![]});}})[_0xd0f5('0x10')](function(){if(_0x1da62a){return _0x1da62a[_0xd0f5('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1cdc29[_0xd0f5('0x38')][_0xd0f5('0x39')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd0f5('0x30')](_0xd0f5('0x31'))});}})['then'](function(_0x135934){_0x58158e(_0x135934);})[_0xd0f5('0x1b')](function(_0x4ca5b6){_0x34c978(_0xd2b461[_0xd0f5('0x17')](0x1f4,_0x4ca5b6[_0xd0f5('0x19')]));});});};exports[_0xd0f5('0x3a')]=function(_0x29135a){var _0x121b58=this;return new Promise(function(_0x2924e7,_0x27b6d2){var _0x5a8f8a;return db[_0xd0f5('0x26')][_0xd0f5('0x3b')]({'where':_0x29135a[_0xd0f5('0x1d')][_0xd0f5('0x1f')]||{},'attributes':['id',_0xd0f5('0x35')]})['then'](function(_0x544859){if(_0x544859){_0x5a8f8a=_0x544859;if(_0x29135a[_0xd0f5('0x38')]['channel']&&!utils[_0xd0f5('0x3c')](_0x29135a['body']['channel'])){throw new Error('Unknown\x20channel');}switch(_0x29135a['body'][_0xd0f5('0x3d')]){case _0xd0f5('0x3e'):return db[_0xd0f5('0x2c')][_0xd0f5('0x2d')]({'paused':0x0},{'where':{'UserId':_0x5a8f8a['id']}})['then'](function(){return db[_0xd0f5('0x2e')][_0xd0f5('0x27')]({'where':{'channel':_0x29135a['body'][_0xd0f5('0x3d')],'membername':_0x5a8f8a[_0xd0f5('0x35')],'type':_0xd0f5('0x37'),'exitAt':null}});})[_0xd0f5('0x10')](function(_0x491815){if(_0x491815){return _0x491815[_0xd0f5('0x2d')]({'exitAt':moment()[_0xd0f5('0x30')](_0xd0f5('0x31')),'data2':_0xd0f5('0x3f')},{'individualHooks':!![]});}return null;})[_0xd0f5('0x10')](function(){return _0x5a8f8a[_0xd0f5('0x2d')]({'voicePause':![]});});case _0xd0f5('0x40'):case'chat':case _0xd0f5('0x41'):case _0xd0f5('0x42'):case _0xd0f5('0x43'):case'whatsapp':return db[_0xd0f5('0x2e')][_0xd0f5('0x27')]({'where':{'channel':_0x29135a[_0xd0f5('0x38')][_0xd0f5('0x3d')],'membername':_0x5a8f8a[_0xd0f5('0x35')],'type':_0xd0f5('0x37'),'exitAt':null}})[_0xd0f5('0x10')](function(_0xdd9bbb){return _0xdd9bbb[_0xd0f5('0x2d')]({'exitAt':moment()['format'](_0xd0f5('0x31')),'data2':_0xd0f5('0x3f')},{'individualHooks':!![]});})[_0xd0f5('0x10')](function(){var _0x434692={};_[_0xd0f5('0x44')](_0x434692,util[_0xd0f5('0x30')]('%s%s',_0x29135a['body']['channel'],_0xd0f5('0x45')),![]);return _0x5a8f8a[_0xd0f5('0x2d')](_0x434692);});default:return db[_0xd0f5('0x2c')][_0xd0f5('0x2d')]({'paused':0x0},{'where':{'UserId':_0x5a8f8a['id']}})[_0xd0f5('0x10')](function(){return db[_0xd0f5('0x2e')]['findAll']({'where':{'membername':_0x5a8f8a[_0xd0f5('0x35')],'type':_0xd0f5('0x37'),'exitAt':null}});})['then'](function(_0x29cd53){var _0x290376=[];_0x29cd53[_0xd0f5('0x34')](function(_0x3fef8b){_0x290376[_0xd0f5('0x46')](_0x3fef8b['update']({'exitAt':moment()['format'](_0xd0f5('0x31')),'data2':_0xd0f5('0x3f')}));});return BPromise[_0xd0f5('0x47')](_0x290376);})[_0xd0f5('0x10')](function(){return _0x5a8f8a['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xd0f5('0x10')](function(_0x300f8c){_0x2924e7(_0x300f8c);})[_0xd0f5('0x1b')](function(_0x3b38b0){_0x27b6d2(_0x121b58['error'](0x1f4,_0x3b38b0[_0xd0f5('0x19')]));});});};exports[_0xd0f5('0x48')]=function(_0x45b0e6){var _0x1804f3=this;return new Promise(function(_0x4fb11f,_0x21a9e9){var _0x456883;return db['User']['findOne']({'where':_0x45b0e6[_0xd0f5('0x1d')][_0xd0f5('0x1f')]||{},'attributes':['id',_0xd0f5('0x35')]})[_0xd0f5('0x10')](function(_0x266e55){if(_0x266e55){_0x456883=_0x266e55;return db[_0xd0f5('0x2c')][_0xd0f5('0x49')]({'where':{'membername':_0x456883[_0xd0f5('0x35')]},'individualHooks':!![]});}})['then'](function(){if(_0x456883){return db['MemberReport'][_0xd0f5('0x1c')]({'where':{'membername':_0x456883[_0xd0f5('0x35')],'exitAt':null}});}})[_0xd0f5('0x10')](function(_0x24311e){if(_0x456883){if(_0x24311e&&_0x24311e['length']){var _0x5cd5e5=[];_0x24311e[_0xd0f5('0x34')](function(_0x2082e8){_0x5cd5e5['push'](_0x2082e8[_0xd0f5('0x2d')]({'exitAt':moment()['format'](_0xd0f5('0x31'))}));});return BPromise['all'](_0x5cd5e5);}}})[_0xd0f5('0x10')](function(){if(_0x456883){return _0x456883[_0xd0f5('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x3a7d0f){_0x4fb11f(_0x3a7d0f);})[_0xd0f5('0x1b')](function(_0x336065){_0x21a9e9(_0x1804f3[_0xd0f5('0x17')](0x1f4,_0x336065['message']));});});};exports[_0xd0f5('0x4a')]=function(_0x39c2e4){var _0x4db8ba=this;return new Promise(function(_0x3b7c15,_0x4508bb){var _0x990599;var _0x4cc322;var _0x3def57;var _0x20d6ef;return db['User'][_0xd0f5('0x3b')]({'where':_0x39c2e4[_0xd0f5('0x1d')][_0xd0f5('0x1f')]||{},'attributes':['id',_0xd0f5('0x35'),_0xd0f5('0x29'),_0xd0f5('0x4b'),_0xd0f5('0x4c'),_0xd0f5('0x2a'),'loginInPause',_0xd0f5('0x2b')]})['then'](function(_0x5351cd){if(_0x5351cd){_0x990599=_0x5351cd;_0x20d6ef=_0x39c2e4[_0xd0f5('0x38')]['interface']?_0x39c2e4[_0xd0f5('0x38')][_0xd0f5('0x2b')]:util[_0xd0f5('0x30')]('SIP/%s',_0x990599[_0xd0f5('0x35')]);return db[_0xd0f5('0x26')]['count']({'where':{'role':_0xd0f5('0x4d'),'online':!![],'id':{'$ne':_0x990599['id']}}});}})[_0xd0f5('0x10')](function(_0x32eb77){if(_0x32eb77){_0x3def57=_0x32eb77;return require(_0xd0f5('0x4e'))['getLicense']();}})[_0xd0f5('0x10')](function(_0x3f8ffc){if(_0x3f8ffc&&_0x3f8ffc[_0xd0f5('0x4f')]&&_0x3def57>=_0x3f8ffc[_0xd0f5('0x4f')]){throw new Error(_0xd0f5('0x50'));}})[_0xd0f5('0x10')](function(){if(_0x990599){return db[_0xd0f5('0x2c')]['destroy']({'where':{'membername':_0x990599['name']},'individualHooks':!![]});}})[_0xd0f5('0x10')](function(){if(_0x990599){return _0x990599[_0xd0f5('0x51')]({'raw':!![]});}})[_0xd0f5('0x10')](function(_0x14cccf){if(_0x990599){if(_0x14cccf){var _0x4c4dd7=[];_0x4cc322=_0x14cccf;if(_0x4cc322[_0xd0f5('0x2f')]){for(var _0x6323ca=0x0;_0x6323ca<_0x4cc322[_0xd0f5('0x2f')];_0x6323ca++){_0x4c4dd7['push'](db[_0xd0f5('0x2c')][_0xd0f5('0x52')]({'membername':_0x990599['name'],'UserId':_0x990599['id'],'queue_name':_0x4cc322[_0x6323ca][_0xd0f5('0x35')],'VoiceQueueId':_0x4cc322[_0x6323ca]['id'],'interface':_0x20d6ef,'paused':_0x990599[_0xd0f5('0x53')]||![],'penalty':_0x4cc322[_0x6323ca][_0xd0f5('0x54')]||0x0}));}return BPromise['all'](_0x4c4dd7);}}}})[_0xd0f5('0x10')](function(){if(_0x990599){return db[_0xd0f5('0x2e')][_0xd0f5('0x1c')]({'where':{'membername':_0x990599['name'],'exitAt':null}});}})[_0xd0f5('0x10')](function(_0x3674bd){if(_0x990599){if(_0x3674bd&&_0x3674bd[_0xd0f5('0x2f')]){var _0x2e0f11=[];_0x3674bd[_0xd0f5('0x34')](function(_0x4067a7){_0x2e0f11[_0xd0f5('0x46')](_0x4067a7[_0xd0f5('0x2d')]({'exitAt':moment()[_0xd0f5('0x30')](_0xd0f5('0x31'))}));});return BPromise[_0xd0f5('0x47')](_0x2e0f11);}}})[_0xd0f5('0x10')](function(_0x458ed4){if(_0x990599){var _0x7461b6=[];var _0xe06e38=[];var _0x51038d=utils[_0xd0f5('0x33')]();var _0x1597d7={'membername':_0x990599[_0xd0f5('0x35')],'interface':_0x20d6ef,'enterAt':moment()[_0xd0f5('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x990599[_0xd0f5('0x29')],'internal':_0x990599['internal']};_0x51038d[_0xd0f5('0x34')](function(_0x7ab291){_0x7461b6['push'](_[_0xd0f5('0x55')]({'channel':_0x7ab291,'type':_0xd0f5('0x56'),'data1':_0xd0f5('0x57'),'data2':_0x20d6ef},_0x1597d7));if(_0x990599[_0xd0f5('0x53')]){_0xe06e38[_0xd0f5('0x46')](_[_0xd0f5('0x55')]({'channel':_0x7ab291,'type':_0xd0f5('0x37'),'data1':'LOGININPAUSE'},_0x1597d7));}});return db[_0xd0f5('0x2e')][_0xd0f5('0x58')](_0x7461b6[_0xd0f5('0x59')](_0xe06e38),{'individualHooks':!![]});}})['then'](function(){if(_0x990599){return _0x990599[_0xd0f5('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xd0f5('0x30')](_0xd0f5('0x31')),'voicePause':_0x990599[_0xd0f5('0x53')]||![],'mailPause':_0x990599['loginInPause']||![],'chatPause':_0x990599[_0xd0f5('0x53')]||![],'faxPause':_0x990599[_0xd0f5('0x53')]||![],'smsPause':_0x990599[_0xd0f5('0x53')]||![],'openchannelPause':_0x990599[_0xd0f5('0x53')]||![],'pauseType':_0x990599['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xd0f5('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x20d6ef});}})['then'](function(_0x3d9fd1){_0x3b7c15(_0x3d9fd1);})[_0xd0f5('0x1b')](function(_0x4cce23){_0x4508bb(_0x4db8ba[_0xd0f5('0x17')](0x1f4,_0x4cce23[_0xd0f5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 7f4561e..74b82bf 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 _0xead7=['removeListener','length','./user.events','update'];(function(_0xf2e93a,_0x1ed5e2){var _0x1949bb=function(_0xeefa3a){while(--_0xeefa3a){_0xf2e93a['push'](_0xf2e93a['shift']());}};_0x1949bb(++_0x1ed5e2);}(_0xead7,0xb6));var _0x7ead=function(_0x2b83c8,_0x42192a){_0x2b83c8=_0x2b83c8-0x0;var _0x21e241=_0xead7[_0x2b83c8];return _0x21e241;};'use strict';var UserEvents=require(_0x7ead('0x0'));var events=['save','remove',_0x7ead('0x1')];function createListener(_0x3ef90a,_0x10c219){return function(_0x43b792){_0x10c219['emit'](_0x3ef90a,_0x43b792);};}function removeListener(_0x838255,_0x385fca){return function(){UserEvents[_0x7ead('0x2')](_0x838255,_0x385fca);};}exports['register']=function(_0x3f9d36){for(var _0x386483=0x0,_0x44f328=events[_0x7ead('0x3')];_0x386483<_0x44f328;_0x386483++){var _0x3598da=events[_0x386483];var _0x29ceb5=createListener('user:'+_0x3598da,_0x3f9d36);UserEvents['on'](_0x3598da,_0x29ceb5);}}; \ No newline at end of file +var _0xefee=['./user.events','save','update','emit','removeListener','length','user:'];(function(_0x55d670,_0x4ff851){var _0x457547=function(_0x58786b){while(--_0x58786b){_0x55d670['push'](_0x55d670['shift']());}};_0x457547(++_0x4ff851);}(_0xefee,0x111));var _0xeefe=function(_0x401473,_0x282dae){_0x401473=_0x401473-0x0;var _0x1800b3=_0xefee[_0x401473];return _0x1800b3;};'use strict';var UserEvents=require(_0xeefe('0x0'));var events=[_0xeefe('0x1'),'remove',_0xeefe('0x2')];function createListener(_0x4a6c98,_0x30d26f){return function(_0x27f491){_0x30d26f[_0xeefe('0x3')](_0x4a6c98,_0x27f491);};}function removeListener(_0x42ab50,_0xb4c20c){return function(){UserEvents[_0xeefe('0x4')](_0x42ab50,_0xb4c20c);};}exports['register']=function(_0x4c293c){for(var _0xc4cedf=0x0,_0x107003=events[_0xeefe('0x5')];_0xc4cedf<_0x107003;_0xc4cedf++){var _0x608312=events[_0xc4cedf];var _0x4db948=createListener(_0xeefe('0x6')+_0x608312,_0x4c293c);UserEvents['on'](_0x608312,_0x4db948);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ec652f4..3810426 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 _0xb19a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0xb19a,0xd0));var _0xab19=function(_0x977ffc,_0x7a8743){_0x977ffc=_0x977ffc-0x0;var _0x5e47ac=_0xb19a[_0x977ffc];return _0x5e47ac;};'use strict';var multer=require(_0xab19('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xab19('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab19('0x2'));var auth=require(_0xab19('0x3'));var interaction=require(_0xab19('0x4'));var config=require(_0xab19('0x5'));module[_0xab19('0x6')]=router; \ No newline at end of file +var _0x135b=['fs-extra','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','Router'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x135b,0xaf));var _0xb135=function(_0x5903c9,_0x406773){_0x5903c9=_0x5903c9-0x0;var _0x40c65c=_0x135b[_0x5903c9];return _0x40c65c;};'use strict';var multer=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var path=require(_0xb135('0x2'));var timeout=require(_0xb135('0x3'));var express=require('express');var router=express[_0xb135('0x4')]();var fs_extra=require(_0xb135('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb135('0x6'));var config=require(_0xb135('0x7'));module[_0xb135('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 40c03df..a8deb90 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(_0x3b2b44,_0xd51143){var _0x417e54=function(_0x1681c3){while(--_0x1681c3){_0x3b2b44['push'](_0x3b2b44['shift']());}};_0x417e54(++_0xd51143);}(_0xe706,0xa3));var _0x6e70=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0xe706[_0x202d24];return _0x2b3a8e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x102411,_0x2c0b2b){var _0x2c904e=function(_0x47276b){while(--_0x47276b){_0x102411['push'](_0x102411['shift']());}};_0x2c904e(++_0x2c0b2b);}(_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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index b10dd9d..753f8c9 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 _0x6f12=['define','UserChatQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x5a0d3f,_0x8df074){var _0x27e94f=function(_0x4f7c89){while(--_0x4f7c89){_0x5a0d3f['push'](_0x5a0d3f['shift']());}};_0x27e94f(++_0x8df074);}(_0x6f12,0x86));var _0x26f1=function(_0x23a4bc,_0x32deba){_0x23a4bc=_0x23a4bc-0x0;var _0x2a450e=_0x6f12[_0x23a4bc];return _0x2a450e;};'use strict';var _=require(_0x26f1('0x0'));var util=require('util');var logger=require(_0x26f1('0x1'))(_0x26f1('0x2'));var moment=require(_0x26f1('0x3'));var BPromise=require(_0x26f1('0x4'));var rp=require(_0x26f1('0x5'));var fs=require('fs');var path=require(_0x26f1('0x6'));var rimraf=require(_0x26f1('0x7'));var config=require(_0x26f1('0x8'));var attributes=require(_0x26f1('0x9'));module['exports']=function(_0x2fff69,_0x484e24){return _0x2fff69[_0x26f1('0xa')](_0x26f1('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f28=['api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x5f28,0xf9));var _0x85f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x85f2('0x0'));var util=require(_0x85f2('0x1'));var logger=require(_0x85f2('0x2'))(_0x85f2('0x3'));var moment=require(_0x85f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x85f2('0x5'));var fs=require('fs');var path=require(_0x85f2('0x6'));var rimraf=require(_0x85f2('0x7'));var config=require(_0x85f2('0x8'));var attributes=require(_0x85f2('0x9'));module[_0x85f2('0xa')]=function(_0x50485c,_0x48c67b){return _0x50485c[_0x85f2('0xb')](_0x85f2('0xc'),attributes,{'tableName':_0x85f2('0xd'),'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 0a19707..a6afa3d 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 _0x1477=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result'];(function(_0x4fe1a8,_0x255cd9){var _0x81662f=function(_0x2bf4ec){while(--_0x2bf4ec){_0x4fe1a8['push'](_0x4fe1a8['shift']());}};_0x81662f(++_0x255cd9);}(_0x1477,0x105));var _0x7147=function(_0x129599,_0x25a15a){_0x129599=_0x129599-0x0;var _0x3b7083=_0x1477[_0x129599];return _0x3b7083;};'use strict';var _=require(_0x7147('0x0'));var util=require(_0x7147('0x1'));var moment=require(_0x7147('0x2'));var BPromise=require('bluebird');var rs=require(_0x7147('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7147('0x4'))['db'];var utils=require(_0x7147('0x5'));var logger=require(_0x7147('0x6'))('rpc');var config=require(_0x7147('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7147('0x8')][_0x7147('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x669a30,_0x22a985,_0x3feaeb){return new BPromise(function(_0x4b46a3,_0x3c6b42){return client[_0x7147('0xa')](_0x669a30,_0x3feaeb)['then'](function(_0x83b56b){logger['info'](_0x7147('0xb'),_0x22a985,'request\x20sent');logger[_0x7147('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x22a985,_0x7147('0xd'),JSON['stringify'](_0x83b56b));if(_0x83b56b[_0x7147('0xe')]){if(_0x83b56b[_0x7147('0xe')][_0x7147('0xf')]===0x1f4){logger['error'](_0x7147('0xb'),_0x22a985,_0x83b56b['error'][_0x7147('0x10')]);return _0x3c6b42(_0x83b56b[_0x7147('0xe')]['message']);}logger[_0x7147('0xe')](_0x7147('0xb'),_0x22a985,_0x83b56b['error'][_0x7147('0x10')]);return _0x4b46a3(_0x83b56b[_0x7147('0xe')][_0x7147('0x10')]);}else{logger[_0x7147('0x11')](_0x7147('0xb'),_0x22a985,'request\x20sent');_0x4b46a3(_0x83b56b[_0x7147('0x12')]['message']);}})[_0x7147('0x13')](function(_0x5b2528){logger[_0x7147('0xe')](_0x7147('0xb'),_0x22a985,_0x5b2528);_0x3c6b42(_0x5b2528);});});} \ No newline at end of file +var _0xab85=['info','request\x20sent','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserChatQueue,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xab85,0x11c));var _0x5ab8=function(_0x5284b6,_0x27317a){_0x5284b6=_0x5284b6-0x0;var _0x43da6e=_0xab85[_0x5284b6];return _0x43da6e;};'use strict';var _=require('lodash');var util=require(_0x5ab8('0x0'));var moment=require(_0x5ab8('0x1'));var BPromise=require('bluebird');var rs=require(_0x5ab8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ab8('0x3'))['db'];var utils=require(_0x5ab8('0x4'));var logger=require(_0x5ab8('0x5'))('rpc');var config=require(_0x5ab8('0x6'));var jayson=require(_0x5ab8('0x7'));var client=jayson[_0x5ab8('0x8')][_0x5ab8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15c916,_0x5b6430,_0x43a523){return new BPromise(function(_0x3a009a,_0x1535e3){return client['request'](_0x15c916,_0x43a523)[_0x5ab8('0xa')](function(_0xfbe400){logger['info'](_0x5ab8('0xb'),_0x5b6430,'request\x20sent');logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5b6430,'request\x20sent',JSON[_0x5ab8('0xc')](_0xfbe400));if(_0xfbe400[_0x5ab8('0xd')]){if(_0xfbe400[_0x5ab8('0xd')][_0x5ab8('0xe')]===0x1f4){logger[_0x5ab8('0xd')](_0x5ab8('0xb'),_0x5b6430,_0xfbe400[_0x5ab8('0xd')][_0x5ab8('0xf')]);return _0x1535e3(_0xfbe400[_0x5ab8('0xd')][_0x5ab8('0xf')]);}logger[_0x5ab8('0xd')](_0x5ab8('0xb'),_0x5b6430,_0xfbe400[_0x5ab8('0xd')][_0x5ab8('0xf')]);return _0x3a009a(_0xfbe400['error'][_0x5ab8('0xf')]);}else{logger[_0x5ab8('0x10')](_0x5ab8('0xb'),_0x5b6430,_0x5ab8('0x11'));_0x3a009a(_0xfbe400[_0x5ab8('0x12')]['message']);}})[_0x5ab8('0x13')](function(_0x39a872){logger[_0x5ab8('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x5b6430,_0x39a872);_0x1535e3(_0x39a872);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index e0e6882..a895b04 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 _0x3266=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout'];(function(_0x417de2,_0x195a20){var _0x3881f9=function(_0xd7334f){while(--_0xd7334f){_0x417de2['push'](_0x417de2['shift']());}};_0x3881f9(++_0x195a20);}(_0x3266,0x6a));var _0x6326=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3266[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');module[_0x6326('0x9')]=router; \ No newline at end of file +var _0x07a2=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x18397d,_0x4a99a0){var _0x2fdf64=function(_0x2859d2){while(--_0x2859d2){_0x18397d['push'](_0x18397d['shift']());}};_0x2fdf64(++_0x4a99a0);}(_0x07a2,0x12c));var _0x207a=function(_0x4ad37c,_0x2e7490){_0x4ad37c=_0x4ad37c-0x0;var _0x288919=_0x07a2[_0x4ad37c];return _0x288919;};'use strict';var multer=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var path=require('path');var timeout=require(_0x207a('0x2'));var express=require(_0x207a('0x3'));var router=express[_0x207a('0x4')]();var fs_extra=require(_0x207a('0x5'));var auth=require(_0x207a('0x6'));var interaction=require(_0x207a('0x7'));var config=require(_0x207a('0x8'));module[_0x207a('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b088fac..693504a 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 _0x8f4c=['exports','INTEGER','STRING','sequelize'];(function(_0x364183,_0x110919){var _0x50ad86=function(_0x41d90f){while(--_0x41d90f){_0x364183['push'](_0x364183['shift']());}};_0x50ad86(++_0x110919);}(_0x8f4c,0x113));var _0xc8f4=function(_0x590a0c,_0xab1f66){_0x590a0c=_0x590a0c-0x0;var _0x32add4=_0x8f4c[_0x590a0c];return _0x32add4;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'penalty':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc8f4('0x3')]}}; \ No newline at end of file +var _0x4fc2=['sequelize','exports','INTEGER'];(function(_0x1f9dac,_0x2c3def){var _0x30bd64=function(_0x1a90f4){while(--_0x1a90f4){_0x1f9dac['push'](_0x1f9dac['shift']());}};_0x30bd64(++_0x2c3def);}(_0x4fc2,0x111));var _0x24fc=function(_0x341a15,_0xaa08f7){_0x341a15=_0x341a15-0x0;var _0x5d1bd0=_0x4fc2[_0x341a15];return _0x5d1bd0;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'penalty':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 484f162..84357df 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 _0xe651=['UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xe651,0x1a5));var _0x1e65=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0xe651[_0x1bf8cc];return _0x322d20;};'use strict';var _=require(_0x1e65('0x0'));var util=require(_0x1e65('0x1'));var logger=require(_0x1e65('0x2'))(_0x1e65('0x3'));var moment=require(_0x1e65('0x4'));var BPromise=require(_0x1e65('0x5'));var rp=require(_0x1e65('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e65('0x7'));var config=require(_0x1e65('0x8'));var attributes=require(_0x1e65('0x9'));module[_0x1e65('0xa')]=function(_0x3d4fd5,_0x517358){return _0x3d4fd5['define'](_0x1e65('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0773=['./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x397d88,_0x3e6288){var _0x2aa147=function(_0x15426e){while(--_0x15426e){_0x397d88['push'](_0x397d88['shift']());}};_0x2aa147(++_0x3e6288);}(_0x0773,0xf6));var _0x3077=function(_0x4bb973,_0x630fd4){_0x4bb973=_0x4bb973-0x0;var _0x225124=_0x0773[_0x4bb973];return _0x225124;};'use strict';var _=require(_0x3077('0x0'));var util=require(_0x3077('0x1'));var logger=require('../../config/logger')(_0x3077('0x2'));var moment=require(_0x3077('0x3'));var BPromise=require(_0x3077('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3077('0x5'));var rimraf=require(_0x3077('0x6'));var config=require('../../config/environment');var attributes=require(_0x3077('0x7'));module[_0x3077('0x8')]=function(_0x23a811,_0x121f14){return _0x23a811['define'](_0x3077('0x9'),attributes,{'tableName':_0x3077('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index c67845f..acfd7bb 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 _0x757e=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x1605c2,_0x3f9dfb){var _0x463da1=function(_0x4dca97){while(--_0x4dca97){_0x1605c2['push'](_0x1605c2['shift']());}};_0x463da1(++_0x3f9dfb);}(_0x757e,0xf8));var _0xe757=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x757e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe757('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe757('0x1'));var rs=require(_0xe757('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe757('0x3'))['db'];var utils=require(_0xe757('0x4'));var logger=require(_0xe757('0x5'))('rpc');var config=require(_0xe757('0x6'));var jayson=require(_0xe757('0x7'));var client=jayson['client'][_0xe757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1358dc,_0x348ebe,_0x341cda){return new BPromise(function(_0x2fe009,_0x3ea5d6){return client['request'](_0x1358dc,_0x341cda)[_0xe757('0x9')](function(_0xb104bb){logger[_0xe757('0xa')](_0xe757('0xb'),_0x348ebe,_0xe757('0xc'));logger[_0xe757('0xd')](_0xe757('0xe'),_0x348ebe,_0xe757('0xc'),JSON[_0xe757('0xf')](_0xb104bb));if(_0xb104bb[_0xe757('0x10')]){if(_0xb104bb[_0xe757('0x10')]['code']===0x1f4){logger[_0xe757('0x10')](_0xe757('0xb'),_0x348ebe,_0xb104bb['error']['message']);return _0x3ea5d6(_0xb104bb['error']['message']);}logger[_0xe757('0x10')](_0xe757('0xb'),_0x348ebe,_0xb104bb['error']['message']);return _0x2fe009(_0xb104bb[_0xe757('0x10')][_0xe757('0x11')]);}else{logger[_0xe757('0xa')](_0xe757('0xb'),_0x348ebe,_0xe757('0xc'));_0x2fe009(_0xb104bb[_0xe757('0x12')][_0xe757('0x11')]);}})[_0xe757('0x13')](function(_0x1bc3d8){logger[_0xe757('0x10')](_0xe757('0xb'),_0x348ebe,_0x1bc3d8);_0x3ea5d6(_0x1bc3d8);});});} \ No newline at end of file +var _0xafa7=['error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0xafa7,0x122));var _0x7afa=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xafa7[_0xd02bb];return _0x1cdf23;};'use strict';var _=require(_0x7afa('0x0'));var util=require(_0x7afa('0x1'));var moment=require('moment');var BPromise=require(_0x7afa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7afa('0x3'));var db=require(_0x7afa('0x4'))['db'];var utils=require(_0x7afa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7afa('0x6'));var jayson=require(_0x7afa('0x7'));var client=jayson[_0x7afa('0x8')][_0x7afa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2243f6,_0x2b826f,_0x59c1f0){return new BPromise(function(_0xde102c,_0x225de7){return client[_0x7afa('0xa')](_0x2243f6,_0x59c1f0)[_0x7afa('0xb')](function(_0x40bff1){logger[_0x7afa('0xc')](_0x7afa('0xd'),_0x2b826f,'request\x20sent');logger[_0x7afa('0xe')](_0x7afa('0xf'),_0x2b826f,_0x7afa('0x10'),JSON[_0x7afa('0x11')](_0x40bff1));if(_0x40bff1[_0x7afa('0x12')]){if(_0x40bff1[_0x7afa('0x12')][_0x7afa('0x13')]===0x1f4){logger[_0x7afa('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x2b826f,_0x40bff1['error']['message']);return _0x225de7(_0x40bff1[_0x7afa('0x12')][_0x7afa('0x14')]);}logger[_0x7afa('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x2b826f,_0x40bff1[_0x7afa('0x12')][_0x7afa('0x14')]);return _0xde102c(_0x40bff1[_0x7afa('0x12')]['message']);}else{logger['info'](_0x7afa('0xd'),_0x2b826f,'request\x20sent');_0xde102c(_0x40bff1[_0x7afa('0x15')]['message']);}})['catch'](function(_0xc6fd10){logger[_0x7afa('0x12')](_0x7afa('0xd'),_0x2b826f,_0xc6fd10);_0x225de7(_0xc6fd10);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 515da7a..13b2625 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 _0x8ba6=['fs-extra','../../components/auth/service','exports','multer','path','express','Router'];(function(_0x49ce11,_0x751697){var _0x1c51f6=function(_0x28fa8c){while(--_0x28fa8c){_0x49ce11['push'](_0x49ce11['shift']());}};_0x1c51f6(++_0x751697);}(_0x8ba6,0x11b));var _0x68ba=function(_0x9ae1c,_0x4cb0cd){_0x9ae1c=_0x9ae1c-0x0;var _0x1c560a=_0x8ba6[_0x9ae1c];return _0x1c560a;};'use strict';var multer=require(_0x68ba('0x0'));var util=require('util');var path=require(_0x68ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x68ba('0x2'));var router=express[_0x68ba('0x3')]();var fs_extra=require(_0x68ba('0x4'));var auth=require(_0x68ba('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x68ba('0x6')]=router; \ No newline at end of file +var _0x6582=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x532634,_0x1963fa){var _0x4bc53f=function(_0x556801){while(--_0x556801){_0x532634['push'](_0x532634['shift']());}};_0x4bc53f(++_0x1963fa);}(_0x6582,0x108));var _0x2658=function(_0x435ba5,_0x55875f){_0x435ba5=_0x435ba5-0x0;var _0x5af51d=_0x6582[_0x435ba5];return _0x5af51d;};'use strict';var multer=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var path=require(_0x2658('0x2'));var timeout=require(_0x2658('0x3'));var express=require(_0x2658('0x4'));var router=express['Router']();var fs_extra=require(_0x2658('0x5'));var auth=require(_0x2658('0x6'));var interaction=require(_0x2658('0x7'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 798c2c0..91a24d2 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(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x264498,_0x5621a0){var _0x9392a5=function(_0x7ed3a2){while(--_0x7ed3a2){_0x264498['push'](_0x264498['shift']());}};_0x9392a5(++_0x5621a0);}(_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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index c550a8e..8295883 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x27d1e1,_0x3cea80){var _0xb3a85f=function(_0x10c70f){while(--_0x10c70f){_0x27d1e1['push'](_0x27d1e1['shift']());}};_0xb3a85f(++_0x3cea80);}(_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 logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0x2821a8,_0x25d9de){var _0x547b3d=function(_0x1812a3){while(--_0x1812a3){_0x2821a8['push'](_0x2821a8['shift']());}};_0x547b3d(++_0x25d9de);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 961b1e0..f13cf83 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 _0xe14a=['../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3c7931,_0x2f91a7){var _0x425a27=function(_0x47ad49){while(--_0x47ad49){_0x3c7931['push'](_0x3c7931['shift']());}};_0x425a27(++_0x2f91a7);}(_0xe14a,0x94));var _0xae14=function(_0x16877c,_0x5db31c){_0x16877c=_0x16877c-0x0;var _0x5a93ef=_0xe14a[_0x16877c];return _0x5a93ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae14('0x0'));var db=require(_0xae14('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xae14('0x2'))(_0xae14('0x3'));var config=require(_0xae14('0x4'));var jayson=require(_0xae14('0x5'));var client=jayson[_0xae14('0x6')][_0xae14('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbdeb24,_0x1aef6a,_0x19d9b8){return new BPromise(function(_0x1efd2c,_0x103029){return client[_0xae14('0x8')](_0xbdeb24,_0x19d9b8)[_0xae14('0x9')](function(_0x53f6f5){logger['info'](_0xae14('0xa'),_0x1aef6a,_0xae14('0xb'));logger[_0xae14('0xc')](_0xae14('0xd'),_0x1aef6a,_0xae14('0xb'),JSON['stringify'](_0x53f6f5));if(_0x53f6f5['error']){if(_0x53f6f5[_0xae14('0xe')][_0xae14('0xf')]===0x1f4){logger[_0xae14('0xe')](_0xae14('0xa'),_0x1aef6a,_0x53f6f5[_0xae14('0xe')][_0xae14('0x10')]);return _0x103029(_0x53f6f5[_0xae14('0xe')][_0xae14('0x10')]);}logger[_0xae14('0xe')](_0xae14('0xa'),_0x1aef6a,_0x53f6f5['error'][_0xae14('0x10')]);return _0x1efd2c(_0x53f6f5[_0xae14('0xe')]['message']);}else{logger[_0xae14('0x11')](_0xae14('0xa'),_0x1aef6a,_0xae14('0xb'));_0x1efd2c(_0x53f6f5[_0xae14('0x12')][_0xae14('0x10')]);}})['catch'](function(_0x5c7cf7){logger[_0xae14('0xe')](_0xae14('0xa'),_0x1aef6a,_0x5c7cf7);_0x103029(_0x5c7cf7);});});} \ No newline at end of file +var _0x3c6c=['jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4cc48c,_0xb2a9c0){var _0x25665e=function(_0x5647ec){while(--_0x5647ec){_0x4cc48c['push'](_0x4cc48c['shift']());}};_0x25665e(++_0xb2a9c0);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x54f402,_0x1b72f7){_0x54f402=_0x54f402-0x0;var _0xda93c8=_0x3c6c[_0x54f402];return _0xda93c8;};'use strict';var _=require(_0xc3c6('0x0'));var util=require('util');var moment=require(_0xc3c6('0x1'));var BPromise=require(_0xc3c6('0x2'));var rs=require(_0xc3c6('0x3'));var fs=require('fs');var Redis=require(_0xc3c6('0x4'));var db=require(_0xc3c6('0x5'))['db'];var utils=require(_0xc3c6('0x6'));var logger=require(_0xc3c6('0x7'))(_0xc3c6('0x8'));var config=require('../../config/environment');var jayson=require(_0xc3c6('0x9'));var client=jayson['client'][_0xc3c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d7ae6,_0x50cd05,_0x4aed87){return new BPromise(function(_0x5185c3,_0x4f39dd){return client[_0xc3c6('0xb')](_0x4d7ae6,_0x4aed87)[_0xc3c6('0xc')](function(_0x5bc1c1){logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x50cd05,_0xc3c6('0xf'));logger[_0xc3c6('0x10')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x50cd05,_0xc3c6('0xf'),JSON[_0xc3c6('0x11')](_0x5bc1c1));if(_0x5bc1c1[_0xc3c6('0x12')]){if(_0x5bc1c1['error']['code']===0x1f4){logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);return _0x4f39dd(_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);}logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);return _0x5185c3(_0x5bc1c1[_0xc3c6('0x12')][_0xc3c6('0x13')]);}else{logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x50cd05,_0xc3c6('0xf'));_0x5185c3(_0x5bc1c1[_0xc3c6('0x14')][_0xc3c6('0x13')]);}})[_0xc3c6('0x15')](function(_0x33920c){logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x50cd05,_0x33920c);_0x4f39dd(_0x33920c);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 1cfa354..d4a5a9a 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9fd=['../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xc9fd,0x10a));var _0xdc9f=function(_0x48d4ac,_0x527859){_0x48d4ac=_0x48d4ac-0x0;var _0x386658=_0xc9fd[_0x48d4ac];return _0x386658;};'use strict';var multer=require(_0xdc9f('0x0'));var util=require(_0xdc9f('0x1'));var path=require(_0xdc9f('0x2'));var timeout=require(_0xdc9f('0x3'));var express=require('express');var router=express[_0xdc9f('0x4')]();var fs_extra=require(_0xdc9f('0x5'));var auth=require(_0xdc9f('0x6'));var interaction=require(_0xdc9f('0x7'));var config=require(_0xdc9f('0x8'));var controller=require(_0xdc9f('0x9'));router['post']('/',auth[_0xdc9f('0xa')](),controller[_0xdc9f('0xb')]);module[_0xdc9f('0xc')]=router; \ No newline at end of file +var _0x6119=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x6119,0x1cf));var _0x9611=function(_0x2277b7,_0x5abe99){_0x2277b7=_0x2277b7-0x0;var _0x60d2ce=_0x6119[_0x2277b7];return _0x60d2ce;};'use strict';var multer=require(_0x9611('0x0'));var util=require(_0x9611('0x1'));var path=require('path');var timeout=require(_0x9611('0x2'));var express=require('express');var router=express[_0x9611('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9611('0x4'));var interaction=require(_0x9611('0x5'));var config=require(_0x9611('0x6'));var controller=require(_0x9611('0x7'));router[_0x9611('0x8')]('/',auth[_0x9611('0x9')](),controller[_0x9611('0xa')]);module[_0x9611('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 2145b50..e4936c9 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x729a=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x729a,0x9a));var _0xa729=function(_0x3e0e65,_0x476a7c){_0x3e0e65=_0x3e0e65-0x0;var _0x4cdfc8=_0x729a[_0x3e0e65];return _0x4cdfc8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xa729('0x0')]},'senderName':{'type':Sequelize[_0xa729('0x1')]},'recipientsId':{'type':Sequelize[_0xa729('0x0')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xbac5=['TEXT','BOOLEAN','sequelize','exports','STRING'];(function(_0x32722b,_0x45bba0){var _0x457837=function(_0x1a2064){while(--_0x1a2064){_0x32722b['push'](_0x32722b['shift']());}};_0x457837(++_0x45bba0);}(_0xbac5,0x106));var _0x5bac=function(_0x3e29df,_0x42fdf8){_0x3e29df=_0x3e29df-0x0;var _0x3e3ba9=_0xbac5[_0x3e29df];return _0x3e3ba9;};'use strict';var Sequelize=require(_0x5bac('0x0'));module[_0x5bac('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5bac('0x2')]},'recipientsId':{'type':Sequelize[_0x5bac('0x3')]},'recipientsDescription':{'type':Sequelize[_0x5bac('0x2')]},'beep':{'type':Sequelize[_0x5bac('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 0bc280f..38d1895 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x210e=['startCase','model','User','union','ids','queue','Queue','push','flatten','getAgents','map','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','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userNotification.socket','register','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','sendUserNotification','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','whatsappqueue','team','user','some','includes','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render'];(function(_0x2d7d07,_0x23a983){var _0x458d6e=function(_0x3512f0){while(--_0x3512f0){_0x2d7d07['push'](_0x2d7d07['shift']());}};_0x458d6e(++_0x23a983);}(_0x210e,0x6e));var _0xe210=function(_0x59684c,_0x4f23bd){_0x59684c=_0x59684c-0x0;var _0x6e9beb=_0x210e[_0x59684c];return _0x6e9beb;};'use strict';var pdf=require(_0xe210('0x0'));var emlformat=require(_0xe210('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe210('0x2'));var jsonpatch=require(_0xe210('0x3'));var rp=require(_0xe210('0x4'));var moment=require('moment');var BPromise=require(_0xe210('0x5'));var Mustache=require(_0xe210('0x6'));var util=require('util');var path=require(_0xe210('0x7'));var sox=require(_0xe210('0x8'));var csv=require(_0xe210('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe210('0xa'));var squel=require(_0xe210('0xb'));var crypto=require(_0xe210('0xc'));var jsforce=require(_0xe210('0xd'));var deskjs=require(_0xe210('0xe'));var toCsv=require(_0xe210('0x9'));var querystring=require(_0xe210('0xf'));var Papa=require(_0xe210('0x10'));var Redis=require('ioredis');var authService=require(_0xe210('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe210('0x12'));var logger=require(_0xe210('0x13'))(_0xe210('0x14'));var utils=require(_0xe210('0x15'));var config=require(_0xe210('0x16'));var licenseUtil=require(_0xe210('0x17'));var db=require('../../mysqldb')['db'];config[_0xe210('0x18')]=_[_0xe210('0x19')](config[_0xe210('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe210('0x1a'))(new Redis(config['redis']));require(_0xe210('0x1b'))[_0xe210('0x1c')](socket);function respondWithStatusCode(_0x2a0f84,_0x3c1f61){_0x3c1f61=_0x3c1f61||0xcc;return function(_0x183f5a){if(_0x183f5a){return _0x2a0f84['sendStatus'](_0x3c1f61);}return _0x2a0f84['status'](_0x3c1f61)[_0xe210('0x1d')]();};}function respondWithResult(_0x545cce,_0x6d4be9){_0x6d4be9=_0x6d4be9||0xc8;return function(_0x4af1b7){if(_0x4af1b7){return _0x545cce[_0xe210('0x1e')](_0x6d4be9)[_0xe210('0x1f')](_0x4af1b7);}};}function respondWithFilteredResult(_0x189f8b,_0x41b297){return function(_0x40e8d9){if(_0x40e8d9){var _0x31ab4d=_0x40e8d9['count'],_0xdd5d9c=_0x41b297[_0xe210('0x20')],_0x3043a6=_0x41b297['offset']+_0x41b297[_0xe210('0x21')],_0x588bce;if(_0x3043a6>=_0x31ab4d){_0x3043a6=_0x31ab4d;_0x588bce=0xc8;}else{_0x588bce=0xce;}_0x189f8b[_0xe210('0x1e')](_0x588bce);return _0x189f8b[_0xe210('0x22')](_0xe210('0x23'),_0xdd5d9c+'-'+_0x3043a6+'/'+_0x31ab4d)['json'](_0x40e8d9);}return null;};}function patchUpdates(_0xdd79b6){return function(_0x263236){try{jsonpatch[_0xe210('0x24')](_0x263236,_0xdd79b6,!![]);}catch(_0x6325c8){return BPromise['reject'](_0x6325c8);}return _0x263236[_0xe210('0x25')]();};}function saveUpdates(_0x16ee97,_0x63d83f){return function(_0x26eba0){if(_0x26eba0){return _0x26eba0[_0xe210('0x26')](_0x16ee97)[_0xe210('0x27')](function(_0xbc9092){return _0xbc9092;});}return null;};}function removeEntity(_0x71a34,_0x59092f){return function(_0x14b7bf){if(_0x14b7bf){return _0x14b7bf[_0xe210('0x28')]()[_0xe210('0x27')](function(){_0x71a34['status'](0xcc)[_0xe210('0x1d')]();});}};}function handleEntityNotFound(_0x561866,_0x59f944){return function(_0x58aa56){if(!_0x58aa56){_0x561866[_0xe210('0x29')](0x194);}return _0x58aa56;};}function handleError(_0x434ae0,_0x5760c6){_0x5760c6=_0x5760c6||0x1f4;return function(_0x5ca6d4){logger[_0xe210('0x2a')](_0x5ca6d4['stack']);if(_0x5ca6d4[_0xe210('0x2b')]){delete _0x5ca6d4[_0xe210('0x2b')];}_0x434ae0[_0xe210('0x1e')](_0x5760c6)[_0xe210('0x2c')](_0x5ca6d4);};}exports[_0xe210('0x2d')]=function(_0x38ca0e,_0x4a71e4,_0x2ef5a2){if(!_0x38ca0e['body'][_0xe210('0x2e')](_0xe210('0x2f'))&&!_0x38ca0e['body'][_0xe210('0x2e')](_0xe210('0x30'))){throw new db[(_0xe210('0x31'))][(_0xe210('0x32'))](_0xe210('0x33'));}else{if(_0x38ca0e[_0xe210('0x34')][_0xe210('0x2e')]('TemplateId')&&!_0x38ca0e['body']['hasOwnProperty'](_0xe210('0x35'))){throw new db[(_0xe210('0x31'))][(_0xe210('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x38ca0e[_0xe210('0x34')][_0xe210('0x2e')](_0xe210('0x36'))){throw new db[(_0xe210('0x31'))][(_0xe210('0x32'))](_0xe210('0x37'));}else{try{var _0x5589f1=JSON[_0xe210('0x38')](_0x38ca0e['body'][_0xe210('0x36')]);}catch(_0x2fe7b4){logger[_0xe210('0x2a')](_0x2fe7b4);throw new db[(_0xe210('0x31'))][(_0xe210('0x32'))](_0xe210('0x39'));}var _0x18915b=[_0xe210('0x3a'),'faxqueue',_0xe210('0x3b'),'openchannelqueue','smsqueue','voicequeue',_0xe210('0x3c'),_0xe210('0x3d'),_0xe210('0x3e')];if(_[_0xe210('0x3f')](_0x5589f1,function(_0x5d2c7c){return!_[_0xe210('0x40')](_0x18915b,_0x5d2c7c['model'][_0xe210('0x41')]());})){throw new db[(_0xe210('0x31'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x1bb439={};_0x1bb439[_0xe210('0x42')]=_0x38ca0e[_0xe210('0x34')][_0xe210('0x2e')](_0xe210('0x42'))?_0x38ca0e['body'][_0xe210('0x42')]:_0x38ca0e[_0xe210('0x3e')][_0xe210('0x43')];_0x1bb439[_0xe210('0x44')]=_[_0xe210('0x45')](_0x38ca0e['body'][_0xe210('0x44')])?null:_0x38ca0e[_0xe210('0x34')]['recipientsDescription'];_0x1bb439[_0xe210('0x46')]=_0x38ca0e['body'][_0xe210('0x46')]||![];_0x1bb439[_0xe210('0x47')]=_0x38ca0e['user']['id'];return getContent(_0x38ca0e['body'])[_0xe210('0x27')](function(_0x49e5a6){_0x1bb439[_0xe210('0x34')]=_0x49e5a6;return getRecipients(_0x5589f1);})[_0xe210('0x27')](function(_0x3adfb3){_0x1bb439[_0xe210('0x48')]=_[_0xe210('0x49')](_0x3adfb3)[_0xe210('0x4a')](',');return db[_0xe210('0x4b')][_0xe210('0x4c')](function(_0x397cd1){return db[_0xe210('0x4d')]['create'](_0x1bb439,{'raw':!![],'transaction':_0x397cd1})[_0xe210('0x27')](function(_0x38dc9e){var _0x181d56={'sender':_0x1bb439[_0xe210('0x42')],'description':_0x1bb439[_0xe210('0x44')],'content':_0x1bb439[_0xe210('0x34')],'beep':_0x1bb439['beep']};_0x3adfb3[_0xe210('0x4e')](function(_0x1640c9){_0x181d56[_0xe210('0x4f')]=_0x1640c9;socket[_0xe210('0x50')](_0xe210('0x51'),_0x181d56);});return _0x38dc9e;});});})['then'](respondWithResult(_0x4a71e4,0xc9))[_0xe210('0x52')](handleError(_0x4a71e4,null));};function getContent(_0x3b6652){return new BPromise(function(_0x5a7141,_0x1c82b4){if(_0x3b6652[_0xe210('0x2f')]){_0x5a7141(_0x3b6652['text']);return;}return db[_0xe210('0x53')][_0xe210('0x54')]({'attributes':[_0xe210('0x55')],'where':{'id':_0x3b6652[_0xe210('0x30')]},'raw':!![]})[_0xe210('0x27')](function(_0x1d4435){if(!_0x1d4435)throw new db[(_0xe210('0x31'))][(_0xe210('0x32'))](_0xe210('0x56'));var _0x5bb07b=Mustache[_0xe210('0x57')](_0x1d4435[_0xe210('0x55')],_0x3b6652[_0xe210('0x35')]);_0x5a7141(_0x5bb07b);})[_0xe210('0x52')](function(_0x50fe0d){_0x1c82b4(_0x50fe0d);});});}function getRecipients(_0x7bde86){return new BPromise(function(_0x61d81f,_0xc6c0e5){var _0x7b284e=[];var _0x1abd01=[];_0x7bde86[_0xe210('0x4e')](function(_0x1aa852){var _0x2cb0cb=_[_0xe210('0x58')](_0x1aa852[_0xe210('0x59')]['toLowerCase']());if(_0x2cb0cb===_0xe210('0x5a')){_0x7b284e=_[_0xe210('0x5b')](_0x7b284e,_0x1aa852[_0xe210('0x5c')]);}else{if(_[_0xe210('0x40')](_0x2cb0cb,_0xe210('0x5d')))_0x2cb0cb=_0x2cb0cb['replace'](_0xe210('0x5d'),_0xe210('0x5e'));_0x1aa852[_0xe210('0x5c')][_0xe210('0x4e')](function(_0x26ea5b){_0x1abd01[_0xe210('0x5f')](getAgents(_0x2cb0cb,_0x26ea5b));});}});return BPromise['all'](_0x1abd01)[_0xe210('0x27')](function(_0x4514e8){_0x7b284e=_[_0xe210('0x5b')](_0x7b284e,_[_0xe210('0x60')](_0x4514e8));_0x61d81f(_0x7b284e);})['catch'](function(_0x4431c6){_0xc6c0e5(_0x4431c6);});});}function getAgents(_0x927f25,_0x420e8f){return new BPromise(function(_0x28646b,_0x5b66ad){return db[_0x927f25]['findOne']({'where':{'id':_0x420e8f}})[_0xe210('0x27')](function(_0x12a2f2){return _0x12a2f2[_0xe210('0x61')]({'attributes':['id'],'raw':!![]})[_0xe210('0x27')](function(_0x328178){var _0x2f0c64=_[_0xe210('0x62')](_0x328178,'id');_0x28646b(_0x2f0c64);});})[_0xe210('0x52')](function(_0x995032){_0x5b66ad(_0x995032);});});} \ No newline at end of file +var _0x3426=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','sendUserNotification','body','text','TemplateId','Sequelize','hasOwnProperty','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','openchannelqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','forEach','recipient','emit','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase','ids','queue','Queue','push','union','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xa7d93e,_0x348116){var _0x25de53=function(_0x498ac9){while(--_0x498ac9){_0xa7d93e['push'](_0xa7d93e['shift']());}};_0x25de53(++_0x348116);}(_0x3426,0x1c6));var _0x6342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3426[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6342('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6342('0x1'));var zipdir=require(_0x6342('0x2'));var jsonpatch=require(_0x6342('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6342('0x4'));var Mustache=require(_0x6342('0x5'));var util=require(_0x6342('0x6'));var path=require(_0x6342('0x7'));var sox=require(_0x6342('0x8'));var csv=require(_0x6342('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6342('0xa'));var _=require(_0x6342('0xb'));var squel=require(_0x6342('0xc'));var crypto=require(_0x6342('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6342('0xe'));var toCsv=require(_0x6342('0x9'));var querystring=require(_0x6342('0xf'));var Papa=require('papaparse');var Redis=require(_0x6342('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6342('0x11'));var as=require(_0x6342('0x12'));var hardwareService=require(_0x6342('0x13'));var logger=require(_0x6342('0x14'))(_0x6342('0x15'));var utils=require(_0x6342('0x16'));var config=require(_0x6342('0x17'));var licenseUtil=require(_0x6342('0x18'));var db=require(_0x6342('0x19'))['db'];config['redis']=_[_0x6342('0x1a')](config[_0x6342('0x1b')],{'host':_0x6342('0x1c'),'port':0x18eb});var socket=require(_0x6342('0x1d'))(new Redis(config[_0x6342('0x1b')]));require(_0x6342('0x1e'))[_0x6342('0x1f')](socket);function respondWithStatusCode(_0x4d0611,_0x4b83d2){_0x4b83d2=_0x4b83d2||0xcc;return function(_0x5b6fa4){if(_0x5b6fa4){return _0x4d0611[_0x6342('0x20')](_0x4b83d2);}return _0x4d0611[_0x6342('0x21')](_0x4b83d2)[_0x6342('0x22')]();};}function respondWithResult(_0x49eacb,_0x375882){_0x375882=_0x375882||0xc8;return function(_0x17c0dc){if(_0x17c0dc){return _0x49eacb[_0x6342('0x21')](_0x375882)[_0x6342('0x23')](_0x17c0dc);}};}function respondWithFilteredResult(_0x36d5b3,_0x560464){return function(_0x49f0b9){if(_0x49f0b9){var _0x2e8815=_0x49f0b9[_0x6342('0x24')],_0x114ab6=_0x560464[_0x6342('0x25')],_0x1565e8=_0x560464[_0x6342('0x25')]+_0x560464['limit'],_0x117281;if(_0x1565e8>=_0x2e8815){_0x1565e8=_0x2e8815;_0x117281=0xc8;}else{_0x117281=0xce;}_0x36d5b3[_0x6342('0x21')](_0x117281);return _0x36d5b3[_0x6342('0x26')](_0x6342('0x27'),_0x114ab6+'-'+_0x1565e8+'/'+_0x2e8815)[_0x6342('0x23')](_0x49f0b9);}return null;};}function patchUpdates(_0x4c89dd){return function(_0x2a9f53){try{jsonpatch[_0x6342('0x28')](_0x2a9f53,_0x4c89dd,!![]);}catch(_0x1f7c01){return BPromise['reject'](_0x1f7c01);}return _0x2a9f53[_0x6342('0x29')]();};}function saveUpdates(_0x1021ef,_0x8ecb63){return function(_0x1190e4){if(_0x1190e4){return _0x1190e4[_0x6342('0x2a')](_0x1021ef)[_0x6342('0x2b')](function(_0x50d22d){return _0x50d22d;});}return null;};}function removeEntity(_0x216a18,_0x3ae8f3){return function(_0x45fe8d){if(_0x45fe8d){return _0x45fe8d['destroy']()[_0x6342('0x2b')](function(){_0x216a18[_0x6342('0x21')](0xcc)[_0x6342('0x22')]();});}};}function handleEntityNotFound(_0xc1deeb,_0x3c7242){return function(_0x43d3d7){if(!_0x43d3d7){_0xc1deeb['sendStatus'](0x194);}return _0x43d3d7;};}function handleError(_0x42cfaa,_0x491855){_0x491855=_0x491855||0x1f4;return function(_0x5b1a4a){logger['error'](_0x5b1a4a[_0x6342('0x2c')]);if(_0x5b1a4a[_0x6342('0x2d')]){delete _0x5b1a4a['name'];}_0x42cfaa['status'](_0x491855)[_0x6342('0x2e')](_0x5b1a4a);};}exports[_0x6342('0x2f')]=function(_0x3c66f0,_0x3656c1,_0x45d0a5){if(!_0x3c66f0[_0x6342('0x30')]['hasOwnProperty'](_0x6342('0x31'))&&!_0x3c66f0[_0x6342('0x30')]['hasOwnProperty'](_0x6342('0x32'))){throw new db[(_0x6342('0x33'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3c66f0[_0x6342('0x30')][_0x6342('0x34')](_0x6342('0x32'))&&!_0x3c66f0[_0x6342('0x30')][_0x6342('0x34')](_0x6342('0x35'))){throw new db[(_0x6342('0x33'))][(_0x6342('0x36'))](_0x6342('0x37'));}if(!_0x3c66f0[_0x6342('0x30')][_0x6342('0x34')](_0x6342('0x38'))){throw new db[(_0x6342('0x33'))][(_0x6342('0x36'))](_0x6342('0x39'));}else{try{var _0x49d4d3=JSON['parse'](_0x3c66f0[_0x6342('0x30')][_0x6342('0x38')]);}catch(_0x424f09){logger[_0x6342('0x3a')](_0x424f09);throw new db[(_0x6342('0x33'))][(_0x6342('0x36'))](_0x6342('0x3b'));}var _0x12a2e1=['chatqueue','faxqueue','mailqueue',_0x6342('0x3c'),'smsqueue',_0x6342('0x3d'),'whatsappqueue',_0x6342('0x3e'),_0x6342('0x3f')];if(_[_0x6342('0x40')](_0x49d4d3,function(_0x5481fa){return!_[_0x6342('0x41')](_0x12a2e1,_0x5481fa[_0x6342('0x42')][_0x6342('0x43')]());})){throw new db[(_0x6342('0x33'))][(_0x6342('0x36'))](_0x6342('0x44'));}}}var _0x591cba={};_0x591cba[_0x6342('0x45')]=_0x3c66f0[_0x6342('0x30')][_0x6342('0x34')]('senderName')?_0x3c66f0[_0x6342('0x30')][_0x6342('0x45')]:_0x3c66f0[_0x6342('0x3f')][_0x6342('0x46')];_0x591cba[_0x6342('0x47')]=_[_0x6342('0x48')](_0x3c66f0['body'][_0x6342('0x47')])?null:_0x3c66f0['body'][_0x6342('0x47')];_0x591cba['beep']=_0x3c66f0[_0x6342('0x30')][_0x6342('0x49')]||![];_0x591cba[_0x6342('0x4a')]=_0x3c66f0[_0x6342('0x3f')]['id'];return getContent(_0x3c66f0[_0x6342('0x30')])[_0x6342('0x2b')](function(_0x277a6a){_0x591cba[_0x6342('0x30')]=_0x277a6a;return getRecipients(_0x49d4d3);})[_0x6342('0x2b')](function(_0x5da971){_0x591cba[_0x6342('0x4b')]=_[_0x6342('0x4c')](_0x5da971)['join'](',');return db[_0x6342('0x4d')][_0x6342('0x4e')](function(_0x4d1753){return db[_0x6342('0x4f')][_0x6342('0x50')](_0x591cba,{'raw':!![],'transaction':_0x4d1753})[_0x6342('0x2b')](function(_0x284e71){var _0x8b605a={'sender':_0x591cba['senderName'],'description':_0x591cba[_0x6342('0x47')],'content':_0x591cba['body'],'beep':_0x591cba[_0x6342('0x49')]};_0x5da971[_0x6342('0x51')](function(_0x236ebd){_0x8b605a[_0x6342('0x52')]=_0x236ebd;socket[_0x6342('0x53')]('userNotification:send',_0x8b605a);});return _0x284e71;});});})[_0x6342('0x2b')](respondWithResult(_0x3656c1,0xc9))['catch'](handleError(_0x3656c1,null));};function getContent(_0x774398){return new BPromise(function(_0x2877ac,_0x42b581){if(_0x774398['text']){_0x2877ac(_0x774398[_0x6342('0x31')]);return;}return db['Template'][_0x6342('0x54')]({'attributes':[_0x6342('0x55')],'where':{'id':_0x774398['TemplateId']},'raw':!![]})['then'](function(_0x4396bf){if(!_0x4396bf)throw new db[(_0x6342('0x33'))][(_0x6342('0x36'))](_0x6342('0x56'));var _0x29f16e=Mustache['render'](_0x4396bf['html'],_0x774398[_0x6342('0x35')]);_0x2877ac(_0x29f16e);})[_0x6342('0x57')](function(_0x44d799){_0x42b581(_0x44d799);});});}function getRecipients(_0x43f9dc){return new BPromise(function(_0x22cbc7,_0x479a94){var _0x4c7d3e=[];var _0x462e3b=[];_0x43f9dc[_0x6342('0x51')](function(_0x2b4f49){var _0x122b9b=_[_0x6342('0x58')](_0x2b4f49[_0x6342('0x42')]['toLowerCase']());if(_0x122b9b==='User'){_0x4c7d3e=_['union'](_0x4c7d3e,_0x2b4f49[_0x6342('0x59')]);}else{if(_[_0x6342('0x41')](_0x122b9b,'queue'))_0x122b9b=_0x122b9b['replace'](_0x6342('0x5a'),_0x6342('0x5b'));_0x2b4f49['ids'][_0x6342('0x51')](function(_0xb7d1ae){_0x462e3b[_0x6342('0x5c')](getAgents(_0x122b9b,_0xb7d1ae));});}});return BPromise['all'](_0x462e3b)[_0x6342('0x2b')](function(_0x5205e4){_0x4c7d3e=_[_0x6342('0x5d')](_0x4c7d3e,_['flatten'](_0x5205e4));_0x22cbc7(_0x4c7d3e);})[_0x6342('0x57')](function(_0x2ae8d0){_0x479a94(_0x2ae8d0);});});}function getAgents(_0x11212a,_0x38f60b){return new BPromise(function(_0x54d37a,_0x577e7c){return db[_0x11212a]['findOne']({'where':{'id':_0x38f60b}})[_0x6342('0x2b')](function(_0x4a3898){return _0x4a3898[_0x6342('0x5e')]({'attributes':['id'],'raw':!![]})[_0x6342('0x2b')](function(_0xf38c0c){var _0x1c0b73=_['map'](_0xf38c0c,'id');_0x54d37a(_0x1c0b73);});})['catch'](function(_0x2fd824){_0x577e7c(_0x2fd824);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 63328ff..a455e61 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e85=['setMaxListeners','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2da86f,_0x55e629){var _0x59f32b=function(_0x181cd3){while(--_0x181cd3){_0x2da86f['push'](_0x2da86f['shift']());}};_0x59f32b(++_0x55e629);}(_0x0e85,0x7c));var _0x50e8=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x0e85[_0x20ef64];return _0x3707d8;};'use strict';var EventEmitter=require(_0x50e8('0x0'));var UserNotification=require(_0x50e8('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x50e8('0x2')](0x0);var events={'afterCreate':_0x50e8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ce6cd){return function(_0x236cf3,_0x4e90e7,_0x3048e3){UserNotificationEvents[_0x50e8('0x4')](_0x4ce6cd+':'+_0x236cf3['id'],_0x236cf3);UserNotificationEvents[_0x50e8('0x4')](_0x4ce6cd,_0x236cf3);_0x3048e3(null);};}for(var e in events){if(events[_0x50e8('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x50e8('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x3937=['UserNotification','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4e2cb1,_0x15747f){var _0x2262dc=function(_0xdcd2aa){while(--_0xdcd2aa){_0x4e2cb1['push'](_0x4e2cb1['shift']());}};_0x2262dc(++_0x15747f);}(_0x3937,0xbf));var _0x7393=function(_0x2cf0f6,_0x1a4818){_0x2cf0f6=_0x2cf0f6-0x0;var _0x3dfcd5=_0x3937[_0x2cf0f6];return _0x3dfcd5;};'use strict';var EventEmitter=require(_0x7393('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x7393('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7393('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7393('0x3'),'afterDestroy':'remove'};function emitEvent(_0x224468){return function(_0x4c9c71,_0x992b15,_0x2790e6){UserNotificationEvents[_0x7393('0x4')](_0x224468+':'+_0x4c9c71['id'],_0x4c9c71);UserNotificationEvents[_0x7393('0x4')](_0x224468,_0x4c9c71);_0x2790e6(null);};}for(var e in events){if(events[_0x7393('0x5')](e)){var event=events[e];UserNotification[_0x7393('0x6')](e,emitEvent(event));}}module[_0x7393('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 3ad070a..332ad48 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab26=['./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab26,0xd2));var _0x6ab2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xab26[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var logger=require(_0x6ab2('0x2'))('api');var moment=require(_0x6ab2('0x3'));var BPromise=require(_0x6ab2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ab2('0x5'));var config=require('../../config/environment');var attributes=require(_0x6ab2('0x6'));module[_0x6ab2('0x7')]=function(_0x31c9f1,_0x56dc80){return _0x31c9f1[_0x6ab2('0x8')](_0x6ab2('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ab2('0xa'),'collate':_0x6ab2('0xb')});}; \ No newline at end of file +var _0x6146=['exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes'];(function(_0x148f7f,_0x43ae18){var _0x1d84f3=function(_0x1db482){while(--_0x1db482){_0x148f7f['push'](_0x148f7f['shift']());}};_0x1d84f3(++_0x43ae18);}(_0x6146,0xba));var _0x6614=function(_0x404e76,_0x3bd4ff){_0x404e76=_0x404e76-0x0;var _0x2b5294=_0x6146[_0x404e76];return _0x2b5294;};'use strict';var _=require(_0x6614('0x0'));var util=require('util');var logger=require(_0x6614('0x1'))(_0x6614('0x2'));var moment=require(_0x6614('0x3'));var BPromise=require(_0x6614('0x4'));var rp=require(_0x6614('0x5'));var fs=require('fs');var path=require(_0x6614('0x6'));var rimraf=require(_0x6614('0x7'));var config=require('../../config/environment');var attributes=require(_0x6614('0x8'));module[_0x6614('0x9')]=function(_0x334591,_0x43c7a7){return _0x334591[_0x6614('0xa')](_0x6614('0xb'),attributes,{'tableName':_0x6614('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6614('0xd'),'collate':_0x6614('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8cfee13..2ce0f9b 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x996a=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x36fa65,_0x2f5f3b){var _0x3a435b=function(_0x270da0){while(--_0x270da0){_0x36fa65['push'](_0x36fa65['shift']());}};_0x3a435b(++_0x2f5f3b);}(_0x996a,0xb6));var _0xa996=function(_0x2b4bee,_0x5345aa){_0x2b4bee=_0x2b4bee-0x0;var _0x39ea8f=_0x996a[_0x2b4bee];return _0x39ea8f;};'use strict';var _=require(_0xa996('0x0'));var util=require('util');var moment=require(_0xa996('0x1'));var BPromise=require('bluebird');var rs=require(_0xa996('0x2'));var fs=require('fs');var Redis=require(_0xa996('0x3'));var db=require(_0xa996('0x4'))['db'];var utils=require(_0xa996('0x5'));var logger=require(_0xa996('0x6'))(_0xa996('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa996('0x8')][_0xa996('0x9')]({'port':0x232a});config[_0xa996('0xa')]=_[_0xa996('0xb')](config[_0xa996('0xa')],{'host':_0xa996('0xc'),'port':0x18eb});var socket=require(_0xa996('0xd'))(new Redis(config[_0xa996('0xa')]));require(_0xa996('0xe'))['register'](socket);function respondWithRpcPromise(_0x3fe0c6,_0x3a1cfe,_0x26fffa){return new BPromise(function(_0x51832d,_0x59bee0){return client['request'](_0x3fe0c6,_0x26fffa)[_0xa996('0xf')](function(_0x464350){logger[_0xa996('0x10')](_0xa996('0x11'),_0x3a1cfe,_0xa996('0x12'));logger[_0xa996('0x13')](_0xa996('0x14'),_0x3a1cfe,'request\x20sent',JSON[_0xa996('0x15')](_0x464350));if(_0x464350[_0xa996('0x16')]){if(_0x464350[_0xa996('0x16')]['code']===0x1f4){logger[_0xa996('0x16')]('UserNotification,\x20%s,\x20%s',_0x3a1cfe,_0x464350[_0xa996('0x16')][_0xa996('0x17')]);return _0x59bee0(_0x464350[_0xa996('0x16')]['message']);}logger[_0xa996('0x16')]('UserNotification,\x20%s,\x20%s',_0x3a1cfe,_0x464350[_0xa996('0x16')][_0xa996('0x17')]);return _0x51832d(_0x464350[_0xa996('0x16')][_0xa996('0x17')]);}else{logger['info'](_0xa996('0x11'),_0x3a1cfe,'request\x20sent');_0x51832d(_0x464350[_0xa996('0x18')][_0xa996('0x17')]);}})[_0xa996('0x19')](function(_0x4161fa){logger[_0xa996('0x16')]('UserNotification,\x20%s,\x20%s',_0x3a1cfe,_0x4161fa);_0x59bee0(_0x4161fa);});});} \ No newline at end of file +var _0x773e=['debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','http','redis','localhost','socket.io-emitter','./userNotification.socket','request','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x27507d,_0x1130c4){var _0x4b87ef=function(_0x3f6f36){while(--_0x3f6f36){_0x27507d['push'](_0x27507d['shift']());}};_0x4b87ef(++_0x1130c4);}(_0x773e,0xd9));var _0xe773=function(_0x2cc303,_0x2c4a2a){_0x2cc303=_0x2cc303-0x0;var _0x82a2ca=_0x773e[_0x2cc303];return _0x82a2ca;};'use strict';var _=require('lodash');var util=require(_0xe773('0x0'));var moment=require(_0xe773('0x1'));var BPromise=require('bluebird');var rs=require(_0xe773('0x2'));var fs=require('fs');var Redis=require(_0xe773('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe773('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe773('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe773('0x6')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe773('0x7')],{'host':_0xe773('0x8'),'port':0x18eb});var socket=require(_0xe773('0x9'))(new Redis(config['redis']));require(_0xe773('0xa'))['register'](socket);function respondWithRpcPromise(_0x49a007,_0x316faa,_0x3cc9df){return new BPromise(function(_0x3d42ba,_0x1ed916){return client[_0xe773('0xb')](_0x49a007,_0x3cc9df)['then'](function(_0x424d11){logger['info'](_0xe773('0xc'),_0x316faa,_0xe773('0xd'));logger[_0xe773('0xe')](_0xe773('0xf'),_0x316faa,'request\x20sent',JSON[_0xe773('0x10')](_0x424d11));if(_0x424d11['error']){if(_0x424d11['error'][_0xe773('0x11')]===0x1f4){logger[_0xe773('0x12')](_0xe773('0xc'),_0x316faa,_0x424d11[_0xe773('0x12')][_0xe773('0x13')]);return _0x1ed916(_0x424d11[_0xe773('0x12')]['message']);}logger['error'](_0xe773('0xc'),_0x316faa,_0x424d11['error'][_0xe773('0x13')]);return _0x3d42ba(_0x424d11[_0xe773('0x12')][_0xe773('0x13')]);}else{logger['info'](_0xe773('0xc'),_0x316faa,_0xe773('0xd'));_0x3d42ba(_0x424d11[_0xe773('0x14')][_0xe773('0x13')]);}})['catch'](function(_0x3115c6){logger['error'](_0xe773('0xc'),_0x316faa,_0x3115c6);_0x1ed916(_0x3115c6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index fa0e02f..c87e1ff 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c65=['./userNotification.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2ef353,_0x29afcd){var _0x494dcb=function(_0x4c23d3){while(--_0x4c23d3){_0x2ef353['push'](_0x2ef353['shift']());}};_0x494dcb(++_0x29afcd);}(_0x6c65,0x78));var _0x56c6=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x6c65[_0x2786ea];return _0x5c38e5;};'use strict';var UserNotificationEvents=require(_0x56c6('0x0'));var events=[_0x56c6('0x1'),_0x56c6('0x2'),_0x56c6('0x3')];function createListener(_0x1bebff,_0x3f6d26){return function(_0x57c6ff){_0x3f6d26[_0x56c6('0x4')](_0x1bebff,_0x57c6ff);};}function removeListener(_0x4321ef,_0x3f532d){return function(){UserNotificationEvents[_0x56c6('0x5')](_0x4321ef,_0x3f532d);};}exports[_0x56c6('0x6')]=function(_0x4fd1f2){for(var _0x309a6c=0x0,_0x2f7d43=events[_0x56c6('0x7')];_0x309a6c<_0x2f7d43;_0x309a6c++){var _0x3123cb=events[_0x309a6c];var _0x2422a9=createListener('userNotification:'+_0x3123cb,_0x4fd1f2);UserNotificationEvents['on'](_0x3123cb,_0x2422a9);}}; \ No newline at end of file +var _0xfd87=['./userNotification.events','save','remove','update','emit','removeListener','length','userNotification:'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0x7fd8('0x0'));var events=[_0x7fd8('0x1'),_0x7fd8('0x2'),_0x7fd8('0x3')];function createListener(_0x11b128,_0x15d25f){return function(_0x2631d9){_0x15d25f[_0x7fd8('0x4')](_0x11b128,_0x2631d9);};}function removeListener(_0x4429f2,_0x43b442){return function(){UserNotificationEvents[_0x7fd8('0x5')](_0x4429f2,_0x43b442);};}exports['register']=function(_0x1395b6){for(var _0x10a778=0x0,_0x55681d=events[_0x7fd8('0x6')];_0x10a778<_0x55681d;_0x10a778++){var _0x6eaf96=events[_0x10a778];var _0x2e2d74=createListener(_0x7fd8('0x7')+_0x6eaf96,_0x1395b6);UserNotificationEvents['on'](_0x6eaf96,_0x2e2d74);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9ba54b2..ab2a18a 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 _0x15f9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x5b1de6,_0x81c9d){var _0x21a065=function(_0x1874f8){while(--_0x1874f8){_0x5b1de6['push'](_0x5b1de6['shift']());}};_0x21a065(++_0x81c9d);}(_0x15f9,0xf7));var _0x915f=function(_0x7d163d,_0x4cf14b){_0x7d163d=_0x7d163d-0x0;var _0x108980=_0x15f9[_0x7d163d];return _0x108980;};'use strict';var multer=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var path=require(_0x915f('0x2'));var timeout=require(_0x915f('0x3'));var express=require(_0x915f('0x4'));var router=express[_0x915f('0x5')]();var fs_extra=require(_0x915f('0x6'));var auth=require(_0x915f('0x7'));var interaction=require(_0x915f('0x8'));var config=require('../../config/environment');module[_0x915f('0x9')]=router; \ No newline at end of file +var _0xc7ea=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0xc7ea,0x171));var _0xac7e=function(_0x631e63,_0x334a4a){_0x631e63=_0x631e63-0x0;var _0x30d1ea=_0xc7ea[_0x631e63];return _0x30d1ea;};'use strict';var multer=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var path=require('path');var timeout=require(_0xac7e('0x2'));var express=require(_0xac7e('0x3'));var router=express[_0xac7e('0x4')]();var fs_extra=require(_0xac7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xac7e('0x6'));var config=require(_0xac7e('0x7'));module[_0xac7e('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 72fa178..7bcc75e 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(_0x4c939e,_0x2df945){var _0x135349=function(_0x2199c2){while(--_0x2199c2){_0x4c939e['push'](_0x4c939e['shift']());}};_0x135349(++_0x2df945);}(_0xe706,0xa3));var _0x6e70=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xe706[_0x247fa1];return _0x244f35;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x385b12,_0x3d11b4){var _0x16b789=function(_0x2f1a07){while(--_0x2f1a07){_0x385b12['push'](_0x385b12['shift']());}};_0x16b789(++_0x3d11b4);}(_0xe706,0xa3));var _0x6e70=function(_0xf915a7,_0x3c5104){_0xf915a7=_0xf915a7-0x0;var _0x714195=_0xe706[_0xf915a7];return _0x714195;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index fc4cb3c..156dc5d 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 _0x8a84=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x4a6979,_0x5f3d1a){var _0x226f93=function(_0x471572){while(--_0x471572){_0x4a6979['push'](_0x4a6979['shift']());}};_0x226f93(++_0x5f3d1a);}(_0x8a84,0x163));var _0x48a8=function(_0x31bcb2,_0x23cc0e){_0x31bcb2=_0x31bcb2-0x0;var _0x3f150c=_0x8a84[_0x31bcb2];return _0x3f150c;};'use strict';var _=require(_0x48a8('0x0'));var util=require('util');var logger=require(_0x48a8('0x1'))('api');var moment=require(_0x48a8('0x2'));var BPromise=require('bluebird');var rp=require(_0x48a8('0x3'));var fs=require('fs');var path=require(_0x48a8('0x4'));var rimraf=require(_0x48a8('0x5'));var config=require('../../config/environment');var attributes=require(_0x48a8('0x6'));module[_0x48a8('0x7')]=function(_0x5a292a,_0xd659b1){return _0x5a292a[_0x48a8('0x8')](_0x48a8('0x9'),attributes,{'tableName':_0x48a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ebe=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','moment'];(function(_0x32e2f1,_0x1e028b){var _0x5d84ea=function(_0x2d0a9a){while(--_0x2d0a9a){_0x32e2f1['push'](_0x32e2f1['shift']());}};_0x5d84ea(++_0x1e028b);}(_0x4ebe,0x169));var _0xe4eb=function(_0x2070e7,_0x5e6e01){_0x2070e7=_0x2070e7-0x0;var _0x6af9b=_0x4ebe[_0x2070e7];return _0x6af9b;};'use strict';var _=require('lodash');var util=require(_0xe4eb('0x0'));var logger=require(_0xe4eb('0x1'))('api');var moment=require(_0xe4eb('0x2'));var BPromise=require(_0xe4eb('0x3'));var rp=require(_0xe4eb('0x4'));var fs=require('fs');var path=require(_0xe4eb('0x5'));var rimraf=require(_0xe4eb('0x6'));var config=require(_0xe4eb('0x7'));var attributes=require(_0xe4eb('0x8'));module[_0xe4eb('0x9')]=function(_0x1dc42f,_0x8742cc){return _0x1dc42f[_0xe4eb('0xa')](_0xe4eb('0xb'),attributes,{'tableName':_0xe4eb('0xc'),'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 3135f35..5acbd1d 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 _0x47f2=['error','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x32836a,_0x2b2252){var _0x4d8753=function(_0xc8f496){while(--_0xc8f496){_0x32836a['push'](_0x32836a['shift']());}};_0x4d8753(++_0x2b2252);}(_0x47f2,0x1cf));var _0x247f=function(_0x3bdad2,_0x571d7a){_0x3bdad2=_0x3bdad2-0x0;var _0x354543=_0x47f2[_0x3bdad2];return _0x354543;};'use strict';var _=require(_0x247f('0x0'));var util=require('util');var moment=require(_0x247f('0x1'));var BPromise=require(_0x247f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x247f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x247f('0x4'));var logger=require(_0x247f('0x5'))(_0x247f('0x6'));var config=require(_0x247f('0x7'));var jayson=require(_0x247f('0x8'));var client=jayson[_0x247f('0x9')][_0x247f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594777,_0x18e0e7,_0x1ac5ba){return new BPromise(function(_0x561c22,_0x1c2c37){return client['request'](_0x594777,_0x1ac5ba)[_0x247f('0xb')](function(_0x21add5){logger[_0x247f('0xc')](_0x247f('0xd'),_0x18e0e7,_0x247f('0xe'));logger[_0x247f('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x18e0e7,'request\x20sent',JSON[_0x247f('0x10')](_0x21add5));if(_0x21add5[_0x247f('0x11')]){if(_0x21add5[_0x247f('0x11')]['code']===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x18e0e7,_0x21add5[_0x247f('0x11')][_0x247f('0x12')]);return _0x1c2c37(_0x21add5['error']['message']);}logger[_0x247f('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x18e0e7,_0x21add5[_0x247f('0x11')][_0x247f('0x12')]);return _0x561c22(_0x21add5[_0x247f('0x11')]['message']);}else{logger['info'](_0x247f('0xd'),_0x18e0e7,_0x247f('0xe'));_0x561c22(_0x21add5[_0x247f('0x13')][_0x247f('0x12')]);}})['catch'](function(_0xa11527){logger[_0x247f('0x11')](_0x247f('0xd'),_0x18e0e7,_0xa11527);_0x1c2c37(_0xa11527);});});} \ No newline at end of file +var _0xe625=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xe625,0xfc));var _0x5e62=function(_0x15c3b3,_0x14f96e){_0x15c3b3=_0x15c3b3-0x0;var _0x58c799=_0xe625[_0x15c3b3];return _0x58c799;};'use strict';var _=require(_0x5e62('0x0'));var util=require(_0x5e62('0x1'));var moment=require(_0x5e62('0x2'));var BPromise=require(_0x5e62('0x3'));var rs=require(_0x5e62('0x4'));var fs=require('fs');var Redis=require(_0x5e62('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e62('0x6'));var config=require(_0x5e62('0x7'));var jayson=require(_0x5e62('0x8'));var client=jayson[_0x5e62('0x9')][_0x5e62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18c01f,_0x5cceea,_0x30ea56){return new BPromise(function(_0x26ae28,_0xc6b205){return client[_0x5e62('0xb')](_0x18c01f,_0x30ea56)[_0x5e62('0xc')](function(_0x29f4b1){logger[_0x5e62('0xd')](_0x5e62('0xe'),_0x5cceea,_0x5e62('0xf'));logger[_0x5e62('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5cceea,_0x5e62('0xf'),JSON[_0x5e62('0x11')](_0x29f4b1));if(_0x29f4b1[_0x5e62('0x12')]){if(_0x29f4b1['error']['code']===0x1f4){logger[_0x5e62('0x12')](_0x5e62('0xe'),_0x5cceea,_0x29f4b1[_0x5e62('0x12')][_0x5e62('0x13')]);return _0xc6b205(_0x29f4b1[_0x5e62('0x12')][_0x5e62('0x13')]);}logger[_0x5e62('0x12')](_0x5e62('0xe'),_0x5cceea,_0x29f4b1[_0x5e62('0x12')][_0x5e62('0x13')]);return _0x26ae28(_0x29f4b1['error'][_0x5e62('0x13')]);}else{logger[_0x5e62('0xd')](_0x5e62('0xe'),_0x5cceea,_0x5e62('0xf'));_0x26ae28(_0x29f4b1[_0x5e62('0x14')]['message']);}})[_0x5e62('0x15')](function(_0x156945){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5cceea,_0x156945);_0xc6b205(_0x156945);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 62434ff..280716f 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 _0x0c2d=['get','isAuthenticated','index','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','addSections','addResources','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfile.controller'];(function(_0x1db7fb,_0x41fbaf){var _0x102973=function(_0x66a4a){while(--_0x66a4a){_0x1db7fb['push'](_0x1db7fb['shift']());}};_0x102973(++_0x41fbaf);}(_0x0c2d,0x18c));var _0xd0c2=function(_0x3d9ca0,_0x1aa0f2){_0x3d9ca0=_0x3d9ca0-0x0;var _0x1d42c2=_0x0c2d[_0x3d9ca0];return _0x1d42c2;};'use strict';var multer=require(_0xd0c2('0x0'));var util=require(_0xd0c2('0x1'));var path=require(_0xd0c2('0x2'));var timeout=require(_0xd0c2('0x3'));var express=require(_0xd0c2('0x4'));var router=express[_0xd0c2('0x5')]();var fs_extra=require(_0xd0c2('0x6'));var auth=require(_0xd0c2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd0c2('0x8'));router[_0xd0c2('0x9')]('/',auth[_0xd0c2('0xa')](),controller[_0xd0c2('0xb')]);router[_0xd0c2('0x9')]('/describe',auth[_0xd0c2('0xa')](),controller['describe']);router['get'](_0xd0c2('0xc'),auth[_0xd0c2('0xa')](),controller[_0xd0c2('0xd')]);router[_0xd0c2('0x9')](_0xd0c2('0xe'),auth['isAuthenticated'](),controller[_0xd0c2('0xf')]);router[_0xd0c2('0x9')](_0xd0c2('0x10'),auth['isAuthenticated'](),controller['getResources']);router[_0xd0c2('0x11')]('/',auth[_0xd0c2('0xa')](),controller[_0xd0c2('0x12')]);router[_0xd0c2('0x11')](_0xd0c2('0x13'),auth[_0xd0c2('0xa')](),controller['clone']);router['post'](_0xd0c2('0xe'),auth[_0xd0c2('0xa')](),controller[_0xd0c2('0x14')]);router[_0xd0c2('0x11')]('/:id/resources',auth['isAuthenticated'](),controller[_0xd0c2('0x15')]);router['put']('/:id',auth[_0xd0c2('0xa')](),controller['update']);router[_0xd0c2('0x16')](_0xd0c2('0xc'),auth[_0xd0c2('0xa')](),controller[_0xd0c2('0x17')]);router[_0xd0c2('0x16')](_0xd0c2('0xe'),auth[_0xd0c2('0xa')](),controller[_0xd0c2('0x18')]);router[_0xd0c2('0x16')](_0xd0c2('0x10'),auth[_0xd0c2('0xa')](),controller[_0xd0c2('0x19')]);module[_0xd0c2('0x1a')]=router; \ No newline at end of file +var _0x59bb=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','put','update','delete','removeSections','removeResources'];(function(_0x1836fc,_0x4a69a8){var _0x14c7ab=function(_0x561988){while(--_0x561988){_0x1836fc['push'](_0x1836fc['shift']());}};_0x14c7ab(++_0x4a69a8);}(_0x59bb,0x88));var _0xb59b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x59bb[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xb59b('0x0'));var util=require(_0xb59b('0x1'));var path=require('path');var timeout=require(_0xb59b('0x2'));var express=require('express');var router=express[_0xb59b('0x3')]();var fs_extra=require(_0xb59b('0x4'));var auth=require(_0xb59b('0x5'));var interaction=require(_0xb59b('0x6'));var config=require('../../config/environment');var controller=require(_0xb59b('0x7'));router[_0xb59b('0x8')]('/',auth[_0xb59b('0x9')](),controller[_0xb59b('0xa')]);router[_0xb59b('0x8')](_0xb59b('0xb'),auth[_0xb59b('0x9')](),controller['describe']);router['get'](_0xb59b('0xc'),auth[_0xb59b('0x9')](),controller['show']);router[_0xb59b('0x8')](_0xb59b('0xd'),auth['isAuthenticated'](),controller[_0xb59b('0xe')]);router['get'](_0xb59b('0xf'),auth['isAuthenticated'](),controller[_0xb59b('0x10')]);router[_0xb59b('0x11')]('/',auth[_0xb59b('0x9')](),controller[_0xb59b('0x12')]);router[_0xb59b('0x11')](_0xb59b('0x13'),auth[_0xb59b('0x9')](),controller[_0xb59b('0x14')]);router[_0xb59b('0x11')](_0xb59b('0xd'),auth['isAuthenticated'](),controller['addSections']);router['post'](_0xb59b('0xf'),auth[_0xb59b('0x9')](),controller['addResources']);router[_0xb59b('0x15')](_0xb59b('0xc'),auth[_0xb59b('0x9')](),controller[_0xb59b('0x16')]);router[_0xb59b('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xb59b('0xd'),auth[_0xb59b('0x9')](),controller[_0xb59b('0x18')]);router[_0xb59b('0x17')](_0xb59b('0xf'),auth[_0xb59b('0x9')](),controller[_0xb59b('0x19')]);module[_0xb59b('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 07dffa2..743330a 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 _0xad95=['STRING','setDataValue','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xad95,0x70));var _0x5ad9=function(_0x5aa107,_0x48c3f9){_0x5aa107=_0x5aa107-0x0;var _0x45c515=_0xad95[_0x5aa107];return _0x45c515;};'use strict';var Sequelize=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]={'name':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x409d5b){this[_0x5ad9('0x3')]('crudPermissions',_0x409d5b?_0x409d5b['join'](''):[]);},'get':function(){return this[_0x5ad9('0x4')]('crudPermissions')?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5ad9('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x5ad9('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x0565=['exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x5ae196,_0x32c8ee){var _0x431ddb=function(_0x6d166a){while(--_0x6d166a){_0x5ae196['push'](_0x5ae196['shift']());}};_0x431ddb(++_0x32c8ee);}(_0x0565,0xf2));var _0x5056=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0565[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'name':{'type':Sequelize[_0x5056('0x2')],'allowNull':![],'unique':_0x5056('0x3')},'crudPermissions':{'type':Sequelize[_0x5056('0x2')],'set':function(_0x397289){this[_0x5056('0x4')](_0x5056('0x5'),_0x397289?_0x397289[_0x5056('0x6')](''):[]);},'get':function(){return this[_0x5056('0x7')]('crudPermissions')?this[_0x5056('0x7')](_0x5056('0x5'))[_0x5056('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5056('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3e56923..a765802 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 _0x347b=['offset','limit','Content-Range','reject','save','then','destroy','end','error','stack','name','send','map','UserProfile','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','filter','count','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','get','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','update','describe','addSections','push','ids','includes','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','ValidationError','Unknown\x20section','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','all','ignore','union','field','foreignKey','associatedResources','default','reportId','DefaultReports','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','AnalyticExtractedReport','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','Lists','companies','CmCompany','CmCustomField','ChatQueue','faxqueues','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','voicequeues','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','intervals','pauses','Pause','scheduler','sounds','tags','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','status','json'];(function(_0x400ae1,_0x58a9f4){var _0x2cd63f=function(_0x24dd05){while(--_0x24dd05){_0x400ae1['push'](_0x400ae1['shift']());}};_0x2cd63f(++_0x58a9f4);}(_0x347b,0x1a3));var _0xb347=function(_0x4e9f29,_0x1bbcbf){_0x4e9f29=_0x4e9f29-0x0;var _0x8e1ab3=_0x347b[_0x4e9f29];return _0x8e1ab3;};'use strict';var pdf=require(_0xb347('0x0'));var emlformat=require(_0xb347('0x1'));var rimraf=require(_0xb347('0x2'));var zipdir=require(_0xb347('0x3'));var jsonpatch=require(_0xb347('0x4'));var rp=require(_0xb347('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb347('0x6'));var util=require(_0xb347('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb347('0x8'));var ejs=require(_0xb347('0x9'));var fs=require('fs');var fs_extra=require(_0xb347('0xa'));var _=require(_0xb347('0xb'));var squel=require(_0xb347('0xc'));var crypto=require(_0xb347('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb347('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb347('0xe'));var authService=require(_0xb347('0xf'));var qs=require(_0xb347('0x10'));var as=require(_0xb347('0x11'));var hardwareService=require(_0xb347('0x12'));var logger=require('../../config/logger')(_0xb347('0x13'));var utils=require('../../config/utils');var config=require(_0xb347('0x14'));var licenseUtil=require(_0xb347('0x15'));var db=require('../../mysqldb')['db'];config[_0xb347('0x16')]=_[_0xb347('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb347('0x18'))(new Redis(config['redis']));require('./userProfile.socket')[_0xb347('0x19')](socket);function respondWithStatusCode(_0x3640a2,_0x1fd8eb){_0x1fd8eb=_0x1fd8eb||0xcc;return function(_0x27c5c0){if(_0x27c5c0){return _0x3640a2[_0xb347('0x1a')](_0x1fd8eb);}return _0x3640a2[_0xb347('0x1b')](_0x1fd8eb)['end']();};}function respondWithResult(_0x17a2d6,_0x178037){_0x178037=_0x178037||0xc8;return function(_0x45e79f){if(_0x45e79f){return _0x17a2d6['status'](_0x178037)[_0xb347('0x1c')](_0x45e79f);}};}function respondWithFilteredResult(_0x1a0be4,_0x4d6c40){return function(_0xa51c76){if(_0xa51c76){var _0x5de6ea=_0xa51c76['count'],_0x8aaffd=_0x4d6c40[_0xb347('0x1d')],_0x577493=_0x4d6c40[_0xb347('0x1d')]+_0x4d6c40[_0xb347('0x1e')],_0x48afa6;if(_0x577493>=_0x5de6ea){_0x577493=_0x5de6ea;_0x48afa6=0xc8;}else{_0x48afa6=0xce;}_0x1a0be4[_0xb347('0x1b')](_0x48afa6);return _0x1a0be4['set'](_0xb347('0x1f'),_0x8aaffd+'-'+_0x577493+'/'+_0x5de6ea)[_0xb347('0x1c')](_0xa51c76);}return null;};}function patchUpdates(_0x5df9b9){return function(_0x34db2d){try{jsonpatch['apply'](_0x34db2d,_0x5df9b9,!![]);}catch(_0x195427){return BPromise[_0xb347('0x20')](_0x195427);}return _0x34db2d[_0xb347('0x21')]();};}function saveUpdates(_0x517693,_0xeefbf){return function(_0x508eca){if(_0x508eca){return _0x508eca['update'](_0x517693)[_0xb347('0x22')](function(_0x489169){return _0x489169;});}return null;};}function removeEntity(_0x53fbd1,_0x28e218){return function(_0x1b3ca1){if(_0x1b3ca1){return _0x1b3ca1[_0xb347('0x23')]()[_0xb347('0x22')](function(){_0x53fbd1[_0xb347('0x1b')](0xcc)[_0xb347('0x24')]();});}};}function handleEntityNotFound(_0x2368b9,_0x3fe4d1){return function(_0x2c49fc){if(!_0x2c49fc){_0x2368b9['sendStatus'](0x194);}return _0x2c49fc;};}function handleError(_0x30fc64,_0x592432){_0x592432=_0x592432||0x1f4;return function(_0x47e96f){logger[_0xb347('0x25')](_0x47e96f[_0xb347('0x26')]);if(_0x47e96f[_0xb347('0x27')]){delete _0x47e96f[_0xb347('0x27')];}_0x30fc64[_0xb347('0x1b')](_0x592432)[_0xb347('0x28')](_0x47e96f);};}exports['index']=function(_0x338005,_0x3416f9){var _0x5208ee={},_0x50ab72={},_0x41abd8={'count':0x0,'rows':[]};var _0xcbaf53=_[_0xb347('0x29')](db[_0xb347('0x2a')]['rawAttributes'],function(_0x524dfc){return{'name':_0x524dfc[_0xb347('0x2b')],'type':_0x524dfc['type'][_0xb347('0x2c')]};});_0x50ab72[_0xb347('0x2d')]=_['map'](_0xcbaf53,_0xb347('0x27'));_0x50ab72['query']=_[_0xb347('0x2e')](_0x338005[_0xb347('0x2f')]);_0x50ab72[_0xb347('0x30')]=_[_0xb347('0x31')](_0x50ab72[_0xb347('0x2d')],_0x50ab72[_0xb347('0x2f')]);_0x5208ee[_0xb347('0x32')]=_[_0xb347('0x31')](_0x50ab72['model'],qs[_0xb347('0x33')](_0x338005[_0xb347('0x2f')][_0xb347('0x33')]));_0x5208ee[_0xb347('0x32')]=_0x5208ee['attributes'][_0xb347('0x34')]?_0x5208ee[_0xb347('0x32')]:_0x50ab72[_0xb347('0x2d')];if(!_0x338005[_0xb347('0x2f')]['hasOwnProperty'](_0xb347('0x35'))){_0x5208ee[_0xb347('0x1e')]=qs['limit'](_0x338005['query']['limit']);_0x5208ee['offset']=qs[_0xb347('0x1d')](_0x338005['query'][_0xb347('0x1d')]);}_0x5208ee[_0xb347('0x36')]=qs[_0xb347('0x37')](_0x338005['query'][_0xb347('0x37')]);_0x5208ee[_0xb347('0x38')]=qs['filters'](_[_0xb347('0x39')](_0x338005[_0xb347('0x2f')],_0x50ab72[_0xb347('0x30')]),_0xcbaf53);if(_0x338005[_0xb347('0x2f')]['filter']){_0x5208ee[_0xb347('0x38')]=_[_0xb347('0x3a')](_0x5208ee[_0xb347('0x38')],{'$or':_[_0xb347('0x29')](_0xcbaf53,function(_0x3dd8e4){if(_0x3dd8e4[_0xb347('0x3b')]!=='VIRTUAL'){var _0x43e0d0={};_0x43e0d0[_0x3dd8e4[_0xb347('0x27')]]={'$like':'%'+_0x338005[_0xb347('0x2f')][_0xb347('0x3c')]+'%'};return _0x43e0d0;}})});}_0x5208ee=_[_0xb347('0x3a')]({},_0x5208ee,_0x338005['options']);var _0x461d90={'where':_0x5208ee['where']};return db['UserProfile'][_0xb347('0x3d')](_0x461d90)[_0xb347('0x22')](function(_0xaed554){_0x41abd8[_0xb347('0x3d')]=_0xaed554;if(_0x338005[_0xb347('0x2f')]['includeAll']){_0x5208ee['include']=[{'all':!![]}];}return db[_0xb347('0x2a')]['findAll'](_0x5208ee);})['then'](function(_0x4cb376){_0x41abd8[_0xb347('0x3e')]=_0x4cb376;return _0x41abd8;})[_0xb347('0x22')](respondWithFilteredResult(_0x3416f9,_0x5208ee))[_0xb347('0x3f')](handleError(_0x3416f9,null));};exports[_0xb347('0x40')]=function(_0x248086,_0x248a32){var _0x14dffd={'raw':![],'where':{'id':_0x248086[_0xb347('0x41')]['id']}},_0x4cfbbf={};_0x4cfbbf[_0xb347('0x2d')]=_[_0xb347('0x2e')](db[_0xb347('0x2a')][_0xb347('0x42')]);_0x4cfbbf[_0xb347('0x2f')]=_[_0xb347('0x2e')](_0x248086[_0xb347('0x2f')]);_0x4cfbbf[_0xb347('0x30')]=_['intersection'](_0x4cfbbf['model'],_0x4cfbbf['query']);_0x14dffd[_0xb347('0x32')]=_[_0xb347('0x31')](_0x4cfbbf[_0xb347('0x2d')],qs[_0xb347('0x33')](_0x248086[_0xb347('0x2f')]['fields']));_0x14dffd[_0xb347('0x32')]=_0x14dffd[_0xb347('0x32')][_0xb347('0x34')]?_0x14dffd[_0xb347('0x32')]:_0x4cfbbf[_0xb347('0x2d')];if(_0x248086[_0xb347('0x2f')][_0xb347('0x43')]){_0x14dffd[_0xb347('0x44')]=[{'all':!![]}];}_0x14dffd=_[_0xb347('0x3a')]({},_0x14dffd,_0x248086[_0xb347('0x45')]);return db['UserProfile'][_0xb347('0x46')](_0x14dffd)[_0xb347('0x22')](handleEntityNotFound(_0x248a32,null))[_0xb347('0x22')](respondWithResult(_0x248a32,null))[_0xb347('0x3f')](handleError(_0x248a32,null));};exports[_0xb347('0x47')]=function(_0x5a8eaa,_0x2cd046){return db[_0xb347('0x2a')][_0xb347('0x47')](_0x5a8eaa[_0xb347('0x48')],{})['then'](respondWithResult(_0x2cd046,0xc9))[_0xb347('0x3f')](handleError(_0x2cd046,null));};exports['clone']=function(_0x14dd5f,_0x47d55d){var _0x455eed={'where':{'id':_0x14dd5f[_0xb347('0x41')]['id']}},_0x58b2db={};_0x58b2db[_0xb347('0x2d')]=_[_0xb347('0x2e')](db[_0xb347('0x2a')][_0xb347('0x42')]);_0x455eed[_0xb347('0x32')]=_[_0xb347('0x31')](_0x58b2db[_0xb347('0x2d')],qs[_0xb347('0x33')](_0x14dd5f[_0xb347('0x2f')][_0xb347('0x33')]));_0x455eed['attributes']=_0x455eed[_0xb347('0x32')][_0xb347('0x34')]?_0x455eed[_0xb347('0x32')]:_0x58b2db[_0xb347('0x2d')];if(_0x14dd5f[_0xb347('0x2f')][_0xb347('0x43')]){_0x455eed[_0xb347('0x44')]=[{'all':!![]}];}_0x455eed=_['merge']({},_0x455eed,_0x14dd5f[_0xb347('0x45')]);return db[_0xb347('0x2a')][_0xb347('0x46')](_0x455eed)[_0xb347('0x22')](handleEntityNotFound(_0x47d55d,null))['then'](function(_0x38cb57){if(_0x38cb57){var _0x21c315=_0x38cb57[_0xb347('0x49')]({'plain':!![]});_0x21c315=qs['omit'](_0x21c315,['id',_0xb347('0x4a'),'updatedAt',_0xb347('0x4b')]);_0x14dd5f[_0xb347('0x48')]=_['omit'](_0x14dd5f[_0xb347('0x48')],['id',_0xb347('0x4a'),_0xb347('0x4c')]);return db[_0xb347('0x4d')][_0xb347('0x4e')](function(_0x4a2206){return db[_0xb347('0x2a')][_0xb347('0x47')](_['merge'](_0x21c315,_0x14dd5f[_0xb347('0x48')]),{'include':_0x14dd5f[_0xb347('0x2f')][_0xb347('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x4a2206})[_0xb347('0x22')](function(_0x35616e){var _0x3adf08=_0x35616e[_0xb347('0x49')]({'plain':!![]});return db[_0xb347('0x4f')][_0xb347('0x50')]({'where':{'userProfileId':_0x14dd5f[_0xb347('0x41')]['id']},'raw':!![]})[_0xb347('0x22')](function(_0x1ed5b9){if(_0x1ed5b9){return BPromise[_0xb347('0x51')](_0x1ed5b9,function(_0x38d914){return new BPromise(function(_0xf8994e,_0x15dbc1){if(_0x38d914[_0xb347('0x52')]===null||_0x38d914[_0xb347('0x52')]===0x1)_0xf8994e(null);return db[_0xb347('0x53')]['findAll']({'where':{'sectionId':_0x38d914['id']},'raw':!![]})[_0xb347('0x22')](function(_0x44eaad){var _0x50e18a=_[_0xb347('0x29')](_0x44eaad,function(_0x4535e1){return qs[_0xb347('0x54')](_0x4535e1,['id',_0xb347('0x4a'),_0xb347('0x4c'),_0xb347('0x55')]);});_0xf8994e(_0x50e18a);})[_0xb347('0x3f')](function(_0x15726d){_0x15dbc1(_0x15726d);});})[_0xb347('0x22')](function(_0x2b820a){var _0x160ca9=qs['omit'](_0x38d914,['id',_0xb347('0x4a'),_0xb347('0x4c')]);_0x160ca9[_0xb347('0x56')]=_0x3adf08['id'];if(_0x2b820a)_0x160ca9[_0xb347('0x57')]=_0x2b820a;return _0x160ca9;})[_0xb347('0x22')](function(_0x474294){return db['UserProfileSection'][_0xb347('0x47')](_0x474294,{'include':[{'model':db[_0xb347('0x53')],'as':_0xb347('0x57')}],'raw':!![],'transaction':_0x4a2206});});})[_0xb347('0x22')](function(){return _0x3adf08;});}});});});}})[_0xb347('0x22')](respondWithResult(_0x47d55d,0xc9))[_0xb347('0x3f')](handleError(_0x47d55d,null));};exports[_0xb347('0x58')]=function(_0x556d82,_0x1a6035){if(_0x556d82[_0xb347('0x48')]['id']){delete _0x556d82[_0xb347('0x48')]['id'];}return db[_0xb347('0x2a')][_0xb347('0x46')]({'where':{'id':_0x556d82[_0xb347('0x41')]['id']}})[_0xb347('0x22')](handleEntityNotFound(_0x1a6035,null))[_0xb347('0x22')](saveUpdates(_0x556d82[_0xb347('0x48')],null))[_0xb347('0x22')](respondWithResult(_0x1a6035,null))[_0xb347('0x3f')](handleError(_0x1a6035,null));};exports[_0xb347('0x23')]=function(_0x23dd50,_0x310cbb){return db['UserProfile']['find']({'where':{'id':_0x23dd50[_0xb347('0x41')]['id']}})[_0xb347('0x22')](handleEntityNotFound(_0x310cbb,null))[_0xb347('0x22')](removeEntity(_0x310cbb,null))[_0xb347('0x3f')](handleError(_0x310cbb,null));};exports[_0xb347('0x59')]=function(_0x14c1e2,_0x38418e){return db[_0xb347('0x2a')][_0xb347('0x59')]()[_0xb347('0x22')](respondWithResult(_0x38418e,null))[_0xb347('0x3f')](handleError(_0x38418e,null));};exports[_0xb347('0x5a')]=function(_0x4a1d64,_0x305c8e){var _0x1be208=_0x4a1d64['body'];return db[_0xb347('0x2a')][_0xb347('0x46')]({'where':{'id':_0x4a1d64[_0xb347('0x41')]['id']}})[_0xb347('0x22')](handleEntityNotFound(_0x305c8e,null))[_0xb347('0x22')](function(_0x102010){if(_0x102010){return db[_0xb347('0x4d')]['transaction'](function(_0x4c0bfb){return db[_0xb347('0x4f')][_0xb347('0x23')]({'where':{'userProfileId':_0x4a1d64[_0xb347('0x41')]['id'],'sectionId':_[_0xb347('0x29')](_0x1be208,function(_0x5e1509){return _0x5e1509[_0xb347('0x55')];})},'transaction':_0x4c0bfb})[_0xb347('0x22')](function(){var _0x16bec1=_[_0xb347('0x29')](_0x1be208,function(_0x53af58){_0x53af58['userProfileId']=_0x4a1d64[_0xb347('0x41')]['id'];return _0x53af58;});var _0x2de175=[];return BPromise[_0xb347('0x51')](_0x16bec1,function(_0x5eea70){return db[_0xb347('0x4f')][_0xb347('0x47')](_0x5eea70,{'include':[{'model':db['UserProfileResource'],'as':_0xb347('0x57')}],'raw':!![],'transaction':_0x4c0bfb})[_0xb347('0x22')](function(_0x1158ea){_0x2de175[_0xb347('0x5b')](_0x1158ea[_0xb347('0x49')]({'plain':!![]}));});})['then'](function(){return _0x2de175;});});});}})[_0xb347('0x22')](function(_0x343606){return _0x343606;})[_0xb347('0x22')](respondWithResult(_0x305c8e,null))[_0xb347('0x3f')](handleError(_0x305c8e,null));};exports['removeSections']=function(_0x1a5132,_0x3a8cae){var _0x2530cb;return db[_0xb347('0x2a')]['find']({'where':{'id':_0x1a5132['params']['id']},'attributes':['id','name']})[_0xb347('0x22')](handleEntityNotFound(_0x3a8cae,null))[_0xb347('0x22')](function(_0x54c8f2){if(_0x54c8f2){_0x2530cb=_0x54c8f2;return db[_0xb347('0x4f')][_0xb347('0x23')]({'where':{'userProfileId':_0x1a5132['params']['id'],'sectionId':_0x1a5132['query'][_0xb347('0x5c')]}});}})[_0xb347('0x22')](function(){return _0x2530cb;})[_0xb347('0x22')](respondWithStatusCode(_0x3a8cae,null))['catch'](handleError(_0x3a8cae,null));};exports['getSections']=function(_0xdc4411,_0x3c7f5d){var _0x296821=[];var _0x1a06dd=[];return db[_0xb347('0x4f')][_0xb347('0x50')]({'where':{'userProfileId':_0xdc4411[_0xb347('0x41')]['id']},'raw':!![]})[_0xb347('0x22')](function(_0x4b8fec){_0x296821=_[_0xb347('0x3c')](_0x4b8fec,function(_0x26bc1f){return _0x26bc1f['enabled']===0x1||_[_0xb347('0x5d')]([0x3eb,0x709],_0x26bc1f[_0xb347('0x55')]);});if(!_['isEmpty'](_0x296821)){return _['map'](_0x296821,function(_0x45073d){return _0x45073d[_0xb347('0x55')];});}else{return;}})[_0xb347('0x22')](function(_0x57fa1f){if(_0x57fa1f)_0x1a06dd=_0x57fa1f;if(_[_0xb347('0x5d')](_0x1a06dd,0x64)){var _0x1cba44=_[_0xb347('0x46')](_0x296821,{'sectionId':0x64});return hasDefaultDashboard(_0x1cba44)[_0xb347('0x22')](function(_0x3846d6){return _['map'](_0x296821,function(_0x3692c4){if(_0x3692c4[_0xb347('0x55')]===0x64){_0x3692c4[_0xb347('0x5e')]=_0x3846d6;}return _0x3692c4;});});}else{return;}})[_0xb347('0x22')](function(_0x422de4){if(_0x422de4)_0x296821=_0x422de4;if(_[_0xb347('0x5d')](_0x1a06dd,0x3eb)){var _0x92ef3e=_[_0xb347('0x46')](_0x296821,{'sectionId':0x3eb});return getCustomDashboards(_0x92ef3e)['then'](function(_0x4a6587){return _['map'](_0x296821,function(_0x1b5972){if(_0x92ef3e[_0xb347('0x5f')]){if(_0x1b5972[_0xb347('0x55')]===0x3eb){_0x1b5972[_0xb347('0x5e')]=_0x4a6587;}}else{if(_0x1b5972[_0xb347('0x55')]===0x64){_0x1b5972[_0xb347('0x5e')]=_0x4a6587;}}return _0x1b5972;});});}else{return;}})[_0xb347('0x22')](function(_0xae22a4){if(_0xae22a4)_0x296821=_0xae22a4;if(_[_0xb347('0x5d')](_0x1a06dd,0x709)){var _0x26b021=_[_0xb347('0x46')](_0x296821,{'sectionId':0x709});return getPlugins(_0x26b021)[_0xb347('0x22')](function(_0x1e3fa7){if(_0x26b021[_0xb347('0x5f')]){return _[_0xb347('0x29')](_0x296821,function(_0x1b5020){if(_0x1b5020[_0xb347('0x55')]===0x709){_0x1b5020[_0xb347('0x5e')]=_0x1e3fa7;}return _0x1b5020;});}else{var _0x5c98ec={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1e3fa7};var _0x565bdb=_['map'](_0x296821);_0x565bdb[_0xb347('0x5b')](_0x5c98ec);return _0x565bdb;}});}else{return;}})[_0xb347('0x22')](function(_0x37bc93){if(_0x37bc93)_0x296821=_0x37bc93;return _['filter'](_0x296821,[_0xb347('0x5f'),0x1]);})[_0xb347('0x22')](respondWithResult(_0x3c7f5d,null))['catch'](handleError(_0x3c7f5d,null));};function hasDefaultDashboard(_0x434b3b){var _0x380a45=[0x65];return new BPromise(function(_0x3a79d3,_0x4583c7){try{if(_0x434b3b[_0xb347('0x52')]){_0x3a79d3(_0x380a45);}else{return db[_0xb347('0x53')][_0xb347('0x60')]({'where':{'sectionId':_0x434b3b['id']},'raw':!![]})[_0xb347('0x22')](function(_0x2c4570){_0x2c4570?_0x3a79d3(_0x380a45):_0x3a79d3();});}}catch(_0x4915fe){_0x4583c7(_0x4915fe);}});}function getCustomDashboards(_0x406834){var _0x3c8a49=[];return new BPromise(function(_0x270459,_0x17b85e){try{if(_0x406834['autoAssociation']){return db[_0xb347('0x61')]['findAll']({'raw':!![]})[_0xb347('0x22')](function(_0x5520ef){_0x5520ef[_0xb347('0x62')](function(_0x4c4957){_0x3c8a49[_0xb347('0x5b')](_0x4c4957['id']+0x1869f);});_0x270459(_0x3c8a49);});}else{return db[_0xb347('0x53')][_0xb347('0x50')]({'where':{'sectionId':_0x406834['id']},'raw':!![]})[_0xb347('0x22')](function(_0x5e00bb){_0x5e00bb[_0xb347('0x62')](function(_0x439255){_0x3c8a49['push'](_0x439255[_0xb347('0x63')]+0x1869f);});_0x270459(_0x3c8a49);});}}catch(_0x11563a){_0x17b85e(_0x11563a);}});}function getPlugins(_0x1b89d6){var _0x3a5cd2=[];return new BPromise(function(_0x370ea8,_0x29634f){try{if(_0x1b89d6['autoAssociation']){return db[_0xb347('0x64')]['findAll']({'raw':!![]})['then'](function(_0x3cb7c0){_0x3cb7c0[_0xb347('0x62')](function(_0x5e9171){_0x3a5cd2[_0xb347('0x5b')](_0x5e9171['id']+0x15b38);});_0x370ea8(_0x3a5cd2);});}else{return db[_0xb347('0x53')][_0xb347('0x50')]({'where':{'sectionId':_0x1b89d6['id']},'raw':!![]})[_0xb347('0x22')](function(_0x285760){_0x285760[_0xb347('0x62')](function(_0x38a6ab){_0x3a5cd2[_0xb347('0x5b')](_0x38a6ab[_0xb347('0x63')]+0x15b38);});_0x370ea8(_0x3a5cd2);});}}catch(_0x11a9fc){_0x29634f(_0x11a9fc);}});}exports[_0xb347('0x65')]=function(_0x1545c2,_0x41042c){return db['UserProfile'][_0xb347('0x46')]({'where':{'id':_0x1545c2[_0xb347('0x41')]['id']}})[_0xb347('0x22')](handleEntityNotFound(_0x41042c,null))[_0xb347('0x22')](function(_0x32f5c5){if(_0x32f5c5){return db[_0xb347('0x4d')]['transaction'](function(_0x4c6ccf){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1545c2[_0xb347('0x41')]['id']},'attributes':['id'],'raw':!![]})[_0xb347('0x22')](function(_0x5c4004){if(_0x5c4004){return db[_0xb347('0x4f')][_0xb347('0x23')]({'where':{'userProfileId':_0x1545c2[_0xb347('0x41')]['id'],'id':_[_0xb347('0x29')](_0x5c4004,function(_0x1a639e){return _0x1a639e['id'];})},'transaction':_0x4c6ccf});}})[_0xb347('0x22')](function(_0x3a5317){var _0x2c10f5=_[_0xb347('0x29')](_0x1545c2[_0xb347('0x48')],function(_0x4632e5){_0x4632e5['userProfileId']=_0x1545c2[_0xb347('0x41')]['id'];return _0x4632e5;});return db[_0xb347('0x4f')][_0xb347('0x66')](_0x2c10f5,{'raw':!![],'transaction':_0x4c6ccf});})[_0xb347('0x22')](function(_0x52e653){var _0x3e4d43=_[_0xb347('0x3c')](_[_0xb347('0x29')](_0x52e653,function(_0x9d1b){return _0x9d1b[_0xb347('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x3e4d43){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1545c2[_0xb347('0x41')]['id'],'sectionId':_[_0xb347('0x29')](_0x3e4d43,function(_0x315eea){return _0x315eea[_0xb347('0x55')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x22157f){var _0x1b9ba2=_[_0xb347('0x29')](_0x1545c2[_0xb347('0x48')],function(_0x3f79ce){_0x3f79ce[_0xb347('0x56')]=_0x1545c2[_0xb347('0x41')]['id'];return _0x3f79ce;});return db[_0xb347('0x53')][_0xb347('0x66')](_0x1b9ba2,{'raw':!![],'transaction':_0x4c6ccf});});}})['catch'](handleError(_0x41042c,null));});}})[_0xb347('0x22')](function(_0x1e4ea8){var _0x4b6201=_[_0xb347('0x29')](_0x1e4ea8,function(_0x336431){return _0x336431[_0xb347('0x49')]({'plain':!![]});});})[_0xb347('0x22')](respondWithResult(_0x41042c,null))[_0xb347('0x3f')](handleError(_0x41042c,null));};exports[_0xb347('0x67')]=function(_0x1aa7d9,_0x5cb3ea,_0x3552d7){return db[_0xb347('0x2a')][_0xb347('0x46')]({'where':{'id':_0x1aa7d9[_0xb347('0x41')]['id']}})['then'](handleEntityNotFound(_0x5cb3ea,null))[_0xb347('0x22')](function(_0x4402a6){if(_0x4402a6){return _0x4402a6[_0xb347('0x67')](_0x1aa7d9[_0xb347('0x2f')][_0xb347('0x5c')]);}})['then'](respondWithStatusCode(_0x5cb3ea,null))['catch'](handleError(_0x5cb3ea,null));};exports[_0xb347('0x68')]=function(_0x178763,_0x4f5b01){var _0x3606b7={'raw':![],'where':{}};var _0x244566={};var _0x2a59aa={'count':0x0,'rows':[]};var _0x4ccff3=_0x178763[_0xb347('0x2f')][_0xb347('0x69')];if(typeof _0x4ccff3===_0xb347('0x6a')){throw new db['Sequelize'][(_0xb347('0x6b'))](_0xb347('0x6c'));}var _0x545301=_0x178763[_0xb347('0x2f')]['mergeResources']||![];var _0x3f1c05=getQueryModels(_0x4ccff3,_0x545301);if(typeof _0x3f1c05[_0xb347('0x6d')]===_0xb347('0x6a')){throw new db['Sequelize'][(_0xb347('0x6b'))](_0xb347('0x6e')+_0x4ccff3+'\x27');}var _0x4c0a58=[];if(!_[_0xb347('0x6f')](_0x3f1c05[_0xb347('0x70')])){_0x4c0a58=_0x3f1c05[_0xb347('0x70')];}else{_0x4c0a58=[{'name':_0x4ccff3}];}return db[_0xb347('0x2a')][_0xb347('0x60')]({'where':{'id':_0x178763[_0xb347('0x41')]['id']}})[_0xb347('0x22')](handleEntityNotFound(_0x4f5b01,null))['then'](function(_0x28450b){if(_0x28450b){var _0x241251=[];for(var _0x372564=0x0;_0x372564<_0x4c0a58['length'];_0x372564++){_0x241251['push'](db['UserProfileSection']['findOne']({'where':{'userProfileId':_0x28450b['id'],'name':_0x4c0a58[_0x372564][_0xb347('0x27')]},'raw':!![]}));}return BPromise[_0xb347('0x71')](_0x241251);}})[_0xb347('0x22')](function(_0x5c44aa){var _0x170b71=_[_0xb347('0x3c')](_0x5c44aa,function(_0x188313){return _0x188313?_0x188313:undefined;});var _0x2c86b3=_[_0xb347('0x3c')](_0x4c0a58,[_0xb347('0x72'),!![]]);var _0x2864a5=_[_0xb347('0x6f')](_0x170b71)&&_[_0xb347('0x6f')](_0x2c86b3)?null:_[_0xb347('0x73')](_0x2c86b3,_0x170b71);if(_0x2864a5){var _0x271b93=[];for(var _0xf5a12b=0x0;_0xf5a12b<_0x2864a5[_0xb347('0x34')];_0xf5a12b++){var _0x268dd2=_[_0xb347('0x46')](_0x4c0a58,function(_0x5526b2){return _0x2864a5[_0xf5a12b]?_0x5526b2[_0xb347('0x27')]===_0x2864a5[_0xf5a12b][_0xb347('0x27')]:null;});if(_0x268dd2){if(_0x2864a5[_0xf5a12b]['ignore']){_0x271b93[_0xb347('0x5b')](getAllResources(_0x3f1c05['childModel'],_0x2864a5[_0xf5a12b]));}else{if(!_0x2864a5[_0xf5a12b][_0xb347('0x52')]){_0x271b93[_0xb347('0x5b')](getAllowedResources(_0x268dd2,_0x2864a5[_0xf5a12b],_0x3f1c05[_0xb347('0x6d')]));}else{if(_0x268dd2[_0xb347('0x2d')]){_0x271b93[_0xb347('0x5b')](getAllFilteredResources(_0x268dd2,_0x2864a5[_0xf5a12b]));}}}}}return BPromise[_0xb347('0x71')](_0x271b93);}else{return null;}})['then'](function(_0x34a2fd){var _0x385e8=_0x34a2fd;var _0x3d61d6=null;if(_0x385e8){_0x3d61d6=_0x385e8[_0xb347('0x34')]===0x1?_0x385e8[0x0]:null;}if(_0x3d61d6||_0x385e8){var _0x46b0e2=db[_0x3f1c05[_0xb347('0x6d')]][_0xb347('0x42')];_0x244566[_0xb347('0x2d')]=_[_0xb347('0x2e')](_0x46b0e2);_0x244566[_0xb347('0x2f')]=_[_0xb347('0x2e')](_0x178763[_0xb347('0x2f')]);_0x244566['filters']=_[_0xb347('0x31')](_0x244566['model'],_0x244566[_0xb347('0x2f')]);_0x3606b7['attributes']=_[_0xb347('0x31')](_0x244566['model'],qs[_0xb347('0x33')](_0x178763[_0xb347('0x2f')][_0xb347('0x33')]));_0x3606b7[_0xb347('0x32')]=_0x3606b7[_0xb347('0x32')]['length']?_0x3606b7[_0xb347('0x32')]:_0x244566[_0xb347('0x2d')];if(!_0x178763[_0xb347('0x2f')]['hasOwnProperty'](_0xb347('0x35'))){_0x3606b7['limit']=qs[_0xb347('0x1e')](_0x178763['query'][_0xb347('0x1e')]);_0x3606b7[_0xb347('0x1d')]=qs[_0xb347('0x1d')](_0x178763['query'][_0xb347('0x1d')]);}_0x3606b7['order']=qs[_0xb347('0x37')](_0x178763[_0xb347('0x2f')]['sort']);_0x3606b7[_0xb347('0x38')]=qs[_0xb347('0x30')](_[_0xb347('0x39')](_0x178763['query'],_0x244566[_0xb347('0x30')]));if(_0x178763[_0xb347('0x2f')][_0xb347('0x3c')]){_0x3606b7[_0xb347('0x38')]=_[_0xb347('0x3a')](_0x3606b7[_0xb347('0x38')],{'$or':_[_0xb347('0x29')](_0x46b0e2,function(_0x28e4b4){if(_0x28e4b4[_0xb347('0x3b')]['key']!=='VIRTUAL'){var _0x1f67be={};_0x1f67be[_0x28e4b4['field']]={'$like':'%'+_0x178763[_0xb347('0x2f')][_0xb347('0x3c')]+'%'};return _0x1f67be;}})});}var _0x2cb654=[];if(_0x3d61d6){var _0x353751=_[_0xb347('0x46')](_0x4c0a58,[_0xb347('0x27'),_0x3d61d6[_0xb347('0x27')]]);if(_0x353751[_0xb347('0x74')]){var _0x414008={};if(_0x3f1c05['childModel']==='AnalyticExtractedReport'){_0x414008[_0x353751[_0xb347('0x75')]]=_[_0xb347('0x29')](_0x3d61d6[_0xb347('0x76')],'id');}else{_0x414008[_0x353751[_0xb347('0x75')]]=_0x3d61d6['associatedResources'];}_0x2cb654['push'](_0x414008);}else{_0x3606b7['where']['id']=_0x3d61d6[_0xb347('0x76')];}}else{for(var _0x34a973=0x0;_0x34a973<_0x385e8['length'];_0x34a973++){var _0x353751=_[_0xb347('0x46')](_0x4c0a58,[_0xb347('0x27'),_0x385e8[_0x34a973][_0xb347('0x27')]]);if(_0x353751[_0xb347('0x74')]){var _0x414008={};_0x414008[_0x353751['foreignKey']]=_0x385e8[_0x34a973][_0xb347('0x76')];_0x2cb654[_0xb347('0x5b')](_0x414008);}else{if(!_0x3606b7['where']['id'])_0x3606b7[_0xb347('0x38')]['id']=[];_0x385e8[_0x34a973][_0xb347('0x76')]['forEach'](function(_0x354439){_0x3606b7[_0xb347('0x38')]['id'][_0xb347('0x5b')](_0x354439);});}}}if(!_[_0xb347('0x6f')](_0x2cb654)){_0x3606b7['where']=_[_0xb347('0x3a')](_0x3606b7['where'],{'$and':{'$or':_0x2cb654}});}_0x3606b7=_[_0xb347('0x3a')]({},_0x3606b7,_0x178763['options']);if(_0x3d61d6&&!_0x3d61d6[_0xb347('0x52')]&&_0x3f1c05[_0xb347('0x6d')]==='AnalyticExtractedReport'){if(_0x178763['query'][_0xb347('0x43')]){_0x3606b7[_0xb347('0x44')]=[{'all':!![]}];}return db[_0x3f1c05[_0xb347('0x6d')]][_0xb347('0x50')](_0x3606b7)[_0xb347('0x22')](function(_0x2d355b){var _0x3ff8ef=[];_0x2d355b[_0xb347('0x62')](function(_0x498618){var _0x10cd68;switch(_0x498618['reportType']){case _0xb347('0x77'):_0x10cd68=_[_0xb347('0x46')](_0x3d61d6['associatedResources'],function(_0x53c223){return _0x53c223['id']===_0x498618[_0xb347('0x78')]&&_0x53c223[_0xb347('0x3b')]===_0xb347('0x79');});break;case'custom':_0x10cd68=_[_0xb347('0x46')](_0x3d61d6[_0xb347('0x76')],function(_0x15e3c7){return _0x15e3c7['id']===_0x498618[_0xb347('0x78')]&&_0x15e3c7[_0xb347('0x3b')]===_0xb347('0x7a');});break;}if(_0x10cd68)_0x3ff8ef['push'](_0x498618);});_0x2a59aa[_0xb347('0x3d')]=_0x3ff8ef[_0xb347('0x34')];_0x2a59aa[_0xb347('0x3e')]=_0x3ff8ef;return _0x2a59aa;});}else{return db[_0x3f1c05[_0xb347('0x6d')]][_0xb347('0x3d')]({'where':_0x3606b7[_0xb347('0x38')]})['then'](function(_0x2c4946){_0x2a59aa[_0xb347('0x3d')]=_0x2c4946;if(_0x178763['query'][_0xb347('0x43')]){if(_0x3f1c05[_0xb347('0x6d')]===_0xb347('0x7b')){_0x3606b7[_0xb347('0x44')]=[{'model':db[_0xb347('0x7c')],'as':_0xb347('0x7d'),'attributes':['id','name',_0xb347('0x7e')],'required':_0x178763[_0xb347('0x2f')][_0xb347('0x7f')]?!![]:![]},{'model':db[_0xb347('0x7c')],'as':_0xb347('0x80'),'attributes':['id','name',_0xb347('0x7e')],'through':_0x178763[_0xb347('0x2f')][_0xb347('0x7f')]?{'attributes':[],'where':{'TagId':_0x178763[_0xb347('0x2f')][_0xb347('0x7f')]||undefined}}:{},'required':_0x178763['query'][_0xb347('0x7f')]?!![]:![]}];}else{_0x3606b7['include']=[{'all':!![]}];}}return db[_0x3f1c05[_0xb347('0x6d')]][_0xb347('0x50')](_0x3606b7);})[_0xb347('0x22')](function(_0x423c82){_0x2a59aa[_0xb347('0x3e')]=_0x423c82;return _0x2a59aa;});}}else{return _0x2a59aa;}})['then'](respondWithFilteredResult(_0x4f5b01,_0x3606b7))['catch'](handleError(_0x4f5b01,null));};function getAllResources(_0x17400e,_0x2ec0ac){return new BPromise(function(_0x5ea147,_0x2318bc){if(_0x2ec0ac){var _0x2108e8=_0x2ec0ac['filter']?{[_0x2ec0ac[_0xb347('0x3c')][_0xb347('0x74')]]:_0x2ec0ac[_0xb347('0x3c')][_0xb347('0x81')]}:undefined;return db[_0x17400e][_0xb347('0x50')]({'where':_0x2108e8,'raw':!![]})['then'](function(_0x3e5db8){_0x2ec0ac['associatedResources']=_['map'](_0x3e5db8,'id');_0x5ea147(_0x2ec0ac);})[_0xb347('0x3f')](function(_0x1fdbb3){_0x2318bc(_0x1fdbb3);});}else{_0x5ea147(null);}});}function getAllFilteredResources(_0x2d4621,_0x1c4d1f){return new BPromise(function(_0x37aa13,_0x3080ec){var _0x3840f0=_0x2d4621[_0xb347('0x3c')]?{[_0x2d4621[_0xb347('0x3c')][_0xb347('0x74')]]:_0x2d4621['filter'][_0xb347('0x81')]}:undefined;return db[_0x2d4621[_0xb347('0x2d')]]['findAll']({'where':_0x3840f0,'raw':!![]})[_0xb347('0x22')](function(_0x160159){_0x1c4d1f['associatedResources']=_[_0xb347('0x29')](_0x160159,function(_0x22e6b5){return _0x22e6b5[_0xb347('0x27')];});_0x37aa13(_0x1c4d1f);})[_0xb347('0x3f')](function(_0x236518){_0x3080ec(_0x236518);});});}function getAllowedResources(_0x4bac17,_0xdb12bc,_0x42604f){return new BPromise(function(_0x86ac3e,_0x3bfbc6){if(_0xdb12bc){return db[_0xb347('0x53')][_0xb347('0x50')]({'where':{'sectionId':_0xdb12bc['id']},'raw':!![]})['then'](function(_0x3fe68d){if(_0x4bac17['field']&&_0x4bac17[_0xb347('0x74')]!=='id'){_0xdb12bc[_0xb347('0x76')]=_[_0xb347('0x29')](_0x3fe68d,function(_0x2b424a){return _0x2b424a[_0x4bac17[_0xb347('0x74')]];});}else{if(_0x42604f===_0xb347('0x82')){_0xdb12bc['associatedResources']=_[_0xb347('0x29')](_0x3fe68d,function(_0x4db9c8){return{'id':_0x4db9c8[_0xb347('0x63')],'type':_0x4db9c8[_0xb347('0x3b')]};});}else{_0xdb12bc['associatedResources']=_[_0xb347('0x29')](_0x3fe68d,function(_0x3d4439){return _0x3d4439[_0xb347('0x63')];});}}_0x86ac3e(_0xdb12bc);})[_0xb347('0x3f')](function(_0x3118be){_0x3bfbc6(_0x3118be);});}else{_0x86ac3e(null);}});}function getQueryModels(_0x2aa6f0,_0x342920){var _0x4dd757=_0x2aa6f0[_0xb347('0x83')]();var _0x1171c5={'childModel':undefined,'parentSections':[]};switch(_0x4dd757){case _0xb347('0x84'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0x85');break;case _0xb347('0x86'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0x87');break;case _0xb347('0x88'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0x89');_0x1171c5['parentSections']=[{'name':_0xb347('0x8a'),'field':'name','foreignKey':_0xb347('0x8b')}];break;case _0xb347('0x8c'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0x8d');break;case'contacts':_0x1171c5['childModel']=_0xb347('0x7b');_0x1171c5[_0xb347('0x70')]=[{'name':_0xb347('0x8e'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x1171c5[_0xb347('0x6d')]='CmList';break;case _0xb347('0x8f'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0x90');break;case'globalcustomfields':_0x1171c5['childModel']=_0xb347('0x91');break;case'chatqueues':_0x1171c5[_0xb347('0x6d')]=_0xb347('0x92');break;case'chatwebsites':_0x1171c5['childModel']='ChatWebsite';break;case _0xb347('0x93'):_0x1171c5['childModel']='FaxQueue';break;case _0xb347('0x94'):_0x1171c5[_0xb347('0x6d')]='FaxAccount';break;case _0xb347('0x95'):case _0xb347('0x96'):case _0xb347('0x97'):_0x1171c5[_0xb347('0x6d')]='VoiceExtension';break;case'contexts':_0x1171c5[_0xb347('0x6d')]=_0xb347('0x98');break;case _0xb347('0x99'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0x9a');break;case _0xb347('0x9b'):_0x1171c5[_0xb347('0x6d')]='VoiceRecording';_0x1171c5[_0xb347('0x70')]=[{'name':_0xb347('0x9c'),'field':_0xb347('0x27'),'foreignKey':_0xb347('0x9d'),'model':_0xb347('0x9e'),'filter':{'field':'role','value':[_0xb347('0x9f')]}},{'name':_0xb347('0xa0'),'field':_0xb347('0x27'),'foreignKey':_0xb347('0x9d'),'model':_0xb347('0x9e'),'filter':{'field':_0xb347('0xa1'),'value':['telephone']}},{'name':_0xb347('0xa2'),'field':'name','foreignKey':_0xb347('0xa3'),'model':_0xb347('0xa4'),'filter':{'field':_0xb347('0x3b'),'value':[_0xb347('0xa5')]}},{'name':_0xb347('0xa6'),'field':_0xb347('0x27'),'foreignKey':'queue','model':_0xb347('0xa4'),'filter':{'field':_0xb347('0x3b'),'value':[_0xb347('0xa7')]}}];break;case _0xb347('0xa8'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xa9');break;case _0xb347('0xaa'):_0x1171c5[_0xb347('0x6d')]='VoiceChanSpy';break;case _0xb347('0xab'):_0x1171c5['childModel']=_0xb347('0xac');break;case _0xb347('0xad'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xae');break;case _0xb347('0xaf'):_0x1171c5['childModel']=_0xb347('0xb0');break;case _0xb347('0xb1'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xb2');break;case'mailsubstatuses':_0x1171c5['childModel']='MailSubstatus';break;case _0xb347('0xb3'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xb4');break;case _0xb347('0xb5'):_0x1171c5[_0xb347('0x6d')]='OpenchannelAccount';break;case _0xb347('0xb6'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xb7');break;case _0xb347('0xb8'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xb9');break;case _0xb347('0xba'):_0x1171c5[_0xb347('0x6d')]='WhatsappQueue';break;case _0xb347('0xbb'):_0x1171c5['childModel']=_0xb347('0xbc');break;case _0xb347('0xbd'):_0x1171c5['childModel']='Team';break;case _0xb347('0xbe'):case'queuecampaigns':_0x1171c5[_0xb347('0x6d')]=_0xb347('0xa4');if(_0x342920){_0x1171c5[_0xb347('0x70')]=[{'name':_0xb347('0xa2')},{'name':_0xb347('0xa6')}];}break;case'users':case _0xb347('0xbf'):case _0xb347('0xc0'):_0x1171c5[_0xb347('0x6d')]='User';if(_0x342920){_0x1171c5[_0xb347('0x70')]=[{'name':_0xb347('0xc1'),'filter':{'field':_0xb347('0xa1'),'value':[_0xb347('0xc2'),_0xb347('0xc3')]},'ignore':!![]},{'name':_0xb347('0x9c')},{'name':'Telephones'}];}break;case _0xb347('0xc4'):_0x1171c5['childModel']=_0xb347('0xc5');break;case'salesforceaccounts':_0x1171c5[_0xb347('0x6d')]='SalesforceAccount';break;case'freshdeskaccounts':_0x1171c5[_0xb347('0x6d')]=_0xb347('0xc6');break;case _0xb347('0xc7'):_0x1171c5[_0xb347('0x6d')]='SugarcrmAccount';break;case _0xb347('0xc8'):_0x1171c5[_0xb347('0x6d')]='DeskAccount';break;case _0xb347('0xc9'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xca');break;case _0xb347('0xcb'):_0x1171c5[_0xb347('0x6d')]='User';break;case'cannedanswers':_0x1171c5[_0xb347('0x6d')]=_0xb347('0xcc');break;case _0xb347('0xcd'):_0x1171c5['childModel']=_0xb347('0xce');break;case'customdashboards':_0x1171c5[_0xb347('0x6d')]=_0xb347('0x61');break;case _0xb347('0xcf'):_0x1171c5[_0xb347('0x6d')]='Interval';break;case _0xb347('0xd0'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xd1');break;case _0xb347('0xd2'):_0x1171c5['childModel']='Schedule';break;case _0xb347('0xd3'):_0x1171c5[_0xb347('0x6d')]='Sound';break;case _0xb347('0xd4'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0x7c');break;case _0xb347('0xd5'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xd6');break;case _0xb347('0xd7'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xd8');break;case'trunks':_0x1171c5[_0xb347('0x6d')]=_0xb347('0xd9');break;case _0xb347('0xda'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xdb');break;case _0xb347('0xdc'):_0x1171c5['childModel']=_0xb347('0x64');break;case _0xb347('0xdd'):_0x1171c5['childModel']='AnalyticExtractedReport';_0x1171c5[_0xb347('0x70')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xb347('0xde'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xdf');break;case _0xb347('0xbb'):_0x1171c5[_0xb347('0x6d')]=_0xb347('0xbc');break;default:return _0x1171c5;}return _0x1171c5;} \ No newline at end of file +var _0x0186=['reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','tag','ThroughTags','rows','value','toLowerCase','squareprojects','odbc','SquareOdbc','squarerecordings','projectName','JscriptyProject','contacts','ListId','lists','CmList','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','voicerecordings','membername','agent','Telephones','User','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','extractedreports','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','json','count','offset','Content-Range','apply','save','update','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','params','find','catch','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','removeSections','ids','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','userProfileId','bulkCreate','removeResources','getResources','section','undefined','ValidationError','Unknown\x20section','mergeResources','childModel','Sequelize','parentSections','all','ignore','hasOwnProperty','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default'];(function(_0x1d4bb9,_0x4bdaac){var _0x4cb19f=function(_0x5a28a9){while(--_0x5a28a9){_0x1d4bb9['push'](_0x1d4bb9['shift']());}};_0x4cb19f(++_0x4bdaac);}(_0x0186,0x15a));var _0x6018=function(_0x4cc459,_0x533b85){_0x4cc459=_0x4cc459-0x0;var _0x5416de=_0x0186[_0x4cc459];return _0x5416de;};'use strict';var pdf=require(_0x6018('0x0'));var emlformat=require(_0x6018('0x1'));var rimraf=require(_0x6018('0x2'));var zipdir=require(_0x6018('0x3'));var jsonpatch=require(_0x6018('0x4'));var rp=require(_0x6018('0x5'));var moment=require('moment');var BPromise=require(_0x6018('0x6'));var Mustache=require('mustache');var util=require(_0x6018('0x7'));var path=require(_0x6018('0x8'));var sox=require(_0x6018('0x9'));var csv=require(_0x6018('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6018('0xb'));var squel=require(_0x6018('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6018('0xd'));var toCsv=require(_0x6018('0xa'));var querystring=require(_0x6018('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6018('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6018('0x10'));var hardwareService=require(_0x6018('0x11'));var logger=require('../../config/logger')(_0x6018('0x12'));var utils=require('../../config/utils');var config=require(_0x6018('0x13'));var licenseUtil=require(_0x6018('0x14'));var db=require(_0x6018('0x15'))['db'];config[_0x6018('0x16')]=_[_0x6018('0x17')](config['redis'],{'host':_0x6018('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6018('0x19'))[_0x6018('0x1a')](socket);function respondWithStatusCode(_0x80c2e8,_0x524bbd){_0x524bbd=_0x524bbd||0xcc;return function(_0x4e9f6f){if(_0x4e9f6f){return _0x80c2e8[_0x6018('0x1b')](_0x524bbd);}return _0x80c2e8[_0x6018('0x1c')](_0x524bbd)['end']();};}function respondWithResult(_0x366dd9,_0xa75c56){_0xa75c56=_0xa75c56||0xc8;return function(_0x398e88){if(_0x398e88){return _0x366dd9['status'](_0xa75c56)[_0x6018('0x1d')](_0x398e88);}};}function respondWithFilteredResult(_0x3abe27,_0x98e173){return function(_0x32b8c5){if(_0x32b8c5){var _0x53462c=_0x32b8c5[_0x6018('0x1e')],_0x497372=_0x98e173['offset'],_0x21ab13=_0x98e173[_0x6018('0x1f')]+_0x98e173['limit'],_0x2c9b70;if(_0x21ab13>=_0x53462c){_0x21ab13=_0x53462c;_0x2c9b70=0xc8;}else{_0x2c9b70=0xce;}_0x3abe27[_0x6018('0x1c')](_0x2c9b70);return _0x3abe27['set'](_0x6018('0x20'),_0x497372+'-'+_0x21ab13+'/'+_0x53462c)[_0x6018('0x1d')](_0x32b8c5);}return null;};}function patchUpdates(_0x5ed3d5){return function(_0x42f202){try{jsonpatch[_0x6018('0x21')](_0x42f202,_0x5ed3d5,!![]);}catch(_0x4c418e){return BPromise['reject'](_0x4c418e);}return _0x42f202[_0x6018('0x22')]();};}function saveUpdates(_0x349397,_0x3462b1){return function(_0x56c5ca){if(_0x56c5ca){return _0x56c5ca[_0x6018('0x23')](_0x349397)['then'](function(_0x240ea4){return _0x240ea4;});}return null;};}function removeEntity(_0xbfe5b,_0x335b68){return function(_0x251872){if(_0x251872){return _0x251872[_0x6018('0x24')]()['then'](function(){_0xbfe5b[_0x6018('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ee99f,_0x2fc7f2){return function(_0x524834){if(!_0x524834){_0x5ee99f[_0x6018('0x1b')](0x194);}return _0x524834;};}function handleError(_0x26ee0d,_0x4b58ba){_0x4b58ba=_0x4b58ba||0x1f4;return function(_0x21c4c7){logger[_0x6018('0x25')](_0x21c4c7['stack']);if(_0x21c4c7[_0x6018('0x26')]){delete _0x21c4c7['name'];}_0x26ee0d[_0x6018('0x1c')](_0x4b58ba)[_0x6018('0x27')](_0x21c4c7);};}exports[_0x6018('0x28')]=function(_0x2aaa4f,_0x2408ee){var _0x58d766={},_0x5dc150={},_0x3c9035={'count':0x0,'rows':[]};var _0x554be6=_[_0x6018('0x29')](db[_0x6018('0x2a')][_0x6018('0x2b')],function(_0x4ea77d){return{'name':_0x4ea77d[_0x6018('0x2c')],'type':_0x4ea77d[_0x6018('0x2d')][_0x6018('0x2e')]};});_0x5dc150[_0x6018('0x2f')]=_[_0x6018('0x29')](_0x554be6,'name');_0x5dc150[_0x6018('0x30')]=_[_0x6018('0x31')](_0x2aaa4f['query']);_0x5dc150[_0x6018('0x32')]=_[_0x6018('0x33')](_0x5dc150[_0x6018('0x2f')],_0x5dc150['query']);_0x58d766[_0x6018('0x34')]=_['intersection'](_0x5dc150[_0x6018('0x2f')],qs['fields'](_0x2aaa4f[_0x6018('0x30')][_0x6018('0x35')]));_0x58d766[_0x6018('0x34')]=_0x58d766[_0x6018('0x34')][_0x6018('0x36')]?_0x58d766['attributes']:_0x5dc150[_0x6018('0x2f')];if(!_0x2aaa4f['query']['hasOwnProperty'](_0x6018('0x37'))){_0x58d766[_0x6018('0x38')]=qs['limit'](_0x2aaa4f[_0x6018('0x30')][_0x6018('0x38')]);_0x58d766[_0x6018('0x1f')]=qs['offset'](_0x2aaa4f['query'][_0x6018('0x1f')]);}_0x58d766[_0x6018('0x39')]=qs[_0x6018('0x3a')](_0x2aaa4f[_0x6018('0x30')]['sort']);_0x58d766[_0x6018('0x3b')]=qs[_0x6018('0x32')](_['pick'](_0x2aaa4f[_0x6018('0x30')],_0x5dc150['filters']),_0x554be6);if(_0x2aaa4f[_0x6018('0x30')][_0x6018('0x3c')]){_0x58d766[_0x6018('0x3b')]=_[_0x6018('0x3d')](_0x58d766[_0x6018('0x3b')],{'$or':_[_0x6018('0x29')](_0x554be6,function(_0x3833eb){if(_0x3833eb[_0x6018('0x2d')]!==_0x6018('0x3e')){var _0x47a3e5={};_0x47a3e5[_0x3833eb['name']]={'$like':'%'+_0x2aaa4f[_0x6018('0x30')][_0x6018('0x3c')]+'%'};return _0x47a3e5;}})});}_0x58d766=_[_0x6018('0x3d')]({},_0x58d766,_0x2aaa4f[_0x6018('0x3f')]);var _0x1ef243={'where':_0x58d766['where']};return db[_0x6018('0x2a')][_0x6018('0x1e')](_0x1ef243)[_0x6018('0x40')](function(_0x304f44){_0x3c9035[_0x6018('0x1e')]=_0x304f44;if(_0x2aaa4f[_0x6018('0x30')][_0x6018('0x41')]){_0x58d766[_0x6018('0x42')]=[{'all':!![]}];}return db['UserProfile'][_0x6018('0x43')](_0x58d766);})[_0x6018('0x40')](function(_0x295ef3){_0x3c9035['rows']=_0x295ef3;return _0x3c9035;})['then'](respondWithFilteredResult(_0x2408ee,_0x58d766))['catch'](handleError(_0x2408ee,null));};exports['show']=function(_0x33dee6,_0x2ce0f6){var _0x2186c7={'raw':![],'where':{'id':_0x33dee6[_0x6018('0x44')]['id']}},_0x286b8d={};_0x286b8d[_0x6018('0x2f')]=_[_0x6018('0x31')](db[_0x6018('0x2a')][_0x6018('0x2b')]);_0x286b8d[_0x6018('0x30')]=_[_0x6018('0x31')](_0x33dee6[_0x6018('0x30')]);_0x286b8d[_0x6018('0x32')]=_['intersection'](_0x286b8d['model'],_0x286b8d[_0x6018('0x30')]);_0x2186c7[_0x6018('0x34')]=_[_0x6018('0x33')](_0x286b8d[_0x6018('0x2f')],qs['fields'](_0x33dee6['query'][_0x6018('0x35')]));_0x2186c7['attributes']=_0x2186c7[_0x6018('0x34')]['length']?_0x2186c7['attributes']:_0x286b8d['model'];if(_0x33dee6[_0x6018('0x30')][_0x6018('0x41')]){_0x2186c7[_0x6018('0x42')]=[{'all':!![]}];}_0x2186c7=_['merge']({},_0x2186c7,_0x33dee6[_0x6018('0x3f')]);return db[_0x6018('0x2a')][_0x6018('0x45')](_0x2186c7)[_0x6018('0x40')](handleEntityNotFound(_0x2ce0f6,null))[_0x6018('0x40')](respondWithResult(_0x2ce0f6,null))[_0x6018('0x46')](handleError(_0x2ce0f6,null));};exports[_0x6018('0x47')]=function(_0xfb3f9,_0x13a13f){return db[_0x6018('0x2a')][_0x6018('0x47')](_0xfb3f9[_0x6018('0x48')],{})['then'](respondWithResult(_0x13a13f,0xc9))['catch'](handleError(_0x13a13f,null));};exports['clone']=function(_0xe26b50,_0x1dfa02){var _0x401c86={'where':{'id':_0xe26b50['params']['id']}},_0x439a33={};_0x439a33['model']=_['keys'](db[_0x6018('0x2a')]['rawAttributes']);_0x401c86[_0x6018('0x34')]=_[_0x6018('0x33')](_0x439a33['model'],qs[_0x6018('0x35')](_0xe26b50[_0x6018('0x30')][_0x6018('0x35')]));_0x401c86[_0x6018('0x34')]=_0x401c86['attributes'][_0x6018('0x36')]?_0x401c86[_0x6018('0x34')]:_0x439a33['model'];if(_0xe26b50[_0x6018('0x30')]['includeAll']){_0x401c86[_0x6018('0x42')]=[{'all':!![]}];}_0x401c86=_[_0x6018('0x3d')]({},_0x401c86,_0xe26b50['options']);return db[_0x6018('0x2a')][_0x6018('0x45')](_0x401c86)['then'](handleEntityNotFound(_0x1dfa02,null))[_0x6018('0x40')](function(_0x41a3eb){if(_0x41a3eb){var _0x4ffb35=_0x41a3eb[_0x6018('0x49')]({'plain':!![]});_0x4ffb35=qs[_0x6018('0x4a')](_0x4ffb35,['id',_0x6018('0x4b'),_0x6018('0x4c'),_0x6018('0x4d')]);_0xe26b50[_0x6018('0x48')]=_[_0x6018('0x4a')](_0xe26b50[_0x6018('0x48')],['id',_0x6018('0x4b'),_0x6018('0x4c')]);return db[_0x6018('0x4e')][_0x6018('0x4f')](function(_0x244d53){return db[_0x6018('0x2a')][_0x6018('0x47')](_[_0x6018('0x3d')](_0x4ffb35,_0xe26b50[_0x6018('0x48')]),{'include':_0xe26b50[_0x6018('0x30')][_0x6018('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x244d53})['then'](function(_0x21e12d){var _0x51dd05=_0x21e12d[_0x6018('0x49')]({'plain':!![]});return db[_0x6018('0x50')][_0x6018('0x43')]({'where':{'userProfileId':_0xe26b50['params']['id']},'raw':!![]})[_0x6018('0x40')](function(_0x4c1bd3){if(_0x4c1bd3){return BPromise[_0x6018('0x51')](_0x4c1bd3,function(_0x260954){return new BPromise(function(_0x339b7e,_0x28b6d5){if(_0x260954[_0x6018('0x52')]===null||_0x260954[_0x6018('0x52')]===0x1)_0x339b7e(null);return db[_0x6018('0x53')][_0x6018('0x43')]({'where':{'sectionId':_0x260954['id']},'raw':!![]})[_0x6018('0x40')](function(_0x4ae640){var _0x51089f=_[_0x6018('0x29')](_0x4ae640,function(_0x34c38f){return qs[_0x6018('0x4a')](_0x34c38f,['id',_0x6018('0x4b'),'updatedAt',_0x6018('0x54')]);});_0x339b7e(_0x51089f);})[_0x6018('0x46')](function(_0x30e65e){_0x28b6d5(_0x30e65e);});})[_0x6018('0x40')](function(_0x6a2e8d){var _0x5bb57a=qs[_0x6018('0x4a')](_0x260954,['id',_0x6018('0x4b'),_0x6018('0x4c')]);_0x5bb57a['userProfileId']=_0x51dd05['id'];if(_0x6a2e8d)_0x5bb57a[_0x6018('0x55')]=_0x6a2e8d;return _0x5bb57a;})[_0x6018('0x40')](function(_0x10f9a9){return db[_0x6018('0x50')][_0x6018('0x47')](_0x10f9a9,{'include':[{'model':db[_0x6018('0x53')],'as':_0x6018('0x55')}],'raw':!![],'transaction':_0x244d53});});})['then'](function(){return _0x51dd05;});}});});});}})[_0x6018('0x40')](respondWithResult(_0x1dfa02,0xc9))['catch'](handleError(_0x1dfa02,null));};exports[_0x6018('0x23')]=function(_0x148d76,_0x3a17e9){if(_0x148d76['body']['id']){delete _0x148d76[_0x6018('0x48')]['id'];}return db[_0x6018('0x2a')][_0x6018('0x45')]({'where':{'id':_0x148d76[_0x6018('0x44')]['id']}})[_0x6018('0x40')](handleEntityNotFound(_0x3a17e9,null))[_0x6018('0x40')](saveUpdates(_0x148d76[_0x6018('0x48')],null))[_0x6018('0x40')](respondWithResult(_0x3a17e9,null))['catch'](handleError(_0x3a17e9,null));};exports[_0x6018('0x24')]=function(_0x266aca,_0x404ac6){return db[_0x6018('0x2a')][_0x6018('0x45')]({'where':{'id':_0x266aca[_0x6018('0x44')]['id']}})[_0x6018('0x40')](handleEntityNotFound(_0x404ac6,null))[_0x6018('0x40')](removeEntity(_0x404ac6,null))[_0x6018('0x46')](handleError(_0x404ac6,null));};exports[_0x6018('0x56')]=function(_0x1c928a,_0x495f2f){return db['UserProfile'][_0x6018('0x56')]()[_0x6018('0x40')](respondWithResult(_0x495f2f,null))[_0x6018('0x46')](handleError(_0x495f2f,null));};exports[_0x6018('0x57')]=function(_0x180004,_0x3cc336){var _0x518584=_0x180004[_0x6018('0x48')];return db[_0x6018('0x2a')]['find']({'where':{'id':_0x180004[_0x6018('0x44')]['id']}})[_0x6018('0x40')](handleEntityNotFound(_0x3cc336,null))[_0x6018('0x40')](function(_0x132945){if(_0x132945){return db[_0x6018('0x4e')]['transaction'](function(_0x459b42){return db[_0x6018('0x50')][_0x6018('0x24')]({'where':{'userProfileId':_0x180004[_0x6018('0x44')]['id'],'sectionId':_[_0x6018('0x29')](_0x518584,function(_0x4910bc){return _0x4910bc[_0x6018('0x54')];})},'transaction':_0x459b42})[_0x6018('0x40')](function(){var _0x355e17=_[_0x6018('0x29')](_0x518584,function(_0x3f12e7){_0x3f12e7['userProfileId']=_0x180004[_0x6018('0x44')]['id'];return _0x3f12e7;});var _0x4874cd=[];return BPromise[_0x6018('0x51')](_0x355e17,function(_0x26ad63){return db[_0x6018('0x50')]['create'](_0x26ad63,{'include':[{'model':db[_0x6018('0x53')],'as':_0x6018('0x55')}],'raw':!![],'transaction':_0x459b42})['then'](function(_0x2b329b){_0x4874cd['push'](_0x2b329b[_0x6018('0x49')]({'plain':!![]}));});})['then'](function(){return _0x4874cd;});});});}})['then'](function(_0x18eb55){return _0x18eb55;})[_0x6018('0x40')](respondWithResult(_0x3cc336,null))[_0x6018('0x46')](handleError(_0x3cc336,null));};exports[_0x6018('0x58')]=function(_0x39ade8,_0x5c5450){var _0x2b5465;return db['UserProfile'][_0x6018('0x45')]({'where':{'id':_0x39ade8[_0x6018('0x44')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x5c5450,null))[_0x6018('0x40')](function(_0x5ee1ef){if(_0x5ee1ef){_0x2b5465=_0x5ee1ef;return db[_0x6018('0x50')][_0x6018('0x24')]({'where':{'userProfileId':_0x39ade8[_0x6018('0x44')]['id'],'sectionId':_0x39ade8['query'][_0x6018('0x59')]}});}})[_0x6018('0x40')](function(){return _0x2b5465;})[_0x6018('0x40')](respondWithStatusCode(_0x5c5450,null))[_0x6018('0x46')](handleError(_0x5c5450,null));};exports['getSections']=function(_0x36da30,_0x320d64){var _0x39ef7c=[];var _0x5679a9=[];return db[_0x6018('0x50')][_0x6018('0x43')]({'where':{'userProfileId':_0x36da30[_0x6018('0x44')]['id']},'raw':!![]})['then'](function(_0x130282){_0x39ef7c=_[_0x6018('0x3c')](_0x130282,function(_0xb221bb){return _0xb221bb[_0x6018('0x5a')]===0x1||_[_0x6018('0x5b')]([0x3eb,0x709],_0xb221bb['sectionId']);});if(!_[_0x6018('0x5c')](_0x39ef7c)){return _[_0x6018('0x29')](_0x39ef7c,function(_0x197065){return _0x197065[_0x6018('0x54')];});}else{return;}})['then'](function(_0x363e34){if(_0x363e34)_0x5679a9=_0x363e34;if(_[_0x6018('0x5b')](_0x5679a9,0x64)){var _0x2bc720=_[_0x6018('0x45')](_0x39ef7c,{'sectionId':0x64});return hasDefaultDashboard(_0x2bc720)[_0x6018('0x40')](function(_0x5a9242){return _[_0x6018('0x29')](_0x39ef7c,function(_0x53a063){if(_0x53a063[_0x6018('0x54')]===0x64){_0x53a063[_0x6018('0x5d')]=_0x5a9242;}return _0x53a063;});});}else{return;}})['then'](function(_0x413d2e){if(_0x413d2e)_0x39ef7c=_0x413d2e;if(_[_0x6018('0x5b')](_0x5679a9,0x3eb)){var _0x18d859=_[_0x6018('0x45')](_0x39ef7c,{'sectionId':0x3eb});return getCustomDashboards(_0x18d859)['then'](function(_0x22081f){return _[_0x6018('0x29')](_0x39ef7c,function(_0x29c69d){if(_0x18d859['enabled']){if(_0x29c69d[_0x6018('0x54')]===0x3eb){_0x29c69d[_0x6018('0x5d')]=_0x22081f;}}else{if(_0x29c69d[_0x6018('0x54')]===0x64){_0x29c69d[_0x6018('0x5d')]=_0x22081f;}}return _0x29c69d;});});}else{return;}})['then'](function(_0x4d59fe){if(_0x4d59fe)_0x39ef7c=_0x4d59fe;if(_['includes'](_0x5679a9,0x709)){var _0x77ecc9=_[_0x6018('0x45')](_0x39ef7c,{'sectionId':0x709});return getPlugins(_0x77ecc9)[_0x6018('0x40')](function(_0x10c1a5){if(_0x77ecc9['enabled']){return _[_0x6018('0x29')](_0x39ef7c,function(_0x31b660){if(_0x31b660[_0x6018('0x54')]===0x709){_0x31b660['subsections']=_0x10c1a5;}return _0x31b660;});}else{var _0x11b192={'sectionId':0x76c,'enabled':0x1,'subsections':_0x10c1a5};var _0x5dc90a=_[_0x6018('0x29')](_0x39ef7c);_0x5dc90a[_0x6018('0x5e')](_0x11b192);return _0x5dc90a;}});}else{return;}})['then'](function(_0x493cdc){if(_0x493cdc)_0x39ef7c=_0x493cdc;return _[_0x6018('0x3c')](_0x39ef7c,[_0x6018('0x5a'),0x1]);})[_0x6018('0x40')](respondWithResult(_0x320d64,null))[_0x6018('0x46')](handleError(_0x320d64,null));};function hasDefaultDashboard(_0xc70af3){var _0x2c7e70=[0x65];return new BPromise(function(_0x517d7b,_0x557ad0){try{if(_0xc70af3[_0x6018('0x52')]){_0x517d7b(_0x2c7e70);}else{return db[_0x6018('0x53')][_0x6018('0x5f')]({'where':{'sectionId':_0xc70af3['id']},'raw':!![]})[_0x6018('0x40')](function(_0x138735){_0x138735?_0x517d7b(_0x2c7e70):_0x517d7b();});}}catch(_0x210999){_0x557ad0(_0x210999);}});}function getCustomDashboards(_0x5a74e6){var _0x7d5812=[];return new BPromise(function(_0x27d721,_0x208a8c){try{if(_0x5a74e6[_0x6018('0x52')]){return db[_0x6018('0x60')][_0x6018('0x43')]({'raw':!![]})[_0x6018('0x40')](function(_0x4567a0){_0x4567a0[_0x6018('0x61')](function(_0x12da72){_0x7d5812[_0x6018('0x5e')](_0x12da72['id']+0x1869f);});_0x27d721(_0x7d5812);});}else{return db[_0x6018('0x53')][_0x6018('0x43')]({'where':{'sectionId':_0x5a74e6['id']},'raw':!![]})[_0x6018('0x40')](function(_0x2031df){_0x2031df[_0x6018('0x61')](function(_0x29ae44){_0x7d5812[_0x6018('0x5e')](_0x29ae44[_0x6018('0x62')]+0x1869f);});_0x27d721(_0x7d5812);});}}catch(_0x2bfd51){_0x208a8c(_0x2bfd51);}});}function getPlugins(_0x262f21){var _0x325526=[];return new BPromise(function(_0x16540c,_0x540a17){try{if(_0x262f21[_0x6018('0x52')]){return db[_0x6018('0x63')]['findAll']({'raw':!![]})[_0x6018('0x40')](function(_0x4fc242){_0x4fc242[_0x6018('0x61')](function(_0x1f0a50){_0x325526[_0x6018('0x5e')](_0x1f0a50['id']+0x15b38);});_0x16540c(_0x325526);});}else{return db[_0x6018('0x53')][_0x6018('0x43')]({'where':{'sectionId':_0x262f21['id']},'raw':!![]})['then'](function(_0x441793){_0x441793['forEach'](function(_0x429088){_0x325526[_0x6018('0x5e')](_0x429088['resourceId']+0x15b38);});_0x16540c(_0x325526);});}}catch(_0x4d5103){_0x540a17(_0x4d5103);}});}exports[_0x6018('0x64')]=function(_0x281f48,_0x1ca8f9){return db['UserProfile']['find']({'where':{'id':_0x281f48[_0x6018('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ca8f9,null))[_0x6018('0x40')](function(_0x5ab92d){if(_0x5ab92d){return db[_0x6018('0x4e')][_0x6018('0x4f')](function(_0x3d0ca2){return db['UserProfileSection'][_0x6018('0x43')]({'where':{'userProfileId':_0x281f48[_0x6018('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x6018('0x40')](function(_0x4ba91b){if(_0x4ba91b){return db[_0x6018('0x50')][_0x6018('0x24')]({'where':{'userProfileId':_0x281f48[_0x6018('0x44')]['id'],'id':_[_0x6018('0x29')](_0x4ba91b,function(_0x2165d0){return _0x2165d0['id'];})},'transaction':_0x3d0ca2});}})[_0x6018('0x40')](function(_0x5539b8){var _0x483c79=_[_0x6018('0x29')](_0x281f48[_0x6018('0x48')],function(_0x1b84f9){_0x1b84f9[_0x6018('0x65')]=_0x281f48[_0x6018('0x44')]['id'];return _0x1b84f9;});return db['UserProfileSection'][_0x6018('0x66')](_0x483c79,{'raw':!![],'transaction':_0x3d0ca2});})[_0x6018('0x40')](function(_0x3505fd){var _0x1b04e4=_[_0x6018('0x3c')](_[_0x6018('0x29')](_0x3505fd,function(_0x13d4f0){return _0x13d4f0[_0x6018('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x1b04e4){return db[_0x6018('0x50')][_0x6018('0x43')]({'where':{'userProfileId':_0x281f48[_0x6018('0x44')]['id'],'sectionId':_[_0x6018('0x29')](_0x1b04e4,function(_0x3c0c40){return _0x3c0c40[_0x6018('0x54')];})},'attributes':['id',_0x6018('0x54')],'raw':!![]})['then'](function(_0x147397){var _0x11d7b5=_[_0x6018('0x29')](_0x281f48[_0x6018('0x48')],function(_0x5c830c){_0x5c830c[_0x6018('0x65')]=_0x281f48[_0x6018('0x44')]['id'];return _0x5c830c;});return db[_0x6018('0x53')][_0x6018('0x66')](_0x11d7b5,{'raw':!![],'transaction':_0x3d0ca2});});}})['catch'](handleError(_0x1ca8f9,null));});}})['then'](function(_0x21e8e4){var _0x15b8ca=_['map'](_0x21e8e4,function(_0x131181){return _0x131181[_0x6018('0x49')]({'plain':!![]});});})['then'](respondWithResult(_0x1ca8f9,null))[_0x6018('0x46')](handleError(_0x1ca8f9,null));};exports['removeResources']=function(_0x331f45,_0x258b02,_0x5ce5a2){return db[_0x6018('0x2a')][_0x6018('0x45')]({'where':{'id':_0x331f45[_0x6018('0x44')]['id']}})[_0x6018('0x40')](handleEntityNotFound(_0x258b02,null))[_0x6018('0x40')](function(_0x1e3f39){if(_0x1e3f39){return _0x1e3f39[_0x6018('0x67')](_0x331f45['query'][_0x6018('0x59')]);}})[_0x6018('0x40')](respondWithStatusCode(_0x258b02,null))[_0x6018('0x46')](handleError(_0x258b02,null));};exports[_0x6018('0x68')]=function(_0x58aa28,_0x515d5e){var _0x248e69={'raw':![],'where':{}};var _0x348a90={};var _0x280b54={'count':0x0,'rows':[]};var _0x4c5a12=_0x58aa28[_0x6018('0x30')][_0x6018('0x69')];if(typeof _0x4c5a12===_0x6018('0x6a')){throw new db['Sequelize'][(_0x6018('0x6b'))](_0x6018('0x6c'));}var _0x4e8462=_0x58aa28[_0x6018('0x30')][_0x6018('0x6d')]||![];var _0x42b415=getQueryModels(_0x4c5a12,_0x4e8462);if(typeof _0x42b415[_0x6018('0x6e')]===_0x6018('0x6a')){throw new db[(_0x6018('0x6f'))]['ValidationError']('Invalid\x20section\x20\x27'+_0x4c5a12+'\x27');}var _0x3dedb9=[];if(!_['isEmpty'](_0x42b415[_0x6018('0x70')])){_0x3dedb9=_0x42b415[_0x6018('0x70')];}else{_0x3dedb9=[{'name':_0x4c5a12}];}return db[_0x6018('0x2a')]['findOne']({'where':{'id':_0x58aa28[_0x6018('0x44')]['id']}})[_0x6018('0x40')](handleEntityNotFound(_0x515d5e,null))['then'](function(_0x5c283a){if(_0x5c283a){var _0x135426=[];for(var _0x20192b=0x0;_0x20192b<_0x3dedb9[_0x6018('0x36')];_0x20192b++){_0x135426[_0x6018('0x5e')](db[_0x6018('0x50')][_0x6018('0x5f')]({'where':{'userProfileId':_0x5c283a['id'],'name':_0x3dedb9[_0x20192b]['name']},'raw':!![]}));}return BPromise[_0x6018('0x71')](_0x135426);}})[_0x6018('0x40')](function(_0x54abfd){var _0x3502a9=_[_0x6018('0x3c')](_0x54abfd,function(_0x1c8540){return _0x1c8540?_0x1c8540:undefined;});var _0x4b1fde=_[_0x6018('0x3c')](_0x3dedb9,[_0x6018('0x72'),!![]]);var _0x4e2d95=_[_0x6018('0x5c')](_0x3502a9)&&_[_0x6018('0x5c')](_0x4b1fde)?null:_['union'](_0x4b1fde,_0x3502a9);if(_0x4e2d95){var _0x36587d=[];for(var _0x1ff94a=0x0;_0x1ff94a<_0x4e2d95['length'];_0x1ff94a++){var _0x210516=_[_0x6018('0x45')](_0x3dedb9,function(_0x357128){return _0x4e2d95[_0x1ff94a]?_0x357128[_0x6018('0x26')]===_0x4e2d95[_0x1ff94a][_0x6018('0x26')]:null;});if(_0x210516){if(_0x4e2d95[_0x1ff94a][_0x6018('0x72')]){_0x36587d[_0x6018('0x5e')](getAllResources(_0x42b415[_0x6018('0x6e')],_0x4e2d95[_0x1ff94a]));}else{if(!_0x4e2d95[_0x1ff94a][_0x6018('0x52')]){_0x36587d[_0x6018('0x5e')](getAllowedResources(_0x210516,_0x4e2d95[_0x1ff94a],_0x42b415[_0x6018('0x6e')]));}else{if(_0x210516[_0x6018('0x2f')]){_0x36587d[_0x6018('0x5e')](getAllFilteredResources(_0x210516,_0x4e2d95[_0x1ff94a]));}}}}}return BPromise[_0x6018('0x71')](_0x36587d);}else{return null;}})['then'](function(_0xc62a65){var _0x5c843e=_0xc62a65;var _0x1865d1=null;if(_0x5c843e){_0x1865d1=_0x5c843e[_0x6018('0x36')]===0x1?_0x5c843e[0x0]:null;}if(_0x1865d1||_0x5c843e){var _0x5efa4c=db[_0x42b415[_0x6018('0x6e')]][_0x6018('0x2b')];_0x348a90[_0x6018('0x2f')]=_[_0x6018('0x31')](_0x5efa4c);_0x348a90['query']=_['keys'](_0x58aa28[_0x6018('0x30')]);_0x348a90['filters']=_['intersection'](_0x348a90['model'],_0x348a90[_0x6018('0x30')]);_0x248e69[_0x6018('0x34')]=_[_0x6018('0x33')](_0x348a90[_0x6018('0x2f')],qs[_0x6018('0x35')](_0x58aa28[_0x6018('0x30')][_0x6018('0x35')]));_0x248e69[_0x6018('0x34')]=_0x248e69['attributes']['length']?_0x248e69[_0x6018('0x34')]:_0x348a90[_0x6018('0x2f')];if(!_0x58aa28[_0x6018('0x30')][_0x6018('0x73')](_0x6018('0x37'))){_0x248e69[_0x6018('0x38')]=qs[_0x6018('0x38')](_0x58aa28[_0x6018('0x30')][_0x6018('0x38')]);_0x248e69[_0x6018('0x1f')]=qs[_0x6018('0x1f')](_0x58aa28['query'][_0x6018('0x1f')]);}_0x248e69['order']=qs['sort'](_0x58aa28['query'][_0x6018('0x3a')]);_0x248e69[_0x6018('0x3b')]=qs[_0x6018('0x32')](_['pick'](_0x58aa28[_0x6018('0x30')],_0x348a90['filters']));if(_0x58aa28[_0x6018('0x30')][_0x6018('0x3c')]){_0x248e69[_0x6018('0x3b')]=_['merge'](_0x248e69[_0x6018('0x3b')],{'$or':_[_0x6018('0x29')](_0x5efa4c,function(_0x26e457){if(_0x26e457[_0x6018('0x2d')][_0x6018('0x2e')]!==_0x6018('0x3e')){var _0xe2de26={};_0xe2de26[_0x26e457['field']]={'$like':'%'+_0x58aa28[_0x6018('0x30')]['filter']+'%'};return _0xe2de26;}})});}var _0x4bb57f=[];if(_0x1865d1){var _0x457581=_[_0x6018('0x45')](_0x3dedb9,[_0x6018('0x26'),_0x1865d1[_0x6018('0x26')]]);if(_0x457581[_0x6018('0x74')]){var _0x18cfdd={};if(_0x42b415[_0x6018('0x6e')]===_0x6018('0x75')){_0x18cfdd[_0x457581[_0x6018('0x76')]]=_[_0x6018('0x29')](_0x1865d1[_0x6018('0x77')],'id');}else{_0x18cfdd[_0x457581[_0x6018('0x76')]]=_0x1865d1[_0x6018('0x77')];}_0x4bb57f[_0x6018('0x5e')](_0x18cfdd);}else{_0x248e69[_0x6018('0x3b')]['id']=_0x1865d1[_0x6018('0x77')];}}else{for(var _0xaf8ebc=0x0;_0xaf8ebc<_0x5c843e[_0x6018('0x36')];_0xaf8ebc++){var _0x457581=_[_0x6018('0x45')](_0x3dedb9,['name',_0x5c843e[_0xaf8ebc]['name']]);if(_0x457581['field']){var _0x18cfdd={};_0x18cfdd[_0x457581[_0x6018('0x76')]]=_0x5c843e[_0xaf8ebc][_0x6018('0x77')];_0x4bb57f[_0x6018('0x5e')](_0x18cfdd);}else{if(!_0x248e69[_0x6018('0x3b')]['id'])_0x248e69[_0x6018('0x3b')]['id']=[];_0x5c843e[_0xaf8ebc][_0x6018('0x77')][_0x6018('0x61')](function(_0x2f208c){_0x248e69[_0x6018('0x3b')]['id'][_0x6018('0x5e')](_0x2f208c);});}}}if(!_['isEmpty'](_0x4bb57f)){_0x248e69['where']=_['merge'](_0x248e69[_0x6018('0x3b')],{'$and':{'$or':_0x4bb57f}});}_0x248e69=_['merge']({},_0x248e69,_0x58aa28[_0x6018('0x3f')]);if(_0x1865d1&&!_0x1865d1[_0x6018('0x52')]&&_0x42b415[_0x6018('0x6e')]===_0x6018('0x75')){if(_0x58aa28[_0x6018('0x30')][_0x6018('0x41')]){_0x248e69[_0x6018('0x42')]=[{'all':!![]}];}return db[_0x42b415['childModel']][_0x6018('0x43')](_0x248e69)[_0x6018('0x40')](function(_0x529435){var _0x451c5a=[];_0x529435[_0x6018('0x61')](function(_0x5d607a){var _0x4ce356;switch(_0x5d607a[_0x6018('0x78')]){case _0x6018('0x79'):_0x4ce356=_[_0x6018('0x45')](_0x1865d1[_0x6018('0x77')],function(_0x3e765a){return _0x3e765a['id']===_0x5d607a[_0x6018('0x7a')]&&_0x3e765a[_0x6018('0x2d')]===_0x6018('0x7b');});break;case _0x6018('0x7c'):_0x4ce356=_['find'](_0x1865d1[_0x6018('0x77')],function(_0x4d3218){return _0x4d3218['id']===_0x5d607a[_0x6018('0x7a')]&&_0x4d3218['type']===_0x6018('0x7d');});break;}if(_0x4ce356)_0x451c5a[_0x6018('0x5e')](_0x5d607a);});_0x280b54['count']=_0x451c5a[_0x6018('0x36')];_0x280b54['rows']=_0x451c5a;return _0x280b54;});}else{return db[_0x42b415[_0x6018('0x6e')]][_0x6018('0x1e')]({'where':_0x248e69[_0x6018('0x3b')]})[_0x6018('0x40')](function(_0x554378){_0x280b54[_0x6018('0x1e')]=_0x554378;if(_0x58aa28[_0x6018('0x30')][_0x6018('0x41')]){if(_0x42b415[_0x6018('0x6e')]===_0x6018('0x7e')){_0x248e69[_0x6018('0x42')]=[{'model':db[_0x6018('0x7f')],'as':_0x6018('0x80'),'attributes':['id',_0x6018('0x26'),'color'],'required':_0x58aa28[_0x6018('0x30')][_0x6018('0x81')]?!![]:![]},{'model':db[_0x6018('0x7f')],'as':_0x6018('0x82'),'attributes':['id',_0x6018('0x26'),'color'],'through':_0x58aa28[_0x6018('0x30')]['tag']?{'attributes':[],'where':{'TagId':_0x58aa28[_0x6018('0x30')][_0x6018('0x81')]||undefined}}:{},'required':_0x58aa28['query'][_0x6018('0x81')]?!![]:![]}];}else{_0x248e69[_0x6018('0x42')]=[{'all':!![]}];}}return db[_0x42b415['childModel']][_0x6018('0x43')](_0x248e69);})[_0x6018('0x40')](function(_0x2b0fa6){_0x280b54[_0x6018('0x83')]=_0x2b0fa6;return _0x280b54;});}}else{return _0x280b54;}})[_0x6018('0x40')](respondWithFilteredResult(_0x515d5e,_0x248e69))[_0x6018('0x46')](handleError(_0x515d5e,null));};function getAllResources(_0x2c93bc,_0x24867f){return new BPromise(function(_0x29589f,_0x2f0511){if(_0x24867f){var _0x108d61=_0x24867f[_0x6018('0x3c')]?{[_0x24867f['filter']['field']]:_0x24867f[_0x6018('0x3c')][_0x6018('0x84')]}:undefined;return db[_0x2c93bc][_0x6018('0x43')]({'where':_0x108d61,'raw':!![]})[_0x6018('0x40')](function(_0x1ff55a){_0x24867f[_0x6018('0x77')]=_['map'](_0x1ff55a,'id');_0x29589f(_0x24867f);})[_0x6018('0x46')](function(_0x39c357){_0x2f0511(_0x39c357);});}else{_0x29589f(null);}});}function getAllFilteredResources(_0x514be4,_0x305bda){return new BPromise(function(_0x5ee89d,_0x33e813){var _0x30ebf6=_0x514be4['filter']?{[_0x514be4['filter']['field']]:_0x514be4[_0x6018('0x3c')][_0x6018('0x84')]}:undefined;return db[_0x514be4['model']][_0x6018('0x43')]({'where':_0x30ebf6,'raw':!![]})[_0x6018('0x40')](function(_0x1031a3){_0x305bda[_0x6018('0x77')]=_[_0x6018('0x29')](_0x1031a3,function(_0x349ef2){return _0x349ef2[_0x6018('0x26')];});_0x5ee89d(_0x305bda);})[_0x6018('0x46')](function(_0xa88f58){_0x33e813(_0xa88f58);});});}function getAllowedResources(_0x54fc56,_0x2f0893,_0x40589b){return new BPromise(function(_0x2d31ad,_0x4a3081){if(_0x2f0893){return db[_0x6018('0x53')]['findAll']({'where':{'sectionId':_0x2f0893['id']},'raw':!![]})[_0x6018('0x40')](function(_0x1cd4b0){if(_0x54fc56[_0x6018('0x74')]&&_0x54fc56[_0x6018('0x74')]!=='id'){_0x2f0893['associatedResources']=_[_0x6018('0x29')](_0x1cd4b0,function(_0x23162f){return _0x23162f[_0x54fc56['field']];});}else{if(_0x40589b===_0x6018('0x75')){_0x2f0893['associatedResources']=_['map'](_0x1cd4b0,function(_0x2728a3){return{'id':_0x2728a3[_0x6018('0x62')],'type':_0x2728a3[_0x6018('0x2d')]};});}else{_0x2f0893[_0x6018('0x77')]=_[_0x6018('0x29')](_0x1cd4b0,function(_0x50d471){return _0x50d471[_0x6018('0x62')];});}}_0x2d31ad(_0x2f0893);})[_0x6018('0x46')](function(_0x2bd018){_0x4a3081(_0x2bd018);});}else{_0x2d31ad(null);}});}function getQueryModels(_0x1af4d9,_0x4e41d5){var _0x4b35a2=_0x1af4d9[_0x6018('0x85')]();var _0x24ca3c={'childModel':undefined,'parentSections':[]};switch(_0x4b35a2){case _0x6018('0x86'):_0x24ca3c[_0x6018('0x6e')]='SquareProject';break;case _0x6018('0x87'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x88');break;case _0x6018('0x89'):_0x24ca3c[_0x6018('0x6e')]='SquareRecording';_0x24ca3c[_0x6018('0x70')]=[{'name':'SquareProjects','field':_0x6018('0x26'),'foreignKey':_0x6018('0x8a')}];break;case'projects':_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x8b');break;case _0x6018('0x8c'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x7e');_0x24ca3c[_0x6018('0x70')]=[{'name':'Lists','field':'id','foreignKey':_0x6018('0x8d')}];break;case _0x6018('0x8e'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x8f');break;case'companies':_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x90');break;case'globalcustomfields':_0x24ca3c['childModel']=_0x6018('0x91');break;case'chatqueues':_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x92');break;case _0x6018('0x93'):_0x24ca3c['childModel']=_0x6018('0x94');break;case'faxqueues':_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x95');break;case _0x6018('0x96'):_0x24ca3c['childModel']=_0x6018('0x97');break;case _0x6018('0x98'):case _0x6018('0x99'):case _0x6018('0x9a'):_0x24ca3c[_0x6018('0x6e')]='VoiceExtension';break;case'contexts':_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x9b');break;case _0x6018('0x9c'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x9d');break;case _0x6018('0x9e'):_0x24ca3c[_0x6018('0x6e')]='VoiceRecording';_0x24ca3c[_0x6018('0x70')]=[{'name':'Agents','field':_0x6018('0x26'),'foreignKey':_0x6018('0x9f'),'model':'User','filter':{'field':'role','value':[_0x6018('0xa0')]}},{'name':_0x6018('0xa1'),'field':_0x6018('0x26'),'foreignKey':_0x6018('0x9f'),'model':_0x6018('0xa2'),'filter':{'field':_0x6018('0xa3'),'value':['telephone']}},{'name':_0x6018('0xa4'),'field':'name','foreignKey':_0x6018('0xa5'),'model':_0x6018('0xa6'),'filter':{'field':_0x6018('0x2d'),'value':[_0x6018('0xa7')]}},{'name':_0x6018('0xa8'),'field':_0x6018('0x26'),'foreignKey':'queue','model':_0x6018('0xa6'),'filter':{'field':_0x6018('0x2d'),'value':[_0x6018('0xa9')]}}];break;case _0x6018('0xaa'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xab');break;case _0x6018('0xac'):_0x24ca3c['childModel']=_0x6018('0xad');break;case'voiceprefixes':_0x24ca3c[_0x6018('0x6e')]='VoicePrefix';break;case _0x6018('0xae'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xaf');break;case'mailqueues':_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xb0');break;case _0x6018('0xb1'):_0x24ca3c['childModel']=_0x6018('0xb2');break;case _0x6018('0xb3'):_0x24ca3c['childModel']=_0x6018('0xb4');break;case _0x6018('0xb5'):_0x24ca3c['childModel']=_0x6018('0xb6');break;case _0x6018('0xb7'):_0x24ca3c[_0x6018('0x6e')]='OpenchannelAccount';break;case _0x6018('0xb8'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xb9');break;case _0x6018('0xba'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xbb');break;case _0x6018('0xbc'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xbd');break;case _0x6018('0xbe'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xbf');break;case _0x6018('0xc0'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xc1');break;case _0x6018('0xc2'):case _0x6018('0xc3'):_0x24ca3c['childModel']='VoiceQueue';if(_0x4e41d5){_0x24ca3c[_0x6018('0x70')]=[{'name':'VoiceQueues'},{'name':_0x6018('0xa8')}];}break;case'users':case'agents':case _0x6018('0xc4'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xa2');if(_0x4e41d5){_0x24ca3c[_0x6018('0x70')]=[{'name':_0x6018('0xc5'),'filter':{'field':_0x6018('0xa3'),'value':[_0x6018('0xc6'),_0x6018('0xc7')]},'ignore':!![]},{'name':_0x6018('0xc8')},{'name':'Telephones'}];}break;case _0x6018('0xc9'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xca');break;case _0x6018('0xcb'):_0x24ca3c['childModel']=_0x6018('0xcc');break;case _0x6018('0xcd'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xce');break;case _0x6018('0xcf'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xd0');break;case _0x6018('0xd1'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xd2');break;case _0x6018('0xd3'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xd4');break;case'vtigeraccounts':_0x24ca3c['childModel']=_0x6018('0xa2');break;case _0x6018('0xd5'):_0x24ca3c['childModel']=_0x6018('0xd6');break;case'dispositions':_0x24ca3c['childModel']=_0x6018('0xd7');break;case _0x6018('0xd8'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0x60');break;case _0x6018('0xd9'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xda');break;case _0x6018('0xdb'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xdc');break;case _0x6018('0xdd'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xde');break;case _0x6018('0xdf'):_0x24ca3c[_0x6018('0x6e')]='Sound';break;case _0x6018('0xe0'):_0x24ca3c[_0x6018('0x6e')]='Tag';break;case _0x6018('0xe1'):_0x24ca3c['childModel']=_0x6018('0xe2');break;case _0x6018('0xe3'):_0x24ca3c['childModel']=_0x6018('0xe4');break;case _0x6018('0xe5'):_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xe6');break;case _0x6018('0xe7'):_0x24ca3c[_0x6018('0x6e')]='Variable';break;case'plugins':_0x24ca3c['childModel']=_0x6018('0x63');break;case _0x6018('0xe8'):_0x24ca3c['childModel']=_0x6018('0x75');_0x24ca3c['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x6018('0x7a')}];break;case'metrics':_0x24ca3c[_0x6018('0x6e')]=_0x6018('0xe9');break;case'whatsappaccounts':_0x24ca3c['childModel']=_0x6018('0xbf');break;default:return _0x24ca3c;}return _0x24ca3c;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a8b41cd..a5a659c 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 _0x40af=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x40af,0x161));var _0xf40a=function(_0x40238c,_0x9a6b3){_0x40238c=_0x40238c-0x0;var _0x202b08=_0x40af[_0x40238c];return _0x202b08;};'use strict';var EventEmitter=require(_0xf40a('0x0'));var UserProfile=require(_0xf40a('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf40a('0x2')](0x0);var events={'afterCreate':_0xf40a('0x3'),'afterUpdate':_0xf40a('0x4'),'afterDestroy':_0xf40a('0x5')};function emitEvent(_0x4e89a8){return function(_0x33bdb3,_0x310319,_0x18d023){UserProfileEvents['emit'](_0x4e89a8+':'+_0x33bdb3['id'],_0x33bdb3);UserProfileEvents['emit'](_0x4e89a8,_0x33bdb3);_0x18d023(null);};}for(var e in events){if(events[_0xf40a('0x6')](e)){var event=events[e];UserProfile[_0xf40a('0x7')](e,emitEvent(event));}}module[_0xf40a('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x4eba=['hook','exports','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x5d9edb,_0x1e10ae){var _0x7589fc=function(_0x528b4e){while(--_0x528b4e){_0x5d9edb['push'](_0x5d9edb['shift']());}};_0x7589fc(++_0x1e10ae);}(_0x4eba,0xca));var _0xa4eb=function(_0x8fc9d1,_0x55be5e){_0x8fc9d1=_0x8fc9d1-0x0;var _0x445c72=_0x4eba[_0x8fc9d1];return _0x445c72;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0xa4eb('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa4eb('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa4eb('0x2'),'afterDestroy':_0xa4eb('0x3')};function emitEvent(_0xb3b3b0){return function(_0x174456,_0x1b0475,_0xdca6d7){UserProfileEvents[_0xa4eb('0x4')](_0xb3b3b0+':'+_0x174456['id'],_0x174456);UserProfileEvents[_0xa4eb('0x4')](_0xb3b3b0,_0x174456);_0xdca6d7(null);};}for(var e in events){if(events[_0xa4eb('0x5')](e)){var event=events[e];UserProfile[_0xa4eb('0x6')](e,emitEvent(event));}}module[_0xa4eb('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f6e29dd..d8abae5 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 _0x4dd3=['User','update','privacyEnabled','then','catch','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','UserProfile'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x4dd3,0xf5));var _0x34dd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4dd3[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var logger=require(_0x34dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34dd('0x4'));var rimraf=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var attributes=require('./userProfile.attributes');module[_0x34dd('0x7')]=function(_0x704165,_0x37ce1d){return _0x704165[_0x34dd('0x8')](_0x34dd('0x9'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4cb036,_0xc0c516,_0x471534){var _0x2edf24=_0x704165['models'];_0x2edf24[_0x34dd('0xa')][_0x34dd('0xb')]({'privacyEnabled':_0x4cb036[_0x34dd('0xc')]},{'where':{'UserProfileId':_0x4cb036['id']}})[_0x34dd('0xd')](function(){_0x471534();})[_0x34dd('0xe')](function(_0x2c16f4){_0x471534(_0x2c16f4);});}}});}; \ No newline at end of file +var _0xb7e7=['../../config/environment','./userProfile.attributes','define','UserProfile','models','User','update','then','catch','lodash','../../config/logger','moment','request-promise','rimraf'];(function(_0x55ff8a,_0x145f03){var _0xfe8dec=function(_0xb30f27){while(--_0xb30f27){_0x55ff8a['push'](_0x55ff8a['shift']());}};_0xfe8dec(++_0x145f03);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xb7e7[_0x1b828b];return _0x98da1a;};'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':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x42b871,_0x223587,_0x2917f9){var _0x1647e5=_0x53ed64[_0x7b7e('0x9')];_0x1647e5[_0x7b7e('0xa')][_0x7b7e('0xb')]({'privacyEnabled':_0x42b871['privacyEnabled']},{'where':{'UserProfileId':_0x42b871['id']}})[_0x7b7e('0xc')](function(){_0x2917f9();})[_0x7b7e('0xd')](function(_0x10a666){_0x2917f9(_0x10a666);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 310bd26..3dc3878 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 _0x5fab=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./userProfile.socket','register'];(function(_0x4b3413,_0x58c416){var _0x3b01ba=function(_0xb25f43){while(--_0xb25f43){_0x4b3413['push'](_0x4b3413['shift']());}};_0x3b01ba(++_0x58c416);}(_0x5fab,0x177));var _0xb5fa=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0x5fab[_0x53417c];return _0x49407d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});config['redis']=_[_0xb5fa('0xc')](config[_0xb5fa('0xd')],{'host':_0xb5fa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0xd')]));require(_0xb5fa('0xf'))[_0xb5fa('0x10')](socket);function respondWithRpcPromise(_0x54c7eb,_0x5b5ea8,_0x3a8e1b){return new BPromise(function(_0x23d124,_0xe46b26){return client[_0xb5fa('0x11')](_0x54c7eb,_0x3a8e1b)[_0xb5fa('0x12')](function(_0xadef41){logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));logger['debug'](_0xb5fa('0x16'),_0x5b5ea8,_0xb5fa('0x15'),JSON['stringify'](_0xadef41));if(_0xadef41[_0xb5fa('0x17')]){if(_0xadef41['error'][_0xb5fa('0x18')]===0x1f4){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0xe46b26(_0xadef41['error']['message']);}logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x23d124(_0xadef41['error']['message']);}else{logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));_0x23d124(_0xadef41[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x3b0f69){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0x3b0f69);_0xe46b26(_0x3b0f69);});});} \ No newline at end of file +var _0x687b=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x14318c,_0xd7e808){var _0x13a781=function(_0x5015c6){while(--_0x5015c6){_0x14318c['push'](_0x14318c['shift']());}};_0x13a781(++_0xd7e808);}(_0x687b,0x14a));var _0xb687=function(_0xe1d065,_0x39ab64){_0xe1d065=_0xe1d065-0x0;var _0x481700=_0x687b[_0xe1d065];return _0x481700;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});config[_0xb687('0xc')]=_[_0xb687('0xd')](config['redis'],{'host':_0xb687('0xe'),'port':0x18eb});var socket=require(_0xb687('0xf'))(new Redis(config['redis']));require(_0xb687('0x10'))[_0xb687('0x11')](socket);function respondWithRpcPromise(_0x825ad,_0x15dc9a,_0x404fdb){return new BPromise(function(_0x309d84,_0x3e6271){return client[_0xb687('0x12')](_0x825ad,_0x404fdb)[_0xb687('0x13')](function(_0x5103b9){logger[_0xb687('0x14')](_0xb687('0x15'),_0x15dc9a,_0xb687('0x16'));logger[_0xb687('0x17')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x15dc9a,'request\x20sent',JSON[_0xb687('0x18')](_0x5103b9));if(_0x5103b9[_0xb687('0x19')]){if(_0x5103b9['error'][_0xb687('0x1a')]===0x1f4){logger[_0xb687('0x19')](_0xb687('0x15'),_0x15dc9a,_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);return _0x3e6271(_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);}logger[_0xb687('0x19')](_0xb687('0x15'),_0x15dc9a,_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);return _0x309d84(_0x5103b9[_0xb687('0x19')]['message']);}else{logger[_0xb687('0x14')](_0xb687('0x15'),_0x15dc9a,_0xb687('0x16'));_0x309d84(_0x5103b9['result']['message']);}})[_0xb687('0x1c')](function(_0x3a10ef){logger[_0xb687('0x19')]('UserProfile,\x20%s,\x20%s',_0x15dc9a,_0x3a10ef);_0x3e6271(_0x3a10ef);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 73328a0..8c426f3 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 _0x0141=['save','remove','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x490772,_0x103e1b){var _0x2d828a=function(_0x468094){while(--_0x468094){_0x490772['push'](_0x490772['shift']());}};_0x2d828a(++_0x103e1b);}(_0x0141,0x1cd));var _0x1014=function(_0x314bef,_0x1b00bd){_0x314bef=_0x314bef-0x0;var _0x178ee4=_0x0141[_0x314bef];return _0x178ee4;};'use strict';var UserProfileEvents=require(_0x1014('0x0'));var events=[_0x1014('0x1'),_0x1014('0x2'),'update'];function createListener(_0x3448d7,_0x5a4bf9){return function(_0x13e1db){_0x5a4bf9['emit'](_0x3448d7,_0x13e1db);};}function removeListener(_0x48682b,_0x2aa660){return function(){UserProfileEvents[_0x1014('0x3')](_0x48682b,_0x2aa660);};}exports[_0x1014('0x4')]=function(_0x41fafe){for(var _0x124e2a=0x0,_0x5a2dde=events[_0x1014('0x5')];_0x124e2a<_0x5a2dde;_0x124e2a++){var _0x5665a2=events[_0x124e2a];var _0x470aa9=createListener(_0x1014('0x6')+_0x5665a2,_0x41fafe);UserProfileEvents['on'](_0x5665a2,_0x470aa9);}}; \ No newline at end of file +var _0x5a28=['remove','emit','removeListener','register','./userProfile.events','save'];(function(_0x417570,_0x414ca3){var _0x11087e=function(_0x1cfec7){while(--_0x1cfec7){_0x417570['push'](_0x417570['shift']());}};_0x11087e(++_0x414ca3);}(_0x5a28,0x136));var _0x85a2=function(_0x3f4a75,_0x1ff97e){_0x3f4a75=_0x3f4a75-0x0;var _0x1cd60d=_0x5a28[_0x3f4a75];return _0x1cd60d;};'use strict';var UserProfileEvents=require(_0x85a2('0x0'));var events=[_0x85a2('0x1'),_0x85a2('0x2'),'update'];function createListener(_0x20e04c,_0x46c3a6){return function(_0x714e6d){_0x46c3a6[_0x85a2('0x3')](_0x20e04c,_0x714e6d);};}function removeListener(_0x1333e3,_0x267fa6){return function(){UserProfileEvents[_0x85a2('0x4')](_0x1333e3,_0x267fa6);};}exports[_0x85a2('0x5')]=function(_0x360ffb){for(var _0x50d3e5=0x0,_0x14ee80=events['length'];_0x50d3e5<_0x14ee80;_0x50d3e5++){var _0x4ee74c=events[_0x50d3e5];var _0x21f068=createListener('userProfile:'+_0x4ee74c,_0x360ffb);UserProfileEvents['on'](_0x4ee74c,_0x21f068);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4c04653..54bfd60 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 _0x93f4=['index','/describe','show','create','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x93f4,0x13a));var _0x493f=function(_0x1f5920,_0x4c4b40){_0x1f5920=_0x1f5920-0x0;var _0x2e226f=_0x93f4[_0x1f5920];return _0x2e226f;};'use strict';var multer=require('multer');var util=require(_0x493f('0x0'));var path=require(_0x493f('0x1'));var timeout=require(_0x493f('0x2'));var express=require(_0x493f('0x3'));var router=express[_0x493f('0x4')]();var fs_extra=require(_0x493f('0x5'));var auth=require(_0x493f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x493f('0x7'));var controller=require('./userProfileResource.controller');router[_0x493f('0x8')]('/',auth[_0x493f('0x9')](),controller[_0x493f('0xa')]);router[_0x493f('0x8')](_0x493f('0xb'),auth[_0x493f('0x9')](),controller['describe']);router[_0x493f('0x8')]('/:id',auth[_0x493f('0x9')](),controller[_0x493f('0xc')]);router['post']('/',auth[_0x493f('0x9')](),controller[_0x493f('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x493f('0xe')]);router['delete'](_0x493f('0xf'),auth['isAuthenticated'](),controller[_0x493f('0x10')]);module[_0x493f('0x11')]=router; \ No newline at end of file +var _0x1717=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x463dfd,_0x4d92a3){var _0xc434ee=function(_0x3bb251){while(--_0x3bb251){_0x463dfd['push'](_0x463dfd['shift']());}};_0xc434ee(++_0x4d92a3);}(_0x1717,0x6f));var _0x7171=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x1717[_0x35d4e9];return _0x5c2770;};'use strict';var multer=require(_0x7171('0x0'));var util=require(_0x7171('0x1'));var path=require(_0x7171('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7171('0x3')]();var fs_extra=require(_0x7171('0x4'));var auth=require(_0x7171('0x5'));var interaction=require(_0x7171('0x6'));var config=require(_0x7171('0x7'));var controller=require(_0x7171('0x8'));router['get']('/',auth[_0x7171('0x9')](),controller[_0x7171('0xa')]);router[_0x7171('0xb')](_0x7171('0xc'),auth['isAuthenticated'](),controller[_0x7171('0xd')]);router[_0x7171('0xb')](_0x7171('0xe'),auth[_0x7171('0x9')](),controller[_0x7171('0xf')]);router[_0x7171('0x10')]('/',auth[_0x7171('0x9')](),controller[_0x7171('0x11')]);router[_0x7171('0x12')](_0x7171('0xe'),auth[_0x7171('0x9')](),controller[_0x7171('0x13')]);router[_0x7171('0x14')](_0x7171('0xe'),auth['isAuthenticated'](),controller[_0x7171('0x15')]);module[_0x7171('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index bee79b9..4a72d24 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 _0x0b09=['exports','STRING','sequelize'];(function(_0x5eda4a,_0x233eb2){var _0x590ca3=function(_0x3d0d1d){while(--_0x3d0d1d){_0x5eda4a['push'](_0x5eda4a['shift']());}};_0x590ca3(++_0x233eb2);}(_0x0b09,0xda));var _0x90b0=function(_0x42ae6c,_0x40fe12){_0x42ae6c=_0x42ae6c-0x0;var _0x92d3c6=_0x0b09[_0x42ae6c];return _0x92d3c6;};'use strict';var Sequelize=require(_0x90b0('0x0'));module[_0x90b0('0x1')]={'name':{'type':Sequelize[_0x90b0('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x90b0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xeb51=['INTEGER','STRING','exports'];(function(_0x23b0c3,_0x370b34){var _0x2c8037=function(_0x3948a5){while(--_0x3948a5){_0x23b0c3['push'](_0x23b0c3['shift']());}};_0x2c8037(++_0x370b34);}(_0xeb51,0x1b2));var _0x1eb5=function(_0x4dbe99,_0x8d6729){_0x4dbe99=_0x4dbe99-0x0;var _0x12d756=_0xeb51[_0x4dbe99];return _0x12d756;};'use strict';var Sequelize=require('sequelize');module[_0x1eb5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1eb5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1eb5('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0af2724..a52ef90 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 _0x3da0=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3da0,0x124));var _0x03da=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x3da0[_0x4bb581];return _0x316bf5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x03da('0x0'));var rimraf=require(_0x03da('0x1'));var zipdir=require(_0x03da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03da('0x3'));var moment=require(_0x03da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x03da('0x5'));var util=require('util');var path=require(_0x03da('0x6'));var sox=require(_0x03da('0x7'));var csv=require(_0x03da('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03da('0x9'));var _=require(_0x03da('0xa'));var squel=require(_0x03da('0xb'));var crypto=require(_0x03da('0xc'));var jsforce=require(_0x03da('0xd'));var deskjs=require(_0x03da('0xe'));var toCsv=require(_0x03da('0x8'));var querystring=require(_0x03da('0xf'));var Papa=require('papaparse');var Redis=require(_0x03da('0x10'));var authService=require(_0x03da('0x11'));var qs=require(_0x03da('0x12'));var as=require(_0x03da('0x13'));var hardwareService=require(_0x03da('0x14'));var logger=require(_0x03da('0x15'))(_0x03da('0x16'));var utils=require('../../config/utils');var config=require(_0x03da('0x17'));var licenseUtil=require(_0x03da('0x18'));var db=require(_0x03da('0x19'))['db'];function respondWithStatusCode(_0x2a6919,_0x45ff2a){_0x45ff2a=_0x45ff2a||0xcc;return function(_0x169398){if(_0x169398){return _0x2a6919[_0x03da('0x1a')](_0x45ff2a);}return _0x2a6919['status'](_0x45ff2a)['end']();};}function respondWithResult(_0x67092c,_0x516772){_0x516772=_0x516772||0xc8;return function(_0x3a6308){if(_0x3a6308){return _0x67092c[_0x03da('0x1b')](_0x516772)[_0x03da('0x1c')](_0x3a6308);}};}function respondWithFilteredResult(_0x1c4f52,_0x37a98a){return function(_0x35c4c7){if(_0x35c4c7){var _0x166619=_0x35c4c7['count'],_0x16ec0d=_0x37a98a[_0x03da('0x1d')],_0x27fa33=_0x37a98a[_0x03da('0x1d')]+_0x37a98a['limit'],_0x424557;if(_0x27fa33>=_0x166619){_0x27fa33=_0x166619;_0x424557=0xc8;}else{_0x424557=0xce;}_0x1c4f52[_0x03da('0x1b')](_0x424557);return _0x1c4f52[_0x03da('0x1e')](_0x03da('0x1f'),_0x16ec0d+'-'+_0x27fa33+'/'+_0x166619)[_0x03da('0x1c')](_0x35c4c7);}return null;};}function patchUpdates(_0x179408){return function(_0x375c32){try{jsonpatch[_0x03da('0x20')](_0x375c32,_0x179408,!![]);}catch(_0x23bf77){return BPromise['reject'](_0x23bf77);}return _0x375c32[_0x03da('0x21')]();};}function saveUpdates(_0x35b7a8,_0x9afa8a){return function(_0x3eba96){if(_0x3eba96){return _0x3eba96['update'](_0x35b7a8)[_0x03da('0x22')](function(_0x150410){return _0x150410;});}return null;};}function removeEntity(_0x2e0086,_0x1e70ab){return function(_0x15e44a){if(_0x15e44a){return _0x15e44a[_0x03da('0x23')]()[_0x03da('0x22')](function(){_0x2e0086[_0x03da('0x1b')](0xcc)[_0x03da('0x24')]();});}};}function handleEntityNotFound(_0x3984c6,_0x1edd24){return function(_0x151c39){if(!_0x151c39){_0x3984c6['sendStatus'](0x194);}return _0x151c39;};}function handleError(_0x2d35a8,_0x351baa){_0x351baa=_0x351baa||0x1f4;return function(_0x2db416){logger[_0x03da('0x25')](_0x2db416[_0x03da('0x26')]);if(_0x2db416[_0x03da('0x27')]){delete _0x2db416[_0x03da('0x27')];}_0x2d35a8['status'](_0x351baa)[_0x03da('0x28')](_0x2db416);};}exports[_0x03da('0x29')]=function(_0x22c66b,_0x4ad571){var _0x26e744={},_0x535ec4={},_0x2f07be={'count':0x0,'rows':[]};var _0x158600=_[_0x03da('0x2a')](db[_0x03da('0x2b')]['rawAttributes'],function(_0x5b6725){return{'name':_0x5b6725[_0x03da('0x2c')],'type':_0x5b6725[_0x03da('0x2d')][_0x03da('0x2e')]};});_0x535ec4[_0x03da('0x2f')]=_[_0x03da('0x2a')](_0x158600,'name');_0x535ec4[_0x03da('0x30')]=_['keys'](_0x22c66b[_0x03da('0x30')]);_0x535ec4[_0x03da('0x31')]=_[_0x03da('0x32')](_0x535ec4['model'],_0x535ec4[_0x03da('0x30')]);_0x26e744['attributes']=_[_0x03da('0x32')](_0x535ec4['model'],qs[_0x03da('0x33')](_0x22c66b['query'][_0x03da('0x33')]));_0x26e744[_0x03da('0x34')]=_0x26e744[_0x03da('0x34')]['length']?_0x26e744['attributes']:_0x535ec4[_0x03da('0x2f')];if(!_0x22c66b[_0x03da('0x30')][_0x03da('0x35')](_0x03da('0x36'))){_0x26e744[_0x03da('0x37')]=qs[_0x03da('0x37')](_0x22c66b[_0x03da('0x30')][_0x03da('0x37')]);_0x26e744[_0x03da('0x1d')]=qs[_0x03da('0x1d')](_0x22c66b[_0x03da('0x30')][_0x03da('0x1d')]);}_0x26e744[_0x03da('0x38')]=qs[_0x03da('0x39')](_0x22c66b[_0x03da('0x30')][_0x03da('0x39')]);_0x26e744[_0x03da('0x3a')]=qs[_0x03da('0x31')](_[_0x03da('0x3b')](_0x22c66b[_0x03da('0x30')],_0x535ec4[_0x03da('0x31')]),_0x158600);if(_0x22c66b[_0x03da('0x30')][_0x03da('0x3c')]){_0x26e744[_0x03da('0x3a')]=_[_0x03da('0x3d')](_0x26e744['where'],{'$or':_[_0x03da('0x2a')](_0x158600,function(_0x325a84){if(_0x325a84['type']!==_0x03da('0x3e')){var _0x1c240d={};_0x1c240d[_0x325a84[_0x03da('0x27')]]={'$like':'%'+_0x22c66b[_0x03da('0x30')][_0x03da('0x3c')]+'%'};return _0x1c240d;}})});}_0x26e744=_[_0x03da('0x3d')]({},_0x26e744,_0x22c66b[_0x03da('0x3f')]);var _0x48ab80={'where':_0x26e744[_0x03da('0x3a')]};return db['UserProfileResource'][_0x03da('0x40')](_0x48ab80)[_0x03da('0x22')](function(_0x3afca3){_0x2f07be[_0x03da('0x40')]=_0x3afca3;if(_0x22c66b[_0x03da('0x30')][_0x03da('0x41')]){_0x26e744[_0x03da('0x42')]=[{'all':!![]}];}return db[_0x03da('0x2b')]['findAll'](_0x26e744);})[_0x03da('0x22')](function(_0x251b19){_0x2f07be[_0x03da('0x43')]=_0x251b19;return _0x2f07be;})['then'](respondWithFilteredResult(_0x4ad571,_0x26e744))[_0x03da('0x44')](handleError(_0x4ad571,null));};exports[_0x03da('0x45')]=function(_0xd7c75e,_0x5f38d9){var _0x20f0dc={'raw':![],'where':{'id':_0xd7c75e[_0x03da('0x46')]['id']}},_0x279c0e={};_0x279c0e[_0x03da('0x2f')]=_[_0x03da('0x47')](db[_0x03da('0x2b')][_0x03da('0x48')]);_0x279c0e[_0x03da('0x30')]=_[_0x03da('0x47')](_0xd7c75e['query']);_0x279c0e[_0x03da('0x31')]=_['intersection'](_0x279c0e[_0x03da('0x2f')],_0x279c0e[_0x03da('0x30')]);_0x20f0dc[_0x03da('0x34')]=_[_0x03da('0x32')](_0x279c0e[_0x03da('0x2f')],qs['fields'](_0xd7c75e[_0x03da('0x30')][_0x03da('0x33')]));_0x20f0dc[_0x03da('0x34')]=_0x20f0dc['attributes'][_0x03da('0x49')]?_0x20f0dc[_0x03da('0x34')]:_0x279c0e['model'];if(_0xd7c75e['query'][_0x03da('0x41')]){_0x20f0dc[_0x03da('0x42')]=[{'all':!![]}];}_0x20f0dc=_[_0x03da('0x3d')]({},_0x20f0dc,_0xd7c75e[_0x03da('0x3f')]);return db[_0x03da('0x2b')][_0x03da('0x4a')](_0x20f0dc)[_0x03da('0x22')](handleEntityNotFound(_0x5f38d9,null))[_0x03da('0x22')](respondWithResult(_0x5f38d9,null))[_0x03da('0x44')](handleError(_0x5f38d9,null));};exports['create']=function(_0x301ff1,_0x631d1f){return db[_0x03da('0x2b')][_0x03da('0x4b')](_0x301ff1['body'],{})['then'](respondWithResult(_0x631d1f,0xc9))[_0x03da('0x44')](handleError(_0x631d1f,null));};exports['update']=function(_0x12bffc,_0x47bc11){if(_0x12bffc[_0x03da('0x4c')]['id']){delete _0x12bffc[_0x03da('0x4c')]['id'];}return db[_0x03da('0x2b')][_0x03da('0x4a')]({'where':{'id':_0x12bffc[_0x03da('0x46')]['id']}})['then'](handleEntityNotFound(_0x47bc11,null))[_0x03da('0x22')](saveUpdates(_0x12bffc[_0x03da('0x4c')],null))[_0x03da('0x22')](respondWithResult(_0x47bc11,null))['catch'](handleError(_0x47bc11,null));};exports[_0x03da('0x23')]=function(_0x37349e,_0x4f8dae){return db[_0x03da('0x2b')]['find']({'where':{'id':_0x37349e[_0x03da('0x46')]['id']}})[_0x03da('0x22')](handleEntityNotFound(_0x4f8dae,null))[_0x03da('0x22')](removeEntity(_0x4f8dae,null))[_0x03da('0x44')](handleError(_0x4f8dae,null));};exports[_0x03da('0x4d')]=function(_0x2efcd4,_0x194681){return db[_0x03da('0x2b')][_0x03da('0x4d')]()[_0x03da('0x22')](respondWithResult(_0x194681,null))[_0x03da('0x44')](handleError(_0x194681,null));}; \ No newline at end of file +var _0xcf0c=['map','VIRTUAL','filter','options','includeAll','rows','catch','show','params','fields','include','create','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','UserProfileResource','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0xcf0c,0xf6));var _0xccf0=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xcf0c[_0x19159a];return _0xa677f4;};'use strict';var pdf=require(_0xccf0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xccf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccf0('0x2'));var rp=require(_0xccf0('0x3'));var moment=require(_0xccf0('0x4'));var BPromise=require(_0xccf0('0x5'));var Mustache=require(_0xccf0('0x6'));var util=require(_0xccf0('0x7'));var path=require(_0xccf0('0x8'));var sox=require(_0xccf0('0x9'));var csv=require(_0xccf0('0xa'));var ejs=require(_0xccf0('0xb'));var fs=require('fs');var fs_extra=require(_0xccf0('0xc'));var _=require(_0xccf0('0xd'));var squel=require(_0xccf0('0xe'));var crypto=require(_0xccf0('0xf'));var jsforce=require(_0xccf0('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xccf0('0xa'));var querystring=require(_0xccf0('0x11'));var Papa=require(_0xccf0('0x12'));var Redis=require(_0xccf0('0x13'));var authService=require(_0xccf0('0x14'));var qs=require(_0xccf0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xccf0('0x16'))('api');var utils=require(_0xccf0('0x17'));var config=require(_0xccf0('0x18'));var licenseUtil=require(_0xccf0('0x19'));var db=require(_0xccf0('0x1a'))['db'];function respondWithStatusCode(_0x10594a,_0x142e79){_0x142e79=_0x142e79||0xcc;return function(_0x3ac66b){if(_0x3ac66b){return _0x10594a['sendStatus'](_0x142e79);}return _0x10594a[_0xccf0('0x1b')](_0x142e79)[_0xccf0('0x1c')]();};}function respondWithResult(_0x302841,_0x3acb85){_0x3acb85=_0x3acb85||0xc8;return function(_0x1d5cd1){if(_0x1d5cd1){return _0x302841[_0xccf0('0x1b')](_0x3acb85)['json'](_0x1d5cd1);}};}function respondWithFilteredResult(_0x57eed2,_0x55fc37){return function(_0x118aee){if(_0x118aee){var _0x25db3d=_0x118aee[_0xccf0('0x1d')],_0x391872=_0x55fc37[_0xccf0('0x1e')],_0xffaa49=_0x55fc37[_0xccf0('0x1e')]+_0x55fc37['limit'],_0x502e7f;if(_0xffaa49>=_0x25db3d){_0xffaa49=_0x25db3d;_0x502e7f=0xc8;}else{_0x502e7f=0xce;}_0x57eed2[_0xccf0('0x1b')](_0x502e7f);return _0x57eed2[_0xccf0('0x1f')](_0xccf0('0x20'),_0x391872+'-'+_0xffaa49+'/'+_0x25db3d)[_0xccf0('0x21')](_0x118aee);}return null;};}function patchUpdates(_0x1748c5){return function(_0x56f1d3){try{jsonpatch[_0xccf0('0x22')](_0x56f1d3,_0x1748c5,!![]);}catch(_0x12ef45){return BPromise[_0xccf0('0x23')](_0x12ef45);}return _0x56f1d3[_0xccf0('0x24')]();};}function saveUpdates(_0x4af589,_0xc8fb16){return function(_0x585a68){if(_0x585a68){return _0x585a68[_0xccf0('0x25')](_0x4af589)[_0xccf0('0x26')](function(_0x4a2c03){return _0x4a2c03;});}return null;};}function removeEntity(_0x1def89,_0x14ce69){return function(_0x4de75e){if(_0x4de75e){return _0x4de75e[_0xccf0('0x27')]()[_0xccf0('0x26')](function(){_0x1def89[_0xccf0('0x1b')](0xcc)[_0xccf0('0x1c')]();});}};}function handleEntityNotFound(_0x1db794,_0x530d3b){return function(_0x111ed4){if(!_0x111ed4){_0x1db794['sendStatus'](0x194);}return _0x111ed4;};}function handleError(_0x598030,_0x14687a){_0x14687a=_0x14687a||0x1f4;return function(_0x3b4895){logger[_0xccf0('0x28')](_0x3b4895[_0xccf0('0x29')]);if(_0x3b4895[_0xccf0('0x2a')]){delete _0x3b4895[_0xccf0('0x2a')];}_0x598030[_0xccf0('0x1b')](_0x14687a)[_0xccf0('0x2b')](_0x3b4895);};}exports['index']=function(_0x547e04,_0x217a28){var _0x2dbdcf={},_0xa9aac1={},_0x306bb4={'count':0x0,'rows':[]};var _0x323072=_['map'](db[_0xccf0('0x2c')][_0xccf0('0x2d')],function(_0x5344e6){return{'name':_0x5344e6['fieldName'],'type':_0x5344e6[_0xccf0('0x2e')]['key']};});_0xa9aac1[_0xccf0('0x2f')]=_['map'](_0x323072,_0xccf0('0x2a'));_0xa9aac1[_0xccf0('0x30')]=_[_0xccf0('0x31')](_0x547e04[_0xccf0('0x30')]);_0xa9aac1[_0xccf0('0x32')]=_[_0xccf0('0x33')](_0xa9aac1[_0xccf0('0x2f')],_0xa9aac1[_0xccf0('0x30')]);_0x2dbdcf[_0xccf0('0x34')]=_[_0xccf0('0x33')](_0xa9aac1[_0xccf0('0x2f')],qs['fields'](_0x547e04['query']['fields']));_0x2dbdcf[_0xccf0('0x34')]=_0x2dbdcf[_0xccf0('0x34')][_0xccf0('0x35')]?_0x2dbdcf['attributes']:_0xa9aac1['model'];if(!_0x547e04[_0xccf0('0x30')][_0xccf0('0x36')](_0xccf0('0x37'))){_0x2dbdcf[_0xccf0('0x38')]=qs[_0xccf0('0x38')](_0x547e04['query']['limit']);_0x2dbdcf[_0xccf0('0x1e')]=qs[_0xccf0('0x1e')](_0x547e04[_0xccf0('0x30')][_0xccf0('0x1e')]);}_0x2dbdcf[_0xccf0('0x39')]=qs[_0xccf0('0x3a')](_0x547e04['query'][_0xccf0('0x3a')]);_0x2dbdcf[_0xccf0('0x3b')]=qs[_0xccf0('0x32')](_[_0xccf0('0x3c')](_0x547e04[_0xccf0('0x30')],_0xa9aac1[_0xccf0('0x32')]),_0x323072);if(_0x547e04[_0xccf0('0x30')]['filter']){_0x2dbdcf[_0xccf0('0x3b')]=_[_0xccf0('0x3d')](_0x2dbdcf[_0xccf0('0x3b')],{'$or':_[_0xccf0('0x3e')](_0x323072,function(_0x4d293f){if(_0x4d293f[_0xccf0('0x2e')]!==_0xccf0('0x3f')){var _0x5948c2={};_0x5948c2[_0x4d293f[_0xccf0('0x2a')]]={'$like':'%'+_0x547e04['query'][_0xccf0('0x40')]+'%'};return _0x5948c2;}})});}_0x2dbdcf=_[_0xccf0('0x3d')]({},_0x2dbdcf,_0x547e04[_0xccf0('0x41')]);var _0x4cb7b1={'where':_0x2dbdcf['where']};return db[_0xccf0('0x2c')][_0xccf0('0x1d')](_0x4cb7b1)['then'](function(_0x1c6b99){_0x306bb4['count']=_0x1c6b99;if(_0x547e04[_0xccf0('0x30')][_0xccf0('0x42')]){_0x2dbdcf['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x2dbdcf);})[_0xccf0('0x26')](function(_0x20fd20){_0x306bb4[_0xccf0('0x43')]=_0x20fd20;return _0x306bb4;})[_0xccf0('0x26')](respondWithFilteredResult(_0x217a28,_0x2dbdcf))[_0xccf0('0x44')](handleError(_0x217a28,null));};exports[_0xccf0('0x45')]=function(_0x40a524,_0x20f4dd){var _0x5ddcc2={'raw':![],'where':{'id':_0x40a524[_0xccf0('0x46')]['id']}},_0x3169c1={};_0x3169c1[_0xccf0('0x2f')]=_[_0xccf0('0x31')](db[_0xccf0('0x2c')]['rawAttributes']);_0x3169c1['query']=_[_0xccf0('0x31')](_0x40a524[_0xccf0('0x30')]);_0x3169c1['filters']=_[_0xccf0('0x33')](_0x3169c1[_0xccf0('0x2f')],_0x3169c1[_0xccf0('0x30')]);_0x5ddcc2[_0xccf0('0x34')]=_[_0xccf0('0x33')](_0x3169c1['model'],qs[_0xccf0('0x47')](_0x40a524[_0xccf0('0x30')]['fields']));_0x5ddcc2[_0xccf0('0x34')]=_0x5ddcc2[_0xccf0('0x34')][_0xccf0('0x35')]?_0x5ddcc2[_0xccf0('0x34')]:_0x3169c1[_0xccf0('0x2f')];if(_0x40a524[_0xccf0('0x30')][_0xccf0('0x42')]){_0x5ddcc2[_0xccf0('0x48')]=[{'all':!![]}];}_0x5ddcc2=_[_0xccf0('0x3d')]({},_0x5ddcc2,_0x40a524['options']);return db['UserProfileResource']['find'](_0x5ddcc2)[_0xccf0('0x26')](handleEntityNotFound(_0x20f4dd,null))[_0xccf0('0x26')](respondWithResult(_0x20f4dd,null))[_0xccf0('0x44')](handleError(_0x20f4dd,null));};exports[_0xccf0('0x49')]=function(_0x11f08f,_0x8c7cf6){return db['UserProfileResource']['create'](_0x11f08f[_0xccf0('0x4a')],{})[_0xccf0('0x26')](respondWithResult(_0x8c7cf6,0xc9))[_0xccf0('0x44')](handleError(_0x8c7cf6,null));};exports[_0xccf0('0x25')]=function(_0x13b752,_0x4807fd){if(_0x13b752[_0xccf0('0x4a')]['id']){delete _0x13b752['body']['id'];}return db[_0xccf0('0x2c')][_0xccf0('0x4b')]({'where':{'id':_0x13b752['params']['id']}})[_0xccf0('0x26')](handleEntityNotFound(_0x4807fd,null))[_0xccf0('0x26')](saveUpdates(_0x13b752[_0xccf0('0x4a')],null))[_0xccf0('0x26')](respondWithResult(_0x4807fd,null))['catch'](handleError(_0x4807fd,null));};exports[_0xccf0('0x27')]=function(_0x4ed072,_0x5adb02){return db['UserProfileResource']['find']({'where':{'id':_0x4ed072[_0xccf0('0x46')]['id']}})['then'](handleEntityNotFound(_0x5adb02,null))[_0xccf0('0x26')](removeEntity(_0x5adb02,null))[_0xccf0('0x44')](handleError(_0x5adb02,null));};exports['describe']=function(_0x5804e7,_0x2df745){return db[_0xccf0('0x2c')][_0xccf0('0x4c')]()[_0xccf0('0x26')](respondWithResult(_0x2df745,null))[_0xccf0('0x44')](handleError(_0x2df745,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 215346e..ec18d7f 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 _0x8278=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3fae29,_0x3d65b5){var _0x200226=function(_0x338dff){while(--_0x338dff){_0x3fae29['push'](_0x3fae29['shift']());}};_0x200226(++_0x3d65b5);}(_0x8278,0xcb));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8827('0x0'))(_0x8827('0x1'));var moment=require(_0x8827('0x2'));var BPromise=require(_0x8827('0x3'));var rp=require(_0x8827('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8827('0x5'));var attributes=require(_0x8827('0x6'));module[_0x8827('0x7')]=function(_0xebd3da,_0xd70ebc){return _0xebd3da[_0x8827('0x8')](_0x8827('0x9'),attributes,{'tableName':_0x8827('0xa'),'paranoid':![],'indexes':[{'name':_0x8827('0xb'),'fields':['resourceId',_0x8827('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa290=['resourceId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','user_profile_has_resources','compositeIndex'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xa290,0xd9));var _0x0a29=function(_0x2f5a66,_0x4260a1){_0x2f5a66=_0x2f5a66-0x0;var _0x35a037=_0xa290[_0x2f5a66];return _0x35a037;};'use strict';var _=require(_0x0a29('0x0'));var util=require(_0x0a29('0x1'));var logger=require(_0x0a29('0x2'))('api');var moment=require(_0x0a29('0x3'));var BPromise=require(_0x0a29('0x4'));var rp=require(_0x0a29('0x5'));var fs=require('fs');var path=require(_0x0a29('0x6'));var rimraf=require('rimraf');var config=require(_0x0a29('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x0a29('0x8')]=function(_0x1b3711,_0xd77177){return _0x1b3711['define']('UserProfileResource',attributes,{'tableName':_0x0a29('0x9'),'paranoid':![],'indexes':[{'name':_0x0a29('0xa'),'fields':[_0x0a29('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 7caf9cb..2d9610e 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 _0xa9bc=['debug','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../config/logger','rpc','client','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9bc,0x185));var _0xca9b=function(_0x4cd6b2,_0x470966){_0x4cd6b2=_0x4cd6b2-0x0;var _0x51535c=_0xa9bc[_0x4cd6b2];return _0x51535c;};'use strict';var _=require(_0xca9b('0x0'));var util=require('util');var moment=require(_0xca9b('0x1'));var BPromise=require(_0xca9b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca9b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xca9b('0x4'))(_0xca9b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xca9b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300736,_0x59dcd8,_0x2cc028){return new BPromise(function(_0x461f83,_0x40fc77){return client[_0xca9b('0x7')](_0x300736,_0x2cc028)['then'](function(_0x12c01f){logger[_0xca9b('0x8')](_0xca9b('0x9'),_0x59dcd8,_0xca9b('0xa'));logger[_0xca9b('0xb')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x59dcd8,_0xca9b('0xa'),JSON[_0xca9b('0xc')](_0x12c01f));if(_0x12c01f['error']){if(_0x12c01f[_0xca9b('0xd')][_0xca9b('0xe')]===0x1f4){logger[_0xca9b('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x59dcd8,_0x12c01f[_0xca9b('0xd')][_0xca9b('0xf')]);return _0x40fc77(_0x12c01f[_0xca9b('0xd')][_0xca9b('0xf')]);}logger[_0xca9b('0xd')](_0xca9b('0x9'),_0x59dcd8,_0x12c01f[_0xca9b('0xd')][_0xca9b('0xf')]);return _0x461f83(_0x12c01f['error']['message']);}else{logger[_0xca9b('0x8')](_0xca9b('0x9'),_0x59dcd8,_0xca9b('0xa'));_0x461f83(_0x12c01f['result'][_0xca9b('0xf')]);}})['catch'](function(_0xe96be4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x59dcd8,_0xe96be4);_0x40fc77(_0xe96be4);});});} \ No newline at end of file +var _0x13e0=['stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x1ea174,_0x56caa6){var _0x2fac69=function(_0x5dc177){while(--_0x5dc177){_0x1ea174['push'](_0x1ea174['shift']());}};_0x2fac69(++_0x56caa6);}(_0x13e0,0x97));var _0x013e=function(_0x568a5c,_0x611e6c){_0x568a5c=_0x568a5c-0x0;var _0x4c9d9a=_0x13e0[_0x568a5c];return _0x4c9d9a;};'use strict';var _=require('lodash');var util=require(_0x013e('0x0'));var moment=require(_0x013e('0x1'));var BPromise=require(_0x013e('0x2'));var rs=require(_0x013e('0x3'));var fs=require('fs');var Redis=require(_0x013e('0x4'));var db=require(_0x013e('0x5'))['db'];var utils=require(_0x013e('0x6'));var logger=require(_0x013e('0x7'))(_0x013e('0x8'));var config=require(_0x013e('0x9'));var jayson=require(_0x013e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e27e0,_0x2a063b,_0x3fea7f){return new BPromise(function(_0x89ea1d,_0x1d6fda){return client[_0x013e('0xb')](_0x1e27e0,_0x3fea7f)[_0x013e('0xc')](function(_0x18e91d){logger['info'](_0x013e('0xd'),_0x2a063b,_0x013e('0xe'));logger[_0x013e('0xf')](_0x013e('0x10'),_0x2a063b,_0x013e('0xe'),JSON[_0x013e('0x11')](_0x18e91d));if(_0x18e91d[_0x013e('0x12')]){if(_0x18e91d['error'][_0x013e('0x13')]===0x1f4){logger[_0x013e('0x12')](_0x013e('0xd'),_0x2a063b,_0x18e91d['error'][_0x013e('0x14')]);return _0x1d6fda(_0x18e91d['error'][_0x013e('0x14')]);}logger[_0x013e('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x2a063b,_0x18e91d[_0x013e('0x12')][_0x013e('0x14')]);return _0x89ea1d(_0x18e91d[_0x013e('0x12')][_0x013e('0x14')]);}else{logger[_0x013e('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x2a063b,_0x013e('0xe'));_0x89ea1d(_0x18e91d[_0x013e('0x16')][_0x013e('0x14')]);}})[_0x013e('0x17')](function(_0x13e828){logger[_0x013e('0x12')](_0x013e('0xd'),_0x2a063b,_0x13e828);_0x1d6fda(_0x13e828);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 10830c5..a99aa93 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 _0x9b9e=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x9b9e,0x115));var _0xe9b9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9b9e[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xe9b9('0x0'));var util=require(_0xe9b9('0x1'));var path=require(_0xe9b9('0x2'));var timeout=require(_0xe9b9('0x3'));var express=require(_0xe9b9('0x4'));var router=express[_0xe9b9('0x5')]();var fs_extra=require(_0xe9b9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe9b9('0x7'));var config=require(_0xe9b9('0x8'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0xe9b9('0x9')](),controller[_0xe9b9('0xa')]);router[_0xe9b9('0xb')](_0xe9b9('0xc'),auth[_0xe9b9('0x9')](),controller[_0xe9b9('0xd')]);router[_0xe9b9('0xb')]('/:id',auth[_0xe9b9('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe9b9('0xe')]);router[_0xe9b9('0xf')](_0xe9b9('0x10'),auth[_0xe9b9('0x9')](),controller['update']);router[_0xe9b9('0x11')](_0xe9b9('0x10'),auth[_0xe9b9('0x9')](),controller[_0xe9b9('0x12')]);module[_0xe9b9('0x13')]=router; \ No newline at end of file +var _0x39f3=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x39f3,0x126));var _0x339f=function(_0x8493a3,_0x15d45c){_0x8493a3=_0x8493a3-0x0;var _0xe45880=_0x39f3[_0x8493a3];return _0xe45880;};'use strict';var multer=require(_0x339f('0x0'));var util=require(_0x339f('0x1'));var path=require(_0x339f('0x2'));var timeout=require(_0x339f('0x3'));var express=require(_0x339f('0x4'));var router=express[_0x339f('0x5')]();var fs_extra=require(_0x339f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x339f('0x7'));var config=require(_0x339f('0x8'));var controller=require(_0x339f('0x9'));router[_0x339f('0xa')]('/',auth[_0x339f('0xb')](),controller[_0x339f('0xc')]);router[_0x339f('0xa')](_0x339f('0xd'),auth[_0x339f('0xb')](),controller[_0x339f('0xe')]);router[_0x339f('0xa')](_0x339f('0xf'),auth[_0x339f('0xb')](),controller[_0x339f('0x10')]);router[_0x339f('0x11')]('/',auth['isAuthenticated'](),controller[_0x339f('0x12')]);router[_0x339f('0x13')]('/:id',auth[_0x339f('0xb')](),controller[_0x339f('0x14')]);router[_0x339f('0x15')]('/:id',auth[_0x339f('0xb')](),controller[_0x339f('0x16')]);module[_0x339f('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 180be25..475546c 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 _0x2b37=['exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize'];(function(_0x3b3f0f,_0x31a071){var _0x3afe5a=function(_0x1ed4e9){while(--_0x1ed4e9){_0x3b3f0f['push'](_0x3b3f0f['shift']());}};_0x3afe5a(++_0x31a071);}(_0x2b37,0x12b));var _0x72b3=function(_0x4ea62c,_0x57c4c4){_0x4ea62c=_0x4ea62c-0x0;var _0x3743d5=_0x2b37[_0x4ea62c];return _0x3743d5;};'use strict';var Sequelize=require(_0x72b3('0x0'));module[_0x72b3('0x1')]={'name':{'type':Sequelize[_0x72b3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x72b3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x72b3('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x72b3('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x72b3('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x72b3('0x2')],'set':function(_0x217bcc){this[_0x72b3('0x5')]('crudPermissions',_0x217bcc?_0x217bcc[_0x72b3('0x6')](''):[]);},'get':function(){return this[_0x72b3('0x7')]('crudPermissions')?this[_0x72b3('0x7')](_0x72b3('0x8'))[_0x72b3('0x9')](''):[];}}}; \ No newline at end of file +var _0x1ef3=['getDataValue','sequelize','exports','STRING','INTEGER','BOOLEAN','crudPermissions','join'];(function(_0x2234e0,_0x447c1d){var _0x2aa615=function(_0x399c56){while(--_0x399c56){_0x2234e0['push'](_0x2234e0['shift']());}};_0x2aa615(++_0x447c1d);}(_0x1ef3,0x69));var _0x31ef=function(_0x38bca2,_0x1c9bf2){_0x38bca2=_0x38bca2-0x0;var _0x82b6=_0x1ef3[_0x38bca2];return _0x82b6;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x31ef('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x31ef('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x31ef('0x2')],'set':function(_0x58388a){this['setDataValue'](_0x31ef('0x5'),_0x58388a?_0x58388a[_0x31ef('0x6')](''):[]);},'get':function(){return this[_0x31ef('0x7')](_0x31ef('0x5'))?this[_0x31ef('0x7')](_0x31ef('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 5e0cd06..3720b5f 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 _0xca2b=['rawAttributes','fieldName','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','rows','params','includeAll','include','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','UserProfileSection'];(function(_0x3dbb12,_0x196e8a){var _0x1db639=function(_0x12855f){while(--_0x12855f){_0x3dbb12['push'](_0x3dbb12['shift']());}};_0x1db639(++_0x196e8a);}(_0xca2b,0x156));var _0xbca2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xca2b[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0xbca2('0x0'));var emlformat=require(_0xbca2('0x1'));var rimraf=require(_0xbca2('0x2'));var zipdir=require(_0xbca2('0x3'));var jsonpatch=require(_0xbca2('0x4'));var rp=require(_0xbca2('0x5'));var moment=require(_0xbca2('0x6'));var BPromise=require(_0xbca2('0x7'));var Mustache=require('mustache');var util=require(_0xbca2('0x8'));var path=require(_0xbca2('0x9'));var sox=require('sox');var csv=require(_0xbca2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbca2('0xb'));var _=require(_0xbca2('0xc'));var squel=require(_0xbca2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbca2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbca2('0xf'));var Redis=require(_0xbca2('0x10'));var authService=require(_0xbca2('0x11'));var qs=require(_0xbca2('0x12'));var as=require(_0xbca2('0x13'));var hardwareService=require(_0xbca2('0x14'));var logger=require(_0xbca2('0x15'))(_0xbca2('0x16'));var utils=require(_0xbca2('0x17'));var config=require(_0xbca2('0x18'));var licenseUtil=require(_0xbca2('0x19'));var db=require(_0xbca2('0x1a'))['db'];function respondWithStatusCode(_0x26bca0,_0x562689){_0x562689=_0x562689||0xcc;return function(_0x32e4e8){if(_0x32e4e8){return _0x26bca0[_0xbca2('0x1b')](_0x562689);}return _0x26bca0[_0xbca2('0x1c')](_0x562689)[_0xbca2('0x1d')]();};}function respondWithResult(_0x1e84d5,_0x170913){_0x170913=_0x170913||0xc8;return function(_0xe2eb6b){if(_0xe2eb6b){return _0x1e84d5[_0xbca2('0x1c')](_0x170913)[_0xbca2('0x1e')](_0xe2eb6b);}};}function respondWithFilteredResult(_0x5f2a39,_0x4dadaf){return function(_0x11e7c6){if(_0x11e7c6){var _0x1b593b=_0x11e7c6[_0xbca2('0x1f')],_0x53e224=_0x4dadaf['offset'],_0x9d7a88=_0x4dadaf[_0xbca2('0x20')]+_0x4dadaf[_0xbca2('0x21')],_0x114c08;if(_0x9d7a88>=_0x1b593b){_0x9d7a88=_0x1b593b;_0x114c08=0xc8;}else{_0x114c08=0xce;}_0x5f2a39[_0xbca2('0x1c')](_0x114c08);return _0x5f2a39[_0xbca2('0x22')](_0xbca2('0x23'),_0x53e224+'-'+_0x9d7a88+'/'+_0x1b593b)['json'](_0x11e7c6);}return null;};}function patchUpdates(_0x595030){return function(_0x328306){try{jsonpatch[_0xbca2('0x24')](_0x328306,_0x595030,!![]);}catch(_0x5dba8d){return BPromise[_0xbca2('0x25')](_0x5dba8d);}return _0x328306[_0xbca2('0x26')]();};}function saveUpdates(_0x434699,_0x4b5d84){return function(_0x3977eb){if(_0x3977eb){return _0x3977eb[_0xbca2('0x27')](_0x434699)['then'](function(_0x1dceb2){return _0x1dceb2;});}return null;};}function removeEntity(_0x20b65d,_0x37c911){return function(_0x392817){if(_0x392817){return _0x392817[_0xbca2('0x28')]()[_0xbca2('0x29')](function(){_0x20b65d[_0xbca2('0x1c')](0xcc)[_0xbca2('0x1d')]();});}};}function handleEntityNotFound(_0x8cdb5d,_0x269ba4){return function(_0xd27b87){if(!_0xd27b87){_0x8cdb5d[_0xbca2('0x1b')](0x194);}return _0xd27b87;};}function handleError(_0x54a5dd,_0x331260){_0x331260=_0x331260||0x1f4;return function(_0x2b4d8b){logger[_0xbca2('0x2a')](_0x2b4d8b[_0xbca2('0x2b')]);if(_0x2b4d8b[_0xbca2('0x2c')]){delete _0x2b4d8b[_0xbca2('0x2c')];}_0x54a5dd[_0xbca2('0x1c')](_0x331260)['send'](_0x2b4d8b);};}exports[_0xbca2('0x2d')]=function(_0x20b7a0,_0x1bf878){var _0xadfbd8={},_0x1e7e75={},_0x1e2372={'count':0x0,'rows':[]};var _0xc7d89f=_[_0xbca2('0x2e')](db[_0xbca2('0x2f')][_0xbca2('0x30')],function(_0x4f2578){return{'name':_0x4f2578[_0xbca2('0x31')],'type':_0x4f2578['type'][_0xbca2('0x32')]};});_0x1e7e75['model']=_['map'](_0xc7d89f,_0xbca2('0x2c'));_0x1e7e75['query']=_[_0xbca2('0x33')](_0x20b7a0[_0xbca2('0x34')]);_0x1e7e75['filters']=_['intersection'](_0x1e7e75[_0xbca2('0x35')],_0x1e7e75[_0xbca2('0x34')]);_0xadfbd8[_0xbca2('0x36')]=_[_0xbca2('0x37')](_0x1e7e75[_0xbca2('0x35')],qs[_0xbca2('0x38')](_0x20b7a0[_0xbca2('0x34')][_0xbca2('0x38')]));_0xadfbd8[_0xbca2('0x36')]=_0xadfbd8[_0xbca2('0x36')][_0xbca2('0x39')]?_0xadfbd8['attributes']:_0x1e7e75[_0xbca2('0x35')];if(!_0x20b7a0[_0xbca2('0x34')][_0xbca2('0x3a')]('nolimit')){_0xadfbd8[_0xbca2('0x21')]=qs[_0xbca2('0x21')](_0x20b7a0[_0xbca2('0x34')][_0xbca2('0x21')]);_0xadfbd8[_0xbca2('0x20')]=qs[_0xbca2('0x20')](_0x20b7a0[_0xbca2('0x34')][_0xbca2('0x20')]);}_0xadfbd8[_0xbca2('0x3b')]=qs[_0xbca2('0x3c')](_0x20b7a0[_0xbca2('0x34')]['sort']);_0xadfbd8['where']=qs[_0xbca2('0x3d')](_[_0xbca2('0x3e')](_0x20b7a0[_0xbca2('0x34')],_0x1e7e75[_0xbca2('0x3d')]),_0xc7d89f);if(_0x20b7a0[_0xbca2('0x34')]['filter']){_0xadfbd8[_0xbca2('0x3f')]=_[_0xbca2('0x40')](_0xadfbd8[_0xbca2('0x3f')],{'$or':_[_0xbca2('0x2e')](_0xc7d89f,function(_0x453928){if(_0x453928[_0xbca2('0x41')]!==_0xbca2('0x42')){var _0x9866c3={};_0x9866c3[_0x453928[_0xbca2('0x2c')]]={'$like':'%'+_0x20b7a0[_0xbca2('0x34')][_0xbca2('0x43')]+'%'};return _0x9866c3;}})});}_0xadfbd8=_[_0xbca2('0x40')]({},_0xadfbd8,_0x20b7a0['options']);var _0xa93494={'where':_0xadfbd8['where']};return db[_0xbca2('0x2f')][_0xbca2('0x1f')](_0xa93494)[_0xbca2('0x29')](function(_0x44c2c6){_0x1e2372[_0xbca2('0x1f')]=_0x44c2c6;if(_0x20b7a0['query']['includeAll']){_0xadfbd8['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0xadfbd8);})[_0xbca2('0x29')](function(_0x5b3208){_0x1e2372[_0xbca2('0x44')]=_0x5b3208;return _0x1e2372;})[_0xbca2('0x29')](respondWithFilteredResult(_0x1bf878,_0xadfbd8))['catch'](handleError(_0x1bf878,null));};exports['show']=function(_0xef5723,_0x758ffa){var _0x32abe9={'raw':![],'where':{'id':_0xef5723[_0xbca2('0x45')]['id']}},_0x3357d9={};_0x3357d9[_0xbca2('0x35')]=_[_0xbca2('0x33')](db['UserProfileSection'][_0xbca2('0x30')]);_0x3357d9[_0xbca2('0x34')]=_[_0xbca2('0x33')](_0xef5723['query']);_0x3357d9['filters']=_[_0xbca2('0x37')](_0x3357d9[_0xbca2('0x35')],_0x3357d9[_0xbca2('0x34')]);_0x32abe9['attributes']=_['intersection'](_0x3357d9[_0xbca2('0x35')],qs['fields'](_0xef5723['query']['fields']));_0x32abe9['attributes']=_0x32abe9[_0xbca2('0x36')][_0xbca2('0x39')]?_0x32abe9[_0xbca2('0x36')]:_0x3357d9['model'];if(_0xef5723[_0xbca2('0x34')][_0xbca2('0x46')]){_0x32abe9[_0xbca2('0x47')]=[{'all':!![]}];}_0x32abe9=_[_0xbca2('0x40')]({},_0x32abe9,_0xef5723[_0xbca2('0x48')]);return db[_0xbca2('0x2f')][_0xbca2('0x49')](_0x32abe9)['then'](handleEntityNotFound(_0x758ffa,null))[_0xbca2('0x29')](respondWithResult(_0x758ffa,null))[_0xbca2('0x4a')](handleError(_0x758ffa,null));};exports[_0xbca2('0x4b')]=function(_0x4b0544,_0x2351b9){return db[_0xbca2('0x2f')]['create'](_0x4b0544[_0xbca2('0x4c')],{})['then'](respondWithResult(_0x2351b9,0xc9))[_0xbca2('0x4a')](handleError(_0x2351b9,null));};exports[_0xbca2('0x27')]=function(_0x3967e0,_0x39dd68){if(_0x3967e0[_0xbca2('0x4c')]['id']){delete _0x3967e0[_0xbca2('0x4c')]['id'];}return db[_0xbca2('0x2f')][_0xbca2('0x49')]({'where':{'id':_0x3967e0[_0xbca2('0x45')]['id']}})[_0xbca2('0x29')](handleEntityNotFound(_0x39dd68,null))[_0xbca2('0x29')](saveUpdates(_0x3967e0[_0xbca2('0x4c')],null))[_0xbca2('0x29')](respondWithResult(_0x39dd68,null))[_0xbca2('0x4a')](handleError(_0x39dd68,null));};exports[_0xbca2('0x28')]=function(_0x2c28bf,_0x3755c3){return db[_0xbca2('0x2f')][_0xbca2('0x49')]({'where':{'id':_0x2c28bf['params']['id']}})[_0xbca2('0x29')](handleEntityNotFound(_0x3755c3,null))[_0xbca2('0x29')](removeEntity(_0x3755c3,null))['catch'](handleError(_0x3755c3,null));};exports[_0xbca2('0x4d')]=function(_0x3975eb,_0x343929){return db[_0xbca2('0x2f')][_0xbca2('0x4d')]()[_0xbca2('0x29')](respondWithResult(_0x343929,null))[_0xbca2('0x4a')](handleError(_0x343929,null));}; \ No newline at end of file +var _0x32ff=['apply','save','update','then','destroy','stack','name','send','index','UserProfileSection','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x31a67e,_0x585f61){var _0x5a55ff=function(_0x3a73d0){while(--_0x3a73d0){_0x31a67e['push'](_0x31a67e['shift']());}};_0x5a55ff(++_0x585f61);}(_0x32ff,0xc7));var _0xf32f=function(_0x4d5c3e,_0x3ac2b9){_0x4d5c3e=_0x4d5c3e-0x0;var _0x3b2536=_0x32ff[_0x4d5c3e];return _0x3b2536;};'use strict';var pdf=require(_0xf32f('0x0'));var emlformat=require(_0xf32f('0x1'));var rimraf=require(_0xf32f('0x2'));var zipdir=require(_0xf32f('0x3'));var jsonpatch=require(_0xf32f('0x4'));var rp=require(_0xf32f('0x5'));var moment=require(_0xf32f('0x6'));var BPromise=require(_0xf32f('0x7'));var Mustache=require(_0xf32f('0x8'));var util=require(_0xf32f('0x9'));var path=require(_0xf32f('0xa'));var sox=require(_0xf32f('0xb'));var csv=require(_0xf32f('0xc'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf32f('0xd'));var _=require('lodash');var squel=require(_0xf32f('0xe'));var crypto=require(_0xf32f('0xf'));var jsforce=require(_0xf32f('0x10'));var deskjs=require(_0xf32f('0x11'));var toCsv=require(_0xf32f('0xc'));var querystring=require(_0xf32f('0x12'));var Papa=require(_0xf32f('0x13'));var Redis=require(_0xf32f('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf32f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf32f('0x16'));var utils=require(_0xf32f('0x17'));var config=require(_0xf32f('0x18'));var licenseUtil=require(_0xf32f('0x19'));var db=require(_0xf32f('0x1a'))['db'];function respondWithStatusCode(_0x159f72,_0x257380){_0x257380=_0x257380||0xcc;return function(_0x364948){if(_0x364948){return _0x159f72[_0xf32f('0x1b')](_0x257380);}return _0x159f72['status'](_0x257380)[_0xf32f('0x1c')]();};}function respondWithResult(_0x120885,_0x174efc){_0x174efc=_0x174efc||0xc8;return function(_0x59128f){if(_0x59128f){return _0x120885[_0xf32f('0x1d')](_0x174efc)[_0xf32f('0x1e')](_0x59128f);}};}function respondWithFilteredResult(_0xeec5c,_0x160ba1){return function(_0x1b7dc3){if(_0x1b7dc3){var _0x1bbaa3=_0x1b7dc3[_0xf32f('0x1f')],_0x5e493a=_0x160ba1['offset'],_0x30b1a1=_0x160ba1[_0xf32f('0x20')]+_0x160ba1[_0xf32f('0x21')],_0x534e7a;if(_0x30b1a1>=_0x1bbaa3){_0x30b1a1=_0x1bbaa3;_0x534e7a=0xc8;}else{_0x534e7a=0xce;}_0xeec5c[_0xf32f('0x1d')](_0x534e7a);return _0xeec5c[_0xf32f('0x22')]('Content-Range',_0x5e493a+'-'+_0x30b1a1+'/'+_0x1bbaa3)[_0xf32f('0x1e')](_0x1b7dc3);}return null;};}function patchUpdates(_0x181d12){return function(_0x4a0805){try{jsonpatch[_0xf32f('0x23')](_0x4a0805,_0x181d12,!![]);}catch(_0x1177a4){return BPromise['reject'](_0x1177a4);}return _0x4a0805[_0xf32f('0x24')]();};}function saveUpdates(_0x40dbdb,_0xda10c8){return function(_0xf2fa68){if(_0xf2fa68){return _0xf2fa68[_0xf32f('0x25')](_0x40dbdb)[_0xf32f('0x26')](function(_0x465f80){return _0x465f80;});}return null;};}function removeEntity(_0xe0b16d,_0x48a316){return function(_0x384490){if(_0x384490){return _0x384490[_0xf32f('0x27')]()[_0xf32f('0x26')](function(){_0xe0b16d[_0xf32f('0x1d')](0xcc)[_0xf32f('0x1c')]();});}};}function handleEntityNotFound(_0x5d0c5a,_0x27914c){return function(_0x5638c1){if(!_0x5638c1){_0x5d0c5a[_0xf32f('0x1b')](0x194);}return _0x5638c1;};}function handleError(_0x1f82c4,_0x52eac7){_0x52eac7=_0x52eac7||0x1f4;return function(_0x517924){logger['error'](_0x517924[_0xf32f('0x28')]);if(_0x517924[_0xf32f('0x29')]){delete _0x517924[_0xf32f('0x29')];}_0x1f82c4[_0xf32f('0x1d')](_0x52eac7)[_0xf32f('0x2a')](_0x517924);};}exports[_0xf32f('0x2b')]=function(_0x1e504f,_0x26bcee){var _0x1a7382={},_0xf409ed={},_0x328c15={'count':0x0,'rows':[]};var _0xe631d0=_['map'](db[_0xf32f('0x2c')][_0xf32f('0x2d')],function(_0x375e57){return{'name':_0x375e57['fieldName'],'type':_0x375e57[_0xf32f('0x2e')][_0xf32f('0x2f')]};});_0xf409ed[_0xf32f('0x30')]=_[_0xf32f('0x31')](_0xe631d0,_0xf32f('0x29'));_0xf409ed[_0xf32f('0x32')]=_[_0xf32f('0x33')](_0x1e504f['query']);_0xf409ed[_0xf32f('0x34')]=_[_0xf32f('0x35')](_0xf409ed[_0xf32f('0x30')],_0xf409ed[_0xf32f('0x32')]);_0x1a7382[_0xf32f('0x36')]=_['intersection'](_0xf409ed[_0xf32f('0x30')],qs['fields'](_0x1e504f['query'][_0xf32f('0x37')]));_0x1a7382[_0xf32f('0x36')]=_0x1a7382[_0xf32f('0x36')][_0xf32f('0x38')]?_0x1a7382[_0xf32f('0x36')]:_0xf409ed[_0xf32f('0x30')];if(!_0x1e504f['query'][_0xf32f('0x39')](_0xf32f('0x3a'))){_0x1a7382[_0xf32f('0x21')]=qs[_0xf32f('0x21')](_0x1e504f[_0xf32f('0x32')][_0xf32f('0x21')]);_0x1a7382[_0xf32f('0x20')]=qs[_0xf32f('0x20')](_0x1e504f['query'][_0xf32f('0x20')]);}_0x1a7382[_0xf32f('0x3b')]=qs['sort'](_0x1e504f[_0xf32f('0x32')][_0xf32f('0x3c')]);_0x1a7382[_0xf32f('0x3d')]=qs['filters'](_[_0xf32f('0x3e')](_0x1e504f[_0xf32f('0x32')],_0xf409ed[_0xf32f('0x34')]),_0xe631d0);if(_0x1e504f[_0xf32f('0x32')][_0xf32f('0x3f')]){_0x1a7382[_0xf32f('0x3d')]=_[_0xf32f('0x40')](_0x1a7382[_0xf32f('0x3d')],{'$or':_[_0xf32f('0x31')](_0xe631d0,function(_0x14dfcc){if(_0x14dfcc[_0xf32f('0x2e')]!==_0xf32f('0x41')){var _0x1fb282={};_0x1fb282[_0x14dfcc[_0xf32f('0x29')]]={'$like':'%'+_0x1e504f[_0xf32f('0x32')]['filter']+'%'};return _0x1fb282;}})});}_0x1a7382=_[_0xf32f('0x40')]({},_0x1a7382,_0x1e504f[_0xf32f('0x42')]);var _0x482120={'where':_0x1a7382[_0xf32f('0x3d')]};return db[_0xf32f('0x2c')][_0xf32f('0x1f')](_0x482120)['then'](function(_0x695248){_0x328c15['count']=_0x695248;if(_0x1e504f[_0xf32f('0x32')][_0xf32f('0x43')]){_0x1a7382['include']=[{'all':!![]}];}return db[_0xf32f('0x2c')][_0xf32f('0x44')](_0x1a7382);})['then'](function(_0x563f1a){_0x328c15[_0xf32f('0x45')]=_0x563f1a;return _0x328c15;})[_0xf32f('0x26')](respondWithFilteredResult(_0x26bcee,_0x1a7382))[_0xf32f('0x46')](handleError(_0x26bcee,null));};exports[_0xf32f('0x47')]=function(_0xdda418,_0x55b8fd){var _0xd5dbbe={'raw':![],'where':{'id':_0xdda418[_0xf32f('0x48')]['id']}},_0x5d2098={};_0x5d2098['model']=_[_0xf32f('0x33')](db[_0xf32f('0x2c')][_0xf32f('0x2d')]);_0x5d2098[_0xf32f('0x32')]=_[_0xf32f('0x33')](_0xdda418[_0xf32f('0x32')]);_0x5d2098[_0xf32f('0x34')]=_[_0xf32f('0x35')](_0x5d2098[_0xf32f('0x30')],_0x5d2098[_0xf32f('0x32')]);_0xd5dbbe[_0xf32f('0x36')]=_[_0xf32f('0x35')](_0x5d2098[_0xf32f('0x30')],qs[_0xf32f('0x37')](_0xdda418[_0xf32f('0x32')]['fields']));_0xd5dbbe[_0xf32f('0x36')]=_0xd5dbbe[_0xf32f('0x36')][_0xf32f('0x38')]?_0xd5dbbe['attributes']:_0x5d2098['model'];if(_0xdda418[_0xf32f('0x32')]['includeAll']){_0xd5dbbe[_0xf32f('0x49')]=[{'all':!![]}];}_0xd5dbbe=_[_0xf32f('0x40')]({},_0xd5dbbe,_0xdda418[_0xf32f('0x42')]);return db['UserProfileSection'][_0xf32f('0x4a')](_0xd5dbbe)[_0xf32f('0x26')](handleEntityNotFound(_0x55b8fd,null))[_0xf32f('0x26')](respondWithResult(_0x55b8fd,null))[_0xf32f('0x46')](handleError(_0x55b8fd,null));};exports[_0xf32f('0x4b')]=function(_0x4d7845,_0x2a1f95){return db[_0xf32f('0x2c')][_0xf32f('0x4b')](_0x4d7845[_0xf32f('0x4c')],{})[_0xf32f('0x26')](respondWithResult(_0x2a1f95,0xc9))[_0xf32f('0x46')](handleError(_0x2a1f95,null));};exports[_0xf32f('0x25')]=function(_0xf5555d,_0x4918c9){if(_0xf5555d['body']['id']){delete _0xf5555d[_0xf32f('0x4c')]['id'];}return db[_0xf32f('0x2c')][_0xf32f('0x4a')]({'where':{'id':_0xf5555d[_0xf32f('0x48')]['id']}})['then'](handleEntityNotFound(_0x4918c9,null))['then'](saveUpdates(_0xf5555d[_0xf32f('0x4c')],null))[_0xf32f('0x26')](respondWithResult(_0x4918c9,null))[_0xf32f('0x46')](handleError(_0x4918c9,null));};exports[_0xf32f('0x27')]=function(_0x84b542,_0x501c2c){return db['UserProfileSection']['find']({'where':{'id':_0x84b542['params']['id']}})['then'](handleEntityNotFound(_0x501c2c,null))[_0xf32f('0x26')](removeEntity(_0x501c2c,null))[_0xf32f('0x46')](handleError(_0x501c2c,null));};exports[_0xf32f('0x4d')]=function(_0x54bea4,_0x445e54){return db[_0xf32f('0x2c')][_0xf32f('0x4d')]()[_0xf32f('0x26')](respondWithResult(_0x445e54,null))[_0xf32f('0x46')](handleError(_0x445e54,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a6f095b..1f52eea 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 _0xb4e6=['bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','compositeIndex','lodash','../../config/logger','api','moment'];(function(_0x1dbbf9,_0x8b2d2a){var _0x3b3d22=function(_0x396607){while(--_0x396607){_0x1dbbf9['push'](_0x1dbbf9['shift']());}};_0x3b3d22(++_0x8b2d2a);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0xb4e6[_0x307bf6];return _0x2878fc;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x6b4e('0xb'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1cc=['bluebird','request-promise','rimraf','../../config/environment','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf1cc,0x1ae));var _0xcf1c=function(_0x906823,_0x3a6f6e){_0x906823=_0x906823-0x0;var _0x3aefc7=_0xf1cc[_0x906823];return _0x3aefc7;};'use strict';var _=require('lodash');var util=require(_0xcf1c('0x0'));var logger=require(_0xcf1c('0x1'))(_0xcf1c('0x2'));var moment=require(_0xcf1c('0x3'));var BPromise=require(_0xcf1c('0x4'));var rp=require(_0xcf1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf1c('0x6'));var config=require(_0xcf1c('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xcf1c('0x8')]=function(_0x49c86a,_0x3cb7fc){return _0x49c86a['define'](_0xcf1c('0x9'),attributes,{'tableName':_0xcf1c('0xa'),'paranoid':![],'indexes':[{'name':_0xcf1c('0xb'),'fields':[_0xcf1c('0xc'),_0xcf1c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 02db027..7ee41ee 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 _0x8803=['then','info','request\x20sent','debug','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x27cd32,_0x24ff36){var _0x405e89=function(_0x46c8e2){while(--_0x46c8e2){_0x27cd32['push'](_0x27cd32['shift']());}};_0x405e89(++_0x24ff36);}(_0x8803,0xbe));var _0x3880=function(_0x491837,_0x1bf150){_0x491837=_0x491837-0x0;var _0x260438=_0x8803[_0x491837];return _0x260438;};'use strict';var _=require(_0x3880('0x0'));var util=require(_0x3880('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3880('0x2'));var fs=require('fs');var Redis=require(_0x3880('0x3'));var db=require(_0x3880('0x4'))['db'];var utils=require(_0x3880('0x5'));var logger=require(_0x3880('0x6'))(_0x3880('0x7'));var config=require(_0x3880('0x8'));var jayson=require(_0x3880('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2919,_0x5ab3a5,_0x195a3b){return new BPromise(function(_0x18036d,_0x23c825){return client['request'](_0x3a2919,_0x195a3b)[_0x3880('0xa')](function(_0x3c0a86){logger[_0x3880('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x5ab3a5,_0x3880('0xc'));logger[_0x3880('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5ab3a5,_0x3880('0xc'),JSON['stringify'](_0x3c0a86));if(_0x3c0a86['error']){if(_0x3c0a86[_0x3880('0xe')][_0x3880('0xf')]===0x1f4){logger[_0x3880('0xe')](_0x3880('0x10'),_0x5ab3a5,_0x3c0a86[_0x3880('0xe')]['message']);return _0x23c825(_0x3c0a86[_0x3880('0xe')]['message']);}logger[_0x3880('0xe')](_0x3880('0x10'),_0x5ab3a5,_0x3c0a86['error'][_0x3880('0x11')]);return _0x18036d(_0x3c0a86['error'][_0x3880('0x11')]);}else{logger[_0x3880('0xb')](_0x3880('0x10'),_0x5ab3a5,_0x3880('0xc'));_0x18036d(_0x3c0a86[_0x3880('0x12')][_0x3880('0x11')]);}})[_0x3880('0x13')](function(_0x94f8f7){logger['error'](_0x3880('0x10'),_0x5ab3a5,_0x94f8f7);_0x23c825(_0x94f8f7);});});} \ No newline at end of file +var _0x223c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x104d23,_0x39fb6c){var _0x1988c5=function(_0x1c839f){while(--_0x1c839f){_0x104d23['push'](_0x104d23['shift']());}};_0x1988c5(++_0x39fb6c);}(_0x223c,0x1c9));var _0xc223=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x223c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc223('0x0'));var util=require('util');var moment=require(_0xc223('0x1'));var BPromise=require(_0xc223('0x2'));var rs=require(_0xc223('0x3'));var fs=require('fs');var Redis=require(_0xc223('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc223('0x5'));var logger=require(_0xc223('0x6'))(_0xc223('0x7'));var config=require(_0xc223('0x8'));var jayson=require(_0xc223('0x9'));var client=jayson[_0xc223('0xa')][_0xc223('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b13e2,_0x45c2b1,_0x4871c5){return new BPromise(function(_0x422dbe,_0x473f34){return client['request'](_0x4b13e2,_0x4871c5)[_0xc223('0xc')](function(_0x107a5f){logger[_0xc223('0xd')](_0xc223('0xe'),_0x45c2b1,'request\x20sent');logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x45c2b1,_0xc223('0xf'),JSON['stringify'](_0x107a5f));if(_0x107a5f['error']){if(_0x107a5f[_0xc223('0x10')][_0xc223('0x11')]===0x1f4){logger['error'](_0xc223('0xe'),_0x45c2b1,_0x107a5f[_0xc223('0x10')][_0xc223('0x12')]);return _0x473f34(_0x107a5f[_0xc223('0x10')][_0xc223('0x12')]);}logger[_0xc223('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x45c2b1,_0x107a5f[_0xc223('0x10')][_0xc223('0x12')]);return _0x422dbe(_0x107a5f[_0xc223('0x10')][_0xc223('0x12')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x45c2b1,_0xc223('0xf'));_0x422dbe(_0x107a5f[_0xc223('0x13')][_0xc223('0x12')]);}})[_0xc223('0x14')](function(_0x34b00e){logger[_0xc223('0x10')](_0xc223('0xe'),_0x45c2b1,_0x34b00e);_0x473f34(_0x34b00e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index be900ef..c8fae62 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 _0x758a=['express','Router','../../config/environment','multer','util','path','connect-timeout'];(function(_0x3834cb,_0x8cd7ca){var _0x45a7fd=function(_0x1a73d8){while(--_0x1a73d8){_0x3834cb['push'](_0x3834cb['shift']());}};_0x45a7fd(++_0x8cd7ca);}(_0x758a,0x1d1));var _0xa758=function(_0x5f1df4,_0x11027a){_0x5f1df4=_0x5f1df4-0x0;var _0x112690=_0x758a[_0x5f1df4];return _0x112690;};'use strict';var multer=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var path=require(_0xa758('0x2'));var timeout=require(_0xa758('0x3'));var express=require(_0xa758('0x4'));var router=express[_0xa758('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa758('0x6'));module['exports']=router; \ No newline at end of file +var _0xd2bf=['../../components/auth/service','../../config/environment','exports','multer','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xd2bf[_0x510b98];return _0x45e775;};'use strict';var multer=require(_0xfd2b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd2b('0x1'));var router=express[_0xfd2b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfd2b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfd2b('0x4'));module[_0xfd2b('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index c95a36f..afe9753 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 _0xd8b0=['exports','sequelize'];(function(_0x1061de,_0x38998a){var _0x3b543f=function(_0x39e67a){while(--_0x39e67a){_0x1061de['push'](_0x1061de['shift']());}};_0x3b543f(++_0x38998a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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(_0x538991,_0x1de972){var _0x544685=function(_0x4297d2){while(--_0x4297d2){_0x538991['push'](_0x538991['shift']());}};_0x544685(++_0x1de972);}(_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 d7fe69f..0f4290a 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 _0x60e8=['user_has_sms_queues','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','UserSmsQueue'];(function(_0x5ca34b,_0x45d273){var _0x2933df=function(_0x21664a){while(--_0x21664a){_0x5ca34b['push'](_0x5ca34b['shift']());}};_0x2933df(++_0x45d273);}(_0x60e8,0x79));var _0x860e=function(_0x3bbbaf,_0x32bca0){_0x3bbbaf=_0x3bbbaf-0x0;var _0x3ba2dc=_0x60e8[_0x3bbbaf];return _0x3ba2dc;};'use strict';var _=require(_0x860e('0x0'));var util=require('util');var logger=require(_0x860e('0x1'))('api');var moment=require(_0x860e('0x2'));var BPromise=require(_0x860e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x860e('0x4'));var config=require(_0x860e('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x860e('0x6')]=function(_0x53fceb,_0x5048ea){return _0x53fceb[_0x860e('0x7')](_0x860e('0x8'),attributes,{'tableName':_0x860e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a4a=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x105bdf,_0x4b1df5){var _0x96886a=function(_0x550828){while(--_0x550828){_0x105bdf['push'](_0x105bdf['shift']());}};_0x96886a(++_0x4b1df5);}(_0x6a4a,0x16a));var _0xa6a4=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x6a4a[_0x27530d];return _0x59e561;};'use strict';var _=require(_0xa6a4('0x0'));var util=require(_0xa6a4('0x1'));var logger=require(_0xa6a4('0x2'))(_0xa6a4('0x3'));var moment=require('moment');var BPromise=require(_0xa6a4('0x4'));var rp=require(_0xa6a4('0x5'));var fs=require('fs');var path=require(_0xa6a4('0x6'));var rimraf=require(_0xa6a4('0x7'));var config=require(_0xa6a4('0x8'));var attributes=require(_0xa6a4('0x9'));module[_0xa6a4('0xa')]=function(_0xf7656c,_0x1e57eb){return _0xf7656c[_0xa6a4('0xb')](_0xa6a4('0xc'),attributes,{'tableName':_0xa6a4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 6e6250f..06a26ea 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 _0xedd9=['debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x4b4277,_0x22676f){var _0x1ff405=function(_0x2fa9e2){while(--_0x2fa9e2){_0x4b4277['push'](_0x4b4277['shift']());}};_0x1ff405(++_0x22676f);}(_0xedd9,0xe4));var _0x9edd=function(_0x267411,_0x17d00f){_0x267411=_0x267411-0x0;var _0x5467d4=_0xedd9[_0x267411];return _0x5467d4;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa14d87,_0x4f4334,_0x3dd245){return new BPromise(function(_0x2c2184,_0x497d25){return client[_0x9edd('0xa')](_0xa14d87,_0x3dd245)[_0x9edd('0xb')](function(_0x2f3437){logger[_0x9edd('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x4f4334,_0x9edd('0xd'));logger[_0x9edd('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4f4334,_0x9edd('0xd'),JSON[_0x9edd('0xf')](_0x2f3437));if(_0x2f3437[_0x9edd('0x10')]){if(_0x2f3437[_0x9edd('0x10')][_0x9edd('0x11')]===0x1f4){logger['error'](_0x9edd('0x12'),_0x4f4334,_0x2f3437[_0x9edd('0x10')][_0x9edd('0x13')]);return _0x497d25(_0x2f3437['error'][_0x9edd('0x13')]);}logger[_0x9edd('0x10')](_0x9edd('0x12'),_0x4f4334,_0x2f3437['error'][_0x9edd('0x13')]);return _0x2c2184(_0x2f3437[_0x9edd('0x10')][_0x9edd('0x13')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4f4334,_0x9edd('0xd'));_0x2c2184(_0x2f3437[_0x9edd('0x14')][_0x9edd('0x13')]);}})[_0x9edd('0x15')](function(_0x326396){logger['error'](_0x9edd('0x12'),_0x4f4334,_0x326396);_0x497d25(_0x326396);});});} \ No newline at end of file +var _0x335b=['http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x335b,0x115));var _0xb335=function(_0x216636,_0x50fac2){_0x216636=_0x216636-0x0;var _0x4354ec=_0x335b[_0x216636];return _0x4354ec;};'use strict';var _=require(_0xb335('0x0'));var util=require('util');var moment=require(_0xb335('0x1'));var BPromise=require('bluebird');var rs=require(_0xb335('0x2'));var fs=require('fs');var Redis=require(_0xb335('0x3'));var db=require(_0xb335('0x4'))['db'];var utils=require(_0xb335('0x5'));var logger=require(_0xb335('0x6'))(_0xb335('0x7'));var config=require(_0xb335('0x8'));var jayson=require(_0xb335('0x9'));var client=jayson[_0xb335('0xa')][_0xb335('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x178c37,_0x2c7070,_0x225e89){return new BPromise(function(_0xf55853,_0x40f380){return client[_0xb335('0xc')](_0x178c37,_0x225e89)[_0xb335('0xd')](function(_0x5da386){logger[_0xb335('0xe')](_0xb335('0xf'),_0x2c7070,_0xb335('0x10'));logger[_0xb335('0x11')](_0xb335('0x12'),_0x2c7070,_0xb335('0x10'),JSON[_0xb335('0x13')](_0x5da386));if(_0x5da386[_0xb335('0x14')]){if(_0x5da386[_0xb335('0x14')][_0xb335('0x15')]===0x1f4){logger[_0xb335('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x2c7070,_0x5da386['error'][_0xb335('0x16')]);return _0x40f380(_0x5da386['error']['message']);}logger[_0xb335('0x14')](_0xb335('0xf'),_0x2c7070,_0x5da386[_0xb335('0x14')][_0xb335('0x16')]);return _0xf55853(_0x5da386[_0xb335('0x14')]['message']);}else{logger[_0xb335('0xe')](_0xb335('0xf'),_0x2c7070,_0xb335('0x10'));_0xf55853(_0x5da386['result'][_0xb335('0x16')]);}})[_0xb335('0x17')](function(_0x45c723){logger['error'](_0xb335('0xf'),_0x2c7070,_0x45c723);_0x40f380(_0x45c723);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 1b13c97..27f48a0 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 _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x44afc8,_0x803873){var _0x67ba48=function(_0x25227f){while(--_0x25227f){_0x44afc8['push'](_0x44afc8['shift']());}};_0x67ba48(++_0x803873);}(_0xb03e,0x1eb));var _0xeb03=function(_0xa9de5b,_0x34c1c8){_0xa9de5b=_0xa9de5b-0x0;var _0xa92bb5=_0xb03e[_0xa9de5b];return _0xa92bb5;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));module[_0xeb03('0x9')]=router; \ No newline at end of file +var _0x6324=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x327e47,_0x1f69a3){var _0xd2b5cd=function(_0x53feec){while(--_0x53feec){_0x327e47['push'](_0x327e47['shift']());}};_0xd2b5cd(++_0x1f69a3);}(_0x6324,0x142));var _0x4632=function(_0x53f05d,_0x8b6dca){_0x53f05d=_0x53f05d-0x0;var _0x39715b=_0x6324[_0x53f05d];return _0x39715b;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e116f8a..4d1dc2c 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x3e0558,_0x4818a4){var _0xfa1387=function(_0x3b5c61){while(--_0x3b5c61){_0x3e0558['push'](_0x3e0558['shift']());}};_0xfa1387(++_0x4818a4);}(_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(_0x148783,_0x1ac458){var _0x85329a=function(_0x52afd8){while(--_0x52afd8){_0x148783['push'](_0x148783['shift']());}};_0x85329a(++_0x1ac458);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index fd9b251..ea8727e 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 _0xdb94=['moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0xdb94,0xe5));var _0x4db9=function(_0x14b305,_0x57804a){_0x14b305=_0x14b305-0x0;var _0x4788d9=_0xdb94[_0x14b305];return _0x4788d9;};'use strict';var _=require('lodash');var util=require(_0x4db9('0x0'));var logger=require(_0x4db9('0x1'))('api');var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var fs=require('fs');var path=require(_0x4db9('0x5'));var rimraf=require(_0x4db9('0x6'));var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x1d21a8,_0xc76bc1){return _0x1d21a8[_0x4db9('0x8')](_0x4db9('0x9'),attributes,{'tableName':_0x4db9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./userVoiceQueue.attributes'];(function(_0x38e656,_0x21bcb0){var _0x411375=function(_0x1582c3){while(--_0x1582c3){_0x38e656['push'](_0x38e656['shift']());}};_0x411375(++_0x21bcb0);}(_0x3e74,0x175));var _0x43e7=function(_0x30ebad,_0x2e394c){_0x30ebad=_0x30ebad-0x0;var _0x257897=_0x3e74[_0x30ebad];return _0x257897;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8fff7b5..4baf400 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 _0x8c14=['../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x3ace8e,_0xc5d82c){var _0x21203a=function(_0x36b7d8){while(--_0x36b7d8){_0x3ace8e['push'](_0x3ace8e['shift']());}};_0x21203a(++_0xc5d82c);}(_0x8c14,0x68));var _0x48c1=function(_0x3c9a3a,_0x2c6024){_0x3c9a3a=_0x3c9a3a-0x0;var _0x4049a2=_0x8c14[_0x3c9a3a];return _0x4049a2;};'use strict';var _=require(_0x48c1('0x0'));var util=require('util');var moment=require(_0x48c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x48c1('0x2'));var fs=require('fs');var Redis=require(_0x48c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48c1('0x4'))(_0x48c1('0x5'));var config=require(_0x48c1('0x6'));var jayson=require(_0x48c1('0x7'));var client=jayson[_0x48c1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48b954,_0x536b19,_0x440f21){return new BPromise(function(_0x24f10c,_0x797888){return client[_0x48c1('0x9')](_0x48b954,_0x440f21)[_0x48c1('0xa')](function(_0x16a3b7){logger[_0x48c1('0xb')](_0x48c1('0xc'),_0x536b19,_0x48c1('0xd'));logger[_0x48c1('0xe')](_0x48c1('0xf'),_0x536b19,_0x48c1('0xd'),JSON[_0x48c1('0x10')](_0x16a3b7));if(_0x16a3b7['error']){if(_0x16a3b7['error'][_0x48c1('0x11')]===0x1f4){logger[_0x48c1('0x12')](_0x48c1('0xc'),_0x536b19,_0x16a3b7[_0x48c1('0x12')]['message']);return _0x797888(_0x16a3b7['error']['message']);}logger[_0x48c1('0x12')](_0x48c1('0xc'),_0x536b19,_0x16a3b7['error']['message']);return _0x24f10c(_0x16a3b7[_0x48c1('0x12')][_0x48c1('0x13')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x536b19,_0x48c1('0xd'));_0x24f10c(_0x16a3b7[_0x48c1('0x14')][_0x48c1('0x13')]);}})[_0x48c1('0x15')](function(_0x1a4f61){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x536b19,_0x1a4f61);_0x797888(_0x1a4f61);});});} \ No newline at end of file +var _0x873c=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','info','debug','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x873c,0x95));var _0xc873=function(_0x2ea02c,_0x1ff1eb){_0x2ea02c=_0x2ea02c-0x0;var _0x490afe=_0x873c[_0x2ea02c];return _0x490afe;};'use strict';var _=require(_0xc873('0x0'));var util=require('util');var moment=require(_0xc873('0x1'));var BPromise=require(_0xc873('0x2'));var rs=require(_0xc873('0x3'));var fs=require('fs');var Redis=require(_0xc873('0x4'));var db=require(_0xc873('0x5'))['db'];var utils=require(_0xc873('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc873('0x7'));var client=jayson['client'][_0xc873('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd7e73e,_0x4a2aec,_0x2058f1){return new BPromise(function(_0x3062d9,_0x4a8020){return client[_0xc873('0x9')](_0xd7e73e,_0x2058f1)['then'](function(_0x19565c){logger[_0xc873('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x4a2aec,'request\x20sent');logger[_0xc873('0xb')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4a2aec,_0xc873('0xc'),JSON[_0xc873('0xd')](_0x19565c));if(_0x19565c[_0xc873('0xe')]){if(_0x19565c[_0xc873('0xe')][_0xc873('0xf')]===0x1f4){logger[_0xc873('0xe')](_0xc873('0x10'),_0x4a2aec,_0x19565c[_0xc873('0xe')]['message']);return _0x4a8020(_0x19565c[_0xc873('0xe')]['message']);}logger[_0xc873('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x4a2aec,_0x19565c[_0xc873('0xe')][_0xc873('0x11')]);return _0x3062d9(_0x19565c[_0xc873('0xe')][_0xc873('0x11')]);}else{logger[_0xc873('0xa')](_0xc873('0x10'),_0x4a2aec,_0xc873('0xc'));_0x3062d9(_0x19565c['result'][_0xc873('0x11')]);}})[_0xc873('0x12')](function(_0x241bd4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4a2aec,_0x241bd4);_0x4a8020(_0x241bd4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b65ae5f..a28ba0d 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 _0x8227=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports','util','connect-timeout'];(function(_0x58b624,_0x403e42){var _0x409454=function(_0x40fd53){while(--_0x40fd53){_0x58b624['push'](_0x58b624['shift']());}};_0x409454(++_0x403e42);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7822('0x0'));var path=require('path');var timeout=require(_0x7822('0x1'));var express=require(_0x7822('0x2'));var router=express[_0x7822('0x3')]();var fs_extra=require(_0x7822('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7822('0x5'));var config=require(_0x7822('0x6'));module[_0x7822('0x7')]=router; \ No newline at end of file +var _0x4f7b=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x2f57d8,_0x26c513){_0x2f57d8=_0x2f57d8-0x0;var _0x4a188f=_0x4f7b[_0x2f57d8];return _0x4a188f;};'use strict';var multer=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var path=require(_0xb4f7('0x2'));var timeout=require(_0xb4f7('0x3'));var express=require('express');var router=express[_0xb4f7('0x4')]();var fs_extra=require(_0xb4f7('0x5'));var auth=require(_0xb4f7('0x6'));var interaction=require(_0xb4f7('0x7'));var config=require(_0xb4f7('0x8'));module[_0xb4f7('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c93104e..1fe08ed 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 _0x8358=['exports','Required\x20by\x20Asterisk','queue_interface','INTEGER','sequelize'];(function(_0x326806,_0x3ca9d2){var _0x4d90a8=function(_0x31e83b){while(--_0x31e83b){_0x326806['push'](_0x326806['shift']());}};_0x4d90a8(++_0x3ca9d2);}(_0x8358,0xf4));var _0x8835=function(_0x40b197,_0x42d098){_0x40b197=_0x40b197-0x0;var _0x6be407=_0x8358[_0x40b197];return _0x6be407;};'use strict';var Sequelize=require(_0x8835('0x0'));module[_0x8835('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x8835('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8835('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x8835('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8835('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x8835('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xbd96=['Required\x20by\x20Asterisk','INTEGER','sequelize','STRING'];(function(_0x19cb6f,_0x2dca10){var _0x594384=function(_0x57b586){while(--_0x57b586){_0x19cb6f['push'](_0x19cb6f['shift']());}};_0x594384(++_0x2dca10);}(_0xbd96,0x14a));var _0x6bd9=function(_0x5b82dd,_0x17cce0){_0x5b82dd=_0x5b82dd-0x0;var _0x1b04ff=_0xbd96[_0x5b82dd];return _0x1b04ff;};'use strict';var Sequelize=require(_0x6bd9('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x6bd9('0x1')],'allowNull':![],'comment':_0x6bd9('0x2')},'UserId':{'type':Sequelize[_0x6bd9('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6bd9('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0x6bd9('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x6bd9('0x2')},'penalty':{'type':Sequelize[_0x6bd9('0x3')](0xb),'defaultValue':0x0,'comment':_0x6bd9('0x2')},'paused':{'type':Sequelize[_0x6bd9('0x3')](0xb),'defaultValue':0x0,'comment':_0x6bd9('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 17f30db..919ed7b 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 _0x29ab=['events','save','update','emit'];(function(_0x4bbb93,_0xf4ee01){var _0x9dea6d=function(_0x4ef404){while(--_0x4ef404){_0x4bbb93['push'](_0x4bbb93['shift']());}};_0x9dea6d(++_0xf4ee01);}(_0x29ab,0x144));var _0xb29a=function(_0x5c31e1,_0x5f5b0f){_0x5c31e1=_0x5c31e1-0x0;var _0x443f74=_0x29ab[_0x5c31e1];return _0x443f74;};'use strict';var EventEmitter=require(_0xb29a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb29a('0x1'),'afterUpdate':_0xb29a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1f5b07){return function(_0x470dcf,_0xc39d15,_0x79cfd8){UserVoiceQueueRtEvents[_0xb29a('0x3')](_0x1f5b07+':'+_0x470dcf['id'],_0x470dcf);UserVoiceQueueRtEvents[_0xb29a('0x3')](_0x1f5b07,_0x470dcf);_0x79cfd8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2164=['hook','exports','../../mysqldb','save','emit','hasOwnProperty'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x2164,0xfe));var _0x4216=function(_0x16d680,_0x4d9a8b){_0x16d680=_0x16d680-0x0;var _0x2d1ab6=_0x2164[_0x16d680];return _0x2d1ab6;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x4216('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4216('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50dae5){return function(_0x204c37,_0x3a8b22,_0x343319){UserVoiceQueueRtEvents[_0x4216('0x2')](_0x50dae5+':'+_0x204c37['id'],_0x204c37);UserVoiceQueueRtEvents['emit'](_0x50dae5,_0x204c37);_0x343319(null);};}for(var e in events){if(events[_0x4216('0x3')](e)){var event=events[e];UserVoiceQueueRt[_0x4216('0x4')](e,emitEvent(event));}}module[_0x4216('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 0aa52a2..6758d60 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 _0x4557=['user_has_voice_queues_rt','lodash','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x19af64,_0x591a66){var _0xea7ae0=function(_0x17bd8d){while(--_0x17bd8d){_0x19af64['push'](_0x19af64['shift']());}};_0xea7ae0(++_0x591a66);}(_0x4557,0x182));var _0x7455=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4557[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7455('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7455('0x1'));var moment=require(_0x7455('0x2'));var BPromise=require(_0x7455('0x3'));var rp=require(_0x7455('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7455('0x5'));var attributes=require(_0x7455('0x6'));module[_0x7455('0x7')]=function(_0x571e46,_0x265148){return _0x571e46[_0x7455('0x8')](_0x7455('0x9'),attributes,{'tableName':_0x7455('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68e2=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f5a7e,_0x41a748){var _0x5bd838=function(_0x3b7572){while(--_0x3b7572){_0x2f5a7e['push'](_0x2f5a7e['shift']());}};_0x5bd838(++_0x41a748);}(_0x68e2,0x1c0));var _0x268e=function(_0x3a2009,_0x5411d4){_0x3a2009=_0x3a2009-0x0;var _0x3ee761=_0x68e2[_0x3a2009];return _0x3ee761;};'use strict';var _=require(_0x268e('0x0'));var util=require('util');var logger=require(_0x268e('0x1'))(_0x268e('0x2'));var moment=require('moment');var BPromise=require(_0x268e('0x3'));var rp=require(_0x268e('0x4'));var fs=require('fs');var path=require(_0x268e('0x5'));var rimraf=require(_0x268e('0x6'));var config=require(_0x268e('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x268e('0x8')]=function(_0x185afa,_0x5f49a3){return _0x185afa[_0x268e('0x9')](_0x268e('0xa'),attributes,{'tableName':_0x268e('0xb'),'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 cf5418e..620bf0c 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 _0x7a63=['redis','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','result','catch','findAll','options','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults'];(function(_0x19faf8,_0x2bc510){var _0x56319f=function(_0x226978){while(--_0x226978){_0x19faf8['push'](_0x19faf8['shift']());}};_0x56319f(++_0x2bc510);}(_0x7a63,0x11e));var _0x37a6=function(_0x5c52c6,_0x54cee7){_0x5c52c6=_0x5c52c6-0x0;var _0x286b8f=_0x7a63[_0x5c52c6];return _0x286b8f;};'use strict';var _=require('lodash');var util=require(_0x37a6('0x0'));var moment=require(_0x37a6('0x1'));var BPromise=require(_0x37a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37a6('0x3'));var db=require(_0x37a6('0x4'))['db'];var utils=require(_0x37a6('0x5'));var logger=require('../../config/logger')(_0x37a6('0x6'));var config=require(_0x37a6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x37a6('0x8')][_0x37a6('0x9')]({'port':0x232a});config['redis']=_[_0x37a6('0xa')](config[_0x37a6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x37a6('0xc'))(new Redis(config[_0x37a6('0xb')]));require('./userVoiceQueueRt.socket')[_0x37a6('0xd')](socket);function respondWithRpcPromise(_0xa6cc70,_0x3ca729,_0xbecae9){return new BPromise(function(_0x44342f,_0x4e9c84){return client[_0x37a6('0xe')](_0xa6cc70,_0xbecae9)[_0x37a6('0xf')](function(_0x48d330){logger[_0x37a6('0x10')](_0x37a6('0x11'),_0x3ca729,_0x37a6('0x12'));logger[_0x37a6('0x13')](_0x37a6('0x14'),_0x3ca729,_0x37a6('0x12'),JSON['stringify'](_0x48d330));if(_0x48d330['error']){if(_0x48d330[_0x37a6('0x15')]['code']===0x1f4){logger[_0x37a6('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ca729,_0x48d330[_0x37a6('0x15')][_0x37a6('0x16')]);return _0x4e9c84(_0x48d330['error'][_0x37a6('0x16')]);}logger[_0x37a6('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ca729,_0x48d330[_0x37a6('0x15')][_0x37a6('0x16')]);return _0x44342f(_0x48d330[_0x37a6('0x15')][_0x37a6('0x16')]);}else{logger[_0x37a6('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ca729,_0x37a6('0x12'));_0x44342f(_0x48d330[_0x37a6('0x17')][_0x37a6('0x16')]);}})[_0x37a6('0x18')](function(_0x266222){logger[_0x37a6('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ca729,_0x266222);_0x4e9c84(_0x266222);});});}exports['GetVoiceQueueRtPauses']=function(_0x1ef81a){var _0x400420=this;return new Promise(function(_0x1e1dd3,_0x58fe69){return db['UserVoiceQueueRt'][_0x37a6('0x19')]({'raw':_0x1ef81a[_0x37a6('0x1a')]?_0x1ef81a['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ef81a[_0x37a6('0x1a')]?_0x1ef81a[_0x37a6('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x37a6('0x1b'),db[_0x37a6('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x37a6('0x1d')))),_0x37a6('0x1e')]]})[_0x37a6('0xf')](function(_0x7cd231){logger['info'](_0x37a6('0x1f'),_0x1ef81a);logger[_0x37a6('0x13')](_0x37a6('0x1f'),_0x1ef81a,JSON[_0x37a6('0x20')](_0x7cd231));_0x1e1dd3(_0x7cd231);})[_0x37a6('0x18')](function(_0x2da8b0){logger[_0x37a6('0x15')](_0x37a6('0x1f'),_0x2da8b0['message'],_0x1ef81a);_0x58fe69(_0x400420[_0x37a6('0x15')](0x1f4,_0x2da8b0[_0x37a6('0x16')]));});});}; \ No newline at end of file +var _0x4f70=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x4f70,0x11b));var _0x04f7=function(_0x21563b,_0x28b2f1){_0x21563b=_0x21563b-0x0;var _0x1ae69b=_0x4f70[_0x21563b];return _0x1ae69b;};'use strict';var _=require(_0x04f7('0x0'));var util=require(_0x04f7('0x1'));var moment=require(_0x04f7('0x2'));var BPromise=require(_0x04f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x04f7('0x5'));var config=require(_0x04f7('0x6'));var jayson=require(_0x04f7('0x7'));var client=jayson[_0x04f7('0x8')][_0x04f7('0x9')]({'port':0x232a});config[_0x04f7('0xa')]=_['defaults'](config[_0x04f7('0xa')],{'host':_0x04f7('0xb'),'port':0x18eb});var socket=require(_0x04f7('0xc'))(new Redis(config['redis']));require(_0x04f7('0xd'))[_0x04f7('0xe')](socket);function respondWithRpcPromise(_0x1dbc0e,_0x18c2c6,_0x22d347){return new BPromise(function(_0x3aef67,_0x5187c3){return client[_0x04f7('0xf')](_0x1dbc0e,_0x22d347)[_0x04f7('0x10')](function(_0x7d5858){logger[_0x04f7('0x11')](_0x04f7('0x12'),_0x18c2c6,_0x04f7('0x13'));logger[_0x04f7('0x14')](_0x04f7('0x15'),_0x18c2c6,_0x04f7('0x13'),JSON[_0x04f7('0x16')](_0x7d5858));if(_0x7d5858['error']){if(_0x7d5858[_0x04f7('0x17')][_0x04f7('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x18c2c6,_0x7d5858[_0x04f7('0x17')]['message']);return _0x5187c3(_0x7d5858['error']['message']);}logger['error'](_0x04f7('0x12'),_0x18c2c6,_0x7d5858[_0x04f7('0x17')][_0x04f7('0x19')]);return _0x3aef67(_0x7d5858[_0x04f7('0x17')][_0x04f7('0x19')]);}else{logger[_0x04f7('0x11')](_0x04f7('0x12'),_0x18c2c6,_0x04f7('0x13'));_0x3aef67(_0x7d5858[_0x04f7('0x1a')][_0x04f7('0x19')]);}})[_0x04f7('0x1b')](function(_0x4dbf4f){logger['error'](_0x04f7('0x12'),_0x18c2c6,_0x4dbf4f);_0x5187c3(_0x4dbf4f);});});}exports['GetVoiceQueueRtPauses']=function(_0x2dd65c){var _0x53488e=this;return new Promise(function(_0x4d0e24,_0x4d67cc){return db[_0x04f7('0x1c')][_0x04f7('0x1d')]({'raw':_0x2dd65c[_0x04f7('0x1e')]?_0x2dd65c[_0x04f7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2dd65c[_0x04f7('0x1e')]?_0x2dd65c[_0x04f7('0x1e')][_0x04f7('0x1f')]||null:null,'attributes':[[db[_0x04f7('0x20')]['fn'](_0x04f7('0x21'),db[_0x04f7('0x20')]['fn']('IF',db['sequelize'][_0x04f7('0x22')](_0x04f7('0x23')))),_0x04f7('0x24')]]})[_0x04f7('0x10')](function(_0x3a53e2){logger[_0x04f7('0x11')]('GetVoiceQueueRtPauses',_0x2dd65c);logger['debug']('GetVoiceQueueRtPauses',_0x2dd65c,JSON[_0x04f7('0x16')](_0x3a53e2));_0x4d0e24(_0x3a53e2);})[_0x04f7('0x1b')](function(_0x556ef4){logger[_0x04f7('0x17')](_0x04f7('0x25'),_0x556ef4['message'],_0x2dd65c);_0x4d67cc(_0x53488e[_0x04f7('0x17')](0x1f4,_0x556ef4[_0x04f7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1c787e7..47d9d74 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 _0xf756=['save','remove','update','emit','removeListener','register','userVoiceQueueRt:'];(function(_0x983986,_0x12b740){var _0x516040=function(_0x59b16a){while(--_0x59b16a){_0x983986['push'](_0x983986['shift']());}};_0x516040(++_0x12b740);}(_0xf756,0xaf));var _0x6f75=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf756[_0x5b644e];return _0x49c6bf;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x6f75('0x0'),_0x6f75('0x1'),_0x6f75('0x2')];function createListener(_0x2c9dc8,_0x4f3905){return function(_0xb949ee){_0x4f3905[_0x6f75('0x3')](_0x2c9dc8,_0xb949ee);};}function removeListener(_0x19a18f,_0x21cacc){return function(){UserVoiceQueueRtEvents[_0x6f75('0x4')](_0x19a18f,_0x21cacc);};}exports[_0x6f75('0x5')]=function(_0x3a94f2){for(var _0x4c5280=0x0,_0x295718=events['length'];_0x4c5280<_0x295718;_0x4c5280++){var _0xcfde42=events[_0x4c5280];var _0x16eee0=createListener(_0x6f75('0x6')+_0xcfde42,_0x3a94f2);UserVoiceQueueRtEvents['on'](_0xcfde42,_0x16eee0);}}; \ No newline at end of file +var _0xc99b=['removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xc99b,0x75));var _0xbc99=function(_0x27efcf,_0x320952){_0x27efcf=_0x27efcf-0x0;var _0xdb0237=_0xc99b[_0x27efcf];return _0xdb0237;};'use strict';var UserVoiceQueueRtEvents=require(_0xbc99('0x0'));var events=[_0xbc99('0x1'),'remove',_0xbc99('0x2')];function createListener(_0x12067f,_0x29ddd9){return function(_0x402556){_0x29ddd9['emit'](_0x12067f,_0x402556);};}function removeListener(_0x7b43e5,_0xf119a2){return function(){UserVoiceQueueRtEvents[_0xbc99('0x3')](_0x7b43e5,_0xf119a2);};}exports['register']=function(_0x2d42a4){for(var _0x3a7c67=0x0,_0x5d650f=events[_0xbc99('0x4')];_0x3a7c67<_0x5d650f;_0x3a7c67++){var _0x5125e7=events[_0x3a7c67];var _0x57865d=createListener(_0xbc99('0x5')+_0x5125e7,_0x2d42a4);UserVoiceQueueRtEvents['on'](_0x5125e7,_0x57865d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 500eef9..0b88511 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 _0x38c9=['fs-extra','../../components/auth/service','../../config/environment','exports','multer','util','path','express','Router'];(function(_0x402381,_0x22eeaf){var _0x4e54de=function(_0x12bc7b){while(--_0x12bc7b){_0x402381['push'](_0x402381['shift']());}};_0x4e54de(++_0x22eeaf);}(_0x38c9,0x199));var _0x938c=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x38c9[_0x257642];return _0x3d813b;};'use strict';var multer=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var path=require(_0x938c('0x2'));var timeout=require('connect-timeout');var express=require(_0x938c('0x3'));var router=express[_0x938c('0x4')]();var fs_extra=require(_0x938c('0x5'));var auth=require(_0x938c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x938c('0x7'));module[_0x938c('0x8')]=router; \ No newline at end of file +var _0x530f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x530f,0x167));var _0xf530=function(_0x55795a,_0x53d9b5){_0x55795a=_0x55795a-0x0;var _0x26ffa5=_0x530f[_0x55795a];return _0x26ffa5;};'use strict';var multer=require('multer');var util=require(_0xf530('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf530('0x1'));var router=express[_0xf530('0x2')]();var fs_extra=require(_0xf530('0x3'));var auth=require(_0xf530('0x4'));var interaction=require(_0xf530('0x5'));var config=require(_0xf530('0x6'));module[_0xf530('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a67e43a..5f72a55 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['sequelize','INTEGER'];(function(_0xaba5d5,_0xc39046){var _0x3ea599=function(_0x1828f4){while(--_0x1828f4){_0xaba5d5['push'](_0xaba5d5['shift']());}};_0x3ea599(++_0xc39046);}(_0xb10b,0x12a));var _0xbb10=function(_0x274394,_0x6fd912){_0x274394=_0x274394-0x0;var _0x2a2773=_0xb10b[_0x274394];return _0x2a2773;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4906c7,_0x5e2ae3){var _0x44f12d=function(_0x230fbe){while(--_0x230fbe){_0x4906c7['push'](_0x4906c7['shift']());}};_0x44f12d(++_0x5e2ae3);}(_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 bb5172d..2f01739 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 _0x955f=['user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','UserWhatsappQueue'];(function(_0x3b9f2b,_0x1e9ed3){var _0x129f8b=function(_0x5de20d){while(--_0x5de20d){_0x3b9f2b['push'](_0x3b9f2b['shift']());}};_0x129f8b(++_0x1e9ed3);}(_0x955f,0x1eb));var _0xf955=function(_0x21dca3,_0x1e77cd){_0x21dca3=_0x21dca3-0x0;var _0x32f3e0=_0x955f[_0x21dca3];return _0x32f3e0;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5dd1d8,_0x34b667){var _0x22e8a6=function(_0x2d3f3e){while(--_0x2d3f3e){_0x5dd1d8['push'](_0x5dd1d8['shift']());}};_0x22e8a6(++_0x34b667);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4776cc,_0x3a715e){_0x4776cc=_0x4776cc-0x0;var _0x427bda=_0x0b0e[_0x4776cc];return _0x427bda;};'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')]('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 64eea01..96d2d50 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(_0x539892,_0x26e1a8){var _0x3a2c77=function(_0x1bb67d){while(--_0x1bb67d){_0x539892['push'](_0x539892['shift']());}};_0x3a2c77(++_0x26e1a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x123145,_0x392bf4){var _0x1b00c5=function(_0x4831e8){while(--_0x4831e8){_0x123145['push'](_0x123145['shift']());}};_0x1b00c5(++_0x392bf4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 65ae26c..77476bc 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 _0x1a6e=['connect-timeout','express','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','create','put','exports','util'];(function(_0x467990,_0x43c921){var _0x5a4a62=function(_0x36b37b){while(--_0x36b37b){_0x467990['push'](_0x467990['shift']());}};_0x5a4a62(++_0x43c921);}(_0x1a6e,0xdf));var _0xe1a6=function(_0x32cd29,_0x29f6bb){_0x32cd29=_0x32cd29-0x0;var _0x2f7e6e=_0x1a6e[_0x32cd29];return _0x2f7e6e;};'use strict';var multer=require('multer');var util=require(_0xe1a6('0x0'));var path=require('path');var timeout=require(_0xe1a6('0x1'));var express=require(_0xe1a6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe1a6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe1a6('0x4'));var controller=require(_0xe1a6('0x5'));router[_0xe1a6('0x6')]('/',auth[_0xe1a6('0x7')](),controller[_0xe1a6('0x8')]);router['get'](_0xe1a6('0x9'),auth[_0xe1a6('0x7')](),controller['show']);router[_0xe1a6('0xa')]('/',auth[_0xe1a6('0x7')](),controller[_0xe1a6('0xb')]);router[_0xe1a6('0xc')](_0xe1a6('0x9'),auth[_0xe1a6('0x7')](),controller['update']);router['delete'](_0xe1a6('0x9'),auth[_0xe1a6('0x7')](),controller['destroy']);module[_0xe1a6('0xd')]=router; \ No newline at end of file +var _0x3585=['/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','get'];(function(_0x59014d,_0x571528){var _0x177d41=function(_0x275d5c){while(--_0x275d5c){_0x59014d['push'](_0x59014d['shift']());}};_0x177d41(++_0x571528);}(_0x3585,0x14c));var _0x5358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3585[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x5358('0x0'));var path=require(_0x5358('0x1'));var timeout=require(_0x5358('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5358('0x3'));var auth=require(_0x5358('0x4'));var interaction=require(_0x5358('0x5'));var config=require(_0x5358('0x6'));var controller=require(_0x5358('0x7'));router['get']('/',auth[_0x5358('0x8')](),controller['index']);router[_0x5358('0x9')](_0x5358('0xa'),auth[_0x5358('0x8')](),controller['show']);router[_0x5358('0xb')]('/',auth[_0x5358('0x8')](),controller[_0x5358('0xc')]);router[_0x5358('0xd')](_0x5358('0xa'),auth[_0x5358('0x8')](),controller[_0x5358('0xe')]);router[_0x5358('0xf')](_0x5358('0xa'),auth[_0x5358('0x8')](),controller[_0x5358('0x10')]);module[_0x5358('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a064760..06cf26a 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 _0xb5ed=['STRING','name','sequelize','exports'];(function(_0x47acdf,_0x1b12cb){var _0x271030=function(_0x45f86c){while(--_0x45f86c){_0x47acdf['push'](_0x47acdf['shift']());}};_0x271030(++_0x1b12cb);}(_0xb5ed,0xa2));var _0xdb5e=function(_0x1ff3a5,_0x4b80aa){_0x1ff3a5=_0x1ff3a5-0x0;var _0x8c0987=_0xb5ed[_0x1ff3a5];return _0x8c0987;};'use strict';var Sequelize=require(_0xdb5e('0x0'));module[_0xdb5e('0x1')]={'name':{'type':Sequelize[_0xdb5e('0x2')],'unique':_0xdb5e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb131=['name','STRING','sequelize','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xb131,0x132));var _0x1b13=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0xb131[_0x52a6e3];return _0x8910d0;};'use strict';var Sequelize=require(_0x1b13('0x0'));module[_0x1b13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1b13('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b13('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 717f012..a6e5c7c 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 _0x50c0=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','merge','filter','options','includeAll','include','rows','catch','show','params','find'];(function(_0x1e8b5c,_0x5c1a87){var _0x407a1d=function(_0xdcb2c4){while(--_0xdcb2c4){_0x1e8b5c['push'](_0x1e8b5c['shift']());}};_0x407a1d(++_0x5c1a87);}(_0x50c0,0xa8));var _0x050c=function(_0xdaf736,_0xd8c667){_0xdaf736=_0xdaf736-0x0;var _0x1090b3=_0x50c0[_0xdaf736];return _0x1090b3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x050c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x050c('0x1'));var jsonpatch=require(_0x050c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x050c('0x3'));var Mustache=require(_0x050c('0x4'));var util=require(_0x050c('0x5'));var path=require(_0x050c('0x6'));var sox=require(_0x050c('0x7'));var csv=require(_0x050c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x050c('0x9'));var _=require(_0x050c('0xa'));var squel=require(_0x050c('0xb'));var crypto=require(_0x050c('0xc'));var jsforce=require(_0x050c('0xd'));var deskjs=require(_0x050c('0xe'));var toCsv=require(_0x050c('0x8'));var querystring=require('querystring');var Papa=require(_0x050c('0xf'));var Redis=require(_0x050c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x050c('0x11'));var as=require(_0x050c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x050c('0x13'))(_0x050c('0x14'));var utils=require(_0x050c('0x15'));var config=require(_0x050c('0x16'));var licenseUtil=require(_0x050c('0x17'));var db=require(_0x050c('0x18'))['db'];function respondWithStatusCode(_0x25a284,_0x4128a0){_0x4128a0=_0x4128a0||0xcc;return function(_0x4b46bb){if(_0x4b46bb){return _0x25a284[_0x050c('0x19')](_0x4128a0);}return _0x25a284['status'](_0x4128a0)[_0x050c('0x1a')]();};}function respondWithResult(_0x2eb8c5,_0x5de4c8){_0x5de4c8=_0x5de4c8||0xc8;return function(_0x314f6f){if(_0x314f6f){return _0x2eb8c5[_0x050c('0x1b')](_0x5de4c8)[_0x050c('0x1c')](_0x314f6f);}};}function respondWithFilteredResult(_0x4b056a,_0x57a0ce){return function(_0x927139){if(_0x927139){var _0x18f256=_0x927139[_0x050c('0x1d')],_0x1c41a5=_0x57a0ce[_0x050c('0x1e')],_0x3fc2c1=_0x57a0ce['offset']+_0x57a0ce[_0x050c('0x1f')],_0x1cfbfa;if(_0x3fc2c1>=_0x18f256){_0x3fc2c1=_0x18f256;_0x1cfbfa=0xc8;}else{_0x1cfbfa=0xce;}_0x4b056a[_0x050c('0x1b')](_0x1cfbfa);return _0x4b056a[_0x050c('0x20')](_0x050c('0x21'),_0x1c41a5+'-'+_0x3fc2c1+'/'+_0x18f256)['json'](_0x927139);}return null;};}function patchUpdates(_0x39c9f7){return function(_0x3c3637){try{jsonpatch[_0x050c('0x22')](_0x3c3637,_0x39c9f7,!![]);}catch(_0x11ffd2){return BPromise[_0x050c('0x23')](_0x11ffd2);}return _0x3c3637[_0x050c('0x24')]();};}function saveUpdates(_0x4b5537,_0x404ba5){return function(_0x1eb413){if(_0x1eb413){return _0x1eb413[_0x050c('0x25')](_0x4b5537)[_0x050c('0x26')](function(_0x36bb5c){return _0x36bb5c;});}return null;};}function removeEntity(_0x22b55b,_0x493259){return function(_0x4369e6){if(_0x4369e6){return _0x4369e6[_0x050c('0x27')]()['then'](function(){var _0x39a1f7=_0x4369e6[_0x050c('0x28')]({'plain':!![]});var _0x435d78='Variables';return db[_0x050c('0x29')][_0x050c('0x27')]({'where':{'type':_0x435d78,'resourceId':_0x39a1f7['id']}})[_0x050c('0x26')](function(){return _0x4369e6;});})['then'](function(){_0x22b55b[_0x050c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a5f4,_0x156cdf){return function(_0x3fed17){if(!_0x3fed17){_0x45a5f4['sendStatus'](0x194);}return _0x3fed17;};}function handleError(_0x334026,_0x2d02ac){_0x2d02ac=_0x2d02ac||0x1f4;return function(_0x2b354){logger[_0x050c('0x2a')](_0x2b354[_0x050c('0x2b')]);if(_0x2b354[_0x050c('0x2c')]){delete _0x2b354[_0x050c('0x2c')];}_0x334026['status'](_0x2d02ac)[_0x050c('0x2d')](_0x2b354);};}exports['index']=function(_0x2b8748,_0x13868e){var _0x55149f={},_0xd3e24f={},_0x3d94c9={'count':0x0,'rows':[]};var _0x1270b4=_[_0x050c('0x2e')](db[_0x050c('0x2f')][_0x050c('0x30')],function(_0x1d925f){return{'name':_0x1d925f[_0x050c('0x31')],'type':_0x1d925f[_0x050c('0x32')][_0x050c('0x33')]};});_0xd3e24f[_0x050c('0x34')]=_['map'](_0x1270b4,_0x050c('0x2c'));_0xd3e24f[_0x050c('0x35')]=_[_0x050c('0x36')](_0x2b8748['query']);_0xd3e24f[_0x050c('0x37')]=_[_0x050c('0x38')](_0xd3e24f['model'],_0xd3e24f['query']);_0x55149f[_0x050c('0x39')]=_[_0x050c('0x38')](_0xd3e24f[_0x050c('0x34')],qs[_0x050c('0x3a')](_0x2b8748[_0x050c('0x35')]['fields']));_0x55149f[_0x050c('0x39')]=_0x55149f[_0x050c('0x39')][_0x050c('0x3b')]?_0x55149f[_0x050c('0x39')]:_0xd3e24f[_0x050c('0x34')];if(!_0x2b8748[_0x050c('0x35')]['hasOwnProperty'](_0x050c('0x3c'))){_0x55149f['limit']=qs['limit'](_0x2b8748[_0x050c('0x35')][_0x050c('0x1f')]);_0x55149f[_0x050c('0x1e')]=qs[_0x050c('0x1e')](_0x2b8748[_0x050c('0x35')][_0x050c('0x1e')]);}_0x55149f['order']=qs['sort'](_0x2b8748[_0x050c('0x35')]['sort']);_0x55149f[_0x050c('0x3d')]=qs[_0x050c('0x37')](_['pick'](_0x2b8748[_0x050c('0x35')],_0xd3e24f[_0x050c('0x37')]),_0x1270b4);if(_0x2b8748[_0x050c('0x35')]['filter']){_0x55149f[_0x050c('0x3d')]=_[_0x050c('0x3e')](_0x55149f[_0x050c('0x3d')],{'$or':_[_0x050c('0x2e')](_0x1270b4,function(_0x67647e){if(_0x67647e[_0x050c('0x32')]!=='VIRTUAL'){var _0x429616={};_0x429616[_0x67647e[_0x050c('0x2c')]]={'$like':'%'+_0x2b8748[_0x050c('0x35')][_0x050c('0x3f')]+'%'};return _0x429616;}})});}_0x55149f=_['merge']({},_0x55149f,_0x2b8748[_0x050c('0x40')]);var _0x25e8ed={'where':_0x55149f[_0x050c('0x3d')]};return db[_0x050c('0x2f')][_0x050c('0x1d')](_0x25e8ed)[_0x050c('0x26')](function(_0x57aeb3){_0x3d94c9['count']=_0x57aeb3;if(_0x2b8748[_0x050c('0x35')][_0x050c('0x41')]){_0x55149f[_0x050c('0x42')]=[{'all':!![]}];}return db[_0x050c('0x2f')]['findAll'](_0x55149f);})[_0x050c('0x26')](function(_0x35beb5){_0x3d94c9[_0x050c('0x43')]=_0x35beb5;return _0x3d94c9;})[_0x050c('0x26')](respondWithFilteredResult(_0x13868e,_0x55149f))[_0x050c('0x44')](handleError(_0x13868e,null));};exports[_0x050c('0x45')]=function(_0xee189e,_0x3eda0e){var _0x38e00a={'raw':!![],'where':{'id':_0xee189e[_0x050c('0x46')]['id']}},_0x1e6a99={};_0x1e6a99['model']=_[_0x050c('0x36')](db['Variable']['rawAttributes']);_0x1e6a99[_0x050c('0x35')]=_[_0x050c('0x36')](_0xee189e['query']);_0x1e6a99[_0x050c('0x37')]=_[_0x050c('0x38')](_0x1e6a99[_0x050c('0x34')],_0x1e6a99[_0x050c('0x35')]);_0x38e00a[_0x050c('0x39')]=_[_0x050c('0x38')](_0x1e6a99[_0x050c('0x34')],qs[_0x050c('0x3a')](_0xee189e[_0x050c('0x35')][_0x050c('0x3a')]));_0x38e00a['attributes']=_0x38e00a[_0x050c('0x39')][_0x050c('0x3b')]?_0x38e00a[_0x050c('0x39')]:_0x1e6a99['model'];if(_0xee189e[_0x050c('0x35')][_0x050c('0x41')]){_0x38e00a[_0x050c('0x42')]=[{'all':!![]}];}_0x38e00a=_[_0x050c('0x3e')]({},_0x38e00a,_0xee189e[_0x050c('0x40')]);return db[_0x050c('0x2f')][_0x050c('0x47')](_0x38e00a)[_0x050c('0x26')](handleEntityNotFound(_0x3eda0e,null))[_0x050c('0x26')](respondWithResult(_0x3eda0e,null))[_0x050c('0x44')](handleError(_0x3eda0e,null));};exports[_0x050c('0x48')]=function(_0x3b77f3,_0x5b5e56){return db[_0x050c('0x2f')]['create'](_0x3b77f3[_0x050c('0x49')],{})['then'](function(_0x2e4738){var _0x193ed5=_0x3b77f3[_0x050c('0x4a')][_0x050c('0x28')]({'plain':!![]});if(!_0x193ed5)throw new Error(_0x050c('0x4b'));if(_0x193ed5[_0x050c('0x4c')]==='user'){var _0x1c45d3=_0x2e4738[_0x050c('0x28')]({'plain':!![]});var _0x4acd37=_0x050c('0x4d');return db['UserProfileSection'][_0x050c('0x47')]({'where':{'name':_0x4acd37,'userProfileId':_0x193ed5[_0x050c('0x4e')]},'raw':!![]})['then'](function(_0x565561){if(_0x565561&&_0x565561['autoAssociation']===0x0){return db['UserProfileResource'][_0x050c('0x48')]({'name':_0x1c45d3[_0x050c('0x2c')],'resourceId':_0x1c45d3['id'],'type':_0x565561[_0x050c('0x2c')],'sectionId':_0x565561['id']},{})[_0x050c('0x26')](function(){return _0x2e4738;});}else{return _0x2e4738;}})['catch'](function(_0x3d8a98){logger['error'](_0x050c('0x4f'),_0x3d8a98);throw _0x3d8a98;});}return _0x2e4738;})['then'](respondWithResult(_0x5b5e56,0xc9))[_0x050c('0x44')](handleError(_0x5b5e56,null));};exports[_0x050c('0x25')]=function(_0xa3ffa6,_0x5ab46b){if(_0xa3ffa6[_0x050c('0x49')]['id']){delete _0xa3ffa6[_0x050c('0x49')]['id'];}return db[_0x050c('0x2f')][_0x050c('0x47')]({'where':{'id':_0xa3ffa6[_0x050c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ab46b,null))[_0x050c('0x26')](saveUpdates(_0xa3ffa6[_0x050c('0x49')],null))[_0x050c('0x26')](respondWithResult(_0x5ab46b,null))[_0x050c('0x44')](handleError(_0x5ab46b,null));};exports[_0x050c('0x27')]=function(_0x2371f8,_0x4f2483){return db[_0x050c('0x2f')][_0x050c('0x47')]({'where':{'id':_0x2371f8[_0x050c('0x46')]['id']}})[_0x050c('0x26')](handleEntityNotFound(_0x4f2483,null))['then'](removeEntity(_0x4f2483,null))['catch'](handleError(_0x4f2483,null));}; \ No newline at end of file +var _0x2e51=['UserProfileResource','sendStatus','stack','name','send','index','map','Variable','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','rawAttributes','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','Variables'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x2e51,0x199));var _0x12e5=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x2e51[_0x5cb1af];return _0x8d7940;};'use strict';var pdf=require(_0x12e5('0x0'));var emlformat=require(_0x12e5('0x1'));var rimraf=require(_0x12e5('0x2'));var zipdir=require(_0x12e5('0x3'));var jsonpatch=require(_0x12e5('0x4'));var rp=require(_0x12e5('0x5'));var moment=require(_0x12e5('0x6'));var BPromise=require(_0x12e5('0x7'));var Mustache=require(_0x12e5('0x8'));var util=require(_0x12e5('0x9'));var path=require(_0x12e5('0xa'));var sox=require(_0x12e5('0xb'));var csv=require(_0x12e5('0xc'));var ejs=require(_0x12e5('0xd'));var fs=require('fs');var fs_extra=require(_0x12e5('0xe'));var _=require(_0x12e5('0xf'));var squel=require(_0x12e5('0x10'));var crypto=require(_0x12e5('0x11'));var jsforce=require(_0x12e5('0x12'));var deskjs=require(_0x12e5('0x13'));var toCsv=require('to-csv');var querystring=require(_0x12e5('0x14'));var Papa=require(_0x12e5('0x15'));var Redis=require(_0x12e5('0x16'));var authService=require(_0x12e5('0x17'));var qs=require('../../components/parsers/qs');var as=require(_0x12e5('0x18'));var hardwareService=require(_0x12e5('0x19'));var logger=require(_0x12e5('0x1a'))(_0x12e5('0x1b'));var utils=require(_0x12e5('0x1c'));var config=require(_0x12e5('0x1d'));var licenseUtil=require(_0x12e5('0x1e'));var db=require(_0x12e5('0x1f'))['db'];function respondWithStatusCode(_0x238594,_0x545532){_0x545532=_0x545532||0xcc;return function(_0x288b3e){if(_0x288b3e){return _0x238594['sendStatus'](_0x545532);}return _0x238594[_0x12e5('0x20')](_0x545532)[_0x12e5('0x21')]();};}function respondWithResult(_0x21bcc2,_0x2f5828){_0x2f5828=_0x2f5828||0xc8;return function(_0x9b75b1){if(_0x9b75b1){return _0x21bcc2[_0x12e5('0x20')](_0x2f5828)[_0x12e5('0x22')](_0x9b75b1);}};}function respondWithFilteredResult(_0x49f114,_0x2fa059){return function(_0x99216f){if(_0x99216f){var _0x1e76ed=_0x99216f[_0x12e5('0x23')],_0x163c5b=_0x2fa059[_0x12e5('0x24')],_0x161e51=_0x2fa059[_0x12e5('0x24')]+_0x2fa059[_0x12e5('0x25')],_0x39844c;if(_0x161e51>=_0x1e76ed){_0x161e51=_0x1e76ed;_0x39844c=0xc8;}else{_0x39844c=0xce;}_0x49f114['status'](_0x39844c);return _0x49f114['set']('Content-Range',_0x163c5b+'-'+_0x161e51+'/'+_0x1e76ed)['json'](_0x99216f);}return null;};}function patchUpdates(_0x235240){return function(_0x8e399c){try{jsonpatch[_0x12e5('0x26')](_0x8e399c,_0x235240,!![]);}catch(_0x1b3ce4){return BPromise[_0x12e5('0x27')](_0x1b3ce4);}return _0x8e399c[_0x12e5('0x28')]();};}function saveUpdates(_0xcffcf4,_0x3d8827){return function(_0x152a87){if(_0x152a87){return _0x152a87[_0x12e5('0x29')](_0xcffcf4)[_0x12e5('0x2a')](function(_0x5bcfb0){return _0x5bcfb0;});}return null;};}function removeEntity(_0x28c1e8,_0x58cbfe){return function(_0x1be918){if(_0x1be918){return _0x1be918[_0x12e5('0x2b')]()['then'](function(){var _0x25e4eb=_0x1be918[_0x12e5('0x2c')]({'plain':!![]});var _0xb665dc=_0x12e5('0x2d');return db[_0x12e5('0x2e')][_0x12e5('0x2b')]({'where':{'type':_0xb665dc,'resourceId':_0x25e4eb['id']}})[_0x12e5('0x2a')](function(){return _0x1be918;});})[_0x12e5('0x2a')](function(){_0x28c1e8['status'](0xcc)[_0x12e5('0x21')]();});}};}function handleEntityNotFound(_0x774de1,_0x2783f4){return function(_0x322926){if(!_0x322926){_0x774de1[_0x12e5('0x2f')](0x194);}return _0x322926;};}function handleError(_0x24b6bf,_0x21c7ec){_0x21c7ec=_0x21c7ec||0x1f4;return function(_0x19ca2c){logger['error'](_0x19ca2c[_0x12e5('0x30')]);if(_0x19ca2c[_0x12e5('0x31')]){delete _0x19ca2c['name'];}_0x24b6bf[_0x12e5('0x20')](_0x21c7ec)[_0x12e5('0x32')](_0x19ca2c);};}exports[_0x12e5('0x33')]=function(_0x5a0726,_0x185032){var _0x21c217={},_0x47c239={},_0x53f08c={'count':0x0,'rows':[]};var _0x6e9d40=_[_0x12e5('0x34')](db[_0x12e5('0x35')]['rawAttributes'],function(_0x4b88d0){return{'name':_0x4b88d0[_0x12e5('0x36')],'type':_0x4b88d0[_0x12e5('0x37')][_0x12e5('0x38')]};});_0x47c239[_0x12e5('0x39')]=_[_0x12e5('0x34')](_0x6e9d40,'name');_0x47c239['query']=_[_0x12e5('0x3a')](_0x5a0726['query']);_0x47c239[_0x12e5('0x3b')]=_[_0x12e5('0x3c')](_0x47c239[_0x12e5('0x39')],_0x47c239[_0x12e5('0x3d')]);_0x21c217[_0x12e5('0x3e')]=_[_0x12e5('0x3c')](_0x47c239[_0x12e5('0x39')],qs[_0x12e5('0x3f')](_0x5a0726[_0x12e5('0x3d')]['fields']));_0x21c217[_0x12e5('0x3e')]=_0x21c217[_0x12e5('0x3e')][_0x12e5('0x40')]?_0x21c217[_0x12e5('0x3e')]:_0x47c239[_0x12e5('0x39')];if(!_0x5a0726['query'][_0x12e5('0x41')](_0x12e5('0x42'))){_0x21c217[_0x12e5('0x25')]=qs[_0x12e5('0x25')](_0x5a0726[_0x12e5('0x3d')][_0x12e5('0x25')]);_0x21c217[_0x12e5('0x24')]=qs[_0x12e5('0x24')](_0x5a0726[_0x12e5('0x3d')][_0x12e5('0x24')]);}_0x21c217['order']=qs[_0x12e5('0x43')](_0x5a0726[_0x12e5('0x3d')][_0x12e5('0x43')]);_0x21c217[_0x12e5('0x44')]=qs['filters'](_[_0x12e5('0x45')](_0x5a0726[_0x12e5('0x3d')],_0x47c239[_0x12e5('0x3b')]),_0x6e9d40);if(_0x5a0726[_0x12e5('0x3d')]['filter']){_0x21c217[_0x12e5('0x44')]=_[_0x12e5('0x46')](_0x21c217[_0x12e5('0x44')],{'$or':_[_0x12e5('0x34')](_0x6e9d40,function(_0x1278bf){if(_0x1278bf[_0x12e5('0x37')]!==_0x12e5('0x47')){var _0xda905={};_0xda905[_0x1278bf[_0x12e5('0x31')]]={'$like':'%'+_0x5a0726['query'][_0x12e5('0x48')]+'%'};return _0xda905;}})});}_0x21c217=_[_0x12e5('0x46')]({},_0x21c217,_0x5a0726[_0x12e5('0x49')]);var _0xbcc05={'where':_0x21c217[_0x12e5('0x44')]};return db[_0x12e5('0x35')][_0x12e5('0x23')](_0xbcc05)[_0x12e5('0x2a')](function(_0x38f162){_0x53f08c[_0x12e5('0x23')]=_0x38f162;if(_0x5a0726[_0x12e5('0x3d')]['includeAll']){_0x21c217['include']=[{'all':!![]}];}return db[_0x12e5('0x35')][_0x12e5('0x4a')](_0x21c217);})[_0x12e5('0x2a')](function(_0x54bb73){_0x53f08c['rows']=_0x54bb73;return _0x53f08c;})[_0x12e5('0x2a')](respondWithFilteredResult(_0x185032,_0x21c217))[_0x12e5('0x4b')](handleError(_0x185032,null));};exports[_0x12e5('0x4c')]=function(_0x27d689,_0xd19f67){var _0xb0ce73={'raw':!![],'where':{'id':_0x27d689[_0x12e5('0x4d')]['id']}},_0x569101={};_0x569101[_0x12e5('0x39')]=_[_0x12e5('0x3a')](db[_0x12e5('0x35')][_0x12e5('0x4e')]);_0x569101[_0x12e5('0x3d')]=_['keys'](_0x27d689[_0x12e5('0x3d')]);_0x569101[_0x12e5('0x3b')]=_[_0x12e5('0x3c')](_0x569101['model'],_0x569101[_0x12e5('0x3d')]);_0xb0ce73[_0x12e5('0x3e')]=_[_0x12e5('0x3c')](_0x569101[_0x12e5('0x39')],qs[_0x12e5('0x3f')](_0x27d689[_0x12e5('0x3d')]['fields']));_0xb0ce73['attributes']=_0xb0ce73[_0x12e5('0x3e')][_0x12e5('0x40')]?_0xb0ce73[_0x12e5('0x3e')]:_0x569101['model'];if(_0x27d689[_0x12e5('0x3d')][_0x12e5('0x4f')]){_0xb0ce73[_0x12e5('0x50')]=[{'all':!![]}];}_0xb0ce73=_[_0x12e5('0x46')]({},_0xb0ce73,_0x27d689[_0x12e5('0x49')]);return db['Variable']['find'](_0xb0ce73)[_0x12e5('0x2a')](handleEntityNotFound(_0xd19f67,null))[_0x12e5('0x2a')](respondWithResult(_0xd19f67,null))['catch'](handleError(_0xd19f67,null));};exports[_0x12e5('0x51')]=function(_0x291c9b,_0x1f5154){return db[_0x12e5('0x35')]['create'](_0x291c9b['body'],{})[_0x12e5('0x2a')](function(_0xd162a4){var _0x2bded9=_0x291c9b[_0x12e5('0x52')][_0x12e5('0x2c')]({'plain':!![]});if(!_0x2bded9)throw new Error(_0x12e5('0x53'));if(_0x2bded9[_0x12e5('0x54')]==='user'){var _0x24ebe6=_0xd162a4[_0x12e5('0x2c')]({'plain':!![]});var _0x213ac8='Variables';return db[_0x12e5('0x55')]['find']({'where':{'name':_0x213ac8,'userProfileId':_0x2bded9[_0x12e5('0x56')]},'raw':!![]})[_0x12e5('0x2a')](function(_0x4dc78d){if(_0x4dc78d&&_0x4dc78d[_0x12e5('0x57')]===0x0){return db[_0x12e5('0x2e')][_0x12e5('0x51')]({'name':_0x24ebe6[_0x12e5('0x31')],'resourceId':_0x24ebe6['id'],'type':_0x4dc78d[_0x12e5('0x31')],'sectionId':_0x4dc78d['id']},{})['then'](function(){return _0xd162a4;});}else{return _0xd162a4;}})['catch'](function(_0x53bf6d){logger[_0x12e5('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53bf6d);throw _0x53bf6d;});}return _0xd162a4;})[_0x12e5('0x2a')](respondWithResult(_0x1f5154,0xc9))['catch'](handleError(_0x1f5154,null));};exports[_0x12e5('0x29')]=function(_0x22ab53,_0x4d7ffc){if(_0x22ab53[_0x12e5('0x59')]['id']){delete _0x22ab53[_0x12e5('0x59')]['id'];}return db[_0x12e5('0x35')][_0x12e5('0x5a')]({'where':{'id':_0x22ab53[_0x12e5('0x4d')]['id']}})[_0x12e5('0x2a')](handleEntityNotFound(_0x4d7ffc,null))['then'](saveUpdates(_0x22ab53[_0x12e5('0x59')],null))[_0x12e5('0x2a')](respondWithResult(_0x4d7ffc,null))[_0x12e5('0x4b')](handleError(_0x4d7ffc,null));};exports[_0x12e5('0x2b')]=function(_0x4223bc,_0x243875){return db[_0x12e5('0x35')][_0x12e5('0x5a')]({'where':{'id':_0x4223bc[_0x12e5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x243875,null))[_0x12e5('0x2a')](removeEntity(_0x243875,null))[_0x12e5('0x4b')](handleError(_0x243875,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5897846..cf12084 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 _0xd33b=['util','api','path','rimraf','./variable.attributes','exports','Variable','lodash'];(function(_0x16d2f9,_0x1f5122){var _0x20241c=function(_0x3f937c){while(--_0x3f937c){_0x16d2f9['push'](_0x16d2f9['shift']());}};_0x20241c(++_0x1f5122);}(_0xd33b,0x1af));var _0xbd33=function(_0x58b7d2,_0x543c5b){_0x58b7d2=_0x58b7d2-0x0;var _0x40b329=_0xd33b[_0x58b7d2];return _0x40b329;};'use strict';var _=require(_0xbd33('0x0'));var util=require(_0xbd33('0x1'));var logger=require('../../config/logger')(_0xbd33('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd33('0x3'));var rimraf=require(_0xbd33('0x4'));var config=require('../../config/environment');var attributes=require(_0xbd33('0x5'));module[_0xbd33('0x6')]=function(_0x2c8b0c,_0x2b9c0d){return _0x2c8b0c['define'](_0xbd33('0x7'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe480=['api','moment','bluebird','request-promise','path','rimraf','define','Variable','tools_variables','util','../../config/logger'];(function(_0x32092e,_0x3e6d80){var _0x4b9a95=function(_0x1ed253){while(--_0x1ed253){_0x32092e['push'](_0x32092e['shift']());}};_0x4b9a95(++_0x3e6d80);}(_0xe480,0x17f));var _0x0e48=function(_0x404cab,_0x4d9561){_0x404cab=_0x404cab-0x0;var _0x4a4778=_0xe480[_0x404cab];return _0x4a4778;};'use strict';var _=require('lodash');var util=require(_0x0e48('0x0'));var logger=require(_0x0e48('0x1'))(_0x0e48('0x2'));var moment=require(_0x0e48('0x3'));var BPromise=require(_0x0e48('0x4'));var rp=require(_0x0e48('0x5'));var fs=require('fs');var path=require(_0x0e48('0x6'));var rimraf=require(_0x0e48('0x7'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module['exports']=function(_0x54bdda,_0x56018e){return _0x54bdda[_0x0e48('0x8')](_0x0e48('0x9'),attributes,{'tableName':_0x0e48('0xa'),'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 f7a7ecb..dffc771 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 _0x4840=['ShowVariable','Variable','options','raw','where','attributes','include','map','model','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5d1029,_0x1fae85){var _0x5bfe37=function(_0x4d16fb){while(--_0x4d16fb){_0x5d1029['push'](_0x5d1029['shift']());}};_0x5bfe37(++_0x1fae85);}(_0x4840,0x8e));var _0x0484=function(_0x161d36,_0x437fee){_0x161d36=_0x161d36-0x0;var _0x84de4=_0x4840[_0x161d36];return _0x84de4;};'use strict';var _=require(_0x0484('0x0'));var util=require(_0x0484('0x1'));var moment=require(_0x0484('0x2'));var BPromise=require(_0x0484('0x3'));var rs=require(_0x0484('0x4'));var fs=require('fs');var Redis=require(_0x0484('0x5'));var db=require(_0x0484('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0484('0x7'))(_0x0484('0x8'));var config=require(_0x0484('0x9'));var jayson=require(_0x0484('0xa'));var client=jayson[_0x0484('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6084,_0x559bb0,_0x289c60){return new BPromise(function(_0x2bb779,_0x6800d7){return client['request'](_0x3f6084,_0x289c60)[_0x0484('0xc')](function(_0x2759fa){logger['info'](_0x0484('0xd'),_0x559bb0,'request\x20sent');logger[_0x0484('0xe')](_0x0484('0xf'),_0x559bb0,'request\x20sent',JSON[_0x0484('0x10')](_0x2759fa));if(_0x2759fa[_0x0484('0x11')]){if(_0x2759fa[_0x0484('0x11')][_0x0484('0x12')]===0x1f4){logger[_0x0484('0x11')](_0x0484('0xd'),_0x559bb0,_0x2759fa['error'][_0x0484('0x13')]);return _0x6800d7(_0x2759fa[_0x0484('0x11')][_0x0484('0x13')]);}logger[_0x0484('0x11')](_0x0484('0xd'),_0x559bb0,_0x2759fa[_0x0484('0x11')][_0x0484('0x13')]);return _0x2bb779(_0x2759fa['error'][_0x0484('0x13')]);}else{logger['info'](_0x0484('0xd'),_0x559bb0,_0x0484('0x14'));_0x2bb779(_0x2759fa[_0x0484('0x15')][_0x0484('0x13')]);}})[_0x0484('0x16')](function(_0x418447){logger[_0x0484('0x11')](_0x0484('0xd'),_0x559bb0,_0x418447);_0x6800d7(_0x418447);});});}exports[_0x0484('0x17')]=function(_0x18c472){var _0x3cf2c3=this;return new Promise(function(_0x3599fe,_0xbaaabd){return db[_0x0484('0x18')]['find']({'raw':_0x18c472[_0x0484('0x19')]?_0x18c472['options'][_0x0484('0x1a')]===undefined?!![]:![]:!![],'where':_0x18c472[_0x0484('0x19')]?_0x18c472[_0x0484('0x19')][_0x0484('0x1b')]||null:null,'attributes':_0x18c472[_0x0484('0x19')]?_0x18c472[_0x0484('0x19')][_0x0484('0x1c')]||null:null,'include':_0x18c472[_0x0484('0x19')]?_0x18c472['options'][_0x0484('0x1d')]?_[_0x0484('0x1e')](_0x18c472[_0x0484('0x19')][_0x0484('0x1d')],function(_0x55cea0){return{'model':db[_0x55cea0[_0x0484('0x1f')]],'as':_0x55cea0['as'],'attributes':_0x55cea0['attributes'],'include':_0x55cea0['include']?_['map'](_0x55cea0[_0x0484('0x1d')],function(_0x1cbd94){return{'model':db[_0x1cbd94['model']],'as':_0x1cbd94['as'],'attributes':_0x1cbd94[_0x0484('0x1c')],'include':_0x1cbd94[_0x0484('0x1d')]?_['map'](_0x1cbd94['include'],function(_0xcfa4d8){return{'model':db[_0xcfa4d8[_0x0484('0x1f')]],'as':_0xcfa4d8['as'],'attributes':_0xcfa4d8[_0x0484('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0484('0xc')](function(_0x59d58f){logger[_0x0484('0x20')](_0x0484('0x17'),_0x18c472);logger['debug']('ShowVariable',_0x18c472,JSON[_0x0484('0x10')](_0x59d58f));_0x3599fe(_0x59d58f);})['catch'](function(_0x6824b2){logger['error']('ShowVariable',_0x6824b2[_0x0484('0x13')],_0x18c472);_0xbaaabd(_0x3cf2c3[_0x0484('0x11')](0x1f4,_0x6824b2[_0x0484('0x13')]));});});}; \ No newline at end of file +var _0x3727=['Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','Variable,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x207ee7,_0x37e551){var _0x20fb0d=function(_0x227006){while(--_0x227006){_0x207ee7['push'](_0x207ee7['shift']());}};_0x20fb0d(++_0x37e551);}(_0x3727,0x195));var _0x7372=function(_0x1375c8,_0x53e24a){_0x1375c8=_0x1375c8-0x0;var _0x1ee1ef=_0x3727[_0x1375c8];return _0x1ee1ef;};'use strict';var _=require(_0x7372('0x0'));var util=require(_0x7372('0x1'));var moment=require(_0x7372('0x2'));var BPromise=require(_0x7372('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7372('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7372('0x5'));var logger=require(_0x7372('0x6'))('rpc');var config=require(_0x7372('0x7'));var jayson=require(_0x7372('0x8'));var client=jayson[_0x7372('0x9')][_0x7372('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cfb93,_0xd8d089,_0x1b2021){return new BPromise(function(_0x3a34ed,_0x4e5c64){return client['request'](_0x3cfb93,_0x1b2021)['then'](function(_0x1b4be9){logger[_0x7372('0xb')](_0x7372('0xc'),_0xd8d089,_0x7372('0xd'));logger[_0x7372('0xe')](_0x7372('0xf'),_0xd8d089,_0x7372('0xd'),JSON[_0x7372('0x10')](_0x1b4be9));if(_0x1b4be9[_0x7372('0x11')]){if(_0x1b4be9[_0x7372('0x11')]['code']===0x1f4){logger[_0x7372('0x11')](_0x7372('0xc'),_0xd8d089,_0x1b4be9[_0x7372('0x11')][_0x7372('0x12')]);return _0x4e5c64(_0x1b4be9[_0x7372('0x11')]['message']);}logger[_0x7372('0x11')](_0x7372('0xc'),_0xd8d089,_0x1b4be9[_0x7372('0x11')][_0x7372('0x12')]);return _0x3a34ed(_0x1b4be9['error']['message']);}else{logger[_0x7372('0xb')]('Variable,\x20%s,\x20%s',_0xd8d089,'request\x20sent');_0x3a34ed(_0x1b4be9[_0x7372('0x13')][_0x7372('0x12')]);}})[_0x7372('0x14')](function(_0x36cbc9){logger[_0x7372('0x11')](_0x7372('0xc'),_0xd8d089,_0x36cbc9);_0x4e5c64(_0x36cbc9);});});}exports[_0x7372('0x15')]=function(_0x6a46f9){var _0x595e72=this;return new Promise(function(_0x36e8c3,_0x190fa4){return db['Variable']['find']({'raw':_0x6a46f9[_0x7372('0x16')]?_0x6a46f9['options'][_0x7372('0x17')]===undefined?!![]:![]:!![],'where':_0x6a46f9['options']?_0x6a46f9['options'][_0x7372('0x18')]||null:null,'attributes':_0x6a46f9[_0x7372('0x16')]?_0x6a46f9[_0x7372('0x16')][_0x7372('0x19')]||null:null,'include':_0x6a46f9[_0x7372('0x16')]?_0x6a46f9[_0x7372('0x16')][_0x7372('0x1a')]?_[_0x7372('0x1b')](_0x6a46f9['options'][_0x7372('0x1a')],function(_0x20e00f){return{'model':db[_0x20e00f[_0x7372('0x1c')]],'as':_0x20e00f['as'],'attributes':_0x20e00f['attributes'],'include':_0x20e00f[_0x7372('0x1a')]?_[_0x7372('0x1b')](_0x20e00f[_0x7372('0x1a')],function(_0x289e7e){return{'model':db[_0x289e7e[_0x7372('0x1c')]],'as':_0x289e7e['as'],'attributes':_0x289e7e[_0x7372('0x19')],'include':_0x289e7e[_0x7372('0x1a')]?_[_0x7372('0x1b')](_0x289e7e[_0x7372('0x1a')],function(_0xa57d96){return{'model':db[_0xa57d96['model']],'as':_0xa57d96['as'],'attributes':_0xa57d96[_0x7372('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7372('0x1d')](function(_0x3f0cc9){logger[_0x7372('0xb')]('ShowVariable',_0x6a46f9);logger[_0x7372('0xe')](_0x7372('0x15'),_0x6a46f9,JSON[_0x7372('0x10')](_0x3f0cc9));_0x36e8c3(_0x3f0cc9);})[_0x7372('0x14')](function(_0x2b325e){logger[_0x7372('0x11')](_0x7372('0x15'),_0x2b325e['message'],_0x6a46f9);_0x190fa4(_0x595e72['error'](0x1f4,_0x2b325e[_0x7372('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7f700a6..c8b919f 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 _0x39c8=['/restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','reset','/pull','pull'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39c8,0x17d));var _0x839c=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x39c8[_0x46401e];return _0x447cba;};'use strict';var express=require('express');var router=express[_0x839c('0x0')]();var auth=require(_0x839c('0x1'));var controller=require(_0x839c('0x2'));router[_0x839c('0x3')]('/',controller['index']);router['get']('/fetch',auth[_0x839c('0x4')](),auth[_0x839c('0x5')](),controller['fetch']);router[_0x839c('0x3')]('/reset',auth[_0x839c('0x4')](),auth[_0x839c('0x5')](),controller[_0x839c('0x6')]);router['get'](_0x839c('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x839c('0x8')]);router['get'](_0x839c('0x9'),auth[_0x839c('0x4')](),controller['restart']);router[_0x839c('0x3')](_0x839c('0xa'),controller[_0x839c('0xb')]);module[_0x839c('0xc')]=router; \ No newline at end of file +var _0x2875=['/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2875,0x14b));var _0x5287=function(_0x3a2e4b,_0x1fc1f7){_0x3a2e4b=_0x3a2e4b-0x0;var _0x3697d9=_0x2875[_0x3a2e4b];return _0x3697d9;};'use strict';var express=require(_0x5287('0x0'));var router=express[_0x5287('0x1')]();var auth=require(_0x5287('0x2'));var controller=require(_0x5287('0x3'));router[_0x5287('0x4')]('/',controller[_0x5287('0x5')]);router[_0x5287('0x4')](_0x5287('0x6'),auth[_0x5287('0x7')](),auth[_0x5287('0x8')](),controller['fetch']);router[_0x5287('0x4')](_0x5287('0x9'),auth[_0x5287('0x7')](),auth[_0x5287('0x8')](),controller[_0x5287('0xa')]);router[_0x5287('0x4')](_0x5287('0xb'),auth['isAuthenticated'](),auth[_0x5287('0x8')](),controller[_0x5287('0xc')]);router[_0x5287('0x4')](_0x5287('0xd'),auth[_0x5287('0x7')](),controller[_0x5287('0xe')]);router['get'](_0x5287('0xf'),controller[_0x5287('0x10')]);module[_0x5287('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 11e0077..6935566 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 _0x62f1=['server','map','\x20to\x20','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','query','latest','tags','status','json','fetch','origin','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','pull','npm\x20install\x20--production','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','migrations','length','.js','exports','sort','Migration','sequelize','join'];(function(_0x5825b4,_0x1cce94){var _0x1f06d4=function(_0x427d5e){while(--_0x427d5e){_0x5825b4['push'](_0x5825b4['shift']());}};_0x1f06d4(++_0x1cce94);}(_0x62f1,0x112));var _0x162f=function(_0x119fb8,_0x2fda18){_0x119fb8=_0x119fb8-0x0;var _0x58a0db=_0x62f1[_0x119fb8];return _0x58a0db;};'use strict';var Umzug=require(_0x162f('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x162f('0x1'));var pkginfo=require(_0x162f('0x2'))(module,_0x162f('0x3'));var compareVersions=require(_0x162f('0x4'));var exec=require(_0x162f('0x5'))[_0x162f('0x6')];var db=require(_0x162f('0x7'))['db'];var config=require(_0x162f('0x8'));var pm2=require(_0x162f('0x9'));var logger=require(_0x162f('0xa'))('update');var git=require(_0x162f('0xb'))(config[_0x162f('0xc')]);exports['index']=function(_0x2b0c29,_0xbeb77d){var _0xcb0ac4={'current':module['exports'][_0x162f('0x3')],'phonebar':0x2};if(_0x2b0c29[_0x162f('0xd')]&&_0x2b0c29[_0x162f('0xd')][_0x162f('0xe')]){return git['fetch']()[_0x162f('0xf')](function(_0x14aaa6,_0x454b6a){_0xcb0ac4['latest']=(_0x14aaa6?module['exports']['version']:_0x454b6a[_0x162f('0xe')])||'2.0.0';return _0xbeb77d[_0x162f('0x10')](0xc8)[_0x162f('0x11')](_0xcb0ac4);});}else{return _0xbeb77d[_0x162f('0x10')](0xc8)[_0x162f('0x11')](_0xcb0ac4);}};exports['fetch']=function(_0x3e4f60,_0x2bf9f0){return git[_0x162f('0x12')]([_0x162f('0x13'),'master'],function(_0x195085){if(_0x195085){logger['error'](_0x195085);return _0x2bf9f0[_0x162f('0x10')](0x1f4)[_0x162f('0x11')](_0x195085);}logger[_0x162f('0x14')](_0x162f('0x15'));return _0x2bf9f0['status'](0xc8)['json']({'output':_0x162f('0x16')});});};exports[_0x162f('0x17')]=function(_0x413c63,_0x1ee433){return git[_0x162f('0x17')]([_0x162f('0x18'),_0x162f('0x19')],function(_0x5723f3){if(_0x5723f3){logger[_0x162f('0x1a')](_0x5723f3);return _0x1ee433['status'](0x1f4)[_0x162f('0x11')](_0x5723f3);}logger[_0x162f('0x14')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1ee433[_0x162f('0x10')](0xc8)[_0x162f('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0x162f('0x1b')]=function(_0x436a5a,_0x3f3092){exec(_0x162f('0x1c'),function(_0x5dc1a7,_0xdab3e,_0x246aff){logger[_0x162f('0x14')](_0xdab3e);logger[_0x162f('0x14')](_0x246aff);if(_0x5dc1a7){logger[_0x162f('0x1a')](_0x5dc1a7);return _0x3f3092[_0x162f('0x10')](0x1f4)[_0x162f('0x11')](_0x5dc1a7);}return _0x3f3092[_0x162f('0x10')](0xc8)['json']({'output':_0xdab3e});});};exports[_0x162f('0x1d')]=function(_0x2bdd02,_0x2dda84){return pm2[_0x162f('0x1d')]('motion2')[_0x162f('0x1e')](function(_0x58af8a){logger[_0x162f('0x14')]('pm2\x20restart\x20motion\x20%s',_0x58af8a);return _0x2dda84[_0x162f('0x10')](0xc8)['json']({'output':_0x162f('0x1f')});})['catch'](function(_0x3e710d){logger[_0x162f('0x1a')](_0x3e710d);return _0x2dda84[_0x162f('0x10')](0x1f4)['json'](_0x3e710d);});};exports['migrations']=function(_0x4c58ff,_0x580e13){var _0x3f9247=fs[_0x162f('0x20')](path['join'](config['root'],'server',_0x162f('0x21')));var _0x5089c7=[];for(var _0x43bb9a=0x0;_0x43bb9a<_0x3f9247[_0x162f('0x22')];_0x43bb9a++){var _0x55b224=_0x3f9247[_0x43bb9a]['replace'](_0x162f('0x23'),'');if(compareVersions(module[_0x162f('0x24')][_0x162f('0x3')],_0x55b224)===-0x1){_0x5089c7['push'](_0x55b224);}}if(_0x5089c7[_0x162f('0x22')]){var _0x37ffee=_0x5089c7[_0x162f('0x25')](compareVersions);var _0x337a3e=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x162f('0x26'),'columnName':'version'},'migrations':{'params':[db[_0x162f('0x27')]['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x162f('0x28')](config[_0x162f('0xc')],_0x162f('0x29'),'migrations'),'pattern':/\.js$/}});_0x337a3e['up']({'migrations':_[_0x162f('0x2a')](_0x37ffee,function(_0x36b094){return _0x36b094+'.js';})})[_0x162f('0x1e')](function(){return _0x580e13[_0x162f('0x10')](0xc8)[_0x162f('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x162f('0x24')]['version']+_0x162f('0x2b')+_['last'](_0x37ffee),'migrations':_[_0x162f('0x28')](_0x37ffee)});})['catch'](function(_0x1013e5){if(_0x1013e5 instanceof db[_0x162f('0x27')]['UniqueConstraintError']){return _0x580e13[_0x162f('0x10')](0xc8)['json']({'output':_0x162f('0x2c')});}else{return _0x580e13[_0x162f('0x10')](0x1f4)['json'](_0x1013e5);}});}else{return _0x580e13[_0x162f('0x10')](0xc8)['json']({'output':_0x162f('0x2c')});}}; \ No newline at end of file +var _0xb3f9=['sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x381e5c,_0x3ef34c){_0x381e5c=_0x381e5c-0x0;var _0x2a08d7=_0xb3f9[_0x381e5c];return _0x2a08d7;};'use strict';var Umzug=require(_0x9b3f('0x0'));var path=require(_0x9b3f('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x9b3f('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x9b3f('0x3'))[_0x9b3f('0x4')];var db=require(_0x9b3f('0x5'))['db'];var config=require(_0x9b3f('0x6'));var pm2=require(_0x9b3f('0x7'));var logger=require(_0x9b3f('0x8'))('update');var git=require('simple-git')(config[_0x9b3f('0x9')]);exports[_0x9b3f('0xa')]=function(_0x4d3e78,_0x2194b5){var _0x53b154={'current':module['exports']['version'],'phonebar':0x2};if(_0x4d3e78[_0x9b3f('0xb')]&&_0x4d3e78['query'][_0x9b3f('0xc')]){return git[_0x9b3f('0xd')]()[_0x9b3f('0xe')](function(_0x230b57,_0x2fd8e0){_0x53b154['latest']=(_0x230b57?module[_0x9b3f('0xf')][_0x9b3f('0x2')]:_0x2fd8e0[_0x9b3f('0xc')])||_0x9b3f('0x10');return _0x2194b5[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')](_0x53b154);});}else{return _0x2194b5[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')](_0x53b154);}};exports['fetch']=function(_0x537ab1,_0x56f676){return git[_0x9b3f('0xd')]([_0x9b3f('0x13'),_0x9b3f('0x14')],function(_0x76978e){if(_0x76978e){logger['error'](_0x76978e);return _0x56f676['status'](0x1f4)['json'](_0x76978e);}logger[_0x9b3f('0x15')](_0x9b3f('0x16'));return _0x56f676[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')]({'output':_0x9b3f('0x17')});});};exports[_0x9b3f('0x18')]=function(_0x5f5c1c,_0x579c32){return git[_0x9b3f('0x18')]([_0x9b3f('0x19'),_0x9b3f('0x1a')],function(_0x23d7c7){if(_0x23d7c7){logger[_0x9b3f('0x1b')](_0x23d7c7);return _0x579c32[_0x9b3f('0x11')](0x1f4)[_0x9b3f('0x12')](_0x23d7c7);}logger[_0x9b3f('0x15')](_0x9b3f('0x1c'));return _0x579c32[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')]({'output':_0x9b3f('0x1d')});});};exports[_0x9b3f('0x1e')]=function(_0x1218c0,_0x50d06c){exec(_0x9b3f('0x1f'),function(_0x1d5c43,_0x5195e9,_0x3360d6){logger['info'](_0x5195e9);logger[_0x9b3f('0x15')](_0x3360d6);if(_0x1d5c43){logger['error'](_0x1d5c43);return _0x50d06c[_0x9b3f('0x11')](0x1f4)['json'](_0x1d5c43);}return _0x50d06c[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')]({'output':_0x5195e9});});};exports[_0x9b3f('0x20')]=function(_0x59469f,_0x39b8b9){return pm2['restart'](_0x9b3f('0x21'))['then'](function(_0x1b3ba8){logger[_0x9b3f('0x15')]('pm2\x20restart\x20motion\x20%s',_0x1b3ba8);return _0x39b8b9[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')]({'output':_0x9b3f('0x22')});})[_0x9b3f('0x23')](function(_0x487527){logger['error'](_0x487527);return _0x39b8b9[_0x9b3f('0x11')](0x1f4)['json'](_0x487527);});};exports[_0x9b3f('0x24')]=function(_0x4a0d60,_0x1059b1){var _0x128542=fs[_0x9b3f('0x25')](path[_0x9b3f('0x26')](config[_0x9b3f('0x9')],'server',_0x9b3f('0x24')));var _0x38dd12=[];for(var _0x1dad0e=0x0;_0x1dad0e<_0x128542[_0x9b3f('0x27')];_0x1dad0e++){var _0x413a00=_0x128542[_0x1dad0e][_0x9b3f('0x28')](_0x9b3f('0x29'),'');if(compareVersions(module['exports']['version'],_0x413a00)===-0x1){_0x38dd12[_0x9b3f('0x2a')](_0x413a00);}}if(_0x38dd12['length']){var _0x53bf78=_0x38dd12[_0x9b3f('0x2b')](compareVersions);var _0x4f3640=new Umzug({'storage':_0x9b3f('0x2c'),'storageOptions':{'model':db[_0x9b3f('0x2d')],'modelName':_0x9b3f('0x2d'),'columnName':_0x9b3f('0x2')},'migrations':{'params':[db[_0x9b3f('0x2c')]['getQueryInterface'](),db[_0x9b3f('0x2c')][_0x9b3f('0x2e')],function(){throw new Error(_0x9b3f('0x2f'));}],'path':path[_0x9b3f('0x26')](config[_0x9b3f('0x9')],_0x9b3f('0x30'),'migrations'),'pattern':/\.js$/}});_0x4f3640['up']({'migrations':_[_0x9b3f('0x31')](_0x53bf78,function(_0x4082cb){return _0x4082cb+_0x9b3f('0x29');})})['then'](function(){return _0x1059b1[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')]({'output':_0x9b3f('0x32')+module[_0x9b3f('0xf')][_0x9b3f('0x2')]+_0x9b3f('0x33')+_[_0x9b3f('0x34')](_0x53bf78),'migrations':_[_0x9b3f('0x26')](_0x53bf78)});})[_0x9b3f('0x23')](function(_0x11174c){if(_0x11174c instanceof db[_0x9b3f('0x2c')][_0x9b3f('0x35')]){return _0x1059b1[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')]({'output':_0x9b3f('0x36')});}else{return _0x1059b1['status'](0x1f4)[_0x9b3f('0x12')](_0x11174c);}});}else{return _0x1059b1[_0x9b3f('0x11')](0xc8)[_0x9b3f('0x12')]({'output':_0x9b3f('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a2c3320..f223269 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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x414ff1,_0xf0462b){var _0x29c53f=function(_0x1dab72){while(--_0x1dab72){_0x414ff1['push'](_0x414ff1['shift']());}};_0x29c53f(++_0xf0462b);}(_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 fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0x0713=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x3c038e,_0x4fa4cf){var _0x5cfd22=function(_0x4613c2){while(--_0x4613c2){_0x3c038e['push'](_0x3c038e['shift']());}};_0x5cfd22(++_0x4fa4cf);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xd'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 83fd78b..882f743 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 _0xf494=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x4db16b,_0x425015){var _0x4981f2=function(_0x3af89b){while(--_0x3af89b){_0x4db16b['push'](_0x4db16b['shift']());}};_0x4981f2(++_0x425015);}(_0xf494,0x1c6));var _0x4f49=function(_0x5b2a8f,_0x34cd2d){_0x5b2a8f=_0x5b2a8f-0x0;var _0x104354=_0xf494[_0x5b2a8f];return _0x104354;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'type':{'type':Sequelize[_0x4f49('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4f49('0x2')]},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'queue':{'type':Sequelize[_0x4f49('0x2')]},'interface':{'type':Sequelize[_0x4f49('0x2')]},'membername':{'type':Sequelize[_0x4f49('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4f49('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4f49('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4f49('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4f49('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4f49('0x3')]},'holdtime':{'type':Sequelize[_0x4f49('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4f49('0x4')]},'agentacw':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4f49('0x4')]},'reason':{'type':Sequelize[_0x4f49('0x2')]},'lastevent':{'type':Sequelize[_0x4f49('0x2')]},'channel':{'type':Sequelize[_0x4f49('0x2')]},'channelstate':{'type':Sequelize[_0x4f49('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4f49('0x2')]},'connectedlinename':{'type':Sequelize[_0x4f49('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4f49('0x2')]},'destchannel':{'type':Sequelize[_0x4f49('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4f49('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4f49('0x2')]},'destcalleridname':{'type':Sequelize[_0x4f49('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4f49('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4f49('0x2')]},'destlanguage':{'type':Sequelize[_0x4f49('0x2')]},'destaccountcode':{'type':Sequelize[_0x4f49('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4f49('0x2')]},'destpriority':{'type':Sequelize[_0x4f49('0x2')]},'destuniqueid':{'type':Sequelize[_0x4f49('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4f49('0x2')],'comment':_0x4f49('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4f49('0x2')]},'agententerreason':{'type':Sequelize[_0x4f49('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8958=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0x2c6250,_0x38426a){var _0x556b5e=function(_0x1569de){while(--_0x1569de){_0x2c6250['push'](_0x2c6250['shift']());}};_0x556b5e(++_0x38426a);}(_0x8958,0x93));var _0x8895=function(_0x1986b9,_0x43f073){_0x1986b9=_0x1986b9-0x0;var _0x5ef33f=_0x8958[_0x1986b9];return _0x5ef33f;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8895('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8895('0x1')]},'agentcalledAt':{'type':Sequelize[_0x8895('0x2')]},'agentconnectAt':{'type':Sequelize[_0x8895('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8895('0x2')]},'agentdumpAt':{'type':Sequelize[_0x8895('0x2')]},'holdtime':{'type':Sequelize[_0x8895('0x3')]},'agentcomplete':{'type':Sequelize[_0x8895('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8895('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8895('0x3')]},'agentacw':{'type':Sequelize[_0x8895('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8895('0x3')]},'reason':{'type':Sequelize[_0x8895('0x1')]},'lastevent':{'type':Sequelize[_0x8895('0x1')]},'channel':{'type':Sequelize[_0x8895('0x1')]},'channelstate':{'type':Sequelize[_0x8895('0x3')]},'channelstatedesc':{'type':Sequelize[_0x8895('0x1')]},'connectedlinenum':{'type':Sequelize[_0x8895('0x1')]},'connectedlinename':{'type':Sequelize[_0x8895('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8895('0x1')]},'context':{'type':Sequelize[_0x8895('0x1')]},'exten':{'type':Sequelize[_0x8895('0x1')]},'priority':{'type':Sequelize[_0x8895('0x1')]},'destchannel':{'type':Sequelize[_0x8895('0x1')]},'destchannelstate':{'type':Sequelize[_0x8895('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8895('0x1')]},'destcalleridname':{'type':Sequelize[_0x8895('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x8895('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8895('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8895('0x1')]},'destpriority':{'type':Sequelize[_0x8895('0x1')]},'destuniqueid':{'type':Sequelize[_0x8895('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8895('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x8895('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8895('0x1')],'comment':_0x8895('0x5')},'transferexten':{'type':Sequelize[_0x8895('0x1')]},'transferuniqueid':{'type':Sequelize[_0x8895('0x1')]},'agententerreason':{'type':Sequelize[_0x8895('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 158a6b4..3b85cb9 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 _0xde7e=['html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','VoiceAgentReport','rawAttributes','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','include','find','body','describe'];(function(_0x59ef2d,_0x5108a1){var _0xf60c39=function(_0x455185){while(--_0x455185){_0x59ef2d['push'](_0x59ef2d['shift']());}};_0xf60c39(++_0x5108a1);}(_0xde7e,0x163));var _0xede7=function(_0x183e0e,_0x4142fe){_0x183e0e=_0x183e0e-0x0;var _0x24b49f=_0xde7e[_0x183e0e];return _0x24b49f;};'use strict';var pdf=require(_0xede7('0x0'));var emlformat=require(_0xede7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xede7('0x2'));var jsonpatch=require(_0xede7('0x3'));var rp=require(_0xede7('0x4'));var moment=require('moment');var BPromise=require(_0xede7('0x5'));var Mustache=require(_0xede7('0x6'));var util=require(_0xede7('0x7'));var path=require(_0xede7('0x8'));var sox=require(_0xede7('0x9'));var csv=require(_0xede7('0xa'));var ejs=require(_0xede7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xede7('0xc'));var jsforce=require(_0xede7('0xd'));var deskjs=require(_0xede7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xede7('0xf'));var Papa=require(_0xede7('0x10'));var Redis=require(_0xede7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xede7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xede7('0x13'));var logger=require(_0xede7('0x14'))('api');var utils=require(_0xede7('0x15'));var config=require(_0xede7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548c88,_0x402faa){_0x402faa=_0x402faa||0xcc;return function(_0x58377f){if(_0x58377f){return _0x548c88['sendStatus'](_0x402faa);}return _0x548c88[_0xede7('0x17')](_0x402faa)[_0xede7('0x18')]();};}function respondWithResult(_0x3c8f9b,_0x27deeb){_0x27deeb=_0x27deeb||0xc8;return function(_0x58a147){if(_0x58a147){return _0x3c8f9b['status'](_0x27deeb)[_0xede7('0x19')](_0x58a147);}};}function respondWithFilteredResult(_0x3e4265,_0xbce809){return function(_0x26d322){if(_0x26d322){var _0x15ef4d=_0x26d322['count'],_0x2ba2e7=_0xbce809[_0xede7('0x1a')],_0x383b4d=_0xbce809[_0xede7('0x1a')]+_0xbce809[_0xede7('0x1b')],_0x3aa810;if(_0x383b4d>=_0x15ef4d){_0x383b4d=_0x15ef4d;_0x3aa810=0xc8;}else{_0x3aa810=0xce;}_0x3e4265[_0xede7('0x17')](_0x3aa810);return _0x3e4265[_0xede7('0x1c')](_0xede7('0x1d'),_0x2ba2e7+'-'+_0x383b4d+'/'+_0x15ef4d)['json'](_0x26d322);}return null;};}function patchUpdates(_0x164b00){return function(_0x429a16){try{jsonpatch['apply'](_0x429a16,_0x164b00,!![]);}catch(_0xcf79ff){return BPromise[_0xede7('0x1e')](_0xcf79ff);}return _0x429a16[_0xede7('0x1f')]();};}function saveUpdates(_0x37ab5f,_0xb64705){return function(_0x3ef2f0){if(_0x3ef2f0){return _0x3ef2f0[_0xede7('0x20')](_0x37ab5f)[_0xede7('0x21')](function(_0x518dcc){return _0x518dcc;});}return null;};}function removeEntity(_0x4254e8,_0x568a78){return function(_0x57f416){if(_0x57f416){return _0x57f416[_0xede7('0x22')]()[_0xede7('0x21')](function(){_0x4254e8[_0xede7('0x17')](0xcc)[_0xede7('0x18')]();});}};}function handleEntityNotFound(_0x1e08e5,_0x1216e3){return function(_0x4719e3){if(!_0x4719e3){_0x1e08e5[_0xede7('0x23')](0x194);}return _0x4719e3;};}function handleError(_0x2a8f19,_0x4552cf){_0x4552cf=_0x4552cf||0x1f4;return function(_0x11c03e){logger[_0xede7('0x24')](_0x11c03e[_0xede7('0x25')]);if(_0x11c03e[_0xede7('0x26')]){delete _0x11c03e[_0xede7('0x26')];}_0x2a8f19[_0xede7('0x17')](_0x4552cf)['send'](_0x11c03e);};}exports[_0xede7('0x27')]=function(_0x346176,_0x30b453){var _0x493009={},_0x144bcb={},_0x206599={'count':0x0,'rows':[]};var _0x4dd75c=_[_0xede7('0x28')](db[_0xede7('0x29')][_0xede7('0x2a')],function(_0xf06fcf){return{'name':_0xf06fcf['fieldName'],'type':_0xf06fcf['type']['key']};});_0x144bcb[_0xede7('0x2b')]=_[_0xede7('0x28')](_0x4dd75c,_0xede7('0x26'));_0x144bcb[_0xede7('0x2c')]=_['keys'](_0x346176[_0xede7('0x2c')]);_0x144bcb[_0xede7('0x2d')]=_[_0xede7('0x2e')](_0x144bcb[_0xede7('0x2b')],_0x144bcb[_0xede7('0x2c')]);_0x493009[_0xede7('0x2f')]=_[_0xede7('0x2e')](_0x144bcb[_0xede7('0x2b')],qs[_0xede7('0x30')](_0x346176[_0xede7('0x2c')][_0xede7('0x30')]));_0x493009[_0xede7('0x2f')]=_0x493009['attributes'][_0xede7('0x31')]?_0x493009[_0xede7('0x2f')]:_0x144bcb[_0xede7('0x2b')];if(!_0x346176[_0xede7('0x2c')]['hasOwnProperty']('nolimit')){_0x493009[_0xede7('0x1b')]=qs[_0xede7('0x1b')](_0x346176[_0xede7('0x2c')][_0xede7('0x1b')]);_0x493009[_0xede7('0x1a')]=qs[_0xede7('0x1a')](_0x346176[_0xede7('0x2c')][_0xede7('0x1a')]);}_0x493009[_0xede7('0x32')]=qs[_0xede7('0x33')](_0x346176[_0xede7('0x2c')][_0xede7('0x33')]);_0x493009[_0xede7('0x34')]=qs[_0xede7('0x2d')](_[_0xede7('0x35')](_0x346176[_0xede7('0x2c')],_0x144bcb['filters']),_0x4dd75c);if(_0x346176[_0xede7('0x2c')][_0xede7('0x36')]){_0x493009[_0xede7('0x34')]=_['merge'](_0x493009[_0xede7('0x34')],{'$or':_[_0xede7('0x28')](_0x4dd75c,function(_0x2f0d40){if(_0x2f0d40[_0xede7('0x37')]!==_0xede7('0x38')){var _0x46f2a9={};_0x46f2a9[_0x2f0d40['name']]={'$like':'%'+_0x346176[_0xede7('0x2c')]['filter']+'%'};return _0x46f2a9;}})});}_0x493009=_[_0xede7('0x39')]({},_0x493009,_0x346176[_0xede7('0x3a')]);var _0x34fd71={'where':_0x493009[_0xede7('0x34')]};return db[_0xede7('0x29')][_0xede7('0x3b')](_0x34fd71)[_0xede7('0x21')](function(_0x245951){_0x206599[_0xede7('0x3b')]=_0x245951;if(_0x346176['query'][_0xede7('0x3c')]){_0x493009['include']=[{'all':!![]}];}return db['VoiceAgentReport'][_0xede7('0x3d')](_0x493009);})[_0xede7('0x21')](function(_0x182260){_0x206599[_0xede7('0x3e')]=_0x182260;return _0x206599;})[_0xede7('0x21')](respondWithFilteredResult(_0x30b453,_0x493009))[_0xede7('0x3f')](handleError(_0x30b453,null));};exports[_0xede7('0x40')]=function(_0x5b957d,_0xdda28b){var _0x48dbfb={'raw':![],'where':{'id':_0x5b957d[_0xede7('0x41')]['id']}},_0x11d797={};_0x11d797['model']=_[_0xede7('0x42')](db[_0xede7('0x29')][_0xede7('0x2a')]);_0x11d797[_0xede7('0x2c')]=_[_0xede7('0x42')](_0x5b957d[_0xede7('0x2c')]);_0x11d797[_0xede7('0x2d')]=_[_0xede7('0x2e')](_0x11d797[_0xede7('0x2b')],_0x11d797['query']);_0x48dbfb[_0xede7('0x2f')]=_['intersection'](_0x11d797[_0xede7('0x2b')],qs[_0xede7('0x30')](_0x5b957d['query'][_0xede7('0x30')]));_0x48dbfb[_0xede7('0x2f')]=_0x48dbfb['attributes'][_0xede7('0x31')]?_0x48dbfb['attributes']:_0x11d797['model'];if(_0x5b957d[_0xede7('0x2c')][_0xede7('0x3c')]){_0x48dbfb[_0xede7('0x43')]=[{'all':!![]}];}_0x48dbfb=_[_0xede7('0x39')]({},_0x48dbfb,_0x5b957d[_0xede7('0x3a')]);return db['VoiceAgentReport'][_0xede7('0x44')](_0x48dbfb)[_0xede7('0x21')](handleEntityNotFound(_0xdda28b,null))[_0xede7('0x21')](respondWithResult(_0xdda28b,null))['catch'](handleError(_0xdda28b,null));};exports['create']=function(_0x50bd78,_0x25905f){return db[_0xede7('0x29')]['create'](_0x50bd78['body'],{})['then'](respondWithResult(_0x25905f,0xc9))[_0xede7('0x3f')](handleError(_0x25905f,null));};exports[_0xede7('0x20')]=function(_0x7dcfd0,_0x4b09ed){if(_0x7dcfd0[_0xede7('0x45')]['id']){delete _0x7dcfd0['body']['id'];}return db['VoiceAgentReport'][_0xede7('0x44')]({'where':{'id':_0x7dcfd0[_0xede7('0x41')]['id']}})[_0xede7('0x21')](handleEntityNotFound(_0x4b09ed,null))['then'](saveUpdates(_0x7dcfd0[_0xede7('0x45')],null))[_0xede7('0x21')](respondWithResult(_0x4b09ed,null))[_0xede7('0x3f')](handleError(_0x4b09ed,null));};exports['destroy']=function(_0x536480,_0x382749){return db['VoiceAgentReport']['find']({'where':{'id':_0x536480[_0xede7('0x41')]['id']}})[_0xede7('0x21')](handleEntityNotFound(_0x382749,null))[_0xede7('0x21')](removeEntity(_0x382749,null))[_0xede7('0x3f')](handleError(_0x382749,null));};exports[_0xede7('0x46')]=function(_0x3b6203,_0x4414f8){return db[_0xede7('0x29')][_0xede7('0x46')]()[_0xede7('0x21')](respondWithResult(_0x4414f8,null))[_0xede7('0x3f')](handleError(_0x4414f8,null));}; \ No newline at end of file +var _0x927c=['then','destroy','sendStatus','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','set','apply','reject','save','update'];(function(_0x390788,_0x38d293){var _0x128775=function(_0x72f14a){while(--_0x72f14a){_0x390788['push'](_0x390788['shift']());}};_0x128775(++_0x38d293);}(_0x927c,0x109));var _0xc927=function(_0x214df9,_0xe9a5e2){_0x214df9=_0x214df9-0x0;var _0x1b6458=_0x927c[_0x214df9];return _0x1b6458;};'use strict';var pdf=require(_0xc927('0x0'));var emlformat=require(_0xc927('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc927('0x2'));var jsonpatch=require(_0xc927('0x3'));var rp=require(_0xc927('0x4'));var moment=require(_0xc927('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc927('0x6'));var util=require('util');var path=require(_0xc927('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc927('0x8'));var _=require('lodash');var squel=require(_0xc927('0x9'));var crypto=require(_0xc927('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc927('0xb'));var toCsv=require(_0xc927('0xc'));var querystring=require(_0xc927('0xd'));var Papa=require(_0xc927('0xe'));var Redis=require(_0xc927('0xf'));var authService=require(_0xc927('0x10'));var qs=require(_0xc927('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc927('0x12'));var logger=require(_0xc927('0x13'))(_0xc927('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc927('0x15'));var db=require(_0xc927('0x16'))['db'];function respondWithStatusCode(_0x5d9c36,_0x5d1ccf){_0x5d1ccf=_0x5d1ccf||0xcc;return function(_0x132f2c){if(_0x132f2c){return _0x5d9c36['sendStatus'](_0x5d1ccf);}return _0x5d9c36[_0xc927('0x17')](_0x5d1ccf)[_0xc927('0x18')]();};}function respondWithResult(_0x2e2913,_0x813e87){_0x813e87=_0x813e87||0xc8;return function(_0x423c77){if(_0x423c77){return _0x2e2913['status'](_0x813e87)['json'](_0x423c77);}};}function respondWithFilteredResult(_0x4c180a,_0x1e8a11){return function(_0x1aabc7){if(_0x1aabc7){var _0x544ec7=_0x1aabc7['count'],_0x272d7b=_0x1e8a11[_0xc927('0x19')],_0x14a097=_0x1e8a11[_0xc927('0x19')]+_0x1e8a11['limit'],_0x1ae303;if(_0x14a097>=_0x544ec7){_0x14a097=_0x544ec7;_0x1ae303=0xc8;}else{_0x1ae303=0xce;}_0x4c180a[_0xc927('0x17')](_0x1ae303);return _0x4c180a[_0xc927('0x1a')]('Content-Range',_0x272d7b+'-'+_0x14a097+'/'+_0x544ec7)['json'](_0x1aabc7);}return null;};}function patchUpdates(_0x446a79){return function(_0x4bdae0){try{jsonpatch[_0xc927('0x1b')](_0x4bdae0,_0x446a79,!![]);}catch(_0x278962){return BPromise[_0xc927('0x1c')](_0x278962);}return _0x4bdae0[_0xc927('0x1d')]();};}function saveUpdates(_0x474df0,_0x3b8d1c){return function(_0x13150d){if(_0x13150d){return _0x13150d[_0xc927('0x1e')](_0x474df0)[_0xc927('0x1f')](function(_0x4d3817){return _0x4d3817;});}return null;};}function removeEntity(_0x3fdbc0,_0x1176d8){return function(_0x7610d9){if(_0x7610d9){return _0x7610d9[_0xc927('0x20')]()[_0xc927('0x1f')](function(){_0x3fdbc0[_0xc927('0x17')](0xcc)[_0xc927('0x18')]();});}};}function handleEntityNotFound(_0xc53f14,_0x1752b0){return function(_0x8df033){if(!_0x8df033){_0xc53f14[_0xc927('0x21')](0x194);}return _0x8df033;};}function handleError(_0x4eef30,_0x4723d3){_0x4723d3=_0x4723d3||0x1f4;return function(_0x4bfbaf){logger[_0xc927('0x22')](_0x4bfbaf[_0xc927('0x23')]);if(_0x4bfbaf[_0xc927('0x24')]){delete _0x4bfbaf[_0xc927('0x24')];}_0x4eef30['status'](_0x4723d3)[_0xc927('0x25')](_0x4bfbaf);};}exports[_0xc927('0x26')]=function(_0x5ec8d1,_0x18b41b){var _0x29ea1b={},_0x1a5965={},_0x14f73d={'count':0x0,'rows':[]};var _0x4c5c7b=_[_0xc927('0x27')](db[_0xc927('0x28')][_0xc927('0x29')],function(_0x310e22){return{'name':_0x310e22[_0xc927('0x2a')],'type':_0x310e22['type']['key']};});_0x1a5965[_0xc927('0x2b')]=_[_0xc927('0x27')](_0x4c5c7b,'name');_0x1a5965[_0xc927('0x2c')]=_['keys'](_0x5ec8d1['query']);_0x1a5965[_0xc927('0x2d')]=_[_0xc927('0x2e')](_0x1a5965[_0xc927('0x2b')],_0x1a5965[_0xc927('0x2c')]);_0x29ea1b[_0xc927('0x2f')]=_[_0xc927('0x2e')](_0x1a5965[_0xc927('0x2b')],qs[_0xc927('0x30')](_0x5ec8d1[_0xc927('0x2c')]['fields']));_0x29ea1b['attributes']=_0x29ea1b[_0xc927('0x2f')][_0xc927('0x31')]?_0x29ea1b[_0xc927('0x2f')]:_0x1a5965[_0xc927('0x2b')];if(!_0x5ec8d1[_0xc927('0x2c')][_0xc927('0x32')](_0xc927('0x33'))){_0x29ea1b[_0xc927('0x34')]=qs['limit'](_0x5ec8d1[_0xc927('0x2c')][_0xc927('0x34')]);_0x29ea1b[_0xc927('0x19')]=qs[_0xc927('0x19')](_0x5ec8d1[_0xc927('0x2c')][_0xc927('0x19')]);}_0x29ea1b[_0xc927('0x35')]=qs['sort'](_0x5ec8d1[_0xc927('0x2c')][_0xc927('0x36')]);_0x29ea1b[_0xc927('0x37')]=qs['filters'](_[_0xc927('0x38')](_0x5ec8d1[_0xc927('0x2c')],_0x1a5965[_0xc927('0x2d')]),_0x4c5c7b);if(_0x5ec8d1['query'][_0xc927('0x39')]){_0x29ea1b[_0xc927('0x37')]=_[_0xc927('0x3a')](_0x29ea1b[_0xc927('0x37')],{'$or':_[_0xc927('0x27')](_0x4c5c7b,function(_0x5667e9){if(_0x5667e9['type']!==_0xc927('0x3b')){var _0x24595b={};_0x24595b[_0x5667e9[_0xc927('0x24')]]={'$like':'%'+_0x5ec8d1['query'][_0xc927('0x39')]+'%'};return _0x24595b;}})});}_0x29ea1b=_['merge']({},_0x29ea1b,_0x5ec8d1[_0xc927('0x3c')]);var _0x48d686={'where':_0x29ea1b[_0xc927('0x37')]};return db['VoiceAgentReport'][_0xc927('0x3d')](_0x48d686)[_0xc927('0x1f')](function(_0x3c321a){_0x14f73d['count']=_0x3c321a;if(_0x5ec8d1[_0xc927('0x2c')][_0xc927('0x3e')]){_0x29ea1b[_0xc927('0x3f')]=[{'all':!![]}];}return db[_0xc927('0x28')][_0xc927('0x40')](_0x29ea1b);})[_0xc927('0x1f')](function(_0x512f45){_0x14f73d[_0xc927('0x41')]=_0x512f45;return _0x14f73d;})[_0xc927('0x1f')](respondWithFilteredResult(_0x18b41b,_0x29ea1b))['catch'](handleError(_0x18b41b,null));};exports[_0xc927('0x42')]=function(_0x364bd3,_0x448783){var _0x199ff4={'raw':![],'where':{'id':_0x364bd3[_0xc927('0x43')]['id']}},_0x18583f={};_0x18583f[_0xc927('0x2b')]=_[_0xc927('0x44')](db[_0xc927('0x28')]['rawAttributes']);_0x18583f[_0xc927('0x2c')]=_[_0xc927('0x44')](_0x364bd3['query']);_0x18583f[_0xc927('0x2d')]=_[_0xc927('0x2e')](_0x18583f[_0xc927('0x2b')],_0x18583f['query']);_0x199ff4['attributes']=_[_0xc927('0x2e')](_0x18583f[_0xc927('0x2b')],qs[_0xc927('0x30')](_0x364bd3[_0xc927('0x2c')][_0xc927('0x30')]));_0x199ff4[_0xc927('0x2f')]=_0x199ff4[_0xc927('0x2f')][_0xc927('0x31')]?_0x199ff4[_0xc927('0x2f')]:_0x18583f[_0xc927('0x2b')];if(_0x364bd3[_0xc927('0x2c')][_0xc927('0x3e')]){_0x199ff4[_0xc927('0x3f')]=[{'all':!![]}];}_0x199ff4=_[_0xc927('0x3a')]({},_0x199ff4,_0x364bd3[_0xc927('0x3c')]);return db[_0xc927('0x28')][_0xc927('0x45')](_0x199ff4)[_0xc927('0x1f')](handleEntityNotFound(_0x448783,null))['then'](respondWithResult(_0x448783,null))[_0xc927('0x46')](handleError(_0x448783,null));};exports[_0xc927('0x47')]=function(_0xec6919,_0x48fec2){return db[_0xc927('0x28')][_0xc927('0x47')](_0xec6919[_0xc927('0x48')],{})['then'](respondWithResult(_0x48fec2,0xc9))[_0xc927('0x46')](handleError(_0x48fec2,null));};exports['update']=function(_0x47d846,_0x53ae9d){if(_0x47d846[_0xc927('0x48')]['id']){delete _0x47d846[_0xc927('0x48')]['id'];}return db[_0xc927('0x28')][_0xc927('0x45')]({'where':{'id':_0x47d846['params']['id']}})[_0xc927('0x1f')](handleEntityNotFound(_0x53ae9d,null))[_0xc927('0x1f')](saveUpdates(_0x47d846[_0xc927('0x48')],null))[_0xc927('0x1f')](respondWithResult(_0x53ae9d,null))['catch'](handleError(_0x53ae9d,null));};exports[_0xc927('0x20')]=function(_0x441588,_0xeed89d){return db[_0xc927('0x28')][_0xc927('0x45')]({'where':{'id':_0x441588[_0xc927('0x43')]['id']}})[_0xc927('0x1f')](handleEntityNotFound(_0xeed89d,null))[_0xc927('0x1f')](removeEntity(_0xeed89d,null))[_0xc927('0x46')](handleError(_0xeed89d,null));};exports[_0xc927('0x49')]=function(_0xe06415,_0xdd06e6){return db['VoiceAgentReport'][_0xc927('0x49')]()['then'](respondWithResult(_0xdd06e6,null))['catch'](handleError(_0xdd06e6,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 502ea30..d1eb119 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 _0x9cd1=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x9cd1,0xdd));var _0x19cd=function(_0x12110d,_0x5a6f83){_0x12110d=_0x12110d-0x0;var _0xebda5=_0x9cd1[_0x12110d];return _0xebda5;};'use strict';var _=require(_0x19cd('0x0'));var util=require(_0x19cd('0x1'));var logger=require(_0x19cd('0x2'))(_0x19cd('0x3'));var moment=require(_0x19cd('0x4'));var BPromise=require('bluebird');var rp=require(_0x19cd('0x5'));var fs=require('fs');var path=require(_0x19cd('0x6'));var rimraf=require(_0x19cd('0x7'));var config=require(_0x19cd('0x8'));var attributes=require(_0x19cd('0x9'));module[_0x19cd('0xa')]=function(_0x19da88,_0x54182a){return _0x19da88['define'](_0x19cd('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x19cd('0xc'),_0x19cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1668=['VoiceAgentReport','report_agent','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x4f7a97,_0x14f986){var _0x2d97cb=function(_0x4323b6){while(--_0x4323b6){_0x4f7a97['push'](_0x4f7a97['shift']());}};_0x2d97cb(++_0x14f986);}(_0x1668,0x65));var _0x8166=function(_0x530ad0,_0x44c281){_0x530ad0=_0x530ad0-0x0;var _0x1d024f=_0x1668[_0x530ad0];return _0x1d024f;};'use strict';var _=require('lodash');var util=require(_0x8166('0x0'));var logger=require(_0x8166('0x1'))(_0x8166('0x2'));var moment=require('moment');var BPromise=require(_0x8166('0x3'));var rp=require(_0x8166('0x4'));var fs=require('fs');var path=require(_0x8166('0x5'));var rimraf=require(_0x8166('0x6'));var config=require(_0x8166('0x7'));var attributes=require(_0x8166('0x8'));module[_0x8166('0x9')]=function(_0x56dc06,_0x365031){return _0x56dc06[_0x8166('0xa')](_0x8166('0xb'),attributes,{'tableName':_0x8166('0xc'),'paranoid':![],'indexes':[{'fields':[_0x8166('0xd'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index a0a72dc..540e4cd 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 _0x404e=['../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','create','body','options','info','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x1250fa,_0x3ac79f){var _0x2f4a44=function(_0x2c2a5c){while(--_0x2c2a5c){_0x1250fa['push'](_0x1250fa['shift']());}};_0x2f4a44(++_0x3ac79f);}(_0x404e,0x1ea));var _0xe404=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0x404e[_0x3299d1];return _0x44356e;};'use strict';var _=require(_0xe404('0x0'));var util=require(_0xe404('0x1'));var moment=require(_0xe404('0x2'));var BPromise=require(_0xe404('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe404('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe404('0x5'));var logger=require(_0xe404('0x6'))(_0xe404('0x7'));var config=require('../../config/environment');var jayson=require(_0xe404('0x8'));var client=jayson[_0xe404('0x9')][_0xe404('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x260581,_0x15fdb6,_0x263ff8){return new BPromise(function(_0x264582,_0x2c8c11){return client[_0xe404('0xb')](_0x260581,_0x263ff8)[_0xe404('0xc')](function(_0x166458){logger['info'](_0xe404('0xd'),_0x15fdb6,'request\x20sent');logger[_0xe404('0xe')](_0xe404('0xf'),_0x15fdb6,_0xe404('0x10'),JSON[_0xe404('0x11')](_0x166458));if(_0x166458['error']){if(_0x166458[_0xe404('0x12')]['code']===0x1f4){logger[_0xe404('0x12')](_0xe404('0xd'),_0x15fdb6,_0x166458[_0xe404('0x12')]['message']);return _0x2c8c11(_0x166458[_0xe404('0x12')][_0xe404('0x13')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x15fdb6,_0x166458['error'][_0xe404('0x13')]);return _0x264582(_0x166458['error'][_0xe404('0x13')]);}else{logger['info'](_0xe404('0xd'),_0x15fdb6,'request\x20sent');_0x264582(_0x166458['result'][_0xe404('0x13')]);}})[_0xe404('0x14')](function(_0x406d5b){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x15fdb6,_0x406d5b);_0x2c8c11(_0x406d5b);});});}exports['CreateVoiceAgentReport']=function(_0x3adbdb){var _0x1935b8=this;return new Promise(function(_0xc46f53,_0x2c3807){return db['VoiceAgentReport'][_0xe404('0x15')](_0x3adbdb[_0xe404('0x16')],{'raw':_0x3adbdb[_0xe404('0x17')]?_0x3adbdb[_0xe404('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xe404('0xc')](function(_0x3a7cb5){logger[_0xe404('0x18')](_0xe404('0x19'),_0x3adbdb);logger['debug'](_0xe404('0x19'),_0x3adbdb,JSON[_0xe404('0x11')](_0x3a7cb5));_0xc46f53(_0x3a7cb5);})[_0xe404('0x14')](function(_0x4b957e){logger[_0xe404('0x12')](_0xe404('0x19'),_0x4b957e[_0xe404('0x13')],_0x3adbdb);_0x2c3807(_0x1935b8[_0xe404('0x12')](0x1f4,_0x4b957e[_0xe404('0x13')]));});});};exports[_0xe404('0x1a')]=function(_0x148aea){var _0x5e6261=this;return new Promise(function(_0x336e1d,_0x246488){return db['VoiceAgentReport'][_0xe404('0x1b')](_0x148aea['body'],{'raw':_0x148aea[_0xe404('0x17')]?_0x148aea[_0xe404('0x17')][_0xe404('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x148aea[_0xe404('0x17')]?_0x148aea[_0xe404('0x17')][_0xe404('0x1d')]||null:null,'attributes':_0x148aea[_0xe404('0x17')]?_0x148aea[_0xe404('0x17')][_0xe404('0x1e')]||null:null,'limit':_0x148aea[_0xe404('0x17')]?_0x148aea[_0xe404('0x17')]['limit']||null:null})['then'](function(_0x3846b9){logger[_0xe404('0x18')](_0xe404('0x1a'),_0x148aea);logger[_0xe404('0xe')](_0xe404('0x1a'),_0x148aea,JSON[_0xe404('0x11')](_0x3846b9));_0x336e1d(_0x3846b9);})[_0xe404('0x14')](function(_0xe7513c){logger[_0xe404('0x12')](_0xe404('0x1a'),_0xe7513c[_0xe404('0x13')],_0x148aea);_0x246488(_0x5e6261[_0xe404('0x12')](0x1f4,_0xe7513c[_0xe404('0x13')]));});});}; \ No newline at end of file +var _0x4f50=['limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','create','body','options','raw','debug','stringify','UpdateVoiceAgentReport','VoiceAgentReport','where'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x4f50,0xac));var _0x04f5=function(_0x1919cc,_0x4ab36e){_0x1919cc=_0x1919cc-0x0;var _0x1d8134=_0x4f50[_0x1919cc];return _0x1d8134;};'use strict';var _=require(_0x04f5('0x0'));var util=require(_0x04f5('0x1'));var moment=require('moment');var BPromise=require(_0x04f5('0x2'));var rs=require(_0x04f5('0x3'));var fs=require('fs');var Redis=require(_0x04f5('0x4'));var db=require(_0x04f5('0x5'))['db'];var utils=require(_0x04f5('0x6'));var logger=require(_0x04f5('0x7'))('rpc');var config=require(_0x04f5('0x8'));var jayson=require(_0x04f5('0x9'));var client=jayson[_0x04f5('0xa')][_0x04f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562361,_0x253f59,_0x23d7c4){return new BPromise(function(_0x3a468e,_0x5976f7){return client[_0x04f5('0xc')](_0x562361,_0x23d7c4)[_0x04f5('0xd')](function(_0x38662a){logger[_0x04f5('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x253f59,'request\x20sent');logger['debug'](_0x04f5('0xf'),_0x253f59,_0x04f5('0x10'),JSON['stringify'](_0x38662a));if(_0x38662a[_0x04f5('0x11')]){if(_0x38662a['error'][_0x04f5('0x12')]===0x1f4){logger[_0x04f5('0x11')](_0x04f5('0x13'),_0x253f59,_0x38662a['error']['message']);return _0x5976f7(_0x38662a[_0x04f5('0x11')]['message']);}logger[_0x04f5('0x11')](_0x04f5('0x13'),_0x253f59,_0x38662a[_0x04f5('0x11')][_0x04f5('0x14')]);return _0x3a468e(_0x38662a['error'][_0x04f5('0x14')]);}else{logger['info'](_0x04f5('0x13'),_0x253f59,_0x04f5('0x10'));_0x3a468e(_0x38662a[_0x04f5('0x15')][_0x04f5('0x14')]);}})['catch'](function(_0x2715e4){logger[_0x04f5('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x253f59,_0x2715e4);_0x5976f7(_0x2715e4);});});}exports[_0x04f5('0x16')]=function(_0xb9b5df){var _0x2e9092=this;return new Promise(function(_0x126533,_0x2c8721){return db['VoiceAgentReport'][_0x04f5('0x17')](_0xb9b5df[_0x04f5('0x18')],{'raw':_0xb9b5df['options']?_0xb9b5df[_0x04f5('0x19')][_0x04f5('0x1a')]===undefined?!![]:![]:!![]})[_0x04f5('0xd')](function(_0x55f0c1){logger[_0x04f5('0xe')](_0x04f5('0x16'),_0xb9b5df);logger[_0x04f5('0x1b')](_0x04f5('0x16'),_0xb9b5df,JSON[_0x04f5('0x1c')](_0x55f0c1));_0x126533(_0x55f0c1);})['catch'](function(_0xcc1887){logger['error'](_0x04f5('0x16'),_0xcc1887[_0x04f5('0x14')],_0xb9b5df);_0x2c8721(_0x2e9092[_0x04f5('0x11')](0x1f4,_0xcc1887[_0x04f5('0x14')]));});});};exports[_0x04f5('0x1d')]=function(_0x4031ce){var _0x51b1dc=this;return new Promise(function(_0x5e67f4,_0x3f093e){return db[_0x04f5('0x1e')]['update'](_0x4031ce[_0x04f5('0x18')],{'raw':_0x4031ce['options']?_0x4031ce['options'][_0x04f5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4031ce[_0x04f5('0x19')]?_0x4031ce['options'][_0x04f5('0x1f')]||null:null,'attributes':_0x4031ce['options']?_0x4031ce['options']['attributes']||null:null,'limit':_0x4031ce['options']?_0x4031ce['options'][_0x04f5('0x20')]||null:null})['then'](function(_0x4c8826){logger[_0x04f5('0xe')]('UpdateVoiceAgentReport',_0x4031ce);logger[_0x04f5('0x1b')]('UpdateVoiceAgentReport',_0x4031ce,JSON[_0x04f5('0x1c')](_0x4c8826));_0x5e67f4(_0x4c8826);})[_0x04f5('0x21')](function(_0x331028){logger[_0x04f5('0x11')](_0x04f5('0x1d'),_0x331028[_0x04f5('0x14')],_0x4031ce);_0x3f093e(_0x51b1dc[_0x04f5('0x11')](0x1f4,_0x331028[_0x04f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e880826..b0fc3b3 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b2e50f4..560597d 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 _0x7dfd=['internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x5c605d,_0x500761){var _0x1bc14c=function(_0x2ae017){while(--_0x2ae017){_0x5c605d['push'](_0x5c605d['shift']());}};_0x1bc14c(++_0x500761);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'type':{'type':Sequelize[_0xd7df('0x3')](_0xd7df('0x4'),_0xd7df('0x5'),_0xd7df('0x6'),_0xd7df('0x7'),_0xd7df('0x8'),_0xd7df('0x9'))},'tag':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'source':{'type':Sequelize[_0xd7df('0x2')]},'destination':{'type':Sequelize[_0xd7df('0x2')]},'destinationcontext':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'channel':{'type':Sequelize[_0xd7df('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xd7df('0x2')]},'lastdata':{'type':Sequelize[_0xd7df('0xa')]},'starttime':{'type':Sequelize[_0xd7df('0xb')]},'systemanswertime':{'type':Sequelize[_0xd7df('0xb')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd7df('0xb')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd7df('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd7df('0x2')]},'amaflags':{'type':Sequelize[_0xd7df('0x2')]},'userfield':{'type':Sequelize[_0xd7df('0x2')]},'userDisposition':{'type':Sequelize[_0xd7df('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xd7df('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xd7df('0x2')]},'note':{'type':Sequelize[_0xd7df('0x2')]},'prefix':{'type':Sequelize[_0xd7df('0x2')]},'routeid':{'type':Sequelize[_0xd7df('0xc')]},'sipcallid':{'type':Sequelize[_0xd7df('0x2')]}}; \ No newline at end of file +var _0x53ec=['internal','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x33ffad,_0x5eb3dc){var _0x4b0dfa=function(_0x191369){while(--_0x191369){_0x33ffad['push'](_0x33ffad['shift']());}};_0x4b0dfa(++_0x5eb3dc);}(_0x53ec,0x192));var _0xc53e=function(_0x212579,_0xdb4d5a){_0x212579=_0x212579-0x0;var _0x55d50e=_0x53ec[_0x212579];return _0x55d50e;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'uniqueid':{'type':Sequelize[_0xc53e('0x2')]},'type':{'type':Sequelize[_0xc53e('0x3')](_0xc53e('0x4'),_0xc53e('0x5'),'outbound',_0xc53e('0x6'),'outbound-fax',_0xc53e('0x7'))},'tag':{'type':Sequelize[_0xc53e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xc53e('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc53e('0x2')]},'callerid':{'type':Sequelize[_0xc53e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xc53e('0x2')]},'lastapplication':{'type':Sequelize[_0xc53e('0x2')]},'lastdata':{'type':Sequelize[_0xc53e('0x8')]},'starttime':{'type':Sequelize[_0xc53e('0x9')]},'systemanswertime':{'type':Sequelize[_0xc53e('0x9')]},'answertime':{'type':Sequelize[_0xc53e('0x9')]},'endtime':{'type':Sequelize[_0xc53e('0x9')]},'duration':{'type':Sequelize[_0xc53e('0xa')]},'billableseconds':{'type':Sequelize[_0xc53e('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc53e('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xc53e('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xc53e('0x2')]},'note':{'type':Sequelize[_0xc53e('0x2')]},'prefix':{'type':Sequelize[_0xc53e('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 64dec09..fa0aae8 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 _0xca3d=['intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','fullname','alias','User','rows','catch','show','params','find','body','describe','uniqueid','user','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x20d577,_0x2b84d1){var _0x35a3fe=function(_0x12f1a8){while(--_0x12f1a8){_0x20d577['push'](_0x20d577['shift']());}};_0x35a3fe(++_0x2b84d1);}(_0xca3d,0x1d0));var _0xdca3=function(_0x171ca6,_0x2f8f9d){_0x171ca6=_0x171ca6-0x0;var _0x244768=_0xca3d[_0x171ca6];return _0x244768;};'use strict';var pdf=require(_0xdca3('0x0'));var emlformat=require(_0xdca3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdca3('0x2'));var jsonpatch=require(_0xdca3('0x3'));var rp=require(_0xdca3('0x4'));var moment=require(_0xdca3('0x5'));var BPromise=require(_0xdca3('0x6'));var Mustache=require(_0xdca3('0x7'));var util=require('util');var path=require(_0xdca3('0x8'));var sox=require(_0xdca3('0x9'));var csv=require(_0xdca3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdca3('0xb'));var squel=require(_0xdca3('0xc'));var crypto=require(_0xdca3('0xd'));var jsforce=require(_0xdca3('0xe'));var deskjs=require(_0xdca3('0xf'));var toCsv=require(_0xdca3('0xa'));var querystring=require(_0xdca3('0x10'));var Papa=require(_0xdca3('0x11'));var Redis=require('ioredis');var authService=require(_0xdca3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdca3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdca3('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdca3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108d8b,_0x3b9f35){_0x3b9f35=_0x3b9f35||0xcc;return function(_0xa89a27){if(_0xa89a27){return _0x108d8b['sendStatus'](_0x3b9f35);}return _0x108d8b[_0xdca3('0x16')](_0x3b9f35)[_0xdca3('0x17')]();};}function respondWithResult(_0x2ff7cb,_0x44eae9){_0x44eae9=_0x44eae9||0xc8;return function(_0xd1b426){if(_0xd1b426){return _0x2ff7cb[_0xdca3('0x16')](_0x44eae9)[_0xdca3('0x18')](_0xd1b426);}};}function respondWithFilteredResult(_0x4036f9,_0x55ff5e){return function(_0x1ec90c){if(_0x1ec90c){var _0x3b90ec=_0x1ec90c[_0xdca3('0x19')],_0x9564db=_0x55ff5e[_0xdca3('0x1a')],_0x40177f=_0x55ff5e[_0xdca3('0x1a')]+_0x55ff5e[_0xdca3('0x1b')],_0x2e6e0a;if(_0x40177f>=_0x3b90ec){_0x40177f=_0x3b90ec;_0x2e6e0a=0xc8;}else{_0x2e6e0a=0xce;}_0x4036f9[_0xdca3('0x16')](_0x2e6e0a);return _0x4036f9['set'](_0xdca3('0x1c'),_0x9564db+'-'+_0x40177f+'/'+_0x3b90ec)['json'](_0x1ec90c);}return null;};}function patchUpdates(_0x259a4e){return function(_0x47aaa2){try{jsonpatch[_0xdca3('0x1d')](_0x47aaa2,_0x259a4e,!![]);}catch(_0x102033){return BPromise[_0xdca3('0x1e')](_0x102033);}return _0x47aaa2[_0xdca3('0x1f')]();};}function saveUpdates(_0x1d0ffe,_0x4ecea8){return function(_0x1dceb5){if(_0x1dceb5){return _0x1dceb5['update'](_0x1d0ffe)[_0xdca3('0x20')](function(_0x5e39ae){return _0x5e39ae;});}return null;};}function removeEntity(_0x2c4fc4,_0xedc8a){return function(_0x529f91){if(_0x529f91){return _0x529f91['destroy']()['then'](function(){_0x2c4fc4['status'](0xcc)[_0xdca3('0x17')]();});}};}function handleEntityNotFound(_0x901ffd,_0xe73d92){return function(_0x5d53d1){if(!_0x5d53d1){_0x901ffd['sendStatus'](0x194);}return _0x5d53d1;};}function handleError(_0x5b2954,_0x3539c5){_0x3539c5=_0x3539c5||0x1f4;return function(_0x446161){logger[_0xdca3('0x21')](_0x446161[_0xdca3('0x22')]);if(_0x446161[_0xdca3('0x23')]){delete _0x446161['name'];}_0x5b2954[_0xdca3('0x16')](_0x3539c5)['send'](_0x446161);};}exports[_0xdca3('0x24')]=function(_0x5f271e,_0x46fc5f){var _0x2c17f4={},_0x34c4ed={},_0x49ddef={'count':0x0,'rows':[]};var _0x3a9224=_[_0xdca3('0x25')](db[_0xdca3('0x26')][_0xdca3('0x27')],function(_0x5b30a4){return{'name':_0x5b30a4[_0xdca3('0x28')],'type':_0x5b30a4[_0xdca3('0x29')][_0xdca3('0x2a')]};});_0x34c4ed[_0xdca3('0x2b')]=_[_0xdca3('0x25')](_0x3a9224,_0xdca3('0x23'));_0x34c4ed[_0xdca3('0x2c')]=_[_0xdca3('0x2d')](_0x5f271e[_0xdca3('0x2c')]);_0x34c4ed[_0xdca3('0x2e')]=_[_0xdca3('0x2f')](_0x34c4ed[_0xdca3('0x2b')],_0x34c4ed['query']);_0x2c17f4[_0xdca3('0x30')]=_[_0xdca3('0x2f')](_0x34c4ed[_0xdca3('0x2b')],qs[_0xdca3('0x31')](_0x5f271e[_0xdca3('0x2c')][_0xdca3('0x31')]));_0x2c17f4[_0xdca3('0x30')]=_0x2c17f4[_0xdca3('0x30')][_0xdca3('0x32')]?_0x2c17f4[_0xdca3('0x30')]:_0x34c4ed[_0xdca3('0x2b')];if(!_0x5f271e[_0xdca3('0x2c')]['hasOwnProperty'](_0xdca3('0x33'))){_0x2c17f4[_0xdca3('0x1b')]=qs[_0xdca3('0x1b')](_0x5f271e['query'][_0xdca3('0x1b')]);_0x2c17f4[_0xdca3('0x1a')]=qs['offset'](_0x5f271e[_0xdca3('0x2c')]['offset']);}_0x2c17f4[_0xdca3('0x34')]=qs[_0xdca3('0x35')](_0x5f271e['query']['sort']);_0x2c17f4[_0xdca3('0x36')]=qs[_0xdca3('0x2e')](_[_0xdca3('0x37')](_0x5f271e[_0xdca3('0x2c')],_0x34c4ed[_0xdca3('0x2e')]),_0x3a9224);if(_0x5f271e[_0xdca3('0x2c')][_0xdca3('0x38')]){_0x2c17f4[_0xdca3('0x36')]=_[_0xdca3('0x39')](_0x2c17f4[_0xdca3('0x36')],{'$or':_[_0xdca3('0x25')](_0x3a9224,function(_0x320397){if(_0x320397[_0xdca3('0x29')]!=='VIRTUAL'){var _0x3a32ab={};_0x3a32ab[_0x320397[_0xdca3('0x23')]]={'$like':'%'+_0x5f271e['query'][_0xdca3('0x38')]+'%'};return _0x3a32ab;}})});}_0x2c17f4=_[_0xdca3('0x39')]({},_0x2c17f4,_0x5f271e[_0xdca3('0x3a')]);var _0x16e798={'where':_0x2c17f4[_0xdca3('0x36')]};return db['VoiceCallReport']['count'](_0x16e798)['then'](function(_0x573b73){_0x49ddef[_0xdca3('0x19')]=_0x573b73;if(_0x5f271e['query'][_0xdca3('0x3b')]){_0x2c17f4[_0xdca3('0x3c')]=[{'attributes':['id',_0xdca3('0x23'),_0xdca3('0x3d'),_0xdca3('0x3e')],'model':db[_0xdca3('0x3f')],'as':'User'}];}return db[_0xdca3('0x26')]['findAll'](_0x2c17f4);})[_0xdca3('0x20')](function(_0x13b221){_0x49ddef[_0xdca3('0x40')]=_0x13b221;return _0x49ddef;})[_0xdca3('0x20')](respondWithFilteredResult(_0x46fc5f,_0x2c17f4))[_0xdca3('0x41')](handleError(_0x46fc5f,null));};exports[_0xdca3('0x42')]=function(_0xf35975,_0x3913f1){var _0x12ffe0={'raw':!![],'where':{'id':_0xf35975[_0xdca3('0x43')]['id']}},_0x23caf3={};_0x23caf3['model']=_[_0xdca3('0x2d')](db[_0xdca3('0x26')]['rawAttributes']);_0x23caf3[_0xdca3('0x2c')]=_[_0xdca3('0x2d')](_0xf35975[_0xdca3('0x2c')]);_0x23caf3['filters']=_[_0xdca3('0x2f')](_0x23caf3[_0xdca3('0x2b')],_0x23caf3[_0xdca3('0x2c')]);_0x12ffe0[_0xdca3('0x30')]=_[_0xdca3('0x2f')](_0x23caf3[_0xdca3('0x2b')],qs[_0xdca3('0x31')](_0xf35975[_0xdca3('0x2c')][_0xdca3('0x31')]));_0x12ffe0[_0xdca3('0x30')]=_0x12ffe0[_0xdca3('0x30')][_0xdca3('0x32')]?_0x12ffe0[_0xdca3('0x30')]:_0x23caf3[_0xdca3('0x2b')];if(_0xf35975[_0xdca3('0x2c')][_0xdca3('0x3b')]){_0x12ffe0[_0xdca3('0x3c')]=[{'all':!![]}];}_0x12ffe0=_[_0xdca3('0x39')]({},_0x12ffe0,_0xf35975[_0xdca3('0x3a')]);return db[_0xdca3('0x26')][_0xdca3('0x44')](_0x12ffe0)[_0xdca3('0x20')](handleEntityNotFound(_0x3913f1,null))['then'](respondWithResult(_0x3913f1,null))[_0xdca3('0x41')](handleError(_0x3913f1,null));};exports['create']=function(_0x128e60,_0x35db17){return db[_0xdca3('0x26')]['create'](_0x128e60[_0xdca3('0x45')],{})['then'](respondWithResult(_0x35db17,0xc9))[_0xdca3('0x41')](handleError(_0x35db17,null));};exports['destroy']=function(_0x974e35,_0x62ff34){return db[_0xdca3('0x26')][_0xdca3('0x44')]({'where':{'id':_0x974e35[_0xdca3('0x43')]['id']}})[_0xdca3('0x20')](handleEntityNotFound(_0x62ff34,null))[_0xdca3('0x20')](removeEntity(_0x62ff34,null))[_0xdca3('0x41')](handleError(_0x62ff34,null));};exports[_0xdca3('0x46')]=function(_0x17a089,_0x1e55b9){return db[_0xdca3('0x26')][_0xdca3('0x46')]()[_0xdca3('0x20')](respondWithResult(_0x1e55b9,null))[_0xdca3('0x41')](handleError(_0x1e55b9,null));};exports['update']=function(_0x24cf17,_0x5dded7){if(_0x24cf17[_0xdca3('0x45')]['uniqueid']){delete _0x24cf17[_0xdca3('0x45')][_0xdca3('0x47')];}return db[_0xdca3('0x26')][_0xdca3('0x44')]({'where':{'uniqueid':_0x24cf17['params']['id'],'UserId':{'$or':[null,_0x24cf17[_0xdca3('0x48')]['id']]}}})[_0xdca3('0x20')](handleEntityNotFound(_0x5dded7,null))['then'](saveUpdates(_0x24cf17[_0xdca3('0x45')],null))[_0xdca3('0x20')](respondWithResult(_0x5dded7,null))[_0xdca3('0x41')](handleError(_0x5dded7,null));}; \ No newline at end of file +var _0x6801=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','send','index','map','VoiceCallReport','rawAttributes','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','include','fullname','User','findAll','rows','show','params','keys','includeAll','find','catch','create','body','describe','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x6801,0xdd));var _0x1680=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6801[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1680('0x0'));var emlformat=require(_0x1680('0x1'));var rimraf=require(_0x1680('0x2'));var zipdir=require(_0x1680('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1680('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1680('0x5'));var util=require(_0x1680('0x6'));var path=require(_0x1680('0x7'));var sox=require(_0x1680('0x8'));var csv=require(_0x1680('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1680('0xa'));var _=require(_0x1680('0xb'));var squel=require('squel');var crypto=require(_0x1680('0xc'));var jsforce=require(_0x1680('0xd'));var deskjs=require(_0x1680('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1680('0xf'));var Papa=require(_0x1680('0x10'));var Redis=require('ioredis');var authService=require(_0x1680('0x11'));var qs=require(_0x1680('0x12'));var as=require(_0x1680('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1680('0x14'))(_0x1680('0x15'));var utils=require(_0x1680('0x16'));var config=require(_0x1680('0x17'));var licenseUtil=require(_0x1680('0x18'));var db=require(_0x1680('0x19'))['db'];function respondWithStatusCode(_0x2bdb92,_0x275a7a){_0x275a7a=_0x275a7a||0xcc;return function(_0x28f4ca){if(_0x28f4ca){return _0x2bdb92[_0x1680('0x1a')](_0x275a7a);}return _0x2bdb92[_0x1680('0x1b')](_0x275a7a)[_0x1680('0x1c')]();};}function respondWithResult(_0x5be158,_0x2e9f1b){_0x2e9f1b=_0x2e9f1b||0xc8;return function(_0x18cdfb){if(_0x18cdfb){return _0x5be158['status'](_0x2e9f1b)[_0x1680('0x1d')](_0x18cdfb);}};}function respondWithFilteredResult(_0x4d7856,_0x209f58){return function(_0x27a45f){if(_0x27a45f){var _0xcd7ce4=_0x27a45f[_0x1680('0x1e')],_0x1f1a37=_0x209f58['offset'],_0x7761ca=_0x209f58['offset']+_0x209f58[_0x1680('0x1f')],_0x4a9786;if(_0x7761ca>=_0xcd7ce4){_0x7761ca=_0xcd7ce4;_0x4a9786=0xc8;}else{_0x4a9786=0xce;}_0x4d7856['status'](_0x4a9786);return _0x4d7856['set'](_0x1680('0x20'),_0x1f1a37+'-'+_0x7761ca+'/'+_0xcd7ce4)[_0x1680('0x1d')](_0x27a45f);}return null;};}function patchUpdates(_0x33d794){return function(_0x36b904){try{jsonpatch[_0x1680('0x21')](_0x36b904,_0x33d794,!![]);}catch(_0x5d1b74){return BPromise[_0x1680('0x22')](_0x5d1b74);}return _0x36b904[_0x1680('0x23')]();};}function saveUpdates(_0xec92be,_0x50d8e4){return function(_0x4d3c6a){if(_0x4d3c6a){return _0x4d3c6a[_0x1680('0x24')](_0xec92be)[_0x1680('0x25')](function(_0x28b670){return _0x28b670;});}return null;};}function removeEntity(_0x28962b,_0xb5c2ec){return function(_0x33d6ce){if(_0x33d6ce){return _0x33d6ce[_0x1680('0x26')]()[_0x1680('0x25')](function(){_0x28962b[_0x1680('0x1b')](0xcc)[_0x1680('0x1c')]();});}};}function handleEntityNotFound(_0x54beeb,_0x8a0dcd){return function(_0x30e13e){if(!_0x30e13e){_0x54beeb[_0x1680('0x1a')](0x194);}return _0x30e13e;};}function handleError(_0x3f8895,_0x1a33c5){_0x1a33c5=_0x1a33c5||0x1f4;return function(_0x45297b){logger[_0x1680('0x27')](_0x45297b['stack']);if(_0x45297b['name']){delete _0x45297b['name'];}_0x3f8895[_0x1680('0x1b')](_0x1a33c5)[_0x1680('0x28')](_0x45297b);};}exports[_0x1680('0x29')]=function(_0xaa8402,_0x14b0e7){var _0x106a63={},_0x24cdf6={},_0x47dd92={'count':0x0,'rows':[]};var _0x1c7b4d=_[_0x1680('0x2a')](db[_0x1680('0x2b')][_0x1680('0x2c')],function(_0x5613a9){return{'name':_0x5613a9['fieldName'],'type':_0x5613a9[_0x1680('0x2d')][_0x1680('0x2e')]};});_0x24cdf6['model']=_[_0x1680('0x2a')](_0x1c7b4d,_0x1680('0x2f'));_0x24cdf6[_0x1680('0x30')]=_['keys'](_0xaa8402[_0x1680('0x30')]);_0x24cdf6[_0x1680('0x31')]=_[_0x1680('0x32')](_0x24cdf6[_0x1680('0x33')],_0x24cdf6[_0x1680('0x30')]);_0x106a63[_0x1680('0x34')]=_['intersection'](_0x24cdf6[_0x1680('0x33')],qs['fields'](_0xaa8402[_0x1680('0x30')][_0x1680('0x35')]));_0x106a63[_0x1680('0x34')]=_0x106a63['attributes'][_0x1680('0x36')]?_0x106a63[_0x1680('0x34')]:_0x24cdf6[_0x1680('0x33')];if(!_0xaa8402[_0x1680('0x30')][_0x1680('0x37')](_0x1680('0x38'))){_0x106a63[_0x1680('0x1f')]=qs[_0x1680('0x1f')](_0xaa8402[_0x1680('0x30')][_0x1680('0x1f')]);_0x106a63[_0x1680('0x39')]=qs['offset'](_0xaa8402[_0x1680('0x30')][_0x1680('0x39')]);}_0x106a63['order']=qs['sort'](_0xaa8402[_0x1680('0x30')][_0x1680('0x3a')]);_0x106a63[_0x1680('0x3b')]=qs['filters'](_[_0x1680('0x3c')](_0xaa8402[_0x1680('0x30')],_0x24cdf6[_0x1680('0x31')]),_0x1c7b4d);if(_0xaa8402[_0x1680('0x30')]['filter']){_0x106a63[_0x1680('0x3b')]=_['merge'](_0x106a63['where'],{'$or':_[_0x1680('0x2a')](_0x1c7b4d,function(_0x74940){if(_0x74940[_0x1680('0x2d')]!=='VIRTUAL'){var _0x2ff8b4={};_0x2ff8b4[_0x74940[_0x1680('0x2f')]]={'$like':'%'+_0xaa8402['query'][_0x1680('0x3d')]+'%'};return _0x2ff8b4;}})});}_0x106a63=_[_0x1680('0x3e')]({},_0x106a63,_0xaa8402[_0x1680('0x3f')]);var _0x290be6={'where':_0x106a63[_0x1680('0x3b')]};return db[_0x1680('0x2b')]['count'](_0x290be6)[_0x1680('0x25')](function(_0x29e9ec){_0x47dd92[_0x1680('0x1e')]=_0x29e9ec;if(_0xaa8402[_0x1680('0x30')]['includeAll']){_0x106a63[_0x1680('0x40')]=[{'attributes':['id',_0x1680('0x2f'),_0x1680('0x41'),'alias'],'model':db['User'],'as':_0x1680('0x42')}];}return db['VoiceCallReport'][_0x1680('0x43')](_0x106a63);})[_0x1680('0x25')](function(_0x5220cd){_0x47dd92[_0x1680('0x44')]=_0x5220cd;return _0x47dd92;})[_0x1680('0x25')](respondWithFilteredResult(_0x14b0e7,_0x106a63))['catch'](handleError(_0x14b0e7,null));};exports[_0x1680('0x45')]=function(_0x19fc56,_0x4b31e1){var _0x2bfb0b={'raw':!![],'where':{'id':_0x19fc56[_0x1680('0x46')]['id']}},_0x219ee6={};_0x219ee6[_0x1680('0x33')]=_[_0x1680('0x47')](db[_0x1680('0x2b')][_0x1680('0x2c')]);_0x219ee6[_0x1680('0x30')]=_['keys'](_0x19fc56[_0x1680('0x30')]);_0x219ee6['filters']=_[_0x1680('0x32')](_0x219ee6[_0x1680('0x33')],_0x219ee6[_0x1680('0x30')]);_0x2bfb0b[_0x1680('0x34')]=_[_0x1680('0x32')](_0x219ee6[_0x1680('0x33')],qs[_0x1680('0x35')](_0x19fc56[_0x1680('0x30')]['fields']));_0x2bfb0b[_0x1680('0x34')]=_0x2bfb0b[_0x1680('0x34')]['length']?_0x2bfb0b[_0x1680('0x34')]:_0x219ee6[_0x1680('0x33')];if(_0x19fc56[_0x1680('0x30')][_0x1680('0x48')]){_0x2bfb0b[_0x1680('0x40')]=[{'all':!![]}];}_0x2bfb0b=_[_0x1680('0x3e')]({},_0x2bfb0b,_0x19fc56['options']);return db[_0x1680('0x2b')][_0x1680('0x49')](_0x2bfb0b)[_0x1680('0x25')](handleEntityNotFound(_0x4b31e1,null))['then'](respondWithResult(_0x4b31e1,null))[_0x1680('0x4a')](handleError(_0x4b31e1,null));};exports[_0x1680('0x4b')]=function(_0x1164e5,_0x2c27e9){return db[_0x1680('0x2b')][_0x1680('0x4b')](_0x1164e5[_0x1680('0x4c')],{})['then'](respondWithResult(_0x2c27e9,0xc9))[_0x1680('0x4a')](handleError(_0x2c27e9,null));};exports[_0x1680('0x26')]=function(_0x110b07,_0x556a7d){return db['VoiceCallReport'][_0x1680('0x49')]({'where':{'id':_0x110b07[_0x1680('0x46')]['id']}})[_0x1680('0x25')](handleEntityNotFound(_0x556a7d,null))[_0x1680('0x25')](removeEntity(_0x556a7d,null))[_0x1680('0x4a')](handleError(_0x556a7d,null));};exports[_0x1680('0x4d')]=function(_0x57e84c,_0x9ce5cd){return db['VoiceCallReport'][_0x1680('0x4d')]()[_0x1680('0x25')](respondWithResult(_0x9ce5cd,null))['catch'](handleError(_0x9ce5cd,null));};exports[_0x1680('0x24')]=function(_0xeb85b2,_0x45c1f6){if(_0xeb85b2[_0x1680('0x4c')][_0x1680('0x4e')]){delete _0xeb85b2[_0x1680('0x4c')]['uniqueid'];}return db[_0x1680('0x2b')][_0x1680('0x49')]({'where':{'uniqueid':_0xeb85b2[_0x1680('0x46')]['id'],'UserId':{'$or':[null,_0xeb85b2[_0x1680('0x4f')]['id']]}}})[_0x1680('0x25')](handleEntityNotFound(_0x45c1f6,null))[_0x1680('0x25')](saveUpdates(_0xeb85b2[_0x1680('0x4c')],null))['then'](respondWithResult(_0x45c1f6,null))[_0x1680('0x4a')](handleError(_0x45c1f6,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4b4b5c4..b842c1d 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 _0x176c=['util','api','moment','path','VoiceCallReport','report_call'];(function(_0x113de8,_0x12aa03){var _0xd3c67a=function(_0x9a5042){while(--_0x9a5042){_0x113de8['push'](_0x113de8['shift']());}};_0xd3c67a(++_0x12aa03);}(_0x176c,0x1ec));var _0xc176=function(_0x3963e7,_0x5f2c24){_0x3963e7=_0x3963e7-0x0;var _0xcece9=_0x176c[_0x3963e7];return _0xcece9;};'use strict';var _=require('lodash');var util=require(_0xc176('0x0'));var logger=require('../../config/logger')(_0xc176('0x1'));var moment=require(_0xc176('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc176('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x2ebcaa,_0x299acf){return _0x2ebcaa['define'](_0xc176('0x4'),attributes,{'tableName':_0xc176('0x5'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ac9=['uniqueid','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','report_call'];(function(_0x885926,_0x5b2d03){var _0x3364df=function(_0x11b004){while(--_0x11b004){_0x885926['push'](_0x885926['shift']());}};_0x3364df(++_0x5b2d03);}(_0x8ac9,0x14b));var _0x98ac=function(_0x509c57,_0x9e2095){_0x509c57=_0x509c57-0x0;var _0x23e2e3=_0x8ac9[_0x509c57];return _0x23e2e3;};'use strict';var _=require('lodash');var util=require(_0x98ac('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x98ac('0x1'));var BPromise=require(_0x98ac('0x2'));var rp=require(_0x98ac('0x3'));var fs=require('fs');var path=require(_0x98ac('0x4'));var rimraf=require(_0x98ac('0x5'));var config=require(_0x98ac('0x6'));var attributes=require(_0x98ac('0x7'));module['exports']=function(_0x1653d7,_0x304af7){return _0x1653d7[_0x98ac('0x8')]('VoiceCallReport',attributes,{'tableName':_0x98ac('0x9'),'paranoid':![],'indexes':[{'fields':[_0x98ac('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index dcc70ec..a23bdf2 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 _0x2d88=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VoiceCallReport','options','where','attributes','limit','map','include','then','GetVoiceCallReport','debug','stringify','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','update','bluebird'];(function(_0x39021f,_0x550073){var _0x1b1096=function(_0x2737cc){while(--_0x2737cc){_0x39021f['push'](_0x39021f['shift']());}};_0x1b1096(++_0x550073);}(_0x2d88,0x7b));var _0x82d8=function(_0x564cae,_0x2adca6){_0x564cae=_0x564cae-0x0;var _0x2d4dfe=_0x2d88[_0x564cae];return _0x2d4dfe;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x82d8('0x0'));var rs=require(_0x82d8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82d8('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x82d8('0x3'))(_0x82d8('0x4'));var config=require('../../config/environment');var jayson=require(_0x82d8('0x5'));var client=jayson[_0x82d8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1018ae,_0x4262c6,_0x249730){return new BPromise(function(_0x48c02f,_0x1d62ac){return client['request'](_0x1018ae,_0x249730)['then'](function(_0x5db218){logger[_0x82d8('0x7')](_0x82d8('0x8'),_0x4262c6,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x4262c6,_0x82d8('0x9'),JSON['stringify'](_0x5db218));if(_0x5db218[_0x82d8('0xa')]){if(_0x5db218[_0x82d8('0xa')][_0x82d8('0xb')]===0x1f4){logger[_0x82d8('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x4262c6,_0x5db218[_0x82d8('0xa')]['message']);return _0x1d62ac(_0x5db218[_0x82d8('0xa')][_0x82d8('0xc')]);}logger[_0x82d8('0xa')](_0x82d8('0x8'),_0x4262c6,_0x5db218['error'][_0x82d8('0xc')]);return _0x48c02f(_0x5db218[_0x82d8('0xa')]['message']);}else{logger[_0x82d8('0x7')](_0x82d8('0x8'),_0x4262c6,_0x82d8('0x9'));_0x48c02f(_0x5db218[_0x82d8('0xd')][_0x82d8('0xc')]);}})[_0x82d8('0xe')](function(_0x293490){logger[_0x82d8('0xa')](_0x82d8('0x8'),_0x4262c6,_0x293490);_0x1d62ac(_0x293490);});});}exports['GetVoiceCallReport']=function(_0x2b0919){var _0x22c4f5=this;return new Promise(function(_0x1f6c16,_0xbe639b){return db[_0x82d8('0xf')]['findAll']({'raw':_0x2b0919[_0x82d8('0x10')]?_0x2b0919[_0x82d8('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x2b0919[_0x82d8('0x10')]?_0x2b0919[_0x82d8('0x10')][_0x82d8('0x11')]||null:null,'attributes':_0x2b0919[_0x82d8('0x10')]?_0x2b0919[_0x82d8('0x10')][_0x82d8('0x12')]||null:null,'limit':_0x2b0919['options']?_0x2b0919['options'][_0x82d8('0x13')]||null:null,'include':_0x2b0919[_0x82d8('0x10')]?_0x2b0919[_0x82d8('0x10')]['include']?_[_0x82d8('0x14')](_0x2b0919[_0x82d8('0x10')][_0x82d8('0x15')],function(_0xa08183){return{'model':db[_0xa08183['model']],'as':_0xa08183['as'],'attributes':_0xa08183['attributes'],'include':_0xa08183[_0x82d8('0x15')]?_[_0x82d8('0x14')](_0xa08183[_0x82d8('0x15')],function(_0x170548){return{'model':db[_0x170548['model']],'as':_0x170548['as'],'attributes':_0x170548[_0x82d8('0x12')],'include':_0x170548[_0x82d8('0x15')]?_[_0x82d8('0x14')](_0x170548[_0x82d8('0x15')],function(_0x2350f7){return{'model':db[_0x2350f7['model']],'as':_0x2350f7['as'],'attributes':_0x2350f7[_0x82d8('0x12')]};}):[]};}):[]};}):[]:[]})[_0x82d8('0x16')](function(_0x4f47fb){logger['info'](_0x82d8('0x17'),_0x2b0919);logger[_0x82d8('0x18')]('GetVoiceCallReport',_0x2b0919,JSON[_0x82d8('0x19')](_0x4f47fb));_0x1f6c16(_0x4f47fb);})[_0x82d8('0xe')](function(_0x43f36c){logger[_0x82d8('0xa')](_0x82d8('0x17'),_0x43f36c[_0x82d8('0xc')],_0x2b0919);_0xbe639b(_0x22c4f5[_0x82d8('0xa')](0x1f4,_0x43f36c[_0x82d8('0xc')]));});});};exports[_0x82d8('0x1a')]=function(_0x2f82cc){var _0x371e84=this;return new Promise(function(_0x5ed0a5,_0x519e2e){return db['VoiceCallReport']['create'](_0x2f82cc[_0x82d8('0x1b')],{'raw':_0x2f82cc[_0x82d8('0x10')]?_0x2f82cc['options'][_0x82d8('0x1c')]===undefined?!![]:![]:!![]})[_0x82d8('0x16')](function(_0xf34a87){logger['info'](_0x82d8('0x1a'),_0x2f82cc);logger[_0x82d8('0x18')](_0x82d8('0x1a'),_0x2f82cc,JSON[_0x82d8('0x19')](_0xf34a87));_0x5ed0a5(_0xf34a87);})[_0x82d8('0xe')](function(_0x19b96d){logger[_0x82d8('0xa')](_0x82d8('0x1a'),_0x19b96d[_0x82d8('0xc')],_0x2f82cc);_0x519e2e(_0x371e84[_0x82d8('0xa')](0x1f4,_0x19b96d[_0x82d8('0xc')]));});});};exports[_0x82d8('0x1d')]=function(_0x1fe2f0){var _0x40af67=this;return new Promise(function(_0x39aebb,_0x34e8c4){return db['VoiceCallReport'][_0x82d8('0x1e')](_0x1fe2f0[_0x82d8('0x1b')],{'raw':_0x1fe2f0['options']?_0x1fe2f0[_0x82d8('0x10')][_0x82d8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fe2f0[_0x82d8('0x10')]?_0x1fe2f0[_0x82d8('0x10')][_0x82d8('0x11')]||null:null,'attributes':_0x1fe2f0[_0x82d8('0x10')]?_0x1fe2f0[_0x82d8('0x10')][_0x82d8('0x12')]||null:null,'limit':_0x1fe2f0[_0x82d8('0x10')]?_0x1fe2f0['options'][_0x82d8('0x13')]||null:null})[_0x82d8('0x16')](function(_0x400d43){logger[_0x82d8('0x7')](_0x82d8('0x1d'),_0x1fe2f0);logger[_0x82d8('0x18')](_0x82d8('0x1d'),_0x1fe2f0,JSON[_0x82d8('0x19')](_0x400d43));_0x39aebb(_0x400d43);})[_0x82d8('0xe')](function(_0x191650){logger[_0x82d8('0xa')]('UpdateVoiceCallReport',_0x191650[_0x82d8('0xc')],_0x1fe2f0);_0x34e8c4(_0x40af67[_0x82d8('0xa')](0x1f4,_0x191650[_0x82d8('0xc')]));});});}; \ No newline at end of file +var _0xab62=['raw','where','limit','attributes','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options'];(function(_0x15343c,_0x37e448){var _0xc7c220=function(_0xe97e06){while(--_0xe97e06){_0x15343c['push'](_0x15343c['shift']());}};_0xc7c220(++_0x37e448);}(_0xab62,0x7e));var _0x2ab6=function(_0x1aae20,_0x462bd4){_0x1aae20=_0x1aae20-0x0;var _0x4604a1=_0xab62[_0x1aae20];return _0x4604a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ab6('0x0'));var BPromise=require(_0x2ab6('0x1'));var rs=require(_0x2ab6('0x2'));var fs=require('fs');var Redis=require(_0x2ab6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ab6('0x4'));var logger=require(_0x2ab6('0x5'))(_0x2ab6('0x6'));var config=require(_0x2ab6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2ab6('0x8')][_0x2ab6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13ce81,_0x303f73,_0x1ecccb){return new BPromise(function(_0x40fc9b,_0x58501f){return client[_0x2ab6('0xa')](_0x13ce81,_0x1ecccb)[_0x2ab6('0xb')](function(_0x44bdbe){logger[_0x2ab6('0xc')](_0x2ab6('0xd'),_0x303f73,'request\x20sent');logger[_0x2ab6('0xe')](_0x2ab6('0xf'),_0x303f73,_0x2ab6('0x10'),JSON[_0x2ab6('0x11')](_0x44bdbe));if(_0x44bdbe[_0x2ab6('0x12')]){if(_0x44bdbe[_0x2ab6('0x12')][_0x2ab6('0x13')]===0x1f4){logger[_0x2ab6('0x12')](_0x2ab6('0xd'),_0x303f73,_0x44bdbe[_0x2ab6('0x12')]['message']);return _0x58501f(_0x44bdbe['error'][_0x2ab6('0x14')]);}logger[_0x2ab6('0x12')](_0x2ab6('0xd'),_0x303f73,_0x44bdbe[_0x2ab6('0x12')][_0x2ab6('0x14')]);return _0x40fc9b(_0x44bdbe[_0x2ab6('0x12')][_0x2ab6('0x14')]);}else{logger['info'](_0x2ab6('0xd'),_0x303f73,'request\x20sent');_0x40fc9b(_0x44bdbe['result']['message']);}})[_0x2ab6('0x15')](function(_0x5778ca){logger[_0x2ab6('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x303f73,_0x5778ca);_0x58501f(_0x5778ca);});});}exports[_0x2ab6('0x16')]=function(_0x144ce3){var _0x3a9699=this;return new Promise(function(_0x18fa7f,_0x3155f4){return db[_0x2ab6('0x17')][_0x2ab6('0x18')]({'raw':_0x144ce3[_0x2ab6('0x19')]?_0x144ce3[_0x2ab6('0x19')][_0x2ab6('0x1a')]===undefined?!![]:![]:!![],'where':_0x144ce3[_0x2ab6('0x19')]?_0x144ce3[_0x2ab6('0x19')][_0x2ab6('0x1b')]||null:null,'attributes':_0x144ce3[_0x2ab6('0x19')]?_0x144ce3['options']['attributes']||null:null,'limit':_0x144ce3[_0x2ab6('0x19')]?_0x144ce3[_0x2ab6('0x19')][_0x2ab6('0x1c')]||null:null,'include':_0x144ce3[_0x2ab6('0x19')]?_0x144ce3['options']['include']?_['map'](_0x144ce3[_0x2ab6('0x19')]['include'],function(_0x19391f){return{'model':db[_0x19391f['model']],'as':_0x19391f['as'],'attributes':_0x19391f[_0x2ab6('0x1d')],'include':_0x19391f[_0x2ab6('0x1e')]?_[_0x2ab6('0x1f')](_0x19391f[_0x2ab6('0x1e')],function(_0x18bef2){return{'model':db[_0x18bef2[_0x2ab6('0x20')]],'as':_0x18bef2['as'],'attributes':_0x18bef2['attributes'],'include':_0x18bef2[_0x2ab6('0x1e')]?_['map'](_0x18bef2[_0x2ab6('0x1e')],function(_0x4b863b){return{'model':db[_0x4b863b[_0x2ab6('0x20')]],'as':_0x4b863b['as'],'attributes':_0x4b863b[_0x2ab6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25b0fb){logger[_0x2ab6('0xc')](_0x2ab6('0x16'),_0x144ce3);logger[_0x2ab6('0xe')](_0x2ab6('0x16'),_0x144ce3,JSON[_0x2ab6('0x11')](_0x25b0fb));_0x18fa7f(_0x25b0fb);})[_0x2ab6('0x15')](function(_0x358221){logger['error'](_0x2ab6('0x16'),_0x358221[_0x2ab6('0x14')],_0x144ce3);_0x3155f4(_0x3a9699[_0x2ab6('0x12')](0x1f4,_0x358221[_0x2ab6('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x5d7012){var _0x5af9d4=this;return new Promise(function(_0x24b4ca,_0x37e698){return db[_0x2ab6('0x17')][_0x2ab6('0x21')](_0x5d7012[_0x2ab6('0x22')],{'raw':_0x5d7012[_0x2ab6('0x19')]?_0x5d7012[_0x2ab6('0x19')][_0x2ab6('0x1a')]===undefined?!![]:![]:!![]})[_0x2ab6('0xb')](function(_0x1d8d1b){logger[_0x2ab6('0xc')](_0x2ab6('0x23'),_0x5d7012);logger['debug'](_0x2ab6('0x23'),_0x5d7012,JSON[_0x2ab6('0x11')](_0x1d8d1b));_0x24b4ca(_0x1d8d1b);})['catch'](function(_0x1e6039){logger[_0x2ab6('0x12')]('CreateVoiceCallReport',_0x1e6039[_0x2ab6('0x14')],_0x5d7012);_0x37e698(_0x5af9d4[_0x2ab6('0x12')](0x1f4,_0x1e6039['message']));});});};exports[_0x2ab6('0x24')]=function(_0x4ca7e9){var _0x273a19=this;return new Promise(function(_0x5fba16,_0x108118){return db[_0x2ab6('0x17')][_0x2ab6('0x25')](_0x4ca7e9[_0x2ab6('0x22')],{'raw':_0x4ca7e9[_0x2ab6('0x19')]?_0x4ca7e9['options'][_0x2ab6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ca7e9[_0x2ab6('0x19')]?_0x4ca7e9['options'][_0x2ab6('0x1b')]||null:null,'attributes':_0x4ca7e9[_0x2ab6('0x19')]?_0x4ca7e9[_0x2ab6('0x19')][_0x2ab6('0x1d')]||null:null,'limit':_0x4ca7e9['options']?_0x4ca7e9[_0x2ab6('0x19')][_0x2ab6('0x1c')]||null:null})[_0x2ab6('0xb')](function(_0x2c27c4){logger['info']('UpdateVoiceCallReport',_0x4ca7e9);logger[_0x2ab6('0xe')](_0x2ab6('0x24'),_0x4ca7e9,JSON[_0x2ab6('0x11')](_0x2c27c4));_0x5fba16(_0x2c27c4);})[_0x2ab6('0x15')](function(_0x415ed4){logger['error'](_0x2ab6('0x24'),_0x415ed4[_0x2ab6('0x14')],_0x4ca7e9);_0x108118(_0x273a19[_0x2ab6('0x12')](0x1f4,_0x415ed4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index dcb898d..dd00550 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 _0xbbee=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x44cfa4,_0x107964){var _0x4bcb51=function(_0xf768ea){while(--_0xf768ea){_0x44cfa4['push'](_0x44cfa4['shift']());}};_0x4bcb51(++_0x107964);}(_0xbbee,0x1bc));var _0xebbe=function(_0x55d9e4,_0x572cba){_0x55d9e4=_0x55d9e4-0x0;var _0x23bda9=_0xbbee[_0x55d9e4];return _0x23bda9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebbe('0x0'));var timeout=require(_0xebbe('0x1'));var express=require(_0xebbe('0x2'));var router=express[_0xebbe('0x3')]();var fs_extra=require(_0xebbe('0x4'));var auth=require(_0xebbe('0x5'));var interaction=require(_0xebbe('0x6'));var config=require(_0xebbe('0x7'));var controller=require(_0xebbe('0x8'));router[_0xebbe('0x9')]('/',auth[_0xebbe('0xa')](),controller[_0xebbe('0xb')]);router[_0xebbe('0x9')](_0xebbe('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xebbe('0xd')]);router[_0xebbe('0xe')](_0xebbe('0xc'),auth[_0xebbe('0xa')](),controller['update']);router[_0xebbe('0xf')](_0xebbe('0xc'),auth[_0xebbe('0xa')](),controller[_0xebbe('0x10')]);module[_0xebbe('0x11')]=router; \ No newline at end of file +var _0xa851=['show','post','create','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id'];(function(_0x2d6b72,_0x363b46){var _0x286f7a=function(_0x1d76b4){while(--_0x1d76b4){_0x2d6b72['push'](_0x2d6b72['shift']());}};_0x286f7a(++_0x363b46);}(_0xa851,0x16e));var _0x1a85=function(_0x1e24b1,_0x14ab30){_0x1e24b1=_0x1e24b1-0x0;var _0x212baf=_0xa851[_0x1e24b1];return _0x212baf;};'use strict';var multer=require(_0x1a85('0x0'));var util=require('util');var path=require(_0x1a85('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a85('0x2'));var router=express[_0x1a85('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1a85('0x4'));var interaction=require(_0x1a85('0x5'));var config=require(_0x1a85('0x6'));var controller=require(_0x1a85('0x7'));router[_0x1a85('0x8')]('/',auth[_0x1a85('0x9')](),controller[_0x1a85('0xa')]);router[_0x1a85('0x8')](_0x1a85('0xb'),auth[_0x1a85('0x9')](),controller[_0x1a85('0xc')]);router[_0x1a85('0xd')]('/',auth['isAuthenticated'](),controller[_0x1a85('0xe')]);router['put'](_0x1a85('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1a85('0xf')](_0x1a85('0xb'),auth['isAuthenticated'](),controller[_0x1a85('0x10')]);module[_0x1a85('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 756317b..811119f 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 _0x3697=['sequelize','exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3697,0x1c2));var _0x7369=function(_0x99e83,_0x1f8d01){_0x99e83=_0x99e83-0x0;var _0x53443c=_0x3697[_0x99e83];return _0x53443c;};'use strict';var Sequelize=require(_0x7369('0x0'));module[_0x7369('0x1')]={'name':{'type':Sequelize[_0x7369('0x2')]},'prefix':{'type':Sequelize[_0x7369('0x2')],'unique':_0x7369('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x7369('0x2')],'set':function(_0xf2ec27){this['setDataValue'](_0x7369('0x4'),_0xf2ec27?_0xf2ec27[_0x7369('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x7369('0x4'))?this[_0x7369('0x6')](_0x7369('0x4'))[_0x7369('0x7')](''):[];}},'auth':{'type':Sequelize[_0x7369('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x7369('0x2')]},'record':{'type':Sequelize[_0x7369('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7369('0x2')]},'description':{'type':Sequelize[_0x7369('0x2')]}}; \ No newline at end of file +var _0xd6aa=['join','getDataValue','BOOLEAN','exports','STRING','setDataValue','options'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xd6aa,0xff));var _0xad6a=function(_0x8dfad3,_0x49b9e9){_0x8dfad3=_0x8dfad3-0x0;var _0xd8d743=_0xd6aa[_0x8dfad3];return _0xd8d743;};'use strict';var Sequelize=require('sequelize');module[_0xad6a('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xad6a('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xad6a('0x1')],'set':function(_0x198eb6){this[_0xad6a('0x2')](_0xad6a('0x3'),_0x198eb6?_0x198eb6[_0xad6a('0x4')](''):[]);},'get':function(){return this[_0xad6a('0x5')](_0xad6a('0x3'))?this[_0xad6a('0x5')](_0xad6a('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0xad6a('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xad6a('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xad6a('0x1')]},'description':{'type':Sequelize[_0xad6a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index fe92068..b8697ca 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 _0xe51a=['offset','limit','Content-Range','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','VoiceChanSpy','count','include','findAll','rows','catch','show','params','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe51a,0x133));var _0xae51=function(_0x3fad19,_0x164e56){_0x3fad19=_0x3fad19-0x0;var _0x2bc102=_0xe51a[_0x3fad19];return _0x2bc102;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae51('0x0'));var rimraf=require(_0xae51('0x1'));var zipdir=require(_0xae51('0x2'));var jsonpatch=require(_0xae51('0x3'));var rp=require(_0xae51('0x4'));var moment=require(_0xae51('0x5'));var BPromise=require(_0xae51('0x6'));var Mustache=require(_0xae51('0x7'));var util=require('util');var path=require(_0xae51('0x8'));var sox=require(_0xae51('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae51('0xa'));var _=require(_0xae51('0xb'));var squel=require(_0xae51('0xc'));var crypto=require(_0xae51('0xd'));var jsforce=require(_0xae51('0xe'));var deskjs=require(_0xae51('0xf'));var toCsv=require(_0xae51('0x10'));var querystring=require(_0xae51('0x11'));var Papa=require(_0xae51('0x12'));var Redis=require(_0xae51('0x13'));var authService=require(_0xae51('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xae51('0x15'))(_0xae51('0x16'));var utils=require(_0xae51('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xae51('0x18'));var db=require(_0xae51('0x19'))['db'];function respondWithStatusCode(_0xed8efb,_0x95cdc8){_0x95cdc8=_0x95cdc8||0xcc;return function(_0x1c24f9){if(_0x1c24f9){return _0xed8efb[_0xae51('0x1a')](_0x95cdc8);}return _0xed8efb['status'](_0x95cdc8)['end']();};}function respondWithResult(_0x151d3e,_0x20a0d3){_0x20a0d3=_0x20a0d3||0xc8;return function(_0x1390a9){if(_0x1390a9){return _0x151d3e[_0xae51('0x1b')](_0x20a0d3)[_0xae51('0x1c')](_0x1390a9);}};}function respondWithFilteredResult(_0x137903,_0x2069c0){return function(_0x18659b){if(_0x18659b){var _0x5e1821=_0x18659b['count'],_0x362554=_0x2069c0[_0xae51('0x1d')],_0x42b810=_0x2069c0[_0xae51('0x1d')]+_0x2069c0[_0xae51('0x1e')],_0x5e4b02;if(_0x42b810>=_0x5e1821){_0x42b810=_0x5e1821;_0x5e4b02=0xc8;}else{_0x5e4b02=0xce;}_0x137903[_0xae51('0x1b')](_0x5e4b02);return _0x137903['set'](_0xae51('0x1f'),_0x362554+'-'+_0x42b810+'/'+_0x5e1821)[_0xae51('0x1c')](_0x18659b);}return null;};}function patchUpdates(_0x19a58d){return function(_0x59f185){try{jsonpatch[_0xae51('0x20')](_0x59f185,_0x19a58d,!![]);}catch(_0x3426d8){return BPromise['reject'](_0x3426d8);}return _0x59f185[_0xae51('0x21')]();};}function saveUpdates(_0xefd1ce,_0x2847ed){return function(_0x5216d9){if(_0x5216d9){return _0x5216d9[_0xae51('0x22')](_0xefd1ce)[_0xae51('0x23')](function(_0x3a5f29){return _0x3a5f29;});}return null;};}function removeEntity(_0x2f211e,_0x3fe3b3){return function(_0x5e01dc){if(_0x5e01dc){return _0x5e01dc[_0xae51('0x24')]()[_0xae51('0x23')](function(){var _0x56dbda=_0x5e01dc[_0xae51('0x25')]({'plain':!![]});var _0x3fd66d=_0xae51('0x26');return db[_0xae51('0x27')][_0xae51('0x24')]({'where':{'type':_0x3fd66d,'resourceId':_0x56dbda['id']}})[_0xae51('0x23')](function(){return _0x5e01dc;});})[_0xae51('0x23')](function(){_0x2f211e['status'](0xcc)[_0xae51('0x28')]();});}};}function handleEntityNotFound(_0x246a36,_0x5f2fe1){return function(_0x2d182a){if(!_0x2d182a){_0x246a36[_0xae51('0x1a')](0x194);}return _0x2d182a;};}function handleError(_0x1a93f0,_0x168d3f){_0x168d3f=_0x168d3f||0x1f4;return function(_0x28cb9d){logger[_0xae51('0x29')](_0x28cb9d[_0xae51('0x2a')]);if(_0x28cb9d[_0xae51('0x2b')]){delete _0x28cb9d[_0xae51('0x2b')];}_0x1a93f0['status'](_0x168d3f)[_0xae51('0x2c')](_0x28cb9d);};}exports['index']=function(_0x582863,_0x3c95fa){var _0x21ca26={},_0x38f391={},_0xd53428={'count':0x0,'rows':[]};var _0x45e3df=_[_0xae51('0x2d')](db['VoiceChanSpy'][_0xae51('0x2e')],function(_0x4a4968){return{'name':_0x4a4968['fieldName'],'type':_0x4a4968[_0xae51('0x2f')][_0xae51('0x30')]};});_0x38f391[_0xae51('0x31')]=_[_0xae51('0x2d')](_0x45e3df,_0xae51('0x2b'));_0x38f391[_0xae51('0x32')]=_[_0xae51('0x33')](_0x582863['query']);_0x38f391[_0xae51('0x34')]=_[_0xae51('0x35')](_0x38f391[_0xae51('0x31')],_0x38f391[_0xae51('0x32')]);_0x21ca26['attributes']=_[_0xae51('0x35')](_0x38f391[_0xae51('0x31')],qs[_0xae51('0x36')](_0x582863[_0xae51('0x32')]['fields']));_0x21ca26[_0xae51('0x37')]=_0x21ca26[_0xae51('0x37')][_0xae51('0x38')]?_0x21ca26[_0xae51('0x37')]:_0x38f391[_0xae51('0x31')];if(!_0x582863['query'][_0xae51('0x39')](_0xae51('0x3a'))){_0x21ca26[_0xae51('0x1e')]=qs[_0xae51('0x1e')](_0x582863['query'][_0xae51('0x1e')]);_0x21ca26[_0xae51('0x1d')]=qs['offset'](_0x582863['query'][_0xae51('0x1d')]);}_0x21ca26['order']=qs[_0xae51('0x3b')](_0x582863[_0xae51('0x32')]['sort']);_0x21ca26[_0xae51('0x3c')]=qs[_0xae51('0x34')](_[_0xae51('0x3d')](_0x582863[_0xae51('0x32')],_0x38f391[_0xae51('0x34')]),_0x45e3df);if(_0x582863['query'][_0xae51('0x3e')]){_0x21ca26[_0xae51('0x3c')]=_[_0xae51('0x3f')](_0x21ca26[_0xae51('0x3c')],{'$or':_['map'](_0x45e3df,function(_0x52eecc){if(_0x52eecc[_0xae51('0x2f')]!==_0xae51('0x40')){var _0x464b22={};_0x464b22[_0x52eecc[_0xae51('0x2b')]]={'$like':'%'+_0x582863['query'][_0xae51('0x3e')]+'%'};return _0x464b22;}})});}_0x21ca26=_[_0xae51('0x3f')]({},_0x21ca26,_0x582863['options']);var _0x4be4ca={'where':_0x21ca26[_0xae51('0x3c')]};return db[_0xae51('0x41')]['count'](_0x4be4ca)[_0xae51('0x23')](function(_0x4fb946){_0xd53428[_0xae51('0x42')]=_0x4fb946;if(_0x582863[_0xae51('0x32')]['includeAll']){_0x21ca26[_0xae51('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xae51('0x44')](_0x21ca26);})[_0xae51('0x23')](function(_0x45df98){_0xd53428[_0xae51('0x45')]=_0x45df98;return _0xd53428;})['then'](respondWithFilteredResult(_0x3c95fa,_0x21ca26))[_0xae51('0x46')](handleError(_0x3c95fa,null));};exports[_0xae51('0x47')]=function(_0x186dd9,_0x5cd821){var _0xc3c4b1={'raw':![],'where':{'id':_0x186dd9[_0xae51('0x48')]['id']}},_0x2a9eed={};_0x2a9eed[_0xae51('0x31')]=_['keys'](db[_0xae51('0x41')]['rawAttributes']);_0x2a9eed[_0xae51('0x32')]=_[_0xae51('0x33')](_0x186dd9[_0xae51('0x32')]);_0x2a9eed['filters']=_[_0xae51('0x35')](_0x2a9eed[_0xae51('0x31')],_0x2a9eed[_0xae51('0x32')]);_0xc3c4b1[_0xae51('0x37')]=_[_0xae51('0x35')](_0x2a9eed[_0xae51('0x31')],qs[_0xae51('0x36')](_0x186dd9['query'][_0xae51('0x36')]));_0xc3c4b1['attributes']=_0xc3c4b1[_0xae51('0x37')][_0xae51('0x38')]?_0xc3c4b1[_0xae51('0x37')]:_0x2a9eed['model'];if(_0x186dd9['query'][_0xae51('0x49')]){_0xc3c4b1['include']=[{'all':!![]}];}_0xc3c4b1=_['merge']({},_0xc3c4b1,_0x186dd9[_0xae51('0x4a')]);return db[_0xae51('0x41')][_0xae51('0x4b')](_0xc3c4b1)['then'](handleEntityNotFound(_0x5cd821,null))[_0xae51('0x23')](respondWithResult(_0x5cd821,null))['catch'](handleError(_0x5cd821,null));};exports[_0xae51('0x4c')]=function(_0x14fcf1,_0x188f6c){return db['VoiceChanSpy'][_0xae51('0x4c')](_0x14fcf1['body'],{})[_0xae51('0x23')](function(_0x1d6ebe){var _0x11623b=_0x14fcf1['user']['get']({'plain':!![]});if(!_0x11623b)throw new Error(_0xae51('0x4d'));if(_0x11623b[_0xae51('0x4e')]===_0xae51('0x4f')){var _0x23eaff=_0x1d6ebe['get']({'plain':!![]});var _0x5e0d0f=_0xae51('0x26');return db[_0xae51('0x50')][_0xae51('0x4b')]({'where':{'name':_0x5e0d0f,'userProfileId':_0x11623b[_0xae51('0x51')]},'raw':!![]})[_0xae51('0x23')](function(_0x43b81d){if(_0x43b81d&&_0x43b81d[_0xae51('0x52')]===0x0){return db[_0xae51('0x27')]['create']({'name':_0x23eaff['name'],'resourceId':_0x23eaff['id'],'type':_0x43b81d['name'],'sectionId':_0x43b81d['id']},{})[_0xae51('0x23')](function(){return _0x1d6ebe;});}else{return _0x1d6ebe;}})['catch'](function(_0x3dde7f){logger[_0xae51('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dde7f);throw _0x3dde7f;});}return _0x1d6ebe;})[_0xae51('0x23')](respondWithResult(_0x188f6c,0xc9))[_0xae51('0x46')](handleError(_0x188f6c,null));};exports[_0xae51('0x22')]=function(_0x533d0f,_0x2a9ad5){if(_0x533d0f[_0xae51('0x53')]['id']){delete _0x533d0f[_0xae51('0x53')]['id'];}return db[_0xae51('0x41')]['find']({'where':{'id':_0x533d0f[_0xae51('0x48')]['id']}})[_0xae51('0x23')](handleEntityNotFound(_0x2a9ad5,null))['then'](saveUpdates(_0x533d0f[_0xae51('0x53')],null))[_0xae51('0x23')](respondWithResult(_0x2a9ad5,null))[_0xae51('0x46')](handleError(_0x2a9ad5,null));};exports[_0xae51('0x24')]=function(_0x46437e,_0x5f12f8){return db['VoiceChanSpy'][_0xae51('0x4b')]({'where':{'id':_0x46437e[_0xae51('0x48')]['id']}})[_0xae51('0x23')](handleEntityNotFound(_0x5f12f8,null))[_0xae51('0x23')](removeEntity(_0x5f12f8,null))['catch'](handleError(_0x5f12f8,null));}; \ No newline at end of file +var _0xea85=['body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','then','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','rows','catch','params','fields','create'];(function(_0x4efdfd,_0x4a27df){var _0x2b413=function(_0x14a082){while(--_0x14a082){_0x4efdfd['push'](_0x4efdfd['shift']());}};_0x2b413(++_0x4a27df);}(_0xea85,0x1ea));var _0x5ea8=function(_0x2f2b74,_0x4071a1){_0x2f2b74=_0x2f2b74-0x0;var _0x42015b=_0xea85[_0x2f2b74];return _0x42015b;};'use strict';var pdf=require(_0x5ea8('0x0'));var emlformat=require(_0x5ea8('0x1'));var rimraf=require(_0x5ea8('0x2'));var zipdir=require(_0x5ea8('0x3'));var jsonpatch=require(_0x5ea8('0x4'));var rp=require('request-promise');var moment=require(_0x5ea8('0x5'));var BPromise=require(_0x5ea8('0x6'));var Mustache=require(_0x5ea8('0x7'));var util=require(_0x5ea8('0x8'));var path=require(_0x5ea8('0x9'));var sox=require(_0x5ea8('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ea8('0xb'));var _=require(_0x5ea8('0xc'));var squel=require(_0x5ea8('0xd'));var crypto=require(_0x5ea8('0xe'));var jsforce=require(_0x5ea8('0xf'));var deskjs=require(_0x5ea8('0x10'));var toCsv=require(_0x5ea8('0x11'));var querystring=require('querystring');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(_0x5ea8('0x12'));var logger=require(_0x5ea8('0x13'))(_0x5ea8('0x14'));var utils=require(_0x5ea8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5ea8('0x16'));var db=require(_0x5ea8('0x17'))['db'];function respondWithStatusCode(_0x437f8d,_0x49ec9e){_0x49ec9e=_0x49ec9e||0xcc;return function(_0x3ad790){if(_0x3ad790){return _0x437f8d[_0x5ea8('0x18')](_0x49ec9e);}return _0x437f8d['status'](_0x49ec9e)['end']();};}function respondWithResult(_0x2b8e50,_0x1b3618){_0x1b3618=_0x1b3618||0xc8;return function(_0x16e15b){if(_0x16e15b){return _0x2b8e50[_0x5ea8('0x19')](_0x1b3618)[_0x5ea8('0x1a')](_0x16e15b);}};}function respondWithFilteredResult(_0x4072cd,_0x1c165a){return function(_0x321bc3){if(_0x321bc3){var _0x42bb9c=_0x321bc3[_0x5ea8('0x1b')],_0x582fc1=_0x1c165a['offset'],_0x354dc2=_0x1c165a[_0x5ea8('0x1c')]+_0x1c165a['limit'],_0x45285f;if(_0x354dc2>=_0x42bb9c){_0x354dc2=_0x42bb9c;_0x45285f=0xc8;}else{_0x45285f=0xce;}_0x4072cd[_0x5ea8('0x19')](_0x45285f);return _0x4072cd[_0x5ea8('0x1d')]('Content-Range',_0x582fc1+'-'+_0x354dc2+'/'+_0x42bb9c)['json'](_0x321bc3);}return null;};}function patchUpdates(_0x44641a){return function(_0x5953e8){try{jsonpatch[_0x5ea8('0x1e')](_0x5953e8,_0x44641a,!![]);}catch(_0x5bffc7){return BPromise[_0x5ea8('0x1f')](_0x5bffc7);}return _0x5953e8[_0x5ea8('0x20')]();};}function saveUpdates(_0x22b266,_0x144914){return function(_0x36c019){if(_0x36c019){return _0x36c019['update'](_0x22b266)[_0x5ea8('0x21')](function(_0x1190b1){return _0x1190b1;});}return null;};}function removeEntity(_0x184b15,_0x583e5b){return function(_0x736c96){if(_0x736c96){return _0x736c96['destroy']()[_0x5ea8('0x21')](function(){var _0x39c892=_0x736c96['get']({'plain':!![]});var _0x253478=_0x5ea8('0x22');return db[_0x5ea8('0x23')]['destroy']({'where':{'type':_0x253478,'resourceId':_0x39c892['id']}})[_0x5ea8('0x21')](function(){return _0x736c96;});})['then'](function(){_0x184b15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43dfbb,_0x5b33ee){return function(_0x1b03a9){if(!_0x1b03a9){_0x43dfbb[_0x5ea8('0x18')](0x194);}return _0x1b03a9;};}function handleError(_0x3ec121,_0x3f7ec5){_0x3f7ec5=_0x3f7ec5||0x1f4;return function(_0x2678c1){logger[_0x5ea8('0x24')](_0x2678c1[_0x5ea8('0x25')]);if(_0x2678c1[_0x5ea8('0x26')]){delete _0x2678c1['name'];}_0x3ec121[_0x5ea8('0x19')](_0x3f7ec5)[_0x5ea8('0x27')](_0x2678c1);};}exports[_0x5ea8('0x28')]=function(_0x5f1ff4,_0x41f482){var _0x3c3665={},_0x414b04={},_0x27be87={'count':0x0,'rows':[]};var _0x340993=_[_0x5ea8('0x29')](db[_0x5ea8('0x2a')][_0x5ea8('0x2b')],function(_0x3379a1){return{'name':_0x3379a1[_0x5ea8('0x2c')],'type':_0x3379a1[_0x5ea8('0x2d')][_0x5ea8('0x2e')]};});_0x414b04[_0x5ea8('0x2f')]=_[_0x5ea8('0x29')](_0x340993,_0x5ea8('0x26'));_0x414b04[_0x5ea8('0x30')]=_[_0x5ea8('0x31')](_0x5f1ff4[_0x5ea8('0x30')]);_0x414b04[_0x5ea8('0x32')]=_[_0x5ea8('0x33')](_0x414b04[_0x5ea8('0x2f')],_0x414b04[_0x5ea8('0x30')]);_0x3c3665[_0x5ea8('0x34')]=_['intersection'](_0x414b04[_0x5ea8('0x2f')],qs['fields'](_0x5f1ff4['query']['fields']));_0x3c3665[_0x5ea8('0x34')]=_0x3c3665[_0x5ea8('0x34')][_0x5ea8('0x35')]?_0x3c3665['attributes']:_0x414b04['model'];if(!_0x5f1ff4['query'][_0x5ea8('0x36')](_0x5ea8('0x37'))){_0x3c3665[_0x5ea8('0x38')]=qs[_0x5ea8('0x38')](_0x5f1ff4['query']['limit']);_0x3c3665[_0x5ea8('0x1c')]=qs[_0x5ea8('0x1c')](_0x5f1ff4[_0x5ea8('0x30')][_0x5ea8('0x1c')]);}_0x3c3665[_0x5ea8('0x39')]=qs[_0x5ea8('0x3a')](_0x5f1ff4['query']['sort']);_0x3c3665['where']=qs['filters'](_['pick'](_0x5f1ff4[_0x5ea8('0x30')],_0x414b04[_0x5ea8('0x32')]),_0x340993);if(_0x5f1ff4['query'][_0x5ea8('0x3b')]){_0x3c3665[_0x5ea8('0x3c')]=_[_0x5ea8('0x3d')](_0x3c3665[_0x5ea8('0x3c')],{'$or':_[_0x5ea8('0x29')](_0x340993,function(_0x25d05f){if(_0x25d05f[_0x5ea8('0x2d')]!=='VIRTUAL'){var _0x5c1f3a={};_0x5c1f3a[_0x25d05f['name']]={'$like':'%'+_0x5f1ff4[_0x5ea8('0x30')]['filter']+'%'};return _0x5c1f3a;}})});}_0x3c3665=_[_0x5ea8('0x3d')]({},_0x3c3665,_0x5f1ff4[_0x5ea8('0x3e')]);var _0xb6ea7e={'where':_0x3c3665[_0x5ea8('0x3c')]};return db[_0x5ea8('0x2a')][_0x5ea8('0x1b')](_0xb6ea7e)[_0x5ea8('0x21')](function(_0x4c5bc3){_0x27be87[_0x5ea8('0x1b')]=_0x4c5bc3;if(_0x5f1ff4['query'][_0x5ea8('0x3f')]){_0x3c3665[_0x5ea8('0x40')]=[{'all':!![]}];}return db[_0x5ea8('0x2a')]['findAll'](_0x3c3665);})[_0x5ea8('0x21')](function(_0x4c794d){_0x27be87[_0x5ea8('0x41')]=_0x4c794d;return _0x27be87;})[_0x5ea8('0x21')](respondWithFilteredResult(_0x41f482,_0x3c3665))[_0x5ea8('0x42')](handleError(_0x41f482,null));};exports['show']=function(_0x1ed6d3,_0x2d2b6){var _0x1bb4c1={'raw':![],'where':{'id':_0x1ed6d3[_0x5ea8('0x43')]['id']}},_0x39f01a={};_0x39f01a[_0x5ea8('0x2f')]=_['keys'](db[_0x5ea8('0x2a')][_0x5ea8('0x2b')]);_0x39f01a[_0x5ea8('0x30')]=_['keys'](_0x1ed6d3['query']);_0x39f01a[_0x5ea8('0x32')]=_[_0x5ea8('0x33')](_0x39f01a[_0x5ea8('0x2f')],_0x39f01a[_0x5ea8('0x30')]);_0x1bb4c1['attributes']=_[_0x5ea8('0x33')](_0x39f01a[_0x5ea8('0x2f')],qs[_0x5ea8('0x44')](_0x1ed6d3[_0x5ea8('0x30')][_0x5ea8('0x44')]));_0x1bb4c1[_0x5ea8('0x34')]=_0x1bb4c1['attributes'][_0x5ea8('0x35')]?_0x1bb4c1['attributes']:_0x39f01a[_0x5ea8('0x2f')];if(_0x1ed6d3[_0x5ea8('0x30')][_0x5ea8('0x3f')]){_0x1bb4c1[_0x5ea8('0x40')]=[{'all':!![]}];}_0x1bb4c1=_['merge']({},_0x1bb4c1,_0x1ed6d3['options']);return db[_0x5ea8('0x2a')]['find'](_0x1bb4c1)[_0x5ea8('0x21')](handleEntityNotFound(_0x2d2b6,null))[_0x5ea8('0x21')](respondWithResult(_0x2d2b6,null))[_0x5ea8('0x42')](handleError(_0x2d2b6,null));};exports[_0x5ea8('0x45')]=function(_0x102387,_0x220598){return db[_0x5ea8('0x2a')][_0x5ea8('0x45')](_0x102387[_0x5ea8('0x46')],{})['then'](function(_0x47ac77){var _0x50b601=_0x102387[_0x5ea8('0x47')][_0x5ea8('0x48')]({'plain':!![]});if(!_0x50b601)throw new Error(_0x5ea8('0x49'));if(_0x50b601['role']===_0x5ea8('0x47')){var _0x811c8a=_0x47ac77[_0x5ea8('0x48')]({'plain':!![]});var _0xf04df1=_0x5ea8('0x22');return db[_0x5ea8('0x4a')]['find']({'where':{'name':_0xf04df1,'userProfileId':_0x50b601[_0x5ea8('0x4b')]},'raw':!![]})[_0x5ea8('0x21')](function(_0xe2d91a){if(_0xe2d91a&&_0xe2d91a[_0x5ea8('0x4c')]===0x0){return db[_0x5ea8('0x23')]['create']({'name':_0x811c8a[_0x5ea8('0x26')],'resourceId':_0x811c8a['id'],'type':_0xe2d91a['name'],'sectionId':_0xe2d91a['id']},{})[_0x5ea8('0x21')](function(){return _0x47ac77;});}else{return _0x47ac77;}})[_0x5ea8('0x42')](function(_0x26c8ff){logger[_0x5ea8('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26c8ff);throw _0x26c8ff;});}return _0x47ac77;})['then'](respondWithResult(_0x220598,0xc9))['catch'](handleError(_0x220598,null));};exports[_0x5ea8('0x4d')]=function(_0x5bc2f4,_0x31c6b9){if(_0x5bc2f4[_0x5ea8('0x46')]['id']){delete _0x5bc2f4[_0x5ea8('0x46')]['id'];}return db[_0x5ea8('0x2a')][_0x5ea8('0x4e')]({'where':{'id':_0x5bc2f4['params']['id']}})[_0x5ea8('0x21')](handleEntityNotFound(_0x31c6b9,null))[_0x5ea8('0x21')](saveUpdates(_0x5bc2f4[_0x5ea8('0x46')],null))[_0x5ea8('0x21')](respondWithResult(_0x31c6b9,null))[_0x5ea8('0x42')](handleError(_0x31c6b9,null));};exports[_0x5ea8('0x4f')]=function(_0x3930cc,_0x52f2ba){return db[_0x5ea8('0x2a')]['find']({'where':{'id':_0x3930cc[_0x5ea8('0x43')]['id']}})[_0x5ea8('0x21')](handleEntityNotFound(_0x52f2ba,null))[_0x5ea8('0x21')](removeEntity(_0x52f2ba,null))['catch'](handleError(_0x52f2ba,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f3a1f0f..88fe746 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 _0xc1fa=['name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','push','Set','format','CDR(type)=%s','chanspy','merge','MixMonitor','recordingFormat','password','ChanSpy','SIP/%s,%s'];(function(_0x189a72,_0x4ac342){var _0x2b457a=function(_0x151b57){while(--_0x151b57){_0x189a72['push'](_0x189a72['shift']());}};_0x2b457a(++_0x4ac342);}(_0xc1fa,0xe5));var _0xac1f=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xc1fa[_0x35fabd];return _0x61a8ee;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xac1f('0x0'));var attributes=require(_0xac1f('0x1'));var getUserApplications=function(_0x21ad52,_0x53bacc,_0x1eb97d){var _0x490d6d=0x1;var _0x46a4de=[];var _0x2c51bb={'context':_0x53bacc['context']||_0xac1f('0x2'),'exten':util['format'](_0xac1f('0x3'),_0x21ad52[_0xac1f('0x4')],_0x1eb97d),'type':'system','isApp':![],'ChanSpyId':_0x21ad52['id'],'UserId':_0x53bacc['id']};_0x46a4de[_0xac1f('0x5')](_['merge']({'app':_0xac1f('0x6'),'appdata':util[_0xac1f('0x7')](_0xac1f('0x8'),_0xac1f('0x9')),'priority':_0x490d6d++},_0x2c51bb));if(_0x21ad52['record']){_0x46a4de[_0xac1f('0x5')](_[_0xac1f('0xa')]({'app':_0xac1f('0xb'),'appdata':util[_0xac1f('0x7')]('${UNIQUEID}.%s,a',_0x21ad52[_0xac1f('0xc')]),'priority':_0x490d6d++},_0x2c51bb));}if(_0x21ad52['auth']){_0x46a4de[_0xac1f('0x5')](_[_0xac1f('0xa')]({'app':'Authenticate','appdata':_0x21ad52[_0xac1f('0xd')],'priority':_0x490d6d++},_0x2c51bb));}_0x46a4de[_0xac1f('0x5')](_['merge']({'app':_0xac1f('0xe'),'appdata':util[_0xac1f('0x7')](_0xac1f('0xf'),_0x53bacc[_0xac1f('0x10')],_0x21ad52[_0xac1f('0x11')]?_0x21ad52[_0xac1f('0x11')][_0xac1f('0x12')](''):''),'priority':_0x490d6d++},_0x2c51bb));if(_0x21ad52[_0xac1f('0x13')]){_0x46a4de[_0xac1f('0x5')](_['merge']({'app':_0xac1f('0x14'),'priority':_0x490d6d++},_0x2c51bb));}return _0x46a4de;};var getChanSpyApplications=function(_0x5d39bf,_0x2ea5b3){var _0x28f7a0=[];for(var _0x3146b8=0x0,_0x3cfb5d=0x1;_0x3146b8<_0x2ea5b3[_0xac1f('0x15')];_0x3146b8++,_0x3cfb5d=0x1){_0x28f7a0=_0x28f7a0[_0xac1f('0x16')](getUserApplications(_0x5d39bf,_0x2ea5b3[_0x3146b8],_0x2ea5b3[_0x3146b8][_0xac1f('0x17')]));if(_0x2ea5b3[_0x3146b8][_0xac1f('0x17')]!=_0x2ea5b3[_0x3146b8][_0xac1f('0x10')]){_0x28f7a0=_0x28f7a0['concat'](getUserApplications(_0x5d39bf,_0x2ea5b3[_0x3146b8],_0x2ea5b3[_0x3146b8]['name']));}}return _0x28f7a0;};var getChanSpyPromise=function(_0x2894e2,_0x3ea6fe){return new BPromise(function(_0x3c376a,_0xd7496){return _0x2894e2[_0xac1f('0x18')][_0xac1f('0x19')]({'attributes':['id',_0xac1f('0x10'),_0xac1f('0x17')],'where':{'role':_0xac1f('0x1a'),'chanspy':!![]},'raw':!![]})[_0xac1f('0x1b')](function(_0x5940d4){if(_0x5940d4){return _0x3c376a(getChanSpyApplications(_0x3ea6fe,_0x5940d4));}return _0x3c376a([]);})[_0xac1f('0x1c')](function(_0x151ba3){_0xd7496(_0x151ba3);});});};module['exports']=function(_0x25b16c,_0x414871){var _0x17339e=_0x25b16c['models'];return _0x25b16c[_0xac1f('0x1d')](_0xac1f('0x1e'),attributes,{'tableName':_0xac1f('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x13081e,_0x33b906,_0x47b630){return getChanSpyPromise(_0x17339e,_0x13081e)[_0xac1f('0x1b')](function(_0x1f60ab){if(_0x1f60ab&&_0x1f60ab[_0xac1f('0x15')]){return _0x17339e[_0xac1f('0x20')]['bulkCreate'](_0x1f60ab);}})['then'](function(){_0x47b630();})[_0xac1f('0x1c')](function(_0xcce02d){_0x47b630(_0xcce02d);});},'afterUpdate':function(_0x2e0420,_0x3bd36c,_0x2b491d){return _0x17339e[_0xac1f('0x20')][_0xac1f('0x21')]({'where':{'ChanSpyId':_0x2e0420['id']}})[_0xac1f('0x1b')](function(){return getChanSpyPromise(_0x17339e,_0x2e0420);})[_0xac1f('0x1b')](function(_0x5678d7){if(_0x5678d7&&_0x5678d7[_0xac1f('0x15')]){return _0x17339e[_0xac1f('0x20')][_0xac1f('0x22')](_0x5678d7);}})[_0xac1f('0x1b')](function(){_0x2b491d();})[_0xac1f('0x1c')](function(_0x9fc682){_0x2b491d(_0x9fc682);});},'afterDestroy':function(_0x2e5c1d,_0xaea3c4,_0x2fc4aa){return _0x17339e[_0xac1f('0x20')][_0xac1f('0x21')]({'where':{'ChanSpyId':_0x2e5c1d['id']}})[_0xac1f('0x1b')](function(){_0x2fc4aa();})[_0xac1f('0x1c')](function(_0x28991f){_0x2fc4aa(_0x28991f);});}}});}; \ No newline at end of file +var _0x5c9c=['merge','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','auth','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','push','CDR(type)=%s','record'];(function(_0x15563e,_0x1357f7){var _0x1150c3=function(_0x1383c9){while(--_0x1383c9){_0x15563e['push'](_0x15563e['shift']());}};_0x1150c3(++_0x1357f7);}(_0x5c9c,0x1d1));var _0xc5c9=function(_0x9ead9f,_0x5b5e47){_0x9ead9f=_0x9ead9f-0x0;var _0x3358a1=_0x5c9c[_0x9ead9f];return _0x3358a1;};'use strict';var _=require(_0xc5c9('0x0'));var util=require(_0xc5c9('0x1'));var BPromise=require(_0xc5c9('0x2'));var attributes=require(_0xc5c9('0x3'));var getUserApplications=function(_0x24fc2c,_0x543896,_0x1d3ab9){var _0x1decca=0x1;var _0x3476e4=[];var _0x3c8342={'context':_0x543896[_0xc5c9('0x4')]||_0xc5c9('0x5'),'exten':util['format'](_0xc5c9('0x6'),_0x24fc2c[_0xc5c9('0x7')],_0x1d3ab9),'type':'system','isApp':![],'ChanSpyId':_0x24fc2c['id'],'UserId':_0x543896['id']};_0x3476e4[_0xc5c9('0x8')](_['merge']({'app':'Set','appdata':util['format'](_0xc5c9('0x9'),'chanspy'),'priority':_0x1decca++},_0x3c8342));if(_0x24fc2c[_0xc5c9('0xa')]){_0x3476e4[_0xc5c9('0x8')](_[_0xc5c9('0xb')]({'app':_0xc5c9('0xc'),'appdata':util[_0xc5c9('0xd')](_0xc5c9('0xe'),_0x24fc2c[_0xc5c9('0xf')]),'priority':_0x1decca++},_0x3c8342));}if(_0x24fc2c[_0xc5c9('0x10')]){_0x3476e4[_0xc5c9('0x8')](_['merge']({'app':'Authenticate','appdata':_0x24fc2c['password'],'priority':_0x1decca++},_0x3c8342));}_0x3476e4[_0xc5c9('0x8')](_[_0xc5c9('0xb')]({'app':_0xc5c9('0x11'),'appdata':util['format'](_0xc5c9('0x12'),_0x543896[_0xc5c9('0x13')],_0x24fc2c[_0xc5c9('0x14')]?_0x24fc2c[_0xc5c9('0x14')]['join'](''):''),'priority':_0x1decca++},_0x3c8342));if(_0x24fc2c[_0xc5c9('0xa')]){_0x3476e4['push'](_[_0xc5c9('0xb')]({'app':_0xc5c9('0x15'),'priority':_0x1decca++},_0x3c8342));}return _0x3476e4;};var getChanSpyApplications=function(_0x4fdf32,_0x35c701){var _0x70a450=[];for(var _0x162e58=0x0,_0x125215=0x1;_0x162e58<_0x35c701['length'];_0x162e58++,_0x125215=0x1){_0x70a450=_0x70a450[_0xc5c9('0x16')](getUserApplications(_0x4fdf32,_0x35c701[_0x162e58],_0x35c701[_0x162e58][_0xc5c9('0x17')]));if(_0x35c701[_0x162e58]['internal']!=_0x35c701[_0x162e58][_0xc5c9('0x13')]){_0x70a450=_0x70a450[_0xc5c9('0x16')](getUserApplications(_0x4fdf32,_0x35c701[_0x162e58],_0x35c701[_0x162e58][_0xc5c9('0x13')]));}}return _0x70a450;};var getChanSpyPromise=function(_0x2d2668,_0x38f18e){return new BPromise(function(_0x4e2f42,_0x1968d5){return _0x2d2668[_0xc5c9('0x18')][_0xc5c9('0x19')]({'attributes':['id',_0xc5c9('0x13'),_0xc5c9('0x17')],'where':{'role':_0xc5c9('0x1a'),'chanspy':!![]},'raw':!![]})[_0xc5c9('0x1b')](function(_0x1e90fe){if(_0x1e90fe){return _0x4e2f42(getChanSpyApplications(_0x38f18e,_0x1e90fe));}return _0x4e2f42([]);})[_0xc5c9('0x1c')](function(_0x381e61){_0x1968d5(_0x381e61);});});};module['exports']=function(_0x55717f,_0xa87e9){var _0xa82302=_0x55717f[_0xc5c9('0x1d')];return _0x55717f['define'](_0xc5c9('0x1e'),attributes,{'tableName':_0xc5c9('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d9d91,_0x263922,_0x41cc1e){return getChanSpyPromise(_0xa82302,_0x3d9d91)[_0xc5c9('0x1b')](function(_0x596453){if(_0x596453&&_0x596453[_0xc5c9('0x20')]){return _0xa82302['VoiceExtension']['bulkCreate'](_0x596453);}})[_0xc5c9('0x1b')](function(){_0x41cc1e();})[_0xc5c9('0x1c')](function(_0x3c01bd){_0x41cc1e(_0x3c01bd);});},'afterUpdate':function(_0x7eb72d,_0x59ff53,_0x294ff5){return _0xa82302[_0xc5c9('0x21')]['destroy']({'where':{'ChanSpyId':_0x7eb72d['id']}})['then'](function(){return getChanSpyPromise(_0xa82302,_0x7eb72d);})[_0xc5c9('0x1b')](function(_0x51ef49){if(_0x51ef49&&_0x51ef49[_0xc5c9('0x20')]){return _0xa82302[_0xc5c9('0x21')]['bulkCreate'](_0x51ef49);}})[_0xc5c9('0x1b')](function(){_0x294ff5();})['catch'](function(_0x4d53a5){_0x294ff5(_0x4d53a5);});},'afterDestroy':function(_0x1c2869,_0x72f3c1,_0x139c48){return _0xa82302[_0xc5c9('0x21')]['destroy']({'where':{'ChanSpyId':_0x1c2869['id']}})[_0xc5c9('0x1b')](function(){_0x139c48();})[_0xc5c9('0x1c')](function(_0x40551f){_0x139c48(_0x40551f);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f7a784d..1965818 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 _0xe797=['request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18d0c8,_0x134428){var _0x369bf0=function(_0x1fe01f){while(--_0x1fe01f){_0x18d0c8['push'](_0x18d0c8['shift']());}};_0x369bf0(++_0x134428);}(_0xe797,0x199));var _0x7e79=function(_0x4ec16b,_0x1946c8){_0x4ec16b=_0x4ec16b-0x0;var _0x432a1c=_0xe797[_0x4ec16b];return _0x432a1c;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var moment=require('moment');var BPromise=require(_0x7e79('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e79('0x3'));var db=require(_0x7e79('0x4'))['db'];var utils=require(_0x7e79('0x5'));var logger=require(_0x7e79('0x6'))(_0x7e79('0x7'));var config=require(_0x7e79('0x8'));var jayson=require(_0x7e79('0x9'));var client=jayson[_0x7e79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f493b,_0x55d082,_0x5a6f62){return new BPromise(function(_0x3f5b37,_0x289968){return client[_0x7e79('0xb')](_0x2f493b,_0x5a6f62)[_0x7e79('0xc')](function(_0x4c4186){logger[_0x7e79('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x55d082,'request\x20sent');logger[_0x7e79('0xe')](_0x7e79('0xf'),_0x55d082,'request\x20sent',JSON[_0x7e79('0x10')](_0x4c4186));if(_0x4c4186[_0x7e79('0x11')]){if(_0x4c4186[_0x7e79('0x11')]['code']===0x1f4){logger[_0x7e79('0x11')](_0x7e79('0x12'),_0x55d082,_0x4c4186[_0x7e79('0x11')][_0x7e79('0x13')]);return _0x289968(_0x4c4186[_0x7e79('0x11')]['message']);}logger['error'](_0x7e79('0x12'),_0x55d082,_0x4c4186['error'][_0x7e79('0x13')]);return _0x3f5b37(_0x4c4186[_0x7e79('0x11')][_0x7e79('0x13')]);}else{logger[_0x7e79('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x55d082,'request\x20sent');_0x3f5b37(_0x4c4186['result']['message']);}})[_0x7e79('0x14')](function(_0x3c47d5){logger[_0x7e79('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x55d082,_0x3c47d5);_0x289968(_0x3c47d5);});});} \ No newline at end of file +var _0xa730=['../../config/utils','rpc','../../config/environment','jayson/promise','then','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','info','result','catch','util','randomstring'];(function(_0x53faa8,_0x5f53bf){var _0x433942=function(_0x32126b){while(--_0x32126b){_0x53faa8['push'](_0x53faa8['shift']());}};_0x433942(++_0x5f53bf);}(_0xa730,0x14e));var _0x0a73=function(_0x5317e2,_0x3df6c5){_0x5317e2=_0x5317e2-0x0;var _0x2ac5d7=_0xa730[_0x5317e2];return _0x2ac5d7;};'use strict';var _=require('lodash');var util=require(_0x0a73('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a73('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a73('0x2'));var logger=require('../../config/logger')(_0x0a73('0x3'));var config=require(_0x0a73('0x4'));var jayson=require(_0x0a73('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30e3e9,_0x5e23d3,_0x2c5143){return new BPromise(function(_0x6cb7cf,_0x21afc3){return client['request'](_0x30e3e9,_0x2c5143)[_0x0a73('0x6')](function(_0x23daac){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x5e23d3,_0x0a73('0x7'));logger['debug'](_0x0a73('0x8'),_0x5e23d3,'request\x20sent',JSON[_0x0a73('0x9')](_0x23daac));if(_0x23daac[_0x0a73('0xa')]){if(_0x23daac[_0x0a73('0xa')]['code']===0x1f4){logger[_0x0a73('0xa')](_0x0a73('0xb'),_0x5e23d3,_0x23daac[_0x0a73('0xa')]['message']);return _0x21afc3(_0x23daac[_0x0a73('0xa')][_0x0a73('0xc')]);}logger[_0x0a73('0xa')](_0x0a73('0xb'),_0x5e23d3,_0x23daac['error']['message']);return _0x6cb7cf(_0x23daac['error']['message']);}else{logger[_0x0a73('0xd')](_0x0a73('0xb'),_0x5e23d3,_0x0a73('0x7'));_0x6cb7cf(_0x23daac[_0x0a73('0xe')][_0x0a73('0xc')]);}})[_0x0a73('0xf')](function(_0x3628aa){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x5e23d3,_0x3628aa);_0x21afc3(_0x3628aa);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 213d536..b5eccbf 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 _0x2029=['isAuthenticated','index','show','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0x2a39a7,_0x5661c2){var _0x54d907=function(_0x155cbc){while(--_0x155cbc){_0x2a39a7['push'](_0x2a39a7['shift']());}};_0x54d907(++_0x5661c2);}(_0x2029,0x171));var _0x9202=function(_0x1b1ea7,_0x3a931d){_0x1b1ea7=_0x1b1ea7-0x0;var _0x37c7bd=_0x2029[_0x1b1ea7];return _0x37c7bd;};'use strict';var multer=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var path=require('path');var timeout=require(_0x9202('0x2'));var express=require(_0x9202('0x3'));var router=express[_0x9202('0x4')]();var fs_extra=require(_0x9202('0x5'));var auth=require(_0x9202('0x6'));var interaction=require(_0x9202('0x7'));var config=require(_0x9202('0x8'));var controller=require(_0x9202('0x9'));router[_0x9202('0xa')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0xc')]);router[_0x9202('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9202('0xd')]);router['post']('/',auth[_0x9202('0xb')](),controller[_0x9202('0xe')]);router['put'](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x10')]);router[_0x9202('0x11')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x12')]);module[_0x9202('0x13')]=router; \ No newline at end of file +var _0x34b2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','post','/:id'];(function(_0x473072,_0xfc9baa){var _0x4b07db=function(_0xa9b06e){while(--_0xa9b06e){_0x473072['push'](_0x473072['shift']());}};_0x4b07db(++_0xfc9baa);}(_0x34b2,0x11c));var _0x234b=function(_0x5a64eb,_0x286782){_0x5a64eb=_0x5a64eb-0x0;var _0x3ad930=_0x34b2[_0x5a64eb];return _0x3ad930;};'use strict';var multer=require(_0x234b('0x0'));var util=require(_0x234b('0x1'));var path=require(_0x234b('0x2'));var timeout=require(_0x234b('0x3'));var express=require(_0x234b('0x4'));var router=express[_0x234b('0x5')]();var fs_extra=require(_0x234b('0x6'));var auth=require(_0x234b('0x7'));var interaction=require(_0x234b('0x8'));var config=require(_0x234b('0x9'));var controller=require(_0x234b('0xa'));router[_0x234b('0xb')]('/',auth[_0x234b('0xc')](),controller['index']);router['get']('/:id',auth[_0x234b('0xc')](),controller[_0x234b('0xd')]);router[_0x234b('0xe')]('/',auth[_0x234b('0xc')](),controller['create']);router['put'](_0x234b('0xf'),auth[_0x234b('0xc')](),controller[_0x234b('0x10')]);router[_0x234b('0x11')](_0x234b('0xf'),auth[_0x234b('0xc')](),controller[_0x234b('0x12')]);module[_0x234b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a61f2ee..cb1c397 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x35cf28,_0x429f70){var _0x44e8b5=function(_0x362573){while(--_0x362573){_0x35cf28['push'](_0x35cf28['shift']());}};_0x44e8b5(++_0x429f70);}(_0xe14b,0x93));var _0xbe14=function(_0x1a5dfa,_0x50cc0a){_0x1a5dfa=_0x1a5dfa-0x0;var _0x2a6e30=_0xe14b[_0x1a5dfa];return _0x2a6e30;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x9ad1c0,_0x5d2fa7){var _0x388d3b=function(_0x333c9a){while(--_0x333c9a){_0x9ad1c0['push'](_0x9ad1c0['shift']());}};_0x388d3b(++_0x5d2fa7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index a87039b..d5534ab 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 _0xe9f2=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','sendStatus','stack','send','map','VoiceContext','rawAttributes','key','name','query','filters','model','intersection','fields','attributes','order','sort','where','filter','merge','options','findAll','catch','show','params','keys','length','includeAll','include','find','create','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','status','end'];(function(_0x4166cd,_0x498a77){var _0x56bf27=function(_0x599291){while(--_0x599291){_0x4166cd['push'](_0x4166cd['shift']());}};_0x56bf27(++_0x498a77);}(_0xe9f2,0x10f));var _0x2e9f=function(_0x40254d,_0x49e43e){_0x40254d=_0x40254d-0x0;var _0x218d53=_0xe9f2[_0x40254d];return _0x218d53;};'use strict';var pdf=require(_0x2e9f('0x0'));var emlformat=require(_0x2e9f('0x1'));var rimraf=require(_0x2e9f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e9f('0x3'));var rp=require(_0x2e9f('0x4'));var moment=require(_0x2e9f('0x5'));var BPromise=require(_0x2e9f('0x6'));var Mustache=require(_0x2e9f('0x7'));var util=require(_0x2e9f('0x8'));var path=require(_0x2e9f('0x9'));var sox=require(_0x2e9f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e9f('0xb'));var _=require('lodash');var squel=require(_0x2e9f('0xc'));var crypto=require(_0x2e9f('0xd'));var jsforce=require(_0x2e9f('0xe'));var deskjs=require(_0x2e9f('0xf'));var toCsv=require(_0x2e9f('0x10'));var querystring=require(_0x2e9f('0x11'));var Papa=require(_0x2e9f('0x12'));var Redis=require(_0x2e9f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2e9f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e9f('0x15'));var logger=require(_0x2e9f('0x16'))(_0x2e9f('0x17'));var utils=require(_0x2e9f('0x18'));var config=require(_0x2e9f('0x19'));var licenseUtil=require(_0x2e9f('0x1a'));var db=require(_0x2e9f('0x1b'))['db'];var jayson=require(_0x2e9f('0x1c'));var client=jayson[_0x2e9f('0x1d')][_0x2e9f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2e89f1,_0x3ef7cb,_0x200f2c,_0x8795dd){return new BPromise(function(_0x46a340,_0x6c2df7){var _0x1a729e=_0x8795dd||client;return _0x1a729e[_0x2e9f('0x1f')](_0x2e89f1,_0x200f2c)[_0x2e9f('0x20')](function(_0x51dfbb){logger[_0x2e9f('0x21')](_0x2e9f('0x22'),_0x3ef7cb,_0x2e9f('0x23'));logger[_0x2e9f('0x24')](_0x2e9f('0x25'),_0x3ef7cb,_0x2e9f('0x23'),JSON[_0x2e9f('0x26')](_0x51dfbb));if(_0x51dfbb['error']){if(_0x51dfbb['error'][_0x2e9f('0x27')]===0x1f4){logger[_0x2e9f('0x28')]('VoiceContext,\x20%s,\x20%s',_0x3ef7cb,_0x51dfbb[_0x2e9f('0x28')]['message']);return _0x6c2df7(_0x51dfbb[_0x2e9f('0x28')][_0x2e9f('0x29')]);}logger[_0x2e9f('0x28')](_0x2e9f('0x22'),_0x3ef7cb,_0x51dfbb[_0x2e9f('0x28')]['message']);return _0x46a340(_0x51dfbb['error']['message']);}else{logger[_0x2e9f('0x21')](_0x2e9f('0x22'),_0x3ef7cb,_0x2e9f('0x23'));_0x46a340(_0x51dfbb['result'][_0x2e9f('0x29')]);}})['catch'](function(_0x19f5c2){logger[_0x2e9f('0x28')](_0x2e9f('0x22'),_0x3ef7cb,_0x19f5c2);_0x6c2df7(_0x19f5c2);});});}function respondWithStatusCode(_0x20cda9,_0x2892af){_0x2892af=_0x2892af||0xcc;return function(_0xb0a3be){if(_0xb0a3be){return _0x20cda9['sendStatus'](_0x2892af);}return _0x20cda9[_0x2e9f('0x2a')](_0x2892af)[_0x2e9f('0x2b')]();};}function respondWithResult(_0x384070,_0x28e770){_0x28e770=_0x28e770||0xc8;return function(_0x38ee6a){if(_0x38ee6a){return _0x384070[_0x2e9f('0x2a')](_0x28e770)[_0x2e9f('0x2c')](_0x38ee6a);}};}function respondWithFilteredResult(_0x1e370d,_0x55eaee){return function(_0x5a4962){if(_0x5a4962){var _0x2a5760=_0x5a4962[_0x2e9f('0x2d')],_0x1dbbf5=_0x55eaee[_0x2e9f('0x2e')],_0x3afc8f=_0x55eaee[_0x2e9f('0x2e')]+_0x55eaee[_0x2e9f('0x2f')],_0x1f84dd;if(_0x3afc8f>=_0x2a5760){_0x3afc8f=_0x2a5760;_0x1f84dd=0xc8;}else{_0x1f84dd=0xce;}_0x1e370d[_0x2e9f('0x2a')](_0x1f84dd);return _0x1e370d[_0x2e9f('0x30')](_0x2e9f('0x31'),_0x1dbbf5+'-'+_0x3afc8f+'/'+_0x2a5760)[_0x2e9f('0x2c')](_0x5a4962);}return null;};}function patchUpdates(_0x2070f4){return function(_0x4c9646){try{jsonpatch[_0x2e9f('0x32')](_0x4c9646,_0x2070f4,!![]);}catch(_0x2943ea){return BPromise[_0x2e9f('0x33')](_0x2943ea);}return _0x4c9646[_0x2e9f('0x34')]();};}function saveUpdates(_0x346f26,_0x222272){return function(_0x41df2c){if(_0x41df2c){return _0x41df2c[_0x2e9f('0x35')](_0x346f26)[_0x2e9f('0x20')](function(_0x2f02ea){return _0x2f02ea;});}return null;};}function removeEntity(_0x261ff3,_0xad8e0e){return function(_0x4fd7e5){if(_0x4fd7e5){return _0x4fd7e5[_0x2e9f('0x36')]()[_0x2e9f('0x20')](function(){var _0x3eea91=_0x4fd7e5[_0x2e9f('0x37')]({'plain':!![]});var _0x39be5d=_0x2e9f('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x39be5d,'resourceId':_0x3eea91['id']}})['then'](function(){return _0x4fd7e5;});})[_0x2e9f('0x20')](function(){_0x261ff3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x688274,_0x167abd){return function(_0x19d81b){if(!_0x19d81b){_0x688274[_0x2e9f('0x39')](0x194);}return _0x19d81b;};}function handleError(_0x5584f6,_0x5dd461){_0x5dd461=_0x5dd461||0x1f4;return function(_0x2f49eb){logger['error'](_0x2f49eb[_0x2e9f('0x3a')]);if(_0x2f49eb['name']){delete _0x2f49eb['name'];}_0x5584f6['status'](_0x5dd461)[_0x2e9f('0x3b')](_0x2f49eb);};}exports['index']=function(_0x523192,_0x4ec35f){var _0x54c956={},_0x4d8afa={},_0x4a33f8={'count':0x0,'rows':[]};var _0x32e9f6=_[_0x2e9f('0x3c')](db[_0x2e9f('0x3d')][_0x2e9f('0x3e')],function(_0x3a2294){return{'name':_0x3a2294['fieldName'],'type':_0x3a2294['type'][_0x2e9f('0x3f')]};});_0x4d8afa['model']=_['map'](_0x32e9f6,_0x2e9f('0x40'));_0x4d8afa[_0x2e9f('0x41')]=_['keys'](_0x523192['query']);_0x4d8afa[_0x2e9f('0x42')]=_['intersection'](_0x4d8afa[_0x2e9f('0x43')],_0x4d8afa[_0x2e9f('0x41')]);_0x54c956['attributes']=_[_0x2e9f('0x44')](_0x4d8afa[_0x2e9f('0x43')],qs['fields'](_0x523192['query'][_0x2e9f('0x45')]));_0x54c956[_0x2e9f('0x46')]=_0x54c956[_0x2e9f('0x46')]['length']?_0x54c956[_0x2e9f('0x46')]:_0x4d8afa[_0x2e9f('0x43')];if(!_0x523192['query']['hasOwnProperty']('nolimit')){_0x54c956[_0x2e9f('0x2f')]=qs[_0x2e9f('0x2f')](_0x523192[_0x2e9f('0x41')][_0x2e9f('0x2f')]);_0x54c956[_0x2e9f('0x2e')]=qs['offset'](_0x523192['query'][_0x2e9f('0x2e')]);}_0x54c956[_0x2e9f('0x47')]=qs[_0x2e9f('0x48')](_0x523192[_0x2e9f('0x41')]['sort']);_0x54c956[_0x2e9f('0x49')]=qs[_0x2e9f('0x42')](_['pick'](_0x523192[_0x2e9f('0x41')],_0x4d8afa['filters']),_0x32e9f6);if(_0x523192[_0x2e9f('0x41')][_0x2e9f('0x4a')]){_0x54c956['where']=_[_0x2e9f('0x4b')](_0x54c956[_0x2e9f('0x49')],{'$or':_[_0x2e9f('0x3c')](_0x32e9f6,function(_0x3b871c){if(_0x3b871c['type']!=='VIRTUAL'){var _0x2a96a2={};_0x2a96a2[_0x3b871c[_0x2e9f('0x40')]]={'$like':'%'+_0x523192[_0x2e9f('0x41')]['filter']+'%'};return _0x2a96a2;}})});}_0x54c956=_[_0x2e9f('0x4b')]({},_0x54c956,_0x523192[_0x2e9f('0x4c')]);var _0x94f887={'where':_0x54c956[_0x2e9f('0x49')]};return db[_0x2e9f('0x3d')][_0x2e9f('0x2d')](_0x94f887)[_0x2e9f('0x20')](function(_0x249052){_0x4a33f8[_0x2e9f('0x2d')]=_0x249052;if(_0x523192['query']['includeAll']){_0x54c956['include']=[{'all':!![]}];}return db[_0x2e9f('0x3d')][_0x2e9f('0x4d')](_0x54c956);})[_0x2e9f('0x20')](function(_0x3d39b8){_0x4a33f8['rows']=_0x3d39b8;return _0x4a33f8;})['then'](respondWithFilteredResult(_0x4ec35f,_0x54c956))[_0x2e9f('0x4e')](handleError(_0x4ec35f,null));};exports[_0x2e9f('0x4f')]=function(_0x191531,_0x1994d2){var _0x17cd16={'raw':![],'where':{'id':_0x191531[_0x2e9f('0x50')]['id']}},_0x56466d={};_0x56466d[_0x2e9f('0x43')]=_[_0x2e9f('0x51')](db[_0x2e9f('0x3d')][_0x2e9f('0x3e')]);_0x56466d[_0x2e9f('0x41')]=_[_0x2e9f('0x51')](_0x191531[_0x2e9f('0x41')]);_0x56466d[_0x2e9f('0x42')]=_[_0x2e9f('0x44')](_0x56466d[_0x2e9f('0x43')],_0x56466d[_0x2e9f('0x41')]);_0x17cd16[_0x2e9f('0x46')]=_[_0x2e9f('0x44')](_0x56466d['model'],qs[_0x2e9f('0x45')](_0x191531[_0x2e9f('0x41')]['fields']));_0x17cd16['attributes']=_0x17cd16[_0x2e9f('0x46')][_0x2e9f('0x52')]?_0x17cd16['attributes']:_0x56466d['model'];if(_0x191531[_0x2e9f('0x41')][_0x2e9f('0x53')]){_0x17cd16[_0x2e9f('0x54')]=[{'all':!![]}];}_0x17cd16=_[_0x2e9f('0x4b')]({},_0x17cd16,_0x191531[_0x2e9f('0x4c')]);return db['VoiceContext'][_0x2e9f('0x55')](_0x17cd16)[_0x2e9f('0x20')](handleEntityNotFound(_0x1994d2,null))[_0x2e9f('0x20')](respondWithResult(_0x1994d2,null))[_0x2e9f('0x4e')](handleError(_0x1994d2,null));};exports[_0x2e9f('0x56')]=function(_0x1680b4,_0x4350da,_0x35aff3){var _0x41a190;return db['VoiceContext']['create'](_0x1680b4['body'],{'raw':!![]})['then'](function(_0x37daa9){_0x41a190=_0x37daa9;return db[_0x2e9f('0x3d')][_0x2e9f('0x4d')]({'raw':!![]});})[_0x2e9f('0x20')](function(_0x271c0f){var _0x456a9a=fs[_0x2e9f('0x57')](path['join'](config[_0x2e9f('0x58')],_0x2e9f('0x59')),'utf8');var _0x58ad19=ejs[_0x2e9f('0x5a')](_0x456a9a,{'contexts':_0x271c0f||[]});fs[_0x2e9f('0x5b')](_0x2e9f('0x5c'),_0x58ad19);})['then'](function(){return respondWithRpcPromise(_0x2e9f('0x5d'),_0x2e9f('0x56'),{'module':_0x2e9f('0x5e')});})[_0x2e9f('0x20')](function(){var _0x32211d=_0x1680b4[_0x2e9f('0x5f')]['get']({'plain':!![]});if(!_0x32211d)throw new Error(_0x2e9f('0x60'));if(_0x32211d[_0x2e9f('0x61')]===_0x2e9f('0x5f')){var _0x56f30c=_0x41a190['get']({'plain':!![]});return db[_0x2e9f('0x62')][_0x2e9f('0x55')]({'where':{'name':_0x2e9f('0x38'),'userProfileId':_0x32211d[_0x2e9f('0x63')]},'raw':!![]})[_0x2e9f('0x20')](function(_0x4d1159){if(_0x4d1159&&_0x4d1159[_0x2e9f('0x64')]===0x0){return db[_0x2e9f('0x65')]['create']({'name':_0x56f30c[_0x2e9f('0x40')],'resourceId':_0x56f30c['id'],'type':_0x4d1159[_0x2e9f('0x40')],'sectionId':_0x4d1159['id']},{})[_0x2e9f('0x20')](function(){return _0x41a190;});}else{return _0x41a190;}})['catch'](function(_0x581622){logger[_0x2e9f('0x28')](_0x2e9f('0x66'),_0x581622);throw _0x581622;});}return _0x41a190;})['then'](respondWithResult(_0x4350da,0xc9))['catch'](handleError(_0x4350da,null));};exports['update']=function(_0x5187aa,_0x531c6c,_0x12e220){var _0x15a68b;return db[_0x2e9f('0x3d')][_0x2e9f('0x55')]({'where':{'id':_0x5187aa[_0x2e9f('0x50')]['id']}})[_0x2e9f('0x20')](handleEntityNotFound(_0x531c6c,null))[_0x2e9f('0x20')](saveUpdates(_0x5187aa[_0x2e9f('0x67')],null))[_0x2e9f('0x20')](function(_0x421010){if(_0x421010){_0x15a68b=_0x421010;return db[_0x2e9f('0x3d')]['findAll']({'raw':!![]});}})[_0x2e9f('0x20')](function(_0x10c3c8){var _0xd448b8=fs[_0x2e9f('0x57')](path[_0x2e9f('0x68')](config['root'],_0x2e9f('0x59')),'utf8');var _0x121ae5=ejs['render'](_0xd448b8,{'contexts':_0x10c3c8||[]});fs[_0x2e9f('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x121ae5);})['then'](function(){return respondWithRpcPromise(_0x2e9f('0x5d'),_0x2e9f('0x35'),{'module':_0x2e9f('0x5e')});})['then'](function(){return _0x15a68b;})[_0x2e9f('0x20')](respondWithResult(_0x531c6c,null))[_0x2e9f('0x4e')](handleError(_0x531c6c,null));};exports[_0x2e9f('0x36')]=function(_0x2c152c,_0x1a4e8f,_0xb11c94){var _0x4d6c26;return db[_0x2e9f('0x3d')][_0x2e9f('0x55')]({'where':{'id':_0x2c152c[_0x2e9f('0x50')]['id']}})[_0x2e9f('0x20')](handleEntityNotFound(_0x1a4e8f,null))['then'](removeEntity(_0x1a4e8f,null))[_0x2e9f('0x20')](function(){return db[_0x2e9f('0x3d')][_0x2e9f('0x4d')]({'raw':!![]});})['then'](function(_0x4c2f1d){var _0x4104ea=fs[_0x2e9f('0x57')](path['join'](config[_0x2e9f('0x58')],_0x2e9f('0x59')),'utf8');var _0x1f39e9=ejs[_0x2e9f('0x5a')](_0x4104ea,{'contexts':_0x4c2f1d});fs[_0x2e9f('0x5b')](_0x2e9f('0x5c'),_0x1f39e9);return respondWithRpcPromise(_0x2e9f('0x5d'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x1a4e8f,null));}; \ No newline at end of file +var _0xe84a=['result','catch','sendStatus','status','json','offset','set','Content-Range','apply','reject','update','destroy','Contexts','UserProfileResource','end','stack','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filter','map','merge','count','includeAll','include','findAll','rows','show','params','length','options','find','create','body','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x9bb329,_0x11a820){var _0x3e7862=function(_0x40c1ef){while(--_0x40c1ef){_0x9bb329['push'](_0x9bb329['shift']());}};_0x3e7862(++_0x11a820);}(_0xe84a,0x113));var _0xae84=function(_0x496889,_0x2effba){_0x496889=_0x496889-0x0;var _0x4003d0=_0xe84a[_0x496889];return _0x4003d0;};'use strict';var pdf=require(_0xae84('0x0'));var emlformat=require(_0xae84('0x1'));var rimraf=require(_0xae84('0x2'));var zipdir=require(_0xae84('0x3'));var jsonpatch=require(_0xae84('0x4'));var rp=require(_0xae84('0x5'));var moment=require(_0xae84('0x6'));var BPromise=require(_0xae84('0x7'));var Mustache=require(_0xae84('0x8'));var util=require(_0xae84('0x9'));var path=require('path');var sox=require(_0xae84('0xa'));var csv=require('to-csv');var ejs=require(_0xae84('0xb'));var fs=require('fs');var fs_extra=require(_0xae84('0xc'));var _=require('lodash');var squel=require(_0xae84('0xd'));var crypto=require(_0xae84('0xe'));var jsforce=require(_0xae84('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xae84('0x10'));var querystring=require('querystring');var Papa=require(_0xae84('0x11'));var Redis=require('ioredis');var authService=require(_0xae84('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xae84('0x13'));var hardwareService=require(_0xae84('0x14'));var logger=require(_0xae84('0x15'))(_0xae84('0x16'));var utils=require(_0xae84('0x17'));var config=require(_0xae84('0x18'));var licenseUtil=require(_0xae84('0x19'));var db=require(_0xae84('0x1a'))['db'];var jayson=require(_0xae84('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a221c,_0x33a9b0,_0x2ae663,_0xbf82d6){return new BPromise(function(_0x506672,_0x43fd37){var _0x23cb22=_0xbf82d6||client;return _0x23cb22['request'](_0x4a221c,_0x2ae663)[_0xae84('0x1c')](function(_0x2b46b2){logger['info'](_0xae84('0x1d'),_0x33a9b0,_0xae84('0x1e'));logger[_0xae84('0x1f')](_0xae84('0x20'),_0x33a9b0,_0xae84('0x1e'),JSON['stringify'](_0x2b46b2));if(_0x2b46b2[_0xae84('0x21')]){if(_0x2b46b2[_0xae84('0x21')][_0xae84('0x22')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x33a9b0,_0x2b46b2[_0xae84('0x21')][_0xae84('0x23')]);return _0x43fd37(_0x2b46b2['error']['message']);}logger['error'](_0xae84('0x1d'),_0x33a9b0,_0x2b46b2[_0xae84('0x21')][_0xae84('0x23')]);return _0x506672(_0x2b46b2[_0xae84('0x21')]['message']);}else{logger[_0xae84('0x24')]('VoiceContext,\x20%s,\x20%s',_0x33a9b0,_0xae84('0x1e'));_0x506672(_0x2b46b2[_0xae84('0x25')][_0xae84('0x23')]);}})[_0xae84('0x26')](function(_0x10e6e0){logger[_0xae84('0x21')]('VoiceContext,\x20%s,\x20%s',_0x33a9b0,_0x10e6e0);_0x43fd37(_0x10e6e0);});});}function respondWithStatusCode(_0x4e52be,_0x557080){_0x557080=_0x557080||0xcc;return function(_0x2c39f8){if(_0x2c39f8){return _0x4e52be[_0xae84('0x27')](_0x557080);}return _0x4e52be[_0xae84('0x28')](_0x557080)['end']();};}function respondWithResult(_0x861fc1,_0x43096f){_0x43096f=_0x43096f||0xc8;return function(_0x22f85){if(_0x22f85){return _0x861fc1[_0xae84('0x28')](_0x43096f)[_0xae84('0x29')](_0x22f85);}};}function respondWithFilteredResult(_0x14c26d,_0x287ee6){return function(_0xfb85a){if(_0xfb85a){var _0x1bd8a3=_0xfb85a['count'],_0x6dd090=_0x287ee6[_0xae84('0x2a')],_0x329b33=_0x287ee6['offset']+_0x287ee6['limit'],_0x51a46f;if(_0x329b33>=_0x1bd8a3){_0x329b33=_0x1bd8a3;_0x51a46f=0xc8;}else{_0x51a46f=0xce;}_0x14c26d[_0xae84('0x28')](_0x51a46f);return _0x14c26d[_0xae84('0x2b')](_0xae84('0x2c'),_0x6dd090+'-'+_0x329b33+'/'+_0x1bd8a3)[_0xae84('0x29')](_0xfb85a);}return null;};}function patchUpdates(_0x53130a){return function(_0x3d0b62){try{jsonpatch[_0xae84('0x2d')](_0x3d0b62,_0x53130a,!![]);}catch(_0x118678){return BPromise[_0xae84('0x2e')](_0x118678);}return _0x3d0b62['save']();};}function saveUpdates(_0x43caa5,_0x405c66){return function(_0x28aaa3){if(_0x28aaa3){return _0x28aaa3[_0xae84('0x2f')](_0x43caa5)[_0xae84('0x1c')](function(_0x2160ee){return _0x2160ee;});}return null;};}function removeEntity(_0x1fd4f5,_0x5b67eb){return function(_0x45d2b1){if(_0x45d2b1){return _0x45d2b1[_0xae84('0x30')]()[_0xae84('0x1c')](function(){var _0x4c97d8=_0x45d2b1['get']({'plain':!![]});var _0x1b8afb=_0xae84('0x31');return db[_0xae84('0x32')][_0xae84('0x30')]({'where':{'type':_0x1b8afb,'resourceId':_0x4c97d8['id']}})[_0xae84('0x1c')](function(){return _0x45d2b1;});})['then'](function(){_0x1fd4f5['status'](0xcc)[_0xae84('0x33')]();});}};}function handleEntityNotFound(_0x3da16d,_0x33f7d0){return function(_0x16e15e){if(!_0x16e15e){_0x3da16d['sendStatus'](0x194);}return _0x16e15e;};}function handleError(_0x37d84d,_0x19022f){_0x19022f=_0x19022f||0x1f4;return function(_0x37166f){logger[_0xae84('0x21')](_0x37166f[_0xae84('0x34')]);if(_0x37166f[_0xae84('0x35')]){delete _0x37166f[_0xae84('0x35')];}_0x37d84d[_0xae84('0x28')](_0x19022f)[_0xae84('0x36')](_0x37166f);};}exports[_0xae84('0x37')]=function(_0x1766b4,_0x6b95ce){var _0x11f90e={},_0x1a4db7={},_0x4e1ce1={'count':0x0,'rows':[]};var _0x51ca35=_['map'](db[_0xae84('0x38')][_0xae84('0x39')],function(_0x4f9fc3){return{'name':_0x4f9fc3[_0xae84('0x3a')],'type':_0x4f9fc3[_0xae84('0x3b')][_0xae84('0x3c')]};});_0x1a4db7[_0xae84('0x3d')]=_['map'](_0x51ca35,_0xae84('0x35'));_0x1a4db7[_0xae84('0x3e')]=_[_0xae84('0x3f')](_0x1766b4['query']);_0x1a4db7[_0xae84('0x40')]=_[_0xae84('0x41')](_0x1a4db7[_0xae84('0x3d')],_0x1a4db7[_0xae84('0x3e')]);_0x11f90e['attributes']=_['intersection'](_0x1a4db7[_0xae84('0x3d')],qs[_0xae84('0x42')](_0x1766b4[_0xae84('0x3e')][_0xae84('0x42')]));_0x11f90e[_0xae84('0x43')]=_0x11f90e[_0xae84('0x43')]['length']?_0x11f90e[_0xae84('0x43')]:_0x1a4db7[_0xae84('0x3d')];if(!_0x1766b4['query'][_0xae84('0x44')]('nolimit')){_0x11f90e[_0xae84('0x45')]=qs[_0xae84('0x45')](_0x1766b4[_0xae84('0x3e')][_0xae84('0x45')]);_0x11f90e[_0xae84('0x2a')]=qs['offset'](_0x1766b4['query']['offset']);}_0x11f90e[_0xae84('0x46')]=qs[_0xae84('0x47')](_0x1766b4[_0xae84('0x3e')]['sort']);_0x11f90e[_0xae84('0x48')]=qs['filters'](_['pick'](_0x1766b4[_0xae84('0x3e')],_0x1a4db7[_0xae84('0x40')]),_0x51ca35);if(_0x1766b4['query'][_0xae84('0x49')]){_0x11f90e[_0xae84('0x48')]=_['merge'](_0x11f90e[_0xae84('0x48')],{'$or':_[_0xae84('0x4a')](_0x51ca35,function(_0xd40cdd){if(_0xd40cdd[_0xae84('0x3b')]!=='VIRTUAL'){var _0x4182c8={};_0x4182c8[_0xd40cdd[_0xae84('0x35')]]={'$like':'%'+_0x1766b4[_0xae84('0x3e')][_0xae84('0x49')]+'%'};return _0x4182c8;}})});}_0x11f90e=_[_0xae84('0x4b')]({},_0x11f90e,_0x1766b4['options']);var _0x28a2da={'where':_0x11f90e['where']};return db[_0xae84('0x38')][_0xae84('0x4c')](_0x28a2da)[_0xae84('0x1c')](function(_0x446cc7){_0x4e1ce1[_0xae84('0x4c')]=_0x446cc7;if(_0x1766b4[_0xae84('0x3e')][_0xae84('0x4d')]){_0x11f90e[_0xae84('0x4e')]=[{'all':!![]}];}return db[_0xae84('0x38')][_0xae84('0x4f')](_0x11f90e);})[_0xae84('0x1c')](function(_0x54e6ca){_0x4e1ce1[_0xae84('0x50')]=_0x54e6ca;return _0x4e1ce1;})[_0xae84('0x1c')](respondWithFilteredResult(_0x6b95ce,_0x11f90e))['catch'](handleError(_0x6b95ce,null));};exports[_0xae84('0x51')]=function(_0x12542f,_0x2f490f){var _0x307c80={'raw':![],'where':{'id':_0x12542f[_0xae84('0x52')]['id']}},_0x4db22b={};_0x4db22b['model']=_[_0xae84('0x3f')](db[_0xae84('0x38')]['rawAttributes']);_0x4db22b[_0xae84('0x3e')]=_['keys'](_0x12542f[_0xae84('0x3e')]);_0x4db22b['filters']=_['intersection'](_0x4db22b[_0xae84('0x3d')],_0x4db22b['query']);_0x307c80['attributes']=_['intersection'](_0x4db22b[_0xae84('0x3d')],qs['fields'](_0x12542f['query'][_0xae84('0x42')]));_0x307c80[_0xae84('0x43')]=_0x307c80[_0xae84('0x43')][_0xae84('0x53')]?_0x307c80[_0xae84('0x43')]:_0x4db22b['model'];if(_0x12542f['query'][_0xae84('0x4d')]){_0x307c80[_0xae84('0x4e')]=[{'all':!![]}];}_0x307c80=_[_0xae84('0x4b')]({},_0x307c80,_0x12542f[_0xae84('0x54')]);return db[_0xae84('0x38')][_0xae84('0x55')](_0x307c80)[_0xae84('0x1c')](handleEntityNotFound(_0x2f490f,null))['then'](respondWithResult(_0x2f490f,null))[_0xae84('0x26')](handleError(_0x2f490f,null));};exports[_0xae84('0x56')]=function(_0x3e39d4,_0x26d52d,_0x152fb8){var _0x87908f;return db[_0xae84('0x38')][_0xae84('0x56')](_0x3e39d4[_0xae84('0x57')],{'raw':!![]})['then'](function(_0x243799){_0x87908f=_0x243799;return db['VoiceContext'][_0xae84('0x4f')]({'raw':!![]});})['then'](function(_0x5712d8){var _0x2c18d3=fs['readFileSync'](path['join'](config['root'],_0xae84('0x58')),_0xae84('0x59'));var _0x4b2f2f=ejs[_0xae84('0x5a')](_0x2c18d3,{'contexts':_0x5712d8||[]});fs[_0xae84('0x5b')](_0xae84('0x5c'),_0x4b2f2f);})[_0xae84('0x1c')](function(){return respondWithRpcPromise(_0xae84('0x5d'),'create',{'module':_0xae84('0x5e')});})[_0xae84('0x1c')](function(){var _0x3bcd35=_0x3e39d4[_0xae84('0x5f')]['get']({'plain':!![]});if(!_0x3bcd35)throw new Error(_0xae84('0x60'));if(_0x3bcd35['role']===_0xae84('0x5f')){var _0x3fcf57=_0x87908f[_0xae84('0x61')]({'plain':!![]});return db[_0xae84('0x62')][_0xae84('0x55')]({'where':{'name':_0xae84('0x31'),'userProfileId':_0x3bcd35[_0xae84('0x63')]},'raw':!![]})['then'](function(_0x487c0a){if(_0x487c0a&&_0x487c0a[_0xae84('0x64')]===0x0){return db[_0xae84('0x32')][_0xae84('0x56')]({'name':_0x3fcf57[_0xae84('0x35')],'resourceId':_0x3fcf57['id'],'type':_0x487c0a[_0xae84('0x35')],'sectionId':_0x487c0a['id']},{})['then'](function(){return _0x87908f;});}else{return _0x87908f;}})[_0xae84('0x26')](function(_0x23a9a5){logger[_0xae84('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23a9a5);throw _0x23a9a5;});}return _0x87908f;})['then'](respondWithResult(_0x26d52d,0xc9))[_0xae84('0x26')](handleError(_0x26d52d,null));};exports[_0xae84('0x2f')]=function(_0x4a059c,_0x588f3a,_0x32d667){var _0x4eca46;return db[_0xae84('0x38')][_0xae84('0x55')]({'where':{'id':_0x4a059c[_0xae84('0x52')]['id']}})['then'](handleEntityNotFound(_0x588f3a,null))['then'](saveUpdates(_0x4a059c[_0xae84('0x57')],null))['then'](function(_0x15fdbf){if(_0x15fdbf){_0x4eca46=_0x15fdbf;return db[_0xae84('0x38')][_0xae84('0x4f')]({'raw':!![]});}})[_0xae84('0x1c')](function(_0x572bab){var _0x1c0199=fs[_0xae84('0x65')](path[_0xae84('0x66')](config[_0xae84('0x67')],_0xae84('0x58')),'utf8');var _0x2f7ca4=ejs[_0xae84('0x5a')](_0x1c0199,{'contexts':_0x572bab||[]});fs['writeFileSync'](_0xae84('0x5c'),_0x2f7ca4);})['then'](function(){return respondWithRpcPromise(_0xae84('0x5d'),'update',{'module':_0xae84('0x5e')});})[_0xae84('0x1c')](function(){return _0x4eca46;})[_0xae84('0x1c')](respondWithResult(_0x588f3a,null))['catch'](handleError(_0x588f3a,null));};exports[_0xae84('0x30')]=function(_0x1ccaf7,_0xbf2754,_0x49e59b){var _0x526e40;return db[_0xae84('0x38')][_0xae84('0x55')]({'where':{'id':_0x1ccaf7[_0xae84('0x52')]['id']}})['then'](handleEntityNotFound(_0xbf2754,null))[_0xae84('0x1c')](removeEntity(_0xbf2754,null))[_0xae84('0x1c')](function(){return db[_0xae84('0x38')][_0xae84('0x4f')]({'raw':!![]});})[_0xae84('0x1c')](function(_0x23bf69){var _0x4b1c3b=fs[_0xae84('0x65')](path[_0xae84('0x66')](config[_0xae84('0x67')],_0xae84('0x58')),'utf8');var _0x4ce20e=ejs[_0xae84('0x5a')](_0x4b1c3b,{'contexts':_0x23bf69});fs['writeFileSync'](_0xae84('0x5c'),_0x4ce20e);return respondWithRpcPromise(_0xae84('0x5d'),_0xae84('0x30'),{'module':'chan_sip.so'});})[_0xae84('0x26')](handleError(_0xbf2754,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e2f19d1..22464cd 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 _0x9401=['api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x3f0b15,_0xaed46d){var _0x594f45=function(_0x15fd1c){while(--_0x15fd1c){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x594f45(++_0xaed46d);}(_0x9401,0x131));var _0x1940=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9401[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x1940('0x0'));var util=require(_0x1940('0x1'));var logger=require(_0x1940('0x2'))(_0x1940('0x3'));var moment=require(_0x1940('0x4'));var BPromise=require(_0x1940('0x5'));var rp=require(_0x1940('0x6'));var fs=require('fs');var path=require(_0x1940('0x7'));var rimraf=require(_0x1940('0x8'));var config=require('../../config/environment');var attributes=require(_0x1940('0x9'));module[_0x1940('0xa')]=function(_0x468f3a,_0x2df64a){return _0x468f3a[_0x1940('0xb')](_0x1940('0xc'),attributes,{'tableName':_0x1940('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9408=['bluebird','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','moment'];(function(_0xc6e10d,_0x1c5d45){var _0x2c6978=function(_0x15a21f){while(--_0x15a21f){_0xc6e10d['push'](_0xc6e10d['shift']());}};_0x2c6978(++_0x1c5d45);}(_0x9408,0x158));var _0x8940=function(_0x59ae55,_0x2d1a0d){_0x59ae55=_0x59ae55-0x0;var _0xc0b26a=_0x9408[_0x59ae55];return _0xc0b26a;};'use strict';var _=require(_0x8940('0x0'));var util=require(_0x8940('0x1'));var logger=require(_0x8940('0x2'))('api');var moment=require(_0x8940('0x3'));var BPromise=require(_0x8940('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8940('0x5'));var config=require(_0x8940('0x6'));var attributes=require(_0x8940('0x7'));module[_0x8940('0x8')]=function(_0x4f5813,_0x201885){return _0x4f5813[_0x8940('0x9')](_0x8940('0xa'),attributes,{'tableName':_0x8940('0xb'),'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 5e249a0..bf9a115 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 _0x0aae=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird'];(function(_0x5a5f5e,_0x47eff4){var _0x506f4b=function(_0x10f417){while(--_0x10f417){_0x5a5f5e['push'](_0x5a5f5e['shift']());}};_0x506f4b(++_0x47eff4);}(_0x0aae,0x1e1));var _0xe0aa=function(_0x1f5776,_0x5a78ac){_0x1f5776=_0x1f5776-0x0;var _0x2abbd7=_0x0aae[_0x1f5776];return _0x2abbd7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe0aa('0x0'));var BPromise=require(_0xe0aa('0x1'));var rs=require(_0xe0aa('0x2'));var fs=require('fs');var Redis=require(_0xe0aa('0x3'));var db=require(_0xe0aa('0x4'))['db'];var utils=require(_0xe0aa('0x5'));var logger=require(_0xe0aa('0x6'))('rpc');var config=require(_0xe0aa('0x7'));var jayson=require(_0xe0aa('0x8'));var client=jayson['client'][_0xe0aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x447c29,_0x53552,_0x3c55e1){return new BPromise(function(_0xeae70a,_0x29dd08){return client[_0xe0aa('0xa')](_0x447c29,_0x3c55e1)[_0xe0aa('0xb')](function(_0x1e3565){logger['info'](_0xe0aa('0xc'),_0x53552,_0xe0aa('0xd'));logger[_0xe0aa('0xe')](_0xe0aa('0xf'),_0x53552,_0xe0aa('0xd'),JSON[_0xe0aa('0x10')](_0x1e3565));if(_0x1e3565[_0xe0aa('0x11')]){if(_0x1e3565[_0xe0aa('0x11')][_0xe0aa('0x12')]===0x1f4){logger[_0xe0aa('0x11')](_0xe0aa('0xc'),_0x53552,_0x1e3565[_0xe0aa('0x11')][_0xe0aa('0x13')]);return _0x29dd08(_0x1e3565[_0xe0aa('0x11')][_0xe0aa('0x13')]);}logger[_0xe0aa('0x11')](_0xe0aa('0xc'),_0x53552,_0x1e3565[_0xe0aa('0x11')][_0xe0aa('0x13')]);return _0xeae70a(_0x1e3565[_0xe0aa('0x11')][_0xe0aa('0x13')]);}else{logger[_0xe0aa('0x14')]('VoiceContext,\x20%s,\x20%s',_0x53552,'request\x20sent');_0xeae70a(_0x1e3565[_0xe0aa('0x15')][_0xe0aa('0x13')]);}})[_0xe0aa('0x16')](function(_0x43ecf9){logger[_0xe0aa('0x11')](_0xe0aa('0xc'),_0x53552,_0x43ecf9);_0x29dd08(_0x43ecf9);});});} \ No newline at end of file +var _0x2a8d=['result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x4fbfd9,_0x2e2b8c){var _0x49806c=function(_0x4af475){while(--_0x4af475){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x49806c(++_0x2e2b8c);}(_0x2a8d,0xce));var _0xd2a8=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0x2a8d[_0x2a390b];return _0x5df10a;};'use strict';var _=require('lodash');var util=require(_0xd2a8('0x0'));var moment=require(_0xd2a8('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2a8('0x2'));var fs=require('fs');var Redis=require(_0xd2a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd2a8('0x4'));var logger=require('../../config/logger')(_0xd2a8('0x5'));var config=require(_0xd2a8('0x6'));var jayson=require(_0xd2a8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x116edd,_0x143bf1,_0x4fb381){return new BPromise(function(_0x67609a,_0x3a86bd){return client[_0xd2a8('0x8')](_0x116edd,_0x4fb381)['then'](function(_0x5b57b5){logger[_0xd2a8('0x9')](_0xd2a8('0xa'),_0x143bf1,_0xd2a8('0xb'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x143bf1,_0xd2a8('0xb'),JSON['stringify'](_0x5b57b5));if(_0x5b57b5['error']){if(_0x5b57b5[_0xd2a8('0xc')][_0xd2a8('0xd')]===0x1f4){logger[_0xd2a8('0xc')](_0xd2a8('0xa'),_0x143bf1,_0x5b57b5[_0xd2a8('0xc')][_0xd2a8('0xe')]);return _0x3a86bd(_0x5b57b5[_0xd2a8('0xc')][_0xd2a8('0xe')]);}logger[_0xd2a8('0xc')](_0xd2a8('0xa'),_0x143bf1,_0x5b57b5[_0xd2a8('0xc')][_0xd2a8('0xe')]);return _0x67609a(_0x5b57b5['error'][_0xd2a8('0xe')]);}else{logger[_0xd2a8('0x9')]('VoiceContext,\x20%s,\x20%s',_0x143bf1,'request\x20sent');_0x67609a(_0x5b57b5[_0xd2a8('0xf')][_0xd2a8('0xe')]);}})[_0xd2a8('0x10')](function(_0x3d7fe8){logger[_0xd2a8('0xc')](_0xd2a8('0xa'),_0x143bf1,_0x3d7fe8);_0x3a86bd(_0x3d7fe8);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 71134de..bb22e1c 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 _0x0b78=['get','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','index','/describe','isAuthenticated','describe'];(function(_0x1a83c8,_0x193672){var _0x4e21f2=function(_0x2614a8){while(--_0x2614a8){_0x1a83c8['push'](_0x1a83c8['shift']());}};_0x4e21f2(++_0x193672);}(_0x0b78,0x1ad));var _0x80b7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0b78[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),auth[_0x80b7('0xa')](),controller[_0x80b7('0xb')]);router[_0x80b7('0xc')]('/:id',auth[_0x80b7('0xa')](),controller[_0x80b7('0xd')]);router[_0x80b7('0xe')]('/',auth['isAuthenticated'](),controller[_0x80b7('0xf')]);router['put'](_0x80b7('0x10'),auth[_0x80b7('0xa')](),controller[_0x80b7('0x11')]);router[_0x80b7('0x12')](_0x80b7('0x10'),auth[_0x80b7('0xa')](),controller[_0x80b7('0x13')]);module[_0x80b7('0x14')]=router; \ No newline at end of file +var _0x5636=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get'];(function(_0x2899ab,_0x2300e4){var _0x731a5d=function(_0x42a1d4){while(--_0x42a1d4){_0x2899ab['push'](_0x2899ab['shift']());}};_0x731a5d(++_0x2300e4);}(_0x5636,0x102));var _0x6563=function(_0x4e98aa,_0xd2e475){_0x4e98aa=_0x4e98aa-0x0;var _0x17b9e5=_0x5636[_0x4e98aa];return _0x17b9e5;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6563('0x10')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);module[_0x6563('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 27b4aed..9b9ebcf 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 _0x7779=['exports','INTEGER','STRING','DATE','called,connect,complete','sequelize'];(function(_0x3ac927,_0x4a1f88){var _0x2ecf88=function(_0x545b38){while(--_0x545b38){_0x3ac927['push'](_0x3ac927['shift']());}};_0x2ecf88(++_0x4a1f88);}(_0x7779,0xd1));var _0x9777=function(_0x4ed17b,_0x2b1745){_0x4ed17b=_0x4ed17b-0x0;var _0x24b248=_0x7779[_0x4ed17b];return _0x24b248;};'use strict';var Sequelize=require(_0x9777('0x0'));module[_0x9777('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x9777('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9777('0x3')]},'calleridnum':{'type':Sequelize[_0x9777('0x3')]},'calleridname':{'type':Sequelize[_0x9777('0x3')]},'connectedlinenum':{'type':Sequelize[_0x9777('0x3')]},'connectedlinename':{'type':Sequelize[_0x9777('0x3')]},'language':{'type':Sequelize[_0x9777('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9777('0x3')]},'priority':{'type':Sequelize[_0x9777('0x2')]},'uniqueid':{'type':Sequelize[_0x9777('0x3')]},'linkedid':{'type':Sequelize[_0x9777('0x3')]},'destchannel':{'type':Sequelize[_0x9777('0x3')]},'destchannelstate':{'type':Sequelize[_0x9777('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9777('0x3')]},'destcalleridname':{'type':Sequelize[_0x9777('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x9777('0x3')]},'destconnectedlinename':{'type':Sequelize[_0x9777('0x3')]},'destlanguage':{'type':Sequelize[_0x9777('0x3')]},'destaccountcode':{'type':Sequelize[_0x9777('0x3')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9777('0x3')]},'destpriority':{'type':Sequelize[_0x9777('0x2')]},'destuniqueid':{'type':Sequelize[_0x9777('0x3')]},'destlinkedid':{'type':Sequelize[_0x9777('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x9777('0x3')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9777('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0x9777('0x5')},'routeId':{'type':Sequelize[_0x9777('0x2')]},'duration':{'type':Sequelize[_0x9777('0x2')]},'holdtime':{'type':Sequelize[_0x9777('0x2')]},'billableseconds':{'type':Sequelize[_0x9777('0x2')]}}; \ No newline at end of file +var _0xa0fe=['exports','STRING','INTEGER','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa0fe,0x74));var _0xea0f=function(_0x57a6b6,_0x44d56d){_0x57a6b6=_0x57a6b6-0x0;var _0xd51c75=_0xa0fe[_0x57a6b6];return _0xd51c75;};'use strict';var Sequelize=require('sequelize');module[_0xea0f('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xea0f('0x1')]},'channelstate':{'type':Sequelize[_0xea0f('0x2')]},'channelstatedesc':{'type':Sequelize[_0xea0f('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xea0f('0x1')]},'connectedlinename':{'type':Sequelize[_0xea0f('0x1')]},'language':{'type':Sequelize[_0xea0f('0x1')]},'accountcode':{'type':Sequelize[_0xea0f('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xea0f('0x1')]},'priority':{'type':Sequelize[_0xea0f('0x2')]},'uniqueid':{'type':Sequelize[_0xea0f('0x1')]},'linkedid':{'type':Sequelize[_0xea0f('0x1')]},'destchannel':{'type':Sequelize[_0xea0f('0x1')]},'destchannelstate':{'type':Sequelize[_0xea0f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xea0f('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xea0f('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xea0f('0x1')]},'destaccountcode':{'type':Sequelize[_0xea0f('0x1')]},'destcontext':{'type':Sequelize[_0xea0f('0x1')]},'destexten':{'type':Sequelize[_0xea0f('0x1')]},'destpriority':{'type':Sequelize[_0xea0f('0x2')]},'destuniqueid':{'type':Sequelize[_0xea0f('0x1')]},'destlinkedid':{'type':Sequelize[_0xea0f('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xea0f('0x1')]},'starttime':{'type':Sequelize[_0xea0f('0x3')]},'answertime':{'type':Sequelize[_0xea0f('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xea0f('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xea0f('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 67dbd84..5e6536f 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 _0x1261=['query','filters','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','pick','merge','type','filter','VoiceDialReport','includeAll','include','findAll','catch','show','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x536ae6,_0x48ce92){var _0x31cfb0=function(_0x3a2dba){while(--_0x3a2dba){_0x536ae6['push'](_0x536ae6['shift']());}};_0x31cfb0(++_0x48ce92);}(_0x1261,0x144));var _0x1126=function(_0x3a0633,_0x120c59){_0x3a0633=_0x3a0633-0x0;var _0x58341e=_0x1261[_0x3a0633];return _0x58341e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var fs_extra=require(_0x1126('0xb'));var _=require('lodash');var squel=require(_0x1126('0xc'));var crypto=require(_0x1126('0xd'));var jsforce=require(_0x1126('0xe'));var deskjs=require(_0x1126('0xf'));var toCsv=require(_0x1126('0x10'));var querystring=require('querystring');var Papa=require(_0x1126('0x11'));var Redis=require(_0x1126('0x12'));var authService=require(_0x1126('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1126('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1126('0x15'));var utils=require('../../config/utils');var config=require(_0x1126('0x16'));var licenseUtil=require(_0x1126('0x17'));var db=require(_0x1126('0x18'))['db'];function respondWithStatusCode(_0x273896,_0xca0355){_0xca0355=_0xca0355||0xcc;return function(_0x3f10e9){if(_0x3f10e9){return _0x273896[_0x1126('0x19')](_0xca0355);}return _0x273896[_0x1126('0x1a')](_0xca0355)[_0x1126('0x1b')]();};}function respondWithResult(_0x53a8f0,_0x5de9a7){_0x5de9a7=_0x5de9a7||0xc8;return function(_0x1af673){if(_0x1af673){return _0x53a8f0[_0x1126('0x1a')](_0x5de9a7)[_0x1126('0x1c')](_0x1af673);}};}function respondWithFilteredResult(_0x4be0c6,_0x45149c){return function(_0x4794a7){if(_0x4794a7){var _0x35fe9f=_0x4794a7[_0x1126('0x1d')],_0x42f379=_0x45149c[_0x1126('0x1e')],_0x257b5f=_0x45149c['offset']+_0x45149c['limit'],_0x4e1c97;if(_0x257b5f>=_0x35fe9f){_0x257b5f=_0x35fe9f;_0x4e1c97=0xc8;}else{_0x4e1c97=0xce;}_0x4be0c6[_0x1126('0x1a')](_0x4e1c97);return _0x4be0c6[_0x1126('0x1f')]('Content-Range',_0x42f379+'-'+_0x257b5f+'/'+_0x35fe9f)['json'](_0x4794a7);}return null;};}function patchUpdates(_0x4564c0){return function(_0x58b109){try{jsonpatch[_0x1126('0x20')](_0x58b109,_0x4564c0,!![]);}catch(_0x1d6d19){return BPromise[_0x1126('0x21')](_0x1d6d19);}return _0x58b109['save']();};}function saveUpdates(_0x2a08ba,_0x49d209){return function(_0x56efeb){if(_0x56efeb){return _0x56efeb[_0x1126('0x22')](_0x2a08ba)[_0x1126('0x23')](function(_0x25b24b){return _0x25b24b;});}return null;};}function removeEntity(_0x36d254,_0x526ca1){return function(_0x29ab60){if(_0x29ab60){return _0x29ab60[_0x1126('0x24')]()['then'](function(){_0x36d254[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(!_0x2199d9){_0x529dd9[_0x1126('0x19')](0x194);}return _0x2199d9;};}function handleError(_0x329914,_0x34bcf1){_0x34bcf1=_0x34bcf1||0x1f4;return function(_0x566c09){logger[_0x1126('0x25')](_0x566c09[_0x1126('0x26')]);if(_0x566c09[_0x1126('0x27')]){delete _0x566c09['name'];}_0x329914[_0x1126('0x1a')](_0x34bcf1)[_0x1126('0x28')](_0x566c09);};}exports[_0x1126('0x29')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89={},_0x39bf0e={},_0x55e195={'count':0x0,'rows':[]};var _0x2fb797=_[_0x1126('0x2a')](db['VoiceDialReport'][_0x1126('0x2b')],function(_0x4bf807){return{'name':_0x4bf807[_0x1126('0x2c')],'type':_0x4bf807['type'][_0x1126('0x2d')]};});_0x39bf0e['model']=_[_0x1126('0x2a')](_0x2fb797,'name');_0x39bf0e['query']=_['keys'](_0x5ddf63[_0x1126('0x2e')]);_0x39bf0e[_0x1126('0x2f')]=_[_0x1126('0x30')](_0x39bf0e['model'],_0x39bf0e[_0x1126('0x2e')]);_0xeb7d89[_0x1126('0x31')]=_['intersection'](_0x39bf0e[_0x1126('0x32')],qs[_0x1126('0x33')](_0x5ddf63[_0x1126('0x2e')][_0x1126('0x33')]));_0xeb7d89['attributes']=_0xeb7d89['attributes'][_0x1126('0x34')]?_0xeb7d89[_0x1126('0x31')]:_0x39bf0e[_0x1126('0x32')];if(!_0x5ddf63[_0x1126('0x2e')]['hasOwnProperty'](_0x1126('0x35'))){_0xeb7d89[_0x1126('0x36')]=qs[_0x1126('0x36')](_0x5ddf63[_0x1126('0x2e')][_0x1126('0x36')]);_0xeb7d89['offset']=qs[_0x1126('0x1e')](_0x5ddf63[_0x1126('0x2e')][_0x1126('0x1e')]);}_0xeb7d89[_0x1126('0x37')]=qs['sort'](_0x5ddf63['query'][_0x1126('0x38')]);_0xeb7d89[_0x1126('0x39')]=qs['filters'](_[_0x1126('0x3a')](_0x5ddf63[_0x1126('0x2e')],_0x39bf0e[_0x1126('0x2f')]),_0x2fb797);if(_0x5ddf63['query']['filter']){_0xeb7d89[_0x1126('0x39')]=_[_0x1126('0x3b')](_0xeb7d89[_0x1126('0x39')],{'$or':_[_0x1126('0x2a')](_0x2fb797,function(_0x4a202e){if(_0x4a202e[_0x1126('0x3c')]!=='VIRTUAL'){var _0x8abfe3={};_0x8abfe3[_0x4a202e[_0x1126('0x27')]]={'$like':'%'+_0x5ddf63[_0x1126('0x2e')][_0x1126('0x3d')]+'%'};return _0x8abfe3;}})});}_0xeb7d89=_[_0x1126('0x3b')]({},_0xeb7d89,_0x5ddf63['options']);var _0x1da59f={'where':_0xeb7d89[_0x1126('0x39')]};return db[_0x1126('0x3e')][_0x1126('0x1d')](_0x1da59f)[_0x1126('0x23')](function(_0x3442b8){_0x55e195[_0x1126('0x1d')]=_0x3442b8;if(_0x5ddf63['query'][_0x1126('0x3f')]){_0xeb7d89[_0x1126('0x40')]=[{'all':!![]}];}return db[_0x1126('0x3e')][_0x1126('0x41')](_0xeb7d89);})[_0x1126('0x23')](function(_0x518de1){_0x55e195['rows']=_0x518de1;return _0x55e195;})[_0x1126('0x23')](respondWithFilteredResult(_0x541bc9,_0xeb7d89))[_0x1126('0x42')](handleError(_0x541bc9,null));};exports[_0x1126('0x43')]=function(_0x21c38e,_0x18b496){var _0x276fd5={'raw':!![],'where':{'id':_0x21c38e['params']['id']}},_0x5489c0={};_0x5489c0['model']=_[_0x1126('0x44')](db['VoiceDialReport'][_0x1126('0x2b')]);_0x5489c0[_0x1126('0x2e')]=_[_0x1126('0x44')](_0x21c38e[_0x1126('0x2e')]);_0x5489c0['filters']=_['intersection'](_0x5489c0[_0x1126('0x32')],_0x5489c0[_0x1126('0x2e')]);_0x276fd5[_0x1126('0x31')]=_['intersection'](_0x5489c0[_0x1126('0x32')],qs['fields'](_0x21c38e[_0x1126('0x2e')]['fields']));_0x276fd5[_0x1126('0x31')]=_0x276fd5[_0x1126('0x31')][_0x1126('0x34')]?_0x276fd5['attributes']:_0x5489c0[_0x1126('0x32')];if(_0x21c38e[_0x1126('0x2e')][_0x1126('0x3f')]){_0x276fd5['include']=[{'all':!![]}];}_0x276fd5=_['merge']({},_0x276fd5,_0x21c38e['options']);return db[_0x1126('0x3e')]['find'](_0x276fd5)[_0x1126('0x23')](handleEntityNotFound(_0x18b496,null))['then'](respondWithResult(_0x18b496,null))[_0x1126('0x42')](handleError(_0x18b496,null));};exports[_0x1126('0x45')]=function(_0x146066,_0x120de1){return db[_0x1126('0x3e')]['create'](_0x146066[_0x1126('0x46')],{})[_0x1126('0x23')](respondWithResult(_0x120de1,0xc9))['catch'](handleError(_0x120de1,null));};exports[_0x1126('0x22')]=function(_0x13dc39,_0x575f79){if(_0x13dc39[_0x1126('0x46')]['id']){delete _0x13dc39[_0x1126('0x46')]['id'];}return db['VoiceDialReport'][_0x1126('0x47')]({'where':{'id':_0x13dc39[_0x1126('0x48')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x575f79,null))['then'](saveUpdates(_0x13dc39[_0x1126('0x46')],null))[_0x1126('0x23')](respondWithResult(_0x575f79,null))[_0x1126('0x42')](handleError(_0x575f79,null));};exports[_0x1126('0x24')]=function(_0x224456,_0x2081f2){return db[_0x1126('0x3e')][_0x1126('0x47')]({'where':{'id':_0x224456['params']['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x2081f2,null))['then'](removeEntity(_0x2081f2,null))[_0x1126('0x42')](handleError(_0x2081f2,null));};exports[_0x1126('0x49')]=function(_0x4a1831,_0x5a2521){return db[_0x1126('0x3e')][_0x1126('0x49')]()[_0x1126('0x23')](respondWithResult(_0x5a2521,null))['catch'](handleError(_0x5a2521,null));}; \ No newline at end of file +var _0x326f=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','then','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','count','rows','show','params','length','include','find','create','body','catch','destroy','describe','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x326f,0xd1));var _0xf326=function(_0x519d09,_0x1a4067){_0x519d09=_0x519d09-0x0;var _0x4abd86=_0x326f[_0x519d09];return _0x4abd86;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf326('0xb'));var _=require(_0xf326('0xc'));var squel=require(_0xf326('0xd'));var crypto=require(_0xf326('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf326('0xf'));var Papa=require(_0xf326('0x10'));var Redis=require(_0xf326('0x11'));var authService=require(_0xf326('0x12'));var qs=require(_0xf326('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf326('0x14'));var logger=require('../../config/logger')(_0xf326('0x15'));var utils=require('../../config/utils');var config=require(_0xf326('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf326('0x17'))['db'];function respondWithStatusCode(_0x9ed463,_0x4b3966){_0x4b3966=_0x4b3966||0xcc;return function(_0x342fe5){if(_0x342fe5){return _0x9ed463[_0xf326('0x18')](_0x4b3966);}return _0x9ed463[_0xf326('0x19')](_0x4b3966)[_0xf326('0x1a')]();};}function respondWithResult(_0x5c8483,_0x45c1b6){_0x45c1b6=_0x45c1b6||0xc8;return function(_0x5204ee){if(_0x5204ee){return _0x5c8483['status'](_0x45c1b6)[_0xf326('0x1b')](_0x5204ee);}};}function respondWithFilteredResult(_0x11f6d2,_0x1f2e5a){return function(_0xa63d1a){if(_0xa63d1a){var _0x292f4b=_0xa63d1a['count'],_0x287a2a=_0x1f2e5a[_0xf326('0x1c')],_0x34128e=_0x1f2e5a[_0xf326('0x1c')]+_0x1f2e5a[_0xf326('0x1d')],_0x2cf2ca;if(_0x34128e>=_0x292f4b){_0x34128e=_0x292f4b;_0x2cf2ca=0xc8;}else{_0x2cf2ca=0xce;}_0x11f6d2[_0xf326('0x19')](_0x2cf2ca);return _0x11f6d2[_0xf326('0x1e')](_0xf326('0x1f'),_0x287a2a+'-'+_0x34128e+'/'+_0x292f4b)['json'](_0xa63d1a);}return null;};}function patchUpdates(_0x4a5b6c){return function(_0x56ad41){try{jsonpatch[_0xf326('0x20')](_0x56ad41,_0x4a5b6c,!![]);}catch(_0x289f4b){return BPromise['reject'](_0x289f4b);}return _0x56ad41['save']();};}function saveUpdates(_0x128c68,_0x4dfa76){return function(_0x5b6d3c){if(_0x5b6d3c){return _0x5b6d3c[_0xf326('0x21')](_0x128c68)[_0xf326('0x22')](function(_0x549b46){return _0x549b46;});}return null;};}function removeEntity(_0x5aa184,_0x19b8ba){return function(_0xb1efcf){if(_0xb1efcf){return _0xb1efcf['destroy']()[_0xf326('0x22')](function(){_0x5aa184[_0xf326('0x19')](0xcc)[_0xf326('0x1a')]();});}};}function handleEntityNotFound(_0x295752,_0x17c157){return function(_0x2049ec){if(!_0x2049ec){_0x295752['sendStatus'](0x194);}return _0x2049ec;};}function handleError(_0x55b9f4,_0x4f31f6){_0x4f31f6=_0x4f31f6||0x1f4;return function(_0x520d85){logger[_0xf326('0x23')](_0x520d85[_0xf326('0x24')]);if(_0x520d85[_0xf326('0x25')]){delete _0x520d85[_0xf326('0x25')];}_0x55b9f4[_0xf326('0x19')](_0x4f31f6)['send'](_0x520d85);};}exports[_0xf326('0x26')]=function(_0xa3c0b,_0x212d5d){var _0x581531={},_0x1617d2={},_0x55ad0f={'count':0x0,'rows':[]};var _0x4a9abf=_[_0xf326('0x27')](db[_0xf326('0x28')][_0xf326('0x29')],function(_0x5dbe63){return{'name':_0x5dbe63[_0xf326('0x2a')],'type':_0x5dbe63[_0xf326('0x2b')]['key']};});_0x1617d2[_0xf326('0x2c')]=_[_0xf326('0x27')](_0x4a9abf,_0xf326('0x25'));_0x1617d2[_0xf326('0x2d')]=_[_0xf326('0x2e')](_0xa3c0b[_0xf326('0x2d')]);_0x1617d2[_0xf326('0x2f')]=_[_0xf326('0x30')](_0x1617d2[_0xf326('0x2c')],_0x1617d2[_0xf326('0x2d')]);_0x581531['attributes']=_[_0xf326('0x30')](_0x1617d2[_0xf326('0x2c')],qs[_0xf326('0x31')](_0xa3c0b['query'][_0xf326('0x31')]));_0x581531[_0xf326('0x32')]=_0x581531[_0xf326('0x32')]['length']?_0x581531['attributes']:_0x1617d2[_0xf326('0x2c')];if(!_0xa3c0b[_0xf326('0x2d')][_0xf326('0x33')](_0xf326('0x34'))){_0x581531[_0xf326('0x1d')]=qs[_0xf326('0x1d')](_0xa3c0b[_0xf326('0x2d')][_0xf326('0x1d')]);_0x581531['offset']=qs[_0xf326('0x1c')](_0xa3c0b[_0xf326('0x2d')]['offset']);}_0x581531[_0xf326('0x35')]=qs['sort'](_0xa3c0b[_0xf326('0x2d')]['sort']);_0x581531['where']=qs[_0xf326('0x2f')](_['pick'](_0xa3c0b[_0xf326('0x2d')],_0x1617d2['filters']),_0x4a9abf);if(_0xa3c0b[_0xf326('0x2d')][_0xf326('0x36')]){_0x581531[_0xf326('0x37')]=_['merge'](_0x581531[_0xf326('0x37')],{'$or':_[_0xf326('0x27')](_0x4a9abf,function(_0x48525a){if(_0x48525a[_0xf326('0x2b')]!==_0xf326('0x38')){var _0x40fa7a={};_0x40fa7a[_0x48525a[_0xf326('0x25')]]={'$like':'%'+_0xa3c0b['query'][_0xf326('0x36')]+'%'};return _0x40fa7a;}})});}_0x581531=_[_0xf326('0x39')]({},_0x581531,_0xa3c0b[_0xf326('0x3a')]);var _0x47188b={'where':_0x581531[_0xf326('0x37')]};return db['VoiceDialReport'][_0xf326('0x3b')](_0x47188b)[_0xf326('0x22')](function(_0x5cfb97){_0x55ad0f['count']=_0x5cfb97;if(_0xa3c0b[_0xf326('0x2d')]['includeAll']){_0x581531['include']=[{'all':!![]}];}return db[_0xf326('0x28')]['findAll'](_0x581531);})[_0xf326('0x22')](function(_0x37a95b){_0x55ad0f[_0xf326('0x3c')]=_0x37a95b;return _0x55ad0f;})[_0xf326('0x22')](respondWithFilteredResult(_0x212d5d,_0x581531))['catch'](handleError(_0x212d5d,null));};exports[_0xf326('0x3d')]=function(_0x45d344,_0x347e7b){var _0x365627={'raw':!![],'where':{'id':_0x45d344[_0xf326('0x3e')]['id']}},_0xc4fda4={};_0xc4fda4[_0xf326('0x2c')]=_[_0xf326('0x2e')](db[_0xf326('0x28')][_0xf326('0x29')]);_0xc4fda4[_0xf326('0x2d')]=_[_0xf326('0x2e')](_0x45d344['query']);_0xc4fda4[_0xf326('0x2f')]=_[_0xf326('0x30')](_0xc4fda4[_0xf326('0x2c')],_0xc4fda4[_0xf326('0x2d')]);_0x365627[_0xf326('0x32')]=_[_0xf326('0x30')](_0xc4fda4['model'],qs[_0xf326('0x31')](_0x45d344[_0xf326('0x2d')]['fields']));_0x365627[_0xf326('0x32')]=_0x365627[_0xf326('0x32')][_0xf326('0x3f')]?_0x365627[_0xf326('0x32')]:_0xc4fda4[_0xf326('0x2c')];if(_0x45d344['query']['includeAll']){_0x365627[_0xf326('0x40')]=[{'all':!![]}];}_0x365627=_[_0xf326('0x39')]({},_0x365627,_0x45d344['options']);return db['VoiceDialReport'][_0xf326('0x41')](_0x365627)[_0xf326('0x22')](handleEntityNotFound(_0x347e7b,null))[_0xf326('0x22')](respondWithResult(_0x347e7b,null))['catch'](handleError(_0x347e7b,null));};exports[_0xf326('0x42')]=function(_0xe96e1e,_0x2180d6){return db[_0xf326('0x28')][_0xf326('0x42')](_0xe96e1e[_0xf326('0x43')],{})[_0xf326('0x22')](respondWithResult(_0x2180d6,0xc9))[_0xf326('0x44')](handleError(_0x2180d6,null));};exports[_0xf326('0x21')]=function(_0x27ced1,_0x1c76c8){if(_0x27ced1[_0xf326('0x43')]['id']){delete _0x27ced1[_0xf326('0x43')]['id'];}return db[_0xf326('0x28')][_0xf326('0x41')]({'where':{'id':_0x27ced1['params']['id']}})[_0xf326('0x22')](handleEntityNotFound(_0x1c76c8,null))[_0xf326('0x22')](saveUpdates(_0x27ced1[_0xf326('0x43')],null))[_0xf326('0x22')](respondWithResult(_0x1c76c8,null))['catch'](handleError(_0x1c76c8,null));};exports[_0xf326('0x45')]=function(_0x2f5511,_0xca88e){return db[_0xf326('0x28')]['find']({'where':{'id':_0x2f5511[_0xf326('0x3e')]['id']}})[_0xf326('0x22')](handleEntityNotFound(_0xca88e,null))[_0xf326('0x22')](removeEntity(_0xca88e,null))[_0xf326('0x44')](handleError(_0xca88e,null));};exports[_0xf326('0x46')]=function(_0x4970fb,_0x5d312d){return db[_0xf326('0x28')][_0xf326('0x46')]()[_0xf326('0x22')](respondWithResult(_0x5d312d,null))['catch'](handleError(_0x5d312d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 63f59cb..a82d121 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 _0x1606=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','moment','bluebird','rimraf','exports'];(function(_0x4d1d24,_0x37a9e0){var _0x315c2e=function(_0x45668c){while(--_0x45668c){_0x4d1d24['push'](_0x4d1d24['shift']());}};_0x315c2e(++_0x37a9e0);}(_0x1606,0x1da));var _0x6160=function(_0x2d9104,_0x12b1ee){_0x2d9104=_0x2d9104-0x0;var _0xe5eec1=_0x1606[_0x2d9104];return _0xe5eec1;};'use strict';var _=require(_0x6160('0x0'));var util=require(_0x6160('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6160('0x2'));var BPromise=require(_0x6160('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6160('0x4'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x6160('0x5')]=function(_0x169b1a,_0x241453){return _0x169b1a[_0x6160('0x6')](_0x6160('0x7'),attributes,{'tableName':_0x6160('0x8'),'paranoid':![],'indexes':[{'fields':[_0x6160('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b8d=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x394d80,_0x1e6060){var _0x371934=function(_0xc60e1d){while(--_0xc60e1d){_0x394d80['push'](_0x394d80['shift']());}};_0x371934(++_0x1e6060);}(_0x3b8d,0x191));var _0xd3b8=function(_0x5a9cc8,_0x107ac0){_0x5a9cc8=_0x5a9cc8-0x0;var _0x5db9ec=_0x3b8d[_0x5a9cc8];return _0x5db9ec;};'use strict';var _=require(_0xd3b8('0x0'));var util=require(_0xd3b8('0x1'));var logger=require(_0xd3b8('0x2'))(_0xd3b8('0x3'));var moment=require(_0xd3b8('0x4'));var BPromise=require('bluebird');var rp=require(_0xd3b8('0x5'));var fs=require('fs');var path=require(_0xd3b8('0x6'));var rimraf=require(_0xd3b8('0x7'));var config=require(_0xd3b8('0x8'));var attributes=require(_0xd3b8('0x9'));module['exports']=function(_0x14e954,_0x28a72f){return _0x14e954[_0xd3b8('0xa')](_0xd3b8('0xb'),attributes,{'tableName':_0xd3b8('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd3b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8b5c37d..017b29a 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 _0x3519=['options','CreateVoiceDialReport','update','body','raw','where','attributes','UpdateVoiceDialReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create'];(function(_0x188374,_0x213fe6){var _0x5a6897=function(_0x473928){while(--_0x473928){_0x188374['push'](_0x188374['shift']());}};_0x5a6897(++_0x213fe6);}(_0x3519,0x128));var _0x9351=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x3519[_0x15dbca];return _0x326533;};'use strict';var _=require(_0x9351('0x0'));var util=require('util');var moment=require(_0x9351('0x1'));var BPromise=require('bluebird');var rs=require(_0x9351('0x2'));var fs=require('fs');var Redis=require(_0x9351('0x3'));var db=require(_0x9351('0x4'))['db'];var utils=require(_0x9351('0x5'));var logger=require(_0x9351('0x6'))('rpc');var config=require(_0x9351('0x7'));var jayson=require(_0x9351('0x8'));var client=jayson[_0x9351('0x9')][_0x9351('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27cc86,_0x4cca8a,_0x6849e5){return new BPromise(function(_0x4e8efa,_0x3a400e){return client['request'](_0x27cc86,_0x6849e5)[_0x9351('0xb')](function(_0x597697){logger[_0x9351('0xc')](_0x9351('0xd'),_0x4cca8a,_0x9351('0xe'));logger[_0x9351('0xf')](_0x9351('0x10'),_0x4cca8a,_0x9351('0xe'),JSON[_0x9351('0x11')](_0x597697));if(_0x597697['error']){if(_0x597697[_0x9351('0x12')][_0x9351('0x13')]===0x1f4){logger[_0x9351('0x12')](_0x9351('0xd'),_0x4cca8a,_0x597697['error'][_0x9351('0x14')]);return _0x3a400e(_0x597697[_0x9351('0x12')][_0x9351('0x14')]);}logger['error'](_0x9351('0xd'),_0x4cca8a,_0x597697[_0x9351('0x12')]['message']);return _0x4e8efa(_0x597697['error'][_0x9351('0x14')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x4cca8a,_0x9351('0xe'));_0x4e8efa(_0x597697[_0x9351('0x15')][_0x9351('0x14')]);}})[_0x9351('0x16')](function(_0x198de6){logger[_0x9351('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x4cca8a,_0x198de6);_0x3a400e(_0x198de6);});});}exports['CreateVoiceDialReport']=function(_0x4d3a88){var _0x565488=this;return new Promise(function(_0x5d1d8d,_0x114854){return db['VoiceDialReport'][_0x9351('0x17')](_0x4d3a88['body'],{'raw':_0x4d3a88[_0x9351('0x18')]?_0x4d3a88[_0x9351('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9351('0xb')](function(_0x55814d){logger[_0x9351('0xc')](_0x9351('0x19'),_0x4d3a88);logger['debug'](_0x9351('0x19'),_0x4d3a88,JSON['stringify'](_0x55814d));_0x5d1d8d(_0x55814d);})[_0x9351('0x16')](function(_0x5162ea){logger[_0x9351('0x12')](_0x9351('0x19'),_0x5162ea[_0x9351('0x14')],_0x4d3a88);_0x114854(_0x565488[_0x9351('0x12')](0x1f4,_0x5162ea['message']));});});};exports['UpdateVoiceDialReport']=function(_0x55db26){var _0x2a0a47=this;return new Promise(function(_0x4ba29b,_0x2e1984){return db['VoiceDialReport'][_0x9351('0x1a')](_0x55db26[_0x9351('0x1b')],{'raw':_0x55db26['options']?_0x55db26[_0x9351('0x18')][_0x9351('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55db26['options']?_0x55db26[_0x9351('0x18')][_0x9351('0x1d')]||null:null,'attributes':_0x55db26['options']?_0x55db26['options'][_0x9351('0x1e')]||null:null,'limit':_0x55db26['options']?_0x55db26['options']['limit']||null:null})['then'](function(_0x37e7f4){logger[_0x9351('0xc')](_0x9351('0x1f'),_0x55db26);logger[_0x9351('0xf')]('UpdateVoiceDialReport',_0x55db26,JSON[_0x9351('0x11')](_0x37e7f4));_0x4ba29b(_0x37e7f4);})[_0x9351('0x16')](function(_0x4393d7){logger['error'](_0x9351('0x1f'),_0x4393d7[_0x9351('0x14')],_0x55db26);_0x2e1984(_0x2a0a47[_0x9351('0x12')](0x1f4,_0x4393d7['message']));});});}; \ No newline at end of file +var _0x2553=['http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x222bd3,_0x4c9a4f){var _0x4bed46=function(_0x4a0261){while(--_0x4a0261){_0x222bd3['push'](_0x222bd3['shift']());}};_0x4bed46(++_0x4c9a4f);}(_0x2553,0xf6));var _0x3255=function(_0x14ec54,_0x2d5098){_0x14ec54=_0x14ec54-0x0;var _0x2f8c0e=_0x2553[_0x14ec54];return _0x2f8c0e;};'use strict';var _=require(_0x3255('0x0'));var util=require(_0x3255('0x1'));var moment=require(_0x3255('0x2'));var BPromise=require(_0x3255('0x3'));var rs=require(_0x3255('0x4'));var fs=require('fs');var Redis=require(_0x3255('0x5'));var db=require(_0x3255('0x6'))['db'];var utils=require(_0x3255('0x7'));var logger=require(_0x3255('0x8'))(_0x3255('0x9'));var config=require(_0x3255('0xa'));var jayson=require(_0x3255('0xb'));var client=jayson[_0x3255('0xc')][_0x3255('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3e0b7b,_0x2034bc,_0x4e9eaa){return new BPromise(function(_0x1327d6,_0x131c55){return client[_0x3255('0xe')](_0x3e0b7b,_0x4e9eaa)[_0x3255('0xf')](function(_0x26d0a1){logger['info'](_0x3255('0x10'),_0x2034bc,_0x3255('0x11'));logger[_0x3255('0x12')](_0x3255('0x13'),_0x2034bc,_0x3255('0x11'),JSON[_0x3255('0x14')](_0x26d0a1));if(_0x26d0a1[_0x3255('0x15')]){if(_0x26d0a1[_0x3255('0x15')][_0x3255('0x16')]===0x1f4){logger['error'](_0x3255('0x10'),_0x2034bc,_0x26d0a1[_0x3255('0x15')][_0x3255('0x17')]);return _0x131c55(_0x26d0a1[_0x3255('0x15')][_0x3255('0x17')]);}logger[_0x3255('0x15')](_0x3255('0x10'),_0x2034bc,_0x26d0a1[_0x3255('0x15')][_0x3255('0x17')]);return _0x1327d6(_0x26d0a1[_0x3255('0x15')][_0x3255('0x17')]);}else{logger[_0x3255('0x18')](_0x3255('0x10'),_0x2034bc,_0x3255('0x11'));_0x1327d6(_0x26d0a1[_0x3255('0x19')][_0x3255('0x17')]);}})['catch'](function(_0x143688){logger['error'](_0x3255('0x10'),_0x2034bc,_0x143688);_0x131c55(_0x143688);});});}exports[_0x3255('0x1a')]=function(_0x43c797){var _0x27fbef=this;return new Promise(function(_0x47f3a5,_0x55fae9){return db[_0x3255('0x1b')][_0x3255('0x1c')](_0x43c797[_0x3255('0x1d')],{'raw':_0x43c797['options']?_0x43c797[_0x3255('0x1e')][_0x3255('0x1f')]===undefined?!![]:![]:!![]})[_0x3255('0xf')](function(_0x43f024){logger[_0x3255('0x18')](_0x3255('0x1a'),_0x43c797);logger[_0x3255('0x12')](_0x3255('0x1a'),_0x43c797,JSON[_0x3255('0x14')](_0x43f024));_0x47f3a5(_0x43f024);})[_0x3255('0x20')](function(_0x1b8eec){logger[_0x3255('0x15')](_0x3255('0x1a'),_0x1b8eec[_0x3255('0x17')],_0x43c797);_0x55fae9(_0x27fbef[_0x3255('0x15')](0x1f4,_0x1b8eec[_0x3255('0x17')]));});});};exports[_0x3255('0x21')]=function(_0x298bd0){var _0x2cb751=this;return new Promise(function(_0x49b9c9,_0x2b1cce){return db[_0x3255('0x1b')][_0x3255('0x22')](_0x298bd0[_0x3255('0x1d')],{'raw':_0x298bd0['options']?_0x298bd0[_0x3255('0x1e')][_0x3255('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x298bd0[_0x3255('0x1e')]?_0x298bd0[_0x3255('0x1e')][_0x3255('0x23')]||null:null,'attributes':_0x298bd0['options']?_0x298bd0[_0x3255('0x1e')]['attributes']||null:null,'limit':_0x298bd0[_0x3255('0x1e')]?_0x298bd0[_0x3255('0x1e')][_0x3255('0x24')]||null:null})[_0x3255('0xf')](function(_0x466f71){logger[_0x3255('0x18')](_0x3255('0x21'),_0x298bd0);logger[_0x3255('0x12')](_0x3255('0x21'),_0x298bd0,JSON[_0x3255('0x14')](_0x466f71));_0x49b9c9(_0x466f71);})['catch'](function(_0x150e6f){logger[_0x3255('0x15')](_0x3255('0x21'),_0x150e6f['message'],_0x298bd0);_0x2b1cce(_0x2cb751['error'](0x1f4,_0x150e6f[_0x3255('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c418c5f..9c5ae60 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 _0x657f=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','show','post','isAuthenticated','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x657f,0x152));var _0xf657=function(_0x4a095e,_0x381cd5){_0x4a095e=_0x4a095e-0x0;var _0x10ef73=_0x657f[_0x4a095e];return _0x10ef73;};'use strict';var multer=require(_0xf657('0x0'));var util=require(_0xf657('0x1'));var path=require(_0xf657('0x2'));var timeout=require(_0xf657('0x3'));var express=require('express');var router=express[_0xf657('0x4')]();var fs_extra=require(_0xf657('0x5'));var auth=require(_0xf657('0x6'));var interaction=require(_0xf657('0x7'));var config=require(_0xf657('0x8'));var controller=require(_0xf657('0x9'));router[_0xf657('0xa')]('/',auth['isAuthenticated'](),controller[_0xf657('0xb')]);router[_0xf657('0xa')](_0xf657('0xc'),auth['isAuthenticated'](),controller[_0xf657('0xd')]);router[_0xf657('0xe')]('/',auth[_0xf657('0xf')](),controller['create']);router['post'](_0xf657('0x10'),auth[_0xf657('0xf')](),controller[_0xf657('0x11')]);router[_0xf657('0x12')](_0xf657('0xc'),auth[_0xf657('0xf')](),controller[_0xf657('0x13')]);router[_0xf657('0x14')]('/:id',auth[_0xf657('0xf')](),controller[_0xf657('0x15')]);module[_0xf657('0x16')]=router; \ No newline at end of file +var _0x3e15=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','post','create','/:id/applications'];(function(_0x580322,_0x49f152){var _0x193be0=function(_0x5079cb){while(--_0x5079cb){_0x580322['push'](_0x580322['shift']());}};_0x193be0(++_0x49f152);}(_0x3e15,0x15a));var _0x53e1=function(_0x262752,_0x9af4b3){_0x262752=_0x262752-0x0;var _0xafcae1=_0x3e15[_0x262752];return _0xafcae1;};'use strict';var multer=require(_0x53e1('0x0'));var util=require(_0x53e1('0x1'));var path=require(_0x53e1('0x2'));var timeout=require(_0x53e1('0x3'));var express=require(_0x53e1('0x4'));var router=express[_0x53e1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x53e1('0x6'));var controller=require(_0x53e1('0x7'));router[_0x53e1('0x8')]('/',auth[_0x53e1('0x9')](),controller['index']);router[_0x53e1('0x8')](_0x53e1('0xa'),auth[_0x53e1('0x9')](),controller['show']);router[_0x53e1('0xb')]('/',auth[_0x53e1('0x9')](),controller[_0x53e1('0xc')]);router['post'](_0x53e1('0xd'),auth[_0x53e1('0x9')](),controller['addApplications']);router[_0x53e1('0xe')](_0x53e1('0xa'),auth[_0x53e1('0x9')](),controller['update']);router[_0x53e1('0xf')](_0x53e1('0xa'),auth['isAuthenticated'](),controller[_0x53e1('0x10')]);module[_0x53e1('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index c1be983..6872093 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(_0x481a76,_0x4792c5){var _0x13d952=function(_0x3ca623){while(--_0x3ca623){_0x481a76['push'](_0x481a76['shift']());}};_0x13d952(++_0x4792c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x5ae288,_0x12f312){var _0x2ff4cc=function(_0x43c51e){while(--_0x43c51e){_0x5ae288['push'](_0x5ae288['shift']());}};_0x2ff4cc(++_0x12f312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 8818dc2..10d458a 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 _0x502e=['map','value','includes','find','type','name','UserProfileResource','error','stack','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','sort','where','merge','count','includeAll','include','rows','catch','show','params','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','apply','reject','save','update','then','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore'];(function(_0xf22365,_0x3bfb87){var _0x3c7388=function(_0x3f0654){while(--_0x3f0654){_0xf22365['push'](_0xf22365['shift']());}};_0x3c7388(++_0x3bfb87);}(_0x502e,0x177));var _0xe502=function(_0x3e2a82,_0x40c8e3){_0x3e2a82=_0x3e2a82-0x0;var _0xe28d8f=_0x502e[_0x3e2a82];return _0xe28d8f;};'use strict';var pdf=require(_0xe502('0x0'));var emlformat=require(_0xe502('0x1'));var rimraf=require(_0xe502('0x2'));var zipdir=require(_0xe502('0x3'));var jsonpatch=require(_0xe502('0x4'));var rp=require('request-promise');var moment=require(_0xe502('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe502('0x6'));var path=require(_0xe502('0x7'));var sox=require(_0xe502('0x8'));var csv=require(_0xe502('0x9'));var ejs=require(_0xe502('0xa'));var fs=require('fs');var fs_extra=require(_0xe502('0xb'));var _=require(_0xe502('0xc'));var squel=require(_0xe502('0xd'));var crypto=require('crypto');var jsforce=require(_0xe502('0xe'));var deskjs=require(_0xe502('0xf'));var toCsv=require(_0xe502('0x9'));var querystring=require(_0xe502('0x10'));var Papa=require(_0xe502('0x11'));var Redis=require(_0xe502('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe502('0x13'));var as=require(_0xe502('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe502('0x15'));var utils=require(_0xe502('0x16'));var config=require(_0xe502('0x17'));var licenseUtil=require(_0xe502('0x18'));var db=require(_0xe502('0x19'))['db'];config['redis']=_[_0xe502('0x1a')](config[_0xe502('0x1b')],{'host':_0xe502('0x1c'),'port':0x18eb});var socket=require(_0xe502('0x1d'))(new Redis(config[_0xe502('0x1b')]));require(_0xe502('0x1e'))['register'](socket);function respondWithStatusCode(_0x4b5321,_0xd89b20){_0xd89b20=_0xd89b20||0xcc;return function(_0x45cc3a){if(_0x45cc3a){return _0x4b5321[_0xe502('0x1f')](_0xd89b20);}return _0x4b5321[_0xe502('0x20')](_0xd89b20)[_0xe502('0x21')]();};}function respondWithResult(_0x2f6ca1,_0x38c0d9){_0x38c0d9=_0x38c0d9||0xc8;return function(_0x4a0a50){if(_0x4a0a50){return _0x2f6ca1[_0xe502('0x20')](_0x38c0d9)['json'](_0x4a0a50);}};}function respondWithFilteredResult(_0x3499ea,_0x22ca13){return function(_0x76df29){if(_0x76df29){var _0x4d8966=_0x76df29['count'],_0x26c344=_0x22ca13['offset'],_0x4ae91b=_0x22ca13['offset']+_0x22ca13['limit'],_0x60390b;if(_0x4ae91b>=_0x4d8966){_0x4ae91b=_0x4d8966;_0x60390b=0xc8;}else{_0x60390b=0xce;}_0x3499ea[_0xe502('0x20')](_0x60390b);return _0x3499ea['set']('Content-Range',_0x26c344+'-'+_0x4ae91b+'/'+_0x4d8966)[_0xe502('0x22')](_0x76df29);}return null;};}function patchUpdates(_0x2403a3){return function(_0x108435){try{jsonpatch[_0xe502('0x23')](_0x108435,_0x2403a3,!![]);}catch(_0x1c8bd3){return BPromise[_0xe502('0x24')](_0x1c8bd3);}return _0x108435[_0xe502('0x25')]();};}function saveUpdates(_0x4255ae,_0x3a6e73){return function(_0x477270){if(_0x477270){return _0x477270[_0xe502('0x26')](_0x4255ae)[_0xe502('0x27')](function(_0x311503){return _0x311503;});}return null;};}function removeEntity(_0x21ca58,_0x926fe3){return function(_0x593dbb){if(_0x593dbb){return _0x593dbb[_0xe502('0x28')]()['then'](function(){var _0xbdb102=_0x593dbb['get']({'plain':!![]});var _0x1006b5=[{'name':_0xe502('0x29'),'value':_0xe502('0x2a'),'ignore':![]},{'name':_0xe502('0x2b'),'value':_0xe502('0x2c'),'ignore':![]},{'name':_0xe502('0x2d'),'value':_0xe502('0x2e'),'ignore':![]}];var _0x1da5e0=_(_0x1006b5)[_0xe502('0x2f')](_0xe502('0x30'))[_0xe502('0x31')](_0xe502('0x32'))[_0xe502('0x32')]();if(_[_0xe502('0x33')](_0x1da5e0,_0xbdb102['type'])){return;}var _0x76a09a=_[_0xe502('0x34')](_0x1006b5,[_0xe502('0x32'),_0xbdb102[_0xe502('0x35')]])[_0xe502('0x36')];return db[_0xe502('0x37')][_0xe502('0x28')]({'where':{'type':_0x76a09a,'resourceId':_0xbdb102['id']}})[_0xe502('0x27')](function(){return _0x593dbb;});})[_0xe502('0x27')](function(){_0x21ca58[_0xe502('0x20')](0xcc)[_0xe502('0x21')]();});}};}function handleEntityNotFound(_0x2281aa,_0x524d5b){return function(_0x473470){if(!_0x473470){_0x2281aa[_0xe502('0x1f')](0x194);}return _0x473470;};}function handleError(_0x954282,_0x23c894){_0x23c894=_0x23c894||0x1f4;return function(_0x1f9166){logger[_0xe502('0x38')](_0x1f9166[_0xe502('0x39')]);if(_0x1f9166[_0xe502('0x36')]){delete _0x1f9166[_0xe502('0x36')];}_0x954282[_0xe502('0x20')](_0x23c894)['send'](_0x1f9166);};}exports[_0xe502('0x3a')]=function(_0x745295,_0x2bc569){var _0x4d4f13={},_0x2db2d1={},_0x4d482f={'count':0x0,'rows':[]};var _0x550acf=_[_0xe502('0x31')](db[_0xe502('0x3b')][_0xe502('0x3c')],function(_0x4a37e5){return{'name':_0x4a37e5['fieldName'],'type':_0x4a37e5[_0xe502('0x35')][_0xe502('0x3d')]};});_0x2db2d1[_0xe502('0x3e')]=_[_0xe502('0x31')](_0x550acf,_0xe502('0x36'));_0x2db2d1[_0xe502('0x3f')]=_[_0xe502('0x40')](_0x745295['query']);_0x2db2d1[_0xe502('0x41')]=_[_0xe502('0x42')](_0x2db2d1[_0xe502('0x3e')],_0x2db2d1[_0xe502('0x3f')]);_0x4d4f13[_0xe502('0x43')]=_[_0xe502('0x42')](_0x2db2d1[_0xe502('0x3e')],qs[_0xe502('0x44')](_0x745295[_0xe502('0x3f')][_0xe502('0x44')]));_0x4d4f13['attributes']=_0x4d4f13[_0xe502('0x43')][_0xe502('0x45')]?_0x4d4f13[_0xe502('0x43')]:_0x2db2d1[_0xe502('0x3e')];if(!_0x745295['query'][_0xe502('0x46')]('nolimit')){_0x4d4f13[_0xe502('0x47')]=qs['limit'](_0x745295[_0xe502('0x3f')][_0xe502('0x47')]);_0x4d4f13['offset']=qs[_0xe502('0x48')](_0x745295[_0xe502('0x3f')][_0xe502('0x48')]);}_0x4d4f13['order']=qs[_0xe502('0x49')](_0x745295[_0xe502('0x3f')][_0xe502('0x49')]);_0x4d4f13[_0xe502('0x4a')]=qs['filters'](_['pick'](_0x745295[_0xe502('0x3f')],_0x2db2d1['filters']),_0x550acf);if(_0x745295['query'][_0xe502('0x2f')]){_0x4d4f13[_0xe502('0x4a')]=_[_0xe502('0x4b')](_0x4d4f13[_0xe502('0x4a')],{'$or':_['map'](_0x550acf,function(_0x4f09ac){if(_0x4f09ac[_0xe502('0x35')]!=='VIRTUAL'){var _0x4220b5={};_0x4220b5[_0x4f09ac['name']]={'$like':'%'+_0x745295[_0xe502('0x3f')][_0xe502('0x2f')]+'%'};return _0x4220b5;}})});}_0x4d4f13=_[_0xe502('0x4b')]({},_0x4d4f13,_0x745295['options']);var _0x2c54f4={'where':_0x4d4f13[_0xe502('0x4a')]};return db[_0xe502('0x3b')]['count'](_0x2c54f4)[_0xe502('0x27')](function(_0x1d0a3f){_0x4d482f[_0xe502('0x4c')]=_0x1d0a3f;if(_0x745295[_0xe502('0x3f')][_0xe502('0x4d')]){_0x4d4f13[_0xe502('0x4e')]=[{'all':!![]}];}return db[_0xe502('0x3b')]['findAll'](_0x4d4f13);})[_0xe502('0x27')](function(_0x1b4dbf){_0x4d482f[_0xe502('0x4f')]=_0x1b4dbf;return _0x4d482f;})[_0xe502('0x27')](respondWithFilteredResult(_0x2bc569,_0x4d4f13))[_0xe502('0x50')](handleError(_0x2bc569,null));};exports[_0xe502('0x51')]=function(_0x7c0267,_0x3854a8){var _0x3ae1d7={'raw':![],'where':{'id':_0x7c0267['params']['id']}},_0x37f6fc={};_0x37f6fc[_0xe502('0x3e')]=_[_0xe502('0x40')](db[_0xe502('0x3b')][_0xe502('0x3c')]);_0x37f6fc['query']=_['keys'](_0x7c0267[_0xe502('0x3f')]);_0x37f6fc[_0xe502('0x41')]=_[_0xe502('0x42')](_0x37f6fc['model'],_0x37f6fc[_0xe502('0x3f')]);_0x3ae1d7[_0xe502('0x43')]=_[_0xe502('0x42')](_0x37f6fc[_0xe502('0x3e')],qs[_0xe502('0x44')](_0x7c0267[_0xe502('0x3f')][_0xe502('0x44')]));_0x3ae1d7['attributes']=_0x3ae1d7['attributes'][_0xe502('0x45')]?_0x3ae1d7['attributes']:_0x37f6fc[_0xe502('0x3e')];if(_0x7c0267[_0xe502('0x3f')]['includeAll']){_0x3ae1d7[_0xe502('0x4e')]=[{'all':!![]}];}_0x3ae1d7=_[_0xe502('0x4b')]({},_0x3ae1d7,_0x7c0267['options']);return db[_0xe502('0x3b')]['find'](_0x3ae1d7)[_0xe502('0x27')](handleEntityNotFound(_0x3854a8,null))[_0xe502('0x27')](respondWithResult(_0x3854a8,null))[_0xe502('0x50')](handleError(_0x3854a8,null));};exports['destroy']=function(_0xad1e02,_0x45f245){return db[_0xe502('0x3b')][_0xe502('0x34')]({'where':{'id':_0xad1e02[_0xe502('0x52')]['id']}})['then'](handleEntityNotFound(_0x45f245,null))[_0xe502('0x27')](removeEntity(_0x45f245,null))[_0xe502('0x50')](handleError(_0x45f245,null));};exports['create']=function(_0x8f023d,_0x5d474d){if(_0x8f023d['body']['type']==='outbound'&&!_[_0xe502('0x53')](_0x8f023d[_0xe502('0x54')][_0xe502('0x55')],'_')){_0x8f023d[_0xe502('0x54')][_0xe502('0x55')]='_'[_0xe502('0x56')](_0x8f023d[_0xe502('0x54')][_0xe502('0x55')]);}return db['VoiceExtension']['create'](_0x8f023d[_0xe502('0x54')],{'raw':![]})[_0xe502('0x27')](function(_0x3a1482){var _0x2a452e=_0x8f023d[_0xe502('0x57')]['get']({'plain':!![]});if(!_0x2a452e)throw new Error(_0xe502('0x58'));if(_0x2a452e[_0xe502('0x59')]===_0xe502('0x57')){var _0x1d53cb=_0x3a1482['get']({'plain':!![]});var _0x39bfd9=[{'name':_0xe502('0x29'),'value':_0xe502('0x2a')},{'name':_0xe502('0x2b'),'value':_0xe502('0x2c')},{'name':_0xe502('0x2d'),'value':_0xe502('0x2e')}];var _0x3bc230=_['find'](_0x39bfd9,[_0xe502('0x32'),_0x1d53cb[_0xe502('0x35')]])['name'];return db[_0xe502('0x5a')][_0xe502('0x34')]({'where':{'name':_0x3bc230,'userProfileId':_0x2a452e[_0xe502('0x5b')]},'raw':!![]})[_0xe502('0x27')](function(_0x234bc8){if(_0x234bc8&&_0x234bc8['autoAssociation']===0x0){return db['UserProfileResource'][_0xe502('0x5c')]({'name':_0x1d53cb[_0xe502('0x36')],'resourceId':_0x1d53cb['id'],'type':_0x234bc8[_0xe502('0x36')],'sectionId':_0x234bc8['id']},{})['then'](function(){return _0x3a1482;});}else{return _0x3a1482;}})[_0xe502('0x50')](function(_0x402e3a){logger[_0xe502('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x402e3a);throw _0x402e3a;});}return _0x3a1482;})[_0xe502('0x27')](respondWithResult(_0x5d474d,0xc9))[_0xe502('0x50')](handleError(_0x5d474d,null));};exports[_0xe502('0x26')]=function(_0x33a585,_0xe56e6f){if(_0x33a585[_0xe502('0x54')]['id']){delete _0x33a585[_0xe502('0x54')]['id'];}return db[_0xe502('0x3b')]['find']({'where':{'id':_0x33a585[_0xe502('0x52')]['id']}})[_0xe502('0x27')](handleEntityNotFound(_0xe56e6f,null))[_0xe502('0x27')](function(_0x280e7b){if(_0x280e7b){return db[_0xe502('0x3b')][_0xe502('0x26')](_[_0xe502('0x5d')](_0x33a585[_0xe502('0x54')],[_0xe502('0x55'),_0xe502('0x5e'),_0xe502('0x5f'),_0xe502('0x60'),_0xe502('0x61'),_0xe502('0x62')]),{'where':{'context':_0x280e7b[_0xe502('0x5e')],'exten':_0x280e7b[_0xe502('0x55')]},'individualHooks':!![]})['then'](function(_0x374f94){return _0x374f94;});}return null;})[_0xe502('0x27')](respondWithStatusCode(_0xe56e6f,null))['catch'](handleError(_0xe56e6f,null));};exports[_0xe502('0x63')]=function(_0x27df33,_0x21200f,_0x1cb0a5){return db[_0xe502('0x3b')][_0xe502('0x64')]({'where':{'id':_0x27df33['params']['id']}})[_0xe502('0x27')](handleEntityNotFound(_0x21200f,null))[_0xe502('0x27')](function(_0x3e94b4){if(_0x3e94b4){return db['sequelize'][_0xe502('0x65')](function(_0x520fbf){return db[_0xe502('0x3b')][_0xe502('0x28')]({'where':{'VoiceExtensionId':_0x27df33[_0xe502('0x52')]['id']},'transaction':_0x520fbf})['then'](function(_0x5b48ea){var _0x557ea6=_[_0xe502('0x31')](_0x27df33[_0xe502('0x54')],function(_0x553cb9){_0x553cb9[_0xe502('0x66')]=_0x27df33[_0xe502('0x52')]['id'];return _0x553cb9;});return db[_0xe502('0x3b')][_0xe502('0x67')](_0x557ea6,{'transaction':_0x520fbf});});})[_0xe502('0x27')](function(){return db[_0xe502('0x3b')][_0xe502('0x68')]({'where':{'isApp':!![],'VoiceExtensionId':_0x27df33['params']['id']},'order':_0xe502('0x69')});});}})[_0xe502('0x27')](respondWithResult(_0x21200f,null))['catch'](handleError(_0x21200f,null));}; \ No newline at end of file +var _0xcab6=['fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','count','includeAll','include','VoiceExtension','findAll','rows','catch','params','rawAttributes','create','body','outbound','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','inbound','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','recordingFormat','mandatoryDisposition','context','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','save','then','destroy','get','internal','filter','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','key','query','keys','filters','intersection','model'];(function(_0x527f2a,_0x33c012){var _0x1a48a9=function(_0x41a503){while(--_0x41a503){_0x527f2a['push'](_0x527f2a['shift']());}};_0x1a48a9(++_0x33c012);}(_0xcab6,0x174));var _0x6cab=function(_0x374cf6,_0x193ac1){_0x374cf6=_0x374cf6-0x0;var _0x114628=_0xcab6[_0x374cf6];return _0x114628;};'use strict';var pdf=require(_0x6cab('0x0'));var emlformat=require(_0x6cab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6cab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cab('0x3'));var moment=require(_0x6cab('0x4'));var BPromise=require(_0x6cab('0x5'));var Mustache=require(_0x6cab('0x6'));var util=require(_0x6cab('0x7'));var path=require(_0x6cab('0x8'));var sox=require('sox');var csv=require(_0x6cab('0x9'));var ejs=require(_0x6cab('0xa'));var fs=require('fs');var fs_extra=require(_0x6cab('0xb'));var _=require(_0x6cab('0xc'));var squel=require(_0x6cab('0xd'));var crypto=require(_0x6cab('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6cab('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6cab('0x10'));var Papa=require(_0x6cab('0x11'));var Redis=require(_0x6cab('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6cab('0x13'));var as=require(_0x6cab('0x14'));var hardwareService=require(_0x6cab('0x15'));var logger=require(_0x6cab('0x16'))(_0x6cab('0x17'));var utils=require('../../config/utils');var config=require(_0x6cab('0x18'));var licenseUtil=require(_0x6cab('0x19'));var db=require(_0x6cab('0x1a'))['db'];config[_0x6cab('0x1b')]=_[_0x6cab('0x1c')](config[_0x6cab('0x1b')],{'host':_0x6cab('0x1d'),'port':0x18eb});var socket=require(_0x6cab('0x1e'))(new Redis(config[_0x6cab('0x1b')]));require(_0x6cab('0x1f'))[_0x6cab('0x20')](socket);function respondWithStatusCode(_0x3bb017,_0x4301d1){_0x4301d1=_0x4301d1||0xcc;return function(_0x5d9e42){if(_0x5d9e42){return _0x3bb017[_0x6cab('0x21')](_0x4301d1);}return _0x3bb017[_0x6cab('0x22')](_0x4301d1)[_0x6cab('0x23')]();};}function respondWithResult(_0x117250,_0x30dbdf){_0x30dbdf=_0x30dbdf||0xc8;return function(_0x4c3a29){if(_0x4c3a29){return _0x117250[_0x6cab('0x22')](_0x30dbdf)['json'](_0x4c3a29);}};}function respondWithFilteredResult(_0x4505c3,_0x1772cb){return function(_0xb06925){if(_0xb06925){var _0x252baa=_0xb06925['count'],_0x519302=_0x1772cb[_0x6cab('0x24')],_0x4d9388=_0x1772cb[_0x6cab('0x24')]+_0x1772cb[_0x6cab('0x25')],_0x3e8818;if(_0x4d9388>=_0x252baa){_0x4d9388=_0x252baa;_0x3e8818=0xc8;}else{_0x3e8818=0xce;}_0x4505c3[_0x6cab('0x22')](_0x3e8818);return _0x4505c3[_0x6cab('0x26')](_0x6cab('0x27'),_0x519302+'-'+_0x4d9388+'/'+_0x252baa)[_0x6cab('0x28')](_0xb06925);}return null;};}function patchUpdates(_0x1d9287){return function(_0x563561){try{jsonpatch['apply'](_0x563561,_0x1d9287,!![]);}catch(_0x1ba3e8){return BPromise['reject'](_0x1ba3e8);}return _0x563561[_0x6cab('0x29')]();};}function saveUpdates(_0x3013b5,_0x181a23){return function(_0x4c2da8){if(_0x4c2da8){return _0x4c2da8['update'](_0x3013b5)[_0x6cab('0x2a')](function(_0x2b8a35){return _0x2b8a35;});}return null;};}function removeEntity(_0x4dd17b,_0x16aad5){return function(_0x2b6a70){if(_0x2b6a70){return _0x2b6a70[_0x6cab('0x2b')]()[_0x6cab('0x2a')](function(){var _0x4050bf=_0x2b6a70[_0x6cab('0x2c')]({'plain':!![]});var _0xa8a555=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x6cab('0x2d'),'ignore':![]}];var _0x2a15e1=_(_0xa8a555)[_0x6cab('0x2e')]('ignore')[_0x6cab('0x2f')](_0x6cab('0x30'))[_0x6cab('0x30')]();if(_[_0x6cab('0x31')](_0x2a15e1,_0x4050bf[_0x6cab('0x32')])){return;}var _0x5358cf=_[_0x6cab('0x33')](_0xa8a555,[_0x6cab('0x30'),_0x4050bf[_0x6cab('0x32')]])[_0x6cab('0x34')];return db[_0x6cab('0x35')]['destroy']({'where':{'type':_0x5358cf,'resourceId':_0x4050bf['id']}})[_0x6cab('0x2a')](function(){return _0x2b6a70;});})['then'](function(){_0x4dd17b['status'](0xcc)[_0x6cab('0x23')]();});}};}function handleEntityNotFound(_0x446604,_0x3c5d16){return function(_0x2cdd3d){if(!_0x2cdd3d){_0x446604[_0x6cab('0x21')](0x194);}return _0x2cdd3d;};}function handleError(_0x392da7,_0x565248){_0x565248=_0x565248||0x1f4;return function(_0x3ee72e){logger[_0x6cab('0x36')](_0x3ee72e[_0x6cab('0x37')]);if(_0x3ee72e[_0x6cab('0x34')]){delete _0x3ee72e[_0x6cab('0x34')];}_0x392da7[_0x6cab('0x22')](_0x565248)[_0x6cab('0x38')](_0x3ee72e);};}exports[_0x6cab('0x39')]=function(_0x38ed40,_0x26fcfc){var _0x502a3a={},_0x2e0405={},_0x4128b6={'count':0x0,'rows':[]};var _0x90771=_[_0x6cab('0x2f')](db['VoiceExtension']['rawAttributes'],function(_0x3209f7){return{'name':_0x3209f7['fieldName'],'type':_0x3209f7[_0x6cab('0x32')][_0x6cab('0x3a')]};});_0x2e0405['model']=_['map'](_0x90771,_0x6cab('0x34'));_0x2e0405[_0x6cab('0x3b')]=_[_0x6cab('0x3c')](_0x38ed40[_0x6cab('0x3b')]);_0x2e0405[_0x6cab('0x3d')]=_[_0x6cab('0x3e')](_0x2e0405[_0x6cab('0x3f')],_0x2e0405[_0x6cab('0x3b')]);_0x502a3a['attributes']=_[_0x6cab('0x3e')](_0x2e0405[_0x6cab('0x3f')],qs['fields'](_0x38ed40[_0x6cab('0x3b')][_0x6cab('0x40')]));_0x502a3a['attributes']=_0x502a3a[_0x6cab('0x41')][_0x6cab('0x42')]?_0x502a3a[_0x6cab('0x41')]:_0x2e0405['model'];if(!_0x38ed40[_0x6cab('0x3b')][_0x6cab('0x43')](_0x6cab('0x44'))){_0x502a3a[_0x6cab('0x25')]=qs[_0x6cab('0x25')](_0x38ed40[_0x6cab('0x3b')][_0x6cab('0x25')]);_0x502a3a['offset']=qs['offset'](_0x38ed40[_0x6cab('0x3b')]['offset']);}_0x502a3a['order']=qs[_0x6cab('0x45')](_0x38ed40[_0x6cab('0x3b')]['sort']);_0x502a3a[_0x6cab('0x46')]=qs['filters'](_['pick'](_0x38ed40[_0x6cab('0x3b')],_0x2e0405[_0x6cab('0x3d')]),_0x90771);if(_0x38ed40[_0x6cab('0x3b')][_0x6cab('0x2e')]){_0x502a3a[_0x6cab('0x46')]=_[_0x6cab('0x47')](_0x502a3a[_0x6cab('0x46')],{'$or':_[_0x6cab('0x2f')](_0x90771,function(_0x26b6ee){if(_0x26b6ee[_0x6cab('0x32')]!==_0x6cab('0x48')){var _0x1a4723={};_0x1a4723[_0x26b6ee['name']]={'$like':'%'+_0x38ed40[_0x6cab('0x3b')]['filter']+'%'};return _0x1a4723;}})});}_0x502a3a=_[_0x6cab('0x47')]({},_0x502a3a,_0x38ed40[_0x6cab('0x49')]);var _0x1d4353={'where':_0x502a3a[_0x6cab('0x46')]};return db['VoiceExtension']['count'](_0x1d4353)['then'](function(_0x557053){_0x4128b6[_0x6cab('0x4a')]=_0x557053;if(_0x38ed40[_0x6cab('0x3b')][_0x6cab('0x4b')]){_0x502a3a[_0x6cab('0x4c')]=[{'all':!![]}];}return db[_0x6cab('0x4d')][_0x6cab('0x4e')](_0x502a3a);})[_0x6cab('0x2a')](function(_0x5d63f8){_0x4128b6[_0x6cab('0x4f')]=_0x5d63f8;return _0x4128b6;})[_0x6cab('0x2a')](respondWithFilteredResult(_0x26fcfc,_0x502a3a))[_0x6cab('0x50')](handleError(_0x26fcfc,null));};exports['show']=function(_0x50f4a0,_0x3dc329){var _0x4ba113={'raw':![],'where':{'id':_0x50f4a0[_0x6cab('0x51')]['id']}},_0x14c154={};_0x14c154['model']=_[_0x6cab('0x3c')](db[_0x6cab('0x4d')][_0x6cab('0x52')]);_0x14c154[_0x6cab('0x3b')]=_[_0x6cab('0x3c')](_0x50f4a0['query']);_0x14c154[_0x6cab('0x3d')]=_[_0x6cab('0x3e')](_0x14c154[_0x6cab('0x3f')],_0x14c154[_0x6cab('0x3b')]);_0x4ba113['attributes']=_['intersection'](_0x14c154[_0x6cab('0x3f')],qs[_0x6cab('0x40')](_0x50f4a0['query'][_0x6cab('0x40')]));_0x4ba113[_0x6cab('0x41')]=_0x4ba113[_0x6cab('0x41')][_0x6cab('0x42')]?_0x4ba113[_0x6cab('0x41')]:_0x14c154[_0x6cab('0x3f')];if(_0x50f4a0[_0x6cab('0x3b')][_0x6cab('0x4b')]){_0x4ba113[_0x6cab('0x4c')]=[{'all':!![]}];}_0x4ba113=_['merge']({},_0x4ba113,_0x50f4a0[_0x6cab('0x49')]);return db[_0x6cab('0x4d')][_0x6cab('0x33')](_0x4ba113)[_0x6cab('0x2a')](handleEntityNotFound(_0x3dc329,null))[_0x6cab('0x2a')](respondWithResult(_0x3dc329,null))[_0x6cab('0x50')](handleError(_0x3dc329,null));};exports[_0x6cab('0x2b')]=function(_0x3b34bf,_0x5c2bbd){return db[_0x6cab('0x4d')]['find']({'where':{'id':_0x3b34bf[_0x6cab('0x51')]['id']}})['then'](handleEntityNotFound(_0x5c2bbd,null))['then'](removeEntity(_0x5c2bbd,null))[_0x6cab('0x50')](handleError(_0x5c2bbd,null));};exports[_0x6cab('0x53')]=function(_0x2c4cb6,_0x81874c){if(_0x2c4cb6[_0x6cab('0x54')][_0x6cab('0x32')]===_0x6cab('0x55')&&!_[_0x6cab('0x56')](_0x2c4cb6[_0x6cab('0x54')][_0x6cab('0x57')],'_')){_0x2c4cb6['body'][_0x6cab('0x57')]='_'[_0x6cab('0x58')](_0x2c4cb6[_0x6cab('0x54')][_0x6cab('0x57')]);}return db['VoiceExtension']['create'](_0x2c4cb6[_0x6cab('0x54')],{'raw':![]})[_0x6cab('0x2a')](function(_0x35e0d5){var _0xc823d3=_0x2c4cb6['user']['get']({'plain':!![]});if(!_0xc823d3)throw new Error(_0x6cab('0x59'));if(_0xc823d3['role']===_0x6cab('0x5a')){var _0x1a7a19=_0x35e0d5[_0x6cab('0x2c')]({'plain':!![]});var _0x21a935=[{'name':'InboundRoutes','value':_0x6cab('0x5b')},{'name':'OutboundRoutes','value':_0x6cab('0x55')},{'name':_0x6cab('0x5c'),'value':'internal'}];var _0x429138=_[_0x6cab('0x33')](_0x21a935,[_0x6cab('0x30'),_0x1a7a19[_0x6cab('0x32')]])[_0x6cab('0x34')];return db[_0x6cab('0x5d')][_0x6cab('0x33')]({'where':{'name':_0x429138,'userProfileId':_0xc823d3[_0x6cab('0x5e')]},'raw':!![]})[_0x6cab('0x2a')](function(_0xa6117c){if(_0xa6117c&&_0xa6117c[_0x6cab('0x5f')]===0x0){return db[_0x6cab('0x35')]['create']({'name':_0x1a7a19[_0x6cab('0x34')],'resourceId':_0x1a7a19['id'],'type':_0xa6117c[_0x6cab('0x34')],'sectionId':_0xa6117c['id']},{})[_0x6cab('0x2a')](function(){return _0x35e0d5;});}else{return _0x35e0d5;}})['catch'](function(_0x35ec15){logger[_0x6cab('0x36')](_0x6cab('0x60'),_0x35ec15);throw _0x35ec15;});}return _0x35e0d5;})['then'](respondWithResult(_0x81874c,0xc9))[_0x6cab('0x50')](handleError(_0x81874c,null));};exports['update']=function(_0x3853bb,_0x57cb29){if(_0x3853bb[_0x6cab('0x54')]['id']){delete _0x3853bb[_0x6cab('0x54')]['id'];}return db['VoiceExtension'][_0x6cab('0x33')]({'where':{'id':_0x3853bb[_0x6cab('0x51')]['id']}})[_0x6cab('0x2a')](handleEntityNotFound(_0x57cb29,null))['then'](function(_0x4b9352){if(_0x4b9352){return db[_0x6cab('0x4d')][_0x6cab('0x61')](_[_0x6cab('0x62')](_0x3853bb[_0x6cab('0x54')],[_0x6cab('0x57'),'context','description',_0x6cab('0x63'),'cutdigits',_0x6cab('0x64')]),{'where':{'context':_0x4b9352[_0x6cab('0x65')],'exten':_0x4b9352[_0x6cab('0x57')]},'individualHooks':!![]})[_0x6cab('0x2a')](function(_0x42e422){return _0x42e422;});}return null;})[_0x6cab('0x2a')](respondWithStatusCode(_0x57cb29,null))[_0x6cab('0x50')](handleError(_0x57cb29,null));};exports[_0x6cab('0x66')]=function(_0x497f70,_0x1f9eca,_0x3b447a){return db[_0x6cab('0x4d')]['findOne']({'where':{'id':_0x497f70[_0x6cab('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f9eca,null))[_0x6cab('0x2a')](function(_0x4ddc81){if(_0x4ddc81){return db[_0x6cab('0x67')][_0x6cab('0x68')](function(_0x13c340){return db[_0x6cab('0x4d')][_0x6cab('0x2b')]({'where':{'VoiceExtensionId':_0x497f70['params']['id']},'transaction':_0x13c340})[_0x6cab('0x2a')](function(_0x21bce6){var _0x39a1d0=_[_0x6cab('0x2f')](_0x497f70[_0x6cab('0x54')],function(_0x574471){_0x574471[_0x6cab('0x69')]=_0x497f70[_0x6cab('0x51')]['id'];return _0x574471;});return db[_0x6cab('0x4d')][_0x6cab('0x6a')](_0x39a1d0,{'transaction':_0x13c340});});})[_0x6cab('0x2a')](function(){return db[_0x6cab('0x4d')][_0x6cab('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x497f70['params']['id']},'order':_0x6cab('0x6c')});});}})[_0x6cab('0x2a')](respondWithResult(_0x1f9eca,null))[_0x6cab('0x50')](handleError(_0x1f9eca,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index c791b77..a545b80 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 _0xbd8f=['update','remove','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0xb4d573,_0x36f850){var _0x55cbab=function(_0x1a78ca){while(--_0x1a78ca){_0xb4d573['push'](_0xb4d573['shift']());}};_0x55cbab(++_0x36f850);}(_0xbd8f,0xca));var _0xfbd8=function(_0x1c16ee,_0xefb5ba){_0x1c16ee=_0x1c16ee-0x0;var _0x1a8f88=_0xbd8f[_0x1c16ee];return _0x1a8f88;};'use strict';var EventEmitter=require(_0xfbd8('0x0'));var VoiceExtension=require(_0xfbd8('0x1'))['db'][_0xfbd8('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfbd8('0x3')](0x0);var events={'afterCreate':_0xfbd8('0x4'),'afterUpdate':_0xfbd8('0x5'),'afterDestroy':_0xfbd8('0x6')};function emitEvent(_0x27b398){return function(_0x32512b,_0x585a17,_0x5178ce){VoiceExtensionEvents['emit'](_0x27b398+':'+_0x32512b['id'],_0x32512b);VoiceExtensionEvents['emit'](_0x27b398,_0x32512b);_0x5178ce(null);};}for(var e in events){if(events[_0xfbd8('0x7')](e)){var event=events[e];VoiceExtension[_0xfbd8('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xe8a7=['events','../../mysqldb','VoiceExtension','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2a7d15,_0x5627a0){var _0x17092c=function(_0x262376){while(--_0x262376){_0x2a7d15['push'](_0x2a7d15['shift']());}};_0x17092c(++_0x5627a0);}(_0xe8a7,0x87));var _0x7e8a=function(_0x4ea61a,_0x1eb61b){_0x4ea61a=_0x4ea61a-0x0;var _0x46c957=_0xe8a7[_0x4ea61a];return _0x46c957;};'use strict';var EventEmitter=require(_0x7e8a('0x0'));var VoiceExtension=require(_0x7e8a('0x1'))['db'][_0x7e8a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7e8a('0x3'),'afterUpdate':'update','afterDestroy':_0x7e8a('0x4')};function emitEvent(_0x21c6cb){return function(_0x4464cd,_0xd46df9,_0x497307){VoiceExtensionEvents['emit'](_0x21c6cb+':'+_0x4464cd['id'],_0x4464cd);VoiceExtensionEvents[_0x7e8a('0x5')](_0x21c6cb,_0x4464cd);_0x497307(null);};}for(var e in events){if(events[_0x7e8a('0x6')](e)){var event=events[e];VoiceExtension[_0x7e8a('0x7')](e,emitEvent(event));}}module[_0x7e8a('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index b5d7a2c..c6cbfe0 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 _0xa5d0=['VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports'];(function(_0x48e458,_0x44559e){var _0x1f5413=function(_0x3de21a){while(--_0x3de21a){_0x48e458['push'](_0x48e458['shift']());}};_0x1f5413(++_0x44559e);}(_0xa5d0,0x1d0));var _0x0a5d=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xa5d0[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x0a5d('0x0'));var util=require(_0x0a5d('0x1'));var logger=require(_0x0a5d('0x2'))(_0x0a5d('0x3'));var moment=require(_0x0a5d('0x4'));var BPromise=require(_0x0a5d('0x5'));var rp=require(_0x0a5d('0x6'));var fs=require('fs');var path=require(_0x0a5d('0x7'));var rimraf=require(_0x0a5d('0x8'));var config=require(_0x0a5d('0x9'));var attributes=require(_0x0a5d('0xa'));module[_0x0a5d('0xb')]=function(_0x3e26e7,_0x3f2339){return _0x3e26e7['define'](_0x0a5d('0xc'),attributes,{'tableName':_0x0a5d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04af=['rimraf','../../config/environment','./voiceExtension.attributes','exports','define','voice_extensions','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0x04af,0x186));var _0xf04a=function(_0x9ba8d1,_0x29fea5){_0x9ba8d1=_0x9ba8d1-0x0;var _0x15f1d8=_0x04af[_0x9ba8d1];return _0x15f1d8;};'use strict';var _=require('lodash');var util=require(_0xf04a('0x0'));var logger=require(_0xf04a('0x1'))('api');var moment=require(_0xf04a('0x2'));var BPromise=require(_0xf04a('0x3'));var rp=require(_0xf04a('0x4'));var fs=require('fs');var path=require(_0xf04a('0x5'));var rimraf=require(_0xf04a('0x6'));var config=require(_0xf04a('0x7'));var attributes=require(_0xf04a('0x8'));module[_0xf04a('0x9')]=function(_0x361d80,_0x45a820){return _0x361d80[_0xf04a('0xa')]('VoiceExtension',attributes,{'tableName':_0xf04a('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 8bd8320..32eef75 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 _0x3eff=['client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x255e47,_0x468858){var _0xed0f81=function(_0xfdb684){while(--_0xfdb684){_0x255e47['push'](_0x255e47['shift']());}};_0xed0f81(++_0x468858);}(_0x3eff,0x10e));var _0xf3ef=function(_0x44caf2,_0x8ffb16){_0x44caf2=_0x44caf2-0x0;var _0x25978d=_0x3eff[_0x44caf2];return _0x25978d;};'use strict';var _=require(_0xf3ef('0x0'));var util=require(_0xf3ef('0x1'));var moment=require(_0xf3ef('0x2'));var BPromise=require(_0xf3ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3ef('0x4'));var db=require(_0xf3ef('0x5'))['db'];var utils=require(_0xf3ef('0x6'));var logger=require(_0xf3ef('0x7'))(_0xf3ef('0x8'));var config=require(_0xf3ef('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf3ef('0xa')][_0xf3ef('0xb')]({'port':0x232a});config['redis']=_[_0xf3ef('0xc')](config[_0xf3ef('0xd')],{'host':_0xf3ef('0xe'),'port':0x18eb});var socket=require(_0xf3ef('0xf'))(new Redis(config[_0xf3ef('0xd')]));require(_0xf3ef('0x10'))[_0xf3ef('0x11')](socket);function respondWithRpcPromise(_0x3ad281,_0x24356e,_0x49cad2){return new BPromise(function(_0x294af7,_0x19f381){return client[_0xf3ef('0x12')](_0x3ad281,_0x49cad2)['then'](function(_0x2dfbe6){logger[_0xf3ef('0x13')](_0xf3ef('0x14'),_0x24356e,_0xf3ef('0x15'));logger[_0xf3ef('0x16')](_0xf3ef('0x17'),_0x24356e,_0xf3ef('0x15'),JSON[_0xf3ef('0x18')](_0x2dfbe6));if(_0x2dfbe6['error']){if(_0x2dfbe6[_0xf3ef('0x19')][_0xf3ef('0x1a')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x24356e,_0x2dfbe6['error'][_0xf3ef('0x1b')]);return _0x19f381(_0x2dfbe6[_0xf3ef('0x19')][_0xf3ef('0x1b')]);}logger[_0xf3ef('0x19')](_0xf3ef('0x14'),_0x24356e,_0x2dfbe6['error']['message']);return _0x294af7(_0x2dfbe6[_0xf3ef('0x19')][_0xf3ef('0x1b')]);}else{logger[_0xf3ef('0x13')](_0xf3ef('0x14'),_0x24356e,_0xf3ef('0x15'));_0x294af7(_0x2dfbe6[_0xf3ef('0x1c')][_0xf3ef('0x1b')]);}})[_0xf3ef('0x1d')](function(_0x1366e9){logger[_0xf3ef('0x19')](_0xf3ef('0x14'),_0x24356e,_0x1366e9);_0x19f381(_0x1366e9);});});}exports[_0xf3ef('0x1e')]=function(_0x40a837){var _0x3ecda2=this;return new Promise(function(_0x6f46a7,_0x58f68f){return db[_0xf3ef('0x1f')]['findAll']({'raw':_0x40a837['options']?_0x40a837[_0xf3ef('0x20')][_0xf3ef('0x21')]===undefined?!![]:![]:!![],'where':_0x40a837[_0xf3ef('0x20')]?_0x40a837[_0xf3ef('0x20')][_0xf3ef('0x22')]||null:null,'attributes':_0x40a837[_0xf3ef('0x20')]?_0x40a837[_0xf3ef('0x20')][_0xf3ef('0x23')]||null:null,'limit':_0x40a837[_0xf3ef('0x20')]?_0x40a837[_0xf3ef('0x20')]['limit']||null:null,'include':_0x40a837['options']?_0x40a837[_0xf3ef('0x20')][_0xf3ef('0x24')]?_[_0xf3ef('0x25')](_0x40a837[_0xf3ef('0x20')][_0xf3ef('0x24')],function(_0x4dc72b){return{'model':db[_0x4dc72b['model']],'as':_0x4dc72b['as'],'attributes':_0x4dc72b[_0xf3ef('0x23')],'include':_0x4dc72b['include']?_[_0xf3ef('0x25')](_0x4dc72b['include'],function(_0x4927fc){return{'model':db[_0x4927fc[_0xf3ef('0x26')]],'as':_0x4927fc['as'],'attributes':_0x4927fc['attributes'],'include':_0x4927fc[_0xf3ef('0x24')]?_[_0xf3ef('0x25')](_0x4927fc[_0xf3ef('0x24')],function(_0x280c76){return{'model':db[_0x280c76[_0xf3ef('0x26')]],'as':_0x280c76['as'],'attributes':_0x280c76[_0xf3ef('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf3ef('0x27')](function(_0x4d7061){logger[_0xf3ef('0x13')](_0xf3ef('0x1e'),_0x40a837);logger[_0xf3ef('0x16')](_0xf3ef('0x1e'),_0x40a837,JSON[_0xf3ef('0x18')](_0x4d7061));_0x6f46a7(_0x4d7061);})[_0xf3ef('0x1d')](function(_0x36548d){logger[_0xf3ef('0x19')](_0xf3ef('0x1e'),_0x36548d['message'],_0x40a837);_0x58f68f(_0x3ecda2[_0xf3ef('0x19')](0x1f4,_0x36548d[_0xf3ef('0x1b')]));});});}; \ No newline at end of file +var _0x0c59=['debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','limit','map','include','model','attributes','info'];(function(_0x49f725,_0x53fe0f){var _0x89c707=function(_0x35c705){while(--_0x35c705){_0x49f725['push'](_0x49f725['shift']());}};_0x89c707(++_0x53fe0f);}(_0x0c59,0x17e));var _0x90c5=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x0c59[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require(_0x90c5('0x0'));var util=require(_0x90c5('0x1'));var moment=require(_0x90c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x90c5('0x3'));var fs=require('fs');var Redis=require(_0x90c5('0x4'));var db=require(_0x90c5('0x5'))['db'];var utils=require(_0x90c5('0x6'));var logger=require(_0x90c5('0x7'))(_0x90c5('0x8'));var config=require(_0x90c5('0x9'));var jayson=require(_0x90c5('0xa'));var client=jayson[_0x90c5('0xb')][_0x90c5('0xc')]({'port':0x232a});config[_0x90c5('0xd')]=_[_0x90c5('0xe')](config[_0x90c5('0xd')],{'host':_0x90c5('0xf'),'port':0x18eb});var socket=require(_0x90c5('0x10'))(new Redis(config[_0x90c5('0xd')]));require(_0x90c5('0x11'))[_0x90c5('0x12')](socket);function respondWithRpcPromise(_0x54f13a,_0x1426f2,_0x416795){return new BPromise(function(_0x48419e,_0x5c25ea){return client['request'](_0x54f13a,_0x416795)['then'](function(_0x57fab4){logger['info'](_0x90c5('0x13'),_0x1426f2,'request\x20sent');logger['debug'](_0x90c5('0x14'),_0x1426f2,_0x90c5('0x15'),JSON['stringify'](_0x57fab4));if(_0x57fab4[_0x90c5('0x16')]){if(_0x57fab4[_0x90c5('0x16')]['code']===0x1f4){logger[_0x90c5('0x16')](_0x90c5('0x13'),_0x1426f2,_0x57fab4[_0x90c5('0x16')][_0x90c5('0x17')]);return _0x5c25ea(_0x57fab4[_0x90c5('0x16')][_0x90c5('0x17')]);}logger[_0x90c5('0x16')](_0x90c5('0x13'),_0x1426f2,_0x57fab4[_0x90c5('0x16')]['message']);return _0x48419e(_0x57fab4[_0x90c5('0x16')][_0x90c5('0x17')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x1426f2,_0x90c5('0x15'));_0x48419e(_0x57fab4[_0x90c5('0x18')][_0x90c5('0x17')]);}})[_0x90c5('0x19')](function(_0x2b30db){logger[_0x90c5('0x16')](_0x90c5('0x13'),_0x1426f2,_0x2b30db);_0x5c25ea(_0x2b30db);});});}exports[_0x90c5('0x1a')]=function(_0x237f14){var _0x1fb866=this;return new Promise(function(_0x7c65ae,_0x21f116){return db[_0x90c5('0x1b')][_0x90c5('0x1c')]({'raw':_0x237f14[_0x90c5('0x1d')]?_0x237f14[_0x90c5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x237f14[_0x90c5('0x1d')]?_0x237f14['options']['where']||null:null,'attributes':_0x237f14[_0x90c5('0x1d')]?_0x237f14[_0x90c5('0x1d')]['attributes']||null:null,'limit':_0x237f14[_0x90c5('0x1d')]?_0x237f14[_0x90c5('0x1d')][_0x90c5('0x1e')]||null:null,'include':_0x237f14[_0x90c5('0x1d')]?_0x237f14[_0x90c5('0x1d')]['include']?_[_0x90c5('0x1f')](_0x237f14[_0x90c5('0x1d')][_0x90c5('0x20')],function(_0x2dfac9){return{'model':db[_0x2dfac9[_0x90c5('0x21')]],'as':_0x2dfac9['as'],'attributes':_0x2dfac9[_0x90c5('0x22')],'include':_0x2dfac9[_0x90c5('0x20')]?_[_0x90c5('0x1f')](_0x2dfac9['include'],function(_0x19b94c){return{'model':db[_0x19b94c[_0x90c5('0x21')]],'as':_0x19b94c['as'],'attributes':_0x19b94c[_0x90c5('0x22')],'include':_0x19b94c['include']?_['map'](_0x19b94c[_0x90c5('0x20')],function(_0xe30c94){return{'model':db[_0xe30c94[_0x90c5('0x21')]],'as':_0xe30c94['as'],'attributes':_0xe30c94[_0x90c5('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x383591){logger[_0x90c5('0x23')](_0x90c5('0x1a'),_0x237f14);logger[_0x90c5('0x24')](_0x90c5('0x1a'),_0x237f14,JSON[_0x90c5('0x25')](_0x383591));_0x7c65ae(_0x383591);})[_0x90c5('0x19')](function(_0x342957){logger[_0x90c5('0x16')](_0x90c5('0x1a'),_0x342957[_0x90c5('0x17')],_0x237f14);_0x21f116(_0x1fb866[_0x90c5('0x16')](0x1f4,_0x342957[_0x90c5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4a660ae..2f181dd 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 _0x2338=['emit','removeListener','register','./voiceExtension.events','remove'];(function(_0x449dad,_0x9662a2){var _0x521a86=function(_0x3fee0a){while(--_0x3fee0a){_0x449dad['push'](_0x449dad['shift']());}};_0x521a86(++_0x9662a2);}(_0x2338,0x102));var _0x8233=function(_0xdb2230,_0x36f784){_0xdb2230=_0xdb2230-0x0;var _0x4e833b=_0x2338[_0xdb2230];return _0x4e833b;};'use strict';var VoiceExtensionEvents=require(_0x8233('0x0'));var events=['save',_0x8233('0x1'),'update'];function createListener(_0x23c395,_0x19dcc6){return function(_0x5802cb){_0x19dcc6[_0x8233('0x2')](_0x23c395,_0x5802cb);};}function removeListener(_0x15e3a0,_0x4bb353){return function(){VoiceExtensionEvents[_0x8233('0x3')](_0x15e3a0,_0x4bb353);};}exports[_0x8233('0x4')]=function(_0x9d0fd8){for(var _0x2b137d=0x0,_0xfe142e=events['length'];_0x2b137d<_0xfe142e;_0x2b137d++){var _0x25cdf6=events[_0x2b137d];var _0x5dd068=createListener('voiceExtension:'+_0x25cdf6,_0x9d0fd8);VoiceExtensionEvents['on'](_0x25cdf6,_0x5dd068);}}; \ No newline at end of file +var _0xe66c=['emit','length','voiceExtension:','./voiceExtension.events','save','update'];(function(_0x28da6d,_0x75cbae){var _0x1a3770=function(_0x56e2f1){while(--_0x56e2f1){_0x28da6d['push'](_0x28da6d['shift']());}};_0x1a3770(++_0x75cbae);}(_0xe66c,0x1ad));var _0xce66=function(_0x2dc56b,_0x1607ee){_0x2dc56b=_0x2dc56b-0x0;var _0x894483=_0xe66c[_0x2dc56b];return _0x894483;};'use strict';var VoiceExtensionEvents=require(_0xce66('0x0'));var events=[_0xce66('0x1'),'remove',_0xce66('0x2')];function createListener(_0x203b66,_0x385cd9){return function(_0x77bf54){_0x385cd9[_0xce66('0x3')](_0x203b66,_0x77bf54);};}function removeListener(_0x1f3e7a,_0x5b47f4){return function(){VoiceExtensionEvents['removeListener'](_0x1f3e7a,_0x5b47f4);};}exports['register']=function(_0x1e6fda){for(var _0x4aeb9c=0x0,_0x2c26df=events[_0xce66('0x4')];_0x4aeb9c<_0x2c26df;_0x4aeb9c++){var _0x2f2353=events[_0x4aeb9c];var _0x31f314=createListener(_0xce66('0x5')+_0x2f2353,_0x1e6fda);VoiceExtensionEvents['on'](_0x2f2353,_0x31f314);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index dbc9da3..32b10c6 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 _0xcffe=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getMessages','post','create','update','delete','destroy','exports','multer'];(function(_0x49fb87,_0x5d65bb){var _0x17db71=function(_0x209c15){while(--_0x209c15){_0x49fb87['push'](_0x49fb87['shift']());}};_0x17db71(++_0x5d65bb);}(_0xcffe,0x1a1));var _0xecff=function(_0x561049,_0x330926){_0x561049=_0x561049-0x0;var _0x52f109=_0xcffe[_0x561049];return _0x52f109;};'use strict';var multer=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var path=require(_0xecff('0x2'));var timeout=require(_0xecff('0x3'));var express=require(_0xecff('0x4'));var router=express[_0xecff('0x5')]();var fs_extra=require(_0xecff('0x6'));var auth=require(_0xecff('0x7'));var interaction=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0xecff('0xa')](),controller[_0xecff('0xb')]);router[_0xecff('0xc')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0xe')]);router[_0xecff('0xc')]('/:id/messages',auth[_0xecff('0xa')](),controller[_0xecff('0xf')]);router[_0xecff('0x10')]('/',auth[_0xecff('0xa')](),controller[_0xecff('0x11')]);router['put'](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0x12')]);router[_0xecff('0x13')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0x14')]);module[_0xecff('0x15')]=router; \ No newline at end of file +var _0x7072=['isAuthenticated','index','/:id','show','/:id/messages','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMail.controller','get'];(function(_0x2e4e7b,_0x4b93c4){var _0x4232a0=function(_0x20083e){while(--_0x20083e){_0x2e4e7b['push'](_0x2e4e7b['shift']());}};_0x4232a0(++_0x4b93c4);}(_0x7072,0x138));var _0x2707=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7072[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0x7')](_0x2707('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2707('0xd')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0x10')]);router[_0x2707('0x11')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0x12')]);module[_0x2707('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 7e3bff5..6706809 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36ee=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x2e94c8,_0x3b4270){var _0x30eb6e=function(_0x16e51d){while(--_0x16e51d){_0x2e94c8['push'](_0x2e94c8['shift']());}};_0x30eb6e(++_0x3b4270);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xe36e('0x0')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xe36e('0x1'),'unique':_0xe36e('0x2')},'mailbox':{'type':Sequelize[_0xe36e('0x0')],'defaultValue':'','allowNull':![],'unique':_0xe36e('0x2')},'password':{'type':Sequelize[_0xe36e('0x0')]},'fullname':{'type':Sequelize[_0xe36e('0x0')]},'email':{'type':Sequelize[_0xe36e('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3f29e1){this[_0xe36e('0x3')](_0xe36e('0x4'),typeof _0x3f29e1===_0xe36e('0x5')&&_0x3f29e1[_0xe36e('0x6')]()?_0x3f29e1['trim']():null);}},'pager':{'type':Sequelize[_0xe36e('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xe36e('0x7')},'attach':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe36e('0x0')]},'callback':{'type':Sequelize[_0xe36e('0x0')]},'review':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe36e('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xe36e('0x9'),'no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'stamp':{'type':_0xe36e('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xe36e('0x0')]},'maxsecs':{'type':Sequelize[_0xe36e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe36e('0xd')],'get':function(){return this['getDataValue'](_0xe36e('0xe'))+_0xe36e('0xf')+this['getDataValue'](_0xe36e('0x10'));}}}; \ No newline at end of file +var _0x0713=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x5159fd,_0x4b760b){var _0x409bae=function(_0x30f5f0){while(--_0x30f5f0){_0x5159fd['push'](_0x5159fd['shift']());}};_0x409bae(++_0x4b760b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3071('0x0')]},'context':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x1'),'unique':_0x3071('0x2')},'mailbox':{'type':Sequelize[_0x3071('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3071('0x0')]},'fullname':{'type':Sequelize[_0x3071('0x0')]},'email':{'type':Sequelize[_0x3071('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3137c8){this[_0x3071('0x3')](_0x3071('0x4'),typeof _0x3137c8===_0x3071('0x5')&&_0x3137c8[_0x3071('0x6')]()?_0x3137c8[_0x3071('0x6')]():null);}},'pager':{'type':Sequelize[_0x3071('0x0')]},'tz':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x7')},'attach':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3071('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'stamp':{'type':_0x3071('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3071('0x0')]},'maxsecs':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3071('0xc')],'get':function(){return this[_0x3071('0xd')](_0x3071('0xe'))+_0x3071('0xf')+this[_0x3071('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index dd34739..3f75c6f 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 _0xaebd=['hasOwnProperty','order','sort','where','filters','pick','merge','filter','includeAll','show','params','include','options','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','destroy','UserProfileResource','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length'];(function(_0x56dfaf,_0x55aff1){var _0x43b0b9=function(_0x56e699){while(--_0x56e699){_0x56dfaf['push'](_0x56dfaf['shift']());}};_0x43b0b9(++_0x55aff1);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4b0d4f,_0x11eaf8){_0x4b0d4f=_0x4b0d4f-0x0;var _0x4cd28f=_0xaebd[_0x4b0d4f];return _0x4cd28f;};'use strict';var pdf=require(_0xdaeb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdaeb('0x1'));var zipdir=require(_0xdaeb('0x2'));var jsonpatch=require(_0xdaeb('0x3'));var rp=require(_0xdaeb('0x4'));var moment=require(_0xdaeb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdaeb('0x6'));var util=require(_0xdaeb('0x7'));var path=require(_0xdaeb('0x8'));var sox=require(_0xdaeb('0x9'));var csv=require(_0xdaeb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdaeb('0xb'));var _=require(_0xdaeb('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdaeb('0xd'));var deskjs=require(_0xdaeb('0xe'));var toCsv=require(_0xdaeb('0xa'));var querystring=require('querystring');var Papa=require(_0xdaeb('0xf'));var Redis=require('ioredis');var authService=require(_0xdaeb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdaeb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaeb('0x12'))(_0xdaeb('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdaeb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ee3cc,_0x2673db){_0x2673db=_0x2673db||0xcc;return function(_0x330cc6){if(_0x330cc6){return _0x4ee3cc[_0xdaeb('0x15')](_0x2673db);}return _0x4ee3cc[_0xdaeb('0x16')](_0x2673db)[_0xdaeb('0x17')]();};}function respondWithResult(_0xc6c611,_0x49ba9a){_0x49ba9a=_0x49ba9a||0xc8;return function(_0x57b091){if(_0x57b091){return _0xc6c611[_0xdaeb('0x16')](_0x49ba9a)[_0xdaeb('0x18')](_0x57b091);}};}function respondWithFilteredResult(_0x34b2fe,_0x18ec4e){return function(_0x538a25){if(_0x538a25){var _0x4c3bf3=_0x538a25[_0xdaeb('0x19')],_0x24b898=_0x18ec4e[_0xdaeb('0x1a')],_0x4dd803=_0x18ec4e[_0xdaeb('0x1a')]+_0x18ec4e[_0xdaeb('0x1b')],_0x47984b;if(_0x4dd803>=_0x4c3bf3){_0x4dd803=_0x4c3bf3;_0x47984b=0xc8;}else{_0x47984b=0xce;}_0x34b2fe[_0xdaeb('0x16')](_0x47984b);return _0x34b2fe[_0xdaeb('0x1c')]('Content-Range',_0x24b898+'-'+_0x4dd803+'/'+_0x4c3bf3)[_0xdaeb('0x18')](_0x538a25);}return null;};}function patchUpdates(_0x5ccf66){return function(_0x16d5e3){try{jsonpatch[_0xdaeb('0x1d')](_0x16d5e3,_0x5ccf66,!![]);}catch(_0x18bd81){return BPromise['reject'](_0x18bd81);}return _0x16d5e3['save']();};}function saveUpdates(_0x13563c,_0x26d433){return function(_0x23fccb){if(_0x23fccb){return _0x23fccb[_0xdaeb('0x1e')](_0x13563c)[_0xdaeb('0x1f')](function(_0x536aae){return _0x536aae;});}return null;};}function removeEntity(_0x597bb7,_0x2c969d){return function(_0x3cfcaf){if(_0x3cfcaf){return _0x3cfcaf[_0xdaeb('0x20')]()[_0xdaeb('0x1f')](function(){var _0x39dfae=_0x3cfcaf['get']({'plain':!![]});var _0x254c3b='Voicemails';return db[_0xdaeb('0x21')][_0xdaeb('0x20')]({'where':{'type':_0x254c3b,'resourceId':_0x39dfae['id']}})[_0xdaeb('0x1f')](function(){return _0x3cfcaf;});})[_0xdaeb('0x1f')](function(){_0x597bb7[_0xdaeb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0b9c,_0x34fa21){return function(_0x338687){if(!_0x338687){_0x3a0b9c['sendStatus'](0x194);}return _0x338687;};}function handleError(_0x57c2c4,_0x43095f){_0x43095f=_0x43095f||0x1f4;return function(_0x4e7f44){logger['error'](_0x4e7f44[_0xdaeb('0x22')]);if(_0x4e7f44[_0xdaeb('0x23')]){delete _0x4e7f44[_0xdaeb('0x23')];}_0x57c2c4['status'](_0x43095f)['send'](_0x4e7f44);};}exports[_0xdaeb('0x24')]=function(_0x440022,_0x37f468){var _0x596c19={},_0x36c933={},_0x510607={'count':0x0,'rows':[]};var _0x4da82d=_[_0xdaeb('0x25')](db[_0xdaeb('0x26')][_0xdaeb('0x27')],function(_0x28c15c){return{'name':_0x28c15c[_0xdaeb('0x28')],'type':_0x28c15c[_0xdaeb('0x29')][_0xdaeb('0x2a')]};});_0x36c933['model']=_[_0xdaeb('0x25')](_0x4da82d,_0xdaeb('0x23'));_0x36c933[_0xdaeb('0x2b')]=_[_0xdaeb('0x2c')](_0x440022[_0xdaeb('0x2b')]);_0x36c933['filters']=_[_0xdaeb('0x2d')](_0x36c933[_0xdaeb('0x2e')],_0x36c933['query']);_0x596c19[_0xdaeb('0x2f')]=_[_0xdaeb('0x2d')](_0x36c933[_0xdaeb('0x2e')],qs[_0xdaeb('0x30')](_0x440022[_0xdaeb('0x2b')][_0xdaeb('0x30')]));_0x596c19[_0xdaeb('0x2f')]=_0x596c19[_0xdaeb('0x2f')][_0xdaeb('0x31')]?_0x596c19[_0xdaeb('0x2f')]:_0x36c933['model'];if(!_0x440022['query'][_0xdaeb('0x32')]('nolimit')){_0x596c19[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x440022[_0xdaeb('0x2b')][_0xdaeb('0x1b')]);_0x596c19[_0xdaeb('0x1a')]=qs[_0xdaeb('0x1a')](_0x440022['query'][_0xdaeb('0x1a')]);}_0x596c19[_0xdaeb('0x33')]=qs[_0xdaeb('0x34')](_0x440022['query'][_0xdaeb('0x34')]);_0x596c19[_0xdaeb('0x35')]=qs[_0xdaeb('0x36')](_[_0xdaeb('0x37')](_0x440022[_0xdaeb('0x2b')],_0x36c933[_0xdaeb('0x36')]),_0x4da82d);if(_0x440022[_0xdaeb('0x2b')]['filter']){_0x596c19[_0xdaeb('0x35')]=_[_0xdaeb('0x38')](_0x596c19['where'],{'$or':_['map'](_0x4da82d,function(_0x2ef310){if(_0x2ef310[_0xdaeb('0x29')]!=='VIRTUAL'){var _0x1ba33c={};_0x1ba33c[_0x2ef310[_0xdaeb('0x23')]]={'$like':'%'+_0x440022['query'][_0xdaeb('0x39')]+'%'};return _0x1ba33c;}})});}_0x596c19=_[_0xdaeb('0x38')]({},_0x596c19,_0x440022['options']);var _0x597ae8={'where':_0x596c19[_0xdaeb('0x35')]};return db[_0xdaeb('0x26')][_0xdaeb('0x19')](_0x597ae8)[_0xdaeb('0x1f')](function(_0x2ea883){_0x510607[_0xdaeb('0x19')]=_0x2ea883;if(_0x440022['query'][_0xdaeb('0x3a')]){_0x596c19['include']=[{'all':!![]}];}return db[_0xdaeb('0x26')]['findAll'](_0x596c19);})['then'](function(_0x2b47d7){_0x510607['rows']=_0x2b47d7;return _0x510607;})[_0xdaeb('0x1f')](respondWithFilteredResult(_0x37f468,_0x596c19))['catch'](handleError(_0x37f468,null));};exports[_0xdaeb('0x3b')]=function(_0x244369,_0x4dd4ce){var _0x2dd241={'raw':!![],'where':{'id':_0x244369[_0xdaeb('0x3c')]['id']}},_0x4cf4df={};_0x4cf4df['model']=_[_0xdaeb('0x2c')](db[_0xdaeb('0x26')][_0xdaeb('0x27')]);_0x4cf4df['query']=_[_0xdaeb('0x2c')](_0x244369[_0xdaeb('0x2b')]);_0x4cf4df[_0xdaeb('0x36')]=_[_0xdaeb('0x2d')](_0x4cf4df[_0xdaeb('0x2e')],_0x4cf4df[_0xdaeb('0x2b')]);_0x2dd241[_0xdaeb('0x2f')]=_[_0xdaeb('0x2d')](_0x4cf4df[_0xdaeb('0x2e')],qs[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')][_0xdaeb('0x30')]));_0x2dd241['attributes']=_0x2dd241[_0xdaeb('0x2f')][_0xdaeb('0x31')]?_0x2dd241['attributes']:_0x4cf4df['model'];if(_0x244369[_0xdaeb('0x2b')][_0xdaeb('0x3a')]){_0x2dd241[_0xdaeb('0x3d')]=[{'all':!![]}];}_0x2dd241=_['merge']({},_0x2dd241,_0x244369[_0xdaeb('0x3e')]);return db[_0xdaeb('0x26')][_0xdaeb('0x3f')](_0x2dd241)[_0xdaeb('0x1f')](handleEntityNotFound(_0x4dd4ce,null))[_0xdaeb('0x1f')](respondWithResult(_0x4dd4ce,null))[_0xdaeb('0x40')](handleError(_0x4dd4ce,null));};exports[_0xdaeb('0x41')]=function(_0x2e4327,_0x5c3e65){return db[_0xdaeb('0x26')][_0xdaeb('0x41')](_0x2e4327['body'],{})[_0xdaeb('0x1f')](function(_0x4dd70c){var _0x403ca1=_0x2e4327[_0xdaeb('0x42')][_0xdaeb('0x43')]({'plain':!![]});if(!_0x403ca1)throw new Error(_0xdaeb('0x44'));if(_0x403ca1[_0xdaeb('0x45')]===_0xdaeb('0x42')){var _0x33a4d7=_0x4dd70c[_0xdaeb('0x43')]({'plain':!![]});var _0x2bd2fd='Voicemails';return db['UserProfileSection'][_0xdaeb('0x3f')]({'where':{'name':_0x2bd2fd,'userProfileId':_0x403ca1[_0xdaeb('0x46')]},'raw':!![]})[_0xdaeb('0x1f')](function(_0x1b742d){if(_0x1b742d&&_0x1b742d[_0xdaeb('0x47')]===0x0){return db[_0xdaeb('0x21')]['create']({'name':_0x33a4d7[_0xdaeb('0x23')],'resourceId':_0x33a4d7['id'],'type':_0x1b742d[_0xdaeb('0x23')],'sectionId':_0x1b742d['id']},{})[_0xdaeb('0x1f')](function(){return _0x4dd70c;});}else{return _0x4dd70c;}})['catch'](function(_0x428b72){logger['error'](_0xdaeb('0x48'),_0x428b72);throw _0x428b72;});}return _0x4dd70c;})[_0xdaeb('0x1f')](respondWithResult(_0x5c3e65,0xc9))[_0xdaeb('0x40')](handleError(_0x5c3e65,null));};exports[_0xdaeb('0x1e')]=function(_0x31eca9,_0x1547c8){if(_0x31eca9['body']['id']){delete _0x31eca9['body']['id'];}return db['VoiceMail'][_0xdaeb('0x3f')]({'where':{'id':_0x31eca9[_0xdaeb('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1547c8,null))['then'](saveUpdates(_0x31eca9['body'],null))[_0xdaeb('0x1f')](respondWithResult(_0x1547c8,null))[_0xdaeb('0x40')](handleError(_0x1547c8,null));};exports[_0xdaeb('0x20')]=function(_0x2afdb8,_0xb41ff5){return db['VoiceMail'][_0xdaeb('0x3f')]({'where':{'id':_0x2afdb8['params']['id']}})[_0xdaeb('0x1f')](handleEntityNotFound(_0xb41ff5,null))[_0xdaeb('0x1f')](removeEntity(_0xb41ff5,null))[_0xdaeb('0x40')](handleError(_0xb41ff5,null));};exports[_0xdaeb('0x49')]=function(_0x27dc44,_0x3a7b64,_0x51b98f){return db['VoiceMail'][_0xdaeb('0x4a')]({'where':{'id':_0x27dc44['params']['id']}})[_0xdaeb('0x1f')](handleEntityNotFound(_0x3a7b64,null))[_0xdaeb('0x1f')](function(_0xe81879){var _0x57374e;var _0x1dd297={},_0x325dcd={};_0x325dcd[_0xdaeb('0x2e')]=_[_0xdaeb('0x2c')](db[_0xdaeb('0x4b')][_0xdaeb('0x27')]);_0x325dcd[_0xdaeb('0x2b')]=_[_0xdaeb('0x2c')](_0x27dc44[_0xdaeb('0x2b')]);_0x325dcd['filters']=_[_0xdaeb('0x2d')](_0x325dcd[_0xdaeb('0x2e')],_0x325dcd[_0xdaeb('0x2b')]);_0x1dd297[_0xdaeb('0x2f')]=_['intersection'](_0x325dcd['model'],qs[_0xdaeb('0x30')](_0x27dc44[_0xdaeb('0x2b')][_0xdaeb('0x30')]));_0x1dd297[_0xdaeb('0x2f')]=_0x1dd297['attributes'][_0xdaeb('0x31')]?_0x1dd297['attributes']:_0x325dcd[_0xdaeb('0x2e')];if(!_0x27dc44['query'][_0xdaeb('0x32')]('nolimit')){_0x1dd297[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x27dc44[_0xdaeb('0x2b')][_0xdaeb('0x1b')]);_0x1dd297[_0xdaeb('0x1a')]=qs[_0xdaeb('0x1a')](_0x27dc44[_0xdaeb('0x2b')][_0xdaeb('0x1a')]);}_0x1dd297[_0xdaeb('0x33')]=qs[_0xdaeb('0x34')](_0x27dc44[_0xdaeb('0x2b')][_0xdaeb('0x34')]);_0x1dd297['where']=qs[_0xdaeb('0x36')](_[_0xdaeb('0x37')](_0x27dc44['query'],_0x325dcd[_0xdaeb('0x36')]));if(_0x27dc44['query'][_0xdaeb('0x39')]){_0x1dd297[_0xdaeb('0x35')]=_['merge'](_0x1dd297[_0xdaeb('0x35')],{'$or':_[_0xdaeb('0x25')](_0x1dd297[_0xdaeb('0x2f')],function(_0x285815){var _0x2af13d={};_0x2af13d[_0x285815]={'$like':'%'+_0x27dc44[_0xdaeb('0x2b')]['filter']+'%'};return _0x2af13d;})});}_0x1dd297[_0xdaeb('0x35')]=_[_0xdaeb('0x38')](_0x1dd297[_0xdaeb('0x35')],{'mailboxuser':_0xe81879[_0xdaeb('0x4c')]});_0x1dd297=_[_0xdaeb('0x38')]({},_0x1dd297,_0x27dc44[_0xdaeb('0x3e')]);return db[_0xdaeb('0x4b')]['findAndCountAll'](_0x1dd297)[_0xdaeb('0x1f')](respondWithFilteredResult(_0x3a7b64,_0x1dd297));})[_0xdaeb('0x40')](handleError(_0x3a7b64,null));}; \ No newline at end of file +var _0x896e=['fieldName','type','key','query','keys','intersection','attributes','model','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','getMessages','findOne','VoiceMailMessage','sort','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','set','Content-Range','apply','reject','update','then','get','Voicemails','UserProfileResource','destroy','status','error','name','send','index','map','VoiceMail','rawAttributes'];(function(_0x2aed25,_0x4c94a6){var _0x4b29b7=function(_0x5312b3){while(--_0x5312b3){_0x2aed25['push'](_0x2aed25['shift']());}};_0x4b29b7(++_0x4c94a6);}(_0x896e,0x1e9));var _0xe896=function(_0x2f018e,_0x2237f5){_0x2f018e=_0x2f018e-0x0;var _0x3c35b3=_0x896e[_0x2f018e];return _0x3c35b3;};'use strict';var pdf=require(_0xe896('0x0'));var emlformat=require(_0xe896('0x1'));var rimraf=require(_0xe896('0x2'));var zipdir=require(_0xe896('0x3'));var jsonpatch=require(_0xe896('0x4'));var rp=require(_0xe896('0x5'));var moment=require(_0xe896('0x6'));var BPromise=require(_0xe896('0x7'));var Mustache=require(_0xe896('0x8'));var util=require(_0xe896('0x9'));var path=require(_0xe896('0xa'));var sox=require(_0xe896('0xb'));var csv=require('to-csv');var ejs=require(_0xe896('0xc'));var fs=require('fs');var fs_extra=require(_0xe896('0xd'));var _=require(_0xe896('0xe'));var squel=require(_0xe896('0xf'));var crypto=require(_0xe896('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xe896('0x11'));var toCsv=require(_0xe896('0x12'));var querystring=require(_0xe896('0x13'));var Papa=require('papaparse');var Redis=require(_0xe896('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe896('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe896('0x16'));var logger=require(_0xe896('0x17'))(_0xe896('0x18'));var utils=require('../../config/utils');var config=require(_0xe896('0x19'));var licenseUtil=require(_0xe896('0x1a'));var db=require(_0xe896('0x1b'))['db'];function respondWithStatusCode(_0x580aac,_0x2aa522){_0x2aa522=_0x2aa522||0xcc;return function(_0x2f1c3e){if(_0x2f1c3e){return _0x580aac[_0xe896('0x1c')](_0x2aa522);}return _0x580aac['status'](_0x2aa522)[_0xe896('0x1d')]();};}function respondWithResult(_0x7dcf8a,_0x1e7ef8){_0x1e7ef8=_0x1e7ef8||0xc8;return function(_0x564758){if(_0x564758){return _0x7dcf8a['status'](_0x1e7ef8)[_0xe896('0x1e')](_0x564758);}};}function respondWithFilteredResult(_0x25606b,_0x51e7b7){return function(_0x5e78d6){if(_0x5e78d6){var _0x11f41c=_0x5e78d6['count'],_0x16e272=_0x51e7b7[_0xe896('0x1f')],_0x57f04b=_0x51e7b7[_0xe896('0x1f')]+_0x51e7b7[_0xe896('0x20')],_0x50d224;if(_0x57f04b>=_0x11f41c){_0x57f04b=_0x11f41c;_0x50d224=0xc8;}else{_0x50d224=0xce;}_0x25606b['status'](_0x50d224);return _0x25606b[_0xe896('0x21')](_0xe896('0x22'),_0x16e272+'-'+_0x57f04b+'/'+_0x11f41c)[_0xe896('0x1e')](_0x5e78d6);}return null;};}function patchUpdates(_0xbebbe1){return function(_0x2693d6){try{jsonpatch[_0xe896('0x23')](_0x2693d6,_0xbebbe1,!![]);}catch(_0x388c2e){return BPromise[_0xe896('0x24')](_0x388c2e);}return _0x2693d6['save']();};}function saveUpdates(_0x180d46,_0x5e1f29){return function(_0x5d2c8d){if(_0x5d2c8d){return _0x5d2c8d[_0xe896('0x25')](_0x180d46)[_0xe896('0x26')](function(_0x40502b){return _0x40502b;});}return null;};}function removeEntity(_0xeeec7c,_0x498469){return function(_0x468479){if(_0x468479){return _0x468479['destroy']()['then'](function(){var _0x45dd49=_0x468479[_0xe896('0x27')]({'plain':!![]});var _0x1e952a=_0xe896('0x28');return db[_0xe896('0x29')][_0xe896('0x2a')]({'where':{'type':_0x1e952a,'resourceId':_0x45dd49['id']}})[_0xe896('0x26')](function(){return _0x468479;});})['then'](function(){_0xeeec7c[_0xe896('0x2b')](0xcc)[_0xe896('0x1d')]();});}};}function handleEntityNotFound(_0xc3cd05,_0x569d5f){return function(_0x26635e){if(!_0x26635e){_0xc3cd05[_0xe896('0x1c')](0x194);}return _0x26635e;};}function handleError(_0x2bc11d,_0xe93aa0){_0xe93aa0=_0xe93aa0||0x1f4;return function(_0x2d8a7b){logger[_0xe896('0x2c')](_0x2d8a7b['stack']);if(_0x2d8a7b[_0xe896('0x2d')]){delete _0x2d8a7b[_0xe896('0x2d')];}_0x2bc11d[_0xe896('0x2b')](_0xe93aa0)[_0xe896('0x2e')](_0x2d8a7b);};}exports[_0xe896('0x2f')]=function(_0x5e0d9b,_0x47c268){var _0x5c7dae={},_0x504d7c={},_0x562ddd={'count':0x0,'rows':[]};var _0x291290=_[_0xe896('0x30')](db[_0xe896('0x31')][_0xe896('0x32')],function(_0x3cd88e){return{'name':_0x3cd88e[_0xe896('0x33')],'type':_0x3cd88e[_0xe896('0x34')][_0xe896('0x35')]};});_0x504d7c['model']=_['map'](_0x291290,_0xe896('0x2d'));_0x504d7c[_0xe896('0x36')]=_[_0xe896('0x37')](_0x5e0d9b[_0xe896('0x36')]);_0x504d7c['filters']=_[_0xe896('0x38')](_0x504d7c['model'],_0x504d7c['query']);_0x5c7dae[_0xe896('0x39')]=_[_0xe896('0x38')](_0x504d7c[_0xe896('0x3a')],qs['fields'](_0x5e0d9b['query']['fields']));_0x5c7dae[_0xe896('0x39')]=_0x5c7dae[_0xe896('0x39')][_0xe896('0x3b')]?_0x5c7dae[_0xe896('0x39')]:_0x504d7c[_0xe896('0x3a')];if(!_0x5e0d9b['query'][_0xe896('0x3c')](_0xe896('0x3d'))){_0x5c7dae[_0xe896('0x20')]=qs[_0xe896('0x20')](_0x5e0d9b[_0xe896('0x36')][_0xe896('0x20')]);_0x5c7dae[_0xe896('0x1f')]=qs[_0xe896('0x1f')](_0x5e0d9b['query'][_0xe896('0x1f')]);}_0x5c7dae[_0xe896('0x3e')]=qs['sort'](_0x5e0d9b[_0xe896('0x36')]['sort']);_0x5c7dae[_0xe896('0x3f')]=qs['filters'](_[_0xe896('0x40')](_0x5e0d9b['query'],_0x504d7c[_0xe896('0x41')]),_0x291290);if(_0x5e0d9b[_0xe896('0x36')][_0xe896('0x42')]){_0x5c7dae[_0xe896('0x3f')]=_[_0xe896('0x43')](_0x5c7dae['where'],{'$or':_['map'](_0x291290,function(_0x203aea){if(_0x203aea[_0xe896('0x34')]!==_0xe896('0x44')){var _0x15b6c5={};_0x15b6c5[_0x203aea[_0xe896('0x2d')]]={'$like':'%'+_0x5e0d9b['query']['filter']+'%'};return _0x15b6c5;}})});}_0x5c7dae=_[_0xe896('0x43')]({},_0x5c7dae,_0x5e0d9b[_0xe896('0x45')]);var _0x5890b1={'where':_0x5c7dae['where']};return db[_0xe896('0x31')][_0xe896('0x46')](_0x5890b1)[_0xe896('0x26')](function(_0x2ab0ac){_0x562ddd[_0xe896('0x46')]=_0x2ab0ac;if(_0x5e0d9b[_0xe896('0x36')][_0xe896('0x47')]){_0x5c7dae[_0xe896('0x48')]=[{'all':!![]}];}return db[_0xe896('0x31')][_0xe896('0x49')](_0x5c7dae);})[_0xe896('0x26')](function(_0x1bc76a){_0x562ddd['rows']=_0x1bc76a;return _0x562ddd;})[_0xe896('0x26')](respondWithFilteredResult(_0x47c268,_0x5c7dae))[_0xe896('0x4a')](handleError(_0x47c268,null));};exports['show']=function(_0x57366b,_0x5cd5a3){var _0x36449e={'raw':!![],'where':{'id':_0x57366b[_0xe896('0x4b')]['id']}},_0x2a354f={};_0x2a354f['model']=_[_0xe896('0x37')](db[_0xe896('0x31')]['rawAttributes']);_0x2a354f['query']=_['keys'](_0x57366b[_0xe896('0x36')]);_0x2a354f[_0xe896('0x41')]=_[_0xe896('0x38')](_0x2a354f[_0xe896('0x3a')],_0x2a354f[_0xe896('0x36')]);_0x36449e[_0xe896('0x39')]=_['intersection'](_0x2a354f[_0xe896('0x3a')],qs[_0xe896('0x4c')](_0x57366b['query'][_0xe896('0x4c')]));_0x36449e[_0xe896('0x39')]=_0x36449e[_0xe896('0x39')][_0xe896('0x3b')]?_0x36449e['attributes']:_0x2a354f[_0xe896('0x3a')];if(_0x57366b[_0xe896('0x36')][_0xe896('0x47')]){_0x36449e[_0xe896('0x48')]=[{'all':!![]}];}_0x36449e=_[_0xe896('0x43')]({},_0x36449e,_0x57366b[_0xe896('0x45')]);return db['VoiceMail'][_0xe896('0x4d')](_0x36449e)['then'](handleEntityNotFound(_0x5cd5a3,null))[_0xe896('0x26')](respondWithResult(_0x5cd5a3,null))[_0xe896('0x4a')](handleError(_0x5cd5a3,null));};exports[_0xe896('0x4e')]=function(_0x24b4f0,_0x252c27){return db[_0xe896('0x31')]['create'](_0x24b4f0[_0xe896('0x4f')],{})[_0xe896('0x26')](function(_0x4818cd){var _0x3373dc=_0x24b4f0[_0xe896('0x50')]['get']({'plain':!![]});if(!_0x3373dc)throw new Error(_0xe896('0x51'));if(_0x3373dc['role']===_0xe896('0x50')){var _0xb90690=_0x4818cd[_0xe896('0x27')]({'plain':!![]});var _0x22424d=_0xe896('0x28');return db['UserProfileSection'][_0xe896('0x4d')]({'where':{'name':_0x22424d,'userProfileId':_0x3373dc[_0xe896('0x52')]},'raw':!![]})[_0xe896('0x26')](function(_0x5e9ea6){if(_0x5e9ea6&&_0x5e9ea6[_0xe896('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0xb90690[_0xe896('0x2d')],'resourceId':_0xb90690['id'],'type':_0x5e9ea6[_0xe896('0x2d')],'sectionId':_0x5e9ea6['id']},{})['then'](function(){return _0x4818cd;});}else{return _0x4818cd;}})[_0xe896('0x4a')](function(_0x3d137b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d137b);throw _0x3d137b;});}return _0x4818cd;})[_0xe896('0x26')](respondWithResult(_0x252c27,0xc9))[_0xe896('0x4a')](handleError(_0x252c27,null));};exports['update']=function(_0x1d18f6,_0x2f1f1b){if(_0x1d18f6[_0xe896('0x4f')]['id']){delete _0x1d18f6[_0xe896('0x4f')]['id'];}return db[_0xe896('0x31')][_0xe896('0x4d')]({'where':{'id':_0x1d18f6[_0xe896('0x4b')]['id']}})[_0xe896('0x26')](handleEntityNotFound(_0x2f1f1b,null))[_0xe896('0x26')](saveUpdates(_0x1d18f6[_0xe896('0x4f')],null))[_0xe896('0x26')](respondWithResult(_0x2f1f1b,null))['catch'](handleError(_0x2f1f1b,null));};exports[_0xe896('0x2a')]=function(_0x2a23a2,_0x131c1c){return db[_0xe896('0x31')][_0xe896('0x4d')]({'where':{'id':_0x2a23a2[_0xe896('0x4b')]['id']}})[_0xe896('0x26')](handleEntityNotFound(_0x131c1c,null))[_0xe896('0x26')](removeEntity(_0x131c1c,null))[_0xe896('0x4a')](handleError(_0x131c1c,null));};exports[_0xe896('0x54')]=function(_0x3faf52,_0x26b78e,_0x5d8265){return db[_0xe896('0x31')][_0xe896('0x55')]({'where':{'id':_0x3faf52[_0xe896('0x4b')]['id']}})['then'](handleEntityNotFound(_0x26b78e,null))['then'](function(_0x4bf8d6){var _0x20f199;var _0x29aa11={},_0x20cadc={};_0x20cadc[_0xe896('0x3a')]=_['keys'](db[_0xe896('0x56')][_0xe896('0x32')]);_0x20cadc[_0xe896('0x36')]=_[_0xe896('0x37')](_0x3faf52['query']);_0x20cadc[_0xe896('0x41')]=_[_0xe896('0x38')](_0x20cadc['model'],_0x20cadc[_0xe896('0x36')]);_0x29aa11[_0xe896('0x39')]=_['intersection'](_0x20cadc['model'],qs[_0xe896('0x4c')](_0x3faf52[_0xe896('0x36')][_0xe896('0x4c')]));_0x29aa11[_0xe896('0x39')]=_0x29aa11[_0xe896('0x39')]['length']?_0x29aa11[_0xe896('0x39')]:_0x20cadc[_0xe896('0x3a')];if(!_0x3faf52[_0xe896('0x36')][_0xe896('0x3c')]('nolimit')){_0x29aa11['limit']=qs[_0xe896('0x20')](_0x3faf52[_0xe896('0x36')]['limit']);_0x29aa11[_0xe896('0x1f')]=qs['offset'](_0x3faf52[_0xe896('0x36')][_0xe896('0x1f')]);}_0x29aa11[_0xe896('0x3e')]=qs[_0xe896('0x57')](_0x3faf52[_0xe896('0x36')][_0xe896('0x57')]);_0x29aa11[_0xe896('0x3f')]=qs[_0xe896('0x41')](_[_0xe896('0x40')](_0x3faf52[_0xe896('0x36')],_0x20cadc[_0xe896('0x41')]));if(_0x3faf52[_0xe896('0x36')][_0xe896('0x42')]){_0x29aa11[_0xe896('0x3f')]=_[_0xe896('0x43')](_0x29aa11[_0xe896('0x3f')],{'$or':_[_0xe896('0x30')](_0x29aa11[_0xe896('0x39')],function(_0x27d90d){var _0x2bbb16={};_0x2bbb16[_0x27d90d]={'$like':'%'+_0x3faf52[_0xe896('0x36')][_0xe896('0x42')]+'%'};return _0x2bbb16;})});}_0x29aa11['where']=_['merge'](_0x29aa11[_0xe896('0x3f')],{'mailboxuser':_0x4bf8d6[_0xe896('0x58')]});_0x29aa11=_['merge']({},_0x29aa11,_0x3faf52[_0xe896('0x45')]);return db[_0xe896('0x56')][_0xe896('0x59')](_0x29aa11)[_0xe896('0x26')](respondWithFilteredResult(_0x26b78e,_0x29aa11));})[_0xe896('0x4a')](handleError(_0x26b78e,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a0d972e..6f5e54a 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 _0x6fad=['mailbox','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x57e2f7,_0x5dbc4a){var _0x22b9cc=function(_0x1eb64d){while(--_0x1eb64d){_0x57e2f7['push'](_0x57e2f7['shift']());}};_0x22b9cc(++_0x5dbc4a);}(_0x6fad,0x17a));var _0xd6fa=function(_0x7342e,_0x1c3fe7){_0x7342e=_0x7342e-0x0;var _0x524ece=_0x6fad[_0x7342e];return _0x524ece;};'use strict';var _=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var logger=require(_0xd6fa('0x2'))(_0xd6fa('0x3'));var moment=require(_0xd6fa('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xd6fa('0x7'));module['exports']=function(_0x37cb49,_0x2d73ee){return _0x37cb49[_0xd6fa('0x8')](_0xd6fa('0x9'),attributes,{'tableName':_0xd6fa('0xa'),'paranoid':![],'indexes':[{'name':_0xd6fa('0xb'),'fields':[_0xd6fa('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','context','util'];(function(_0x34996c,_0x175386){var _0x2de25c=function(_0x8ac394){while(--_0x8ac394){_0x34996c['push'](_0x34996c['shift']());}};_0x2de25c(++_0x175386);}(_0xb261,0x1b1));var _0x1b26=function(_0x430b24,_0x1f085e){_0x430b24=_0x430b24-0x0;var _0x5cee14=_0xb261[_0x430b24];return _0x5cee14;};'use strict';var _=require('lodash');var util=require(_0x1b26('0x0'));var logger=require(_0x1b26('0x1'))(_0x1b26('0x2'));var moment=require(_0x1b26('0x3'));var BPromise=require(_0x1b26('0x4'));var rp=require(_0x1b26('0x5'));var fs=require('fs');var path=require(_0x1b26('0x6'));var rimraf=require(_0x1b26('0x7'));var config=require('../../config/environment');var attributes=require(_0x1b26('0x8'));module[_0x1b26('0x9')]=function(_0x5d2bf7,_0x2a964d){return _0x5d2bf7[_0x1b26('0xa')](_0x1b26('0xb'),attributes,{'tableName':_0x1b26('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x1b26('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 39f0302..9496e02 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 _0x69e7=['http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4edc4e,_0x28d6fd){var _0x57eeef=function(_0x3bf543){while(--_0x3bf543){_0x4edc4e['push'](_0x4edc4e['shift']());}};_0x57eeef(++_0x28d6fd);}(_0x69e7,0xf2));var _0x769e=function(_0x27f0e3,_0x440303){_0x27f0e3=_0x27f0e3-0x0;var _0x1145c7=_0x69e7[_0x27f0e3];return _0x1145c7;};'use strict';var _=require(_0x769e('0x0'));var util=require(_0x769e('0x1'));var moment=require(_0x769e('0x2'));var BPromise=require(_0x769e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x769e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x769e('0x5'));var logger=require(_0x769e('0x6'))(_0x769e('0x7'));var config=require('../../config/environment');var jayson=require(_0x769e('0x8'));var client=jayson[_0x769e('0x9')][_0x769e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ada0,_0xd7fd9a,_0x20590b){return new BPromise(function(_0x12dd41,_0x3680e5){return client[_0x769e('0xb')](_0x54ada0,_0x20590b)[_0x769e('0xc')](function(_0xc472ce){logger[_0x769e('0xd')](_0x769e('0xe'),_0xd7fd9a,_0x769e('0xf'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0xd7fd9a,_0x769e('0xf'),JSON['stringify'](_0xc472ce));if(_0xc472ce[_0x769e('0x10')]){if(_0xc472ce[_0x769e('0x10')][_0x769e('0x11')]===0x1f4){logger[_0x769e('0x10')]('VoiceMail,\x20%s,\x20%s',_0xd7fd9a,_0xc472ce[_0x769e('0x10')][_0x769e('0x12')]);return _0x3680e5(_0xc472ce[_0x769e('0x10')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0xd7fd9a,_0xc472ce[_0x769e('0x10')]['message']);return _0x12dd41(_0xc472ce[_0x769e('0x10')][_0x769e('0x12')]);}else{logger[_0x769e('0xd')]('VoiceMail,\x20%s,\x20%s',_0xd7fd9a,'request\x20sent');_0x12dd41(_0xc472ce[_0x769e('0x13')]['message']);}})[_0x769e('0x14')](function(_0x500446){logger['error'](_0x769e('0xe'),_0xd7fd9a,_0x500446);_0x3680e5(_0x500446);});});} \ No newline at end of file +var _0xe26b=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x2dfd8a,_0x2fcc3e){var _0x4ed41d=function(_0x66111f){while(--_0x66111f){_0x2dfd8a['push'](_0x2dfd8a['shift']());}};_0x4ed41d(++_0x2fcc3e);}(_0xe26b,0x1cd));var _0xbe26=function(_0x3788b8,_0x2335c6){_0x3788b8=_0x3788b8-0x0;var _0x47e3bc=_0xe26b[_0x3788b8];return _0x47e3bc;};'use strict';var _=require(_0xbe26('0x0'));var util=require('util');var moment=require(_0xbe26('0x1'));var BPromise=require(_0xbe26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe26('0x3'));var db=require(_0xbe26('0x4'))['db'];var utils=require(_0xbe26('0x5'));var logger=require('../../config/logger')(_0xbe26('0x6'));var config=require(_0xbe26('0x7'));var jayson=require(_0xbe26('0x8'));var client=jayson[_0xbe26('0x9')][_0xbe26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4fc5,_0x449ca4,_0x513294){return new BPromise(function(_0x46fda0,_0x14f8a1){return client[_0xbe26('0xb')](_0x4c4fc5,_0x513294)[_0xbe26('0xc')](function(_0x4b673){logger['info'](_0xbe26('0xd'),_0x449ca4,_0xbe26('0xe'));logger[_0xbe26('0xf')](_0xbe26('0x10'),_0x449ca4,_0xbe26('0xe'),JSON['stringify'](_0x4b673));if(_0x4b673[_0xbe26('0x11')]){if(_0x4b673[_0xbe26('0x11')][_0xbe26('0x12')]===0x1f4){logger['error'](_0xbe26('0xd'),_0x449ca4,_0x4b673['error']['message']);return _0x14f8a1(_0x4b673[_0xbe26('0x11')][_0xbe26('0x13')]);}logger[_0xbe26('0x11')](_0xbe26('0xd'),_0x449ca4,_0x4b673[_0xbe26('0x11')]['message']);return _0x46fda0(_0x4b673[_0xbe26('0x11')][_0xbe26('0x13')]);}else{logger[_0xbe26('0x14')](_0xbe26('0xd'),_0x449ca4,'request\x20sent');_0x46fda0(_0x4b673[_0xbe26('0x15')][_0xbe26('0x13')]);}})[_0xbe26('0x16')](function(_0x56d953){logger['error'](_0xbe26('0xd'),_0x449ca4,_0x56d953);_0x14f8a1(_0x56d953);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c003534..f80c0db 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 _0x3754=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x229a96,_0x3bc4b2){var _0xdeaeea=function(_0x2d218e){while(--_0x2d218e){_0x229a96['push'](_0x229a96['shift']());}};_0xdeaeea(++_0x3bc4b2);}(_0x3754,0x1ca));var _0x4375=function(_0xdf4c9d,_0x46b006){_0xdf4c9d=_0xdf4c9d-0x0;var _0xe221f4=_0x3754[_0xdf4c9d];return _0xe221f4;};'use strict';var multer=require('multer');var util=require(_0x4375('0x0'));var path=require(_0x4375('0x1'));var timeout=require(_0x4375('0x2'));var express=require(_0x4375('0x3'));var router=express['Router']();var fs_extra=require(_0x4375('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4375('0x5'));var config=require(_0x4375('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x4375('0x7')]('/',auth[_0x4375('0x8')](),controller[_0x4375('0x9')]);router[_0x4375('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4375('0x7')](_0x4375('0xa'),auth['isAuthenticated'](),controller[_0x4375('0xb')]);router[_0x4375('0xc')]('/',auth[_0x4375('0x8')](),controller[_0x4375('0xd')]);router[_0x4375('0xe')](_0x4375('0xf'),auth['isAuthenticated'](),controller[_0x4375('0x10')]);router[_0x4375('0x11')]('/:id',auth[_0x4375('0x8')](),controller[_0x4375('0x12')]);module[_0x4375('0x13')]=router; \ No newline at end of file +var _0x68be=['./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x121521,_0x263a44){var _0x569c58=function(_0x333755){while(--_0x333755){_0x121521['push'](_0x121521['shift']());}};_0x569c58(++_0x263a44);}(_0x68be,0xa0));var _0xe68b=function(_0x17aac8,_0x1a4a8){_0x17aac8=_0x17aac8-0x0;var _0x661d4e=_0x68be[_0x17aac8];return _0x661d4e;};'use strict';var multer=require(_0xe68b('0x0'));var util=require(_0xe68b('0x1'));var path=require(_0xe68b('0x2'));var timeout=require(_0xe68b('0x3'));var express=require(_0xe68b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe68b('0x5'));var interaction=require(_0xe68b('0x6'));var config=require(_0xe68b('0x7'));var controller=require(_0xe68b('0x8'));router[_0xe68b('0x9')]('/',auth[_0xe68b('0xa')](),controller[_0xe68b('0xb')]);router[_0xe68b('0x9')]('/:id',auth[_0xe68b('0xa')](),controller[_0xe68b('0xc')]);router[_0xe68b('0x9')](_0xe68b('0xd'),auth[_0xe68b('0xa')](),controller[_0xe68b('0xe')]);router['post']('/',auth[_0xe68b('0xa')](),controller[_0xe68b('0xf')]);router[_0xe68b('0x10')](_0xe68b('0x11'),auth['isAuthenticated'](),controller[_0xe68b('0x12')]);router['delete']('/:id',auth[_0xe68b('0xa')](),controller[_0xe68b('0x13')]);module[_0xe68b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 462cc4c..2c384f3 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 _0xda71=['STRING','long','TIMESTAMP','literal','sequelize','exports','INTEGER'];(function(_0x130328,_0x51028e){var _0x2d3f68=function(_0x57fb22){while(--_0x57fb22){_0x130328['push'](_0x130328['shift']());}};_0x2d3f68(++_0x51028e);}(_0xda71,0xba));var _0x1da7=function(_0x574833,_0x33cc42){_0x574833=_0x574833-0x0;var _0x3a9357=_0xda71[_0x574833];return _0x3a9357;};'use strict';var Sequelize=require(_0x1da7('0x0'));module[_0x1da7('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2fe553){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x1da7('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x1da7('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1da7('0x3')],'defaultValue':''},'stamp':{'type':_0x1da7('0x5'),'defaultValue':Sequelize[_0x1da7('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xd9db=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER','STRING'];(function(_0x53ee43,_0x2a63ec){var _0x58b2ca=function(_0x35e8a0){while(--_0x35e8a0){_0x53ee43['push'](_0x53ee43['shift']());}};_0x58b2ca(++_0x2a63ec);}(_0xd9db,0x17d));var _0xbd9d=function(_0x4fe6be,_0x3ead62){_0x4fe6be=_0x4fe6be-0x0;var _0x5c19ba=_0xd9db[_0x4fe6be];return _0x5c19ba;};'use strict';var Sequelize=require(_0xbd9d('0x0'));module[_0xbd9d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1d73dc){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xbd9d('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xbd9d('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xbd9d('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xbd9d('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xbd9d('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xbd9d('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xbd9d('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xbd9d('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xbd9d('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xbd9d('0x5')](_0xbd9d('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d0c0e96..748abf8 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 _0x806b=['ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','download','recording','msg_id','Sequelize'];(function(_0x397fab,_0x34c89c){var _0x45d4e5=function(_0x13370b){while(--_0x13370b){_0x397fab['push'](_0x397fab['shift']());}};_0x45d4e5(++_0x34c89c);}(_0x806b,0x163));var _0xb806=function(_0x211885,_0x27c05a){_0x211885=_0x211885-0x0;var _0x2ca8a2=_0x806b[_0x211885];return _0x2ca8a2;};'use strict';var pdf=require(_0xb806('0x0'));var emlformat=require(_0xb806('0x1'));var rimraf=require(_0xb806('0x2'));var zipdir=require(_0xb806('0x3'));var jsonpatch=require(_0xb806('0x4'));var rp=require(_0xb806('0x5'));var moment=require(_0xb806('0x6'));var BPromise=require(_0xb806('0x7'));var Mustache=require('mustache');var util=require(_0xb806('0x8'));var path=require(_0xb806('0x9'));var sox=require(_0xb806('0xa'));var csv=require(_0xb806('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb806('0xc'));var _=require(_0xb806('0xd'));var squel=require('squel');var crypto=require(_0xb806('0xe'));var jsforce=require(_0xb806('0xf'));var deskjs=require(_0xb806('0x10'));var toCsv=require(_0xb806('0xb'));var querystring=require('querystring');var Papa=require(_0xb806('0x11'));var Redis=require('ioredis');var authService=require(_0xb806('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb806('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb806('0x14'))(_0xb806('0x15'));var utils=require(_0xb806('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb806('0x17'));var db=require(_0xb806('0x18'))['db'];function respondWithStatusCode(_0x5f46d4,_0x2b2f90){_0x2b2f90=_0x2b2f90||0xcc;return function(_0x44ddeb){if(_0x44ddeb){return _0x5f46d4['sendStatus'](_0x2b2f90);}return _0x5f46d4[_0xb806('0x19')](_0x2b2f90)[_0xb806('0x1a')]();};}function respondWithResult(_0x58fdc3,_0x282777){_0x282777=_0x282777||0xc8;return function(_0xede757){if(_0xede757){return _0x58fdc3[_0xb806('0x19')](_0x282777)[_0xb806('0x1b')](_0xede757);}};}function respondWithFilteredResult(_0x3d7ef9,_0x49b02c){return function(_0x549bb6){if(_0x549bb6){var _0x43b794=_0x549bb6[_0xb806('0x1c')],_0x56ef07=_0x49b02c[_0xb806('0x1d')],_0x131447=_0x49b02c['offset']+_0x49b02c[_0xb806('0x1e')],_0xcd5371;if(_0x131447>=_0x43b794){_0x131447=_0x43b794;_0xcd5371=0xc8;}else{_0xcd5371=0xce;}_0x3d7ef9[_0xb806('0x19')](_0xcd5371);return _0x3d7ef9[_0xb806('0x1f')](_0xb806('0x20'),_0x56ef07+'-'+_0x131447+'/'+_0x43b794)[_0xb806('0x1b')](_0x549bb6);}return null;};}function patchUpdates(_0x21ed1d){return function(_0x547aa7){try{jsonpatch[_0xb806('0x21')](_0x547aa7,_0x21ed1d,!![]);}catch(_0x2d945f){return BPromise['reject'](_0x2d945f);}return _0x547aa7[_0xb806('0x22')]();};}function saveUpdates(_0x2dbb8a,_0x1f4181){return function(_0x1f2841){if(_0x1f2841){return _0x1f2841['update'](_0x2dbb8a)[_0xb806('0x23')](function(_0x44e06e){return _0x44e06e;});}return null;};}function removeEntity(_0x201f1f,_0x49ae70){return function(_0x4c0c20){if(_0x4c0c20){return _0x4c0c20[_0xb806('0x24')]()[_0xb806('0x23')](function(){_0x201f1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5dac,_0x36e841){return function(_0x4a456f){if(!_0x4a456f){_0x4e5dac['sendStatus'](0x194);}return _0x4a456f;};}function handleError(_0x29a3bd,_0x3c4556){_0x3c4556=_0x3c4556||0x1f4;return function(_0x3c6d4a){logger[_0xb806('0x25')](_0x3c6d4a[_0xb806('0x26')]);if(_0x3c6d4a[_0xb806('0x27')]){delete _0x3c6d4a[_0xb806('0x27')];}_0x29a3bd[_0xb806('0x19')](_0x3c4556)[_0xb806('0x28')](_0x3c6d4a);};}exports['index']=function(_0x536d2d,_0x481826){var _0x49c53a={},_0xf3ed69={},_0x3114cc={'count':0x0,'rows':[]};var _0x512571=_[_0xb806('0x29')](db[_0xb806('0x2a')][_0xb806('0x2b')],function(_0x538ce4){return{'name':_0x538ce4[_0xb806('0x2c')],'type':_0x538ce4[_0xb806('0x2d')]['key']};});_0xf3ed69[_0xb806('0x2e')]=_[_0xb806('0x2f')](_[_0xb806('0x29')](_0x512571,_0xb806('0x27')),[_0xb806('0x27')]);_0xf3ed69[_0xb806('0x30')]=_[_0xb806('0x31')](_0x536d2d['query']);_0xf3ed69[_0xb806('0x32')]=_[_0xb806('0x33')](_0xf3ed69[_0xb806('0x2e')],_0xf3ed69['query']);_0x49c53a[_0xb806('0x34')]=_[_0xb806('0x33')](_0xf3ed69['model'],qs[_0xb806('0x35')](_0x536d2d['query'][_0xb806('0x35')]));_0x49c53a[_0xb806('0x34')]=_0x49c53a[_0xb806('0x34')][_0xb806('0x36')]?_0x49c53a[_0xb806('0x34')]:_0xf3ed69['model'];if(!_0x536d2d[_0xb806('0x30')][_0xb806('0x37')](_0xb806('0x38'))){_0x49c53a[_0xb806('0x1e')]=qs[_0xb806('0x1e')](_0x536d2d[_0xb806('0x30')][_0xb806('0x1e')]);_0x49c53a[_0xb806('0x1d')]=qs[_0xb806('0x1d')](_0x536d2d['query'][_0xb806('0x1d')]);}_0x49c53a[_0xb806('0x39')]=qs[_0xb806('0x3a')](_0x536d2d[_0xb806('0x30')][_0xb806('0x3a')]);_0x49c53a[_0xb806('0x3b')]=qs[_0xb806('0x32')](_[_0xb806('0x3c')](_0x536d2d[_0xb806('0x30')],_0xf3ed69['filters']),_0x512571);if(_0x536d2d[_0xb806('0x30')][_0xb806('0x3d')]){_0x49c53a[_0xb806('0x3b')]=_[_0xb806('0x3e')](_0x49c53a[_0xb806('0x3b')],{'$or':_[_0xb806('0x29')](_0x512571,function(_0x3e7b34){if(_0x3e7b34[_0xb806('0x2d')]!==_0xb806('0x3f')){var _0x176383={};_0x176383[_0x3e7b34[_0xb806('0x27')]]={'$like':'%'+_0x536d2d[_0xb806('0x30')][_0xb806('0x3d')]+'%'};return _0x176383;}})});}_0x49c53a=_[_0xb806('0x3e')]({},_0x49c53a,_0x536d2d[_0xb806('0x40')]);var _0x4a0c66={'where':_0x49c53a[_0xb806('0x3b')]};return db[_0xb806('0x2a')][_0xb806('0x1c')](_0x4a0c66)[_0xb806('0x23')](function(_0x5d829e){_0x3114cc[_0xb806('0x1c')]=_0x5d829e;if(_0x536d2d[_0xb806('0x30')][_0xb806('0x41')]){_0x49c53a[_0xb806('0x42')]=[{'all':!![]}];}return db[_0xb806('0x2a')][_0xb806('0x43')](_0x49c53a);})[_0xb806('0x23')](function(_0x1abec9){_0x3114cc[_0xb806('0x44')]=_0x1abec9;return _0x3114cc;})[_0xb806('0x23')](respondWithFilteredResult(_0x481826,_0x49c53a))[_0xb806('0x45')](handleError(_0x481826,null));};exports[_0xb806('0x46')]=function(_0xea92eb,_0x23dc64){var _0x441693={'raw':!![],'where':{'id':_0xea92eb[_0xb806('0x47')]['id']}},_0x3f0973={};_0x3f0973['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x3f0973[_0xb806('0x30')]=_['keys'](_0xea92eb[_0xb806('0x30')]);_0x3f0973[_0xb806('0x32')]=_[_0xb806('0x33')](_0x3f0973[_0xb806('0x2e')],_0x3f0973[_0xb806('0x30')]);_0x441693[_0xb806('0x34')]=_['intersection'](_0x3f0973['model'],qs[_0xb806('0x35')](_0xea92eb[_0xb806('0x30')][_0xb806('0x35')]));_0x441693[_0xb806('0x34')]=_0x441693[_0xb806('0x34')]['length']?_0x441693['attributes']:_0x3f0973[_0xb806('0x2e')];if(_0xea92eb[_0xb806('0x30')][_0xb806('0x41')]){_0x441693['include']=[{'all':!![]}];}_0x441693=_[_0xb806('0x3e')]({},_0x441693,_0xea92eb['options']);return db[_0xb806('0x2a')]['find'](_0x441693)['then'](handleEntityNotFound(_0x23dc64,null))['then'](respondWithResult(_0x23dc64,null))[_0xb806('0x45')](handleError(_0x23dc64,null));};exports['create']=function(_0x4ed157,_0x552485){return db['VoiceMailMessage'][_0xb806('0x48')](_0x4ed157[_0xb806('0x49')],{})[_0xb806('0x23')](respondWithResult(_0x552485,0xc9))['catch'](handleError(_0x552485,null));};exports[_0xb806('0x4a')]=function(_0x56226a,_0x3f7fc4){if(_0x56226a['body']['id']){delete _0x56226a['body']['id'];}return db[_0xb806('0x2a')][_0xb806('0x4b')]({'where':{'id':_0x56226a[_0xb806('0x47')]['id']}})[_0xb806('0x23')](handleEntityNotFound(_0x3f7fc4,null))[_0xb806('0x23')](saveUpdates(_0x56226a[_0xb806('0x49')],null))[_0xb806('0x23')](respondWithResult(_0x3f7fc4,null))[_0xb806('0x45')](handleError(_0x3f7fc4,null));};exports[_0xb806('0x24')]=function(_0x4a732e,_0x20317b){return db[_0xb806('0x2a')][_0xb806('0x4b')]({'where':{'id':_0x4a732e[_0xb806('0x47')]['id']}})['then'](handleEntityNotFound(_0x20317b,null))['then'](removeEntity(_0x20317b,null))[_0xb806('0x45')](handleError(_0x20317b,null));};exports[_0xb806('0x4c')]=function(_0x3164fb,_0x24e5ff,_0x5c8b2a){return db['VoiceMailMessage'][_0xb806('0x4b')]({'where':{'id':_0x3164fb[_0xb806('0x47')]['id']},'attributes':['id',_0xb806('0x4d'),_0xb806('0x4e')]})[_0xb806('0x23')](handleEntityNotFound(_0x24e5ff,null))[_0xb806('0x23')](function(_0x4a93f2){if(_0x4a93f2){if(!_0x4a93f2[_0xb806('0x4d')]){throw new db[(_0xb806('0x4f'))][(_0xb806('0x50'))](_0xb806('0x51'));}var _0x4b80e5={'Content-Type':_0xb806('0x52'),'Content-Disposition':_0xb806('0x53')};if(_0x4a93f2[_0xb806('0x4e')]){_0x4b80e5[_0xb806('0x54')]=_0xb806('0x55')+_0x4a93f2[_0xb806('0x4e')]+_0xb806('0x56');}_0x24e5ff['set'](_0x4b80e5);return _0x24e5ff[_0xb806('0x28')](new Buffer(_0x4a93f2[_0xb806('0x4d')]));}})[_0xb806('0x45')](handleError(_0x24e5ff,null));}; \ No newline at end of file +var _0x3f27=['attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','status','Content-Range','reject','save','update','then','destroy','end','error','stack','send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','body','recording','Sequelize','VoiceMailMessage\x20not\x20found','attachment','msg_id','Content-Disposition'];(function(_0x38323b,_0x5f79df){var _0x2b9af5=function(_0x576caa){while(--_0x576caa){_0x38323b['push'](_0x38323b['shift']());}};_0x2b9af5(++_0x5f79df);}(_0x3f27,0x1f4));var _0x73f2=function(_0x4e57f9,_0x14cf49){_0x4e57f9=_0x4e57f9-0x0;var _0x5c8c97=_0x3f27[_0x4e57f9];return _0x5c8c97;};'use strict';var pdf=require(_0x73f2('0x0'));var emlformat=require(_0x73f2('0x1'));var rimraf=require(_0x73f2('0x2'));var zipdir=require(_0x73f2('0x3'));var jsonpatch=require(_0x73f2('0x4'));var rp=require('request-promise');var moment=require(_0x73f2('0x5'));var BPromise=require(_0x73f2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x73f2('0x7'));var csv=require(_0x73f2('0x8'));var ejs=require(_0x73f2('0x9'));var fs=require('fs');var fs_extra=require(_0x73f2('0xa'));var _=require(_0x73f2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x73f2('0xc'));var deskjs=require(_0x73f2('0xd'));var toCsv=require(_0x73f2('0x8'));var querystring=require(_0x73f2('0xe'));var Papa=require(_0x73f2('0xf'));var Redis=require(_0x73f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x73f2('0x11'));var as=require(_0x73f2('0x12'));var hardwareService=require(_0x73f2('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x73f2('0x14'));var licenseUtil=require(_0x73f2('0x15'));var db=require(_0x73f2('0x16'))['db'];function respondWithStatusCode(_0x25e1bc,_0x454352){_0x454352=_0x454352||0xcc;return function(_0x467e75){if(_0x467e75){return _0x25e1bc[_0x73f2('0x17')](_0x454352);}return _0x25e1bc['status'](_0x454352)['end']();};}function respondWithResult(_0x469686,_0x45e8e0){_0x45e8e0=_0x45e8e0||0xc8;return function(_0x49d49b){if(_0x49d49b){return _0x469686['status'](_0x45e8e0)[_0x73f2('0x18')](_0x49d49b);}};}function respondWithFilteredResult(_0x39feae,_0x2a1ac6){return function(_0x262f51){if(_0x262f51){var _0x2c38b8=_0x262f51[_0x73f2('0x19')],_0x32ed42=_0x2a1ac6[_0x73f2('0x1a')],_0x32e9c6=_0x2a1ac6[_0x73f2('0x1a')]+_0x2a1ac6[_0x73f2('0x1b')],_0x205e3e;if(_0x32e9c6>=_0x2c38b8){_0x32e9c6=_0x2c38b8;_0x205e3e=0xc8;}else{_0x205e3e=0xce;}_0x39feae[_0x73f2('0x1c')](_0x205e3e);return _0x39feae['set'](_0x73f2('0x1d'),_0x32ed42+'-'+_0x32e9c6+'/'+_0x2c38b8)[_0x73f2('0x18')](_0x262f51);}return null;};}function patchUpdates(_0x13c6ec){return function(_0x17c4ef){try{jsonpatch['apply'](_0x17c4ef,_0x13c6ec,!![]);}catch(_0x1a75d3){return BPromise[_0x73f2('0x1e')](_0x1a75d3);}return _0x17c4ef[_0x73f2('0x1f')]();};}function saveUpdates(_0x2ae791,_0x5e3759){return function(_0xd80727){if(_0xd80727){return _0xd80727[_0x73f2('0x20')](_0x2ae791)[_0x73f2('0x21')](function(_0x55416e){return _0x55416e;});}return null;};}function removeEntity(_0x4a723b,_0x444b06){return function(_0x1788f2){if(_0x1788f2){return _0x1788f2[_0x73f2('0x22')]()['then'](function(){_0x4a723b['status'](0xcc)[_0x73f2('0x23')]();});}};}function handleEntityNotFound(_0xd5bb3b,_0x4c87dc){return function(_0x12f634){if(!_0x12f634){_0xd5bb3b[_0x73f2('0x17')](0x194);}return _0x12f634;};}function handleError(_0xdbff74,_0x4ecdc7){_0x4ecdc7=_0x4ecdc7||0x1f4;return function(_0x1b3f34){logger[_0x73f2('0x24')](_0x1b3f34[_0x73f2('0x25')]);if(_0x1b3f34['name']){delete _0x1b3f34['name'];}_0xdbff74['status'](_0x4ecdc7)[_0x73f2('0x26')](_0x1b3f34);};}exports[_0x73f2('0x27')]=function(_0x398593,_0x444efc){var _0x4168eb={},_0x3f784d={},_0x545fb5={'count':0x0,'rows':[]};var _0x2840f0=_[_0x73f2('0x28')](db['VoiceMailMessage'][_0x73f2('0x29')],function(_0x1a23a4){return{'name':_0x1a23a4[_0x73f2('0x2a')],'type':_0x1a23a4[_0x73f2('0x2b')][_0x73f2('0x2c')]};});_0x3f784d['model']=_[_0x73f2('0x2d')](_[_0x73f2('0x28')](_0x2840f0,'name'),['name']);_0x3f784d[_0x73f2('0x2e')]=_[_0x73f2('0x2f')](_0x398593[_0x73f2('0x2e')]);_0x3f784d['filters']=_['intersection'](_0x3f784d['model'],_0x3f784d['query']);_0x4168eb[_0x73f2('0x30')]=_['intersection'](_0x3f784d[_0x73f2('0x31')],qs[_0x73f2('0x32')](_0x398593[_0x73f2('0x2e')][_0x73f2('0x32')]));_0x4168eb['attributes']=_0x4168eb[_0x73f2('0x30')][_0x73f2('0x33')]?_0x4168eb[_0x73f2('0x30')]:_0x3f784d['model'];if(!_0x398593[_0x73f2('0x2e')][_0x73f2('0x34')](_0x73f2('0x35'))){_0x4168eb['limit']=qs[_0x73f2('0x1b')](_0x398593[_0x73f2('0x2e')][_0x73f2('0x1b')]);_0x4168eb[_0x73f2('0x1a')]=qs[_0x73f2('0x1a')](_0x398593[_0x73f2('0x2e')][_0x73f2('0x1a')]);}_0x4168eb[_0x73f2('0x36')]=qs[_0x73f2('0x37')](_0x398593['query']['sort']);_0x4168eb['where']=qs[_0x73f2('0x38')](_[_0x73f2('0x39')](_0x398593[_0x73f2('0x2e')],_0x3f784d['filters']),_0x2840f0);if(_0x398593[_0x73f2('0x2e')][_0x73f2('0x3a')]){_0x4168eb[_0x73f2('0x3b')]=_[_0x73f2('0x3c')](_0x4168eb[_0x73f2('0x3b')],{'$or':_['map'](_0x2840f0,function(_0x2ae8ce){if(_0x2ae8ce[_0x73f2('0x2b')]!==_0x73f2('0x3d')){var _0x42e3b5={};_0x42e3b5[_0x2ae8ce[_0x73f2('0x3e')]]={'$like':'%'+_0x398593[_0x73f2('0x2e')]['filter']+'%'};return _0x42e3b5;}})});}_0x4168eb=_[_0x73f2('0x3c')]({},_0x4168eb,_0x398593['options']);var _0x22a6fb={'where':_0x4168eb[_0x73f2('0x3b')]};return db[_0x73f2('0x3f')][_0x73f2('0x19')](_0x22a6fb)[_0x73f2('0x21')](function(_0x283ea1){_0x545fb5[_0x73f2('0x19')]=_0x283ea1;if(_0x398593[_0x73f2('0x2e')][_0x73f2('0x40')]){_0x4168eb[_0x73f2('0x41')]=[{'all':!![]}];}return db[_0x73f2('0x3f')][_0x73f2('0x42')](_0x4168eb);})['then'](function(_0x5183f7){_0x545fb5[_0x73f2('0x43')]=_0x5183f7;return _0x545fb5;})['then'](respondWithFilteredResult(_0x444efc,_0x4168eb))[_0x73f2('0x44')](handleError(_0x444efc,null));};exports[_0x73f2('0x45')]=function(_0x3cacb1,_0x4b9d44){var _0x5daea2={'raw':!![],'where':{'id':_0x3cacb1[_0x73f2('0x46')]['id']}},_0x3ab04d={};_0x3ab04d[_0x73f2('0x31')]=_[_0x73f2('0x2f')](db[_0x73f2('0x3f')][_0x73f2('0x29')]);_0x3ab04d['query']=_['keys'](_0x3cacb1[_0x73f2('0x2e')]);_0x3ab04d[_0x73f2('0x38')]=_[_0x73f2('0x47')](_0x3ab04d['model'],_0x3ab04d[_0x73f2('0x2e')]);_0x5daea2[_0x73f2('0x30')]=_[_0x73f2('0x47')](_0x3ab04d[_0x73f2('0x31')],qs['fields'](_0x3cacb1[_0x73f2('0x2e')]['fields']));_0x5daea2[_0x73f2('0x30')]=_0x5daea2['attributes'][_0x73f2('0x33')]?_0x5daea2['attributes']:_0x3ab04d[_0x73f2('0x31')];if(_0x3cacb1[_0x73f2('0x2e')][_0x73f2('0x40')]){_0x5daea2[_0x73f2('0x41')]=[{'all':!![]}];}_0x5daea2=_[_0x73f2('0x3c')]({},_0x5daea2,_0x3cacb1[_0x73f2('0x48')]);return db[_0x73f2('0x3f')][_0x73f2('0x49')](_0x5daea2)[_0x73f2('0x21')](handleEntityNotFound(_0x4b9d44,null))['then'](respondWithResult(_0x4b9d44,null))[_0x73f2('0x44')](handleError(_0x4b9d44,null));};exports['create']=function(_0x414c78,_0x216797){return db['VoiceMailMessage']['create'](_0x414c78[_0x73f2('0x4a')],{})[_0x73f2('0x21')](respondWithResult(_0x216797,0xc9))['catch'](handleError(_0x216797,null));};exports['update']=function(_0x3a39fa,_0x586f7a){if(_0x3a39fa[_0x73f2('0x4a')]['id']){delete _0x3a39fa['body']['id'];}return db[_0x73f2('0x3f')]['find']({'where':{'id':_0x3a39fa[_0x73f2('0x46')]['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x586f7a,null))[_0x73f2('0x21')](saveUpdates(_0x3a39fa[_0x73f2('0x4a')],null))['then'](respondWithResult(_0x586f7a,null))[_0x73f2('0x44')](handleError(_0x586f7a,null));};exports[_0x73f2('0x22')]=function(_0x574aaa,_0x1b58c7){return db[_0x73f2('0x3f')]['find']({'where':{'id':_0x574aaa[_0x73f2('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b58c7,null))['then'](removeEntity(_0x1b58c7,null))[_0x73f2('0x44')](handleError(_0x1b58c7,null));};exports['download']=function(_0x19bbbf,_0x340a46,_0x503f74){return db[_0x73f2('0x3f')][_0x73f2('0x49')]({'where':{'id':_0x19bbbf[_0x73f2('0x46')]['id']},'attributes':['id',_0x73f2('0x4b'),'msg_id']})['then'](handleEntityNotFound(_0x340a46,null))[_0x73f2('0x21')](function(_0x2eece4){if(_0x2eece4){if(!_0x2eece4[_0x73f2('0x4b')]){throw new db[(_0x73f2('0x4c'))]['ValidationError'](_0x73f2('0x4d'));}var _0x41f1f4={'Content-Type':'audio/wav','Content-Disposition':_0x73f2('0x4e')};if(_0x2eece4[_0x73f2('0x4f')]){_0x41f1f4[_0x73f2('0x50')]=_0x73f2('0x51')+_0x2eece4[_0x73f2('0x4f')]+_0x73f2('0x52');}_0x340a46['set'](_0x41f1f4);return _0x340a46['send'](new Buffer(_0x2eece4[_0x73f2('0x4b')]));}})['catch'](handleError(_0x340a46,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 040fc16..e0275a1 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 _0xf8aa=['../../config/logger','moment','path','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util'];(function(_0x2f97c6,_0x42a230){var _0x1506e7=function(_0x3df8fe){while(--_0x3df8fe){_0x2f97c6['push'](_0x2f97c6['shift']());}};_0x1506e7(++_0x42a230);}(_0xf8aa,0x1c1));var _0xaf8a=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf8aa[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xaf8a('0x0'));var util=require(_0xaf8a('0x1'));var logger=require(_0xaf8a('0x2'))('api');var moment=require(_0xaf8a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf8a('0x4'));var rimraf=require('rimraf');var config=require(_0xaf8a('0x5'));var attributes=require(_0xaf8a('0x6'));module[_0xaf8a('0x7')]=function(_0x48cecc,_0x50ebee){return _0x48cecc[_0xaf8a('0x8')]('VoiceMailMessage',attributes,{'tableName':_0xaf8a('0x9'),'paranoid':![],'indexes':[{'name':_0xaf8a('0xa'),'fields':[_0xaf8a('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x92a9=['dir','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0x92a9,0xcd));var _0x992a=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x92a9[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0x992a('0x0'));var util=require(_0x992a('0x1'));var logger=require(_0x992a('0x2'))(_0x992a('0x3'));var moment=require(_0x992a('0x4'));var BPromise=require('bluebird');var rp=require(_0x992a('0x5'));var fs=require('fs');var path=require(_0x992a('0x6'));var rimraf=require(_0x992a('0x7'));var config=require(_0x992a('0x8'));var attributes=require(_0x992a('0x9'));module['exports']=function(_0x3556e4,_0x4b2227){return _0x3556e4[_0x992a('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x992a('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 8d46073..a7cc92d 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 _0x0b0e=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x0b0e[_0x41ee16];return _0x1f60de;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xba3c8c,_0x31c11b){var _0x5283e9=function(_0x1d4d8e){while(--_0x1d4d8e){_0xba3c8c['push'](_0xba3c8c['shift']());}};_0x5283e9(++_0x31c11b);}(_0x57ca,0x108));var _0xa57c=function(_0x264eae,_0x558b68){_0x264eae=_0x264eae-0x0;var _0x2faffa=_0x57ca[_0x264eae];return _0x2faffa;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 70087a8..6cb39a3 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 _0x8bb5=['isAuthenticated','/:id','getSounds','post','create','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x238779,_0x12bfb3){var _0x320afe=function(_0x41f5a4){while(--_0x41f5a4){_0x238779['push'](_0x238779['shift']());}};_0x320afe(++_0x12bfb3);}(_0x8bb5,0x1da));var _0x58bb=function(_0x39202d,_0x1087b1){_0x39202d=_0x39202d-0x0;var _0x26bee8=_0x8bb5[_0x39202d];return _0x26bee8;};'use strict';var multer=require('multer');var util=require(_0x58bb('0x0'));var path=require(_0x58bb('0x1'));var timeout=require(_0x58bb('0x2'));var express=require(_0x58bb('0x3'));var router=express[_0x58bb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x58bb('0x5'));var config=require(_0x58bb('0x6'));var controller=require(_0x58bb('0x7'));router[_0x58bb('0x8')]('/',auth[_0x58bb('0x9')](),controller['index']);router['get'](_0x58bb('0xa'),auth[_0x58bb('0x9')](),controller['show']);router[_0x58bb('0x8')]('/:id/sounds',auth[_0x58bb('0x9')](),controller[_0x58bb('0xb')]);router[_0x58bb('0xc')]('/',auth[_0x58bb('0x9')](),controller[_0x58bb('0xd')]);router['post']('/:id/sounds',auth[_0x58bb('0x9')](),controller[_0x58bb('0xe')]);router['put'](_0x58bb('0xa'),auth[_0x58bb('0x9')](),controller[_0x58bb('0xf')]);router[_0x58bb('0x10')](_0x58bb('0xa'),auth[_0x58bb('0x9')](),controller[_0x58bb('0x11')]);router[_0x58bb('0x10')](_0x58bb('0x12'),auth[_0x58bb('0x9')](),controller[_0x58bb('0x13')]);module[_0x58bb('0x14')]=router; \ No newline at end of file +var _0x1098=['/:id/sounds','create','post','addSound','put','update','delete','destroy','removeSound','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1098,0x1ac));var _0x8109=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1098[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8109('0x0'));var util=require('util');var path=require(_0x8109('0x1'));var timeout=require('connect-timeout');var express=require(_0x8109('0x2'));var router=express[_0x8109('0x3')]();var fs_extra=require(_0x8109('0x4'));var auth=require(_0x8109('0x5'));var interaction=require(_0x8109('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8109('0x7')]);router[_0x8109('0x8')](_0x8109('0x9'),auth[_0x8109('0xa')](),controller[_0x8109('0xb')]);router[_0x8109('0x8')](_0x8109('0xc'),auth[_0x8109('0xa')](),controller['getSounds']);router['post']('/',auth[_0x8109('0xa')](),controller[_0x8109('0xd')]);router[_0x8109('0xe')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x8109('0xf')]);router[_0x8109('0x10')](_0x8109('0x9'),auth['isAuthenticated'](),controller[_0x8109('0x11')]);router[_0x8109('0x12')](_0x8109('0x9'),auth[_0x8109('0xa')](),controller[_0x8109('0x13')]);router[_0x8109('0x12')]('/:id/sounds/:id2',auth[_0x8109('0xa')](),controller[_0x8109('0x14')]);module[_0x8109('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 d67b1d7..491f476 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 _0x71c5=['ENUM','files','mp3nb','TIMESTAMP','BOOLEAN','exports','STRING','name'];(function(_0x5af88e,_0x4f18d1){var _0x296d1e=function(_0x7e63eb){while(--_0x7e63eb){_0x5af88e['push'](_0x5af88e['shift']());}};_0x296d1e(++_0x4f18d1);}(_0x71c5,0x8d));var _0x571c=function(_0x1e5557,_0x50bd53){_0x1e5557=_0x1e5557-0x0;var _0x5898fa=_0x71c5[_0x1e5557];return _0x5898fa;};'use strict';var Sequelize=require('sequelize');module[_0x571c('0x0')]={'name':{'type':Sequelize[_0x571c('0x1')],'allowNull':![],'unique':_0x571c('0x2')},'mode':{'type':Sequelize[_0x571c('0x3')]('custom',_0x571c('0x4'),_0x571c('0x5'),'quietmp3nb','quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x571c('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x571c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x571c('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x571c('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x571c('0x6')},'defaultEntry':{'type':Sequelize[_0x571c('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x127b=['exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN'];(function(_0x41e7cc,_0x3e893e){var _0x4a79cf=function(_0x2056d7){while(--_0x2056d7){_0x41e7cc['push'](_0x41e7cc['shift']());}};_0x4a79cf(++_0x3e893e);}(_0x127b,0x1bc));var _0xb127=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x127b[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require('sequelize');module[_0xb127('0x0')]={'name':{'type':Sequelize[_0xb127('0x1')],'allowNull':![],'unique':_0xb127('0x2')},'mode':{'type':Sequelize[_0xb127('0x3')](_0xb127('0x4'),_0xb127('0x5'),_0xb127('0x6'),_0xb127('0x7'),_0xb127('0x8'),_0xb127('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xb127('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xb127('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xb127('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xb127('0x1')],'allowNull':!![]},'stamp':{'type':_0xb127('0xa')},'defaultEntry':{'type':Sequelize[_0xb127('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index ea9c1ce..a644e34 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 _0x9957=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','params','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','%s.%s','symlinkSync','ValidationError','removeSound','id2','Sequelize','getSounds','length','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','model','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','body','find','create','sequelize','transaction','mode','files','root','server/files/moh','mkdirSync','directory'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var fs_extra=require(_0x7995('0xc'));var _=require(_0x7995('0xd'));var squel=require('squel');var crypto=require(_0x7995('0xe'));var jsforce=require(_0x7995('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7995('0xa'));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('../../config/license/hardware');var logger=require(_0x7995('0x16'))(_0x7995('0x17'));var utils=require('../../config/utils');var config=require(_0x7995('0x18'));var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x385f00,_0x281576){_0x281576=_0x281576||0xcc;return function(_0x23999f){if(_0x23999f){return _0x385f00[_0x7995('0x1b')](_0x281576);}return _0x385f00['status'](_0x281576)['end']();};}function respondWithResult(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xc8;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1c')](_0x2233dd)[_0x7995('0x1d')](_0x24b5bb);}};}function respondWithFilteredResult(_0x1a5310,_0x2202ce){return function(_0x41cbf0){if(_0x41cbf0){var _0x5377e5=_0x41cbf0[_0x7995('0x1e')],_0x2eeacc=_0x2202ce[_0x7995('0x1f')],_0x565d97=_0x2202ce[_0x7995('0x1f')]+_0x2202ce[_0x7995('0x20')],_0x2f832e;if(_0x565d97>=_0x5377e5){_0x565d97=_0x5377e5;_0x2f832e=0xc8;}else{_0x2f832e=0xce;}_0x1a5310[_0x7995('0x1c')](_0x2f832e);return _0x1a5310['set']('Content-Range',_0x2eeacc+'-'+_0x565d97+'/'+_0x5377e5)[_0x7995('0x1d')](_0x41cbf0);}return null;};}function patchUpdates(_0x5e6f90){return function(_0x555f74){try{jsonpatch[_0x7995('0x21')](_0x555f74,_0x5e6f90,!![]);}catch(_0x3d463e){return BPromise['reject'](_0x3d463e);}return _0x555f74[_0x7995('0x22')]();};}function saveUpdates(_0x51f276,_0x4b1a8e){return function(_0x3e4c54){if(_0x3e4c54){return _0x3e4c54[_0x7995('0x23')](_0x51f276)[_0x7995('0x24')](function(_0x1a8568){return _0x1a8568;});}return null;};}function removeEntity(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x25')]()[_0x7995('0x24')](function(){var _0x204507=_0x5d40ae[_0x7995('0x26')]({'plain':!![]});var _0x563799=_0x7995('0x27');return db[_0x7995('0x28')][_0x7995('0x25')]({'where':{'type':_0x563799,'resourceId':_0x204507['id']}})['then'](function(){return _0x5d40ae;});})[_0x7995('0x24')](function(){_0x460924[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x268ce7,_0x3a3fcf){return function(_0x2a307e){if(!_0x2a307e){_0x268ce7['sendStatus'](0x194);}return _0x2a307e;};}function handleError(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0x1f4;return function(_0x229742){logger[_0x7995('0x2a')](_0x229742[_0x7995('0x2b')]);if(_0x229742[_0x7995('0x2c')]){delete _0x229742[_0x7995('0x2c')];}_0x47625f['status'](_0x5911c3)[_0x7995('0x2d')](_0x229742);};}exports['index']=function(_0x456a28,_0x3250e0){var _0x4253e5={},_0x574574={},_0x530611={'count':0x0,'rows':[]};var _0x48e573=_[_0x7995('0x2e')](db[_0x7995('0x2f')][_0x7995('0x30')],function(_0x2b874d){return{'name':_0x2b874d[_0x7995('0x31')],'type':_0x2b874d[_0x7995('0x32')]['key']};});_0x574574['model']=_[_0x7995('0x2e')](_0x48e573,'name');_0x574574[_0x7995('0x33')]=_[_0x7995('0x34')](_0x456a28[_0x7995('0x33')]);_0x574574[_0x7995('0x35')]=_[_0x7995('0x36')](_0x574574['model'],_0x574574[_0x7995('0x33')]);_0x4253e5[_0x7995('0x37')]=_['intersection'](_0x574574['model'],qs['fields'](_0x456a28[_0x7995('0x33')][_0x7995('0x38')]));_0x4253e5['attributes']=_0x4253e5[_0x7995('0x37')]['length']?_0x4253e5[_0x7995('0x37')]:_0x574574[_0x7995('0x39')];if(!_0x456a28[_0x7995('0x33')]['hasOwnProperty']('nolimit')){_0x4253e5[_0x7995('0x20')]=qs['limit'](_0x456a28['query'][_0x7995('0x20')]);_0x4253e5[_0x7995('0x1f')]=qs['offset'](_0x456a28[_0x7995('0x33')][_0x7995('0x1f')]);}_0x4253e5[_0x7995('0x3a')]=qs[_0x7995('0x3b')](_0x456a28[_0x7995('0x33')]['sort']);_0x4253e5[_0x7995('0x3c')]=qs[_0x7995('0x35')](_[_0x7995('0x3d')](_0x456a28[_0x7995('0x33')],_0x574574['filters']),_0x48e573);if(_0x456a28[_0x7995('0x33')][_0x7995('0x3e')]){_0x4253e5[_0x7995('0x3c')]=_[_0x7995('0x3f')](_0x4253e5[_0x7995('0x3c')],{'$or':_[_0x7995('0x2e')](_0x48e573,function(_0x5688a1){if(_0x5688a1[_0x7995('0x32')]!==_0x7995('0x40')){var _0x8a1be0={};_0x8a1be0[_0x5688a1[_0x7995('0x2c')]]={'$like':'%'+_0x456a28[_0x7995('0x33')][_0x7995('0x3e')]+'%'};return _0x8a1be0;}})});}_0x4253e5=_[_0x7995('0x3f')]({},_0x4253e5,_0x456a28[_0x7995('0x41')]);var _0x1234e1={'where':_0x4253e5[_0x7995('0x3c')]};return db[_0x7995('0x2f')][_0x7995('0x1e')](_0x1234e1)[_0x7995('0x24')](function(_0x53cda2){_0x530611['count']=_0x53cda2;if(_0x456a28[_0x7995('0x33')][_0x7995('0x42')]){_0x4253e5['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x7995('0x43')](_0x4253e5);})['then'](function(_0x504a33){_0x530611[_0x7995('0x44')]=_0x504a33;return _0x530611;})[_0x7995('0x24')](respondWithFilteredResult(_0x3250e0,_0x4253e5))[_0x7995('0x45')](handleError(_0x3250e0,null));};exports['show']=function(_0x46ac4f,_0x5e85b9){var _0x3993b5={'raw':![],'where':{'id':_0x46ac4f['params']['id']}},_0x5a8881={};_0x5a8881[_0x7995('0x39')]=_[_0x7995('0x34')](db[_0x7995('0x2f')][_0x7995('0x30')]);_0x5a8881['query']=_[_0x7995('0x34')](_0x46ac4f[_0x7995('0x33')]);_0x5a8881[_0x7995('0x35')]=_[_0x7995('0x36')](_0x5a8881['model'],_0x5a8881['query']);_0x3993b5[_0x7995('0x37')]=_['intersection'](_0x5a8881[_0x7995('0x39')],qs['fields'](_0x46ac4f[_0x7995('0x33')]['fields']));_0x3993b5[_0x7995('0x37')]=_0x3993b5[_0x7995('0x37')]['length']?_0x3993b5[_0x7995('0x37')]:_0x5a8881[_0x7995('0x39')];if(_0x46ac4f[_0x7995('0x33')][_0x7995('0x42')]){_0x3993b5['include']=[{'all':!![]}];}_0x3993b5=_[_0x7995('0x3f')]({},_0x3993b5,_0x46ac4f[_0x7995('0x41')]);return db[_0x7995('0x2f')]['find'](_0x3993b5)[_0x7995('0x24')](handleEntityNotFound(_0x5e85b9,null))[_0x7995('0x24')](respondWithResult(_0x5e85b9,null))[_0x7995('0x45')](handleError(_0x5e85b9,null));};exports[_0x7995('0x23')]=function(_0x255313,_0x51934b){if(_0x255313[_0x7995('0x46')]['id']){delete _0x255313[_0x7995('0x46')]['id'];}return db['VoiceMusicOnHold'][_0x7995('0x47')]({'where':{'id':_0x255313['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x51934b,null))[_0x7995('0x24')](saveUpdates(_0x255313[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x51934b,null))[_0x7995('0x45')](handleError(_0x51934b,null));};exports[_0x7995('0x48')]=function(_0x1579b9,_0x4d46bc,_0x427dcf){return db[_0x7995('0x49')][_0x7995('0x4a')](function(_0x4ffc8a){if(_0x1579b9[_0x7995('0x46')][_0x7995('0x4b')]===_0x7995('0x4c')){_0x1579b9['body']['directory']=path['join'](config[_0x7995('0x4d')],_0x7995('0x4e'),_0x1579b9['body'][_0x7995('0x2c')]);}return db[_0x7995('0x2f')][_0x7995('0x48')](_0x1579b9[_0x7995('0x46')],{'transaction':_0x4ffc8a})[_0x7995('0x24')](function(_0x528c8e){if(_0x1579b9[_0x7995('0x46')]['mode']===_0x7995('0x4c')){fs[_0x7995('0x4f')](_0x528c8e[_0x7995('0x50')],parseInt('0777',0x8));}var _0x5e1f34=_0x1579b9['user']['get']({'plain':!![]});if(!_0x5e1f34)throw new Error(_0x7995('0x51'));if(_0x5e1f34[_0x7995('0x52')]===_0x7995('0x53')){var _0x150261=_0x528c8e[_0x7995('0x26')]({'plain':!![]});return db[_0x7995('0x54')][_0x7995('0x47')]({'where':{'name':_0x7995('0x27'),'userProfileId':_0x5e1f34[_0x7995('0x55')]},'raw':!![]})[_0x7995('0x24')](function(_0xa7af8c){if(_0xa7af8c&&_0xa7af8c[_0x7995('0x56')]===0x0){return db[_0x7995('0x28')][_0x7995('0x48')]({'name':_0x150261[_0x7995('0x2c')],'resourceId':_0x150261['id'],'type':_0xa7af8c[_0x7995('0x2c')],'sectionId':_0xa7af8c['id']},{})[_0x7995('0x24')](function(){return _0x528c8e;});}else{return _0x528c8e;}})[_0x7995('0x45')](function(_0x45e86e){logger['error'](_0x7995('0x57'),_0x45e86e);});}return _0x528c8e;});})[_0x7995('0x24')](respondWithResult(_0x4d46bc,0xc9))[_0x7995('0x45')](handleError(_0x4d46bc,null));};exports[_0x7995('0x25')]=function(_0x5d160d,_0x53125a,_0x402fa0){var _0x197b52;return db[_0x7995('0x2f')][_0x7995('0x47')]({'where':{'id':_0x5d160d['params']['id']}})[_0x7995('0x24')](function(_0x74ff38){if(_0x74ff38){return db[_0x7995('0x49')][_0x7995('0x4a')](function(_0x502d43){return _0x74ff38['destroy']({'transaction':_0x502d43,'raw':!![]})[_0x7995('0x24')](function(_0x398fac){if(_0x398fac[_0x7995('0x50')]){fs[_0x7995('0x58')](_0x398fac[_0x7995('0x50')])[_0x7995('0x59')](function(_0x1d4689){fs[_0x7995('0x5a')](path[_0x7995('0x5b')](_0x398fac['directory'],_0x1d4689));});fs[_0x7995('0x5c')](_0x398fac[_0x7995('0x50')]);}return _0x398fac;});})[_0x7995('0x45')](function(_0x1ecfdb){throw new db['Sequelize']['ValidationError'](_0x1ecfdb[_0x7995('0x5d')]);});}})[_0x7995('0x24')](handleEntityNotFound(_0x53125a,null))['then'](removeEntity(_0x53125a,null))[_0x7995('0x45')](handleError(_0x53125a,null));};exports[_0x7995('0x5e')]=function(_0x2e3421,_0x57727e,_0x32cb04){return db['sequelize'][_0x7995('0x4a')](function(_0x564fca){var _0x3e0a46;return db[_0x7995('0x2f')][_0x7995('0x47')]({'where':{'id':_0x2e3421[_0x7995('0x5f')]['id']}})[_0x7995('0x24')](function(_0xeb8920){if(_0xeb8920){_0x3e0a46=_0xeb8920;return _0xeb8920[_0x7995('0x5e')](_0x2e3421[_0x7995('0x46')]['id'],{'transaction':_0x564fca});}})[_0x7995('0x24')](function(_0x3f2bde){if(_0x3f2bde){return db[_0x7995('0x60')][_0x7995('0x61')]({'where':{'id':_0x2e3421['body']['id']},'attributes':['id',_0x7995('0x2c'),_0x7995('0x62'),_0x7995('0x63'),_0x7995('0x64')],'raw':!![]});}})[_0x7995('0x24')](function(_0x54a2e0){if(_0x54a2e0){var _0x4b54f2=path[_0x7995('0x5b')](config[_0x7995('0x4d')],_0x7995('0x65'),util[_0x7995('0x66')]('%s.%s',path[_0x7995('0x67')](_0x54a2e0['save_name'],path['extname'](_0x54a2e0[_0x7995('0x62')])),_0x54a2e0[_0x7995('0x63')]));var _0x3f0a71=path[_0x7995('0x5b')](config[_0x7995('0x4d')],_0x7995('0x4e'),_0x3e0a46[_0x7995('0x2c')],util[_0x7995('0x66')](_0x7995('0x68'),_0x54a2e0[_0x7995('0x2c')],_0x54a2e0['converted_format']));fs[_0x7995('0x69')](_0x4b54f2,_0x3f0a71);return _0x54a2e0;}})[_0x7995('0x45')](function(_0x3c5802){throw new db['Sequelize'][(_0x7995('0x6a'))](_0x3c5802[_0x7995('0x5d')]);});})[_0x7995('0x24')](handleEntityNotFound(_0x57727e,null))[_0x7995('0x24')](respondWithResult(_0x57727e,0xc9))[_0x7995('0x45')](handleError(_0x57727e,null));};exports[_0x7995('0x6b')]=function(_0x550a10,_0x3adfd2,_0x2f94c4){return db[_0x7995('0x49')][_0x7995('0x4a')](function(_0x535131){var _0x5e8b4c;return db[_0x7995('0x2f')][_0x7995('0x61')]({'where':{'id':_0x550a10[_0x7995('0x5f')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3adfd2,null))['then'](function(_0x3b45e8){if(_0x3b45e8){_0x5e8b4c=_0x3b45e8;return _0x3b45e8[_0x7995('0x6b')](_0x550a10['params']['id2']);}})[_0x7995('0x24')](function(_0x305b5a){if(_0x305b5a){return db['Sound'][_0x7995('0x61')]({'where':{'id':_0x550a10['params'][_0x7995('0x6c')]},'attributes':['id',_0x7995('0x2c'),'save_name','converted_format',_0x7995('0x64')],'raw':!![]});}})['then'](function(_0x31b9e6){if(_0x31b9e6){fs[_0x7995('0x5a')](path[_0x7995('0x5b')](_0x5e8b4c[_0x7995('0x50')],util[_0x7995('0x66')](_0x7995('0x68'),_0x31b9e6[_0x7995('0x2c')],_0x31b9e6[_0x7995('0x63')])));return _0x31b9e6;}})[_0x7995('0x45')](function(_0x117317){throw new db[(_0x7995('0x6d'))][(_0x7995('0x6a'))](_0x117317[_0x7995('0x5d')]);});})[_0x7995('0x24')](handleEntityNotFound(_0x3adfd2,null))[_0x7995('0x24')](respondWithStatusCode(_0x3adfd2,0xcc))[_0x7995('0x45')](handleError(_0x3adfd2,null));};exports[_0x7995('0x6e')]=function(_0x251490,_0x2ff7ba,_0xa2fc8e){var _0x306fa9={};var _0x1e8dad={};var _0x11fe75;var _0x280fbb;return db[_0x7995('0x2f')][_0x7995('0x61')]({'where':{'id':_0x251490[_0x7995('0x5f')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x2ff7ba,null))['then'](function(_0x3fdb4b){if(_0x3fdb4b){_0x11fe75=_0x3fdb4b;_0x1e8dad[_0x7995('0x39')]=_['keys'](db['Sound'][_0x7995('0x30')]);_0x1e8dad[_0x7995('0x33')]=_[_0x7995('0x34')](_0x251490[_0x7995('0x33')]);_0x1e8dad[_0x7995('0x35')]=_[_0x7995('0x36')](_0x1e8dad['model'],_0x1e8dad[_0x7995('0x33')]);_0x306fa9[_0x7995('0x37')]=_[_0x7995('0x36')](_0x1e8dad[_0x7995('0x39')],qs[_0x7995('0x38')](_0x251490[_0x7995('0x33')][_0x7995('0x38')]));_0x306fa9[_0x7995('0x37')]=_0x306fa9['attributes'][_0x7995('0x6f')]?_0x306fa9[_0x7995('0x37')]:_0x1e8dad['model'];_0x306fa9['order']=qs[_0x7995('0x3b')](_0x251490[_0x7995('0x33')][_0x7995('0x3b')]);_0x306fa9[_0x7995('0x3c')]=qs[_0x7995('0x35')](_['pick'](_0x251490[_0x7995('0x33')],_0x1e8dad[_0x7995('0x35')]));if(_0x251490['query'][_0x7995('0x3e')]){_0x306fa9[_0x7995('0x3c')]=_['merge'](_0x306fa9[_0x7995('0x3c')],{'$or':_['map'](_0x306fa9[_0x7995('0x37')],function(_0x2322bf){var _0x3ab421={};_0x3ab421[_0x2322bf]={'$like':'%'+_0x251490[_0x7995('0x33')][_0x7995('0x3e')]+'%'};return _0x3ab421;})});}_0x306fa9=_['merge']({},_0x306fa9,_0x251490[_0x7995('0x41')]);return _0x11fe75[_0x7995('0x6e')](_0x306fa9);}})[_0x7995('0x24')](function(_0x5bc4fa){if(_0x5bc4fa){_0x280fbb=_0x5bc4fa[_0x7995('0x6f')];if(!_0x251490[_0x7995('0x33')][_0x7995('0x70')](_0x7995('0x71'))){_0x306fa9['limit']=qs[_0x7995('0x20')](_0x251490[_0x7995('0x33')][_0x7995('0x20')]);_0x306fa9['offset']=qs['offset'](_0x251490[_0x7995('0x33')][_0x7995('0x1f')]);}return _0x11fe75['getSounds'](_0x306fa9);}})['then'](function(_0x2e3dfe){if(_0x2e3dfe){return _0x2e3dfe?{'count':_0x280fbb,'rows':_0x2e3dfe}:null;}})[_0x7995('0x24')](respondWithResult(_0x2ff7ba,null))[_0x7995('0x45')](handleError(_0x2ff7ba,null));}; \ No newline at end of file +var _0xa9e0=['MusicOnHolds','UserProfileResource','sendStatus','error','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','update','body','create','sequelize','transaction','mode','join','root','server/files/moh','files','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','directory','forEach','unlinkSync','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','Sequelize','removeSound','getSounds','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get'];(function(_0x451f88,_0x5c061a){var _0x2cc2b7=function(_0x5bb6ce){while(--_0x5bb6ce){_0x451f88['push'](_0x451f88['shift']());}};_0x2cc2b7(++_0x5c061a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=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 licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){var _0x4abc77=_0x432e56[_0x0a9e('0x23')]({'plain':!![]});var _0x2fb0e4=_0x0a9e('0x24');return db[_0x0a9e('0x25')][_0x0a9e('0x22')]({'where':{'type':_0x2fb0e4,'resourceId':_0x4abc77['id']}})[_0x0a9e('0x21')](function(){return _0x432e56;});})[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x26')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x16')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}exports[_0x0a9e('0x2a')]=function(_0x1538a4,_0x11c3b6){var _0x14de77={},_0x5a101a={},_0x3652a7={'count':0x0,'rows':[]};var _0x468813=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')]['rawAttributes'],function(_0x15b200){return{'name':_0x15b200[_0x0a9e('0x2d')],'type':_0x15b200[_0x0a9e('0x2e')][_0x0a9e('0x2f')]};});_0x5a101a[_0x0a9e('0x30')]=_[_0x0a9e('0x2b')](_0x468813,_0x0a9e('0x28'));_0x5a101a[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x1538a4['query']);_0x5a101a[_0x0a9e('0x33')]=_['intersection'](_0x5a101a[_0x0a9e('0x30')],_0x5a101a[_0x0a9e('0x31')]);_0x14de77[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x5a101a[_0x0a9e('0x30')],qs['fields'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14de77[_0x0a9e('0x34')]=_0x14de77[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14de77[_0x0a9e('0x34')]:_0x5a101a[_0x0a9e('0x30')];if(!_0x1538a4[_0x0a9e('0x31')]['hasOwnProperty'](_0x0a9e('0x38'))){_0x14de77['limit']=qs[_0x0a9e('0x1a')](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x14de77[_0x0a9e('0x19')]=qs['offset'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x19')]);}_0x14de77[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x1538a4['query']['sort']);_0x14de77[_0x0a9e('0x3b')]=qs['filters'](_[_0x0a9e('0x3c')](_0x1538a4[_0x0a9e('0x31')],_0x5a101a[_0x0a9e('0x33')]),_0x468813);if(_0x1538a4[_0x0a9e('0x31')]['filter']){_0x14de77[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x14de77[_0x0a9e('0x3b')],{'$or':_['map'](_0x468813,function(_0x1dbf74){if(_0x1dbf74[_0x0a9e('0x2e')]!==_0x0a9e('0x3e')){var _0x4c1c0e={};_0x4c1c0e[_0x1dbf74['name']]={'$like':'%'+_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4c1c0e;}})});}_0x14de77=_['merge']({},_0x14de77,_0x1538a4[_0x0a9e('0x40')]);var _0x419125={'where':_0x14de77[_0x0a9e('0x3b')]};return db[_0x0a9e('0x2c')]['count'](_0x419125)['then'](function(_0x15e37d){_0x3652a7[_0x0a9e('0x18')]=_0x15e37d;if(_0x1538a4['query'][_0x0a9e('0x41')]){_0x14de77[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x14de77);})[_0x0a9e('0x21')](function(_0x2cfea9){_0x3652a7[_0x0a9e('0x43')]=_0x2cfea9;return _0x3652a7;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x11c3b6,_0x14de77))[_0x0a9e('0x44')](handleError(_0x11c3b6,null));};exports[_0x0a9e('0x45')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x46')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x47')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x31')]);_0x3da2cd[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],_0x3da2cd[_0x0a9e('0x31')]);_0x23b089[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x23b089[_0x0a9e('0x34')]=_0x23b089['attributes'][_0x0a9e('0x37')]?_0x23b089[_0x0a9e('0x34')]:_0x3da2cd[_0x0a9e('0x30')];if(_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x23b089[_0x0a9e('0x42')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x3d')]({},_0x23b089,_0x2881b3[_0x0a9e('0x40')]);return db['VoiceMusicOnHold'][_0x0a9e('0x48')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x21')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x44')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x49')]=function(_0x562fb4,_0x14bec2){if(_0x562fb4[_0x0a9e('0x4a')]['id']){delete _0x562fb4[_0x0a9e('0x4a')]['id'];}return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x562fb4[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x14bec2,null))['then'](saveUpdates(_0x562fb4[_0x0a9e('0x4a')],null))[_0x0a9e('0x21')](respondWithResult(_0x14bec2,null))[_0x0a9e('0x44')](handleError(_0x14bec2,null));};exports[_0x0a9e('0x4b')]=function(_0x409789,_0x992c77,_0x6054ee){return db[_0x0a9e('0x4c')][_0x0a9e('0x4d')](function(_0x58a5c2){if(_0x409789[_0x0a9e('0x4a')][_0x0a9e('0x4e')]==='files'){_0x409789['body']['directory']=path[_0x0a9e('0x4f')](config[_0x0a9e('0x50')],_0x0a9e('0x51'),_0x409789[_0x0a9e('0x4a')][_0x0a9e('0x28')]);}return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')](_0x409789[_0x0a9e('0x4a')],{'transaction':_0x58a5c2})['then'](function(_0x4b1b9f){if(_0x409789['body'][_0x0a9e('0x4e')]===_0x0a9e('0x52')){fs[_0x0a9e('0x53')](_0x4b1b9f['directory'],parseInt(_0x0a9e('0x54'),0x8));}var _0x161aa7=_0x409789['user']['get']({'plain':!![]});if(!_0x161aa7)throw new Error(_0x0a9e('0x55'));if(_0x161aa7['role']===_0x0a9e('0x56')){var _0x4c3845=_0x4b1b9f[_0x0a9e('0x23')]({'plain':!![]});return db[_0x0a9e('0x57')][_0x0a9e('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x161aa7[_0x0a9e('0x58')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x508b47){if(_0x508b47&&_0x508b47['autoAssociation']===0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x4b')]({'name':_0x4c3845['name'],'resourceId':_0x4c3845['id'],'type':_0x508b47[_0x0a9e('0x28')],'sectionId':_0x508b47['id']},{})['then'](function(){return _0x4b1b9f;});}else{return _0x4b1b9f;}})[_0x0a9e('0x44')](function(_0x523cd2){logger[_0x0a9e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x523cd2);});}return _0x4b1b9f;});})['then'](respondWithResult(_0x992c77,0xc9))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x22')]=function(_0x47de4c,_0x2f7092,_0x65432){var _0x3cfd00;return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x47de4c[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](function(_0x28d814){if(_0x28d814){return db['sequelize'][_0x0a9e('0x4d')](function(_0x121cef){return _0x28d814[_0x0a9e('0x22')]({'transaction':_0x121cef,'raw':!![]})[_0x0a9e('0x21')](function(_0xb83dfd){if(_0xb83dfd[_0x0a9e('0x59')]){fs['readdirSync'](_0xb83dfd[_0x0a9e('0x59')])[_0x0a9e('0x5a')](function(_0x5239ef){fs[_0x0a9e('0x5b')](path['join'](_0xb83dfd[_0x0a9e('0x59')],_0x5239ef));});fs['rmdirSync'](_0xb83dfd['directory']);}return _0xb83dfd;});})['catch'](function(_0x273cb5){throw new db['Sequelize'][(_0x0a9e('0x5c'))](_0x273cb5[_0x0a9e('0x5d')]);});}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2f7092,null))[_0x0a9e('0x21')](removeEntity(_0x2f7092,null))[_0x0a9e('0x44')](handleError(_0x2f7092,null));};exports[_0x0a9e('0x5e')]=function(_0x49eed0,_0x1627a7,_0x5854cc){return db[_0x0a9e('0x4c')][_0x0a9e('0x4d')](function(_0x51aaf7){var _0x5adf8f;return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x49eed0[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](function(_0x497d91){if(_0x497d91){_0x5adf8f=_0x497d91;return _0x497d91[_0x0a9e('0x5e')](_0x49eed0[_0x0a9e('0x4a')]['id'],{'transaction':_0x51aaf7});}})['then'](function(_0x797b45){if(_0x797b45){return db[_0x0a9e('0x5f')][_0x0a9e('0x60')]({'where':{'id':_0x49eed0[_0x0a9e('0x4a')]['id']},'attributes':['id',_0x0a9e('0x28'),'save_name',_0x0a9e('0x61'),_0x0a9e('0x62')],'raw':!![]});}})[_0x0a9e('0x21')](function(_0x47bb43){if(_0x47bb43){var _0x3528b7=path['join'](config['root'],_0x0a9e('0x63'),util[_0x0a9e('0x64')](_0x0a9e('0x65'),path[_0x0a9e('0x66')](_0x47bb43[_0x0a9e('0x67')],path[_0x0a9e('0x68')](_0x47bb43[_0x0a9e('0x67')])),_0x47bb43[_0x0a9e('0x61')]));var _0x2d7205=path[_0x0a9e('0x4f')](config[_0x0a9e('0x50')],_0x0a9e('0x51'),_0x5adf8f[_0x0a9e('0x28')],util[_0x0a9e('0x64')](_0x0a9e('0x65'),_0x47bb43[_0x0a9e('0x28')],_0x47bb43[_0x0a9e('0x61')]));fs[_0x0a9e('0x69')](_0x3528b7,_0x2d7205);return _0x47bb43;}})['catch'](function(_0x1b0b98){throw new db[(_0x0a9e('0x6a'))][(_0x0a9e('0x5c'))](_0x1b0b98['message']);});})[_0x0a9e('0x21')](handleEntityNotFound(_0x1627a7,null))[_0x0a9e('0x21')](respondWithResult(_0x1627a7,0xc9))['catch'](handleError(_0x1627a7,null));};exports[_0x0a9e('0x6b')]=function(_0x56e31e,_0x3ef315,_0x427946){return db[_0x0a9e('0x4c')]['transaction'](function(_0x50cdce){var _0x4a2438;return db[_0x0a9e('0x2c')][_0x0a9e('0x60')]({'where':{'id':_0x56e31e[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x3ef315,null))[_0x0a9e('0x21')](function(_0x380ab3){if(_0x380ab3){_0x4a2438=_0x380ab3;return _0x380ab3[_0x0a9e('0x6b')](_0x56e31e[_0x0a9e('0x46')]['id2']);}})[_0x0a9e('0x21')](function(_0xcbc8b2){if(_0xcbc8b2){return db[_0x0a9e('0x5f')]['findOne']({'where':{'id':_0x56e31e[_0x0a9e('0x46')]['id2']},'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x67'),'converted_format',_0x0a9e('0x62')],'raw':!![]});}})[_0x0a9e('0x21')](function(_0x2cc7a7){if(_0x2cc7a7){fs[_0x0a9e('0x5b')](path['join'](_0x4a2438[_0x0a9e('0x59')],util[_0x0a9e('0x64')](_0x0a9e('0x65'),_0x2cc7a7[_0x0a9e('0x28')],_0x2cc7a7['converted_format'])));return _0x2cc7a7;}})[_0x0a9e('0x44')](function(_0x3d91db){throw new db[(_0x0a9e('0x6a'))][(_0x0a9e('0x5c'))](_0x3d91db['message']);});})[_0x0a9e('0x21')](handleEntityNotFound(_0x3ef315,null))[_0x0a9e('0x21')](respondWithStatusCode(_0x3ef315,0xcc))[_0x0a9e('0x44')](handleError(_0x3ef315,null));};exports[_0x0a9e('0x6c')]=function(_0x332367,_0xdb98ca,_0x40fc56){var _0x3df0e3={};var _0x1a7b03={};var _0x336dc3;var _0xc4c230;return db[_0x0a9e('0x2c')][_0x0a9e('0x60')]({'where':{'id':_0x332367[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0xdb98ca,null))[_0x0a9e('0x21')](function(_0x11da9c){if(_0x11da9c){_0x336dc3=_0x11da9c;_0x1a7b03[_0x0a9e('0x30')]=_['keys'](db[_0x0a9e('0x5f')][_0x0a9e('0x47')]);_0x1a7b03[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x332367['query']);_0x1a7b03['filters']=_[_0x0a9e('0x35')](_0x1a7b03[_0x0a9e('0x30')],_0x1a7b03['query']);_0x3df0e3[_0x0a9e('0x34')]=_['intersection'](_0x1a7b03[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x332367['query'][_0x0a9e('0x36')]));_0x3df0e3[_0x0a9e('0x34')]=_0x3df0e3[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x3df0e3[_0x0a9e('0x34')]:_0x1a7b03[_0x0a9e('0x30')];_0x3df0e3[_0x0a9e('0x39')]=qs['sort'](_0x332367[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x3df0e3[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_['pick'](_0x332367[_0x0a9e('0x31')],_0x1a7b03[_0x0a9e('0x33')]));if(_0x332367['query'][_0x0a9e('0x3f')]){_0x3df0e3['where']=_[_0x0a9e('0x3d')](_0x3df0e3[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x3df0e3[_0x0a9e('0x34')],function(_0x5af453){var _0x51ccd7={};_0x51ccd7[_0x5af453]={'$like':'%'+_0x332367[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x51ccd7;})});}_0x3df0e3=_[_0x0a9e('0x3d')]({},_0x3df0e3,_0x332367['options']);return _0x336dc3[_0x0a9e('0x6c')](_0x3df0e3);}})[_0x0a9e('0x21')](function(_0x524e38){if(_0x524e38){_0xc4c230=_0x524e38['length'];if(!_0x332367[_0x0a9e('0x31')]['hasOwnProperty']('nolimit')){_0x3df0e3['limit']=qs[_0x0a9e('0x1a')](_0x332367[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x3df0e3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x332367[_0x0a9e('0x31')]['offset']);}return _0x336dc3[_0x0a9e('0x6c')](_0x3df0e3);}})['then'](function(_0x2871c1){if(_0x2871c1){return _0x2871c1?{'count':_0xc4c230,'rows':_0x2871c1}:null;}})[_0x0a9e('0x21')](respondWithResult(_0xdb98ca,null))[_0x0a9e('0x44')](handleError(_0xdb98ca,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c261dc5..26ff28f 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 _0xc646=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMusicOnHold.attributes','exports'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xc646,0x12e));var _0x6c64=function(_0x2393c0,_0x5d5d61){_0x2393c0=_0x2393c0-0x0;var _0x188aa9=_0xc646[_0x2393c0];return _0x188aa9;};'use strict';var _=require(_0x6c64('0x0'));var util=require(_0x6c64('0x1'));var logger=require(_0x6c64('0x2'))(_0x6c64('0x3'));var moment=require(_0x6c64('0x4'));var BPromise=require(_0x6c64('0x5'));var rp=require(_0x6c64('0x6'));var fs=require('fs');var path=require(_0x6c64('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c64('0x8'));module[_0x6c64('0x9')]=function(_0xa959cf,_0xe4faa8){return _0xa959cf[_0x6c64('0xa')](_0x6c64('0xb'),attributes,{'tableName':_0x6c64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9176=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x5c46c5,_0x51b557){var _0xcac307=function(_0x1489b3){while(--_0x1489b3){_0x5c46c5['push'](_0x5c46c5['shift']());}};_0xcac307(++_0x51b557);}(_0x9176,0x197));var _0x6917=function(_0x1d1aee,_0x401fb0){_0x1d1aee=_0x1d1aee-0x0;var _0x298795=_0x9176[_0x1d1aee];return _0x298795;};'use strict';var _=require('lodash');var util=require(_0x6917('0x0'));var logger=require(_0x6917('0x1'))(_0x6917('0x2'));var moment=require(_0x6917('0x3'));var BPromise=require('bluebird');var rp=require(_0x6917('0x4'));var fs=require('fs');var path=require(_0x6917('0x5'));var rimraf=require(_0x6917('0x6'));var config=require(_0x6917('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x481576,_0x23a058){return _0x481576[_0x6917('0x8')](_0x6917('0x9'),attributes,{'tableName':_0x6917('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 5c570f5..9c469d4 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 _0x87b7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x387520,_0x11bfd8){var _0x4cedb9=function(_0x1c3a5e){while(--_0x1c3a5e){_0x387520['push'](_0x387520['shift']());}};_0x4cedb9(++_0x11bfd8);}(_0x87b7,0x1b5));var _0x787b=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x87b7[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x787b('0x0'));var util=require(_0x787b('0x1'));var moment=require(_0x787b('0x2'));var BPromise=require(_0x787b('0x3'));var rs=require(_0x787b('0x4'));var fs=require('fs');var Redis=require(_0x787b('0x5'));var db=require(_0x787b('0x6'))['db'];var utils=require(_0x787b('0x7'));var logger=require(_0x787b('0x8'))(_0x787b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19b24c,_0x52d126,_0xfa7fde){return new BPromise(function(_0x391101,_0x3967e1){return client[_0x787b('0xa')](_0x19b24c,_0xfa7fde)['then'](function(_0x31bbe3){logger[_0x787b('0xb')](_0x787b('0xc'),_0x52d126,'request\x20sent');logger[_0x787b('0xd')](_0x787b('0xe'),_0x52d126,'request\x20sent',JSON[_0x787b('0xf')](_0x31bbe3));if(_0x31bbe3[_0x787b('0x10')]){if(_0x31bbe3[_0x787b('0x10')]['code']===0x1f4){logger[_0x787b('0x10')](_0x787b('0xc'),_0x52d126,_0x31bbe3[_0x787b('0x10')][_0x787b('0x11')]);return _0x3967e1(_0x31bbe3[_0x787b('0x10')][_0x787b('0x11')]);}logger[_0x787b('0x10')](_0x787b('0xc'),_0x52d126,_0x31bbe3[_0x787b('0x10')][_0x787b('0x11')]);return _0x391101(_0x31bbe3['error'][_0x787b('0x11')]);}else{logger[_0x787b('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x52d126,_0x787b('0x12'));_0x391101(_0x31bbe3[_0x787b('0x13')][_0x787b('0x11')]);}})[_0x787b('0x14')](function(_0x5d3aeb){logger[_0x787b('0x10')](_0x787b('0xc'),_0x52d126,_0x5d3aeb);_0x3967e1(_0x5d3aeb);});});} \ No newline at end of file +var _0x1dd6=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4bfef9,_0x5ae8fa){var _0x4d631e=function(_0x1a2384){while(--_0x1a2384){_0x4bfef9['push'](_0x4bfef9['shift']());}};_0x4d631e(++_0x5ae8fa);}(_0x1dd6,0x1d9));var _0x61dd=function(_0x3611f2,_0xe6f253){_0x3611f2=_0x3611f2-0x0;var _0x87de50=_0x1dd6[_0x3611f2];return _0x87de50;};'use strict';var _=require(_0x61dd('0x0'));var util=require(_0x61dd('0x1'));var moment=require(_0x61dd('0x2'));var BPromise=require(_0x61dd('0x3'));var rs=require(_0x61dd('0x4'));var fs=require('fs');var Redis=require(_0x61dd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x61dd('0x6'));var logger=require(_0x61dd('0x7'))(_0x61dd('0x8'));var config=require(_0x61dd('0x9'));var jayson=require(_0x61dd('0xa'));var client=jayson[_0x61dd('0xb')][_0x61dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x283114,_0xf63aa9,_0x5f240e){return new BPromise(function(_0x118cd9,_0x5e79df){return client[_0x61dd('0xd')](_0x283114,_0x5f240e)[_0x61dd('0xe')](function(_0x53015d){logger[_0x61dd('0xf')](_0x61dd('0x10'),_0xf63aa9,_0x61dd('0x11'));logger[_0x61dd('0x12')](_0x61dd('0x13'),_0xf63aa9,_0x61dd('0x11'),JSON[_0x61dd('0x14')](_0x53015d));if(_0x53015d['error']){if(_0x53015d[_0x61dd('0x15')][_0x61dd('0x16')]===0x1f4){logger['error'](_0x61dd('0x10'),_0xf63aa9,_0x53015d['error'][_0x61dd('0x17')]);return _0x5e79df(_0x53015d[_0x61dd('0x15')][_0x61dd('0x17')]);}logger['error'](_0x61dd('0x10'),_0xf63aa9,_0x53015d[_0x61dd('0x15')][_0x61dd('0x17')]);return _0x118cd9(_0x53015d['error']['message']);}else{logger[_0x61dd('0xf')](_0x61dd('0x10'),_0xf63aa9,'request\x20sent');_0x118cd9(_0x53015d[_0x61dd('0x18')]['message']);}})[_0x61dd('0x19')](function(_0x256717){logger[_0x61dd('0x15')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf63aa9,_0x256717);_0x5e79df(_0x256717);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 76e5684..5d79e3e 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 _0xbff5=['put','update','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','post','create'];(function(_0x119c23,_0x484c88){var _0x1f1c4f=function(_0x35c942){while(--_0x35c942){_0x119c23['push'](_0x119c23['shift']());}};_0x1f1c4f(++_0x484c88);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2ad51c,_0x53be07){_0x2ad51c=_0x2ad51c-0x0;var _0x414e67=_0xbff5[_0x2ad51c];return _0x414e67;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['get'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller['getAgents']);router[_0x5bff('0x10')]('/',auth['isAuthenticated'](),controller[_0x5bff('0x11')]);router['post'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller['addAgents']);router[_0x5bff('0x12')]('/:id',auth[_0x5bff('0x9')](),controller[_0x5bff('0x13')]);router['delete'](_0x5bff('0xd'),auth[_0x5bff('0x9')](),controller['destroy']);router['delete'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1261=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','index','get','isAuthenticated','describe','/:id','/:id/users','post','addAgents','put','update','delete','removeAgents','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1261,0x144));var _0x1126=function(_0x54f978,_0x3a6b7e){_0x54f978=_0x54f978-0x0;var _0x5d40b3=_0x1261[_0x54f978];return _0x5d40b3;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xb')](_0x1126('0xf'),auth[_0x1126('0xc')](),controller['getAgents']);router[_0x1126('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1126('0x10')]('/:id/users',auth[_0x1126('0xc')](),controller[_0x1126('0x11')]);router[_0x1126('0x12')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);router[_0x1126('0x14')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['destroy']);router['delete'](_0x1126('0xf'),auth[_0x1126('0xc')](),controller[_0x1126('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 f13876b..595b697 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 _0x0da9=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x41a0fd,_0xce6c5f){var _0x1b21a2=function(_0x508c4d){while(--_0x508c4d){_0x41a0fd['push'](_0x41a0fd['shift']());}};_0x1b21a2(++_0xce6c5f);}(_0x0da9,0x64));var _0x90da=function(_0x2c8afe,_0x100f80){_0x2c8afe=_0x2c8afe-0x0;var _0x982977=_0x0da9[_0x2c8afe];return _0x982977;};'use strict';var Sequelize=require(_0x90da('0x0'));module[_0x90da('0x1')]={'name':{'type':Sequelize[_0x90da('0x2')],'allowNull':![],'unique':_0x90da('0x3')},'prefix':{'type':Sequelize[_0x90da('0x4')],'get':function(_0x3120aa){return'system-'+this[_0x90da('0x5')](_0x90da('0x3'))+'-';}},'description':{'type':Sequelize[_0x90da('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x90da('0x6')]}}; \ No newline at end of file +var _0x5837=['INTEGER','sequelize','name','system-','getDataValue','STRING'];(function(_0x49f1fd,_0x236a0b){var _0x565e95=function(_0x1cb9d3){while(--_0x1cb9d3){_0x49f1fd['push'](_0x49f1fd['shift']());}};_0x565e95(++_0x236a0b);}(_0x5837,0x73));var _0x7583=function(_0x3cd025,_0x1e2adf){_0x3cd025=_0x3cd025-0x0;var _0xaa86eb=_0x5837[_0x3cd025];return _0xaa86eb;};'use strict';var Sequelize=require(_0x7583('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7583('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5aa295){return _0x7583('0x2')+this[_0x7583('0x3')](_0x7583('0x1'))+'-';}},'description':{'type':Sequelize[_0x7583('0x4')]},'callerIdAll':{'type':Sequelize[_0x7583('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x7583('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index b186021..a11692f 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 _0x66f7=['charAt','body','system-','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','eml-format','rimraf','fast-json-patch','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','get','UserProfileResource','then','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','destroy','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','bulkCreate','Extensions\x20creation\x20failed','prefix','push','callerIdAll','Set','No\x20callerid\x20available','${EXTEN:'];(function(_0x10b967,_0xb32c4d){var _0x264da2=function(_0x1a7212){while(--_0x1a7212){_0x10b967['push'](_0x10b967['shift']());}};_0x264da2(++_0xb32c4d);}(_0x66f7,0x16b));var _0x766f=function(_0xf38492,_0x45d84e){_0xf38492=_0xf38492-0x0;var _0x3e66e3=_0x66f7[_0xf38492];return _0x3e66e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x766f('0x0'));var rimraf=require(_0x766f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x766f('0x2'));var rp=require('request-promise');var moment=require(_0x766f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x766f('0x4'));var path=require('path');var sox=require(_0x766f('0x5'));var csv=require(_0x766f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x766f('0x7'));var squel=require(_0x766f('0x8'));var crypto=require(_0x766f('0x9'));var jsforce=require(_0x766f('0xa'));var deskjs=require(_0x766f('0xb'));var toCsv=require(_0x766f('0x6'));var querystring=require(_0x766f('0xc'));var Papa=require(_0x766f('0xd'));var Redis=require(_0x766f('0xe'));var authService=require(_0x766f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x766f('0x10'))('api');var utils=require(_0x766f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x766f('0x12'));var db=require(_0x766f('0x13'))['db'];config[_0x766f('0x14')]=_[_0x766f('0x15')](config[_0x766f('0x14')],{'host':_0x766f('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x766f('0x14')]));require(_0x766f('0x17'))[_0x766f('0x18')](socket);function respondWithStatusCode(_0x2178b6,_0x4423f9){_0x4423f9=_0x4423f9||0xcc;return function(_0xbba52a){if(_0xbba52a){return _0x2178b6[_0x766f('0x19')](_0x4423f9);}return _0x2178b6[_0x766f('0x1a')](_0x4423f9)[_0x766f('0x1b')]();};}function respondWithResult(_0x927f71,_0x565ebc){_0x565ebc=_0x565ebc||0xc8;return function(_0x77acd9){if(_0x77acd9){return _0x927f71[_0x766f('0x1a')](_0x565ebc)[_0x766f('0x1c')](_0x77acd9);}};}function respondWithFilteredResult(_0xd01b02,_0x394b83){return function(_0x4d6866){if(_0x4d6866){var _0x3b2ea0=_0x4d6866[_0x766f('0x1d')],_0x377cb4=_0x394b83['offset'],_0x4d76fc=_0x394b83[_0x766f('0x1e')]+_0x394b83[_0x766f('0x1f')],_0x36e0a8;if(_0x4d76fc>=_0x3b2ea0){_0x4d76fc=_0x3b2ea0;_0x36e0a8=0xc8;}else{_0x36e0a8=0xce;}_0xd01b02['status'](_0x36e0a8);return _0xd01b02['set'](_0x766f('0x20'),_0x377cb4+'-'+_0x4d76fc+'/'+_0x3b2ea0)[_0x766f('0x1c')](_0x4d6866);}return null;};}function patchUpdates(_0x43c944){return function(_0x312f4e){try{jsonpatch[_0x766f('0x21')](_0x312f4e,_0x43c944,!![]);}catch(_0x3feb2b){return BPromise[_0x766f('0x22')](_0x3feb2b);}return _0x312f4e[_0x766f('0x23')]();};}function saveUpdates(_0x251d13,_0x4e450b){return function(_0x803361){if(_0x803361){return _0x803361[_0x766f('0x24')](_0x251d13)['then'](function(_0x4d72b6){return _0x4d72b6;});}return null;};}function removeEntity(_0x175200,_0xbefd67){return function(_0x580a70){if(_0x580a70){return _0x580a70['destroy']()['then'](function(){var _0x173e62=_0x580a70[_0x766f('0x25')]({'plain':!![]});var _0x640bef='VoicePrefixes';return db[_0x766f('0x26')]['destroy']({'where':{'type':_0x640bef,'resourceId':_0x173e62['id']}})[_0x766f('0x27')](function(){return _0x580a70;});})[_0x766f('0x27')](function(){_0x175200[_0x766f('0x1a')](0xcc)[_0x766f('0x1b')]();});}};}function handleEntityNotFound(_0x40d418,_0x3e0b96){return function(_0x3fa342){if(!_0x3fa342){_0x40d418[_0x766f('0x19')](0x194);}return _0x3fa342;};}function handleError(_0x2c1cb1,_0xe8480b){_0xe8480b=_0xe8480b||0x1f4;return function(_0x12850d){logger['error'](_0x12850d[_0x766f('0x28')]);if(_0x12850d[_0x766f('0x29')]){delete _0x12850d[_0x766f('0x29')];}_0x2c1cb1['status'](_0xe8480b)['send'](_0x12850d);};}exports[_0x766f('0x2a')]=function(_0x9d6ee8,_0x1c5ad0){var _0x5ac0ff={},_0x1e187a={},_0x2cbc32={'count':0x0,'rows':[]};var _0x3699a9=_[_0x766f('0x2b')](db[_0x766f('0x2c')][_0x766f('0x2d')],function(_0x4d50fc){return{'name':_0x4d50fc[_0x766f('0x2e')],'type':_0x4d50fc[_0x766f('0x2f')][_0x766f('0x30')]};});_0x1e187a[_0x766f('0x31')]=_[_0x766f('0x2b')](_0x3699a9,_0x766f('0x29'));_0x1e187a['query']=_[_0x766f('0x32')](_0x9d6ee8['query']);_0x1e187a[_0x766f('0x33')]=_[_0x766f('0x34')](_0x1e187a[_0x766f('0x31')],_0x1e187a[_0x766f('0x35')]);_0x5ac0ff[_0x766f('0x36')]=_[_0x766f('0x34')](_0x1e187a[_0x766f('0x31')],qs[_0x766f('0x37')](_0x9d6ee8[_0x766f('0x35')][_0x766f('0x37')]));_0x5ac0ff[_0x766f('0x36')]=_0x5ac0ff[_0x766f('0x36')]['length']?_0x5ac0ff[_0x766f('0x36')]:_0x1e187a[_0x766f('0x31')];if(!_0x9d6ee8[_0x766f('0x35')][_0x766f('0x38')](_0x766f('0x39'))){_0x5ac0ff[_0x766f('0x1f')]=qs[_0x766f('0x1f')](_0x9d6ee8[_0x766f('0x35')][_0x766f('0x1f')]);_0x5ac0ff[_0x766f('0x1e')]=qs[_0x766f('0x1e')](_0x9d6ee8[_0x766f('0x35')][_0x766f('0x1e')]);}_0x5ac0ff[_0x766f('0x3a')]=qs[_0x766f('0x3b')](_0x9d6ee8[_0x766f('0x35')][_0x766f('0x3b')]);_0x5ac0ff['where']=qs[_0x766f('0x33')](_[_0x766f('0x3c')](_0x9d6ee8['query'],_0x1e187a['filters']),_0x3699a9);if(_0x9d6ee8[_0x766f('0x35')]['filter']){_0x5ac0ff[_0x766f('0x3d')]=_[_0x766f('0x3e')](_0x5ac0ff[_0x766f('0x3d')],{'$or':_[_0x766f('0x2b')](_0x3699a9,function(_0x1825d9){if(_0x1825d9['type']!==_0x766f('0x3f')){var _0x16d716={};_0x16d716[_0x1825d9[_0x766f('0x29')]]={'$like':'%'+_0x9d6ee8[_0x766f('0x35')][_0x766f('0x40')]+'%'};return _0x16d716;}})});}_0x5ac0ff=_[_0x766f('0x3e')]({},_0x5ac0ff,_0x9d6ee8[_0x766f('0x41')]);var _0x335b57={'where':_0x5ac0ff[_0x766f('0x3d')]};return db[_0x766f('0x2c')][_0x766f('0x1d')](_0x335b57)[_0x766f('0x27')](function(_0x2ddb49){_0x2cbc32[_0x766f('0x1d')]=_0x2ddb49;if(_0x9d6ee8[_0x766f('0x35')]['includeAll']){_0x5ac0ff[_0x766f('0x42')]=[{'all':!![]}];}return db[_0x766f('0x2c')][_0x766f('0x43')](_0x5ac0ff);})[_0x766f('0x27')](function(_0x74af4a){_0x2cbc32[_0x766f('0x44')]=_0x74af4a;return _0x2cbc32;})['then'](respondWithFilteredResult(_0x1c5ad0,_0x5ac0ff))[_0x766f('0x45')](handleError(_0x1c5ad0,null));};exports[_0x766f('0x46')]=function(_0x5afb1f,_0x1ec5d2){var _0x59e171={'raw':![],'where':{'id':_0x5afb1f[_0x766f('0x47')]['id']}},_0x3c8ed1={};_0x3c8ed1['model']=_[_0x766f('0x32')](db[_0x766f('0x2c')][_0x766f('0x2d')]);_0x3c8ed1[_0x766f('0x35')]=_[_0x766f('0x32')](_0x5afb1f[_0x766f('0x35')]);_0x3c8ed1[_0x766f('0x33')]=_[_0x766f('0x34')](_0x3c8ed1['model'],_0x3c8ed1['query']);_0x59e171[_0x766f('0x36')]=_[_0x766f('0x34')](_0x3c8ed1[_0x766f('0x31')],qs[_0x766f('0x37')](_0x5afb1f[_0x766f('0x35')]['fields']));_0x59e171[_0x766f('0x36')]=_0x59e171[_0x766f('0x36')][_0x766f('0x48')]?_0x59e171[_0x766f('0x36')]:_0x3c8ed1[_0x766f('0x31')];if(_0x5afb1f[_0x766f('0x35')]['includeAll']){_0x59e171['include']=[{'all':!![]}];}_0x59e171=_['merge']({},_0x59e171,_0x5afb1f[_0x766f('0x41')]);return db[_0x766f('0x2c')]['find'](_0x59e171)[_0x766f('0x27')](handleEntityNotFound(_0x1ec5d2,null))['then'](respondWithResult(_0x1ec5d2,null))[_0x766f('0x45')](handleError(_0x1ec5d2,null));};exports[_0x766f('0x49')]=function(_0x146fc5,_0x11688d){return db[_0x766f('0x2c')][_0x766f('0x4a')]({'where':{'id':_0x146fc5[_0x766f('0x47')]['id']}})[_0x766f('0x27')](handleEntityNotFound(_0x11688d,null))[_0x766f('0x27')](removeEntity(_0x11688d,null))[_0x766f('0x45')](handleError(_0x11688d,null));};exports[_0x766f('0x4b')]=function(_0x4db475,_0x26bd44){return db[_0x766f('0x2c')][_0x766f('0x4b')]()[_0x766f('0x27')](respondWithResult(_0x26bd44,null))[_0x766f('0x45')](handleError(_0x26bd44,null));};exports[_0x766f('0x4c')]=function(_0xa1a15e,_0x34921a){var _0x303091;return db[_0x766f('0x4d')][_0x766f('0x4e')](function(_0xb3728e){return db[_0x766f('0x2c')][_0x766f('0x4c')](_0xa1a15e['body'],{'transaction':_0xb3728e})[_0x766f('0x27')](function(_0x2fda5b){_0x303091=_0x2fda5b['get']({'plain':!![]});return db[_0x766f('0x4f')][_0x766f('0x4a')]({'where':{'id':_0x303091[_0x766f('0x50')]},'raw':!![]})[_0x766f('0x27')](function(_0x283a88){return createVoicePrefixExtensions(_0x303091,_0x283a88,_0xb3728e);});});})[_0x766f('0x27')](function(){var _0xb5f5a6=_0xa1a15e[_0x766f('0x51')][_0x766f('0x25')]({'plain':!![]});if(!_0xb5f5a6)throw new Error(_0x766f('0x52'));if(_0xb5f5a6[_0x766f('0x53')]===_0x766f('0x51')){var _0x27b1bf=_0x303091;return db[_0x766f('0x54')]['find']({'where':{'name':_0x766f('0x55'),'userProfileId':_0xb5f5a6['userProfileId']},'raw':!![]})[_0x766f('0x27')](function(_0x5d5e18){if(_0x5d5e18&&_0x5d5e18[_0x766f('0x56')]===0x0){return db[_0x766f('0x26')][_0x766f('0x4c')]({'name':_0x27b1bf[_0x766f('0x29')],'resourceId':_0x27b1bf['id'],'type':_0x5d5e18[_0x766f('0x29')],'sectionId':_0x5d5e18['id']},{})[_0x766f('0x27')](function(){return _0x303091;});}else{return _0x303091;}})[_0x766f('0x45')](function(_0x4bd640){logger[_0x766f('0x57')](_0x766f('0x58'),_0x4bd640);throw _0x4bd640;});}return _0x303091;})[_0x766f('0x27')](respondWithResult(_0x34921a,null))[_0x766f('0x45')](handleError(_0x34921a,null));};function Extension(_0x3ec1aa,_0xcde185,_0x569bb9,_0x4d6ada){this[_0x766f('0x59')]=_0x766f('0x5a');this[_0x766f('0x5b')]=_0x3ec1aa;this['app']=_0x569bb9;this[_0x766f('0x2f')]='system';this['description']=_0x766f('0x5c');this[_0x766f('0x5d')]=_0xcde185;this[_0x766f('0x5e')]=_0x4d6ada;}function createVoicePrefixExtensions(_0x1ac232,_0x266788,_0x49e4ed){return new BPromise(function(_0x3242ba,_0x49ebf3){var _0x53e435=new Extension(formatPrefixName(_0x1ac232['prefix']),0x1,_0x766f('0x5f'),_0x766f('0x60'));_0x53e435['VoicePrefixId']=_0x1ac232['id'];return db['VoiceExtension'][_0x766f('0x4c')](_0x53e435,{'transaction':_0x49e4ed})[_0x766f('0x27')](function(_0x5316cf){var _0x1ebcda=_0x5316cf[_0x766f('0x25')]({'plain':!![]});var _0x1a97e2=_['map'](addVoicePrefixExtensions(_0x1ac232,_0x266788),function(_0x62e35a){_0x62e35a[_0x766f('0x50')]=_0x1ebcda['id'];_0x62e35a['VoicePrefixId']=_0x1ac232['id'];return _0x62e35a;});return db['VoiceExtension'][_0x766f('0x61')](_0x1a97e2,{'transaction':_0x49e4ed})[_0x766f('0x27')](function(_0x2ab37d){if(!_0x2ab37d){return _0x49ebf3(_0x766f('0x62'));}else{return _0x3242ba(_0x2ab37d);}})[_0x766f('0x45')](function(_0x4ed32b){return _0x49ebf3(_0x4ed32b);});});;});};function addVoicePrefixExtensions(_0x702ae3,_0x552f87){var _0x5ce34e=[];var _0x51e747=formatPrefixName(_0x702ae3[_0x766f('0x63')]);_0x5ce34e[_0x766f('0x64')](new Extension(_0x51e747,0x2,'Set','CDR(prefix)='+_0x702ae3[_0x766f('0x29')]));if(_0x702ae3[_0x766f('0x65')]){_0x5ce34e['push'](new Extension(_0x51e747,0x3,_0x766f('0x66'),'PREFIX-CALLERIDALL='+_0x702ae3[_0x766f('0x65')]));}else{_0x5ce34e['push'](new Extension(_0x51e747,0x3,_0x766f('0x5f'),_0x766f('0x67')));}_0x5ce34e[_0x766f('0x64')](new Extension(_0x51e747,0x4,'goto',_0x552f87[_0x766f('0x59')]+','+_0x766f('0x68')+(0x8+_0x702ae3[_0x766f('0x29')][_0x766f('0x48')])+'}'+','+0x1));return _0x5ce34e;}function formatPrefixName(_0x46b1c8){var _0x427b6f='_';for(var _0x4edf02=0x0;_0x4edf02<_0x46b1c8['length'];_0x4edf02++){if(_0x46b1c8[_0x766f('0x69')](_0x4edf02)=='-'){_0x427b6f+=_0x46b1c8['charAt'](_0x4edf02);}else{_0x427b6f+='['+_0x46b1c8[_0x766f('0x69')](_0x4edf02)+']';}}_0x427b6f+='.';return _0x427b6f;}exports[_0x766f('0x24')]=function(_0x432a4c,_0x2507c3,_0x346488){var _0x1dedae=_0x432a4c[_0x766f('0x6a')];_0x1dedae[_0x766f('0x63')]=_0x766f('0x6b')+_0x1dedae[_0x766f('0x29')]+'-';return db[_0x766f('0x4d')][_0x766f('0x4e')](function(_0x3bf077){return db[_0x766f('0x2c')][_0x766f('0x24')](_0x1dedae,{'where':{'id':_0x1dedae['id']},'transaction':_0x3bf077})['then'](function(){return db[_0x766f('0x4f')][_0x766f('0x49')]({'where':{'VoicePrefixId':_0x1dedae['id']},'transaction':_0x3bf077})[_0x766f('0x27')](function(){return db['VoiceExtension'][_0x766f('0x4a')]({'where':{'id':_0x1dedae['VoiceExtensionId']},'raw':!![]})[_0x766f('0x27')](function(_0x52eb84){return createVoicePrefixExtensions(_0x1dedae,_0x52eb84,_0x3bf077);});});});})[_0x766f('0x27')](function(){return db['VoicePrefix']['findById'](_0x1dedae['id']);})[_0x766f('0x27')](respondWithResult(_0x2507c3,null))[_0x766f('0x45')](handleError(_0x2507c3,null));};exports[_0x766f('0x6c')]=function(_0xe354c2,_0x3a0be0,_0xbca29b){return db[_0x766f('0x2c')][_0x766f('0x4a')]({'where':{'id':_0xe354c2[_0x766f('0x47')]['id']}})[_0x766f('0x27')](handleEntityNotFound(_0x3a0be0,null))[_0x766f('0x27')](function(_0x90105b){if(_0x90105b){return _0x90105b[_0x766f('0x6c')](_0xe354c2[_0x766f('0x6a')][_0x766f('0x6d')],_['omit'](_0xe354c2['body'],[_0x766f('0x6d'),'id'])||{})[_0x766f('0x6e')](function(_0x5c2fcc){for(var _0x2a8fcb=0x0;_0x2a8fcb<_0xe354c2['body'][_0x766f('0x6d')][_0x766f('0x48')];_0x2a8fcb+=0x1){socket[_0x766f('0x6f')]('userVoicePrefix:save',{'UserId':_0xe354c2[_0x766f('0x6a')]['ids'][_0x2a8fcb],'VoicePrefixId':_0xe354c2[_0x766f('0x47')]['id']});}return _0x5c2fcc;});}})[_0x766f('0x27')](respondWithResult(_0x3a0be0,null))[_0x766f('0x45')](handleError(_0x3a0be0,null));};exports[_0x766f('0x70')]=function(_0x28e9e,_0x424f50,_0x54808b){return db[_0x766f('0x2c')][_0x766f('0x4a')]({'where':{'id':_0x28e9e[_0x766f('0x47')]['id']}})[_0x766f('0x27')](handleEntityNotFound(_0x424f50,null))[_0x766f('0x27')](function(_0x157536){if(_0x157536){return _0x157536[_0x766f('0x70')](_0x28e9e[_0x766f('0x35')][_0x766f('0x6d')])['then'](function(){if(_['isArray'](_0x28e9e[_0x766f('0x35')]['ids'])){for(var _0x4af944=0x0;_0x4af944<_0x28e9e['query'][_0x766f('0x6d')][_0x766f('0x48')];_0x4af944+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x28e9e[_0x766f('0x35')][_0x766f('0x6d')][_0x4af944]),'VoicePrefixId':Number(_0x28e9e[_0x766f('0x47')]['id'])});}}else{socket[_0x766f('0x6f')](_0x766f('0x71'),{'UserId':Number(_0x28e9e[_0x766f('0x35')]['ids']),'VoicePrefixId':Number(_0x28e9e[_0x766f('0x47')]['id'])});}});}})[_0x766f('0x27')](respondWithStatusCode(_0x424f50,null))[_0x766f('0x45')](handleError(_0x424f50,null));};exports[_0x766f('0x72')]=function(_0x4f5337,_0x5d4e55,_0x1def1f){var _0x151c39={};var _0x2c4840={};var _0x44d60b;var _0x5cd20f;return db[_0x766f('0x2c')][_0x766f('0x73')]({'where':{'id':_0x4f5337[_0x766f('0x47')]['id']}})[_0x766f('0x27')](handleEntityNotFound(_0x5d4e55,null))[_0x766f('0x27')](function(_0x5ee391){if(_0x5ee391){_0x44d60b=_0x5ee391;_0x2c4840['model']=_['keys'](db[_0x766f('0x74')][_0x766f('0x2d')]);_0x2c4840['query']=_[_0x766f('0x32')](_0x4f5337[_0x766f('0x35')]);_0x2c4840[_0x766f('0x33')]=_[_0x766f('0x34')](_0x2c4840[_0x766f('0x31')],_0x2c4840[_0x766f('0x35')]);_0x151c39[_0x766f('0x36')]=_[_0x766f('0x34')](_0x2c4840[_0x766f('0x31')],qs[_0x766f('0x37')](_0x4f5337[_0x766f('0x35')][_0x766f('0x37')]));_0x151c39[_0x766f('0x36')]=_0x151c39[_0x766f('0x36')][_0x766f('0x48')]?_0x151c39[_0x766f('0x36')]:_0x2c4840[_0x766f('0x31')];_0x151c39['order']=qs[_0x766f('0x3b')](_0x4f5337[_0x766f('0x35')][_0x766f('0x3b')]);_0x151c39[_0x766f('0x3d')]=qs['filters'](_[_0x766f('0x3c')](_0x4f5337[_0x766f('0x35')],_0x2c4840[_0x766f('0x33')]));if(_0x4f5337[_0x766f('0x35')][_0x766f('0x40')]){_0x151c39['where']=_[_0x766f('0x3e')](_0x151c39[_0x766f('0x3d')],{'$or':_[_0x766f('0x2b')](_0x151c39[_0x766f('0x36')],function(_0x551d56){var _0x3c966c={};_0x3c966c[_0x551d56]={'$like':'%'+_0x4f5337['query'][_0x766f('0x40')]+'%'};return _0x3c966c;})});}_0x151c39=_[_0x766f('0x3e')]({},_0x151c39,_0x4f5337[_0x766f('0x41')]);return _0x44d60b[_0x766f('0x72')](_0x151c39);}})[_0x766f('0x27')](function(_0x2e660a){if(_0x2e660a){_0x5cd20f=_0x2e660a['length'];if(!_0x4f5337[_0x766f('0x35')][_0x766f('0x38')](_0x766f('0x39'))){_0x151c39[_0x766f('0x1f')]=qs[_0x766f('0x1f')](_0x4f5337[_0x766f('0x35')][_0x766f('0x1f')]);_0x151c39[_0x766f('0x1e')]=qs[_0x766f('0x1e')](_0x4f5337[_0x766f('0x35')][_0x766f('0x1e')]);}return _0x44d60b['getAgents'](_0x151c39);}})['then'](function(_0x2c7966){if(_0x2c7966){return _0x2c7966?{'count':_0x5cd20f,'rows':_0x2c7966}:null;}})[_0x766f('0x27')](respondWithResult(_0x5d4e55,null))[_0x766f('0x45')](handleError(_0x5d4e55,null));}; \ No newline at end of file +var _0x2913=['appdata','Voice\x20Prefix','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','goto','${EXTEN:','charAt','prefix','system-','destroy','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','VoicePrefixes','UserProfileResource','error','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','find','catch','describe','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority'];(function(_0x5baddd,_0x5da48f){var _0x18832f=function(_0x537043){while(--_0x537043){_0x5baddd['push'](_0x5baddd['shift']());}};_0x18832f(++_0x5da48f);}(_0x2913,0x123));var _0x3291=function(_0x26e2e9,_0xde6600){_0x26e2e9=_0x26e2e9-0x0;var _0x5ec2e5=_0x2913[_0x26e2e9];return _0x5ec2e5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3291('0x0'));var zipdir=require(_0x3291('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3291('0x2'));var moment=require(_0x3291('0x3'));var BPromise=require(_0x3291('0x4'));var Mustache=require(_0x3291('0x5'));var util=require(_0x3291('0x6'));var path=require(_0x3291('0x7'));var sox=require(_0x3291('0x8'));var csv=require(_0x3291('0x9'));var ejs=require(_0x3291('0xa'));var fs=require('fs');var fs_extra=require(_0x3291('0xb'));var _=require(_0x3291('0xc'));var squel=require(_0x3291('0xd'));var crypto=require(_0x3291('0xe'));var jsforce=require(_0x3291('0xf'));var deskjs=require(_0x3291('0x10'));var toCsv=require(_0x3291('0x9'));var querystring=require(_0x3291('0x11'));var Papa=require(_0x3291('0x12'));var Redis=require(_0x3291('0x13'));var authService=require(_0x3291('0x14'));var qs=require(_0x3291('0x15'));var as=require(_0x3291('0x16'));var hardwareService=require(_0x3291('0x17'));var logger=require(_0x3291('0x18'))(_0x3291('0x19'));var utils=require(_0x3291('0x1a'));var config=require(_0x3291('0x1b'));var licenseUtil=require(_0x3291('0x1c'));var db=require(_0x3291('0x1d'))['db'];config[_0x3291('0x1e')]=_[_0x3291('0x1f')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3291('0x20'))(new Redis(config[_0x3291('0x1e')]));require(_0x3291('0x21'))[_0x3291('0x22')](socket);function respondWithStatusCode(_0x18d27e,_0x46bc65){_0x46bc65=_0x46bc65||0xcc;return function(_0x52b8ce){if(_0x52b8ce){return _0x18d27e[_0x3291('0x23')](_0x46bc65);}return _0x18d27e[_0x3291('0x24')](_0x46bc65)[_0x3291('0x25')]();};}function respondWithResult(_0x1ff4ac,_0xc7ab9){_0xc7ab9=_0xc7ab9||0xc8;return function(_0x532266){if(_0x532266){return _0x1ff4ac[_0x3291('0x24')](_0xc7ab9)[_0x3291('0x26')](_0x532266);}};}function respondWithFilteredResult(_0x4041fa,_0x1d4022){return function(_0x1957fa){if(_0x1957fa){var _0x39f492=_0x1957fa[_0x3291('0x27')],_0x3efa26=_0x1d4022[_0x3291('0x28')],_0x2d51c5=_0x1d4022[_0x3291('0x28')]+_0x1d4022[_0x3291('0x29')],_0x2c005f;if(_0x2d51c5>=_0x39f492){_0x2d51c5=_0x39f492;_0x2c005f=0xc8;}else{_0x2c005f=0xce;}_0x4041fa[_0x3291('0x24')](_0x2c005f);return _0x4041fa[_0x3291('0x2a')](_0x3291('0x2b'),_0x3efa26+'-'+_0x2d51c5+'/'+_0x39f492)[_0x3291('0x26')](_0x1957fa);}return null;};}function patchUpdates(_0x14a1ab){return function(_0x179af8){try{jsonpatch['apply'](_0x179af8,_0x14a1ab,!![]);}catch(_0x57adbf){return BPromise[_0x3291('0x2c')](_0x57adbf);}return _0x179af8[_0x3291('0x2d')]();};}function saveUpdates(_0x375b25,_0x1dd0af){return function(_0x352045){if(_0x352045){return _0x352045[_0x3291('0x2e')](_0x375b25)['then'](function(_0x5e1206){return _0x5e1206;});}return null;};}function removeEntity(_0x50a2df,_0x1e582d){return function(_0x4876f4){if(_0x4876f4){return _0x4876f4['destroy']()[_0x3291('0x2f')](function(){var _0x5d8a04=_0x4876f4[_0x3291('0x30')]({'plain':!![]});var _0x41914a=_0x3291('0x31');return db[_0x3291('0x32')]['destroy']({'where':{'type':_0x41914a,'resourceId':_0x5d8a04['id']}})[_0x3291('0x2f')](function(){return _0x4876f4;});})[_0x3291('0x2f')](function(){_0x50a2df[_0x3291('0x24')](0xcc)[_0x3291('0x25')]();});}};}function handleEntityNotFound(_0xcf996,_0x25a72f){return function(_0x14720b){if(!_0x14720b){_0xcf996['sendStatus'](0x194);}return _0x14720b;};}function handleError(_0x456106,_0x8c1561){_0x8c1561=_0x8c1561||0x1f4;return function(_0x5dfc33){logger[_0x3291('0x33')](_0x5dfc33['stack']);if(_0x5dfc33[_0x3291('0x34')]){delete _0x5dfc33[_0x3291('0x34')];}_0x456106[_0x3291('0x24')](_0x8c1561)[_0x3291('0x35')](_0x5dfc33);};}exports[_0x3291('0x36')]=function(_0x3d9f71,_0x406c0e){var _0xd0e0e7={},_0x1ce1b7={},_0x2f5206={'count':0x0,'rows':[]};var _0x447628=_['map'](db[_0x3291('0x37')][_0x3291('0x38')],function(_0x3a3768){return{'name':_0x3a3768[_0x3291('0x39')],'type':_0x3a3768[_0x3291('0x3a')][_0x3291('0x3b')]};});_0x1ce1b7[_0x3291('0x3c')]=_[_0x3291('0x3d')](_0x447628,'name');_0x1ce1b7['query']=_['keys'](_0x3d9f71[_0x3291('0x3e')]);_0x1ce1b7[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x1ce1b7['model'],_0x1ce1b7[_0x3291('0x3e')]);_0xd0e0e7[_0x3291('0x41')]=_[_0x3291('0x40')](_0x1ce1b7['model'],qs['fields'](_0x3d9f71['query'][_0x3291('0x42')]));_0xd0e0e7[_0x3291('0x41')]=_0xd0e0e7[_0x3291('0x41')][_0x3291('0x43')]?_0xd0e0e7[_0x3291('0x41')]:_0x1ce1b7['model'];if(!_0x3d9f71[_0x3291('0x3e')][_0x3291('0x44')](_0x3291('0x45'))){_0xd0e0e7[_0x3291('0x29')]=qs[_0x3291('0x29')](_0x3d9f71[_0x3291('0x3e')][_0x3291('0x29')]);_0xd0e0e7[_0x3291('0x28')]=qs[_0x3291('0x28')](_0x3d9f71[_0x3291('0x3e')]['offset']);}_0xd0e0e7[_0x3291('0x46')]=qs[_0x3291('0x47')](_0x3d9f71[_0x3291('0x3e')][_0x3291('0x47')]);_0xd0e0e7[_0x3291('0x48')]=qs[_0x3291('0x3f')](_[_0x3291('0x49')](_0x3d9f71['query'],_0x1ce1b7[_0x3291('0x3f')]),_0x447628);if(_0x3d9f71['query'][_0x3291('0x4a')]){_0xd0e0e7[_0x3291('0x48')]=_[_0x3291('0x4b')](_0xd0e0e7[_0x3291('0x48')],{'$or':_['map'](_0x447628,function(_0x17880f){if(_0x17880f[_0x3291('0x3a')]!==_0x3291('0x4c')){var _0x187c1f={};_0x187c1f[_0x17880f[_0x3291('0x34')]]={'$like':'%'+_0x3d9f71['query'][_0x3291('0x4a')]+'%'};return _0x187c1f;}})});}_0xd0e0e7=_[_0x3291('0x4b')]({},_0xd0e0e7,_0x3d9f71[_0x3291('0x4d')]);var _0xdb7ea0={'where':_0xd0e0e7['where']};return db[_0x3291('0x37')]['count'](_0xdb7ea0)['then'](function(_0x26d0f7){_0x2f5206['count']=_0x26d0f7;if(_0x3d9f71[_0x3291('0x3e')]['includeAll']){_0xd0e0e7[_0x3291('0x4e')]=[{'all':!![]}];}return db[_0x3291('0x37')][_0x3291('0x4f')](_0xd0e0e7);})['then'](function(_0x4418a0){_0x2f5206[_0x3291('0x50')]=_0x4418a0;return _0x2f5206;})[_0x3291('0x2f')](respondWithFilteredResult(_0x406c0e,_0xd0e0e7))['catch'](handleError(_0x406c0e,null));};exports['show']=function(_0x5d4c38,_0x3b6e84){var _0x42a534={'raw':![],'where':{'id':_0x5d4c38[_0x3291('0x51')]['id']}},_0x9e7690={};_0x9e7690['model']=_[_0x3291('0x52')](db[_0x3291('0x37')][_0x3291('0x38')]);_0x9e7690[_0x3291('0x3e')]=_[_0x3291('0x52')](_0x5d4c38['query']);_0x9e7690[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x9e7690['model'],_0x9e7690[_0x3291('0x3e')]);_0x42a534[_0x3291('0x41')]=_[_0x3291('0x40')](_0x9e7690[_0x3291('0x3c')],qs[_0x3291('0x42')](_0x5d4c38['query'][_0x3291('0x42')]));_0x42a534[_0x3291('0x41')]=_0x42a534['attributes'][_0x3291('0x43')]?_0x42a534['attributes']:_0x9e7690[_0x3291('0x3c')];if(_0x5d4c38['query']['includeAll']){_0x42a534[_0x3291('0x4e')]=[{'all':!![]}];}_0x42a534=_[_0x3291('0x4b')]({},_0x42a534,_0x5d4c38['options']);return db[_0x3291('0x37')][_0x3291('0x53')](_0x42a534)[_0x3291('0x2f')](handleEntityNotFound(_0x3b6e84,null))[_0x3291('0x2f')](respondWithResult(_0x3b6e84,null))[_0x3291('0x54')](handleError(_0x3b6e84,null));};exports['destroy']=function(_0x22fda9,_0x395b6c){return db[_0x3291('0x37')]['find']({'where':{'id':_0x22fda9['params']['id']}})[_0x3291('0x2f')](handleEntityNotFound(_0x395b6c,null))[_0x3291('0x2f')](removeEntity(_0x395b6c,null))['catch'](handleError(_0x395b6c,null));};exports['describe']=function(_0x8cc4dc,_0x3c6eab){return db[_0x3291('0x37')][_0x3291('0x55')]()[_0x3291('0x2f')](respondWithResult(_0x3c6eab,null))[_0x3291('0x54')](handleError(_0x3c6eab,null));};exports['create']=function(_0x5d858f,_0x182d61){var _0x18933e;return db[_0x3291('0x56')][_0x3291('0x57')](function(_0x36d41d){return db[_0x3291('0x37')][_0x3291('0x58')](_0x5d858f[_0x3291('0x59')],{'transaction':_0x36d41d})[_0x3291('0x2f')](function(_0x436f87){_0x18933e=_0x436f87[_0x3291('0x30')]({'plain':!![]});return db[_0x3291('0x5a')][_0x3291('0x53')]({'where':{'id':_0x18933e[_0x3291('0x5b')]},'raw':!![]})[_0x3291('0x2f')](function(_0xa84fcd){return createVoicePrefixExtensions(_0x18933e,_0xa84fcd,_0x36d41d);});});})['then'](function(){var _0x50cc97=_0x5d858f[_0x3291('0x5c')]['get']({'plain':!![]});if(!_0x50cc97)throw new Error(_0x3291('0x5d'));if(_0x50cc97[_0x3291('0x5e')]===_0x3291('0x5c')){var _0x3d2d62=_0x18933e;return db[_0x3291('0x5f')]['find']({'where':{'name':_0x3291('0x31'),'userProfileId':_0x50cc97[_0x3291('0x60')]},'raw':!![]})['then'](function(_0x37f36b){if(_0x37f36b&&_0x37f36b[_0x3291('0x61')]===0x0){return db[_0x3291('0x32')][_0x3291('0x58')]({'name':_0x3d2d62[_0x3291('0x34')],'resourceId':_0x3d2d62['id'],'type':_0x37f36b[_0x3291('0x34')],'sectionId':_0x37f36b['id']},{})['then'](function(){return _0x18933e;});}else{return _0x18933e;}})[_0x3291('0x54')](function(_0x1840ce){logger[_0x3291('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1840ce);throw _0x1840ce;});}return _0x18933e;})[_0x3291('0x2f')](respondWithResult(_0x182d61,null))['catch'](handleError(_0x182d61,null));};function Extension(_0x305819,_0x29fed8,_0x33060e,_0x289ad7){this[_0x3291('0x62')]=_0x3291('0x63');this[_0x3291('0x64')]=_0x305819;this[_0x3291('0x65')]=_0x33060e;this[_0x3291('0x3a')]='system';this[_0x3291('0x66')]=_0x3291('0x67');this[_0x3291('0x68')]=_0x29fed8;this[_0x3291('0x69')]=_0x289ad7;}function createVoicePrefixExtensions(_0x2eae96,_0x4a3c6e,_0x297338){return new BPromise(function(_0x2452c8,_0x4e034b){var _0x56fc7b=new Extension(formatPrefixName(_0x2eae96['prefix']),0x1,'NoOp',_0x3291('0x6a'));_0x56fc7b['VoicePrefixId']=_0x2eae96['id'];return db[_0x3291('0x5a')][_0x3291('0x58')](_0x56fc7b,{'transaction':_0x297338})[_0x3291('0x2f')](function(_0x212d50){var _0x586e81=_0x212d50[_0x3291('0x30')]({'plain':!![]});var _0x31853a=_[_0x3291('0x3d')](addVoicePrefixExtensions(_0x2eae96,_0x4a3c6e),function(_0x4c00d8){_0x4c00d8[_0x3291('0x5b')]=_0x586e81['id'];_0x4c00d8['VoicePrefixId']=_0x2eae96['id'];return _0x4c00d8;});return db['VoiceExtension']['bulkCreate'](_0x31853a,{'transaction':_0x297338})[_0x3291('0x2f')](function(_0x42b7a3){if(!_0x42b7a3){return _0x4e034b(_0x3291('0x6b'));}else{return _0x2452c8(_0x42b7a3);}})['catch'](function(_0x483a52){return _0x4e034b(_0x483a52);});});;});};function addVoicePrefixExtensions(_0x544259,_0x5e0a07){var _0x2070a1=[];var _0x36e593=formatPrefixName(_0x544259['prefix']);_0x2070a1[_0x3291('0x6c')](new Extension(_0x36e593,0x2,_0x3291('0x6d'),_0x3291('0x6e')+_0x544259[_0x3291('0x34')]));if(_0x544259[_0x3291('0x6f')]){_0x2070a1[_0x3291('0x6c')](new Extension(_0x36e593,0x3,_0x3291('0x6d'),_0x3291('0x70')+_0x544259['callerIdAll']));}else{_0x2070a1[_0x3291('0x6c')](new Extension(_0x36e593,0x3,_0x3291('0x71'),'No\x20callerid\x20available'));}_0x2070a1[_0x3291('0x6c')](new Extension(_0x36e593,0x4,_0x3291('0x72'),_0x5e0a07[_0x3291('0x62')]+','+_0x3291('0x73')+(0x8+_0x544259['name'][_0x3291('0x43')])+'}'+','+0x1));return _0x2070a1;}function formatPrefixName(_0x1b01aa){var _0x9dc4eb='_';for(var _0x432a25=0x0;_0x432a25<_0x1b01aa['length'];_0x432a25++){if(_0x1b01aa['charAt'](_0x432a25)=='-'){_0x9dc4eb+=_0x1b01aa[_0x3291('0x74')](_0x432a25);}else{_0x9dc4eb+='['+_0x1b01aa['charAt'](_0x432a25)+']';}}_0x9dc4eb+='.';return _0x9dc4eb;}exports[_0x3291('0x2e')]=function(_0x2ce523,_0xd90d0e,_0x632243){var _0x22e12e=_0x2ce523['body'];_0x22e12e[_0x3291('0x75')]=_0x3291('0x76')+_0x22e12e[_0x3291('0x34')]+'-';return db[_0x3291('0x56')]['transaction'](function(_0x33bebc){return db[_0x3291('0x37')][_0x3291('0x2e')](_0x22e12e,{'where':{'id':_0x22e12e['id']},'transaction':_0x33bebc})[_0x3291('0x2f')](function(){return db[_0x3291('0x5a')][_0x3291('0x77')]({'where':{'VoicePrefixId':_0x22e12e['id']},'transaction':_0x33bebc})[_0x3291('0x2f')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x22e12e[_0x3291('0x5b')]},'raw':!![]})[_0x3291('0x2f')](function(_0x5666aa){return createVoicePrefixExtensions(_0x22e12e,_0x5666aa,_0x33bebc);});});});})[_0x3291('0x2f')](function(){return db[_0x3291('0x37')][_0x3291('0x78')](_0x22e12e['id']);})[_0x3291('0x2f')](respondWithResult(_0xd90d0e,null))[_0x3291('0x54')](handleError(_0xd90d0e,null));};exports[_0x3291('0x79')]=function(_0x525479,_0x5d5dd4,_0x36c36a){return db['VoicePrefix'][_0x3291('0x53')]({'where':{'id':_0x525479[_0x3291('0x51')]['id']}})[_0x3291('0x2f')](handleEntityNotFound(_0x5d5dd4,null))['then'](function(_0xcdfd2d){if(_0xcdfd2d){return _0xcdfd2d[_0x3291('0x79')](_0x525479[_0x3291('0x59')][_0x3291('0x7a')],_[_0x3291('0x7b')](_0x525479['body'],[_0x3291('0x7a'),'id'])||{})['spread'](function(_0x52f317){for(var _0x1f4c6b=0x0;_0x1f4c6b<_0x525479[_0x3291('0x59')][_0x3291('0x7a')][_0x3291('0x43')];_0x1f4c6b+=0x1){socket[_0x3291('0x7c')](_0x3291('0x7d'),{'UserId':_0x525479['body'][_0x3291('0x7a')][_0x1f4c6b],'VoicePrefixId':_0x525479['params']['id']});}return _0x52f317;});}})[_0x3291('0x2f')](respondWithResult(_0x5d5dd4,null))[_0x3291('0x54')](handleError(_0x5d5dd4,null));};exports['removeAgents']=function(_0x1b48d8,_0x590d50,_0x28c64d){return db[_0x3291('0x37')][_0x3291('0x53')]({'where':{'id':_0x1b48d8[_0x3291('0x51')]['id']}})['then'](handleEntityNotFound(_0x590d50,null))['then'](function(_0x3529df){if(_0x3529df){return _0x3529df[_0x3291('0x7e')](_0x1b48d8['query'][_0x3291('0x7a')])['then'](function(){if(_[_0x3291('0x7f')](_0x1b48d8[_0x3291('0x3e')][_0x3291('0x7a')])){for(var _0x4338d7=0x0;_0x4338d7<_0x1b48d8[_0x3291('0x3e')]['ids'][_0x3291('0x43')];_0x4338d7+=0x1){socket[_0x3291('0x7c')](_0x3291('0x80'),{'UserId':Number(_0x1b48d8[_0x3291('0x3e')][_0x3291('0x7a')][_0x4338d7]),'VoicePrefixId':Number(_0x1b48d8[_0x3291('0x51')]['id'])});}}else{socket[_0x3291('0x7c')](_0x3291('0x80'),{'UserId':Number(_0x1b48d8['query'][_0x3291('0x7a')]),'VoicePrefixId':Number(_0x1b48d8[_0x3291('0x51')]['id'])});}});}})[_0x3291('0x2f')](respondWithStatusCode(_0x590d50,null))['catch'](handleError(_0x590d50,null));};exports[_0x3291('0x81')]=function(_0x4dca53,_0x299688,_0x39b5ca){var _0x3c3271={};var _0x1c5342={};var _0x2916bf;var _0x89ece9;return db[_0x3291('0x37')][_0x3291('0x82')]({'where':{'id':_0x4dca53[_0x3291('0x51')]['id']}})[_0x3291('0x2f')](handleEntityNotFound(_0x299688,null))[_0x3291('0x2f')](function(_0x27d710){if(_0x27d710){_0x2916bf=_0x27d710;_0x1c5342['model']=_[_0x3291('0x52')](db[_0x3291('0x83')][_0x3291('0x38')]);_0x1c5342[_0x3291('0x3e')]=_[_0x3291('0x52')](_0x4dca53[_0x3291('0x3e')]);_0x1c5342[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x1c5342[_0x3291('0x3c')],_0x1c5342[_0x3291('0x3e')]);_0x3c3271[_0x3291('0x41')]=_[_0x3291('0x40')](_0x1c5342[_0x3291('0x3c')],qs['fields'](_0x4dca53['query'][_0x3291('0x42')]));_0x3c3271[_0x3291('0x41')]=_0x3c3271['attributes'][_0x3291('0x43')]?_0x3c3271[_0x3291('0x41')]:_0x1c5342[_0x3291('0x3c')];_0x3c3271[_0x3291('0x46')]=qs['sort'](_0x4dca53[_0x3291('0x3e')][_0x3291('0x47')]);_0x3c3271[_0x3291('0x48')]=qs[_0x3291('0x3f')](_[_0x3291('0x49')](_0x4dca53[_0x3291('0x3e')],_0x1c5342['filters']));if(_0x4dca53['query'][_0x3291('0x4a')]){_0x3c3271[_0x3291('0x48')]=_[_0x3291('0x4b')](_0x3c3271['where'],{'$or':_[_0x3291('0x3d')](_0x3c3271['attributes'],function(_0x5df012){var _0x13d40a={};_0x13d40a[_0x5df012]={'$like':'%'+_0x4dca53[_0x3291('0x3e')][_0x3291('0x4a')]+'%'};return _0x13d40a;})});}_0x3c3271=_['merge']({},_0x3c3271,_0x4dca53[_0x3291('0x4d')]);return _0x2916bf[_0x3291('0x81')](_0x3c3271);}})[_0x3291('0x2f')](function(_0x3068fd){if(_0x3068fd){_0x89ece9=_0x3068fd[_0x3291('0x43')];if(!_0x4dca53[_0x3291('0x3e')][_0x3291('0x44')](_0x3291('0x45'))){_0x3c3271[_0x3291('0x29')]=qs[_0x3291('0x29')](_0x4dca53[_0x3291('0x3e')]['limit']);_0x3c3271['offset']=qs[_0x3291('0x28')](_0x4dca53[_0x3291('0x3e')][_0x3291('0x28')]);}return _0x2916bf['getAgents'](_0x3c3271);}})[_0x3291('0x2f')](function(_0x169744){if(_0x169744){return _0x169744?{'count':_0x89ece9,'rows':_0x169744}:null;}})[_0x3291('0x2f')](respondWithResult(_0x299688,null))[_0x3291('0x54')](handleError(_0x299688,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b93edd3..fecc3d5 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xedd9,0xfc));var _0x9edd=function(_0x1da35b,_0x3a16e4){_0x1da35b=_0x1da35b-0x0;var _0x2743b9=_0xedd9[_0x1da35b];return _0x2743b9;};'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 deed636..a8f53c9 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 _0xbbd0=['../../config/environment','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x369289,_0xb779d8){var _0x1c8ba4=function(_0x28cc27){while(--_0x28cc27){_0x369289['push'](_0x369289['shift']());}};_0x1c8ba4(++_0xb779d8);}(_0xbbd0,0x1d1));var _0x0bbd=function(_0x29e7c7,_0x4459dd){_0x29e7c7=_0x29e7c7-0x0;var _0xe4af8=_0xbbd0[_0x29e7c7];return _0xe4af8;};'use strict';var _=require(_0x0bbd('0x0'));var util=require(_0x0bbd('0x1'));var logger=require(_0x0bbd('0x2'))(_0x0bbd('0x3'));var moment=require(_0x0bbd('0x4'));var BPromise=require(_0x0bbd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bbd('0x6'));var rimraf=require(_0x0bbd('0x7'));var config=require(_0x0bbd('0x8'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x2520bf,_0x305f2f){return _0x2520bf['define'](_0x0bbd('0x9'),attributes,{'tableName':_0x0bbd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb66=['api','moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdb66,0x11e));var _0x6db6=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xdb66[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x6db6('0x0'));var util=require(_0x6db6('0x1'));var logger=require('../../config/logger')(_0x6db6('0x2'));var moment=require(_0x6db6('0x3'));var BPromise=require(_0x6db6('0x4'));var rp=require(_0x6db6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6db6('0x6'));var attributes=require(_0x6db6('0x7'));module[_0x6db6('0x8')]=function(_0x1a0f72,_0x5524d2){return _0x1a0f72[_0x6db6('0x9')](_0x6db6('0xa'),attributes,{'tableName':_0x6db6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 3b246d7..5756d3e 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 _0x061c=['../../config/utils','../../config/logger','../../config/environment','client','defaults','localhost','socket.io-emitter','register','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','info','util','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x061c,0x1d0));var _0xc061=function(_0x344136,_0x19bf07){_0x344136=_0x344136-0x0;var _0x68c0ef=_0x061c[_0x344136];return _0x68c0ef;};'use strict';var _=require('lodash');var util=require(_0xc061('0x0'));var moment=require('moment');var BPromise=require(_0xc061('0x1'));var rs=require(_0xc061('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc061('0x3'))['db'];var utils=require(_0xc061('0x4'));var logger=require(_0xc061('0x5'))('rpc');var config=require(_0xc061('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc061('0x7')]['http']({'port':0x232a});config['redis']=_[_0xc061('0x8')](config['redis'],{'host':_0xc061('0x9'),'port':0x18eb});var socket=require(_0xc061('0xa'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xc061('0xb')](socket);function respondWithRpcPromise(_0x22284b,_0x444198,_0x465a28){return new BPromise(function(_0x1dfdde,_0x3edb9f){return client['request'](_0x22284b,_0x465a28)['then'](function(_0xcb3e21){logger['info'](_0xc061('0xc'),_0x444198,_0xc061('0xd'));logger['debug'](_0xc061('0xe'),_0x444198,'request\x20sent',JSON['stringify'](_0xcb3e21));if(_0xcb3e21[_0xc061('0xf')]){if(_0xcb3e21[_0xc061('0xf')]['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x444198,_0xcb3e21[_0xc061('0xf')][_0xc061('0x10')]);return _0x3edb9f(_0xcb3e21['error']['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x444198,_0xcb3e21[_0xc061('0xf')][_0xc061('0x10')]);return _0x1dfdde(_0xcb3e21['error'][_0xc061('0x10')]);}else{logger[_0xc061('0x11')](_0xc061('0xc'),_0x444198,_0xc061('0xd'));_0x1dfdde(_0xcb3e21['result'][_0xc061('0x10')]);}})['catch'](function(_0x416750){logger[_0xc061('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x444198,_0x416750);_0x3edb9f(_0x416750);});});} \ No newline at end of file +var _0xa8a0=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa8a0,0x9e));var _0x0a8a=function(_0x47da9e,_0x4bb117){_0x47da9e=_0x47da9e-0x0;var _0x15ab57=_0xa8a0[_0x47da9e];return _0x15ab57;};'use strict';var _=require(_0x0a8a('0x0'));var util=require(_0x0a8a('0x1'));var moment=require('moment');var BPromise=require(_0x0a8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a8a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a8a('0x4'))(_0x0a8a('0x5'));var config=require(_0x0a8a('0x6'));var jayson=require(_0x0a8a('0x7'));var client=jayson[_0x0a8a('0x8')][_0x0a8a('0x9')]({'port':0x232a});config[_0x0a8a('0xa')]=_[_0x0a8a('0xb')](config[_0x0a8a('0xa')],{'host':_0x0a8a('0xc'),'port':0x18eb});var socket=require(_0x0a8a('0xd'))(new Redis(config['redis']));require(_0x0a8a('0xe'))[_0x0a8a('0xf')](socket);function respondWithRpcPromise(_0x1dca7e,_0x5ec9b4,_0x5f2fdd){return new BPromise(function(_0x6fd564,_0x167cac){return client['request'](_0x1dca7e,_0x5f2fdd)['then'](function(_0x399490){logger[_0x0a8a('0x10')](_0x0a8a('0x11'),_0x5ec9b4,_0x0a8a('0x12'));logger['debug'](_0x0a8a('0x13'),_0x5ec9b4,_0x0a8a('0x12'),JSON[_0x0a8a('0x14')](_0x399490));if(_0x399490[_0x0a8a('0x15')]){if(_0x399490[_0x0a8a('0x15')][_0x0a8a('0x16')]===0x1f4){logger[_0x0a8a('0x15')](_0x0a8a('0x11'),_0x5ec9b4,_0x399490[_0x0a8a('0x15')][_0x0a8a('0x17')]);return _0x167cac(_0x399490[_0x0a8a('0x15')][_0x0a8a('0x17')]);}logger[_0x0a8a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x5ec9b4,_0x399490[_0x0a8a('0x15')][_0x0a8a('0x17')]);return _0x6fd564(_0x399490[_0x0a8a('0x15')]['message']);}else{logger[_0x0a8a('0x10')](_0x0a8a('0x11'),_0x5ec9b4,_0x0a8a('0x12'));_0x6fd564(_0x399490[_0x0a8a('0x18')]['message']);}})[_0x0a8a('0x19')](function(_0x41ca5c){logger[_0x0a8a('0x15')](_0x0a8a('0x11'),_0x5ec9b4,_0x41ca5c);_0x167cac(_0x41ca5c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 74606b3..f4a5b15 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 _0x3657=['remove','update','emit','register','length','voicePrefix:','save'];(function(_0x128e44,_0x66067c){var _0x319658=function(_0x49d71c){while(--_0x49d71c){_0x128e44['push'](_0x128e44['shift']());}};_0x319658(++_0x66067c);}(_0x3657,0x15d));var _0x7365=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x3657[_0x102ff9];return _0x24fa97;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x7365('0x0'),_0x7365('0x1'),_0x7365('0x2')];function createListener(_0x55ab35,_0x349cae){return function(_0x292234){_0x349cae[_0x7365('0x3')](_0x55ab35,_0x292234);};}function removeListener(_0x218d99,_0xd9ce2f){return function(){VoicePrefixEvents['removeListener'](_0x218d99,_0xd9ce2f);};}exports[_0x7365('0x4')]=function(_0x3103c6){for(var _0x226b33=0x0,_0x39edf9=events[_0x7365('0x5')];_0x226b33<_0x39edf9;_0x226b33++){var _0xefbee9=events[_0x226b33];var _0x4881b2=createListener(_0x7365('0x6')+_0xefbee9,_0x3103c6);VoicePrefixEvents['on'](_0xefbee9,_0x4881b2);}}; \ No newline at end of file +var _0x0087=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x602f33,_0x26af94){var _0x3520b4=function(_0x48c79f){while(--_0x48c79f){_0x602f33['push'](_0x602f33['shift']());}};_0x3520b4(++_0x26af94);}(_0x0087,0xb4));var _0x7008=function(_0x29e91f,_0x19746f){_0x29e91f=_0x29e91f-0x0;var _0x96024=_0x0087[_0x29e91f];return _0x96024;};'use strict';var VoicePrefixEvents=require(_0x7008('0x0'));var events=[_0x7008('0x1'),_0x7008('0x2'),_0x7008('0x3')];function createListener(_0x29c54e,_0x39591a){return function(_0x4531bd){_0x39591a['emit'](_0x29c54e,_0x4531bd);};}function removeListener(_0x2beaa4,_0xabcaa6){return function(){VoicePrefixEvents[_0x7008('0x4')](_0x2beaa4,_0xabcaa6);};}exports[_0x7008('0x5')]=function(_0x2604ed){for(var _0x3cae9a=0x0,_0x437044=events[_0x7008('0x6')];_0x3cae9a<_0x437044;_0x3cae9a++){var _0x430e4b=events[_0x3cae9a];var _0x1b3d8a=createListener(_0x7008('0x7')+_0x430e4b,_0x2604ed);VoicePrefixEvents['on'](_0x430e4b,_0x1b3d8a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ed49787..bad15cb 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 _0x1a85=['delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','addLists','addBlackLists'];(function(_0x2d6f40,_0x1c2800){var _0x343ca7=function(_0x1874a9){while(--_0x1874a9){_0x2d6f40['push'](_0x2d6f40['shift']());}};_0x343ca7(++_0x1c2800);}(_0x1a85,0x178));var _0x51a8=function(_0x32bff9,_0x3f27d5){_0x32bff9=_0x32bff9-0x0;var _0xbab93=_0x1a85[_0x32bff9];return _0xbab93;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./voiceQueue.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['show']);router[_0x51a8('0x6')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0x6')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0x6')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xe')]);router[_0x51a8('0x6')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x10')]);router[_0x51a8('0x6')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x12')]);router['get'](_0x51a8('0x13'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x14')]);router['get'](_0x51a8('0x15'),auth['isAuthenticated'](),controller[_0x51a8('0x16')]);router[_0x51a8('0x6')](_0x51a8('0x17'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x18')]);router[_0x51a8('0x6')](_0x51a8('0x19'),auth['isAuthenticated'](),controller[_0x51a8('0x1a')]);router[_0x51a8('0x1b')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0x1c')]);router[_0x51a8('0x1b')](_0x51a8('0x1d'),auth['isAuthenticated'](),controller[_0x51a8('0x1e')]);router[_0x51a8('0x1b')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x1f')]);router[_0x51a8('0x1b')](_0x51a8('0x13'),auth[_0x51a8('0x9')](),controller['addAgents']);router[_0x51a8('0x1b')]('/:id/lists',auth[_0x51a8('0x9')](),controller[_0x51a8('0x20')]);router[_0x51a8('0x1b')](_0x51a8('0x19'),auth['isAuthenticated'](),controller[_0x51a8('0x21')]);router['put']('/:id',auth[_0x51a8('0x9')](),controller['update']);router[_0x51a8('0x22')](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x23')]);router[_0x51a8('0x22')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x24')]);router['delete'](_0x51a8('0x13'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x25')]);router[_0x51a8('0x22')](_0x51a8('0x17'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x26')]);router[_0x51a8('0x22')](_0x51a8('0x19'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x27')]);module[_0x51a8('0x28')]=router; \ No newline at end of file +var _0xef0f=['isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','/:id/users','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','addTeams','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef0f,0x168));var _0xfef0=function(_0x9809ff,_0x4aa0e3){_0x9809ff=_0x9809ff-0x0;var _0x3666ec=_0xef0f[_0x9809ff];return _0x3666ec;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0x8')](_0xfef0('0xf'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x8')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x8')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller['getHopperBlacks']);router[_0xfef0('0x8')](_0xfef0('0x14'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x15')]);router[_0xfef0('0x8')](_0xfef0('0x16'),auth[_0xfef0('0x9')](),controller['getAgents']);router[_0xfef0('0x8')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xfef0('0x8')](_0xfef0('0x17'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x18')]);router[_0xfef0('0x8')](_0xfef0('0x19'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x1a')]);router['post']('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x1b')]);router[_0xfef0('0x1c')](_0xfef0('0x1d'),auth[_0xfef0('0x9')](),controller['clone']);router[_0xfef0('0x1c')]('/:id/teams',auth[_0xfef0('0x9')](),controller[_0xfef0('0x1e')]);router[_0xfef0('0x1c')]('/:id/users',auth[_0xfef0('0x9')](),controller['addAgents']);router[_0xfef0('0x1c')](_0xfef0('0x17'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0xfef0('0x19'),auth['isAuthenticated'](),controller[_0xfef0('0x1f')]);router[_0xfef0('0x20')](_0xfef0('0xb'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x21')]);router[_0xfef0('0x22')]('/:id',auth['isAuthenticated'](),controller[_0xfef0('0x23')]);router[_0xfef0('0x22')](_0xfef0('0x14'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x24')]);router[_0xfef0('0x22')](_0xfef0('0x16'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x25')]);router['delete'](_0xfef0('0x17'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x26')]);router[_0xfef0('0x22')](_0xfef0('0x19'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x27')]);module[_0xfef0('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 7178011..183b2b7 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 _0x1bc4=['periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','never','onlyIfOpen','always','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Minutes\x20to\x20wait\x20to\x20call\x20next\x20additional\x20phone\x20number\x20','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x1bc4,0xd3));var _0x41bc=function(_0x24e88d,_0xb947f0){_0x24e88d=_0x24e88d-0x0;var _0x580070=_0x1bc4[_0x24e88d];return _0x580070;};'use strict';var Sequelize=require(_0x41bc('0x0'));module['exports']={'name':{'type':Sequelize[_0x41bc('0x1')],'allowNull':![],'unique':_0x41bc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x41bc('0x5')},'announce':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x41bc('0x6'),'leastrecent',_0x41bc('0x7'),_0x41bc('0x8'),_0x41bc('0x9'),_0x41bc('0xa'),_0x41bc('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x1748d8){this[_0x41bc('0xc')](_0x41bc('0xd'),_0x1748d8?_0x1748d8:_0x41bc('0x9'));},'get':function(){var _0x42415c=this[_0x41bc('0xe')](_0x41bc('0xf'));var _0x45e3e1=this[_0x41bc('0xe')](_0x41bc('0x10'));var _0x30da76=this[_0x41bc('0xe')](_0x41bc('0xd'));if(_0x42415c==='inbound'){return _0x30da76;}if(_0x45e3e1===_0x41bc('0x11')&&_0x30da76===_0x41bc('0x9')||_0x45e3e1===_0x41bc('0x11')&&_0x30da76===_0x41bc('0x12')){return _0x30da76;}if(_0x45e3e1===_0x41bc('0x13')||_0x45e3e1===_0x41bc('0x14')||_0x45e3e1===_0x41bc('0x15')){return _0x30da76;}return null;}},'servicelevel':{'type':Sequelize[_0x41bc('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x41bc('0x16')](0xb)},'timeout':{'type':Sequelize[_0x41bc('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x41bc('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x41bc('0x17'),'no'),'defaultValue':_0x41bc('0x17')},'autopause':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x41bc('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x41bc('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x41bc('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x41bc('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x41bc('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x41bc('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x41bc('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x41bc('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x41bc('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x41bc('0x3')]('yes','no'),'defaultValue':_0x41bc('0x17')},'announce_holdtime':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x17'),'no',_0x41bc('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x41bc('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x41bc('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x41bc('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x41bc('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x41bc('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x41bc('0x1')]},'queue_less_than':{'type':Sequelize[_0x41bc('0x1')]},'periodic_announce':{'type':Sequelize[_0x41bc('0x19')],'set':function(_0x301614){this['setDataValue'](_0x41bc('0x1a'),_0x301614?_0x301614[_0x41bc('0x1b')](','):[]);},'get':function(){return this[_0x41bc('0xe')](_0x41bc('0x1a'))?this[_0x41bc('0xe')](_0x41bc('0x1a'))[_0x41bc('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':_0x41bc('0x17'),'set':function(_0x5ae5f3){this['setDataValue'](_0x41bc('0x1d'),_0x5ae5f3?_0x5ae5f3[_0x41bc('0x1b')](','):undefined);},'get':function(){return this[_0x41bc('0xe')](_0x41bc('0x1d'))?this['getDataValue']('joinempty')[_0x41bc('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':'no','set':function(_0x5b224b){this[_0x41bc('0xc')](_0x41bc('0x1e'),_0x5b224b?_0x5b224b[_0x41bc('0x1b')](','):undefined);},'get':function(){return this[_0x41bc('0xe')]('leavewhenempty')?this[_0x41bc('0xe')]('leavewhenempty')[_0x41bc('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x41bc('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x41bc('0x1')]},'description':{'type':Sequelize[_0x41bc('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3eeeb1){this['setDataValue'](_0x41bc('0x1f'),_0x3eeeb1);if(_0x3eeeb1){if(this[_0x41bc('0xe')]('wrapuptime')<0x2){this['setDataValue'](_0x41bc('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x41bc('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x41bc('0x21')},'dialMethod':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x22'),_0x41bc('0x13'),_0x41bc('0x15'),_0x41bc('0x14'),_0x41bc('0x11')),'defaultValue':_0x41bc('0x13'),'comment':_0x41bc('0x23')},'dialLimitChannel':{'type':Sequelize[_0x41bc('0x16')](0x4)[_0x41bc('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x41bc('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x41bc('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x41bc('0x26')},'dialPowerLevel':{'type':Sequelize[_0x41bc('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x41bc('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x41bc('0x3')](_0x41bc('0x29'),_0x41bc('0x2a')),'defaultValue':_0x41bc('0x2a'),'comment':_0x41bc('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x41bc('0x27')](0x2)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x41bc('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x41bc('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x41bc('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x41bc('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bc('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':_0x41bc('0x2e'),'comment':_0x41bc('0x2f')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x41bc('0x1')],'comment':_0x41bc('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bc('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x41bc('0x16')](0x5)[_0x41bc('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bc('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x41bc('0x16')](0x5)[_0x41bc('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bc('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x41bc('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bc('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x41bc('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x41bc('0x35'),_0x41bc('0x36')),'defaultValue':_0x41bc('0x37')},'dialAMDActive':{'type':Sequelize[_0x41bc('0x38')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x41bc('0x16')](0x9)[_0x41bc('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x41bc('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x41bc('0x16')](0x9)[_0x41bc('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x41bc('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x41bc('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x41bc('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x41bc('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x41bc('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x41bc('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x41bc('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x41bc('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x41bc('0x16')](0x5)[_0x41bc('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x41bc('0x16')](0x9)[_0x41bc('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x41bc('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x41bc('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0x41bc('0x38')],'defaultValue':0x0,'comment':_0x41bc('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x41bc('0x40'),_0x41bc('0x41')),'defaultValue':_0x41bc('0x40')},'dialQueueProject2':{'type':Sequelize[_0x41bc('0x1')],'comment':_0x41bc('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x41bc('0x38')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x41bc('0x42')},'dialCutDigit':{'type':Sequelize[_0x41bc('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x41bc('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x41bc('0x16')](0x5)[_0x41bc('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bc('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bc('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x41bc('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bc('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x41bc('0x16')](0x5)[_0x41bc('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bc('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bc('0x48')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bc('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bc('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x41bc('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bc('0x4b')},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x41bc('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x3,'comment':_0x41bc('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x41bc('0x4d'),'set':function(_0x43b529){if(!_0x43b529)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x41bc('0xc')](_0x41bc('0x4e'),_0x43b529);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x41bc('0x16')](0x3)[_0x41bc('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x50e1=['progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Minutes\x20to\x20wait\x20to\x20call\x20next\x20additional\x20phone\x20number\x20','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','booked','roundrobin'];(function(_0x3f6d79,_0xeda85c){var _0x563ca8=function(_0x164936){while(--_0x164936){_0x3f6d79['push'](_0x3f6d79['shift']());}};_0x563ca8(++_0xeda85c);}(_0x50e1,0xe0));var _0x150e=function(_0x59cec8,_0x137ff2){_0x59cec8=_0x59cec8-0x0;var _0x3ef665=_0x50e1[_0x59cec8];return _0x3ef665;};'use strict';var Sequelize=require(_0x150e('0x0'));module[_0x150e('0x1')]={'name':{'type':Sequelize[_0x150e('0x2')],'allowNull':![],'unique':_0x150e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x5'),_0x150e('0x6')),'allowNull':![],'defaultValue':_0x150e('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x150e('0x7')},'announce':{'type':Sequelize[_0x150e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x150e('0x8'),_0x150e('0x9'),_0x150e('0xa'),_0x150e('0xb'),_0x150e('0xc'),_0x150e('0xd'),_0x150e('0xe'),_0x150e('0xf')),'allowNull':![],'defaultValue':_0x150e('0x8'),'set':function(_0x12a862){this[_0x150e('0x10')](_0x150e('0x11'),_0x12a862?_0x12a862:_0x150e('0xc'));},'get':function(){var _0x3285fb=this[_0x150e('0x12')](_0x150e('0x13'));var _0x5efc8f=this['getDataValue']('dialMethod');var _0x52e042=this['getDataValue'](_0x150e('0x11'));if(_0x3285fb===_0x150e('0x5')){return _0x52e042;}if(_0x5efc8f===_0x150e('0x14')&&_0x52e042===_0x150e('0xc')||_0x5efc8f===_0x150e('0x14')&&_0x52e042===_0x150e('0x15')){return _0x52e042;}if(_0x5efc8f===_0x150e('0x16')||_0x5efc8f===_0x150e('0x17')||_0x5efc8f===_0x150e('0x18')){return _0x52e042;}return null;}},'servicelevel':{'type':Sequelize[_0x150e('0x19')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x150e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x150e('0x19')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x150e('0x19')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x150e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x150e('0x4')]('yes','no'),'defaultValue':_0x150e('0x1a')},'autopause':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no',_0x150e('0x1b')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x150e('0x1a'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x150e('0x19')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x150e('0x1a'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x150e('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x150e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x150e('0x19')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x150e('0x19')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x150e('0x1a'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no',_0x150e('0x1c')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no')},'announce_position_limit':{'type':Sequelize[_0x150e('0x19')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x150e('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x150e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x150e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x150e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x150e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x150e('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x150e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x150e('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x150e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x150e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x150e('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x150e('0x2')]},'queue_less_than':{'type':Sequelize[_0x150e('0x2')]},'periodic_announce':{'type':Sequelize[_0x150e('0x1d')],'set':function(_0x2682ca){this[_0x150e('0x10')](_0x150e('0x1e'),_0x2682ca?_0x2682ca[_0x150e('0x1f')](','):[]);},'get':function(){return this[_0x150e('0x12')]('periodic_announce')?this[_0x150e('0x12')](_0x150e('0x1e'))[_0x150e('0x20')](','):[];}},'joinempty':{'type':Sequelize[_0x150e('0x2')],'defaultValue':_0x150e('0x1a'),'set':function(_0x4a8141){this['setDataValue'](_0x150e('0x21'),_0x4a8141?_0x4a8141[_0x150e('0x1f')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x150e('0x12')](_0x150e('0x21'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x150e('0x2')],'defaultValue':'no','set':function(_0x231b1e){this[_0x150e('0x10')]('leavewhenempty',_0x231b1e?_0x231b1e[_0x150e('0x1f')](','):undefined);},'get':function(){return this[_0x150e('0x12')](_0x150e('0x22'))?this['getDataValue'](_0x150e('0x22'))[_0x150e('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x1a'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x150e('0x2')]},'description':{'type':Sequelize[_0x150e('0x2')]},'acw':{'type':Sequelize[_0x150e('0x23')],'defaultValue':0x0,'set':function(_0x5807fd){this[_0x150e('0x10')](_0x150e('0x24'),_0x5807fd);if(_0x5807fd){if(this[_0x150e('0x12')](_0x150e('0x25'))<0x2){this[_0x150e('0x10')](_0x150e('0x25'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x150e('0x19')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x150e('0x23')],'defaultValue':0x0,'comment':_0x150e('0x26')},'dialMethod':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x27'),_0x150e('0x16'),_0x150e('0x18'),_0x150e('0x17'),_0x150e('0x14')),'defaultValue':_0x150e('0x16'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x150e('0x19')](0x4)[_0x150e('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x150e('0x29')},'dialLimitQueue':{'type':Sequelize[_0x150e('0x19')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x150e('0x2a')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x150e('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x2b'),_0x150e('0x2c')),'defaultValue':_0x150e('0x2c'),'comment':_0x150e('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x150e('0x2e')](0x2)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x150e('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x150e('0x19')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x150e('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0x150e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x150e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x150e('0x19')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x150e('0x31')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x150e('0x32'),'comment':_0x150e('0x33')},'dialQueueTimeout':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x150e('0x2')],'comment':_0x150e('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x150e('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x150e('0x36')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x150e('0x37')},'dialBusyRetryFrequency':{'type':Sequelize[_0x150e('0x19')](0x5)[_0x150e('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x150e('0x38')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'defaultValue':0x3,'comment':_0x150e('0x39')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x150e('0x3a')},'dialGlobalMaxRetry':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x150e('0x3b')},'dialTimezone':{'type':Sequelize[_0x150e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x3c'),_0x150e('0x3d'),'onlyIfOpen'),'defaultValue':_0x150e('0x3c')},'dialAMDActive':{'type':Sequelize[_0x150e('0x23')],'defaultValue':0x0,'comment':_0x150e('0x3e')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x150e('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x150e('0x3f')},'dialAMDGreeting':{'type':Sequelize[_0x150e('0x19')](0x9)[_0x150e('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x150e('0x40')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x150e('0x19')](0x9)[_0x150e('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x150e('0x41')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x150e('0x19')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x150e('0x42')},'dialAMDMinWordLength':{'type':Sequelize[_0x150e('0x19')](0x9)[_0x150e('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x150e('0x43')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x150e('0x19')](0x9)[_0x150e('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x150e('0x19')](0x9)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x150e('0x44')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x150e('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x150e('0x19')](0x9)[_0x150e('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x150e('0x19')](0x5)[_0x150e('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x150e('0x45')},'dialRecallInQueue':{'type':Sequelize[_0x150e('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x150e('0x4')](_0x150e('0x46'),_0x150e('0x47')),'defaultValue':_0x150e('0x46')},'dialQueueProject2':{'type':Sequelize[_0x150e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x150e('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x150e('0x48')},'dialCutDigit':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x150e('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x150e('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x150e('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0x150e('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x150e('0x19')](0x5)[_0x150e('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x150e('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x150e('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x150e('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x150e('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x150e('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x150e('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x150e('0x19')](0x5)[_0x150e('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x3,'comment':_0x150e('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x150e('0x19')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x150e('0x23')],'defaultValue':![],'comment':_0x150e('0x4f'),'set':function(_0x39f58b){if(!_0x39f58b)this['setDataValue'](_0x150e('0x50'),null);this['setDataValue'](_0x150e('0x51'),_0x39f58b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x150e('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x150e('0x19')](0x3)[_0x150e('0x28')],'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 33b4384..347b8e8 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 _0x5f2b=['fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','options','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','include','omit','createdAt','updatedAt','QueueCampaigns','getHoppers','findOne','hasOwnProperty','pick','VoiceQueueId','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','removeAgents','addAgents','spread','isEmpty','isNil','isArray','userVoiceQueue:remove','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','NOW()','scheduledAt','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','removeLists','getBlackLists','addBlackLists','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f2b,0x17a));var _0xb5f2=function(_0x3e89ee,_0x315931){_0x3e89ee=_0x3e89ee-0x0;var _0xb16d81=_0x5f2b[_0x3e89ee];return _0xb16d81;};'use strict';var pdf=require(_0xb5f2('0x0'));var emlformat=require(_0xb5f2('0x1'));var rimraf=require(_0xb5f2('0x2'));var zipdir=require(_0xb5f2('0x3'));var jsonpatch=require(_0xb5f2('0x4'));var rp=require('request-promise');var moment=require(_0xb5f2('0x5'));var BPromise=require(_0xb5f2('0x6'));var Mustache=require(_0xb5f2('0x7'));var util=require(_0xb5f2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb5f2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5f2('0xa'));var _=require(_0xb5f2('0xb'));var squel=require(_0xb5f2('0xc'));var crypto=require(_0xb5f2('0xd'));var jsforce=require(_0xb5f2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5f2('0x9'));var querystring=require(_0xb5f2('0xf'));var Papa=require(_0xb5f2('0x10'));var Redis=require('ioredis');var authService=require(_0xb5f2('0x11'));var qs=require(_0xb5f2('0x12'));var as=require(_0xb5f2('0x13'));var hardwareService=require(_0xb5f2('0x14'));var logger=require(_0xb5f2('0x15'))(_0xb5f2('0x16'));var utils=require(_0xb5f2('0x17'));var config=require(_0xb5f2('0x18'));var licenseUtil=require(_0xb5f2('0x19'));var db=require(_0xb5f2('0x1a'))['db'];config['redis']=_[_0xb5f2('0x1b')](config[_0xb5f2('0x1c')],{'host':_0xb5f2('0x1d'),'port':0x18eb});var socket=require(_0xb5f2('0x1e'))(new Redis(config[_0xb5f2('0x1c')]));require(_0xb5f2('0x1f'))[_0xb5f2('0x20')](socket);function respondWithStatusCode(_0x3161e6,_0x1f1f58){_0x1f1f58=_0x1f1f58||0xcc;return function(_0x2b24f0){if(_0x2b24f0){return _0x3161e6[_0xb5f2('0x21')](_0x1f1f58);}return _0x3161e6[_0xb5f2('0x22')](_0x1f1f58)[_0xb5f2('0x23')]();};}function respondWithResult(_0x1537e9,_0x2fa252){_0x2fa252=_0x2fa252||0xc8;return function(_0x1c3bdc){if(_0x1c3bdc){return _0x1537e9[_0xb5f2('0x22')](_0x2fa252)[_0xb5f2('0x24')](_0x1c3bdc);}};}function respondWithFilteredResult(_0x2d1dff,_0x214a43){return function(_0xae836d){if(_0xae836d){var _0x22cf47=_0xae836d[_0xb5f2('0x25')],_0x5baa23=_0x214a43[_0xb5f2('0x26')],_0x3f6571=_0x214a43['offset']+_0x214a43[_0xb5f2('0x27')],_0x5487b5;if(_0x3f6571>=_0x22cf47){_0x3f6571=_0x22cf47;_0x5487b5=0xc8;}else{_0x5487b5=0xce;}_0x2d1dff['status'](_0x5487b5);return _0x2d1dff[_0xb5f2('0x28')](_0xb5f2('0x29'),_0x5baa23+'-'+_0x3f6571+'/'+_0x22cf47)[_0xb5f2('0x24')](_0xae836d);}return null;};}function patchUpdates(_0x56857e){return function(_0x7176){try{jsonpatch[_0xb5f2('0x2a')](_0x7176,_0x56857e,!![]);}catch(_0x3d915c){return BPromise[_0xb5f2('0x2b')](_0x3d915c);}return _0x7176['save']();};}function saveUpdates(_0xced05f,_0x4a4ecc){return function(_0x27c374){if(_0x27c374){return _0x27c374[_0xb5f2('0x2c')](_0xced05f)[_0xb5f2('0x2d')](function(_0x15dc58){return _0x15dc58;});}return null;};}function removeEntity(_0x565dd7,_0x22ecc9){return function(_0x49e206){if(_0x49e206){return _0x49e206[_0xb5f2('0x2e')]()[_0xb5f2('0x2d')](function(){var _0x40e77a=_0x49e206[_0xb5f2('0x2f')]({'plain':!![]});var _0x31af39=[{'name':_0xb5f2('0x30'),'value':_0xb5f2('0x31'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb5f2('0x32'),'ignore':![]}];var _0x37e35f=_(_0x31af39)[_0xb5f2('0x33')](_0xb5f2('0x34'))[_0xb5f2('0x35')](_0xb5f2('0x36'))[_0xb5f2('0x36')]();if(_[_0xb5f2('0x37')](_0x37e35f,_0x40e77a[_0xb5f2('0x38')])){return;}var _0x58bf1d=_[_0xb5f2('0x39')](_0x31af39,[_0xb5f2('0x36'),_0x40e77a[_0xb5f2('0x38')]])[_0xb5f2('0x3a')];return db[_0xb5f2('0x3b')][_0xb5f2('0x2e')]({'where':{'type':_0x58bf1d,'resourceId':_0x40e77a['id']}})[_0xb5f2('0x2d')](function(){return _0x49e206;});})[_0xb5f2('0x2d')](function(){_0x565dd7[_0xb5f2('0x22')](0xcc)[_0xb5f2('0x23')]();});}};}function handleEntityNotFound(_0x201612,_0xd3b14a){return function(_0x1f9821){if(!_0x1f9821){_0x201612['sendStatus'](0x194);}return _0x1f9821;};}function handleError(_0xc824a3,_0x501740){_0x501740=_0x501740||0x1f4;return function(_0x4edaa6){logger['error'](_0x4edaa6[_0xb5f2('0x3c')]);if(_0x4edaa6[_0xb5f2('0x3a')]){delete _0x4edaa6['name'];}_0xc824a3['status'](_0x501740)[_0xb5f2('0x3d')](_0x4edaa6);};}exports['index']=function(_0x446921,_0x2f6898){var _0x151702={},_0x4be28f={},_0x407f25={'count':0x0,'rows':[]};var _0x122c6d=_[_0xb5f2('0x35')](db[_0xb5f2('0x3e')][_0xb5f2('0x3f')],function(_0x65ba20){return{'name':_0x65ba20[_0xb5f2('0x40')],'type':_0x65ba20['type'][_0xb5f2('0x41')]};});_0x4be28f[_0xb5f2('0x42')]=_[_0xb5f2('0x35')](_0x122c6d,_0xb5f2('0x3a'));_0x4be28f[_0xb5f2('0x43')]=_[_0xb5f2('0x44')](_0x446921[_0xb5f2('0x43')]);_0x4be28f[_0xb5f2('0x45')]=_['intersection'](_0x4be28f[_0xb5f2('0x42')],_0x4be28f[_0xb5f2('0x43')]);_0x151702['attributes']=_[_0xb5f2('0x46')](_0x4be28f[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x446921[_0xb5f2('0x43')][_0xb5f2('0x47')]));_0x151702['attributes']=_0x151702[_0xb5f2('0x48')][_0xb5f2('0x49')]?_0x151702['attributes']:_0x4be28f[_0xb5f2('0x42')];if(!_0x446921[_0xb5f2('0x43')]['hasOwnProperty'](_0xb5f2('0x4a'))){_0x151702[_0xb5f2('0x27')]=qs[_0xb5f2('0x27')](_0x446921['query']['limit']);_0x151702['offset']=qs['offset'](_0x446921['query'][_0xb5f2('0x26')]);}_0x151702[_0xb5f2('0x4b')]=qs[_0xb5f2('0x4c')](_0x446921[_0xb5f2('0x43')]['sort']);_0x151702[_0xb5f2('0x4d')]=qs['filters'](_['pick'](_0x446921[_0xb5f2('0x43')],_0x4be28f[_0xb5f2('0x45')]),_0x122c6d);if(_0x446921[_0xb5f2('0x43')][_0xb5f2('0x33')]){_0x151702[_0xb5f2('0x4d')]=_['merge'](_0x151702[_0xb5f2('0x4d')],{'$or':_['map'](_0x122c6d,function(_0x4c3203){if(_0x4c3203[_0xb5f2('0x38')]!=='VIRTUAL'){var _0x2acc6e={};_0x2acc6e[_0x4c3203[_0xb5f2('0x3a')]]={'$like':'%'+_0x446921[_0xb5f2('0x43')][_0xb5f2('0x33')]+'%'};return _0x2acc6e;}})});}_0x151702=_[_0xb5f2('0x4e')]({},_0x151702,_0x446921[_0xb5f2('0x4f')]);var _0x168650={'where':_0x151702[_0xb5f2('0x4d')]};return db[_0xb5f2('0x3e')][_0xb5f2('0x25')](_0x168650)[_0xb5f2('0x2d')](function(_0x253716){_0x407f25[_0xb5f2('0x25')]=_0x253716;if(_0x446921['query']['includeAll']){_0x151702['include']=[{'all':!![]}];}return db[_0xb5f2('0x3e')]['findAll'](_0x151702);})['then'](function(_0x1369a2){_0x407f25['rows']=_0x1369a2;return _0x407f25;})[_0xb5f2('0x2d')](respondWithFilteredResult(_0x2f6898,_0x151702))[_0xb5f2('0x50')](handleError(_0x2f6898,null));};exports[_0xb5f2('0x51')]=function(_0x2310b6,_0x11e444){var _0x108d75={'raw':![],'where':{'id':_0x2310b6[_0xb5f2('0x52')]['id']}},_0x24f132={};_0x24f132[_0xb5f2('0x42')]=_[_0xb5f2('0x44')](db[_0xb5f2('0x3e')][_0xb5f2('0x3f')]);_0x24f132[_0xb5f2('0x43')]=_['keys'](_0x2310b6['query']);_0x24f132[_0xb5f2('0x45')]=_['intersection'](_0x24f132['model'],_0x24f132[_0xb5f2('0x43')]);_0x108d75[_0xb5f2('0x48')]=_['intersection'](_0x24f132[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x2310b6[_0xb5f2('0x43')]['fields']));_0x108d75[_0xb5f2('0x48')]=_0x108d75[_0xb5f2('0x48')][_0xb5f2('0x49')]?_0x108d75[_0xb5f2('0x48')]:_0x24f132['model'];if(_0x2310b6[_0xb5f2('0x43')][_0xb5f2('0x53')]){_0x108d75['include']=[{'all':!![]}];}_0x108d75=_[_0xb5f2('0x4e')]({},_0x108d75,_0x2310b6[_0xb5f2('0x4f')]);return db[_0xb5f2('0x3e')][_0xb5f2('0x39')](_0x108d75)[_0xb5f2('0x2d')](handleEntityNotFound(_0x11e444,null))[_0xb5f2('0x2d')](respondWithResult(_0x11e444,null))[_0xb5f2('0x50')](handleError(_0x11e444,null));};exports[_0xb5f2('0x54')]=function(_0x3a621d,_0x105507){return db[_0xb5f2('0x3e')]['create'](_0x3a621d[_0xb5f2('0x55')],{})[_0xb5f2('0x2d')](function(_0x408a45){var _0xe4c1a3=_0x3a621d[_0xb5f2('0x56')][_0xb5f2('0x2f')]({'plain':!![]});if(!_0xe4c1a3)throw new Error(_0xb5f2('0x57'));if(_0xe4c1a3[_0xb5f2('0x58')]===_0xb5f2('0x56')){var _0x1e2bb2=_0x408a45[_0xb5f2('0x2f')]({'plain':!![]});var _0x3c79e4=[{'name':_0xb5f2('0x30'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xb5f2('0x32')}];var _0x516498=_[_0xb5f2('0x39')](_0x3c79e4,[_0xb5f2('0x36'),_0x1e2bb2[_0xb5f2('0x38')]])[_0xb5f2('0x3a')];return db[_0xb5f2('0x59')]['find']({'where':{'name':_0x516498,'userProfileId':_0xe4c1a3[_0xb5f2('0x5a')]},'raw':!![]})[_0xb5f2('0x2d')](function(_0x2974bd){if(_0x2974bd&&_0x2974bd[_0xb5f2('0x5b')]===0x0){return db[_0xb5f2('0x3b')][_0xb5f2('0x54')]({'name':_0x1e2bb2['name'],'resourceId':_0x1e2bb2['id'],'type':_0x2974bd['name'],'sectionId':_0x2974bd['id']},{})[_0xb5f2('0x2d')](function(){return _0x408a45;});}else{return _0x408a45;}})['catch'](function(_0x319f14){logger[_0xb5f2('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x319f14);throw _0x319f14;});}return _0x408a45;})[_0xb5f2('0x2d')](respondWithResult(_0x105507,0xc9))[_0xb5f2('0x50')](handleError(_0x105507,null));};exports[_0xb5f2('0x5d')]=function(_0x1fc4cd,_0xd2e938){var _0x11b21e={'where':{'id':_0x1fc4cd['params']['id']}},_0x4b97dc={};_0x4b97dc[_0xb5f2('0x42')]=_[_0xb5f2('0x44')](db['VoiceQueue'][_0xb5f2('0x3f')]);_0x11b21e[_0xb5f2('0x48')]=_[_0xb5f2('0x46')](_0x4b97dc[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x1fc4cd[_0xb5f2('0x43')][_0xb5f2('0x47')]));_0x11b21e[_0xb5f2('0x48')]=_0x11b21e[_0xb5f2('0x48')][_0xb5f2('0x49')]?_0x11b21e['attributes']:_0x4b97dc[_0xb5f2('0x42')];if(_0x1fc4cd[_0xb5f2('0x43')][_0xb5f2('0x53')]){_0x11b21e[_0xb5f2('0x5e')]=[{'all':!![]}];}_0x11b21e=_[_0xb5f2('0x4e')]({},_0x11b21e,_0x1fc4cd['options']);return db['VoiceQueue'][_0xb5f2('0x39')](_0x11b21e)['then'](handleEntityNotFound(_0xd2e938,null))['then'](function(_0x3ac90f){if(_0x3ac90f){var _0x4bd05d=_0x3ac90f[_0xb5f2('0x2f')]({'plain':!![]});_0x4bd05d=qs[_0xb5f2('0x5f')](_0x4bd05d,['id',_0xb5f2('0x60'),_0xb5f2('0x61')]);_0x1fc4cd['body']=_['omit'](_0x1fc4cd[_0xb5f2('0x55')],['id','createdAt',_0xb5f2('0x61')]);return db['VoiceQueue'][_0xb5f2('0x54')](_[_0xb5f2('0x4e')](_0x4bd05d,_0x1fc4cd[_0xb5f2('0x55')]),{'include':_0x1fc4cd[_0xb5f2('0x43')][_0xb5f2('0x53')]?[{'all':!![]}]:undefined})['then'](function(_0x4c7362){var _0x3579e3=_0x1fc4cd[_0xb5f2('0x56')][_0xb5f2('0x2f')]({'plain':!![]});if(!_0x3579e3)throw new Error(_0xb5f2('0x57'));if(_0x3579e3['role']===_0xb5f2('0x56')){var _0x275dd4=_0x4c7362['get']({'plain':!![]});var _0x4f5303=[{'name':_0xb5f2('0x30'),'value':'inbound'},{'name':_0xb5f2('0x62'),'value':_0xb5f2('0x32')}];var _0x38b37d=_[_0xb5f2('0x39')](_0x4f5303,[_0xb5f2('0x36'),_0x275dd4[_0xb5f2('0x38')]])[_0xb5f2('0x3a')];return db[_0xb5f2('0x59')]['find']({'where':{'name':_0x38b37d,'userProfileId':_0x3579e3[_0xb5f2('0x5a')]},'raw':!![]})[_0xb5f2('0x2d')](function(_0x1a3cef){if(_0x1a3cef&&_0x1a3cef[_0xb5f2('0x5b')]===0x0){return db[_0xb5f2('0x3b')][_0xb5f2('0x54')]({'name':_0x275dd4['name'],'resourceId':_0x275dd4['id'],'type':_0x1a3cef['name'],'sectionId':_0x1a3cef['id']},{})[_0xb5f2('0x2d')](function(){return _0x4c7362;});}else{return _0x4c7362;}})[_0xb5f2('0x50')](function(_0x54d2f0){logger[_0xb5f2('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54d2f0);throw _0x54d2f0;});}return _0x4c7362;});}})[_0xb5f2('0x2d')](respondWithResult(_0xd2e938,0xc9))['catch'](handleError(_0xd2e938,null));};exports[_0xb5f2('0x2c')]=function(_0x2d91cc,_0x15ed8f){if(_0x2d91cc[_0xb5f2('0x55')]['id']){delete _0x2d91cc[_0xb5f2('0x55')]['id'];}return db[_0xb5f2('0x3e')][_0xb5f2('0x39')]({'where':{'id':_0x2d91cc[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x15ed8f,null))['then'](saveUpdates(_0x2d91cc[_0xb5f2('0x55')],null))[_0xb5f2('0x2d')](respondWithResult(_0x15ed8f,null))[_0xb5f2('0x50')](handleError(_0x15ed8f,null));};exports[_0xb5f2('0x2e')]=function(_0x35322f,_0x2d2cb8){return db[_0xb5f2('0x3e')][_0xb5f2('0x39')]({'where':{'id':_0x35322f[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x2d2cb8,null))[_0xb5f2('0x2d')](removeEntity(_0x2d2cb8,null))[_0xb5f2('0x50')](handleError(_0x2d2cb8,null));};exports[_0xb5f2('0x63')]=function(_0x127b10,_0x539026,_0x4b0373){var _0x7b7793={'raw':![],'where':{}};var _0x46ada1={};var _0x30f0b4={'count':0x0,'rows':[]};return db[_0xb5f2('0x3e')][_0xb5f2('0x64')]({'where':{'id':_0x127b10[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x539026,null))[_0xb5f2('0x2d')](function(_0x3343a6){if(_0x3343a6){_0x46ada1['model']=_['keys'](db['CmHopper'][_0xb5f2('0x3f')]);_0x46ada1[_0xb5f2('0x43')]=_[_0xb5f2('0x44')](_0x127b10['query']);_0x46ada1['filters']=_[_0xb5f2('0x46')](_0x46ada1[_0xb5f2('0x42')],_0x46ada1[_0xb5f2('0x43')]);_0x7b7793[_0xb5f2('0x48')]=_['intersection'](_0x46ada1[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x127b10[_0xb5f2('0x43')]['fields']));_0x7b7793[_0xb5f2('0x48')]=_0x7b7793[_0xb5f2('0x48')][_0xb5f2('0x49')]?_0x7b7793['attributes']:_0x46ada1['model'];if(!_0x127b10['query'][_0xb5f2('0x65')](_0xb5f2('0x4a'))){_0x7b7793['limit']=qs[_0xb5f2('0x27')](_0x127b10[_0xb5f2('0x43')]['limit']);_0x7b7793[_0xb5f2('0x26')]=qs[_0xb5f2('0x26')](_0x127b10[_0xb5f2('0x43')][_0xb5f2('0x26')]);}_0x7b7793[_0xb5f2('0x4b')]=qs[_0xb5f2('0x4c')](_0x127b10[_0xb5f2('0x43')][_0xb5f2('0x4c')]);_0x7b7793['where']=qs[_0xb5f2('0x45')](_[_0xb5f2('0x66')](_0x127b10[_0xb5f2('0x43')],_0x46ada1['filters']));_0x7b7793[_0xb5f2('0x4d')][_0xb5f2('0x67')]=_0x3343a6['id'];if(_0x127b10[_0xb5f2('0x43')][_0xb5f2('0x33')]){_0x7b7793['where']=_[_0xb5f2('0x4e')](_0x7b7793[_0xb5f2('0x4d')],{'$or':_['map'](_0x7b7793[_0xb5f2('0x48')],function(_0x250c9c){var _0x44a1af={};_0x44a1af[_0x250c9c]={'$like':'%'+_0x127b10[_0xb5f2('0x43')][_0xb5f2('0x33')]+'%'};return _0x44a1af;})});}_0x7b7793=_[_0xb5f2('0x4e')]({},_0x7b7793,_0x127b10['options']);return db[_0xb5f2('0x68')][_0xb5f2('0x25')]({'where':_0x7b7793[_0xb5f2('0x4d')]})[_0xb5f2('0x2d')](function(_0x301f4c){_0x30f0b4[_0xb5f2('0x25')]=_0x301f4c;if(_0x127b10[_0xb5f2('0x43')][_0xb5f2('0x53')]){_0x7b7793['include']=[{'all':!![]}];}return db['CmHopper'][_0xb5f2('0x69')](_0x7b7793);})[_0xb5f2('0x2d')](function(_0x49307d){_0x30f0b4[_0xb5f2('0x6a')]=_0x49307d;return _0x30f0b4;});}})[_0xb5f2('0x2d')](respondWithFilteredResult(_0x539026,_0x7b7793))['catch'](handleError(_0x539026,null));};exports[_0xb5f2('0x6b')]=function(_0x3a6f83,_0x52ace4,_0x5d79dd){var _0xa1b77f={'raw':!![],'where':{}};var _0x40a6aa={};var _0x121a49={'count':0x0,'rows':[]};return db[_0xb5f2('0x3e')][_0xb5f2('0x64')]({'where':{'id':_0x3a6f83[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x52ace4,null))[_0xb5f2('0x2d')](function(_0x365c00){if(_0x365c00){_0x40a6aa[_0xb5f2('0x42')]=_[_0xb5f2('0x44')](db[_0xb5f2('0x6c')][_0xb5f2('0x3f')]);_0x40a6aa['query']=_['keys'](_0x3a6f83['query']);_0x40a6aa[_0xb5f2('0x45')]=_[_0xb5f2('0x46')](_0x40a6aa['model'],_0x40a6aa[_0xb5f2('0x43')]);_0xa1b77f[_0xb5f2('0x48')]=_['intersection'](_0x40a6aa['model'],qs['fields'](_0x3a6f83[_0xb5f2('0x43')][_0xb5f2('0x47')]));_0xa1b77f[_0xb5f2('0x48')]=_0xa1b77f[_0xb5f2('0x48')]['length']?_0xa1b77f[_0xb5f2('0x48')]:_0x40a6aa[_0xb5f2('0x42')];if(!_0x3a6f83[_0xb5f2('0x43')][_0xb5f2('0x65')](_0xb5f2('0x4a'))){_0xa1b77f[_0xb5f2('0x27')]=qs['limit'](_0x3a6f83[_0xb5f2('0x43')][_0xb5f2('0x27')]);_0xa1b77f['offset']=qs['offset'](_0x3a6f83['query']['offset']);}_0xa1b77f['order']=qs['sort'](_0x3a6f83[_0xb5f2('0x43')]['sort']);_0xa1b77f[_0xb5f2('0x4d')]=qs[_0xb5f2('0x45')](_[_0xb5f2('0x66')](_0x3a6f83[_0xb5f2('0x43')],_0x40a6aa['filters']));_0xa1b77f[_0xb5f2('0x4d')][_0xb5f2('0x67')]=_0x365c00['id'];if(_0x3a6f83[_0xb5f2('0x43')][_0xb5f2('0x33')]){_0xa1b77f['where']=_['merge'](_0xa1b77f['where'],{'$or':_['map'](_0xa1b77f[_0xb5f2('0x48')],function(_0x55f826){var _0x54741f={};_0x54741f[_0x55f826]={'$like':'%'+_0x3a6f83['query'][_0xb5f2('0x33')]+'%'};return _0x54741f;})});}_0xa1b77f=_['merge']({},_0xa1b77f,_0x3a6f83[_0xb5f2('0x4f')]);return db[_0xb5f2('0x6c')][_0xb5f2('0x25')]({'where':_0xa1b77f[_0xb5f2('0x4d')]})[_0xb5f2('0x2d')](function(_0x3c4821){_0x121a49[_0xb5f2('0x25')]=_0x3c4821;if(_0x3a6f83['query'][_0xb5f2('0x53')]){_0xa1b77f[_0xb5f2('0x5e')]=[{'all':!![]}];}return db[_0xb5f2('0x6c')][_0xb5f2('0x69')](_0xa1b77f);})['then'](function(_0x128c90){_0x121a49[_0xb5f2('0x6a')]=_0x128c90;return _0x121a49;});}})['then'](respondWithFilteredResult(_0x52ace4,_0xa1b77f))[_0xb5f2('0x50')](handleError(_0x52ace4,null));};exports[_0xb5f2('0x6d')]=function(_0x278fa8,_0x16717d,_0x17e786){var _0x8d0473={'raw':!![],'where':{}};var _0x7e9f5c={};var _0x4e1d7a={'count':0x0,'rows':[]};return db[_0xb5f2('0x3e')][_0xb5f2('0x64')]({'where':{'id':_0x278fa8['params']['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x16717d,null))[_0xb5f2('0x2d')](function(_0x5981f9){if(_0x5981f9){_0x7e9f5c['model']=_['keys'](db[_0xb5f2('0x6e')][_0xb5f2('0x3f')]);_0x7e9f5c[_0xb5f2('0x43')]=_[_0xb5f2('0x44')](_0x278fa8[_0xb5f2('0x43')]);_0x7e9f5c[_0xb5f2('0x45')]=_[_0xb5f2('0x46')](_0x7e9f5c[_0xb5f2('0x42')],_0x7e9f5c['query']);_0x8d0473[_0xb5f2('0x48')]=_[_0xb5f2('0x46')](_0x7e9f5c[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x278fa8[_0xb5f2('0x43')][_0xb5f2('0x47')]));_0x8d0473[_0xb5f2('0x48')]=_0x8d0473[_0xb5f2('0x48')][_0xb5f2('0x49')]?_0x8d0473['attributes']:_0x7e9f5c['model'];if(!_0x278fa8[_0xb5f2('0x43')][_0xb5f2('0x65')](_0xb5f2('0x4a'))){_0x8d0473['limit']=qs[_0xb5f2('0x27')](_0x278fa8[_0xb5f2('0x43')][_0xb5f2('0x27')]);_0x8d0473[_0xb5f2('0x26')]=qs['offset'](_0x278fa8[_0xb5f2('0x43')][_0xb5f2('0x26')]);}_0x8d0473['order']=qs[_0xb5f2('0x4c')](_0x278fa8[_0xb5f2('0x43')][_0xb5f2('0x4c')]);_0x8d0473[_0xb5f2('0x4d')]=qs[_0xb5f2('0x45')](_['pick'](_0x278fa8[_0xb5f2('0x43')],_0x7e9f5c[_0xb5f2('0x45')]));_0x8d0473[_0xb5f2('0x4d')][_0xb5f2('0x67')]=_0x5981f9['id'];if(_0x278fa8[_0xb5f2('0x43')][_0xb5f2('0x33')]){_0x8d0473[_0xb5f2('0x4d')]=_[_0xb5f2('0x4e')](_0x8d0473[_0xb5f2('0x4d')],{'$or':_[_0xb5f2('0x35')](_0x8d0473[_0xb5f2('0x48')],function(_0x5997e9){var _0x4f4ad2={};_0x4f4ad2[_0x5997e9]={'$like':'%'+_0x278fa8[_0xb5f2('0x43')][_0xb5f2('0x33')]+'%'};return _0x4f4ad2;})});}_0x8d0473=_['merge']({},_0x8d0473,_0x278fa8[_0xb5f2('0x4f')]);return db[_0xb5f2('0x6e')][_0xb5f2('0x25')]({'where':_0x8d0473[_0xb5f2('0x4d')]})[_0xb5f2('0x2d')](function(_0x234015){_0x4e1d7a[_0xb5f2('0x25')]=_0x234015;if(_0x278fa8[_0xb5f2('0x43')]['includeAll']){_0x8d0473[_0xb5f2('0x5e')]=[{'all':!![]}];}return db[_0xb5f2('0x6e')][_0xb5f2('0x69')](_0x8d0473);})[_0xb5f2('0x2d')](function(_0x209ba7){_0x4e1d7a[_0xb5f2('0x6a')]=_0x209ba7;return _0x4e1d7a;});}})['then'](respondWithFilteredResult(_0x16717d,_0x8d0473))['catch'](handleError(_0x16717d,null));};exports[_0xb5f2('0x6f')]=function(_0x128f86,_0x493ed1,_0x1b0ecf){var _0x5c1557={'raw':!![],'where':{}};var _0x580646={};var _0x4cb2de={'count':0x0,'rows':[]};return db[_0xb5f2('0x3e')][_0xb5f2('0x64')]({'where':{'id':_0x128f86[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x493ed1,null))[_0xb5f2('0x2d')](function(_0x4750bd){if(_0x4750bd){_0x580646[_0xb5f2('0x42')]=_[_0xb5f2('0x44')](db[_0xb5f2('0x70')][_0xb5f2('0x3f')]);_0x580646['query']=_['keys'](_0x128f86[_0xb5f2('0x43')]);_0x580646['filters']=_[_0xb5f2('0x46')](_0x580646[_0xb5f2('0x42')],_0x580646['query']);_0x5c1557[_0xb5f2('0x48')]=_['intersection'](_0x580646[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x128f86[_0xb5f2('0x43')][_0xb5f2('0x47')]));_0x5c1557[_0xb5f2('0x48')]=_0x5c1557[_0xb5f2('0x48')][_0xb5f2('0x49')]?_0x5c1557[_0xb5f2('0x48')]:_0x580646[_0xb5f2('0x42')];if(!_0x128f86[_0xb5f2('0x43')]['hasOwnProperty'](_0xb5f2('0x4a'))){_0x5c1557[_0xb5f2('0x27')]=qs[_0xb5f2('0x27')](_0x128f86['query'][_0xb5f2('0x27')]);_0x5c1557[_0xb5f2('0x26')]=qs[_0xb5f2('0x26')](_0x128f86['query'][_0xb5f2('0x26')]);}_0x5c1557['order']=qs[_0xb5f2('0x4c')](_0x128f86[_0xb5f2('0x43')][_0xb5f2('0x4c')]);_0x5c1557[_0xb5f2('0x4d')]=qs['filters'](_[_0xb5f2('0x66')](_0x128f86[_0xb5f2('0x43')],_0x580646[_0xb5f2('0x45')]));_0x5c1557['where'][_0xb5f2('0x67')]=_0x4750bd['id'];if(_0x128f86[_0xb5f2('0x43')]['filter']){_0x5c1557[_0xb5f2('0x4d')]=_[_0xb5f2('0x4e')](_0x5c1557['where'],{'$or':_[_0xb5f2('0x35')](_0x5c1557[_0xb5f2('0x48')],function(_0x45f15d){var _0xc73c79={};_0xc73c79[_0x45f15d]={'$like':'%'+_0x128f86[_0xb5f2('0x43')][_0xb5f2('0x33')]+'%'};return _0xc73c79;})});}_0x5c1557=_[_0xb5f2('0x4e')]({},_0x5c1557,_0x128f86[_0xb5f2('0x4f')]);return db['CmHopperBlack'][_0xb5f2('0x25')]({'where':_0x5c1557[_0xb5f2('0x4d')]})[_0xb5f2('0x2d')](function(_0x3838db){_0x4cb2de[_0xb5f2('0x25')]=_0x3838db;if(_0x128f86[_0xb5f2('0x43')][_0xb5f2('0x53')]){_0x5c1557[_0xb5f2('0x5e')]=[{'all':!![]}];}return db[_0xb5f2('0x70')][_0xb5f2('0x69')](_0x5c1557);})[_0xb5f2('0x2d')](function(_0x50952d){_0x4cb2de[_0xb5f2('0x6a')]=_0x50952d;return _0x4cb2de;});}})[_0xb5f2('0x2d')](respondWithFilteredResult(_0x493ed1,_0x5c1557))[_0xb5f2('0x50')](handleError(_0x493ed1,null));};exports[_0xb5f2('0x71')]=function(_0x529510,_0x44567d,_0x9fc213){var _0x57a7ec={};var _0x5aa9d5={};var _0x472b8b;var _0x3ed044;return db[_0xb5f2('0x3e')][_0xb5f2('0x64')]({'where':{'id':_0x529510['params']['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x44567d,null))[_0xb5f2('0x2d')](function(_0x309a37){if(_0x309a37){_0x472b8b=_0x309a37;_0x5aa9d5[_0xb5f2('0x42')]=_[_0xb5f2('0x44')](db[_0xb5f2('0x72')][_0xb5f2('0x3f')]);_0x5aa9d5[_0xb5f2('0x43')]=_[_0xb5f2('0x44')](_0x529510[_0xb5f2('0x43')]);_0x5aa9d5[_0xb5f2('0x45')]=_[_0xb5f2('0x46')](_0x5aa9d5[_0xb5f2('0x42')],_0x5aa9d5[_0xb5f2('0x43')]);_0x57a7ec[_0xb5f2('0x48')]=_[_0xb5f2('0x46')](_0x5aa9d5[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x529510[_0xb5f2('0x43')][_0xb5f2('0x47')]));_0x57a7ec[_0xb5f2('0x48')]=_0x57a7ec[_0xb5f2('0x48')][_0xb5f2('0x49')]?_0x57a7ec[_0xb5f2('0x48')]:_0x5aa9d5[_0xb5f2('0x42')];_0x57a7ec[_0xb5f2('0x4b')]=qs['sort'](_0x529510[_0xb5f2('0x43')][_0xb5f2('0x4c')]);_0x57a7ec[_0xb5f2('0x4d')]=qs[_0xb5f2('0x45')](_[_0xb5f2('0x66')](_0x529510[_0xb5f2('0x43')],_0x5aa9d5['filters']));if(_0x529510[_0xb5f2('0x43')]['filter']){_0x57a7ec[_0xb5f2('0x4d')]=_[_0xb5f2('0x4e')](_0x57a7ec['where'],{'$or':_[_0xb5f2('0x35')](_0x57a7ec['attributes'],function(_0x31ed17){var _0x24e666={};_0x24e666[_0x31ed17]={'$like':'%'+_0x529510['query'][_0xb5f2('0x33')]+'%'};return _0x24e666;})});}_0x57a7ec=_[_0xb5f2('0x4e')]({},_0x57a7ec,_0x529510[_0xb5f2('0x4f')]);return _0x472b8b[_0xb5f2('0x71')](_0x57a7ec);}})[_0xb5f2('0x2d')](function(_0x3c0ad6){if(_0x3c0ad6){_0x3ed044=_0x3c0ad6[_0xb5f2('0x49')];if(!_0x529510[_0xb5f2('0x43')][_0xb5f2('0x65')](_0xb5f2('0x4a'))){_0x57a7ec['limit']=qs[_0xb5f2('0x27')](_0x529510[_0xb5f2('0x43')][_0xb5f2('0x27')]);_0x57a7ec['offset']=qs[_0xb5f2('0x26')](_0x529510['query'][_0xb5f2('0x26')]);}return _0x472b8b[_0xb5f2('0x71')](_0x57a7ec);}})[_0xb5f2('0x2d')](function(_0x47ffd0){if(_0x47ffd0){return _0x47ffd0?{'count':_0x3ed044,'rows':_0x47ffd0}:null;}})[_0xb5f2('0x2d')](respondWithResult(_0x44567d,null))['catch'](handleError(_0x44567d,null));};exports[_0xb5f2('0x73')]=function(_0x2a6050,_0x1a3ddc,_0x390c9b){var _0x13bff5=_0x2a6050[_0xb5f2('0x55')][_0xb5f2('0x74')];var _0x24d97e=_[_0xb5f2('0x35')](_0x13bff5,'id');return db['Team'][_0xb5f2('0x69')]({'where':{'id':_0x24d97e},'attributes':['id'],'include':[{'model':db[_0xb5f2('0x75')],'as':'Agents','attributes':['id','name',_0xb5f2('0x76'),_0xb5f2('0x77'),_0xb5f2('0x78')],'raw':!![]}]})['then'](function(_0x15c146){if(_0x15c146){var _0x36d1f8=_[_0xb5f2('0x79')](_0x15c146,function(_0x666263){var _0x1ebe8a=_0x666263[_0xb5f2('0x2f')]({'plain':!![]});_0x1ebe8a[_0xb5f2('0x7a')][_0xb5f2('0x7b')](function(_0x5a701d){_0x5a701d[_0xb5f2('0x7c')]=_[_0xb5f2('0x39')](_0x13bff5,{'id':_0x1ebe8a['id']})[_0xb5f2('0x7c')];});return _0x1ebe8a[_0xb5f2('0x7a')];});return db['VoiceQueue']['find']({'where':{'id':_0x2a6050[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](function(_0x334a75){return db[_0xb5f2('0x7d')][_0xb5f2('0x7e')](function(_0x12f395){return _0x334a75['addTeams'](_0x24d97e,{'transaction':_0x12f395})[_0xb5f2('0x2d')](function(){return BPromise[_0xb5f2('0x7f')](_0x13bff5,function(_0x4ca5ec){return db['TeamVoiceQueue'][_0xb5f2('0x80')]({'TeamId':_0x4ca5ec['id'],'VoiceQueueId':_0x2a6050[_0xb5f2('0x52')]['id'],'penalty':_0x4ca5ec[_0xb5f2('0x7c')]},{'transaction':_0x12f395});});})[_0xb5f2('0x2d')](function(){return BPromise[_0xb5f2('0x7f')](_0x36d1f8,function(_0x24b041){return db[_0xb5f2('0x81')][_0xb5f2('0x82')]({'where':{'UserId':_0x24b041['id'],'VoiceQueueId':_0x2a6050[_0xb5f2('0x52')]['id']},'defaults':{'penalty':_0x24b041[_0xb5f2('0x7c')]},'transaction':_0x12f395});});})[_0xb5f2('0x2d')](function(){return BPromise[_0xb5f2('0x7f')](_[_0xb5f2('0x33')](_0x36d1f8,{'online':!![]}),function(_0x4c4192){return db[_0xb5f2('0x83')][_0xb5f2('0x80')]({'membername':_0x4c4192['name'],'UserId':_0x4c4192['id'],'queue_name':_0x334a75[_0xb5f2('0x3a')],'VoiceQueueId':_0x334a75['id'],'interface':_['isNil'](_0x4c4192['interface'])?util[_0xb5f2('0x84')](_0xb5f2('0x85'),_0x4c4192[_0xb5f2('0x3a')]):_0x4c4192[_0xb5f2('0x78')],'paused':_0x4c4192['voicePause']||![],'penalty':_0x4c4192[_0xb5f2('0x7c')]},{'transaction':_0x12f395});});})[_0xb5f2('0x2d')](function(){_0x36d1f8[_0xb5f2('0x7b')](function(_0xb05c96){socket[_0xb5f2('0x86')](_0xb5f2('0x87'),{'UserId':_0xb05c96['id'],'VoiceQueueId':_0x334a75['id']});});});});});}})[_0xb5f2('0x2d')](respondWithStatusCode(_0x1a3ddc,null))['catch'](handleError(_0x1a3ddc,null));};exports['removeTeams']=function(_0x5d7b04,_0x202eaf,_0x3bbd48){return db['Team'][_0xb5f2('0x69')]({'where':{'id':_0x5d7b04[_0xb5f2('0x43')][_0xb5f2('0x88')]},'attributes':['id'],'include':[{'model':db[_0xb5f2('0x75')],'as':_0xb5f2('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x202eaf,null))[_0xb5f2('0x2d')](function(_0xa8ae36){var _0x69de1e=_[_0xb5f2('0x35')](_0xa8ae36,'id');var _0x1748a7=[];var _0x2380f4=[];var _0x5c0fc6=squel[_0xb5f2('0x89')]();_0x5c0fc6[_0xb5f2('0x8a')](_0xb5f2('0x8b'))[_0xb5f2('0x8c')](_0xb5f2('0x8d'),'tq')['join']('user_has_teams','ut',_0xb5f2('0x8e'))['where'](_0xb5f2('0x8f'),_0x5d7b04[_0xb5f2('0x52')]['id']);for(var _0x55d1a5=0x0;_0x55d1a5<_0xa8ae36[_0xb5f2('0x49')];_0x55d1a5+=0x1){let _0x3e0465=_0xa8ae36[_0x55d1a5];for(var _0x2fc3ef=0x0;_0x2fc3ef<_0x3e0465[_0xb5f2('0x7a')][_0xb5f2('0x49')];_0x2fc3ef+=0x1){let _0x4fd939=_0x3e0465[_0xb5f2('0x7a')][_0x2fc3ef];var _0x3f6e93=_0x5c0fc6[_0xb5f2('0x5d')]();_0x3f6e93[_0xb5f2('0x4d')](_0xb5f2('0x90'),_0x4fd939['id']);_0x2380f4[_0xb5f2('0x91')](db[_0xb5f2('0x7d')][_0xb5f2('0x43')](_0x3f6e93['toString'](),{'type':db[_0xb5f2('0x7d')][_0xb5f2('0x92')][_0xb5f2('0x93')]})[_0xb5f2('0x2d')](function(_0x41e869){if(_0x41e869[_0xb5f2('0x49')]===0x1){return _0x4fd939['id'];}else{var _0x33c20a=_[_0xb5f2('0x94')](_[_0xb5f2('0x35')](_0x41e869,_0xb5f2('0x95')),function(_0x1c087d){return _[_0xb5f2('0x37')](_0x69de1e,_0x1c087d);});if(_0x33c20a){return _0x4fd939['id'];}}}));}}return BPromise[_0xb5f2('0x96')](_0x2380f4)[_0xb5f2('0x2d')](function(_0x9fa6bd){_0x1748a7=_(_0x1748a7)[_0xb5f2('0x97')](_0x9fa6bd)[_0xb5f2('0x98')]()[_0xb5f2('0x36')]();return db[_0xb5f2('0x3e')][_0xb5f2('0x39')]({'where':{'id':_0x5d7b04[_0xb5f2('0x52')]['id']}})['then'](function(_0x553998){return db[_0xb5f2('0x7d')][_0xb5f2('0x7e')](function(_0x2ddcab){return _0x553998[_0xb5f2('0x99')](_0x5d7b04[_0xb5f2('0x43')][_0xb5f2('0x88')],{'transaction':_0x2ddcab})['then'](function(){if(!_['isEmpty'](_0x1748a7)){return _0x553998[_0xb5f2('0x9a')](_0x1748a7,{'transaction':_0x2ddcab})['then'](function(){return db[_0xb5f2('0x83')][_0xb5f2('0x2e')]({'where':{'VoiceQueueId':_0x5d7b04[_0xb5f2('0x52')]['id'],'UserId':_0x1748a7},'transaction':_0x2ddcab});});}})[_0xb5f2('0x2d')](function(){_0x1748a7[_0xb5f2('0x7b')](function(_0x488c67){socket[_0xb5f2('0x86')]('userVoiceQueue:remove',{'UserId':_0x488c67,'VoiceQueueId':_0x553998['id']});});});});});});})[_0xb5f2('0x2d')](respondWithStatusCode(_0x202eaf,null))['catch'](handleError(_0x202eaf,null));};exports[_0xb5f2('0x9b')]=function(_0x559a91,_0x34be0f,_0x140045){var _0x35f769,_0x33e0aa;return db[_0xb5f2('0x3e')][_0xb5f2('0x39')]({'where':{'id':_0x559a91[_0xb5f2('0x52')]['id']}})['then'](handleEntityNotFound(_0x34be0f,null))[_0xb5f2('0x2d')](function(_0x21ab45){if(_0x21ab45){_0x33e0aa=_0x21ab45;return _0x21ab45[_0xb5f2('0x9b')](_0x559a91[_0xb5f2('0x55')][_0xb5f2('0x88')],_[_0xb5f2('0x5f')](_0x559a91[_0xb5f2('0x55')],['ids','id'])||{})[_0xb5f2('0x9c')](function(_0x315653){for(var _0x56014e=0x0;_0x56014e<_0x559a91[_0xb5f2('0x55')]['ids'][_0xb5f2('0x49')];_0x56014e+=0x1){socket['emit'](_0xb5f2('0x87'),{'UserId':_0x559a91[_0xb5f2('0x55')][_0xb5f2('0x88')][_0x56014e],'VoiceQueueId':_0x559a91[_0xb5f2('0x52')]['id']});}return _0x315653;});}})['then'](function(_0x495e27){_0x35f769=_0x495e27||[];if(_0x33e0aa){return db[_0xb5f2('0x75')][_0xb5f2('0x69')]({'where':{'id':_0x559a91[_0xb5f2('0x55')][_0xb5f2('0x88')]},'attributes':['id',_0xb5f2('0x3a'),_0xb5f2('0x76'),_0xb5f2('0x77'),_0xb5f2('0x78')],'raw':!![]});}})[_0xb5f2('0x2d')](function(_0x296750){if(!_[_0xb5f2('0x9d')](_0x296750)){var _0x5d974a=[];for(var _0x2f5c20=0x0;_0x2f5c20<_0x296750[_0xb5f2('0x49')];_0x2f5c20++){if(_0x296750[_0x2f5c20]['online']){_0x5d974a[_0xb5f2('0x91')](db[_0xb5f2('0x83')][_0xb5f2('0x80')]({'membername':_0x296750[_0x2f5c20][_0xb5f2('0x3a')],'UserId':_0x296750[_0x2f5c20]['id'],'queue_name':_0x33e0aa['name'],'VoiceQueueId':_0x33e0aa['id'],'interface':_[_0xb5f2('0x9e')](_0x296750[_0x2f5c20][_0xb5f2('0x78')])?util[_0xb5f2('0x84')](_0xb5f2('0x85'),_0x296750[_0x2f5c20][_0xb5f2('0x3a')]):_0x296750[_0x2f5c20][_0xb5f2('0x78')],'paused':_0x296750[_0x2f5c20]['voicePause']||![],'penalty':_0x559a91['body']['penalty']||0x0}));}}return BPromise[_0xb5f2('0x96')](_0x5d974a);}})[_0xb5f2('0x2d')](function(){return _0x35f769;})['then'](respondWithResult(_0x34be0f,null))[_0xb5f2('0x50')](handleError(_0x34be0f,null));};exports['removeAgents']=function(_0x3ddd69,_0x44d752,_0x1f61a1){return db[_0xb5f2('0x3e')][_0xb5f2('0x39')]({'where':{'id':_0x3ddd69[_0xb5f2('0x52')]['id']}})['then'](handleEntityNotFound(_0x44d752,null))[_0xb5f2('0x2d')](function(_0x391750){if(_0x391750){return _0x391750[_0xb5f2('0x9a')](_0x3ddd69['query']['ids'])[_0xb5f2('0x2d')](function(){if(_[_0xb5f2('0x9f')](_0x3ddd69[_0xb5f2('0x43')]['ids'])){for(var _0x3a684f=0x0;_0x3a684f<_0x3ddd69[_0xb5f2('0x43')]['ids'][_0xb5f2('0x49')];_0x3a684f+=0x1){socket['emit'](_0xb5f2('0xa0'),{'UserId':Number(_0x3ddd69[_0xb5f2('0x43')][_0xb5f2('0x88')][_0x3a684f]),'VoiceQueueId':Number(_0x3ddd69[_0xb5f2('0x52')]['id'])});}}else{socket[_0xb5f2('0x86')](_0xb5f2('0xa0'),{'UserId':Number(_0x3ddd69['query'][_0xb5f2('0x88')]),'VoiceQueueId':Number(_0x3ddd69[_0xb5f2('0x52')]['id'])});}});}})[_0xb5f2('0x2d')](function(_0x539d67){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3ddd69['params']['id'],'UserId':_0x3ddd69[_0xb5f2('0x43')]['ids']}})[_0xb5f2('0x2d')](function(){return _0x539d67;});})['then'](respondWithStatusCode(_0x44d752,null))[_0xb5f2('0x50')](handleError(_0x44d752,null));};exports['getAgents']=function(_0x4c3851,_0x33cfb3,_0x49d319){var _0x167673={};var _0x58b235={};var _0x14ef8d;var _0x278f29;return db[_0xb5f2('0x3e')][_0xb5f2('0x64')]({'where':{'id':_0x4c3851[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x33cfb3,null))[_0xb5f2('0x2d')](function(_0x1bc7d4){if(_0x1bc7d4){_0x14ef8d=_0x1bc7d4;_0x58b235['model']=_[_0xb5f2('0x44')](db[_0xb5f2('0x75')]['rawAttributes']);_0x58b235[_0xb5f2('0x43')]=_['keys'](_0x4c3851[_0xb5f2('0x43')]);_0x58b235[_0xb5f2('0x45')]=_[_0xb5f2('0x46')](_0x58b235[_0xb5f2('0x42')],_0x58b235[_0xb5f2('0x43')]);_0x167673[_0xb5f2('0x48')]=_[_0xb5f2('0x46')](_0x58b235[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x4c3851['query'][_0xb5f2('0x47')]));_0x167673[_0xb5f2('0x48')]=_0x167673[_0xb5f2('0x48')]['length']?_0x167673[_0xb5f2('0x48')]:_0x58b235[_0xb5f2('0x42')];_0x167673['order']=qs[_0xb5f2('0x4c')](_0x4c3851[_0xb5f2('0x43')]['sort']);_0x167673['where']=qs['filters'](_[_0xb5f2('0x66')](_0x4c3851[_0xb5f2('0x43')],_0x58b235[_0xb5f2('0x45')]));if(_0x4c3851[_0xb5f2('0x43')]['filter']){_0x167673['where']=_[_0xb5f2('0x4e')](_0x167673['where'],{'$or':_[_0xb5f2('0x35')](_0x167673[_0xb5f2('0x48')],function(_0x5e6e05){var _0x328acc={};_0x328acc[_0x5e6e05]={'$like':'%'+_0x4c3851[_0xb5f2('0x43')][_0xb5f2('0x33')]+'%'};return _0x328acc;})});}_0x167673=_[_0xb5f2('0x4e')]({},_0x167673,_0x4c3851['options']);return _0x14ef8d['getAgents'](_0x167673);}})[_0xb5f2('0x2d')](function(_0x2ba52f){if(_0x2ba52f){_0x278f29=_0x2ba52f[_0xb5f2('0x49')];if(!_0x4c3851[_0xb5f2('0x43')][_0xb5f2('0x65')](_0xb5f2('0x4a'))){_0x167673[_0xb5f2('0x27')]=qs[_0xb5f2('0x27')](_0x4c3851[_0xb5f2('0x43')][_0xb5f2('0x27')]);_0x167673[_0xb5f2('0x26')]=qs['offset'](_0x4c3851[_0xb5f2('0x43')][_0xb5f2('0x26')]);}return _0x14ef8d['getAgents'](_0x167673);}})[_0xb5f2('0x2d')](function(_0x34d7dc){if(_0x34d7dc){return _0x34d7dc?{'count':_0x278f29,'rows':_0x34d7dc}:null;}})['then'](respondWithResult(_0x33cfb3,null))['catch'](handleError(_0x33cfb3,null));};exports[_0xb5f2('0xa1')]=function(_0x561677,_0xed8525,_0x5a4cc5){var _0x131157={};var _0x1507a2={};var _0x40f58a;var _0x398a2d;return db[_0xb5f2('0x3e')][_0xb5f2('0x64')]({'where':{'id':_0x561677['params']['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0xed8525,null))['then'](function(_0x4a282f){if(_0x4a282f){_0x40f58a=_0x4a282f;_0x1507a2['model']=_[_0xb5f2('0x44')](db[_0xb5f2('0x83')][_0xb5f2('0x3f')]);_0x1507a2[_0xb5f2('0x43')]=_[_0xb5f2('0x44')](_0x561677['query']);_0x1507a2[_0xb5f2('0x45')]=_[_0xb5f2('0x46')](_0x1507a2[_0xb5f2('0x42')],_0x1507a2[_0xb5f2('0x43')]);_0x131157[_0xb5f2('0x48')]=_['intersection'](_0x1507a2[_0xb5f2('0x42')],qs['fields'](_0x561677['query']['fields']));_0x131157[_0xb5f2('0x48')]=_0x131157['attributes'][_0xb5f2('0x49')]?_0x131157['attributes']:_0x1507a2[_0xb5f2('0x42')];_0x131157[_0xb5f2('0x4b')]=qs[_0xb5f2('0x4c')](_0x561677[_0xb5f2('0x43')][_0xb5f2('0x4c')]);_0x131157[_0xb5f2('0x4d')]=qs[_0xb5f2('0x45')](_['pick'](_0x561677[_0xb5f2('0x43')],_0x1507a2['filters']));if(_0x561677['query']['filter']){_0x131157[_0xb5f2('0x4d')]=_[_0xb5f2('0x4e')](_0x131157[_0xb5f2('0x4d')],{'$or':_[_0xb5f2('0x35')](_0x131157['attributes'],function(_0x149682){var _0x3e8ca8={};_0x3e8ca8[_0x149682]={'$like':'%'+_0x561677[_0xb5f2('0x43')][_0xb5f2('0x33')]+'%'};return _0x3e8ca8;})});}_0x131157=_['merge']({},_0x131157,_0x561677[_0xb5f2('0x4f')]);return _0x40f58a[_0xb5f2('0xa1')](_0x131157);}})['then'](function(_0x120d82){if(_0x120d82){_0x398a2d=_0x120d82[_0xb5f2('0x49')];if(!_0x561677[_0xb5f2('0x43')][_0xb5f2('0x65')](_0xb5f2('0x4a'))){_0x131157[_0xb5f2('0x27')]=qs[_0xb5f2('0x27')](_0x561677['query']['limit']);_0x131157[_0xb5f2('0x26')]=qs[_0xb5f2('0x26')](_0x561677[_0xb5f2('0x43')][_0xb5f2('0x26')]);}return _0x40f58a[_0xb5f2('0xa1')](_0x131157);}})[_0xb5f2('0x2d')](function(_0x37b0f0){return _0x37b0f0?{'count':_0x398a2d,'rows':_0x37b0f0}:null;})[_0xb5f2('0x2d')](respondWithResult(_0xed8525,null))[_0xb5f2('0x50')](handleError(_0xed8525,null));};exports[_0xb5f2('0xa2')]=function(_0x20f889,_0x1fbedb,_0x25006d){var _0x590fad={};var _0x20dcac={};var _0x1019f7;var _0xe8a575;return db['VoiceQueue'][_0xb5f2('0x64')]({'where':{'id':_0x20f889[_0xb5f2('0x52')]['id']}})['then'](handleEntityNotFound(_0x1fbedb,null))[_0xb5f2('0x2d')](function(_0x49d8db){if(_0x49d8db){_0x1019f7=_0x49d8db;_0x20dcac[_0xb5f2('0x42')]=_[_0xb5f2('0x44')](db[_0xb5f2('0xa3')][_0xb5f2('0x3f')]);_0x20dcac[_0xb5f2('0x43')]=_[_0xb5f2('0x44')](_0x20f889[_0xb5f2('0x43')]);_0x20dcac[_0xb5f2('0x45')]=_[_0xb5f2('0x46')](_0x20dcac['model'],_0x20dcac[_0xb5f2('0x43')]);_0x590fad[_0xb5f2('0x48')]=_[_0xb5f2('0x46')](_0x20dcac[_0xb5f2('0x42')],qs[_0xb5f2('0x47')](_0x20f889[_0xb5f2('0x43')][_0xb5f2('0x47')]));_0x590fad['attributes']=_0x590fad['attributes'][_0xb5f2('0x49')]?_0x590fad[_0xb5f2('0x48')]:_0x20dcac[_0xb5f2('0x42')];_0x590fad[_0xb5f2('0x4b')]=qs[_0xb5f2('0x4c')](_0x20f889['query'][_0xb5f2('0x4c')]);_0x590fad[_0xb5f2('0x4d')]=qs[_0xb5f2('0x45')](_[_0xb5f2('0x66')](_0x20f889[_0xb5f2('0x43')],_0x20dcac['filters']));if(_0x20f889[_0xb5f2('0x43')][_0xb5f2('0x33')]){_0x590fad[_0xb5f2('0x4d')]=_[_0xb5f2('0x4e')](_0x590fad[_0xb5f2('0x4d')],{'$or':_[_0xb5f2('0x35')](_0x590fad[_0xb5f2('0x48')],function(_0x4f3820){var _0x4eab0d={};_0x4eab0d[_0x4f3820]={'$like':'%'+_0x20f889['query'][_0xb5f2('0x33')]+'%'};return _0x4eab0d;})});}_0x590fad=_[_0xb5f2('0x4e')]({},_0x590fad,_0x20f889[_0xb5f2('0x4f')]);return _0x1019f7[_0xb5f2('0xa2')](_0x590fad);}})[_0xb5f2('0x2d')](function(_0xa31d78){if(_0xa31d78){_0xe8a575=_0xa31d78[_0xb5f2('0x49')];if(!_0x20f889[_0xb5f2('0x43')]['hasOwnProperty'](_0xb5f2('0x4a'))){_0x590fad[_0xb5f2('0x27')]=qs[_0xb5f2('0x27')](_0x20f889['query']['limit']);_0x590fad[_0xb5f2('0x26')]=qs['offset'](_0x20f889[_0xb5f2('0x43')]['offset']);}return _0x1019f7[_0xb5f2('0xa2')](_0x590fad);}})[_0xb5f2('0x2d')](function(_0x46e293){if(_0x46e293){return _0x46e293?{'count':_0xe8a575,'rows':_0x46e293}:null;}})[_0xb5f2('0x2d')](respondWithResult(_0x1fbedb,null))[_0xb5f2('0x50')](handleError(_0x1fbedb,null));};exports[_0xb5f2('0xa4')]=function(_0xe32b25,_0x567adc,_0x250223){var _0x2311c8,_0x5f3b41;return db['VoiceQueue']['find']({'where':{'id':_0xe32b25['params']['id']}})['then'](handleEntityNotFound(_0x567adc,null))[_0xb5f2('0x2d')](function(_0x17a956){if(_0x17a956){_0x5f3b41=_0x17a956;return _0x17a956[_0xb5f2('0xa4')](_0xe32b25['body'][_0xb5f2('0x88')],_[_0xb5f2('0x5f')](_0xe32b25['body'],[_0xb5f2('0x88'),'id'])||{});}return null;})[_0xb5f2('0x9c')](function(_0x33f1c0){var _0x1a0ec1;_0x2311c8=_0x33f1c0||[];var _0x42cf65=[];if(_0x33f1c0){for(var _0x2b8882=0x0;_0x2b8882<_0x33f1c0[_0xb5f2('0x49')];_0x2b8882+=0x1){var _0x4938ce=_0x33f1c0[_0x2b8882][_0xb5f2('0x2f')]({'plain':!![]});_0x5f3b41[_0xb5f2('0xa5')]=_0xe32b25[_0xb5f2('0x55')][_0xb5f2('0xa5')]?_0xe32b25['body'][_0xb5f2('0xa5')]:_0x5f3b41[_0xb5f2('0xa5')];switch(_0x5f3b41['dialCheckDuplicateType']){case _0xb5f2('0xa6'):_0x1a0ec1=squel[_0xb5f2('0xa7')]()[_0xb5f2('0xa8')]('cm_hopper')[_0xb5f2('0xa9')]([_0xb5f2('0xaa'),'scheduledAt',_0xb5f2('0xab'),_0xb5f2('0xac'),_0xb5f2('0x67'),_0xb5f2('0x60'),'updatedAt'],squel[_0xb5f2('0x89')]()['field'](_0xb5f2('0xaa'),'phone')['field'](_0xb5f2('0xad'),_0xb5f2('0xae'))['field']('id',_0xb5f2('0xab'))['field'](_0x4938ce[_0xb5f2('0xaf')]['toString'](),_0xb5f2('0xac'))[_0xb5f2('0x8a')](_0xe32b25[_0xb5f2('0x52')]['id'][_0xb5f2('0xb0')](),_0xb5f2('0x67'))[_0xb5f2('0x8a')](_0xb5f2('0xad'),'createdAt')[_0xb5f2('0x8a')](_0xb5f2('0xad'),_0xb5f2('0x61'))['from'](_0xb5f2('0xb1'))['where'](_0xb5f2('0xb2'))[_0xb5f2('0x4d')](_0xb5f2('0xb3'),_0x4938ce[_0xb5f2('0xaf')][_0xb5f2('0xb0')]())[_0xb5f2('0x4d')]('phone\x20IS\x20NOT\x20NULL')[_0xb5f2('0x4d')](_0xb5f2('0xb4'),squel['select']()[_0xb5f2('0x8a')](_0xb5f2('0xb5'))[_0xb5f2('0x8c')]('cm_hopper_final')[_0xb5f2('0x4d')](_0xb5f2('0x8f'),_0xe32b25[_0xb5f2('0x52')]['id']['toString']()))['where'](_0xb5f2('0xb4'),squel[_0xb5f2('0x89')]()[_0xb5f2('0x8a')](_0xb5f2('0xb6'))['from']('cm_hopper')[_0xb5f2('0x4d')](_0xb5f2('0x8f'),_0xe32b25[_0xb5f2('0x52')]['id'][_0xb5f2('0xb0')]())))[_0xb5f2('0xb0')]();break;case _0xb5f2('0xb7'):_0x1a0ec1=squel['insert']()['into']('cm_hopper')['fromQuery']([_0xb5f2('0xaa'),'scheduledAt','ContactId','ListId','VoiceQueueId',_0xb5f2('0x60'),_0xb5f2('0x61')],squel[_0xb5f2('0x89')]()[_0xb5f2('0x8a')](_0xb5f2('0xaa'),_0xb5f2('0xaa'))[_0xb5f2('0x8a')](_0xb5f2('0xad'),'scheduledAt')[_0xb5f2('0x8a')]('id',_0xb5f2('0xab'))[_0xb5f2('0x8a')](_0x4938ce[_0xb5f2('0xaf')]['toString'](),_0xb5f2('0xac'))[_0xb5f2('0x8a')](_0xe32b25[_0xb5f2('0x52')]['id'][_0xb5f2('0xb0')](),_0xb5f2('0x67'))[_0xb5f2('0x8a')](_0xb5f2('0xad'),_0xb5f2('0x60'))['field']('NOW()',_0xb5f2('0x61'))['from'](_0xb5f2('0xb1'))[_0xb5f2('0x4d')](_0xb5f2('0xb2'))['where'](_0xb5f2('0xb3'),_0x4938ce[_0xb5f2('0xaf')][_0xb5f2('0xb0')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xb5f2('0xb4'),squel[_0xb5f2('0x89')]()[_0xb5f2('0x8a')](_0xb5f2('0xb6'))[_0xb5f2('0x8c')](_0xb5f2('0xb8'))['where'](_0xb5f2('0x8f'),_0xe32b25[_0xb5f2('0x52')]['id'][_0xb5f2('0xb0')]())))[_0xb5f2('0xb0')]();break;default:_0x1a0ec1=squel[_0xb5f2('0xa7')]()[_0xb5f2('0xa8')](_0xb5f2('0xb8'))[_0xb5f2('0xa9')]([_0xb5f2('0xaa'),_0xb5f2('0xae'),_0xb5f2('0xab'),_0xb5f2('0xac'),_0xb5f2('0x67'),'createdAt','updatedAt'],squel['select']()[_0xb5f2('0x8a')](_0xb5f2('0xaa'),'phone')[_0xb5f2('0x8a')]('NOW()','scheduledAt')[_0xb5f2('0x8a')]('id',_0xb5f2('0xab'))[_0xb5f2('0x8a')](_0x4938ce[_0xb5f2('0xaf')][_0xb5f2('0xb0')](),_0xb5f2('0xac'))[_0xb5f2('0x8a')](_0xe32b25[_0xb5f2('0x52')]['id'][_0xb5f2('0xb0')](),_0xb5f2('0x67'))['field'](_0xb5f2('0xad'),_0xb5f2('0x60'))[_0xb5f2('0x8a')]('NOW()','updatedAt')[_0xb5f2('0x8c')](_0xb5f2('0xb1'))[_0xb5f2('0x4d')](_0xb5f2('0xb2'))[_0xb5f2('0x4d')](_0xb5f2('0xb3'),_0x4938ce[_0xb5f2('0xaf')][_0xb5f2('0xb0')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xb5f2('0xb0')]();}_0x42cf65['push'](db[_0xb5f2('0x7d')][_0xb5f2('0x43')](_0x1a0ec1));}return BPromise[_0xb5f2('0x96')](_0x42cf65);}})[_0xb5f2('0x2d')](function(){return _0x2311c8;})[_0xb5f2('0x2d')](respondWithResult(_0x567adc,null))['catch'](handleError(_0x567adc,null));};exports[_0xb5f2('0xb9')]=function(_0x315721,_0x26db5d,_0x1aa91e){return db[_0xb5f2('0x3e')][_0xb5f2('0x39')]({'where':{'id':_0x315721[_0xb5f2('0x52')]['id']}})['then'](handleEntityNotFound(_0x26db5d,null))[_0xb5f2('0x2d')](function(_0x5d092e){if(_0x5d092e){return _0x5d092e['removeLists'](_0x315721[_0xb5f2('0x43')]['ids']);}})[_0xb5f2('0x2d')](function(_0x426cee){if(_0x426cee){return db[_0xb5f2('0x68')][_0xb5f2('0x2e')]({'where':{'ListId':_0x315721['query'][_0xb5f2('0x88')],'VoiceQueueId':_0x315721[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](function(){return _0x426cee;});}})[_0xb5f2('0x2d')](respondWithStatusCode(_0x26db5d,null))['catch'](handleError(_0x26db5d,null));};exports['getBlackLists']=function(_0x466c29,_0x58047b,_0x13909e){var _0x43640d={};var _0x56117e={};var _0xbf0e3d;var _0x3d2aa1;return db['VoiceQueue'][_0xb5f2('0x64')]({'where':{'id':_0x466c29[_0xb5f2('0x52')]['id']}})['then'](handleEntityNotFound(_0x58047b,null))['then'](function(_0x33fc47){if(_0x33fc47){_0xbf0e3d=_0x33fc47;_0x56117e[_0xb5f2('0x42')]=_[_0xb5f2('0x44')](db[_0xb5f2('0xa3')][_0xb5f2('0x3f')]);_0x56117e[_0xb5f2('0x43')]=_[_0xb5f2('0x44')](_0x466c29[_0xb5f2('0x43')]);_0x56117e[_0xb5f2('0x45')]=_[_0xb5f2('0x46')](_0x56117e[_0xb5f2('0x42')],_0x56117e[_0xb5f2('0x43')]);_0x43640d[_0xb5f2('0x48')]=_['intersection'](_0x56117e['model'],qs[_0xb5f2('0x47')](_0x466c29['query'][_0xb5f2('0x47')]));_0x43640d['attributes']=_0x43640d[_0xb5f2('0x48')][_0xb5f2('0x49')]?_0x43640d['attributes']:_0x56117e[_0xb5f2('0x42')];_0x43640d[_0xb5f2('0x4b')]=qs[_0xb5f2('0x4c')](_0x466c29[_0xb5f2('0x43')][_0xb5f2('0x4c')]);_0x43640d[_0xb5f2('0x4d')]=qs[_0xb5f2('0x45')](_['pick'](_0x466c29[_0xb5f2('0x43')],_0x56117e[_0xb5f2('0x45')]));if(_0x466c29['query'][_0xb5f2('0x33')]){_0x43640d['where']=_[_0xb5f2('0x4e')](_0x43640d['where'],{'$or':_[_0xb5f2('0x35')](_0x43640d[_0xb5f2('0x48')],function(_0x177c30){var _0x26d066={};_0x26d066[_0x177c30]={'$like':'%'+_0x466c29['query'][_0xb5f2('0x33')]+'%'};return _0x26d066;})});}_0x43640d=_['merge']({},_0x43640d,_0x466c29[_0xb5f2('0x4f')]);return _0xbf0e3d[_0xb5f2('0xba')](_0x43640d);}})[_0xb5f2('0x2d')](function(_0x54f885){if(_0x54f885){_0x3d2aa1=_0x54f885[_0xb5f2('0x49')];if(!_0x466c29['query']['hasOwnProperty'](_0xb5f2('0x4a'))){_0x43640d[_0xb5f2('0x27')]=qs[_0xb5f2('0x27')](_0x466c29['query']['limit']);_0x43640d[_0xb5f2('0x26')]=qs['offset'](_0x466c29['query']['offset']);}return _0xbf0e3d[_0xb5f2('0xba')](_0x43640d);}})[_0xb5f2('0x2d')](function(_0x182ba7){if(_0x182ba7){return _0x182ba7?{'count':_0x3d2aa1,'rows':_0x182ba7}:null;}})[_0xb5f2('0x2d')](respondWithResult(_0x58047b,null))[_0xb5f2('0x50')](handleError(_0x58047b,null));};exports[_0xb5f2('0xbb')]=function(_0xb7384d,_0x2ea488,_0x169139){var _0x417ae8,_0x38dc81;return db[_0xb5f2('0x3e')][_0xb5f2('0x39')]({'where':{'id':_0xb7384d[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x2ea488,null))[_0xb5f2('0x2d')](function(_0x2f0b93){if(_0x2f0b93){_0x38dc81=_0x2f0b93;return _0x2f0b93[_0xb5f2('0xbb')](_0xb7384d['body']['ids'],_['omit'](_0xb7384d['body'],[_0xb5f2('0x88'),'id'])||{});}return null;})['spread'](function(_0x159a6d){var _0x375399;_0x417ae8=_0x159a6d||[];var _0x367081=[];if(_0x159a6d){for(var _0x54ef27=0x0;_0x54ef27<_0x159a6d['length'];_0x54ef27+=0x1){var _0x318769=_0x159a6d[_0x54ef27][_0xb5f2('0x2f')]({'plain':!![]});_0x375399=squel[_0xb5f2('0xa7')]()[_0xb5f2('0xa8')](_0xb5f2('0xbc'))[_0xb5f2('0xa9')]([_0xb5f2('0xaa'),_0xb5f2('0xab'),_0xb5f2('0xac'),_0xb5f2('0x67'),_0xb5f2('0x60'),_0xb5f2('0x61')],squel['select']()[_0xb5f2('0x8a')]('phone',_0xb5f2('0xaa'))['field']('id',_0xb5f2('0xab'))[_0xb5f2('0x8a')](_0x318769[_0xb5f2('0xaf')][_0xb5f2('0xb0')](),_0xb5f2('0xac'))[_0xb5f2('0x8a')](_0xb7384d[_0xb5f2('0x52')]['id'][_0xb5f2('0xb0')](),_0xb5f2('0x67'))[_0xb5f2('0x8a')]('NOW()',_0xb5f2('0x60'))[_0xb5f2('0x8a')](_0xb5f2('0xad'),'updatedAt')[_0xb5f2('0x8c')]('cm_contacts')[_0xb5f2('0x4d')](_0xb5f2('0xb2'))['where'](_0xb5f2('0xb3'),_0x318769['CmListId'][_0xb5f2('0xb0')]())['where'](_0xb5f2('0xbd')))[_0xb5f2('0xb0')]();_0x367081['push'](db[_0xb5f2('0x7d')][_0xb5f2('0x43')](_0x375399));}return BPromise[_0xb5f2('0x96')](_0x367081);}})['then'](function(){return _0x417ae8;})[_0xb5f2('0x2d')](respondWithResult(_0x2ea488,null))[_0xb5f2('0x50')](handleError(_0x2ea488,null));};exports[_0xb5f2('0xbe')]=function(_0x2b2432,_0x41bc00,_0x4d71dd){return db[_0xb5f2('0x3e')][_0xb5f2('0x39')]({'where':{'id':_0x2b2432[_0xb5f2('0x52')]['id']}})[_0xb5f2('0x2d')](handleEntityNotFound(_0x41bc00,null))[_0xb5f2('0x2d')](function(_0x286e1e){if(_0x286e1e){return _0x286e1e[_0xb5f2('0xbe')](_0x2b2432[_0xb5f2('0x43')][_0xb5f2('0x88')]);}})['then'](function(_0x554fd5){if(_0x554fd5){return db[_0xb5f2('0x70')][_0xb5f2('0x2e')]({'where':{'ListId':_0x2b2432[_0xb5f2('0x43')][_0xb5f2('0x88')],'VoiceQueueId':_0x2b2432['params']['id']}})[_0xb5f2('0x2d')](function(){return _0x554fd5;});}})['then'](respondWithStatusCode(_0x41bc00,null))[_0xb5f2('0x50')](handleError(_0x41bc00,null));}; \ No newline at end of file +var _0xdcbb=['userVoiceQueue:remove','addAgents','omit','spread','isNil','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','NOW()','ContactId','ListId','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','count','limit','set','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','end','stack','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','merge','VIRTUAL','options','includeAll','include','VoiceQueue','findAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','clone','params','createdAt','updatedAt','userProfileId','getHoppers','findOne','pick','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','removeAgents'];(function(_0x31a047,_0x25638b){var _0x48a379=function(_0x1bd2df){while(--_0x1bd2df){_0x31a047['push'](_0x31a047['shift']());}};_0x48a379(++_0x25638b);}(_0xdcbb,0x18c));var _0xbdcb=function(_0x30e09e,_0x11899f){_0x30e09e=_0x30e09e-0x0;var _0x196ff5=_0xdcbb[_0x30e09e];return _0x196ff5;};'use strict';var pdf=require(_0xbdcb('0x0'));var emlformat=require(_0xbdcb('0x1'));var rimraf=require(_0xbdcb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdcb('0x3'));var rp=require('request-promise');var moment=require(_0xbdcb('0x4'));var BPromise=require(_0xbdcb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbdcb('0x6'));var sox=require('sox');var csv=require(_0xbdcb('0x7'));var ejs=require(_0xbdcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbdcb('0x9'));var _=require(_0xbdcb('0xa'));var squel=require(_0xbdcb('0xb'));var crypto=require(_0xbdcb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbdcb('0xd'));var toCsv=require(_0xbdcb('0x7'));var querystring=require(_0xbdcb('0xe'));var Papa=require(_0xbdcb('0xf'));var Redis=require(_0xbdcb('0x10'));var authService=require(_0xbdcb('0x11'));var qs=require(_0xbdcb('0x12'));var as=require(_0xbdcb('0x13'));var hardwareService=require(_0xbdcb('0x14'));var logger=require(_0xbdcb('0x15'))(_0xbdcb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbdcb('0x17'));var db=require('../../mysqldb')['db'];config[_0xbdcb('0x18')]=_[_0xbdcb('0x19')](config[_0xbdcb('0x18')],{'host':_0xbdcb('0x1a'),'port':0x18eb});var socket=require(_0xbdcb('0x1b'))(new Redis(config['redis']));require(_0xbdcb('0x1c'))[_0xbdcb('0x1d')](socket);function respondWithStatusCode(_0x5b75e6,_0x45daad){_0x45daad=_0x45daad||0xcc;return function(_0x8827c2){if(_0x8827c2){return _0x5b75e6[_0xbdcb('0x1e')](_0x45daad);}return _0x5b75e6['status'](_0x45daad)['end']();};}function respondWithResult(_0x2d340c,_0x1b3e89){_0x1b3e89=_0x1b3e89||0xc8;return function(_0x3b876b){if(_0x3b876b){return _0x2d340c[_0xbdcb('0x1f')](_0x1b3e89)[_0xbdcb('0x20')](_0x3b876b);}};}function respondWithFilteredResult(_0x58389c,_0x99c4f1){return function(_0x15ab2){if(_0x15ab2){var _0x39d2b2=_0x15ab2[_0xbdcb('0x21')],_0x132b8f=_0x99c4f1['offset'],_0x350dbe=_0x99c4f1['offset']+_0x99c4f1[_0xbdcb('0x22')],_0xe54eb2;if(_0x350dbe>=_0x39d2b2){_0x350dbe=_0x39d2b2;_0xe54eb2=0xc8;}else{_0xe54eb2=0xce;}_0x58389c[_0xbdcb('0x1f')](_0xe54eb2);return _0x58389c[_0xbdcb('0x23')]('Content-Range',_0x132b8f+'-'+_0x350dbe+'/'+_0x39d2b2)[_0xbdcb('0x20')](_0x15ab2);}return null;};}function patchUpdates(_0x4c106d){return function(_0x280879){try{jsonpatch['apply'](_0x280879,_0x4c106d,!![]);}catch(_0x28820e){return BPromise[_0xbdcb('0x24')](_0x28820e);}return _0x280879['save']();};}function saveUpdates(_0x591e61,_0x593a62){return function(_0x27398d){if(_0x27398d){return _0x27398d['update'](_0x591e61)[_0xbdcb('0x25')](function(_0x58d4c4){return _0x58d4c4;});}return null;};}function removeEntity(_0x2d77d0,_0x4c2ddc){return function(_0x118b46){if(_0x118b46){return _0x118b46[_0xbdcb('0x26')]()[_0xbdcb('0x25')](function(){var _0x232695=_0x118b46[_0xbdcb('0x27')]({'plain':!![]});var _0x5d05dd=[{'name':_0xbdcb('0x28'),'value':_0xbdcb('0x29'),'ignore':![]},{'name':_0xbdcb('0x2a'),'value':_0xbdcb('0x2b'),'ignore':![]}];var _0x2d42ae=_(_0x5d05dd)[_0xbdcb('0x2c')](_0xbdcb('0x2d'))['map'](_0xbdcb('0x2e'))[_0xbdcb('0x2e')]();if(_[_0xbdcb('0x2f')](_0x2d42ae,_0x232695[_0xbdcb('0x30')])){return;}var _0x3901ff=_[_0xbdcb('0x31')](_0x5d05dd,[_0xbdcb('0x2e'),_0x232695['type']])[_0xbdcb('0x32')];return db[_0xbdcb('0x33')][_0xbdcb('0x26')]({'where':{'type':_0x3901ff,'resourceId':_0x232695['id']}})[_0xbdcb('0x25')](function(){return _0x118b46;});})[_0xbdcb('0x25')](function(){_0x2d77d0[_0xbdcb('0x1f')](0xcc)[_0xbdcb('0x34')]();});}};}function handleEntityNotFound(_0x7cdc44,_0x121c34){return function(_0x44277b){if(!_0x44277b){_0x7cdc44[_0xbdcb('0x1e')](0x194);}return _0x44277b;};}function handleError(_0x511d94,_0x22ecfd){_0x22ecfd=_0x22ecfd||0x1f4;return function(_0x250af1){logger['error'](_0x250af1[_0xbdcb('0x35')]);if(_0x250af1['name']){delete _0x250af1[_0xbdcb('0x32')];}_0x511d94[_0xbdcb('0x1f')](_0x22ecfd)[_0xbdcb('0x36')](_0x250af1);};}exports[_0xbdcb('0x37')]=function(_0x5d94dd,_0x314d6d){var _0x370d26={},_0x5135c0={},_0x27e83e={'count':0x0,'rows':[]};var _0x1e0b1a=_['map'](db['VoiceQueue'][_0xbdcb('0x38')],function(_0x42a149){return{'name':_0x42a149[_0xbdcb('0x39')],'type':_0x42a149[_0xbdcb('0x30')][_0xbdcb('0x3a')]};});_0x5135c0[_0xbdcb('0x3b')]=_[_0xbdcb('0x3c')](_0x1e0b1a,'name');_0x5135c0[_0xbdcb('0x3d')]=_[_0xbdcb('0x3e')](_0x5d94dd['query']);_0x5135c0[_0xbdcb('0x3f')]=_[_0xbdcb('0x40')](_0x5135c0[_0xbdcb('0x3b')],_0x5135c0[_0xbdcb('0x3d')]);_0x370d26[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x5135c0[_0xbdcb('0x3b')],qs[_0xbdcb('0x42')](_0x5d94dd[_0xbdcb('0x3d')][_0xbdcb('0x42')]));_0x370d26[_0xbdcb('0x41')]=_0x370d26['attributes'][_0xbdcb('0x43')]?_0x370d26[_0xbdcb('0x41')]:_0x5135c0[_0xbdcb('0x3b')];if(!_0x5d94dd[_0xbdcb('0x3d')][_0xbdcb('0x44')](_0xbdcb('0x45'))){_0x370d26['limit']=qs[_0xbdcb('0x22')](_0x5d94dd[_0xbdcb('0x3d')][_0xbdcb('0x22')]);_0x370d26[_0xbdcb('0x46')]=qs[_0xbdcb('0x46')](_0x5d94dd[_0xbdcb('0x3d')][_0xbdcb('0x46')]);}_0x370d26[_0xbdcb('0x47')]=qs[_0xbdcb('0x48')](_0x5d94dd['query'][_0xbdcb('0x48')]);_0x370d26[_0xbdcb('0x49')]=qs['filters'](_['pick'](_0x5d94dd[_0xbdcb('0x3d')],_0x5135c0[_0xbdcb('0x3f')]),_0x1e0b1a);if(_0x5d94dd[_0xbdcb('0x3d')][_0xbdcb('0x2c')]){_0x370d26[_0xbdcb('0x49')]=_[_0xbdcb('0x4a')](_0x370d26['where'],{'$or':_['map'](_0x1e0b1a,function(_0x54c02c){if(_0x54c02c[_0xbdcb('0x30')]!==_0xbdcb('0x4b')){var _0x2bafc7={};_0x2bafc7[_0x54c02c[_0xbdcb('0x32')]]={'$like':'%'+_0x5d94dd[_0xbdcb('0x3d')][_0xbdcb('0x2c')]+'%'};return _0x2bafc7;}})});}_0x370d26=_[_0xbdcb('0x4a')]({},_0x370d26,_0x5d94dd[_0xbdcb('0x4c')]);var _0x98690={'where':_0x370d26[_0xbdcb('0x49')]};return db['VoiceQueue'][_0xbdcb('0x21')](_0x98690)['then'](function(_0x592425){_0x27e83e['count']=_0x592425;if(_0x5d94dd[_0xbdcb('0x3d')][_0xbdcb('0x4d')]){_0x370d26[_0xbdcb('0x4e')]=[{'all':!![]}];}return db[_0xbdcb('0x4f')][_0xbdcb('0x50')](_0x370d26);})[_0xbdcb('0x25')](function(_0x505429){_0x27e83e['rows']=_0x505429;return _0x27e83e;})[_0xbdcb('0x25')](respondWithFilteredResult(_0x314d6d,_0x370d26))[_0xbdcb('0x51')](handleError(_0x314d6d,null));};exports['show']=function(_0x54ff72,_0x3ffdc4){var _0x411c97={'raw':![],'where':{'id':_0x54ff72['params']['id']}},_0x423488={};_0x423488['model']=_[_0xbdcb('0x3e')](db[_0xbdcb('0x4f')][_0xbdcb('0x38')]);_0x423488[_0xbdcb('0x3d')]=_[_0xbdcb('0x3e')](_0x54ff72[_0xbdcb('0x3d')]);_0x423488[_0xbdcb('0x3f')]=_[_0xbdcb('0x40')](_0x423488[_0xbdcb('0x3b')],_0x423488['query']);_0x411c97[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x423488[_0xbdcb('0x3b')],qs[_0xbdcb('0x42')](_0x54ff72[_0xbdcb('0x3d')][_0xbdcb('0x42')]));_0x411c97['attributes']=_0x411c97[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x411c97[_0xbdcb('0x41')]:_0x423488['model'];if(_0x54ff72[_0xbdcb('0x3d')]['includeAll']){_0x411c97[_0xbdcb('0x4e')]=[{'all':!![]}];}_0x411c97=_[_0xbdcb('0x4a')]({},_0x411c97,_0x54ff72[_0xbdcb('0x4c')]);return db[_0xbdcb('0x4f')]['find'](_0x411c97)['then'](handleEntityNotFound(_0x3ffdc4,null))[_0xbdcb('0x25')](respondWithResult(_0x3ffdc4,null))[_0xbdcb('0x51')](handleError(_0x3ffdc4,null));};exports[_0xbdcb('0x52')]=function(_0x4bc177,_0x2c9254){return db['VoiceQueue'][_0xbdcb('0x52')](_0x4bc177[_0xbdcb('0x53')],{})[_0xbdcb('0x25')](function(_0x25df6d){var _0x387e2b=_0x4bc177[_0xbdcb('0x54')]['get']({'plain':!![]});if(!_0x387e2b)throw new Error(_0xbdcb('0x55'));if(_0x387e2b[_0xbdcb('0x56')]===_0xbdcb('0x54')){var _0x3be8fe=_0x25df6d['get']({'plain':!![]});var _0x5605c5=[{'name':_0xbdcb('0x28'),'value':_0xbdcb('0x29')},{'name':'QueueCampaigns','value':_0xbdcb('0x2b')}];var _0x5ae779=_[_0xbdcb('0x31')](_0x5605c5,[_0xbdcb('0x2e'),_0x3be8fe[_0xbdcb('0x30')]])[_0xbdcb('0x32')];return db[_0xbdcb('0x57')][_0xbdcb('0x31')]({'where':{'name':_0x5ae779,'userProfileId':_0x387e2b['userProfileId']},'raw':!![]})[_0xbdcb('0x25')](function(_0x27a3a7){if(_0x27a3a7&&_0x27a3a7[_0xbdcb('0x58')]===0x0){return db[_0xbdcb('0x33')][_0xbdcb('0x52')]({'name':_0x3be8fe[_0xbdcb('0x32')],'resourceId':_0x3be8fe['id'],'type':_0x27a3a7[_0xbdcb('0x32')],'sectionId':_0x27a3a7['id']},{})[_0xbdcb('0x25')](function(){return _0x25df6d;});}else{return _0x25df6d;}})['catch'](function(_0x12ff8b){logger[_0xbdcb('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12ff8b);throw _0x12ff8b;});}return _0x25df6d;})['then'](respondWithResult(_0x2c9254,0xc9))['catch'](handleError(_0x2c9254,null));};exports[_0xbdcb('0x5a')]=function(_0x51a3a0,_0x2318a1){var _0x19ef68={'where':{'id':_0x51a3a0[_0xbdcb('0x5b')]['id']}},_0x15f6ed={};_0x15f6ed[_0xbdcb('0x3b')]=_[_0xbdcb('0x3e')](db['VoiceQueue'][_0xbdcb('0x38')]);_0x19ef68[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x15f6ed['model'],qs[_0xbdcb('0x42')](_0x51a3a0[_0xbdcb('0x3d')][_0xbdcb('0x42')]));_0x19ef68['attributes']=_0x19ef68[_0xbdcb('0x41')]['length']?_0x19ef68[_0xbdcb('0x41')]:_0x15f6ed[_0xbdcb('0x3b')];if(_0x51a3a0['query'][_0xbdcb('0x4d')]){_0x19ef68['include']=[{'all':!![]}];}_0x19ef68=_[_0xbdcb('0x4a')]({},_0x19ef68,_0x51a3a0['options']);return db['VoiceQueue']['find'](_0x19ef68)[_0xbdcb('0x25')](handleEntityNotFound(_0x2318a1,null))[_0xbdcb('0x25')](function(_0x4f7cbd){if(_0x4f7cbd){var _0x763328=_0x4f7cbd[_0xbdcb('0x27')]({'plain':!![]});_0x763328=qs['omit'](_0x763328,['id','createdAt','updatedAt']);_0x51a3a0['body']=_['omit'](_0x51a3a0[_0xbdcb('0x53')],['id',_0xbdcb('0x5c'),_0xbdcb('0x5d')]);return db[_0xbdcb('0x4f')][_0xbdcb('0x52')](_[_0xbdcb('0x4a')](_0x763328,_0x51a3a0['body']),{'include':_0x51a3a0['query'][_0xbdcb('0x4d')]?[{'all':!![]}]:undefined})[_0xbdcb('0x25')](function(_0x3e42e5){var _0x453dd3=_0x51a3a0[_0xbdcb('0x54')]['get']({'plain':!![]});if(!_0x453dd3)throw new Error(_0xbdcb('0x55'));if(_0x453dd3['role']===_0xbdcb('0x54')){var _0x40851c=_0x3e42e5[_0xbdcb('0x27')]({'plain':!![]});var _0x266ee4=[{'name':_0xbdcb('0x28'),'value':_0xbdcb('0x29')},{'name':_0xbdcb('0x2a'),'value':_0xbdcb('0x2b')}];var _0x444b27=_[_0xbdcb('0x31')](_0x266ee4,['value',_0x40851c[_0xbdcb('0x30')]])[_0xbdcb('0x32')];return db[_0xbdcb('0x57')][_0xbdcb('0x31')]({'where':{'name':_0x444b27,'userProfileId':_0x453dd3[_0xbdcb('0x5e')]},'raw':!![]})[_0xbdcb('0x25')](function(_0x2b2d3e){if(_0x2b2d3e&&_0x2b2d3e[_0xbdcb('0x58')]===0x0){return db[_0xbdcb('0x33')][_0xbdcb('0x52')]({'name':_0x40851c['name'],'resourceId':_0x40851c['id'],'type':_0x2b2d3e[_0xbdcb('0x32')],'sectionId':_0x2b2d3e['id']},{})['then'](function(){return _0x3e42e5;});}else{return _0x3e42e5;}})[_0xbdcb('0x51')](function(_0x28d481){logger[_0xbdcb('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28d481);throw _0x28d481;});}return _0x3e42e5;});}})[_0xbdcb('0x25')](respondWithResult(_0x2318a1,0xc9))[_0xbdcb('0x51')](handleError(_0x2318a1,null));};exports['update']=function(_0x19245f,_0x10162b){if(_0x19245f[_0xbdcb('0x53')]['id']){delete _0x19245f[_0xbdcb('0x53')]['id'];}return db[_0xbdcb('0x4f')][_0xbdcb('0x31')]({'where':{'id':_0x19245f[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x10162b,null))['then'](saveUpdates(_0x19245f[_0xbdcb('0x53')],null))[_0xbdcb('0x25')](respondWithResult(_0x10162b,null))['catch'](handleError(_0x10162b,null));};exports[_0xbdcb('0x26')]=function(_0x2ae2be,_0x18dacc){return db[_0xbdcb('0x4f')][_0xbdcb('0x31')]({'where':{'id':_0x2ae2be[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x18dacc,null))[_0xbdcb('0x25')](removeEntity(_0x18dacc,null))[_0xbdcb('0x51')](handleError(_0x18dacc,null));};exports[_0xbdcb('0x5f')]=function(_0x48c9e8,_0x108668,_0x168e5d){var _0x3230c0={'raw':![],'where':{}};var _0x176f6c={};var _0x53e7d6={'count':0x0,'rows':[]};return db[_0xbdcb('0x4f')][_0xbdcb('0x60')]({'where':{'id':_0x48c9e8['params']['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x108668,null))[_0xbdcb('0x25')](function(_0x1cdd7d){if(_0x1cdd7d){_0x176f6c['model']=_[_0xbdcb('0x3e')](db['CmHopper'][_0xbdcb('0x38')]);_0x176f6c['query']=_[_0xbdcb('0x3e')](_0x48c9e8[_0xbdcb('0x3d')]);_0x176f6c[_0xbdcb('0x3f')]=_['intersection'](_0x176f6c[_0xbdcb('0x3b')],_0x176f6c[_0xbdcb('0x3d')]);_0x3230c0[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x176f6c[_0xbdcb('0x3b')],qs[_0xbdcb('0x42')](_0x48c9e8[_0xbdcb('0x3d')][_0xbdcb('0x42')]));_0x3230c0[_0xbdcb('0x41')]=_0x3230c0[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x3230c0[_0xbdcb('0x41')]:_0x176f6c['model'];if(!_0x48c9e8[_0xbdcb('0x3d')]['hasOwnProperty'](_0xbdcb('0x45'))){_0x3230c0[_0xbdcb('0x22')]=qs['limit'](_0x48c9e8[_0xbdcb('0x3d')]['limit']);_0x3230c0['offset']=qs['offset'](_0x48c9e8[_0xbdcb('0x3d')][_0xbdcb('0x46')]);}_0x3230c0[_0xbdcb('0x47')]=qs[_0xbdcb('0x48')](_0x48c9e8['query'][_0xbdcb('0x48')]);_0x3230c0[_0xbdcb('0x49')]=qs[_0xbdcb('0x3f')](_[_0xbdcb('0x61')](_0x48c9e8['query'],_0x176f6c[_0xbdcb('0x3f')]));_0x3230c0['where']['VoiceQueueId']=_0x1cdd7d['id'];if(_0x48c9e8[_0xbdcb('0x3d')][_0xbdcb('0x2c')]){_0x3230c0[_0xbdcb('0x49')]=_[_0xbdcb('0x4a')](_0x3230c0['where'],{'$or':_[_0xbdcb('0x3c')](_0x3230c0[_0xbdcb('0x41')],function(_0x54e8b9){var _0x3bbde1={};_0x3bbde1[_0x54e8b9]={'$like':'%'+_0x48c9e8['query'][_0xbdcb('0x2c')]+'%'};return _0x3bbde1;})});}_0x3230c0=_['merge']({},_0x3230c0,_0x48c9e8[_0xbdcb('0x4c')]);return db[_0xbdcb('0x62')][_0xbdcb('0x21')]({'where':_0x3230c0[_0xbdcb('0x49')]})['then'](function(_0x27d6de){_0x53e7d6[_0xbdcb('0x21')]=_0x27d6de;if(_0x48c9e8[_0xbdcb('0x3d')][_0xbdcb('0x4d')]){_0x3230c0[_0xbdcb('0x4e')]=[{'all':!![]}];}return db[_0xbdcb('0x62')]['findAll'](_0x3230c0);})[_0xbdcb('0x25')](function(_0x11fdf4){_0x53e7d6['rows']=_0x11fdf4;return _0x53e7d6;});}})['then'](respondWithFilteredResult(_0x108668,_0x3230c0))['catch'](handleError(_0x108668,null));};exports[_0xbdcb('0x63')]=function(_0x36e3e3,_0x539349,_0x2b2026){var _0x2fd89a={'raw':!![],'where':{}};var _0x5c57f4={};var _0x1d325b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xbdcb('0x60')]({'where':{'id':_0x36e3e3['params']['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x539349,null))[_0xbdcb('0x25')](function(_0x3d349d){if(_0x3d349d){_0x5c57f4[_0xbdcb('0x3b')]=_[_0xbdcb('0x3e')](db[_0xbdcb('0x64')][_0xbdcb('0x38')]);_0x5c57f4[_0xbdcb('0x3d')]=_['keys'](_0x36e3e3[_0xbdcb('0x3d')]);_0x5c57f4[_0xbdcb('0x3f')]=_[_0xbdcb('0x40')](_0x5c57f4['model'],_0x5c57f4[_0xbdcb('0x3d')]);_0x2fd89a[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x5c57f4['model'],qs[_0xbdcb('0x42')](_0x36e3e3[_0xbdcb('0x3d')][_0xbdcb('0x42')]));_0x2fd89a[_0xbdcb('0x41')]=_0x2fd89a['attributes'][_0xbdcb('0x43')]?_0x2fd89a[_0xbdcb('0x41')]:_0x5c57f4[_0xbdcb('0x3b')];if(!_0x36e3e3[_0xbdcb('0x3d')]['hasOwnProperty'](_0xbdcb('0x45'))){_0x2fd89a[_0xbdcb('0x22')]=qs[_0xbdcb('0x22')](_0x36e3e3[_0xbdcb('0x3d')][_0xbdcb('0x22')]);_0x2fd89a[_0xbdcb('0x46')]=qs['offset'](_0x36e3e3['query']['offset']);}_0x2fd89a['order']=qs[_0xbdcb('0x48')](_0x36e3e3[_0xbdcb('0x3d')]['sort']);_0x2fd89a[_0xbdcb('0x49')]=qs[_0xbdcb('0x3f')](_['pick'](_0x36e3e3[_0xbdcb('0x3d')],_0x5c57f4[_0xbdcb('0x3f')]));_0x2fd89a[_0xbdcb('0x49')][_0xbdcb('0x65')]=_0x3d349d['id'];if(_0x36e3e3[_0xbdcb('0x3d')]['filter']){_0x2fd89a['where']=_[_0xbdcb('0x4a')](_0x2fd89a['where'],{'$or':_[_0xbdcb('0x3c')](_0x2fd89a[_0xbdcb('0x41')],function(_0xbba0de){var _0x4ff307={};_0x4ff307[_0xbba0de]={'$like':'%'+_0x36e3e3[_0xbdcb('0x3d')][_0xbdcb('0x2c')]+'%'};return _0x4ff307;})});}_0x2fd89a=_[_0xbdcb('0x4a')]({},_0x2fd89a,_0x36e3e3[_0xbdcb('0x4c')]);return db['CmHopperHistory'][_0xbdcb('0x21')]({'where':_0x2fd89a['where']})[_0xbdcb('0x25')](function(_0x302692){_0x1d325b[_0xbdcb('0x21')]=_0x302692;if(_0x36e3e3[_0xbdcb('0x3d')][_0xbdcb('0x4d')]){_0x2fd89a[_0xbdcb('0x4e')]=[{'all':!![]}];}return db[_0xbdcb('0x64')]['findAll'](_0x2fd89a);})[_0xbdcb('0x25')](function(_0x51dc32){_0x1d325b['rows']=_0x51dc32;return _0x1d325b;});}})[_0xbdcb('0x25')](respondWithFilteredResult(_0x539349,_0x2fd89a))[_0xbdcb('0x51')](handleError(_0x539349,null));};exports['getHopperFinals']=function(_0x51e6ed,_0x2e5e59,_0x334f4f){var _0x189ad0={'raw':!![],'where':{}};var _0x5dbbd6={};var _0x11067e={'count':0x0,'rows':[]};return db[_0xbdcb('0x4f')][_0xbdcb('0x60')]({'where':{'id':_0x51e6ed[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x2e5e59,null))['then'](function(_0x78e77b){if(_0x78e77b){_0x5dbbd6[_0xbdcb('0x3b')]=_['keys'](db[_0xbdcb('0x66')][_0xbdcb('0x38')]);_0x5dbbd6[_0xbdcb('0x3d')]=_[_0xbdcb('0x3e')](_0x51e6ed[_0xbdcb('0x3d')]);_0x5dbbd6[_0xbdcb('0x3f')]=_[_0xbdcb('0x40')](_0x5dbbd6[_0xbdcb('0x3b')],_0x5dbbd6[_0xbdcb('0x3d')]);_0x189ad0[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x5dbbd6[_0xbdcb('0x3b')],qs[_0xbdcb('0x42')](_0x51e6ed['query'][_0xbdcb('0x42')]));_0x189ad0[_0xbdcb('0x41')]=_0x189ad0[_0xbdcb('0x41')]['length']?_0x189ad0[_0xbdcb('0x41')]:_0x5dbbd6[_0xbdcb('0x3b')];if(!_0x51e6ed[_0xbdcb('0x3d')][_0xbdcb('0x44')]('nolimit')){_0x189ad0[_0xbdcb('0x22')]=qs[_0xbdcb('0x22')](_0x51e6ed[_0xbdcb('0x3d')]['limit']);_0x189ad0[_0xbdcb('0x46')]=qs[_0xbdcb('0x46')](_0x51e6ed[_0xbdcb('0x3d')][_0xbdcb('0x46')]);}_0x189ad0[_0xbdcb('0x47')]=qs['sort'](_0x51e6ed[_0xbdcb('0x3d')][_0xbdcb('0x48')]);_0x189ad0[_0xbdcb('0x49')]=qs[_0xbdcb('0x3f')](_[_0xbdcb('0x61')](_0x51e6ed[_0xbdcb('0x3d')],_0x5dbbd6[_0xbdcb('0x3f')]));_0x189ad0[_0xbdcb('0x49')]['VoiceQueueId']=_0x78e77b['id'];if(_0x51e6ed[_0xbdcb('0x3d')][_0xbdcb('0x2c')]){_0x189ad0['where']=_[_0xbdcb('0x4a')](_0x189ad0[_0xbdcb('0x49')],{'$or':_['map'](_0x189ad0[_0xbdcb('0x41')],function(_0x743b25){var _0x49a673={};_0x49a673[_0x743b25]={'$like':'%'+_0x51e6ed[_0xbdcb('0x3d')]['filter']+'%'};return _0x49a673;})});}_0x189ad0=_['merge']({},_0x189ad0,_0x51e6ed[_0xbdcb('0x4c')]);return db[_0xbdcb('0x66')][_0xbdcb('0x21')]({'where':_0x189ad0[_0xbdcb('0x49')]})[_0xbdcb('0x25')](function(_0x80d068){_0x11067e[_0xbdcb('0x21')]=_0x80d068;if(_0x51e6ed[_0xbdcb('0x3d')]['includeAll']){_0x189ad0['include']=[{'all':!![]}];}return db[_0xbdcb('0x66')][_0xbdcb('0x50')](_0x189ad0);})[_0xbdcb('0x25')](function(_0x2d50d0){_0x11067e[_0xbdcb('0x67')]=_0x2d50d0;return _0x11067e;});}})[_0xbdcb('0x25')](respondWithFilteredResult(_0x2e5e59,_0x189ad0))[_0xbdcb('0x51')](handleError(_0x2e5e59,null));};exports[_0xbdcb('0x68')]=function(_0x5d0e43,_0x488dc9,_0x47b1ed){var _0x4afd9d={'raw':!![],'where':{}};var _0x4a2ab6={};var _0x2bae36={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xbdcb('0x60')]({'where':{'id':_0x5d0e43['params']['id']}})['then'](handleEntityNotFound(_0x488dc9,null))[_0xbdcb('0x25')](function(_0x3df811){if(_0x3df811){_0x4a2ab6[_0xbdcb('0x3b')]=_[_0xbdcb('0x3e')](db['CmHopperBlack'][_0xbdcb('0x38')]);_0x4a2ab6[_0xbdcb('0x3d')]=_[_0xbdcb('0x3e')](_0x5d0e43[_0xbdcb('0x3d')]);_0x4a2ab6[_0xbdcb('0x3f')]=_[_0xbdcb('0x40')](_0x4a2ab6[_0xbdcb('0x3b')],_0x4a2ab6[_0xbdcb('0x3d')]);_0x4afd9d[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x4a2ab6[_0xbdcb('0x3b')],qs[_0xbdcb('0x42')](_0x5d0e43['query'][_0xbdcb('0x42')]));_0x4afd9d[_0xbdcb('0x41')]=_0x4afd9d[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x4afd9d[_0xbdcb('0x41')]:_0x4a2ab6[_0xbdcb('0x3b')];if(!_0x5d0e43[_0xbdcb('0x3d')]['hasOwnProperty']('nolimit')){_0x4afd9d[_0xbdcb('0x22')]=qs[_0xbdcb('0x22')](_0x5d0e43[_0xbdcb('0x3d')][_0xbdcb('0x22')]);_0x4afd9d[_0xbdcb('0x46')]=qs[_0xbdcb('0x46')](_0x5d0e43[_0xbdcb('0x3d')][_0xbdcb('0x46')]);}_0x4afd9d[_0xbdcb('0x47')]=qs['sort'](_0x5d0e43[_0xbdcb('0x3d')][_0xbdcb('0x48')]);_0x4afd9d['where']=qs[_0xbdcb('0x3f')](_[_0xbdcb('0x61')](_0x5d0e43[_0xbdcb('0x3d')],_0x4a2ab6[_0xbdcb('0x3f')]));_0x4afd9d['where'][_0xbdcb('0x65')]=_0x3df811['id'];if(_0x5d0e43[_0xbdcb('0x3d')]['filter']){_0x4afd9d[_0xbdcb('0x49')]=_['merge'](_0x4afd9d[_0xbdcb('0x49')],{'$or':_[_0xbdcb('0x3c')](_0x4afd9d[_0xbdcb('0x41')],function(_0x4215e6){var _0x4c96c6={};_0x4c96c6[_0x4215e6]={'$like':'%'+_0x5d0e43['query'][_0xbdcb('0x2c')]+'%'};return _0x4c96c6;})});}_0x4afd9d=_['merge']({},_0x4afd9d,_0x5d0e43[_0xbdcb('0x4c')]);return db[_0xbdcb('0x69')][_0xbdcb('0x21')]({'where':_0x4afd9d[_0xbdcb('0x49')]})[_0xbdcb('0x25')](function(_0x11ac82){_0x2bae36[_0xbdcb('0x21')]=_0x11ac82;if(_0x5d0e43['query'][_0xbdcb('0x4d')]){_0x4afd9d[_0xbdcb('0x4e')]=[{'all':!![]}];}return db[_0xbdcb('0x69')][_0xbdcb('0x50')](_0x4afd9d);})['then'](function(_0x2f5b98){_0x2bae36[_0xbdcb('0x67')]=_0x2f5b98;return _0x2bae36;});}})[_0xbdcb('0x25')](respondWithFilteredResult(_0x488dc9,_0x4afd9d))[_0xbdcb('0x51')](handleError(_0x488dc9,null));};exports[_0xbdcb('0x6a')]=function(_0x18d965,_0x5e8741,_0x20e4d7){var _0x48a032={};var _0x3eef30={};var _0x572d57;var _0x52f539;return db[_0xbdcb('0x4f')][_0xbdcb('0x60')]({'where':{'id':_0x18d965[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x5e8741,null))['then'](function(_0x3e0e02){if(_0x3e0e02){_0x572d57=_0x3e0e02;_0x3eef30[_0xbdcb('0x3b')]=_[_0xbdcb('0x3e')](db['Team']['rawAttributes']);_0x3eef30[_0xbdcb('0x3d')]=_['keys'](_0x18d965[_0xbdcb('0x3d')]);_0x3eef30[_0xbdcb('0x3f')]=_[_0xbdcb('0x40')](_0x3eef30[_0xbdcb('0x3b')],_0x3eef30[_0xbdcb('0x3d')]);_0x48a032[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x3eef30['model'],qs[_0xbdcb('0x42')](_0x18d965[_0xbdcb('0x3d')]['fields']));_0x48a032[_0xbdcb('0x41')]=_0x48a032['attributes'][_0xbdcb('0x43')]?_0x48a032[_0xbdcb('0x41')]:_0x3eef30['model'];_0x48a032[_0xbdcb('0x47')]=qs[_0xbdcb('0x48')](_0x18d965['query'][_0xbdcb('0x48')]);_0x48a032['where']=qs['filters'](_['pick'](_0x18d965[_0xbdcb('0x3d')],_0x3eef30[_0xbdcb('0x3f')]));if(_0x18d965['query'][_0xbdcb('0x2c')]){_0x48a032[_0xbdcb('0x49')]=_['merge'](_0x48a032[_0xbdcb('0x49')],{'$or':_[_0xbdcb('0x3c')](_0x48a032[_0xbdcb('0x41')],function(_0x5aeae3){var _0x1837e3={};_0x1837e3[_0x5aeae3]={'$like':'%'+_0x18d965[_0xbdcb('0x3d')]['filter']+'%'};return _0x1837e3;})});}_0x48a032=_['merge']({},_0x48a032,_0x18d965[_0xbdcb('0x4c')]);return _0x572d57[_0xbdcb('0x6a')](_0x48a032);}})[_0xbdcb('0x25')](function(_0x782657){if(_0x782657){_0x52f539=_0x782657[_0xbdcb('0x43')];if(!_0x18d965[_0xbdcb('0x3d')][_0xbdcb('0x44')](_0xbdcb('0x45'))){_0x48a032['limit']=qs[_0xbdcb('0x22')](_0x18d965['query']['limit']);_0x48a032[_0xbdcb('0x46')]=qs['offset'](_0x18d965[_0xbdcb('0x3d')][_0xbdcb('0x46')]);}return _0x572d57[_0xbdcb('0x6a')](_0x48a032);}})[_0xbdcb('0x25')](function(_0x191f14){if(_0x191f14){return _0x191f14?{'count':_0x52f539,'rows':_0x191f14}:null;}})['then'](respondWithResult(_0x5e8741,null))[_0xbdcb('0x51')](handleError(_0x5e8741,null));};exports[_0xbdcb('0x6b')]=function(_0x54b93d,_0x5a7480,_0x104c65){var _0x322349=_0x54b93d[_0xbdcb('0x53')]['teams'];var _0x2caffe=_['map'](_0x322349,'id');return db[_0xbdcb('0x6c')]['findAll']({'where':{'id':_0x2caffe},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbdcb('0x6d'),'attributes':['id',_0xbdcb('0x32'),_0xbdcb('0x6e'),_0xbdcb('0x6f'),_0xbdcb('0x70')],'raw':!![]}]})[_0xbdcb('0x25')](function(_0x2d5f2a){if(_0x2d5f2a){var _0x14e424=_[_0xbdcb('0x71')](_0x2d5f2a,function(_0xee536b){var _0x202d9e=_0xee536b['get']({'plain':!![]});_0x202d9e[_0xbdcb('0x6d')][_0xbdcb('0x72')](function(_0xf16c8e){_0xf16c8e['penalty']=_['find'](_0x322349,{'id':_0x202d9e['id']})[_0xbdcb('0x73')];});return _0x202d9e['Agents'];});return db[_0xbdcb('0x4f')][_0xbdcb('0x31')]({'where':{'id':_0x54b93d[_0xbdcb('0x5b')]['id']}})['then'](function(_0x5edbd1){return db[_0xbdcb('0x74')][_0xbdcb('0x75')](function(_0x5a4939){return _0x5edbd1['addTeams'](_0x2caffe,{'transaction':_0x5a4939})[_0xbdcb('0x25')](function(){return BPromise[_0xbdcb('0x76')](_0x322349,function(_0x40d7eb){return db['TeamVoiceQueue'][_0xbdcb('0x77')]({'TeamId':_0x40d7eb['id'],'VoiceQueueId':_0x54b93d[_0xbdcb('0x5b')]['id'],'penalty':_0x40d7eb['penalty']},{'transaction':_0x5a4939});});})[_0xbdcb('0x25')](function(){return BPromise[_0xbdcb('0x76')](_0x14e424,function(_0x1e086b){return db[_0xbdcb('0x78')][_0xbdcb('0x79')]({'where':{'UserId':_0x1e086b['id'],'VoiceQueueId':_0x54b93d[_0xbdcb('0x5b')]['id']},'defaults':{'penalty':_0x1e086b[_0xbdcb('0x73')]},'transaction':_0x5a4939});});})['then'](function(){return BPromise['each'](_['filter'](_0x14e424,{'online':!![]}),function(_0x266206){return db[_0xbdcb('0x7a')]['upsert']({'membername':_0x266206['name'],'UserId':_0x266206['id'],'queue_name':_0x5edbd1[_0xbdcb('0x32')],'VoiceQueueId':_0x5edbd1['id'],'interface':_['isNil'](_0x266206[_0xbdcb('0x70')])?util[_0xbdcb('0x7b')](_0xbdcb('0x7c'),_0x266206[_0xbdcb('0x32')]):_0x266206[_0xbdcb('0x70')],'paused':_0x266206['voicePause']||![],'penalty':_0x266206['penalty']},{'transaction':_0x5a4939});});})[_0xbdcb('0x25')](function(){_0x14e424['forEach'](function(_0x2ecd13){socket[_0xbdcb('0x7d')](_0xbdcb('0x7e'),{'UserId':_0x2ecd13['id'],'VoiceQueueId':_0x5edbd1['id']});});});});});}})[_0xbdcb('0x25')](respondWithStatusCode(_0x5a7480,null))[_0xbdcb('0x51')](handleError(_0x5a7480,null));};exports[_0xbdcb('0x7f')]=function(_0x113e3f,_0x21ac10,_0x40e26e){return db['Team'][_0xbdcb('0x50')]({'where':{'id':_0x113e3f['query'][_0xbdcb('0x80')]},'attributes':['id'],'include':[{'model':db[_0xbdcb('0x81')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbdcb('0x25')](handleEntityNotFound(_0x21ac10,null))['then'](function(_0x50dee2){var _0x445e70=_[_0xbdcb('0x3c')](_0x50dee2,'id');var _0x515bd8=[];var _0x4c4e44=[];var _0x45a55f=squel[_0xbdcb('0x82')]();_0x45a55f[_0xbdcb('0x83')](_0xbdcb('0x84'))[_0xbdcb('0x85')](_0xbdcb('0x86'),'tq')['join']('user_has_teams','ut',_0xbdcb('0x87'))[_0xbdcb('0x49')](_0xbdcb('0x88'),_0x113e3f[_0xbdcb('0x5b')]['id']);for(var _0x783d64=0x0;_0x783d64<_0x50dee2[_0xbdcb('0x43')];_0x783d64+=0x1){let _0x3a43eb=_0x50dee2[_0x783d64];for(var _0x745bfb=0x0;_0x745bfb<_0x3a43eb[_0xbdcb('0x6d')][_0xbdcb('0x43')];_0x745bfb+=0x1){let _0x1c198d=_0x3a43eb['Agents'][_0x745bfb];var _0x4fc44c=_0x45a55f[_0xbdcb('0x5a')]();_0x4fc44c[_0xbdcb('0x49')](_0xbdcb('0x89'),_0x1c198d['id']);_0x4c4e44[_0xbdcb('0x8a')](db[_0xbdcb('0x74')][_0xbdcb('0x3d')](_0x4fc44c[_0xbdcb('0x8b')](),{'type':db[_0xbdcb('0x74')]['QueryTypes']['SELECT']})[_0xbdcb('0x25')](function(_0x562afa){if(_0x562afa[_0xbdcb('0x43')]===0x1){return _0x1c198d['id'];}else{var _0x5aa715=_[_0xbdcb('0x8c')](_[_0xbdcb('0x3c')](_0x562afa,_0xbdcb('0x8d')),function(_0x4e3ef6){return _[_0xbdcb('0x2f')](_0x445e70,_0x4e3ef6);});if(_0x5aa715){return _0x1c198d['id'];}}}));}}return BPromise[_0xbdcb('0x8e')](_0x4c4e44)[_0xbdcb('0x25')](function(_0x788bad){_0x515bd8=_(_0x515bd8)['union'](_0x788bad)['compact']()[_0xbdcb('0x2e')]();return db['VoiceQueue'][_0xbdcb('0x31')]({'where':{'id':_0x113e3f[_0xbdcb('0x5b')]['id']}})['then'](function(_0x13d316){return db['sequelize'][_0xbdcb('0x75')](function(_0x2b6e87){return _0x13d316[_0xbdcb('0x7f')](_0x113e3f['query'][_0xbdcb('0x80')],{'transaction':_0x2b6e87})[_0xbdcb('0x25')](function(){if(!_['isEmpty'](_0x515bd8)){return _0x13d316[_0xbdcb('0x8f')](_0x515bd8,{'transaction':_0x2b6e87})['then'](function(){return db[_0xbdcb('0x7a')][_0xbdcb('0x26')]({'where':{'VoiceQueueId':_0x113e3f[_0xbdcb('0x5b')]['id'],'UserId':_0x515bd8},'transaction':_0x2b6e87});});}})['then'](function(){_0x515bd8[_0xbdcb('0x72')](function(_0x15d8a7){socket[_0xbdcb('0x7d')](_0xbdcb('0x90'),{'UserId':_0x15d8a7,'VoiceQueueId':_0x13d316['id']});});});});});});})[_0xbdcb('0x25')](respondWithStatusCode(_0x21ac10,null))[_0xbdcb('0x51')](handleError(_0x21ac10,null));};exports[_0xbdcb('0x91')]=function(_0x39310f,_0x25055e,_0x4a3f1d){var _0x3e6efb,_0x30631e;return db[_0xbdcb('0x4f')]['find']({'where':{'id':_0x39310f[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x25055e,null))[_0xbdcb('0x25')](function(_0x337717){if(_0x337717){_0x30631e=_0x337717;return _0x337717[_0xbdcb('0x91')](_0x39310f[_0xbdcb('0x53')][_0xbdcb('0x80')],_[_0xbdcb('0x92')](_0x39310f[_0xbdcb('0x53')],[_0xbdcb('0x80'),'id'])||{})[_0xbdcb('0x93')](function(_0x4f6983){for(var _0x4045a2=0x0;_0x4045a2<_0x39310f[_0xbdcb('0x53')][_0xbdcb('0x80')][_0xbdcb('0x43')];_0x4045a2+=0x1){socket[_0xbdcb('0x7d')](_0xbdcb('0x7e'),{'UserId':_0x39310f[_0xbdcb('0x53')]['ids'][_0x4045a2],'VoiceQueueId':_0x39310f[_0xbdcb('0x5b')]['id']});}return _0x4f6983;});}})[_0xbdcb('0x25')](function(_0x13cc3c){_0x3e6efb=_0x13cc3c||[];if(_0x30631e){return db[_0xbdcb('0x81')][_0xbdcb('0x50')]({'where':{'id':_0x39310f[_0xbdcb('0x53')][_0xbdcb('0x80')]},'attributes':['id',_0xbdcb('0x32'),_0xbdcb('0x6e'),_0xbdcb('0x6f'),_0xbdcb('0x70')],'raw':!![]});}})[_0xbdcb('0x25')](function(_0x11fb19){if(!_['isEmpty'](_0x11fb19)){var _0x502d2a=[];for(var _0x5a548d=0x0;_0x5a548d<_0x11fb19[_0xbdcb('0x43')];_0x5a548d++){if(_0x11fb19[_0x5a548d][_0xbdcb('0x6e')]){_0x502d2a[_0xbdcb('0x8a')](db[_0xbdcb('0x7a')][_0xbdcb('0x77')]({'membername':_0x11fb19[_0x5a548d][_0xbdcb('0x32')],'UserId':_0x11fb19[_0x5a548d]['id'],'queue_name':_0x30631e[_0xbdcb('0x32')],'VoiceQueueId':_0x30631e['id'],'interface':_[_0xbdcb('0x94')](_0x11fb19[_0x5a548d]['interface'])?util['format']('SIP/%s',_0x11fb19[_0x5a548d]['name']):_0x11fb19[_0x5a548d][_0xbdcb('0x70')],'paused':_0x11fb19[_0x5a548d]['voicePause']||![],'penalty':_0x39310f[_0xbdcb('0x53')][_0xbdcb('0x73')]||0x0}));}}return BPromise[_0xbdcb('0x8e')](_0x502d2a);}})[_0xbdcb('0x25')](function(){return _0x3e6efb;})[_0xbdcb('0x25')](respondWithResult(_0x25055e,null))['catch'](handleError(_0x25055e,null));};exports[_0xbdcb('0x8f')]=function(_0xf38e2d,_0x13eb7f,_0x19e0ff){return db[_0xbdcb('0x4f')]['find']({'where':{'id':_0xf38e2d[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x13eb7f,null))[_0xbdcb('0x25')](function(_0x47d8ef){if(_0x47d8ef){return _0x47d8ef['removeAgents'](_0xf38e2d[_0xbdcb('0x3d')]['ids'])[_0xbdcb('0x25')](function(){if(_[_0xbdcb('0x95')](_0xf38e2d['query'][_0xbdcb('0x80')])){for(var _0xcf4dde=0x0;_0xcf4dde<_0xf38e2d[_0xbdcb('0x3d')][_0xbdcb('0x80')]['length'];_0xcf4dde+=0x1){socket[_0xbdcb('0x7d')](_0xbdcb('0x90'),{'UserId':Number(_0xf38e2d[_0xbdcb('0x3d')]['ids'][_0xcf4dde]),'VoiceQueueId':Number(_0xf38e2d[_0xbdcb('0x5b')]['id'])});}}else{socket[_0xbdcb('0x7d')](_0xbdcb('0x90'),{'UserId':Number(_0xf38e2d['query'][_0xbdcb('0x80')]),'VoiceQueueId':Number(_0xf38e2d[_0xbdcb('0x5b')]['id'])});}});}})[_0xbdcb('0x25')](function(_0x237388){return db[_0xbdcb('0x7a')][_0xbdcb('0x26')]({'where':{'VoiceQueueId':_0xf38e2d[_0xbdcb('0x5b')]['id'],'UserId':_0xf38e2d[_0xbdcb('0x3d')]['ids']}})[_0xbdcb('0x25')](function(){return _0x237388;});})[_0xbdcb('0x25')](respondWithStatusCode(_0x13eb7f,null))[_0xbdcb('0x51')](handleError(_0x13eb7f,null));};exports[_0xbdcb('0x96')]=function(_0x5764fd,_0x411072,_0x1e2731){var _0x3ff1d3={};var _0x786a95={};var _0x4da097;var _0x7ca4fc;return db[_0xbdcb('0x4f')][_0xbdcb('0x60')]({'where':{'id':_0x5764fd['params']['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x411072,null))['then'](function(_0x1fe7e8){if(_0x1fe7e8){_0x4da097=_0x1fe7e8;_0x786a95['model']=_[_0xbdcb('0x3e')](db[_0xbdcb('0x81')][_0xbdcb('0x38')]);_0x786a95['query']=_['keys'](_0x5764fd[_0xbdcb('0x3d')]);_0x786a95[_0xbdcb('0x3f')]=_[_0xbdcb('0x40')](_0x786a95['model'],_0x786a95[_0xbdcb('0x3d')]);_0x3ff1d3[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x786a95[_0xbdcb('0x3b')],qs['fields'](_0x5764fd[_0xbdcb('0x3d')][_0xbdcb('0x42')]));_0x3ff1d3['attributes']=_0x3ff1d3[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x3ff1d3[_0xbdcb('0x41')]:_0x786a95['model'];_0x3ff1d3['order']=qs['sort'](_0x5764fd[_0xbdcb('0x3d')][_0xbdcb('0x48')]);_0x3ff1d3[_0xbdcb('0x49')]=qs['filters'](_[_0xbdcb('0x61')](_0x5764fd[_0xbdcb('0x3d')],_0x786a95[_0xbdcb('0x3f')]));if(_0x5764fd[_0xbdcb('0x3d')][_0xbdcb('0x2c')]){_0x3ff1d3[_0xbdcb('0x49')]=_['merge'](_0x3ff1d3[_0xbdcb('0x49')],{'$or':_['map'](_0x3ff1d3['attributes'],function(_0x4ee18d){var _0x42db2e={};_0x42db2e[_0x4ee18d]={'$like':'%'+_0x5764fd[_0xbdcb('0x3d')][_0xbdcb('0x2c')]+'%'};return _0x42db2e;})});}_0x3ff1d3=_[_0xbdcb('0x4a')]({},_0x3ff1d3,_0x5764fd[_0xbdcb('0x4c')]);return _0x4da097[_0xbdcb('0x96')](_0x3ff1d3);}})[_0xbdcb('0x25')](function(_0x3701e6){if(_0x3701e6){_0x7ca4fc=_0x3701e6[_0xbdcb('0x43')];if(!_0x5764fd[_0xbdcb('0x3d')][_0xbdcb('0x44')]('nolimit')){_0x3ff1d3['limit']=qs[_0xbdcb('0x22')](_0x5764fd['query'][_0xbdcb('0x22')]);_0x3ff1d3['offset']=qs[_0xbdcb('0x46')](_0x5764fd['query'][_0xbdcb('0x46')]);}return _0x4da097['getAgents'](_0x3ff1d3);}})[_0xbdcb('0x25')](function(_0x474b8b){if(_0x474b8b){return _0x474b8b?{'count':_0x7ca4fc,'rows':_0x474b8b}:null;}})[_0xbdcb('0x25')](respondWithResult(_0x411072,null))['catch'](handleError(_0x411072,null));};exports[_0xbdcb('0x97')]=function(_0x30b8cf,_0x583e22,_0x21c855){var _0x2e8ede={};var _0x25d5fe={};var _0x4010b1;var _0x2666f6;return db['VoiceQueue']['findOne']({'where':{'id':_0x30b8cf[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x583e22,null))[_0xbdcb('0x25')](function(_0x2c7866){if(_0x2c7866){_0x4010b1=_0x2c7866;_0x25d5fe[_0xbdcb('0x3b')]=_[_0xbdcb('0x3e')](db['UserVoiceQueueRt']['rawAttributes']);_0x25d5fe[_0xbdcb('0x3d')]=_[_0xbdcb('0x3e')](_0x30b8cf[_0xbdcb('0x3d')]);_0x25d5fe['filters']=_[_0xbdcb('0x40')](_0x25d5fe[_0xbdcb('0x3b')],_0x25d5fe[_0xbdcb('0x3d')]);_0x2e8ede[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x25d5fe[_0xbdcb('0x3b')],qs['fields'](_0x30b8cf['query']['fields']));_0x2e8ede[_0xbdcb('0x41')]=_0x2e8ede[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x2e8ede['attributes']:_0x25d5fe[_0xbdcb('0x3b')];_0x2e8ede['order']=qs[_0xbdcb('0x48')](_0x30b8cf['query'][_0xbdcb('0x48')]);_0x2e8ede[_0xbdcb('0x49')]=qs[_0xbdcb('0x3f')](_[_0xbdcb('0x61')](_0x30b8cf[_0xbdcb('0x3d')],_0x25d5fe[_0xbdcb('0x3f')]));if(_0x30b8cf['query'][_0xbdcb('0x2c')]){_0x2e8ede['where']=_[_0xbdcb('0x4a')](_0x2e8ede[_0xbdcb('0x49')],{'$or':_[_0xbdcb('0x3c')](_0x2e8ede['attributes'],function(_0x20b72f){var _0x54381a={};_0x54381a[_0x20b72f]={'$like':'%'+_0x30b8cf['query'][_0xbdcb('0x2c')]+'%'};return _0x54381a;})});}_0x2e8ede=_['merge']({},_0x2e8ede,_0x30b8cf['options']);return _0x4010b1['getMembers'](_0x2e8ede);}})[_0xbdcb('0x25')](function(_0x17639e){if(_0x17639e){_0x2666f6=_0x17639e['length'];if(!_0x30b8cf['query'][_0xbdcb('0x44')](_0xbdcb('0x45'))){_0x2e8ede['limit']=qs[_0xbdcb('0x22')](_0x30b8cf['query'][_0xbdcb('0x22')]);_0x2e8ede[_0xbdcb('0x46')]=qs[_0xbdcb('0x46')](_0x30b8cf[_0xbdcb('0x3d')][_0xbdcb('0x46')]);}return _0x4010b1[_0xbdcb('0x97')](_0x2e8ede);}})['then'](function(_0x3bfe4c){return _0x3bfe4c?{'count':_0x2666f6,'rows':_0x3bfe4c}:null;})[_0xbdcb('0x25')](respondWithResult(_0x583e22,null))[_0xbdcb('0x51')](handleError(_0x583e22,null));};exports[_0xbdcb('0x98')]=function(_0x2ca606,_0x253fbc,_0x254119){var _0x3a42f7={};var _0xb285c9={};var _0x240e44;var _0x959c4a;return db[_0xbdcb('0x4f')][_0xbdcb('0x60')]({'where':{'id':_0x2ca606[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x253fbc,null))[_0xbdcb('0x25')](function(_0x1b6631){if(_0x1b6631){_0x240e44=_0x1b6631;_0xb285c9[_0xbdcb('0x3b')]=_[_0xbdcb('0x3e')](db[_0xbdcb('0x99')][_0xbdcb('0x38')]);_0xb285c9[_0xbdcb('0x3d')]=_[_0xbdcb('0x3e')](_0x2ca606[_0xbdcb('0x3d')]);_0xb285c9[_0xbdcb('0x3f')]=_['intersection'](_0xb285c9['model'],_0xb285c9[_0xbdcb('0x3d')]);_0x3a42f7[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0xb285c9[_0xbdcb('0x3b')],qs[_0xbdcb('0x42')](_0x2ca606['query'][_0xbdcb('0x42')]));_0x3a42f7[_0xbdcb('0x41')]=_0x3a42f7[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x3a42f7[_0xbdcb('0x41')]:_0xb285c9[_0xbdcb('0x3b')];_0x3a42f7[_0xbdcb('0x47')]=qs[_0xbdcb('0x48')](_0x2ca606[_0xbdcb('0x3d')][_0xbdcb('0x48')]);_0x3a42f7[_0xbdcb('0x49')]=qs[_0xbdcb('0x3f')](_[_0xbdcb('0x61')](_0x2ca606[_0xbdcb('0x3d')],_0xb285c9[_0xbdcb('0x3f')]));if(_0x2ca606[_0xbdcb('0x3d')]['filter']){_0x3a42f7['where']=_[_0xbdcb('0x4a')](_0x3a42f7[_0xbdcb('0x49')],{'$or':_[_0xbdcb('0x3c')](_0x3a42f7[_0xbdcb('0x41')],function(_0x3669ab){var _0x1dd91f={};_0x1dd91f[_0x3669ab]={'$like':'%'+_0x2ca606['query'][_0xbdcb('0x2c')]+'%'};return _0x1dd91f;})});}_0x3a42f7=_[_0xbdcb('0x4a')]({},_0x3a42f7,_0x2ca606['options']);return _0x240e44[_0xbdcb('0x98')](_0x3a42f7);}})[_0xbdcb('0x25')](function(_0x266d87){if(_0x266d87){_0x959c4a=_0x266d87['length'];if(!_0x2ca606['query'][_0xbdcb('0x44')](_0xbdcb('0x45'))){_0x3a42f7['limit']=qs[_0xbdcb('0x22')](_0x2ca606[_0xbdcb('0x3d')]['limit']);_0x3a42f7['offset']=qs[_0xbdcb('0x46')](_0x2ca606[_0xbdcb('0x3d')]['offset']);}return _0x240e44[_0xbdcb('0x98')](_0x3a42f7);}})['then'](function(_0x5344e1){if(_0x5344e1){return _0x5344e1?{'count':_0x959c4a,'rows':_0x5344e1}:null;}})[_0xbdcb('0x25')](respondWithResult(_0x253fbc,null))[_0xbdcb('0x51')](handleError(_0x253fbc,null));};exports['addLists']=function(_0x284958,_0x305a37,_0x4178f4){var _0x30bef5,_0x5b373c;return db['VoiceQueue'][_0xbdcb('0x31')]({'where':{'id':_0x284958['params']['id']}})['then'](handleEntityNotFound(_0x305a37,null))['then'](function(_0x38750f){if(_0x38750f){_0x5b373c=_0x38750f;return _0x38750f[_0xbdcb('0x9a')](_0x284958[_0xbdcb('0x53')][_0xbdcb('0x80')],_[_0xbdcb('0x92')](_0x284958[_0xbdcb('0x53')],['ids','id'])||{});}return null;})[_0xbdcb('0x93')](function(_0x24ff41){var _0x18896d;_0x30bef5=_0x24ff41||[];var _0xff2d3f=[];if(_0x24ff41){for(var _0x1e8e0c=0x0;_0x1e8e0c<_0x24ff41[_0xbdcb('0x43')];_0x1e8e0c+=0x1){var _0xda1356=_0x24ff41[_0x1e8e0c][_0xbdcb('0x27')]({'plain':!![]});_0x5b373c['dialCheckDuplicateType']=_0x284958[_0xbdcb('0x53')][_0xbdcb('0x9b')]?_0x284958['body'][_0xbdcb('0x9b')]:_0x5b373c[_0xbdcb('0x9b')];switch(_0x5b373c[_0xbdcb('0x9b')]){case _0xbdcb('0x9c'):_0x18896d=squel[_0xbdcb('0x9d')]()['into'](_0xbdcb('0x9e'))[_0xbdcb('0x9f')]([_0xbdcb('0xa0'),_0xbdcb('0xa1'),'ContactId','ListId',_0xbdcb('0x65'),_0xbdcb('0x5c'),_0xbdcb('0x5d')],squel['select']()[_0xbdcb('0x83')](_0xbdcb('0xa0'),_0xbdcb('0xa0'))['field'](_0xbdcb('0xa2'),_0xbdcb('0xa1'))[_0xbdcb('0x83')]('id',_0xbdcb('0xa3'))[_0xbdcb('0x83')](_0xda1356['CmListId'][_0xbdcb('0x8b')](),_0xbdcb('0xa4'))[_0xbdcb('0x83')](_0x284958[_0xbdcb('0x5b')]['id'][_0xbdcb('0x8b')](),'VoiceQueueId')['field'](_0xbdcb('0xa2'),_0xbdcb('0x5c'))[_0xbdcb('0x83')]('NOW()',_0xbdcb('0x5d'))['from']('cm_contacts')[_0xbdcb('0x49')](_0xbdcb('0xa5'))['where']('ListId\x20=\x20?',_0xda1356[_0xbdcb('0xa6')][_0xbdcb('0x8b')]())[_0xbdcb('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0xbdcb('0x49')](_0xbdcb('0xa7'),squel['select']()[_0xbdcb('0x83')](_0xbdcb('0xa8'))[_0xbdcb('0x85')]('cm_hopper_final')[_0xbdcb('0x49')](_0xbdcb('0x88'),_0x284958[_0xbdcb('0x5b')]['id']['toString']()))[_0xbdcb('0x49')](_0xbdcb('0xa7'),squel[_0xbdcb('0x82')]()[_0xbdcb('0x83')](_0xbdcb('0xa9'))[_0xbdcb('0x85')](_0xbdcb('0x9e'))[_0xbdcb('0x49')](_0xbdcb('0x88'),_0x284958[_0xbdcb('0x5b')]['id'][_0xbdcb('0x8b')]())))[_0xbdcb('0x8b')]();break;case _0xbdcb('0xaa'):_0x18896d=squel[_0xbdcb('0x9d')]()[_0xbdcb('0xab')]('cm_hopper')[_0xbdcb('0x9f')](['phone',_0xbdcb('0xa1'),'ContactId','ListId',_0xbdcb('0x65'),_0xbdcb('0x5c'),_0xbdcb('0x5d')],squel[_0xbdcb('0x82')]()['field']('phone',_0xbdcb('0xa0'))[_0xbdcb('0x83')]('NOW()',_0xbdcb('0xa1'))[_0xbdcb('0x83')]('id',_0xbdcb('0xa3'))[_0xbdcb('0x83')](_0xda1356[_0xbdcb('0xa6')][_0xbdcb('0x8b')](),'ListId')['field'](_0x284958['params']['id']['toString'](),_0xbdcb('0x65'))[_0xbdcb('0x83')](_0xbdcb('0xa2'),_0xbdcb('0x5c'))['field'](_0xbdcb('0xa2'),_0xbdcb('0x5d'))[_0xbdcb('0x85')](_0xbdcb('0xac'))[_0xbdcb('0x49')](_0xbdcb('0xa5'))[_0xbdcb('0x49')](_0xbdcb('0xad'),_0xda1356[_0xbdcb('0xa6')][_0xbdcb('0x8b')]())[_0xbdcb('0x49')](_0xbdcb('0xae'))[_0xbdcb('0x49')](_0xbdcb('0xa7'),squel[_0xbdcb('0x82')]()[_0xbdcb('0x83')](_0xbdcb('0xa9'))[_0xbdcb('0x85')](_0xbdcb('0x9e'))[_0xbdcb('0x49')](_0xbdcb('0x88'),_0x284958[_0xbdcb('0x5b')]['id'][_0xbdcb('0x8b')]())))[_0xbdcb('0x8b')]();break;default:_0x18896d=squel['insert']()['into'](_0xbdcb('0x9e'))[_0xbdcb('0x9f')]([_0xbdcb('0xa0'),_0xbdcb('0xa1'),'ContactId',_0xbdcb('0xa4'),_0xbdcb('0x65'),'createdAt',_0xbdcb('0x5d')],squel['select']()[_0xbdcb('0x83')](_0xbdcb('0xa0'),_0xbdcb('0xa0'))[_0xbdcb('0x83')](_0xbdcb('0xa2'),_0xbdcb('0xa1'))[_0xbdcb('0x83')]('id',_0xbdcb('0xa3'))[_0xbdcb('0x83')](_0xda1356['CmListId'][_0xbdcb('0x8b')](),_0xbdcb('0xa4'))['field'](_0x284958['params']['id'][_0xbdcb('0x8b')](),'VoiceQueueId')[_0xbdcb('0x83')]('NOW()',_0xbdcb('0x5c'))['field'](_0xbdcb('0xa2'),_0xbdcb('0x5d'))[_0xbdcb('0x85')](_0xbdcb('0xac'))[_0xbdcb('0x49')](_0xbdcb('0xa5'))[_0xbdcb('0x49')](_0xbdcb('0xad'),_0xda1356[_0xbdcb('0xa6')][_0xbdcb('0x8b')]())[_0xbdcb('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0xbdcb('0x8b')]();}_0xff2d3f[_0xbdcb('0x8a')](db[_0xbdcb('0x74')][_0xbdcb('0x3d')](_0x18896d));}return BPromise['all'](_0xff2d3f);}})[_0xbdcb('0x25')](function(){return _0x30bef5;})[_0xbdcb('0x25')](respondWithResult(_0x305a37,null))[_0xbdcb('0x51')](handleError(_0x305a37,null));};exports[_0xbdcb('0xaf')]=function(_0x3df3d3,_0x4d0256,_0x5abaa0){return db['VoiceQueue']['find']({'where':{'id':_0x3df3d3[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x4d0256,null))['then'](function(_0x32900a){if(_0x32900a){return _0x32900a['removeLists'](_0x3df3d3[_0xbdcb('0x3d')][_0xbdcb('0x80')]);}})[_0xbdcb('0x25')](function(_0x43aca9){if(_0x43aca9){return db[_0xbdcb('0x62')]['destroy']({'where':{'ListId':_0x3df3d3[_0xbdcb('0x3d')][_0xbdcb('0x80')],'VoiceQueueId':_0x3df3d3['params']['id']}})['then'](function(){return _0x43aca9;});}})[_0xbdcb('0x25')](respondWithStatusCode(_0x4d0256,null))['catch'](handleError(_0x4d0256,null));};exports[_0xbdcb('0xb0')]=function(_0x3ef42f,_0x4b4ddf,_0xf091e3){var _0x409ca8={};var _0x3a0b0e={};var _0x24fbaa;var _0x510e72;return db[_0xbdcb('0x4f')][_0xbdcb('0x60')]({'where':{'id':_0x3ef42f[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x4b4ddf,null))[_0xbdcb('0x25')](function(_0x5bb858){if(_0x5bb858){_0x24fbaa=_0x5bb858;_0x3a0b0e[_0xbdcb('0x3b')]=_[_0xbdcb('0x3e')](db['CmList'][_0xbdcb('0x38')]);_0x3a0b0e['query']=_[_0xbdcb('0x3e')](_0x3ef42f[_0xbdcb('0x3d')]);_0x3a0b0e[_0xbdcb('0x3f')]=_['intersection'](_0x3a0b0e[_0xbdcb('0x3b')],_0x3a0b0e[_0xbdcb('0x3d')]);_0x409ca8[_0xbdcb('0x41')]=_[_0xbdcb('0x40')](_0x3a0b0e[_0xbdcb('0x3b')],qs['fields'](_0x3ef42f[_0xbdcb('0x3d')][_0xbdcb('0x42')]));_0x409ca8[_0xbdcb('0x41')]=_0x409ca8[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x409ca8[_0xbdcb('0x41')]:_0x3a0b0e[_0xbdcb('0x3b')];_0x409ca8[_0xbdcb('0x47')]=qs[_0xbdcb('0x48')](_0x3ef42f[_0xbdcb('0x3d')][_0xbdcb('0x48')]);_0x409ca8[_0xbdcb('0x49')]=qs['filters'](_[_0xbdcb('0x61')](_0x3ef42f[_0xbdcb('0x3d')],_0x3a0b0e[_0xbdcb('0x3f')]));if(_0x3ef42f['query'][_0xbdcb('0x2c')]){_0x409ca8['where']=_[_0xbdcb('0x4a')](_0x409ca8[_0xbdcb('0x49')],{'$or':_[_0xbdcb('0x3c')](_0x409ca8[_0xbdcb('0x41')],function(_0x122536){var _0x4cfdba={};_0x4cfdba[_0x122536]={'$like':'%'+_0x3ef42f[_0xbdcb('0x3d')][_0xbdcb('0x2c')]+'%'};return _0x4cfdba;})});}_0x409ca8=_['merge']({},_0x409ca8,_0x3ef42f[_0xbdcb('0x4c')]);return _0x24fbaa[_0xbdcb('0xb0')](_0x409ca8);}})[_0xbdcb('0x25')](function(_0x2fccfd){if(_0x2fccfd){_0x510e72=_0x2fccfd[_0xbdcb('0x43')];if(!_0x3ef42f[_0xbdcb('0x3d')][_0xbdcb('0x44')](_0xbdcb('0x45'))){_0x409ca8[_0xbdcb('0x22')]=qs[_0xbdcb('0x22')](_0x3ef42f[_0xbdcb('0x3d')][_0xbdcb('0x22')]);_0x409ca8[_0xbdcb('0x46')]=qs['offset'](_0x3ef42f[_0xbdcb('0x3d')][_0xbdcb('0x46')]);}return _0x24fbaa['getBlackLists'](_0x409ca8);}})[_0xbdcb('0x25')](function(_0x3ef61b){if(_0x3ef61b){return _0x3ef61b?{'count':_0x510e72,'rows':_0x3ef61b}:null;}})[_0xbdcb('0x25')](respondWithResult(_0x4b4ddf,null))['catch'](handleError(_0x4b4ddf,null));};exports[_0xbdcb('0xb1')]=function(_0x3adf08,_0x20ed74,_0x295ae5){var _0x4e5d8b,_0x5a2792;return db[_0xbdcb('0x4f')][_0xbdcb('0x31')]({'where':{'id':_0x3adf08[_0xbdcb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x20ed74,null))[_0xbdcb('0x25')](function(_0x454166){if(_0x454166){_0x5a2792=_0x454166;return _0x454166['addBlackLists'](_0x3adf08[_0xbdcb('0x53')][_0xbdcb('0x80')],_['omit'](_0x3adf08[_0xbdcb('0x53')],['ids','id'])||{});}return null;})[_0xbdcb('0x93')](function(_0x9ad462){var _0x5c7c3c;_0x4e5d8b=_0x9ad462||[];var _0xc49315=[];if(_0x9ad462){for(var _0x546b28=0x0;_0x546b28<_0x9ad462['length'];_0x546b28+=0x1){var _0x580825=_0x9ad462[_0x546b28][_0xbdcb('0x27')]({'plain':!![]});_0x5c7c3c=squel['insert']()[_0xbdcb('0xab')](_0xbdcb('0xb2'))[_0xbdcb('0x9f')]([_0xbdcb('0xa0'),'ContactId',_0xbdcb('0xa4'),_0xbdcb('0x65'),_0xbdcb('0x5c'),_0xbdcb('0x5d')],squel[_0xbdcb('0x82')]()[_0xbdcb('0x83')](_0xbdcb('0xa0'),'phone')[_0xbdcb('0x83')]('id','ContactId')[_0xbdcb('0x83')](_0x580825['CmListId']['toString'](),_0xbdcb('0xa4'))[_0xbdcb('0x83')](_0x3adf08[_0xbdcb('0x5b')]['id'][_0xbdcb('0x8b')](),_0xbdcb('0x65'))[_0xbdcb('0x83')](_0xbdcb('0xa2'),'createdAt')[_0xbdcb('0x83')](_0xbdcb('0xa2'),_0xbdcb('0x5d'))[_0xbdcb('0x85')](_0xbdcb('0xac'))[_0xbdcb('0x49')](_0xbdcb('0xa5'))[_0xbdcb('0x49')]('ListId\x20=\x20?',_0x580825[_0xbdcb('0xa6')]['toString']())[_0xbdcb('0x49')](_0xbdcb('0xae')))[_0xbdcb('0x8b')]();_0xc49315[_0xbdcb('0x8a')](db['sequelize']['query'](_0x5c7c3c));}return BPromise[_0xbdcb('0x8e')](_0xc49315);}})['then'](function(){return _0x4e5d8b;})[_0xbdcb('0x25')](respondWithResult(_0x20ed74,null))[_0xbdcb('0x51')](handleError(_0x20ed74,null));};exports[_0xbdcb('0xb3')]=function(_0x2c72f3,_0x2c4eb7,_0x2d1279){return db[_0xbdcb('0x4f')]['find']({'where':{'id':_0x2c72f3[_0xbdcb('0x5b')]['id']}})[_0xbdcb('0x25')](handleEntityNotFound(_0x2c4eb7,null))['then'](function(_0x1b9e8f){if(_0x1b9e8f){return _0x1b9e8f[_0xbdcb('0xb3')](_0x2c72f3[_0xbdcb('0x3d')][_0xbdcb('0x80')]);}})[_0xbdcb('0x25')](function(_0x67397f){if(_0x67397f){return db['CmHopperBlack'][_0xbdcb('0x26')]({'where':{'ListId':_0x2c72f3[_0xbdcb('0x3d')]['ids'],'VoiceQueueId':_0x2c72f3[_0xbdcb('0x5b')]['id']}})['then'](function(){return _0x67397f;});}})[_0xbdcb('0x25')](respondWithStatusCode(_0x2c4eb7,null))[_0xbdcb('0x51')](handleError(_0x2c4eb7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index bdd80e1..6fbcfed 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 _0x7dd0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue'];(function(_0x336fc6,_0x47749f){var _0x28a25a=function(_0x2974ae){while(--_0x2974ae){_0x336fc6['push'](_0x336fc6['shift']());}};_0x28a25a(++_0x47749f);}(_0x7dd0,0x183));var _0x07dd=function(_0x467e05,_0x2cdb2d){_0x467e05=_0x467e05-0x0;var _0x3e8347=_0x7dd0[_0x467e05];return _0x3e8347;};'use strict';var EventEmitter=require(_0x07dd('0x0'));var VoiceQueue=require(_0x07dd('0x1'))['db'][_0x07dd('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x07dd('0x3')](0x0);var events={'afterCreate':_0x07dd('0x4'),'afterUpdate':_0x07dd('0x5'),'afterDestroy':_0x07dd('0x6')};function emitEvent(_0x53b269){return function(_0x1899be,_0x4f52d0,_0x2bb69b){VoiceQueueEvents[_0x07dd('0x7')](_0x53b269+':'+_0x1899be['id'],_0x1899be);VoiceQueueEvents[_0x07dd('0x7')](_0x53b269,_0x1899be);_0x2bb69b(null);};}for(var e in events){if(events[_0x07dd('0x8')](e)){var event=events[e];VoiceQueue[_0x07dd('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x9162=['events','VoiceQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x142b4c,_0x50c65f){var _0x2ed05e=function(_0x1ea363){while(--_0x1ea363){_0x142b4c['push'](_0x142b4c['shift']());}};_0x2ed05e(++_0x50c65f);}(_0x9162,0x19e));var _0x2916=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x9162[_0x4c12ec];return _0x3ae42c;};'use strict';var EventEmitter=require(_0x2916('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x2916('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2916('0x2')](0x0);var events={'afterCreate':_0x2916('0x3'),'afterUpdate':_0x2916('0x4'),'afterDestroy':_0x2916('0x5')};function emitEvent(_0x14aca0){return function(_0x21a4a7,_0x11edfa,_0x187eda){VoiceQueueEvents[_0x2916('0x6')](_0x14aca0+':'+_0x21a4a7['id'],_0x21a4a7);VoiceQueueEvents[_0x2916('0x6')](_0x14aca0,_0x21a4a7);_0x187eda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x2916('0x7')](e,emitEvent(event));}}module[_0x2916('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 e0db53c..c4175c9 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 _0x0801=['util','api','moment','request-promise','path','rimraf','exports','VoiceQueue','voice_queues','lodash'];(function(_0x330500,_0x56df8f){var _0x5af587=function(_0x2a3e42){while(--_0x2a3e42){_0x330500['push'](_0x330500['shift']());}};_0x5af587(++_0x56df8f);}(_0x0801,0x15d));var _0x1080=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0801[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x1080('0x0'));var util=require(_0x1080('0x1'));var logger=require('../../config/logger')(_0x1080('0x2'));var moment=require(_0x1080('0x3'));var BPromise=require('bluebird');var rp=require(_0x1080('0x4'));var fs=require('fs');var path=require(_0x1080('0x5'));var rimraf=require(_0x1080('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueue.attributes');module[_0x1080('0x7')]=function(_0x594505,_0x2261db){return _0x594505['define'](_0x1080('0x8'),attributes,{'tableName':_0x1080('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e4=['moment','bluebird','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue','voice_queues','lodash','../../config/logger','api'];(function(_0x4a0384,_0x28a5a3){var _0x2f63af=function(_0xa4b267){while(--_0xa4b267){_0x4a0384['push'](_0x4a0384['shift']());}};_0x2f63af(++_0x28a5a3);}(_0xb4e4,0xb1));var _0x4b4e=function(_0x2b87cf,_0x38e45e){_0x2b87cf=_0x2b87cf-0x0;var _0x4f9fdc=_0xb4e4[_0x2b87cf];return _0x4f9fdc;};'use strict';var _=require(_0x4b4e('0x0'));var util=require('util');var logger=require(_0x4b4e('0x1'))(_0x4b4e('0x2'));var moment=require(_0x4b4e('0x3'));var BPromise=require(_0x4b4e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b4e('0x5'));var rimraf=require(_0x4b4e('0x6'));var config=require(_0x4b4e('0x7'));var attributes=require(_0x4b4e('0x8'));module[_0x4b4e('0x9')]=function(_0x23e1a7,_0x19cedd){return _0x23e1a7['define'](_0x4b4e('0xa'),attributes,{'tableName':_0x4b4e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ebd232f..a9d7fd1 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 _0xb804=['request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','options','raw','where','attributes','limit','map','include','model','ShowVoiceQueue','VoiceQueue','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s'];(function(_0x6e454d,_0x1c8d49){var _0x533fd4=function(_0x58d176){while(--_0x58d176){_0x6e454d['push'](_0x6e454d['shift']());}};_0x533fd4(++_0x1c8d49);}(_0xb804,0x11e));var _0x4b80=function(_0x49e175,_0x4b0c36){_0x49e175=_0x49e175-0x0;var _0x564a3a=_0xb804[_0x49e175];return _0x564a3a;};'use strict';var _=require(_0x4b80('0x0'));var util=require('util');var moment=require(_0x4b80('0x1'));var BPromise=require(_0x4b80('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b80('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b80('0x4'));var logger=require(_0x4b80('0x5'))(_0x4b80('0x6'));var config=require('../../config/environment');var jayson=require(_0x4b80('0x7'));var client=jayson[_0x4b80('0x8')][_0x4b80('0x9')]({'port':0x232a});config[_0x4b80('0xa')]=_[_0x4b80('0xb')](config['redis'],{'host':_0x4b80('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b80('0xa')]));require(_0x4b80('0xd'))['register'](socket);function respondWithRpcPromise(_0x50b11f,_0x11f1d8,_0x680286){return new BPromise(function(_0x549d18,_0x2c0cbb){return client[_0x4b80('0xe')](_0x50b11f,_0x680286)[_0x4b80('0xf')](function(_0x1a505a){logger[_0x4b80('0x10')](_0x4b80('0x11'),_0x11f1d8,_0x4b80('0x12'));logger[_0x4b80('0x13')](_0x4b80('0x14'),_0x11f1d8,'request\x20sent',JSON[_0x4b80('0x15')](_0x1a505a));if(_0x1a505a[_0x4b80('0x16')]){if(_0x1a505a[_0x4b80('0x16')][_0x4b80('0x17')]===0x1f4){logger[_0x4b80('0x16')](_0x4b80('0x11'),_0x11f1d8,_0x1a505a[_0x4b80('0x16')][_0x4b80('0x18')]);return _0x2c0cbb(_0x1a505a['error'][_0x4b80('0x18')]);}logger[_0x4b80('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x11f1d8,_0x1a505a[_0x4b80('0x16')][_0x4b80('0x18')]);return _0x549d18(_0x1a505a[_0x4b80('0x16')][_0x4b80('0x18')]);}else{logger[_0x4b80('0x10')](_0x4b80('0x11'),_0x11f1d8,_0x4b80('0x12'));_0x549d18(_0x1a505a[_0x4b80('0x19')][_0x4b80('0x18')]);}})[_0x4b80('0x1a')](function(_0x3c23e2){logger[_0x4b80('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x11f1d8,_0x3c23e2);_0x2c0cbb(_0x3c23e2);});});}exports[_0x4b80('0x1b')]=function(_0x5a466f){var _0x5d2666=this;return new Promise(function(_0x47542d,_0x144814){return db['VoiceQueue']['findAll']({'raw':_0x5a466f[_0x4b80('0x1c')]?_0x5a466f[_0x4b80('0x1c')][_0x4b80('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a466f[_0x4b80('0x1c')]?_0x5a466f['options'][_0x4b80('0x1e')]||null:null,'attributes':_0x5a466f['options']?_0x5a466f['options'][_0x4b80('0x1f')]||null:null,'limit':_0x5a466f[_0x4b80('0x1c')]?_0x5a466f[_0x4b80('0x1c')][_0x4b80('0x20')]||null:null,'include':_0x5a466f[_0x4b80('0x1c')]?_0x5a466f['options']['include']?_[_0x4b80('0x21')](_0x5a466f['options'][_0x4b80('0x22')],function(_0x1814f4){return{'model':db[_0x1814f4[_0x4b80('0x23')]],'as':_0x1814f4['as'],'attributes':_0x1814f4[_0x4b80('0x1f')],'include':_0x1814f4[_0x4b80('0x22')]?_[_0x4b80('0x21')](_0x1814f4[_0x4b80('0x22')],function(_0x216d1b){return{'model':db[_0x216d1b[_0x4b80('0x23')]],'as':_0x216d1b['as'],'attributes':_0x216d1b[_0x4b80('0x1f')],'include':_0x216d1b[_0x4b80('0x22')]?_[_0x4b80('0x21')](_0x216d1b['include'],function(_0x3b4123){return{'model':db[_0x3b4123[_0x4b80('0x23')]],'as':_0x3b4123['as'],'attributes':_0x3b4123['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b80('0xf')](function(_0x3a83da){logger[_0x4b80('0x10')]('GetVoiceQueue',_0x5a466f);logger[_0x4b80('0x13')]('GetVoiceQueue',_0x5a466f,JSON[_0x4b80('0x15')](_0x3a83da));_0x47542d(_0x3a83da);})['catch'](function(_0x4565d6){logger[_0x4b80('0x16')]('GetVoiceQueue',_0x4565d6[_0x4b80('0x18')],_0x5a466f);_0x144814(_0x5d2666['error'](0x1f4,_0x4565d6[_0x4b80('0x18')]));});});};exports[_0x4b80('0x24')]=function(_0x439c49){var _0x61de1f=this;return new Promise(function(_0x393402,_0x148b81){return db[_0x4b80('0x25')]['find']({'raw':_0x439c49[_0x4b80('0x1c')]?_0x439c49['options'][_0x4b80('0x1d')]===undefined?!![]:![]:!![],'where':_0x439c49[_0x4b80('0x1c')]?_0x439c49['options'][_0x4b80('0x1e')]||null:null,'attributes':_0x439c49[_0x4b80('0x1c')]?_0x439c49['options'][_0x4b80('0x1f')]||null:null,'include':_0x439c49['options']?_0x439c49[_0x4b80('0x1c')][_0x4b80('0x22')]?_['map'](_0x439c49[_0x4b80('0x1c')]['include'],function(_0x15e630){return{'model':db[_0x15e630[_0x4b80('0x23')]],'as':_0x15e630['as'],'attributes':_0x15e630[_0x4b80('0x1f')],'include':_0x15e630[_0x4b80('0x22')]?_[_0x4b80('0x21')](_0x15e630['include'],function(_0x1422b0){return{'model':db[_0x1422b0[_0x4b80('0x23')]],'as':_0x1422b0['as'],'attributes':_0x1422b0[_0x4b80('0x1f')],'include':_0x1422b0['include']?_[_0x4b80('0x21')](_0x1422b0[_0x4b80('0x22')],function(_0x1bd9e2){return{'model':db[_0x1bd9e2[_0x4b80('0x23')]],'as':_0x1bd9e2['as'],'attributes':_0x1bd9e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b80('0xf')](function(_0x21cb18){logger[_0x4b80('0x10')](_0x4b80('0x24'),_0x439c49);logger['debug'](_0x4b80('0x24'),_0x439c49,JSON['stringify'](_0x21cb18));_0x393402(_0x21cb18);})[_0x4b80('0x1a')](function(_0x1799e4){logger[_0x4b80('0x16')](_0x4b80('0x24'),_0x1799e4[_0x4b80('0x18')],_0x439c49);_0x148b81(_0x61de1f[_0x4b80('0x16')](0x1f4,_0x1799e4[_0x4b80('0x18')]));});});}; \ No newline at end of file +var _0x1702=['error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1fcd02,_0x2fe7c6){var _0x1d52ae=function(_0x14f944){while(--_0x14f944){_0x1fcd02['push'](_0x1fcd02['shift']());}};_0x1d52ae(++_0x2fe7c6);}(_0x1702,0x114));var _0x2170=function(_0x536e88,_0x3a1791){_0x536e88=_0x536e88-0x0;var _0x3de540=_0x1702[_0x536e88];return _0x3de540;};'use strict';var _=require(_0x2170('0x0'));var util=require(_0x2170('0x1'));var moment=require(_0x2170('0x2'));var BPromise=require(_0x2170('0x3'));var rs=require(_0x2170('0x4'));var fs=require('fs');var Redis=require(_0x2170('0x5'));var db=require(_0x2170('0x6'))['db'];var utils=require(_0x2170('0x7'));var logger=require('../../config/logger')(_0x2170('0x8'));var config=require(_0x2170('0x9'));var jayson=require(_0x2170('0xa'));var client=jayson[_0x2170('0xb')][_0x2170('0xc')]({'port':0x232a});config['redis']=_[_0x2170('0xd')](config[_0x2170('0xe')],{'host':_0x2170('0xf'),'port':0x18eb});var socket=require(_0x2170('0x10'))(new Redis(config[_0x2170('0xe')]));require(_0x2170('0x11'))['register'](socket);function respondWithRpcPromise(_0x40c553,_0x58a456,_0x48dd4a){return new BPromise(function(_0x3a81c0,_0xcfbe29){return client[_0x2170('0x12')](_0x40c553,_0x48dd4a)[_0x2170('0x13')](function(_0x35beee){logger[_0x2170('0x14')](_0x2170('0x15'),_0x58a456,_0x2170('0x16'));logger[_0x2170('0x17')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x58a456,_0x2170('0x16'),JSON[_0x2170('0x18')](_0x35beee));if(_0x35beee[_0x2170('0x19')]){if(_0x35beee[_0x2170('0x19')][_0x2170('0x1a')]===0x1f4){logger['error'](_0x2170('0x15'),_0x58a456,_0x35beee['error'][_0x2170('0x1b')]);return _0xcfbe29(_0x35beee['error']['message']);}logger[_0x2170('0x19')](_0x2170('0x15'),_0x58a456,_0x35beee[_0x2170('0x19')][_0x2170('0x1b')]);return _0x3a81c0(_0x35beee[_0x2170('0x19')][_0x2170('0x1b')]);}else{logger[_0x2170('0x14')](_0x2170('0x15'),_0x58a456,_0x2170('0x16'));_0x3a81c0(_0x35beee[_0x2170('0x1c')][_0x2170('0x1b')]);}})[_0x2170('0x1d')](function(_0x51d61e){logger[_0x2170('0x19')](_0x2170('0x15'),_0x58a456,_0x51d61e);_0xcfbe29(_0x51d61e);});});}exports[_0x2170('0x1e')]=function(_0x284fe8){var _0x310a23=this;return new Promise(function(_0x782534,_0x49c27d){return db[_0x2170('0x1f')][_0x2170('0x20')]({'raw':_0x284fe8[_0x2170('0x21')]?_0x284fe8[_0x2170('0x21')][_0x2170('0x22')]===undefined?!![]:![]:!![],'where':_0x284fe8[_0x2170('0x21')]?_0x284fe8['options'][_0x2170('0x23')]||null:null,'attributes':_0x284fe8[_0x2170('0x21')]?_0x284fe8['options'][_0x2170('0x24')]||null:null,'limit':_0x284fe8[_0x2170('0x21')]?_0x284fe8['options'][_0x2170('0x25')]||null:null,'include':_0x284fe8[_0x2170('0x21')]?_0x284fe8[_0x2170('0x21')][_0x2170('0x26')]?_['map'](_0x284fe8[_0x2170('0x21')][_0x2170('0x26')],function(_0x3fb43d){return{'model':db[_0x3fb43d[_0x2170('0x27')]],'as':_0x3fb43d['as'],'attributes':_0x3fb43d['attributes'],'include':_0x3fb43d[_0x2170('0x26')]?_[_0x2170('0x28')](_0x3fb43d['include'],function(_0x223eb2){return{'model':db[_0x223eb2['model']],'as':_0x223eb2['as'],'attributes':_0x223eb2[_0x2170('0x24')],'include':_0x223eb2['include']?_[_0x2170('0x28')](_0x223eb2[_0x2170('0x26')],function(_0x5b43ca){return{'model':db[_0x5b43ca['model']],'as':_0x5b43ca['as'],'attributes':_0x5b43ca[_0x2170('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2170('0x13')](function(_0x384df6){logger[_0x2170('0x14')]('GetVoiceQueue',_0x284fe8);logger[_0x2170('0x17')](_0x2170('0x1e'),_0x284fe8,JSON[_0x2170('0x18')](_0x384df6));_0x782534(_0x384df6);})[_0x2170('0x1d')](function(_0x38bb8b){logger['error']('GetVoiceQueue',_0x38bb8b[_0x2170('0x1b')],_0x284fe8);_0x49c27d(_0x310a23['error'](0x1f4,_0x38bb8b['message']));});});};exports['ShowVoiceQueue']=function(_0xd2b6e5){var _0x3085fd=this;return new Promise(function(_0x30833e,_0x3f7211){return db[_0x2170('0x1f')][_0x2170('0x29')]({'raw':_0xd2b6e5[_0x2170('0x21')]?_0xd2b6e5[_0x2170('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0xd2b6e5[_0x2170('0x21')]?_0xd2b6e5[_0x2170('0x21')][_0x2170('0x23')]||null:null,'attributes':_0xd2b6e5[_0x2170('0x21')]?_0xd2b6e5[_0x2170('0x21')][_0x2170('0x24')]||null:null,'include':_0xd2b6e5[_0x2170('0x21')]?_0xd2b6e5['options'][_0x2170('0x26')]?_[_0x2170('0x28')](_0xd2b6e5['options']['include'],function(_0x71dd8a){return{'model':db[_0x71dd8a['model']],'as':_0x71dd8a['as'],'attributes':_0x71dd8a[_0x2170('0x24')],'include':_0x71dd8a[_0x2170('0x26')]?_[_0x2170('0x28')](_0x71dd8a[_0x2170('0x26')],function(_0x3659fd){return{'model':db[_0x3659fd['model']],'as':_0x3659fd['as'],'attributes':_0x3659fd[_0x2170('0x24')],'include':_0x3659fd[_0x2170('0x26')]?_[_0x2170('0x28')](_0x3659fd[_0x2170('0x26')],function(_0x4bd96a){return{'model':db[_0x4bd96a[_0x2170('0x27')]],'as':_0x4bd96a['as'],'attributes':_0x4bd96a[_0x2170('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2170('0x13')](function(_0x1d493e){logger[_0x2170('0x14')](_0x2170('0x2a'),_0xd2b6e5);logger[_0x2170('0x17')]('ShowVoiceQueue',_0xd2b6e5,JSON['stringify'](_0x1d493e));_0x30833e(_0x1d493e);})[_0x2170('0x1d')](function(_0x34d89c){logger['error']('ShowVoiceQueue',_0x34d89c['message'],_0xd2b6e5);_0x3f7211(_0x3085fd[_0x2170('0x19')](0x1f4,_0x34d89c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 1fd90df..98cc802 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 _0xa8f6=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update','removeListener'];(function(_0x4c8b61,_0x6c1f59){var _0x39d2ec=function(_0x31e713){while(--_0x31e713){_0x4c8b61['push'](_0x4c8b61['shift']());}};_0x39d2ec(++_0x6c1f59);}(_0xa8f6,0x1d3));var _0x6a8f=function(_0x521bb3,_0x453b57){_0x521bb3=_0x521bb3-0x0;var _0x2cf41c=_0xa8f6[_0x521bb3];return _0x2cf41c;};'use strict';var VoiceQueueEvents=require(_0x6a8f('0x0'));var events=[_0x6a8f('0x1'),_0x6a8f('0x2'),_0x6a8f('0x3')];function createListener(_0x2d7b3e,_0x20b17b){return function(_0x2527b3){_0x20b17b['emit'](_0x2d7b3e,_0x2527b3);};}function removeListener(_0x11cf1a,_0x4193bc){return function(){VoiceQueueEvents[_0x6a8f('0x4')](_0x11cf1a,_0x4193bc);};}exports[_0x6a8f('0x5')]=function(_0x48452b){for(var _0x3f0709=0x0,_0x9e979f=events[_0x6a8f('0x6')];_0x3f0709<_0x9e979f;_0x3f0709++){var _0x555c5e=events[_0x3f0709];var _0x485dd8=createListener(_0x6a8f('0x7')+_0x555c5e,_0x48452b);VoiceQueueEvents['on'](_0x555c5e,_0x485dd8);}}; \ No newline at end of file +var _0xd866=['save','emit','removeListener','length','voiceQueue:','./voiceQueue.events'];(function(_0x220134,_0xb47799){var _0x952a4d=function(_0x1c4b04){while(--_0x1c4b04){_0x220134['push'](_0x220134['shift']());}};_0x952a4d(++_0xb47799);}(_0xd866,0xbf));var _0x6d86=function(_0xb36843,_0x57c1f4){_0xb36843=_0xb36843-0x0;var _0x227b83=_0xd866[_0xb36843];return _0x227b83;};'use strict';var VoiceQueueEvents=require(_0x6d86('0x0'));var events=[_0x6d86('0x1'),'remove','update'];function createListener(_0x2519c9,_0x3704cd){return function(_0x41ba97){_0x3704cd[_0x6d86('0x2')](_0x2519c9,_0x41ba97);};}function removeListener(_0x3681c8,_0x2b8be5){return function(){VoiceQueueEvents[_0x6d86('0x3')](_0x3681c8,_0x2b8be5);};}exports['register']=function(_0x51a5ee){for(var _0x38d573=0x0,_0x1598f6=events[_0x6d86('0x4')];_0x38d573<_0x1598f6;_0x38d573++){var _0x16db07=events[_0x38d573];var _0xb5b872=createListener(_0x6d86('0x5')+_0x16db07,_0x51a5ee);VoiceQueueEvents['on'](_0x16db07,_0xb5b872);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f3c039c..081f426 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 _0x73f6=['describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x73f6,0xbb));var _0x673f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x73f6[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x673f('0x0'));var util=require(_0x673f('0x1'));var path=require('path');var timeout=require(_0x673f('0x2'));var express=require(_0x673f('0x3'));var router=express[_0x673f('0x4')]();var fs_extra=require(_0x673f('0x5'));var auth=require(_0x673f('0x6'));var interaction=require(_0x673f('0x7'));var config=require(_0x673f('0x8'));var controller=require(_0x673f('0x9'));router[_0x673f('0xa')]('/',auth[_0x673f('0xb')](),controller[_0x673f('0xc')]);router[_0x673f('0xa')]('/describe',auth[_0x673f('0xb')](),controller[_0x673f('0xd')]);router[_0x673f('0xa')](_0x673f('0xe'),auth['isAuthenticated'](),controller[_0x673f('0xf')]);router[_0x673f('0xa')](_0x673f('0x10'),auth[_0x673f('0xb')](),controller[_0x673f('0x11')]);router[_0x673f('0x12')]('/',auth[_0x673f('0xb')](),controller[_0x673f('0x13')]);router[_0x673f('0x14')]('/:id',auth[_0x673f('0xb')](),controller[_0x673f('0x15')]);router[_0x673f('0x16')](_0x673f('0x10'),auth[_0x673f('0xb')](),controller[_0x673f('0x17')]);module[_0x673f('0x18')]=router; \ No newline at end of file +var _0xdc59=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','destroy'];(function(_0x5c1fac,_0x3a186a){var _0x4074a0=function(_0x261e08){while(--_0x261e08){_0x5c1fac['push'](_0x5c1fac['shift']());}};_0x4074a0(++_0x3a186a);}(_0xdc59,0xb1));var _0x9dc5=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xdc59[_0x5b7788];return _0x573871;};'use strict';var multer=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var path=require(_0x9dc5('0x2'));var timeout=require(_0x9dc5('0x3'));var express=require(_0x9dc5('0x4'));var router=express['Router']();var fs_extra=require(_0x9dc5('0x5'));var auth=require(_0x9dc5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9dc5('0x7'));router[_0x9dc5('0x8')]('/',auth[_0x9dc5('0x9')](),controller[_0x9dc5('0xa')]);router[_0x9dc5('0x8')](_0x9dc5('0xb'),auth['isAuthenticated'](),controller[_0x9dc5('0xc')]);router[_0x9dc5('0x8')](_0x9dc5('0xd'),auth['isAuthenticated'](),controller[_0x9dc5('0xe')]);router[_0x9dc5('0x8')](_0x9dc5('0xf'),auth[_0x9dc5('0x9')](),controller[_0x9dc5('0x10')]);router[_0x9dc5('0x11')]('/',auth[_0x9dc5('0x9')](),controller[_0x9dc5('0x12')]);router[_0x9dc5('0x13')](_0x9dc5('0xf'),auth[_0x9dc5('0x9')](),controller['update']);router['delete'](_0x9dc5('0xf'),auth[_0x9dc5('0x9')](),controller[_0x9dc5('0x14')]);module[_0x9dc5('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4049337..38f441b 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 _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xcb91[_0x506d83];return _0x335e8b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff'];(function(_0xb6b026,_0x4d9cfb){var _0xb6c910=function(_0x648238){while(--_0x648238){_0xb6b026['push'](_0xb6b026['shift']());}};_0xb6c910(++_0x4d9cfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a9e('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a9e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0a9e('0x4')],'set':function(_0x991246){var _0x981158=moment(_0x991246);var _0x57b080=moment(this[_0x0a9e('0x5')](_0x0a9e('0x6')))[_0x0a9e('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x503809=_0x981158[_0x0a9e('0x8')](_0x57b080,'seconds');this['setDataValue'](_0x0a9e('0x9'),_0x991246);this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x503809||null);}},'position':{'type':Sequelize[_0x0a9e('0xc')]},'count':{'type':Sequelize[_0x0a9e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x0a9e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0a9e('0x3')],'comment':_0x0a9e('0xe')},'originalposition':{'type':Sequelize[_0x0a9e('0xc')]},'channel':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a9e('0x3')]},'context':{'type':Sequelize[_0x0a9e('0x3')]},'exten':{'type':Sequelize[_0x0a9e('0x3')]},'priority':{'type':Sequelize[_0x0a9e('0x3')]},'holdtime':{'type':Sequelize[_0x0a9e('0xc')]},'mohtime':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0a9e('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0a9e('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0a9e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0a9e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0a9e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0a9e('0xc')],'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 bc41dce..76e1448 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 _0xb845=['defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy','error','stack','name','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','update','body','describe','getVoiceQueuesReport','nolimit','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb845,0x18b));var _0x5b84=function(_0x45e509,_0x4fb1b3){_0x45e509=_0x45e509-0x0;var _0x478177=_0xb845[_0x45e509];return _0x478177;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5b84('0x0'));var rimraf=require(_0x5b84('0x1'));var zipdir=require(_0x5b84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b84('0x3'));var moment=require(_0x5b84('0x4'));var BPromise=require(_0x5b84('0x5'));var Mustache=require(_0x5b84('0x6'));var util=require(_0x5b84('0x7'));var path=require(_0x5b84('0x8'));var sox=require(_0x5b84('0x9'));var csv=require(_0x5b84('0xa'));var ejs=require(_0x5b84('0xb'));var fs=require('fs');var fs_extra=require(_0x5b84('0xc'));var _=require(_0x5b84('0xd'));var squel=require(_0x5b84('0xe'));var crypto=require(_0x5b84('0xf'));var jsforce=require(_0x5b84('0x10'));var deskjs=require(_0x5b84('0x11'));var toCsv=require(_0x5b84('0xa'));var querystring=require(_0x5b84('0x12'));var Papa=require(_0x5b84('0x13'));var Redis=require(_0x5b84('0x14'));var authService=require(_0x5b84('0x15'));var qs=require(_0x5b84('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b84('0x17'));var logger=require(_0x5b84('0x18'))(_0x5b84('0x19'));var utils=require('../../config/utils');var config=require(_0x5b84('0x1a'));var licenseUtil=require(_0x5b84('0x1b'));var db=require(_0x5b84('0x1c'))['db'];config[_0x5b84('0x1d')]=_[_0x5b84('0x1e')](config[_0x5b84('0x1d')],{'host':_0x5b84('0x1f'),'port':0x18eb});var socket=require(_0x5b84('0x20'))(new Redis(config[_0x5b84('0x1d')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x17d6c0,_0x55eb98){_0x55eb98=_0x55eb98||0xcc;return function(_0x43a9aa){if(_0x43a9aa){return _0x17d6c0[_0x5b84('0x21')](_0x55eb98);}return _0x17d6c0[_0x5b84('0x22')](_0x55eb98)[_0x5b84('0x23')]();};}function respondWithResult(_0x11bdc8,_0x9796bf){_0x9796bf=_0x9796bf||0xc8;return function(_0x9e5b30){if(_0x9e5b30){return _0x11bdc8[_0x5b84('0x22')](_0x9796bf)[_0x5b84('0x24')](_0x9e5b30);}};}function respondWithFilteredResult(_0x25d376,_0xc4a68c){return function(_0x1de69c){if(_0x1de69c){var _0x47e04b=_0x1de69c[_0x5b84('0x25')],_0x584e99=_0xc4a68c[_0x5b84('0x26')],_0x4e421a=_0xc4a68c['offset']+_0xc4a68c[_0x5b84('0x27')],_0x125984;if(_0x4e421a>=_0x47e04b){_0x4e421a=_0x47e04b;_0x125984=0xc8;}else{_0x125984=0xce;}_0x25d376['status'](_0x125984);return _0x25d376[_0x5b84('0x28')](_0x5b84('0x29'),_0x584e99+'-'+_0x4e421a+'/'+_0x47e04b)[_0x5b84('0x24')](_0x1de69c);}return null;};}function patchUpdates(_0x2ddf1f){return function(_0x20656d){try{jsonpatch[_0x5b84('0x2a')](_0x20656d,_0x2ddf1f,!![]);}catch(_0x6bcf72){return BPromise['reject'](_0x6bcf72);}return _0x20656d['save']();};}function saveUpdates(_0x58e3c6,_0x556beb){return function(_0x45ffcd){if(_0x45ffcd){return _0x45ffcd['update'](_0x58e3c6)[_0x5b84('0x2b')](function(_0x81511c){return _0x81511c;});}return null;};}function removeEntity(_0x14e0ba,_0x59b736){return function(_0x2e09ff){if(_0x2e09ff){return _0x2e09ff[_0x5b84('0x2c')]()[_0x5b84('0x2b')](function(){_0x14e0ba[_0x5b84('0x22')](0xcc)[_0x5b84('0x23')]();});}};}function handleEntityNotFound(_0x20fba7,_0x200ac5){return function(_0x3dd77b){if(!_0x3dd77b){_0x20fba7[_0x5b84('0x21')](0x194);}return _0x3dd77b;};}function handleError(_0x5683b8,_0x52fb8e){_0x52fb8e=_0x52fb8e||0x1f4;return function(_0x3483a0){logger[_0x5b84('0x2d')](_0x3483a0[_0x5b84('0x2e')]);if(_0x3483a0[_0x5b84('0x2f')]){delete _0x3483a0[_0x5b84('0x2f')];}_0x5683b8[_0x5b84('0x22')](_0x52fb8e)['send'](_0x3483a0);};}exports['index']=function(_0x3b21c9,_0x15590c){var _0x1396af={},_0xe63f8f={},_0x42a6e4={'count':0x0,'rows':[]};var _0x292999=_[_0x5b84('0x30')](db[_0x5b84('0x31')][_0x5b84('0x32')],function(_0x3228b7){return{'name':_0x3228b7[_0x5b84('0x33')],'type':_0x3228b7[_0x5b84('0x34')][_0x5b84('0x35')]};});_0xe63f8f[_0x5b84('0x36')]=_[_0x5b84('0x30')](_0x292999,_0x5b84('0x2f'));_0xe63f8f['query']=_['keys'](_0x3b21c9['query']);_0xe63f8f['filters']=_[_0x5b84('0x37')](_0xe63f8f[_0x5b84('0x36')],_0xe63f8f[_0x5b84('0x38')]);_0x1396af[_0x5b84('0x39')]=_[_0x5b84('0x37')](_0xe63f8f[_0x5b84('0x36')],qs[_0x5b84('0x3a')](_0x3b21c9['query'][_0x5b84('0x3a')]));_0x1396af[_0x5b84('0x39')]=_0x1396af['attributes']['length']?_0x1396af[_0x5b84('0x39')]:_0xe63f8f[_0x5b84('0x36')];if(!_0x3b21c9[_0x5b84('0x38')][_0x5b84('0x3b')]('nolimit')){_0x1396af['limit']=qs['limit'](_0x3b21c9[_0x5b84('0x38')][_0x5b84('0x27')]);_0x1396af[_0x5b84('0x26')]=qs[_0x5b84('0x26')](_0x3b21c9[_0x5b84('0x38')][_0x5b84('0x26')]);}_0x1396af[_0x5b84('0x3c')]=qs['sort'](_0x3b21c9['query'][_0x5b84('0x3d')]);_0x1396af[_0x5b84('0x3e')]=qs['filters'](_['pick'](_0x3b21c9[_0x5b84('0x38')],_0xe63f8f[_0x5b84('0x3f')]),_0x292999);if(_0x3b21c9[_0x5b84('0x38')][_0x5b84('0x40')]){_0x1396af[_0x5b84('0x3e')]=_[_0x5b84('0x41')](_0x1396af[_0x5b84('0x3e')],{'$or':_[_0x5b84('0x30')](_0x292999,function(_0x3877be){if(_0x3877be[_0x5b84('0x34')]!==_0x5b84('0x42')){var _0xdb3a51={};_0xdb3a51[_0x3877be[_0x5b84('0x2f')]]={'$like':'%'+_0x3b21c9['query'][_0x5b84('0x40')]+'%'};return _0xdb3a51;}})});}_0x1396af=_[_0x5b84('0x41')]({},_0x1396af,_0x3b21c9['options']);var _0x5411c5={'where':_0x1396af[_0x5b84('0x3e')]};return db['VoiceQueueReport'][_0x5b84('0x25')](_0x5411c5)[_0x5b84('0x2b')](function(_0x2e6b39){_0x42a6e4[_0x5b84('0x25')]=_0x2e6b39;if(_0x3b21c9['query'][_0x5b84('0x43')]){_0x1396af[_0x5b84('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x5b84('0x45')](_0x1396af);})[_0x5b84('0x2b')](function(_0x38bdd9){_0x42a6e4[_0x5b84('0x46')]=_0x38bdd9;return _0x42a6e4;})[_0x5b84('0x2b')](respondWithFilteredResult(_0x15590c,_0x1396af))[_0x5b84('0x47')](handleError(_0x15590c,null));};exports[_0x5b84('0x48')]=function(_0x3090b8,_0x45d086){var _0x19d16a={'raw':![],'where':{'id':_0x3090b8[_0x5b84('0x49')]['id']}},_0x49ec8b={};_0x49ec8b[_0x5b84('0x36')]=_[_0x5b84('0x4a')](db[_0x5b84('0x31')][_0x5b84('0x32')]);_0x49ec8b['query']=_[_0x5b84('0x4a')](_0x3090b8[_0x5b84('0x38')]);_0x49ec8b['filters']=_[_0x5b84('0x37')](_0x49ec8b[_0x5b84('0x36')],_0x49ec8b[_0x5b84('0x38')]);_0x19d16a['attributes']=_[_0x5b84('0x37')](_0x49ec8b[_0x5b84('0x36')],qs[_0x5b84('0x3a')](_0x3090b8[_0x5b84('0x38')][_0x5b84('0x3a')]));_0x19d16a[_0x5b84('0x39')]=_0x19d16a['attributes'][_0x5b84('0x4b')]?_0x19d16a['attributes']:_0x49ec8b[_0x5b84('0x36')];if(_0x3090b8['query'][_0x5b84('0x43')]){_0x19d16a[_0x5b84('0x44')]=[{'all':!![]}];}_0x19d16a=_[_0x5b84('0x41')]({},_0x19d16a,_0x3090b8[_0x5b84('0x4c')]);return db['VoiceQueueReport'][_0x5b84('0x4d')](_0x19d16a)[_0x5b84('0x2b')](handleEntityNotFound(_0x45d086,null))[_0x5b84('0x2b')](respondWithResult(_0x45d086,null))['catch'](handleError(_0x45d086,null));};exports['create']=function(_0x1e4a8f,_0x383fcb){return db['VoiceQueueReport'][_0x5b84('0x4e')](_0x1e4a8f['body'],{})['then'](respondWithResult(_0x383fcb,0xc9))[_0x5b84('0x47')](handleError(_0x383fcb,null));};exports[_0x5b84('0x4f')]=function(_0x15bb6e,_0x469665){if(_0x15bb6e['body']['id']){delete _0x15bb6e[_0x5b84('0x50')]['id'];}return db[_0x5b84('0x31')][_0x5b84('0x4d')]({'where':{'id':_0x15bb6e[_0x5b84('0x49')]['id']}})[_0x5b84('0x2b')](handleEntityNotFound(_0x469665,null))[_0x5b84('0x2b')](saveUpdates(_0x15bb6e[_0x5b84('0x50')],null))['then'](respondWithResult(_0x469665,null))[_0x5b84('0x47')](handleError(_0x469665,null));};exports['destroy']=function(_0x3bf0db,_0x58b002){return db[_0x5b84('0x31')][_0x5b84('0x4d')]({'where':{'id':_0x3bf0db['params']['id']}})[_0x5b84('0x2b')](handleEntityNotFound(_0x58b002,null))[_0x5b84('0x2b')](removeEntity(_0x58b002,null))[_0x5b84('0x47')](handleError(_0x58b002,null));};exports[_0x5b84('0x51')]=function(_0xd2539e,_0x31f1a1){return db[_0x5b84('0x31')][_0x5b84('0x51')]()[_0x5b84('0x2b')](respondWithResult(_0x31f1a1,null))[_0x5b84('0x47')](handleError(_0x31f1a1,null));};exports[_0x5b84('0x52')]=function(_0x4e0b05,_0x512ee9){var _0x2d1680={},_0x9d2068={},_0x24e198={'count':0x0,'rows':[]};_0x9d2068[_0x5b84('0x36')]=_['keys'](db[_0x5b84('0x31')][_0x5b84('0x32')]);_0x9d2068[_0x5b84('0x38')]=_[_0x5b84('0x4a')](_0x4e0b05[_0x5b84('0x38')]);_0x9d2068['filters']=_[_0x5b84('0x37')](_0x9d2068[_0x5b84('0x36')],_0x9d2068[_0x5b84('0x38')]);_0x2d1680[_0x5b84('0x39')]=_[_0x5b84('0x37')](_0x9d2068[_0x5b84('0x36')],qs['fields'](_0x4e0b05[_0x5b84('0x38')]['fields']));_0x2d1680['attributes']=_0x2d1680[_0x5b84('0x39')][_0x5b84('0x4b')]?_0x2d1680[_0x5b84('0x39')]:_0x9d2068[_0x5b84('0x36')];if(!_0x4e0b05[_0x5b84('0x38')][_0x5b84('0x3b')](_0x5b84('0x53'))){_0x2d1680[_0x5b84('0x27')]=qs[_0x5b84('0x27')](_0x4e0b05['query']['limit']);_0x2d1680[_0x5b84('0x26')]=qs[_0x5b84('0x26')](_0x4e0b05[_0x5b84('0x38')][_0x5b84('0x26')]);}_0x2d1680[_0x5b84('0x3c')]=qs[_0x5b84('0x3d')](_0x4e0b05[_0x5b84('0x38')]['sort']);_0x2d1680[_0x5b84('0x3e')]=qs['filters'](_[_0x5b84('0x54')](_0x4e0b05[_0x5b84('0x38')],_0x9d2068[_0x5b84('0x3f')]));if(_0x4e0b05['query'][_0x5b84('0x40')]){_0x2d1680['where']=_[_0x5b84('0x41')](_0x2d1680[_0x5b84('0x3e')],{'$or':_[_0x5b84('0x30')](_0x2d1680[_0x5b84('0x39')],function(_0x439dbd){var _0x35b277={};_0x35b277[_0x439dbd]={'$like':'%'+_0x4e0b05[_0x5b84('0x38')][_0x5b84('0x40')]+'%'};return _0x35b277;})});}_0x2d1680=_['merge']({},_0x2d1680,_0x4e0b05['options']);var _0x2313b8={'where':_0x2d1680[_0x5b84('0x3e')]};return db[_0x5b84('0x31')][_0x5b84('0x25')](_0x2313b8)[_0x5b84('0x2b')](function(_0x227ebb){_0x24e198[_0x5b84('0x25')]=_0x227ebb;if(_0x4e0b05[_0x5b84('0x38')][_0x5b84('0x43')]){_0x2d1680['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x2d1680);})[_0x5b84('0x2b')](function(_0x4bd61e){_0x24e198[_0x5b84('0x46')]=_0x4bd61e;return _0x24e198;})[_0x5b84('0x2b')](respondWithFilteredResult(_0x512ee9,_0x2d1680,_0x5b84('0x52')))['catch'](handleError(_0x512ee9,null,_0x5b84('0x52')));}; \ No newline at end of file +var _0xdb90=['index','map','VoiceQueueReport','type','key','model','keys','query','filters','intersection','attributes','fields','length','limit','sort','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','order','pick','filter','count','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','end','status','offset','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name'];(function(_0x561c4c,_0x51bf1b){var _0x21d57a=function(_0xd104f){while(--_0xd104f){_0x561c4c['push'](_0x561c4c['shift']());}};_0x21d57a(++_0x51bf1b);}(_0xdb90,0xcb));var _0x0db9=function(_0x299efe,_0x5e1129){_0x299efe=_0x299efe-0x0;var _0x53c2b8=_0xdb90[_0x299efe];return _0x53c2b8;};'use strict';var pdf=require(_0x0db9('0x0'));var emlformat=require(_0x0db9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0db9('0x2'));var jsonpatch=require(_0x0db9('0x3'));var rp=require('request-promise');var moment=require(_0x0db9('0x4'));var BPromise=require(_0x0db9('0x5'));var Mustache=require(_0x0db9('0x6'));var util=require(_0x0db9('0x7'));var path=require(_0x0db9('0x8'));var sox=require(_0x0db9('0x9'));var csv=require(_0x0db9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0db9('0xb'));var _=require(_0x0db9('0xc'));var squel=require(_0x0db9('0xd'));var crypto=require(_0x0db9('0xe'));var jsforce=require(_0x0db9('0xf'));var deskjs=require(_0x0db9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0db9('0x11'));var Papa=require(_0x0db9('0x12'));var Redis=require(_0x0db9('0x13'));var authService=require(_0x0db9('0x14'));var qs=require(_0x0db9('0x15'));var as=require(_0x0db9('0x16'));var hardwareService=require(_0x0db9('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x0db9('0x18'));var config=require(_0x0db9('0x19'));var licenseUtil=require(_0x0db9('0x1a'));var db=require(_0x0db9('0x1b'))['db'];config[_0x0db9('0x1c')]=_[_0x0db9('0x1d')](config[_0x0db9('0x1c')],{'host':_0x0db9('0x1e'),'port':0x18eb});var socket=require(_0x0db9('0x1f'))(new Redis(config[_0x0db9('0x1c')]));require(_0x0db9('0x20'))[_0x0db9('0x21')](socket);function respondWithStatusCode(_0x5a32c6,_0x18870e){_0x18870e=_0x18870e||0xcc;return function(_0xa335ed){if(_0xa335ed){return _0x5a32c6['sendStatus'](_0x18870e);}return _0x5a32c6['status'](_0x18870e)[_0x0db9('0x22')]();};}function respondWithResult(_0x381fa1,_0x5e96ee){_0x5e96ee=_0x5e96ee||0xc8;return function(_0x44591e){if(_0x44591e){return _0x381fa1[_0x0db9('0x23')](_0x5e96ee)['json'](_0x44591e);}};}function respondWithFilteredResult(_0x3a1a39,_0x2e6911){return function(_0x143c0b){if(_0x143c0b){var _0x55c3ec=_0x143c0b['count'],_0x5971bb=_0x2e6911[_0x0db9('0x24')],_0x3bfaaa=_0x2e6911[_0x0db9('0x24')]+_0x2e6911['limit'],_0x2cd3f3;if(_0x3bfaaa>=_0x55c3ec){_0x3bfaaa=_0x55c3ec;_0x2cd3f3=0xc8;}else{_0x2cd3f3=0xce;}_0x3a1a39[_0x0db9('0x23')](_0x2cd3f3);return _0x3a1a39['set'](_0x0db9('0x25'),_0x5971bb+'-'+_0x3bfaaa+'/'+_0x55c3ec)['json'](_0x143c0b);}return null;};}function patchUpdates(_0xf4d2b){return function(_0x1351a8){try{jsonpatch[_0x0db9('0x26')](_0x1351a8,_0xf4d2b,!![]);}catch(_0x1a9e49){return BPromise[_0x0db9('0x27')](_0x1a9e49);}return _0x1351a8['save']();};}function saveUpdates(_0x3dab49,_0x4b5af0){return function(_0x42e04f){if(_0x42e04f){return _0x42e04f[_0x0db9('0x28')](_0x3dab49)[_0x0db9('0x29')](function(_0x517253){return _0x517253;});}return null;};}function removeEntity(_0x54a7f3,_0x5125de){return function(_0x1f1243){if(_0x1f1243){return _0x1f1243[_0x0db9('0x2a')]()[_0x0db9('0x29')](function(){_0x54a7f3[_0x0db9('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d4529,_0x4151e2){return function(_0x7a3dd1){if(!_0x7a3dd1){_0x2d4529[_0x0db9('0x2b')](0x194);}return _0x7a3dd1;};}function handleError(_0x31a60c,_0x21b501){_0x21b501=_0x21b501||0x1f4;return function(_0x58be24){logger[_0x0db9('0x2c')](_0x58be24['stack']);if(_0x58be24[_0x0db9('0x2d')]){delete _0x58be24[_0x0db9('0x2d')];}_0x31a60c['status'](_0x21b501)['send'](_0x58be24);};}exports[_0x0db9('0x2e')]=function(_0x5c5841,_0x1a9a33){var _0x2857ca={},_0x1f1d26={},_0x50f7d0={'count':0x0,'rows':[]};var _0x27e9dc=_[_0x0db9('0x2f')](db[_0x0db9('0x30')]['rawAttributes'],function(_0x49f1de){return{'name':_0x49f1de['fieldName'],'type':_0x49f1de[_0x0db9('0x31')][_0x0db9('0x32')]};});_0x1f1d26[_0x0db9('0x33')]=_[_0x0db9('0x2f')](_0x27e9dc,_0x0db9('0x2d'));_0x1f1d26['query']=_[_0x0db9('0x34')](_0x5c5841[_0x0db9('0x35')]);_0x1f1d26[_0x0db9('0x36')]=_[_0x0db9('0x37')](_0x1f1d26[_0x0db9('0x33')],_0x1f1d26[_0x0db9('0x35')]);_0x2857ca[_0x0db9('0x38')]=_['intersection'](_0x1f1d26['model'],qs[_0x0db9('0x39')](_0x5c5841['query']['fields']));_0x2857ca['attributes']=_0x2857ca[_0x0db9('0x38')][_0x0db9('0x3a')]?_0x2857ca['attributes']:_0x1f1d26['model'];if(!_0x5c5841[_0x0db9('0x35')]['hasOwnProperty']('nolimit')){_0x2857ca[_0x0db9('0x3b')]=qs['limit'](_0x5c5841[_0x0db9('0x35')][_0x0db9('0x3b')]);_0x2857ca[_0x0db9('0x24')]=qs[_0x0db9('0x24')](_0x5c5841[_0x0db9('0x35')]['offset']);}_0x2857ca['order']=qs[_0x0db9('0x3c')](_0x5c5841[_0x0db9('0x35')][_0x0db9('0x3c')]);_0x2857ca['where']=qs[_0x0db9('0x36')](_['pick'](_0x5c5841[_0x0db9('0x35')],_0x1f1d26[_0x0db9('0x36')]),_0x27e9dc);if(_0x5c5841[_0x0db9('0x35')]['filter']){_0x2857ca[_0x0db9('0x3d')]=_['merge'](_0x2857ca[_0x0db9('0x3d')],{'$or':_['map'](_0x27e9dc,function(_0x5b54ba){if(_0x5b54ba[_0x0db9('0x31')]!=='VIRTUAL'){var _0x1c4e4={};_0x1c4e4[_0x5b54ba[_0x0db9('0x2d')]]={'$like':'%'+_0x5c5841[_0x0db9('0x35')]['filter']+'%'};return _0x1c4e4;}})});}_0x2857ca=_[_0x0db9('0x3e')]({},_0x2857ca,_0x5c5841['options']);var _0x167b90={'where':_0x2857ca['where']};return db[_0x0db9('0x30')]['count'](_0x167b90)['then'](function(_0x3f0b4c){_0x50f7d0['count']=_0x3f0b4c;if(_0x5c5841[_0x0db9('0x35')][_0x0db9('0x3f')]){_0x2857ca[_0x0db9('0x40')]=[{'all':!![]}];}return db[_0x0db9('0x30')][_0x0db9('0x41')](_0x2857ca);})[_0x0db9('0x29')](function(_0x37221a){_0x50f7d0[_0x0db9('0x42')]=_0x37221a;return _0x50f7d0;})[_0x0db9('0x29')](respondWithFilteredResult(_0x1a9a33,_0x2857ca))[_0x0db9('0x43')](handleError(_0x1a9a33,null));};exports[_0x0db9('0x44')]=function(_0x1810d1,_0x4614bb){var _0x461c50={'raw':![],'where':{'id':_0x1810d1[_0x0db9('0x45')]['id']}},_0x480945={};_0x480945[_0x0db9('0x33')]=_[_0x0db9('0x34')](db['VoiceQueueReport'][_0x0db9('0x46')]);_0x480945[_0x0db9('0x35')]=_[_0x0db9('0x34')](_0x1810d1[_0x0db9('0x35')]);_0x480945[_0x0db9('0x36')]=_[_0x0db9('0x37')](_0x480945[_0x0db9('0x33')],_0x480945[_0x0db9('0x35')]);_0x461c50[_0x0db9('0x38')]=_['intersection'](_0x480945[_0x0db9('0x33')],qs[_0x0db9('0x39')](_0x1810d1[_0x0db9('0x35')]['fields']));_0x461c50[_0x0db9('0x38')]=_0x461c50[_0x0db9('0x38')]['length']?_0x461c50[_0x0db9('0x38')]:_0x480945[_0x0db9('0x33')];if(_0x1810d1[_0x0db9('0x35')][_0x0db9('0x3f')]){_0x461c50[_0x0db9('0x40')]=[{'all':!![]}];}_0x461c50=_['merge']({},_0x461c50,_0x1810d1[_0x0db9('0x47')]);return db['VoiceQueueReport'][_0x0db9('0x48')](_0x461c50)['then'](handleEntityNotFound(_0x4614bb,null))['then'](respondWithResult(_0x4614bb,null))[_0x0db9('0x43')](handleError(_0x4614bb,null));};exports[_0x0db9('0x49')]=function(_0x15c1ce,_0x57c15f){return db[_0x0db9('0x30')][_0x0db9('0x49')](_0x15c1ce[_0x0db9('0x4a')],{})[_0x0db9('0x29')](respondWithResult(_0x57c15f,0xc9))['catch'](handleError(_0x57c15f,null));};exports[_0x0db9('0x28')]=function(_0x335aa6,_0x571323){if(_0x335aa6[_0x0db9('0x4a')]['id']){delete _0x335aa6[_0x0db9('0x4a')]['id'];}return db[_0x0db9('0x30')]['find']({'where':{'id':_0x335aa6[_0x0db9('0x45')]['id']}})[_0x0db9('0x29')](handleEntityNotFound(_0x571323,null))['then'](saveUpdates(_0x335aa6['body'],null))['then'](respondWithResult(_0x571323,null))[_0x0db9('0x43')](handleError(_0x571323,null));};exports[_0x0db9('0x2a')]=function(_0x532cc9,_0x5cb7dc){return db['VoiceQueueReport']['find']({'where':{'id':_0x532cc9[_0x0db9('0x45')]['id']}})[_0x0db9('0x29')](handleEntityNotFound(_0x5cb7dc,null))[_0x0db9('0x29')](removeEntity(_0x5cb7dc,null))[_0x0db9('0x43')](handleError(_0x5cb7dc,null));};exports['describe']=function(_0x18e8aa,_0x28e7f3){return db[_0x0db9('0x30')][_0x0db9('0x4b')]()[_0x0db9('0x29')](respondWithResult(_0x28e7f3,null))[_0x0db9('0x43')](handleError(_0x28e7f3,null));};exports[_0x0db9('0x4c')]=function(_0x1030eb,_0x6a7d5d){var _0x38ee9a={},_0x4c5358={},_0x271049={'count':0x0,'rows':[]};_0x4c5358[_0x0db9('0x33')]=_['keys'](db['VoiceQueueReport'][_0x0db9('0x46')]);_0x4c5358['query']=_['keys'](_0x1030eb[_0x0db9('0x35')]);_0x4c5358[_0x0db9('0x36')]=_[_0x0db9('0x37')](_0x4c5358['model'],_0x4c5358[_0x0db9('0x35')]);_0x38ee9a['attributes']=_['intersection'](_0x4c5358[_0x0db9('0x33')],qs[_0x0db9('0x39')](_0x1030eb[_0x0db9('0x35')]['fields']));_0x38ee9a['attributes']=_0x38ee9a[_0x0db9('0x38')][_0x0db9('0x3a')]?_0x38ee9a['attributes']:_0x4c5358['model'];if(!_0x1030eb[_0x0db9('0x35')][_0x0db9('0x4d')](_0x0db9('0x4e'))){_0x38ee9a['limit']=qs[_0x0db9('0x3b')](_0x1030eb['query'][_0x0db9('0x3b')]);_0x38ee9a[_0x0db9('0x24')]=qs['offset'](_0x1030eb[_0x0db9('0x35')][_0x0db9('0x24')]);}_0x38ee9a[_0x0db9('0x4f')]=qs[_0x0db9('0x3c')](_0x1030eb[_0x0db9('0x35')][_0x0db9('0x3c')]);_0x38ee9a['where']=qs[_0x0db9('0x36')](_[_0x0db9('0x50')](_0x1030eb['query'],_0x4c5358[_0x0db9('0x36')]));if(_0x1030eb[_0x0db9('0x35')][_0x0db9('0x51')]){_0x38ee9a[_0x0db9('0x3d')]=_[_0x0db9('0x3e')](_0x38ee9a[_0x0db9('0x3d')],{'$or':_[_0x0db9('0x2f')](_0x38ee9a['attributes'],function(_0x5790fb){var _0x57a3b4={};_0x57a3b4[_0x5790fb]={'$like':'%'+_0x1030eb[_0x0db9('0x35')]['filter']+'%'};return _0x57a3b4;})});}_0x38ee9a=_['merge']({},_0x38ee9a,_0x1030eb['options']);var _0x5ea8e0={'where':_0x38ee9a['where']};return db['VoiceQueueReport'][_0x0db9('0x52')](_0x5ea8e0)['then'](function(_0x43695a){_0x271049[_0x0db9('0x52')]=_0x43695a;if(_0x1030eb[_0x0db9('0x35')][_0x0db9('0x3f')]){_0x38ee9a[_0x0db9('0x40')]=[{'all':!![]}];}return db[_0x0db9('0x30')][_0x0db9('0x41')](_0x38ee9a);})[_0x0db9('0x29')](function(_0x16c220){_0x271049[_0x0db9('0x42')]=_0x16c220;return _0x271049;})[_0x0db9('0x29')](respondWithFilteredResult(_0x6a7d5d,_0x38ee9a,'getVoiceQueuesReport'))[_0x0db9('0x43')](handleError(_0x6a7d5d,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b0cf8b7..bfa686e 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 _0x90d1=['hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x77d454,_0x450801){var _0x3e5a3d=function(_0x50e16f){while(--_0x50e16f){_0x77d454['push'](_0x77d454['shift']());}};_0x3e5a3d(++_0x450801);}(_0x90d1,0x158));var _0x190d=function(_0x4a83f4,_0x50f589){_0x4a83f4=_0x4a83f4-0x0;var _0x1fc810=_0x90d1[_0x4a83f4];return _0x1fc810;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x190d('0x0'))['db'][_0x190d('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x190d('0x2')](0x0);var events={'afterCreate':_0x190d('0x3'),'afterUpdate':_0x190d('0x4'),'afterDestroy':_0x190d('0x5')};function emitEvent(_0xa7ec91){return function(_0x262d61,_0x3b8851,_0x2b835a){VoiceQueueReportEvents[_0x190d('0x6')](_0xa7ec91+':'+_0x262d61['id'],_0x262d61);VoiceQueueReportEvents[_0x190d('0x6')](_0xa7ec91,_0x262d61);_0x2b835a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x190d('0x7')](e,emitEvent(event));}}module[_0x190d('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x44fe=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit'];(function(_0x559ab1,_0x4e47c3){var _0x5494ae=function(_0x443a5a){while(--_0x443a5a){_0x559ab1['push'](_0x559ab1['shift']());}};_0x5494ae(++_0x4e47c3);}(_0x44fe,0x1bb));var _0xe44f=function(_0x2e0ff0,_0x409f61){_0x2e0ff0=_0x2e0ff0-0x0;var _0x25bc56=_0x44fe[_0x2e0ff0];return _0x25bc56;};'use strict';var EventEmitter=require(_0xe44f('0x0'));var VoiceQueueReport=require(_0xe44f('0x1'))['db'][_0xe44f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe44f('0x3')](0x0);var events={'afterCreate':_0xe44f('0x4'),'afterUpdate':'update','afterDestroy':_0xe44f('0x5')};function emitEvent(_0x519ee3){return function(_0x51ba35,_0x4af23b,_0x9b438f){VoiceQueueReportEvents[_0xe44f('0x6')](_0x519ee3+':'+_0x51ba35['id'],_0x51ba35);VoiceQueueReportEvents[_0xe44f('0x6')](_0x519ee3,_0x51ba35);_0x9b438f(null);};}for(var e in events){if(events[_0xe44f('0x7')](e)){var event=events[e];VoiceQueueReport[_0xe44f('0x8')](e,emitEvent(event));}}module[_0xe44f('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 c1213fe..da807de 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 _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x2361e4,_0x2effee){var _0x37111e=function(_0x221d2a){while(--_0x221d2a){_0x2361e4['push'](_0x2361e4['shift']());}};_0x37111e(++_0x2effee);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x0b0e[_0x18aaaf];return _0x52d892;};'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')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x48faa4,_0x370786){var _0x5f3fad=function(_0xf8bb57){while(--_0xf8bb57){_0x48faa4['push'](_0x48faa4['shift']());}};_0x5f3fad(++_0x370786);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3f70cd,_0x6bf4ed){_0x3f70cd=_0x3f70cd-0x0;var _0x3feb93=_0x0b0e[_0x3f70cd];return _0x3feb93;};'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')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7c5ffea..2257316 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 _0xc463=['then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','register','request'];(function(_0x389182,_0x3adcb5){var _0x4b6da3=function(_0x4a26cb){while(--_0x4a26cb){_0x389182['push'](_0x389182['shift']());}};_0x4b6da3(++_0x3adcb5);}(_0xc463,0x13a));var _0x3c46=function(_0x351af1,_0x2770f7){_0x351af1=_0x351af1-0x0;var _0x2aaafd=_0xc463[_0x351af1];return _0x2aaafd;};'use strict';var _=require('lodash');var util=require(_0x3c46('0x0'));var moment=require(_0x3c46('0x1'));var BPromise=require(_0x3c46('0x2'));var rs=require(_0x3c46('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c46('0x4'))['db'];var utils=require(_0x3c46('0x5'));var logger=require('../../config/logger')(_0x3c46('0x6'));var config=require(_0x3c46('0x7'));var jayson=require(_0x3c46('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x3c46('0x9')]=_[_0x3c46('0xa')](config[_0x3c46('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c46('0xb'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x3c46('0xc')](socket);function respondWithRpcPromise(_0xbbb401,_0x21f9e6,_0x52803e){return new BPromise(function(_0x431f7f,_0x350594){return client[_0x3c46('0xd')](_0xbbb401,_0x52803e)[_0x3c46('0xe')](function(_0x22de43){logger['info'](_0x3c46('0xf'),_0x21f9e6,_0x3c46('0x10'));logger[_0x3c46('0x11')](_0x3c46('0x12'),_0x21f9e6,_0x3c46('0x10'),JSON[_0x3c46('0x13')](_0x22de43));if(_0x22de43[_0x3c46('0x14')]){if(_0x22de43['error'][_0x3c46('0x15')]===0x1f4){logger[_0x3c46('0x14')](_0x3c46('0xf'),_0x21f9e6,_0x22de43[_0x3c46('0x14')]['message']);return _0x350594(_0x22de43[_0x3c46('0x14')]['message']);}logger[_0x3c46('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x21f9e6,_0x22de43[_0x3c46('0x14')]['message']);return _0x431f7f(_0x22de43[_0x3c46('0x14')][_0x3c46('0x16')]);}else{logger[_0x3c46('0x17')](_0x3c46('0xf'),_0x21f9e6,_0x3c46('0x10'));_0x431f7f(_0x22de43[_0x3c46('0x18')][_0x3c46('0x16')]);}})[_0x3c46('0x19')](function(_0x3a5687){logger[_0x3c46('0x14')](_0x3c46('0xf'),_0x21f9e6,_0x3a5687);_0x350594(_0x3a5687);});});}exports[_0x3c46('0x1a')]=function(_0xa07a89){var _0x1fa043=this;return new Promise(function(_0x106821,_0x370496){return db[_0x3c46('0x1b')][_0x3c46('0x1c')]({'raw':_0xa07a89[_0x3c46('0x1d')]?_0xa07a89[_0x3c46('0x1d')][_0x3c46('0x1e')]===undefined?!![]:![]:!![],'where':_0xa07a89['options']?_0xa07a89[_0x3c46('0x1d')][_0x3c46('0x1f')]||null:null,'attributes':_0xa07a89['options']?_0xa07a89['options']['attributes']||null:null,'limit':_0xa07a89[_0x3c46('0x1d')]?_0xa07a89[_0x3c46('0x1d')][_0x3c46('0x20')]||null:null,'include':_0xa07a89[_0x3c46('0x1d')]?_0xa07a89[_0x3c46('0x1d')][_0x3c46('0x21')]?_[_0x3c46('0x22')](_0xa07a89['options'][_0x3c46('0x21')],function(_0x833d52){return{'model':db[_0x833d52[_0x3c46('0x23')]],'as':_0x833d52['as'],'attributes':_0x833d52[_0x3c46('0x24')],'include':_0x833d52[_0x3c46('0x21')]?_[_0x3c46('0x22')](_0x833d52[_0x3c46('0x21')],function(_0xb5d334){return{'model':db[_0xb5d334[_0x3c46('0x23')]],'as':_0xb5d334['as'],'attributes':_0xb5d334['attributes'],'include':_0xb5d334[_0x3c46('0x21')]?_[_0x3c46('0x22')](_0xb5d334[_0x3c46('0x21')],function(_0x30a590){return{'model':db[_0x30a590[_0x3c46('0x23')]],'as':_0x30a590['as'],'attributes':_0x30a590[_0x3c46('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x598a66){logger['info'](_0x3c46('0x1a'),_0xa07a89);logger[_0x3c46('0x11')](_0x3c46('0x1a'),_0xa07a89,JSON[_0x3c46('0x13')](_0x598a66));_0x106821(_0x598a66);})[_0x3c46('0x19')](function(_0x20542c){logger[_0x3c46('0x14')]('GetVoiceQueueReport',_0x20542c[_0x3c46('0x16')],_0xa07a89);_0x370496(_0x1fa043[_0x3c46('0x14')](0x1f4,_0x20542c[_0x3c46('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x45eb7b){var _0x2a7028=this;return new Promise(function(_0x245e9d,_0x58c3cc){return db[_0x3c46('0x1b')]['create'](_0x45eb7b['body'],{'raw':_0x45eb7b[_0x3c46('0x1d')]?_0x45eb7b['options'][_0x3c46('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x49a5c6){logger[_0x3c46('0x17')]('CreateVoiceQueueReport',_0x45eb7b);logger[_0x3c46('0x11')](_0x3c46('0x25'),_0x45eb7b,JSON['stringify'](_0x49a5c6));_0x245e9d(_0x49a5c6);})[_0x3c46('0x19')](function(_0x8e2f8){logger[_0x3c46('0x14')](_0x3c46('0x25'),_0x8e2f8[_0x3c46('0x16')],_0x45eb7b);_0x58c3cc(_0x2a7028[_0x3c46('0x14')](0x1f4,_0x8e2f8[_0x3c46('0x16')]));});});};exports[_0x3c46('0x26')]=function(_0x2e3887){var _0x47241e=this;return new Promise(function(_0x2a4fdc,_0x14c170){return db[_0x3c46('0x1b')][_0x3c46('0x27')](_0x2e3887[_0x3c46('0x28')],{'raw':_0x2e3887[_0x3c46('0x1d')]?_0x2e3887[_0x3c46('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e3887[_0x3c46('0x1d')]?_0x2e3887['options'][_0x3c46('0x1f')]||null:null,'attributes':_0x2e3887[_0x3c46('0x1d')]?_0x2e3887[_0x3c46('0x1d')]['attributes']||null:null,'limit':_0x2e3887['options']?_0x2e3887[_0x3c46('0x1d')]['limit']||null:null})['then'](function(_0x270635){logger[_0x3c46('0x17')]('UpdateVoiceQueueReport',_0x2e3887);logger[_0x3c46('0x11')]('UpdateVoiceQueueReport',_0x2e3887,JSON[_0x3c46('0x13')](_0x270635));_0x2a4fdc(_0x270635);})[_0x3c46('0x19')](function(_0x8f10ea){logger[_0x3c46('0x14')]('UpdateVoiceQueueReport',_0x8f10ea[_0x3c46('0x16')],_0x2e3887);_0x14c170(_0x47241e[_0x3c46('0x14')](0x1f4,_0x8f10ea[_0x3c46('0x16')]));});});}; \ No newline at end of file +var _0xc584=['options','raw','where','attributes','limit','include','model','map','then','create','CreateVoiceQueueReport','VoiceQueueReport','update','UpdateVoiceQueueReport','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','GetVoiceQueueReport','findAll'];(function(_0x545144,_0xa215cd){var _0x480562=function(_0x4a7cea){while(--_0x4a7cea){_0x545144['push'](_0x545144['shift']());}};_0x480562(++_0xa215cd);}(_0xc584,0x1e7));var _0x4c58=function(_0x46b832,_0x454e18){_0x46b832=_0x46b832-0x0;var _0x42b328=_0xc584[_0x46b832];return _0x42b328;};'use strict';var _=require(_0x4c58('0x0'));var util=require('util');var moment=require(_0x4c58('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c58('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c58('0x3'))['db'];var utils=require(_0x4c58('0x4'));var logger=require('../../config/logger')(_0x4c58('0x5'));var config=require(_0x4c58('0x6'));var jayson=require(_0x4c58('0x7'));var client=jayson[_0x4c58('0x8')][_0x4c58('0x9')]({'port':0x232a});config[_0x4c58('0xa')]=_[_0x4c58('0xb')](config[_0x4c58('0xa')],{'host':_0x4c58('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4c58('0xd'))[_0x4c58('0xe')](socket);function respondWithRpcPromise(_0x49519f,_0x402e1f,_0x4f18fe){return new BPromise(function(_0x37c99a,_0x343d82){return client[_0x4c58('0xf')](_0x49519f,_0x4f18fe)['then'](function(_0x3ef2ea){logger[_0x4c58('0x10')](_0x4c58('0x11'),_0x402e1f,'request\x20sent');logger[_0x4c58('0x12')](_0x4c58('0x13'),_0x402e1f,'request\x20sent',JSON[_0x4c58('0x14')](_0x3ef2ea));if(_0x3ef2ea['error']){if(_0x3ef2ea['error'][_0x4c58('0x15')]===0x1f4){logger[_0x4c58('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x402e1f,_0x3ef2ea['error'][_0x4c58('0x17')]);return _0x343d82(_0x3ef2ea['error']['message']);}logger[_0x4c58('0x16')](_0x4c58('0x11'),_0x402e1f,_0x3ef2ea[_0x4c58('0x16')][_0x4c58('0x17')]);return _0x37c99a(_0x3ef2ea[_0x4c58('0x16')][_0x4c58('0x17')]);}else{logger[_0x4c58('0x10')](_0x4c58('0x11'),_0x402e1f,_0x4c58('0x18'));_0x37c99a(_0x3ef2ea[_0x4c58('0x19')][_0x4c58('0x17')]);}})[_0x4c58('0x1a')](function(_0x1f935c){logger[_0x4c58('0x16')](_0x4c58('0x11'),_0x402e1f,_0x1f935c);_0x343d82(_0x1f935c);});});}exports[_0x4c58('0x1b')]=function(_0x11dca5){var _0x53c2f5=this;return new Promise(function(_0x3a8969,_0x4a1be3){return db['VoiceQueueReport'][_0x4c58('0x1c')]({'raw':_0x11dca5[_0x4c58('0x1d')]?_0x11dca5[_0x4c58('0x1d')][_0x4c58('0x1e')]===undefined?!![]:![]:!![],'where':_0x11dca5[_0x4c58('0x1d')]?_0x11dca5[_0x4c58('0x1d')][_0x4c58('0x1f')]||null:null,'attributes':_0x11dca5[_0x4c58('0x1d')]?_0x11dca5[_0x4c58('0x1d')][_0x4c58('0x20')]||null:null,'limit':_0x11dca5[_0x4c58('0x1d')]?_0x11dca5[_0x4c58('0x1d')][_0x4c58('0x21')]||null:null,'include':_0x11dca5[_0x4c58('0x1d')]?_0x11dca5[_0x4c58('0x1d')]['include']?_['map'](_0x11dca5['options'][_0x4c58('0x22')],function(_0xc18f5a){return{'model':db[_0xc18f5a[_0x4c58('0x23')]],'as':_0xc18f5a['as'],'attributes':_0xc18f5a[_0x4c58('0x20')],'include':_0xc18f5a[_0x4c58('0x22')]?_[_0x4c58('0x24')](_0xc18f5a[_0x4c58('0x22')],function(_0x1a078c){return{'model':db[_0x1a078c['model']],'as':_0x1a078c['as'],'attributes':_0x1a078c[_0x4c58('0x20')],'include':_0x1a078c[_0x4c58('0x22')]?_[_0x4c58('0x24')](_0x1a078c[_0x4c58('0x22')],function(_0x11f4d1){return{'model':db[_0x11f4d1[_0x4c58('0x23')]],'as':_0x11f4d1['as'],'attributes':_0x11f4d1[_0x4c58('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4c58('0x25')](function(_0x1969c5){logger[_0x4c58('0x10')]('GetVoiceQueueReport',_0x11dca5);logger[_0x4c58('0x12')](_0x4c58('0x1b'),_0x11dca5,JSON[_0x4c58('0x14')](_0x1969c5));_0x3a8969(_0x1969c5);})[_0x4c58('0x1a')](function(_0x19c901){logger[_0x4c58('0x16')](_0x4c58('0x1b'),_0x19c901[_0x4c58('0x17')],_0x11dca5);_0x4a1be3(_0x53c2f5[_0x4c58('0x16')](0x1f4,_0x19c901[_0x4c58('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x2b29ee){var _0x3af169=this;return new Promise(function(_0x66ef6a,_0x22d08e){return db['VoiceQueueReport'][_0x4c58('0x26')](_0x2b29ee['body'],{'raw':_0x2b29ee['options']?_0x2b29ee[_0x4c58('0x1d')][_0x4c58('0x1e')]===undefined?!![]:![]:!![]})[_0x4c58('0x25')](function(_0x29f545){logger[_0x4c58('0x10')](_0x4c58('0x27'),_0x2b29ee);logger[_0x4c58('0x12')]('CreateVoiceQueueReport',_0x2b29ee,JSON[_0x4c58('0x14')](_0x29f545));_0x66ef6a(_0x29f545);})[_0x4c58('0x1a')](function(_0x2a51aa){logger[_0x4c58('0x16')](_0x4c58('0x27'),_0x2a51aa[_0x4c58('0x17')],_0x2b29ee);_0x22d08e(_0x3af169[_0x4c58('0x16')](0x1f4,_0x2a51aa[_0x4c58('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x23c208){var _0x186f6e=this;return new Promise(function(_0x525ea8,_0x21f17d){return db[_0x4c58('0x28')][_0x4c58('0x29')](_0x23c208['body'],{'raw':_0x23c208[_0x4c58('0x1d')]?_0x23c208[_0x4c58('0x1d')][_0x4c58('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c208[_0x4c58('0x1d')]?_0x23c208[_0x4c58('0x1d')][_0x4c58('0x1f')]||null:null,'attributes':_0x23c208['options']?_0x23c208['options']['attributes']||null:null,'limit':_0x23c208[_0x4c58('0x1d')]?_0x23c208[_0x4c58('0x1d')][_0x4c58('0x21')]||null:null})[_0x4c58('0x25')](function(_0x39c251){logger[_0x4c58('0x10')](_0x4c58('0x2a'),_0x23c208);logger[_0x4c58('0x12')]('UpdateVoiceQueueReport',_0x23c208,JSON[_0x4c58('0x14')](_0x39c251));_0x525ea8(_0x39c251);})['catch'](function(_0x459a73){logger[_0x4c58('0x16')](_0x4c58('0x2a'),_0x459a73[_0x4c58('0x17')],_0x23c208);_0x21f17d(_0x186f6e[_0x4c58('0x16')](0x1f4,_0x459a73['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 57ad5e0..94b3540 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 _0x7ca3=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','emit'];(function(_0x5ca164,_0x533cb5){var _0x54bdbb=function(_0x4f2daa){while(--_0x4f2daa){_0x5ca164['push'](_0x5ca164['shift']());}};_0x54bdbb(++_0x533cb5);}(_0x7ca3,0x6d));var _0x37ca=function(_0x28d391,_0x1357b3){_0x28d391=_0x28d391-0x0;var _0x3c8bf0=_0x7ca3[_0x28d391];return _0x3c8bf0;};'use strict';var VoiceQueueReportEvents=require(_0x37ca('0x0'));var events=[_0x37ca('0x1'),'remove','update'];function createListener(_0x27a551,_0x136453){return function(_0x1d7a27){_0x136453[_0x37ca('0x2')](_0x27a551,_0x1d7a27);};}function removeListener(_0x2b3da3,_0x64931){return function(){VoiceQueueReportEvents[_0x37ca('0x3')](_0x2b3da3,_0x64931);};}exports[_0x37ca('0x4')]=function(_0x24b2cc){for(var _0x1825b3=0x0,_0x38ed5d=events[_0x37ca('0x5')];_0x1825b3<_0x38ed5d;_0x1825b3++){var _0x27c755=events[_0x1825b3];var _0x3855d0=createListener(_0x37ca('0x6')+_0x27c755,_0x24b2cc);VoiceQueueReportEvents['on'](_0x27c755,_0x3855d0);}}; \ No newline at end of file +var _0x180c=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x180c,0xea));var _0xc180=function(_0x36fba8,_0x3b33c0){_0x36fba8=_0x36fba8-0x0;var _0x23e0db=_0x180c[_0x36fba8];return _0x23e0db;};'use strict';var VoiceQueueReportEvents=require(_0xc180('0x0'));var events=[_0xc180('0x1'),_0xc180('0x2'),_0xc180('0x3')];function createListener(_0x4db04c,_0x93c1fa){return function(_0x35ac5b){_0x93c1fa[_0xc180('0x4')](_0x4db04c,_0x35ac5b);};}function removeListener(_0x14c7a3,_0x3c88cf){return function(){VoiceQueueReportEvents[_0xc180('0x5')](_0x14c7a3,_0x3c88cf);};}exports[_0xc180('0x6')]=function(_0x296873){for(var _0x9147=0x0,_0xbd7111=events[_0xc180('0x7')];_0x9147<_0xbd7111;_0x9147++){var _0x43c60b=events[_0x9147];var _0x311a9f=createListener(_0xc180('0x8')+_0x43c60b,_0x296873);VoiceQueueReportEvents['on'](_0x43c60b,_0x311a9f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6a64570..15ecd3b 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 _0x8ac9=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8ac9,0x199));var _0x98ac=function(_0x277a2b,_0xcc97db){_0x277a2b=_0x277a2b-0x0;var _0x61ff6b=_0x8ac9[_0x277a2b];return _0x61ff6b;};'use strict';var multer=require(_0x98ac('0x0'));var util=require(_0x98ac('0x1'));var path=require(_0x98ac('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x98ac('0x3')]();var fs_extra=require(_0x98ac('0x4'));var auth=require(_0x98ac('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x98ac('0x6'));router[_0x98ac('0x7')]('/',auth[_0x98ac('0x8')](),controller['index']);router['get'](_0x98ac('0x9'),auth[_0x98ac('0x8')](),controller[_0x98ac('0xa')]);router[_0x98ac('0xb')]('/',auth[_0x98ac('0x8')](),controller[_0x98ac('0xc')]);router['put'](_0x98ac('0x9'),auth['isAuthenticated'](),controller[_0x98ac('0xd')]);router[_0x98ac('0xe')](_0x98ac('0x9'),auth[_0x98ac('0x8')](),controller[_0x98ac('0xf')]);module[_0x98ac('0x10')]=router; \ No newline at end of file +var _0x62f1=['index','isAuthenticated','show','post','create','put','/:id','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x62f1,0x112));var _0x162f=function(_0x5bfd3b,_0x1633f2){_0x5bfd3b=_0x5bfd3b-0x0;var _0x403f95=_0x62f1[_0x5bfd3b];return _0x403f95;};'use strict';var multer=require(_0x162f('0x0'));var util=require('util');var path=require(_0x162f('0x1'));var timeout=require(_0x162f('0x2'));var express=require(_0x162f('0x3'));var router=express[_0x162f('0x4')]();var fs_extra=require(_0x162f('0x5'));var auth=require(_0x162f('0x6'));var interaction=require(_0x162f('0x7'));var config=require(_0x162f('0x8'));var controller=require(_0x162f('0x9'));router[_0x162f('0xa')]('/',auth['isAuthenticated'](),controller[_0x162f('0xb')]);router[_0x162f('0xa')]('/:id',auth[_0x162f('0xc')](),controller[_0x162f('0xd')]);router[_0x162f('0xe')]('/',auth['isAuthenticated'](),controller[_0x162f('0xf')]);router[_0x162f('0x10')](_0x162f('0x11'),auth[_0x162f('0xc')](),controller['update']);router[_0x162f('0x12')](_0x162f('0x11'),auth[_0x162f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index adb23e5..68beccb 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 _0x381b=['moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0xf5f04a,_0x11bc06){var _0x47ff3b=function(_0x40b3a4){while(--_0x40b3a4){_0xf5f04a['push'](_0xf5f04a['shift']());}};_0x47ff3b(++_0x11bc06);}(_0x381b,0x179));var _0xb381=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x381b[_0x49c057];return _0xd8f0e6;};'use strict';var Sequelize=require(_0xb381('0x0'));var moment=require(_0xb381('0x1'));module[_0xb381('0x2')]={'time':{'type':Sequelize[_0xb381('0x3')]},'callid':{'type':Sequelize[_0xb381('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb381('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb381('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb381('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb381('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb381('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb381('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb381('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb381('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xb381('0x5'))}}; \ No newline at end of file +var _0x08ba=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x586c70,_0x4a8cb3){var _0x26db79=function(_0xbfa842){while(--_0xbfa842){_0x586c70['push'](_0x586c70['shift']());}};_0x26db79(++_0x4a8cb3);}(_0x08ba,0xd6));var _0xa08b=function(_0x236023,_0x20dea0){_0x236023=_0x236023-0x0;var _0x5f0ceb=_0x08ba[_0x236023];return _0x5f0ceb;};'use strict';var Sequelize=require(_0xa08b('0x0'));var moment=require(_0xa08b('0x1'));module[_0xa08b('0x2')]={'time':{'type':Sequelize[_0xa08b('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa08b('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa08b('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa08b('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa08b('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa08b('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa08b('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa08b('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa08b('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa08b('0x4')],'allowNull':![],'defaultValue':moment()[_0xa08b('0x5')](_0xa08b('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 03d422d..85fe448 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 _0xcc1b=['sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','where','pick','merge','filter','options','count','include','findAll','rows','catch','length','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x5f162a,_0x224503){var _0x35a073=function(_0xecfae3){while(--_0xecfae3){_0x5f162a['push'](_0x5f162a['shift']());}};_0x35a073(++_0x224503);}(_0xcc1b,0x89));var _0xbcc1=function(_0x587546,_0x28edf1){_0x587546=_0x587546-0x0;var _0x5a9bb4=_0xcc1b[_0x587546];return _0x5a9bb4;};'use strict';var pdf=require(_0xbcc1('0x0'));var emlformat=require(_0xbcc1('0x1'));var rimraf=require(_0xbcc1('0x2'));var zipdir=require(_0xbcc1('0x3'));var jsonpatch=require(_0xbcc1('0x4'));var rp=require(_0xbcc1('0x5'));var moment=require('moment');var BPromise=require(_0xbcc1('0x6'));var Mustache=require(_0xbcc1('0x7'));var util=require(_0xbcc1('0x8'));var path=require('path');var sox=require(_0xbcc1('0x9'));var csv=require('to-csv');var ejs=require(_0xbcc1('0xa'));var fs=require('fs');var fs_extra=require(_0xbcc1('0xb'));var _=require('lodash');var squel=require(_0xbcc1('0xc'));var crypto=require(_0xbcc1('0xd'));var jsforce=require(_0xbcc1('0xe'));var deskjs=require(_0xbcc1('0xf'));var toCsv=require(_0xbcc1('0x10'));var querystring=require(_0xbcc1('0x11'));var Papa=require(_0xbcc1('0x12'));var Redis=require(_0xbcc1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbcc1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcc1('0x15'))(_0xbcc1('0x16'));var utils=require(_0xbcc1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbcc1('0x18'));var db=require(_0xbcc1('0x19'))['db'];function respondWithStatusCode(_0x186785,_0x29a04c){_0x29a04c=_0x29a04c||0xcc;return function(_0x279f7b){if(_0x279f7b){return _0x186785['sendStatus'](_0x29a04c);}return _0x186785[_0xbcc1('0x1a')](_0x29a04c)[_0xbcc1('0x1b')]();};}function respondWithResult(_0x2a3cb4,_0x1d66cf){_0x1d66cf=_0x1d66cf||0xc8;return function(_0x315678){if(_0x315678){return _0x2a3cb4['status'](_0x1d66cf)[_0xbcc1('0x1c')](_0x315678);}};}function respondWithFilteredResult(_0x121c47,_0x205666){return function(_0x56b1fa){if(_0x56b1fa){var _0x2788f1=_0x56b1fa['count'],_0x36cc25=_0x205666[_0xbcc1('0x1d')],_0x5bb838=_0x205666[_0xbcc1('0x1d')]+_0x205666[_0xbcc1('0x1e')],_0x9a3f2;if(_0x5bb838>=_0x2788f1){_0x5bb838=_0x2788f1;_0x9a3f2=0xc8;}else{_0x9a3f2=0xce;}_0x121c47['status'](_0x9a3f2);return _0x121c47[_0xbcc1('0x1f')](_0xbcc1('0x20'),_0x36cc25+'-'+_0x5bb838+'/'+_0x2788f1)[_0xbcc1('0x1c')](_0x56b1fa);}return null;};}function patchUpdates(_0x300774){return function(_0x394c94){try{jsonpatch[_0xbcc1('0x21')](_0x394c94,_0x300774,!![]);}catch(_0x2a8ea3){return BPromise[_0xbcc1('0x22')](_0x2a8ea3);}return _0x394c94[_0xbcc1('0x23')]();};}function saveUpdates(_0x39d32a,_0x1862c0){return function(_0x39e10d){if(_0x39e10d){return _0x39e10d[_0xbcc1('0x24')](_0x39d32a)[_0xbcc1('0x25')](function(_0x5177da){return _0x5177da;});}return null;};}function removeEntity(_0x23d1fa,_0x4e3e11){return function(_0xc3af1){if(_0xc3af1){return _0xc3af1[_0xbcc1('0x26')]()[_0xbcc1('0x25')](function(){_0x23d1fa[_0xbcc1('0x1a')](0xcc)[_0xbcc1('0x1b')]();});}};}function handleEntityNotFound(_0x24388d,_0x5568a5){return function(_0x175cbd){if(!_0x175cbd){_0x24388d[_0xbcc1('0x27')](0x194);}return _0x175cbd;};}function handleError(_0xf3f7cf,_0x3bc96f){_0x3bc96f=_0x3bc96f||0x1f4;return function(_0x5ad8ea){logger[_0xbcc1('0x28')](_0x5ad8ea['stack']);if(_0x5ad8ea['name']){delete _0x5ad8ea[_0xbcc1('0x29')];}_0xf3f7cf[_0xbcc1('0x1a')](_0x3bc96f)[_0xbcc1('0x2a')](_0x5ad8ea);};}exports['index']=function(_0x5a2783,_0x131e50){var _0x588754={},_0x376f1b={},_0x2a79dd={'count':0x0,'rows':[]};var _0x47dde4=_[_0xbcc1('0x2b')](db[_0xbcc1('0x2c')][_0xbcc1('0x2d')],function(_0x4eccde){return{'name':_0x4eccde[_0xbcc1('0x2e')],'type':_0x4eccde[_0xbcc1('0x2f')]['key']};});_0x376f1b['model']=_['map'](_0x47dde4,_0xbcc1('0x29'));_0x376f1b[_0xbcc1('0x30')]=_[_0xbcc1('0x31')](_0x5a2783[_0xbcc1('0x30')]);_0x376f1b[_0xbcc1('0x32')]=_[_0xbcc1('0x33')](_0x376f1b[_0xbcc1('0x34')],_0x376f1b[_0xbcc1('0x30')]);_0x588754[_0xbcc1('0x35')]=_['intersection'](_0x376f1b[_0xbcc1('0x34')],qs[_0xbcc1('0x36')](_0x5a2783[_0xbcc1('0x30')][_0xbcc1('0x36')]));_0x588754['attributes']=_0x588754[_0xbcc1('0x35')]['length']?_0x588754[_0xbcc1('0x35')]:_0x376f1b[_0xbcc1('0x34')];if(!_0x5a2783[_0xbcc1('0x30')]['hasOwnProperty'](_0xbcc1('0x37'))){_0x588754[_0xbcc1('0x1e')]=qs['limit'](_0x5a2783[_0xbcc1('0x30')][_0xbcc1('0x1e')]);_0x588754[_0xbcc1('0x1d')]=qs[_0xbcc1('0x1d')](_0x5a2783[_0xbcc1('0x30')][_0xbcc1('0x1d')]);}_0x588754[_0xbcc1('0x38')]=qs['sort'](_0x5a2783[_0xbcc1('0x30')]['sort']);_0x588754[_0xbcc1('0x39')]=qs[_0xbcc1('0x32')](_[_0xbcc1('0x3a')](_0x5a2783[_0xbcc1('0x30')],_0x376f1b[_0xbcc1('0x32')]),_0x47dde4);if(_0x5a2783[_0xbcc1('0x30')]['filter']){_0x588754[_0xbcc1('0x39')]=_[_0xbcc1('0x3b')](_0x588754[_0xbcc1('0x39')],{'$or':_[_0xbcc1('0x2b')](_0x47dde4,function(_0x1be357){if(_0x1be357['type']!=='VIRTUAL'){var _0x2ede7b={};_0x2ede7b[_0x1be357[_0xbcc1('0x29')]]={'$like':'%'+_0x5a2783[_0xbcc1('0x30')][_0xbcc1('0x3c')]+'%'};return _0x2ede7b;}})});}_0x588754=_[_0xbcc1('0x3b')]({},_0x588754,_0x5a2783[_0xbcc1('0x3d')]);var _0x5de0bf={'where':_0x588754[_0xbcc1('0x39')]};return db[_0xbcc1('0x2c')][_0xbcc1('0x3e')](_0x5de0bf)[_0xbcc1('0x25')](function(_0x45b9c9){_0x2a79dd[_0xbcc1('0x3e')]=_0x45b9c9;if(_0x5a2783['query']['includeAll']){_0x588754[_0xbcc1('0x3f')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xbcc1('0x40')](_0x588754);})[_0xbcc1('0x25')](function(_0x1afc2a){_0x2a79dd[_0xbcc1('0x41')]=_0x1afc2a;return _0x2a79dd;})['then'](respondWithFilteredResult(_0x131e50,_0x588754))[_0xbcc1('0x42')](handleError(_0x131e50,null));};exports['show']=function(_0x4b5615,_0x2a0688){var _0x43f71a={'raw':!![],'where':{'id':_0x4b5615['params']['id']}},_0xa78bc3={};_0xa78bc3[_0xbcc1('0x34')]=_['keys'](db[_0xbcc1('0x2c')]['rawAttributes']);_0xa78bc3[_0xbcc1('0x30')]=_[_0xbcc1('0x31')](_0x4b5615[_0xbcc1('0x30')]);_0xa78bc3['filters']=_['intersection'](_0xa78bc3[_0xbcc1('0x34')],_0xa78bc3[_0xbcc1('0x30')]);_0x43f71a[_0xbcc1('0x35')]=_[_0xbcc1('0x33')](_0xa78bc3[_0xbcc1('0x34')],qs['fields'](_0x4b5615[_0xbcc1('0x30')][_0xbcc1('0x36')]));_0x43f71a['attributes']=_0x43f71a['attributes'][_0xbcc1('0x43')]?_0x43f71a[_0xbcc1('0x35')]:_0xa78bc3[_0xbcc1('0x34')];if(_0x4b5615['query'][_0xbcc1('0x44')]){_0x43f71a['include']=[{'all':!![]}];}_0x43f71a=_['merge']({},_0x43f71a,_0x4b5615[_0xbcc1('0x3d')]);return db[_0xbcc1('0x2c')][_0xbcc1('0x45')](_0x43f71a)[_0xbcc1('0x25')](handleEntityNotFound(_0x2a0688,null))['then'](respondWithResult(_0x2a0688,null))['catch'](handleError(_0x2a0688,null));};exports[_0xbcc1('0x46')]=function(_0x199f5d,_0x43aef0){return db['VoiceQueuesLog'][_0xbcc1('0x46')](_0x199f5d[_0xbcc1('0x47')],{})[_0xbcc1('0x25')](respondWithResult(_0x43aef0,0xc9))[_0xbcc1('0x42')](handleError(_0x43aef0,null));};exports['update']=function(_0x52b482,_0x3df4e2){if(_0x52b482[_0xbcc1('0x47')]['id']){delete _0x52b482['body']['id'];}return db['VoiceQueuesLog'][_0xbcc1('0x45')]({'where':{'id':_0x52b482[_0xbcc1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3df4e2,null))['then'](saveUpdates(_0x52b482[_0xbcc1('0x47')],null))[_0xbcc1('0x25')](respondWithResult(_0x3df4e2,null))[_0xbcc1('0x42')](handleError(_0x3df4e2,null));};exports[_0xbcc1('0x26')]=function(_0x23aed2,_0x141a5f){return db[_0xbcc1('0x2c')][_0xbcc1('0x45')]({'where':{'id':_0x23aed2[_0xbcc1('0x48')]['id']}})[_0xbcc1('0x25')](handleEntityNotFound(_0x141a5f,null))['then'](removeEntity(_0x141a5f,null))[_0xbcc1('0x42')](handleError(_0x141a5f,null));}; \ No newline at end of file +var _0xd722=['catch','show','params','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','VoiceQueuesLog','includeAll','include','findAll','rows'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xd722,0x191));var _0x2d72=function(_0x2b7970,_0x373e41){_0x2b7970=_0x2b7970-0x0;var _0x4df874=_0xd722[_0x2b7970];return _0x4df874;};'use strict';var pdf=require(_0x2d72('0x0'));var emlformat=require(_0x2d72('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2d72('0x2'));var jsonpatch=require(_0x2d72('0x3'));var rp=require(_0x2d72('0x4'));var moment=require(_0x2d72('0x5'));var BPromise=require(_0x2d72('0x6'));var Mustache=require(_0x2d72('0x7'));var util=require(_0x2d72('0x8'));var path=require(_0x2d72('0x9'));var sox=require(_0x2d72('0xa'));var csv=require('to-csv');var ejs=require(_0x2d72('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d72('0xc'));var squel=require(_0x2d72('0xd'));var crypto=require(_0x2d72('0xe'));var jsforce=require(_0x2d72('0xf'));var deskjs=require(_0x2d72('0x10'));var toCsv=require(_0x2d72('0x11'));var querystring=require('querystring');var Papa=require(_0x2d72('0x12'));var Redis=require(_0x2d72('0x13'));var authService=require(_0x2d72('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2d72('0x15'));var hardwareService=require(_0x2d72('0x16'));var logger=require(_0x2d72('0x17'))(_0x2d72('0x18'));var utils=require(_0x2d72('0x19'));var config=require(_0x2d72('0x1a'));var licenseUtil=require(_0x2d72('0x1b'));var db=require(_0x2d72('0x1c'))['db'];function respondWithStatusCode(_0x394bf7,_0x2d3a40){_0x2d3a40=_0x2d3a40||0xcc;return function(_0x37597c){if(_0x37597c){return _0x394bf7[_0x2d72('0x1d')](_0x2d3a40);}return _0x394bf7[_0x2d72('0x1e')](_0x2d3a40)[_0x2d72('0x1f')]();};}function respondWithResult(_0x289e61,_0x30e11e){_0x30e11e=_0x30e11e||0xc8;return function(_0x4244dc){if(_0x4244dc){return _0x289e61['status'](_0x30e11e)[_0x2d72('0x20')](_0x4244dc);}};}function respondWithFilteredResult(_0x5a4384,_0x8f49ea){return function(_0x39607e){if(_0x39607e){var _0x50247b=_0x39607e[_0x2d72('0x21')],_0x4c6f75=_0x8f49ea[_0x2d72('0x22')],_0xe7bda7=_0x8f49ea['offset']+_0x8f49ea['limit'],_0x243e98;if(_0xe7bda7>=_0x50247b){_0xe7bda7=_0x50247b;_0x243e98=0xc8;}else{_0x243e98=0xce;}_0x5a4384['status'](_0x243e98);return _0x5a4384[_0x2d72('0x23')](_0x2d72('0x24'),_0x4c6f75+'-'+_0xe7bda7+'/'+_0x50247b)[_0x2d72('0x20')](_0x39607e);}return null;};}function patchUpdates(_0x3e0958){return function(_0xe1dff2){try{jsonpatch[_0x2d72('0x25')](_0xe1dff2,_0x3e0958,!![]);}catch(_0x518340){return BPromise[_0x2d72('0x26')](_0x518340);}return _0xe1dff2[_0x2d72('0x27')]();};}function saveUpdates(_0x5db306,_0x5ee65d){return function(_0x477974){if(_0x477974){return _0x477974[_0x2d72('0x28')](_0x5db306)['then'](function(_0x469843){return _0x469843;});}return null;};}function removeEntity(_0x23d24c,_0x30967c){return function(_0x3ba6f9){if(_0x3ba6f9){return _0x3ba6f9[_0x2d72('0x29')]()[_0x2d72('0x2a')](function(){_0x23d24c[_0x2d72('0x1e')](0xcc)[_0x2d72('0x1f')]();});}};}function handleEntityNotFound(_0x72b0f4,_0xb65955){return function(_0x58f503){if(!_0x58f503){_0x72b0f4['sendStatus'](0x194);}return _0x58f503;};}function handleError(_0x62e52e,_0x268159){_0x268159=_0x268159||0x1f4;return function(_0x1540b2){logger[_0x2d72('0x2b')](_0x1540b2[_0x2d72('0x2c')]);if(_0x1540b2[_0x2d72('0x2d')]){delete _0x1540b2[_0x2d72('0x2d')];}_0x62e52e[_0x2d72('0x1e')](_0x268159)[_0x2d72('0x2e')](_0x1540b2);};}exports[_0x2d72('0x2f')]=function(_0x4ef0fe,_0x5d6369){var _0x921cb={},_0x50f9e9={},_0x19eb03={'count':0x0,'rows':[]};var _0x2e9c4e=_[_0x2d72('0x30')](db['VoiceQueuesLog'][_0x2d72('0x31')],function(_0x5db933){return{'name':_0x5db933['fieldName'],'type':_0x5db933[_0x2d72('0x32')][_0x2d72('0x33')]};});_0x50f9e9[_0x2d72('0x34')]=_[_0x2d72('0x30')](_0x2e9c4e,_0x2d72('0x2d'));_0x50f9e9[_0x2d72('0x35')]=_[_0x2d72('0x36')](_0x4ef0fe['query']);_0x50f9e9[_0x2d72('0x37')]=_[_0x2d72('0x38')](_0x50f9e9[_0x2d72('0x34')],_0x50f9e9['query']);_0x921cb[_0x2d72('0x39')]=_[_0x2d72('0x38')](_0x50f9e9[_0x2d72('0x34')],qs[_0x2d72('0x3a')](_0x4ef0fe['query'][_0x2d72('0x3a')]));_0x921cb[_0x2d72('0x39')]=_0x921cb[_0x2d72('0x39')]['length']?_0x921cb[_0x2d72('0x39')]:_0x50f9e9[_0x2d72('0x34')];if(!_0x4ef0fe['query'][_0x2d72('0x3b')]('nolimit')){_0x921cb[_0x2d72('0x3c')]=qs[_0x2d72('0x3c')](_0x4ef0fe['query']['limit']);_0x921cb['offset']=qs[_0x2d72('0x22')](_0x4ef0fe['query'][_0x2d72('0x22')]);}_0x921cb[_0x2d72('0x3d')]=qs[_0x2d72('0x3e')](_0x4ef0fe['query']['sort']);_0x921cb[_0x2d72('0x3f')]=qs[_0x2d72('0x37')](_[_0x2d72('0x40')](_0x4ef0fe[_0x2d72('0x35')],_0x50f9e9[_0x2d72('0x37')]),_0x2e9c4e);if(_0x4ef0fe['query'][_0x2d72('0x41')]){_0x921cb[_0x2d72('0x3f')]=_[_0x2d72('0x42')](_0x921cb[_0x2d72('0x3f')],{'$or':_['map'](_0x2e9c4e,function(_0x436375){if(_0x436375[_0x2d72('0x32')]!=='VIRTUAL'){var _0x554087={};_0x554087[_0x436375[_0x2d72('0x2d')]]={'$like':'%'+_0x4ef0fe[_0x2d72('0x35')]['filter']+'%'};return _0x554087;}})});}_0x921cb=_['merge']({},_0x921cb,_0x4ef0fe[_0x2d72('0x43')]);var _0x3f11a4={'where':_0x921cb[_0x2d72('0x3f')]};return db[_0x2d72('0x44')]['count'](_0x3f11a4)[_0x2d72('0x2a')](function(_0x34a43e){_0x19eb03[_0x2d72('0x21')]=_0x34a43e;if(_0x4ef0fe['query'][_0x2d72('0x45')]){_0x921cb[_0x2d72('0x46')]=[{'all':!![]}];}return db[_0x2d72('0x44')][_0x2d72('0x47')](_0x921cb);})[_0x2d72('0x2a')](function(_0x1dee00){_0x19eb03[_0x2d72('0x48')]=_0x1dee00;return _0x19eb03;})[_0x2d72('0x2a')](respondWithFilteredResult(_0x5d6369,_0x921cb))[_0x2d72('0x49')](handleError(_0x5d6369,null));};exports[_0x2d72('0x4a')]=function(_0x9530d1,_0x138e4f){var _0x1d1d20={'raw':!![],'where':{'id':_0x9530d1[_0x2d72('0x4b')]['id']}},_0x415b8f={};_0x415b8f['model']=_[_0x2d72('0x36')](db[_0x2d72('0x44')][_0x2d72('0x31')]);_0x415b8f[_0x2d72('0x35')]=_[_0x2d72('0x36')](_0x9530d1['query']);_0x415b8f[_0x2d72('0x37')]=_[_0x2d72('0x38')](_0x415b8f[_0x2d72('0x34')],_0x415b8f['query']);_0x1d1d20[_0x2d72('0x39')]=_['intersection'](_0x415b8f[_0x2d72('0x34')],qs[_0x2d72('0x3a')](_0x9530d1['query'][_0x2d72('0x3a')]));_0x1d1d20['attributes']=_0x1d1d20[_0x2d72('0x39')]['length']?_0x1d1d20['attributes']:_0x415b8f[_0x2d72('0x34')];if(_0x9530d1['query']['includeAll']){_0x1d1d20[_0x2d72('0x46')]=[{'all':!![]}];}_0x1d1d20=_['merge']({},_0x1d1d20,_0x9530d1[_0x2d72('0x43')]);return db[_0x2d72('0x44')][_0x2d72('0x4c')](_0x1d1d20)['then'](handleEntityNotFound(_0x138e4f,null))[_0x2d72('0x2a')](respondWithResult(_0x138e4f,null))['catch'](handleError(_0x138e4f,null));};exports[_0x2d72('0x4d')]=function(_0x4c2d14,_0x568582){return db[_0x2d72('0x44')][_0x2d72('0x4d')](_0x4c2d14['body'],{})[_0x2d72('0x2a')](respondWithResult(_0x568582,0xc9))[_0x2d72('0x49')](handleError(_0x568582,null));};exports[_0x2d72('0x28')]=function(_0x45cb6b,_0x39f15e){if(_0x45cb6b[_0x2d72('0x4e')]['id']){delete _0x45cb6b[_0x2d72('0x4e')]['id'];}return db[_0x2d72('0x44')][_0x2d72('0x4c')]({'where':{'id':_0x45cb6b[_0x2d72('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39f15e,null))[_0x2d72('0x2a')](saveUpdates(_0x45cb6b[_0x2d72('0x4e')],null))[_0x2d72('0x2a')](respondWithResult(_0x39f15e,null))[_0x2d72('0x49')](handleError(_0x39f15e,null));};exports[_0x2d72('0x29')]=function(_0x274053,_0x39cfc2){return db['VoiceQueuesLog']['find']({'where':{'id':_0x274053['params']['id']}})['then'](handleEntityNotFound(_0x39cfc2,null))['then'](removeEntity(_0x39cfc2,null))[_0x2d72('0x49')](handleError(_0x39cfc2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6e9dbe6..30d5675 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 _0x59c6=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x271456,_0x4ed63d){var _0x4247df=function(_0x5340e2){while(--_0x5340e2){_0x271456['push'](_0x271456['shift']());}};_0x4247df(++_0x4ed63d);}(_0x59c6,0x8e));var _0x659c=function(_0x2a242a,_0x54e374){_0x2a242a=_0x2a242a-0x0;var _0x5c6faa=_0x59c6[_0x2a242a];return _0x5c6faa;};'use strict';var _=require(_0x659c('0x0'));var util=require(_0x659c('0x1'));var logger=require(_0x659c('0x2'))(_0x659c('0x3'));var moment=require(_0x659c('0x4'));var BPromise=require(_0x659c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x659c('0x6'));var config=require(_0x659c('0x7'));var attributes=require(_0x659c('0x8'));module[_0x659c('0x9')]=function(_0x555eda,_0x2e1620){return _0x555eda[_0x659c('0xa')](_0x659c('0xb'),attributes,{'tableName':_0x659c('0xc'),'paranoid':![],'indexes':[{'name':_0x659c('0xd'),'fields':[_0x659c('0xe'),_0x659c('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8fd4=['path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x257954,_0x174500){var _0x1ff7d8=function(_0x19baa3){while(--_0x19baa3){_0x257954['push'](_0x257954['shift']());}};_0x1ff7d8(++_0x174500);}(_0x8fd4,0xea));var _0x48fd=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x8fd4[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x48fd('0x0'));var util=require(_0x48fd('0x1'));var logger=require(_0x48fd('0x2'))(_0x48fd('0x3'));var moment=require('moment');var BPromise=require(_0x48fd('0x4'));var rp=require(_0x48fd('0x5'));var fs=require('fs');var path=require(_0x48fd('0x6'));var rimraf=require(_0x48fd('0x7'));var config=require(_0x48fd('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x48fd('0x9')]=function(_0x4be35a,_0x1556e5){return _0x4be35a[_0x48fd('0xa')](_0x48fd('0xb'),attributes,{'tableName':_0x48fd('0xc'),'paranoid':![],'indexes':[{'name':_0x48fd('0xd'),'fields':[_0x48fd('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 7528c20..930f8d3 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 _0x2f68=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug'];(function(_0xfc9ef5,_0x4d318b){var _0x10b5f3=function(_0x27b094){while(--_0x27b094){_0xfc9ef5['push'](_0xfc9ef5['shift']());}};_0x10b5f3(++_0x4d318b);}(_0x2f68,0x9a));var _0x82f6=function(_0x1c727d,_0x28d3b2){_0x1c727d=_0x1c727d-0x0;var _0x25c25a=_0x2f68[_0x1c727d];return _0x25c25a;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});} \ No newline at end of file +var _0x8130=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x26d4ca,_0x194ea8){var _0x2f4122=function(_0x1f52bd){while(--_0x1f52bd){_0x26d4ca['push'](_0x26d4ca['shift']());}};_0x2f4122(++_0x194ea8);}(_0x8130,0x146));var _0x0813=function(_0x4cb40f,_0x6d1e3f){_0x4cb40f=_0x4cb40f-0x0;var _0x1dd39e=_0x8130[_0x4cb40f];return _0x1dd39e;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require('moment');var BPromise=require(_0x0813('0x2'));var rs=require(_0x0813('0x3'));var fs=require('fs');var Redis=require(_0x0813('0x4'));var db=require(_0x0813('0x5'))['db'];var utils=require(_0x0813('0x6'));var logger=require(_0x0813('0x7'))('rpc');var config=require(_0x0813('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0813('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2df45a,_0x2bbdfd,_0x19a508){return new BPromise(function(_0x2ab8f0,_0x115a90){return client[_0x0813('0xa')](_0x2df45a,_0x19a508)['then'](function(_0x44ec2c){logger[_0x0813('0xb')](_0x0813('0xc'),_0x2bbdfd,'request\x20sent');logger['debug'](_0x0813('0xd'),_0x2bbdfd,'request\x20sent',JSON[_0x0813('0xe')](_0x44ec2c));if(_0x44ec2c['error']){if(_0x44ec2c[_0x0813('0xf')][_0x0813('0x10')]===0x1f4){logger[_0x0813('0xf')](_0x0813('0xc'),_0x2bbdfd,_0x44ec2c['error']['message']);return _0x115a90(_0x44ec2c[_0x0813('0xf')][_0x0813('0x11')]);}logger['error'](_0x0813('0xc'),_0x2bbdfd,_0x44ec2c['error']['message']);return _0x2ab8f0(_0x44ec2c[_0x0813('0xf')][_0x0813('0x11')]);}else{logger['info'](_0x0813('0xc'),_0x2bbdfd,'request\x20sent');_0x2ab8f0(_0x44ec2c[_0x0813('0x12')][_0x0813('0x11')]);}})[_0x0813('0x13')](function(_0xee126d){logger[_0x0813('0xf')](_0x0813('0xc'),_0x2bbdfd,_0xee126d);_0x115a90(_0xee126d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 374ed02..548c623 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 _0x4e5b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4e5b,0x67));var _0xb4e5=function(_0x7f1644,_0x268f86){_0x7f1644=_0x7f1644-0x0;var _0x5518b0=_0x4e5b[_0x7f1644];return _0x5518b0;};'use strict';var multer=require(_0xb4e5('0x0'));var util=require(_0xb4e5('0x1'));var path=require(_0xb4e5('0x2'));var timeout=require(_0xb4e5('0x3'));var express=require(_0xb4e5('0x4'));var router=express[_0xb4e5('0x5')]();var fs_extra=require(_0xb4e5('0x6'));var auth=require(_0xb4e5('0x7'));var interaction=require(_0xb4e5('0x8'));var config=require(_0xb4e5('0x9'));var controller=require('./voiceRecording.controller');router[_0xb4e5('0xa')]('/',auth[_0xb4e5('0xb')](),controller['index']);router[_0xb4e5('0xa')](_0xb4e5('0xc'),auth['isAuthenticated'](),controller[_0xb4e5('0xd')]);router[_0xb4e5('0xa')]('/:id',auth[_0xb4e5('0xb')](),controller[_0xb4e5('0xe')]);router['get'](_0xb4e5('0xf'),auth[_0xb4e5('0xb')](),controller[_0xb4e5('0x10')]);router[_0xb4e5('0xa')]('/:id/downloads',controller[_0xb4e5('0x11')]);router[_0xb4e5('0xa')](_0xb4e5('0x12'),auth[_0xb4e5('0xb')](),controller[_0xb4e5('0x13')]);router[_0xb4e5('0x14')]('/',auth[_0xb4e5('0xb')](),controller[_0xb4e5('0x15')]);router[_0xb4e5('0x14')](_0xb4e5('0x12'),auth['isAuthenticated'](),controller[_0xb4e5('0x16')]);router['put'](_0xb4e5('0x17'),auth[_0xb4e5('0xb')](),controller['update']);router[_0xb4e5('0x18')](_0xb4e5('0x17'),auth[_0xb4e5('0xb')](),controller[_0xb4e5('0x19')]);module[_0xb4e5('0x1a')]=router; \ No newline at end of file +var _0xb48a=['update','delete','connect-timeout','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','index','isAuthenticated','/:id','/:id/download','download','downloads','downloadTranscribe','post','/:id/transcribe','runTranscribe','put'];(function(_0x2a5807,_0x14e3ba){var _0x59925e=function(_0x22865a){while(--_0x22865a){_0x2a5807['push'](_0x2a5807['shift']());}};_0x59925e(++_0x14e3ba);}(_0xb48a,0x1f0));var _0xab48=function(_0x27e817,_0x5a0516){_0x27e817=_0x27e817-0x0;var _0x2b8d6c=_0xb48a[_0x27e817];return _0x2b8d6c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xab48('0x0'));var express=require('express');var router=express[_0xab48('0x1')]();var fs_extra=require(_0xab48('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xab48('0x3'));var controller=require(_0xab48('0x4'));router[_0xab48('0x5')]('/',auth['isAuthenticated'](),controller[_0xab48('0x6')]);router[_0xab48('0x5')]('/describe',auth[_0xab48('0x7')](),controller['describe']);router[_0xab48('0x5')](_0xab48('0x8'),auth[_0xab48('0x7')](),controller['show']);router[_0xab48('0x5')](_0xab48('0x9'),auth[_0xab48('0x7')](),controller[_0xab48('0xa')]);router['get']('/:id/downloads',controller[_0xab48('0xb')]);router[_0xab48('0x5')]('/:id/transcribe',auth[_0xab48('0x7')](),controller[_0xab48('0xc')]);router['post']('/',auth[_0xab48('0x7')](),controller['create']);router[_0xab48('0xd')](_0xab48('0xe'),auth[_0xab48('0x7')](),controller[_0xab48('0xf')]);router[_0xab48('0x10')]('/:id',auth[_0xab48('0x7')](),controller[_0xab48('0x11')]);router[_0xab48('0x12')](_0xab48('0x8'),auth[_0xab48('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 809f410..fe35237 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 _0x2c84=['createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','exports','getDataValue','value','STRING','setDataValue','channel','membername','INTEGER','NEW','TEXT','FLOAT','BOOLEAN','DATE'];(function(_0x48d27a,_0x52be05){var _0x57f33c=function(_0x55c6f0){while(--_0x55c6f0){_0x48d27a['push'](_0x48d27a['shift']());}};_0x57f33c(++_0x52be05);}(_0x2c84,0x1ba));var _0x42c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2c84[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x42c8('0x0'));var path=require('path');module[_0x42c8('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x42c8('0x2')](_0x42c8('0x3'))?path['extname'](this['getDataValue'](_0x42c8('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0x42c8('0x4')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x116f64){if(_0x116f64){this[_0x42c8('0x5')](_0x42c8('0x6'),_0x116f64);this['setDataValue'](_0x42c8('0x7'),_0x116f64['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x42c8('0x4')]},'calleridname':{'type':Sequelize[_0x42c8('0x4')]},'connectedlinenum':{'type':Sequelize[_0x42c8('0x4')]},'connectedlinename':{'type':Sequelize[_0x42c8('0x4')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x42c8('0x4')]},'exten':{'type':Sequelize[_0x42c8('0x4')]},'value':{'type':Sequelize[_0x42c8('0x4')]},'type':{'type':Sequelize[_0x42c8('0x4')]},'rating':{'type':Sequelize[_0x42c8('0x8')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x42c8('0x4')]},'userSecondDisposition':{'type':Sequelize[_0x42c8('0x4')]},'userThirdDisposition':{'type':Sequelize[_0x42c8('0x4')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x42c8('0x4')]},'transcribeStatus':{'type':Sequelize[_0x42c8('0x4')],'defaultValue':_0x42c8('0x9')},'fileUri':{'type':Sequelize[_0x42c8('0xa')]},'fileText':{'type':Sequelize[_0x42c8('0xa')]},'failureReason':{'type':Sequelize[_0x42c8('0xa')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x42c8('0xb')]},'sNeutral':{'type':Sequelize[_0x42c8('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x42c8('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x42c8('0xd')],'get':function(){return moment(this['getDataValue'](_0x42c8('0xe')))[_0x42c8('0xf')](_0x42c8('0x10'))[_0x42c8('0x11')]();}},'updatedAt':{'type':Sequelize[_0x42c8('0xd')],'get':function(){return moment(this[_0x42c8('0x2')](_0x42c8('0x12')))[_0x42c8('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x42c8('0x11')]();}}}; \ No newline at end of file +var _0x1466=['split','INTEGER','FLOAT','BOOLEAN','format','toString','DATE','MM-DD-YYYY\x20HH:mm','sequelize','moment','exports','VIRTUAL','getDataValue','value','extname','STRING','channel','setDataValue','membername'];(function(_0x5c8b1e,_0x32e4e1){var _0x4647a9=function(_0x3465ce){while(--_0x3465ce){_0x5c8b1e['push'](_0x5c8b1e['shift']());}};_0x4647a9(++_0x32e4e1);}(_0x1466,0x15e));var _0x6146=function(_0xfd9600,_0x57069d){_0xfd9600=_0xfd9600-0x0;var _0x501cae=_0x1466[_0xfd9600];return _0x501cae;};'use strict';var Sequelize=require(_0x6146('0x0'));var moment=require(_0x6146('0x1'));var path=require('path');module[_0x6146('0x2')]={'format':{'type':Sequelize[_0x6146('0x3')],'get':function(){return this[_0x6146('0x4')](_0x6146('0x5'))?path[_0x6146('0x6')](this[_0x6146('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x6146('0x7')]},'channel':{'type':Sequelize[_0x6146('0x7')],'set':function(_0x7c37ea){if(_0x7c37ea){this['setDataValue'](_0x6146('0x8'),_0x7c37ea);this[_0x6146('0x9')](_0x6146('0xa'),_0x7c37ea[_0x6146('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6146('0x7')]},'connectedlinenum':{'type':Sequelize[_0x6146('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6146('0x7')]},'context':{'type':Sequelize[_0x6146('0x7')]},'exten':{'type':Sequelize[_0x6146('0x7')]},'value':{'type':Sequelize[_0x6146('0x7')]},'type':{'type':Sequelize[_0x6146('0x7')]},'rating':{'type':Sequelize[_0x6146('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x6146('0x7')]},'userDisposition':{'type':Sequelize[_0x6146('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x6146('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x6146('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x6146('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x6146('0xd')]},'sNeutral':{'type':Sequelize[_0x6146('0xd')]},'sMixed':{'type':Sequelize[_0x6146('0xd')]},'tempSentiment':{'type':Sequelize[_0x6146('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6146('0x4')]('createdAt'))[_0x6146('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x6146('0x10')]();}},'updatedAt':{'type':Sequelize[_0x6146('0x11')],'get':function(){return moment(this[_0x6146('0x4')]('updatedAt'))[_0x6146('0xf')](_0x6146('0x12'))[_0x6146('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 51e07fc..e999c9b 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 _0x0324=['util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','describe','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','destroy','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','decryptFile','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x5ec656,_0x2e3a23){var _0x21f7dd=function(_0xc46b0d){while(--_0xc46b0d){_0x5ec656['push'](_0x5ec656['shift']());}};_0x21f7dd(++_0x2e3a23);}(_0x0324,0x90));var _0x4032=function(_0x3aaf63,_0x138033){_0x3aaf63=_0x3aaf63-0x0;var _0x11fa5a=_0x0324[_0x3aaf63];return _0x11fa5a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4032('0x0'));var rimraf=require(_0x4032('0x1'));var zipdir=require(_0x4032('0x2'));var jsonpatch=require(_0x4032('0x3'));var rp=require(_0x4032('0x4'));var moment=require(_0x4032('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4032('0x6'));var util=require(_0x4032('0x7'));var path=require(_0x4032('0x8'));var sox=require(_0x4032('0x9'));var csv=require(_0x4032('0xa'));var ejs=require(_0x4032('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4032('0xc'));var squel=require(_0x4032('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4032('0xe'));var toCsv=require(_0x4032('0xa'));var querystring=require('querystring');var Papa=require(_0x4032('0xf'));var AWS=require(_0x4032('0x10'));var uuidv4=require(_0x4032('0x11'));var Redis=require(_0x4032('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4032('0x13'));var as=require(_0x4032('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4032('0x15'));var config=require(_0x4032('0x16'));var licenseUtil=require(_0x4032('0x17'));var db=require(_0x4032('0x18'))['db'];function respondWithStatusCode(_0xe33681,_0x1b95f4){_0x1b95f4=_0x1b95f4||0xcc;return function(_0x140794){if(_0x140794){return _0xe33681[_0x4032('0x19')](_0x1b95f4);}return _0xe33681[_0x4032('0x1a')](_0x1b95f4)[_0x4032('0x1b')]();};}function respondWithResult(_0x4c0753,_0x53daf2){_0x53daf2=_0x53daf2||0xc8;return function(_0x3222d0){if(_0x3222d0){return _0x4c0753[_0x4032('0x1a')](_0x53daf2)[_0x4032('0x1c')](_0x3222d0);}};}function respondWithFilteredResult(_0x19a0bd,_0x3c67a6){return function(_0x3d7709){if(_0x3d7709){var _0x5bfb88=_0x3d7709[_0x4032('0x1d')],_0x37e4fc=_0x3c67a6[_0x4032('0x1e')],_0x55db57=_0x3c67a6[_0x4032('0x1e')]+_0x3c67a6[_0x4032('0x1f')],_0x495ff7;if(_0x55db57>=_0x5bfb88){_0x55db57=_0x5bfb88;_0x495ff7=0xc8;}else{_0x495ff7=0xce;}_0x19a0bd[_0x4032('0x1a')](_0x495ff7);return _0x19a0bd[_0x4032('0x20')]('Content-Range',_0x37e4fc+'-'+_0x55db57+'/'+_0x5bfb88)[_0x4032('0x1c')](_0x3d7709);}return null;};}function patchUpdates(_0x4ffcda){return function(_0x5bb9f5){try{jsonpatch[_0x4032('0x21')](_0x5bb9f5,_0x4ffcda,!![]);}catch(_0x4ce170){return BPromise[_0x4032('0x22')](_0x4ce170);}return _0x5bb9f5[_0x4032('0x23')]();};}function saveUpdates(_0x56baba,_0x390b13){return function(_0x1cdd45){if(_0x1cdd45){return _0x1cdd45['update'](_0x56baba)[_0x4032('0x24')](function(_0x288125){return _0x288125;});}return null;};}function removeEntity(_0x4eb51b,_0x356b11){return function(_0x3ac3fa){if(_0x3ac3fa){return _0x3ac3fa['destroy']()[_0x4032('0x24')](function(){_0x4eb51b[_0x4032('0x1a')](0xcc)[_0x4032('0x1b')]();});}};}function handleEntityNotFound(_0x38705e,_0x3f9fb2){return function(_0x4e59c3){if(!_0x4e59c3){_0x38705e['sendStatus'](0x194);}return _0x4e59c3;};}function handleError(_0x47f7fa,_0x334cfe){_0x334cfe=_0x334cfe||0x1f4;return function(_0x11eb2c){logger['error'](_0x11eb2c['stack']);if(_0x11eb2c[_0x4032('0x25')]){delete _0x11eb2c[_0x4032('0x25')];}_0x47f7fa[_0x4032('0x1a')](_0x334cfe)[_0x4032('0x26')](_0x11eb2c);};}exports['index']=function(_0x1c04f9,_0x23331d){var _0x225ca4={},_0x1c5c32={},_0x36df3c={'count':0x0,'rows':[]};var _0x541508=_[_0x4032('0x27')](db[_0x4032('0x28')][_0x4032('0x29')],function(_0x41edca){return{'name':_0x41edca[_0x4032('0x2a')],'type':_0x41edca[_0x4032('0x2b')][_0x4032('0x2c')]};});_0x1c5c32[_0x4032('0x2d')]=_[_0x4032('0x2e')](_[_0x4032('0x27')](_0x541508,_0x4032('0x25')),[_0x4032('0x2f')]);_0x1c5c32[_0x4032('0x30')]=_['keys'](_0x1c04f9[_0x4032('0x30')]);_0x1c5c32[_0x4032('0x31')]=_[_0x4032('0x32')](_0x1c5c32['model'],_0x1c5c32['query']);_0x225ca4[_0x4032('0x33')]=_[_0x4032('0x32')](_0x1c5c32[_0x4032('0x2d')],qs[_0x4032('0x34')](_0x1c04f9[_0x4032('0x30')][_0x4032('0x34')]));_0x225ca4[_0x4032('0x33')]=_0x225ca4[_0x4032('0x33')][_0x4032('0x35')]?_0x225ca4[_0x4032('0x33')]:_0x1c5c32[_0x4032('0x2d')];if(!_0x1c04f9[_0x4032('0x30')][_0x4032('0x36')](_0x4032('0x37'))){_0x225ca4[_0x4032('0x1f')]=qs[_0x4032('0x1f')](_0x1c04f9['query']['limit']);_0x225ca4[_0x4032('0x1e')]=qs[_0x4032('0x1e')](_0x1c04f9[_0x4032('0x30')][_0x4032('0x1e')]);}_0x225ca4[_0x4032('0x38')]=qs[_0x4032('0x39')](_0x1c04f9[_0x4032('0x30')]['sort']);_0x225ca4['where']=qs[_0x4032('0x31')](_[_0x4032('0x3a')](_0x1c04f9[_0x4032('0x30')],_0x1c5c32[_0x4032('0x31')]),_0x541508);if(_0x1c04f9[_0x4032('0x30')][_0x4032('0x3b')]){_0x225ca4[_0x4032('0x3c')]=_[_0x4032('0x3d')](_0x225ca4['where'],{'$or':_[_0x4032('0x27')](_0x541508,function(_0x261c00){if(_0x261c00[_0x4032('0x2b')]!==_0x4032('0x3e')){var _0x57a69a={};_0x57a69a[_0x261c00[_0x4032('0x25')]]={'$like':'%'+_0x1c04f9[_0x4032('0x30')][_0x4032('0x3b')]+'%'};return _0x57a69a;}})});}_0x225ca4=_[_0x4032('0x3d')]({},_0x225ca4,_0x1c04f9[_0x4032('0x3f')]);var _0xb2f6df={'where':_0x225ca4[_0x4032('0x3c')]};return db[_0x4032('0x28')][_0x4032('0x1d')](_0xb2f6df)[_0x4032('0x24')](function(_0x5c5811){_0x36df3c[_0x4032('0x1d')]=_0x5c5811;if(_0x1c04f9[_0x4032('0x30')][_0x4032('0x40')]){_0x225ca4[_0x4032('0x41')]=[{'all':!![]}];}return db['VoiceRecording'][_0x4032('0x42')](_0x225ca4);})[_0x4032('0x24')](function(_0x55133b){_0x36df3c[_0x4032('0x43')]=_0x55133b;return _0x36df3c;})[_0x4032('0x24')](respondWithFilteredResult(_0x23331d,_0x225ca4))[_0x4032('0x44')](handleError(_0x23331d,null));};exports['show']=function(_0x2ef044,_0xa8c40a){var _0x4af9a1={'raw':![],'where':{'id':_0x2ef044['params']['id']}},_0x2b61d8={};_0x2b61d8['model']=_['keys'](db['VoiceRecording'][_0x4032('0x29')]);_0x2b61d8['query']=_[_0x4032('0x45')](_0x2ef044['query']);_0x2b61d8['filters']=_[_0x4032('0x32')](_0x2b61d8['model'],_0x2b61d8[_0x4032('0x30')]);_0x4af9a1['attributes']=_['intersection'](_0x2b61d8[_0x4032('0x2d')],qs[_0x4032('0x34')](_0x2ef044[_0x4032('0x30')]['fields']));_0x4af9a1[_0x4032('0x33')]=_0x4af9a1[_0x4032('0x33')]['length']?_0x4af9a1[_0x4032('0x33')]:_0x2b61d8[_0x4032('0x2d')];if(_0x2ef044['query'][_0x4032('0x40')]){_0x4af9a1[_0x4032('0x41')]=[{'all':!![]}];}_0x4af9a1=_[_0x4032('0x3d')]({},_0x4af9a1,_0x2ef044['options']);return db[_0x4032('0x28')][_0x4032('0x46')](_0x4af9a1)[_0x4032('0x24')](handleEntityNotFound(_0xa8c40a,null))['then'](respondWithResult(_0xa8c40a,null))['catch'](handleError(_0xa8c40a,null));};exports[_0x4032('0x47')]=function(_0x1596e0,_0x248f1f){return db['VoiceRecording'][_0x4032('0x47')](_0x1596e0[_0x4032('0x48')],{})[_0x4032('0x24')](respondWithResult(_0x248f1f,0xc9))['catch'](handleError(_0x248f1f,null));};exports['update']=function(_0xa6786d,_0x1765b0){if(_0xa6786d[_0x4032('0x48')]['id']){delete _0xa6786d[_0x4032('0x48')]['id'];}return db['VoiceRecording'][_0x4032('0x46')]({'where':{'id':_0xa6786d[_0x4032('0x49')]['id']}})[_0x4032('0x24')](handleEntityNotFound(_0x1765b0,null))[_0x4032('0x24')](saveUpdates(_0xa6786d[_0x4032('0x48')],null))[_0x4032('0x24')](respondWithResult(_0x1765b0,null))[_0x4032('0x44')](handleError(_0x1765b0,null));};exports['describe']=function(_0xb906e3,_0x38573e){return db['VoiceRecording'][_0x4032('0x4a')]()['then'](respondWithResult(_0x38573e,null))['catch'](handleError(_0x38573e,null));};exports['download']=function(_0x56d6ba,_0x51160f,_0x2171f5){var _0x5812e6=require('../../components/encryptor');var _0x298030=![];var _0x38d4cf={};if(_0x56d6ba[_0x4032('0x30')][_0x4032('0x2b')]&&_0x56d6ba['query']['type']===_0x4032('0x4b')){_0x38d4cf[_0x4032('0x4b')]=_0x56d6ba[_0x4032('0x49')]['id'];}else{_0x38d4cf['id']=_0x56d6ba[_0x4032('0x49')]['id'];}return db[_0x4032('0x28')][_0x4032('0x46')]({'where':_0x38d4cf,'attributes':['id','value'],'raw':!![]})[_0x4032('0x24')](handleEntityNotFound(_0x51160f,null))[_0x4032('0x24')](function(_0x181c29){if(_0x181c29){var _0x3f90b5=_0x181c29[_0x4032('0x4c')];var _0x26e299=util[_0x4032('0x2f')](_0x4032('0x4d'),_0x3f90b5);if(fs[_0x4032('0x4e')](_0x26e299)){_0x298030=!![];return _0x5812e6['decryptFile'](_0x26e299,_0x3f90b5,config[_0x4032('0x4f')][_0x4032('0x50')])['then'](function(){return _0x181c29;});}return _0x181c29;}})[_0x4032('0x24')](function(_0x5c901a){if(_0x5c901a){var _0x14258a=_0x5c901a[_0x4032('0x4c')];if(!fs['existsSync'](_0x14258a)){throw new db[(_0x4032('0x51'))][(_0x4032('0x52'))](_0x4032('0x53'));}if(_0x5c901a[_0x4032('0x54')]){return _0x51160f[_0x4032('0x55')](_0x14258a,_0x5c901a[_0x4032('0x54')]+path[_0x4032('0x56')](_0x14258a),function(){if(_0x298030){fs[_0x4032('0x57')](_0x14258a);}});}else{return _0x51160f[_0x4032('0x55')](_0x14258a,function(_0x278f46){if(_0x298030){fs[_0x4032('0x57')](_0x14258a);}});}}})[_0x4032('0x44')](function(_0x68a69c){if(_0x68a69c[_0x4032('0x58')]==='VoiceRecording\x20not\x20found'){_0x51160f['status'](0x194)[_0x4032('0x26')](_0x4032('0x59'));}else{return handleError(_0x51160f,null);}});};exports[_0x4032('0x5a')]=function(_0x236158,_0x5e4980,_0x15b102){var _0x35f567=require(_0x4032('0x5b'));var _0x316cec=![];var _0x33e106={'$and':[db[_0x4032('0x5c')][_0x4032('0x3c')](db[_0x4032('0x5c')]['fn'](_0x4032('0x5d'),db[_0x4032('0x5c')][_0x4032('0x5e')](_0x4032('0x4b'))),_0x236158[_0x4032('0x30')][_0x4032('0x5f')])]};if(_0x236158[_0x4032('0x30')][_0x4032('0x2b')]&&_0x236158[_0x4032('0x30')][_0x4032('0x2b')]===_0x4032('0x4b')){_0x33e106[_0x4032('0x60')][_0x4032('0x61')]({'uniqueid':_0x236158[_0x4032('0x49')]['id']});}else{_0x33e106['$and'][_0x4032('0x61')]({'id':_0x236158[_0x4032('0x49')]['id']});}return db[_0x4032('0x28')][_0x4032('0x46')]({'where':_0x33e106,'attributes':['id','value'],'raw':!![]})[_0x4032('0x24')](handleEntityNotFound(_0x5e4980,null))['then'](function(_0x18ec11){if(_0x18ec11){var _0x2383b6=util[_0x4032('0x2f')](_0x4032('0x4d'),_0x18ec11[_0x4032('0x4c')]);if(fs[_0x4032('0x4e')](_0x2383b6)){_0x316cec=!![];return _0x35f567['decryptFile'](_0x2383b6,_0x18ec11[_0x4032('0x4c')],config[_0x4032('0x4f')][_0x4032('0x50')])[_0x4032('0x24')](function(){return _0x18ec11;});}return _0x18ec11;}})[_0x4032('0x24')](function(_0xff8f9f){if(_0xff8f9f){if(!fs[_0x4032('0x4e')](_0xff8f9f[_0x4032('0x4c')])){throw new db[(_0x4032('0x51'))][(_0x4032('0x52'))](_0x4032('0x53'));}if(_0xff8f9f[_0x4032('0x54')]){return _0x5e4980[_0x4032('0x55')](_0xff8f9f[_0x4032('0x4c')],_0xff8f9f[_0x4032('0x54')]+path[_0x4032('0x56')](_0xff8f9f['value']),function(){if(_0x316cec){fs[_0x4032('0x57')](_0xff8f9f[_0x4032('0x4c')]);}});}else{return _0x5e4980['download'](_0xff8f9f[_0x4032('0x4c')],function(_0x2d92e1){if(_0x316cec){fs[_0x4032('0x57')](_0xff8f9f['value']);}});}}})[_0x4032('0x44')](handleError(_0x5e4980,null));};exports[_0x4032('0x62')]=function(_0xbe3869,_0x1e1924){return db[_0x4032('0x28')][_0x4032('0x46')]({'where':{'id':_0xbe3869['params']['id']}})[_0x4032('0x24')](function(_0x2f9b4b){if(!_0x2f9b4b)throw new ReferenceError(_0x4032('0x63'));return _0x2f9b4b;})['then'](function(_0x1d26ab){var _0x5acd4e=_0x1d26ab[_0x4032('0x4c')];logger[_0x4032('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x5acd4e);if(!_[_0x4032('0x65')](_0x1d26ab[_0x4032('0x4c')])&&fs[_0x4032('0x4e')](_0x5acd4e)){logger[_0x4032('0x64')](_0x4032('0x66')+_0x5acd4e+_0x4032('0x67'));fs[_0x4032('0x68')](_0x5acd4e);}_0x5acd4e=_0x5acd4e+_0x4032('0x69');if(!_[_0x4032('0x65')](_0x1d26ab[_0x4032('0x4c')])&&fs[_0x4032('0x4e')](_0x5acd4e)){logger['info'](_0x4032('0x66')+_0x5acd4e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4032('0x68')](_0x5acd4e);}return _0x1d26ab;})[_0x4032('0x24')](function(_0x140a25){if(!_0x140a25)throw new InternalError();return _0x140a25[_0x4032('0x62')]();})[_0x4032('0x24')](function(){_0x1e1924[_0x4032('0x1a')](0xcc)[_0x4032('0x1b')]();})['catch'](handleError(_0x1e1924,null));};function getBucketslist(_0x39e05a,_0x250f1b,_0x3157e5){return new Promise(function(_0x18993a,_0x4fadde){var _0x3e5311=new AWS['S3']({'accessKeyId':_0x250f1b,'secretAccessKey':_0x39e05a,'region':_0x3157e5});_0x3e5311[_0x4032('0x6a')]({},function(_0x5167e2,_0x49c6e2){if(_0x5167e2){return _0x4fadde(_0x5167e2);}else{return _0x18993a(_0x49c6e2);}});});}function createBucket(_0x186e91,_0x1102a5,_0x45c50b,_0x2cdd78){return new Promise(function(_0x59b30b,_0x54a163){var _0x424b70=new AWS['S3']({'accessKeyId':_0x1102a5,'secretAccessKey':_0x186e91,'region':_0x45c50b});_0x424b70[_0x4032('0x6b')]({'Bucket':_0x2cdd78},function(_0x4fa4f9,_0x15b421){if(_0x4fa4f9){return _0x54a163(_0x4fa4f9);}else{return _0x59b30b(_0x15b421);}});});}function uploadFile(_0x54b299,_0x4d7b0c,_0x14567b,_0x306c89,_0x2349d1,_0x47c447){return new Promise(function(_0x179707,_0x112c53){var _0x8895f=new AWS['S3']({'accessKeyId':_0x4d7b0c,'secretAccessKey':_0x54b299,'region':_0x14567b});_0x8895f[_0x4032('0x6c')]({'Bucket':_0x306c89,'Key':_0x2349d1,'Body':_0x47c447},function(_0x30d047,_0x157fc0){if(_0x30d047){return _0x112c53(_0x30d047);}else{return _0x179707(_0x157fc0);}});});}function startTranscribe(_0x4d5b29,_0x145793,_0xf2b2f4,_0x242b2b,_0x400564,_0x5d4cad){return new Promise(function(_0x178b24,_0x3bef01){var _0x1c789d=new AWS[(_0x4032('0x6d'))]({'accessKeyId':_0x145793,'secretAccessKey':_0x4d5b29,'region':_0xf2b2f4});_0x1c789d[_0x4032('0x6e')]({'TranscriptionJobName':_0x242b2b,'LanguageCode':_0x400564,'Media':{'MediaFileUri':_0x5d4cad}},function(_0x9eb94c,_0x18e833){if(_0x9eb94c){return _0x3bef01(_0x9eb94c);}else{return _0x178b24(_0x18e833);}});});}function transcribe(_0x2387c2,_0x1589f3,_0x2de48b,_0x348db0,_0x186fc1,_0x4499f9,_0x4f3a9d){return new Promise(function(_0x3e6eae,_0x3ac420){var _0xd06f17={};logger[_0x4032('0x64')](util['format'](_0x4032('0x6f'),_0x2387c2,_0x186fc1));return uploadFile(_0x1589f3,_0x2de48b,_0x348db0,_0x186fc1,path[_0x4032('0x70')](_0x4499f9),fs[_0x4032('0x71')](_0x4499f9))[_0x4032('0x24')](function(_0x266dc2){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2387c2,_0x186fc1,_0x266dc2[_0x4032('0x72')]));_0xd06f17[_0x4032('0x73')]=_0x266dc2[_0x4032('0x74')];_0xd06f17[_0x4032('0x75')]=_0x266dc2[_0x4032('0x72')];logger[_0x4032('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2387c2));return startTranscribe(_0x1589f3,_0x2de48b,_0x348db0,uuidv4(),_0x4f3a9d,_0x266dc2[_0x4032('0x72')]);})[_0x4032('0x24')](function(_0x55cdd0){logger['info'](util[_0x4032('0x2f')](_0x4032('0x76'),_0x2387c2,_0x55cdd0[_0x4032('0x77')]['TranscriptionJobName']));_0xd06f17['transcribeName']=_0x55cdd0[_0x4032('0x77')][_0x4032('0x78')];_0xd06f17[_0x4032('0x79')]=_0x55cdd0[_0x4032('0x77')][_0x4032('0x7a')];return _0x3e6eae(_0xd06f17);})[_0x4032('0x44')](function(_0x1d5757){return _0x3ac420(_0x1d5757);});});}exports[_0x4032('0x7b')]=function(_0x901183,_0x5a5de9,_0x55d2d1){var _0x413f9e;var _0x3eac0b;var _0x486bc4;var _0x55609e=require(_0x4032('0x5b'));return db[_0x4032('0x28')][_0x4032('0x7c')]({'where':{'id':_0x901183['params']['id']}})[_0x4032('0x24')](function(_0x53f5aa){if(_0x53f5aa){var _0x53ecb9=util[_0x4032('0x2f')](_0x4032('0x4d'),_0x53f5aa[_0x4032('0x4c')]);if(fs[_0x4032('0x4e')](_0x53ecb9)){cypher=!![];return _0x55609e[_0x4032('0x7d')](_0x53ecb9,_0x53f5aa['value'],config[_0x4032('0x4f')][_0x4032('0x50')])[_0x4032('0x24')](function(){return _0x53f5aa;});}return _0x53f5aa;}})[_0x4032('0x24')](function(_0x5a4aa2){if(!_0x5a4aa2){throw new db[(_0x4032('0x51'))][(_0x4032('0x52'))](_0x4032('0x7e'));}_0x3eac0b=_0x5a4aa2;return db['Setting'][_0x4032('0x7c')]({'where':{'id':0x1}});})[_0x4032('0x24')](handleEntityNotFound(_0x5a5de9,null))[_0x4032('0x24')](function(_0x399b4d){if(_0x399b4d){_0x413f9e=_0x399b4d;if(!_0x413f9e[_0x4032('0x7f')]||!_0x413f9e[_0x4032('0x80')]||!_0x413f9e[_0x4032('0x81')]||!_0x413f9e[_0x4032('0x82')]||!_0x413f9e['bucket']){throw new db[(_0x4032('0x51'))][(_0x4032('0x52'))](_0x4032('0x83'));}if(_0x901183[_0x4032('0x48')][_0x4032('0x84')]&&(!_0x413f9e[_0x4032('0x85')]||!_0x413f9e[_0x4032('0x86')]||!_0x413f9e[_0x4032('0x87')]||!_0x413f9e['language']||!_0x413f9e[_0x4032('0x73')])){throw new db[(_0x4032('0x51'))]['ValidationError'](_0x4032('0x88'));}return db['CloudProvider'][_0x4032('0x7c')]({'where':{'id':_0x413f9e[_0x4032('0x80')]}});}})['then'](function(_0x329024){if(!_0x329024){throw new db['Sequelize'][(_0x4032('0x52'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x329024['data1']||!_0x329024[_0x4032('0x89')]){throw new db[(_0x4032('0x51'))][(_0x4032('0x52'))](_0x4032('0x8a'));}_0x486bc4=_0x329024;return getBucketslist(_0x486bc4[_0x4032('0x8b')],_0x486bc4[_0x4032('0x89')],_0x413f9e[_0x4032('0x81')]);})[_0x4032('0x24')](function(_0x5c3973){if(_0x5c3973&&_0x5c3973[_0x4032('0x8c')]){var _0x57f8b3=_[_0x4032('0x46')](_0x5c3973[_0x4032('0x8c')],function(_0x58a70e){return _0x58a70e[_0x4032('0x8d')]===_0x413f9e[_0x4032('0x73')];});if(!_0x57f8b3){logger[_0x4032('0x64')](util[_0x4032('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x901183[_0x4032('0x49')]['id'],_0x413f9e['bucket']));return createBucket(_0x486bc4[_0x4032('0x8b')],_0x486bc4[_0x4032('0x89')],_0x413f9e[_0x4032('0x81')],_0x413f9e[_0x4032('0x73')]);}logger[_0x4032('0x64')](util[_0x4032('0x2f')](_0x4032('0x8e'),_0x901183['params']['id'],_0x413f9e['bucket']));return;}})[_0x4032('0x24')](function(_0x4bed6c){if(_0x3eac0b[_0x4032('0x79')]==='NEW'){return transcribe(_0x901183[_0x4032('0x49')]['id'],_0x486bc4['data1'],_0x486bc4[_0x4032('0x89')],_0x413f9e[_0x4032('0x81')],_0x413f9e[_0x4032('0x73')],_0x3eac0b[_0x4032('0x4c')],_0x413f9e['language']);}else{logger[_0x4032('0x64')](util['format'](_0x4032('0x8f'),_0x901183['params']['id']));return{'transcribeStatus':_0x4032('0x90')};}})['then'](function(_0x1bbb2e){if(_0x1bbb2e){_0x1bbb2e['tempSentiment']=_0x901183[_0x4032('0x48')]['runSentiment'];return _0x3eac0b[_0x4032('0x91')](_0x1bbb2e);}})[_0x4032('0x24')](respondWithResult(_0x5a5de9,null))[_0x4032('0x44')](handleError(_0x5a5de9,null));};function writeFile(_0x3d0ffe,_0x151329){return new Promise(function(_0x283368,_0x2d553c){fs['writeFile'](_0x151329,_0x3d0ffe,function(_0x43a48e,_0x2862fb){if(_0x43a48e){return _0x2d553c(_0x43a48e);}else{return _0x283368(_0x2862fb);}});});}exports[_0x4032('0x92')]=function(_0x1b89ae,_0xd84e16,_0x2a84f1){return db[_0x4032('0x28')][_0x4032('0x7c')]({'where':{'id':_0x1b89ae[_0x4032('0x49')]['id']}})[_0x4032('0x24')](handleEntityNotFound(_0xd84e16))['then'](function(_0x589e68){if(_0x589e68&&_0x589e68[_0x4032('0x93')]){var _0x5b7432=_0x589e68[_0x4032('0x93')];var _0x2c899a=config[_0x4032('0x94')]+_0x4032('0x95')+_0x589e68['id']+'.txt';if(fs['existsSync'](_0x2c899a)){return _0x2c899a;}return writeFile(_0x5b7432,_0x2c899a)['then'](function(){return _0x2c899a;});}else{throw new db[(_0x4032('0x51'))]['ValidationError'](_0x4032('0x96'));}})[_0x4032('0x24')](function(_0x1a9f2d){return _0xd84e16[_0x4032('0x55')](_0x1a9f2d);})['catch'](handleError(_0xd84e16));}; \ No newline at end of file +var _0xb1ad=['describe','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','download','extname','unlink','message','downloads','../../components/encryptor','sequelize','MD5','token','push','decryptFile','ValidationError','filename','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','VoiceRecording','fieldName','type','key','differenceBy','map','name','format','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find'];(function(_0x30b746,_0x4119de){var _0x17f7a2=function(_0x1065c6){while(--_0x1065c6){_0x30b746['push'](_0x30b746['shift']());}};_0x17f7a2(++_0x4119de);}(_0xb1ad,0x184));var _0xdb1a=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb1ad[_0x9df060];return _0x338dfe;};'use strict';var pdf=require(_0xdb1a('0x0'));var emlformat=require(_0xdb1a('0x1'));var rimraf=require(_0xdb1a('0x2'));var zipdir=require(_0xdb1a('0x3'));var jsonpatch=require(_0xdb1a('0x4'));var rp=require(_0xdb1a('0x5'));var moment=require('moment');var BPromise=require(_0xdb1a('0x6'));var Mustache=require(_0xdb1a('0x7'));var util=require(_0xdb1a('0x8'));var path=require(_0xdb1a('0x9'));var sox=require(_0xdb1a('0xa'));var csv=require(_0xdb1a('0xb'));var ejs=require(_0xdb1a('0xc'));var fs=require('fs');var fs_extra=require(_0xdb1a('0xd'));var _=require(_0xdb1a('0xe'));var squel=require(_0xdb1a('0xf'));var crypto=require(_0xdb1a('0x10'));var jsforce=require(_0xdb1a('0x11'));var deskjs=require(_0xdb1a('0x12'));var toCsv=require(_0xdb1a('0xb'));var querystring=require(_0xdb1a('0x13'));var Papa=require('papaparse');var AWS=require(_0xdb1a('0x14'));var uuidv4=require(_0xdb1a('0x15'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb1a('0x16'));var hardwareService=require(_0xdb1a('0x17'));var logger=require(_0xdb1a('0x18'))(_0xdb1a('0x19'));var utils=require(_0xdb1a('0x1a'));var config=require(_0xdb1a('0x1b'));var licenseUtil=require(_0xdb1a('0x1c'));var db=require(_0xdb1a('0x1d'))['db'];function respondWithStatusCode(_0x140fb4,_0x21b3bd){_0x21b3bd=_0x21b3bd||0xcc;return function(_0x40851a){if(_0x40851a){return _0x140fb4[_0xdb1a('0x1e')](_0x21b3bd);}return _0x140fb4[_0xdb1a('0x1f')](_0x21b3bd)['end']();};}function respondWithResult(_0x117680,_0x135faf){_0x135faf=_0x135faf||0xc8;return function(_0x112be1){if(_0x112be1){return _0x117680['status'](_0x135faf)[_0xdb1a('0x20')](_0x112be1);}};}function respondWithFilteredResult(_0x504d92,_0x1c9d2b){return function(_0x3419d5){if(_0x3419d5){var _0x1637fa=_0x3419d5[_0xdb1a('0x21')],_0x5e18a0=_0x1c9d2b['offset'],_0x9ffb77=_0x1c9d2b[_0xdb1a('0x22')]+_0x1c9d2b[_0xdb1a('0x23')],_0x250601;if(_0x9ffb77>=_0x1637fa){_0x9ffb77=_0x1637fa;_0x250601=0xc8;}else{_0x250601=0xce;}_0x504d92[_0xdb1a('0x1f')](_0x250601);return _0x504d92[_0xdb1a('0x24')](_0xdb1a('0x25'),_0x5e18a0+'-'+_0x9ffb77+'/'+_0x1637fa)[_0xdb1a('0x20')](_0x3419d5);}return null;};}function patchUpdates(_0x572ee2){return function(_0xde9106){try{jsonpatch[_0xdb1a('0x26')](_0xde9106,_0x572ee2,!![]);}catch(_0x386e32){return BPromise[_0xdb1a('0x27')](_0x386e32);}return _0xde9106[_0xdb1a('0x28')]();};}function saveUpdates(_0x400397,_0x1e6f9d){return function(_0x20521b){if(_0x20521b){return _0x20521b[_0xdb1a('0x29')](_0x400397)[_0xdb1a('0x2a')](function(_0x4d1d09){return _0x4d1d09;});}return null;};}function removeEntity(_0x2971b5,_0x4de659){return function(_0x28ccfe){if(_0x28ccfe){return _0x28ccfe[_0xdb1a('0x2b')]()[_0xdb1a('0x2a')](function(){_0x2971b5['status'](0xcc)[_0xdb1a('0x2c')]();});}};}function handleEntityNotFound(_0x58ae1d,_0x3f4d11){return function(_0x37c95e){if(!_0x37c95e){_0x58ae1d[_0xdb1a('0x1e')](0x194);}return _0x37c95e;};}function handleError(_0x157c6a,_0xaa6f2e){_0xaa6f2e=_0xaa6f2e||0x1f4;return function(_0x340d54){logger[_0xdb1a('0x2d')](_0x340d54[_0xdb1a('0x2e')]);if(_0x340d54['name']){delete _0x340d54['name'];}_0x157c6a[_0xdb1a('0x1f')](_0xaa6f2e)[_0xdb1a('0x2f')](_0x340d54);};}exports[_0xdb1a('0x30')]=function(_0x4341b1,_0x29bdfc){var _0x2eaf81={},_0x5d1514={},_0x3ec2f6={'count':0x0,'rows':[]};var _0x51f0ff=_['map'](db[_0xdb1a('0x31')]['rawAttributes'],function(_0x5752d1){return{'name':_0x5752d1[_0xdb1a('0x32')],'type':_0x5752d1[_0xdb1a('0x33')][_0xdb1a('0x34')]};});_0x5d1514['model']=_[_0xdb1a('0x35')](_[_0xdb1a('0x36')](_0x51f0ff,_0xdb1a('0x37')),[_0xdb1a('0x38')]);_0x5d1514['query']=_[_0xdb1a('0x39')](_0x4341b1[_0xdb1a('0x3a')]);_0x5d1514[_0xdb1a('0x3b')]=_['intersection'](_0x5d1514[_0xdb1a('0x3c')],_0x5d1514[_0xdb1a('0x3a')]);_0x2eaf81[_0xdb1a('0x3d')]=_[_0xdb1a('0x3e')](_0x5d1514['model'],qs['fields'](_0x4341b1['query'][_0xdb1a('0x3f')]));_0x2eaf81[_0xdb1a('0x3d')]=_0x2eaf81['attributes'][_0xdb1a('0x40')]?_0x2eaf81[_0xdb1a('0x3d')]:_0x5d1514[_0xdb1a('0x3c')];if(!_0x4341b1[_0xdb1a('0x3a')][_0xdb1a('0x41')]('nolimit')){_0x2eaf81['limit']=qs['limit'](_0x4341b1[_0xdb1a('0x3a')]['limit']);_0x2eaf81['offset']=qs[_0xdb1a('0x22')](_0x4341b1[_0xdb1a('0x3a')]['offset']);}_0x2eaf81[_0xdb1a('0x42')]=qs[_0xdb1a('0x43')](_0x4341b1[_0xdb1a('0x3a')][_0xdb1a('0x43')]);_0x2eaf81[_0xdb1a('0x44')]=qs['filters'](_['pick'](_0x4341b1[_0xdb1a('0x3a')],_0x5d1514[_0xdb1a('0x3b')]),_0x51f0ff);if(_0x4341b1[_0xdb1a('0x3a')][_0xdb1a('0x45')]){_0x2eaf81[_0xdb1a('0x44')]=_[_0xdb1a('0x46')](_0x2eaf81[_0xdb1a('0x44')],{'$or':_['map'](_0x51f0ff,function(_0x4008d5){if(_0x4008d5['type']!=='VIRTUAL'){var _0x5d5f21={};_0x5d5f21[_0x4008d5['name']]={'$like':'%'+_0x4341b1[_0xdb1a('0x3a')][_0xdb1a('0x45')]+'%'};return _0x5d5f21;}})});}_0x2eaf81=_[_0xdb1a('0x46')]({},_0x2eaf81,_0x4341b1[_0xdb1a('0x47')]);var _0x200c73={'where':_0x2eaf81[_0xdb1a('0x44')]};return db[_0xdb1a('0x31')][_0xdb1a('0x21')](_0x200c73)[_0xdb1a('0x2a')](function(_0x45a611){_0x3ec2f6[_0xdb1a('0x21')]=_0x45a611;if(_0x4341b1[_0xdb1a('0x3a')][_0xdb1a('0x48')]){_0x2eaf81[_0xdb1a('0x49')]=[{'all':!![]}];}return db[_0xdb1a('0x31')][_0xdb1a('0x4a')](_0x2eaf81);})['then'](function(_0x593e94){_0x3ec2f6[_0xdb1a('0x4b')]=_0x593e94;return _0x3ec2f6;})[_0xdb1a('0x2a')](respondWithFilteredResult(_0x29bdfc,_0x2eaf81))[_0xdb1a('0x4c')](handleError(_0x29bdfc,null));};exports[_0xdb1a('0x4d')]=function(_0x43be4b,_0x4572d){var _0x149fd6={'raw':![],'where':{'id':_0x43be4b[_0xdb1a('0x4e')]['id']}},_0xad79f2={};_0xad79f2[_0xdb1a('0x3c')]=_[_0xdb1a('0x39')](db[_0xdb1a('0x31')][_0xdb1a('0x4f')]);_0xad79f2['query']=_[_0xdb1a('0x39')](_0x43be4b[_0xdb1a('0x3a')]);_0xad79f2[_0xdb1a('0x3b')]=_[_0xdb1a('0x3e')](_0xad79f2[_0xdb1a('0x3c')],_0xad79f2[_0xdb1a('0x3a')]);_0x149fd6[_0xdb1a('0x3d')]=_['intersection'](_0xad79f2['model'],qs['fields'](_0x43be4b[_0xdb1a('0x3a')][_0xdb1a('0x3f')]));_0x149fd6['attributes']=_0x149fd6[_0xdb1a('0x3d')][_0xdb1a('0x40')]?_0x149fd6['attributes']:_0xad79f2['model'];if(_0x43be4b[_0xdb1a('0x3a')][_0xdb1a('0x48')]){_0x149fd6['include']=[{'all':!![]}];}_0x149fd6=_[_0xdb1a('0x46')]({},_0x149fd6,_0x43be4b[_0xdb1a('0x47')]);return db[_0xdb1a('0x31')]['find'](_0x149fd6)[_0xdb1a('0x2a')](handleEntityNotFound(_0x4572d,null))[_0xdb1a('0x2a')](respondWithResult(_0x4572d,null))[_0xdb1a('0x4c')](handleError(_0x4572d,null));};exports[_0xdb1a('0x50')]=function(_0x57f3f7,_0x37aa5e){return db[_0xdb1a('0x31')][_0xdb1a('0x50')](_0x57f3f7[_0xdb1a('0x51')],{})['then'](respondWithResult(_0x37aa5e,0xc9))[_0xdb1a('0x4c')](handleError(_0x37aa5e,null));};exports[_0xdb1a('0x29')]=function(_0x15f5a7,_0x367b1f){if(_0x15f5a7[_0xdb1a('0x51')]['id']){delete _0x15f5a7[_0xdb1a('0x51')]['id'];}return db[_0xdb1a('0x31')][_0xdb1a('0x52')]({'where':{'id':_0x15f5a7[_0xdb1a('0x4e')]['id']}})[_0xdb1a('0x2a')](handleEntityNotFound(_0x367b1f,null))['then'](saveUpdates(_0x15f5a7['body'],null))['then'](respondWithResult(_0x367b1f,null))[_0xdb1a('0x4c')](handleError(_0x367b1f,null));};exports[_0xdb1a('0x53')]=function(_0x21c1e2,_0x3b018c){return db[_0xdb1a('0x31')][_0xdb1a('0x53')]()[_0xdb1a('0x2a')](respondWithResult(_0x3b018c,null))['catch'](handleError(_0x3b018c,null));};exports['download']=function(_0x4d774b,_0x4cd25d,_0xfa239){var _0x1f6115=require('../../components/encryptor');var _0x535027=![];var _0x532710={};if(_0x4d774b[_0xdb1a('0x3a')][_0xdb1a('0x33')]&&_0x4d774b[_0xdb1a('0x3a')][_0xdb1a('0x33')]===_0xdb1a('0x54')){_0x532710[_0xdb1a('0x54')]=_0x4d774b['params']['id'];}else{_0x532710['id']=_0x4d774b[_0xdb1a('0x4e')]['id'];}return db[_0xdb1a('0x31')][_0xdb1a('0x52')]({'where':_0x532710,'attributes':['id',_0xdb1a('0x55')],'raw':!![]})[_0xdb1a('0x2a')](handleEntityNotFound(_0x4cd25d,null))[_0xdb1a('0x2a')](function(_0x138893){if(_0x138893){var _0x2dacc3=_0x138893[_0xdb1a('0x55')];var _0x4c79cb=util[_0xdb1a('0x38')](_0xdb1a('0x56'),_0x2dacc3);if(fs[_0xdb1a('0x57')](_0x4c79cb)){_0x535027=!![];return _0x1f6115['decryptFile'](_0x4c79cb,_0x2dacc3,config[_0xdb1a('0x58')][_0xdb1a('0x59')])[_0xdb1a('0x2a')](function(){return _0x138893;});}return _0x138893;}})[_0xdb1a('0x2a')](function(_0x38af03){if(_0x38af03){var _0x20fce0=_0x38af03[_0xdb1a('0x55')];if(!fs['existsSync'](_0x20fce0)){throw new db[(_0xdb1a('0x5a'))]['ValidationError'](_0xdb1a('0x5b'));}if(_0x38af03['filename']){return _0x4cd25d[_0xdb1a('0x5c')](_0x20fce0,_0x38af03['filename']+path[_0xdb1a('0x5d')](_0x20fce0),function(){if(_0x535027){fs['unlink'](_0x20fce0);}});}else{return _0x4cd25d[_0xdb1a('0x5c')](_0x20fce0,function(_0x214433){if(_0x535027){fs[_0xdb1a('0x5e')](_0x20fce0);}});}}})[_0xdb1a('0x4c')](function(_0x19615e){if(_0x19615e[_0xdb1a('0x5f')]===_0xdb1a('0x5b')){_0x4cd25d[_0xdb1a('0x1f')](0x194)[_0xdb1a('0x2f')]('Not\x20found');}else{return handleError(_0x4cd25d,null);}});};exports[_0xdb1a('0x60')]=function(_0x41ffbf,_0x1bdb0e,_0x43d3a2){var _0xbdfd56=require(_0xdb1a('0x61'));var _0x130e3d=![];var _0x24b22a={'$and':[db['sequelize'][_0xdb1a('0x44')](db[_0xdb1a('0x62')]['fn'](_0xdb1a('0x63'),db[_0xdb1a('0x62')]['col']('uniqueid')),_0x41ffbf[_0xdb1a('0x3a')][_0xdb1a('0x64')])]};if(_0x41ffbf[_0xdb1a('0x3a')]['type']&&_0x41ffbf[_0xdb1a('0x3a')][_0xdb1a('0x33')]===_0xdb1a('0x54')){_0x24b22a['$and'][_0xdb1a('0x65')]({'uniqueid':_0x41ffbf['params']['id']});}else{_0x24b22a['$and'][_0xdb1a('0x65')]({'id':_0x41ffbf[_0xdb1a('0x4e')]['id']});}return db[_0xdb1a('0x31')][_0xdb1a('0x52')]({'where':_0x24b22a,'attributes':['id',_0xdb1a('0x55')],'raw':!![]})[_0xdb1a('0x2a')](handleEntityNotFound(_0x1bdb0e,null))[_0xdb1a('0x2a')](function(_0x30c12b){if(_0x30c12b){var _0x3f620b=util[_0xdb1a('0x38')](_0xdb1a('0x56'),_0x30c12b[_0xdb1a('0x55')]);if(fs['existsSync'](_0x3f620b)){_0x130e3d=!![];return _0xbdfd56[_0xdb1a('0x66')](_0x3f620b,_0x30c12b['value'],config[_0xdb1a('0x58')]['recording'])[_0xdb1a('0x2a')](function(){return _0x30c12b;});}return _0x30c12b;}})[_0xdb1a('0x2a')](function(_0x1e9b7e){if(_0x1e9b7e){if(!fs[_0xdb1a('0x57')](_0x1e9b7e[_0xdb1a('0x55')])){throw new db['Sequelize'][(_0xdb1a('0x67'))](_0xdb1a('0x5b'));}if(_0x1e9b7e[_0xdb1a('0x68')]){return _0x1bdb0e[_0xdb1a('0x5c')](_0x1e9b7e[_0xdb1a('0x55')],_0x1e9b7e[_0xdb1a('0x68')]+path['extname'](_0x1e9b7e[_0xdb1a('0x55')]),function(){if(_0x130e3d){fs[_0xdb1a('0x5e')](_0x1e9b7e[_0xdb1a('0x55')]);}});}else{return _0x1bdb0e[_0xdb1a('0x5c')](_0x1e9b7e[_0xdb1a('0x55')],function(_0x1ab9d5){if(_0x130e3d){fs[_0xdb1a('0x5e')](_0x1e9b7e[_0xdb1a('0x55')]);}});}}})[_0xdb1a('0x4c')](handleError(_0x1bdb0e,null));};exports['destroy']=function(_0x17c933,_0x2b555e){return db[_0xdb1a('0x31')]['find']({'where':{'id':_0x17c933[_0xdb1a('0x4e')]['id']}})['then'](function(_0x14ef41){if(!_0x14ef41)throw new ReferenceError('Entity\x20not\x20found');return _0x14ef41;})[_0xdb1a('0x2a')](function(_0x322656){var _0x39521e=_0x322656[_0xdb1a('0x55')];logger['info'](_0xdb1a('0x69'),_0x39521e);if(!_['isNil'](_0x322656[_0xdb1a('0x55')])&&fs[_0xdb1a('0x57')](_0x39521e)){logger[_0xdb1a('0x6a')](_0xdb1a('0x6b')+_0x39521e+_0xdb1a('0x6c'));fs['unlinkSync'](_0x39521e);}_0x39521e=_0x39521e+_0xdb1a('0x6d');if(!_[_0xdb1a('0x6e')](_0x322656[_0xdb1a('0x55')])&&fs[_0xdb1a('0x57')](_0x39521e)){logger[_0xdb1a('0x6a')]('File:\x20\x22'+_0x39521e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdb1a('0x6f')](_0x39521e);}return _0x322656;})[_0xdb1a('0x2a')](function(_0x28cc8c){if(!_0x28cc8c)throw new InternalError();return _0x28cc8c[_0xdb1a('0x2b')]();})[_0xdb1a('0x2a')](function(){_0x2b555e[_0xdb1a('0x1f')](0xcc)[_0xdb1a('0x2c')]();})[_0xdb1a('0x4c')](handleError(_0x2b555e,null));};function getBucketslist(_0x1a410c,_0x19f2e5,_0x1a569d){return new Promise(function(_0x614ddd,_0xaca41b){var _0x8b9d99=new AWS['S3']({'accessKeyId':_0x19f2e5,'secretAccessKey':_0x1a410c,'region':_0x1a569d});_0x8b9d99[_0xdb1a('0x70')]({},function(_0x127beb,_0x261a23){if(_0x127beb){return _0xaca41b(_0x127beb);}else{return _0x614ddd(_0x261a23);}});});}function createBucket(_0x3b5008,_0x18c40c,_0x49282e,_0x5b69dd){return new Promise(function(_0x7fcf0c,_0x167d79){var _0x27cd6a=new AWS['S3']({'accessKeyId':_0x18c40c,'secretAccessKey':_0x3b5008,'region':_0x49282e});_0x27cd6a[_0xdb1a('0x71')]({'Bucket':_0x5b69dd},function(_0x27f196,_0x2ce169){if(_0x27f196){return _0x167d79(_0x27f196);}else{return _0x7fcf0c(_0x2ce169);}});});}function uploadFile(_0xaaaae3,_0x48a7b5,_0x1d2e23,_0x24906e,_0xbad190,_0x1a4dc1){return new Promise(function(_0x53efaf,_0x49dd1a){var _0xafa68d=new AWS['S3']({'accessKeyId':_0x48a7b5,'secretAccessKey':_0xaaaae3,'region':_0x1d2e23});_0xafa68d['upload']({'Bucket':_0x24906e,'Key':_0xbad190,'Body':_0x1a4dc1},function(_0xe6053f,_0x4a46d8){if(_0xe6053f){return _0x49dd1a(_0xe6053f);}else{return _0x53efaf(_0x4a46d8);}});});}function startTranscribe(_0x306a12,_0x86bfc7,_0x5921bf,_0x582f41,_0x5d6286,_0x10f044){return new Promise(function(_0xdc460c,_0x5dab68){var _0x59b416=new AWS[(_0xdb1a('0x72'))]({'accessKeyId':_0x86bfc7,'secretAccessKey':_0x306a12,'region':_0x5921bf});_0x59b416[_0xdb1a('0x73')]({'TranscriptionJobName':_0x582f41,'LanguageCode':_0x5d6286,'Media':{'MediaFileUri':_0x10f044}},function(_0x3e3585,_0x47d1d9){if(_0x3e3585){return _0x5dab68(_0x3e3585);}else{return _0xdc460c(_0x47d1d9);}});});}function transcribe(_0x3198f4,_0x2786be,_0x4c14b1,_0x8efd83,_0x5e1f3f,_0x1ce913,_0xa2c6fe){return new Promise(function(_0x1397d6,_0x1121f0){var _0x4a25cb={};logger['info'](util[_0xdb1a('0x38')](_0xdb1a('0x74'),_0x3198f4,_0x5e1f3f));return uploadFile(_0x2786be,_0x4c14b1,_0x8efd83,_0x5e1f3f,path['basename'](_0x1ce913),fs[_0xdb1a('0x75')](_0x1ce913))[_0xdb1a('0x2a')](function(_0x16b83f){logger[_0xdb1a('0x6a')](util[_0xdb1a('0x38')](_0xdb1a('0x76'),_0x3198f4,_0x5e1f3f,_0x16b83f[_0xdb1a('0x77')]));_0x4a25cb[_0xdb1a('0x78')]=_0x16b83f[_0xdb1a('0x79')];_0x4a25cb[_0xdb1a('0x7a')]=_0x16b83f[_0xdb1a('0x77')];logger[_0xdb1a('0x6a')](util[_0xdb1a('0x38')](_0xdb1a('0x7b'),_0x3198f4));return startTranscribe(_0x2786be,_0x4c14b1,_0x8efd83,uuidv4(),_0xa2c6fe,_0x16b83f[_0xdb1a('0x77')]);})['then'](function(_0x3ca697){logger[_0xdb1a('0x6a')](util['format'](_0xdb1a('0x7c'),_0x3198f4,_0x3ca697[_0xdb1a('0x7d')]['TranscriptionJobName']));_0x4a25cb['transcribeName']=_0x3ca697[_0xdb1a('0x7d')][_0xdb1a('0x7e')];_0x4a25cb[_0xdb1a('0x7f')]=_0x3ca697[_0xdb1a('0x7d')][_0xdb1a('0x80')];return _0x1397d6(_0x4a25cb);})['catch'](function(_0x5a6c44){return _0x1121f0(_0x5a6c44);});});}exports['runTranscribe']=function(_0x4c60aa,_0x4f3dbc,_0x5d660d){var _0x2ec7d1;var _0x1aa328;var _0x42c3f4;var _0x52b8d5=require(_0xdb1a('0x61'));return db[_0xdb1a('0x31')]['findOne']({'where':{'id':_0x4c60aa[_0xdb1a('0x4e')]['id']}})['then'](function(_0x1e8adc){if(_0x1e8adc){var _0x5b1ea1=util[_0xdb1a('0x38')](_0xdb1a('0x56'),_0x1e8adc[_0xdb1a('0x55')]);if(fs[_0xdb1a('0x57')](_0x5b1ea1)){cypher=!![];return _0x52b8d5[_0xdb1a('0x66')](_0x5b1ea1,_0x1e8adc[_0xdb1a('0x55')],config[_0xdb1a('0x58')][_0xdb1a('0x59')])[_0xdb1a('0x2a')](function(){return _0x1e8adc;});}return _0x1e8adc;}})[_0xdb1a('0x2a')](function(_0xbaea68){if(!_0xbaea68){throw new db['Sequelize'][(_0xdb1a('0x67'))](_0xdb1a('0x81'));}_0x1aa328=_0xbaea68;return db[_0xdb1a('0x82')][_0xdb1a('0x83')]({'where':{'id':0x1}});})[_0xdb1a('0x2a')](handleEntityNotFound(_0x4f3dbc,null))[_0xdb1a('0x2a')](function(_0x4efcd2){if(_0x4efcd2){_0x2ec7d1=_0x4efcd2;if(!_0x2ec7d1[_0xdb1a('0x84')]||!_0x2ec7d1[_0xdb1a('0x85')]||!_0x2ec7d1[_0xdb1a('0x86')]||!_0x2ec7d1[_0xdb1a('0x87')]||!_0x2ec7d1[_0xdb1a('0x78')]){throw new db[(_0xdb1a('0x5a'))]['ValidationError'](_0xdb1a('0x88'));}if(_0x4c60aa[_0xdb1a('0x51')][_0xdb1a('0x89')]&&(!_0x2ec7d1[_0xdb1a('0x8a')]||!_0x2ec7d1[_0xdb1a('0x8b')]||!_0x2ec7d1['sentimentRegion']||!_0x2ec7d1[_0xdb1a('0x87')]||!_0x2ec7d1['bucket'])){throw new db[(_0xdb1a('0x5a'))][(_0xdb1a('0x67'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xdb1a('0x8c')][_0xdb1a('0x83')]({'where':{'id':_0x2ec7d1['transcribeAccountId']}});}})[_0xdb1a('0x2a')](function(_0x289504){if(!_0x289504){throw new db['Sequelize']['ValidationError'](_0xdb1a('0x8d'));}if(!_0x289504[_0xdb1a('0x8e')]||!_0x289504['data2']){throw new db[(_0xdb1a('0x5a'))]['ValidationError'](_0xdb1a('0x8f'));}_0x42c3f4=_0x289504;return getBucketslist(_0x42c3f4[_0xdb1a('0x8e')],_0x42c3f4[_0xdb1a('0x90')],_0x2ec7d1[_0xdb1a('0x86')]);})[_0xdb1a('0x2a')](function(_0x4a249f){if(_0x4a249f&&_0x4a249f[_0xdb1a('0x91')]){var _0x19efa8=_['find'](_0x4a249f[_0xdb1a('0x91')],function(_0x14d909){return _0x14d909[_0xdb1a('0x92')]===_0x2ec7d1[_0xdb1a('0x78')];});if(!_0x19efa8){logger['info'](util[_0xdb1a('0x38')](_0xdb1a('0x93'),_0x4c60aa[_0xdb1a('0x4e')]['id'],_0x2ec7d1['bucket']));return createBucket(_0x42c3f4[_0xdb1a('0x8e')],_0x42c3f4[_0xdb1a('0x90')],_0x2ec7d1[_0xdb1a('0x86')],_0x2ec7d1['bucket']);}logger[_0xdb1a('0x6a')](util[_0xdb1a('0x38')](_0xdb1a('0x94'),_0x4c60aa[_0xdb1a('0x4e')]['id'],_0x2ec7d1[_0xdb1a('0x78')]));return;}})[_0xdb1a('0x2a')](function(_0x1f30d1){if(_0x1aa328[_0xdb1a('0x7f')]===_0xdb1a('0x95')){return transcribe(_0x4c60aa['params']['id'],_0x42c3f4[_0xdb1a('0x8e')],_0x42c3f4[_0xdb1a('0x90')],_0x2ec7d1[_0xdb1a('0x86')],_0x2ec7d1[_0xdb1a('0x78')],_0x1aa328['value'],_0x2ec7d1[_0xdb1a('0x87')]);}else{logger[_0xdb1a('0x6a')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4c60aa[_0xdb1a('0x4e')]['id']));return{'transcribeStatus':_0xdb1a('0x96')};}})[_0xdb1a('0x2a')](function(_0x17c259){if(_0x17c259){_0x17c259[_0xdb1a('0x97')]=_0x4c60aa[_0xdb1a('0x51')][_0xdb1a('0x89')];return _0x1aa328[_0xdb1a('0x98')](_0x17c259);}})[_0xdb1a('0x2a')](respondWithResult(_0x4f3dbc,null))[_0xdb1a('0x4c')](handleError(_0x4f3dbc,null));};function writeFile(_0x308051,_0x2d9717){return new Promise(function(_0x5deb98,_0x25cf74){fs[_0xdb1a('0x99')](_0x2d9717,_0x308051,function(_0x1c68b8,_0x39b999){if(_0x1c68b8){return _0x25cf74(_0x1c68b8);}else{return _0x5deb98(_0x39b999);}});});}exports['downloadTranscribe']=function(_0x5d465f,_0x78ac89,_0x14fa22){return db[_0xdb1a('0x31')][_0xdb1a('0x83')]({'where':{'id':_0x5d465f[_0xdb1a('0x4e')]['id']}})[_0xdb1a('0x2a')](handleEntityNotFound(_0x78ac89))['then'](function(_0x1286c2){if(_0x1286c2&&_0x1286c2[_0xdb1a('0x9a')]){var _0x11c818=_0x1286c2[_0xdb1a('0x9a')];var _0x993af6=config['root']+_0xdb1a('0x9b')+_0x1286c2['id']+'.txt';if(fs['existsSync'](_0x993af6)){return _0x993af6;}return writeFile(_0x11c818,_0x993af6)[_0xdb1a('0x2a')](function(){return _0x993af6;});}else{throw new db[(_0xdb1a('0x5a'))][(_0xdb1a('0x67'))](_0xdb1a('0x9c'));}})['then'](function(_0x33bdb3){return _0x78ac89[_0xdb1a('0x5c')](_0x33bdb3);})[_0xdb1a('0x4c')](handleError(_0x78ac89));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 783c462..e7e1578 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 _0x9e9b=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./voiceRecording.attributes'];(function(_0x1736e7,_0x30aa5d){var _0x18e00d=function(_0x48734a){while(--_0x48734a){_0x1736e7['push'](_0x1736e7['shift']());}};_0x18e00d(++_0x30aa5d);}(_0x9e9b,0x87));var _0xb9e9=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x9e9b[_0x2134b7];return _0x6c5914;};'use strict';var _=require(_0xb9e9('0x0'));var util=require(_0xb9e9('0x1'));var logger=require(_0xb9e9('0x2'))(_0xb9e9('0x3'));var moment=require(_0xb9e9('0x4'));var BPromise=require('bluebird');var rp=require(_0xb9e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb9e9('0x6'));var attributes=require(_0xb9e9('0x7'));module['exports']=function(_0x1877cf,_0x5c6424){return _0x1877cf['define'](_0xb9e9('0x8'),attributes,{'tableName':_0xb9e9('0x9'),'paranoid':![],'indexes':[{'name':_0xb9e9('0xa'),'fields':[_0xb9e9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf299=['../../config/environment','define','VoiceRecording','uniqueid','lodash','util','api','moment'];(function(_0x2ea477,_0x542d6e){var _0xb86664=function(_0x4774ba){while(--_0x4774ba){_0x2ea477['push'](_0x2ea477['shift']());}};_0xb86664(++_0x542d6e);}(_0xf299,0x154));var _0x9f29=function(_0x4b0e93,_0xf4f143){_0x4b0e93=_0x4b0e93-0x0;var _0x83c2cd=_0xf299[_0x4b0e93];return _0x83c2cd;};'use strict';var _=require(_0x9f29('0x0'));var util=require(_0x9f29('0x1'));var logger=require('../../config/logger')(_0x9f29('0x2'));var moment=require(_0x9f29('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f29('0x4'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x4d8dc8,_0x3b1661){return _0x4d8dc8[_0x9f29('0x5')](_0x9f29('0x6'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x9f29('0x7'),'fields':[_0x9f29('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index be89d17..c193cab 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(_0x212d22,_0x2309d2){var _0x48f2b1=function(_0x43cc92){while(--_0x43cc92){_0x212d22['push'](_0x212d22['shift']());}};_0x48f2b1(++_0x2309d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x320cb3,_0x49c0cf){var _0x899c86=function(_0x9fc8f){while(--_0x9fc8f){_0x320cb3['push'](_0x320cb3['shift']());}};_0x899c86(++_0x49c0cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 13df301..f8a242d 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 _0x2da8=['/describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get'];(function(_0x6cfbf7,_0x374cbb){var _0x407dd1=function(_0x283064){while(--_0x283064){_0x6cfbf7['push'](_0x6cfbf7['shift']());}};_0x407dd1(++_0x374cbb);}(_0x2da8,0x1b8));var _0x82da=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2da8[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x82da('0x0'));var util=require('util');var path=require(_0x82da('0x1'));var timeout=require(_0x82da('0x2'));var express=require(_0x82da('0x3'));var router=express[_0x82da('0x4')]();var fs_extra=require(_0x82da('0x5'));var auth=require(_0x82da('0x6'));var interaction=require(_0x82da('0x7'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x82da('0x8')](),controller['index']);router[_0x82da('0x9')](_0x82da('0xa'),auth[_0x82da('0x8')](),controller['describe']);router['get'](_0x82da('0xb'),auth[_0x82da('0x8')](),controller[_0x82da('0xc')]);router[_0x82da('0xd')]('/',auth[_0x82da('0x8')](),controller[_0x82da('0xe')]);router['put'](_0x82da('0xb'),auth['isAuthenticated'](),controller[_0x82da('0xf')]);router[_0x82da('0x10')](_0x82da('0xb'),auth['isAuthenticated'](),controller[_0x82da('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb71f=['connect-timeout','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','/:id','delete','destroy','exports','multer','path'];(function(_0x4bbefb,_0x36ad00){var _0x1f2a8d=function(_0x55e622){while(--_0x55e622){_0x4bbefb['push'](_0x4bbefb['shift']());}};_0x1f2a8d(++_0x36ad00);}(_0xb71f,0xfe));var _0xfb71=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0xb71f[_0x6182ff];return _0x1cec22;};'use strict';var multer=require(_0xfb71('0x0'));var util=require('util');var path=require(_0xfb71('0x1'));var timeout=require(_0xfb71('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfb71('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfb71('0x4'));var config=require('../../config/environment');var controller=require(_0xfb71('0x5'));router[_0xfb71('0x6')]('/',auth[_0xfb71('0x7')](),controller['index']);router[_0xfb71('0x6')](_0xfb71('0x8'),auth[_0xfb71('0x7')](),controller[_0xfb71('0x9')]);router[_0xfb71('0x6')]('/:id',auth[_0xfb71('0x7')](),controller[_0xfb71('0xa')]);router[_0xfb71('0xb')]('/',auth[_0xfb71('0x7')](),controller['create']);router['put'](_0xfb71('0xc'),auth[_0xfb71('0x7')](),controller['update']);router[_0xfb71('0xd')](_0xfb71('0xc'),auth['isAuthenticated'](),controller[_0xfb71('0xe')]);module[_0xfb71('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 19dbdf3..a11ba2c 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 _0xeaac=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xeaac,0x7b));var _0xceaa=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xeaac[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xceaa('0x0'));var moment=require(_0xceaa('0x1'));module[_0xceaa('0x2')]={'type':{'type':Sequelize[_0xceaa('0x3')](_0xceaa('0x4'),_0xceaa('0x5'))},'result':{'type':Sequelize[_0xceaa('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xceaa('0x6')]},'transferercalleridname':{'type':Sequelize[_0xceaa('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xceaa('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xceaa('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xceaa('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xceaa('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xceaa('0x6')]},'transfereecontext':{'type':Sequelize[_0xceaa('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xceaa('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0xceaa('0x7'),'No')},'context':{'type':Sequelize[_0xceaa('0x6')]},'extension':{'type':Sequelize[_0xceaa('0x6')]}}; \ No newline at end of file +var _0xc5e8=['sequelize','exports','ENUM','blind','attended','STRING'];(function(_0x5c04e9,_0x5408c0){var _0x29e424=function(_0x1d8048){while(--_0x1d8048){_0x5c04e9['push'](_0x5c04e9['shift']());}};_0x29e424(++_0x5408c0);}(_0xc5e8,0x1b6));var _0x8c5e=function(_0x1714c2,_0x5ec46f){_0x1714c2=_0x1714c2-0x0;var _0x5e643e=_0xc5e8[_0x1714c2];return _0x5e643e;};'use strict';var Sequelize=require(_0x8c5e('0x0'));var moment=require('moment');module[_0x8c5e('0x1')]={'type':{'type':Sequelize[_0x8c5e('0x2')](_0x8c5e('0x3'),_0x8c5e('0x4'))},'result':{'type':Sequelize[_0x8c5e('0x5')]},'transfererchannel':{'type':Sequelize[_0x8c5e('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8c5e('0x5')]},'transferercalleridname':{'type':Sequelize[_0x8c5e('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8c5e('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x8c5e('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x8c5e('0x5')]},'transferercontext':{'type':Sequelize[_0x8c5e('0x5')]},'transfererexten':{'type':Sequelize[_0x8c5e('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x8c5e('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8c5e('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8c5e('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x8c5e('0x5')]},'transfereecontext':{'type':Sequelize[_0x8c5e('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x8c5e('0x5')]},'isexternal':{'type':Sequelize[_0x8c5e('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x8c5e('0x5')]},'extension':{'type':Sequelize[_0x8c5e('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 74a52be..8fc78d3 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 _0xdb28=['error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','catch','params','intersection','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xdb28,0x106));var _0x8db2=function(_0x59f903,_0x10a2e9){_0x59f903=_0x59f903-0x0;var _0x5604c1=_0xdb28[_0x59f903];return _0x5604c1;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8db2('0xb'));var squel=require(_0x8db2('0xc'));var crypto=require(_0x8db2('0xd'));var jsforce=require(_0x8db2('0xe'));var deskjs=require(_0x8db2('0xf'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0x10'));var Papa=require('papaparse');var Redis=require(_0x8db2('0x11'));var authService=require(_0x8db2('0x12'));var qs=require(_0x8db2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8db2('0x14'));var logger=require(_0x8db2('0x15'))('api');var utils=require(_0x8db2('0x16'));var config=require(_0x8db2('0x17'));var licenseUtil=require(_0x8db2('0x18'));var db=require(_0x8db2('0x19'))['db'];function respondWithStatusCode(_0x37d017,_0x559fb1){_0x559fb1=_0x559fb1||0xcc;return function(_0x49fadc){if(_0x49fadc){return _0x37d017[_0x8db2('0x1a')](_0x559fb1);}return _0x37d017[_0x8db2('0x1b')](_0x559fb1)[_0x8db2('0x1c')]();};}function respondWithResult(_0x1d6a15,_0x227355){_0x227355=_0x227355||0xc8;return function(_0xfa285b){if(_0xfa285b){return _0x1d6a15[_0x8db2('0x1b')](_0x227355)[_0x8db2('0x1d')](_0xfa285b);}};}function respondWithFilteredResult(_0x131252,_0x16c8c2){return function(_0x5489a9){if(_0x5489a9){var _0x13b0f5=_0x5489a9[_0x8db2('0x1e')],_0x24da1b=_0x16c8c2[_0x8db2('0x1f')],_0x48101e=_0x16c8c2[_0x8db2('0x1f')]+_0x16c8c2[_0x8db2('0x20')],_0x2b3f73;if(_0x48101e>=_0x13b0f5){_0x48101e=_0x13b0f5;_0x2b3f73=0xc8;}else{_0x2b3f73=0xce;}_0x131252[_0x8db2('0x1b')](_0x2b3f73);return _0x131252['set']('Content-Range',_0x24da1b+'-'+_0x48101e+'/'+_0x13b0f5)[_0x8db2('0x1d')](_0x5489a9);}return null;};}function patchUpdates(_0x104e33){return function(_0x1310d3){try{jsonpatch[_0x8db2('0x21')](_0x1310d3,_0x104e33,!![]);}catch(_0x58562e){return BPromise[_0x8db2('0x22')](_0x58562e);}return _0x1310d3[_0x8db2('0x23')]();};}function saveUpdates(_0x260940,_0x297ba3){return function(_0x3dbe8e){if(_0x3dbe8e){return _0x3dbe8e['update'](_0x260940)[_0x8db2('0x24')](function(_0x3e30e6){return _0x3e30e6;});}return null;};}function removeEntity(_0x18f69c,_0x125be2){return function(_0x2260d8){if(_0x2260d8){return _0x2260d8[_0x8db2('0x25')]()[_0x8db2('0x24')](function(){_0x18f69c['status'](0xcc)[_0x8db2('0x1c')]();});}};}function handleEntityNotFound(_0x4f6516,_0x5725f0){return function(_0x52a9ca){if(!_0x52a9ca){_0x4f6516['sendStatus'](0x194);}return _0x52a9ca;};}function handleError(_0xec8cd2,_0x29b5cd){_0x29b5cd=_0x29b5cd||0x1f4;return function(_0x3be281){logger[_0x8db2('0x26')](_0x3be281[_0x8db2('0x27')]);if(_0x3be281[_0x8db2('0x28')]){delete _0x3be281['name'];}_0xec8cd2[_0x8db2('0x1b')](_0x29b5cd)[_0x8db2('0x29')](_0x3be281);};}exports[_0x8db2('0x2a')]=function(_0x8b7cec,_0x483aee){var _0x2e0691={},_0x11f398={},_0x241baf={'count':0x0,'rows':[]};var _0x1687ed=_[_0x8db2('0x2b')](db[_0x8db2('0x2c')][_0x8db2('0x2d')],function(_0x3124d5){return{'name':_0x3124d5[_0x8db2('0x2e')],'type':_0x3124d5['type'][_0x8db2('0x2f')]};});_0x11f398['model']=_['map'](_0x1687ed,_0x8db2('0x28'));_0x11f398[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x8b7cec['query']);_0x11f398[_0x8db2('0x32')]=_['intersection'](_0x11f398[_0x8db2('0x33')],_0x11f398[_0x8db2('0x30')]);_0x2e0691[_0x8db2('0x34')]=_['intersection'](_0x11f398['model'],qs[_0x8db2('0x35')](_0x8b7cec[_0x8db2('0x30')]['fields']));_0x2e0691['attributes']=_0x2e0691[_0x8db2('0x34')][_0x8db2('0x36')]?_0x2e0691[_0x8db2('0x34')]:_0x11f398[_0x8db2('0x33')];if(!_0x8b7cec[_0x8db2('0x30')][_0x8db2('0x37')](_0x8db2('0x38'))){_0x2e0691[_0x8db2('0x20')]=qs[_0x8db2('0x20')](_0x8b7cec[_0x8db2('0x30')]['limit']);_0x2e0691[_0x8db2('0x1f')]=qs[_0x8db2('0x1f')](_0x8b7cec['query'][_0x8db2('0x1f')]);}_0x2e0691[_0x8db2('0x39')]=qs['sort'](_0x8b7cec['query'][_0x8db2('0x3a')]);_0x2e0691['where']=qs[_0x8db2('0x32')](_[_0x8db2('0x3b')](_0x8b7cec[_0x8db2('0x30')],_0x11f398[_0x8db2('0x32')]),_0x1687ed);if(_0x8b7cec['query'][_0x8db2('0x3c')]){_0x2e0691['where']=_[_0x8db2('0x3d')](_0x2e0691[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x2b')](_0x1687ed,function(_0x4599c3){if(_0x4599c3['type']!=='VIRTUAL'){var _0x2acd1f={};_0x2acd1f[_0x4599c3[_0x8db2('0x28')]]={'$like':'%'+_0x8b7cec['query'][_0x8db2('0x3c')]+'%'};return _0x2acd1f;}})});}_0x2e0691=_[_0x8db2('0x3d')]({},_0x2e0691,_0x8b7cec[_0x8db2('0x3f')]);var _0x4cb253={'where':_0x2e0691[_0x8db2('0x3e')]};return db[_0x8db2('0x2c')][_0x8db2('0x1e')](_0x4cb253)[_0x8db2('0x24')](function(_0x2e6f0c){_0x241baf[_0x8db2('0x1e')]=_0x2e6f0c;if(_0x8b7cec[_0x8db2('0x30')][_0x8db2('0x40')]){_0x2e0691[_0x8db2('0x41')]=[{'all':!![]}];}return db[_0x8db2('0x2c')][_0x8db2('0x42')](_0x2e0691);})[_0x8db2('0x24')](function(_0x1d9025){_0x241baf['rows']=_0x1d9025;return _0x241baf;})[_0x8db2('0x24')](respondWithFilteredResult(_0x483aee,_0x2e0691))[_0x8db2('0x43')](handleError(_0x483aee,null));};exports['show']=function(_0x49a7ae,_0x249c73){var _0x4f1a49={'raw':!![],'where':{'id':_0x49a7ae[_0x8db2('0x44')]['id']}},_0x130eb9={};_0x130eb9[_0x8db2('0x33')]=_[_0x8db2('0x31')](db[_0x8db2('0x2c')][_0x8db2('0x2d')]);_0x130eb9[_0x8db2('0x30')]=_['keys'](_0x49a7ae[_0x8db2('0x30')]);_0x130eb9[_0x8db2('0x32')]=_[_0x8db2('0x45')](_0x130eb9[_0x8db2('0x33')],_0x130eb9['query']);_0x4f1a49[_0x8db2('0x34')]=_[_0x8db2('0x45')](_0x130eb9[_0x8db2('0x33')],qs[_0x8db2('0x35')](_0x49a7ae['query'][_0x8db2('0x35')]));_0x4f1a49['attributes']=_0x4f1a49[_0x8db2('0x34')][_0x8db2('0x36')]?_0x4f1a49[_0x8db2('0x34')]:_0x130eb9['model'];if(_0x49a7ae['query'][_0x8db2('0x40')]){_0x4f1a49['include']=[{'all':!![]}];}_0x4f1a49=_[_0x8db2('0x3d')]({},_0x4f1a49,_0x49a7ae[_0x8db2('0x3f')]);return db[_0x8db2('0x2c')][_0x8db2('0x46')](_0x4f1a49)[_0x8db2('0x24')](handleEntityNotFound(_0x249c73,null))[_0x8db2('0x24')](respondWithResult(_0x249c73,null))[_0x8db2('0x43')](handleError(_0x249c73,null));};exports[_0x8db2('0x47')]=function(_0x4291e3,_0x12a1ef){return db[_0x8db2('0x2c')][_0x8db2('0x47')](_0x4291e3['body'],{})[_0x8db2('0x24')](respondWithResult(_0x12a1ef,0xc9))[_0x8db2('0x43')](handleError(_0x12a1ef,null));};exports[_0x8db2('0x48')]=function(_0x3244db,_0x4f5018){if(_0x3244db['body']['id']){delete _0x3244db[_0x8db2('0x49')]['id'];}return db[_0x8db2('0x2c')][_0x8db2('0x46')]({'where':{'id':_0x3244db['params']['id']}})['then'](handleEntityNotFound(_0x4f5018,null))['then'](saveUpdates(_0x3244db[_0x8db2('0x49')],null))[_0x8db2('0x24')](respondWithResult(_0x4f5018,null))[_0x8db2('0x43')](handleError(_0x4f5018,null));};exports[_0x8db2('0x25')]=function(_0xaab731,_0x4195ef){return db[_0x8db2('0x2c')]['find']({'where':{'id':_0xaab731['params']['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4195ef,null))[_0x8db2('0x24')](removeEntity(_0x4195ef,null))[_0x8db2('0x43')](handleError(_0x4195ef,null));};exports[_0x8db2('0x4a')]=function(_0x3daed6,_0x2bf408){return db[_0x8db2('0x2c')][_0x8db2('0x4a')]()[_0x8db2('0x24')](respondWithResult(_0x2bf408,null))[_0x8db2('0x43')](handleError(_0x2bf408,null));}; \ No newline at end of file +var _0x0b0e=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','map','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','limit','apply','reject','update','then','destroy','sendStatus','error','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4fa97c,_0x4aa6ab){_0x4fa97c=_0x4fa97c-0x0;var _0x518c7f=_0x0b0e[_0x4fa97c];return _0x518c7f;};'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 fs_extra=require(_0xe0b0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0b0('0xd'));var jsforce=require(_0xe0b0('0xe'));var deskjs=require(_0xe0b0('0xf'));var toCsv=require(_0xe0b0('0xa'));var querystring=require('querystring');var Papa=require(_0xe0b0('0x10'));var Redis=require(_0xe0b0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe0b0('0x12'));var as=require(_0xe0b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b0('0x14'))(_0xe0b0('0x15'));var utils=require(_0xe0b0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe0b0('0x17'));var db=require(_0xe0b0('0x18'))['db'];function respondWithStatusCode(_0x3cc19a,_0x45f914){_0x45f914=_0x45f914||0xcc;return function(_0x34fed4){if(_0x34fed4){return _0x3cc19a['sendStatus'](_0x45f914);}return _0x3cc19a[_0xe0b0('0x19')](_0x45f914)[_0xe0b0('0x1a')]();};}function respondWithResult(_0x743318,_0x24babd){_0x24babd=_0x24babd||0xc8;return function(_0x177c24){if(_0x177c24){return _0x743318['status'](_0x24babd)[_0xe0b0('0x1b')](_0x177c24);}};}function respondWithFilteredResult(_0x5adb01,_0x35cb40){return function(_0xadee6e){if(_0xadee6e){var _0x519ae8=_0xadee6e[_0xe0b0('0x1c')],_0x11fdca=_0x35cb40['offset'],_0x4a4cc0=_0x35cb40['offset']+_0x35cb40[_0xe0b0('0x1d')],_0x2d6fb6;if(_0x4a4cc0>=_0x519ae8){_0x4a4cc0=_0x519ae8;_0x2d6fb6=0xc8;}else{_0x2d6fb6=0xce;}_0x5adb01['status'](_0x2d6fb6);return _0x5adb01['set']('Content-Range',_0x11fdca+'-'+_0x4a4cc0+'/'+_0x519ae8)[_0xe0b0('0x1b')](_0xadee6e);}return null;};}function patchUpdates(_0x50fa4a){return function(_0x52598b){try{jsonpatch[_0xe0b0('0x1e')](_0x52598b,_0x50fa4a,!![]);}catch(_0x59dff5){return BPromise[_0xe0b0('0x1f')](_0x59dff5);}return _0x52598b['save']();};}function saveUpdates(_0x2c84cc,_0x1cd7c4){return function(_0x3e10b3){if(_0x3e10b3){return _0x3e10b3[_0xe0b0('0x20')](_0x2c84cc)[_0xe0b0('0x21')](function(_0x58b804){return _0x58b804;});}return null;};}function removeEntity(_0x4cae54,_0x2fa820){return function(_0x5512bb){if(_0x5512bb){return _0x5512bb[_0xe0b0('0x22')]()[_0xe0b0('0x21')](function(){_0x4cae54['status'](0xcc)[_0xe0b0('0x1a')]();});}};}function handleEntityNotFound(_0x503883,_0x2208d0){return function(_0x49a727){if(!_0x49a727){_0x503883[_0xe0b0('0x23')](0x194);}return _0x49a727;};}function handleError(_0x576352,_0x3e5c88){_0x3e5c88=_0x3e5c88||0x1f4;return function(_0x4de537){logger[_0xe0b0('0x24')](_0x4de537['stack']);if(_0x4de537[_0xe0b0('0x25')]){delete _0x4de537['name'];}_0x576352[_0xe0b0('0x19')](_0x3e5c88)[_0xe0b0('0x26')](_0x4de537);};}exports[_0xe0b0('0x27')]=function(_0x1d91ad,_0x3ec2){var _0x10745d={},_0x5200a6={},_0x1444b9={'count':0x0,'rows':[]};var _0x1b8aa8=_['map'](db[_0xe0b0('0x28')][_0xe0b0('0x29')],function(_0x36d137){return{'name':_0x36d137[_0xe0b0('0x2a')],'type':_0x36d137[_0xe0b0('0x2b')][_0xe0b0('0x2c')]};});_0x5200a6[_0xe0b0('0x2d')]=_['map'](_0x1b8aa8,_0xe0b0('0x25'));_0x5200a6[_0xe0b0('0x2e')]=_['keys'](_0x1d91ad['query']);_0x5200a6[_0xe0b0('0x2f')]=_[_0xe0b0('0x30')](_0x5200a6[_0xe0b0('0x2d')],_0x5200a6[_0xe0b0('0x2e')]);_0x10745d[_0xe0b0('0x31')]=_['intersection'](_0x5200a6[_0xe0b0('0x2d')],qs[_0xe0b0('0x32')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x32')]));_0x10745d[_0xe0b0('0x31')]=_0x10745d['attributes'][_0xe0b0('0x33')]?_0x10745d[_0xe0b0('0x31')]:_0x5200a6[_0xe0b0('0x2d')];if(!_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x34')](_0xe0b0('0x35'))){_0x10745d[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x10745d[_0xe0b0('0x36')]=qs[_0xe0b0('0x36')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x36')]);}_0x10745d[_0xe0b0('0x37')]=qs['sort'](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x10745d[_0xe0b0('0x39')]=qs[_0xe0b0('0x2f')](_[_0xe0b0('0x3a')](_0x1d91ad[_0xe0b0('0x2e')],_0x5200a6[_0xe0b0('0x2f')]),_0x1b8aa8);if(_0x1d91ad['query']['filter']){_0x10745d['where']=_['merge'](_0x10745d[_0xe0b0('0x39')],{'$or':_[_0xe0b0('0x3b')](_0x1b8aa8,function(_0xe6f635){if(_0xe6f635['type']!==_0xe0b0('0x3c')){var _0x352c09={};_0x352c09[_0xe6f635[_0xe0b0('0x25')]]={'$like':'%'+_0x1d91ad[_0xe0b0('0x2e')]['filter']+'%'};return _0x352c09;}})});}_0x10745d=_[_0xe0b0('0x3d')]({},_0x10745d,_0x1d91ad[_0xe0b0('0x3e')]);var _0x43d352={'where':_0x10745d[_0xe0b0('0x39')]};return db[_0xe0b0('0x28')][_0xe0b0('0x1c')](_0x43d352)[_0xe0b0('0x21')](function(_0x115a69){_0x1444b9[_0xe0b0('0x1c')]=_0x115a69;if(_0x1d91ad['query'][_0xe0b0('0x3f')]){_0x10745d['include']=[{'all':!![]}];}return db[_0xe0b0('0x28')][_0xe0b0('0x40')](_0x10745d);})[_0xe0b0('0x21')](function(_0x74f3fa){_0x1444b9['rows']=_0x74f3fa;return _0x1444b9;})[_0xe0b0('0x21')](respondWithFilteredResult(_0x3ec2,_0x10745d))[_0xe0b0('0x41')](handleError(_0x3ec2,null));};exports[_0xe0b0('0x42')]=function(_0x402a0e,_0x19c80e){var _0x1c12bd={'raw':!![],'where':{'id':_0x402a0e[_0xe0b0('0x43')]['id']}},_0x3ad564={};_0x3ad564['model']=_[_0xe0b0('0x44')](db[_0xe0b0('0x28')]['rawAttributes']);_0x3ad564['query']=_[_0xe0b0('0x44')](_0x402a0e[_0xe0b0('0x2e')]);_0x3ad564['filters']=_[_0xe0b0('0x30')](_0x3ad564[_0xe0b0('0x2d')],_0x3ad564[_0xe0b0('0x2e')]);_0x1c12bd[_0xe0b0('0x31')]=_[_0xe0b0('0x30')](_0x3ad564['model'],qs['fields'](_0x402a0e['query'][_0xe0b0('0x32')]));_0x1c12bd[_0xe0b0('0x31')]=_0x1c12bd['attributes'][_0xe0b0('0x33')]?_0x1c12bd[_0xe0b0('0x31')]:_0x3ad564[_0xe0b0('0x2d')];if(_0x402a0e[_0xe0b0('0x2e')][_0xe0b0('0x3f')]){_0x1c12bd['include']=[{'all':!![]}];}_0x1c12bd=_['merge']({},_0x1c12bd,_0x402a0e[_0xe0b0('0x3e')]);return db[_0xe0b0('0x28')][_0xe0b0('0x45')](_0x1c12bd)[_0xe0b0('0x21')](handleEntityNotFound(_0x19c80e,null))[_0xe0b0('0x21')](respondWithResult(_0x19c80e,null))['catch'](handleError(_0x19c80e,null));};exports[_0xe0b0('0x46')]=function(_0x11d4fd,_0x534340){return db['VoiceTransferReport']['create'](_0x11d4fd[_0xe0b0('0x47')],{})[_0xe0b0('0x21')](respondWithResult(_0x534340,0xc9))[_0xe0b0('0x41')](handleError(_0x534340,null));};exports[_0xe0b0('0x20')]=function(_0x5b1756,_0x2e2b10){if(_0x5b1756[_0xe0b0('0x47')]['id']){delete _0x5b1756['body']['id'];}return db['VoiceTransferReport'][_0xe0b0('0x45')]({'where':{'id':_0x5b1756[_0xe0b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e2b10,null))[_0xe0b0('0x21')](saveUpdates(_0x5b1756[_0xe0b0('0x47')],null))['then'](respondWithResult(_0x2e2b10,null))['catch'](handleError(_0x2e2b10,null));};exports[_0xe0b0('0x22')]=function(_0x511679,_0x165dc8){return db[_0xe0b0('0x28')][_0xe0b0('0x45')]({'where':{'id':_0x511679[_0xe0b0('0x43')]['id']}})[_0xe0b0('0x21')](handleEntityNotFound(_0x165dc8,null))[_0xe0b0('0x21')](removeEntity(_0x165dc8,null))['catch'](handleError(_0x165dc8,null));};exports['describe']=function(_0x2ef908,_0x5d380a){return db['VoiceTransferReport'][_0xe0b0('0x48')]()[_0xe0b0('0x21')](respondWithResult(_0x5d380a,null))['catch'](handleError(_0x5d380a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index deba4af..d690441 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 _0x9c90=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x35f578,_0x19eb81){var _0x2a458e=function(_0x2d85d1){while(--_0x2d85d1){_0x35f578['push'](_0x35f578['shift']());}};_0x2a458e(++_0x19eb81);}(_0x9c90,0xd1));var _0x09c9=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x9c90[_0x199b1f];return _0x267ac9;};'use strict';var _=require('lodash');var util=require(_0x09c9('0x0'));var logger=require('../../config/logger')(_0x09c9('0x1'));var moment=require(_0x09c9('0x2'));var BPromise=require(_0x09c9('0x3'));var rp=require(_0x09c9('0x4'));var fs=require('fs');var path=require(_0x09c9('0x5'));var rimraf=require(_0x09c9('0x6'));var config=require(_0x09c9('0x7'));var attributes=require(_0x09c9('0x8'));module[_0x09c9('0x9')]=function(_0x2bde04,_0xe483f3){return _0x2bde04[_0x09c9('0xa')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x299e=['../../config/logger','api','request-promise','path','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','util'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x299e,0x1e7));var _0xe299=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x299e[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xe299('0x0'));var logger=require(_0xe299('0x1'))(_0xe299('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe299('0x3'));var fs=require('fs');var path=require(_0xe299('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe299('0x5'));module['exports']=function(_0x473a15,_0x3c1910){return _0x473a15['define'](_0xe299('0x6'),attributes,{'tableName':_0xe299('0x7'),'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 b278333..3dc696d 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 _0xf301=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0xf301,0xe6));var _0x1f30=function(_0x2c7984,_0x39d8e6){_0x2c7984=_0x2c7984-0x0;var _0x22d1b5=_0xf301[_0x2c7984];return _0x22d1b5;};'use strict';var _=require(_0x1f30('0x0'));var util=require(_0x1f30('0x1'));var moment=require(_0x1f30('0x2'));var BPromise=require(_0x1f30('0x3'));var rs=require(_0x1f30('0x4'));var fs=require('fs');var Redis=require(_0x1f30('0x5'));var db=require(_0x1f30('0x6'))['db'];var utils=require(_0x1f30('0x7'));var logger=require(_0x1f30('0x8'))(_0x1f30('0x9'));var config=require(_0x1f30('0xa'));var jayson=require(_0x1f30('0xb'));var client=jayson[_0x1f30('0xc')][_0x1f30('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x82a96f,_0x5a705f,_0x1f77a8){return new BPromise(function(_0x43c98d,_0x2b4484){return client[_0x1f30('0xe')](_0x82a96f,_0x1f77a8)[_0x1f30('0xf')](function(_0xbd04ec){logger[_0x1f30('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5a705f,'request\x20sent');logger[_0x1f30('0x11')](_0x1f30('0x12'),_0x5a705f,_0x1f30('0x13'),JSON[_0x1f30('0x14')](_0xbd04ec));if(_0xbd04ec[_0x1f30('0x15')]){if(_0xbd04ec[_0x1f30('0x15')]['code']===0x1f4){logger[_0x1f30('0x15')](_0x1f30('0x16'),_0x5a705f,_0xbd04ec['error'][_0x1f30('0x17')]);return _0x2b4484(_0xbd04ec[_0x1f30('0x15')][_0x1f30('0x17')]);}logger[_0x1f30('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0x5a705f,_0xbd04ec['error'][_0x1f30('0x17')]);return _0x43c98d(_0xbd04ec[_0x1f30('0x15')][_0x1f30('0x17')]);}else{logger[_0x1f30('0x10')](_0x1f30('0x16'),_0x5a705f,_0x1f30('0x13'));_0x43c98d(_0xbd04ec[_0x1f30('0x18')][_0x1f30('0x17')]);}})[_0x1f30('0x19')](function(_0x1ca3ab){logger[_0x1f30('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0x5a705f,_0x1ca3ab);_0x2b4484(_0x1ca3ab);});});}exports['CreateVoiceTransferReport']=function(_0x4e56cd){var _0x400732=this;return new Promise(function(_0x5cd250,_0x533225){return db[_0x1f30('0x1a')]['create'](_0x4e56cd[_0x1f30('0x1b')],{'raw':_0x4e56cd[_0x1f30('0x1c')]?_0x4e56cd[_0x1f30('0x1c')][_0x1f30('0x1d')]===undefined?!![]:![]:!![]})[_0x1f30('0xf')](function(_0x59fd32){logger['info']('CreateVoiceTransferReport',_0x4e56cd);logger[_0x1f30('0x11')](_0x1f30('0x1e'),_0x4e56cd,JSON['stringify'](_0x59fd32));_0x5cd250(_0x59fd32);})[_0x1f30('0x19')](function(_0x6a644){logger['error']('CreateVoiceTransferReport',_0x6a644['message'],_0x4e56cd);_0x533225(_0x400732['error'](0x1f4,_0x6a644[_0x1f30('0x17')]));});});}; \ No newline at end of file +var _0x95b9=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceTransferReport','create','body','options','raw','debug','lodash','util'];(function(_0x14f009,_0x47a289){var _0x23c84b=function(_0x554b36){while(--_0x554b36){_0x14f009['push'](_0x14f009['shift']());}};_0x23c84b(++_0x47a289);}(_0x95b9,0x10c));var _0x995b=function(_0x1b78c0,_0xaa4084){_0x1b78c0=_0x1b78c0-0x0;var _0x48fd6a=_0x95b9[_0x1b78c0];return _0x48fd6a;};'use strict';var _=require(_0x995b('0x0'));var util=require(_0x995b('0x1'));var moment=require('moment');var BPromise=require(_0x995b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x995b('0x3'));var db=require(_0x995b('0x4'))['db'];var utils=require(_0x995b('0x5'));var logger=require(_0x995b('0x6'))(_0x995b('0x7'));var config=require('../../config/environment');var jayson=require(_0x995b('0x8'));var client=jayson[_0x995b('0x9')][_0x995b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288eab,_0x3bdc1a,_0x416c0c){return new BPromise(function(_0x240a63,_0x409d1d){return client[_0x995b('0xb')](_0x288eab,_0x416c0c)[_0x995b('0xc')](function(_0x6893b0){logger[_0x995b('0xd')](_0x995b('0xe'),_0x3bdc1a,_0x995b('0xf'));logger['debug'](_0x995b('0x10'),_0x3bdc1a,_0x995b('0xf'),JSON[_0x995b('0x11')](_0x6893b0));if(_0x6893b0[_0x995b('0x12')]){if(_0x6893b0[_0x995b('0x12')]['code']===0x1f4){logger[_0x995b('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x3bdc1a,_0x6893b0[_0x995b('0x12')][_0x995b('0x13')]);return _0x409d1d(_0x6893b0[_0x995b('0x12')][_0x995b('0x13')]);}logger[_0x995b('0x12')](_0x995b('0xe'),_0x3bdc1a,_0x6893b0[_0x995b('0x12')][_0x995b('0x13')]);return _0x240a63(_0x6893b0[_0x995b('0x12')][_0x995b('0x13')]);}else{logger['info'](_0x995b('0xe'),_0x3bdc1a,'request\x20sent');_0x240a63(_0x6893b0[_0x995b('0x14')][_0x995b('0x13')]);}})['catch'](function(_0x5a5e70){logger[_0x995b('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x3bdc1a,_0x5a5e70);_0x409d1d(_0x5a5e70);});});}exports[_0x995b('0x15')]=function(_0x154f5b){var _0x1ee38f=this;return new Promise(function(_0x3ad787,_0x109d2e){return db['VoiceTransferReport'][_0x995b('0x16')](_0x154f5b[_0x995b('0x17')],{'raw':_0x154f5b[_0x995b('0x18')]?_0x154f5b['options'][_0x995b('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x6b3552){logger['info'](_0x995b('0x15'),_0x154f5b);logger[_0x995b('0x1a')](_0x995b('0x15'),_0x154f5b,JSON['stringify'](_0x6b3552));_0x3ad787(_0x6b3552);})['catch'](function(_0x48459f){logger[_0x995b('0x12')](_0x995b('0x15'),_0x48459f[_0x995b('0x13')],_0x154f5b);_0x109d2e(_0x1ee38f[_0x995b('0x12')](0x1f4,_0x48459f['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 04f4db0..99b6aa0 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 _0xa631=['/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','/originate','originate','post','/hangup','/answer','isAuthenticated','canUpdate'];(function(_0x480eaa,_0x3cf0ab){var _0x852452=function(_0x54ea23){while(--_0x54ea23){_0x480eaa['push'](_0x480eaa['shift']());}};_0x852452(++_0x3cf0ab);}(_0xa631,0xe4));var _0x1a63=function(_0x30f5e9,_0x33d522){_0x30f5e9=_0x30f5e9-0x0;var _0x321de7=_0xa631[_0x30f5e9];return _0x321de7;};'use strict';var express=require('express');var router=express[_0x1a63('0x0')]();var auth=require(_0x1a63('0x1'));var controller=require(_0x1a63('0x2'));router['post'](_0x1a63('0x3'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x1a63('0x4')]);router[_0x1a63('0x5')](_0x1a63('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router['post'](_0x1a63('0x7'),auth[_0x1a63('0x8')](),auth[_0x1a63('0x9')](),controller['answer']);router['post'](_0x1a63('0xa'),auth[_0x1a63('0x8')](),auth[_0x1a63('0x9')](),controller[_0x1a63('0xb')]);router[_0x1a63('0x5')]('/unhold',auth[_0x1a63('0x8')](),auth[_0x1a63('0x9')](),controller[_0x1a63('0xc')]);router[_0x1a63('0x5')]('/calls',auth[_0x1a63('0x8')](),auth[_0x1a63('0x9')](),controller[_0x1a63('0xd')]);router['post'](_0x1a63('0xe'),auth['isAuthenticated'](),auth[_0x1a63('0x9')](),controller[_0x1a63('0xf')]);module[_0x1a63('0x10')]=router; \ No newline at end of file +var _0xe94a=['/answer','answer','hold','/unhold','unhold','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate','hangup'];(function(_0x38082e,_0xe78dcb){var _0x45b8a8=function(_0x4b64fc){while(--_0x4b64fc){_0x38082e['push'](_0x38082e['shift']());}};_0x45b8a8(++_0xe78dcb);}(_0xe94a,0x1c7));var _0xae94=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xe94a[_0xb6e2ea];return _0x2a57bb;};'use strict';var express=require(_0xae94('0x0'));var router=express[_0xae94('0x1')]();var auth=require(_0xae94('0x2'));var controller=require('./webbar.controller');router[_0xae94('0x3')](_0xae94('0x4'),auth[_0xae94('0x5')](),auth[_0xae94('0x6')](),controller[_0xae94('0x7')]);router[_0xae94('0x3')]('/hangup',auth[_0xae94('0x5')](),auth[_0xae94('0x6')](),controller[_0xae94('0x8')]);router[_0xae94('0x3')](_0xae94('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xae94('0xa')]);router[_0xae94('0x3')]('/hold',auth[_0xae94('0x5')](),auth[_0xae94('0x6')](),controller[_0xae94('0xb')]);router[_0xae94('0x3')](_0xae94('0xc'),auth[_0xae94('0x5')](),auth[_0xae94('0x6')](),controller[_0xae94('0xd')]);router['post']('/calls',auth[_0xae94('0x5')](),auth[_0xae94('0x6')](),controller['calls']);router[_0xae94('0x3')]('/transfer',auth[_0xae94('0x5')](),auth[_0xae94('0x6')](),controller[_0xae94('0xe')]);module[_0xae94('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1aac788..e909f94 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 _0x98a7=['calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','body','length','userId','callNumber','entityFound:','format','user:%s','webbar:originate','json','catch','hangup','info','hangup\x20fired:','webbar:hangup','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!'];(function(_0x4beb14,_0x3d9446){var _0x1e404b=function(_0xb059a0){while(--_0xb059a0){_0x4beb14['push'](_0x4beb14['shift']());}};_0x1e404b(++_0x3d9446);}(_0x98a7,0x9e));var _0x798a=function(_0x41c5f1,_0x2c2f73){_0x41c5f1=_0x41c5f1-0x0;var _0x3f7441=_0x98a7[_0x41c5f1];return _0x3f7441;};'use strict';var path=require(_0x798a('0x0'));var fs=require('fs');var _=require(_0x798a('0x1'));var db=require(_0x798a('0x2'))['db'];var config=require(_0x798a('0x3'));var util=require(_0x798a('0x4'));var BPromise=require(_0x798a('0x5'));var jayson=require(_0x798a('0x6'));var amiClient=jayson['client'][_0x798a('0x7')]({'port':0x232a});var logger=require(_0x798a('0x8'))('webbarapi');var Redis=require('ioredis');config[_0x798a('0x9')]=_[_0x798a('0xa')](config[_0x798a('0x9')],{'host':_0x798a('0xb'),'port':0x18eb});var io=require(_0x798a('0xc'))(new Redis(config[_0x798a('0x9')]));var Schema=require(_0x798a('0xd'));var originateValidation=new Schema({'userId':{'type':_0x798a('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x798a('0xf'),'required':[!![],_0x798a('0x10')]},'callerId':{'type':_0x798a('0xf')},'callbackUrl':{'type':_0x798a('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x798a('0x11')]},'sessionId':{'type':_0x798a('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x798a('0xe'),'required':[!![],_0x798a('0x11')]},'sessionId':{'type':_0x798a('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x798a('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x798a('0xf'),'required':[!![],_0x798a('0x12')]},'transferNumber':{'type':_0x798a('0xf'),'required':[!![],_0x798a('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x798a('0x11')]},'sessionId':{'type':_0x798a('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x798a('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x798a('0xe'),'required':[!![],_0x798a('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x798a('0xe'),'required':[!![],_0x798a('0x11')]}});function emit(_0x560366,_0x1f8329,_0x26b43a){logger['info'](_0x560366,_0x1f8329,JSON[_0x798a('0x14')](_0x26b43a));io['to'](_0x560366)[_0x798a('0x15')](_0x1f8329,_0x26b43a);}function handleError(_0x27ed21){return function(_0x14ddc6){console[_0x798a('0x16')](_0x798a('0x17'),_0x14ddc6,_0x14ddc6 instanceof RangeError);logger[_0x798a('0x18')](_0x14ddc6[_0x798a('0x19')]);if(_0x14ddc6 instanceof RangeError){if(_0x14ddc6[_0x798a('0x1a')]){delete _0x14ddc6[_0x798a('0x1a')];}_0x27ed21[_0x798a('0x1b')](0x194)['send'](_0x14ddc6);}else{if(_0x14ddc6[_0x798a('0x1a')]){delete _0x14ddc6[_0x798a('0x1a')];}_0x27ed21[_0x798a('0x1b')](0x1f4)[_0x798a('0x1c')](_0x14ddc6);}};}function checkError(){return function(_0x2c5837){if(!_0x2c5837){throw new RangeError(_0x798a('0x1d'));}return _0x2c5837;};}function respondWithRpcPromise(_0x318d41,_0xea094d){return new BPromise(function(_0x23e327,_0x2b103c){var _0x4c6e5e=amiClient;return _0x4c6e5e['request'](_0x318d41,_0xea094d)[_0x798a('0x1e')](function(_0xcaf0df){if(_0xcaf0df[_0x798a('0x18')]){if(_0xcaf0df['error'][_0x798a('0x1f')]===0x1f4){return _0x2b103c(_0xcaf0df[_0x798a('0x18')][_0x798a('0x20')]);}return _0x23e327(_0xcaf0df['error'][_0x798a('0x20')]);}else{_0x23e327(_0xcaf0df['result']);}})['catch'](function(_0x294475){_0x2b103c(_0x294475);});});}function getAgent(_0x3d203a){return db['User'][_0x798a('0x21')]({'where':{'id':_0x3d203a,'role':_0x798a('0x22')}})[_0x798a('0x1e')](checkError());}function getAgentCheckSession(_0x2bef37,_0x4c11fa){return new BPromise(function(_0x3eeb44,_0xf28bbf){var _0x288e96=respondWithRpcPromise(_0x798a('0x23'));var _0x5ca780=getAgent(_0x2bef37);Promise[_0x798a('0x24')]([_0x288e96,_0x5ca780])[_0x798a('0x1e')](function(_0x2203ed){var _0x226767=_0x2203ed[0x0];var _0x3e6a67=_0x2203ed[0x1];var _0x27ed3d=_[_0x798a('0x25')](_0x226767['rows'],function(_0x139ea4){return _0x139ea4[_0x798a('0x26')]==_0x3e6a67['id']&&_0x139ea4[_0x798a('0x27')]==_0x4c11fa;});if(_0x27ed3d['length']==0x1){_0x3eeb44(_0x3e6a67);}else{_0xf28bbf(new RangeError(_0x798a('0x28')+_0x4c11fa+_0x798a('0x29')));}});});}exports['originate']=function(_0x4cd933,_0x43ddfc){logger['info']('originate\x20fired:',_0x4cd933[_0x798a('0x2a')]);var _0x282cb1=originateValidation['validate'](_0x4cd933[_0x798a('0x2a')]);if(_0x282cb1[_0x798a('0x2b')]>0x0){return _0x43ddfc[_0x798a('0x1b')](0x190)['json'](_0x282cb1);}var _0x1d3c99=_0x4cd933[_0x798a('0x2a')][_0x798a('0x2c')];var _0x23d9a7=_0x4cd933['body'][_0x798a('0x2d')];var _0x1d524b=_0x4cd933[_0x798a('0x2a')]['callerId'];var _0x4e9798=_0x4cd933[_0x798a('0x2a')]['callbackUrl'];return getAgent(_0x1d3c99)[_0x798a('0x1e')](function(_0x18056a){logger['info'](_0x798a('0x2e'),_0x18056a[_0x798a('0x1a')]);emit(util[_0x798a('0x2f')](_0x798a('0x30'),_0x18056a['name']),_0x798a('0x31'),{'callNumber':_0x23d9a7,'callerId':_0x1d524b,'callbackUrl':_0x4e9798});return _0x43ddfc[_0x798a('0x1b')](0xc8)[_0x798a('0x32')]({'error':![],'message':'originate\x20executed!'});})[_0x798a('0x33')](handleError(_0x43ddfc));};exports[_0x798a('0x34')]=function(_0x61e5ad,_0x17ebb0){logger[_0x798a('0x35')](_0x798a('0x36'),_0x61e5ad['body']);var _0x5511b5=hangupValidation['validate'](_0x61e5ad[_0x798a('0x2a')]);if(_0x5511b5[_0x798a('0x2b')]>0x0){return _0x17ebb0['status'](0x190)[_0x798a('0x32')](_0x5511b5);}var _0x68be5e=_0x61e5ad['body'][_0x798a('0x2c')];var _0x55c978=_0x61e5ad[_0x798a('0x2a')][_0x798a('0x27')];return getAgent(_0x68be5e)[_0x798a('0x1e')](function(_0x135e84){logger[_0x798a('0x35')](_0x798a('0x2e'),_0x135e84['name']);emit(util[_0x798a('0x2f')]('user:%s',_0x135e84['name']),_0x798a('0x37'),{'sessionId':_0x55c978});return _0x17ebb0[_0x798a('0x1b')](0xc8)[_0x798a('0x32')]({'error':![],'message':'hangup\x20executed!'});})[_0x798a('0x33')](handleError(_0x17ebb0));};exports['answer']=function(_0x2eec07,_0x3ac829){logger[_0x798a('0x35')](_0x798a('0x38'),_0x2eec07[_0x798a('0x2a')]);var _0x46ce53=answerValidation[_0x798a('0xd')](_0x2eec07[_0x798a('0x2a')]);if(_0x46ce53[_0x798a('0x2b')]>0x0){return _0x3ac829[_0x798a('0x1b')](0x190)['json'](_0x46ce53);}var _0x37c0fd=_0x2eec07[_0x798a('0x2a')][_0x798a('0x2c')];var _0xc1aa98=_0x2eec07[_0x798a('0x2a')][_0x798a('0x27')];return getAgent(_0x37c0fd)[_0x798a('0x1e')](function(_0x4b55d4){logger[_0x798a('0x35')](_0x798a('0x2e'),_0x4b55d4[_0x798a('0x1a')]);emit(util[_0x798a('0x2f')]('user:%s',_0x4b55d4[_0x798a('0x1a')]),_0x798a('0x39'),{'sessionId':_0xc1aa98});return _0x3ac829[_0x798a('0x1b')](0xc8)[_0x798a('0x32')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x3ac829));};exports[_0x798a('0x3a')]=function(_0x42d2c3,_0x56aa89){logger[_0x798a('0x35')](_0x798a('0x3b'),_0x42d2c3[_0x798a('0x2a')]);var _0xc678fc=holdValidation[_0x798a('0xd')](_0x42d2c3[_0x798a('0x2a')]);if(_0xc678fc['length']>0x0){return _0x56aa89['status'](0x190)[_0x798a('0x32')](_0xc678fc);}var _0x1a6d60=_0x42d2c3[_0x798a('0x2a')]['userId'];var _0x35ab34=_0x42d2c3[_0x798a('0x2a')][_0x798a('0x27')];return getAgent(_0x1a6d60)[_0x798a('0x1e')](function(_0x5d1fd4){logger['info'](_0x798a('0x2e'),_0x5d1fd4[_0x798a('0x1a')]);emit(util['format']('user:%s',_0x5d1fd4[_0x798a('0x1a')]),_0x798a('0x3c'),{'sessionId':_0x35ab34});return _0x56aa89[_0x798a('0x1b')](0xc8)[_0x798a('0x32')]({'error':![],'message':_0x798a('0x3d')});})['catch'](handleError(_0x56aa89));};exports['unhold']=function(_0x6e5d0a,_0x3bad1a){logger[_0x798a('0x35')]('unhold\x20fired:',_0x6e5d0a[_0x798a('0x2a')]);var _0x1cde3d=unholdValidation[_0x798a('0xd')](_0x6e5d0a['body']);if(_0x1cde3d['length']>0x0){return _0x3bad1a[_0x798a('0x1b')](0x190)[_0x798a('0x32')](_0x1cde3d);}var _0x2cb4e6=_0x6e5d0a[_0x798a('0x2a')][_0x798a('0x2c')];var _0x4a9a00=_0x6e5d0a[_0x798a('0x2a')][_0x798a('0x27')];return getAgent(_0x2cb4e6)[_0x798a('0x1e')](function(_0x4fcbcb){logger[_0x798a('0x35')](_0x798a('0x2e'),_0x4fcbcb['name']);emit(util[_0x798a('0x2f')](_0x798a('0x30'),_0x4fcbcb[_0x798a('0x1a')]),_0x798a('0x3e'),{'sessionId':_0x4a9a00});return _0x3bad1a['status'](0xc8)[_0x798a('0x32')]({'error':![],'message':_0x798a('0x3f')});})[_0x798a('0x33')](handleError(_0x3bad1a));};exports[_0x798a('0x40')]=function(_0x3de2cc,_0x3c9af3){logger[_0x798a('0x35')](_0x798a('0x41'),_0x3c9af3[_0x798a('0x2a')]);var _0x8baf84=callsValidation[_0x798a('0xd')](_0x3de2cc[_0x798a('0x2a')]);if(_0x8baf84[_0x798a('0x2b')]>0x0){return _0x3c9af3[_0x798a('0x1b')](0x190)[_0x798a('0x32')](_0x8baf84);}var _0x133cbf=_0x3de2cc[_0x798a('0x2a')][_0x798a('0x2c')];var _0x45ca2f=respondWithRpcPromise(_0x798a('0x23'));var _0x37e3c7=getAgent(_0x133cbf);return Promise[_0x798a('0x24')]([_0x45ca2f,_0x37e3c7])[_0x798a('0x1e')](function(_0x107662){var _0x55d081=_0x107662[0x0];var _0x3c88ca=_0x107662[0x1];var _0x5a15f1=_['filter'](_0x55d081['rows'],function(_0x323b8a){return _0x323b8a[_0x798a('0x26')]==_0x3c88ca['id'];});return _0x3c9af3[_0x798a('0x1b')](0xc8)[_0x798a('0x32')]({'count':_0x5a15f1[_0x798a('0x2b')],'rows':_0x5a15f1});})[_0x798a('0x33')](handleError(_0x3c9af3));};exports[_0x798a('0x42')]=function(_0x50a07a,_0x557d97){logger['info'](_0x798a('0x43'),_0x50a07a['body']);var _0x3d0278=conferenceValidation[_0x798a('0xd')](_0x50a07a[_0x798a('0x2a')]);if(_0x3d0278['length']>0x0){return _0x557d97[_0x798a('0x1b')](0x190)[_0x798a('0x32')](_0x3d0278);}var _0x55cbd2=_0x50a07a[_0x798a('0x2a')][_0x798a('0x2c')];return getAgent(_0x55cbd2)['then'](function(_0x2ad2a1){logger['info'](_0x798a('0x2e'),_0x2ad2a1[_0x798a('0x1a')]);emit(util['format']('user:%s',_0x2ad2a1[_0x798a('0x1a')]),_0x798a('0x44'));return _0x557d97['status'](0xc8)[_0x798a('0x32')]({'error':![],'message':_0x798a('0x45')});})[_0x798a('0x33')](handleError(_0x557d97));};exports['transfer']=function(_0x3549b9,_0xec44e3){logger['info'](_0x798a('0x46'),_0x3549b9[_0x798a('0x2a')]);var _0x1ed1c2=transferValidation['validate'](_0x3549b9['body']);if(_0x1ed1c2[_0x798a('0x2b')]>0x0){return _0xec44e3[_0x798a('0x1b')](0x190)[_0x798a('0x32')](_0x1ed1c2);}var _0x2778c4=_0x3549b9[_0x798a('0x2a')][_0x798a('0x2c')];var _0x4011ac=_0x3549b9[_0x798a('0x2a')]['sessionId'];var _0x462f97=_0x3549b9[_0x798a('0x2a')][_0x798a('0x47')];return getAgent(_0x2778c4)['then'](function(_0x32247e){logger[_0x798a('0x35')]('entityFound:',_0x32247e[_0x798a('0x1a')]);emit(util[_0x798a('0x2f')](_0x798a('0x30'),_0x32247e['name']),_0x798a('0x48'),{'sessionId':_0x4011ac,'transferNumber':_0x462f97});return _0xec44e3[_0x798a('0x1b')](0xc8)[_0x798a('0x32')]({'error':![],'message':_0x798a('0x49')});})['catch'](handleError(_0xec44e3));}; \ No newline at end of file +var _0xdadd=['../../config/logger','webbarapi','ioredis','redis','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','error','code','message','catch','User','findOne','agent','VoiceChannels','all','then','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','status','json','userId','entityFound:','hangup\x20fired:','length','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','user:%s','hold','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','jayson/promise','http'];(function(_0xae5ad4,_0x58b46e){var _0x54d414=function(_0x4dfda7){while(--_0x4dfda7){_0xae5ad4['push'](_0xae5ad4['shift']());}};_0x54d414(++_0x58b46e);}(_0xdadd,0x1c8));var _0xddad=function(_0x3ec0dd,_0x3a5e67){_0x3ec0dd=_0x3ec0dd-0x0;var _0x2818c7=_0xdadd[_0x3ec0dd];return _0x2818c7;};'use strict';var path=require(_0xddad('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xddad('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xddad('0x2'));var BPromise=require(_0xddad('0x3'));var jayson=require(_0xddad('0x4'));var amiClient=jayson['client'][_0xddad('0x5')]({'port':0x232a});var logger=require(_0xddad('0x6'))(_0xddad('0x7'));var Redis=require(_0xddad('0x8'));config['redis']=_['defaults'](config[_0xddad('0x9')],{'host':_0xddad('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xddad('0x9')]));var Schema=require(_0xddad('0xb'));var originateValidation=new Schema({'userId':{'type':_0xddad('0xc'),'required':[!![],_0xddad('0xd')]},'callNumber':{'type':_0xddad('0xe'),'required':[!![],_0xddad('0xf')]},'callerId':{'type':_0xddad('0xe')},'callbackUrl':{'type':_0xddad('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xddad('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xddad('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xddad('0xc'),'required':[!![],_0xddad('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xddad('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xddad('0xe'),'required':[!![],_0xddad('0x10')]},'transferNumber':{'type':_0xddad('0xe'),'required':[!![],_0xddad('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xddad('0xc'),'required':[!![],_0xddad('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xddad('0xc'),'required':[!![],_0xddad('0xd')]},'sessionId':{'type':_0xddad('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xddad('0xc'),'required':[!![],_0xddad('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xddad('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x50c3e4,_0x13af9e,_0x10eb2d){logger[_0xddad('0x12')](_0x50c3e4,_0x13af9e,JSON[_0xddad('0x13')](_0x10eb2d));io['to'](_0x50c3e4)[_0xddad('0x14')](_0x13af9e,_0x10eb2d);}function handleError(_0x512bc9){return function(_0x282b69){console[_0xddad('0x15')](_0xddad('0x16'),_0x282b69,_0x282b69 instanceof RangeError);logger['error'](_0x282b69[_0xddad('0x17')]);if(_0x282b69 instanceof RangeError){if(_0x282b69['name']){delete _0x282b69[_0xddad('0x18')];}_0x512bc9['status'](0x194)['send'](_0x282b69);}else{if(_0x282b69['name']){delete _0x282b69[_0xddad('0x18')];}_0x512bc9['status'](0x1f4)['send'](_0x282b69);}};}function checkError(){return function(_0x56c771){if(!_0x56c771){throw new RangeError('NotFound');}return _0x56c771;};}function respondWithRpcPromise(_0x3fb4bf,_0x4c98a9){return new BPromise(function(_0x1c4db9,_0x450080){var _0x2598c3=amiClient;return _0x2598c3['request'](_0x3fb4bf,_0x4c98a9)['then'](function(_0x59739e){if(_0x59739e[_0xddad('0x19')]){if(_0x59739e['error'][_0xddad('0x1a')]===0x1f4){return _0x450080(_0x59739e[_0xddad('0x19')][_0xddad('0x1b')]);}return _0x1c4db9(_0x59739e[_0xddad('0x19')][_0xddad('0x1b')]);}else{_0x1c4db9(_0x59739e['result']);}})[_0xddad('0x1c')](function(_0x5b3a5b){_0x450080(_0x5b3a5b);});});}function getAgent(_0x5eb1b7){return db[_0xddad('0x1d')][_0xddad('0x1e')]({'where':{'id':_0x5eb1b7,'role':_0xddad('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x3a0851,_0x4708bf){return new BPromise(function(_0x513587,_0x172901){var _0x58797f=respondWithRpcPromise(_0xddad('0x20'));var _0x53c761=getAgent(_0x3a0851);Promise[_0xddad('0x21')]([_0x58797f,_0x53c761])[_0xddad('0x22')](function(_0x55ea75){var _0x108192=_0x55ea75[0x0];var _0x5617c0=_0x55ea75[0x1];var _0x424608=_['filter'](_0x108192[_0xddad('0x23')],function(_0xf5daec){return _0xf5daec[_0xddad('0x24')]==_0x5617c0['id']&&_0xf5daec[_0xddad('0x25')]==_0x4708bf;});if(_0x424608['length']==0x1){_0x513587(_0x5617c0);}else{_0x172901(new RangeError(_0xddad('0x26')+_0x4708bf+_0xddad('0x27')));}});});}exports['originate']=function(_0x40fce4,_0x516d82){logger['info'](_0xddad('0x28'),_0x40fce4[_0xddad('0x29')]);var _0x3455b8=originateValidation[_0xddad('0xb')](_0x40fce4[_0xddad('0x29')]);if(_0x3455b8['length']>0x0){return _0x516d82[_0xddad('0x2a')](0x190)[_0xddad('0x2b')](_0x3455b8);}var _0x301f7a=_0x40fce4['body'][_0xddad('0x2c')];var _0x4895cf=_0x40fce4[_0xddad('0x29')]['callNumber'];var _0x22233e=_0x40fce4[_0xddad('0x29')]['callerId'];var _0x2ccf30=_0x40fce4['body']['callbackUrl'];return getAgent(_0x301f7a)['then'](function(_0x51e6b3){logger[_0xddad('0x12')](_0xddad('0x2d'),_0x51e6b3['name']);emit(util['format']('user:%s',_0x51e6b3[_0xddad('0x18')]),'webbar:originate',{'callNumber':_0x4895cf,'callerId':_0x22233e,'callbackUrl':_0x2ccf30});return _0x516d82[_0xddad('0x2a')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x516d82));};exports['hangup']=function(_0x5ade8f,_0x34960c){logger[_0xddad('0x12')](_0xddad('0x2e'),_0x5ade8f[_0xddad('0x29')]);var _0x8b8def=hangupValidation[_0xddad('0xb')](_0x5ade8f[_0xddad('0x29')]);if(_0x8b8def[_0xddad('0x2f')]>0x0){return _0x34960c[_0xddad('0x2a')](0x190)[_0xddad('0x2b')](_0x8b8def);}var _0x365551=_0x5ade8f[_0xddad('0x29')]['userId'];var _0x87c9ba=_0x5ade8f[_0xddad('0x29')]['sessionId'];return getAgent(_0x365551)[_0xddad('0x22')](function(_0x5437c9){logger[_0xddad('0x12')](_0xddad('0x2d'),_0x5437c9[_0xddad('0x18')]);emit(util[_0xddad('0x30')]('user:%s',_0x5437c9['name']),_0xddad('0x31'),{'sessionId':_0x87c9ba});return _0x34960c[_0xddad('0x2a')](0xc8)[_0xddad('0x2b')]({'error':![],'message':_0xddad('0x32')});})[_0xddad('0x1c')](handleError(_0x34960c));};exports['answer']=function(_0x69cf03,_0x407061){logger['info'](_0xddad('0x33'),_0x69cf03[_0xddad('0x29')]);var _0x17bded=answerValidation['validate'](_0x69cf03[_0xddad('0x29')]);if(_0x17bded[_0xddad('0x2f')]>0x0){return _0x407061[_0xddad('0x2a')](0x190)[_0xddad('0x2b')](_0x17bded);}var _0x70e3a4=_0x69cf03[_0xddad('0x29')][_0xddad('0x2c')];var _0x17a1ca=_0x69cf03[_0xddad('0x29')]['sessionId'];return getAgent(_0x70e3a4)[_0xddad('0x22')](function(_0x35e712){logger[_0xddad('0x12')](_0xddad('0x2d'),_0x35e712['name']);emit(util['format'](_0xddad('0x34'),_0x35e712[_0xddad('0x18')]),'webbar:answer',{'sessionId':_0x17a1ca});return _0x407061[_0xddad('0x2a')](0xc8)[_0xddad('0x2b')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x407061));};exports[_0xddad('0x35')]=function(_0x17d1e0,_0x23bdb0){logger[_0xddad('0x12')]('hold\x20fired:',_0x17d1e0['body']);var _0x524177=holdValidation[_0xddad('0xb')](_0x17d1e0[_0xddad('0x29')]);if(_0x524177['length']>0x0){return _0x23bdb0['status'](0x190)[_0xddad('0x2b')](_0x524177);}var _0x43b19c=_0x17d1e0[_0xddad('0x29')][_0xddad('0x2c')];var _0x5a0c52=_0x17d1e0[_0xddad('0x29')]['sessionId'];return getAgent(_0x43b19c)[_0xddad('0x22')](function(_0x1ada5e){logger['info'](_0xddad('0x2d'),_0x1ada5e[_0xddad('0x18')]);emit(util['format']('user:%s',_0x1ada5e[_0xddad('0x18')]),_0xddad('0x36'),{'sessionId':_0x5a0c52});return _0x23bdb0[_0xddad('0x2a')](0xc8)[_0xddad('0x2b')]({'error':![],'message':_0xddad('0x37')});})[_0xddad('0x1c')](handleError(_0x23bdb0));};exports['unhold']=function(_0x43dd61,_0x440124){logger['info']('unhold\x20fired:',_0x43dd61['body']);var _0x3a6098=unholdValidation[_0xddad('0xb')](_0x43dd61['body']);if(_0x3a6098[_0xddad('0x2f')]>0x0){return _0x440124[_0xddad('0x2a')](0x190)[_0xddad('0x2b')](_0x3a6098);}var _0x4e9d26=_0x43dd61[_0xddad('0x29')][_0xddad('0x2c')];var _0x4f29e1=_0x43dd61[_0xddad('0x29')]['sessionId'];return getAgent(_0x4e9d26)[_0xddad('0x22')](function(_0xec8c81){logger[_0xddad('0x12')](_0xddad('0x2d'),_0xec8c81[_0xddad('0x18')]);emit(util[_0xddad('0x30')](_0xddad('0x34'),_0xec8c81[_0xddad('0x18')]),_0xddad('0x38'),{'sessionId':_0x4f29e1});return _0x440124[_0xddad('0x2a')](0xc8)[_0xddad('0x2b')]({'error':![],'message':_0xddad('0x39')});})[_0xddad('0x1c')](handleError(_0x440124));};exports['calls']=function(_0x8bf492,_0x1efb1e){logger['info']('calls\x20fired:',_0x1efb1e[_0xddad('0x29')]);var _0x5b7a23=callsValidation['validate'](_0x8bf492[_0xddad('0x29')]);if(_0x5b7a23[_0xddad('0x2f')]>0x0){return _0x1efb1e[_0xddad('0x2a')](0x190)[_0xddad('0x2b')](_0x5b7a23);}var _0x1bb500=_0x8bf492[_0xddad('0x29')][_0xddad('0x2c')];var _0x364fa3=respondWithRpcPromise('VoiceChannels');var _0x26a232=getAgent(_0x1bb500);return Promise[_0xddad('0x21')]([_0x364fa3,_0x26a232])['then'](function(_0x1afbb6){var _0x2e9ef8=_0x1afbb6[0x0];var _0x42e249=_0x1afbb6[0x1];var _0x23472e=_['filter'](_0x2e9ef8[_0xddad('0x23')],function(_0x1ef505){return _0x1ef505[_0xddad('0x24')]==_0x42e249['id'];});return _0x1efb1e['status'](0xc8)[_0xddad('0x2b')]({'count':_0x23472e[_0xddad('0x2f')],'rows':_0x23472e});})[_0xddad('0x1c')](handleError(_0x1efb1e));};exports[_0xddad('0x3a')]=function(_0x44974b,_0xc23a9b){logger[_0xddad('0x12')]('conference\x20fired:',_0x44974b[_0xddad('0x29')]);var _0x51e62b=conferenceValidation[_0xddad('0xb')](_0x44974b['body']);if(_0x51e62b['length']>0x0){return _0xc23a9b[_0xddad('0x2a')](0x190)[_0xddad('0x2b')](_0x51e62b);}var _0x597828=_0x44974b[_0xddad('0x29')]['userId'];return getAgent(_0x597828)[_0xddad('0x22')](function(_0x57f62a){logger[_0xddad('0x12')](_0xddad('0x2d'),_0x57f62a[_0xddad('0x18')]);emit(util['format'](_0xddad('0x34'),_0x57f62a[_0xddad('0x18')]),_0xddad('0x3b'));return _0xc23a9b['status'](0xc8)[_0xddad('0x2b')]({'error':![],'message':_0xddad('0x3c')});})[_0xddad('0x1c')](handleError(_0xc23a9b));};exports[_0xddad('0x3d')]=function(_0x36befc,_0x3fd02f){logger[_0xddad('0x12')](_0xddad('0x3e'),_0x36befc[_0xddad('0x29')]);var _0x2b19f4=transferValidation['validate'](_0x36befc['body']);if(_0x2b19f4['length']>0x0){return _0x3fd02f[_0xddad('0x2a')](0x190)[_0xddad('0x2b')](_0x2b19f4);}var _0x42f611=_0x36befc[_0xddad('0x29')][_0xddad('0x2c')];var _0x29c739=_0x36befc['body'][_0xddad('0x25')];var _0x444378=_0x36befc[_0xddad('0x29')][_0xddad('0x3f')];return getAgent(_0x42f611)['then'](function(_0x5079ea){logger['info'](_0xddad('0x2d'),_0x5079ea[_0xddad('0x18')]);emit(util[_0xddad('0x30')](_0xddad('0x34'),_0x5079ea[_0xddad('0x18')]),_0xddad('0x40'),{'sessionId':_0x29c739,'transferNumber':_0x444378});return _0x3fd02f['status'](0xc8)[_0xddad('0x2b')]({'error':![],'message':_0xddad('0x41')});})[_0xddad('0x1c')](handleError(_0x3fd02f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 72ef4c0..62d245c 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 _0x66d4=['post','create','/:id/dispositions','addAnswer','addApplications','/:id/notify','notify','/:id/send','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/describe','/:id/canned_answers','/:id/users','/:id/applications','getApplications'];(function(_0x519066,_0x2c38ee){var _0x5ae31a=function(_0x43391c){while(--_0x43391c){_0x519066['push'](_0x519066['shift']());}};_0x5ae31a(++_0x2c38ee);}(_0x66d4,0x1a6));var _0x466d=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x66d4[_0x67f95e];return _0x538f5a;};'use strict';var multer=require(_0x466d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x466d('0x1'));var express=require(_0x466d('0x2'));var router=express[_0x466d('0x3')]();var fs_extra=require(_0x466d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x466d('0x5')]('/',auth[_0x466d('0x6')](),controller[_0x466d('0x7')]);router['get'](_0x466d('0x8'),auth[_0x466d('0x6')](),controller['describe']);router[_0x466d('0x5')]('/:id',auth[_0x466d('0x6')](),controller['show']);router[_0x466d('0x5')]('/:id/dispositions',auth[_0x466d('0x6')](),controller['getDispositions']);router[_0x466d('0x5')](_0x466d('0x9'),auth[_0x466d('0x6')](),controller['getAnswers']);router['get'](_0x466d('0xa'),auth['isAuthenticated'](),controller['getAgents']);router[_0x466d('0x5')](_0x466d('0xb'),auth[_0x466d('0x6')](),controller[_0x466d('0xc')]);router[_0x466d('0xd')]('/',auth[_0x466d('0x6')](),controller[_0x466d('0xe')]);router[_0x466d('0xd')](_0x466d('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x466d('0xd')]('/:id/canned_answers',auth[_0x466d('0x6')](),controller[_0x466d('0x10')]);router[_0x466d('0xd')](_0x466d('0xa'),auth[_0x466d('0x6')](),controller['addAgents']);router[_0x466d('0xd')]('/:id/applications',auth[_0x466d('0x6')](),controller[_0x466d('0x11')]);router[_0x466d('0xd')](_0x466d('0x12'),controller[_0x466d('0x13')]);router[_0x466d('0xd')](_0x466d('0x14'),auth[_0x466d('0x6')](),controller['send']);router[_0x466d('0x15')](_0x466d('0x16'),auth[_0x466d('0x6')](),controller[_0x466d('0x17')]);router[_0x466d('0x18')](_0x466d('0x16'),auth['isAuthenticated'](),controller['destroy']);router[_0x466d('0x18')](_0x466d('0xf'),auth['isAuthenticated'](),controller[_0x466d('0x19')]);router[_0x466d('0x18')](_0x466d('0x9'),auth[_0x466d('0x6')](),controller[_0x466d('0x1a')]);router[_0x466d('0x18')](_0x466d('0xa'),auth[_0x466d('0x6')](),controller[_0x466d('0x1b')]);module[_0x466d('0x1c')]=router; \ No newline at end of file +var _0xaf6b=['/:id/applications','addApplications','/:id/notify','/:id/send','send','put','update','delete','/:id','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents'];(function(_0x1a2238,_0x24c8b6){var _0x3d0b35=function(_0x6c935e){while(--_0x6c935e){_0x1a2238['push'](_0x1a2238['shift']());}};_0x3d0b35(++_0x24c8b6);}(_0xaf6b,0x147));var _0xbaf6=function(_0x70381f,_0x3ce152){_0x70381f=_0x70381f-0x0;var _0xc650ea=_0xaf6b[_0x70381f];return _0xc650ea;};'use strict';var multer=require(_0xbaf6('0x0'));var util=require('util');var path=require(_0xbaf6('0x1'));var timeout=require(_0xbaf6('0x2'));var express=require('express');var router=express[_0xbaf6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbaf6('0x4'));var interaction=require(_0xbaf6('0x5'));var config=require(_0xbaf6('0x6'));var controller=require(_0xbaf6('0x7'));router['get']('/',auth[_0xbaf6('0x8')](),controller[_0xbaf6('0x9')]);router[_0xbaf6('0xa')]('/describe',auth[_0xbaf6('0x8')](),controller[_0xbaf6('0xb')]);router[_0xbaf6('0xa')]('/:id',auth[_0xbaf6('0x8')](),controller['show']);router['get'](_0xbaf6('0xc'),auth['isAuthenticated'](),controller[_0xbaf6('0xd')]);router[_0xbaf6('0xa')](_0xbaf6('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xbaf6('0xa')](_0xbaf6('0xf'),auth['isAuthenticated'](),controller[_0xbaf6('0x10')]);router[_0xbaf6('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0xbaf6('0x11')]);router[_0xbaf6('0x12')]('/',auth[_0xbaf6('0x8')](),controller[_0xbaf6('0x13')]);router['post'](_0xbaf6('0xc'),auth['isAuthenticated'](),controller[_0xbaf6('0x14')]);router[_0xbaf6('0x12')]('/:id/canned_answers',auth[_0xbaf6('0x8')](),controller[_0xbaf6('0x15')]);router[_0xbaf6('0x12')](_0xbaf6('0xf'),auth[_0xbaf6('0x8')](),controller[_0xbaf6('0x16')]);router[_0xbaf6('0x12')](_0xbaf6('0x17'),auth['isAuthenticated'](),controller[_0xbaf6('0x18')]);router[_0xbaf6('0x12')](_0xbaf6('0x19'),controller['notify']);router[_0xbaf6('0x12')](_0xbaf6('0x1a'),auth[_0xbaf6('0x8')](),controller[_0xbaf6('0x1b')]);router[_0xbaf6('0x1c')]('/:id',auth[_0xbaf6('0x8')](),controller[_0xbaf6('0x1d')]);router[_0xbaf6('0x1e')](_0xbaf6('0x1f'),auth['isAuthenticated'](),controller['destroy']);router[_0xbaf6('0x1e')](_0xbaf6('0xc'),auth[_0xbaf6('0x8')](),controller[_0xbaf6('0x20')]);router[_0xbaf6('0x1e')](_0xbaf6('0xe'),auth[_0xbaf6('0x8')](),controller[_0xbaf6('0x21')]);router[_0xbaf6('0x1e')]('/:id/users',auth[_0xbaf6('0x8')](),controller['removeAgents']);module[_0xbaf6('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 542ee56..d90e4cf 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 _0x6bec=['STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition','sequelize'];(function(_0x252e25,_0x9cd821){var _0x5cb06a=function(_0x4a1e70){while(--_0x4a1e70){_0x252e25['push'](_0x252e25['shift']());}};_0x5cb06a(++_0x9cd821);}(_0x6bec,0x1ee));var _0xc6be=function(_0x2091e5,_0x4e2f1e){_0x2091e5=_0x2091e5-0x0;var _0x46d868=_0x6bec[_0x2091e5];return _0x46d868;};'use strict';var Sequelize=require(_0xc6be('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc6be('0x1')],'defaultValue':function(){return rs[_0xc6be('0x2')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc6be('0x3')](_0xc6be('0x4'))},'accountSid':{'type':Sequelize[_0xc6be('0x1')]},'authToken':{'type':Sequelize[_0xc6be('0x1')]},'notificationTemplate':{'type':Sequelize[_0xc6be('0x5')],'defaultValue':function(){return _0xc6be('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc6be('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc6be('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc6be('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc6be('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3cc14a){if(!_0x3cc14a){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xc6be('0x9')](_0xc6be('0xa'),_0x3cc14a);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf791=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate'];(function(_0x4200ab,_0x1a09a1){var _0x7f219e=function(_0x120274){while(--_0x120274){_0x4200ab['push'](_0x4200ab['shift']());}};_0x7f219e(++_0x1a09a1);}(_0xf791,0xbe));var _0x1f79=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0xf791[_0x3c6b7d];return _0x1d3ed2;};'use strict';var Sequelize=require(_0x1f79('0x0'));var rs=require(_0x1f79('0x1'));module[_0x1f79('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x1f79('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1f79('0x4')]();}},'phone':{'type':Sequelize[_0x1f79('0x3')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0x1f79('0x3')]},'authToken':{'type':Sequelize[_0x1f79('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1f79('0x5')],'defaultValue':function(){return _0x1f79('0x6');}},'notificationSound':{'type':Sequelize[_0x1f79('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1f79('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f79('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1f79('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1f79('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1f79('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f79('0x8')],'comment':_0x1f79('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1f79('0x7')],'defaultValue':![],'comment':_0x1f79('0xa'),'set':function(_0x497fcb){if(!_0x497fcb){this[_0x1f79('0xb')](_0x1f79('0xc'),null);}this[_0x1f79('0xb')]('mandatoryDisposition',_0x497fcb);}},'description':{'type':Sequelize[_0x1f79('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 67e421c..8b5be46 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 _0xda1f=['addAgents','omit','spread','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','ListId','mobile','twilio','from','From','replace','Body','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','created','WhatsappMessage','messageId','ContactId','UserId','unshift','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','json','offset','Content-Range','apply','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','WhatsappAccount','count','includeAll','findAll','rows','show','params','mandatoryDispositionPause','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','include','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers'];(function(_0x376e81,_0x118733){var _0x311244=function(_0x4b9344){while(--_0x4b9344){_0x376e81['push'](_0x376e81['shift']());}};_0x311244(++_0x118733);}(_0xda1f,0x1c0));var _0xfda1=function(_0x558cff,_0x5e73b2){_0x558cff=_0x558cff-0x0;var _0x316356=_0xda1f[_0x558cff];return _0x316356;};'use strict';var pdf=require(_0xfda1('0x0'));var emlformat=require(_0xfda1('0x1'));var rimraf=require(_0xfda1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfda1('0x3'));var rp=require(_0xfda1('0x4'));var moment=require(_0xfda1('0x5'));var BPromise=require(_0xfda1('0x6'));var Mustache=require(_0xfda1('0x7'));var util=require(_0xfda1('0x8'));var path=require(_0xfda1('0x9'));var sox=require('sox');var csv=require(_0xfda1('0xa'));var ejs=require(_0xfda1('0xb'));var fs=require('fs');var fs_extra=require(_0xfda1('0xc'));var _=require(_0xfda1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfda1('0xe'));var deskjs=require(_0xfda1('0xf'));var toCsv=require(_0xfda1('0xa'));var querystring=require(_0xfda1('0x10'));var Papa=require(_0xfda1('0x11'));var Redis=require('ioredis');var authService=require(_0xfda1('0x12'));var qs=require(_0xfda1('0x13'));var as=require(_0xfda1('0x14'));var hardwareService=require(_0xfda1('0x15'));var logger=require(_0xfda1('0x16'))(_0xfda1('0x17'));var utils=require(_0xfda1('0x18'));var config=require(_0xfda1('0x19'));var licenseUtil=require(_0xfda1('0x1a'));var db=require(_0xfda1('0x1b'))['db'];config[_0xfda1('0x1c')]=_['defaults'](config[_0xfda1('0x1c')],{'host':_0xfda1('0x1d'),'port':0x18eb});var socket=require(_0xfda1('0x1e'))(new Redis(config[_0xfda1('0x1c')]));require('./whatsappAccount.socket')[_0xfda1('0x1f')](socket);var jayson=require(_0xfda1('0x20'));var client=jayson[_0xfda1('0x21')][_0xfda1('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x261e32,_0xc3c653,_0xc23ad5,_0x5c619b){return new BPromise(function(_0x12a7d9,_0xedf12d){var _0x3d19eb=_0x5c619b||client;return _0x3d19eb[_0xfda1('0x23')](_0x261e32,_0xc23ad5)[_0xfda1('0x24')](function(_0x1a3463){logger[_0xfda1('0x25')](_0xfda1('0x26'),_0xc3c653,_0xfda1('0x27'));logger[_0xfda1('0x28')](_0xfda1('0x29'),_0xc3c653,_0xfda1('0x27'),JSON[_0xfda1('0x2a')](_0x1a3463));if(_0x1a3463['error']){if(_0x1a3463['error'][_0xfda1('0x2b')]===0x1f4){logger[_0xfda1('0x2c')](_0xfda1('0x26'),_0xc3c653,_0x1a3463[_0xfda1('0x2c')][_0xfda1('0x2d')]);return _0xedf12d(_0x1a3463[_0xfda1('0x2c')][_0xfda1('0x2d')]);}logger[_0xfda1('0x2c')](_0xfda1('0x26'),_0xc3c653,_0x1a3463['error'][_0xfda1('0x2d')]);return _0x12a7d9(_0x1a3463['error'][_0xfda1('0x2d')]);}else{logger['info'](_0xfda1('0x26'),_0xc3c653,_0xfda1('0x27'));_0x12a7d9(_0x1a3463['result'][_0xfda1('0x2d')]);}})[_0xfda1('0x2e')](function(_0x22bfa3){logger[_0xfda1('0x2c')]('WhatsappAccount,\x20%s,\x20%s',_0xc3c653,_0x22bfa3);_0xedf12d(_0x22bfa3);});});}function respondWithStatusCode(_0x5454a9,_0x48ac37){_0x48ac37=_0x48ac37||0xcc;return function(_0x149979){if(_0x149979){return _0x5454a9[_0xfda1('0x2f')](_0x48ac37);}return _0x5454a9[_0xfda1('0x30')](_0x48ac37)[_0xfda1('0x31')]();};}function respondWithResult(_0x54b13c,_0x3aa7e5){_0x3aa7e5=_0x3aa7e5||0xc8;return function(_0x4f71aa){if(_0x4f71aa){return _0x54b13c[_0xfda1('0x30')](_0x3aa7e5)[_0xfda1('0x32')](_0x4f71aa);}};}function respondWithFilteredResult(_0x42d4e6,_0x47031d){return function(_0x441369){if(_0x441369){var _0xb8cb93=_0x441369['count'],_0x53da61=_0x47031d[_0xfda1('0x33')],_0x9dec=_0x47031d[_0xfda1('0x33')]+_0x47031d['limit'],_0x525144;if(_0x9dec>=_0xb8cb93){_0x9dec=_0xb8cb93;_0x525144=0xc8;}else{_0x525144=0xce;}_0x42d4e6['status'](_0x525144);return _0x42d4e6['set'](_0xfda1('0x34'),_0x53da61+'-'+_0x9dec+'/'+_0xb8cb93)[_0xfda1('0x32')](_0x441369);}return null;};}function patchUpdates(_0x7fd730){return function(_0x38e15b){try{jsonpatch[_0xfda1('0x35')](_0x38e15b,_0x7fd730,!![]);}catch(_0x20eb3d){return BPromise['reject'](_0x20eb3d);}return _0x38e15b[_0xfda1('0x36')]();};}function saveUpdates(_0x17ae67,_0xd784e1){return function(_0x3ac679){if(_0x3ac679){return _0x3ac679[_0xfda1('0x37')](_0x17ae67)[_0xfda1('0x24')](function(_0x62bace){return _0x62bace;});}return null;};}function removeEntity(_0xa7bafd,_0x593dd5){return function(_0x295af0){if(_0x295af0){return _0x295af0[_0xfda1('0x38')]()[_0xfda1('0x24')](function(){var _0x40f48c=_0x295af0['get']({'plain':!![]});var _0x5d0aca=_0xfda1('0x39');return db[_0xfda1('0x3a')][_0xfda1('0x38')]({'where':{'type':_0x5d0aca,'resourceId':_0x40f48c['id']}})[_0xfda1('0x24')](function(){return _0x295af0;});})['then'](function(){_0xa7bafd['status'](0xcc)[_0xfda1('0x31')]();});}};}function handleEntityNotFound(_0x37905b,_0x378d0a){return function(_0x544402){if(!_0x544402){_0x37905b[_0xfda1('0x2f')](0x194);}return _0x544402;};}function handleError(_0x4def6d,_0x4b2834){_0x4b2834=_0x4b2834||0x1f4;return function(_0x5bc241){logger[_0xfda1('0x2c')](_0x5bc241[_0xfda1('0x3b')]);if(_0x5bc241['name']){delete _0x5bc241[_0xfda1('0x3c')];}_0x4def6d[_0xfda1('0x30')](_0x4b2834)[_0xfda1('0x3d')](_0x5bc241);};}exports[_0xfda1('0x3e')]=function(_0x354420,_0x2e0c76){var _0x2f2739={'include':[{'model':db[_0xfda1('0x3f')],'as':'mandatoryDispositionPause'}]},_0x555feb={},_0x35c67d={'count':0x0,'rows':[]};var _0x1edd30=_[_0xfda1('0x40')](db['WhatsappAccount'][_0xfda1('0x41')],function(_0x134373){return{'name':_0x134373[_0xfda1('0x42')],'type':_0x134373['type'][_0xfda1('0x43')]};});_0x555feb[_0xfda1('0x44')]=_[_0xfda1('0x40')](_0x1edd30,'name');_0x555feb[_0xfda1('0x45')]=_[_0xfda1('0x46')](_0x354420[_0xfda1('0x45')]);_0x555feb['filters']=_[_0xfda1('0x47')](_0x555feb['model'],_0x555feb[_0xfda1('0x45')]);_0x2f2739[_0xfda1('0x48')]=_[_0xfda1('0x47')](_0x555feb['model'],qs['fields'](_0x354420[_0xfda1('0x45')][_0xfda1('0x49')]));_0x2f2739['attributes']=_0x2f2739[_0xfda1('0x48')][_0xfda1('0x4a')]?_0x2f2739[_0xfda1('0x48')]:_0x555feb[_0xfda1('0x44')];if(!_0x354420['query'][_0xfda1('0x4b')](_0xfda1('0x4c'))){_0x2f2739['limit']=qs[_0xfda1('0x4d')](_0x354420['query']['limit']);_0x2f2739[_0xfda1('0x33')]=qs[_0xfda1('0x33')](_0x354420[_0xfda1('0x45')][_0xfda1('0x33')]);}_0x2f2739[_0xfda1('0x4e')]=qs[_0xfda1('0x4f')](_0x354420[_0xfda1('0x45')][_0xfda1('0x4f')]);_0x2f2739['where']=qs[_0xfda1('0x50')](_[_0xfda1('0x51')](_0x354420['query'],_0x555feb['filters']),_0x1edd30);if(_0x354420['query'][_0xfda1('0x52')]){_0x2f2739[_0xfda1('0x53')]=_[_0xfda1('0x54')](_0x2f2739[_0xfda1('0x53')],{'$or':_[_0xfda1('0x40')](_0x1edd30,function(_0x5938fa){if(_0x5938fa[_0xfda1('0x55')]!==_0xfda1('0x56')){var _0x307abc={};_0x307abc[_0x5938fa[_0xfda1('0x3c')]]={'$like':'%'+_0x354420[_0xfda1('0x45')][_0xfda1('0x52')]+'%'};return _0x307abc;}})});}_0x2f2739=_[_0xfda1('0x54')]({},_0x2f2739,_0x354420[_0xfda1('0x57')]);var _0x1ce38b={'where':_0x2f2739[_0xfda1('0x53')]};return db[_0xfda1('0x58')][_0xfda1('0x59')](_0x1ce38b)['then'](function(_0x3ee153){_0x35c67d[_0xfda1('0x59')]=_0x3ee153;if(_0x354420[_0xfda1('0x45')][_0xfda1('0x5a')]){_0x2f2739['include']=[{'all':!![]}];}return db[_0xfda1('0x58')][_0xfda1('0x5b')](_0x2f2739);})['then'](function(_0x4dab67){_0x35c67d[_0xfda1('0x5c')]=_0x4dab67;return _0x35c67d;})[_0xfda1('0x24')](respondWithFilteredResult(_0x2e0c76,_0x2f2739))[_0xfda1('0x2e')](handleError(_0x2e0c76,null));};exports[_0xfda1('0x5d')]=function(_0x18203d,_0x5141e3){var _0x36046e={'raw':![],'where':{'id':_0x18203d[_0xfda1('0x5e')]['id']},'include':[{'model':db[_0xfda1('0x3f')],'as':_0xfda1('0x5f')}]},_0x42b975={};_0x42b975['model']=_['keys'](db['WhatsappAccount'][_0xfda1('0x41')]);_0x42b975[_0xfda1('0x45')]=_[_0xfda1('0x46')](_0x18203d[_0xfda1('0x45')]);_0x42b975[_0xfda1('0x50')]=_[_0xfda1('0x47')](_0x42b975['model'],_0x42b975[_0xfda1('0x45')]);_0x36046e[_0xfda1('0x48')]=_[_0xfda1('0x47')](_0x42b975[_0xfda1('0x44')],qs[_0xfda1('0x49')](_0x18203d[_0xfda1('0x45')][_0xfda1('0x49')]));_0x36046e[_0xfda1('0x48')]=_0x36046e[_0xfda1('0x48')][_0xfda1('0x4a')]?_0x36046e[_0xfda1('0x48')]:_0x42b975['model'];if(_0x18203d[_0xfda1('0x45')][_0xfda1('0x5a')]){_0x36046e['include']=[{'all':!![]}];}_0x36046e=_[_0xfda1('0x54')]({},_0x36046e,_0x18203d[_0xfda1('0x57')]);return db[_0xfda1('0x58')]['find'](_0x36046e)[_0xfda1('0x24')](handleEntityNotFound(_0x5141e3,null))[_0xfda1('0x24')](respondWithResult(_0x5141e3,null))['catch'](handleError(_0x5141e3,null));};exports['create']=function(_0x97a9b4,_0x36a7da){return db[_0xfda1('0x58')]['create'](_0x97a9b4[_0xfda1('0x60')],{})[_0xfda1('0x24')](function(_0x589b82){var _0x3a13c4=_0x97a9b4[_0xfda1('0x61')][_0xfda1('0x62')]({'plain':!![]});if(!_0x3a13c4)throw new Error(_0xfda1('0x63'));if(_0x3a13c4[_0xfda1('0x64')]==='user'){var _0x31245e=_0x589b82[_0xfda1('0x62')]({'plain':!![]});var _0x350f1d=_0xfda1('0x39');return db['UserProfileSection'][_0xfda1('0x65')]({'where':{'name':_0x350f1d,'userProfileId':_0x3a13c4[_0xfda1('0x66')]},'raw':!![]})['then'](function(_0x4034d6){if(_0x4034d6&&_0x4034d6[_0xfda1('0x67')]===0x0){return db[_0xfda1('0x3a')][_0xfda1('0x68')]({'name':_0x31245e[_0xfda1('0x3c')],'resourceId':_0x31245e['id'],'type':_0x4034d6['name'],'sectionId':_0x4034d6['id']},{})['then'](function(){return _0x589b82;});}else{return _0x589b82;}})[_0xfda1('0x2e')](function(_0x1fdada){logger['error'](_0xfda1('0x69'),_0x1fdada);throw _0x1fdada;});}return _0x589b82;})[_0xfda1('0x24')](respondWithResult(_0x36a7da,0xc9))[_0xfda1('0x2e')](handleError(_0x36a7da,null));};exports[_0xfda1('0x37')]=function(_0x5bac11,_0x2a0057){if(_0x5bac11['body']['id']){delete _0x5bac11['body']['id'];}return db[_0xfda1('0x58')]['find']({'where':{'id':_0x5bac11[_0xfda1('0x5e')]['id']},'include':[{'model':db[_0xfda1('0x3f')],'as':_0xfda1('0x5f')}]})[_0xfda1('0x24')](handleEntityNotFound(_0x2a0057,null))[_0xfda1('0x24')](saveUpdates(_0x5bac11[_0xfda1('0x60')],null))[_0xfda1('0x24')](respondWithResult(_0x2a0057,null))[_0xfda1('0x2e')](handleError(_0x2a0057,null));};exports['destroy']=function(_0x403998,_0x13436c){return db[_0xfda1('0x58')][_0xfda1('0x65')]({'where':{'id':_0x403998['params']['id']}})['then'](handleEntityNotFound(_0x13436c,null))[_0xfda1('0x24')](removeEntity(_0x13436c,null))[_0xfda1('0x2e')](handleError(_0x13436c,null));};exports[_0xfda1('0x6a')]=function(_0x3a5994,_0x47adea){return db['WhatsappAccount'][_0xfda1('0x6a')]()[_0xfda1('0x24')](respondWithResult(_0x47adea,null))[_0xfda1('0x2e')](handleError(_0x47adea,null));};exports[_0xfda1('0x6b')]=function(_0x3597c0,_0x35f58e,_0x234e55){if(_0x3597c0[_0xfda1('0x60')]['id']){delete _0x3597c0[_0xfda1('0x60')]['id'];}return db[_0xfda1('0x58')][_0xfda1('0x65')]({'where':{'id':_0x3597c0[_0xfda1('0x5e')]['id']}})[_0xfda1('0x24')](handleEntityNotFound(_0x35f58e,null))[_0xfda1('0x24')](function(_0xedfcee){if(_0xedfcee){_0x3597c0[_0xfda1('0x60')][_0xfda1('0x6c')]=_0xedfcee['id'];return db[_0xfda1('0x6d')][_0xfda1('0x68')](_0x3597c0['body']);}})[_0xfda1('0x24')](respondWithResult(_0x35f58e,null))[_0xfda1('0x2e')](handleError(_0x35f58e,null));};exports[_0xfda1('0x6e')]=function(_0x1706d5,_0x26a536,_0x4a1bb7){var _0x20e997={'raw':![],'where':{}};var _0x227431={};var _0x343390={'count':0x0,'rows':[]};return db[_0xfda1('0x58')]['findOne']({'where':{'id':_0x1706d5['params']['id']}})[_0xfda1('0x24')](handleEntityNotFound(_0x26a536,null))[_0xfda1('0x24')](function(_0x474b99){if(_0x474b99){_0x227431['model']=_[_0xfda1('0x46')](db['Disposition'][_0xfda1('0x41')]);_0x227431[_0xfda1('0x45')]=_['keys'](_0x1706d5['query']);_0x227431[_0xfda1('0x50')]=_[_0xfda1('0x47')](_0x227431[_0xfda1('0x44')],_0x227431[_0xfda1('0x45')]);_0x20e997[_0xfda1('0x48')]=_[_0xfda1('0x47')](_0x227431[_0xfda1('0x44')],qs['fields'](_0x1706d5[_0xfda1('0x45')][_0xfda1('0x49')]));_0x20e997[_0xfda1('0x48')]=_0x20e997[_0xfda1('0x48')]['length']?_0x20e997[_0xfda1('0x48')]:_0x227431[_0xfda1('0x44')];if(!_0x1706d5[_0xfda1('0x45')][_0xfda1('0x4b')]('nolimit')){_0x20e997[_0xfda1('0x4d')]=qs[_0xfda1('0x4d')](_0x1706d5[_0xfda1('0x45')]['limit']);_0x20e997[_0xfda1('0x33')]=qs[_0xfda1('0x33')](_0x1706d5[_0xfda1('0x45')][_0xfda1('0x33')]);}_0x20e997[_0xfda1('0x4e')]=qs[_0xfda1('0x4f')](_0x1706d5[_0xfda1('0x45')][_0xfda1('0x4f')]);_0x20e997[_0xfda1('0x53')]=qs['filters'](_[_0xfda1('0x51')](_0x1706d5[_0xfda1('0x45')],_0x227431[_0xfda1('0x50')]));_0x20e997['where'][_0xfda1('0x6c')]=_0x474b99['id'];if(_0x1706d5[_0xfda1('0x45')][_0xfda1('0x52')]){_0x20e997[_0xfda1('0x53')]=_[_0xfda1('0x54')](_0x20e997[_0xfda1('0x53')],{'$or':_['map'](_0x20e997['attributes'],function(_0x335835){var _0x494cb6={};_0x494cb6[_0x335835]={'$like':'%'+_0x1706d5[_0xfda1('0x45')][_0xfda1('0x52')]+'%'};return _0x494cb6;})});}_0x20e997=_[_0xfda1('0x54')]({},_0x20e997,_0x1706d5['options']);return db[_0xfda1('0x6d')]['count']({'where':_0x20e997[_0xfda1('0x53')]})[_0xfda1('0x24')](function(_0x6599c9){_0x343390[_0xfda1('0x59')]=_0x6599c9;if(_0x1706d5[_0xfda1('0x45')][_0xfda1('0x5a')]){_0x20e997[_0xfda1('0x6f')]=[{'all':!![]}];}return db[_0xfda1('0x6d')][_0xfda1('0x5b')](_0x20e997);})[_0xfda1('0x24')](function(_0xe71e28){_0x343390[_0xfda1('0x5c')]=_0xe71e28;return _0x343390;});}})[_0xfda1('0x24')](respondWithFilteredResult(_0x26a536,_0x20e997))[_0xfda1('0x2e')](handleError(_0x26a536,null));};exports['removeDispositions']=function(_0x4eec06,_0x16b19b,_0x2d0348){return db[_0xfda1('0x58')][_0xfda1('0x65')]({'where':{'id':_0x4eec06[_0xfda1('0x5e')]['id']}})[_0xfda1('0x24')](handleEntityNotFound(_0x16b19b,null))[_0xfda1('0x24')](function(_0x10b946){if(_0x10b946){return _0x10b946[_0xfda1('0x70')](_0x4eec06[_0xfda1('0x45')][_0xfda1('0x71')]);}})['then'](respondWithStatusCode(_0x16b19b,null))[_0xfda1('0x2e')](handleError(_0x16b19b,null));};exports[_0xfda1('0x72')]=function(_0x521b6d,_0x3f36cd,_0x4701cc){if(_0x521b6d[_0xfda1('0x60')]['id']){delete _0x521b6d[_0xfda1('0x60')]['id'];}return db[_0xfda1('0x58')][_0xfda1('0x65')]({'where':{'id':_0x521b6d[_0xfda1('0x5e')]['id']}})[_0xfda1('0x24')](handleEntityNotFound(_0x3f36cd,null))[_0xfda1('0x24')](function(_0xc01755){if(_0xc01755){_0x521b6d[_0xfda1('0x60')]['WhatsappAccountId']=_0xc01755['id'];return db['CannedAnswer'][_0xfda1('0x68')](_0x521b6d['body']);}})[_0xfda1('0x24')](respondWithResult(_0x3f36cd,null))[_0xfda1('0x2e')](handleError(_0x3f36cd,null));};exports[_0xfda1('0x73')]=function(_0x140879,_0x1f9b77,_0x122bd5){var _0x32c471={'raw':![],'where':{}};var _0x3a1eea={};var _0x3b24a4={'count':0x0,'rows':[]};return db[_0xfda1('0x58')][_0xfda1('0x74')]({'where':{'id':_0x140879[_0xfda1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1f9b77,null))[_0xfda1('0x24')](function(_0x35370c){if(_0x35370c){_0x3a1eea[_0xfda1('0x44')]=_[_0xfda1('0x46')](db[_0xfda1('0x75')][_0xfda1('0x41')]);_0x3a1eea['query']=_[_0xfda1('0x46')](_0x140879[_0xfda1('0x45')]);_0x3a1eea[_0xfda1('0x50')]=_[_0xfda1('0x47')](_0x3a1eea[_0xfda1('0x44')],_0x3a1eea['query']);_0x32c471[_0xfda1('0x48')]=_[_0xfda1('0x47')](_0x3a1eea[_0xfda1('0x44')],qs[_0xfda1('0x49')](_0x140879['query'][_0xfda1('0x49')]));_0x32c471[_0xfda1('0x48')]=_0x32c471[_0xfda1('0x48')][_0xfda1('0x4a')]?_0x32c471[_0xfda1('0x48')]:_0x3a1eea['model'];if(!_0x140879[_0xfda1('0x45')][_0xfda1('0x4b')](_0xfda1('0x4c'))){_0x32c471['limit']=qs[_0xfda1('0x4d')](_0x140879[_0xfda1('0x45')][_0xfda1('0x4d')]);_0x32c471[_0xfda1('0x33')]=qs['offset'](_0x140879['query'][_0xfda1('0x33')]);}_0x32c471[_0xfda1('0x4e')]=qs[_0xfda1('0x4f')](_0x140879[_0xfda1('0x45')][_0xfda1('0x4f')]);_0x32c471[_0xfda1('0x53')]=qs['filters'](_[_0xfda1('0x51')](_0x140879[_0xfda1('0x45')],_0x3a1eea[_0xfda1('0x50')]));_0x32c471['where'][_0xfda1('0x6c')]=_0x35370c['id'];if(_0x140879[_0xfda1('0x45')][_0xfda1('0x52')]){_0x32c471[_0xfda1('0x53')]=_[_0xfda1('0x54')](_0x32c471['where'],{'$or':_[_0xfda1('0x40')](_0x32c471[_0xfda1('0x48')],function(_0x4c84f9){var _0x4ee507={};_0x4ee507[_0x4c84f9]={'$like':'%'+_0x140879[_0xfda1('0x45')][_0xfda1('0x52')]+'%'};return _0x4ee507;})});}_0x32c471=_[_0xfda1('0x54')]({},_0x32c471,_0x140879[_0xfda1('0x57')]);return db[_0xfda1('0x75')][_0xfda1('0x59')]({'where':_0x32c471[_0xfda1('0x53')]})[_0xfda1('0x24')](function(_0x3b1d5c){_0x3b24a4[_0xfda1('0x59')]=_0x3b1d5c;if(_0x140879[_0xfda1('0x45')][_0xfda1('0x5a')]){_0x32c471[_0xfda1('0x6f')]=[{'all':!![]}];}return db[_0xfda1('0x75')][_0xfda1('0x5b')](_0x32c471);})['then'](function(_0x5ed546){_0x3b24a4['rows']=_0x5ed546;return _0x3b24a4;});}})['then'](respondWithFilteredResult(_0x1f9b77,_0x32c471))[_0xfda1('0x2e')](handleError(_0x1f9b77,null));};exports[_0xfda1('0x76')]=function(_0x308594,_0x14bad2,_0x310e5b){return db['WhatsappAccount'][_0xfda1('0x65')]({'where':{'id':_0x308594[_0xfda1('0x5e')]['id']}})[_0xfda1('0x24')](handleEntityNotFound(_0x14bad2,null))[_0xfda1('0x24')](function(_0x414e66){if(_0x414e66){return _0x414e66[_0xfda1('0x76')](_0x308594['query'][_0xfda1('0x71')]);}})['then'](respondWithStatusCode(_0x14bad2,null))[_0xfda1('0x2e')](handleError(_0x14bad2,null));};exports['addAgents']=function(_0x536fe8,_0x16a984,_0x46177b){return db[_0xfda1('0x58')][_0xfda1('0x65')]({'where':{'id':_0x536fe8[_0xfda1('0x5e')]['id']}})[_0xfda1('0x24')](handleEntityNotFound(_0x16a984,null))[_0xfda1('0x24')](function(_0xffad32){if(_0xffad32){return _0xffad32[_0xfda1('0x77')](_0x536fe8[_0xfda1('0x60')][_0xfda1('0x71')],_[_0xfda1('0x78')](_0x536fe8[_0xfda1('0x60')],[_0xfda1('0x71'),'id'])||{})[_0xfda1('0x79')](function(_0x33a6fc){for(var _0x1b84a=0x0;_0x1b84a<_0x536fe8[_0xfda1('0x60')][_0xfda1('0x71')][_0xfda1('0x4a')];_0x1b84a+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x536fe8[_0xfda1('0x60')][_0xfda1('0x71')][_0x1b84a],'WhatsappAccountId':_0x536fe8[_0xfda1('0x5e')]['id']});}return _0x33a6fc;});}})[_0xfda1('0x24')](respondWithResult(_0x16a984,null))['catch'](handleError(_0x16a984,null));};exports['removeAgents']=function(_0x51ee26,_0xfe1b3f,_0x1a8ea9){return db[_0xfda1('0x58')][_0xfda1('0x65')]({'where':{'id':_0x51ee26[_0xfda1('0x5e')]['id']}})['then'](handleEntityNotFound(_0xfe1b3f,null))['then'](function(_0x144668){if(_0x144668){return _0x144668[_0xfda1('0x7a')](_0x51ee26[_0xfda1('0x45')][_0xfda1('0x71')])[_0xfda1('0x24')](function(){if(_['isArray'](_0x51ee26[_0xfda1('0x45')][_0xfda1('0x71')])){for(var _0x9840b7=0x0;_0x9840b7<_0x51ee26[_0xfda1('0x45')][_0xfda1('0x71')][_0xfda1('0x4a')];_0x9840b7+=0x1){socket[_0xfda1('0x7b')](_0xfda1('0x7c'),{'UserId':Number(_0x51ee26[_0xfda1('0x45')][_0xfda1('0x71')][_0x9840b7]),'WhatsappAccountId':Number(_0x51ee26['params']['id'])});}}else{socket[_0xfda1('0x7b')](_0xfda1('0x7c'),{'UserId':Number(_0x51ee26['query'][_0xfda1('0x71')]),'WhatsappAccountId':Number(_0x51ee26[_0xfda1('0x5e')]['id'])});}});}})[_0xfda1('0x24')](respondWithStatusCode(_0xfe1b3f,null))[_0xfda1('0x2e')](handleError(_0xfe1b3f,null));};exports[_0xfda1('0x7d')]=function(_0x73c002,_0x1e44bc,_0x2d94be){var _0x11edc4={};var _0x5056f7={};var _0x2452b1;var _0x23d266;return db[_0xfda1('0x58')][_0xfda1('0x74')]({'where':{'id':_0x73c002[_0xfda1('0x5e')]['id']}})[_0xfda1('0x24')](handleEntityNotFound(_0x1e44bc,null))[_0xfda1('0x24')](function(_0x2da9bb){if(_0x2da9bb){_0x2452b1=_0x2da9bb;_0x5056f7[_0xfda1('0x44')]=_['keys'](db[_0xfda1('0x7e')][_0xfda1('0x41')]);_0x5056f7['query']=_['keys'](_0x73c002[_0xfda1('0x45')]);_0x5056f7[_0xfda1('0x50')]=_[_0xfda1('0x47')](_0x5056f7['model'],_0x5056f7[_0xfda1('0x45')]);_0x11edc4['attributes']=_[_0xfda1('0x47')](_0x5056f7['model'],qs[_0xfda1('0x49')](_0x73c002['query']['fields']));_0x11edc4[_0xfda1('0x48')]=_0x11edc4[_0xfda1('0x48')][_0xfda1('0x4a')]?_0x11edc4[_0xfda1('0x48')]:_0x5056f7['model'];_0x11edc4['order']=qs[_0xfda1('0x4f')](_0x73c002[_0xfda1('0x45')][_0xfda1('0x4f')]);_0x11edc4[_0xfda1('0x53')]=qs[_0xfda1('0x50')](_[_0xfda1('0x51')](_0x73c002[_0xfda1('0x45')],_0x5056f7[_0xfda1('0x50')]));if(_0x73c002[_0xfda1('0x45')][_0xfda1('0x52')]){_0x11edc4[_0xfda1('0x53')]=_['merge'](_0x11edc4[_0xfda1('0x53')],{'$or':_[_0xfda1('0x40')](_0x11edc4['attributes'],function(_0xd4260){var _0x4b736d={};_0x4b736d[_0xd4260]={'$like':'%'+_0x73c002[_0xfda1('0x45')]['filter']+'%'};return _0x4b736d;})});}_0x11edc4=_[_0xfda1('0x54')]({},_0x11edc4,_0x73c002[_0xfda1('0x57')]);return _0x2452b1[_0xfda1('0x7d')](_0x11edc4);}})[_0xfda1('0x24')](function(_0xcf6763){if(_0xcf6763){_0x23d266=_0xcf6763[_0xfda1('0x4a')];if(!_0x73c002[_0xfda1('0x45')]['hasOwnProperty'](_0xfda1('0x4c'))){_0x11edc4[_0xfda1('0x4d')]=qs[_0xfda1('0x4d')](_0x73c002[_0xfda1('0x45')][_0xfda1('0x4d')]);_0x11edc4[_0xfda1('0x33')]=qs['offset'](_0x73c002[_0xfda1('0x45')][_0xfda1('0x33')]);}return _0x2452b1[_0xfda1('0x7d')](_0x11edc4);}})[_0xfda1('0x24')](function(_0x4a16c7){if(_0x4a16c7){return _0x4a16c7?{'count':_0x23d266,'rows':_0x4a16c7}:null;}})[_0xfda1('0x24')](respondWithResult(_0x1e44bc,null))[_0xfda1('0x2e')](handleError(_0x1e44bc,null));};exports[_0xfda1('0x7f')]=function(_0x45e9fc,_0x599aae,_0x5ed0de){return db[_0xfda1('0x58')][_0xfda1('0x74')]({'where':{'id':_0x45e9fc['params']['id']}})['then'](handleEntityNotFound(_0x599aae,null))['then'](function(_0xad1bb7){if(_0xad1bb7){return db[_0xfda1('0x80')]['transaction'](function(_0x35fb44){return db[_0xfda1('0x81')][_0xfda1('0x38')]({'where':{'WhatsappAccountId':_0x45e9fc[_0xfda1('0x5e')]['id']},'transaction':_0x35fb44})['then'](function(_0x5827db){var _0x89eb1d=_[_0xfda1('0x40')](_0x45e9fc[_0xfda1('0x60')],function(_0x5d4650){_0x5d4650[_0xfda1('0x6c')]=_0x45e9fc[_0xfda1('0x5e')]['id'];return _0x5d4650;});return db[_0xfda1('0x81')][_0xfda1('0x82')](_0x89eb1d,{'transaction':_0x35fb44});});})[_0xfda1('0x24')](function(){return db[_0xfda1('0x81')][_0xfda1('0x83')]({'where':{'WhatsappAccountId':_0x45e9fc[_0xfda1('0x5e')]['id']},'order':'priority'});});}})[_0xfda1('0x24')](respondWithResult(_0x599aae,null))['catch'](handleError(_0x599aae,null));};exports[_0xfda1('0x84')]=function(_0x54e648,_0x3887af,_0x49b17b){var _0x1b2fd7={};var _0x3e13bc={};var _0x2b387a;var _0x1189ff;return db[_0xfda1('0x58')][_0xfda1('0x74')]({'where':{'id':_0x54e648['params']['id']}})['then'](handleEntityNotFound(_0x3887af,null))[_0xfda1('0x24')](function(_0x2c5e54){if(_0x2c5e54){_0x2b387a=_0x2c5e54;_0x3e13bc[_0xfda1('0x44')]=_[_0xfda1('0x46')](db[_0xfda1('0x81')][_0xfda1('0x41')]);_0x3e13bc[_0xfda1('0x45')]=_['keys'](_0x54e648[_0xfda1('0x45')]);_0x3e13bc[_0xfda1('0x50')]=_[_0xfda1('0x47')](_0x3e13bc['model'],_0x3e13bc[_0xfda1('0x45')]);_0x1b2fd7['attributes']=_['intersection'](_0x3e13bc[_0xfda1('0x44')],qs['fields'](_0x54e648[_0xfda1('0x45')][_0xfda1('0x49')]));_0x1b2fd7['attributes']=_0x1b2fd7['attributes'][_0xfda1('0x4a')]?_0x1b2fd7[_0xfda1('0x48')]:_0x3e13bc['model'];_0x1b2fd7[_0xfda1('0x4e')]=qs[_0xfda1('0x4f')](_0x54e648['query'][_0xfda1('0x4f')]);_0x1b2fd7[_0xfda1('0x53')]=qs[_0xfda1('0x50')](_[_0xfda1('0x51')](_0x54e648[_0xfda1('0x45')],_0x3e13bc['filters']));if(_0x54e648[_0xfda1('0x45')][_0xfda1('0x52')]){_0x1b2fd7['where']=_[_0xfda1('0x54')](_0x1b2fd7[_0xfda1('0x53')],{'$or':_[_0xfda1('0x40')](_0x1b2fd7[_0xfda1('0x48')],function(_0x2fbdbb){var _0x146420={};_0x146420[_0x2fbdbb]={'$like':'%'+_0x54e648[_0xfda1('0x45')]['filter']+'%'};return _0x146420;})});}_0x1b2fd7=_['merge']({},_0x1b2fd7,_0x54e648[_0xfda1('0x57')]);return _0x2b387a[_0xfda1('0x84')](_0x1b2fd7);}})[_0xfda1('0x24')](function(_0xfd530c){if(_0xfd530c){_0x1189ff=_0xfd530c[_0xfda1('0x4a')];if(!_0x54e648['query'][_0xfda1('0x4b')](_0xfda1('0x4c'))){_0x1b2fd7[_0xfda1('0x4d')]=qs[_0xfda1('0x4d')](_0x54e648[_0xfda1('0x45')][_0xfda1('0x4d')]);_0x1b2fd7[_0xfda1('0x33')]=qs['offset'](_0x54e648[_0xfda1('0x45')][_0xfda1('0x33')]);}return _0x2b387a[_0xfda1('0x84')](_0x1b2fd7);}})[_0xfda1('0x24')](function(_0x36298c){if(_0x36298c){return _0x36298c?{'count':_0x1189ff,'rows':_0x36298c}:null;}})[_0xfda1('0x24')](respondWithResult(_0x3887af,null))[_0xfda1('0x2e')](handleError(_0x3887af,null));};exports[_0xfda1('0x85')]=function(_0x5e2d02,_0x23f3b6,_0x2189ad){var _0x24b0c5={'channel':_0xfda1('0x86')};var _0x1a3854=[];var _0x2a7b1f=[];var _0x25f735={};return db[_0xfda1('0x58')][_0xfda1('0x65')]({'where':{'id':_0x5e2d02[_0xfda1('0x5e')]['id']},'include':[{'model':db[_0xfda1('0x81')],'as':_0xfda1('0x87')}]})[_0xfda1('0x24')](handleEntityNotFound(_0x23f3b6,null))['then'](function(_0xc21ecc){_0x24b0c5[_0xfda1('0x88')]=_0xc21ecc;_0x24b0c5[_0xfda1('0x89')]=_['orderBy'](_0xc21ecc[_0xfda1('0x87')],[_0xfda1('0x8a')],[_0xfda1('0x8b')]);if(_0x24b0c5[_0xfda1('0x88')][_0xfda1('0x87')]){delete _0x24b0c5[_0xfda1('0x88')][_0xfda1('0x87')];}return db[_0xfda1('0x8c')][_0xfda1('0x6a')]();})[_0xfda1('0x24')](function(_0x56d8f5){if(!_0x56d8f5){throw new db[(_0xfda1('0x8d'))][(_0xfda1('0x8e'))](_0xfda1('0x8f'));}_0x1a3854=_[_0xfda1('0x90')](_['keys'](_0x56d8f5),['createdAt',_0xfda1('0x91')]);_0x2a7b1f=_['difference'](_[_0xfda1('0x46')](_0x56d8f5),['createdAt',_0xfda1('0x91'),'CompanyId',_0xfda1('0x92')]);_0x24b0c5[_0xfda1('0x60')]={'mapKey':_0xfda1('0x93')};if(_0x24b0c5[_0xfda1('0x88')][_0xfda1('0x55')]&&_0x24b0c5[_0xfda1('0x88')][_0xfda1('0x55')]===_0xfda1('0x94')){_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x95')]=_0x5e2d02[_0xfda1('0x60')][_0xfda1('0x96')][_0xfda1('0x97')]('whatsapp:','');_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x60')]=_0x5e2d02['body'][_0xfda1('0x98')];_0x24b0c5[_0xfda1('0x60')]['messageId']=_0x5e2d02[_0xfda1('0x60')][_0xfda1('0x99')];}if(_0x24b0c5[_0xfda1('0x60')]['id']){delete _0x24b0c5[_0xfda1('0x60')]['id'];}if(_['isNil'](_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x95')])){throw new db[(_0xfda1('0x8d'))][(_0xfda1('0x8e'))](_0xfda1('0x9a'));}if(_[_0xfda1('0x9b')](_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x60')])||_0x24b0c5[_0xfda1('0x60')]['body']===''){throw new db[(_0xfda1('0x8d'))][(_0xfda1('0x8e'))](_0xfda1('0x9c'));}if(_[_0xfda1('0x9b')](_0x24b0c5[_0xfda1('0x60')]['mapKey'])){throw new db[(_0xfda1('0x8d'))][(_0xfda1('0x8e'))](_0xfda1('0x9d')+_0x2a7b1f);}if(!_[_0xfda1('0x9e')](_0x2a7b1f,_0x24b0c5['body'][_0xfda1('0x9f')])){throw new db[(_0xfda1('0x8d'))][(_0xfda1('0x8e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a7b1f);}_0x25f735[_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x9f')]]=_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x95')];return db['CmList'][_0xfda1('0x65')]({'where':{'id':_0x24b0c5['account']['ListId']},'include':[{'model':db[_0xfda1('0x8c')],'as':_0xfda1('0xa0'),'where':_0x25f735,'limit':0x1,'order':[['updatedAt',_0xfda1('0xa1')]]}]});})[_0xfda1('0x24')](handleEntityNotFound(_0x23f3b6,null))[_0xfda1('0x24')](function(_0x58d9a5){if(_0x58d9a5){_0x24b0c5['list']=_['omit'](_0x58d9a5,['Contacts']);if(_0x58d9a5[_0xfda1('0xa0')][_0xfda1('0x4a')]){return _0x58d9a5[_0xfda1('0xa0')][0x0];}var _0x1733ad=_[_0xfda1('0xa2')](_0x24b0c5[_0xfda1('0x60')],{'firstName':_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x95')],'ListId':_0x58d9a5['id']});_0x1733ad[_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x9f')]]=_0x24b0c5[_0xfda1('0x60')]['from'];return db[_0xfda1('0x8c')][_0xfda1('0x68')](_0x1733ad,{'fields':_0x1a3854,'raw':!![]});}})[_0xfda1('0x24')](handleEntityNotFound(_0x23f3b6,null))[_0xfda1('0x24')](function(_0xc3d3c8){if(_0xc3d3c8){_0x24b0c5[_0xfda1('0xa3')]=_0xc3d3c8;var _0x134cac={'ContactId':_0xc3d3c8['id'],'phone':_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x95')],'WhatsappAccountId':_0x5e2d02['params']['id']};var _0x5703ed={'ContactId':_0xc3d3c8['id'],'WhatsappAccountId':_0x5e2d02['params']['id'],'closed':![]};return db[_0xfda1('0xa4')]['find']({'where':_0x5703ed})[_0xfda1('0x24')](function(_0x4de11f){if(_0x4de11f){return[_0x4de11f,![]];}return db[_0xfda1('0xa4')]['create'](_0x134cac)[_0xfda1('0x24')](function(_0x59cb0c){return[_0x59cb0c,!![]];});});}})[_0xfda1('0x79')](function(_0x2ad1d7,_0x2ffd20){_0x24b0c5[_0xfda1('0xa5')]=_0x2ad1d7[_0xfda1('0x62')]({'plain':!![]});_0x24b0c5['interaction']['created']=![];if(_0x2ffd20){if(_0x24b0c5[_0xfda1('0x88')][_0xfda1('0xa6')]){_0x24b0c5['applications'][_0xfda1('0xa7')]({'id':0x0,'priority':_0x24b0c5[_0xfda1('0x89')][_0xfda1('0x4a')]+0x1,'app':'close','appdata':_0xfda1('0xa8'),'interval':_0xfda1('0xa9')});}_0x24b0c5[_0xfda1('0xa5')][_0xfda1('0xaa')]=!![];}return db[_0xfda1('0xab')][_0xfda1('0x68')]({'phone':_0x24b0c5[_0xfda1('0x60')][_0xfda1('0x95')],'messageId':_0x24b0c5[_0xfda1('0x60')][_0xfda1('0xac')],'body':_0x24b0c5[_0xfda1('0x60')]['body'],'WhatsappAccountId':_0x5e2d02[_0xfda1('0x5e')]['id'],'WhatsappInteractionId':_0x2ad1d7['id'],'direction':'in','ContactId':_0x2ad1d7[_0xfda1('0xad')],'AttachmentId':_0x24b0c5[_0xfda1('0x60')]['AttachmentId']});})['then'](function(_0x3e38e6){_0x24b0c5[_0xfda1('0x2d')]=_0x3e38e6;if(_0x24b0c5['interaction'][_0xfda1('0xae')]){return db['User'][_0xfda1('0x65')]({'attributes':['id',_0xfda1('0x3c')],'where':{'id':_0x24b0c5['interaction'][_0xfda1('0xae')]}})[_0xfda1('0x24')](function(_0x5946ba){if(_0x5946ba){_0x24b0c5[_0xfda1('0x89')][_0xfda1('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5946ba[_0xfda1('0x3c')]+','+(_0x24b0c5[_0xfda1('0x88')][_0xfda1('0xb0')]||0xa),'interval':_0xfda1('0xa9')});}return respondWithRpcPromise(_0xfda1('0xb1'),'startRouting',_0x24b0c5);});}return respondWithRpcPromise('Start','startRouting',_0x24b0c5);})[_0xfda1('0x24')](function(_0x507919){if(_0x507919){var _0x3a197b=0xc8;var _0x374abb=_0xfda1('0xb2');logger[_0xfda1('0x25')](_0xfda1('0x29'),_0x374abb,_0x3a197b,_0xfda1('0xb3'));logger[_0xfda1('0x28')](_0xfda1('0xb4'),_0x374abb,_0x3a197b,'entity\x20found',JSON['stringify'](_0x507919));if(_0x24b0c5[_0xfda1('0x88')][_0xfda1('0x55')]===_0xfda1('0x94')){return _0x23f3b6[_0xfda1('0x30')](_0x3a197b)[_0xfda1('0xb5')]('Content-Type',_0xfda1('0xb6'))[_0xfda1('0x3d')](_0xfda1('0xb7'));}else{return _0x23f3b6[_0xfda1('0x30')](_0x3a197b)[_0xfda1('0x32')](_0x507919);}}})['catch'](handleError(_0x23f3b6,null));};exports[_0xfda1('0x3d')]=function(_0x2997a0,_0xa8a782,_0x27d4b6){var _0x4b61f6,_0x2c7add,_0x4a6aad;if(_['isNil'](_0x2997a0[_0xfda1('0x60')][_0xfda1('0x60')])||_0x2997a0[_0xfda1('0x60')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfda1('0x9b')](_0x2997a0[_0xfda1('0x60')]['to'])){throw new db['Sequelize'][(_0xfda1('0x8e'))](_0xfda1('0xb8'));}_0x4b61f6=_0x2997a0[_0xfda1('0x60')]['to'];return db[_0xfda1('0x58')]['find']({'where':{'id':_0x2997a0[_0xfda1('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0xfda1('0xb9'),'include':[{'model':db[_0xfda1('0x8c')],'as':_0xfda1('0xa0'),'where':{'mobile':_0x4b61f6},'limit':0x1,'order':[[_0xfda1('0x91'),'DESC']]}]}]})[_0xfda1('0x24')](handleEntityNotFound(_0xa8a782,null))[_0xfda1('0x24')](function(_0xc03025){if(_0xc03025&&_0xc03025[_0xfda1('0xb9')]){_0x2c7add=_0xc03025[_0xfda1('0x62')]({'plain':!![]});if(_0x2c7add['List']&&_0x2c7add['List'][_0xfda1('0xa0')][_0xfda1('0x4a')]){return _0x2c7add[_0xfda1('0xb9')][_0xfda1('0xa0')][0x0];}return db[_0xfda1('0x8c')][_0xfda1('0x68')](_[_0xfda1('0xa2')](_0x2997a0[_0xfda1('0x60')],{'firstName':_0x4b61f6,'mobile':_0x4b61f6,'phone':_0x4b61f6,'ListId':_0x2c7add['ListId']}));}})[_0xfda1('0x24')](handleEntityNotFound(_0xa8a782,null))[_0xfda1('0x24')](function(_0x48f722){if(_0x48f722){_0x4a6aad=_0x48f722;return db['WhatsappInteraction'][_0xfda1('0x65')]({'where':{'ContactId':_0x4a6aad['id'],'closed':![],'WhatsappAccountId':_0x2c7add['id']}})[_0xfda1('0x24')](function(_0x351176){if(_0x351176){return[_0x351176,![]];}return db[_0xfda1('0xa4')][_0xfda1('0x68')]({'UserId':_0x2997a0[_0xfda1('0x61')]['id'],'ContactId':_0x4a6aad['id'],'WhatsappAccountId':_0x2c7add['id'],'phone':_0x4b61f6,'firstMsgDirection':_0xfda1('0xba'),'Messages':[_['merge'](_0x2997a0[_0xfda1('0x60')],{'read':![],'body':_0x2997a0[_0xfda1('0x60')]['body'],'phone':_0x4b61f6,'WhatsappAccountId':_0x2c7add['id'],'UserId':_0x2997a0[_0xfda1('0x61')]['id'],'ContactId':_0x4a6aad['id']})]},{'include':[{'model':db[_0xfda1('0xab')],'as':'Messages'}]})[_0xfda1('0x24')](function(_0x248d37){return[_0x248d37,!![]];});});}})['spread'](function(_0x1e5364,_0x218d48){if(_0x218d48){return _0x1e5364;}return db[_0xfda1('0xab')][_0xfda1('0x68')](_[_0xfda1('0x54')](_0x2997a0[_0xfda1('0x60')],{'read':![],'body':_0x2997a0['body']['body'],'phone':_0x4b61f6,'WhatsappAccountId':_0x2c7add['id'],'WhatsappInteractionId':_0x1e5364['id'],'UserId':_0x2997a0[_0xfda1('0x61')]['id'],'ContactId':_0x4a6aad['id']}))[_0xfda1('0x24')](function(_0x5439fd){_0x1e5364[_0xfda1('0xbb')][_0xfda1('0xbc')]=[];_0x1e5364['dataValues'][_0xfda1('0xbc')]['push'](_0x5439fd[_0xfda1('0xbb')]);return _0x1e5364;});})[_0xfda1('0x24')](respondWithResult(_0xa8a782,null))[_0xfda1('0x2e')](handleError(_0xa8a782,null));}; \ No newline at end of file +var _0x93de=['VIRTUAL','filter','options','include','findAll','rows','show','params','Pause','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','account','applications','orderBy','priority','Applications','CmContact','describe','Sequelize','ValidationError','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','messageId','MessageSid','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','updatedAt','DESC','Contacts','contact','WhatsappInteraction','spread','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','interaction','User','UserId','agent','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','html-pdf','eml-format','zip-dir','moment','mustache','sox','to-csv','ejs','fs-extra','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','../../config/license/util','redis','defaults','localhost','register','jayson/promise','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type'];(function(_0xa8ec8f,_0x3eaefa){var _0xcd07ea=function(_0xca5f5b){while(--_0xca5f5b){_0xa8ec8f['push'](_0xa8ec8f['shift']());}};_0xcd07ea(++_0x3eaefa);}(_0x93de,0x64));var _0xe93d=function(_0x261426,_0x59e18f){_0x261426=_0x261426-0x0;var _0x30f0fc=_0x93de[_0x261426];return _0x30f0fc;};'use strict';var pdf=require(_0xe93d('0x0'));var emlformat=require(_0xe93d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe93d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe93d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe93d('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe93d('0x5'));var csv=require(_0xe93d('0x6'));var ejs=require(_0xe93d('0x7'));var fs=require('fs');var fs_extra=require(_0xe93d('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe93d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe93d('0xa'));var toCsv=require(_0xe93d('0x6'));var querystring=require(_0xe93d('0xb'));var Papa=require(_0xe93d('0xc'));var Redis=require(_0xe93d('0xd'));var authService=require(_0xe93d('0xe'));var qs=require(_0xe93d('0xf'));var as=require(_0xe93d('0x10'));var hardwareService=require(_0xe93d('0x11'));var logger=require(_0xe93d('0x12'))(_0xe93d('0x13'));var utils=require(_0xe93d('0x14'));var config=require(_0xe93d('0x15'));var licenseUtil=require(_0xe93d('0x16'));var db=require('../../mysqldb')['db'];config[_0xe93d('0x17')]=_[_0xe93d('0x18')](config[_0xe93d('0x17')],{'host':_0xe93d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe93d('0x17')]));require('./whatsappAccount.socket')[_0xe93d('0x1a')](socket);var jayson=require(_0xe93d('0x1b'));var client=jayson['client'][_0xe93d('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0xf18738,_0x5bf0e4,_0x53e201,_0x2b8b83){return new BPromise(function(_0xc61099,_0x17fee2){var _0x884804=_0x2b8b83||client;return _0x884804[_0xe93d('0x1d')](_0xf18738,_0x53e201)[_0xe93d('0x1e')](function(_0x1cc604){logger[_0xe93d('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x5bf0e4,_0xe93d('0x20'));logger[_0xe93d('0x21')](_0xe93d('0x22'),_0x5bf0e4,_0xe93d('0x20'),JSON[_0xe93d('0x23')](_0x1cc604));if(_0x1cc604[_0xe93d('0x24')]){if(_0x1cc604['error']['code']===0x1f4){logger['error'](_0xe93d('0x25'),_0x5bf0e4,_0x1cc604[_0xe93d('0x24')][_0xe93d('0x26')]);return _0x17fee2(_0x1cc604[_0xe93d('0x24')][_0xe93d('0x26')]);}logger['error'](_0xe93d('0x25'),_0x5bf0e4,_0x1cc604[_0xe93d('0x24')][_0xe93d('0x26')]);return _0xc61099(_0x1cc604[_0xe93d('0x24')]['message']);}else{logger[_0xe93d('0x1f')](_0xe93d('0x25'),_0x5bf0e4,_0xe93d('0x20'));_0xc61099(_0x1cc604[_0xe93d('0x27')][_0xe93d('0x26')]);}})[_0xe93d('0x28')](function(_0x17338c){logger[_0xe93d('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5bf0e4,_0x17338c);_0x17fee2(_0x17338c);});});}function respondWithStatusCode(_0x23615a,_0xdacf79){_0xdacf79=_0xdacf79||0xcc;return function(_0x3d0e0b){if(_0x3d0e0b){return _0x23615a['sendStatus'](_0xdacf79);}return _0x23615a[_0xe93d('0x29')](_0xdacf79)[_0xe93d('0x2a')]();};}function respondWithResult(_0x7eec66,_0x44b3d8){_0x44b3d8=_0x44b3d8||0xc8;return function(_0x4b3fdc){if(_0x4b3fdc){return _0x7eec66['status'](_0x44b3d8)[_0xe93d('0x2b')](_0x4b3fdc);}};}function respondWithFilteredResult(_0x321d74,_0x1d03e2){return function(_0x520e3c){if(_0x520e3c){var _0x14d297=_0x520e3c[_0xe93d('0x2c')],_0x8adbdc=_0x1d03e2[_0xe93d('0x2d')],_0x5e03b1=_0x1d03e2[_0xe93d('0x2d')]+_0x1d03e2[_0xe93d('0x2e')],_0x2c3212;if(_0x5e03b1>=_0x14d297){_0x5e03b1=_0x14d297;_0x2c3212=0xc8;}else{_0x2c3212=0xce;}_0x321d74[_0xe93d('0x29')](_0x2c3212);return _0x321d74[_0xe93d('0x2f')](_0xe93d('0x30'),_0x8adbdc+'-'+_0x5e03b1+'/'+_0x14d297)[_0xe93d('0x2b')](_0x520e3c);}return null;};}function patchUpdates(_0x52f9a0){return function(_0x992b8d){try{jsonpatch['apply'](_0x992b8d,_0x52f9a0,!![]);}catch(_0x4d32fe){return BPromise[_0xe93d('0x31')](_0x4d32fe);}return _0x992b8d[_0xe93d('0x32')]();};}function saveUpdates(_0x397cce,_0x4dd1da){return function(_0x2f3633){if(_0x2f3633){return _0x2f3633[_0xe93d('0x33')](_0x397cce)[_0xe93d('0x1e')](function(_0x4f89eb){return _0x4f89eb;});}return null;};}function removeEntity(_0x56e7ee,_0x555ecf){return function(_0x197d3f){if(_0x197d3f){return _0x197d3f[_0xe93d('0x34')]()[_0xe93d('0x1e')](function(){var _0x263e85=_0x197d3f[_0xe93d('0x35')]({'plain':!![]});var _0x3027cd=_0xe93d('0x36');return db[_0xe93d('0x37')][_0xe93d('0x34')]({'where':{'type':_0x3027cd,'resourceId':_0x263e85['id']}})[_0xe93d('0x1e')](function(){return _0x197d3f;});})[_0xe93d('0x1e')](function(){_0x56e7ee[_0xe93d('0x29')](0xcc)[_0xe93d('0x2a')]();});}};}function handleEntityNotFound(_0x11b2ad,_0x5168ac){return function(_0x5f1717){if(!_0x5f1717){_0x11b2ad[_0xe93d('0x38')](0x194);}return _0x5f1717;};}function handleError(_0x3361c8,_0x346414){_0x346414=_0x346414||0x1f4;return function(_0x158d51){logger[_0xe93d('0x24')](_0x158d51[_0xe93d('0x39')]);if(_0x158d51['name']){delete _0x158d51[_0xe93d('0x3a')];}_0x3361c8[_0xe93d('0x29')](_0x346414)[_0xe93d('0x3b')](_0x158d51);};}exports['index']=function(_0x107345,_0x2d8096){var _0x258503={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x191989={},_0x18b3d9={'count':0x0,'rows':[]};var _0x1c74b3=_[_0xe93d('0x3c')](db[_0xe93d('0x3d')][_0xe93d('0x3e')],function(_0x3774f6){return{'name':_0x3774f6[_0xe93d('0x3f')],'type':_0x3774f6['type'][_0xe93d('0x40')]};});_0x191989[_0xe93d('0x41')]=_[_0xe93d('0x3c')](_0x1c74b3,'name');_0x191989[_0xe93d('0x42')]=_[_0xe93d('0x43')](_0x107345[_0xe93d('0x42')]);_0x191989[_0xe93d('0x44')]=_['intersection'](_0x191989[_0xe93d('0x41')],_0x191989['query']);_0x258503[_0xe93d('0x45')]=_[_0xe93d('0x46')](_0x191989['model'],qs[_0xe93d('0x47')](_0x107345['query'][_0xe93d('0x47')]));_0x258503[_0xe93d('0x45')]=_0x258503[_0xe93d('0x45')]['length']?_0x258503[_0xe93d('0x45')]:_0x191989[_0xe93d('0x41')];if(!_0x107345[_0xe93d('0x42')][_0xe93d('0x48')](_0xe93d('0x49'))){_0x258503[_0xe93d('0x2e')]=qs[_0xe93d('0x2e')](_0x107345[_0xe93d('0x42')]['limit']);_0x258503['offset']=qs[_0xe93d('0x2d')](_0x107345['query'][_0xe93d('0x2d')]);}_0x258503[_0xe93d('0x4a')]=qs[_0xe93d('0x4b')](_0x107345[_0xe93d('0x42')][_0xe93d('0x4b')]);_0x258503[_0xe93d('0x4c')]=qs[_0xe93d('0x44')](_[_0xe93d('0x4d')](_0x107345['query'],_0x191989[_0xe93d('0x44')]),_0x1c74b3);if(_0x107345[_0xe93d('0x42')]['filter']){_0x258503['where']=_[_0xe93d('0x4e')](_0x258503[_0xe93d('0x4c')],{'$or':_['map'](_0x1c74b3,function(_0x520f13){if(_0x520f13[_0xe93d('0x4f')]!==_0xe93d('0x50')){var _0x5c365d={};_0x5c365d[_0x520f13[_0xe93d('0x3a')]]={'$like':'%'+_0x107345[_0xe93d('0x42')][_0xe93d('0x51')]+'%'};return _0x5c365d;}})});}_0x258503=_[_0xe93d('0x4e')]({},_0x258503,_0x107345[_0xe93d('0x52')]);var _0x1d4f5d={'where':_0x258503[_0xe93d('0x4c')]};return db[_0xe93d('0x3d')][_0xe93d('0x2c')](_0x1d4f5d)['then'](function(_0x239608){_0x18b3d9[_0xe93d('0x2c')]=_0x239608;if(_0x107345['query']['includeAll']){_0x258503[_0xe93d('0x53')]=[{'all':!![]}];}return db[_0xe93d('0x3d')][_0xe93d('0x54')](_0x258503);})[_0xe93d('0x1e')](function(_0x4d8973){_0x18b3d9[_0xe93d('0x55')]=_0x4d8973;return _0x18b3d9;})[_0xe93d('0x1e')](respondWithFilteredResult(_0x2d8096,_0x258503))[_0xe93d('0x28')](handleError(_0x2d8096,null));};exports[_0xe93d('0x56')]=function(_0x1e933a,_0x2bc25a){var _0x40d37f={'raw':![],'where':{'id':_0x1e933a[_0xe93d('0x57')]['id']},'include':[{'model':db[_0xe93d('0x58')],'as':'mandatoryDispositionPause'}]},_0x451a15={};_0x451a15[_0xe93d('0x41')]=_[_0xe93d('0x43')](db[_0xe93d('0x3d')][_0xe93d('0x3e')]);_0x451a15[_0xe93d('0x42')]=_[_0xe93d('0x43')](_0x1e933a[_0xe93d('0x42')]);_0x451a15[_0xe93d('0x44')]=_[_0xe93d('0x46')](_0x451a15[_0xe93d('0x41')],_0x451a15['query']);_0x40d37f[_0xe93d('0x45')]=_[_0xe93d('0x46')](_0x451a15['model'],qs['fields'](_0x1e933a[_0xe93d('0x42')][_0xe93d('0x47')]));_0x40d37f[_0xe93d('0x45')]=_0x40d37f['attributes'][_0xe93d('0x59')]?_0x40d37f['attributes']:_0x451a15[_0xe93d('0x41')];if(_0x1e933a[_0xe93d('0x42')][_0xe93d('0x5a')]){_0x40d37f[_0xe93d('0x53')]=[{'all':!![]}];}_0x40d37f=_[_0xe93d('0x4e')]({},_0x40d37f,_0x1e933a[_0xe93d('0x52')]);return db['WhatsappAccount'][_0xe93d('0x5b')](_0x40d37f)[_0xe93d('0x1e')](handleEntityNotFound(_0x2bc25a,null))[_0xe93d('0x1e')](respondWithResult(_0x2bc25a,null))[_0xe93d('0x28')](handleError(_0x2bc25a,null));};exports[_0xe93d('0x5c')]=function(_0x262966,_0x5a312b){return db[_0xe93d('0x3d')]['create'](_0x262966['body'],{})['then'](function(_0x1b3936){var _0xd5bd87=_0x262966['user'][_0xe93d('0x35')]({'plain':!![]});if(!_0xd5bd87)throw new Error(_0xe93d('0x5d'));if(_0xd5bd87[_0xe93d('0x5e')]===_0xe93d('0x5f')){var _0x1a66e7=_0x1b3936[_0xe93d('0x35')]({'plain':!![]});var _0x55a7f4='WhatsappAccounts';return db[_0xe93d('0x60')][_0xe93d('0x5b')]({'where':{'name':_0x55a7f4,'userProfileId':_0xd5bd87[_0xe93d('0x61')]},'raw':!![]})[_0xe93d('0x1e')](function(_0x3f1bd6){if(_0x3f1bd6&&_0x3f1bd6['autoAssociation']===0x0){return db[_0xe93d('0x37')][_0xe93d('0x5c')]({'name':_0x1a66e7[_0xe93d('0x3a')],'resourceId':_0x1a66e7['id'],'type':_0x3f1bd6[_0xe93d('0x3a')],'sectionId':_0x3f1bd6['id']},{})[_0xe93d('0x1e')](function(){return _0x1b3936;});}else{return _0x1b3936;}})[_0xe93d('0x28')](function(_0x333a72){logger[_0xe93d('0x24')](_0xe93d('0x62'),_0x333a72);throw _0x333a72;});}return _0x1b3936;})[_0xe93d('0x1e')](respondWithResult(_0x5a312b,0xc9))[_0xe93d('0x28')](handleError(_0x5a312b,null));};exports[_0xe93d('0x33')]=function(_0xe09cf,_0x108e46){if(_0xe09cf[_0xe93d('0x63')]['id']){delete _0xe09cf['body']['id'];}return db[_0xe93d('0x3d')][_0xe93d('0x5b')]({'where':{'id':_0xe09cf[_0xe93d('0x57')]['id']},'include':[{'model':db[_0xe93d('0x58')],'as':_0xe93d('0x64')}]})[_0xe93d('0x1e')](handleEntityNotFound(_0x108e46,null))[_0xe93d('0x1e')](saveUpdates(_0xe09cf[_0xe93d('0x63')],null))['then'](respondWithResult(_0x108e46,null))['catch'](handleError(_0x108e46,null));};exports[_0xe93d('0x34')]=function(_0x3b451b,_0x1145c6){return db[_0xe93d('0x3d')][_0xe93d('0x5b')]({'where':{'id':_0x3b451b[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x1145c6,null))[_0xe93d('0x1e')](removeEntity(_0x1145c6,null))[_0xe93d('0x28')](handleError(_0x1145c6,null));};exports['describe']=function(_0x12496b,_0xfe1b8c){return db[_0xe93d('0x3d')]['describe']()[_0xe93d('0x1e')](respondWithResult(_0xfe1b8c,null))[_0xe93d('0x28')](handleError(_0xfe1b8c,null));};exports['addDisposition']=function(_0x6bd8ea,_0x4102c0,_0x2697e6){if(_0x6bd8ea['body']['id']){delete _0x6bd8ea[_0xe93d('0x63')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x6bd8ea[_0xe93d('0x57')]['id']}})['then'](handleEntityNotFound(_0x4102c0,null))[_0xe93d('0x1e')](function(_0x4170ed){if(_0x4170ed){_0x6bd8ea[_0xe93d('0x63')][_0xe93d('0x65')]=_0x4170ed['id'];return db['Disposition']['create'](_0x6bd8ea['body']);}})['then'](respondWithResult(_0x4102c0,null))[_0xe93d('0x28')](handleError(_0x4102c0,null));};exports[_0xe93d('0x66')]=function(_0x438a9d,_0x574112,_0x2831ec){var _0x209cf8={'raw':![],'where':{}};var _0x35ae9d={};var _0x80cfef={'count':0x0,'rows':[]};return db[_0xe93d('0x3d')][_0xe93d('0x67')]({'where':{'id':_0x438a9d[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x574112,null))[_0xe93d('0x1e')](function(_0x251d44){if(_0x251d44){_0x35ae9d[_0xe93d('0x41')]=_[_0xe93d('0x43')](db[_0xe93d('0x68')][_0xe93d('0x3e')]);_0x35ae9d[_0xe93d('0x42')]=_['keys'](_0x438a9d[_0xe93d('0x42')]);_0x35ae9d[_0xe93d('0x44')]=_[_0xe93d('0x46')](_0x35ae9d[_0xe93d('0x41')],_0x35ae9d['query']);_0x209cf8[_0xe93d('0x45')]=_['intersection'](_0x35ae9d[_0xe93d('0x41')],qs[_0xe93d('0x47')](_0x438a9d['query']['fields']));_0x209cf8[_0xe93d('0x45')]=_0x209cf8[_0xe93d('0x45')][_0xe93d('0x59')]?_0x209cf8[_0xe93d('0x45')]:_0x35ae9d[_0xe93d('0x41')];if(!_0x438a9d[_0xe93d('0x42')][_0xe93d('0x48')](_0xe93d('0x49'))){_0x209cf8[_0xe93d('0x2e')]=qs['limit'](_0x438a9d[_0xe93d('0x42')][_0xe93d('0x2e')]);_0x209cf8[_0xe93d('0x2d')]=qs[_0xe93d('0x2d')](_0x438a9d['query'][_0xe93d('0x2d')]);}_0x209cf8[_0xe93d('0x4a')]=qs[_0xe93d('0x4b')](_0x438a9d[_0xe93d('0x42')][_0xe93d('0x4b')]);_0x209cf8[_0xe93d('0x4c')]=qs[_0xe93d('0x44')](_['pick'](_0x438a9d['query'],_0x35ae9d[_0xe93d('0x44')]));_0x209cf8['where'][_0xe93d('0x65')]=_0x251d44['id'];if(_0x438a9d[_0xe93d('0x42')]['filter']){_0x209cf8[_0xe93d('0x4c')]=_[_0xe93d('0x4e')](_0x209cf8['where'],{'$or':_[_0xe93d('0x3c')](_0x209cf8[_0xe93d('0x45')],function(_0x22877d){var _0x4eebd2={};_0x4eebd2[_0x22877d]={'$like':'%'+_0x438a9d['query'][_0xe93d('0x51')]+'%'};return _0x4eebd2;})});}_0x209cf8=_[_0xe93d('0x4e')]({},_0x209cf8,_0x438a9d['options']);return db[_0xe93d('0x68')]['count']({'where':_0x209cf8[_0xe93d('0x4c')]})[_0xe93d('0x1e')](function(_0x5ae075){_0x80cfef[_0xe93d('0x2c')]=_0x5ae075;if(_0x438a9d['query'][_0xe93d('0x5a')]){_0x209cf8[_0xe93d('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x209cf8);})[_0xe93d('0x1e')](function(_0x491df8){_0x80cfef[_0xe93d('0x55')]=_0x491df8;return _0x80cfef;});}})[_0xe93d('0x1e')](respondWithFilteredResult(_0x574112,_0x209cf8))[_0xe93d('0x28')](handleError(_0x574112,null));};exports[_0xe93d('0x69')]=function(_0x265dcd,_0x3c7017,_0x590048){return db['WhatsappAccount'][_0xe93d('0x5b')]({'where':{'id':_0x265dcd[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x3c7017,null))[_0xe93d('0x1e')](function(_0xcea0ca){if(_0xcea0ca){return _0xcea0ca[_0xe93d('0x69')](_0x265dcd['query'][_0xe93d('0x6a')]);}})[_0xe93d('0x1e')](respondWithStatusCode(_0x3c7017,null))[_0xe93d('0x28')](handleError(_0x3c7017,null));};exports[_0xe93d('0x6b')]=function(_0xf981eb,_0x446307,_0x9cac5){if(_0xf981eb[_0xe93d('0x63')]['id']){delete _0xf981eb[_0xe93d('0x63')]['id'];}return db[_0xe93d('0x3d')][_0xe93d('0x5b')]({'where':{'id':_0xf981eb[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x446307,null))[_0xe93d('0x1e')](function(_0x29f051){if(_0x29f051){_0xf981eb['body'][_0xe93d('0x65')]=_0x29f051['id'];return db[_0xe93d('0x6c')]['create'](_0xf981eb[_0xe93d('0x63')]);}})[_0xe93d('0x1e')](respondWithResult(_0x446307,null))[_0xe93d('0x28')](handleError(_0x446307,null));};exports[_0xe93d('0x6d')]=function(_0x5a2d59,_0x136142,_0x5afbcc){var _0x56c943={'raw':![],'where':{}};var _0x5327ce={};var _0x198eb5={'count':0x0,'rows':[]};return db[_0xe93d('0x3d')][_0xe93d('0x67')]({'where':{'id':_0x5a2d59['params']['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x136142,null))[_0xe93d('0x1e')](function(_0x585fbf){if(_0x585fbf){_0x5327ce[_0xe93d('0x41')]=_[_0xe93d('0x43')](db[_0xe93d('0x6c')][_0xe93d('0x3e')]);_0x5327ce[_0xe93d('0x42')]=_['keys'](_0x5a2d59[_0xe93d('0x42')]);_0x5327ce[_0xe93d('0x44')]=_[_0xe93d('0x46')](_0x5327ce[_0xe93d('0x41')],_0x5327ce[_0xe93d('0x42')]);_0x56c943[_0xe93d('0x45')]=_[_0xe93d('0x46')](_0x5327ce[_0xe93d('0x41')],qs['fields'](_0x5a2d59['query']['fields']));_0x56c943[_0xe93d('0x45')]=_0x56c943[_0xe93d('0x45')]['length']?_0x56c943[_0xe93d('0x45')]:_0x5327ce[_0xe93d('0x41')];if(!_0x5a2d59['query'][_0xe93d('0x48')](_0xe93d('0x49'))){_0x56c943['limit']=qs[_0xe93d('0x2e')](_0x5a2d59[_0xe93d('0x42')][_0xe93d('0x2e')]);_0x56c943[_0xe93d('0x2d')]=qs[_0xe93d('0x2d')](_0x5a2d59['query'][_0xe93d('0x2d')]);}_0x56c943[_0xe93d('0x4a')]=qs[_0xe93d('0x4b')](_0x5a2d59[_0xe93d('0x42')][_0xe93d('0x4b')]);_0x56c943[_0xe93d('0x4c')]=qs[_0xe93d('0x44')](_['pick'](_0x5a2d59[_0xe93d('0x42')],_0x5327ce[_0xe93d('0x44')]));_0x56c943[_0xe93d('0x4c')][_0xe93d('0x65')]=_0x585fbf['id'];if(_0x5a2d59[_0xe93d('0x42')][_0xe93d('0x51')]){_0x56c943[_0xe93d('0x4c')]=_['merge'](_0x56c943[_0xe93d('0x4c')],{'$or':_['map'](_0x56c943['attributes'],function(_0x399d73){var _0x5d9eb4={};_0x5d9eb4[_0x399d73]={'$like':'%'+_0x5a2d59[_0xe93d('0x42')][_0xe93d('0x51')]+'%'};return _0x5d9eb4;})});}_0x56c943=_[_0xe93d('0x4e')]({},_0x56c943,_0x5a2d59[_0xe93d('0x52')]);return db[_0xe93d('0x6c')][_0xe93d('0x2c')]({'where':_0x56c943[_0xe93d('0x4c')]})['then'](function(_0x2867e6){_0x198eb5[_0xe93d('0x2c')]=_0x2867e6;if(_0x5a2d59[_0xe93d('0x42')][_0xe93d('0x5a')]){_0x56c943[_0xe93d('0x53')]=[{'all':!![]}];}return db[_0xe93d('0x6c')][_0xe93d('0x54')](_0x56c943);})[_0xe93d('0x1e')](function(_0x1069dc){_0x198eb5[_0xe93d('0x55')]=_0x1069dc;return _0x198eb5;});}})[_0xe93d('0x1e')](respondWithFilteredResult(_0x136142,_0x56c943))[_0xe93d('0x28')](handleError(_0x136142,null));};exports[_0xe93d('0x6e')]=function(_0xe7fb21,_0x2f9be2,_0x2f4bfe){return db[_0xe93d('0x3d')]['find']({'where':{'id':_0xe7fb21[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x2f9be2,null))[_0xe93d('0x1e')](function(_0x4a1c12){if(_0x4a1c12){return _0x4a1c12[_0xe93d('0x6e')](_0xe7fb21[_0xe93d('0x42')][_0xe93d('0x6a')]);}})[_0xe93d('0x1e')](respondWithStatusCode(_0x2f9be2,null))['catch'](handleError(_0x2f9be2,null));};exports[_0xe93d('0x6f')]=function(_0x3f352a,_0x59153b,_0xe8d9d6){return db['WhatsappAccount']['find']({'where':{'id':_0x3f352a['params']['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x59153b,null))['then'](function(_0x3203f6){if(_0x3203f6){return _0x3203f6[_0xe93d('0x6f')](_0x3f352a['body']['ids'],_[_0xe93d('0x70')](_0x3f352a['body'],[_0xe93d('0x6a'),'id'])||{})['spread'](function(_0x18b907){for(var _0x525478=0x0;_0x525478<_0x3f352a[_0xe93d('0x63')][_0xe93d('0x6a')][_0xe93d('0x59')];_0x525478+=0x1){socket[_0xe93d('0x71')](_0xe93d('0x72'),{'UserId':_0x3f352a[_0xe93d('0x63')][_0xe93d('0x6a')][_0x525478],'WhatsappAccountId':_0x3f352a[_0xe93d('0x57')]['id']});}return _0x18b907;});}})[_0xe93d('0x1e')](respondWithResult(_0x59153b,null))[_0xe93d('0x28')](handleError(_0x59153b,null));};exports[_0xe93d('0x73')]=function(_0x58516b,_0x7d76e,_0x5ee78d){return db[_0xe93d('0x3d')][_0xe93d('0x5b')]({'where':{'id':_0x58516b[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x7d76e,null))[_0xe93d('0x1e')](function(_0x235a42){if(_0x235a42){return _0x235a42[_0xe93d('0x73')](_0x58516b[_0xe93d('0x42')][_0xe93d('0x6a')])[_0xe93d('0x1e')](function(){if(_['isArray'](_0x58516b['query'][_0xe93d('0x6a')])){for(var _0x5c5bb4=0x0;_0x5c5bb4<_0x58516b[_0xe93d('0x42')][_0xe93d('0x6a')]['length'];_0x5c5bb4+=0x1){socket[_0xe93d('0x71')](_0xe93d('0x74'),{'UserId':Number(_0x58516b[_0xe93d('0x42')]['ids'][_0x5c5bb4]),'WhatsappAccountId':Number(_0x58516b[_0xe93d('0x57')]['id'])});}}else{socket[_0xe93d('0x71')](_0xe93d('0x74'),{'UserId':Number(_0x58516b[_0xe93d('0x42')]['ids']),'WhatsappAccountId':Number(_0x58516b['params']['id'])});}});}})[_0xe93d('0x1e')](respondWithStatusCode(_0x7d76e,null))[_0xe93d('0x28')](handleError(_0x7d76e,null));};exports[_0xe93d('0x75')]=function(_0x25e730,_0xe2200a,_0x568b12){var _0x1d17c5={};var _0x4dafc7={};var _0x3cbac4;var _0x34602d;return db[_0xe93d('0x3d')]['findOne']({'where':{'id':_0x25e730[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0xe2200a,null))[_0xe93d('0x1e')](function(_0x3ad11b){if(_0x3ad11b){_0x3cbac4=_0x3ad11b;_0x4dafc7[_0xe93d('0x41')]=_[_0xe93d('0x43')](db['User']['rawAttributes']);_0x4dafc7[_0xe93d('0x42')]=_[_0xe93d('0x43')](_0x25e730['query']);_0x4dafc7[_0xe93d('0x44')]=_[_0xe93d('0x46')](_0x4dafc7[_0xe93d('0x41')],_0x4dafc7[_0xe93d('0x42')]);_0x1d17c5[_0xe93d('0x45')]=_[_0xe93d('0x46')](_0x4dafc7[_0xe93d('0x41')],qs[_0xe93d('0x47')](_0x25e730[_0xe93d('0x42')][_0xe93d('0x47')]));_0x1d17c5['attributes']=_0x1d17c5[_0xe93d('0x45')]['length']?_0x1d17c5[_0xe93d('0x45')]:_0x4dafc7[_0xe93d('0x41')];_0x1d17c5['order']=qs['sort'](_0x25e730['query'][_0xe93d('0x4b')]);_0x1d17c5[_0xe93d('0x4c')]=qs[_0xe93d('0x44')](_[_0xe93d('0x4d')](_0x25e730[_0xe93d('0x42')],_0x4dafc7[_0xe93d('0x44')]));if(_0x25e730[_0xe93d('0x42')]['filter']){_0x1d17c5[_0xe93d('0x4c')]=_[_0xe93d('0x4e')](_0x1d17c5['where'],{'$or':_[_0xe93d('0x3c')](_0x1d17c5[_0xe93d('0x45')],function(_0x14de8e){var _0x40f2b8={};_0x40f2b8[_0x14de8e]={'$like':'%'+_0x25e730[_0xe93d('0x42')]['filter']+'%'};return _0x40f2b8;})});}_0x1d17c5=_[_0xe93d('0x4e')]({},_0x1d17c5,_0x25e730[_0xe93d('0x52')]);return _0x3cbac4['getAgents'](_0x1d17c5);}})[_0xe93d('0x1e')](function(_0x380a7c){if(_0x380a7c){_0x34602d=_0x380a7c[_0xe93d('0x59')];if(!_0x25e730['query']['hasOwnProperty'](_0xe93d('0x49'))){_0x1d17c5[_0xe93d('0x2e')]=qs['limit'](_0x25e730['query']['limit']);_0x1d17c5['offset']=qs[_0xe93d('0x2d')](_0x25e730[_0xe93d('0x42')][_0xe93d('0x2d')]);}return _0x3cbac4[_0xe93d('0x75')](_0x1d17c5);}})['then'](function(_0x53e739){if(_0x53e739){return _0x53e739?{'count':_0x34602d,'rows':_0x53e739}:null;}})['then'](respondWithResult(_0xe2200a,null))['catch'](handleError(_0xe2200a,null));};exports['addApplications']=function(_0x1a19c5,_0x1b7e90,_0xd47929){return db[_0xe93d('0x3d')][_0xe93d('0x67')]({'where':{'id':_0x1a19c5[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x1b7e90,null))[_0xe93d('0x1e')](function(_0x3d853b){if(_0x3d853b){return db[_0xe93d('0x76')][_0xe93d('0x77')](function(_0x329475){return db[_0xe93d('0x78')][_0xe93d('0x34')]({'where':{'WhatsappAccountId':_0x1a19c5['params']['id']},'transaction':_0x329475})[_0xe93d('0x1e')](function(_0x1fd4cb){var _0x29aa37=_['map'](_0x1a19c5['body'],function(_0x34ae1b){_0x34ae1b[_0xe93d('0x65')]=_0x1a19c5[_0xe93d('0x57')]['id'];return _0x34ae1b;});return db['WhatsappApplication'][_0xe93d('0x79')](_0x29aa37,{'transaction':_0x329475});});})[_0xe93d('0x1e')](function(){return db[_0xe93d('0x78')][_0xe93d('0x7a')]({'where':{'WhatsappAccountId':_0x1a19c5[_0xe93d('0x57')]['id']},'order':'priority'});});}})[_0xe93d('0x1e')](respondWithResult(_0x1b7e90,null))['catch'](handleError(_0x1b7e90,null));};exports[_0xe93d('0x7b')]=function(_0x46d958,_0x43a127,_0x4c4308){var _0x560d86={};var _0x970cb4={};var _0x285297;var _0x3a3c80;return db[_0xe93d('0x3d')][_0xe93d('0x67')]({'where':{'id':_0x46d958[_0xe93d('0x57')]['id']}})[_0xe93d('0x1e')](handleEntityNotFound(_0x43a127,null))[_0xe93d('0x1e')](function(_0xca46f0){if(_0xca46f0){_0x285297=_0xca46f0;_0x970cb4[_0xe93d('0x41')]=_[_0xe93d('0x43')](db['WhatsappApplication']['rawAttributes']);_0x970cb4['query']=_['keys'](_0x46d958[_0xe93d('0x42')]);_0x970cb4['filters']=_[_0xe93d('0x46')](_0x970cb4['model'],_0x970cb4['query']);_0x560d86[_0xe93d('0x45')]=_[_0xe93d('0x46')](_0x970cb4['model'],qs[_0xe93d('0x47')](_0x46d958[_0xe93d('0x42')][_0xe93d('0x47')]));_0x560d86[_0xe93d('0x45')]=_0x560d86[_0xe93d('0x45')]['length']?_0x560d86[_0xe93d('0x45')]:_0x970cb4[_0xe93d('0x41')];_0x560d86[_0xe93d('0x4a')]=qs[_0xe93d('0x4b')](_0x46d958['query'][_0xe93d('0x4b')]);_0x560d86['where']=qs[_0xe93d('0x44')](_[_0xe93d('0x4d')](_0x46d958[_0xe93d('0x42')],_0x970cb4[_0xe93d('0x44')]));if(_0x46d958['query'][_0xe93d('0x51')]){_0x560d86[_0xe93d('0x4c')]=_['merge'](_0x560d86[_0xe93d('0x4c')],{'$or':_[_0xe93d('0x3c')](_0x560d86[_0xe93d('0x45')],function(_0x2bd805){var _0x41ebdb={};_0x41ebdb[_0x2bd805]={'$like':'%'+_0x46d958[_0xe93d('0x42')]['filter']+'%'};return _0x41ebdb;})});}_0x560d86=_[_0xe93d('0x4e')]({},_0x560d86,_0x46d958['options']);return _0x285297[_0xe93d('0x7b')](_0x560d86);}})[_0xe93d('0x1e')](function(_0x49495f){if(_0x49495f){_0x3a3c80=_0x49495f[_0xe93d('0x59')];if(!_0x46d958[_0xe93d('0x42')][_0xe93d('0x48')](_0xe93d('0x49'))){_0x560d86[_0xe93d('0x2e')]=qs[_0xe93d('0x2e')](_0x46d958[_0xe93d('0x42')][_0xe93d('0x2e')]);_0x560d86['offset']=qs[_0xe93d('0x2d')](_0x46d958[_0xe93d('0x42')][_0xe93d('0x2d')]);}return _0x285297['getApplications'](_0x560d86);}})[_0xe93d('0x1e')](function(_0xebb512){if(_0xebb512){return _0xebb512?{'count':_0x3a3c80,'rows':_0xebb512}:null;}})['then'](respondWithResult(_0x43a127,null))[_0xe93d('0x28')](handleError(_0x43a127,null));};exports[_0xe93d('0x7c')]=function(_0x22acf2,_0x2f9609,_0x27e15b){var _0x30605e={'channel':'whatsapp'};var _0x214622=[];var _0x3b24a8=[];var _0x339231={};return db[_0xe93d('0x3d')][_0xe93d('0x5b')]({'where':{'id':_0x22acf2[_0xe93d('0x57')]['id']},'include':[{'model':db[_0xe93d('0x78')],'as':'Applications'}]})[_0xe93d('0x1e')](handleEntityNotFound(_0x2f9609,null))[_0xe93d('0x1e')](function(_0xee10b){_0x30605e[_0xe93d('0x7d')]=_0xee10b;_0x30605e[_0xe93d('0x7e')]=_[_0xe93d('0x7f')](_0xee10b['Applications'],[_0xe93d('0x80')],['asc']);if(_0x30605e[_0xe93d('0x7d')][_0xe93d('0x81')]){delete _0x30605e['account'][_0xe93d('0x81')];}return db[_0xe93d('0x82')][_0xe93d('0x83')]();})[_0xe93d('0x1e')](function(_0x1686ce){if(!_0x1686ce){throw new db[(_0xe93d('0x84'))][(_0xe93d('0x85'))]('no\x20available\x20attributes');}_0x214622=_['difference'](_[_0xe93d('0x43')](_0x1686ce),['createdAt','updatedAt']);_0x3b24a8=_[_0xe93d('0x86')](_['keys'](_0x1686ce),[_0xe93d('0x87'),'updatedAt',_0xe93d('0x88'),_0xe93d('0x89')]);_0x30605e[_0xe93d('0x63')]={'mapKey':_0xe93d('0x8a')};if(_0x30605e['account'][_0xe93d('0x4f')]&&_0x30605e[_0xe93d('0x7d')][_0xe93d('0x4f')]===_0xe93d('0x8b')){_0x30605e[_0xe93d('0x63')][_0xe93d('0x8c')]=_0x22acf2['body'][_0xe93d('0x8d')]['replace'](_0xe93d('0x8e'),'');_0x30605e['body'][_0xe93d('0x63')]=_0x22acf2[_0xe93d('0x63')]['Body'];_0x30605e[_0xe93d('0x63')][_0xe93d('0x8f')]=_0x22acf2[_0xe93d('0x63')][_0xe93d('0x90')];}if(_0x30605e[_0xe93d('0x63')]['id']){delete _0x30605e['body']['id'];}if(_['isNil'](_0x30605e[_0xe93d('0x63')]['from'])){throw new db['Sequelize'][(_0xe93d('0x85'))](_0xe93d('0x91'));}if(_['isNil'](_0x30605e[_0xe93d('0x63')][_0xe93d('0x63')])||_0x30605e['body'][_0xe93d('0x63')]===''){throw new db['Sequelize']['ValidationError'](_0xe93d('0x92'));}if(_[_0xe93d('0x93')](_0x30605e[_0xe93d('0x63')][_0xe93d('0x94')])){throw new db['Sequelize'][(_0xe93d('0x85'))](_0xe93d('0x95')+_0x3b24a8);}if(!_[_0xe93d('0x96')](_0x3b24a8,_0x30605e['body'][_0xe93d('0x94')])){throw new db[(_0xe93d('0x84'))][(_0xe93d('0x85'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b24a8);}_0x339231[_0x30605e[_0xe93d('0x63')][_0xe93d('0x94')]]=_0x30605e[_0xe93d('0x63')]['from'];return db['CmList'][_0xe93d('0x5b')]({'where':{'id':_0x30605e[_0xe93d('0x7d')][_0xe93d('0x89')]},'include':[{'model':db[_0xe93d('0x82')],'as':'Contacts','where':_0x339231,'limit':0x1,'order':[[_0xe93d('0x97'),_0xe93d('0x98')]]}]});})[_0xe93d('0x1e')](handleEntityNotFound(_0x2f9609,null))[_0xe93d('0x1e')](function(_0x5e154e){if(_0x5e154e){_0x30605e['list']=_['omit'](_0x5e154e,[_0xe93d('0x99')]);if(_0x5e154e[_0xe93d('0x99')]['length']){return _0x5e154e[_0xe93d('0x99')][0x0];}var _0x454a4b=_[_0xe93d('0x18')](_0x30605e[_0xe93d('0x63')],{'firstName':_0x30605e[_0xe93d('0x63')]['from'],'ListId':_0x5e154e['id']});_0x454a4b[_0x30605e['body'][_0xe93d('0x94')]]=_0x30605e[_0xe93d('0x63')][_0xe93d('0x8c')];return db[_0xe93d('0x82')][_0xe93d('0x5c')](_0x454a4b,{'fields':_0x214622,'raw':!![]});}})['then'](handleEntityNotFound(_0x2f9609,null))['then'](function(_0x5693b7){if(_0x5693b7){_0x30605e[_0xe93d('0x9a')]=_0x5693b7;var _0x2f0160={'ContactId':_0x5693b7['id'],'phone':_0x30605e['body'][_0xe93d('0x8c')],'WhatsappAccountId':_0x22acf2['params']['id']};var _0x5d54ea={'ContactId':_0x5693b7['id'],'WhatsappAccountId':_0x22acf2['params']['id'],'closed':![]};return db[_0xe93d('0x9b')][_0xe93d('0x5b')]({'where':_0x5d54ea})[_0xe93d('0x1e')](function(_0x593a5a){if(_0x593a5a){return[_0x593a5a,![]];}return db['WhatsappInteraction'][_0xe93d('0x5c')](_0x2f0160)[_0xe93d('0x1e')](function(_0x4740a3){return[_0x4740a3,!![]];});});}})[_0xe93d('0x9c')](function(_0xcbf5b4,_0xa0d8cd){_0x30605e['interaction']=_0xcbf5b4['get']({'plain':!![]});_0x30605e['interaction'][_0xe93d('0x9d')]=![];if(_0xa0d8cd){if(_0x30605e[_0xe93d('0x7d')][_0xe93d('0x9e')]){_0x30605e['applications'][_0xe93d('0x9f')]({'id':0x0,'priority':_0x30605e['applications'][_0xe93d('0x59')]+0x1,'app':_0xe93d('0xa0'),'appdata':_0xe93d('0xa1'),'interval':_0xe93d('0xa2')});}_0x30605e['interaction']['created']=!![];}return db[_0xe93d('0xa3')][_0xe93d('0x5c')]({'phone':_0x30605e[_0xe93d('0x63')][_0xe93d('0x8c')],'messageId':_0x30605e[_0xe93d('0x63')][_0xe93d('0x8f')],'body':_0x30605e['body'][_0xe93d('0x63')],'WhatsappAccountId':_0x22acf2[_0xe93d('0x57')]['id'],'WhatsappInteractionId':_0xcbf5b4['id'],'direction':'in','ContactId':_0xcbf5b4[_0xe93d('0xa4')],'AttachmentId':_0x30605e[_0xe93d('0x63')]['AttachmentId']});})[_0xe93d('0x1e')](function(_0x1f6232){_0x30605e['message']=_0x1f6232;if(_0x30605e[_0xe93d('0xa5')]['UserId']){return db[_0xe93d('0xa6')][_0xe93d('0x5b')]({'attributes':['id',_0xe93d('0x3a')],'where':{'id':_0x30605e[_0xe93d('0xa5')][_0xe93d('0xa7')]}})[_0xe93d('0x1e')](function(_0x1e7c1c){if(_0x1e7c1c){_0x30605e[_0xe93d('0x7e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe93d('0xa8'),'appdata':_0x1e7c1c[_0xe93d('0x3a')]+','+(_0x30605e[_0xe93d('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':_0xe93d('0xa2')});}return respondWithRpcPromise(_0xe93d('0xa9'),'startRouting',_0x30605e);});}return respondWithRpcPromise(_0xe93d('0xa9'),'startRouting',_0x30605e);})[_0xe93d('0x1e')](function(_0xb93331){if(_0xb93331){var _0x41dead=0xc8;var _0x2cc12d='receiveMessage';logger[_0xe93d('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2cc12d,_0x41dead,_0xe93d('0xaa'));logger[_0xe93d('0x21')](_0xe93d('0xab'),_0x2cc12d,_0x41dead,_0xe93d('0xaa'),JSON[_0xe93d('0x23')](_0xb93331));if(_0x30605e['account'][_0xe93d('0x4f')]===_0xe93d('0x8b')){return _0x2f9609[_0xe93d('0x29')](_0x41dead)['set'](_0xe93d('0xac'),_0xe93d('0xad'))[_0xe93d('0x3b')]('\x0a');}else{return _0x2f9609[_0xe93d('0x29')](_0x41dead)[_0xe93d('0x2b')](_0xb93331);}}})[_0xe93d('0x28')](handleError(_0x2f9609,null));};exports['send']=function(_0x1e2e21,_0x8a9e1c,_0x36e53a){var _0xfe4ef8,_0x13df31,_0x2f072c;if(_['isNil'](_0x1e2e21['body'][_0xe93d('0x63')])||_0x1e2e21[_0xe93d('0x63')][_0xe93d('0x63')]===''){throw new db[(_0xe93d('0x84'))]['ValidationError'](_0xe93d('0x92'));}if(_[_0xe93d('0x93')](_0x1e2e21[_0xe93d('0x63')]['to'])){throw new db[(_0xe93d('0x84'))][(_0xe93d('0x85'))](_0xe93d('0xae'));}_0xfe4ef8=_0x1e2e21['body']['to'];return db['WhatsappAccount'][_0xe93d('0x5b')]({'where':{'id':_0x1e2e21['params']['id']},'include':[{'model':db[_0xe93d('0xaf')],'as':_0xe93d('0xb0'),'include':[{'model':db[_0xe93d('0x82')],'as':_0xe93d('0x99'),'where':{'mobile':_0xfe4ef8},'limit':0x1,'order':[[_0xe93d('0x97'),_0xe93d('0x98')]]}]}]})[_0xe93d('0x1e')](handleEntityNotFound(_0x8a9e1c,null))[_0xe93d('0x1e')](function(_0x2c46de){if(_0x2c46de&&_0x2c46de[_0xe93d('0xb0')]){_0x13df31=_0x2c46de['get']({'plain':!![]});if(_0x13df31['List']&&_0x13df31[_0xe93d('0xb0')][_0xe93d('0x99')][_0xe93d('0x59')]){return _0x13df31[_0xe93d('0xb0')]['Contacts'][0x0];}return db[_0xe93d('0x82')][_0xe93d('0x5c')](_[_0xe93d('0x18')](_0x1e2e21[_0xe93d('0x63')],{'firstName':_0xfe4ef8,'mobile':_0xfe4ef8,'phone':_0xfe4ef8,'ListId':_0x13df31[_0xe93d('0x89')]}));}})[_0xe93d('0x1e')](handleEntityNotFound(_0x8a9e1c,null))[_0xe93d('0x1e')](function(_0x534c97){if(_0x534c97){_0x2f072c=_0x534c97;return db['WhatsappInteraction'][_0xe93d('0x5b')]({'where':{'ContactId':_0x2f072c['id'],'closed':![],'WhatsappAccountId':_0x13df31['id']}})[_0xe93d('0x1e')](function(_0x447599){if(_0x447599){return[_0x447599,![]];}return db[_0xe93d('0x9b')]['create']({'UserId':_0x1e2e21['user']['id'],'ContactId':_0x2f072c['id'],'WhatsappAccountId':_0x13df31['id'],'phone':_0xfe4ef8,'firstMsgDirection':_0xe93d('0xb1'),'Messages':[_[_0xe93d('0x4e')](_0x1e2e21[_0xe93d('0x63')],{'read':![],'body':_0x1e2e21[_0xe93d('0x63')][_0xe93d('0x63')],'phone':_0xfe4ef8,'WhatsappAccountId':_0x13df31['id'],'UserId':_0x1e2e21['user']['id'],'ContactId':_0x2f072c['id']})]},{'include':[{'model':db[_0xe93d('0xa3')],'as':'Messages'}]})[_0xe93d('0x1e')](function(_0xa17e32){return[_0xa17e32,!![]];});});}})[_0xe93d('0x9c')](function(_0x4e7b10,_0x1472ed){if(_0x1472ed){return _0x4e7b10;}return db['WhatsappMessage'][_0xe93d('0x5c')](_[_0xe93d('0x4e')](_0x1e2e21['body'],{'read':![],'body':_0x1e2e21[_0xe93d('0x63')][_0xe93d('0x63')],'phone':_0xfe4ef8,'WhatsappAccountId':_0x13df31['id'],'WhatsappInteractionId':_0x4e7b10['id'],'UserId':_0x1e2e21[_0xe93d('0x5f')]['id'],'ContactId':_0x2f072c['id']}))[_0xe93d('0x1e')](function(_0x525a3d){_0x4e7b10[_0xe93d('0xb2')][_0xe93d('0xb3')]=[];_0x4e7b10[_0xe93d('0xb2')][_0xe93d('0xb3')][_0xe93d('0x9f')](_0x525a3d[_0xe93d('0xb2')]);return _0x4e7b10;});})['then'](respondWithResult(_0x8a9e1c,null))[_0xe93d('0x28')](handleError(_0x8a9e1c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c74ea9a..0ffdbfc 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 _0xc6a2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x5e5903,_0x30acbf){var _0x364f33=function(_0x5af312){while(--_0x5af312){_0x5e5903['push'](_0x5e5903['shift']());}};_0x364f33(++_0x30acbf);}(_0xc6a2,0x69));var _0x2c6a=function(_0x2dbea6,_0x11f24b){_0x2dbea6=_0x2dbea6-0x0;var _0xeec637=_0xc6a2[_0x2dbea6];return _0xeec637;};'use strict';var EventEmitter=require(_0x2c6a('0x0'));var WhatsappAccount=require(_0x2c6a('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2c6a('0x2')](0x0);var events={'afterCreate':_0x2c6a('0x3'),'afterUpdate':_0x2c6a('0x4'),'afterDestroy':_0x2c6a('0x5')};function emitEvent(_0x121b96){return function(_0xc93e9a,_0x3b1269,_0x1d2cfd){WhatsappAccountEvents[_0x2c6a('0x6')](_0x121b96+':'+_0xc93e9a['id'],_0xc93e9a);WhatsappAccountEvents[_0x2c6a('0x6')](_0x121b96,_0xc93e9a);_0x1d2cfd(null);};}for(var e in events){if(events[_0x2c6a('0x7')](e)){var event=events[e];WhatsappAccount[_0x2c6a('0x8')](e,emitEvent(event));}}module[_0x2c6a('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xe3da=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4ab585,_0xb82e5){var _0x44dcdb=function(_0x539d54){while(--_0x539d54){_0x4ab585['push'](_0x4ab585['shift']());}};_0x44dcdb(++_0xb82e5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xae3d('0x0'));var WhatsappAccount=require(_0xae3d('0x1'))['db'][_0xae3d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xae3d('0x3')](0x0);var events={'afterCreate':_0xae3d('0x4'),'afterUpdate':_0xae3d('0x5'),'afterDestroy':_0xae3d('0x6')};function emitEvent(_0x17952f){return function(_0xb2dfd3,_0x22bacf,_0x1b9397){WhatsappAccountEvents[_0xae3d('0x7')](_0x17952f+':'+_0xb2dfd3['id'],_0xb2dfd3);WhatsappAccountEvents[_0xae3d('0x7')](_0x17952f,_0xb2dfd3);_0x1b9397(null);};}for(var e in events){if(events[_0xae3d('0x8')](e)){var event=events[e];WhatsappAccount[_0xae3d('0x9')](e,emitEvent(event));}}module[_0xae3d('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f20701c..87cf786 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 _0x58e0=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0x58e0,0x190));var _0x058e=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x58e0[_0x616290];return _0x453879;};'use strict';var _=require(_0x058e('0x0'));var util=require('util');var logger=require(_0x058e('0x1'))(_0x058e('0x2'));var moment=require(_0x058e('0x3'));var BPromise=require(_0x058e('0x4'));var rp=require(_0x058e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x058e('0x6'));var config=require(_0x058e('0x7'));var attributes=require(_0x058e('0x8'));module[_0x058e('0x9')]=function(_0x1b06ef,_0xd55b6c){return _0x1b06ef[_0x058e('0xa')](_0x058e('0xb'),attributes,{'tableName':_0x058e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x765f=['path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','bluebird','request-promise'];(function(_0x83d08e,_0x228942){var _0x404d4f=function(_0x161ce){while(--_0x161ce){_0x83d08e['push'](_0x83d08e['shift']());}};_0x404d4f(++_0x228942);}(_0x765f,0x75));var _0xf765=function(_0x42f059,_0x372ca3){_0x42f059=_0x42f059-0x0;var _0x2121d6=_0x765f[_0x42f059];return _0x2121d6;};'use strict';var _=require('lodash');var util=require(_0xf765('0x0'));var logger=require(_0xf765('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf765('0x2'));var rp=require(_0xf765('0x3'));var fs=require('fs');var path=require(_0xf765('0x4'));var rimraf=require(_0xf765('0x5'));var config=require(_0xf765('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xf765('0x7')]=function(_0x2db2c0,_0x565ad1){return _0x2db2c0[_0xf765('0x8')](_0xf765('0x9'),attributes,{'tableName':_0xf765('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 9a9d3d4..1b8113a 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 _0x8804=['request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s'];(function(_0x2155f5,_0x4e7345){var _0x2d8d88=function(_0x1d2e3a){while(--_0x1d2e3a){_0x2155f5['push'](_0x2155f5['shift']());}};_0x2d8d88(++_0x4e7345);}(_0x8804,0x160));var _0x4880=function(_0x18fa44,_0x1143f5){_0x18fa44=_0x18fa44-0x0;var _0x5cf7d0=_0x8804[_0x18fa44];return _0x5cf7d0;};'use strict';var _=require(_0x4880('0x0'));var util=require(_0x4880('0x1'));var moment=require(_0x4880('0x2'));var BPromise=require(_0x4880('0x3'));var rs=require(_0x4880('0x4'));var fs=require('fs');var Redis=require(_0x4880('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4880('0x6'));var config=require(_0x4880('0x7'));var jayson=require(_0x4880('0x8'));var client=jayson['client'][_0x4880('0x9')]({'port':0x232a});config['redis']=_[_0x4880('0xa')](config[_0x4880('0xb')],{'host':_0x4880('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4880('0xb')]));require(_0x4880('0xd'))['register'](socket);function respondWithRpcPromise(_0x392616,_0x5e9070,_0x5b7395){return new BPromise(function(_0x3c26b7,_0x1ecf06){return client[_0x4880('0xe')](_0x392616,_0x5b7395)[_0x4880('0xf')](function(_0x3445d3){logger[_0x4880('0x10')](_0x4880('0x11'),_0x5e9070,_0x4880('0x12'));logger[_0x4880('0x13')](_0x4880('0x14'),_0x5e9070,'request\x20sent',JSON[_0x4880('0x15')](_0x3445d3));if(_0x3445d3['error']){if(_0x3445d3[_0x4880('0x16')][_0x4880('0x17')]===0x1f4){logger[_0x4880('0x16')](_0x4880('0x11'),_0x5e9070,_0x3445d3['error'][_0x4880('0x18')]);return _0x1ecf06(_0x3445d3['error'][_0x4880('0x18')]);}logger[_0x4880('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x5e9070,_0x3445d3[_0x4880('0x16')][_0x4880('0x18')]);return _0x3c26b7(_0x3445d3['error'][_0x4880('0x18')]);}else{logger[_0x4880('0x10')](_0x4880('0x11'),_0x5e9070,'request\x20sent');_0x3c26b7(_0x3445d3[_0x4880('0x19')]['message']);}})[_0x4880('0x1a')](function(_0x127b28){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5e9070,_0x127b28);_0x1ecf06(_0x127b28);});});}exports['ShowWhatsappAccount']=function(_0x15f964){var _0x28078a=this;return new Promise(function(_0x10dc6a,_0x516b69){return db[_0x4880('0x1b')][_0x4880('0x1c')]({'raw':_0x15f964[_0x4880('0x1d')]?_0x15f964[_0x4880('0x1d')][_0x4880('0x1e')]===undefined?!![]:![]:!![],'where':_0x15f964[_0x4880('0x1d')]?_0x15f964[_0x4880('0x1d')][_0x4880('0x1f')]||null:null,'attributes':_0x15f964[_0x4880('0x1d')]?_0x15f964[_0x4880('0x1d')][_0x4880('0x20')]||null:null,'include':_0x15f964['options']?_0x15f964['options'][_0x4880('0x21')]?_[_0x4880('0x22')](_0x15f964['options'][_0x4880('0x21')],function(_0x74639b){return{'model':db[_0x74639b['model']],'as':_0x74639b['as'],'attributes':_0x74639b[_0x4880('0x20')],'include':_0x74639b[_0x4880('0x21')]?_[_0x4880('0x22')](_0x74639b['include'],function(_0x1e97b3){return{'model':db[_0x1e97b3[_0x4880('0x23')]],'as':_0x1e97b3['as'],'attributes':_0x1e97b3[_0x4880('0x20')],'include':_0x1e97b3[_0x4880('0x21')]?_[_0x4880('0x22')](_0x1e97b3[_0x4880('0x21')],function(_0x40cf1f){return{'model':db[_0x40cf1f[_0x4880('0x23')]],'as':_0x40cf1f['as'],'attributes':_0x40cf1f[_0x4880('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4880('0xf')](function(_0x4f5fef){logger['info']('ShowWhatsappAccount',_0x15f964);logger[_0x4880('0x13')](_0x4880('0x24'),_0x15f964,JSON[_0x4880('0x15')](_0x4f5fef));_0x10dc6a(_0x4f5fef);})[_0x4880('0x1a')](function(_0x33f1b8){logger[_0x4880('0x16')](_0x4880('0x24'),_0x33f1b8[_0x4880('0x18')],_0x15f964);_0x516b69(_0x28078a[_0x4880('0x16')](0x1f4,_0x33f1b8[_0x4880('0x18')]));});});}; \ No newline at end of file +var _0x1176=['register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x402b60,_0x33b1b3){var _0x5b119a=function(_0x53ef26){while(--_0x53ef26){_0x402b60['push'](_0x402b60['shift']());}};_0x5b119a(++_0x33b1b3);}(_0x1176,0x80));var _0x6117=function(_0x4c899f,_0x441c64){_0x4c899f=_0x4c899f-0x0;var _0xb5dd3a=_0x1176[_0x4c899f];return _0xb5dd3a;};'use strict';var _=require(_0x6117('0x0'));var util=require(_0x6117('0x1'));var moment=require('moment');var BPromise=require(_0x6117('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6117('0x3'));var db=require(_0x6117('0x4'))['db'];var utils=require(_0x6117('0x5'));var logger=require(_0x6117('0x6'))(_0x6117('0x7'));var config=require(_0x6117('0x8'));var jayson=require(_0x6117('0x9'));var client=jayson[_0x6117('0xa')][_0x6117('0xb')]({'port':0x232a});config[_0x6117('0xc')]=_[_0x6117('0xd')](config['redis'],{'host':_0x6117('0xe'),'port':0x18eb});var socket=require(_0x6117('0xf'))(new Redis(config[_0x6117('0xc')]));require('./whatsappAccount.socket')[_0x6117('0x10')](socket);function respondWithRpcPromise(_0xb4bcd8,_0x5d7d52,_0x4dbd96){return new BPromise(function(_0x4eeafd,_0x328ddd){return client[_0x6117('0x11')](_0xb4bcd8,_0x4dbd96)['then'](function(_0x4a816f){logger[_0x6117('0x12')](_0x6117('0x13'),_0x5d7d52,_0x6117('0x14'));logger[_0x6117('0x15')](_0x6117('0x16'),_0x5d7d52,_0x6117('0x14'),JSON['stringify'](_0x4a816f));if(_0x4a816f['error']){if(_0x4a816f[_0x6117('0x17')]['code']===0x1f4){logger[_0x6117('0x17')](_0x6117('0x13'),_0x5d7d52,_0x4a816f['error']['message']);return _0x328ddd(_0x4a816f[_0x6117('0x17')][_0x6117('0x18')]);}logger[_0x6117('0x17')](_0x6117('0x13'),_0x5d7d52,_0x4a816f[_0x6117('0x17')][_0x6117('0x18')]);return _0x4eeafd(_0x4a816f[_0x6117('0x17')][_0x6117('0x18')]);}else{logger[_0x6117('0x12')](_0x6117('0x13'),_0x5d7d52,_0x6117('0x14'));_0x4eeafd(_0x4a816f['result'][_0x6117('0x18')]);}})[_0x6117('0x19')](function(_0x421eef){logger[_0x6117('0x17')](_0x6117('0x13'),_0x5d7d52,_0x421eef);_0x328ddd(_0x421eef);});});}exports[_0x6117('0x1a')]=function(_0x389ecb){var _0x368d0a=this;return new Promise(function(_0x4883d2,_0x49a482){return db[_0x6117('0x1b')]['find']({'raw':_0x389ecb[_0x6117('0x1c')]?_0x389ecb['options'][_0x6117('0x1d')]===undefined?!![]:![]:!![],'where':_0x389ecb[_0x6117('0x1c')]?_0x389ecb[_0x6117('0x1c')][_0x6117('0x1e')]||null:null,'attributes':_0x389ecb['options']?_0x389ecb[_0x6117('0x1c')][_0x6117('0x1f')]||null:null,'include':_0x389ecb[_0x6117('0x1c')]?_0x389ecb[_0x6117('0x1c')][_0x6117('0x20')]?_[_0x6117('0x21')](_0x389ecb['options']['include'],function(_0x597054){return{'model':db[_0x597054[_0x6117('0x22')]],'as':_0x597054['as'],'attributes':_0x597054[_0x6117('0x1f')],'include':_0x597054[_0x6117('0x20')]?_[_0x6117('0x21')](_0x597054[_0x6117('0x20')],function(_0x5548e4){return{'model':db[_0x5548e4[_0x6117('0x22')]],'as':_0x5548e4['as'],'attributes':_0x5548e4[_0x6117('0x1f')],'include':_0x5548e4[_0x6117('0x20')]?_[_0x6117('0x21')](_0x5548e4['include'],function(_0x4a30a9){return{'model':db[_0x4a30a9[_0x6117('0x22')]],'as':_0x4a30a9['as'],'attributes':_0x4a30a9[_0x6117('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3af047){logger['info'](_0x6117('0x1a'),_0x389ecb);logger[_0x6117('0x15')](_0x6117('0x1a'),_0x389ecb,JSON[_0x6117('0x23')](_0x3af047));_0x4883d2(_0x3af047);})[_0x6117('0x19')](function(_0x1c9dd5){logger[_0x6117('0x17')](_0x6117('0x1a'),_0x1c9dd5[_0x6117('0x18')],_0x389ecb);_0x49a482(_0x368d0a['error'](0x1f4,_0x1c9dd5[_0x6117('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f6f339e..b956d9e 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 _0x818a=['register','length','whatsappAccount:','./whatsappAccount.events','save','update','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x818a,0x16f));var _0xa818=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0x818a[_0x32d414];return _0x4e0bca;};'use strict';var WhatsappAccountEvents=require(_0xa818('0x0'));var events=[_0xa818('0x1'),'remove',_0xa818('0x2')];function createListener(_0xca72d0,_0x363ba6){return function(_0x19afd2){_0x363ba6['emit'](_0xca72d0,_0x19afd2);};}function removeListener(_0x1e5d7b,_0x19df98){return function(){WhatsappAccountEvents[_0xa818('0x3')](_0x1e5d7b,_0x19df98);};}exports[_0xa818('0x4')]=function(_0x3c48ec){for(var _0x318427=0x0,_0x38cb3e=events[_0xa818('0x5')];_0x318427<_0x38cb3e;_0x318427++){var _0xdd7e2a=events[_0x318427];var _0x1f3b83=createListener(_0xa818('0x6')+_0xdd7e2a,_0x3c48ec);WhatsappAccountEvents['on'](_0xdd7e2a,_0x1f3b83);}}; \ No newline at end of file +var _0x8cda=['update','emit','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x2a2f90,_0x1ca71b){var _0x865e75=function(_0x1efcbc){while(--_0x1efcbc){_0x2a2f90['push'](_0x2a2f90['shift']());}};_0x865e75(++_0x1ca71b);}(_0x8cda,0x6d));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappAccountEvents=require(_0xa8cd('0x0'));var events=[_0xa8cd('0x1'),_0xa8cd('0x2'),_0xa8cd('0x3')];function createListener(_0x52793c,_0x3a1805){return function(_0x5c7037){_0x3a1805[_0xa8cd('0x4')](_0x52793c,_0x5c7037);};}function removeListener(_0xe0f7d5,_0x70a5a6){return function(){WhatsappAccountEvents['removeListener'](_0xe0f7d5,_0x70a5a6);};}exports['register']=function(_0xa6d35c){for(var _0x460284=0x0,_0x18a913=events[_0xa8cd('0x5')];_0x460284<_0x18a913;_0x460284++){var _0x496347=events[_0x460284];var _0x3e3044=createListener(_0xa8cd('0x6')+_0x496347,_0xa6d35c);WhatsappAccountEvents['on'](_0x496347,_0x3e3044);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 00c12dd..23e847d 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 _0xaf22=['../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','create','put','/:id','update','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0xaf22,0x15f));var _0x2af2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaf22[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x2af2('0x0'));var util=require(_0x2af2('0x1'));var path=require('path');var timeout=require(_0x2af2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2af2('0x3'));var auth=require(_0x2af2('0x4'));var interaction=require(_0x2af2('0x5'));var config=require(_0x2af2('0x6'));var controller=require(_0x2af2('0x7'));router[_0x2af2('0x8')]('/',auth[_0x2af2('0x9')](),controller[_0x2af2('0xa')]);router[_0x2af2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2af2('0xb')]);router['post']('/',auth[_0x2af2('0x9')](),controller[_0x2af2('0xc')]);router[_0x2af2('0xd')](_0x2af2('0xe'),auth['isAuthenticated'](),controller[_0x2af2('0xf')]);router['delete'](_0x2af2('0xe'),auth[_0x2af2('0x9')](),controller['destroy']);module[_0x2af2('0x10')]=router; \ No newline at end of file +var _0x27c9=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','show','post','put','/:id'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x27c9,0x108));var _0x927c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x27c9[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var path=require(_0x927c('0x2'));var timeout=require(_0x927c('0x3'));var express=require(_0x927c('0x4'));var router=express[_0x927c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x927c('0x6'));var config=require(_0x927c('0x7'));var controller=require(_0x927c('0x8'));router[_0x927c('0x9')]('/',auth['isAuthenticated'](),controller[_0x927c('0xa')]);router[_0x927c('0x9')]('/:id',auth[_0x927c('0xb')](),controller[_0x927c('0xc')]);router[_0x927c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x927c('0xe')](_0x927c('0xf'),auth[_0x927c('0xb')](),controller[_0x927c('0x10')]);router[_0x927c('0x11')](_0x927c('0xf'),auth[_0x927c('0xb')](),controller[_0x927c('0x12')]);module[_0x927c('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 4b0bd96..d1d53c4 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 _0x9991=['TEXT','STRING','sequelize','exports','INTEGER','noop'];(function(_0x49bd78,_0x312150){var _0x11549e=function(_0x20657c){while(--_0x20657c){_0x49bd78['push'](_0x49bd78['shift']());}};_0x11549e(++_0x312150);}(_0x9991,0x164));var _0x1999=function(_0x2ff0e8,_0x1ecdee){_0x2ff0e8=_0x2ff0e8-0x0;var _0x57b2d2=_0x9991[_0x2ff0e8];return _0x57b2d2;};'use strict';var Sequelize=require(_0x1999('0x0'));module[_0x1999('0x1')]={'priority':{'type':Sequelize[_0x1999('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1999('0x3')},'appdata':{'type':Sequelize[_0x1999('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1999('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x42cb=['exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x518c60,_0x4e4195){var _0x438e84=function(_0x3ed2be){while(--_0x3ed2be){_0x518c60['push'](_0x518c60['shift']());}};_0x438e84(++_0x4e4195);}(_0x42cb,0x1e0));var _0xb42c=function(_0x54d6b0,_0xb40301){_0x54d6b0=_0x54d6b0-0x0;var _0x261f6e=_0x42cb[_0x54d6b0];return _0x261f6e;};'use strict';var Sequelize=require('sequelize');module[_0xb42c('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb42c('0x1')],'allowNull':![],'defaultValue':_0xb42c('0x2')},'appdata':{'type':Sequelize[_0xb42c('0x3')]()},'description':{'type':Sequelize[_0xb42c('0x1')]},'interval':{'type':Sequelize[_0xb42c('0x1')],'defaultValue':_0xb42c('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ada6273..58299d6 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 _0x1967=['options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','save','then','destroy','sendStatus','error','name','send','WhatsappApplication','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x27dc2e,_0x2c2db7){var _0x27606c=function(_0x5f50d9){while(--_0x5f50d9){_0x27dc2e['push'](_0x27dc2e['shift']());}};_0x27606c(++_0x2c2db7);}(_0x1967,0x173));var _0x7196=function(_0x407f0d,_0x32cf7f){_0x407f0d=_0x407f0d-0x0;var _0x3f2fd1=_0x1967[_0x407f0d];return _0x3f2fd1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7196('0x0'));var rimraf=require(_0x7196('0x1'));var zipdir=require(_0x7196('0x2'));var jsonpatch=require(_0x7196('0x3'));var rp=require(_0x7196('0x4'));var moment=require(_0x7196('0x5'));var BPromise=require(_0x7196('0x6'));var Mustache=require(_0x7196('0x7'));var util=require(_0x7196('0x8'));var path=require(_0x7196('0x9'));var sox=require('sox');var csv=require(_0x7196('0xa'));var ejs=require(_0x7196('0xb'));var fs=require('fs');var fs_extra=require(_0x7196('0xc'));var _=require(_0x7196('0xd'));var squel=require(_0x7196('0xe'));var crypto=require(_0x7196('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7196('0x10'));var toCsv=require(_0x7196('0xa'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7196('0x14'));var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x24f1c3,_0xba707b){_0xba707b=_0xba707b||0xcc;return function(_0x154101){if(_0x154101){return _0x24f1c3['sendStatus'](_0xba707b);}return _0x24f1c3[_0x7196('0x1c')](_0xba707b)[_0x7196('0x1d')]();};}function respondWithResult(_0x3545aa,_0xf098c1){_0xf098c1=_0xf098c1||0xc8;return function(_0x511aa1){if(_0x511aa1){return _0x3545aa[_0x7196('0x1c')](_0xf098c1)['json'](_0x511aa1);}};}function respondWithFilteredResult(_0xe32933,_0x2590a6){return function(_0xf7e97){if(_0xf7e97){var _0x3ed1ad=_0xf7e97[_0x7196('0x1e')],_0x12dce7=_0x2590a6[_0x7196('0x1f')],_0x2e3e0e=_0x2590a6[_0x7196('0x1f')]+_0x2590a6[_0x7196('0x20')],_0x22bd62;if(_0x2e3e0e>=_0x3ed1ad){_0x2e3e0e=_0x3ed1ad;_0x22bd62=0xc8;}else{_0x22bd62=0xce;}_0xe32933['status'](_0x22bd62);return _0xe32933['set'](_0x7196('0x21'),_0x12dce7+'-'+_0x2e3e0e+'/'+_0x3ed1ad)[_0x7196('0x22')](_0xf7e97);}return null;};}function patchUpdates(_0x40418d){return function(_0x517a3e){try{jsonpatch[_0x7196('0x23')](_0x517a3e,_0x40418d,!![]);}catch(_0x539d8b){return BPromise['reject'](_0x539d8b);}return _0x517a3e[_0x7196('0x24')]();};}function saveUpdates(_0x627223,_0x8dee9d){return function(_0x4ddf78){if(_0x4ddf78){return _0x4ddf78['update'](_0x627223)[_0x7196('0x25')](function(_0x3cd8ff){return _0x3cd8ff;});}return null;};}function removeEntity(_0x598a26,_0x18649b){return function(_0x27ff84){if(_0x27ff84){return _0x27ff84[_0x7196('0x26')]()[_0x7196('0x25')](function(){_0x598a26[_0x7196('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(!_0x3ce9a0){_0x3f8178[_0x7196('0x27')](0x194);}return _0x3ce9a0;};}function handleError(_0x2e15c7,_0xa69810){_0xa69810=_0xa69810||0x1f4;return function(_0x70aa65){logger[_0x7196('0x28')](_0x70aa65['stack']);if(_0x70aa65['name']){delete _0x70aa65[_0x7196('0x29')];}_0x2e15c7[_0x7196('0x1c')](_0xa69810)[_0x7196('0x2a')](_0x70aa65);};}exports['index']=function(_0x5aa538,_0x41cfd2){var _0x162cfc={},_0x675e64={},_0x4c6006={'count':0x0,'rows':[]};var _0x35eef9=_['map'](db[_0x7196('0x2b')]['rawAttributes'],function(_0x30151f){return{'name':_0x30151f[_0x7196('0x2c')],'type':_0x30151f[_0x7196('0x2d')]['key']};});_0x675e64[_0x7196('0x2e')]=_[_0x7196('0x2f')](_0x35eef9,_0x7196('0x29'));_0x675e64[_0x7196('0x30')]=_['keys'](_0x5aa538[_0x7196('0x30')]);_0x675e64[_0x7196('0x31')]=_[_0x7196('0x32')](_0x675e64[_0x7196('0x2e')],_0x675e64[_0x7196('0x30')]);_0x162cfc[_0x7196('0x33')]=_[_0x7196('0x32')](_0x675e64[_0x7196('0x2e')],qs[_0x7196('0x34')](_0x5aa538[_0x7196('0x30')][_0x7196('0x34')]));_0x162cfc['attributes']=_0x162cfc[_0x7196('0x33')]['length']?_0x162cfc[_0x7196('0x33')]:_0x675e64['model'];if(!_0x5aa538[_0x7196('0x30')][_0x7196('0x35')]('nolimit')){_0x162cfc[_0x7196('0x20')]=qs[_0x7196('0x20')](_0x5aa538[_0x7196('0x30')][_0x7196('0x20')]);_0x162cfc[_0x7196('0x1f')]=qs['offset'](_0x5aa538[_0x7196('0x30')][_0x7196('0x1f')]);}_0x162cfc[_0x7196('0x36')]=qs[_0x7196('0x37')](_0x5aa538[_0x7196('0x30')][_0x7196('0x37')]);_0x162cfc['where']=qs[_0x7196('0x31')](_[_0x7196('0x38')](_0x5aa538[_0x7196('0x30')],_0x675e64['filters']),_0x35eef9);if(_0x5aa538[_0x7196('0x30')][_0x7196('0x39')]){_0x162cfc[_0x7196('0x3a')]=_[_0x7196('0x3b')](_0x162cfc[_0x7196('0x3a')],{'$or':_[_0x7196('0x2f')](_0x35eef9,function(_0x938e49){if(_0x938e49[_0x7196('0x2d')]!==_0x7196('0x3c')){var _0x3ee114={};_0x3ee114[_0x938e49['name']]={'$like':'%'+_0x5aa538[_0x7196('0x30')][_0x7196('0x39')]+'%'};return _0x3ee114;}})});}_0x162cfc=_['merge']({},_0x162cfc,_0x5aa538[_0x7196('0x3d')]);var _0x54767f={'where':_0x162cfc['where']};return db[_0x7196('0x2b')][_0x7196('0x1e')](_0x54767f)['then'](function(_0x587f6f){_0x4c6006[_0x7196('0x1e')]=_0x587f6f;if(_0x5aa538[_0x7196('0x30')][_0x7196('0x3e')]){_0x162cfc['include']=[{'all':!![]}];}return db[_0x7196('0x2b')][_0x7196('0x3f')](_0x162cfc);})[_0x7196('0x25')](function(_0x29c58d){_0x4c6006[_0x7196('0x40')]=_0x29c58d;return _0x4c6006;})[_0x7196('0x25')](respondWithFilteredResult(_0x41cfd2,_0x162cfc))[_0x7196('0x41')](handleError(_0x41cfd2,null));};exports[_0x7196('0x42')]=function(_0x5cd903,_0x89c8ea){var _0xa852e1={'raw':!![],'where':{'id':_0x5cd903[_0x7196('0x43')]['id']}},_0x4f8b4a={};_0x4f8b4a[_0x7196('0x2e')]=_['keys'](db[_0x7196('0x2b')][_0x7196('0x44')]);_0x4f8b4a[_0x7196('0x30')]=_['keys'](_0x5cd903[_0x7196('0x30')]);_0x4f8b4a[_0x7196('0x31')]=_['intersection'](_0x4f8b4a[_0x7196('0x2e')],_0x4f8b4a[_0x7196('0x30')]);_0xa852e1['attributes']=_[_0x7196('0x32')](_0x4f8b4a['model'],qs['fields'](_0x5cd903['query']['fields']));_0xa852e1['attributes']=_0xa852e1[_0x7196('0x33')]['length']?_0xa852e1[_0x7196('0x33')]:_0x4f8b4a[_0x7196('0x2e')];if(_0x5cd903[_0x7196('0x30')][_0x7196('0x3e')]){_0xa852e1['include']=[{'all':!![]}];}_0xa852e1=_[_0x7196('0x3b')]({},_0xa852e1,_0x5cd903['options']);return db[_0x7196('0x2b')][_0x7196('0x45')](_0xa852e1)[_0x7196('0x25')](handleEntityNotFound(_0x89c8ea,null))['then'](respondWithResult(_0x89c8ea,null))[_0x7196('0x41')](handleError(_0x89c8ea,null));};exports[_0x7196('0x46')]=function(_0x1b5c68,_0x5b8f7a){return db['WhatsappApplication'][_0x7196('0x46')](_0x1b5c68['body'],{})[_0x7196('0x25')](respondWithResult(_0x5b8f7a,0xc9))['catch'](handleError(_0x5b8f7a,null));};exports['update']=function(_0x14b489,_0x5de6f2){if(_0x14b489['body']['id']){delete _0x14b489['body']['id'];}return db[_0x7196('0x2b')]['find']({'where':{'id':_0x14b489['params']['id']}})[_0x7196('0x25')](handleEntityNotFound(_0x5de6f2,null))[_0x7196('0x25')](saveUpdates(_0x14b489[_0x7196('0x47')],null))[_0x7196('0x25')](respondWithResult(_0x5de6f2,null))['catch'](handleError(_0x5de6f2,null));};exports[_0x7196('0x26')]=function(_0x564688,_0x36844f){return db[_0x7196('0x2b')]['find']({'where':{'id':_0x564688[_0x7196('0x43')]['id']}})[_0x7196('0x25')](handleEntityNotFound(_0x36844f,null))[_0x7196('0x25')](removeEntity(_0x36844f,null))['catch'](handleError(_0x36844f,null));}; \ No newline at end of file +var _0x814b=['destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','count','include','findAll','rows','catch','show','keys','includeAll','merge','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','save','update','then'];(function(_0x1f62a4,_0x155b67){var _0x58ab12=function(_0x4d5d6a){while(--_0x4d5d6a){_0x1f62a4['push'](_0x1f62a4['shift']());}};_0x58ab12(++_0x155b67);}(_0x814b,0x1a2));var _0xb814=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0x814b[_0x5465e6];return _0x10044e;};'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 fs_extra=require(_0xb814('0xc'));var _=require(_0xb814('0xd'));var squel=require('squel');var crypto=require(_0xb814('0xe'));var jsforce=require(_0xb814('0xf'));var deskjs=require(_0xb814('0x10'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x11'));var Papa=require(_0xb814('0x12'));var Redis=require(_0xb814('0x13'));var authService=require(_0xb814('0x14'));var qs=require(_0xb814('0x15'));var as=require(_0xb814('0x16'));var hardwareService=require(_0xb814('0x17'));var logger=require('../../config/logger')(_0xb814('0x18'));var utils=require('../../config/utils');var config=require(_0xb814('0x19'));var licenseUtil=require(_0xb814('0x1a'));var db=require(_0xb814('0x1b'))['db'];function respondWithStatusCode(_0x2cc46b,_0x2ce718){_0x2ce718=_0x2ce718||0xcc;return function(_0x3bde14){if(_0x3bde14){return _0x2cc46b[_0xb814('0x1c')](_0x2ce718);}return _0x2cc46b[_0xb814('0x1d')](_0x2ce718)[_0xb814('0x1e')]();};}function respondWithResult(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xc8;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x1d')](_0x3f4881)[_0xb814('0x1f')](_0x44fb96);}};}function respondWithFilteredResult(_0x303aca,_0x3a71d6){return function(_0x45e0d0){if(_0x45e0d0){var _0x265a83=_0x45e0d0['count'],_0x125ce2=_0x3a71d6[_0xb814('0x20')],_0x21b73f=_0x3a71d6['offset']+_0x3a71d6[_0xb814('0x21')],_0x7a21ef;if(_0x21b73f>=_0x265a83){_0x21b73f=_0x265a83;_0x7a21ef=0xc8;}else{_0x7a21ef=0xce;}_0x303aca[_0xb814('0x1d')](_0x7a21ef);return _0x303aca['set']('Content-Range',_0x125ce2+'-'+_0x21b73f+'/'+_0x265a83)['json'](_0x45e0d0);}return null;};}function patchUpdates(_0x399b43){return function(_0x4d5276){try{jsonpatch['apply'](_0x4d5276,_0x399b43,!![]);}catch(_0xb684ea){return BPromise[_0xb814('0x22')](_0xb684ea);}return _0x4d5276[_0xb814('0x23')]();};}function saveUpdates(_0x4e139e,_0xf5b8aa){return function(_0x531032){if(_0x531032){return _0x531032[_0xb814('0x24')](_0x4e139e)[_0xb814('0x25')](function(_0x3b267e){return _0x3b267e;});}return null;};}function removeEntity(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x26')]()['then'](function(){_0x470e81[_0xb814('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(!_0x31c7ec){_0x3f81d0[_0xb814('0x1c')](0x194);}return _0x31c7ec;};}function handleError(_0x1c8a2e,_0xb9e57d){_0xb9e57d=_0xb9e57d||0x1f4;return function(_0x3d836c){logger['error'](_0x3d836c[_0xb814('0x27')]);if(_0x3d836c[_0xb814('0x28')]){delete _0x3d836c[_0xb814('0x28')];}_0x1c8a2e[_0xb814('0x1d')](_0xb9e57d)[_0xb814('0x29')](_0x3d836c);};}exports[_0xb814('0x2a')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291={},_0x271aa8={},_0x328a08={'count':0x0,'rows':[]};var _0x52ed64=_[_0xb814('0x2b')](db[_0xb814('0x2c')][_0xb814('0x2d')],function(_0x499f22){return{'name':_0x499f22[_0xb814('0x2e')],'type':_0x499f22[_0xb814('0x2f')]['key']};});_0x271aa8[_0xb814('0x30')]=_['map'](_0x52ed64,_0xb814('0x28'));_0x271aa8['query']=_['keys'](_0x3f0150[_0xb814('0x31')]);_0x271aa8['filters']=_[_0xb814('0x32')](_0x271aa8[_0xb814('0x30')],_0x271aa8[_0xb814('0x31')]);_0x5a6291['attributes']=_['intersection'](_0x271aa8[_0xb814('0x30')],qs[_0xb814('0x33')](_0x3f0150['query'][_0xb814('0x33')]));_0x5a6291[_0xb814('0x34')]=_0x5a6291[_0xb814('0x34')][_0xb814('0x35')]?_0x5a6291[_0xb814('0x34')]:_0x271aa8[_0xb814('0x30')];if(!_0x3f0150[_0xb814('0x31')]['hasOwnProperty'](_0xb814('0x36'))){_0x5a6291[_0xb814('0x21')]=qs[_0xb814('0x21')](_0x3f0150[_0xb814('0x31')][_0xb814('0x21')]);_0x5a6291['offset']=qs[_0xb814('0x20')](_0x3f0150['query'][_0xb814('0x20')]);}_0x5a6291[_0xb814('0x37')]=qs[_0xb814('0x38')](_0x3f0150['query'][_0xb814('0x38')]);_0x5a6291[_0xb814('0x39')]=qs['filters'](_[_0xb814('0x3a')](_0x3f0150[_0xb814('0x31')],_0x271aa8[_0xb814('0x3b')]),_0x52ed64);if(_0x3f0150[_0xb814('0x31')][_0xb814('0x3c')]){_0x5a6291[_0xb814('0x39')]=_['merge'](_0x5a6291[_0xb814('0x39')],{'$or':_['map'](_0x52ed64,function(_0x2aaf1c){if(_0x2aaf1c['type']!==_0xb814('0x3d')){var _0x4b9233={};_0x4b9233[_0x2aaf1c[_0xb814('0x28')]]={'$like':'%'+_0x3f0150[_0xb814('0x31')]['filter']+'%'};return _0x4b9233;}})});}_0x5a6291=_['merge']({},_0x5a6291,_0x3f0150['options']);var _0x57b379={'where':_0x5a6291[_0xb814('0x39')]};return db[_0xb814('0x2c')][_0xb814('0x3e')](_0x57b379)[_0xb814('0x25')](function(_0x51cdba){_0x328a08['count']=_0x51cdba;if(_0x3f0150[_0xb814('0x31')]['includeAll']){_0x5a6291[_0xb814('0x3f')]=[{'all':!![]}];}return db[_0xb814('0x2c')][_0xb814('0x40')](_0x5a6291);})[_0xb814('0x25')](function(_0x42653f){_0x328a08[_0xb814('0x41')]=_0x42653f;return _0x328a08;})[_0xb814('0x25')](respondWithFilteredResult(_0x1e4e89,_0x5a6291))[_0xb814('0x42')](handleError(_0x1e4e89,null));};exports[_0xb814('0x43')]=function(_0x4b6ff8,_0x544d36){var _0x5d26be={'raw':!![],'where':{'id':_0x4b6ff8['params']['id']}},_0x56d9d1={};_0x56d9d1[_0xb814('0x30')]=_['keys'](db[_0xb814('0x2c')][_0xb814('0x2d')]);_0x56d9d1[_0xb814('0x31')]=_[_0xb814('0x44')](_0x4b6ff8['query']);_0x56d9d1[_0xb814('0x3b')]=_[_0xb814('0x32')](_0x56d9d1[_0xb814('0x30')],_0x56d9d1[_0xb814('0x31')]);_0x5d26be[_0xb814('0x34')]=_[_0xb814('0x32')](_0x56d9d1['model'],qs[_0xb814('0x33')](_0x4b6ff8[_0xb814('0x31')][_0xb814('0x33')]));_0x5d26be[_0xb814('0x34')]=_0x5d26be[_0xb814('0x34')][_0xb814('0x35')]?_0x5d26be[_0xb814('0x34')]:_0x56d9d1['model'];if(_0x4b6ff8['query'][_0xb814('0x45')]){_0x5d26be[_0xb814('0x3f')]=[{'all':!![]}];}_0x5d26be=_[_0xb814('0x46')]({},_0x5d26be,_0x4b6ff8[_0xb814('0x47')]);return db[_0xb814('0x2c')][_0xb814('0x48')](_0x5d26be)[_0xb814('0x25')](handleEntityNotFound(_0x544d36,null))[_0xb814('0x25')](respondWithResult(_0x544d36,null))[_0xb814('0x42')](handleError(_0x544d36,null));};exports[_0xb814('0x49')]=function(_0xe73300,_0x5c7a49){return db[_0xb814('0x2c')][_0xb814('0x49')](_0xe73300['body'],{})[_0xb814('0x25')](respondWithResult(_0x5c7a49,0xc9))['catch'](handleError(_0x5c7a49,null));};exports[_0xb814('0x24')]=function(_0x37866f,_0xc71270){if(_0x37866f[_0xb814('0x4a')]['id']){delete _0x37866f[_0xb814('0x4a')]['id'];}return db[_0xb814('0x2c')][_0xb814('0x48')]({'where':{'id':_0x37866f[_0xb814('0x4b')]['id']}})[_0xb814('0x25')](handleEntityNotFound(_0xc71270,null))[_0xb814('0x25')](saveUpdates(_0x37866f['body'],null))['then'](respondWithResult(_0xc71270,null))[_0xb814('0x42')](handleError(_0xc71270,null));};exports[_0xb814('0x26')]=function(_0x4156d8,_0x3f8e29){return db[_0xb814('0x2c')][_0xb814('0x48')]({'where':{'id':_0x4156d8[_0xb814('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f8e29,null))[_0xb814('0x25')](removeEntity(_0x3f8e29,null))[_0xb814('0x42')](handleError(_0x3f8e29,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b59a5b2..4462672 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 _0x95e1=['../../config/environment','exports','whatsapp_applications','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x26eaed,_0x5aca19){var _0x228b93=function(_0x1c20af){while(--_0x1c20af){_0x26eaed['push'](_0x26eaed['shift']());}};_0x228b93(++_0x5aca19);}(_0x95e1,0x1c7));var _0x195e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x95e1[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x195e('0x0'));var util=require(_0x195e('0x1'));var logger=require('../../config/logger')(_0x195e('0x2'));var moment=require('moment');var BPromise=require(_0x195e('0x3'));var rp=require(_0x195e('0x4'));var fs=require('fs');var path=require(_0x195e('0x5'));var rimraf=require(_0x195e('0x6'));var config=require(_0x195e('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x195e('0x8')]=function(_0x245bc7,_0x5067e7){return _0x245bc7['define']('WhatsappApplication',attributes,{'tableName':_0x195e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x195e('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa1d1=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications'];(function(_0x3f4cdd,_0x4d5dec){var _0x1a9d8c=function(_0x5bf4ef){while(--_0x5bf4ef){_0x3f4cdd['push'](_0x3f4cdd['shift']());}};_0x1a9d8c(++_0x4d5dec);}(_0xa1d1,0x152));var _0x1a1d=function(_0x476224,_0x20ae98){_0x476224=_0x476224-0x0;var _0x5d3cc8=_0xa1d1[_0x476224];return _0x5d3cc8;};'use strict';var _=require(_0x1a1d('0x0'));var util=require(_0x1a1d('0x1'));var logger=require(_0x1a1d('0x2'))('api');var moment=require(_0x1a1d('0x3'));var BPromise=require(_0x1a1d('0x4'));var rp=require(_0x1a1d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a1d('0x6'));var config=require(_0x1a1d('0x7'));var attributes=require(_0x1a1d('0x8'));module[_0x1a1d('0x9')]=function(_0x1326b1,_0x2dcfd1){return _0x1326b1['define'](_0x1a1d('0xa'),attributes,{'tableName':_0x1a1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a1d('0xc'),'collate':_0x1a1d('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index cfdd3bd..a1efff1 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 _0x80c3=['message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s'];(function(_0x5098cc,_0x4b87cf){var _0x529660=function(_0x229203){while(--_0x229203){_0x5098cc['push'](_0x5098cc['shift']());}};_0x529660(++_0x4b87cf);}(_0x80c3,0x18f));var _0x380c=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x80c3[_0x238671];return _0x474844;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x332ed3,_0x395efa,_0x1cdbad){return new BPromise(function(_0x59445f,_0x1d853e){return client[_0x380c('0x6')](_0x332ed3,_0x1cdbad)['then'](function(_0xdd635d){logger[_0x380c('0x7')]('WhatsappApplication,\x20%s,\x20%s',_0x395efa,_0x380c('0x8'));logger[_0x380c('0x9')](_0x380c('0xa'),_0x395efa,'request\x20sent',JSON[_0x380c('0xb')](_0xdd635d));if(_0xdd635d[_0x380c('0xc')]){if(_0xdd635d[_0x380c('0xc')][_0x380c('0xd')]===0x1f4){logger[_0x380c('0xc')](_0x380c('0xe'),_0x395efa,_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);return _0x1d853e(_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);}logger['error'](_0x380c('0xe'),_0x395efa,_0xdd635d[_0x380c('0xc')]['message']);return _0x59445f(_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);}else{logger[_0x380c('0x7')](_0x380c('0xe'),_0x395efa,_0x380c('0x8'));_0x59445f(_0xdd635d[_0x380c('0x10')][_0x380c('0xf')]);}})[_0x380c('0x11')](function(_0x3022e6){logger['error'](_0x380c('0xe'),_0x395efa,_0x3022e6);_0x1d853e(_0x3022e6);});});} \ No newline at end of file +var _0x6379=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1e7c22,_0x485d2c){var _0x572ff7=function(_0x436cfe){while(--_0x436cfe){_0x1e7c22['push'](_0x1e7c22['shift']());}};_0x572ff7(++_0x485d2c);}(_0x6379,0x84));var _0x9637=function(_0x10371c,_0x4b83a2){_0x10371c=_0x10371c-0x0;var _0x57e601=_0x6379[_0x10371c];return _0x57e601;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var moment=require(_0x9637('0x2'));var BPromise=require(_0x9637('0x3'));var rs=require(_0x9637('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9637('0x5'))['db'];var utils=require(_0x9637('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9637('0x7'));var jayson=require(_0x9637('0x8'));var client=jayson[_0x9637('0x9')][_0x9637('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf0db9f,_0x5ce1a4,_0x515a84){return new BPromise(function(_0x21d91b,_0x42eda1){return client[_0x9637('0xb')](_0xf0db9f,_0x515a84)[_0x9637('0xc')](function(_0x5e66ee){logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));logger[_0x9637('0x10')](_0x9637('0x11'),_0x5ce1a4,_0x9637('0xf'),JSON[_0x9637('0x12')](_0x5e66ee));if(_0x5e66ee[_0x9637('0x13')]){if(_0x5e66ee[_0x9637('0x13')]['code']===0x1f4){logger[_0x9637('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x5ce1a4,_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);return _0x42eda1(_0x5e66ee['error'][_0x9637('0x14')]);}logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x5e66ee[_0x9637('0x13')]['message']);return _0x21d91b(_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);}else{logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));_0x21d91b(_0x5e66ee['result'][_0x9637('0x14')]);}})[_0x9637('0x15')](function(_0x1eb774){logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x1eb774);_0x42eda1(_0x1eb774);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 4ce911a..39bfee3 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 _0xfa3e=['util','path','connect-timeout','express','fs-extra','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','delete','whatsappinteraction:destroy','removeTags','exports','multer'];(function(_0x213cc1,_0x5d7eaf){var _0x4e638e=function(_0x15db55){while(--_0x15db55){_0x213cc1['push'](_0x213cc1['shift']());}};_0x4e638e(++_0x5d7eaf);}(_0xfa3e,0x194));var _0xefa3=function(_0x292d7c,_0x4c829c){_0x292d7c=_0x292d7c-0x0;var _0x10e57e=_0xfa3e[_0x292d7c];return _0x10e57e;};'use strict';var multer=require(_0xefa3('0x0'));var util=require(_0xefa3('0x1'));var path=require(_0xefa3('0x2'));var timeout=require(_0xefa3('0x3'));var express=require(_0xefa3('0x4'));var router=express['Router']();var fs_extra=require(_0xefa3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xefa3('0x6'));var controller=require(_0xefa3('0x7'));router[_0xefa3('0x8')]('/',auth[_0xefa3('0x9')](),controller[_0xefa3('0xa')]);router[_0xefa3('0x8')](_0xefa3('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xefa3('0x8')](_0xefa3('0xc'),auth[_0xefa3('0x9')](),controller[_0xefa3('0xd')]);router[_0xefa3('0x8')](_0xefa3('0xe'),auth[_0xefa3('0x9')](),controller['getMessages']);router[_0xefa3('0x8')](_0xefa3('0xf'),auth[_0xefa3('0x9')](),controller[_0xefa3('0x10')]);router[_0xefa3('0x11')]('/',auth[_0xefa3('0x9')](),controller['create']);router['post']('/:id/messages',auth[_0xefa3('0x9')](),controller['addMessage']);router['post'](_0xefa3('0x12'),auth[_0xefa3('0x9')](),interaction[_0xefa3('0x13')](_0xefa3('0x14'),_0xefa3('0x15')),controller['addTags']);router[_0xefa3('0x16')](_0xefa3('0xc'),auth[_0xefa3('0x9')](),interaction[_0xefa3('0x13')](_0xefa3('0x14'),'whatsappinteraction:update'),controller['update']);router[_0xefa3('0x17')](_0xefa3('0xc'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xefa3('0x18')),controller['destroy']);router[_0xefa3('0x17')](_0xefa3('0x12'),auth[_0xefa3('0x9')](),controller[_0xefa3('0x19')]);module[_0xefa3('0x1a')]=router; \ No newline at end of file +var _0x9c53=['removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9c53,0x81));var _0x39c5=function(_0x22867a,_0x3c902e){_0x22867a=_0x22867a-0x0;var _0x5e15eb=_0x9c53[_0x22867a];return _0x5e15eb;};'use strict';var multer=require(_0x39c5('0x0'));var util=require(_0x39c5('0x1'));var path=require(_0x39c5('0x2'));var timeout=require(_0x39c5('0x3'));var express=require(_0x39c5('0x4'));var router=express[_0x39c5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x39c5('0x6'));var interaction=require(_0x39c5('0x7'));var config=require(_0x39c5('0x8'));var controller=require(_0x39c5('0x9'));router[_0x39c5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x39c5('0xb'),auth[_0x39c5('0xc')](),controller[_0x39c5('0xd')]);router['get'](_0x39c5('0xe'),auth[_0x39c5('0xc')](),controller[_0x39c5('0xf')]);router[_0x39c5('0xa')](_0x39c5('0x10'),auth[_0x39c5('0xc')](),controller['getMessages']);router['get'](_0x39c5('0x11'),auth['isAuthenticated'](),controller['download']);router[_0x39c5('0x12')]('/',auth[_0x39c5('0xc')](),controller[_0x39c5('0x13')]);router[_0x39c5('0x12')]('/:id/messages',auth[_0x39c5('0xc')](),controller['addMessage']);router[_0x39c5('0x12')]('/:id/tags',auth[_0x39c5('0xc')](),interaction[_0x39c5('0x14')]('whatsapp',_0x39c5('0x15')),controller[_0x39c5('0x16')]);router[_0x39c5('0x17')](_0x39c5('0xe'),auth[_0x39c5('0xc')](),interaction[_0x39c5('0x14')](_0x39c5('0x18'),_0x39c5('0x19')),controller[_0x39c5('0x1a')]);router[_0x39c5('0x1b')](_0x39c5('0xe'),auth[_0x39c5('0xc')](),interaction[_0x39c5('0x14')](_0x39c5('0x18'),_0x39c5('0x1c')),controller[_0x39c5('0x1d')]);router[_0x39c5('0x1b')](_0x39c5('0x1e'),auth[_0x39c5('0xc')](),controller[_0x39c5('0x1f')]);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 275db04..43b46a4 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 _0x2c64=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x477905,_0x480628){var _0x2b76e8=function(_0x2bdb2d){while(--_0x2bdb2d){_0x477905['push'](_0x477905['shift']());}};_0x2b76e8(++_0x480628);}(_0x2c64,0x181));var _0x42c6=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x2c64[_0x1cb18a];return _0x22442e;};'use strict';var Sequelize=require(_0x42c6('0x0'));var moment=require(_0x42c6('0x1'));module['exports']={'closed':{'type':Sequelize[_0x42c6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x42c6('0x3')]},'disposition':{'type':Sequelize[_0x42c6('0x4')]},'secondDisposition':{'type':Sequelize[_0x42c6('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x42c6('0x4')]},'read1stAt':{'type':Sequelize[_0x42c6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x42c6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x42c6('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xcdb9=['BOOLEAN','STRING','out','ENUM','moment','exports'];(function(_0x4ca75a,_0xae467f){var _0x504ef3=function(_0x23716e){while(--_0x23716e){_0x4ca75a['push'](_0x4ca75a['shift']());}};_0x504ef3(++_0xae467f);}(_0xcdb9,0x82));var _0x9cdb=function(_0x262007,_0x22defe){_0x262007=_0x262007-0x0;var _0x1e419d=_0xcdb9[_0x262007];return _0x1e419d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9cdb('0x0'));module[_0x9cdb('0x1')]={'closed':{'type':Sequelize[_0x9cdb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9cdb('0x3')]},'secondDisposition':{'type':Sequelize[_0x9cdb('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9cdb('0x3')]},'note':{'type':Sequelize[_0x9cdb('0x3')]},'phone':{'type':Sequelize[_0x9cdb('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9cdb('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9cdb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 6157f5d..5d557f5 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 _0x9f0e=['Attachment','Messages','direction','secret','Account','Owner','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','union','User','operator','UserId','body','start','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','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','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','sequelize','count','toString','keyBy','merge','WhatsappInteraction','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','all','catch','params','fields','includeAll','include','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','WhatsappInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName'];(function(_0x41031d,_0x17a3ee){var _0x2606c8=function(_0x24b03a){while(--_0x24b03a){_0x41031d['push'](_0x41031d['shift']());}};_0x2606c8(++_0x17a3ee);}(_0x9f0e,0x116));var _0xe9f0=function(_0x26f643,_0x34e722){_0x26f643=_0x26f643-0x0;var _0xd802a2=_0x9f0e[_0x26f643];return _0xd802a2;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require(_0xe9f0('0x2'));var zipdir=require(_0xe9f0('0x3'));var jsonpatch=require(_0xe9f0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9f0('0x5'));var Mustache=require(_0xe9f0('0x6'));var util=require(_0xe9f0('0x7'));var path=require(_0xe9f0('0x8'));var sox=require(_0xe9f0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9f0('0xa'));var _=require(_0xe9f0('0xb'));var squel=require(_0xe9f0('0xc'));var crypto=require('crypto');var jsforce=require(_0xe9f0('0xd'));var deskjs=require(_0xe9f0('0xe'));var toCsv=require(_0xe9f0('0xf'));var querystring=require(_0xe9f0('0x10'));var Papa=require(_0xe9f0('0x11'));var Redis=require(_0xe9f0('0x12'));var authService=require(_0xe9f0('0x13'));var qs=require(_0xe9f0('0x14'));var as=require(_0xe9f0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9f0('0x16'))(_0xe9f0('0x17'));var utils=require(_0xe9f0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe9f0('0x19'));var db=require('../../mysqldb')['db'];config[_0xe9f0('0x1a')]=_[_0xe9f0('0x1b')](config[_0xe9f0('0x1a')],{'host':_0xe9f0('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe9f0('0x1a')]));require('./whatsappInteraction.socket')[_0xe9f0('0x1d')](socket);function respondWithStatusCode(_0x23914b,_0x3800e8){_0x3800e8=_0x3800e8||0xcc;return function(_0x59320d){if(_0x59320d){return _0x23914b[_0xe9f0('0x1e')](_0x3800e8);}return _0x23914b[_0xe9f0('0x1f')](_0x3800e8)[_0xe9f0('0x20')]();};}function respondWithResult(_0x598eee,_0xaa7aa6){_0xaa7aa6=_0xaa7aa6||0xc8;return function(_0x1e16e0){if(_0x1e16e0){return _0x598eee[_0xe9f0('0x1f')](_0xaa7aa6)[_0xe9f0('0x21')](_0x1e16e0);}};}function respondWithFilteredResult(_0x3ed69a,_0x2ab12b){return function(_0x3da237){if(_0x3da237){var _0x59bf5a=_0x3da237['count'],_0x15a33b=_0x2ab12b[_0xe9f0('0x22')],_0x19e090=_0x2ab12b[_0xe9f0('0x22')]+_0x2ab12b[_0xe9f0('0x23')],_0x232f2c;if(_0x19e090>=_0x59bf5a){_0x19e090=_0x59bf5a;_0x232f2c=0xc8;}else{_0x232f2c=0xce;}_0x3ed69a[_0xe9f0('0x1f')](_0x232f2c);return _0x3ed69a['set'](_0xe9f0('0x24'),_0x15a33b+'-'+_0x19e090+'/'+_0x59bf5a)[_0xe9f0('0x21')](_0x3da237);}return null;};}function patchUpdates(_0x583687){return function(_0x51e03f){try{jsonpatch['apply'](_0x51e03f,_0x583687,!![]);}catch(_0x12fe9f){return BPromise[_0xe9f0('0x25')](_0x12fe9f);}return _0x51e03f[_0xe9f0('0x26')]();};}function saveUpdates(_0x316cdf,_0x3ce106){return function(_0x4a5c27){if(_0x4a5c27){return _0x4a5c27[_0xe9f0('0x27')](_0x316cdf)[_0xe9f0('0x28')](function(_0x437d43){return _0x437d43;});}return null;};}function removeEntity(_0x10801b,_0x3ca991){return function(_0x372ffd){if(_0x372ffd){return _0x372ffd[_0xe9f0('0x29')]()[_0xe9f0('0x28')](function(){_0x10801b[_0xe9f0('0x1f')](0xcc)[_0xe9f0('0x20')]();});}};}function handleEntityNotFound(_0x48128a,_0x371095){return function(_0x27541f){if(!_0x27541f){_0x48128a[_0xe9f0('0x1e')](0x194);}return _0x27541f;};}function handleError(_0x1a8478,_0x4cf1b1){_0x4cf1b1=_0x4cf1b1||0x1f4;return function(_0x212a38){logger[_0xe9f0('0x2a')](_0x212a38[_0xe9f0('0x2b')]);if(_0x212a38[_0xe9f0('0x2c')]){delete _0x212a38[_0xe9f0('0x2c')];}_0x1a8478['status'](_0x4cf1b1)[_0xe9f0('0x2d')](_0x212a38);};}function getInteractionUsers(_0xdc16bc,_0x44fb5b){return new BPromise(function(_0xab3d81,_0xa27c84){try{if(_0x44fb5b[_0xdc16bc['id']]){_0xdc16bc[_0xe9f0('0x2e')]=_[_0xe9f0('0x2f')](_0x44fb5b[_0xdc16bc['id']],function(_0x2efd33){return{'id':_0x2efd33['id'],'fullname':_0x2efd33[_0xe9f0('0x30')]};});}}catch(_0x3dbe49){_0xa27c84(_0x3dbe49);}_0xab3d81(_0xdc16bc);});}function getInteractionTags(_0x22806c,_0x617ad3){return new BPromise(function(_0x445ad0,_0x2ab77d){try{if(_0x22806c[_0xe9f0('0x31')]){_0x22806c[_0xe9f0('0x32')]=[];_0x22806c[_0xe9f0('0x31')][_0xe9f0('0x33')](',')[_0xe9f0('0x34')](function(_0x19d799){_0x22806c[_0xe9f0('0x32')][_0xe9f0('0x35')](_0x617ad3[_0x19d799]);});}delete _0x22806c[_0xe9f0('0x31')];}catch(_0x3611c0){_0x2ab77d(_0x3611c0);}_0x445ad0(_0x22806c);});}function updateWhatsappInteraction(_0x5480ce,_0x49996c,_0x58d38b){return new BPromise(function(_0x191a39,_0x585742){return getInteractionUsers(_0x5480ce,_0x58d38b)[_0xe9f0('0x28')](function(_0xc5fa13){return getInteractionTags(_0xc5fa13,_0x49996c);})['then'](function(_0x285457){_0x191a39(_0x285457);})['catch'](function(_0x576a7a){_0x585742(_0x576a7a);});});}exports['index']=function(_0x165440,_0x39722b){var _0x5cd6ed={},_0x3becb9={},_0xb0cfc={'count':0x0,'rows':[]};var _0x1d4748=_['map'](db['WhatsappInteraction'][_0xe9f0('0x36')],function(_0x3ff42d){return{'name':_0x3ff42d[_0xe9f0('0x37')],'type':_0x3ff42d['type'][_0xe9f0('0x38')]};});_0x3becb9[_0xe9f0('0x39')]=_[_0xe9f0('0x2f')](_0x1d4748,_0xe9f0('0x2c'));_0x3becb9[_0xe9f0('0x3a')]=_['keys'](_0x165440[_0xe9f0('0x3a')]);_0x3becb9[_0xe9f0('0x3b')]=_[_0xe9f0('0x3c')](_0x3becb9['model'],_0x3becb9[_0xe9f0('0x3a')]);_0x5cd6ed[_0xe9f0('0x3d')]=_['intersection'](_0x3becb9[_0xe9f0('0x39')],qs['fields'](_0x165440[_0xe9f0('0x3a')]['fields']));_0x5cd6ed['attributes']=_0x5cd6ed['attributes']['length']?_0x5cd6ed['attributes']:_0x3becb9[_0xe9f0('0x39')];if(!_0x165440[_0xe9f0('0x3a')][_0xe9f0('0x3e')](_0xe9f0('0x3f'))){_0x5cd6ed[_0xe9f0('0x23')]=qs[_0xe9f0('0x23')](_0x165440[_0xe9f0('0x3a')][_0xe9f0('0x23')]);_0x5cd6ed[_0xe9f0('0x22')]=qs['offset'](_0x165440[_0xe9f0('0x3a')][_0xe9f0('0x22')]);}_0x5cd6ed[_0xe9f0('0x40')]=qs['sort'](_0x165440['query'][_0xe9f0('0x41')]);_0x5cd6ed['where']=qs[_0xe9f0('0x3b')](_[_0xe9f0('0x42')](_0x165440[_0xe9f0('0x3a')],_0x3becb9[_0xe9f0('0x3b')]),_0x1d4748);var _0x4f1663=[];var _0x123739=squel[_0xe9f0('0x43')]()[_0xe9f0('0x44')]('id')[_0xe9f0('0x44')](_0xe9f0('0x2c'))['field'](_0xe9f0('0x45'))[_0xe9f0('0x46')](_0xe9f0('0x47'));var _0x319380=squel[_0xe9f0('0x43')]()['field'](_0xe9f0('0x48'))['field']('u.fullname')[_0xe9f0('0x44')](_0xe9f0('0x49'))['from'](_0xe9f0('0x4a'),'ui')[_0xe9f0('0x4b')](_0xe9f0('0x4c'),'u',_0xe9f0('0x4d'));var _0xdf4173=squel[_0xe9f0('0x43')]()[_0xe9f0('0x46')]('whatsapp_interactions','i')[_0xe9f0('0x4b')]('cm_contacts','c',_0xe9f0('0x4e'))['left_join'](_0xe9f0('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xe9f0('0x4b')](_0xe9f0('0x4f'),'a',_0xe9f0('0x50'))['left_join'](_0xe9f0('0x51'),'me',_0xe9f0('0x52'))[_0xe9f0('0x4b')](_0xe9f0('0x53'),'it',_0xe9f0('0x54'))[_0xe9f0('0x4b')](_0xe9f0('0x47'),'t',_0xe9f0('0x55'));var _0x18fc2b=squel[_0xe9f0('0x56')]();var _0x108467=[];var _0x1325a2=squel['expr']();var _0x55e898;if(_0x165440[_0xe9f0('0x3a')][_0xe9f0('0x57')]){_0x55e898=as[_0xe9f0('0x58')](_0x165440['query'][_0xe9f0('0x57')]);var _0x4d8b2e=_0x55e898[_0xe9f0('0x59')];for(var _0x3c69c0=0x0;_0x3c69c0<_0x55e898[_0xe9f0('0x5a')][_0xe9f0('0x5b')];_0x3c69c0++){var _0x49fc70=_0x55e898[_0xe9f0('0x5a')][_0x3c69c0];var _0x3fa271='i';var _0x5163ea=_[_0xe9f0('0x5c')](_0x1d4748,[_0xe9f0('0x2c'),_0x49fc70[_0xe9f0('0x44')]]);if(!_0x5163ea){switch(_0x49fc70[_0xe9f0('0x44')]){case'unreadMessages':if(_0x49fc70[_0xe9f0('0x5d')]==0x1){_0xdf4173[_0xe9f0('0x5e')]('`'+_0x49fc70[_0xe9f0('0x44')]+_0xe9f0('0x5f'));}else{_0xdf4173[_0xe9f0('0x5e')]('`'+_0x49fc70[_0xe9f0('0x44')]+_0xe9f0('0x60'));}break;case _0xe9f0('0x61'):if(_0x49fc70['operator']===_0xe9f0('0x62')){if(_0x49fc70[_0xe9f0('0x5d')][_0xe9f0('0x33')]('\x20')[_0xe9f0('0x5b')]>0x1){_0x18fc2b[_0x4d8b2e](_0xe9f0('0x63'),qs[_0xe9f0('0x64')](_0x49fc70[_0xe9f0('0x5d')]),null);}else{var _0xec9b3c='%'+_0x49fc70[_0xe9f0('0x5d')]+'%';_0x18fc2b[_0x4d8b2e](_0xe9f0('0x65'),_0xec9b3c,_0xec9b3c,_0xec9b3c);}}else{_0x5163ea=_[_0xe9f0('0x5c')](_0x1d4748,[_0xe9f0('0x2c'),_0xe9f0('0x66')]);_0x49fc70[_0xe9f0('0x44')]='ContactId';_0x260927=as[_0xe9f0('0x67')](_0x3fa271,_0x5163ea[_0xe9f0('0x68')],_0x49fc70);_0x18fc2b[_0x4d8b2e](_0x260927[_0xe9f0('0x69')],_0x260927['value']['start'],_0x260927[_0xe9f0('0x5d')]['end']);}break;case _0xe9f0('0x6a'):var _0x31deaf=_0x49fc70[_0xe9f0('0x5d')]['split'](',')[_0xe9f0('0x2f')](function(_0x454b8a){return Number(_0x454b8a);});_0x31deaf[_0xe9f0('0x34')](function(_0x429743){_0x1325a2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x429743+',%');});_0x108467=_[_0xe9f0('0x6b')](_0x108467,_0x31deaf);break;case _0xe9f0('0x6c'):if(_0x49fc70[_0xe9f0('0x6d')]===_0xe9f0('0x62')){_0x18fc2b[_0x4d8b2e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x49fc70['value']+'%',null);}else{_0x5163ea=_[_0xe9f0('0x5c')](_0x1d4748,[_0xe9f0('0x2c'),_0xe9f0('0x6e')]);_0x49fc70[_0xe9f0('0x44')]=_0xe9f0('0x6e');_0x260927=as['buildExpression'](_0x3fa271,_0x5163ea[_0xe9f0('0x68')],_0x49fc70);_0x18fc2b[_0x4d8b2e](_0x260927['text'],_0x260927[_0xe9f0('0x5d')]['start'],_0x260927[_0xe9f0('0x5d')][_0xe9f0('0x20')]);}break;case _0xe9f0('0x6f'):_0x260927=as[_0xe9f0('0x67')]('me',null,_0x49fc70);_0x18fc2b[_0x4d8b2e](_0x260927[_0xe9f0('0x69')],_0x260927['value']['start'],_0x260927['value'][_0xe9f0('0x20')]);break;}}else{var _0x260927=as['buildExpression'](_0x3fa271,_0x5163ea[_0xe9f0('0x68')],_0x49fc70);_0x18fc2b[_0x4d8b2e](_0x260927['text'],_0x260927['value'][_0xe9f0('0x70')],_0x260927[_0xe9f0('0x5d')][_0xe9f0('0x20')]);}}}else{var _0x1dcb10=_(_0x165440[_0xe9f0('0x3a')])[_0xe9f0('0x71')]()['map'](function(_0x5e4ad4){return _[_0xe9f0('0x72')](_0x1d4748,[_0xe9f0('0x2c'),_0x5e4ad4])?_0x5e4ad4:undefined;})[_0xe9f0('0x73')]()[_0xe9f0('0x5d')]();if(!_['isEmpty'](_0x1dcb10)){_0x1dcb10[_0xe9f0('0x34')](function(_0x83dea9){if(_0x83dea9===_0xe9f0('0x74')){_0xdf4173[_0xe9f0('0x75')](_0xe9f0('0x76'),[][_0xe9f0('0x77')](_0x165440['query'][_0x83dea9]));}else if(_0x83dea9===_0xe9f0('0x78')){var _0x2b074a=JSON[_0xe9f0('0x79')](_0x165440[_0xe9f0('0x3a')][_0x83dea9])[_0xe9f0('0x7a')];var _0x588497=JSON[_0xe9f0('0x79')](_0x165440[_0xe9f0('0x3a')][_0x83dea9])[_0xe9f0('0x7b')];_0xdf4173[_0xe9f0('0x75')](_0xe9f0('0x7c'),_0x2b074a,_0x588497);}else{if(_0x165440[_0xe9f0('0x3a')][_0x83dea9]===_0xe9f0('0x7d')){_0xdf4173[_0xe9f0('0x75')]('i.'+_0x83dea9+_0xe9f0('0x7e'));}else{_0xdf4173[_0xe9f0('0x75')]('i.'+_0x83dea9+_0xe9f0('0x7f'),_0x165440[_0xe9f0('0x3a')][_0x83dea9]);}}});}if(_0x165440['query'][_0xe9f0('0x80')]){if(_0x165440[_0xe9f0('0x3a')][_0xe9f0('0x80')]==0x1){_0xdf4173[_0xe9f0('0x5e')](_0xe9f0('0x81'));}else{_0xdf4173[_0xe9f0('0x5e')](_0xe9f0('0x82'));}}if(_0x165440['query'][_0xe9f0('0x83')]){_0x108467=_[_0xe9f0('0x84')](_0x165440['query'][_0xe9f0('0x83')])?_0x165440[_0xe9f0('0x3a')][_0xe9f0('0x83')]:new Array(_0x165440['query'][_0xe9f0('0x83')]);_0x108467[_0xe9f0('0x34')](function(_0x59821c){_0x1325a2['or'](_0xe9f0('0x85'),'%,'+_0x59821c+',%');});}if(_0x165440[_0xe9f0('0x3a')]['filter']){var _0x5df2cf=_0x165440[_0xe9f0('0x3a')]['filter'][_0xe9f0('0x86')]('\x5c','\x5c\x5c')[_0xe9f0('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5df2cf)){_0x18fc2b['or'](_0xe9f0('0x87'),_0x5df2cf+'%')['or'](_0xe9f0('0x88'),_0x5df2cf+'%');}else{_0x18fc2b['or'](_0xe9f0('0x89'),qs[_0xe9f0('0x64')](_0x5df2cf))['or'](_0xe9f0('0x8a'),_0x5df2cf+'%');}}}_0xdf4173[_0xe9f0('0x75')](_0x18fc2b);_0xdf4173[_0xe9f0('0x8b')](_0xe9f0('0x8c'));var _0x594421={'type':db['Sequelize'][_0xe9f0('0x8d')][_0xe9f0('0x8e')],'raw':!![]};var _0xe7fdb=_0xdf4173[_0xe9f0('0x8f')]();_0xe7fdb[_0xe9f0('0x44')](_0xe9f0('0x8c'));_0xe7fdb[_0xe9f0('0x44')](_0xe9f0('0x90'),'unreadMessages');if(_0x5cd6ed[_0xe9f0('0x40')]){_0x5cd6ed[_0xe9f0('0x40')][_0xe9f0('0x34')](function(_0x3768b9){var _0x35c16a=_0x3768b9[0x0]===_0xe9f0('0x91')?_0x3768b9[0x0]:'i.'+_0x3768b9[0x0];_0xdf4173['order'](_0x35c16a,_0x3768b9[0x1]===_0xe9f0('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x108467)){_0xdf4173['having'](_0x1325a2);_0xe7fdb['where'](_0xe9f0('0x93'),_0x108467);}BPromise[_0xe9f0('0x94')]()[_0xe9f0('0x28')](function(){if(!_0x55e898){if(_0x165440[_0xe9f0('0x3a')][_0xe9f0('0x74')])return;_0xe7fdb[_0xe9f0('0x75')](_0xe9f0('0x95'));_0xdf4173[_0xe9f0('0x75')](_0xe9f0('0x95'));return;}if(_0x165440['user'][_0xe9f0('0x96')]!==_0xe9f0('0x97'))return;return _0x165440[_0xe9f0('0x98')][_0xe9f0('0x99')]({'attributes':['id'],'raw':!![]})[_0xe9f0('0x28')](function(_0x15aef7){if(_[_0xe9f0('0x9a')](_0x15aef7)){_0xe7fdb[_0xe9f0('0x75')](_0xe9f0('0x9b'));_0xdf4173[_0xe9f0('0x75')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0xe7fdb['where'](_0xe9f0('0x76'),_[_0xe9f0('0x2f')](_0x15aef7,'id'));_0xdf4173[_0xe9f0('0x75')](_0xe9f0('0x76'),_[_0xe9f0('0x2f')](_0x15aef7,'id'));}});})[_0xe9f0('0x28')](function(){if(_0x165440[_0xe9f0('0x98')][_0xe9f0('0x96')]==='agent'&&!_0x55e898&&!_0x165440['query'][_0xe9f0('0x74')])return[];return db[_0xe9f0('0x9c')]['query'](_0xe7fdb['toString'](),_0x594421);})[_0xe9f0('0x28')](function(_0x145040){_0xb0cfc[_0xe9f0('0x9d')]=_0x145040[_0xe9f0('0x5b')];if(_0xb0cfc[_0xe9f0('0x9d')]===0x0)return[];return db['sequelize'][_0xe9f0('0x3a')](_0x123739[_0xe9f0('0x9e')](),_0x594421)[_0xe9f0('0x28')](function(_0x13b25d){_0x4f1663=_[_0xe9f0('0x9f')](_0x13b25d,'id');_0x594421=_[_0xe9f0('0xa0')](_0x594421,{'model':db[_0xe9f0('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x165440['query']['fields']){_0x5cd6ed['attributes'][_0xe9f0('0x34')](function(_0x3c95f4){_0xdf4173[_0xe9f0('0x44')]('i.'+_0x3c95f4);});}else{_0xdf4173[_0xe9f0('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe9f0('0xa2'));_0xdf4173['field'](_0xe9f0('0xa3'),'Account.key');_0xdf4173[_0xe9f0('0x44')](_0xe9f0('0xa4'),_0xe9f0('0xa5'));_0xdf4173[_0xe9f0('0x44')](_0xe9f0('0xa6'),_0xe9f0('0x91'));_0xdf4173['field'](_0xe9f0('0xa7'));_0xdf4173[_0xe9f0('0x44')](_0xe9f0('0xa8'),_0xe9f0('0xa9'));_0xdf4173[_0xe9f0('0x44')]('c.lastName',_0xe9f0('0xaa'));_0xdf4173[_0xe9f0('0x44')]('c.email',_0xe9f0('0xab'));_0xdf4173['field'](_0xe9f0('0xac'),_0xe9f0('0xad'));_0xdf4173[_0xe9f0('0x44')]('c.mobile',_0xe9f0('0xae'));_0xdf4173[_0xe9f0('0x44')](_0xe9f0('0xaf'),'Contact.fax');_0xdf4173[_0xe9f0('0x44')](_0xe9f0('0xb0'),_0xe9f0('0xb1'));_0xdf4173[_0xe9f0('0x44')](_0xe9f0('0xb2'),_0xe9f0('0xb3'));_0xdf4173[_0xe9f0('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5cd6ed[_0xe9f0('0x23')])_0xdf4173[_0xe9f0('0x23')](_0x5cd6ed[_0xe9f0('0x23')]);if(_0x5cd6ed['offset'])_0xdf4173[_0xe9f0('0x22')](_0x5cd6ed[_0xe9f0('0x22')]);return db[_0xe9f0('0x9c')][_0xe9f0('0x3a')](_0xdf4173['toString'](),_0x594421);})['then'](function(_0x20436f){_0x319380[_0xe9f0('0x75')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xe9f0('0x2f')](_0x20436f,'id'));return db['sequelize']['query'](_0x319380[_0xe9f0('0x9e')](),_0x594421)[_0xe9f0('0x28')](function(_0x77b59d){var _0x32ad0e=_[_0xe9f0('0xb4')](_0x77b59d,'WhatsappInteractionId');var _0x5761d3=[];_0x20436f[_0xe9f0('0x34')](function(_0x41c1a9){_0x5761d3[_0xe9f0('0x35')](updateWhatsappInteraction(_0x41c1a9,_0x4f1663,_0x32ad0e));});return BPromise[_0xe9f0('0xb5')](_0x5761d3);});});})[_0xe9f0('0x28')](function(_0x5cf4ff){_0xb0cfc['rows']=_0x5cf4ff;return _0xb0cfc;})['then'](respondWithFilteredResult(_0x39722b,_0x5cd6ed))[_0xe9f0('0xb6')](handleError(_0x39722b,null));};exports['show']=function(_0x4223bd,_0x191005){var _0x182a51={'raw':![],'where':{'id':_0x4223bd[_0xe9f0('0xb7')]['id']}},_0x358ade={};_0x358ade[_0xe9f0('0x39')]=_['keys'](db['WhatsappInteraction'][_0xe9f0('0x36')]);_0x358ade[_0xe9f0('0x3a')]=_[_0xe9f0('0x71')](_0x4223bd[_0xe9f0('0x3a')]);_0x358ade[_0xe9f0('0x3b')]=_[_0xe9f0('0x3c')](_0x358ade[_0xe9f0('0x39')],_0x358ade[_0xe9f0('0x3a')]);_0x182a51[_0xe9f0('0x3d')]=_[_0xe9f0('0x3c')](_0x358ade[_0xe9f0('0x39')],qs[_0xe9f0('0xb8')](_0x4223bd[_0xe9f0('0x3a')][_0xe9f0('0xb8')]));_0x182a51['attributes']=_0x182a51[_0xe9f0('0x3d')][_0xe9f0('0x5b')]?_0x182a51[_0xe9f0('0x3d')]:_0x358ade[_0xe9f0('0x39')];if(_0x4223bd[_0xe9f0('0x3a')][_0xe9f0('0xb9')]){_0x182a51[_0xe9f0('0xba')]=[{'all':!![]}];}_0x182a51=_[_0xe9f0('0xa0')]({},_0x182a51,_0x4223bd[_0xe9f0('0xbb')]);return db[_0xe9f0('0xa1')][_0xe9f0('0x5c')](_0x182a51)['then'](handleEntityNotFound(_0x191005,null))[_0xe9f0('0x28')](respondWithResult(_0x191005,null))[_0xe9f0('0xb6')](handleError(_0x191005,null));};exports[_0xe9f0('0xbc')]=function(_0x2af661,_0x1ff995){return db[_0xe9f0('0xa1')][_0xe9f0('0xbc')](_0x2af661[_0xe9f0('0x6f')],{})['then'](respondWithResult(_0x1ff995,0xc9))['catch'](handleError(_0x1ff995,null));};exports[_0xe9f0('0x27')]=function(_0x294cd4,_0x4e7f22){if(_0x294cd4['body']['id']){delete _0x294cd4[_0xe9f0('0x6f')]['id'];}return db[_0xe9f0('0xa1')][_0xe9f0('0x5c')]({'where':{'id':_0x294cd4[_0xe9f0('0xb7')]['id']}})[_0xe9f0('0x28')](handleEntityNotFound(_0x4e7f22,null))[_0xe9f0('0x28')](saveUpdates(_0x294cd4['body'],null))[_0xe9f0('0x28')](respondWithResult(_0x4e7f22,null))[_0xe9f0('0xb6')](handleError(_0x4e7f22,null));};exports['destroy']=function(_0x4d59c0,_0x425119){return db[_0xe9f0('0xa1')]['find']({'where':{'id':_0x4d59c0[_0xe9f0('0xb7')]['id']}})[_0xe9f0('0x28')](handleEntityNotFound(_0x425119,null))[_0xe9f0('0x28')](removeEntity(_0x425119,null))['catch'](handleError(_0x425119,null));};exports[_0xe9f0('0xbd')]=function(_0x1105aa,_0x2a607b){return db[_0xe9f0('0xa1')]['describe']()[_0xe9f0('0x28')](respondWithResult(_0x2a607b,null))[_0xe9f0('0xb6')](handleError(_0x2a607b,null));};exports[_0xe9f0('0xbe')]=function(_0x561efe,_0x53c989,_0x5df737){return db[_0xe9f0('0xbf')]['find']({'where':{'id':_0x561efe['params']['id']}})[_0xe9f0('0x28')](handleEntityNotFound(_0x53c989,null))['then'](function(_0x1b2532){if(_0x1b2532){return _0x1b2532[_0xe9f0('0xbe')](_0x561efe[_0xe9f0('0x6f')][_0xe9f0('0xc0')],_['omit'](_0x561efe[_0xe9f0('0x6f')],[_0xe9f0('0xc0'),'id'])||{});}})[_0xe9f0('0x28')](respondWithResult(_0x53c989,null))[_0xe9f0('0xb6')](handleError(_0x53c989,null));};exports[_0xe9f0('0xc1')]=function(_0x25c2f6,_0x46d412,_0x3c2431){var _0x3434d7={'raw':![],'where':{}};var _0x2cd0a5={};var _0x31426f={'count':0x0,'rows':[]};return db[_0xe9f0('0xa1')][_0xe9f0('0xc2')]({'where':{'id':_0x25c2f6['params']['id']}})[_0xe9f0('0x28')](handleEntityNotFound(_0x46d412,null))[_0xe9f0('0x28')](function(_0x4933c2){if(_0x4933c2){_0x2cd0a5['model']=_[_0xe9f0('0x71')](db[_0xe9f0('0xbf')][_0xe9f0('0x36')]);_0x2cd0a5[_0xe9f0('0x3a')]=_['keys'](_0x25c2f6[_0xe9f0('0x3a')]);_0x2cd0a5[_0xe9f0('0x3b')]=_[_0xe9f0('0x3c')](_0x2cd0a5['model'],_0x2cd0a5[_0xe9f0('0x3a')]);_0x3434d7[_0xe9f0('0x3d')]=_[_0xe9f0('0x3c')](_0x2cd0a5[_0xe9f0('0x39')],qs[_0xe9f0('0xb8')](_0x25c2f6['query']['fields']));_0x3434d7[_0xe9f0('0x3d')]=_0x3434d7[_0xe9f0('0x3d')][_0xe9f0('0x5b')]?_0x3434d7[_0xe9f0('0x3d')]:_0x2cd0a5[_0xe9f0('0x39')];if(!_0x25c2f6[_0xe9f0('0x3a')][_0xe9f0('0x3e')](_0xe9f0('0x3f'))){_0x3434d7['limit']=qs[_0xe9f0('0x23')](_0x25c2f6['query']['limit']);_0x3434d7[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x25c2f6[_0xe9f0('0x3a')]['offset']);}_0x3434d7[_0xe9f0('0x40')]=qs[_0xe9f0('0x41')](_0x25c2f6['query'][_0xe9f0('0x41')]);_0x3434d7[_0xe9f0('0x75')]=qs[_0xe9f0('0x3b')](_[_0xe9f0('0x42')](_0x25c2f6['query'],_0x2cd0a5[_0xe9f0('0x3b')]));_0x3434d7['where'][_0xe9f0('0xc3')]=_0x4933c2['id'];if(_0x25c2f6['query']['filter']){_0x3434d7['where']=_[_0xe9f0('0xa0')](_0x3434d7[_0xe9f0('0x75')],{'$or':_['map'](_0x3434d7[_0xe9f0('0x3d')],function(_0x165624){var _0x250bfe={};_0x250bfe[_0x165624]={'$like':'%'+_0x25c2f6[_0xe9f0('0x3a')][_0xe9f0('0xc4')]+'%'};return _0x250bfe;})});}if(_0x25c2f6[_0xe9f0('0x3a')][_0xe9f0('0x7a')]){var _0x5ab78c=_0x25c2f6[_0xe9f0('0x3a')][_0xe9f0('0x7a')][_0xe9f0('0x33')](',');var _0x4f542d={};_0x4f542d[_0x5ab78c[0x0]]={'$gte':moment(_0x5ab78c[0x1])[_0xe9f0('0xc5')](_0xe9f0('0xc6'))};_0x3434d7[_0xe9f0('0x75')]=_['merge'](_0x3434d7[_0xe9f0('0x75')],_0x4f542d);}_0x3434d7=_[_0xe9f0('0xa0')]({},_0x3434d7,_0x25c2f6['options']);return db[_0xe9f0('0xbf')]['count']({'where':_0x3434d7[_0xe9f0('0x75')]})[_0xe9f0('0x28')](function(_0x22c0ec){_0x31426f[_0xe9f0('0x9d')]=_0x22c0ec;if(_0x25c2f6[_0xe9f0('0x3a')][_0xe9f0('0xb9')]){_0x3434d7['include']=[{'all':!![]}];}return db[_0xe9f0('0xbf')][_0xe9f0('0xc7')](_0x3434d7);})[_0xe9f0('0x28')](function(_0x1684a7){_0x31426f[_0xe9f0('0xc8')]=_0x1684a7;return _0x31426f;});}})[_0xe9f0('0x28')](respondWithFilteredResult(_0x46d412,_0x3434d7))[_0xe9f0('0xb6')](handleError(_0x46d412,null));};exports['addTags']=function(_0x5b9074,_0x447417,_0x3e8745){return db['WhatsappInteraction'][_0xe9f0('0x5c')]({'where':{'id':_0x5b9074['params']['id']}})[_0xe9f0('0x28')](handleEntityNotFound(_0x447417,null))[_0xe9f0('0x28')](function(_0x557b90){if(_0x557b90){return _0x557b90['setTags'](_0x5b9074[_0xe9f0('0x6f')][_0xe9f0('0xc0')],_[_0xe9f0('0xc9')](_0x5b9074['body'],['ids','id'])||{})[_0xe9f0('0xca')](function(){return db[_0xe9f0('0x6a')][_0xe9f0('0xc7')]({'attributes':['id',_0xe9f0('0x2c'),_0xe9f0('0x45')],'where':{'id':_0x5b9074[_0xe9f0('0x6f')][_0xe9f0('0xc0')]}});})[_0xe9f0('0x28')](function(_0x2f65a6){socket[_0xe9f0('0xcb')](_0xe9f0('0xcc'),{'id':Number(_0x5b9074[_0xe9f0('0xb7')]['id']),'tags':_0x2f65a6||[]});return{'id':Number(_0x5b9074[_0xe9f0('0xb7')]['id']),'tags':_0x2f65a6||[]};});}})[_0xe9f0('0x28')](respondWithResult(_0x447417,null))['catch'](handleError(_0x447417,null));};exports[_0xe9f0('0xcd')]=function(_0x57b4c8,_0x88a06a,_0x229e28){return db[_0xe9f0('0xa1')][_0xe9f0('0x5c')]({'where':{'id':_0x57b4c8[_0xe9f0('0xb7')]['id']}})[_0xe9f0('0x28')](handleEntityNotFound(_0x88a06a,null))[_0xe9f0('0x28')](function(_0x114c65){if(_0x114c65){return _0x114c65['removeTags'](_0x57b4c8[_0xe9f0('0x3a')][_0xe9f0('0xc0')]);}})[_0xe9f0('0x28')](respondWithStatusCode(_0x88a06a,null))[_0xe9f0('0xb6')](handleError(_0x88a06a,null));};exports[_0xe9f0('0xce')]=function(_0x2a18bf,_0x1095d8){var _0x59a75c=moment()[_0xe9f0('0xcf')]()[_0xe9f0('0x9e')]();var _0x896068=path[_0xe9f0('0xd0')](config[_0xe9f0('0xd1')],_0xe9f0('0xd2'),_0xe9f0('0xd3'),_0xe9f0('0xd4'));var _0x59f266=path[_0xe9f0('0xd0')](config[_0xe9f0('0xd1')],'server',_0xe9f0('0xd3'),_0xe9f0('0xd5'));var _0x2df2e3=path[_0xe9f0('0xd0')](_0x896068,_0x59a75c);var _0x5c34fa=util[_0xe9f0('0xc5')](_0xe9f0('0xd6'),_0x2a18bf[_0xe9f0('0xb7')]['id'],_0x59a75c);var _0x3c970a=path['join'](_0x896068,_0x5c34fa);var _0x23269b=[];_0x23269b['push']({'model':db['User'],'as':_0xe9f0('0x6c'),'attributes':['id','fullname'],'raw':!![]});_0x23269b['push']({'model':db[_0xe9f0('0xd7')],'as':_0xe9f0('0x61'),'attributes':['id',_0xe9f0('0xd8'),_0xe9f0('0xd9')],'raw':!![]});if(_0x2a18bf[_0xe9f0('0x3a')]['attachments']){_0x23269b[_0xe9f0('0x35')]({'model':db[_0xe9f0('0xda')],'as':'Attachment','raw':!![]});}var _0x39522a=[{'model':db[_0xe9f0('0xbf')],'as':_0xe9f0('0xdb'),'attributes':['id',_0xe9f0('0x6f'),_0xe9f0('0x78'),_0xe9f0('0xdc'),_0xe9f0('0xdd'),_0xe9f0('0x80')],'include':_0x23269b}];_0x39522a[_0xe9f0('0x35')]({'model':db['WhatsappAccount'],'as':_0xe9f0('0xde'),'attributes':['id',_0xe9f0('0x2c')]});_0x39522a['push']({'model':db[_0xe9f0('0x6c')],'as':_0xe9f0('0xdf'),'attributes':['id',_0xe9f0('0x30')]});return db[_0xe9f0('0xa1')][_0xe9f0('0x5c')]({'where':{'id':_0x2a18bf['params']['id']},'include':_0x39522a})['then'](handleEntityNotFound(_0x1095d8,null))[_0xe9f0('0x28')](function(_0x720ae8){if(_0x720ae8){var _0x212ab5=_0x720ae8['get']({'plain':!![]});fs[_0xe9f0('0xe0')](_0x2df2e3);var _0x2420ef={'format':'A4','border':_0xe9f0('0xe1'),'header':{'height':_0xe9f0('0xe2'),'contents':{'first':_0xe9f0('0xe3')}},'footer':{'height':_0xe9f0('0xe4'),'contents':{'default':util[_0xe9f0('0xc5')](_0xe9f0('0xe5'),util[_0xe9f0('0xc5')](_0xe9f0('0xe6'),_0xe9f0('0xe7'),_0x212ab5['id']),moment()[_0xe9f0('0xc5')](_0xe9f0('0xe8'))[_0xe9f0('0x9e')]())}}};var _0x2151c4={'channel':_0xe9f0('0xe7'),'account':_0x212ab5[_0xe9f0('0xde')]['name'],'agent':_0x212ab5[_0xe9f0('0xdf')]?_0x212ab5[_0xe9f0('0xdf')][_0xe9f0('0x30')]:'N.A.','createdAt':moment(_0x212ab5[_0xe9f0('0x78')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe9f0('0x9e')](),'closedAt':_0x212ab5['closed']?moment(_0x212ab5[_0xe9f0('0xe9')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe9f0('0x9e')]():'','disposition':_0x212ab5[_0xe9f0('0xea')],'messages':_(_0x212ab5[_0xe9f0('0xdb')])['filter']({'secret':![]})[_0xe9f0('0x2f')](function(_0x23c8a8){if(_0x23c8a8[_0xe9f0('0xda')]){var _0x291c68=path[_0xe9f0('0xd0')](_0x59f266,_0x23c8a8[_0xe9f0('0xda')][_0xe9f0('0xeb')]);if(fs[_0xe9f0('0xec')](_0x291c68)){fs[_0xe9f0('0xed')](_0x291c68)[_0xe9f0('0xee')](fs[_0xe9f0('0xef')](path[_0xe9f0('0xd0')](_0x2df2e3,_0x23c8a8[_0xe9f0('0xda')][_0xe9f0('0xeb')])));}}return{'date':moment(_0x23c8a8['createdAt'])[_0xe9f0('0xc5')](_0xe9f0('0xc6'))[_0xe9f0('0x9e')](),'sender':_0x23c8a8[_0xe9f0('0xdc')]===_0xe9f0('0xf0')?_0x23c8a8[_0xe9f0('0x6c')]?_0x23c8a8[_0xe9f0('0x6c')][_0xe9f0('0x30')]:'System':_0x23c8a8[_0xe9f0('0x61')]['firstName']+(_0x23c8a8[_0xe9f0('0x61')][_0xe9f0('0xd9')]?'\x20'+_0x23c8a8[_0xe9f0('0x61')][_0xe9f0('0xd9')]:''),'body':_0x23c8a8[_0xe9f0('0xda')]?_0x23c8a8[_0xe9f0('0xda')][_0xe9f0('0xeb')]:_0x23c8a8['body'],'direction':_0x23c8a8[_0xe9f0('0xdc')]==='out'?'A':'C','secret':_0x23c8a8[_0xe9f0('0xdd')],'read':_0x23c8a8[_0xe9f0('0x80')],'attachment':_0x23c8a8['Attachment']};})['value']()};return ejs[_0xe9f0('0xf1')](path[_0xe9f0('0xd0')](config[_0xe9f0('0xd1')],_0xe9f0('0xd2'),_0xe9f0('0xf2'),_0xe9f0('0xf3')),{'interaction':_0x2151c4})[_0xe9f0('0x28')](function(_0x2763d8){return new BPromise(function(_0x408608,_0xba1abf){pdf[_0xe9f0('0xbc')](_0x2763d8,_0x2420ef)[_0xe9f0('0xf4')](path[_0xe9f0('0xd0')](_0x2df2e3,'transcript-'+_0x212ab5['id']+'-'+_0x59a75c+_0xe9f0('0xf5')),function(_0x546e35,_0x51ef23){if(_0x546e35)return _0xba1abf(_0x546e35);_0x408608(_0x51ef23);});});})[_0xe9f0('0x28')](function(){return new BPromise(function(_0x7b7dde,_0x2d547f){zipdir(_0x2df2e3,{'saveTo':_0x3c970a},function(_0x2e798d,_0x56518d){if(_0x2e798d)return _0x2d547f(_0x2e798d);return _0x7b7dde(_0x56518d);});})[_0xe9f0('0x28')](function(){return new BPromise(function(_0x1a3475,_0x29d853){rimraf(_0x2df2e3,function(_0x1e337d){if(_0x1e337d)_0x29d853(_0x1e337d);return _0x1a3475();});});})[_0xe9f0('0x28')](function(){return _0x1095d8['download'](_0x3c970a,_0x5c34fa,function(_0x32cd68){if(_0x32cd68){console[_0xe9f0('0xf6')]('err',_0x32cd68);}else{fs[_0xe9f0('0xf7')](_0x3c970a);}});});});}else{return _0x1095d8['sendStatus'](0xc8);}})[_0xe9f0('0xb6')](handleError(_0x1095d8,null));}; \ No newline at end of file +var _0xc6ac=['resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','push','all','rows','catch','includeAll','include','options','create','describe','addMessage','WhatsappMessage','omit','getMessages','findOne','rawAttributes','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','params','setTags','ids','spread','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','Attachment','direction','secret','WhatsappAccount','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','Whatsapp','YYYY-MM-DD','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','pipe','createWriteStream','out','System','lastName','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','./whatsappInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','index','WhatsappInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','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)','ContactId','buildExpression','text','start','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','DESC','t.id\x20IN\x20?'];(function(_0x13a0c2,_0x5dbebd){var _0x1bef6a=function(_0x407b9f){while(--_0x407b9f){_0x13a0c2['push'](_0x13a0c2['shift']());}};_0x1bef6a(++_0x5dbebd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x70a382,_0x5d4eca){_0x70a382=_0x70a382-0x0;var _0x3340ae=_0xc6ac[_0x70a382];return _0x3340ae;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc6a('0xe'));var squel=require(_0xcc6a('0xf'));var crypto=require(_0xcc6a('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xcc6a('0x11'));var toCsv=require(_0xcc6a('0xc'));var querystring=require(_0xcc6a('0x12'));var Papa=require(_0xcc6a('0x13'));var Redis=require(_0xcc6a('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xcc6a('0x15'));var as=require(_0xcc6a('0x16'));var hardwareService=require(_0xcc6a('0x17'));var logger=require('../../config/logger')(_0xcc6a('0x18'));var utils=require(_0xcc6a('0x19'));var config=require(_0xcc6a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xcc6a('0x1b')]=_[_0xcc6a('0x1c')](config[_0xcc6a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc6a('0x1b')]));require(_0xcc6a('0x1d'))[_0xcc6a('0x1e')](socket);function respondWithStatusCode(_0x348af7,_0x96f9de){_0x96f9de=_0x96f9de||0xcc;return function(_0x337ec5){if(_0x337ec5){return _0x348af7[_0xcc6a('0x1f')](_0x96f9de);}return _0x348af7[_0xcc6a('0x20')](_0x96f9de)['end']();};}function respondWithResult(_0x4e628f,_0x4d021a){_0x4d021a=_0x4d021a||0xc8;return function(_0x395a55){if(_0x395a55){return _0x4e628f[_0xcc6a('0x20')](_0x4d021a)[_0xcc6a('0x21')](_0x395a55);}};}function respondWithFilteredResult(_0x3e63d9,_0x33079c){return function(_0x12ef33){if(_0x12ef33){var _0x2d9585=_0x12ef33[_0xcc6a('0x22')],_0x412bc7=_0x33079c['offset'],_0x374e51=_0x33079c[_0xcc6a('0x23')]+_0x33079c[_0xcc6a('0x24')],_0x2a3994;if(_0x374e51>=_0x2d9585){_0x374e51=_0x2d9585;_0x2a3994=0xc8;}else{_0x2a3994=0xce;}_0x3e63d9[_0xcc6a('0x20')](_0x2a3994);return _0x3e63d9[_0xcc6a('0x25')](_0xcc6a('0x26'),_0x412bc7+'-'+_0x374e51+'/'+_0x2d9585)[_0xcc6a('0x21')](_0x12ef33);}return null;};}function patchUpdates(_0x36c80f){return function(_0x43f510){try{jsonpatch[_0xcc6a('0x27')](_0x43f510,_0x36c80f,!![]);}catch(_0x19d32c){return BPromise[_0xcc6a('0x28')](_0x19d32c);}return _0x43f510[_0xcc6a('0x29')]();};}function saveUpdates(_0x51be9a,_0x41c4c8){return function(_0x3a081e){if(_0x3a081e){return _0x3a081e[_0xcc6a('0x2a')](_0x51be9a)['then'](function(_0x10016a){return _0x10016a;});}return null;};}function removeEntity(_0x294486,_0x3a00e5){return function(_0x3ed7ce){if(_0x3ed7ce){return _0x3ed7ce[_0xcc6a('0x2b')]()[_0xcc6a('0x2c')](function(){_0x294486['status'](0xcc)[_0xcc6a('0x2d')]();});}};}function handleEntityNotFound(_0x29d8be,_0x3514f3){return function(_0x5f27e5){if(!_0x5f27e5){_0x29d8be[_0xcc6a('0x1f')](0x194);}return _0x5f27e5;};}function handleError(_0x3dad72,_0x4da301){_0x4da301=_0x4da301||0x1f4;return function(_0xb377de){logger[_0xcc6a('0x2e')](_0xb377de[_0xcc6a('0x2f')]);if(_0xb377de[_0xcc6a('0x30')]){delete _0xb377de['name'];}_0x3dad72[_0xcc6a('0x20')](_0x4da301)[_0xcc6a('0x31')](_0xb377de);};}function getInteractionUsers(_0x2c6d88,_0x4f176b){return new BPromise(function(_0x2590a2,_0x5308d4){try{if(_0x4f176b[_0x2c6d88['id']]){_0x2c6d88['Users']=_[_0xcc6a('0x32')](_0x4f176b[_0x2c6d88['id']],function(_0x2e9f41){return{'id':_0x2e9f41['id'],'fullname':_0x2e9f41[_0xcc6a('0x33')]};});}}catch(_0x11b481){_0x5308d4(_0x11b481);}_0x2590a2(_0x2c6d88);});}function getInteractionTags(_0x2b575d,_0x131138){return new BPromise(function(_0x4e2de4,_0x7b2b54){try{if(_0x2b575d[_0xcc6a('0x34')]){_0x2b575d[_0xcc6a('0x35')]=[];_0x2b575d[_0xcc6a('0x34')][_0xcc6a('0x36')](',')[_0xcc6a('0x37')](function(_0x2030a6){_0x2b575d[_0xcc6a('0x35')]['push'](_0x131138[_0x2030a6]);});}delete _0x2b575d[_0xcc6a('0x34')];}catch(_0xc8c90c){_0x7b2b54(_0xc8c90c);}_0x4e2de4(_0x2b575d);});}function updateWhatsappInteraction(_0x3769b2,_0x1538bc,_0x30d6e1){return new BPromise(function(_0x711a58,_0x28b16e){return getInteractionUsers(_0x3769b2,_0x30d6e1)['then'](function(_0x5d2287){return getInteractionTags(_0x5d2287,_0x1538bc);})['then'](function(_0x49c85b){_0x711a58(_0x49c85b);})['catch'](function(_0x38910a){_0x28b16e(_0x38910a);});});}exports[_0xcc6a('0x38')]=function(_0x1101ec,_0xe213b3){var _0x1dc64f={},_0x5856af={},_0x58f6ee={'count':0x0,'rows':[]};var _0x10f47d=_[_0xcc6a('0x32')](db[_0xcc6a('0x39')]['rawAttributes'],function(_0x382283){return{'name':_0x382283[_0xcc6a('0x3a')],'type':_0x382283[_0xcc6a('0x3b')][_0xcc6a('0x3c')]};});_0x5856af[_0xcc6a('0x3d')]=_[_0xcc6a('0x32')](_0x10f47d,_0xcc6a('0x30'));_0x5856af[_0xcc6a('0x3e')]=_[_0xcc6a('0x3f')](_0x1101ec[_0xcc6a('0x3e')]);_0x5856af[_0xcc6a('0x40')]=_[_0xcc6a('0x41')](_0x5856af[_0xcc6a('0x3d')],_0x5856af[_0xcc6a('0x3e')]);_0x1dc64f[_0xcc6a('0x42')]=_[_0xcc6a('0x41')](_0x5856af[_0xcc6a('0x3d')],qs[_0xcc6a('0x43')](_0x1101ec['query']['fields']));_0x1dc64f[_0xcc6a('0x42')]=_0x1dc64f[_0xcc6a('0x42')][_0xcc6a('0x44')]?_0x1dc64f[_0xcc6a('0x42')]:_0x5856af[_0xcc6a('0x3d')];if(!_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x45')](_0xcc6a('0x46'))){_0x1dc64f['limit']=qs['limit'](_0x1101ec[_0xcc6a('0x3e')]['limit']);_0x1dc64f['offset']=qs['offset'](_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x23')]);}_0x1dc64f[_0xcc6a('0x47')]=qs[_0xcc6a('0x48')](_0x1101ec[_0xcc6a('0x3e')]['sort']);_0x1dc64f[_0xcc6a('0x49')]=qs[_0xcc6a('0x40')](_[_0xcc6a('0x4a')](_0x1101ec[_0xcc6a('0x3e')],_0x5856af[_0xcc6a('0x40')]),_0x10f47d);var _0x2235e0=[];var _0x54f862=squel[_0xcc6a('0x4b')]()[_0xcc6a('0x4c')]('id')[_0xcc6a('0x4c')](_0xcc6a('0x30'))['field'](_0xcc6a('0x4d'))['from'](_0xcc6a('0x4e'));var _0x3f280a=squel[_0xcc6a('0x4b')]()['field'](_0xcc6a('0x4f'))[_0xcc6a('0x4c')](_0xcc6a('0x50'))['field']('ui.WhatsappInteractionId')[_0xcc6a('0x51')](_0xcc6a('0x52'),'ui')[_0xcc6a('0x53')](_0xcc6a('0x54'),'u',_0xcc6a('0x55'));var _0x5e59af=squel[_0xcc6a('0x4b')]()[_0xcc6a('0x51')]('whatsapp_interactions','i')[_0xcc6a('0x53')](_0xcc6a('0x56'),'c',_0xcc6a('0x57'))[_0xcc6a('0x53')](_0xcc6a('0x54'),'o',_0xcc6a('0x58'))['left_join']('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0xcc6a('0x53')](_0xcc6a('0x59'),'me',_0xcc6a('0x5a'))[_0xcc6a('0x53')]('whatsapp_interaction_has_tags','it',_0xcc6a('0x5b'))['left_join'](_0xcc6a('0x4e'),'t',_0xcc6a('0x5c'));var _0xcfc540=squel[_0xcc6a('0x5d')]();var _0x41be6d=[];var _0x3687b1=squel['expr']();var _0x1a3b82;if(_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x5e')]){_0x1a3b82=as[_0xcc6a('0x5f')](_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x5e')]);var _0x431684=_0x1a3b82[_0xcc6a('0x60')];for(var _0x31987f=0x0;_0x31987f<_0x1a3b82[_0xcc6a('0x61')]['length'];_0x31987f++){var _0x1c8470=_0x1a3b82[_0xcc6a('0x61')][_0x31987f];var _0xbed299='i';var _0x34531d=_[_0xcc6a('0x62')](_0x10f47d,[_0xcc6a('0x30'),_0x1c8470['field']]);if(!_0x34531d){switch(_0x1c8470['field']){case _0xcc6a('0x63'):if(_0x1c8470['value']==0x1){_0x5e59af[_0xcc6a('0x64')]('`'+_0x1c8470[_0xcc6a('0x4c')]+_0xcc6a('0x65'));}else{_0x5e59af[_0xcc6a('0x64')]('`'+_0x1c8470[_0xcc6a('0x4c')]+_0xcc6a('0x66'));}break;case _0xcc6a('0x67'):if(_0x1c8470[_0xcc6a('0x68')]===_0xcc6a('0x69')){if(_0x1c8470[_0xcc6a('0x6a')][_0xcc6a('0x36')]('\x20')['length']>0x1){_0xcfc540[_0x431684](_0xcc6a('0x6b'),qs['getFullTextValue'](_0x1c8470[_0xcc6a('0x6a')]),null);}else{var _0x1570fe='%'+_0x1c8470[_0xcc6a('0x6a')]+'%';_0xcfc540[_0x431684]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1570fe,_0x1570fe,_0x1570fe);}}else{_0x34531d=_[_0xcc6a('0x62')](_0x10f47d,['name',_0xcc6a('0x6c')]);_0x1c8470['field']=_0xcc6a('0x6c');_0x2ffe07=as[_0xcc6a('0x6d')](_0xbed299,_0x34531d[_0xcc6a('0x3b')],_0x1c8470);_0xcfc540[_0x431684](_0x2ffe07[_0xcc6a('0x6e')],_0x2ffe07[_0xcc6a('0x6a')][_0xcc6a('0x6f')],_0x2ffe07[_0xcc6a('0x6a')][_0xcc6a('0x2d')]);}break;case'Tag':var _0x14d3ff=_0x1c8470['value'][_0xcc6a('0x36')](',')['map'](function(_0x1807cb){return Number(_0x1807cb);});_0x14d3ff[_0xcc6a('0x37')](function(_0x3c4b7c){_0x3687b1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c4b7c+',%');});_0x41be6d=_[_0xcc6a('0x70')](_0x41be6d,_0x14d3ff);break;case'User':if(_0x1c8470['operator']===_0xcc6a('0x69')){_0xcfc540[_0x431684](_0xcc6a('0x71'),'%'+_0x1c8470[_0xcc6a('0x6a')]+'%',null);}else{_0x34531d=_[_0xcc6a('0x62')](_0x10f47d,[_0xcc6a('0x30'),_0xcc6a('0x72')]);_0x1c8470[_0xcc6a('0x4c')]=_0xcc6a('0x72');_0x2ffe07=as[_0xcc6a('0x6d')](_0xbed299,_0x34531d[_0xcc6a('0x3b')],_0x1c8470);_0xcfc540[_0x431684](_0x2ffe07[_0xcc6a('0x6e')],_0x2ffe07[_0xcc6a('0x6a')][_0xcc6a('0x6f')],_0x2ffe07['value'][_0xcc6a('0x2d')]);}break;case _0xcc6a('0x73'):_0x2ffe07=as[_0xcc6a('0x6d')]('me',null,_0x1c8470);_0xcfc540[_0x431684](_0x2ffe07[_0xcc6a('0x6e')],_0x2ffe07['value'][_0xcc6a('0x6f')],_0x2ffe07[_0xcc6a('0x6a')][_0xcc6a('0x2d')]);break;}}else{var _0x2ffe07=as[_0xcc6a('0x6d')](_0xbed299,_0x34531d[_0xcc6a('0x3b')],_0x1c8470);_0xcfc540[_0x431684](_0x2ffe07[_0xcc6a('0x6e')],_0x2ffe07[_0xcc6a('0x6a')][_0xcc6a('0x6f')],_0x2ffe07[_0xcc6a('0x6a')]['end']);}}}else{var _0x49f60a=_(_0x1101ec['query'])[_0xcc6a('0x3f')]()[_0xcc6a('0x32')](function(_0x9c444){return _['some'](_0x10f47d,[_0xcc6a('0x30'),_0x9c444])?_0x9c444:undefined;})[_0xcc6a('0x74')]()[_0xcc6a('0x6a')]();if(!_[_0xcc6a('0x75')](_0x49f60a)){_0x49f60a['forEach'](function(_0x481d25){if(_0x481d25===_0xcc6a('0x76')){_0x5e59af[_0xcc6a('0x49')](_0xcc6a('0x77'),[][_0xcc6a('0x78')](_0x1101ec['query'][_0x481d25]));}else if(_0x481d25===_0xcc6a('0x79')){var _0x2e9a9f=JSON[_0xcc6a('0x7a')](_0x1101ec[_0xcc6a('0x3e')][_0x481d25])[_0xcc6a('0x7b')];var _0x55d129=JSON['parse'](_0x1101ec[_0xcc6a('0x3e')][_0x481d25])[_0xcc6a('0x7c')];_0x5e59af[_0xcc6a('0x49')](_0xcc6a('0x7d'),_0x2e9a9f,_0x55d129);}else{if(_0x1101ec['query'][_0x481d25]==='null'){_0x5e59af[_0xcc6a('0x49')]('i.'+_0x481d25+_0xcc6a('0x7e'));}else{_0x5e59af[_0xcc6a('0x49')]('i.'+_0x481d25+_0xcc6a('0x7f'),_0x1101ec['query'][_0x481d25]);}}});}if(_0x1101ec['query']['read']){if(_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x80')]==0x1){_0x5e59af[_0xcc6a('0x64')](_0xcc6a('0x81'));}else{_0x5e59af['having'](_0xcc6a('0x82'));}}if(_0x1101ec[_0xcc6a('0x3e')]['tag']){_0x41be6d=_[_0xcc6a('0x83')](_0x1101ec['query'][_0xcc6a('0x84')])?_0x1101ec['query'][_0xcc6a('0x84')]:new Array(_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x84')]);_0x41be6d['forEach'](function(_0x3ce1eb){_0x3687b1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3ce1eb+',%');});}if(_0x1101ec[_0xcc6a('0x3e')]['filter']){var _0x12acc4=_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x85')][_0xcc6a('0x86')]('\x5c','\x5c\x5c')[_0xcc6a('0x86')](/'/g,'\x27\x27');if(qs[_0xcc6a('0x87')](_0x12acc4)){_0xcfc540['or']('i.id\x20LIKE\x20?',_0x12acc4+'%')['or'](_0xcc6a('0x88'),_0x12acc4+'%');}else{_0xcfc540['or'](_0xcc6a('0x89'),qs[_0xcc6a('0x8a')](_0x12acc4))['or'](_0xcc6a('0x8b'),_0x12acc4+'%');}}}_0x5e59af[_0xcc6a('0x49')](_0xcfc540);_0x5e59af['group'](_0xcc6a('0x8c'));var _0x731844={'type':db['Sequelize']['QueryTypes'][_0xcc6a('0x8d')],'raw':!![]};var _0x2e9b03=_0x5e59af[_0xcc6a('0x8e')]();_0x2e9b03[_0xcc6a('0x4c')](_0xcc6a('0x8c'));_0x2e9b03[_0xcc6a('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xcc6a('0x63'));if(_0x1dc64f[_0xcc6a('0x47')]){_0x1dc64f[_0xcc6a('0x47')][_0xcc6a('0x37')](function(_0x19a582){var _0xda7d0e=_0x19a582[0x0]==='contactName'?_0x19a582[0x0]:'i.'+_0x19a582[0x0];_0x5e59af['order'](_0xda7d0e,_0x19a582[0x1]===_0xcc6a('0x8f')?![]:!![]);});}if(!_[_0xcc6a('0x75')](_0x41be6d)){_0x5e59af[_0xcc6a('0x64')](_0x3687b1);_0x2e9b03[_0xcc6a('0x49')](_0xcc6a('0x90'),_0x41be6d);}BPromise[_0xcc6a('0x91')]()[_0xcc6a('0x2c')](function(){if(!_0x1a3b82){if(_0x1101ec['query'][_0xcc6a('0x76')])return;_0x2e9b03[_0xcc6a('0x49')](_0xcc6a('0x92'));_0x5e59af[_0xcc6a('0x49')](_0xcc6a('0x92'));return;}if(_0x1101ec[_0xcc6a('0x93')]['role']!==_0xcc6a('0x94'))return;return _0x1101ec[_0xcc6a('0x93')][_0xcc6a('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25098f){if(_[_0xcc6a('0x75')](_0x25098f)){_0x2e9b03[_0xcc6a('0x49')](_0xcc6a('0x96'));_0x5e59af[_0xcc6a('0x49')](_0xcc6a('0x96'));}else{_0x2e9b03['where'](_0xcc6a('0x77'),_[_0xcc6a('0x32')](_0x25098f,'id'));_0x5e59af['where'](_0xcc6a('0x77'),_[_0xcc6a('0x32')](_0x25098f,'id'));}});})[_0xcc6a('0x2c')](function(){if(_0x1101ec[_0xcc6a('0x93')][_0xcc6a('0x97')]==='agent'&&!_0x1a3b82&&!_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x76')])return[];return db[_0xcc6a('0x98')][_0xcc6a('0x3e')](_0x2e9b03[_0xcc6a('0x99')](),_0x731844);})[_0xcc6a('0x2c')](function(_0x5e9b26){_0x58f6ee['count']=_0x5e9b26[_0xcc6a('0x44')];if(_0x58f6ee['count']===0x0)return[];return db[_0xcc6a('0x98')][_0xcc6a('0x3e')](_0x54f862[_0xcc6a('0x99')](),_0x731844)[_0xcc6a('0x2c')](function(_0x1149dd){_0x2235e0=_[_0xcc6a('0x9a')](_0x1149dd,'id');_0x731844=_[_0xcc6a('0x9b')](_0x731844,{'model':db[_0xcc6a('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1101ec[_0xcc6a('0x3e')][_0xcc6a('0x43')]){_0x1dc64f[_0xcc6a('0x42')][_0xcc6a('0x37')](function(_0x58fdb3){_0x5e59af[_0xcc6a('0x4c')]('i.'+_0x58fdb3);});}else{_0x5e59af[_0xcc6a('0x4c')](_0xcc6a('0x9c'),_0xcc6a('0x63'));_0x5e59af['field'](_0xcc6a('0x9d'),'Account.key');_0x5e59af[_0xcc6a('0x4c')](_0xcc6a('0x9e'),_0xcc6a('0x9f'));_0x5e59af[_0xcc6a('0x4c')](_0xcc6a('0xa0'),_0xcc6a('0xa1'));_0x5e59af[_0xcc6a('0x4c')]('i.*');_0x5e59af[_0xcc6a('0x4c')](_0xcc6a('0xa2'),_0xcc6a('0xa3'));_0x5e59af[_0xcc6a('0x4c')](_0xcc6a('0xa4'),_0xcc6a('0xa5'));_0x5e59af['field'](_0xcc6a('0xa6'),_0xcc6a('0xa7'));_0x5e59af['field']('c.phone',_0xcc6a('0xa8'));_0x5e59af[_0xcc6a('0x4c')](_0xcc6a('0xa9'),_0xcc6a('0xaa'));_0x5e59af[_0xcc6a('0x4c')]('c.fax',_0xcc6a('0xab'));_0x5e59af['field'](_0xcc6a('0xac'),_0xcc6a('0xad'));_0x5e59af[_0xcc6a('0x4c')](_0xcc6a('0xae'),_0xcc6a('0xaf'));_0x5e59af[_0xcc6a('0x4c')](_0xcc6a('0xb0'),_0xcc6a('0x34'));}if(_0x1dc64f['limit'])_0x5e59af[_0xcc6a('0x24')](_0x1dc64f[_0xcc6a('0x24')]);if(_0x1dc64f[_0xcc6a('0x23')])_0x5e59af['offset'](_0x1dc64f[_0xcc6a('0x23')]);return db[_0xcc6a('0x98')][_0xcc6a('0x3e')](_0x5e59af[_0xcc6a('0x99')](),_0x731844);})[_0xcc6a('0x2c')](function(_0x151263){_0x3f280a[_0xcc6a('0x49')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xcc6a('0x32')](_0x151263,'id'));return db[_0xcc6a('0x98')][_0xcc6a('0x3e')](_0x3f280a[_0xcc6a('0x99')](),_0x731844)[_0xcc6a('0x2c')](function(_0xc42043){var _0x1332e7=_[_0xcc6a('0xb1')](_0xc42043,'WhatsappInteractionId');var _0x47e671=[];_0x151263[_0xcc6a('0x37')](function(_0x53ef27){_0x47e671[_0xcc6a('0xb2')](updateWhatsappInteraction(_0x53ef27,_0x2235e0,_0x1332e7));});return BPromise[_0xcc6a('0xb3')](_0x47e671);});});})[_0xcc6a('0x2c')](function(_0x37ecd2){_0x58f6ee[_0xcc6a('0xb4')]=_0x37ecd2;return _0x58f6ee;})[_0xcc6a('0x2c')](respondWithFilteredResult(_0xe213b3,_0x1dc64f))[_0xcc6a('0xb5')](handleError(_0xe213b3,null));};exports['show']=function(_0x10d731,_0x537e2b){var _0x5eb00a={'raw':![],'where':{'id':_0x10d731['params']['id']}},_0x1fb9bb={};_0x1fb9bb[_0xcc6a('0x3d')]=_[_0xcc6a('0x3f')](db['WhatsappInteraction']['rawAttributes']);_0x1fb9bb[_0xcc6a('0x3e')]=_['keys'](_0x10d731[_0xcc6a('0x3e')]);_0x1fb9bb[_0xcc6a('0x40')]=_[_0xcc6a('0x41')](_0x1fb9bb[_0xcc6a('0x3d')],_0x1fb9bb[_0xcc6a('0x3e')]);_0x5eb00a[_0xcc6a('0x42')]=_['intersection'](_0x1fb9bb[_0xcc6a('0x3d')],qs[_0xcc6a('0x43')](_0x10d731[_0xcc6a('0x3e')][_0xcc6a('0x43')]));_0x5eb00a['attributes']=_0x5eb00a[_0xcc6a('0x42')][_0xcc6a('0x44')]?_0x5eb00a[_0xcc6a('0x42')]:_0x1fb9bb[_0xcc6a('0x3d')];if(_0x10d731[_0xcc6a('0x3e')][_0xcc6a('0xb6')]){_0x5eb00a[_0xcc6a('0xb7')]=[{'all':!![]}];}_0x5eb00a=_['merge']({},_0x5eb00a,_0x10d731[_0xcc6a('0xb8')]);return db[_0xcc6a('0x39')]['find'](_0x5eb00a)[_0xcc6a('0x2c')](handleEntityNotFound(_0x537e2b,null))[_0xcc6a('0x2c')](respondWithResult(_0x537e2b,null))[_0xcc6a('0xb5')](handleError(_0x537e2b,null));};exports[_0xcc6a('0xb9')]=function(_0xc4ed84,_0xa732e6){return db[_0xcc6a('0x39')][_0xcc6a('0xb9')](_0xc4ed84[_0xcc6a('0x73')],{})[_0xcc6a('0x2c')](respondWithResult(_0xa732e6,0xc9))[_0xcc6a('0xb5')](handleError(_0xa732e6,null));};exports[_0xcc6a('0x2a')]=function(_0x2768b6,_0x3ba3b0){if(_0x2768b6['body']['id']){delete _0x2768b6['body']['id'];}return db[_0xcc6a('0x39')][_0xcc6a('0x62')]({'where':{'id':_0x2768b6['params']['id']}})[_0xcc6a('0x2c')](handleEntityNotFound(_0x3ba3b0,null))[_0xcc6a('0x2c')](saveUpdates(_0x2768b6[_0xcc6a('0x73')],null))['then'](respondWithResult(_0x3ba3b0,null))[_0xcc6a('0xb5')](handleError(_0x3ba3b0,null));};exports['destroy']=function(_0x1ced4b,_0x4345eb){return db['WhatsappInteraction'][_0xcc6a('0x62')]({'where':{'id':_0x1ced4b['params']['id']}})[_0xcc6a('0x2c')](handleEntityNotFound(_0x4345eb,null))[_0xcc6a('0x2c')](removeEntity(_0x4345eb,null))[_0xcc6a('0xb5')](handleError(_0x4345eb,null));};exports[_0xcc6a('0xba')]=function(_0x32098d,_0x57abcf){return db['WhatsappInteraction']['describe']()[_0xcc6a('0x2c')](respondWithResult(_0x57abcf,null))[_0xcc6a('0xb5')](handleError(_0x57abcf,null));};exports[_0xcc6a('0xbb')]=function(_0x5d00fb,_0x1f8ec5,_0x3d7dcd){return db[_0xcc6a('0xbc')][_0xcc6a('0x62')]({'where':{'id':_0x5d00fb['params']['id']}})[_0xcc6a('0x2c')](handleEntityNotFound(_0x1f8ec5,null))[_0xcc6a('0x2c')](function(_0x1ef493){if(_0x1ef493){return _0x1ef493['addMessage'](_0x5d00fb[_0xcc6a('0x73')]['ids'],_[_0xcc6a('0xbd')](_0x5d00fb[_0xcc6a('0x73')],['ids','id'])||{});}})[_0xcc6a('0x2c')](respondWithResult(_0x1f8ec5,null))[_0xcc6a('0xb5')](handleError(_0x1f8ec5,null));};exports[_0xcc6a('0xbe')]=function(_0x25ce7b,_0x20581c,_0x125dba){var _0x36df40={'raw':![],'where':{}};var _0x15146c={};var _0x25ba57={'count':0x0,'rows':[]};return db[_0xcc6a('0x39')][_0xcc6a('0xbf')]({'where':{'id':_0x25ce7b['params']['id']}})['then'](handleEntityNotFound(_0x20581c,null))[_0xcc6a('0x2c')](function(_0x5019b5){if(_0x5019b5){_0x15146c[_0xcc6a('0x3d')]=_['keys'](db['WhatsappMessage'][_0xcc6a('0xc0')]);_0x15146c[_0xcc6a('0x3e')]=_[_0xcc6a('0x3f')](_0x25ce7b[_0xcc6a('0x3e')]);_0x15146c['filters']=_[_0xcc6a('0x41')](_0x15146c['model'],_0x15146c['query']);_0x36df40[_0xcc6a('0x42')]=_[_0xcc6a('0x41')](_0x15146c[_0xcc6a('0x3d')],qs[_0xcc6a('0x43')](_0x25ce7b[_0xcc6a('0x3e')][_0xcc6a('0x43')]));_0x36df40[_0xcc6a('0x42')]=_0x36df40['attributes'][_0xcc6a('0x44')]?_0x36df40[_0xcc6a('0x42')]:_0x15146c[_0xcc6a('0x3d')];if(!_0x25ce7b['query'][_0xcc6a('0x45')]('nolimit')){_0x36df40[_0xcc6a('0x24')]=qs['limit'](_0x25ce7b['query'][_0xcc6a('0x24')]);_0x36df40[_0xcc6a('0x23')]=qs[_0xcc6a('0x23')](_0x25ce7b[_0xcc6a('0x3e')][_0xcc6a('0x23')]);}_0x36df40['order']=qs['sort'](_0x25ce7b['query'][_0xcc6a('0x48')]);_0x36df40[_0xcc6a('0x49')]=qs[_0xcc6a('0x40')](_[_0xcc6a('0x4a')](_0x25ce7b[_0xcc6a('0x3e')],_0x15146c[_0xcc6a('0x40')]));_0x36df40['where'][_0xcc6a('0xc1')]=_0x5019b5['id'];if(_0x25ce7b['query'][_0xcc6a('0x85')]){_0x36df40[_0xcc6a('0x49')]=_[_0xcc6a('0x9b')](_0x36df40[_0xcc6a('0x49')],{'$or':_[_0xcc6a('0x32')](_0x36df40['attributes'],function(_0x58d868){var _0x2db2d7={};_0x2db2d7[_0x58d868]={'$like':'%'+_0x25ce7b[_0xcc6a('0x3e')]['filter']+'%'};return _0x2db2d7;})});}if(_0x25ce7b[_0xcc6a('0x3e')][_0xcc6a('0x7b')]){var _0x3a154d=_0x25ce7b[_0xcc6a('0x3e')][_0xcc6a('0x7b')][_0xcc6a('0x36')](',');var _0x56cd4e={};_0x56cd4e[_0x3a154d[0x0]]={'$gte':moment(_0x3a154d[0x1])[_0xcc6a('0xc2')](_0xcc6a('0xc3'))};_0x36df40[_0xcc6a('0x49')]=_['merge'](_0x36df40['where'],_0x56cd4e);}_0x36df40=_['merge']({},_0x36df40,_0x25ce7b['options']);return db[_0xcc6a('0xbc')]['count']({'where':_0x36df40[_0xcc6a('0x49')]})[_0xcc6a('0x2c')](function(_0x4fb2f5){_0x25ba57[_0xcc6a('0x22')]=_0x4fb2f5;if(_0x25ce7b['query'][_0xcc6a('0xb6')]){_0x36df40[_0xcc6a('0xb7')]=[{'all':!![]}];}return db[_0xcc6a('0xbc')][_0xcc6a('0xc4')](_0x36df40);})[_0xcc6a('0x2c')](function(_0x197961){_0x25ba57[_0xcc6a('0xb4')]=_0x197961;return _0x25ba57;});}})[_0xcc6a('0x2c')](respondWithFilteredResult(_0x20581c,_0x36df40))[_0xcc6a('0xb5')](handleError(_0x20581c,null));};exports[_0xcc6a('0xc5')]=function(_0x353442,_0x258397,_0x27182c){return db[_0xcc6a('0x39')][_0xcc6a('0x62')]({'where':{'id':_0x353442[_0xcc6a('0xc6')]['id']}})[_0xcc6a('0x2c')](handleEntityNotFound(_0x258397,null))[_0xcc6a('0x2c')](function(_0x1b870e){if(_0x1b870e){return _0x1b870e[_0xcc6a('0xc7')](_0x353442[_0xcc6a('0x73')][_0xcc6a('0xc8')],_['omit'](_0x353442[_0xcc6a('0x73')],[_0xcc6a('0xc8'),'id'])||{})[_0xcc6a('0xc9')](function(){return db['Tag'][_0xcc6a('0xc4')]({'attributes':['id',_0xcc6a('0x30'),'color'],'where':{'id':_0x353442[_0xcc6a('0x73')][_0xcc6a('0xc8')]}});})['then'](function(_0xa113c7){socket[_0xcc6a('0xca')](_0xcc6a('0xcb'),{'id':Number(_0x353442[_0xcc6a('0xc6')]['id']),'tags':_0xa113c7||[]});return{'id':Number(_0x353442[_0xcc6a('0xc6')]['id']),'tags':_0xa113c7||[]};});}})[_0xcc6a('0x2c')](respondWithResult(_0x258397,null))['catch'](handleError(_0x258397,null));};exports['removeTags']=function(_0x1e436d,_0x331efb,_0x50a8fe){return db[_0xcc6a('0x39')]['find']({'where':{'id':_0x1e436d[_0xcc6a('0xc6')]['id']}})['then'](handleEntityNotFound(_0x331efb,null))[_0xcc6a('0x2c')](function(_0x9391bf){if(_0x9391bf){return _0x9391bf[_0xcc6a('0xcc')](_0x1e436d['query'][_0xcc6a('0xc8')]);}})[_0xcc6a('0x2c')](respondWithStatusCode(_0x331efb,null))[_0xcc6a('0xb5')](handleError(_0x331efb,null));};exports['download']=function(_0x4fb270,_0x4cd822){var _0x1c8930=moment()[_0xcc6a('0xcd')]()[_0xcc6a('0x99')]();var _0x412c37=path[_0xcc6a('0xce')](config[_0xcc6a('0xcf')],_0xcc6a('0xd0'),_0xcc6a('0xd1'),_0xcc6a('0xd2'));var _0x239139=path[_0xcc6a('0xce')](config[_0xcc6a('0xcf')],'server',_0xcc6a('0xd1'),_0xcc6a('0xd3'));var _0x462ab1=path['join'](_0x412c37,_0x1c8930);var _0x1ba02d=util[_0xcc6a('0xc2')](_0xcc6a('0xd4'),_0x4fb270['params']['id'],_0x1c8930);var _0x1a549a=path[_0xcc6a('0xce')](_0x412c37,_0x1ba02d);var _0xa33c5f=[];_0xa33c5f[_0xcc6a('0xb2')]({'model':db['User'],'as':_0xcc6a('0xd5'),'attributes':['id','fullname'],'raw':!![]});_0xa33c5f['push']({'model':db['CmContact'],'as':_0xcc6a('0x67'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x4fb270[_0xcc6a('0x3e')][_0xcc6a('0xd3')]){_0xa33c5f[_0xcc6a('0xb2')]({'model':db[_0xcc6a('0xd6')],'as':_0xcc6a('0xd6'),'raw':!![]});}var _0x7754a9=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body',_0xcc6a('0x79'),_0xcc6a('0xd7'),_0xcc6a('0xd8'),_0xcc6a('0x80')],'include':_0xa33c5f}];_0x7754a9[_0xcc6a('0xb2')]({'model':db[_0xcc6a('0xd9')],'as':'Account','attributes':['id','name']});_0x7754a9[_0xcc6a('0xb2')]({'model':db[_0xcc6a('0xd5')],'as':_0xcc6a('0xda'),'attributes':['id',_0xcc6a('0x33')]});return db['WhatsappInteraction'][_0xcc6a('0x62')]({'where':{'id':_0x4fb270['params']['id']},'include':_0x7754a9})[_0xcc6a('0x2c')](handleEntityNotFound(_0x4cd822,null))[_0xcc6a('0x2c')](function(_0x8fa195){if(_0x8fa195){var _0x2af6ae=_0x8fa195[_0xcc6a('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x462ab1);var _0x525941={'format':'A4','border':_0xcc6a('0xdc'),'header':{'height':_0xcc6a('0xdd'),'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':_0xcc6a('0xde'),'contents':{'default':util[_0xcc6a('0xc2')](_0xcc6a('0xdf'),util[_0xcc6a('0xc2')](_0xcc6a('0xe0'),_0xcc6a('0xe1'),_0x2af6ae['id']),moment()[_0xcc6a('0xc2')](_0xcc6a('0xe2'))[_0xcc6a('0x99')]())}}};var _0x1a469f={'channel':'Whatsapp','account':_0x2af6ae['Account'][_0xcc6a('0x30')],'agent':_0x2af6ae['Owner']?_0x2af6ae[_0xcc6a('0xda')][_0xcc6a('0x33')]:_0xcc6a('0xe3'),'createdAt':moment(_0x2af6ae['createdAt'])[_0xcc6a('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcc6a('0x99')](),'closedAt':_0x2af6ae[_0xcc6a('0xe4')]?moment(_0x2af6ae[_0xcc6a('0xe5')])[_0xcc6a('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcc6a('0x99')]():'','disposition':_0x2af6ae[_0xcc6a('0xe6')],'messages':_(_0x2af6ae[_0xcc6a('0xe7')])[_0xcc6a('0x85')]({'secret':![]})[_0xcc6a('0x32')](function(_0x878513){if(_0x878513[_0xcc6a('0xd6')]){var _0x575bcb=path['join'](_0x239139,_0x878513['Attachment'][_0xcc6a('0xe8')]);if(fs[_0xcc6a('0xe9')](_0x575bcb)){fs['createReadStream'](_0x575bcb)[_0xcc6a('0xea')](fs[_0xcc6a('0xeb')](path[_0xcc6a('0xce')](_0x462ab1,_0x878513['Attachment'][_0xcc6a('0xe8')])));}}return{'date':moment(_0x878513['createdAt'])[_0xcc6a('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcc6a('0x99')](),'sender':_0x878513[_0xcc6a('0xd7')]===_0xcc6a('0xec')?_0x878513[_0xcc6a('0xd5')]?_0x878513['User'][_0xcc6a('0x33')]:_0xcc6a('0xed'):_0x878513[_0xcc6a('0x67')]['firstName']+(_0x878513['Contact']['lastName']?'\x20'+_0x878513[_0xcc6a('0x67')][_0xcc6a('0xee')]:''),'body':_0x878513[_0xcc6a('0xd6')]?_0x878513[_0xcc6a('0xd6')][_0xcc6a('0xe8')]:_0x878513[_0xcc6a('0x73')],'direction':_0x878513[_0xcc6a('0xd7')]===_0xcc6a('0xec')?'A':'C','secret':_0x878513[_0xcc6a('0xd8')],'read':_0x878513[_0xcc6a('0x80')],'attachment':_0x878513[_0xcc6a('0xd6')]};})[_0xcc6a('0x6a')]()};return ejs['renderFile'](path[_0xcc6a('0xce')](config[_0xcc6a('0xcf')],_0xcc6a('0xd0'),_0xcc6a('0xef'),_0xcc6a('0xf0')),{'interaction':_0x1a469f})[_0xcc6a('0x2c')](function(_0x24ded7){return new BPromise(function(_0x4efdd9,_0x364d3d){pdf[_0xcc6a('0xb9')](_0x24ded7,_0x525941)[_0xcc6a('0xf1')](path[_0xcc6a('0xce')](_0x462ab1,_0xcc6a('0xf2')+_0x2af6ae['id']+'-'+_0x1c8930+'.pdf'),function(_0x132834,_0x5c045e){if(_0x132834)return _0x364d3d(_0x132834);_0x4efdd9(_0x5c045e);});});})[_0xcc6a('0x2c')](function(){return new BPromise(function(_0x132f83,_0x10ebdf){zipdir(_0x462ab1,{'saveTo':_0x1a549a},function(_0x371639,_0x549282){if(_0x371639)return _0x10ebdf(_0x371639);return _0x132f83(_0x549282);});})[_0xcc6a('0x2c')](function(){return new BPromise(function(_0x2955fb,_0x2e8c0a){rimraf(_0x462ab1,function(_0x25b6b9){if(_0x25b6b9)_0x2e8c0a(_0x25b6b9);return _0x2955fb();});});})[_0xcc6a('0x2c')](function(){return _0x4cd822['download'](_0x1a549a,_0x1ba02d,function(_0x57be11){if(_0x57be11){console[_0xcc6a('0xf3')](_0xcc6a('0xf4'),_0x57be11);}else{fs[_0xcc6a('0xf5')](_0x1a549a);}});});});}else{return _0x4cd822[_0xcc6a('0x1f')](0xc8);}})['catch'](handleError(_0x4cd822,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b911bb9..ccd053c 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 _0x43b3=['catch','hook','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','length','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43b3,0xe2));var _0x343b=function(_0x144714,_0x52642a){_0x144714=_0x144714-0x0;var _0x580e09=_0x43b3[_0x144714];return _0x580e09;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x343b('0x0'))['db'][_0x343b('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x343b('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x343b('0x3')](0x0);var events={'afterCreate':_0x343b('0x4'),'afterUpdate':_0x343b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2ac030){return function(_0x2c3f77,_0x558b57,_0x13fd28){_0x2c3f77[_0x343b('0x6')]({'attributes':['id'],'raw':!![]})[_0x343b('0x7')](function(_0x2b4b7c){_0x2c3f77[_0x343b('0x8')](_0x343b('0x9'),_0x2b4b7c[_0x343b('0xa')](function(_0x5a920f){return{'id':_0x5a920f['id']};}));return WhatsappMessage[_0x343b('0xb')]({'where':{'WhatsappInteractionId':_0x2c3f77['id'],'direction':'in','read':![]},'raw':!![]});})[_0x343b('0x7')](function(_0x55256b){_0x2c3f77[_0x343b('0x8')]('unreadMessages',_0x55256b[_0x343b('0xc')]);WhatsappInteractionEvents[_0x343b('0xd')](_0x2ac030+':'+_0x2c3f77['id'],_0x2c3f77);WhatsappInteractionEvents['emit'](_0x2ac030,_0x2c3f77);_0x13fd28(null);})[_0x343b('0xe')](_0x13fd28(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x343b('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xfd5c=['hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch'];(function(_0x5bfa08,_0x1a99a2){var _0x58ebc9=function(_0x59d40b){while(--_0x59d40b){_0x5bfa08['push'](_0x5bfa08['shift']());}};_0x58ebc9(++_0x1a99a2);}(_0xfd5c,0x1f0));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xcfd5('0x0'));var WhatsappInteraction=require(_0xcfd5('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xcfd5('0x1'))['db'][_0xcfd5('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xcfd5('0x3')](0x0);var events={'afterCreate':_0xcfd5('0x4'),'afterUpdate':_0xcfd5('0x5'),'afterDestroy':_0xcfd5('0x6')};function emitEvent(_0x2ccbe9){return function(_0x2ea712,_0x578400,_0x5b3ddc){_0x2ea712[_0xcfd5('0x7')]({'attributes':['id'],'raw':!![]})[_0xcfd5('0x8')](function(_0x33c677){_0x2ea712['setDataValue'](_0xcfd5('0x9'),_0x33c677[_0xcfd5('0xa')](function(_0x1f39f6){return{'id':_0x1f39f6['id']};}));return WhatsappMessage[_0xcfd5('0xb')]({'where':{'WhatsappInteractionId':_0x2ea712['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcfd5('0x8')](function(_0x5f2ab4){_0x2ea712[_0xcfd5('0xc')](_0xcfd5('0xd'),_0x5f2ab4[_0xcfd5('0xe')]);WhatsappInteractionEvents[_0xcfd5('0xf')](_0x2ccbe9+':'+_0x2ea712['id'],_0x2ea712);WhatsappInteractionEvents[_0xcfd5('0xf')](_0x2ccbe9,_0x2ea712);_0x5b3ddc(null);})[_0xcfd5('0x10')](_0x5b3ddc(null));};}for(var e in events){if(events[_0xcfd5('0x11')](e)){var event=events[e];WhatsappInteraction[_0xcfd5('0x12')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 805b7e5..70b3fb4 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 _0x5c93=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','../../config/logger','moment','bluebird','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5c93,0x10c));var _0x35c9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5c93[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x35c9('0x0'))('api');var moment=require(_0x35c9('0x1'));var BPromise=require(_0x35c9('0x2'));var rp=require(_0x35c9('0x3'));var fs=require('fs');var path=require(_0x35c9('0x4'));var rimraf=require(_0x35c9('0x5'));var config=require(_0x35c9('0x6'));var attributes=require(_0x35c9('0x7'));module[_0x35c9('0x8')]=function(_0x539941,_0x270a11){return _0x539941[_0x35c9('0x9')](_0x35c9('0xa'),attributes,{'tableName':_0x35c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x465943,_0x24abb0,_0x32a9e5){if(_0x465943[_0x35c9('0xc')](_0x35c9('0xd'))){_0x465943[_0x35c9('0xe')]=moment()[_0x35c9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x32a9e5(null,_0x465943);}}});}; \ No newline at end of file +var _0x62d8=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x62d8,0x1f3));var _0x862d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x62d8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x862d('0x0'));var util=require(_0x862d('0x1'));var logger=require(_0x862d('0x2'))(_0x862d('0x3'));var moment=require(_0x862d('0x4'));var BPromise=require(_0x862d('0x5'));var rp=require(_0x862d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x862d('0x7'));var attributes=require(_0x862d('0x8'));module[_0x862d('0x9')]=function(_0x324a2c,_0xdab289){return _0x324a2c[_0x862d('0xa')](_0x862d('0xb'),attributes,{'tableName':_0x862d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ca919,_0x548333,_0x58d350){if(_0x3ca919['changed'](_0x862d('0xd'))){_0x3ca919[_0x862d('0xe')]=moment()['format'](_0x862d('0xf'));}_0x58d350(null,_0x3ca919);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 01cad07..37062f7 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 _0xa633=['error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','where','attributes','limit','then','debug','stringify','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0xa633,0x11d));var _0x3a63=function(_0x27e046,_0x1944a2){_0x27e046=_0x27e046-0x0;var _0x535b52=_0xa633[_0x27e046];return _0x535b52;};'use strict';var _=require('lodash');var util=require(_0x3a63('0x0'));var moment=require(_0x3a63('0x1'));var BPromise=require(_0x3a63('0x2'));var rs=require(_0x3a63('0x3'));var fs=require('fs');var Redis=require(_0x3a63('0x4'));var db=require(_0x3a63('0x5'))['db'];var utils=require(_0x3a63('0x6'));var logger=require(_0x3a63('0x7'))(_0x3a63('0x8'));var config=require(_0x3a63('0x9'));var jayson=require(_0x3a63('0xa'));var client=jayson[_0x3a63('0xb')]['http']({'port':0x232a});config[_0x3a63('0xc')]=_['defaults'](config[_0x3a63('0xc')],{'host':_0x3a63('0xd'),'port':0x18eb});var socket=require(_0x3a63('0xe'))(new Redis(config[_0x3a63('0xc')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x351820,_0x3e7c11,_0x3c0e72){return new BPromise(function(_0x175e78,_0x4ff92a){return client[_0x3a63('0xf')](_0x351820,_0x3c0e72)['then'](function(_0x32880f){logger[_0x3a63('0x10')](_0x3a63('0x11'),_0x3e7c11,_0x3a63('0x12'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3e7c11,_0x3a63('0x12'),JSON['stringify'](_0x32880f));if(_0x32880f[_0x3a63('0x13')]){if(_0x32880f[_0x3a63('0x13')][_0x3a63('0x14')]===0x1f4){logger[_0x3a63('0x13')](_0x3a63('0x11'),_0x3e7c11,_0x32880f[_0x3a63('0x13')]['message']);return _0x4ff92a(_0x32880f[_0x3a63('0x13')][_0x3a63('0x15')]);}logger[_0x3a63('0x13')](_0x3a63('0x11'),_0x3e7c11,_0x32880f[_0x3a63('0x13')][_0x3a63('0x15')]);return _0x175e78(_0x32880f[_0x3a63('0x13')][_0x3a63('0x15')]);}else{logger['info'](_0x3a63('0x11'),_0x3e7c11,_0x3a63('0x12'));_0x175e78(_0x32880f['result'][_0x3a63('0x15')]);}})[_0x3a63('0x16')](function(_0x25834d){logger[_0x3a63('0x13')](_0x3a63('0x11'),_0x3e7c11,_0x25834d);_0x4ff92a(_0x25834d);});});}exports[_0x3a63('0x17')]=function(_0x4bb89c){var _0x233290=this;return new Promise(function(_0x589582,_0xf175e4){return db[_0x3a63('0x18')]['update'](_0x4bb89c[_0x3a63('0x19')],{'raw':_0x4bb89c[_0x3a63('0x1a')]?_0x4bb89c[_0x3a63('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb89c[_0x3a63('0x1a')]?_0x4bb89c[_0x3a63('0x1a')][_0x3a63('0x1b')]||null:null,'attributes':_0x4bb89c[_0x3a63('0x1a')]?_0x4bb89c['options'][_0x3a63('0x1c')]||null:null,'limit':_0x4bb89c[_0x3a63('0x1a')]?_0x4bb89c[_0x3a63('0x1a')][_0x3a63('0x1d')]||null:null})[_0x3a63('0x1e')](function(_0x4df1d6){logger['info'](_0x3a63('0x17'),_0x4bb89c);logger[_0x3a63('0x1f')]('UpdateWhatsappInteraction',_0x4bb89c,JSON[_0x3a63('0x20')](_0x4df1d6));_0x589582(_0x4df1d6);})[_0x3a63('0x16')](function(_0x1b8c5c){logger[_0x3a63('0x13')]('UpdateWhatsappInteraction',_0x1b8c5c['message'],_0x4bb89c);_0xf175e4(_0x233290[_0x3a63('0x13')](0x1f4,_0x1b8c5c[_0x3a63('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x29fd31){return new Promise(function(_0x359501,_0x5b0315){return db[_0x3a63('0x18')]['find']({'where':_0x29fd31[_0x3a63('0x1a')]?_0x29fd31[_0x3a63('0x1a')][_0x3a63('0x1b')]||null:null})[_0x3a63('0x1e')](function(_0x976595){if(_0x976595){return _0x976595[_0x3a63('0x21')](_0x29fd31['body'][_0x3a63('0x22')],_[_0x3a63('0x23')](_0x29fd31[_0x3a63('0x19')],[_0x3a63('0x22'),'id'])||{});}})[_0x3a63('0x24')](function(_0x2942ce){logger['info'](_0x3a63('0x25'),_0x29fd31);logger[_0x3a63('0x1f')](_0x3a63('0x25'),_0x29fd31,JSON['stringify'](_0x2942ce));_0x359501(_0x2942ce);})[_0x3a63('0x16')](function(_0x1e5379){logger[_0x3a63('0x13')]('AddTags',_0x1e5379[_0x3a63('0x15')],_0x29fd31);_0x5b0315(_this['error'](0x1f4,_0x1e5379[_0x3a63('0x15')]));});});}; \ No newline at end of file +var _0xf23e=['body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','message','error','update','options','raw','where','attributes','limit','UpdateWhatsappInteraction','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags'];(function(_0x28db4a,_0x6d6d5a){var _0x3bf87e=function(_0x3e0f75){while(--_0x3e0f75){_0x28db4a['push'](_0x28db4a['shift']());}};_0x3bf87e(++_0x6d6d5a);}(_0xf23e,0xdb));var _0xef23=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xf23e[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0xef23('0x0'));var util=require(_0xef23('0x1'));var moment=require(_0xef23('0x2'));var BPromise=require(_0xef23('0x3'));var rs=require(_0xef23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef23('0x5'))['db'];var utils=require(_0xef23('0x6'));var logger=require(_0xef23('0x7'))(_0xef23('0x8'));var config=require(_0xef23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xef23('0xa')][_0xef23('0xb')]({'port':0x232a});config[_0xef23('0xc')]=_['defaults'](config[_0xef23('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xef23('0xd'))(new Redis(config[_0xef23('0xc')]));require(_0xef23('0xe'))[_0xef23('0xf')](socket);function respondWithRpcPromise(_0x5532e4,_0x129817,_0x204ebd){return new BPromise(function(_0x1c0f75,_0x419169){return client[_0xef23('0x10')](_0x5532e4,_0x204ebd)[_0xef23('0x11')](function(_0x3acece){logger[_0xef23('0x12')](_0xef23('0x13'),_0x129817,_0xef23('0x14'));logger[_0xef23('0x15')](_0xef23('0x16'),_0x129817,_0xef23('0x14'),JSON[_0xef23('0x17')](_0x3acece));if(_0x3acece['error']){if(_0x3acece['error'][_0xef23('0x18')]===0x1f4){logger['error'](_0xef23('0x13'),_0x129817,_0x3acece['error'][_0xef23('0x19')]);return _0x419169(_0x3acece['error'][_0xef23('0x19')]);}logger[_0xef23('0x1a')](_0xef23('0x13'),_0x129817,_0x3acece[_0xef23('0x1a')][_0xef23('0x19')]);return _0x1c0f75(_0x3acece['error'][_0xef23('0x19')]);}else{logger[_0xef23('0x12')](_0xef23('0x13'),_0x129817,_0xef23('0x14'));_0x1c0f75(_0x3acece['result'][_0xef23('0x19')]);}})['catch'](function(_0x51a758){logger[_0xef23('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x129817,_0x51a758);_0x419169(_0x51a758);});});}exports['UpdateWhatsappInteraction']=function(_0x531c31){var _0x501206=this;return new Promise(function(_0x23b623,_0xf902d3){return db['WhatsappInteraction'][_0xef23('0x1b')](_0x531c31['body'],{'raw':_0x531c31[_0xef23('0x1c')]?_0x531c31['options'][_0xef23('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531c31[_0xef23('0x1c')]?_0x531c31[_0xef23('0x1c')][_0xef23('0x1e')]||null:null,'attributes':_0x531c31[_0xef23('0x1c')]?_0x531c31[_0xef23('0x1c')][_0xef23('0x1f')]||null:null,'limit':_0x531c31[_0xef23('0x1c')]?_0x531c31[_0xef23('0x1c')][_0xef23('0x20')]||null:null})[_0xef23('0x11')](function(_0x18be90){logger['info']('UpdateWhatsappInteraction',_0x531c31);logger[_0xef23('0x15')](_0xef23('0x21'),_0x531c31,JSON[_0xef23('0x17')](_0x18be90));_0x23b623(_0x18be90);})[_0xef23('0x22')](function(_0x3a98da){logger[_0xef23('0x1a')](_0xef23('0x21'),_0x3a98da[_0xef23('0x19')],_0x531c31);_0xf902d3(_0x501206[_0xef23('0x1a')](0x1f4,_0x3a98da[_0xef23('0x19')]));});});};exports[_0xef23('0x23')]=function(_0x300178){return new Promise(function(_0x2aa2b0,_0x317b72){return db[_0xef23('0x24')][_0xef23('0x25')]({'where':_0x300178[_0xef23('0x1c')]?_0x300178[_0xef23('0x1c')][_0xef23('0x1e')]||null:null})[_0xef23('0x11')](function(_0x52f930){if(_0x52f930){return _0x52f930[_0xef23('0x26')](_0x300178[_0xef23('0x27')][_0xef23('0x28')],_['omit'](_0x300178['body'],['ids','id'])||{});}})[_0xef23('0x29')](function(_0x2de8c9){logger[_0xef23('0x12')]('AddTags',_0x300178);logger[_0xef23('0x15')](_0xef23('0x2a'),_0x300178,JSON['stringify'](_0x2de8c9));_0x2aa2b0(_0x2de8c9);})['catch'](function(_0x3b419c){logger['error']('AddTags',_0x3b419c[_0xef23('0x19')],_0x300178);_0x317b72(_this[_0xef23('0x1a')](0x1f4,_0x3b419c[_0xef23('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 2e2a0df..666614d 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 _0x50a0=['remove','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0x50a0,0x1b7));var _0x050a=function(_0x48b714,_0x5b110c){_0x48b714=_0x48b714-0x0;var _0x46b4af=_0x50a0[_0x48b714];return _0x46b4af;};'use strict';var WhatsappInteractionEvents=require(_0x050a('0x0'));var events=['save',_0x050a('0x1'),'update'];function createListener(_0x352ae7,_0x1a9722){return function(_0x527afd){_0x1a9722['emit'](_0x352ae7,_0x527afd);};}function removeListener(_0x4ced3c,_0x5e0632){return function(){WhatsappInteractionEvents['removeListener'](_0x4ced3c,_0x5e0632);};}exports[_0x050a('0x2')]=function(_0x240fa){for(var _0x51c6e5=0x0,_0x830921=events[_0x050a('0x3')];_0x51c6e5<_0x830921;_0x51c6e5++){var _0x4ea654=events[_0x51c6e5];var _0x19719c=createListener(_0x050a('0x4')+_0x4ea654,_0x240fa);WhatsappInteractionEvents['on'](_0x4ea654,_0x19719c);}}; \ No newline at end of file +var _0x6b03=['remove','update','emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x6b03,0x17e));var _0x36b0=function(_0x5a054d,_0x444818){_0x5a054d=_0x5a054d-0x0;var _0x20e765=_0x6b03[_0x5a054d];return _0x20e765;};'use strict';var WhatsappInteractionEvents=require(_0x36b0('0x0'));var events=[_0x36b0('0x1'),_0x36b0('0x2'),_0x36b0('0x3')];function createListener(_0x9ff3fe,_0x302118){return function(_0x1a05dc){_0x302118[_0x36b0('0x4')](_0x9ff3fe,_0x1a05dc);};}function removeListener(_0x25eb57,_0x2dbd47){return function(){WhatsappInteractionEvents[_0x36b0('0x5')](_0x25eb57,_0x2dbd47);};}exports[_0x36b0('0x6')]=function(_0x13e659){for(var _0x24765e=0x0,_0x212ac3=events['length'];_0x24765e<_0x212ac3;_0x24765e++){var _0x2c18c9=events[_0x24765e];var _0x6ebf0=createListener(_0x36b0('0x7')+_0x2c18c9,_0x13e659);WhatsappInteractionEvents['on'](_0x2c18c9,_0x6ebf0);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index e79fa9d..c9a7d89 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 _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x378715,_0x262fef){_0x378715=_0x378715-0x0;var _0x292fa3=_0x8ef6[_0x378715];return _0x292fa3;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xc')](),interaction[_0x68ef('0x10')](_0x68ef('0x11'),_0x68ef('0x12')),controller[_0x68ef('0x13')]);router[_0x68ef('0xf')](_0x68ef('0x14'),controller['status']);router[_0x68ef('0x15')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x15')](_0x68ef('0x17'),auth['isAuthenticated'](),controller[_0x68ef('0x18')]);router[_0x68ef('0x15')](_0x68ef('0x19'),auth['isAuthenticated'](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);module[_0x68ef('0x1d')]=router; \ No newline at end of file +var _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ef6,0xf2));var _0x68ef=function(_0x872cbe,_0x89666c){_0x872cbe=_0x872cbe-0x0;var _0x487ca0=_0x8ef6[_0x872cbe];return _0x487ca0;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xc')](),interaction[_0x68ef('0x10')](_0x68ef('0x11'),_0x68ef('0x12')),controller[_0x68ef('0x13')]);router[_0x68ef('0xf')](_0x68ef('0x14'),controller['status']);router[_0x68ef('0x15')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x15')](_0x68ef('0x17'),auth['isAuthenticated'](),controller[_0x68ef('0x18')]);router[_0x68ef('0x15')](_0x68ef('0x19'),auth['isAuthenticated'](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);module[_0x68ef('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 35c9a7a..1ecb82a 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 _0xc912=['BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out','STRING','DATE'];(function(_0x35e683,_0x128119){var _0x580795=function(_0x1facd4){while(--_0x1facd4){_0x35e683['push'](_0x35e683['shift']());}};_0x580795(++_0x128119);}(_0xc912,0xd0));var _0x2c91=function(_0xa27ec4,_0x5db07d){_0xa27ec4=_0xa27ec4-0x0;var _0x123a39=_0xc912[_0xa27ec4];return _0x123a39;};'use strict';var Sequelize=require(_0x2c91('0x0'));module[_0x2c91('0x1')]={'body':{'type':Sequelize[_0x2c91('0x2')](_0x2c91('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c91('0x4')]('in',_0x2c91('0x5')),'defaultValue':_0x2c91('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2c91('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2c91('0x7')]},'secret':{'type':Sequelize[_0x2c91('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2c91('0x6')]},'providerResponse':{'type':Sequelize[_0x2c91('0x2')]}}; \ No newline at end of file +var _0xc89a=['medium','BOOLEAN','ENUM','out','STRING','TEXT','exports'];(function(_0x3ade0f,_0x2bc5c9){var _0x3f1b21=function(_0x12cd07){while(--_0x12cd07){_0x3ade0f['push'](_0x3ade0f['shift']());}};_0x3f1b21(++_0x2bc5c9);}(_0xc89a,0x12c));var _0xac89=function(_0x1b682a,_0x5ee2ce){_0x1b682a=_0x1b682a-0x0;var _0x2be4fb=_0xc89a[_0x1b682a];return _0x2be4fb;};'use strict';var Sequelize=require('sequelize');module[_0xac89('0x0')]={'body':{'type':Sequelize['TEXT'](_0xac89('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xac89('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xac89('0x3')]('in','out'),'defaultValue':_0xac89('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xac89('0x5')](0xbe)},'phone':{'type':Sequelize[_0xac89('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xac89('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xac89('0x5')]},'providerResponse':{'type':Sequelize[_0xac89('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b3df01e..24455be 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 _0xdf4d=['WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','WhatsappMessage','findAll','catch','show','find','create','body','params','describe','../../config/logger','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','whatsapp-interactions','whatsapp','RejectMessage','rejectMessage','SIP/%s','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x29b6ed,_0x2ca5fc){var _0x1e9926=function(_0x4e3043){while(--_0x4e3043){_0x29b6ed['push'](_0x29b6ed['shift']());}};_0x1e9926(++_0x2ca5fc);}(_0xdf4d,0x161));var _0xddf4=function(_0x3e3dd4,_0x513af){_0x3e3dd4=_0x3e3dd4-0x0;var _0x19e439=_0xdf4d[_0x3e3dd4];return _0x19e439;};'use strict';var pdf=require(_0xddf4('0x0'));var emlformat=require(_0xddf4('0x1'));var rimraf=require(_0xddf4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddf4('0x3'));var rp=require('request-promise');var moment=require(_0xddf4('0x4'));var BPromise=require(_0xddf4('0x5'));var Mustache=require(_0xddf4('0x6'));var util=require(_0xddf4('0x7'));var path=require(_0xddf4('0x8'));var sox=require(_0xddf4('0x9'));var csv=require(_0xddf4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddf4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xddf4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xddf4('0xd'));var Papa=require('papaparse');var Redis=require(_0xddf4('0xe'));var authService=require(_0xddf4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xddf4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xddf4('0x11'));var utils=require(_0xddf4('0x12'));var config=require(_0xddf4('0x13'));var licenseUtil=require(_0xddf4('0x14'));var db=require(_0xddf4('0x15'))['db'];config[_0xddf4('0x16')]=_[_0xddf4('0x17')](config[_0xddf4('0x16')],{'host':_0xddf4('0x18'),'port':0x18eb});var socket=require(_0xddf4('0x19'))(new Redis(config[_0xddf4('0x16')]));require(_0xddf4('0x1a'))[_0xddf4('0x1b')](socket);var jayson=require(_0xddf4('0x1c'));var client=jayson[_0xddf4('0x1d')][_0xddf4('0x1e')]({'port':0x232c});var client9002=jayson[_0xddf4('0x1d')][_0xddf4('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x241625,_0x17e3db,_0x18bba6,_0x3890e0){return new BPromise(function(_0x16b55b,_0x1e4a84){var _0x3c5e13=_0x3890e0||client;return _0x3c5e13[_0xddf4('0x1f')](_0x241625,_0x18bba6)[_0xddf4('0x20')](function(_0x58de72){logger[_0xddf4('0x21')](_0xddf4('0x22'),_0x17e3db,_0xddf4('0x23'));logger[_0xddf4('0x24')](_0xddf4('0x25'),_0x17e3db,_0xddf4('0x23'),JSON[_0xddf4('0x26')](_0x58de72));if(_0x58de72[_0xddf4('0x27')]){if(_0x58de72[_0xddf4('0x27')][_0xddf4('0x28')]===0x1f4){logger[_0xddf4('0x27')](_0xddf4('0x22'),_0x17e3db,_0x58de72[_0xddf4('0x27')][_0xddf4('0x29')]);return _0x1e4a84(_0x58de72['error']['message']);}logger[_0xddf4('0x27')](_0xddf4('0x22'),_0x17e3db,_0x58de72[_0xddf4('0x27')]['message']);return _0x16b55b(_0x58de72[_0xddf4('0x27')][_0xddf4('0x29')]);}else{logger['info'](_0xddf4('0x22'),_0x17e3db,_0xddf4('0x23'));_0x16b55b(_0x58de72[_0xddf4('0x2a')][_0xddf4('0x29')]);}})['catch'](function(_0x57c028){logger[_0xddf4('0x27')](_0xddf4('0x22'),_0x17e3db,_0x57c028);_0x1e4a84(_0x57c028);});});}function respondWithStatusCode(_0x329660,_0x532c73){_0x532c73=_0x532c73||0xcc;return function(_0x35f8d8){if(_0x35f8d8){return _0x329660[_0xddf4('0x2b')](_0x532c73);}return _0x329660['status'](_0x532c73)[_0xddf4('0x2c')]();};}function respondWithResult(_0x312890,_0x41e00d){_0x41e00d=_0x41e00d||0xc8;return function(_0x50fcaf){if(_0x50fcaf){return _0x312890[_0xddf4('0x2d')](_0x41e00d)[_0xddf4('0x2e')](_0x50fcaf);}};}function respondWithFilteredResult(_0x56a553,_0x455aaf){return function(_0x5c37e7){if(_0x5c37e7){var _0x35ba1f=_0x5c37e7[_0xddf4('0x2f')],_0x2b2bd4=_0x455aaf[_0xddf4('0x30')],_0x49c731=_0x455aaf[_0xddf4('0x30')]+_0x455aaf[_0xddf4('0x31')],_0x2c22be;if(_0x49c731>=_0x35ba1f){_0x49c731=_0x35ba1f;_0x2c22be=0xc8;}else{_0x2c22be=0xce;}_0x56a553[_0xddf4('0x2d')](_0x2c22be);return _0x56a553[_0xddf4('0x32')](_0xddf4('0x33'),_0x2b2bd4+'-'+_0x49c731+'/'+_0x35ba1f)[_0xddf4('0x2e')](_0x5c37e7);}return null;};}function patchUpdates(_0x44d4cc){return function(_0x2a998b){try{jsonpatch['apply'](_0x2a998b,_0x44d4cc,!![]);}catch(_0x1b8fc9){return BPromise[_0xddf4('0x34')](_0x1b8fc9);}return _0x2a998b[_0xddf4('0x35')]();};}function saveUpdates(_0xbfbc60,_0x30ae34){return function(_0x563fc4){if(_0x563fc4){return _0x563fc4[_0xddf4('0x36')](_0xbfbc60)[_0xddf4('0x20')](function(_0x26d2e7){return _0x26d2e7;});}return null;};}function removeEntity(_0x2f3f8f,_0x5114f3){return function(_0x4d96cb){if(_0x4d96cb){return _0x4d96cb[_0xddf4('0x37')]()['then'](function(){_0x2f3f8f[_0xddf4('0x2d')](0xcc)[_0xddf4('0x2c')]();});}};}function handleEntityNotFound(_0xc24f06,_0x3d5554){return function(_0x1de296){if(!_0x1de296){_0xc24f06['sendStatus'](0x194);}return _0x1de296;};}function handleError(_0x3e6aaf,_0x149809){_0x149809=_0x149809||0x1f4;return function(_0x387a8a){logger[_0xddf4('0x27')](_0x387a8a['stack']);if(_0x387a8a[_0xddf4('0x38')]){delete _0x387a8a[_0xddf4('0x38')];}_0x3e6aaf[_0xddf4('0x2d')](_0x149809)[_0xddf4('0x39')](_0x387a8a);};}exports[_0xddf4('0x3a')]=function(_0x2af322,_0x459f12){var _0x53f067={},_0x5e4e93={},_0x55f7bc={'count':0x0,'rows':[]};var _0x1891a2=_[_0xddf4('0x3b')](db['WhatsappMessage'][_0xddf4('0x3c')],function(_0x550a1c){return{'name':_0x550a1c[_0xddf4('0x3d')],'type':_0x550a1c['type'][_0xddf4('0x3e')]};});_0x5e4e93[_0xddf4('0x3f')]=_[_0xddf4('0x3b')](_0x1891a2,_0xddf4('0x38'));_0x5e4e93['query']=_[_0xddf4('0x40')](_0x2af322['query']);_0x5e4e93['filters']=_[_0xddf4('0x41')](_0x5e4e93[_0xddf4('0x3f')],_0x5e4e93[_0xddf4('0x42')]);_0x53f067[_0xddf4('0x43')]=_[_0xddf4('0x41')](_0x5e4e93[_0xddf4('0x3f')],qs[_0xddf4('0x44')](_0x2af322[_0xddf4('0x42')][_0xddf4('0x44')]));_0x53f067[_0xddf4('0x43')]=_0x53f067[_0xddf4('0x43')][_0xddf4('0x45')]?_0x53f067['attributes']:_0x5e4e93[_0xddf4('0x3f')];if(!_0x2af322[_0xddf4('0x42')][_0xddf4('0x46')]('nolimit')){_0x53f067[_0xddf4('0x31')]=qs[_0xddf4('0x31')](_0x2af322[_0xddf4('0x42')][_0xddf4('0x31')]);_0x53f067[_0xddf4('0x30')]=qs[_0xddf4('0x30')](_0x2af322[_0xddf4('0x42')][_0xddf4('0x30')]);}_0x53f067[_0xddf4('0x47')]=qs[_0xddf4('0x48')](_0x2af322[_0xddf4('0x42')][_0xddf4('0x48')]);_0x53f067['where']=qs[_0xddf4('0x49')](_[_0xddf4('0x4a')](_0x2af322[_0xddf4('0x42')],_0x5e4e93[_0xddf4('0x49')]),_0x1891a2);if(_0x2af322[_0xddf4('0x42')][_0xddf4('0x4b')]){_0x53f067['where']=_[_0xddf4('0x4c')](_0x53f067[_0xddf4('0x4d')],{'$or':_['map'](_0x1891a2,function(_0x4a4175){if(_0x4a4175[_0xddf4('0x4e')]!==_0xddf4('0x4f')){var _0xef5924={};_0xef5924[_0x4a4175[_0xddf4('0x38')]]={'$like':'%'+_0x2af322[_0xddf4('0x42')][_0xddf4('0x4b')]+'%'};return _0xef5924;}})});}_0x53f067=_['merge']({},_0x53f067,_0x2af322[_0xddf4('0x50')]);var _0x580843={'where':_0x53f067[_0xddf4('0x4d')]};return db['WhatsappMessage'][_0xddf4('0x2f')](_0x580843)[_0xddf4('0x20')](function(_0x441420){_0x55f7bc['count']=_0x441420;if(_0x2af322[_0xddf4('0x42')][_0xddf4('0x51')]){_0x53f067['include']=[{'all':!![]}];}return db[_0xddf4('0x52')][_0xddf4('0x53')](_0x53f067);})[_0xddf4('0x20')](function(_0x1884a8){_0x55f7bc['rows']=_0x1884a8;return _0x55f7bc;})['then'](respondWithFilteredResult(_0x459f12,_0x53f067))[_0xddf4('0x54')](handleError(_0x459f12,null));};exports[_0xddf4('0x55')]=function(_0x2d2076,_0x5f567d){var _0x1292df={'raw':!![],'where':{'id':_0x2d2076['params']['id']}},_0x4b8718={};_0x4b8718[_0xddf4('0x3f')]=_[_0xddf4('0x40')](db[_0xddf4('0x52')][_0xddf4('0x3c')]);_0x4b8718['query']=_[_0xddf4('0x40')](_0x2d2076[_0xddf4('0x42')]);_0x4b8718[_0xddf4('0x49')]=_[_0xddf4('0x41')](_0x4b8718['model'],_0x4b8718['query']);_0x1292df['attributes']=_[_0xddf4('0x41')](_0x4b8718[_0xddf4('0x3f')],qs[_0xddf4('0x44')](_0x2d2076['query'][_0xddf4('0x44')]));_0x1292df['attributes']=_0x1292df[_0xddf4('0x43')][_0xddf4('0x45')]?_0x1292df[_0xddf4('0x43')]:_0x4b8718[_0xddf4('0x3f')];if(_0x2d2076[_0xddf4('0x42')][_0xddf4('0x51')]){_0x1292df['include']=[{'all':!![]}];}_0x1292df=_[_0xddf4('0x4c')]({},_0x1292df,_0x2d2076[_0xddf4('0x50')]);return db[_0xddf4('0x52')][_0xddf4('0x56')](_0x1292df)['then'](handleEntityNotFound(_0x5f567d,null))[_0xddf4('0x20')](respondWithResult(_0x5f567d,null))['catch'](handleError(_0x5f567d,null));};exports[_0xddf4('0x57')]=function(_0x1e523a,_0x406faa){return db[_0xddf4('0x52')][_0xddf4('0x57')](_0x1e523a[_0xddf4('0x58')],{})[_0xddf4('0x20')](respondWithResult(_0x406faa,0xc9))[_0xddf4('0x54')](handleError(_0x406faa,null));};exports[_0xddf4('0x36')]=function(_0x138230,_0x1f808a){if(_0x138230[_0xddf4('0x58')]['id']){delete _0x138230[_0xddf4('0x58')]['id'];}return db[_0xddf4('0x52')][_0xddf4('0x56')]({'where':{'id':_0x138230[_0xddf4('0x59')]['id']}})['then'](handleEntityNotFound(_0x1f808a,null))[_0xddf4('0x20')](saveUpdates(_0x138230[_0xddf4('0x58')],null))[_0xddf4('0x20')](respondWithResult(_0x1f808a,null))[_0xddf4('0x54')](handleError(_0x1f808a,null));};exports[_0xddf4('0x37')]=function(_0x4582c0,_0x42578b){return db[_0xddf4('0x52')][_0xddf4('0x56')]({'where':{'id':_0x4582c0[_0xddf4('0x59')]['id']}})[_0xddf4('0x20')](handleEntityNotFound(_0x42578b,null))[_0xddf4('0x20')](removeEntity(_0x42578b,null))[_0xddf4('0x54')](handleError(_0x42578b,null));};exports[_0xddf4('0x5a')]=function(_0x48aacc,_0x441f0a){return db['WhatsappMessage']['describe']()[_0xddf4('0x20')](respondWithResult(_0x441f0a,null))[_0xddf4('0x54')](handleError(_0x441f0a,null));};var interaction_log=require(_0xddf4('0x5b'))('whatsapp-interactions');exports[_0xddf4('0x5c')]=function(_0x435ca4,_0xbbfe9d,_0x183706){var _0x3c1c53={'agent':{},'channel':'whatsapp'};if(_0x435ca4[_0xddf4('0x58')]['id']){delete _0x435ca4['body']['id'];}_0x435ca4[_0xddf4('0x58')][_0xddf4('0x5d')]=!![];_0x435ca4['body']['readAt']=moment()[_0xddf4('0x5e')](_0xddf4('0x5f'));_0x435ca4['body'][_0xddf4('0x60')]=_0x435ca4['body']['UserId']||_0x435ca4[_0xddf4('0x61')]['id'];_0x3c1c53['agent']['id']=_0x435ca4['body']['UserId'];return db['WhatsappMessage'][_0xddf4('0x56')]({'where':{'id':_0x435ca4[_0xddf4('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xddf4('0x62')}]})[_0xddf4('0x20')](handleEntityNotFound(_0xbbfe9d,null))[_0xddf4('0x20')](saveUpdates(_0x435ca4[_0xddf4('0x58')],null))[_0xddf4('0x20')](function(_0x547f8c){if(_0x547f8c){_0x3c1c53[_0xddf4('0x29')]=_0x547f8c[_0xddf4('0x63')]({'plain':!![]});return db[_0xddf4('0x64')]['find']({'where':{'id':_0x547f8c[_0xddf4('0x65')]}});}return null;})[_0xddf4('0x20')](handleEntityNotFound(_0xbbfe9d,null))[_0xddf4('0x20')](function(_0x3383de){if(_0x3383de){return _0x3383de[_0xddf4('0x36')]({'UserId':_0x435ca4[_0xddf4('0x58')]['UserId'],'read1stAt':_[_0xddf4('0x66')](_0x3383de[_0xddf4('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xddf4('0x20')](function(_0x1335f2){if(_0x1335f2){_0x3c1c53[_0xddf4('0x68')]=_0x1335f2[_0xddf4('0x63')]({'plain':!![]});interaction_log[_0xddf4('0x21')](_0xddf4('0x69'),_0x435ca4[_0xddf4('0x61')]['id'],_0x435ca4['user'][_0xddf4('0x38')],_0x435ca4[_0xddf4('0x61')][_0xddf4('0x6a')],_0x3c1c53[_0xddf4('0x68')]['id'],_0x435ca4[_0xddf4('0x58')]?JSON[_0xddf4('0x26')](_0x435ca4[_0xddf4('0x58')]):_0xddf4('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xddf4('0x6c'),_0x3c1c53);}return null;})['then'](function(_0x80862d){if(_0x80862d){if(_0x435ca4[_0xddf4('0x58')][_0xddf4('0x6d')]){_0x3c1c53[_0xddf4('0x29')][_0xddf4('0x6e')]=util[_0xddf4('0x5e')]('SIP/%s',_0x435ca4[_0xddf4('0x61')]['name']);_0x3c1c53['message'][_0xddf4('0x6f')]=_0x3c1c53[_0xddf4('0x6f')];_0x3c1c53[_0xddf4('0x29')][_0xddf4('0x70')]='accept';return respondWithRpcPromise(_0xddf4('0x71'),'EventManager',{'event':_0xddf4('0x72'),'message':_0x3c1c53[_0xddf4('0x29')]},client9002)['then'](function(){return _0x3c1c53;});}return _0x3c1c53;}return null;})['then'](respondWithResult(_0xbbfe9d,null))['catch'](handleError(_0xbbfe9d,null));};var interaction_log=require(_0xddf4('0x5b'))(_0xddf4('0x73'));exports[_0xddf4('0x34')]=function(_0x2a2525,_0xa1b323,_0x355771){var _0x36bd45={'agent':{},'channel':_0xddf4('0x74')};if(_0x2a2525[_0xddf4('0x58')]['id']){delete _0x2a2525[_0xddf4('0x58')]['id'];}_0x2a2525[_0xddf4('0x58')][_0xddf4('0x60')]=_0x2a2525[_0xddf4('0x58')]['UserId']||_0x2a2525[_0xddf4('0x61')]['id'];_0x36bd45['agent']['id']=_0x2a2525['body'][_0xddf4('0x60')];return db[_0xddf4('0x52')][_0xddf4('0x56')]({'where':{'id':_0x2a2525[_0xddf4('0x59')]['id'],'UserId':null}})[_0xddf4('0x20')](handleEntityNotFound(_0xa1b323,null))[_0xddf4('0x20')](function(_0x3b42e2){if(_0x3b42e2){_0x36bd45['message']=_0x3b42e2[_0xddf4('0x63')]({'plain':!![]});return db[_0xddf4('0x64')][_0xddf4('0x56')]({'where':{'id':_0x3b42e2[_0xddf4('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xa1b323,null))['then'](function(_0x2ecfdc){if(_0x2ecfdc){_0x36bd45['interaction']=_0x2ecfdc[_0xddf4('0x63')]({'plain':!![]});interaction_log[_0xddf4('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a2525[_0xddf4('0x61')]['id'],_0x2a2525[_0xddf4('0x61')][_0xddf4('0x38')],_0x2a2525[_0xddf4('0x61')][_0xddf4('0x6a')],_0x36bd45[_0xddf4('0x68')]['id'],_0x2a2525[_0xddf4('0x58')]?JSON[_0xddf4('0x26')](_0x2a2525['body']):_0xddf4('0x6b'));return respondWithRpcPromise(_0xddf4('0x75'),_0xddf4('0x76'),_0x36bd45);}return null;})[_0xddf4('0x20')](function(_0x3819b9){if(_0x3819b9){_0x3819b9[_0xddf4('0x29')]['interface']=util[_0xddf4('0x5e')](_0xddf4('0x77'),_0x2a2525[_0xddf4('0x61')][_0xddf4('0x38')]);_0x3819b9['message']['channel']=_0x36bd45[_0xddf4('0x6f')];_0x3819b9[_0xddf4('0x29')]['event']=_0xddf4('0x34');respondWithRpcPromise(_0xddf4('0x71'),_0xddf4('0x71'),{'event':_0xddf4('0x78'),'message':_0x3819b9[_0xddf4('0x29')]},client9002);return _0x36bd45;}return null;})['then'](respondWithResult(_0xa1b323,null))[_0xddf4('0x54')](handleError(_0xa1b323,null));};exports[_0xddf4('0x2d')]=function(_0x581b22,_0x30ce8e,_0x340389){if(_0x581b22[_0xddf4('0x58')]['id']){delete _0x581b22[_0xddf4('0x58')]['id'];}var _0x143e9c;return db['WhatsappMessage']['find']({'where':{'id':_0x581b22[_0xddf4('0x59')]['id']}})[_0xddf4('0x20')](handleEntityNotFound(_0x30ce8e,null))[_0xddf4('0x20')](function(_0x25d7ff){if(_0x25d7ff){_0x143e9c=_0x25d7ff;return db['WhatsappAccount'][_0xddf4('0x56')]({'where':{'id':_0x25d7ff[_0xddf4('0x79')]}});}})[_0xddf4('0x20')](handleEntityNotFound(_0x30ce8e,null))[_0xddf4('0x20')](function(_0x50948b){if(_0x50948b){logger[_0xddf4('0x24')](_0xddf4('0x7a'),'status',_0xddf4('0x7b'),_0x50948b['type'],util[_0xddf4('0x7c')](_0x581b22[_0xddf4('0x58')],{'showHidden':![],'depth':null}));switch(_0x50948b[_0xddf4('0x4e')]){case'twilio':if(_0x581b22[_0xddf4('0x58')]['MessageSid']&&_0x581b22[_0xddf4('0x58')][_0xddf4('0x7d')]===_0x143e9c[_0xddf4('0x7e')]&&_0x581b22[_0xddf4('0x58')]['MessageStatus']&&_0x581b22[_0xddf4('0x58')][_0xddf4('0x7f')]===_0xddf4('0x5d')){return _0x143e9c[_0xddf4('0x36')]({'read':!![]});}else{logger[_0xddf4('0x27')](_0xddf4('0x80'),_0xddf4('0x2d'),_0xddf4('0x81'),util[_0xddf4('0x7c')](_0x581b22['body'],{'showHidden':![],'depth':null}));}break;}return _0x143e9c;}})[_0xddf4('0x20')](respondWithResult(_0x30ce8e,null))[_0xddf4('0x54')](handleError(_0x30ce8e,null));}; \ No newline at end of file +var _0x5ed6=['query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','agent','UserId','CmContact','Contact','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','reject','WhatsappInteractionId','RejectMessage','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','sendStatus','end','json','count','offset','limit','set','save','update','destroy','status','stack','name','send','index','WhatsappMessage','rawAttributes','key'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x5ed6,0x142));var _0x65ed=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0x5ed6[_0x4c2dfc];return _0xfd728d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x65ed('0x2'));var BPromise=require(_0x65ed('0x3'));var Mustache=require(_0x65ed('0x4'));var util=require(_0x65ed('0x5'));var path=require(_0x65ed('0x6'));var sox=require(_0x65ed('0x7'));var csv=require(_0x65ed('0x8'));var ejs=require(_0x65ed('0x9'));var fs=require('fs');var fs_extra=require(_0x65ed('0xa'));var _=require(_0x65ed('0xb'));var squel=require(_0x65ed('0xc'));var crypto=require('crypto');var jsforce=require(_0x65ed('0xd'));var deskjs=require(_0x65ed('0xe'));var toCsv=require(_0x65ed('0x8'));var querystring=require(_0x65ed('0xf'));var Papa=require(_0x65ed('0x10'));var Redis=require(_0x65ed('0x11'));var authService=require(_0x65ed('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65ed('0x13'));var logger=require(_0x65ed('0x14'))(_0x65ed('0x15'));var utils=require(_0x65ed('0x16'));var config=require(_0x65ed('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x65ed('0x18'))['db'];config[_0x65ed('0x19')]=_[_0x65ed('0x1a')](config[_0x65ed('0x19')],{'host':_0x65ed('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65ed('0x19')]));require(_0x65ed('0x1c'))[_0x65ed('0x1d')](socket);var jayson=require(_0x65ed('0x1e'));var client=jayson[_0x65ed('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x65ed('0x1f')][_0x65ed('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x54f8de,_0x5d7608,_0xa4effb,_0x553d82){return new BPromise(function(_0x32df26,_0x4bc3f9){var _0x2388f0=_0x553d82||client;return _0x2388f0[_0x65ed('0x21')](_0x54f8de,_0xa4effb)[_0x65ed('0x22')](function(_0x214bda){logger[_0x65ed('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5d7608,_0x65ed('0x24'));logger['debug'](_0x65ed('0x25'),_0x5d7608,_0x65ed('0x24'),JSON[_0x65ed('0x26')](_0x214bda));if(_0x214bda['error']){if(_0x214bda[_0x65ed('0x27')][_0x65ed('0x28')]===0x1f4){logger[_0x65ed('0x27')](_0x65ed('0x29'),_0x5d7608,_0x214bda[_0x65ed('0x27')]['message']);return _0x4bc3f9(_0x214bda[_0x65ed('0x27')][_0x65ed('0x2a')]);}logger[_0x65ed('0x27')](_0x65ed('0x29'),_0x5d7608,_0x214bda[_0x65ed('0x27')]['message']);return _0x32df26(_0x214bda[_0x65ed('0x27')][_0x65ed('0x2a')]);}else{logger['info'](_0x65ed('0x29'),_0x5d7608,'request\x20sent');_0x32df26(_0x214bda[_0x65ed('0x2b')][_0x65ed('0x2a')]);}})['catch'](function(_0x3d88f4){logger['error'](_0x65ed('0x29'),_0x5d7608,_0x3d88f4);_0x4bc3f9(_0x3d88f4);});});}function respondWithStatusCode(_0x17b186,_0x132996){_0x132996=_0x132996||0xcc;return function(_0x316e5c){if(_0x316e5c){return _0x17b186[_0x65ed('0x2c')](_0x132996);}return _0x17b186['status'](_0x132996)[_0x65ed('0x2d')]();};}function respondWithResult(_0x5ddf4f,_0x3064cb){_0x3064cb=_0x3064cb||0xc8;return function(_0x27963a){if(_0x27963a){return _0x5ddf4f['status'](_0x3064cb)[_0x65ed('0x2e')](_0x27963a);}};}function respondWithFilteredResult(_0x29adb9,_0x31ff37){return function(_0x3cf2bb){if(_0x3cf2bb){var _0x594f42=_0x3cf2bb[_0x65ed('0x2f')],_0x4001bb=_0x31ff37['offset'],_0x458e61=_0x31ff37[_0x65ed('0x30')]+_0x31ff37[_0x65ed('0x31')],_0x420033;if(_0x458e61>=_0x594f42){_0x458e61=_0x594f42;_0x420033=0xc8;}else{_0x420033=0xce;}_0x29adb9['status'](_0x420033);return _0x29adb9[_0x65ed('0x32')]('Content-Range',_0x4001bb+'-'+_0x458e61+'/'+_0x594f42)['json'](_0x3cf2bb);}return null;};}function patchUpdates(_0x4013e3){return function(_0x38ca62){try{jsonpatch['apply'](_0x38ca62,_0x4013e3,!![]);}catch(_0xd73ab6){return BPromise['reject'](_0xd73ab6);}return _0x38ca62[_0x65ed('0x33')]();};}function saveUpdates(_0x1f7eb1,_0x39c31c){return function(_0x53faf9){if(_0x53faf9){return _0x53faf9[_0x65ed('0x34')](_0x1f7eb1)[_0x65ed('0x22')](function(_0x47734c){return _0x47734c;});}return null;};}function removeEntity(_0x14194d,_0x258474){return function(_0x3eeaa8){if(_0x3eeaa8){return _0x3eeaa8[_0x65ed('0x35')]()['then'](function(){_0x14194d[_0x65ed('0x36')](0xcc)[_0x65ed('0x2d')]();});}};}function handleEntityNotFound(_0x1ff17c,_0x2915cc){return function(_0x6cd2ac){if(!_0x6cd2ac){_0x1ff17c['sendStatus'](0x194);}return _0x6cd2ac;};}function handleError(_0x46c08e,_0x297bd4){_0x297bd4=_0x297bd4||0x1f4;return function(_0x45bd53){logger[_0x65ed('0x27')](_0x45bd53[_0x65ed('0x37')]);if(_0x45bd53['name']){delete _0x45bd53[_0x65ed('0x38')];}_0x46c08e[_0x65ed('0x36')](_0x297bd4)[_0x65ed('0x39')](_0x45bd53);};}exports[_0x65ed('0x3a')]=function(_0x3bd9a4,_0x281376){var _0x3a34b2={},_0x4b248f={},_0x4f09f3={'count':0x0,'rows':[]};var _0x2d22b8=_['map'](db[_0x65ed('0x3b')][_0x65ed('0x3c')],function(_0x464c6c){return{'name':_0x464c6c['fieldName'],'type':_0x464c6c['type'][_0x65ed('0x3d')]};});_0x4b248f['model']=_['map'](_0x2d22b8,_0x65ed('0x38'));_0x4b248f[_0x65ed('0x3e')]=_['keys'](_0x3bd9a4[_0x65ed('0x3e')]);_0x4b248f['filters']=_[_0x65ed('0x3f')](_0x4b248f[_0x65ed('0x40')],_0x4b248f[_0x65ed('0x3e')]);_0x3a34b2[_0x65ed('0x41')]=_[_0x65ed('0x3f')](_0x4b248f[_0x65ed('0x40')],qs[_0x65ed('0x42')](_0x3bd9a4[_0x65ed('0x3e')][_0x65ed('0x42')]));_0x3a34b2[_0x65ed('0x41')]=_0x3a34b2[_0x65ed('0x41')]['length']?_0x3a34b2[_0x65ed('0x41')]:_0x4b248f[_0x65ed('0x40')];if(!_0x3bd9a4[_0x65ed('0x3e')][_0x65ed('0x43')](_0x65ed('0x44'))){_0x3a34b2[_0x65ed('0x31')]=qs[_0x65ed('0x31')](_0x3bd9a4[_0x65ed('0x3e')]['limit']);_0x3a34b2[_0x65ed('0x30')]=qs[_0x65ed('0x30')](_0x3bd9a4[_0x65ed('0x3e')][_0x65ed('0x30')]);}_0x3a34b2['order']=qs[_0x65ed('0x45')](_0x3bd9a4[_0x65ed('0x3e')][_0x65ed('0x45')]);_0x3a34b2[_0x65ed('0x46')]=qs[_0x65ed('0x47')](_[_0x65ed('0x48')](_0x3bd9a4[_0x65ed('0x3e')],_0x4b248f['filters']),_0x2d22b8);if(_0x3bd9a4[_0x65ed('0x3e')]['filter']){_0x3a34b2[_0x65ed('0x46')]=_['merge'](_0x3a34b2['where'],{'$or':_[_0x65ed('0x49')](_0x2d22b8,function(_0x466d21){if(_0x466d21[_0x65ed('0x4a')]!==_0x65ed('0x4b')){var _0x3019c6={};_0x3019c6[_0x466d21['name']]={'$like':'%'+_0x3bd9a4[_0x65ed('0x3e')]['filter']+'%'};return _0x3019c6;}})});}_0x3a34b2=_['merge']({},_0x3a34b2,_0x3bd9a4[_0x65ed('0x4c')]);var _0x392d49={'where':_0x3a34b2['where']};return db[_0x65ed('0x3b')][_0x65ed('0x2f')](_0x392d49)['then'](function(_0x2b280b){_0x4f09f3['count']=_0x2b280b;if(_0x3bd9a4['query'][_0x65ed('0x4d')]){_0x3a34b2[_0x65ed('0x4e')]=[{'all':!![]}];}return db[_0x65ed('0x3b')][_0x65ed('0x4f')](_0x3a34b2);})[_0x65ed('0x22')](function(_0x14eefe){_0x4f09f3[_0x65ed('0x50')]=_0x14eefe;return _0x4f09f3;})[_0x65ed('0x22')](respondWithFilteredResult(_0x281376,_0x3a34b2))[_0x65ed('0x51')](handleError(_0x281376,null));};exports[_0x65ed('0x52')]=function(_0x72a5ca,_0x173881){var _0x3f3fdd={'raw':!![],'where':{'id':_0x72a5ca[_0x65ed('0x53')]['id']}},_0x37f03d={};_0x37f03d[_0x65ed('0x40')]=_['keys'](db[_0x65ed('0x3b')][_0x65ed('0x3c')]);_0x37f03d[_0x65ed('0x3e')]=_[_0x65ed('0x54')](_0x72a5ca[_0x65ed('0x3e')]);_0x37f03d['filters']=_[_0x65ed('0x3f')](_0x37f03d[_0x65ed('0x40')],_0x37f03d[_0x65ed('0x3e')]);_0x3f3fdd[_0x65ed('0x41')]=_['intersection'](_0x37f03d[_0x65ed('0x40')],qs[_0x65ed('0x42')](_0x72a5ca[_0x65ed('0x3e')]['fields']));_0x3f3fdd[_0x65ed('0x41')]=_0x3f3fdd[_0x65ed('0x41')]['length']?_0x3f3fdd[_0x65ed('0x41')]:_0x37f03d[_0x65ed('0x40')];if(_0x72a5ca[_0x65ed('0x3e')][_0x65ed('0x4d')]){_0x3f3fdd[_0x65ed('0x4e')]=[{'all':!![]}];}_0x3f3fdd=_['merge']({},_0x3f3fdd,_0x72a5ca[_0x65ed('0x4c')]);return db[_0x65ed('0x3b')]['find'](_0x3f3fdd)[_0x65ed('0x22')](handleEntityNotFound(_0x173881,null))[_0x65ed('0x22')](respondWithResult(_0x173881,null))['catch'](handleError(_0x173881,null));};exports[_0x65ed('0x55')]=function(_0x2dde6a,_0x734764){return db[_0x65ed('0x3b')][_0x65ed('0x55')](_0x2dde6a[_0x65ed('0x56')],{})[_0x65ed('0x22')](respondWithResult(_0x734764,0xc9))['catch'](handleError(_0x734764,null));};exports['update']=function(_0x206009,_0x54a2af){if(_0x206009['body']['id']){delete _0x206009['body']['id'];}return db[_0x65ed('0x3b')][_0x65ed('0x57')]({'where':{'id':_0x206009[_0x65ed('0x53')]['id']}})[_0x65ed('0x22')](handleEntityNotFound(_0x54a2af,null))[_0x65ed('0x22')](saveUpdates(_0x206009[_0x65ed('0x56')],null))[_0x65ed('0x22')](respondWithResult(_0x54a2af,null))[_0x65ed('0x51')](handleError(_0x54a2af,null));};exports['destroy']=function(_0x310b03,_0x56c611){return db[_0x65ed('0x3b')]['find']({'where':{'id':_0x310b03[_0x65ed('0x53')]['id']}})[_0x65ed('0x22')](handleEntityNotFound(_0x56c611,null))[_0x65ed('0x22')](removeEntity(_0x56c611,null))['catch'](handleError(_0x56c611,null));};exports[_0x65ed('0x58')]=function(_0x9962a7,_0xcb8f37){return db[_0x65ed('0x3b')][_0x65ed('0x58')]()['then'](respondWithResult(_0xcb8f37,null))[_0x65ed('0x51')](handleError(_0xcb8f37,null));};var interaction_log=require(_0x65ed('0x14'))(_0x65ed('0x59'));exports[_0x65ed('0x5a')]=function(_0x1a2225,_0x13b65c,_0x37cc40){var _0x2b3c56={'agent':{},'channel':_0x65ed('0x5b')};if(_0x1a2225[_0x65ed('0x56')]['id']){delete _0x1a2225[_0x65ed('0x56')]['id'];}_0x1a2225['body'][_0x65ed('0x5c')]=!![];_0x1a2225[_0x65ed('0x56')][_0x65ed('0x5d')]=moment()[_0x65ed('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a2225[_0x65ed('0x56')]['UserId']=_0x1a2225[_0x65ed('0x56')]['UserId']||_0x1a2225['user']['id'];_0x2b3c56[_0x65ed('0x5f')]['id']=_0x1a2225[_0x65ed('0x56')][_0x65ed('0x60')];return db[_0x65ed('0x3b')][_0x65ed('0x57')]({'where':{'id':_0x1a2225[_0x65ed('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x65ed('0x61')],'as':_0x65ed('0x62')}]})['then'](handleEntityNotFound(_0x13b65c,null))[_0x65ed('0x22')](saveUpdates(_0x1a2225[_0x65ed('0x56')],null))[_0x65ed('0x22')](function(_0x5b5f34){if(_0x5b5f34){_0x2b3c56['message']=_0x5b5f34[_0x65ed('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x65ed('0x57')]({'where':{'id':_0x5b5f34['WhatsappInteractionId']}});}return null;})[_0x65ed('0x22')](handleEntityNotFound(_0x13b65c,null))[_0x65ed('0x22')](function(_0x58eff2){if(_0x58eff2){return _0x58eff2['update']({'UserId':_0x1a2225[_0x65ed('0x56')][_0x65ed('0x60')],'read1stAt':_['isNil'](_0x58eff2[_0x65ed('0x64')])?moment()[_0x65ed('0x5e')](_0x65ed('0x65')):undefined});}return null;})['then'](function(_0x4e343f){if(_0x4e343f){_0x2b3c56['interaction']=_0x4e343f[_0x65ed('0x63')]({'plain':!![]});interaction_log[_0x65ed('0x23')](_0x65ed('0x66'),_0x1a2225['user']['id'],_0x1a2225[_0x65ed('0x67')]['name'],_0x1a2225[_0x65ed('0x67')][_0x65ed('0x68')],_0x2b3c56[_0x65ed('0x69')]['id'],_0x1a2225['body']?JSON['stringify'](_0x1a2225[_0x65ed('0x56')]):_0x65ed('0x6a'));return respondWithRpcPromise(_0x65ed('0x6b'),_0x65ed('0x6c'),_0x2b3c56);}return null;})[_0x65ed('0x22')](function(_0xbdb773){if(_0xbdb773){if(_0x1a2225[_0x65ed('0x56')][_0x65ed('0x6d')]){_0x2b3c56[_0x65ed('0x2a')][_0x65ed('0x6e')]=util[_0x65ed('0x5e')]('SIP/%s',_0x1a2225[_0x65ed('0x67')][_0x65ed('0x38')]);_0x2b3c56[_0x65ed('0x2a')][_0x65ed('0x6f')]=_0x2b3c56[_0x65ed('0x6f')];_0x2b3c56[_0x65ed('0x2a')][_0x65ed('0x70')]=_0x65ed('0x5a');return respondWithRpcPromise(_0x65ed('0x71'),_0x65ed('0x71'),{'event':_0x65ed('0x72'),'message':_0x2b3c56[_0x65ed('0x2a')]},client9002)[_0x65ed('0x22')](function(){return _0x2b3c56;});}return _0x2b3c56;}return null;})['then'](respondWithResult(_0x13b65c,null))['catch'](handleError(_0x13b65c,null));};var interaction_log=require('../../config/logger')(_0x65ed('0x59'));exports[_0x65ed('0x73')]=function(_0x4ba627,_0x228947,_0x40378c){var _0xbc2ddb={'agent':{},'channel':'whatsapp'};if(_0x4ba627[_0x65ed('0x56')]['id']){delete _0x4ba627[_0x65ed('0x56')]['id'];}_0x4ba627['body']['UserId']=_0x4ba627['body']['UserId']||_0x4ba627[_0x65ed('0x67')]['id'];_0xbc2ddb[_0x65ed('0x5f')]['id']=_0x4ba627[_0x65ed('0x56')][_0x65ed('0x60')];return db[_0x65ed('0x3b')]['find']({'where':{'id':_0x4ba627[_0x65ed('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x228947,null))[_0x65ed('0x22')](function(_0x55439f){if(_0x55439f){_0xbc2ddb['message']=_0x55439f['get']({'plain':!![]});return db['WhatsappInteraction'][_0x65ed('0x57')]({'where':{'id':_0x55439f[_0x65ed('0x74')]}});}return null;})[_0x65ed('0x22')](handleEntityNotFound(_0x228947,null))[_0x65ed('0x22')](function(_0x265d6d){if(_0x265d6d){_0xbc2ddb[_0x65ed('0x69')]=_0x265d6d[_0x65ed('0x63')]({'plain':!![]});interaction_log[_0x65ed('0x23')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ba627[_0x65ed('0x67')]['id'],_0x4ba627[_0x65ed('0x67')]['name'],_0x4ba627[_0x65ed('0x67')][_0x65ed('0x68')],_0xbc2ddb[_0x65ed('0x69')]['id'],_0x4ba627['body']?JSON[_0x65ed('0x26')](_0x4ba627['body']):_0x65ed('0x6a'));return respondWithRpcPromise(_0x65ed('0x75'),'rejectMessage',_0xbc2ddb);}return null;})[_0x65ed('0x22')](function(_0x1ae468){if(_0x1ae468){_0x1ae468[_0x65ed('0x2a')][_0x65ed('0x6e')]=util[_0x65ed('0x5e')](_0x65ed('0x76'),_0x4ba627['user'][_0x65ed('0x38')]);_0x1ae468['message'][_0x65ed('0x6f')]=_0xbc2ddb[_0x65ed('0x6f')];_0x1ae468['message']['event']=_0x65ed('0x73');respondWithRpcPromise(_0x65ed('0x71'),_0x65ed('0x71'),{'event':_0x65ed('0x77'),'message':_0x1ae468[_0x65ed('0x2a')]},client9002);return _0xbc2ddb;}return null;})[_0x65ed('0x22')](respondWithResult(_0x228947,null))[_0x65ed('0x51')](handleError(_0x228947,null));};exports[_0x65ed('0x36')]=function(_0x4c78cd,_0x16cd94,_0x3d4dc8){if(_0x4c78cd[_0x65ed('0x56')]['id']){delete _0x4c78cd['body']['id'];}var _0x163633;return db[_0x65ed('0x3b')]['find']({'where':{'id':_0x4c78cd[_0x65ed('0x53')]['id']}})['then'](handleEntityNotFound(_0x16cd94,null))[_0x65ed('0x22')](function(_0x233364){if(_0x233364){_0x163633=_0x233364;return db[_0x65ed('0x78')]['find']({'where':{'id':_0x233364[_0x65ed('0x79')]}});}})[_0x65ed('0x22')](handleEntityNotFound(_0x16cd94,null))[_0x65ed('0x22')](function(_0x3fb71f){if(_0x3fb71f){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x65ed('0x36'),'received\x20delivery\x20report\x20from',_0x3fb71f['type'],util[_0x65ed('0x7a')](_0x4c78cd['body'],{'showHidden':![],'depth':null}));switch(_0x3fb71f[_0x65ed('0x4a')]){case _0x65ed('0x7b'):if(_0x4c78cd[_0x65ed('0x56')]['MessageSid']&&_0x4c78cd[_0x65ed('0x56')][_0x65ed('0x7c')]===_0x163633[_0x65ed('0x7d')]&&_0x4c78cd['body'][_0x65ed('0x7e')]&&_0x4c78cd[_0x65ed('0x56')][_0x65ed('0x7e')]==='read'){return _0x163633[_0x65ed('0x34')]({'read':!![]});}else{logger[_0x65ed('0x27')](_0x65ed('0x7f'),_0x65ed('0x36'),_0x65ed('0x7b'),util[_0x65ed('0x7a')](_0x4c78cd['body'],{'showHidden':![],'depth':null}));}break;}return _0x163633;}})[_0x65ed('0x22')](respondWithResult(_0x16cd94,null))[_0x65ed('0x51')](handleError(_0x16cd94,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index cd72d2d..f2f5f52 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(_0x12f03e,_0x320adb){var _0x5690bb=function(_0x510d61){while(--_0x510d61){_0x12f03e['push'](_0x12f03e['shift']());}};_0x5690bb(++_0x320adb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47f370,_0xe59903){_0x47f370=_0x47f370-0x0;var _0x4eb63e=_0x5f2f[_0x47f370];return _0x4eb63e;};'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 _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x40d865,_0x360683){var _0x51b1ae=function(_0x2408cb){while(--_0x2408cb){_0x40d865['push'](_0x40d865['shift']());}};_0x51b1ae(++_0x360683);}(_0x7a54,0x106));var _0x47a5=function(_0x2ed3ee,_0x585417){_0x2ed3ee=_0x2ed3ee-0x0;var _0x37b21f=_0x7a54[_0x2ed3ee];return _0x37b21f;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 2f0fa47..fc980b4 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 _0xae24=['find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/status?token=','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','out','secret','UserId','findOne','WhatsappInteractionId','update','createdAt','toLowerCase','catch','error','WhatsappAccount'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xae24,0x180));var _0x4ae2=function(_0x3aa679,_0x1f6108){_0x3aa679=_0x3aa679-0x0;var _0x4dfdb7=_0xae24[_0x3aa679];return _0x4dfdb7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ae2('0x0'))(_0x4ae2('0x1'));var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require(_0x4ae2('0x4'));var fs=require('fs');var path=require(_0x4ae2('0x5'));var rimraf=require(_0x4ae2('0x6'));var config=require(_0x4ae2('0x7'));var attributes=require(_0x4ae2('0x8'));module[_0x4ae2('0x9')]=function(_0x526b01,_0x497634){return _0x526b01[_0x4ae2('0xa')](_0x4ae2('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x4ae2('0xc')]},{'name':_0x4ae2('0xd'),'fields':[_0x4ae2('0xe')],'type':_0x4ae2('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26de8b,_0xf85fbf,_0x36b080){var _0x424614=_0x526b01[_0x4ae2('0x10')];var _0x508a1d=_0x26de8b[_0x4ae2('0x11')]({'plain':!![]});if(_0x508a1d[_0x4ae2('0x12')]['toLowerCase']()==='in'||_0x508a1d[_0x4ae2('0x12')]['toLowerCase']()===_0x4ae2('0x13')&&!_0x508a1d[_0x4ae2('0x14')]&&!_['isNil'](_0x508a1d[_0x4ae2('0x15')])){_0x424614['WhatsappInteraction'][_0x4ae2('0x16')]({'where':{'id':_0x508a1d[_0x4ae2('0x17')]}})['then'](function(_0x31d465){if(_0x31d465){_0x31d465[_0x4ae2('0x18')]({'lastMsgAt':_0x508a1d[_0x4ae2('0x19')],'lastMsgDirection':_0x508a1d[_0x4ae2('0x12')][_0x4ae2('0x1a')]()});}})[_0x4ae2('0x1b')](function(_0x4939dd){console[_0x4ae2('0x1c')](_0x4939dd);});}if(_0x508a1d[_0x4ae2('0x12')]===_0x4ae2('0x13')&&!_0x508a1d[_0x4ae2('0x14')]){var _0x5b92ae;_0x424614[_0x4ae2('0x1d')][_0x4ae2('0x1e')]({'where':{'id':_0x508a1d[_0x4ae2('0x1f')]},'raw':!![]})['then'](function(_0x16f68b){_0x5b92ae=_0x16f68b;if(_0x5b92ae&&_0x5b92ae['type']){switch(_0x5b92ae[_0x4ae2('0x20')]){case _0x4ae2('0x21'):var _0x2a5489=require('twilio');if(_0x5b92ae[_0x4ae2('0x22')]&&_0x5b92ae[_0x4ae2('0x23')]&&_0x5b92ae[_0x4ae2('0x24')]){var _0x127267=new _0x2a5489(_0x5b92ae[_0x4ae2('0x22')],_0x5b92ae[_0x4ae2('0x23')]);_0x127267[_0x4ae2('0x25')]['create']({'body':_0x508a1d[_0x4ae2('0xe')],'to':'whatsapp:'+_0x508a1d[_0x4ae2('0x24')],'from':'whatsapp:'+_0x5b92ae[_0x4ae2('0x24')],'statusCallback':_0x5b92ae[_0x4ae2('0x26')]+'/api/whatsapp/messages/'+_0x508a1d['id']+_0x4ae2('0x27')+_0x5b92ae[_0x4ae2('0x28')]})['then'](function(_0xfc5b78){if(_0xfc5b78['sid']){return _0x26de8b[_0x4ae2('0x18')]({'messageId':_0xfc5b78['sid']});}})[_0x4ae2('0x1b')](function(_0x368007){logger[_0x4ae2('0x1c')](_0x4ae2('0x29'),_0x4ae2('0x2a'),_0x4ae2('0x21'),util['inspect'](_0x368007,{'showHidden':![],'depth':null}));});}else{logger[_0x4ae2('0x1c')](_0x4ae2('0x29'),_0x4ae2('0x2a'),_0x4ae2('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x4ae2('0x2b')](function(){_0x36b080();});}else{_0x36b080();}}},'charset':_0x4ae2('0x2c'),'collate':_0x4ae2('0x2d')});}; \ No newline at end of file +var _0x04d5=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','secret','find','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally'];(function(_0x3989ce,_0x4253c1){var _0xad77b3=function(_0x12b6dc){while(--_0x12b6dc){_0x3989ce['push'](_0x3989ce['shift']());}};_0xad77b3(++_0x4253c1);}(_0x04d5,0xe1));var _0x504d=function(_0x20fc3d,_0x465cb6){_0x20fc3d=_0x20fc3d-0x0;var _0x3d9229=_0x04d5[_0x20fc3d];return _0x3d9229;};'use strict';var _=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var logger=require('../../config/logger')(_0x504d('0x2'));var moment=require(_0x504d('0x3'));var BPromise=require(_0x504d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x504d('0x5'));var rimraf=require(_0x504d('0x6'));var config=require(_0x504d('0x7'));var attributes=require(_0x504d('0x8'));module[_0x504d('0x9')]=function(_0x535671,_0x289d44){return _0x535671[_0x504d('0xa')](_0x504d('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x504d('0xc')]},{'name':_0x504d('0xd'),'fields':[_0x504d('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x155164,_0x3f0070,_0x10a7bd){var _0x378754=_0x535671['models'];var _0x1b9e95=_0x155164[_0x504d('0xf')]({'plain':!![]});if(_0x1b9e95[_0x504d('0x10')][_0x504d('0x11')]()==='in'||_0x1b9e95[_0x504d('0x10')][_0x504d('0x11')]()===_0x504d('0x12')&&!_0x1b9e95['secret']&&!_['isNil'](_0x1b9e95[_0x504d('0x13')])){_0x378754[_0x504d('0x14')][_0x504d('0x15')]({'where':{'id':_0x1b9e95[_0x504d('0x16')]}})[_0x504d('0x17')](function(_0x3954ac){if(_0x3954ac){_0x3954ac['update']({'lastMsgAt':_0x1b9e95[_0x504d('0x18')],'lastMsgDirection':_0x1b9e95['direction'][_0x504d('0x11')]()});}})[_0x504d('0x19')](function(_0x529f96){console[_0x504d('0x1a')](_0x529f96);});}if(_0x1b9e95[_0x504d('0x10')]===_0x504d('0x12')&&!_0x1b9e95[_0x504d('0x1b')]){var _0x2a7b5b;_0x378754['WhatsappAccount'][_0x504d('0x1c')]({'where':{'id':_0x1b9e95['WhatsappAccountId']},'raw':!![]})[_0x504d('0x17')](function(_0x4eec88){_0x2a7b5b=_0x4eec88;if(_0x2a7b5b&&_0x2a7b5b[_0x504d('0x1d')]){switch(_0x2a7b5b['type']){case _0x504d('0x1e'):var _0x1e2a28=require(_0x504d('0x1e'));if(_0x2a7b5b[_0x504d('0x1f')]&&_0x2a7b5b[_0x504d('0x20')]&&_0x2a7b5b['phone']){var _0x483e28=new _0x1e2a28(_0x2a7b5b[_0x504d('0x1f')],_0x2a7b5b['authToken']);_0x483e28[_0x504d('0x21')][_0x504d('0x22')]({'body':_0x1b9e95['body'],'to':_0x504d('0x23')+_0x1b9e95['phone'],'from':_0x504d('0x23')+_0x2a7b5b[_0x504d('0x24')],'statusCallback':_0x2a7b5b[_0x504d('0x25')]+'/api/whatsapp/messages/'+_0x1b9e95['id']+_0x504d('0x26')+_0x2a7b5b['token']})['then'](function(_0x218d20){if(_0x218d20[_0x504d('0x27')]){return _0x155164['update']({'messageId':_0x218d20['sid']});}})[_0x504d('0x19')](function(_0x251284){logger['error'](_0x504d('0x28'),_0x504d('0x29'),_0x504d('0x1e'),util[_0x504d('0x2a')](_0x251284,{'showHidden':![],'depth':null}));});}else{logger[_0x504d('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x504d('0x29'),_0x504d('0x1e'),_0x504d('0x2b'));}break;}}})[_0x504d('0x2c')](function(){_0x10a7bd();});}else{_0x10a7bd();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index edf93cb..3f87690 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 _0x9d7d=['stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x9d7d,0xf4));var _0xd9d7=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x9d7d[_0x57645b];return _0xe82f00;};'use strict';var _=require(_0xd9d7('0x0'));var util=require(_0xd9d7('0x1'));var moment=require(_0xd9d7('0x2'));var BPromise=require(_0xd9d7('0x3'));var rs=require(_0xd9d7('0x4'));var fs=require('fs');var Redis=require(_0xd9d7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9d7('0x6'));var logger=require(_0xd9d7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd9d7('0x8'));var client=jayson[_0xd9d7('0x9')]['http']({'port':0x232a});config[_0xd9d7('0xa')]=_[_0xd9d7('0xb')](config[_0xd9d7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd9d7('0xc'))(new Redis(config[_0xd9d7('0xa')]));require('./whatsappMessage.socket')[_0xd9d7('0xd')](socket);function respondWithRpcPromise(_0x284f5b,_0x5c5d90,_0x4cf80a){return new BPromise(function(_0x5e6afa,_0x42a11c){return client[_0xd9d7('0xe')](_0x284f5b,_0x4cf80a)['then'](function(_0xf63660){logger[_0xd9d7('0xf')](_0xd9d7('0x10'),_0x5c5d90,_0xd9d7('0x11'));logger[_0xd9d7('0x12')](_0xd9d7('0x13'),_0x5c5d90,'request\x20sent',JSON[_0xd9d7('0x14')](_0xf63660));if(_0xf63660['error']){if(_0xf63660[_0xd9d7('0x15')][_0xd9d7('0x16')]===0x1f4){logger[_0xd9d7('0x15')](_0xd9d7('0x10'),_0x5c5d90,_0xf63660[_0xd9d7('0x15')][_0xd9d7('0x17')]);return _0x42a11c(_0xf63660['error'][_0xd9d7('0x17')]);}logger[_0xd9d7('0x15')](_0xd9d7('0x10'),_0x5c5d90,_0xf63660[_0xd9d7('0x15')]['message']);return _0x5e6afa(_0xf63660[_0xd9d7('0x15')]['message']);}else{logger[_0xd9d7('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x5c5d90,_0xd9d7('0x11'));_0x5e6afa(_0xf63660[_0xd9d7('0x18')]['message']);}})[_0xd9d7('0x19')](function(_0x517f8a){logger[_0xd9d7('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5c5d90,_0x517f8a);_0x42a11c(_0x517f8a);});});}exports[_0xd9d7('0x1a')]=function(_0xf3f9e8){var _0xd7f5ef=this;return new Promise(function(_0x6f54df,_0xcb2690){return db[_0xd9d7('0x1b')][_0xd9d7('0x1c')](_0xf3f9e8[_0xd9d7('0x1d')],{'raw':_0xf3f9e8[_0xd9d7('0x1e')]?_0xf3f9e8[_0xd9d7('0x1e')][_0xd9d7('0x1f')]===undefined?!![]:![]:!![]})[_0xd9d7('0x20')](function(_0x37d4e7){logger[_0xd9d7('0xf')](_0xd9d7('0x1a'),_0xf3f9e8);logger['debug'](_0xd9d7('0x1a'),_0xf3f9e8,JSON[_0xd9d7('0x14')](_0x37d4e7));_0x6f54df(_0x37d4e7);})[_0xd9d7('0x19')](function(_0x49f59d){logger[_0xd9d7('0x15')](_0xd9d7('0x1a'),_0x49f59d[_0xd9d7('0x17')],_0xf3f9e8);_0xcb2690(_0xd7f5ef[_0xd9d7('0x15')](0x1f4,_0x49f59d[_0xd9d7('0x17')]));});});}; \ No newline at end of file +var _0x10f1=['./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x25bca6,_0xe415ea){var _0x3f8d02=function(_0x3e581b){while(--_0x3e581b){_0x25bca6['push'](_0x25bca6['shift']());}};_0x3f8d02(++_0xe415ea);}(_0x10f1,0x168));var _0x110f=function(_0x26cfd2,_0x57bb84){_0x26cfd2=_0x26cfd2-0x0;var _0x173e25=_0x10f1[_0x26cfd2];return _0x173e25;};'use strict';var _=require(_0x110f('0x0'));var util=require(_0x110f('0x1'));var moment=require(_0x110f('0x2'));var BPromise=require(_0x110f('0x3'));var rs=require(_0x110f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x110f('0x5'))['db'];var utils=require(_0x110f('0x6'));var logger=require('../../config/logger')(_0x110f('0x7'));var config=require(_0x110f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x110f('0x9')][_0x110f('0xa')]({'port':0x232a});config[_0x110f('0xb')]=_[_0x110f('0xc')](config[_0x110f('0xb')],{'host':_0x110f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x110f('0xb')]));require(_0x110f('0xe'))[_0x110f('0xf')](socket);function respondWithRpcPromise(_0x10ca29,_0x508f3a,_0x1dc060){return new BPromise(function(_0x1332cb,_0x3b1cc8){return client[_0x110f('0x10')](_0x10ca29,_0x1dc060)[_0x110f('0x11')](function(_0x5f4bbb){logger[_0x110f('0x12')](_0x110f('0x13'),_0x508f3a,_0x110f('0x14'));logger[_0x110f('0x15')](_0x110f('0x16'),_0x508f3a,_0x110f('0x14'),JSON[_0x110f('0x17')](_0x5f4bbb));if(_0x5f4bbb[_0x110f('0x18')]){if(_0x5f4bbb[_0x110f('0x18')][_0x110f('0x19')]===0x1f4){logger[_0x110f('0x18')](_0x110f('0x13'),_0x508f3a,_0x5f4bbb[_0x110f('0x18')]['message']);return _0x3b1cc8(_0x5f4bbb[_0x110f('0x18')]['message']);}logger[_0x110f('0x18')](_0x110f('0x13'),_0x508f3a,_0x5f4bbb['error']['message']);return _0x1332cb(_0x5f4bbb['error']['message']);}else{logger[_0x110f('0x12')](_0x110f('0x13'),_0x508f3a,_0x110f('0x14'));_0x1332cb(_0x5f4bbb[_0x110f('0x1a')][_0x110f('0x1b')]);}})[_0x110f('0x1c')](function(_0x30a3d7){logger[_0x110f('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x508f3a,_0x30a3d7);_0x3b1cc8(_0x30a3d7);});});}exports[_0x110f('0x1d')]=function(_0x10418e){var _0x2a019d=this;return new Promise(function(_0x563fef,_0x481788){return db[_0x110f('0x1e')][_0x110f('0x1f')](_0x10418e[_0x110f('0x20')],{'raw':_0x10418e[_0x110f('0x21')]?_0x10418e[_0x110f('0x21')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57a8eb){logger['info'](_0x110f('0x1d'),_0x10418e);logger[_0x110f('0x15')](_0x110f('0x1d'),_0x10418e,JSON[_0x110f('0x17')](_0x57a8eb));_0x563fef(_0x57a8eb);})[_0x110f('0x1c')](function(_0x377fd6){logger['error']('CreateWhatsappMessage',_0x377fd6['message'],_0x10418e);_0x481788(_0x2a019d[_0x110f('0x18')](0x1f4,_0x377fd6[_0x110f('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5040dc4..732d565 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 _0xe8cf=['length','whatsappMessage:','./whatsappMessage.events','save','removeListener','register'];(function(_0x5cddd4,_0x5e3711){var _0x44bcf2=function(_0x432d3c){while(--_0x432d3c){_0x5cddd4['push'](_0x5cddd4['shift']());}};_0x44bcf2(++_0x5e3711);}(_0xe8cf,0xb6));var _0xfe8c=function(_0x51b236,_0x31044f){_0x51b236=_0x51b236-0x0;var _0x1d5261=_0xe8cf[_0x51b236];return _0x1d5261;};'use strict';var WhatsappMessageEvents=require(_0xfe8c('0x0'));var events=[_0xfe8c('0x1'),'remove','update'];function createListener(_0x51ae39,_0x15e816){return function(_0x140fbb){_0x15e816['emit'](_0x51ae39,_0x140fbb);};}function removeListener(_0x53411a,_0x5b0f91){return function(){WhatsappMessageEvents[_0xfe8c('0x2')](_0x53411a,_0x5b0f91);};}exports[_0xfe8c('0x3')]=function(_0x11ce91){for(var _0x399f8=0x0,_0x5585f1=events[_0xfe8c('0x4')];_0x399f8<_0x5585f1;_0x399f8++){var _0x11ae88=events[_0x399f8];var _0x43a2a0=createListener(_0xfe8c('0x5')+_0x11ae88,_0x11ce91);WhatsappMessageEvents['on'](_0x11ae88,_0x43a2a0);}}; \ No newline at end of file +var _0x95d9=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x1afa3b,_0x2df634){var _0x36add4=function(_0x52f535){while(--_0x52f535){_0x1afa3b['push'](_0x1afa3b['shift']());}};_0x36add4(++_0x2df634);}(_0x95d9,0x97));var _0x995d=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x95d9[_0x2faddb];return _0x273c05;};'use strict';var WhatsappMessageEvents=require(_0x995d('0x0'));var events=[_0x995d('0x1'),_0x995d('0x2'),_0x995d('0x3')];function createListener(_0x568331,_0x3d6fa5){return function(_0x3b9a11){_0x3d6fa5[_0x995d('0x4')](_0x568331,_0x3b9a11);};}function removeListener(_0x5b44d3,_0x225c17){return function(){WhatsappMessageEvents[_0x995d('0x5')](_0x5b44d3,_0x225c17);};}exports[_0x995d('0x6')]=function(_0x226250){for(var _0xe6d244=0x0,_0x4a4d21=events[_0x995d('0x7')];_0xe6d244<_0x4a4d21;_0xe6d244++){var _0x464e22=events[_0xe6d244];var _0x351a63=createListener(_0x995d('0x8')+_0x464e22,_0x226250);WhatsappMessageEvents['on'](_0x464e22,_0x351a63);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4e2b7bb..9f88b21 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 _0x8b3d=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','destroy','delete','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x173180,_0x20df33){var _0x5675e7=function(_0x11358a){while(--_0x11358a){_0x173180['push'](_0x173180['shift']());}};_0x5675e7(++_0x20df33);}(_0x8b3d,0xab));var _0xd8b3=function(_0x389c38,_0x2621c6){_0x389c38=_0x389c38-0x0;var _0x46c89f=_0x8b3d[_0x389c38];return _0x46c89f;};'use strict';var multer=require(_0xd8b3('0x0'));var util=require(_0xd8b3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd8b3('0x2'));var router=express['Router']();var fs_extra=require(_0xd8b3('0x3'));var auth=require(_0xd8b3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd8b3('0x5'));router[_0xd8b3('0x6')]('/',auth[_0xd8b3('0x7')](),controller[_0xd8b3('0x8')]);router[_0xd8b3('0x6')](_0xd8b3('0x9'),auth[_0xd8b3('0x7')](),controller[_0xd8b3('0xa')]);router['get'](_0xd8b3('0xb'),auth[_0xd8b3('0x7')](),controller[_0xd8b3('0xc')]);router[_0xd8b3('0x6')](_0xd8b3('0xd'),auth[_0xd8b3('0x7')](),controller[_0xd8b3('0xe')]);router[_0xd8b3('0x6')](_0xd8b3('0xf'),auth[_0xd8b3('0x7')](),controller[_0xd8b3('0x10')]);router[_0xd8b3('0x6')](_0xd8b3('0x11'),auth['isAuthenticated'](),controller[_0xd8b3('0x12')]);router[_0xd8b3('0x13')]('/',auth[_0xd8b3('0x7')](),controller[_0xd8b3('0x14')]);router['post']('/:id/teams',auth[_0xd8b3('0x7')](),controller['addTeams']);router[_0xd8b3('0x13')](_0xd8b3('0x11'),auth[_0xd8b3('0x7')](),controller[_0xd8b3('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xd8b3('0xb'),auth[_0xd8b3('0x7')](),controller[_0xd8b3('0x16')]);router[_0xd8b3('0x17')]('/:id/teams',auth[_0xd8b3('0x7')](),controller['removeTeams']);router[_0xd8b3('0x17')](_0xd8b3('0x11'),auth['isAuthenticated'](),controller[_0xd8b3('0x18')]);module[_0xd8b3('0x19')]=router; \ No newline at end of file +var _0x0e98=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer'];(function(_0x3783a2,_0x310e64){var _0x2eccb4=function(_0x240eeb){while(--_0x240eeb){_0x3783a2['push'](_0x3783a2['shift']());}};_0x2eccb4(++_0x310e64);}(_0x0e98,0x14f));var _0x80e9=function(_0x151c01,_0x17a1ac){_0x151c01=_0x151c01-0x0;var _0x12bc71=_0x0e98[_0x151c01];return _0x12bc71;};'use strict';var multer=require(_0x80e9('0x0'));var util=require(_0x80e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x80e9('0x2'));var router=express[_0x80e9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x80e9('0x4'));var interaction=require(_0x80e9('0x5'));var config=require(_0x80e9('0x6'));var controller=require(_0x80e9('0x7'));router[_0x80e9('0x8')]('/',auth[_0x80e9('0x9')](),controller[_0x80e9('0xa')]);router['get'](_0x80e9('0xb'),auth[_0x80e9('0x9')](),controller[_0x80e9('0xc')]);router['get'](_0x80e9('0xd'),auth[_0x80e9('0x9')](),controller['show']);router['get']('/:id/members',auth[_0x80e9('0x9')](),controller[_0x80e9('0xe')]);router['get'](_0x80e9('0xf'),auth[_0x80e9('0x9')](),controller[_0x80e9('0x10')]);router[_0x80e9('0x8')](_0x80e9('0x11'),auth[_0x80e9('0x9')](),controller[_0x80e9('0x12')]);router['post']('/',auth[_0x80e9('0x9')](),controller['create']);router[_0x80e9('0x13')](_0x80e9('0xf'),auth[_0x80e9('0x9')](),controller['addTeams']);router[_0x80e9('0x13')](_0x80e9('0x11'),auth[_0x80e9('0x9')](),controller[_0x80e9('0x14')]);router[_0x80e9('0x15')]('/:id',auth[_0x80e9('0x9')](),controller[_0x80e9('0x16')]);router['delete'](_0x80e9('0xd'),auth[_0x80e9('0x9')](),controller[_0x80e9('0x17')]);router[_0x80e9('0x18')](_0x80e9('0xf'),auth[_0x80e9('0x9')](),controller[_0x80e9('0x19')]);router[_0x80e9('0x18')](_0x80e9('0x11'),auth[_0x80e9('0x9')](),controller[_0x80e9('0x1a')]);module[_0x80e9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a6f693f..cbd5f3b 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 _0x94df=['beepall','roundrobin','STRING','ENUM','rrmemory'];(function(_0x5772e2,_0x392722){var _0x563ba7=function(_0x1c151b){while(--_0x1c151b){_0x5772e2['push'](_0x5772e2['shift']());}};_0x563ba7(++_0x392722);}(_0x94df,0x93));var _0xf94d=function(_0x250ff1,_0x14dc01){_0x250ff1=_0x250ff1-0x0;var _0x5d2036=_0x94df[_0x250ff1];return _0x5d2036;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf94d('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf94d('0x1')](_0xf94d('0x2'),_0xf94d('0x3'),_0xf94d('0x4'))},'description':{'type':Sequelize[_0xf94d('0x0')]}}; \ No newline at end of file +var _0xd699=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x4c07e7,_0x5b2a0c){var _0x20918e=function(_0x5ccdc1){while(--_0x5ccdc1){_0x4c07e7['push'](_0x4c07e7['shift']());}};_0x20918e(++_0x5b2a0c);}(_0xd699,0xb3));var _0x9d69=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xd699[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require('sequelize');module[_0x9d69('0x0')]={'name':{'type':Sequelize[_0x9d69('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9d69('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9d69('0x3')](_0x9d69('0x4'),_0x9d69('0x5'),_0x9d69('0x6'))},'description':{'type':Sequelize[_0x9d69('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 5885671..84b04eb 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 _0x87a5=['find','sequelize','transaction','each','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','WhatsappQueues','UserProfileResource','end','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','sort','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap'];(function(_0x3e1366,_0x23f48f){var _0x27eccd=function(_0x5e9177){while(--_0x5e9177){_0x3e1366['push'](_0x3e1366['shift']());}};_0x27eccd(++_0x23f48f);}(_0x87a5,0xb3));var _0x587a=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0x87a5[_0x5401ae];return _0x286068;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x587a('0x0'));var rimraf=require(_0x587a('0x1'));var zipdir=require(_0x587a('0x2'));var jsonpatch=require(_0x587a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x587a('0x4'));var Mustache=require(_0x587a('0x5'));var util=require(_0x587a('0x6'));var path=require('path');var sox=require(_0x587a('0x7'));var csv=require('to-csv');var ejs=require(_0x587a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x587a('0x9'));var crypto=require('crypto');var jsforce=require(_0x587a('0xa'));var deskjs=require(_0x587a('0xb'));var toCsv=require(_0x587a('0xc'));var querystring=require(_0x587a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x587a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x587a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x587a('0x10'))(_0x587a('0x11'));var utils=require(_0x587a('0x12'));var config=require(_0x587a('0x13'));var licenseUtil=require(_0x587a('0x14'));var db=require(_0x587a('0x15'))['db'];config[_0x587a('0x16')]=_['defaults'](config[_0x587a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x587a('0x17'))(new Redis(config[_0x587a('0x16')]));require(_0x587a('0x18'))[_0x587a('0x19')](socket);function respondWithStatusCode(_0x489037,_0x26f324){_0x26f324=_0x26f324||0xcc;return function(_0x5a4db7){if(_0x5a4db7){return _0x489037[_0x587a('0x1a')](_0x26f324);}return _0x489037['status'](_0x26f324)['end']();};}function respondWithResult(_0x7d9e26,_0x2f6963){_0x2f6963=_0x2f6963||0xc8;return function(_0x1d320b){if(_0x1d320b){return _0x7d9e26[_0x587a('0x1b')](_0x2f6963)[_0x587a('0x1c')](_0x1d320b);}};}function respondWithFilteredResult(_0x229ead,_0x54c431){return function(_0x33ccee){if(_0x33ccee){var _0x327dc9=_0x33ccee[_0x587a('0x1d')],_0x9e8251=_0x54c431[_0x587a('0x1e')],_0x17d544=_0x54c431[_0x587a('0x1e')]+_0x54c431['limit'],_0x30c2c8;if(_0x17d544>=_0x327dc9){_0x17d544=_0x327dc9;_0x30c2c8=0xc8;}else{_0x30c2c8=0xce;}_0x229ead[_0x587a('0x1b')](_0x30c2c8);return _0x229ead[_0x587a('0x1f')](_0x587a('0x20'),_0x9e8251+'-'+_0x17d544+'/'+_0x327dc9)[_0x587a('0x1c')](_0x33ccee);}return null;};}function patchUpdates(_0x12bf61){return function(_0x4d8c62){try{jsonpatch[_0x587a('0x21')](_0x4d8c62,_0x12bf61,!![]);}catch(_0x3e2feb){return BPromise['reject'](_0x3e2feb);}return _0x4d8c62[_0x587a('0x22')]();};}function saveUpdates(_0x2e9ee4,_0x44eeae){return function(_0x1f4c55){if(_0x1f4c55){return _0x1f4c55[_0x587a('0x23')](_0x2e9ee4)[_0x587a('0x24')](function(_0x3e1c20){return _0x3e1c20;});}return null;};}function removeEntity(_0x574828,_0x541157){return function(_0x7bd867){if(_0x7bd867){return _0x7bd867['destroy']()[_0x587a('0x24')](function(){var _0x428a64=_0x7bd867['get']({'plain':!![]});var _0x40fc0f=_0x587a('0x25');return db[_0x587a('0x26')]['destroy']({'where':{'type':_0x40fc0f,'resourceId':_0x428a64['id']}})[_0x587a('0x24')](function(){return _0x7bd867;});})[_0x587a('0x24')](function(){_0x574828[_0x587a('0x1b')](0xcc)[_0x587a('0x27')]();});}};}function handleEntityNotFound(_0x33746b,_0x3408e9){return function(_0x1e0d6f){if(!_0x1e0d6f){_0x33746b[_0x587a('0x1a')](0x194);}return _0x1e0d6f;};}function handleError(_0xfacece,_0x38c2db){_0x38c2db=_0x38c2db||0x1f4;return function(_0x272955){logger['error'](_0x272955['stack']);if(_0x272955[_0x587a('0x28')]){delete _0x272955[_0x587a('0x28')];}_0xfacece[_0x587a('0x1b')](_0x38c2db)[_0x587a('0x29')](_0x272955);};}exports[_0x587a('0x2a')]=function(_0x59bbb6,_0x530789){var _0x5bcc91={},_0xadc6={},_0x2fee16={'count':0x0,'rows':[]};var _0xdebe30=_[_0x587a('0x2b')](db[_0x587a('0x2c')][_0x587a('0x2d')],function(_0x48893f){return{'name':_0x48893f[_0x587a('0x2e')],'type':_0x48893f[_0x587a('0x2f')][_0x587a('0x30')]};});_0xadc6[_0x587a('0x31')]=_[_0x587a('0x2b')](_0xdebe30,_0x587a('0x28'));_0xadc6[_0x587a('0x32')]=_['keys'](_0x59bbb6[_0x587a('0x32')]);_0xadc6[_0x587a('0x33')]=_[_0x587a('0x34')](_0xadc6['model'],_0xadc6[_0x587a('0x32')]);_0x5bcc91[_0x587a('0x35')]=_[_0x587a('0x34')](_0xadc6[_0x587a('0x31')],qs[_0x587a('0x36')](_0x59bbb6['query'][_0x587a('0x36')]));_0x5bcc91[_0x587a('0x35')]=_0x5bcc91[_0x587a('0x35')]['length']?_0x5bcc91[_0x587a('0x35')]:_0xadc6[_0x587a('0x31')];if(!_0x59bbb6[_0x587a('0x32')]['hasOwnProperty'](_0x587a('0x37'))){_0x5bcc91[_0x587a('0x38')]=qs[_0x587a('0x38')](_0x59bbb6[_0x587a('0x32')][_0x587a('0x38')]);_0x5bcc91[_0x587a('0x1e')]=qs['offset'](_0x59bbb6['query']['offset']);}_0x5bcc91[_0x587a('0x39')]=qs['sort'](_0x59bbb6[_0x587a('0x32')]['sort']);_0x5bcc91[_0x587a('0x3a')]=qs[_0x587a('0x33')](_[_0x587a('0x3b')](_0x59bbb6['query'],_0xadc6[_0x587a('0x33')]),_0xdebe30);if(_0x59bbb6[_0x587a('0x32')]['filter']){_0x5bcc91['where']=_[_0x587a('0x3c')](_0x5bcc91[_0x587a('0x3a')],{'$or':_[_0x587a('0x2b')](_0xdebe30,function(_0x3bfddc){if(_0x3bfddc['type']!==_0x587a('0x3d')){var _0x4898c7={};_0x4898c7[_0x3bfddc[_0x587a('0x28')]]={'$like':'%'+_0x59bbb6[_0x587a('0x32')][_0x587a('0x3e')]+'%'};return _0x4898c7;}})});}_0x5bcc91=_[_0x587a('0x3c')]({},_0x5bcc91,_0x59bbb6[_0x587a('0x3f')]);var _0x2bdd21={'where':_0x5bcc91['where']};return db[_0x587a('0x2c')][_0x587a('0x1d')](_0x2bdd21)[_0x587a('0x24')](function(_0x547d73){_0x2fee16[_0x587a('0x1d')]=_0x547d73;if(_0x59bbb6['query'][_0x587a('0x40')]){_0x5bcc91[_0x587a('0x41')]=[{'all':!![]}];}return db[_0x587a('0x2c')][_0x587a('0x42')](_0x5bcc91);})[_0x587a('0x24')](function(_0x42a272){_0x2fee16[_0x587a('0x43')]=_0x42a272;return _0x2fee16;})[_0x587a('0x24')](respondWithFilteredResult(_0x530789,_0x5bcc91))[_0x587a('0x44')](handleError(_0x530789,null));};exports[_0x587a('0x45')]=function(_0x9ea05d,_0x3ce39e){var _0x2d3715={'raw':!![],'where':{'id':_0x9ea05d[_0x587a('0x46')]['id']}},_0x91f989={};_0x91f989['model']=_[_0x587a('0x47')](db[_0x587a('0x2c')]['rawAttributes']);_0x91f989['query']=_[_0x587a('0x47')](_0x9ea05d[_0x587a('0x32')]);_0x91f989[_0x587a('0x33')]=_['intersection'](_0x91f989['model'],_0x91f989[_0x587a('0x32')]);_0x2d3715[_0x587a('0x35')]=_[_0x587a('0x34')](_0x91f989[_0x587a('0x31')],qs[_0x587a('0x36')](_0x9ea05d[_0x587a('0x32')]['fields']));_0x2d3715[_0x587a('0x35')]=_0x2d3715[_0x587a('0x35')][_0x587a('0x48')]?_0x2d3715['attributes']:_0x91f989['model'];if(_0x9ea05d[_0x587a('0x32')]['includeAll']){_0x2d3715[_0x587a('0x41')]=[{'all':!![]}];}_0x2d3715=_['merge']({},_0x2d3715,_0x9ea05d[_0x587a('0x3f')]);return db[_0x587a('0x2c')]['find'](_0x2d3715)[_0x587a('0x24')](handleEntityNotFound(_0x3ce39e,null))['then'](respondWithResult(_0x3ce39e,null))[_0x587a('0x44')](handleError(_0x3ce39e,null));};exports[_0x587a('0x49')]=function(_0x32bd4f,_0x5de197){return db[_0x587a('0x2c')][_0x587a('0x49')](_0x32bd4f[_0x587a('0x4a')],{})[_0x587a('0x24')](function(_0x58356a){var _0x5da67e=_0x32bd4f[_0x587a('0x4b')][_0x587a('0x4c')]({'plain':!![]});if(!_0x5da67e)throw new Error(_0x587a('0x4d'));if(_0x5da67e[_0x587a('0x4e')]===_0x587a('0x4b')){var _0x1ac97b=_0x58356a['get']({'plain':!![]});var _0x385ed4=_0x587a('0x25');return db[_0x587a('0x4f')]['find']({'where':{'name':_0x385ed4,'userProfileId':_0x5da67e[_0x587a('0x50')]},'raw':!![]})[_0x587a('0x24')](function(_0x314721){if(_0x314721&&_0x314721[_0x587a('0x51')]===0x0){return db[_0x587a('0x26')]['create']({'name':_0x1ac97b['name'],'resourceId':_0x1ac97b['id'],'type':_0x314721[_0x587a('0x28')],'sectionId':_0x314721['id']},{})[_0x587a('0x24')](function(){return _0x58356a;});}else{return _0x58356a;}})[_0x587a('0x44')](function(_0x4c9d69){logger[_0x587a('0x52')](_0x587a('0x53'),_0x4c9d69);throw _0x4c9d69;});}return _0x58356a;})[_0x587a('0x24')](respondWithResult(_0x5de197,0xc9))[_0x587a('0x44')](handleError(_0x5de197,null));};exports[_0x587a('0x23')]=function(_0x4530c6,_0x3c4de6){if(_0x4530c6[_0x587a('0x4a')]['id']){delete _0x4530c6['body']['id'];}return db[_0x587a('0x2c')]['find']({'where':{'id':_0x4530c6[_0x587a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c4de6,null))[_0x587a('0x24')](saveUpdates(_0x4530c6[_0x587a('0x4a')],null))[_0x587a('0x24')](respondWithResult(_0x3c4de6,null))['catch'](handleError(_0x3c4de6,null));};exports[_0x587a('0x54')]=function(_0x30bd07,_0x1558de){return db[_0x587a('0x2c')]['find']({'where':{'id':_0x30bd07[_0x587a('0x46')]['id']}})[_0x587a('0x24')](handleEntityNotFound(_0x1558de,null))['then'](removeEntity(_0x1558de,null))[_0x587a('0x44')](handleError(_0x1558de,null));};exports[_0x587a('0x55')]=function(_0x383d0e,_0x51f40a){return db['WhatsappQueue'][_0x587a('0x55')]()[_0x587a('0x24')](respondWithResult(_0x51f40a,null))['catch'](handleError(_0x51f40a,null));};exports[_0x587a('0x56')]=function(_0x304f3f,_0x241a29,_0xe2c160){var _0x24a189={'raw':!![],'where':{}},_0x5aa61f={},_0x48ecb9;return db['WhatsappQueue'][_0x587a('0x57')]({'where':{'id':_0x304f3f[_0x587a('0x46')]['id']}})['then'](handleEntityNotFound(_0x241a29,null))[_0x587a('0x24')](function(_0x1a3659){if(_0x1a3659){_0x48ecb9=_0x1a3659[_0x587a('0x4c')]({'plain':!![]});_0x5aa61f[_0x587a('0x31')]=_['keys'](db[_0x587a('0x58')][_0x587a('0x2d')]);_0x5aa61f[_0x587a('0x32')]=_[_0x587a('0x47')](_0x304f3f['query']);_0x5aa61f[_0x587a('0x33')]=_[_0x587a('0x34')](_0x5aa61f[_0x587a('0x31')],_0x5aa61f[_0x587a('0x32')]);_0x24a189[_0x587a('0x35')]=_[_0x587a('0x34')](_0x5aa61f['model'],qs[_0x587a('0x36')](_0x304f3f[_0x587a('0x32')][_0x587a('0x36')]));_0x24a189[_0x587a('0x35')]=_0x24a189[_0x587a('0x35')][_0x587a('0x48')]?_0x24a189[_0x587a('0x35')]:_0x5aa61f[_0x587a('0x31')];if(!_0x304f3f['query'][_0x587a('0x59')](_0x587a('0x37'))){_0x24a189['limit']=qs[_0x587a('0x38')](_0x304f3f['query'][_0x587a('0x38')]);_0x24a189[_0x587a('0x1e')]=qs[_0x587a('0x1e')](_0x304f3f['query']['offset']);}_0x24a189[_0x587a('0x39')]=qs[_0x587a('0x5a')](_0x304f3f[_0x587a('0x32')]['sort']);_0x24a189[_0x587a('0x3a')]=qs['filters'](_['pick'](_0x304f3f[_0x587a('0x32')],_0x5aa61f[_0x587a('0x33')]));_0x24a189[_0x587a('0x3a')][_0x587a('0x5b')]=_0x1a3659['id'];if(_0x304f3f[_0x587a('0x32')][_0x587a('0x3e')]){_0x24a189[_0x587a('0x3a')]=_[_0x587a('0x3c')](_0x24a189['where'],{'$or':_['map'](_0x24a189[_0x587a('0x35')],function(_0x248bd7){var _0x29bf2a={};_0x29bf2a[_0x248bd7]={'$like':'%'+_0x304f3f[_0x587a('0x32')][_0x587a('0x3e')]+'%'};return _0x29bf2a;})});}_0x24a189=_[_0x587a('0x3c')]({},_0x24a189,_0x304f3f['options']);return db[_0x587a('0x58')][_0x587a('0x42')](_0x24a189);}})[_0x587a('0x24')](function(_0x37e0bd){if(_0x37e0bd){return db[_0x587a('0x5c')][_0x587a('0x5d')]({'where':{'id':_[_0x587a('0x2b')](_0x37e0bd,'UserId'),'role':_0x587a('0x5e')},'attributes':['id',_0x587a('0x28'),_0x587a('0x5f'),_0x587a('0x60'),_0x587a('0x61')]});}})[_0x587a('0x24')](function(_0x27e7e0){if(_0x27e7e0){return{'count':_0x27e7e0[_0x587a('0x1d')],'rows':_[_0x587a('0x2b')](_0x27e7e0[_0x587a('0x43')],function(_0x3d04b3){return{'membername':_0x3d04b3[_0x587a('0x28')],'UserId':_0x3d04b3['id'],'queue_name':_0x48ecb9[_0x587a('0x28')],'WhatsappQueueId':_0x48ecb9['id'],'interface':util[_0x587a('0x62')](_0x587a('0x63'),_0x587a('0x64'),_0x3d04b3[_0x587a('0x28')]),'penalty':0x0,'paused':_0x3d04b3['whatsappPause'],'createdAt':_0x3d04b3['createdAt'],'updatedAt':_0x3d04b3[_0x587a('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x587a('0x24')](respondWithFilteredResult(_0x241a29,_0x24a189))[_0x587a('0x44')](handleError(_0x241a29,null));};exports[_0x587a('0x65')]=function(_0xf3b38b,_0x439027,_0x5c65e0){var _0x405b74={};var _0x33519a={};var _0x411198;var _0x1bdd88;return db['WhatsappQueue'][_0x587a('0x57')]({'where':{'id':_0xf3b38b['params']['id']}})['then'](handleEntityNotFound(_0x439027,null))[_0x587a('0x24')](function(_0x1d5543){if(_0x1d5543){_0x411198=_0x1d5543;_0x33519a['model']=_[_0x587a('0x47')](db[_0x587a('0x66')][_0x587a('0x2d')]);_0x33519a[_0x587a('0x32')]=_[_0x587a('0x47')](_0xf3b38b['query']);_0x33519a[_0x587a('0x33')]=_[_0x587a('0x34')](_0x33519a[_0x587a('0x31')],_0x33519a[_0x587a('0x32')]);_0x405b74[_0x587a('0x35')]=_[_0x587a('0x34')](_0x33519a[_0x587a('0x31')],qs[_0x587a('0x36')](_0xf3b38b[_0x587a('0x32')][_0x587a('0x36')]));_0x405b74[_0x587a('0x35')]=_0x405b74[_0x587a('0x35')][_0x587a('0x48')]?_0x405b74[_0x587a('0x35')]:_0x33519a[_0x587a('0x31')];_0x405b74[_0x587a('0x39')]=qs[_0x587a('0x5a')](_0xf3b38b[_0x587a('0x32')][_0x587a('0x5a')]);_0x405b74[_0x587a('0x3a')]=qs[_0x587a('0x33')](_['pick'](_0xf3b38b[_0x587a('0x32')],_0x33519a['filters']));if(_0xf3b38b[_0x587a('0x32')][_0x587a('0x3e')]){_0x405b74[_0x587a('0x3a')]=_[_0x587a('0x3c')](_0x405b74[_0x587a('0x3a')],{'$or':_[_0x587a('0x2b')](_0x405b74[_0x587a('0x35')],function(_0x547920){var _0x3345bb={};_0x3345bb[_0x547920]={'$like':'%'+_0xf3b38b['query'][_0x587a('0x3e')]+'%'};return _0x3345bb;})});}_0x405b74=_['merge']({},_0x405b74,_0xf3b38b[_0x587a('0x3f')]);return _0x411198[_0x587a('0x65')](_0x405b74);}})[_0x587a('0x24')](function(_0x487f66){if(_0x487f66){_0x1bdd88=_0x487f66[_0x587a('0x48')];if(!_0xf3b38b['query'][_0x587a('0x59')]('nolimit')){_0x405b74['limit']=qs[_0x587a('0x38')](_0xf3b38b[_0x587a('0x32')][_0x587a('0x38')]);_0x405b74['offset']=qs[_0x587a('0x1e')](_0xf3b38b[_0x587a('0x32')][_0x587a('0x1e')]);}return _0x411198[_0x587a('0x65')](_0x405b74);}})[_0x587a('0x24')](function(_0x4dd86e){if(_0x4dd86e){return _0x4dd86e?{'count':_0x1bdd88,'rows':_0x4dd86e}:null;}})[_0x587a('0x24')](respondWithResult(_0x439027,null))[_0x587a('0x44')](handleError(_0x439027,null));};exports[_0x587a('0x67')]=function(_0x4909cb,_0x2ce6f7,_0x4aecdf){var _0x3ca501=_0x4909cb[_0x587a('0x4a')]['ids'];return db['Team'][_0x587a('0x42')]({'where':{'id':_0x3ca501},'attributes':['id'],'include':[{'model':db[_0x587a('0x5c')],'as':_0x587a('0x68'),'attributes':['id',_0x587a('0x28'),_0x587a('0x69'),_0x587a('0x6a'),_0x587a('0x6b')],'raw':!![]}]})['then'](function(_0x5a56ff){if(_0x5a56ff){var _0x59259a=_[_0x587a('0x6c')](_0x5a56ff,function(_0x42aa61){var _0x4d3285=_0x42aa61['get']({'plain':!![]});return _0x4d3285['Agents'];});return db[_0x587a('0x2c')][_0x587a('0x6d')]({'where':{'id':_0x4909cb[_0x587a('0x46')]['id']}})[_0x587a('0x24')](function(_0x2b72b0){return db[_0x587a('0x6e')][_0x587a('0x6f')](function(_0x2992ad){return _0x2b72b0[_0x587a('0x67')](_0x3ca501,{'transaction':_0x2992ad})[_0x587a('0x24')](function(){return BPromise[_0x587a('0x70')](_0x59259a,function(_0x56179b){return db[_0x587a('0x58')]['findOrCreate']({'where':{'UserId':_0x56179b['id'],'WhatsappQueueId':_0x4909cb[_0x587a('0x46')]['id']},'transaction':_0x2992ad});});})['then'](function(){_0x59259a['forEach'](function(_0x59f364){socket[_0x587a('0x71')]('userWhatsappQueue:save',{'UserId':_0x59f364['id'],'WhatsappQueueId':_0x2b72b0['id']});});});});});}})[_0x587a('0x24')](respondWithStatusCode(_0x2ce6f7,null))['catch'](handleError(_0x2ce6f7,null));};exports[_0x587a('0x72')]=function(_0x1d1b51,_0x29d417,_0x5972bd){return db[_0x587a('0x66')][_0x587a('0x42')]({'where':{'id':_0x1d1b51[_0x587a('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x587a('0x5c')],'as':_0x587a('0x68'),'attributes':['id'],'raw':!![]}]})[_0x587a('0x24')](handleEntityNotFound(_0x29d417,null))[_0x587a('0x24')](function(_0x39bb5b){var _0x458e7f=_[_0x587a('0x2b')](_0x39bb5b,'id');var _0x472d33=[];var _0x4e4db2=[];var _0x1f4ef2=squel[_0x587a('0x73')]();_0x1f4ef2[_0x587a('0x74')](_0x587a('0x75'))[_0x587a('0x76')](_0x587a('0x77'),'tq')['join'](_0x587a('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x587a('0x3a')](_0x587a('0x79'),_0x1d1b51[_0x587a('0x46')]['id']);for(var _0x365ea1=0x0;_0x365ea1<_0x39bb5b[_0x587a('0x48')];_0x365ea1+=0x1){let _0x459a8c=_0x39bb5b[_0x365ea1];for(var _0x5f188c=0x0;_0x5f188c<_0x459a8c['Agents'][_0x587a('0x48')];_0x5f188c+=0x1){let _0x17e394=_0x459a8c[_0x587a('0x68')][_0x5f188c];var _0x40571a=_0x1f4ef2[_0x587a('0x7a')]();_0x40571a['where'](_0x587a('0x7b'),_0x17e394['id']);_0x4e4db2[_0x587a('0x7c')](db[_0x587a('0x6e')]['query'](_0x40571a[_0x587a('0x7d')](),{'type':db['sequelize'][_0x587a('0x7e')][_0x587a('0x7f')]})['then'](function(_0x1dabb8){if(_0x1dabb8[_0x587a('0x48')]===0x1){return _0x17e394['id'];}else{var _0x96b5ae=_[_0x587a('0x80')](_[_0x587a('0x2b')](_0x1dabb8,_0x587a('0x81')),function(_0x33ebf5){return _[_0x587a('0x82')](_0x458e7f,_0x33ebf5);});if(_0x96b5ae){return _0x17e394['id'];}}}));}}return BPromise[_0x587a('0x83')](_0x4e4db2)[_0x587a('0x24')](function(_0x485585){_0x472d33=_(_0x472d33)[_0x587a('0x84')](_0x485585)[_0x587a('0x85')]()['value']();return db[_0x587a('0x2c')][_0x587a('0x6d')]({'where':{'id':_0x1d1b51[_0x587a('0x46')]['id']}})[_0x587a('0x24')](function(_0x83137e){return db['sequelize'][_0x587a('0x6f')](function(_0x218d71){return _0x83137e['removeTeams'](_0x1d1b51[_0x587a('0x32')][_0x587a('0x86')],{'transaction':_0x218d71})[_0x587a('0x24')](function(){if(!_[_0x587a('0x87')](_0x472d33)){return _0x83137e[_0x587a('0x88')](_0x472d33,{'transaction':_0x218d71});}})[_0x587a('0x24')](function(){_0x472d33[_0x587a('0x89')](function(_0x32301f){socket[_0x587a('0x71')](_0x587a('0x8a'),{'UserId':_0x32301f,'WhatsappQueueId':_0x83137e['id']});});});});});});})[_0x587a('0x24')](respondWithStatusCode(_0x29d417,null))[_0x587a('0x44')](handleError(_0x29d417,null));};exports[_0x587a('0x8b')]=function(_0x38b561,_0x2735e0,_0x1703ba){return db[_0x587a('0x2c')][_0x587a('0x6d')]({'where':{'id':_0x38b561['params']['id']}})[_0x587a('0x24')](handleEntityNotFound(_0x2735e0,null))[_0x587a('0x24')](function(_0x420ac1){if(_0x420ac1){return _0x420ac1[_0x587a('0x8b')](_0x38b561['body']['ids'],_[_0x587a('0x8c')](_0x38b561[_0x587a('0x4a')],[_0x587a('0x86'),'id'])||{})['spread'](function(_0x1fc8aa){for(var _0x3feacc=0x0;_0x3feacc<_0x38b561[_0x587a('0x4a')][_0x587a('0x86')][_0x587a('0x48')];_0x3feacc+=0x1){socket[_0x587a('0x71')](_0x587a('0x8d'),{'UserId':_0x38b561[_0x587a('0x4a')][_0x587a('0x86')][_0x3feacc],'WhatsappQueueId':_0x38b561[_0x587a('0x46')]['id']});}return _0x1fc8aa;});}})['then'](respondWithResult(_0x2735e0,null))[_0x587a('0x44')](handleError(_0x2735e0,null));};exports['removeAgents']=function(_0x3f562a,_0x3436c7,_0x187ede){return db[_0x587a('0x2c')][_0x587a('0x6d')]({'where':{'id':_0x3f562a[_0x587a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3436c7,null))[_0x587a('0x24')](function(_0x5896b2){if(_0x5896b2){return _0x5896b2[_0x587a('0x88')](_0x3f562a[_0x587a('0x32')]['ids'])['then'](function(){if(_[_0x587a('0x8e')](_0x3f562a['query']['ids'])){for(var _0x1f3b65=0x0;_0x1f3b65<_0x3f562a[_0x587a('0x32')][_0x587a('0x86')]['length'];_0x1f3b65+=0x1){socket[_0x587a('0x71')](_0x587a('0x8a'),{'UserId':Number(_0x3f562a[_0x587a('0x32')]['ids'][_0x1f3b65]),'WhatsappQueueId':Number(_0x3f562a[_0x587a('0x46')]['id'])});}}else{socket[_0x587a('0x71')](_0x587a('0x8a'),{'UserId':Number(_0x3f562a[_0x587a('0x32')][_0x587a('0x86')]),'WhatsappQueueId':Number(_0x3f562a[_0x587a('0x46')]['id'])});}});}})[_0x587a('0x24')](respondWithStatusCode(_0x3436c7,null))[_0x587a('0x44')](handleError(_0x3436c7,null));};exports['getAgents']=function(_0x389638,_0x4d6cd2,_0x7a572f){var _0x21d75f={};var _0x58b98d={};var _0x13ab6a;var _0x2bdcc4;return db[_0x587a('0x2c')]['findOne']({'where':{'id':_0x389638[_0x587a('0x46')]['id']}})[_0x587a('0x24')](handleEntityNotFound(_0x4d6cd2,null))[_0x587a('0x24')](function(_0x1782ed){if(_0x1782ed){_0x13ab6a=_0x1782ed;_0x58b98d[_0x587a('0x31')]=_['keys'](db[_0x587a('0x5c')][_0x587a('0x2d')]);_0x58b98d[_0x587a('0x32')]=_[_0x587a('0x47')](_0x389638[_0x587a('0x32')]);_0x58b98d['filters']=_['intersection'](_0x58b98d[_0x587a('0x31')],_0x58b98d[_0x587a('0x32')]);_0x21d75f[_0x587a('0x35')]=_['intersection'](_0x58b98d[_0x587a('0x31')],qs[_0x587a('0x36')](_0x389638['query'][_0x587a('0x36')]));_0x21d75f[_0x587a('0x35')]=_0x21d75f[_0x587a('0x35')]['length']?_0x21d75f[_0x587a('0x35')]:_0x58b98d[_0x587a('0x31')];_0x21d75f[_0x587a('0x39')]=qs['sort'](_0x389638[_0x587a('0x32')]['sort']);_0x21d75f[_0x587a('0x3a')]=qs[_0x587a('0x33')](_[_0x587a('0x3b')](_0x389638['query'],_0x58b98d['filters']));if(_0x389638[_0x587a('0x32')]['filter']){_0x21d75f[_0x587a('0x3a')]=_[_0x587a('0x3c')](_0x21d75f['where'],{'$or':_[_0x587a('0x2b')](_0x21d75f['attributes'],function(_0x3772e9){var _0x41543a={};_0x41543a[_0x3772e9]={'$like':'%'+_0x389638['query'][_0x587a('0x3e')]+'%'};return _0x41543a;})});}_0x21d75f=_[_0x587a('0x3c')]({},_0x21d75f,_0x389638[_0x587a('0x3f')]);return _0x13ab6a['getAgents'](_0x21d75f);}})[_0x587a('0x24')](function(_0x2939d5){if(_0x2939d5){_0x2bdcc4=_0x2939d5[_0x587a('0x48')];if(!_0x389638[_0x587a('0x32')][_0x587a('0x59')](_0x587a('0x37'))){_0x21d75f[_0x587a('0x38')]=qs[_0x587a('0x38')](_0x389638[_0x587a('0x32')][_0x587a('0x38')]);_0x21d75f[_0x587a('0x1e')]=qs[_0x587a('0x1e')](_0x389638[_0x587a('0x32')][_0x587a('0x1e')]);}return _0x13ab6a[_0x587a('0x8f')](_0x21d75f);}})[_0x587a('0x24')](function(_0x9a3751){if(_0x9a3751){return _0x9a3751?{'count':_0x2bdcc4,'rows':_0x9a3751}:null;}})[_0x587a('0x24')](respondWithResult(_0x4d6cd2,null))[_0x587a('0x44')](handleError(_0x4d6cd2,null));}; \ No newline at end of file +var _0x9905=['catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','get','length','nolimit','WhatsappQueueId','UserWhatsappQueue','findAndCountAll','UserId','whatsappPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','User','Agents','online','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','compact','transaction','isEmpty','userWhatsappQueue:remove','addAgents','find','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','WhatsappQueues','UserProfileResource','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows'];(function(_0x2c2498,_0x4bb40b){var _0x1b5575=function(_0x40fe4d){while(--_0x40fe4d){_0x2c2498['push'](_0x2c2498['shift']());}};_0x1b5575(++_0x4bb40b);}(_0x9905,0xd4));var _0x5990=function(_0x5fcb09,_0x5155bd){_0x5fcb09=_0x5fcb09-0x0;var _0x508f62=_0x9905[_0x5fcb09];return _0x508f62;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5990('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5990('0x1'));var jsonpatch=require(_0x5990('0x2'));var rp=require(_0x5990('0x3'));var moment=require(_0x5990('0x4'));var BPromise=require(_0x5990('0x5'));var Mustache=require(_0x5990('0x6'));var util=require(_0x5990('0x7'));var path=require(_0x5990('0x8'));var sox=require('sox');var csv=require(_0x5990('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5990('0xa'));var _=require(_0x5990('0xb'));var squel=require(_0x5990('0xc'));var crypto=require('crypto');var jsforce=require(_0x5990('0xd'));var deskjs=require(_0x5990('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5990('0xf'));var authService=require(_0x5990('0x10'));var qs=require(_0x5990('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5990('0x12'))(_0x5990('0x13'));var utils=require('../../config/utils');var config=require(_0x5990('0x14'));var licenseUtil=require(_0x5990('0x15'));var db=require(_0x5990('0x16'))['db'];config['redis']=_[_0x5990('0x17')](config[_0x5990('0x18')],{'host':_0x5990('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5990('0x18')]));require(_0x5990('0x1a'))[_0x5990('0x1b')](socket);function respondWithStatusCode(_0x54d24f,_0x1475d3){_0x1475d3=_0x1475d3||0xcc;return function(_0x4e1708){if(_0x4e1708){return _0x54d24f['sendStatus'](_0x1475d3);}return _0x54d24f[_0x5990('0x1c')](_0x1475d3)[_0x5990('0x1d')]();};}function respondWithResult(_0x5e295b,_0x287897){_0x287897=_0x287897||0xc8;return function(_0x4fec84){if(_0x4fec84){return _0x5e295b[_0x5990('0x1c')](_0x287897)[_0x5990('0x1e')](_0x4fec84);}};}function respondWithFilteredResult(_0x4904d3,_0x327a6f){return function(_0x120110){if(_0x120110){var _0x166108=_0x120110[_0x5990('0x1f')],_0x53cd07=_0x327a6f[_0x5990('0x20')],_0x1f5ace=_0x327a6f['offset']+_0x327a6f[_0x5990('0x21')],_0x3f88e9;if(_0x1f5ace>=_0x166108){_0x1f5ace=_0x166108;_0x3f88e9=0xc8;}else{_0x3f88e9=0xce;}_0x4904d3[_0x5990('0x1c')](_0x3f88e9);return _0x4904d3[_0x5990('0x22')](_0x5990('0x23'),_0x53cd07+'-'+_0x1f5ace+'/'+_0x166108)[_0x5990('0x1e')](_0x120110);}return null;};}function patchUpdates(_0x2154aa){return function(_0xb16ed2){try{jsonpatch[_0x5990('0x24')](_0xb16ed2,_0x2154aa,!![]);}catch(_0x731dcd){return BPromise[_0x5990('0x25')](_0x731dcd);}return _0xb16ed2['save']();};}function saveUpdates(_0x28de27,_0xb785e5){return function(_0x636384){if(_0x636384){return _0x636384['update'](_0x28de27)[_0x5990('0x26')](function(_0x340755){return _0x340755;});}return null;};}function removeEntity(_0x36a218,_0x1faafc){return function(_0x424742){if(_0x424742){return _0x424742[_0x5990('0x27')]()[_0x5990('0x26')](function(){var _0x3aa723=_0x424742['get']({'plain':!![]});var _0x2c1bc0=_0x5990('0x28');return db[_0x5990('0x29')][_0x5990('0x27')]({'where':{'type':_0x2c1bc0,'resourceId':_0x3aa723['id']}})[_0x5990('0x26')](function(){return _0x424742;});})['then'](function(){_0x36a218[_0x5990('0x1c')](0xcc)[_0x5990('0x1d')]();});}};}function handleEntityNotFound(_0x1427be,_0x5ab651){return function(_0x505dc6){if(!_0x505dc6){_0x1427be['sendStatus'](0x194);}return _0x505dc6;};}function handleError(_0x1a5da9,_0x551d6b){_0x551d6b=_0x551d6b||0x1f4;return function(_0x39a320){logger[_0x5990('0x2a')](_0x39a320[_0x5990('0x2b')]);if(_0x39a320[_0x5990('0x2c')]){delete _0x39a320[_0x5990('0x2c')];}_0x1a5da9[_0x5990('0x1c')](_0x551d6b)[_0x5990('0x2d')](_0x39a320);};}exports[_0x5990('0x2e')]=function(_0x2667be,_0x30b7c3){var _0x3b21d9={},_0x18a29c={},_0x496c71={'count':0x0,'rows':[]};var _0x103f93=_['map'](db[_0x5990('0x2f')][_0x5990('0x30')],function(_0x1246a2){return{'name':_0x1246a2[_0x5990('0x31')],'type':_0x1246a2['type']['key']};});_0x18a29c['model']=_['map'](_0x103f93,'name');_0x18a29c['query']=_[_0x5990('0x32')](_0x2667be[_0x5990('0x33')]);_0x18a29c[_0x5990('0x34')]=_[_0x5990('0x35')](_0x18a29c[_0x5990('0x36')],_0x18a29c[_0x5990('0x33')]);_0x3b21d9[_0x5990('0x37')]=_[_0x5990('0x35')](_0x18a29c['model'],qs[_0x5990('0x38')](_0x2667be[_0x5990('0x33')]['fields']));_0x3b21d9[_0x5990('0x37')]=_0x3b21d9['attributes']['length']?_0x3b21d9[_0x5990('0x37')]:_0x18a29c[_0x5990('0x36')];if(!_0x2667be['query'][_0x5990('0x39')]('nolimit')){_0x3b21d9[_0x5990('0x21')]=qs[_0x5990('0x21')](_0x2667be['query'][_0x5990('0x21')]);_0x3b21d9['offset']=qs[_0x5990('0x20')](_0x2667be[_0x5990('0x33')][_0x5990('0x20')]);}_0x3b21d9[_0x5990('0x3a')]=qs['sort'](_0x2667be[_0x5990('0x33')][_0x5990('0x3b')]);_0x3b21d9[_0x5990('0x3c')]=qs[_0x5990('0x34')](_[_0x5990('0x3d')](_0x2667be[_0x5990('0x33')],_0x18a29c[_0x5990('0x34')]),_0x103f93);if(_0x2667be[_0x5990('0x33')][_0x5990('0x3e')]){_0x3b21d9['where']=_['merge'](_0x3b21d9[_0x5990('0x3c')],{'$or':_[_0x5990('0x3f')](_0x103f93,function(_0x2fb31f){if(_0x2fb31f[_0x5990('0x40')]!==_0x5990('0x41')){var _0x108dd3={};_0x108dd3[_0x2fb31f[_0x5990('0x2c')]]={'$like':'%'+_0x2667be[_0x5990('0x33')][_0x5990('0x3e')]+'%'};return _0x108dd3;}})});}_0x3b21d9=_[_0x5990('0x42')]({},_0x3b21d9,_0x2667be[_0x5990('0x43')]);var _0x384a63={'where':_0x3b21d9['where']};return db[_0x5990('0x2f')][_0x5990('0x1f')](_0x384a63)[_0x5990('0x26')](function(_0x340f7e){_0x496c71[_0x5990('0x1f')]=_0x340f7e;if(_0x2667be[_0x5990('0x33')][_0x5990('0x44')]){_0x3b21d9[_0x5990('0x45')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x5990('0x46')](_0x3b21d9);})['then'](function(_0x3af5a8){_0x496c71[_0x5990('0x47')]=_0x3af5a8;return _0x496c71;})[_0x5990('0x26')](respondWithFilteredResult(_0x30b7c3,_0x3b21d9))[_0x5990('0x48')](handleError(_0x30b7c3,null));};exports[_0x5990('0x49')]=function(_0x255ea1,_0x3ea340){var _0x61eaa5={'raw':!![],'where':{'id':_0x255ea1['params']['id']}},_0x1eb343={};_0x1eb343[_0x5990('0x36')]=_[_0x5990('0x32')](db[_0x5990('0x2f')][_0x5990('0x30')]);_0x1eb343[_0x5990('0x33')]=_[_0x5990('0x32')](_0x255ea1[_0x5990('0x33')]);_0x1eb343[_0x5990('0x34')]=_[_0x5990('0x35')](_0x1eb343[_0x5990('0x36')],_0x1eb343['query']);_0x61eaa5[_0x5990('0x37')]=_[_0x5990('0x35')](_0x1eb343[_0x5990('0x36')],qs[_0x5990('0x38')](_0x255ea1[_0x5990('0x33')]['fields']));_0x61eaa5[_0x5990('0x37')]=_0x61eaa5[_0x5990('0x37')]['length']?_0x61eaa5[_0x5990('0x37')]:_0x1eb343[_0x5990('0x36')];if(_0x255ea1[_0x5990('0x33')][_0x5990('0x44')]){_0x61eaa5[_0x5990('0x45')]=[{'all':!![]}];}_0x61eaa5=_[_0x5990('0x42')]({},_0x61eaa5,_0x255ea1[_0x5990('0x43')]);return db[_0x5990('0x2f')]['find'](_0x61eaa5)['then'](handleEntityNotFound(_0x3ea340,null))['then'](respondWithResult(_0x3ea340,null))[_0x5990('0x48')](handleError(_0x3ea340,null));};exports[_0x5990('0x4a')]=function(_0x473544,_0x530c5d){return db['WhatsappQueue'][_0x5990('0x4a')](_0x473544[_0x5990('0x4b')],{})[_0x5990('0x26')](function(_0x57f6e8){var _0x56e2c2=_0x473544['user']['get']({'plain':!![]});if(!_0x56e2c2)throw new Error(_0x5990('0x4c'));if(_0x56e2c2[_0x5990('0x4d')]===_0x5990('0x4e')){var _0x5f1844=_0x57f6e8['get']({'plain':!![]});var _0x115bd3='WhatsappQueues';return db[_0x5990('0x4f')]['find']({'where':{'name':_0x115bd3,'userProfileId':_0x56e2c2[_0x5990('0x50')]},'raw':!![]})[_0x5990('0x26')](function(_0x1845e3){if(_0x1845e3&&_0x1845e3[_0x5990('0x51')]===0x0){return db[_0x5990('0x29')][_0x5990('0x4a')]({'name':_0x5f1844['name'],'resourceId':_0x5f1844['id'],'type':_0x1845e3[_0x5990('0x2c')],'sectionId':_0x1845e3['id']},{})[_0x5990('0x26')](function(){return _0x57f6e8;});}else{return _0x57f6e8;}})['catch'](function(_0x21721a){logger[_0x5990('0x2a')](_0x5990('0x52'),_0x21721a);throw _0x21721a;});}return _0x57f6e8;})[_0x5990('0x26')](respondWithResult(_0x530c5d,0xc9))[_0x5990('0x48')](handleError(_0x530c5d,null));};exports[_0x5990('0x53')]=function(_0x45bb42,_0xf41e3c){if(_0x45bb42[_0x5990('0x4b')]['id']){delete _0x45bb42[_0x5990('0x4b')]['id'];}return db[_0x5990('0x2f')]['find']({'where':{'id':_0x45bb42[_0x5990('0x54')]['id']}})[_0x5990('0x26')](handleEntityNotFound(_0xf41e3c,null))[_0x5990('0x26')](saveUpdates(_0x45bb42[_0x5990('0x4b')],null))[_0x5990('0x26')](respondWithResult(_0xf41e3c,null))[_0x5990('0x48')](handleError(_0xf41e3c,null));};exports[_0x5990('0x27')]=function(_0xfd0ae9,_0x4a8b8e){return db['WhatsappQueue']['find']({'where':{'id':_0xfd0ae9['params']['id']}})[_0x5990('0x26')](handleEntityNotFound(_0x4a8b8e,null))[_0x5990('0x26')](removeEntity(_0x4a8b8e,null))['catch'](handleError(_0x4a8b8e,null));};exports[_0x5990('0x55')]=function(_0x5f1ac3,_0x557f1d){return db[_0x5990('0x2f')][_0x5990('0x55')]()['then'](respondWithResult(_0x557f1d,null))[_0x5990('0x48')](handleError(_0x557f1d,null));};exports[_0x5990('0x56')]=function(_0x4cc0a6,_0x48f64b,_0x41f188){var _0x4efca0={'raw':!![],'where':{}},_0x396d7c={},_0x307ce2;return db[_0x5990('0x2f')][_0x5990('0x57')]({'where':{'id':_0x4cc0a6[_0x5990('0x54')]['id']}})[_0x5990('0x26')](handleEntityNotFound(_0x48f64b,null))[_0x5990('0x26')](function(_0x47ec97){if(_0x47ec97){_0x307ce2=_0x47ec97[_0x5990('0x58')]({'plain':!![]});_0x396d7c[_0x5990('0x36')]=_[_0x5990('0x32')](db['UserWhatsappQueue']['rawAttributes']);_0x396d7c['query']=_[_0x5990('0x32')](_0x4cc0a6[_0x5990('0x33')]);_0x396d7c[_0x5990('0x34')]=_[_0x5990('0x35')](_0x396d7c[_0x5990('0x36')],_0x396d7c['query']);_0x4efca0['attributes']=_['intersection'](_0x396d7c[_0x5990('0x36')],qs[_0x5990('0x38')](_0x4cc0a6['query']['fields']));_0x4efca0[_0x5990('0x37')]=_0x4efca0[_0x5990('0x37')][_0x5990('0x59')]?_0x4efca0[_0x5990('0x37')]:_0x396d7c[_0x5990('0x36')];if(!_0x4cc0a6[_0x5990('0x33')]['hasOwnProperty'](_0x5990('0x5a'))){_0x4efca0[_0x5990('0x21')]=qs[_0x5990('0x21')](_0x4cc0a6[_0x5990('0x33')][_0x5990('0x21')]);_0x4efca0[_0x5990('0x20')]=qs[_0x5990('0x20')](_0x4cc0a6[_0x5990('0x33')][_0x5990('0x20')]);}_0x4efca0[_0x5990('0x3a')]=qs['sort'](_0x4cc0a6[_0x5990('0x33')][_0x5990('0x3b')]);_0x4efca0[_0x5990('0x3c')]=qs[_0x5990('0x34')](_[_0x5990('0x3d')](_0x4cc0a6['query'],_0x396d7c[_0x5990('0x34')]));_0x4efca0[_0x5990('0x3c')][_0x5990('0x5b')]=_0x47ec97['id'];if(_0x4cc0a6[_0x5990('0x33')]['filter']){_0x4efca0[_0x5990('0x3c')]=_[_0x5990('0x42')](_0x4efca0['where'],{'$or':_[_0x5990('0x3f')](_0x4efca0[_0x5990('0x37')],function(_0x34648b){var _0x4d93a4={};_0x4d93a4[_0x34648b]={'$like':'%'+_0x4cc0a6['query'][_0x5990('0x3e')]+'%'};return _0x4d93a4;})});}_0x4efca0=_['merge']({},_0x4efca0,_0x4cc0a6[_0x5990('0x43')]);return db[_0x5990('0x5c')][_0x5990('0x46')](_0x4efca0);}})[_0x5990('0x26')](function(_0x46daec){if(_0x46daec){return db['User'][_0x5990('0x5d')]({'where':{'id':_['map'](_0x46daec,_0x5990('0x5e')),'role':'agent'},'attributes':['id',_0x5990('0x2c'),_0x5990('0x5f'),'updatedAt','createdAt']});}})['then'](function(_0x140bfa){if(_0x140bfa){return{'count':_0x140bfa[_0x5990('0x1f')],'rows':_[_0x5990('0x3f')](_0x140bfa[_0x5990('0x47')],function(_0x1e2d13){return{'membername':_0x1e2d13[_0x5990('0x2c')],'UserId':_0x1e2d13['id'],'queue_name':_0x307ce2[_0x5990('0x2c')],'WhatsappQueueId':_0x307ce2['id'],'interface':util[_0x5990('0x60')](_0x5990('0x61'),_0x5990('0x62'),_0x1e2d13[_0x5990('0x2c')]),'penalty':0x0,'paused':_0x1e2d13[_0x5990('0x5f')],'createdAt':_0x1e2d13[_0x5990('0x63')],'updatedAt':_0x1e2d13[_0x5990('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5990('0x26')](respondWithFilteredResult(_0x48f64b,_0x4efca0))[_0x5990('0x48')](handleError(_0x48f64b,null));};exports[_0x5990('0x65')]=function(_0x2b50d9,_0x311a1b,_0x2c533e){var _0x34d71b={};var _0x5511d5={};var _0x17e9e3;var _0x5c61f0;return db[_0x5990('0x2f')][_0x5990('0x57')]({'where':{'id':_0x2b50d9[_0x5990('0x54')]['id']}})[_0x5990('0x26')](handleEntityNotFound(_0x311a1b,null))[_0x5990('0x26')](function(_0x2497b3){if(_0x2497b3){_0x17e9e3=_0x2497b3;_0x5511d5[_0x5990('0x36')]=_[_0x5990('0x32')](db[_0x5990('0x66')][_0x5990('0x30')]);_0x5511d5['query']=_['keys'](_0x2b50d9[_0x5990('0x33')]);_0x5511d5[_0x5990('0x34')]=_[_0x5990('0x35')](_0x5511d5[_0x5990('0x36')],_0x5511d5[_0x5990('0x33')]);_0x34d71b['attributes']=_[_0x5990('0x35')](_0x5511d5[_0x5990('0x36')],qs[_0x5990('0x38')](_0x2b50d9[_0x5990('0x33')][_0x5990('0x38')]));_0x34d71b[_0x5990('0x37')]=_0x34d71b[_0x5990('0x37')][_0x5990('0x59')]?_0x34d71b[_0x5990('0x37')]:_0x5511d5[_0x5990('0x36')];_0x34d71b[_0x5990('0x3a')]=qs['sort'](_0x2b50d9[_0x5990('0x33')]['sort']);_0x34d71b[_0x5990('0x3c')]=qs['filters'](_[_0x5990('0x3d')](_0x2b50d9['query'],_0x5511d5[_0x5990('0x34')]));if(_0x2b50d9[_0x5990('0x33')][_0x5990('0x3e')]){_0x34d71b['where']=_[_0x5990('0x42')](_0x34d71b[_0x5990('0x3c')],{'$or':_['map'](_0x34d71b[_0x5990('0x37')],function(_0x2ca94f){var _0x347a64={};_0x347a64[_0x2ca94f]={'$like':'%'+_0x2b50d9['query'][_0x5990('0x3e')]+'%'};return _0x347a64;})});}_0x34d71b=_[_0x5990('0x42')]({},_0x34d71b,_0x2b50d9[_0x5990('0x43')]);return _0x17e9e3[_0x5990('0x65')](_0x34d71b);}})[_0x5990('0x26')](function(_0x55e6fc){if(_0x55e6fc){_0x5c61f0=_0x55e6fc[_0x5990('0x59')];if(!_0x2b50d9[_0x5990('0x33')][_0x5990('0x39')](_0x5990('0x5a'))){_0x34d71b[_0x5990('0x21')]=qs[_0x5990('0x21')](_0x2b50d9['query'][_0x5990('0x21')]);_0x34d71b[_0x5990('0x20')]=qs[_0x5990('0x20')](_0x2b50d9[_0x5990('0x33')]['offset']);}return _0x17e9e3[_0x5990('0x65')](_0x34d71b);}})['then'](function(_0x464605){if(_0x464605){return _0x464605?{'count':_0x5c61f0,'rows':_0x464605}:null;}})[_0x5990('0x26')](respondWithResult(_0x311a1b,null))['catch'](handleError(_0x311a1b,null));};exports['addTeams']=function(_0x303418,_0xa5c74f,_0x2e231a){var _0x5e962c=_0x303418[_0x5990('0x4b')]['ids'];return db['Team'][_0x5990('0x46')]({'where':{'id':_0x5e962c},'attributes':['id'],'include':[{'model':db[_0x5990('0x67')],'as':_0x5990('0x68'),'attributes':['id',_0x5990('0x2c'),_0x5990('0x69'),'voicePause',_0x5990('0x6a')],'raw':!![]}]})['then'](function(_0x28bf93){if(_0x28bf93){var _0x3616a8=_[_0x5990('0x6b')](_0x28bf93,function(_0x4cb468){var _0x2d050a=_0x4cb468[_0x5990('0x58')]({'plain':!![]});return _0x2d050a[_0x5990('0x68')];});return db[_0x5990('0x2f')]['find']({'where':{'id':_0x303418[_0x5990('0x54')]['id']}})[_0x5990('0x26')](function(_0x2db1c){return db[_0x5990('0x6c')]['transaction'](function(_0x257026){return _0x2db1c[_0x5990('0x6d')](_0x5e962c,{'transaction':_0x257026})[_0x5990('0x26')](function(){return BPromise[_0x5990('0x6e')](_0x3616a8,function(_0x5d954e){return db[_0x5990('0x5c')][_0x5990('0x6f')]({'where':{'UserId':_0x5d954e['id'],'WhatsappQueueId':_0x303418[_0x5990('0x54')]['id']},'transaction':_0x257026});});})[_0x5990('0x26')](function(){_0x3616a8[_0x5990('0x70')](function(_0x5d6f5a){socket[_0x5990('0x71')](_0x5990('0x72'),{'UserId':_0x5d6f5a['id'],'WhatsappQueueId':_0x2db1c['id']});});});});});}})[_0x5990('0x26')](respondWithStatusCode(_0xa5c74f,null))[_0x5990('0x48')](handleError(_0xa5c74f,null));};exports[_0x5990('0x73')]=function(_0x116a9,_0x1fd901,_0x8bfd9c){return db[_0x5990('0x66')][_0x5990('0x46')]({'where':{'id':_0x116a9[_0x5990('0x33')][_0x5990('0x74')]},'attributes':['id'],'include':[{'model':db[_0x5990('0x67')],'as':_0x5990('0x68'),'attributes':['id'],'raw':!![]}]})[_0x5990('0x26')](handleEntityNotFound(_0x1fd901,null))[_0x5990('0x26')](function(_0x5577ef){var _0x5692ba=_[_0x5990('0x3f')](_0x5577ef,'id');var _0x51157a=[];var _0xc5c997=[];var _0x3d5c2c=squel[_0x5990('0x75')]();_0x3d5c2c[_0x5990('0x76')](_0x5990('0x77'))['from'](_0x5990('0x78'),'tq')[_0x5990('0x79')](_0x5990('0x7a'),'ut',_0x5990('0x7b'))['where'](_0x5990('0x7c'),_0x116a9[_0x5990('0x54')]['id']);for(var _0xa1dcf1=0x0;_0xa1dcf1<_0x5577ef[_0x5990('0x59')];_0xa1dcf1+=0x1){let _0x3fa608=_0x5577ef[_0xa1dcf1];for(var _0x3463d8=0x0;_0x3463d8<_0x3fa608[_0x5990('0x68')][_0x5990('0x59')];_0x3463d8+=0x1){let _0x23149c=_0x3fa608[_0x5990('0x68')][_0x3463d8];var _0x5f431a=_0x3d5c2c[_0x5990('0x7d')]();_0x5f431a[_0x5990('0x3c')](_0x5990('0x7e'),_0x23149c['id']);_0xc5c997[_0x5990('0x7f')](db['sequelize'][_0x5990('0x33')](_0x5f431a['toString'](),{'type':db['sequelize'][_0x5990('0x80')][_0x5990('0x81')]})['then'](function(_0x398b54){if(_0x398b54['length']===0x1){return _0x23149c['id'];}else{var _0x8f08d7=_['every'](_['map'](_0x398b54,_0x5990('0x82')),function(_0x19190b){return _['includes'](_0x5692ba,_0x19190b);});if(_0x8f08d7){return _0x23149c['id'];}}}));}}return BPromise[_0x5990('0x83')](_0xc5c997)[_0x5990('0x26')](function(_0x17e013){_0x51157a=_(_0x51157a)['union'](_0x17e013)[_0x5990('0x84')]()['value']();return db[_0x5990('0x2f')]['find']({'where':{'id':_0x116a9[_0x5990('0x54')]['id']}})[_0x5990('0x26')](function(_0x17554f){return db['sequelize'][_0x5990('0x85')](function(_0x2b113e){return _0x17554f['removeTeams'](_0x116a9[_0x5990('0x33')][_0x5990('0x74')],{'transaction':_0x2b113e})[_0x5990('0x26')](function(){if(!_[_0x5990('0x86')](_0x51157a)){return _0x17554f['removeAgents'](_0x51157a,{'transaction':_0x2b113e});}})[_0x5990('0x26')](function(){_0x51157a[_0x5990('0x70')](function(_0x2787a1){socket[_0x5990('0x71')](_0x5990('0x87'),{'UserId':_0x2787a1,'WhatsappQueueId':_0x17554f['id']});});});});});});})['then'](respondWithStatusCode(_0x1fd901,null))['catch'](handleError(_0x1fd901,null));};exports[_0x5990('0x88')]=function(_0x4a9dfc,_0x5737ae,_0x5110e7){return db['WhatsappQueue'][_0x5990('0x89')]({'where':{'id':_0x4a9dfc['params']['id']}})['then'](handleEntityNotFound(_0x5737ae,null))['then'](function(_0x2c97f0){if(_0x2c97f0){return _0x2c97f0[_0x5990('0x88')](_0x4a9dfc[_0x5990('0x4b')]['ids'],_['omit'](_0x4a9dfc['body'],[_0x5990('0x74'),'id'])||{})[_0x5990('0x8a')](function(_0x59b768){for(var _0x306a0b=0x0;_0x306a0b<_0x4a9dfc['body'][_0x5990('0x74')]['length'];_0x306a0b+=0x1){socket[_0x5990('0x71')]('userWhatsappQueue:save',{'UserId':_0x4a9dfc[_0x5990('0x4b')][_0x5990('0x74')][_0x306a0b],'WhatsappQueueId':_0x4a9dfc[_0x5990('0x54')]['id']});}return _0x59b768;});}})[_0x5990('0x26')](respondWithResult(_0x5737ae,null))[_0x5990('0x48')](handleError(_0x5737ae,null));};exports[_0x5990('0x8b')]=function(_0x21ff3b,_0x2b6ecc,_0x17ce7e){return db[_0x5990('0x2f')]['find']({'where':{'id':_0x21ff3b[_0x5990('0x54')]['id']}})[_0x5990('0x26')](handleEntityNotFound(_0x2b6ecc,null))[_0x5990('0x26')](function(_0x505940){if(_0x505940){return _0x505940['removeAgents'](_0x21ff3b[_0x5990('0x33')][_0x5990('0x74')])[_0x5990('0x26')](function(){if(_[_0x5990('0x8c')](_0x21ff3b['query']['ids'])){for(var _0x12348d=0x0;_0x12348d<_0x21ff3b[_0x5990('0x33')]['ids']['length'];_0x12348d+=0x1){socket['emit'](_0x5990('0x87'),{'UserId':Number(_0x21ff3b[_0x5990('0x33')][_0x5990('0x74')][_0x12348d]),'WhatsappQueueId':Number(_0x21ff3b['params']['id'])});}}else{socket[_0x5990('0x71')](_0x5990('0x87'),{'UserId':Number(_0x21ff3b[_0x5990('0x33')]['ids']),'WhatsappQueueId':Number(_0x21ff3b[_0x5990('0x54')]['id'])});}});}})[_0x5990('0x26')](respondWithStatusCode(_0x2b6ecc,null))[_0x5990('0x48')](handleError(_0x2b6ecc,null));};exports[_0x5990('0x8d')]=function(_0x21c966,_0x595e43,_0x35a37f){var _0xfb0462={};var _0x49dd50={};var _0x5d3c0f;var _0x1643fc;return db[_0x5990('0x2f')][_0x5990('0x57')]({'where':{'id':_0x21c966['params']['id']}})[_0x5990('0x26')](handleEntityNotFound(_0x595e43,null))['then'](function(_0x179843){if(_0x179843){_0x5d3c0f=_0x179843;_0x49dd50[_0x5990('0x36')]=_['keys'](db[_0x5990('0x67')][_0x5990('0x30')]);_0x49dd50['query']=_['keys'](_0x21c966['query']);_0x49dd50[_0x5990('0x34')]=_[_0x5990('0x35')](_0x49dd50['model'],_0x49dd50[_0x5990('0x33')]);_0xfb0462[_0x5990('0x37')]=_['intersection'](_0x49dd50[_0x5990('0x36')],qs[_0x5990('0x38')](_0x21c966[_0x5990('0x33')][_0x5990('0x38')]));_0xfb0462[_0x5990('0x37')]=_0xfb0462[_0x5990('0x37')][_0x5990('0x59')]?_0xfb0462[_0x5990('0x37')]:_0x49dd50[_0x5990('0x36')];_0xfb0462['order']=qs['sort'](_0x21c966[_0x5990('0x33')]['sort']);_0xfb0462[_0x5990('0x3c')]=qs['filters'](_[_0x5990('0x3d')](_0x21c966[_0x5990('0x33')],_0x49dd50[_0x5990('0x34')]));if(_0x21c966[_0x5990('0x33')]['filter']){_0xfb0462[_0x5990('0x3c')]=_[_0x5990('0x42')](_0xfb0462[_0x5990('0x3c')],{'$or':_[_0x5990('0x3f')](_0xfb0462['attributes'],function(_0x4551ff){var _0x5d75c1={};_0x5d75c1[_0x4551ff]={'$like':'%'+_0x21c966[_0x5990('0x33')]['filter']+'%'};return _0x5d75c1;})});}_0xfb0462=_[_0x5990('0x42')]({},_0xfb0462,_0x21c966[_0x5990('0x43')]);return _0x5d3c0f[_0x5990('0x8d')](_0xfb0462);}})[_0x5990('0x26')](function(_0x2a9012){if(_0x2a9012){_0x1643fc=_0x2a9012[_0x5990('0x59')];if(!_0x21c966['query'][_0x5990('0x39')](_0x5990('0x5a'))){_0xfb0462[_0x5990('0x21')]=qs[_0x5990('0x21')](_0x21c966[_0x5990('0x33')]['limit']);_0xfb0462[_0x5990('0x20')]=qs['offset'](_0x21c966[_0x5990('0x33')][_0x5990('0x20')]);}return _0x5d3c0f['getAgents'](_0xfb0462);}})[_0x5990('0x26')](function(_0x45a93e){if(_0x45a93e){return _0x45a93e?{'count':_0x1643fc,'rows':_0x45a93e}:null;}})['then'](respondWithResult(_0x595e43,null))[_0x5990('0x48')](handleError(_0x595e43,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index afc586b..99e312a 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 _0x9c56=['hook','../../mysqldb','WhatsappQueue','save','update','remove','emit'];(function(_0x5585bf,_0x3a0038){var _0x9f62a8=function(_0x3522bb){while(--_0x3522bb){_0x5585bf['push'](_0x5585bf['shift']());}};_0x9f62a8(++_0x3a0038);}(_0x9c56,0x19e));var _0x69c5=function(_0x444ca7,_0x5acdf6){_0x444ca7=_0x444ca7-0x0;var _0x38ead7=_0x9c56[_0x444ca7];return _0x38ead7;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x69c5('0x0'))['db'][_0x69c5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x69c5('0x2'),'afterUpdate':_0x69c5('0x3'),'afterDestroy':_0x69c5('0x4')};function emitEvent(_0x5ebab7){return function(_0x5d9e16,_0x3edf21,_0x48ebc5){WhatsappQueueEvents[_0x69c5('0x5')](_0x5ebab7+':'+_0x5d9e16['id'],_0x5d9e16);WhatsappQueueEvents[_0x69c5('0x5')](_0x5ebab7,_0x5d9e16);_0x48ebc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x69c5('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x7fe7=['emit','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x578a80,_0x485eb4){var _0x2676fc=function(_0x7512fe){while(--_0x7512fe){_0x578a80['push'](_0x578a80['shift']());}};_0x2676fc(++_0x485eb4);}(_0x7fe7,0x141));var _0x77fe=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x7fe7[_0x4ab3fb];return _0x34fe1e;};'use strict';var EventEmitter=require(_0x77fe('0x0'));var WhatsappQueue=require(_0x77fe('0x1'))['db'][_0x77fe('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x77fe('0x3')](0x0);var events={'afterCreate':_0x77fe('0x4'),'afterUpdate':_0x77fe('0x5'),'afterDestroy':_0x77fe('0x6')};function emitEvent(_0x5d3a32){return function(_0x198022,_0x4e3f5e,_0x4fd6c0){WhatsappQueueEvents[_0x77fe('0x7')](_0x5d3a32+':'+_0x198022['id'],_0x198022);WhatsappQueueEvents[_0x77fe('0x7')](_0x5d3a32,_0x198022);_0x4fd6c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](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 cfc4de3..7274bbd 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 _0x5a74=['rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4fb789,_0x6b8092){var _0x49b5e4=function(_0x256537){while(--_0x256537){_0x4fb789['push'](_0x4fb789['shift']());}};_0x49b5e4(++_0x6b8092);}(_0x5a74,0x16e));var _0x45a7=function(_0x4b630,_0x151f86){_0x4b630=_0x4b630-0x0;var _0x24f855=_0x5a74[_0x4b630];return _0x24f855;};'use strict';var _=require('lodash');var util=require(_0x45a7('0x0'));var logger=require(_0x45a7('0x1'))(_0x45a7('0x2'));var moment=require(_0x45a7('0x3'));var BPromise=require(_0x45a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45a7('0x5'));var rimraf=require(_0x45a7('0x6'));var config=require(_0x45a7('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x45a7('0x8')]=function(_0x598cef,_0x345645){return _0x598cef[_0x45a7('0x9')](_0x45a7('0xa'),attributes,{'tableName':_0x45a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60f5=['../../config/environment','exports','define','WhatsappQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x40299d,_0x5e6d8e){var _0x5b5c8e=function(_0x230ded){while(--_0x230ded){_0x40299d['push'](_0x40299d['shift']());}};_0x5b5c8e(++_0x5e6d8e);}(_0x60f5,0x1a8));var _0x560f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x60f5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x560f('0x0'));var logger=require(_0x560f('0x1'))(_0x560f('0x2'));var moment=require(_0x560f('0x3'));var BPromise=require(_0x560f('0x4'));var rp=require(_0x560f('0x5'));var fs=require('fs');var path=require(_0x560f('0x6'));var rimraf=require(_0x560f('0x7'));var config=require(_0x560f('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x560f('0x9')]=function(_0x50c1b4,_0x26e541){return _0x50c1b4[_0x560f('0xa')](_0x560f('0xb'),attributes,{'tableName':'whatsapp_queues','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 f9b2e61..8164956 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 _0x8672=['./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowWhatsappQueue','find','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0x45b999,_0x39467f){var _0x449e7a=function(_0x1640fa){while(--_0x1640fa){_0x45b999['push'](_0x45b999['shift']());}};_0x449e7a(++_0x39467f);}(_0x8672,0x18c));var _0x2867=function(_0x5b38bd,_0x4efb77){_0x5b38bd=_0x5b38bd-0x0;var _0xf356ab=_0x8672[_0x5b38bd];return _0xf356ab;};'use strict';var _=require(_0x2867('0x0'));var util=require(_0x2867('0x1'));var moment=require(_0x2867('0x2'));var BPromise=require('bluebird');var rs=require(_0x2867('0x3'));var fs=require('fs');var Redis=require(_0x2867('0x4'));var db=require(_0x2867('0x5'))['db'];var utils=require(_0x2867('0x6'));var logger=require(_0x2867('0x7'))(_0x2867('0x8'));var config=require('../../config/environment');var jayson=require(_0x2867('0x9'));var client=jayson['client'][_0x2867('0xa')]({'port':0x232a});config[_0x2867('0xb')]=_[_0x2867('0xc')](config['redis'],{'host':_0x2867('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2867('0xb')]));require(_0x2867('0xe'))['register'](socket);function respondWithRpcPromise(_0xfee459,_0x4a40de,_0x236c61){return new BPromise(function(_0x2fc797,_0xead48e){return client[_0x2867('0xf')](_0xfee459,_0x236c61)[_0x2867('0x10')](function(_0x49fb10){logger[_0x2867('0x11')](_0x2867('0x12'),_0x4a40de,_0x2867('0x13'));logger[_0x2867('0x14')](_0x2867('0x15'),_0x4a40de,_0x2867('0x13'),JSON['stringify'](_0x49fb10));if(_0x49fb10['error']){if(_0x49fb10['error'][_0x2867('0x16')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x4a40de,_0x49fb10[_0x2867('0x17')][_0x2867('0x18')]);return _0xead48e(_0x49fb10[_0x2867('0x17')][_0x2867('0x18')]);}logger[_0x2867('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x4a40de,_0x49fb10[_0x2867('0x17')][_0x2867('0x18')]);return _0x2fc797(_0x49fb10[_0x2867('0x17')]['message']);}else{logger[_0x2867('0x11')](_0x2867('0x12'),_0x4a40de,_0x2867('0x13'));_0x2fc797(_0x49fb10[_0x2867('0x19')][_0x2867('0x18')]);}})['catch'](function(_0xb311a0){logger[_0x2867('0x17')](_0x2867('0x12'),_0x4a40de,_0xb311a0);_0xead48e(_0xb311a0);});});}exports[_0x2867('0x1a')]=function(_0x594145){var _0x55b050=this;return new Promise(function(_0x4902f8,_0x4b03c2){return db[_0x2867('0x1b')][_0x2867('0x1c')]({'raw':_0x594145['options']?_0x594145[_0x2867('0x1d')][_0x2867('0x1e')]===undefined?!![]:![]:!![],'where':_0x594145[_0x2867('0x1d')]?_0x594145[_0x2867('0x1d')][_0x2867('0x1f')]||null:null,'attributes':_0x594145['options']?_0x594145[_0x2867('0x1d')][_0x2867('0x20')]||null:null,'limit':_0x594145[_0x2867('0x1d')]?_0x594145['options'][_0x2867('0x21')]||null:null,'include':_0x594145[_0x2867('0x1d')]?_0x594145[_0x2867('0x1d')]['include']?_['map'](_0x594145[_0x2867('0x1d')][_0x2867('0x22')],function(_0x181315){return{'model':db[_0x181315[_0x2867('0x23')]],'as':_0x181315['as'],'attributes':_0x181315[_0x2867('0x20')],'include':_0x181315[_0x2867('0x22')]?_['map'](_0x181315['include'],function(_0x1f8ae2){return{'model':db[_0x1f8ae2[_0x2867('0x23')]],'as':_0x1f8ae2['as'],'attributes':_0x1f8ae2['attributes'],'include':_0x1f8ae2[_0x2867('0x22')]?_[_0x2867('0x24')](_0x1f8ae2[_0x2867('0x22')],function(_0x38c0a3){return{'model':db[_0x38c0a3[_0x2867('0x23')]],'as':_0x38c0a3['as'],'attributes':_0x38c0a3[_0x2867('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2867('0x10')](function(_0x19bb9b){logger[_0x2867('0x11')](_0x2867('0x1a'),_0x594145);logger[_0x2867('0x14')](_0x2867('0x1a'),_0x594145,JSON[_0x2867('0x25')](_0x19bb9b));_0x4902f8(_0x19bb9b);})['catch'](function(_0x87896e){logger[_0x2867('0x17')](_0x2867('0x1a'),_0x87896e[_0x2867('0x18')],_0x594145);_0x4b03c2(_0x55b050[_0x2867('0x17')](0x1f4,_0x87896e[_0x2867('0x18')]));});});};exports[_0x2867('0x26')]=function(_0x715537){var _0x45b085=this;return new Promise(function(_0xee2710,_0x229573){return db['WhatsappQueue'][_0x2867('0x27')]({'raw':_0x715537['options']?_0x715537[_0x2867('0x1d')][_0x2867('0x1e')]===undefined?!![]:![]:!![],'where':_0x715537[_0x2867('0x1d')]?_0x715537[_0x2867('0x1d')][_0x2867('0x1f')]||null:null,'attributes':_0x715537['options']?_0x715537[_0x2867('0x1d')]['attributes']||null:null,'include':_0x715537[_0x2867('0x1d')]?_0x715537[_0x2867('0x1d')][_0x2867('0x22')]?_[_0x2867('0x24')](_0x715537[_0x2867('0x1d')][_0x2867('0x22')],function(_0x46b841){return{'model':db[_0x46b841['model']],'as':_0x46b841['as'],'attributes':_0x46b841[_0x2867('0x20')],'include':_0x46b841[_0x2867('0x22')]?_['map'](_0x46b841['include'],function(_0x29d42b){return{'model':db[_0x29d42b['model']],'as':_0x29d42b['as'],'attributes':_0x29d42b[_0x2867('0x20')],'include':_0x29d42b[_0x2867('0x22')]?_[_0x2867('0x24')](_0x29d42b[_0x2867('0x22')],function(_0x55aebc){return{'model':db[_0x55aebc[_0x2867('0x23')]],'as':_0x55aebc['as'],'attributes':_0x55aebc[_0x2867('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2867('0x10')](function(_0x1aeb0a){logger[_0x2867('0x11')](_0x2867('0x26'),_0x715537);logger[_0x2867('0x14')]('ShowWhatsappQueue',_0x715537,JSON[_0x2867('0x25')](_0x1aeb0a));_0xee2710(_0x1aeb0a);})[_0x2867('0x28')](function(_0x2854bb){logger[_0x2867('0x17')](_0x2867('0x26'),_0x2854bb[_0x2867('0x18')],_0x715537);_0x229573(_0x45b085[_0x2867('0x17')](0x1f4,_0x2854bb[_0x2867('0x18')]));});});}; \ No newline at end of file +var _0xce9c=['findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowWhatsappQueue','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','info','result','GetWhatsappQueue'];(function(_0xef2a14,_0x4c359a){var _0x242a4d=function(_0x3227c9){while(--_0x3227c9){_0xef2a14['push'](_0xef2a14['shift']());}};_0x242a4d(++_0x4c359a);}(_0xce9c,0x13c));var _0xcce9=function(_0x4acfa2,_0x526ee0){_0x4acfa2=_0x4acfa2-0x0;var _0x4ceb70=_0xce9c[_0x4acfa2];return _0x4ceb70;};'use strict';var _=require('lodash');var util=require(_0xcce9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcce9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcce9('0x2'))['db'];var utils=require(_0xcce9('0x3'));var logger=require(_0xcce9('0x4'))(_0xcce9('0x5'));var config=require(_0xcce9('0x6'));var jayson=require(_0xcce9('0x7'));var client=jayson['client'][_0xcce9('0x8')]({'port':0x232a});config[_0xcce9('0x9')]=_['defaults'](config['redis'],{'host':_0xcce9('0xa'),'port':0x18eb});var socket=require(_0xcce9('0xb'))(new Redis(config[_0xcce9('0x9')]));require('./whatsappQueue.socket')[_0xcce9('0xc')](socket);function respondWithRpcPromise(_0xf448f1,_0x1871e1,_0x5d1b7a){return new BPromise(function(_0x216c16,_0x4f16ef){return client[_0xcce9('0xd')](_0xf448f1,_0x5d1b7a)[_0xcce9('0xe')](function(_0x3beb16){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1871e1,'request\x20sent');logger[_0xcce9('0xf')](_0xcce9('0x10'),_0x1871e1,_0xcce9('0x11'),JSON[_0xcce9('0x12')](_0x3beb16));if(_0x3beb16[_0xcce9('0x13')]){if(_0x3beb16[_0xcce9('0x13')][_0xcce9('0x14')]===0x1f4){logger[_0xcce9('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x1871e1,_0x3beb16[_0xcce9('0x13')][_0xcce9('0x15')]);return _0x4f16ef(_0x3beb16['error'][_0xcce9('0x15')]);}logger['error'](_0xcce9('0x16'),_0x1871e1,_0x3beb16[_0xcce9('0x13')][_0xcce9('0x15')]);return _0x216c16(_0x3beb16[_0xcce9('0x13')][_0xcce9('0x15')]);}else{logger[_0xcce9('0x17')](_0xcce9('0x16'),_0x1871e1,_0xcce9('0x11'));_0x216c16(_0x3beb16[_0xcce9('0x18')][_0xcce9('0x15')]);}})['catch'](function(_0x28b929){logger[_0xcce9('0x13')](_0xcce9('0x16'),_0x1871e1,_0x28b929);_0x4f16ef(_0x28b929);});});}exports[_0xcce9('0x19')]=function(_0x1083f0){var _0x2b9c8c=this;return new Promise(function(_0x25227f,_0x29a982){return db['WhatsappQueue'][_0xcce9('0x1a')]({'raw':_0x1083f0[_0xcce9('0x1b')]?_0x1083f0[_0xcce9('0x1b')][_0xcce9('0x1c')]===undefined?!![]:![]:!![],'where':_0x1083f0[_0xcce9('0x1b')]?_0x1083f0[_0xcce9('0x1b')][_0xcce9('0x1d')]||null:null,'attributes':_0x1083f0[_0xcce9('0x1b')]?_0x1083f0[_0xcce9('0x1b')][_0xcce9('0x1e')]||null:null,'limit':_0x1083f0[_0xcce9('0x1b')]?_0x1083f0[_0xcce9('0x1b')][_0xcce9('0x1f')]||null:null,'include':_0x1083f0[_0xcce9('0x1b')]?_0x1083f0[_0xcce9('0x1b')]['include']?_['map'](_0x1083f0[_0xcce9('0x1b')][_0xcce9('0x20')],function(_0x38757d){return{'model':db[_0x38757d[_0xcce9('0x21')]],'as':_0x38757d['as'],'attributes':_0x38757d[_0xcce9('0x1e')],'include':_0x38757d[_0xcce9('0x20')]?_[_0xcce9('0x22')](_0x38757d[_0xcce9('0x20')],function(_0x40f841){return{'model':db[_0x40f841[_0xcce9('0x21')]],'as':_0x40f841['as'],'attributes':_0x40f841[_0xcce9('0x1e')],'include':_0x40f841[_0xcce9('0x20')]?_['map'](_0x40f841[_0xcce9('0x20')],function(_0x5e940f){return{'model':db[_0x5e940f[_0xcce9('0x21')]],'as':_0x5e940f['as'],'attributes':_0x5e940f[_0xcce9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2acbed){logger[_0xcce9('0x17')](_0xcce9('0x19'),_0x1083f0);logger['debug']('GetWhatsappQueue',_0x1083f0,JSON[_0xcce9('0x12')](_0x2acbed));_0x25227f(_0x2acbed);})[_0xcce9('0x23')](function(_0x4ea977){logger[_0xcce9('0x13')](_0xcce9('0x19'),_0x4ea977[_0xcce9('0x15')],_0x1083f0);_0x29a982(_0x2b9c8c[_0xcce9('0x13')](0x1f4,_0x4ea977[_0xcce9('0x15')]));});});};exports[_0xcce9('0x24')]=function(_0x4cc680){var _0xa30e42=this;return new Promise(function(_0xdfc29,_0x2bc760){return db['WhatsappQueue'][_0xcce9('0x25')]({'raw':_0x4cc680[_0xcce9('0x1b')]?_0x4cc680[_0xcce9('0x1b')][_0xcce9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4cc680[_0xcce9('0x1b')]?_0x4cc680[_0xcce9('0x1b')]['where']||null:null,'attributes':_0x4cc680[_0xcce9('0x1b')]?_0x4cc680[_0xcce9('0x1b')][_0xcce9('0x1e')]||null:null,'include':_0x4cc680[_0xcce9('0x1b')]?_0x4cc680[_0xcce9('0x1b')][_0xcce9('0x20')]?_[_0xcce9('0x22')](_0x4cc680[_0xcce9('0x1b')][_0xcce9('0x20')],function(_0x1bf1d4){return{'model':db[_0x1bf1d4[_0xcce9('0x21')]],'as':_0x1bf1d4['as'],'attributes':_0x1bf1d4[_0xcce9('0x1e')],'include':_0x1bf1d4[_0xcce9('0x20')]?_['map'](_0x1bf1d4[_0xcce9('0x20')],function(_0x4aacec){return{'model':db[_0x4aacec['model']],'as':_0x4aacec['as'],'attributes':_0x4aacec['attributes'],'include':_0x4aacec[_0xcce9('0x20')]?_[_0xcce9('0x22')](_0x4aacec[_0xcce9('0x20')],function(_0x24e6ac){return{'model':db[_0x24e6ac['model']],'as':_0x24e6ac['as'],'attributes':_0x24e6ac[_0xcce9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a7f3d){logger['info'](_0xcce9('0x24'),_0x4cc680);logger[_0xcce9('0xf')](_0xcce9('0x24'),_0x4cc680,JSON['stringify'](_0x2a7f3d));_0xdfc29(_0x2a7f3d);})[_0xcce9('0x23')](function(_0x1b4838){logger[_0xcce9('0x13')](_0xcce9('0x24'),_0x1b4838[_0xcce9('0x15')],_0x4cc680);_0x2bc760(_0xa30e42['error'](0x1f4,_0x1b4838[_0xcce9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 44171a6..193d31b 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 _0xb5f6=['update','emit','removeListener','whatsappQueue:','save','remove'];(function(_0x47c899,_0x100b17){var _0x5cc36e=function(_0x484e60){while(--_0x484e60){_0x47c899['push'](_0x47c899['shift']());}};_0x5cc36e(++_0x100b17);}(_0xb5f6,0x12a));var _0x6b5f=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xb5f6[_0x1064bc];return _0x5edc45;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6b5f('0x0'),_0x6b5f('0x1'),_0x6b5f('0x2')];function createListener(_0x16135e,_0x4ab8c1){return function(_0x3d6fb1){_0x4ab8c1[_0x6b5f('0x3')](_0x16135e,_0x3d6fb1);};}function removeListener(_0x5f5ab5,_0x36b5f1){return function(){WhatsappQueueEvents[_0x6b5f('0x4')](_0x5f5ab5,_0x36b5f1);};}exports['register']=function(_0x33b5b0){for(var _0x11cf81=0x0,_0x40db17=events['length'];_0x11cf81<_0x40db17;_0x11cf81++){var _0x2d8a2b=events[_0x11cf81];var _0x517f26=createListener(_0x6b5f('0x5')+_0x2d8a2b,_0x33b5b0);WhatsappQueueEvents['on'](_0x2d8a2b,_0x517f26);}}; \ No newline at end of file +var _0x703f=['remove','update','emit','removeListener','register','whatsappQueue:'];(function(_0xfd42fa,_0x4568ea){var _0x38ff1f=function(_0x541b98){while(--_0x541b98){_0xfd42fa['push'](_0xfd42fa['shift']());}};_0x38ff1f(++_0x4568ea);}(_0x703f,0x1b6));var _0xf703=function(_0x179a81,_0x1c6665){_0x179a81=_0x179a81-0x0;var _0x5b571f=_0x703f[_0x179a81];return _0x5b571f;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0xf703('0x0'),_0xf703('0x1')];function createListener(_0x279b29,_0x12f9b1){return function(_0x599db5){_0x12f9b1[_0xf703('0x2')](_0x279b29,_0x599db5);};}function removeListener(_0x2b09a2,_0x348981){return function(){WhatsappQueueEvents[_0xf703('0x3')](_0x2b09a2,_0x348981);};}exports[_0xf703('0x4')]=function(_0x3a7652){for(var _0x2737ab=0x0,_0x37ee93=events['length'];_0x2737ab<_0x37ee93;_0x2737ab++){var _0x591306=events[_0x2737ab];var _0x41c83=createListener(_0xf703('0x5')+_0x591306,_0x3a7652);WhatsappQueueEvents['on'](_0x591306,_0x41c83);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b4d8e50..cbdf0db 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 _0x78f0=['isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x78f0,0x15d));var _0x078f=function(_0x580308,_0x3ce453){_0x580308=_0x580308-0x0;var _0x414070=_0x78f0[_0x580308];return _0x414070;};'use strict';var multer=require(_0x078f('0x0'));var util=require(_0x078f('0x1'));var path=require(_0x078f('0x2'));var timeout=require(_0x078f('0x3'));var express=require(_0x078f('0x4'));var router=express[_0x078f('0x5')]();var fs_extra=require(_0x078f('0x6'));var auth=require(_0x078f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x078f('0x8'));var controller=require(_0x078f('0x9'));router[_0x078f('0xa')]('/',auth[_0x078f('0xb')](),controller['index']);router[_0x078f('0xa')](_0x078f('0xc'),auth['isAuthenticated'](),controller[_0x078f('0xd')]);router[_0x078f('0xa')](_0x078f('0xe'),auth[_0x078f('0xb')](),controller[_0x078f('0xf')]);router[_0x078f('0x10')]('/',auth[_0x078f('0xb')](),controller[_0x078f('0x11')]);router['put'](_0x078f('0xe'),auth[_0x078f('0xb')](),controller['update']);router[_0x078f('0x12')](_0x078f('0xe'),auth[_0x078f('0xb')](),controller[_0x078f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9d02=['isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','/describe'];(function(_0x10a94a,_0x1796ac){var _0x612866=function(_0x56a345){while(--_0x56a345){_0x10a94a['push'](_0x10a94a['shift']());}};_0x612866(++_0x1796ac);}(_0x9d02,0x118));var _0x29d0=function(_0xe9949b,_0x35000b){_0xe9949b=_0xe9949b-0x0;var _0x50e968=_0x9d02[_0xe9949b];return _0x50e968;};'use strict';var multer=require(_0x29d0('0x0'));var util=require('util');var path=require(_0x29d0('0x1'));var timeout=require('connect-timeout');var express=require(_0x29d0('0x2'));var router=express['Router']();var fs_extra=require(_0x29d0('0x3'));var auth=require(_0x29d0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x29d0('0x5'));var controller=require(_0x29d0('0x6'));router[_0x29d0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x29d0('0x8'),auth[_0x29d0('0x9')](),controller['describe']);router[_0x29d0('0x7')](_0x29d0('0xa'),auth['isAuthenticated'](),controller[_0x29d0('0xb')]);router[_0x29d0('0xc')]('/',auth['isAuthenticated'](),controller[_0x29d0('0xd')]);router[_0x29d0('0xe')](_0x29d0('0xa'),auth[_0x29d0('0x9')](),controller['update']);router['delete'](_0x29d0('0xa'),auth[_0x29d0('0x9')](),controller[_0x29d0('0xf')]);module[_0x29d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 42c2d01..c623d60 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 _0x7217=['sequelize','STRING','DATE'];(function(_0x2706c2,_0x3c879b){var _0x1ef848=function(_0x2306b3){while(--_0x2306b3){_0x2706c2['push'](_0x2706c2['shift']());}};_0x1ef848(++_0x3c879b);}(_0x7217,0x19e));var _0x7721=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7217[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7721('0x1')]},'joinAt':{'type':Sequelize[_0x7721('0x2')]},'leaveAt':{'type':Sequelize[_0x7721('0x2')]},'acceptAt':{'type':Sequelize[_0x7721('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x86c038,_0x15253c){var _0x323b20=function(_0x3d7173){while(--_0x3d7173){_0x86c038['push'](_0x86c038['shift']());}};_0x323b20(++_0x15253c);}(_0x55ca,0x126));var _0xa55c=function(_0xea98ab,_0x297344){_0xea98ab=_0xea98ab-0x0;var _0x39058e=_0x55ca[_0xea98ab];return _0x39058e;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index cd9e2d3..3ec0ba1 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 _0x6f7a=['sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','filters','pick','filter','merge','where','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','attributes','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x17a21f,_0x29ffca){_0x17a21f=_0x17a21f-0x0;var _0x4e04e4=_0x6f7a[_0x17a21f];return _0x4e04e4;};'use strict';var pdf=require(_0xa6f7('0x0'));var emlformat=require(_0xa6f7('0x1'));var rimraf=require(_0xa6f7('0x2'));var zipdir=require(_0xa6f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6f7('0x4'));var moment=require(_0xa6f7('0x5'));var BPromise=require(_0xa6f7('0x6'));var Mustache=require(_0xa6f7('0x7'));var util=require(_0xa6f7('0x8'));var path=require(_0xa6f7('0x9'));var sox=require(_0xa6f7('0xa'));var csv=require(_0xa6f7('0xb'));var ejs=require(_0xa6f7('0xc'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xd'));var _=require(_0xa6f7('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa6f7('0xf'));var deskjs=require(_0xa6f7('0x10'));var toCsv=require(_0xa6f7('0xb'));var querystring=require(_0xa6f7('0x11'));var Papa=require(_0xa6f7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa6f7('0x13'));var as=require(_0xa6f7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6f7('0x15'))('api');var utils=require(_0xa6f7('0x16'));var config=require(_0xa6f7('0x17'));var licenseUtil=require(_0xa6f7('0x18'));var db=require(_0xa6f7('0x19'))['db'];function respondWithStatusCode(_0x5a3035,_0x3fc7f1){_0x3fc7f1=_0x3fc7f1||0xcc;return function(_0x532352){if(_0x532352){return _0x5a3035[_0xa6f7('0x1a')](_0x3fc7f1);}return _0x5a3035[_0xa6f7('0x1b')](_0x3fc7f1)[_0xa6f7('0x1c')]();};}function respondWithResult(_0x4d3d59,_0x34c02d){_0x34c02d=_0x34c02d||0xc8;return function(_0x491fae){if(_0x491fae){return _0x4d3d59[_0xa6f7('0x1b')](_0x34c02d)['json'](_0x491fae);}};}function respondWithFilteredResult(_0x17b814,_0x17f9c5){return function(_0x6efd38){if(_0x6efd38){var _0x47e664=_0x6efd38[_0xa6f7('0x1d')],_0xdb37e2=_0x17f9c5['offset'],_0x22635e=_0x17f9c5['offset']+_0x17f9c5[_0xa6f7('0x1e')],_0x131959;if(_0x22635e>=_0x47e664){_0x22635e=_0x47e664;_0x131959=0xc8;}else{_0x131959=0xce;}_0x17b814['status'](_0x131959);return _0x17b814[_0xa6f7('0x1f')](_0xa6f7('0x20'),_0xdb37e2+'-'+_0x22635e+'/'+_0x47e664)['json'](_0x6efd38);}return null;};}function patchUpdates(_0x18fc4a){return function(_0xb2cfaa){try{jsonpatch[_0xa6f7('0x21')](_0xb2cfaa,_0x18fc4a,!![]);}catch(_0x35891a){return BPromise[_0xa6f7('0x22')](_0x35891a);}return _0xb2cfaa[_0xa6f7('0x23')]();};}function saveUpdates(_0x4887ad,_0x3c0c55){return function(_0x45d79e){if(_0x45d79e){return _0x45d79e['update'](_0x4887ad)['then'](function(_0x5ddc8d){return _0x5ddc8d;});}return null;};}function removeEntity(_0x1de6c9,_0x119950){return function(_0x566b63){if(_0x566b63){return _0x566b63['destroy']()['then'](function(){_0x1de6c9[_0xa6f7('0x1b')](0xcc)[_0xa6f7('0x1c')]();});}};}function handleEntityNotFound(_0x28263e,_0x5baaa9){return function(_0x484874){if(!_0x484874){_0x28263e[_0xa6f7('0x1a')](0x194);}return _0x484874;};}function handleError(_0x53b3c2,_0x47ef97){_0x47ef97=_0x47ef97||0x1f4;return function(_0x402d25){logger['error'](_0x402d25[_0xa6f7('0x24')]);if(_0x402d25[_0xa6f7('0x25')]){delete _0x402d25[_0xa6f7('0x25')];}_0x53b3c2[_0xa6f7('0x1b')](_0x47ef97)[_0xa6f7('0x26')](_0x402d25);};}exports['index']=function(_0x51db47,_0x1c419b){var _0x2ad0d9={},_0x55d45a={},_0x267917={'count':0x0,'rows':[]};var _0x27babb=_[_0xa6f7('0x27')](db[_0xa6f7('0x28')][_0xa6f7('0x29')],function(_0x10bf77){return{'name':_0x10bf77[_0xa6f7('0x2a')],'type':_0x10bf77[_0xa6f7('0x2b')][_0xa6f7('0x2c')]};});_0x55d45a[_0xa6f7('0x2d')]=_[_0xa6f7('0x27')](_0x27babb,_0xa6f7('0x25'));_0x55d45a['query']=_[_0xa6f7('0x2e')](_0x51db47[_0xa6f7('0x2f')]);_0x55d45a['filters']=_[_0xa6f7('0x30')](_0x55d45a[_0xa6f7('0x2d')],_0x55d45a['query']);_0x2ad0d9['attributes']=_[_0xa6f7('0x30')](_0x55d45a[_0xa6f7('0x2d')],qs[_0xa6f7('0x31')](_0x51db47[_0xa6f7('0x2f')][_0xa6f7('0x31')]));_0x2ad0d9['attributes']=_0x2ad0d9['attributes'][_0xa6f7('0x32')]?_0x2ad0d9['attributes']:_0x55d45a[_0xa6f7('0x2d')];if(!_0x51db47[_0xa6f7('0x2f')][_0xa6f7('0x33')](_0xa6f7('0x34'))){_0x2ad0d9[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x51db47['query'][_0xa6f7('0x1e')]);_0x2ad0d9[_0xa6f7('0x35')]=qs[_0xa6f7('0x35')](_0x51db47['query'][_0xa6f7('0x35')]);}_0x2ad0d9['order']=qs[_0xa6f7('0x36')](_0x51db47[_0xa6f7('0x2f')][_0xa6f7('0x36')]);_0x2ad0d9['where']=qs[_0xa6f7('0x37')](_[_0xa6f7('0x38')](_0x51db47[_0xa6f7('0x2f')],_0x55d45a[_0xa6f7('0x37')]),_0x27babb);if(_0x51db47[_0xa6f7('0x2f')][_0xa6f7('0x39')]){_0x2ad0d9['where']=_[_0xa6f7('0x3a')](_0x2ad0d9[_0xa6f7('0x3b')],{'$or':_[_0xa6f7('0x27')](_0x27babb,function(_0x2c7440){if(_0x2c7440[_0xa6f7('0x2b')]!==_0xa6f7('0x3c')){var _0x45acdd={};_0x45acdd[_0x2c7440[_0xa6f7('0x25')]]={'$like':'%'+_0x51db47['query'][_0xa6f7('0x39')]+'%'};return _0x45acdd;}})});}_0x2ad0d9=_[_0xa6f7('0x3a')]({},_0x2ad0d9,_0x51db47[_0xa6f7('0x3d')]);var _0x518088={'where':_0x2ad0d9[_0xa6f7('0x3b')]};return db[_0xa6f7('0x28')]['count'](_0x518088)[_0xa6f7('0x3e')](function(_0x13c7c4){_0x267917[_0xa6f7('0x1d')]=_0x13c7c4;if(_0x51db47[_0xa6f7('0x2f')][_0xa6f7('0x3f')]){_0x2ad0d9['include']=[{'all':!![]}];}return db[_0xa6f7('0x28')][_0xa6f7('0x40')](_0x2ad0d9);})[_0xa6f7('0x3e')](function(_0x1b8bf3){_0x267917[_0xa6f7('0x41')]=_0x1b8bf3;return _0x267917;})[_0xa6f7('0x3e')](respondWithFilteredResult(_0x1c419b,_0x2ad0d9))[_0xa6f7('0x42')](handleError(_0x1c419b,null));};exports[_0xa6f7('0x43')]=function(_0x5646b9,_0x5ac005){var _0x12f7b5={'raw':!![],'where':{'id':_0x5646b9[_0xa6f7('0x44')]['id']}},_0x3e1535={};_0x3e1535[_0xa6f7('0x2d')]=_[_0xa6f7('0x2e')](db[_0xa6f7('0x28')][_0xa6f7('0x29')]);_0x3e1535[_0xa6f7('0x2f')]=_[_0xa6f7('0x2e')](_0x5646b9[_0xa6f7('0x2f')]);_0x3e1535['filters']=_[_0xa6f7('0x30')](_0x3e1535[_0xa6f7('0x2d')],_0x3e1535['query']);_0x12f7b5[_0xa6f7('0x45')]=_[_0xa6f7('0x30')](_0x3e1535[_0xa6f7('0x2d')],qs[_0xa6f7('0x31')](_0x5646b9['query'][_0xa6f7('0x31')]));_0x12f7b5['attributes']=_0x12f7b5['attributes'][_0xa6f7('0x32')]?_0x12f7b5[_0xa6f7('0x45')]:_0x3e1535[_0xa6f7('0x2d')];if(_0x5646b9[_0xa6f7('0x2f')][_0xa6f7('0x3f')]){_0x12f7b5[_0xa6f7('0x46')]=[{'all':!![]}];}_0x12f7b5=_[_0xa6f7('0x3a')]({},_0x12f7b5,_0x5646b9['options']);return db[_0xa6f7('0x28')][_0xa6f7('0x47')](_0x12f7b5)['then'](handleEntityNotFound(_0x5ac005,null))[_0xa6f7('0x3e')](respondWithResult(_0x5ac005,null))[_0xa6f7('0x42')](handleError(_0x5ac005,null));};exports[_0xa6f7('0x48')]=function(_0x5cc89c,_0xc72eff){return db['WhatsappQueueReport'][_0xa6f7('0x48')](_0x5cc89c[_0xa6f7('0x49')],{})[_0xa6f7('0x3e')](respondWithResult(_0xc72eff,0xc9))['catch'](handleError(_0xc72eff,null));};exports['update']=function(_0x2b06b5,_0x5928e4){if(_0x2b06b5[_0xa6f7('0x49')]['id']){delete _0x2b06b5['body']['id'];}return db['WhatsappQueueReport'][_0xa6f7('0x47')]({'where':{'id':_0x2b06b5[_0xa6f7('0x44')]['id']}})[_0xa6f7('0x3e')](handleEntityNotFound(_0x5928e4,null))[_0xa6f7('0x3e')](saveUpdates(_0x2b06b5[_0xa6f7('0x49')],null))[_0xa6f7('0x3e')](respondWithResult(_0x5928e4,null))['catch'](handleError(_0x5928e4,null));};exports[_0xa6f7('0x4a')]=function(_0x328b47,_0x58080f){return db[_0xa6f7('0x28')]['find']({'where':{'id':_0x328b47[_0xa6f7('0x44')]['id']}})['then'](handleEntityNotFound(_0x58080f,null))['then'](removeEntity(_0x58080f,null))[_0xa6f7('0x42')](handleError(_0x58080f,null));};exports[_0xa6f7('0x4b')]=function(_0x1c9f38,_0x2b3de2){return db[_0xa6f7('0x28')]['describe']()[_0xa6f7('0x3e')](respondWithResult(_0x2b3de2,null))[_0xa6f7('0x42')](handleError(_0x2b3de2,null));}; \ No newline at end of file +var _0x0bb5=['apply','save','update','then','destroy','stack','map','WhatsappQueueReport','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x0bb5,0x148));var _0x50bb=function(_0x258aff,_0xc87b1){_0x258aff=_0x258aff-0x0;var _0x2ea3f5=_0x0bb5[_0x258aff];return _0x2ea3f5;};'use strict';var pdf=require(_0x50bb('0x0'));var emlformat=require(_0x50bb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50bb('0x2'));var rp=require(_0x50bb('0x3'));var moment=require(_0x50bb('0x4'));var BPromise=require(_0x50bb('0x5'));var Mustache=require(_0x50bb('0x6'));var util=require(_0x50bb('0x7'));var path=require(_0x50bb('0x8'));var sox=require(_0x50bb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50bb('0xa'));var _=require(_0x50bb('0xb'));var squel=require(_0x50bb('0xc'));var crypto=require(_0x50bb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x50bb('0xe'));var querystring=require(_0x50bb('0xf'));var Papa=require(_0x50bb('0x10'));var Redis=require(_0x50bb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x50bb('0x12'));var as=require(_0x50bb('0x13'));var hardwareService=require(_0x50bb('0x14'));var logger=require(_0x50bb('0x15'))(_0x50bb('0x16'));var utils=require(_0x50bb('0x17'));var config=require(_0x50bb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x50bb('0x19'))['db'];function respondWithStatusCode(_0x58837d,_0x283f04){_0x283f04=_0x283f04||0xcc;return function(_0xd8ab27){if(_0xd8ab27){return _0x58837d[_0x50bb('0x1a')](_0x283f04);}return _0x58837d['status'](_0x283f04)[_0x50bb('0x1b')]();};}function respondWithResult(_0x309986,_0x3094f2){_0x3094f2=_0x3094f2||0xc8;return function(_0x5244b0){if(_0x5244b0){return _0x309986[_0x50bb('0x1c')](_0x3094f2)['json'](_0x5244b0);}};}function respondWithFilteredResult(_0x21befa,_0x3e1a51){return function(_0x253073){if(_0x253073){var _0x42ffab=_0x253073[_0x50bb('0x1d')],_0x908950=_0x3e1a51['offset'],_0x4f2897=_0x3e1a51[_0x50bb('0x1e')]+_0x3e1a51['limit'],_0x10a191;if(_0x4f2897>=_0x42ffab){_0x4f2897=_0x42ffab;_0x10a191=0xc8;}else{_0x10a191=0xce;}_0x21befa[_0x50bb('0x1c')](_0x10a191);return _0x21befa[_0x50bb('0x1f')]('Content-Range',_0x908950+'-'+_0x4f2897+'/'+_0x42ffab)['json'](_0x253073);}return null;};}function patchUpdates(_0x43465b){return function(_0x1499dc){try{jsonpatch[_0x50bb('0x20')](_0x1499dc,_0x43465b,!![]);}catch(_0x26abe7){return BPromise['reject'](_0x26abe7);}return _0x1499dc[_0x50bb('0x21')]();};}function saveUpdates(_0x32bfc3,_0x4020a0){return function(_0x597e95){if(_0x597e95){return _0x597e95[_0x50bb('0x22')](_0x32bfc3)[_0x50bb('0x23')](function(_0x1344ec){return _0x1344ec;});}return null;};}function removeEntity(_0x4825f8,_0x1dbba2){return function(_0x4cc7f9){if(_0x4cc7f9){return _0x4cc7f9[_0x50bb('0x24')]()[_0x50bb('0x23')](function(){_0x4825f8[_0x50bb('0x1c')](0xcc)[_0x50bb('0x1b')]();});}};}function handleEntityNotFound(_0x846311,_0x342078){return function(_0x4f7f73){if(!_0x4f7f73){_0x846311[_0x50bb('0x1a')](0x194);}return _0x4f7f73;};}function handleError(_0xee0af0,_0x284a76){_0x284a76=_0x284a76||0x1f4;return function(_0x3462c1){logger['error'](_0x3462c1[_0x50bb('0x25')]);if(_0x3462c1['name']){delete _0x3462c1['name'];}_0xee0af0[_0x50bb('0x1c')](_0x284a76)['send'](_0x3462c1);};}exports['index']=function(_0x41fd89,_0x12ee2c){var _0x3004a3={},_0x1b74f9={},_0x17c158={'count':0x0,'rows':[]};var _0x269479=_[_0x50bb('0x26')](db[_0x50bb('0x27')]['rawAttributes'],function(_0x44ce86){return{'name':_0x44ce86[_0x50bb('0x28')],'type':_0x44ce86[_0x50bb('0x29')][_0x50bb('0x2a')]};});_0x1b74f9['model']=_[_0x50bb('0x26')](_0x269479,_0x50bb('0x2b'));_0x1b74f9[_0x50bb('0x2c')]=_[_0x50bb('0x2d')](_0x41fd89[_0x50bb('0x2c')]);_0x1b74f9[_0x50bb('0x2e')]=_[_0x50bb('0x2f')](_0x1b74f9[_0x50bb('0x30')],_0x1b74f9[_0x50bb('0x2c')]);_0x3004a3[_0x50bb('0x31')]=_[_0x50bb('0x2f')](_0x1b74f9[_0x50bb('0x30')],qs['fields'](_0x41fd89[_0x50bb('0x2c')][_0x50bb('0x32')]));_0x3004a3[_0x50bb('0x31')]=_0x3004a3[_0x50bb('0x31')][_0x50bb('0x33')]?_0x3004a3[_0x50bb('0x31')]:_0x1b74f9[_0x50bb('0x30')];if(!_0x41fd89[_0x50bb('0x2c')][_0x50bb('0x34')](_0x50bb('0x35'))){_0x3004a3[_0x50bb('0x36')]=qs['limit'](_0x41fd89[_0x50bb('0x2c')][_0x50bb('0x36')]);_0x3004a3[_0x50bb('0x1e')]=qs[_0x50bb('0x1e')](_0x41fd89[_0x50bb('0x2c')][_0x50bb('0x1e')]);}_0x3004a3['order']=qs['sort'](_0x41fd89[_0x50bb('0x2c')]['sort']);_0x3004a3[_0x50bb('0x37')]=qs[_0x50bb('0x2e')](_[_0x50bb('0x38')](_0x41fd89[_0x50bb('0x2c')],_0x1b74f9[_0x50bb('0x2e')]),_0x269479);if(_0x41fd89['query'][_0x50bb('0x39')]){_0x3004a3['where']=_[_0x50bb('0x3a')](_0x3004a3[_0x50bb('0x37')],{'$or':_[_0x50bb('0x26')](_0x269479,function(_0x4c29c9){if(_0x4c29c9['type']!==_0x50bb('0x3b')){var _0x2e904e={};_0x2e904e[_0x4c29c9[_0x50bb('0x2b')]]={'$like':'%'+_0x41fd89[_0x50bb('0x2c')]['filter']+'%'};return _0x2e904e;}})});}_0x3004a3=_[_0x50bb('0x3a')]({},_0x3004a3,_0x41fd89['options']);var _0x52059b={'where':_0x3004a3[_0x50bb('0x37')]};return db['WhatsappQueueReport'][_0x50bb('0x1d')](_0x52059b)[_0x50bb('0x23')](function(_0x1ef231){_0x17c158[_0x50bb('0x1d')]=_0x1ef231;if(_0x41fd89[_0x50bb('0x2c')][_0x50bb('0x3c')]){_0x3004a3[_0x50bb('0x3d')]=[{'all':!![]}];}return db[_0x50bb('0x27')][_0x50bb('0x3e')](_0x3004a3);})[_0x50bb('0x23')](function(_0x594f16){_0x17c158['rows']=_0x594f16;return _0x17c158;})[_0x50bb('0x23')](respondWithFilteredResult(_0x12ee2c,_0x3004a3))[_0x50bb('0x3f')](handleError(_0x12ee2c,null));};exports[_0x50bb('0x40')]=function(_0x1d929d,_0x5e8085){var _0x41243a={'raw':!![],'where':{'id':_0x1d929d[_0x50bb('0x41')]['id']}},_0x4d34f5={};_0x4d34f5[_0x50bb('0x30')]=_[_0x50bb('0x2d')](db[_0x50bb('0x27')][_0x50bb('0x42')]);_0x4d34f5[_0x50bb('0x2c')]=_[_0x50bb('0x2d')](_0x1d929d[_0x50bb('0x2c')]);_0x4d34f5[_0x50bb('0x2e')]=_[_0x50bb('0x2f')](_0x4d34f5[_0x50bb('0x30')],_0x4d34f5[_0x50bb('0x2c')]);_0x41243a[_0x50bb('0x31')]=_[_0x50bb('0x2f')](_0x4d34f5[_0x50bb('0x30')],qs[_0x50bb('0x32')](_0x1d929d['query'][_0x50bb('0x32')]));_0x41243a['attributes']=_0x41243a[_0x50bb('0x31')][_0x50bb('0x33')]?_0x41243a[_0x50bb('0x31')]:_0x4d34f5[_0x50bb('0x30')];if(_0x1d929d[_0x50bb('0x2c')][_0x50bb('0x3c')]){_0x41243a[_0x50bb('0x3d')]=[{'all':!![]}];}_0x41243a=_[_0x50bb('0x3a')]({},_0x41243a,_0x1d929d[_0x50bb('0x43')]);return db[_0x50bb('0x27')][_0x50bb('0x44')](_0x41243a)[_0x50bb('0x23')](handleEntityNotFound(_0x5e8085,null))[_0x50bb('0x23')](respondWithResult(_0x5e8085,null))[_0x50bb('0x3f')](handleError(_0x5e8085,null));};exports['create']=function(_0x3eb429,_0x4e545f){return db[_0x50bb('0x27')][_0x50bb('0x45')](_0x3eb429[_0x50bb('0x46')],{})[_0x50bb('0x23')](respondWithResult(_0x4e545f,0xc9))[_0x50bb('0x3f')](handleError(_0x4e545f,null));};exports[_0x50bb('0x22')]=function(_0x133dd9,_0x358b3a){if(_0x133dd9['body']['id']){delete _0x133dd9[_0x50bb('0x46')]['id'];}return db[_0x50bb('0x27')][_0x50bb('0x44')]({'where':{'id':_0x133dd9[_0x50bb('0x41')]['id']}})[_0x50bb('0x23')](handleEntityNotFound(_0x358b3a,null))['then'](saveUpdates(_0x133dd9[_0x50bb('0x46')],null))[_0x50bb('0x23')](respondWithResult(_0x358b3a,null))[_0x50bb('0x3f')](handleError(_0x358b3a,null));};exports[_0x50bb('0x24')]=function(_0x77f534,_0x5e050f){return db['WhatsappQueueReport'][_0x50bb('0x44')]({'where':{'id':_0x77f534['params']['id']}})[_0x50bb('0x23')](handleEntityNotFound(_0x5e050f,null))['then'](removeEntity(_0x5e050f,null))[_0x50bb('0x3f')](handleError(_0x5e050f,null));};exports[_0x50bb('0x47')]=function(_0x186bfb,_0x4e67c1){return db[_0x50bb('0x27')][_0x50bb('0x47')]()['then'](respondWithResult(_0x4e67c1,null))[_0x50bb('0x3f')](handleError(_0x4e67c1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 43efef4..5921190 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 _0xe51b=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x36fd5d,_0x1f8293){var _0x510826=function(_0x48c38f){while(--_0x48c38f){_0x36fd5d['push'](_0x36fd5d['shift']());}};_0x510826(++_0x1f8293);}(_0xe51b,0xa6));var _0xbe51=function(_0x3c7354,_0x4ff563){_0x3c7354=_0x3c7354-0x0;var _0x22cc09=_0xe51b[_0x3c7354];return _0x22cc09;};'use strict';var _=require(_0xbe51('0x0'));var util=require('util');var logger=require(_0xbe51('0x1'))(_0xbe51('0x2'));var moment=require(_0xbe51('0x3'));var BPromise=require(_0xbe51('0x4'));var rp=require(_0xbe51('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe51('0x6'));var config=require(_0xbe51('0x7'));var attributes=require(_0xbe51('0x8'));module[_0xbe51('0x9')]=function(_0x451129,_0x3cdb17){return _0x451129[_0xbe51('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0xbe51('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbe51('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e8f=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x21cd08,_0x16cd11){var _0x1d77ba=function(_0x9dcabb){while(--_0x9dcabb){_0x21cd08['push'](_0x21cd08['shift']());}};_0x1d77ba(++_0x16cd11);}(_0x1e8f,0xb1));var _0xf1e8=function(_0xe55873,_0x44b28a){_0xe55873=_0xe55873-0x0;var _0x180fc6=_0x1e8f[_0xe55873];return _0x180fc6;};'use strict';var _=require(_0xf1e8('0x0'));var util=require('util');var logger=require(_0xf1e8('0x1'))(_0xf1e8('0x2'));var moment=require('moment');var BPromise=require(_0xf1e8('0x3'));var rp=require(_0xf1e8('0x4'));var fs=require('fs');var path=require(_0xf1e8('0x5'));var rimraf=require(_0xf1e8('0x6'));var config=require(_0xf1e8('0x7'));var attributes=require(_0xf1e8('0x8'));module[_0xf1e8('0x9')]=function(_0x30826d,_0x42b093){return _0x30826d[_0xf1e8('0xa')](_0xf1e8('0xb'),attributes,{'tableName':_0xf1e8('0xc'),'paranoid':![],'indexes':[{'name':_0xf1e8('0xd'),'fields':[_0xf1e8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 8ca97a3..b11728f 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 _0xca0d=['info','WhatsappQueueReport','update','raw','attributes','UpdateWhatsappQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','body','options'];(function(_0x2a04d4,_0xa57830){var _0x40b2f9=function(_0x44f8cf){while(--_0x44f8cf){_0x2a04d4['push'](_0x2a04d4['shift']());}};_0x40b2f9(++_0xa57830);}(_0xca0d,0xdf));var _0xdca0=function(_0x8f3512,_0x8c54ea){_0x8f3512=_0x8f3512-0x0;var _0x547d7f=_0xca0d[_0x8f3512];return _0x547d7f;};'use strict';var _=require(_0xdca0('0x0'));var util=require(_0xdca0('0x1'));var moment=require(_0xdca0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdca0('0x3'));var db=require(_0xdca0('0x4'))['db'];var utils=require(_0xdca0('0x5'));var logger=require('../../config/logger')(_0xdca0('0x6'));var config=require(_0xdca0('0x7'));var jayson=require(_0xdca0('0x8'));var client=jayson[_0xdca0('0x9')][_0xdca0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46e96d,_0x139485,_0x265af9){return new BPromise(function(_0x155651,_0x304c8f){return client['request'](_0x46e96d,_0x265af9)[_0xdca0('0xb')](function(_0xb7e6a4){logger['info'](_0xdca0('0xc'),_0x139485,_0xdca0('0xd'));logger[_0xdca0('0xe')](_0xdca0('0xf'),_0x139485,_0xdca0('0xd'),JSON[_0xdca0('0x10')](_0xb7e6a4));if(_0xb7e6a4[_0xdca0('0x11')]){if(_0xb7e6a4[_0xdca0('0x11')][_0xdca0('0x12')]===0x1f4){logger[_0xdca0('0x11')](_0xdca0('0xc'),_0x139485,_0xb7e6a4[_0xdca0('0x11')]['message']);return _0x304c8f(_0xb7e6a4['error'][_0xdca0('0x13')]);}logger[_0xdca0('0x11')](_0xdca0('0xc'),_0x139485,_0xb7e6a4[_0xdca0('0x11')]['message']);return _0x155651(_0xb7e6a4[_0xdca0('0x11')][_0xdca0('0x13')]);}else{logger['info'](_0xdca0('0xc'),_0x139485,_0xdca0('0xd'));_0x155651(_0xb7e6a4[_0xdca0('0x14')]['message']);}})[_0xdca0('0x15')](function(_0x327893){logger['error'](_0xdca0('0xc'),_0x139485,_0x327893);_0x304c8f(_0x327893);});});}exports[_0xdca0('0x16')]=function(_0x599deb){var _0x3c80a1=this;return new Promise(function(_0x303266,_0x31d240){return db['WhatsappQueueReport']['create'](_0x599deb[_0xdca0('0x17')],{'raw':_0x599deb['options']?_0x599deb[_0xdca0('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xdca0('0xb')](function(_0x2f8b2e){logger[_0xdca0('0x19')](_0xdca0('0x16'),_0x599deb);logger[_0xdca0('0xe')](_0xdca0('0x16'),_0x599deb,JSON[_0xdca0('0x10')](_0x2f8b2e));_0x303266(_0x2f8b2e);})[_0xdca0('0x15')](function(_0x24aaee){logger['error'](_0xdca0('0x16'),_0x24aaee[_0xdca0('0x13')],_0x599deb);_0x31d240(_0x3c80a1[_0xdca0('0x11')](0x1f4,_0x24aaee['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0xe1e1d4){var _0x716621=this;return new Promise(function(_0x115472,_0x151801){return db[_0xdca0('0x1a')][_0xdca0('0x1b')](_0xe1e1d4['body'],{'raw':_0xe1e1d4[_0xdca0('0x18')]?_0xe1e1d4[_0xdca0('0x18')][_0xdca0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe1e1d4[_0xdca0('0x18')]?_0xe1e1d4[_0xdca0('0x18')]['where']||null:null,'attributes':_0xe1e1d4[_0xdca0('0x18')]?_0xe1e1d4['options'][_0xdca0('0x1d')]||null:null,'limit':_0xe1e1d4[_0xdca0('0x18')]?_0xe1e1d4[_0xdca0('0x18')]['limit']||null:null})[_0xdca0('0xb')](function(_0x216c76){logger['info'](_0xdca0('0x1e'),_0xe1e1d4);logger['debug'](_0xdca0('0x1e'),_0xe1e1d4,JSON['stringify'](_0x216c76));_0x115472(_0x216c76);})['catch'](function(_0xcd094){logger[_0xdca0('0x11')](_0xdca0('0x1e'),_0xcd094[_0xdca0('0x13')],_0xe1e1d4);_0x151801(_0x716621['error'](0x1f4,_0xcd094[_0xdca0('0x13')]));});});}; \ No newline at end of file +var _0x593d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport','limit','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x512d2f,_0xe3f424){var _0x36a5f2=function(_0x45b729){while(--_0x45b729){_0x512d2f['push'](_0x512d2f['shift']());}};_0x36a5f2(++_0xe3f424);}(_0x593d,0xdb));var _0xd593=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x593d[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd593('0x0'));var BPromise=require(_0xd593('0x1'));var rs=require(_0xd593('0x2'));var fs=require('fs');var Redis=require(_0xd593('0x3'));var db=require(_0xd593('0x4'))['db'];var utils=require(_0xd593('0x5'));var logger=require(_0xd593('0x6'))(_0xd593('0x7'));var config=require(_0xd593('0x8'));var jayson=require(_0xd593('0x9'));var client=jayson[_0xd593('0xa')][_0xd593('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a25a4,_0x31d740,_0x278b26){return new BPromise(function(_0x390bd2,_0x562fdc){return client[_0xd593('0xc')](_0x1a25a4,_0x278b26)[_0xd593('0xd')](function(_0x2f36d3){logger[_0xd593('0xe')](_0xd593('0xf'),_0x31d740,'request\x20sent');logger[_0xd593('0x10')](_0xd593('0x11'),_0x31d740,_0xd593('0x12'),JSON[_0xd593('0x13')](_0x2f36d3));if(_0x2f36d3['error']){if(_0x2f36d3[_0xd593('0x14')]['code']===0x1f4){logger['error'](_0xd593('0xf'),_0x31d740,_0x2f36d3[_0xd593('0x14')][_0xd593('0x15')]);return _0x562fdc(_0x2f36d3[_0xd593('0x14')][_0xd593('0x15')]);}logger[_0xd593('0x14')](_0xd593('0xf'),_0x31d740,_0x2f36d3[_0xd593('0x14')][_0xd593('0x15')]);return _0x390bd2(_0x2f36d3[_0xd593('0x14')][_0xd593('0x15')]);}else{logger[_0xd593('0xe')](_0xd593('0xf'),_0x31d740,_0xd593('0x12'));_0x390bd2(_0x2f36d3[_0xd593('0x16')][_0xd593('0x15')]);}})['catch'](function(_0x5a4859){logger[_0xd593('0x14')](_0xd593('0xf'),_0x31d740,_0x5a4859);_0x562fdc(_0x5a4859);});});}exports[_0xd593('0x17')]=function(_0x33c40d){var _0x2790d4=this;return new Promise(function(_0x5a4193,_0x1780cb){return db[_0xd593('0x18')][_0xd593('0x19')](_0x33c40d[_0xd593('0x1a')],{'raw':_0x33c40d[_0xd593('0x1b')]?_0x33c40d[_0xd593('0x1b')][_0xd593('0x1c')]===undefined?!![]:![]:!![]})[_0xd593('0xd')](function(_0x2b893e){logger[_0xd593('0xe')](_0xd593('0x17'),_0x33c40d);logger[_0xd593('0x10')](_0xd593('0x17'),_0x33c40d,JSON[_0xd593('0x13')](_0x2b893e));_0x5a4193(_0x2b893e);})[_0xd593('0x1d')](function(_0x4b3197){logger[_0xd593('0x14')](_0xd593('0x17'),_0x4b3197[_0xd593('0x15')],_0x33c40d);_0x1780cb(_0x2790d4[_0xd593('0x14')](0x1f4,_0x4b3197[_0xd593('0x15')]));});});};exports[_0xd593('0x1e')]=function(_0x1ab80){var _0x47a8dd=this;return new Promise(function(_0x4b7b7c,_0x1ee7d6){return db[_0xd593('0x18')]['update'](_0x1ab80[_0xd593('0x1a')],{'raw':_0x1ab80[_0xd593('0x1b')]?_0x1ab80[_0xd593('0x1b')][_0xd593('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ab80[_0xd593('0x1b')]?_0x1ab80[_0xd593('0x1b')]['where']||null:null,'attributes':_0x1ab80['options']?_0x1ab80[_0xd593('0x1b')]['attributes']||null:null,'limit':_0x1ab80[_0xd593('0x1b')]?_0x1ab80[_0xd593('0x1b')][_0xd593('0x1f')]||null:null})['then'](function(_0x5bfd74){logger[_0xd593('0xe')](_0xd593('0x1e'),_0x1ab80);logger[_0xd593('0x10')](_0xd593('0x1e'),_0x1ab80,JSON[_0xd593('0x13')](_0x5bfd74));_0x4b7b7c(_0x5bfd74);})[_0xd593('0x1d')](function(_0x5eaf73){logger[_0xd593('0x14')](_0xd593('0x1e'),_0x5eaf73[_0xd593('0x15')],_0x1ab80);_0x1ee7d6(_0x47a8dd[_0xd593('0x14')](0x1f4,_0x5eaf73[_0xd593('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 5c31f21..1e1194c 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 _0x2a2d=['/describe','describe','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x2a2d,0xf8));var _0xd2a2=function(_0x470a01,_0x1ef188){_0x470a01=_0x470a01-0x0;var _0x5df181=_0x2a2d[_0x470a01];return _0x5df181;};'use strict';var multer=require(_0xd2a2('0x0'));var util=require(_0xd2a2('0x1'));var path=require(_0xd2a2('0x2'));var timeout=require(_0xd2a2('0x3'));var express=require(_0xd2a2('0x4'));var router=express[_0xd2a2('0x5')]();var fs_extra=require(_0xd2a2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd2a2('0x7'));var config=require(_0xd2a2('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0xd2a2('0x9')]('/',auth[_0xd2a2('0xa')](),controller[_0xd2a2('0xb')]);router[_0xd2a2('0x9')](_0xd2a2('0xc'),auth[_0xd2a2('0xa')](),controller[_0xd2a2('0xd')]);router[_0xd2a2('0x9')]('/:id',auth[_0xd2a2('0xa')](),controller['show']);router[_0xd2a2('0xe')]('/',auth[_0xd2a2('0xa')](),controller[_0xd2a2('0xf')]);router[_0xd2a2('0x10')](_0xd2a2('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xd2a2('0x12')](_0xd2a2('0x11'),auth[_0xd2a2('0xa')](),controller[_0xd2a2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2280=['../../config/environment','./whatsappTransferReport.controller','get','index','/describe','describe','show','post','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3eb052,_0x3f32c4){var _0x3e9e69=function(_0xaf660f){while(--_0xaf660f){_0x3eb052['push'](_0x3eb052['shift']());}};_0x3e9e69(++_0x3f32c4);}(_0x2280,0x116));var _0x0228=function(_0x298a3f,_0x4f128e){_0x298a3f=_0x298a3f-0x0;var _0xb9ff74=_0x2280[_0x298a3f];return _0xb9ff74;};'use strict';var multer=require(_0x0228('0x0'));var util=require(_0x0228('0x1'));var path=require(_0x0228('0x2'));var timeout=require('connect-timeout');var express=require(_0x0228('0x3'));var router=express[_0x0228('0x4')]();var fs_extra=require(_0x0228('0x5'));var auth=require(_0x0228('0x6'));var interaction=require(_0x0228('0x7'));var config=require(_0x0228('0x8'));var controller=require(_0x0228('0x9'));router[_0x0228('0xa')]('/',auth['isAuthenticated'](),controller[_0x0228('0xb')]);router['get'](_0x0228('0xc'),auth['isAuthenticated'](),controller[_0x0228('0xd')]);router[_0x0228('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0228('0xe')]);router[_0x0228('0xf')]('/',auth[_0x0228('0x10')](),controller['create']);router['put']('/:id',auth[_0x0228('0x10')](),controller[_0x0228('0x11')]);router[_0x0228('0x12')](_0x0228('0x13'),auth[_0x0228('0x10')](),controller[_0x0228('0x14')]);module[_0x0228('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a50848a..c1dc195 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(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x757a,0xde));var _0xa757=function(_0x2ddb5a,_0x183f72){_0x2ddb5a=_0x2ddb5a-0x0;var _0x529b10=_0x757a[_0x2ddb5a];return _0x529b10;};'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 _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x56d6c6,_0x2af5e4){var _0x3b1faf=function(_0x21d3f2){while(--_0x21d3f2){_0x56d6c6['push'](_0x56d6c6['shift']());}};_0x3b1faf(++_0x2af5e4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20ed8b,_0xa5ac9c){_0x20ed8b=_0x20ed8b-0x0;var _0x35dcde=_0x5f2f[_0x20ed8b];return _0x35dcde;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 0a02d58..e90981d 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 _0x513c=['api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','map','VIRTUAL','options','WhatsappTransferReport','count','includeAll','findAll','show','params','keys','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x12be7a,_0x3fe14f){var _0x30beb4=function(_0x2b00b5){while(--_0x2b00b5){_0x12be7a['push'](_0x12be7a['shift']());}};_0x30beb4(++_0x3fe14f);}(_0x513c,0xcd));var _0xc513=function(_0x4719b1,_0x4d3628){_0x4719b1=_0x4719b1-0x0;var _0x5cc325=_0x513c[_0x4719b1];return _0x5cc325;};'use strict';var pdf=require(_0xc513('0x0'));var emlformat=require(_0xc513('0x1'));var rimraf=require(_0xc513('0x2'));var zipdir=require(_0xc513('0x3'));var jsonpatch=require(_0xc513('0x4'));var rp=require(_0xc513('0x5'));var moment=require(_0xc513('0x6'));var BPromise=require(_0xc513('0x7'));var Mustache=require(_0xc513('0x8'));var util=require(_0xc513('0x9'));var path=require(_0xc513('0xa'));var sox=require(_0xc513('0xb'));var csv=require('to-csv');var ejs=require(_0xc513('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc513('0xd'));var squel=require(_0xc513('0xe'));var crypto=require(_0xc513('0xf'));var jsforce=require(_0xc513('0x10'));var deskjs=require(_0xc513('0x11'));var toCsv=require(_0xc513('0x12'));var querystring=require(_0xc513('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc513('0x14'));var qs=require(_0xc513('0x15'));var as=require(_0xc513('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc513('0x17'));var utils=require('../../config/utils');var config=require(_0xc513('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc513('0x19'))['db'];function respondWithStatusCode(_0x2f186a,_0x3e64c4){_0x3e64c4=_0x3e64c4||0xcc;return function(_0xaff59){if(_0xaff59){return _0x2f186a[_0xc513('0x1a')](_0x3e64c4);}return _0x2f186a['status'](_0x3e64c4)[_0xc513('0x1b')]();};}function respondWithResult(_0x15962c,_0x337f34){_0x337f34=_0x337f34||0xc8;return function(_0x55622a){if(_0x55622a){return _0x15962c[_0xc513('0x1c')](_0x337f34)['json'](_0x55622a);}};}function respondWithFilteredResult(_0x3538bd,_0x273d58){return function(_0x331200){if(_0x331200){var _0x4568da=_0x331200['count'],_0x20845a=_0x273d58[_0xc513('0x1d')],_0x52bc8c=_0x273d58[_0xc513('0x1d')]+_0x273d58[_0xc513('0x1e')],_0x5de6c8;if(_0x52bc8c>=_0x4568da){_0x52bc8c=_0x4568da;_0x5de6c8=0xc8;}else{_0x5de6c8=0xce;}_0x3538bd[_0xc513('0x1c')](_0x5de6c8);return _0x3538bd[_0xc513('0x1f')]('Content-Range',_0x20845a+'-'+_0x52bc8c+'/'+_0x4568da)[_0xc513('0x20')](_0x331200);}return null;};}function patchUpdates(_0x39d56a){return function(_0x2da18c){try{jsonpatch[_0xc513('0x21')](_0x2da18c,_0x39d56a,!![]);}catch(_0x153be3){return BPromise[_0xc513('0x22')](_0x153be3);}return _0x2da18c[_0xc513('0x23')]();};}function saveUpdates(_0x14b7e1,_0x3f7769){return function(_0x5b36af){if(_0x5b36af){return _0x5b36af[_0xc513('0x24')](_0x14b7e1)[_0xc513('0x25')](function(_0x455f74){return _0x455f74;});}return null;};}function removeEntity(_0x4ea1b8,_0x1faf36){return function(_0x3f2f76){if(_0x3f2f76){return _0x3f2f76[_0xc513('0x26')]()[_0xc513('0x25')](function(){_0x4ea1b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49a288,_0x5e5baf){return function(_0x92a8bb){if(!_0x92a8bb){_0x49a288[_0xc513('0x1a')](0x194);}return _0x92a8bb;};}function handleError(_0x310fd4,_0x1565b2){_0x1565b2=_0x1565b2||0x1f4;return function(_0x4f250d){logger[_0xc513('0x27')](_0x4f250d['stack']);if(_0x4f250d[_0xc513('0x28')]){delete _0x4f250d['name'];}_0x310fd4[_0xc513('0x1c')](_0x1565b2)[_0xc513('0x29')](_0x4f250d);};}exports[_0xc513('0x2a')]=function(_0x25245b,_0x302ec9){var _0x4fd037={},_0x17253a={},_0x496a49={'count':0x0,'rows':[]};var _0x249738=_['map'](db['WhatsappTransferReport'][_0xc513('0x2b')],function(_0x37b416){return{'name':_0x37b416[_0xc513('0x2c')],'type':_0x37b416[_0xc513('0x2d')][_0xc513('0x2e')]};});_0x17253a[_0xc513('0x2f')]=_['map'](_0x249738,'name');_0x17253a[_0xc513('0x30')]=_['keys'](_0x25245b[_0xc513('0x30')]);_0x17253a['filters']=_['intersection'](_0x17253a[_0xc513('0x2f')],_0x17253a[_0xc513('0x30')]);_0x4fd037['attributes']=_[_0xc513('0x31')](_0x17253a['model'],qs['fields'](_0x25245b['query'][_0xc513('0x32')]));_0x4fd037[_0xc513('0x33')]=_0x4fd037[_0xc513('0x33')][_0xc513('0x34')]?_0x4fd037[_0xc513('0x33')]:_0x17253a['model'];if(!_0x25245b[_0xc513('0x30')][_0xc513('0x35')](_0xc513('0x36'))){_0x4fd037[_0xc513('0x1e')]=qs['limit'](_0x25245b[_0xc513('0x30')]['limit']);_0x4fd037[_0xc513('0x1d')]=qs[_0xc513('0x1d')](_0x25245b[_0xc513('0x30')][_0xc513('0x1d')]);}_0x4fd037[_0xc513('0x37')]=qs[_0xc513('0x38')](_0x25245b[_0xc513('0x30')][_0xc513('0x38')]);_0x4fd037['where']=qs[_0xc513('0x39')](_['pick'](_0x25245b['query'],_0x17253a['filters']),_0x249738);if(_0x25245b['query'][_0xc513('0x3a')]){_0x4fd037[_0xc513('0x3b')]=_[_0xc513('0x3c')](_0x4fd037[_0xc513('0x3b')],{'$or':_[_0xc513('0x3d')](_0x249738,function(_0x3790d4){if(_0x3790d4['type']!==_0xc513('0x3e')){var _0x23e930={};_0x23e930[_0x3790d4['name']]={'$like':'%'+_0x25245b[_0xc513('0x30')]['filter']+'%'};return _0x23e930;}})});}_0x4fd037=_['merge']({},_0x4fd037,_0x25245b[_0xc513('0x3f')]);var _0x2328bc={'where':_0x4fd037[_0xc513('0x3b')]};return db[_0xc513('0x40')][_0xc513('0x41')](_0x2328bc)[_0xc513('0x25')](function(_0x139cb5){_0x496a49[_0xc513('0x41')]=_0x139cb5;if(_0x25245b[_0xc513('0x30')][_0xc513('0x42')]){_0x4fd037['include']=[{'all':!![]}];}return db[_0xc513('0x40')][_0xc513('0x43')](_0x4fd037);})[_0xc513('0x25')](function(_0x5f088c){_0x496a49['rows']=_0x5f088c;return _0x496a49;})[_0xc513('0x25')](respondWithFilteredResult(_0x302ec9,_0x4fd037))['catch'](handleError(_0x302ec9,null));};exports[_0xc513('0x44')]=function(_0xb0f5a7,_0x4be8ae){var _0x5b17ed={'raw':!![],'where':{'id':_0xb0f5a7[_0xc513('0x45')]['id']}},_0x22b967={};_0x22b967[_0xc513('0x2f')]=_[_0xc513('0x46')](db[_0xc513('0x40')][_0xc513('0x2b')]);_0x22b967['query']=_['keys'](_0xb0f5a7[_0xc513('0x30')]);_0x22b967[_0xc513('0x39')]=_[_0xc513('0x31')](_0x22b967[_0xc513('0x2f')],_0x22b967[_0xc513('0x30')]);_0x5b17ed[_0xc513('0x33')]=_[_0xc513('0x31')](_0x22b967[_0xc513('0x2f')],qs[_0xc513('0x32')](_0xb0f5a7['query'][_0xc513('0x32')]));_0x5b17ed[_0xc513('0x33')]=_0x5b17ed['attributes']['length']?_0x5b17ed[_0xc513('0x33')]:_0x22b967[_0xc513('0x2f')];if(_0xb0f5a7['query'][_0xc513('0x42')]){_0x5b17ed['include']=[{'all':!![]}];}_0x5b17ed=_[_0xc513('0x3c')]({},_0x5b17ed,_0xb0f5a7[_0xc513('0x3f')]);return db[_0xc513('0x40')][_0xc513('0x47')](_0x5b17ed)[_0xc513('0x25')](handleEntityNotFound(_0x4be8ae,null))[_0xc513('0x25')](respondWithResult(_0x4be8ae,null))[_0xc513('0x48')](handleError(_0x4be8ae,null));};exports['create']=function(_0x11c169,_0x58fd21){return db[_0xc513('0x40')][_0xc513('0x49')](_0x11c169[_0xc513('0x4a')],{})[_0xc513('0x25')](respondWithResult(_0x58fd21,0xc9))[_0xc513('0x48')](handleError(_0x58fd21,null));};exports['update']=function(_0xad10fc,_0x34709c){if(_0xad10fc[_0xc513('0x4a')]['id']){delete _0xad10fc[_0xc513('0x4a')]['id'];}return db[_0xc513('0x40')][_0xc513('0x47')]({'where':{'id':_0xad10fc[_0xc513('0x45')]['id']}})[_0xc513('0x25')](handleEntityNotFound(_0x34709c,null))[_0xc513('0x25')](saveUpdates(_0xad10fc[_0xc513('0x4a')],null))[_0xc513('0x25')](respondWithResult(_0x34709c,null))[_0xc513('0x48')](handleError(_0x34709c,null));};exports[_0xc513('0x26')]=function(_0x3c7607,_0x1e9494){return db[_0xc513('0x40')][_0xc513('0x47')]({'where':{'id':_0x3c7607['params']['id']}})[_0xc513('0x25')](handleEntityNotFound(_0x1e9494,null))[_0xc513('0x25')](removeEntity(_0x1e9494,null))[_0xc513('0x48')](handleError(_0x1e9494,null));};exports[_0xc513('0x4b')]=function(_0x12832b,_0x3e800b){return db[_0xc513('0x40')][_0xc513('0x4b')]()['then'](respondWithResult(_0x3e800b,null))['catch'](handleError(_0x3e800b,null));}; \ No newline at end of file +var _0x67da=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','WhatsappTransferReport','includeAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','reject','save','update','then','destroy','end','error','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length'];(function(_0x1980ac,_0x3b8b9a){var _0xc97dca=function(_0x2fd60a){while(--_0x2fd60a){_0x1980ac['push'](_0x1980ac['shift']());}};_0xc97dca(++_0x3b8b9a);}(_0x67da,0x1cb));var _0xa67d=function(_0x3afc4a,_0x146f14){_0x3afc4a=_0x3afc4a-0x0;var _0x1979ba=_0x67da[_0x3afc4a];return _0x1979ba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa67d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa67d('0x1'));var jsonpatch=require(_0xa67d('0x2'));var rp=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var BPromise=require(_0xa67d('0x5'));var Mustache=require(_0xa67d('0x6'));var util=require(_0xa67d('0x7'));var path=require(_0xa67d('0x8'));var sox=require(_0xa67d('0x9'));var csv=require(_0xa67d('0xa'));var ejs=require(_0xa67d('0xb'));var fs=require('fs');var fs_extra=require(_0xa67d('0xc'));var _=require(_0xa67d('0xd'));var squel=require(_0xa67d('0xe'));var crypto=require(_0xa67d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa67d('0x10'));var toCsv=require(_0xa67d('0xa'));var querystring=require(_0xa67d('0x11'));var Papa=require(_0xa67d('0x12'));var Redis=require(_0xa67d('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa67d('0x14'));var hardwareService=require(_0xa67d('0x15'));var logger=require(_0xa67d('0x16'))(_0xa67d('0x17'));var utils=require(_0xa67d('0x18'));var config=require(_0xa67d('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36e4c6,_0x2e8812){_0x2e8812=_0x2e8812||0xcc;return function(_0x896b71){if(_0x896b71){return _0x36e4c6[_0xa67d('0x1a')](_0x2e8812);}return _0x36e4c6[_0xa67d('0x1b')](_0x2e8812)['end']();};}function respondWithResult(_0xc6242,_0x59ae1e){_0x59ae1e=_0x59ae1e||0xc8;return function(_0x48a673){if(_0x48a673){return _0xc6242[_0xa67d('0x1b')](_0x59ae1e)['json'](_0x48a673);}};}function respondWithFilteredResult(_0x29e47c,_0x11c1d9){return function(_0x14ba6f){if(_0x14ba6f){var _0x49c7d1=_0x14ba6f[_0xa67d('0x1c')],_0x54fb44=_0x11c1d9[_0xa67d('0x1d')],_0x202a4c=_0x11c1d9[_0xa67d('0x1d')]+_0x11c1d9['limit'],_0x3e0737;if(_0x202a4c>=_0x49c7d1){_0x202a4c=_0x49c7d1;_0x3e0737=0xc8;}else{_0x3e0737=0xce;}_0x29e47c['status'](_0x3e0737);return _0x29e47c[_0xa67d('0x1e')]('Content-Range',_0x54fb44+'-'+_0x202a4c+'/'+_0x49c7d1)['json'](_0x14ba6f);}return null;};}function patchUpdates(_0x30d078){return function(_0xa770ab){try{jsonpatch['apply'](_0xa770ab,_0x30d078,!![]);}catch(_0x2c9733){return BPromise[_0xa67d('0x1f')](_0x2c9733);}return _0xa770ab[_0xa67d('0x20')]();};}function saveUpdates(_0x4392bf,_0x52762a){return function(_0x1dee9d){if(_0x1dee9d){return _0x1dee9d[_0xa67d('0x21')](_0x4392bf)[_0xa67d('0x22')](function(_0x47ddb3){return _0x47ddb3;});}return null;};}function removeEntity(_0x545811,_0x21e405){return function(_0x4f7e28){if(_0x4f7e28){return _0x4f7e28[_0xa67d('0x23')]()['then'](function(){_0x545811['status'](0xcc)[_0xa67d('0x24')]();});}};}function handleEntityNotFound(_0x3594cd,_0x7ae533){return function(_0x5e5b6e){if(!_0x5e5b6e){_0x3594cd[_0xa67d('0x1a')](0x194);}return _0x5e5b6e;};}function handleError(_0x20454f,_0x439c23){_0x439c23=_0x439c23||0x1f4;return function(_0x20705a){logger[_0xa67d('0x25')](_0x20705a['stack']);if(_0x20705a[_0xa67d('0x26')]){delete _0x20705a[_0xa67d('0x26')];}_0x20454f['status'](_0x439c23)['send'](_0x20705a);};}exports['index']=function(_0x389a8c,_0x259317){var _0x5f43aa={},_0x1159cf={},_0x243968={'count':0x0,'rows':[]};var _0xe1794c=_[_0xa67d('0x27')](db['WhatsappTransferReport'][_0xa67d('0x28')],function(_0x11b597){return{'name':_0x11b597[_0xa67d('0x29')],'type':_0x11b597[_0xa67d('0x2a')][_0xa67d('0x2b')]};});_0x1159cf[_0xa67d('0x2c')]=_['map'](_0xe1794c,'name');_0x1159cf['query']=_[_0xa67d('0x2d')](_0x389a8c[_0xa67d('0x2e')]);_0x1159cf[_0xa67d('0x2f')]=_['intersection'](_0x1159cf[_0xa67d('0x2c')],_0x1159cf[_0xa67d('0x2e')]);_0x5f43aa['attributes']=_[_0xa67d('0x30')](_0x1159cf['model'],qs[_0xa67d('0x31')](_0x389a8c['query'][_0xa67d('0x31')]));_0x5f43aa[_0xa67d('0x32')]=_0x5f43aa[_0xa67d('0x32')][_0xa67d('0x33')]?_0x5f43aa['attributes']:_0x1159cf[_0xa67d('0x2c')];if(!_0x389a8c[_0xa67d('0x2e')][_0xa67d('0x34')](_0xa67d('0x35'))){_0x5f43aa[_0xa67d('0x36')]=qs[_0xa67d('0x36')](_0x389a8c[_0xa67d('0x2e')]['limit']);_0x5f43aa[_0xa67d('0x1d')]=qs['offset'](_0x389a8c[_0xa67d('0x2e')][_0xa67d('0x1d')]);}_0x5f43aa[_0xa67d('0x37')]=qs['sort'](_0x389a8c[_0xa67d('0x2e')][_0xa67d('0x38')]);_0x5f43aa[_0xa67d('0x39')]=qs[_0xa67d('0x2f')](_[_0xa67d('0x3a')](_0x389a8c[_0xa67d('0x2e')],_0x1159cf[_0xa67d('0x2f')]),_0xe1794c);if(_0x389a8c[_0xa67d('0x2e')][_0xa67d('0x3b')]){_0x5f43aa[_0xa67d('0x39')]=_[_0xa67d('0x3c')](_0x5f43aa['where'],{'$or':_[_0xa67d('0x27')](_0xe1794c,function(_0x50d902){if(_0x50d902['type']!=='VIRTUAL'){var _0x4fb133={};_0x4fb133[_0x50d902[_0xa67d('0x26')]]={'$like':'%'+_0x389a8c[_0xa67d('0x2e')][_0xa67d('0x3b')]+'%'};return _0x4fb133;}})});}_0x5f43aa=_[_0xa67d('0x3c')]({},_0x5f43aa,_0x389a8c['options']);var _0x2ec2fc={'where':_0x5f43aa[_0xa67d('0x39')]};return db[_0xa67d('0x3d')][_0xa67d('0x1c')](_0x2ec2fc)[_0xa67d('0x22')](function(_0x22fb8b){_0x243968[_0xa67d('0x1c')]=_0x22fb8b;if(_0x389a8c[_0xa67d('0x2e')][_0xa67d('0x3e')]){_0x5f43aa['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x5f43aa);})[_0xa67d('0x22')](function(_0x9b6d76){_0x243968[_0xa67d('0x3f')]=_0x9b6d76;return _0x243968;})[_0xa67d('0x22')](respondWithFilteredResult(_0x259317,_0x5f43aa))[_0xa67d('0x40')](handleError(_0x259317,null));};exports[_0xa67d('0x41')]=function(_0x5cd9e8,_0x5ed400){var _0x9499c9={'raw':!![],'where':{'id':_0x5cd9e8[_0xa67d('0x42')]['id']}},_0xf9854a={};_0xf9854a[_0xa67d('0x2c')]=_[_0xa67d('0x2d')](db[_0xa67d('0x3d')][_0xa67d('0x28')]);_0xf9854a[_0xa67d('0x2e')]=_[_0xa67d('0x2d')](_0x5cd9e8['query']);_0xf9854a['filters']=_[_0xa67d('0x30')](_0xf9854a[_0xa67d('0x2c')],_0xf9854a[_0xa67d('0x2e')]);_0x9499c9[_0xa67d('0x32')]=_[_0xa67d('0x30')](_0xf9854a[_0xa67d('0x2c')],qs[_0xa67d('0x31')](_0x5cd9e8['query']['fields']));_0x9499c9[_0xa67d('0x32')]=_0x9499c9[_0xa67d('0x32')][_0xa67d('0x33')]?_0x9499c9[_0xa67d('0x32')]:_0xf9854a[_0xa67d('0x2c')];if(_0x5cd9e8[_0xa67d('0x2e')][_0xa67d('0x3e')]){_0x9499c9[_0xa67d('0x43')]=[{'all':!![]}];}_0x9499c9=_[_0xa67d('0x3c')]({},_0x9499c9,_0x5cd9e8[_0xa67d('0x44')]);return db[_0xa67d('0x3d')][_0xa67d('0x45')](_0x9499c9)[_0xa67d('0x22')](handleEntityNotFound(_0x5ed400,null))[_0xa67d('0x22')](respondWithResult(_0x5ed400,null))['catch'](handleError(_0x5ed400,null));};exports[_0xa67d('0x46')]=function(_0x2c0341,_0x20194c){return db[_0xa67d('0x3d')][_0xa67d('0x46')](_0x2c0341['body'],{})['then'](respondWithResult(_0x20194c,0xc9))['catch'](handleError(_0x20194c,null));};exports[_0xa67d('0x21')]=function(_0x3ce4fe,_0x3ed08f){if(_0x3ce4fe[_0xa67d('0x47')]['id']){delete _0x3ce4fe[_0xa67d('0x47')]['id'];}return db['WhatsappTransferReport'][_0xa67d('0x45')]({'where':{'id':_0x3ce4fe[_0xa67d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3ed08f,null))[_0xa67d('0x22')](saveUpdates(_0x3ce4fe['body'],null))['then'](respondWithResult(_0x3ed08f,null))[_0xa67d('0x40')](handleError(_0x3ed08f,null));};exports[_0xa67d('0x23')]=function(_0x162582,_0x5f4351){return db[_0xa67d('0x3d')]['find']({'where':{'id':_0x162582[_0xa67d('0x42')]['id']}})[_0xa67d('0x22')](handleEntityNotFound(_0x5f4351,null))[_0xa67d('0x22')](removeEntity(_0x5f4351,null))[_0xa67d('0x40')](handleError(_0x5f4351,null));};exports[_0xa67d('0x48')]=function(_0x531598,_0x3302db){return db[_0xa67d('0x3d')][_0xa67d('0x48')]()[_0xa67d('0x22')](respondWithResult(_0x3302db,null))['catch'](handleError(_0x3302db,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6c1246b..cc0ee32 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 _0xd6bc=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6bc,0xe3));var _0xcd6b=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xd6bc[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xcd6b('0x0'));var util=require('util');var logger=require(_0xcd6b('0x1'))(_0xcd6b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcd6b('0x3'));var fs=require('fs');var path=require(_0xcd6b('0x4'));var rimraf=require(_0xcd6b('0x5'));var config=require(_0xcd6b('0x6'));var attributes=require(_0xcd6b('0x7'));module[_0xcd6b('0x8')]=function(_0x2becf7,_0x5f4f83){return _0x2becf7[_0xcd6b('0x9')](_0xcd6b('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xcd6b('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf814=['util','api','moment','bluebird','path','exports','define','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf814,0x1e9));var _0x4f81=function(_0x57beaf,_0x165fb5){_0x57beaf=_0x57beaf-0x0;var _0x1f23c6=_0xf814[_0x57beaf];return _0x1f23c6;};'use strict';var _=require(_0x4f81('0x0'));var util=require(_0x4f81('0x1'));var logger=require('../../config/logger')(_0x4f81('0x2'));var moment=require(_0x4f81('0x3'));var BPromise=require(_0x4f81('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f81('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x4f81('0x6')]=function(_0x5d4b1f,_0x598e57){return _0x5d4b1f[_0x4f81('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0x4f81('0x8'),'paranoid':![],'indexes':[{'name':_0x4f81('0x9'),'fields':[_0x4f81('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 2c18262..cd1a3e3 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(_0x483fa4,_0x167378){var _0x8ec464=function(_0x25bd78){while(--_0x25bd78){_0x483fa4['push'](_0x483fa4['shift']());}};_0x8ec464(++_0x167378);}(_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 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(_0x30f520,_0x1e4b11){var _0x406781=function(_0x35617e){while(--_0x35617e){_0x30f520['push'](_0x30f520['shift']());}};_0x406781(++_0x1e4b11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 d26b549..b9da371 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8e=['./config/license','error','exit','lodash','./rpc','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','./config/seedDB','default'];(function(_0x3df4ee,_0x47c6ad){var _0x4ca14b=function(_0x13f13a){while(--_0x13f13a){_0x3df4ee['push'](_0x3df4ee['shift']());}};_0x4ca14b(++_0x47c6ad);}(_0x8b8e,0x108));var _0xe8b8=function(_0x794ad,_0x33a884){_0x794ad=_0x794ad-0x0;var _0x3360c1=_0x8b8e[_0x794ad];return _0x3360c1;};'use strict';var _=require(_0xe8b8('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xe8b8('0x1'));var config=require('./config/environment');var logger=require(_0xe8b8('0x2'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xe8b8('0x3'));var schedule=require(_0xe8b8('0x4'));var chat=require(_0xe8b8('0x5'));var whatsapp=require(_0xe8b8('0x6'));var transcribe=require(_0xe8b8('0x7'));function main(){return mysqldb['db'][_0xe8b8('0x8')][_0xe8b8('0x9')]()[_0xe8b8('0xa')](function(){return rpc[_0xe8b8('0xb')]();})[_0xe8b8('0xa')](function(_0x4ce796){logger[_0xe8b8('0xc')](_0x4ce796);return chat['start']();})[_0xe8b8('0xa')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xe8b8('0xd')]();})[_0xe8b8('0xa')](function(){return transcribe['start']();})['then'](function(_0x259a1a){logger[_0xe8b8('0xc')](_0x259a1a);return pm2[_0xe8b8('0xd')](pm2Config);})[_0xe8b8('0xa')](function(_0xf5b5b1){logger[_0xe8b8('0xc')](_0xe8b8('0xe'),_[_0xe8b8('0xf')](_[_0xe8b8('0x10')](_0xf5b5b1,{'status':_0xe8b8('0x11')}),_0xe8b8('0x12'))[_0xe8b8('0x13')]());logger[_0xe8b8('0xc')](_0xe8b8('0x14'),_['map'](_[_0xe8b8('0x10')](_0xf5b5b1,function(_0x52ff32){return _0x52ff32[_0xe8b8('0x15')]!==_0xe8b8('0x11');}),_0xe8b8('0x12'))[_0xe8b8('0x13')]()||_0xe8b8('0x16'));config[_0xe8b8('0x17')]&&require(_0xe8b8('0x18'))[_0xe8b8('0x19')]();require(_0xe8b8('0x1a'))[_0xe8b8('0x19')]();})['catch'](function(_0xbaca4a){logger[_0xe8b8('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xbaca4a);process[_0xe8b8('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x18f3=['start','info','Online\x20apps:','online','name','join','Offline\x20apps:','map','filter','status','None','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/environment','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then'];(function(_0x41092a,_0x5ccb0c){var _0x3fa970=function(_0x4763c6){while(--_0x4763c6){_0x41092a['push'](_0x41092a['shift']());}};_0x3fa970(++_0x5ccb0c);}(_0x18f3,0x19f));var _0x318f=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x18f3[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var mysqldb=require(_0x318f('0x0'));var rpc=require(_0x318f('0x1'));var config=require(_0x318f('0x2'));var logger=require('./config/logger')('app');var pm2=require(_0x318f('0x3'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x318f('0x4'));var chat=require(_0x318f('0x5'));var whatsapp=require(_0x318f('0x6'));var transcribe=require(_0x318f('0x7'));function main(){return mysqldb['db']['sequelize'][_0x318f('0x8')]()[_0x318f('0x9')](function(){return rpc['listen']();})['then'](function(_0x4618c1){logger['info'](_0x4618c1);return chat[_0x318f('0xa')]();})[_0x318f('0x9')](function(){return whatsapp[_0x318f('0xa')]();})[_0x318f('0x9')](function(){return schedule[_0x318f('0xa')]();})[_0x318f('0x9')](function(){return transcribe[_0x318f('0xa')]();})[_0x318f('0x9')](function(_0x1e9916){logger[_0x318f('0xb')](_0x1e9916);return pm2[_0x318f('0xa')](pm2Config);})[_0x318f('0x9')](function(_0x3098f9){logger[_0x318f('0xb')](_0x318f('0xc'),_['map'](_['filter'](_0x3098f9,{'status':_0x318f('0xd')}),_0x318f('0xe'))[_0x318f('0xf')]());logger[_0x318f('0xb')](_0x318f('0x10'),_[_0x318f('0x11')](_[_0x318f('0x12')](_0x3098f9,function(_0x4e6b05){return _0x4e6b05[_0x318f('0x13')]!=='online';}),'name')[_0x318f('0xf')]()||_0x318f('0x14'));config['seedDB']&&require('./config/seedDB')[_0x318f('0x15')]();require('./config/license')[_0x318f('0x15')]();})[_0x318f('0x16')](function(_0x2ff62b){logger[_0x318f('0x17')](_0x318f('0x18'),_0x2ff62b);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index f3633a7..8c5216d 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 _0x5b2e=['hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','User','find','authenticate','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','canUpdate','Forbidden','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','join','sign','secret','payload','promisify','verify','randomBytes','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','session','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort'];(function(_0x2540f9,_0x1d46a4){var _0x39f15d=function(_0x194bee){while(--_0x194bee){_0x2540f9['push'](_0x2540f9['shift']());}};_0x39f15d(++_0x1d46a4);}(_0x5b2e,0x147));var _0xe5b2=function(_0x1e7263,_0x32b2e8){_0x1e7263=_0x1e7263-0x0;var _0x12971e=_0x5b2e[_0x1e7263];return _0x12971e;};'use strict';var db=require(_0xe5b2('0x0'))['db'];var config=require(_0xe5b2('0x1'));var hardwareConf=require(_0xe5b2('0x2'));var licenseUtil=require(_0xe5b2('0x3'));var encryptor=require(_0xe5b2('0x4'));var _=require(_0xe5b2('0x5'));var jwt=require(_0xe5b2('0x6'));var expressJwt=require(_0xe5b2('0x7'));var compose=require(_0xe5b2('0x8'));var basicAuth=require(_0xe5b2('0x9'));var crypto=require('crypto');var BPromise=require(_0xe5b2('0xa'));var util=require(_0xe5b2('0xb'));var moment=require(_0xe5b2('0xc'));var validateJwt=expressJwt({'secret':config['secrets'][_0xe5b2('0xd')]});var userAttributes=['id',_0xe5b2('0xe'),_0xe5b2('0xf'),_0xe5b2('0x10'),_0xe5b2('0x11'),_0xe5b2('0x12'),'userpic',_0xe5b2('0x13'),_0xe5b2('0x14'),_0xe5b2('0x15'),_0xe5b2('0x16'),_0xe5b2('0x17'),_0xe5b2('0x18'),_0xe5b2('0x19'),_0xe5b2('0x1a'),'pauseType',_0xe5b2('0x1b'),_0xe5b2('0x1c'),_0xe5b2('0x1d'),_0xe5b2('0x1e'),_0xe5b2('0x1f'),_0xe5b2('0x20'),_0xe5b2('0x21'),_0xe5b2('0x22'),_0xe5b2('0x23'),_0xe5b2('0x24'),_0xe5b2('0x25'),_0xe5b2('0x26'),'phoneBarEnableSettings','phoneBarExpires',_0xe5b2('0x27'),_0xe5b2('0x28'),_0xe5b2('0x29'),_0xe5b2('0x2a'),_0xe5b2('0x2b'),_0xe5b2('0x2c'),'privacyEnabled',_0xe5b2('0x2d')];exports[_0xe5b2('0x2e')]=function(){return this[_0xe5b2('0x2f')](!![])['use'](function(_0x1579a3,_0x12d6e0,_0x3d7698){if(_0x1579a3[_0xe5b2('0x30')]){_0x3d7698();}else{return db[_0xe5b2('0x31')][_0xe5b2('0x32')]({'where':{'id':_0x1579a3[_0xe5b2('0x33')]['id']},'attributes':['id',_0xe5b2('0x34'),_0xe5b2('0x35')],'raw':!![]})[_0xe5b2('0x36')](function(_0x7cae5f){if(_0x7cae5f&&_0x7cae5f[_0xe5b2('0x34')]){return _0x12d6e0[_0xe5b2('0x37')](_0x7cae5f['disposition']===_0xe5b2('0x38')?0x195:0x193)[_0xe5b2('0x39')]({'message':_0x7cae5f['disposition']==='unmanaged'?_0xe5b2('0x3a'):_0xe5b2('0x3b')});}else{_0x3d7698();}})[_0xe5b2('0x3c')](function(_0xc8b2f6){_0x3d7698(_0xc8b2f6);});}});};exports[_0xe5b2('0x2f')]=function isAuthenticated(_0x44acf6){return compose()[_0xe5b2('0x3d')](function(_0x451324,_0x112d19,_0x41c84b){var _0x57f425;if(_0x451324[_0xe5b2('0x3e')][_0xe5b2('0x3f')]){if(_[_0xe5b2('0x40')](_0x451324['headers'][_0xe5b2('0x3f')],'Basic')){var _0x227e87=basicAuth(_0x451324);db[_0xe5b2('0x41')][_0xe5b2('0x42')]({'where':{'name':_0x227e87['name']}})['then'](function(_0x2d5ca0){if(!_0x2d5ca0||!_0x2d5ca0[_0xe5b2('0x43')](_0x227e87['pass'])){return _0x112d19[_0xe5b2('0x37')](0x191)[_0xe5b2('0x39')]({'message':_0xe5b2('0x44')});}_0x451324[_0xe5b2('0x30')]={'id':_0x2d5ca0['id']};_0x41c84b();})[_0xe5b2('0x3c')](function(_0x139782){_0x41c84b(_0x139782);});}else if(_[_0xe5b2('0x40')](_0x451324[_0xe5b2('0x3e')][_0xe5b2('0x3f')],'Bearer')){validateJwt(_0x451324,_0x112d19,_0x41c84b);}else{if(_0x44acf6){_0x41c84b();}else{return _0x112d19[_0xe5b2('0x37')](0x193)['json']({'message':_0xe5b2('0x45')});}}}else if(_0x451324[_0xe5b2('0x46')][_0xe5b2('0x47')]){try{var _0x4da5cd={'audience':hardwareConf[_0xe5b2('0x48')](),'issuer':hardwareConf[_0xe5b2('0x48')]()};verifyJwt(_0x451324[_0xe5b2('0x46')][_0xe5b2('0x47')],_0x4da5cd)[_0xe5b2('0x36')](function(_0x70b88b){return db['User'][_0xe5b2('0x42')]({'where':{'id':_0x70b88b[_0xe5b2('0x49')]}})[_0xe5b2('0x36')](function(_0x3b34ff){_0x57f425=_0x3b34ff;return db[_0xe5b2('0x4a')][_0xe5b2('0x32')]({'where':{'id':0x1},'attributes':[_0xe5b2('0x4b'),_0xe5b2('0x4c')],'raw':!![]});})[_0xe5b2('0x36')](function(_0x1d8582){if(!_0x57f425||!_[_0xe5b2('0x4d')](_0x57f425[_0xe5b2('0x4e')],_0x70b88b[_0xe5b2('0x4f')])){return _0x112d19[_0xe5b2('0x37')](0x191)[_0xe5b2('0x39')]({'message':_0xe5b2('0x50')});}if(_0x57f425[_0xe5b2('0x51')]){return _0x112d19[_0xe5b2('0x37')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x57f425[_0xe5b2('0x52')]){if(_0x1d8582[_0xe5b2('0x4c')]>0x0){if(moment(_0x57f425[_0xe5b2('0x53')])[_0xe5b2('0x54')](_0x1d8582[_0xe5b2('0x4c')],'minutes')>moment()){return _0x112d19[_0xe5b2('0x37')](0x191)['json']({'message':_0xe5b2('0x55')});}}else{return _0x112d19[_0xe5b2('0x37')](0x191)[_0xe5b2('0x39')]({'message':_0xe5b2('0x55')});}}_0x451324[_0xe5b2('0x30')]={'id':_0x57f425['id']};_0x41c84b();});})[_0xe5b2('0x3c')](function(){return _0x112d19[_0xe5b2('0x37')](0x191)[_0xe5b2('0x39')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e963b){_0x41c84b(_0x1e963b);}}else if(_0x44acf6){_0x41c84b();}else{return _0x112d19[_0xe5b2('0x37')](0x193)['json']({'message':_0xe5b2('0x45')});}})[_0xe5b2('0x3d')](function(_0x1968c3,_0x291e0d,_0x5c328b){if(_0x1968c3[_0xe5b2('0x30')]){db[_0xe5b2('0x41')]['find']({'where':{'id':_0x1968c3[_0xe5b2('0x30')]['id']},'attributes':userAttributes})[_0xe5b2('0x36')](function(_0x58c93f){if(!_0x58c93f){return _0x291e0d[_0xe5b2('0x37')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x1968c3[_0xe5b2('0x30')]=_0x58c93f;_0x5c328b();})[_0xe5b2('0x3c')](function(_0x148811){_0x5c328b(_0x148811);});}else if(_0x44acf6){_0x5c328b();}else{return _0x291e0d['status'](0x194)[_0xe5b2('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xe5b2('0x56')]=function canUpdate(){return compose()[_0xe5b2('0x3d')](function(_0x3dfb1c,_0x4958d9,_0x3af485){return licenseUtil['getLicense']()[_0xe5b2('0x36')](function(_0x1c6f5d){if(_0x1c6f5d['update']){_0x3af485();}else{return _0x4958d9[_0xe5b2('0x37')](0x193)[_0xe5b2('0x39')]({'message':_0xe5b2('0x57')});}})['catch'](function(_0x35cea5){_0x3af485(_0x35cea5);});});};exports[_0xe5b2('0x58')]=function(_0x386df4,_0x231ec5,_0x3a1b17){_0x386df4[_0xe5b2('0x58')]=!![];return _0x3a1b17();};exports['signToken']=function signToken(_0x465bd9){return signJwt(_0x465bd9);};exports['setTokenCookie']=function(_0x1223f8,_0x4e3a62){if(!_0x1223f8[_0xe5b2('0x30')]){return _0x4e3a62[_0xe5b2('0x37')](0x194)[_0xe5b2('0x39')]({'message':_0xe5b2('0x59')});}var _0xcbcca={'payload':{'id':_0x1223f8[_0xe5b2('0x30')]['id'],'role':_0x1223f8[_0xe5b2('0x30')][_0xe5b2('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcbcca)[_0xe5b2('0x36')](function(_0x478e3f){_0x4e3a62[_0xe5b2('0x5a')](_0xe5b2('0x5b'),_0x478e3f);_0x4e3a62[_0xe5b2('0x5c')](_0xe5b2('0x5d'));})['catch'](function(_0x496b49){return _0x4e3a62['status'](0x1f4)[_0xe5b2('0x5e')](_0x496b49);});};exports['retrieveApiKey']=function(_0x1d6838){if(_[_0xe5b2('0x5f')](_0x1d6838[_0xe5b2('0x4e')])||_['isNil'](_0x1d6838[_0xe5b2('0x60')])){return null;}else{return createJwt(_0x1d6838);}};exports[_0xe5b2('0x61')]=function(_0xf4fd84){_0xf4fd84[_0xe5b2('0x4e')]=generateNonce();_0xf4fd84[_0xe5b2('0x60')]=generateIssuedAt();return createJwt(_0xf4fd84);};exports['regenerateApiKey']=function(_0x2660d3,_0xa9f700){var _0x494388=_0x2660d3[_0xe5b2('0x46')]['apikey'];if(_0x494388){var _0x57d045={'nonce':_0xa9f700['apiKeyNonce'],'iat':_0xa9f700[_0xe5b2('0x60')],'audience':hardwareConf[_0xe5b2('0x48')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x494388,_0x57d045)[_0xe5b2('0x36')](function(){return generateApiKey(_0xa9f700);});}else{throw{'message':_0xe5b2('0x62')};}};exports[_0xe5b2('0x63')]=function(_0x4237c6){var _0x2c2b4a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2c2b4a[_0xe5b2('0x64')](_0x4237c6))throw new db['Sequelize'][(_0xe5b2('0x65'))](_0xe5b2('0x66'));return;};exports['validatePasswordHistory']=function(_0x43da54,_0x3b99e5,_0x84d783){var _0x4c1119=encryptor[_0xe5b2('0x67')](_0x3b99e5)[_0xe5b2('0x68')](',');for(var _0x535786=0x0;_0x535786<_0x84d783;_0x535786++){if(!_0x4c1119[_0x535786])break;if(_0x43da54[_0xe5b2('0x69')]()===_0x4c1119[_0x535786][_0xe5b2('0x69')]()){var _0x19e2ee=util[_0xe5b2('0x6a')](_0xe5b2('0x6b'),_0x84d783);if(_0x84d783===0x1){_0x19e2ee=_0xe5b2('0x6c');}throw new db[(_0xe5b2('0x6d'))][(_0xe5b2('0x65'))](_0x19e2ee);}}return;};exports[_0xe5b2('0x6e')]=function(_0x5a3b35,_0x518534){var _0xff4dcd=_0x518534?encryptor['decryptString'](_0x518534)[_0xe5b2('0x68')](','):[];if(_0xff4dcd[_0xe5b2('0x6f')]===0x5){_0xff4dcd[_0xe5b2('0x70')](-0x1,0x1);}_0xff4dcd['unshift'](_0x5a3b35);return encryptor['encryptString'](_0xff4dcd[_0xe5b2('0x71')](','));};function signJwt(_0x23e1aa){var _0x2b7245=BPromise['promisify'](jwt[_0xe5b2('0x72')],{'context':jwt});var _0x2ced6e=_0x23e1aa[_0xe5b2('0x73')]||config['secrets'][_0xe5b2('0xd')];return new BPromise(function(_0x34d5ac,_0x59ced0){_0x2b7245(_0x23e1aa[_0xe5b2('0x74')],_0x2ced6e,_0x23e1aa['options'])['then'](function(_0xf8918f){_0x34d5ac(_0xf8918f);})[_0xe5b2('0x3c')](function(_0x2f027e){_0x59ced0(_0x2f027e);});});}function verifyJwt(_0x421c40,_0x90d333,_0x25a800){var _0x194b9d=BPromise[_0xe5b2('0x75')](jwt[_0xe5b2('0x76')],{'context':jwt});var _0x55bf55=_0x25a800||config['secrets']['session'];return new BPromise(function(_0x803def,_0x504060){_0x194b9d(_0x421c40,_0x55bf55,_0x90d333)['then'](function(_0x19bc96){_0x803def(_0x19bc96);})[_0xe5b2('0x3c')](function(_0x153ba1){_0x504060(_0x153ba1);});});}function generateNonce(){return crypto[_0xe5b2('0x77')](0x10)[_0xe5b2('0x78')](_0xe5b2('0x79'));}function generateIssuedAt(){return Math[_0xe5b2('0x7a')](Date['now']()/0x3e8)[_0xe5b2('0x78')]();}function createJwt(_0x15cd91){var _0xb5c0c4={'payload':{'iat':_0x15cd91[_0xe5b2('0x60')],'nonce':_0x15cd91[_0xe5b2('0x4e')]},'options':{'algorithm':'HS512','subject':_0x15cd91['id']['toString'](),'issuer':hardwareConf[_0xe5b2('0x48')](),'audience':hardwareConf[_0xe5b2('0x48')]()}};return signJwt(_0xb5c0c4)[_0xe5b2('0x36')](function(_0x2f1130){return{'iat':_0x15cd91[_0xe5b2('0x60')],'nonce':_0x15cd91[_0xe5b2('0x4e')],'token':_0x2f1130};});} \ No newline at end of file +var _0xcd2f=['unshift','encryptString','join','promisify','sign','payload','verify','toString','hex','floor','now','HS512','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','Basic','find','pass','catch','Bearer','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice'];(function(_0x48cbf4,_0x1298c8){var _0x4db79e=function(_0x5eabb3){while(--_0x5eabb3){_0x48cbf4['push'](_0x48cbf4['shift']());}};_0x4db79e(++_0x1298c8);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xcd2f[_0x1d24eb];return _0x1dc576;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xfcd2('0x0'));var encryptor=require(_0xfcd2('0x1'));var _=require(_0xfcd2('0x2'));var jwt=require(_0xfcd2('0x3'));var expressJwt=require(_0xfcd2('0x4'));var compose=require(_0xfcd2('0x5'));var basicAuth=require(_0xfcd2('0x6'));var crypto=require(_0xfcd2('0x7'));var BPromise=require('bluebird');var util=require(_0xfcd2('0x8'));var moment=require(_0xfcd2('0x9'));var validateJwt=expressJwt({'secret':config[_0xfcd2('0xa')][_0xfcd2('0xb')]});var userAttributes=['id',_0xfcd2('0xc'),_0xfcd2('0xd'),_0xfcd2('0xe'),_0xfcd2('0xf'),_0xfcd2('0x10'),_0xfcd2('0x11'),_0xfcd2('0x12'),'md5secret',_0xfcd2('0x13'),_0xfcd2('0x14'),_0xfcd2('0x15'),_0xfcd2('0x16'),_0xfcd2('0x17'),'openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt',_0xfcd2('0x18'),_0xfcd2('0x19'),'passwordResetAt',_0xfcd2('0x1a'),_0xfcd2('0x1b'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xfcd2('0x1c'),_0xfcd2('0x1d'),_0xfcd2('0x1e'),_0xfcd2('0x1f'),_0xfcd2('0x20'),'phoneBarRemoteControl',_0xfcd2('0x21'),_0xfcd2('0x22'),_0xfcd2('0x23'),_0xfcd2('0x24'),_0xfcd2('0x25'),_0xfcd2('0x26')];exports['isChatInteractionAuthorized']=function(){return this[_0xfcd2('0x27')](!![])[_0xfcd2('0x28')](function(_0x32607c,_0x2c4b8f,_0x580184){if(_0x32607c[_0xfcd2('0x29')]){_0x580184();}else{return db[_0xfcd2('0x2a')][_0xfcd2('0x2b')]({'where':{'id':_0x32607c[_0xfcd2('0x2c')]['id']},'attributes':['id',_0xfcd2('0x2d'),_0xfcd2('0x2e')],'raw':!![]})[_0xfcd2('0x2f')](function(_0x55d8b0){if(_0x55d8b0&&_0x55d8b0[_0xfcd2('0x2d')]){return _0x2c4b8f[_0xfcd2('0x30')](_0x55d8b0[_0xfcd2('0x2e')]===_0xfcd2('0x31')?0x195:0x193)[_0xfcd2('0x32')]({'message':_0x55d8b0[_0xfcd2('0x2e')]===_0xfcd2('0x31')?_0xfcd2('0x33'):_0xfcd2('0x34')});}else{_0x580184();}})['catch'](function(_0x23104f){_0x580184(_0x23104f);});}});};exports['isAuthenticated']=function isAuthenticated(_0xedae7a){return compose()[_0xfcd2('0x28')](function(_0x4f220e,_0x567436,_0x187ae5){var _0xe7fde9;if(_0x4f220e[_0xfcd2('0x35')][_0xfcd2('0x36')]){if(_['startsWith'](_0x4f220e[_0xfcd2('0x35')][_0xfcd2('0x36')],_0xfcd2('0x37'))){var _0x107ee7=basicAuth(_0x4f220e);db['User'][_0xfcd2('0x38')]({'where':{'name':_0x107ee7['name']}})[_0xfcd2('0x2f')](function(_0x22fe88){if(!_0x22fe88||!_0x22fe88['authenticate'](_0x107ee7[_0xfcd2('0x39')])){return _0x567436[_0xfcd2('0x30')](0x191)[_0xfcd2('0x32')]({'message':'Wrong\x20credentials.'});}_0x4f220e[_0xfcd2('0x29')]={'id':_0x22fe88['id']};_0x187ae5();})[_0xfcd2('0x3a')](function(_0x9e3183){_0x187ae5(_0x9e3183);});}else if(_['startsWith'](_0x4f220e['headers']['authorization'],_0xfcd2('0x3b'))){validateJwt(_0x4f220e,_0x567436,_0x187ae5);}else{if(_0xedae7a){_0x187ae5();}else{return _0x567436[_0xfcd2('0x30')](0x193)[_0xfcd2('0x32')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4f220e[_0xfcd2('0x3c')][_0xfcd2('0x3d')]){try{var _0x2934b1={'audience':hardwareConf[_0xfcd2('0x3e')](),'issuer':hardwareConf[_0xfcd2('0x3e')]()};verifyJwt(_0x4f220e[_0xfcd2('0x3c')][_0xfcd2('0x3d')],_0x2934b1)['then'](function(_0x50f0d6){return db[_0xfcd2('0x3f')]['find']({'where':{'id':_0x50f0d6[_0xfcd2('0x40')]}})[_0xfcd2('0x2f')](function(_0x11a179){_0xe7fde9=_0x11a179;return db[_0xfcd2('0x41')][_0xfcd2('0x2b')]({'where':{'id':0x1},'attributes':[_0xfcd2('0x42'),_0xfcd2('0x43')],'raw':!![]});})[_0xfcd2('0x2f')](function(_0x1a1cb8){if(!_0xe7fde9||!_['isEqual'](_0xe7fde9[_0xfcd2('0x44')],_0x50f0d6[_0xfcd2('0x45')])){return _0x567436[_0xfcd2('0x30')](0x191)[_0xfcd2('0x32')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0xe7fde9['disabled']){return _0x567436[_0xfcd2('0x30')](0x191)[_0xfcd2('0x32')]({'message':_0xfcd2('0x46')});}if(_0xe7fde9[_0xfcd2('0x47')]){if(_0x1a1cb8['blockDuration']>0x0){if(moment(_0xe7fde9[_0xfcd2('0x48')])[_0xfcd2('0x49')](_0x1a1cb8['blockDuration'],_0xfcd2('0x4a'))>moment()){return _0x567436['status'](0x191)[_0xfcd2('0x32')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x567436[_0xfcd2('0x30')](0x191)[_0xfcd2('0x32')]({'message':_0xfcd2('0x46')});}}_0x4f220e['user']={'id':_0xe7fde9['id']};_0x187ae5();});})[_0xfcd2('0x3a')](function(){return _0x567436[_0xfcd2('0x30')](0x191)[_0xfcd2('0x32')]({'message':_0xfcd2('0x46')});});}catch(_0x10214e){_0x187ae5(_0x10214e);}}else if(_0xedae7a){_0x187ae5();}else{return _0x567436[_0xfcd2('0x30')](0x193)[_0xfcd2('0x32')]({'message':_0xfcd2('0x4b')});}})[_0xfcd2('0x28')](function(_0x293db3,_0x1e2f53,_0x180e52){if(_0x293db3[_0xfcd2('0x29')]){db[_0xfcd2('0x3f')][_0xfcd2('0x38')]({'where':{'id':_0x293db3[_0xfcd2('0x29')]['id']},'attributes':userAttributes})[_0xfcd2('0x2f')](function(_0x47d6b6){if(!_0x47d6b6){return _0x1e2f53[_0xfcd2('0x30')](0x194)['json']({'message':_0xfcd2('0x4c')});}_0x293db3[_0xfcd2('0x29')]=_0x47d6b6;_0x180e52();})[_0xfcd2('0x3a')](function(_0x321ace){_0x180e52(_0x321ace);});}else if(_0xedae7a){_0x180e52();}else{return _0x1e2f53['status'](0x194)[_0xfcd2('0x32')]({'message':_0xfcd2('0x4d')});}});};exports[_0xfcd2('0x4e')]=function canUpdate(){return compose()[_0xfcd2('0x28')](function(_0x2d01da,_0x100198,_0x20c15b){return licenseUtil[_0xfcd2('0x4f')]()['then'](function(_0x413569){if(_0x413569[_0xfcd2('0x50')]){_0x20c15b();}else{return _0x100198[_0xfcd2('0x30')](0x193)[_0xfcd2('0x32')]({'message':_0xfcd2('0x51')});}})['catch'](function(_0x2084be){_0x20c15b(_0x2084be);});});};exports[_0xfcd2('0x52')]=function(_0x3c69c,_0x1bb628,_0x5ae388){_0x3c69c[_0xfcd2('0x52')]=!![];return _0x5ae388();};exports[_0xfcd2('0x53')]=function signToken(_0x32167d){return signJwt(_0x32167d);};exports[_0xfcd2('0x54')]=function(_0x7baa73,_0x339ca9){if(!_0x7baa73[_0xfcd2('0x29')]){return _0x339ca9[_0xfcd2('0x30')](0x194)[_0xfcd2('0x32')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d7ac2={'payload':{'id':_0x7baa73['user']['id'],'role':_0x7baa73[_0xfcd2('0x29')][_0xfcd2('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d7ac2)[_0xfcd2('0x2f')](function(_0x3b4b1c){_0x339ca9['cookie'](_0xfcd2('0x55'),_0x3b4b1c);_0x339ca9[_0xfcd2('0x56')](_0xfcd2('0x57'));})[_0xfcd2('0x3a')](function(_0x5a1f85){return _0x339ca9[_0xfcd2('0x30')](0x1f4)[_0xfcd2('0x58')](_0x5a1f85);});};exports[_0xfcd2('0x59')]=function(_0x5b7954){if(_[_0xfcd2('0x5a')](_0x5b7954[_0xfcd2('0x44')])||_['isNil'](_0x5b7954[_0xfcd2('0x5b')])){return null;}else{return createJwt(_0x5b7954);}};exports['generateApiKey']=function(_0x559dea){_0x559dea[_0xfcd2('0x44')]=generateNonce();_0x559dea[_0xfcd2('0x5b')]=generateIssuedAt();return createJwt(_0x559dea);};exports[_0xfcd2('0x5c')]=function(_0x2b7fed,_0x57b33f){var _0x258a57=_0x2b7fed[_0xfcd2('0x3c')][_0xfcd2('0x3d')];if(_0x258a57){var _0x5b04cd={'nonce':_0x57b33f[_0xfcd2('0x44')],'iat':_0x57b33f[_0xfcd2('0x5b')],'audience':hardwareConf[_0xfcd2('0x3e')](),'issuer':hardwareConf[_0xfcd2('0x3e')]()};return verifyJwt(_0x258a57,_0x5b04cd)[_0xfcd2('0x2f')](function(){return generateApiKey(_0x57b33f);});}else{throw{'message':_0xfcd2('0x5d')};}};exports[_0xfcd2('0x5e')]=function(_0x2cfd2b){var _0x3749a6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3749a6[_0xfcd2('0x5f')](_0x2cfd2b))throw new db[(_0xfcd2('0x60'))][(_0xfcd2('0x61'))](_0xfcd2('0x62'));return;};exports[_0xfcd2('0x63')]=function(_0x39c6c4,_0x655d56,_0x5aea8b){var _0x258d76=encryptor[_0xfcd2('0x64')](_0x655d56)[_0xfcd2('0x65')](',');for(var _0x277081=0x0;_0x277081<_0x5aea8b;_0x277081++){if(!_0x258d76[_0x277081])break;if(_0x39c6c4['toLowerCase']()===_0x258d76[_0x277081][_0xfcd2('0x66')]()){var _0x15477b=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5aea8b);if(_0x5aea8b===0x1){_0x15477b=_0xfcd2('0x67');}throw new db[(_0xfcd2('0x60'))][(_0xfcd2('0x61'))](_0x15477b);}}return;};exports['updatePasswordsHistory']=function(_0x46f041,_0x1098cb){var _0x241b08=_0x1098cb?encryptor[_0xfcd2('0x64')](_0x1098cb)['split'](','):[];if(_0x241b08[_0xfcd2('0x68')]===0x5){_0x241b08[_0xfcd2('0x69')](-0x1,0x1);}_0x241b08[_0xfcd2('0x6a')](_0x46f041);return encryptor[_0xfcd2('0x6b')](_0x241b08[_0xfcd2('0x6c')](','));};function signJwt(_0x8dd217){var _0x1c85fd=BPromise[_0xfcd2('0x6d')](jwt[_0xfcd2('0x6e')],{'context':jwt});var _0x523d5a=_0x8dd217['secret']||config[_0xfcd2('0xa')]['session'];return new BPromise(function(_0x35d308,_0x5e7343){_0x1c85fd(_0x8dd217[_0xfcd2('0x6f')],_0x523d5a,_0x8dd217['options'])[_0xfcd2('0x2f')](function(_0x5a5003){_0x35d308(_0x5a5003);})[_0xfcd2('0x3a')](function(_0x18423c){_0x5e7343(_0x18423c);});});}function verifyJwt(_0x456417,_0x1455c0,_0x198ad7){var _0x772a1=BPromise['promisify'](jwt[_0xfcd2('0x70')],{'context':jwt});var _0xd59a6=_0x198ad7||config[_0xfcd2('0xa')][_0xfcd2('0xb')];return new BPromise(function(_0x2d4299,_0x23d55e){_0x772a1(_0x456417,_0xd59a6,_0x1455c0)['then'](function(_0x1a2903){_0x2d4299(_0x1a2903);})[_0xfcd2('0x3a')](function(_0x1d5aab){_0x23d55e(_0x1d5aab);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xfcd2('0x71')](_0xfcd2('0x72'));}function generateIssuedAt(){return Math[_0xfcd2('0x73')](Date[_0xfcd2('0x74')]()/0x3e8)['toString']();}function createJwt(_0x478f15){var _0x574885={'payload':{'iat':_0x478f15[_0xfcd2('0x5b')],'nonce':_0x478f15[_0xfcd2('0x44')]},'options':{'algorithm':_0xfcd2('0x75'),'subject':_0x478f15['id']['toString'](),'issuer':hardwareConf[_0xfcd2('0x3e')](),'audience':hardwareConf[_0xfcd2('0x3e')]()}};return signJwt(_0x574885)[_0xfcd2('0x2f')](function(_0x28e1fc){return{'iat':_0x478f15[_0xfcd2('0x5b')],'nonce':_0x478f15[_0xfcd2('0x44')],'token':_0x28e1fc};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 2f60724..db2437d 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 _0xb0a2=['lodash','../../config/environment','../../config/logger','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','binary','write','end','final','close','unlink','createDecipher','encryptString','base64','secret','utf8','crypto'];(function(_0x500825,_0x57de29){var _0x2221bb=function(_0x9b7072){while(--_0x9b7072){_0x500825['push'](_0x500825['shift']());}};_0x2221bb(++_0x57de29);}(_0xb0a2,0x178));var _0x2b0a=function(_0x3afc7e,_0x30efb0){_0x3afc7e=_0x3afc7e-0x0;var _0x4d108e=_0xb0a2[_0x3afc7e];return _0x4d108e;};'use strict';var crypto=require(_0x2b0a('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x2b0a('0x1'));var config=require(_0x2b0a('0x2'));var logger=require(_0x2b0a('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x2b0a('0x4')],'algorithm':_0x2b0a('0x5')};const fileOptions={'algorithm':_0x2b0a('0x6')};if(config[_0x2b0a('0x7')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x2b0a('0x7')][_0x2b0a('0x8')]);if(isSupported){fileOptions[_0x2b0a('0x8')]=config[_0x2b0a('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2b0a('0x9')](',\x20');logger[_0x2b0a('0xa')](config[_0x2b0a('0x7')][_0x2b0a('0x8')],_0x2b0a('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x48074e){return AES_SUPPORTED_RX['test'](_0x48074e);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x361628){return getSupportedCiphers()[_0x2b0a('0xc')](_0x361628)>-0x1;}function combineOptions(_0x5e5b16){var _0x2a3de8={};for(var _0x457949 in fileOptions){if(fileOptions[_0x2b0a('0xd')](_0x457949)){_0x2a3de8[_0x457949]=fileOptions[_0x457949];}}if(_0x5e5b16){for(var _0x1a46e6 in _0x5e5b16){if(_0x5e5b16['hasOwnProperty'](_0x1a46e6)){_0x2a3de8[_0x1a46e6]=_0x5e5b16[_0x1a46e6];}}}return _0x2a3de8;}exports[_0x2b0a('0xe')]=function(_0x2c81ce,_0x5e6051,_0x5eaec7,_0x50a5eb){return new BPromise(function(_0x599753,_0x54b677){_0x50a5eb=combineOptions(_0x50a5eb);var _0x4c0390=new Buffer(_0x5eaec7);var _0x43138e=fs['createReadStream'](_0x2c81ce);var _0x304ba6=fs[_0x2b0a('0xf')](_0x5e6051);var _0x5541ab=crypto['createCipher'](_0x50a5eb[_0x2b0a('0x8')],_0x4c0390);_0x43138e['on'](_0x2b0a('0x10'),function(_0x267152){var _0x4d2195=new Buffer(_0x5541ab[_0x2b0a('0x11')](_0x267152),_0x2b0a('0x12'));_0x304ba6[_0x2b0a('0x13')](_0x4d2195);});_0x43138e['on'](_0x2b0a('0x14'),function(){try{var _0x57bb4c=new Buffer(_0x5541ab[_0x2b0a('0x15')](_0x2b0a('0x12')),_0x2b0a('0x12'));_0x304ba6[_0x2b0a('0x13')](_0x57bb4c);_0x304ba6[_0x2b0a('0x14')]();_0x304ba6['on'](_0x2b0a('0x16'),function(){return _0x599753(_0x5e6051);});}catch(_0x432eb7){fs[_0x2b0a('0x17')](_0x5e6051);return _0x54b677(_0x432eb7);}});});};exports['decryptFile']=function(_0x488880,_0x43e2db,_0x570f76,_0x5141ff){return new BPromise(function(_0x2e57d4,_0x1db730){_0x5141ff=combineOptions(_0x5141ff);var _0x302a3e=new Buffer(_0x570f76);var _0x3b8c2c=fs['createReadStream'](_0x488880);var _0x9b9cb2=fs['createWriteStream'](_0x43e2db);var _0x52fa6a=crypto[_0x2b0a('0x18')](_0x5141ff[_0x2b0a('0x8')],_0x302a3e);_0x3b8c2c['on'](_0x2b0a('0x10'),function(_0x87403b){var _0x284d4b=new Buffer(_0x52fa6a[_0x2b0a('0x11')](_0x87403b),'binary');_0x9b9cb2[_0x2b0a('0x13')](_0x284d4b);});_0x3b8c2c['on'](_0x2b0a('0x14'),function(){try{var _0x22b32c=new Buffer(_0x52fa6a['final'](_0x2b0a('0x12')),_0x2b0a('0x12'));_0x9b9cb2[_0x2b0a('0x13')](_0x22b32c);_0x9b9cb2[_0x2b0a('0x14')]();_0x9b9cb2['on'](_0x2b0a('0x16'),function(){return _0x2e57d4(_0x43e2db);});}catch(_0x4c6cbf){fs[_0x2b0a('0x17')](_0x43e2db);return _0x1db730(_0x4c6cbf);}});});};exports[_0x2b0a('0x19')]=function(_0x337c23,_0xe5ac20,_0x557e4f){var _0x586f7b=_0x557e4f||stringOptions[_0x2b0a('0x8')];var _0x523ed2=_0xe5ac20||stringOptions['secret'];var _0x217e5f=crypto['createCipher'](_0x586f7b,_0x523ed2);var _0x413548=_0x217e5f[_0x2b0a('0x11')](_0x337c23,'utf8','base64');_0x413548+=_0x217e5f[_0x2b0a('0x15')](_0x2b0a('0x1a'));return _0x413548;};exports['decryptString']=function(_0x108a7c,_0x5e6bce,_0x3caf34){var _0x557df5=_0x3caf34||stringOptions[_0x2b0a('0x8')];var _0x4029fc=_0x5e6bce||stringOptions[_0x2b0a('0x1b')];var _0x4cc4a8=crypto[_0x2b0a('0x18')](_0x557df5,_0x4029fc);var _0x582068=_0x4cc4a8[_0x2b0a('0x11')](_0x108a7c,'base64',_0x2b0a('0x1c'));_0x582068+=_0x4cc4a8[_0x2b0a('0x15')]('utf8');return _0x582068;}; \ No newline at end of file +var _0x675e=['decryptFile','createDecipher','secret','utf8','base64','decryptString','lodash','../../config/environment','../../config/logger','session','aes-256-ctr','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','unlink'];(function(_0x339726,_0x57c3da){var _0x16aaf8=function(_0x2b5a0d){while(--_0x2b5a0d){_0x339726['push'](_0x339726['shift']());}};_0x16aaf8(++_0x57c3da);}(_0x675e,0x1d7));var _0xe675=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x675e[_0xf04c6d];return _0x4a804e;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xe675('0x0'));var config=require(_0xe675('0x1'));var logger=require(_0xe675('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xe675('0x3')],'algorithm':_0xe675('0x4')};const fileOptions={'algorithm':'aes192'};if(config[_0xe675('0x5')]&&config[_0xe675('0x5')][_0xe675('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xe675('0x6')]);if(isSupported){fileOptions[_0xe675('0x6')]=config[_0xe675('0x5')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe675('0x7')](',\x20');logger[_0xe675('0x8')](config[_0xe675('0x5')][_0xe675('0x6')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x5e31cc){return AES_SUPPORTED_RX[_0xe675('0x9')](_0x5e31cc);}function getSupportedCiphers(){return crypto[_0xe675('0xa')]()[_0xe675('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x182566){return getSupportedCiphers()[_0xe675('0xc')](_0x182566)>-0x1;}function combineOptions(_0x16d162){var _0x1d5823={};for(var _0x34ff5f in fileOptions){if(fileOptions[_0xe675('0xd')](_0x34ff5f)){_0x1d5823[_0x34ff5f]=fileOptions[_0x34ff5f];}}if(_0x16d162){for(var _0x540635 in _0x16d162){if(_0x16d162[_0xe675('0xd')](_0x540635)){_0x1d5823[_0x540635]=_0x16d162[_0x540635];}}}return _0x1d5823;}exports[_0xe675('0xe')]=function(_0x12ccbf,_0xc6188d,_0x5161e5,_0x319637){return new BPromise(function(_0x13f4dc,_0x5b3d27){_0x319637=combineOptions(_0x319637);var _0x1c4b96=new Buffer(_0x5161e5);var _0x203a86=fs[_0xe675('0xf')](_0x12ccbf);var _0x1900cf=fs[_0xe675('0x10')](_0xc6188d);var _0x4defa8=crypto[_0xe675('0x11')](_0x319637['algorithm'],_0x1c4b96);_0x203a86['on'](_0xe675('0x12'),function(_0x3fa6a9){var _0x382698=new Buffer(_0x4defa8[_0xe675('0x13')](_0x3fa6a9),_0xe675('0x14'));_0x1900cf[_0xe675('0x15')](_0x382698);});_0x203a86['on'](_0xe675('0x16'),function(){try{var _0xfbb9ec=new Buffer(_0x4defa8[_0xe675('0x17')](_0xe675('0x14')),_0xe675('0x14'));_0x1900cf[_0xe675('0x15')](_0xfbb9ec);_0x1900cf[_0xe675('0x16')]();_0x1900cf['on']('close',function(){return _0x13f4dc(_0xc6188d);});}catch(_0x54ae74){fs[_0xe675('0x18')](_0xc6188d);return _0x5b3d27(_0x54ae74);}});});};exports[_0xe675('0x19')]=function(_0x13a51a,_0x29c1ac,_0x2ad0f1,_0x31f241){return new BPromise(function(_0x29351c,_0x452c4f){_0x31f241=combineOptions(_0x31f241);var _0x390476=new Buffer(_0x2ad0f1);var _0x466db3=fs[_0xe675('0xf')](_0x13a51a);var _0x33271d=fs[_0xe675('0x10')](_0x29c1ac);var _0x376f60=crypto[_0xe675('0x1a')](_0x31f241[_0xe675('0x6')],_0x390476);_0x466db3['on'](_0xe675('0x12'),function(_0x4fc0f4){var _0x49cb68=new Buffer(_0x376f60[_0xe675('0x13')](_0x4fc0f4),_0xe675('0x14'));_0x33271d[_0xe675('0x15')](_0x49cb68);});_0x466db3['on'](_0xe675('0x16'),function(){try{var _0x1e3a42=new Buffer(_0x376f60['final']('binary'),_0xe675('0x14'));_0x33271d[_0xe675('0x15')](_0x1e3a42);_0x33271d[_0xe675('0x16')]();_0x33271d['on']('close',function(){return _0x29351c(_0x29c1ac);});}catch(_0x4c6abf){fs[_0xe675('0x18')](_0x29c1ac);return _0x452c4f(_0x4c6abf);}});});};exports['encryptString']=function(_0x4822b5,_0x244ee1,_0x5be3b8){var _0x4eebb1=_0x5be3b8||stringOptions[_0xe675('0x6')];var _0x56f7d5=_0x244ee1||stringOptions[_0xe675('0x1b')];var _0x3b639b=crypto[_0xe675('0x11')](_0x4eebb1,_0x56f7d5);var _0x7780c7=_0x3b639b[_0xe675('0x13')](_0x4822b5,_0xe675('0x1c'),_0xe675('0x1d'));_0x7780c7+=_0x3b639b[_0xe675('0x17')](_0xe675('0x1d'));return _0x7780c7;};exports[_0xe675('0x1e')]=function(_0x3efe3c,_0x246e83,_0x1fa348){var _0xf5aa30=_0x1fa348||stringOptions[_0xe675('0x6')];var _0x592b9c=_0x246e83||stringOptions['secret'];var _0x54e21d=crypto[_0xe675('0x1a')](_0xf5aa30,_0x592b9c);var _0x167b0f=_0x54e21d[_0xe675('0x13')](_0x3efe3c,_0xe675('0x1d'),_0xe675('0x1c'));_0x167b0f+=_0x54e21d[_0xe675('0x17')](_0xe675('0x1c'));return _0x167b0f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 25c61c5..e045889 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 _0x54ef=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','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','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','CSV','Setting','find','split','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','push'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x54ef,0x112));var _0xf54e=function(_0x4c962e,_0x272758){_0x4c962e=_0x4c962e-0x0;var _0x35ace5=_0x54ef[_0x4c962e];return _0x35ace5;};'use strict';var util=require(_0xf54e('0x0'));var path=require(_0xf54e('0x1'));var _=require(_0xf54e('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xf54e('0x3'));var zipdir=require(_0xf54e('0x4'));var rimraf=require(_0xf54e('0x5'));var db=require(_0xf54e('0x6'))['db'];var dbH=require(_0xf54e('0x6'))[_0xf54e('0x7')];var logger=require(_0xf54e('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf54e('0x9')][0x3];var PATH=process[_0xf54e('0x9')][0x4];function analyticExtractedReport(_0x2464ae,_0x561870){var _0x27e69b={'status':_0x2464ae};var _0x57a1ce={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x561870){_0x27e69b[_0xf54e('0xa')]=_0x561870;}return db[_0xf54e('0xb')]['update'](_0x27e69b,_0x57a1ce);}function main(){var _0x26fc3e=0x1388;var _0xefa1c0;logger[_0xf54e('0xc')](util[_0xf54e('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf54e('0xe')));return db[_0xf54e('0xf')][_0xf54e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf54e('0x11'),'splitSizeCsv']})[_0xf54e('0x12')](function(_0x4b0ee1){if(_0x4b0ee1){_0xefa1c0=_0x4b0ee1;_0x26fc3e=_0xefa1c0['splitSizeCsv']||0x1388;}})[_0xf54e('0x12')](function(){return dbH[_0xf54e('0x13')][_0xf54e('0x14')](util[_0xf54e('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf54e('0x13')][_0xf54e('0x15')][_0xf54e('0x16')]});})[_0xf54e('0x12')](function(_0x56828e){if(!_0x56828e[0x0][_0xf54e('0x17')]){return analyticExtractedReport(_0xf54e('0x18'));}var _0x3eb415=[];var _0x5c5d00=0x0;var _0x4af633=!![];if(_0x56828e&&_0x56828e[_0xf54e('0x19')]){var _0x41fb35=_0x56828e[0x0][_0xf54e('0x17')]%(_0x5c5d00+_0x26fc3e);if(_0xefa1c0[_0xf54e('0x11')]){for(;_0x4af633;_0x5c5d00+=_0x26fc3e,_0x41fb35=_0x56828e[0x0][_0xf54e('0x17')]%(_0x5c5d00+_0x26fc3e)){if(_0x41fb35==0x0||_0x41fb35==_0x56828e[0x0][_0xf54e('0x17')]){_0x4af633=![];}_0x3eb415[_0xf54e('0x1a')](dbH[_0xf54e('0x13')][_0xf54e('0x14')](util[_0xf54e('0xd')](_0xf54e('0x1b'),QUERY,_0x26fc3e,_0x5c5d00),{'type':dbH['sequelize']['QueryTypes'][_0xf54e('0x16')]}));}}else{_0x3eb415['push'](dbH[_0xf54e('0x13')][_0xf54e('0x14')](QUERY,{'type':dbH[_0xf54e('0x13')][_0xf54e('0x15')][_0xf54e('0x16')]}));}}var _0x3887b0=path[_0xf54e('0x1c')](PATH);var _0x11985e=path[_0xf54e('0x1d')](PATH,_0xf54e('0x1e'));var _0x1c58bd=_0xefa1c0['split']&&_0x3eb415[_0xf54e('0x19')]>0x1;var _0x54f914=[];if(!fs[_0xf54e('0x1f')](path[_0xf54e('0x20')](_0x3887b0,_0x11985e))&&_0x1c58bd){fs[_0xf54e('0x21')](path[_0xf54e('0x20')](_0x3887b0,_0x11985e));}return BPromise[_0xf54e('0x22')](_0x3eb415,function(_0x160160){_0x54f914[_0xf54e('0x1a')](_0x160160);})[_0xf54e('0x12')](function(){for(var _0x2342a9=0x0;_0x2342a9<_0x54f914[_0xf54e('0x19')];_0x2342a9+=0x1){var _0xf6cdd7;var _0x39c0ae=_0x54f914[_0x2342a9];if(_0x1c58bd){_0xf6cdd7=path[_0xf54e('0x20')](_0x3887b0,_0x11985e,util['format'](_0xf54e('0x23'),_0x11985e,_0x2342a9,'csv'));}else{_0xf6cdd7=path[_0xf54e('0x20')](_0x3887b0,util['format'](_0xf54e('0x24'),_0x11985e,_0xf54e('0x25')));}fs[_0xf54e('0x26')](_0xf6cdd7,csv(_0x39c0ae));}})[_0xf54e('0x12')](function(){if(_0x1c58bd){zipdir(path[_0xf54e('0x20')](_0x3887b0,_0x11985e),{'saveTo':path[_0xf54e('0x20')](_0x3887b0,util[_0xf54e('0xd')]('%s.%s',_0x11985e,'zip'))},function(_0x2f96b1,_0x258d29){});rimraf(path[_0xf54e('0x20')](_0x3887b0,_0x11985e),function(){});}})[_0xf54e('0x12')](function(){logger[_0xf54e('0xc')](util[_0xf54e('0xd')](_0xf54e('0x27'),EXTRACTED_REPORT_ID,_0xf54e('0xe')));return analyticExtractedReport(_0xf54e('0x28'),_0x1c58bd?util[_0xf54e('0xd')]('%s.%s',_0x11985e,_0x1c58bd?'zip':_0xf54e('0x25')):null);});})[_0xf54e('0x29')](function(_0x4d8fdd){logger[_0xf54e('0xc')](util[_0xf54e('0xd')](_0xf54e('0x2a'),EXTRACTED_REPORT_ID,_0xf54e('0xe')),util['inspect'](_0x4d8fdd,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x84ab=['inspect','Failed','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','AnalyticExtractedReport','info','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','%s.%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x84ab,0x12f));var _0xb84a=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x84ab[_0x28394f];return _0x2618d2;};'use strict';var util=require(_0xb84a('0x0'));var path=require(_0xb84a('0x1'));var _=require(_0xb84a('0x2'));var csv=require(_0xb84a('0x3'));var fs=require('fs');var BPromise=require(_0xb84a('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xb84a('0x5'));var db=require(_0xb84a('0x6'))['db'];var dbH=require('../../mysqldb')[_0xb84a('0x7')];var logger=require(_0xb84a('0x8'))(_0xb84a('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0xd445b5,_0x4fac4d){var _0x3e9086={'status':_0xd445b5};var _0x8d9dbe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fac4d){_0x3e9086['savename']=_0x4fac4d;}return db[_0xb84a('0xa')]['update'](_0x3e9086,_0x8d9dbe);}function main(){var _0x2e6a71=0x1388;var _0x1886e0;logger[_0xb84a('0xb')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xb84a('0xc')][_0xb84a('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb84a('0xe'),_0xb84a('0xf')]})[_0xb84a('0x10')](function(_0x4d3758){if(_0x4d3758){_0x1886e0=_0x4d3758;_0x2e6a71=_0x1886e0[_0xb84a('0xf')]||0x1388;}})[_0xb84a('0x10')](function(){return dbH[_0xb84a('0x11')][_0xb84a('0x12')](util[_0xb84a('0x13')](_0xb84a('0x14'),QUERY),{'type':dbH[_0xb84a('0x11')][_0xb84a('0x15')][_0xb84a('0x16')]});})[_0xb84a('0x10')](function(_0xc0b2e0){if(!_0xc0b2e0[0x0][_0xb84a('0x17')]){return analyticExtractedReport('Empty');}var _0x11dd4d=[];var _0x4a691d=0x0;var _0xb65e5a=!![];if(_0xc0b2e0&&_0xc0b2e0[_0xb84a('0x18')]){var _0x1c7378=_0xc0b2e0[0x0][_0xb84a('0x17')]%(_0x4a691d+_0x2e6a71);if(_0x1886e0[_0xb84a('0xe')]){for(;_0xb65e5a;_0x4a691d+=_0x2e6a71,_0x1c7378=_0xc0b2e0[0x0][_0xb84a('0x17')]%(_0x4a691d+_0x2e6a71)){if(_0x1c7378==0x0||_0x1c7378==_0xc0b2e0[0x0][_0xb84a('0x17')]){_0xb65e5a=![];}_0x11dd4d[_0xb84a('0x19')](dbH[_0xb84a('0x11')][_0xb84a('0x12')](util[_0xb84a('0x13')](_0xb84a('0x1a'),QUERY,_0x2e6a71,_0x4a691d),{'type':dbH['sequelize'][_0xb84a('0x15')][_0xb84a('0x16')]}));}}else{_0x11dd4d['push'](dbH[_0xb84a('0x11')][_0xb84a('0x12')](QUERY,{'type':dbH[_0xb84a('0x11')][_0xb84a('0x15')]['SELECT']}));}}var _0x4ac5f8=path[_0xb84a('0x1b')](PATH);var _0x19097d=path[_0xb84a('0x1c')](PATH,_0xb84a('0x1d'));var _0x1e2fd4=_0x1886e0[_0xb84a('0xe')]&&_0x11dd4d[_0xb84a('0x18')]>0x1;var _0x21d0d3=[];if(!fs[_0xb84a('0x1e')](path[_0xb84a('0x1f')](_0x4ac5f8,_0x19097d))&&_0x1e2fd4){fs[_0xb84a('0x20')](path[_0xb84a('0x1f')](_0x4ac5f8,_0x19097d));}return BPromise[_0xb84a('0x21')](_0x11dd4d,function(_0x409df0){_0x21d0d3[_0xb84a('0x19')](_0x409df0);})[_0xb84a('0x10')](function(){for(var _0x378ce1=0x0;_0x378ce1<_0x21d0d3[_0xb84a('0x18')];_0x378ce1+=0x1){var _0x3b6805;var _0xd468c3=_0x21d0d3[_0x378ce1];if(_0x1e2fd4){_0x3b6805=path[_0xb84a('0x1f')](_0x4ac5f8,_0x19097d,util[_0xb84a('0x13')](_0xb84a('0x22'),_0x19097d,_0x378ce1,_0xb84a('0x23')));}else{_0x3b6805=path[_0xb84a('0x1f')](_0x4ac5f8,util[_0xb84a('0x13')]('%s.%s',_0x19097d,'csv'));}fs[_0xb84a('0x24')](_0x3b6805,csv(_0xd468c3));}})[_0xb84a('0x10')](function(){if(_0x1e2fd4){zipdir(path['join'](_0x4ac5f8,_0x19097d),{'saveTo':path[_0xb84a('0x1f')](_0x4ac5f8,util[_0xb84a('0x13')]('%s.%s',_0x19097d,'zip'))},function(_0x28f2e7,_0x8e9319){});rimraf(path['join'](_0x4ac5f8,_0x19097d),function(){});}})[_0xb84a('0x10')](function(){logger[_0xb84a('0xb')](util[_0xb84a('0x13')](_0xb84a('0x25'),EXTRACTED_REPORT_ID,_0xb84a('0x26')));return analyticExtractedReport(_0xb84a('0x27'),_0x1e2fd4?util[_0xb84a('0x13')](_0xb84a('0x28'),_0x19097d,_0x1e2fd4?'zip':_0xb84a('0x23')):null);});})['catch'](function(_0x4bca85){logger[_0xb84a('0xb')](util[_0xb84a('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0xb84a('0x29')](_0x4bca85,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb84a('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index cd5ea89..59fc4e7 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 _0xeb81=['%s.%s','pipe','createWriteStream','finish','error','log','end','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','bluebird','util','moment','pdfmake/src/printer','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','push','tableHeader','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','SELECT','sequelize','query','existsSync','mkdirSync','join','each','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','black','toString','body','content','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','createPdfKitDocument','%s%d.%s','pdf'];(function(_0x513491,_0x3bf1f0){var _0x1408ad=function(_0x1afcf7){while(--_0x1afcf7){_0x513491['push'](_0x513491['shift']());}};_0x1408ad(++_0x3bf1f0);}(_0xeb81,0x157));var _0x1eb8=function(_0x4ed72e,_0x3cbb92){_0x4ed72e=_0x4ed72e-0x0;var _0x16cc9a=_0xeb81[_0x4ed72e];return _0x16cc9a;};'use strict';var _=require('lodash');var fs=require('fs');var BPromise=require(_0x1eb8('0x0'));var util=require(_0x1eb8('0x1'));var path=require('path');var moment=require(_0x1eb8('0x2'));var PdfPrinter=require(_0x1eb8('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x1eb8('0x4'))['db'];var dbH=require('../../mysqldb')[_0x1eb8('0x5')];var logger=require(_0x1eb8('0x6'))(_0x1eb8('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1eb8('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1eb8('0x8')][0x4];var NAME=process[_0x1eb8('0x8')][0x5];var FORMAT=_0x1eb8('0x9');var _extractedReport;function analyticExtractedReport(_0x39416c,_0x5c96bc){var _0x361468={'status':_0x39416c};var _0x2ea4c4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c96bc){_0x361468[_0x1eb8('0xa')]=_0x5c96bc;}return db[_0x1eb8('0xb')][_0x1eb8('0xc')](_0x361468,_0x2ea4c4);}function getHeader(_0x1e5d3b){var _0x531228=[];for(var _0x19e600 in _0x1e5d3b){if(_0x1e5d3b[_0x1eb8('0xd')](_0x19e600)){_0x531228[_0x1eb8('0xe')]({'text':_0x19e600,'style':_0x1eb8('0xf')});}}return _0x531228;}function extractReport(_0x719433){var _0x15a0ff=0x1388;var _0x1d67b3;if(!_0x719433[0x0][_0x1eb8('0x10')]){return analyticExtractedReport(_0x1eb8('0x11'));}var _0x2f8222=[];var _0x3d49bf=0x0;var _0x5d8659=!![];var _0x5f6fd9=path[_0x1eb8('0x12')](PATH);var _0x400045=path[_0x1eb8('0x13')](PATH,'.pdf');var _0x24bab=![];var _0x2fc31d=[];return db[_0x1eb8('0x14')][_0x1eb8('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1eb8('0x16'),_0x1eb8('0x17')]})[_0x1eb8('0x18')](function(_0xf45c9f){if(_0xf45c9f){_0x1d67b3=_0xf45c9f;_0x15a0ff=_0x1d67b3[_0x1eb8('0x17')]||0x3e8;}})[_0x1eb8('0x18')](function(){if(_0x719433&&_0x719433[_0x1eb8('0x19')]){var _0x11c4e6=_0x719433[0x0][_0x1eb8('0x10')]%(_0x3d49bf+_0x15a0ff);if(_0x1d67b3[_0x1eb8('0x16')]){for(;_0x5d8659;_0x3d49bf+=_0x15a0ff,_0x11c4e6=_0x719433[0x0][_0x1eb8('0x10')]%(_0x3d49bf+_0x15a0ff)){if(_0x11c4e6==0x0||_0x11c4e6==_0x719433[0x0][_0x1eb8('0x10')]){_0x5d8659=![];}_0x2f8222[_0x1eb8('0xe')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x15a0ff,_0x3d49bf),{'type':dbH['sequelize']['QueryTypes'][_0x1eb8('0x1a')]}));}}else{_0x2f8222[_0x1eb8('0xe')](dbH[_0x1eb8('0x1b')][_0x1eb8('0x1c')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x1eb8('0x1a')]}));}}_0x24bab=_0x1d67b3['split']&&_0x2f8222[_0x1eb8('0x19')]>0x1;if(!fs[_0x1eb8('0x1d')](path['join'](_0x5f6fd9,_0x400045))&&_0x24bab){fs[_0x1eb8('0x1e')](path[_0x1eb8('0x1f')](_0x5f6fd9,_0x400045));}return BPromise[_0x1eb8('0x20')](_0x2f8222,function(_0x5d7844){_0x2fc31d[_0x1eb8('0xe')](_0x5d7844);});})['then'](function(){return BPromise[_0x1eb8('0x20')](_0x2f8222,function(_0x3006d6,_0x375859){var _0x57b135;var _0x551988=util[_0x1eb8('0x21')](_0x1eb8('0x22'),NAME,_extractedReport[_0x1eb8('0x23')],moment(_extractedReport[_0x1eb8('0x24')])[_0x1eb8('0x21')](FORMAT),moment(_extractedReport['endDate'])['format'](FORMAT));var _0x47a15e={'pageSize':'A4','pageOrientation':'landscape','content':[{'text':_0x551988,'style':_0x1eb8('0x25')}],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1eb8('0x26')}}};var _0x2e601c={'headerRows':0x1,'body':[]};_0x2e601c['body'][_0x1eb8('0xe')](getHeader(_0x3006d6[0x0]));var _0x1e26aa;for(var _0x3bcc21=0x0;_0x3bcc21<_0x3006d6[_0x1eb8('0x19')];_0x3bcc21+=0x1){_0x1e26aa=[];for(var _0x46a389 in _0x3006d6[_0x3bcc21]){if(_0x3006d6[_0x3bcc21][_0x1eb8('0xd')](_0x46a389)){_0x1e26aa[_0x1eb8('0xe')](_0x3006d6[_0x3bcc21][_0x46a389]?_[_0x1eb8('0x27')](_0x3006d6[_0x3bcc21][_0x46a389]):'');}}_0x2e601c[_0x1eb8('0x28')]['push'](_0x1e26aa);}_0x47a15e[_0x1eb8('0x29')][_0x1eb8('0xe')]({'table':_0x2e601c});return new BPromise(function(_0x1b052a,_0x5d8b4e){var _0x3f12cb=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x1eb8('0x2a'),'bolditalics':__dirname+_0x1eb8('0x2b')}});var _0x3039a3=_0x3f12cb[_0x1eb8('0x2c')](_0x47a15e);if(_0x24bab){_0x57b135=path[_0x1eb8('0x1f')](_0x5f6fd9,_0x400045,util[_0x1eb8('0x21')](_0x1eb8('0x2d'),_0x400045,_0x375859,_0x1eb8('0x2e')));}else{_0x57b135=path[_0x1eb8('0x1f')](_0x5f6fd9,util[_0x1eb8('0x21')](_0x1eb8('0x2f'),_0x400045,_0x1eb8('0x2e')));}var _0x3102f3=_0x3039a3[_0x1eb8('0x30')](fs[_0x1eb8('0x31')](_0x57b135));_0x3102f3['on'](_0x1eb8('0x32'),function(){_0x1b052a();});_0x3102f3['on'](_0x1eb8('0x33'),function(_0x50ac19){console[_0x1eb8('0x34')]('err',_0x50ac19);_0x5d8b4e(_0x50ac19);});_0x3039a3[_0x1eb8('0x35')]();});});})[_0x1eb8('0x18')](function(){if(_0x24bab){return new BPromise(function(_0x1624e9,_0x2ddc59){zipdir(path[_0x1eb8('0x1f')](_0x5f6fd9,_0x400045),{'saveTo':path[_0x1eb8('0x1f')](_0x5f6fd9,util[_0x1eb8('0x21')](_0x1eb8('0x2f'),_0x400045,_0x1eb8('0x36')))},function(_0x8347e9){if(_0x8347e9){_0x2ddc59(_0x8347e9);}else{_0x1624e9();}});});}})['then'](function(){if(_0x24bab){rimraf(path[_0x1eb8('0x1f')](_0x5f6fd9,_0x400045),function(){});}})[_0x1eb8('0x18')](function(){logger[_0x1eb8('0x37')](util[_0x1eb8('0x21')](_0x1eb8('0x38'),EXTRACTED_REPORT_ID,_0x1eb8('0x39')));return analyticExtractedReport(_0x1eb8('0x3a'),_0x24bab?util[_0x1eb8('0x21')](_0x1eb8('0x2f'),_0x400045,_0x24bab?_0x1eb8('0x36'):_0x1eb8('0x2e')):null);});}function main(){logger[_0x1eb8('0x37')](util[_0x1eb8('0x21')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1eb8('0x3b')));return db[_0x1eb8('0xb')][_0x1eb8('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1eb8('0x18')](function(_0x5455b0){_extractedReport=_0x5455b0;return dbH[_0x1eb8('0x1b')][_0x1eb8('0x1c')](util[_0x1eb8('0x21')](_0x1eb8('0x3d'),QUERY),{'type':dbH[_0x1eb8('0x1b')][_0x1eb8('0x3e')]['SELECT']});})[_0x1eb8('0x18')](extractReport)['catch'](function(_0x249088){logger[_0x1eb8('0x37')](util['format'](_0x1eb8('0x3f'),EXTRACTED_REPORT_ID,_0x1eb8('0x3b')),util[_0x1eb8('0x40')](_0x249088,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x6c11=['query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','existsSync','mkdirSync','join','each','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','header','Arial','body','toString','content','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s%d.%s','pdf','%s.%s','pipe','createWriteStream','log','err','end','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','lodash','bluebird','util','path','pdfmake/src/printer','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','hasOwnProperty','push','tableHeader','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','num','sequelize'];(function(_0x30ba85,_0x503490){var _0x58b533=function(_0x131acf){while(--_0x131acf){_0x30ba85['push'](_0x30ba85['shift']());}};_0x58b533(++_0x503490);}(_0x6c11,0xf5));var _0x16c1=function(_0xc73a34,_0xc7b9c7){_0xc73a34=_0xc73a34-0x0;var _0x285d38=_0x6c11[_0xc73a34];return _0x285d38;};'use strict';var _=require(_0x16c1('0x0'));var fs=require('fs');var BPromise=require(_0x16c1('0x1'));var util=require(_0x16c1('0x2'));var path=require(_0x16c1('0x3'));var moment=require('moment');var PdfPrinter=require(_0x16c1('0x4'));var zipdir=require(_0x16c1('0x5'));var rimraf=require('rimraf');var db=require(_0x16c1('0x6'))['db'];var dbH=require(_0x16c1('0x6'))[_0x16c1('0x7')];var logger=require(_0x16c1('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x16c1('0x9')][0x2]);var QUERY=process[_0x16c1('0x9')][0x3];var PATH=process[_0x16c1('0x9')][0x4];var NAME=process[_0x16c1('0x9')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var _extractedReport;function analyticExtractedReport(_0xfd2a12,_0x351b8d){var _0x15b3c9={'status':_0xfd2a12};var _0x3a2cd8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x351b8d){_0x15b3c9[_0x16c1('0xa')]=_0x351b8d;}return db[_0x16c1('0xb')][_0x16c1('0xc')](_0x15b3c9,_0x3a2cd8);}function getHeader(_0x58576b){var _0x47280a=[];for(var _0xd922a6 in _0x58576b){if(_0x58576b[_0x16c1('0xd')](_0xd922a6)){_0x47280a[_0x16c1('0xe')]({'text':_0xd922a6,'style':_0x16c1('0xf')});}}return _0x47280a;}function extractReport(_0x173484){var _0x35f97b=0x1388;var _0x28428d;if(!_0x173484[0x0]['num']){return analyticExtractedReport('Empty');}var _0x4aa738=[];var _0x4917a0=0x0;var _0x48c094=!![];var _0x46f05b=path[_0x16c1('0x10')](PATH);var _0x48a2ab=path[_0x16c1('0x11')](PATH,_0x16c1('0x12'));var _0x26d2d1=![];var _0x361cc1=[];return db[_0x16c1('0x13')][_0x16c1('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x16c1('0x15'),_0x16c1('0x16')]})[_0x16c1('0x17')](function(_0x272806){if(_0x272806){_0x28428d=_0x272806;_0x35f97b=_0x28428d[_0x16c1('0x16')]||0x3e8;}})[_0x16c1('0x17')](function(){if(_0x173484&&_0x173484[_0x16c1('0x18')]){var _0x39cfde=_0x173484[0x0]['num']%(_0x4917a0+_0x35f97b);if(_0x28428d[_0x16c1('0x15')]){for(;_0x48c094;_0x4917a0+=_0x35f97b,_0x39cfde=_0x173484[0x0][_0x16c1('0x19')]%(_0x4917a0+_0x35f97b)){if(_0x39cfde==0x0||_0x39cfde==_0x173484[0x0]['num']){_0x48c094=![];}_0x4aa738[_0x16c1('0xe')](dbH[_0x16c1('0x1a')][_0x16c1('0x1b')](util['format'](_0x16c1('0x1c'),QUERY,_0x35f97b,_0x4917a0),{'type':dbH[_0x16c1('0x1a')]['QueryTypes']['SELECT']}));}}else{_0x4aa738['push'](dbH[_0x16c1('0x1a')][_0x16c1('0x1b')](QUERY,{'type':dbH[_0x16c1('0x1a')][_0x16c1('0x1d')]['SELECT']}));}}_0x26d2d1=_0x28428d[_0x16c1('0x15')]&&_0x4aa738[_0x16c1('0x18')]>0x1;if(!fs[_0x16c1('0x1e')](path['join'](_0x46f05b,_0x48a2ab))&&_0x26d2d1){fs[_0x16c1('0x1f')](path[_0x16c1('0x20')](_0x46f05b,_0x48a2ab));}return BPromise['each'](_0x4aa738,function(_0x37c140){_0x361cc1[_0x16c1('0xe')](_0x37c140);});})['then'](function(){return BPromise[_0x16c1('0x21')](_0x4aa738,function(_0x4f8b3d,_0x3d498c){var _0x39189e;var _0x47ae86=util[_0x16c1('0x22')](_0x16c1('0x23'),NAME,_extractedReport['name'],moment(_extractedReport[_0x16c1('0x24')])[_0x16c1('0x22')](FORMAT),moment(_extractedReport[_0x16c1('0x25')])[_0x16c1('0x22')](FORMAT));var _0x233be8={'pageSize':'A4','pageOrientation':_0x16c1('0x26'),'content':[{'text':_0x47ae86,'style':_0x16c1('0x27')}],'defaultStyle':{'font':_0x16c1('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x10ede5={'headerRows':0x1,'body':[]};_0x10ede5[_0x16c1('0x29')][_0x16c1('0xe')](getHeader(_0x4f8b3d[0x0]));var _0x18fa68;for(var _0x5a891e=0x0;_0x5a891e<_0x4f8b3d[_0x16c1('0x18')];_0x5a891e+=0x1){_0x18fa68=[];for(var _0x173c40 in _0x4f8b3d[_0x5a891e]){if(_0x4f8b3d[_0x5a891e][_0x16c1('0xd')](_0x173c40)){_0x18fa68[_0x16c1('0xe')](_0x4f8b3d[_0x5a891e][_0x173c40]?_[_0x16c1('0x2a')](_0x4f8b3d[_0x5a891e][_0x173c40]):'');}}_0x10ede5[_0x16c1('0x29')]['push'](_0x18fa68);}_0x233be8[_0x16c1('0x2b')]['push']({'table':_0x10ede5});return new BPromise(function(_0x5d6ff3,_0x39b981){var _0x771bcf=new PdfPrinter({'Arial':{'normal':__dirname+_0x16c1('0x2c'),'bold':__dirname+_0x16c1('0x2d'),'italics':__dirname+_0x16c1('0x2e'),'bolditalics':__dirname+_0x16c1('0x2f')}});var _0x1e266d=_0x771bcf['createPdfKitDocument'](_0x233be8);if(_0x26d2d1){_0x39189e=path[_0x16c1('0x20')](_0x46f05b,_0x48a2ab,util['format'](_0x16c1('0x30'),_0x48a2ab,_0x3d498c,_0x16c1('0x31')));}else{_0x39189e=path[_0x16c1('0x20')](_0x46f05b,util[_0x16c1('0x22')](_0x16c1('0x32'),_0x48a2ab,'pdf'));}var _0x2fd455=_0x1e266d[_0x16c1('0x33')](fs[_0x16c1('0x34')](_0x39189e));_0x2fd455['on']('finish',function(){_0x5d6ff3();});_0x2fd455['on']('error',function(_0x534d23){console[_0x16c1('0x35')](_0x16c1('0x36'),_0x534d23);_0x39b981(_0x534d23);});_0x1e266d[_0x16c1('0x37')]();});});})[_0x16c1('0x17')](function(){if(_0x26d2d1){return new BPromise(function(_0x3e481c,_0x11a235){zipdir(path[_0x16c1('0x20')](_0x46f05b,_0x48a2ab),{'saveTo':path[_0x16c1('0x20')](_0x46f05b,util[_0x16c1('0x22')](_0x16c1('0x32'),_0x48a2ab,_0x16c1('0x38')))},function(_0x410d19){if(_0x410d19){_0x11a235(_0x410d19);}else{_0x3e481c();}});});}})[_0x16c1('0x17')](function(){if(_0x26d2d1){rimraf(path[_0x16c1('0x20')](_0x46f05b,_0x48a2ab),function(){});}})[_0x16c1('0x17')](function(){logger[_0x16c1('0x39')](util[_0x16c1('0x22')](_0x16c1('0x3a'),EXTRACTED_REPORT_ID,_0x16c1('0x3b')));return analyticExtractedReport(_0x16c1('0x3c'),_0x26d2d1?util['format'](_0x16c1('0x32'),_0x48a2ab,_0x26d2d1?_0x16c1('0x38'):_0x16c1('0x31')):null);});}function main(){logger[_0x16c1('0x39')](util['format'](_0x16c1('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x16c1('0xb')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x16c1('0x17')](function(_0x3b6a28){_extractedReport=_0x3b6a28;return dbH['sequelize'][_0x16c1('0x1b')](util['format'](_0x16c1('0x3e'),QUERY),{'type':dbH[_0x16c1('0x1a')]['QueryTypes'][_0x16c1('0x3f')]});})[_0x16c1('0x17')](extractReport)[_0x16c1('0x40')](function(_0x163b32){logger[_0x16c1('0x39')](util[_0x16c1('0x22')](_0x16c1('0x41'),EXTRACTED_REPORT_ID,_0x16c1('0x42')),util[_0x16c1('0x43')](_0x163b32,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2dee553..96361a3 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 _0x3dda=['push','dirname','join','each','xlsx','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length'];(function(_0x1bf8f5,_0x28f62c){var _0x36a54e=function(_0x43ba61){while(--_0x43ba61){_0x1bf8f5['push'](_0x1bf8f5['shift']());}};_0x36a54e(++_0x28f62c);}(_0x3dda,0x1a7));var _0xa3dd=function(_0x5d1df9,_0x4a95bf){_0x5d1df9=_0x5d1df9-0x0;var _0x5d4feb=_0x3dda[_0x5d1df9];return _0x5d4feb;};'use strict';var util=require(_0xa3dd('0x0'));var path=require(_0xa3dd('0x1'));var _=require(_0xa3dd('0x2'));var fs=require('fs');var json2xls=require(_0xa3dd('0x3'));var BPromise=require(_0xa3dd('0x4'));var zipdir=require(_0xa3dd('0x5'));var rimraf=require(_0xa3dd('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa3dd('0x7'))[_0xa3dd('0x8')];var logger=require(_0xa3dd('0x9'))(_0xa3dd('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa3dd('0xb')][0x3];var PATH=process[_0xa3dd('0xb')][0x4];function analyticExtractedReport(_0x7a85e0,_0x398913){var _0x3cad6d={'status':_0x7a85e0};var _0x2ad9e0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x398913){_0x3cad6d['savename']=_0x398913;}return db[_0xa3dd('0xc')]['update'](_0x3cad6d,_0x2ad9e0);}function main(){var _0x56b6e4=0x1388;var _0x37f738;logger[_0xa3dd('0xd')](util[_0xa3dd('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa3dd('0xf')));return db[_0xa3dd('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa3dd('0x11'),_0xa3dd('0x12')]})['then'](function(_0x3125ad){if(_0x3125ad){_0x37f738=_0x3125ad;_0x56b6e4=_0x37f738[_0xa3dd('0x12')]||0x1388;}})[_0xa3dd('0x13')](function(){return dbH[_0xa3dd('0x14')][_0xa3dd('0x15')](util[_0xa3dd('0xe')](_0xa3dd('0x16'),QUERY),{'type':dbH[_0xa3dd('0x14')][_0xa3dd('0x17')][_0xa3dd('0x18')]});})['then'](function(_0x4732a0){if(!_0x4732a0[0x0][_0xa3dd('0x19')]){return analyticExtractedReport(_0xa3dd('0x1a'));}var _0x3e2b6c=[];var _0x5268c8=0x0;var _0x1a700c=!![];if(_0x37f738['split']){if(_0x4732a0&&_0x4732a0[_0xa3dd('0x1b')]){var _0x2c6d9c=_0x4732a0[0x0][_0xa3dd('0x19')]%(_0x5268c8+_0x56b6e4);for(;_0x1a700c;_0x5268c8+=_0x56b6e4,_0x2c6d9c=_0x4732a0[0x0]['num']%(_0x5268c8+_0x56b6e4)){if(_0x2c6d9c==0x0||_0x2c6d9c==_0x4732a0[0x0][_0xa3dd('0x19')]){_0x1a700c=![];}_0x3e2b6c[_0xa3dd('0x1c')](dbH[_0xa3dd('0x14')][_0xa3dd('0x15')](util[_0xa3dd('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x56b6e4,_0x5268c8),{'type':dbH[_0xa3dd('0x14')][_0xa3dd('0x17')][_0xa3dd('0x18')]}));}}}else{_0x3e2b6c['push'](dbH[_0xa3dd('0x14')]['query'](QUERY,{'type':dbH[_0xa3dd('0x14')][_0xa3dd('0x17')][_0xa3dd('0x18')]}));}var _0x41bc01=path[_0xa3dd('0x1d')](PATH);var _0x2d457c=path['basename'](PATH,'.xlsx');var _0x239d16=_0x37f738[_0xa3dd('0x11')]&&_0x3e2b6c[_0xa3dd('0x1b')]>0x1;var _0x31675d=[];if(!fs['existsSync'](path[_0xa3dd('0x1e')](_0x41bc01,_0x2d457c))&&_0x239d16){fs['mkdirSync'](path[_0xa3dd('0x1e')](_0x41bc01,_0x2d457c));}return BPromise[_0xa3dd('0x1f')](_0x3e2b6c,function(_0x308a91){_0x31675d['push'](_0x308a91);})['then'](function(){for(var _0xb441e0=0x0;_0xb441e0<_0x31675d[_0xa3dd('0x1b')];_0xb441e0+=0x1){var _0x1db3ae;var _0xe4385=_0x31675d[_0xb441e0];if(_0x239d16){_0x1db3ae=path[_0xa3dd('0x1e')](_0x41bc01,_0x2d457c,util[_0xa3dd('0xe')]('%s%d.%s',_0x2d457c,_0xb441e0,_0xa3dd('0x20')));}else{_0x1db3ae=path[_0xa3dd('0x1e')](_0x41bc01,util[_0xa3dd('0xe')]('%s.%s',_0x2d457c,_0xa3dd('0x20')));}fs['writeFileSync'](_0x1db3ae,json2xls(_0xe4385),_0xa3dd('0x21'));}})[_0xa3dd('0x13')](function(){if(_0x239d16){zipdir(path[_0xa3dd('0x1e')](_0x41bc01,_0x2d457c),{'saveTo':path['join'](_0x41bc01,util[_0xa3dd('0xe')](_0xa3dd('0x22'),_0x2d457c,_0xa3dd('0x23')))},function(_0x52d69b,_0x2808ab){});rimraf(path[_0xa3dd('0x1e')](_0x41bc01,_0x2d457c),function(){});}})[_0xa3dd('0x13')](function(){logger['info'](util['format'](_0xa3dd('0x24'),EXTRACTED_REPORT_ID,_0xa3dd('0xf')));return analyticExtractedReport(_0xa3dd('0x25'),_0x239d16?util[_0xa3dd('0xe')](_0xa3dd('0x22'),_0x2d457c,_0x239d16?'zip':_0xa3dd('0x20')):null);});})[_0xa3dd('0x26')](function(_0x4c0e11){logger[_0xa3dd('0xd')](util[_0xa3dd('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa3dd('0xf')),util[_0xa3dd('0x27')](_0x4c0e11,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa3dd('0x28'));});}main(); \ No newline at end of file +var _0xaf5a=['.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','binary','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','then','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename'];(function(_0x63e59d,_0x1696a7){var _0x5f4893=function(_0x351c15){while(--_0x351c15){_0x63e59d['push'](_0x63e59d['shift']());}};_0x5f4893(++_0x1696a7);}(_0xaf5a,0x116));var _0xaaf5=function(_0x5eb6e6,_0x17f551){_0x5eb6e6=_0x5eb6e6-0x0;var _0x35c38b=_0xaf5a[_0x5eb6e6];return _0x35c38b;};'use strict';var util=require('util');var path=require(_0xaaf5('0x0'));var _=require(_0xaaf5('0x1'));var fs=require('fs');var json2xls=require(_0xaaf5('0x2'));var BPromise=require(_0xaaf5('0x3'));var zipdir=require(_0xaaf5('0x4'));var rimraf=require(_0xaaf5('0x5'));var db=require(_0xaaf5('0x6'))['db'];var dbH=require(_0xaaf5('0x6'))['dbH'];var logger=require(_0xaaf5('0x7'))(_0xaaf5('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xaaf5('0x9')][0x2]);var QUERY=process[_0xaaf5('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x57e7f9,_0x34a86f){var _0x2243cb={'status':_0x57e7f9};var _0x408180={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x34a86f){_0x2243cb[_0xaaf5('0xa')]=_0x34a86f;}return db[_0xaaf5('0xb')]['update'](_0x2243cb,_0x408180);}function main(){var _0x9787e1=0x1388;var _0x5957ba;logger['info'](util[_0xaaf5('0xc')](_0xaaf5('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xaaf5('0xe')][_0xaaf5('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaaf5('0x10'),_0xaaf5('0x11')]})['then'](function(_0x459334){if(_0x459334){_0x5957ba=_0x459334;_0x9787e1=_0x5957ba[_0xaaf5('0x11')]||0x1388;}})['then'](function(){return dbH[_0xaaf5('0x12')]['query'](util[_0xaaf5('0xc')](_0xaaf5('0x13'),QUERY),{'type':dbH[_0xaaf5('0x12')][_0xaaf5('0x14')]['SELECT']});})[_0xaaf5('0x15')](function(_0x3079c3){if(!_0x3079c3[0x0][_0xaaf5('0x16')]){return analyticExtractedReport(_0xaaf5('0x17'));}var _0x277f2b=[];var _0x10a50b=0x0;var _0x27d66f=!![];if(_0x5957ba['split']){if(_0x3079c3&&_0x3079c3[_0xaaf5('0x18')]){var _0x14bc84=_0x3079c3[0x0][_0xaaf5('0x16')]%(_0x10a50b+_0x9787e1);for(;_0x27d66f;_0x10a50b+=_0x9787e1,_0x14bc84=_0x3079c3[0x0][_0xaaf5('0x16')]%(_0x10a50b+_0x9787e1)){if(_0x14bc84==0x0||_0x14bc84==_0x3079c3[0x0][_0xaaf5('0x16')]){_0x27d66f=![];}_0x277f2b[_0xaaf5('0x19')](dbH[_0xaaf5('0x12')]['query'](util['format'](_0xaaf5('0x1a'),QUERY,_0x9787e1,_0x10a50b),{'type':dbH[_0xaaf5('0x12')][_0xaaf5('0x14')][_0xaaf5('0x1b')]}));}}}else{_0x277f2b[_0xaaf5('0x19')](dbH[_0xaaf5('0x12')]['query'](QUERY,{'type':dbH['sequelize'][_0xaaf5('0x14')][_0xaaf5('0x1b')]}));}var _0x341cfe=path[_0xaaf5('0x1c')](PATH);var _0x3020b0=path[_0xaaf5('0x1d')](PATH,_0xaaf5('0x1e'));var _0x457b69=_0x5957ba[_0xaaf5('0x10')]&&_0x277f2b[_0xaaf5('0x18')]>0x1;var _0x43b064=[];if(!fs[_0xaaf5('0x1f')](path[_0xaaf5('0x20')](_0x341cfe,_0x3020b0))&&_0x457b69){fs[_0xaaf5('0x21')](path['join'](_0x341cfe,_0x3020b0));}return BPromise['each'](_0x277f2b,function(_0x15a6e4){_0x43b064['push'](_0x15a6e4);})[_0xaaf5('0x15')](function(){for(var _0x4d2003=0x0;_0x4d2003<_0x43b064['length'];_0x4d2003+=0x1){var _0x236131;var _0x26f14a=_0x43b064[_0x4d2003];if(_0x457b69){_0x236131=path[_0xaaf5('0x20')](_0x341cfe,_0x3020b0,util[_0xaaf5('0xc')](_0xaaf5('0x22'),_0x3020b0,_0x4d2003,_0xaaf5('0x23')));}else{_0x236131=path['join'](_0x341cfe,util[_0xaaf5('0xc')]('%s.%s',_0x3020b0,'xlsx'));}fs[_0xaaf5('0x24')](_0x236131,json2xls(_0x26f14a),_0xaaf5('0x25'));}})[_0xaaf5('0x15')](function(){if(_0x457b69){zipdir(path[_0xaaf5('0x20')](_0x341cfe,_0x3020b0),{'saveTo':path[_0xaaf5('0x20')](_0x341cfe,util[_0xaaf5('0xc')]('%s.%s',_0x3020b0,_0xaaf5('0x26')))},function(_0x4954af,_0x39539f){});rimraf(path[_0xaaf5('0x20')](_0x341cfe,_0x3020b0),function(){});}})['then'](function(){logger[_0xaaf5('0x27')](util['format'](_0xaaf5('0x28'),EXTRACTED_REPORT_ID,_0xaaf5('0x29')));return analyticExtractedReport('Completed',_0x457b69?util[_0xaaf5('0xc')]('%s.%s',_0x3020b0,_0x457b69?_0xaaf5('0x26'):_0xaaf5('0x23')):null);});})['catch'](function(_0x10285c){logger['info'](util[_0xaaf5('0xc')](_0xaaf5('0x2a'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xaaf5('0x2b')](_0x10285c,{'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 7bf27bb..a1ae241 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 _0x38db=['CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','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','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','push','Set','type','context','priority','outbound','${EXTEN:','cutdigits','${EXTEN}','VoiceExtensionId','CDR(routeid)=','ExecIf'];(function(_0x54e0a8,_0x2b73bf){var _0x31cdb1=function(_0x5fe38c){while(--_0x5fe38c){_0x54e0a8['push'](_0x54e0a8['shift']());}};_0x31cdb1(++_0x2b73bf);}(_0x38db,0x6a));var _0xb38d=function(_0x21c72a,_0x406cd1){_0x21c72a=_0x21c72a-0x0;var _0x406971=_0x38db[_0x21c72a];return _0x406971;};'use strict';var _=require(_0xb38d('0x0'));var util=require(_0xb38d('0x1'));function rewrite(_0x2c310c,_0x3da738){var _0x3f9e3b=this;return _0x2c310c[_0xb38d('0x2')][_0xb38d('0x3')][_0xb38d('0x4')]({'raw':!![]})[_0xb38d('0x5')](function(_0x1e2b0e){_0x3f9e3b[_0xb38d('0x6')]=_0x1e2b0e;return _0x2c310c[_0xb38d('0x2')][_0xb38d('0x7')][_0xb38d('0x4')]({'where':{'IntervalId':_0x3da738[_0xb38d('0x8')]},'raw':!![]});})[_0xb38d('0x5')](function(_0x1e53d3){return _0x2c310c[_0xb38d('0x2')]['VoiceExtension'][_0xb38d('0x4')]({'where':{'exten':{'$in':_[_0xb38d('0x9')](_[_0xb38d('0xa')](_0x1e53d3,_0xb38d('0xb')))}},'order':[{'raw':_0xb38d('0xc')}],'raw':!![]});})[_0xb38d('0x5')](function(_0x24ff6e){var _0x51c465=_[_0xb38d('0xd')](_0x24ff6e,{'priority':'1'});var _0xb02ddd=_['filter'](_0x24ff6e,{'isApp':0x1});var _0x3497a8=_[_0xb38d('0xe')](_0xb02ddd,_0xb38d('0xb'));var _0x2790ff=[_0xb38d('0xf'),_0xb38d('0x10')];var _0x199b5b=[];var _0x52ba80=[];for(var _0x281e89 in _0x3497a8){if(_0x3497a8[_0xb38d('0x11')](_0x281e89)){_0x3f9e3b['priority']=0x2;_0x3f9e3b[_0xb38d('0x12')]=[];_0x3f9e3b[_0xb38d('0x13')]=_['find'](_0x51c465,{'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')]});_0x3f9e3b['extensions'][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0]['type'],'app':_0xb38d('0x15'),'appdata':util['format']('CDR(type)=%s',_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')]),'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'priority':_0x3f9e3b[_0xb38d('0x18')]++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0]['VoiceExtensionId']});if(_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')]===_0xb38d('0x19')){if(_0x3f9e3b[_0xb38d('0x13')]){_0x3f9e3b[_0xb38d('0x12')][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':'Set','appdata':'CDR(destination)='+(_0x3f9e3b[_0xb38d('0x13')]['cutdigits']?_0xb38d('0x1a')+_0x3f9e3b[_0xb38d('0x13')][_0xb38d('0x1b')]+'}':_0xb38d('0x1c')),'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0]['exten'],'priority':_0x3f9e3b[_0xb38d('0x18')]++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});}_0x3f9e3b['extensions'][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':'Set','appdata':_0xb38d('0x1e')+_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')],'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'priority':_0x3f9e3b[_0xb38d('0x18')]++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});var _0x2745ed=_0x3f9e3b['priority']++;_0x3f9e3b['extensions'][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0]['type'],'app':_0xb38d('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2745ed+0x2)+'):Goto('+(_0x2745ed+0x1)+')','context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0]['exten'],'priority':_0x2745ed,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});if(_0x3f9e3b[_0xb38d('0x13')]){_0x3f9e3b[_0xb38d('0x12')][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':_0xb38d('0x15'),'appdata':_0x3f9e3b[_0xb38d('0x13')][_0xb38d('0x1b')]?_0xb38d('0x20')+_0x3f9e3b[_0xb38d('0x13')][_0xb38d('0x1b')]+'}':_0xb38d('0x21'),'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'priority':_0x3f9e3b[_0xb38d('0x18')]++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});}_0x3f9e3b['extensions'][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':'Set','appdata':_0xb38d('0x22')+_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')],'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0]['exten'],'priority':_0x3f9e3b['priority']++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});if(_0x3f9e3b['extension']&&_0x3f9e3b['extension'][_0xb38d('0x11')]('recordingFormat')&&_0x3f9e3b[_0xb38d('0x13')]['recordingFormat']!==_0xb38d('0x23')){_0x3f9e3b[_0xb38d('0x12')][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'priority':_0x3f9e3b['priority']++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});_0x3f9e3b[_0xb38d('0x12')][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':_0xb38d('0x15'),'appdata':_0xb38d('0x24')+_0x3f9e3b[_0xb38d('0x13')]['recordingFormat']||_0xb38d('0x25'),'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'priority':_0x3f9e3b['priority']++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});}}_0x3f9e3b[_0xb38d('0x12')][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0]['type'],'app':'Set','appdata':_0xb38d('0x26'),'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'priority':_0x3f9e3b['priority']++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});_0x3f9e3b['extensions']['push']({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':_0xb38d('0x15'),'appdata':_0xb38d('0x27'),'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'priority':_0x3f9e3b['priority']++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0]['VoiceExtensionId']});_0x3f9e3b[_0xb38d('0x12')][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':_0xb38d('0x15'),'appdata':_0xb38d('0x28'),'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'priority':_0x3f9e3b[_0xb38d('0x18')]++,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});for(var _0x59b10f=0x0,_0x290a9e=0x0;_0x59b10f<_0x3497a8[_0x281e89][_0xb38d('0x29')];_0x59b10f+=0x1,_0x290a9e=0x0){var _0x579e98=_0x3497a8[_0x281e89][_0x59b10f];if(_0x579e98[_0xb38d('0x16')]){_0x579e98[_0xb38d('0x16')]=_0x579e98['type']['toLowerCase']();}var _0x1801ab=[];var _0x57dcdf=[];delete _0x579e98['id'];delete _0x579e98[_0xb38d('0x2a')];delete _0x579e98[_0xb38d('0x2b')];var _0x3b08c5=_0x579e98[_0xb38d('0x2c')]!=='*,*,*,*'?[_0x579e98[_0xb38d('0x2c')]]:_0x579e98['IntervalId']?_[_0xb38d('0xa')](_[_0xb38d('0xd')](_0x3f9e3b[_0xb38d('0x6')],{'IntervalId':_0x579e98['IntervalId']}),_0xb38d('0x2c')):[];if(_0x579e98['hasOwnProperty'](_0xb38d('0x2d'))){if(_0x579e98[_0xb38d('0x2d')]&&_0x579e98[_0xb38d('0x2d')]!=='--'){_0x1801ab[_0xb38d('0x14')]({'type':_0x579e98[_0xb38d('0x16')],'app':_0xb38d('0x15'),'appdata':'CDR(tag)='+_0x579e98[_0xb38d('0x2d')],'context':_0x579e98[_0xb38d('0x17')],'exten':_0x579e98['exten'],'priority':_0x3b08c5[_0xb38d('0x29')]+_0x3f9e3b['priority']+_0x290a9e++,'VoiceExtensionId':_0x579e98[_0xb38d('0x1d')]});}}if(_0x579e98[_0xb38d('0x16')]===_0xb38d('0x19')&&_0x579e98[_0xb38d('0x11')](_0xb38d('0x2e'))){if(_0x579e98[_0xb38d('0x2e')]){_0x1801ab[_0xb38d('0x14')]({'type':_0x579e98[_0xb38d('0x16')],'app':_0xb38d('0x1f'),'appdata':_0xb38d('0x2f')+_0x579e98['callerID']+')','context':_0x579e98[_0xb38d('0x17')],'exten':_0x579e98[_0xb38d('0xb')],'priority':_0x3b08c5[_0xb38d('0x29')]+_0x3f9e3b[_0xb38d('0x18')]+_0x290a9e++,'VoiceExtensionId':_0x579e98[_0xb38d('0x1d')]});}else{_0x1801ab[_0xb38d('0x14')]({'type':_0x579e98[_0xb38d('0x16')],'app':_0xb38d('0x1f'),'appdata':_0xb38d('0x30'),'context':_0x579e98[_0xb38d('0x17')],'exten':_0x579e98[_0xb38d('0xb')],'priority':_0x3b08c5[_0xb38d('0x29')]+_0x3f9e3b[_0xb38d('0x18')]+_0x290a9e++,'VoiceExtensionId':_0x579e98['VoiceExtensionId']});}}if(_0x579e98['hasOwnProperty'](_0xb38d('0x31'))){if(_0x2790ff[_0xb38d('0x32')](_0x579e98[_0xb38d('0x33')]['toLowerCase']())>=0x0&&_0x579e98[_0xb38d('0x34')]!==_0xb38d('0x35')){if(_0x579e98[_0xb38d('0x31')]){_0x1801ab[_0xb38d('0x14')]({'type':_0x579e98[_0xb38d('0x16')],'app':'ExecIf','appdata':_0xb38d('0x36'),'context':_0x579e98[_0xb38d('0x17')],'exten':_0x579e98[_0xb38d('0xb')],'priority':_0x3b08c5[_0xb38d('0x29')]+_0x3f9e3b[_0xb38d('0x18')]+_0x290a9e++,'VoiceExtensionId':_0x579e98[_0xb38d('0x1d')]});_0x1801ab[_0xb38d('0x14')]({'type':_0x579e98[_0xb38d('0x16')],'app':_0xb38d('0x15'),'appdata':_0xb38d('0x37'),'context':_0x579e98[_0xb38d('0x17')],'exten':_0x579e98['exten'],'priority':_0x3b08c5[_0xb38d('0x29')]+_0x3f9e3b[_0xb38d('0x18')]+_0x290a9e++,'VoiceExtensionId':_0x579e98[_0xb38d('0x1d')]});}else{_0x1801ab['push']({'type':_0x579e98[_0xb38d('0x16')],'app':_0xb38d('0x1f'),'appdata':_0xb38d('0x38'),'context':_0x579e98[_0xb38d('0x17')],'exten':_0x579e98[_0xb38d('0xb')],'priority':_0x3b08c5[_0xb38d('0x29')]+_0x3f9e3b[_0xb38d('0x18')]+_0x290a9e++,'VoiceExtensionId':_0x579e98[_0xb38d('0x1d')]});_0x1801ab[_0xb38d('0x14')]({'type':_0x579e98[_0xb38d('0x16')],'app':_0xb38d('0x15'),'appdata':_0xb38d('0x39'),'context':_0x579e98[_0xb38d('0x17')],'exten':_0x579e98['exten'],'priority':_0x3b08c5[_0xb38d('0x29')]+_0x3f9e3b[_0xb38d('0x18')]+_0x290a9e++,'VoiceExtensionId':_0x579e98[_0xb38d('0x1d')]});}}}for(var _0x445c96=0x0;_0x445c96<_0x3b08c5['length'];_0x445c96+=0x1){var _0x507af5=_0x3f9e3b[_0xb38d('0x18')]+_0x3b08c5['length'];var _0x3bcedd=_0x445c96===_0x3b08c5[_0xb38d('0x29')]-0x1?_0x3f9e3b[_0xb38d('0x18')]+_0x1801ab['length']+_0x57dcdf[_0xb38d('0x29')]+0x2:_0x3f9e3b[_0xb38d('0x18')]+_0x445c96+0x1;_0x1801ab['splice'](_0x445c96,0x0,{'type':_0x579e98['type'],'app':_0xb38d('0x3a'),'appdata':_0x3b08c5[_0x445c96]+'?'+_0x579e98[_0xb38d('0x17')]+_0xb38d('0x3b')+_0x507af5+':'+_0x579e98[_0xb38d('0x17')]+',${EXTEN},'+_0x3bcedd,'exten':_0x579e98[_0xb38d('0xb')],'context':_0x579e98[_0xb38d('0x17')],'priority':_0x3f9e3b['priority']+_0x445c96,'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});}_0x579e98['priority']=_0x1801ab[_0xb38d('0x29')]?_[_0xb38d('0x3c')](_0x1801ab)[_0xb38d('0x18')]+0x1:_0x3f9e3b[_0xb38d('0x18')];_0x3f9e3b[_0xb38d('0x18')]=(_0x57dcdf[_0xb38d('0x29')]?_[_0xb38d('0x3c')](_0x57dcdf)[_0xb38d('0x18')]:_0x579e98[_0xb38d('0x18')])+0x1;_0x3f9e3b[_0xb38d('0x12')]=_[_0xb38d('0x3d')](_0x3f9e3b[_0xb38d('0x12')],_0x1801ab,[_0x579e98],_0x57dcdf);}_0x3f9e3b[_0xb38d('0x12')][_0xb38d('0x14')]({'type':_0x3497a8[_0x281e89][0x0][_0xb38d('0x16')],'app':_0xb38d('0x3e'),'exten':_0x3497a8[_0x281e89][0x0][_0xb38d('0xb')],'context':_0x3497a8[_0x281e89][0x0][_0xb38d('0x17')],'priority':_0x3f9e3b[_0xb38d('0x18')],'VoiceExtensionId':_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]});_0x199b5b[_0xb38d('0x14')](_0x3497a8[_0x281e89][0x0][_0xb38d('0x1d')]);_0x52ba80=_['concat'](_0x52ba80,_0x3f9e3b[_0xb38d('0x12')]);}}return _0x2c310c[_0xb38d('0x3f')](function(_0x387f1e){return _0x2c310c[_0xb38d('0x2')][_0xb38d('0x7')][_0xb38d('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x199b5b}},'transaction':_0x387f1e})[_0xb38d('0x5')](function(_0x10d078){return _0x2c310c[_0xb38d('0x2')][_0xb38d('0x7')][_0xb38d('0x41')](_[_0xb38d('0x42')](_0x52ba80,'priority'),{'transaction':_0x387f1e});});});})[_0xb38d('0x43')](function(_0x48ffa8){console['error'](_0x48ffa8);});}exports[_0xb38d('0x44')]=rewrite; \ No newline at end of file +var _0x6691=['context','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','destroy','catch','error','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','exten','filter','groupBy','queue','extensions','extension','find','type','Set','format','CDR(type)=%s','priority','VoiceExtensionId','push','cutdigits','${EXTEN:','${EXTEN}'];(function(_0x139b85,_0x5e0691){var _0x1e833f=function(_0xc97932){while(--_0xc97932){_0x139b85['push'](_0x139b85['shift']());}};_0x1e833f(++_0x5e0691);}(_0x6691,0x134));var _0x1669=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6691[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));function rewrite(_0x250715,_0x287a8a){var _0x6bfc4e=this;return _0x250715[_0x1669('0x2')][_0x1669('0x3')][_0x1669('0x4')]({'raw':!![]})['then'](function(_0x3925b4){_0x6bfc4e[_0x1669('0x5')]=_0x3925b4;return _0x250715[_0x1669('0x2')][_0x1669('0x6')][_0x1669('0x4')]({'where':{'IntervalId':_0x287a8a[_0x1669('0x7')]},'raw':!![]});})[_0x1669('0x8')](function(_0x40a41b){return _0x250715['models'][_0x1669('0x6')][_0x1669('0x4')]({'where':{'exten':{'$in':_[_0x1669('0x9')](_['map'](_0x40a41b,_0x1669('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x50ebc3){var _0x17a4fe=_[_0x1669('0xb')](_0x50ebc3,{'priority':'1'});var _0x14694c=_[_0x1669('0xb')](_0x50ebc3,{'isApp':0x1});var _0x3bd44d=_[_0x1669('0xc')](_0x14694c,_0x1669('0xa'));var _0x53e1a5=[_0x1669('0xd'),'playback'];var _0x16aba3=[];var _0x29eb1c=[];for(var _0xe49c2c in _0x3bd44d){if(_0x3bd44d['hasOwnProperty'](_0xe49c2c)){_0x6bfc4e['priority']=0x2;_0x6bfc4e[_0x1669('0xe')]=[];_0x6bfc4e[_0x1669('0xf')]=_[_0x1669('0x10')](_0x17a4fe,{'exten':_0x3bd44d[_0xe49c2c][0x0]['exten']});_0x6bfc4e['extensions']['push']({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':util[_0x1669('0x13')](_0x1669('0x14'),_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')]),'context':_0x3bd44d[_0xe49c2c][0x0]['context'],'exten':_0x3bd44d[_0xe49c2c][0x0]['exten'],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});if(_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')]==='outbound'){if(_0x6bfc4e[_0x1669('0xf')]){_0x6bfc4e[_0x1669('0xe')][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':'CDR(destination)='+(_0x6bfc4e[_0x1669('0xf')][_0x1669('0x18')]?_0x1669('0x19')+_0x6bfc4e[_0x1669('0xf')]['cutdigits']+'}':_0x1669('0x1a')),'context':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x1b')],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});}_0x6bfc4e[_0x1669('0xe')][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0]['type'],'app':_0x1669('0x12'),'appdata':_0x1669('0x1c')+_0x3bd44d[_0xe49c2c][0x0]['VoiceExtensionId'],'context':_0x3bd44d[_0xe49c2c][0x0]['context'],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0]['VoiceExtensionId']});var _0x2ea214=_0x6bfc4e['priority']++;_0x6bfc4e[_0x1669('0xe')]['push']({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x1d'),'appdata':_0x1669('0x1e')+(_0x2ea214+0x2)+'):Goto('+(_0x2ea214+0x1)+')','context':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x1b')],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x2ea214,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});if(_0x6bfc4e[_0x1669('0xf')]){_0x6bfc4e[_0x1669('0xe')][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':_0x6bfc4e[_0x1669('0xf')][_0x1669('0x18')]?'CDR(prefix)=${EXTEN:0:'+_0x6bfc4e[_0x1669('0xf')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x1b')],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0]['VoiceExtensionId']});}_0x6bfc4e[_0x1669('0xe')][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':'outboundrouteid='+_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')],'context':_0x3bd44d[_0xe49c2c][0x0]['context'],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});if(_0x6bfc4e[_0x1669('0xf')]&&_0x6bfc4e[_0x1669('0xf')][_0x1669('0x1f')]('recordingFormat')&&_0x6bfc4e[_0x1669('0xf')][_0x1669('0x20')]!==_0x1669('0x21')){_0x6bfc4e[_0x1669('0xe')][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':_0x1669('0x22'),'context':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x1b')],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0]['VoiceExtensionId']});_0x6bfc4e['extensions'][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':_0x1669('0x23')+_0x6bfc4e['extension'][_0x1669('0x20')]||_0x1669('0x24'),'context':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x1b')],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});}}_0x6bfc4e[_0x1669('0xe')]['push']({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':_0x1669('0x25'),'context':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x1b')],'exten':_0x3bd44d[_0xe49c2c][0x0]['exten'],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});_0x6bfc4e[_0x1669('0xe')][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0]['type'],'app':_0x1669('0x12'),'appdata':_0x1669('0x26'),'context':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x1b')],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});_0x6bfc4e[_0x1669('0xe')][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3bd44d[_0xe49c2c][0x0]['context'],'exten':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0xa')],'priority':_0x6bfc4e[_0x1669('0x15')]++,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});for(var _0x2c0721=0x0,_0xada02d=0x0;_0x2c0721<_0x3bd44d[_0xe49c2c][_0x1669('0x27')];_0x2c0721+=0x1,_0xada02d=0x0){var _0x28a5f5=_0x3bd44d[_0xe49c2c][_0x2c0721];if(_0x28a5f5[_0x1669('0x11')]){_0x28a5f5[_0x1669('0x11')]=_0x28a5f5[_0x1669('0x11')][_0x1669('0x28')]();}var _0xfd1c2b=[];var _0x4ba706=[];delete _0x28a5f5['id'];delete _0x28a5f5['createdAt'];delete _0x28a5f5[_0x1669('0x29')];var _0x525100=_0x28a5f5[_0x1669('0x2a')]!==_0x1669('0x2b')?[_0x28a5f5[_0x1669('0x2a')]]:_0x28a5f5['IntervalId']?_[_0x1669('0x2c')](_['filter'](_0x6bfc4e[_0x1669('0x5')],{'IntervalId':_0x28a5f5[_0x1669('0x7')]}),_0x1669('0x2a')):[];if(_0x28a5f5[_0x1669('0x1f')](_0x1669('0x2d'))){if(_0x28a5f5[_0x1669('0x2d')]&&_0x28a5f5[_0x1669('0x2d')]!=='--'){_0xfd1c2b[_0x1669('0x17')]({'type':_0x28a5f5[_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':_0x1669('0x2e')+_0x28a5f5[_0x1669('0x2d')],'context':_0x28a5f5[_0x1669('0x1b')],'exten':_0x28a5f5[_0x1669('0xa')],'priority':_0x525100['length']+_0x6bfc4e[_0x1669('0x15')]+_0xada02d++,'VoiceExtensionId':_0x28a5f5[_0x1669('0x16')]});}}if(_0x28a5f5[_0x1669('0x11')]===_0x1669('0x2f')&&_0x28a5f5[_0x1669('0x1f')]('callerID')){if(_0x28a5f5[_0x1669('0x30')]){_0xfd1c2b[_0x1669('0x17')]({'type':_0x28a5f5[_0x1669('0x11')],'app':_0x1669('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x28a5f5[_0x1669('0x30')]+')','context':_0x28a5f5[_0x1669('0x1b')],'exten':_0x28a5f5[_0x1669('0xa')],'priority':_0x525100['length']+_0x6bfc4e[_0x1669('0x15')]+_0xada02d++,'VoiceExtensionId':_0x28a5f5[_0x1669('0x16')]});}else{_0xfd1c2b[_0x1669('0x17')]({'type':_0x28a5f5[_0x1669('0x11')],'app':_0x1669('0x1d'),'appdata':_0x1669('0x31'),'context':_0x28a5f5[_0x1669('0x1b')],'exten':_0x28a5f5['exten'],'priority':_0x525100[_0x1669('0x27')]+_0x6bfc4e['priority']+_0xada02d++,'VoiceExtensionId':_0x28a5f5[_0x1669('0x16')]});}}if(_0x28a5f5['hasOwnProperty'](_0x1669('0x32'))){if(_0x53e1a5[_0x1669('0x33')](_0x28a5f5[_0x1669('0x34')][_0x1669('0x28')]())>=0x0&&_0x28a5f5['appType']!==_0x1669('0x35')){if(_0x28a5f5[_0x1669('0x32')]){_0xfd1c2b[_0x1669('0x17')]({'type':_0x28a5f5[_0x1669('0x11')],'app':_0x1669('0x1d'),'appdata':_0x1669('0x36'),'context':_0x28a5f5[_0x1669('0x1b')],'exten':_0x28a5f5[_0x1669('0xa')],'priority':_0x525100[_0x1669('0x27')]+_0x6bfc4e[_0x1669('0x15')]+_0xada02d++,'VoiceExtensionId':_0x28a5f5[_0x1669('0x16')]});_0xfd1c2b[_0x1669('0x17')]({'type':_0x28a5f5[_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':_0x1669('0x37'),'context':_0x28a5f5['context'],'exten':_0x28a5f5[_0x1669('0xa')],'priority':_0x525100[_0x1669('0x27')]+_0x6bfc4e[_0x1669('0x15')]+_0xada02d++,'VoiceExtensionId':_0x28a5f5['VoiceExtensionId']});}else{_0xfd1c2b[_0x1669('0x17')]({'type':_0x28a5f5[_0x1669('0x11')],'app':'ExecIf','appdata':_0x1669('0x38'),'context':_0x28a5f5['context'],'exten':_0x28a5f5[_0x1669('0xa')],'priority':_0x525100[_0x1669('0x27')]+_0x6bfc4e['priority']+_0xada02d++,'VoiceExtensionId':_0x28a5f5['VoiceExtensionId']});_0xfd1c2b[_0x1669('0x17')]({'type':_0x28a5f5[_0x1669('0x11')],'app':_0x1669('0x12'),'appdata':_0x1669('0x39'),'context':_0x28a5f5['context'],'exten':_0x28a5f5[_0x1669('0xa')],'priority':_0x525100[_0x1669('0x27')]+_0x6bfc4e['priority']+_0xada02d++,'VoiceExtensionId':_0x28a5f5[_0x1669('0x16')]});}}}for(var _0x447189=0x0;_0x447189<_0x525100[_0x1669('0x27')];_0x447189+=0x1){var _0x592c05=_0x6bfc4e['priority']+_0x525100[_0x1669('0x27')];var _0x39ec2b=_0x447189===_0x525100[_0x1669('0x27')]-0x1?_0x6bfc4e[_0x1669('0x15')]+_0xfd1c2b[_0x1669('0x27')]+_0x4ba706[_0x1669('0x27')]+0x2:_0x6bfc4e[_0x1669('0x15')]+_0x447189+0x1;_0xfd1c2b[_0x1669('0x3a')](_0x447189,0x0,{'type':_0x28a5f5[_0x1669('0x11')],'app':_0x1669('0x3b'),'appdata':_0x525100[_0x447189]+'?'+_0x28a5f5[_0x1669('0x1b')]+_0x1669('0x3c')+_0x592c05+':'+_0x28a5f5['context']+',${EXTEN},'+_0x39ec2b,'exten':_0x28a5f5['exten'],'context':_0x28a5f5[_0x1669('0x1b')],'priority':_0x6bfc4e[_0x1669('0x15')]+_0x447189,'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]});}_0x28a5f5['priority']=_0xfd1c2b[_0x1669('0x27')]?_['last'](_0xfd1c2b)[_0x1669('0x15')]+0x1:_0x6bfc4e['priority'];_0x6bfc4e[_0x1669('0x15')]=(_0x4ba706['length']?_[_0x1669('0x3d')](_0x4ba706)[_0x1669('0x15')]:_0x28a5f5[_0x1669('0x15')])+0x1;_0x6bfc4e[_0x1669('0xe')]=_['concat'](_0x6bfc4e[_0x1669('0xe')],_0xfd1c2b,[_0x28a5f5],_0x4ba706);}_0x6bfc4e[_0x1669('0xe')][_0x1669('0x17')]({'type':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x11')],'app':_0x1669('0x3e'),'exten':_0x3bd44d[_0xe49c2c][0x0]['exten'],'context':_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x1b')],'priority':_0x6bfc4e[_0x1669('0x15')],'VoiceExtensionId':_0x3bd44d[_0xe49c2c][0x0]['VoiceExtensionId']});_0x16aba3[_0x1669('0x17')](_0x3bd44d[_0xe49c2c][0x0][_0x1669('0x16')]);_0x29eb1c=_['concat'](_0x29eb1c,_0x6bfc4e[_0x1669('0xe')]);}}return _0x250715[_0x1669('0x3f')](function(_0x23a864){return _0x250715[_0x1669('0x2')][_0x1669('0x6')][_0x1669('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x16aba3}},'transaction':_0x23a864})[_0x1669('0x8')](function(_0x39135f){return _0x250715['models'][_0x1669('0x6')]['bulkCreate'](_['sortBy'](_0x29eb1c,_0x1669('0x15')),{'transaction':_0x23a864});});});})[_0x1669('0x41')](function(_0x5421ae){console[_0x1669('0x42')](_0x5421ae);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0131d34..9223b84 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x13d831,_0x2eb6cf){var _0x5d9d6b=function(_0x265913){while(--_0x265913){_0x13d831['push'](_0x13d831['shift']());}};_0x5d9d6b(++_0x2eb6cf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +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(_0x50dda8,_0x31b42e){var _0x403dab=function(_0x4aa8c0){while(--_0x4aa8c0){_0x50dda8['push'](_0x50dda8['shift']());}};_0x403dab(++_0x31b42e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 4227a68..f0cd861 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 _0x1d1e=['YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','all','split','filter','push','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_hopper_black','fromQuery','.CmListId\x20=\x20?','ListId\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','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','sequelize','spread','catch','main','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','name','header','writeFileSync','parse','createReadStream','data','find','isNil','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','emit','unlink','exit','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format'];(function(_0x317bf0,_0x277c03){var _0x225932=function(_0x2c280e){while(--_0x2c280e){_0x317bf0['push'](_0x317bf0['shift']());}};_0x225932(++_0x277c03);}(_0x1d1e,0x9a));var _0xe1d1=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0x1d1e[_0x21205e];return _0x136ebb;};'use strict';var fs=require('fs');var path=require(_0xe1d1('0x0'));var _=require(_0xe1d1('0x1'));var Papa=require(_0xe1d1('0x2'));var util=require(_0xe1d1('0x3'));var BPromise=require(_0xe1d1('0x4'));var moment=require(_0xe1d1('0x5'));var squel=require('squel');var Redis=require(_0xe1d1('0x6'));var db=require(_0xe1d1('0x7'))['db'];var config=require(_0xe1d1('0x8'));var logger=require(_0xe1d1('0x9'))(_0xe1d1('0xa'));config[_0xe1d1('0xb')]=_[_0xe1d1('0xc')](config['redis'],{'host':_0xe1d1('0xd'),'port':0x18eb});var socket=require(_0xe1d1('0xe'))(new Redis(config[_0xe1d1('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xe1d1('0xf')](_0xe1d1('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x2690d5){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))*$/[_0xe1d1('0x11')](_0x2690d5);}function selectNotIn(_0x2dabc0,_0x393058,_0x4f614d,_0x598b20,_0x2066e6){return squel[_0xe1d1('0x12')]()[_0xe1d1('0x13')](_0xe1d1('0x14'))[_0xe1d1('0x15')](_0x598b20)[_0xe1d1('0x16')](_0x393058,null,_0x393058+'.id\x20=\x20'+_0x598b20+'.'+_0x4f614d)['where'](_0x598b20+'.'+_0x4f614d+_0xe1d1('0x17')+_0x2dabc0+'.'+_0x4f614d)[_0xe1d1('0x18')](_0x393058+_0xe1d1('0x19')+_0x2066e6[_0xe1d1('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x176214,_0x252cd0){promisesAdditionalPhones=[];return db[_0xe1d1('0x1a')][_0xe1d1('0x1b')]({'raw':!![],'attributes':['id',_0xe1d1('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xe1d1('0x1d')](function(_0x1826a7){if(_0x1826a7!==null){var _0x2c193f=[];for(var _0xab253b=0x0;_0xab253b<_0x1826a7[_0xe1d1('0x1e')];_0xab253b++){var _0x16db6c=_0x1826a7[_0xab253b];_0x2c193f['push'](insertAdditionalPhones(_0x16db6c));}}Promise[_0xe1d1('0x1f')](_0x2c193f)[_0xe1d1('0x1d')](function(){_0x176214({'val':0x1});});});});}function insertAdditionalPhones(_0x2fe357){return new Promise(function(_0x470805,_0x3fd4e7){var _0x5914fa=_0x2fe357[_0xe1d1('0x1c')];var _0x3046a9=_0x5914fa[_0xe1d1('0x20')](';');var _0x5a77b7=[];orderBy=0x0;for(var _0x10b584=0x0;_0x10b584<_0x3046a9[_0xe1d1('0x1e')];_0x10b584++){_0x5a77b7['push'](splitAdditionalPhone(_0x2fe357['id'],_0x3046a9[_0x10b584]));}Promise[_0xe1d1('0x1f')](_0x5a77b7)[_0xe1d1('0x1d')](function(){_0x470805({'val':_0x3046a9['length']});});});}function splitAdditionalPhone(_0xe575bc,_0x276440){return new Promise(function(_0x164af3,_0x25a263){var _0x34b925=_0x276440['split'](':');var _0x9ff9f0=_0x34b925[0x0];var _0x4929b0=_0x34b925[0x1];if(_0x4929b0!==''){var _0x5e39d2=_0x4929b0['split']('|');var _0x16c63e=[];for(var _0x57cc2c=0x0;_0x57cc2c<_0x5e39d2['length'];_0x57cc2c++){if(_0x5e39d2[_0x57cc2c]!==''){var _0x4193c8=_[_0xe1d1('0x21')](promisesAdditionalPhones,{'contactId':_0xe575bc,'phone':_0x5e39d2[_0x57cc2c]});if(_0x4193c8[_0xe1d1('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0xe1d1('0x22')]({'contactId':_0xe575bc,'contactTypeId':_0x9ff9f0,'phone':_0x5e39d2[_0x57cc2c],'orderBy':orderBy});}}}_0x164af3({'ok':0x1});}else _0x164af3({'res':0x0});});}function createAdditionalPhone(_0x267d89,_0x35af6c,_0x45eb05,_0x1836b6){return new Promise(function(_0x1f591d,_0x2b3515){return db[_0xe1d1('0x23')][_0xe1d1('0x24')]({'where':{'CmContactId':_0x267d89,'item':_0x45eb05}})[_0xe1d1('0x1d')](function(_0x2a6fc4){if(_0x2a6fc4){return db[_0xe1d1('0x23')][_0xe1d1('0x25')]({'ItemTypeId':_0x35af6c,'OrderBy':_0x1836b6},{'where':{'CmContactId':_0x267d89,'item':_0x45eb05}})[_0xe1d1('0x1d')](function(_0x4973bd){_0x1f591d({'res':_0xe1d1('0x26')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x267d89,'item':_0x45eb05,'ItemTypeId':_0x35af6c,'OrderBy':_0x1836b6,'ItemClass':_0xe1d1('0x27')})['then'](function(_0x25f7dc){_0x1f591d({'res':_0xe1d1('0x28')});});}});});}function insertCmHopper(_0xc82587,_0x494f0b,_0x17577c,_0xe76e77,_0x45547f){var _0x5d01ba=[_0xe1d1('0x29'),_0xe1d1('0x2a'),_0xe1d1('0x2b'),'cm_contacts.ListId',_0x494f0b+'.'+_0xe76e77,_0xe1d1('0x2c'),_0xe1d1('0x2d'),_0xe1d1('0x2e'),_0xe1d1('0x2f'),'\x22'+_0x45547f+'\x22'];return squel[_0xe1d1('0x30')]()[_0xe1d1('0x31')](_0xe1d1('0x32'))['fromQuery']([_0xe1d1('0x14'),_0xe1d1('0x33'),_0xe1d1('0x34'),_0xe1d1('0x35'),_0xe76e77,_0xe1d1('0x36'),_0xe1d1('0x37'),_0xe1d1('0x38'),_0xe1d1('0x39'),_0xe1d1('0x3a')],squel['select']()[_0xe1d1('0x3b')](_0x5d01ba)[_0xe1d1('0x15')](_0x494f0b)[_0xe1d1('0x16')](_0xe1d1('0x3c'),null,_0xe1d1('0x3d')+_0x494f0b+_0xe1d1('0x3e'))[_0xe1d1('0x16')](_0x17577c,null,_0x17577c+_0xe1d1('0x3f')+_0x494f0b+'.'+_0xe76e77)[_0xe1d1('0x18')](_0x494f0b+'.CmListId\x20=\x20?',_0xc82587)['where'](_0xe1d1('0x40'),NOW)[_0xe1d1('0x18')](_0xe1d1('0x41'),selectNotIn(_0x494f0b,_0x17577c,_0xe76e77,_0xe1d1('0x32'),[_0xe1d1('0x42'),_0xe1d1('0x43')]))[_0xe1d1('0x18')](_0xe1d1('0x41'),selectNotIn(_0x494f0b,_0x17577c,_0xe76e77,_0xe1d1('0x32'),[_0xe1d1('0x42')])))[_0xe1d1('0x44')]();}function insertCmHopperBlack(_0x47614d,_0x33eaba,_0x48a5f7,_0xce84){var _0x2aa308=[_0xe1d1('0x29'),_0xe1d1('0x2b'),_0xe1d1('0x45'),_0x33eaba+'.'+_0xce84,_0xe1d1('0x2c'),'cm_contacts.updatedAt'];return squel[_0xe1d1('0x30')]()[_0xe1d1('0x31')](_0xe1d1('0x46'))[_0xe1d1('0x47')](['phone',_0xe1d1('0x34'),_0xe1d1('0x35'),_0xce84,_0xe1d1('0x36'),_0xe1d1('0x37')],squel['select']()[_0xe1d1('0x3b')](_0x2aa308)[_0xe1d1('0x15')](_0x33eaba)[_0xe1d1('0x16')]('cm_contacts',null,_0xe1d1('0x3d')+_0x33eaba+_0xe1d1('0x3e'))['join'](_0x48a5f7,null,_0x48a5f7+_0xe1d1('0x3f')+_0x33eaba+'.'+_0xce84)[_0xe1d1('0x18')](_0x33eaba+_0xe1d1('0x48'),_0x47614d)[_0xe1d1('0x18')](_0xe1d1('0x40'),NOW)[_0xe1d1('0x18')](_0xe1d1('0x41'),squel[_0xe1d1('0x12')]()[_0xe1d1('0x13')](_0xe1d1('0x14'))['from'](_0xe1d1('0x46'))[_0xe1d1('0x18')](_0xe1d1('0x49'),_0x47614d)[_0xe1d1('0x18')](_0xce84+'\x20=\x20?',_0x33eaba+'.'+_0xce84)))[_0xe1d1('0x44')]();}function insertCmHopperAdditionalPhones(_0xe9a59a){var _0x4f0e6e=['cm_hopper.id',_0xe1d1('0x4a'),_0xe1d1('0x4b'),_0xe1d1('0x4c'),_0xe1d1('0x4d')];return squel[_0xe1d1('0x30')]()[_0xe1d1('0x31')](_0xe1d1('0x4e'))[_0xe1d1('0x47')]([_0xe1d1('0x4f'),_0xe1d1('0x14'),_0xe1d1('0x50'),_0xe1d1('0x36'),'updatedAt'],squel[_0xe1d1('0x12')]()[_0xe1d1('0x3b')](_0x4f0e6e)[_0xe1d1('0x15')]('cm_hopper')[_0xe1d1('0x16')](_0xe1d1('0x3c'),null,_0xe1d1('0x51'))['join'](_0xe1d1('0x52'),null,_0xe1d1('0x53'))[_0xe1d1('0x18')]('cm_hopper.ListId\x20=\x20?',_0xe9a59a)[_0xe1d1('0x18')](_0xe1d1('0x40'),NOW))[_0xe1d1('0x44')]();}function insertCmContact(_0x293dc6,_0x2b0f3f,_0x3f5adc,_0x1246ac){var _0xb17667=_[_0xe1d1('0x54')](_[_0xe1d1('0x55')](_0x1246ac),[_0xe1d1('0x35'),'CompanyId',_0xe1d1('0x36'),_0xe1d1('0x37')]);return squel[_0xe1d1('0x30')]()[_0xe1d1('0x31')]('cm_contacts')['fromQuery'](_0xb17667,squel['select']()[_0xe1d1('0x3b')](_0xb17667)[_0xe1d1('0x15')](_0x2b0f3f)[_0xe1d1('0x18')]('('+_0x3f5adc[_0xe1d1('0x16')](',')+_0xe1d1('0x56'),squel[_0xe1d1('0x12')]()['fields'](_0x3f5adc)[_0xe1d1('0x15')](_0xe1d1('0x3c'))['where']('ListId\x20=\x20?',_0x293dc6)[_0xe1d1('0x18')]('deletedAt\x20IS\x20NULL'))[_0xe1d1('0x18')]('id\x20IN\x20?',squel[_0xe1d1('0x12')]()['field'](_0xe1d1('0x57'),_0xe1d1('0x58'))[_0xe1d1('0x15')](_0x2b0f3f)[_0xe1d1('0x59')](_0x3f5adc[_0xe1d1('0x16')](','))))['toString']();}function handleStop(){logger[_0xe1d1('0x5a')](_0xe1d1('0x5b'));stopped=!![];}function handleUncaughtException(_0x22609a){logger[_0xe1d1('0x5c')](_0x22609a[_0xe1d1('0x5d')]);process['exit'](0x1);}function handleError(_0x1f3da6,_0x37645b){stats[_0xe1d1('0x5e')][_0xe1d1('0x22')]({'name':_0x37645b['code'],'message':_0x37645b[_0xe1d1('0x5d')],'row':_0x1f3da6});}function handleQuery(_0x588bdb){logger[_0xe1d1('0x5a')](_0x588bdb);return db[_0xe1d1('0x5f')]['query'](_0x588bdb)[_0xe1d1('0x60')](function(_0x1c6fa7){results[_0xe1d1('0x22')](_0x1c6fa7);})[_0xe1d1('0x61')](function(_0x4e0944){logger[_0xe1d1('0x5c')](_0x4e0944[_0xe1d1('0x5d')]);});}function main(_0x4a17dd,_0x1132c2,_0x4fb55e,_0x361d27){logger[_0xe1d1('0x5a')](_0xe1d1('0x62'),_0x4a17dd,JSON[_0xe1d1('0x63')](_0x1132c2));process['send'](_0xe1d1('0x64'));var _0x2772f6=_0x1132c2[_0xe1d1('0x65')];var _0x3e234b=_[_0xe1d1('0x66')](_0x2772f6);var _0xcaec55=_0x1132c2[_0xe1d1('0x67')];var _0x54d778=path[_0xe1d1('0x16')](config[_0xe1d1('0x68')],_0xe1d1('0x69'),_0xcaec55+_0xe1d1('0x6a'));logger['info'](_0xe1d1('0x6b'),_0x1132c2);db['ContactItemType'][_0xe1d1('0x1b')]({'raw':!![],'attributes':['id',_0xe1d1('0x6c')]})[_0xe1d1('0x1d')](function(_0x9023f1){for(var _0x3b5ddc=0x0;_0x3b5ddc<_0x9023f1['length'];_0x3b5ddc++){if(_0x9023f1[_0x3b5ddc][_0xe1d1('0x6c')]in _0x2772f6){contactItemTypes[_0xe1d1('0x22')](_0x9023f1[_0x3b5ddc]);delete _0x3e234b[_0x9023f1[_0x3b5ddc]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x3e234b[_0xe1d1('0x1c')]='';var _0x4811f5=_[_0xe1d1('0x55')](_0x3e234b)[_0xe1d1('0x16')]();logger[_0xe1d1('0x5a')](_0xe1d1('0x6d'),_0x4811f5);fs[_0xe1d1('0x6e')](_0x54d778,_0x4811f5+'\x0a');Papa[_0xe1d1('0x6f')](fs[_0xe1d1('0x70')](_0x4a17dd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x13e9b8,_0x232a4b){try{for(var _0x47e969=0x0,_0x17b3d6=[];_0x47e969<_0x13e9b8['data'][_0xe1d1('0x1e')];_0x47e969++){stats['rows']+=0x1;if(_0x13e9b8['errors'][_0x47e969]){handleError(_0x13e9b8[_0xe1d1('0x71')][_0x47e969],_0x13e9b8[_0xe1d1('0x5e')][_0x47e969]);}else{var _0x59120e=[];var _0x580c14=[];for(var _0x203982 in _0x2772f6){let _0x5e7727=contactItemTypes[_0xe1d1('0x72')](_0x57df3e=>_0x57df3e['name']===_0x203982);if(_[_0xe1d1('0x73')](_0x5e7727)){if(_0x2772f6[_0xe1d1('0x74')](_0x203982)){if(_0x13e9b8['data'][_0x47e969][_0x2772f6[_0x203982]]){var _0x4698b8=_['trim'](_0x13e9b8['data'][_0x47e969][_0x2772f6[_0x203982]][_0xe1d1('0x75')](/"/g,'\x27'));switch(_0x203982){case _0xe1d1('0x33'):var _0x18ce08=moment(_0x4698b8,_0xe1d1('0x10'),!![]);if(_0x18ce08[_0xe1d1('0x76')]()){_0x17b3d6[_0xe1d1('0x22')]('\x22'+_0x4698b8+'\x22');}else{_0x59120e[_0xe1d1('0x22')](_0xe1d1('0x77'));}break;case _0xe1d1('0x38'):var _0x28590c=parseInt(_0x4698b8);_0x4698b8=_[_0xe1d1('0x78')](_0x28590c)||_0x28590c<0x0||_0x28590c>0x4?_0x361d27?0x3:0x2:_0x28590c;_0x17b3d6[_0xe1d1('0x22')]('\x22'+_0x4698b8+'\x22');break;case _0xe1d1('0x39'):var _0x23b985=parseInt(_0x4698b8);if(_[_0xe1d1('0x79')](_0x23b985)&&_['includes'](_0x4fb55e,_0x23b985)){_0x17b3d6[_0xe1d1('0x22')]('\x22'+_0x23b985+'\x22');}else{_0x59120e[_0xe1d1('0x22')]('agent\x20not\x20exists');}break;case _0xe1d1('0x7a'):if(isEmail(_0x4698b8)){_0x17b3d6[_0xe1d1('0x22')]('\x22'+_0x4698b8+'\x22');}else{_0x59120e[_0xe1d1('0x22')](_0xe1d1('0x7b'));}break;case _0xe1d1('0x7c'):var _0x5d6296=moment(_0x4698b8,_0xe1d1('0x7d'),!![]);if(_0x5d6296['isValid']()){_0x17b3d6[_0xe1d1('0x22')]('\x22'+_0x4698b8+'\x22');}else{_0x59120e['push'](_0xe1d1('0x7e'));}break;default:_0x17b3d6[_0xe1d1('0x22')]('\x22'+_0x4698b8+'\x22');}}else{switch(_0x203982){case _0xe1d1('0x7f'):case _0xe1d1('0x14'):_0x59120e[_0xe1d1('0x22')](_0x203982+_0xe1d1('0x80'));break;default:_0x17b3d6[_0xe1d1('0x22')]('\x22\x22');}}}}else{var _0x2bfd75='';for(var _0x370c48=0x0;_0x370c48<_0x2772f6[_0x203982][_0xe1d1('0x1e')];_0x370c48++){var _0x4698b8=_[_0xe1d1('0x81')](_0x13e9b8[_0xe1d1('0x71')][_0x47e969][_0x2772f6[_0x203982][_0x370c48]][_0xe1d1('0x75')](/"/g,'\x27'));if(_0x2bfd75=='')_0x2bfd75=_0x4698b8;else _0x2bfd75+='|'+_0x4698b8;}_0x580c14['push'](_0x5e7727['id']+':'+_0x2bfd75);}}if(hasAdditionalPhones){_0x17b3d6[_0xe1d1('0x22')]('\x22'+_0x580c14[_0xe1d1('0x16')](';')+'\x22');}if(_0x59120e[_0xe1d1('0x1e')]){handleError(_0x13e9b8['data'][_0x47e969],{'code':_0xe1d1('0x82'),'message':_0x59120e[_0xe1d1('0x16')]()});}else{fs[_0xe1d1('0x83')](_0x54d778,_0x17b3d6['join']()+'\x0a');}_0x17b3d6=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xe1d1('0x84')+_0xcaec55,stats);stats[_0xe1d1('0x5e')]=[];}}if(stopped){logger[_0xe1d1('0x5a')](_0xe1d1('0x85'));_0x232a4b[_0xe1d1('0x86')]();}}catch(_0x20a291){handleError(_0x13e9b8[_0xe1d1('0x71')][_0x47e969],{'code':_0xe1d1('0x87'),'message':_0x20a291[_0xe1d1('0x5d')]});logger[_0xe1d1('0x5c')](_0xe1d1('0x88'),_0x20a291[_0xe1d1('0x5d')]);}},'complete':function(){try{var _0x59785e=[];var _0x4b5ae2=_0xe1d1('0x3c');if(_0x1132c2['duplicates']&&_0x1132c2[_0xe1d1('0x89')][_0xe1d1('0x1e')]){_0x4b5ae2=_0xe1d1('0x8a')+_0xcaec55;_0x59785e[_0xe1d1('0x22')]('CREATE\x20TABLE\x20'+_0x4b5ae2+_0xe1d1('0x8b'));}logger[_0xe1d1('0x5a')](_0xe1d1('0x8c'),contactItemTypes[_0xe1d1('0x1e')]);var _0xbf042=util[_0xe1d1('0xf')]('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',_0x54d778,_0x4b5ae2,_0x4811f5,_0x1132c2[_0xe1d1('0x35')],_0x1132c2['CompanyId']||null,NOW,NOW);if(_[_0xe1d1('0x73')](_0x2772f6[_0xe1d1('0x33')])){_0xbf042+=_0xe1d1('0x8d');}_0x59785e['push'](_0xbf042);if(_0x1132c2[_0xe1d1('0x89')]&&_0x1132c2[_0xe1d1('0x89')][_0xe1d1('0x1e')]){_0x59785e['push'](insertCmContact(_0x1132c2[_0xe1d1('0x35')],_0x4b5ae2,_0x1132c2[_0xe1d1('0x89')],_0x2772f6));_0x59785e[_0xe1d1('0x22')](_0xe1d1('0x8e')+_0x4b5ae2+';');}BPromise[_0xe1d1('0x8f')](_0x59785e,handleQuery)[_0xe1d1('0x1d')](function(_0x3a4d84){BPromise[_0xe1d1('0x1f')]([handleAdditionalPhones()])[_0xe1d1('0x1d')](function(){_0x59785e=[];for(var _0x53c1f1=0x0;_0x53c1f1_0x449619[_0x6c82('0x68')]===_0x343bb4);if(_[_0x6c82('0x6e')](_0x15c5bd)){if(_0x4708ce[_0x6c82('0x6f')](_0x343bb4)){if(_0x17c971[_0x6c82('0x70')][_0x184b03][_0x4708ce[_0x343bb4]]){var _0x3b8e86=_[_0x6c82('0x71')](_0x17c971[_0x6c82('0x70')][_0x184b03][_0x4708ce[_0x343bb4]][_0x6c82('0x72')](/"/g,'\x27'));switch(_0x343bb4){case _0x6c82('0x2c'):var _0x26c757=moment(_0x3b8e86,_0x6c82('0xc'),!![]);if(_0x26c757[_0x6c82('0x73')]()){_0x1242d4[_0x6c82('0x17')]('\x22'+_0x3b8e86+'\x22');}else{_0x43c0b8['push'](_0x6c82('0x74'));}break;case _0x6c82('0x30'):var _0x4bd73c=parseInt(_0x3b8e86);_0x3b8e86=_[_0x6c82('0x75')](_0x4bd73c)||_0x4bd73c<0x0||_0x4bd73c>0x4?_0x196adc?0x3:0x2:_0x4bd73c;_0x1242d4['push']('\x22'+_0x3b8e86+'\x22');break;case _0x6c82('0x31'):var _0x11883e=parseInt(_0x3b8e86);if(_[_0x6c82('0x76')](_0x11883e)&&_[_0x6c82('0x77')](_0x311662,_0x11883e)){_0x1242d4[_0x6c82('0x17')]('\x22'+_0x11883e+'\x22');}else{_0x43c0b8[_0x6c82('0x17')](_0x6c82('0x78'));}break;case _0x6c82('0x79'):if(isEmail(_0x3b8e86)){_0x1242d4[_0x6c82('0x17')]('\x22'+_0x3b8e86+'\x22');}else{_0x43c0b8['push'](_0x6c82('0x7a'));}break;case _0x6c82('0x7b'):var _0x2f9c40=moment(_0x3b8e86,_0x6c82('0x7c'),!![]);if(_0x2f9c40[_0x6c82('0x73')]()){_0x1242d4[_0x6c82('0x17')]('\x22'+_0x3b8e86+'\x22');}else{_0x43c0b8[_0x6c82('0x17')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1242d4[_0x6c82('0x17')]('\x22'+_0x3b8e86+'\x22');}}else{switch(_0x343bb4){case _0x6c82('0x7d'):case _0x6c82('0xf'):_0x43c0b8['push'](_0x343bb4+_0x6c82('0x7e'));break;default:_0x1242d4['push']('\x22\x22');}}}}else{var _0x59b200='';for(var _0x26b2ab=0x0;_0x26b2ab<_0x4708ce[_0x343bb4][_0x6c82('0x1b')];_0x26b2ab++){var _0x3b8e86=_['trim'](_0x17c971['data'][_0x184b03][_0x4708ce[_0x343bb4][_0x26b2ab]]['replace'](/"/g,'\x27'));if(_0x59b200=='')_0x59b200=_0x3b8e86;else _0x59b200+='|'+_0x3b8e86;}_0x3c69e1[_0x6c82('0x17')](_0x15c5bd['id']+':'+_0x59b200);}}if(hasAdditionalPhones){_0x1242d4['push']('\x22'+_0x3c69e1[_0x6c82('0x11')](';')+'\x22');}if(_0x43c0b8[_0x6c82('0x1b')]){handleError(_0x17c971['data'][_0x184b03],{'code':'SystemRow','message':_0x43c0b8[_0x6c82('0x11')]()});}else{fs['appendFileSync'](_0x36fd94,_0x1242d4[_0x6c82('0x11')]()+'\x0a');}_0x1242d4=[];}if(!(stats[_0x6c82('0x6c')]%0xc8)){socket[_0x6c82('0x7f')]('contact:import:'+_0x349055,stats);stats[_0x6c82('0x57')]=[];}}if(stopped){logger[_0x6c82('0x58')](_0x6c82('0x80'));_0x47d613['abort']();}}catch(_0x266e66){handleError(_0x17c971[_0x6c82('0x70')][_0x184b03],{'code':_0x6c82('0x81'),'message':_0x266e66['message']});logger['error'](_0x6c82('0x82'),_0x266e66[_0x6c82('0x5e')]);}},'complete':function(){try{var _0x178088=[];var _0x49e37d=_0x6c82('0x34');if(_0x1aaaee[_0x6c82('0x83')]&&_0x1aaaee[_0x6c82('0x83')][_0x6c82('0x1b')]){_0x49e37d='cm_contacts_'+_0x349055;_0x178088[_0x6c82('0x17')]('CREATE\x20TABLE\x20'+_0x49e37d+_0x6c82('0x84'));}logger[_0x6c82('0x58')]('CIS\x20len',contactItemTypes[_0x6c82('0x1b')]);var _0x46ded9=util[_0x6c82('0xb')](_0x6c82('0x85'),_0x36fd94,_0x49e37d,_0x2e72ea,_0x1aaaee[_0x6c82('0x2e')],_0x1aaaee[_0x6c82('0x4e')]||null,NOW,NOW);if(_[_0x6c82('0x6e')](_0x4708ce[_0x6c82('0x2c')])){_0x46ded9+=_0x6c82('0x86');}_0x178088[_0x6c82('0x17')](_0x46ded9);if(_0x1aaaee[_0x6c82('0x83')]&&_0x1aaaee[_0x6c82('0x83')][_0x6c82('0x1b')]){_0x178088[_0x6c82('0x17')](insertCmContact(_0x1aaaee[_0x6c82('0x2e')],_0x49e37d,_0x1aaaee[_0x6c82('0x83')],_0x4708ce));_0x178088['push'](_0x6c82('0x87')+_0x49e37d+';');}BPromise[_0x6c82('0x88')](_0x178088,handleQuery)[_0x6c82('0x19')](function(_0x40390b){BPromise[_0x6c82('0x18')]([handleAdditionalPhones()])['then'](function(){_0x178088=[];for(var _0x38e5b0=0x0;_0x38e5b0\x20\x20');}var _0xed974b=path['join'](config['root'],_0x6c82('0x97'),process[_0x6c82('0x96')][0x2]);if(!fs[_0x6c82('0x98')](_0xed974b)){throw new Error(_0x6c82('0x99'));}var _0xf3fe0={};try{_0xf3fe0=JSON[_0x6c82('0x6b')](process[_0x6c82('0x96')][0x3]);if(!_0xf3fe0[_0x6c82('0x62')]){throw new Error(_0x6c82('0x9a'));}if(!_0xf3fe0[_0x6c82('0x62')][_0x6c82('0xf')]){throw new Error('phone\x20is\x20mandatory');}if(!_0xf3fe0[_0x6c82('0x62')][_0x6c82('0x7d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3cdf48=0x0;if(_0xf3fe0[_0x6c82('0x62')]['UserId']){_0x3cdf48=0x1;}if(!_0xf3fe0['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x2675dc){throw new Error(_0x6c82('0x9b'));}var _0x22b5e6=[];try{_0x22b5e6=_[_0x6c82('0x9c')](JSON[_0x6c82('0x6b')](process[_0x6c82('0x96')][0x4]),'id');}catch(_0x219cb2){logger[_0x6c82('0x58')](_0x6c82('0x9d'));}main(_0xed974b,_0xf3fe0,_0x22b5e6,_0x3cdf48);}validate();process['on'](_0x6c82('0x9e'),handleStop);process['on'](_0x6c82('0x9f'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index f713d6c..02b2bb8 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 _0x68f8=['ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','exit','code','info','main','send','start','binding','clone','server/files/tmp','.csv','body','ContactItemType','name','AdditionalPhones','writeFileSync','parse','errors','data','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','all','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','field','phone','from','join','\x20=\x20','where','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','then','catch','error','message','split','filter','findOne','CmContactHasItem','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','insert','cm_hopper_black','updatedAt'];(function(_0x5af587,_0x3a7377){var _0x14d879=function(_0x24f9b6){while(--_0x24f9b6){_0x5af587['push'](_0x5af587['shift']());}};_0x14d879(++_0x3a7377);}(_0x68f8,0x17f));var _0x868f=function(_0x416f83,_0x448f3a){_0x416f83=_0x416f83-0x0;var _0x463967=_0x68f8[_0x416f83];return _0x463967;};'use strict';var fs=require('fs');var path=require(_0x868f('0x0'));var _=require('lodash');var Papa=require(_0x868f('0x1'));var util=require(_0x868f('0x2'));var BPromise=require(_0x868f('0x3'));var moment=require(_0x868f('0x4'));var squel=require(_0x868f('0x5'));var Redis=require(_0x868f('0x6'));var db=require(_0x868f('0x7'))['db'];var config=require(_0x868f('0x8'));var logger=require(_0x868f('0x9'))(_0x868f('0xa'));config[_0x868f('0xb')]=_['defaults'](config[_0x868f('0xb')],{'host':_0x868f('0xc'),'port':0x18eb});var socket=require(_0x868f('0xd'))(new Redis(config[_0x868f('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x868f('0xe'));var tempTableName='cm_contacts_temp_'+moment()[_0x868f('0xf')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x21573c){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))*$/[_0x868f('0x10')](_0x21573c);}function selectNotIn(_0xa20d71,_0x1c57c5,_0x4a3c91,_0x200132,_0xcf7981){return squel['select']()[_0x868f('0x11')](_0x868f('0x12'))[_0x868f('0x13')](_0x200132)[_0x868f('0x14')](_0x1c57c5,null,_0x1c57c5+'.id\x20=\x20'+_0x200132+'.'+_0x4a3c91)['where'](_0x200132+'.'+_0x4a3c91+_0x868f('0x15')+_0xa20d71+'.'+_0x4a3c91)[_0x868f('0x16')](_0x1c57c5+'.dialCheckDuplicateType\x20IN\x20('+_0xcf7981[_0x868f('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x351c0d,_0x4c47fe){promisesAdditionalPhones=[];promisesContact=[];return db[_0x868f('0x17')][_0x868f('0x18')](_0x868f('0x19')+tempTableName)[_0x868f('0x1a')](function(_0x3ac559){if(_0x3ac559!==null){var _0x333c8b=[];for(var _0x58f787=0x0;_0x58f787<_0x3ac559[_0x868f('0x1b')];_0x58f787++){var _0x3acbe0=_0x3ac559[_0x58f787];if(!_[_0x868f('0x1c')](_0x3acbe0[_0x868f('0x12')])){if(!_[_0x868f('0x1c')](_0x3acbe0['AdditionalPhones']))_0x333c8b[_0x868f('0x1d')](insertAdditionalPhones(_0x3acbe0));promisesContact[_0x868f('0x1d')]({'contact':_0x3acbe0});}}}Promise['all'](_0x333c8b)[_0x868f('0x1e')](function(){_0x351c0d({'val':0x1});});})[_0x868f('0x1f')](function(_0x40e35d){logger[_0x868f('0x20')](_0x40e35d[_0x868f('0x21')]);});});}function insertAdditionalPhones(_0x58f440){return new Promise(function(_0x20639f,_0x21fc7e){var _0x361237=_0x58f440['AdditionalPhones'];if(_[_0x868f('0x1c')](_0x361237))_0x21fc7e({'val':0x0});else{var _0x46ac35=_0x361237['split'](';');var _0x2c78f5=[];orderBy=0x0;for(var _0x113475=0x0;_0x113475<_0x46ac35['length'];_0x113475++){_0x2c78f5[_0x868f('0x1d')](splitAdditionalPhone(_0x58f440['id'],_0x46ac35[_0x113475]));}Promise['all'](_0x2c78f5)[_0x868f('0x1e')](function(){_0x20639f({'val':_0x46ac35[_0x868f('0x1b')]});});}});}function splitAdditionalPhone(_0x2f0ff7,_0x395142){return new Promise(function(_0x3633e6,_0x1cff6b){var _0x1d3a15=_0x395142[_0x868f('0x22')](':');var _0x4c2987=_0x1d3a15[0x0];var _0x3e7460=_0x1d3a15[0x1];if(_0x3e7460!==''){var _0x38aeb5=_0x3e7460[_0x868f('0x22')]('|');var _0x32c180=[];for(var _0x487b87=0x0;_0x487b87<_0x38aeb5[_0x868f('0x1b')];_0x487b87++){if(_0x38aeb5[_0x487b87]!==''){var _0x16973e=_[_0x868f('0x23')](promisesAdditionalPhones,{'contactId':_0x2f0ff7,'phone':_0x38aeb5[_0x487b87]});if(_0x16973e[_0x868f('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x868f('0x1d')]({'contactId':_0x2f0ff7,'contactTypeId':_0x4c2987,'phone':_0x38aeb5[_0x487b87],'orderBy':orderBy});}}}_0x3633e6({'ok':0x1});}else _0x3633e6({'res':0x0});});}function createAdditionalPhone(_0x5a7a8a,_0x1ba98e,_0x31751e,_0x197ba5){return new Promise(function(_0x5d99ef,_0x5c1204){return db['CmContactHasItem'][_0x868f('0x24')]({'where':{'CmContactId':_0x5a7a8a,'item':_0x31751e}})[_0x868f('0x1e')](function(_0x58d02a){if(_0x58d02a){return db[_0x868f('0x25')][_0x868f('0x26')]({'ItemTypeId':_0x1ba98e,'OrderBy':_0x197ba5},{'where':{'CmContactId':_0x5a7a8a,'item':_0x31751e}})[_0x868f('0x1e')](function(_0x5cb97e){_0x5d99ef({'res':_0x868f('0x27')});});}else{return db['CmContactHasItem'][_0x868f('0x28')]({'CmContactId':_0x5a7a8a,'item':_0x31751e,'ItemTypeId':_0x1ba98e,'OrderBy':_0x197ba5,'ItemClass':'PHONE'})[_0x868f('0x1e')](function(_0x26cd93){_0x5d99ef({'res':_0x868f('0x29')});});}});});}function updateContact(_0x44a2d4){return new Promise(function(_0x2e5e2e,_0x11b65b){var _0x38dc54=_0x44a2d4['id'];delete _0x44a2d4['id'];return db[_0x868f('0x2a')][_0x868f('0x26')](_0x44a2d4,{'where':{'id':_0x38dc54}})[_0x868f('0x1e')](function(_0x37ef63){updatedRows+=0x1;return db[_0x868f('0x2b')][_0x868f('0x26')]({'phone':_0x44a2d4[_0x868f('0x12')]},{'where':{'ContactId':_0x38dc54}})[_0x868f('0x1e')](function(_0x17f245){_0x2e5e2e({'ret':'OK'});});});});}function insertCmHopper(_0x159e4e,_0x5d995b,_0x1904ea,_0x499a79,_0x3c6438){var _0x47bc20=[_0x868f('0x2c'),_0x868f('0x2d'),'cm_contacts.id',_0x868f('0x2e'),_0x5d995b+'.'+_0x499a79,_0x868f('0x2f'),'cm_contacts.updatedAt',_0x868f('0x30'),'cm_contacts.UserId','\x22'+_0x3c6438+'\x22'];return squel['insert']()[_0x868f('0x31')](_0x868f('0x32'))[_0x868f('0x33')](['phone',_0x868f('0x34'),_0x868f('0x35'),_0x868f('0x36'),_0x499a79,_0x868f('0x37'),'updatedAt','priority',_0x868f('0x38'),_0x868f('0x39')],squel[_0x868f('0x3a')]()[_0x868f('0x3b')](_0x47bc20)['from'](_0x5d995b)[_0x868f('0x14')](_0x868f('0x3c'),null,_0x868f('0x3d')+_0x5d995b+_0x868f('0x3e'))[_0x868f('0x14')](_0x1904ea,null,_0x1904ea+_0x868f('0x3f')+_0x5d995b+'.'+_0x499a79)[_0x868f('0x16')](_0x5d995b+_0x868f('0x40'),_0x159e4e)[_0x868f('0x16')](_0x868f('0x41'),NOW)[_0x868f('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5d995b,_0x1904ea,_0x499a79,_0x868f('0x32'),[_0x868f('0x42'),'\x22onlyIfOpen\x22']))[_0x868f('0x16')](_0x868f('0x43'),selectNotIn(_0x5d995b,_0x1904ea,_0x499a79,'cm_hopper',[_0x868f('0x42')])))[_0x868f('0x44')]();}function insertCmHopperBlack(_0x2301af,_0x53060e,_0x495302,_0x1dd251){var _0x797011=[_0x868f('0x2c'),_0x868f('0x45'),_0x868f('0x2e'),_0x53060e+'.'+_0x1dd251,_0x868f('0x2f'),'cm_contacts.updatedAt'];return squel[_0x868f('0x46')]()[_0x868f('0x31')](_0x868f('0x47'))[_0x868f('0x33')]([_0x868f('0x12'),'ContactId','ListId',_0x1dd251,_0x868f('0x37'),_0x868f('0x48')],squel[_0x868f('0x3a')]()['fields'](_0x797011)[_0x868f('0x13')](_0x53060e)[_0x868f('0x14')](_0x868f('0x3c'),null,_0x868f('0x3d')+_0x53060e+_0x868f('0x3e'))[_0x868f('0x14')](_0x495302,null,_0x495302+_0x868f('0x3f')+_0x53060e+'.'+_0x1dd251)[_0x868f('0x16')](_0x53060e+_0x868f('0x40'),_0x2301af)[_0x868f('0x16')](_0x868f('0x41'),NOW)[_0x868f('0x16')](_0x868f('0x43'),squel[_0x868f('0x3a')]()[_0x868f('0x11')]('phone')[_0x868f('0x13')](_0x868f('0x47'))[_0x868f('0x16')](_0x868f('0x49'),_0x2301af)['where'](_0x1dd251+_0x868f('0x4a'),_0x53060e+'.'+_0x1dd251)))['toString']();}function insertCmHopperAdditionalPhones(_0x1339e1){var _0x107859=['cm_hopper.id',_0x868f('0x4b'),_0x868f('0x4c'),'cm_contact_has_items.createdAt',_0x868f('0x4d')];return squel[_0x868f('0x46')]()[_0x868f('0x31')]('cm_hopper_additional_phones')[_0x868f('0x33')]([_0x868f('0x4e'),'phone',_0x868f('0x4f'),_0x868f('0x37'),'updatedAt'],squel[_0x868f('0x3a')]()[_0x868f('0x3b')](_0x107859)[_0x868f('0x13')](_0x868f('0x32'))[_0x868f('0x14')](_0x868f('0x3c'),null,_0x868f('0x50'))[_0x868f('0x14')]('cm_contact_has_items',null,_0x868f('0x51'))['where'](_0x868f('0x52'),_0x1339e1)[_0x868f('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x868f('0x44')]();}function insertCmContact(_0x1eff7b,_0x38f32e,_0x175e2e,_0x2d9a1c){var _0x1bbe4d=_[_0x868f('0x53')](_[_0x868f('0x54')](_0x2d9a1c),[_0x868f('0x36'),'CompanyId',_0x868f('0x37'),_0x868f('0x48')]);return squel[_0x868f('0x46')]()[_0x868f('0x31')](_0x868f('0x3c'))['fromQuery'](_0x1bbe4d,squel[_0x868f('0x3a')]()[_0x868f('0x3b')](_0x1bbe4d)[_0x868f('0x13')](_0x38f32e)['where']('('+_0x175e2e[_0x868f('0x14')](',')+_0x868f('0x55'),squel['select']()[_0x868f('0x3b')](_0x175e2e)[_0x868f('0x13')](_0x868f('0x3c'))[_0x868f('0x16')](_0x868f('0x49'),_0x1eff7b))[_0x868f('0x16')](_0x868f('0x56'),squel[_0x868f('0x3a')]()[_0x868f('0x11')](_0x868f('0x57'),_0x868f('0x58'))[_0x868f('0x13')](_0x38f32e)[_0x868f('0x59')](_0x175e2e[_0x868f('0x14')](','))))[_0x868f('0x44')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x291f8f){logger[_0x868f('0x20')](_0x291f8f[_0x868f('0x21')]);process[_0x868f('0x5a')](0x1);}function handleError(_0x39a8c6,_0x1d972d){stats['errors'][_0x868f('0x1d')]({'name':_0x1d972d[_0x868f('0x5b')],'message':_0x1d972d[_0x868f('0x21')],'row':_0x39a8c6});}function handleQuery(_0x163056){logger[_0x868f('0x5c')](_0x163056);return db['sequelize']['query'](_0x163056)[_0x868f('0x1a')](function(_0x3e57d6){results[_0x868f('0x1d')](_0x3e57d6);})[_0x868f('0x1f')](function(_0x539eb6){logger['error'](_0x539eb6[_0x868f('0x21')]);});}function main(_0x125699,_0x2786aa,_0x4495d9,_0x1f888b){logger['info'](_0x868f('0x5d'),_0x125699,JSON['stringify'](_0x2786aa));process[_0x868f('0x5e')](_0x868f('0x5f'));var _0x454e07=_0x2786aa[_0x868f('0x60')];var _0x495e5e=_[_0x868f('0x61')](_0x454e07);var _0x39338e=_0x2786aa['socket_timestamp'];var _0x42a22e=path[_0x868f('0x14')](config['root'],_0x868f('0x62'),_0x39338e+_0x868f('0x63'));logger[_0x868f('0x5c')](_0x868f('0x64'),_0x2786aa);db[_0x868f('0x65')]['findAll']({'raw':!![],'attributes':['id',_0x868f('0x66')]})[_0x868f('0x1e')](function(_0x53aa9c){for(var _0xb6f8c7=0x0;_0xb6f8c7<_0x53aa9c[_0x868f('0x1b')];_0xb6f8c7++){if(_0x53aa9c[_0xb6f8c7][_0x868f('0x66')]in _0x454e07){contactItemTypes['push'](_0x53aa9c[_0xb6f8c7]);delete _0x495e5e[_0x53aa9c[_0xb6f8c7][_0x868f('0x66')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x495e5e[_0x868f('0x67')]='';var _0x3f2581=_[_0x868f('0x54')](_0x495e5e)[_0x868f('0x14')]();logger[_0x868f('0x5c')]('header',_0x3f2581);fs[_0x868f('0x68')](_0x42a22e,_0x3f2581+'\x0a');Papa[_0x868f('0x69')](fs['createReadStream'](_0x125699),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58d519,_0x539e2f){try{for(var _0xfbd75f=0x0,_0x48de58=[];_0xfbd75f<_0x58d519['data']['length'];_0xfbd75f++){stats['rows']+=0x1;if(_0x58d519[_0x868f('0x6a')][_0xfbd75f]){handleError(_0x58d519[_0x868f('0x6b')][_0xfbd75f],_0x58d519['errors'][_0xfbd75f]);}else{var _0x54525c=[];var _0x2d24fd=[];for(var _0x48c61f in _0x454e07){let _0x133154=contactItemTypes['find'](_0x42cbdc=>_0x42cbdc['name']===_0x48c61f);if(_['isNil'](_0x133154)){if(_0x454e07[_0x868f('0x6c')](_0x48c61f)){if(_0x58d519[_0x868f('0x6b')][_0xfbd75f][_0x454e07[_0x48c61f]]){var _0x112f2d=_[_0x868f('0x6d')](_0x58d519[_0x868f('0x6b')][_0xfbd75f][_0x454e07[_0x48c61f]][_0x868f('0x6e')](/"/g,'\x27'));switch(_0x48c61f){case _0x868f('0x34'):var _0x55382e=moment(_0x112f2d,_0x868f('0xe'),!![]);if(_0x55382e[_0x868f('0x6f')]()){_0x48de58[_0x868f('0x1d')]('\x22'+_0x112f2d+'\x22');}else{_0x54525c[_0x868f('0x1d')](_0x868f('0x70'));}break;case _0x868f('0x71'):var _0x1c44fd=parseInt(_0x112f2d);_0x112f2d=_[_0x868f('0x72')](_0x1c44fd)||_0x1c44fd<0x0||_0x1c44fd>0x4?_0x1f888b?0x3:0x2:_0x1c44fd;_0x48de58[_0x868f('0x1d')]('\x22'+_0x112f2d+'\x22');break;case'UserId':var _0x5a97ae=parseInt(_0x112f2d);if(_[_0x868f('0x73')](_0x5a97ae)&&_['includes'](_0x4495d9,_0x5a97ae)){_0x48de58['push']('\x22'+_0x5a97ae+'\x22');}else{_0x54525c[_0x868f('0x1d')](_0x868f('0x74'));}break;case _0x868f('0x75'):if(isEmail(_0x112f2d)){_0x48de58[_0x868f('0x1d')]('\x22'+_0x112f2d+'\x22');}else{_0x54525c[_0x868f('0x1d')]('email\x20wrong\x20format');}break;case _0x868f('0x76'):var _0x27e2dd=moment(_0x112f2d,_0x868f('0x77'),!![]);if(_0x27e2dd['isValid']()){_0x48de58[_0x868f('0x1d')]('\x22'+_0x112f2d+'\x22');}else{_0x54525c[_0x868f('0x1d')](_0x868f('0x78'));}break;default:_0x48de58[_0x868f('0x1d')]('\x22'+_0x112f2d+'\x22');}}else{switch(_0x48c61f){case _0x868f('0x79'):case _0x868f('0x12'):_0x54525c[_0x868f('0x1d')](_0x48c61f+'\x20not\x20specified');break;default:_0x48de58[_0x868f('0x1d')]('\x22\x22');}}}}else{var _0x371619='';for(var _0x4a12b3=0x0;_0x4a12b3<_0x454e07[_0x48c61f][_0x868f('0x1b')];_0x4a12b3++){var _0x112f2d=_['trim'](_0x58d519[_0x868f('0x6b')][_0xfbd75f][_0x454e07[_0x48c61f][_0x4a12b3]][_0x868f('0x6e')](/"/g,'\x27'));if(_0x371619=='')_0x371619=_0x112f2d;else _0x371619+='|'+_0x112f2d;}_0x2d24fd[_0x868f('0x1d')](_0x133154['id']+':'+_0x371619);}}if(hasAdditionalPhones){_0x48de58[_0x868f('0x1d')]('\x22'+_0x2d24fd[_0x868f('0x14')](';')+'\x22');}if(_0x54525c[_0x868f('0x1b')]){handleError(_0x58d519[_0x868f('0x6b')][_0xfbd75f],{'code':'SystemRow','message':_0x54525c[_0x868f('0x14')]()});}else{fs[_0x868f('0x7a')](_0x42a22e,_0x48de58['join']()+'\x0a');}_0x48de58=[];}if(!(stats[_0x868f('0x7b')]%0xc8)){socket[_0x868f('0x7c')](_0x868f('0x7d')+_0x39338e,stats);stats[_0x868f('0x6a')]=[];}}if(stopped){logger[_0x868f('0x5c')](_0x868f('0x7e'));_0x539e2f[_0x868f('0x7f')]();}}catch(_0x165203){handleError(_0x58d519[_0x868f('0x6b')][_0xfbd75f],{'code':_0x868f('0x80'),'message':_0x165203[_0x868f('0x21')]});logger[_0x868f('0x20')](_0x868f('0x81'),_0x165203[_0x868f('0x21')]);}},'complete':function(){try{var _0xecd678=[];var _0x3fb388=tempTableName;_0xecd678['push'](_0x868f('0x82')+_0x3fb388+_0x868f('0x83'));logger[_0x868f('0x5c')](_0x868f('0x84'),contactItemTypes[_0x868f('0x1b')]);var _0x362d5=util['format'](_0x868f('0x85'),_0x42a22e,_0x3fb388,_0x3f2581,_0x2786aa[_0x868f('0x36')],_0x2786aa['CompanyId']||null,NOW,NOW);if(_[_0x868f('0x1c')](_0x454e07['scheduledat'])){_0x362d5+=_0x868f('0x86');}_0xecd678[_0x868f('0x1d')](_0x362d5);BPromise[_0x868f('0x87')](_0xecd678,handleQuery)[_0x868f('0x1e')](function(_0xdd8749){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0xecd678=[];for(var _0x5496e4=0x0;_0x5496e4\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','then','error','message','split','all','length','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','priority','recallme','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.updatedAt','cm_hopper_black','ListId','fields','cm_contacts','.CmListId','field','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','catch','main','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','header','writeFileSync','parse','createReadStream','data','find','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x583d,0x164));var _0xd583=function(_0x128d8e,_0xdf3c7b){_0x128d8e=_0x128d8e-0x0;var _0x5a1306=_0x583d[_0x128d8e];return _0x5a1306;};'use strict';var fs=require('fs');var path=require(_0xd583('0x0'));var _=require('lodash');var Papa=require(_0xd583('0x1'));var util=require(_0xd583('0x2'));var BPromise=require(_0xd583('0x3'));var moment=require(_0xd583('0x4'));var squel=require(_0xd583('0x5'));var Redis=require(_0xd583('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xd583('0x7'));var logger=require(_0xd583('0x8'))('import');config['redis']=_[_0xd583('0x9')](config[_0xd583('0xa')],{'host':_0xd583('0xb'),'port':0x18eb});var socket=require(_0xd583('0xc'))(new Redis(config[_0xd583('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xd583('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xd583('0xe')+moment()[_0xd583('0xd')](_0xd583('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x500e4c){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))*$/[_0xd583('0x10')](_0x500e4c);}function selectNotIn(_0x2faa5e,_0x3c1d25,_0x13ba22,_0x26adb9,_0x13828b){return squel[_0xd583('0x11')]()['field'](_0xd583('0x12'))[_0xd583('0x13')](_0x26adb9)[_0xd583('0x14')](_0x3c1d25,null,_0x3c1d25+_0xd583('0x15')+_0x26adb9+'.'+_0x13ba22)['where'](_0x26adb9+'.'+_0x13ba22+_0xd583('0x16')+_0x2faa5e+'.'+_0x13ba22)[_0xd583('0x17')](_0x3c1d25+_0xd583('0x18')+_0x13828b[_0xd583('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5283df,_0x24cb83){promisesAdditionalPhones=[];promisesContact=[];return db[_0xd583('0x19')][_0xd583('0x1a')](_0xd583('0x1b')+tempTableName)[_0xd583('0x1c')](function(_0x2c1c18){if(_0x2c1c18!==null){var _0x5c8679=[];for(var _0x31918c=0x0;_0x31918c<_0x2c1c18['length'];_0x31918c++){var _0x534c03=_0x2c1c18[_0x31918c];if(!_[_0xd583('0x1d')](_0x534c03['phone'])){if(!_[_0xd583('0x1d')](_0x534c03[_0xd583('0x1e')]))_0x5c8679[_0xd583('0x1f')](insertAdditionalPhones(_0x534c03));promisesContact[_0xd583('0x1f')]({'contact':_0x534c03});}}}Promise['all'](_0x5c8679)[_0xd583('0x20')](function(){_0x5283df({'val':0x1});});})['catch'](function(_0x147876){logger[_0xd583('0x21')](_0x147876[_0xd583('0x22')]);});});}function insertAdditionalPhones(_0x1b3302){return new Promise(function(_0x42ff7e,_0x4db3ed){var _0x257e7d=_0x1b3302['AdditionalPhones'];if(_['isNil'](_0x257e7d))_0x4db3ed({'val':0x0});else{var _0x110612=_0x257e7d[_0xd583('0x23')](';');var _0x35264d=[];orderBy=0x0;for(var _0x84ad11=0x0;_0x84ad11<_0x110612['length'];_0x84ad11++){_0x35264d[_0xd583('0x1f')](splitAdditionalPhone(_0x1b3302['id'],_0x110612[_0x84ad11]));}Promise[_0xd583('0x24')](_0x35264d)[_0xd583('0x20')](function(){_0x42ff7e({'val':_0x110612[_0xd583('0x25')]});});}});}function splitAdditionalPhone(_0x394226,_0x2f6466){return new Promise(function(_0x31c48f,_0x47c7b3){var _0x55fa9a=_0x2f6466['split'](':');var _0xfa2641=_0x55fa9a[0x0];var _0xb1a0a2=_0x55fa9a[0x1];if(_0xb1a0a2!==''){var _0x20cb66=_0xb1a0a2[_0xd583('0x23')]('|');var _0x2c0a6f=[];for(var _0x903dd8=0x0;_0x903dd8<_0x20cb66[_0xd583('0x25')];_0x903dd8++){if(_0x20cb66[_0x903dd8]!==''){var _0x2c7c45=_[_0xd583('0x26')](promisesAdditionalPhones,{'contactId':_0x394226,'phone':_0x20cb66[_0x903dd8]});if(_0x2c7c45['length']==0x0){orderBy++;promisesAdditionalPhones[_0xd583('0x1f')]({'contactId':_0x394226,'contactTypeId':_0xfa2641,'phone':_0x20cb66[_0x903dd8],'orderBy':orderBy});}}}_0x31c48f({'ok':0x1});}else _0x31c48f({'res':0x0});});}function createAdditionalPhone(_0x4f7add,_0x2fe292,_0x4f1e7d,_0x40b34e){return new Promise(function(_0x310833,_0x3d1ab0){return db['CmContactHasItem'][_0xd583('0x27')]({'where':{'CmContactId':_0x4f7add,'item':_0x4f1e7d}})[_0xd583('0x20')](function(_0x461f9e){if(_0x461f9e){return db[_0xd583('0x28')][_0xd583('0x29')]({'ItemTypeId':_0x2fe292,'OrderBy':_0x40b34e},{'where':{'CmContactId':_0x4f7add,'item':_0x4f1e7d}})['then'](function(_0xadc32b){_0x310833({'res':_0xd583('0x2a')});});}else{return db[_0xd583('0x28')][_0xd583('0x2b')]({'CmContactId':_0x4f7add,'item':_0x4f1e7d,'ItemTypeId':_0x2fe292,'OrderBy':_0x40b34e,'ItemClass':_0xd583('0x2c')})[_0xd583('0x20')](function(_0x590bc3){_0x310833({'res':_0xd583('0x2d')});});}});});}function updateContact(_0x1dae85){return new Promise(function(_0x1e7258,_0x302df7){var _0x2a7e31=_0x1dae85['id'];delete _0x1dae85['id'];return db[_0xd583('0x2e')]['update'](_0x1dae85,{'where':{'id':_0x2a7e31}})[_0xd583('0x20')](function(_0x17a0eb){updatedRows+=0x1;return db[_0xd583('0x2f')][_0xd583('0x29')]({'phone':_0x1dae85['phone']},{'where':{'ContactId':_0x2a7e31}})[_0xd583('0x20')](function(_0x2595c2){_0x1e7258({'ret':'OK'});});});});}function insertCmHopper(_0x4d7069,_0x52861f,_0x243ddf,_0x171c27,_0x400914){var _0x19a834=[_0xd583('0x30'),_0xd583('0x31'),_0xd583('0x32'),_0xd583('0x33'),_0x52861f+'.'+_0x171c27,_0xd583('0x34'),'cm_contacts.updatedAt',_0xd583('0x35'),_0xd583('0x36'),'\x22'+_0x400914+'\x22'];return squel[_0xd583('0x37')]()[_0xd583('0x38')](_0xd583('0x39'))[_0xd583('0x3a')]([_0xd583('0x12'),'scheduledat',_0xd583('0x3b'),'ListId',_0x171c27,_0xd583('0x3c'),_0xd583('0x3d'),_0xd583('0x3e'),'UserId',_0xd583('0x3f')],squel[_0xd583('0x11')]()['fields'](_0x19a834)[_0xd583('0x13')](_0x52861f)[_0xd583('0x14')]('cm_contacts',null,_0xd583('0x40')+_0x52861f+'.CmListId')[_0xd583('0x14')](_0x243ddf,null,_0x243ddf+'.id\x20=\x20'+_0x52861f+'.'+_0x171c27)[_0xd583('0x17')](_0x52861f+_0xd583('0x41'),_0x4d7069)[_0xd583('0x17')](_0xd583('0x42'),NOW)[_0xd583('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x52861f,_0x243ddf,_0x171c27,'cm_hopper',[_0xd583('0x43'),'\x22onlyIfOpen\x22']))[_0xd583('0x17')](_0xd583('0x44'),selectNotIn(_0x52861f,_0x243ddf,_0x171c27,_0xd583('0x39'),['\x22always\x22'])))[_0xd583('0x45')]();}function insertCmHopperBlack(_0x20fb24,_0x324d78,_0x26bd7d,_0x12b283){var _0x11215c=[_0xd583('0x30'),_0xd583('0x32'),'cm_contacts.ListId',_0x324d78+'.'+_0x12b283,_0xd583('0x34'),_0xd583('0x46')];return squel[_0xd583('0x37')]()[_0xd583('0x38')](_0xd583('0x47'))[_0xd583('0x3a')]([_0xd583('0x12'),_0xd583('0x3b'),_0xd583('0x48'),_0x12b283,_0xd583('0x3c'),_0xd583('0x3d')],squel['select']()[_0xd583('0x49')](_0x11215c)['from'](_0x324d78)['join'](_0xd583('0x4a'),null,_0xd583('0x40')+_0x324d78+_0xd583('0x4b'))[_0xd583('0x14')](_0x26bd7d,null,_0x26bd7d+_0xd583('0x15')+_0x324d78+'.'+_0x12b283)[_0xd583('0x17')](_0x324d78+_0xd583('0x41'),_0x20fb24)[_0xd583('0x17')](_0xd583('0x42'),NOW)[_0xd583('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xd583('0x11')]()[_0xd583('0x4c')]('phone')[_0xd583('0x13')](_0xd583('0x47'))['where'](_0xd583('0x4d'),_0x20fb24)[_0xd583('0x17')](_0x12b283+_0xd583('0x4e'),_0x324d78+'.'+_0x12b283)))[_0xd583('0x45')]();}function insertCmHopperAdditionalPhones(_0x4d524e){var _0x14a3b1=[_0xd583('0x4f'),'cm_contact_has_items.item',_0xd583('0x50'),_0xd583('0x51'),_0xd583('0x52')];return squel['insert']()[_0xd583('0x38')]('cm_hopper_additional_phones')[_0xd583('0x3a')]([_0xd583('0x53'),_0xd583('0x12'),_0xd583('0x54'),_0xd583('0x3c'),_0xd583('0x3d')],squel['select']()[_0xd583('0x49')](_0x14a3b1)['from'](_0xd583('0x39'))[_0xd583('0x14')](_0xd583('0x4a'),null,_0xd583('0x55'))[_0xd583('0x14')](_0xd583('0x56'),null,_0xd583('0x57'))['where'](_0xd583('0x58'),_0x4d524e)['where'](_0xd583('0x42'),NOW))[_0xd583('0x45')]();}function insertCmContact(_0x4fd324,_0x49219e,_0x224958,_0x5b3c49){var _0x4e7657=_[_0xd583('0x59')](_[_0xd583('0x5a')](_0x5b3c49),['ListId',_0xd583('0x5b'),_0xd583('0x3c'),_0xd583('0x3d')]);return squel[_0xd583('0x37')]()[_0xd583('0x38')](_0xd583('0x4a'))[_0xd583('0x3a')](_0x4e7657,squel['select']()['fields'](_0x4e7657)['from'](_0x49219e)[_0xd583('0x17')]('('+_0x224958[_0xd583('0x14')](',')+_0xd583('0x5c'),squel[_0xd583('0x11')]()[_0xd583('0x49')](_0x224958)[_0xd583('0x13')](_0xd583('0x4a'))[_0xd583('0x17')](_0xd583('0x4d'),_0x4fd324))['where']('id\x20IN\x20?',squel[_0xd583('0x11')]()[_0xd583('0x4c')](_0xd583('0x5d'),_0xd583('0x5e'))['from'](_0x49219e)[_0xd583('0x5f')](_0x224958[_0xd583('0x14')](','))))[_0xd583('0x45')]();}function handleStop(){logger[_0xd583('0x60')](_0xd583('0x61'));stopped=!![];}function handleUncaughtException(_0xeb9187){logger[_0xd583('0x21')](_0xeb9187[_0xd583('0x22')]);process[_0xd583('0x62')](0x1);}function handleError(_0x1e5ddf,_0x3aee59){stats[_0xd583('0x63')][_0xd583('0x1f')]({'name':_0x3aee59[_0xd583('0x64')],'message':_0x3aee59[_0xd583('0x22')],'row':_0x1e5ddf});}function handleQuery(_0x572811){logger[_0xd583('0x60')](_0x572811);return db[_0xd583('0x19')][_0xd583('0x1a')](_0x572811)[_0xd583('0x1c')](function(_0x35ab7e){results[_0xd583('0x1f')](_0x35ab7e);})[_0xd583('0x65')](function(_0x3181e3){logger[_0xd583('0x21')](_0x3181e3[_0xd583('0x22')]);});}function main(_0x2ab1a6,_0x15cae9,_0x115f62,_0x3bf6dc){logger[_0xd583('0x60')](_0xd583('0x66'),_0x2ab1a6,JSON[_0xd583('0x67')](_0x15cae9));process['send'](_0xd583('0x68'));var _0x551a2d=_0x15cae9[_0xd583('0x69')];var _0x51fbc3=_[_0xd583('0x6a')](_0x551a2d);var _0x546dab=_0x15cae9[_0xd583('0x6b')];var _0x1e3e4e=path[_0xd583('0x14')](config[_0xd583('0x6c')],_0xd583('0x6d'),_0x546dab+_0xd583('0x6e'));logger[_0xd583('0x60')](_0xd583('0x6f'),_0x15cae9);db[_0xd583('0x70')]['findAll']({'raw':!![],'attributes':['id',_0xd583('0x71')]})[_0xd583('0x20')](function(_0x40ee30){for(var _0x4389e3=0x0;_0x4389e3<_0x40ee30[_0xd583('0x25')];_0x4389e3++){if(_0x40ee30[_0x4389e3][_0xd583('0x71')]in _0x551a2d){contactItemTypes[_0xd583('0x1f')](_0x40ee30[_0x4389e3]);delete _0x51fbc3[_0x40ee30[_0x4389e3][_0xd583('0x71')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x51fbc3[_0xd583('0x1e')]='';var _0xdaddc4=_[_0xd583('0x5a')](_0x51fbc3)[_0xd583('0x14')]();logger[_0xd583('0x60')](_0xd583('0x72'),_0xdaddc4);fs[_0xd583('0x73')](_0x1e3e4e,_0xdaddc4+'\x0a');Papa[_0xd583('0x74')](fs[_0xd583('0x75')](_0x2ab1a6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x43f9ef,_0x4d251e){try{for(var _0x226724=0x0,_0x11c549=[];_0x226724<_0x43f9ef['data'][_0xd583('0x25')];_0x226724++){stats['rows']+=0x1;if(_0x43f9ef[_0xd583('0x63')][_0x226724]){handleError(_0x43f9ef[_0xd583('0x76')][_0x226724],_0x43f9ef[_0xd583('0x63')][_0x226724]);}else{var _0x244ebf=[];var _0xceb24b=[];for(var _0x282038 in _0x551a2d){let _0x38e118=contactItemTypes[_0xd583('0x77')](_0x4e8830=>_0x4e8830[_0xd583('0x71')]===_0x282038);if(_[_0xd583('0x1d')](_0x38e118)){if(_0x551a2d['hasOwnProperty'](_0x282038)){if(_0x43f9ef[_0xd583('0x76')][_0x226724][_0x551a2d[_0x282038]]){var _0x43dd38=_[_0xd583('0x78')](_0x43f9ef['data'][_0x226724][_0x551a2d[_0x282038]][_0xd583('0x79')](/"/g,'\x27'));switch(_0x282038){case'scheduledat':var _0x3ad9a0=moment(_0x43dd38,_0xd583('0x7a'),!![]);if(_0x3ad9a0[_0xd583('0x7b')]()){_0x11c549[_0xd583('0x1f')]('\x22'+_0x43dd38+'\x22');}else{_0x244ebf[_0xd583('0x1f')](_0xd583('0x7c'));}break;case _0xd583('0x3e'):var _0x537ef5=parseInt(_0x43dd38);_0x43dd38=_[_0xd583('0x7d')](_0x537ef5)||_0x537ef5<0x0||_0x537ef5>0x4?_0x3bf6dc?0x3:0x2:_0x537ef5;_0x11c549[_0xd583('0x1f')]('\x22'+_0x43dd38+'\x22');break;case _0xd583('0x7e'):var _0x3cda59=parseInt(_0x43dd38);if(_[_0xd583('0x7f')](_0x3cda59)&&_[_0xd583('0x80')](_0x115f62,_0x3cda59)){_0x11c549[_0xd583('0x1f')]('\x22'+_0x3cda59+'\x22');}else{_0x244ebf[_0xd583('0x1f')](_0xd583('0x81'));}break;case _0xd583('0x82'):if(isEmail(_0x43dd38)){_0x11c549[_0xd583('0x1f')]('\x22'+_0x43dd38+'\x22');}else{_0x244ebf[_0xd583('0x1f')](_0xd583('0x83'));}break;case _0xd583('0x84'):var _0xb772f4=moment(_0x43dd38,_0xd583('0x85'),!![]);if(_0xb772f4['isValid']()){_0x11c549[_0xd583('0x1f')]('\x22'+_0x43dd38+'\x22');}else{_0x244ebf[_0xd583('0x1f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x11c549[_0xd583('0x1f')]('\x22'+_0x43dd38+'\x22');}}else{switch(_0x282038){case _0xd583('0x86'):case'phone':_0x244ebf[_0xd583('0x1f')](_0x282038+_0xd583('0x87'));break;default:_0x11c549[_0xd583('0x1f')]('\x22\x22');}}}}else{var _0x5e9c23='';for(var _0x3b42f2=0x0;_0x3b42f2<_0x551a2d[_0x282038]['length'];_0x3b42f2++){var _0x43dd38=_['trim'](_0x43f9ef[_0xd583('0x76')][_0x226724][_0x551a2d[_0x282038][_0x3b42f2]][_0xd583('0x79')](/"/g,'\x27'));if(_0x5e9c23=='')_0x5e9c23=_0x43dd38;else _0x5e9c23+='|'+_0x43dd38;}_0xceb24b[_0xd583('0x1f')](_0x38e118['id']+':'+_0x5e9c23);}}if(hasAdditionalPhones){_0x11c549['push']('\x22'+_0xceb24b[_0xd583('0x14')](';')+'\x22');}if(_0x244ebf[_0xd583('0x25')]){handleError(_0x43f9ef['data'][_0x226724],{'code':_0xd583('0x88'),'message':_0x244ebf[_0xd583('0x14')]()});}else{fs[_0xd583('0x89')](_0x1e3e4e,_0x11c549['join']()+'\x0a');}_0x11c549=[];}if(!(stats['rows']%0xc8)){socket[_0xd583('0x8a')](_0xd583('0x8b')+_0x546dab,stats);stats[_0xd583('0x63')]=[];}}if(stopped){logger[_0xd583('0x60')](_0xd583('0x8c'));_0x4d251e[_0xd583('0x8d')]();}}catch(_0x2588ee){handleError(_0x43f9ef[_0xd583('0x76')][_0x226724],{'code':'SystemError','message':_0x2588ee[_0xd583('0x22')]});logger['error'](_0xd583('0x8e'),_0x2588ee[_0xd583('0x22')]);}},'complete':function(){try{var _0x32f450=[];var _0x3cde5c=tempTableName;_0x32f450[_0xd583('0x1f')](_0xd583('0x8f')+_0x3cde5c+_0xd583('0x90'));logger['info']('CIS\x20len',contactItemTypes['length']);var _0x25c322=util[_0xd583('0xd')](_0xd583('0x91'),_0x1e3e4e,_0x3cde5c,_0xdaddc4,_0x15cae9[_0xd583('0x48')],_0x15cae9[_0xd583('0x5b')]||null,NOW,NOW);if(_[_0xd583('0x1d')](_0x551a2d[_0xd583('0x92')])){_0x25c322+=',\x20scheduledAt\x20=\x20NOW()';}_0x32f450['push'](_0x25c322);BPromise['each'](_0x32f450,handleQuery)[_0xd583('0x20')](function(_0x4ef3f8){BPromise[_0xd583('0x24')]([handleAdditionalPhones()])[_0xd583('0x20')](function(){_0x32f450=[];for(var _0x142980=0x0;_0x142980=_0x27edc1){return _0x4371cf[_0x3ab6('0x10')](0x193)[_0x3ab6('0x11')]({'message':util[_0x3ab6('0x12')](_0x3ab6('0x13'),_0x1f99b3)});}_0x3ec50e();})['catch'](function(_0x4a5739){_0x3ec50e(_0x4a5739);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x3ab6('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0x3ab6('0x15')}]}});}exports[_0x3ab6('0x16')]=isUserLimit; \ No newline at end of file +var _0x0296=['crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','user'];(function(_0x470cdf,_0x568cd1){var _0x15e9a0=function(_0x4e13f0){while(--_0x4e13f0){_0x470cdf['push'](_0x470cdf['shift']());}};_0x15e9a0(++_0x568cd1);}(_0x0296,0x142));var _0x6029=function(_0x5dff0c,_0x2bdeb4){_0x5dff0c=_0x5dff0c-0x0;var _0x15615f=_0x0296[_0x5dff0c];return _0x15615f;};'use strict';var crypto=require(_0x6029('0x0'));var util=require(_0x6029('0x1'));var compose=require(_0x6029('0x2'));var db=require(_0x6029('0x3'))['db'];var config=require(_0x6029('0x4'));function getValueFromLicense(_0x302c55,_0x5f2a62){if(_0x302c55&&_0x5f2a62){if(_0x5f2a62[_0x6029('0x5')]&&_0x5f2a62[_0x6029('0x6')]){var _0xa92a00=_0x5f2a62['data1'];var _0x3807ce=_0x5f2a62[_0x6029('0x6')];var _0x830604=_0xa92a00[_0x6029('0x7')]('-')[0x4];var _0x17b924=_0xa92a00[_0x6029('0x7')]('-')[0x0];var _0x4ccf81=crypto[_0x6029('0x8')]('aes-256-ctr',util[_0x6029('0x9')](_0x6029('0xa'),_0x830604,_0xa92a00,_0x17b924));var _0x21e1d1=_0x4ccf81['update'](_0x3807ce,_0x6029('0xb'),_0x6029('0xc'));_0x21e1d1+=_0x4ccf81[_0x6029('0xd')](_0x6029('0xc'));var _0x1e4bb9=JSON[_0x6029('0xe')](_0x21e1d1);return _0x1e4bb9[_0x6029('0xf')](_0x302c55)?_0x1e4bb9[_0x302c55]:null;}}return null;}function isLimit(_0x120592,_0x1b9880,_0x4c38ad,_0x5d5536){var _0x5f08de=_0x1b9880;return compose()[_0x6029('0x10')](function(_0x2c2adc,_0x5cea91,_0x5e668d){return db[_0x6029('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x6029('0x12')](function(_0x651237){var _0x31d363=getValueFromLicense(_0x120592,_0x651237);return _0x31d363?_0x31d363:_0x5f08de;})[_0x6029('0x12')](function(_0x473d93){_0x5f08de=_0x473d93;return _0x4c38ad['count'](_0x5d5536);})['then'](function(_0x622b73){if(_0x622b73>=_0x5f08de){return _0x5cea91[_0x6029('0x13')](0x193)['json']({'message':util['format'](_0x6029('0x14'),_0x120592)});}_0x5e668d();})[_0x6029('0x15')](function(_0x1d6e4c){_0x5e668d(_0x1d6e4c);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x6029('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ebdffc1..b509ba3 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 _0x9b42=['$between','start','DATE','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','operator','value','includes','$gt','$lte','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$notIn','text','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','<\x20?','<=\x20?','$gte','>=\x20?'];(function(_0x23a093,_0x43e7eb){var _0x4b58b0=function(_0x239a7a){while(--_0x239a7a){_0x23a093['push'](_0x23a093['shift']());}};_0x4b58b0(++_0x43e7eb);}(_0x9b42,0x74));var _0x29b4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9b42[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x29b4('0x0'));var moment=require(_0x29b4('0x1'));exports[_0x29b4('0x2')]=function(_0x2424f1){var _0x252710={'conditions':[]};_0x252710[_0x29b4('0x3')]=_[_0x29b4('0x4')](_0x2424f1,_0x29b4('0x5'))?'or':_0x29b4('0x6');var _0x125a16=_0x2424f1[_0x29b4('0x7')]('[$and]','')[_0x29b4('0x7')](_0x29b4('0x5'),'')[_0x29b4('0x8')]('||');for(var _0x6ef27f=0x0;_0x6ef27f<_0x125a16[_0x29b4('0x9')];_0x6ef27f++){var _0x4b3dba=_0x125a16[_0x6ef27f][_0x29b4('0x8')](':=');var _0x3dd01c=_0x4b3dba[0x0];var _0x2b7cf3=_0x4b3dba['slice'](0x1);_0x2b7cf3[_0x29b4('0xa')](function(_0x1cb170){var _0x4d5991=_0x1cb170[_0x29b4('0x8')]('[')[_0x29b4('0xb')]();var _0x11ff68=_0x1cb170[_0x29b4('0xc')](/\[(.*?)\]/g);_0x11ff68[_0x29b4('0xa')](function(_0x1a2cc1){var _0x1ecaca=_0x1a2cc1[_0x29b4('0x8')]('[')[_0x29b4('0xd')](function(_0x265ee3){return _0x265ee3[_0x29b4('0xe')](']')>-0x1;})[_0x29b4('0xf')](function(_0x2ba0a1){return _0x2ba0a1[_0x29b4('0x8')](']')[0x0];})[0x0];_0x252710[_0x29b4('0x10')][_0x29b4('0x11')]({'field':_0x3dd01c,'operator':_0x4d5991,'value':_0x1ecaca});});});}return _0x252710;};exports[_0x29b4('0x12')]=function(_0x2f2476,_0x31172b,_0xb89093){var _0xf4e124={};if(_0x31172b==='DATE'){if(_0xb89093['operator']==='$eq'){_0xb89093[_0x29b4('0x13')]='$between';_0xb89093[_0x29b4('0x14')]+=','+_0xb89093[_0x29b4('0x14')];}else if(_[_0x29b4('0x15')]([_0x29b4('0x16'),_0x29b4('0x17')],_0xb89093['operator'])){_0xb89093[_0x29b4('0x14')]=moment(_0xb89093[_0x29b4('0x14')])['add'](0x1,'days')[_0x29b4('0x18')](_0x29b4('0x19'));}}if(_0xb89093['castTo']){_0x31172b=_0xb89093[_0x29b4('0x1a')];_0xf4e124['text']=_0x29b4('0x1b')+_0x2f2476+'.'+_0xb89093[_0x29b4('0x1c')]+_0x29b4('0x1d')+_0xb89093[_0x29b4('0x1a')]+')\x20'+parseOperator(_0xb89093[_0x29b4('0x13')]);}else{_0xf4e124['text']=_0x2f2476+'.'+_0xb89093['field']+'\x20'+parseOperator(_0xb89093[_0x29b4('0x13')]);}if(_[_0x29b4('0x15')](['$ne',_0x29b4('0x1e')],_0xb89093['operator']))_0xf4e124[_0x29b4('0x1f')]='('+_0xf4e124[_0x29b4('0x1f')]+'\x20OR\x20'+_0x2f2476+'.'+_0xb89093['field']+_0x29b4('0x20');_0xf4e124[_0x29b4('0x14')]=parseValue(_0x31172b,_0xb89093[_0x29b4('0x13')],_0xb89093[_0x29b4('0x14')]);return _0xf4e124;};function parseOperator(_0x3776d0){var _0x2916c5;switch(_0x3776d0){case _0x29b4('0x21'):_0x2916c5=_0x29b4('0x22');break;case _0x29b4('0x1e'):_0x2916c5=_0x29b4('0x23');break;case _0x29b4('0x24'):_0x2916c5=_0x29b4('0x25');break;case'$ne':_0x2916c5=_0x29b4('0x26');break;case'$substring':case _0x29b4('0x27'):case _0x29b4('0x28'):_0x2916c5=_0x29b4('0x29');break;case'$lt':_0x2916c5=_0x29b4('0x2a');break;case _0x29b4('0x16'):_0x2916c5='>\x20?';break;case _0x29b4('0x17'):_0x2916c5=_0x29b4('0x2b');break;case _0x29b4('0x2c'):_0x2916c5=_0x29b4('0x2d');break;case _0x29b4('0x2e'):_0x2916c5='BETWEEN\x20?\x20AND\x20?';break;}return _0x2916c5;}function parseValue(_0x4ddcdd,_0x1f6cbd,_0x569fd3){var _0x14bd45={'start':undefined,'end':undefined};switch(_0x1f6cbd){case _0x29b4('0x21'):case _0x29b4('0x1e'):_0x14bd45[_0x29b4('0x2f')]=_0x569fd3[_0x29b4('0x8')](',');break;case'$substring':_0x14bd45[_0x29b4('0x2f')]='%'+_0x569fd3+'%';break;case'$startsWith':_0x14bd45[_0x29b4('0x2f')]=_0x569fd3+'%';break;case'$endsWith':_0x14bd45[_0x29b4('0x2f')]='%'+_0x569fd3;break;case _0x29b4('0x2e'):var _0x581f13=_0x569fd3['split'](',');var _0x569fd3=_0x581f13['shift']();var _0x33a40d=_0x581f13['pop']();if(_0x4ddcdd===_0x29b4('0x30')){_0x569fd3=moment(_0x569fd3)[_0x29b4('0x31')](0x0,!![])[_0x29b4('0x18')]();_0x33a40d=moment(_0x33a40d)[_0x29b4('0x31')](0x0,!![])[_0x29b4('0x32')](0x17,_0x29b4('0x33'))[_0x29b4('0x32')](0x3b,_0x29b4('0x34'))[_0x29b4('0x32')](0x3b,_0x29b4('0x35'))['format']();}_0x14bd45={'start':_0x569fd3,'end':_0x33a40d};break;default:_0x14bd45[_0x29b4('0x2f')]=_0x569fd3;break;}return _0x14bd45;} \ No newline at end of file +var _0x2269=['start','$endsWith','shift','pop','utcOffset','format','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','split','length','match','forEach','filter','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','add','days','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lte','<=\x20?','$gte','>=\x20?'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2269,0xa1));var _0x9226=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0x2269[_0x1f16de];return _0x36cd80;};'use strict';var _=require(_0x9226('0x0'));var moment=require('moment');exports[_0x9226('0x1')]=function(_0x41991a){var _0x409c8f={'conditions':[]};_0x409c8f[_0x9226('0x2')]=_[_0x9226('0x3')](_0x41991a,_0x9226('0x4'))?'or':_0x9226('0x5');var _0x239d27=_0x41991a['replace'](_0x9226('0x6'),'')['replace'](_0x9226('0x4'),'')[_0x9226('0x7')]('||');for(var _0x529eaa=0x0;_0x529eaa<_0x239d27[_0x9226('0x8')];_0x529eaa++){var _0x4c47e3=_0x239d27[_0x529eaa][_0x9226('0x7')](':=');var _0x415446=_0x4c47e3[0x0];var _0x941cb2=_0x4c47e3['slice'](0x1);_0x941cb2['forEach'](function(_0x1b31f9){var _0x4c4462=_0x1b31f9[_0x9226('0x7')]('[')['shift']();var _0x3eb2a0=_0x1b31f9[_0x9226('0x9')](/\[(.*?)\]/g);_0x3eb2a0[_0x9226('0xa')](function(_0x3a3947){var _0x58d7f3=_0x3a3947[_0x9226('0x7')]('[')[_0x9226('0xb')](function(_0x4ba530){return _0x4ba530['indexOf'](']')>-0x1;})[_0x9226('0xc')](function(_0x2da9ae){return _0x2da9ae[_0x9226('0x7')](']')[0x0];})[0x0];_0x409c8f[_0x9226('0xd')][_0x9226('0xe')]({'field':_0x415446,'operator':_0x4c4462,'value':_0x58d7f3});});});}return _0x409c8f;};exports[_0x9226('0xf')]=function(_0x135e13,_0x429e25,_0x3ae404){var _0x571171={};if(_0x429e25===_0x9226('0x10')){if(_0x3ae404[_0x9226('0x11')]===_0x9226('0x12')){_0x3ae404[_0x9226('0x11')]=_0x9226('0x13');_0x3ae404[_0x9226('0x14')]+=','+_0x3ae404[_0x9226('0x14')];}else if(_['includes']([_0x9226('0x15'),'$lte'],_0x3ae404[_0x9226('0x11')])){_0x3ae404[_0x9226('0x14')]=moment(_0x3ae404[_0x9226('0x14')])[_0x9226('0x16')](0x1,_0x9226('0x17'))['format'](_0x9226('0x18'));}}if(_0x3ae404[_0x9226('0x19')]){_0x429e25=_0x3ae404[_0x9226('0x19')];_0x571171[_0x9226('0x1a')]='CAST('+_0x135e13+'.'+_0x3ae404[_0x9226('0x1b')]+_0x9226('0x1c')+_0x3ae404['castTo']+')\x20'+parseOperator(_0x3ae404[_0x9226('0x11')]);}else{_0x571171[_0x9226('0x1a')]=_0x135e13+'.'+_0x3ae404[_0x9226('0x1b')]+'\x20'+parseOperator(_0x3ae404['operator']);}if(_['includes']([_0x9226('0x1d'),_0x9226('0x1e')],_0x3ae404[_0x9226('0x11')]))_0x571171[_0x9226('0x1a')]='('+_0x571171[_0x9226('0x1a')]+_0x9226('0x1f')+_0x135e13+'.'+_0x3ae404[_0x9226('0x1b')]+_0x9226('0x20');_0x571171[_0x9226('0x14')]=parseValue(_0x429e25,_0x3ae404[_0x9226('0x11')],_0x3ae404[_0x9226('0x14')]);return _0x571171;};function parseOperator(_0x464113){var _0x56ff98;switch(_0x464113){case _0x9226('0x21'):_0x56ff98='IN\x20?';break;case _0x9226('0x1e'):_0x56ff98=_0x9226('0x22');break;case _0x9226('0x12'):_0x56ff98='=\x20?';break;case _0x9226('0x1d'):_0x56ff98=_0x9226('0x23');break;case _0x9226('0x24'):case _0x9226('0x25'):case'$endsWith':_0x56ff98=_0x9226('0x26');break;case'$lt':_0x56ff98='<\x20?';break;case'$gt':_0x56ff98='>\x20?';break;case _0x9226('0x27'):_0x56ff98=_0x9226('0x28');break;case _0x9226('0x29'):_0x56ff98=_0x9226('0x2a');break;case _0x9226('0x13'):_0x56ff98='BETWEEN\x20?\x20AND\x20?';break;}return _0x56ff98;}function parseValue(_0x3adc3a,_0x4dd04a,_0x39ced7){var _0x2b4e9d={'start':undefined,'end':undefined};switch(_0x4dd04a){case _0x9226('0x21'):case _0x9226('0x1e'):_0x2b4e9d[_0x9226('0x2b')]=_0x39ced7[_0x9226('0x7')](',');break;case _0x9226('0x24'):_0x2b4e9d['start']='%'+_0x39ced7+'%';break;case _0x9226('0x25'):_0x2b4e9d[_0x9226('0x2b')]=_0x39ced7+'%';break;case _0x9226('0x2c'):_0x2b4e9d[_0x9226('0x2b')]='%'+_0x39ced7;break;case'$between':var _0x43c7f8=_0x39ced7['split'](',');var _0x39ced7=_0x43c7f8[_0x9226('0x2d')]();var _0x460b66=_0x43c7f8[_0x9226('0x2e')]();if(_0x3adc3a==='DATE'){_0x39ced7=moment(_0x39ced7)[_0x9226('0x2f')](0x0,!![])[_0x9226('0x30')]();_0x460b66=moment(_0x460b66)[_0x9226('0x2f')](0x0,!![])['add'](0x17,'hours')[_0x9226('0x16')](0x3b,_0x9226('0x31'))[_0x9226('0x16')](0x3b,_0x9226('0x32'))[_0x9226('0x30')]();}_0x2b4e9d={'start':_0x39ced7,'end':_0x460b66};break;default:_0x2b4e9d[_0x9226('0x2b')]=_0x39ced7;break;}return _0x2b4e9d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e527857..b5176ae 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 _0x290f=['offset','sort','indexOf','priority','unsigned','substr','DESC','col','ASC','omit','isEmpty','length','isString','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','push','join','lodash','sequelize','moment','fields','split','forOwn','find','DATE','isPlainObject','parse','YYYY-MM-DD','$lte','utc','subtract','format','name','uniqueid','isArray','limit'];(function(_0x48ef16,_0x237c07){var _0x2ece38=function(_0xb0efd8){while(--_0xb0efd8){_0x48ef16['push'](_0x48ef16['shift']());}};_0x2ece38(++_0x237c07);}(_0x290f,0x91));var _0xf290=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x290f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf290('0x0'));var sequelize=require(_0xf290('0x1'));var moment=require(_0xf290('0x2'));var LIMIT_VALUE=0xfa;exports[_0xf290('0x3')]=function(_0x50072d){var _0x140d4d=null;if(_0x50072d){_0x140d4d=_0x50072d[_0xf290('0x4')](',');}return _0x140d4d;};exports['filters']=function(_0x295f5c,_0x22a8f6){var _0x7529a8={};if(!_['isEmpty'](_0x295f5c)){_[_0xf290('0x5')](_0x295f5c,function(_0x495374,_0x3e7939){try{if(_0x22a8f6){var _0x5772d9=_[_0xf290('0x6')](_0x22a8f6,{'name':_0x3e7939})||{};if(_0x5772d9['type']===_0xf290('0x7')&&_[_0xf290('0x8')](_0x495374)){var _0x4bd2b2=JSON[_0xf290('0x9')](_0x495374);var _0x99103f={'$gte':moment(moment(_0x4bd2b2['$gte'])['format'](_0xf290('0xa')))['utc']()['format'](),'$lte':moment(moment(_0x4bd2b2[_0xf290('0xb')])['format'](_0xf290('0xa')))[_0xf290('0xc')]()[_0xf290('0xd')](0x1,'s')[_0xf290('0xe')]()};_0x7529a8[_0x3e7939]=_0x99103f;}else if(_0x5772d9[_0xf290('0xf')]===_0xf290('0x10')){_0x7529a8[_0x3e7939]=_0x495374;}else{_0x7529a8[_0x3e7939]=_[_0xf290('0x11')](_0x495374)?_0x495374:JSON[_0xf290('0x9')](_0x495374);}}else{_0x7529a8[_0x3e7939]=_['isArray'](_0x495374)?_0x495374:JSON[_0xf290('0x9')](_0x495374);}}catch(_0x3be01b){_0x7529a8[_0x3e7939]=_0x495374[_0xf290('0x4')](',');}});}return _0x7529a8;};exports[_0xf290('0x12')]=function(_0x3011e3){_0x3011e3=parseInt(_0x3011e3,0xa);if(!_0x3011e3||_0x3011e3<0x0){_0x3011e3=LIMIT_VALUE;}return _0x3011e3;};exports[_0xf290('0x13')]=function(_0x50fe05){_0x50fe05=parseInt(_0x50fe05,0xa);if(!_0x50fe05||_0x50fe05<0x0){_0x50fe05=0x0;}return _0x50fe05;};exports[_0xf290('0x14')]=function(_0x476374){var _0x4d190a,_0x517f90=null;if(_0x476374){_0x4d190a=_0x476374[_0xf290('0x4')](',');_0x517f90=_['map'](_0x4d190a,function(_0x443e8a){if(_0x443e8a[_0xf290('0x15')]('-')===0x0){return[_0x443e8a===_0xf290('0x16')?sequelize['cast'](sequelize['col'](_0xf290('0x16')),_0xf290('0x17')):_0x443e8a[_0xf290('0x18')](0x1),_0xf290('0x19')];}else{return[_0x443e8a===_0xf290('0x16')?sequelize['cast'](sequelize[_0xf290('0x1a')]('priority'),_0xf290('0x17')):_0x443e8a,_0xf290('0x1b')];}});}return _0x517f90;};exports[_0xf290('0x1c')]=function(_0x481bab,_0x1f9789){if(_[_0xf290('0x1d')](_0x481bab)){return _0x481bab;}if(_['isArray'](_0x481bab)){for(var _0x5a7c0b=0x0;_0x5a7c0b<_0x481bab[_0xf290('0x1e')];_0x5a7c0b+=0x1){_0x481bab[_0x5a7c0b]=this[_0xf290('0x1c')](_0x481bab[_0x5a7c0b],_0x1f9789);}return _0x481bab;}if(!_['isObject'](_0x481bab)){return _0x481bab;}if(_[_0xf290('0x1f')](_0x1f9789)){_0x1f9789=[_0x1f9789];}if(!_[_0xf290('0x11')](_0x1f9789)){return _0x481bab;}for(var _0x157adc=0x0;_0x157adc<_0x1f9789['length'];_0x157adc+=0x1){_['unset'](_0x481bab,_0x1f9789[_0x157adc]);}for(var _0x41e4ab in _0x481bab){if(_0x481bab['hasOwnProperty'](_0x41e4ab)){_0x481bab[_0x41e4ab]=this[_0xf290('0x1c')](_0x481bab[_0x41e4ab],_0x1f9789);}}return _0x481bab;};exports[_0xf290('0x20')]=function(_0xecd6bf){return _0xecd6bf[_0xf290('0x21')](RegExp(_0xf290('0x22')))?!![]:![];};exports[_0xf290('0x23')]=function(_0x385f1a){return _0x385f1a[_0xf290('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xf290('0x24')]=function(_0x5b921c){var _0x2494d=[];_0x5b921c[_0xf290('0x4')](/[ ,]+/)[_0xf290('0x25')](function(_0x9dd166){_0x9dd166=_0x9dd166['replace'](/([^:]")"+/g,'$1');_0x9dd166='+'+_0x9dd166+'*';if(_0x9dd166[_0xf290('0x26')]('@'))_0x9dd166='\x22'+_0x9dd166+'\x22';_0x2494d[_0xf290('0x27')](_0x9dd166);});return _0x2494d[_0xf290('0x28')]('\x20');}; \ No newline at end of file +var _0x3acf=['moment','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','parse','utc','format','$lte','subtract','uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','substr','DESC','unsigned','omit','isString','length','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','lodash'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x3acf,0x9b));var _0xf3ac=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x3acf[_0x4d45c1];return _0x244478;};'use strict';var _=require(_0xf3ac('0x0'));var sequelize=require('sequelize');var moment=require(_0xf3ac('0x1'));var LIMIT_VALUE=0xfa;exports[_0xf3ac('0x2')]=function(_0xd9843){var _0x3b0eaa=null;if(_0xd9843){_0x3b0eaa=_0xd9843[_0xf3ac('0x3')](',');}return _0x3b0eaa;};exports[_0xf3ac('0x4')]=function(_0x29ea32,_0x1beb7d){var _0x12aaf1={};if(!_[_0xf3ac('0x5')](_0x29ea32)){_['forOwn'](_0x29ea32,function(_0x443fd5,_0x3904d3){try{if(_0x1beb7d){var _0x58a9c9=_[_0xf3ac('0x6')](_0x1beb7d,{'name':_0x3904d3})||{};if(_0x58a9c9[_0xf3ac('0x7')]===_0xf3ac('0x8')&&_[_0xf3ac('0x9')](_0x443fd5)){var _0x3079b4=JSON[_0xf3ac('0xa')](_0x443fd5);var _0x9dd9fa={'$gte':moment(moment(_0x3079b4['$gte'])['format']('YYYY-MM-DD'))[_0xf3ac('0xb')]()[_0xf3ac('0xc')](),'$lte':moment(moment(_0x3079b4[_0xf3ac('0xd')])[_0xf3ac('0xc')]('YYYY-MM-DD'))[_0xf3ac('0xb')]()[_0xf3ac('0xe')](0x1,'s')['format']()};_0x12aaf1[_0x3904d3]=_0x9dd9fa;}else if(_0x58a9c9['name']===_0xf3ac('0xf')){_0x12aaf1[_0x3904d3]=_0x443fd5;}else{_0x12aaf1[_0x3904d3]=_[_0xf3ac('0x10')](_0x443fd5)?_0x443fd5:JSON['parse'](_0x443fd5);}}else{_0x12aaf1[_0x3904d3]=_[_0xf3ac('0x10')](_0x443fd5)?_0x443fd5:JSON[_0xf3ac('0xa')](_0x443fd5);}}catch(_0x51f16c){_0x12aaf1[_0x3904d3]=_0x443fd5[_0xf3ac('0x3')](',');}});}return _0x12aaf1;};exports['limit']=function(_0x3852c8){_0x3852c8=parseInt(_0x3852c8,0xa);if(!_0x3852c8||_0x3852c8<0x0){_0x3852c8=LIMIT_VALUE;}return _0x3852c8;};exports[_0xf3ac('0x11')]=function(_0x544782){_0x544782=parseInt(_0x544782,0xa);if(!_0x544782||_0x544782<0x0){_0x544782=0x0;}return _0x544782;};exports[_0xf3ac('0x12')]=function(_0x3ae0c1){var _0x58dc15,_0x3b6eb6=null;if(_0x3ae0c1){_0x58dc15=_0x3ae0c1[_0xf3ac('0x3')](',');_0x3b6eb6=_[_0xf3ac('0x13')](_0x58dc15,function(_0x54aa25){if(_0x54aa25[_0xf3ac('0x14')]('-')===0x0){return[_0x54aa25===_0xf3ac('0x15')?sequelize[_0xf3ac('0x16')](sequelize[_0xf3ac('0x17')](_0xf3ac('0x15')),'unsigned'):_0x54aa25[_0xf3ac('0x18')](0x1),_0xf3ac('0x19')];}else{return[_0x54aa25===_0xf3ac('0x15')?sequelize['cast'](sequelize[_0xf3ac('0x17')](_0xf3ac('0x15')),_0xf3ac('0x1a')):_0x54aa25,'ASC'];}});}return _0x3b6eb6;};exports[_0xf3ac('0x1b')]=function(_0x23423f,_0x54ba40){if(_['isEmpty'](_0x23423f)){return _0x23423f;}if(_[_0xf3ac('0x10')](_0x23423f)){for(var _0x574014=0x0;_0x574014<_0x23423f['length'];_0x574014+=0x1){_0x23423f[_0x574014]=this[_0xf3ac('0x1b')](_0x23423f[_0x574014],_0x54ba40);}return _0x23423f;}if(!_['isObject'](_0x23423f)){return _0x23423f;}if(_[_0xf3ac('0x1c')](_0x54ba40)){_0x54ba40=[_0x54ba40];}if(!_[_0xf3ac('0x10')](_0x54ba40)){return _0x23423f;}for(var _0x400951=0x0;_0x400951<_0x54ba40[_0xf3ac('0x1d')];_0x400951+=0x1){_['unset'](_0x23423f,_0x54ba40[_0x400951]);}for(var _0x28356b in _0x23423f){if(_0x23423f['hasOwnProperty'](_0x28356b)){_0x23423f[_0x28356b]=this[_0xf3ac('0x1b')](_0x23423f[_0x28356b],_0x54ba40);}}return _0x23423f;};exports[_0xf3ac('0x1e')]=function(_0xbf5805){return _0xbf5805[_0xf3ac('0x1f')](RegExp(_0xf3ac('0x20')))?!![]:![];};exports[_0xf3ac('0x21')]=function(_0x1910b5){return _0x1910b5[_0xf3ac('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0xf3ac('0x22')]=function(_0x372e51){var _0x52a86c=[];_0x372e51[_0xf3ac('0x3')](/[ ,]+/)[_0xf3ac('0x23')](function(_0x3bc6de){_0x3bc6de=_0x3bc6de[_0xf3ac('0x24')](/([^:]")"+/g,'$1');_0x3bc6de='+'+_0x3bc6de+'*';if(_0x3bc6de['includes']('@'))_0x3bc6de='\x22'+_0x3bc6de+'\x22';_0x52a86c[_0xf3ac('0x25')](_0x3bc6de);});return _0x52a86c[_0xf3ac('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index c437830..12a7dc6 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4620=['set','appPath','public','test','join','root','client','use','toISOString','split','static','views','/server/views','engine','ejs','renderFile','view\x20engine','html','initialize','serve-favicon','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','env','production'];(function(_0x4b9953,_0x4069b9){var _0x2df421=function(_0x34ffdc){while(--_0x34ffdc){_0x4b9953['push'](_0x4b9953['shift']());}};_0x2df421(++_0x4069b9);}(_0x4620,0xb3));var _0x0462=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x4620[_0x195577];return _0x13c367;};'use strict';var express=require('express');var favicon=require(_0x0462('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0x0462('0x1'));var cookieParser=require(_0x0462('0x2'));var errorHandler=require(_0x0462('0x3'));var path=require(_0x0462('0x4'));var passport=require(_0x0462('0x5'));var cors=require(_0x0462('0x6'));var moment=require(_0x0462('0x7'));var config=require('./environment');var db=require(_0x0462('0x8'))['db'];exports[_0x0462('0x9')]=function(_0x17830f){var _0x3fcb52=_0x17830f[_0x0462('0xa')](_0x0462('0xb'));if(_0x3fcb52===_0x0462('0xc')){_0x17830f[_0x0462('0xd')](_0x0462('0xe'),path['join'](config['root'],_0x0462('0xf')));}if(_0x3fcb52==='development'||_0x3fcb52===_0x0462('0x10')){_0x17830f[_0x0462('0xd')](_0x0462('0xe'),path[_0x0462('0x11')](config[_0x0462('0x12')],_0x0462('0x13')));_0x17830f[_0x0462('0x14')](errorHandler());}_0x17830f['set']('json\x20replacer',function(_0x5a492c,_0x3580b2){if(this[_0x5a492c]instanceof Date){_0x3580b2=this[_0x5a492c][_0x0462('0x15')]()[_0x0462('0x16')]('.')[0x0]+'Z';}return _0x3580b2;});_0x17830f['use'](express[_0x0462('0x17')](_0x17830f[_0x0462('0xa')](_0x0462('0xe'))));_0x17830f[_0x0462('0xd')](_0x0462('0x18'),config[_0x0462('0x12')]+_0x0462('0x19'));_0x17830f[_0x0462('0x1a')]('html',require(_0x0462('0x1b'))[_0x0462('0x1c')]);_0x17830f['set'](_0x0462('0x1d'),_0x0462('0x1e'));_0x17830f[_0x0462('0x14')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x17830f[_0x0462('0x14')](bodyParser['json']({'limit':'50mb'}));_0x17830f[_0x0462('0x14')](cors());_0x17830f['use'](methodOverride());_0x17830f[_0x0462('0x14')](cookieParser());_0x17830f[_0x0462('0x14')](passport[_0x0462('0x1f')]());}; \ No newline at end of file +var _0xa5c3=['./environment','default','get','env','production','set','appPath','join','development','test','root','use','json\x20replacer','toISOString','split','static','views','/server/views','html','urlencoded','50mb','json','initialize','serve-favicon','method-override','cookie-parser','path','passport','moment'];(function(_0x341b0d,_0x509d1c){var _0x76b8aa=function(_0x24fbcb){while(--_0x24fbcb){_0x341b0d['push'](_0x341b0d['shift']());}};_0x76b8aa(++_0x509d1c);}(_0xa5c3,0x190));var _0x3a5c=function(_0x1b4568,_0xd42a91){_0x1b4568=_0x1b4568-0x0;var _0x40720b=_0xa5c3[_0x1b4568];return _0x40720b;};'use strict';var express=require('express');var favicon=require(_0x3a5c('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0x3a5c('0x1'));var cookieParser=require(_0x3a5c('0x2'));var errorHandler=require('errorhandler');var path=require(_0x3a5c('0x3'));var passport=require(_0x3a5c('0x4'));var cors=require('cors');var moment=require(_0x3a5c('0x5'));var config=require(_0x3a5c('0x6'));var db=require('../mysqldb')['db'];exports[_0x3a5c('0x7')]=function(_0x28b5aa){var _0x5b450d=_0x28b5aa[_0x3a5c('0x8')](_0x3a5c('0x9'));if(_0x5b450d===_0x3a5c('0xa')){_0x28b5aa[_0x3a5c('0xb')](_0x3a5c('0xc'),path[_0x3a5c('0xd')](config['root'],'public'));}if(_0x5b450d===_0x3a5c('0xe')||_0x5b450d===_0x3a5c('0xf')){_0x28b5aa[_0x3a5c('0xb')](_0x3a5c('0xc'),path[_0x3a5c('0xd')](config[_0x3a5c('0x10')],'client'));_0x28b5aa[_0x3a5c('0x11')](errorHandler());}_0x28b5aa['set'](_0x3a5c('0x12'),function(_0x843cd6,_0x1867d1){if(this[_0x843cd6]instanceof Date){_0x1867d1=this[_0x843cd6][_0x3a5c('0x13')]()[_0x3a5c('0x14')]('.')[0x0]+'Z';}return _0x1867d1;});_0x28b5aa[_0x3a5c('0x11')](express[_0x3a5c('0x15')](_0x28b5aa[_0x3a5c('0x8')](_0x3a5c('0xc'))));_0x28b5aa[_0x3a5c('0xb')](_0x3a5c('0x16'),config[_0x3a5c('0x10')]+_0x3a5c('0x17'));_0x28b5aa['engine'](_0x3a5c('0x18'),require('ejs')['renderFile']);_0x28b5aa[_0x3a5c('0xb')]('view\x20engine','html');_0x28b5aa['use'](bodyParser[_0x3a5c('0x19')]({'limit':_0x3a5c('0x1a'),'extended':!![]}));_0x28b5aa[_0x3a5c('0x11')](bodyParser[_0x3a5c('0x1b')]({'limit':'50mb'}));_0x28b5aa['use'](cors());_0x28b5aa[_0x3a5c('0x11')](methodOverride());_0x28b5aa['use'](cookieParser());_0x28b5aa['use'](passport[_0x3a5c('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 2504397..18b6d7a 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 _0xb5b3=['ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress'];(function(_0x22eba2,_0x3d8d3d){var _0xcce128=function(_0x4135df){while(--_0x4135df){_0x22eba2['push'](_0x22eba2['shift']());}};_0xcce128(++_0x3d8d3d);}(_0xb5b3,0x143));var _0x3b5b=function(_0x36e69b,_0x28c20a){_0x36e69b=_0x36e69b-0x0;var _0x356b37=_0xb5b3[_0x36e69b];return _0x356b37;};'use strict';var _=require(_0x3b5b('0x0'));var os=require('os');var crypto=require(_0x3b5b('0x1'));var machine=require(_0x3b5b('0x2'));var exec=require(_0x3b5b('0x3'))['execSync'];var config=require(_0x3b5b('0x4'));function getInterfaces(){var _0x427a03=[];var _0x2e8dee=os[_0x3b5b('0x5')]();var _0x4677e3=_['orderBy'](_[_0x3b5b('0x6')](_0x2e8dee));for(var _0x134533=0x0;_0x134533<_0x4677e3[_0x3b5b('0x7')];_0x134533++){var _0xad7d57=_0x2e8dee[_0x4677e3[_0x134533]][_0x3b5b('0x8')](function(_0x4394cb){return _0x4394cb[_0x3b5b('0x9')]===_0x3b5b('0xa')&&_0x4394cb[_0x3b5b('0xb')]===![];});_0x427a03=_0x427a03[_0x3b5b('0xc')](_0xad7d57);}return _0x427a03;}function getFirstInterface(){var _0x403bc8=_[_0x3b5b('0xd')](getInterfaces());return{'macAddress':_0x403bc8&&_0x403bc8[_0x3b5b('0xe')]?_0x403bc8[_0x3b5b('0xe')]:_0x3b5b('0xf'),'ipAddress':_0x403bc8&&_0x403bc8['address']?_0x403bc8[_0x3b5b('0x10')]:_0x3b5b('0x11')};}exports[_0x3b5b('0x12')]=getFirstInterface;function getCPUhash(){var _0x551ba1=_[_0x3b5b('0x13')](os[_0x3b5b('0x14')]()[_0x3b5b('0x15')](function(_0x51f4b0){return _0x51f4b0[_0x3b5b('0x16')];}))[_0x3b5b('0x17')](':');return crypto[_0x3b5b('0x18')](_0x3b5b('0x19'))[_0x3b5b('0x1a')](_0x551ba1)['digest'](_0x3b5b('0x1b'));}exports[_0x3b5b('0x1c')]=function(){var _0x359d7a=os[_0x3b5b('0x1d')]();var _0x1664c7=/[0-9a-f-]{36}/;if(config[_0x3b5b('0x1e')]&&_0x1664c7[_0x3b5b('0x1f')](config['licenseToken'])){return config[_0x3b5b('0x1e')];}else if(_0x359d7a===_0x3b5b('0x20')){return exec(_0x3b5b('0x21'),{'encoding':_0x3b5b('0x22')})[_0x3b5b('0x23')]('\x0d\x0a','');}else{var _0x36755c=getFirstInterface();var _0x2dd608=getCPUhash();var _0x58b733=_0x2dd608+'|'+os['hostname']()+'|'+_0x36755c[_0x3b5b('0x24')]+'|'+_0x36755c[_0x3b5b('0x25')];var _0x2b12b0=crypto[_0x3b5b('0x18')](_0x3b5b('0x19'))[_0x3b5b('0x1a')](_0x58b733)[_0x3b5b('0x26')](_0x3b5b('0x1b'));return _0x2b12b0[_0x3b5b('0x27')](0x0,0x8)+'-'+_0x2b12b0[_0x3b5b('0x27')](0x8,0xc)+'-'+_0x2b12b0[_0x3b5b('0x27')](0xc,0x10)+'-'+_0x2b12b0['substring'](0x10,0x14)+'-'+_0x2b12b0[_0x3b5b('0x27')](0x14);}}; \ No newline at end of file +var _0x7eea=['createHash','md5','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model'];(function(_0x6c2e59,_0x306384){var _0x18c88f=function(_0x21cf6d){while(--_0x21cf6d){_0x6c2e59['push'](_0x6c2e59['shift']());}};_0x18c88f(++_0x306384);}(_0x7eea,0x9b));var _0xa7ee=function(_0x122349,_0xffd1a2){_0x122349=_0x122349-0x0;var _0xf337b0=_0x7eea[_0x122349];return _0xf337b0;};'use strict';var _=require(_0xa7ee('0x0'));var os=require('os');var crypto=require(_0xa7ee('0x1'));var machine=require(_0xa7ee('0x2'));var exec=require(_0xa7ee('0x3'))[_0xa7ee('0x4')];var config=require(_0xa7ee('0x5'));function getInterfaces(){var _0x243525=[];var _0x35e282=os['networkInterfaces']();var _0x267626=_[_0xa7ee('0x6')](_['keys'](_0x35e282));for(var _0x8a02ac=0x0;_0x8a02ac<_0x267626[_0xa7ee('0x7')];_0x8a02ac++){var _0x462d68=_0x35e282[_0x267626[_0x8a02ac]][_0xa7ee('0x8')](function(_0x381eeb){return _0x381eeb[_0xa7ee('0x9')]===_0xa7ee('0xa')&&_0x381eeb[_0xa7ee('0xb')]===![];});_0x243525=_0x243525[_0xa7ee('0xc')](_0x462d68);}return _0x243525;}function getFirstInterface(){var _0x1cbbde=_[_0xa7ee('0xd')](getInterfaces());return{'macAddress':_0x1cbbde&&_0x1cbbde[_0xa7ee('0xe')]?_0x1cbbde[_0xa7ee('0xe')]:_0xa7ee('0xf'),'ipAddress':_0x1cbbde&&_0x1cbbde[_0xa7ee('0x10')]?_0x1cbbde[_0xa7ee('0x10')]:_0xa7ee('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5b3675=_['orderBy'](os[_0xa7ee('0x12')]()['map'](function(_0x3d23bf){return _0x3d23bf[_0xa7ee('0x13')];}))['join'](':');return crypto[_0xa7ee('0x14')](_0xa7ee('0x15'))[_0xa7ee('0x16')](_0x5b3675)[_0xa7ee('0x17')](_0xa7ee('0x18'));}exports[_0xa7ee('0x19')]=function(){var _0x209b9d=os[_0xa7ee('0x1a')]();var _0x372265=/[0-9a-f-]{36}/;if(config[_0xa7ee('0x1b')]&&_0x372265['test'](config['licenseToken'])){return config['licenseToken'];}else if(_0x209b9d===_0xa7ee('0x1c')){return exec(_0xa7ee('0x1d'),{'encoding':_0xa7ee('0x1e')})['replace']('\x0d\x0a','');}else{var _0x4662a0=getFirstInterface();var _0x372f26=getCPUhash();var _0x5d69cc=_0x372f26+'|'+os[_0xa7ee('0x1f')]()+'|'+_0x4662a0[_0xa7ee('0x20')]+'|'+_0x4662a0[_0xa7ee('0x21')];var _0x46006b=crypto[_0xa7ee('0x14')](_0xa7ee('0x15'))[_0xa7ee('0x16')](_0x5d69cc)[_0xa7ee('0x17')](_0xa7ee('0x18'));return _0x46006b[_0xa7ee('0x22')](0x0,0x8)+'-'+_0x46006b[_0xa7ee('0x22')](0x8,0xc)+'-'+_0x46006b[_0xa7ee('0x22')](0xc,0x10)+'-'+_0x46006b[_0xa7ee('0x22')](0x10,0x14)+'-'+_0x46006b[_0xa7ee('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0da2414..fa6720e 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 _0x65ae=['catch','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','GET','then'];(function(_0x9c173a,_0x461c9c){var _0x88d611=function(_0x4900c7){while(--_0x4900c7){_0x9c173a['push'](_0x9c173a['shift']());}};_0x88d611(++_0x461c9c);}(_0x65ae,0x1bf));var _0xe65a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x65ae[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xe65a('0x0'));var moment=require('moment');var rp=require(_0xe65a('0x1'));var BPromise=require(_0xe65a('0x2'));var pkginfo=require(_0xe65a('0x3'))(module,_0xe65a('0x4'));var db=require(_0xe65a('0x5'))['db'];var encryptor=require(_0xe65a('0x6'));var hardware=require(_0xe65a('0x7'));var logger=require(_0xe65a('0x8'))(_0xe65a('0x9'));var HOST=_0xe65a('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x244fef){return new BPromise(function(_0x1f294f,_0x1d3c23){var _0x36234e=util[_0xe65a('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x244fef,module[_0xe65a('0xc')][_0xe65a('0x4')]);if(oldToken){_0x36234e=util[_0xe65a('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x244fef,module[_0xe65a('0xc')]['version'],oldToken);}var _0x3541f3={'uri':_0x36234e,'method':_0xe65a('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3541f3)[_0xe65a('0xe')](function(_0xa5be0f){_0x1f294f(_0xa5be0f);})[_0xe65a('0xf')](function(_0x301e19){_0x1d3c23(_0x301e19);});});}function manageLicense(_0x580aa5,_0x2f4747){var _0x4f7beb=_0x2f4747['get']({'plain':!![]});if(!isOldTokenSent&&_0x4f7beb[_0xe65a('0x10')]!==_0x580aa5&&!_0x4f7beb['data2']){oldToken=_0x4f7beb['data1'];}httpRequest(_0x580aa5)[_0xe65a('0xe')](function(_0xf445d8){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xf445d8[_0xe65a('0x11')]){isOldTokenSent=![];if(!_0x4f7beb[_0xe65a('0x9')]&&_0x4f7beb[_0xe65a('0x9')]!=_0xf445d8[_0xe65a('0x9')]||_0x4f7beb[_0xe65a('0x9')]&&_0x4f7beb['data2']){logger[_0xe65a('0x12')](_0xe65a('0x13'));}if(_0x4f7beb[_0xe65a('0x9')]&&!_0x4f7beb[_0xe65a('0x14')]&&_0x4f7beb['license']!=_0xf445d8[_0xe65a('0x9')]){logger[_0xe65a('0x12')](_0xe65a('0x15'));}if(_0x4f7beb['license']&&!_0x4f7beb['data2']&&_0x4f7beb[_0xe65a('0x9')]==_0xf445d8[_0xe65a('0x9')]){return _0x2f4747;}return _0x2f4747[_0xe65a('0x16')]({'data1':_0x580aa5,'data2':null,'license':_0xf445d8[_0xe65a('0x9')]});}else{if(_0xf445d8[_0xe65a('0x9')]||_0x4f7beb[_0xe65a('0x9')]){if(!_0x4f7beb['data2']){if(_0x4f7beb[_0xe65a('0x10')]==_0x580aa5){GRAY_PERIOD_REASON=_0xe65a('0x17');logger[_0xe65a('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xe65a('0x18');logger[_0xe65a('0x12')](_0xe65a('0x19'),_0x4f7beb[_0xe65a('0x10')],_0x580aa5);}logger[_0xe65a('0x12')](_0xe65a('0x1a'),GRAY_PERIOD_REASON[_0xe65a('0x1b')](),moment()['format'](_0xe65a('0x1c')));return _0x2f4747[_0xe65a('0x16')]({'data2':encryptor[_0xe65a('0x1d')](moment()[_0xe65a('0xb')](_0xe65a('0x1c')))});}else{if(moment()[_0xe65a('0x1e')](encryptor[_0xe65a('0x1f')](_0x4f7beb['data2']),_0xe65a('0x20'))>DAYS){logger[_0xe65a('0x12')](_0xe65a('0x21'),moment()[_0xe65a('0xb')](_0xe65a('0x1c')));isOldTokenSent=![];return _0x2f4747[_0xe65a('0x16')]({'data1':_0x580aa5,'data2':null,'license':null});}}}else{if(_0x4f7beb[_0xe65a('0x10')]!=_0x580aa5){logger[_0xe65a('0x12')](_0xe65a('0x19'),_0x4f7beb[_0xe65a('0x10')],_0x580aa5);return _0x2f4747['update']({'data1':_0x580aa5,'data2':null,'license':null});}}}return _0x2f4747;})[_0xe65a('0xe')](function(_0x170dbe){_0x2f4747=_0x170dbe;})[_0xe65a('0xf')](function(_0x420fac){logger[_0xe65a('0x22')](_0x420fac[_0xe65a('0x23')]);})[_0xe65a('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xe65a('0x25')](),_0x2f4747);},TIME);});}function defaultLicense(){var _0x4ad9cb=hardware[_0xe65a('0x25')]();if(_0x4ad9cb){return db[_0xe65a('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4ad9cb}})[_0xe65a('0x27')](function(_0x475bf2,_0x37c7b2){logger['info'](_0xe65a('0x28'),_0x4ad9cb);manageLicense(_0x4ad9cb,_0x475bf2);})['catch'](function(_0x2ad351){logger[_0xe65a('0x22')](_0x2ad351[_0xe65a('0x23')]);});}}exports[_0xe65a('0x29')]=defaultLicense; \ No newline at end of file +var _0x3394=['error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s'];(function(_0x5bc345,_0x460f27){var _0x3c9c9c=function(_0x2c096a){while(--_0x2c096a){_0x5bc345['push'](_0x5bc345['shift']());}};_0x3c9c9c(++_0x460f27);}(_0x3394,0x159));var _0x4339=function(_0x4f1414,_0x3e233f){_0x4f1414=_0x4f1414-0x0;var _0x13ff06=_0x3394[_0x4f1414];return _0x13ff06;};'use strict';var util=require(_0x4339('0x0'));var moment=require(_0x4339('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x4339('0x2'))(module,_0x4339('0x3'));var db=require(_0x4339('0x4'))['db'];var encryptor=require(_0x4339('0x5'));var hardware=require(_0x4339('0x6'));var logger=require(_0x4339('0x7'))('license');var HOST=_0x4339('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x590e97){return new BPromise(function(_0x50894e,_0x489984){var _0x3143b9=util[_0x4339('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x590e97,module['exports'][_0x4339('0x3')]);if(oldToken){_0x3143b9=util[_0x4339('0x9')](_0x4339('0xa'),HOST,_0x590e97,module['exports'][_0x4339('0x3')],oldToken);}var _0x3d9bd1={'uri':_0x3143b9,'method':_0x4339('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x3d9bd1)[_0x4339('0xc')](function(_0x5a8cf4){_0x50894e(_0x5a8cf4);})[_0x4339('0xd')](function(_0x103b35){_0x489984(_0x103b35);});});}function manageLicense(_0xac6829,_0x1cbf91){var _0x578882=_0x1cbf91[_0x4339('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x578882['data1']!==_0xac6829&&!_0x578882[_0x4339('0xf')]){oldToken=_0x578882[_0x4339('0x10')];}httpRequest(_0xac6829)[_0x4339('0xc')](function(_0x2d2013){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2d2013[_0x4339('0x11')]){isOldTokenSent=![];if(!_0x578882['license']&&_0x578882[_0x4339('0x12')]!=_0x2d2013[_0x4339('0x12')]||_0x578882[_0x4339('0x12')]&&_0x578882['data2']){logger[_0x4339('0x13')](_0x4339('0x14'));}if(_0x578882[_0x4339('0x12')]&&!_0x578882[_0x4339('0xf')]&&_0x578882['license']!=_0x2d2013[_0x4339('0x12')]){logger[_0x4339('0x13')](_0x4339('0x15'));}if(_0x578882['license']&&!_0x578882[_0x4339('0xf')]&&_0x578882[_0x4339('0x12')]==_0x2d2013['license']){return _0x1cbf91;}return _0x1cbf91[_0x4339('0x16')]({'data1':_0xac6829,'data2':null,'license':_0x2d2013[_0x4339('0x12')]});}else{if(_0x2d2013[_0x4339('0x12')]||_0x578882[_0x4339('0x12')]){if(!_0x578882[_0x4339('0xf')]){if(_0x578882[_0x4339('0x10')]==_0xac6829){GRAY_PERIOD_REASON='Disabled';logger[_0x4339('0x13')](_0x4339('0x17'));}else{GRAY_PERIOD_REASON=_0x4339('0x18');logger[_0x4339('0x13')](_0x4339('0x19'),_0x578882[_0x4339('0x10')],_0xac6829);}logger[_0x4339('0x13')](_0x4339('0x1a'),GRAY_PERIOD_REASON[_0x4339('0x1b')](),moment()[_0x4339('0x9')](_0x4339('0x1c')));return _0x1cbf91[_0x4339('0x16')]({'data2':encryptor[_0x4339('0x1d')](moment()[_0x4339('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x4339('0x1e')](encryptor[_0x4339('0x1f')](_0x578882[_0x4339('0xf')]),'days')>DAYS){logger['info'](_0x4339('0x20'),moment()['format'](_0x4339('0x1c')));isOldTokenSent=![];return _0x1cbf91['update']({'data1':_0xac6829,'data2':null,'license':null});}}}else{if(_0x578882[_0x4339('0x10')]!=_0xac6829){logger[_0x4339('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x578882[_0x4339('0x10')],_0xac6829);return _0x1cbf91[_0x4339('0x16')]({'data1':_0xac6829,'data2':null,'license':null});}}}return _0x1cbf91;})[_0x4339('0xc')](function(_0x5cb254){_0x1cbf91=_0x5cb254;})[_0x4339('0xd')](function(_0x4a6a6e){logger[_0x4339('0x21')](_0x4a6a6e[_0x4339('0x22')]);})[_0x4339('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x1cbf91);},TIME);});}function defaultLicense(){var _0x3c9a13=hardware[_0x4339('0x24')]();if(_0x3c9a13){return db[_0x4339('0x25')][_0x4339('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3c9a13}})[_0x4339('0x27')](function(_0x58549e,_0x40bb51){logger[_0x4339('0x13')](_0x4339('0x28'),_0x3c9a13);manageLicense(_0x3c9a13,_0x58549e);})[_0x4339('0xd')](function(_0x2aeb66){logger['error'](_0x2aeb66[_0x4339('0x22')]);});}}exports[_0x4339('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e850ea9..af8d9d2 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 _0xc43c=['data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','uuid','message','User','findAll','role','COUNT','sequelize','count','telephone','users','admin','user','pick','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','License\x20key\x20value\x20not\x20found'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc43c,0x160));var _0xcc43=function(_0x594e0c,_0x33af52){_0x594e0c=_0x594e0c-0x0;var _0x3ca818=_0xc43c[_0x594e0c];return _0x3ca818;};'use strict';var util=require(_0xcc43('0x0'));var _=require(_0xcc43('0x1'));var moment=require(_0xcc43('0x2'));var BPromise=require(_0xcc43('0x3'));var hardware=require('./hardware');var encryptor=require(_0xcc43('0x4'));var db=require(_0xcc43('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcc43('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcc43('0x7'),'machineUuid':hardware[_0xcc43('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcc43('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcc43('0x9'),'machineUuid':hardware[_0xcc43('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5058c1){return new BPromise(function(_0xcf570,_0x5dcd4c){return db[_0xcc43('0xa')][_0xcc43('0xb')](_[_0xcc43('0xc')](_0x5058c1,{'raw':!![],'where':{'id':0x1}}))[_0xcc43('0xd')](function(_0x5ac6d2){return checkLicense(_0x5ac6d2,null);})[_0xcc43('0xd')](function(_0x3c3e16){_0xcf570(_0x3c3e16);return;})[_0xcc43('0xe')](function(_0x1622e9){_0x5dcd4c(_0x1622e9);});});}function checkLicense(_0xfb4d8b,_0x404568){if(!_0xfb4d8b){demoLicense['uuid']=_0xfb4d8b['data1'];return demoLicense;}try{var _0x3d058a=_0x404568||_0xfb4d8b['license'];if(_['isEmpty'](_0x3d058a)){throw new Error(_0xcc43('0xf'));}var _0x54b207=_0xfb4d8b[_0xcc43('0x10')];var _0x4ef799=_0xfb4d8b[_0xcc43('0x11')];var _0x5858ec=_0x54b207[_0xcc43('0x12')]('-')[0x4];var _0x2881d7=_0x54b207['split']('-')[0x0];var _0x44b077=encryptor[_0xcc43('0x13')](_0x3d058a,util[_0xcc43('0x14')](_0xcc43('0x15'),_0x5858ec,_0x54b207,_0x2881d7));var _0x57c102=JSON[_0xcc43('0x16')](_0x44b077);_0x57c102[_0xcc43('0x17')]=![];_0x57c102['uuid']=_0x54b207;_0x57c102[_0xcc43('0x18')]=hardware[_0xcc43('0x8')]();if(_0x4ef799){var _0x2f8e86=encryptor[_0xcc43('0x13')](_0x4ef799);_0x57c102[_0xcc43('0x19')]=_0x2f8e86;_0x57c102[_0xcc43('0x1a')]=moment(_0x2f8e86)[_0xcc43('0x1b')](0x7,_0xcc43('0x1c'))['format']();_0x57c102[_0xcc43('0x1d')]=_0x57c102['uuid']!=_0x57c102[_0xcc43('0x18')]?_0xcc43('0x1e'):_0xcc43('0x1f');}return _0x57c102;}catch(_0x303db1){breakingLicense[_0xcc43('0x20')]=_0xfb4d8b['data1'];breakingLicense[_0xcc43('0x21')]=_0x303db1['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x44e680,_0x20d58c){getLicense()[_0xcc43('0xd')](function(_0x440753){return db[_0xcc43('0x22')][_0xcc43('0x23')]({'attributes':[_0xcc43('0x24'),[db['sequelize']['fn'](_0xcc43('0x25'),db[_0xcc43('0x26')]['col'](_0xcc43('0x24'))),_0xcc43('0x27')]],'group':_0xcc43('0x24'),'where':{'role':{'$or':['admin','user',_0xcc43('0x28')]}},'raw':!![]})['then'](function(_0x4aa0c7){var _0x4d3b37={'user':_0x440753[_0xcc43('0x29')]||0x0,'telephone':_0x440753['telephones']||0x0};_0x4aa0c7['forEach'](function(_0x3efee0){var _0x2eaa8d=_0x3efee0[_0xcc43('0x24')]===_0xcc43('0x2a')?_0xcc43('0x2b'):_0x3efee0['role'];_0x4d3b37[_0x2eaa8d]-=_0x3efee0[_0xcc43('0x27')];if(_0x4d3b37[_0x2eaa8d]<0x0)_0x4d3b37[_0x2eaa8d]=0x0;});_0x44e680(_0x4d3b37);return;});})[_0xcc43('0xe')](function(_0x24d178){_0x20d58c(_0x24d178);});});}function checkUserLimits(_0x1ae9ae){return new BPromise(function(_0x342dd5,_0x548209){getLimits()['then'](function(_0x54fbd8){var _0x373a3e=_[_0xcc43('0x2c')](_['countBy'](_0x1ae9ae,'role'),[_0xcc43('0x2a'),'user','telephone']);var _0x4259c5=(_0x373a3e['admin']||0x0)+(_0x373a3e['user']||0x0);var _0xab32bb=_0x373a3e[_0xcc43('0x28')]||0x0;if(_0x4259c5>_0x54fbd8[_0xcc43('0x2b')])return _0x548209('License\x20limit\x20reached\x20for\x20users');if(_0xab32bb>_0x54fbd8['telephone'])return _0x548209(_0xcc43('0x2d'));return _0x342dd5();})[_0xcc43('0xe')](function(_0x11442b){_0x548209(_0x11442b);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8f61=['COUNT','sequelize','col','count','admin','user','telephone','telephones','countBy','util','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','data1','license','isEmpty','data2','split','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','days','grayReason','changed','disabled','message','User','findAll','role'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8f61,0x1ad));var _0x18f6=function(_0x4d5c54,_0x566974){_0x4d5c54=_0x4d5c54-0x0;var _0x3f8f26=_0x8f61[_0x4d5c54];return _0x3f8f26;};'use strict';var util=require(_0x18f6('0x0'));var _=require('lodash');var moment=require(_0x18f6('0x1'));var BPromise=require('bluebird');var hardware=require(_0x18f6('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x18f6('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18f6('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x18f6('0x5'),'machineUuid':hardware[_0x18f6('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18f6('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x18f6('0x7'),'machineUuid':hardware[_0x18f6('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x26db33){return new BPromise(function(_0x177dde,_0x214da1){return db[_0x18f6('0x8')][_0x18f6('0x9')](_['defaults'](_0x26db33,{'raw':!![],'where':{'id':0x1}}))[_0x18f6('0xa')](function(_0x325730){return checkLicense(_0x325730,null);})['then'](function(_0x148bd8){_0x177dde(_0x148bd8);return;})[_0x18f6('0xb')](function(_0x3ed192){_0x214da1(_0x3ed192);});});}function checkLicense(_0x2bfb1d,_0x543c55){if(!_0x2bfb1d){demoLicense['uuid']=_0x2bfb1d[_0x18f6('0xc')];return demoLicense;}try{var _0x47f593=_0x543c55||_0x2bfb1d[_0x18f6('0xd')];if(_[_0x18f6('0xe')](_0x47f593)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2f1e8e=_0x2bfb1d[_0x18f6('0xc')];var _0x41cd6c=_0x2bfb1d[_0x18f6('0xf')];var _0x13a911=_0x2f1e8e[_0x18f6('0x10')]('-')[0x4];var _0x56700f=_0x2f1e8e[_0x18f6('0x10')]('-')[0x0];var _0x25a0fc=encryptor['decryptString'](_0x47f593,util[_0x18f6('0x11')](_0x18f6('0x12'),_0x13a911,_0x2f1e8e,_0x56700f));var _0x5a15bf=JSON[_0x18f6('0x13')](_0x25a0fc);_0x5a15bf[_0x18f6('0x14')]=![];_0x5a15bf[_0x18f6('0x15')]=_0x2f1e8e;_0x5a15bf[_0x18f6('0x16')]=hardware[_0x18f6('0x6')]();if(_0x41cd6c){var _0x2ed9f2=encryptor['decryptString'](_0x41cd6c);_0x5a15bf[_0x18f6('0x17')]=_0x2ed9f2;_0x5a15bf[_0x18f6('0x18')]=moment(_0x2ed9f2)['add'](0x7,_0x18f6('0x19'))[_0x18f6('0x11')]();_0x5a15bf[_0x18f6('0x1a')]=_0x5a15bf[_0x18f6('0x15')]!=_0x5a15bf[_0x18f6('0x16')]?_0x18f6('0x1b'):_0x18f6('0x1c');}return _0x5a15bf;}catch(_0x1cde86){breakingLicense[_0x18f6('0x15')]=_0x2bfb1d[_0x18f6('0xc')];breakingLicense[_0x18f6('0x1d')]=_0x1cde86['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5ec247,_0x31bf24){getLicense()[_0x18f6('0xa')](function(_0x1ca2d3){return db[_0x18f6('0x1e')][_0x18f6('0x1f')]({'attributes':[_0x18f6('0x20'),[db['sequelize']['fn'](_0x18f6('0x21'),db[_0x18f6('0x22')][_0x18f6('0x23')](_0x18f6('0x20'))),_0x18f6('0x24')]],'group':_0x18f6('0x20'),'where':{'role':{'$or':[_0x18f6('0x25'),_0x18f6('0x26'),_0x18f6('0x27')]}},'raw':!![]})[_0x18f6('0xa')](function(_0x4c4518){var _0x11880b={'user':_0x1ca2d3['users']||0x0,'telephone':_0x1ca2d3[_0x18f6('0x28')]||0x0};_0x4c4518['forEach'](function(_0x11df5d){var _0x33293b=_0x11df5d[_0x18f6('0x20')]==='admin'?_0x18f6('0x26'):_0x11df5d['role'];_0x11880b[_0x33293b]-=_0x11df5d[_0x18f6('0x24')];if(_0x11880b[_0x33293b]<0x0)_0x11880b[_0x33293b]=0x0;});_0x5ec247(_0x11880b);return;});})[_0x18f6('0xb')](function(_0x5578f4){_0x31bf24(_0x5578f4);});});}function checkUserLimits(_0x592d17){return new BPromise(function(_0x2643bf,_0x29b3ea){getLimits()[_0x18f6('0xa')](function(_0x546bc4){var _0x4d7b8b=_['pick'](_[_0x18f6('0x29')](_0x592d17,_0x18f6('0x20')),[_0x18f6('0x25'),_0x18f6('0x26'),_0x18f6('0x27')]);var _0x5bab3a=(_0x4d7b8b[_0x18f6('0x25')]||0x0)+(_0x4d7b8b[_0x18f6('0x26')]||0x0);var _0x40932e=_0x4d7b8b[_0x18f6('0x27')]||0x0;if(_0x5bab3a>_0x546bc4[_0x18f6('0x26')])return _0x29b3ea('License\x20limit\x20reached\x20for\x20users');if(_0x40932e>_0x546bc4[_0x18f6('0x27')])return _0x29b3ea('License\x20limit\x20reached\x20for\x20telephones');return _0x2643bf();})[_0x18f6('0xb')](function(_0x5742df){_0x29b3ea(_0x5742df);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 3a09e6b..394570f 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 _0x15e8=['app-id','secret','http://localhost:9000'];(function(_0x412b2a,_0x11fb8a){var _0x5872e3=function(_0x202191){while(--_0x202191){_0x412b2a['push'](_0x412b2a['shift']());}};_0x5872e3(++_0x11fb8a);}(_0x15e8,0x13d));var _0x815e=function(_0x35dae4,_0x232bff){_0x35dae4=_0x35dae4-0x0;var _0x5bc99a=_0x15e8[_0x35dae4];return _0x5bc99a;};'use strict';module['exports']={'DOMAIN':_0x815e('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x815e('0x1'),'GOOGLE_SECRET':_0x815e('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x1777=['app-id','exports','myappanuglar-secret'];(function(_0x3d3015,_0x333ffb){var _0x346bf8=function(_0x367ca5){while(--_0x367ca5){_0x3d3015['push'](_0x3d3015['shift']());}};_0x346bf8(++_0x333ffb);}(_0x1777,0x1e1));var _0x7177=function(_0x49c07a,_0x518336){_0x49c07a=_0x49c07a-0x0;var _0x2422f0=_0x1777[_0x49c07a];return _0x2422f0;};'use strict';module[_0x7177('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x7177('0x1'),'GOOGLE_ID':_0x7177('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 0686898..02d0d8d 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x146a=['File','info','env','debugLevel','moment','winston','util','path','join','/var','log','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','transports','%s-%s','error'];(function(_0x30141f,_0x6e1fc0){var _0x4323cb=function(_0x5f84a9){while(--_0x5f84a9){_0x30141f['push'](_0x30141f['shift']());}};_0x4323cb(++_0x6e1fc0);}(_0x146a,0x9a));var _0xa146=function(_0x5ba8fc,_0x3120dd){_0x5ba8fc=_0x5ba8fc-0x0;var _0x974890=_0x146a[_0x5ba8fc];return _0x974890;};'use strict';var moment=require(_0xa146('0x0'));var winston=require(_0xa146('0x1'));var util=require(_0xa146('0x2'));var path=require(_0xa146('0x3'));var debugLevel='INFO';function filename(_0x15f5e4,_0x4bc88d){return path[_0xa146('0x4')](_0xa146('0x5'),_0xa146('0x6'),_0xa146('0x7'),util[_0xa146('0x8')](_0xa146('0x9'),_0x15f5e4,_0x4bc88d));}function formatter(_0x4ae904,_0x9014ff){_0x9014ff[_0xa146('0xa')]=_0x9014ff[_0xa146('0xa')][_0xa146('0xb')](/@@{/g,'{{{')['replace'](/}@@/g,_0xa146('0xc'))[_0xa146('0xb')](/@{/g,'{{')[_0xa146('0xb')](/}@/g,'}}');return util[_0xa146('0x8')](_0xa146('0xd'),moment()[_0xa146('0x8')](_0xa146('0xe')),_0x9014ff[_0xa146('0xf')][_0xa146('0x10')](),_0x4ae904,_0x9014ff[_0xa146('0xa')]);}module[_0xa146('0x11')]=function(_0x38506c){return new winston['Logger']({'transports':[new winston[(_0xa146('0x12'))]['File']({'name':util[_0xa146('0x8')](_0xa146('0x13'),_0x38506c,'error'),'filename':filename(_0x38506c,_0xa146('0x14')),'level':_0xa146('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4ca92e){return formatter(_0x38506c,_0x4ca92e);}}),new winston[(_0xa146('0x12'))][(_0xa146('0x15'))]({'name':util[_0xa146('0x8')](_0xa146('0x13'),_0x38506c,'info'),'filename':filename(_0x38506c,'info'),'level':_0xa146('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7ed163){return formatter(_0x38506c,_0x7ed163);}}),new winston[(_0xa146('0x12'))]['Console']({'level':process[_0xa146('0x17')][_0xa146('0x18')]||debugLevel,'json':![],'formatter':function(_0x2e068f){return formatter(_0x38506c,_0x2e068f);}})]});}; \ No newline at end of file +var _0x2dc5=['exports','transports','File','%s-%s','error','info','env','moment','winston','util','path','INFO','join','xcally','format','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x552f33,_0x437bd7){var _0x52ccab=function(_0x5b61f9){while(--_0x5b61f9){_0x552f33['push'](_0x552f33['shift']());}};_0x52ccab(++_0x437bd7);}(_0x2dc5,0xed));var _0x52dc=function(_0x3793ed,_0x43c147){_0x3793ed=_0x3793ed-0x0;var _0x2d976e=_0x2dc5[_0x3793ed];return _0x2d976e;};'use strict';var moment=require(_0x52dc('0x0'));var winston=require(_0x52dc('0x1'));var util=require(_0x52dc('0x2'));var path=require(_0x52dc('0x3'));var debugLevel=_0x52dc('0x4');function filename(_0x110d02,_0x239dc3){return path[_0x52dc('0x5')]('/var','log',_0x52dc('0x6'),util[_0x52dc('0x7')]('%s-%s.log',_0x110d02,_0x239dc3));}function formatter(_0x16bceb,_0x163c2f){_0x163c2f['message']=_0x163c2f[_0x52dc('0x8')]['replace'](/@@{/g,_0x52dc('0x9'))[_0x52dc('0xa')](/}@@/g,_0x52dc('0xb'))[_0x52dc('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x52dc('0x7')](_0x52dc('0xc'),moment()['format'](_0x52dc('0xd')),_0x163c2f[_0x52dc('0xe')][_0x52dc('0xf')](),_0x16bceb,_0x163c2f[_0x52dc('0x8')]);}module[_0x52dc('0x10')]=function(_0x1b212f){return new winston['Logger']({'transports':[new winston[(_0x52dc('0x11'))][(_0x52dc('0x12'))]({'name':util[_0x52dc('0x7')](_0x52dc('0x13'),_0x1b212f,_0x52dc('0x14')),'filename':filename(_0x1b212f,_0x52dc('0x14')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x306152){return formatter(_0x1b212f,_0x306152);}}),new winston[(_0x52dc('0x11'))][(_0x52dc('0x12'))]({'name':util[_0x52dc('0x7')](_0x52dc('0x13'),_0x1b212f,_0x52dc('0x15')),'filename':filename(_0x1b212f,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x91ec88){return formatter(_0x1b212f,_0x91ec88);}}),new winston[(_0x52dc('0x11'))]['Console']({'level':process[_0x52dc('0x16')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x3e1120){return formatter(_0x1b212f,_0x3e1120);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 4f676ff..f257faa 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 _0xd044=['ami','join','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','express'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xd044,0x136));var _0x4d04=function(_0x8b247d,_0x9401a9){_0x8b247d=_0x8b247d-0x0;var _0x4e10a3=_0xd044[_0x8b247d];return _0x4e10a3;};'use strict';var path=require(_0x4d04('0x0'));var os=require('os');var config={'apps':[{'name':_0x4d04('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x4d04('0x2'),'script':path[_0x4d04('0x3')](__dirname,_0x4d04('0x4'))},{'name':'agi','script':path['join'](__dirname,_0x4d04('0x5'))},{'name':_0x4d04('0x6'),'script':path[_0x4d04('0x3')](__dirname,_0x4d04('0x7'))},{'name':_0x4d04('0x8'),'script':path[_0x4d04('0x3')](__dirname,_0x4d04('0x9'))},{'name':_0x4d04('0xa'),'script':path[_0x4d04('0x3')](__dirname,'../../services/xdr/index.js')}]};module[_0x4d04('0xb')]=config; \ No newline at end of file +var _0x7f6d=['join','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7f6d,0x100));var _0xd7f6=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x7f6d[_0x2dea24];return _0x309d58;};'use strict';var path=require(_0xd7f6('0x0'));var os=require('os');var config={'apps':[{'name':_0xd7f6('0x1'),'script':path['join'](__dirname,_0xd7f6('0x2'))},{'name':_0xd7f6('0x3'),'script':path[_0xd7f6('0x4')](__dirname,_0xd7f6('0x5'))},{'name':_0xd7f6('0x6'),'script':path[_0xd7f6('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0xd7f6('0x7'),'script':path[_0xd7f6('0x4')](__dirname,_0xd7f6('0x8'))},{'name':_0xd7f6('0x9'),'script':path[_0xd7f6('0x4')](__dirname,_0xd7f6('0xa'))},{'name':'xdr','script':path[_0xd7f6('0x4')](__dirname,_0xd7f6('0xb'))}]};module[_0xd7f6('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index bb94574..82a4592 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 _0x88b0=['describe','delete','dump','saved','pm2','bluebird','connect','connected','then','disconnect','stop','restart','list'];(function(_0x195c8d,_0x1a9050){var _0x3ee25e=function(_0x388692){while(--_0x388692){_0x195c8d['push'](_0x195c8d['shift']());}};_0x3ee25e(++_0x1a9050);}(_0x88b0,0x1cb));var _0x088b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x88b0[_0x3b380d];return _0x54502b;};'use strict';var pm2=require(_0x088b('0x0'));var BPromise=require(_0x088b('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x550558,_0x3f8d4a){return pm2[_0x088b('0x2')](function(_0x28a565){if(_0x28a565){return _0x3f8d4a(_0x28a565);}return _0x550558(_0x088b('0x3'));});});};exports['start']=function(_0x211dfb){return connect()[_0x088b('0x4')](function(){return new BPromise(function(_0xc1e9cd,_0x5af8a4){return pm2['start'](_0x211dfb,function(_0xfd98a3,_0xa5a81f){if(_0xfd98a3){return _0x5af8a4(_0xfd98a3);}pm2[_0x088b('0x5')]();return _0xc1e9cd(_0xa5a81f);});});});};exports[_0x088b('0x6')]=function(_0x321629){return connect()[_0x088b('0x4')](function(){return new BPromise(function(_0x40436c,_0x4fd94e){return pm2[_0x088b('0x6')](_0x321629,function(_0x597a93,_0x2502df){if(_0x597a93){return _0x4fd94e(_0x597a93);}pm2['disconnect']();return _0x40436c(_0x2502df);});});});};exports[_0x088b('0x7')]=function(_0x2c95f1){return connect()['then'](function(){return new BPromise(function(_0x4b6d34,_0x278ce){return pm2[_0x088b('0x7')](_0x2c95f1,function(_0x37bf38,_0x4c8a3b){if(_0x37bf38){return _0x278ce(_0x37bf38);}pm2[_0x088b('0x5')]();return _0x4b6d34(_0x4c8a3b);});});});};exports[_0x088b('0x8')]=function(){return connect()[_0x088b('0x4')](function(){return new BPromise(function(_0x4fa81a,_0x1d2829){return pm2[_0x088b('0x8')](function(_0x1b0771,_0xf6bd53){if(_0x1b0771){return _0x1d2829(_0x1b0771);}pm2[_0x088b('0x5')]();return _0x4fa81a(_0xf6bd53);});});});};exports[_0x088b('0x9')]=function(_0x462392){return connect()['then'](function(){return new BPromise(function(_0x393335,_0x1c1096){return pm2[_0x088b('0x9')](_0x462392,function(_0xdee68a,_0x41bf62){if(_0xdee68a){return _0x1c1096(_0xdee68a);}pm2[_0x088b('0x5')]();return _0x393335(_0x41bf62);});});});};exports['delete']=function(_0x331cb0){return connect()[_0x088b('0x4')](function(){return new BPromise(function(_0x135e00,_0x31d121){return pm2[_0x088b('0xa')](_0x331cb0,function(_0x48a089,_0x4d3265){if(_0x48a089){return _0x31d121(_0x48a089);}pm2[_0x088b('0x5')]();return _0x135e00(_0x4d3265);});});});};exports[_0x088b('0xb')]=function(){return connect()[_0x088b('0x4')](function(){return new BPromise(function(_0x376c8c,_0x3c9c1d){return pm2[_0x088b('0xb')](function(_0x565220){if(_0x565220){return _0x3c9c1d(_0x565220);}return _0x376c8c(_0x088b('0xc'));});});});}; \ No newline at end of file +var _0x1d01=['delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop','disconnect','restart','list','describe'];(function(_0x84b948,_0x1a7a75){var _0x37a855=function(_0x2fd950){while(--_0x2fd950){_0x84b948['push'](_0x84b948['shift']());}};_0x37a855(++_0x1a7a75);}(_0x1d01,0xb7));var _0x11d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d01[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x11d0('0x0'));var BPromise=require(_0x11d0('0x1'));var config=require(_0x11d0('0x2'));function connect(){return new BPromise(function(_0x25b21a,_0x222d4a){return pm2[_0x11d0('0x3')](function(_0x467b74){if(_0x467b74){return _0x222d4a(_0x467b74);}return _0x25b21a(_0x11d0('0x4'));});});};exports[_0x11d0('0x5')]=function(_0x31ce1b){return connect()[_0x11d0('0x6')](function(){return new BPromise(function(_0x3130b1,_0x3617ab){return pm2['start'](_0x31ce1b,function(_0x4ec0e4,_0x502227){if(_0x4ec0e4){return _0x3617ab(_0x4ec0e4);}pm2['disconnect']();return _0x3130b1(_0x502227);});});});};exports['stop']=function(_0x4d93e9){return connect()['then'](function(){return new BPromise(function(_0x3d5c37,_0x1a076a){return pm2[_0x11d0('0x7')](_0x4d93e9,function(_0x5f3ae2,_0x3f9def){if(_0x5f3ae2){return _0x1a076a(_0x5f3ae2);}pm2[_0x11d0('0x8')]();return _0x3d5c37(_0x3f9def);});});});};exports['restart']=function(_0x30564f){return connect()['then'](function(){return new BPromise(function(_0x20e5e3,_0x45e970){return pm2[_0x11d0('0x9')](_0x30564f,function(_0x54c22b,_0x4d66a7){if(_0x54c22b){return _0x45e970(_0x54c22b);}pm2['disconnect']();return _0x20e5e3(_0x4d66a7);});});});};exports[_0x11d0('0xa')]=function(){return connect()[_0x11d0('0x6')](function(){return new BPromise(function(_0xbb6317,_0xe7c36f){return pm2['list'](function(_0x22cd1e,_0x4b57b8){if(_0x22cd1e){return _0xe7c36f(_0x22cd1e);}pm2[_0x11d0('0x8')]();return _0xbb6317(_0x4b57b8);});});});};exports[_0x11d0('0xb')]=function(_0x4a4a4f){return connect()[_0x11d0('0x6')](function(){return new BPromise(function(_0x230cb3,_0x758368){return pm2[_0x11d0('0xb')](_0x4a4a4f,function(_0x27380e,_0x4401c5){if(_0x27380e){return _0x758368(_0x27380e);}pm2['disconnect']();return _0x230cb3(_0x4401c5);});});});};exports[_0x11d0('0xc')]=function(_0x454ae0){return connect()[_0x11d0('0x6')](function(){return new BPromise(function(_0x5db6be,_0x312c38){return pm2['delete'](_0x454ae0,function(_0x5d01c0,_0x417c7d){if(_0x5d01c0){return _0x312c38(_0x5d01c0);}pm2['disconnect']();return _0x5db6be(_0x417c7d);});});});};exports[_0x11d0('0xd')]=function(){return connect()[_0x11d0('0x6')](function(){return new BPromise(function(_0x580408,_0x4ab37a){return pm2[_0x11d0('0xd')](function(_0x310b21){if(_0x310b21){return _0x4ab37a(_0x310b21);}return _0x580408(_0x11d0('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8ed32b5..fdaf351 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 _0xfaa8=['redis','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../mysqldb','../logger','defaults'];(function(_0x110a07,_0x3dcde2){var _0x5428c4=function(_0x2829cd){while(--_0x2829cd){_0x110a07['push'](_0x110a07['shift']());}};_0x5428c4(++_0x3dcde2);}(_0xfaa8,0xa8));var _0x8faa=function(_0x4aa1a8,_0x583251){_0x4aa1a8=_0x4aa1a8-0x0;var _0xee6eb=_0xfaa8[_0x4aa1a8];return _0xee6eb;};'use strict';var _=require(_0x8faa('0x0'));var moment=require(_0x8faa('0x1'));var Redis=require('ioredis');var util=require(_0x8faa('0x2'));var config=require('../../config/environment');var db=require(_0x8faa('0x3'))['db'];var logger=require(_0x8faa('0x4'))('schedule');config['redis']=_[_0x8faa('0x5')](config[_0x8faa('0x6')],{'host':_0x8faa('0x7'),'port':0x18eb});var io=require(_0x8faa('0x8'))(new Redis(config[_0x8faa('0x6')]));function closeInteractions(){var _0x2ebd32=0x0;var _0x2361a1=[];return db['Setting'][_0x8faa('0x9')]({'raw':!![],'attributes':['id',_0x8faa('0xa')],'where':{'id':0x1}})[_0x8faa('0xb')](function(_0x2d7284){_0x2ebd32=_0x2d7284[_0x8faa('0xa')];if(_0x2ebd32){return db[_0x8faa('0xc')][_0x8faa('0xd')]({'raw':!![],'attributes':['id',_0x8faa('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8faa('0xf')](_0x2d7284[_0x8faa('0xa')],_0x8faa('0x10'))}}});}else{return[];}})[_0x8faa('0xb')](function(_0x16533f){if(_0x16533f&&_0x16533f[_0x8faa('0x11')]){_0x2361a1=_['map'](_0x16533f||[],'id');logger[_0x8faa('0x12')](_0x8faa('0x13'),_0x2361a1[_0x8faa('0x14')]());return db[_0x8faa('0xc')][_0x8faa('0x15')]({'closeReason':'system','disposition':_0x8faa('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2361a1}});}})[_0x8faa('0xb')](function(){if(_0x2361a1&&_0x2361a1['length']){logger['info'](_0x8faa('0x17'),_0x2361a1[_0x8faa('0x14')]());for(var _0x18550f=0x0;_0x18550f<_0x2361a1[_0x8faa('0x11')];_0x18550f++){io['emit'](_0x8faa('0x18'),{'id':_0x2361a1[_0x18550f],'closed':!![]});}}})[_0x8faa('0x19')](function(_0x4f430b){logger['error'](_0x8faa('0x1a'),_0x4f430b?util[_0x8faa('0x1b')](_0x4f430b,{'showHidden':![],'depth':null}):'');});}exports[_0x8faa('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6a84=['Setting','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','socket.io-emitter'];(function(_0x5d3eb5,_0x3962ff){var _0x2041f3=function(_0x41ef33){while(--_0x41ef33){_0x5d3eb5['push'](_0x5d3eb5['shift']());}};_0x2041f3(++_0x3962ff);}(_0x6a84,0x74));var _0x46a8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6a84[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var moment=require(_0x46a8('0x0'));var Redis=require(_0x46a8('0x1'));var util=require(_0x46a8('0x2'));var config=require(_0x46a8('0x3'));var db=require(_0x46a8('0x4'))['db'];var logger=require('../logger')(_0x46a8('0x5'));config[_0x46a8('0x6')]=_['defaults'](config[_0x46a8('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x46a8('0x7'))(new Redis(config[_0x46a8('0x6')]));function closeInteractions(){var _0x41e148=0x0;var _0x5c2e76=[];return db[_0x46a8('0x8')]['find']({'raw':!![],'attributes':['id',_0x46a8('0x9')],'where':{'id':0x1}})['then'](function(_0xb8a2a7){_0x41e148=_0xb8a2a7[_0x46a8('0x9')];if(_0x41e148){return db[_0x46a8('0xa')][_0x46a8('0xb')]({'raw':!![],'attributes':['id',_0x46a8('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xb8a2a7['chatTimeout'],_0x46a8('0xd'))}}});}else{return[];}})[_0x46a8('0xe')](function(_0x2ec3a4){if(_0x2ec3a4&&_0x2ec3a4[_0x46a8('0xf')]){_0x5c2e76=_[_0x46a8('0x10')](_0x2ec3a4||[],'id');logger[_0x46a8('0x11')](_0x46a8('0x12'),_0x5c2e76[_0x46a8('0x13')]());return db[_0x46a8('0xa')][_0x46a8('0x14')]({'closeReason':_0x46a8('0x15'),'disposition':_0x46a8('0x16'),'closed':!![],'closedAt':moment()[_0x46a8('0x17')](_0x46a8('0x18'))},{'where':{'id':_0x5c2e76}});}})[_0x46a8('0xe')](function(){if(_0x5c2e76&&_0x5c2e76[_0x46a8('0xf')]){logger[_0x46a8('0x11')](_0x46a8('0x19'),_0x5c2e76[_0x46a8('0x13')]());for(var _0x497a5a=0x0;_0x497a5a<_0x5c2e76[_0x46a8('0xf')];_0x497a5a++){io[_0x46a8('0x1a')](_0x46a8('0x1b'),{'id':_0x5c2e76[_0x497a5a],'closed':!![]});}}})[_0x46a8('0x1c')](function(_0x414cb5){logger[_0x46a8('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x414cb5?util[_0x46a8('0x1e')](_0x414cb5,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index be8b9ad..f0179f0 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 _0xe4f5=['exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','startAt','update','update\x20cron','stop','run','util','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','join','../../files/reports','savename','basename','zip','existsSync','status','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','Sent','message','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe4f5,0xd2));var _0x5e4f=function(_0x21ed01,_0xadb758){_0x21ed01=_0x21ed01-0x0;var _0xbb8683=_0xe4f5[_0x21ed01];return _0xbb8683;};'use strict';var fs=require('fs');var util=require(_0x5e4f('0x0'));var path=require(_0x5e4f('0x1'));var _=require('lodash');var moment=require(_0x5e4f('0x2'));var CronJobManager=require(_0x5e4f('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x5e4f('0x4'));var logger=require(_0x5e4f('0x5'))(_0x5e4f('0x6'));var db=require(_0x5e4f('0x7'))['db'];var analyticCustomReportController=require(_0x5e4f('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x5e4f('0x9')][_0x5e4f('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3bb17b,_0x2ec30c){return function(){logger[_0x5e4f('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x3bb17b[_0x5e4f('0xc')]);var _0x583045=!![];var _0xe821b2={'tls':{'rejectUnauthorized':![]}};if(_0x3bb17b[_0x5e4f('0xd')]['Smtp'][_0x5e4f('0xe')]){_0xe821b2[_0x5e4f('0xe')]=_0x3bb17b[_0x5e4f('0xd')][_0x5e4f('0xf')][_0x5e4f('0xe')];}else{_0xe821b2[_0x5e4f('0x10')]=_0x3bb17b[_0x5e4f('0xd')][_0x5e4f('0xf')][_0x5e4f('0x10')];_0xe821b2[_0x5e4f('0x11')]=_0x3bb17b['MailAccount']['Smtp'][_0x5e4f('0x11')];_0xe821b2['secure']=_0x3bb17b[_0x5e4f('0xd')][_0x5e4f('0xf')][_0x5e4f('0x12')];}if(_0x3bb17b['MailAccount'][_0x5e4f('0xf')][_0x5e4f('0x13')]){_0xe821b2[_0x5e4f('0x14')]={'user':_0x3bb17b[_0x5e4f('0xd')][_0x5e4f('0xf')][_0x5e4f('0x15')],'pass':_0x3bb17b[_0x5e4f('0xd')][_0x5e4f('0xf')]['pass']};}var _0x97b985={'account':_0xe821b2,'message':{'from':util[_0x5e4f('0x16')](_0x5e4f('0x17'),_0x3bb17b[_0x5e4f('0xd')][_0x5e4f('0x18')],_0x3bb17b[_0x5e4f('0xd')]['email']||_0x3bb17b[_0x5e4f('0xd')][_0x5e4f('0xf')][_0x5e4f('0x15')]),'to':_0x3bb17b['email'],'cc':_0x3bb17b['cc'],'bcc':_0x3bb17b[_0x5e4f('0x19')],'subject':util[_0x5e4f('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x2ec30c['name'],_0x3bb17b[_0x5e4f('0x1a')],_0x3bb17b['subtractUnit'])}};var _0x4ccefd=path[_0x5e4f('0x1b')](__dirname,_0x5e4f('0x1c'));var _0x5a0861=_0x2ec30c[_0x5e4f('0x1d')];var _0x5de47c=util[_0x5e4f('0x16')]('%s.%s',path[_0x5e4f('0x1e')](_0x2ec30c[_0x5e4f('0x1d')],path['extname'](_0x2ec30c[_0x5e4f('0x1d')])),_0x5e4f('0x1f'));var _0x6a33fa=path['join'](_0x4ccefd,_0x5a0861);var _0x47d762=path[_0x5e4f('0x1b')](_0x4ccefd,_0x5de47c);if(fs[_0x5e4f('0x20')](_0x6a33fa)){_0x2ec30c[_0x5e4f('0x21')]='Sent';_0x97b985['message'][_0x5e4f('0x22')]=[{'filename':_0x5a0861,'path':_0x6a33fa}];_0x97b985['message'][_0x5e4f('0x23')]=util[_0x5e4f('0x16')](_0x5e4f('0x24'),JSON[_0x5e4f('0x25')](_0x2ec30c,null,0x2));}else if(fs[_0x5e4f('0x20')](_0x47d762)){_0x2ec30c[_0x5e4f('0x21')]=_0x5e4f('0x26');_0x97b985[_0x5e4f('0x27')]['attachments']=[{'filename':_0x5de47c,'path':_0x47d762}];}else{_0x97b985['message'][_0x5e4f('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3bb17b[_0x5e4f('0x28')]){_0x583045=![];logger[_0x5e4f('0xb')](_0x5e4f('0x29'));}}if(_0x583045){return client[_0x5e4f('0x2a')](_0x5e4f('0x2b'),_0x97b985)[_0x5e4f('0x2c')](function(_0x42b7dd){if(_0x42b7dd['error']){return logger[_0x5e4f('0x2d')](_0x5e4f('0x2e'),JSON[_0x5e4f('0x25')](_0x42b7dd));}return logger['info'](_0x5e4f('0x2f'));})[_0x5e4f('0x30')](function(_0x398290){return logger[_0x5e4f('0x2d')](_0x5e4f('0x2e'),JSON[_0x5e4f('0x25')](_0x398290));});}};}function handleError(){return function(_0x2b9b64){return logger['error'](JSON[_0x5e4f('0x25')](_0x2b9b64));};}function handleResult(_0x4820d2){return function(_0x5289db){logger[_0x5e4f('0xb')]('data',JSON[_0x5e4f('0x25')](_0x5289db));if(_0x4820d2['MailAccount']&&_0x4820d2[_0x5e4f('0xd')][_0x5e4f('0xf')]&&!_[_0x5e4f('0x31')](_0x4820d2[_0x5e4f('0xc')])){setTimeout(handleSendEmail(_0x4820d2,_0x5289db),0x3c*0x3e8);}};}function handleJob(_0x22113b){return function(){try{if(_[_0x5e4f('0x31')](_0x22113b[_0x5e4f('0x1a')])){return logger[_0x5e4f('0xb')](_0x5e4f('0x32'));}if(_['isNil'](_0x22113b[_0x5e4f('0x33')])){return logger[_0x5e4f('0xb')](_0x5e4f('0x34'));}var _0x4f2e9c={'startDate':moment()['subtract'](_0x22113b['subtractNumber'],_0x22113b[_0x5e4f('0x33')])['format'](_0x5e4f('0x35')),'endDate':moment()[_0x5e4f('0x16')](_0x5e4f('0x35')),'type':_0x5e4f('0x36'),'output':_0x22113b[_0x5e4f('0x37')],'name':_0x22113b[_0x5e4f('0x18')]};if(!_[_0x5e4f('0x31')](_0x22113b[_0x5e4f('0x38')])){logger['info'](_0x5e4f('0x39'),_0x22113b[_0x5e4f('0x38')]);return analyticDefaultReportController[_0x5e4f('0x3a')]({'id':_0x22113b[_0x5e4f('0x38')]},_0x4f2e9c)[_0x5e4f('0x2c')](handleResult(_0x22113b))[_0x5e4f('0x30')](handleError());}if(!_[_0x5e4f('0x31')](_0x22113b[_0x5e4f('0x3b')])){logger['info'](_0x5e4f('0x3c'),_0x22113b['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x22113b[_0x5e4f('0x3b')]},_0x4f2e9c)[_0x5e4f('0x2c')](handleResult(_0x22113b))['catch'](handleError());}}catch(_0x4e91ad){logger[_0x5e4f('0x2d')](JSON[_0x5e4f('0x25')](_0x4e91ad));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x4d7801){var _0x4f58a6={};if(_0x4d7801){_0x4f58a6['id']=_0x4d7801;}return db['Schedule'][_0x5e4f('0x3d')]({'where':_0x4f58a6,'include':[{'model':db[_0x5e4f('0xd')],'attributes':['id',_0x5e4f('0x18'),_0x5e4f('0xc')],'include':[{'model':db[_0x5e4f('0x3e')],'as':_0x5e4f('0xf')}]}]})[_0x5e4f('0x2c')](function(_0x3ff8a0){var _0x3c792b=_[_0x5e4f('0x3f')](manager[_0x5e4f('0x40')]);var _0x11780b=_['map'](_0x3ff8a0,function(_0x2aaca2){return _0x2aaca2['id'][_0x5e4f('0x41')]();});var _0x27f589=_[_0x5e4f('0x42')](_0x3ff8a0,function(_0x16d4bf){return _0x16d4bf['id'][_0x5e4f('0x41')]();});var _0x437406=_0x4d7801?_0x11780b:_[_0x5e4f('0x43')](_0x11780b,_0x3c792b);var _0x518972=_[_0x5e4f('0x44')](_0x11780b,_0x3c792b);var _0x21cbe2=_[_0x5e4f('0x43')](_0x3c792b,_0x11780b);var _0x8f1905;var _0x2e843c;for(_0x8f1905=0x0;_0x8f1905<_0x21cbe2[_0x5e4f('0x45')]&&!_0x4d7801;_0x8f1905+=0x1){_0x2e843c=_0x21cbe2[_0x8f1905][_0x5e4f('0x41')]();if(manager[_0x5e4f('0x46')](_0x2e843c)){manager['stop'](_0x2e843c);manager[_0x5e4f('0x47')](_0x2e843c);logger['info'](_0x5e4f('0x48'),_0x2e843c);}}logger['info'](_0x5e4f('0x49'),JSON[_0x5e4f('0x25')](_0x437406));for(_0x8f1905=0x0;_0x8f1905<_0x437406[_0x5e4f('0x45')];_0x8f1905+=0x1){_0x2e843c=_0x437406[_0x8f1905][_0x5e4f('0x41')]();logger[_0x5e4f('0xb')](_0x5e4f('0x4a'),_0x2e843c);if(_0x4d7801){logger[_0x5e4f('0xb')](_0x5e4f('0x4b'),_0x4d7801);logger[_0x5e4f('0xb')](JSON[_0x5e4f('0x25')](_0x27f589[_0x2e843c]));BPromise[_0x5e4f('0x4c')]()[_0x5e4f('0x2c')](handleJob(_0x27f589[_0x2e843c]));logger[_0x5e4f('0xb')](_0x5e4f('0x4d'),_0x27f589[_0x2e843c][_0x5e4f('0x18')],_0x27f589[_0x2e843c][_0x5e4f('0x4e')]);}else if(_0x27f589[_0x2e843c][_0x5e4f('0x4e')]&&_0x27f589[_0x2e843c][_0x5e4f('0x4f')]&&moment()[_0x5e4f('0x50')](_0x27f589[_0x2e843c]['startAt'],_0x27f589[_0x2e843c][_0x5e4f('0x51')])){manager[_0x5e4f('0x52')](_0x2e843c,_0x27f589[_0x2e843c]['cron'],handleJob(_0x27f589[_0x2e843c]));manager[_0x5e4f('0x53')](_0x2e843c);logger[_0x5e4f('0xb')](_0x5e4f('0x54'),_0x27f589[_0x2e843c]['name'],_0x27f589[_0x2e843c][_0x5e4f('0x4e')]);}else if(manager['exists'](_0x2e843c)){manager['stop'](_0x2e843c);manager[_0x5e4f('0x47')](_0x2e843c);logger[_0x5e4f('0xb')]('stop\x20cron',_0x27f589[_0x2e843c]['name'],_0x27f589[_0x2e843c]['cron']);}}for(_0x8f1905=0x0,_0x2e843c;_0x8f1905<_0x518972[_0x5e4f('0x45')]&&!_0x4d7801;_0x8f1905+=0x1){_0x2e843c=_0x518972[_0x8f1905][_0x5e4f('0x41')]();if(manager['exists'](_0x2e843c)){if(_0x27f589[_0x2e843c][_0x5e4f('0x4e')]&&_0x27f589[_0x2e843c][_0x5e4f('0x4f')]&&moment()['isBetween'](_0x27f589[_0x2e843c][_0x5e4f('0x55')],_0x27f589[_0x2e843c]['endAt'])){manager[_0x5e4f('0x56')](_0x2e843c,_0x27f589[_0x2e843c][_0x5e4f('0x4e')],handleJob(_0x27f589[_0x2e843c]));logger[_0x5e4f('0xb')](_0x5e4f('0x57'),_0x27f589[_0x2e843c]['name'],_0x27f589[_0x2e843c][_0x5e4f('0x4e')]);}else{manager[_0x5e4f('0x58')](_0x2e843c);manager['deleteJob'](_0x2e843c);logger['info']('stop\x20cron',_0x27f589[_0x2e843c][_0x5e4f('0x18')],_0x27f589[_0x2e843c][_0x5e4f('0x4e')]);}}}})['catch'](function(_0x18e2a3){logger[_0x5e4f('0x2d')](JSON[_0x5e4f('0x25')](_0x18e2a3));});}exports[_0x5e4f('0x59')]=function(_0x4c973d){return getJobs(_0x4c973d);};exports[_0x5e4f('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x1705=['keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','index','resolve','cron','active','isBetween','endAt','add','start','add\x20cron','startAt','update','update\x20cron','stop\x20cron','run','util','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','Smtp','host','port','secure','user','pass','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Sent','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut'];(function(_0x296231,_0x50b0fb){var _0x1f73e3=function(_0x53e236){while(--_0x53e236){_0x296231['push'](_0x296231['shift']());}};_0x1f73e3(++_0x50b0fb);}(_0x1705,0x122));var _0x5170=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x1705[_0x4cf0b7];return _0x545f10;};'use strict';var fs=require('fs');var util=require(_0x5170('0x0'));var path=require(_0x5170('0x1'));var _=require('lodash');var moment=require(_0x5170('0x2'));var CronJobManager=require(_0x5170('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x5170('0x4'));var logger=require(_0x5170('0x5'))(_0x5170('0x6'));var db=require(_0x5170('0x7'))['db'];var analyticCustomReportController=require(_0x5170('0x8'));var analyticDefaultReportController=require(_0x5170('0x9'));var client=jayson[_0x5170('0xa')][_0x5170('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xb0ed6d,_0x3b8e3e){return function(){logger[_0x5170('0xc')](_0x5170('0xd'),_0xb0ed6d[_0x5170('0xe')]);var _0x3c18d6=!![];var _0x5254fb={'tls':{'rejectUnauthorized':![]}};if(_0xb0ed6d['MailAccount']['Smtp'][_0x5170('0xf')]){_0x5254fb['service']=_0xb0ed6d[_0x5170('0x10')][_0x5170('0x11')][_0x5170('0xf')];}else{_0x5254fb[_0x5170('0x12')]=_0xb0ed6d[_0x5170('0x10')]['Smtp']['host'];_0x5254fb['port']=_0xb0ed6d['MailAccount'][_0x5170('0x11')][_0x5170('0x13')];_0x5254fb[_0x5170('0x14')]=_0xb0ed6d[_0x5170('0x10')][_0x5170('0x11')][_0x5170('0x14')];}if(_0xb0ed6d[_0x5170('0x10')]['Smtp']['authentication']){_0x5254fb['auth']={'user':_0xb0ed6d[_0x5170('0x10')][_0x5170('0x11')][_0x5170('0x15')],'pass':_0xb0ed6d[_0x5170('0x10')]['Smtp'][_0x5170('0x16')]};}var _0x5d31cf={'account':_0x5254fb,'message':{'from':util[_0x5170('0x17')](_0x5170('0x18'),_0xb0ed6d['MailAccount'][_0x5170('0x19')],_0xb0ed6d['MailAccount'][_0x5170('0xe')]||_0xb0ed6d['MailAccount'][_0x5170('0x11')][_0x5170('0x15')]),'to':_0xb0ed6d[_0x5170('0xe')],'cc':_0xb0ed6d['cc'],'bcc':_0xb0ed6d['bcc'],'subject':util['format'](_0x5170('0x1a'),_0x3b8e3e[_0x5170('0x19')],_0xb0ed6d['subtractNumber'],_0xb0ed6d[_0x5170('0x1b')])}};var _0x59d740=path[_0x5170('0x1c')](__dirname,_0x5170('0x1d'));var _0x214b67=_0x3b8e3e[_0x5170('0x1e')];var _0xea0aba=util[_0x5170('0x17')](_0x5170('0x1f'),path[_0x5170('0x20')](_0x3b8e3e[_0x5170('0x1e')],path[_0x5170('0x21')](_0x3b8e3e[_0x5170('0x1e')])),_0x5170('0x22'));var _0x4c4467=path['join'](_0x59d740,_0x214b67);var _0x45f4e6=path[_0x5170('0x1c')](_0x59d740,_0xea0aba);if(fs[_0x5170('0x23')](_0x4c4467)){_0x3b8e3e['status']='Sent';_0x5d31cf['message']['attachments']=[{'filename':_0x214b67,'path':_0x4c4467}];_0x5d31cf[_0x5170('0x24')][_0x5170('0x25')]=util['format'](_0x5170('0x26'),JSON[_0x5170('0x27')](_0x3b8e3e,null,0x2));}else if(fs[_0x5170('0x23')](_0x45f4e6)){_0x3b8e3e[_0x5170('0x28')]=_0x5170('0x29');_0x5d31cf['message'][_0x5170('0x2a')]=[{'filename':_0xea0aba,'path':_0x45f4e6}];}else{_0x5d31cf['message'][_0x5170('0x25')]=_0x5170('0x2b');if(!_0xb0ed6d['sendIfEmpty']){_0x3c18d6=![];logger['info'](_0x5170('0x2c'));}}if(_0x3c18d6){return client[_0x5170('0x2d')]('SendMail',_0x5d31cf)[_0x5170('0x2e')](function(_0x208ba5){if(_0x208ba5[_0x5170('0x2f')]){return logger['error'](_0x5170('0x30'),JSON[_0x5170('0x27')](_0x208ba5));}return logger['info']('email\x20sent');})['catch'](function(_0xf60079){return logger[_0x5170('0x2f')](_0x5170('0x30'),JSON[_0x5170('0x27')](_0xf60079));});}};}function handleError(){return function(_0x147682){return logger[_0x5170('0x2f')](JSON[_0x5170('0x27')](_0x147682));};}function handleResult(_0x4b0dbf){return function(_0x1f3817){logger[_0x5170('0xc')](_0x5170('0x31'),JSON[_0x5170('0x27')](_0x1f3817));if(_0x4b0dbf[_0x5170('0x10')]&&_0x4b0dbf[_0x5170('0x10')]['Smtp']&&!_['isNil'](_0x4b0dbf[_0x5170('0xe')])){setTimeout(handleSendEmail(_0x4b0dbf,_0x1f3817),0x3c*0x3e8);}};}function handleJob(_0x30dedf){return function(){try{if(_[_0x5170('0x32')](_0x30dedf[_0x5170('0x33')])){return logger[_0x5170('0xc')](_0x5170('0x34'));}if(_['isNil'](_0x30dedf[_0x5170('0x1b')])){return logger[_0x5170('0xc')](_0x5170('0x35'));}var _0xf79e61={'startDate':moment()['subtract'](_0x30dedf[_0x5170('0x33')],_0x30dedf[_0x5170('0x1b')])[_0x5170('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x5170('0x17')](_0x5170('0x36')),'type':_0x5170('0x37'),'output':_0x30dedf[_0x5170('0x38')],'name':_0x30dedf[_0x5170('0x19')]};if(!_[_0x5170('0x32')](_0x30dedf[_0x5170('0x39')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x30dedf[_0x5170('0x39')]);return analyticDefaultReportController[_0x5170('0x3a')]({'id':_0x30dedf[_0x5170('0x39')]},_0xf79e61)['then'](handleResult(_0x30dedf))[_0x5170('0x3b')](handleError());}if(!_[_0x5170('0x32')](_0x30dedf[_0x5170('0x3c')])){logger[_0x5170('0xc')](_0x5170('0x3d'),_0x30dedf[_0x5170('0x3c')]);return analyticCustomReportController[_0x5170('0x3a')]({'id':_0x30dedf[_0x5170('0x3c')]},_0xf79e61)[_0x5170('0x2e')](handleResult(_0x30dedf))['catch'](handleError());}}catch(_0x530fb3){logger['error'](JSON[_0x5170('0x27')](_0x530fb3));}return logger[_0x5170('0xc')](_0x5170('0x3e'));};}function getJobs(_0x38b2c6){var _0x42b2c0={};if(_0x38b2c6){_0x42b2c0['id']=_0x38b2c6;}return db[_0x5170('0x3f')][_0x5170('0x40')]({'where':_0x42b2c0,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x5170('0xe')],'include':[{'model':db[_0x5170('0x41')],'as':_0x5170('0x11')}]}]})[_0x5170('0x2e')](function(_0x26acbd){var _0x2bcb26=_[_0x5170('0x42')](manager[_0x5170('0x43')]);var _0x1f7920=_['map'](_0x26acbd,function(_0x328a3b){return _0x328a3b['id'][_0x5170('0x44')]();});var _0x639f0b=_[_0x5170('0x45')](_0x26acbd,function(_0x4be02c){return _0x4be02c['id']['toString']();});var _0x49e59d=_0x38b2c6?_0x1f7920:_[_0x5170('0x46')](_0x1f7920,_0x2bcb26);var _0x46a5a3=_[_0x5170('0x47')](_0x1f7920,_0x2bcb26);var _0x5b08cf=_[_0x5170('0x46')](_0x2bcb26,_0x1f7920);var _0x460531;var _0x772922;for(_0x460531=0x0;_0x460531<_0x5b08cf[_0x5170('0x48')]&&!_0x38b2c6;_0x460531+=0x1){_0x772922=_0x5b08cf[_0x460531][_0x5170('0x44')]();if(manager[_0x5170('0x49')](_0x772922)){manager[_0x5170('0x4a')](_0x772922);manager['deleteJob'](_0x772922);logger[_0x5170('0xc')]('delete\x20cron',_0x772922);}}logger[_0x5170('0xc')]('toRun',JSON['stringify'](_0x49e59d));for(_0x460531=0x0;_0x460531<_0x49e59d[_0x5170('0x48')];_0x460531+=0x1){_0x772922=_0x49e59d[_0x460531]['toString']();logger[_0x5170('0xc')](_0x5170('0x4b'),_0x772922);if(_0x38b2c6){logger[_0x5170('0xc')]('my\x20id',_0x38b2c6);logger['info'](JSON[_0x5170('0x27')](_0x639f0b[_0x772922]));BPromise[_0x5170('0x4c')]()[_0x5170('0x2e')](handleJob(_0x639f0b[_0x772922]));logger[_0x5170('0xc')]('run\x20job',_0x639f0b[_0x772922][_0x5170('0x19')],_0x639f0b[_0x772922][_0x5170('0x4d')]);}else if(_0x639f0b[_0x772922]['cron']&&_0x639f0b[_0x772922][_0x5170('0x4e')]&&moment()[_0x5170('0x4f')](_0x639f0b[_0x772922]['startAt'],_0x639f0b[_0x772922][_0x5170('0x50')])){manager[_0x5170('0x51')](_0x772922,_0x639f0b[_0x772922][_0x5170('0x4d')],handleJob(_0x639f0b[_0x772922]));manager[_0x5170('0x52')](_0x772922);logger[_0x5170('0xc')](_0x5170('0x53'),_0x639f0b[_0x772922][_0x5170('0x19')],_0x639f0b[_0x772922][_0x5170('0x4d')]);}else if(manager['exists'](_0x772922)){manager[_0x5170('0x4a')](_0x772922);manager['deleteJob'](_0x772922);logger[_0x5170('0xc')]('stop\x20cron',_0x639f0b[_0x772922][_0x5170('0x19')],_0x639f0b[_0x772922][_0x5170('0x4d')]);}}for(_0x460531=0x0,_0x772922;_0x460531<_0x46a5a3[_0x5170('0x48')]&&!_0x38b2c6;_0x460531+=0x1){_0x772922=_0x46a5a3[_0x460531][_0x5170('0x44')]();if(manager['exists'](_0x772922)){if(_0x639f0b[_0x772922][_0x5170('0x4d')]&&_0x639f0b[_0x772922][_0x5170('0x4e')]&&moment()['isBetween'](_0x639f0b[_0x772922][_0x5170('0x54')],_0x639f0b[_0x772922][_0x5170('0x50')])){manager[_0x5170('0x55')](_0x772922,_0x639f0b[_0x772922][_0x5170('0x4d')],handleJob(_0x639f0b[_0x772922]));logger[_0x5170('0xc')](_0x5170('0x56'),_0x639f0b[_0x772922][_0x5170('0x19')],_0x639f0b[_0x772922][_0x5170('0x4d')]);}else{manager[_0x5170('0x4a')](_0x772922);manager['deleteJob'](_0x772922);logger['info'](_0x5170('0x57'),_0x639f0b[_0x772922][_0x5170('0x19')],_0x639f0b[_0x772922][_0x5170('0x4d')]);}}}})[_0x5170('0x3b')](function(_0x54c80a){logger[_0x5170('0x2f')](JSON[_0x5170('0x27')](_0x54c80a));});}exports[_0x5170('0x58')]=function(_0x1b79e4){return getJobs(_0x1b79e4);};exports[_0x5170('0x52')]=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 ffb53d3..3546237 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 _0xf98e=['TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','language','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','transcribeAccountId','Transcribe\x20not\x20configured','push','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript'];(function(_0x585eb8,_0x31a008){var _0x56dd25=function(_0x46247e){while(--_0x46247e){_0x585eb8['push'](_0x585eb8['shift']());}};_0x56dd25(++_0x31a008);}(_0xf98e,0x1d1));var _0xef98=function(_0x2617cf,_0x85a49f){_0x2617cf=_0x2617cf-0x0;var _0x3edf6a=_0xf98e[_0x2617cf];return _0x3edf6a;};var _=require(_0xef98('0x0'));var AWS=require(_0xef98('0x1'));var rp=require(_0xef98('0x2'));var util=require(_0xef98('0x3'));var BPromise=require(_0xef98('0x4'));var db=require(_0xef98('0x5'))['db'];var logger=require(_0xef98('0x6'))(_0xef98('0x7'));function getTranscriptionJob(_0x1b5774,_0x7019ee,_0xe64d5f,_0x45eb1f){return new Promise(function(_0x248d34,_0x242c5d){var _0x4c6e08=new AWS[(_0xef98('0x8'))]({'accessKeyId':_0x7019ee,'secretAccessKey':_0x1b5774,'region':_0xe64d5f});_0x4c6e08['getTranscriptionJob']({'TranscriptionJobName':_0x45eb1f},function(_0x4f1acd,_0x419b07){if(_0x4f1acd){return _0x242c5d(_0x4f1acd);}else{return _0x248d34(_0x419b07);}});});}function sentiment(_0x1be49c,_0x2abe94,_0x2485f5,_0x5759f5,_0x4b15f1){return new Promise(function(_0x1a496f,_0x47b39a){var _0x53cfd4=new AWS[(_0xef98('0x9'))]({'accessKeyId':_0x2abe94,'secretAccessKey':_0x1be49c,'region':_0x2485f5});_0x53cfd4[_0xef98('0xa')]({'Text':_0x5759f5,'LanguageCode':_0x4b15f1[_0xef98('0xb')](0x0,0x2)},function(_0x4749ad,_0x550489){if(_0x4749ad){return _0x47b39a(_0x4749ad);}else{return _0x1a496f(_0x550489);}});});}function checkTranscribeJob(_0x11d033,_0xfb5479,_0x5927d2){var _0x43cd62;return new BPromise(function(_0x5d9fbf,_0x3c8637){logger[_0xef98('0xc')](util[_0xef98('0xd')](_0xef98('0xe'),_0x11d033['id'],_0x11d033[_0xef98('0xf')]));return getTranscriptionJob(_0x5927d2[_0xef98('0x10')],_0x5927d2[_0xef98('0x11')],_0xfb5479[_0xef98('0x12')],_0x11d033[_0xef98('0xf')])['then'](function(_0x29282f){logger[_0xef98('0xc')](util['format'](_0xef98('0x13'),_0x11d033['id'],_0x11d033[_0xef98('0xf')],_0x29282f['TranscriptionJob'][_0xef98('0x14')]));if(!_0x11d033[_0xef98('0x15')]){switch(_0x29282f['TranscriptionJob'][_0xef98('0x14')]){case _0xef98('0x16'):var _0x4a6106={'transcribeStatus':_0x29282f[_0xef98('0x17')][_0xef98('0x14')],'fileUri':_0x29282f[_0xef98('0x17')][_0xef98('0x18')][_0xef98('0x19')]};logger[_0xef98('0xc')](util['format'](_0xef98('0x1a'),_0x11d033['id']));return rp({'uri':_0x29282f[_0xef98('0x17')][_0xef98('0x18')][_0xef98('0x19')],'json':!![]})[_0xef98('0x1b')](function(_0x218c71){logger[_0xef98('0xc')](util[_0xef98('0xd')](_0xef98('0x1c'),_0x11d033['id']));if(_0x218c71&&_0x218c71['results']&&_0x218c71[_0xef98('0x1d')][_0xef98('0x1e')]&&_0x218c71[_0xef98('0x1d')][_0xef98('0x1e')][_0xef98('0x1f')]){_0x4a6106[_0xef98('0x15')]='';for(var _0x2c40de=0x0;_0x2c40de<_0x218c71[_0xef98('0x1d')][_0xef98('0x1e')]['length'];_0x2c40de++){_0x4a6106[_0xef98('0x15')]+=_0x218c71[_0xef98('0x1d')][_0xef98('0x1e')][_0x2c40de][_0xef98('0x20')]+'';}}return _0x11d033[_0xef98('0x21')](_0x4a6106);})[_0xef98('0x1b')](function(){logger[_0xef98('0xc')](util['format'](_0xef98('0x22'),_0x11d033['id']));if(!_0x11d033[_0xef98('0x23')]){throw new db['Sequelize']['ValidationError'](_0xef98('0x24'));}if(!_0xfb5479[_0xef98('0x25')]||!_0xfb5479[_0xef98('0x26')]||!_0xfb5479['sentimentRegion']||!_0xfb5479['language']||!_0xfb5479[_0xef98('0x27')]){throw new db[(_0xef98('0x28'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4a6106[_0xef98('0x15')]){throw new Error(_0xef98('0x29'));}if(_0xfb5479[_0xef98('0x26')]===_0x5927d2['id']){return _0x5927d2;}else{return db[_0xef98('0x2a')][_0xef98('0x2b')]({'where':{'id':_settings[_0xef98('0x26')]}});}})[_0xef98('0x1b')](function(_0x33a50e){if(!_0x33a50e){throw new db[(_0xef98('0x28'))][(_0xef98('0x2c'))](_0xef98('0x2d'));}if(!_0x33a50e[_0xef98('0x10')]||!_0x33a50e[_0xef98('0x11')]){throw new db[(_0xef98('0x28'))][(_0xef98('0x2c'))](_0xef98('0x2e'));}_0x43cd62=_0x33a50e;logger[_0xef98('0xc')](util['format'](_0xef98('0x2f'),_0x11d033['id']));return sentiment(_0x43cd62[_0xef98('0x10')],_0x43cd62[_0xef98('0x11')],_0xfb5479[_0xef98('0x30')],_0x4a6106[_0xef98('0x15')],_0xfb5479['language']);})['then'](function(_0x381586){logger[_0xef98('0xc')](util[_0xef98('0xd')](_0xef98('0x31'),_0x11d033['id']));return _0x11d033[_0xef98('0x21')]({'sentiment':_0x381586['Sentiment'],'sPositive':_0x381586[_0xef98('0x32')][_0xef98('0x33')],'sNegative':_0x381586[_0xef98('0x32')][_0xef98('0x34')],'sMixed':_0x381586[_0xef98('0x32')][_0xef98('0x35')],'sNeutral':_0x381586[_0xef98('0x32')][_0xef98('0x36')]});})[_0xef98('0x1b')](function(){logger[_0xef98('0xc')](util[_0xef98('0xd')](_0xef98('0x22'),_0x11d033['id']));_0x5d9fbf();});case _0xef98('0x37'):return _0x11d033[_0xef98('0x21')]({'transcribeStatus':'FAILED','failureReason':_0x29282f[_0xef98('0x17')][_0xef98('0x38')]})[_0xef98('0x1b')](function(){logger[_0xef98('0xc')](util[_0xef98('0xd')](_0xef98('0x22'),_0x11d033['id']));_0x5d9fbf();});default:logger[_0xef98('0xc')](util[_0xef98('0xd')](_0xef98('0x39'),_0x11d033['id']));break;}}else{return BPromise['resolve']()[_0xef98('0x1b')](function(){if(!_0x11d033[_0xef98('0x23')]){throw new db[(_0xef98('0x28'))][(_0xef98('0x2c'))](_0xef98('0x24'));}if(!_0xfb5479['sentiment']||!_0xfb5479[_0xef98('0x26')]||!_0xfb5479[_0xef98('0x30')]||!_0xfb5479[_0xef98('0x3a')]||!_0xfb5479[_0xef98('0x27')]){throw new db['Sequelize'][(_0xef98('0x2c'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x11d033[_0xef98('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0xfb5479[_0xef98('0x26')]===_0x5927d2['id']){return _0x5927d2;}else{return db[_0xef98('0x2a')][_0xef98('0x2b')]({'where':{'id':_settings[_0xef98('0x26')]}});}})[_0xef98('0x1b')](function(_0x564e47){if(!_0x564e47){throw new db[(_0xef98('0x28'))]['ValidationError'](_0xef98('0x2d'));}if(!_0x564e47[_0xef98('0x10')]||!_0x564e47['data2']){throw new db[(_0xef98('0x28'))][(_0xef98('0x2c'))]('Cloud\x20Provider\x20not\x20configured');}_0x43cd62=_0x564e47;logger[_0xef98('0xc')](util[_0xef98('0xd')](_0xef98('0x2f'),_0x11d033['id']));return sentiment(_0x43cd62[_0xef98('0x10')],_0x43cd62[_0xef98('0x11')],_0xfb5479[_0xef98('0x30')],_0x11d033[_0xef98('0x15')],_0xfb5479[_0xef98('0x3a')]);})[_0xef98('0x1b')](function(_0x850c3){logger['info'](util[_0xef98('0xd')](_0xef98('0x31'),_0x11d033['id']));return _0x11d033[_0xef98('0x21')]({'sentiment':_0x850c3['Sentiment'],'sPositive':_0x850c3[_0xef98('0x32')][_0xef98('0x33')],'sNegative':_0x850c3[_0xef98('0x32')][_0xef98('0x34')],'sMixed':_0x850c3[_0xef98('0x32')][_0xef98('0x35')],'sNeutral':_0x850c3[_0xef98('0x32')][_0xef98('0x36')],'transcribeStatus':_0xef98('0x16')});})[_0xef98('0x1b')](function(){logger[_0xef98('0xc')](util[_0xef98('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x11d033['id']));_0x5d9fbf();});}})['catch'](function(_0x42f830){if(_0x42f830){if(!_0x42f830[_0xef98('0x3b')]||_0x42f830['name']!==_0xef98('0x3c')){logger[_0xef98('0x3d')](util[_0xef98('0xd')](_0xef98('0x3e'),_0x11d033['id']),util[_0xef98('0x3f')](_0x42f830,{'showHidden':![],'depth':null}));}}_0x5d9fbf();});});}function checkTranscribe(){var _0x1c39fd;var _0x31249e;var _0x10792f;return db[_0xef98('0x40')][_0xef98('0x41')]({'where':{'transcribeStatus':_0xef98('0x42')}})[_0xef98('0x1b')](function(_0x330bc8){if(!_0x330bc8||!_0x330bc8[_0xef98('0x1f')]){throw new db['Sequelize'][(_0xef98('0x2c'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1c39fd=_0x330bc8;return db['Setting'][_0xef98('0x2b')]({'where':{'id':0x1}});})[_0xef98('0x1b')](function(_0x1a816b){if(!_0x1a816b){throw new db[(_0xef98('0x28'))][(_0xef98('0x2c'))]('Settings\x20not\x20available');}_0x31249e=_0x1a816b;if(!_0x31249e['transcribe']||!_0x31249e[_0xef98('0x43')]||!_0x31249e[_0xef98('0x12')]||!_0x31249e[_0xef98('0x3a')]||!_0x31249e[_0xef98('0x27')]){throw new db[(_0xef98('0x28'))][(_0xef98('0x2c'))](_0xef98('0x44'));}return db[_0xef98('0x2a')]['findOne']({'where':{'id':_0x31249e[_0xef98('0x43')]}});})[_0xef98('0x1b')](function(_0x240a6a){if(!_0x240a6a){throw new db[(_0xef98('0x28'))][(_0xef98('0x2c'))](_0xef98('0x2d'));}if(!_0x240a6a[_0xef98('0x10')]||!_0x240a6a[_0xef98('0x11')]){throw new db[(_0xef98('0x28'))]['ValidationError'](_0xef98('0x2e'));}_0x10792f=_0x240a6a;var _0x2681ea=[];_0x1c39fd['forEach'](function(_0x1a6992){_0x2681ea[_0xef98('0x45')](checkTranscribeJob(_0x1a6992,_0x31249e,_0x10792f));});return BPromise['all'](_0x2681ea);})['catch'](function(_0xf279df){if(_0xf279df){if(!_0xf279df[_0xef98('0x3b')]||_0xf279df['name']!==_0xef98('0x3c')){logger[_0xef98('0x3d')](util[_0xef98('0x3f')](_0xf279df,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8051=['COMPLETED','catch','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','push','all','start','lodash','bluebird','TranscribeService','getTranscriptionJob','substring','format','transcribeName','data1','transcribeRegion','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','Transcript\x20not\x20available'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x8051,0x9b));var _0x1805=function(_0x4a6317,_0x1ae149){_0x4a6317=_0x4a6317-0x0;var _0x49f5ae=_0x8051[_0x4a6317];return _0x49f5ae;};var _=require(_0x1805('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0x1805('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x95550a,_0x5116e5,_0x8f1ed2,_0x321845){return new Promise(function(_0x269cb0,_0x2b8675){var _0x510b8b=new AWS[(_0x1805('0x2'))]({'accessKeyId':_0x5116e5,'secretAccessKey':_0x95550a,'region':_0x8f1ed2});_0x510b8b[_0x1805('0x3')]({'TranscriptionJobName':_0x321845},function(_0x59e9bc,_0x448524){if(_0x59e9bc){return _0x2b8675(_0x59e9bc);}else{return _0x269cb0(_0x448524);}});});}function sentiment(_0x51d996,_0x48ce03,_0x522532,_0xb276bc,_0x1be409){return new Promise(function(_0x44d7bb,_0x37eb48){var _0x3ae772=new AWS['Comprehend']({'accessKeyId':_0x48ce03,'secretAccessKey':_0x51d996,'region':_0x522532});_0x3ae772['detectSentiment']({'Text':_0xb276bc,'LanguageCode':_0x1be409[_0x1805('0x4')](0x0,0x2)},function(_0x290f59,_0x397d69){if(_0x290f59){return _0x37eb48(_0x290f59);}else{return _0x44d7bb(_0x397d69);}});});}function checkTranscribeJob(_0x34c04c,_0x1d61da,_0x5c2118){var _0x249513;return new BPromise(function(_0x26e45a,_0x1dcbde){logger['info'](util[_0x1805('0x5')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x34c04c['id'],_0x34c04c[_0x1805('0x6')]));return getTranscriptionJob(_0x5c2118[_0x1805('0x7')],_0x5c2118['data2'],_0x1d61da[_0x1805('0x8')],_0x34c04c['transcribeName'])['then'](function(_0x2b56d4){logger[_0x1805('0x9')](util['format'](_0x1805('0xa'),_0x34c04c['id'],_0x34c04c[_0x1805('0x6')],_0x2b56d4['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x34c04c['fileText']){switch(_0x2b56d4[_0x1805('0xb')][_0x1805('0xc')]){case'COMPLETED':var _0x4f1081={'transcribeStatus':_0x2b56d4[_0x1805('0xb')][_0x1805('0xc')],'fileUri':_0x2b56d4[_0x1805('0xb')]['Transcript'][_0x1805('0xd')]};logger['info'](util[_0x1805('0x5')](_0x1805('0xe'),_0x34c04c['id']));return rp({'uri':_0x2b56d4['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0x1805('0xf')](function(_0x3b5c6e){logger['info'](util[_0x1805('0x5')](_0x1805('0x10'),_0x34c04c['id']));if(_0x3b5c6e&&_0x3b5c6e['results']&&_0x3b5c6e[_0x1805('0x11')][_0x1805('0x12')]&&_0x3b5c6e[_0x1805('0x11')][_0x1805('0x12')][_0x1805('0x13')]){_0x4f1081[_0x1805('0x14')]='';for(var _0xe4717b=0x0;_0xe4717b<_0x3b5c6e[_0x1805('0x11')]['transcripts']['length'];_0xe4717b++){_0x4f1081[_0x1805('0x14')]+=_0x3b5c6e[_0x1805('0x11')]['transcripts'][_0xe4717b][_0x1805('0x15')]+'';}}return _0x34c04c['update'](_0x4f1081);})[_0x1805('0xf')](function(){logger[_0x1805('0x9')](util['format'](_0x1805('0x16'),_0x34c04c['id']));if(!_0x34c04c[_0x1805('0x17')]){throw new db['Sequelize'][(_0x1805('0x18'))](_0x1805('0x19'));}if(!_0x1d61da[_0x1805('0x1a')]||!_0x1d61da['sentimentAccountId']||!_0x1d61da['sentimentRegion']||!_0x1d61da[_0x1805('0x1b')]||!_0x1d61da['bucket']){throw new db[(_0x1805('0x1c'))]['ValidationError'](_0x1805('0x1d'));}if(!_0x4f1081[_0x1805('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x1d61da[_0x1805('0x1e')]===_0x5c2118['id']){return _0x5c2118;}else{return db[_0x1805('0x1f')][_0x1805('0x20')]({'where':{'id':_settings[_0x1805('0x1e')]}});}})['then'](function(_0x56c591){if(!_0x56c591){throw new db['Sequelize'][(_0x1805('0x18'))](_0x1805('0x21'));}if(!_0x56c591[_0x1805('0x7')]||!_0x56c591[_0x1805('0x22')]){throw new db[(_0x1805('0x1c'))][(_0x1805('0x18'))](_0x1805('0x23'));}_0x249513=_0x56c591;logger[_0x1805('0x9')](util['format'](_0x1805('0x24'),_0x34c04c['id']));return sentiment(_0x249513[_0x1805('0x7')],_0x249513[_0x1805('0x22')],_0x1d61da[_0x1805('0x25')],_0x4f1081[_0x1805('0x14')],_0x1d61da['language']);})[_0x1805('0xf')](function(_0x1ea2e0){logger[_0x1805('0x9')](util[_0x1805('0x5')](_0x1805('0x26'),_0x34c04c['id']));return _0x34c04c[_0x1805('0x27')]({'sentiment':_0x1ea2e0[_0x1805('0x28')],'sPositive':_0x1ea2e0['SentimentScore'][_0x1805('0x29')],'sNegative':_0x1ea2e0[_0x1805('0x2a')][_0x1805('0x2b')],'sMixed':_0x1ea2e0[_0x1805('0x2a')][_0x1805('0x2c')],'sNeutral':_0x1ea2e0[_0x1805('0x2a')][_0x1805('0x2d')]});})[_0x1805('0xf')](function(){logger[_0x1805('0x9')](util[_0x1805('0x5')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x34c04c['id']));_0x26e45a();});case _0x1805('0x2e'):return _0x34c04c[_0x1805('0x27')]({'transcribeStatus':_0x1805('0x2e'),'failureReason':_0x2b56d4['TranscriptionJob'][_0x1805('0x2f')]})[_0x1805('0xf')](function(){logger[_0x1805('0x9')](util[_0x1805('0x5')](_0x1805('0x16'),_0x34c04c['id']));_0x26e45a();});default:logger[_0x1805('0x9')](util[_0x1805('0x5')](_0x1805('0x30'),_0x34c04c['id']));break;}}else{return BPromise[_0x1805('0x31')]()[_0x1805('0xf')](function(){if(!_0x34c04c[_0x1805('0x17')]){throw new db[(_0x1805('0x1c'))][(_0x1805('0x18'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1d61da['sentiment']||!_0x1d61da['sentimentAccountId']||!_0x1d61da[_0x1805('0x25')]||!_0x1d61da[_0x1805('0x1b')]||!_0x1d61da[_0x1805('0x32')]){throw new db[(_0x1805('0x1c'))]['ValidationError'](_0x1805('0x1d'));}if(!_0x34c04c[_0x1805('0x14')]){throw new Error(_0x1805('0x33'));}if(_0x1d61da['sentimentAccountId']===_0x5c2118['id']){return _0x5c2118;}else{return db[_0x1805('0x1f')][_0x1805('0x20')]({'where':{'id':_settings[_0x1805('0x1e')]}});}})[_0x1805('0xf')](function(_0x28e8c6){if(!_0x28e8c6){throw new db[(_0x1805('0x1c'))]['ValidationError'](_0x1805('0x21'));}if(!_0x28e8c6[_0x1805('0x7')]||!_0x28e8c6[_0x1805('0x22')]){throw new db['Sequelize'][(_0x1805('0x18'))](_0x1805('0x23'));}_0x249513=_0x28e8c6;logger[_0x1805('0x9')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x34c04c['id']));return sentiment(_0x249513[_0x1805('0x7')],_0x249513[_0x1805('0x22')],_0x1d61da[_0x1805('0x25')],_0x34c04c[_0x1805('0x14')],_0x1d61da['language']);})['then'](function(_0x1c74a4){logger[_0x1805('0x9')](util[_0x1805('0x5')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x34c04c['id']));return _0x34c04c[_0x1805('0x27')]({'sentiment':_0x1c74a4[_0x1805('0x28')],'sPositive':_0x1c74a4[_0x1805('0x2a')][_0x1805('0x29')],'sNegative':_0x1c74a4[_0x1805('0x2a')]['Negative'],'sMixed':_0x1c74a4[_0x1805('0x2a')][_0x1805('0x2c')],'sNeutral':_0x1c74a4['SentimentScore'][_0x1805('0x2d')],'transcribeStatus':_0x1805('0x34')});})[_0x1805('0xf')](function(){logger[_0x1805('0x9')](util[_0x1805('0x5')](_0x1805('0x16'),_0x34c04c['id']));_0x26e45a();});}})[_0x1805('0x35')](function(_0xec2d61){if(_0xec2d61){if(!_0xec2d61[_0x1805('0x36')]||_0xec2d61[_0x1805('0x36')]!==_0x1805('0x37')){logger[_0x1805('0x38')](util[_0x1805('0x5')](_0x1805('0x39'),_0x34c04c['id']),util[_0x1805('0x3a')](_0xec2d61,{'showHidden':![],'depth':null}));}}_0x26e45a();});});}function checkTranscribe(){var _0x4844d3;var _0x52c936;var _0x42ade2;return db[_0x1805('0x3b')][_0x1805('0x3c')]({'where':{'transcribeStatus':_0x1805('0x3d')}})[_0x1805('0xf')](function(_0x143bc1){if(!_0x143bc1||!_0x143bc1[_0x1805('0x13')]){throw new db[(_0x1805('0x1c'))]['ValidationError'](_0x1805('0x3e'));}_0x4844d3=_0x143bc1;return db[_0x1805('0x3f')][_0x1805('0x20')]({'where':{'id':0x1}});})[_0x1805('0xf')](function(_0x4a54e0){if(!_0x4a54e0){throw new db[(_0x1805('0x1c'))][(_0x1805('0x18'))](_0x1805('0x40'));}_0x52c936=_0x4a54e0;if(!_0x52c936['transcribe']||!_0x52c936[_0x1805('0x41')]||!_0x52c936[_0x1805('0x8')]||!_0x52c936[_0x1805('0x1b')]||!_0x52c936[_0x1805('0x32')]){throw new db[(_0x1805('0x1c'))][(_0x1805('0x18'))]('Transcribe\x20not\x20configured');}return db[_0x1805('0x1f')][_0x1805('0x20')]({'where':{'id':_0x52c936[_0x1805('0x41')]}});})[_0x1805('0xf')](function(_0xc04b83){if(!_0xc04b83){throw new db[(_0x1805('0x1c'))][(_0x1805('0x18'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xc04b83[_0x1805('0x7')]||!_0xc04b83[_0x1805('0x22')]){throw new db[(_0x1805('0x1c'))][(_0x1805('0x18'))](_0x1805('0x23'));}_0x42ade2=_0xc04b83;var _0x1320be=[];_0x4844d3['forEach'](function(_0x2c81f7){_0x1320be[_0x1805('0x42')](checkTranscribeJob(_0x2c81f7,_0x52c936,_0x42ade2));});return BPromise[_0x1805('0x43')](_0x1320be);})['catch'](function(_0x409046){if(_0x409046){if(!_0x409046[_0x1805('0x36')]||_0x409046['name']!=='SequelizeValidationError'){logger[_0x1805('0x38')](util[_0x1805('0x3a')](_0x409046,{'showHidden':![],'depth':null}));}}});}exports[_0x1805('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 015e39e..4688b4b 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdcc=['timeout','format','join','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','util','../../mysqldb','../logger','schedule','redis','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system'];(function(_0x3aa8f6,_0x26710a){var _0x5bf1d8=function(_0x343c74){while(--_0x343c74){_0x3aa8f6['push'](_0x3aa8f6['shift']());}};_0x5bf1d8(++_0x26710a);}(_0xbdcc,0x89));var _0xcbdc=function(_0x32d78b,_0x2259fc){_0x32d78b=_0x32d78b-0x0;var _0x11999d=_0xbdcc[_0x32d78b];return _0x11999d;};'use strict';var _=require(_0xcbdc('0x0'));var moment=require(_0xcbdc('0x1'));var Redis=require('ioredis');var util=require(_0xcbdc('0x2'));var config=require('../../config/environment');var db=require(_0xcbdc('0x3'))['db'];var logger=require(_0xcbdc('0x4'))(_0xcbdc('0x5'));config[_0xcbdc('0x6')]=_['defaults'](config[_0xcbdc('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xcbdc('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x550a88=[];return db[_0xcbdc('0x8')][_0xcbdc('0x9')]({'raw':!![],'attributes':['id',_0xcbdc('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xcbdc('0xb'))}}})[_0xcbdc('0xc')](function(_0x3d0b2e){if(_0x3d0b2e&&_0x3d0b2e[_0xcbdc('0xd')]){_0x550a88=_[_0xcbdc('0xe')](_0x3d0b2e||[],'id');logger[_0xcbdc('0xf')](_0xcbdc('0x10'),_0x550a88['join']());return db[_0xcbdc('0x8')][_0xcbdc('0x11')]({'closeReason':_0xcbdc('0x12'),'disposition':_0xcbdc('0x13'),'closed':!![],'closedAt':moment()[_0xcbdc('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x550a88}});}})[_0xcbdc('0xc')](function(){if(_0x550a88&&_0x550a88[_0xcbdc('0xd')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x550a88[_0xcbdc('0x15')]());for(var _0x11ac61=0x0;_0x11ac61<_0x550a88[_0xcbdc('0xd')];_0x11ac61++){io[_0xcbdc('0x16')](_0xcbdc('0x17'),{'id':_0x550a88[_0x11ac61],'closed':!![]});}}})['catch'](function(_0x513817){logger[_0xcbdc('0x18')](_0xcbdc('0x19'),_0x513817?util['inspect'](_0x513817,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1068=['[WHATSAPP]\x20Interactions\x20to\x20close:','system','timeout','format','length','join','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','map','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1068,0x7b));var _0x8106=function(_0x58af89,_0x2a9aae){_0x58af89=_0x58af89-0x0;var _0x34d828=_0x1068[_0x58af89];return _0x34d828;};'use strict';var _=require(_0x8106('0x0'));var moment=require(_0x8106('0x1'));var Redis=require(_0x8106('0x2'));var util=require(_0x8106('0x3'));var config=require(_0x8106('0x4'));var db=require(_0x8106('0x5'))['db'];var logger=require(_0x8106('0x6'))('schedule');config[_0x8106('0x7')]=_[_0x8106('0x8')](config[_0x8106('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8106('0x9'))(new Redis(config[_0x8106('0x7')]));function closeInteractions(){var _0x2af84c=[];return db[_0x8106('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x8106('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8106('0xc')](0x18,_0x8106('0xd'))}}})[_0x8106('0xe')](function(_0x2d627a){if(_0x2d627a&&_0x2d627a['length']){_0x2af84c=_[_0x8106('0xf')](_0x2d627a||[],'id');logger[_0x8106('0x10')](_0x8106('0x11'),_0x2af84c['join']());return db['WhatsappInteraction']['update']({'closeReason':_0x8106('0x12'),'disposition':_0x8106('0x13'),'closed':!![],'closedAt':moment()[_0x8106('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2af84c}});}})[_0x8106('0xe')](function(){if(_0x2af84c&&_0x2af84c[_0x8106('0x15')]){logger[_0x8106('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2af84c[_0x8106('0x16')]());for(var _0x582b3f=0x0;_0x582b3f<_0x2af84c[_0x8106('0x15')];_0x582b3f++){io['emit'](_0x8106('0x17'),{'id':_0x2af84c[_0x582b3f],'closed':!![]});}}})[_0x8106('0x18')](function(_0x101732){logger[_0x8106('0x19')](_0x8106('0x1a'),_0x101732?util['inspect'](_0x101732,{'showHidden':![],'depth':null}):'');});}exports[_0x8106('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e679335..d0c65a8 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a0d=['log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','CmContact','bulkCreate'];(function(_0x3ba99b,_0x4f838d){var _0x1c2b56=function(_0x5d9d98){while(--_0x5d9d98){_0x3ba99b['push'](_0x3ba99b['shift']());}};_0x1c2b56(++_0x4f838d);}(_0x8a0d,0x1aa));var _0xd8a0=function(_0x1ba976,_0x5cb880){_0x1ba976=_0x1ba976-0x0;var _0x84cb93=_0x8a0d[_0x1ba976];return _0x84cb93;};'use strict';var util=require(_0xd8a0('0x0'));var db=require(_0xd8a0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd8a0('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xd8a0('0x3')+i,'phone':0xf879fb460+i,'email':_0xd8a0('0x4')+i+_0xd8a0('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd8a0('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd8a0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xd8a0('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd8a0('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xd8a0('0x3')+i,'phone':0xf879fb460+i,'email':_0xd8a0('0x4')+i+_0xd8a0('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd8a0('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd8a0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd8a0('0x6')](),'updatedAt':Date[_0xd8a0('0x6')]()});}db['CmContact'][_0xd8a0('0x7')]({'where':{}})[_0xd8a0('0x8')](function(){return db[_0xd8a0('0x9')][_0xd8a0('0xa')](contacts);})[_0xd8a0('0x8')](function(){console[_0xd8a0('0xb')](_0xd8a0('0xc'),_0xd8a0('0xd'));return db[_0xd8a0('0xe')]['destroy']({'where':{}});})[_0xd8a0('0x8')](function(){return db[_0xd8a0('0xe')]['bulkCreate'](hopper);})['then'](function(){console[_0xd8a0('0xb')](_0xd8a0('0xc'),_0xd8a0('0xf'));return db[_0xd8a0('0x9')][_0xd8a0('0xa')](contacts2);})['then'](function(){console[_0xd8a0('0xb')](_0xd8a0('0xc'),_0xd8a0('0x10'));return db[_0xd8a0('0xe')]['bulkCreate'](hopper2);})[_0xd8a0('0x8')](function(){console[_0xd8a0('0xb')](_0xd8a0('0xc'),_0xd8a0('0x11'));})[_0xd8a0('0x12')](function(_0x5db675){console['log'](_0x5db675);}); \ No newline at end of file +var _0xfe5c=['CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','CmContact','bulkCreate','then','log','finished\x20populating','contacts1'];(function(_0x238b1a,_0x2e4c55){var _0x2d23cc=function(_0x182579){while(--_0x182579){_0x238b1a['push'](_0x238b1a['shift']());}};_0x2d23cc(++_0x2e4c55);}(_0xfe5c,0x134));var _0xcfe5=function(_0x53aa9d,_0x9fde52){_0x53aa9d=_0x53aa9d-0x0;var _0x11b494=_0xfe5c[_0x53aa9d];return _0x11b494;};'use strict';var util=require(_0xcfe5('0x0'));var db=require(_0xcfe5('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xcfe5('0x2')]({'id':i,'firstName':_0xcfe5('0x3')+i,'lastName':_0xcfe5('0x4')+i,'phone':0xf879fb460+i,'email':_0xcfe5('0x5')+i+_0xcfe5('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xcfe5('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xcfe5('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xcfe5('0x7')](),'updatedAt':Date[_0xcfe5('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xcfe5('0x2')]({'id':i,'firstName':_0xcfe5('0x3')+i,'lastName':_0xcfe5('0x4')+i,'phone':0xf879fb460+i,'email':_0xcfe5('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xcfe5('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xcfe5('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xcfe5('0x7')](),'updatedAt':Date[_0xcfe5('0x7')]()});}db['CmContact'][_0xcfe5('0x8')]({'where':{}})['then'](function(){return db[_0xcfe5('0x9')][_0xcfe5('0xa')](contacts);})[_0xcfe5('0xb')](function(){console[_0xcfe5('0xc')](_0xcfe5('0xd'),_0xcfe5('0xe'));return db[_0xcfe5('0xf')][_0xcfe5('0x8')]({'where':{}});})[_0xcfe5('0xb')](function(){return db[_0xcfe5('0xf')][_0xcfe5('0xa')](hopper);})[_0xcfe5('0xb')](function(){console['log'](_0xcfe5('0xd'),_0xcfe5('0x10'));return db['CmContact'][_0xcfe5('0xa')](contacts2);})[_0xcfe5('0xb')](function(){console[_0xcfe5('0xc')](_0xcfe5('0xd'),_0xcfe5('0x11'));return db[_0xcfe5('0xf')][_0xcfe5('0xa')](hopper2);})[_0xcfe5('0xb')](function(){console['log'](_0xcfe5('0xd'),_0xcfe5('0x12'));})['catch'](function(_0xbf8179){console[_0xcfe5('0xc')](_0xbf8179);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index aee1248..8b33f05 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a65=['/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','log','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x4df97a,_0x3180ab){var _0x38ce0e=function(_0x3ce5cd){while(--_0x3ce5cd){_0x4df97a['push'](_0x4df97a['shift']());}};_0x38ce0e(++_0x3180ab);}(_0x6a65,0xc5));var _0x56a6=function(_0xdd1ec3,_0x8d4c0e){_0xdd1ec3=_0xdd1ec3-0x0;var _0x4aa65c=_0x6a65[_0xdd1ec3];return _0x4aa65c;};'use strict';var util=require('util');var db=require(_0x56a6('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x56a6('0x1')]({'name':util[_0x56a6('0x2')](_0x56a6('0x3'),_0x56a6('0x4'),i),'fullname':util[_0x56a6('0x2')]('%s%s','agent',i),'email':util[_0x56a6('0x2')](_0x56a6('0x5'),_0x56a6('0x4'),i),'role':_0x56a6('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x56a6('0x6')],'disallow':[_0x56a6('0x7')],'allow':[_0x56a6('0x8')],'defaultuser':util[_0x56a6('0x2')](_0x56a6('0x3'),'agent',i),'encryption':_0x56a6('0x9'),'avpf':_0x56a6('0x9'),'force_avp':_0x56a6('0x9'),'icesupport':_0x56a6('0x9'),'dtlsenable':_0x56a6('0x9'),'dtlsverify':'no','dtlscertfile':_0x56a6('0xa'),'dtlsprivatekey':_0x56a6('0xb'),'dtlssetup':'actpass','callerid':util[_0x56a6('0x2')](_0x56a6('0xc'),util[_0x56a6('0x2')](_0x56a6('0x3'),'agent',i),0xfa0+i)});}db[_0x56a6('0xd')][_0x56a6('0xe')](users)['then'](function(){console[_0x56a6('0xf')]('add\x20user');})['catch'](function(_0x35a91e){console['log'](_0x35a91e);}); \ No newline at end of file +var _0x500d=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','wss'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x500d,0xd5));var _0xd500=function(_0xc930ac,_0x25f008){_0xc930ac=_0xc930ac-0x0;var _0x2fafae=_0x500d[_0xc930ac];return _0x2fafae;};'use strict';var util=require('util');var db=require(_0xd500('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xd500('0x1')](_0xd500('0x2'),_0xd500('0x3'),i),'fullname':util[_0xd500('0x1')](_0xd500('0x2'),_0xd500('0x3'),i),'email':util[_0xd500('0x1')](_0xd500('0x4'),_0xd500('0x3'),i),'role':_0xd500('0x3'),'password':_0xd500('0x5'),'internal':0xfa0+i,'type':_0xd500('0x6'),'transport':['udp','ws',_0xd500('0x7')],'disallow':[_0xd500('0x8')],'allow':[_0xd500('0x9')],'defaultuser':util[_0xd500('0x1')](_0xd500('0x2'),_0xd500('0x3'),i),'encryption':_0xd500('0xa'),'avpf':_0xd500('0xa'),'force_avp':_0xd500('0xa'),'icesupport':'yes','dtlsenable':_0xd500('0xa'),'dtlsverify':'no','dtlscertfile':_0xd500('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xd500('0x1')](_0xd500('0xc'),util['format']('%s%s',_0xd500('0x3'),i),0xfa0+i)});}db['User'][_0xd500('0xd')](users)['then'](function(){console[_0xd500('0xe')](_0xd500('0xf'));})[_0xd500('0x10')](function(_0x982c12){console[_0xd500('0xe')](_0x982c12);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 90b8bda..a329297 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10ee=['getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','mail','openchannel','telephone:%s','trunk:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','user:%s','find','userProfileId','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','Trunk','user','FaxQueues','MailQueues','MailQueue','OpenchannelQueue','WhatsappQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues'];(function(_0x37f682,_0x4e66db){var _0x3244ea=function(_0x124bb0){while(--_0x124bb0){_0x37f682['push'](_0x37f682['shift']());}};_0x3244ea(++_0x4e66db);}(_0x10ee,0xed));var _0xe10e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x10ee[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe10e('0x0'));var util=require(_0xe10e('0x1'));var BPromise=require(_0xe10e('0x2'));var db=require(_0xe10e('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xe10e('0x4')],'include':[{'as':_0xe10e('0x5'),'model':db[_0xe10e('0x6')],'attributes':['id',_0xe10e('0x4'),_0xe10e('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe10e('0x4')],'where':{'role':_0xe10e('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe10e('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe10e('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe10e('0x4'),_0xe10e('0xa')],'where':{'type':_0xe10e('0xb')}};function getAssociatedResources(_0x522145,_0x34ece9,_0x21c5e0){return db[_0xe10e('0xc')][_0xe10e('0xd')]({'where':{'name':_0x522145,'userProfileId':_0x34ece9},'raw':!![]})[_0xe10e('0xe')](function(_0x4a099f){if(_0x4a099f){if(_0x4a099f['autoAssociation']){switch(_0x522145){case _0xe10e('0xf'):case _0xe10e('0x10'):case'FaxQueues':case _0xe10e('0x11'):case'MailQueues':case _0xe10e('0x12'):case _0xe10e('0x13'):return db[_0x21c5e0]['findAll'](queryQueues);case'Telephones':return db[_0x21c5e0][_0xe10e('0x14')](queryTelephones);case _0xe10e('0x15'):return db[_0x21c5e0][_0xe10e('0x14')](queryTrunks);case _0xe10e('0x16'):return db[_0x21c5e0]['findAll'](queryCampaigns);}}else{return db[_0xe10e('0x17')]['findAll']({'attributes':[_0xe10e('0x18')],'where':{'sectionId':_0x4a099f['id']},'raw':!![]})[_0xe10e('0xe')](function(_0x2e37b2){if(_0x2e37b2){var _0xc6f530={'where':{'id':_[_0xe10e('0x19')](_0x2e37b2,_0xe10e('0x18'))},'raw':!![]};switch(_0x21c5e0){case _0xe10e('0x6'):_0xc6f530[_0xe10e('0x1a')][_0xe10e('0x7')]=_0xe10e('0x8');break;case _0xe10e('0x1b'):_0xc6f530[_0xe10e('0x1a')][_0xe10e('0xa')]=_0xe10e('0xb');break;}return db[_0x21c5e0][_0xe10e('0x14')](_0xc6f530);}else{return[];}});}}else{return[];}})[_0xe10e('0xe')](function(_0x392fb3){return _0x392fb3;});}function joinOrLeaveQueues(_0x15881e,_0x1aa172,_0x11edc7,_0x2296ff){_0x15881e[_0x1aa172](util[_0xe10e('0x1c')](_0xe10e('0x1d'),_0x11edc7,_0x2296ff[_0xe10e('0x4')]));if(_0x2296ff[_0xe10e('0x5')]){for(var _0x5d9d3b=0x0;_0x5d9d3b<_0x2296ff[_0xe10e('0x5')]['length'];_0x5d9d3b+=0x1){_0x15881e[_0x1aa172](util['format'](_0xe10e('0x1e'),_0x2296ff[_0xe10e('0x5')][_0x5d9d3b][_0xe10e('0x4')]));}}}function joinOrLeave(_0xf1ea36,_0xa77246,_0x3075eb){var _0x2dfa94;if(_0xf1ea36['handshake']['query']['id']){db[_0xe10e('0x6')][_0xe10e('0x1f')]({'attributes':['id',_0xe10e('0x4'),_0xe10e('0x7'),_0xe10e('0x20')],'where':{'id':_0xf1ea36[_0xe10e('0x21')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe10e('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xe10e('0x23')],'as':_0xe10e('0x24'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xe10e('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe10e('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe10e('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe10e('0x28')],'as':_0xe10e('0x29'),'attributes':['id'],'raw':!![]}]})[_0xe10e('0xe')](function(_0x26f024){if(_0x26f024){_0x2dfa94=_0x26f024;_0xf1ea36[_0xa77246](util[_0xe10e('0x1c')](_0xe10e('0x1e'),_0x26f024[_0xe10e('0x4')]));var _0x7b32cd=[];switch(_0x26f024['role']){case _0xe10e('0x2a'):_0xf1ea36[_0xa77246](_0xe10e('0x2b'));_0xf1ea36[_0xa77246](_0xe10e('0x2c'));if(queryQueues[_0xe10e('0x2d')]('include')){delete queryQueues[_0xe10e('0x2e')];}_0x7b32cd[_0xe10e('0x2f')](db[_0xe10e('0x30')][_0xe10e('0x14')](queryQueues));_0x7b32cd[_0xe10e('0x2f')](db[_0xe10e('0x31')][_0xe10e('0x14')](queryQueues));_0x7b32cd['push'](db[_0xe10e('0x32')]['findAll'](queryQueues));_0x7b32cd[_0xe10e('0x2f')](db[_0xe10e('0x33')]['findAll'](queryQueues));_0x7b32cd[_0xe10e('0x2f')](db['MailQueue'][_0xe10e('0x14')](queryQueues));_0x7b32cd[_0xe10e('0x2f')](db['OpenchannelQueue'][_0xe10e('0x14')](queryQueues));_0x7b32cd[_0xe10e('0x2f')](db['WhatsappQueue'][_0xe10e('0x14')](queryQueues));_0x7b32cd[_0xe10e('0x2f')](db[_0xe10e('0x6')]['findAll'](queryTelephones));_0x7b32cd[_0xe10e('0x2f')](db[_0xe10e('0x34')][_0xe10e('0x14')](queryTrunks));_0x7b32cd[_0xe10e('0x2f')](db[_0xe10e('0x1b')][_0xe10e('0x14')](queryCampaigns));_0x7b32cd[_0xe10e('0x2f')](db['User'][_0xe10e('0x14')](queryAgents));break;case _0xe10e('0x35'):_0xf1ea36[_0xa77246](_0xe10e('0x2b'));_0xf1ea36[_0xa77246](_0xe10e('0x2c'));_0x7b32cd['push'](getAssociatedResources('VoiceQueues',_0x26f024['userProfileId'],_0xe10e('0x30')));_0x7b32cd['push'](getAssociatedResources(_0xe10e('0x10'),_0x26f024[_0xe10e('0x20')],_0xe10e('0x31')));_0x7b32cd['push'](getAssociatedResources(_0xe10e('0x36'),_0x26f024[_0xe10e('0x20')],_0xe10e('0x32')));_0x7b32cd[_0xe10e('0x2f')](getAssociatedResources('SmsQueues',_0x26f024[_0xe10e('0x20')],_0xe10e('0x33')));_0x7b32cd[_0xe10e('0x2f')](getAssociatedResources(_0xe10e('0x37'),_0x26f024['userProfileId'],_0xe10e('0x38')));_0x7b32cd[_0xe10e('0x2f')](getAssociatedResources(_0xe10e('0x12'),_0x26f024['userProfileId'],_0xe10e('0x39')));_0x7b32cd[_0xe10e('0x2f')](getAssociatedResources('WhatsappQueues',_0x26f024[_0xe10e('0x20')],_0xe10e('0x3a')));_0x7b32cd[_0xe10e('0x2f')](getAssociatedResources(_0xe10e('0x3b'),_0x26f024[_0xe10e('0x20')],_0xe10e('0x6')));_0x7b32cd[_0xe10e('0x2f')](getAssociatedResources('Trunks',_0x26f024['userProfileId'],_0xe10e('0x34')));_0x7b32cd[_0xe10e('0x2f')](getAssociatedResources('IvrCampaigns',_0x26f024[_0xe10e('0x20')],_0xe10e('0x1b')));_0x7b32cd[_0xe10e('0x2f')](db[_0xe10e('0x6')][_0xe10e('0x14')](queryAgents));break;case _0xe10e('0x9'):_0xf1ea36[_0xa77246](_0xe10e('0x2b'));_0xf1ea36[_0xa77246](_0xe10e('0x2c'));_0x7b32cd[_0xe10e('0x2f')](_0x26f024[_0xe10e('0x3c')]({'attributes':['id',_0xe10e('0x4')]}));_0x7b32cd['push'](_0x26f024[_0xe10e('0x3d')]({'attributes':['id',_0xe10e('0x4')]}));_0x7b32cd[_0xe10e('0x2f')](_0x26f024[_0xe10e('0x3e')]({'attributes':['id',_0xe10e('0x4')]}));_0x7b32cd[_0xe10e('0x2f')](_0x26f024[_0xe10e('0x3f')]({'attributes':['id',_0xe10e('0x4')]}));_0x7b32cd[_0xe10e('0x2f')](_0x26f024[_0xe10e('0x40')]({'attributes':['id',_0xe10e('0x4')]}));_0x7b32cd['push'](_0x26f024[_0xe10e('0x41')]({'attributes':['id',_0xe10e('0x4')]}));_0x7b32cd['push'](_0x26f024[_0xe10e('0x42')]({'attributes':['id',_0xe10e('0x4')]}));break;}return BPromise['all'](_0x7b32cd);}})[_0xe10e('0xe')](function(_0x3b5b3e){if(_0x3b5b3e&&_0x3b5b3e[_0xe10e('0x43')]){for(var _0x1669e3=0x0;_0x1669e3<_0x3b5b3e['length'];_0x1669e3+=0x1){for(var _0x52056a=0x0;_0x52056a<_0x3b5b3e[_0x1669e3][_0xe10e('0x43')];_0x52056a+=0x1){switch(_0x1669e3){case 0x0:joinOrLeaveQueues(_0xf1ea36,_0xa77246,_0xe10e('0x44'),_0x3b5b3e[_0x1669e3][_0x52056a]);break;case 0x1:joinOrLeaveQueues(_0xf1ea36,_0xa77246,'chat',_0x3b5b3e[_0x1669e3][_0x52056a]);break;case 0x2:joinOrLeaveQueues(_0xf1ea36,_0xa77246,'fax',_0x3b5b3e[_0x1669e3][_0x52056a]);break;case 0x3:joinOrLeaveQueues(_0xf1ea36,_0xa77246,'sms',_0x3b5b3e[_0x1669e3][_0x52056a]);break;case 0x4:joinOrLeaveQueues(_0xf1ea36,_0xa77246,_0xe10e('0x45'),_0x3b5b3e[_0x1669e3][_0x52056a]);break;case 0x5:joinOrLeaveQueues(_0xf1ea36,_0xa77246,_0xe10e('0x46'),_0x3b5b3e[_0x1669e3][_0x52056a]);break;case 0x6:joinOrLeaveQueues(_0xf1ea36,_0xa77246,'whatsapp',_0x3b5b3e[_0x1669e3][_0x52056a]);break;case 0x7:if(_0x2dfa94['role']!==_0xe10e('0x9'))_0xf1ea36[_0xa77246](util[_0xe10e('0x1c')](_0xe10e('0x47'),_0x3b5b3e[_0x1669e3][_0x52056a][_0xe10e('0x4')]));break;case 0x8:if(_0x2dfa94[_0xe10e('0x7')]!==_0xe10e('0x9'))_0xf1ea36[_0xa77246](util['format'](_0xe10e('0x48'),_0x3b5b3e[_0x1669e3][_0x52056a][_0xe10e('0x4')]));break;case 0x9:if(_0x2dfa94[_0xe10e('0x7')]!==_0xe10e('0x9'))_0xf1ea36[_0xa77246](util[_0xe10e('0x1c')]('campaign:%s:%s',_0x3b5b3e[_0x1669e3][_0x52056a]['type'],_0x3b5b3e[_0x1669e3][_0x52056a][_0xe10e('0x4')]));break;case 0xa:_0xf1ea36[_0xa77246](util['format']('user:%s',_0x3b5b3e[_0x1669e3][_0x52056a][_0xe10e('0x4')]));break;}}}}})['then'](function(){if(_0xa77246===_0xe10e('0x49')){var _0x45fb18=_[_0xe10e('0x19')](_0x2dfa94[_0xe10e('0x22')],'id');return _0x2dfa94['removeChatInteractions'](_0x45fb18)['then'](function(){for(var _0x5357b4=0x0;_0x5357b4<_0x45fb18['length'];_0x5357b4+=0x1){_0x3075eb[_0xe10e('0x4a')](_0xe10e('0x4b'),{'ChatInteractionId':Number(_0x45fb18[_0x5357b4]),'UserId':Number(_0x2dfa94['id'])});}});}})['then'](function(){if(_0xa77246===_0xe10e('0x49')){var _0xb07f37=_[_0xe10e('0x19')](_0x2dfa94[_0xe10e('0x24')],'id');return _0x2dfa94[_0xe10e('0x4c')](_0xb07f37)[_0xe10e('0xe')](function(){for(var _0x3afb4a=0x0;_0x3afb4a<_0xb07f37['length'];_0x3afb4a+=0x1){_0x3075eb['emit'](_0xe10e('0x4d'),{'MailInteractionId':Number(_0xb07f37[_0x3afb4a]),'UserId':Number(_0x2dfa94['id'])});}});}})[_0xe10e('0xe')](function(){if(_0xa77246==='leave'){var _0x5d6885=_[_0xe10e('0x19')](_0x2dfa94[_0xe10e('0x25')],'id');return _0x2dfa94[_0xe10e('0x4e')](_0x5d6885)[_0xe10e('0xe')](function(){for(var _0xadd454=0x0;_0xadd454<_0x5d6885[_0xe10e('0x43')];_0xadd454+=0x1){_0x3075eb[_0xe10e('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5d6885[_0xadd454]),'UserId':Number(_0x2dfa94['id'])});}});}})['then'](function(){if(_0xa77246===_0xe10e('0x49')){var _0x170390=_['map'](_0x2dfa94['SmsInteractions'],'id');return _0x2dfa94[_0xe10e('0x4f')](_0x170390)[_0xe10e('0xe')](function(){for(var _0x3f77bb=0x0;_0x3f77bb<_0x170390[_0xe10e('0x43')];_0x3f77bb+=0x1){_0x3075eb[_0xe10e('0x4a')](_0xe10e('0x50'),{'SmsInteractionId':Number(_0x170390[_0x3f77bb]),'UserId':Number(_0x2dfa94['id'])});}});}})[_0xe10e('0xe')](function(){if(_0xa77246===_0xe10e('0x49')){var _0x3a91b6=_[_0xe10e('0x19')](_0x2dfa94[_0xe10e('0x51')],'id');return _0x2dfa94[_0xe10e('0x52')](_0x3a91b6)[_0xe10e('0xe')](function(){for(var _0x321eb8=0x0;_0x321eb8<_0x3a91b6['length'];_0x321eb8+=0x1){_0x3075eb['emit'](_0xe10e('0x53'),{'OpenchannelInteractionId':Number(_0x3a91b6[_0x321eb8]),'UserId':Number(_0x2dfa94['id'])});}});}})[_0xe10e('0xe')](function(){if(_0xa77246==='leave'){var _0x54fa70=_['map'](_0x2dfa94[_0xe10e('0x29')],'id');return _0x2dfa94[_0xe10e('0x54')](_0x54fa70)[_0xe10e('0xe')](function(){for(var _0x46bc47=0x0;_0x46bc47<_0x54fa70[_0xe10e('0x43')];_0x46bc47+=0x1){_0x3075eb[_0xe10e('0x4a')](_0xe10e('0x55'),{'WhatsappInteractionId':Number(_0x54fa70[_0x46bc47]),'UserId':Number(_0x2dfa94['id'])});}});}})[_0xe10e('0x56')](function(_0x512d14){_0xf1ea36[_0xe10e('0x57')](_0x512d14);});}}function onDisconnect(_0x592bfb,_0x34f540){joinOrLeave(_0x592bfb,_0xe10e('0x49'),_0x34f540);}function onConnect(_0x2ecc3c){joinOrLeave(_0x2ecc3c,_0xe10e('0x58'));}exports['default']=function(_0x3d1f64){_0x3d1f64['on'](_0xe10e('0x59'),function(_0x1eeedb){_0x1eeedb[_0xe10e('0x5a')](0x0);_0x1eeedb[_0xe10e('0x5b')]=_0x1eeedb['request'][_0xe10e('0x59')][_0xe10e('0x5c')]+':'+_0x1eeedb[_0xe10e('0x5d')]['connection'][_0xe10e('0x5e')];_0x1eeedb[_0xe10e('0x5f')]=new Date();_0x1eeedb[_0xe10e('0x57')]=function(_0x55682f){console[_0xe10e('0x57')](_0xe10e('0x60')+_0x1eeedb[_0xe10e('0x61')][_0xe10e('0x4')]+'['+_0x1eeedb[_0xe10e('0x5b')]+']',_0x55682f);};_0x1eeedb['on'](_0xe10e('0x62'),function(){onDisconnect(_0x1eeedb,_0x3d1f64);_0x1eeedb[_0xe10e('0x57')](_0xe10e('0x63'));});onConnect(_0x1eeedb);_0x1eeedb[_0xe10e('0x57')]('CONNECTED');});}; \ No newline at end of file +var _0x81f8=['VoiceQueues','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','handshake','find','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','userProfileId','ChatQueue','Telephones','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','type','user:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','then'];(function(_0x47548a,_0x5dcdbe){var _0x22bd47=function(_0x2cb2b0){while(--_0x2cb2b0){_0x47548a['push'](_0x47548a['shift']());}};_0x22bd47(++_0x5dcdbe);}(_0x81f8,0x186));var _0x881f=function(_0x40cf33,_0x1c3912){_0x40cf33=_0x40cf33-0x0;var _0x10247a=_0x81f8[_0x40cf33];return _0x10247a;};'use strict';var _=require(_0x881f('0x0'));var util=require(_0x881f('0x1'));var BPromise=require('bluebird');var db=require(_0x881f('0x2'))['db'];var config=require(_0x881f('0x3'));var queryQueues={'attributes':['id',_0x881f('0x4')],'include':[{'as':_0x881f('0x5'),'model':db[_0x881f('0x6')],'attributes':['id','name',_0x881f('0x7')],'raw':!![],'where':{'role':_0x881f('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x881f('0x4')],'where':{'role':_0x881f('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x881f('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x881f('0x4')],'where':{'role':_0x881f('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x881f('0xa')}};function getAssociatedResources(_0x2e9748,_0x493708,_0x8d94d7){return db[_0x881f('0xb')][_0x881f('0xc')]({'where':{'name':_0x2e9748,'userProfileId':_0x493708},'raw':!![]})[_0x881f('0xd')](function(_0x56d967){if(_0x56d967){if(_0x56d967['autoAssociation']){switch(_0x2e9748){case _0x881f('0xe'):case _0x881f('0xf'):case _0x881f('0x10'):case'SmsQueues':case'MailQueues':case _0x881f('0x11'):case _0x881f('0x12'):return db[_0x8d94d7]['findAll'](queryQueues);case'Telephones':return db[_0x8d94d7][_0x881f('0x13')](queryTelephones);case _0x881f('0x14'):return db[_0x8d94d7][_0x881f('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x8d94d7][_0x881f('0x13')](queryCampaigns);}}else{return db[_0x881f('0x15')]['findAll']({'attributes':[_0x881f('0x16')],'where':{'sectionId':_0x56d967['id']},'raw':!![]})[_0x881f('0xd')](function(_0x4b7378){if(_0x4b7378){var _0x301d66={'where':{'id':_[_0x881f('0x17')](_0x4b7378,_0x881f('0x16'))},'raw':!![]};switch(_0x8d94d7){case _0x881f('0x6'):_0x301d66[_0x881f('0x18')][_0x881f('0x7')]='telephone';break;case _0x881f('0x19'):_0x301d66['where']['type']=_0x881f('0xa');break;}return db[_0x8d94d7][_0x881f('0x13')](_0x301d66);}else{return[];}});}}else{return[];}})[_0x881f('0xd')](function(_0x480259){return _0x480259;});}function joinOrLeaveQueues(_0x49c605,_0x44fd56,_0x4e7f3d,_0x954062){_0x49c605[_0x44fd56](util[_0x881f('0x1a')](_0x881f('0x1b'),_0x4e7f3d,_0x954062['name']));if(_0x954062['Agents']){for(var _0x38f7a7=0x0;_0x38f7a7<_0x954062[_0x881f('0x5')][_0x881f('0x1c')];_0x38f7a7+=0x1){_0x49c605[_0x44fd56](util[_0x881f('0x1a')]('user:%s',_0x954062[_0x881f('0x5')][_0x38f7a7][_0x881f('0x4')]));}}}function joinOrLeave(_0x14caf2,_0x59c60e,_0x16392b){var _0x51bbb2;if(_0x14caf2[_0x881f('0x1d')]['query']['id']){db[_0x881f('0x6')][_0x881f('0x1e')]({'attributes':['id',_0x881f('0x4'),_0x881f('0x7'),'userProfileId'],'where':{'id':_0x14caf2[_0x881f('0x1d')][_0x881f('0x1f')]['id']},'include':[{'model':db[_0x881f('0x20')],'as':_0x881f('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x881f('0x22')],'as':_0x881f('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x881f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x881f('0x25')],'as':_0x881f('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x881f('0x27')],'as':_0x881f('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x881f('0xd')](function(_0x11f353){if(_0x11f353){_0x51bbb2=_0x11f353;_0x14caf2[_0x59c60e](util[_0x881f('0x1a')]('user:%s',_0x11f353[_0x881f('0x4')]));var _0x21bbd8=[];switch(_0x11f353[_0x881f('0x7')]){case _0x881f('0x29'):_0x14caf2[_0x59c60e](_0x881f('0x2a'));_0x14caf2[_0x59c60e](_0x881f('0x2b'));if(queryQueues[_0x881f('0x2c')](_0x881f('0x2d'))){delete queryQueues[_0x881f('0x2d')];}_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x2f')][_0x881f('0x13')](queryQueues));_0x21bbd8[_0x881f('0x2e')](db['ChatQueue'][_0x881f('0x13')](queryQueues));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x30')]['findAll'](queryQueues));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x31')]['findAll'](queryQueues));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x32')][_0x881f('0x13')](queryQueues));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x33')][_0x881f('0x13')](queryQueues));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x34')][_0x881f('0x13')](queryQueues));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x6')]['findAll'](queryTelephones));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x35')]['findAll'](queryTrunks));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x19')][_0x881f('0x13')](queryCampaigns));_0x21bbd8[_0x881f('0x2e')](db[_0x881f('0x6')]['findAll'](queryAgents));break;case'user':_0x14caf2[_0x59c60e](_0x881f('0x2a'));_0x14caf2[_0x59c60e](_0x881f('0x2b'));_0x21bbd8['push'](getAssociatedResources(_0x881f('0xe'),_0x11f353['userProfileId'],_0x881f('0x2f')));_0x21bbd8[_0x881f('0x2e')](getAssociatedResources(_0x881f('0xf'),_0x11f353[_0x881f('0x36')],_0x881f('0x37')));_0x21bbd8[_0x881f('0x2e')](getAssociatedResources('FaxQueues',_0x11f353[_0x881f('0x36')],_0x881f('0x30')));_0x21bbd8[_0x881f('0x2e')](getAssociatedResources('SmsQueues',_0x11f353[_0x881f('0x36')],_0x881f('0x31')));_0x21bbd8[_0x881f('0x2e')](getAssociatedResources('MailQueues',_0x11f353[_0x881f('0x36')],_0x881f('0x32')));_0x21bbd8[_0x881f('0x2e')](getAssociatedResources(_0x881f('0x11'),_0x11f353[_0x881f('0x36')],_0x881f('0x33')));_0x21bbd8[_0x881f('0x2e')](getAssociatedResources('WhatsappQueues',_0x11f353['userProfileId'],_0x881f('0x34')));_0x21bbd8['push'](getAssociatedResources(_0x881f('0x38'),_0x11f353['userProfileId'],_0x881f('0x6')));_0x21bbd8[_0x881f('0x2e')](getAssociatedResources(_0x881f('0x14'),_0x11f353[_0x881f('0x36')],'Trunk'));_0x21bbd8[_0x881f('0x2e')](getAssociatedResources('IvrCampaigns',_0x11f353['userProfileId'],_0x881f('0x19')));_0x21bbd8[_0x881f('0x2e')](db['User'][_0x881f('0x13')](queryAgents));break;case _0x881f('0x8'):_0x14caf2[_0x59c60e](_0x881f('0x2a'));_0x14caf2[_0x59c60e](_0x881f('0x2b'));_0x21bbd8[_0x881f('0x2e')](_0x11f353['getVoiceQueues']({'attributes':['id','name']}));_0x21bbd8['push'](_0x11f353[_0x881f('0x39')]({'attributes':['id',_0x881f('0x4')]}));_0x21bbd8[_0x881f('0x2e')](_0x11f353[_0x881f('0x3a')]({'attributes':['id',_0x881f('0x4')]}));_0x21bbd8[_0x881f('0x2e')](_0x11f353[_0x881f('0x3b')]({'attributes':['id',_0x881f('0x4')]}));_0x21bbd8['push'](_0x11f353[_0x881f('0x3c')]({'attributes':['id',_0x881f('0x4')]}));_0x21bbd8['push'](_0x11f353[_0x881f('0x3d')]({'attributes':['id',_0x881f('0x4')]}));_0x21bbd8['push'](_0x11f353['getWhatsappQueues']({'attributes':['id',_0x881f('0x4')]}));break;}return BPromise[_0x881f('0x3e')](_0x21bbd8);}})['then'](function(_0x1ac26b){if(_0x1ac26b&&_0x1ac26b['length']){for(var _0x5ed67e=0x0;_0x5ed67e<_0x1ac26b['length'];_0x5ed67e+=0x1){for(var _0x42afc8=0x0;_0x42afc8<_0x1ac26b[_0x5ed67e]['length'];_0x42afc8+=0x1){switch(_0x5ed67e){case 0x0:joinOrLeaveQueues(_0x14caf2,_0x59c60e,_0x881f('0x3f'),_0x1ac26b[_0x5ed67e][_0x42afc8]);break;case 0x1:joinOrLeaveQueues(_0x14caf2,_0x59c60e,_0x881f('0x40'),_0x1ac26b[_0x5ed67e][_0x42afc8]);break;case 0x2:joinOrLeaveQueues(_0x14caf2,_0x59c60e,_0x881f('0x41'),_0x1ac26b[_0x5ed67e][_0x42afc8]);break;case 0x3:joinOrLeaveQueues(_0x14caf2,_0x59c60e,_0x881f('0x42'),_0x1ac26b[_0x5ed67e][_0x42afc8]);break;case 0x4:joinOrLeaveQueues(_0x14caf2,_0x59c60e,_0x881f('0x43'),_0x1ac26b[_0x5ed67e][_0x42afc8]);break;case 0x5:joinOrLeaveQueues(_0x14caf2,_0x59c60e,_0x881f('0x44'),_0x1ac26b[_0x5ed67e][_0x42afc8]);break;case 0x6:joinOrLeaveQueues(_0x14caf2,_0x59c60e,_0x881f('0x45'),_0x1ac26b[_0x5ed67e][_0x42afc8]);break;case 0x7:if(_0x51bbb2[_0x881f('0x7')]!==_0x881f('0x8'))_0x14caf2[_0x59c60e](util[_0x881f('0x1a')](_0x881f('0x46'),_0x1ac26b[_0x5ed67e][_0x42afc8][_0x881f('0x4')]));break;case 0x8:if(_0x51bbb2[_0x881f('0x7')]!==_0x881f('0x8'))_0x14caf2[_0x59c60e](util[_0x881f('0x1a')]('trunk:%s',_0x1ac26b[_0x5ed67e][_0x42afc8][_0x881f('0x4')]));break;case 0x9:if(_0x51bbb2[_0x881f('0x7')]!=='agent')_0x14caf2[_0x59c60e](util[_0x881f('0x1a')](_0x881f('0x47'),_0x1ac26b[_0x5ed67e][_0x42afc8][_0x881f('0x48')],_0x1ac26b[_0x5ed67e][_0x42afc8][_0x881f('0x4')]));break;case 0xa:_0x14caf2[_0x59c60e](util[_0x881f('0x1a')](_0x881f('0x49'),_0x1ac26b[_0x5ed67e][_0x42afc8][_0x881f('0x4')]));break;}}}}})[_0x881f('0xd')](function(){if(_0x59c60e===_0x881f('0x4a')){var _0x1212d4=_[_0x881f('0x17')](_0x51bbb2[_0x881f('0x21')],'id');return _0x51bbb2[_0x881f('0x4b')](_0x1212d4)['then'](function(){for(var _0x2a747c=0x0;_0x2a747c<_0x1212d4[_0x881f('0x1c')];_0x2a747c+=0x1){_0x16392b[_0x881f('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1212d4[_0x2a747c]),'UserId':Number(_0x51bbb2['id'])});}});}})['then'](function(){if(_0x59c60e==='leave'){var _0xbb2c0c=_[_0x881f('0x17')](_0x51bbb2[_0x881f('0x23')],'id');return _0x51bbb2[_0x881f('0x4d')](_0xbb2c0c)['then'](function(){for(var _0x2d9eb5=0x0;_0x2d9eb5<_0xbb2c0c[_0x881f('0x1c')];_0x2d9eb5+=0x1){_0x16392b[_0x881f('0x4c')](_0x881f('0x4e'),{'MailInteractionId':Number(_0xbb2c0c[_0x2d9eb5]),'UserId':Number(_0x51bbb2['id'])});}});}})['then'](function(){if(_0x59c60e===_0x881f('0x4a')){var _0x13a1bb=_[_0x881f('0x17')](_0x51bbb2['FaxInteractions'],'id');return _0x51bbb2[_0x881f('0x4f')](_0x13a1bb)['then'](function(){for(var _0x2a6206=0x0;_0x2a6206<_0x13a1bb['length'];_0x2a6206+=0x1){_0x16392b[_0x881f('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x13a1bb[_0x2a6206]),'UserId':Number(_0x51bbb2['id'])});}});}})[_0x881f('0xd')](function(){if(_0x59c60e==='leave'){var _0x5a3d13=_[_0x881f('0x17')](_0x51bbb2[_0x881f('0x26')],'id');return _0x51bbb2[_0x881f('0x50')](_0x5a3d13)[_0x881f('0xd')](function(){for(var _0x36e87f=0x0;_0x36e87f<_0x5a3d13['length'];_0x36e87f+=0x1){_0x16392b['emit'](_0x881f('0x51'),{'SmsInteractionId':Number(_0x5a3d13[_0x36e87f]),'UserId':Number(_0x51bbb2['id'])});}});}})[_0x881f('0xd')](function(){if(_0x59c60e==='leave'){var _0x4a2d59=_[_0x881f('0x17')](_0x51bbb2[_0x881f('0x28')],'id');return _0x51bbb2[_0x881f('0x52')](_0x4a2d59)[_0x881f('0xd')](function(){for(var _0x19a7cd=0x0;_0x19a7cd<_0x4a2d59['length'];_0x19a7cd+=0x1){_0x16392b[_0x881f('0x4c')](_0x881f('0x53'),{'OpenchannelInteractionId':Number(_0x4a2d59[_0x19a7cd]),'UserId':Number(_0x51bbb2['id'])});}});}})[_0x881f('0xd')](function(){if(_0x59c60e===_0x881f('0x4a')){var _0x21faf1=_[_0x881f('0x17')](_0x51bbb2['WhatsappInteractions'],'id');return _0x51bbb2['removeWhatsappInteractions'](_0x21faf1)[_0x881f('0xd')](function(){for(var _0x1da7b4=0x0;_0x1da7b4<_0x21faf1[_0x881f('0x1c')];_0x1da7b4+=0x1){_0x16392b['emit'](_0x881f('0x54'),{'WhatsappInteractionId':Number(_0x21faf1[_0x1da7b4]),'UserId':Number(_0x51bbb2['id'])});}});}})[_0x881f('0x55')](function(_0x12a543){_0x14caf2['log'](_0x12a543);});}}function onDisconnect(_0x12e453,_0x2a24c9){joinOrLeave(_0x12e453,'leave',_0x2a24c9);}function onConnect(_0x492259){joinOrLeave(_0x492259,_0x881f('0x56'));}exports[_0x881f('0x57')]=function(_0x5d5f8f){_0x5d5f8f['on'](_0x881f('0x58'),function(_0x24fab8){_0x24fab8[_0x881f('0x59')](0x0);_0x24fab8[_0x881f('0x5a')]=_0x24fab8[_0x881f('0x5b')][_0x881f('0x58')][_0x881f('0x5c')]+':'+_0x24fab8[_0x881f('0x5b')][_0x881f('0x58')][_0x881f('0x5d')];_0x24fab8[_0x881f('0x5e')]=new Date();_0x24fab8[_0x881f('0x5f')]=function(_0x571b50){console[_0x881f('0x5f')](_0x881f('0x60')+_0x24fab8[_0x881f('0x61')]['name']+'['+_0x24fab8[_0x881f('0x5a')]+']',_0x571b50);};_0x24fab8['on'](_0x881f('0x62'),function(){onDisconnect(_0x24fab8,_0x5d5f8f);_0x24fab8[_0x881f('0x5f')](_0x881f('0x63'));});onConnect(_0x24fab8);_0x24fab8[_0x881f('0x5f')](_0x881f('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index fc0e750..e8d0e18 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 _0x8298=['Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','User','find','name','then','interface','SIP/%s','outgoingmessage','opened','changed','closed','format','default','length','hasOwnProperty','hook','toLowerCase','condition','../../mysqldb','../logger','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','info'];(function(_0xa21d01,_0x420cae){var _0x49006b=function(_0x437e59){while(--_0x437e59){_0xa21d01['push'](_0xa21d01['shift']());}};_0x49006b(++_0x420cae);}(_0x8298,0x1ca));var _0x8829=function(_0x1758e9,_0xa44a1c){_0x1758e9=_0x1758e9-0x0;var _0x1c2df8=_0x8298[_0x1758e9];return _0x1c2df8;};'use strict';var util=require('util');var db=require(_0x8829('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0x8829('0x1'))(_0x8829('0x2'));var client=jayson[_0x8829('0x3')][_0x8829('0x4')]({'port':0x232a});var triggers=[{'channel':_0x8829('0x5'),'model':'ChatInteraction','event':_0x8829('0x6'),'condition':_0x8829('0x7'),'callback':afterCreate},{'channel':_0x8829('0x5'),'model':_0x8829('0x8'),'event':_0x8829('0x9'),'condition':_0x8829('0xa'),'callback':afterUpdate},{'channel':_0x8829('0x5'),'model':_0x8829('0xb'),'event':'afterCreate','condition':_0x8829('0xc'),'callback':afterCreateMessage},{'channel':_0x8829('0xd'),'model':'SmsInteraction','event':_0x8829('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8829('0xd'),'model':_0x8829('0xe'),'event':_0x8829('0x9'),'condition':_0x8829('0xa'),'callback':afterUpdate},{'channel':_0x8829('0xd'),'model':'SmsMessage','event':_0x8829('0x6'),'condition':_0x8829('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x8829('0xf'),'event':_0x8829('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8829('0x10'),'model':_0x8829('0xf'),'event':'afterUpdate','condition':_0x8829('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x8829('0x6'),'condition':_0x8829('0xc'),'callback':afterCreateMessage},{'channel':_0x8829('0x11'),'model':'FaxInteraction','event':'afterCreate','condition':_0x8829('0x7'),'callback':afterCreate},{'channel':_0x8829('0x11'),'model':_0x8829('0x12'),'event':_0x8829('0x9'),'condition':_0x8829('0xa'),'callback':afterUpdate},{'channel':_0x8829('0x11'),'model':_0x8829('0x13'),'event':_0x8829('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8829('0x14'),'model':_0x8829('0x15'),'event':_0x8829('0x6'),'condition':_0x8829('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0x8829('0x15'),'event':_0x8829('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x8829('0x16'),'event':_0x8829('0x6'),'condition':_0x8829('0xc'),'callback':afterCreateMessage},{'channel':_0x8829('0x17'),'model':_0x8829('0x18'),'event':'afterCreate','condition':_0x8829('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':_0x8829('0x18'),'event':_0x8829('0x9'),'condition':_0x8829('0xa'),'callback':afterUpdate},{'channel':_0x8829('0x17'),'model':_0x8829('0x19'),'event':_0x8829('0x6'),'condition':_0x8829('0xc'),'callback':afterCreateMessage}];function request(_0x9a9b1){return client['request'](_0x8829('0x1a'),_0x9a9b1)['then'](function(_0x342e2f){logger[_0x8829('0x1b')](_0x8829('0x1c'),_0x8829('0x1a'),_0x342e2f);if(_0x342e2f[_0x8829('0x1d')]){if(_0x342e2f['error'][_0x8829('0x1e')]===0x1f4){logger[_0x8829('0x1d')](_0x8829('0x1c'),_0x8829('0x1a'),_0x342e2f['error']);}}})[_0x8829('0x1f')](function(_0x486e43){logger[_0x8829('0x1d')](_0x8829('0x1c'),_0x8829('0x1a'),_0x486e43);});}function afterCreateMessage(_0x254580,_0x386170){return function(_0x3949cb,_0x4f9aa3){_0x3949cb=_0x3949cb[_0x8829('0x20')]({'plain':!![]});_0x3949cb[_0x8829('0x21')]=_0x254580;_0x3949cb[_0x8829('0x22')]=_0x3949cb[_0x8829('0x23')];if(_0x3949cb[_0x8829('0x24')]){return db[_0x8829('0x25')][_0x8829('0x26')]({'where':{'id':_0x3949cb['UserId']},'attributes':['id',_0x8829('0x27')],'raw':!![]})[_0x8829('0x28')](function(_0x528c1c){_0x3949cb[_0x8829('0x29')]=util['format'](_0x8829('0x2a'),_0x528c1c[_0x8829('0x27')]);_0x3949cb['channel']=_0x254580;return request({'event':'incomingmessage','message':_0x3949cb});})['catch'](function(_0x5e17aa){console[_0x8829('0x1d')](_0x5e17aa);});}else{return request({'event':_0x8829('0x2b'),'message':_0x3949cb});}};}function afterCreate(_0xa4a17d,_0x425649){return function(_0x529124,_0x10b977){_0x529124=_0x529124[_0x8829('0x20')]({'plain':!![]});_0x529124[_0x8829('0x21')]=_0xa4a17d;_0x529124['event']=_0x8829('0x2c');return request({'event':_0x425649,'message':_0x529124});};}function afterUpdate(_0x28fae9,_0x4fb253){return function(_0x4dfcd9,_0xdb2b47){if(_0x4dfcd9[_0x8829('0x2d')](_0x8829('0x2e'))&&_0x4dfcd9['closed']){_0x4dfcd9=_0x4dfcd9['get']({'plain':!![]});_0x4dfcd9[_0x8829('0x21')]=_0x28fae9;_0x4dfcd9['event']=_0x8829('0x2e');if(_0x4dfcd9[_0x8829('0x24')]){return db[_0x8829('0x25')][_0x8829('0x26')]({'where':{'id':_0x4dfcd9[_0x8829('0x24')]},'attributes':['id',_0x8829('0x27')],'raw':!![]})[_0x8829('0x28')](function(_0x3cf0fe){_0x4dfcd9[_0x8829('0x29')]=util[_0x8829('0x2f')](_0x8829('0x2a'),_0x3cf0fe[_0x8829('0x27')]);return request({'event':_0x4fb253,'message':_0x4dfcd9});})[_0x8829('0x1f')](function(_0x2500ab){console[_0x8829('0x1d')](_0x2500ab);});}else{return request({'event':_0x4fb253,'message':_0x4dfcd9});}}};}exports[_0x8829('0x30')]=function(){for(var _0xe79cdc=0x0;_0xe79cdc=_0x25cfea[_0xfa35('0xf')]){throw Error(_0xfa35('0x10'));}_0x166b05(_0x4cc366);})['catch'](function(_0x2a496f){_0x437147(_0x2a496f);});});}; \ No newline at end of file +var _0xbee7=['whatsapp','openchannel','getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','mail','chat','sms'];(function(_0x35f8c1,_0x14442a){var _0x35b77d=function(_0x4ca016){while(--_0x4ca016){_0x35f8c1['push'](_0x35f8c1['shift']());}};_0x35b77d(++_0x14442a);}(_0xbee7,0x12d));var _0x7bee=function(_0x4f29f8,_0x1f80ee){_0x4f29f8=_0x4f29f8-0x0;var _0x1352c8=_0xbee7[_0x4f29f8];return _0x1352c8;};'use strict';var _=require(_0x7bee('0x0'));var BPromise=require(_0x7bee('0x1'));var db=require(_0x7bee('0x2'))['db'];var util=require(_0x7bee('0x3'));var channels=['voice',_0x7bee('0x4'),_0x7bee('0x5'),'fax',_0x7bee('0x6'),_0x7bee('0x7'),_0x7bee('0x8')];exports[_0x7bee('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x377f0){_0x377f0=_0x377f0[_0x7bee('0xa')]();return _[_0x7bee('0xb')](channels,_0x377f0);};exports[_0x7bee('0xc')]=function(_0x157721,_0x4fb977,_0x397d78,_0xe128ec){var _0x49e1d4={'loginAttempts':_0x4fb977,'blocked':_0x397d78};if(!_[_0x7bee('0xd')](_0xe128ec)){_0x49e1d4[_0x7bee('0xe')]=_0xe128ec;}return _0x157721[_0x7bee('0xf')](_0x49e1d4);};exports[_0x7bee('0x10')]=function(_0x3779a2){return new BPromise(function(_0x2ec66a,_0x54f982){var _0x175dae=0x0;if(_0x3779a2['role']!==_0x7bee('0x11')){_0x2ec66a(_0x3779a2);}db['User'][_0x7bee('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3779a2['id']}}})[_0x7bee('0x13')](function(_0x54c540){_0x175dae=_0x54c540;return util['getLicense']();})[_0x7bee('0x13')](function(_0x11d461){if(_0x11d461&&_0x11d461[_0x7bee('0x14')]&&_0x175dae>=_0x11d461[_0x7bee('0x14')]){throw Error(_0x7bee('0x15'));}_0x2ec66a(_0x3779a2);})['catch'](function(_0x3ac7d9){_0x54f982(_0x3ac7d9);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index beff78f..f23aee9 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ae9=['render','json','404','status'];(function(_0xf43f2a,_0x496cee){var _0x50e2cf=function(_0x394379){while(--_0x394379){_0xf43f2a['push'](_0xf43f2a['shift']());}};_0x50e2cf(++_0x496cee);}(_0x6ae9,0x18a));var _0x96ae=function(_0x58001f,_0x3d9c4c){_0x58001f=_0x58001f-0x0;var _0x935187=_0x6ae9[_0x58001f];return _0x935187;};'use strict';module['exports'][0x194]=function pageNotFound(_0x6b4008,_0x547470){var _0xf880f2=_0x96ae('0x0');var _0x31cff8=0x194;var _0x154d5b={'status':_0x31cff8};_0x547470[_0x96ae('0x1')](_0x154d5b[_0x96ae('0x1')]);_0x547470[_0x96ae('0x2')](_0xf880f2,{},function(_0x547944,_0x277c80){if(_0x547944){return _0x547470[_0x96ae('0x1')](_0x154d5b['status'])[_0x96ae('0x3')](_0x154d5b);}_0x547470['send'](_0x277c80);});}; \ No newline at end of file +var _0xdd0a=['exports','status','json','send'];(function(_0x20ecf2,_0x6f9ab){var _0x119204=function(_0x421e91){while(--_0x421e91){_0x20ecf2['push'](_0x20ecf2['shift']());}};_0x119204(++_0x6f9ab);}(_0xdd0a,0x1a8));var _0xadd0=function(_0x11ff7b,_0x522ea1){_0x11ff7b=_0x11ff7b-0x0;var _0x4a56e1=_0xdd0a[_0x11ff7b];return _0x4a56e1;};'use strict';module[_0xadd0('0x0')][0x194]=function pageNotFound(_0x3e6ba4,_0x3dd9d9){var _0x13a557='404';var _0x20fd7a=0x194;var _0x371654={'status':_0x20fd7a};_0x3dd9d9[_0xadd0('0x1')](_0x371654[_0xadd0('0x1')]);_0x3dd9d9['render'](_0x13a557,{},function(_0x388a56,_0x2278fb){if(_0x388a56){return _0x3dd9d9[_0xadd0('0x1')](_0x371654['status'])[_0xadd0('0x2')](_0x371654);}_0x3dd9d9[_0xadd0('0x3')](_0x2278fb);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e398d29..3a334da 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b00=['../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','License','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','cascade','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','UserNotifications','belongsTo','UserProfile','userProfileId','belongsToMany','chat_group_has_users','cm_user_has_contacts','Lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','ChanSpyId','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Messages','Interactions','Applications','ListId','Template','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Attachments','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','MailApplication','restrict','TagId','MailQueueReport','List','Items','FaxAccountId','Answers','fax_interaction_has_tags','Users','FaxInteractionId','Interaction','AttachmentId','FaxQueue','team_has_fax_queues','SmsAccountId','SmsApplication','sms_interaction_has_tags','ThroughTags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueue','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','Website','Contacts','CompanyId','CmContactId','Phones','JscriptySessions','MailInteractions','Company','cm_contact_has_tags','AdditionalPhones','CampaignId','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ContactItemType','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','Subjects','DescriptionId','FieldId','Subject','SubjectId','Configurations','SugarcrmConfiguration','Descriptions','Description','VariableId','int_desk_configuration_has_tags','Field','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshsalesAccount','FreshsalesConfiguration','ToId','SessionId','ProjectId','VoiceQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','CustomFields','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','motion2','utf8_general_ci','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasPhone','../api/cmContactHasPhone/cmContactHasPhone.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration'];(function(_0x1342eb,_0x21be6d){var _0x1bb8c6=function(_0x3a141d){while(--_0x3a141d){_0x1342eb['push'](_0x1342eb['shift']());}};_0x1bb8c6(++_0x21be6d);}(_0x7b00,0x151));var _0x07b0=function(_0x3fb2bd,_0x26e191){_0x3fb2bd=_0x3fb2bd-0x0;var _0x4d6def=_0x7b00[_0x3fb2bd];return _0x4d6def;};'use strict';var path=require('path');var config=require(_0x07b0('0x0'));var Sequelize=require(_0x07b0('0x1'));var _=require(_0x07b0('0x2'));var jstz=require(_0x07b0('0x3'));var timezone=jstz[_0x07b0('0x4')]();config[_0x07b0('0x1')]=_[_0x07b0('0x5')](config[_0x07b0('0x1')],{'database':'motion2','username':_0x07b0('0x6'),'password':_0x07b0('0x7'),'options':{'host':_0x07b0('0x8'),'port':0xcea,'dialect':_0x07b0('0x9'),'dialectOptions':{'charset':_0x07b0('0xa')},'logging':![],'timezone':timezone[_0x07b0('0xb')](),'define':{'charset':_0x07b0('0xc'),'collate':'utf8_general_ci'}}});config[_0x07b0('0xd')]=_[_0x07b0('0x5')](config[_0x07b0('0xd')],{'database':_0x07b0('0xe'),'username':_0x07b0('0x6'),'password':_0x07b0('0x7'),'options':{'host':_0x07b0('0x8'),'port':0xcea,'dialect':_0x07b0('0x9'),'dialectOptions':{'charset':_0x07b0('0xa')},'logging':![],'timezone':timezone[_0x07b0('0xb')](),'define':{'charset':_0x07b0('0xc'),'collate':_0x07b0('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x07b0('0x1')][_0x07b0('0x10')],config[_0x07b0('0x1')][_0x07b0('0x11')],config[_0x07b0('0x1')][_0x07b0('0x12')],config[_0x07b0('0x1')][_0x07b0('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x07b0('0x10')],config[_0x07b0('0xd')][_0x07b0('0x11')],config[_0x07b0('0xd')][_0x07b0('0x12')],config[_0x07b0('0xd')][_0x07b0('0x13')])};db[_0x07b0('0x14')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/user/user.model');db[_0x07b0('0x16')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x17'));db[_0x07b0('0x18')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x19'));db[_0x07b0('0x1a')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x1b'));db[_0x07b0('0x1c')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x1d'));db[_0x07b0('0x1e')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x1f'));db[_0x07b0('0x20')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x21'));db[_0x07b0('0x22')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x23'));db[_0x07b0('0x24')]=db['sequelize']['import'](_0x07b0('0x25'));db[_0x07b0('0x26')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x07b0('0x27')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x28'));db[_0x07b0('0x29')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x2a'));db[_0x07b0('0x2b')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x2c'));db[_0x07b0('0x2d')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x2e'));db[_0x07b0('0x2f')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/memberReport/memberReport.model');db[_0x07b0('0x30')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x31'));db[_0x07b0('0x32')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x33'));db[_0x07b0('0x34')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x35'));db[_0x07b0('0x36')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x37'));db[_0x07b0('0x38')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x39'));db[_0x07b0('0x3a')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x3b'));db[_0x07b0('0x3c')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x3d'));db[_0x07b0('0x3e')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/userSmsQueue/userSmsQueue.model');db[_0x07b0('0x3f')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x40'));db['UserWhatsappQueue']=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x41'));db[_0x07b0('0x42')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x43'));db[_0x07b0('0x44')]=db['sequelize'][_0x07b0('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0x07b0('0x45')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x46'));db[_0x07b0('0x47')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x48'));db[_0x07b0('0x49')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x4a'));db[_0x07b0('0x4b')]=db[_0x07b0('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x07b0('0x4c')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x4d'));db['MailApplication']=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x4e'));db['MailQueueReport']=db[_0x07b0('0x1')]['import'](_0x07b0('0x4f'));db[_0x07b0('0x50')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x51'));db[_0x07b0('0x52')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x53'));db[_0x07b0('0x54')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x55'));db[_0x07b0('0x56')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x57'));db['FaxInteraction']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x58'));db[_0x07b0('0x59')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x5a'));db[_0x07b0('0x5b')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x5c'));db['SmsAccount']=db[_0x07b0('0x1')]['import'](_0x07b0('0x5d'));db['SmsApplication']=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x5e'));db[_0x07b0('0x5f')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x60'));db[_0x07b0('0x61')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x62'));db[_0x07b0('0x63')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x64'));db['OpenchannelAccount']=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x65'));db[_0x07b0('0x66')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x67'));db[_0x07b0('0x68')]=db[_0x07b0('0x1')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x07b0('0x69')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x6a'));db['OpenchannelQueue']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x6b'));db[_0x07b0('0x6c')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x6d'));db[_0x07b0('0x6e')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x6f'));db[_0x07b0('0x70')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x71'));db['ChatInteraction']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x72'));db[_0x07b0('0x73')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x74'));db['ChatOfflineMessage']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x75'));db['ChatQueue']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x76'));db[_0x07b0('0x77')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x78'));db['ChatProactiveAction']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x79'));db[_0x07b0('0x7a')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x7b'));db[_0x07b0('0x7c')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x7d'));db[_0x07b0('0x7e')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x7f'));db[_0x07b0('0x80')]=db['sequelize']['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x07b0('0x81')]=db['sequelize']['import'](_0x07b0('0x82'));db['CmHopperHistory']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x83'));db[_0x07b0('0x84')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x07b0('0x85')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x86'));db[_0x07b0('0x87')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x88'));db[_0x07b0('0x89')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x8a'));db[_0x07b0('0x8b')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x8c'));db[_0x07b0('0x8d')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x8e'));db[_0x07b0('0x8f')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x90'));db[_0x07b0('0x91')]=db['sequelize'][_0x07b0('0x15')]('../api/interval/interval.model');db[_0x07b0('0x92')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x93'));db[_0x07b0('0x94')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x95'));db[_0x07b0('0x96')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x97'));db[_0x07b0('0x98')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x99'));db[_0x07b0('0x9a')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x9b'));db[_0x07b0('0x9c')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x9d'));db['ContactItemType']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x9e'));db[_0x07b0('0x9f')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xa0'));db[_0x07b0('0xa1')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xa2'));db[_0x07b0('0xa3')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xa4'));db['Template']=db['sequelize']['import'](_0x07b0('0xa5'));db['Trigger']=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xa6'));db[_0x07b0('0xa7')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xa8'));db['Integration']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xa9'));db[_0x07b0('0xaa')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xab'));db[_0x07b0('0xac')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xad'));db['AnalyticDefaultReport']=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x07b0('0xae')]=db['sequelize']['import'](_0x07b0('0xaf'));db[_0x07b0('0xb0')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xb1'));db[_0x07b0('0xb2')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xb3'));db[_0x07b0('0xb4')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xb5'));db[_0x07b0('0xb6')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xb7'));db[_0x07b0('0xb8')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xb9'));db[_0x07b0('0xba')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xbb'));db[_0x07b0('0xbc')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xbd'));db['SugarcrmConfiguration']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xbe'));db[_0x07b0('0xbf')]=db[_0x07b0('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x07b0('0xc0')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xc1'));db[_0x07b0('0xc2')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x07b0('0xc3')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xc4'));db[_0x07b0('0xc5')]=db['sequelize']['import'](_0x07b0('0xc6'));db[_0x07b0('0xc7')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xc8'));db[_0x07b0('0xc9')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xca'));db[_0x07b0('0xcb')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xcc'));db['ZendeskConfiguration']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xcd'));db['ZendeskField']=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db[_0x07b0('0xce')]=db[_0x07b0('0x1')]['import'](_0x07b0('0xcf'));db[_0x07b0('0xd0')]=db['sequelize'][_0x07b0('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x07b0('0xd1')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xd2'));db[_0x07b0('0xd3')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x07b0('0xd4')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xd5'));db[_0x07b0('0xd6')]=db[_0x07b0('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x07b0('0xd7')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xd8'));db[_0x07b0('0xd9')]=db[_0x07b0('0x1')]['import'](_0x07b0('0xda'));db[_0x07b0('0xdb')]=db['sequelize']['import'](_0x07b0('0xdc'));db[_0x07b0('0xdd')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xde'));db[_0x07b0('0xdf')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xe0'));db[_0x07b0('0xe1')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xe2'));db['FreshsalesAccount']=db[_0x07b0('0x1')]['import'](_0x07b0('0xe3'));db['FreshsalesConfiguration']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xe4'));db[_0x07b0('0xe5')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xe6'));db['Integration']=db[_0x07b0('0x1')]['import'](_0x07b0('0xa9'));db[_0x07b0('0xe7')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xe8'));db[_0x07b0('0xe9')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xea'));db[_0x07b0('0xeb')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x07b0('0xec')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xed'));db[_0x07b0('0xee')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0xef'));db[_0x07b0('0xf0')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x07b0('0xf1')]=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0x07b0('0xf2')]=db[_0x07b0('0x1')]['import'](_0x07b0('0xf3'));db[_0x07b0('0xf4')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xf5'));db[_0x07b0('0xf6')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xf7'));db[_0x07b0('0xf8')]=db[_0x07b0('0x1')]['import']('../api/setting/setting.model');db['SquareOdbc']=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/squareOdbc/squareOdbc.model');db[_0x07b0('0xf9')]=db['sequelize']['import'](_0x07b0('0xfa'));db[_0x07b0('0xfb')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xfc'));db['SquareMessage']=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/team/team.model');db[_0x07b0('0xfd')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0xfe'));db[_0x07b0('0xff')]=db['sequelize']['import']('../api/campaign/campaign.model');db['Migration']=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x100'));db[_0x07b0('0x101')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x102'));db[_0x07b0('0x103')]=db[_0x07b0('0x1')]['import']('../api/plugin/plugin.model');db[_0x07b0('0x104')]=db['sequelize']['import'](_0x07b0('0x105'));db['ChatTransferReport']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x106'));db[_0x07b0('0x107')]=db[_0x07b0('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x07b0('0x108')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x109'));db['SmsTransferReport']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x10a'));db[_0x07b0('0x10b')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x10c'));db['VoicePrefix']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x10d'));db['UserProfile']=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x10e'));db[_0x07b0('0x10f')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x110'));db['UserProfileResource']=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x111'));db[_0x07b0('0x112')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x113'));db[_0x07b0('0x114')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x115'));db[_0x07b0('0x116')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x117'));db[_0x07b0('0x118')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x119'));db[_0x07b0('0x11a')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x11b'));db[_0x07b0('0x11c')]=db[_0x07b0('0x1')]['import'](_0x07b0('0x11d'));db['WhatsappTransferReport']=db[_0x07b0('0x1')][_0x07b0('0x15')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x07b0('0x11e')]=db['sequelize'][_0x07b0('0x15')](_0x07b0('0x11f'));db[_0x07b0('0x120')]=db['sequelize']['import']('../api/cloudProvider/cloudProvider.model');db[_0x07b0('0x121')]=db[_0x07b0('0x1')][_0x07b0('0x15')](_0x07b0('0x122'));db[_0x07b0('0x14')][_0x07b0('0x123')](db[_0x07b0('0x24')],{'as':_0x07b0('0x24'),'onDelete':'cascade','foreignKey':_0x07b0('0x124')});db[_0x07b0('0x14')][_0x07b0('0x125')](db[_0x07b0('0x20')],{'as':_0x07b0('0x126'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x14')][_0x07b0('0x125')](db[_0x07b0('0x34')],{'as':_0x07b0('0x127'),'foreignKey':_0x07b0('0x124')});db['User'][_0x07b0('0x125')](db[_0x07b0('0x1a')],{'as':_0x07b0('0x128'),'onDelete':_0x07b0('0x129'),'hooks':!![]});db['User']['hasMany'](db[_0x07b0('0x81')],{'as':_0x07b0('0x12a'),'foreignKey':_0x07b0('0x124')});db['User'][_0x07b0('0x125')](db[_0x07b0('0x12b')],{'as':_0x07b0('0x12c'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x14')][_0x07b0('0x125')](db[_0x07b0('0x84')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x07b0('0x14')][_0x07b0('0x125')](db[_0x07b0('0x68')],{'as':_0x07b0('0x12d'),'foreignKey':'UserId'});db[_0x07b0('0x14')][_0x07b0('0x125')](db[_0x07b0('0x12e')],{'as':_0x07b0('0x12f'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x14')][_0x07b0('0x125')](db['SmsInteraction'],{'as':_0x07b0('0x130'),'foreignKey':_0x07b0('0x124')});db['User'][_0x07b0('0x125')](db[_0x07b0('0x131')],{'as':_0x07b0('0x132'),'foreignKey':_0x07b0('0x124')});db['User'][_0x07b0('0x125')](db[_0x07b0('0x4b')],{'as':'MailInteractions','foreignKey':_0x07b0('0x124')});db[_0x07b0('0x14')][_0x07b0('0x125')](db[_0x07b0('0x118')],{'as':_0x07b0('0x133'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x14')]['hasMany'](db['UserNotification'],{'as':_0x07b0('0x134'),'foreignKey':'SenderId'});db[_0x07b0('0x14')][_0x07b0('0x135')](db[_0x07b0('0x136')],{'as':_0x07b0('0x136'),'foreignKey':_0x07b0('0x137')});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x77')],{'as':'Groups','through':_0x07b0('0x139')});db['User'][_0x07b0('0x138')](db[_0x07b0('0x7c')],{'as':'Contacts','through':_0x07b0('0x13a')});db['User']['belongsToMany'](db[_0x07b0('0x10b')],{'as':_0x07b0('0x13b'),'through':'cm_user_has_lists'});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x13c')],{'through':_0x07b0('0x13d')});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x4b')],{'as':'MailInteractions','through':_0x07b0('0x13e')});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x12e')],{'as':_0x07b0('0x12f'),'through':_0x07b0('0x13f')});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x131')],{'as':_0x07b0('0x132'),'through':_0x07b0('0x140')});db[_0x07b0('0x14')][_0x07b0('0x138')](db['SmsInteraction'],{'as':_0x07b0('0x130'),'through':_0x07b0('0x141')});db[_0x07b0('0x14')][_0x07b0('0x138')](db['OpenchannelInteraction'],{'as':_0x07b0('0x12d'),'through':_0x07b0('0x142')});db[_0x07b0('0x14')]['belongsToMany'](db[_0x07b0('0x118')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User'][_0x07b0('0x138')](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User'][_0x07b0('0x138')](db['MailQueue'],{'as':_0x07b0('0x143'),'through':_0x07b0('0x3a'),'required':![]});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x144')],{'as':_0x07b0('0x145'),'through':_0x07b0('0x38'),'required':![],'hooks':!![]});db[_0x07b0('0x14')][_0x07b0('0x138')](db['FaxQueue'],{'as':_0x07b0('0x146'),'through':_0x07b0('0x3c'),'required':![]});db[_0x07b0('0x14')][_0x07b0('0x138')](db['SmsQueue'],{'as':_0x07b0('0x147'),'through':_0x07b0('0x3e'),'required':![]});db[_0x07b0('0x14')]['belongsToMany'](db['OpenchannelQueue'],{'as':_0x07b0('0x148'),'through':_0x07b0('0x3f'),'required':![]});db[_0x07b0('0x14')][_0x07b0('0x138')](db['WhatsappQueue'],{'as':_0x07b0('0x149'),'through':'UserWhatsappQueue','required':![]});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x10b')],{'through':_0x07b0('0x14a')});db['User'][_0x07b0('0x138')](db[_0x07b0('0x14b')],{'as':_0x07b0('0x14c'),'through':_0x07b0('0x14d'),'required':![]});db['User'][_0x07b0('0x138')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x07b0('0x14e')});db[_0x07b0('0x14')]['belongsToMany'](db[_0x07b0('0x54')],{'as':_0x07b0('0x14f'),'through':_0x07b0('0x150')});db['User'][_0x07b0('0x138')](db['MailAccount'],{'as':'MailAccounts','through':_0x07b0('0x151')});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x152')],{'as':_0x07b0('0x153'),'through':_0x07b0('0x154')});db[_0x07b0('0x14')][_0x07b0('0x138')](db[_0x07b0('0x155')],{'as':_0x07b0('0x156'),'through':_0x07b0('0x157')});db[_0x07b0('0x14')][_0x07b0('0x138')](db['WhatsappAccount'],{'as':_0x07b0('0x158'),'through':'user_has_whatsapp_accounts'});db['User'][_0x07b0('0x138')](db['SquareProject'],{'as':_0x07b0('0x159'),'through':'user_has_square_projects'});db[_0x07b0('0x16')][_0x07b0('0x125')](db[_0x07b0('0x1a')],{'as':'SpiedAgents','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x15a')});db['VoiceContext'][_0x07b0('0x125')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x07b0('0x1a')][_0x07b0('0x125')](db[_0x07b0('0x1a')],{'as':'Applications','onDelete':_0x07b0('0x129')});db[_0x07b0('0x1c')]['belongsToMany'](db[_0x07b0('0x9a')],{'as':_0x07b0('0x15b'),'through':_0x07b0('0x15c')});db['VoiceQueue']['hasMany'](db[_0x07b0('0x34')],{'as':'Members','foreignKey':_0x07b0('0x15d')});db[_0x07b0('0x1e')][_0x07b0('0x125')](db[_0x07b0('0x7e')],{'as':_0x07b0('0x15e'),'foreignKey':_0x07b0('0x15d')});db['VoiceQueue'][_0x07b0('0x125')](db[_0x07b0('0x81')],{'as':_0x07b0('0x12a'),'foreignKey':'VoiceQueueId'});db[_0x07b0('0x1e')]['hasMany'](db[_0x07b0('0x12b')],{'as':_0x07b0('0x15f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x07b0('0x125')](db[_0x07b0('0x84')],{'as':_0x07b0('0x84'),'foreignKey':'VoiceQueueId'});db[_0x07b0('0x1e')][_0x07b0('0x125')](db['CmHopperBlack'],{'as':_0x07b0('0x160'),'foreignKey':_0x07b0('0x15d')});db['VoiceQueue'][_0x07b0('0x125')](db[_0x07b0('0xf0')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x07b0('0x135')](db[_0x07b0('0x30')],{'as':_0x07b0('0x30'),'foreignKey':_0x07b0('0x161')});db['VoiceQueue']['belongsTo'](db[_0x07b0('0x30')],{'as':_0x07b0('0x162'),'foreignKey':'TrunkBackupId'});db[_0x07b0('0x1e')][_0x07b0('0x135')](db[_0x07b0('0x91')],{'as':_0x07b0('0x91'),'foreignKey':_0x07b0('0x163')});db[_0x07b0('0x1e')][_0x07b0('0x135')](db[_0x07b0('0x92')],{'as':_0x07b0('0x164'),'foreignKey':_0x07b0('0x165')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':'Lists','through':_0x07b0('0x166')});db[_0x07b0('0x1e')]['belongsToMany'](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':_0x07b0('0x36')});db[_0x07b0('0x1e')][_0x07b0('0x138')](db[_0x07b0('0x13c')],{'as':_0x07b0('0x168'),'through':'TeamVoiceQueue'});db[_0x07b0('0x1e')][_0x07b0('0x138')](db[_0x07b0('0x10b')],{'as':_0x07b0('0x169'),'through':_0x07b0('0x16a')});db['VoiceRecording'][_0x07b0('0x135')](db[_0x07b0('0x14')],{'as':'User','foreignKey':_0x07b0('0x124')});db[_0x07b0('0x22')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'as':'User','foreignKey':_0x07b0('0x124')});db[_0x07b0('0x24')][_0x07b0('0x125')](db[_0x07b0('0x26')],{'as':'Messages','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x16b'),'sourceKey':_0x07b0('0x16c')});db[_0x07b0('0x26')][_0x07b0('0x135')](db[_0x07b0('0x24')],{'foreignKey':_0x07b0('0x16b'),'targetKey':'mailbox'});db[_0x07b0('0x27')][_0x07b0('0x125')](db[_0x07b0('0x2d')],{'as':_0x07b0('0x16d'),'foreignKey':_0x07b0('0x16e'),'constraints':![]});db['VoiceCallReport'][_0x07b0('0x125')](db[_0x07b0('0x2b')],{'as':'AgentReports','foreignKey':_0x07b0('0x16e'),'constraints':![]});db['VoiceCallReport'][_0x07b0('0x135')](db[_0x07b0('0x14')],{'as':_0x07b0('0x14'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x27')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'as':_0x07b0('0x16f'),'foreignKey':_0x07b0('0x170')});db[_0x07b0('0x42')][_0x07b0('0x135')](db[_0x07b0('0x45')],{'as':_0x07b0('0x45'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x07b0('0x135')](db[_0x07b0('0x45')],{'as':'MailAccount','foreignKey':_0x07b0('0x171')});db[_0x07b0('0x45')][_0x07b0('0x123')](db[_0x07b0('0x42')],{'as':_0x07b0('0x172'),'onDelete':_0x07b0('0x129')});db['MailAccount'][_0x07b0('0x123')](db[_0x07b0('0x44')],{'as':_0x07b0('0x173'),'onDelete':'cascade'});db[_0x07b0('0x45')]['hasMany'](db[_0x07b0('0x8d')],{'as':_0x07b0('0x174'),'foreignKey':_0x07b0('0x171')});db[_0x07b0('0x45')][_0x07b0('0x125')](db[_0x07b0('0x8b')],{'as':'Answers','foreignKey':_0x07b0('0x171')});db['MailAccount'][_0x07b0('0x125')](db[_0x07b0('0x4c')],{'as':_0x07b0('0x175'),'foreignKey':'MailAccountId'});db[_0x07b0('0x45')][_0x07b0('0x125')](db[_0x07b0('0x4b')],{'as':_0x07b0('0x176')});db[_0x07b0('0x45')][_0x07b0('0x125')](db['MailApplication'],{'as':_0x07b0('0x177')});db[_0x07b0('0x45')][_0x07b0('0x135')](db[_0x07b0('0x10b')],{'as':'List','foreignKey':_0x07b0('0x178')});db[_0x07b0('0x45')][_0x07b0('0x135')](db[_0x07b0('0x179')],{'as':_0x07b0('0x179'),'foreignKey':'TemplateId'});db['MailAccount'][_0x07b0('0x135')](db[_0x07b0('0x92')],{'as':'mandatoryDispositionPause','foreignKey':_0x07b0('0x165')});db[_0x07b0('0x45')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':'Agents','through':_0x07b0('0x151')});db[_0x07b0('0x47')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':_0x07b0('0x3a')});db[_0x07b0('0x47')][_0x07b0('0x138')](db[_0x07b0('0x13c')],{'through':_0x07b0('0x17a'),'as':_0x07b0('0x168')});db[_0x07b0('0x4b')][_0x07b0('0x125')](db['MailMessage'],{'as':_0x07b0('0x175'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x17b')});db[_0x07b0('0x4b')][_0x07b0('0x135')](db[_0x07b0('0x45')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x171')});db[_0x07b0('0x4b')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'as':'Contact','foreignKey':_0x07b0('0x170')});db['MailInteraction'][_0x07b0('0x135')](db[_0x07b0('0x14')],{'as':_0x07b0('0x17d'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x4b')][_0x07b0('0x138')](db[_0x07b0('0x9c')],{'through':_0x07b0('0x17e'),'as':_0x07b0('0x17f')});db[_0x07b0('0x4b')][_0x07b0('0x138')](db['Tag'],{'through':_0x07b0('0x17e'),'as':'ThroughTags'});db[_0x07b0('0x4b')]['belongsToMany'](db[_0x07b0('0x14')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x07b0('0x17b')});db[_0x07b0('0x4c')][_0x07b0('0x125')](db[_0x07b0('0x101')],{'as':_0x07b0('0x180'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0x4c')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'as':_0x07b0('0x14')});db[_0x07b0('0x4c')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'onDelete':_0x07b0('0x129'),'as':'Contact'});db[_0x07b0('0x4c')][_0x07b0('0x135')](db[_0x07b0('0x4b')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x07b0('0x4c')][_0x07b0('0x135')](db[_0x07b0('0x45')],{'as':_0x07b0('0x17c'),'foreignKey':'MailAccountId'});db['MailMessage'][_0x07b0('0x135')](db[_0x07b0('0x6c')],{'as':_0x07b0('0x6c'),'foreignKey':_0x07b0('0x181')});db[_0x07b0('0x4c')][_0x07b0('0x135')](db['ChatOfflineMessage'],{'as':_0x07b0('0x182'),'foreignKey':_0x07b0('0x183')});db[_0x07b0('0x184')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'onDelete':_0x07b0('0x185')});db['MailApplication'][_0x07b0('0x135')](db['MailQueue'],{'onDelete':'restrict'});db[_0x07b0('0x184')][_0x07b0('0x135')](db[_0x07b0('0x45')],{'onDelete':_0x07b0('0x185')});db['MailApplication'][_0x07b0('0x135')](db[_0x07b0('0x91')],{'onDelete':_0x07b0('0x185'),'foreignKey':'IntervalId'});db[_0x07b0('0x184')][_0x07b0('0x135')](db[_0x07b0('0x9c')],{'onDelete':'restrict','foreignKey':_0x07b0('0x186')});db[_0x07b0('0x187')][_0x07b0('0x135')](db[_0x07b0('0x45')],{});db[_0x07b0('0x187')][_0x07b0('0x135')](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x187')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'as':_0x07b0('0x16f'),'foreignKey':'ContactId'});db[_0x07b0('0x187')][_0x07b0('0x135')](db[_0x07b0('0x4b')],{});db[_0x07b0('0x187')][_0x07b0('0x135')](db[_0x07b0('0x4c')],{});db[_0x07b0('0x187')]['belongsTo'](db[_0x07b0('0x14')],{});db['MailQueueReport'][_0x07b0('0x135')](db[_0x07b0('0x47')],{});db[_0x07b0('0x50')][_0x07b0('0x125')](db[_0x07b0('0x52')],{'as':_0x07b0('0x189'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0x54')][_0x07b0('0x125')](db['Disposition'],{'as':_0x07b0('0x174'),'foreignKey':_0x07b0('0x18a')});db[_0x07b0('0x54')][_0x07b0('0x125')](db[_0x07b0('0x8b')],{'as':_0x07b0('0x18b'),'foreignKey':_0x07b0('0x18a')});db[_0x07b0('0x54')][_0x07b0('0x125')](db[_0x07b0('0x131')],{'as':_0x07b0('0x176')});db['FaxAccount']['hasMany'](db[_0x07b0('0x56')],{'as':_0x07b0('0x177')});db['FaxAccount'][_0x07b0('0x125')](db[_0x07b0('0x1a')],{'as':'Exntensions','onDelete':_0x07b0('0x129')});db[_0x07b0('0x54')][_0x07b0('0x125')](db[_0x07b0('0x59')],{'as':'Messages'});db[_0x07b0('0x54')][_0x07b0('0x135')](db['Trunk'],{'as':_0x07b0('0x30')});db[_0x07b0('0x54')][_0x07b0('0x135')](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x54')][_0x07b0('0x135')](db['Pause'],{'as':_0x07b0('0x164'),'foreignKey':_0x07b0('0x165')});db['FaxAccount'][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':_0x07b0('0x150')});db[_0x07b0('0x56')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'onDelete':_0x07b0('0x185')});db['FaxApplication']['belongsTo'](db['FaxQueue'],{'onDelete':_0x07b0('0x185')});db[_0x07b0('0x56')][_0x07b0('0x135')](db[_0x07b0('0x54')],{'onDelete':_0x07b0('0x185')});db[_0x07b0('0x56')]['belongsTo'](db[_0x07b0('0x9c')],{'onDelete':_0x07b0('0x185'),'foreignKey':_0x07b0('0x186')});db['FaxInteraction'][_0x07b0('0x125')](db['FaxMessage'],{'as':'Messages','onDelete':_0x07b0('0x129'),'foreignKey':'FaxInteractionId'});db[_0x07b0('0x131')][_0x07b0('0x135')](db[_0x07b0('0x54')],{'as':'Account','foreignKey':_0x07b0('0x18a')});db['FaxInteraction'][_0x07b0('0x135')](db['CmContact'],{'as':_0x07b0('0x16f'),'foreignKey':_0x07b0('0x170')});db[_0x07b0('0x131')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x07b0('0x124')});db[_0x07b0('0x131')]['belongsToMany'](db[_0x07b0('0x9c')],{'through':_0x07b0('0x18c'),'as':'Tags'});db['FaxInteraction'][_0x07b0('0x138')](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x07b0('0x131')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x18d'),'through':_0x07b0('0x140'),'foreignKey':_0x07b0('0x18e')});db['FaxMessage']['belongsTo'](db['User'],{'onDelete':_0x07b0('0x129'),'as':_0x07b0('0x14')});db['FaxMessage'][_0x07b0('0x135')](db[_0x07b0('0x131')],{'as':_0x07b0('0x18f'),'foreignKey':_0x07b0('0x18e')});db[_0x07b0('0x59')]['belongsTo'](db['CmContact'],{'onDelete':_0x07b0('0x129'),'as':'Contact'});db[_0x07b0('0x59')][_0x07b0('0x135')](db[_0x07b0('0x101')],{'as':_0x07b0('0x101'),'foreignKey':_0x07b0('0x190')});db['FaxMessage'][_0x07b0('0x135')](db[_0x07b0('0x54')],{'as':_0x07b0('0x17c'),'foreignKey':'FaxAccountId'});db[_0x07b0('0x191')][_0x07b0('0x138')](db['User'],{'as':_0x07b0('0x167'),'through':_0x07b0('0x3c')});db['FaxQueue'][_0x07b0('0x138')](db['Team'],{'through':_0x07b0('0x192'),'as':_0x07b0('0x168')});db[_0x07b0('0x5b')][_0x07b0('0x135')](db['FaxAccount'],{});db[_0x07b0('0x5b')][_0x07b0('0x135')](db[_0x07b0('0x10b')],{'as':'List','foreignKey':_0x07b0('0x178')});db[_0x07b0('0x5b')]['belongsTo'](db[_0x07b0('0x7c')],{'as':_0x07b0('0x16f'),'foreignKey':'ContactId'});db[_0x07b0('0x5b')][_0x07b0('0x135')](db[_0x07b0('0x131')],{});db[_0x07b0('0x5b')][_0x07b0('0x135')](db[_0x07b0('0x59')],{});db['FaxQueueReport'][_0x07b0('0x135')](db[_0x07b0('0x14')],{});db[_0x07b0('0x5b')][_0x07b0('0x135')](db[_0x07b0('0x191')],{});db[_0x07b0('0x155')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x07b0('0x193')});db['SmsAccount'][_0x07b0('0x125')](db['CannedAnswer'],{'as':_0x07b0('0x18b'),'foreignKey':_0x07b0('0x193')});db[_0x07b0('0x155')][_0x07b0('0x125')](db[_0x07b0('0x61')],{'as':'Messages','foreignKey':_0x07b0('0x193')});db[_0x07b0('0x155')]['hasMany'](db[_0x07b0('0x5f')],{'as':_0x07b0('0x176')});db['SmsAccount'][_0x07b0('0x125')](db[_0x07b0('0x194')],{'as':_0x07b0('0x177')});db[_0x07b0('0x155')][_0x07b0('0x135')](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':'ListId'});db[_0x07b0('0x155')][_0x07b0('0x135')](db[_0x07b0('0x92')],{'as':_0x07b0('0x164'),'foreignKey':_0x07b0('0x165')});db[_0x07b0('0x155')][_0x07b0('0x138')](db['User'],{'as':_0x07b0('0x167'),'through':_0x07b0('0x157')});db['SmsApplication'][_0x07b0('0x135')](db['User'],{'onDelete':_0x07b0('0x185')});db['SmsApplication'][_0x07b0('0x135')](db[_0x07b0('0x63')],{'onDelete':_0x07b0('0x185')});db[_0x07b0('0x194')][_0x07b0('0x135')](db[_0x07b0('0x155')],{'onDelete':_0x07b0('0x185')});db[_0x07b0('0x194')][_0x07b0('0x135')](db[_0x07b0('0x91')],{'onDelete':_0x07b0('0x185'),'foreignKey':'IntervalId'});db[_0x07b0('0x194')][_0x07b0('0x135')](db[_0x07b0('0x9c')],{'onDelete':_0x07b0('0x185'),'foreignKey':_0x07b0('0x186')});db['SmsInteraction'][_0x07b0('0x125')](db['SmsMessage'],{'as':'Messages','onDelete':_0x07b0('0x129'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x07b0('0x135')](db['SmsAccount'],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x193')});db[_0x07b0('0x5f')][_0x07b0('0x135')](db['CmContact'],{'as':_0x07b0('0x16f'),'foreignKey':_0x07b0('0x170')});db[_0x07b0('0x5f')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'as':_0x07b0('0x17d'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x5f')][_0x07b0('0x138')](db[_0x07b0('0x9c')],{'through':_0x07b0('0x195'),'as':_0x07b0('0x17f')});db[_0x07b0('0x5f')][_0x07b0('0x138')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x07b0('0x196')});db['SmsInteraction'][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x18d'),'through':'user_has_sms_interactions','foreignKey':_0x07b0('0x197')});db[_0x07b0('0x61')]['belongsTo'](db[_0x07b0('0x14')],{'as':_0x07b0('0x14')});db[_0x07b0('0x61')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'onDelete':_0x07b0('0x129'),'as':_0x07b0('0x16f')});db[_0x07b0('0x61')][_0x07b0('0x135')](db[_0x07b0('0x5f')],{'onDelete':_0x07b0('0x129'),'as':_0x07b0('0x18f'),'foreignKey':_0x07b0('0x197')});db[_0x07b0('0x61')][_0x07b0('0x135')](db[_0x07b0('0x155')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x193')});db[_0x07b0('0x63')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':_0x07b0('0x3e'),'foreignKey':_0x07b0('0x198')});db[_0x07b0('0x63')]['belongsToMany'](db[_0x07b0('0x13c')],{'through':_0x07b0('0x199'),'as':_0x07b0('0x168')});db[_0x07b0('0x152')][_0x07b0('0x125')](db[_0x07b0('0x8d')],{'as':'Dispositions','foreignKey':_0x07b0('0x19a')});db[_0x07b0('0x152')][_0x07b0('0x125')](db['CannedAnswer'],{'as':_0x07b0('0x18b'),'foreignKey':_0x07b0('0x19a')});db[_0x07b0('0x152')][_0x07b0('0x125')](db[_0x07b0('0x68')],{'as':_0x07b0('0x176'),'foreignKey':'OpenchannelAccountId'});db[_0x07b0('0x152')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x07b0('0x125')](db[_0x07b0('0x66')],{'as':_0x07b0('0x177'),'foreignKey':_0x07b0('0x19a')});db[_0x07b0('0x152')][_0x07b0('0x135')](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178')});db['OpenchannelAccount'][_0x07b0('0x135')](db['Pause'],{'as':_0x07b0('0x164'),'foreignKey':_0x07b0('0x165')});db[_0x07b0('0x152')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':'user_has_openchannel_accounts'});db[_0x07b0('0x66')][_0x07b0('0x135')](db['User'],{'onDelete':_0x07b0('0x185')});db[_0x07b0('0x66')][_0x07b0('0x135')](db[_0x07b0('0x19b')],{'onDelete':_0x07b0('0x185'),'foreignKey':_0x07b0('0x19c')});db[_0x07b0('0x66')]['belongsTo'](db[_0x07b0('0x152')],{'onDelete':_0x07b0('0x185'),'foreignKey':'OpenchannelAccountId'});db[_0x07b0('0x66')]['belongsTo'](db[_0x07b0('0x91')],{'onDelete':_0x07b0('0x185'),'foreignKey':_0x07b0('0x163')});db[_0x07b0('0x66')][_0x07b0('0x135')](db[_0x07b0('0x9c')],{'onDelete':_0x07b0('0x185'),'foreignKey':'TagId'});db[_0x07b0('0x68')][_0x07b0('0x125')](db[_0x07b0('0x69')],{'as':_0x07b0('0x175'),'onDelete':'cascade','foreignKey':_0x07b0('0x19d')});db['OpenchannelInteraction'][_0x07b0('0x135')](db[_0x07b0('0x152')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x19a')});db['OpenchannelInteraction'][_0x07b0('0x135')](db['CmContact'],{'as':_0x07b0('0x16f'),'foreignKey':'ContactId'});db[_0x07b0('0x68')][_0x07b0('0x135')](db['User'],{'as':_0x07b0('0x17d'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x68')][_0x07b0('0x138')](db['Tag'],{'through':_0x07b0('0x19e'),'as':_0x07b0('0x17f')});db[_0x07b0('0x68')][_0x07b0('0x138')](db[_0x07b0('0x9c')],{'through':_0x07b0('0x19e'),'as':_0x07b0('0x196')});db[_0x07b0('0x68')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':'Users','through':_0x07b0('0x142'),'foreignKey':_0x07b0('0x19d')});db['OpenchannelMessage']['belongsTo'](db['User'],{'onDelete':_0x07b0('0x129'),'as':_0x07b0('0x14')});db[_0x07b0('0x69')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'onDelete':'cascade','as':_0x07b0('0x16f')});db[_0x07b0('0x69')][_0x07b0('0x135')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x07b0('0x18f'),'foreignKey':_0x07b0('0x19d')});db[_0x07b0('0x69')][_0x07b0('0x135')](db[_0x07b0('0x101')],{'as':_0x07b0('0x101'),'foreignKey':_0x07b0('0x190')});db[_0x07b0('0x69')][_0x07b0('0x135')](db[_0x07b0('0x152')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x19a')});db['OpenchannelQueue']['belongsToMany'](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':_0x07b0('0x3f'),'foreignKey':_0x07b0('0x19c')});db[_0x07b0('0x19b')][_0x07b0('0x138')](db[_0x07b0('0x13c')],{'through':_0x07b0('0x19f'),'as':_0x07b0('0x168')});db[_0x07b0('0x6c')]['hasMany'](db[_0x07b0('0x8d')],{'as':_0x07b0('0x174'),'foreignKey':'ChatWebsiteId'});db[_0x07b0('0x6c')][_0x07b0('0x125')](db[_0x07b0('0x8b')],{'as':_0x07b0('0x18b'),'foreignKey':_0x07b0('0x181')});db[_0x07b0('0x6c')][_0x07b0('0x125')](db[_0x07b0('0x1a0')],{'as':_0x07b0('0x1a1')});db['ChatWebsite']['hasMany'](db[_0x07b0('0x12e')],{'as':_0x07b0('0x176')});db[_0x07b0('0x6c')]['hasMany'](db[_0x07b0('0x70')],{'as':_0x07b0('0x177')});db[_0x07b0('0x6c')][_0x07b0('0x125')](db[_0x07b0('0x73')],{'as':_0x07b0('0x175')});db[_0x07b0('0x6c')]['belongsTo'](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x6c')][_0x07b0('0x135')](db[_0x07b0('0x91')],{'as':_0x07b0('0x91'),'foreignKey':'IntervalId'});db[_0x07b0('0x6c')][_0x07b0('0x135')](db[_0x07b0('0x45')],{'as':_0x07b0('0x45'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0x07b0('0x135')](db[_0x07b0('0x92')],{'as':'mandatoryDispositionPause','foreignKey':_0x07b0('0x165')});db[_0x07b0('0x6c')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':_0x07b0('0x14e')});db['OpenchannelQueueReport'][_0x07b0('0x135')](db[_0x07b0('0x152')],{});db[_0x07b0('0x6e')][_0x07b0('0x135')](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x6e')]['belongsTo'](db[_0x07b0('0x7c')],{'as':_0x07b0('0x16f'),'foreignKey':_0x07b0('0x170')});db['OpenchannelQueueReport'][_0x07b0('0x135')](db['OpenchannelInteraction'],{});db[_0x07b0('0x6e')][_0x07b0('0x135')](db[_0x07b0('0x69')],{});db[_0x07b0('0x6e')][_0x07b0('0x135')](db[_0x07b0('0x14')],{});db[_0x07b0('0x6e')][_0x07b0('0x135')](db[_0x07b0('0x19b')],{});db[_0x07b0('0x70')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'as':_0x07b0('0x1a2'),'foreignKey':_0x07b0('0x124'),'onDelete':'restrict'});db['ChatApplication'][_0x07b0('0x135')](db[_0x07b0('0x144')],{'as':_0x07b0('0x1a3'),'foreignKey':_0x07b0('0x1a4'),'onDelete':_0x07b0('0x185')});db[_0x07b0('0x70')][_0x07b0('0x135')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x07b0('0x181'),'onDelete':_0x07b0('0x185')});db[_0x07b0('0x70')]['belongsTo'](db['Tag'],{'onDelete':_0x07b0('0x185'),'foreignKey':'TagId'});db[_0x07b0('0x12e')][_0x07b0('0x125')](db['ChatMessage'],{'as':_0x07b0('0x175'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1a5')});db[_0x07b0('0x12e')][_0x07b0('0x135')](db[_0x07b0('0x6c')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x181')});db[_0x07b0('0x12e')]['belongsTo'](db[_0x07b0('0x7c')],{'as':'Contact','foreignKey':_0x07b0('0x170')});db['ChatInteraction'][_0x07b0('0x135')](db['User'],{'as':_0x07b0('0x17d'),'foreignKey':_0x07b0('0x124')});db[_0x07b0('0x12e')]['belongsToMany'](db['Tag'],{'through':_0x07b0('0x1a6'),'as':_0x07b0('0x17f')});db[_0x07b0('0x12e')][_0x07b0('0x138')](db[_0x07b0('0x9c')],{'through':_0x07b0('0x1a6'),'as':_0x07b0('0x196')});db[_0x07b0('0x12e')]['belongsToMany'](db[_0x07b0('0x14')],{'as':_0x07b0('0x18d'),'through':_0x07b0('0x13f'),'foreignKey':_0x07b0('0x1a5')});db['ChatMessage']['belongsTo'](db[_0x07b0('0x14')],{'onDelete':_0x07b0('0x129'),'as':_0x07b0('0x14')});db[_0x07b0('0x73')]['belongsTo'](db['CmContact'],{'onDelete':_0x07b0('0x129'),'as':'Contact','foreignKey':_0x07b0('0x170')});db[_0x07b0('0x73')][_0x07b0('0x135')](db[_0x07b0('0x12e')],{'onDelete':'cascade','as':_0x07b0('0x18f'),'foreignKey':_0x07b0('0x1a5')});db[_0x07b0('0x73')][_0x07b0('0x135')](db['Attachment'],{'as':_0x07b0('0x101'),'foreignKey':_0x07b0('0x190')});db[_0x07b0('0x73')][_0x07b0('0x135')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x07b0('0x181')});db[_0x07b0('0x182')][_0x07b0('0x125')](db['Attachment'],{'as':_0x07b0('0x180'),'foreignKey':_0x07b0('0x183'),'onDelete':_0x07b0('0x129'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0x07b0('0x7c')],{'onDelete':_0x07b0('0x129'),'as':_0x07b0('0x16f'),'foreignKey':_0x07b0('0x170')});db['ChatOfflineMessage'][_0x07b0('0x135')](db[_0x07b0('0x6c')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x181')});db['ChatQueue'][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':_0x07b0('0x38'),'hooks':!![]});db[_0x07b0('0x144')][_0x07b0('0x138')](db[_0x07b0('0x13c')],{'through':_0x07b0('0x1a7'),'as':'Teams'});db[_0x07b0('0x77')]['hasMany'](db[_0x07b0('0xeb')],{'as':_0x07b0('0x175'),'foreignKey':_0x07b0('0x1a8'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0x77')][_0x07b0('0x138')](db['User'],{'as':_0x07b0('0x1a9'),'through':_0x07b0('0x139')});db[_0x07b0('0x1a0')]['belongsTo'](db[_0x07b0('0x6c')],{'as':_0x07b0('0x1aa'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x07b0('0x125')](db['CmContact'],{'as':_0x07b0('0x1ab'),'foreignKey':_0x07b0('0x1ac')});db['CmContact']['hasMany'](db[_0x07b0('0x9f')],{'as':'Phones2','foreignKey':_0x07b0('0x1ad')});db['CmContact'][_0x07b0('0x125')](db[_0x07b0('0xa1')],{'as':_0x07b0('0x1ae'),'foreignKey':_0x07b0('0x1ad')});db[_0x07b0('0x7c')][_0x07b0('0x125')](db[_0x07b0('0x7e')],{'as':_0x07b0('0x15e'),'foreignKey':_0x07b0('0x170')});db['CmContact'][_0x07b0('0x125')](db[_0x07b0('0x81')],{'as':_0x07b0('0x12a'),'foreignKey':_0x07b0('0x170')});db[_0x07b0('0x7c')][_0x07b0('0x125')](db['CmHopperHistory'],{'as':_0x07b0('0x15f'),'foreignKey':_0x07b0('0x170')});db['CmContact'][_0x07b0('0x125')](db[_0x07b0('0x84')],{'as':_0x07b0('0x84'),'foreignKey':_0x07b0('0x170')});db[_0x07b0('0x7c')][_0x07b0('0x125')](db[_0x07b0('0xf0')],{'as':_0x07b0('0x1af'),'foreignKey':_0x07b0('0x170')});db[_0x07b0('0x7c')]['hasMany'](db[_0x07b0('0x68')],{'as':_0x07b0('0x12d'),'foreignKey':_0x07b0('0x170'),'onDelete':_0x07b0('0x185')});db[_0x07b0('0x7c')][_0x07b0('0x125')](db['ChatInteraction'],{'as':_0x07b0('0x12f'),'foreignKey':_0x07b0('0x170'),'onDelete':_0x07b0('0x185')});db[_0x07b0('0x7c')][_0x07b0('0x125')](db['SmsInteraction'],{'as':_0x07b0('0x130'),'foreignKey':_0x07b0('0x170'),'onDelete':_0x07b0('0x185')});db[_0x07b0('0x7c')][_0x07b0('0x125')](db[_0x07b0('0x131')],{'as':_0x07b0('0x132'),'foreignKey':'ContactId','onDelete':_0x07b0('0x185')});db['CmContact'][_0x07b0('0x125')](db[_0x07b0('0x4b')],{'as':_0x07b0('0x1b0'),'foreignKey':'ContactId','onDelete':_0x07b0('0x185')});db[_0x07b0('0x7c')][_0x07b0('0x135')](db[_0x07b0('0x7a')],{'as':_0x07b0('0x1b1'),'foreignKey':_0x07b0('0x1ac')});db[_0x07b0('0x7c')][_0x07b0('0x135')](db['CmList'],{'as':'List','foreignKey':_0x07b0('0x178'),'onDelete':_0x07b0('0x129')});db['CmContact'][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x18d'),'through':_0x07b0('0x13a')});db['CmContact'][_0x07b0('0x138')](db[_0x07b0('0x9c')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x07b0('0x7c')][_0x07b0('0x138')](db['Tag'],{'through':_0x07b0('0x1b2'),'as':_0x07b0('0x196')});db['CmHopper'][_0x07b0('0x125')](db['CmHopperAdditionalPhone'],{'as':_0x07b0('0x1b3'),'foreignKey':'CmHopperId'});db[_0x07b0('0x7e')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'as':_0x07b0('0x16f'),'foreignKey':_0x07b0('0x170'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0x7e')]['belongsTo'](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0x7e')][_0x07b0('0x135')](db['User'],{'as':_0x07b0('0x1a2'),'foreignKey':'UserId'});db[_0x07b0('0x7e')]['belongsTo'](db['VoiceQueue'],{'as':_0x07b0('0x1a3'),'foreignKey':'VoiceQueueId','onDelete':_0x07b0('0x129')});db[_0x07b0('0x7e')][_0x07b0('0x135')](db[_0x07b0('0xff')],{'as':_0x07b0('0xff'),'foreignKey':'CampaignId','onDelete':_0x07b0('0x129')});db['CmHopper']['belongsTo'](db[_0x07b0('0x14')],{'as':_0x07b0('0x17d'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'as':'Contact','foreignKey':_0x07b0('0x170'),'onDelete':_0x07b0('0x129')});db['CmHopperBlack']['belongsTo'](db['CmList'],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0x80')][_0x07b0('0x135')](db['VoiceQueue'],{'as':_0x07b0('0x1a3'),'foreignKey':_0x07b0('0x15d'),'onDelete':'cascade'});db[_0x07b0('0x80')][_0x07b0('0x135')](db[_0x07b0('0xff')],{'as':_0x07b0('0xff'),'foreignKey':_0x07b0('0x1b4'),'onDelete':_0x07b0('0x129')});db['Automation'][_0x07b0('0x125')](db[_0x07b0('0x8f')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x07b0('0x1b5'),'onDelete':_0x07b0('0x129'),'hooks':!![]});db[_0x07b0('0x89')]['hasMany'](db['Condition'],{'as':{'plural':_0x07b0('0x1b6'),'singular':'OneAny'},'foreignKey':_0x07b0('0x1b7'),'onDelete':_0x07b0('0x129'),'hooks':!![]});db[_0x07b0('0x89')]['hasMany'](db[_0x07b0('0x87')],{'as':_0x07b0('0x1b8'),'foreignKey':_0x07b0('0x1b9'),'onDelete':_0x07b0('0x129'),'hooks':!![]});db[_0x07b0('0x8d')][_0x07b0('0x125')](db[_0x07b0('0x8d')],{'as':_0x07b0('0x174'),'foreignKey':_0x07b0('0x1ba'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0x91')][_0x07b0('0x125')](db['Interval'],{'as':_0x07b0('0x1bb'),'foreignKey':_0x07b0('0x163'),'onDelete':_0x07b0('0x129'),'hooks':!![],'required':![]});db[_0x07b0('0x91')][_0x07b0('0x125')](db['VoiceExtension'],{'as':_0x07b0('0x128'),'foreignKey':'IntervalId','onDelete':_0x07b0('0x185')});db[_0x07b0('0x91')]['hasMany'](db[_0x07b0('0x184')],{'as':'MailApplications','foreignKey':_0x07b0('0x163')});db[_0x07b0('0x91')][_0x07b0('0x125')](db[_0x07b0('0x70')],{'as':_0x07b0('0x1bc'),'foreignKey':_0x07b0('0x163')});db[_0x07b0('0x91')][_0x07b0('0x125')](db[_0x07b0('0x56')],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x07b0('0x194')],{'as':_0x07b0('0x1bd'),'foreignKey':_0x07b0('0x163')});db['Schedule']['belongsTo'](db['MailAccount'],{});db['Schedule'][_0x07b0('0x135')](db[_0x07b0('0x1be')],{'foreignKey':_0x07b0('0x1bf')});db[_0x07b0('0x98')]['belongsTo'](db[_0x07b0('0xac')],{'foreignKey':_0x07b0('0x1c0')});db['Sound'][_0x07b0('0x138')](db[_0x07b0('0x1c')],{'as':'Mohs','through':_0x07b0('0x15c'),'onDelete':'restrict'});db[_0x07b0('0x9c')][_0x07b0('0x138')](db[_0x07b0('0x7c')],{'through':_0x07b0('0x1b2')});db[_0x07b0('0x9c')][_0x07b0('0x138')](db[_0x07b0('0x12e')],{'through':_0x07b0('0x1a6')});db[_0x07b0('0x9c')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x07b0('0x9c')]['belongsToMany'](db[_0x07b0('0x5f')],{'through':_0x07b0('0x195')});db[_0x07b0('0x9c')][_0x07b0('0x138')](db[_0x07b0('0x131')],{'through':_0x07b0('0x18c')});db['Tag']['belongsToMany'](db[_0x07b0('0x68')],{'through':_0x07b0('0x19e')});db[_0x07b0('0x9c')][_0x07b0('0x138')](db[_0x07b0('0x118')],{'through':_0x07b0('0x1c1')});db[_0x07b0('0xa1')]['belongsTo'](db[_0x07b0('0x1c2')],{'as':'ItemType','foreignKey':_0x07b0('0x1c3')});db[_0x07b0('0xa3')][_0x07b0('0x135')](db['CmHopper'],{'as':_0x07b0('0x1c4'),'foreignKey':'CmHopperId'});db[_0x07b0('0x1c5')]['hasMany'](db['Condition'],{'as':{'plural':_0x07b0('0x1c6'),'singular':_0x07b0('0x1c7')},'foreignKey':_0x07b0('0x1c8'),'onDelete':_0x07b0('0x129'),'hooks':!![]});db[_0x07b0('0x1c5')][_0x07b0('0x125')](db[_0x07b0('0x8f')],{'as':{'plural':_0x07b0('0x1c9'),'singular':'AnyCondition'},'foreignKey':_0x07b0('0x1ca'),'onDelete':_0x07b0('0x129'),'hooks':!![]});db[_0x07b0('0x1c5')][_0x07b0('0x125')](db[_0x07b0('0x87')],{'as':_0x07b0('0x1b8'),'foreignKey':_0x07b0('0x1cb'),'onDelete':_0x07b0('0x129'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x07b0('0xb2')],{'as':_0x07b0('0x1cc'),'onDelete':_0x07b0('0x129'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x07b0('0x1be')][_0x07b0('0x125')](db[_0x07b0('0xb2')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x07b0('0x1bf')});db[_0x07b0('0xb0')][_0x07b0('0x125')](db[_0x07b0('0xb2')],{'as':'Fields','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1cd')});db[_0x07b0('0xb2')]['belongsTo'](db[_0x07b0('0xb0')],{'foreignKey':_0x07b0('0x1cd')});db[_0x07b0('0xb6')][_0x07b0('0x125')](db[_0x07b0('0xb8')],{'as':'Configurations','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1ce')});db['SalesforceConfiguration'][_0x07b0('0x125')](db['SalesforceField'],{'as':_0x07b0('0x1cf'),'onDelete':_0x07b0('0x129'),'foreignKey':'SubjectId'});db[_0x07b0('0xb8')][_0x07b0('0x125')](db[_0x07b0('0xba')],{'as':'Descriptions','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xb8')]['hasMany'](db[_0x07b0('0xba')],{'as':'Fields','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d1')});db['SalesforceConfiguration'][_0x07b0('0x135')](db[_0x07b0('0xb6')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xba')]['hasMany'](db[_0x07b0('0xba')],{'as':_0x07b0('0x1d2'),'foreignKey':_0x07b0('0x1d3')});db['SalesforceField'][_0x07b0('0x125')](db[_0x07b0('0xba')],{'as':'Description','foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xba')][_0x07b0('0x125')](db[_0x07b0('0xba')],{'as':'Field','foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0xba')][_0x07b0('0x135')](db[_0x07b0('0xa7')],{'as':_0x07b0('0xa7'),'foreignKey':'VariableId'});db[_0x07b0('0xbc')][_0x07b0('0x125')](db['SugarcrmConfiguration'],{'as':_0x07b0('0x1d4'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1ce')});db['SugarcrmConfiguration']['hasMany'](db[_0x07b0('0xbf')],{'as':'Subjects','onDelete':_0x07b0('0x129'),'foreignKey':'SubjectId'});db[_0x07b0('0x1d5')]['hasMany'](db[_0x07b0('0xbf')],{'as':_0x07b0('0x1d6'),'onDelete':'cascade','foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0x1d5')][_0x07b0('0x125')](db[_0x07b0('0xbf')],{'as':_0x07b0('0x1cc'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0x1d5')][_0x07b0('0x135')](db[_0x07b0('0xbc')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xbf')][_0x07b0('0x125')](db[_0x07b0('0xbf')],{'as':_0x07b0('0x1d2'),'foreignKey':_0x07b0('0x1d3')});db['SugarcrmField'][_0x07b0('0x125')](db['SugarcrmField'],{'as':_0x07b0('0x1d7'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xbf')][_0x07b0('0x125')](db[_0x07b0('0xbf')],{'as':'Field','foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0xbf')][_0x07b0('0x135')](db[_0x07b0('0xa7')],{'as':_0x07b0('0xa7'),'foreignKey':_0x07b0('0x1d8')});db['DeskAccount'][_0x07b0('0x125')](db[_0x07b0('0xc2')],{'as':_0x07b0('0x1d4'),'onDelete':'cascade','foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xc2')]['hasMany'](db[_0x07b0('0xc3')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0xc2')][_0x07b0('0x125')](db['DeskField'],{'as':_0x07b0('0x1d6'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xc2')]['hasMany'](db[_0x07b0('0xc3')],{'as':_0x07b0('0x1cc'),'onDelete':_0x07b0('0x129'),'foreignKey':'FieldId'});db[_0x07b0('0xc2')][_0x07b0('0x135')](db['DeskAccount'],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xc2')][_0x07b0('0x138')](db[_0x07b0('0x9c')],{'through':_0x07b0('0x1d9')});db[_0x07b0('0xc3')][_0x07b0('0x125')](db[_0x07b0('0xc3')],{'as':'Subject','foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0xc3')][_0x07b0('0x125')](db[_0x07b0('0xc3')],{'as':_0x07b0('0x1d7'),'foreignKey':'DescriptionId'});db['DeskField'][_0x07b0('0x125')](db['DeskField'],{'as':_0x07b0('0x1da'),'foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0xc3')]['belongsTo'](db[_0x07b0('0xa7')],{'as':'Variable','foreignKey':_0x07b0('0x1d8')});db[_0x07b0('0xc5')][_0x07b0('0x125')](db[_0x07b0('0xc7')],{'as':_0x07b0('0x1d4'),'onDelete':'cascade','foreignKey':_0x07b0('0x1ce')});db['ZohoConfiguration']['hasMany'](db[_0x07b0('0xc9')],{'as':'Subjects','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0xc7')][_0x07b0('0x125')](db[_0x07b0('0xc9')],{'as':'Descriptions','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xc7')][_0x07b0('0x125')](db['ZohoField'],{'as':_0x07b0('0x1cc'),'onDelete':'cascade','foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0xc7')][_0x07b0('0x135')](db[_0x07b0('0xc5')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xc9')][_0x07b0('0x125')](db[_0x07b0('0xc9')],{'as':_0x07b0('0x1d2'),'foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0xc9')][_0x07b0('0x125')](db[_0x07b0('0xc9')],{'as':'Description','foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xc9')][_0x07b0('0x125')](db[_0x07b0('0xc9')],{'as':_0x07b0('0x1da'),'foreignKey':_0x07b0('0x1d1')});db['ZohoField'][_0x07b0('0x135')](db[_0x07b0('0xa7')],{'as':'Variable','foreignKey':'VariableId'});db[_0x07b0('0xcb')][_0x07b0('0x125')](db[_0x07b0('0x1db')],{'as':_0x07b0('0x1d4'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0x1db')][_0x07b0('0x125')](db[_0x07b0('0x1dc')],{'as':_0x07b0('0x1cf'),'foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0x1db')]['hasMany'](db[_0x07b0('0x1dc')],{'as':_0x07b0('0x1d6'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0x1db')][_0x07b0('0x125')](db['ZendeskField'],{'as':_0x07b0('0x1cc'),'foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0x1db')][_0x07b0('0x135')](db[_0x07b0('0xcb')],{'as':_0x07b0('0x17c'),'foreignKey':'AccountId'});db[_0x07b0('0x1db')][_0x07b0('0x138')](db['Tag'],{'through':_0x07b0('0x1dd')});db[_0x07b0('0x1dc')]['hasMany'](db['ZendeskField'],{'as':_0x07b0('0x1d2'),'foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0x1dc')][_0x07b0('0x125')](db[_0x07b0('0x1dc')],{'as':_0x07b0('0x1d7'),'foreignKey':_0x07b0('0x1d0')});db['ZendeskField'][_0x07b0('0x125')](db[_0x07b0('0x1dc')],{'as':'Field','foreignKey':_0x07b0('0x1d1')});db['ZendeskField'][_0x07b0('0x135')](db['Variable'],{'as':_0x07b0('0xa7'),'foreignKey':_0x07b0('0x1d8')});db['FreshdeskAccount'][_0x07b0('0x125')](db['FreshdeskConfiguration'],{'as':_0x07b0('0x1d4'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xd0')][_0x07b0('0x125')](db['FreshdeskField'],{'as':_0x07b0('0x1cf'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0xd0')]['hasMany'](db[_0x07b0('0xd1')],{'as':_0x07b0('0x1d6'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xd0')][_0x07b0('0x125')](db[_0x07b0('0xd1')],{'as':_0x07b0('0x1cc'),'onDelete':_0x07b0('0x129'),'foreignKey':'FieldId'});db['FreshdeskConfiguration']['belongsTo'](db[_0x07b0('0xce')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x1ce')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x07b0('0x9c')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x07b0('0xd1')][_0x07b0('0x125')](db[_0x07b0('0xd1')],{'as':'Subject','foreignKey':_0x07b0('0x1d3')});db['FreshdeskField'][_0x07b0('0x125')](db[_0x07b0('0xd1')],{'as':_0x07b0('0x1d7'),'foreignKey':'DescriptionId'});db[_0x07b0('0xd1')][_0x07b0('0x125')](db['FreshdeskField'],{'as':_0x07b0('0x1da'),'foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0xd1')][_0x07b0('0x135')](db['Variable'],{'as':_0x07b0('0xa7'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x07b0('0x125')](db[_0x07b0('0xd4')],{'as':_0x07b0('0x1d4'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1ce')});db['VtigerConfiguration'][_0x07b0('0x125')](db['VtigerField'],{'as':_0x07b0('0x1cf'),'foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0xd4')][_0x07b0('0x125')](db[_0x07b0('0xd6')],{'as':_0x07b0('0x1d6'),'foreignKey':'DescriptionId'});db[_0x07b0('0xd4')][_0x07b0('0x125')](db['VtigerField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x07b0('0xd4')][_0x07b0('0x135')](db[_0x07b0('0xd3')],{'as':'Account','foreignKey':_0x07b0('0x1ce')});db['VtigerField'][_0x07b0('0x125')](db['VtigerField'],{'as':'Subject','foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0xd6')][_0x07b0('0x125')](db[_0x07b0('0xd6')],{'as':_0x07b0('0x1d7'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xd6')][_0x07b0('0x125')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0x07b0('0xd6')]['belongsTo'](db[_0x07b0('0xa7')],{'as':'Variable','foreignKey':_0x07b0('0x1d8')});db[_0x07b0('0xd7')]['hasMany'](db[_0x07b0('0xd9')],{'as':'Configurations','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xd9')][_0x07b0('0x125')](db[_0x07b0('0xdb')],{'as':_0x07b0('0x1cf'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x07b0('0x125')](db[_0x07b0('0xdb')],{'as':_0x07b0('0x1d6'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xd9')][_0x07b0('0x125')](db[_0x07b0('0xdb')],{'as':_0x07b0('0x1cc'),'foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0xd9')][_0x07b0('0x135')](db[_0x07b0('0xd7')],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xdb')][_0x07b0('0x125')](db['ServicenowField'],{'as':_0x07b0('0x1d2'),'foreignKey':_0x07b0('0x1d3')});db[_0x07b0('0xdb')][_0x07b0('0x125')](db[_0x07b0('0xdb')],{'as':_0x07b0('0x1d7'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xdb')][_0x07b0('0x125')](db[_0x07b0('0xdb')],{'as':'Field','foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0xdb')][_0x07b0('0x135')](db[_0x07b0('0xa7')],{'as':_0x07b0('0xa7'),'foreignKey':_0x07b0('0x1d8')});db[_0x07b0('0xdd')][_0x07b0('0x125')](db['Dynamics365Configuration'],{'as':_0x07b0('0x1d4'),'onDelete':_0x07b0('0x129'),'foreignKey':'AccountId'});db['Dynamics365Configuration'][_0x07b0('0x125')](db[_0x07b0('0xe1')],{'as':'Subjects','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d3')});db['Dynamics365Configuration'][_0x07b0('0x125')](db[_0x07b0('0xe1')],{'as':'Descriptions','onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xdf')][_0x07b0('0x125')](db[_0x07b0('0xe1')],{'as':'Fields','onDelete':_0x07b0('0x129'),'foreignKey':'FieldId'});db[_0x07b0('0xdf')][_0x07b0('0x135')](db['Dynamics365Account'],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xe1')][_0x07b0('0x125')](db[_0x07b0('0xe1')],{'as':'Subject','foreignKey':_0x07b0('0x1d3')});db['Dynamics365Field'][_0x07b0('0x125')](db[_0x07b0('0xe1')],{'as':_0x07b0('0x1d7'),'foreignKey':_0x07b0('0x1d0')});db['Dynamics365Field']['hasMany'](db[_0x07b0('0xe1')],{'as':'Field','foreignKey':'FieldId'});db[_0x07b0('0xe1')][_0x07b0('0x135')](db[_0x07b0('0xa7')],{'as':_0x07b0('0xa7'),'foreignKey':_0x07b0('0x1d8')});db[_0x07b0('0x1de')]['hasMany'](db[_0x07b0('0x1df')],{'as':_0x07b0('0x1d4'),'onDelete':_0x07b0('0x129'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x07b0('0x125')](db[_0x07b0('0xe5')],{'as':_0x07b0('0x1cf'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x07b0('0x125')](db[_0x07b0('0xe5')],{'as':'Descriptions','foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0x1df')][_0x07b0('0x125')](db[_0x07b0('0xe5')],{'as':_0x07b0('0x1cc'),'foreignKey':'FieldId'});db[_0x07b0('0x1df')][_0x07b0('0x135')](db['FreshsalesAccount'],{'as':_0x07b0('0x17c'),'foreignKey':_0x07b0('0x1ce')});db[_0x07b0('0xe5')][_0x07b0('0x125')](db['FreshsalesField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x07b0('0xe5')]['hasMany'](db[_0x07b0('0xe5')],{'as':_0x07b0('0x1d7'),'foreignKey':_0x07b0('0x1d0')});db[_0x07b0('0xe5')][_0x07b0('0x125')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x07b0('0x1d1')});db[_0x07b0('0xe5')][_0x07b0('0x135')](db[_0x07b0('0xa7')],{'as':_0x07b0('0xa7'),'foreignKey':_0x07b0('0x1d8')});db['ChatQueueReport']['belongsTo'](db[_0x07b0('0x6c')],{});db[_0x07b0('0xe9')]['belongsTo'](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x07b0('0x135')](db['CmContact'],{'as':'Contact','foreignKey':_0x07b0('0x170')});db[_0x07b0('0xe9')][_0x07b0('0x135')](db[_0x07b0('0x12e')],{});db[_0x07b0('0xe9')][_0x07b0('0x135')](db['ChatMessage'],{});db[_0x07b0('0xe9')]['belongsTo'](db[_0x07b0('0x14')],{});db[_0x07b0('0xe9')][_0x07b0('0x135')](db[_0x07b0('0x144')],{});db[_0x07b0('0xeb')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'onDelete':_0x07b0('0x129'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x07b0('0x135')](db['User'],{'onDelete':'cascade','foreignKey':_0x07b0('0x1e0')});db[_0x07b0('0xf0')][_0x07b0('0x125')](db[_0x07b0('0xee')],{'foreignKey':_0x07b0('0x1e1'),'onDelete':_0x07b0('0x129')});db['JscriptySessionReport'][_0x07b0('0x125')](db[_0x07b0('0xec')],{'foreignKey':_0x07b0('0x1e1'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0xf1')][_0x07b0('0x135')](db[_0x07b0('0x155')],{});db[_0x07b0('0xf1')]['belongsTo'](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0xf1')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'as':_0x07b0('0x16f'),'foreignKey':_0x07b0('0x170')});db[_0x07b0('0xf1')][_0x07b0('0x135')](db[_0x07b0('0x5f')],{});db[_0x07b0('0xf1')][_0x07b0('0x135')](db[_0x07b0('0x61')],{});db['SmsQueueReport'][_0x07b0('0x135')](db[_0x07b0('0x14')],{});db[_0x07b0('0xf1')][_0x07b0('0x135')](db[_0x07b0('0x63')],{});db[_0x07b0('0xf6')][_0x07b0('0x125')](db[_0x07b0('0xf0')],{'foreignKey':'ProjectId'});db[_0x07b0('0xf6')][_0x07b0('0x125')](db[_0x07b0('0xee')],{'foreignKey':_0x07b0('0x1e2')});db[_0x07b0('0xf6')][_0x07b0('0x125')](db[_0x07b0('0xec')],{'foreignKey':'ProjectId'});db['SquareProject'][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x18d'),'through':'user_has_square_projects'});db[_0x07b0('0x13c')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':'user_has_teams'});db['Team'][_0x07b0('0x138')](db[_0x07b0('0x1e')],{'through':_0x07b0('0x121'),'as':_0x07b0('0x1e3')});db[_0x07b0('0x13c')]['belongsToMany'](db['MailQueue'],{'through':_0x07b0('0x17a'),'as':_0x07b0('0x143')});db[_0x07b0('0x13c')][_0x07b0('0x138')](db[_0x07b0('0x144')],{'through':_0x07b0('0x1a7'),'as':'ChatQueues'});db[_0x07b0('0x13c')]['belongsToMany'](db[_0x07b0('0x191')],{'through':_0x07b0('0x192'),'as':_0x07b0('0x146')});db[_0x07b0('0x13c')]['belongsToMany'](db['SmsQueue'],{'through':_0x07b0('0x199'),'as':_0x07b0('0x147')});db[_0x07b0('0x13c')][_0x07b0('0x138')](db['OpenchannelQueue'],{'through':_0x07b0('0x19f'),'as':_0x07b0('0x148')});db[_0x07b0('0x13c')][_0x07b0('0x138')](db[_0x07b0('0x11e')],{'through':_0x07b0('0x1e4'),'as':'WhatsappQueues'});db[_0x07b0('0xff')][_0x07b0('0x125')](db[_0x07b0('0x7e')],{'as':_0x07b0('0x15e'),'foreignKey':_0x07b0('0x1b4')});db[_0x07b0('0xff')]['hasMany'](db[_0x07b0('0x81')],{'as':_0x07b0('0x12a'),'foreignKey':'CampaignId'});db['Campaign'][_0x07b0('0x125')](db['CmHopperHistory'],{'as':_0x07b0('0x15f'),'foreignKey':'CampaignId'});db[_0x07b0('0xff')][_0x07b0('0x125')](db[_0x07b0('0x80')],{'as':_0x07b0('0x160'),'foreignKey':_0x07b0('0x1b4')});db[_0x07b0('0xff')][_0x07b0('0x135')](db[_0x07b0('0x30')],{'as':_0x07b0('0x30'),'foreignKey':'TrunkId'});db[_0x07b0('0xff')][_0x07b0('0x135')](db[_0x07b0('0x30')],{'as':'TrunkBackup','foreignKey':_0x07b0('0x1e5')});db[_0x07b0('0xff')][_0x07b0('0x135')](db[_0x07b0('0x91')],{'as':_0x07b0('0x91'),'foreignKey':_0x07b0('0x163')});db[_0x07b0('0xff')][_0x07b0('0x135')](db['SquareProject'],{'as':_0x07b0('0xf9'),'foreignKey':_0x07b0('0x1e6')});db['Campaign']['belongsToMany'](db[_0x07b0('0x10b')],{'as':_0x07b0('0x13b'),'through':_0x07b0('0x1e7')});db[_0x07b0('0xff')][_0x07b0('0x138')](db[_0x07b0('0x10b')],{'as':'BlackLists','through':_0x07b0('0x1e8')});db[_0x07b0('0x101')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x07b0('0x104')][_0x07b0('0x135')](db[_0x07b0('0x4c')],{});db[_0x07b0('0x104')]['belongsTo'](db['MailInteraction'],{});db[_0x07b0('0x104')]['belongsTo'](db[_0x07b0('0x45')],{'foreignKey':_0x07b0('0x1e9'),'as':_0x07b0('0x1ea')});db[_0x07b0('0x104')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'foreignKey':_0x07b0('0x1eb'),'as':_0x07b0('0x1ec')});db['MailTransferReport'][_0x07b0('0x135')](db[_0x07b0('0x14')],{'foreignKey':_0x07b0('0x1ed'),'as':'ToAgent'});db[_0x07b0('0x104')][_0x07b0('0x135')](db['MailQueue'],{'foreignKey':_0x07b0('0x1ee'),'as':_0x07b0('0x1ef')});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0x07b0('0x1f0'),'as':_0x07b0('0x1f1')});db[_0x07b0('0x1f2')]['belongsTo'](db[_0x07b0('0x73')],{});db[_0x07b0('0x1f2')][_0x07b0('0x135')](db['ChatInteraction'],{});db[_0x07b0('0x1f2')]['belongsTo'](db[_0x07b0('0x6c')],{'foreignKey':_0x07b0('0x1f3'),'as':_0x07b0('0x1ea')});db[_0x07b0('0x1f2')]['belongsTo'](db[_0x07b0('0x14')],{'foreignKey':'FromUserId','as':_0x07b0('0x1ec')});db[_0x07b0('0x1f2')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'foreignKey':_0x07b0('0x1ed'),'as':_0x07b0('0x1f4')});db[_0x07b0('0x1f2')]['belongsTo'](db[_0x07b0('0x144')],{'foreignKey':'ToChatQueueId','as':_0x07b0('0x1ef')});db[_0x07b0('0x1f2')][_0x07b0('0x135')](db[_0x07b0('0x6c')],{'foreignKey':_0x07b0('0x1f5'),'as':_0x07b0('0x1f1')});db[_0x07b0('0x107')][_0x07b0('0x135')](db[_0x07b0('0x59')],{});db['FaxTransferReport']['belongsTo'](db[_0x07b0('0x131')],{});db[_0x07b0('0x107')][_0x07b0('0x135')](db[_0x07b0('0x54')],{'foreignKey':_0x07b0('0x1f6'),'as':'FromAccount'});db[_0x07b0('0x107')]['belongsTo'](db[_0x07b0('0x14')],{'foreignKey':_0x07b0('0x1eb'),'as':_0x07b0('0x1ec')});db[_0x07b0('0x107')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'foreignKey':_0x07b0('0x1ed'),'as':_0x07b0('0x1f4')});db[_0x07b0('0x107')][_0x07b0('0x135')](db['FaxQueue'],{'foreignKey':_0x07b0('0x1f7'),'as':_0x07b0('0x1ef')});db[_0x07b0('0x107')]['belongsTo'](db[_0x07b0('0x54')],{'foreignKey':_0x07b0('0x1f8'),'as':'ToAccount'});db[_0x07b0('0x108')][_0x07b0('0x135')](db[_0x07b0('0x69')],{});db[_0x07b0('0x108')][_0x07b0('0x135')](db[_0x07b0('0x68')],{});db[_0x07b0('0x108')][_0x07b0('0x135')](db[_0x07b0('0x152')],{'foreignKey':'FromOpenchannelAccountId','as':_0x07b0('0x1ea')});db['OpenchannelTransferReport']['belongsTo'](db[_0x07b0('0x14')],{'foreignKey':'FromUserId','as':_0x07b0('0x1ec')});db['OpenchannelTransferReport']['belongsTo'](db[_0x07b0('0x14')],{'foreignKey':_0x07b0('0x1ed'),'as':_0x07b0('0x1f4')});db[_0x07b0('0x108')][_0x07b0('0x135')](db[_0x07b0('0x19b')],{'foreignKey':_0x07b0('0x1f9'),'as':'ToQueue'});db[_0x07b0('0x108')][_0x07b0('0x135')](db[_0x07b0('0x152')],{'foreignKey':_0x07b0('0x1fa'),'as':'ToAccount'});db[_0x07b0('0x1fb')][_0x07b0('0x135')](db[_0x07b0('0x61')],{});db[_0x07b0('0x1fb')][_0x07b0('0x135')](db[_0x07b0('0x5f')],{});db['SmsTransferReport'][_0x07b0('0x135')](db[_0x07b0('0x155')],{'foreignKey':_0x07b0('0x1fc'),'as':'FromAccount'});db[_0x07b0('0x1fb')]['belongsTo'](db[_0x07b0('0x14')],{'foreignKey':_0x07b0('0x1eb'),'as':'FromAgent'});db[_0x07b0('0x1fb')][_0x07b0('0x135')](db['User'],{'foreignKey':_0x07b0('0x1ed'),'as':_0x07b0('0x1f4')});db[_0x07b0('0x1fb')][_0x07b0('0x135')](db[_0x07b0('0x63')],{'foreignKey':'ToSmsQueueId','as':_0x07b0('0x1ef')});db['SmsTransferReport'][_0x07b0('0x135')](db[_0x07b0('0x155')],{'foreignKey':'ToSmsAccountId','as':_0x07b0('0x1f1')});db['CmList'][_0x07b0('0x125')](db['Disposition'],{'as':_0x07b0('0x174'),'foreignKey':'ListId'});db[_0x07b0('0x10b')][_0x07b0('0x125')](db['CmCustomField'],{'as':_0x07b0('0x1fd'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x10b')]['hasMany'](db[_0x07b0('0x7c')],{'as':_0x07b0('0x1ab'),'onDelete':_0x07b0('0x129'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x10b')][_0x07b0('0x125')](db['CmHopperFinal'],{'as':_0x07b0('0x12a'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x10b')][_0x07b0('0x125')](db[_0x07b0('0x12b')],{'as':_0x07b0('0x12c'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x10b')][_0x07b0('0x125')](db[_0x07b0('0x84')],{'as':_0x07b0('0x84'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x10b')]['belongsToMany'](db['VoiceQueue'],{'as':_0x07b0('0x1fe'),'through':'voice_queues_has_cm_lists'});db[_0x07b0('0x10b')][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':_0x07b0('0x14a')});db[_0x07b0('0x14b')][_0x07b0('0x125')](db[_0x07b0('0x1a')],{'as':_0x07b0('0x128'),'onDelete':'cascade'});db[_0x07b0('0x14b')][_0x07b0('0x138')](db['User'],{'as':_0x07b0('0x167'),'through':_0x07b0('0x14d')});db[_0x07b0('0x136')][_0x07b0('0x125')](db[_0x07b0('0x14')],{'as':_0x07b0('0x18d'),'foreignKey':_0x07b0('0x137')});db[_0x07b0('0x136')][_0x07b0('0x125')](db['UserProfileSection'],{'as':_0x07b0('0x1ff'),'foreignKey':_0x07b0('0x137'),'onDelete':_0x07b0('0x129')});db[_0x07b0('0x10f')]['hasMany'](db[_0x07b0('0x200')],{'as':_0x07b0('0x201'),'foreignKey':_0x07b0('0x202'),'onDelete':_0x07b0('0x129')});db['WhatsappAccount'][_0x07b0('0x125')](db[_0x07b0('0x8d')],{'as':'Dispositions','foreignKey':_0x07b0('0x203')});db['WhatsappAccount'][_0x07b0('0x125')](db[_0x07b0('0x8b')],{'as':_0x07b0('0x18b'),'foreignKey':_0x07b0('0x203')});db[_0x07b0('0x114')][_0x07b0('0x125')](db[_0x07b0('0x11a')],{'as':'Messages','foreignKey':_0x07b0('0x203')});db['WhatsappAccount'][_0x07b0('0x125')](db[_0x07b0('0x118')],{'as':'Interactions'});db['WhatsappAccount'][_0x07b0('0x125')](db[_0x07b0('0x116')],{'as':_0x07b0('0x177')});db[_0x07b0('0x114')]['belongsTo'](db[_0x07b0('0x10b')],{'as':_0x07b0('0x188'),'foreignKey':_0x07b0('0x178')});db[_0x07b0('0x114')][_0x07b0('0x135')](db[_0x07b0('0x92')],{'as':_0x07b0('0x164'),'foreignKey':_0x07b0('0x165')});db['WhatsappAccount']['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_whatsapp_accounts'});db['WhatsappApplication']['belongsTo'](db[_0x07b0('0x14')],{'onDelete':'restrict'});db[_0x07b0('0x116')]['belongsTo'](db[_0x07b0('0x11e')],{'onDelete':_0x07b0('0x185')});db[_0x07b0('0x116')]['belongsTo'](db[_0x07b0('0x114')],{'onDelete':'restrict'});db[_0x07b0('0x116')][_0x07b0('0x135')](db[_0x07b0('0x91')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x07b0('0x116')][_0x07b0('0x135')](db['Tag'],{'onDelete':_0x07b0('0x185'),'foreignKey':_0x07b0('0x186')});db['WhatsappInteraction'][_0x07b0('0x125')](db[_0x07b0('0x11a')],{'as':_0x07b0('0x175'),'onDelete':'cascade','foreignKey':_0x07b0('0x204')});db[_0x07b0('0x118')]['belongsTo'](db[_0x07b0('0x114')],{'as':_0x07b0('0x17c'),'foreignKey':'WhatsappAccountId'});db[_0x07b0('0x118')][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'as':'Contact','foreignKey':_0x07b0('0x170')});db['WhatsappInteraction']['belongsTo'](db[_0x07b0('0x14')],{'as':'Owner','foreignKey':_0x07b0('0x124')});db[_0x07b0('0x118')][_0x07b0('0x138')](db[_0x07b0('0x9c')],{'through':'whatsapp_interaction_has_tags','as':_0x07b0('0x17f')});db[_0x07b0('0x118')]['belongsToMany'](db[_0x07b0('0x9c')],{'through':_0x07b0('0x1c1'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x07b0('0x204')});db[_0x07b0('0x11a')][_0x07b0('0x135')](db[_0x07b0('0x14')],{'as':_0x07b0('0x14')});db[_0x07b0('0x11a')]['belongsTo'](db[_0x07b0('0x7c')],{'onDelete':_0x07b0('0x129'),'as':_0x07b0('0x16f')});db[_0x07b0('0x11a')]['belongsTo'](db[_0x07b0('0x118')],{'onDelete':_0x07b0('0x129'),'as':_0x07b0('0x18f'),'foreignKey':_0x07b0('0x204')});db[_0x07b0('0x11a')][_0x07b0('0x135')](db[_0x07b0('0x114')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x07b0('0x11c')][_0x07b0('0x135')](db[_0x07b0('0x114')],{});db[_0x07b0('0x11c')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x07b0('0x178')});db['WhatsappQueueReport'][_0x07b0('0x135')](db[_0x07b0('0x7c')],{'as':_0x07b0('0x16f'),'foreignKey':'ContactId'});db[_0x07b0('0x11c')][_0x07b0('0x135')](db[_0x07b0('0x118')],{});db['WhatsappQueueReport'][_0x07b0('0x135')](db[_0x07b0('0x11e')],{});db[_0x07b0('0x11c')][_0x07b0('0x135')](db[_0x07b0('0x11a')],{});db[_0x07b0('0x11c')][_0x07b0('0x135')](db[_0x07b0('0x14')],{});db[_0x07b0('0x205')][_0x07b0('0x135')](db[_0x07b0('0x11a')],{});db[_0x07b0('0x205')][_0x07b0('0x135')](db['WhatsappInteraction'],{});db[_0x07b0('0x205')][_0x07b0('0x135')](db[_0x07b0('0x114')],{'foreignKey':_0x07b0('0x206'),'as':_0x07b0('0x1ea')});db[_0x07b0('0x205')][_0x07b0('0x135')](db[_0x07b0('0x114')],{'foreignKey':_0x07b0('0x207'),'as':_0x07b0('0x1f1')});db[_0x07b0('0x205')][_0x07b0('0x135')](db[_0x07b0('0x11e')],{'foreignKey':_0x07b0('0x208'),'as':_0x07b0('0x1ef')});db[_0x07b0('0x205')][_0x07b0('0x135')](db['User'],{'foreignKey':_0x07b0('0x1eb'),'as':'FromAgent'});db[_0x07b0('0x205')]['belongsTo'](db[_0x07b0('0x14')],{'foreignKey':'ToUserId','as':_0x07b0('0x1f4')});db['WhatsappQueue'][_0x07b0('0x138')](db[_0x07b0('0x14')],{'as':_0x07b0('0x167'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x07b0('0x11e')][_0x07b0('0x138')](db[_0x07b0('0x13c')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0x07b0('0x209')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2419=['SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','hasMany','VoiceRecording','Recordings','UserId','Extensions','CmHopperFinal','HopperFinals','HopperHistory','ReportAgentPreview','ChatInteractions','FaxInteraction','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteractions','VoiceQueues','MailQueue','MailQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','ChatWebsites','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','VoiceChanSpy','SpiedAgents','cascade','ChanSpyId','Applications','Sound','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','MailMessage','Interactions','List','ListId','TemplateId','team_has_mail_queues','Messages','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachment','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','FaxAccountId','FaxApplication','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','Tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','UserChatQueue','ChatInternalMessage','ChatGroupId','CompanyId','CmContactId','Company','cm_contact_has_tags','CmHopperId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','AllCondition','TriggerAllId','AnyCondition','Fields','DefaultReportId','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','SugarcrmField','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ChatQueueReport','FromId','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','team_has_chat_queues','ChatQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','user_has_voice_prefixes','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','mysql','utf8_general_ci','database','username','password','options','User','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','FaxAccount','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasPhone','../api/cmContactHasPhone/cmContactHasPhone.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/network/network.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model'];(function(_0x2ce4d9,_0x47173f){var _0x3a802c=function(_0x13c969){while(--_0x13c969){_0x2ce4d9['push'](_0x2ce4d9['shift']());}};_0x3a802c(++_0x47173f);}(_0x2419,0x11b));var _0x9241=function(_0x46f9eb,_0x371671){_0x46f9eb=_0x46f9eb-0x0;var _0x3709b3=_0x2419[_0x46f9eb];return _0x3709b3;};'use strict';var path=require(_0x9241('0x0'));var config=require(_0x9241('0x1'));var Sequelize=require(_0x9241('0x2'));var _=require(_0x9241('0x3'));var jstz=require(_0x9241('0x4'));var timezone=jstz['determine']();config['sequelize']=_[_0x9241('0x5')](config[_0x9241('0x2')],{'database':_0x9241('0x6'),'username':_0x9241('0x7'),'password':_0x9241('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x9241('0x9')},'logging':![],'timezone':timezone[_0x9241('0xa')](),'define':{'charset':_0x9241('0xb'),'collate':'utf8_general_ci'}}});config[_0x9241('0xc')]=_[_0x9241('0x5')](config[_0x9241('0xc')],{'database':'motion2','username':'xcall','password':_0x9241('0x8'),'options':{'host':_0x9241('0xd'),'port':0xcea,'dialect':_0x9241('0xe'),'dialectOptions':{'charset':_0x9241('0x9')},'logging':![],'timezone':timezone[_0x9241('0xa')](),'define':{'charset':_0x9241('0xb'),'collate':_0x9241('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9241('0x2')][_0x9241('0x10')],config['sequelize'][_0x9241('0x11')],config[_0x9241('0x2')][_0x9241('0x12')],config['sequelize'][_0x9241('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9241('0xc')][_0x9241('0x10')],config['sequelizeHistory']['username'],config['sequelizeHistory']['password'],config['sequelizeHistory'][_0x9241('0x13')])};db[_0x9241('0x14')]=db[_0x9241('0x2')]['import']('../api/user/user.model');db['VoiceChanSpy']=db['sequelize'][_0x9241('0x15')](_0x9241('0x16'));db[_0x9241('0x17')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/voiceContext/voiceContext.model');db[_0x9241('0x18')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0x9241('0x19')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x9241('0x1a')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x1b'));db['VoiceRecording']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x1c'));db[_0x9241('0x1d')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x1e'));db['VoiceMail']=db[_0x9241('0x2')]['import'](_0x9241('0x1f'));db[_0x9241('0x20')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x21'));db['VoiceCallReport']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x22'));db['VoiceDialReport']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x23'));db[_0x9241('0x24')]=db[_0x9241('0x2')]['import'](_0x9241('0x25'));db['VoiceQueueReport']=db[_0x9241('0x2')][_0x9241('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x9241('0x26')]=db['sequelize']['import'](_0x9241('0x27'));db[_0x9241('0x28')]=db['sequelize']['import'](_0x9241('0x29'));db[_0x9241('0x2a')]=db[_0x9241('0x2')]['import'](_0x9241('0x2b'));db[_0x9241('0x2c')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x2d'));db[_0x9241('0x2e')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x2f'));db['UserChatQueue']=db['sequelize'][_0x9241('0x15')](_0x9241('0x30'));db[_0x9241('0x31')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x32'));db[_0x9241('0x33')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x34'));db[_0x9241('0x35')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x36'));db[_0x9241('0x37')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x38'));db[_0x9241('0x39')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x3a'));db['MailServerIn']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x3b'));db[_0x9241('0x3c')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x3d'));db[_0x9241('0x3e')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x3f'));db[_0x9241('0x40')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x41'));db['MailInteraction']=db['sequelize'][_0x9241('0x15')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x42'));db[_0x9241('0x43')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x44'));db[_0x9241('0x45')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x46'));db['DashboardItem']=db[_0x9241('0x2')][_0x9241('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0x9241('0x47')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x48'));db['FaxInteraction']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x49'));db[_0x9241('0x4a')]=db[_0x9241('0x2')]['import'](_0x9241('0x4b'));db[_0x9241('0x4c')]=db[_0x9241('0x2')]['import'](_0x9241('0x4d'));db[_0x9241('0x4e')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x4f'));db[_0x9241('0x50')]=db[_0x9241('0x2')]['import'](_0x9241('0x51'));db[_0x9241('0x52')]=db['sequelize']['import'](_0x9241('0x53'));db[_0x9241('0x54')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x55'));db[_0x9241('0x56')]=db[_0x9241('0x2')]['import'](_0x9241('0x57'));db[_0x9241('0x58')]=db[_0x9241('0x2')]['import'](_0x9241('0x59'));db[_0x9241('0x5a')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x5b'));db[_0x9241('0x5c')]=db['sequelize']['import'](_0x9241('0x5d'));db[_0x9241('0x5e')]=db['sequelize'][_0x9241('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x9241('0x5f')]=db[_0x9241('0x2')]['import'](_0x9241('0x60'));db[_0x9241('0x61')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x62'));db[_0x9241('0x63')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x64'));db[_0x9241('0x65')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x9241('0x2')][_0x9241('0x15')]('../api/chatApplication/chatApplication.model');db[_0x9241('0x66')]=db['sequelize']['import']('../api/chatInteraction/chatInteraction.model');db[_0x9241('0x67')]=db['sequelize'][_0x9241('0x15')]('../api/chatMessage/chatMessage.model');db[_0x9241('0x68')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x69'));db[_0x9241('0x6a')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x6b'));db[_0x9241('0x6c')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x6d'));db['ChatProactiveAction']=db[_0x9241('0x2')][_0x9241('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x9241('0x6e')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x6f'));db[_0x9241('0x70')]=db[_0x9241('0x2')]['import'](_0x9241('0x71'));db[_0x9241('0x72')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/cmHopper/cmHopper.model');db[_0x9241('0x73')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x74'));db['CmHopperFinal']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x75'));db[_0x9241('0x76')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db['sequelize']['import'](_0x9241('0x77'));db[_0x9241('0x78')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x79'));db[_0x9241('0x7a')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/action/action.model');db[_0x9241('0x7b')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x7c'));db[_0x9241('0x7d')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x7e'));db['Disposition']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x7f'));db[_0x9241('0x80')]=db[_0x9241('0x2')]['import'](_0x9241('0x81'));db[_0x9241('0x82')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/interval/interval.model');db[_0x9241('0x83')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x84'));db['Cdr']=db[_0x9241('0x2')]['import']('../api/cdr/cdr.model');db[_0x9241('0x85')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x86'));db[_0x9241('0x87')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x88'));db['Sound']=db[_0x9241('0x2')]['import']('../api/sound/sound.model');db[_0x9241('0x89')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x8a'));db[_0x9241('0x8b')]=db[_0x9241('0x2')]['import'](_0x9241('0x8c'));db[_0x9241('0x8d')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x8e'));db[_0x9241('0x8f')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x90'));db[_0x9241('0x91')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x92'));db[_0x9241('0x93')]=db['sequelize'][_0x9241('0x15')]('../api/template/template.model');db[_0x9241('0x94')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x95'));db['Variable']=db['sequelize'][_0x9241('0x15')](_0x9241('0x96'));db[_0x9241('0x97')]=db[_0x9241('0x2')]['import'](_0x9241('0x98'));db[_0x9241('0x99')]=db['sequelize']['import'](_0x9241('0x9a'));db[_0x9241('0x9b')]=db['sequelize'][_0x9241('0x15')](_0x9241('0x9c'));db[_0x9241('0x9d')]=db[_0x9241('0x2')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x9241('0x9e')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x9f'));db[_0x9241('0xa0')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0x9241('0xa1')]=db[_0x9241('0x2')]['import'](_0x9241('0xa2'));db['AnalyticTreeReport']=db[_0x9241('0x2')][_0x9241('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x9241('0xa3')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xa4'));db[_0x9241('0xa5')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xa6'));db['SalesforceField']=db[_0x9241('0x2')][_0x9241('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0x9241('0xa7')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xa8'));db['SugarcrmConfiguration']=db[_0x9241('0x2')]['import'](_0x9241('0xa9'));db['SugarcrmField']=db[_0x9241('0x2')]['import'](_0x9241('0xaa'));db[_0x9241('0xab')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0x9241('0xac')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xad'));db[_0x9241('0xae')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xaf'));db[_0x9241('0xb0')]=db['sequelize'][_0x9241('0x15')](_0x9241('0xb1'));db['ZohoConfiguration']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xb2'));db[_0x9241('0xb3')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/intZohoField/intZohoField.model');db[_0x9241('0xb4')]=db[_0x9241('0x2')]['import'](_0x9241('0xb5'));db[_0x9241('0xb6')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xb7'));db[_0x9241('0xb8')]=db['sequelize']['import'](_0x9241('0xb9'));db[_0x9241('0xba')]=db['sequelize']['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x9241('0xbb')]=db[_0x9241('0x2')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x9241('0xbc')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xbd'));db['VtigerAccount']=db['sequelize'][_0x9241('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x9241('0xbe')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x9241('0xbf')]=db['sequelize'][_0x9241('0x15')](_0x9241('0xc0'));db[_0x9241('0xc1')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xc2'));db[_0x9241('0xc3')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x9241('0xc4')]=db['sequelize'][_0x9241('0x15')](_0x9241('0xc5'));db[_0x9241('0xc6')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xc7'));db[_0x9241('0xc8')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xc9'));db[_0x9241('0xca')]=db[_0x9241('0x2')]['import'](_0x9241('0xcb'));db[_0x9241('0xcc')]=db[_0x9241('0x2')]['import'](_0x9241('0xcd'));db[_0x9241('0xce')]=db['sequelize'][_0x9241('0x15')](_0x9241('0xcf'));db[_0x9241('0xd0')]=db[_0x9241('0x2')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db['sequelize'][_0x9241('0x15')](_0x9241('0x98'));db['Network']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xd1'));db['ChatQueueReport']=db['sequelize'][_0x9241('0x15')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xd2'));db[_0x9241('0xd3')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x9241('0xd4')]=db[_0x9241('0x2')]['import'](_0x9241('0xd5'));db[_0x9241('0xd6')]=db[_0x9241('0x2')]['import'](_0x9241('0xd7'));db['SmsQueueReport']=db['sequelize'][_0x9241('0x15')](_0x9241('0xd8'));db[_0x9241('0xd9')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xda'));db['SquareDetailsReport']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xdb'));db['JscriptyProject']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xdc'));db['Setting']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xdd'));db[_0x9241('0xde')]=db[_0x9241('0x2')]['import'](_0x9241('0xdf'));db[_0x9241('0xe0')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xe1'));db['SquareRecording']=db[_0x9241('0x2')]['import'](_0x9241('0xe2'));db[_0x9241('0xe3')]=db['sequelize'][_0x9241('0x15')]('../api/squareMessage/squareMessage.model');db[_0x9241('0xe4')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/team/team.model');db[_0x9241('0xe5')]=db[_0x9241('0x2')]['import'](_0x9241('0xe6'));db[_0x9241('0xe7')]=db[_0x9241('0x2')]['import'](_0x9241('0xe8'));db[_0x9241('0xe9')]=db[_0x9241('0x2')]['import'](_0x9241('0xea'));db['Attachment']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xeb'));db['Plugin']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xec'));db[_0x9241('0xed')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xee'));db[_0x9241('0xef')]=db['sequelize'][_0x9241('0x15')](_0x9241('0xf0'));db[_0x9241('0xf1')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xf2'));db['OpenchannelTransferReport']=db[_0x9241('0x2')][_0x9241('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xf3'));db[_0x9241('0xf4')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xf5'));db[_0x9241('0xf6')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xf7'));db[_0x9241('0xf8')]=db[_0x9241('0x2')]['import']('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0x9241('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0x9241('0xf9')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xfa'));db[_0x9241('0xfb')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xfc'));db[_0x9241('0xfd')]=db[_0x9241('0x2')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x9241('0xfe')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0xff'));db[_0x9241('0x100')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x101'));db[_0x9241('0x102')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/whatsappMessage/whatsappMessage.model');db[_0x9241('0x103')]=db[_0x9241('0x2')][_0x9241('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x9241('0x104')]=db[_0x9241('0x2')]['import'](_0x9241('0x105'));db['WhatsappQueue']=db[_0x9241('0x2')]['import'](_0x9241('0x106'));db[_0x9241('0x107')]=db[_0x9241('0x2')]['import'](_0x9241('0x108'));db[_0x9241('0x109')]=db[_0x9241('0x2')][_0x9241('0x15')](_0x9241('0x10a'));db[_0x9241('0x14')][_0x9241('0x10b')](db[_0x9241('0x10c')],{'as':_0x9241('0x10c'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x9241('0x14')][_0x9241('0x10d')](db[_0x9241('0x10e')],{'as':_0x9241('0x10f'),'foreignKey':_0x9241('0x110')});db[_0x9241('0x14')][_0x9241('0x10d')](db[_0x9241('0x2c')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x9241('0x14')][_0x9241('0x10d')](db['VoiceExtension'],{'as':_0x9241('0x111'),'onDelete':'cascade','hooks':!![]});db['User']['hasMany'](db[_0x9241('0x112')],{'as':_0x9241('0x113'),'foreignKey':'UserId'});db[_0x9241('0x14')][_0x9241('0x10d')](db[_0x9241('0x76')],{'as':_0x9241('0x114'),'foreignKey':_0x9241('0x110')});db[_0x9241('0x14')][_0x9241('0x10d')](db['ReportAgentPreview'],{'as':_0x9241('0x115'),'foreignKey':_0x9241('0x110')});db[_0x9241('0x14')][_0x9241('0x10d')](db[_0x9241('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0x9241('0x110')});db[_0x9241('0x14')][_0x9241('0x10d')](db[_0x9241('0x66')],{'as':_0x9241('0x116'),'foreignKey':_0x9241('0x110')});db[_0x9241('0x14')][_0x9241('0x10d')](db[_0x9241('0x54')],{'as':'SmsInteractions','foreignKey':_0x9241('0x110')});db[_0x9241('0x14')]['hasMany'](db[_0x9241('0x117')],{'as':_0x9241('0x118'),'foreignKey':'UserId'});db[_0x9241('0x14')]['hasMany'](db[_0x9241('0x119')],{'as':_0x9241('0x11a'),'foreignKey':'UserId'});db[_0x9241('0x14')][_0x9241('0x10d')](db[_0x9241('0x100')],{'as':_0x9241('0x11b'),'foreignKey':_0x9241('0x110')});db[_0x9241('0x14')][_0x9241('0x10d')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0x9241('0x11c')});db[_0x9241('0x14')][_0x9241('0x11d')](db[_0x9241('0xf8')],{'as':_0x9241('0xf8'),'foreignKey':_0x9241('0x11e')});db['User']['belongsToMany'](db[_0x9241('0x6c')],{'as':'Groups','through':_0x9241('0x11f')});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x70')],{'as':_0x9241('0x121'),'through':_0x9241('0x122')});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0xf4')],{'as':_0x9241('0x123'),'through':_0x9241('0x124')});db[_0x9241('0x14')]['belongsToMany'](db[_0x9241('0xe4')],{'through':_0x9241('0x125')});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x119')],{'as':_0x9241('0x11a'),'through':_0x9241('0x126')});db[_0x9241('0x14')]['belongsToMany'](db[_0x9241('0x66')],{'as':_0x9241('0x116'),'through':'user_has_chat_interactions'});db['User'][_0x9241('0x120')](db[_0x9241('0x117')],{'as':_0x9241('0x118'),'through':_0x9241('0x127')});db[_0x9241('0x14')][_0x9241('0x120')](db['SmsInteraction'],{'as':_0x9241('0x128'),'through':_0x9241('0x129')});db[_0x9241('0x14')]['belongsToMany'](db[_0x9241('0x5e')],{'as':_0x9241('0x12a'),'through':'user_has_openchannel_interactions'});db[_0x9241('0x14')][_0x9241('0x120')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x1a')],{'as':_0x9241('0x12b'),'through':_0x9241('0x2e'),'required':![]});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x12c')],{'as':_0x9241('0x12d'),'through':_0x9241('0x31'),'required':![]});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x6a')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x9241('0x14')][_0x9241('0x120')](db['FaxQueue'],{'as':_0x9241('0x12e'),'through':_0x9241('0x33'),'required':![]});db['User'][_0x9241('0x120')](db[_0x9241('0x58')],{'as':_0x9241('0x12f'),'through':_0x9241('0x35'),'required':![]});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x61')],{'as':_0x9241('0x130'),'through':_0x9241('0x37'),'required':![]});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x131')],{'as':_0x9241('0x132'),'through':_0x9241('0x39'),'required':![]});db[_0x9241('0x14')]['belongsToMany'](db[_0x9241('0xf4')],{'through':'cm_user_has_lists'});db[_0x9241('0x14')][_0x9241('0x120')](db['VoicePrefix'],{'as':_0x9241('0x133'),'through':'user_has_voice_prefixes','required':![]});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x63')],{'as':_0x9241('0x134'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0x9241('0x47')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x3e')],{'as':_0x9241('0x135'),'through':_0x9241('0x136')});db['User'][_0x9241('0x120')](db[_0x9241('0x5a')],{'as':'OpenchannelAccounts','through':_0x9241('0x137')});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0x50')],{'as':_0x9241('0x138'),'through':'user_has_sms_accounts'});db[_0x9241('0x14')]['belongsToMany'](db[_0x9241('0xfd')],{'as':_0x9241('0x139'),'through':_0x9241('0x13a')});db[_0x9241('0x14')][_0x9241('0x120')](db[_0x9241('0xe0')],{'as':'SquareProjects','through':_0x9241('0x13b')});db[_0x9241('0x13c')]['hasMany'](db[_0x9241('0x18')],{'as':_0x9241('0x13d'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x13f')});db[_0x9241('0x17')][_0x9241('0x10d')](db['VoiceExtension'],{'onDelete':_0x9241('0x13e')});db[_0x9241('0x18')]['hasMany'](db[_0x9241('0x18')],{'as':_0x9241('0x140'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0x9241('0x120')](db[_0x9241('0x141')],{'as':'Sounds','through':_0x9241('0x142')});db['VoiceQueue'][_0x9241('0x10d')](db[_0x9241('0x2c')],{'as':_0x9241('0x143'),'foreignKey':_0x9241('0x144')});db['VoiceQueue'][_0x9241('0x10d')](db[_0x9241('0x72')],{'as':_0x9241('0x145'),'foreignKey':_0x9241('0x144')});db[_0x9241('0x1a')][_0x9241('0x10d')](db[_0x9241('0x112')],{'as':_0x9241('0x113'),'foreignKey':_0x9241('0x144')});db['VoiceQueue']['hasMany'](db[_0x9241('0x76')],{'as':_0x9241('0x146'),'foreignKey':_0x9241('0x144')});db[_0x9241('0x1a')][_0x9241('0x10d')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x9241('0x1a')][_0x9241('0x10d')](db[_0x9241('0x73')],{'as':_0x9241('0x147'),'foreignKey':_0x9241('0x144')});db[_0x9241('0x1a')][_0x9241('0x10d')](db[_0x9241('0xd6')],{'as':_0x9241('0x148'),'foreignKey':'VoiceQueueId'});db[_0x9241('0x1a')][_0x9241('0x11d')](db[_0x9241('0x28')],{'as':_0x9241('0x28'),'foreignKey':_0x9241('0x149')});db[_0x9241('0x1a')][_0x9241('0x11d')](db[_0x9241('0x28')],{'as':'TrunkBackup','foreignKey':_0x9241('0x14a')});db['VoiceQueue'][_0x9241('0x11d')](db[_0x9241('0x82')],{'as':_0x9241('0x82'),'foreignKey':_0x9241('0x14b')});db[_0x9241('0x1a')]['belongsTo'](db[_0x9241('0x83')],{'as':_0x9241('0x14c'),'foreignKey':_0x9241('0x14d')});db[_0x9241('0x1a')][_0x9241('0x120')](db[_0x9241('0xf4')],{'as':_0x9241('0x123'),'through':_0x9241('0x14e')});db['VoiceQueue'][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':'UserVoiceQueue'});db[_0x9241('0x1a')][_0x9241('0x120')](db[_0x9241('0xe4')],{'as':_0x9241('0x150'),'through':'TeamVoiceQueue'});db[_0x9241('0x1a')][_0x9241('0x120')](db[_0x9241('0xf4')],{'as':_0x9241('0x151'),'through':_0x9241('0x152')});db[_0x9241('0x10e')][_0x9241('0x11d')](db['User'],{'as':'User','foreignKey':_0x9241('0x110')});db[_0x9241('0x1d')]['belongsTo'](db[_0x9241('0x14')],{'as':'User','foreignKey':_0x9241('0x110')});db[_0x9241('0x10c')][_0x9241('0x10d')](db[_0x9241('0x20')],{'as':'Messages','onDelete':_0x9241('0x13e'),'foreignKey':'mailboxuser','sourceKey':_0x9241('0x153')});db[_0x9241('0x20')][_0x9241('0x11d')](db[_0x9241('0x10c')],{'foreignKey':'mailboxuser','targetKey':_0x9241('0x153')});db[_0x9241('0x154')]['hasMany'](db[_0x9241('0x155')],{'as':_0x9241('0x156'),'foreignKey':_0x9241('0x157'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x9241('0x24')],{'as':'AgentReports','foreignKey':_0x9241('0x157'),'constraints':![]});db['VoiceCallReport'][_0x9241('0x11d')](db['User'],{'as':_0x9241('0x14'),'foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9241('0x158')});db['MailServerIn']['belongsTo'](db[_0x9241('0x3e')],{'as':_0x9241('0x3e'),'foreignKey':_0x9241('0x159')});db[_0x9241('0x3c')][_0x9241('0x11d')](db[_0x9241('0x3e')],{'as':_0x9241('0x3e'),'foreignKey':_0x9241('0x159')});db[_0x9241('0x3e')][_0x9241('0x10b')](db['MailServerIn'],{'as':_0x9241('0x15a'),'onDelete':_0x9241('0x13e')});db['MailAccount'][_0x9241('0x10b')](db[_0x9241('0x3c')],{'as':_0x9241('0x15b'),'onDelete':_0x9241('0x13e')});db[_0x9241('0x3e')][_0x9241('0x10d')](db[_0x9241('0x15c')],{'as':_0x9241('0x15d'),'foreignKey':_0x9241('0x159')});db['MailAccount']['hasMany'](db[_0x9241('0x7d')],{'as':_0x9241('0x15e'),'foreignKey':'MailAccountId'});db[_0x9241('0x3e')]['hasMany'](db[_0x9241('0x15f')],{'as':'Messages','foreignKey':_0x9241('0x159')});db[_0x9241('0x3e')][_0x9241('0x10d')](db['MailInteraction'],{'as':_0x9241('0x160')});db[_0x9241('0x3e')][_0x9241('0x10d')](db['MailApplication'],{'as':_0x9241('0x140')});db[_0x9241('0x3e')][_0x9241('0x11d')](db[_0x9241('0xf4')],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162')});db[_0x9241('0x3e')]['belongsTo'](db['Template'],{'as':_0x9241('0x93'),'foreignKey':_0x9241('0x163')});db[_0x9241('0x3e')][_0x9241('0x11d')](db[_0x9241('0x83')],{'as':_0x9241('0x14c'),'foreignKey':_0x9241('0x14d')});db[_0x9241('0x3e')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':'Agents','through':_0x9241('0x136')});db[_0x9241('0x12c')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':_0x9241('0x31')});db[_0x9241('0x12c')][_0x9241('0x120')](db[_0x9241('0xe4')],{'through':_0x9241('0x164'),'as':_0x9241('0x150')});db[_0x9241('0x119')][_0x9241('0x10d')](db[_0x9241('0x15f')],{'as':_0x9241('0x165'),'onDelete':'cascade','foreignKey':_0x9241('0x166')});db[_0x9241('0x119')]['belongsTo'](db[_0x9241('0x3e')],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x159')});db[_0x9241('0x119')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x119')]['belongsTo'](db[_0x9241('0x14')],{'as':_0x9241('0x169'),'foreignKey':_0x9241('0x110')});db['MailInteraction'][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x16a'),'as':'Tags'});db[_0x9241('0x119')][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x16a'),'as':_0x9241('0x16b')});db[_0x9241('0x119')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x16c'),'through':_0x9241('0x126'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x9241('0x10d')](db[_0x9241('0x16d')],{'as':'Attachments','onDelete':_0x9241('0x13e')});db[_0x9241('0x15f')][_0x9241('0x11d')](db[_0x9241('0x14')],{'as':_0x9241('0x14')});db[_0x9241('0x15f')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x9241('0x168')});db[_0x9241('0x15f')][_0x9241('0x11d')](db[_0x9241('0x119')],{'as':_0x9241('0x16e'),'foreignKey':_0x9241('0x166')});db[_0x9241('0x15f')][_0x9241('0x11d')](db[_0x9241('0x3e')],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x159')});db[_0x9241('0x15f')]['belongsTo'](db[_0x9241('0x63')],{'as':_0x9241('0x63'),'foreignKey':_0x9241('0x16f')});db[_0x9241('0x15f')][_0x9241('0x11d')](db[_0x9241('0x68')],{'as':_0x9241('0x68'),'foreignKey':_0x9241('0x170')});db[_0x9241('0x43')][_0x9241('0x11d')](db['User'],{'onDelete':_0x9241('0x171')});db[_0x9241('0x43')][_0x9241('0x11d')](db['MailQueue'],{'onDelete':_0x9241('0x171')});db[_0x9241('0x43')][_0x9241('0x11d')](db[_0x9241('0x3e')],{'onDelete':_0x9241('0x171')});db[_0x9241('0x43')][_0x9241('0x11d')](db[_0x9241('0x82')],{'onDelete':_0x9241('0x171'),'foreignKey':_0x9241('0x14b')});db[_0x9241('0x43')][_0x9241('0x11d')](db[_0x9241('0x89')],{'onDelete':_0x9241('0x171'),'foreignKey':_0x9241('0x172')});db[_0x9241('0x173')][_0x9241('0x11d')](db['MailAccount'],{});db[_0x9241('0x173')]['belongsTo'](db['CmList'],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162')});db[_0x9241('0x173')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158')});db['MailQueueReport'][_0x9241('0x11d')](db['MailInteraction'],{});db[_0x9241('0x173')]['belongsTo'](db['MailMessage'],{});db[_0x9241('0x173')][_0x9241('0x11d')](db[_0x9241('0x14')],{});db['MailQueueReport']['belongsTo'](db[_0x9241('0x12c')],{});db[_0x9241('0x45')][_0x9241('0x10d')](db['DashboardItem'],{'as':'Items','onDelete':_0x9241('0x13e')});db['FaxAccount'][_0x9241('0x10d')](db[_0x9241('0x15c')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x9241('0x47')][_0x9241('0x10d')](db[_0x9241('0x7d')],{'as':_0x9241('0x15e'),'foreignKey':_0x9241('0x174')});db[_0x9241('0x47')]['hasMany'](db[_0x9241('0x117')],{'as':_0x9241('0x160')});db['FaxAccount'][_0x9241('0x10d')](db[_0x9241('0x175')],{'as':'Applications'});db[_0x9241('0x47')][_0x9241('0x10d')](db[_0x9241('0x18')],{'as':_0x9241('0x176'),'onDelete':_0x9241('0x13e')});db[_0x9241('0x47')][_0x9241('0x10d')](db[_0x9241('0x4a')],{'as':_0x9241('0x165')});db[_0x9241('0x47')][_0x9241('0x11d')](db[_0x9241('0x28')],{'as':_0x9241('0x28')});db[_0x9241('0x47')][_0x9241('0x11d')](db[_0x9241('0xf4')],{'as':'List','foreignKey':_0x9241('0x162')});db[_0x9241('0x47')][_0x9241('0x11d')](db[_0x9241('0x83')],{'as':_0x9241('0x14c'),'foreignKey':_0x9241('0x14d')});db[_0x9241('0x47')]['belongsToMany'](db['User'],{'as':_0x9241('0x14f'),'through':_0x9241('0x177')});db[_0x9241('0x175')]['belongsTo'](db[_0x9241('0x14')],{'onDelete':_0x9241('0x171')});db['FaxApplication'][_0x9241('0x11d')](db[_0x9241('0x4c')],{'onDelete':_0x9241('0x171')});db[_0x9241('0x175')][_0x9241('0x11d')](db[_0x9241('0x47')],{'onDelete':_0x9241('0x171')});db[_0x9241('0x175')][_0x9241('0x11d')](db['Tag'],{'onDelete':_0x9241('0x171'),'foreignKey':'TagId'});db[_0x9241('0x117')]['hasMany'](db[_0x9241('0x4a')],{'as':_0x9241('0x165'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x178')});db[_0x9241('0x117')]['belongsTo'](db[_0x9241('0x47')],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x174')});db[_0x9241('0x117')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':'ContactId'});db[_0x9241('0x117')][_0x9241('0x11d')](db[_0x9241('0x14')],{'as':_0x9241('0x169'),'foreignKey':'UserId'});db['FaxInteraction'][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x179'),'as':'Tags'});db[_0x9241('0x117')][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x179'),'as':'ThroughTags'});db[_0x9241('0x117')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x16c'),'through':_0x9241('0x127'),'foreignKey':'FaxInteractionId'});db[_0x9241('0x4a')]['belongsTo'](db[_0x9241('0x14')],{'onDelete':_0x9241('0x13e'),'as':_0x9241('0x14')});db[_0x9241('0x4a')][_0x9241('0x11d')](db['FaxInteraction'],{'as':_0x9241('0x16e'),'foreignKey':_0x9241('0x178')});db['FaxMessage'][_0x9241('0x11d')](db[_0x9241('0x70')],{'onDelete':_0x9241('0x13e'),'as':_0x9241('0x168')});db[_0x9241('0x4a')][_0x9241('0x11d')](db[_0x9241('0x16d')],{'as':_0x9241('0x16d'),'foreignKey':_0x9241('0x17a')});db[_0x9241('0x4a')]['belongsTo'](db[_0x9241('0x47')],{'as':_0x9241('0x167'),'foreignKey':'FaxAccountId'});db[_0x9241('0x4c')]['belongsToMany'](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':_0x9241('0x33')});db[_0x9241('0x4c')][_0x9241('0x120')](db[_0x9241('0xe4')],{'through':_0x9241('0x17b'),'as':'Teams'});db[_0x9241('0x4e')][_0x9241('0x11d')](db[_0x9241('0x47')],{});db[_0x9241('0x4e')]['belongsTo'](db[_0x9241('0xf4')],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162')});db[_0x9241('0x4e')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':'ContactId'});db[_0x9241('0x4e')]['belongsTo'](db['FaxInteraction'],{});db[_0x9241('0x4e')][_0x9241('0x11d')](db['FaxMessage'],{});db['FaxQueueReport'][_0x9241('0x11d')](db['User'],{});db[_0x9241('0x4e')][_0x9241('0x11d')](db[_0x9241('0x4c')],{});db[_0x9241('0x50')][_0x9241('0x10d')](db[_0x9241('0x15c')],{'as':_0x9241('0x15d'),'foreignKey':'SmsAccountId'});db[_0x9241('0x50')][_0x9241('0x10d')](db[_0x9241('0x7d')],{'as':_0x9241('0x15e'),'foreignKey':_0x9241('0x17c')});db[_0x9241('0x50')][_0x9241('0x10d')](db[_0x9241('0x56')],{'as':'Messages','foreignKey':_0x9241('0x17c')});db[_0x9241('0x50')][_0x9241('0x10d')](db['SmsInteraction'],{'as':_0x9241('0x160')});db['SmsAccount'][_0x9241('0x10d')](db[_0x9241('0x52')],{'as':'Applications'});db['SmsAccount'][_0x9241('0x11d')](db[_0x9241('0xf4')],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162')});db['SmsAccount'][_0x9241('0x11d')](db['Pause'],{'as':_0x9241('0x14c'),'foreignKey':_0x9241('0x14d')});db[_0x9241('0x50')]['belongsToMany'](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':_0x9241('0x17d')});db['SmsApplication'][_0x9241('0x11d')](db[_0x9241('0x14')],{'onDelete':_0x9241('0x171')});db[_0x9241('0x52')][_0x9241('0x11d')](db[_0x9241('0x58')],{'onDelete':'restrict'});db[_0x9241('0x52')][_0x9241('0x11d')](db[_0x9241('0x50')],{'onDelete':_0x9241('0x171')});db['SmsApplication'][_0x9241('0x11d')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x9241('0x52')][_0x9241('0x11d')](db[_0x9241('0x89')],{'onDelete':'restrict','foreignKey':_0x9241('0x172')});db['SmsInteraction'][_0x9241('0x10d')](db[_0x9241('0x56')],{'as':_0x9241('0x165'),'onDelete':'cascade','foreignKey':_0x9241('0x17e')});db[_0x9241('0x54')][_0x9241('0x11d')](db[_0x9241('0x50')],{'as':'Account','foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x54')]['belongsTo'](db[_0x9241('0x14')],{'as':_0x9241('0x169'),'foreignKey':_0x9241('0x110')});db['SmsInteraction'][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x17f'),'as':_0x9241('0x180')});db['SmsInteraction'][_0x9241('0x120')](db['Tag'],{'through':_0x9241('0x17f'),'as':_0x9241('0x16b')});db[_0x9241('0x54')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x16c'),'through':_0x9241('0x129'),'foreignKey':_0x9241('0x17e')});db[_0x9241('0x56')][_0x9241('0x11d')](db['User'],{'as':_0x9241('0x14')});db[_0x9241('0x56')]['belongsTo'](db[_0x9241('0x70')],{'onDelete':_0x9241('0x13e'),'as':'Contact'});db[_0x9241('0x56')][_0x9241('0x11d')](db[_0x9241('0x54')],{'onDelete':_0x9241('0x13e'),'as':_0x9241('0x16e'),'foreignKey':_0x9241('0x17e')});db['SmsMessage'][_0x9241('0x11d')](db[_0x9241('0x50')],{'as':_0x9241('0x167'),'foreignKey':'SmsAccountId'});db[_0x9241('0x58')]['belongsToMany'](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':'UserSmsQueue','foreignKey':_0x9241('0x181')});db['SmsQueue'][_0x9241('0x120')](db[_0x9241('0xe4')],{'through':_0x9241('0x182'),'as':_0x9241('0x150')});db[_0x9241('0x5a')]['hasMany'](db[_0x9241('0x15c')],{'as':_0x9241('0x15d'),'foreignKey':_0x9241('0x183')});db[_0x9241('0x5a')][_0x9241('0x10d')](db[_0x9241('0x7d')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x9241('0x5a')][_0x9241('0x10d')](db[_0x9241('0x5e')],{'as':_0x9241('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0x9241('0x5a')][_0x9241('0x10d')](db[_0x9241('0x5f')],{'as':'Messages','foreignKey':_0x9241('0x183')});db['OpenchannelAccount'][_0x9241('0x10d')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0x9241('0x5a')][_0x9241('0x11d')](db[_0x9241('0xf4')],{'as':_0x9241('0x161'),'foreignKey':'ListId'});db[_0x9241('0x5a')][_0x9241('0x11d')](db[_0x9241('0x83')],{'as':_0x9241('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9241('0x5a')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x9241('0x11d')](db[_0x9241('0x14')],{'onDelete':_0x9241('0x171')});db[_0x9241('0x5c')][_0x9241('0x11d')](db[_0x9241('0x61')],{'onDelete':_0x9241('0x171'),'foreignKey':_0x9241('0x184')});db['OpenchannelApplication'][_0x9241('0x11d')](db[_0x9241('0x5a')],{'onDelete':_0x9241('0x171'),'foreignKey':_0x9241('0x183')});db['OpenchannelApplication'][_0x9241('0x11d')](db[_0x9241('0x82')],{'onDelete':_0x9241('0x171'),'foreignKey':'IntervalId'});db[_0x9241('0x5c')][_0x9241('0x11d')](db[_0x9241('0x89')],{'onDelete':_0x9241('0x171'),'foreignKey':_0x9241('0x172')});db['OpenchannelInteraction'][_0x9241('0x10d')](db[_0x9241('0x5f')],{'as':_0x9241('0x165'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x185')});db[_0x9241('0x5e')][_0x9241('0x11d')](db[_0x9241('0x5a')],{'as':'Account','foreignKey':_0x9241('0x183')});db[_0x9241('0x5e')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9241('0x158')});db[_0x9241('0x5e')][_0x9241('0x11d')](db[_0x9241('0x14')],{'as':_0x9241('0x169'),'foreignKey':'UserId'});db[_0x9241('0x5e')][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x186'),'as':_0x9241('0x180')});db[_0x9241('0x5e')][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x186'),'as':_0x9241('0x16b')});db[_0x9241('0x5e')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x16c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x9241('0x11d')](db[_0x9241('0x14')],{'onDelete':_0x9241('0x13e'),'as':_0x9241('0x14')});db[_0x9241('0x5f')][_0x9241('0x11d')](db[_0x9241('0x70')],{'onDelete':'cascade','as':_0x9241('0x168')});db[_0x9241('0x5f')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x9241('0x16e'),'foreignKey':'OpenchannelInteractionId'});db[_0x9241('0x5f')][_0x9241('0x11d')](db[_0x9241('0x16d')],{'as':_0x9241('0x16d'),'foreignKey':_0x9241('0x17a')});db[_0x9241('0x5f')][_0x9241('0x11d')](db[_0x9241('0x5a')],{'as':'Account','foreignKey':_0x9241('0x183')});db[_0x9241('0x61')][_0x9241('0x120')](db['User'],{'as':'Agents','through':_0x9241('0x37'),'foreignKey':_0x9241('0x184')});db[_0x9241('0x61')][_0x9241('0x120')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x9241('0x150')});db[_0x9241('0x63')][_0x9241('0x10d')](db[_0x9241('0x15c')],{'as':_0x9241('0x15d'),'foreignKey':_0x9241('0x16f')});db[_0x9241('0x63')][_0x9241('0x10d')](db[_0x9241('0x7d')],{'as':_0x9241('0x15e'),'foreignKey':_0x9241('0x16f')});db[_0x9241('0x63')]['hasMany'](db['ChatProactiveAction'],{'as':_0x9241('0x187')});db['ChatWebsite'][_0x9241('0x10d')](db[_0x9241('0x66')],{'as':_0x9241('0x160')});db[_0x9241('0x63')][_0x9241('0x10d')](db[_0x9241('0x188')],{'as':_0x9241('0x140')});db['ChatWebsite'][_0x9241('0x10d')](db[_0x9241('0x67')],{'as':'Messages'});db[_0x9241('0x63')]['belongsTo'](db['CmList'],{'as':_0x9241('0x161'),'foreignKey':'ListId'});db[_0x9241('0x63')]['belongsTo'](db['Interval'],{'as':_0x9241('0x82'),'foreignKey':_0x9241('0x14b')});db['ChatWebsite'][_0x9241('0x11d')](db[_0x9241('0x3e')],{'as':_0x9241('0x3e'),'foreignKey':_0x9241('0x159')});db[_0x9241('0x63')][_0x9241('0x11d')](db[_0x9241('0x83')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x9241('0x120')](db[_0x9241('0x14')],{'as':'Agents','through':_0x9241('0x189')});db[_0x9241('0x65')][_0x9241('0x11d')](db[_0x9241('0x5a')],{});db[_0x9241('0x65')]['belongsTo'](db['CmList'],{'as':_0x9241('0x161'),'foreignKey':'ListId'});db[_0x9241('0x65')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':'Contact','foreignKey':_0x9241('0x158')});db[_0x9241('0x65')][_0x9241('0x11d')](db[_0x9241('0x5e')],{});db['OpenchannelQueueReport'][_0x9241('0x11d')](db['OpenchannelMessage'],{});db[_0x9241('0x65')][_0x9241('0x11d')](db[_0x9241('0x14')],{});db['OpenchannelQueueReport'][_0x9241('0x11d')](db['OpenchannelQueue'],{});db[_0x9241('0x188')][_0x9241('0x11d')](db[_0x9241('0x14')],{'as':_0x9241('0x18a'),'foreignKey':_0x9241('0x110'),'onDelete':_0x9241('0x171')});db[_0x9241('0x188')][_0x9241('0x11d')](db['ChatQueue'],{'as':_0x9241('0x18b'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x9241('0x188')]['belongsTo'](db['ChatWebsite'],{'as':_0x9241('0x18c'),'foreignKey':_0x9241('0x16f'),'onDelete':'restrict'});db[_0x9241('0x188')][_0x9241('0x11d')](db['Tag'],{'onDelete':_0x9241('0x171'),'foreignKey':_0x9241('0x172')});db[_0x9241('0x66')][_0x9241('0x10d')](db[_0x9241('0x67')],{'as':'Messages','onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x18d')});db[_0x9241('0x66')][_0x9241('0x11d')](db[_0x9241('0x63')],{'as':'Account','foreignKey':_0x9241('0x16f')});db[_0x9241('0x66')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0x9241('0x14')],{'as':_0x9241('0x169'),'foreignKey':_0x9241('0x110')});db[_0x9241('0x66')][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x18e'),'as':_0x9241('0x180')});db[_0x9241('0x66')][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x18e'),'as':_0x9241('0x16b')});db['ChatInteraction'][_0x9241('0x120')](db[_0x9241('0x14')],{'as':'Users','through':_0x9241('0x18f'),'foreignKey':'ChatInteractionId'});db[_0x9241('0x67')][_0x9241('0x11d')](db[_0x9241('0x14')],{'onDelete':_0x9241('0x13e'),'as':_0x9241('0x14')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x9241('0x13e'),'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x67')][_0x9241('0x11d')](db[_0x9241('0x66')],{'onDelete':_0x9241('0x13e'),'as':'Interaction','foreignKey':_0x9241('0x18d')});db[_0x9241('0x67')][_0x9241('0x11d')](db['Attachment'],{'as':_0x9241('0x16d'),'foreignKey':_0x9241('0x17a')});db['ChatMessage'][_0x9241('0x11d')](db[_0x9241('0x63')],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x16f')});db['ChatOfflineMessage']['hasMany'](db[_0x9241('0x16d')],{'as':_0x9241('0x190'),'foreignKey':_0x9241('0x170'),'onDelete':_0x9241('0x13e'),'hooks':!![]});db['ChatOfflineMessage'][_0x9241('0x11d')](db[_0x9241('0x70')],{'onDelete':_0x9241('0x13e'),'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158')});db['ChatOfflineMessage'][_0x9241('0x11d')](db[_0x9241('0x63')],{'as':_0x9241('0x167'),'foreignKey':'ChatWebsiteId'});db[_0x9241('0x6a')]['belongsToMany'](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':_0x9241('0x191'),'hooks':!![]});db['ChatQueue'][_0x9241('0x120')](db[_0x9241('0xe4')],{'through':'team_has_chat_queues','as':_0x9241('0x150')});db[_0x9241('0x6c')][_0x9241('0x10d')](db[_0x9241('0x192')],{'as':'Messages','foreignKey':_0x9241('0x193'),'onDelete':_0x9241('0x13e')});db[_0x9241('0x6c')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x143'),'through':_0x9241('0x11f')});db['ChatProactiveAction']['belongsTo'](db[_0x9241('0x63')],{'as':'Website','foreignKey':_0x9241('0x16f')});db['CmCompany'][_0x9241('0x10d')](db[_0x9241('0x70')],{'as':_0x9241('0x121'),'foreignKey':_0x9241('0x194')});db[_0x9241('0x70')]['hasMany'](db[_0x9241('0x8d')],{'as':'Phones2','foreignKey':_0x9241('0x195')});db[_0x9241('0x70')][_0x9241('0x10d')](db[_0x9241('0x8f')],{'as':'Phones','foreignKey':_0x9241('0x195')});db[_0x9241('0x70')][_0x9241('0x10d')](db[_0x9241('0x72')],{'as':_0x9241('0x145'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x70')][_0x9241('0x10d')](db[_0x9241('0x112')],{'as':_0x9241('0x113'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x70')][_0x9241('0x10d')](db[_0x9241('0x76')],{'as':_0x9241('0x146'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x70')][_0x9241('0x10d')](db['ReportAgentPreview'],{'as':_0x9241('0x115'),'foreignKey':'ContactId'});db['CmContact'][_0x9241('0x10d')](db['JscriptySessionReport'],{'as':_0x9241('0x148'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x70')][_0x9241('0x10d')](db['OpenchannelInteraction'],{'as':_0x9241('0x12a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x9241('0x70')]['hasMany'](db[_0x9241('0x66')],{'as':_0x9241('0x116'),'foreignKey':_0x9241('0x158'),'onDelete':_0x9241('0x171')});db['CmContact'][_0x9241('0x10d')](db[_0x9241('0x54')],{'as':_0x9241('0x128'),'foreignKey':_0x9241('0x158'),'onDelete':'restrict'});db[_0x9241('0x70')][_0x9241('0x10d')](db[_0x9241('0x117')],{'as':_0x9241('0x118'),'foreignKey':_0x9241('0x158'),'onDelete':'restrict'});db[_0x9241('0x70')][_0x9241('0x10d')](db[_0x9241('0x119')],{'as':_0x9241('0x11a'),'foreignKey':_0x9241('0x158'),'onDelete':_0x9241('0x171')});db[_0x9241('0x70')][_0x9241('0x11d')](db[_0x9241('0x6e')],{'as':_0x9241('0x196'),'foreignKey':_0x9241('0x194')});db[_0x9241('0x70')][_0x9241('0x11d')](db[_0x9241('0xf4')],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162'),'onDelete':_0x9241('0x13e')});db[_0x9241('0x70')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x16c'),'through':_0x9241('0x122')});db['CmContact'][_0x9241('0x120')](db[_0x9241('0x89')],{'as':_0x9241('0x180'),'through':_0x9241('0x197')});db[_0x9241('0x70')][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x197'),'as':_0x9241('0x16b')});db[_0x9241('0x72')][_0x9241('0x10d')](db[_0x9241('0x91')],{'as':'AdditionalPhones','foreignKey':_0x9241('0x198')});db['CmHopper'][_0x9241('0x11d')](db['CmContact'],{'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162'),'onDelete':'cascade'});db[_0x9241('0x72')]['belongsTo'](db[_0x9241('0x14')],{'as':_0x9241('0x18a'),'foreignKey':_0x9241('0x110')});db[_0x9241('0x72')]['belongsTo'](db[_0x9241('0x1a')],{'as':_0x9241('0x18b'),'foreignKey':_0x9241('0x144'),'onDelete':'cascade'});db[_0x9241('0x72')]['belongsTo'](db['Campaign'],{'as':_0x9241('0xe7'),'foreignKey':'CampaignId','onDelete':_0x9241('0x13e')});db[_0x9241('0x72')][_0x9241('0x11d')](db[_0x9241('0x14')],{'as':'Owner','foreignKey':'OwnerId'});db[_0x9241('0x73')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158'),'onDelete':'cascade'});db[_0x9241('0x73')][_0x9241('0x11d')](db[_0x9241('0xf4')],{'as':_0x9241('0x161'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x9241('0x73')][_0x9241('0x11d')](db[_0x9241('0x1a')],{'as':_0x9241('0x18b'),'foreignKey':_0x9241('0x144'),'onDelete':_0x9241('0x13e')});db['CmHopperBlack'][_0x9241('0x11d')](db[_0x9241('0xe7')],{'as':_0x9241('0xe7'),'foreignKey':_0x9241('0x199'),'onDelete':'cascade'});db['Automation'][_0x9241('0x10d')](db[_0x9241('0x80')],{'as':{'plural':_0x9241('0x19a'),'singular':_0x9241('0x19b')},'foreignKey':_0x9241('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x9241('0x7b')]['hasMany'](db[_0x9241('0x80')],{'as':{'plural':_0x9241('0x19d'),'singular':_0x9241('0x19e')},'foreignKey':_0x9241('0x19f'),'onDelete':_0x9241('0x13e'),'hooks':!![]});db[_0x9241('0x7b')]['hasMany'](db[_0x9241('0x7a')],{'as':_0x9241('0x1a0'),'foreignKey':_0x9241('0x1a1'),'onDelete':_0x9241('0x13e'),'hooks':!![]});db['Disposition'][_0x9241('0x10d')](db[_0x9241('0x15c')],{'as':_0x9241('0x15d'),'foreignKey':_0x9241('0x1a2'),'onDelete':_0x9241('0x13e')});db[_0x9241('0x82')][_0x9241('0x10d')](db[_0x9241('0x82')],{'as':'Intervals','foreignKey':_0x9241('0x14b'),'onDelete':_0x9241('0x13e'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0x9241('0x111'),'foreignKey':_0x9241('0x14b'),'onDelete':_0x9241('0x171')});db[_0x9241('0x82')][_0x9241('0x10d')](db[_0x9241('0x43')],{'as':_0x9241('0x1a3'),'foreignKey':_0x9241('0x14b')});db[_0x9241('0x82')][_0x9241('0x10d')](db[_0x9241('0x188')],{'as':_0x9241('0x1a4'),'foreignKey':_0x9241('0x14b')});db[_0x9241('0x82')][_0x9241('0x10d')](db['FaxApplication'],{'as':_0x9241('0x1a5'),'foreignKey':_0x9241('0x14b')});db[_0x9241('0x82')][_0x9241('0x10d')](db[_0x9241('0x52')],{'as':_0x9241('0x1a6'),'foreignKey':'IntervalId'});db['Schedule'][_0x9241('0x11d')](db['MailAccount'],{});db['Schedule'][_0x9241('0x11d')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x9241('0x87')][_0x9241('0x11d')](db[_0x9241('0x9b')],{'foreignKey':_0x9241('0x1a7')});db['Sound'][_0x9241('0x120')](db['VoiceMusicOnHold'],{'as':_0x9241('0x1a8'),'through':_0x9241('0x142'),'onDelete':_0x9241('0x171')});db['Tag'][_0x9241('0x120')](db[_0x9241('0x70')],{'through':'cm_contact_has_tags'});db[_0x9241('0x89')]['belongsToMany'](db[_0x9241('0x66')],{'through':_0x9241('0x18e')});db[_0x9241('0x89')][_0x9241('0x120')](db[_0x9241('0x119')],{'through':_0x9241('0x16a')});db['Tag']['belongsToMany'](db[_0x9241('0x54')],{'through':_0x9241('0x17f')});db['Tag'][_0x9241('0x120')](db[_0x9241('0x117')],{'through':'fax_interaction_has_tags'});db[_0x9241('0x89')]['belongsToMany'](db[_0x9241('0x5e')],{'through':'openchannel_interaction_has_tags'});db[_0x9241('0x89')][_0x9241('0x120')](db[_0x9241('0x100')],{'through':_0x9241('0x1a9')});db['CmContactHasItem'][_0x9241('0x11d')](db['ContactItemType'],{'as':'ItemType','foreignKey':_0x9241('0x1aa')});db[_0x9241('0x91')][_0x9241('0x11d')](db[_0x9241('0x72')],{'as':'Hopper','foreignKey':_0x9241('0x198')});db['Trigger'][_0x9241('0x10d')](db[_0x9241('0x80')],{'as':{'plural':'AllConditions','singular':_0x9241('0x1ab')},'foreignKey':_0x9241('0x1ac'),'onDelete':_0x9241('0x13e'),'hooks':!![]});db[_0x9241('0x94')]['hasMany'](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x9241('0x1ad')},'foreignKey':'TriggerAnyId','onDelete':_0x9241('0x13e'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x9241('0x7a')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x9241('0x13e'),'hooks':!![]});db[_0x9241('0x9b')][_0x9241('0x10d')](db[_0x9241('0xa1')],{'as':_0x9241('0x1ae'),'onDelete':'cascade','foreignKey':_0x9241('0x1a7'),'hooks':!![]});db[_0x9241('0x9d')][_0x9241('0x10d')](db[_0x9241('0xa1')],{'as':'Fields','onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1af')});db[_0x9241('0xa0')][_0x9241('0x10d')](db[_0x9241('0xa1')],{'as':_0x9241('0x1ae'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b0')});db[_0x9241('0xa1')][_0x9241('0x11d')](db['AnalyticMetric'],{'foreignKey':_0x9241('0x1b0')});db['SalesforceAccount'][_0x9241('0x10d')](db[_0x9241('0xa5')],{'as':_0x9241('0x1b1'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b2')});db[_0x9241('0xa5')][_0x9241('0x10d')](db[_0x9241('0x1b3')],{'as':_0x9241('0x1b4'),'onDelete':'cascade','foreignKey':_0x9241('0x1b5')});db['SalesforceConfiguration'][_0x9241('0x10d')](db[_0x9241('0x1b3')],{'as':_0x9241('0x1b6'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b7')});db['SalesforceConfiguration'][_0x9241('0x10d')](db['SalesforceField'],{'as':'Fields','onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b8')});db[_0x9241('0xa5')]['belongsTo'](db[_0x9241('0xa3')],{'as':'Account','foreignKey':_0x9241('0x1b2')});db['SalesforceField'][_0x9241('0x10d')](db[_0x9241('0x1b3')],{'as':_0x9241('0x1b9'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0x1b3')][_0x9241('0x10d')](db[_0x9241('0x1b3')],{'as':_0x9241('0x1ba'),'foreignKey':_0x9241('0x1b7')});db['SalesforceField'][_0x9241('0x10d')](db['SalesforceField'],{'as':_0x9241('0x1bb'),'foreignKey':'FieldId'});db[_0x9241('0x1b3')]['belongsTo'](db[_0x9241('0x1bc')],{'as':_0x9241('0x1bc'),'foreignKey':_0x9241('0x1bd')});db[_0x9241('0xa7')][_0x9241('0x10d')](db[_0x9241('0x1be')],{'as':'Configurations','onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b2')});db[_0x9241('0x1be')][_0x9241('0x10d')](db[_0x9241('0x1bf')],{'as':_0x9241('0x1b4'),'onDelete':'cascade','foreignKey':_0x9241('0x1b5')});db[_0x9241('0x1be')][_0x9241('0x10d')](db['SugarcrmField'],{'as':_0x9241('0x1b6'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b7')});db[_0x9241('0x1be')][_0x9241('0x10d')](db[_0x9241('0x1bf')],{'as':_0x9241('0x1ae'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b8')});db[_0x9241('0x1be')]['belongsTo'](db[_0x9241('0xa7')],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x1b2')});db[_0x9241('0x1bf')][_0x9241('0x10d')](db[_0x9241('0x1bf')],{'as':_0x9241('0x1b9'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0x1bf')]['hasMany'](db[_0x9241('0x1bf')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x9241('0x10d')](db['SugarcrmField'],{'as':_0x9241('0x1bb'),'foreignKey':_0x9241('0x1b8')});db['SugarcrmField']['belongsTo'](db[_0x9241('0x1bc')],{'as':_0x9241('0x1bc'),'foreignKey':'VariableId'});db[_0x9241('0xab')]['hasMany'](db[_0x9241('0xac')],{'as':'Configurations','onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b2')});db['DeskConfiguration'][_0x9241('0x10d')](db[_0x9241('0xae')],{'as':_0x9241('0x1b4'),'onDelete':'cascade','foreignKey':_0x9241('0x1b5')});db[_0x9241('0xac')]['hasMany'](db[_0x9241('0xae')],{'as':_0x9241('0x1b6'),'onDelete':_0x9241('0x13e'),'foreignKey':'DescriptionId'});db[_0x9241('0xac')]['hasMany'](db['DeskField'],{'as':_0x9241('0x1ae'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b8')});db[_0x9241('0xac')][_0x9241('0x11d')](db[_0x9241('0xab')],{'as':'Account','foreignKey':'AccountId'});db[_0x9241('0xac')][_0x9241('0x120')](db['Tag'],{'through':_0x9241('0x1c0')});db['DeskField']['hasMany'](db[_0x9241('0xae')],{'as':_0x9241('0x1b9'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0xae')][_0x9241('0x10d')](db['DeskField'],{'as':_0x9241('0x1ba'),'foreignKey':_0x9241('0x1b7')});db[_0x9241('0xae')][_0x9241('0x10d')](db[_0x9241('0xae')],{'as':'Field','foreignKey':_0x9241('0x1b8')});db[_0x9241('0xae')]['belongsTo'](db[_0x9241('0x1bc')],{'as':_0x9241('0x1bc'),'foreignKey':_0x9241('0x1bd')});db[_0x9241('0xb0')]['hasMany'](db[_0x9241('0x1c1')],{'as':_0x9241('0x1b1'),'onDelete':'cascade','foreignKey':_0x9241('0x1b2')});db['ZohoConfiguration']['hasMany'](db[_0x9241('0xb3')],{'as':_0x9241('0x1b4'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b5')});db['ZohoConfiguration'][_0x9241('0x10d')](db[_0x9241('0xb3')],{'as':_0x9241('0x1b6'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b7')});db['ZohoConfiguration']['hasMany'](db[_0x9241('0xb3')],{'as':_0x9241('0x1ae'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b8')});db['ZohoConfiguration']['belongsTo'](db['ZohoAccount'],{'as':_0x9241('0x167'),'foreignKey':'AccountId'});db[_0x9241('0xb3')][_0x9241('0x10d')](db[_0x9241('0xb3')],{'as':_0x9241('0x1b9'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0xb3')][_0x9241('0x10d')](db[_0x9241('0xb3')],{'as':'Description','foreignKey':_0x9241('0x1b7')});db['ZohoField']['hasMany'](db[_0x9241('0xb3')],{'as':_0x9241('0x1bb'),'foreignKey':_0x9241('0x1b8')});db['ZohoField']['belongsTo'](db[_0x9241('0x1bc')],{'as':_0x9241('0x1bc'),'foreignKey':_0x9241('0x1bd')});db[_0x9241('0xb4')][_0x9241('0x10d')](db[_0x9241('0xb6')],{'as':_0x9241('0x1b1'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b2')});db[_0x9241('0xb6')][_0x9241('0x10d')](db['ZendeskField'],{'as':_0x9241('0x1b4'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0xb6')][_0x9241('0x10d')](db[_0x9241('0xb8')],{'as':_0x9241('0x1b6'),'foreignKey':_0x9241('0x1b7')});db[_0x9241('0xb6')][_0x9241('0x10d')](db[_0x9241('0xb8')],{'as':'Fields','foreignKey':_0x9241('0x1b8')});db[_0x9241('0xb6')][_0x9241('0x11d')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x9241('0x1b2')});db['ZendeskConfiguration'][_0x9241('0x120')](db[_0x9241('0x89')],{'through':_0x9241('0x1c2')});db['ZendeskField'][_0x9241('0x10d')](db[_0x9241('0xb8')],{'as':_0x9241('0x1b9'),'foreignKey':_0x9241('0x1b5')});db['ZendeskField'][_0x9241('0x10d')](db[_0x9241('0xb8')],{'as':_0x9241('0x1ba'),'foreignKey':_0x9241('0x1b7')});db['ZendeskField']['hasMany'](db[_0x9241('0xb8')],{'as':'Field','foreignKey':_0x9241('0x1b8')});db[_0x9241('0xb8')][_0x9241('0x11d')](db['Variable'],{'as':'Variable','foreignKey':_0x9241('0x1bd')});db[_0x9241('0xba')][_0x9241('0x10d')](db['FreshdeskConfiguration'],{'as':_0x9241('0x1b1'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x9241('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0x9241('0x1b4'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0xbb')][_0x9241('0x10d')](db[_0x9241('0xbc')],{'as':_0x9241('0x1b6'),'onDelete':_0x9241('0x13e'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x9241('0x10d')](db['FreshdeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9241('0x1b8')});db['FreshdeskConfiguration'][_0x9241('0x11d')](db['FreshdeskAccount'],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x1b2')});db['FreshdeskConfiguration'][_0x9241('0x120')](db['Tag'],{'through':_0x9241('0x1c3')});db[_0x9241('0xbc')][_0x9241('0x10d')](db[_0x9241('0xbc')],{'as':_0x9241('0x1b9'),'foreignKey':_0x9241('0x1b5')});db['FreshdeskField'][_0x9241('0x10d')](db[_0x9241('0xbc')],{'as':_0x9241('0x1ba'),'foreignKey':_0x9241('0x1b7')});db[_0x9241('0xbc')]['hasMany'](db[_0x9241('0xbc')],{'as':_0x9241('0x1bb'),'foreignKey':_0x9241('0x1b8')});db[_0x9241('0xbc')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x9241('0x1bd')});db['VtigerAccount'][_0x9241('0x10d')](db[_0x9241('0xbe')],{'as':_0x9241('0x1b1'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b2')});db[_0x9241('0xbe')][_0x9241('0x10d')](db[_0x9241('0xbf')],{'as':_0x9241('0x1b4'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0xbe')]['hasMany'](db[_0x9241('0xbf')],{'as':_0x9241('0x1b6'),'foreignKey':_0x9241('0x1b7')});db[_0x9241('0xbe')][_0x9241('0x10d')](db['VtigerField'],{'as':_0x9241('0x1ae'),'foreignKey':_0x9241('0x1b8')});db[_0x9241('0xbe')][_0x9241('0x11d')](db[_0x9241('0x1c4')],{'as':'Account','foreignKey':_0x9241('0x1b2')});db[_0x9241('0xbf')][_0x9241('0x10d')](db[_0x9241('0xbf')],{'as':_0x9241('0x1b9'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0xbf')][_0x9241('0x10d')](db['VtigerField'],{'as':_0x9241('0x1ba'),'foreignKey':_0x9241('0x1b7')});db['VtigerField'][_0x9241('0x10d')](db[_0x9241('0xbf')],{'as':_0x9241('0x1bb'),'foreignKey':_0x9241('0x1b8')});db[_0x9241('0xbf')]['belongsTo'](db[_0x9241('0x1bc')],{'as':_0x9241('0x1bc'),'foreignKey':_0x9241('0x1bd')});db[_0x9241('0xc1')][_0x9241('0x10d')](db[_0x9241('0xc3')],{'as':_0x9241('0x1b1'),'onDelete':_0x9241('0x13e'),'foreignKey':'AccountId'});db[_0x9241('0xc3')]['hasMany'](db[_0x9241('0xc4')],{'as':_0x9241('0x1b4'),'foreignKey':_0x9241('0x1b5')});db['ServicenowConfiguration'][_0x9241('0x10d')](db[_0x9241('0xc4')],{'as':_0x9241('0x1b6'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db[_0x9241('0xc4')],{'as':_0x9241('0x1ae'),'foreignKey':'FieldId'});db[_0x9241('0xc3')][_0x9241('0x11d')](db[_0x9241('0xc1')],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x1b2')});db[_0x9241('0xc4')][_0x9241('0x10d')](db['ServicenowField'],{'as':'Subject','foreignKey':_0x9241('0x1b5')});db[_0x9241('0xc4')][_0x9241('0x10d')](db[_0x9241('0xc4')],{'as':_0x9241('0x1ba'),'foreignKey':_0x9241('0x1b7')});db[_0x9241('0xc4')][_0x9241('0x10d')](db[_0x9241('0xc4')],{'as':_0x9241('0x1bb'),'foreignKey':_0x9241('0x1b8')});db[_0x9241('0xc4')][_0x9241('0x11d')](db['Variable'],{'as':_0x9241('0x1bc'),'foreignKey':_0x9241('0x1bd')});db[_0x9241('0xc6')][_0x9241('0x10d')](db[_0x9241('0xc8')],{'as':'Configurations','onDelete':_0x9241('0x13e'),'foreignKey':'AccountId'});db[_0x9241('0xc8')][_0x9241('0x10d')](db[_0x9241('0xca')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x9241('0x1b5')});db[_0x9241('0xc8')][_0x9241('0x10d')](db[_0x9241('0xca')],{'as':_0x9241('0x1b6'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b7')});db[_0x9241('0xc8')][_0x9241('0x10d')](db[_0x9241('0xca')],{'as':_0x9241('0x1ae'),'onDelete':'cascade','foreignKey':_0x9241('0x1b8')});db[_0x9241('0xc8')][_0x9241('0x11d')](db[_0x9241('0xc6')],{'as':'Account','foreignKey':_0x9241('0x1b2')});db[_0x9241('0xca')][_0x9241('0x10d')](db[_0x9241('0xca')],{'as':_0x9241('0x1b9'),'foreignKey':'SubjectId'});db[_0x9241('0xca')][_0x9241('0x10d')](db[_0x9241('0xca')],{'as':'Description','foreignKey':_0x9241('0x1b7')});db[_0x9241('0xca')][_0x9241('0x10d')](db[_0x9241('0xca')],{'as':_0x9241('0x1bb'),'foreignKey':_0x9241('0x1b8')});db['Dynamics365Field'][_0x9241('0x11d')](db[_0x9241('0x1bc')],{'as':_0x9241('0x1bc'),'foreignKey':_0x9241('0x1bd')});db[_0x9241('0xcc')][_0x9241('0x10d')](db[_0x9241('0xce')],{'as':_0x9241('0x1b1'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1b2')});db[_0x9241('0xce')]['hasMany'](db['FreshsalesField'],{'as':_0x9241('0x1b4'),'foreignKey':_0x9241('0x1b5')});db[_0x9241('0xce')][_0x9241('0x10d')](db[_0x9241('0xd0')],{'as':'Descriptions','foreignKey':_0x9241('0x1b7')});db['FreshsalesConfiguration'][_0x9241('0x10d')](db[_0x9241('0xd0')],{'as':_0x9241('0x1ae'),'foreignKey':'FieldId'});db[_0x9241('0xce')][_0x9241('0x11d')](db[_0x9241('0xcc')],{'as':_0x9241('0x167'),'foreignKey':'AccountId'});db[_0x9241('0xd0')]['hasMany'](db[_0x9241('0xd0')],{'as':'Subject','foreignKey':_0x9241('0x1b5')});db[_0x9241('0xd0')]['hasMany'](db[_0x9241('0xd0')],{'as':_0x9241('0x1ba'),'foreignKey':_0x9241('0x1b7')});db['FreshsalesField'][_0x9241('0x10d')](db[_0x9241('0xd0')],{'as':_0x9241('0x1bb'),'foreignKey':_0x9241('0x1b8')});db[_0x9241('0xd0')][_0x9241('0x11d')](db[_0x9241('0x1bc')],{'as':'Variable','foreignKey':_0x9241('0x1bd')});db[_0x9241('0x1c5')][_0x9241('0x11d')](db[_0x9241('0x63')],{});db[_0x9241('0x1c5')][_0x9241('0x11d')](db['CmList'],{'as':'List','foreignKey':_0x9241('0x162')});db[_0x9241('0x1c5')]['belongsTo'](db['CmContact'],{'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x1c5')][_0x9241('0x11d')](db['ChatInteraction'],{});db[_0x9241('0x1c5')][_0x9241('0x11d')](db[_0x9241('0x67')],{});db[_0x9241('0x1c5')]['belongsTo'](db['User'],{});db[_0x9241('0x1c5')][_0x9241('0x11d')](db[_0x9241('0x6a')],{});db['ChatInternalMessage'][_0x9241('0x11d')](db[_0x9241('0x14')],{'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1c6')});db[_0x9241('0x192')][_0x9241('0x11d')](db[_0x9241('0x14')],{'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1c7')});db[_0x9241('0xd6')][_0x9241('0x10d')](db[_0x9241('0xd4')],{'foreignKey':_0x9241('0x1c8'),'onDelete':'cascade'});db[_0x9241('0xd6')]['hasMany'](db[_0x9241('0xd3')],{'foreignKey':_0x9241('0x1c8'),'onDelete':_0x9241('0x13e')});db[_0x9241('0x1c9')][_0x9241('0x11d')](db[_0x9241('0x50')],{});db[_0x9241('0x1c9')][_0x9241('0x11d')](db[_0x9241('0xf4')],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162')});db[_0x9241('0x1c9')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x1c9')]['belongsTo'](db['SmsInteraction'],{});db[_0x9241('0x1c9')][_0x9241('0x11d')](db[_0x9241('0x56')],{});db['SmsQueueReport'][_0x9241('0x11d')](db[_0x9241('0x14')],{});db['SmsQueueReport'][_0x9241('0x11d')](db[_0x9241('0x58')],{});db[_0x9241('0x1ca')][_0x9241('0x10d')](db[_0x9241('0xd6')],{'foreignKey':_0x9241('0x1cb')});db[_0x9241('0x1ca')][_0x9241('0x10d')](db[_0x9241('0xd4')],{'foreignKey':_0x9241('0x1cb')});db[_0x9241('0x1ca')][_0x9241('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':_0x9241('0x1cb')});db[_0x9241('0xe0')][_0x9241('0x120')](db['User'],{'as':_0x9241('0x16c'),'through':_0x9241('0x13b')});db[_0x9241('0xe4')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':_0x9241('0x125')});db[_0x9241('0xe4')][_0x9241('0x120')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0x9241('0x12b')});db[_0x9241('0xe4')][_0x9241('0x120')](db[_0x9241('0x12c')],{'through':_0x9241('0x164'),'as':_0x9241('0x12d')});db[_0x9241('0xe4')][_0x9241('0x120')](db[_0x9241('0x6a')],{'through':_0x9241('0x1cc'),'as':_0x9241('0x1cd')});db['Team'][_0x9241('0x120')](db[_0x9241('0x4c')],{'through':_0x9241('0x17b'),'as':_0x9241('0x12e')});db[_0x9241('0xe4')][_0x9241('0x120')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0x9241('0x12f')});db[_0x9241('0xe4')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0x9241('0x1ce'),'as':_0x9241('0x130')});db['Team'][_0x9241('0x120')](db[_0x9241('0x131')],{'through':_0x9241('0x1cf'),'as':'WhatsappQueues'});db[_0x9241('0xe7')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x9241('0x199')});db[_0x9241('0xe7')][_0x9241('0x10d')](db[_0x9241('0x112')],{'as':_0x9241('0x113'),'foreignKey':'CampaignId'});db['Campaign']['hasMany'](db[_0x9241('0x76')],{'as':_0x9241('0x146'),'foreignKey':_0x9241('0x199')});db['Campaign']['hasMany'](db[_0x9241('0x73')],{'as':_0x9241('0x147'),'foreignKey':_0x9241('0x199')});db[_0x9241('0xe7')][_0x9241('0x11d')](db[_0x9241('0x28')],{'as':_0x9241('0x28'),'foreignKey':_0x9241('0x149')});db[_0x9241('0xe7')][_0x9241('0x11d')](db['Trunk'],{'as':_0x9241('0x1d0'),'foreignKey':_0x9241('0x14a')});db[_0x9241('0xe7')][_0x9241('0x11d')](db['Interval'],{'as':_0x9241('0x82'),'foreignKey':_0x9241('0x14b')});db['Campaign']['belongsTo'](db[_0x9241('0xe0')],{'as':_0x9241('0xe0'),'foreignKey':_0x9241('0x1d1')});db[_0x9241('0xe7')][_0x9241('0x120')](db['CmList'],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x9241('0xe7')][_0x9241('0x120')](db['CmList'],{'as':_0x9241('0x151'),'through':_0x9241('0x1d2')});db[_0x9241('0x16d')]['belongsTo'](db[_0x9241('0x68')],{'as':_0x9241('0x68'),'foreignKey':_0x9241('0x170')});db[_0x9241('0xed')]['belongsTo'](db['MailMessage'],{});db[_0x9241('0xed')][_0x9241('0x11d')](db['MailInteraction'],{});db[_0x9241('0xed')][_0x9241('0x11d')](db[_0x9241('0x3e')],{'foreignKey':'FromMailAccountId','as':_0x9241('0x1d3')});db[_0x9241('0xed')][_0x9241('0x11d')](db[_0x9241('0x14')],{'foreignKey':_0x9241('0x1d4'),'as':_0x9241('0x1d5')});db[_0x9241('0xed')]['belongsTo'](db[_0x9241('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x9241('0xed')][_0x9241('0x11d')](db['MailQueue'],{'foreignKey':_0x9241('0x1d6'),'as':_0x9241('0x1d7')});db[_0x9241('0xed')][_0x9241('0x11d')](db['MailAccount'],{'foreignKey':_0x9241('0x1d8'),'as':_0x9241('0x1d9')});db[_0x9241('0xef')]['belongsTo'](db[_0x9241('0x67')],{});db[_0x9241('0xef')]['belongsTo'](db[_0x9241('0x66')],{});db[_0x9241('0xef')][_0x9241('0x11d')](db[_0x9241('0x63')],{'foreignKey':_0x9241('0x1da'),'as':_0x9241('0x1d3')});db[_0x9241('0xef')][_0x9241('0x11d')](db[_0x9241('0x14')],{'foreignKey':_0x9241('0x1d4'),'as':_0x9241('0x1d5')});db[_0x9241('0xef')][_0x9241('0x11d')](db[_0x9241('0x14')],{'foreignKey':_0x9241('0x1db'),'as':_0x9241('0x1dc')});db[_0x9241('0xef')]['belongsTo'](db[_0x9241('0x6a')],{'foreignKey':'ToChatQueueId','as':_0x9241('0x1d7')});db[_0x9241('0xef')][_0x9241('0x11d')](db[_0x9241('0x63')],{'foreignKey':_0x9241('0x1dd'),'as':_0x9241('0x1d9')});db[_0x9241('0xf1')][_0x9241('0x11d')](db[_0x9241('0x4a')],{});db[_0x9241('0xf1')][_0x9241('0x11d')](db[_0x9241('0x117')],{});db[_0x9241('0xf1')][_0x9241('0x11d')](db[_0x9241('0x47')],{'foreignKey':_0x9241('0x1de'),'as':_0x9241('0x1d3')});db[_0x9241('0xf1')][_0x9241('0x11d')](db['User'],{'foreignKey':_0x9241('0x1d4'),'as':_0x9241('0x1d5')});db[_0x9241('0xf1')][_0x9241('0x11d')](db[_0x9241('0x14')],{'foreignKey':_0x9241('0x1db'),'as':'ToAgent'});db[_0x9241('0xf1')][_0x9241('0x11d')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x9241('0x1d7')});db[_0x9241('0xf1')][_0x9241('0x11d')](db[_0x9241('0x47')],{'foreignKey':_0x9241('0x1df'),'as':_0x9241('0x1d9')});db['OpenchannelTransferReport'][_0x9241('0x11d')](db[_0x9241('0x5f')],{});db[_0x9241('0x1e0')][_0x9241('0x11d')](db[_0x9241('0x5e')],{});db[_0x9241('0x1e0')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x9241('0x1e1'),'as':_0x9241('0x1d3')});db[_0x9241('0x1e0')][_0x9241('0x11d')](db[_0x9241('0x14')],{'foreignKey':_0x9241('0x1d4'),'as':'FromAgent'});db[_0x9241('0x1e0')]['belongsTo'](db['User'],{'foreignKey':_0x9241('0x1db'),'as':_0x9241('0x1dc')});db[_0x9241('0x1e0')][_0x9241('0x11d')](db[_0x9241('0x61')],{'foreignKey':_0x9241('0x1e2'),'as':'ToQueue'});db[_0x9241('0x1e0')][_0x9241('0x11d')](db['OpenchannelAccount'],{'foreignKey':_0x9241('0x1e3'),'as':_0x9241('0x1d9')});db[_0x9241('0x1e4')][_0x9241('0x11d')](db[_0x9241('0x56')],{});db[_0x9241('0x1e4')][_0x9241('0x11d')](db[_0x9241('0x54')],{});db[_0x9241('0x1e4')][_0x9241('0x11d')](db['SmsAccount'],{'foreignKey':_0x9241('0x1e5'),'as':_0x9241('0x1d3')});db[_0x9241('0x1e4')][_0x9241('0x11d')](db['User'],{'foreignKey':_0x9241('0x1d4'),'as':_0x9241('0x1d5')});db[_0x9241('0x1e4')][_0x9241('0x11d')](db['User'],{'foreignKey':_0x9241('0x1db'),'as':_0x9241('0x1dc')});db[_0x9241('0x1e4')][_0x9241('0x11d')](db['SmsQueue'],{'foreignKey':_0x9241('0x1e6'),'as':_0x9241('0x1d7')});db['SmsTransferReport'][_0x9241('0x11d')](db[_0x9241('0x50')],{'foreignKey':_0x9241('0x1e7'),'as':_0x9241('0x1d9')});db[_0x9241('0xf4')][_0x9241('0x10d')](db[_0x9241('0x15c')],{'as':_0x9241('0x15d'),'foreignKey':_0x9241('0x162')});db[_0x9241('0xf4')][_0x9241('0x10d')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db['CmList'][_0x9241('0x10d')](db['CmContact'],{'as':_0x9241('0x121'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x162')});db[_0x9241('0xf4')][_0x9241('0x10d')](db[_0x9241('0x112')],{'as':_0x9241('0x113'),'foreignKey':_0x9241('0x162')});db[_0x9241('0xf4')][_0x9241('0x10d')](db[_0x9241('0x76')],{'as':_0x9241('0x114'),'foreignKey':'ListId'});db[_0x9241('0xf4')][_0x9241('0x10d')](db['ReportAgentPreview'],{'as':_0x9241('0x115'),'foreignKey':_0x9241('0x162')});db[_0x9241('0xf4')][_0x9241('0x120')](db[_0x9241('0x1a')],{'as':'Queues','through':_0x9241('0x14e')});db[_0x9241('0xf4')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':_0x9241('0x124')});db[_0x9241('0xf6')][_0x9241('0x10d')](db['VoiceExtension'],{'as':_0x9241('0x111'),'onDelete':_0x9241('0x13e')});db[_0x9241('0xf6')]['belongsToMany'](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':_0x9241('0x1e8')});db['UserProfile'][_0x9241('0x10d')](db[_0x9241('0x14')],{'as':_0x9241('0x16c'),'foreignKey':_0x9241('0x11e')});db[_0x9241('0xf8')]['hasMany'](db[_0x9241('0x1e9')],{'as':_0x9241('0x1ea'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0x9241('0x1e9')][_0x9241('0x10d')](db['UserProfileResource'],{'as':_0x9241('0x1eb'),'foreignKey':_0x9241('0x1ec'),'onDelete':_0x9241('0x13e')});db[_0x9241('0xfd')]['hasMany'](db[_0x9241('0x15c')],{'as':_0x9241('0x15d'),'foreignKey':_0x9241('0x1ed')});db['WhatsappAccount']['hasMany'](db['CannedAnswer'],{'as':_0x9241('0x15e'),'foreignKey':'WhatsappAccountId'});db[_0x9241('0xfd')]['hasMany'](db['WhatsappMessage'],{'as':_0x9241('0x165'),'foreignKey':_0x9241('0x1ed')});db[_0x9241('0xfd')]['hasMany'](db[_0x9241('0x100')],{'as':_0x9241('0x160')});db[_0x9241('0xfd')][_0x9241('0x10d')](db[_0x9241('0xfe')],{'as':'Applications'});db['WhatsappAccount'][_0x9241('0x11d')](db['CmList'],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162')});db[_0x9241('0xfd')]['belongsTo'](db[_0x9241('0x83')],{'as':_0x9241('0x14c'),'foreignKey':_0x9241('0x14d')});db[_0x9241('0xfd')][_0x9241('0x120')](db[_0x9241('0x14')],{'as':_0x9241('0x14f'),'through':'user_has_whatsapp_accounts'});db[_0x9241('0xfe')][_0x9241('0x11d')](db['User'],{'onDelete':_0x9241('0x171')});db['WhatsappApplication'][_0x9241('0x11d')](db[_0x9241('0x131')],{'onDelete':'restrict'});db[_0x9241('0xfe')][_0x9241('0x11d')](db[_0x9241('0xfd')],{'onDelete':_0x9241('0x171')});db[_0x9241('0xfe')][_0x9241('0x11d')](db['Interval'],{'onDelete':_0x9241('0x171'),'foreignKey':_0x9241('0x14b')});db[_0x9241('0xfe')]['belongsTo'](db[_0x9241('0x89')],{'onDelete':'restrict','foreignKey':_0x9241('0x172')});db[_0x9241('0x100')][_0x9241('0x10d')](db[_0x9241('0x102')],{'as':_0x9241('0x165'),'onDelete':_0x9241('0x13e'),'foreignKey':_0x9241('0x1ee')});db[_0x9241('0x100')][_0x9241('0x11d')](db[_0x9241('0xfd')],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x1ed')});db[_0x9241('0x100')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':_0x9241('0x168'),'foreignKey':_0x9241('0x158')});db[_0x9241('0x100')][_0x9241('0x11d')](db[_0x9241('0x14')],{'as':'Owner','foreignKey':_0x9241('0x110')});db[_0x9241('0x100')][_0x9241('0x120')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x9241('0x180')});db['WhatsappInteraction']['belongsToMany'](db[_0x9241('0x89')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x9241('0x100')]['belongsToMany'](db[_0x9241('0x14')],{'as':_0x9241('0x16c'),'through':_0x9241('0x1ef'),'foreignKey':'WhatsappInteractionId'});db[_0x9241('0x102')][_0x9241('0x11d')](db[_0x9241('0x14')],{'as':'User'});db[_0x9241('0x102')][_0x9241('0x11d')](db[_0x9241('0x70')],{'onDelete':_0x9241('0x13e'),'as':_0x9241('0x168')});db[_0x9241('0x102')][_0x9241('0x11d')](db['WhatsappInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x9241('0x1ee')});db[_0x9241('0x102')][_0x9241('0x11d')](db[_0x9241('0xfd')],{'as':_0x9241('0x167'),'foreignKey':_0x9241('0x1ed')});db[_0x9241('0x103')][_0x9241('0x11d')](db[_0x9241('0xfd')],{});db[_0x9241('0x103')][_0x9241('0x11d')](db[_0x9241('0xf4')],{'as':_0x9241('0x161'),'foreignKey':_0x9241('0x162')});db[_0x9241('0x103')][_0x9241('0x11d')](db[_0x9241('0x70')],{'as':'Contact','foreignKey':_0x9241('0x158')});db[_0x9241('0x103')][_0x9241('0x11d')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x9241('0x11d')](db[_0x9241('0x131')],{});db[_0x9241('0x103')][_0x9241('0x11d')](db[_0x9241('0x102')],{});db[_0x9241('0x103')]['belongsTo'](db['User'],{});db['WhatsappTransferReport'][_0x9241('0x11d')](db['WhatsappMessage'],{});db[_0x9241('0x104')][_0x9241('0x11d')](db['WhatsappInteraction'],{});db[_0x9241('0x104')][_0x9241('0x11d')](db['WhatsappAccount'],{'foreignKey':_0x9241('0x1f0'),'as':'FromAccount'});db[_0x9241('0x104')][_0x9241('0x11d')](db[_0x9241('0xfd')],{'foreignKey':_0x9241('0x1f1'),'as':'ToAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x9241('0x131')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x9241('0x104')][_0x9241('0x11d')](db[_0x9241('0x14')],{'foreignKey':_0x9241('0x1d4'),'as':_0x9241('0x1d5')});db[_0x9241('0x104')][_0x9241('0x11d')](db[_0x9241('0x14')],{'foreignKey':_0x9241('0x1db'),'as':_0x9241('0x1dc')});db[_0x9241('0x131')]['belongsToMany'](db['User'],{'as':_0x9241('0x14f'),'through':_0x9241('0x39'),'foreignKey':_0x9241('0x1f2')});db[_0x9241('0x131')][_0x9241('0x120')](db[_0x9241('0xe4')],{'through':_0x9241('0x1cf'),'as':'Teams'});module[_0x9241('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 6f95d7f..d98bb36 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/openchannelQueueReport','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/intervals','/api/pauses','/api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_phones','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/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/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','./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/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','static','join','/apidoc','/www','root','/demo','/snippet','snippet','/server/files/plugins','route','get','resolve','/index.html','username','password','newPassword','apiKey','firstName','street','phone','fax','email','clientId','clientSecret','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','clientEmail','secretaccesskey','pass','accountSid','dsn','secret','registry','isArray','length','isPlainObject','isString','@@{','}@@','replace','includes','lodash','path','express','util','./errors','./config/logger','api','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','other','agent_id','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport'];(function(_0x4e6629,_0x4f7713){var _0x304308=function(_0x47fba1){while(--_0x47fba1){_0x4e6629['push'](_0x4e6629['shift']());}};_0x304308(++_0x4f7713);}(_0x7a54,0x106));var _0x47a5=function(_0x2d99fa,_0x3b82f9){_0x2d99fa=_0x2d99fa-0x0;var _0x5f5fb2=_0x7a54[_0x2d99fa];return _0x5f5fb2;};'use strict';var _=require(_0x47a5('0x0'));var path=require(_0x47a5('0x1'));var express=require(_0x47a5('0x2'));var ewinston=require('express-winston');var util=require(_0x47a5('0x3'));var errors=require(_0x47a5('0x4'));var config=require('./config/environment');var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var authLogger=require(_0x47a5('0x5'))(_0x47a5('0x7'));exports[_0x47a5('0x8')]=function(_0x545a97){_0x545a97[_0x47a5('0x9')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x343372,_0x30e405){var _0x506eda=_0x47a5('0xa');if(!_['isEmpty'](_0x343372['body'])){_0x506eda+='\x20body=%s';var _0x2a0e98=_0x343372[_0x47a5('0xb')];maskSensitiveData(_0x2a0e98);}return util['format'](_0x506eda,_0x343372[_0x47a5('0xc')],_0x343372['headers']['x-forwarded-for']?_0x343372[_0x47a5('0xd')][_0x47a5('0xe')]:_0x343372[_0x47a5('0xf')][_0x47a5('0x10')]||_0x343372['ip'],_0x343372[_0x47a5('0x11')],_0x30e405[_0x47a5('0x12')],_0x30e405[_0x47a5('0x13')],_0x343372['user']?_0x343372[_0x47a5('0x14')]['id']:null,_0x343372[_0x47a5('0x14')]?_0x343372[_0x47a5('0x14')][_0x47a5('0x15')]:null,_0x343372[_0x47a5('0x14')]?_0x343372[_0x47a5('0x14')][_0x47a5('0x16')]:null,_0x2a0e98?util[_0x47a5('0x17')](_0x2a0e98,![],null):'');}}));_0x545a97['use'](ewinston[_0x47a5('0x18')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x11faf5,_0x3b001e){var _0x2a2cbb=_0x47a5('0x19');if(_0x11faf5['body']&&_0x11faf5['body'][_0x47a5('0x1a')]&&_0x11faf5['body']['agent_id']){_0x2a2cbb=_0x47a5('0x1b');}return util[_0x47a5('0x1c')](_0x2a2cbb,_0x11faf5[_0x47a5('0xc')],_0x11faf5[_0x47a5('0xd')][_0x47a5('0xe')]?_0x11faf5[_0x47a5('0xd')][_0x47a5('0xe')]:_0x11faf5[_0x47a5('0xf')][_0x47a5('0x10')]||_0x11faf5['ip'],_0x11faf5['url'],_0x3b001e[_0x47a5('0x12')],_0x3b001e[_0x47a5('0x13')],_0x11faf5['user']?_0x11faf5[_0x47a5('0x14')]['id']:null,_0x11faf5[_0x47a5('0x14')]?_0x11faf5[_0x47a5('0x14')]['name']:null,_0x11faf5[_0x47a5('0x14')]?_0x11faf5[_0x47a5('0x14')][_0x47a5('0x16')]:null,_0x11faf5[_0x47a5('0xb')]&&_0x11faf5['body'][_0x47a5('0x1a')]?_0x11faf5[_0x47a5('0xb')]['device']:_0x47a5('0x1d'),_0x11faf5[_0x47a5('0xb')]&&_0x11faf5[_0x47a5('0xb')][_0x47a5('0x1e')]?_0x11faf5[_0x47a5('0xb')]['agent_id']:'',_0x11faf5['body']&&_0x11faf5[_0x47a5('0xb')]['agent_name']?_0x11faf5[_0x47a5('0xb')]['agent_name']:'');},'ignoreRoute':function(_0x23cb77){var _0x378208=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x378208[_0x47a5('0x1f')](_0x23cb77[_0x47a5('0x11')]);}}));_0x545a97[_0x47a5('0x9')](_0x47a5('0x20'),require(_0x47a5('0x21')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x22'),require(_0x47a5('0x23')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x24'),require(_0x47a5('0x25')));_0x545a97['use'](_0x47a5('0x26'),require('./api/voiceExtension'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x27'),require(_0x47a5('0x28')));_0x545a97['use'](_0x47a5('0x29'),require(_0x47a5('0x2a')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x2b'),require('./api/voiceRecording'));_0x545a97['use'](_0x47a5('0x2c'),require(_0x47a5('0x2d')));_0x545a97['use']('/api/voice/mails',require(_0x47a5('0x2e')));_0x545a97[_0x47a5('0x9')]('/api/voice/mails/messages',require(_0x47a5('0x2f')));_0x545a97['use'](_0x47a5('0x30'),require(_0x47a5('0x31')));_0x545a97['use']('/api/voice/dials/reports',require(_0x47a5('0x32')));_0x545a97['use'](_0x47a5('0x33'),require(_0x47a5('0x34')));_0x545a97[_0x47a5('0x9')]('/api/voice/queues/reports',require(_0x47a5('0x35')));_0x545a97['use']('/api/members/reports',require(_0x47a5('0x36')));_0x545a97['use'](_0x47a5('0x37'),require('./api/trunk'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x38'),require(_0x47a5('0x39')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x3a'),require(_0x47a5('0x3b')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x3c'),require(_0x47a5('0x3d')));_0x545a97['use'](_0x47a5('0x3e'),require(_0x47a5('0x3f')));_0x545a97['use'](_0x47a5('0x40'),require(_0x47a5('0x41')));_0x545a97[_0x47a5('0x9')]('/api/mail/interactions',require(_0x47a5('0x42')));_0x545a97[_0x47a5('0x9')]('/api/mail/messages',require(_0x47a5('0x43')));_0x545a97[_0x47a5('0x9')]('/api/mail/applications',require('./api/mailApplication'));_0x545a97['use'](_0x47a5('0x44'),require('./api/mailQueueReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x45'),require(_0x47a5('0x46')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x47'),require(_0x47a5('0x48')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x49'),require(_0x47a5('0x4a')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x4b'),require(_0x47a5('0x4c')));_0x545a97[_0x47a5('0x9')]('/api/fax/interactions',require(_0x47a5('0x4d')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x4e'),require(_0x47a5('0x4f')));_0x545a97['use'](_0x47a5('0x50'),require('./api/faxQueue'));_0x545a97['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x545a97[_0x47a5('0x9')]('/api/sms/accounts',require(_0x47a5('0x51')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x52'),require('./api/smsApplication'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x53'),require('./api/smsInteraction'));_0x545a97['use'](_0x47a5('0x54'),require('./api/smsMessage'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x55'),require(_0x47a5('0x56')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x57'),require(_0x47a5('0x58')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x59'),require(_0x47a5('0x5a')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x5b'),require(_0x47a5('0x5c')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x5d'),require(_0x47a5('0x5e')));_0x545a97[_0x47a5('0x9')]('/api/openchannel/queues',require(_0x47a5('0x5f')));_0x545a97[_0x47a5('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x545a97[_0x47a5('0x9')]('/api/openchannel/reports/queue',require(_0x47a5('0x60')));_0x545a97[_0x47a5('0x9')]('/api/chat/applications',require('./api/chatApplication'));_0x545a97[_0x47a5('0x9')]('/api/chat/interactions',require(_0x47a5('0x61')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x62'),require(_0x47a5('0x63')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x64'),require(_0x47a5('0x65')));_0x545a97['use']('/api/chat/queues',require(_0x47a5('0x66')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x67'),require(_0x47a5('0x68')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x69'),require(_0x47a5('0x6a')));_0x545a97['use'](_0x47a5('0x6b'),require(_0x47a5('0x6c')));_0x545a97[_0x47a5('0x9')]('/api/cm/contacts',require(_0x47a5('0x6d')));_0x545a97['use'](_0x47a5('0x6e'),require(_0x47a5('0x6f')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x70'),require('./api/cmHopperBlack'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x71'),require(_0x47a5('0x72')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x73'),require(_0x47a5('0x74')));_0x545a97[_0x47a5('0x9')]('/api/cm/custom_fields',require(_0x47a5('0x75')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x76'),require(_0x47a5('0x77')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x78'),require('./api/automation'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x79'),require(_0x47a5('0x7a')));_0x545a97['use'](_0x47a5('0x7b'),require(_0x47a5('0x7c')));_0x545a97[_0x47a5('0x9')]('/api/conditions',require('./api/condition'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x7d'),require('./api/interval'));_0x545a97['use'](_0x47a5('0x7e'),require('./api/pause'));_0x545a97[_0x47a5('0x9')]('/api/cdr',require('./api/cdr'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x7f'),require('./api/voiceQueuesLog'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x80'),require('./api/schedule'));_0x545a97['use'](_0x47a5('0x81'),require(_0x47a5('0x82')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x83'),require('./api/tag'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x84'),require(_0x47a5('0x85')));_0x545a97['use'](_0x47a5('0x86'),require('./api/cmContactHasPhone'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x87'),require(_0x47a5('0x88')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x89'),require('./api/cmHopperAdditionalPhone'));_0x545a97[_0x47a5('0x9')]('/api/templates',require('./api/template'));_0x545a97['use']('/api/triggers',require(_0x47a5('0x8a')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x8b'),require('./api/variable'));_0x545a97['use'](_0x47a5('0x8c'),require(_0x47a5('0x8d')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x8e'),require(_0x47a5('0x8f')));_0x545a97['use'](_0x47a5('0x90'),require('./api/analyticCustomReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x91'),require('./api/analyticDefaultReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x92'),require(_0x47a5('0x93')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x94'),require(_0x47a5('0x95')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x96'),require('./api/analyticFieldReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x97'),require(_0x47a5('0x98')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x99'),require('./api/intSalesforceAccount'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x9a'),require(_0x47a5('0x9b')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x9c'),require(_0x47a5('0x9d')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x9e'),require(_0x47a5('0x9f')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xa0'),require(_0x47a5('0xa1')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xa2'),require(_0x47a5('0xa3')));_0x545a97['use'](_0x47a5('0xa4'),require(_0x47a5('0xa5')));_0x545a97[_0x47a5('0x9')]('/api/integrations/desk/configurations',require(_0x47a5('0xa6')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xa7'),require(_0x47a5('0xa8')));_0x545a97['use'](_0x47a5('0xa9'),require('./api/intZohoAccount'));_0x545a97[_0x47a5('0x9')]('/api/integrations/zoho/configurations',require(_0x47a5('0xaa')));_0x545a97['use'](_0x47a5('0xab'),require(_0x47a5('0xac')));_0x545a97[_0x47a5('0x9')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x545a97['use'](_0x47a5('0xad'),require(_0x47a5('0xae')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xaf'),require('./api/intZendeskField'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb0'),require(_0x47a5('0xb1')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb2'),require(_0x47a5('0xb3')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb4'),require(_0x47a5('0xb5')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb6'),require(_0x47a5('0xb7')));_0x545a97['use'](_0x47a5('0xb8'),require('./api/intVtigerConfiguration'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb9'),require(_0x47a5('0xba')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xbb'),require(_0x47a5('0xbc')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xbd'),require(_0x47a5('0xbe')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xbf'),require(_0x47a5('0xc0')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xc1'),require(_0x47a5('0xc2')));_0x545a97['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x545a97['use'](_0x47a5('0xc3'),require(_0x47a5('0xc4')));_0x545a97['use'](_0x47a5('0xc5'),require(_0x47a5('0xc6')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xc7'),require(_0x47a5('0xc8')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xc9'),require(_0x47a5('0xca')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xcb'),require(_0x47a5('0xcc')));_0x545a97['use'](_0x47a5('0xcd'),require(_0x47a5('0xce')));_0x545a97[_0x47a5('0x9')]('/api/chat/internal/messages',require(_0x47a5('0xcf')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd0'),require('./api/jscriptyAnswerReport'));_0x545a97[_0x47a5('0x9')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd1'),require(_0x47a5('0xd2')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd3'),require(_0x47a5('0xd4')));_0x545a97['use']('/api/square/reports',require(_0x47a5('0xd5')));_0x545a97['use'](_0x47a5('0xd6'),require(_0x47a5('0xd7')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd8'),require('./api/jscriptyProject'));_0x545a97[_0x47a5('0x9')]('/api/settings',require('./api/setting'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd9'),require('./api/squareOdbc'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xda'),require(_0x47a5('0xdb')));_0x545a97['use'](_0x47a5('0xdc'),require('./api/squareRecording'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xdd'),require(_0x47a5('0xde')));_0x545a97['use'](_0x47a5('0xdf'),require(_0x47a5('0xe0')));_0x545a97[_0x47a5('0x9')]('/api/license',require(_0x47a5('0xe1')));_0x545a97['use'](_0x47a5('0xe2'),require('./api/campaign'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xe3'),require(_0x47a5('0xe4')));_0x545a97[_0x47a5('0x9')]('/api/attachments',require(_0x47a5('0xe5')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xe6'),require(_0x47a5('0xe7')));_0x545a97[_0x47a5('0x9')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x545a97[_0x47a5('0x9')]('/api/chat/reports/transfer',require(_0x47a5('0xe8')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xe9'),require('./api/faxTransferReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xea'),require('./api/openchannelTransferReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xeb'),require(_0x47a5('0xec')));_0x545a97[_0x47a5('0x9')]('/api/cm/lists',require('./api/cmList'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xed'),require('./api/voicePrefix'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xee'),require('./api/userProfile'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xef'),require(_0x47a5('0xf0')));_0x545a97['use'](_0x47a5('0xf1'),require('./api/userProfileResource'));_0x545a97[_0x47a5('0x9')]('/api/userNotifications',require(_0x47a5('0xf2')));_0x545a97[_0x47a5('0x9')]('/api/whatsapp/accounts',require(_0x47a5('0xf3')));_0x545a97['use'](_0x47a5('0xf4'),require(_0x47a5('0xf5')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xf6'),require('./api/whatsappInteraction'));_0x545a97[_0x47a5('0x9')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xf7'),require(_0x47a5('0xf8')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xf9'),require('./api/whatsappTransferReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xfa'),require(_0x47a5('0xfb')));_0x545a97[_0x47a5('0x9')]('/api/cloudProviders',require(_0x47a5('0xfc')));_0x545a97['use'](_0x47a5('0xfd'),require(_0x47a5('0xfe')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xff'),require(_0x47a5('0x100')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x101'),require(_0x47a5('0x102')));_0x545a97[_0x47a5('0x9')]('/api/rpc',require(_0x47a5('0x103')));_0x545a97[_0x47a5('0x9')]('/api/version',require(_0x47a5('0x104')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x105'),require('./api/system'));_0x545a97['use'](_0x47a5('0x106'),require(_0x47a5('0x107')));_0x545a97['use']('/api/webbar',require(_0x47a5('0x108')));_0x545a97[_0x47a5('0x9')]('/apidoc',express[_0x47a5('0x109')](path[_0x47a5('0x10a')](config['root'],_0x47a5('0x10b'))));_0x545a97[_0x47a5('0x9')](_0x47a5('0x10c'),express[_0x47a5('0x109')](path[_0x47a5('0x10a')](config[_0x47a5('0x10d')],'/www')));_0x545a97['use']('/demo',express[_0x47a5('0x109')](path[_0x47a5('0x10a')](config['root'],_0x47a5('0x10e'))));_0x545a97[_0x47a5('0x9')](_0x47a5('0x10f'),express[_0x47a5('0x109')](path[_0x47a5('0x10a')](config['root'],_0x47a5('0x110'),'3.0.0')));_0x545a97['use']('/plugins',express[_0x47a5('0x109')](path['join'](config[_0x47a5('0x10d')],_0x47a5('0x111'))));_0x545a97[_0x47a5('0x112')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x47a5('0x113')](errors[0x194]);_0x545a97[_0x47a5('0x112')]('/*')[_0x47a5('0x113')](function(_0x121750,_0x392ad7){_0x392ad7['sendFile'](path[_0x47a5('0x114')](_0x545a97[_0x47a5('0x113')]('appPath')+_0x47a5('0x115')));});};var sensitiveFields=[_0x47a5('0x116'),_0x47a5('0x117'),_0x47a5('0x118'),_0x47a5('0x119'),_0x47a5('0x11a'),'lastName',_0x47a5('0x11b'),_0x47a5('0x11c'),'mobile',_0x47a5('0x11d'),_0x47a5('0x11e'),_0x47a5('0x11f'),_0x47a5('0x120'),'securityToken','code','accessKey','tenantId',_0x47a5('0x121'),_0x47a5('0x122'),_0x47a5('0x123'),_0x47a5('0x124'),_0x47a5('0x125'),_0x47a5('0x126'),_0x47a5('0x127'),_0x47a5('0x128'),'calleridname',_0x47a5('0x129'),_0x47a5('0x12a'),_0x47a5('0x12b'),_0x47a5('0x12c'),'privateKey','accesskeyid',_0x47a5('0x12d'),'key','user',_0x47a5('0x12e'),_0x47a5('0x12f'),'localstationid',_0x47a5('0x130'),_0x47a5('0x131'),_0x47a5('0x132'),'oldPassword'];function maskSensitiveData(_0x740bdf){var _0xee23c7=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x740bdf))return;for(var _0x1172fd in _0x740bdf){if(_[_0x47a5('0x133')](_0x740bdf[_0x1172fd])){for(var _0x10ee87=0x0;_0x10ee87<_0x740bdf[_0x1172fd][_0x47a5('0x134')];_0x10ee87++){maskSensitiveData(_0x740bdf[_0x1172fd][_0x10ee87]);}}else if(_[_0x47a5('0x135')](_0x740bdf[_0x1172fd])){maskSensitiveData(_0x740bdf[_0x1172fd]);}else if(_[_0x47a5('0x136')](_0x740bdf[_0x1172fd])){_0x740bdf[_0x1172fd]=_0x740bdf[_0x1172fd]['replace'](/{{{/g,_0x47a5('0x137'))['replace'](/}}}/g,_0x47a5('0x138'))[_0x47a5('0x139')](/{{/g,'@{')[_0x47a5('0x139')](/}}/g,'}@');if(_[_0x47a5('0x13a')](sensitiveFields,_0x1172fd)){_0x740bdf[_0x1172fd]=_0x740bdf[_0x1172fd]['replace'](_0xee23c7,'*');}}}} \ No newline at end of file +var _0x7a54=['./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/openchannelQueueReport','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/intervals','/api/pauses','/api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_phones','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/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/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','./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/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','static','join','/apidoc','/www','root','/demo','/snippet','snippet','/server/files/plugins','route','get','resolve','/index.html','username','password','newPassword','apiKey','firstName','street','phone','fax','email','clientId','clientSecret','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','clientEmail','secretaccesskey','pass','accountSid','dsn','secret','registry','isArray','length','isPlainObject','isString','@@{','}@@','replace','includes','lodash','path','express','util','./errors','./config/logger','api','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','other','agent_id','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport'];(function(_0xcd4ce9,_0x9964b6){var _0x51ff98=function(_0x1ee052){while(--_0x1ee052){_0xcd4ce9['push'](_0xcd4ce9['shift']());}};_0x51ff98(++_0x9964b6);}(_0x7a54,0x106));var _0x47a5=function(_0x2df195,_0x1e8ebd){_0x2df195=_0x2df195-0x0;var _0xa7e7d9=_0x7a54[_0x2df195];return _0xa7e7d9;};'use strict';var _=require(_0x47a5('0x0'));var path=require(_0x47a5('0x1'));var express=require(_0x47a5('0x2'));var ewinston=require('express-winston');var util=require(_0x47a5('0x3'));var errors=require(_0x47a5('0x4'));var config=require('./config/environment');var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var authLogger=require(_0x47a5('0x5'))(_0x47a5('0x7'));exports[_0x47a5('0x8')]=function(_0x545a97){_0x545a97[_0x47a5('0x9')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x343372,_0x30e405){var _0x506eda=_0x47a5('0xa');if(!_['isEmpty'](_0x343372['body'])){_0x506eda+='\x20body=%s';var _0x2a0e98=_0x343372[_0x47a5('0xb')];maskSensitiveData(_0x2a0e98);}return util['format'](_0x506eda,_0x343372[_0x47a5('0xc')],_0x343372['headers']['x-forwarded-for']?_0x343372[_0x47a5('0xd')][_0x47a5('0xe')]:_0x343372[_0x47a5('0xf')][_0x47a5('0x10')]||_0x343372['ip'],_0x343372[_0x47a5('0x11')],_0x30e405[_0x47a5('0x12')],_0x30e405[_0x47a5('0x13')],_0x343372['user']?_0x343372[_0x47a5('0x14')]['id']:null,_0x343372[_0x47a5('0x14')]?_0x343372[_0x47a5('0x14')][_0x47a5('0x15')]:null,_0x343372[_0x47a5('0x14')]?_0x343372[_0x47a5('0x14')][_0x47a5('0x16')]:null,_0x2a0e98?util[_0x47a5('0x17')](_0x2a0e98,![],null):'');}}));_0x545a97['use'](ewinston[_0x47a5('0x18')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x11faf5,_0x3b001e){var _0x2a2cbb=_0x47a5('0x19');if(_0x11faf5['body']&&_0x11faf5['body'][_0x47a5('0x1a')]&&_0x11faf5['body']['agent_id']){_0x2a2cbb=_0x47a5('0x1b');}return util[_0x47a5('0x1c')](_0x2a2cbb,_0x11faf5[_0x47a5('0xc')],_0x11faf5[_0x47a5('0xd')][_0x47a5('0xe')]?_0x11faf5[_0x47a5('0xd')][_0x47a5('0xe')]:_0x11faf5[_0x47a5('0xf')][_0x47a5('0x10')]||_0x11faf5['ip'],_0x11faf5['url'],_0x3b001e[_0x47a5('0x12')],_0x3b001e[_0x47a5('0x13')],_0x11faf5['user']?_0x11faf5[_0x47a5('0x14')]['id']:null,_0x11faf5[_0x47a5('0x14')]?_0x11faf5[_0x47a5('0x14')]['name']:null,_0x11faf5[_0x47a5('0x14')]?_0x11faf5[_0x47a5('0x14')][_0x47a5('0x16')]:null,_0x11faf5[_0x47a5('0xb')]&&_0x11faf5['body'][_0x47a5('0x1a')]?_0x11faf5[_0x47a5('0xb')]['device']:_0x47a5('0x1d'),_0x11faf5[_0x47a5('0xb')]&&_0x11faf5[_0x47a5('0xb')][_0x47a5('0x1e')]?_0x11faf5[_0x47a5('0xb')]['agent_id']:'',_0x11faf5['body']&&_0x11faf5[_0x47a5('0xb')]['agent_name']?_0x11faf5[_0x47a5('0xb')]['agent_name']:'');},'ignoreRoute':function(_0x23cb77){var _0x378208=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x378208[_0x47a5('0x1f')](_0x23cb77[_0x47a5('0x11')]);}}));_0x545a97[_0x47a5('0x9')](_0x47a5('0x20'),require(_0x47a5('0x21')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x22'),require(_0x47a5('0x23')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x24'),require(_0x47a5('0x25')));_0x545a97['use'](_0x47a5('0x26'),require('./api/voiceExtension'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x27'),require(_0x47a5('0x28')));_0x545a97['use'](_0x47a5('0x29'),require(_0x47a5('0x2a')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x2b'),require('./api/voiceRecording'));_0x545a97['use'](_0x47a5('0x2c'),require(_0x47a5('0x2d')));_0x545a97['use']('/api/voice/mails',require(_0x47a5('0x2e')));_0x545a97[_0x47a5('0x9')]('/api/voice/mails/messages',require(_0x47a5('0x2f')));_0x545a97['use'](_0x47a5('0x30'),require(_0x47a5('0x31')));_0x545a97['use']('/api/voice/dials/reports',require(_0x47a5('0x32')));_0x545a97['use'](_0x47a5('0x33'),require(_0x47a5('0x34')));_0x545a97[_0x47a5('0x9')]('/api/voice/queues/reports',require(_0x47a5('0x35')));_0x545a97['use']('/api/members/reports',require(_0x47a5('0x36')));_0x545a97['use'](_0x47a5('0x37'),require('./api/trunk'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x38'),require(_0x47a5('0x39')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x3a'),require(_0x47a5('0x3b')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x3c'),require(_0x47a5('0x3d')));_0x545a97['use'](_0x47a5('0x3e'),require(_0x47a5('0x3f')));_0x545a97['use'](_0x47a5('0x40'),require(_0x47a5('0x41')));_0x545a97[_0x47a5('0x9')]('/api/mail/interactions',require(_0x47a5('0x42')));_0x545a97[_0x47a5('0x9')]('/api/mail/messages',require(_0x47a5('0x43')));_0x545a97[_0x47a5('0x9')]('/api/mail/applications',require('./api/mailApplication'));_0x545a97['use'](_0x47a5('0x44'),require('./api/mailQueueReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x45'),require(_0x47a5('0x46')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x47'),require(_0x47a5('0x48')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x49'),require(_0x47a5('0x4a')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x4b'),require(_0x47a5('0x4c')));_0x545a97[_0x47a5('0x9')]('/api/fax/interactions',require(_0x47a5('0x4d')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x4e'),require(_0x47a5('0x4f')));_0x545a97['use'](_0x47a5('0x50'),require('./api/faxQueue'));_0x545a97['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x545a97[_0x47a5('0x9')]('/api/sms/accounts',require(_0x47a5('0x51')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x52'),require('./api/smsApplication'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x53'),require('./api/smsInteraction'));_0x545a97['use'](_0x47a5('0x54'),require('./api/smsMessage'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x55'),require(_0x47a5('0x56')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x57'),require(_0x47a5('0x58')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x59'),require(_0x47a5('0x5a')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x5b'),require(_0x47a5('0x5c')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x5d'),require(_0x47a5('0x5e')));_0x545a97[_0x47a5('0x9')]('/api/openchannel/queues',require(_0x47a5('0x5f')));_0x545a97[_0x47a5('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x545a97[_0x47a5('0x9')]('/api/openchannel/reports/queue',require(_0x47a5('0x60')));_0x545a97[_0x47a5('0x9')]('/api/chat/applications',require('./api/chatApplication'));_0x545a97[_0x47a5('0x9')]('/api/chat/interactions',require(_0x47a5('0x61')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x62'),require(_0x47a5('0x63')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x64'),require(_0x47a5('0x65')));_0x545a97['use']('/api/chat/queues',require(_0x47a5('0x66')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x67'),require(_0x47a5('0x68')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x69'),require(_0x47a5('0x6a')));_0x545a97['use'](_0x47a5('0x6b'),require(_0x47a5('0x6c')));_0x545a97[_0x47a5('0x9')]('/api/cm/contacts',require(_0x47a5('0x6d')));_0x545a97['use'](_0x47a5('0x6e'),require(_0x47a5('0x6f')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x70'),require('./api/cmHopperBlack'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x71'),require(_0x47a5('0x72')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x73'),require(_0x47a5('0x74')));_0x545a97[_0x47a5('0x9')]('/api/cm/custom_fields',require(_0x47a5('0x75')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x76'),require(_0x47a5('0x77')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x78'),require('./api/automation'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x79'),require(_0x47a5('0x7a')));_0x545a97['use'](_0x47a5('0x7b'),require(_0x47a5('0x7c')));_0x545a97[_0x47a5('0x9')]('/api/conditions',require('./api/condition'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x7d'),require('./api/interval'));_0x545a97['use'](_0x47a5('0x7e'),require('./api/pause'));_0x545a97[_0x47a5('0x9')]('/api/cdr',require('./api/cdr'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x7f'),require('./api/voiceQueuesLog'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x80'),require('./api/schedule'));_0x545a97['use'](_0x47a5('0x81'),require(_0x47a5('0x82')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x83'),require('./api/tag'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x84'),require(_0x47a5('0x85')));_0x545a97['use'](_0x47a5('0x86'),require('./api/cmContactHasPhone'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x87'),require(_0x47a5('0x88')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x89'),require('./api/cmHopperAdditionalPhone'));_0x545a97[_0x47a5('0x9')]('/api/templates',require('./api/template'));_0x545a97['use']('/api/triggers',require(_0x47a5('0x8a')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x8b'),require('./api/variable'));_0x545a97['use'](_0x47a5('0x8c'),require(_0x47a5('0x8d')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x8e'),require(_0x47a5('0x8f')));_0x545a97['use'](_0x47a5('0x90'),require('./api/analyticCustomReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x91'),require('./api/analyticDefaultReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x92'),require(_0x47a5('0x93')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x94'),require(_0x47a5('0x95')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x96'),require('./api/analyticFieldReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x97'),require(_0x47a5('0x98')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x99'),require('./api/intSalesforceAccount'));_0x545a97[_0x47a5('0x9')](_0x47a5('0x9a'),require(_0x47a5('0x9b')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x9c'),require(_0x47a5('0x9d')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x9e'),require(_0x47a5('0x9f')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xa0'),require(_0x47a5('0xa1')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xa2'),require(_0x47a5('0xa3')));_0x545a97['use'](_0x47a5('0xa4'),require(_0x47a5('0xa5')));_0x545a97[_0x47a5('0x9')]('/api/integrations/desk/configurations',require(_0x47a5('0xa6')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xa7'),require(_0x47a5('0xa8')));_0x545a97['use'](_0x47a5('0xa9'),require('./api/intZohoAccount'));_0x545a97[_0x47a5('0x9')]('/api/integrations/zoho/configurations',require(_0x47a5('0xaa')));_0x545a97['use'](_0x47a5('0xab'),require(_0x47a5('0xac')));_0x545a97[_0x47a5('0x9')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x545a97['use'](_0x47a5('0xad'),require(_0x47a5('0xae')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xaf'),require('./api/intZendeskField'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb0'),require(_0x47a5('0xb1')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb2'),require(_0x47a5('0xb3')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb4'),require(_0x47a5('0xb5')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb6'),require(_0x47a5('0xb7')));_0x545a97['use'](_0x47a5('0xb8'),require('./api/intVtigerConfiguration'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xb9'),require(_0x47a5('0xba')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xbb'),require(_0x47a5('0xbc')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xbd'),require(_0x47a5('0xbe')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xbf'),require(_0x47a5('0xc0')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xc1'),require(_0x47a5('0xc2')));_0x545a97['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x545a97['use'](_0x47a5('0xc3'),require(_0x47a5('0xc4')));_0x545a97['use'](_0x47a5('0xc5'),require(_0x47a5('0xc6')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xc7'),require(_0x47a5('0xc8')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xc9'),require(_0x47a5('0xca')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xcb'),require(_0x47a5('0xcc')));_0x545a97['use'](_0x47a5('0xcd'),require(_0x47a5('0xce')));_0x545a97[_0x47a5('0x9')]('/api/chat/internal/messages',require(_0x47a5('0xcf')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd0'),require('./api/jscriptyAnswerReport'));_0x545a97[_0x47a5('0x9')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd1'),require(_0x47a5('0xd2')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd3'),require(_0x47a5('0xd4')));_0x545a97['use']('/api/square/reports',require(_0x47a5('0xd5')));_0x545a97['use'](_0x47a5('0xd6'),require(_0x47a5('0xd7')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd8'),require('./api/jscriptyProject'));_0x545a97[_0x47a5('0x9')]('/api/settings',require('./api/setting'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xd9'),require('./api/squareOdbc'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xda'),require(_0x47a5('0xdb')));_0x545a97['use'](_0x47a5('0xdc'),require('./api/squareRecording'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xdd'),require(_0x47a5('0xde')));_0x545a97['use'](_0x47a5('0xdf'),require(_0x47a5('0xe0')));_0x545a97[_0x47a5('0x9')]('/api/license',require(_0x47a5('0xe1')));_0x545a97['use'](_0x47a5('0xe2'),require('./api/campaign'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xe3'),require(_0x47a5('0xe4')));_0x545a97[_0x47a5('0x9')]('/api/attachments',require(_0x47a5('0xe5')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xe6'),require(_0x47a5('0xe7')));_0x545a97[_0x47a5('0x9')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x545a97[_0x47a5('0x9')]('/api/chat/reports/transfer',require(_0x47a5('0xe8')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xe9'),require('./api/faxTransferReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xea'),require('./api/openchannelTransferReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xeb'),require(_0x47a5('0xec')));_0x545a97[_0x47a5('0x9')]('/api/cm/lists',require('./api/cmList'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xed'),require('./api/voicePrefix'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xee'),require('./api/userProfile'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xef'),require(_0x47a5('0xf0')));_0x545a97['use'](_0x47a5('0xf1'),require('./api/userProfileResource'));_0x545a97[_0x47a5('0x9')]('/api/userNotifications',require(_0x47a5('0xf2')));_0x545a97[_0x47a5('0x9')]('/api/whatsapp/accounts',require(_0x47a5('0xf3')));_0x545a97['use'](_0x47a5('0xf4'),require(_0x47a5('0xf5')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xf6'),require('./api/whatsappInteraction'));_0x545a97[_0x47a5('0x9')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xf7'),require(_0x47a5('0xf8')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xf9'),require('./api/whatsappTransferReport'));_0x545a97[_0x47a5('0x9')](_0x47a5('0xfa'),require(_0x47a5('0xfb')));_0x545a97[_0x47a5('0x9')]('/api/cloudProviders',require(_0x47a5('0xfc')));_0x545a97['use'](_0x47a5('0xfd'),require(_0x47a5('0xfe')));_0x545a97[_0x47a5('0x9')](_0x47a5('0xff'),require(_0x47a5('0x100')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x101'),require(_0x47a5('0x102')));_0x545a97[_0x47a5('0x9')]('/api/rpc',require(_0x47a5('0x103')));_0x545a97[_0x47a5('0x9')]('/api/version',require(_0x47a5('0x104')));_0x545a97[_0x47a5('0x9')](_0x47a5('0x105'),require('./api/system'));_0x545a97['use'](_0x47a5('0x106'),require(_0x47a5('0x107')));_0x545a97['use']('/api/webbar',require(_0x47a5('0x108')));_0x545a97[_0x47a5('0x9')]('/apidoc',express[_0x47a5('0x109')](path[_0x47a5('0x10a')](config['root'],_0x47a5('0x10b'))));_0x545a97[_0x47a5('0x9')](_0x47a5('0x10c'),express[_0x47a5('0x109')](path[_0x47a5('0x10a')](config[_0x47a5('0x10d')],'/www')));_0x545a97['use']('/demo',express[_0x47a5('0x109')](path[_0x47a5('0x10a')](config['root'],_0x47a5('0x10e'))));_0x545a97[_0x47a5('0x9')](_0x47a5('0x10f'),express[_0x47a5('0x109')](path[_0x47a5('0x10a')](config['root'],_0x47a5('0x110'),'3.0.0')));_0x545a97['use']('/plugins',express[_0x47a5('0x109')](path['join'](config[_0x47a5('0x10d')],_0x47a5('0x111'))));_0x545a97[_0x47a5('0x112')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x47a5('0x113')](errors[0x194]);_0x545a97[_0x47a5('0x112')]('/*')[_0x47a5('0x113')](function(_0x121750,_0x392ad7){_0x392ad7['sendFile'](path[_0x47a5('0x114')](_0x545a97[_0x47a5('0x113')]('appPath')+_0x47a5('0x115')));});};var sensitiveFields=[_0x47a5('0x116'),_0x47a5('0x117'),_0x47a5('0x118'),_0x47a5('0x119'),_0x47a5('0x11a'),'lastName',_0x47a5('0x11b'),_0x47a5('0x11c'),'mobile',_0x47a5('0x11d'),_0x47a5('0x11e'),_0x47a5('0x11f'),_0x47a5('0x120'),'securityToken','code','accessKey','tenantId',_0x47a5('0x121'),_0x47a5('0x122'),_0x47a5('0x123'),_0x47a5('0x124'),_0x47a5('0x125'),_0x47a5('0x126'),_0x47a5('0x127'),_0x47a5('0x128'),'calleridname',_0x47a5('0x129'),_0x47a5('0x12a'),_0x47a5('0x12b'),_0x47a5('0x12c'),'privateKey','accesskeyid',_0x47a5('0x12d'),'key','user',_0x47a5('0x12e'),_0x47a5('0x12f'),'localstationid',_0x47a5('0x130'),_0x47a5('0x131'),_0x47a5('0x132'),'oldPassword'];function maskSensitiveData(_0x740bdf){var _0xee23c7=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x740bdf))return;for(var _0x1172fd in _0x740bdf){if(_[_0x47a5('0x133')](_0x740bdf[_0x1172fd])){for(var _0x10ee87=0x0;_0x10ee87<_0x740bdf[_0x1172fd][_0x47a5('0x134')];_0x10ee87++){maskSensitiveData(_0x740bdf[_0x1172fd][_0x10ee87]);}}else if(_[_0x47a5('0x135')](_0x740bdf[_0x1172fd])){maskSensitiveData(_0x740bdf[_0x1172fd]);}else if(_[_0x47a5('0x136')](_0x740bdf[_0x1172fd])){_0x740bdf[_0x1172fd]=_0x740bdf[_0x1172fd]['replace'](/{{{/g,_0x47a5('0x137'))['replace'](/}}}/g,_0x47a5('0x138'))[_0x47a5('0x139')](/{{/g,'@{')[_0x47a5('0x139')](/}}/g,'}@');if(_[_0x47a5('0x13a')](sensitiveFields,_0x1172fd)){_0x740bdf[_0x1172fd]=_0x740bdf[_0x1172fd]['replace'](_0xee23c7,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 016829f..cad999b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1ad=['../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','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/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb1ad,0x1d8));var _0xdb1a=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xb1ad[_0x3899d1];return _0xeb4a7d;};'use strict';var jayson=require(_0xdb1a('0x0'));var BPromise=require(_0xdb1a('0x1'));var _=require(_0xdb1a('0x2'));var config=require(_0xdb1a('0x3'));exports[_0xdb1a('0x4')]=function(){return new BPromise(function(_0x5256ff,_0x545367){var _0x5d4af9={};_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/user/user.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x6')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x7')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x8')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x9')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0xa')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0xb')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/trunk/trunk.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0xc')));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0xd')));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0xe')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0xf')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x10')));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0x11')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x12')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x13')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x14')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x15')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x16')));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0x17')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/faxQueue/faxQueue.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x18')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x19')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x1a')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x1b')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x1c')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x1d')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x1e')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5d4af9=_['merge'](_0x5d4af9,require('../api/chatInteraction/chatInteraction.rpc'));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0x1f')));_0x5d4af9=_['merge'](_0x5d4af9,require('../api/chatQueue/chatQueue.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x20')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/cmHopper/cmHopper.rpc'));_0x5d4af9=_['merge'](_0x5d4af9,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5d4af9=_['merge'](_0x5d4af9,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0x21')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x22')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x23')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x24')));_0x5d4af9=_['merge'](_0x5d4af9,require('../api/sound/sound.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/template/template.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/trigger/trigger.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/variable/variable.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x25')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x26')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x27')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x28')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x29')));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0x2a')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x2b')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x2c')));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0x2d')));_0x5d4af9=_['merge'](_0x5d4af9,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x2e')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/squareReport/squareReport.rpc'));_0x5d4af9=_['merge'](_0x5d4af9,require(_0xdb1a('0x2f')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x30')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x31')));_0x5d4af9=_['merge'](_0x5d4af9,require('../api/squareProject/squareProject.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/squareRecording/squareRecording.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/squareMessage/squareMessage.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x32')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x33')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x34')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x35')));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5d4af9=_[_0xdb1a('0x5')](_0x5d4af9,require(_0xdb1a('0x36')));var _0xb932d1=jayson[_0xdb1a('0x37')](_0x5d4af9)['http']();var _0x212892=config[_0xdb1a('0x38')][_0xdb1a('0x39')]||config[_0xdb1a('0x39')]+0x1;var _0x18d0d3=config[_0xdb1a('0x38')]['ip']||_0xdb1a('0x3a');_0xb932d1['on'](_0xdb1a('0x3b'),function(_0x1b75ce){return _0x545367(_0x1b75ce);});_0xb932d1['listen'](_0x212892,_0x18d0d3,function(){console[_0xdb1a('0x3c')](_0xdb1a('0x3d'),_0x18d0d3,_0x212892);require(_0xdb1a('0x3e'))[_0xdb1a('0x3f')]();return _0x5256ff(_0xdb1a('0x40')+_0x18d0d3+':'+_0x212892);});});}; \ No newline at end of file +var _0xea06=['../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge'];(function(_0x53ed97,_0x1b32fd){var _0x5eb20e=function(_0x40fc0a){while(--_0x40fc0a){_0x53ed97['push'](_0x53ed97['shift']());}};_0x5eb20e(++_0x1b32fd);}(_0xea06,0x158));var _0x6ea0=function(_0x154e43,_0x3fe0c7){_0x154e43=_0x154e43-0x0;var _0x593ff4=_0xea06[_0x154e43];return _0x593ff4;};'use strict';var jayson=require(_0x6ea0('0x0'));var BPromise=require(_0x6ea0('0x1'));var _=require(_0x6ea0('0x2'));var config=require(_0x6ea0('0x3'));exports[_0x6ea0('0x4')]=function(){return new BPromise(function(_0x32e07b,_0x488629){var _0x2c9567={};_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/user/user.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x6')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x7')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/voiceRecording/voiceRecording.rpc'));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x8')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x9')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0xa')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0xb')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/memberReport/memberReport.rpc'));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0xc')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0xd')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0xe')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/mailAccount/mailAccount.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0xf')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x10')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x11')));_0x2c9567=_['merge'](_0x2c9567,require('../api/mailApplication/mailApplication.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x12')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x13')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/faxApplication/faxApplication.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/faxInteraction/faxInteraction.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x14')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x15')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x16')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x17')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x18')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/smsMessage/smsMessage.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/smsQueue/smsQueue.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x19')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x1a')));_0x2c9567=_['merge'](_0x2c9567,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2c9567=_['merge'](_0x2c9567,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x1b')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x1c')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x1d')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/cmContact/cmContact.rpc'));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x1e')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x1f')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x20')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x21')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x22')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x23')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x24')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x25')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x26')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x27')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x28')));_0x2c9567=_['merge'](_0x2c9567,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x29')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x2a')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x2b')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x2c')));_0x2c9567=_['merge'](_0x2c9567,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x2d')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x2e')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x2f')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x30')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x31')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x32')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x33')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/squareOdbc/squareOdbc.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x34')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/squareRecording/squareRecording.rpc'));_0x2c9567=_['merge'](_0x2c9567,require('../api/squareMessage/squareMessage.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require('../api/campaign/campaign.rpc'));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x35')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x36')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x37')));_0x2c9567=_[_0x6ea0('0x5')](_0x2c9567,require(_0x6ea0('0x38')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x39')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x3a')));_0x2c9567=_['merge'](_0x2c9567,require(_0x6ea0('0x3b')));var _0x4d3ee0=jayson[_0x6ea0('0x3c')](_0x2c9567)[_0x6ea0('0x3d')]();var _0x48a6ef=config[_0x6ea0('0x3e')][_0x6ea0('0x3f')]||config['port']+0x1;var _0x28bfed=config[_0x6ea0('0x3e')]['ip']||_0x6ea0('0x40');_0x4d3ee0['on']('error',function(_0x5348d4){return _0x488629(_0x5348d4);});_0x4d3ee0[_0x6ea0('0x4')](_0x48a6ef,_0x28bfed,function(){console[_0x6ea0('0x41')](_0x6ea0('0x42'),_0x28bfed,_0x48a6ef);require(_0x6ea0('0x43'))[_0x6ea0('0x44')]();return _0x32e07b(_0x6ea0('0x45')+_0x28bfed+':'+_0x48a6ef);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c2d64b5..9003411 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 _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x39345e,_0x35e129){var _0x5e6cfb=function(_0x51caf7){while(--_0x51caf7){_0x39345e['push'](_0x39345e['shift']());}};_0x5e6cfb(++_0x35e129);}(_0x70e0,0x17b));var _0x070e=function(_0x3777cd,_0x571250){_0x3777cd=_0x3777cd-0x0;var _0x17191f=_0x70e0[_0x3777cd];return _0x17191f;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file +var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','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','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x4079f0,_0x3e1229){var _0x185476=function(_0x39e9c0){while(--_0x39e9c0){_0x4079f0['push'](_0x4079f0['shift']());}};_0x185476(++_0x3e1229);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 76a35a1..066f325 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 _0xdbb3=['name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply'];(function(_0x38f638,_0xf677a8){var _0x33bf23=function(_0x5f02da){while(--_0x5f02da){_0x38f638['push'](_0x38f638['shift']());}};_0x33bf23(++_0xf677a8);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xdbb3[_0x59c301];return _0x3866b9;};'use strict';var util=require(_0x3dbb('0x0'));var error={'E_AGI_UNDEFINED':_0x3dbb('0x1'),'E_AGI_ARGUMENT_PORT':_0x3dbb('0x2'),'E_AGI_SERVER_ERROR':_0x3dbb('0x3'),'E_AGI_SERVER_CLOSE':_0x3dbb('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x3dbb('0x5'),'E_AGI_SOCKET_ERROR':_0x3dbb('0x6'),'E_AGI_SOCKET_CLOSE':_0x3dbb('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x3dbb('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3dbb('0x9'),'E_AGI_IVR_ENTRY':_0x3dbb('0xa')};function AGIError(_0x545ae5){var _0x545ae5=_0x545ae5||null,_0x380291=_0x380291||[],_0x48e970=0x1,_0x440257='';if(!error[_0x545ae5]){_0x545ae5='E_AGI_UNDEFINED';}_0x380291[_0x3dbb('0xb')](error[_0x545ae5]);while(arguments[_0x48e970]){_0x380291[_0x3dbb('0xb')](arguments[_0x48e970]);_0x48e970++;}_0x440257=util[_0x3dbb('0xc')][_0x3dbb('0xd')](util,_0x380291);this['message']=_0x440257;this[_0x3dbb('0xe')]=_0x545ae5;}module[_0x3dbb('0xf')]=AGIError; \ No newline at end of file +var _0x8db0=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.'];(function(_0x40b20a,_0x394455){var _0xf147df=function(_0x109aa1){while(--_0x109aa1){_0x40b20a['push'](_0x40b20a['shift']());}};_0xf147df(++_0x394455);}(_0x8db0,0x65));var _0x08db=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x8db0[_0xf34109];return _0x570bfc;};'use strict';var util=require(_0x08db('0x0'));var error={'E_AGI_UNDEFINED':_0x08db('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x08db('0x2'),'E_AGI_SERVER_CLOSE':_0x08db('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x08db('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x08db('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x08db('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x14b0e6){var _0x14b0e6=_0x14b0e6||null,_0x41b4bf=_0x41b4bf||[],_0x1ca3d1=0x1,_0x16bcc0='';if(!error[_0x14b0e6]){_0x14b0e6=_0x08db('0x7');}_0x41b4bf[_0x08db('0x8')](error[_0x14b0e6]);while(arguments[_0x1ca3d1]){_0x41b4bf['push'](arguments[_0x1ca3d1]);_0x1ca3d1++;}_0x16bcc0=util['format'][_0x08db('0x9')](util,_0x41b4bf);this[_0x08db('0xa')]=_0x16bcc0;this[_0x08db('0xb')]=_0x14b0e6;}module[_0x08db('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 59c5fd4..b8ea81c 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 _0x02a7=['includes','exports','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found'];(function(_0x236f12,_0x4c7faf){var _0x32969a=function(_0x3a3e1d){while(--_0x3a3e1d){_0x236f12['push'](_0x236f12['shift']());}};_0x32969a(++_0x4c7faf);}(_0x02a7,0x1a6));var _0x702a=function(_0x7c241c,_0x2dc6f4){_0x7c241c=_0x7c241c-0x0;var _0x1f848f=_0x02a7[_0x7c241c];return _0x1f848f;};'use strict';var _=require('lodash');var logger=require(_0x702a('0x0'))(_0x702a('0x1'));var verticesWithRetry=[_0x702a('0x2'),_0x702a('0x3'),_0x702a('0x4')];var Graph=function(){this[_0x702a('0x5')]={};this[_0x702a('0x6')]={};this[_0x702a('0x7')]=0x0;};Graph[_0x702a('0x8')][_0x702a('0x9')]=function(_0x5a9a59){this['vertices'][_0x5a9a59['id']]=_0x5a9a59;this[_0x702a('0x6')][_0x5a9a59['id']]=[];};Graph['prototype'][_0x702a('0xa')]=function(_0x3f5ff8,_0x51bf52,_0x562fdb){this['edges'][_0x3f5ff8]['push']({'target':_0x51bf52,'condition':_0x562fdb});this[_0x702a('0x7')]+=0x1;};Graph[_0x702a('0x8')]['size']=function(){return _[_0x702a('0xb')](this[_0x702a('0x5')]);};Graph[_0x702a('0x8')][_0x702a('0xc')]=function(){return this[_0x702a('0x7')];};Graph[_0x702a('0x8')][_0x702a('0xd')]=function(_0x31fbed){return this['vertices'][_0x31fbed];};Graph[_0x702a('0x8')][_0x702a('0xe')]=function(_0x15adfe,_0x2250e9){if(!this['vertices'][_0x15adfe]){return logger[_0x702a('0xf')](_0x702a('0x10'));}var _0x384ae2=_0x2250e9(this[_0x702a('0x5')][_0x15adfe]);if(!_0x384ae2){return logger[_0x702a('0xf')]('stop\x20traverse');}if(this[_0x702a('0x6')][_0x15adfe][_0x702a('0x11')]===0x0){return logger[_0x702a('0xf')](_0x702a('0x12'));}for(var _0x434d28=0x0,_0x448b74=[],_0x451881=![];_0x434d28\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','sync','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc','context','extension','priority','response','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','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','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','connection','lodash','util','../../config/environment','agi','../../config/license/util','./graph','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','error','[%s]\x20%s','[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','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','getSquareProject','catch','createSquareReport','then','agi_','substring','inspect','debug','variables'];(function(_0x5bb149,_0x456cdc){var _0x1c85f5=function(_0x3c0645){while(--_0x3c0645){_0x5bb149['push'](_0x5bb149['shift']());}};_0x1c85f5(++_0x456cdc);}(_0xf2cb,0x130));var _0xbf2c=function(_0x8b8292,_0x37bcd5){_0x8b8292=_0x8b8292-0x0;var _0x4dedbf=_0xf2cb[_0x8b8292];return _0x4dedbf;};'use strict';var parser=require('xml2json');var _=require(_0xbf2c('0x0'));var syncho=require('syncho');var util=require(_0xbf2c('0x1'));var moment=require('moment');var config=require(_0xbf2c('0x2'));var logger=require('../../config/logger')(_0xbf2c('0x3'));var utilLicense=require(_0xbf2c('0x4'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xbf2c('0x5'));var Vertices=require(_0xbf2c('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xbf2c('0x3')]=_[_0xbf2c('0x7')](config['agi'],{'ip':_0xbf2c('0x8'),'port':0x11dd});function connectionHandler(_0x584a08){process[_0xbf2c('0x9')](function(){syncho(function(){try{setChannelVariables(_0x584a08);agiHandler(_0x584a08);}catch(_0x5e070d){logger['error'](_0x5e070d[_0xbf2c('0xa')]);}});});}function listeningHandler(){console[_0xbf2c('0xb')](_0xbf2c('0xc'),config['agi'][_0xbf2c('0xd')]);logger[_0xbf2c('0xe')](util[_0xbf2c('0xf')](_0xbf2c('0x10'),config[_0xbf2c('0x3')]['ip'],config[_0xbf2c('0x3')][_0xbf2c('0xd')]));}function errorHandler(_0x3a5268){if(_0x3a5268&&_0x3a5268['name']&&_0x3a5268[_0xbf2c('0x11')]){logger[_0xbf2c('0x12')](util[_0xbf2c('0xf')](_0xbf2c('0x13'),_0x3a5268['name'],_0x3a5268[_0xbf2c('0x11')]));}else{logger['error'](util['format'](_0xbf2c('0x14'),_0x3a5268['stack']));}}function closeHandler(){logger['info'](util[_0xbf2c('0xf')](_0xbf2c('0x15'),this[_0xbf2c('0x16')],this[_0xbf2c('0x17')],this[_0xbf2c('0x18')],this['dnid'],this[_0xbf2c('0x19')]));try{createSquareReport(this);}catch(_0x5514b0){logger[_0xbf2c('0x12')](_0x5514b0[_0xbf2c('0xa')]);}}function timeoutHandler(){logger[_0xbf2c('0xe')](util[_0xbf2c('0xf')](_0xbf2c('0x1a'),this['arg_1'],this[_0xbf2c('0x17')],this[_0xbf2c('0x18')],this[_0xbf2c('0x1b')],this[_0xbf2c('0x19')]));}function hangupHandler(){logger[_0xbf2c('0xe')](util[_0xbf2c('0xf')](_0xbf2c('0x1c'),this['arg_1'],this[_0xbf2c('0x17')],this[_0xbf2c('0x18')],this[_0xbf2c('0x1b')],this[_0xbf2c('0x19')]));this['evtHangup']=!![];}function getRoot(_0x2bc2ad){return parser[_0xbf2c('0x1d')](_0x2bc2ad,{'object':!![]})['mxGraphModel'][_0xbf2c('0x1e')];}function addVertex(_0x356f26,_0x3f1cdb,_0x52ecb4){_0x3f1cdb['agicommand']=_0x52ecb4;if(_0x3f1cdb[_0xbf2c('0x1f')](_0xbf2c('0x20'))){_0x3f1cdb[_0xbf2c('0x21')]=parseInt(_0x3f1cdb[_0xbf2c('0x20')],0xa);}_0x356f26[_0xbf2c('0x22')](_[_0xbf2c('0x23')](_0x3f1cdb,_0xbf2c('0x24')));}function initGraph(_0x4df358,_0x530102){var _0x169948=new Graph();for(var _0xcbd882 in _0x4df358){if(_0x4df358[_0xbf2c('0x1f')](_0xcbd882)){if(_[_0xbf2c('0x25')](_0x4df358[_0xcbd882])){for(var _0x3ed68d=0x0;_0x3ed68d<_0x4df358[_0xcbd882][_0xbf2c('0x26')];_0x3ed68d+=0x1){addVertex(_0x169948,_0x4df358[_0xcbd882][_0x3ed68d],_0xcbd882);}}else{addVertex(_0x169948,_0x4df358[_0xcbd882],_0xcbd882);}}}for(var _0x30ca=0x0;_0x30ca<_0x530102[_0xbf2c('0x26')];_0x30ca+=0x1){if(_0x530102[_0x30ca][_0xbf2c('0x27')]&&_0x530102[_0x30ca]['target']){_0x169948[_0xbf2c('0x28')](_0x530102[_0x30ca]['source'],_0x530102[_0x30ca][_0xbf2c('0x29')],_0x530102[_0x30ca][_0xbf2c('0x2a')]);}}return _0x169948;}function getSquareProject(_0x40e866,_0x17238f){rpc[_0xbf2c('0x2b')](_0x40e866)['then'](function(_0x1e946c){_0x17238f(null,_0x1e946c);})[_0xbf2c('0x2c')](function(_0x132365){_0x17238f(null,_0x132365);});}function createSquareReport(_0x13e238,_0x2cc8cb){rpc[_0xbf2c('0x2d')](_0x13e238)[_0xbf2c('0x2e')](function(_0x3462dd){if(_0x2cc8cb){_0x2cc8cb(null,_0x3462dd);}})['catch'](function(_0x37cf35){if(_0x2cc8cb){_0x2cc8cb(null,_0x37cf35);}});}function setChannelVariables(_0x3dfe0e){for(var _0x30f0c0 in _0x3dfe0e){if(_0x3dfe0e['hasOwnProperty'](_0x30f0c0)){if(_0x30f0c0['indexOf'](_0xbf2c('0x2f'))===0x0){_0x3dfe0e[_0x30f0c0[_0xbf2c('0x30')](0x4)]=_0x3dfe0e[_0x30f0c0];delete _0x3dfe0e[_0x30f0c0];}}}}function getLogFromObject(_0x25fcb3){return util[_0xbf2c('0x31')](_0x25fcb3,{'showHidden':![],'depth':null});}function agiHandler(_0x286634){var _0x45f743,_0x43272f,_0x255cbc,_0x3bd274,_0x5ef32a;logger[_0xbf2c('0x32')](_0xbf2c('0x33'),JSON[_0xbf2c('0x34')](_0x286634,null,0x2));logger[_0xbf2c('0xe')](util[_0xbf2c('0xf')](_0xbf2c('0x35'),_0x286634[_0xbf2c('0x16')],_0x286634[_0xbf2c('0x17')],_0x286634['callerid'],_0x286634[_0xbf2c('0x1b')],_0x286634[_0xbf2c('0x19')]));_0x286634['on'](_0xbf2c('0x12'),errorHandler);_0x286634['on']('close',closeHandler);_0x286634['on'](_0xbf2c('0x36'),timeoutHandler);_0x286634[_0xbf2c('0x37')]=![];_0x286634['on'](_0xbf2c('0x38'),hangupHandler);var _0x5402ff=getSquareProject[_0xbf2c('0x39')](null,_0x286634[_0xbf2c('0x16')]);if(_0x5402ff){if(_0x5402ff['production']){_0x45f743=getRoot(_0x5402ff['production']);if(_0x45f743&&_0x45f743['start']){logger['debug']('root',JSON[_0xbf2c('0x34')](_0x45f743,null,0x2));_0x286634[_0xbf2c('0x3a')]=moment()[_0xbf2c('0xf')](_0xbf2c('0x3b'));_0x43272f=initGraph(_[_0xbf2c('0x23')](_0x45f743,_0xbf2c('0x24')),_0x45f743[_0xbf2c('0x24')]);_0x255cbc=new Vertices(_0x286634,rpc,mailRpc);logger[_0xbf2c('0xe')](util[_0xbf2c('0xf')](_0xbf2c('0x3c'),_0x286634[_0xbf2c('0x16')],_0x286634[_0xbf2c('0x17')],_0x286634[_0xbf2c('0x18')],_0x286634[_0xbf2c('0x1b')],_0x286634[_0xbf2c('0x19')]));_0x43272f[_0xbf2c('0x3d')](_0x45f743['start']['id'],function(_0x294684){try{_0x294684=_0x255cbc[_0xbf2c('0x3e')](_0x294684);logger[_0xbf2c('0x32')](_0xbf2c('0x3f'),JSON[_0xbf2c('0x34')](_0x294684,null,0x2));if(_0x294684[_0xbf2c('0x40')]===_0xbf2c('0x41')){logger[_0xbf2c('0xe')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x286634[_0xbf2c('0x42')]=_0x294684[_0xbf2c('0x42')]||_0x286634[_0xbf2c('0x42')];_0x286634[_0xbf2c('0x43')]=_0x294684['extension'];_0x286634[_0xbf2c('0x44')]=_0x294684['priority']?_0x294684[_0xbf2c('0x44')]-0x1:0x1;return null;}else if(_0x294684&&_0x255cbc[_0x294684[_0xbf2c('0x40')]]){_0x5ef32a=_0x255cbc[_0x294684[_0xbf2c('0x40')]](_0x294684);logger[_0xbf2c('0xe')](_0xbf2c('0x45'),JSON[_0xbf2c('0x34')](_0x5ef32a,null,0x2));if(_0x5ef32a&&_0x5ef32a['code']===AGI_CODE_SUCCESS&&_0x5ef32a[_0xbf2c('0x46')]!==AGI_RESULT_ERROR&&!_0x286634['evtHangup']){logger['debug'](_0xbf2c('0x45'),getLogFromObject(_0x5ef32a));return _['isUndefined'](_0x5ef32a['result'])?null:_0x5ef32a[_0xbf2c('0x46')][_0xbf2c('0x47')]();}else{logger['error'](_0xbf2c('0x45'),getLogFromObject(_0x5ef32a));return null;}}else{logger['error'](_0xbf2c('0x48'));return null;}}catch(_0x4995e9){logger[_0xbf2c('0x12')](_0x4995e9[_0xbf2c('0xa')]);return null;}});if(_0x45f743[_0xbf2c('0x49')]){logger[_0xbf2c('0xe')](util[_0xbf2c('0xf')](_0xbf2c('0x4a'),_0x286634['arg_1'],_0x286634[_0xbf2c('0x17')],_0x286634[_0xbf2c('0x18')],_0x286634[_0xbf2c('0x1b')],_0x286634[_0xbf2c('0x19')]));_0x43272f[_0xbf2c('0x3d')](_0x45f743['finally']['id'],function(_0x586b2b){try{_0x586b2b=_0x255cbc[_0xbf2c('0x3e')](_0x586b2b);logger['debug'](_0xbf2c('0x3f'),JSON[_0xbf2c('0x34')](_0x586b2b,null,0x2));if(_0x586b2b&&_0x255cbc[_0x586b2b[_0xbf2c('0x40')]]){_0x5ef32a=_0x255cbc[_0x586b2b[_0xbf2c('0x40')]](_0x586b2b);if(_0x5ef32a){logger[_0xbf2c('0x32')](_0xbf2c('0x45'),getLogFromObject(_0x5ef32a));return _[_0xbf2c('0x4b')](_0x5ef32a[_0xbf2c('0x46')])?null:_0x5ef32a[_0xbf2c('0x46')][_0xbf2c('0x47')]();}else{logger[_0xbf2c('0x12')]('response',getLogFromObject(_0x5ef32a));return null;}}else{logger[_0xbf2c('0x12')](_0xbf2c('0x48'));return null;}}catch(_0x90276){logger[_0xbf2c('0x12')](_0x90276['stack']);return null;}});}logger['info'](util['format'](_0xbf2c('0x4c'),_0x286634[_0xbf2c('0x16')],_0x286634['calleridname'],_0x286634['callerid'],_0x286634['dnid'],_0x286634[_0xbf2c('0x19')]));logger[_0xbf2c('0xe')](util[_0xbf2c('0xf')](_0xbf2c('0x4d'),_0x286634[_0xbf2c('0x42')],_0x286634[_0xbf2c('0x43')],parseInt(_0x286634['priority'],0xa)+0x1));_0x286634[_0xbf2c('0x4e')](_0x286634[_0xbf2c('0x42')],_0x286634[_0xbf2c('0x43')],parseInt(_0x286634[_0xbf2c('0x44')],0xa)+0x1);_0x286634[_0xbf2c('0x4f')]();}}else{logger[_0xbf2c('0x12')](util[_0xbf2c('0xf')](_0xbf2c('0x50'),_0x286634['arg_1']));_0x286634['continueAt'](_0x286634['context'],_0x286634[_0xbf2c('0x43')],parseInt(_0x286634[_0xbf2c('0x44')],0xa)+0x1);_0x286634[_0xbf2c('0x4f')]();}}else{logger[_0xbf2c('0x12')](util['format'](_0xbf2c('0x51'),_0x286634[_0xbf2c('0x16')]));_0x286634['continueAt'](_0x286634[_0xbf2c('0x42')],_0x286634[_0xbf2c('0x43')],parseInt(_0x286634[_0xbf2c('0x44')],0xa)+0x1);_0x286634['close']();}}function main(){var _0x5ac538;return utilLicense['getLicense']()['then'](function(_0x39c10e){if(_0x39c10e){if(_0x39c10e[_0xbf2c('0x52')]){if(_0x39c10e[_0xbf2c('0x53')]&&_0x39c10e[_0xbf2c('0x53')]>0x0){logger[_0xbf2c('0xe')](util['format'](_0xbf2c('0x54'),_0x39c10e[_0xbf2c('0x53')]));_0x5ac538=_0x39c10e['callysquare'];}else{logger[_0xbf2c('0xe')](_0xbf2c('0x55'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x5ac538=-0x1;}}})['catch'](function(_0x363f77){logger['error']('[LICENSE]',_0x363f77[_0xbf2c('0xa')]);})[_0xbf2c('0x49')](function(){var _0x2b84c6=require(_0xbf2c('0x56'))(config['agi']['port'],config[_0xbf2c('0x3')]['ip'],_0x5ac538);_0x2b84c6['on'](_0xbf2c('0x12'),errorHandler);_0x2b84c6['on'](_0xbf2c('0x57'),listeningHandler);_0x2b84c6['on'](_0xbf2c('0x58'),connectionHandler);_0x2b84c6['on'](_0xbf2c('0x4f'),closeHandler);});}main(); \ No newline at end of file +var _0xed1f=['[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','close','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','arg_1','callerid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','target','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x2853d2,_0x2cf097){var _0x28e40d=function(_0xb1a4dd){while(--_0xb1a4dd){_0x2853d2['push'](_0x2853d2['shift']());}};_0x28e40d(++_0x2cf097);}(_0xed1f,0x6a));var _0xfed1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xed1f[_0x2c91e9];return _0x13f0ff;};'use strict';var parser=require(_0xfed1('0x0'));var _=require(_0xfed1('0x1'));var syncho=require(_0xfed1('0x2'));var util=require(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var config=require(_0xfed1('0x5'));var logger=require(_0xfed1('0x6'))(_0xfed1('0x7'));var utilLicense=require(_0xfed1('0x8'));var rpc=require(_0xfed1('0x9'));var mailRpc=require(_0xfed1('0xa'));var Graph=require(_0xfed1('0xb'));var Vertices=require(_0xfed1('0xc'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xfed1('0x7')]=_[_0xfed1('0xd')](config[_0xfed1('0x7')],{'ip':_0xfed1('0xe'),'port':0x11dd});function connectionHandler(_0x2967ef){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2967ef);agiHandler(_0x2967ef);}catch(_0x42dd5c){logger[_0xfed1('0xf')](_0x42dd5c['stack']);}});});}function listeningHandler(){console[_0xfed1('0x10')](_0xfed1('0x11'),config['agi'][_0xfed1('0x12')]);logger['info'](util[_0xfed1('0x13')](_0xfed1('0x14'),config['agi']['ip'],config['agi'][_0xfed1('0x12')]));}function errorHandler(_0xe84ba6){if(_0xe84ba6&&_0xe84ba6['name']&&_0xe84ba6[_0xfed1('0x15')]){logger['error'](util['format'](_0xfed1('0x16'),_0xe84ba6[_0xfed1('0x17')],_0xe84ba6['message']));}else{logger[_0xfed1('0xf')](util['format']('[ERROR]\x20%s',_0xe84ba6[_0xfed1('0x18')]));}}function closeHandler(){logger[_0xfed1('0x19')](util[_0xfed1('0x13')](_0xfed1('0x1a'),this['arg_1'],this[_0xfed1('0x1b')],this['callerid'],this[_0xfed1('0x1c')],this[_0xfed1('0x1d')]));try{createSquareReport(this);}catch(_0x489a0f){logger[_0xfed1('0xf')](_0x489a0f[_0xfed1('0x18')]);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfed1('0x1e')],this['calleridname'],this[_0xfed1('0x1f')],this[_0xfed1('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0xfed1('0x19')](util[_0xfed1('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfed1('0x1e')],this[_0xfed1('0x1b')],this[_0xfed1('0x1f')],this[_0xfed1('0x1c')],this['uniqueid']));this[_0xfed1('0x20')]=!![];}function getRoot(_0x59333e){return parser[_0xfed1('0x21')](_0x59333e,{'object':!![]})[_0xfed1('0x22')][_0xfed1('0x23')];}function addVertex(_0x532ec2,_0x41d22c,_0x594917){_0x41d22c[_0xfed1('0x24')]=_0x594917;if(_0x41d22c[_0xfed1('0x25')](_0xfed1('0x26'))){_0x41d22c[_0xfed1('0x27')]=parseInt(_0x41d22c[_0xfed1('0x26')],0xa);}_0x532ec2[_0xfed1('0x28')](_['omit'](_0x41d22c,_0xfed1('0x29')));}function initGraph(_0xcb1cdc,_0x49072b){var _0x1d6c72=new Graph();for(var _0x2b9dd2 in _0xcb1cdc){if(_0xcb1cdc[_0xfed1('0x25')](_0x2b9dd2)){if(_[_0xfed1('0x2a')](_0xcb1cdc[_0x2b9dd2])){for(var _0x3b9122=0x0;_0x3b9122<_0xcb1cdc[_0x2b9dd2][_0xfed1('0x2b')];_0x3b9122+=0x1){addVertex(_0x1d6c72,_0xcb1cdc[_0x2b9dd2][_0x3b9122],_0x2b9dd2);}}else{addVertex(_0x1d6c72,_0xcb1cdc[_0x2b9dd2],_0x2b9dd2);}}}for(var _0x583953=0x0;_0x583953<_0x49072b[_0xfed1('0x2b')];_0x583953+=0x1){if(_0x49072b[_0x583953]['source']&&_0x49072b[_0x583953][_0xfed1('0x2c')]){_0x1d6c72['addEdge'](_0x49072b[_0x583953]['source'],_0x49072b[_0x583953][_0xfed1('0x2c')],_0x49072b[_0x583953][_0xfed1('0x2d')]);}}return _0x1d6c72;}function getSquareProject(_0x2d334e,_0x599c23){rpc[_0xfed1('0x2e')](_0x2d334e)[_0xfed1('0x2f')](function(_0x13f414){_0x599c23(null,_0x13f414);})[_0xfed1('0x30')](function(_0x12399f){_0x599c23(null,_0x12399f);});}function createSquareReport(_0x30272b,_0x5ccc3a){rpc[_0xfed1('0x31')](_0x30272b)[_0xfed1('0x2f')](function(_0x4fc309){if(_0x5ccc3a){_0x5ccc3a(null,_0x4fc309);}})['catch'](function(_0x28bd98){if(_0x5ccc3a){_0x5ccc3a(null,_0x28bd98);}});}function setChannelVariables(_0x2d10f5){for(var _0x2def09 in _0x2d10f5){if(_0x2d10f5[_0xfed1('0x25')](_0x2def09)){if(_0x2def09[_0xfed1('0x32')]('agi_')===0x0){_0x2d10f5[_0x2def09[_0xfed1('0x33')](0x4)]=_0x2d10f5[_0x2def09];delete _0x2d10f5[_0x2def09];}}}}function getLogFromObject(_0x21b292){return util[_0xfed1('0x34')](_0x21b292,{'showHidden':![],'depth':null});}function agiHandler(_0x349de1){var _0xa4c53c,_0x4fde94,_0x1da4b7,_0x4a81be,_0x11c5bd;logger[_0xfed1('0x35')](_0xfed1('0x36'),JSON[_0xfed1('0x37')](_0x349de1,null,0x2));logger[_0xfed1('0x19')](util[_0xfed1('0x13')](_0xfed1('0x38'),_0x349de1[_0xfed1('0x1e')],_0x349de1['calleridname'],_0x349de1[_0xfed1('0x1f')],_0x349de1[_0xfed1('0x1c')],_0x349de1[_0xfed1('0x1d')]));_0x349de1['on'](_0xfed1('0xf'),errorHandler);_0x349de1['on']('close',closeHandler);_0x349de1['on']('timeout',timeoutHandler);_0x349de1[_0xfed1('0x20')]=![];_0x349de1['on'](_0xfed1('0x39'),hangupHandler);var _0x1d06af=getSquareProject[_0xfed1('0x3a')](null,_0x349de1[_0xfed1('0x1e')]);if(_0x1d06af){if(_0x1d06af[_0xfed1('0x3b')]){_0xa4c53c=getRoot(_0x1d06af[_0xfed1('0x3b')]);if(_0xa4c53c&&_0xa4c53c[_0xfed1('0x3c')]){logger['debug']('root',JSON[_0xfed1('0x37')](_0xa4c53c,null,0x2));_0x349de1[_0xfed1('0x3d')]=moment()['format'](_0xfed1('0x3e'));_0x4fde94=initGraph(_[_0xfed1('0x3f')](_0xa4c53c,_0xfed1('0x29')),_0xa4c53c[_0xfed1('0x29')]);_0x1da4b7=new Vertices(_0x349de1,rpc,mailRpc);logger[_0xfed1('0x19')](util[_0xfed1('0x13')](_0xfed1('0x40'),_0x349de1[_0xfed1('0x1e')],_0x349de1[_0xfed1('0x1b')],_0x349de1['callerid'],_0x349de1['dnid'],_0x349de1['uniqueid']));_0x4fde94[_0xfed1('0x41')](_0xa4c53c[_0xfed1('0x3c')]['id'],function(_0x2f8f08){try{_0x2f8f08=_0x1da4b7['clear'](_0x2f8f08);logger[_0xfed1('0x35')]('vertex',JSON[_0xfed1('0x37')](_0x2f8f08,null,0x2));if(_0x2f8f08[_0xfed1('0x24')]===_0xfed1('0x42')){logger['info'](_0xfed1('0x43'));_0x349de1[_0xfed1('0x44')]=_0x2f8f08[_0xfed1('0x44')]||_0x349de1['context'];_0x349de1[_0xfed1('0x45')]=_0x2f8f08['extension'];_0x349de1[_0xfed1('0x46')]=_0x2f8f08[_0xfed1('0x46')]?_0x2f8f08[_0xfed1('0x46')]-0x1:0x1;return null;}else if(_0x2f8f08&&_0x1da4b7[_0x2f8f08[_0xfed1('0x24')]]){_0x11c5bd=_0x1da4b7[_0x2f8f08[_0xfed1('0x24')]](_0x2f8f08);logger[_0xfed1('0x19')](_0xfed1('0x47'),JSON[_0xfed1('0x37')](_0x11c5bd,null,0x2));if(_0x11c5bd&&_0x11c5bd[_0xfed1('0x48')]===AGI_CODE_SUCCESS&&_0x11c5bd['result']!==AGI_RESULT_ERROR&&!_0x349de1[_0xfed1('0x20')]){logger[_0xfed1('0x35')](_0xfed1('0x47'),getLogFromObject(_0x11c5bd));return _['isUndefined'](_0x11c5bd['result'])?null:_0x11c5bd[_0xfed1('0x49')][_0xfed1('0x4a')]();}else{logger[_0xfed1('0xf')](_0xfed1('0x47'),getLogFromObject(_0x11c5bd));return null;}}else{logger[_0xfed1('0xf')](_0xfed1('0x4b'));return null;}}catch(_0x2547ee){logger[_0xfed1('0xf')](_0x2547ee[_0xfed1('0x18')]);return null;}});if(_0xa4c53c[_0xfed1('0x4c')]){logger[_0xfed1('0x19')](util[_0xfed1('0x13')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x349de1[_0xfed1('0x1e')],_0x349de1[_0xfed1('0x1b')],_0x349de1[_0xfed1('0x1f')],_0x349de1[_0xfed1('0x1c')],_0x349de1[_0xfed1('0x1d')]));_0x4fde94[_0xfed1('0x41')](_0xa4c53c['finally']['id'],function(_0x1dd879){try{_0x1dd879=_0x1da4b7[_0xfed1('0x4d')](_0x1dd879);logger[_0xfed1('0x35')]('vertex',JSON[_0xfed1('0x37')](_0x1dd879,null,0x2));if(_0x1dd879&&_0x1da4b7[_0x1dd879[_0xfed1('0x24')]]){_0x11c5bd=_0x1da4b7[_0x1dd879[_0xfed1('0x24')]](_0x1dd879);if(_0x11c5bd){logger[_0xfed1('0x35')]('response',getLogFromObject(_0x11c5bd));return _[_0xfed1('0x4e')](_0x11c5bd[_0xfed1('0x49')])?null:_0x11c5bd[_0xfed1('0x49')][_0xfed1('0x4a')]();}else{logger[_0xfed1('0xf')](_0xfed1('0x47'),getLogFromObject(_0x11c5bd));return null;}}else{logger[_0xfed1('0xf')](_0xfed1('0x4b'));return null;}}catch(_0x2365db){logger[_0xfed1('0xf')](_0x2365db[_0xfed1('0x18')]);return null;}});}logger[_0xfed1('0x19')](util[_0xfed1('0x13')](_0xfed1('0x4f'),_0x349de1[_0xfed1('0x1e')],_0x349de1[_0xfed1('0x1b')],_0x349de1[_0xfed1('0x1f')],_0x349de1[_0xfed1('0x1c')],_0x349de1['uniqueid']));logger['info'](util[_0xfed1('0x13')](_0xfed1('0x50'),_0x349de1[_0xfed1('0x44')],_0x349de1[_0xfed1('0x45')],parseInt(_0x349de1['priority'],0xa)+0x1));_0x349de1[_0xfed1('0x51')](_0x349de1[_0xfed1('0x44')],_0x349de1['extension'],parseInt(_0x349de1['priority'],0xa)+0x1);_0x349de1['close']();}}else{logger[_0xfed1('0xf')](util[_0xfed1('0x13')](_0xfed1('0x52'),_0x349de1[_0xfed1('0x1e')]));_0x349de1[_0xfed1('0x51')](_0x349de1[_0xfed1('0x44')],_0x349de1[_0xfed1('0x45')],parseInt(_0x349de1[_0xfed1('0x46')],0xa)+0x1);_0x349de1[_0xfed1('0x53')]();}}else{logger[_0xfed1('0xf')](util['format']('Project\x20%s\x20not\x20found',_0x349de1[_0xfed1('0x1e')]));_0x349de1[_0xfed1('0x51')](_0x349de1[_0xfed1('0x44')],_0x349de1[_0xfed1('0x45')],parseInt(_0x349de1[_0xfed1('0x46')],0xa)+0x1);_0x349de1[_0xfed1('0x53')]();}}function main(){var _0x122702;return utilLicense[_0xfed1('0x54')]()[_0xfed1('0x2f')](function(_0x427fa6){if(_0x427fa6){if(_0x427fa6[_0xfed1('0x55')]){if(_0x427fa6[_0xfed1('0x56')]&&_0x427fa6[_0xfed1('0x56')]>0x0){logger[_0xfed1('0x19')](util[_0xfed1('0x13')](_0xfed1('0x57'),_0x427fa6[_0xfed1('0x56')]));_0x122702=_0x427fa6['callysquare'];}else{logger['info'](_0xfed1('0x58'));}}else{logger[_0xfed1('0x19')](_0xfed1('0x59'));_0x122702=-0x1;}}})[_0xfed1('0x30')](function(_0x23a4f0){logger[_0xfed1('0xf')](_0xfed1('0x5a'),_0x23a4f0[_0xfed1('0x18')]);})[_0xfed1('0x4c')](function(){var _0x1f2250=require(_0xfed1('0x5b'))(config[_0xfed1('0x7')][_0xfed1('0x12')],config[_0xfed1('0x7')]['ip'],_0x122702);_0x1f2250['on']('error',errorHandler);_0x1f2250['on'](_0xfed1('0x5c'),listeningHandler);_0x1f2250['on']('connection',connectionHandler);_0x1f2250['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index bc61541..82366e9 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(_0x246e6e,_0x5928a8){var _0x1e74c3=function(_0x5bf70d){while(--_0x5bf70d){_0x246e6e['push'](_0x246e6e['shift']());}};_0x1e74c3(++_0x5928a8);}(_0x814b,0x1a2));var _0xb814=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x814b[_0x3718b7];return _0xf8c91e;};'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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x59f118,_0x57466f){var _0x17d09d=function(_0x2fca97){while(--_0x2fca97){_0x59f118['push'](_0x59f118['shift']());}};_0x17d09d(++_0x57466f);}(_0x34e8,0x12c));var _0x834e=function(_0xff7155,_0x336cfd){_0xff7155=_0xff7155-0x0;var _0x355859=_0x34e8[_0xff7155];return _0x355859;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 4581726..19fec86 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x4bab2c,_0x161460){var _0x3ddbcf=function(_0x1bf8ae){while(--_0x1bf8ae){_0x4bab2c['push'](_0x4bab2c['shift']());}};_0x3ddbcf(++_0x161460);}(_0x7a54,0x106));var _0x47a5=function(_0xe0878b,_0x38613d){_0xe0878b=_0xe0878b-0x0;var _0x10f990=_0x7a54[_0xe0878b];return _0x10f990;};'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 +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(_0x24507a,_0x58e59b){var _0x20ed6a=function(_0x3ed6e8){while(--_0x3ed6e8){_0x24507a['push'](_0x24507a['shift']());}};_0x20ed6a(++_0x58e59b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x42baf8,_0x402a8c){_0x42baf8=_0x42baf8-0x0;var _0x42f10b=_0x5f2f[_0x42baf8];return _0x42f10b;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index ffda87f..672f1d4 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 _0x3d3e=['ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','ShowCmHopper','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','error','message','getSquareProject','ShowSquareProject','production','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getSoundById','ShowSound'];(function(_0x16a9ee,_0x9bf4e3){var _0x306ad3=function(_0x5e7c51){while(--_0x5e7c51){_0x16a9ee['push'](_0x16a9ee['shift']());}};_0x306ad3(++_0x9bf4e3);}(_0x3d3e,0x89));var _0xe3d3=function(_0x2a66b0,_0x25def3){_0x2a66b0=_0x2a66b0-0x0;var _0xbcc1dd=_0x3d3e[_0x2a66b0];return _0xbcc1dd;};'use strict';var BPromise=require(_0xe3d3('0x0'));var moment=require(_0xe3d3('0x1'));var _=require(_0xe3d3('0x2'));var util=require(_0xe3d3('0x3'));var jayson=require(_0xe3d3('0x4'));var client=jayson[_0xe3d3('0x5')][_0xe3d3('0x6')]({'port':0x2329});function request(_0x5afd3b,_0x2bae34){return new BPromise(function(_0x3059c1,_0x21912a){return client[_0xe3d3('0x7')](_0x5afd3b,_0x2bae34)['then'](function(_0x1d36b6){if(_0x1d36b6[_0xe3d3('0x8')]){return _0x21912a(_0x1d36b6[_0xe3d3('0x8')][_0xe3d3('0x9')]);}else{return _0x3059c1(_0x1d36b6['result']);}})['catch'](function(_0x3d4b83){return _0x21912a(_0x3d4b83);});});}exports[_0xe3d3('0xa')]=function(_0x2b5806){return request(_0xe3d3('0xb'),{'options':{'raw':![],'where':{'name':_0x2b5806},'attributes':[_0xe3d3('0xc')]}});};exports['getMailAccountById']=function(_0x38c97d){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x38c97d},'include':[{'model':_0xe3d3('0xd'),'as':_0xe3d3('0xe')}],'attributes':['id',_0xe3d3('0xf'),_0xe3d3('0x10')]}});};exports[_0xe3d3('0x11')]=function(_0x3ccd84){return request(_0xe3d3('0xb'),{'options':{'where':{'id':_0x3ccd84},'attributes':[_0xe3d3('0xf')]}});};exports[_0xe3d3('0x12')]=function(_0x55eca1){return request(_0xe3d3('0x13'),{'options':{'where':{'id':_0x55eca1},'attributes':[_0xe3d3('0xf')]}});};exports[_0xe3d3('0x14')]=function(_0x52dda5){return request(_0xe3d3('0x15'),{'options':{'where':{'id':_0x52dda5},'attributes':[_0xe3d3('0xf')]}});};exports[_0xe3d3('0x16')]=function(_0x276671){return request(_0xe3d3('0x17'),{'options':{'where':{'id':_0x276671},'attributes':[_0xe3d3('0x18')]}});};exports[_0xe3d3('0x19')]=function(_0x2c82f7){return request('ShowUser',{'options':{'where':{'id':_0x2c82f7},'attributes':[_0xe3d3('0xf')]}});};exports['getTrunkById']=function(_0x181559){return request('ShowTrunk',{'options':{'where':{'id':_0x181559},'attributes':['name']}});};exports[_0xe3d3('0x1a')]=function(_0x30a41c){return request(_0xe3d3('0x1b'),{'options':{'where':{'id':_0x30a41c},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x51c23f){return request(_0xe3d3('0x1c'),{'options':{'raw':![],'where':{'id':_0x51c23f},'include':[{'model':_0xe3d3('0x1d'),'as':_0xe3d3('0x1e')}]}});};exports[_0xe3d3('0x1f')]=function(_0x31e0d2){return request(_0xe3d3('0x20'),{'options':{'where':{'id':_0x31e0d2},'attributes':['id',_0xe3d3('0xf')]}});};exports[_0xe3d3('0x21')]=function(_0x3329c9){return request(_0xe3d3('0x22'),{'body':_0x3329c9});};exports[_0xe3d3('0x23')]=function(_0x287310){return request('CreateSquareDetailsReport',{'body':_0x287310});};exports['createSquareReport']=function(_0x24f02d){return request(_0xe3d3('0x24'),{'body':_[_0xe3d3('0x25')](_0x24f02d,{'project_name':_0x24f02d['arg_1'],'prev_project_name':_0x24f02d[_0xe3d3('0x26')]||'','is_subproject':_0x24f02d[_0xe3d3('0x26')]?!![]:![],'leaveAt':moment()[_0xe3d3('0x27')](_0xe3d3('0x28'))})});};exports[_0xe3d3('0x29')]=function(_0x30f623){return request('CreateSquareRecording',{'body':_0x30f623});};exports[_0xe3d3('0x2a')]=function(_0x3b360d){return request('CreateSquareMessage',{'body':_0x3b360d});};exports['createCmContact']=function(_0x108918){return request(_0xe3d3('0x2b'),{'options':{'raw':![],'where':{'phone':_0x108918['phone'],'ListId':_0x108918['ListId']}}})[_0xe3d3('0x2c')](function(_0x4db670){if(_0x4db670){return _0x4db670;}return request(_0xe3d3('0x2d'),{'body':_0x108918});});};exports[_0xe3d3('0x2e')]=function(_0x4d2bc2){return request(_0xe3d3('0x2f'),{'options':{'where':{'id':_0x4d2bc2},'attributes':[_0xe3d3('0xf')]}});};exports[_0xe3d3('0x30')]=function(_0x330811,_0x1e0bce){return request(_0xe3d3('0x31'),{'body':{'interface':_0x1e0bce},'options':{'where':_0x330811}});};exports[_0xe3d3('0x32')]=function(_0x21474a,_0x1675ae,_0x4e0497){return request(_0xe3d3('0x33'),{'body':{'type':_0x1675ae,'uniqueid':_0x4e0497},'options':{'where':_0x21474a}});};exports[_0xe3d3('0x34')]=function(_0x36e272){return request(_0xe3d3('0x35'),{'body':{},'options':{'where':_0x36e272}});};exports['agentLogout']=function(_0x44c7e0){return request(_0xe3d3('0x36'),{'body':{},'options':{'where':_0x44c7e0}});}; \ No newline at end of file +var _0xd12a=['UnpauseUser','agentLogout','LogoutUser','moment','util','http','request','error','message','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','then','CreateCmContact','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause'];(function(_0x1bf2a0,_0x18e849){var _0x35c771=function(_0x15dbe1){while(--_0x15dbe1){_0x1bf2a0['push'](_0x1bf2a0['shift']());}};_0x35c771(++_0x18e849);}(_0xd12a,0x1f2));var _0xad12=function(_0x56bf94,_0x16e5f0){_0x56bf94=_0x56bf94-0x0;var _0x369780=_0xd12a[_0x56bf94];return _0x369780;};'use strict';var BPromise=require('bluebird');var moment=require(_0xad12('0x0'));var _=require('lodash');var util=require(_0xad12('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0xad12('0x2')]({'port':0x2329});function request(_0x51a260,_0x4ef429){return new BPromise(function(_0x1df5b4,_0x187d20){return client[_0xad12('0x3')](_0x51a260,_0x4ef429)['then'](function(_0x35484){if(_0x35484[_0xad12('0x4')]){return _0x187d20(_0x35484[_0xad12('0x4')][_0xad12('0x5')]);}else{return _0x1df5b4(_0x35484['result']);}})[_0xad12('0x6')](function(_0x1bf636){return _0x187d20(_0x1bf636);});});}exports['getSquareProject']=function(_0xb9e6b5){return request(_0xad12('0x7'),{'options':{'raw':![],'where':{'name':_0xb9e6b5},'attributes':[_0xad12('0x8')]}});};exports[_0xad12('0x9')]=function(_0x523873){return request(_0xad12('0xa'),{'options':{'raw':![],'where':{'id':_0x523873},'include':[{'model':_0xad12('0xb'),'as':_0xad12('0xc')}],'attributes':['id',_0xad12('0xd'),_0xad12('0xe')]}});};exports[_0xad12('0xf')]=function(_0x4054f8){return request(_0xad12('0x7'),{'options':{'where':{'id':_0x4054f8},'attributes':[_0xad12('0xd')]}});};exports[_0xad12('0x10')]=function(_0x4e6c8c){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4e6c8c},'attributes':[_0xad12('0xd')]}});};exports[_0xad12('0x11')]=function(_0x45a546){return request(_0xad12('0x12'),{'options':{'where':{'id':_0x45a546},'attributes':[_0xad12('0xd')]}});};exports[_0xad12('0x13')]=function(_0x5b5176){return request(_0xad12('0x14'),{'options':{'where':{'id':_0x5b5176},'attributes':[_0xad12('0x15')]}});};exports['getUserById']=function(_0x40889b){return request(_0xad12('0x16'),{'options':{'where':{'id':_0x40889b},'attributes':[_0xad12('0xd')]}});};exports[_0xad12('0x17')]=function(_0x374048){return request(_0xad12('0x18'),{'options':{'where':{'id':_0x374048},'attributes':[_0xad12('0xd')]}});};exports[_0xad12('0x19')]=function(_0x3b4561){return request(_0xad12('0x1a'),{'options':{'where':{'id':_0x3b4561},'attributes':['save_name']}});};exports[_0xad12('0x1b')]=function(_0x6f438f){return request(_0xad12('0x1c'),{'options':{'raw':![],'where':{'id':_0x6f438f},'include':[{'model':_0xad12('0x1d'),'as':'Intervals'}]}});};exports[_0xad12('0x1e')]=function(_0x5254b5){return request(_0xad12('0x1f'),{'options':{'where':{'id':_0x5254b5},'attributes':['id',_0xad12('0xd')]}});};exports['createSmsMessage']=function(_0x15710a){return request(_0xad12('0x20'),{'body':_0x15710a});};exports['createSquareDetailsReport']=function(_0x4147db){return request(_0xad12('0x21'),{'body':_0x4147db});};exports[_0xad12('0x22')]=function(_0x170860){return request(_0xad12('0x23'),{'body':_[_0xad12('0x24')](_0x170860,{'project_name':_0x170860[_0xad12('0x25')],'prev_project_name':_0x170860['arg_2']||'','is_subproject':_0x170860[_0xad12('0x26')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xad12('0x27')]=function(_0x4423cb){return request('CreateSquareRecording',{'body':_0x4423cb});};exports[_0xad12('0x28')]=function(_0x74477d){return request(_0xad12('0x29'),{'body':_0x74477d});};exports['createCmContact']=function(_0x11b4bf){return request(_0xad12('0x2a'),{'options':{'raw':![],'where':{'phone':_0x11b4bf[_0xad12('0x2b')],'ListId':_0x11b4bf[_0xad12('0x2c')]}}})[_0xad12('0x2d')](function(_0x57ca44){if(_0x57ca44){return _0x57ca44;}return request(_0xad12('0x2e'),{'body':_0x11b4bf});});};exports['getPauseById']=function(_0x4e5b66){return request(_0xad12('0x2f'),{'options':{'where':{'id':_0x4e5b66},'attributes':['name']}});};exports[_0xad12('0x30')]=function(_0x6d747b,_0x5bc209){return request('LoginUser',{'body':{'interface':_0x5bc209},'options':{'where':_0x6d747b}});};exports[_0xad12('0x31')]=function(_0x204e98,_0x39604a,_0x164d7d){return request(_0xad12('0x32'),{'body':{'type':_0x39604a,'uniqueid':_0x164d7d},'options':{'where':_0x204e98}});};exports[_0xad12('0x33')]=function(_0x2ba8d6){return request(_0xad12('0x34'),{'body':{},'options':{'where':_0x2ba8d6}});};exports[_0xad12('0x35')]=function(_0x4b913b){return request(_0xad12('0x36'),{'body':{},'options':{'where':_0x4b913b}});}; \ 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 637bb0e..45dd976 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 _0x1cc7=['exports','./polly','./lex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cc7,0x15a));var _0x71cc=function(_0x5a6496,_0xf2a797){_0x5a6496=_0x5a6496-0x0;var _0x326597=_0x1cc7[_0x5a6496];return _0x326597;};var polly=require(_0x71cc('0x0'));var lex=require(_0x71cc('0x1'));module[_0x71cc('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5c12=['./lex','exports'];(function(_0x43b382,_0x7dfe77){var _0x4255e7=function(_0x24893e){while(--_0x24893e){_0x43b382['push'](_0x43b382['shift']());}};_0x4255e7(++_0x7dfe77);}(_0x5c12,0x188));var _0x25c1=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0x5c12[_0x510b98];return _0x45e775;};var polly=require('./polly');var lex=require(_0x25c1('0x0'));module[_0x25c1('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 62f69b8..fef6a87 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 _0xd404=['exports','./lib/api'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xd404,0x15b));var _0x4d40=function(_0x503374,_0x388275){_0x503374=_0x503374-0x0;var _0x325f26=_0xd404[_0x503374];return _0x325f26;};'use strict';var lex=require(_0x4d40('0x0'));module[_0x4d40('0x1')]=function(_0x5b9c2b,_0xb6576c,_0x2322e5,_0x502a67,_0x3e9bbc,_0x610dbf){return lex(_0x5b9c2b,_0xb6576c,_0x2322e5,_0x502a67,_0x3e9bbc,_0x610dbf);}; \ No newline at end of file +var _0xd691=['./lib/api','exports'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0xd691,0xe6));var _0x1d69=function(_0x18b0a1,_0x535aac){_0x18b0a1=_0x18b0a1-0x0;var _0x55005a=_0xd691[_0x18b0a1];return _0x55005a;};'use strict';var lex=require(_0x1d69('0x0'));module[_0x1d69('0x1')]=function(_0x4738f2,_0x5ea40d,_0x468419,_0x44899f,_0x32502d,_0x3dc1c9){return lex(_0x4738f2,_0x5ea40d,_0x468419,_0x44899f,_0x32502d,_0x3dc1c9);}; \ 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 c943535..320d593 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 _0xc1fe=['slot_','exports','LexRuntime','bluebird','aws-sdk','postText','slots','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1fe,0x113));var _0xec1f=function(_0x51396e,_0x47ad19){_0x51396e=_0x51396e-0x0;var _0x6bca61=_0xc1fe[_0x51396e];return _0x6bca61;};'use strict';var BPromise=require(_0xec1f('0x0'));var AWS=require(_0xec1f('0x1'));function lexResult(_0x19ff77,_0x2d6f33){return new BPromise(function(_0x5b8024,_0x4345d6){_0x19ff77[_0xec1f('0x2')](_0x2d6f33,function(_0x26a228,_0x5c615c){if(_0x26a228){_0x4345d6(_0x26a228);}if(_0x5c615c[_0xec1f('0x3')]){for(const _0x2bbea6 in _0x5c615c[_0xec1f('0x3')]){if(_0x5c615c[_0xec1f('0x3')][_0xec1f('0x4')](_0x2bbea6)){var _0x55b285=_0x5c615c[_0xec1f('0x3')][_0x2bbea6];_0x5c615c[_0xec1f('0x5')+_0x2bbea6]=_0x55b285;}}}_0x5b8024(_0x5c615c);});});}module[_0xec1f('0x6')]=function(_0x4eac5e,_0x656bcc,_0x5f5c1d,_0x3f9423,_0x582622,_0x6befca){var _0x4e8267=new AWS[(_0xec1f('0x7'))]({'accessKeyId':_0x656bcc,'secretAccessKey':_0x5f5c1d,'region':_0x3f9423});var _0x501438={'botAlias':'$LATEST','botName':_0x6befca,'inputText':_0x582622,'userId':_0x4eac5e};return lexResult(_0x4e8267,_0x501438);}; \ No newline at end of file +var _0xdd66=['slot_','exports','LexRuntime','$LATEST','aws-sdk','postText','slots'];(function(_0x2d6375,_0x149216){var _0x29186f=function(_0x31fc6f){while(--_0x31fc6f){_0x2d6375['push'](_0x2d6375['shift']());}};_0x29186f(++_0x149216);}(_0xdd66,0xd6));var _0x6dd6=function(_0x366a24,_0x2a7abe){_0x366a24=_0x366a24-0x0;var _0x7783b2=_0xdd66[_0x366a24];return _0x7783b2;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x6dd6('0x0'));function lexResult(_0x2b538e,_0x34be75){return new BPromise(function(_0x4f75a9,_0x323ed4){_0x2b538e[_0x6dd6('0x1')](_0x34be75,function(_0x5762da,_0x4435aa){if(_0x5762da){_0x323ed4(_0x5762da);}if(_0x4435aa[_0x6dd6('0x2')]){for(const _0x1f6c0d in _0x4435aa[_0x6dd6('0x2')]){if(_0x4435aa['slots']['hasOwnProperty'](_0x1f6c0d)){var _0x4eb7db=_0x4435aa[_0x6dd6('0x2')][_0x1f6c0d];_0x4435aa[_0x6dd6('0x3')+_0x1f6c0d]=_0x4eb7db;}}}_0x4f75a9(_0x4435aa);});});}module[_0x6dd6('0x4')]=function(_0x3fdc69,_0x1debc6,_0xecaa79,_0x17a2d0,_0xd44831,_0x3b0cc8){var _0x557e69=new AWS[(_0x6dd6('0x5'))]({'accessKeyId':_0x1debc6,'secretAccessKey':_0xecaa79,'region':_0x17a2d0});var _0x5ba86a={'botAlias':_0x6dd6('0x6'),'botName':_0x3b0cc8,'inputText':_0xd44831,'userId':_0x3fdc69};return lexResult(_0x557e69,_0x5ba86a);}; \ 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 1a629ff..e86ec64 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 _0x4675=['exports','./lib/api'];(function(_0x1310d0,_0xa2ef4f){var _0x1355f1=function(_0x45f693){while(--_0x45f693){_0x1310d0['push'](_0x1310d0['shift']());}};_0x1355f1(++_0xa2ef4f);}(_0x4675,0xed));var _0x5467=function(_0x2e926e,_0x57f426){_0x2e926e=_0x2e926e-0x0;var _0x7ff506=_0x4675[_0x2e926e];return _0x7ff506;};'use strict';var polly=require(_0x5467('0x0'));module[_0x5467('0x1')]=function(_0x2a24d6,_0x3cea42,_0x5f4398,_0x35f3b4,_0x19023c,_0x4ba99e,_0x357314){return polly(_0x2a24d6,_0x3cea42,_0x5f4398,_0x35f3b4,_0x19023c,_0x4ba99e,_0x357314);}; \ No newline at end of file +var _0x613d=['./lib/api'];(function(_0x1d32bc,_0xa5811d){var _0xe5523=function(_0x384748){while(--_0x384748){_0x1d32bc['push'](_0x1d32bc['shift']());}};_0xe5523(++_0xa5811d);}(_0x613d,0x1c5));var _0xd613=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0x613d[_0xf973b7];return _0x499087;};'use strict';var polly=require(_0xd613('0x0'));module['exports']=function(_0x586981,_0x1ed77e,_0xe1cbe,_0x3d051e,_0xc22b37,_0x2fc1c7,_0x7dc8b){return polly(_0x586981,_0x1ed77e,_0xe1cbe,_0x3d051e,_0xc22b37,_0x2fc1c7,_0x7dc8b);}; \ 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 40f5966..0b76751 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 _0x6d0e=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','bluebird','randomstring','aws-sdk'];(function(_0xf503ac,_0x3779e1){var _0x54becd=function(_0x1f1ef3){while(--_0x1f1ef3){_0xf503ac['push'](_0xf503ac['shift']());}};_0x54becd(++_0x3779e1);}(_0x6d0e,0xe7));var _0xe6d0=function(_0x5b3279,_0xbb2f2c){_0x5b3279=_0x5b3279-0x0;var _0x16e4fd=_0x6d0e[_0x5b3279];return _0x16e4fd;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xe6d0('0x0'));var rs=require(_0xe6d0('0x1'));var AWS=require(_0xe6d0('0x2'));function pollyResult(_0x5b5aff,_0x30a092,_0x2eb237){return new BPromise(function(_0x3e5e67,_0x6fcee9){_0x5b5aff[_0xe6d0('0x3')](_0x30a092,function(_0x5db43b,_0x27d466){if(_0x5db43b){_0x6fcee9(_0x5db43b);}else if(_0x27d466){if(_0x27d466[_0xe6d0('0x4')]instanceof Buffer){fs[_0xe6d0('0x5')](_0x2eb237,_0x27d466[_0xe6d0('0x4')],function(_0x292eab){if(_0x292eab){_0x6fcee9(_0x292eab);}else{_0x3e5e67();}});}else{_0x6fcee9(new Error(_0xe6d0('0x6')));}}else{_0x6fcee9(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x8416a8,_0x890281,_0x579ee2,_0x50a55d,_0x6af93d,_0x164d1f,_0x564fc1){var _0x51f70c=new AWS[(_0xe6d0('0x7'))]({'accessKeyId':_0x8416a8,'secretAccessKey':_0x890281,'region':_0x579ee2});var _0x254c3c={'Text':_0x6af93d,'TextType':_0x164d1f||'text','OutputFormat':_0xe6d0('0x8'),'VoiceId':_0x50a55d};return pollyResult(_0x51f70c,_0x254c3c,_0x564fc1);}; \ No newline at end of file +var _0x37fd=['bluebird','randomstring','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path'];(function(_0x27ab2f,_0x5f3a93){var _0x351192=function(_0x3e41f7){while(--_0x3e41f7){_0x27ab2f['push'](_0x27ab2f['shift']());}};_0x351192(++_0x5f3a93);}(_0x37fd,0xd7));var _0xd37f=function(_0x300a26,_0x1ad864){_0x300a26=_0x300a26-0x0;var _0x43bccd=_0x37fd[_0x300a26];return _0x43bccd;};'use strict';var fs=require('fs');var path=require(_0xd37f('0x0'));var BPromise=require(_0xd37f('0x1'));var rs=require(_0xd37f('0x2'));var AWS=require(_0xd37f('0x3'));function pollyResult(_0xce55a6,_0x1c93ae,_0x348473){return new BPromise(function(_0x2f3aaa,_0x31f340){_0xce55a6['synthesizeSpeech'](_0x1c93ae,function(_0x49f64c,_0x536f34){if(_0x49f64c){_0x31f340(_0x49f64c);}else if(_0x536f34){if(_0x536f34['AudioStream']instanceof Buffer){fs['writeFile'](_0x348473,_0x536f34[_0xd37f('0x4')],function(_0x9ccb65){if(_0x9ccb65){_0x31f340(_0x9ccb65);}else{_0x2f3aaa();}});}else{_0x31f340(new Error(_0xd37f('0x5')));}}else{_0x31f340(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xd37f('0x6')]=function(_0x13ca60,_0x31e0e3,_0x2d5d90,_0x462e76,_0xef21f7,_0x41d7bf,_0x4c9fc1){var _0xf7293e=new AWS[(_0xd37f('0x7'))]({'accessKeyId':_0x13ca60,'secretAccessKey':_0x31e0e3,'region':_0x2d5d90});var _0x4e26bd={'Text':_0xef21f7,'TextType':_0x41d7bf||'text','OutputFormat':_0xd37f('0x8'),'VoiceId':_0x462e76};return pollyResult(_0xf7293e,_0x4e26bd,_0x4c9fc1);}; \ 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 e13eafe..6db49e5 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 _0x9691=['exports'];(function(_0x2c9a4e,_0x1450aa){var _0x4898ce=function(_0x3f8f8e){while(--_0x3f8f8e){_0x2c9a4e['push'](_0x2c9a4e['shift']());}};_0x4898ce(++_0x1450aa);}(_0x9691,0xf1));var _0x1969=function(_0x2418f4,_0x2cf1c9){_0x2418f4=_0x2418f4-0x0;var _0x39d09c=_0x9691[_0x2418f4];return _0x39d09c;};'use strict';var asr=require('./lib/api');module[_0x1969('0x0')]=function(_0x4dc3dc,_0x57b47b,_0x32cf57,_0x1e5bf7){return asr(_0x4dc3dc,_0x57b47b,_0x32cf57);}; \ No newline at end of file +var _0x5e7d=['./lib/api','exports'];(function(_0x47814c,_0x3e324f){var _0x2c03ff=function(_0x39f4e1){while(--_0x39f4e1){_0x47814c['push'](_0x47814c['shift']());}};_0x2c03ff(++_0x3e324f);}(_0x5e7d,0xac));var _0xd5e7=function(_0x374d90,_0x262da6){_0x374d90=_0x374d90-0x0;var _0x539cbb=_0x5e7d[_0x374d90];return _0x539cbb;};'use strict';var asr=require(_0xd5e7('0x0'));module[_0xd5e7('0x1')]=function(_0x30d542,_0x2e8b9f,_0x46580f,_0x3d9513){return asr(_0x30d542,_0x2e8b9f,_0x46580f);}; \ 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 470a276..29a0779 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 _0xc802=['readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0xc802,0xc8));var _0x2c80=function(_0x51944d,_0x20dbf0){_0x51944d=_0x51944d-0x0;var _0x39024e=_0xc802[_0x51944d];return _0x39024e;};'use strict';var url=require(_0x2c80('0x0'));var BPromise=require(_0x2c80('0x1'));var fs=require('fs');var host=_0x2c80('0x2');module['exports']=function(_0x52eb66,_0x473bc1,_0x2e6308){return new BPromise(function(_0x49f745,_0x2a3bcb){var _0x255a8c;if(typeof _0x52eb66!==_0x2c80('0x3')||_0x52eb66['length']===0x0){return _0x2a3bcb(_0x2c80('0x4'));}if(typeof _0x473bc1!==_0x2c80('0x3')||_0x473bc1[_0x2c80('0x5')]===0x0){return _0x2a3bcb(_0x2c80('0x6'));}if(typeof _0x2e6308!=='undefined'&&(typeof _0x2e6308!==_0x2c80('0x3')||_0x2e6308['length']===0x0)){return _0x2a3bcb(_0x2c80('0x7'));}try{_0x255a8c=fs[_0x2c80('0x8')](_0x52eb66)['toString'](_0x2c80('0x9'));}catch(_0x15f899){return _0x2a3bcb(_0x15f899);}return _0x49f745({'method':_0x2c80('0xa'),'uri':host+_0x2c80('0xb')+_0x473bc1,'body':{'config':{'encoding':_0x2c80('0xc'),'sampleRateHertz':'8000','languageCode':_0x2e6308},'audio':{'content':_0x255a8c}},'json':!![]});});}; \ No newline at end of file +var _0x0695=['string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x299f82,_0x4ead27){var _0x2e8ec3=function(_0x58c7c7){while(--_0x58c7c7){_0x299f82['push'](_0x299f82['shift']());}};_0x2e8ec3(++_0x4ead27);}(_0x0695,0xea));var _0x5069=function(_0x6acfa,_0x39f3b5){_0x6acfa=_0x6acfa-0x0;var _0x9a122=_0x0695[_0x6acfa];return _0x9a122;};'use strict';var url=require(_0x5069('0x0'));var BPromise=require(_0x5069('0x1'));var fs=require('fs');var host=_0x5069('0x2');module[_0x5069('0x3')]=function(_0x42b441,_0x321508,_0x510ab9){return new BPromise(function(_0x5bb89c,_0x21a78a){var _0x3fee5d;if(typeof _0x42b441!=='string'||_0x42b441[_0x5069('0x4')]===0x0){return _0x21a78a(_0x5069('0x5'));}if(typeof _0x321508!==_0x5069('0x6')||_0x321508[_0x5069('0x4')]===0x0){return _0x21a78a(_0x5069('0x7'));}if(typeof _0x510ab9!==_0x5069('0x8')&&(typeof _0x510ab9!==_0x5069('0x6')||_0x510ab9[_0x5069('0x4')]===0x0)){return _0x21a78a(_0x5069('0x9'));}try{_0x3fee5d=fs[_0x5069('0xa')](_0x42b441)[_0x5069('0xb')](_0x5069('0xc'));}catch(_0x4ca036){return _0x21a78a(_0x4ca036);}return _0x5bb89c({'method':_0x5069('0xd'),'uri':host+'/v1/speech:recognize?key='+_0x321508,'body':{'config':{'encoding':_0x5069('0xe'),'sampleRateHertz':_0x5069('0xf'),'languageCode':_0x510ab9},'audio':{'content':_0x3fee5d}},'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 dc91c05..172e71f 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 _0x655e=['./asr','exports'];(function(_0x3c8d29,_0x24c60d){var _0x22b902=function(_0x1d91a5){while(--_0x1d91a5){_0x3c8d29['push'](_0x3c8d29['shift']());}};_0x22b902(++_0x24c60d);}(_0x655e,0x126));var _0xe655=function(_0x36289a,_0x1fe4e2){_0x36289a=_0x36289a-0x0;var _0x28862b=_0x655e[_0x36289a];return _0x28862b;};var asr=require(_0xe655('0x0'));module[_0xe655('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf9e5=['exports','./asr'];(function(_0x18e45d,_0x1f44c7){var _0x371f5c=function(_0x443c38){while(--_0x443c38){_0x18e45d['push'](_0x18e45d['shift']());}};_0x371f5c(++_0x1f44c7);}(_0xf9e5,0x89));var _0x5f9e=function(_0x6e1f9c,_0x52d838){_0x6e1f9c=_0x6e1f9c-0x0;var _0x1b7358=_0xf9e5[_0x6e1f9c];return _0x1b7358;};var asr=require(_0x5f9e('0x0'));module[_0x5f9e('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 59ab1dd..32fefa3 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 _0x7123=['alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','status','code','metadata','endConversation','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','request-promise','randomstring','sox','google-tts-api','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','path','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','WHAT_EVER','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','.wav','chmodSync','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','then','generate','.mp3','from','audioContent','resolve','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','uri','results','map'];(function(_0x3dd549,_0x236c91){var _0xeaf384=function(_0x456445){while(--_0x456445){_0x3dd549['push'](_0x3dd549['shift']());}};_0xeaf384(++_0x236c91);}(_0x7123,0x14d));var _0x3712=function(_0x5839a6,_0x48f291){_0x5839a6=_0x5839a6-0x0;var _0x43584c=_0x7123[_0x5839a6];return _0x43584c;};'use strict';var apiai=require(_0x3712('0x0'));var BPromise=require(_0x3712('0x1'));var dialogflow=require(_0x3712('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x3712('0x3'));var md5=require(_0x3712('0x4'));var path=require('path');var querystring=require('querystring');var rp=require(_0x3712('0x5'));var rs=require(_0x3712('0x6'));var sox=require(_0x3712('0x7'));var tts=require(_0x3712('0x8'));var urlParse=require('url')[_0x3712('0x9')];var util=require('util');var aws=require(_0x3712('0xa'));var google=require(_0x3712('0xb'));var sestek=require(_0x3712('0xc'));var tilde=require(_0x3712('0xd'));var logger=require(_0x3712('0xe'))(_0x3712('0xf'));var ISPEECH_API=_0x3712('0x10');function downloadFile(_0x47fa6f,_0x102c80){return new BPromise(function(_0xa1214e,_0x16b842){var _0x3e318b=urlParse(_0x47fa6f);var _0x47032e=_0x3e318b[_0x3712('0x11')]===_0x3712('0x12')?https:http;var _0x8bab8a={'host':_0x3e318b['host'],'path':_0x3e318b[_0x3712('0x13')],'headers':{'user-agent':'WHAT_EVER'}};_0x47032e[_0x3712('0x14')](_0x8bab8a,function(_0x541b60){if(_0x541b60['statusCode']!==0xc8){logger[_0x3712('0x15')](_0x3712('0x16')+_0x47fa6f+_0x3712('0x17')+_0x541b60[_0x3712('0x18')]+'\x20('+_0x541b60['statusMessage']+')');_0x16b842(new Error(_0x3712('0x16')+_0x47fa6f+'\x20failed,\x20status\x20code\x20=\x20'+_0x541b60[_0x3712('0x18')]+'\x20('+_0x541b60[_0x3712('0x19')]+')'));return;}var _0x261880=fs[_0x3712('0x1a')](_0x102c80);_0x261880['on'](_0x3712('0x1b'),function(){logger[_0x3712('0x1c')](_0x3712('0x1d'));_0x261880[_0x3712('0x1e')](_0xa1214e);});_0x261880['on'](_0x3712('0x15'),function(_0x9902f0){fs[_0x3712('0x1f')](_0x102c80);logger['error'](_0x3712('0x20'),_0x9902f0);_0x16b842(_0x9902f0);});_0x541b60[_0x3712('0x21')](_0x261880);})['on'](_0x3712('0x15'),function(_0x26a374){logger['error'](_0x26a374);_0x16b842(_0x26a374);})[_0x3712('0x22')]();});}function uploadFile(_0x43a86c){return new BPromise(function(_0x1c343c,_0x1a7411){var _0x5e46c4=urlParse(_0x43a86c);var _0x32e8b8=_0x5e46c4['protocol']==='https:'?https:http;var _0x42d31f={'host':_0x5e46c4[_0x3712('0x23')],'path':_0x5e46c4[_0x3712('0x13')],'headers':{'user-agent':_0x3712('0x24')}};_0x32e8b8[_0x3712('0x14')](_0x42d31f,function(_0x7f7854){if(_0x7f7854[_0x3712('0x18')]!==0xc8){_0x1a7411(new Error('request\x20to\x20'+_0x43a86c+'\x20failed,\x20status\x20code\x20=\x20'+_0x7f7854[_0x3712('0x18')]+'\x20('+_0x7f7854['statusMessage']+')'));return;}var _0x28c1d1='';_0x7f7854['on']('data',function(_0x580ae0){_0x28c1d1+=_0x580ae0;});_0x7f7854['on'](_0x3712('0x22'),function(){_0x1c343c(_0x28c1d1);});})['on'](_0x3712('0x15'),function(_0x449c4e){_0x1a7411(_0x449c4e);})['end']();});}function convertFile(_0xaad8c0,_0x9cb00f){return new BPromise(function(_0x4ef7bf,_0x3c9d6c){var _0x57447c=sox[_0x3712('0x25')](_0xaad8c0,_0x9cb00f,{'sampleRate':0x1f40,'format':_0x3712('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x57447c['on'](_0x3712('0x15'),function(_0x245b14){logger[_0x3712('0x15')](_0x3712('0x27'),_0x245b14);_0x3c9d6c(_0x245b14);});_0x57447c['on'](_0x3712('0x22'),function(){logger[_0x3712('0x1c')](_0x3712('0x28'));_0x4ef7bf();});_0x57447c[_0x3712('0x29')]();});}function base64Decode(_0x158418,_0x28015d){var _0x28e954=path['resolve'](__dirname,_0x3712('0x2a'),rs['generate'](0x4)+_0x3712('0x2b'));fs['writeFileSync'](_0x28e954,_0x158418,'base64');return convertFile(_0x28e954,_0x28015d)['then'](function(){try{fs[_0x3712('0x1f')](_0x28e954);fs[_0x3712('0x2c')](_0x28015d,_0x3712('0x2d'));}catch(_0x3858f6){logger[_0x3712('0x15')](_0x3858f6);}return _0x28015d[_0x3712('0x2e')]('.')[0x0];});}function base64Encode(_0x303e22){var _0x45802e=fs['readFileSync'](_0x303e22);return new Buffer(_0x45802e)[_0x3712('0x2f')](_0x3712('0x30'));}exports[_0x3712('0x31')]=function(_0x568e6f,_0x1c87d7,_0x48f1a2,_0x33fef5,_0x5229b1,_0x4b4576){var _0x480d1d,_0x3b2c07;var _0x4ff2a5=_0x3712('0x32');var _0x1996c3=_0x3712('0x33')+_0x568e6f;var _0x38740b={};if(_0x1c87d7===_0x3712('0x34')){_0x38740b[_0x3712('0x35')]={'ssml':_0x48f1a2};}else{_0x38740b[_0x3712('0x35')]={'text':_0x48f1a2};};_0x38740b[_0x3712('0x36')]={'languageCode':_0x33fef5,'ssmlGender':_0x5229b1};_0x38740b[_0x3712('0x37')]={'audioEncoding':_0x3712('0x38'),'sampleRateHertz':0x1f40};var _0x4ed87d={'url':_0x4ff2a5+'text:synthesize'+_0x1996c3,'method':_0x3712('0x39'),'json':!![],'body':_0x38740b};return rp(_0x4ed87d)[_0x3712('0x3a')](function(_0x2a7bac){return new BPromise(function(_0x35ba74,_0x4ece66){_0x480d1d=path['resolve'](__dirname,_0x3712('0x2a'),rs[_0x3712('0x3b')](0x4)+_0x3712('0x3c'));var _0x33dabc=Buffer[_0x3712('0x3d')](_0x2a7bac[_0x3712('0x3e')],_0x3712('0x30'));return fs['writeFile'](_0x480d1d,_0x33dabc,function(_0x37bbc3){_0x4ece66(_0x37bbc3);},function(_0x24456b){fs[_0x3712('0x2c')](_0x480d1d,_0x3712('0x2d'));_0x35ba74(_0x24456b);});});})[_0x3712('0x3a')](function(_0x4d115b){_0x3b2c07=path[_0x3712('0x3f')](__dirname,_0x3712('0x2a'),rs[_0x3712('0x3b')](0x4)+_0x3712('0x2b'));return convertFile(_0x480d1d,_0x3b2c07);})[_0x3712('0x3a')](function(){try{fs['unlink'](_0x480d1d);fs[_0x3712('0x2c')](_0x3b2c07,_0x3712('0x2d'));}catch(_0x185063){logger[_0x3712('0x15')](_0x185063);}logger[_0x3712('0x1c')]('googleCloudTTS\x20path',_0x3b2c07[_0x3712('0x2e')]('.')[0x0]);return _0x3b2c07[_0x3712('0x2e')]('.')[0x0];});};exports[_0x3712('0x40')]=function(_0x42f975,_0x133c5d){var _0x52f1d1=_0x3712('0x41');var _0x2b7658,_0x56b9bf;var _0x51c6c0;var _0x2b651f={'encoding':'utf8','method':_0x3712('0x39'),'timeout':0x2710,'url':_0x52f1d1,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x3712('0x42')+encodeURIComponent(JSON['stringify']([[[_0x3712('0x43'),JSON[_0x3712('0x44')]([_0x42f975,_0x133c5d||'en',![],_0x3712('0x45')]),null,_0x3712('0x46')]]]))};return rp(_0x2b651f)[_0x3712('0x3a')](function(_0x4304b6){try{_0x51c6c0=eval(_0x4304b6[_0x3712('0x47')](0x5))[0x0][0x2];}catch(_0xff283b){throw new Error(_0x3712('0x48')+_0x4304b6[_0x3712('0x49')]);}if(!_0x51c6c0){if(_0x42f975[_0x3712('0x4a')]>0xc8){throw new Error(_0x3712('0x4b'));}else{throw new Error(_0x3712('0x4c')+_0x133c5d+_0x3712('0x4d'));}}try{_0x51c6c0=eval(_0x51c6c0)[0x0];}catch(_0x241fd3){throw new Error(_0x3712('0x48')+res[_0x3712('0x49')]);}const _0x4b8aa8=_0x51c6c0;_0x2b7658=path[_0x3712('0x3f')](__dirname,_0x3712('0x2a'),rs[_0x3712('0x3b')](0x4)+_0x3712('0x3c'));fs[_0x3712('0x4e')](_0x2b7658,_0x51c6c0,{'encoding':_0x3712('0x30')});_0x56b9bf=path[_0x3712('0x3f')](__dirname,_0x3712('0x2a'),rs[_0x3712('0x3b')](0x4)+_0x3712('0x2b'));return convertFile(_0x2b7658,_0x56b9bf);})[_0x3712('0x3a')](function(){try{fs[_0x3712('0x1f')](_0x2b7658);fs[_0x3712('0x2c')](_0x56b9bf,_0x3712('0x2d'));}catch(_0xb606ae){logger[_0x3712('0x15')](_0xb606ae);}logger[_0x3712('0x1c')](_0x3712('0x4f'),_0x56b9bf['split']('.')[0x0]);return _0x56b9bf[_0x3712('0x2e')]('.')[0x0];});};exports[_0x3712('0x50')]=function(_0x438b23,_0x34697d,_0x5aba6b){return google['asr'](_0x438b23,_0x34697d,_0x5aba6b)['then'](function(_0x8dccab){logger['info'](_0x8dccab[_0x3712('0x51')]);return rp(_0x8dccab);})['then'](function(_0x4ba096){var _0x568c5a='';var _0x1e9231=0x0;try{fs[_0x3712('0x1f')](_0x438b23);}catch(_0x21dd50){logger[_0x3712('0x15')](_0x21dd50);}if(_0x4ba096&&_0x4ba096[_0x3712('0x52')]){_0x568c5a=_0x4ba096[_0x3712('0x52')][_0x3712('0x53')](function(_0x44e8cd){return _0x44e8cd&&_0x44e8cd[_0x3712('0x54')][0x0]&&_0x44e8cd[_0x3712('0x54')][0x0][_0x3712('0x55')]?_0x44e8cd[_0x3712('0x54')][0x0][_0x3712('0x55')]:'';})[_0x3712('0x56')]('\x0a');_0x1e9231=_0x4ba096[_0x3712('0x52')][_0x3712('0x53')](function(_0x42c684){return _0x42c684&&_0x42c684[_0x3712('0x54')][0x0]&&_0x42c684['alternatives'][0x0][_0x3712('0x57')]?_0x42c684['alternatives'][0x0]['confidence']:0x0;})[_0x3712('0x56')]('\x0a');}logger[_0x3712('0x1c')](_0x3712('0x58'),_0x568c5a);logger[_0x3712('0x1c')](_0x3712('0x59'),_0x1e9231);return{'transcript':_0x568c5a,'confidence':_0x1e9231};})[_0x3712('0x5a')](function(_0x2ac17a){logger['error'](_0x3712('0x5b'),_0x2ac17a[_0x3712('0x18')],_0x2ac17a['name'],_0x2ac17a['message']);});};exports['googleDialogflow']=function(_0x39963e,_0xa06bf6,_0x2aefb8,_0x1d8b32){var _0x302c3a=apiai(_0xa06bf6,{'language':_0x1d8b32||'en'});return _0x302c3a[_0x3712('0x5c')](_0x2aefb8,{'sessionId':md5(_0x39963e)})[_0x3712('0x3a')](function(_0x4df3e0){logger[_0x3712('0x1c')](JSON[_0x3712('0x44')](_0x4df3e0));return{'source':_0x4df3e0[_0x3712('0x5d')][_0x3712('0x5e')],'resolvedQuery':_0x4df3e0[_0x3712('0x5d')][_0x3712('0x5f')],'action':_0x4df3e0['result'][_0x3712('0x60')],'actionIncomplete':_0x4df3e0['result'][_0x3712('0x61')],'speech':_0x4df3e0[_0x3712('0x5d')][_0x3712('0x62')]['speech'],'score':_0x4df3e0[_0x3712('0x5d')]['score'],'statusCode':_0x4df3e0[_0x3712('0x63')][_0x3712('0x64')],'endConversation':_0x4df3e0[_0x3712('0x5d')][_0x3712('0x65')][_0x3712('0x66')]||![],'isFallbackIntent':_0x4df3e0['result'][_0x3712('0x65')]['isFallbackIntent']};});};exports[_0x3712('0x67')]=function(_0x87649c,_0x3eb69b,_0x5c680b,_0x260fc6,_0x513dbc,_0x3fd14f){var _0x3f6158=_0x260fc6[_0x3712('0x68')](/\\n/g,'\x0a');var _0x583e44={'credentials':{'private_key':_0x3f6158,'client_email':_0x5c680b}};var _0x319a78=new dialogflow['SessionsClient'](_0x583e44);var _0x2d4ea5=_0x319a78[_0x3712('0x69')](_0x3eb69b,md5(_0x87649c));var _0x161e3b={'session':_0x2d4ea5,'queryInput':{'text':{'text':_0x513dbc,'languageCode':_0x3fd14f}}};return _0x319a78[_0x3712('0x6a')](_0x161e3b)[_0x3712('0x3a')](function(_0x193f2f){if(_0x193f2f&&_0x193f2f[_0x3712('0x4a')]){logger['info'](_0x3712('0x6b'),JSON[_0x3712('0x44')](_0x193f2f));var _0x5d8833=_0x193f2f[0x0];if(_0x5d8833){var _0x1824bb={'action':_0x5d8833['queryResult'][_0x3712('0x60')],'allRequiredParamsPresent':_0x5d8833[_0x3712('0x6c')]['allRequiredParamsPresent'],'endConversation':_0x5d8833[_0x3712('0x6c')][_0x3712('0x6d')]&&_0x5d8833[_0x3712('0x6c')][_0x3712('0x6d')][_0x3712('0x6e')]?_0x5d8833[_0x3712('0x6c')][_0x3712('0x6d')][_0x3712('0x6e')][_0x3712('0x6f')]['boolValue']:![],'fulfillmentText':_0x5d8833['queryResult'][_0x3712('0x70')],'intentName':_0x5d8833[_0x3712('0x6c')][_0x3712('0x71')]['name'],'intentDisplayName':_0x5d8833['queryResult']['intent'][_0x3712('0x72')],'isFallbackIntent':_0x5d8833[_0x3712('0x6c')][_0x3712('0x71')][_0x3712('0x73')],'languageCode':_0x5d8833[_0x3712('0x6c')][_0x3712('0x74')],'queryText':_0x5d8833[_0x3712('0x6c')][_0x3712('0x75')],'responseId':_0x5d8833[_0x3712('0x76')],'score':_0x5d8833[_0x3712('0x6c')][_0x3712('0x77')],'speech':_0x5d8833[_0x3712('0x6c')][_0x3712('0x70')],'providerResponse':JSON[_0x3712('0x44')](_0x193f2f)};return _0x1824bb;}}});};exports[_0x3712('0x78')]=function(_0x317a5f,_0x4ae9ac,_0x20ac24,_0xf680c0){return tilde['asr'](_0x317a5f,_0x4ae9ac,_0x20ac24,_0xf680c0)[_0x3712('0x3a')](function(_0x1f19de){try{fs[_0x3712('0x1f')](_0x317a5f);}catch(_0x3da50f){logger['error'](_0x3da50f);}logger[_0x3712('0x1c')](_0x3712('0x79'),_0x1f19de[_0x3712('0x55')]);logger[_0x3712('0x1c')](_0x3712('0x7a'),_0x1f19de['confidence']);return _0x1f19de;});};exports[_0x3712('0x7b')]=function(_0x4db918,_0xc24c75,_0x36f6cc,_0x12981e,_0x20f055,_0xfad78){var _0x540442=path[_0x3712('0x3f')](__dirname,_0x3712('0x2a'),rs[_0x3712('0x3b')](0x4)+_0x3712('0x3c'));var _0x452581;return aws[_0x3712('0x7c')](_0x4db918,_0xc24c75,_0x36f6cc,_0x12981e,_0x20f055,_0xfad78,_0x540442)[_0x3712('0x3a')](function(){_0x452581=path[_0x3712('0x3f')](__dirname,_0x3712('0x2a'),rs[_0x3712('0x3b')](0x4)+_0x3712('0x2b'));return convertFile(_0x540442,_0x452581);})[_0x3712('0x3a')](function(){try{fs[_0x3712('0x1f')](_0x540442);fs[_0x3712('0x2c')](_0x452581,_0x3712('0x2d'));}catch(_0x57e453){logger[_0x3712('0x15')](_0x57e453);}return _0x452581[_0x3712('0x2e')]('.')[0x0];});};exports[_0x3712('0x7d')]=function(_0x630fc3,_0x3f93a5,_0x1e56f2,_0x520a7b,_0x64bb7e,_0x1c487b){return aws[_0x3712('0x7e')](_0x630fc3,_0x3f93a5,_0x1e56f2,_0x520a7b,_0x64bb7e,_0x1c487b)[_0x3712('0x3a')](function(_0x408790){logger[_0x3712('0x1c')](JSON[_0x3712('0x44')](_0x408790));return _0x408790;});};exports['ispeechTTS']=function(_0x181731,_0x2e7743,_0x27facc,_0x135de7){var _0x381d5a=util[_0x3712('0x7f')](_0x3712('0x80'),ISPEECH_API,_0x181731,encodeURIComponent(_0x2e7743),_0x27facc,_0x135de7);var _0x3c5ed6=path[_0x3712('0x3f')](__dirname,_0x3712('0x2a'),rs[_0x3712('0x3b')](0x4)+'.mp3');var _0x54937d;return downloadFile(_0x381d5a,_0x3c5ed6)[_0x3712('0x3a')](function(){_0x54937d=path[_0x3712('0x3f')](__dirname,_0x3712('0x2a'),rs['generate'](0x4)+_0x3712('0x2b'));return convertFile(_0x3c5ed6,_0x54937d);})[_0x3712('0x3a')](function(){try{fs[_0x3712('0x1f')](_0x3c5ed6);fs[_0x3712('0x2c')](_0x54937d,_0x3712('0x2d'));}catch(_0x4cebf1){logger[_0x3712('0x15')](_0x4cebf1);}return _0x54937d[_0x3712('0x2e')]('.')[0x0];});};exports['ispeechASR']=function(_0x580576,_0x54d584,_0x30df59,_0x29eae8){var _0x159483=util['format'](_0x3712('0x81'),ISPEECH_API,_0x54d584,_0x30df59,base64Encode(_0x580576),_0x29eae8?util[_0x3712('0x7f')](_0x3712('0x82'),encodeURIComponent(_0x29eae8)):_0x3712('0x83'));return uploadFile(_0x159483)[_0x3712('0x3a')](function(_0x3a3589){return querystring[_0x3712('0x9')](_0x3a3589);});};exports[_0x3712('0x84')]=function(_0x435d3e,_0x31427c){return sestek['nda'](_0x435d3e,_0x31427c)[_0x3712('0x3a')](function(_0x51081b){logger[_0x3712('0x1c')](JSON[_0x3712('0x44')](_0x51081b));var _0x34693e={'speech':_0x51081b[_0x3712('0x85')],'action':_0x51081b[_0x3712('0x86')]?_0x51081b[_0x3712('0x86')][_0x3712('0x87')]:undefined,'actiondata':_0x51081b[_0x3712('0x86')]?_0x51081b[_0x3712('0x86')]['CustomActionData']:undefined};if(_0x51081b[_0x3712('0x86')]&&_0x51081b['channelData']['AudioFromTts']){return base64Decode(_0x51081b[_0x3712('0x86')]['AudioFromTts'][_0x3712('0x88')],path[_0x3712('0x3f')](__dirname,_0x3712('0x2a'),rs[_0x3712('0x3b')](0x4)+_0x3712('0x2b')))['then'](function(_0x21d78e){_0x34693e[_0x3712('0x89')]=_0x21d78e;return _0x34693e;});}return _0x34693e;});};exports[_0x3712('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x3e80=['readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','tmp','audioContent','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','request-promise','randomstring','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','transcode','error\x20convert','start','generate','.wav','writeFileSync','base64','then','chmodSync','777'];(function(_0x492e2e,_0x5ce525){var _0x5344ec=function(_0x12dec9){while(--_0x12dec9){_0x492e2e['push'](_0x492e2e['shift']());}};_0x5344ec(++_0x5ce525);}(_0x3e80,0x168));var _0x03e8=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0x3e80[_0x229128];return _0x1875b9;};'use strict';var apiai=require(_0x03e8('0x0'));var BPromise=require(_0x03e8('0x1'));var dialogflow=require(_0x03e8('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x03e8('0x3'));var md5=require('md5');var path=require(_0x03e8('0x4'));var querystring=require('querystring');var rp=require(_0x03e8('0x5'));var rs=require(_0x03e8('0x6'));var sox=require('sox');var tts=require(_0x03e8('0x7'));var urlParse=require(_0x03e8('0x8'))[_0x03e8('0x9')];var util=require(_0x03e8('0xa'));var aws=require(_0x03e8('0xb'));var google=require(_0x03e8('0xc'));var sestek=require(_0x03e8('0xd'));var tilde=require('./tilde');var logger=require(_0x03e8('0xe'))(_0x03e8('0xf'));var ISPEECH_API=_0x03e8('0x10');function downloadFile(_0x104e86,_0x1976ef){return new BPromise(function(_0x58215f,_0x3f73ae){var _0x4c353f=urlParse(_0x104e86);var _0x5c92c2=_0x4c353f[_0x03e8('0x11')]===_0x03e8('0x12')?https:http;var _0xc9a50b={'host':_0x4c353f[_0x03e8('0x13')],'path':_0x4c353f[_0x03e8('0x4')],'headers':{'user-agent':_0x03e8('0x14')}};_0x5c92c2[_0x03e8('0x15')](_0xc9a50b,function(_0x4d4dce){if(_0x4d4dce['statusCode']!==0xc8){logger[_0x03e8('0x16')](_0x03e8('0x17')+_0x104e86+_0x03e8('0x18')+_0x4d4dce[_0x03e8('0x19')]+'\x20('+_0x4d4dce[_0x03e8('0x1a')]+')');_0x3f73ae(new Error(_0x03e8('0x17')+_0x104e86+'\x20failed,\x20status\x20code\x20=\x20'+_0x4d4dce['statusCode']+'\x20('+_0x4d4dce['statusMessage']+')'));return;}var _0x287661=fs[_0x03e8('0x1b')](_0x1976ef);_0x287661['on']('finish',function(){logger[_0x03e8('0x1c')](_0x03e8('0x1d'));_0x287661[_0x03e8('0x1e')](_0x58215f);});_0x287661['on'](_0x03e8('0x16'),function(_0x522320){fs[_0x03e8('0x1f')](_0x1976ef);logger[_0x03e8('0x16')](_0x03e8('0x20'),_0x522320);_0x3f73ae(_0x522320);});_0x4d4dce[_0x03e8('0x21')](_0x287661);})['on']('error',function(_0x4aec4d){logger[_0x03e8('0x16')](_0x4aec4d);_0x3f73ae(_0x4aec4d);})['end']();});}function uploadFile(_0x3e93a9){return new BPromise(function(_0x1d3b21,_0x1997fc){var _0x11ccfe=urlParse(_0x3e93a9);var _0x1f0d55=_0x11ccfe['protocol']===_0x03e8('0x12')?https:http;var _0x45eb16={'host':_0x11ccfe['host'],'path':_0x11ccfe[_0x03e8('0x4')],'headers':{'user-agent':_0x03e8('0x14')}};_0x1f0d55['get'](_0x45eb16,function(_0x214035){if(_0x214035[_0x03e8('0x19')]!==0xc8){_0x1997fc(new Error('request\x20to\x20'+_0x3e93a9+_0x03e8('0x18')+_0x214035[_0x03e8('0x19')]+'\x20('+_0x214035[_0x03e8('0x1a')]+')'));return;}var _0x2b23a9='';_0x214035['on']('data',function(_0x3fb836){_0x2b23a9+=_0x3fb836;});_0x214035['on'](_0x03e8('0x22'),function(){_0x1d3b21(_0x2b23a9);});})['on'](_0x03e8('0x16'),function(_0xda702){_0x1997fc(_0xda702);})[_0x03e8('0x22')]();});}function convertFile(_0x57b700,_0x5669db){return new BPromise(function(_0x10ff5c,_0x3048c1){var _0x5b16f2=sox[_0x03e8('0x23')](_0x57b700,_0x5669db,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5b16f2['on']('error',function(_0x43e724){logger[_0x03e8('0x16')](_0x03e8('0x24'),_0x43e724);_0x3048c1(_0x43e724);});_0x5b16f2['on']('end',function(){logger[_0x03e8('0x1c')]('finish\x20to\x20convert');_0x10ff5c();});_0x5b16f2[_0x03e8('0x25')]();});}function base64Decode(_0x49da46,_0x24e866){var _0x93dce5=path['resolve'](__dirname,'tmp',rs[_0x03e8('0x26')](0x4)+_0x03e8('0x27'));fs[_0x03e8('0x28')](_0x93dce5,_0x49da46,_0x03e8('0x29'));return convertFile(_0x93dce5,_0x24e866)[_0x03e8('0x2a')](function(){try{fs[_0x03e8('0x1f')](_0x93dce5);fs[_0x03e8('0x2b')](_0x24e866,_0x03e8('0x2c'));}catch(_0x168962){logger[_0x03e8('0x16')](_0x168962);}return _0x24e866['split']('.')[0x0];});}function base64Encode(_0x3d3a33){var _0x376781=fs[_0x03e8('0x2d')](_0x3d3a33);return new Buffer(_0x376781)[_0x03e8('0x2e')](_0x03e8('0x29'));}exports['googleCloudTTS']=function(_0x37b337,_0x3b3bb3,_0x3b25e5,_0x43c9c6,_0xb8b9ce,_0x87706e){var _0x38f2f3,_0x235b69;var _0x469498=_0x03e8('0x2f');var _0x5c051b=_0x03e8('0x30')+_0x37b337;var _0x59067c={};if(_0x3b3bb3===_0x03e8('0x31')){_0x59067c[_0x03e8('0x32')]={'ssml':_0x3b25e5};}else{_0x59067c[_0x03e8('0x32')]={'text':_0x3b25e5};};_0x59067c[_0x03e8('0x33')]={'languageCode':_0x43c9c6,'ssmlGender':_0xb8b9ce};_0x59067c[_0x03e8('0x34')]={'audioEncoding':_0x03e8('0x35'),'sampleRateHertz':0x1f40};var _0x33a358={'url':_0x469498+_0x03e8('0x36')+_0x5c051b,'method':'POST','json':!![],'body':_0x59067c};return rp(_0x33a358)['then'](function(_0x483094){return new BPromise(function(_0x16689e,_0x3c9e51){_0x38f2f3=path[_0x03e8('0x37')](__dirname,_0x03e8('0x38'),rs[_0x03e8('0x26')](0x4)+'.mp3');var _0x66997e=Buffer['from'](_0x483094[_0x03e8('0x39')],_0x03e8('0x29'));return fs['writeFile'](_0x38f2f3,_0x66997e,function(_0x978cca){_0x3c9e51(_0x978cca);},function(_0x256026){fs['chmodSync'](_0x38f2f3,'777');_0x16689e(_0x256026);});});})[_0x03e8('0x2a')](function(_0x473ad3){_0x235b69=path[_0x03e8('0x37')](__dirname,'tmp',rs[_0x03e8('0x26')](0x4)+_0x03e8('0x27'));return convertFile(_0x38f2f3,_0x235b69);})['then'](function(){try{fs[_0x03e8('0x1f')](_0x38f2f3);fs[_0x03e8('0x2b')](_0x235b69,_0x03e8('0x2c'));}catch(_0x255984){logger[_0x03e8('0x16')](_0x255984);}logger[_0x03e8('0x1c')](_0x03e8('0x3a'),_0x235b69[_0x03e8('0x3b')]('.')[0x0]);return _0x235b69[_0x03e8('0x3b')]('.')[0x0];});};exports[_0x03e8('0x3c')]=function(_0x37ce2d,_0x4cf8ad){var _0xc4d0ea=_0x03e8('0x3d');var _0x382d0b,_0x57b512;var _0x36de7d;var _0x42de25={'encoding':_0x03e8('0x3e'),'method':'POST','timeout':0x2710,'url':_0xc4d0ea,'headers':{'Content-Type':_0x03e8('0x3f')},'body':_0x03e8('0x40')+encodeURIComponent(JSON[_0x03e8('0x41')]([[[_0x03e8('0x42'),JSON[_0x03e8('0x41')]([_0x37ce2d,_0x4cf8ad||'en',![],_0x03e8('0x43')]),null,_0x03e8('0x44')]]]))};return rp(_0x42de25)['then'](function(_0x55c589){try{_0x36de7d=eval(_0x55c589['slice'](0x5))[0x0][0x2];}catch(_0x1778ac){throw new Error(_0x03e8('0x45')+_0x55c589[_0x03e8('0x46')]);}if(!_0x36de7d){if(_0x37ce2d[_0x03e8('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x03e8('0x48')+_0x4cf8ad+_0x03e8('0x49'));}}try{_0x36de7d=eval(_0x36de7d)[0x0];}catch(_0x557bcb){throw new Error(_0x03e8('0x45')+res[_0x03e8('0x46')]);}const _0x42a51e=_0x36de7d;_0x382d0b=path[_0x03e8('0x37')](__dirname,'tmp',rs[_0x03e8('0x26')](0x4)+_0x03e8('0x4a'));fs[_0x03e8('0x28')](_0x382d0b,_0x36de7d,{'encoding':_0x03e8('0x29')});_0x57b512=path[_0x03e8('0x37')](__dirname,_0x03e8('0x38'),rs[_0x03e8('0x26')](0x4)+_0x03e8('0x27'));return convertFile(_0x382d0b,_0x57b512);})[_0x03e8('0x2a')](function(){try{fs['unlink'](_0x382d0b);fs[_0x03e8('0x2b')](_0x57b512,_0x03e8('0x2c'));}catch(_0x471cf7){logger['error'](_0x471cf7);}logger['info'](_0x03e8('0x4b'),_0x57b512[_0x03e8('0x3b')]('.')[0x0]);return _0x57b512['split']('.')[0x0];});};exports['googleASR']=function(_0x389ab7,_0x5f2d64,_0x7d3009){return google[_0x03e8('0x4c')](_0x389ab7,_0x5f2d64,_0x7d3009)[_0x03e8('0x2a')](function(_0x608d64){logger['info'](_0x608d64[_0x03e8('0x4d')]);return rp(_0x608d64);})[_0x03e8('0x2a')](function(_0x151f71){var _0x52dcc4='';var _0x467c91=0x0;try{fs['unlink'](_0x389ab7);}catch(_0xe48518){logger['error'](_0xe48518);}if(_0x151f71&&_0x151f71[_0x03e8('0x4e')]){_0x52dcc4=_0x151f71[_0x03e8('0x4e')]['map'](function(_0x216b4f){return _0x216b4f&&_0x216b4f[_0x03e8('0x4f')][0x0]&&_0x216b4f['alternatives'][0x0][_0x03e8('0x50')]?_0x216b4f['alternatives'][0x0]['transcript']:'';})[_0x03e8('0x51')]('\x0a');_0x467c91=_0x151f71[_0x03e8('0x4e')]['map'](function(_0xffbada){return _0xffbada&&_0xffbada[_0x03e8('0x4f')][0x0]&&_0xffbada[_0x03e8('0x4f')][0x0][_0x03e8('0x52')]?_0xffbada[_0x03e8('0x4f')][0x0][_0x03e8('0x52')]:0x0;})[_0x03e8('0x51')]('\x0a');}logger['info'](_0x03e8('0x53'),_0x52dcc4);logger[_0x03e8('0x1c')]('googleASR\x20confidence',_0x467c91);return{'transcript':_0x52dcc4,'confidence':_0x467c91};})[_0x03e8('0x54')](function(_0x4131d8){logger[_0x03e8('0x16')]('[%s]\x20%s:%s',_0x4131d8[_0x03e8('0x19')],_0x4131d8['name'],_0x4131d8[_0x03e8('0x55')]);});};exports[_0x03e8('0x56')]=function(_0x56f46f,_0x5d5745,_0xf07e4e,_0x5c1da7){var _0x5b3da2=apiai(_0x5d5745,{'language':_0x5c1da7||'en'});return _0x5b3da2[_0x03e8('0x57')](_0xf07e4e,{'sessionId':md5(_0x56f46f)})[_0x03e8('0x2a')](function(_0x13f8eb){logger[_0x03e8('0x1c')](JSON[_0x03e8('0x41')](_0x13f8eb));return{'source':_0x13f8eb['result'][_0x03e8('0x58')],'resolvedQuery':_0x13f8eb[_0x03e8('0x59')][_0x03e8('0x5a')],'action':_0x13f8eb[_0x03e8('0x59')][_0x03e8('0x5b')],'actionIncomplete':_0x13f8eb[_0x03e8('0x59')]['actionIncomplete'],'speech':_0x13f8eb[_0x03e8('0x59')][_0x03e8('0x5c')]['speech'],'score':_0x13f8eb[_0x03e8('0x59')][_0x03e8('0x5d')],'statusCode':_0x13f8eb[_0x03e8('0x5e')][_0x03e8('0x5f')],'endConversation':_0x13f8eb[_0x03e8('0x59')]['metadata'][_0x03e8('0x60')]||![],'isFallbackIntent':_0x13f8eb[_0x03e8('0x59')][_0x03e8('0x61')][_0x03e8('0x62')]};});};exports[_0x03e8('0x63')]=function(_0x4e88e9,_0x431c78,_0x395a3e,_0x372d57,_0x6bc75d,_0x30ca0e){var _0x5de5c9=_0x372d57[_0x03e8('0x64')](/\\n/g,'\x0a');var _0x130cec={'credentials':{'private_key':_0x5de5c9,'client_email':_0x395a3e}};var _0x353b2b=new dialogflow[(_0x03e8('0x65'))](_0x130cec);var _0x41610f=_0x353b2b[_0x03e8('0x66')](_0x431c78,md5(_0x4e88e9));var _0x586fd2={'session':_0x41610f,'queryInput':{'text':{'text':_0x6bc75d,'languageCode':_0x30ca0e}}};return _0x353b2b[_0x03e8('0x67')](_0x586fd2)[_0x03e8('0x2a')](function(_0x44601a){if(_0x44601a&&_0x44601a[_0x03e8('0x47')]){logger[_0x03e8('0x1c')](_0x03e8('0x68'),JSON['stringify'](_0x44601a));var _0x230768=_0x44601a[0x0];if(_0x230768){var _0x3008cb={'action':_0x230768[_0x03e8('0x69')]['action'],'allRequiredParamsPresent':_0x230768['queryResult']['allRequiredParamsPresent'],'endConversation':_0x230768[_0x03e8('0x69')]['diagnosticInfo']&&_0x230768[_0x03e8('0x69')][_0x03e8('0x6a')][_0x03e8('0x6b')]?_0x230768[_0x03e8('0x69')][_0x03e8('0x6a')][_0x03e8('0x6b')][_0x03e8('0x6c')][_0x03e8('0x6d')]:![],'fulfillmentText':_0x230768[_0x03e8('0x69')][_0x03e8('0x6e')],'intentName':_0x230768[_0x03e8('0x69')][_0x03e8('0x6f')]['name'],'intentDisplayName':_0x230768['queryResult']['intent']['displayName'],'isFallbackIntent':_0x230768[_0x03e8('0x69')][_0x03e8('0x6f')]['isFallback'],'languageCode':_0x230768[_0x03e8('0x69')][_0x03e8('0x70')],'queryText':_0x230768[_0x03e8('0x69')][_0x03e8('0x71')],'responseId':_0x230768[_0x03e8('0x72')],'score':_0x230768['queryResult'][_0x03e8('0x73')],'speech':_0x230768[_0x03e8('0x69')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x44601a)};return _0x3008cb;}}});};exports[_0x03e8('0x74')]=function(_0x2e6e84,_0x4d4562,_0x457712,_0x4f910e){return tilde['asr'](_0x2e6e84,_0x4d4562,_0x457712,_0x4f910e)[_0x03e8('0x2a')](function(_0xb3a33){try{fs[_0x03e8('0x1f')](_0x2e6e84);}catch(_0x3fcb54){logger[_0x03e8('0x16')](_0x3fcb54);}logger['info']('Tilde\x20ASR\x20transcription',_0xb3a33['transcript']);logger[_0x03e8('0x1c')]('Tilde\x20ASR\x20confidence',_0xb3a33['confidence']);return _0xb3a33;});};exports[_0x03e8('0x75')]=function(_0x3fca5c,_0x21154d,_0x31bf35,_0x29fa8c,_0x22942d,_0xdd8382){var _0x144a1e=path['resolve'](__dirname,_0x03e8('0x38'),rs[_0x03e8('0x26')](0x4)+'.mp3');var _0x2453b9;return aws['polly'](_0x3fca5c,_0x21154d,_0x31bf35,_0x29fa8c,_0x22942d,_0xdd8382,_0x144a1e)['then'](function(){_0x2453b9=path[_0x03e8('0x37')](__dirname,_0x03e8('0x38'),rs[_0x03e8('0x26')](0x4)+_0x03e8('0x27'));return convertFile(_0x144a1e,_0x2453b9);})[_0x03e8('0x2a')](function(){try{fs[_0x03e8('0x1f')](_0x144a1e);fs[_0x03e8('0x2b')](_0x2453b9,_0x03e8('0x2c'));}catch(_0x55c70c){logger[_0x03e8('0x16')](_0x55c70c);}return _0x2453b9[_0x03e8('0x3b')]('.')[0x0];});};exports[_0x03e8('0x76')]=function(_0x1baa88,_0x272424,_0x344aa5,_0x6e1137,_0x3b9d01,_0x5a9edd){return aws[_0x03e8('0x77')](_0x1baa88,_0x272424,_0x344aa5,_0x6e1137,_0x3b9d01,_0x5a9edd)[_0x03e8('0x2a')](function(_0x4461cf){logger[_0x03e8('0x1c')](JSON['stringify'](_0x4461cf));return _0x4461cf;});};exports[_0x03e8('0x78')]=function(_0x284b1a,_0x222a23,_0x29353f,_0x4b9b45){var _0x376f1b=util['format'](_0x03e8('0x79'),ISPEECH_API,_0x284b1a,encodeURIComponent(_0x222a23),_0x29353f,_0x4b9b45);var _0x1ff2ab=path[_0x03e8('0x37')](__dirname,'tmp',rs[_0x03e8('0x26')](0x4)+'.mp3');var _0x413775;return downloadFile(_0x376f1b,_0x1ff2ab)['then'](function(){_0x413775=path[_0x03e8('0x37')](__dirname,_0x03e8('0x38'),rs[_0x03e8('0x26')](0x4)+'.wav');return convertFile(_0x1ff2ab,_0x413775);})[_0x03e8('0x2a')](function(){try{fs[_0x03e8('0x1f')](_0x1ff2ab);fs['chmodSync'](_0x413775,_0x03e8('0x2c'));}catch(_0x3dff5b){logger[_0x03e8('0x16')](_0x3dff5b);}return _0x413775[_0x03e8('0x3b')]('.')[0x0];});};exports[_0x03e8('0x7a')]=function(_0x315d2f,_0xa01fe,_0x20085f,_0x3a33ca){var _0x3ae3cc=util[_0x03e8('0x7b')](_0x03e8('0x7c'),ISPEECH_API,_0xa01fe,_0x20085f,base64Encode(_0x315d2f),_0x3a33ca?util['format'](_0x03e8('0x7d'),encodeURIComponent(_0x3a33ca)):'freeform=3');return uploadFile(_0x3ae3cc)['then'](function(_0x1e3f6e){return querystring[_0x03e8('0x9')](_0x1e3f6e);});};exports[_0x03e8('0x7e')]=function(_0x2e3ef2,_0x3286d9){return sestek[_0x03e8('0x7f')](_0x2e3ef2,_0x3286d9)[_0x03e8('0x2a')](function(_0x3e9951){logger[_0x03e8('0x1c')](JSON[_0x03e8('0x41')](_0x3e9951));var _0x56640a={'speech':_0x3e9951[_0x03e8('0x80')],'action':_0x3e9951[_0x03e8('0x81')]?_0x3e9951['channelData']['CustomAction']:undefined,'actiondata':_0x3e9951['channelData']?_0x3e9951['channelData'][_0x03e8('0x82')]:undefined};if(_0x3e9951['channelData']&&_0x3e9951[_0x03e8('0x81')][_0x03e8('0x83')]){return base64Decode(_0x3e9951[_0x03e8('0x81')][_0x03e8('0x83')][_0x03e8('0x84')],path[_0x03e8('0x37')](__dirname,_0x03e8('0x38'),rs[_0x03e8('0x26')](0x4)+_0x03e8('0x27')))[_0x03e8('0x2a')](function(_0x4580ac){_0x56640a[_0x03e8('0x85')]=_0x4580ac;return _0x56640a;});}return _0x56640a;});};exports[_0x03e8('0x86')]=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 6a85a87..f01881b 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 _0x21ff=['./nda'];(function(_0x153f01,_0x38b1ae){var _0x22e95d=function(_0x732e60){while(--_0x732e60){_0x153f01['push'](_0x153f01['shift']());}};_0x22e95d(++_0x38b1ae);}(_0x21ff,0x9b));var _0xf21f=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x21ff[_0x350182];return _0x4a0892;};var nda=require(_0xf21f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x51cc=['./nda'];(function(_0xd307d9,_0x50e8e0){var _0x209bf8=function(_0x335069){while(--_0x335069){_0xd307d9['push'](_0xd307d9['shift']());}};_0x209bf8(++_0x50e8e0);}(_0x51cc,0x12a));var _0xc51c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x51cc[_0x138adb];return _0x1b27f2;};var nda=require(_0xc51c('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 9c14616..e9c08f8 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 _0x76f6=['username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','POST','resolve','/token','password'];(function(_0x5c3585,_0x1712bc){var _0xe3f00c=function(_0x843b36){while(--_0x843b36){_0x5c3585['push'](_0x5c3585['shift']());}};_0xe3f00c(++_0x1712bc);}(_0x76f6,0x9b));var _0x676f=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x76f6[_0x4e9d3c];return _0x2d0825;};'use strict';var rp=require(_0x676f('0x0'));var url=require(_0x676f('0x1'));var logger=require(_0x676f('0x2'))('agi');module['exports']=function(_0x8dc25b,_0x50ab34){var _0x3160bd={'method':_0x676f('0x3'),'uri':url[_0x676f('0x4')](_0x50ab34['ndauth_url'],_0x676f('0x5')),'form':{'grant_type':_0x676f('0x6'),'username':_0x50ab34[_0x676f('0x7')],'password':_0x50ab34['password']},'json':!![]};return rp(_0x3160bd)['then'](function(_0x3bc96e){var _0x3ffac7={'method':_0x676f('0x3'),'uri':url[_0x676f('0x4')](_0x50ab34[_0x676f('0x8')],_0x676f('0x9')),'body':{'type':_0x50ab34['ndaactivity_type']||'message','channelId':'Nda','conversation':{'id':_0x8dc25b['uniqueid']},'from':{'id':_0x8dc25b[_0x676f('0xa')],'name':_0x8dc25b[_0x676f('0xb')]},'recipient':{'id':_0x8dc25b[_0x676f('0xc')],'name':_0x8dc25b['extension']},'text':_0x50ab34[_0x676f('0xd')],'channelData':{}},'headers':{'Authorization':_0x676f('0xe')+_0x3bc96e[_0x676f('0xf')]},'json':!![]};if(_0x50ab34[_0x676f('0x10')]){_0x3ffac7[_0x676f('0x11')][_0x676f('0x12')]['ProjectName']=_0x50ab34[_0x676f('0x10')];}if(_0x50ab34[_0x676f('0x13')]=='1'){_0x3ffac7['body'][_0x676f('0x12')][_0x676f('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x50ab34[_0x676f('0x15')]){_0x3ffac7[_0x676f('0x11')][_0x676f('0x12')][_0x676f('0x16')]=_0x50ab34[_0x676f('0x15')];if(_0x50ab34['custom_action_data']){_0x3ffac7[_0x676f('0x11')][_0x676f('0x12')][_0x676f('0x17')]=_0x50ab34[_0x676f('0x18')];}}logger[_0x676f('0x19')](JSON[_0x676f('0x1a')](_0x3ffac7));return rp(_0x3ffac7);});}; \ No newline at end of file +var _0x52e3=['message','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','request-promise','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','password','username','then','POST','ndaactivity_type'];(function(_0x432d6e,_0x192dec){var _0x52a56a=function(_0x588e3a){while(--_0x588e3a){_0x432d6e['push'](_0x432d6e['shift']());}};_0x52a56a(++_0x192dec);}(_0x52e3,0xa2));var _0x352e=function(_0x30de90,_0x3f10d5){_0x30de90=_0x30de90-0x0;var _0x5a3e67=_0x52e3[_0x30de90];return _0x5a3e67;};'use strict';var rp=require(_0x352e('0x0'));var url=require(_0x352e('0x1'));var logger=require(_0x352e('0x2'))(_0x352e('0x3'));module['exports']=function(_0x120877,_0x4b8636){var _0x591f03={'method':'POST','uri':url[_0x352e('0x4')](_0x4b8636[_0x352e('0x5')],_0x352e('0x6')),'form':{'grant_type':_0x352e('0x7'),'username':_0x4b8636[_0x352e('0x8')],'password':_0x4b8636[_0x352e('0x7')]},'json':!![]};return rp(_0x591f03)[_0x352e('0x9')](function(_0x311f1f){var _0x2c1b62={'method':_0x352e('0xa'),'uri':url[_0x352e('0x4')](_0x4b8636['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4b8636[_0x352e('0xb')]||_0x352e('0xc'),'channelId':'Nda','conversation':{'id':_0x120877[_0x352e('0xd')]},'from':{'id':_0x120877[_0x352e('0xe')],'name':_0x120877[_0x352e('0xf')]},'recipient':{'id':_0x120877['dnid'],'name':_0x120877[_0x352e('0x10')]},'text':_0x4b8636[_0x352e('0x11')],'channelData':{}},'headers':{'Authorization':_0x352e('0x12')+_0x311f1f[_0x352e('0x13')]},'json':!![]};if(_0x4b8636[_0x352e('0x14')]){_0x2c1b62[_0x352e('0x15')][_0x352e('0x16')][_0x352e('0x17')]=_0x4b8636[_0x352e('0x14')];}if(_0x4b8636['ndagenerate_audio']=='1'){_0x2c1b62[_0x352e('0x15')]['channelData'][_0x352e('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x352e('0x19')};}if(_0x4b8636['custom_action']){_0x2c1b62[_0x352e('0x15')][_0x352e('0x16')][_0x352e('0x1a')]=_0x4b8636[_0x352e('0x1b')];if(_0x4b8636['custom_action_data']){_0x2c1b62['body'][_0x352e('0x16')]['CustomActionData']=_0x4b8636[_0x352e('0x1c')];}}logger['info'](JSON['stringify'](_0x2c1b62));return rp(_0x2c1b62);});}; \ 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 e87d20c..d7acfa8 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0xfaf50c,_0x21e05a,_0x215435,_0x135cd8){return asr(_0xfaf50c,_0x21e05a,_0x215435,_0x135cd8);}; \ No newline at end of file +var _0x882c=['exports','./lib/api'];(function(_0x3e8110,_0x2a64f4){var _0x1d201c=function(_0x57e8df){while(--_0x57e8df){_0x3e8110['push'](_0x3e8110['shift']());}};_0x1d201c(++_0x2a64f4);}(_0x882c,0xfb));var _0xc882=function(_0x2fc960,_0x5219db){_0x2fc960=_0x2fc960-0x0;var _0x3072a7=_0x882c[_0x2fc960];return _0x3072a7;};'use strict';var asr=require(_0xc882('0x0'));module[_0xc882('0x1')]=function(_0x44a0bb,_0x28f86d,_0x1f31c9,_0x5d8953){return asr(_0x44a0bb,_0x28f86d,_0x1f31c9,_0x5d8953);}; \ 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 0ad1484..d9b2238 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 _0x2a89=['unix','send','createReadStream','data','close','EOS','error','stringify','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x3a8124,_0x254d7f){var _0x2b8c85=function(_0x4c48c4){while(--_0x4c48c4){_0x3a8124['push'](_0x3a8124['shift']());}};_0x2b8c85(++_0x254d7f);}(_0x2a89,0xed));var _0x92a8=function(_0x2857f8,_0x3252c9){_0x2857f8=_0x2857f8-0x0;var _0x529949=_0x2a89[_0x2857f8];return _0x529949;};'use strict';var BPromise=require(_0x92a8('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x92a8('0x1'));var crypto=require(_0x92a8('0x2'));var logger=require(_0x92a8('0x3'))(_0x92a8('0x4'));module[_0x92a8('0x5')]=function(_0xa64790,_0x17e07c,_0x49e9d8,_0x2ab7cf){return new BPromise(function(_0x1bc9a9,_0x42500c){logger[_0x92a8('0x6')]('Tilde\x20URI',_0x2ab7cf||_0x92a8('0x7'));var _0x44f0f6=new WebSocket(_0x2ab7cf||_0x92a8('0x7'),{'perMessageDeflate':![]});var _0x1c176a='';var _0x2552dd='0';var _0x47acf8='1';var _0x1c34bb=_0x92a8('0x8');function _0x16ea81(_0x1b040d){var _0xd7655c=crypto[_0x92a8('0x9')](_0x92a8('0xa'));_0xd7655c[_0x92a8('0xb')](_0x1b040d);return _0xd7655c[_0x92a8('0xc')](_0x92a8('0xd'));}function _0x40b79f(){try{logger[_0x92a8('0x6')](_0x92a8('0xe'));var _0x2fad77=moment()[_0x92a8('0xf')]();var _0x367125=_0x16ea81(_0x2fad77+_0x17e07c+_0x49e9d8);_0x44f0f6[_0x92a8('0x10')](JSON['stringify']({'appID':_0x17e07c,'timestamp':_0x2fad77,'appKey':_0x367125}));var _0x590ff9=fs[_0x92a8('0x11')](_0xa64790);_0x590ff9['on'](_0x92a8('0x12'),function(_0x425ef0){_0x44f0f6[_0x92a8('0x10')](_0x425ef0);});_0x590ff9['on'](_0x92a8('0x13'),function(){_0x44f0f6['send'](_0x92a8('0x14'));});}catch(_0x414884){logger[_0x92a8('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0x92a8('0x16')](_0x414884));_0x44f0f6['terminate']();}}function _0x1f9dc7(_0x1b3161){try{if(_0x1b3161){var _0x13e8ee=JSON[_0x92a8('0x17')](_0x1b3161);switch(_0x13e8ee[_0x92a8('0x18')]){case 0x0:if(_0x13e8ee[_0x92a8('0x19')]){if(_0x13e8ee[_0x92a8('0x19')][_0x92a8('0x1a')]){logger[_0x92a8('0x6')](_0x92a8('0x1b'),JSON[_0x92a8('0x16')](_0x13e8ee[_0x92a8('0x19')][_0x92a8('0x1c')]));_0x1c176a=_0x13e8ee[_0x92a8('0x19')]['hypotheses'][0x0]['transcript'];_0x2552dd=_0x13e8ee[_0x92a8('0x19')][_0x92a8('0x1c')][0x0][_0x92a8('0x1d')];_0x47acf8='0';_0x1c34bb=_0x92a8('0x1e');_0x44f0f6[_0x92a8('0x1f')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x47acf8='1';_0x1c34bb=_0x92a8('0x8');break;case 0x2:logger[_0x92a8('0x6')](_0x92a8('0x20'));_0x47acf8='2';_0x1c34bb=_0x92a8('0x20');break;case 0x9:logger[_0x92a8('0x6')](_0x92a8('0x21'));_0x47acf8='9';_0x1c34bb=_0x92a8('0x21');break;case 0xa:logger[_0x92a8('0x6')](_0x92a8('0x22'));_0x47acf8='10';_0x1c34bb='Authentication\x20failed.';break;case 0xb:logger[_0x92a8('0x6')](_0x92a8('0x23'));_0x47acf8='11';_0x1c34bb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x3fcb66){logger[_0x92a8('0x15')](_0x92a8('0x24'),JSON[_0x92a8('0x16')](_0x3fcb66));_0x44f0f6[_0x92a8('0x1f')]();}}function _0xfeac65(){logger[_0x92a8('0x6')](_0x92a8('0x25'));_0x1bc9a9({'transcript':_0x1c176a,'confidence':_0x2552dd,'status':_0x47acf8,'status_message':_0x1c34bb});}function _0x4fe67e(_0x53837f){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x92a8('0x26')](_0x53837f)){logger[_0x92a8('0x15')](_[_0x92a8('0x27')](_0x53837f)?JSON[_0x92a8('0x16')](_0x53837f):_0x53837f);}}_0x44f0f6['on'](_0x92a8('0x28'),_0x40b79f);_0x44f0f6['on'](_0x92a8('0x29'),_0x1f9dc7);_0x44f0f6['on']('close',_0xfeac65);_0x44f0f6['on'](_0x92a8('0x15'),_0x4fe67e);});}; \ No newline at end of file +var _0xfebc=['Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','crypto','agi','exports','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','digest','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','close','EOS','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x1b46f5,_0x2f28c8){var _0x3cace7=function(_0x1e0458){while(--_0x1e0458){_0x1b46f5['push'](_0x1b46f5['shift']());}};_0x3cace7(++_0x2f28c8);}(_0xfebc,0x190));var _0xcfeb=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0xfebc[_0x1073ad];return _0x528474;};'use strict';var BPromise=require(_0xcfeb('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcfeb('0x1'));var crypto=require(_0xcfeb('0x2'));var logger=require('../../../../../../config/logger')(_0xcfeb('0x3'));module[_0xcfeb('0x4')]=function(_0x5e69ef,_0x834c5c,_0x591689,_0x2682f1){return new BPromise(function(_0x429518,_0x1a54f3){logger['info'](_0xcfeb('0x5'),_0x2682f1||_0xcfeb('0x6'));var _0x36291e=new WebSocket(_0x2682f1||_0xcfeb('0x6'),{'perMessageDeflate':![]});var _0x1c0b61='';var _0x480af3='0';var _0xfc4aad='1';var _0x19ef3e=_0xcfeb('0x7');function _0x45321c(_0x5ad203){var _0x54f7f8=crypto[_0xcfeb('0x8')]('sha1');_0x54f7f8['update'](_0x5ad203);return _0x54f7f8[_0xcfeb('0x9')]('hex');}function _0x49d68a(){try{logger[_0xcfeb('0xa')](_0xcfeb('0xb'));var _0x7f6f3=moment()['unix']();var _0x13dec6=_0x45321c(_0x7f6f3+_0x834c5c+_0x591689);_0x36291e[_0xcfeb('0xc')](JSON[_0xcfeb('0xd')]({'appID':_0x834c5c,'timestamp':_0x7f6f3,'appKey':_0x13dec6}));var _0x5cdd8b=fs[_0xcfeb('0xe')](_0x5e69ef);_0x5cdd8b['on']('data',function(_0x51c05e){_0x36291e[_0xcfeb('0xc')](_0x51c05e);});_0x5cdd8b['on'](_0xcfeb('0xf'),function(){_0x36291e[_0xcfeb('0xc')](_0xcfeb('0x10'));});}catch(_0x322f2f){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0xcfeb('0xd')](_0x322f2f));_0x36291e['terminate']();}}function _0x2f954c(_0x201029){try{if(_0x201029){var _0x18fcb6=JSON['parse'](_0x201029);switch(_0x18fcb6[_0xcfeb('0x11')]){case 0x0:if(_0x18fcb6[_0xcfeb('0x12')]){if(_0x18fcb6[_0xcfeb('0x12')][_0xcfeb('0x13')]){logger[_0xcfeb('0xa')](_0xcfeb('0x14'),JSON[_0xcfeb('0xd')](_0x18fcb6[_0xcfeb('0x12')][_0xcfeb('0x15')]));_0x1c0b61=_0x18fcb6[_0xcfeb('0x12')]['hypotheses'][0x0][_0xcfeb('0x16')];_0x480af3=_0x18fcb6['result'][_0xcfeb('0x15')][0x0]['likelihood'];_0xfc4aad='0';_0x19ef3e=_0xcfeb('0x17');_0x36291e['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xfc4aad='1';_0x19ef3e=_0xcfeb('0x7');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xfc4aad='2';_0x19ef3e='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xcfeb('0x18'));_0xfc4aad='9';_0x19ef3e=_0xcfeb('0x18');break;case 0xa:logger[_0xcfeb('0xa')](_0xcfeb('0x19'));_0xfc4aad='10';_0x19ef3e='Authentication\x20failed.';break;case 0xb:logger[_0xcfeb('0xa')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xfc4aad='11';_0x19ef3e='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x100b78){logger[_0xcfeb('0x1a')](_0xcfeb('0x1b'),JSON[_0xcfeb('0xd')](_0x100b78));_0x36291e['terminate']();}}function _0x50f0ff(){logger[_0xcfeb('0xa')](_0xcfeb('0x1c'));_0x429518({'transcript':_0x1c0b61,'confidence':_0x480af3,'status':_0xfc4aad,'status_message':_0x19ef3e});}function _0x1d1eac(_0x1e13a2){logger[_0xcfeb('0x1a')](_0xcfeb('0x1d'));if(!_['isNil'](_0x1e13a2)){logger[_0xcfeb('0x1a')](_[_0xcfeb('0x1e')](_0x1e13a2)?JSON[_0xcfeb('0xd')](_0x1e13a2):_0x1e13a2);}}_0x36291e['on'](_0xcfeb('0x1f'),_0x49d68a);_0x36291e['on'](_0xcfeb('0x20'),_0x2f954c);_0x36291e['on']('close',_0x50f0ff);_0x36291e['on'](_0xcfeb('0x1a'),_0x1d1eac);});}; \ 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 c3dd852..09c3baa 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 _0xd8dc=['exports'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xd8dc,0x1f0));var _0xcd8d=function(_0x2b4d8c,_0x43c175){_0x2b4d8c=_0x2b4d8c-0x0;var _0xaca561=_0xd8dc[_0x2b4d8c];return _0xaca561;};var asr=require('./asr');module[_0xcd8d('0x0')]={'asr':asr}; \ No newline at end of file +var _0xd912=['exports','./asr'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xd912,0x1b9));var _0x2d91=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd912[_0x19e35c];return _0x3e1fe8;};var asr=require(_0x2d91('0x0'));module[_0x2d91('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f49723b..2f5b6c3 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 _0x3f59=['listening','connection','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','nextTick','inherits','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x3f59,0x1b0));var _0x93f5=function(_0x4b5d92,_0x1e45bc){_0x4b5d92=_0x4b5d92-0x0;var _0x5c73f5=_0x3f59[_0x4b5d92];return _0x5c73f5;};'use strict';var util=require(_0x93f5('0x0'));var net=require(_0x93f5('0x1'));var EventEmitter=require('events')[_0x93f5('0x2')];var AGIError=require(_0x93f5('0x3'));var AGIChannel=require(_0x93f5('0x4'));var AGIServer=function(_0xcea971,_0x2e1dfe,_0x21ac17){var _0x374022=this,_0xcea971=_0xcea971||0x11dd,_0x2e1dfe=_0x2e1dfe||_0x93f5('0x5'),_0x4dd06b=null,_0x565ad3=0x0;EventEmitter[_0x93f5('0x6')](_0x374022);function _0x1e7b4d(){if(!_0xcea971){_0x374022[_0x93f5('0x7')](_0x93f5('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x4dd06b=net['createServer']();_0x4dd06b['listen'](_0xcea971,_0x2e1dfe);_0x4dd06b['on']('listening',function(){_0x374022[_0x93f5('0x7')](_0x93f5('0x9'));});_0x4dd06b['on'](_0x93f5('0xa'),function(_0xe2e487){_0x4dd06b['getConnections'](function(_0x559793,_0x364b63){if(_0x559793){_0x374022[_0x93f5('0x7')](_0x93f5('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x559793));}else if(_0x21ac17&&_0x21ac17<0x0){_0x374022[_0x93f5('0x7')]('error',new AGIError(_0x93f5('0xb')));_0xe2e487[_0x93f5('0xc')]();}else if(_0x21ac17&&_0x21ac17>0x0&&_0x21ac17<_0x364b63){_0x565ad3+=0x1;_0x374022[_0x93f5('0x7')](_0x93f5('0x8'),new AGIError(_0x93f5('0xd'),_0x565ad3));_0xe2e487[_0x93f5('0xc')]();}else{var _0x5d6001=new AGIChannel(_0xe2e487);_0x5d6001['on'](_0x93f5('0xe'),function(){_0x374022[_0x93f5('0x7')](_0x93f5('0xa'),_0x5d6001);});}});});_0x4dd06b['on'](_0x93f5('0x8'),function(_0x316fb2){_0x374022[_0x93f5('0x7')](_0x93f5('0x8'),new AGIError(_0x93f5('0xf'),_0x316fb2[_0x93f5('0x10')]));});_0x4dd06b['on'](_0x93f5('0x11'),function(){_0x374022[_0x93f5('0x7')](_0x93f5('0x11'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x93f5('0x12')](function(){_0x1e7b4d();});};util[_0x93f5('0x13')](AGIServer,EventEmitter);module[_0x93f5('0x14')]=function(_0x32b798,_0x22452d,_0x569c0c){return new AGIServer(_0x32b798,_0x22452d,_0x569c0c);}; \ No newline at end of file +var _0xccdc=['listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','nextTick','inherits','exports','util','net','./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x344545,_0x5c3da2){var _0x3c37ae=function(_0x16e1c4){while(--_0x16e1c4){_0x344545['push'](_0x344545['shift']());}};_0x3c37ae(++_0x5c3da2);}(_0xccdc,0x1c4));var _0xcccd=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xccdc[_0x36c5b0];return _0xf19333;};'use strict';var util=require(_0xcccd('0x0'));var net=require(_0xcccd('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require(_0xcccd('0x2'));var AGIChannel=require(_0xcccd('0x3'));var AGIServer=function(_0x1d2186,_0x183a99,_0x41cab2){var _0x2ec68c=this,_0x1d2186=_0x1d2186||0x11dd,_0x183a99=_0x183a99||'127.0.0.1',_0x2da46a=null,_0x18365a=0x0;EventEmitter[_0xcccd('0x4')](_0x2ec68c);function _0x270368(){if(!_0x1d2186){_0x2ec68c[_0xcccd('0x5')](_0xcccd('0x6'),new AGIError(_0xcccd('0x7')));return![];}_0x2da46a=net[_0xcccd('0x8')]();_0x2da46a[_0xcccd('0x9')](_0x1d2186,_0x183a99);_0x2da46a['on'](_0xcccd('0xa'),function(){_0x2ec68c['emit'](_0xcccd('0xa'));});_0x2da46a['on'](_0xcccd('0xb'),function(_0x3687df){_0x2da46a[_0xcccd('0xc')](function(_0x2dff2f,_0x2cba03){if(_0x2dff2f){_0x2ec68c[_0xcccd('0x5')](_0xcccd('0x6'),new AGIError(_0xcccd('0xd'),_0x2dff2f));}else if(_0x41cab2&&_0x41cab2<0x0){_0x2ec68c[_0xcccd('0x5')](_0xcccd('0x6'),new AGIError(_0xcccd('0xe')));_0x3687df[_0xcccd('0xf')]();}else if(_0x41cab2&&_0x41cab2>0x0&&_0x41cab2<_0x2cba03){_0x18365a+=0x1;_0x2ec68c[_0xcccd('0x5')](_0xcccd('0x6'),new AGIError(_0xcccd('0x10'),_0x18365a));_0x3687df[_0xcccd('0xf')]();}else{var _0x2b172f=new AGIChannel(_0x3687df);_0x2b172f['on']('ready',function(){_0x2ec68c['emit'](_0xcccd('0xb'),_0x2b172f);});}});});_0x2da46a['on'](_0xcccd('0x6'),function(_0x3696dd){_0x2ec68c['emit'](_0xcccd('0x6'),new AGIError(_0xcccd('0xd'),_0x3696dd[_0xcccd('0x11')]));});_0x2da46a['on']('close',function(){_0x2ec68c[_0xcccd('0x5')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xcccd('0x12')](function(){_0x270368();});};util[_0xcccd('0x13')](AGIServer,EventEmitter);module[_0xcccd('0x14')]=function(_0xa5a57f,_0x3a1b0a,_0x1403d8){return new AGIServer(_0xa5a57f,_0x3a1b0a,_0x1403d8);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index bcf4954..685777f 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 _0xef66=['tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','shelljs','odbc','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','mailRpc','rpc','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','interval','map','format','%s/sounds/converted/%s','open','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','replace','googleCloudTTS','apiKey','languageCode','en-US','ssmlGender','audioEncoding','googleTTS','text','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','getVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','exec','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','getdigits','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','createSquareRecording','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','service','host','port','authentication','auth','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created'];(function(_0x29cb9b,_0x247dd1){var _0x544ff3=function(_0x5919b2){while(--_0x5919b2){_0x29cb9b['push'](_0x29cb9b['shift']());}};_0x544ff3(++_0x247dd1);}(_0xef66,0x1db));var _0x6ef6=function(_0x6b1e77,_0x10b1c5){_0x6b1e77=_0x6b1e77-0x0;var _0x5d61e6=_0xef66[_0x6b1e77];return _0x5d61e6;};'use strict';var fs=require('fs');var path=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var _=require(_0x6ef6('0x2'));var sh=require(_0x6ef6('0x3'));var odbc=require(_0x6ef6('0x4'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x6ef6('0x5'));var rp=require(_0x6ef6('0x6'));var logger=require(_0x6ef6('0x7'))(_0x6ef6('0x8'));var config=require(_0x6ef6('0x9'));var scripts=require(_0x6ef6('0xa'));var FILES_PATH=_0x6ef6('0xb');var recursiveMapAttributes=[_0x6ef6('0xc'),_0x6ef6('0xd')];var verticesWithRetry=['menu','getdigits',_0x6ef6('0xe')];var AGIVertices=function(_0xeccd37,_0x1be0c5,_0x391e0e){this[_0x6ef6('0xf')]=_0xeccd37;this['rpc']=_0x1be0c5;this[_0x6ef6('0x10')]=_0x391e0e;};AGIVertices['prototype']['getVariable']=function(_0x220b9e,_0x5e298d){this[_0x6ef6('0x11')][_0x6ef6('0x12')](_0x220b9e)[_0x6ef6('0x13')](function(_0x331113){_0x5e298d(null,_0x331113?_0x331113['name']:![]);})[_0x6ef6('0x14')](function(_0x22b44e){_0x5e298d(_0x22b44e);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x16')]=function(_0x5ba663,_0x265583){this['rpc'][_0x6ef6('0x17')](_0x5ba663)[_0x6ef6('0x13')](function(_0x587806){_0x265583(null,_0x587806?_0x587806[_0x6ef6('0x18')]:![]);})[_0x6ef6('0x14')](function(_0x453aa3){_0x265583(_0x453aa3);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x19')]=function(_0x2e6eb6,_0x4ea222){this[_0x6ef6('0x11')][_0x6ef6('0x1a')](_0x2e6eb6)[_0x6ef6('0x13')](function(_0x53586d){_0x4ea222(null,_0x53586d?_0x53586d[_0x6ef6('0x18')]:![]);})[_0x6ef6('0x14')](function(_0x292af9){_0x4ea222(_0x292af9);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x1b')]=function(_0x2e6e52,_0xb9a5fa){this['rpc'][_0x6ef6('0x1c')](_0x2e6e52)[_0x6ef6('0x13')](function(_0x2903ea){_0xb9a5fa(null,_0x2903ea?_0x2903ea[_0x6ef6('0x1d')]:![]);})['catch'](function(_0x164ed9){_0xb9a5fa(_0x164ed9);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x1e')]=function(_0x4f6df6,_0x4257d8){this[_0x6ef6('0x11')]['getUserById'](_0x4f6df6)[_0x6ef6('0x13')](function(_0x3c225f){_0x4257d8(null,_0x3c225f?_0x3c225f['name']:![]);})[_0x6ef6('0x14')](function(_0xb1c6b0){_0x4257d8(_0xb1c6b0);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x1f')]=function(_0x43bb8d,_0x3246df){this[_0x6ef6('0x11')]['getTrunkById'](_0x43bb8d)[_0x6ef6('0x13')](function(_0x503379){_0x3246df(null,_0x503379?_0x503379[_0x6ef6('0x18')]:![]);})[_0x6ef6('0x14')](function(_0x443ded){_0x3246df(_0x443ded);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x20')]=function(_0xf69d3d,_0x23eb77){var _0x3e027d=this;this[_0x6ef6('0x11')][_0x6ef6('0x21')](_0xf69d3d)[_0x6ef6('0x13')](function(_0x2d87a8){_0x23eb77(null,_0x2d87a8?_0x3e027d[_0x6ef6('0x22')](_0x2d87a8[_0x6ef6('0x23')]):![]);})[_0x6ef6('0x14')](function(_0x2e4bed){_0x23eb77(_0x2e4bed);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x24')]=function(_0x24eeae,_0x23f979){this['rpc'][_0x6ef6('0x25')](_0x24eeae)['then'](function(_0xce3e82){_0x23f979(null,_0xce3e82?_0xce3e82:![]);})[_0x6ef6('0x14')](function(_0x186137){_0x23f979(_0x186137);});};AGIVertices['prototype']['sendMailMessage']=function(_0xd97cd0,_0x300051,_0x335b1d){this['mailRpc'][_0x6ef6('0x26')](_0xd97cd0,_0x300051)['then'](function(){_0x335b1d(null);})[_0x6ef6('0x14')](function(_0x4e299f){_0x335b1d(_0x4e299f);});};AGIVertices['prototype']['getIntervals']=function(_0x31a564,_0x5395a3){this[_0x6ef6('0x11')]['getIntervalById'](_0x31a564)[_0x6ef6('0x13')](function(_0x4b8d24){if(_0x4b8d24){if(_0x4b8d24['IntervalId']){_0x5395a3(null,[_0x4b8d24[_0x6ef6('0x27')]]);}else{_0x5395a3(null,_[_0x6ef6('0x28')](_0x4b8d24['Intervals'],_0x6ef6('0x27')));}}else{_0x5395a3(null,![]);}})['catch'](function(_0xf1aaf2){_0x5395a3(_0xf1aaf2);});};AGIVertices['prototype'][_0x6ef6('0x22')]=function(_0x5cf0ea){return util[_0x6ef6('0x29')](_0x6ef6('0x2a'),FILES_PATH,_0x5cf0ea);};AGIVertices[_0x6ef6('0x15')]['getQueryOdbc']=function(_0x546bc3,_0xf186c1,_0x101427){odbc[_0x6ef6('0x2b')](_0x546bc3,function(_0x2f3f3e){if(_0x2f3f3e){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x2f3f3e);_0x101427(_0x2f3f3e);}else{logger[_0x6ef6('0x2c')]('ODBC\x20connection\x20successfully');odbc['query'](_0xf186c1,function(_0x37a8b7,_0x4bb91c){if(_0x37a8b7){logger[_0x6ef6('0x2c')](_0x6ef6('0x2d'),_0xf186c1);_0x101427(_0x37a8b7);}else{logger[_0x6ef6('0x2c')](_0x6ef6('0x2e'),_0xf186c1);odbc[_0x6ef6('0x2f')](function(_0xed6093){if(_0xed6093){logger[_0x6ef6('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xed6093);}_0x101427(null,_0x4bb91c);});}});}});};AGIVertices[_0x6ef6('0x15')]['getSmsAccount']=function(_0x522399,_0x31696e){this[_0x6ef6('0x11')][_0x6ef6('0x31')](_0x522399)['then'](function(_0x335afd){_0x31696e(null,_0x335afd?_0x335afd:![]);})[_0x6ef6('0x14')](function(_0x215529){_0x31696e(_0x215529);});};AGIVertices['prototype'][_0x6ef6('0x32')]=function(_0x22c1c3,_0x19a0ab){this[_0x6ef6('0x11')][_0x6ef6('0x32')](_0x22c1c3)[_0x6ef6('0x13')](function(_0x459a64){_0x19a0ab(null,_0x459a64);})[_0x6ef6('0x14')](function(_0x2c03a7){_0x19a0ab(_0x2c03a7);});};AGIVertices[_0x6ef6('0x15')]['createSquareDetailsReport']=function(_0xf46913,_0x174827,_0x3be8e3){this[_0x6ef6('0x11')][_0x6ef6('0x33')]({'uniqueid':this[_0x6ef6('0xf')][_0x6ef6('0x34')],'node':_0xf46913[_0x6ef6('0x35')],'application':_0xf46913[_0x6ef6('0x36')],'data':_0x174827||null,'project_name':this[_0x6ef6('0xf')][_0x6ef6('0x37')],'callerid':this['channel'][_0x6ef6('0x38')]})['then'](function(_0x3d7e71){if(_0x3be8e3){_0x3be8e3(null,_0x3d7e71);}})['catch'](function(_0x2b7b21){if(_0x3be8e3){_0x3be8e3(_0x2b7b21);}});};AGIVertices[_0x6ef6('0x15')]['createSquareRecording']=function(_0x3c57e0,_0x258704,_0x49efb6,_0x15e91e){this[_0x6ef6('0x11')]['createSquareRecording']({'uniqueid':this[_0x6ef6('0xf')][_0x6ef6('0x34')],'callerid':this[_0x6ef6('0xf')][_0x6ef6('0x38')],'calleridname':this[_0x6ef6('0xf')][_0x6ef6('0x39')],'context':this[_0x6ef6('0xf')][_0x6ef6('0x3a')],'extension':this['channel'][_0x6ef6('0x3b')],'priority':this[_0x6ef6('0xf')]['priority'],'accountcode':this['channel'][_0x6ef6('0x3c')],'dnid':this['channel'][_0x6ef6('0x3d')],'projectName':this['channel'][_0x6ef6('0x37')],'saveName':_0x258704,'filename':_0x3c57e0[_0x6ef6('0x3e')]||_0x258704,'savePath':_0x49efb6})[_0x6ef6('0x13')](function(_0x312612){_0x15e91e(null,_0x312612);})['catch'](function(_0x5db34a){_0x15e91e(_0x5db34a);});};AGIVertices['prototype']['createSquareMessage']=function(_0x2fdb50,_0x11bab8,_0x19c0f4,_0x5bc4bf,_0x41beef){this[_0x6ef6('0x11')][_0x6ef6('0x3f')]({'uniqueid':this[_0x6ef6('0xf')][_0x6ef6('0x34')],'body':_0x2fdb50,'direction':_0x11bab8,'providerName':_0x19c0f4,'providerResponse':_0x5bc4bf})[_0x6ef6('0x13')](function(_0x3dfbab){if(_0x41beef){_0x41beef(null,_0x3dfbab);}})['catch'](function(_0x260497){if(_0x41beef){_0x41beef(_0x260497);}});};AGIVertices['prototype'][_0x6ef6('0x40')]=function(_0x3549e9,_0x511a43){this['rpc'][_0x6ef6('0x40')]({'firstName':_[_0x6ef6('0x41')](_0x3549e9[_0x6ef6('0x18')])||_[_0x6ef6('0x42')](_0x3549e9[_0x6ef6('0x18')])?_0x6ef6('0x43')+Math[_0x6ef6('0x44')]():_0x3549e9['name'],'lastName':_[_0x6ef6('0x41')](_0x3549e9[_0x6ef6('0x45')])||_[_0x6ef6('0x42')](_0x3549e9['lastName'])?null:_0x3549e9[_0x6ef6('0x45')],'phone':_0x3549e9[_0x6ef6('0x46')],'ListId':_0x3549e9['list_id'],'scheduledat':_0x3549e9[_0x6ef6('0x47')],'callbackUniqueid':this[_0x6ef6('0xf')][_0x6ef6('0x34')],'tags':_0x6ef6('0x48'),'description':_0x6ef6('0x49')+_0x3549e9[_0x6ef6('0x47')][_0x6ef6('0x4a')](),'priority':_0x3549e9[_0x6ef6('0x4b')]})['then'](function(_0x2cec2a){_0x511a43(null,_0x2cec2a);})[_0x6ef6('0x14')](function(_0x329233){_0x511a43(_0x329233);});};AGIVertices[_0x6ef6('0x15')]['getPause']=function(_0x286a1e,_0x5b3aee){this[_0x6ef6('0x11')][_0x6ef6('0x4c')](_0x286a1e)[_0x6ef6('0x13')](function(_0x4b0066){_0x5b3aee(null,_0x4b0066?_0x4b0066[_0x6ef6('0x18')]:![]);})[_0x6ef6('0x14')](function(_0x56a627){_0x5b3aee(_0x56a627);});};AGIVertices['prototype'][_0x6ef6('0x4d')]=function(_0x287f39,_0x10aec9,_0x59a1f7){var _0x266d2e={'role':'agent'};_0x266d2e[_0x287f39]=this['channel'][_0x6ef6('0x38')];this[_0x6ef6('0x11')]['agentPause'](_0x266d2e,_0x10aec9,this[_0x6ef6('0xf')][_0x6ef6('0x34')])[_0x6ef6('0x13')](function(_0x3f3c63){_0x59a1f7(null,_['isNil'](_0x3f3c63)?![]:!![]);})[_0x6ef6('0x14')](function(_0x3b886c){logger[_0x6ef6('0x30')](_0x3b886c);_0x59a1f7(null,![]);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x4e')]=function(_0x2f7551,_0x573361){var _0x4c9630={'role':'agent'};_0x4c9630[_0x2f7551]=this[_0x6ef6('0xf')][_0x6ef6('0x38')];this[_0x6ef6('0x11')][_0x6ef6('0x4e')](_0x4c9630)[_0x6ef6('0x13')](function(_0x3de2f3){_0x573361(null,_[_0x6ef6('0x42')](_0x3de2f3)?![]:!![]);})[_0x6ef6('0x14')](function(_0x338b57){logger[_0x6ef6('0x30')](_0x338b57);_0x573361(null,![]);});};AGIVertices[_0x6ef6('0x15')]['agentLogout']=function(_0x42b112,_0x3c5802){var _0x4c9186={'role':_0x6ef6('0x4f')};_0x4c9186[_0x42b112]=this[_0x6ef6('0xf')][_0x6ef6('0x38')];this[_0x6ef6('0x11')][_0x6ef6('0x50')](_0x4c9186)['then'](function(_0x28f39b){_0x3c5802(null,_['isNil'](_0x28f39b)?![]:!![]);})[_0x6ef6('0x14')](function(_0x2fc349){logger[_0x6ef6('0x30')](_0x2fc349);_0x3c5802(null,![]);});};AGIVertices['prototype'][_0x6ef6('0x51')]=function(_0x26ab4d,_0x1999df){var _0x43e63b={'role':'agent'};_0x43e63b[_0x26ab4d]=this[_0x6ef6('0xf')][_0x6ef6('0x38')];var _0x22af41=_0x26ab4d!=_0x6ef6('0x52')?util[_0x6ef6('0x29')](_0x6ef6('0x53'),_0x6ef6('0x54'),this[_0x6ef6('0xf')][_0x6ef6('0x38')]):undefined;this[_0x6ef6('0x11')]['agentLogin'](_0x43e63b,_0x22af41)[_0x6ef6('0x13')](function(_0x4020ab){_0x1999df(null,_[_0x6ef6('0x42')](_0x4020ab)?![]:!![]);})[_0x6ef6('0x14')](function(_0x5ef38d){logger[_0x6ef6('0x30')](_0x5ef38d);_0x1999df(null,![]);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x55')]=function(_0x178978,_0x33a532){sh['exec'](_['trim'](_0x178978),function(_0x25ab5f,_0x49a26b){var _0x34f9ea=_0x49a26b[_0x6ef6('0x56')](/(\r\n|\n|\r)/gm,'');_0x33a532(null,_0x34f9ea);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x57')]=function(_0x290e99,_0x361f87){scripts[_0x6ef6('0x57')](_0x290e99[_0x6ef6('0x58')],_0x290e99['google_cloud_tts_text_type']||'text',_0x290e99['text'],_0x290e99[_0x6ef6('0x59')]||_0x6ef6('0x5a'),_0x290e99[_0x6ef6('0x5b')]||'MALE',_0x290e99[_0x6ef6('0x5c')]||'MP3')['then'](function(_0x23b7c3){_0x361f87(null,_0x23b7c3);})[_0x6ef6('0x14')](function(_0x576174){_0x361f87(_0x576174);});};AGIVertices['prototype'][_0x6ef6('0x5d')]=function(_0x594422,_0x5f0fd2){scripts[_0x6ef6('0x5d')](_0x594422[_0x6ef6('0x5e')],_0x594422[_0x6ef6('0x5f')]||'en',0x1)[_0x6ef6('0x13')](function(_0x1d1da7){_0x5f0fd2(null,_0x1d1da7);})[_0x6ef6('0x14')](function(_0x529853){_0x5f0fd2(_0x529853);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x60')]=function(_0xce25b0,_0x4af6cf){var _0x429b84={'uri':_0xce25b0[_0x6ef6('0x61')],'method':_0xce25b0[_0x6ef6('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xce25b0[_0x6ef6('0x63')])==='number'&&parseInt(_0xce25b0[_0x6ef6('0x63')])>=0x1?parseInt(_0xce25b0['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x6ef6('0x64')]([_0x6ef6('0x65'),_0x6ef6('0x66')],_0x429b84[_0x6ef6('0x62')][_0x6ef6('0x67')]())){try{_0x429b84[_0x6ef6('0x68')]=_0xce25b0[_0x6ef6('0xd')]?JSON[_0x6ef6('0x69')](_0xce25b0[_0x6ef6('0xd')]):{};}catch(_0x2dd9e8){logger['error'](_0x6ef6('0x6a'),_0x2dd9e8);}}try{_0x429b84[_0x6ef6('0x6b')]=_0xce25b0[_0x6ef6('0xc')]?JSON[_0x6ef6('0x69')](_0xce25b0[_0x6ef6('0xc')]):{};}catch(_0x283896){logger[_0x6ef6('0x30')](_0x6ef6('0x6c'),_0x283896);}if(_0xce25b0['computedVariables']){try{var _0x3c3d27=require(_0xce25b0['computedVariables'])[_0x6ef6('0x6d')](this,_0x429b84);_0x429b84['uri']=Mustache[_0x6ef6('0x6e')](_0xce25b0[_0x6ef6('0x61')],_0x3c3d27,{},['$$','$$']);if(_0x429b84[_0x6ef6('0x6b')]){_0x429b84['headers']=JSON['parse'](Mustache[_0x6ef6('0x6e')](JSON[_0x6ef6('0x6f')](_0x429b84['headers']),_0x3c3d27,{},['$$','$$']));}if(_0x429b84[_0x6ef6('0x68')]){_0x429b84[_0x6ef6('0x68')]=JSON[_0x6ef6('0x69')](Mustache[_0x6ef6('0x6e')](JSON[_0x6ef6('0x6f')](_0x429b84[_0x6ef6('0x68')]),_0x3c3d27,{},['$$','$$']));}}catch(_0x1a3d42){logger[_0x6ef6('0x30')](_0x6ef6('0x70'),_0x1a3d42);}}rp(_0x429b84)[_0x6ef6('0x13')](function(_0x37bffb){var _0x1c0320={'statusCode':_0x37bffb['statusCode']||0xc8,'statusMessage':_0x37bffb[_0x6ef6('0x71')]||'OK','headers':_0x37bffb[_0x6ef6('0x6b')]||{},'body':_0x37bffb['body']||{}};_0x4af6cf(null,_0x1c0320);})['catch'](function(_0x79816c){var _0x45950f={'statusCode':_0x79816c[_0x6ef6('0x72')]||0x1f4,'statusMessage':_0x79816c[_0x6ef6('0x73')]||_0x6ef6('0x74'),'headers':_0x79816c[_0x6ef6('0x75')][_0x6ef6('0x6b')]||{},'body':_0x79816c['options'][_0x6ef6('0x68')]||{}};_0x4af6cf(null,_0x45950f);});};AGIVertices['prototype'][_0x6ef6('0x76')]=function(_0x29b137,_0x2cda86){scripts[_0x6ef6('0x76')](this[_0x6ef6('0xf')]['uniqueid'],_0x29b137[_0x6ef6('0x77')],_0x29b137[_0x6ef6('0x5e')],_0x29b137[_0x6ef6('0x78')]||'en')['then'](function(_0x360fbb){_0x2cda86(null,_0x360fbb);})['catch'](function(_0x19c241){_0x2cda86(_0x19c241);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x5bb2ec,_0x3287bc){scripts[_0x6ef6('0x79')](this[_0x6ef6('0xf')][_0x6ef6('0x34')],_0x5bb2ec[_0x6ef6('0x7a')],_0x5bb2ec['client_email'],_0x5bb2ec[_0x6ef6('0x7b')],_0x5bb2ec[_0x6ef6('0x5e')],_0x5bb2ec['dialogflowV2_language']||'en')[_0x6ef6('0x13')](function(_0x20b1a3){_0x3287bc(null,_0x20b1a3);})[_0x6ef6('0x14')](function(_0x4d953e){_0x3287bc(_0x4d953e);});};AGIVertices[_0x6ef6('0x15')]['sestekNDA']=function(_0x2b4ab9,_0x3dc5e4){scripts[_0x6ef6('0x7c')](this[_0x6ef6('0xf')],_0x2b4ab9)[_0x6ef6('0x13')](function(_0x4fd850){_0x3dc5e4(null,_0x4fd850);})['catch'](function(_0x9ac884){_0x3dc5e4(_0x9ac884);});};AGIVertices[_0x6ef6('0x15')]['ispeechTTS']=function(_0x2206e3,_0x26ddc9){scripts[_0x6ef6('0x7d')](_0x2206e3[_0x6ef6('0x77')],_0x2206e3[_0x6ef6('0x5e')],_0x2206e3['ispeech_tts_language']||_0x6ef6('0x5a'),_0x2206e3['speed'])['then'](function(_0xf7d22){_0x26ddc9(null,_0xf7d22);})[_0x6ef6('0x14')](function(_0x15aa26){_0x26ddc9(_0x15aa26);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x7e')]=function(_0x1d80bb,_0x5daf60,_0x354f74){scripts[_0x6ef6('0x7e')](_0x5daf60,_0x1d80bb['key'],_0x1d80bb[_0x6ef6('0x7f')]||'en-US',this[_0x6ef6('0x80')](_0x1d80bb[_0x6ef6('0x81')])?_0x1d80bb[_0x6ef6('0x81')]:undefined)['then'](function(_0x30f310){_0x354f74(null,_0x30f310);})[_0x6ef6('0x14')](function(_0x24ef26){_0x354f74(_0x24ef26);});};AGIVertices[_0x6ef6('0x15')]['awsPolly']=function(_0xfff13f,_0x3fcf72){scripts[_0x6ef6('0x82')](_0xfff13f[_0x6ef6('0x83')],_0xfff13f[_0x6ef6('0x84')],_0xfff13f['aws_polly_region'],_0xfff13f[_0x6ef6('0x85')]||_0x6ef6('0x86'),_0xfff13f[_0x6ef6('0x5e')],_0xfff13f[_0x6ef6('0x87')]||_0x6ef6('0x5e'))[_0x6ef6('0x13')](function(_0x2a2aaa){_0x3fcf72(null,_0x2a2aaa);})[_0x6ef6('0x14')](function(_0x52757a){_0x3fcf72(_0x52757a);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x88')]=function(_0x4a9c6c,_0x5ec655){scripts['awsLex'](this[_0x6ef6('0xf')][_0x6ef6('0x34')],_0x4a9c6c[_0x6ef6('0x83')],_0x4a9c6c['aws_secret_access_key'],_0x4a9c6c[_0x6ef6('0x89')],_0x4a9c6c[_0x6ef6('0x5e')],_0x4a9c6c['aws_bot_name'])['then'](function(_0x56429d){_0x5ec655(null,_0x56429d);})['catch'](function(_0x195cea){_0x5ec655(_0x195cea);});};AGIVertices['prototype'][_0x6ef6('0x8a')]=function(_0x188949,_0x1254f3,_0x2baa06){scripts[_0x6ef6('0x8a')](_0x1254f3,_0x188949[_0x6ef6('0x77')],_0x188949[_0x6ef6('0x8b')]||'en-US')[_0x6ef6('0x13')](function(_0x3aa7f9){_0x2baa06(null,_0x3aa7f9);})[_0x6ef6('0x14')](function(_0x2d88dc){_0x2baa06(_0x2d88dc);});};AGIVertices[_0x6ef6('0x15')]['tildeASR']=function(_0x3144e8,_0xa61bf9,_0x4bf0fd){scripts[_0x6ef6('0x8c')](_0xa61bf9,_0x3144e8[_0x6ef6('0x8d')],_0x3144e8['appsecret'],_0x3144e8[_0x6ef6('0x8e')])[_0x6ef6('0x13')](function(_0x2f7640){_0x4bf0fd(null,_0x2f7640);})[_0x6ef6('0x14')](function(_0x28858f){_0x4bf0fd(_0x28858f);});};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x8f')]=function(_0x50d124){var _0x58424a=_['includes'](verticesWithRetry,_0x50d124['agicommand'])?_0x50d124:_[_0x6ef6('0x90')](_0x50d124);for(var _0x1f61d3 in _0x58424a){if(_0x58424a[_0x6ef6('0x91')](_0x1f61d3)){if(_0x58424a[_0x1f61d3]&&_[_0x6ef6('0x92')](_0x58424a[_0x1f61d3])){if(_[_0x6ef6('0x64')](recursiveMapAttributes,_0x1f61d3)){_0x58424a[_0x1f61d3]=this[_0x6ef6('0x93')](_0x58424a[_0x1f61d3]);}else{_0x58424a[_0x1f61d3]=this[_0x6ef6('0x94')](_0x58424a[_0x1f61d3]);}}}}return _0x58424a;};AGIVertices['prototype'][_0x6ef6('0x95')]=function(_0x59c278){for(var _0x3d67cd in _0x59c278){if(_0x59c278[_0x6ef6('0x91')](_0x3d67cd)){if(_[_0x6ef6('0x96')](_0x59c278[_0x3d67cd])){this['recursiveNodeIndex'](_0x59c278[_0x3d67cd]);}else if(_[_0x6ef6('0x97')](_0x59c278[_0x3d67cd])){for(var _0x1d2244=0x0;_0x1d2244<_0x59c278[_0x3d67cd][_0x6ef6('0x98')];_0x1d2244++){this[_0x6ef6('0x95')](_0x59c278[_0x3d67cd][_0x1d2244]);}}else if(_['isString'](_0x59c278[_0x3d67cd])){_0x59c278[_0x3d67cd]=this[_0x6ef6('0x94')](_0x59c278[_0x3d67cd]);}}}};AGIVertices['prototype'][_0x6ef6('0x99')]=function(_0x39779a,_0x42278d){for(var _0x501aa5 in _0x39779a){if(_0x39779a['hasOwnProperty'](_0x501aa5)){if(_['isPlainObject'](_0x39779a[_0x501aa5])){if(!_[_0x6ef6('0x41')](_0x39779a[_0x501aa5])){this['saveRestApiResult'](_0x39779a[_0x501aa5],util['format'](_0x6ef6('0x9a'),_0x42278d,_0x501aa5));}}else if(_[_0x6ef6('0x97')](_0x39779a[_0x501aa5])){for(var _0x5b2695=0x0;_0x5b2695<_0x39779a[_0x501aa5][_0x6ef6('0x98')];_0x5b2695++){this[_0x6ef6('0x99')](_0x39779a[_0x501aa5][_0x5b2695],util[_0x6ef6('0x29')](_0x6ef6('0x9a'),_0x42278d,_0x501aa5+'['+_0x5b2695+']'));}}else{if(!_[_0x6ef6('0x42')](_0x39779a[_0x501aa5])){this['channel'][_0x6ef6('0x9b')](util[_0x6ef6('0x29')](_0x6ef6('0x9a'),_0x42278d,_0x501aa5),_0x39779a[_0x501aa5]);}}}}};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x93')]=function(_0x1ccf2d){try{var _0x526b89=JSON['parse'](_0x1ccf2d);this['recursiveNodeIndex'](_0x526b89);return JSON[_0x6ef6('0x6f')](_0x526b89);}catch(_0x2a96d7){return this[_0x6ef6('0x94')](_0x1ccf2d);}};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x94')]=function(_0x291f90){var _0x5c201a=_0x291f90[_0x6ef6('0x9c')]('{');for(var _0x47a73e=0x1;_0x47a73e<_0x5c201a[_0x6ef6('0x98')];_0x47a73e+=0x1){var _0xeaffff=_0x5c201a[_0x47a73e]['split']('}');if(_0xeaffff[_0x6ef6('0x98')]>0x1){_0x291f90=_0x291f90[_0x6ef6('0x9d')]('{'+_0xeaffff[0x0]+'}',this[_0x6ef6('0xf')]['getVariable'](_0xeaffff[0x0])[_0x6ef6('0x9e')]||_0xeaffff[0x0]);}}if(_0x5c201a[_0x6ef6('0x98')]===0x1){return _0x291f90[_0x6ef6('0x4a')]();}return this[_0x6ef6('0x94')](_0x291f90);};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x9f')]=function(_0x2f22b3,_0x29f1b3){var _0x4f0347=this['channel'][_0x6ef6('0xa0')](_0x2f22b3);if(_0x4f0347['result']===-0x1){return _0x4f0347;}logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0xa1'),_0x29f1b3,_0x4f0347[_0x6ef6('0x9e')]));return this[_0x6ef6('0xf')]['setVariable'](_0x29f1b3,_0x4f0347[_0x6ef6('0x9e')]);};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x80')]=function(_0x1b5900){return _0x1b5900&&_0x1b5900!=='0'&&_0x1b5900!=='-1'&&_0x1b5900!=='';};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0xa2')]=function(_0x1455c4){this['createSquareDetailsReport'][_0x6ef6('0x6d')](this,_0x1455c4,'-');_0x1455c4[_0x6ef6('0xa3')]=_0x1455c4[_0x6ef6('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x6ef6('0xa4')]=function(_0x4fe0b9){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4fe0b9['label']));if(!this[_0x6ef6('0x80')](_0x4fe0b9['text'])){return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0xa6'));}var _0x3fa524='\x22'+_0x4fe0b9[_0x6ef6('0x5e')]+'\x22';if(this[_0x6ef6('0x80')](_0x4fe0b9[_0x6ef6('0x75')])){_0x3fa524+=','+_0x4fe0b9[_0x6ef6('0x75')];}var _0x7a5a31=this[_0x6ef6('0xf')][_0x6ef6('0xa7')](_0x6ef6('0xa8'),_0x3fa524);if(_0x7a5a31[_0x6ef6('0xa9')]===-0x1){return _0x7a5a31;}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util['format'](_0x6ef6('0xaa'),_0x3fa524));};AGIVertices['prototype'][_0x6ef6('0xab')]=function(_0x5db9ff){logger[_0x6ef6('0x2c')](util['format'](_0x6ef6('0xac'),_0x5db9ff['label']));if(!this[_0x6ef6('0x80')](_0x5db9ff['grammar'])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xad'));}var _0x1c571a=_0x5db9ff[_0x6ef6('0xae')];if(this[_0x6ef6('0x80')](_0x5db9ff[_0x6ef6('0x75')])){_0x1c571a+=','+_0x5db9ff[_0x6ef6('0x75')];}var _0x16c53c=this['channel'][_0x6ef6('0xa7')]('MRCPRecog',_0x1c571a);if(_0x16c53c[_0x6ef6('0xa9')]===-0x1){return _0x16c53c;}var _0x23709f=this[_0x6ef6('0x9f')](_0x6ef6('0xaf'),_0x6ef6('0xb0'));if(_0x23709f['result']===-0x1){return _0x23709f;}var _0x583b33=this[_0x6ef6('0x9f')]('RECOG_INPUT()',_0x6ef6('0xb1'));if(_0x583b33['result']===-0x1){return _0x583b33;}var _0x2fc318=this[_0x6ef6('0x9f')](_0x6ef6('0xb2'),_0x6ef6('0xb3'));if(_0x2fc318[_0x6ef6('0xa9')]===-0x1){return _0x2fc318;}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1c571a));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x8')]=function(_0x4f2d97){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0xb4'),_0x4f2d97['label']));return this[_0x6ef6('0xf')]['agi']([_0x4f2d97[_0x6ef6('0xb5')],_0x4f2d97[_0x6ef6('0xb6')]]);};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0xb7')]=function(_0xcce6a6){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0xb8'),_0xcce6a6[_0x6ef6('0x35')]));if(this[_0x6ef6('0x80')](_0xcce6a6['timeout'])){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0xb9'),_0xcce6a6[_0x6ef6('0x63')]));var _0x358398=this[_0x6ef6('0xf')][_0x6ef6('0xba')](_0xcce6a6[_0x6ef6('0x63')]);if(_0x358398[_0x6ef6('0xa9')]===-0x1){return _0x358398;}}return this[_0x6ef6('0xf')][_0x6ef6('0xb7')]();};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x48')]=function(_0x54316d){logger[_0x6ef6('0x2c')](util['format'](_0x6ef6('0xbb'),_0x54316d[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x54316d[_0x6ef6('0xbc')])){return this[_0x6ef6('0xf')]['error'](_0x54316d,_0x6ef6('0xbd'));}_0x54316d[_0x6ef6('0x47')]=moment();if(this[_0x6ef6('0x80')](_0x54316d[_0x6ef6('0xbe')])){_0x54316d[_0x6ef6('0x47')]=moment()[_0x6ef6('0xbf')](_0x54316d['delay'],_0x6ef6('0xc0'));}if(!this[_0x6ef6('0x80')](_0x54316d[_0x6ef6('0x4b')])){_0x54316d[_0x6ef6('0x4b')]=0x2;}this[_0x6ef6('0x40')]['sync'](this,_0x54316d);return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0xc1'),_0x54316d[_0x6ef6('0x46')],_0x54316d[_0x6ef6('0xbc')],_0x54316d[_0x6ef6('0x47')]));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0xc2')]=function(_0x2066ed){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2066ed['label']));var _0x1326ba=this['channel'][_0x6ef6('0xa7')](_0x2066ed[_0x6ef6('0xc3')],_0x2066ed[_0x6ef6('0x75')]);if(_0x1326ba[_0x6ef6('0xa9')]===-0x1){return _0x1326ba;}return this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('Executed\x20command\x20%s\x20%s',_0x2066ed[_0x6ef6('0xc3')],_0x2066ed[_0x6ef6('0x75')]));};AGIVertices[_0x6ef6('0x15')]['lumenvoxtts']=function(_0x38c08c){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0xc4'),_0x38c08c[_0x6ef6('0x35')]));if(!this['isConfigured'](_0x38c08c[_0x6ef6('0x5e')])){return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0xa6'));}var _0x1a0a87='\x22'+_0x38c08c[_0x6ef6('0x5e')]+'\x22';if(this[_0x6ef6('0x80')](_0x38c08c['options'])){_0x1a0a87+=','+_0x38c08c[_0x6ef6('0x75')];}var _0xe9eaa3=this[_0x6ef6('0xf')][_0x6ef6('0xa7')]('MRCPSynth',_0x1a0a87);if(_0xe9eaa3[_0x6ef6('0xa9')]===-0x1){return _0xe9eaa3;}return this['channel'][_0x6ef6('0xa5')](util['format'](_0x6ef6('0xaa'),_0x1a0a87));};AGIVertices['prototype']['sestektts']=function(_0x1f8c84){logger[_0x6ef6('0x2c')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1f8c84[_0x6ef6('0x35')]));if(!this['isConfigured'](_0x1f8c84[_0x6ef6('0x5e')])){return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0xa6'));}var _0x299648='\x22'+_0x1f8c84[_0x6ef6('0x5e')]+'\x22';if(this[_0x6ef6('0x80')](_0x1f8c84['options'])){_0x299648+=','+_0x1f8c84['options'];}var _0x52951a=this[_0x6ef6('0xf')][_0x6ef6('0xa7')](_0x6ef6('0xa8'),_0x299648);if(_0x52951a[_0x6ef6('0xa9')]===-0x1){return _0x52951a;}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0xaa'),_0x299648));};AGIVertices[_0x6ef6('0x15')]['lumenvoxasr']=function(_0x49386a){logger['info'](util[_0x6ef6('0x29')](_0x6ef6('0xc5'),_0x49386a[_0x6ef6('0x35')]));if(!this['isConfigured'](_0x49386a[_0x6ef6('0xae')])){return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0xad'));}var _0x2ddeec=_0x49386a['grammar'];if(this[_0x6ef6('0x80')](_0x49386a[_0x6ef6('0x75')])){_0x2ddeec+=','+_0x49386a[_0x6ef6('0x75')];}var _0x395a84=this[_0x6ef6('0xf')]['exec']('MRCPRecog',_0x2ddeec);if(_0x395a84[_0x6ef6('0xa9')]===-0x1){return _0x395a84;}var _0x29b060=this[_0x6ef6('0x9f')](_0x6ef6('0xaf'),'LUMENVOX_ASR_CONFIDENCE');if(_0x29b060[_0x6ef6('0xa9')]===-0x1){return _0x29b060;}var _0x36dfe3=this['getAndSetVariable']('RECOG_INPUT()',_0x6ef6('0xc6'));if(_0x36dfe3['result']===-0x1){return _0x36dfe3;}var _0x2eac13=this[_0x6ef6('0x9f')](_0x6ef6('0xb2'),_0x6ef6('0xc7'));if(_0x2eac13['result']===-0x1){return _0x2eac13;}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0xc8'),_0x2ddeec));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0xc9')]=function(_0x107f06){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0xca'),_0x107f06['label']));if(!this['isConfigured'](_0x107f06[_0x6ef6('0xae')])){return this['channel']['noop'](_0x6ef6('0xad'));}var _0x12bd42=_0x107f06['grammar'];if(this[_0x6ef6('0x80')](_0x107f06[_0x6ef6('0x75')])){_0x12bd42+=','+_0x107f06[_0x6ef6('0x75')];}var _0xa0357a=this[_0x6ef6('0xf')]['exec'](_0x6ef6('0xcb'),_0x12bd42);if(_0xa0357a[_0x6ef6('0xa9')]===-0x1){return _0xa0357a;}var _0x12e147=this[_0x6ef6('0x9f')](_0x6ef6('0xaf'),'SESTEK_ASR_CONFIDENCE');if(_0x12e147[_0x6ef6('0xa9')]===-0x1){return _0x12e147;}var _0xf452f2=this[_0x6ef6('0x9f')](_0x6ef6('0xcc'),_0x6ef6('0xcd'));if(_0xf452f2[_0x6ef6('0xa9')]===-0x1){return _0xf452f2;}var _0x539cd6=this[_0x6ef6('0x9f')]('RECOG_INSTANCE()',_0x6ef6('0xce'));if(_0x539cd6[_0x6ef6('0xa9')]===-0x1){return _0x539cd6;}return this['channel']['noop'](util[_0x6ef6('0x29')](_0x6ef6('0xc8'),_0x12bd42));};AGIVertices[_0x6ef6('0x15')]['database']=function(_0x1fe434){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0xcf'),_0x1fe434[_0x6ef6('0x35')]));if(!this['isConfigured'](_0x1fe434['odbc_id'])){return this[_0x6ef6('0xf')]['error'](_0x1fe434,_0x6ef6('0xd0'));}var _0x212f8e=this[_0x6ef6('0x1b')]['sync'](this,_0x1fe434['odbc_id']);if(!_0x212f8e){return this[_0x6ef6('0xf')]['error'](_0x1fe434,_0x6ef6('0xd1'));}if(!this[_0x6ef6('0x80')](_0x1fe434[_0x6ef6('0xd2')])){return this[_0x6ef6('0xf')]['error'](_0x1fe434,_0x6ef6('0xd3'));}var _0x1916a1=_0x1fe434['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util['format'](_0x6ef6('0xd4'),_0x1916a1));var _0x2a3476=this[_0x6ef6('0xd5')][_0x6ef6('0x6d')](this,_0x212f8e,_0x1916a1);this[_0x6ef6('0x33')][_0x6ef6('0x6d')](this,_0x1fe434,_0x1916a1);if(!this[_0x6ef6('0x80')](_0x1fe434[_0x6ef6('0xd6')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3dce48=this[_0x6ef6('0xa0')][_0x6ef6('0x6d')](this,_0x1fe434[_0x6ef6('0xd6')]);if(!_0x3dce48){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x1fe434,'no\x20variable\x20found');}var _0x2e1980=this;_0x2a3476[_0x6ef6('0xd7')](function(_0x315459,_0x2d5448){Object[_0x6ef6('0xd8')](_0x315459)[_0x6ef6('0xd7')](function(_0x9beb1c){_0x2e1980[_0x6ef6('0xf')][_0x6ef6('0x9b')](util[_0x6ef6('0x29')](_0x6ef6('0xd9'),_0x3dce48,_0x2d5448,_0x9beb1c),_0x315459[_0x9beb1c]);});});this[_0x6ef6('0xf')][_0x6ef6('0x9b')](util['format'](_0x6ef6('0xda'),_0x3dce48),_0x2a3476['length']);return this[_0x6ef6('0xf')]['noop'](util[_0x6ef6('0x29')]('variable\x20%s\x20set',_0x3dce48));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0xdb')]=function(_0x331c56){logger[_0x6ef6('0xdc')](util[_0x6ef6('0x29')](_0x6ef6('0xdd'),_0x331c56['label']));if(!this[_0x6ef6('0x80')](_0x331c56[_0x6ef6('0xde')])){return this['channel'][_0x6ef6('0x30')](_0x331c56,_0x6ef6('0xdf'));}var _0x3b672f=this['getUser'][_0x6ef6('0x6d')](this,_0x331c56[_0x6ef6('0xde')]);if(!_0x3b672f){return this['channel'][_0x6ef6('0x30')](_0x331c56,_0x6ef6('0xe0'));}var _0x5c07ad=this[_0x6ef6('0xf')][_0x6ef6('0xa7')](_0x6ef6('0xe1'),[util[_0x6ef6('0x29')](_0x6ef6('0xe2'),_0x3b672f),_0x331c56['timeout'],_0x331c56[_0x6ef6('0xe3')],_0x331c56[_0x6ef6('0x61')]]);if(_0x5c07ad[_0x6ef6('0xa9')]===-0x1){return _0x5c07ad;}return this['channel']['noop'](util[_0x6ef6('0x29')](_0x6ef6('0xe4'),'DIAL'));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0xe5')]=function(_0x5a24ef){logger[_0x6ef6('0x2c')](util['format'](_0x6ef6('0xe6'),_0x5a24ef['label']));if(!this[_0x6ef6('0x80')](_0x5a24ef[_0x6ef6('0x77')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xe7'));}if(!this['isConfigured'](_0x5a24ef[_0x6ef6('0x5e')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')]('no\x20text\x20configured');}this[_0x6ef6('0xf')][_0x6ef6('0xe8')]=!![];this[_0x6ef6('0x33')](_0x5a24ef);this['createSquareMessage'](_0x5a24ef['text'],'in','','');this['channel']['noop'](util['format'](_0x6ef6('0xe9'),_0x5a24ef[_0x6ef6('0x5e')]));var _0xfce37d=this[_0x6ef6('0x76')]['sync'](this,_0x5a24ef);if(_0xfce37d){for(var _0x507302 in _0xfce37d){if(_0xfce37d[_0x6ef6('0x91')](_0x507302)){this[_0x6ef6('0xf')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x507302['toUpperCase']()),_0xfce37d[_0x507302]);}}this[_0x6ef6('0x3f')](_0xfce37d[_0x6ef6('0xea')],_0x6ef6('0xeb'),_0x6ef6('0xe5'),'');return this[_0x6ef6('0xf')]['noop'](util['format'](_0x6ef6('0xec'),_0xfce37d['speech']));}return this['channel'][_0x6ef6('0x30')](_0x5a24ef,_0x6ef6('0xed'));};AGIVertices['prototype'][_0x6ef6('0xee')]=function(_0x5efdf9){logger[_0x6ef6('0x2c')](util['format'](_0x6ef6('0xef'),_0x5efdf9[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x5efdf9[_0x6ef6('0x7a')])){return this['channel'][_0x6ef6('0xa5')]('no\x20project_id\x20configured');}if(!this[_0x6ef6('0x80')](_0x5efdf9['client_email'])){return this[_0x6ef6('0xf')]['noop'](_0x6ef6('0xf0'));}if(!this[_0x6ef6('0x80')](_0x5efdf9[_0x6ef6('0x7b')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xf1'));}if(!this[_0x6ef6('0x80')](_0x5efdf9['dialogflowV2_language'])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xf2'));}if(!this[_0x6ef6('0x80')](_0x5efdf9[_0x6ef6('0x5e')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xa6'));}this[_0x6ef6('0xf')][_0x6ef6('0xe8')]=!![];this[_0x6ef6('0x33')](_0x5efdf9);this[_0x6ef6('0x3f')](_0x5efdf9['text'],'in','','');this[_0x6ef6('0xf')]['noop'](util[_0x6ef6('0x29')](_0x6ef6('0xf3'),_0x5efdf9['text']));var _0x38c80a=this['googleDialogflowV2'][_0x6ef6('0x6d')](this,_0x5efdf9);if(_0x38c80a){for(var _0x367ae6 in _0x38c80a){if(_0x38c80a['hasOwnProperty'](_0x367ae6)){if(_0x367ae6!==_0x6ef6('0xf4')){this['channel'][_0x6ef6('0x9b')](util['format'](_0x6ef6('0xf5'),_0x367ae6['toUpperCase']()),_0x38c80a[_0x367ae6]);}}}this['createSquareMessage'](_0x38c80a[_0x6ef6('0xea')],'out',_0x6ef6('0xee'),_0x38c80a[_0x6ef6('0xf4')]);return this[_0x6ef6('0xf')]['noop'](util[_0x6ef6('0x29')]('DialogflowV2\x20Result\x20%s',_0x38c80a['speech']));}return this['channel']['error'](_0x5efdf9,_0x6ef6('0xf6'));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0xf7')]=function(_0x5ccd85){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x5ccd85[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x5ccd85['ndauth_url'])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xf8'));}if(!this['isConfigured'](_0x5ccd85[_0x6ef6('0xf9')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xfa'));}if(!this[_0x6ef6('0x80')](_0x5ccd85[_0x6ef6('0xfb')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xfc'));}if(!this['isConfigured'](_0x5ccd85['ndassistant_url'])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xa6'));}this[_0x6ef6('0xf')][_0x6ef6('0xe8')]=!![];this[_0x6ef6('0x33')](_0x5ccd85);this[_0x6ef6('0x3f')](_0x5ccd85[_0x6ef6('0x5e')],'in','','');this['channel']['noop'](util[_0x6ef6('0x29')](_0x6ef6('0xfd'),_0x5ccd85[_0x6ef6('0x5e')]));var _0x180bc3=this['sestekNDA'][_0x6ef6('0x6d')](this,_0x5ccd85);if(_0x180bc3){for(var _0x232b26 in _0x180bc3){if(_0x180bc3[_0x6ef6('0x91')](_0x232b26)){this[_0x6ef6('0xf')]['setVariable'](util['format'](_0x6ef6('0xfe'),_0x232b26[_0x6ef6('0x67')]()),_0x180bc3[_0x232b26]);}}this[_0x6ef6('0x3f')](_0x180bc3[_0x6ef6('0xea')],_0x6ef6('0xeb'),_0x6ef6('0xf7'),'');if(_0x180bc3[_0x6ef6('0xff')]){this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x100'),_0x180bc3[_0x6ef6('0xff')]));var _0x1ee1ca=this[_0x6ef6('0xf')][_0x6ef6('0x101')](_0x180bc3['audiofile']);try{fs[_0x6ef6('0x102')](_0x180bc3[_0x6ef6('0xff')]+'.wav');}catch(_0x3ba5b5){logger[_0x6ef6('0x30')](_0x3ba5b5);}return _0x1ee1ca;}else{return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util['format'](_0x6ef6('0x103'),_0x180bc3[_0x6ef6('0xea')]));}}return this[_0x6ef6('0xf')]['error'](_0x5ccd85,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x6ef6('0x104')]=function(_0x21e808){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x105'),_0x21e808[_0x6ef6('0x35')]));return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0x104'));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x106')]=function(_0x153b53){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x153b53[_0x6ef6('0x35')]));var _0x336487='';if(_0x153b53[_0x6ef6('0x107')]){if(!this[_0x6ef6('0x80')](_0x153b53[_0x6ef6('0x107')])){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x153b53,_0x6ef6('0x108'));}else{var _0x3ccdf=parseInt(_0x153b53[_0x6ef6('0x107')],0xa);if(isNaN(_0x3ccdf)){_0x336487=_0x153b53['trunk_id'];}else{_0x336487=this[_0x6ef6('0x1f')][_0x6ef6('0x6d')](this,_0x153b53[_0x6ef6('0x107')]);if(!_0x336487){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x153b53,'no\x20trunk\x20found');}}}}else if(_0x153b53[_0x6ef6('0x109')]){_0x336487=_0x153b53[_0x6ef6('0x109')];}else{return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x153b53,_0x6ef6('0x108'));}var _0x1fc08f=this[_0x6ef6('0xf')][_0x6ef6('0xa7')](_0x6ef6('0xe1'),[util[_0x6ef6('0x29')](_0x6ef6('0x10a'),_0x336487,_0x153b53[_0x6ef6('0x46')]),_0x153b53['timeout'],_0x153b53[_0x6ef6('0xe3')],_0x153b53[_0x6ef6('0x61')]]);if(_0x1fc08f[_0x6ef6('0xa9')]===-0x1){return _0x1fc08f;}return this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0xe4'),_0x6ef6('0xe1')));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x10b')]=function(_0x136bd8){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x136bd8[_0x6ef6('0x35')]));return this[_0x6ef6('0xf')]['noop'](_0x6ef6('0x10b'));};AGIVertices['prototype'][_0x6ef6('0x10c')]=function(_0x7d4ebe){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x7d4ebe[_0x6ef6('0x35')]));if(_0x7d4ebe['retry']===0x0){return this[_0x6ef6('0xa2')](_0x7d4ebe);}_0x7d4ebe[_0x6ef6('0xa3')]-=0x1;if(!this[_0x6ef6('0x80')](_0x7d4ebe[_0x6ef6('0x10d')])){return this[_0x6ef6('0xf')]['error'](_0x7d4ebe,_0x6ef6('0x10e'));}var _0x5b26b3=this[_0x6ef6('0x20')][_0x6ef6('0x6d')](this,_0x7d4ebe['file_id']);if(!_0x5b26b3){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x7d4ebe,_0x6ef6('0x10f'));}if(!this['isConfigured'](_0x7d4ebe[_0x6ef6('0xd6')])){return this[_0x6ef6('0xf')]['error'](_0x6ef6('0x110'));}var _0x516a4f=this[_0x6ef6('0xf')]['getData'](_0x5b26b3,_0x7d4ebe[_0x6ef6('0x111')],_0x7d4ebe[_0x6ef6('0x112')]);var _0x752320=_0x516a4f[_0x6ef6('0xa9')]?_0x516a4f['result']['toString']():'';logger[_0x6ef6('0x2c')](_0x6ef6('0x113'),JSON[_0x6ef6('0x6f')](_0x516a4f));if(_0x516a4f['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x7d4ebe,_0x752320);return _0x516a4f;}else if(_0x516a4f[_0x6ef6('0x9e')]===_0x6ef6('0x63')){_0x516a4f[_0x6ef6('0xa9')]=_0x752320[_0x6ef6('0x98')]>=parseInt(_0x7d4ebe[_0x6ef6('0x114')])?'x':'i';}else{_0x516a4f[_0x6ef6('0xa9')]=_0x752320['length']>=parseInt(_0x7d4ebe[_0x6ef6('0x114')])&&_0x752320[_0x6ef6('0x98')]<=parseInt(_0x7d4ebe[_0x6ef6('0x112')])?'x':'i';}var _0x373cbb=this[_0x6ef6('0xa0')][_0x6ef6('0x6d')](this,_0x7d4ebe[_0x6ef6('0xd6')]);if(!_0x373cbb){return this['channel'][_0x6ef6('0x30')](_0x7d4ebe,_0x6ef6('0x115'));}this[_0x6ef6('0xf')]['setVariable'](_0x373cbb,_0x752320);if(this[_0x6ef6('0x80')](_0x7d4ebe[_0x6ef6('0x116')])){var _0x2e740e=parseInt(_0x7d4ebe['hiddendigitsnum'],0xa);var _0xec49bf=rs[_0x6ef6('0x117')]({'charset':'*','length':_0x2e740e});var _0x36b62c=_0x752320[_0x6ef6('0x98')];if(_0x36b62c>0x0){if(_0x36b62c>_0x2e740e){this[_0x6ef6('0x33')][_0x6ef6('0x6d')](this,_0x7d4ebe,_0x7d4ebe[_0x6ef6('0x118')]===_0x6ef6('0x119')?_0xec49bf+_0x752320[_0x6ef6('0x11a')](_0x2e740e):_0x752320['substr'](0x0,_0x36b62c-_0x2e740e)+_0xec49bf);}else{this[_0x6ef6('0x33')][_0x6ef6('0x6d')](this,_0x7d4ebe,rs['generate']({'charset':'*','length':_0x36b62c}));}}else{this['createSquareDetailsReport']['sync'](this,_0x7d4ebe,'');}}else{this[_0x6ef6('0x33')][_0x6ef6('0x6d')](this,_0x7d4ebe,_0x752320);}return _0x516a4f;};AGIVertices[_0x6ef6('0x15')]['getsecretdigits']=function(_0x1731c1){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x11b'),_0x1731c1['label']));return this[_0x6ef6('0x10c')](_0x1731c1);};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x11c')]=function(_0x1d6417){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x11d'),_0x1d6417[_0x6ef6('0x35')]));this['createSquareDetailsReport'][_0x6ef6('0x6d')](this,_0x1d6417,_0x1d6417['goalname']);return this['channel'][_0x6ef6('0xa5')](util['format'](_0x6ef6('0x11e'),_0x1d6417[_0x6ef6('0x11f')]));};AGIVertices[_0x6ef6('0x15')]['awspolly']=function(_0x4838f7){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x120'),_0x4838f7[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x4838f7[_0x6ef6('0x83')])||!this[_0x6ef6('0x80')](_0x4838f7['aws_secret_access_key'])){return this[_0x6ef6('0xf')]['noop'](_0x6ef6('0x121'));}if(!this[_0x6ef6('0x80')](_0x4838f7['text'])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xa6'));}this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x122'),_0x4838f7['text']));var _0x4651df=this[_0x6ef6('0x82')][_0x6ef6('0x6d')](this,_0x4838f7);if(_0x4651df){this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x123'),_0x4651df));var _0x19f24c=this[_0x6ef6('0xf')][_0x6ef6('0x101')](_0x4651df);try{fs['unlink'](_0x4651df+_0x6ef6('0x124'));}catch(_0x202b6c){logger[_0x6ef6('0x30')](_0x202b6c);}return _0x19f24c;}return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x4838f7,_0x6ef6('0x125'));};AGIVertices[_0x6ef6('0x15')]['awslex']=function(_0x6ad7d7){logger[_0x6ef6('0x2c')](util['format'](_0x6ef6('0x126'),_0x6ad7d7['label']));if(!this[_0x6ef6('0x80')](_0x6ad7d7['aws_access_key_id'])||!this['isConfigured'](_0x6ad7d7[_0x6ef6('0x84')])){return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0x121'));}if(!this['isConfigured'](_0x6ad7d7['aws_bot_name'])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x127'));}if(!this['isConfigured'](_0x6ad7d7[_0x6ef6('0x5e')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')]('no\x20text\x20configured');}this[_0x6ef6('0xf')][_0x6ef6('0xe8')]=!![];this[_0x6ef6('0x33')](_0x6ad7d7);this[_0x6ef6('0x3f')](_0x6ad7d7['text'],'in','','');this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x128'),_0x6ad7d7[_0x6ef6('0x5e')]));var _0x58cd42=this[_0x6ef6('0x88')]['sync'](this,_0x6ad7d7);if(_0x58cd42){for(var _0x2c2275 in _0x58cd42){if(_0x58cd42[_0x6ef6('0x91')](_0x2c2275)&&_['isString'](_0x58cd42[_0x2c2275])){this[_0x6ef6('0xf')][_0x6ef6('0x9b')](util[_0x6ef6('0x29')](_0x6ef6('0x129'),_0x2c2275[_0x6ef6('0x67')]()),_0x58cd42[_0x2c2275]);}}if(_[_0x6ef6('0x42')](_0x58cd42[_0x6ef6('0x73')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x12a'));}else{this[_0x6ef6('0x3f')](_0x58cd42[_0x6ef6('0x73')],_0x6ef6('0xeb'),_0x6ef6('0x12b'),'');return this[_0x6ef6('0xf')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x58cd42['message']));}}return this['channel'][_0x6ef6('0x30')](_0x6ad7d7,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x12c')]=function(_0xb7cf0e){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x12d'),_0xb7cf0e[_0x6ef6('0x35')],_0xb7cf0e['timeout']));if(!this[_0x6ef6('0x80')](_0xb7cf0e['key'])){return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0xe7'));}var _0xd63d6f='wav';var _0x31b025=util[_0x6ef6('0x29')](_0x6ef6('0x12e'),FILES_PATH,rs[_0x6ef6('0x117')](0x4));var _0x2978f0=util['format']('%s.%s',_0x31b025,_0xd63d6f);var _0x3ec248=!![];if(_0xb7cf0e[_0x6ef6('0x12f')]===_0x6ef6('0x130')){_0x3ec248=![];}var _0x196ab4=this[_0x6ef6('0xf')]['recordFile'](_0x31b025,_0xd63d6f,_0xb7cf0e[_0x6ef6('0x131')],_0xb7cf0e[_0x6ef6('0x63')],undefined,_0x3ec248);if(_0x196ab4['result']!==-0x1){this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x132'),_0x2978f0));var _0x32036f=this[_0x6ef6('0x8a')][_0x6ef6('0x6d')](this,_0xb7cf0e,_0x2978f0);if(_0x32036f){for(var _0x56bce3 in _0x32036f){if(_0x32036f[_0x6ef6('0x91')](_0x56bce3)){this[_0x6ef6('0xf')][_0x6ef6('0x9b')](util[_0x6ef6('0x29')](_0x6ef6('0x133'),_0x56bce3[_0x6ef6('0x67')]()),_0x32036f[_0x56bce3]);}}return this[_0x6ef6('0xf')]['noop'](util[_0x6ef6('0x29')](_0x6ef6('0x134'),JSON[_0x6ef6('0x6f')](_0x32036f)));}}return _0x196ab4;};AGIVertices['prototype'][_0x6ef6('0x135')]=function(_0x5bf6e6){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x136'),_0x5bf6e6[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x5bf6e6[_0x6ef6('0x8d')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x137'));}if(!this[_0x6ef6('0x80')](_0x5bf6e6[_0x6ef6('0x138')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x139'));}var _0x1c5b99=_0x6ef6('0x13a');var _0x24e0b4=util[_0x6ef6('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x6ef6('0x117')](0x4));var _0x2f823e=util['format'](_0x6ef6('0x9a'),_0x24e0b4,_0x1c5b99);var _0x57b6bb=!![];if(_0x5bf6e6['beep']===_0x6ef6('0x130')){_0x57b6bb=![];}var _0x247a3c=this[_0x6ef6('0xf')]['recordFile'](_0x24e0b4,_0x1c5b99,_0x5bf6e6[_0x6ef6('0x131')],_0x5bf6e6['timeout'],undefined,_0x57b6bb);if(_0x247a3c['result']!==-0x1){this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x13b'),_0x2f823e));var _0x1c4072=this['tildeASR'][_0x6ef6('0x6d')](this,_0x5bf6e6,_0x2f823e);if(_0x1c4072){for(var _0x41679f in _0x1c4072){if(_0x1c4072[_0x6ef6('0x91')](_0x41679f)){this[_0x6ef6('0xf')][_0x6ef6('0x9b')](util[_0x6ef6('0x29')](_0x6ef6('0x13c'),_0x41679f[_0x6ef6('0x67')]()),_0x1c4072[_0x41679f]);}}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x13d'),JSON[_0x6ef6('0x6f')](_0x1c4072)));}}return _0x247a3c;};AGIVertices['prototype'][_0x6ef6('0x13e')]=function(_0x353651){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x13f'),_0x353651[_0x6ef6('0x35')]));return this[_0x6ef6('0xf')][_0x6ef6('0x140')](_0x353651[_0x6ef6('0x3a')],_0x353651['extension'],_0x353651[_0x6ef6('0x141')]);};AGIVertices['prototype'][_0x6ef6('0x142')]=function(_0x3661e0){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x143'),_0x3661e0[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x3661e0[_0x6ef6('0x144')])){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x3661e0,_0x6ef6('0x145'));}try{var _0x26a35f=eval(_0x3661e0['condition'])?_0x6ef6('0x146'):_0x6ef6('0x147');this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x148'),_0x3661e0[_0x6ef6('0x144')],_0x26a35f));return{'code':0xc8,'result':_0x26a35f};}catch(_0x55cad0){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x149')]=function(_0x7e1435){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x14a'),_0x7e1435[_0x6ef6('0x35')]));if(!this['isConfigured'](_0x7e1435['interval_id'])){return this['channel'][_0x6ef6('0x30')](_0x7e1435,_0x6ef6('0x14b'));}var _0x555e87=this['getIntervals'][_0x6ef6('0x6d')](this,_0x7e1435['interval_id']);if(!_0x555e87){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x7e1435,'no\x20intervals\x20found');}for(var _0x47229c=0x0;_0x47229c<_0x555e87[_0x6ef6('0x98')];_0x47229c+=0x1){var _0x12ee39=this[_0x6ef6('0xf')][_0x6ef6('0xa0')](util['format'](_0x6ef6('0x14c'),_0x555e87[_0x47229c]));if(_0x12ee39[_0x6ef6('0xa9')]===-0x1){return _0x12ee39;}logger['info'](util[_0x6ef6('0x29')](_0x6ef6('0x14d'),_0x555e87[_0x47229c],_0x12ee39[_0x6ef6('0x9e')]));if(_0x12ee39[_0x6ef6('0x9e')]===_0x6ef6('0x146')){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x14d'),_0x555e87[_0x47229c],_0x6ef6('0x146')));this[_0x6ef6('0xf')]['noop'](util[_0x6ef6('0x29')]('IFTIME\x20%s\x20%s',_0x555e87[_0x47229c],_0x6ef6('0x146')));return{'code':0xc8,'result':'true'};}else{logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('IFTIME\x20%s\x20%s',_0x555e87[_0x47229c],_0x6ef6('0x147')));this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('IFTIME\x20%s\x20%s',_0x555e87[_0x47229c],_0x6ef6('0x147')));}}return{'code':0xc8,'result':_0x6ef6('0x147')};};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x14e')]=function(_0x252ebf){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x14f'),_0x252ebf[_0x6ef6('0x35')]));return this['channel'][_0x6ef6('0x14e')]();};AGIVertices['prototype'][_0x6ef6('0x150')]=function(_0x30b150){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x151'),_0x30b150[_0x6ef6('0x35')]));if(!this['isConfigured'](_0x30b150['key'])){return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0xe7'));}var _0x20e3ae='wav';var _0x2af7ed=util[_0x6ef6('0x29')](_0x6ef6('0x12e'),FILES_PATH,rs[_0x6ef6('0x117')](0x4));var _0x30a4e8=util[_0x6ef6('0x29')](_0x6ef6('0x9a'),_0x2af7ed,_0x20e3ae);var _0x4654b0=!![];if(_0x30b150[_0x6ef6('0x12f')]==='NOBEEP'){_0x4654b0=![];}var _0x3d76b9=this[_0x6ef6('0xf')][_0x6ef6('0x152')](_0x2af7ed,_0x20e3ae,_0x30b150[_0x6ef6('0x131')],_0x30b150['timeout'],undefined,_0x4654b0);if(_0x3d76b9[_0x6ef6('0xa9')]!==-0x1){this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x153'),_0x30a4e8));var _0xe3507a=this[_0x6ef6('0x7e')][_0x6ef6('0x6d')](this,_0x30b150,_0x30a4e8);if(_0xe3507a){for(var _0x69cdef in _0xe3507a){if(_0xe3507a[_0x6ef6('0x91')](_0x69cdef)){this['channel']['setVariable'](util['format'](_0x6ef6('0x154'),_0x69cdef['toUpperCase']()),_0xe3507a[_0x69cdef]);}}return this['channel']['noop'](util[_0x6ef6('0x29')](_0x6ef6('0x155'),JSON[_0x6ef6('0x6f')](_0xe3507a)));}}return _0x3d76b9;};AGIVertices['prototype']['ispeechtts']=function(_0x54918f){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x156'),_0x54918f[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x54918f[_0x6ef6('0x77')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xe7'));}if(!this[_0x6ef6('0x80')](_0x54918f[_0x6ef6('0x5e')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')]('no\x20text\x20configured');}this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x157'),_0x54918f['text']));var _0x494cb1=this[_0x6ef6('0x7d')][_0x6ef6('0x6d')](this,_0x54918f);if(_0x494cb1){this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x153'),_0x494cb1));var _0x327a3e=this[_0x6ef6('0xf')]['streamFile'](_0x494cb1,_0x54918f[_0x6ef6('0x131')]);try{fs[_0x6ef6('0x102')](_0x494cb1+'.wav');}catch(_0x224db1){logger[_0x6ef6('0x30')](_0x224db1);}return _0x327a3e;}return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x54918f,_0x6ef6('0x158'));};AGIVertices['prototype'][_0x6ef6('0x159')]=function(_0x39f976){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x15a'),_0x39f976['label']));if(!this[_0x6ef6('0x80')](_0x39f976[_0x6ef6('0x15b')])){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x39f976,_0x6ef6('0x15c'));}logger['info'](util[_0x6ef6('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6ef6('0xf')]['callerid'],_0x39f976[_0x6ef6('0x15b')]));var _0x54ba5e=this[_0x6ef6('0x51')][_0x6ef6('0x6d')](this,_0x39f976['findBy']);if(_0x54ba5e){logger['info'](util[_0x6ef6('0x29')](_0x6ef6('0x15d'),this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x39f976['findBy']));this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x39f976[_0x6ef6('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x15e'),this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x39f976[_0x6ef6('0x15b')]));this[_0x6ef6('0xf')]['noop'](util['format'](_0x6ef6('0x15e'),this[_0x6ef6('0xf')]['callerid'],_0x39f976[_0x6ef6('0x15b')]));return{'code':0xc8,'result':_0x6ef6('0x15f')};}};AGIVertices[_0x6ef6('0x15')]['logout']=function(_0x40c57b){logger[_0x6ef6('0x2c')](util['format'](_0x6ef6('0x160'),_0x40c57b[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x40c57b[_0x6ef6('0x15b')])){return this['channel'][_0x6ef6('0x30')](_0x40c57b,_0x6ef6('0x15c'));}logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x161'),this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x40c57b[_0x6ef6('0x15b')]));var _0x41ff2d=this[_0x6ef6('0x50')][_0x6ef6('0x6d')](this,_0x40c57b['findBy']);if(_0x41ff2d){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x40c57b[_0x6ef6('0x15b')]));this['channel'][_0x6ef6('0xa5')](util['format'](_0x6ef6('0x15d'),this[_0x6ef6('0xf')]['callerid'],_0x40c57b['findBy']));return{'code':0xc8,'result':_0x6ef6('0x162')};}else{logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x15e'),this['channel'][_0x6ef6('0x38')],_0x40c57b[_0x6ef6('0x15b')]));this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x15e'),this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x40c57b['findBy']));return{'code':0xc8,'result':_0x6ef6('0x15f')};}};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x163')]=function(_0x2db112){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x164'),_0x2db112[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x2db112['operation'])){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x2db112,'no\x20operation\x20configured');}this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x165'),_0x2db112[_0x6ef6('0x166')]));var _0x134ecf=eval(_0x2db112['operation']);if(!this[_0x6ef6('0x80')](_0x2db112[_0x6ef6('0xd6')])){return this[_0x6ef6('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4eff7f=this[_0x6ef6('0xa0')]['sync'](this,_0x2db112[_0x6ef6('0xd6')]);if(!_0x4eff7f){return this[_0x6ef6('0xf')]['error'](_0x2db112,_0x6ef6('0x115'));}if(_['isArray'](_0x134ecf)){var _0x4a98f5=this;_0x134ecf[_0x6ef6('0xd7')](function(_0x5ada40,_0x5ca189){_0x4a98f5[_0x6ef6('0xf')][_0x6ef6('0x9b')](util['format'](_0x6ef6('0x167'),_0x4eff7f,_0x5ca189),_0x5ada40);});return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x168'),_0x4eff7f));}else{return this['channel'][_0x6ef6('0x9b')](_0x4eff7f,_0x134ecf);}};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x169')]=function(_0x1def44){logger[_0x6ef6('0x2c')](util['format'](_0x6ef6('0x16a'),_0x1def44[_0x6ef6('0x35')]));if(_0x1def44[_0x6ef6('0xa3')]===0x0){return this[_0x6ef6('0xa2')](_0x1def44);}_0x1def44[_0x6ef6('0xa3')]-=0x1;if(!this[_0x6ef6('0x80')](_0x1def44[_0x6ef6('0x10d')])){return this[_0x6ef6('0xf')]['error'](_0x1def44,_0x6ef6('0x10e'));}var _0x1ee352=this[_0x6ef6('0x20')]['sync'](this,_0x1def44[_0x6ef6('0x10d')]);if(!_0x1ee352){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x1def44,_0x6ef6('0x10f'));}var _0x9730ae=this['channel'][_0x6ef6('0x16b')](_0x1ee352,_0x1def44[_0x6ef6('0x111')],_0x1def44[_0x6ef6('0x16c')]);var _0x3f5689=_0x9730ae[_0x6ef6('0xa9')];if(_0x9730ae[_0x6ef6('0xa9')]===-0x1){this[_0x6ef6('0x33')][_0x6ef6('0x6d')](this,_0x1def44,'-1');return _0x9730ae;}else if(_0x9730ae[_0x6ef6('0x9e')]===_0x6ef6('0x63')){_0x9730ae[_0x6ef6('0xa9')]=_0x9730ae['result'][_0x6ef6('0x98')]>0x0?_0x9730ae['result']:'t';}else if(_[_0x6ef6('0x41')](_0x9730ae[_0x6ef6('0xa9')])){_0x9730ae[_0x6ef6('0xa9')]='#';_0x3f5689='#';}if(!this[_0x6ef6('0x80')](_0x1def44[_0x6ef6('0xd6')])){this['channel'][_0x6ef6('0xa5')](_0x6ef6('0x110'));}else{var _0xb4dfd1=this[_0x6ef6('0xa0')]['sync'](this,_0x1def44[_0x6ef6('0xd6')]);if(!_0xb4dfd1){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x1def44,'no\x20variable\x20found');}this['channel'][_0x6ef6('0x9b')](_0xb4dfd1,_0x3f5689);}this[_0x6ef6('0x33')][_0x6ef6('0x6d')](this,_0x1def44,_0x3f5689);return _0x9730ae;};AGIVertices['prototype'][_0x6ef6('0xa5')]=function(_0x9c1d5b){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x9c1d5b['label']));return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x9c1d5b[_0x6ef6('0x16d')]||_0x9c1d5b[_0x6ef6('0x35')]);};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x16e')]=function(_0x41d7c3){logger['info'](util[_0x6ef6('0x29')](_0x6ef6('0x16f'),_0x41d7c3[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x41d7c3[_0x6ef6('0x15b')])){return this['channel'][_0x6ef6('0x30')](_0x41d7c3,_0x6ef6('0x15c'));}logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x161'),this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x41d7c3[_0x6ef6('0x15b')]));var _0x1d2b67=this['getPause'][_0x6ef6('0x6d')](this,_0x41d7c3[_0x6ef6('0x170')]);var _0x23eeeb=this[_0x6ef6('0x4d')][_0x6ef6('0x6d')](this,_0x41d7c3['findBy'],_0x1d2b67);if(_0x23eeeb){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x41d7c3[_0x6ef6('0x15b')]));this['channel']['noop'](util[_0x6ef6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x41d7c3[_0x6ef6('0x15b')]));return{'code':0xc8,'result':_0x6ef6('0x162')};}else{logger['info'](util[_0x6ef6('0x29')](_0x6ef6('0x15e'),this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x41d7c3[_0x6ef6('0x15b')]));this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x41d7c3[_0x6ef6('0x15b')]));return{'code':0xc8,'result':_0x6ef6('0x15f')};}};AGIVertices[_0x6ef6('0x15')]['playback']=function(_0x2d5226){logger['info'](util[_0x6ef6('0x29')](_0x6ef6('0x171'),_0x2d5226[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x2d5226[_0x6ef6('0x10d')])){return this[_0x6ef6('0xf')]['error'](_0x2d5226,_0x6ef6('0x10e'));}var _0x3cc8d9=this[_0x6ef6('0x20')][_0x6ef6('0x6d')](this,_0x2d5226[_0x6ef6('0x10d')]);if(!_0x3cc8d9){return this['channel'][_0x6ef6('0x30')](_0x2d5226,_0x6ef6('0x10f'));}var _0x2c4c6c=this['channel'][_0x6ef6('0xa7')](_0x6ef6('0x172'),[_0x3cc8d9,_0x2d5226['opts']]);if(_0x2c4c6c[_0x6ef6('0xa9')]===-0x1){return _0x2c4c6c;}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x173'),'PLAYBACK',_0x3cc8d9));};AGIVertices['prototype'][_0x6ef6('0x174')]=function(_0x4d07df){logger[_0x6ef6('0x2c')](util['format'](_0x6ef6('0x175'),_0x4d07df[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x4d07df['queue_id'])){return this['channel']['error'](_0x4d07df,'no\x20queue\x20selected');}var _0x1f3e66='';var _0x51fe1d=parseInt(_0x4d07df[_0x6ef6('0x176')],0xa);if(isNaN(_0x51fe1d)){_0x1f3e66=_0x4d07df[_0x6ef6('0x176')];}else{_0x1f3e66=this['getVoiceQueue']['sync'](this,_0x4d07df[_0x6ef6('0x176')]);if(!_0x1f3e66){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x4d07df,_0x6ef6('0x177'));}}var _0x38ec0e='';if(this[_0x6ef6('0x80')](_0x4d07df[_0x6ef6('0x10d')])){var _0x5b766d=this[_0x6ef6('0x20')]['sync'](this,_0x4d07df['file_id']);if(_0x5b766d){_0x38ec0e=_0x5b766d;}}this['createSquareDetailsReport'][_0x6ef6('0x6d')](this,_0x4d07df,_0x1f3e66);if(_0x4d07df['opts'][_0x6ef6('0x178')]('x')<0x0){_0x4d07df[_0x6ef6('0xe3')]+='x';}if(_0x4d07df['opts'][_0x6ef6('0x178')]('X')<0x0){_0x4d07df[_0x6ef6('0xe3')]+='X';}this['channel'][_0x6ef6('0x9b')](_0x6ef6('0x179'),_0x1f3e66?_0x1f3e66[_0x6ef6('0x17a')]():'');var _0x16f943=this[_0x6ef6('0xf')][_0x6ef6('0xa7')](_0x6ef6('0x17b'),[_0x1f3e66,_0x4d07df['opts'],_0x4d07df[_0x6ef6('0x61')],_0x38ec0e,_0x4d07df[_0x6ef6('0x63')],_0x4d07df[_0x6ef6('0x8')],_0x4d07df[_0x6ef6('0x17c')],_0x4d07df['gosub'],'',_0x4d07df[_0x6ef6('0x17d')]]);if(_0x16f943[_0x6ef6('0xa9')]===-0x1){return _0x16f943;}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x173'),_0x6ef6('0x17b'),_0x1f3e66));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x17e')]=function(_0x12695d){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x17f'),_0x12695d[_0x6ef6('0x35')]));var _0x33e684=_0x12695d[_0x6ef6('0x180')]||_0x6ef6('0x13a');var _0x6c6ac=util['format']('%s_%s',this[_0x6ef6('0xf')]['uniqueid'],rs[_0x6ef6('0x117')](0x5));var _0xc962b3=util[_0x6ef6('0x29')](_0x6ef6('0x181'),FILES_PATH,_0x6c6ac,_0x33e684);var _0x4eb85e=util[_0x6ef6('0x29')]('%s/recordings/%s',FILES_PATH,_0x6c6ac);this[_0x6ef6('0x182')][_0x6ef6('0x6d')](this,_0x12695d,_0x6c6ac,_0xc962b3);this[_0x6ef6('0xf')][_0x6ef6('0x9b')]('RECORDING_SAVENAME',_0x6c6ac);logger[_0x6ef6('0x2c')](_0x6ef6('0x183'),_0x4eb85e,_0x33e684,_0x12695d[_0x6ef6('0x184')],_0x12695d[_0x6ef6('0x63')]);return this[_0x6ef6('0xf')][_0x6ef6('0x152')](_0x4eb85e,_0x33e684,_0x12695d[_0x6ef6('0x184')],_0x12695d[_0x6ef6('0x63')],undefined,!![]);};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x185')]=function(_0x288915){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x288915[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x288915[_0x6ef6('0x61')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x186'));}var _0x31d7d5=this['restAPI'][_0x6ef6('0x6d')](this,_0x288915);logger['info'](util['format'](_0x6ef6('0x187'),util['inspect'](_0x31d7d5,{'showHidden':![],'depth':null})));if(!this[_0x6ef6('0x80')](_0x288915['variable_id'])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x188'));}var _0x4b07ff=this[_0x6ef6('0xa0')][_0x6ef6('0x6d')](this,_0x288915[_0x6ef6('0xd6')]);if(!_0x4b07ff){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x288915,_0x6ef6('0x115'));}this[_0x6ef6('0xf')][_0x6ef6('0x9b')](util[_0x6ef6('0x29')](_0x6ef6('0x189'),_0x4b07ff),_0x31d7d5[_0x6ef6('0x72')]?_0x31d7d5[_0x6ef6('0x72')]:_0x6ef6('0x18a'));this[_0x6ef6('0xf')][_0x6ef6('0x9b')](util[_0x6ef6('0x29')](_0x6ef6('0x18b'),_0x4b07ff),_0x31d7d5[_0x6ef6('0x71')]?_0x31d7d5[_0x6ef6('0x71')]:'OK');if(_0x31d7d5[_0x6ef6('0x68')]){try{this[_0x6ef6('0x99')](_0x31d7d5[_0x6ef6('0x68')],_0x4b07ff);}catch(_0x2367d8){logger[_0x6ef6('0x30')](util[_0x6ef6('0x29')](_0x6ef6('0x18c'),_0x4b07ff));}}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util['format'](_0x6ef6('0x18d'),_0x4b07ff));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x18e')]=function(_0x488554){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x18f'),_0x488554['label']));return this[_0x6ef6('0xf')]['sayDigits'](_0x488554['digits'][_0x6ef6('0x56')](/\s+/g,''),_0x488554[_0x6ef6('0x184')]);};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x190')]=function(_0x4efa6){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4efa6[_0x6ef6('0x35')]));return this[_0x6ef6('0xf')]['sayNumber'](_0x4efa6[_0x6ef6('0x191')]['replace'](/\s+/g,''),_0x4efa6['escape_digits']);};AGIVertices['prototype'][_0x6ef6('0x192')]=function(_0x298805){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x193'),_0x298805[_0x6ef6('0x35')]));return this[_0x6ef6('0xf')]['sayPhonetic'](_0x298805[_0x6ef6('0x5e')],_0x298805[_0x6ef6('0x184')]);};AGIVertices[_0x6ef6('0x15')]['sendMail']=function(_0x5488e3){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x194'),_0x5488e3[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x5488e3[_0x6ef6('0x195')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x196'));}var _0x3cfff4=this[_0x6ef6('0x24')][_0x6ef6('0x6d')](this,_0x5488e3[_0x6ef6('0x195')]);if(!_0x3cfff4||!_0x3cfff4[_0x6ef6('0x197')]){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x5488e3,_0x6ef6('0x198'));}var _0x19ba2a={'from':util['format'](_0x6ef6('0x199'),_0x3cfff4[_0x6ef6('0x18')],_0x3cfff4['email']||_0x3cfff4[_0x6ef6('0x197')][_0x6ef6('0x19a')]),'to':_0x5488e3['to']||'','cc':_0x5488e3['cc']||'','bcc':_0x5488e3[_0x6ef6('0x19b')]||'','subject':_0x5488e3['subject'],'html':_0x5488e3[_0x6ef6('0x5e')],'text':_0x5488e3[_0x6ef6('0x5e')]};var _0x51f5f3={'tls':{'rejectUnauthorized':![]}};if(_0x3cfff4[_0x6ef6('0x197')]['service']){_0x51f5f3[_0x6ef6('0x19c')]=_0x3cfff4[_0x6ef6('0x197')][_0x6ef6('0x19c')];}else{_0x51f5f3[_0x6ef6('0x19d')]=_0x3cfff4[_0x6ef6('0x197')][_0x6ef6('0x19d')];_0x51f5f3[_0x6ef6('0x19e')]=_0x3cfff4[_0x6ef6('0x197')]['port'];_0x51f5f3['secure']=_0x3cfff4['Smtp']['secure'];}if(_0x3cfff4[_0x6ef6('0x197')][_0x6ef6('0x19f')]){_0x51f5f3[_0x6ef6('0x1a0')]={'user':_0x3cfff4[_0x6ef6('0x197')][_0x6ef6('0x19a')],'pass':_0x3cfff4[_0x6ef6('0x197')]['pass']};}if(this[_0x6ef6('0x80')](_0x5488e3['template_id'])){}logger[_0x6ef6('0xdc')]('sendMail\x20message',JSON[_0x6ef6('0x6f')](_0x19ba2a));this['createSquareDetailsReport'][_0x6ef6('0x6d')](this,_0x5488e3,_0x5488e3['account_id']);this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3cfff4[_0x6ef6('0x18')]));this[_0x6ef6('0x26')][_0x6ef6('0x6d')](this,_0x51f5f3,_0x19ba2a);return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x1a1'));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x1a2')]=function(_0x7ab4c8){logger['info'](util[_0x6ef6('0x29')](_0x6ef6('0x1a3'),_0x7ab4c8['label']));return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0x1a4'));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x1a5')]=function(_0x4c0261){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x1a6'),_0x4c0261[_0x6ef6('0x35')]));if(!this['isConfigured'](_0x4c0261['sms_account_id'])){return this['channel'][_0x6ef6('0xa5')](_0x6ef6('0x1a7'));}var _0x4bcf6d=this[_0x6ef6('0x1a8')]['sync'](this,_0x4c0261[_0x6ef6('0x1a9')]);if(!_0x4bcf6d){return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x4c0261,_0x6ef6('0x1aa'));}var _0x5a64ce={'body':_0x4c0261[_0x6ef6('0x1ab')],'phone':_0x4c0261['to']||'','SmsAccountId':_0x4bcf6d['id']};logger[_0x6ef6('0xdc')](_0x6ef6('0x1ac'),JSON[_0x6ef6('0x6f')](_0x5a64ce));this['createSquareDetailsReport'][_0x6ef6('0x6d')](this,_0x4c0261,_0x4c0261['sms_account_id']);this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4bcf6d[_0x6ef6('0x18')]));this[_0x6ef6('0x32')][_0x6ef6('0x6d')](this,_0x5a64ce);return this[_0x6ef6('0xf')][_0x6ef6('0xa5')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x1ef08e){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x1ad'),_0x1ef08e[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x1ef08e[_0x6ef6('0xd6')])){return this['channel'][_0x6ef6('0x30')](_0x1ef08e,_0x6ef6('0x1ae'));}var _0x2099e1=this[_0x6ef6('0xa0')][_0x6ef6('0x6d')](this,_0x1ef08e[_0x6ef6('0xd6')]);if(!_0x2099e1){return this['channel'][_0x6ef6('0x30')](_0x1ef08e,'no\x20variable\x20found');}return this[_0x6ef6('0xf')]['setVariable'](_0x2099e1,_0x1ef08e[_0x6ef6('0x1af')]);};AGIVertices[_0x6ef6('0x15')]['start']=function(_0xbfd932){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x1b0'),_0xbfd932[_0x6ef6('0x35')]));this[_0x6ef6('0xf')][_0x6ef6('0xa5')]('START\x20CALLY\x20SQUARE');if(_0xbfd932[_0x6ef6('0xb7')]===_0x6ef6('0x1b1')){this[_0x6ef6('0xf')]['noop'](_0x6ef6('0x1b2'));return this['channel']['answer']();}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x1b3'));};AGIVertices['prototype'][_0x6ef6('0x1b4')]=function(_0x592fee){logger['info'](util['format'](_0x6ef6('0x1b5'),_0x592fee[_0x6ef6('0x35')]));if(!this[_0x6ef6('0x80')](_0x592fee[_0x6ef6('0x1b6')])){return this[_0x6ef6('0xf')]['error'](_0x592fee,_0x6ef6('0x1b7'));}var _0x45534d=this[_0x6ef6('0x19')][_0x6ef6('0x6d')](this,_0x592fee['project_id']);if(!this[_0x6ef6('0x80')](_0x45534d)){return this[_0x6ef6('0xf')]['error'](_0x592fee,util[_0x6ef6('0x29')](_0x6ef6('0x1b8'),_0x592fee['project_id']));}if(_0x45534d===this['channel'][_0x6ef6('0x37')]){return this['channel'][_0x6ef6('0x30')](_0x592fee,_0x6ef6('0x1b9'));}this['createSquareDetailsReport'][_0x6ef6('0x6d')](this,_0x592fee,_0x45534d);var _0x3f7325=this[_0x6ef6('0xf')][_0x6ef6('0xa7')](_0x6ef6('0x1ba'),util[_0x6ef6('0x29')](_0x6ef6('0x1bb'),config[_0x6ef6('0x8')][_0x6ef6('0x19d')]||'127.0.0.1',_0x45534d,this[_0x6ef6('0xf')][_0x6ef6('0x37')]));if(_0x3f7325[_0x6ef6('0xa9')]===-0x1){return _0x3f7325;}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x173'),_0x6ef6('0x1ba'),_0x45534d));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x1bc')]=function(_0x1dcef8){logger['info'](util['format'](_0x6ef6('0x1bd'),_0x1dcef8[_0x6ef6('0x35')]));var _0xd5ff07=this['shellCommand'][_0x6ef6('0x6d')](this,_0x1dcef8[_0x6ef6('0xb5')]);this[_0x6ef6('0x33')][_0x6ef6('0x6d')](this,_0x1dcef8,_0x1dcef8[_0x6ef6('0xb5')]);if(this['isConfigured'](_0x1dcef8['variable_id'])){var _0x576838=this[_0x6ef6('0xa0')][_0x6ef6('0x6d')](this,_0x1dcef8[_0x6ef6('0xd6')]);if(_0x576838){this['channel'][_0x6ef6('0x9b')](_0x576838,_0xd5ff07);return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util['format'](_0x6ef6('0x1be'),_0x1dcef8[_0x6ef6('0xb5')],_0x576838));}}return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x1bf'),_0x1dcef8[_0x6ef6('0xb5')]));};AGIVertices[_0x6ef6('0x15')]['google_cloud_tts']=function(_0x25ce55){logger['info'](util[_0x6ef6('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x25ce55[_0x6ef6('0x35')]));_0x25ce55[_0x6ef6('0x5e')]=_0x25ce55['text'][_0x6ef6('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6ef6('0x80')](_0x25ce55[_0x6ef6('0x58')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0x1c0'));}if(!this[_0x6ef6('0x80')](_0x25ce55[_0x6ef6('0x5e')])){return this[_0x6ef6('0xf')][_0x6ef6('0xa5')](_0x6ef6('0xa6'));}this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util['format'](_0x6ef6('0x1c1'),_0x25ce55[_0x6ef6('0x5e')]));var _0x2ccdce=this[_0x6ef6('0x57')]['sync'](this,_0x25ce55);if(_0x2ccdce){this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x1c2'),_0x2ccdce));var _0x1eabe2=this['channel'][_0x6ef6('0x101')](_0x2ccdce);try{fs[_0x6ef6('0x102')](_0x2ccdce+_0x6ef6('0x124'));}catch(_0x42f272){logger[_0x6ef6('0x30')](_0x42f272);}return _0x1eabe2;}return this[_0x6ef6('0xf')][_0x6ef6('0x30')](_0x25ce55,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x1c3')]=function(_0x37b04f){logger[_0x6ef6('0x2c')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x37b04f[_0x6ef6('0x35')]));_0x37b04f[_0x6ef6('0x5e')]=_0x37b04f[_0x6ef6('0x5e')][_0x6ef6('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x37b04f[_0x6ef6('0x5e')])){return this[_0x6ef6('0xf')]['noop'](_0x6ef6('0xa6'));}this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x37b04f[_0x6ef6('0x5e')]));var _0x5e2095=this[_0x6ef6('0x5d')]['sync'](this,_0x37b04f);if(_0x5e2095){this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util[_0x6ef6('0x29')](_0x6ef6('0x1c4'),_0x5e2095));var _0x4a68da=this['channel'][_0x6ef6('0x101')](_0x5e2095);try{fs[_0x6ef6('0x102')](_0x5e2095+_0x6ef6('0x124'));}catch(_0x46658f){logger[_0x6ef6('0x30')](_0x46658f);}return _0x4a68da;}return this[_0x6ef6('0xf')]['error'](_0x37b04f,_0x6ef6('0x1c5'));};AGIVertices[_0x6ef6('0x15')][_0x6ef6('0x1c6')]=function(_0x1e8b58){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x1c7'),_0x1e8b58['label']));if(!this[_0x6ef6('0x80')](_0x1e8b58['findBy'])){return this[_0x6ef6('0xf')]['error'](_0x1e8b58,_0x6ef6('0x15c'));}logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x161'),this['channel'][_0x6ef6('0x38')],_0x1e8b58[_0x6ef6('0x15b')]));var _0x1727db=this[_0x6ef6('0x4e')]['sync'](this,_0x1e8b58[_0x6ef6('0x15b')]);if(_0x1727db){logger['info'](util[_0x6ef6('0x29')](_0x6ef6('0x15d'),this['channel'][_0x6ef6('0x38')],_0x1e8b58[_0x6ef6('0x15b')]));this[_0x6ef6('0xf')][_0x6ef6('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x1e8b58[_0x6ef6('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x15e'),this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x1e8b58[_0x6ef6('0x15b')]));this['channel'][_0x6ef6('0xa5')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6ef6('0xf')][_0x6ef6('0x38')],_0x1e8b58[_0x6ef6('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x6ef6('0x1c8')]=function(_0x5068b6){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x1c9'),_0x5068b6[_0x6ef6('0x35')]));var _0x417eed=this[_0x6ef6('0xf')][_0x6ef6('0xa7')](_0x6ef6('0x1ca'),[_0x5068b6[_0x6ef6('0x1cb')],_0x5068b6['options']]);if(_0x417eed[_0x6ef6('0xa9')]===-0x1){return _0x417eed;}return this['channel'][_0x6ef6('0xa5')](util[_0x6ef6('0x29')]('Executed\x20command\x20%s\x20%s',_0x6ef6('0x1ca'),_0x5068b6['mailbox']));};AGIVertices['prototype'][_0x6ef6('0x1cc')]=function(_0x8dc3ec){logger[_0x6ef6('0x2c')](util[_0x6ef6('0x29')](_0x6ef6('0x1cd'),_0x8dc3ec[_0x6ef6('0x35')]));if(!this['isConfigured'](_0x8dc3ec[_0x6ef6('0xd6')])){return this['channel']['error'](_0x8dc3ec,_0x6ef6('0x1ae'));}var _0x479cad=this['getVariable'][_0x6ef6('0x6d')](this,_0x8dc3ec[_0x6ef6('0xd6')]);if(!_0x479cad){return this['channel'][_0x6ef6('0x30')](_0x8dc3ec,_0x6ef6('0x115'));}var _0x1c0ea6=this[_0x6ef6('0xf')][_0x6ef6('0xa0')](_0x479cad);return{'code':0xc8,'result':_0x1c0ea6[_0x6ef6('0x9e')]?_0x1c0ea6[_0x6ef6('0x9e')]:'-'};};String[_0x6ef6('0x15')]['replaceAll']=function(_0x293e0f,_0x62ff3){return this[_0x6ef6('0x9c')](_0x293e0f)[_0x6ef6('0x1ce')](_0x62ff3);};module['exports']=AGIVertices; \ No newline at end of file +var _0xe0c1=['Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','getVariable','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','dialogflow','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','toUpperCase','out','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','toString','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','secure','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','failure','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','timeout','includes','PUT','method','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','url','stringify','render','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','length','replaceAll','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','label','no\x20text\x20configured','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','result','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','scheduledAt','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','custom_app'];(function(_0x28322e,_0x311fda){var _0x379bfc=function(_0x15c262){while(--_0x15c262){_0x28322e['push'](_0x28322e['shift']());}};_0x379bfc(++_0x311fda);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x1d7a33,_0x2fc6c0){_0x1d7a33=_0x1d7a33-0x0;var _0x2646ad=_0xe0c1[_0x1d7a33];return _0x2646ad;};'use strict';var fs=require('fs');var path=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var _=require(_0x1e0c('0x2'));var sh=require(_0x1e0c('0x3'));var odbc=require(_0x1e0c('0x4'))();var rs=require(_0x1e0c('0x5'));var moment=require(_0x1e0c('0x6'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x1e0c('0x7');var recursiveMapAttributes=[_0x1e0c('0x8'),_0x1e0c('0x9')];var verticesWithRetry=[_0x1e0c('0xa'),_0x1e0c('0xb'),_0x1e0c('0xc')];var AGIVertices=function(_0x364859,_0x1fe14b,_0x5182bb){this[_0x1e0c('0xd')]=_0x364859;this[_0x1e0c('0xe')]=_0x1fe14b;this[_0x1e0c('0xf')]=_0x5182bb;};AGIVertices[_0x1e0c('0x10')]['getVariable']=function(_0x452aee,_0x42b407){this[_0x1e0c('0xe')]['getVariableById'](_0x452aee)[_0x1e0c('0x11')](function(_0x504f4d){_0x42b407(null,_0x504f4d?_0x504f4d[_0x1e0c('0x12')]:![]);})[_0x1e0c('0x13')](function(_0x432542){_0x42b407(_0x432542);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x14')]=function(_0x2dd59a,_0x1aece1){this[_0x1e0c('0xe')][_0x1e0c('0x15')](_0x2dd59a)[_0x1e0c('0x11')](function(_0x599d0b){_0x1aece1(null,_0x599d0b?_0x599d0b[_0x1e0c('0x12')]:![]);})['catch'](function(_0x2500d7){_0x1aece1(_0x2500d7);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x16')]=function(_0xb52d20,_0x3dfe8e){this[_0x1e0c('0xe')][_0x1e0c('0x17')](_0xb52d20)['then'](function(_0x4315aa){_0x3dfe8e(null,_0x4315aa?_0x4315aa[_0x1e0c('0x12')]:![]);})[_0x1e0c('0x13')](function(_0x1755b4){_0x3dfe8e(_0x1755b4);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x596304,_0x18b981){this[_0x1e0c('0xe')][_0x1e0c('0x18')](_0x596304)[_0x1e0c('0x11')](function(_0x3f2a59){_0x18b981(null,_0x3f2a59?_0x3f2a59[_0x1e0c('0x19')]:![]);})[_0x1e0c('0x13')](function(_0x3c955c){_0x18b981(_0x3c955c);});};AGIVertices['prototype']['getUser']=function(_0x3885d2,_0x38d8bd){this[_0x1e0c('0xe')][_0x1e0c('0x1a')](_0x3885d2)['then'](function(_0x4743e7){_0x38d8bd(null,_0x4743e7?_0x4743e7[_0x1e0c('0x12')]:![]);})[_0x1e0c('0x13')](function(_0x1cf772){_0x38d8bd(_0x1cf772);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x1b')]=function(_0x509efd,_0x50f968){this[_0x1e0c('0xe')][_0x1e0c('0x1c')](_0x509efd)[_0x1e0c('0x11')](function(_0x46eb21){_0x50f968(null,_0x46eb21?_0x46eb21['name']:![]);})[_0x1e0c('0x13')](function(_0x104bf4){_0x50f968(_0x104bf4);});};AGIVertices[_0x1e0c('0x10')]['getSound']=function(_0xef59ad,_0x1a6a87){var _0x23efc0=this;this[_0x1e0c('0xe')][_0x1e0c('0x1d')](_0xef59ad)['then'](function(_0x6ffd65){_0x1a6a87(null,_0x6ffd65?_0x23efc0['getSoundPath'](_0x6ffd65[_0x1e0c('0x1e')]):![]);})['catch'](function(_0x105ca4){_0x1a6a87(_0x105ca4);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x1f')]=function(_0x28422a,_0x11cb84){this['rpc'][_0x1e0c('0x20')](_0x28422a)[_0x1e0c('0x11')](function(_0x57dfb6){_0x11cb84(null,_0x57dfb6?_0x57dfb6:![]);})['catch'](function(_0x13cf71){_0x11cb84(_0x13cf71);});};AGIVertices['prototype'][_0x1e0c('0x21')]=function(_0x39d12a,_0xca3b86,_0x47424e){this[_0x1e0c('0xf')][_0x1e0c('0x21')](_0x39d12a,_0xca3b86)[_0x1e0c('0x11')](function(){_0x47424e(null);})[_0x1e0c('0x13')](function(_0x1f3273){_0x47424e(_0x1f3273);});};AGIVertices[_0x1e0c('0x10')]['getIntervals']=function(_0x36a8bf,_0x525744){this[_0x1e0c('0xe')]['getIntervalById'](_0x36a8bf)[_0x1e0c('0x11')](function(_0x548c0b){if(_0x548c0b){if(_0x548c0b[_0x1e0c('0x22')]){_0x525744(null,[_0x548c0b[_0x1e0c('0x23')]]);}else{_0x525744(null,_['map'](_0x548c0b['Intervals'],'interval'));}}else{_0x525744(null,![]);}})[_0x1e0c('0x13')](function(_0x5ee462){_0x525744(_0x5ee462);});};AGIVertices['prototype'][_0x1e0c('0x24')]=function(_0x3a76d8){return util[_0x1e0c('0x25')](_0x1e0c('0x26'),FILES_PATH,_0x3a76d8);};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x27')]=function(_0x4eea3e,_0x458a45,_0x3c112b){odbc[_0x1e0c('0x28')](_0x4eea3e,function(_0x3bd6fd){if(_0x3bd6fd){logger[_0x1e0c('0x29')](_0x1e0c('0x2a'),_0x3bd6fd);_0x3c112b(_0x3bd6fd);}else{logger['info'](_0x1e0c('0x2b'));odbc[_0x1e0c('0x2c')](_0x458a45,function(_0x1b729b,_0x34053f){if(_0x1b729b){logger[_0x1e0c('0x2d')](_0x1e0c('0x2e'),_0x458a45);_0x3c112b(_0x1b729b);}else{logger['info'](_0x1e0c('0x2f'),_0x458a45);odbc[_0x1e0c('0x30')](function(_0x49d853){if(_0x49d853){logger[_0x1e0c('0x29')](_0x1e0c('0x31'),_0x49d853);}_0x3c112b(null,_0x34053f);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0xe2a24a,_0x33fa9c){this[_0x1e0c('0xe')][_0x1e0c('0x32')](_0xe2a24a)['then'](function(_0x531be7){_0x33fa9c(null,_0x531be7?_0x531be7:![]);})[_0x1e0c('0x13')](function(_0x4b213e){_0x33fa9c(_0x4b213e);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x33')]=function(_0x24c1ba,_0x510579){this['rpc'][_0x1e0c('0x33')](_0x24c1ba)['then'](function(_0x390f79){_0x510579(null,_0x390f79);})['catch'](function(_0x2f72e1){_0x510579(_0x2f72e1);});};AGIVertices['prototype'][_0x1e0c('0x34')]=function(_0x52c87e,_0x2a0aa0,_0x8cf19a){this[_0x1e0c('0xe')][_0x1e0c('0x34')]({'uniqueid':this[_0x1e0c('0xd')][_0x1e0c('0x35')],'node':_0x52c87e['label'],'application':_0x52c87e['agicommand'],'data':_0x2a0aa0||null,'project_name':this[_0x1e0c('0xd')][_0x1e0c('0x36')],'callerid':this[_0x1e0c('0xd')][_0x1e0c('0x37')]})[_0x1e0c('0x11')](function(_0x134563){if(_0x8cf19a){_0x8cf19a(null,_0x134563);}})['catch'](function(_0x16d330){if(_0x8cf19a){_0x8cf19a(_0x16d330);}});};AGIVertices[_0x1e0c('0x10')]['createSquareRecording']=function(_0x55cdc0,_0x1002d1,_0x2efcd9,_0x2f45f1){this[_0x1e0c('0xe')][_0x1e0c('0x38')]({'uniqueid':this[_0x1e0c('0xd')][_0x1e0c('0x35')],'callerid':this[_0x1e0c('0xd')][_0x1e0c('0x37')],'calleridname':this[_0x1e0c('0xd')][_0x1e0c('0x39')],'context':this[_0x1e0c('0xd')]['context'],'extension':this[_0x1e0c('0xd')]['extension'],'priority':this[_0x1e0c('0xd')][_0x1e0c('0x3a')],'accountcode':this[_0x1e0c('0xd')][_0x1e0c('0x3b')],'dnid':this[_0x1e0c('0xd')][_0x1e0c('0x3c')],'projectName':this[_0x1e0c('0xd')][_0x1e0c('0x36')],'saveName':_0x1002d1,'filename':_0x55cdc0['file']||_0x1002d1,'savePath':_0x2efcd9})['then'](function(_0x2f3f40){_0x2f45f1(null,_0x2f3f40);})[_0x1e0c('0x13')](function(_0x157490){_0x2f45f1(_0x157490);});};AGIVertices['prototype'][_0x1e0c('0x3d')]=function(_0x13b962,_0x4319a3,_0x4f6362,_0x49de82,_0xe234b0){this[_0x1e0c('0xe')]['createSquareMessage']({'uniqueid':this[_0x1e0c('0xd')][_0x1e0c('0x35')],'body':_0x13b962,'direction':_0x4319a3,'providerName':_0x4f6362,'providerResponse':_0x49de82})[_0x1e0c('0x11')](function(_0x4b81ed){if(_0xe234b0){_0xe234b0(null,_0x4b81ed);}})[_0x1e0c('0x13')](function(_0x4d8abb){if(_0xe234b0){_0xe234b0(_0x4d8abb);}});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x3e')]=function(_0x252609,_0x26e276){this[_0x1e0c('0xe')][_0x1e0c('0x3e')]({'firstName':_[_0x1e0c('0x3f')](_0x252609[_0x1e0c('0x12')])||_[_0x1e0c('0x40')](_0x252609['name'])?'callback_'+Math[_0x1e0c('0x41')]():_0x252609[_0x1e0c('0x12')],'lastName':_[_0x1e0c('0x3f')](_0x252609[_0x1e0c('0x42')])||_[_0x1e0c('0x40')](_0x252609[_0x1e0c('0x42')])?null:_0x252609['lastName'],'phone':_0x252609[_0x1e0c('0x43')],'ListId':_0x252609['list_id'],'scheduledat':_0x252609['scheduledAt'],'callbackUniqueid':this[_0x1e0c('0xd')]['uniqueid'],'tags':_0x1e0c('0x44'),'description':_0x1e0c('0x45')+_0x252609['scheduledAt']['toString'](),'priority':_0x252609[_0x1e0c('0x46')]})['then'](function(_0xae77a8){_0x26e276(null,_0xae77a8);})[_0x1e0c('0x13')](function(_0x519173){_0x26e276(_0x519173);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x47')]=function(_0x3a51b0,_0x242c69){this[_0x1e0c('0xe')][_0x1e0c('0x48')](_0x3a51b0)['then'](function(_0x552c4b){_0x242c69(null,_0x552c4b?_0x552c4b[_0x1e0c('0x12')]:![]);})[_0x1e0c('0x13')](function(_0x3f4b2e){_0x242c69(_0x3f4b2e);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x49')]=function(_0x1a3c49,_0xddf094,_0x5958b5){var _0x595ebe={'role':_0x1e0c('0x4a')};_0x595ebe[_0x1a3c49]=this[_0x1e0c('0xd')][_0x1e0c('0x37')];this[_0x1e0c('0xe')][_0x1e0c('0x49')](_0x595ebe,_0xddf094,this[_0x1e0c('0xd')]['uniqueid'])['then'](function(_0x469b49){_0x5958b5(null,_['isNil'](_0x469b49)?![]:!![]);})[_0x1e0c('0x13')](function(_0x342888){logger[_0x1e0c('0x29')](_0x342888);_0x5958b5(null,![]);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x4b')]=function(_0x188577,_0x48cc46){var _0x117914={'role':_0x1e0c('0x4a')};_0x117914[_0x188577]=this[_0x1e0c('0xd')][_0x1e0c('0x37')];this[_0x1e0c('0xe')]['agentUnpause'](_0x117914)[_0x1e0c('0x11')](function(_0x491251){_0x48cc46(null,_[_0x1e0c('0x40')](_0x491251)?![]:!![]);})[_0x1e0c('0x13')](function(_0x184a89){logger[_0x1e0c('0x29')](_0x184a89);_0x48cc46(null,![]);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x4c')]=function(_0x5cf65c,_0x24334f){var _0x2004ed={'role':_0x1e0c('0x4a')};_0x2004ed[_0x5cf65c]=this[_0x1e0c('0xd')]['callerid'];this[_0x1e0c('0xe')][_0x1e0c('0x4c')](_0x2004ed)[_0x1e0c('0x11')](function(_0x369b69){_0x24334f(null,_[_0x1e0c('0x40')](_0x369b69)?![]:!![]);})[_0x1e0c('0x13')](function(_0x5a1647){logger['error'](_0x5a1647);_0x24334f(null,![]);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x4d')]=function(_0x126969,_0x124b0f){var _0x5b7ddc={'role':_0x1e0c('0x4a')};_0x5b7ddc[_0x126969]=this[_0x1e0c('0xd')]['callerid'];var _0x4059f8=_0x126969!=_0x1e0c('0x4e')?util[_0x1e0c('0x25')]('%s/%s@from-sip/n','LOCAL',this[_0x1e0c('0xd')][_0x1e0c('0x37')]):undefined;this['rpc'][_0x1e0c('0x4d')](_0x5b7ddc,_0x4059f8)[_0x1e0c('0x11')](function(_0x514748){_0x124b0f(null,_[_0x1e0c('0x40')](_0x514748)?![]:!![]);})[_0x1e0c('0x13')](function(_0x1135bd){logger['error'](_0x1135bd);_0x124b0f(null,![]);});};AGIVertices[_0x1e0c('0x10')]['shellCommand']=function(_0x54c9ba,_0x30f08b){sh[_0x1e0c('0x4f')](_['trim'](_0x54c9ba),function(_0xe45fc7,_0x59b008){var _0x1842ec=_0x59b008[_0x1e0c('0x50')](/(\r\n|\n|\r)/gm,'');_0x30f08b(null,_0x1842ec);});};AGIVertices['prototype'][_0x1e0c('0x51')]=function(_0x2422eb,_0x1eb796){scripts[_0x1e0c('0x51')](_0x2422eb['apiKey'],_0x2422eb[_0x1e0c('0x52')]||_0x1e0c('0x53'),_0x2422eb[_0x1e0c('0x53')],_0x2422eb[_0x1e0c('0x54')]||_0x1e0c('0x55'),_0x2422eb[_0x1e0c('0x56')]||_0x1e0c('0x57'),_0x2422eb[_0x1e0c('0x58')]||_0x1e0c('0x59'))[_0x1e0c('0x11')](function(_0x491d39){_0x1eb796(null,_0x491d39);})[_0x1e0c('0x13')](function(_0x5ba3c0){_0x1eb796(_0x5ba3c0);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x5a')]=function(_0x350de7,_0x123189){scripts[_0x1e0c('0x5a')](_0x350de7[_0x1e0c('0x53')],_0x350de7[_0x1e0c('0x5b')]||'en',0x1)['then'](function(_0x371855){_0x123189(null,_0x371855);})['catch'](function(_0x24f57c){_0x123189(_0x24f57c);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x5c')]=function(_0x5d39e,_0x54134d){var _0x1e6e78={'uri':_0x5d39e['url'],'method':_0x5d39e['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5d39e['timeout'])==='number'&&parseInt(_0x5d39e['timeout'])>=0x1?parseInt(_0x5d39e[_0x1e0c('0x5d')])*0x3e8:0x5*0x3e8};if(_[_0x1e0c('0x5e')](['POST',_0x1e0c('0x5f')],_0x1e6e78[_0x1e0c('0x60')]['toUpperCase']())){try{_0x1e6e78[_0x1e0c('0x61')]=_0x5d39e[_0x1e0c('0x9')]?JSON[_0x1e0c('0x62')](_0x5d39e[_0x1e0c('0x9')]):{};}catch(_0x4ee37b){logger['error'](_0x1e0c('0x63'),_0x4ee37b);}}try{_0x1e6e78[_0x1e0c('0x64')]=_0x5d39e[_0x1e0c('0x8')]?JSON[_0x1e0c('0x62')](_0x5d39e[_0x1e0c('0x8')]):{};}catch(_0x2d6b3a){logger['error'](_0x1e0c('0x65'),_0x2d6b3a);}if(_0x5d39e['computedVariables']){try{var _0x2624af=require(_0x5d39e[_0x1e0c('0x66')])[_0x1e0c('0x67')](this,_0x1e6e78);_0x1e6e78[_0x1e0c('0x68')]=Mustache['render'](_0x5d39e[_0x1e0c('0x69')],_0x2624af,{},['$$','$$']);if(_0x1e6e78[_0x1e0c('0x64')]){_0x1e6e78[_0x1e0c('0x64')]=JSON['parse'](Mustache['render'](JSON[_0x1e0c('0x6a')](_0x1e6e78[_0x1e0c('0x64')]),_0x2624af,{},['$$','$$']));}if(_0x1e6e78[_0x1e0c('0x61')]){_0x1e6e78[_0x1e0c('0x61')]=JSON['parse'](Mustache[_0x1e0c('0x6b')](JSON[_0x1e0c('0x6a')](_0x1e6e78[_0x1e0c('0x61')]),_0x2624af,{},['$$','$$']));}}catch(_0x2a52aa){logger[_0x1e0c('0x29')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2a52aa);}}rp(_0x1e6e78)[_0x1e0c('0x11')](function(_0x4f0a93){var _0x12971e={'statusCode':_0x4f0a93[_0x1e0c('0x6c')]||0xc8,'statusMessage':_0x4f0a93[_0x1e0c('0x6d')]||'OK','headers':_0x4f0a93[_0x1e0c('0x64')]||{},'body':_0x4f0a93[_0x1e0c('0x61')]||{}};_0x54134d(null,_0x12971e);})[_0x1e0c('0x13')](function(_0x8173f6){var _0x41539b={'statusCode':_0x8173f6['statusCode']||0x1f4,'statusMessage':_0x8173f6[_0x1e0c('0x6e')]||_0x1e0c('0x6f'),'headers':_0x8173f6['options']['headers']||{},'body':_0x8173f6[_0x1e0c('0x70')]['body']||{}};_0x54134d(null,_0x41539b);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x71')]=function(_0x4198da,_0x292648){scripts['googleDialogflow'](this[_0x1e0c('0xd')][_0x1e0c('0x35')],_0x4198da['key'],_0x4198da[_0x1e0c('0x53')],_0x4198da[_0x1e0c('0x72')]||'en')['then'](function(_0x451441){_0x292648(null,_0x451441);})[_0x1e0c('0x13')](function(_0x5ab121){_0x292648(_0x5ab121);});};AGIVertices['prototype'][_0x1e0c('0x73')]=function(_0x13fc64,_0x3c7478){scripts[_0x1e0c('0x73')](this[_0x1e0c('0xd')][_0x1e0c('0x35')],_0x13fc64['dialogflowV2_project_id'],_0x13fc64[_0x1e0c('0x74')],_0x13fc64[_0x1e0c('0x75')],_0x13fc64[_0x1e0c('0x53')],_0x13fc64[_0x1e0c('0x76')]||'en')[_0x1e0c('0x11')](function(_0x305a65){_0x3c7478(null,_0x305a65);})['catch'](function(_0xfd01cd){_0x3c7478(_0xfd01cd);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x77')]=function(_0x52ddb1,_0x555b5b){scripts['sestekNDA'](this['channel'],_0x52ddb1)[_0x1e0c('0x11')](function(_0x1e7777){_0x555b5b(null,_0x1e7777);})[_0x1e0c('0x13')](function(_0x4a422c){_0x555b5b(_0x4a422c);});};AGIVertices['prototype'][_0x1e0c('0x78')]=function(_0x5666c9,_0x23277a){scripts['ispeechTTS'](_0x5666c9[_0x1e0c('0x79')],_0x5666c9[_0x1e0c('0x53')],_0x5666c9[_0x1e0c('0x7a')]||_0x1e0c('0x55'),_0x5666c9['speed'])['then'](function(_0x4c81fd){_0x23277a(null,_0x4c81fd);})[_0x1e0c('0x13')](function(_0x47c209){_0x23277a(_0x47c209);});};AGIVertices[_0x1e0c('0x10')]['ispeechASR']=function(_0xecc94e,_0x15d73a,_0x1c1fb0){scripts[_0x1e0c('0x7b')](_0x15d73a,_0xecc94e[_0x1e0c('0x79')],_0xecc94e['ispeech_asr_language']||_0x1e0c('0x55'),this[_0x1e0c('0x7c')](_0xecc94e['model'])?_0xecc94e[_0x1e0c('0x7d')]:undefined)[_0x1e0c('0x11')](function(_0x3e175b){_0x1c1fb0(null,_0x3e175b);})[_0x1e0c('0x13')](function(_0x18b32b){_0x1c1fb0(_0x18b32b);});};AGIVertices['prototype'][_0x1e0c('0x7e')]=function(_0x3234ac,_0x25291f){scripts[_0x1e0c('0x7e')](_0x3234ac[_0x1e0c('0x7f')],_0x3234ac['aws_secret_access_key'],_0x3234ac['aws_polly_region'],_0x3234ac[_0x1e0c('0x80')]||_0x1e0c('0x81'),_0x3234ac[_0x1e0c('0x53')],_0x3234ac[_0x1e0c('0x82')]||'text')[_0x1e0c('0x11')](function(_0xc6cb05){_0x25291f(null,_0xc6cb05);})['catch'](function(_0x3ce21a){_0x25291f(_0x3ce21a);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x83')]=function(_0x5abfef,_0x33a578){scripts[_0x1e0c('0x83')](this['channel']['uniqueid'],_0x5abfef['aws_access_key_id'],_0x5abfef['aws_secret_access_key'],_0x5abfef[_0x1e0c('0x84')],_0x5abfef[_0x1e0c('0x53')],_0x5abfef['aws_bot_name'])[_0x1e0c('0x11')](function(_0x3c9b78){_0x33a578(null,_0x3c9b78);})[_0x1e0c('0x13')](function(_0x53b8a8){_0x33a578(_0x53b8a8);});};AGIVertices[_0x1e0c('0x10')]['googleASR']=function(_0x1f0a13,_0x2810ff,_0x22d14d){scripts[_0x1e0c('0x85')](_0x2810ff,_0x1f0a13[_0x1e0c('0x79')],_0x1f0a13[_0x1e0c('0x86')]||_0x1e0c('0x55'))[_0x1e0c('0x11')](function(_0x1a2354){_0x22d14d(null,_0x1a2354);})[_0x1e0c('0x13')](function(_0x3931b4){_0x22d14d(_0x3931b4);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x87')]=function(_0xe8441d,_0x4d4266,_0x4250e1){scripts[_0x1e0c('0x87')](_0x4d4266,_0xe8441d[_0x1e0c('0x88')],_0xe8441d[_0x1e0c('0x89')],_0xe8441d[_0x1e0c('0x68')])[_0x1e0c('0x11')](function(_0x4d1ce2){_0x4250e1(null,_0x4d1ce2);})[_0x1e0c('0x13')](function(_0x116ded){_0x4250e1(_0x116ded);});};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x8a')]=function(_0x411f2d){var _0x207e70=_[_0x1e0c('0x5e')](verticesWithRetry,_0x411f2d[_0x1e0c('0x8b')])?_0x411f2d:_['clone'](_0x411f2d);for(var _0x5545cb in _0x207e70){if(_0x207e70['hasOwnProperty'](_0x5545cb)){if(_0x207e70[_0x5545cb]&&_['isString'](_0x207e70[_0x5545cb])){if(_[_0x1e0c('0x5e')](recursiveMapAttributes,_0x5545cb)){_0x207e70[_0x5545cb]=this[_0x1e0c('0x8c')](_0x207e70[_0x5545cb]);}else{_0x207e70[_0x5545cb]=this['replaceAllVariables'](_0x207e70[_0x5545cb]);}}}}return _0x207e70;};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x8d')]=function(_0x23cd96){for(var _0x12892a in _0x23cd96){if(_0x23cd96[_0x1e0c('0x8e')](_0x12892a)){if(_[_0x1e0c('0x8f')](_0x23cd96[_0x12892a])){this['recursiveNodeIndex'](_0x23cd96[_0x12892a]);}else if(_[_0x1e0c('0x90')](_0x23cd96[_0x12892a])){for(var _0x2fd232=0x0;_0x2fd232<_0x23cd96[_0x12892a]['length'];_0x2fd232++){this[_0x1e0c('0x8d')](_0x23cd96[_0x12892a][_0x2fd232]);}}else if(_[_0x1e0c('0x91')](_0x23cd96[_0x12892a])){_0x23cd96[_0x12892a]=this[_0x1e0c('0x92')](_0x23cd96[_0x12892a]);}}}};AGIVertices['prototype'][_0x1e0c('0x93')]=function(_0x2a0b2a,_0x1096b6){for(var _0x36ddc4 in _0x2a0b2a){if(_0x2a0b2a[_0x1e0c('0x8e')](_0x36ddc4)){if(_[_0x1e0c('0x8f')](_0x2a0b2a[_0x36ddc4])){if(!_[_0x1e0c('0x3f')](_0x2a0b2a[_0x36ddc4])){this[_0x1e0c('0x93')](_0x2a0b2a[_0x36ddc4],util[_0x1e0c('0x25')](_0x1e0c('0x94'),_0x1096b6,_0x36ddc4));}}else if(_[_0x1e0c('0x90')](_0x2a0b2a[_0x36ddc4])){for(var _0x5bceb6=0x0;_0x5bceb6<_0x2a0b2a[_0x36ddc4]['length'];_0x5bceb6++){this[_0x1e0c('0x93')](_0x2a0b2a[_0x36ddc4][_0x5bceb6],util[_0x1e0c('0x25')]('%s.%s',_0x1096b6,_0x36ddc4+'['+_0x5bceb6+']'));}}else{if(!_[_0x1e0c('0x40')](_0x2a0b2a[_0x36ddc4])){this['channel'][_0x1e0c('0x95')](util[_0x1e0c('0x25')](_0x1e0c('0x94'),_0x1096b6,_0x36ddc4),_0x2a0b2a[_0x36ddc4]);}}}}};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x8c')]=function(_0x1dd1f1){try{var _0x15ffde=JSON[_0x1e0c('0x62')](_0x1dd1f1);this[_0x1e0c('0x8d')](_0x15ffde);return JSON[_0x1e0c('0x6a')](_0x15ffde);}catch(_0x2fa308){return this[_0x1e0c('0x92')](_0x1dd1f1);}};AGIVertices['prototype'][_0x1e0c('0x92')]=function(_0x4cb5a1){var _0x2f61ae=_0x4cb5a1['split']('{');for(var _0x2342df=0x1;_0x2342df<_0x2f61ae['length'];_0x2342df+=0x1){var _0x5062e0=_0x2f61ae[_0x2342df]['split']('}');if(_0x5062e0[_0x1e0c('0x96')]>0x1){_0x4cb5a1=_0x4cb5a1[_0x1e0c('0x97')]('{'+_0x5062e0[0x0]+'}',this[_0x1e0c('0xd')]['getVariable'](_0x5062e0[0x0])['extra']||_0x5062e0[0x0]);}}if(_0x2f61ae[_0x1e0c('0x96')]===0x1){return _0x4cb5a1['toString']();}return this['replaceAllVariables'](_0x4cb5a1);};AGIVertices[_0x1e0c('0x10')]['getAndSetVariable']=function(_0x3c9752,_0x18ce34){var _0x283bf0=this['channel']['getVariable'](_0x3c9752);if(_0x283bf0['result']===-0x1){return _0x283bf0;}logger[_0x1e0c('0x2d')](util['format'](_0x1e0c('0x98'),_0x18ce34,_0x283bf0[_0x1e0c('0x99')]));return this['channel'][_0x1e0c('0x95')](_0x18ce34,_0x283bf0[_0x1e0c('0x99')]);};AGIVertices[_0x1e0c('0x10')]['isConfigured']=function(_0x5abcf6){return _0x5abcf6&&_0x5abcf6!=='0'&&_0x5abcf6!=='-1'&&_0x5abcf6!=='';};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x9a')]=function(_0x5a8361){this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0x5a8361,'-');_0x5a8361['retry']=_0x5a8361['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x1e0c('0x9b')]=function(_0x3ac8cc){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x3ac8cc[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x3ac8cc[_0x1e0c('0x53')])){return this[_0x1e0c('0xd')]['noop'](_0x1e0c('0x9d'));}var _0x3683ce='\x22'+_0x3ac8cc[_0x1e0c('0x53')]+'\x22';if(this[_0x1e0c('0x7c')](_0x3ac8cc['options'])){_0x3683ce+=','+_0x3ac8cc[_0x1e0c('0x70')];}var _0x528eeb=this['channel'][_0x1e0c('0x4f')]('MRCPSynth',_0x3683ce);if(_0x528eeb['result']===-0x1){return _0x528eeb;}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0x9f'),_0x3683ce));};AGIVertices[_0x1e0c('0x10')]['mrcprecog']=function(_0x103a1d){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0xa0'),_0x103a1d[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x103a1d['grammar'])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0xa1'));}var _0x29e638=_0x103a1d[_0x1e0c('0xa2')];if(this['isConfigured'](_0x103a1d['options'])){_0x29e638+=','+_0x103a1d[_0x1e0c('0x70')];}var _0x472dd9=this[_0x1e0c('0xd')][_0x1e0c('0x4f')](_0x1e0c('0xa3'),_0x29e638);if(_0x472dd9[_0x1e0c('0xa4')]===-0x1){return _0x472dd9;}var _0x3149bd=this[_0x1e0c('0xa5')](_0x1e0c('0xa6'),_0x1e0c('0xa7'));if(_0x3149bd[_0x1e0c('0xa4')]===-0x1){return _0x3149bd;}var _0x6c3cef=this[_0x1e0c('0xa5')](_0x1e0c('0xa8'),_0x1e0c('0xa9'));if(_0x6c3cef[_0x1e0c('0xa4')]===-0x1){return _0x6c3cef;}var _0x596dca=this['getAndSetVariable'](_0x1e0c('0xaa'),_0x1e0c('0xab'));if(_0x596dca['result']===-0x1){return _0x596dca;}return this[_0x1e0c('0xd')]['noop'](util['format'](_0x1e0c('0xac'),_0x29e638));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xad')]=function(_0x1bcd8e){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0xae'),_0x1bcd8e[_0x1e0c('0x9c')]));return this[_0x1e0c('0xd')]['agi']([_0x1bcd8e['command'],_0x1bcd8e[_0x1e0c('0xaf')]]);};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xb0')]=function(_0x4787b9){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0xb1'),_0x4787b9[_0x1e0c('0x9c')]));if(this[_0x1e0c('0x7c')](_0x4787b9['timeout'])){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4787b9[_0x1e0c('0x5d')]));var _0x378ef5=this['channel'][_0x1e0c('0xb2')](_0x4787b9['timeout']);if(_0x378ef5[_0x1e0c('0xa4')]===-0x1){return _0x378ef5;}}return this['channel']['answer']();};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x44')]=function(_0x3db8c4){logger[_0x1e0c('0x2d')](util['format'](_0x1e0c('0xb3'),_0x3db8c4[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x3db8c4['list_id'])){return this['channel']['error'](_0x3db8c4,'no\x20list\x20selected');}_0x3db8c4[_0x1e0c('0xb4')]=moment();if(this[_0x1e0c('0x7c')](_0x3db8c4[_0x1e0c('0xb5')])){_0x3db8c4['scheduledAt']=moment()[_0x1e0c('0xb6')](_0x3db8c4['delay'],_0x1e0c('0xb7'));}if(!this[_0x1e0c('0x7c')](_0x3db8c4[_0x1e0c('0x46')])){_0x3db8c4[_0x1e0c('0x46')]=0x2;}this['createCmContact'][_0x1e0c('0x67')](this,_0x3db8c4);return this[_0x1e0c('0xd')]['noop'](util['format'](_0x1e0c('0xb8'),_0x3db8c4[_0x1e0c('0x43')],_0x3db8c4[_0x1e0c('0xb9')],_0x3db8c4[_0x1e0c('0xb4')]));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xba')]=function(_0x2d285e){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0xbb'),_0x2d285e[_0x1e0c('0x9c')]));var _0x1a5f43=this[_0x1e0c('0xd')][_0x1e0c('0x4f')](_0x2d285e['application'],_0x2d285e['options']);if(_0x1a5f43[_0x1e0c('0xa4')]===-0x1){return _0x1a5f43;}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0xbc'),_0x2d285e['application'],_0x2d285e[_0x1e0c('0x70')]));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xbd')]=function(_0x594973){logger['info'](util[_0x1e0c('0x25')](_0x1e0c('0xbe'),_0x594973[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x594973[_0x1e0c('0x53')])){return this['channel']['noop'](_0x1e0c('0x9d'));}var _0x2f6e04='\x22'+_0x594973[_0x1e0c('0x53')]+'\x22';if(this['isConfigured'](_0x594973[_0x1e0c('0x70')])){_0x2f6e04+=','+_0x594973['options'];}var _0x2d9cac=this['channel'][_0x1e0c('0x4f')](_0x1e0c('0xbf'),_0x2f6e04);if(_0x2d9cac[_0x1e0c('0xa4')]===-0x1){return _0x2d9cac;}return this['channel']['noop'](util[_0x1e0c('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2f6e04));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xc0')]=function(_0x5a1370){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0xc1'),_0x5a1370[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x5a1370[_0x1e0c('0x53')])){return this[_0x1e0c('0xd')]['noop'](_0x1e0c('0x9d'));}var _0x17058a='\x22'+_0x5a1370[_0x1e0c('0x53')]+'\x22';if(this[_0x1e0c('0x7c')](_0x5a1370[_0x1e0c('0x70')])){_0x17058a+=','+_0x5a1370['options'];}var _0x1b99c2=this['channel'][_0x1e0c('0x4f')]('MRCPSynth',_0x17058a);if(_0x1b99c2[_0x1e0c('0xa4')]===-0x1){return _0x1b99c2;}return this['channel'][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x9f'),_0x17058a));};AGIVertices['prototype']['lumenvoxasr']=function(_0x2042f0){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0xc2'),_0x2042f0[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x2042f0[_0x1e0c('0xa2')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0xa1'));}var _0x4e2023=_0x2042f0[_0x1e0c('0xa2')];if(this[_0x1e0c('0x7c')](_0x2042f0[_0x1e0c('0x70')])){_0x4e2023+=','+_0x2042f0[_0x1e0c('0x70')];}var _0x9e24b1=this[_0x1e0c('0xd')][_0x1e0c('0x4f')](_0x1e0c('0xa3'),_0x4e2023);if(_0x9e24b1[_0x1e0c('0xa4')]===-0x1){return _0x9e24b1;}var _0x32cd20=this[_0x1e0c('0xa5')](_0x1e0c('0xa6'),_0x1e0c('0xc3'));if(_0x32cd20[_0x1e0c('0xa4')]===-0x1){return _0x32cd20;}var _0x15a1da=this[_0x1e0c('0xa5')](_0x1e0c('0xa8'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x15a1da[_0x1e0c('0xa4')]===-0x1){return _0x15a1da;}var _0x11c1bd=this[_0x1e0c('0xa5')]('RECOG_INSTANCE()',_0x1e0c('0xc4'));if(_0x11c1bd[_0x1e0c('0xa4')]===-0x1){return _0x11c1bd;}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4e2023));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xc5')]=function(_0x547aa6){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0xc6'),_0x547aa6['label']));if(!this[_0x1e0c('0x7c')](_0x547aa6[_0x1e0c('0xa2')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0xa1'));}var _0x584fb9=_0x547aa6[_0x1e0c('0xa2')];if(this[_0x1e0c('0x7c')](_0x547aa6['options'])){_0x584fb9+=','+_0x547aa6[_0x1e0c('0x70')];}var _0x666eaf=this[_0x1e0c('0xd')][_0x1e0c('0x4f')](_0x1e0c('0xa3'),_0x584fb9);if(_0x666eaf[_0x1e0c('0xa4')]===-0x1){return _0x666eaf;}var _0x48a8b0=this[_0x1e0c('0xa5')]('RECOG_CONFIDENCE()',_0x1e0c('0xc7'));if(_0x48a8b0[_0x1e0c('0xa4')]===-0x1){return _0x48a8b0;}var _0x33a20f=this[_0x1e0c('0xa5')](_0x1e0c('0xa8'),_0x1e0c('0xc8'));if(_0x33a20f['result']===-0x1){return _0x33a20f;}var _0x1bb71f=this['getAndSetVariable'](_0x1e0c('0xaa'),'SESTEK_ASR_INSTANCE');if(_0x1bb71f[_0x1e0c('0xa4')]===-0x1){return _0x1bb71f;}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0xac'),_0x584fb9));};AGIVertices[_0x1e0c('0x10')]['database']=function(_0x53b9cb){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x53b9cb[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x53b9cb[_0x1e0c('0xc9')])){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x53b9cb,_0x1e0c('0xca'));}var _0x96575b=this[_0x1e0c('0xcb')][_0x1e0c('0x67')](this,_0x53b9cb[_0x1e0c('0xc9')]);if(!_0x96575b){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x53b9cb,_0x1e0c('0xcc'));}if(!this['isConfigured'](_0x53b9cb[_0x1e0c('0x2c')])){return this[_0x1e0c('0xd')]['error'](_0x53b9cb,_0x1e0c('0xcd'));}var _0x19182a=_0x53b9cb[_0x1e0c('0x2c')][_0x1e0c('0x50')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0xce'),_0x19182a));var _0x42f233=this[_0x1e0c('0x27')][_0x1e0c('0x67')](this,_0x96575b,_0x19182a);this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0x53b9cb,_0x19182a);if(!this[_0x1e0c('0x7c')](_0x53b9cb[_0x1e0c('0xcf')])){return this['channel'][_0x1e0c('0x9e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x265280=this[_0x1e0c('0xd0')]['sync'](this,_0x53b9cb['variable_id']);if(!_0x265280){return this['channel']['error'](_0x53b9cb,_0x1e0c('0xd1'));}var _0x398c73=this;_0x42f233[_0x1e0c('0xd2')](function(_0x576979,_0x2b99bc){Object[_0x1e0c('0xd3')](_0x576979)[_0x1e0c('0xd2')](function(_0x3f0847){_0x398c73['channel'][_0x1e0c('0x95')](util[_0x1e0c('0x25')](_0x1e0c('0xd4'),_0x265280,_0x2b99bc,_0x3f0847),_0x576979[_0x3f0847]);});});this['channel'][_0x1e0c('0x95')](util[_0x1e0c('0x25')](_0x1e0c('0xd5'),_0x265280),_0x42f233[_0x1e0c('0x96')]);return this[_0x1e0c('0xd')]['noop'](util[_0x1e0c('0x25')]('variable\x20%s\x20set',_0x265280));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xd6')]=function(_0x1d2566){logger[_0x1e0c('0xd7')](util['format'](_0x1e0c('0xd8'),_0x1d2566[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x1d2566[_0x1e0c('0xd9')])){return this[_0x1e0c('0xd')]['error'](_0x1d2566,'no\x20user\x20selected');}var _0x50e87f=this[_0x1e0c('0xda')][_0x1e0c('0x67')](this,_0x1d2566[_0x1e0c('0xd9')]);if(!_0x50e87f){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x1d2566,_0x1e0c('0xdb'));}var _0x1aebca=this[_0x1e0c('0xd')]['exec'](_0x1e0c('0xdc'),[util[_0x1e0c('0x25')](_0x1e0c('0xdd'),_0x50e87f),_0x1d2566['timeout'],_0x1d2566[_0x1e0c('0xde')],_0x1d2566[_0x1e0c('0x69')]]);if(_0x1aebca['result']===-0x1){return _0x1aebca;}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0xdf'),_0x1e0c('0xdc')));};AGIVertices['prototype']['dialogflow']=function(_0x3f8983){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0xe0'),_0x3f8983[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x3f8983['key'])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')]('no\x20key\x20configured');}if(!this[_0x1e0c('0x7c')](_0x3f8983['text'])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x9d'));}this[_0x1e0c('0xd')][_0x1e0c('0xe1')]=!![];this['createSquareDetailsReport'](_0x3f8983);this[_0x1e0c('0x3d')](_0x3f8983[_0x1e0c('0x53')],'in','','');this['channel'][_0x1e0c('0x9e')](util['format'](_0x1e0c('0xe2'),_0x3f8983['text']));var _0x3ab70d=this[_0x1e0c('0x71')][_0x1e0c('0x67')](this,_0x3f8983);if(_0x3ab70d){for(var _0x32cab0 in _0x3ab70d){if(_0x3ab70d[_0x1e0c('0x8e')](_0x32cab0)){this[_0x1e0c('0xd')][_0x1e0c('0x95')](util[_0x1e0c('0x25')](_0x1e0c('0xe3'),_0x32cab0['toUpperCase']()),_0x3ab70d[_0x32cab0]);}}this['createSquareMessage'](_0x3ab70d[_0x1e0c('0xe4')],'out',_0x1e0c('0xe5'),'');return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0xe6'),_0x3ab70d[_0x1e0c('0xe4')]));}return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x3f8983,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xe7')]=function(_0x5680c5){logger[_0x1e0c('0x2d')](util['format'](_0x1e0c('0xe8'),_0x5680c5['label']));if(!this[_0x1e0c('0x7c')](_0x5680c5['dialogflowV2_project_id'])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0xe9'));}if(!this['isConfigured'](_0x5680c5['client_email'])){return this[_0x1e0c('0xd')]['noop'](_0x1e0c('0xea'));}if(!this[_0x1e0c('0x7c')](_0x5680c5['private_key'])){return this[_0x1e0c('0xd')]['noop'](_0x1e0c('0xeb'));}if(!this[_0x1e0c('0x7c')](_0x5680c5[_0x1e0c('0x76')])){return this[_0x1e0c('0xd')]['noop'](_0x1e0c('0xec'));}if(!this[_0x1e0c('0x7c')](_0x5680c5[_0x1e0c('0x53')])){return this['channel']['noop'](_0x1e0c('0x9d'));}this[_0x1e0c('0xd')][_0x1e0c('0xe1')]=!![];this[_0x1e0c('0x34')](_0x5680c5);this[_0x1e0c('0x3d')](_0x5680c5['text'],'in','','');this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0xed'),_0x5680c5[_0x1e0c('0x53')]));var _0x3382e5=this['googleDialogflowV2'][_0x1e0c('0x67')](this,_0x5680c5);if(_0x3382e5){for(var _0x45971b in _0x3382e5){if(_0x3382e5[_0x1e0c('0x8e')](_0x45971b)){if(_0x45971b!==_0x1e0c('0xee')){this[_0x1e0c('0xd')][_0x1e0c('0x95')](util['format']('DIALOGFLOW_%s',_0x45971b['toUpperCase']()),_0x3382e5[_0x45971b]);}}}this[_0x1e0c('0x3d')](_0x3382e5[_0x1e0c('0xe4')],'out',_0x1e0c('0xe7'),_0x3382e5[_0x1e0c('0xee')]);return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0xef'),_0x3382e5[_0x1e0c('0xe4')]));}return this['channel'][_0x1e0c('0x29')](_0x5680c5,_0x1e0c('0xf0'));};AGIVertices['prototype'][_0x1e0c('0xf1')]=function(_0x4f4d94){logger['info'](util['format'](_0x1e0c('0xf2'),_0x4f4d94['label']));if(!this[_0x1e0c('0x7c')](_0x4f4d94['ndauth_url'])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x1e0c('0x7c')](_0x4f4d94['username'])){return this['channel'][_0x1e0c('0x9e')](_0x1e0c('0xf3'));}if(!this[_0x1e0c('0x7c')](_0x4f4d94['password'])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0xf4'));}if(!this[_0x1e0c('0x7c')](_0x4f4d94['ndassistant_url'])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x9d'));}this[_0x1e0c('0xd')][_0x1e0c('0xe1')]=!![];this[_0x1e0c('0x34')](_0x4f4d94);this[_0x1e0c('0x3d')](_0x4f4d94['text'],'in','','');this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0xf5'),_0x4f4d94[_0x1e0c('0x53')]));var _0x3a46fa=this[_0x1e0c('0x77')]['sync'](this,_0x4f4d94);if(_0x3a46fa){for(var _0x373294 in _0x3a46fa){if(_0x3a46fa[_0x1e0c('0x8e')](_0x373294)){this[_0x1e0c('0xd')][_0x1e0c('0x95')](util[_0x1e0c('0x25')](_0x1e0c('0xf6'),_0x373294[_0x1e0c('0xf7')]()),_0x3a46fa[_0x373294]);}}this['createSquareMessage'](_0x3a46fa[_0x1e0c('0xe4')],_0x1e0c('0xf8'),'sesteknda','');if(_0x3a46fa['audiofile']){this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0xf9'),_0x3a46fa['audiofile']));var _0x492041=this[_0x1e0c('0xd')][_0x1e0c('0xfa')](_0x3a46fa[_0x1e0c('0xfb')]);try{fs[_0x1e0c('0xfc')](_0x3a46fa[_0x1e0c('0xfb')]+'.wav');}catch(_0x250ea2){logger['error'](_0x250ea2);}return _0x492041;}else{return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0xfd'),_0x3a46fa['speech']));}}return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x4f4d94,_0x1e0c('0xfe'));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xff')]=function(_0x5b5d9c){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x100'),_0x5b5d9c[_0x1e0c('0x9c')]));return this['channel'][_0x1e0c('0x9e')](_0x1e0c('0xff'));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x101')]=function(_0x5eb60e){logger['info'](util['format'](_0x1e0c('0x102'),_0x5eb60e['label']));var _0x491f9d='';if(_0x5eb60e[_0x1e0c('0x103')]){if(!this[_0x1e0c('0x7c')](_0x5eb60e['trunk_id'])){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x5eb60e,_0x1e0c('0x104'));}else{var _0x470722=parseInt(_0x5eb60e[_0x1e0c('0x103')],0xa);if(isNaN(_0x470722)){_0x491f9d=_0x5eb60e[_0x1e0c('0x103')];}else{_0x491f9d=this[_0x1e0c('0x1b')][_0x1e0c('0x67')](this,_0x5eb60e[_0x1e0c('0x103')]);if(!_0x491f9d){return this[_0x1e0c('0xd')]['error'](_0x5eb60e,_0x1e0c('0x105'));}}}}else if(_0x5eb60e['trunk_name']){_0x491f9d=_0x5eb60e[_0x1e0c('0x106')];}else{return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x5eb60e,_0x1e0c('0x104'));}var _0x573674=this[_0x1e0c('0xd')][_0x1e0c('0x4f')](_0x1e0c('0xdc'),[util[_0x1e0c('0x25')](_0x1e0c('0x107'),_0x491f9d,_0x5eb60e[_0x1e0c('0x43')]),_0x5eb60e[_0x1e0c('0x5d')],_0x5eb60e['opts'],_0x5eb60e['url']]);if(_0x573674[_0x1e0c('0xa4')]===-0x1){return _0x573674;}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0xdf'),_0x1e0c('0xdc')));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x108')]=function(_0x4a8e89){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x109'),_0x4a8e89[_0x1e0c('0x9c')]));return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x108'));};AGIVertices[_0x1e0c('0x10')]['getdigits']=function(_0xeff20f){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xeff20f[_0x1e0c('0x9c')]));if(_0xeff20f[_0x1e0c('0x10a')]===0x0){return this[_0x1e0c('0x9a')](_0xeff20f);}_0xeff20f[_0x1e0c('0x10a')]-=0x1;if(!this[_0x1e0c('0x7c')](_0xeff20f['file_id'])){return this['channel'][_0x1e0c('0x29')](_0xeff20f,_0x1e0c('0x10b'));}var _0x42d48c=this[_0x1e0c('0x10c')][_0x1e0c('0x67')](this,_0xeff20f[_0x1e0c('0x10d')]);if(!_0x42d48c){return this['channel'][_0x1e0c('0x29')](_0xeff20f,_0x1e0c('0x10e'));}if(!this[_0x1e0c('0x7c')](_0xeff20f['variable_id'])){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x1e0c('0x10f'));}var _0x1667d1=this[_0x1e0c('0xd')][_0x1e0c('0x110')](_0x42d48c,_0xeff20f[_0x1e0c('0x111')],_0xeff20f[_0x1e0c('0x112')]);var _0xa8c07d=_0x1667d1['result']?_0x1667d1[_0x1e0c('0xa4')][_0x1e0c('0x113')]():'';logger[_0x1e0c('0x2d')]('test',JSON[_0x1e0c('0x6a')](_0x1667d1));if(_0x1667d1[_0x1e0c('0xa4')]===-0x1){this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0xeff20f,_0xa8c07d);return _0x1667d1;}else if(_0x1667d1[_0x1e0c('0x99')]===_0x1e0c('0x5d')){_0x1667d1[_0x1e0c('0xa4')]=_0xa8c07d[_0x1e0c('0x96')]>=parseInt(_0xeff20f[_0x1e0c('0x114')])?'x':'i';}else{_0x1667d1[_0x1e0c('0xa4')]=_0xa8c07d[_0x1e0c('0x96')]>=parseInt(_0xeff20f[_0x1e0c('0x114')])&&_0xa8c07d[_0x1e0c('0x96')]<=parseInt(_0xeff20f[_0x1e0c('0x112')])?'x':'i';}var _0x3bbb48=this[_0x1e0c('0xd0')][_0x1e0c('0x67')](this,_0xeff20f[_0x1e0c('0xcf')]);if(!_0x3bbb48){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0xeff20f,_0x1e0c('0xd1'));}this[_0x1e0c('0xd')][_0x1e0c('0x95')](_0x3bbb48,_0xa8c07d);if(this[_0x1e0c('0x7c')](_0xeff20f[_0x1e0c('0x115')])){var _0x192e39=parseInt(_0xeff20f['hiddendigitsnum'],0xa);var _0x305667=rs[_0x1e0c('0x116')]({'charset':'*','length':_0x192e39});var _0x160789=_0xa8c07d[_0x1e0c('0x96')];if(_0x160789>0x0){if(_0x160789>_0x192e39){this['createSquareDetailsReport']['sync'](this,_0xeff20f,_0xeff20f[_0x1e0c('0x117')]==='first'?_0x305667+_0xa8c07d['substr'](_0x192e39):_0xa8c07d[_0x1e0c('0x118')](0x0,_0x160789-_0x192e39)+_0x305667);}else{this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0xeff20f,rs[_0x1e0c('0x116')]({'charset':'*','length':_0x160789}));}}else{this['createSquareDetailsReport']['sync'](this,_0xeff20f,'');}}else{this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0xeff20f,_0xa8c07d);}return _0x1667d1;};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0xc')]=function(_0x570f4a){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x570f4a[_0x1e0c('0x9c')]));return this[_0x1e0c('0xb')](_0x570f4a);};AGIVertices['prototype'][_0x1e0c('0x119')]=function(_0x4ff2cf){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4ff2cf[_0x1e0c('0x9c')]));this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0x4ff2cf,_0x4ff2cf[_0x1e0c('0x11a')]);return this['channel'][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x11b'),_0x4ff2cf[_0x1e0c('0x11a')]));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x11c')]=function(_0x577f5d){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x11d'),_0x577f5d[_0x1e0c('0x9c')]));if(!this['isConfigured'](_0x577f5d['aws_access_key_id'])||!this[_0x1e0c('0x7c')](_0x577f5d[_0x1e0c('0x11e')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x577f5d[_0x1e0c('0x53')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x9d'));}this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0x11f'),_0x577f5d['text']));var _0x24c3a5=this['awsPolly'][_0x1e0c('0x67')](this,_0x577f5d);if(_0x24c3a5){this['channel']['noop'](util[_0x1e0c('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x24c3a5));var _0xdbfaae=this[_0x1e0c('0xd')][_0x1e0c('0xfa')](_0x24c3a5);try{fs[_0x1e0c('0xfc')](_0x24c3a5+_0x1e0c('0x120'));}catch(_0x2bc634){logger[_0x1e0c('0x29')](_0x2bc634);}return _0xdbfaae;}return this['channel'][_0x1e0c('0x29')](_0x577f5d,_0x1e0c('0x121'));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x122')]=function(_0x2ca696){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x123'),_0x2ca696[_0x1e0c('0x9c')]));if(!this['isConfigured'](_0x2ca696['aws_access_key_id'])||!this[_0x1e0c('0x7c')](_0x2ca696[_0x1e0c('0x11e')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x124'));}if(!this['isConfigured'](_0x2ca696[_0x1e0c('0x125')])){return this[_0x1e0c('0xd')]['noop'](_0x1e0c('0x126'));}if(!this['isConfigured'](_0x2ca696[_0x1e0c('0x53')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x9d'));}this[_0x1e0c('0xd')]['bot']=!![];this[_0x1e0c('0x34')](_0x2ca696);this[_0x1e0c('0x3d')](_0x2ca696[_0x1e0c('0x53')],'in','','');this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x2ca696[_0x1e0c('0x53')]));var _0x20777c=this[_0x1e0c('0x83')][_0x1e0c('0x67')](this,_0x2ca696);if(_0x20777c){for(var _0x427437 in _0x20777c){if(_0x20777c[_0x1e0c('0x8e')](_0x427437)&&_[_0x1e0c('0x91')](_0x20777c[_0x427437])){this[_0x1e0c('0xd')]['setVariable'](util[_0x1e0c('0x25')](_0x1e0c('0x127'),_0x427437['toUpperCase']()),_0x20777c[_0x427437]);}}if(_['isNil'](_0x20777c[_0x1e0c('0x6e')])){return this['channel']['noop'](_0x1e0c('0x128'));}else{this[_0x1e0c('0x3d')](_0x20777c[_0x1e0c('0x6e')],'out','amazonlex','');return this[_0x1e0c('0xd')]['noop'](util[_0x1e0c('0x25')](_0x1e0c('0x129'),_0x20777c['message']));}}return this['channel'][_0x1e0c('0x29')](_0x2ca696,_0x1e0c('0x12a'));};AGIVertices[_0x1e0c('0x10')]['googleasr']=function(_0x97904e){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x12b'),_0x97904e[_0x1e0c('0x9c')],_0x97904e['timeout']));if(!this[_0x1e0c('0x7c')](_0x97904e[_0x1e0c('0x79')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x12c'));}var _0x4097b2=_0x1e0c('0x12d');var _0x199ce8=util[_0x1e0c('0x25')](_0x1e0c('0x12e'),FILES_PATH,rs[_0x1e0c('0x116')](0x4));var _0x24c046=util[_0x1e0c('0x25')](_0x1e0c('0x94'),_0x199ce8,_0x4097b2);var _0xb32d4f=!![];if(_0x97904e['beep']===_0x1e0c('0x12f')){_0xb32d4f=![];}var _0x3b1263=this[_0x1e0c('0xd')][_0x1e0c('0x130')](_0x199ce8,_0x4097b2,_0x97904e[_0x1e0c('0x131')],_0x97904e['timeout'],undefined,_0xb32d4f);if(_0x3b1263[_0x1e0c('0xa4')]!==-0x1){this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x132'),_0x24c046));var _0x2d101d=this['googleASR'][_0x1e0c('0x67')](this,_0x97904e,_0x24c046);if(_0x2d101d){for(var _0x352e3c in _0x2d101d){if(_0x2d101d[_0x1e0c('0x8e')](_0x352e3c)){this[_0x1e0c('0xd')][_0x1e0c('0x95')](util['format']('GOOGLE_ASR_%s',_0x352e3c[_0x1e0c('0xf7')]()),_0x2d101d[_0x352e3c]);}}return this['channel']['noop'](util[_0x1e0c('0x25')]('GoogleASR\x20Result\x20%s',JSON[_0x1e0c('0x6a')](_0x2d101d)));}}return _0x3b1263;};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x133')]=function(_0x2eefed){logger[_0x1e0c('0x2d')](util['format'](_0x1e0c('0x134'),_0x2eefed[_0x1e0c('0x9c')]));if(!this['isConfigured'](_0x2eefed['appid'])){return this['channel'][_0x1e0c('0x9e')](_0x1e0c('0x135'));}if(!this['isConfigured'](_0x2eefed[_0x1e0c('0x89')])){return this['channel'][_0x1e0c('0x9e')](_0x1e0c('0x136'));}var _0x28f996='wav';var _0x25abef=util[_0x1e0c('0x25')](_0x1e0c('0x12e'),FILES_PATH,rs[_0x1e0c('0x116')](0x4));var _0x4312d4=util[_0x1e0c('0x25')](_0x1e0c('0x94'),_0x25abef,_0x28f996);var _0x1899a8=!![];if(_0x2eefed[_0x1e0c('0x137')]===_0x1e0c('0x12f')){_0x1899a8=![];}var _0x36e364=this[_0x1e0c('0xd')][_0x1e0c('0x130')](_0x25abef,_0x28f996,_0x2eefed[_0x1e0c('0x131')],_0x2eefed[_0x1e0c('0x5d')],undefined,_0x1899a8);if(_0x36e364['result']!==-0x1){this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x138'),_0x4312d4));var _0x8caafe=this['tildeASR'][_0x1e0c('0x67')](this,_0x2eefed,_0x4312d4);if(_0x8caafe){for(var _0x761565 in _0x8caafe){if(_0x8caafe['hasOwnProperty'](_0x761565)){this[_0x1e0c('0xd')]['setVariable'](util['format']('TILDE_ASR_%s',_0x761565[_0x1e0c('0xf7')]()),_0x8caafe[_0x761565]);}}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x139'),JSON[_0x1e0c('0x6a')](_0x8caafe)));}}return _0x36e364;};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x13a')]=function(_0x493c1d){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x13b'),_0x493c1d[_0x1e0c('0x9c')]));return this['channel'][_0x1e0c('0x13c')](_0x493c1d[_0x1e0c('0x13d')],_0x493c1d[_0x1e0c('0x13e')],_0x493c1d[_0x1e0c('0x3a')]);};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x13f')]=function(_0x30364b){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x140'),_0x30364b['label']));if(!this[_0x1e0c('0x7c')](_0x30364b[_0x1e0c('0x141')])){return this[_0x1e0c('0xd')]['error'](_0x30364b,_0x1e0c('0x142'));}try{var _0x298fed=eval(_0x30364b[_0x1e0c('0x141')])?_0x1e0c('0x143'):_0x1e0c('0x144');this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')]('EVAL\x20CONDITION\x20%s\x20%s',_0x30364b[_0x1e0c('0x141')],_0x298fed));return{'code':0xc8,'result':_0x298fed};}catch(_0x442a25){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x5856ce){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x145'),_0x5856ce[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x5856ce[_0x1e0c('0x146')])){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x5856ce,_0x1e0c('0x147'));}var _0x52da26=this[_0x1e0c('0x148')][_0x1e0c('0x67')](this,_0x5856ce[_0x1e0c('0x146')]);if(!_0x52da26){return this['channel'][_0x1e0c('0x29')](_0x5856ce,_0x1e0c('0x149'));}for(var _0x767bf2=0x0;_0x767bf2<_0x52da26[_0x1e0c('0x96')];_0x767bf2+=0x1){var _0x327663=this[_0x1e0c('0xd')][_0x1e0c('0xd0')](util['format'](_0x1e0c('0x14a'),_0x52da26[_0x767bf2]));if(_0x327663[_0x1e0c('0xa4')]===-0x1){return _0x327663;}logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x14b'),_0x52da26[_0x767bf2],_0x327663[_0x1e0c('0x99')]));if(_0x327663['extra']===_0x1e0c('0x143')){logger[_0x1e0c('0x2d')](util['format']('IFTIME\x20%s\x20%s',_0x52da26[_0x767bf2],_0x1e0c('0x143')));this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format']('IFTIME\x20%s\x20%s',_0x52da26[_0x767bf2],'true'));return{'code':0xc8,'result':_0x1e0c('0x143')};}else{logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x14b'),_0x52da26[_0x767bf2],'false'));this['channel']['noop'](util[_0x1e0c('0x25')](_0x1e0c('0x14b'),_0x52da26[_0x767bf2],_0x1e0c('0x144')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x1e0c('0x10')]['hangup']=function(_0x53cb73){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x14c'),_0x53cb73[_0x1e0c('0x9c')]));return this[_0x1e0c('0xd')][_0x1e0c('0x14d')]();};AGIVertices['prototype'][_0x1e0c('0x14e')]=function(_0x226f74){logger['info'](util[_0x1e0c('0x25')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x226f74[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x226f74[_0x1e0c('0x79')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')]('no\x20key\x20configured');}var _0x3cf9b8=_0x1e0c('0x12d');var _0x41f3f1=util[_0x1e0c('0x25')](_0x1e0c('0x12e'),FILES_PATH,rs[_0x1e0c('0x116')](0x4));var _0x1a5d71=util[_0x1e0c('0x25')](_0x1e0c('0x94'),_0x41f3f1,_0x3cf9b8);var _0x151ec0=!![];if(_0x226f74[_0x1e0c('0x137')]===_0x1e0c('0x12f')){_0x151ec0=![];}var _0x20c70c=this[_0x1e0c('0xd')][_0x1e0c('0x130')](_0x41f3f1,_0x3cf9b8,_0x226f74[_0x1e0c('0x131')],_0x226f74['timeout'],undefined,_0x151ec0);if(_0x20c70c[_0x1e0c('0xa4')]!==-0x1){this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format']('ispeech\x20%s\x20file\x20created',_0x1a5d71));var _0x561843=this['ispeechASR']['sync'](this,_0x226f74,_0x1a5d71);if(_0x561843){for(var _0x39f45c in _0x561843){if(_0x561843[_0x1e0c('0x8e')](_0x39f45c)){this[_0x1e0c('0xd')][_0x1e0c('0x95')](util[_0x1e0c('0x25')](_0x1e0c('0x14f'),_0x39f45c[_0x1e0c('0xf7')]()),_0x561843[_0x39f45c]);}}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x150'),JSON['stringify'](_0x561843)));}}return _0x20c70c;};AGIVertices[_0x1e0c('0x10')]['ispeechtts']=function(_0x249cf8){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x151'),_0x249cf8[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x249cf8[_0x1e0c('0x79')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x12c'));}if(!this['isConfigured'](_0x249cf8['text'])){return this[_0x1e0c('0xd')]['noop'](_0x1e0c('0x9d'));}this[_0x1e0c('0xd')]['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x249cf8[_0x1e0c('0x53')]));var _0x5147b8=this[_0x1e0c('0x78')][_0x1e0c('0x67')](this,_0x249cf8);if(_0x5147b8){this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')]('ispeech\x20%s\x20file\x20created',_0x5147b8));var _0x196c89=this['channel'][_0x1e0c('0xfa')](_0x5147b8,_0x249cf8[_0x1e0c('0x131')]);try{fs[_0x1e0c('0xfc')](_0x5147b8+_0x1e0c('0x120'));}catch(_0x3e80f1){logger['error'](_0x3e80f1);}return _0x196c89;}return this['channel'][_0x1e0c('0x29')](_0x249cf8,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x152')]=function(_0xce2b83){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x153'),_0xce2b83[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0xce2b83['findBy'])){return this['channel'][_0x1e0c('0x29')](_0xce2b83,_0x1e0c('0x154'));}logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x155'),this[_0x1e0c('0xd')]['callerid'],_0xce2b83[_0x1e0c('0x156')]));var _0x57106a=this[_0x1e0c('0x4d')][_0x1e0c('0x67')](this,_0xce2b83['findBy']);if(_0x57106a){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0xce2b83[_0x1e0c('0x156')]));this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x157'),this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0xce2b83['findBy']));return{'code':0xc8,'result':_0x1e0c('0x158')};}else{logger['info'](util[_0x1e0c('0x25')](_0x1e0c('0x159'),this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0xce2b83[_0x1e0c('0x156')]));this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1e0c('0xd')]['callerid'],_0xce2b83['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1e0c('0x10')]['logout']=function(_0x5a11d5){logger[_0x1e0c('0x2d')](util['format'](_0x1e0c('0x15a'),_0x5a11d5[_0x1e0c('0x9c')]));if(!this['isConfigured'](_0x5a11d5['findBy'])){return this[_0x1e0c('0xd')]['error'](_0x5a11d5,_0x1e0c('0x154'));}logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x155'),this['channel'][_0x1e0c('0x37')],_0x5a11d5[_0x1e0c('0x156')]));var _0x95003a=this['agentLogout'][_0x1e0c('0x67')](this,_0x5a11d5[_0x1e0c('0x156')]);if(_0x95003a){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0x5a11d5['findBy']));this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0x157'),this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0x5a11d5[_0x1e0c('0x156')]));return{'code':0xc8,'result':_0x1e0c('0x158')};}else{logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x159'),this[_0x1e0c('0xd')]['callerid'],_0x5a11d5[_0x1e0c('0x156')]));this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0x5a11d5[_0x1e0c('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x15b')]=function(_0x543303){logger['info'](util[_0x1e0c('0x25')](_0x1e0c('0x15c'),_0x543303['label']));if(!this[_0x1e0c('0x7c')](_0x543303[_0x1e0c('0x15d')])){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x543303,_0x1e0c('0x15e'));}this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x15f'),_0x543303[_0x1e0c('0x15d')]));var _0x171fb5=eval(_0x543303[_0x1e0c('0x15d')]);if(!this[_0x1e0c('0x7c')](_0x543303[_0x1e0c('0xcf')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x10f'));}var _0x216510=this[_0x1e0c('0xd0')]['sync'](this,_0x543303[_0x1e0c('0xcf')]);if(!_0x216510){return this['channel'][_0x1e0c('0x29')](_0x543303,'no\x20variable\x20found');}if(_[_0x1e0c('0x90')](_0x171fb5)){var _0x5b14f4=this;_0x171fb5[_0x1e0c('0xd2')](function(_0x563fff,_0x2c28c4){_0x5b14f4['channel'][_0x1e0c('0x95')](util['format']('%s[%s]',_0x216510,_0x2c28c4),_0x563fff);});return this['channel'][_0x1e0c('0x9e')](util['format'](_0x1e0c('0x160'),_0x216510));}else{return this[_0x1e0c('0xd')][_0x1e0c('0x95')](_0x216510,_0x171fb5);}};AGIVertices['prototype'][_0x1e0c('0xa')]=function(_0x2c3971){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x161'),_0x2c3971[_0x1e0c('0x9c')]));if(_0x2c3971['retry']===0x0){return this[_0x1e0c('0x9a')](_0x2c3971);}_0x2c3971['retry']-=0x1;if(!this['isConfigured'](_0x2c3971[_0x1e0c('0x10d')])){return this['channel'][_0x1e0c('0x29')](_0x2c3971,_0x1e0c('0x10b'));}var _0x3a3b0d=this[_0x1e0c('0x10c')][_0x1e0c('0x67')](this,_0x2c3971[_0x1e0c('0x10d')]);if(!_0x3a3b0d){return this[_0x1e0c('0xd')]['error'](_0x2c3971,_0x1e0c('0x10e'));}var _0x5b9a09=this[_0x1e0c('0xd')][_0x1e0c('0x110')](_0x3a3b0d,_0x2c3971['response'],_0x2c3971[_0x1e0c('0x162')]);var _0x48e672=_0x5b9a09[_0x1e0c('0xa4')];if(_0x5b9a09['result']===-0x1){this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0x2c3971,'-1');return _0x5b9a09;}else if(_0x5b9a09[_0x1e0c('0x99')]===_0x1e0c('0x5d')){_0x5b9a09[_0x1e0c('0xa4')]=_0x5b9a09['result']['length']>0x0?_0x5b9a09[_0x1e0c('0xa4')]:'t';}else if(_[_0x1e0c('0x3f')](_0x5b9a09[_0x1e0c('0xa4')])){_0x5b9a09['result']='#';_0x48e672='#';}if(!this[_0x1e0c('0x7c')](_0x2c3971[_0x1e0c('0xcf')])){this['channel']['noop'](_0x1e0c('0x10f'));}else{var _0x5287b2=this['getVariable']['sync'](this,_0x2c3971[_0x1e0c('0xcf')]);if(!_0x5287b2){return this[_0x1e0c('0xd')]['error'](_0x2c3971,_0x1e0c('0xd1'));}this[_0x1e0c('0xd')][_0x1e0c('0x95')](_0x5287b2,_0x48e672);}this[_0x1e0c('0x34')]['sync'](this,_0x2c3971,_0x48e672);return _0x5b9a09;};AGIVertices[_0x1e0c('0x10')]['noop']=function(_0xe0ef71){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x163'),_0xe0ef71[_0x1e0c('0x9c')]));return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0xe0ef71['output']||_0xe0ef71[_0x1e0c('0x9c')]);};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x164')]=function(_0x3f82c3){logger[_0x1e0c('0x2d')](util['format'](_0x1e0c('0x165'),_0x3f82c3[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x3f82c3[_0x1e0c('0x156')])){return this['channel']['error'](_0x3f82c3,_0x1e0c('0x154'));}logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x155'),this['channel']['callerid'],_0x3f82c3[_0x1e0c('0x156')]));var _0x118ed7=this['getPause'][_0x1e0c('0x67')](this,_0x3f82c3[_0x1e0c('0x166')]);var _0x8921bc=this[_0x1e0c('0x49')][_0x1e0c('0x67')](this,_0x3f82c3['findBy'],_0x118ed7);if(_0x8921bc){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x157'),this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0x3f82c3[_0x1e0c('0x156')]));this['channel'][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x157'),this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0x3f82c3[_0x1e0c('0x156')]));return{'code':0xc8,'result':_0x1e0c('0x158')};}else{logger[_0x1e0c('0x2d')](util['format'](_0x1e0c('0x159'),this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0x3f82c3['findBy']));this[_0x1e0c('0xd')]['noop'](util['format'](_0x1e0c('0x157'),this[_0x1e0c('0xd')]['callerid'],_0x3f82c3[_0x1e0c('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['playback']=function(_0x1f837f){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x167'),_0x1f837f[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x1f837f[_0x1e0c('0x10d')])){return this[_0x1e0c('0xd')]['error'](_0x1f837f,'no\x20file\x20audio\x20selected');}var _0x4628fd=this['getSound']['sync'](this,_0x1f837f['file_id']);if(!_0x4628fd){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x1f837f,'no\x20file\x20audio\x20found');}var _0x5b787e=this['channel'][_0x1e0c('0x4f')]('PLAYBACK',[_0x4628fd,_0x1f837f[_0x1e0c('0xde')]]);if(_0x5b787e['result']===-0x1){return _0x5b787e;}return this[_0x1e0c('0xd')]['noop'](util[_0x1e0c('0x25')](_0x1e0c('0xbc'),_0x1e0c('0x168'),_0x4628fd));};AGIVertices['prototype'][_0x1e0c('0x169')]=function(_0x3e91ea){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x16a'),_0x3e91ea[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x3e91ea[_0x1e0c('0x16b')])){return this['channel'][_0x1e0c('0x29')](_0x3e91ea,_0x1e0c('0x16c'));}var _0x454689='';var _0x3e9a45=parseInt(_0x3e91ea[_0x1e0c('0x16b')],0xa);if(isNaN(_0x3e9a45)){_0x454689=_0x3e91ea[_0x1e0c('0x16b')];}else{_0x454689=this[_0x1e0c('0x14')]['sync'](this,_0x3e91ea['queue_id']);if(!_0x454689){return this['channel']['error'](_0x3e91ea,_0x1e0c('0x16d'));}}var _0x59a0a6='';if(this[_0x1e0c('0x7c')](_0x3e91ea[_0x1e0c('0x10d')])){var _0x4c98c8=this[_0x1e0c('0x10c')]['sync'](this,_0x3e91ea['file_id']);if(_0x4c98c8){_0x59a0a6=_0x4c98c8;}}this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0x3e91ea,_0x454689);if(_0x3e91ea[_0x1e0c('0xde')][_0x1e0c('0x16e')]('x')<0x0){_0x3e91ea['opts']+='x';}if(_0x3e91ea[_0x1e0c('0xde')][_0x1e0c('0x16e')]('X')<0x0){_0x3e91ea[_0x1e0c('0xde')]+='X';}this[_0x1e0c('0xd')][_0x1e0c('0x95')]('XMCS-QUEUE',_0x454689?_0x454689[_0x1e0c('0x16f')]():'');var _0x1f08d9=this[_0x1e0c('0xd')][_0x1e0c('0x4f')](_0x1e0c('0x170'),[_0x454689,_0x3e91ea[_0x1e0c('0xde')],_0x3e91ea['url'],_0x59a0a6,_0x3e91ea['timeout'],_0x3e91ea[_0x1e0c('0xad')],_0x3e91ea['macro'],_0x3e91ea['gosub'],'',_0x3e91ea['position']]);if(_0x1f08d9[_0x1e0c('0xa4')]===-0x1){return _0x1f08d9;}return this['channel'][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0xbc'),'QUEUE',_0x454689));};AGIVertices[_0x1e0c('0x10')]['record']=function(_0x3de386){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x171'),_0x3de386[_0x1e0c('0x9c')]));var _0x31aa9c=_0x3de386[_0x1e0c('0x172')]||'wav';var _0x2d9731=util[_0x1e0c('0x25')](_0x1e0c('0x173'),this[_0x1e0c('0xd')][_0x1e0c('0x35')],rs['generate'](0x5));var _0xa2e7d3=util[_0x1e0c('0x25')](_0x1e0c('0x174'),FILES_PATH,_0x2d9731,_0x31aa9c);var _0x2c983a=util['format'](_0x1e0c('0x12e'),FILES_PATH,_0x2d9731);this['createSquareRecording'][_0x1e0c('0x67')](this,_0x3de386,_0x2d9731,_0xa2e7d3);this[_0x1e0c('0xd')][_0x1e0c('0x95')](_0x1e0c('0x175'),_0x2d9731);logger[_0x1e0c('0x2d')](_0x1e0c('0x176'),_0x2c983a,_0x31aa9c,_0x3de386[_0x1e0c('0x177')],_0x3de386[_0x1e0c('0x5d')]);return this[_0x1e0c('0xd')][_0x1e0c('0x130')](_0x2c983a,_0x31aa9c,_0x3de386[_0x1e0c('0x177')],_0x3de386[_0x1e0c('0x5d')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x347797){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x178'),_0x347797['label']));if(!this[_0x1e0c('0x7c')](_0x347797[_0x1e0c('0x69')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x179'));}var _0x3f5225=this['restAPI']['sync'](this,_0x347797);logger['info'](util[_0x1e0c('0x25')]('Response:',util[_0x1e0c('0x17a')](_0x3f5225,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x347797['variable_id'])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x17b'));}var _0x32d1f1=this['getVariable']['sync'](this,_0x347797[_0x1e0c('0xcf')]);if(!_0x32d1f1){return this[_0x1e0c('0xd')]['error'](_0x347797,'no\x20variable\x20found');}this[_0x1e0c('0xd')]['setVariable'](util[_0x1e0c('0x25')](_0x1e0c('0x17c'),_0x32d1f1),_0x3f5225[_0x1e0c('0x6c')]?_0x3f5225[_0x1e0c('0x6c')]:'200');this[_0x1e0c('0xd')]['setVariable'](util['format'](_0x1e0c('0x17d'),_0x32d1f1),_0x3f5225['statusMessage']?_0x3f5225[_0x1e0c('0x6d')]:'OK');if(_0x3f5225[_0x1e0c('0x61')]){try{this[_0x1e0c('0x93')](_0x3f5225[_0x1e0c('0x61')],_0x32d1f1);}catch(_0x3b0422){logger[_0x1e0c('0x29')](util[_0x1e0c('0x25')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x32d1f1));}}return this['channel']['noop'](util[_0x1e0c('0x25')](_0x1e0c('0x17e'),_0x32d1f1));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x17f')]=function(_0x59582f){logger['info'](util[_0x1e0c('0x25')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x59582f['label']));return this[_0x1e0c('0xd')][_0x1e0c('0x180')](_0x59582f[_0x1e0c('0x181')][_0x1e0c('0x50')](/\s+/g,''),_0x59582f[_0x1e0c('0x177')]);};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x182')]=function(_0x305726){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x183'),_0x305726[_0x1e0c('0x9c')]));return this[_0x1e0c('0xd')][_0x1e0c('0x184')](_0x305726[_0x1e0c('0x185')][_0x1e0c('0x50')](/\s+/g,''),_0x305726[_0x1e0c('0x177')]);};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x186')]=function(_0xb85451){logger['info'](util[_0x1e0c('0x25')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0xb85451[_0x1e0c('0x9c')]));return this[_0x1e0c('0xd')]['sayPhonetic'](_0xb85451[_0x1e0c('0x53')],_0xb85451[_0x1e0c('0x177')]);};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x187')]=function(_0x4a7937){logger['info'](util[_0x1e0c('0x25')](_0x1e0c('0x188'),_0x4a7937[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x4a7937[_0x1e0c('0x189')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x18a'));}var _0x29aecc=this[_0x1e0c('0x1f')][_0x1e0c('0x67')](this,_0x4a7937[_0x1e0c('0x189')]);if(!_0x29aecc||!_0x29aecc[_0x1e0c('0x18b')]){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x4a7937,_0x1e0c('0x18c'));}var _0x48201c={'from':util['format'](_0x1e0c('0x18d'),_0x29aecc[_0x1e0c('0x12')],_0x29aecc[_0x1e0c('0x18e')]||_0x29aecc[_0x1e0c('0x18b')][_0x1e0c('0x18f')]),'to':_0x4a7937['to']||'','cc':_0x4a7937['cc']||'','bcc':_0x4a7937[_0x1e0c('0x190')]||'','subject':_0x4a7937[_0x1e0c('0x191')],'html':_0x4a7937[_0x1e0c('0x53')],'text':_0x4a7937[_0x1e0c('0x53')]};var _0x1c9bce={'tls':{'rejectUnauthorized':![]}};if(_0x29aecc[_0x1e0c('0x18b')]['service']){_0x1c9bce[_0x1e0c('0x192')]=_0x29aecc[_0x1e0c('0x18b')]['service'];}else{_0x1c9bce[_0x1e0c('0x193')]=_0x29aecc[_0x1e0c('0x18b')][_0x1e0c('0x193')];_0x1c9bce['port']=_0x29aecc[_0x1e0c('0x18b')]['port'];_0x1c9bce['secure']=_0x29aecc[_0x1e0c('0x18b')][_0x1e0c('0x194')];}if(_0x29aecc['Smtp']['authentication']){_0x1c9bce[_0x1e0c('0x195')]={'user':_0x29aecc[_0x1e0c('0x18b')]['user'],'pass':_0x29aecc[_0x1e0c('0x18b')][_0x1e0c('0x196')]};}if(this[_0x1e0c('0x7c')](_0x4a7937[_0x1e0c('0x197')])){}logger[_0x1e0c('0xd7')]('sendMail\x20message',JSON[_0x1e0c('0x6a')](_0x48201c));this['createSquareDetailsReport'][_0x1e0c('0x67')](this,_0x4a7937,_0x4a7937[_0x1e0c('0x189')]);this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x198'),_0x29aecc[_0x1e0c('0x12')]));this['sendMailMessage'][_0x1e0c('0x67')](this,_0x1c9bce,_0x48201c);return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x199'));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x19a')]=function(_0x16b025){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x19b'),_0x16b025[_0x1e0c('0x9c')]));return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x19c'));};AGIVertices['prototype'][_0x1e0c('0x19d')]=function(_0x6900d8){logger['info'](util[_0x1e0c('0x25')](_0x1e0c('0x19e'),_0x6900d8['label']));if(!this[_0x1e0c('0x7c')](_0x6900d8[_0x1e0c('0x19f')])){return this['channel'][_0x1e0c('0x9e')](_0x1e0c('0x1a0'));}var _0x3e5884=this['getSmsAccount'][_0x1e0c('0x67')](this,_0x6900d8[_0x1e0c('0x19f')]);if(!_0x3e5884){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x6900d8,'no\x20sms\x20account\x20found');}var _0x189db1={'body':_0x6900d8[_0x1e0c('0x1a1')],'phone':_0x6900d8['to']||'','SmsAccountId':_0x3e5884['id']};logger[_0x1e0c('0xd7')](_0x1e0c('0x1a2'),JSON[_0x1e0c('0x6a')](_0x189db1));this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0x6900d8,_0x6900d8[_0x1e0c('0x19f')]);this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x1a3'),_0x3e5884[_0x1e0c('0x12')]));this[_0x1e0c('0x33')]['sync'](this,_0x189db1);return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x1a4'));};AGIVertices[_0x1e0c('0x10')]['set']=function(_0x51316e){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x1a5'),_0x51316e[_0x1e0c('0x9c')]));if(!this[_0x1e0c('0x7c')](_0x51316e[_0x1e0c('0xcf')])){return this[_0x1e0c('0xd')]['error'](_0x51316e,'no\x20variable\x20selected');}var _0x4c34f0=this[_0x1e0c('0xd0')]['sync'](this,_0x51316e[_0x1e0c('0xcf')]);if(!_0x4c34f0){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x51316e,_0x1e0c('0xd1'));}return this['channel'][_0x1e0c('0x95')](_0x4c34f0,_0x51316e[_0x1e0c('0x1a6')]);};AGIVertices[_0x1e0c('0x10')]['start']=function(_0x31a9d3){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x1a7'),_0x31a9d3[_0x1e0c('0x9c')]));this[_0x1e0c('0xd')][_0x1e0c('0x9e')]('START\x20CALLY\x20SQUARE');if(_0x31a9d3[_0x1e0c('0xb0')]===_0x1e0c('0x1a8')){this[_0x1e0c('0xd')][_0x1e0c('0x9e')]('Answer');return this[_0x1e0c('0xd')]['answer']();}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x1a9'));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x1aa')]=function(_0x1ae187){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x1ab'),_0x1ae187['label']));if(!this['isConfigured'](_0x1ae187[_0x1e0c('0x1ac')])){return this['channel'][_0x1e0c('0x29')](_0x1ae187,_0x1e0c('0x1ad'));}var _0x1207b4=this[_0x1e0c('0x16')][_0x1e0c('0x67')](this,_0x1ae187[_0x1e0c('0x1ac')]);if(!this[_0x1e0c('0x7c')](_0x1207b4)){return this[_0x1e0c('0xd')]['error'](_0x1ae187,util[_0x1e0c('0x25')](_0x1e0c('0x1ae'),_0x1ae187['project_id']));}if(_0x1207b4===this[_0x1e0c('0xd')][_0x1e0c('0x36')]){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x1ae187,_0x1e0c('0x1af'));}this[_0x1e0c('0x34')]['sync'](this,_0x1ae187,_0x1207b4);var _0x1ecd93=this['channel'][_0x1e0c('0x4f')]('AGI',util[_0x1e0c('0x25')](_0x1e0c('0x1b0'),config['agi']['host']||'127.0.0.1',_0x1207b4,this['channel']['arg_1']));if(_0x1ecd93[_0x1e0c('0xa4')]===-0x1){return _0x1ecd93;}return this['channel'][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0xbc'),_0x1e0c('0x1b1'),_0x1207b4));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x1b2')]=function(_0x22ef5a){logger['info'](util[_0x1e0c('0x25')](_0x1e0c('0x1b3'),_0x22ef5a[_0x1e0c('0x9c')]));var _0x211725=this['shellCommand']['sync'](this,_0x22ef5a[_0x1e0c('0x1b4')]);this[_0x1e0c('0x34')][_0x1e0c('0x67')](this,_0x22ef5a,_0x22ef5a[_0x1e0c('0x1b4')]);if(this[_0x1e0c('0x7c')](_0x22ef5a[_0x1e0c('0xcf')])){var _0x36c604=this[_0x1e0c('0xd0')][_0x1e0c('0x67')](this,_0x22ef5a[_0x1e0c('0xcf')]);if(_0x36c604){this[_0x1e0c('0xd')][_0x1e0c('0x95')](_0x36c604,_0x211725);return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util['format'](_0x1e0c('0x1b5'),_0x22ef5a[_0x1e0c('0x1b4')],_0x36c604));}}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0x1b6'),_0x22ef5a[_0x1e0c('0x1b4')]));};AGIVertices['prototype'][_0x1e0c('0x1b7')]=function(_0x2f02ae){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x1b8'),_0x2f02ae[_0x1e0c('0x9c')]));_0x2f02ae[_0x1e0c('0x53')]=_0x2f02ae['text'][_0x1e0c('0x50')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1e0c('0x7c')](_0x2f02ae[_0x1e0c('0x1b9')])){return this['channel']['noop'](_0x1e0c('0x1ba'));}if(!this[_0x1e0c('0x7c')](_0x2f02ae[_0x1e0c('0x53')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x9d'));}this['channel']['noop'](util[_0x1e0c('0x25')](_0x1e0c('0x1bb'),_0x2f02ae[_0x1e0c('0x53')]));var _0x2c85a0=this[_0x1e0c('0x51')][_0x1e0c('0x67')](this,_0x2f02ae);if(_0x2c85a0){this['channel']['noop'](util[_0x1e0c('0x25')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2c85a0));var _0x2b6669=this[_0x1e0c('0xd')]['streamFile'](_0x2c85a0);try{fs['unlink'](_0x2c85a0+_0x1e0c('0x120'));}catch(_0x439fce){logger[_0x1e0c('0x29')](_0x439fce);}return _0x2b6669;}return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x2f02ae,_0x1e0c('0x1bc'));};AGIVertices[_0x1e0c('0x10')]['tts']=function(_0x13d92d){logger['info'](util[_0x1e0c('0x25')](_0x1e0c('0x1bd'),_0x13d92d[_0x1e0c('0x9c')]));_0x13d92d['text']=_0x13d92d[_0x1e0c('0x53')][_0x1e0c('0x50')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1e0c('0x7c')](_0x13d92d[_0x1e0c('0x53')])){return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](_0x1e0c('0x9d'));}this['channel']['noop'](util[_0x1e0c('0x25')]('Trying\x20Google\x20TTS\x20%s',_0x13d92d['text']));var _0x29eaeb=this[_0x1e0c('0x5a')][_0x1e0c('0x67')](this,_0x13d92d);if(_0x29eaeb){this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')]('Google\x20TTS\x20%s\x20file\x20created',_0x29eaeb));var _0x189de3=this[_0x1e0c('0xd')][_0x1e0c('0xfa')](_0x29eaeb);try{fs[_0x1e0c('0xfc')](_0x29eaeb+_0x1e0c('0x120'));}catch(_0x307661){logger[_0x1e0c('0x29')](_0x307661);}return _0x189de3;}return this[_0x1e0c('0xd')]['error'](_0x13d92d,_0x1e0c('0x1be'));};AGIVertices[_0x1e0c('0x10')][_0x1e0c('0x1bf')]=function(_0x1b3541){logger[_0x1e0c('0x2d')](util['format'](_0x1e0c('0x1c0'),_0x1b3541[_0x1e0c('0x9c')]));if(!this['isConfigured'](_0x1b3541[_0x1e0c('0x156')])){return this['channel'][_0x1e0c('0x29')](_0x1b3541,_0x1e0c('0x154'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0x1b3541[_0x1e0c('0x156')]));var _0x3300c7=this['agentUnpause'][_0x1e0c('0x67')](this,_0x1b3541['findBy']);if(_0x3300c7){logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1e0c('0xd')]['callerid'],_0x1b3541[_0x1e0c('0x156')]));this['channel'][_0x1e0c('0x9e')](util[_0x1e0c('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1e0c('0xd')]['callerid'],_0x1b3541[_0x1e0c('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1e0c('0x2d')](util[_0x1e0c('0x25')](_0x1e0c('0x159'),this['channel'][_0x1e0c('0x37')],_0x1b3541[_0x1e0c('0x156')]));this[_0x1e0c('0xd')]['noop'](util[_0x1e0c('0x25')](_0x1e0c('0x159'),this[_0x1e0c('0xd')][_0x1e0c('0x37')],_0x1b3541[_0x1e0c('0x156')]));return{'code':0xc8,'result':_0x1e0c('0x1c1')};}};AGIVertices['prototype'][_0x1e0c('0x1c2')]=function(_0x37a522){logger['info'](util[_0x1e0c('0x25')](_0x1e0c('0x1c3'),_0x37a522['label']));var _0x33b026=this[_0x1e0c('0xd')][_0x1e0c('0x4f')](_0x1e0c('0x1c4'),[_0x37a522[_0x1e0c('0x1c5')],_0x37a522[_0x1e0c('0x70')]]);if(_0x33b026[_0x1e0c('0xa4')]===-0x1){return _0x33b026;}return this[_0x1e0c('0xd')][_0x1e0c('0x9e')](util[_0x1e0c('0x25')](_0x1e0c('0xbc'),_0x1e0c('0x1c4'),_0x37a522[_0x1e0c('0x1c5')]));};AGIVertices['prototype'][_0x1e0c('0x1c6')]=function(_0x44451e){logger[_0x1e0c('0x2d')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x44451e[_0x1e0c('0x9c')]));if(!this['isConfigured'](_0x44451e[_0x1e0c('0xcf')])){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x44451e,_0x1e0c('0x1c7'));}var _0x101309=this[_0x1e0c('0xd0')][_0x1e0c('0x67')](this,_0x44451e[_0x1e0c('0xcf')]);if(!_0x101309){return this[_0x1e0c('0xd')][_0x1e0c('0x29')](_0x44451e,'no\x20variable\x20found');}var _0x4cdbc7=this['channel'][_0x1e0c('0xd0')](_0x101309);return{'code':0xc8,'result':_0x4cdbc7['extra']?_0x4cdbc7['extra']:'-'};};String['prototype']['replaceAll']=function(_0x3c0aca,_0x1a4888){return this['split'](_0x3c0aca)[_0x1e0c('0x1c8')](_0x1a4888);};module[_0x1e0c('0x1c9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b286f85..42ca692 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 _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0x33479a,_0x1558c9){var _0x347d29=function(_0x66e793){while(--_0x66e793){_0x33479a['push'](_0x33479a['shift']());}};_0x347d29(++_0x1558c9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file +var _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x19883a,_0x98963a){var _0x529e8a=function(_0x1513b8){while(--_0x1513b8){_0x19883a['push'](_0x19883a['shift']());}};_0x529e8a(++_0x98963a);}(_0x7a54,0x106));var _0x47a5=function(_0x3aeb33,_0x31428d){_0x3aeb33=_0x3aeb33-0x0;var _0x197cf1=_0x7a54[_0x3aeb33];return _0x197cf1;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 18ea1b6..bafcbb5 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 _0x60ad=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','username','actionSipShowRegistry','Action','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','log','asterisk-manager','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','keepConnected','action','format'];(function(_0x5de6c9,_0x471538){var _0x4f45f6=function(_0xe0c086){while(--_0xe0c086){_0x5de6c9['push'](_0x5de6c9['shift']());}};_0x4f45f6(++_0x471538);}(_0x60ad,0x85));var _0xd60a=function(_0x62a541,_0x2bba95){_0x62a541=_0x62a541-0x0;var _0x7c9dbe=_0x60ad[_0x62a541];return _0x7c9dbe;};'use strict';var Manager=require(_0xd60a('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0xd60a('0x1'));var _=require(_0xd60a('0x2'));var logger=require(_0xd60a('0x3'))(_0xd60a('0x4'));var config=require(_0xd60a('0x5'));var ami=new Manager(config[_0xd60a('0x6')][_0xd60a('0x7')],config['asterisk']['ip'],config[_0xd60a('0x6')]['username'],config[_0xd60a('0x6')]['password'],!![]);ami[_0xd60a('0x8')]();ami['Action']=BPromise['promisify'](ami[_0xd60a('0x9')]);function error(_0x403c03){logger['error'](util[_0xd60a('0xa')](_0xd60a('0xb'),config[_0xd60a('0x6')]['username'],config[_0xd60a('0x6')]['ip'],config[_0xd60a('0x6')][_0xd60a('0x7')],util[_0xd60a('0xc')](_0x403c03,![],null)));}function close(){logger[_0xd60a('0xd')](util[_0xd60a('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xd60a('0x6')][_0xd60a('0xe')],config['asterisk']['ip'],config[_0xd60a('0x6')][_0xd60a('0x7')]));}ami[_0xd60a('0xf')]=function(){return function(){return ami[_0xd60a('0x10')]({'action':'sipshowregistry'});};};ami[_0xd60a('0x11')]=function(){return function(){return ami[_0xd60a('0x10')]({'action':_0xd60a('0x12')});};};ami[_0xd60a('0x13')]=function(){return function(){return ami['Action']({'action':_0xd60a('0x14')});};};ami[_0xd60a('0x15')]=function(){return function(){return ami[_0xd60a('0x10')]({'action':_0xd60a('0x16')});};};ami[_0xd60a('0x17')]=function(){return function(){return ami[_0xd60a('0x10')]({'action':_0xd60a('0x18')});};};function connect(_0x35b00e){logger[_0xd60a('0x19')](util[_0xd60a('0xa')](_0xd60a('0x1a'),config['asterisk'][_0xd60a('0xe')],config['asterisk']['ip'],config[_0xd60a('0x6')]['port']));ami[_0xd60a('0x1b')](_0xd60a('0xd'),error);ami[_0xd60a('0x1b')](_0xd60a('0x1c'),close);}ami['on'](_0xd60a('0x1d'),connect);ami['on'](_0xd60a('0x1e'),function(_0xdbe9f5){logger[_0xd60a('0x19')](util[_0xd60a('0xa')](_0xd60a('0x1f'),config[_0xd60a('0x6')][_0xd60a('0xe')],config[_0xd60a('0x6')]['ip'],config['asterisk'][_0xd60a('0x7')],util[_0xd60a('0xc')](_0xdbe9f5,![],null)));});ami['on']('fullybooted',function(_0xb795){logger['info'](util['format'](_0xd60a('0x20'),config[_0xd60a('0x6')][_0xd60a('0xe')],config['asterisk']['ip'],config['asterisk'][_0xd60a('0x7')]));return BPromise['resolve']()[_0xd60a('0x21')](ami[_0xd60a('0xf')]())['then'](ami[_0xd60a('0x11')]())[_0xd60a('0x21')](ami[_0xd60a('0x13')]())['then'](ami[_0xd60a('0x15')]())[_0xd60a('0x21')](ami[_0xd60a('0x17')]())[_0xd60a('0x22')](function(_0x56b5c9){console[_0xd60a('0x23')](_0x56b5c9);});});ami[_0xd60a('0x1b')](_0xd60a('0xd'),error);ami['once']('close',close);module['exports']=ami; \ No newline at end of file +var _0x2b6a=['actionQueueSummary','queuesummary','info','once','error','close','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionCoreShowChannels','catch','log','exports','asterisk-manager','bluebird','util','lodash','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','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','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus'];(function(_0x3e6b3b,_0x1926ee){var _0x2d6af5=function(_0x5f5213){while(--_0x5f5213){_0x3e6b3b['push'](_0x3e6b3b['shift']());}};_0x2d6af5(++_0x1926ee);}(_0x2b6a,0xce));var _0xa2b6=function(_0x4e8250,_0x479dab){_0x4e8250=_0x4e8250-0x0;var _0x389a21=_0x2b6a[_0x4e8250];return _0x389a21;};'use strict';var Manager=require(_0xa2b6('0x0'));var BPromise=require(_0xa2b6('0x1'));var moment=require('moment');var util=require(_0xa2b6('0x2'));var _=require(_0xa2b6('0x3'));var logger=require('../../config/logger')(_0xa2b6('0x4'));var config=require(_0xa2b6('0x5'));var ami=new Manager(config[_0xa2b6('0x6')][_0xa2b6('0x7')],config[_0xa2b6('0x6')]['ip'],config[_0xa2b6('0x6')][_0xa2b6('0x8')],config[_0xa2b6('0x6')][_0xa2b6('0x9')],!![]);ami[_0xa2b6('0xa')]();ami[_0xa2b6('0xb')]=BPromise[_0xa2b6('0xc')](ami[_0xa2b6('0xd')]);function error(_0x4383d2){logger['error'](util[_0xa2b6('0xe')](_0xa2b6('0xf'),config[_0xa2b6('0x6')][_0xa2b6('0x8')],config[_0xa2b6('0x6')]['ip'],config[_0xa2b6('0x6')][_0xa2b6('0x7')],util[_0xa2b6('0x10')](_0x4383d2,![],null)));}function close(){logger['error'](util[_0xa2b6('0xe')](_0xa2b6('0x11'),config[_0xa2b6('0x6')]['username'],config[_0xa2b6('0x6')]['ip'],config['asterisk'][_0xa2b6('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xa2b6('0xb')]({'action':_0xa2b6('0x12')});};};ami[_0xa2b6('0x13')]=function(){return function(){return ami[_0xa2b6('0xb')]({'action':_0xa2b6('0x14')});};};ami[_0xa2b6('0x15')]=function(){return function(){return ami[_0xa2b6('0xb')]({'action':'sippeerstatus'});};};ami[_0xa2b6('0x16')]=function(){return function(){return ami['Action']({'action':_0xa2b6('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xa2b6('0xb')]({'action':'coreshowchannels'});};};function connect(_0x4b2538){logger[_0xa2b6('0x18')](util[_0xa2b6('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0xa2b6('0x8')],config[_0xa2b6('0x6')]['ip'],config['asterisk'][_0xa2b6('0x7')]));ami[_0xa2b6('0x19')](_0xa2b6('0x1a'),error);ami[_0xa2b6('0x19')](_0xa2b6('0x1b'),close);}ami['on']('connect',connect);ami['on'](_0xa2b6('0x1c'),function(_0x1039eb){logger[_0xa2b6('0x18')](util[_0xa2b6('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0xa2b6('0x6')]['ip'],config[_0xa2b6('0x6')][_0xa2b6('0x7')],util[_0xa2b6('0x10')](_0x1039eb,![],null)));});ami['on'](_0xa2b6('0x1d'),function(_0x4cc39c){logger[_0xa2b6('0x18')](util['format'](_0xa2b6('0x1e'),config[_0xa2b6('0x6')][_0xa2b6('0x8')],config[_0xa2b6('0x6')]['ip'],config['asterisk'][_0xa2b6('0x7')]));return BPromise[_0xa2b6('0x1f')]()[_0xa2b6('0x20')](ami[_0xa2b6('0x21')]())[_0xa2b6('0x20')](ami[_0xa2b6('0x13')]())['then'](ami['actionSipPeerStatus']())['then'](ami[_0xa2b6('0x16')]())['then'](ami[_0xa2b6('0x22')]())[_0xa2b6('0x23')](function(_0x3fa58a){console[_0xa2b6('0x24')](_0x3fa58a);});});ami[_0xa2b6('0x19')]('error',error);ami[_0xa2b6('0x19')]('close',close);module[_0xa2b6('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ec601a8..4bbc144 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 _0x8cb6=['message','result','catch','exports','bluebird','ami','client','http','Request','request','debug','rpc','memberReport','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8cb6,0x9e));var _0x68cb=function(_0x4c4ca2,_0x30d812){_0x4c4ca2=_0x4c4ca2-0x0;var _0x17dac3=_0x8cb6[_0x4c4ca2];return _0x17dac3;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x68cb('0x0'));var logger=require('../../config/logger')(_0x68cb('0x1'));var client=jayson[_0x68cb('0x2')][_0x68cb('0x3')]({'port':0x2329});client[_0x68cb('0x4')]=function(_0x507803,_0x31cd29){return new BPromise(function(_0x522f13,_0x2d5e18){return client[_0x68cb('0x5')](_0x507803,_0x31cd29)['then'](function(_0x13257d){logger[_0x68cb('0x6')](_0x68cb('0x7'),_0x68cb('0x8'),_0x507803,_0x31cd29,_0x13257d);if(_0x13257d[_0x68cb('0x9')]){logger['error'](_0x68cb('0x7'),_0x68cb('0x8'),_0x507803,_0x13257d[_0x68cb('0x9')][_0x68cb('0xa')],_0x31cd29);return _0x2d5e18(_0x13257d[_0x68cb('0x9')][_0x68cb('0xa')]);}else{return _0x522f13(_0x13257d[_0x68cb('0xb')]);}})[_0x68cb('0xc')](function(_0x3e7cc8){logger[_0x68cb('0x9')](_0x68cb('0x7'),'memberReport',_0x507803,_0x3e7cc8,_0x31cd29);return _0x2d5e18(_0x3e7cc8);});});};module[_0x68cb('0xd')]=client; \ No newline at end of file +var _0x9d7d=['http','Request','request','debug','memberReport','error','rpc','message','result','exports','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0x3d2761,_0x2696bf){var _0x531ae9=function(_0x495aa6){while(--_0x495aa6){_0x3d2761['push'](_0x3d2761['shift']());}};_0x531ae9(++_0x2696bf);}(_0x9d7d,0x172));var _0xd9d7=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0x9d7d[_0x456bd2];return _0x2218c1;};'use strict';var jayson=require(_0xd9d7('0x0'));var BPromise=require(_0xd9d7('0x1'));var logger=require(_0xd9d7('0x2'))(_0xd9d7('0x3'));var client=jayson[_0xd9d7('0x4')][_0xd9d7('0x5')]({'port':0x2329});client[_0xd9d7('0x6')]=function(_0xee6fad,_0x5d5cb8){return new BPromise(function(_0x24c631,_0x3def99){return client[_0xd9d7('0x7')](_0xee6fad,_0x5d5cb8)['then'](function(_0x34c87f){logger[_0xd9d7('0x8')]('rpc',_0xd9d7('0x9'),_0xee6fad,_0x5d5cb8,_0x34c87f);if(_0x34c87f[_0xd9d7('0xa')]){logger[_0xd9d7('0xa')](_0xd9d7('0xb'),_0xd9d7('0x9'),_0xee6fad,_0x34c87f[_0xd9d7('0xa')][_0xd9d7('0xc')],_0x5d5cb8);return _0x3def99(_0x34c87f[_0xd9d7('0xa')][_0xd9d7('0xc')]);}else{return _0x24c631(_0x34c87f[_0xd9d7('0xd')]);}})['catch'](function(_0x2e05a2){logger[_0xd9d7('0xa')](_0xd9d7('0xb'),_0xd9d7('0x9'),_0xee6fad,_0x2e05a2,_0x5d5cb8);return _0x3def99(_0x2e05a2);});});};module[_0xd9d7('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 4707937..2dd3a78 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 _0x9827=['YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','exports','moment','isNil','string','voiceQueue','uniqueid','Contact','lastName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName'];(function(_0x28ce79,_0x1cc464){var _0x2705e4=function(_0x516bab){while(--_0x516bab){_0x28ce79['push'](_0x28ce79['shift']());}};_0x2705e4(++_0x1cc464);}(_0x9827,0x12b));var _0x7982=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x9827[_0x558e45];return _0x3e9075;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7982('0x0'));function checkNameSurname(_0x38dbb5,_0x2a60fc,_0x42de5e){var _0x465e45='';if(!_[_0x7982('0x1')](_0x2a60fc)&&_0x7982('0x2')===typeof _0x2a60fc){_0x465e45+=_0x2a60fc;}if(!_[_0x7982('0x1')](_0x42de5e)&&'string'===typeof _0x42de5e){_0x465e45+='\x20'+_0x42de5e;}if(_0x465e45!==''){return _0x465e45;}return _0x38dbb5;}function Action(_0x52dc7d,_0x2ce0cf,_0x3f7fc2){this[_0x7982('0x3')]=_0x52dc7d;this[_0x7982('0x4')]=_0x3f7fc2||undefined;this['name']=checkNameSurname(_0x2ce0cf[_0x7982('0x5')]['phone'],_0x2ce0cf[_0x7982('0x5')]['firstName'],_0x2ce0cf['Contact'][_0x7982('0x6')]);this[_0x7982('0x7')]=_0x2ce0cf[_0x7982('0x8')];this[_0x7982('0x9')]=_0x52dc7d[_0x7982('0xa')];this[_0x7982('0xb')]=_0x2ce0cf[_0x7982('0xb')]||![];this['type']=_0x52dc7d[_0x7982('0xc')];this[_0x7982('0xd')]=_0x52dc7d[_0x7982('0xd')]||0x3;this[_0x7982('0xe')]=_0x2ce0cf[_0x7982('0xe')];this['countbusyretry']=_0x2ce0cf['countbusyretry'];this['countcongestionretry']=_0x2ce0cf[_0x7982('0xf')];this[_0x7982('0x10')]=_0x2ce0cf['countnoanswerretry'];this[_0x7982('0x11')]=_0x2ce0cf[_0x7982('0x11')];this[_0x7982('0x12')]=_0x2ce0cf[_0x7982('0x12')];this[_0x7982('0x13')]=_0x2ce0cf[_0x7982('0x13')];this[_0x7982('0x14')]=_0x2ce0cf[_0x7982('0x14')];this[_0x7982('0x15')]=_0x2ce0cf['countagentrejectretry'];this[_0x7982('0x16')]=_0x2ce0cf['ContactId'];this[_0x7982('0x17')]=_0x2ce0cf['ListId'];this[_0x7982('0x18')]=_0x2ce0cf[_0x7982('0x18')];this[_0x7982('0x19')]=_0x2ce0cf[_0x7982('0x19')];this['CampaignId']=_0x2ce0cf[_0x7982('0x1a')];this['idHopper']=_0x2ce0cf['id'];this[_0x7982('0x1b')]=_0x2ce0cf['Contact'][_0x7982('0x1c')]||'';this['starttime']=moment()['format'](_0x7982('0x1d'));this[_0x7982('0x1e')]=_0x2ce0cf[_0x7982('0x1e')];this['callbackuniqueid']=_0x2ce0cf[_0x7982('0x1f')];this[_0x7982('0x20')]=_0x2ce0cf[_0x7982('0x20')];this['recallme']=_0x2ce0cf[_0x7982('0x21')];this['originatecalleridnum']='';this[_0x7982('0x22')]='';}Action[_0x7982('0x23')][_0x7982('0x24')]=function(){return util[_0x7982('0x25')](_0x7982('0x26'),this[_0x7982('0xa')],this[_0x7982('0x3')]['dialCutDigit']>0x0?this[_0x7982('0x7')]['substring'](this[_0x7982('0x3')][_0x7982('0x27')]):this['number']);};Action[_0x7982('0x23')]['getQueue']=function(){return this[_0x7982('0x9')];};module[_0x7982('0x28')]=Action; \ No newline at end of file +var _0x61a9=['string','voiceQueue','uniqueid','Contact','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','util','isNil'];(function(_0xdd1f52,_0x227e9e){var _0x368782=function(_0x480309){while(--_0x480309){_0xdd1f52['push'](_0xdd1f52['shift']());}};_0x368782(++_0x227e9e);}(_0x61a9,0x106));var _0x961a=function(_0x4d7362,_0x3a2bc5){_0x4d7362=_0x4d7362-0x0;var _0xa73eb3=_0x61a9[_0x4d7362];return _0xa73eb3;};'use strict';var util=require(_0x961a('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x43896f,_0xad51b9,_0x1ef513){var _0x171b42='';if(!_[_0x961a('0x1')](_0xad51b9)&&_0x961a('0x2')===typeof _0xad51b9){_0x171b42+=_0xad51b9;}if(!_[_0x961a('0x1')](_0x1ef513)&&_0x961a('0x2')===typeof _0x1ef513){_0x171b42+='\x20'+_0x1ef513;}if(_0x171b42!==''){return _0x171b42;}return _0x43896f;}function Action(_0x1ce793,_0x22c2b7,_0x47a241){this[_0x961a('0x3')]=_0x1ce793;this[_0x961a('0x4')]=_0x47a241||undefined;this['name']=checkNameSurname(_0x22c2b7[_0x961a('0x5')]['phone'],_0x22c2b7[_0x961a('0x5')]['firstName'],_0x22c2b7['Contact']['lastName']);this['number']=_0x22c2b7[_0x961a('0x6')];this[_0x961a('0x7')]=_0x1ce793[_0x961a('0x8')];this['active']=_0x22c2b7[_0x961a('0x9')]||![];this[_0x961a('0xa')]=_0x1ce793[_0x961a('0xa')];this[_0x961a('0xb')]=_0x1ce793[_0x961a('0xb')]||0x3;this['scheduledat']=_0x22c2b7[_0x961a('0xc')];this[_0x961a('0xd')]=_0x22c2b7[_0x961a('0xd')];this[_0x961a('0xe')]=_0x22c2b7[_0x961a('0xe')];this[_0x961a('0xf')]=_0x22c2b7[_0x961a('0xf')];this['countnosuchnumberretry']=_0x22c2b7[_0x961a('0x10')];this[_0x961a('0x11')]=_0x22c2b7[_0x961a('0x11')];this[_0x961a('0x12')]=_0x22c2b7[_0x961a('0x12')];this[_0x961a('0x13')]=_0x22c2b7[_0x961a('0x13')];this['countagentrejectretry']=_0x22c2b7[_0x961a('0x14')];this['ContactId']=_0x22c2b7[_0x961a('0x15')];this[_0x961a('0x16')]=_0x22c2b7[_0x961a('0x16')];this[_0x961a('0x17')]=_0x22c2b7['UserId'];this[_0x961a('0x18')]=_0x22c2b7[_0x961a('0x18')];this[_0x961a('0x19')]=_0x22c2b7[_0x961a('0x19')];this[_0x961a('0x1a')]=_0x22c2b7['id'];this[_0x961a('0x1b')]=_0x22c2b7[_0x961a('0x5')][_0x961a('0x1c')]||'';this[_0x961a('0x1d')]=moment()[_0x961a('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x961a('0x1f')]=_0x22c2b7['callback'];this['callbackuniqueid']=_0x22c2b7[_0x961a('0x20')];this[_0x961a('0x21')]=_0x22c2b7['callbackat'];this['recallme']=_0x22c2b7[_0x961a('0x22')];this[_0x961a('0x23')]='';this['originatecalleridname']='';}Action[_0x961a('0x24')][_0x961a('0x25')]=function(){return util[_0x961a('0x1e')](_0x961a('0x26'),this[_0x961a('0x8')],this[_0x961a('0x3')][_0x961a('0x27')]>0x0?this[_0x961a('0x28')][_0x961a('0x29')](this[_0x961a('0x3')]['dialCutDigit']):this[_0x961a('0x28')]);};Action[_0x961a('0x24')][_0x961a('0x2a')]=function(){return this['queue'];};module[_0x961a('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 239cfe6..b3b709e 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 _0x541d=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','queue','calleridname','name','number','responsetime','endtime','starttime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','lodash','milliseconds'];(function(_0x5c89ef,_0x296c7e){var _0x517710=function(_0x4fd0e7){while(--_0x4fd0e7){_0x5c89ef['push'](_0x5c89ef['shift']());}};_0x517710(++_0x296c7e);}(_0x541d,0x130));var _0xd541=function(_0x26679e,_0x564d45){_0x26679e=_0x26679e-0x0;var _0x3d6890=_0x541d[_0x26679e];return _0x3d6890;};'use strict';var util=require('util');var _=require(_0xd541('0x0'));var moment=require('moment');function getSeconds(_0x2e14e4,_0xd76c85){var _0x521cb9=moment(_0x2e14e4)[_0xd541('0x1')](0x0);var _0xa51002=moment(_0xd76c85)['milliseconds'](0x0);return _0x521cb9['diff'](_0xa51002,_0xd541('0x2'));}function AdditionalPhone(_0x17da0a){this[_0xd541('0x3')]=_0x17da0a[_0xd541('0x3')];this[_0xd541('0x4')]=_0x17da0a['scheduledat']||undefined;this[_0xd541('0x5')]=_0x17da0a[_0xd541('0x5')];this[_0xd541('0x6')]=_0x17da0a['type']===_0xd541('0x7')?'queue':_0x17da0a[_0xd541('0x5')];this[_0xd541('0x8')]=_0x17da0a[_0xd541('0x8')];this[_0xd541('0x9')]=_0x17da0a['countcongestionretry'];this[_0xd541('0xa')]=_0x17da0a[_0xd541('0xa')];this['countglobal']=_0x17da0a['countbusyretry']+_0x17da0a[_0xd541('0x9')]+_0x17da0a[_0xd541('0xa')]+_0x17da0a[_0xd541('0xb')]+_0x17da0a['countdropretry']+_0x17da0a['countabandonedretry']+_0x17da0a[_0xd541('0xc')]+_0x17da0a[_0xd541('0xd')];this[_0xd541('0xb')]=_0x17da0a[_0xd541('0xb')];this[_0xd541('0xe')]=_0x17da0a[_0xd541('0xe')];this[_0xd541('0xf')]=_0x17da0a[_0xd541('0xf')];this[_0xd541('0xc')]=_0x17da0a[_0xd541('0xc')];this[_0xd541('0xd')]=_0x17da0a['countagentrejectretry'];this[_0xd541('0x10')]=_0x17da0a['queue'];this[_0xd541('0x11')]=_0x17da0a[_0xd541('0x12')];this['calleridnum']=_0x17da0a[_0xd541('0x13')];this['starttime']=_0x17da0a['starttime'];this[_0xd541('0x14')]=_0x17da0a['responsetime'];this[_0xd541('0x15')]=_0x17da0a[_0xd541('0x14')];this['ringtime']=getSeconds(_0x17da0a[_0xd541('0x14')],_0x17da0a[_0xd541('0x16')]);this['holdtime']=0x0;this[_0xd541('0x17')]=0x0;this['callback']=_0x17da0a[_0xd541('0x18')];this[_0xd541('0x19')]=_0x17da0a['callbackuniqueid'];this['callbackat']=_0x17da0a[_0xd541('0x1a')];this['recallme']=_0x17da0a[_0xd541('0x1b')];this[_0xd541('0x1c')]=_0x17da0a['ContactId'];this[_0xd541('0x1d')]=_0x17da0a[_0xd541('0x1d')];this[_0xd541('0x1e')]=_0x17da0a[_0xd541('0x1e')];this['VoiceQueueId']=_0x17da0a['VoiceQueueId'];this[_0xd541('0x1f')]=_0x17da0a[_0xd541('0x1f')];this[_0xd541('0x20')]=_0x17da0a[_0xd541('0x20')]||'';this[_0xd541('0x21')]=_0x17da0a[_0xd541('0x21')]||'';}module['exports']=History; \ No newline at end of file +var _0x9a3e=['countabandonedretry','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x9a3e,0xff));var _0xe9a3=function(_0x1b0b14,_0x581c37){_0x1b0b14=_0x1b0b14-0x0;var _0x4f18b2=_0x9a3e[_0x1b0b14];return _0x4f18b2;};'use strict';var util=require(_0xe9a3('0x0'));var _=require(_0xe9a3('0x1'));var moment=require(_0xe9a3('0x2'));function getSeconds(_0x4eef7c,_0xec6984){var _0x9b2046=moment(_0x4eef7c)[_0xe9a3('0x3')](0x0);var _0x361680=moment(_0xec6984)['milliseconds'](0x0);return _0x9b2046[_0xe9a3('0x4')](_0x361680,_0xe9a3('0x5'));}function AdditionalPhone(_0x51d38e){this[_0xe9a3('0x6')]=_0x51d38e['uniqueid'];this[_0xe9a3('0x7')]=_0x51d38e[_0xe9a3('0x7')]||undefined;this['type']=_0x51d38e[_0xe9a3('0x8')];this[_0xe9a3('0x9')]=_0x51d38e['type']===_0xe9a3('0xa')?_0xe9a3('0xb'):_0x51d38e[_0xe9a3('0x8')];this[_0xe9a3('0xc')]=_0x51d38e['countbusyretry'];this['countcongestionretry']=_0x51d38e[_0xe9a3('0xd')];this[_0xe9a3('0xe')]=_0x51d38e[_0xe9a3('0xe')];this['countglobal']=_0x51d38e[_0xe9a3('0xc')]+_0x51d38e[_0xe9a3('0xd')]+_0x51d38e[_0xe9a3('0xe')]+_0x51d38e['countnosuchnumberretry']+_0x51d38e[_0xe9a3('0xf')]+_0x51d38e['countabandonedretry']+_0x51d38e[_0xe9a3('0x10')]+_0x51d38e[_0xe9a3('0x11')];this['countnosuchnumberretry']=_0x51d38e['countnosuchnumberretry'];this[_0xe9a3('0xf')]=_0x51d38e[_0xe9a3('0xf')];this[_0xe9a3('0x12')]=_0x51d38e[_0xe9a3('0x12')];this[_0xe9a3('0x10')]=_0x51d38e[_0xe9a3('0x10')];this[_0xe9a3('0x11')]=_0x51d38e[_0xe9a3('0x11')];this['queue']=_0x51d38e[_0xe9a3('0xb')];this['calleridname']=_0x51d38e[_0xe9a3('0x13')];this['calleridnum']=_0x51d38e[_0xe9a3('0x14')];this['starttime']=_0x51d38e[_0xe9a3('0x15')];this[_0xe9a3('0x16')]=_0x51d38e[_0xe9a3('0x16')];this[_0xe9a3('0x17')]=_0x51d38e[_0xe9a3('0x16')];this[_0xe9a3('0x18')]=getSeconds(_0x51d38e['responsetime'],_0x51d38e['starttime']);this[_0xe9a3('0x19')]=0x0;this[_0xe9a3('0x1a')]=0x0;this[_0xe9a3('0x1b')]=_0x51d38e[_0xe9a3('0x1b')];this['callbackuniqueid']=_0x51d38e[_0xe9a3('0x1c')];this[_0xe9a3('0x1d')]=_0x51d38e[_0xe9a3('0x1d')];this[_0xe9a3('0x1e')]=_0x51d38e[_0xe9a3('0x1e')];this[_0xe9a3('0x1f')]=_0x51d38e[_0xe9a3('0x1f')];this[_0xe9a3('0x20')]=_0x51d38e[_0xe9a3('0x20')];this['UserId']=_0x51d38e[_0xe9a3('0x21')];this[_0xe9a3('0x22')]=_0x51d38e[_0xe9a3('0x22')];this[_0xe9a3('0x23')]=_0x51d38e[_0xe9a3('0x23')];this[_0xe9a3('0x24')]=_0x51d38e[_0xe9a3('0x24')]||'';this[_0xe9a3('0x25')]=_0x51d38e['originatecalleridname']||'';}module[_0xe9a3('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 4e5194f..41aa85e 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 _0x7d1b=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0xb2b040,_0x5b8d7b){var _0x4cc1b8=function(_0xf7712e){while(--_0xf7712e){_0xb2b040['push'](_0xb2b040['shift']());}};_0x4cc1b8(++_0x5b8d7b);}(_0x7d1b,0x123));var _0xb7d1=function(_0x1784ef,_0x5d0fbc){_0x1784ef=_0x1784ef-0x0;var _0x56056f=_0x7d1b[_0x1784ef];return _0x56056f;};'use strict';var util=require('util');var _=require(_0xb7d1('0x0'));var moment=require(_0xb7d1('0x1'));function getSeconds(_0x392a5e,_0x39a8de){var _0x11f5ac=moment(_0x392a5e)[_0xb7d1('0x2')](0x0);var _0x2b0ace=moment(_0x39a8de)[_0xb7d1('0x2')](0x0);return _0x11f5ac[_0xb7d1('0x3')](_0x2b0ace,_0xb7d1('0x4'));}function AgentComplete(_0x544bf2,_0x383a99){this['state']=0x4;this[_0xb7d1('0x5')]=_0xb7d1('0x6');this[_0xb7d1('0x7')]=_0x544bf2[_0xb7d1('0x7')];this['type']=_0x544bf2['type'];this[_0xb7d1('0x8')]=_0x544bf2['type']===_0xb7d1('0x9')?_0xb7d1('0xa'):_0x544bf2[_0xb7d1('0xb')];this[_0xb7d1('0xc')]=_0x544bf2[_0xb7d1('0xc')];this['countcongestionretry']=_0x544bf2[_0xb7d1('0xd')];this['countnoanswerretry']=_0x544bf2[_0xb7d1('0xe')];this[_0xb7d1('0xf')]=_0x544bf2[_0xb7d1('0xc')]+_0x544bf2[_0xb7d1('0xd')]+_0x544bf2[_0xb7d1('0xe')]+_0x544bf2[_0xb7d1('0x10')]+_0x544bf2[_0xb7d1('0x11')]+_0x544bf2[_0xb7d1('0x12')]+_0x544bf2[_0xb7d1('0x13')]+_0x544bf2[_0xb7d1('0x14')];this['countnosuchnumberretry']=_0x544bf2['countnosuchnumberretry'];this['countdropretry']=_0x544bf2[_0xb7d1('0x11')];this[_0xb7d1('0x12')]=_0x544bf2['countabandonedretry'];this[_0xb7d1('0x13')]=_0x544bf2[_0xb7d1('0x13')];this[_0xb7d1('0x14')]=_0x544bf2[_0xb7d1('0x14')];this[_0xb7d1('0x15')]=_0x383a99[_0xb7d1('0x15')];this[_0xb7d1('0x16')]=_0x544bf2[_0xb7d1('0x17')];this[_0xb7d1('0x18')]=_0x544bf2[_0xb7d1('0x19')];this['starttime']=_0x544bf2[_0xb7d1('0x1a')];this['responsetime']=_0x544bf2[_0xb7d1('0x1b')];this[_0xb7d1('0x1c')]=_0x544bf2['answertime'];this[_0xb7d1('0x1d')]=moment()[_0xb7d1('0x1e')](_0xb7d1('0x1f'));this['ringtime']=getSeconds(_0x544bf2[_0xb7d1('0x1b')],_0x544bf2['starttime']);this[_0xb7d1('0x20')]=getSeconds(_0x544bf2[_0xb7d1('0x1c')],_0x544bf2[_0xb7d1('0x1b')]);this['talktime']=getSeconds(this['endtime'],_0x544bf2[_0xb7d1('0x1c')]);this[_0xb7d1('0xa')]=_0x383a99[_0xb7d1('0xa')];this[_0xb7d1('0x21')]=_0x383a99['membername'];this[_0xb7d1('0x22')]=_0x383a99['reason'];this[_0xb7d1('0x23')]=_0x544bf2[_0xb7d1('0x23')];this[_0xb7d1('0x24')]=_0x544bf2[_0xb7d1('0x24')];this[_0xb7d1('0x25')]=_0x544bf2['callbackat'];this[_0xb7d1('0x26')]=_0x544bf2[_0xb7d1('0x26')];this[_0xb7d1('0x27')]=_0x544bf2['ContactId'];this[_0xb7d1('0x28')]=_0x544bf2[_0xb7d1('0x28')];this[_0xb7d1('0x29')]=_0x544bf2[_0xb7d1('0x29')];this[_0xb7d1('0x2a')]=_0x544bf2['VoiceQueueId'];this[_0xb7d1('0x2b')]=_0x544bf2[_0xb7d1('0x2b')];this[_0xb7d1('0x2c')]=_0x544bf2[_0xb7d1('0x2c')]||'';this[_0xb7d1('0x2d')]=_0x544bf2[_0xb7d1('0x2d')]||'';}module[_0xb7d1('0x2e')]=AgentComplete; \ No newline at end of file +var _0x6c89=['calleridnum','number','starttime','responsetime','answertime','endtime','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name'];(function(_0x41f6d4,_0x255693){var _0x42a2a9=function(_0x1d0a8){while(--_0x1d0a8){_0x41f6d4['push'](_0x41f6d4['shift']());}};_0x42a2a9(++_0x255693);}(_0x6c89,0xc9));var _0x96c8=function(_0x189c41,_0x65162c){_0x189c41=_0x189c41-0x0;var _0x3e117c=_0x6c89[_0x189c41];return _0x3e117c;};'use strict';var util=require('util');var _=require(_0x96c8('0x0'));var moment=require(_0x96c8('0x1'));function getSeconds(_0x3402cb,_0x2fe379){var _0x1ea8d9=moment(_0x3402cb)['milliseconds'](0x0);var _0x345806=moment(_0x2fe379)[_0x96c8('0x2')](0x0);return _0x1ea8d9[_0x96c8('0x3')](_0x345806,_0x96c8('0x4'));}function AgentComplete(_0x8ef4,_0x45dfca){this[_0x96c8('0x5')]=0x4;this[_0x96c8('0x6')]=_0x96c8('0x7');this['scheduledat']=_0x8ef4[_0x96c8('0x8')];this[_0x96c8('0x9')]=_0x8ef4[_0x96c8('0x9')];this[_0x96c8('0xa')]=_0x8ef4['type']===_0x96c8('0xb')?'queue':_0x8ef4[_0x96c8('0x9')];this[_0x96c8('0xc')]=_0x8ef4[_0x96c8('0xc')];this[_0x96c8('0xd')]=_0x8ef4[_0x96c8('0xd')];this['countnoanswerretry']=_0x8ef4[_0x96c8('0xe')];this[_0x96c8('0xf')]=_0x8ef4[_0x96c8('0xc')]+_0x8ef4[_0x96c8('0xd')]+_0x8ef4[_0x96c8('0xe')]+_0x8ef4[_0x96c8('0x10')]+_0x8ef4[_0x96c8('0x11')]+_0x8ef4[_0x96c8('0x12')]+_0x8ef4[_0x96c8('0x13')]+_0x8ef4[_0x96c8('0x14')];this[_0x96c8('0x10')]=_0x8ef4[_0x96c8('0x10')];this['countdropretry']=_0x8ef4[_0x96c8('0x11')];this['countabandonedretry']=_0x8ef4[_0x96c8('0x12')];this['countmachineretry']=_0x8ef4[_0x96c8('0x13')];this[_0x96c8('0x14')]=_0x8ef4[_0x96c8('0x14')];this[_0x96c8('0x15')]=_0x45dfca['uniqueid'];this[_0x96c8('0x16')]=_0x8ef4[_0x96c8('0x17')];this[_0x96c8('0x18')]=_0x8ef4[_0x96c8('0x19')];this['starttime']=_0x8ef4[_0x96c8('0x1a')];this[_0x96c8('0x1b')]=_0x8ef4['responsetime'];this['answertime']=_0x8ef4[_0x96c8('0x1c')];this[_0x96c8('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x96c8('0x1e')]=getSeconds(_0x8ef4['responsetime'],_0x8ef4[_0x96c8('0x1a')]);this[_0x96c8('0x1f')]=getSeconds(_0x8ef4[_0x96c8('0x1c')],_0x8ef4[_0x96c8('0x1b')]);this[_0x96c8('0x20')]=getSeconds(this[_0x96c8('0x1d')],_0x8ef4['answertime']);this['queue']=_0x45dfca[_0x96c8('0x21')];this[_0x96c8('0x22')]=_0x45dfca[_0x96c8('0x22')];this[_0x96c8('0x23')]=_0x45dfca[_0x96c8('0x23')];this[_0x96c8('0x24')]=_0x8ef4[_0x96c8('0x24')];this[_0x96c8('0x25')]=_0x8ef4[_0x96c8('0x25')];this['callbackat']=_0x8ef4[_0x96c8('0x26')];this['recallme']=_0x8ef4[_0x96c8('0x27')];this['ContactId']=_0x8ef4[_0x96c8('0x28')];this[_0x96c8('0x29')]=_0x8ef4['ListId'];this['UserId']=_0x8ef4['UserId'];this['VoiceQueueId']=_0x8ef4['VoiceQueueId'];this[_0x96c8('0x2a')]=_0x8ef4[_0x96c8('0x2a')];this['originatecalleridnum']=_0x8ef4[_0x96c8('0x2b')]||'';this[_0x96c8('0x2c')]=_0x8ef4['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 3d14c99..16ed621 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 _0x6ab0=['UserId','VoiceQueueId','CampaignId','originatecalleridname','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x53c5d0,_0x5bd925){var _0x2a0e39=function(_0x200300){while(--_0x200300){_0x53c5d0['push'](_0x53c5d0['shift']());}};_0x2a0e39(++_0x5bd925);}(_0x6ab0,0x1be));var _0x06ab=function(_0x385c97,_0xef4ef9){_0x385c97=_0x385c97-0x0;var _0x496b51=_0x6ab0[_0x385c97];return _0x496b51;};'use strict';var util=require('util');var _=require(_0x06ab('0x0'));var moment=require(_0x06ab('0x1'));function getSeconds(_0x375428,_0x3a787f){var _0x55d412=moment(_0x375428)[_0x06ab('0x2')](0x0);var _0x5636e7=moment(_0x3a787f)[_0x06ab('0x2')](0x0);return _0x55d412['diff'](_0x5636e7,_0x06ab('0x3'));}function Final(_0x7b450c){this[_0x06ab('0x4')]=_0x7b450c['uniqueid'];this[_0x06ab('0x5')]=_0x7b450c[_0x06ab('0x5')];this['type']=_0x7b450c[_0x06ab('0x6')];this['campaigntype']=_0x7b450c[_0x06ab('0x6')]===_0x06ab('0x7')?_0x06ab('0x8'):_0x7b450c[_0x06ab('0x6')];this[_0x06ab('0x9')]=_0x7b450c[_0x06ab('0x9')];this[_0x06ab('0xa')]=_0x7b450c[_0x06ab('0xa')];this[_0x06ab('0xb')]=_0x7b450c[_0x06ab('0xb')];this['countglobal']=_0x7b450c[_0x06ab('0x9')]+_0x7b450c['countcongestionretry']+_0x7b450c[_0x06ab('0xb')]+_0x7b450c[_0x06ab('0xc')]+_0x7b450c['countdropretry']+_0x7b450c[_0x06ab('0xd')]+_0x7b450c[_0x06ab('0xe')]+_0x7b450c[_0x06ab('0xf')];this[_0x06ab('0xc')]=_0x7b450c[_0x06ab('0xc')];this[_0x06ab('0x10')]=_0x7b450c[_0x06ab('0x10')];this[_0x06ab('0xd')]=_0x7b450c[_0x06ab('0xd')];this['countmachineretry']=_0x7b450c[_0x06ab('0xe')];this[_0x06ab('0xf')]=_0x7b450c[_0x06ab('0xf')];this[_0x06ab('0x8')]=_0x7b450c[_0x06ab('0x8')];this['calleridname']=_0x7b450c[_0x06ab('0x11')];this[_0x06ab('0x12')]=_0x7b450c[_0x06ab('0x12')];this['starttime']=_0x7b450c[_0x06ab('0x13')];this[_0x06ab('0x14')]=_0x7b450c[_0x06ab('0x14')];this[_0x06ab('0x15')]=_0x7b450c[_0x06ab('0x14')];this['ringtime']=_0x7b450c['ringtime']||0x0;this[_0x06ab('0x16')]=_0x7b450c[_0x06ab('0x16')]||0x0;this[_0x06ab('0x17')]=_0x7b450c[_0x06ab('0x17')]||0x0;this[_0x06ab('0x18')]=_0x7b450c[_0x06ab('0x18')];this[_0x06ab('0x19')]=_0x7b450c['callbackuniqueid'];this[_0x06ab('0x1a')]=_0x7b450c['callbackat'];this[_0x06ab('0x1b')]=_0x7b450c[_0x06ab('0x1b')];this[_0x06ab('0x1c')]=_0x7b450c[_0x06ab('0x1c')];this[_0x06ab('0x1d')]=_0x7b450c[_0x06ab('0x1d')];this[_0x06ab('0x1e')]=_0x7b450c[_0x06ab('0x1e')];this[_0x06ab('0x1f')]=_0x7b450c[_0x06ab('0x1f')];this[_0x06ab('0x20')]=_0x7b450c[_0x06ab('0x20')];this['originatecalleridnum']=_0x7b450c['originatecalleridnum']||'';this['originatecalleridname']=_0x7b450c[_0x06ab('0x21')]||'';}module['exports']=Final; \ No newline at end of file +var _0x3fe6=['countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','lodash','milliseconds','diff','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x3fe6,0x1cc));var _0x63fe=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x3fe6[_0x870b62];return _0x2dcb39;};'use strict';var util=require('util');var _=require(_0x63fe('0x0'));var moment=require('moment');function getSeconds(_0x7909d2,_0x182980){var _0x5c823c=moment(_0x7909d2)[_0x63fe('0x1')](0x0);var _0x25b7fa=moment(_0x182980)[_0x63fe('0x1')](0x0);return _0x5c823c[_0x63fe('0x2')](_0x25b7fa,'seconds');}function Final(_0x4b243a){this[_0x63fe('0x3')]=_0x4b243a[_0x63fe('0x3')];this['scheduledat']=_0x4b243a['scheduledat'];this[_0x63fe('0x4')]=_0x4b243a[_0x63fe('0x4')];this[_0x63fe('0x5')]=_0x4b243a[_0x63fe('0x4')]===_0x63fe('0x6')?_0x63fe('0x7'):_0x4b243a[_0x63fe('0x4')];this[_0x63fe('0x8')]=_0x4b243a['countbusyretry'];this[_0x63fe('0x9')]=_0x4b243a[_0x63fe('0x9')];this['countnoanswerretry']=_0x4b243a[_0x63fe('0xa')];this[_0x63fe('0xb')]=_0x4b243a[_0x63fe('0x8')]+_0x4b243a['countcongestionretry']+_0x4b243a[_0x63fe('0xa')]+_0x4b243a[_0x63fe('0xc')]+_0x4b243a[_0x63fe('0xd')]+_0x4b243a[_0x63fe('0xe')]+_0x4b243a[_0x63fe('0xf')]+_0x4b243a[_0x63fe('0x10')];this[_0x63fe('0xc')]=_0x4b243a[_0x63fe('0xc')];this[_0x63fe('0xd')]=_0x4b243a[_0x63fe('0xd')];this[_0x63fe('0xe')]=_0x4b243a[_0x63fe('0xe')];this['countmachineretry']=_0x4b243a['countmachineretry'];this['countagentrejectretry']=_0x4b243a[_0x63fe('0x10')];this[_0x63fe('0x7')]=_0x4b243a[_0x63fe('0x7')];this[_0x63fe('0x11')]=_0x4b243a[_0x63fe('0x11')];this[_0x63fe('0x12')]=_0x4b243a[_0x63fe('0x12')];this['starttime']=_0x4b243a['starttime'];this[_0x63fe('0x13')]=_0x4b243a[_0x63fe('0x13')];this[_0x63fe('0x14')]=_0x4b243a['responsetime'];this[_0x63fe('0x15')]=_0x4b243a['ringtime']||0x0;this[_0x63fe('0x16')]=_0x4b243a[_0x63fe('0x16')]||0x0;this[_0x63fe('0x17')]=_0x4b243a[_0x63fe('0x17')]||0x0;this[_0x63fe('0x18')]=_0x4b243a[_0x63fe('0x18')];this['callbackuniqueid']=_0x4b243a[_0x63fe('0x19')];this[_0x63fe('0x1a')]=_0x4b243a[_0x63fe('0x1a')];this['recallme']=_0x4b243a[_0x63fe('0x1b')];this[_0x63fe('0x1c')]=_0x4b243a['ContactId'];this[_0x63fe('0x1d')]=_0x4b243a[_0x63fe('0x1d')];this[_0x63fe('0x1e')]=_0x4b243a[_0x63fe('0x1e')];this[_0x63fe('0x1f')]=_0x4b243a[_0x63fe('0x1f')];this[_0x63fe('0x20')]=_0x4b243a[_0x63fe('0x20')];this[_0x63fe('0x21')]=_0x4b243a[_0x63fe('0x21')]||'';this['originatecalleridname']=_0x4b243a['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index abdd2ec..1dfa47d 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 _0xc78f=['scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','statedesc','Answer'];(function(_0x3808c5,_0x1625ad){var _0x214c4e=function(_0x265824){while(--_0x265824){_0x3808c5['push'](_0x3808c5['shift']());}};_0x214c4e(++_0x1625ad);}(_0xc78f,0x102));var _0xfc78=function(_0x4713be,_0x267634){_0x4713be=_0x4713be-0x0;var _0x2dd601=_0xc78f[_0x4713be];return _0x2dd601;};'use strict';var util=require(_0xfc78('0x0'));var _=require(_0xfc78('0x1'));var moment=require('moment');function getSeconds(_0xc0f7bc,_0x595901){var _0x1583c9=moment(_0xc0f7bc)[_0xfc78('0x2')](0x0);var _0x28f2cf=moment(_0x595901)[_0xfc78('0x2')](0x0);return _0x1583c9[_0xfc78('0x3')](_0x28f2cf,'seconds');}function Hangup(_0x20adb9,_0x2376bb){this['state']=0x4;this[_0xfc78('0x4')]=_0xfc78('0x5');this[_0xfc78('0x6')]=_0x20adb9[_0xfc78('0x6')];this[_0xfc78('0x7')]=_0x20adb9[_0xfc78('0x7')];this[_0xfc78('0x8')]=_0x20adb9[_0xfc78('0x7')]==='outbound'?'queue':_0x20adb9[_0xfc78('0x7')];this[_0xfc78('0x9')]=_0x20adb9['countbusyretry'];this[_0xfc78('0xa')]=_0x20adb9['countcongestionretry'];this[_0xfc78('0xb')]=_0x20adb9[_0xfc78('0xb')];this[_0xfc78('0xc')]=_0x20adb9[_0xfc78('0x9')]+_0x20adb9['countcongestionretry']+_0x20adb9[_0xfc78('0xb')]+_0x20adb9[_0xfc78('0xd')]+_0x20adb9[_0xfc78('0xe')]+_0x20adb9[_0xfc78('0xf')]+_0x20adb9[_0xfc78('0x10')]+_0x20adb9[_0xfc78('0x11')];this['countnosuchnumberretry']=_0x20adb9[_0xfc78('0xd')];this[_0xfc78('0xe')]=_0x20adb9[_0xfc78('0xe')];this[_0xfc78('0xf')]=_0x20adb9[_0xfc78('0xf')];this[_0xfc78('0x10')]=_0x20adb9['countmachineretry'];this[_0xfc78('0x11')]=_0x20adb9[_0xfc78('0x11')];this[_0xfc78('0x12')]=_0x2376bb['uniqueid'];this[_0xfc78('0x13')]=_0x20adb9[_0xfc78('0x14')];this['calleridnum']=_0x20adb9[_0xfc78('0x15')];this[_0xfc78('0x16')]=_0x20adb9[_0xfc78('0x16')];this[_0xfc78('0x17')]=_0x20adb9[_0xfc78('0x17')];this[_0xfc78('0x18')]=moment()[_0xfc78('0x19')](_0xfc78('0x1a'));this['ringtime']=getSeconds(_0x20adb9['responsetime'],_0x20adb9[_0xfc78('0x16')]);this[_0xfc78('0x1b')]=0x0;this[_0xfc78('0x1c')]=getSeconds(this[_0xfc78('0x18')],_0x20adb9[_0xfc78('0x17')]);this[_0xfc78('0x1d')]=_0x20adb9[_0xfc78('0x1d')];this[_0xfc78('0x1e')]=_0xfc78('0x1f');this[_0xfc78('0x20')]=_0x2376bb[_0xfc78('0x21')];this[_0xfc78('0x22')]=_0x20adb9[_0xfc78('0x22')];this[_0xfc78('0x23')]=_0x20adb9[_0xfc78('0x23')];this[_0xfc78('0x24')]=_0x20adb9[_0xfc78('0x24')];this['recallme']=_0x20adb9[_0xfc78('0x25')];this['ContactId']=_0x20adb9[_0xfc78('0x26')];this['ListId']=_0x20adb9[_0xfc78('0x27')];this[_0xfc78('0x28')]=_0x20adb9[_0xfc78('0x28')];this[_0xfc78('0x29')]=_0x20adb9[_0xfc78('0x29')];this['CampaignId']=_0x20adb9[_0xfc78('0x2a')];}module[_0xfc78('0x2b')]=Hangup; \ No newline at end of file +var _0x80fb=['talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x34764e,_0x217156){var _0x16fadf=function(_0x49b70e){while(--_0x49b70e){_0x34764e['push'](_0x34764e['shift']());}};_0x16fadf(++_0x217156);}(_0x80fb,0x1a4));var _0xb80f=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x80fb[_0x491a7f];return _0x3d8f44;};'use strict';var util=require('util');var _=require(_0xb80f('0x0'));var moment=require('moment');function getSeconds(_0x3af0db,_0x29804f){var _0x2b9da4=moment(_0x3af0db)[_0xb80f('0x1')](0x0);var _0x12891d=moment(_0x29804f)[_0xb80f('0x1')](0x0);return _0x2b9da4[_0xb80f('0x2')](_0x12891d,'seconds');}function Hangup(_0x1fa7c9,_0x56500a){this[_0xb80f('0x3')]=0x4;this[_0xb80f('0x4')]=_0xb80f('0x5');this[_0xb80f('0x6')]=_0x1fa7c9[_0xb80f('0x6')];this[_0xb80f('0x7')]=_0x1fa7c9[_0xb80f('0x7')];this[_0xb80f('0x8')]=_0x1fa7c9['type']===_0xb80f('0x9')?_0xb80f('0xa'):_0x1fa7c9['type'];this['countbusyretry']=_0x1fa7c9[_0xb80f('0xb')];this[_0xb80f('0xc')]=_0x1fa7c9[_0xb80f('0xc')];this['countnoanswerretry']=_0x1fa7c9[_0xb80f('0xd')];this[_0xb80f('0xe')]=_0x1fa7c9[_0xb80f('0xb')]+_0x1fa7c9[_0xb80f('0xc')]+_0x1fa7c9['countnoanswerretry']+_0x1fa7c9[_0xb80f('0xf')]+_0x1fa7c9[_0xb80f('0x10')]+_0x1fa7c9[_0xb80f('0x11')]+_0x1fa7c9[_0xb80f('0x12')]+_0x1fa7c9[_0xb80f('0x13')];this[_0xb80f('0xf')]=_0x1fa7c9[_0xb80f('0xf')];this[_0xb80f('0x10')]=_0x1fa7c9[_0xb80f('0x10')];this[_0xb80f('0x11')]=_0x1fa7c9[_0xb80f('0x11')];this[_0xb80f('0x12')]=_0x1fa7c9[_0xb80f('0x12')];this['countagentrejectretry']=_0x1fa7c9['countagentrejectretry'];this[_0xb80f('0x14')]=_0x56500a['uniqueid'];this[_0xb80f('0x15')]=_0x1fa7c9[_0xb80f('0x16')];this[_0xb80f('0x17')]=_0x1fa7c9[_0xb80f('0x18')];this[_0xb80f('0x19')]=_0x1fa7c9['starttime'];this[_0xb80f('0x1a')]=_0x1fa7c9['responsetime'];this[_0xb80f('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb80f('0x1c')]=getSeconds(_0x1fa7c9[_0xb80f('0x1a')],_0x1fa7c9[_0xb80f('0x19')]);this[_0xb80f('0x1d')]=0x0;this[_0xb80f('0x1e')]=getSeconds(this['endtime'],_0x1fa7c9[_0xb80f('0x1a')]);this[_0xb80f('0xa')]=_0x1fa7c9[_0xb80f('0xa')];this[_0xb80f('0x1f')]=_0xb80f('0x20');this[_0xb80f('0x21')]=_0x56500a[_0xb80f('0x22')];this['callback']=_0x1fa7c9[_0xb80f('0x23')];this[_0xb80f('0x24')]=_0x1fa7c9[_0xb80f('0x24')];this[_0xb80f('0x25')]=_0x1fa7c9[_0xb80f('0x25')];this[_0xb80f('0x26')]=_0x1fa7c9['recallme'];this[_0xb80f('0x27')]=_0x1fa7c9[_0xb80f('0x27')];this[_0xb80f('0x28')]=_0x1fa7c9[_0xb80f('0x28')];this[_0xb80f('0x29')]=_0x1fa7c9['UserId'];this[_0xb80f('0x2a')]=_0x1fa7c9[_0xb80f('0x2a')];this[_0xb80f('0x2b')]=_0x1fa7c9[_0xb80f('0x2b')];}module[_0xb80f('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 0deeb44..a83cbf4 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 _0x214c=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid'];(function(_0x3e3e95,_0x4bccab){var _0x229728=function(_0x100da6){while(--_0x100da6){_0x3e3e95['push'](_0x3e3e95['shift']());}};_0x229728(++_0x4bccab);}(_0x214c,0x169));var _0xc214=function(_0x1871bb,_0xb8d5fb){_0x1871bb=_0x1871bb-0x0;var _0x53be8f=_0x214c[_0x1871bb];return _0x53be8f;};'use strict';var util=require(_0xc214('0x0'));var _=require(_0xc214('0x1'));var moment=require(_0xc214('0x2'));function getSeconds(_0x577b37,_0x23f2c9){var _0x2fc5c9=moment(_0x577b37)[_0xc214('0x3')](0x0);var _0x42c7e6=moment(_0x23f2c9)[_0xc214('0x3')](0x0);return _0x2fc5c9[_0xc214('0x4')](_0x42c7e6,_0xc214('0x5'));}function History(_0x3d2b2a){this[_0xc214('0x6')]=_0x3d2b2a[_0xc214('0x6')];this[_0xc214('0x7')]=_0x3d2b2a[_0xc214('0x7')]||undefined;this[_0xc214('0x8')]=_0x3d2b2a[_0xc214('0x8')];this[_0xc214('0x9')]=_0x3d2b2a[_0xc214('0x8')]===_0xc214('0xa')?_0xc214('0xb'):_0x3d2b2a[_0xc214('0x8')];this['countbusyretry']=_0x3d2b2a[_0xc214('0xc')];this['countcongestionretry']=_0x3d2b2a[_0xc214('0xd')];this[_0xc214('0xe')]=_0x3d2b2a['countnoanswerretry'];this['countglobal']=_0x3d2b2a[_0xc214('0xc')]+_0x3d2b2a['countcongestionretry']+_0x3d2b2a['countnoanswerretry']+_0x3d2b2a[_0xc214('0xf')]+_0x3d2b2a[_0xc214('0x10')]+_0x3d2b2a[_0xc214('0x11')]+_0x3d2b2a[_0xc214('0x12')]+_0x3d2b2a[_0xc214('0x13')];this[_0xc214('0xf')]=_0x3d2b2a[_0xc214('0xf')];this[_0xc214('0x10')]=_0x3d2b2a[_0xc214('0x10')];this['countabandonedretry']=_0x3d2b2a[_0xc214('0x11')];this[_0xc214('0x12')]=_0x3d2b2a[_0xc214('0x12')];this[_0xc214('0x13')]=_0x3d2b2a[_0xc214('0x13')];this[_0xc214('0xb')]=_0x3d2b2a[_0xc214('0xb')];this[_0xc214('0x14')]=_0x3d2b2a[_0xc214('0x15')];this[_0xc214('0x16')]=_0x3d2b2a['number'];this[_0xc214('0x17')]=_0x3d2b2a['starttime'];this[_0xc214('0x18')]=_0x3d2b2a[_0xc214('0x18')];this[_0xc214('0x19')]=_0x3d2b2a[_0xc214('0x18')];this['ringtime']=getSeconds(_0x3d2b2a['responsetime'],_0x3d2b2a['starttime']);this[_0xc214('0x1a')]=0x0;this['talktime']=0x0;this[_0xc214('0x1b')]=_0x3d2b2a[_0xc214('0x1b')];this[_0xc214('0x1c')]=_0x3d2b2a[_0xc214('0x1c')];this[_0xc214('0x1d')]=_0x3d2b2a[_0xc214('0x1d')];this[_0xc214('0x1e')]=_0x3d2b2a[_0xc214('0x1e')];this[_0xc214('0x1f')]=_0x3d2b2a[_0xc214('0x1f')];this[_0xc214('0x20')]=_0x3d2b2a[_0xc214('0x20')];this[_0xc214('0x21')]=_0x3d2b2a[_0xc214('0x21')];this[_0xc214('0x22')]=_0x3d2b2a[_0xc214('0x22')];this['CampaignId']=_0x3d2b2a[_0xc214('0x23')];this[_0xc214('0x24')]=_0x3d2b2a[_0xc214('0x24')]||'';this['originatecalleridname']=_0x3d2b2a[_0xc214('0x25')]||'';}module[_0xc214('0x26')]=History; \ No newline at end of file +var _0x155e=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x155e,0x9c));var _0xe155=function(_0x42025b,_0x2c635a){_0x42025b=_0x42025b-0x0;var _0xc991fc=_0x155e[_0x42025b];return _0xc991fc;};'use strict';var util=require(_0xe155('0x0'));var _=require(_0xe155('0x1'));var moment=require(_0xe155('0x2'));function getSeconds(_0x574e53,_0x3431dc){var _0x172efe=moment(_0x574e53)['milliseconds'](0x0);var _0x361474=moment(_0x3431dc)[_0xe155('0x3')](0x0);return _0x172efe['diff'](_0x361474,_0xe155('0x4'));}function History(_0x27c3b){this['uniqueid']=_0x27c3b[_0xe155('0x5')];this[_0xe155('0x6')]=_0x27c3b[_0xe155('0x6')]||undefined;this[_0xe155('0x7')]=_0x27c3b['type'];this[_0xe155('0x8')]=_0x27c3b['type']===_0xe155('0x9')?_0xe155('0xa'):_0x27c3b[_0xe155('0x7')];this[_0xe155('0xb')]=_0x27c3b['countbusyretry'];this[_0xe155('0xc')]=_0x27c3b['countcongestionretry'];this['countnoanswerretry']=_0x27c3b[_0xe155('0xd')];this[_0xe155('0xe')]=_0x27c3b[_0xe155('0xb')]+_0x27c3b[_0xe155('0xc')]+_0x27c3b[_0xe155('0xd')]+_0x27c3b[_0xe155('0xf')]+_0x27c3b[_0xe155('0x10')]+_0x27c3b[_0xe155('0x11')]+_0x27c3b[_0xe155('0x12')]+_0x27c3b['countagentrejectretry'];this[_0xe155('0xf')]=_0x27c3b[_0xe155('0xf')];this[_0xe155('0x10')]=_0x27c3b[_0xe155('0x10')];this[_0xe155('0x11')]=_0x27c3b['countabandonedretry'];this[_0xe155('0x12')]=_0x27c3b[_0xe155('0x12')];this[_0xe155('0x13')]=_0x27c3b[_0xe155('0x13')];this['queue']=_0x27c3b['queue'];this[_0xe155('0x14')]=_0x27c3b['name'];this[_0xe155('0x15')]=_0x27c3b['number'];this[_0xe155('0x16')]=_0x27c3b['starttime'];this[_0xe155('0x17')]=_0x27c3b[_0xe155('0x17')];this[_0xe155('0x18')]=_0x27c3b[_0xe155('0x17')];this[_0xe155('0x19')]=getSeconds(_0x27c3b[_0xe155('0x17')],_0x27c3b[_0xe155('0x16')]);this[_0xe155('0x1a')]=0x0;this[_0xe155('0x1b')]=0x0;this[_0xe155('0x1c')]=_0x27c3b[_0xe155('0x1c')];this['callbackuniqueid']=_0x27c3b[_0xe155('0x1d')];this[_0xe155('0x1e')]=_0x27c3b[_0xe155('0x1e')];this['recallme']=_0x27c3b[_0xe155('0x1f')];this[_0xe155('0x20')]=_0x27c3b[_0xe155('0x20')];this['ListId']=_0x27c3b[_0xe155('0x21')];this[_0xe155('0x22')]=_0x27c3b[_0xe155('0x22')];this[_0xe155('0x23')]=_0x27c3b[_0xe155('0x23')];this[_0xe155('0x24')]=_0x27c3b[_0xe155('0x24')];this[_0xe155('0x25')]=_0x27c3b[_0xe155('0x25')]||'';this['originatecalleridname']=_0x27c3b[_0xe155('0x26')]||'';}module[_0xe155('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 65312e6..7c2a6b3 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 _0x5387=['syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Intervals','stringify','milliseconds','seconds','emit','type','outbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice:queue:%s','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','prototype','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','uniqueid','variable','exten','dialAMDActive','value','HANGUP','state','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countbusyretry','countnosuchnumberretry','reason19\x20machine....','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','run','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','dialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','xcally-motion-dialer','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','entity\x20is\x20undefine','[callProgressDetecting]','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','buildObj','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','averageHandleTime','dialPredictiveInterval','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\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]','Umin\x20=\x20','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5387,0x1f3));var _0x7538=function(_0x1b7d39,_0xe94c72){_0x1b7d39=_0x1b7d39-0x0;var _0x35dc88=_0x5387[_0x1b7d39];return _0x35dc88;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x7538('0x0'));var uuid=require(_0x7538('0x1'));var moment=require('moment');var rr=require('rr');var md5=require(_0x7538('0x2'));var Redis=require(_0x7538('0x3'));var ut=require(_0x7538('0x4'));var config=require(_0x7538('0x5'));var logger=require(_0x7538('0x6'))(_0x7538('0x7'));var loggerBooked=require(_0x7538('0x6'))(_0x7538('0x8'));var loggerPredictive=require(_0x7538('0x6'))(_0x7538('0x9'));var loggerPredictiveCalls=require(_0x7538('0x6'))(_0x7538('0xa'));var loggerSyncQueueSummary=require(_0x7538('0x6'))(_0x7538('0xb'));var ami=require(_0x7538('0xc'));config[_0x7538('0xd')]=_['defaults'](config[_0x7538('0xd')],{'host':_0x7538('0xe'),'port':0x18eb});var io=require(_0x7538('0xf'))(new Redis(config[_0x7538('0xd')]));var cmHopper=require(_0x7538('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require(_0x7538('0x11'));var cmHopperAdditionalPhone=require(_0x7538('0x12'));var cmHopperBlack=require(_0x7538('0x13'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x7538('0x14'));var Final=require(_0x7538('0x15'));var AgentComplete=require(_0x7538('0x16'));var QueueCallerAbandon=require(_0x7538('0x17'));var Hangup=require(_0x7538('0x18'));var ipAgi=process['env'][_0x7538('0x19')]||'127.0.0.1';var strategy={'rrmemory':_0x7538('0x1a'),'roundrobin':_0x7538('0x1b')};var Sequence=function(){};Sequence['prototype'][_0x7538('0x1c')]=function(_0x4f4480){this['tail']=this[_0x7538('0x1d')]?this['tail'][_0x7538('0x1e')](_0x4f4480):_0x4f4480();};function Dialer(_0x4ffb1f,_0x4885f6){this[_0x7538('0x1f')]=new Sequence();this[_0x7538('0x20')]=_0x4885f6;this[_0x7538('0x21')]=_0x4ffb1f[_0x7538('0x21')];this[_0x7538('0x22')]=_0x4ffb1f[_0x7538('0x22')];this['agents']=_0x4ffb1f[_0x7538('0x23')];this[_0x7538('0x24')]=_0x4ffb1f[_0x7538('0x24')];this[_0x7538('0x25')]=config[_0x7538('0x25')]||0x2;this[_0x7538('0x26')]={};this[_0x7538('0x27')]={};this[_0x7538('0x28')]={};this[_0x7538('0x29')]={};this[_0x7538('0x2a')]={};this[_0x7538('0x2b')]={};this[_0x7538('0x2c')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x7538('0x2d')]={};ami['on'](_0x7538('0x2e'),this[_0x7538('0x2f')][_0x7538('0x30')](this));ami['on'](_0x7538('0x31'),this[_0x7538('0x32')][_0x7538('0x30')](this));ami['on'](_0x7538('0x33'),this[_0x7538('0x34')]['bind'](this));ami['on'](_0x7538('0x35'),this[_0x7538('0x36')]['bind'](this));ami['on'](_0x7538('0x37'),this[_0x7538('0xb')][_0x7538('0x30')](this));ami['on'](_0x7538('0x38'),this[_0x7538('0x39')]['bind'](this));ami['on'](_0x7538('0x3a'),this[_0x7538('0x3b')]['bind'](this));ami['on'](_0x7538('0x3c'),this[_0x7538('0x3d')]['bind'](this));ami['on'](_0x7538('0x3e'),this[_0x7538('0x3f')][_0x7538('0x30')](this));ami['on'](_0x7538('0x40'),this['syncQueueStatusComplete'][_0x7538('0x30')](this));this[_0x7538('0x41')]();this['loopClearZombieChannels']();}function isNotNull(_0x2e1521){return _0x2e1521!==null&&!_[_0x7538('0x42')](_0x2e1521);}function checkIsLoggedIn(_0x126ea7,_0x4dc3fb){return function(){if(_0x4dc3fb<=0x0){_0x126ea7[_0x7538('0x43')]='AGENTS_NOT_LOGGED';throw _0x126ea7['name']+_0x7538('0x44');}};}function isActive(_0x514848){return _0x514848;}function checkIsActive(_0x284774,_0x440cae){return function(){if(!isActive(_0x440cae)){_0x284774[_0x7538('0x43')]=_0x7538('0x45');throw _0x284774['name']+_0x7538('0x46');}};}function checkInterval(_0x1b1508){return function(){if(!isNotNull(_0x1b1508[_0x7538('0x47')])){_0x1b1508[_0x7538('0x43')]=_0x7538('0x48');throw _0x1b1508[_0x7538('0x49')]+_0x7538('0x4a');}if(!isNotNull(_0x1b1508[_0x7538('0x47')][_0x7538('0x4b')])){_0x1b1508['message']='INTERVAL_IS_NULL';throw _0x1b1508['name']+_0x7538('0x4a');}if(!isNotNull(_['isEmpty'](_0x1b1508[_0x7538('0x47')][_0x7538('0x4b')]))){_0x1b1508[_0x7538('0x43')]=_0x7538('0x48');throw _0x1b1508[_0x7538('0x49')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x440ab9,_0x2f23eb,_0x50b161){return{'action':_0x440ab9,'response':_0x2f23eb,'message':_0x50b161,'stack':_0x50b161};}function myreject(_0xf768e9){return function(_0x44a9a1){return _0xf768e9(msgResponse('[ifTime][Action]','Error',JSON[_0x7538('0x4c')](_0x44a9a1)));};}function getSeconds(_0x49392f,_0x35ec9a){var _0x5dce3e=moment(_0x49392f)['milliseconds'](0x0);var _0x4bf9cf=moment(_0x35ec9a)[_0x7538('0x4d')](0x0);return _0x5dce3e['diff'](_0x4bf9cf,_0x7538('0x4e'));}function emit(_0x255891,_0x5948b6,_0x11edd3){io['to'](_0x255891)[_0x7538('0x4f')](_0x5948b6,_0x11edd3);}function emitVoiceQueueSummary(_0x8e75f7){if(_0x8e75f7[_0x7538('0x50')]===_0x7538('0x51')){var _0x363b33={'id':_0x8e75f7['id'],'name':_0x8e75f7[_0x7538('0x49')],'strategy':_0x8e75f7[_0x7538('0x52')],'answered':_0x8e75f7[_0x7538('0x53')],'available':_0x8e75f7['available'],'loggedIn':_0x8e75f7[_0x7538('0x54')],'pTalking':_0x8e75f7['pTalking'],'sumBillable':_0x8e75f7[_0x7538('0x55')],'sumDuration':_0x8e75f7[_0x7538('0x56')],'sumHoldTime':_0x8e75f7[_0x7538('0x57')]||0x0,'talking':_0x8e75f7[_0x7538('0x58')],'total':_0x8e75f7['total'],'type':_0x8e75f7[_0x7538('0x50')],'unmanaged':_0x8e75f7[_0x7538('0x59')],'abandoned':_0x8e75f7[_0x7538('0x5a')],'waiting':_0x8e75f7[_0x7538('0x5b')],'loggedInDb':_0x8e75f7[_0x7538('0x5c')],'dialActive':_0x8e75f7[_0x7538('0x5d')],'dialMethod':_0x8e75f7['dialMethod'],'dialOriginateCallerIdName':_0x8e75f7[_0x7538('0x5e')],'dialOriginateCallerIdNumber':_0x8e75f7[_0x7538('0x5f')],'dialOriginateTimeout':_0x8e75f7[_0x7538('0x60')],'dialPrefix':_0x8e75f7[_0x7538('0x61')],'outboundAnswerAgiCallsDay':_0x8e75f7[_0x7538('0x62')],'outboundAnswerCallsDay':_0x8e75f7[_0x7538('0x63')],'outboundBlacklistCallsDay':_0x8e75f7[_0x7538('0x64')],'outboundBusyCallsDay':_0x8e75f7['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x8e75f7[_0x7538('0x65')],'outboundDropCallsDayACS':_0x8e75f7[_0x7538('0x66')],'outboundDropCallsDayCallersExit':_0x8e75f7['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x8e75f7[_0x7538('0x67')],'outboundNoAnswerCallsDay':_0x8e75f7[_0x7538('0x68')],'outboundNoSuchCallsDay':_0x8e75f7[_0x7538('0x69')],'outboundOriginateFailureCallsDay':_0x8e75f7[_0x7538('0x6a')],'outboundReCallsDay':_0x8e75f7[_0x7538('0x6b')],'outboundRejectCallsDay':_0x8e75f7[_0x7538('0x6c')],'outboundUnknownCallsDay':_0x8e75f7[_0x7538('0x6d')],'predictiveIntervalAnsweredCalls':_0x8e75f7[_0x7538('0x6e')],'predictiveIntervalAvgHoldtime':_0x8e75f7['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x8e75f7[_0x7538('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x8e75f7[_0x7538('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x8e75f7[_0x7538('0x71')],'predictiveIntervalErlangCalls':_0x8e75f7['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x8e75f7[_0x7538('0x72')],'predictiveIntervalHitRate':_0x8e75f7[_0x7538('0x73')],'predictiveIntervalMultiplicativeFactor':_0x8e75f7[_0x7538('0x74')],'predictiveIntervalPauses':_0x8e75f7[_0x7538('0x75')],'predictiveIntervalAvailable':_0x8e75f7[_0x7538('0x76')],'predictiveIntervalTotalCalls':_0x8e75f7['predictiveIntervalTotalCalls'],'message':_0x8e75f7[_0x7538('0x43')],'originated':_0x8e75f7[_0x7538('0x77')],'erlangCalls':_0x8e75f7[_0x7538('0x78')],'erlangCallToSecond':_0x8e75f7[_0x7538('0x79')],'erlangAbandonmentRate':_0x8e75f7[_0x7538('0x7a')],'erlangBusyFactor':_0x8e75f7[_0x7538('0x7b')],'startPredictive':_0x8e75f7['startPredictive'],'startProgressive':_0x8e75f7[_0x7538('0x2c')]};if(_0x8e75f7[_0x7538('0x7c')]){_0x363b33['Trunk']={'id':_0x8e75f7['Trunk']['id'],'name':_0x8e75f7[_0x7538('0x7c')][_0x7538('0x49')],'active':_0x8e75f7[_0x7538('0x7c')][_0x7538('0x7d')],'callerid':_0x8e75f7[_0x7538('0x7c')][_0x7538('0x7e')]};}if(_0x8e75f7[_0x7538('0x47')]){_0x363b33[_0x7538('0x47')]={'id':_0x8e75f7['Interval']['id'],'name':_0x8e75f7[_0x7538('0x47')][_0x7538('0x49')]};}var _0x50693a=md5(JSON[_0x7538('0x4c')](_0x363b33));if(_0x8e75f7[_0x7538('0x2')]!==_0x50693a){_0x8e75f7[_0x7538('0x2')]=_0x50693a;emit(util['format'](_0x7538('0x7f'),_0x363b33['name']),'voice_queue:save',_0x363b33);}}}function emitCampaignSummary(_0x336cd8){if(_0x336cd8[_0x7538('0x50')]===_0x7538('0x80')){emit(util[_0x7538('0x81')](_0x7538('0x82'),_0x336cd8[_0x7538('0x49')]),_0x7538('0x83'),_0x336cd8);}}function checkGetDataPredictive(_0x4f2e7e){if(isNotNull(_0x4f2e7e)&&!_[_0x7538('0x84')](_0x4f2e7e)){loggerPredictive[_0x7538('0x85')](_0x7538('0x86'));loggerPredictive[_0x7538('0x85')](_0x7538('0x87'),_0x4f2e7e[_0x7538('0x88')]);loggerPredictive[_0x7538('0x85')](_0x7538('0x89'),_0x4f2e7e[_0x7538('0x6e')]);loggerPredictive[_0x7538('0x85')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4f2e7e[_0x7538('0x71')]);loggerPredictive['info'](_0x7538('0x8a'),_0x4f2e7e[_0x7538('0x70')]);loggerPredictive[_0x7538('0x85')](_0x7538('0x8b'),_0x4f2e7e[_0x7538('0x8c')]);loggerPredictive[_0x7538('0x85')](_0x7538('0x8d'),_0x4f2e7e['predictiveIntervalAvgTalktime']);loggerPredictive[_0x7538('0x85')](_0x7538('0x8e'));if(_0x4f2e7e[_0x7538('0x88')]>0x0){if(!_[_0x7538('0x42')](_0x4f2e7e[_0x7538('0x6f')])&&_0x4f2e7e[_0x7538('0x6f')]>0x0){return!![];}loggerPredictive[_0x7538('0x85')](_0x7538('0x8f'));if(!_[_0x7538('0x42')](_0x4f2e7e[_0x7538('0x8c')])&&_0x4f2e7e[_0x7538('0x8c')]>0x0){return!![];}loggerPredictive[_0x7538('0x85')](_0x7538('0x90'));}else{loggerPredictive[_0x7538('0x85')](_0x7538('0x91'));}}else{loggerPredictive['info'](_0x7538('0x92'));}return![];}function mergeDataErlangB(_0x338f89){return function(_0x384896){loggerPredictive['info'](_0x7538('0x93'));loggerPredictive[_0x7538('0x85')](_0x7538('0x94'),_0x384896[_0x7538('0x78')]);loggerPredictive[_0x7538('0x85')](_0x7538('0x95'),_0x384896[_0x7538('0x79')]);loggerPredictive[_0x7538('0x85')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x384896['erlangAbandonmentRate']);loggerPredictive['info'](_0x7538('0x96'),_0x384896[_0x7538('0x7b')]);loggerPredictive[_0x7538('0x85')](_0x7538('0x97'),_0x384896[_0x7538('0x7a')]);loggerPredictive[_0x7538('0x85')]('---------------------------');_[_0x7538('0x98')](_0x338f89,_0x384896);};}function getDiff(_0x5268e5){var _0x1c9f04=moment()[_0x7538('0x4d')](0x0);var _0x20a7ad=moment(_0x5268e5)['milliseconds'](0x0);return _0x1c9f04[_0x7538('0x99')](_0x20a7ad,_0x7538('0x4e'));}function ifInterval(_0x5574fa,_0x2b8f08){if(_['isUndefined'](_0x2b8f08)){return![];}return getDiff(_0x2b8f08)<_0x5574fa*0x3c;}function freeVariablesPredictive(_0xfbea9){if(isNotNull(_0xfbea9)){if(!_['isUndefined'](_0xfbea9[_0x7538('0x2c')])){_0xfbea9[_0x7538('0x2c')]=undefined;loggerPredictive[_0x7538('0x85')](_0xfbea9[_0x7538('0x49')],_0x7538('0x9a'));}if(!_['isUndefined'](_0xfbea9[_0x7538('0x2b')])){_0xfbea9[_0x7538('0x2b')]=undefined;loggerPredictive[_0x7538('0x85')](_0xfbea9['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x7538('0x42')](_0xfbea9[_0x7538('0x9b')])){clearInterval(_0xfbea9[_0x7538('0x9b')]);_0xfbea9[_0x7538('0x9b')]=undefined;loggerPredictive['info'](_0xfbea9[_0x7538('0x49')],_0x7538('0x9c'));}}}function erlangb(_0x11ea92,_0x2eae71){if(_0x2eae71===0x0){return 0x0;}var _0x4a01bc=0x1;for(var _0x28198c=0x1;_0x28198c<=_0x2eae71;_0x28198c+=0x1){_0x4a01bc=0x1+_0x4a01bc*_0x28198c/_0x11ea92;}return 0x1/_0x4a01bc;}function isVoiceQueueOutbound(_0x526882){return _0x526882===_0x7538('0x51');}function isNotPreview(_0x5a1107){return _0x5a1107!=='preview';}function isCampaignIvr(_0x542d5f){return _0x542d5f===_0x7538('0x80');}function getCallerId(_0x2d7797,_0x2bc44c,_0x337bc4){if(!_[_0x7538('0x42')](_0x337bc4)&&typeof _0x337bc4===_0x7538('0x9d')&&!_[_0x7538('0x84')](_0x337bc4)){if(!_[_0x7538('0x42')](_0x2bc44c)&&typeof _0x2bc44c===_0x7538('0x9d')&&!_[_0x7538('0x84')](_0x2bc44c)){return util[_0x7538('0x81')](_0x7538('0x9e'),_0x2bc44c,_0x337bc4);}return util[_0x7538('0x81')](_0x7538('0x9e'),_0x337bc4,_0x337bc4);}if(!_[_0x7538('0x42')](_0x2d7797)&&typeof _0x2d7797===_0x7538('0x9d')&&!_['isEmpty'](_0x2d7797)){return _0x2d7797;}return _0x7538('0x9f');}function loggerCatchQueueSummary(_0x3f35b7,_0x43ce7c){return function(_0x33c5d2){freeVariablesPredictive(_0x43ce7c);emitVoiceQueueSummary(_0x43ce7c);emitCampaignSummary(_0x43ce7c);loggerSyncQueueSummary[_0x7538('0xa0')](_0x3f35b7,util['inspect'](_0x33c5d2,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x19d0a1,_0x133066){return function(_0x1b5d57){loggerPredictive[_0x7538('0xa0')](_0x133066[_0x7538('0x49')],_0x19d0a1);loggerPredictive[_0x7538('0xa0')](_0x1b5d57[_0x7538('0xa1')]);freeVariablesPredictive(_0x133066);};}function loggerCatch(_0x2c2c40){return function(_0x4e113f){logger['error'](_0x2c2c40,util[_0x7538('0xa2')](_0x4e113f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x6a1355){return _0x6a1355&&!_[_0x7538('0x42')](_0x6a1355)&&_0x6a1355['length']>0x0;}function decremetOriginate(_0x474cbd){if(!_[_0x7538('0x42')](_0x474cbd)&&_0x474cbd!==null){if(typeof _0x474cbd[_0x7538('0x77')]!==_0x7538('0xa3')){if(_0x474cbd[_0x7538('0x77')]>0x0){_0x474cbd[_0x7538('0x77')]-=0x1;}else{logger[_0x7538('0xa0')](_0x7538('0xa4'));}}}else{logger[_0x7538('0xa0')](_0x7538('0xa5'));}}function checkContactLowerLimitOriginate(_0x5ab019,_0x170e25,_0x38ad4c){if(_0x170e25>_0x38ad4c){for(var _0x1c2fa8=0x0;_0x1c2fa8<_0x170e25-_0x38ad4c;_0x1c2fa8+=0x1){decremetOriginate(_0x5ab019);}}}function loggerGetContactDialer(_0xb3749f,_0x5aba55,_0x3fd2cd){return function(_0x30f869){checkContactLowerLimitOriginate(_0x5aba55,_0x3fd2cd,0x0);logger[_0x7538('0xa0')](_0xb3749f,util[_0x7538('0xa2')](_0x30f869,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3c31dc){return function(_0x112d71){if(isNotNull(_0x112d71)&&isNotNull(_0x112d71[0x0])){if(_0x112d71[0x0][_0x7538('0xa6')]>0x0){_0x3c31dc[_0x7538('0x43')]=_0x7538('0xa7');logger[_0x7538('0x85')](_0x7538('0xa8')+_0x3c31dc[_0x7538('0x49')],_0x112d71[0x0][_0x7538('0xa6')],'contacts');}else{_0x3c31dc[_0x7538('0x43')]=_0x7538('0xa9');logger[_0x7538('0x85')](_0x7538('0xaa')+_0x3c31dc[_0x7538('0x49')]);}}};}function notSendMessagesQueue(_0x52702f){if(_0x52702f[_0x7538('0xab')]){freeVariablesPredictive(_0x52702f);if(_0x52702f[_0x7538('0x77')]===0x0&&_0x52702f[_0x7538('0x58')]===0x0&&_0x52702f[_0x7538('0x5b')]===0x0&&(_0x52702f[_0x7538('0xac')]||0x0)===0x0){_0x52702f[_0x7538('0xab')]=![];_0x52702f[_0x7538('0xad')]=0x0;_0x52702f['message']=_0x7538('0x45');loggerSyncQueueSummary[_0x7538('0xa0')](_0x7538('0xae'),_0x52702f['name'],_0x7538('0xaf'));}else{_0x52702f[_0x7538('0x43')]=_0x7538('0xb0');loggerSyncQueueSummary[_0x7538('0xa0')](_0x7538('0xae'),_0x52702f[_0x7538('0x49')],_0x7538('0xb1'));}emitVoiceQueueSummary(_0x52702f);}}function notSendMessagesCampaign(_0x2dbe90){if(_0x2dbe90[_0x7538('0xab')]){if(_0x2dbe90[_0x7538('0x77')]===0x0){_0x2dbe90[_0x7538('0xab')]=![];_0x2dbe90[_0x7538('0x43')]=_0x7538('0x45');loggerSyncQueueSummary[_0x7538('0xa0')](_0x7538('0xb2'),_0x2dbe90['name'],_0x7538('0xaf'));}else{_0x2dbe90[_0x7538('0x43')]=_0x7538('0xb0');loggerSyncQueueSummary['error'](_0x7538('0xb2'),_0x2dbe90['name'],'is\x20disactive');}emitCampaignSummary(_0x2dbe90);}}function createObjHistory(_0x15c1b6,_0x445403,_0x3c61f7,_0x16d21d,_0x118c14){_0x15c1b6[_0x7538('0x43')]=_0x3c61f7;var _0x2a7e58=new Action(_0x15c1b6,_0x445403);var _0x47024a=new History(_0x2a7e58);_0x47024a['state']=_0x16d21d;_0x47024a[_0x7538('0xb3')]=_0x118c14;_0x47024a[_0x7538('0xb4')]=_0x2a7e58[_0x7538('0xb5')];return _0x47024a;}Dialer['prototype'][_0x7538('0xb6')]=function(){var _0x561f19=this;setInterval(function(){_0x561f19[_0x7538('0xb7')](_0x561f19['uniqueId'],'[uniqueid]');_0x561f19[_0x7538('0xb7')](_0x561f19[_0x7538('0x27')],'[actions]');},0x32c8);};Dialer[_0x7538('0xb8')][_0x7538('0xb7')]=function(_0x4bc304,_0x49f8e6){var _0x3bf2b7=this;for(var _0x551134 in _0x4bc304){if(typeof _0x4bc304[_0x551134]!=='undefined'){this[_0x7538('0x1f')][_0x7538('0x1c')](function(){if(!_[_0x7538('0xb9')](_0x4bc304[_0x551134])){return ami[_0x7538('0xba')]({'action':'status','channel':_0x4bc304[_0x551134][_0x7538('0xbb')]})[_0x7538('0xbc')](function(_0x2b94ef){if(_0x2b94ef['message']===_0x7538('0xbd')){setTimeout(function(){if(_0x4bc304[_0x551134]&&_0x4bc304[_0x551134][_0x7538('0x50')]!==_0x7538('0x80')){_0x3bf2b7[_0x7538('0xbe')](_0x3bf2b7['voiceQueues'][_0x4bc304[_0x551134][_0x7538('0xbf')]]);logger['error'](_0x7538('0xc0'),_0x49f8e6,_0x551134,_0x4bc304[_0x551134][_0x7538('0xbf')]);delete _0x4bc304[_0x551134];}if(_0x4bc304[_0x551134]&&_0x4bc304[_0x551134][_0x7538('0x50')]==='ivr'){_0x3bf2b7[_0x7538('0xbe')](_0x3bf2b7['campaigns'][_0x4bc304[_0x551134][_0x7538('0xbf')]]);logger[_0x7538('0xa0')]('[Dialer][checkChannel][ivr]',_0x49f8e6,_0x551134,_0x4bc304[_0x551134][_0x7538('0xbf')]);delete _0x4bc304[_0x551134];}},0x2328);}});}});}}};Dialer[_0x7538('0xb8')][_0x7538('0xc1')]=function(_0x45030a){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](cmHopper[_0x7538('0xc1')](_0x45030a))[_0x7538('0xbc')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x7538('0xb8')][_0x7538('0xc4')]=function(_0x5e5826){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](cmHopperBlack['checkIsBlackList'](_0x5e5826))[_0x7538('0xbc')](loggerCatch(_0x7538('0xc5')));};Dialer[_0x7538('0xb8')][_0x7538('0xc6')]=function(_0x184a34,_0x534224,_0x476995){return BPromise[_0x7538('0xc2')]()['then'](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x184a34,_0x534224,_0x476995))[_0x7538('0xbc')](loggerCatch(_0x7538('0xc7')));};Dialer[_0x7538('0xb8')][_0x7538('0xc8')]=function(_0x56551b,_0x57b97e,_0xdbb091){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](cmHopperAdditionalPhone[_0x7538('0xc8')](_0x56551b,_0x57b97e,_0xdbb091))[_0x7538('0xbc')](loggerCatch(_0x7538('0xc9')));};Dialer[_0x7538('0xb8')][_0x7538('0xca')]=function(_0x14a31c){return BPromise['resolve']()['then'](cmHopperBlack[_0x7538('0xca')](_0x14a31c))[_0x7538('0xbc')](loggerCatch(_0x7538('0xcb')));};Dialer[_0x7538('0xb8')]['averageHandleTime']=function(_0x3eb1f7){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](cmHopperHistory['avgHandleTime'](_0x3eb1f7))['catch'](loggerCatch(_0x7538('0xcc')));};Dialer[_0x7538('0xb8')][_0x7538('0xcd')]=function(_0x291f5c){return BPromise['resolve']()[_0x7538('0xc3')](cmHopper[_0x7538('0xcd')](_0x291f5c))[_0x7538('0xbc')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x7538('0xb8')][_0x7538('0xce')]=function(_0x297683,_0x575c46,_0x2c8779){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](cmHopper[_0x7538('0xce')](_0x297683,_0x575c46,_0x2c8779))[_0x7538('0xbc')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x7538('0xb8')][_0x7538('0xcf')]=function(_0x51b2c2,_0x16f8b7,_0xc62ebe,_0x24d791){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](cmHopper['getContactDialer'](_0x51b2c2,_0x16f8b7,_0xc62ebe,_0x24d791))[_0x7538('0xbc')](loggerCatch(_0x7538('0xd0')));};Dialer[_0x7538('0xb8')][_0x7538('0xd1')]=function(_0x5149f7,_0x399072,_0x56aa11){return BPromise['resolve']()['then'](cmHopper['getContactDialerIvr'](_0x5149f7,_0x399072,_0x56aa11))[_0x7538('0xbc')](loggerCatch(_0x7538('0xd0')));};Dialer[_0x7538('0xb8')][_0x7538('0xd2')]=function(_0x2c7b30){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](voiceQueueRt[_0x7538('0xd2')](_0x2c7b30))['catch'](loggerCatch(_0x7538('0xd3')));};Dialer[_0x7538('0xb8')][_0x7538('0xd4')]=function(_0xe96e7f){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](cmHopper[_0x7538('0xd4')](_0xe96e7f))[_0x7538('0xbc')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x7538('0xb8')][_0x7538('0xd5')]=function(_0x23eec3){return BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](cmHopperHistory[_0x7538('0xd5')](_0x23eec3))[_0x7538('0xbc')](loggerCatch(_0x7538('0xd6')));};Dialer['prototype'][_0x7538('0xbe')]=function(_0x1cb70c){if(!_['isUndefined'](_0x1cb70c)&&_0x1cb70c!==null){if(typeof _0x1cb70c[_0x7538('0x77')]!==_0x7538('0xa3')){if(_0x1cb70c[_0x7538('0x77')]>0x0){_0x1cb70c[_0x7538('0x77')]-=0x1;}else{logger[_0x7538('0xa0')](_0x7538('0xd7'));}}}else{logger[_0x7538('0xa0')](_0x7538('0xd8'));}};Dialer[_0x7538('0xb8')][_0x7538('0xd9')]=function(_0x2d16f8,_0x38156e){var _0x397f76=this;return function(_0x184bc3){_0x397f76['updateOriginated'](_0x38156e);logger['error'](_0x2d16f8,util[_0x7538('0xa2')](_0x184bc3,{'showHidden':![],'depth':null}));};};Dialer[_0x7538('0xb8')][_0x7538('0xda')]=function(_0x56bafb,_0x230d48,_0x393986){var _0x21d8f2={'state':0x19,'statedesc':_0x7538('0xdb')};this[_0x7538('0xbe')](_0x230d48);this[_0x7538('0xdc')](_[_0x7538('0x98')](_0x21d8f2,_[_0x7538('0xdd')](_0x393986,[_0x7538('0xde'),'ListId',_0x7538('0xdf'),_0x7538('0xe0'),_0x7538('0xe1')])),_0x7538('0xe2'),_0x7538('0xe3'));logger[_0x7538('0xa0')](_0x56bafb);};Dialer[_0x7538('0xb8')][_0x7538('0xe4')]=function(_0x46242c){return _0x46242c===_0x7538('0xe5');};Dialer[_0x7538('0xb8')][_0x7538('0xe6')]=function(_0x162bd4){return!_['isUndefined'](_0x162bd4)&&_0x162bd4&&!_[_0x7538('0x42')](_0x162bd4[_0x7538('0x49')])&&!_[_0x7538('0x42')](_0x162bd4['active'])&&_0x162bd4[_0x7538('0x7d')]&&(this[_0x7538('0x24')][util['format'](_0x7538('0xe7'),_0x162bd4['name'])][_0x7538('0xe8')]===_0x7538('0xe9')||this[_0x7538('0x24')][util[_0x7538('0x81')](_0x7538('0xe7'),_0x162bd4[_0x7538('0x49')])]['status']===_0x7538('0xea'));};Dialer[_0x7538('0xb8')][_0x7538('0xdc')]=function(_0x2a579e,_0xfe7f6d,_0x26e981){this[_0x7538('0xd5')](_0x2a579e)[_0x7538('0xbc')](loggerCatch(_0xfe7f6d));this[_0x7538('0xd4')](_0x2a579e)[_0x7538('0xbc')](loggerCatch(_0x26e981));};Dialer[_0x7538('0xb8')][_0x7538('0x3d')]=function(_0x56b835){var _0x3db87e=this[_0x7538('0x29')][_0x56b835[_0x7538('0xeb')]];var _0x33472e;if(!_[_0x7538('0xb9')](_0x56b835)&&!_['isNil'](_0x56b835[_0x7538('0xec')])&&!_[_0x7538('0xb9')](_0x56b835[_0x7538('0xec')]['amdstatus'])&&_0x56b835[_0x7538('0xed')]==='xcally-motion-dialer'&&_0x3db87e){if(_0x3db87e[_0x7538('0x50')]!=='ivr'&&this[_0x7538('0x21')][_0x3db87e[_0x7538('0xbf')]][_0x7538('0xee')]&&_0x56b835[_0x7538('0xef')]===_0x7538('0xf0')){delete this['uniqueId'][_0x56b835['uniqueid']];this['updateOriginated'](this[_0x7538('0x21')][_0x3db87e[_0x7538('0xbf')]]);this['voiceQueues'][_0x3db87e[_0x7538('0xbf')]][_0x7538('0x63')]+=0x1;this[_0x7538('0x21')][_0x3db87e[_0x7538('0xbf')]]['outboundAnswerAgiCallsDay']+=0x1;_0x33472e=new Hangup(_0x3db87e,_0x56b835);_0x33472e[_0x7538('0xf1')]=0x12;_0x33472e[_0x7538('0xb3')]=_0x7538('0xf2');_0x33472e[_0x7538('0xf3')]='AMD';this[_0x7538('0xdc')](_0x33472e,_0x7538('0xf4'),_0x7538('0xf5'));}if(_0x3db87e[_0x7538('0x50')]!==_0x7538('0x80')&&this[_0x7538('0x21')][_0x3db87e[_0x7538('0xbf')]][_0x7538('0xee')]&&_0x56b835[_0x7538('0xef')]==='MACHINE'){var _0x10ef59=this;return new BPromise(function(_0x48df0f,_0x4243bf){delete _0x10ef59[_0x7538('0x29')][_0x56b835[_0x7538('0xeb')]];_0x10ef59[_0x7538('0xbe')](_0x10ef59[_0x7538('0x21')][_0x3db87e[_0x7538('0xbf')]]);_0x10ef59['voiceQueues'][_0x3db87e['queue']][_0x7538('0x63')]+=0x1;_0x10ef59[_0x7538('0x21')][_0x3db87e[_0x7538('0xbf')]][_0x7538('0x62')]+=0x1;var _0x46e767=_0x10ef59[_0x7538('0x21')][_0x3db87e[_0x7538('0xbf')]];var _0x3cebfc=new Hangup(_0x3db87e,_0x56b835);_0x3cebfc[_0x7538('0xf1')]=0x13;_0x3cebfc['statedesc']=_0x7538('0xf6');_0x3cebfc['membername']='AMD';_0x3cebfc[_0x7538('0xf7')]+=0x1;_0x3cebfc[_0x7538('0xf8')]+=0x1;_0x3cebfc[_0x7538('0xf9')]=!![];_0x10ef59['createHistory'](_0x3cebfc)[_0x7538('0xbc')](loggerCatch(_0x7538('0xfa')));if(_0x3cebfc['countbusyretry']+_0x3cebfc[_0x7538('0xfb')]+_0x3cebfc[_0x7538('0xfc')]+_0x3cebfc['countnosuchnumberretry']+_0x3cebfc[_0x7538('0xfd')]+_0x3cebfc[_0x7538('0xfe')]+_0x3cebfc[_0x7538('0xf7')]+_0x3cebfc[_0x7538('0xff')]>=_0x46e767[_0x7538('0x100')]){_0x10ef59[_0x7538('0x101')](_0x3cebfc,_0x48df0f,_0x4243bf,'reason19\x20machine....');}else{if(_0x3cebfc['countmachineretry']>=_0x46e767[_0x7538('0x102')]){_0x10ef59[_0x7538('0x103')](_0x3cebfc,_0x48df0f,_0x4243bf,'reason\x2019\x20machine....');}else{_0x10ef59[_0x7538('0xcd')]({'active':![],'countmachineretry':_0x3cebfc[_0x7538('0xf7')],'scheduledat':moment()[_0x7538('0x104')](_0x46e767[_0x7538('0x105')],_0x7538('0x106'))[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0x3cebfc[_0x7538('0xde')],'ListId':_0x3cebfc[_0x7538('0x108')],'VoiceQueueId':_0x3cebfc[_0x7538('0xe0')]||undefined,'CampaignId':_0x3cebfc[_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch('[rescheduleContact][Machine]'));_0x48df0f({'reschedule':0x1});}}});}if(_0x3db87e[_0x7538('0x50')]===_0x7538('0x80')&&this[_0x7538('0x22')][_0x3db87e[_0x7538('0xbf')]][_0x7538('0xee')]&&_0x56b835['value']===_0x7538('0xf0')){delete this[_0x7538('0x29')][_0x56b835[_0x7538('0xeb')]];this[_0x7538('0xbe')](this[_0x7538('0x22')][_0x3db87e[_0x7538('0xbf')]]);_0x33472e=new Hangup(_0x3db87e,_0x56b835);_0x33472e[_0x7538('0xf1')]=0x12;_0x33472e[_0x7538('0xb3')]=_0x7538('0xf2');_0x33472e[_0x7538('0xf3')]=_0x7538('0x109');this[_0x7538('0xdc')](_0x33472e,_0x7538('0x10a'),_0x7538('0x10b'));}if(_0x3db87e[_0x7538('0x50')]==='ivr'&&this[_0x7538('0x22')][_0x3db87e[_0x7538('0xbf')]]['dialAMDActive']&&_0x56b835['value']===_0x7538('0x10c')){var _0x10ef59=this;return new BPromise(function(_0xda85eb,_0x12c3f0){delete _0x10ef59[_0x7538('0x29')][_0x56b835[_0x7538('0xeb')]];_0x10ef59['updateOriginated'](_0x10ef59[_0x7538('0x22')][_0x3db87e['queue']]);_0x10ef59[_0x7538('0x22')][_0x3db87e[_0x7538('0xbf')]][_0x7538('0x63')]+=0x1;_0x10ef59[_0x7538('0x22')][_0x3db87e[_0x7538('0xbf')]][_0x7538('0x62')]+=0x1;var _0x31d0e2=_0x10ef59['campaigns'][_0x3db87e['queue']];var _0x4670fc=new Hangup(_0x3db87e,_0x56b835);_0x4670fc[_0x7538('0xf1')]=0x13;_0x4670fc['statedesc']=_0x7538('0xf6');_0x4670fc[_0x7538('0xf3')]=_0x7538('0x109');_0x4670fc['countmachineretry']+=0x1;_0x4670fc[_0x7538('0xf8')]+=0x1;_0x4670fc['amd']=!![];_0x10ef59[_0x7538('0xd5')](_0x4670fc)[_0x7538('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4670fc[_0x7538('0x10d')]+_0x4670fc[_0x7538('0xfb')]+_0x4670fc[_0x7538('0xfc')]+_0x4670fc[_0x7538('0x10e')]+_0x4670fc[_0x7538('0xfd')]+_0x4670fc[_0x7538('0xfe')]+_0x4670fc['countmachineretry']+_0x4670fc[_0x7538('0xff')]>=_0x31d0e2['dialGlobalMaxRetry']){_0x10ef59[_0x7538('0x101')](_0x4670fc,_0xda85eb,_0x12c3f0,_0x7538('0x10f'));}else{if(_0x4670fc['countmachineretry']>=_0x31d0e2[_0x7538('0x102')]){_0x10ef59[_0x7538('0x103')](_0x4670fc,_0xda85eb,_0x12c3f0,_0x7538('0x110'));}else{_0x10ef59['rescheduleContact']({'active':![],'countmachineretry':_0x4670fc[_0x7538('0xf7')],'scheduledat':moment()[_0x7538('0x104')](_0x31d0e2[_0x7538('0x105')],_0x7538('0x106'))[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0x4670fc[_0x7538('0xde')],'ListId':_0x4670fc[_0x7538('0x108')],'VoiceQueueId':_0x4670fc[_0x7538('0xe0')]||undefined,'CampaignId':_0x4670fc[_0x7538('0xe1')]||undefined})['catch'](loggerCatch(_0x7538('0x111')));_0xda85eb({'reschedule':0x1});}}});}}};Dialer[_0x7538('0xb8')][_0x7538('0x39')]=function(_0x2e099f){var _0x1157f1=this[_0x7538('0x29')][_0x2e099f[_0x7538('0xeb')]];var _0x3b815d=this;var _0x109a77;if(_0x1157f1&&_0x1157f1[_0x7538('0x50')]===_0x7538('0x80')){delete this['uniqueId'][_0x2e099f[_0x7538('0xeb')]];this[_0x7538('0xbe')](this[_0x7538('0x22')][_0x1157f1[_0x7538('0xbf')]]);this['campaigns'][_0x1157f1[_0x7538('0xbf')]]['ivrAnswerCallsDay']+=0x1;_0x109a77=new Hangup(_0x1157f1,_0x2e099f);this[_0x7538('0xd5')](_0x109a77)[_0x7538('0xbc')](loggerCatch(_0x7538('0x112')));this[_0x7538('0xd4')](_0x109a77)['catch'](loggerCatch(_0x7538('0x113')));}if(_0x1157f1&&_0x1157f1[_0x7538('0x50')]!==_0x7538('0x80')&&isNotNull(this['voiceQueues'][_0x1157f1['queue']][_0x7538('0x114')])){delete this['uniqueId'][_0x2e099f[_0x7538('0xeb')]];this[_0x7538('0xbe')](this[_0x7538('0x21')][_0x1157f1[_0x7538('0xbf')]]);this[_0x7538('0x21')][_0x1157f1[_0x7538('0xbf')]][_0x7538('0x63')]+=0x1;this[_0x7538('0x21')][_0x1157f1['queue']][_0x7538('0x62')]+=0x1;_0x109a77=new Hangup(_0x1157f1,_0x2e099f);_0x109a77[_0x7538('0xf1')]=0x10;_0x109a77[_0x7538('0xb3')]='AnswerAGI';_0x109a77[_0x7538('0xf3')]=_0x7538('0x115');this[_0x7538('0xd5')](_0x109a77)['catch'](loggerCatch(_0x7538('0x112')));this['moveContactManagedDialer'](_0x109a77)['catch'](loggerCatch(_0x7538('0x113')));}if(_0x1157f1&&_0x1157f1['type']!==_0x7538('0x80')&&!isNotNull(this[_0x7538('0x21')][_0x1157f1[_0x7538('0xbf')]][_0x7538('0x114')])){delete this[_0x7538('0x29')][_0x2e099f['uniqueid']];this['updateOriginated'](this[_0x7538('0x21')][_0x1157f1[_0x7538('0xbf')]]);this[_0x7538('0x21')][_0x1157f1['queue']][_0x7538('0x6d')]+=0x1;_0x109a77=new Hangup(_0x1157f1,_0x2e099f);_0x109a77[_0x7538('0xf1')]=0xc;_0x109a77[_0x7538('0xb3')]=_0x2e099f['cause-txt'];_0x109a77[_0x7538('0xf3')]=_0x7538('0x116');this[_0x7538('0xd5')](_0x109a77)[_0x7538('0xbc')](loggerCatch(_0x7538('0x112')));this[_0x7538('0xd4')](_0x109a77)[_0x7538('0xbc')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x7538('0xb8')]['syncAgentComplete']=function(_0x1ca0bb){var _0x2dbd90=this[_0x7538('0x29')][_0x1ca0bb[_0x7538('0xeb')]];var _0x48917f=this;if(this[_0x7538('0x21')][_0x1ca0bb[_0x7538('0xbf')]]){if(_0x2dbd90&&_0x2dbd90[_0x7538('0x50')]!==_0x7538('0x80')){delete this['uniqueId'][_0x1ca0bb[_0x7538('0xeb')]];this[_0x7538('0x21')][_0x1ca0bb[_0x7538('0xbf')]][_0x7538('0x63')]+=0x1;var _0x298a90=new AgentComplete(_0x2dbd90,_0x1ca0bb);if(_0x1ca0bb[_0x7538('0x117')]===_0x7538('0x118')){_0x298a90[_0x7538('0x119')]=this[_0x7538('0x21')][_0x1ca0bb[_0x7538('0xbf')]][_0x7538('0x11a')]&&this[_0x7538('0x21')][_0x1ca0bb[_0x7538('0xbf')]][_0x7538('0x11b')]?moment()[_0x7538('0x81')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x7538('0xd5')](_0x298a90)[_0x7538('0xbc')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x7538('0xd4')](_0x298a90)[_0x7538('0xbc')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x7538('0x2f')]=function(_0x228fb4){if(this['voiceQueues'][_0x228fb4[_0x7538('0xbf')]]){if(this[_0x7538('0x29')][_0x228fb4[_0x7538('0xeb')]]&&this[_0x7538('0x29')][_0x228fb4['uniqueid']][_0x7538('0x50')]!==_0x7538('0x80')){this['updateOriginated'](this[_0x7538('0x21')][_0x228fb4[_0x7538('0xbf')]]);this[_0x7538('0x29')][_0x228fb4[_0x7538('0xeb')]]['answertime']=moment()['format'](_0x7538('0x107'));}}};Dialer[_0x7538('0xb8')][_0x7538('0x11c')]=function(_0x26798d,_0x4ee7d8){this[_0x7538('0xd5')](_0x26798d)[_0x7538('0xbc')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x4ee7d8==0x0){this['moveContactManagedDialer'](_0x26798d)[_0x7538('0xbc')](loggerCatch(_0x7538('0x11d')));}};Dialer[_0x7538('0xb8')][_0x7538('0x32')]=function(_0x5b9a8e){var _0xda9d7c=this['uniqueId'][_0x5b9a8e[_0x7538('0xeb')]];var _0x9669=this;var _0x128c1c=![];var _0x46caf7;var _0x3ba9bb;if(this['voiceQueues'][_0x5b9a8e[_0x7538('0xbf')]]){if(_0xda9d7c&&_0xda9d7c['type']!=='ivr'){delete this[_0x7538('0x29')][_0x5b9a8e[_0x7538('0xeb')]];this['updateOriginated'](this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]]);_0xda9d7c['droptime']=moment()[_0x7538('0x81')](_0x7538('0x107'));var _0x355cfe=new QueueCallerAbandon(_0xda9d7c,_0x5b9a8e);if(getSeconds(_0xda9d7c[_0x7538('0x11e')],_0xda9d7c[_0x7538('0x11f')])>=_0xda9d7c[_0x7538('0x120')]){this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]][_0x7538('0x71')]+=0x1;this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]][_0x7538('0x67')]+=0x1;this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x355cfe[_0x7538('0xf1')]=0xa;_0x355cfe[_0x7538('0xb3')]='Drop';_0x355cfe[_0x7538('0x121')]=_0x7538('0x122');_0x355cfe[_0x7538('0x119')]=this['voiceQueues'][_0x5b9a8e['queue']]['dialQueueProject2']?moment()[_0x7538('0x81')](_0x7538('0x107')):undefined;_0x355cfe[_0x7538('0xfd')]+=0x1;_0x355cfe[_0x7538('0xf8')]+=0x1;_0x46caf7=this[_0x7538('0x21')][_0x5b9a8e['queue']][_0x7538('0x123')];_0x3ba9bb=this['voiceQueues'][_0x5b9a8e[_0x7538('0xbf')]][_0x7538('0x124')];_0x9669['verifyAdditionalPhones'](_0x355cfe,_0x355cfe[_0x7538('0xf1')],_0xda9d7c[_0x7538('0x125')])[_0x7538('0xc3')](function(_0x397255){_0x128c1c=_0x397255[_0x7538('0x126')]==0x1;if(_0x355cfe[_0x7538('0xfd')]>=_0x9669[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]][_0x7538('0x127')]){_0x9669[_0x7538('0x11c')](_0x355cfe,_0x397255[_0x7538('0x126')]);}else{_0x9669['rescheduleContact']({'active':![],'countdropretry':_0x355cfe[_0x7538('0xfd')],'scheduledat':moment()['add'](this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]]['dialDropRetryFrequency'],_0x7538('0x106'))[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0xda9d7c[_0x7538('0xde')],'ListId':_0xda9d7c[_0x7538('0x108')],'VoiceQueueId':_0xda9d7c[_0x7538('0xe0')]||undefined,'CampaignId':_0xda9d7c[_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch('[rescheduleContact][Drop]'));var _0xfe4a46=new History(_0x355cfe);_0xfe4a46['state']=0xa;_0xfe4a46[_0x7538('0xb3')]=_0x7538('0x128');_0xfe4a46[_0x7538('0xb5')]=moment()['format'](_0x7538('0x107'));_0xfe4a46['endtime']=_0xfe4a46[_0x7538('0xb5')];_0xfe4a46['calleridname']=_0x355cfe[_0x7538('0x129')];_0xfe4a46['calleridnum']=_0x355cfe[_0x7538('0x12a')];_0x9669['createHistory'](_0xfe4a46)[_0x7538('0xbc')](loggerCatch(_0x7538('0x12b')));}})[_0x7538('0xc3')](function(_0x2088f8){if(_0x128c1c)_0x9669[_0x7538('0xc8')](_0x355cfe,_0x46caf7,_0x3ba9bb)['then'](function(_0xcb94d1){return 0x1;});});}else{this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]][_0x7538('0x70')]+=0x1;this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]][_0x7538('0x12c')]+=0x1;_0x355cfe[_0x7538('0xf1')]=0xb;_0x355cfe[_0x7538('0xb3')]=_0x7538('0x12d');_0x355cfe[_0x7538('0x121')]='CALLEREXIT';_0x355cfe[_0x7538('0xfe')]+=0x1;_0x355cfe[_0x7538('0xf8')]+=0x1;_0x46caf7=this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]]['dialAbandonedRetryFrequency'];_0x3ba9bb=this[_0x7538('0x21')][_0x5b9a8e[_0x7538('0xbf')]][_0x7538('0x124')];_0x9669[_0x7538('0xc6')](_0x355cfe,_0x355cfe[_0x7538('0xf1')],_0xda9d7c[_0x7538('0x125')])['then'](function(_0xce4ed4){if(_0x355cfe[_0x7538('0xfe')]>=_0x9669['voiceQueues'][_0x5b9a8e['queue']][_0x7538('0x12e')]){_0x9669['queueCallerAbandonCreateState'](_0x355cfe,_0xce4ed4[_0x7538('0x126')]);}else{_0x9669[_0x7538('0xcd')]({'active':![],'countabandonedretry':_0x355cfe[_0x7538('0xfe')],'scheduledat':moment()[_0x7538('0x104')](this['voiceQueues'][_0x5b9a8e[_0x7538('0xbf')]][_0x7538('0x12f')],_0x7538('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xda9d7c[_0x7538('0xde')],'ListId':_0xda9d7c[_0x7538('0x108')],'VoiceQueueId':_0xda9d7c[_0x7538('0xe0')]||undefined,'CampaignId':_0xda9d7c[_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch(_0x7538('0x130')));var _0x761b24=new History(_0x355cfe);_0x761b24['state']=0xb;_0x761b24[_0x7538('0xb3')]=_0x7538('0x12d');_0x761b24[_0x7538('0xb5')]=moment()[_0x7538('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0x761b24[_0x7538('0xb4')]=_0x761b24[_0x7538('0xb5')];_0x761b24[_0x7538('0x129')]=_0x355cfe[_0x7538('0x129')];_0x761b24[_0x7538('0x12a')]=_0x355cfe[_0x7538('0x12a')];_0x9669[_0x7538('0xd5')](_0x761b24)[_0x7538('0xbc')](loggerCatch(_0x7538('0x131')));}})[_0x7538('0xc3')](function(_0x40f93b){if(_0x128c1c)_0x9669[_0x7538('0xc8')](_0x355cfe,_0x46caf7,_0x3ba9bb)[_0x7538('0xc3')](function(_0x1aaea5){return 0x1;});});}}}};Dialer[_0x7538('0xb8')]['syncNewExten']=function(_0x101359){if(this[_0x7538('0x27')][_0x101359[_0x7538('0xeb')]]){this[_0x7538('0x27')][_0x101359[_0x7538('0xeb')]][_0x7538('0xbb')]=_0x101359[_0x7538('0xbb')];}if(this[_0x7538('0x29')][_0x101359[_0x7538('0xeb')]]){this[_0x7538('0x29')][_0x101359[_0x7538('0xeb')]][_0x7538('0xbb')]=_0x101359[_0x7538('0xbb')];}};Dialer['prototype']['syncQueueMember']=function(_0x3e5d1d){if(strategy[this[_0x7538('0x21')][this[_0x7538('0x27')][_0x3e5d1d[_0x7538('0x132')]][_0x7538('0xbf')]]['strategy']]===_0x7538('0x1b')){if(this[_0x7538('0x27')][_0x3e5d1d[_0x7538('0x132')]]&&_[_0x7538('0xb9')](this[_0x7538('0x27')][_0x3e5d1d[_0x7538('0x132')]][_0x7538('0x133')])&&_0x3e5d1d[_0x7538('0xe8')]==='1'&&_0x3e5d1d[_0x7538('0x134')]==='0'){if(this[_0x7538('0x23')][_0x3e5d1d[_0x7538('0x135')]]){if(!this['agents'][_0x3e5d1d['stateinterface']]['locked']){this[_0x7538('0x23')][_0x3e5d1d['stateinterface']][_0x7538('0x133')]=!![];this['actions'][_0x3e5d1d[_0x7538('0x132')]]['locked']=!![];this[_0x7538('0x27')][_0x3e5d1d[_0x7538('0x132')]][_0x7538('0x135')]=_0x3e5d1d[_0x7538('0x135')];}}}}else if((strategy[this[_0x7538('0x21')][this['actions'][_0x3e5d1d[_0x7538('0x132')]]['queue']]['strategy']]||'rrmemory')===_0x7538('0x1a')){if(this['actions'][_0x3e5d1d[_0x7538('0x132')]]){if(this['agents'][_0x3e5d1d[_0x7538('0x135')]]){this[_0x7538('0x27')][_0x3e5d1d[_0x7538('0x132')]][_0x7538('0x135')]=_0x3e5d1d[_0x7538('0x135')];if(_[_0x7538('0xb9')](this['queueBooked'][this[_0x7538('0x27')][_0x3e5d1d[_0x7538('0x132')]]['queue']])){this[_0x7538('0x136')][this[_0x7538('0x27')][_0x3e5d1d['actionid']][_0x7538('0xbf')]]=[];}this['queueBooked'][this['actions'][_0x3e5d1d[_0x7538('0x132')]][_0x7538('0xbf')]][_0x7538('0x137')](_[_0x7538('0x98')](_['pick'](this[_0x7538('0x27')][_0x3e5d1d['actionid']],[_0x7538('0x138'),_0x7538('0x135')]),{'status':_0x3e5d1d[_0x7538('0xe8')],'paused':_0x3e5d1d[_0x7538('0x134')]}));}}}};function unlockQueueStatus(_0x28efa0,_0x8ff1b){setTimeout(function(){if(_[_0x7538('0x42')](_0x28efa0['queueStatusComplete'])){loggerBooked['error'](_0x7538('0x139'),_0x8ff1b);}_0x28efa0[_0x7538('0x13a')]=!![];loggerBooked[_0x7538('0x85')](_0x7538('0x13b'),_0x8ff1b,JSON[_0x7538('0x4c')](_[_0x7538('0xdd')](_0x28efa0,[_0x7538('0x49'),_0x7538('0x13a')])));},0x1f3);}Dialer[_0x7538('0xb8')]['syncQueueStatusComplete']=function(_0x54a555){var _0x2b0b99=this;var _0x48cf99=_0x2b0b99[_0x7538('0x21')][_0x2b0b99['actions'][_0x54a555['actionid']][_0x7538('0xbf')]];if(strategy[this[_0x7538('0x21')][this[_0x7538('0x27')][_0x54a555['actionid']][_0x7538('0xbf')]][_0x7538('0x52')]]===_0x7538('0x1b')){if(this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]]&&this[_0x7538('0x27')][_0x54a555['actionid']][_0x7538('0x135')]){this[_0x7538('0x20')]['run'](this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]]['idHopper'],this['actions'][_0x54a555[_0x7538('0x132')]]['stateinterface'])[_0x7538('0xbc')](function(_0x33723f){logger[_0x7538('0xa0')](_0x7538('0x13c'),util[_0x7538('0xa2')](_0x33723f,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2b0b99[_0x7538('0xbe')](_0x2b0b99['voiceQueues'][_0x2b0b99[_0x7538('0x27')][_0x54a555['actionid']][_0x7538('0xbf')]]);_0x2b0b99['agents'][_0x2b0b99[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]][_0x7538('0x135')]]['locked']=![];delete _0x2b0b99['actions'][_0x54a555[_0x7538('0x132')]];unlockQueueStatus(_0x48cf99);});}else{this[_0x7538('0xbe')](this[_0x7538('0x21')][this[_0x7538('0x27')][_0x54a555['actionid']][_0x7538('0xbf')]]);this[_0x7538('0xcd')]({'active':![],'ContactId':this['actions'][_0x54a555[_0x7538('0x132')]][_0x7538('0xde')],'ListId':this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]]['ListId'],'VoiceQueueId':this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]][_0x7538('0xe0')]||undefined,'CampaignId':this['actions'][_0x54a555[_0x7538('0x132')]][_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch(_0x7538('0x13d')));delete this[_0x7538('0x27')][_0x54a555['actionid']];unlockQueueStatus(_0x48cf99);}}else if((strategy[this[_0x7538('0x21')][this[_0x7538('0x27')][_0x54a555['actionid']][_0x7538('0xbf')]]['strategy']]||_0x7538('0x1a'))===_0x7538('0x1a')){var _0x25d350;if(this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]]&&!_[_0x7538('0x84')](this[_0x7538('0x136')][this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]][_0x7538('0xbf')]])){if(this[_0x7538('0x2d')][_0x2b0b99[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]]['queue']]){this[_0x7538('0x2d')][_0x2b0b99[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]][_0x7538('0xbf')]]=this[_0x7538('0x2d')][this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]][_0x7538('0xbf')]]?this[_0x7538('0x2d')][this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]][_0x7538('0xbf')]]:this[_0x7538('0x136')][this['actions'][_0x54a555[_0x7538('0x132')]][_0x7538('0xbf')]]?this[_0x7538('0x136')][this['actions'][_0x54a555[_0x7538('0x132')]]['queue']][_0x7538('0x13e')]||0x0:0x0;}this['queueBooked'][this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]][_0x7538('0xbf')]][_0x7538('0x13e')]=this['queueBookedRR'][this[_0x7538('0x27')][_0x54a555[_0x7538('0x132')]][_0x7538('0xbf')]];for(var _0x1d4db6=0x0;_0x1d4db6=0x0;})[_0x7538('0xbc')](myreject(_0x38a068)));}}else{_0x233932[_0x7538('0x137')](ami[_0x7538('0xba')]({'action':'command','command':util[_0x7538('0x81')]('iftime\x20%s,%s',_0x52e7ea,!_['isUndefined'](config['timezones'][_0x5273c4])?_0x5273c4:'')})[_0x7538('0xc3')](function(_0x3fe22b){return _0x3fe22b[_0x7538('0x15a')][_0x7538('0x15b')]('true')>=0x0;})['catch'](myreject(_0x38a068)));}BPromise[_0x7538('0x15d')](_0x233932)[_0x7538('0xc3')](function(_0x31b439){var _0x523834=_[_0x7538('0x15e')](_0x31b439);if(_0x523834){return _0x4049e7(_0x523834);}else{_0x4c0185['message']=_0x27058b?_0x7538('0x15f'):_0x7538('0x160');return _0x38a068(msgResponse(_0x7538('0x161'),_0x7538('0x155'),_0x7538('0x162')+_0x27058b+'\x20'+_0x20784b+_0x7538('0x163')+util[_0x7538('0xa2')](_0x52e7ea,{'showHidden':![],'depth':null})+_0x7538('0x164')+_0x5273c4));}})[_0x7538('0xbc')](function(_0x5e7a6a){return _0x38a068(msgResponse('ifTime',_0x7538('0x155'),JSON['stringify'](_0x5e7a6a)));});});};Dialer[_0x7538('0xb8')]['checkDialMethod']=function(_0x1ac27f){var _0x5bd8e2=this;return function(){switch(_0x1ac27f[_0x7538('0x165')]){case _0x7538('0x166'):freeVariablesPredictive(_0x1ac27f);_0x5bd8e2[_0x7538('0x167')](_0x1ac27f,0x1);break;case _0x7538('0x168'):freeVariablesPredictive(_0x1ac27f);_0x5bd8e2[_0x7538('0x167')](_0x1ac27f,_0x1ac27f[_0x7538('0x169')]);break;case _0x7538('0x9'):_0x5bd8e2[_0x7538('0x9')](_0x1ac27f);break;case _0x7538('0x8'):freeVariablesPredictive(_0x1ac27f);_0x5bd8e2[_0x7538('0x167')](_0x1ac27f,0x1);break;default:freeVariablesPredictive(_0x1ac27f);logger['error']('Queue',_0x1ac27f[_0x7538('0x49')],_0x7538('0x16a'));}};};Dialer[_0x7538('0xb8')]['launchHandleIvr']=function(_0xfec1c1){var _0x49ea57=this;return function(){_0x49ea57[_0x7538('0x16b')](_0xfec1c1);};};Dialer[_0x7538('0xb8')][_0x7538('0xb')]=function(_0x35ab04){var _0x35e7d8=this;if(isNotPreview(_0x35ab04['dialMethod'])){if(isVoiceQueueOutbound(_0x35ab04['type'])&&isActive(_0x35ab04['dialActive'])){_0x35ab04['sendMessageOneNotActive']=!![];BPromise[_0x7538('0xc2')]()[_0x7538('0xc3')](checkIsLoggedIn(_0x35ab04,_0x35ab04[_0x7538('0x54')]))[_0x7538('0xc3')](checkIsActive(_0x35ab04,_0x35ab04['dialActive']))['then'](checkInterval(_0x35ab04))[_0x7538('0xc3')](_0x35e7d8[_0x7538('0x14a')](_0x35ab04))[_0x7538('0xc3')](_0x35e7d8[_0x7538('0x14e')](_0x35ab04[_0x7538('0x16c')],_0x35ab04[_0x7538('0x16d')],_0x35ab04['name'],_0x35ab04))['then'](_0x35e7d8[_0x7538('0x150')](_0x35ab04[_0x7538('0x47')],_0x35ab04[_0x7538('0x16d')],_0x35ab04[_0x7538('0x49')],_0x35ab04))[_0x7538('0xc3')](_0x35e7d8['checkDialMethod'](_0x35ab04))['catch'](loggerCatchQueueSummary(_0x7538('0x16e'),_0x35ab04));}else{notSendMessagesQueue(_0x35ab04);}}else{freeVariablesPredictive(_0x35ab04);}};Dialer['prototype'][_0x7538('0x149')]=function(){var _0x8043f9=this;var _0x908553;for(var _0x4e949a in this[_0x7538('0x22')]){if(typeof this[_0x7538('0x22')][_0x4e949a]!=='undefined'){_0x908553=this['campaigns'][_0x4e949a];if(isCampaignIvr(_0x908553[_0x7538('0x50')])&&isActive(_0x908553[_0x7538('0x7d')])){_0x908553['sendMessageOneNotActive']=!![];BPromise['resolve']()['then'](checkIsActive(_0x908553,_0x908553[_0x7538('0x7d')]))['then'](checkInterval(_0x908553))[_0x7538('0xc3')](_0x8043f9[_0x7538('0x14a')](_0x908553))[_0x7538('0xc3')](_0x8043f9[_0x7538('0x14e')](_0x908553[_0x7538('0x16c')],_0x908553[_0x7538('0x16d')],_0x908553[_0x7538('0x49')],_0x908553))[_0x7538('0xc3')](_0x8043f9['checkIfTimeIntervals'](_0x908553[_0x7538('0x47')],_0x908553[_0x7538('0x16d')],_0x908553[_0x7538('0x49')],_0x908553))[_0x7538('0xc3')](_0x8043f9[_0x7538('0x16f')](_0x908553))['catch'](loggerCatchQueueSummary(_0x7538('0x170'),_0x908553));}else{notSendMessagesCampaign(_0x908553);}}}};function getCallerIdRandom(_0x359158,_0x36440c){var _0xba8b1;var _0xb7eaf7;var _0x3a207a;if(_0x36440c<=0x0){_0x36440c=0x1;}_0xba8b1=new RegExp('\x5cw{0,'+_0x36440c+'}$');_0xb7eaf7=Math[_0x7538('0x171')](0xa,_0x36440c-0x1);_0x3a207a=Math[_0x7538('0x171')](0xa,_0x36440c)-0x1;return util[_0x7538('0x81')]('%s',_[_0x7538('0x172')](_0x359158,_0xba8b1,_[_0x7538('0x173')](_0xb7eaf7,_0x3a207a)));}function extractCalleridName(_0x3c7cfb){var _0x1250e9=_0x3c7cfb[_0x7538('0x174')](/"(.*?)"/);return _0x1250e9?_0x1250e9[0x1]:_0x3c7cfb;}function extractCalleridNumber(_0x2aec98){var _0x55d244=_0x2aec98[_0x7538('0x174')](/<(.*?)>/);return _0x55d244?_0x55d244[0x1]:_0x2aec98;}Dialer[_0x7538('0xb8')]['actionOriginate']=function(_0x1263e8,_0x249b05){var _0x3aef50=this;var _0x46fe4a=uuid['v4']();this['actions'][_0x46fe4a]=new Action(_0x1263e8,_0x249b05,_0x46fe4a);return new BPromise(function(_0x1e8618,_0x515cc3){if(_['isUndefined'](_0x1263e8)&&typeof _0x1263e8!==_0x7538('0x175')){return _0x515cc3(msgResponse('originate',_0x7538('0x155'),_0x7538('0x176')));}if(_['isUndefined'](_0x249b05[_0x7538('0x177')][_0x7538('0x178')])||_0x249b05[_0x7538('0x177')][_0x7538('0x178')]===null){return _0x515cc3(msgResponse(_0x7538('0x179'),_0x7538('0x155'),'contact\x20is\x20undefine'));}var _0x36d594={'XMD-CALLERID':_0x3aef50[_0x7538('0x27')][_0x46fe4a][_0x7538('0x17a')](),'XMD-AGI':_0x1263e8[_0x7538('0x114')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x1263e8['dialQueueProject']):_0x7538('0x17b'),'XMD-AGIAFTER':_0x1263e8['dialQueueProject2']?util['format'](_0x7538('0x17c'),ipAgi,_0x1263e8[_0x7538('0x11a')]):_0x7538('0x17b'),'XMD-QUEUE':_0x1263e8[_0x7538('0x50')]===_0x7538('0x51')?util[_0x7538('0x81')](_0x7538('0x17d'),_0x1263e8['name'],_0x1263e8[_0x7538('0x17e')]||'',_0x1263e8['dialAgiAfterHangupAgent']?'c':'',_0x1263e8['dialQueueTimeout']||0x3):_0x7538('0x17b'),'XMD-CONTACTID':_0x249b05[_0x7538('0xde')],'XMD-CDRTYPE':_0x7538('0x7'),'CALLERID(all)':_0x3aef50[_0x7538('0x27')][_0x46fe4a]['getCaller'](),'XMD-AMD':_0x1263e8[_0x7538('0xee')]?_0x7538('0x17f'):_0x7538('0x17b'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x1263e8[_0x7538('0xee')]){_0x36d594[_0x7538('0x180')]=_0x1263e8[_0x7538('0x181')]||0x9c4;_0x36d594['XMD-AMDGREETING']=_0x1263e8[_0x7538('0x182')]||0x5dc;_0x36d594['XMD-AMDAFTERGREETINGSILENCE']=_0x1263e8['dialAMDAfterGreetingSilence']||0x320;_0x36d594[_0x7538('0x183')]=_0x1263e8[_0x7538('0x184')]||0x1388;_0x36d594[_0x7538('0x185')]=_0x1263e8[_0x7538('0x186')]||0x64;_0x36d594['XMD-AMDBETWEENWORDSSILENCE']=_0x1263e8['dialAMDBetweenWordsSilence']||0x32;_0x36d594['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x1263e8[_0x7538('0x187')]||0x3;_0x36d594[_0x7538('0x188')]=_0x1263e8[_0x7538('0x189')]||0x100;_0x36d594['XMD-AMDMAXIMUMWORDLENGTH']=_0x1263e8['dialAMDMaximumWordLength']||0x1388;}if(_0x1263e8[_0x7538('0x50')]===_0x7538('0x51')){_0x36d594[_0x7538('0x18a')]=_0x249b05[_0x7538('0xe0')];}else{_0x36d594['XMD-CAMPAIGNID']=_0x249b05[_0x7538('0xe1')];}for(var _0x58d8ca in _0x249b05[_0x7538('0x177')]){if(typeof _0x249b05[_0x7538('0x177')][_0x58d8ca]!==_0x7538('0xa3')){if(isNotNull(_0x249b05[_0x7538('0x177')][_0x58d8ca])&&_0x58d8ca!=='id'&&_0x58d8ca!==_0x7538('0x18b')&&_0x58d8ca!==_0x7538('0x18c')&&_0x58d8ca!==_0x7538('0x18d')){_0x36d594[util['format'](_0x7538('0x18e'),_0x7538('0x18f'),_['toUpper'](_0x58d8ca))]=_0x249b05[_0x7538('0x177')][_0x58d8ca];}}}var _0x360c6f=_0x3aef50[_0x7538('0xe6')](_0x1263e8[_0x7538('0x7c')])?getCallerId(_0x1263e8['Trunk']['callerid'],_0x1263e8[_0x7538('0x5e')],_0x1263e8['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1263e8[_0x7538('0x5f')],_0x1263e8['dialRandomLastDigitCallerIdNumber']):_0x1263e8[_0x7538('0x5f')]):getCallerId(_[_0x7538('0xb9')](_0x1263e8[_0x7538('0x14b')])?_0x1263e8[_0x7538('0x7c')][_0x7538('0x7e')]:_0x1263e8[_0x7538('0x14b')][_0x7538('0x7e')],_0x1263e8['dialOriginateCallerIdName'],_0x1263e8[_0x7538('0x190')]>0x0?getCallerIdRandom(_0x1263e8['dialOriginateCallerIdNumber'],_0x1263e8[_0x7538('0x190')]):_0x1263e8[_0x7538('0x5f')]);if(_0x360c6f){_0x36d594[_0x7538('0x191')]=_0x3aef50[_0x7538('0x27')][_0x46fe4a][_0x7538('0x192')]=extractCalleridName(_0x360c6f);_0x36d594[_0x7538('0x193')]=_0x3aef50['actions'][_0x46fe4a][_0x7538('0x194')]=extractCalleridNumber(_0x360c6f);}return ami[_0x7538('0xba')]({'actionid':_0x46fe4a,'action':_0x7538('0x179'),'channel':_0x3aef50[_0x7538('0xe6')](_0x1263e8[_0x7538('0x7c')])?util[_0x7538('0x81')](_0x7538('0x195'),_0x1263e8[_0x7538('0x7c')]['name'],isNotNull(_0x1263e8['dialPrefix'])?_0x1263e8['dialPrefix']['trim']()||'':'',_0x1263e8[_0x7538('0x196')]>0x0?_0x249b05[_0x7538('0x177')][_0x7538('0x178')][_0x7538('0x197')](_0x1263e8['dialCutDigit']):_0x249b05[_0x7538('0x177')]['phone']):util[_0x7538('0x81')](_0x7538('0x195'),_[_0x7538('0xb9')](_0x1263e8[_0x7538('0x14b')])?_0x1263e8[_0x7538('0x7c')][_0x7538('0x49')]:_0x1263e8[_0x7538('0x14b')][_0x7538('0x49')],isNotNull(_0x1263e8[_0x7538('0x61')])?_0x1263e8['dialPrefix']['trim']()||'':'',_0x1263e8['dialCutDigit']>0x0?_0x249b05[_0x7538('0x177')][_0x7538('0x178')]['substring'](_0x1263e8[_0x7538('0x196')]):_0x249b05['Contact'][_0x7538('0x178')]),'callerid':_0x360c6f,'Exten':_0x7538('0x198'),'Context':'from-sip','Priority':'1','variable':_0x36d594,'timeout':(_0x1263e8['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x46fe4a})[_0x7538('0xc3')](function(_0x18fb99){return _0x1e8618(_0x18fb99);})[_0x7538('0xbc')](function(_0x13b662){_0x1263e8[_0x7538('0x6a')]+=0x1;var _0x35e56b=new History(_0x3aef50[_0x7538('0x27')][_0x46fe4a]);logger[_0x7538('0xa0')](util[_0x7538('0x81')](_0x7538('0x199'),JSON[_0x7538('0x4c')](_0x13b662)));_0x35e56b[_0x7538('0xf1')]=0xe;_0x35e56b[_0x7538('0xb3')]=_0x7538('0x19a');_0x35e56b[_0x7538('0xb5')]=moment()[_0x7538('0x81')](_0x7538('0x107'));_0x35e56b['endtime']=_0x35e56b[_0x7538('0xb5')];_0x3aef50['createHistory'](_0x35e56b)[_0x7538('0xbc')](loggerCatch(_0x7538('0x19b')));_0x3aef50[_0x7538('0xd4')](_0x35e56b)['catch'](loggerCatch(_0x7538('0x19b')))['finally'](function(){delete _0x3aef50[_0x7538('0x27')][_0x46fe4a];return _0x515cc3(msgResponse(_0x7538('0x179'),_0x7538('0x19c'),_0x7538('0x19d')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x2ca999){var _0x22cbd8=this['actions'][_0x2ca999[_0x7538('0x132')]];if(_0x22cbd8){delete this[_0x7538('0x27')][_0x2ca999[_0x7538('0x132')]];_0x22cbd8[_0x7538('0x11f')]=moment()['format'](_0x7538('0x107'));var _0x46be69=_0x22cbd8[_0x7538('0x50')]==='ivr'?this[_0x7538('0x22')][_0x22cbd8[_0x7538('0xbf')]]:this[_0x7538('0x21')][_0x22cbd8[_0x7538('0x19e')]()];if(!this[_0x7538('0xe4')](_0x2ca999[_0x7538('0x19f')])){this['updateOriginated'](_0x46be69);return this[_0x7538('0x1a0')](_0x22cbd8,_0x46be69,_0x2ca999)['catch'](loggerCatch(_0x7538('0x1a1')));}this[_0x7538('0x29')][_0x2ca999[_0x7538('0xeb')]]=_0x22cbd8;}};Dialer[_0x7538('0xb8')][_0x7538('0x1a2')]=function(_0x46ca45,_0x275b40,_0x47ddc9){var _0x2fe332=new History(_0x275b40);if(_0x2fe332['countbusyretry']+_0x2fe332[_0x7538('0xfb')]+_0x2fe332['countnoanswerretry']+_0x2fe332[_0x7538('0x10e')]+_0x2fe332[_0x7538('0xfd')]+_0x2fe332['countabandonedretry']+_0x2fe332[_0x7538('0xf7')]+_0x2fe332['countagentrejectretry']>=_0x47ddc9[_0x7538('0x100')]-0x1){return!![];}switch(_0x46ca45){case 0x3:if(_0x2fe332[_0x7538('0xfc')]>=_0x47ddc9[_0x7538('0x1a3')]-0x1){return!![];}this[_0x7538('0xcd')]({'active':![],'countnoanswerretry':_0x2fe332[_0x7538('0xfc')]+=0x1,'scheduledat':moment()['add'](_0x47ddc9[_0x7538('0x1a4')],_0x7538('0x106'))[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0x2fe332['ContactId'],'ListId':_0x2fe332[_0x7538('0x108')],'VoiceQueueId':_0x2fe332[_0x7538('0xe0')]||undefined,'CampaignId':_0x2fe332[_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2fe332[_0x7538('0x10d')]>=_0x47ddc9[_0x7538('0x1a5')]-0x1){return!![];}this[_0x7538('0xcd')]({'active':![],'countbusyretry':_0x2fe332[_0x7538('0x10d')]+=0x1,'scheduledat':moment()['add'](_0x47ddc9[_0x7538('0x1a6')],'minutes')[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0x2fe332[_0x7538('0xde')],'ListId':_0x2fe332[_0x7538('0x108')],'VoiceQueueId':_0x2fe332[_0x7538('0xe0')]||undefined,'CampaignId':_0x2fe332[_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch(_0x7538('0x1a7')));break;case 0x8:if(_0x2fe332[_0x7538('0xfb')]>=_0x47ddc9[_0x7538('0x1a8')]-0x1){return!![];}this[_0x7538('0xcd')]({'active':![],'countcongestionretry':_0x2fe332[_0x7538('0xfb')]+=0x1,'scheduledat':moment()[_0x7538('0x104')](_0x47ddc9[_0x7538('0x1a9')],'minutes')['format'](_0x7538('0x107')),'ContactId':_0x2fe332[_0x7538('0xde')],'ListId':_0x2fe332[_0x7538('0x108')],'VoiceQueueId':_0x2fe332[_0x7538('0xe0')]||undefined,'CampaignId':_0x2fe332[_0x7538('0xe1')]||undefined})['catch'](loggerCatch(_0x7538('0x1aa')));break;case 0x0:if(_0x2fe332[_0x7538('0x10e')]>=_0x47ddc9['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x2fe332[_0x7538('0x10e')]+=0x1,'scheduledat':moment()['add'](_0x47ddc9[_0x7538('0x1ab')],_0x7538('0x106'))[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0x2fe332['ContactId'],'ListId':_0x2fe332['ListId'],'VoiceQueueId':_0x2fe332[_0x7538('0xe0')]||undefined,'CampaignId':_0x2fe332['CampaignId']||undefined})[_0x7538('0xbc')](loggerCatch(_0x7538('0x1ac')));}break;case 0xa:if(_0x2fe332['countdropretry']>=_0x47ddc9[_0x7538('0x127')]-0x1){return!![];}this[_0x7538('0xcd')]({'active':![],'countdropretry':_0x2fe332['countdropretry']+=0x1,'scheduledat':moment()[_0x7538('0x104')](_0x47ddc9[_0x7538('0x123')],_0x7538('0x106'))[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0x2fe332[_0x7538('0xde')],'ListId':_0x2fe332[_0x7538('0x108')],'VoiceQueueId':_0x2fe332[_0x7538('0xe0')]||undefined,'CampaignId':_0x2fe332['CampaignId']||undefined})[_0x7538('0xbc')](loggerCatch(_0x7538('0x1ad')));break;case 0xb:if(_0x2fe332[_0x7538('0xfe')]>=_0x47ddc9[_0x7538('0x12e')]-0x1){return!![];}this[_0x7538('0xcd')]({'active':![],'countabandonedretry':_0x2fe332['countabandonedretry']+=0x1,'scheduledat':moment()[_0x7538('0x104')](_0x47ddc9[_0x7538('0x12f')],_0x7538('0x106'))[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0x2fe332['ContactId'],'ListId':_0x2fe332['ListId'],'VoiceQueueId':_0x2fe332[_0x7538('0xe0')]||undefined,'CampaignId':_0x2fe332['CampaignId']||undefined})[_0x7538('0xbc')](loggerCatch(_0x7538('0x130')));break;case 0x13:if(_0x2fe332[_0x7538('0xf7')]>=_0x47ddc9[_0x7538('0x102')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x2fe332[_0x7538('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x47ddc9[_0x7538('0x105')],_0x7538('0x106'))[_0x7538('0x81')](_0x7538('0x107')),'ContactId':_0x2fe332[_0x7538('0xde')],'ListId':_0x2fe332['ListId'],'VoiceQueueId':_0x2fe332['VoiceQueueId']||undefined,'CampaignId':_0x2fe332[_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2fe332[_0x7538('0xff')]>=_0x47ddc9['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x7538('0xcd')]({'active':![],'countagentrejectretry':_0x2fe332['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x47ddc9['dialAgentRejectRetryFrequency'],_0x7538('0x106'))[_0x7538('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2fe332['ContactId'],'ListId':_0x2fe332[_0x7538('0x108')],'VoiceQueueId':_0x2fe332[_0x7538('0xe0')]||undefined,'CampaignId':_0x2fe332[_0x7538('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x7538('0xb8')][_0x7538('0x1a0')]=function(_0x55173e,_0x281793,_0x51be3d){var _0x2be554=this;var _0x3475f1=new History(_0x55173e);var _0x4cfd81=![];var _0x20bf00;var _0x4d177d;return new BPromise(function(_0x1c05c0,_0xcfd77e){if(_[_0x7538('0x42')](_0x281793)&&typeof _0x281793!==_0x7538('0x175')){return _0xcfd77e(msgResponse('[callProgressDetecting]','Failure',_0x7538('0x1ae')));}if(_[_0x7538('0x42')](_0x51be3d)&&typeof _0x51be3d!==_0x7538('0x175')){return _0xcfd77e(msgResponse(_0x7538('0x1af'),'Failure','evt\x20is\x20undefine'));}_0x2be554[_0x7538('0xc6')](_0x3475f1,_0x51be3d[_0x7538('0x117')],_0x281793)[_0x7538('0xc3')](function(_0x123655){if(_0x123655['additional']==0x1)_0x4cfd81=!![];switch(_0x51be3d['reason']){case'0':_0x281793[_0x7538('0x69')]+=0x1;_0x3475f1[_0x7538('0xf1')]=0x0;_0x3475f1[_0x7538('0xb3')]=_0x7538('0x1b0');_0x3475f1['countnosuchnumberretry']+=0x1;_0x3475f1[_0x7538('0xf8')]+=0x1;ami[_0x7538('0x4f')](_0x7538('0x1b1'),ut['buildObj'](_0x55173e,_0x7538('0x1b2')));_0x2be554['createHistory'](_0x3475f1)[_0x7538('0xbc')](loggerCatch(_0x7538('0xfa')));if(_0x2be554[_0x7538('0x1a2')](0x0,_0x55173e,_0x281793)&&!_0x4cfd81){if(_0x3475f1['countnosuchnumberretry']>=_0x281793['dialNoSuchNumberMaxRetry']){_0x2be554[_0x7538('0x103')](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1b3'));}else{_0x2be554[_0x7538('0x101')](_0x3475f1,_0x1c05c0,_0xcfd77e,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x281793[_0x7538('0x68')]+=0x1;_0x3475f1[_0x7538('0xf1')]=0x3;_0x3475f1[_0x7538('0xb3')]='NoAnswer';_0x3475f1[_0x7538('0xfc')]+=0x1;_0x3475f1[_0x7538('0xf8')]+=0x1;ami[_0x7538('0x4f')]('custom:agentnoanswer',ut['buildObj'](_0x55173e,_0x7538('0x1b4')));_0x2be554['createHistory'](_0x3475f1)['catch'](loggerCatch(_0x7538('0x1b5')));if(_0x2be554[_0x7538('0x1a2')](0x3,_0x55173e,_0x281793)&&!_0x4cfd81){if(_0x3475f1[_0x7538('0xfc')]>=_0x281793[_0x7538('0x1a3')]){_0x2be554[_0x7538('0x103')](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1b6'));}else{_0x2be554[_0x7538('0x101')](_0x3475f1,_0x1c05c0,_0xcfd77e,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x281793[_0x7538('0x1b7')]+=0x1;_0x3475f1[_0x7538('0xf1')]=0x5;_0x3475f1['statedesc']='Busy';_0x3475f1[_0x7538('0x10d')]+=0x1;_0x3475f1[_0x7538('0xf8')]+=0x1;ami[_0x7538('0x4f')]('custom:agentbusy',ut['buildObj'](_0x55173e,_0x7538('0x1b8')));_0x2be554[_0x7538('0xd5')](_0x3475f1)['catch'](loggerCatch(_0x7538('0x1b9')));if(_0x2be554[_0x7538('0x1a2')](0x5,_0x55173e,_0x281793)&&!_0x4cfd81){if(_0x3475f1[_0x7538('0x10d')]>=_0x281793[_0x7538('0x1a5')]){_0x2be554['createStateFinal'](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1ba'));}else{_0x2be554[_0x7538('0x101')](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1ba'));}}break;case'8':_0x281793['outboundCongestionCallsDay']+=0x1;_0x3475f1[_0x7538('0xf1')]=0x8;_0x3475f1[_0x7538('0xb3')]=_0x7538('0x1bb');_0x3475f1['countcongestionretry']+=0x1;_0x3475f1[_0x7538('0xf8')]+=0x1;ami[_0x7538('0x4f')]('custom:agentcongestion',ut[_0x7538('0x1bc')](_0x55173e,'congestion'));_0x2be554['createHistory'](_0x3475f1)['catch'](loggerCatch(_0x7538('0x1bd')));if(_0x2be554[_0x7538('0x1a2')](0x8,_0x55173e,_0x281793)&&!_0x4cfd81){if(_0x3475f1[_0x7538('0xfb')]>=_0x281793[_0x7538('0x1a8')]){_0x2be554[_0x7538('0x103')](_0x3475f1,_0x1c05c0,_0xcfd77e,'reason\x208\x20congestion');}else{_0x2be554[_0x7538('0x101')](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1be'));}}break;case'11':_0x281793['outboundAbandonedCallsDay']+=0x1;_0x3475f1[_0x7538('0xf1')]=0xb;_0x3475f1['statedesc']=_0x7538('0x12d');_0x3475f1[_0x7538('0xfe')]+=0x1;_0x3475f1[_0x7538('0xf8')]+=0x1;_0x2be554['createHistory'](_0x3475f1)['catch'](loggerCatch(_0x7538('0x131')));if(_0x2be554[_0x7538('0x1a2')](0xb,_0x55173e,_0x281793)&&!_0x4cfd81){if(_0x3475f1[_0x7538('0xfe')]>=_0x281793[_0x7538('0x12e')]){_0x2be554[_0x7538('0x103')](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1bf'));}else{_0x2be554[_0x7538('0x101')](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1bf'));}}break;case'20':_0x281793[_0x7538('0x6c')]+=0x1;_0x3475f1['state']=0x14;_0x3475f1['statedesc']=_0x7538('0x1c0');_0x3475f1['countagentrejectretry']+=0x1;_0x3475f1['countglobal']+=0x1;ami['emit'](_0x7538('0x1c1'),ut[_0x7538('0x1bc')](_0x55173e,_0x7538('0x1c2')));_0x2be554[_0x7538('0xd5')](_0x3475f1)[_0x7538('0xbc')](loggerCatch(_0x7538('0x1c3')));if(_0x2be554[_0x7538('0x1a2')](0x14,_0x55173e,_0x281793)&&!_0x4cfd81){if(_0x3475f1[_0x7538('0xff')]>=_0x281793[_0x7538('0x1c4')]){_0x2be554[_0x7538('0x103')](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1c5'));}else{_0x2be554[_0x7538('0x101')](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x7538('0x1c5'));}}break;default:_0x281793[_0x7538('0x6d')]+=0x1;_0x3475f1[_0x7538('0xf1')]=0xc;_0x3475f1[_0x7538('0xb3')]=_0x51be3d['reason'];_0x2be554[_0x7538('0xd5')](_0x3475f1)[_0x7538('0xbc')](loggerCatch(_0x7538('0x1c6')));if(_0x2be554[_0x7538('0x1a2')](_0x51be3d[_0x7538('0x117')],_0x55173e,_0x281793)&&!_0x4cfd81){if(_0x3475f1[_0x7538('0x10d')]+_0x3475f1[_0x7538('0xfb')]+_0x3475f1[_0x7538('0xfc')]+_0x3475f1[_0x7538('0x10e')]+_0x3475f1[_0x7538('0xfd')]+_0x3475f1[_0x7538('0xfe')]+_0x3475f1[_0x7538('0xf7')]+_0x3475f1[_0x7538('0xff')]>=_0x281793[_0x7538('0x100')]){_0x2be554['stateGlobal'](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x51be3d[_0x7538('0x117')]);}else{_0x2be554['createStateFinal'](_0x3475f1,_0x1c05c0,_0xcfd77e,_0x51be3d[_0x7538('0x117')]);}}}})[_0x7538('0xc3')](function(_0x263a2b){if(_0x4cfd81){_0x2be554[_0x7538('0xc8')](_0x3475f1,_0x20bf00,_0x4d177d)[_0x7538('0xc3')](function(_0x2fb32f){return _0x1c05c0(0x1);});}});});};Dialer[_0x7538('0xb8')][_0x7538('0x101')]=function(_0x18c3f9,_0xba82c4,_0x37c4ba,_0x2b9a7a){var _0x26b583=new Final(_0x18c3f9);_0x26b583[_0x7538('0xf1')]=0xf;_0x26b583[_0x7538('0xb3')]=_0x7538('0x1c7');this[_0x7538('0x103')](_0x26b583,_0xba82c4,_0x37c4ba,_0x2b9a7a);};Dialer[_0x7538('0xb8')]['createStateFinal']=function(_0x571f4d,_0x51c63d,_0x462455,_0x1ac757){this[_0x7538('0xd4')](_0x571f4d)[_0x7538('0xc3')](function(){return _0x51c63d(msgResponse('[callProgressDetecting]',_0x7538('0xe5'),_0x1ac757));})['catch'](function(){return _0x462455(msgResponse(_0x7538('0x1c8'),'Failure',_0x7538('0x1c9')));});};Dialer[_0x7538('0xb8')][_0x7538('0x9')]=function(_0x5acb7b){var _0x471fd7=_0x5acb7b['dialPredictiveOptimizationPercentage']/0x64;var _0x3587fc=_0x5acb7b[_0x7538('0x67')]/(_0x5acb7b[_0x7538('0x67')]+_0x5acb7b['outboundAnswerCallsDay']);var _0x527f59=Math[_0x7538('0x1ca')](_0x5acb7b[_0x7538('0x76')]*(_0x5acb7b[_0x7538('0x1cb')]/0x64));var _0x3d6fd3=Math[_0x7538('0x1ca')](_0x5acb7b[_0x7538('0x76')]*(_0x5acb7b[_0x7538('0x1cc')]/0x64));var _0x339a0b=_0x5acb7b[_0x7538('0xad')]+_0x5acb7b[_0x7538('0x58')];var _0x5eab7d=Math[_0x7538('0x1cd')](_0x5acb7b['erlangCalls']*_0x5acb7b[_0x7538('0x7a')]*_0x5acb7b[_0x7538('0x73')]*_0x5acb7b['predictiveIntervalMultiplicativeFactor']);if(_[_0x7538('0x42')](_0x5acb7b['startProgressive'])){if(!_[_0x7538('0x42')](_0x5acb7b[_0x7538('0x2b')])){_0x5acb7b['startPredictive']=undefined;loggerPredictive[_0x7538('0xa0')]('[startMethodPredictive][StartProgressive]',_0x7538('0x1ce'));}if(!_[_0x7538('0x42')](_0x5acb7b[_0x7538('0x9b')])){loggerPredictive[_0x7538('0xa0')](_0x7538('0x1cf'),_0x7538('0x1d0'));clearInterval(_0x5acb7b[_0x7538('0x9b')]);_0x5acb7b['handlePredictive']=undefined;}_0x5acb7b[_0x7538('0x2c')]=moment()[_0x7538('0x81')](_0x7538('0x107'));loggerPredictive[_0x7538('0x85')](_0x5acb7b[_0x7538('0x49')],_0x7538('0x1d1'),_0x5acb7b[_0x7538('0x2c')]);this[_0x7538('0x167')](_0x5acb7b,0x1);}else if(ifInterval(_0x5acb7b['dialPredictiveInterval'],_0x5acb7b[_0x7538('0x2c')])){this[_0x7538('0x167')](_0x5acb7b,0x1);loggerPredictiveCalls[_0x7538('0x85')](_0x7538('0x1d2'),_0x5acb7b[_0x7538('0x2c')],_0x5acb7b[_0x7538('0x49')]);_0x5acb7b[_0x7538('0x78')]=0x0;_0x5acb7b['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x471fd7<_0x3587fc&&_0x5acb7b[_0x7538('0x1d3')]===_0x7538('0x1d4')){freeVariablesPredictive(_0x5acb7b);loggerPredictive['info'](_0x7538('0x1d5'),'Dropped\x20calls\x20day',_0x3587fc,_0x7538('0x2c'),_0x5acb7b['name']);}else if(_0x5eab7d<_0x5acb7b[_0x7538('0x72')]&&_0x5acb7b[_0x7538('0x1d3')]===_0x7538('0x1d4')){freeVariablesPredictive(_0x5acb7b);loggerPredictive['info'](_0x7538('0x1d6'),'Max\x20Drop\x20',_0x5eab7d,'Drop\x20in\x20this\x20interval',_0x5acb7b[_0x7538('0x72')],_0x7538('0x2c'),_0x5acb7b[_0x7538('0x49')]);}else if(!ifInterval(_0x5acb7b['dialPredictiveInterval'],_0x5acb7b[_0x7538('0x2c')])&&_['isUndefined'](_0x5acb7b[_0x7538('0x2b')])&&!_[_0x7538('0x42')](_0x5acb7b[_0x7538('0x2c')])){_0x5acb7b['startPredictive']=moment()[_0x7538('0x81')](_0x7538('0x107'));loggerPredictive['info'](_0x5acb7b[_0x7538('0x49')],_0x7538('0x1d7'),_0x5acb7b[_0x7538('0x2b')]);this[_0x7538('0x1d8')](_0x5acb7b[_0x7538('0x1d9')])[_0x7538('0xc3')](this['getDataPredictive'](_0x5acb7b))[_0x7538('0xc3')](mergeDataErlangB(_0x5acb7b))[_0x7538('0xc3')](this[_0x7538('0x1da')](_0x5acb7b))['catch'](loggerCatchPredictive(_0x7538('0x1db'),_0x5acb7b));}else if(!ifInterval(_0x5acb7b[_0x7538('0x1d9')],_0x5acb7b['startPredictive'])){_0x5acb7b[_0x7538('0x72')]=0x0;_0x5acb7b[_0x7538('0x2b')]=moment()[_0x7538('0x81')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5acb7b[_0x7538('0x49')],_0x7538('0x1dc'),_0x5acb7b[_0x7538('0x2b')]);clearInterval(_0x5acb7b[_0x7538('0x9b')]);_0x5acb7b['handlePredictive']=undefined;this[_0x7538('0x1d8')](_0x5acb7b[_0x7538('0x1d9')])[_0x7538('0xc3')](this['getDataPredictive'](_0x5acb7b))[_0x7538('0xc3')](mergeDataErlangB(_0x5acb7b))[_0x7538('0xc3')](this[_0x7538('0x1da')](_0x5acb7b))[_0x7538('0xbc')](loggerCatchPredictive(_0x7538('0x1dd'),_0x5acb7b));}else if(_0x5acb7b[_0x7538('0x76')]&&_0x339a0b<_0x5acb7b[_0x7538('0x76')]-_0x3d6fd3){freeVariablesPredictive(_0x5acb7b);loggerPredictive[_0x7538('0x85')](_0x5acb7b['name'],_0x7538('0x1de'),_0x339a0b,_0x7538('0x1df'),_0x5acb7b[_0x7538('0x76')],'-',_0x3d6fd3,'=',_0x5acb7b[_0x7538('0x76')]-_0x3d6fd3,')');}else if(_0x5acb7b['predictiveIntervalAvailable']&&_0x339a0b>_0x5acb7b[_0x7538('0x76')]+_0x527f59){freeVariablesPredictive(_0x5acb7b);loggerPredictive[_0x7538('0x85')](_0x5acb7b[_0x7538('0x49')],_0x7538('0x1de'),_0x339a0b,_0x7538('0x1e0'),_0x5acb7b[_0x7538('0x76')],'+',_0x527f59,'=',_0x5acb7b['predictiveIntervalAvailable']+_0x527f59,')');}};Dialer[_0x7538('0xb8')][_0x7538('0x1e1')]=function(_0x29fef2){var _0x5193f5=this;return function(_0x3521f4){return new BPromise(function(_0x5e0ede,_0x24bbb0){_[_0x7538('0x98')](_0x29fef2,_0x3521f4[0x0]);if(checkGetDataPredictive(_0x3521f4[0x0])){var _0x2a47a0=_0x29fef2[_0x7538('0x76')]=_0x29fef2[_0x7538('0x58')]+_0x29fef2[_0x7538('0xad')];var _0x4b5686=_0x29fef2[_0x7538('0x1d9')]*0x3c;var _0x2b510f=_0x3521f4[0x0][_0x7538('0x6f')]+_0x3521f4[0x0][_0x7538('0x8c')];var _0x4b6e66=(_0x3521f4[0x0][_0x7538('0x6e')]+_0x3521f4[0x0][_0x7538('0x71')]+_0x3521f4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3521f4[0x0]['predictiveIntervalTotalCalls'];_0x29fef2['predictiveIntervalHitRate']=_0x4b6e66>0x0?_0x4b6e66:0x1;switch(_0x29fef2[_0x7538('0x1d3')]){case'dropRate':var _0x3311c4=_0x29fef2[_0x7538('0x1e2')]/0x64;return _0x5193f5[_0x7538('0x1e3')](_0x2a47a0,_0x4b5686,_0x2b510f,_0x4b6e66,_0x3311c4)['then'](function(_0x186e41){return _0x5e0ede(_0x186e41);});case _0x7538('0x1e4'):var _0x456e67=_0x29fef2['dialPredictiveOptimizationPercentage']/0x64;return _0x5193f5['busyFactor'](_0x2a47a0,_0x4b5686,_0x2b510f,_0x4b6e66,_0x456e67)['then'](function(_0x28fd91){return _0x5e0ede(_0x28fd91);});default:return _0x24bbb0(msgResponse(_0x7538('0x1e5'),_0x7538('0x155'),_0x7538('0x1e6')));}}else{return _0x24bbb0(msgResponse(_0x7538('0x1e5'),'Failure',_0x7538('0x1e7')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x525527){var _0x17ce5c=this;return function(_0x395fd6){return new BPromise(function(_0x442cb4,_0x53be11){_[_0x7538('0x98')](_0x525527,_0x395fd6[0x0]);if(checkGetDataPredictive(_0x395fd6[0x0])){loggerPredictive[_0x7538('0x85')](JSON[_0x7538('0x4c')](_0x395fd6[0x0]));if(_0x525527[_0x7538('0x1d3')]===_0x7538('0x1d4')){return _0x17ce5c['getVoiceQueueRtPauses'](_0x525527['id'])[_0x7538('0xc3')](function(_0x353362){var _0x49d6cc=_0x525527[_0x7538('0x54')]-_0x353362[0x0][_0x7538('0x1e8')];var _0xfe7fbb=_0x525527['dialPredictiveInterval']*0x3c;var _0x48a20b=_0x395fd6[0x0][_0x7538('0x6f')]+_0x395fd6[0x0][_0x7538('0x8c')];var _0xb37e5e=(_0x395fd6[0x0]['predictiveIntervalAnsweredCalls']+_0x395fd6[0x0][_0x7538('0x71')]+_0x395fd6[0x0][_0x7538('0x70')])/_0x395fd6[0x0][_0x7538('0x88')];var _0x416af2=_0x525527[_0x7538('0x1e2')]/0x64;_0x525527['predictiveIntervalPauses']=_0x353362[0x0][_0x7538('0x1e8')]||0x0;_0x525527['predictiveIntervalHitRate']=_0xb37e5e>0x0?_0xb37e5e:0x1;return _0x17ce5c['abandonmentRate'](_0x49d6cc,_0xfe7fbb,_0x48a20b,_0xb37e5e,_0x416af2);})['then'](function(_0x228424){return _0x442cb4(_0x228424);})[_0x7538('0xbc')](function(_0x328b88){return _0x53be11(msgResponse(_0x7538('0x1e9'),'Failure',JSON[_0x7538('0x4c')](_0x328b88)));});}if(_0x525527[_0x7538('0x1d3')]==='agentBusyFactor'){return _0x17ce5c[_0x7538('0xd2')](_0x525527['id'])['then'](function(_0x24ffcd){var _0x5c6a6b=_0x525527[_0x7538('0x54')]-_0x24ffcd[0x0][_0x7538('0x1e8')];var _0x42e37a=_0x525527[_0x7538('0x1d9')]*0x3c;var _0x7b5f4d=_0x395fd6[0x0][_0x7538('0x6f')]+_0x395fd6[0x0][_0x7538('0x8c')];var _0x522372=(_0x395fd6[0x0][_0x7538('0x6e')]+_0x395fd6[0x0][_0x7538('0x71')]+_0x395fd6[0x0][_0x7538('0x70')])/_0x395fd6[0x0][_0x7538('0x88')];var _0x2a965c=_0x525527[_0x7538('0x1e2')]/0x64;_0x525527[_0x7538('0x75')]=_0x24ffcd[0x0][_0x7538('0x1e8')]||0x0;_0x525527[_0x7538('0x73')]=_0x522372>0x0?_0x522372:0x1;return _0x17ce5c[_0x7538('0x1ea')](_0x5c6a6b,_0x42e37a,_0x7b5f4d,_0x522372,_0x2a965c);})['then'](function(_0x44ca3f){return _0x442cb4(_0x44ca3f);})[_0x7538('0xbc')](function(_0x48cd1e){return _0x53be11(msgResponse(_0x7538('0x1e9'),_0x7538('0x155'),JSON[_0x7538('0x4c')](_0x48cd1e)));});}}else{return _0x53be11(msgResponse('[getDataPredictive]','Failure',_0x7538('0x1e7')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x11af28){var _0x46f3fb=this;return function(){var _0x299983=0x0;var _0x4ce3d7=Math['floor'](_0x11af28[_0x7538('0x79')]*0x3e8);if(_0x4ce3d7>0x0){_0x4ce3d7=_0x4ce3d7<0x64?0x64:_0x4ce3d7;loggerPredictive[_0x7538('0x85')](_0x11af28['name'],_0x7538('0x1eb'),_0x4ce3d7,_0x7538('0x4d'));_0x11af28['handlePredictive']=setInterval(function(){_0x46f3fb[_0x7538('0x9b')](_0x11af28);loggerPredictiveCalls[_0x7538('0x85')](_0x7538('0x1ec'),_0x299983+=0x1);},_0x4ce3d7);}else{loggerPredictive['info'](_0x11af28[_0x7538('0x49')],_0x7538('0x1ed'));}};};Dialer[_0x7538('0xb8')][_0x7538('0x1ee')]=function(_0x1a5018,_0x76ed91){var _0x2bad93=this;return function(_0xea95bd){if(_['isEmpty'](_0xea95bd)){if(_[_0x7538('0xb9')](_0x76ed91[_0x7538('0xdf')])||!_0x76ed91[_0x7538('0x1ef')]){if(_0x1a5018[_0x7538('0x165')]===_0x7538('0x8')){_0x1a5018['queueStatusComplete']=_[_0x7538('0x42')](_0x1a5018[_0x7538('0x13a')])?!![]:_0x1a5018[_0x7538('0x13a')];var _0x2c71e6=uuid['v4']();_0x2bad93[_0x7538('0x27')][_0x2c71e6]=new Action(_0x1a5018,_0x76ed91,_0x2c71e6);loggerBooked[_0x7538('0x85')]('[booked][checkContactBlack]',_0x2c71e6,_0x7538('0x1f0'),JSON[_0x7538('0x4c')](_0x1a5018[_0x7538('0x13a')]),_0x7538('0x1f1'),_0x1a5018[_0x7538('0x49')]);if(_0x1a5018['queueStatusComplete']){_0x1a5018['queueStatusComplete']=![];_0x2bad93[_0x7538('0x136')][_0x2bad93[_0x7538('0x27')][_0x2c71e6][_0x7538('0xbf')]]=[];ami[_0x7538('0xba')]({'actionid':_0x2c71e6,'action':_0x7538('0x1f2'),'queue':_0x1a5018[_0x7538('0x49')]})[_0x7538('0xbc')](function(){_0x2bad93[_0x7538('0xbe')](_0x1a5018);_0x2bad93[_0x7538('0xcd')]({'active':![],'ContactId':_0x2bad93[_0x7538('0x27')][_0x2c71e6][_0x7538('0xde')],'ListId':_0x2bad93[_0x7538('0x27')][_0x2c71e6][_0x7538('0x108')],'VoiceQueueId':_0x2bad93[_0x7538('0x27')][_0x2c71e6][_0x7538('0xe0')]||undefined,'CampaignId':_0x2bad93['actions'][_0x2c71e6][_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch(_0x7538('0x1f3')));delete _0x2bad93[_0x7538('0x27')][_0x2c71e6];});}else{loggerBooked[_0x7538('0x85')](_0x7538('0x1f4'),JSON[_0x7538('0x4c')](_0x1a5018[_0x7538('0x13a')]),_0x7538('0x1f1'),_0x1a5018[_0x7538('0x49')]);_0x2bad93[_0x7538('0xbe')](_0x1a5018);_0x2bad93['rescheduleContact']({'active':![],'ContactId':_0x2bad93[_0x7538('0x27')][_0x2c71e6][_0x7538('0xde')],'ListId':_0x2bad93[_0x7538('0x27')][_0x2c71e6][_0x7538('0x108')],'VoiceQueueId':_0x2bad93[_0x7538('0x27')][_0x2c71e6][_0x7538('0xe0')]||undefined,'CampaignId':_0x2bad93['actions'][_0x2c71e6][_0x7538('0xe1')]||undefined})[_0x7538('0xbc')](loggerCatch(_0x7538('0x1f3')));delete _0x2bad93[_0x7538('0x27')][_0x2c71e6];}}else{return _0x2bad93['actionOriginate'](_0x1a5018,_0x76ed91);}}else{if(getDiff(_0x76ed91[_0x7538('0x1f5')])<_0x1a5018[_0x7538('0x1f6')]*0x3c){if(_0x76ed91['Agent']&&!_0x76ed91['Agent']['voicePause']){_0x2bad93[_0x7538('0x20')]['run'](_0x76ed91['id'])[_0x7538('0x1e')](function(){_0x2bad93['updateOriginated'](_0x1a5018);});}else{_0x2bad93[_0x7538('0xce')]({'active':![]},_0x76ed91['id'],0x1)[_0x7538('0x1e')](function(){_0x2bad93[_0x7538('0xbe')](_0x1a5018);});}}else{_0x1a5018[_0x7538('0x6b')]+=0x1;_0x2bad93[_0x7538('0xbe')](_0x1a5018);if(_0x1a5018[_0x7538('0x1f7')]){_0x2bad93['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x76ed91['ContactId'],'ListId':_0x76ed91[_0x7538('0x108')],'VoiceQueueId':_0x76ed91['VoiceQueueId']||undefined,'CampaignId':_0x76ed91[_0x7538('0xe1')]||undefined})['catch'](loggerCatch(_0x7538('0x1f8')));_0x2bad93[_0x7538('0xd5')](createObjHistory(_0x1a5018,_0x76ed91,_0x7538('0x1f9'),0x17,_0x7538('0x1fa')))[_0x7538('0xbc')](loggerCatch(_0x7538('0x1fb')));}else{_0x2bad93[_0x7538('0xdc')](createObjHistory(_0x1a5018,_0x76ed91,_0x7538('0x1fc'),0x16,_0x7538('0x1fd')),_0x7538('0x1fe'),_0x7538('0x1ff'));}}}}else{_0x1a5018[_0x7538('0x64')]+=0x1;_0x2bad93[_0x7538('0xdc')](createObjHistory(_0x1a5018,_0x76ed91,_0x7538('0x200'),0xd,_0x7538('0x201')),_0x7538('0x202'),_0x7538('0x203'));throw _0x7538('0x204');}};};Dialer[_0x7538('0xb8')][_0x7538('0x16b')]=function(_0x228181){var _0x5ee247=this;var _0x1ec45=_0x228181[_0x7538('0x205')]-_0x228181[_0x7538('0x77')]-_0x228181[_0x7538('0x206')];emitCampaignSummary(_0x228181);if(_0x1ec45>0x0){if(_0x1ec45>this['maxNumberOriginate']){_0x1ec45=this[_0x7538('0x25')];}_0x228181['temp']+=_0x1ec45;this[_0x7538('0xd1')](_0x228181['id'],_0x1ec45,_0x228181['dialOrderByScheduledAt'])[_0x7538('0xc3')](function(_0x4f50ad){_0x228181['temp']-=_0x1ec45;_0x228181[_0x7538('0x206')]=_0x228181['temp']>0x0?_0x228181[_0x7538('0x206')]:0x0;if(!checkContactEmpty(_0x4f50ad)){_0x228181[_0x7538('0x43')]=_0x7538('0xa9');logger[_0x7538('0x85')](_0x7538('0x207')+_0x228181[_0x7538('0x49')]);}else{_0x228181[_0x7538('0x77')]+=_0x4f50ad['length'];_0x228181[_0x7538('0x43')]=_0x7538('0x208');for(var _0x15ee87=0x0;_0x15ee87<_0x4f50ad[_0x7538('0x13f')];_0x15ee87+=0x1){_0x228181[_0x7538('0x209')]+=0x1;if(_[_0x7538('0xb9')](_0x4f50ad[_0x15ee87])||_['isNil'](_0x4f50ad[_0x15ee87][_0x7538('0x177')])||_[_0x7538('0xb9')](_0x4f50ad[_0x15ee87]['Contact'][_0x7538('0x178')])){_0x5ee247[_0x7538('0xda')](_0x7538('0x20a'),_0x228181,_0x4f50ad[_0x15ee87]);}else{_0x5ee247[_0x7538('0xca')](_[_0x7538('0xdd')](_0x4f50ad[_0x15ee87],[_0x7538('0xe1'),_0x7538('0x20b')]))['then'](_0x5ee247[_0x7538('0x1ee')](_0x228181,_0x4f50ad[_0x15ee87]))[_0x7538('0xbc')](_0x5ee247[_0x7538('0xd9')](_0x7538('0x20c'),_0x228181));}}}})[_0x7538('0xbc')](loggerGetContactDialer(_0x7538('0x20d'),_0x228181,_0x1ec45));}};Dialer['prototype'][_0x7538('0x167')]=function(_0x332c39,_0x13291a){var _0x374961=this;var _0x4dd967=[];var _0x12293c=_0x13291a>=0x1?_0x13291a:0x1;if(_0x332c39[_0x7538('0x165')]==='booked'){_0x12293c=0x1;}var _0x1c9c8b=Math[_0x7538('0x1cd')](_0x332c39['available']*_0x12293c)-_0x332c39['originated']-_0x332c39[_0x7538('0x206')];emitVoiceQueueSummary(_0x332c39);if(_0x332c39[_0x7538('0x20e')]>0x0){var _0x529db1=_0x332c39[_0x7538('0x20e')]-_0x332c39['originated']-_0x332c39[_0x7538('0x58')]-_0x332c39['temp']-_0x332c39[_0x7538('0xac')];if(_0x1c9c8b>_0x529db1){_0x1c9c8b=_0x529db1;}}if(_0x1c9c8b>0x0){if(_0x332c39[_0x7538('0x165')]===_0x7538('0x8')){_0x1c9c8b=0x1;}if(_0x1c9c8b>this[_0x7538('0x25')]){_0x1c9c8b=this[_0x7538('0x25')];}_0x332c39[_0x7538('0x206')]+=_0x1c9c8b;for(var _0x27282c in this['agents']){if(typeof this[_0x7538('0x23')][_0x27282c]!==_0x7538('0xa3')){if(this[_0x7538('0x23')][_0x27282c][_0x7538('0xf1')]===_0x7538('0x20f')&&this['agents'][_0x27282c][_0x7538('0xe8')]===_0x7538('0xe9')){_0x4dd967[_0x7538('0x137')](this['agents'][_0x27282c]['id']);}}}this[_0x7538('0xcf')](_0x332c39['id'],_0x4dd967,_0x1c9c8b,_0x332c39[_0x7538('0x210')])[_0x7538('0xc3')](function(_0x3b43c0){_0x332c39[_0x7538('0x206')]-=_0x1c9c8b;_0x332c39['temp']=_0x332c39[_0x7538('0x206')]>0x0?_0x332c39[_0x7538('0x206')]:0x0;if(!checkContactEmpty(_0x3b43c0)){_0x374961[_0x7538('0xc1')](_0x332c39)[_0x7538('0xc3')](sendMessageReschedule(_0x332c39))['catch'](loggerCatch(_0x7538('0x211')));}else{_0x332c39[_0x7538('0x77')]+=_0x3b43c0['length'];_0x332c39[_0x7538('0x43')]=_0x332c39['dialMethod']===_0x7538('0x8')?_0x7538('0x17f'):'RUNNING';for(var _0x3e3720=0x0;_0x3e3720<_0x3b43c0[_0x7538('0x13f')];_0x3e3720+=0x1){if(_[_0x7538('0xb9')](_0x3b43c0[_0x3e3720])||_[_0x7538('0xb9')](_0x3b43c0[_0x3e3720][_0x7538('0x177')])||_[_0x7538('0xb9')](_0x3b43c0[_0x3e3720][_0x7538('0x177')][_0x7538('0x178')])){_0x374961[_0x7538('0xda')]('[actionOriginate]\x20',_0x332c39,_0x3b43c0[_0x3e3720]);}else{_0x374961[_0x7538('0xc4')](_[_0x7538('0xdd')](_0x3b43c0[_0x3e3720],[_0x7538('0xe0'),'Contact.phone']))[_0x7538('0xc3')](_0x374961[_0x7538('0x1ee')](_0x332c39,_0x3b43c0[_0x3e3720]))['catch'](_0x374961[_0x7538('0xd9')]('[actionOriginate]\x20',_0x332c39));}}}})[_0x7538('0xbc')](loggerGetContactDialer(_0x7538('0x212'),_0x332c39,_0x1c9c8b));}};Dialer[_0x7538('0xb8')]['handlePredictive']=function(_0x4df681){if(_0x4df681[_0x7538('0x20e')]>0x0){var _0x4f7d95=_0x4df681['dialLimitQueue']-_0x4df681[_0x7538('0x77')]-_0x4df681['talking'];if(_0x4f7d95>0x0){this[_0x7538('0x213')](_0x4df681);}else{loggerPredictiveCalls[_0x7538('0x85')](_0x7538('0x214'));}}else{this[_0x7538('0x213')](_0x4df681);}};Dialer['prototype'][_0x7538('0x213')]=function(_0x4c14d4){var _0x3e2f77=this;var _0x415c84=[];_0x4c14d4[_0x7538('0x77')]+=0x1;for(var _0x536c3c in this[_0x7538('0x23')]){if(typeof this[_0x7538('0x23')][_0x536c3c]!==_0x7538('0xa3')){if(this[_0x7538('0x23')][_0x536c3c]['state']===_0x7538('0x20f')&&this['agents'][_0x536c3c][_0x7538('0xe8')]===_0x7538('0xe9')){_0x415c84[_0x7538('0x137')](this['agents'][_0x536c3c]['id']);}}}this[_0x7538('0xcf')](_0x4c14d4['id'],_0x415c84,0x1,_0x4c14d4['dialOrderByScheduledAt'])['then'](function(_0x5781dc){if(!checkContactEmpty(_0x5781dc)){checkContactLowerLimitOriginate(_0x4c14d4,0x1,0x0);_0x3e2f77['countReScheduled'](_0x4c14d4)[_0x7538('0xc3')](sendMessageReschedule(_0x4c14d4))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x4c14d4[_0x7538('0x43')]=_0x7538('0x208');if(_['isNil'](_0x5781dc[0x0])||_['isNil'](_0x5781dc[0x0][_0x7538('0x177')])||_['isNil'](_0x5781dc[0x0][_0x7538('0x177')][_0x7538('0x178')])){_0x3e2f77[_0x7538('0xda')]('[actionOriginate]\x20',_0x4c14d4,_0x5781dc[0x0]);}else{_0x3e2f77['checkIsBlackList'](_[_0x7538('0xdd')](_0x5781dc[0x0],[_0x7538('0xe0'),_0x7538('0x20b')]))[_0x7538('0xc3')](_0x3e2f77[_0x7538('0x1ee')](_0x4c14d4,_0x5781dc[0x0]))['catch'](_0x3e2f77[_0x7538('0xd9')](_0x7538('0x215'),_0x4c14d4));}}})[_0x7538('0xbc')](loggerGetContactDialer(_0x7538('0x216'),_0x4c14d4,0x1));emitVoiceQueueSummary(_0x4c14d4);};Dialer[_0x7538('0xb8')][_0x7538('0x1e3')]=function(_0x11421b,_0x420259,_0x1e40db,_0x20d70d,_0x2dc8a6,_0x55c34c){loggerPredictive[_0x7538('0x85')](_0x7538('0x217'));loggerPredictive[_0x7538('0x85')](_0x7538('0x218'),_0x11421b);loggerPredictive[_0x7538('0x85')](_0x7538('0x219'),_0x420259);loggerPredictive[_0x7538('0x85')](_0x7538('0x21a'),_0x1e40db);loggerPredictive[_0x7538('0x85')](_0x7538('0x21b'),_0x20d70d);loggerPredictive['info'](_0x7538('0x21c'),_0x2dc8a6);loggerPredictive[_0x7538('0x85')](_0x7538('0x8e'));return new BPromise(function(_0x4bca2d,_0x4014d2){if(_0x11421b<=0x0||isNaN(_0x11421b)){return _0x4014d2(msgResponse(_0x7538('0x21d'),'Error',_0x7538('0x21e')+_0x11421b));}if(_0x1e40db<=0x0||isNaN(_0x1e40db)){return _0x4014d2(msgResponse('[abandonmentRate]',_0x7538('0x19c'),_0x7538('0x21f')+_0x1e40db));}if(_0x20d70d<=0x0||isNaN(_0x20d70d)){return _0x4014d2(msgResponse('[abandonmentRate]',_0x7538('0x19c'),_0x7538('0x220')+_0x20d70d));}if(_0x420259<=0x0||isNaN(_0x420259)){return _0x4014d2(msgResponse(_0x7538('0x21d'),_0x7538('0x19c'),_0x7538('0x221')+_0x420259));}if(_0x2dc8a6<=0x0||isNaN(_0x2dc8a6)){return _0x4014d2(msgResponse(_0x7538('0x21d'),'Error',_0x7538('0x222')+_0x2dc8a6));}_0x55c34c=_0x55c34c||0x0;var _0xb69938=0x1/_0x1e40db;var _0x51828e=0x0;var _0x4cbe56=0x0;var _0x27cc38=0x0;var _0x5509cf=0x0;for(var _0x3cd7f1=0x0;_0x27cc38<_0x2dc8a6;_0x3cd7f1+=0x1){_0x4cbe56=_0x3cd7f1/_0x420259;_0x51828e=(_0x20d70d*_0x4cbe56+_0x55c34c)/_0xb69938;_0x27cc38=erlangb(_0x51828e,_0x11421b);_0x5509cf=_0x51828e/_0x11421b*(0x1-erlangb(_0x51828e,_0x11421b));}return _0x4bca2d({'erlangCalls':_0x3cd7f1,'erlangCallToSecond':_0x420259/_0x3cd7f1,'erlangAbandonmentRate':_0x27cc38,'erlangBusyFactor':_0x5509cf});});};Dialer['prototype'][_0x7538('0x1ea')]=function(_0x2417eb,_0x399a86,_0x4b2fa8,_0x1d8592,_0x560588,_0x2c7167){loggerPredictive[_0x7538('0x85')](_0x7538('0x223'));loggerPredictive[_0x7538('0x85')](_0x7538('0x218'),_0x2417eb);loggerPredictive[_0x7538('0x85')](_0x7538('0x219'),_0x399a86);loggerPredictive[_0x7538('0x85')](_0x7538('0x21a'),_0x4b2fa8);loggerPredictive[_0x7538('0x85')](_0x7538('0x21b'),_0x1d8592);loggerPredictive[_0x7538('0x85')](_0x7538('0x224'),_0x560588);loggerPredictive[_0x7538('0x85')](_0x7538('0x8e'));return new BPromise(function(_0x44ce91,_0xfd15e4){if(_0x2417eb<=0x0||isNaN(_0x2417eb)){return _0xfd15e4(msgResponse('[busyFactor]',_0x7538('0x19c'),_0x7538('0x21e')+_0x2417eb));}if(_0x4b2fa8<=0x0||isNaN(_0x4b2fa8)){return _0xfd15e4(msgResponse('[busyFactor]',_0x7538('0x19c'),_0x7538('0x21f')+_0x4b2fa8));}if(_0x1d8592<=0x0||isNaN(_0x1d8592)){return _0xfd15e4(msgResponse('[busyFactor]',_0x7538('0x19c'),_0x7538('0x220')+_0x1d8592));}if(_0x399a86<=0x0||isNaN(_0x399a86)){return _0xfd15e4(msgResponse(_0x7538('0x225'),'Error','interval\x20=\x20'+_0x399a86));}if(_0x560588<=0x0||isNaN(_0x560588)){return _0xfd15e4(msgResponse(_0x7538('0x225'),_0x7538('0x19c'),_0x7538('0x226')+_0x560588));}_0x2c7167=_0x2c7167||0x0;var _0x4ea725=0x1/_0x4b2fa8;var _0x2d7e20=0x0;var _0x536982=0x0;var _0x47f286=0x0;var _0x9a5813=0x0;for(var _0x3b5bb5=0x0;_0x9a5813<_0x560588;_0x3b5bb5+=0x1){_0x536982=_0x3b5bb5/_0x399a86;_0x2d7e20=(_0x1d8592*_0x536982+_0x2c7167)/_0x4ea725;_0x47f286=erlangb(_0x2d7e20,_0x2417eb);_0x9a5813=_0x2d7e20/_0x2417eb*(0x1-erlangb(_0x2d7e20,_0x2417eb));}return _0x44ce91({'erlangCalls':_0x3b5bb5,'erlangCallToSecond':_0x399a86/_0x3b5bb5,'erlangAbandonmentRate':_0x47f286,'erlangBusyFactor':_0x9a5813});});};module['exports']=Dialer; \ No newline at end of file +var _0x70e0=['actions','[actions]','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','saveInDb','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnosuchnumberretry','stateGlobal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','Drop','TIMEOUT','dialDropRetryFrequency','additional','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','pick','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','SIP/%s/%s%s','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','[callProgressDetecting]\x20','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[getDataPredictive]','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','booked','predictiveCalls','../../../config/logger','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','env','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','stack','undefined','originated','error','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels'];(function(_0x179662,_0x4aeb98){var _0x4e5a53=function(_0x25c512){while(--_0x25c512){_0x179662['push'](_0x179662['shift']());}};_0x4e5a53(++_0x4aeb98);}(_0x70e0,0x17b));var _0x070e=function(_0x3cf206,_0x4bec11){_0x3cf206=_0x3cf206-0x0;var _0x3d5423=_0x70e0[_0x3cf206];return _0x3d5423;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var BPromise=require(_0x070e('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x070e('0x3'));var Redis=require(_0x070e('0x4'));var ut=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var logger=require('../../../config/logger')(_0x070e('0x7'));var loggerBooked=require('../../../config/logger')(_0x070e('0x8'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x070e('0x9'));var loggerSyncQueueSummary=require(_0x070e('0xa'))(_0x070e('0xb'));var ami=require(_0x070e('0xc'));config[_0x070e('0xd')]=_[_0x070e('0xe')](config[_0x070e('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x070e('0xd')]));var cmHopper=require(_0x070e('0xf'));var cmHopperHistory=require(_0x070e('0x10'));var cmHopperFinal=require(_0x070e('0x11'));var cmHopperAdditionalPhone=require(_0x070e('0x12'));var cmHopperBlack=require(_0x070e('0x13'));var voiceQueueRt=require(_0x070e('0x14'));var Action=require(_0x070e('0x15'));var History=require(_0x070e('0x16'));var Final=require(_0x070e('0x17'));var AgentComplete=require(_0x070e('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x070e('0x19')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x070e('0x1a')};var Sequence=function(){};Sequence[_0x070e('0x1b')]['enqueue']=function(_0x5d3a38){this[_0x070e('0x1c')]=this[_0x070e('0x1c')]?this[_0x070e('0x1c')][_0x070e('0x1d')](_0x5d3a38):_0x5d3a38();};function Dialer(_0x5bc71e,_0x49861b){this[_0x070e('0x1e')]=new Sequence();this[_0x070e('0x1f')]=_0x49861b;this[_0x070e('0x20')]=_0x5bc71e[_0x070e('0x20')];this[_0x070e('0x21')]=_0x5bc71e['campaigns'];this[_0x070e('0x22')]=_0x5bc71e[_0x070e('0x22')];this[_0x070e('0x23')]=_0x5bc71e[_0x070e('0x23')];this[_0x070e('0x24')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0x070e('0x25')]={};this[_0x070e('0x26')]={};this[_0x070e('0x27')]={};this['startPredictive']={};this[_0x070e('0x28')]={};this['ivrOriginated']={};this[_0x070e('0x29')]={};this[_0x070e('0x2a')]={};ami['on'](_0x070e('0x2b'),this[_0x070e('0x2c')][_0x070e('0x2d')](this));ami['on'](_0x070e('0x2e'),this[_0x070e('0x2f')][_0x070e('0x2d')](this));ami['on']('originateresponse',this[_0x070e('0x30')][_0x070e('0x2d')](this));ami['on'](_0x070e('0x31'),this['syncAgentComplete'][_0x070e('0x2d')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x070e('0x2d')](this));ami['on'](_0x070e('0x32'),this[_0x070e('0x33')][_0x070e('0x2d')](this));ami['on'](_0x070e('0x34'),this['syncNewExten'][_0x070e('0x2d')](this));ami['on'](_0x070e('0x35'),this[_0x070e('0x36')][_0x070e('0x2d')](this));ami['on'](_0x070e('0x37'),this[_0x070e('0x38')][_0x070e('0x2d')](this));ami['on'](_0x070e('0x39'),this['syncQueueStatusComplete'][_0x070e('0x2d')](this));this[_0x070e('0x3a')]();this[_0x070e('0x3b')]();}function isNotNull(_0x56fc12){return _0x56fc12!==null&&!_['isUndefined'](_0x56fc12);}function checkIsLoggedIn(_0x13097f,_0x46065c){return function(){if(_0x46065c<=0x0){_0x13097f[_0x070e('0x3c')]='AGENTS_NOT_LOGGED';throw _0x13097f[_0x070e('0x3d')]+_0x070e('0x3e');}};}function isActive(_0x3a9425){return _0x3a9425;}function checkIsActive(_0x5f2bee,_0x53d473){return function(){if(!isActive(_0x53d473)){_0x5f2bee['message']='NOT_ACTIVE';throw _0x5f2bee['name']+_0x070e('0x3f');}};}function checkInterval(_0x4e0a7d){return function(){if(!isNotNull(_0x4e0a7d[_0x070e('0x40')])){_0x4e0a7d[_0x070e('0x3c')]='INTERVAL_IS_NULL';throw _0x4e0a7d['name']+_0x070e('0x41');}if(!isNotNull(_0x4e0a7d[_0x070e('0x40')]['Intervals'])){_0x4e0a7d['message']=_0x070e('0x42');throw _0x4e0a7d[_0x070e('0x3d')]+_0x070e('0x41');}if(!isNotNull(_[_0x070e('0x43')](_0x4e0a7d[_0x070e('0x40')]['Intervals']))){_0x4e0a7d['message']=_0x070e('0x42');throw _0x4e0a7d[_0x070e('0x3d')]+_0x070e('0x41');}};}function msgResponse(_0xf57ed,_0xf11439,_0x4deaf8){return{'action':_0xf57ed,'response':_0xf11439,'message':_0x4deaf8,'stack':_0x4deaf8};}function myreject(_0x22f3a9){return function(_0x1927f4){return _0x22f3a9(msgResponse('[ifTime][Action]',_0x070e('0x44'),JSON[_0x070e('0x45')](_0x1927f4)));};}function getSeconds(_0x4ba6f0,_0x4d4ee8){var _0x5ddbe9=moment(_0x4ba6f0)[_0x070e('0x46')](0x0);var _0x3dfbf7=moment(_0x4d4ee8)[_0x070e('0x46')](0x0);return _0x5ddbe9[_0x070e('0x47')](_0x3dfbf7,_0x070e('0x48'));}function emit(_0x5e3827,_0x104048,_0xa1bb20){io['to'](_0x5e3827)[_0x070e('0x49')](_0x104048,_0xa1bb20);}function emitVoiceQueueSummary(_0x487276){if(_0x487276[_0x070e('0x4a')]===_0x070e('0x4b')){var _0x165c16={'id':_0x487276['id'],'name':_0x487276['name'],'strategy':_0x487276[_0x070e('0x4c')],'answered':_0x487276[_0x070e('0x4d')],'available':_0x487276['available'],'loggedIn':_0x487276[_0x070e('0x4e')],'pTalking':_0x487276['pTalking'],'sumBillable':_0x487276[_0x070e('0x4f')],'sumDuration':_0x487276[_0x070e('0x50')],'sumHoldTime':_0x487276[_0x070e('0x51')]||0x0,'talking':_0x487276[_0x070e('0x52')],'total':_0x487276[_0x070e('0x53')],'type':_0x487276['type'],'unmanaged':_0x487276[_0x070e('0x54')],'abandoned':_0x487276['abandoned'],'waiting':_0x487276['waiting'],'loggedInDb':_0x487276[_0x070e('0x55')],'dialActive':_0x487276[_0x070e('0x56')],'dialMethod':_0x487276[_0x070e('0x57')],'dialOriginateCallerIdName':_0x487276['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x487276[_0x070e('0x58')],'dialOriginateTimeout':_0x487276[_0x070e('0x59')],'dialPrefix':_0x487276[_0x070e('0x5a')],'outboundAnswerAgiCallsDay':_0x487276[_0x070e('0x5b')],'outboundAnswerCallsDay':_0x487276['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x487276[_0x070e('0x5c')],'outboundBusyCallsDay':_0x487276['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x487276['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x487276['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x487276[_0x070e('0x5d')],'outboundDropCallsDayTimeout':_0x487276[_0x070e('0x5e')],'outboundNoAnswerCallsDay':_0x487276[_0x070e('0x5f')],'outboundNoSuchCallsDay':_0x487276[_0x070e('0x60')],'outboundOriginateFailureCallsDay':_0x487276[_0x070e('0x61')],'outboundReCallsDay':_0x487276['outboundReCallsDay'],'outboundRejectCallsDay':_0x487276[_0x070e('0x62')],'outboundUnknownCallsDay':_0x487276['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x487276[_0x070e('0x63')],'predictiveIntervalAvgHoldtime':_0x487276[_0x070e('0x64')],'predictiveIntervalAvgTalktime':_0x487276[_0x070e('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x487276['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x487276['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x487276[_0x070e('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x487276['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x487276[_0x070e('0x67')],'predictiveIntervalMultiplicativeFactor':_0x487276[_0x070e('0x68')],'predictiveIntervalPauses':_0x487276[_0x070e('0x69')],'predictiveIntervalAvailable':_0x487276['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x487276[_0x070e('0x6a')],'message':_0x487276[_0x070e('0x3c')],'originated':_0x487276['originated'],'erlangCalls':_0x487276['erlangCalls'],'erlangCallToSecond':_0x487276[_0x070e('0x6b')],'erlangAbandonmentRate':_0x487276[_0x070e('0x6c')],'erlangBusyFactor':_0x487276[_0x070e('0x6d')],'startPredictive':_0x487276[_0x070e('0x6e')],'startProgressive':_0x487276[_0x070e('0x28')]};if(_0x487276['Trunk']){_0x165c16[_0x070e('0x6f')]={'id':_0x487276[_0x070e('0x6f')]['id'],'name':_0x487276[_0x070e('0x6f')][_0x070e('0x3d')],'active':_0x487276[_0x070e('0x6f')][_0x070e('0x70')],'callerid':_0x487276[_0x070e('0x6f')][_0x070e('0x71')]};}if(_0x487276[_0x070e('0x40')]){_0x165c16[_0x070e('0x40')]={'id':_0x487276[_0x070e('0x40')]['id'],'name':_0x487276[_0x070e('0x40')][_0x070e('0x3d')]};}var _0x216d27=md5(JSON[_0x070e('0x45')](_0x165c16));if(_0x487276['md5']!==_0x216d27){_0x487276[_0x070e('0x3')]=_0x216d27;emit(util[_0x070e('0x72')](_0x070e('0x73'),_0x165c16[_0x070e('0x3d')]),_0x070e('0x74'),_0x165c16);}}}function emitCampaignSummary(_0x3bd738){if(_0x3bd738[_0x070e('0x4a')]===_0x070e('0x75')){emit(util[_0x070e('0x72')]('campaign:ivr:%s',_0x3bd738[_0x070e('0x3d')]),'campaign:save',_0x3bd738);}}function checkGetDataPredictive(_0x1acddb){if(isNotNull(_0x1acddb)&&!_[_0x070e('0x43')](_0x1acddb)){loggerPredictive['info'](_0x070e('0x76'));loggerPredictive[_0x070e('0x77')](_0x070e('0x78'),_0x1acddb[_0x070e('0x6a')]);loggerPredictive[_0x070e('0x77')](_0x070e('0x79'),_0x1acddb[_0x070e('0x63')]);loggerPredictive['info'](_0x070e('0x7a'),_0x1acddb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x070e('0x7b'),_0x1acddb[_0x070e('0x7c')]);loggerPredictive[_0x070e('0x77')](_0x070e('0x7d'),_0x1acddb[_0x070e('0x64')]);loggerPredictive[_0x070e('0x77')](_0x070e('0x7e'),_0x1acddb[_0x070e('0x65')]);loggerPredictive['info'](_0x070e('0x7f'));if(_0x1acddb['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x1acddb[_0x070e('0x65')])&&_0x1acddb[_0x070e('0x65')]>0x0){return!![];}loggerPredictive['info'](_0x070e('0x80'));if(!_[_0x070e('0x81')](_0x1acddb[_0x070e('0x64')])&&_0x1acddb[_0x070e('0x64')]>0x0){return!![];}loggerPredictive[_0x070e('0x77')](_0x070e('0x82'));}else{loggerPredictive[_0x070e('0x77')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3087e5){return function(_0x1948a5){loggerPredictive[_0x070e('0x77')](_0x070e('0x83'));loggerPredictive['info'](_0x070e('0x84'),_0x1948a5['erlangCalls']);loggerPredictive[_0x070e('0x77')](_0x070e('0x85'),_0x1948a5[_0x070e('0x6b')]);loggerPredictive[_0x070e('0x77')](_0x070e('0x86'),_0x1948a5[_0x070e('0x6c')]);loggerPredictive['info'](_0x070e('0x87'),_0x1948a5[_0x070e('0x6d')]);loggerPredictive[_0x070e('0x77')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1948a5[_0x070e('0x6c')]);loggerPredictive[_0x070e('0x77')]('---------------------------');_[_0x070e('0x88')](_0x3087e5,_0x1948a5);};}function getDiff(_0x4e8dfc){var _0xc89f90=moment()['milliseconds'](0x0);var _0x4cb86f=moment(_0x4e8dfc)['milliseconds'](0x0);return _0xc89f90[_0x070e('0x47')](_0x4cb86f,_0x070e('0x48'));}function ifInterval(_0x1100d8,_0x122198){if(_[_0x070e('0x81')](_0x122198)){return![];}return getDiff(_0x122198)<_0x1100d8*0x3c;}function freeVariablesPredictive(_0x3a00bb){if(isNotNull(_0x3a00bb)){if(!_['isUndefined'](_0x3a00bb[_0x070e('0x28')])){_0x3a00bb['startProgressive']=undefined;loggerPredictive[_0x070e('0x77')](_0x3a00bb['name'],_0x070e('0x89'));}if(!_[_0x070e('0x81')](_0x3a00bb['startPredictive'])){_0x3a00bb[_0x070e('0x6e')]=undefined;loggerPredictive['info'](_0x3a00bb[_0x070e('0x3d')],_0x070e('0x8a'));}if(!_[_0x070e('0x81')](_0x3a00bb[_0x070e('0x8b')])){clearInterval(_0x3a00bb[_0x070e('0x8b')]);_0x3a00bb[_0x070e('0x8b')]=undefined;loggerPredictive[_0x070e('0x77')](_0x3a00bb[_0x070e('0x3d')],_0x070e('0x8c'));}}}function erlangb(_0x3332d0,_0x40c560){if(_0x40c560===0x0){return 0x0;}var _0x16887c=0x1;for(var _0x455bf2=0x1;_0x455bf2<=_0x40c560;_0x455bf2+=0x1){_0x16887c=0x1+_0x16887c*_0x455bf2/_0x3332d0;}return 0x1/_0x16887c;}function isVoiceQueueOutbound(_0x20bcf3){return _0x20bcf3==='outbound';}function isNotPreview(_0x45bf20){return _0x45bf20!==_0x070e('0x1f');}function isCampaignIvr(_0x381c83){return _0x381c83===_0x070e('0x75');}function getCallerId(_0x5712d1,_0x2ccd8d,_0x4e8e58){if(!_[_0x070e('0x81')](_0x4e8e58)&&typeof _0x4e8e58===_0x070e('0x8d')&&!_[_0x070e('0x43')](_0x4e8e58)){if(!_[_0x070e('0x81')](_0x2ccd8d)&&typeof _0x2ccd8d==='string'&&!_[_0x070e('0x43')](_0x2ccd8d)){return util[_0x070e('0x72')](_0x070e('0x8e'),_0x2ccd8d,_0x4e8e58);}return util[_0x070e('0x72')]('\x22%s\x22\x20<%s>',_0x4e8e58,_0x4e8e58);}if(!_[_0x070e('0x81')](_0x5712d1)&&typeof _0x5712d1==='string'&&!_[_0x070e('0x43')](_0x5712d1)){return _0x5712d1;}return _0x070e('0x8f');}function loggerCatchQueueSummary(_0x3a1ad2,_0x150bf6){return function(_0x2a20d4){freeVariablesPredictive(_0x150bf6);emitVoiceQueueSummary(_0x150bf6);emitCampaignSummary(_0x150bf6);loggerSyncQueueSummary['error'](_0x3a1ad2,util[_0x070e('0x90')](_0x2a20d4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2e38c6,_0x8cc913){return function(_0x114bcf){loggerPredictive['error'](_0x8cc913[_0x070e('0x3d')],_0x2e38c6);loggerPredictive['error'](_0x114bcf[_0x070e('0x91')]);freeVariablesPredictive(_0x8cc913);};}function loggerCatch(_0x44e465){return function(_0x1214d2){logger['error'](_0x44e465,util[_0x070e('0x90')](_0x1214d2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4d344c){return _0x4d344c&&!_[_0x070e('0x81')](_0x4d344c)&&_0x4d344c['length']>0x0;}function decremetOriginate(_0x381271){if(!_[_0x070e('0x81')](_0x381271)&&_0x381271!==null){if(typeof _0x381271['originated']!==_0x070e('0x92')){if(_0x381271['originated']>0x0){_0x381271[_0x070e('0x93')]-=0x1;}else{logger[_0x070e('0x94')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x070e('0x95'));}}function checkContactLowerLimitOriginate(_0x3022cd,_0xf67cfd,_0x17cf15){if(_0xf67cfd>_0x17cf15){for(var _0x25f1d0=0x0;_0x25f1d0<_0xf67cfd-_0x17cf15;_0x25f1d0+=0x1){decremetOriginate(_0x3022cd);}}}function loggerGetContactDialer(_0x26c5c3,_0x280d62,_0x332c8a){return function(_0x25b599){checkContactLowerLimitOriginate(_0x280d62,_0x332c8a,0x0);logger[_0x070e('0x94')](_0x26c5c3,util[_0x070e('0x90')](_0x25b599,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x25670e){return function(_0x1d3af4){if(isNotNull(_0x1d3af4)&&isNotNull(_0x1d3af4[0x0])){if(_0x1d3af4[0x0]['contactsRescheduled']>0x0){_0x25670e[_0x070e('0x3c')]=_0x070e('0x96');logger['info']('[getContactDialer2][ReScheduled]'+_0x25670e[_0x070e('0x3d')],_0x1d3af4[0x0][_0x070e('0x97')],_0x070e('0x98'));}else{_0x25670e[_0x070e('0x3c')]=_0x070e('0x99');logger[_0x070e('0x77')](_0x070e('0x9a')+_0x25670e[_0x070e('0x3d')]);}}};}function notSendMessagesQueue(_0x24ac0f){if(_0x24ac0f[_0x070e('0x9b')]){freeVariablesPredictive(_0x24ac0f);if(_0x24ac0f[_0x070e('0x93')]===0x0&&_0x24ac0f[_0x070e('0x52')]===0x0&&_0x24ac0f[_0x070e('0x9c')]===0x0&&(_0x24ac0f['pTalking']||0x0)===0x0){_0x24ac0f['sendMessageOneNotActive']=![];_0x24ac0f['available']=0x0;_0x24ac0f[_0x070e('0x3c')]=_0x070e('0x9d');loggerSyncQueueSummary[_0x070e('0x94')](_0x070e('0x9e'),_0x24ac0f['name'],_0x070e('0x9f'));}else{_0x24ac0f[_0x070e('0x3c')]=_0x070e('0xa0');loggerSyncQueueSummary[_0x070e('0x94')](_0x070e('0x9e'),_0x24ac0f[_0x070e('0x3d')],'is\x20disactive');}emitVoiceQueueSummary(_0x24ac0f);}}function notSendMessagesCampaign(_0xb2954d){if(_0xb2954d['sendMessageOneNotActive']){if(_0xb2954d[_0x070e('0x93')]===0x0){_0xb2954d[_0x070e('0x9b')]=![];_0xb2954d[_0x070e('0x3c')]=_0x070e('0x9d');loggerSyncQueueSummary[_0x070e('0x94')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xb2954d[_0x070e('0x3d')],_0x070e('0x9f'));}else{_0xb2954d['message']=_0x070e('0xa0');loggerSyncQueueSummary[_0x070e('0x94')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xb2954d[_0x070e('0x3d')],_0x070e('0xa1'));}emitCampaignSummary(_0xb2954d);}}function createObjHistory(_0xf0aef8,_0x4da906,_0x40d7e6,_0xe8c476,_0x134b72){_0xf0aef8[_0x070e('0x3c')]=_0x40d7e6;var _0x2082a8=new Action(_0xf0aef8,_0x4da906);var _0x17975c=new History(_0x2082a8);_0x17975c[_0x070e('0xa2')]=_0xe8c476;_0x17975c[_0x070e('0xa3')]=_0x134b72;_0x17975c[_0x070e('0xa4')]=_0x2082a8[_0x070e('0xa5')];return _0x17975c;}Dialer[_0x070e('0x1b')][_0x070e('0x3b')]=function(){var _0x18c27a=this;setInterval(function(){_0x18c27a['clearZombieChannels'](_0x18c27a[_0x070e('0x26')],_0x070e('0xa6'));_0x18c27a[_0x070e('0xa7')](_0x18c27a[_0x070e('0xa8')],_0x070e('0xa9'));},0x32c8);};Dialer[_0x070e('0x1b')]['clearZombieChannels']=function(_0x55f135,_0x4a8563){var _0x3c9abf=this;for(var _0x44a9f0 in _0x55f135){if(typeof _0x55f135[_0x44a9f0]!==_0x070e('0x92')){this[_0x070e('0x1e')]['enqueue'](function(){if(!_[_0x070e('0xaa')](_0x55f135[_0x44a9f0])){return ami[_0x070e('0xab')]({'action':_0x070e('0xac'),'channel':_0x55f135[_0x44a9f0]['channel']})[_0x070e('0xad')](function(_0x48c011){if(_0x48c011[_0x070e('0x3c')]===_0x070e('0xae')){setTimeout(function(){if(_0x55f135[_0x44a9f0]&&_0x55f135[_0x44a9f0]['type']!=='ivr'){_0x3c9abf[_0x070e('0xaf')](_0x3c9abf[_0x070e('0x20')][_0x55f135[_0x44a9f0]['queue']]);logger[_0x070e('0x94')]('[Dialer][checkChannel]',_0x4a8563,_0x44a9f0,_0x55f135[_0x44a9f0]['queue']);delete _0x55f135[_0x44a9f0];}if(_0x55f135[_0x44a9f0]&&_0x55f135[_0x44a9f0]['type']===_0x070e('0x75')){_0x3c9abf[_0x070e('0xaf')](_0x3c9abf[_0x070e('0x21')][_0x55f135[_0x44a9f0][_0x070e('0xb0')]]);logger[_0x070e('0x94')](_0x070e('0xb1'),_0x4a8563,_0x44a9f0,_0x55f135[_0x44a9f0][_0x070e('0xb0')]);delete _0x55f135[_0x44a9f0];}},0x2328);}});}});}}};Dialer[_0x070e('0x1b')][_0x070e('0xb2')]=function(_0xdcc60a){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](cmHopper[_0x070e('0xb2')](_0xdcc60a))[_0x070e('0xad')](loggerCatch(_0x070e('0xb5')));};Dialer[_0x070e('0x1b')][_0x070e('0xb6')]=function(_0x3f9e15){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](cmHopperBlack[_0x070e('0xb6')](_0x3f9e15))[_0x070e('0xad')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x070e('0x1b')][_0x070e('0xb7')]=function(_0x449337,_0xe50b1b,_0x495403){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](cmHopperAdditionalPhone[_0x070e('0xb7')](_0x449337,_0xe50b1b,_0x495403))[_0x070e('0xad')](loggerCatch(_0x070e('0xb8')));};Dialer[_0x070e('0x1b')]['swapAdditionalPhones']=function(_0x5918ed,_0x524a81,_0x33ef0d){return BPromise['resolve']()[_0x070e('0xb4')](cmHopperAdditionalPhone[_0x070e('0xb9')](_0x5918ed,_0x524a81,_0x33ef0d))['catch'](loggerCatch(_0x070e('0xba')));};Dialer[_0x070e('0x1b')]['checkIsBlackListIvr']=function(_0x56f389){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](cmHopperBlack[_0x070e('0xbb')](_0x56f389))[_0x070e('0xad')](loggerCatch(_0x070e('0xbc')));};Dialer['prototype'][_0x070e('0xbd')]=function(_0x56e3da){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](cmHopperHistory['avgHandleTime'](_0x56e3da))[_0x070e('0xad')](loggerCatch(_0x070e('0xbe')));};Dialer[_0x070e('0x1b')][_0x070e('0xbf')]=function(_0x174ca6){return BPromise[_0x070e('0xb3')]()['then'](cmHopper[_0x070e('0xbf')](_0x174ca6))[_0x070e('0xad')](loggerCatch(_0x070e('0xc0')));};Dialer[_0x070e('0x1b')][_0x070e('0xc1')]=function(_0x4b3282,_0x2531f7,_0x3f03aa){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](cmHopper[_0x070e('0xc1')](_0x4b3282,_0x2531f7,_0x3f03aa))[_0x070e('0xad')](loggerCatch(_0x070e('0xc2')));};Dialer[_0x070e('0x1b')][_0x070e('0xc3')]=function(_0xfe61be,_0x1e14b5,_0x2614b2,_0x2ea439){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](cmHopper[_0x070e('0xc3')](_0xfe61be,_0x1e14b5,_0x2614b2,_0x2ea439))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x070e('0x1b')][_0x070e('0xc4')]=function(_0x4ceba3,_0x5d8c9f,_0x5d8f66){return BPromise['resolve']()[_0x070e('0xb4')](cmHopper[_0x070e('0xc4')](_0x4ceba3,_0x5d8c9f,_0x5d8f66))[_0x070e('0xad')](loggerCatch(_0x070e('0xc5')));};Dialer[_0x070e('0x1b')][_0x070e('0xc6')]=function(_0x32cfe3){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](voiceQueueRt[_0x070e('0xc6')](_0x32cfe3))['catch'](loggerCatch(_0x070e('0xc7')));};Dialer[_0x070e('0x1b')]['moveContactManagedDialer']=function(_0x30db4a){return BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](cmHopper[_0x070e('0xc8')](_0x30db4a))['catch'](loggerCatch(_0x070e('0xc9')));};Dialer[_0x070e('0x1b')][_0x070e('0xca')]=function(_0x46d83e){return BPromise['resolve']()[_0x070e('0xb4')](cmHopperHistory[_0x070e('0xca')](_0x46d83e))[_0x070e('0xad')](loggerCatch(_0x070e('0xcb')));};Dialer[_0x070e('0x1b')][_0x070e('0xaf')]=function(_0x1a4ed1){if(!_[_0x070e('0x81')](_0x1a4ed1)&&_0x1a4ed1!==null){if(typeof _0x1a4ed1[_0x070e('0x93')]!==_0x070e('0x92')){if(_0x1a4ed1[_0x070e('0x93')]>0x0){_0x1a4ed1['originated']-=0x1;}else{logger[_0x070e('0x94')](_0x070e('0xcc'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x070e('0x1b')]['loggerHandler']=function(_0x2c759a,_0x24612f){var _0x34606a=this;return function(_0x1f6e07){_0x34606a[_0x070e('0xaf')](_0x24612f);logger[_0x070e('0x94')](_0x2c759a,util[_0x070e('0x90')](_0x1f6e07,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x070e('0xcd')]=function(_0x468f08,_0x2543df,_0x2a80bd){var _0x4a9c99={'state':0x19,'statedesc':'notFound'};this[_0x070e('0xaf')](_0x2543df);this[_0x070e('0xce')](_[_0x070e('0x88')](_0x4a9c99,_['pick'](_0x2a80bd,[_0x070e('0xcf'),_0x070e('0xd0'),'UserId',_0x070e('0xd1'),_0x070e('0xd2')])),_0x070e('0xd3'),_0x070e('0xd4'));logger[_0x070e('0x94')](_0x468f08);};Dialer[_0x070e('0x1b')]['isSuccess']=function(_0x58c3d7){return _0x58c3d7===_0x070e('0xd5');};Dialer['prototype'][_0x070e('0xd6')]=function(_0x270d47){return!_['isUndefined'](_0x270d47)&&_0x270d47&&!_[_0x070e('0x81')](_0x270d47['name'])&&!_[_0x070e('0x81')](_0x270d47[_0x070e('0x70')])&&_0x270d47[_0x070e('0x70')]&&(this[_0x070e('0x23')][util[_0x070e('0x72')](_0x070e('0xd7'),_0x270d47['name'])][_0x070e('0xac')]===_0x070e('0xd8')||this['trunks'][util['format'](_0x070e('0xd7'),_0x270d47[_0x070e('0x3d')])][_0x070e('0xac')]===_0x070e('0xd9'));};Dialer[_0x070e('0x1b')][_0x070e('0xce')]=function(_0x42bf72,_0x442cca,_0x501885){this[_0x070e('0xca')](_0x42bf72)[_0x070e('0xad')](loggerCatch(_0x442cca));this[_0x070e('0xc8')](_0x42bf72)[_0x070e('0xad')](loggerCatch(_0x501885));};Dialer[_0x070e('0x1b')][_0x070e('0x36')]=function(_0xe2a5b4){var _0x85163b=this['uniqueId'][_0xe2a5b4[_0x070e('0xda')]];var _0x1f1501;if(!_[_0x070e('0xaa')](_0xe2a5b4)&&!_[_0x070e('0xaa')](_0xe2a5b4[_0x070e('0xdb')])&&!_[_0x070e('0xaa')](_0xe2a5b4[_0x070e('0xdb')][_0x070e('0xdc')])&&_0xe2a5b4[_0x070e('0xdd')]===_0x070e('0xde')&&_0x85163b){if(_0x85163b['type']!=='ivr'&&this[_0x070e('0x20')][_0x85163b[_0x070e('0xb0')]][_0x070e('0xdf')]&&_0xe2a5b4['value']===_0x070e('0xe0')){delete this[_0x070e('0x26')][_0xe2a5b4['uniqueid']];this[_0x070e('0xaf')](this[_0x070e('0x20')][_0x85163b[_0x070e('0xb0')]]);this[_0x070e('0x20')][_0x85163b[_0x070e('0xb0')]][_0x070e('0xe1')]+=0x1;this['voiceQueues'][_0x85163b['queue']][_0x070e('0x5b')]+=0x1;_0x1f1501=new Hangup(_0x85163b,_0xe2a5b4);_0x1f1501[_0x070e('0xa2')]=0x12;_0x1f1501['statedesc']=_0x070e('0xe2');_0x1f1501[_0x070e('0xe3')]=_0x070e('0xe4');this[_0x070e('0xce')](_0x1f1501,_0x070e('0xe5'),_0x070e('0xe6'));}if(_0x85163b['type']!==_0x070e('0x75')&&this[_0x070e('0x20')][_0x85163b['queue']][_0x070e('0xdf')]&&_0xe2a5b4[_0x070e('0xe7')]===_0x070e('0xe8')){var _0x5d8e1a=this;return new BPromise(function(_0x4b6569,_0x4c621a){delete _0x5d8e1a[_0x070e('0x26')][_0xe2a5b4[_0x070e('0xda')]];_0x5d8e1a[_0x070e('0xaf')](_0x5d8e1a[_0x070e('0x20')][_0x85163b[_0x070e('0xb0')]]);_0x5d8e1a[_0x070e('0x20')][_0x85163b[_0x070e('0xb0')]][_0x070e('0xe1')]+=0x1;_0x5d8e1a[_0x070e('0x20')][_0x85163b[_0x070e('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3759a6=_0x5d8e1a[_0x070e('0x20')][_0x85163b[_0x070e('0xb0')]];var _0x205fc7=new Hangup(_0x85163b,_0xe2a5b4);_0x205fc7['state']=0x13;_0x205fc7[_0x070e('0xa3')]=_0x070e('0xe9');_0x205fc7['membername']='AMD';_0x205fc7[_0x070e('0xea')]+=0x1;_0x205fc7[_0x070e('0xeb')]+=0x1;_0x205fc7[_0x070e('0xec')]=!![];_0x5d8e1a['createHistory'](_0x205fc7)[_0x070e('0xad')](loggerCatch(_0x070e('0xed')));if(_0x205fc7[_0x070e('0xee')]+_0x205fc7[_0x070e('0xef')]+_0x205fc7[_0x070e('0xf0')]+_0x205fc7['countnosuchnumberretry']+_0x205fc7[_0x070e('0xf1')]+_0x205fc7[_0x070e('0xf2')]+_0x205fc7['countmachineretry']+_0x205fc7[_0x070e('0xf3')]>=_0x3759a6['dialGlobalMaxRetry']){_0x5d8e1a['stateGlobal'](_0x205fc7,_0x4b6569,_0x4c621a,'reason19\x20machine....');}else{if(_0x205fc7[_0x070e('0xea')]>=_0x3759a6[_0x070e('0xf4')]){_0x5d8e1a[_0x070e('0xf5')](_0x205fc7,_0x4b6569,_0x4c621a,_0x070e('0xf6'));}else{_0x5d8e1a['rescheduleContact']({'active':![],'countmachineretry':_0x205fc7[_0x070e('0xea')],'scheduledat':moment()[_0x070e('0xf7')](_0x3759a6['dialMachineRetryFrequency'],_0x070e('0xf8'))[_0x070e('0x72')](_0x070e('0xf9')),'ContactId':_0x205fc7[_0x070e('0xcf')],'ListId':_0x205fc7[_0x070e('0xd0')],'VoiceQueueId':_0x205fc7[_0x070e('0xd1')]||undefined,'CampaignId':_0x205fc7['CampaignId']||undefined})[_0x070e('0xad')](loggerCatch('[rescheduleContact][Machine]'));_0x4b6569({'reschedule':0x1});}}});}if(_0x85163b[_0x070e('0x4a')]===_0x070e('0x75')&&this[_0x070e('0x21')][_0x85163b['queue']][_0x070e('0xdf')]&&_0xe2a5b4[_0x070e('0xe7')]===_0x070e('0xe0')){delete this['uniqueId'][_0xe2a5b4[_0x070e('0xda')]];this[_0x070e('0xaf')](this['campaigns'][_0x85163b[_0x070e('0xb0')]]);_0x1f1501=new Hangup(_0x85163b,_0xe2a5b4);_0x1f1501[_0x070e('0xa2')]=0x12;_0x1f1501['statedesc']='HangupInAMD';_0x1f1501['membername']='AMD';this[_0x070e('0xce')](_0x1f1501,_0x070e('0xfa'),_0x070e('0xfb'));}if(_0x85163b[_0x070e('0x4a')]===_0x070e('0x75')&&this[_0x070e('0x21')][_0x85163b[_0x070e('0xb0')]][_0x070e('0xdf')]&&_0xe2a5b4['value']==='MACHINE'){var _0x5d8e1a=this;return new BPromise(function(_0x58ae9b,_0x22a659){delete _0x5d8e1a[_0x070e('0x26')][_0xe2a5b4[_0x070e('0xda')]];_0x5d8e1a[_0x070e('0xaf')](_0x5d8e1a[_0x070e('0x21')][_0x85163b['queue']]);_0x5d8e1a['campaigns'][_0x85163b[_0x070e('0xb0')]][_0x070e('0xe1')]+=0x1;_0x5d8e1a['campaigns'][_0x85163b[_0x070e('0xb0')]][_0x070e('0x5b')]+=0x1;var _0x239385=_0x5d8e1a[_0x070e('0x21')][_0x85163b[_0x070e('0xb0')]];var _0x15b1f6=new Hangup(_0x85163b,_0xe2a5b4);_0x15b1f6['state']=0x13;_0x15b1f6[_0x070e('0xa3')]=_0x070e('0xe9');_0x15b1f6[_0x070e('0xe3')]='AMD';_0x15b1f6[_0x070e('0xea')]+=0x1;_0x15b1f6[_0x070e('0xeb')]+=0x1;_0x15b1f6[_0x070e('0xec')]=!![];_0x5d8e1a[_0x070e('0xca')](_0x15b1f6)['catch'](loggerCatch(_0x070e('0xed')));if(_0x15b1f6[_0x070e('0xee')]+_0x15b1f6['countcongestionretry']+_0x15b1f6[_0x070e('0xf0')]+_0x15b1f6[_0x070e('0xfc')]+_0x15b1f6['countdropretry']+_0x15b1f6[_0x070e('0xf2')]+_0x15b1f6['countmachineretry']+_0x15b1f6[_0x070e('0xf3')]>=_0x239385['dialGlobalMaxRetry']){_0x5d8e1a[_0x070e('0xfd')](_0x15b1f6,_0x58ae9b,_0x22a659,'reason19\x20machine....');}else{if(_0x15b1f6['countmachineretry']>=_0x239385[_0x070e('0xf4')]){_0x5d8e1a['createStateFinal'](_0x15b1f6,_0x58ae9b,_0x22a659,'reason\x2019\x20machine....');}else{_0x5d8e1a[_0x070e('0xbf')]({'active':![],'countmachineretry':_0x15b1f6[_0x070e('0xea')],'scheduledat':moment()[_0x070e('0xf7')](_0x239385[_0x070e('0xfe')],_0x070e('0xf8'))['format'](_0x070e('0xf9')),'ContactId':_0x15b1f6[_0x070e('0xcf')],'ListId':_0x15b1f6[_0x070e('0xd0')],'VoiceQueueId':_0x15b1f6[_0x070e('0xd1')]||undefined,'CampaignId':_0x15b1f6[_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch('[rescheduleContact][Machine]'));_0x58ae9b({'reschedule':0x1});}}});}}};Dialer[_0x070e('0x1b')][_0x070e('0x33')]=function(_0x6aca88){var _0x44c780=this['uniqueId'][_0x6aca88['uniqueid']];var _0xf08686=this;var _0x324641;if(_0x44c780&&_0x44c780[_0x070e('0x4a')]===_0x070e('0x75')){delete this[_0x070e('0x26')][_0x6aca88[_0x070e('0xda')]];this['updateOriginated'](this[_0x070e('0x21')][_0x44c780[_0x070e('0xb0')]]);this[_0x070e('0x21')][_0x44c780[_0x070e('0xb0')]][_0x070e('0xff')]+=0x1;_0x324641=new Hangup(_0x44c780,_0x6aca88);this[_0x070e('0xca')](_0x324641)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x070e('0xc8')](_0x324641)[_0x070e('0xad')](loggerCatch(_0x070e('0x100')));}if(_0x44c780&&_0x44c780[_0x070e('0x4a')]!==_0x070e('0x75')&&isNotNull(this[_0x070e('0x20')][_0x44c780[_0x070e('0xb0')]]['dialQueueProject'])){delete this[_0x070e('0x26')][_0x6aca88['uniqueid']];this[_0x070e('0xaf')](this['voiceQueues'][_0x44c780['queue']]);this['voiceQueues'][_0x44c780[_0x070e('0xb0')]][_0x070e('0xe1')]+=0x1;this[_0x070e('0x20')][_0x44c780[_0x070e('0xb0')]][_0x070e('0x5b')]+=0x1;_0x324641=new Hangup(_0x44c780,_0x6aca88);_0x324641[_0x070e('0xa2')]=0x10;_0x324641[_0x070e('0xa3')]=_0x070e('0x101');_0x324641[_0x070e('0xe3')]='AGI';this[_0x070e('0xca')](_0x324641)[_0x070e('0xad')](loggerCatch(_0x070e('0x102')));this[_0x070e('0xc8')](_0x324641)[_0x070e('0xad')](loggerCatch(_0x070e('0x100')));}if(_0x44c780&&_0x44c780[_0x070e('0x4a')]!==_0x070e('0x75')&&!isNotNull(this[_0x070e('0x20')][_0x44c780['queue']]['dialQueueProject'])){delete this[_0x070e('0x26')][_0x6aca88[_0x070e('0xda')]];this['updateOriginated'](this[_0x070e('0x20')][_0x44c780['queue']]);this['voiceQueues'][_0x44c780[_0x070e('0xb0')]][_0x070e('0x103')]+=0x1;_0x324641=new Hangup(_0x44c780,_0x6aca88);_0x324641['state']=0xc;_0x324641[_0x070e('0xa3')]=_0x6aca88[_0x070e('0x104')];_0x324641[_0x070e('0xe3')]='Unknow';this['createHistory'](_0x324641)[_0x070e('0xad')](loggerCatch(_0x070e('0x102')));this[_0x070e('0xc8')](_0x324641)['catch'](loggerCatch(_0x070e('0x100')));}};Dialer[_0x070e('0x1b')]['syncAgentComplete']=function(_0x12faf6){var _0x27ceff=this[_0x070e('0x26')][_0x12faf6[_0x070e('0xda')]];var _0x3f7b2c=this;if(this[_0x070e('0x20')][_0x12faf6[_0x070e('0xb0')]]){if(_0x27ceff&&_0x27ceff[_0x070e('0x4a')]!==_0x070e('0x75')){delete this[_0x070e('0x26')][_0x12faf6[_0x070e('0xda')]];this[_0x070e('0x20')][_0x12faf6[_0x070e('0xb0')]][_0x070e('0xe1')]+=0x1;var _0x148dd1=new AgentComplete(_0x27ceff,_0x12faf6);if(_0x12faf6[_0x070e('0x105')]===_0x070e('0x106')){_0x148dd1['agiafterat']=this['voiceQueues'][_0x12faf6['queue']]['dialQueueProject2']&&this[_0x070e('0x20')][_0x12faf6[_0x070e('0xb0')]][_0x070e('0x107')]?moment()['format'](_0x070e('0xf9')):undefined;}this[_0x070e('0xca')](_0x148dd1)[_0x070e('0xad')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x070e('0xc8')](_0x148dd1)[_0x070e('0xad')](loggerCatch(_0x070e('0x108')));}}};Dialer[_0x070e('0x1b')]['syncAgentConnect']=function(_0x7f803a){if(this[_0x070e('0x20')][_0x7f803a[_0x070e('0xb0')]]){if(this['uniqueId'][_0x7f803a[_0x070e('0xda')]]&&this[_0x070e('0x26')][_0x7f803a[_0x070e('0xda')]][_0x070e('0x4a')]!==_0x070e('0x75')){this[_0x070e('0xaf')](this[_0x070e('0x20')][_0x7f803a[_0x070e('0xb0')]]);this[_0x070e('0x26')][_0x7f803a['uniqueid']]['answertime']=moment()[_0x070e('0x72')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x070e('0x109')]=function(_0x6479e4,_0x3007b7){this[_0x070e('0xca')](_0x6479e4)[_0x070e('0xad')](loggerCatch(_0x070e('0x10a')));if(_0x3007b7==0x0){this['moveContactManagedDialer'](_0x6479e4)[_0x070e('0xad')](loggerCatch(_0x070e('0x10b')));}};Dialer[_0x070e('0x1b')][_0x070e('0x2f')]=function(_0x5dbc81){var _0x22a256=this['uniqueId'][_0x5dbc81[_0x070e('0xda')]];var _0x698f7c=this;var _0x1935fb=![];var _0x668dea;var _0x2b6b45;if(this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]]){if(_0x22a256&&_0x22a256[_0x070e('0x4a')]!==_0x070e('0x75')){delete this['uniqueId'][_0x5dbc81[_0x070e('0xda')]];this[_0x070e('0xaf')](this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]]);_0x22a256[_0x070e('0x10c')]=moment()[_0x070e('0x72')](_0x070e('0xf9'));var _0x2ba99e=new QueueCallerAbandon(_0x22a256,_0x5dbc81);if(getSeconds(_0x22a256['droptime'],_0x22a256[_0x070e('0x10d')])>=_0x22a256[_0x070e('0x10e')]){this['voiceQueues'][_0x5dbc81['queue']][_0x070e('0x10f')]+=0x1;this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]][_0x070e('0x5e')]+=0x1;this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2ba99e['state']=0xa;_0x2ba99e[_0x070e('0xa3')]=_0x070e('0x110');_0x2ba99e['dropreason']=_0x070e('0x111');_0x2ba99e['agiafterat']=this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]]['dialQueueProject2']?moment()[_0x070e('0x72')](_0x070e('0xf9')):undefined;_0x2ba99e['countdropretry']+=0x1;_0x2ba99e['countglobal']+=0x1;_0x668dea=this[_0x070e('0x20')][_0x5dbc81['queue']][_0x070e('0x112')];_0x2b6b45=this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]]['callAdditionalPhoneAfterMin'];_0x698f7c[_0x070e('0xb7')](_0x2ba99e,_0x2ba99e[_0x070e('0xa2')],_0x22a256['voiceQueue'])[_0x070e('0xb4')](function(_0x19a689){_0x1935fb=_0x19a689[_0x070e('0x113')]==0x1;if(_0x2ba99e[_0x070e('0xf1')]>=_0x698f7c[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]][_0x070e('0x114')]){_0x698f7c[_0x070e('0x109')](_0x2ba99e,_0x19a689[_0x070e('0x113')]);}else{_0x698f7c[_0x070e('0xbf')]({'active':![],'countdropretry':_0x2ba99e['countdropretry'],'scheduledat':moment()[_0x070e('0xf7')](this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]]['dialDropRetryFrequency'],'minutes')[_0x070e('0x72')](_0x070e('0xf9')),'ContactId':_0x22a256[_0x070e('0xcf')],'ListId':_0x22a256[_0x070e('0xd0')],'VoiceQueueId':_0x22a256['VoiceQueueId']||undefined,'CampaignId':_0x22a256[_0x070e('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x1a1851=new History(_0x2ba99e);_0x1a1851['state']=0xa;_0x1a1851[_0x070e('0xa3')]=_0x070e('0x110');_0x1a1851[_0x070e('0xa5')]=moment()[_0x070e('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a1851[_0x070e('0xa4')]=_0x1a1851['starttime'];_0x1a1851[_0x070e('0x115')]=_0x2ba99e[_0x070e('0x115')];_0x1a1851[_0x070e('0x116')]=_0x2ba99e[_0x070e('0x116')];_0x698f7c[_0x070e('0xca')](_0x1a1851)[_0x070e('0xad')](loggerCatch(_0x070e('0x117')));}})[_0x070e('0xb4')](function(_0xa4fe4e){if(_0x1935fb)_0x698f7c[_0x070e('0xb9')](_0x2ba99e,_0x668dea,_0x2b6b45)[_0x070e('0xb4')](function(_0xf0cc00){return 0x1;});});}else{this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]][_0x070e('0x7c')]+=0x1;this[_0x070e('0x20')][_0x5dbc81['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x2ba99e[_0x070e('0xa2')]=0xb;_0x2ba99e[_0x070e('0xa3')]='Abandoned';_0x2ba99e[_0x070e('0x118')]=_0x070e('0x119');_0x2ba99e['countabandonedretry']+=0x1;_0x2ba99e[_0x070e('0xeb')]+=0x1;_0x668dea=this[_0x070e('0x20')][_0x5dbc81['queue']][_0x070e('0x11a')];_0x2b6b45=this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]][_0x070e('0x11b')];_0x698f7c[_0x070e('0xb7')](_0x2ba99e,_0x2ba99e[_0x070e('0xa2')],_0x22a256['voiceQueue'])[_0x070e('0xb4')](function(_0x283199){if(_0x2ba99e[_0x070e('0xf2')]>=_0x698f7c['voiceQueues'][_0x5dbc81[_0x070e('0xb0')]][_0x070e('0x11c')]){_0x698f7c[_0x070e('0x109')](_0x2ba99e,_0x283199[_0x070e('0x113')]);}else{_0x698f7c['rescheduleContact']({'active':![],'countabandonedretry':_0x2ba99e['countabandonedretry'],'scheduledat':moment()[_0x070e('0xf7')](this[_0x070e('0x20')][_0x5dbc81[_0x070e('0xb0')]][_0x070e('0x11a')],_0x070e('0xf8'))[_0x070e('0x72')](_0x070e('0xf9')),'ContactId':_0x22a256['ContactId'],'ListId':_0x22a256[_0x070e('0xd0')],'VoiceQueueId':_0x22a256[_0x070e('0xd1')]||undefined,'CampaignId':_0x22a256[_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch(_0x070e('0x11d')));var _0xd9becc=new History(_0x2ba99e);_0xd9becc[_0x070e('0xa2')]=0xb;_0xd9becc[_0x070e('0xa3')]=_0x070e('0x11e');_0xd9becc[_0x070e('0xa5')]=moment()[_0x070e('0x72')](_0x070e('0xf9'));_0xd9becc[_0x070e('0xa4')]=_0xd9becc[_0x070e('0xa5')];_0xd9becc[_0x070e('0x115')]=_0x2ba99e['calleridname'];_0xd9becc[_0x070e('0x116')]=_0x2ba99e[_0x070e('0x116')];_0x698f7c[_0x070e('0xca')](_0xd9becc)[_0x070e('0xad')](loggerCatch(_0x070e('0x11f')));}})[_0x070e('0xb4')](function(_0x4326ee){if(_0x1935fb)_0x698f7c['swapAdditionalPhones'](_0x2ba99e,_0x668dea,_0x2b6b45)[_0x070e('0xb4')](function(_0x2196e9){return 0x1;});});}}}};Dialer[_0x070e('0x1b')][_0x070e('0x120')]=function(_0x354dc8){if(this[_0x070e('0xa8')][_0x354dc8[_0x070e('0xda')]]){this[_0x070e('0xa8')][_0x354dc8[_0x070e('0xda')]]['channel']=_0x354dc8[_0x070e('0x121')];}if(this[_0x070e('0x26')][_0x354dc8[_0x070e('0xda')]]){this[_0x070e('0x26')][_0x354dc8[_0x070e('0xda')]][_0x070e('0x121')]=_0x354dc8[_0x070e('0x121')];}};Dialer[_0x070e('0x1b')][_0x070e('0x38')]=function(_0x1c8c06){if(strategy[this[_0x070e('0x20')][this[_0x070e('0xa8')][_0x1c8c06[_0x070e('0x122')]][_0x070e('0xb0')]][_0x070e('0x4c')]]===_0x070e('0x1a')){if(this[_0x070e('0xa8')][_0x1c8c06[_0x070e('0x122')]]&&_[_0x070e('0xaa')](this[_0x070e('0xa8')][_0x1c8c06[_0x070e('0x122')]][_0x070e('0x123')])&&_0x1c8c06['status']==='1'&&_0x1c8c06[_0x070e('0x124')]==='0'){if(this[_0x070e('0x22')][_0x1c8c06[_0x070e('0x125')]]){if(!this[_0x070e('0x22')][_0x1c8c06['stateinterface']][_0x070e('0x123')]){this['agents'][_0x1c8c06[_0x070e('0x125')]]['locked']=!![];this['actions'][_0x1c8c06[_0x070e('0x122')]][_0x070e('0x123')]=!![];this[_0x070e('0xa8')][_0x1c8c06['actionid']][_0x070e('0x125')]=_0x1c8c06['stateinterface'];}}}}else if((strategy[this[_0x070e('0x20')][this[_0x070e('0xa8')][_0x1c8c06['actionid']][_0x070e('0xb0')]]['strategy']]||_0x070e('0x126'))===_0x070e('0x126')){if(this[_0x070e('0xa8')][_0x1c8c06['actionid']]){if(this['agents'][_0x1c8c06[_0x070e('0x125')]]){this['actions'][_0x1c8c06[_0x070e('0x122')]][_0x070e('0x125')]=_0x1c8c06[_0x070e('0x125')];if(_[_0x070e('0xaa')](this[_0x070e('0x29')][this[_0x070e('0xa8')][_0x1c8c06['actionid']]['queue']])){this[_0x070e('0x29')][this['actions'][_0x1c8c06['actionid']][_0x070e('0xb0')]]=[];}this[_0x070e('0x29')][this[_0x070e('0xa8')][_0x1c8c06['actionid']][_0x070e('0xb0')]][_0x070e('0x127')](_[_0x070e('0x88')](_['pick'](this['actions'][_0x1c8c06[_0x070e('0x122')]],[_0x070e('0x128'),_0x070e('0x125')]),{'status':_0x1c8c06['status'],'paused':_0x1c8c06[_0x070e('0x124')]}));}}}};function unlockQueueStatus(_0x54de0c,_0x2e9263){setTimeout(function(){if(_['isUndefined'](_0x54de0c[_0x070e('0x129')])){loggerBooked[_0x070e('0x94')]('[unlockQueueStatus][undefined]',_0x2e9263);}_0x54de0c[_0x070e('0x129')]=!![];loggerBooked[_0x070e('0x77')](_0x070e('0x12a'),_0x2e9263,JSON[_0x070e('0x45')](_[_0x070e('0x12b')](_0x54de0c,[_0x070e('0x3d'),_0x070e('0x129')])));},0x1f3);}Dialer[_0x070e('0x1b')][_0x070e('0x12c')]=function(_0x3c7240){var _0x431580=this;var _0x10b168=_0x431580[_0x070e('0x20')][_0x431580['actions'][_0x3c7240[_0x070e('0x122')]][_0x070e('0xb0')]];if(strategy[this[_0x070e('0x20')][this['actions'][_0x3c7240['actionid']][_0x070e('0xb0')]][_0x070e('0x4c')]]==='roundrobin'){if(this[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]]&&this[_0x070e('0xa8')][_0x3c7240['actionid']][_0x070e('0x125')]){this['preview'][_0x070e('0x12d')](this[_0x070e('0xa8')][_0x3c7240['actionid']][_0x070e('0x128')],this[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]][_0x070e('0x125')])[_0x070e('0xad')](function(_0x19e6a3){logger[_0x070e('0x94')](_0x070e('0x12e'),util[_0x070e('0x90')](_0x19e6a3,{'showHidden':![],'depth':null}));})['finally'](function(){_0x431580[_0x070e('0xaf')](_0x431580[_0x070e('0x20')][_0x431580[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]]['queue']]);_0x431580['agents'][_0x431580['actions'][_0x3c7240[_0x070e('0x122')]]['stateinterface']][_0x070e('0x123')]=![];delete _0x431580[_0x070e('0xa8')][_0x3c7240['actionid']];unlockQueueStatus(_0x10b168);});}else{this[_0x070e('0xaf')](this['voiceQueues'][this['actions'][_0x3c7240[_0x070e('0x122')]][_0x070e('0xb0')]]);this[_0x070e('0xbf')]({'active':![],'ContactId':this[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]][_0x070e('0xcf')],'ListId':this[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]][_0x070e('0xd0')],'VoiceQueueId':this[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]][_0x070e('0xd1')]||undefined,'CampaignId':this['actions'][_0x3c7240[_0x070e('0x122')]][_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch(_0x070e('0x12f')));delete this[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]];unlockQueueStatus(_0x10b168);}}else if((strategy[this['voiceQueues'][this['actions'][_0x3c7240['actionid']][_0x070e('0xb0')]][_0x070e('0x4c')]]||_0x070e('0x126'))==='rrmemory'){var _0x27035b;if(this[_0x070e('0xa8')][_0x3c7240['actionid']]&&!_['isEmpty'](this[_0x070e('0x29')][this['actions'][_0x3c7240[_0x070e('0x122')]][_0x070e('0xb0')]])){if(this[_0x070e('0x2a')][_0x431580[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]][_0x070e('0xb0')]]){this['queueBookedRR'][_0x431580[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]][_0x070e('0xb0')]]=this['queueBookedRR'][this[_0x070e('0xa8')][_0x3c7240['actionid']]['queue']]?this[_0x070e('0x2a')][this['actions'][_0x3c7240[_0x070e('0x122')]]['queue']]:this[_0x070e('0x29')][this[_0x070e('0xa8')][_0x3c7240['actionid']][_0x070e('0xb0')]]?this[_0x070e('0x29')][this[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]][_0x070e('0xb0')]][_0x070e('0x130')]||0x0:0x0;}this[_0x070e('0x29')][this[_0x070e('0xa8')][_0x3c7240[_0x070e('0x122')]][_0x070e('0xb0')]]['_rr']=this[_0x070e('0x2a')][this['actions'][_0x3c7240[_0x070e('0x122')]][_0x070e('0xb0')]];for(var _0x58052b=0x0;_0x58052b=0x0;})[_0x070e('0xad')](myreject(_0x334f52)));}}else{_0x33ba9c[_0x070e('0x127')](ami[_0x070e('0xab')]({'action':_0x070e('0x147'),'command':util[_0x070e('0x72')](_0x070e('0x148'),_0xa2a25c,!_[_0x070e('0x81')](config[_0x070e('0x14a')][_0x593b38])?_0x593b38:'')})[_0x070e('0xb4')](function(_0x5280d7){return _0x5280d7[_0x070e('0x14b')][_0x070e('0x14c')](_0x070e('0x14d'))>=0x0;})['catch'](myreject(_0x334f52)));}BPromise[_0x070e('0x14e')](_0x33ba9c)[_0x070e('0xb4')](function(_0x2f5572){var _0x42c8b3=_[_0x070e('0x14f')](_0x2f5572);if(_0x42c8b3){return _0x2a6a94(_0x42c8b3);}else{_0x262216[_0x070e('0x3c')]=_0x259552?_0x070e('0x150'):'INTERVAL_IS_OVERTIME';return _0x334f52(msgResponse(_0x070e('0x151'),_0x070e('0x144'),_0x070e('0x152')+_0x259552+'\x20'+_0x1658ae+_0x070e('0x153')+util[_0x070e('0x90')](_0xa2a25c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x593b38));}})[_0x070e('0xad')](function(_0x916dc3){return _0x334f52(msgResponse('ifTime','Failure',JSON['stringify'](_0x916dc3)));});});};Dialer[_0x070e('0x1b')][_0x070e('0x154')]=function(_0x5906f5){var _0x550c04=this;return function(){switch(_0x5906f5[_0x070e('0x57')]){case'progressive':freeVariablesPredictive(_0x5906f5);_0x550c04[_0x070e('0x155')](_0x5906f5,0x1);break;case _0x070e('0x156'):freeVariablesPredictive(_0x5906f5);_0x550c04[_0x070e('0x155')](_0x5906f5,_0x5906f5[_0x070e('0x157')]);break;case _0x070e('0x158'):_0x550c04[_0x070e('0x158')](_0x5906f5);break;case _0x070e('0x8'):freeVariablesPredictive(_0x5906f5);_0x550c04['handlePower'](_0x5906f5,0x1);break;default:freeVariablesPredictive(_0x5906f5);logger[_0x070e('0x94')](_0x070e('0x159'),_0x5906f5[_0x070e('0x3d')],_0x070e('0x15a'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x32472f){var _0x148bc4=this;return function(){_0x148bc4[_0x070e('0x15b')](_0x32472f);};};Dialer['prototype'][_0x070e('0xb')]=function(_0x2b3145){var _0x77c827=this;if(isNotPreview(_0x2b3145[_0x070e('0x57')])){if(isVoiceQueueOutbound(_0x2b3145['type'])&&isActive(_0x2b3145['dialActive'])){_0x2b3145[_0x070e('0x9b')]=!![];BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](checkIsLoggedIn(_0x2b3145,_0x2b3145[_0x070e('0x4e')]))[_0x070e('0xb4')](checkIsActive(_0x2b3145,_0x2b3145['dialActive']))['then'](checkInterval(_0x2b3145))['then'](_0x77c827[_0x070e('0x13c')](_0x2b3145))[_0x070e('0xb4')](_0x77c827[_0x070e('0x13f')](_0x2b3145[_0x070e('0x15c')],_0x2b3145['dialTimezone'],_0x2b3145[_0x070e('0x3d')],_0x2b3145))['then'](_0x77c827['checkIfTimeIntervals'](_0x2b3145[_0x070e('0x40')],_0x2b3145[_0x070e('0x15d')],_0x2b3145['name'],_0x2b3145))[_0x070e('0xb4')](_0x77c827[_0x070e('0x154')](_0x2b3145))[_0x070e('0xad')](loggerCatchQueueSummary(_0x070e('0x15e'),_0x2b3145));}else{notSendMessagesQueue(_0x2b3145);}}else{freeVariablesPredictive(_0x2b3145);}};Dialer[_0x070e('0x1b')][_0x070e('0x13b')]=function(){var _0x56d09f=this;var _0x237251;for(var _0x2e9e03 in this[_0x070e('0x21')]){if(typeof this['campaigns'][_0x2e9e03]!==_0x070e('0x92')){_0x237251=this[_0x070e('0x21')][_0x2e9e03];if(isCampaignIvr(_0x237251[_0x070e('0x4a')])&&isActive(_0x237251['active'])){_0x237251[_0x070e('0x9b')]=!![];BPromise[_0x070e('0xb3')]()[_0x070e('0xb4')](checkIsActive(_0x237251,_0x237251[_0x070e('0x70')]))[_0x070e('0xb4')](checkInterval(_0x237251))[_0x070e('0xb4')](_0x56d09f[_0x070e('0x13c')](_0x237251))[_0x070e('0xb4')](_0x56d09f[_0x070e('0x13f')](_0x237251[_0x070e('0x15c')],_0x237251[_0x070e('0x15d')],_0x237251['name'],_0x237251))[_0x070e('0xb4')](_0x56d09f[_0x070e('0x141')](_0x237251[_0x070e('0x40')],_0x237251[_0x070e('0x15d')],_0x237251['name'],_0x237251))[_0x070e('0xb4')](_0x56d09f[_0x070e('0x15f')](_0x237251))['catch'](loggerCatchQueueSummary(_0x070e('0x160'),_0x237251));}else{notSendMessagesCampaign(_0x237251);}}}};function getCallerIdRandom(_0x4a004,_0x47e429){var _0x1b11bb;var _0x54849e;var _0xfb3cf0;if(_0x47e429<=0x0){_0x47e429=0x1;}_0x1b11bb=new RegExp('\x5cw{0,'+_0x47e429+'}$');_0x54849e=Math['pow'](0xa,_0x47e429-0x1);_0xfb3cf0=Math[_0x070e('0x161')](0xa,_0x47e429)-0x1;return util['format']('%s',_[_0x070e('0x162')](_0x4a004,_0x1b11bb,_[_0x070e('0x163')](_0x54849e,_0xfb3cf0)));}function extractCalleridName(_0x3c1583){var _0x2c8d19=_0x3c1583[_0x070e('0x164')](/"(.*?)"/);return _0x2c8d19?_0x2c8d19[0x1]:_0x3c1583;}function extractCalleridNumber(_0x4092ef){var _0x5e0678=_0x4092ef['match'](/<(.*?)>/);return _0x5e0678?_0x5e0678[0x1]:_0x4092ef;}Dialer['prototype']['actionOriginate']=function(_0x349339,_0x54ffda){var _0x295e24=this;var _0x207b50=uuid['v4']();this[_0x070e('0xa8')][_0x207b50]=new Action(_0x349339,_0x54ffda,_0x207b50);return new BPromise(function(_0x620e54,_0x1bfd42){if(_[_0x070e('0x81')](_0x349339)&&typeof _0x349339!=='object'){return _0x1bfd42(msgResponse(_0x070e('0x165'),_0x070e('0x144'),_0x070e('0x166')));}if(_[_0x070e('0x81')](_0x54ffda[_0x070e('0x167')])||_0x54ffda[_0x070e('0x167')]===null){return _0x1bfd42(msgResponse('originate',_0x070e('0x144'),_0x070e('0x168')));}var _0x71e72={'XMD-CALLERID':_0x295e24['actions'][_0x207b50][_0x070e('0x169')](),'XMD-AGI':_0x349339[_0x070e('0x16a')]?util[_0x070e('0x72')](_0x070e('0x16b'),ipAgi,_0x349339[_0x070e('0x16a')]):_0x070e('0x16c'),'XMD-AGIAFTER':_0x349339[_0x070e('0x16d')]?util[_0x070e('0x72')](_0x070e('0x16b'),ipAgi,_0x349339[_0x070e('0x16d')]):_0x070e('0x16c'),'XMD-QUEUE':_0x349339[_0x070e('0x4a')]===_0x070e('0x4b')?util[_0x070e('0x72')](_0x070e('0x16e'),_0x349339[_0x070e('0x3d')],_0x349339[_0x070e('0x16f')]||'',_0x349339[_0x070e('0x107')]?'c':'',_0x349339[_0x070e('0x10e')]||0x3):_0x070e('0x16c'),'XMD-CONTACTID':_0x54ffda['ContactId'],'XMD-CDRTYPE':_0x070e('0x7'),'CALLERID(all)':_0x295e24['actions'][_0x207b50]['getCaller'](),'XMD-AMD':_0x349339[_0x070e('0xdf')]?'ACTIVE':_0x070e('0x16c'),'XMD-DESTINATION':_0x070e('0xde')};if(_0x349339[_0x070e('0xdf')]){_0x71e72[_0x070e('0x170')]=_0x349339[_0x070e('0x171')]||0x9c4;_0x71e72[_0x070e('0x172')]=_0x349339[_0x070e('0x173')]||0x5dc;_0x71e72[_0x070e('0x174')]=_0x349339[_0x070e('0x175')]||0x320;_0x71e72[_0x070e('0x176')]=_0x349339['dialAMDTotalAnalysisTime']||0x1388;_0x71e72[_0x070e('0x177')]=_0x349339[_0x070e('0x178')]||0x64;_0x71e72[_0x070e('0x179')]=_0x349339[_0x070e('0x17a')]||0x32;_0x71e72[_0x070e('0x17b')]=_0x349339['dialAMDMaximumNumberOfWords']||0x3;_0x71e72[_0x070e('0x17c')]=_0x349339[_0x070e('0x17d')]||0x100;_0x71e72[_0x070e('0x17e')]=_0x349339[_0x070e('0x17f')]||0x1388;}if(_0x349339['type']===_0x070e('0x4b')){_0x71e72[_0x070e('0x180')]=_0x54ffda['VoiceQueueId'];}else{_0x71e72[_0x070e('0x181')]=_0x54ffda[_0x070e('0xd2')];}for(var _0x1e1f1a in _0x54ffda[_0x070e('0x182')]){if(typeof _0x54ffda['Contact'][_0x1e1f1a]!==_0x070e('0x92')){if(isNotNull(_0x54ffda[_0x070e('0x182')][_0x1e1f1a])&&_0x1e1f1a!=='id'&&_0x1e1f1a!==_0x070e('0x183')&&_0x1e1f1a!=='createdAt'&&_0x1e1f1a!==_0x070e('0x184')){_0x71e72[util['format'](_0x070e('0x185'),_0x070e('0x186'),_['toUpper'](_0x1e1f1a))]=_0x54ffda[_0x070e('0x182')][_0x1e1f1a];}}}var _0x3941fd=_0x295e24[_0x070e('0xd6')](_0x349339[_0x070e('0x6f')])?getCallerId(_0x349339[_0x070e('0x6f')][_0x070e('0x71')],_0x349339[_0x070e('0x187')],_0x349339['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x349339['dialOriginateCallerIdNumber'],_0x349339[_0x070e('0x188')]):_0x349339[_0x070e('0x58')]):getCallerId(_[_0x070e('0xaa')](_0x349339['TrunkBackup'])?_0x349339['Trunk'][_0x070e('0x71')]:_0x349339['TrunkBackup']['callerid'],_0x349339[_0x070e('0x187')],_0x349339[_0x070e('0x188')]>0x0?getCallerIdRandom(_0x349339[_0x070e('0x58')],_0x349339[_0x070e('0x188')]):_0x349339['dialOriginateCallerIdNumber']);if(_0x3941fd){_0x71e72['XMD-ORIGINATECALLERIDNAME']=_0x295e24[_0x070e('0xa8')][_0x207b50][_0x070e('0x189')]=extractCalleridName(_0x3941fd);_0x71e72[_0x070e('0x18a')]=_0x54ffda[_0x070e('0x167')];}return ami[_0x070e('0xab')]({'actionid':_0x207b50,'action':'originate','channel':_0x295e24[_0x070e('0xd6')](_0x349339[_0x070e('0x6f')])?util[_0x070e('0x72')]('SIP/%s/%s%s',_0x349339[_0x070e('0x6f')]['name'],isNotNull(_0x349339[_0x070e('0x5a')])?_0x349339[_0x070e('0x5a')][_0x070e('0x18b')]()||'':'',_0x349339[_0x070e('0x18c')]>0x0?_0x54ffda[_0x070e('0x167')]['substring'](_0x349339['dialCutDigit']):_0x54ffda[_0x070e('0x167')]):util[_0x070e('0x72')](_0x070e('0x18d'),_['isNil'](_0x349339['TrunkBackup'])?_0x349339[_0x070e('0x6f')][_0x070e('0x3d')]:_0x349339[_0x070e('0x13d')][_0x070e('0x3d')],isNotNull(_0x349339[_0x070e('0x5a')])?_0x349339[_0x070e('0x5a')][_0x070e('0x18b')]()||'':'',_0x349339[_0x070e('0x18c')]>0x0?_0x54ffda[_0x070e('0x167')][_0x070e('0x18e')](_0x349339[_0x070e('0x18c')]):_0x54ffda[_0x070e('0x167')]),'callerid':_0x3941fd,'Exten':_0x070e('0xde'),'Context':_0x070e('0x18f'),'Priority':'1','variable':_0x71e72,'timeout':(_0x349339[_0x070e('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x207b50})['then'](function(_0x15277b){return _0x620e54(_0x15277b);})[_0x070e('0xad')](function(_0x2f20d9){_0x349339['outboundOriginateFailureCallsDay']+=0x1;var _0x51836a=new History(_0x295e24['actions'][_0x207b50]);logger['error'](util[_0x070e('0x72')](_0x070e('0x190'),JSON[_0x070e('0x45')](_0x2f20d9)));_0x51836a[_0x070e('0xa2')]=0xe;_0x51836a[_0x070e('0xa3')]=_0x070e('0x191');_0x51836a[_0x070e('0xa5')]=moment()[_0x070e('0x72')](_0x070e('0xf9'));_0x51836a['endtime']=_0x51836a['starttime'];_0x295e24['createHistory'](_0x51836a)['catch'](loggerCatch(_0x070e('0x192')));_0x295e24['moveContactManagedDialer'](_0x51836a)[_0x070e('0xad')](loggerCatch(_0x070e('0x192')))[_0x070e('0x1d')](function(){delete _0x295e24[_0x070e('0xa8')][_0x207b50];return _0x1bfd42(msgResponse(_0x070e('0x165'),_0x070e('0x44'),_0x070e('0x193')));});});});};Dialer[_0x070e('0x1b')]['syncOriginateResponse']=function(_0x15fa9f){var _0xe86113=this[_0x070e('0xa8')][_0x15fa9f[_0x070e('0x122')]];if(_0xe86113){delete this[_0x070e('0xa8')][_0x15fa9f[_0x070e('0x122')]];_0xe86113[_0x070e('0x10d')]=moment()[_0x070e('0x72')](_0x070e('0xf9'));var _0xa77951=_0xe86113[_0x070e('0x4a')]==='ivr'?this[_0x070e('0x21')][_0xe86113[_0x070e('0xb0')]]:this['voiceQueues'][_0xe86113[_0x070e('0x194')]()];if(!this['isSuccess'](_0x15fa9f['response'])){this[_0x070e('0xaf')](_0xa77951);return this['callProgressDetecting'](_0xe86113,_0xa77951,_0x15fa9f)[_0x070e('0xad')](loggerCatch(_0x070e('0x195')));}this[_0x070e('0x26')][_0x15fa9f['uniqueid']]=_0xe86113;}};Dialer[_0x070e('0x1b')]['checkRetriveMax']=function(_0x43f3f6,_0x5c04b8,_0x2a205b){var _0x2190ad=new History(_0x5c04b8);if(_0x2190ad[_0x070e('0xee')]+_0x2190ad['countcongestionretry']+_0x2190ad['countnoanswerretry']+_0x2190ad[_0x070e('0xfc')]+_0x2190ad[_0x070e('0xf1')]+_0x2190ad[_0x070e('0xf2')]+_0x2190ad[_0x070e('0xea')]+_0x2190ad['countagentrejectretry']>=_0x2a205b[_0x070e('0x196')]-0x1){return!![];}switch(_0x43f3f6){case 0x3:if(_0x2190ad[_0x070e('0xf0')]>=_0x2a205b[_0x070e('0x197')]-0x1){return!![];}this[_0x070e('0xbf')]({'active':![],'countnoanswerretry':_0x2190ad[_0x070e('0xf0')]+=0x1,'scheduledat':moment()[_0x070e('0xf7')](_0x2a205b['dialNoAnswerRetryFrequency'],_0x070e('0xf8'))[_0x070e('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2190ad[_0x070e('0xcf')],'ListId':_0x2190ad[_0x070e('0xd0')],'VoiceQueueId':_0x2190ad[_0x070e('0xd1')]||undefined,'CampaignId':_0x2190ad[_0x070e('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2190ad[_0x070e('0xee')]>=_0x2a205b[_0x070e('0x198')]-0x1){return!![];}this[_0x070e('0xbf')]({'active':![],'countbusyretry':_0x2190ad[_0x070e('0xee')]+=0x1,'scheduledat':moment()[_0x070e('0xf7')](_0x2a205b['dialBusyRetryFrequency'],_0x070e('0xf8'))[_0x070e('0x72')](_0x070e('0xf9')),'ContactId':_0x2190ad[_0x070e('0xcf')],'ListId':_0x2190ad[_0x070e('0xd0')],'VoiceQueueId':_0x2190ad['VoiceQueueId']||undefined,'CampaignId':_0x2190ad[_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch(_0x070e('0x199')));break;case 0x8:if(_0x2190ad[_0x070e('0xef')]>=_0x2a205b['dialCongestionMaxRetry']-0x1){return!![];}this[_0x070e('0xbf')]({'active':![],'countcongestionretry':_0x2190ad[_0x070e('0xef')]+=0x1,'scheduledat':moment()['add'](_0x2a205b[_0x070e('0x19a')],_0x070e('0xf8'))[_0x070e('0x72')](_0x070e('0xf9')),'ContactId':_0x2190ad[_0x070e('0xcf')],'ListId':_0x2190ad[_0x070e('0xd0')],'VoiceQueueId':_0x2190ad[_0x070e('0xd1')]||undefined,'CampaignId':_0x2190ad[_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2190ad[_0x070e('0xfc')]>=_0x2a205b[_0x070e('0x19b')]-0x1){return!![];}else{this[_0x070e('0xbf')]({'active':![],'countnosuchnumberretry':_0x2190ad[_0x070e('0xfc')]+=0x1,'scheduledat':moment()[_0x070e('0xf7')](_0x2a205b[_0x070e('0x19c')],_0x070e('0xf8'))['format'](_0x070e('0xf9')),'ContactId':_0x2190ad[_0x070e('0xcf')],'ListId':_0x2190ad[_0x070e('0xd0')],'VoiceQueueId':_0x2190ad['VoiceQueueId']||undefined,'CampaignId':_0x2190ad[_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch(_0x070e('0x19d')));}break;case 0xa:if(_0x2190ad[_0x070e('0xf1')]>=_0x2a205b[_0x070e('0x114')]-0x1){return!![];}this[_0x070e('0xbf')]({'active':![],'countdropretry':_0x2190ad[_0x070e('0xf1')]+=0x1,'scheduledat':moment()[_0x070e('0xf7')](_0x2a205b[_0x070e('0x112')],_0x070e('0xf8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2190ad[_0x070e('0xcf')],'ListId':_0x2190ad[_0x070e('0xd0')],'VoiceQueueId':_0x2190ad[_0x070e('0xd1')]||undefined,'CampaignId':_0x2190ad['CampaignId']||undefined})[_0x070e('0xad')](loggerCatch(_0x070e('0x19e')));break;case 0xb:if(_0x2190ad[_0x070e('0xf2')]>=_0x2a205b['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x070e('0xbf')]({'active':![],'countabandonedretry':_0x2190ad[_0x070e('0xf2')]+=0x1,'scheduledat':moment()[_0x070e('0xf7')](_0x2a205b[_0x070e('0x11a')],'minutes')[_0x070e('0x72')](_0x070e('0xf9')),'ContactId':_0x2190ad[_0x070e('0xcf')],'ListId':_0x2190ad[_0x070e('0xd0')],'VoiceQueueId':_0x2190ad[_0x070e('0xd1')]||undefined,'CampaignId':_0x2190ad[_0x070e('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2190ad[_0x070e('0xea')]>=_0x2a205b['dialMachineMaxRetry']-0x1){return!![];}this[_0x070e('0xbf')]({'active':![],'countmachineretry':_0x2190ad[_0x070e('0xea')]+=0x1,'scheduledat':moment()['add'](_0x2a205b[_0x070e('0xfe')],_0x070e('0xf8'))[_0x070e('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2190ad[_0x070e('0xcf')],'ListId':_0x2190ad['ListId'],'VoiceQueueId':_0x2190ad['VoiceQueueId']||undefined,'CampaignId':_0x2190ad[_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2190ad[_0x070e('0xf3')]>=_0x2a205b[_0x070e('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x2190ad[_0x070e('0xf3')]+=0x1,'scheduledat':moment()[_0x070e('0xf7')](_0x2a205b['dialAgentRejectRetryFrequency'],_0x070e('0xf8'))[_0x070e('0x72')](_0x070e('0xf9')),'ContactId':_0x2190ad['ContactId'],'ListId':_0x2190ad['ListId'],'VoiceQueueId':_0x2190ad[_0x070e('0xd1')]||undefined,'CampaignId':_0x2190ad[_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch(_0x070e('0x1a0')));break;default:return!![];}};Dialer[_0x070e('0x1b')][_0x070e('0x1a1')]=function(_0x87d2b3,_0x2e48c7,_0x3cc322){var _0x59e6d6=this;var _0x13623c=new History(_0x87d2b3);var _0x482296=![];var _0xc99f8f;var _0x3477ab;return new BPromise(function(_0xe15ea6,_0x36b103){if(_[_0x070e('0x81')](_0x2e48c7)&&typeof _0x2e48c7!==_0x070e('0x1a2')){return _0x36b103(msgResponse(_0x070e('0x1a3'),'Failure',_0x070e('0x1a4')));}if(_[_0x070e('0x81')](_0x3cc322)&&typeof _0x3cc322!=='object'){return _0x36b103(msgResponse(_0x070e('0x1a3'),_0x070e('0x144'),_0x070e('0x1a5')));}_0x59e6d6[_0x070e('0xb7')](_0x13623c,_0x3cc322[_0x070e('0x105')],_0x2e48c7)[_0x070e('0xb4')](function(_0x2062f4){if(_0x2062f4[_0x070e('0x113')]==0x1)_0x482296=!![];switch(_0x3cc322[_0x070e('0x105')]){case'0':_0x2e48c7['outboundNoSuchCallsDay']+=0x1;_0x13623c['state']=0x0;_0x13623c[_0x070e('0xa3')]=_0x070e('0x1a6');_0x13623c[_0x070e('0xfc')]+=0x1;_0x13623c[_0x070e('0xeb')]+=0x1;ami[_0x070e('0x49')](_0x070e('0x1a7'),ut[_0x070e('0x1a8')](_0x87d2b3,_0x070e('0x1a9')));_0x59e6d6[_0x070e('0xca')](_0x13623c)[_0x070e('0xad')](loggerCatch(_0x070e('0xed')));if(_0x59e6d6[_0x070e('0x1aa')](0x0,_0x87d2b3,_0x2e48c7)&&!_0x482296){if(_0x13623c[_0x070e('0xfc')]>=_0x2e48c7['dialNoSuchNumberMaxRetry']){_0x59e6d6['createStateFinal'](_0x13623c,_0xe15ea6,_0x36b103,_0x070e('0x1ab'));}else{_0x59e6d6[_0x070e('0xfd')](_0x13623c,_0xe15ea6,_0x36b103,_0x070e('0x1ab'));}}break;case'3':_0x2e48c7['outboundNoAnswerCallsDay']+=0x1;_0x13623c[_0x070e('0xa2')]=0x3;_0x13623c[_0x070e('0xa3')]=_0x070e('0x1ac');_0x13623c[_0x070e('0xf0')]+=0x1;_0x13623c['countglobal']+=0x1;ami[_0x070e('0x49')]('custom:agentnoanswer',ut[_0x070e('0x1a8')](_0x87d2b3,_0x070e('0x1ad')));_0x59e6d6[_0x070e('0xca')](_0x13623c)['catch'](loggerCatch(_0x070e('0x1ae')));if(_0x59e6d6[_0x070e('0x1aa')](0x3,_0x87d2b3,_0x2e48c7)&&!_0x482296){if(_0x13623c[_0x070e('0xf0')]>=_0x2e48c7[_0x070e('0x197')]){_0x59e6d6['createStateFinal'](_0x13623c,_0xe15ea6,_0x36b103,'reason\x203\x20ringing\x20no\x20answer');}else{_0x59e6d6[_0x070e('0xfd')](_0x13623c,_0xe15ea6,_0x36b103,_0x070e('0x1af'));}}break;case'5':_0x2e48c7[_0x070e('0x1b0')]+=0x1;_0x13623c[_0x070e('0xa2')]=0x5;_0x13623c['statedesc']=_0x070e('0x1b1');_0x13623c[_0x070e('0xee')]+=0x1;_0x13623c[_0x070e('0xeb')]+=0x1;ami[_0x070e('0x49')](_0x070e('0x1b2'),ut['buildObj'](_0x87d2b3,'busy'));_0x59e6d6[_0x070e('0xca')](_0x13623c)[_0x070e('0xad')](loggerCatch(_0x070e('0x1b3')));if(_0x59e6d6[_0x070e('0x1aa')](0x5,_0x87d2b3,_0x2e48c7)&&!_0x482296){if(_0x13623c[_0x070e('0xee')]>=_0x2e48c7[_0x070e('0x198')]){_0x59e6d6[_0x070e('0xf5')](_0x13623c,_0xe15ea6,_0x36b103,_0x070e('0x1b4'));}else{_0x59e6d6[_0x070e('0xfd')](_0x13623c,_0xe15ea6,_0x36b103,'reason\x205\x20busy');}}break;case'8':_0x2e48c7[_0x070e('0x1b5')]+=0x1;_0x13623c['state']=0x8;_0x13623c[_0x070e('0xa3')]=_0x070e('0x1b6');_0x13623c[_0x070e('0xef')]+=0x1;_0x13623c['countglobal']+=0x1;ami['emit'](_0x070e('0x1b7'),ut[_0x070e('0x1a8')](_0x87d2b3,'congestion'));_0x59e6d6[_0x070e('0xca')](_0x13623c)[_0x070e('0xad')](loggerCatch(_0x070e('0x1b8')));if(_0x59e6d6[_0x070e('0x1aa')](0x8,_0x87d2b3,_0x2e48c7)&&!_0x482296){if(_0x13623c[_0x070e('0xef')]>=_0x2e48c7['dialCongestionMaxRetry']){_0x59e6d6['createStateFinal'](_0x13623c,_0xe15ea6,_0x36b103,'reason\x208\x20congestion');}else{_0x59e6d6[_0x070e('0xfd')](_0x13623c,_0xe15ea6,_0x36b103,_0x070e('0x1b9'));}}break;case'11':_0x2e48c7['outboundAbandonedCallsDay']+=0x1;_0x13623c[_0x070e('0xa2')]=0xb;_0x13623c[_0x070e('0xa3')]=_0x070e('0x11e');_0x13623c[_0x070e('0xf2')]+=0x1;_0x13623c[_0x070e('0xeb')]+=0x1;_0x59e6d6['createHistory'](_0x13623c)[_0x070e('0xad')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x59e6d6[_0x070e('0x1aa')](0xb,_0x87d2b3,_0x2e48c7)&&!_0x482296){if(_0x13623c['countabandonedretry']>=_0x2e48c7[_0x070e('0x11c')]){_0x59e6d6[_0x070e('0xf5')](_0x13623c,_0xe15ea6,_0x36b103,'reason\x2011\x20abandoned');}else{_0x59e6d6['stateGlobal'](_0x13623c,_0xe15ea6,_0x36b103,_0x070e('0x1ba'));}}break;case'20':_0x2e48c7['outboundRejectCallsDay']+=0x1;_0x13623c['state']=0x14;_0x13623c[_0x070e('0xa3')]=_0x070e('0x1bb');_0x13623c[_0x070e('0xf3')]+=0x1;_0x13623c[_0x070e('0xeb')]+=0x1;ami[_0x070e('0x49')](_0x070e('0x1bc'),ut[_0x070e('0x1a8')](_0x87d2b3,_0x070e('0x1bd')));_0x59e6d6[_0x070e('0xca')](_0x13623c)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x59e6d6[_0x070e('0x1aa')](0x14,_0x87d2b3,_0x2e48c7)&&!_0x482296){if(_0x13623c[_0x070e('0xf3')]>=_0x2e48c7[_0x070e('0x19f')]){_0x59e6d6[_0x070e('0xf5')](_0x13623c,_0xe15ea6,_0x36b103,_0x070e('0x1be'));}else{_0x59e6d6[_0x070e('0xfd')](_0x13623c,_0xe15ea6,_0x36b103,_0x070e('0x1be'));}}break;default:_0x2e48c7[_0x070e('0x103')]+=0x1;_0x13623c[_0x070e('0xa2')]=0xc;_0x13623c[_0x070e('0xa3')]=_0x3cc322[_0x070e('0x105')];_0x59e6d6[_0x070e('0xca')](_0x13623c)['catch'](loggerCatch(_0x070e('0x1bf')));if(_0x59e6d6[_0x070e('0x1aa')](_0x3cc322['reason'],_0x87d2b3,_0x2e48c7)&&!_0x482296){if(_0x13623c[_0x070e('0xee')]+_0x13623c[_0x070e('0xef')]+_0x13623c[_0x070e('0xf0')]+_0x13623c[_0x070e('0xfc')]+_0x13623c[_0x070e('0xf1')]+_0x13623c[_0x070e('0xf2')]+_0x13623c['countmachineretry']+_0x13623c[_0x070e('0xf3')]>=_0x2e48c7[_0x070e('0x196')]){_0x59e6d6[_0x070e('0xfd')](_0x13623c,_0xe15ea6,_0x36b103,_0x3cc322[_0x070e('0x105')]);}else{_0x59e6d6['createStateFinal'](_0x13623c,_0xe15ea6,_0x36b103,_0x3cc322[_0x070e('0x105')]);}}}})[_0x070e('0xb4')](function(_0x3e500b){if(_0x482296){_0x59e6d6[_0x070e('0xb9')](_0x13623c,_0xc99f8f,_0x3477ab)[_0x070e('0xb4')](function(_0x3cfaec){return _0xe15ea6(0x1);});}});});};Dialer[_0x070e('0x1b')][_0x070e('0xfd')]=function(_0x17960c,_0x14b92b,_0x31e72b,_0x378090){var _0x45237a=new Final(_0x17960c);_0x45237a[_0x070e('0xa2')]=0xf;_0x45237a[_0x070e('0xa3')]=_0x070e('0x1c0');this[_0x070e('0xf5')](_0x45237a,_0x14b92b,_0x31e72b,_0x378090);};Dialer[_0x070e('0x1b')][_0x070e('0xf5')]=function(_0x44a756,_0x315d3c,_0xb8b11c,_0x4223cf){this[_0x070e('0xc8')](_0x44a756)[_0x070e('0xb4')](function(){return _0x315d3c(msgResponse(_0x070e('0x1a3'),_0x070e('0xd5'),_0x4223cf));})[_0x070e('0xad')](function(){return _0xb8b11c(msgResponse(_0x070e('0x1c1'),_0x070e('0x144'),_0x070e('0x1c2')));});};Dialer['prototype']['predictive']=function(_0x552911){var _0x9c3e37=_0x552911[_0x070e('0x1c3')]/0x64;var _0x28a3df=_0x552911[_0x070e('0x5e')]/(_0x552911[_0x070e('0x5e')]+_0x552911['outboundAnswerCallsDay']);var _0x25bc13=Math['round'](_0x552911['predictiveIntervalAvailable']*(_0x552911[_0x070e('0x1c4')]/0x64));var _0x20d6c5=Math[_0x070e('0x1c5')](_0x552911[_0x070e('0x1c6')]*(_0x552911[_0x070e('0x1c7')]/0x64));var _0x2cb354=_0x552911[_0x070e('0x1c8')]+_0x552911['talking'];var _0x151aac=Math[_0x070e('0x1c9')](_0x552911['erlangCalls']*_0x552911[_0x070e('0x6c')]*_0x552911[_0x070e('0x67')]*_0x552911[_0x070e('0x68')]);if(_[_0x070e('0x81')](_0x552911[_0x070e('0x28')])){if(!_[_0x070e('0x81')](_0x552911[_0x070e('0x6e')])){_0x552911[_0x070e('0x6e')]=undefined;loggerPredictive['error'](_0x070e('0x1ca'),_0x070e('0x1cb'));}if(!_[_0x070e('0x81')](_0x552911[_0x070e('0x8b')])){loggerPredictive[_0x070e('0x94')](_0x070e('0x1ca'),_0x070e('0x1cc'));clearInterval(_0x552911[_0x070e('0x8b')]);_0x552911[_0x070e('0x8b')]=undefined;}_0x552911[_0x070e('0x28')]=moment()[_0x070e('0x72')](_0x070e('0xf9'));loggerPredictive['info'](_0x552911[_0x070e('0x3d')],'collection\x20data\x20in\x20progressive\x20at',_0x552911[_0x070e('0x28')]);this[_0x070e('0x155')](_0x552911,0x1);}else if(ifInterval(_0x552911[_0x070e('0x1cd')],_0x552911[_0x070e('0x28')])){this[_0x070e('0x155')](_0x552911,0x1);loggerPredictiveCalls[_0x070e('0x77')](_0x070e('0x1ce'),_0x552911[_0x070e('0x28')],_0x552911[_0x070e('0x3d')]);_0x552911[_0x070e('0x1cf')]=0x0;_0x552911[_0x070e('0x1d0')]=0x0;}else if(_0x9c3e37<_0x28a3df&&_0x552911[_0x070e('0x1d1')]===_0x070e('0x1d2')){freeVariablesPredictive(_0x552911);loggerPredictive['info'](_0x070e('0x1d3'),'Dropped\x20calls\x20day',_0x28a3df,_0x070e('0x28'),_0x552911[_0x070e('0x3d')]);}else if(_0x151aac<_0x552911[_0x070e('0x1d0')]&&_0x552911['dialPredictiveOptimization']===_0x070e('0x1d2')){freeVariablesPredictive(_0x552911);loggerPredictive[_0x070e('0x77')](_0x070e('0x1d4'),_0x070e('0x1d5'),_0x151aac,_0x070e('0x1d6'),_0x552911[_0x070e('0x1d0')],'startProgressive',_0x552911[_0x070e('0x3d')]);}else if(!ifInterval(_0x552911[_0x070e('0x1cd')],_0x552911[_0x070e('0x28')])&&_[_0x070e('0x81')](_0x552911['startPredictive'])&&!_['isUndefined'](_0x552911[_0x070e('0x28')])){_0x552911[_0x070e('0x6e')]=moment()[_0x070e('0x72')](_0x070e('0xf9'));loggerPredictive[_0x070e('0x77')](_0x552911[_0x070e('0x3d')],_0x070e('0x1d7'),_0x552911['startPredictive']);this['averageHandleTime'](_0x552911[_0x070e('0x1cd')])[_0x070e('0xb4')](this[_0x070e('0x1d8')](_0x552911))['then'](mergeDataErlangB(_0x552911))[_0x070e('0xb4')](this[_0x070e('0x1d9')](_0x552911))[_0x070e('0xad')](loggerCatchPredictive(_0x070e('0x1da'),_0x552911));}else if(!ifInterval(_0x552911[_0x070e('0x1cd')],_0x552911[_0x070e('0x6e')])){_0x552911[_0x070e('0x1d0')]=0x0;_0x552911['startPredictive']=moment()[_0x070e('0x72')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x070e('0x77')](_0x552911[_0x070e('0x3d')],_0x070e('0x1db'),_0x552911[_0x070e('0x6e')]);clearInterval(_0x552911['handlePredictive']);_0x552911[_0x070e('0x8b')]=undefined;this[_0x070e('0xbd')](_0x552911[_0x070e('0x1cd')])['then'](this[_0x070e('0x1d8')](_0x552911))[_0x070e('0xb4')](mergeDataErlangB(_0x552911))['then'](this['startMethodPredictive'](_0x552911))['catch'](loggerCatchPredictive(_0x070e('0x1dc'),_0x552911));}else if(_0x552911[_0x070e('0x1c6')]&&_0x2cb354<_0x552911[_0x070e('0x1c6')]-_0x20d6c5){freeVariablesPredictive(_0x552911);loggerPredictive['info'](_0x552911[_0x070e('0x3d')],_0x070e('0x1dd'),_0x2cb354,_0x070e('0x1de'),_0x552911[_0x070e('0x1c6')],'-',_0x20d6c5,'=',_0x552911[_0x070e('0x1c6')]-_0x20d6c5,')');}else if(_0x552911[_0x070e('0x1c6')]&&_0x2cb354>_0x552911[_0x070e('0x1c6')]+_0x25bc13){freeVariablesPredictive(_0x552911);loggerPredictive[_0x070e('0x77')](_0x552911['name'],_0x070e('0x1dd'),_0x2cb354,_0x070e('0x1df'),_0x552911[_0x070e('0x1c6')],'+',_0x25bc13,'=',_0x552911[_0x070e('0x1c6')]+_0x25bc13,')');}};Dialer[_0x070e('0x1b')][_0x070e('0x1d8')]=function(_0x2b37b2){var _0x4a3d79=this;return function(_0x40e9b7){return new BPromise(function(_0x2c70b6,_0x289335){_[_0x070e('0x88')](_0x2b37b2,_0x40e9b7[0x0]);if(checkGetDataPredictive(_0x40e9b7[0x0])){var _0x235792=_0x2b37b2['predictiveIntervalAvailable']=_0x2b37b2[_0x070e('0x52')]+_0x2b37b2['available'];var _0x2b22ea=_0x2b37b2['dialPredictiveInterval']*0x3c;var _0x43eea3=_0x40e9b7[0x0][_0x070e('0x65')]+_0x40e9b7[0x0][_0x070e('0x64')];var _0x217b1b=(_0x40e9b7[0x0][_0x070e('0x63')]+_0x40e9b7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x40e9b7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x40e9b7[0x0][_0x070e('0x6a')];_0x2b37b2[_0x070e('0x67')]=_0x217b1b>0x0?_0x217b1b:0x1;switch(_0x2b37b2[_0x070e('0x1d1')]){case _0x070e('0x1d2'):var _0x276751=_0x2b37b2[_0x070e('0x1c3')]/0x64;return _0x4a3d79['abandonmentRate'](_0x235792,_0x2b22ea,_0x43eea3,_0x217b1b,_0x276751)[_0x070e('0xb4')](function(_0x3f3b95){return _0x2c70b6(_0x3f3b95);});case _0x070e('0x1e0'):var _0x163b42=_0x2b37b2['dialPredictiveOptimizationPercentage']/0x64;return _0x4a3d79[_0x070e('0x1e1')](_0x235792,_0x2b22ea,_0x43eea3,_0x217b1b,_0x163b42)[_0x070e('0xb4')](function(_0x583a84){return _0x2c70b6(_0x583a84);});default:return _0x289335(msgResponse('[getDataPredictive]',_0x070e('0x144'),'Unknown\x20Predictive'));}}else{return _0x289335(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x070e('0x1b')][_0x070e('0x1e2')]=function(_0x12544c){var _0x289e79=this;return function(_0x44d7ee){return new BPromise(function(_0x345f61,_0xe00edb){_[_0x070e('0x88')](_0x12544c,_0x44d7ee[0x0]);if(checkGetDataPredictive(_0x44d7ee[0x0])){loggerPredictive[_0x070e('0x77')](JSON[_0x070e('0x45')](_0x44d7ee[0x0]));if(_0x12544c[_0x070e('0x1d1')]===_0x070e('0x1d2')){return _0x289e79[_0x070e('0xc6')](_0x12544c['id'])[_0x070e('0xb4')](function(_0x3a8108){var _0x3a99e6=_0x12544c[_0x070e('0x4e')]-_0x3a8108[0x0][_0x070e('0x1e3')];var _0xbaa431=_0x12544c['dialPredictiveInterval']*0x3c;var _0x505871=_0x44d7ee[0x0]['predictiveIntervalAvgTalktime']+_0x44d7ee[0x0]['predictiveIntervalAvgHoldtime'];var _0x3592c4=(_0x44d7ee[0x0][_0x070e('0x63')]+_0x44d7ee[0x0][_0x070e('0x10f')]+_0x44d7ee[0x0][_0x070e('0x7c')])/_0x44d7ee[0x0]['predictiveIntervalTotalCalls'];var _0x519d64=_0x12544c[_0x070e('0x1c3')]/0x64;_0x12544c[_0x070e('0x69')]=_0x3a8108[0x0][_0x070e('0x1e3')]||0x0;_0x12544c[_0x070e('0x67')]=_0x3592c4>0x0?_0x3592c4:0x1;return _0x289e79[_0x070e('0x1e4')](_0x3a99e6,_0xbaa431,_0x505871,_0x3592c4,_0x519d64);})['then'](function(_0x4e8231){return _0x345f61(_0x4e8231);})[_0x070e('0xad')](function(_0x4b99ee){return _0xe00edb(msgResponse('[CatchErlangB]','Failure',JSON[_0x070e('0x45')](_0x4b99ee)));});}if(_0x12544c['dialPredictiveOptimization']===_0x070e('0x1e0')){return _0x289e79[_0x070e('0xc6')](_0x12544c['id'])[_0x070e('0xb4')](function(_0x193f7c){var _0x286ce2=_0x12544c[_0x070e('0x4e')]-_0x193f7c[0x0][_0x070e('0x1e3')];var _0x57fc31=_0x12544c[_0x070e('0x1cd')]*0x3c;var _0x3dbf17=_0x44d7ee[0x0][_0x070e('0x65')]+_0x44d7ee[0x0][_0x070e('0x64')];var _0x43ab95=(_0x44d7ee[0x0]['predictiveIntervalAnsweredCalls']+_0x44d7ee[0x0][_0x070e('0x10f')]+_0x44d7ee[0x0][_0x070e('0x7c')])/_0x44d7ee[0x0][_0x070e('0x6a')];var _0xcb1589=_0x12544c[_0x070e('0x1c3')]/0x64;_0x12544c[_0x070e('0x69')]=_0x193f7c[0x0]['outboundQueuePauses']||0x0;_0x12544c[_0x070e('0x67')]=_0x43ab95>0x0?_0x43ab95:0x1;return _0x289e79['busyFactor'](_0x286ce2,_0x57fc31,_0x3dbf17,_0x43ab95,_0xcb1589);})[_0x070e('0xb4')](function(_0x50c878){return _0x345f61(_0x50c878);})[_0x070e('0xad')](function(_0x299878){return _0xe00edb(msgResponse('[CatchErlangB]','Failure',JSON[_0x070e('0x45')](_0x299878)));});}}else{return _0xe00edb(msgResponse(_0x070e('0x1e5'),_0x070e('0x144'),_0x070e('0x1e6')));}});};};Dialer[_0x070e('0x1b')]['startMethodPredictive']=function(_0x4b0061){var _0x1e00a2=this;return function(){var _0x377b40=0x0;var _0x4b2a30=Math['floor'](_0x4b0061[_0x070e('0x6b')]*0x3e8);if(_0x4b2a30>0x0){_0x4b2a30=_0x4b2a30<0x64?0x64:_0x4b2a30;loggerPredictive[_0x070e('0x77')](_0x4b0061[_0x070e('0x3d')],_0x070e('0x1e7'),_0x4b2a30,_0x070e('0x46'));_0x4b0061[_0x070e('0x8b')]=setInterval(function(){_0x1e00a2[_0x070e('0x8b')](_0x4b0061);loggerPredictiveCalls[_0x070e('0x77')](_0x070e('0x1e8'),_0x377b40+=0x1);},_0x4b2a30);}else{loggerPredictive[_0x070e('0x77')](_0x4b0061[_0x070e('0x3d')],_0x070e('0x1e9'));}};};Dialer['prototype'][_0x070e('0x1ea')]=function(_0x1ac06e,_0x4bada7){var _0x4fd188=this;return function(_0x399003){if(_['isEmpty'](_0x399003)){if(_[_0x070e('0xaa')](_0x4bada7['UserId'])||!_0x4bada7[_0x070e('0x1eb')]){if(_0x1ac06e['dialMethod']===_0x070e('0x8')){_0x1ac06e[_0x070e('0x129')]=_[_0x070e('0x81')](_0x1ac06e[_0x070e('0x129')])?!![]:_0x1ac06e['queueStatusComplete'];var _0x1a380a=uuid['v4']();_0x4fd188[_0x070e('0xa8')][_0x1a380a]=new Action(_0x1ac06e,_0x4bada7,_0x1a380a);loggerBooked['info'](_0x070e('0x1ec'),_0x1a380a,'queueStatusComplete:\x20',JSON[_0x070e('0x45')](_0x1ac06e[_0x070e('0x129')]),_0x070e('0x1ed'),_0x1ac06e['name']);if(_0x1ac06e[_0x070e('0x129')]){_0x1ac06e[_0x070e('0x129')]=![];_0x4fd188['queueBooked'][_0x4fd188[_0x070e('0xa8')][_0x1a380a][_0x070e('0xb0')]]=[];ami[_0x070e('0xab')]({'actionid':_0x1a380a,'action':_0x070e('0x1ee'),'queue':_0x1ac06e[_0x070e('0x3d')]})[_0x070e('0xad')](function(){_0x4fd188[_0x070e('0xaf')](_0x1ac06e);_0x4fd188['rescheduleContact']({'active':![],'ContactId':_0x4fd188[_0x070e('0xa8')][_0x1a380a][_0x070e('0xcf')],'ListId':_0x4fd188['actions'][_0x1a380a][_0x070e('0xd0')],'VoiceQueueId':_0x4fd188[_0x070e('0xa8')][_0x1a380a][_0x070e('0xd1')]||undefined,'CampaignId':_0x4fd188[_0x070e('0xa8')][_0x1a380a][_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch(_0x070e('0x1ef')));delete _0x4fd188[_0x070e('0xa8')][_0x1a380a];});}else{loggerBooked[_0x070e('0x77')](_0x070e('0x1f0'),JSON['stringify'](_0x1ac06e[_0x070e('0x129')]),_0x070e('0x1ed'),_0x1ac06e[_0x070e('0x3d')]);_0x4fd188['updateOriginated'](_0x1ac06e);_0x4fd188[_0x070e('0xbf')]({'active':![],'ContactId':_0x4fd188[_0x070e('0xa8')][_0x1a380a][_0x070e('0xcf')],'ListId':_0x4fd188[_0x070e('0xa8')][_0x1a380a][_0x070e('0xd0')],'VoiceQueueId':_0x4fd188['actions'][_0x1a380a]['VoiceQueueId']||undefined,'CampaignId':_0x4fd188[_0x070e('0xa8')][_0x1a380a]['CampaignId']||undefined})[_0x070e('0xad')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4fd188['actions'][_0x1a380a];}}else{return _0x4fd188[_0x070e('0x1f1')](_0x1ac06e,_0x4bada7);}}else{if(getDiff(_0x4bada7['scheduledat'])<_0x1ac06e[_0x070e('0x1f2')]*0x3c){if(_0x4bada7[_0x070e('0x1f3')]&&!_0x4bada7[_0x070e('0x1f3')][_0x070e('0x1f4')]){_0x4fd188[_0x070e('0x1f')][_0x070e('0x12d')](_0x4bada7['id'])[_0x070e('0x1d')](function(){_0x4fd188[_0x070e('0xaf')](_0x1ac06e);});}else{_0x4fd188[_0x070e('0xc1')]({'active':![]},_0x4bada7['id'],0x1)[_0x070e('0x1d')](function(){_0x4fd188[_0x070e('0xaf')](_0x1ac06e);});}}else{_0x1ac06e[_0x070e('0x1f5')]+=0x1;_0x4fd188[_0x070e('0xaf')](_0x1ac06e);if(_0x1ac06e['dialRecallInQueue']){_0x4fd188['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4bada7['ContactId'],'ListId':_0x4bada7[_0x070e('0xd0')],'VoiceQueueId':_0x4bada7[_0x070e('0xd1')]||undefined,'CampaignId':_0x4bada7[_0x070e('0xd2')]||undefined})[_0x070e('0xad')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x4fd188[_0x070e('0xca')](createObjHistory(_0x1ac06e,_0x4bada7,_0x070e('0x1f6'),0x17,_0x070e('0x1f7')))[_0x070e('0xad')](loggerCatch(_0x070e('0x1f8')));}else{_0x4fd188['saveInDb'](createObjHistory(_0x1ac06e,_0x4bada7,_0x070e('0x1f9'),0x16,_0x070e('0x1fa')),_0x070e('0x1fb'),_0x070e('0x1fc'));}}}}else{_0x1ac06e['outboundBlacklistCallsDay']+=0x1;_0x4fd188[_0x070e('0xce')](createObjHistory(_0x1ac06e,_0x4bada7,_0x070e('0x1fd'),0xd,_0x070e('0x1fe')),'[Originate][historyBlacklist]',_0x070e('0x1ff'));throw _0x070e('0x200');}};};Dialer[_0x070e('0x1b')][_0x070e('0x15b')]=function(_0x45c550){var _0xd53e36=this;var _0x153ad2=_0x45c550[_0x070e('0x201')]-_0x45c550[_0x070e('0x93')]-_0x45c550[_0x070e('0x202')];emitCampaignSummary(_0x45c550);if(_0x153ad2>0x0){if(_0x153ad2>this[_0x070e('0x24')]){_0x153ad2=this['maxNumberOriginate'];}_0x45c550[_0x070e('0x202')]+=_0x153ad2;this[_0x070e('0xc4')](_0x45c550['id'],_0x153ad2,_0x45c550[_0x070e('0x203')])['then'](function(_0x4712b6){_0x45c550['temp']-=_0x153ad2;_0x45c550[_0x070e('0x202')]=_0x45c550[_0x070e('0x202')]>0x0?_0x45c550['temp']:0x0;if(!checkContactEmpty(_0x4712b6)){_0x45c550[_0x070e('0x3c')]=_0x070e('0x99');logger[_0x070e('0x77')](_0x070e('0x204')+_0x45c550['name']);}else{_0x45c550['originated']+=_0x4712b6[_0x070e('0x131')];_0x45c550[_0x070e('0x3c')]=_0x070e('0x205');for(var _0x16dda3=0x0;_0x16dda3<_0x4712b6[_0x070e('0x131')];_0x16dda3+=0x1){_0x45c550[_0x070e('0x206')]+=0x1;if(_[_0x070e('0xaa')](_0x4712b6[_0x16dda3])||_[_0x070e('0xaa')](_0x4712b6[_0x16dda3][_0x070e('0x182')])||_['isNil'](_0x4712b6[_0x16dda3][_0x070e('0x167')])){_0xd53e36[_0x070e('0xcd')](_0x070e('0x207'),_0x45c550,_0x4712b6[_0x16dda3]);}else{_0xd53e36[_0x070e('0xbb')](_['pick'](_0x4712b6[_0x16dda3],[_0x070e('0xd2'),_0x070e('0x208')]))[_0x070e('0xb4')](_0xd53e36[_0x070e('0x1ea')](_0x45c550,_0x4712b6[_0x16dda3]))[_0x070e('0xad')](_0xd53e36[_0x070e('0x209')](_0x070e('0x20a'),_0x45c550));}}}})[_0x070e('0xad')](loggerGetContactDialer(_0x070e('0x20b'),_0x45c550,_0x153ad2));}};Dialer[_0x070e('0x1b')][_0x070e('0x155')]=function(_0x5ef561,_0x6ced0b){var _0x5ef7f8=this;var _0x58f400=[];var _0x5b8b57=_0x6ced0b>=0x1?_0x6ced0b:0x1;if(_0x5ef561['dialMethod']===_0x070e('0x8')){_0x5b8b57=0x1;}var _0x19def3=Math[_0x070e('0x1c9')](_0x5ef561[_0x070e('0x1c8')]*_0x5b8b57)-_0x5ef561['originated']-_0x5ef561[_0x070e('0x202')];emitVoiceQueueSummary(_0x5ef561);if(_0x5ef561[_0x070e('0x20c')]>0x0){var _0x45d651=_0x5ef561['dialLimitQueue']-_0x5ef561[_0x070e('0x93')]-_0x5ef561['talking']-_0x5ef561[_0x070e('0x202')]-_0x5ef561[_0x070e('0x20d')];if(_0x19def3>_0x45d651){_0x19def3=_0x45d651;}}if(_0x19def3>0x0){if(_0x5ef561[_0x070e('0x57')]==='booked'){_0x19def3=0x1;}if(_0x19def3>this[_0x070e('0x24')]){_0x19def3=this['maxNumberOriginate'];}_0x5ef561[_0x070e('0x202')]+=_0x19def3;for(var _0x22a361 in this[_0x070e('0x22')]){if(typeof this['agents'][_0x22a361]!==_0x070e('0x92')){if(this['agents'][_0x22a361][_0x070e('0xa2')]===_0x070e('0x20e')&&this['agents'][_0x22a361][_0x070e('0xac')]==='reachable'){_0x58f400[_0x070e('0x127')](this[_0x070e('0x22')][_0x22a361]['id']);}}}this[_0x070e('0xc3')](_0x5ef561['id'],_0x58f400,_0x19def3,_0x5ef561[_0x070e('0x203')])[_0x070e('0xb4')](function(_0x57eb67){_0x5ef561[_0x070e('0x202')]-=_0x19def3;_0x5ef561[_0x070e('0x202')]=_0x5ef561[_0x070e('0x202')]>0x0?_0x5ef561[_0x070e('0x202')]:0x0;if(!checkContactEmpty(_0x57eb67)){_0x5ef7f8[_0x070e('0xb2')](_0x5ef561)[_0x070e('0xb4')](sendMessageReschedule(_0x5ef561))[_0x070e('0xad')](loggerCatch(_0x070e('0xb5')));}else{_0x5ef561[_0x070e('0x93')]+=_0x57eb67['length'];_0x5ef561['message']=_0x5ef561[_0x070e('0x57')]===_0x070e('0x8')?_0x070e('0x20f'):'RUNNING';for(var _0x3bb67b=0x0;_0x3bb67b<_0x57eb67[_0x070e('0x131')];_0x3bb67b+=0x1){if(_['isNil'](_0x57eb67[_0x3bb67b])||_[_0x070e('0xaa')](_0x57eb67[_0x3bb67b][_0x070e('0x182')])||_[_0x070e('0xaa')](_0x57eb67[_0x3bb67b][_0x070e('0x167')])){_0x5ef7f8['emptyContact'](_0x070e('0x207'),_0x5ef561,_0x57eb67[_0x3bb67b]);}else{_0x5ef7f8[_0x070e('0xb6')](_[_0x070e('0x12b')](_0x57eb67[_0x3bb67b],['VoiceQueueId',_0x070e('0x208')]))['then'](_0x5ef7f8[_0x070e('0x1ea')](_0x5ef561,_0x57eb67[_0x3bb67b]))['catch'](_0x5ef7f8[_0x070e('0x209')](_0x070e('0x207'),_0x5ef561));}}}})[_0x070e('0xad')](loggerGetContactDialer(_0x070e('0x210'),_0x5ef561,_0x19def3));}};Dialer[_0x070e('0x1b')][_0x070e('0x8b')]=function(_0x23f6a2){if(_0x23f6a2[_0x070e('0x20c')]>0x0){var _0x1ad516=_0x23f6a2['dialLimitQueue']-_0x23f6a2['originated']-_0x23f6a2[_0x070e('0x52')];if(_0x1ad516>0x0){this[_0x070e('0x211')](_0x23f6a2);}else{loggerPredictiveCalls[_0x070e('0x77')](_0x070e('0x212'));}}else{this[_0x070e('0x211')](_0x23f6a2);}};Dialer[_0x070e('0x1b')][_0x070e('0x211')]=function(_0x52d0e2){var _0x39b9cc=this;var _0x5f4461=[];_0x52d0e2[_0x070e('0x93')]+=0x1;for(var _0x40ba6b in this['agents']){if(typeof this[_0x070e('0x22')][_0x40ba6b]!==_0x070e('0x92')){if(this[_0x070e('0x22')][_0x40ba6b][_0x070e('0xa2')]===_0x070e('0x20e')&&this[_0x070e('0x22')][_0x40ba6b][_0x070e('0xac')]===_0x070e('0xd8')){_0x5f4461['push'](this[_0x070e('0x22')][_0x40ba6b]['id']);}}}this[_0x070e('0xc3')](_0x52d0e2['id'],_0x5f4461,0x1,_0x52d0e2[_0x070e('0x203')])[_0x070e('0xb4')](function(_0x26b981){if(!checkContactEmpty(_0x26b981)){checkContactLowerLimitOriginate(_0x52d0e2,0x1,0x0);_0x39b9cc[_0x070e('0xb2')](_0x52d0e2)['then'](sendMessageReschedule(_0x52d0e2))[_0x070e('0xad')](loggerCatch('[countReScheduled]\x20'));}else{_0x52d0e2[_0x070e('0x3c')]='RUNNING';if(_[_0x070e('0xaa')](_0x26b981[0x0])||_[_0x070e('0xaa')](_0x26b981[0x0][_0x070e('0x182')])||_[_0x070e('0xaa')](_0x26b981[0x0][_0x070e('0x167')])){_0x39b9cc['emptyContact'](_0x070e('0x207'),_0x52d0e2,_0x26b981[0x0]);}else{_0x39b9cc[_0x070e('0xb6')](_[_0x070e('0x12b')](_0x26b981[0x0],[_0x070e('0xd1'),_0x070e('0x208')]))['then'](_0x39b9cc['checkContactBlack'](_0x52d0e2,_0x26b981[0x0]))['catch'](_0x39b9cc['loggerHandler'](_0x070e('0x213'),_0x52d0e2));}}})[_0x070e('0xad')](loggerGetContactDialer(_0x070e('0x214'),_0x52d0e2,0x1));emitVoiceQueueSummary(_0x52d0e2);};Dialer[_0x070e('0x1b')][_0x070e('0x1e4')]=function(_0x3ab4ee,_0x1ea623,_0x931664,_0x14c7a7,_0x5d2f6c,_0xcbb5fc){loggerPredictive[_0x070e('0x77')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0x070e('0x215'),_0x3ab4ee);loggerPredictive['info'](_0x070e('0x216'),_0x1ea623);loggerPredictive[_0x070e('0x77')](_0x070e('0x217'),_0x931664);loggerPredictive[_0x070e('0x77')]('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',_0x14c7a7);loggerPredictive['info'](_0x070e('0x218'),_0x5d2f6c);loggerPredictive[_0x070e('0x77')]('---------------------------');return new BPromise(function(_0xdacff5,_0x2caf0f){if(_0x3ab4ee<=0x0||isNaN(_0x3ab4ee)){return _0x2caf0f(msgResponse(_0x070e('0x219'),_0x070e('0x44'),_0x070e('0x21a')+_0x3ab4ee));}if(_0x931664<=0x0||isNaN(_0x931664)){return _0x2caf0f(msgResponse(_0x070e('0x219'),'Error',_0x070e('0x21b')+_0x931664));}if(_0x14c7a7<=0x0||isNaN(_0x14c7a7)){return _0x2caf0f(msgResponse('[abandonmentRate]',_0x070e('0x44'),_0x070e('0x21c')+_0x14c7a7));}if(_0x1ea623<=0x0||isNaN(_0x1ea623)){return _0x2caf0f(msgResponse(_0x070e('0x219'),_0x070e('0x44'),_0x070e('0x21d')+_0x1ea623));}if(_0x5d2f6c<=0x0||isNaN(_0x5d2f6c)){return _0x2caf0f(msgResponse(_0x070e('0x219'),_0x070e('0x44'),'Amax\x20=\x20'+_0x5d2f6c));}_0xcbb5fc=_0xcbb5fc||0x0;var _0x26d29b=0x1/_0x931664;var _0x81d538=0x0;var _0x179791=0x0;var _0x5d4efd=0x0;var _0x3c3c7d=0x0;for(var _0x2a47f7=0x0;_0x5d4efd<_0x5d2f6c;_0x2a47f7+=0x1){_0x179791=_0x2a47f7/_0x1ea623;_0x81d538=(_0x14c7a7*_0x179791+_0xcbb5fc)/_0x26d29b;_0x5d4efd=erlangb(_0x81d538,_0x3ab4ee);_0x3c3c7d=_0x81d538/_0x3ab4ee*(0x1-erlangb(_0x81d538,_0x3ab4ee));}return _0xdacff5({'erlangCalls':_0x2a47f7,'erlangCallToSecond':_0x1ea623/_0x2a47f7,'erlangAbandonmentRate':_0x5d4efd,'erlangBusyFactor':_0x3c3c7d});});};Dialer[_0x070e('0x1b')][_0x070e('0x1e1')]=function(_0x1f9ad4,_0x282499,_0xdd2fe3,_0x50dfb7,_0x5e41c5,_0x53d000){loggerPredictive[_0x070e('0x77')](_0x070e('0x21e'));loggerPredictive[_0x070e('0x77')](_0x070e('0x215'),_0x1f9ad4);loggerPredictive[_0x070e('0x77')](_0x070e('0x216'),_0x282499);loggerPredictive[_0x070e('0x77')]('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',_0xdd2fe3);loggerPredictive[_0x070e('0x77')](_0x070e('0x21f'),_0x50dfb7);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e41c5);loggerPredictive[_0x070e('0x77')]('---------------------------');return new BPromise(function(_0xa66cdc,_0x5480e5){if(_0x1f9ad4<=0x0||isNaN(_0x1f9ad4)){return _0x5480e5(msgResponse(_0x070e('0x220'),_0x070e('0x44'),_0x070e('0x21a')+_0x1f9ad4));}if(_0xdd2fe3<=0x0||isNaN(_0xdd2fe3)){return _0x5480e5(msgResponse(_0x070e('0x220'),'Error',_0x070e('0x21b')+_0xdd2fe3));}if(_0x50dfb7<=0x0||isNaN(_0x50dfb7)){return _0x5480e5(msgResponse(_0x070e('0x220'),'Error','p\x20=\x20'+_0x50dfb7));}if(_0x282499<=0x0||isNaN(_0x282499)){return _0x5480e5(msgResponse('[busyFactor]',_0x070e('0x44'),'interval\x20=\x20'+_0x282499));}if(_0x5e41c5<=0x0||isNaN(_0x5e41c5)){return _0x5480e5(msgResponse(_0x070e('0x220'),_0x070e('0x44'),_0x070e('0x221')+_0x5e41c5));}_0x53d000=_0x53d000||0x0;var _0x283972=0x1/_0xdd2fe3;var _0x2edbaa=0x0;var _0x4ee787=0x0;var _0x2df51e=0x0;var _0x10be4b=0x0;for(var _0x133dde=0x0;_0x10be4b<_0x5e41c5;_0x133dde+=0x1){_0x4ee787=_0x133dde/_0x282499;_0x2edbaa=(_0x50dfb7*_0x4ee787+_0x53d000)/_0x283972;_0x2df51e=erlangb(_0x2edbaa,_0x1f9ad4);_0x10be4b=_0x2edbaa/_0x1f9ad4*(0x1-erlangb(_0x2edbaa,_0x1f9ad4));}return _0xa66cdc({'erlangCalls':_0x133dde,'erlangCallToSecond':_0x282499/_0x133dde,'erlangAbandonmentRate':_0x2df51e,'erlangBusyFactor':_0x10be4b});});};module[_0x070e('0x222')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index ce4a979..36032b3 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 _0x3cbb=['scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','ringtime','holdtime','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff'];(function(_0x20ae2f,_0x455457){var _0x47adce=function(_0xae326f){while(--_0xae326f){_0x20ae2f['push'](_0x20ae2f['shift']());}};_0x47adce(++_0x455457);}(_0x3cbb,0x6b));var _0xb3cb=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x3cbb[_0x541ea6];return _0x3c3e84;};'use strict';var util=require(_0xb3cb('0x0'));var _=require(_0xb3cb('0x1'));var moment=require('moment');function getSeconds(_0x3c60ef,_0x202d32){var _0x547753=moment(_0x3c60ef)[_0xb3cb('0x2')](0x0);var _0x3897c3=moment(_0x202d32)[_0xb3cb('0x2')](0x0);return _0x547753[_0xb3cb('0x3')](_0x3897c3,'seconds');}function QueueCallerAbandon(_0x1d2eef,_0x1e08dd){this[_0xb3cb('0x4')]=_0x1d2eef['scheduledat'];this[_0xb3cb('0x5')]=_0x1d2eef['type'];this[_0xb3cb('0x6')]=_0x1d2eef[_0xb3cb('0x5')]===_0xb3cb('0x7')?_0xb3cb('0x8'):_0x1d2eef[_0xb3cb('0x5')];this['countbusyretry']=_0x1d2eef['countbusyretry'];this[_0xb3cb('0x9')]=_0x1d2eef['countcongestionretry'];this[_0xb3cb('0xa')]=_0x1d2eef['countnoanswerretry'];this['countglobal']=_0x1d2eef['countbusyretry']+_0x1d2eef[_0xb3cb('0x9')]+_0x1d2eef[_0xb3cb('0xa')]+_0x1d2eef['countnosuchnumberretry']+_0x1d2eef['countdropretry']+_0x1d2eef['countabandonedretry']+_0x1d2eef[_0xb3cb('0xb')]+_0x1d2eef[_0xb3cb('0xc')];this['countnosuchnumberretry']=_0x1d2eef[_0xb3cb('0xd')];this[_0xb3cb('0xe')]=_0x1d2eef[_0xb3cb('0xe')];this[_0xb3cb('0xf')]=_0x1d2eef[_0xb3cb('0xf')];this[_0xb3cb('0xb')]=_0x1d2eef[_0xb3cb('0xb')];this['countagentrejectretry']=_0x1d2eef[_0xb3cb('0xc')];this[_0xb3cb('0x10')]=_0x1e08dd[_0xb3cb('0x10')];this[_0xb3cb('0x11')]=_0x1d2eef[_0xb3cb('0x12')];this['calleridnum']=_0x1d2eef[_0xb3cb('0x13')];this[_0xb3cb('0x14')]=_0x1d2eef[_0xb3cb('0x14')];this[_0xb3cb('0x15')]=_0x1d2eef[_0xb3cb('0x15')];this[_0xb3cb('0x16')]=_0x1d2eef[_0xb3cb('0x16')];this['endtime']=this[_0xb3cb('0x16')];this[_0xb3cb('0x17')]=getSeconds(_0x1d2eef[_0xb3cb('0x15')],_0x1d2eef['starttime']);this[_0xb3cb('0x18')]=getSeconds(this['droptime'],_0x1d2eef[_0xb3cb('0x15')]);this['talktime']=0x0;this['queue']=_0x1e08dd[_0xb3cb('0x8')];this['membername']=_0x1e08dd[_0xb3cb('0x19')];this[_0xb3cb('0x1a')]=_0x1e08dd[_0xb3cb('0x1a')];this[_0xb3cb('0x1b')]=_0x1d2eef[_0xb3cb('0x1b')];this[_0xb3cb('0x1c')]=_0x1d2eef[_0xb3cb('0x1c')];this['callbackat']=_0x1d2eef['callbackat'];this[_0xb3cb('0x1d')]=_0x1d2eef[_0xb3cb('0x1d')];this['ContactId']=_0x1d2eef[_0xb3cb('0x1e')];this[_0xb3cb('0x1f')]=_0x1d2eef[_0xb3cb('0x1f')];this[_0xb3cb('0x20')]=_0x1d2eef['UserId'];this[_0xb3cb('0x21')]=_0x1d2eef[_0xb3cb('0x21')];this['CampaignId']=_0x1d2eef[_0xb3cb('0x22')];this[_0xb3cb('0x23')]=_0x1d2eef[_0xb3cb('0x23')]||'';this[_0xb3cb('0x24')]=_0x1d2eef['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x5d78=['calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x5d78,0x18e));var _0x85d7=function(_0x31f51f,_0x53404e){_0x31f51f=_0x31f51f-0x0;var _0x5e6499=_0x5d78[_0x31f51f];return _0x5e6499;};'use strict';var util=require(_0x85d7('0x0'));var _=require(_0x85d7('0x1'));var moment=require(_0x85d7('0x2'));function getSeconds(_0x1c9cac,_0x518656){var _0x3bcba5=moment(_0x1c9cac)[_0x85d7('0x3')](0x0);var _0x1e1b0f=moment(_0x518656)[_0x85d7('0x3')](0x0);return _0x3bcba5[_0x85d7('0x4')](_0x1e1b0f,_0x85d7('0x5'));}function QueueCallerAbandon(_0x459051,_0x290d78){this[_0x85d7('0x6')]=_0x459051['scheduledat'];this[_0x85d7('0x7')]=_0x459051[_0x85d7('0x7')];this[_0x85d7('0x8')]=_0x459051[_0x85d7('0x7')]==='outbound'?_0x85d7('0x9'):_0x459051[_0x85d7('0x7')];this['countbusyretry']=_0x459051[_0x85d7('0xa')];this[_0x85d7('0xb')]=_0x459051[_0x85d7('0xb')];this[_0x85d7('0xc')]=_0x459051[_0x85d7('0xc')];this[_0x85d7('0xd')]=_0x459051[_0x85d7('0xa')]+_0x459051[_0x85d7('0xb')]+_0x459051['countnoanswerretry']+_0x459051[_0x85d7('0xe')]+_0x459051[_0x85d7('0xf')]+_0x459051[_0x85d7('0x10')]+_0x459051['countmachineretry']+_0x459051[_0x85d7('0x11')];this[_0x85d7('0xe')]=_0x459051['countnosuchnumberretry'];this[_0x85d7('0xf')]=_0x459051[_0x85d7('0xf')];this[_0x85d7('0x10')]=_0x459051[_0x85d7('0x10')];this[_0x85d7('0x12')]=_0x459051[_0x85d7('0x12')];this[_0x85d7('0x11')]=_0x459051[_0x85d7('0x11')];this['uniqueid']=_0x290d78[_0x85d7('0x13')];this[_0x85d7('0x14')]=_0x459051[_0x85d7('0x15')];this[_0x85d7('0x16')]=_0x459051[_0x85d7('0x17')];this[_0x85d7('0x18')]=_0x459051['starttime'];this[_0x85d7('0x19')]=_0x459051[_0x85d7('0x19')];this['droptime']=_0x459051[_0x85d7('0x1a')];this['endtime']=this[_0x85d7('0x1a')];this[_0x85d7('0x1b')]=getSeconds(_0x459051[_0x85d7('0x19')],_0x459051[_0x85d7('0x18')]);this[_0x85d7('0x1c')]=getSeconds(this[_0x85d7('0x1a')],_0x459051['responsetime']);this[_0x85d7('0x1d')]=0x0;this['queue']=_0x290d78[_0x85d7('0x9')];this[_0x85d7('0x1e')]=_0x290d78[_0x85d7('0x1f')];this[_0x85d7('0x20')]=_0x290d78[_0x85d7('0x20')];this[_0x85d7('0x21')]=_0x459051[_0x85d7('0x21')];this[_0x85d7('0x22')]=_0x459051[_0x85d7('0x22')];this[_0x85d7('0x23')]=_0x459051[_0x85d7('0x23')];this['recallme']=_0x459051[_0x85d7('0x24')];this[_0x85d7('0x25')]=_0x459051[_0x85d7('0x25')];this['ListId']=_0x459051['ListId'];this[_0x85d7('0x26')]=_0x459051[_0x85d7('0x26')];this[_0x85d7('0x27')]=_0x459051[_0x85d7('0x27')];this[_0x85d7('0x28')]=_0x459051[_0x85d7('0x28')];this['originatecalleridnum']=_0x459051[_0x85d7('0x29')]||'';this['originatecalleridname']=_0x459051['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b2f21f6..38f10e1 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 _0xa77a=['AttachmentId','exports','util','lodash','moment','uniqueid','channel','format','%s/%s/%s','Trunk','fax','localstationid','headerinfo','path'];(function(_0x5a1892,_0x1675c0){var _0x36def6=function(_0x54fec5){while(--_0x54fec5){_0x5a1892['push'](_0x5a1892['shift']());}};_0x36def6(++_0x1675c0);}(_0xa77a,0x16e));var _0xaa77=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xa77a[_0x3e69ae];return _0x3d7f42;};'use strict';var util=require(_0xaa77('0x0'));var _=require(_0xaa77('0x1'));var moment=require(_0xaa77('0x2'));function Action(_0x58c565,_0xf868f6,_0x4038f5){this[_0xaa77('0x3')]=_0x58c565||undefined;this[_0xaa77('0x4')]=util[_0xaa77('0x5')](_0xaa77('0x6'),_0xf868f6['tech'],_0xf868f6[_0xaa77('0x7')]['name'],_0x4038f5[_0xaa77('0x8')]);this[_0xaa77('0x9')]=_0xf868f6[_0xaa77('0x9')];this['headerinfo']=_0xf868f6[_0xaa77('0xa')];this[_0xaa77('0xb')]=_0x4038f5[_0xaa77('0xb')];this[_0xaa77('0xc')]=_0x4038f5[_0xaa77('0xc')];}module[_0xaa77('0xd')]=Action; \ No newline at end of file +var _0xcd08=['AttachmentId','moment','channel','%s/%s/%s','tech','name','fax','localstationid','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcd08,0x10f));var _0x8cd0=function(_0xf9e34c,_0x3fb428){_0xf9e34c=_0xf9e34c-0x0;var _0x28d77d=_0xcd08[_0xf9e34c];return _0x28d77d;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8cd0('0x0'));function Action(_0x25c13,_0xc91a68,_0x45a922){this['uniqueid']=_0x25c13||undefined;this[_0x8cd0('0x1')]=util['format'](_0x8cd0('0x2'),_0xc91a68[_0x8cd0('0x3')],_0xc91a68['Trunk'][_0x8cd0('0x4')],_0x45a922[_0x8cd0('0x5')]);this[_0x8cd0('0x6')]=_0xc91a68[_0x8cd0('0x6')];this['headerinfo']=_0xc91a68['headerinfo'];this[_0x8cd0('0x7')]=_0x45a922[_0x8cd0('0x7')];this[_0x8cd0('0x8')]=_0x45a922[_0x8cd0('0x8')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 37d4c07..9e99627 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 _0x24e6=['Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','./util/gs','../../../config/logger','fax','../ami','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncNewState','newexten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk'];(function(_0x1c1da1,_0x4755d8){var _0x3c1816=function(_0x547090){while(--_0x547090){_0x1c1da1['push'](_0x1c1da1['shift']());}};_0x3c1816(++_0x4755d8);}(_0x24e6,0x105));var _0x624e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x24e6[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x624e('0x0'));var _=require(_0x624e('0x1'));var BPromise=require(_0x624e('0x2'));var uuid=require(_0x624e('0x3'));var moment=require('moment');var path=require(_0x624e('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x624e('0x5'));var logger=require(_0x624e('0x6'))(_0x624e('0x7'));var ami=require(_0x624e('0x8'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x624e('0x9'));var Action=require('./action');var faxAccount=require(_0x624e('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x624e('0xb'));function Fax(_0x304244){this[_0x624e('0xc')]={};this['faxAccounts']=_0x304244[_0x624e('0xd')];this[_0x624e('0xe')]=_0x304244[_0x624e('0xe')];this[_0x624e('0xf')]={};ami['on'](_0x624e('0x10'),this[_0x624e('0x11')][_0x624e('0x12')](this));ami['on'](_0x624e('0x13'),this['syncVarSet'][_0x624e('0x12')](this));ami['on']('newstate',this[_0x624e('0x14')]['bind'](this));ami['on'](_0x624e('0x15'),this['syncNewExten'][_0x624e('0x12')](this));ami['on'](_0x624e('0x16'),this[_0x624e('0x17')][_0x624e('0x12')](this));ami['on']('receivefax',this[_0x624e('0x18')][_0x624e('0x12')](this));ami['on'](_0x624e('0x19'),this['syncHangup']['bind'](this));ami['on']('originateresponse',this[_0x624e('0x1a')][_0x624e('0x12')](this));}Fax[_0x624e('0x1b')][_0x624e('0x11')]=function(_0x37e90f){if(_0x37e90f[_0x624e('0x1c')]===_0x624e('0x1d')){for(var _0x15fddd in this[_0x624e('0xd')]){if(this['faxAccounts'][_0x624e('0x1e')](_0x15fddd)){if(_0x37e90f['exten']===this[_0x624e('0xd')][_0x15fddd][_0x624e('0x1f')]){this[_0x624e('0xc')][_0x37e90f[_0x624e('0x20')]]={};this['channels'][_0x37e90f[_0x624e('0x20')]][_0x624e('0x21')]=_0x37e90f[_0x624e('0x21')];this[_0x624e('0xc')][_0x37e90f['uniqueid']]['id']=this['faxAccounts'][_0x15fddd]['id'];this[_0x624e('0xc')][_0x37e90f['uniqueid']]['name']=this[_0x624e('0xd')][_0x15fddd][_0x624e('0x22')];logger[_0x624e('0x23')](_0x37e90f['uniqueid'],_0x624e('0x24'));}}}}if(this[_0x624e('0xf')][_0x37e90f[_0x624e('0x20')]]){this[_0x624e('0xc')][_0x37e90f[_0x624e('0x20')]]={};this[_0x624e('0xc')][_0x37e90f[_0x624e('0x20')]][_0x624e('0x21')]=_0x37e90f[_0x624e('0x21')];logger[_0x624e('0x23')](_0x37e90f['uniqueid'],_0x624e('0x24'));}};Fax[_0x624e('0x1b')][_0x624e('0x25')]=function(_0x4415e4){if(this[_0x624e('0xc')][_0x4415e4[_0x624e('0x20')]]){for(var _0x4d4d09 in _0x4415e4[_0x624e('0x26')]){if(_0x4415e4[_0x624e('0x26')][_0x624e('0x1e')](_0x4d4d09)){this['channels'][_0x4415e4[_0x624e('0x20')]][_0x4d4d09]=_0x4415e4[_0x624e('0x27')];}}}};Fax[_0x624e('0x1b')][_0x624e('0x14')]=function(_0x3be4cb){if(this[_0x624e('0xc')][_0x3be4cb[_0x624e('0x20')]]){this[_0x624e('0xc')][_0x3be4cb['uniqueid']][_0x624e('0x28')]=_0x3be4cb[_0x624e('0x28')];this[_0x624e('0xc')][_0x3be4cb[_0x624e('0x20')]][_0x624e('0x29')]=_0x3be4cb[_0x624e('0x29')];}};Fax[_0x624e('0x1b')][_0x624e('0x2a')]=function(_0x351812){if(this[_0x624e('0xc')][_0x351812[_0x624e('0x20')]]){for(var _0x3e5f97 in _0x351812[_0x624e('0x26')]){if(_0x351812['variable'][_0x624e('0x1e')](_0x3e5f97)){this['channels'][_0x351812['uniqueid']][_0x3e5f97]=_0x351812[_0x624e('0x27')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x19ffab){if(this[_0x624e('0xc')][_0x19ffab[_0x624e('0x20')]]){this['channels'][_0x19ffab[_0x624e('0x20')]][_0x624e('0x2b')]=_0x19ffab[_0x624e('0x2b')];this[_0x624e('0xc')][_0x19ffab[_0x624e('0x20')]][_0x624e('0x2c')]=_0x19ffab['status'];this[_0x624e('0xc')][_0x19ffab[_0x624e('0x20')]][_0x624e('0x1f')]=_0x19ffab[_0x624e('0x1f')];this[_0x624e('0xc')][_0x19ffab[_0x624e('0x20')]][_0x624e('0x2d')]=_0x19ffab['filename'];logger[_0x624e('0x23')](_0x19ffab['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x624e('0x1b')][_0x624e('0x18')]=function(_0x519fc6){var _0x12d72f=this;if(this[_0x624e('0xc')][_0x519fc6[_0x624e('0x20')]]){var _0x2157a5=this['channels'][_0x519fc6[_0x624e('0x20')]]['id'];this['channels'][_0x519fc6[_0x624e('0x20')]][_0x624e('0x2e')]=_0x519fc6[_0x624e('0x2e')];this[_0x624e('0xc')][_0x519fc6['uniqueid']][_0x624e('0x2f')]=_0x519fc6[_0x624e('0x2f')];this['channels'][_0x519fc6[_0x624e('0x20')]][_0x624e('0x1f')]=_0x519fc6['localstationid'];this['channels'][_0x519fc6[_0x624e('0x20')]]['resolution']=_0x519fc6[_0x624e('0x30')];this[_0x624e('0xc')][_0x519fc6[_0x624e('0x20')]][_0x624e('0x31')]=_0x519fc6['transferrate'];this[_0x624e('0xc')][_0x519fc6['uniqueid']][_0x624e('0x2d')]=_0x519fc6[_0x624e('0x2d')];this[_0x624e('0xc')][_0x519fc6[_0x624e('0x20')]][_0x624e('0x32')]=_0x519fc6[_0x624e('0x32')];if(this[_0x624e('0xc')][_0x519fc6[_0x624e('0x20')]]['pagestransferred']>0x0){tiff2pdf(_0x519fc6[_0x624e('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x1bc846){logger[_0x624e('0x23')](_0x519fc6[_0x624e('0x20')],'\x20result\x20conversion\x20file\x20',_0x1bc846['message']);attachment[_0x624e('0x33')]({'name':path[_0x624e('0x34')](_0x519fc6[_0x624e('0x2d')])[_0x624e('0x22')],'basename':path[_0x624e('0x34')](_0x519fc6[_0x624e('0x2d')])[_0x624e('0x22')]+_0x624e('0x35'),'type':_0x624e('0x36')})[_0x624e('0x37')](function(_0x2a1027){faxAccount[_0x624e('0x38')](_0x2157a5,{'from':_0x519fc6[_0x624e('0x32')],'mapKey':_0x624e('0x7'),'body':path['parse'](_0x519fc6['filename'])['name']+_0x624e('0x35'),'AttachmentId':_0x2a1027['id']})[_0x624e('0x39')](function(_0x11e3cb){logger[_0x624e('0x3a')](_0x519fc6[_0x624e('0x20')],_0x624e('0x3b'),JSON[_0x624e('0x3c')](_0x11e3cb));});})['catch'](function(_0xa8756b){logger[_0x624e('0x3a')](_0x519fc6[_0x624e('0x20')],_0x624e('0x3d'),JSON['stringify'](_0xa8756b));});});}logger[_0x624e('0x23')](_0x519fc6['uniqueid'],_0x624e('0x3d'));}};Fax[_0x624e('0x1b')][_0x624e('0x1a')]=function(_0xb46432){if(this['actions'][_0xb46432[_0x624e('0x20')]]){_[_0x624e('0x3e')](this[_0x624e('0xc')][_0xb46432['uniqueid']],_[_0x624e('0x3f')](_0xb46432,[_0x624e('0x40'),_0x624e('0x41')]));}};function updateStatus(_0x281c25){if(_0x281c25[_0x624e('0x42')]){faxMessage['update'](_0x281c25[_0x624e('0x42')],{'failMessage':_0x624e('0x43')})[_0x624e('0x37')](function(_0x50b2c4){ut[_0x624e('0x44')](_0x624e('0x45'),_0x50b2c4);})['catch'](function(_0x47aa74){ut[_0x624e('0x44')](_0x624e('0x46'),_0x47aa74);});}else{ut[_0x624e('0x44')](_0x624e('0x47'));}}Fax[_0x624e('0x1b')][_0x624e('0x48')]=function(_0x3e54f9,_0x5cf836,_0x461a78){var _0x15e237=this;var _0x26419d={};if(_0x5cf836){_0x26419d={'read':_0x5cf836};}else{_0x26419d={'failMessage':_0x461a78};}if(this[_0x624e('0xf')][_0x3e54f9][_0x624e('0x42')]){faxMessage[_0x624e('0x49')](this[_0x624e('0xf')][_0x3e54f9][_0x624e('0x42')],_0x26419d)['then'](function(_0x2e9021){ut[_0x624e('0x44')](_0x624e('0x4a'),_0x2e9021);})[_0x624e('0x39')](function(_0x31d37b){ut[_0x624e('0x44')](_0x624e('0x4b'),_0x31d37b);})[_0x624e('0x4c')](function(){delete _0x15e237[_0x624e('0xc')][_0x3e54f9];delete _0x15e237[_0x624e('0xf')][_0x3e54f9];});}else{ut[_0x624e('0x44')](_0x624e('0x4d'));delete this['channels'][_0x3e54f9];delete this['actions'][_0x3e54f9];}};Fax[_0x624e('0x1b')][_0x624e('0x4e')]=function(_0x2e94c0){var _0x5bf06c=this;if(this[_0x624e('0xc')][_0x2e94c0[_0x624e('0x20')]]){if(this['actions'][_0x2e94c0['uniqueid']]){this[_0x624e('0xc')][_0x2e94c0[_0x624e('0x20')]]['id']=this[_0x624e('0xf')][_0x2e94c0[_0x624e('0x20')]]['id'];this[_0x624e('0xc')][_0x2e94c0[_0x624e('0x20')]][_0x624e('0x22')]=this[_0x624e('0xf')][_0x2e94c0[_0x624e('0x20')]][_0x624e('0x22')];}logger[_0x624e('0x23')](_0x2e94c0[_0x624e('0x20')],this[_0x624e('0xf')][_0x2e94c0[_0x624e('0x20')]]?_0x624e('0x4f'):_0x624e('0x50'),JSON[_0x624e('0x3c')](this[_0x624e('0xc')][_0x2e94c0[_0x624e('0x20')]]));if(this[_0x624e('0xf')][_0x2e94c0[_0x624e('0x20')]]){if(this[_0x624e('0xc')][_0x2e94c0[_0x624e('0x20')]][_0x624e('0x51')]>0x0&&this[_0x624e('0xc')][_0x2e94c0['uniqueid']][_0x624e('0x16')]===_0x624e('0x52')){this['updateStatus'](_0x2e94c0[_0x624e('0x20')],!![]);}else{this[_0x624e('0x48')](_0x2e94c0[_0x624e('0x20')],![],this[_0x624e('0xc')][_0x2e94c0[_0x624e('0x20')]][_0x624e('0x53')]?_0x624e('0x54')+this['channels'][_0x2e94c0[_0x624e('0x20')]][_0x624e('0x53')]:_0x624e('0x55'));}}}};Fax[_0x624e('0x1b')][_0x624e('0x56')]=function(_0x7955ba){var _0x2d784d=this;return new BPromise(function(_0x312815,_0x585e1d){_0x2d784d[_0x624e('0x57')](_0x7955ba,_0x2d784d['faxAccounts'][_0x7955ba[_0x624e('0x58')]])[_0x624e('0x37')](function(_0x45b8be){ut[_0x624e('0x44')](_0x624e('0x59'),_0x45b8be);_0x312815(ut[_0x624e('0x5a')](_0x624e('0x5b')));})['catch'](function(_0x59a496){ut[_0x624e('0x44')](_0x624e('0x5c'),_0x59a496);updateStatus(_0x7955ba);_0x585e1d(ut[_0x624e('0x5a')](_0x624e('0x5d')));});});};Fax['prototype'][_0x624e('0x5e')]=function(_0x1cfaa8){var _0x3b0c33=this;return new BPromise(function(_0x196c0b,_0x50bfb1){var _0x2ffb6e=_0x3b0c33[_0x624e('0x5f')](_0x3b0c33[_0x624e('0xd')][_0x1cfaa8['FaxAccountId']][_0x624e('0x60')],_0x1cfaa8);if(_0x2ffb6e[_0x624e('0x61')]){_0x196c0b(ut[_0x624e('0x5a')](_0x624e('0x62')));}else{_0x50bfb1(ut[_0x624e('0x5a')](_0x2ffb6e[_0x624e('0x5a')]));}});};function originate(_0x4eff30,_0x5394a5,_0x49b1e2){return new BPromise(function(_0xfb20a9,_0x2fd189){if(_0x49b1e2){var _0x5005c9=util[_0x624e('0x63')](_0x624e('0x64'),path['parse'](_0x4eff30[_0x624e('0x4')])[_0x624e('0x22')],_0x4eff30[_0x624e('0x4')]);gs[_0x624e('0x65')](_0x5005c9)[_0x624e('0x37')](function(){_0x4eff30['path']=util['format']('%s/%s.tif',path['parse'](_0x4eff30[_0x624e('0x4')])[_0x624e('0x66')],path['parse'](_0x4eff30[_0x624e('0x4')])[_0x624e('0x22')]);_0x5394a5['XMF-PATH']=_0x4eff30['path'];ut[_0x624e('0x44')]('Convert\x20pdf\x20to\x20tif','');ami[_0x624e('0x67')](ut[_0x624e('0x68')](_0x4eff30,_0x5394a5))['then'](function(_0x5b7ded){_0xfb20a9(_0x5b7ded);})['catch'](function(_0x10fa1a){_0x2fd189(_0x10fa1a);});})[_0x624e('0x39')](function(_0x3d3520){_0x2fd189(_0x3d3520);});}else{ami[_0x624e('0x67')](ut['variablesAction'](_0x4eff30,_0x5394a5))['then'](function(_0x18c51d){_0xfb20a9(_0x18c51d);})['catch'](function(_0x55db48){_0x2fd189(_0x55db48);});}});}Fax[_0x624e('0x1b')][_0x624e('0x57')]=function(_0x9a1533,_0x4d389e){var _0x363c03=this;return new BPromise(function(_0x461191,_0x24f6c0){var _0x43ba07=uuid['v4']();var _0xbf9287=ut[_0x624e('0x69')](_0x9a1533,_0x4d389e);_0x363c03['actions'][_0x43ba07]=new Action(_0x43ba07,_0x4d389e,_0x9a1533);var _0x40bf62=_0x363c03[_0x624e('0xf')][_0x43ba07];if(path[_0x624e('0x34')](_0x9a1533[_0x624e('0x4')])[_0x624e('0x6a')]===_0x624e('0x35')){originate(_0x40bf62,_0xbf9287,!![])[_0x624e('0x37')](function(_0xf704fb){_0x461191(_0xf704fb);})[_0x624e('0x39')](function(_0x1cc010){_0x24f6c0(_0x1cc010);});}else{originate(_0x40bf62,_0xbf9287,![])[_0x624e('0x37')](function(_0x4a5732){_0x461191(_0x4a5732);})[_0x624e('0x39')](function(_0x22d00a){_0x24f6c0(_0x22d00a);});}});};Fax[_0x624e('0x1b')][_0x624e('0x6b')]=function(_0xa278f7){return!_['isNil'](_0xa278f7)&&!_[_0x624e('0x6c')](_0xa278f7['name'])&&!_[_0x624e('0x6c')](_0xa278f7[_0x624e('0x6d')])&&_0xa278f7[_0x624e('0x6d')]&&!_[_0x624e('0x6c')](this[_0x624e('0xe')][util[_0x624e('0x63')]('SIP/%s',_0xa278f7['name'])])&&!_[_0x624e('0x6c')](this['trunks'][util[_0x624e('0x63')](_0x624e('0x6e'),_0xa278f7['name'])][_0x624e('0x2c')])&&(this[_0x624e('0xe')][util[_0x624e('0x63')](_0x624e('0x6e'),_0xa278f7[_0x624e('0x22')])][_0x624e('0x2c')]===_0x624e('0x6f')||this[_0x624e('0xe')][util['format'](_0x624e('0x6e'),_0xa278f7['name'])][_0x624e('0x2c')]===_0x624e('0x70'));};Fax['prototype'][_0x624e('0x5f')]=function(_0x2aa83d,_0x526cb6){if(!this[_0x624e('0x6b')](_0x2aa83d)){ut[_0x624e('0x44')](_0x624e('0x71'),_[_0x624e('0x6c')](_0x2aa83d)?'':_0x2aa83d[_0x624e('0x22')]+_0x624e('0x72'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x624e('0x6c')](_0x526cb6[_0x624e('0x7')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x624e('0x3c')](_0x526cb6));return{'isValid':![],'message':_0x624e('0x73')};}if(_[_0x624e('0x6c')](_0x526cb6['path'])){ut[_0x624e('0x44')](_0x624e('0x74'),JSON[_0x624e('0x3c')](_0x526cb6));return{'isValid':![],'message':_0x624e('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x624e('0x76')]=Fax; \ No newline at end of file +var _0x7d69=['.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','\x20receiveFax\x20','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','reachable','checkTrunk','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','newstate','syncNewState','bind','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x7d69,0xaa));var _0x97d6=function(_0x3a599d,_0x2444e8){_0x3a599d=_0x3a599d-0x0;var _0x393ecb=_0x7d69[_0x3a599d];return _0x393ecb;};'use strict';var util=require(_0x97d6('0x0'));var _=require('lodash');var BPromise=require(_0x97d6('0x1'));var uuid=require(_0x97d6('0x2'));var moment=require(_0x97d6('0x3'));var path=require(_0x97d6('0x4'));var tiff2pdf=require(_0x97d6('0x5'));var gs=require('./util/gs');var logger=require(_0x97d6('0x6'))(_0x97d6('0x7'));var ami=require(_0x97d6('0x8'));var rpcDb=require(_0x97d6('0x9'));var Channel=require(_0x97d6('0xa'));var ut=require('./util/util');var Action=require(_0x97d6('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x97d6('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x121d33){this[_0x97d6('0xd')]={};this[_0x97d6('0xe')]=_0x121d33[_0x97d6('0xe')];this[_0x97d6('0xf')]=_0x121d33[_0x97d6('0xf')];this[_0x97d6('0x10')]={};ami['on'](_0x97d6('0x11'),this[_0x97d6('0x12')]['bind'](this));ami['on']('varset',this[_0x97d6('0x13')]['bind'](this));ami['on'](_0x97d6('0x14'),this[_0x97d6('0x15')][_0x97d6('0x16')](this));ami['on'](_0x97d6('0x17'),this['syncNewExten'][_0x97d6('0x16')](this));ami['on'](_0x97d6('0x18'),this[_0x97d6('0x19')][_0x97d6('0x16')](this));ami['on'](_0x97d6('0x1a'),this[_0x97d6('0x1b')][_0x97d6('0x16')](this));ami['on'](_0x97d6('0x1c'),this[_0x97d6('0x1d')][_0x97d6('0x16')](this));ami['on'](_0x97d6('0x1e'),this[_0x97d6('0x1f')][_0x97d6('0x16')](this));}Fax[_0x97d6('0x20')]['syncNewchannel']=function(_0x4964a0){if(_0x4964a0[_0x97d6('0x21')]===_0x97d6('0x22')){for(var _0x50771e in this[_0x97d6('0xe')]){if(this[_0x97d6('0xe')][_0x97d6('0x23')](_0x50771e)){if(_0x4964a0['exten']===this['faxAccounts'][_0x50771e][_0x97d6('0x24')]){this['channels'][_0x4964a0['uniqueid']]={};this[_0x97d6('0xd')][_0x4964a0[_0x97d6('0x25')]][_0x97d6('0x26')]=_0x4964a0[_0x97d6('0x26')];this['channels'][_0x4964a0[_0x97d6('0x25')]]['id']=this[_0x97d6('0xe')][_0x50771e]['id'];this[_0x97d6('0xd')][_0x4964a0[_0x97d6('0x25')]][_0x97d6('0x27')]=this[_0x97d6('0xe')][_0x50771e]['name'];logger[_0x97d6('0x28')](_0x4964a0[_0x97d6('0x25')],_0x97d6('0x29'));}}}}if(this[_0x97d6('0x10')][_0x4964a0[_0x97d6('0x25')]]){this['channels'][_0x4964a0[_0x97d6('0x25')]]={};this[_0x97d6('0xd')][_0x4964a0[_0x97d6('0x25')]]['channel']=_0x4964a0['channel'];logger[_0x97d6('0x28')](_0x4964a0['uniqueid'],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x97d6('0x13')]=function(_0x21cf40){if(this[_0x97d6('0xd')][_0x21cf40['uniqueid']]){for(var _0x1e9596 in _0x21cf40['variable']){if(_0x21cf40[_0x97d6('0x2a')]['hasOwnProperty'](_0x1e9596)){this[_0x97d6('0xd')][_0x21cf40['uniqueid']][_0x1e9596]=_0x21cf40[_0x97d6('0x2b')];}}}};Fax[_0x97d6('0x20')]['syncNewState']=function(_0x2716e0){if(this['channels'][_0x2716e0['uniqueid']]){this['channels'][_0x2716e0[_0x97d6('0x25')]][_0x97d6('0x2c')]=_0x2716e0['channelstate'];this[_0x97d6('0xd')][_0x2716e0[_0x97d6('0x25')]][_0x97d6('0x2d')]=_0x2716e0[_0x97d6('0x2d')];}};Fax['prototype'][_0x97d6('0x2e')]=function(_0x484b69){if(this[_0x97d6('0xd')][_0x484b69[_0x97d6('0x25')]]){for(var _0x2ab5eb in _0x484b69[_0x97d6('0x2a')]){if(_0x484b69[_0x97d6('0x2a')][_0x97d6('0x23')](_0x2ab5eb)){this[_0x97d6('0xd')][_0x484b69[_0x97d6('0x25')]][_0x2ab5eb]=_0x484b69[_0x97d6('0x2b')];}}}};Fax[_0x97d6('0x20')][_0x97d6('0x19')]=function(_0x25e04d){if(this[_0x97d6('0xd')][_0x25e04d[_0x97d6('0x25')]]){this['channels'][_0x25e04d[_0x97d6('0x25')]][_0x97d6('0x2f')]=_0x25e04d['operation'];this[_0x97d6('0xd')][_0x25e04d[_0x97d6('0x25')]][_0x97d6('0x30')]=_0x25e04d['status'];this[_0x97d6('0xd')][_0x25e04d[_0x97d6('0x25')]][_0x97d6('0x24')]=_0x25e04d[_0x97d6('0x24')];this[_0x97d6('0xd')][_0x25e04d['uniqueid']][_0x97d6('0x31')]=_0x25e04d[_0x97d6('0x31')];logger['info'](_0x25e04d[_0x97d6('0x25')],_0x97d6('0x32'));}};Fax[_0x97d6('0x20')][_0x97d6('0x1b')]=function(_0x433af5){var _0x3447aa=this;if(this[_0x97d6('0xd')][_0x433af5['uniqueid']]){var _0x2da651=this[_0x97d6('0xd')][_0x433af5[_0x97d6('0x25')]]['id'];this[_0x97d6('0xd')][_0x433af5[_0x97d6('0x25')]][_0x97d6('0x33')]=_0x433af5[_0x97d6('0x33')];this['channels'][_0x433af5[_0x97d6('0x25')]][_0x97d6('0x34')]=_0x433af5[_0x97d6('0x34')];this[_0x97d6('0xd')][_0x433af5['uniqueid']][_0x97d6('0x24')]=_0x433af5[_0x97d6('0x24')];this[_0x97d6('0xd')][_0x433af5[_0x97d6('0x25')]][_0x97d6('0x35')]=_0x433af5['resolution'];this[_0x97d6('0xd')][_0x433af5[_0x97d6('0x25')]][_0x97d6('0x36')]=_0x433af5[_0x97d6('0x36')];this[_0x97d6('0xd')][_0x433af5[_0x97d6('0x25')]][_0x97d6('0x31')]=_0x433af5['filename'];this['channels'][_0x433af5[_0x97d6('0x25')]][_0x97d6('0x37')]=_0x433af5[_0x97d6('0x37')];if(this[_0x97d6('0xd')][_0x433af5[_0x97d6('0x25')]][_0x97d6('0x34')]>0x0){tiff2pdf(_0x433af5[_0x97d6('0x31')],_0x97d6('0x38'),function(_0x26b63c){logger[_0x97d6('0x28')](_0x433af5['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x26b63c[_0x97d6('0x39')]);attachment[_0x97d6('0x3a')]({'name':path[_0x97d6('0x3b')](_0x433af5[_0x97d6('0x31')])[_0x97d6('0x27')],'basename':path['parse'](_0x433af5[_0x97d6('0x31')])['name']+_0x97d6('0x3c'),'type':_0x97d6('0x3d')})[_0x97d6('0x3e')](function(_0x19d79e){faxAccount[_0x97d6('0x3f')](_0x2da651,{'from':_0x433af5[_0x97d6('0x37')],'mapKey':_0x97d6('0x7'),'body':path[_0x97d6('0x3b')](_0x433af5[_0x97d6('0x31')])[_0x97d6('0x27')]+_0x97d6('0x3c'),'AttachmentId':_0x19d79e['id']})['catch'](function(_0xf2df9a){logger[_0x97d6('0x40')](_0x433af5['uniqueid'],_0x97d6('0x41'),JSON[_0x97d6('0x42')](_0xf2df9a));});})['catch'](function(_0x2a391f){logger[_0x97d6('0x40')](_0x433af5[_0x97d6('0x25')],'\x20receiveFax\x20',JSON[_0x97d6('0x42')](_0x2a391f));});});}logger['info'](_0x433af5[_0x97d6('0x25')],_0x97d6('0x43'));}};Fax['prototype'][_0x97d6('0x1f')]=function(_0x40350a){if(this[_0x97d6('0x10')][_0x40350a[_0x97d6('0x25')]]){_['merge'](this[_0x97d6('0xd')][_0x40350a[_0x97d6('0x25')]],_['pick'](_0x40350a,[_0x97d6('0x44'),_0x97d6('0x45')]));}};function updateStatus(_0x3fdb6f){if(_0x3fdb6f[_0x97d6('0x46')]){faxMessage[_0x97d6('0x47')](_0x3fdb6f[_0x97d6('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x97d6('0x3e')](function(_0x3d501d){ut[_0x97d6('0x48')](_0x97d6('0x49'),_0x3d501d);})[_0x97d6('0x4a')](function(_0x247114){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x247114);});}else{ut[_0x97d6('0x48')](_0x97d6('0x4b'));}}Fax[_0x97d6('0x20')]['updateStatus']=function(_0x3af777,_0x23cfc8,_0x39cc04){var _0x320171=this;var _0x540188={};if(_0x23cfc8){_0x540188={'read':_0x23cfc8};}else{_0x540188={'failMessage':_0x39cc04};}if(this[_0x97d6('0x10')][_0x3af777]['AttachmentId']){faxMessage[_0x97d6('0x47')](this[_0x97d6('0x10')][_0x3af777][_0x97d6('0x46')],_0x540188)[_0x97d6('0x3e')](function(_0x1a3726){ut['logger'](_0x97d6('0x4c'),_0x1a3726);})[_0x97d6('0x4a')](function(_0x1e9c1a){ut[_0x97d6('0x48')](_0x97d6('0x4d'),_0x1e9c1a);})[_0x97d6('0x4e')](function(){delete _0x320171[_0x97d6('0xd')][_0x3af777];delete _0x320171['actions'][_0x3af777];});}else{ut[_0x97d6('0x48')](_0x97d6('0x4f'));delete this[_0x97d6('0xd')][_0x3af777];delete this['actions'][_0x3af777];}};Fax['prototype']['syncHangup']=function(_0x3dfd60){var _0x338b0e=this;if(this[_0x97d6('0xd')][_0x3dfd60['uniqueid']]){if(this['actions'][_0x3dfd60['uniqueid']]){this[_0x97d6('0xd')][_0x3dfd60[_0x97d6('0x25')]]['id']=this[_0x97d6('0x10')][_0x3dfd60[_0x97d6('0x25')]]['id'];this[_0x97d6('0xd')][_0x3dfd60['uniqueid']][_0x97d6('0x27')]=this['actions'][_0x3dfd60[_0x97d6('0x25')]][_0x97d6('0x27')];}logger[_0x97d6('0x28')](_0x3dfd60[_0x97d6('0x25')],this['actions'][_0x3dfd60[_0x97d6('0x25')]]?'\x20hangup\x20sendFile\x20':_0x97d6('0x50'),JSON['stringify'](this[_0x97d6('0xd')][_0x3dfd60[_0x97d6('0x25')]]));if(this[_0x97d6('0x10')][_0x3dfd60[_0x97d6('0x25')]]){if(this[_0x97d6('0xd')][_0x3dfd60[_0x97d6('0x25')]]['faxpages']>0x0&&this[_0x97d6('0xd')][_0x3dfd60[_0x97d6('0x25')]][_0x97d6('0x18')]==='SUCCESS'){this['updateStatus'](_0x3dfd60['uniqueid'],!![]);}else{this[_0x97d6('0x51')](_0x3dfd60[_0x97d6('0x25')],![],this[_0x97d6('0xd')][_0x3dfd60['uniqueid']][_0x97d6('0x52')]?_0x97d6('0x53')+this[_0x97d6('0xd')][_0x3dfd60['uniqueid']][_0x97d6('0x52')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x97d6('0x54')]=function(_0x3cab00){var _0xa53eea=this;return new BPromise(function(_0x1586d1,_0x105bae){_0xa53eea[_0x97d6('0x55')](_0x3cab00,_0xa53eea[_0x97d6('0xe')][_0x3cab00['FaxAccountId']])[_0x97d6('0x3e')](function(_0x2806f5){ut['logger'](_0x97d6('0x56'),_0x2806f5);_0x1586d1(ut[_0x97d6('0x39')](_0x97d6('0x57')));})[_0x97d6('0x4a')](function(_0x34b25c){ut['logger'](_0x97d6('0x58'),_0x34b25c);updateStatus(_0x3cab00);_0x105bae(ut[_0x97d6('0x39')](_0x97d6('0x59')));});});};Fax[_0x97d6('0x20')][_0x97d6('0x5a')]=function(_0x3a2ae5){var _0x2c3a15=this;return new BPromise(function(_0x39de6a,_0x384975){var _0x30f335=_0x2c3a15['checkTrunk'](_0x2c3a15[_0x97d6('0xe')][_0x3a2ae5['FaxAccountId']][_0x97d6('0x5b')],_0x3a2ae5);if(_0x30f335[_0x97d6('0x5c')]){_0x39de6a(ut[_0x97d6('0x39')](_0x97d6('0x5d')));}else{_0x384975(ut[_0x97d6('0x39')](_0x30f335[_0x97d6('0x39')]));}});};function originate(_0x2f2d2e,_0x31bafb,_0x4e1927){return new BPromise(function(_0x37cff3,_0x70fdeb){if(_0x4e1927){var _0x321bd3=util[_0x97d6('0x5e')](_0x97d6('0x5f'),path[_0x97d6('0x3b')](_0x2f2d2e[_0x97d6('0x4')])[_0x97d6('0x27')],_0x2f2d2e[_0x97d6('0x4')]);gs[_0x97d6('0x60')](_0x321bd3)['then'](function(){_0x2f2d2e[_0x97d6('0x4')]=util['format'](_0x97d6('0x61'),path[_0x97d6('0x3b')](_0x2f2d2e[_0x97d6('0x4')])[_0x97d6('0x62')],path[_0x97d6('0x3b')](_0x2f2d2e[_0x97d6('0x4')])['name']);_0x31bafb['XMF-PATH']=_0x2f2d2e['path'];ut[_0x97d6('0x48')](_0x97d6('0x63'),'');ami[_0x97d6('0x64')](ut['variablesAction'](_0x2f2d2e,_0x31bafb))[_0x97d6('0x3e')](function(_0x516463){_0x37cff3(_0x516463);})[_0x97d6('0x4a')](function(_0x49addb){_0x70fdeb(_0x49addb);});})[_0x97d6('0x4a')](function(_0x3f3fc2){_0x70fdeb(_0x3f3fc2);});}else{ami[_0x97d6('0x64')](ut[_0x97d6('0x65')](_0x2f2d2e,_0x31bafb))[_0x97d6('0x3e')](function(_0xbb3582){_0x37cff3(_0xbb3582);})[_0x97d6('0x4a')](function(_0x29d516){_0x70fdeb(_0x29d516);});}});}Fax[_0x97d6('0x20')][_0x97d6('0x55')]=function(_0x47eed1,_0x4a6987){var _0x33a13=this;return new BPromise(function(_0x1995a6,_0x5356e0){var _0x51af4b=uuid['v4']();var _0x3a4f4f=ut['addVariables'](_0x47eed1,_0x4a6987);_0x33a13[_0x97d6('0x10')][_0x51af4b]=new Action(_0x51af4b,_0x4a6987,_0x47eed1);var _0x505f3d=_0x33a13[_0x97d6('0x10')][_0x51af4b];if(path[_0x97d6('0x3b')](_0x47eed1['path'])[_0x97d6('0x66')]===_0x97d6('0x3c')){originate(_0x505f3d,_0x3a4f4f,!![])[_0x97d6('0x3e')](function(_0x29c079){_0x1995a6(_0x29c079);})[_0x97d6('0x4a')](function(_0x42f62f){_0x5356e0(_0x42f62f);});}else{originate(_0x505f3d,_0x3a4f4f,![])[_0x97d6('0x3e')](function(_0x39bd55){_0x1995a6(_0x39bd55);})[_0x97d6('0x4a')](function(_0x2f950a){_0x5356e0(_0x2f950a);});}});};Fax[_0x97d6('0x20')]['isTrunkReachable']=function(_0x51d27a){return!_[_0x97d6('0x67')](_0x51d27a)&&!_[_0x97d6('0x67')](_0x51d27a['name'])&&!_['isNil'](_0x51d27a['active'])&&_0x51d27a[_0x97d6('0x68')]&&!_[_0x97d6('0x67')](this['trunks'][util[_0x97d6('0x5e')](_0x97d6('0x69'),_0x51d27a['name'])])&&!_[_0x97d6('0x67')](this[_0x97d6('0xf')][util[_0x97d6('0x5e')]('SIP/%s',_0x51d27a[_0x97d6('0x27')])][_0x97d6('0x30')])&&(this[_0x97d6('0xf')][util[_0x97d6('0x5e')]('SIP/%s',_0x51d27a['name'])][_0x97d6('0x30')]===_0x97d6('0x6a')||this[_0x97d6('0xf')][util[_0x97d6('0x5e')](_0x97d6('0x69'),_0x51d27a['name'])][_0x97d6('0x30')]==='unmonitored');};Fax['prototype'][_0x97d6('0x6b')]=function(_0x4afb1c,_0x15ea68){if(!this[_0x97d6('0x6c')](_0x4afb1c)){ut[_0x97d6('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x97d6('0x67')](_0x4afb1c)?'':_0x4afb1c[_0x97d6('0x27')]+_0x97d6('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x97d6('0x67')](_0x15ea68[_0x97d6('0x7')])){ut[_0x97d6('0x48')](_0x97d6('0x6e'),JSON['stringify'](_0x15ea68));return{'isValid':![],'message':_0x97d6('0x6f')};}if(_['isNil'](_0x15ea68[_0x97d6('0x4')])){ut[_0x97d6('0x48')](_0x97d6('0x70'),JSON['stringify'](_0x15ea68));return{'isValid':![],'message':_0x97d6('0x71')};}return{'isValid':!![],'message':_0x97d6('0x72')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ac2f51a..3eebb15 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 _0x1b71=['error','notify','then','[Notify]\x20','bluebird','../../../config/logger','preview','../rpc/faxAccount'];(function(_0x3b44e9,_0x4035ac){var _0x1e34ec=function(_0x46ae74){while(--_0x46ae74){_0x3b44e9['push'](_0x3b44e9['shift']());}};_0x1e34ec(++_0x4035ac);}(_0x1b71,0xbc));var _0x11b7=function(_0x298e5f,_0x5c2c8b){_0x298e5f=_0x298e5f-0x0;var _0xd2e00d=_0x1b71[_0x298e5f];return _0xd2e00d;};'use strict';var util=require('util');var BPromise=require(_0x11b7('0x0'));var logger=require(_0x11b7('0x1'))(_0x11b7('0x2'));var _=require('lodash');var faxAccount=require(_0x11b7('0x3'));function loggerCatch(_0x984407){return function(_0x2dd560){logger[_0x11b7('0x4')](_0x984407,util['inspect'](_0x2dd560,{'showHidden':![],'depth':null}));};}exports[_0x11b7('0x5')]=function(_0x2d58f9,_0x22e809){return BPromise['resolve']()[_0x11b7('0x6')](faxAccount[_0x11b7('0x5')](_0x2d58f9,_0x22e809))['catch'](loggerCatch(_0x11b7('0x7')));}; \ No newline at end of file +var _0xd6bc=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','then','notify'];(function(_0x29920c,_0x57fb6f){var _0x49bd86=function(_0x36262e){while(--_0x36262e){_0x29920c['push'](_0x29920c['shift']());}};_0x49bd86(++_0x57fb6f);}(_0xd6bc,0xc2));var _0xcd6b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd6bc[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xcd6b('0x0'));var BPromise=require(_0xcd6b('0x1'));var logger=require(_0xcd6b('0x2'))(_0xcd6b('0x3'));var _=require(_0xcd6b('0x4'));var faxAccount=require(_0xcd6b('0x5'));function loggerCatch(_0x1ec4fc){return function(_0x46d05e){logger[_0xcd6b('0x6')](_0x1ec4fc,util[_0xcd6b('0x7')](_0x46d05e,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x24027e,_0x1a1e3b){return BPromise['resolve']()[_0xcd6b('0x8')](faxAccount[_0xcd6b('0x9')](_0x24027e,_0x1a1e3b))[_0xcd6b('0xa')](loggerCatch(_0xcd6b('0xb')));}; \ 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 47e2218..0010136 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 _0x32e1=['info','Exec\x20gs','\x20Error\x20:','util','fax','bluebird','child_process','exec','execute'];(function(_0x27470d,_0x20ad27){var _0x2cab2b=function(_0x26380c){while(--_0x26380c){_0x27470d['push'](_0x27470d['shift']());}};_0x2cab2b(++_0x20ad27);}(_0x32e1,0x1d7));var _0x132e=function(_0x282f70,_0x2898ef){_0x282f70=_0x282f70-0x0;var _0x3cafe9=_0x32e1[_0x282f70];return _0x3cafe9;};'use strict';var util=require(_0x132e('0x0'));var logger=require('../../../../config/logger')(_0x132e('0x1'));var BPromise=require(_0x132e('0x2'));var exec=require(_0x132e('0x3'))[_0x132e('0x4')];exports[_0x132e('0x5')]=function(_0x54924d){return new BPromise(function(_0x1755f3,_0x24ef7a){exec(_0x54924d,function(_0x4a6d23,_0x1f7ae7,_0x23f756){logger[_0x132e('0x6')](_0x132e('0x7'),_0x1f7ae7);if(_0x4a6d23){logger[_0x132e('0x6')](_0x132e('0x7'),_0x132e('0x8'),util['inspect'](_0x4a6d23,{'showHidden':![],'depth':null}),_0x1f7ae7,_0x23f756);_0x24ef7a(_0x4a6d23);}_0x1755f3(_0x1f7ae7);});});}; \ No newline at end of file +var _0x6905=['Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','child_process','execute','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6905,0xb2));var _0x5690=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0x6905[_0x5f5cce];return _0x705ecf;};'use strict';var util=require(_0x5690('0x0'));var logger=require(_0x5690('0x1'))(_0x5690('0x2'));var BPromise=require('bluebird');var exec=require(_0x5690('0x3'))['exec'];exports[_0x5690('0x4')]=function(_0x5752b9){return new BPromise(function(_0x3c129c,_0x10c37b){exec(_0x5752b9,function(_0x16af5b,_0x3fd0f2,_0x1c0460){logger[_0x5690('0x5')]('Exec\x20gs',_0x3fd0f2);if(_0x16af5b){logger[_0x5690('0x5')](_0x5690('0x6'),_0x5690('0x7'),util['inspect'](_0x16af5b,{'showHidden':![],'depth':null}),_0x3fd0f2,_0x1c0460);_0x10c37b(_0x16af5b);}_0x3c129c(_0x3fd0f2);});});}; \ 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 1c17ddc..241bd4a 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(_0x684ed3,_0x3c9796){var _0x273da5=function(_0x3cfc4b){while(--_0x3cfc4b){_0x684ed3['push'](_0x684ed3['shift']());}};_0x273da5(++_0x3c9796);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0xbdb7[_0x2aee2f];return _0x19337f;};'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 _0x2750=['path','variablesAction','uniqueid','originate','channel','\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate','maxrate','format','gateway','t38timeout','localstationid'];(function(_0x344924,_0xaeaddd){var _0x1fa366=function(_0x5905bf){while(--_0x5905bf){_0x344924['push'](_0x344924['shift']());}};_0x1fa366(++_0xaeaddd);}(_0x2750,0x13b));var _0x0275=function(_0x557629,_0x463706){_0x557629=_0x557629-0x0;var _0x445349=_0x2750[_0x557629];return _0x445349;};'use strict';var util=require(_0x0275('0x0'));var _=require('lodash');var moment=require(_0x0275('0x1'));var logger=require(_0x0275('0x2'))(_0x0275('0x3'));exports[_0x0275('0x4')]=function(_0x101b26){return{'message':_0x101b26};};exports[_0x0275('0x5')]=function(_0x20273d,_0x4960){logger[_0x0275('0x6')](_0x20273d,util[_0x0275('0x7')](_0x4960,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3f645f,_0x2421fd){var _0x2fa0eb={'XMF-ECM':_0x2421fd[_0x0275('0x8')],'XMF-HEADERINFO':_0x2421fd['headerinfo'],'XMF-MINRATE':_0x2421fd[_0x0275('0x9')],'XMF-MAXRATE':_0x2421fd[_0x0275('0xa')],'XMF-MODEM':util[_0x0275('0xb')]('\x22%s\x22',_0x2421fd['modem']),'XMF-GATEWAY':_0x2421fd[_0x0275('0xc')],'XMF-FAXDETECT':_0x2421fd['faxdetect'],'XMF-T38TIMEOUT':_0x2421fd[_0x0275('0xd')],'XMF-LOCALSTATIONID':_0x2421fd[_0x0275('0xe')],'XMF-PATH':_0x3f645f[_0x0275('0xf')]};return _0x2fa0eb;};exports[_0x0275('0x10')]=function(_0x14bc3e,_0x5ae208){return{'actionid':_0x14bc3e[_0x0275('0x11')],'action':_0x0275('0x12'),'channel':_0x14bc3e[_0x0275('0x13')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x0275('0xb')](_0x0275('0x14'),_0x14bc3e[_0x0275('0x15')]?_0x14bc3e[_0x0275('0x15')]:'',_0x14bc3e[_0x0275('0xe')]),'variable':_0x5ae208,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x14bc3e[_0x0275('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index d658e3d..7f3357d 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 _0xd8b0=['./trigger','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','getServicenowAccounts','initVoiceExtensions','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','bluebird','util','./report','./acw'];(function(_0x12e1fa,_0x44e981){var _0x1e743e=function(_0x56e0c1){while(--_0x56e0c1){_0x12e1fa['push'](_0x12e1fa['shift']());}};_0x1e743e(++_0x44e981);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x0d8b('0x2'));var Acw=require(_0x0d8b('0x3'));var Trigger=require(_0x0d8b('0x4'));var Dialer=require(_0x0d8b('0x5'));var Preview=require(_0x0d8b('0x6'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x0d8b('0x7'));var voiceQueueReport=require(_0x0d8b('0x8'));var voiceCallReport=require(_0x0d8b('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0x0d8b('0xa'));var template=require(_0x0d8b('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x0d8b('0xc'));var voiceExtension=require(_0x0d8b('0xd'));var faxAccount=require(_0x0d8b('0xe'));var zendesk=require(_0x0d8b('0xf'));var salesforce=require(_0x0d8b('0x10'));var sugarcrm=require(_0x0d8b('0x11'));var freshdesk=require(_0x0d8b('0x12'));var desk=require(_0x0d8b('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x0d8b('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0d8b('0x15'));var dynamics365=require(_0x0d8b('0x16'));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()[_0x0d8b('0x17')](_0x0d8b('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0d8b('0x17')](_0x0d8b('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0d8b('0x19')]()[_0x0d8b('0x1a')](user[_0x0d8b('0x1b')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x1c')]())[_0x0d8b('0x1a')](user[_0x0d8b('0x1d')]())[_0x0d8b('0x1a')](realtime['initTelephones']())[_0x0d8b('0x1a')](trunk[_0x0d8b('0x1e')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x1f')]())[_0x0d8b('0x1a')](voiceQueue['getVoiceQueues']())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x20')]())[_0x0d8b('0x1a')](trigger[_0x0d8b('0x21')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x22')]())[_0x0d8b('0x1a')](template[_0x0d8b('0x23')]())['then'](realtime[_0x0d8b('0x24')]())[_0x0d8b('0x1a')](zendesk[_0x0d8b('0x25')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x26')]())[_0x0d8b('0x1a')](salesforce[_0x0d8b('0x27')]())[_0x0d8b('0x1a')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x0d8b('0x28')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x0d8b('0x29')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x2a')]())[_0x0d8b('0x1a')](desk[_0x0d8b('0x2b')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x2c')]())[_0x0d8b('0x1a')](zoho[_0x0d8b('0x2d')]())['then'](realtime[_0x0d8b('0x2e')]())[_0x0d8b('0x1a')](vtiger['getVtigerAccounts']())[_0x0d8b('0x1a')](realtime['initVtigerAccounts']())[_0x0d8b('0x1a')](freshsales[_0x0d8b('0x2f')]())[_0x0d8b('0x1a')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x0d8b('0x30')]())[_0x0d8b('0x1a')](realtime['initServicenowAccounts']())[_0x0d8b('0x1a')](dynamics365['getDynamics365Accounts']())[_0x0d8b('0x1a')](realtime['initDynamics365Accounts']())[_0x0d8b('0x1a')](campaign['getCampaigns']())[_0x0d8b('0x1a')](realtime['initCampaigns']())[_0x0d8b('0x1a')](voiceExtension['getVoiceExtensions']())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x31')]())[_0x0d8b('0x1a')](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())[_0x0d8b('0x1a')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x0d8b('0x1a')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x0d8b('0x32')]())[_0x0d8b('0x1a')](cmHopperHistory[_0x0d8b('0x33')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x34')]())[_0x0d8b('0x1a')](cmHopperHistory[_0x0d8b('0x35')]())[_0x0d8b('0x1a')](realtime['initCampaignHopperHistory']())[_0x0d8b('0x1a')](voiceCallReport[_0x0d8b('0x36')]())['then'](realtime[_0x0d8b('0x37')]())[_0x0d8b('0x1a')](function(_0x18a905){})['catch'](function(_0x113318){console[_0x0d8b('0x38')](_0x113318);});}function main(){return server[_0x0d8b('0x39')](realtime,preview,fax)[_0x0d8b('0x1a')](function(_0x933e01){return initRealtime();})['then'](function(){return initParams();})[_0x0d8b('0x1a')](function(){report[_0x0d8b('0x3a')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1180ac){console[_0x0d8b('0x38')](_0x1180ac);});}main(); \ No newline at end of file +var _0xda3f=['resolve','then','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','listen','sync','catch','util','moment','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get'];(function(_0x43258c,_0x177738){var _0x1f4482=function(_0x55faf4){while(--_0x55faf4){_0x43258c['push'](_0x43258c['shift']());}};_0x1f4482(++_0x177738);}(_0xda3f,0xec));var _0xfda3=function(_0x29a97b,_0x4e68a7){_0x29a97b=_0x29a97b-0x0;var _0x10ac32=_0xda3f[_0x29a97b];return _0x10ac32;};'use strict';var BPromise=require('bluebird');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var server=require('./server');var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xfda3('0x2'));var Trigger=require('./trigger');var Dialer=require(_0xfda3('0x3'));var Preview=require(_0xfda3('0x4'));var Fax=require('./fax');var user=require(_0xfda3('0x5'));var voiceQueue=require(_0xfda3('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xfda3('0x7'));var trigger=require(_0xfda3('0x8'));var template=require(_0xfda3('0x9'));var cmHopperHistory=require(_0xfda3('0xa'));var campaign=require(_0xfda3('0xb'));var voiceExtension=require(_0xfda3('0xc'));var faxAccount=require(_0xfda3('0xd'));var zendesk=require(_0xfda3('0xe'));var salesforce=require(_0xfda3('0xf'));var sugarcrm=require(_0xfda3('0x10'));var freshdesk=require(_0xfda3('0x11'));var desk=require(_0xfda3('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xfda3('0x13'));var freshsales=require(_0xfda3('0x14'));var servicenow=require(_0xfda3('0x15'));var dynamics365=require(_0xfda3('0x16'));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()[_0xfda3('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfda3('0x17')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xfda3('0x18')]()[_0xfda3('0x19')](user['getAgents']())['then'](realtime['initAgents']())[_0xfda3('0x19')](user[_0xfda3('0x1a')]())['then'](realtime['initTelephones']())['then'](trunk[_0xfda3('0x1b')]())[_0xfda3('0x19')](realtime[_0xfda3('0x1c')]())[_0xfda3('0x19')](voiceQueue[_0xfda3('0x1d')]())[_0xfda3('0x19')](realtime[_0xfda3('0x1e')]())[_0xfda3('0x19')](trigger[_0xfda3('0x1f')]())[_0xfda3('0x19')](realtime['initTriggers']())[_0xfda3('0x19')](template[_0xfda3('0x20')]())[_0xfda3('0x19')](realtime[_0xfda3('0x21')]())['then'](zendesk[_0xfda3('0x22')]())[_0xfda3('0x19')](realtime[_0xfda3('0x23')]())['then'](salesforce['getSalesforceAccounts']())[_0xfda3('0x19')](realtime[_0xfda3('0x24')]())[_0xfda3('0x19')](sugarcrm['getSugarcrmAccounts']())[_0xfda3('0x19')](realtime[_0xfda3('0x25')]())[_0xfda3('0x19')](freshdesk[_0xfda3('0x26')]())[_0xfda3('0x19')](realtime[_0xfda3('0x27')]())[_0xfda3('0x19')](desk[_0xfda3('0x28')]())[_0xfda3('0x19')](realtime['initDeskAccounts']())[_0xfda3('0x19')](zoho[_0xfda3('0x29')]())[_0xfda3('0x19')](realtime['initZohoAccounts']())[_0xfda3('0x19')](vtiger[_0xfda3('0x2a')]())[_0xfda3('0x19')](realtime[_0xfda3('0x2b')]())[_0xfda3('0x19')](freshsales[_0xfda3('0x2c')]())['then'](realtime[_0xfda3('0x2d')]())[_0xfda3('0x19')](servicenow[_0xfda3('0x2e')]())[_0xfda3('0x19')](realtime[_0xfda3('0x2f')]())['then'](dynamics365[_0xfda3('0x30')]())[_0xfda3('0x19')](realtime[_0xfda3('0x31')]())[_0xfda3('0x19')](campaign[_0xfda3('0x32')]())[_0xfda3('0x19')](realtime[_0xfda3('0x33')]())['then'](voiceExtension['getVoiceExtensions']())[_0xfda3('0x19')](realtime['initVoiceExtensions']())['then'](faxAccount[_0xfda3('0x34')]())[_0xfda3('0x19')](realtime[_0xfda3('0x35')]())[_0xfda3('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xfda3('0x18')]()[_0xfda3('0x19')](voiceQueueReport[_0xfda3('0x36')]())[_0xfda3('0x19')](realtime[_0xfda3('0x37')]())['then'](cmHopperHistory[_0xfda3('0x38')]())[_0xfda3('0x19')](realtime[_0xfda3('0x39')]())[_0xfda3('0x19')](cmHopperHistory[_0xfda3('0x3a')]())[_0xfda3('0x19')](realtime[_0xfda3('0x3b')]())[_0xfda3('0x19')](voiceCallReport[_0xfda3('0x3c')]())['then'](realtime['initVoiceCallReports']())[_0xfda3('0x19')](function(_0x17cccb){})['catch'](function(_0x1ac6f2){console[_0xfda3('0x3d')](_0x1ac6f2);});}function main(){return server[_0xfda3('0x3e')](realtime,preview,fax)['then'](function(_0x1d92a9){return initRealtime();})[_0xfda3('0x19')](function(){return initParams();})[_0xfda3('0x19')](function(){report[_0xfda3('0x3f')]();setInterval(initRealtime,0x1388);})[_0xfda3('0x40')](function(_0x5ae650){console[_0xfda3('0x3d')](_0x5ae650);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index fc2cc03..b87fd84 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 _0x73bd=['defaults','localhost','name','email','accountcode','fullname','state','unknown','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','toNumber','stateTime','voiceStatusCallerIdNumber','stringify','format','user:%s','emit','user:save','user:presence','lodash','moment','md5','ioredis','../../../config/environment','redis'];(function(_0x2f1a51,_0x3c1f80){var _0x581809=function(_0x190b5c){while(--_0x190b5c){_0x2f1a51['push'](_0x2f1a51['shift']());}};_0x581809(++_0x3c1f80);}(_0x73bd,0x122));var _0xd73b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x73bd[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xd73b('0x0'));var util=require('util');var moment=require(_0xd73b('0x1'));var md5=require(_0xd73b('0x2'));var Redis=require(_0xd73b('0x3'));var config=require(_0xd73b('0x4'));config[_0xd73b('0x5')]=_[_0xd73b('0x6')](config['redis'],{'host':_0xd73b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd73b('0x5')]));function Agent(_0x2f1a69){this['id']=_0x2f1a69['id']||0x0;this[_0xd73b('0x8')]=_0x2f1a69[_0xd73b('0x8')]||'';this['email']=_0x2f1a69[_0xd73b('0x9')]||'';this['accountcode']=_0x2f1a69[_0xd73b('0xa')]||'';this[_0xd73b('0xb')]=_0x2f1a69[_0xd73b('0xb')]||'';this[_0xd73b('0xc')]=_0xd73b('0xd');this['stateTime']=0x0;this[_0xd73b('0xe')]=_0xd73b('0xd');this[_0xd73b('0xf')]='';this[_0xd73b('0x10')]='';this[_0xd73b('0x11')]='';this['interface']='';this[_0xd73b('0x12')]=_0x2f1a69['online']||![];this[_0xd73b('0x13')]='unknown';this[_0xd73b('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xd73b('0x15')]='';this[_0xd73b('0x16')]=![];this[_0xd73b('0x17')]=![];this['md5']='';}Agent['prototype'][_0xd73b('0x18')]=function(_0x46c796){var _0x3491b2;if(_0x46c796&&_0x46c796[_0xd73b('0xc')]){_0x3491b2=_0x46c796[_0xd73b('0xc')][_0xd73b('0x19')]();switch(_0x3491b2){case _0xd73b('0x1a'):_0x3491b2=_0xd73b('0x1b');break;case'inuse':_0x3491b2='talking';break;}}if(_0x3491b2&&this[_0xd73b('0x13')]!==_0x3491b2||_0x46c796['statePause']){this[_0xd73b('0x14')]=_[_0xd73b('0x1c')](moment()['format']('x'));}if(_0x3491b2){this[_0xd73b('0x13')]=_0x3491b2;}var _0x19d157={'id':this['id'],'name':this['name'],'email':this[_0xd73b('0x9')],'accountcode':this[_0xd73b('0xa')],'fullname':this[_0xd73b('0xb')],'state':this[_0xd73b('0xc')],'stateTime':this[_0xd73b('0x1d')],'status':this[_0xd73b('0xe')],'address':this[_0xd73b('0xf')],'online':this[_0xd73b('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd73b('0x14')],'voiceStatusCallerIdNumber':this[_0xd73b('0x1e')],'voiceStatusQueue':this[_0xd73b('0x15')],'interface':this['interface'],'onhold':this[_0xd73b('0x16')]};var _0x1f933d=md5(JSON[_0xd73b('0x1f')](_0x19d157));if(this[_0xd73b('0x2')]!==_0x1f933d){this['md5']=_0x1f933d;io['to'](util[_0xd73b('0x20')](_0xd73b('0x21'),_0x19d157[_0xd73b('0x8')]))[_0xd73b('0x22')](_0xd73b('0x23'),_0x19d157);io['emit'](_0xd73b('0x24'),_0x19d157);}};module['exports']=Agent; \ No newline at end of file +var _0x364b=['onhold','local','prototype','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','format','status','voiceStatusCallerIdNumber','stringify','user:%s','user:save','exports','lodash','util','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusQueue'];(function(_0x575841,_0x333c2b){var _0x5d71a4=function(_0x21b51a){while(--_0x21b51a){_0x575841['push'](_0x575841['shift']());}};_0x5d71a4(++_0x333c2b);}(_0x364b,0x108));var _0xb364=function(_0x320ff6,_0x223d7a){_0x320ff6=_0x320ff6-0x0;var _0x5685e6=_0x364b[_0x320ff6];return _0x5685e6;};'use strict';var _=require(_0xb364('0x0'));var util=require(_0xb364('0x1'));var moment=require('moment');var md5=require(_0xb364('0x2'));var Redis=require(_0xb364('0x3'));var config=require(_0xb364('0x4'));config[_0xb364('0x5')]=_[_0xb364('0x6')](config[_0xb364('0x5')],{'host':_0xb364('0x7'),'port':0x18eb});var io=require(_0xb364('0x8'))(new Redis(config[_0xb364('0x5')]));function Agent(_0x2bbfe4){this['id']=_0x2bbfe4['id']||0x0;this[_0xb364('0x9')]=_0x2bbfe4['name']||'';this[_0xb364('0xa')]=_0x2bbfe4[_0xb364('0xa')]||'';this['accountcode']=_0x2bbfe4[_0xb364('0xb')]||'';this[_0xb364('0xc')]=_0x2bbfe4[_0xb364('0xc')]||'';this[_0xb364('0xd')]=_0xb364('0xe');this[_0xb364('0xf')]=0x0;this['status']=_0xb364('0xe');this[_0xb364('0x10')]='';this[_0xb364('0x11')]='';this[_0xb364('0x12')]='';this[_0xb364('0x13')]='';this[_0xb364('0x14')]=_0x2bbfe4[_0xb364('0x14')]||![];this['voiceStatus']='unknown';this[_0xb364('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xb364('0x16')]='';this[_0xb364('0x17')]=![];this[_0xb364('0x18')]=![];this[_0xb364('0x2')]='';}Agent[_0xb364('0x19')]['updateStatusRealtime']=function(_0x1829ec){var _0x5ca415;if(_0x1829ec&&_0x1829ec[_0xb364('0xd')]){_0x5ca415=_0x1829ec['state'][_0xb364('0x1a')]();switch(_0x5ca415){case _0xb364('0x1b'):_0x5ca415=_0xb364('0x1c');break;case _0xb364('0x1d'):_0x5ca415=_0xb364('0x1e');break;}}if(_0x5ca415&&this[_0xb364('0x1f')]!==_0x5ca415||_0x1829ec[_0xb364('0x20')]){this[_0xb364('0x15')]=_[_0xb364('0x21')](moment()[_0xb364('0x22')]('x'));}if(_0x5ca415){this[_0xb364('0x1f')]=_0x5ca415;}var _0x33dd89={'id':this['id'],'name':this[_0xb364('0x9')],'email':this[_0xb364('0xa')],'accountcode':this[_0xb364('0xb')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0xb364('0xf')],'status':this[_0xb364('0x23')],'address':this[_0xb364('0x10')],'online':this[_0xb364('0x14')],'voiceStatus':this[_0xb364('0x1f')],'voiceStatusTime':this[_0xb364('0x15')],'voiceStatusCallerIdNumber':this[_0xb364('0x24')],'voiceStatusQueue':this[_0xb364('0x16')],'interface':this[_0xb364('0x13')],'onhold':this['onhold']};var _0x219971=md5(JSON[_0xb364('0x25')](_0x33dd89));if(this[_0xb364('0x2')]!==_0x219971){this['md5']=_0x219971;io['to'](util[_0xb364('0x22')](_0xb364('0x26'),_0x33dd89[_0xb364('0x9')]))['emit'](_0xb364('0x27'),_0x33dd89);io['emit']('user:presence',_0x33dd89);}};module[_0xb364('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 36aebef..84e7c84 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 _0x4197=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4197,0x80));var _0x7419=function(_0x5cdc15,_0x46fbf0){_0x5cdc15=_0x5cdc15-0x0;var _0x5cf381=_0x4197[_0x5cdc15];return _0x5cf381;};'use strict';function Campaign(_0x4e1b19){this['id']=_0x4e1b19['id']||0x0;this[_0x7419('0x0')]=_0x4e1b19['name']||'';this[_0x7419('0x1')]=_0x4e1b19['type']||'campaign';this[_0x7419('0x2')]=0x0;this['temp']=0x0;this[_0x7419('0x3')]=0x0;this[_0x7419('0x4')]=0x0;this[_0x7419('0x5')]='';this[_0x7419('0x6')]=!![];this['active']=_0x4e1b19[_0x7419('0x7')];this[_0x7419('0x8')]=_0x4e1b19[_0x7419('0x8')];this[_0x7419('0x9')]=_0x4e1b19[_0x7419('0x9')]||null;this['dialGlobalInterval']=_0x4e1b19['dialGlobalInterval']?_0x4e1b19[_0x7419('0xa')]:null;this[_0x7419('0xb')]=_0x4e1b19[_0x7419('0xb')];this[_0x7419('0xc')]=_0x4e1b19[_0x7419('0xc')];this['dialOriginateTimeout']=_0x4e1b19['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x4e1b19[_0x7419('0xd')];this['dialCongestionRetryFrequency']=_0x4e1b19[_0x7419('0xe')];this[_0x7419('0xf')]=_0x4e1b19['dialBusyMaxRetry'];this[_0x7419('0x10')]=_0x4e1b19[_0x7419('0x10')];this['dialNoAnswerMaxRetry']=_0x4e1b19[_0x7419('0x11')];this[_0x7419('0x12')]=_0x4e1b19[_0x7419('0x12')];this['dialGlobalMaxRetry']=_0x4e1b19['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x4e1b19[_0x7419('0x13')]||0x3;this[_0x7419('0x14')]=_0x4e1b19['dialNoSuchNumberRetryFrequency']||0x96;this[_0x7419('0x15')]=_0x4e1b19[_0x7419('0x15')]||0x3;this[_0x7419('0x16')]=_0x4e1b19[_0x7419('0x16')]||0x96;this[_0x7419('0x17')]=_0x4e1b19[_0x7419('0x17')]||0x3;this[_0x7419('0x18')]=_0x4e1b19[_0x7419('0x18')]||0x96;this[_0x7419('0x19')]=_0x4e1b19[_0x7419('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x4e1b19[_0x7419('0x1a')]||0x96;this[_0x7419('0x1b')]=_0x4e1b19['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x4e1b19[_0x7419('0x1c')]||0x96;this[_0x7419('0x1d')]=_0x4e1b19[_0x7419('0x1d')]||'DESC';this[_0x7419('0x1e')]=_0x4e1b19[_0x7419('0x1e')]||undefined;this[_0x7419('0x1f')]=_0x4e1b19[_0x7419('0x1f')]||undefined;this[_0x7419('0x20')]=_0x4e1b19[_0x7419('0x20')]||undefined;this[_0x7419('0x21')]=_0x4e1b19['TrunkBackup']?_0x4e1b19[_0x7419('0x21')]:undefined;this[_0x7419('0x22')]=_0x4e1b19[_0x7419('0x22')]?_0x4e1b19[_0x7419('0x22')]:undefined;this['Interval']=_0x4e1b19[_0x7419('0x23')]?_0x4e1b19['Interval']:undefined;this['SquareProject']=_0x4e1b19[_0x7419('0x24')]?_0x4e1b19['SquareProject']:undefined;this['dialQueueProject']=_0x4e1b19['SquareProject']?_0x4e1b19['SquareProject'][_0x7419('0x0')]:undefined;this[_0x7419('0x25')]=_0x4e1b19['dialAMDActive']||![];this[_0x7419('0x26')]=_0x4e1b19['dialAMDInitialSilence'];this[_0x7419('0x27')]=_0x4e1b19[_0x7419('0x27')];this[_0x7419('0x28')]=_0x4e1b19[_0x7419('0x28')];this['dialAMDTotalAnalysisTime']=_0x4e1b19[_0x7419('0x29')];this[_0x7419('0x2a')]=_0x4e1b19[_0x7419('0x2a')];this[_0x7419('0x2b')]=_0x4e1b19[_0x7419('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x4e1b19[_0x7419('0x2c')];this[_0x7419('0x2d')]=_0x4e1b19[_0x7419('0x2d')];this[_0x7419('0x2e')]=_0x4e1b19[_0x7419('0x2e')];}module[_0x7419('0x2f')]=Campaign; \ No newline at end of file +var _0xc89a=['type','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name'];(function(_0x798784,_0x303ff7){var _0x1a4b5d=function(_0x4fcfaf){while(--_0x4fcfaf){_0x798784['push'](_0x798784['shift']());}};_0x1a4b5d(++_0x303ff7);}(_0xc89a,0x177));var _0xac89=function(_0x327a56,_0x1df348){_0x327a56=_0x327a56-0x0;var _0x139404=_0xc89a[_0x327a56];return _0x139404;};'use strict';function Campaign(_0x29a8f3){this['id']=_0x29a8f3['id']||0x0;this[_0xac89('0x0')]=_0x29a8f3['name']||'';this[_0xac89('0x1')]=_0x29a8f3[_0xac89('0x1')]||'campaign';this['originated']=0x0;this[_0xac89('0x2')]=0x0;this[_0xac89('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xac89('0x4')]='';this[_0xac89('0x5')]=!![];this[_0xac89('0x6')]=_0x29a8f3[_0xac89('0x6')];this[_0xac89('0x7')]=_0x29a8f3[_0xac89('0x7')];this['dialTimezone']=_0x29a8f3['dialTimezone']||null;this[_0xac89('0x8')]=_0x29a8f3[_0xac89('0x8')]?_0x29a8f3[_0xac89('0x8')]:null;this['dialOriginateCallerIdName']=_0x29a8f3[_0xac89('0x9')];this[_0xac89('0xa')]=_0x29a8f3[_0xac89('0xa')];this[_0xac89('0xb')]=_0x29a8f3[_0xac89('0xb')]||0x1e;this[_0xac89('0xc')]=_0x29a8f3[_0xac89('0xc')];this[_0xac89('0xd')]=_0x29a8f3[_0xac89('0xd')];this[_0xac89('0xe')]=_0x29a8f3[_0xac89('0xe')];this[_0xac89('0xf')]=_0x29a8f3['dialBusyRetryFrequency'];this[_0xac89('0x10')]=_0x29a8f3[_0xac89('0x10')];this[_0xac89('0x11')]=_0x29a8f3['dialNoAnswerRetryFrequency'];this[_0xac89('0x12')]=_0x29a8f3[_0xac89('0x12')];this[_0xac89('0x13')]=_0x29a8f3[_0xac89('0x13')]||0x3;this[_0xac89('0x14')]=_0x29a8f3['dialNoSuchNumberRetryFrequency']||0x96;this[_0xac89('0x15')]=_0x29a8f3['dialDropMaxRetry']||0x3;this[_0xac89('0x16')]=_0x29a8f3[_0xac89('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x29a8f3[_0xac89('0x17')]||0x3;this[_0xac89('0x18')]=_0x29a8f3['dialAbandonedRetryFrequency']||0x96;this[_0xac89('0x19')]=_0x29a8f3['dialMachineMaxRetry']||0x3;this[_0xac89('0x1a')]=_0x29a8f3[_0xac89('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x29a8f3[_0xac89('0x1b')]||0x3;this[_0xac89('0x1c')]=_0x29a8f3[_0xac89('0x1c')]||0x96;this[_0xac89('0x1d')]=_0x29a8f3[_0xac89('0x1d')]||'DESC';this[_0xac89('0x1e')]=_0x29a8f3['dialPrefix']||undefined;this[_0xac89('0x1f')]=_0x29a8f3[_0xac89('0x1f')]||undefined;this[_0xac89('0x20')]=_0x29a8f3[_0xac89('0x20')]||undefined;this[_0xac89('0x21')]=_0x29a8f3['TrunkBackup']?_0x29a8f3[_0xac89('0x21')]:undefined;this['Trunk']=_0x29a8f3[_0xac89('0x22')]?_0x29a8f3[_0xac89('0x22')]:undefined;this[_0xac89('0x23')]=_0x29a8f3['Interval']?_0x29a8f3[_0xac89('0x23')]:undefined;this[_0xac89('0x24')]=_0x29a8f3[_0xac89('0x24')]?_0x29a8f3[_0xac89('0x24')]:undefined;this['dialQueueProject']=_0x29a8f3[_0xac89('0x24')]?_0x29a8f3[_0xac89('0x24')][_0xac89('0x0')]:undefined;this[_0xac89('0x25')]=_0x29a8f3[_0xac89('0x25')]||![];this[_0xac89('0x26')]=_0x29a8f3['dialAMDInitialSilence'];this[_0xac89('0x27')]=_0x29a8f3['dialAMDGreeting'];this[_0xac89('0x28')]=_0x29a8f3[_0xac89('0x28')];this[_0xac89('0x29')]=_0x29a8f3[_0xac89('0x29')];this[_0xac89('0x2a')]=_0x29a8f3[_0xac89('0x2a')];this[_0xac89('0x2b')]=_0x29a8f3[_0xac89('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x29a8f3['dialAMDMaximumNumberOfWords'];this[_0xac89('0x2c')]=_0x29a8f3[_0xac89('0x2c')];this[_0xac89('0x2d')]=_0x29a8f3[_0xac89('0x2d')];}module[_0xac89('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 109d3e8..1d303e1 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 _0x0ff2=['transferconnectedlinenum','exports','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transfercalleridnum'];(function(_0x311e5a,_0x69b78e){var _0x3bdf76=function(_0x5170bc){while(--_0x5170bc){_0x311e5a['push'](_0x311e5a['shift']());}};_0x3bdf76(++_0x69b78e);}(_0x0ff2,0x197));var _0x20ff=function(_0x119ab3,_0x32eef8){_0x119ab3=_0x119ab3-0x0;var _0x4418a1=_0x0ff2[_0x119ab3];return _0x4418a1;};'use strict';function Channel(){this[_0x20ff('0x0')]=null;this['channel']='';this[_0x20ff('0x1')]='';this['calleridnum']=0x0;this[_0x20ff('0x2')]='';this[_0x20ff('0x3')]=undefined;this[_0x20ff('0x4')]=undefined;this[_0x20ff('0x5')]=0x0;this[_0x20ff('0x6')]='';this[_0x20ff('0x7')]=0x0;this['linkedid']=0x0;this[_0x20ff('0x8')]=0x0;this[_0x20ff('0x9')]=![];this[_0x20ff('0xa')]=null;this[_0x20ff('0xb')]=null;this[_0x20ff('0xc')]=![];this[_0x20ff('0xd')]=![];this[_0x20ff('0xe')]='';this[_0x20ff('0xf')]='';this['duration']=0x0;this[_0x20ff('0x10')]=0x0;this[_0x20ff('0x11')]=0x0;this[_0x20ff('0x12')]=null;this[_0x20ff('0x13')]=null;this[_0x20ff('0x14')]=null;this[_0x20ff('0x15')]=![];this['monitorFilename']=null;this[_0x20ff('0x16')]=null;this[_0x20ff('0x17')]=[];this[_0x20ff('0x18')]=undefined;this[_0x20ff('0x19')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x20ff('0x1a')]=Channel; \ No newline at end of file +var _0x8ce7=['mohtime','exports','starttime','channel','calleridnum','connectedlinenum','connectedlinename','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferType'];(function(_0x31dbf5,_0x4867c5){var _0x138295=function(_0x35e346){while(--_0x35e346){_0x31dbf5['push'](_0x31dbf5['shift']());}};_0x138295(++_0x4867c5);}(_0x8ce7,0x98));var _0x78ce=function(_0x5d9690,_0x690ea0){_0x5d9690=_0x5d9690-0x0;var _0xc0fd5=_0x8ce7[_0x5d9690];return _0xc0fd5;};'use strict';function Channel(){this[_0x78ce('0x0')]=null;this[_0x78ce('0x1')]='';this['destinationchannel']='';this[_0x78ce('0x2')]=0x0;this['calleridname']='';this[_0x78ce('0x3')]=undefined;this[_0x78ce('0x4')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x78ce('0x5')]=0x0;this[_0x78ce('0x6')]=0x0;this[_0x78ce('0x7')]=0x0;this[_0x78ce('0x8')]=![];this[_0x78ce('0x9')]=null;this[_0x78ce('0xa')]=null;this['unmanaged']=![];this[_0x78ce('0xb')]=![];this[_0x78ce('0xc')]='';this[_0x78ce('0xd')]='';this[_0x78ce('0xe')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x78ce('0xf')]=null;this[_0x78ce('0x10')]=null;this[_0x78ce('0x11')]=null;this[_0x78ce('0x12')]=![];this['monitorFilename']=null;this[_0x78ce('0x13')]=null;this[_0x78ce('0x14')]=[];this[_0x78ce('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x78ce('0x16')]=undefined;this[_0x78ce('0x17')]=0x0;}module[_0x78ce('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 7b46313..1903730 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 _0x04f1=['token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','consumerSecret'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x04f1,0x92));var _0x104f=function(_0x1226a8,_0x2176f9){_0x1226a8=_0x1226a8-0x0;var _0x1bbd4a=_0x04f1[_0x1226a8];return _0x1bbd4a;};'use strict';function DeskAccount(_0x2550ff){this['id']=_0x2550ff['id']||0x0;this[_0x104f('0x0')]=_0x2550ff[_0x104f('0x0')]||'';this['username']=_0x2550ff['username']||'';this[_0x104f('0x1')]=_0x2550ff[_0x104f('0x1')]||'';this[_0x104f('0x2')]=_0x2550ff['authType']||'';this['password']=_0x2550ff['password']||'';this['consumerKey']=_0x2550ff['consumerKey']||'';this[_0x104f('0x3')]=_0x2550ff[_0x104f('0x3')]||'';this[_0x104f('0x4')]=_0x2550ff[_0x104f('0x4')]||'';this['tokenSecret']=_0x2550ff[_0x104f('0x5')]||'';this[_0x104f('0x6')]=_0x2550ff[_0x104f('0x6')]||'';this[_0x104f('0x7')]=_0x2550ff['serverUrl']||'';this['Configurations']=_0x2550ff[_0x104f('0x8')]||{};}module[_0x104f('0x9')]=DeskAccount; \ No newline at end of file +var _0x9ab0=['authType','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x584e3b,_0x5cf329){var _0x4390c3=function(_0xd6165b){while(--_0xd6165b){_0x584e3b['push'](_0x584e3b['shift']());}};_0x4390c3(++_0x5cf329);}(_0x9ab0,0x195));var _0x09ab=function(_0x3ebae6,_0x51f53f){_0x3ebae6=_0x3ebae6-0x0;var _0x518868=_0x9ab0[_0x3ebae6];return _0x518868;};'use strict';function DeskAccount(_0x25e2ea){this['id']=_0x25e2ea['id']||0x0;this[_0x09ab('0x0')]=_0x25e2ea[_0x09ab('0x0')]||'';this[_0x09ab('0x1')]=_0x25e2ea[_0x09ab('0x1')]||'';this[_0x09ab('0x2')]=_0x25e2ea[_0x09ab('0x2')]||'';this[_0x09ab('0x3')]=_0x25e2ea[_0x09ab('0x3')]||'';this['password']=_0x25e2ea['password']||'';this['consumerKey']=_0x25e2ea[_0x09ab('0x4')]||'';this[_0x09ab('0x5')]=_0x25e2ea[_0x09ab('0x5')]||'';this[_0x09ab('0x6')]=_0x25e2ea[_0x09ab('0x6')]||'';this[_0x09ab('0x7')]=_0x25e2ea[_0x09ab('0x7')]||'';this[_0x09ab('0x8')]=_0x25e2ea[_0x09ab('0x8')]||'';this['serverUrl']=_0x25e2ea[_0x09ab('0x9')]||'';this['Configurations']=_0x25e2ea[_0x09ab('0xa')]||{};}module[_0x09ab('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 96fd3a2..4c49bea 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 _0x845a=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x3bc525,_0xd8d488){var _0x13125f=function(_0x5244dd){while(--_0x5244dd){_0x3bc525['push'](_0x3bc525['shift']());}};_0x13125f(++_0xd8d488);}(_0x845a,0x11d));var _0xa845=function(_0x5f343f,_0x157119){_0x5f343f=_0x5f343f-0x0;var _0x509d92=_0x845a[_0x5f343f];return _0x509d92;};'use strict';function Dynamics365Account(_0x8c0601){this['id']=_0x8c0601['id']||0x0;this[_0xa845('0x0')]=_0x8c0601['name']||'';this['username']=_0x8c0601[_0xa845('0x1')]||'';this[_0xa845('0x2')]=_0x8c0601[_0xa845('0x2')]||'';this[_0xa845('0x3')]=_0x8c0601[_0xa845('0x3')]||'';this[_0xa845('0x4')]=_0x8c0601[_0xa845('0x4')]||'';this['clientId']=_0x8c0601[_0xa845('0x5')]||'';this[_0xa845('0x6')]=_0x8c0601['clientSecret']||{};this[_0xa845('0x7')]=_0x8c0601[_0xa845('0x7')]||'';this[_0xa845('0x8')]=_0x8c0601[_0xa845('0x8')]||{};}module[_0xa845('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x5079=['name','username','password','remoteUri','tenantId','clientId','serverUrl','Configurations','exports'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x5079,0x13b));var _0x9507=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0x5079[_0x119629];return _0x49a771;};'use strict';function Dynamics365Account(_0x5abaca){this['id']=_0x5abaca['id']||0x0;this[_0x9507('0x0')]=_0x5abaca[_0x9507('0x0')]||'';this['username']=_0x5abaca[_0x9507('0x1')]||'';this[_0x9507('0x2')]=_0x5abaca[_0x9507('0x2')]||'';this['remoteUri']=_0x5abaca[_0x9507('0x3')]||'';this[_0x9507('0x4')]=_0x5abaca[_0x9507('0x4')]||'';this[_0x9507('0x5')]=_0x5abaca[_0x9507('0x5')]||'';this['clientSecret']=_0x5abaca['clientSecret']||{};this[_0x9507('0x6')]=_0x5abaca[_0x9507('0x6')]||'';this['Configurations']=_0x5abaca[_0x9507('0x7')]||{};}module[_0x9507('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 881e6dd..dcffdcd 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 _0x890b=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x293866,_0x33ab3e){var _0x4b33c8=function(_0x26a041){while(--_0x26a041){_0x293866['push'](_0x293866['shift']());}};_0x4b33c8(++_0x33ab3e);}(_0x890b,0x8f));var _0xb890=function(_0x58b830,_0x481377){_0x58b830=_0x58b830-0x0;var _0x370379=_0x890b[_0x58b830];return _0x370379;};'use strict';function FaxAccount(_0x145c5b){this['id']=_0x145c5b['id']||0x0;this[_0xb890('0x0')]=_0x145c5b[_0xb890('0x0')]||'';this['description']=_0x145c5b[_0xb890('0x1')];this[_0xb890('0x2')]=_0x145c5b[_0xb890('0x2')];this[_0xb890('0x3')]=_0x145c5b[_0xb890('0x3')];this[_0xb890('0x4')]=_0x145c5b[_0xb890('0x4')];this[_0xb890('0x5')]=_0x145c5b[_0xb890('0x5')]||0x960;this[_0xb890('0x6')]=_0x145c5b[_0xb890('0x6')]||0x3840;this[_0xb890('0x7')]=_0x145c5b['modem']||_0xb890('0x8');this[_0xb890('0x9')]=_0x145c5b['gateway']||'no';this['faxdetect']=_0x145c5b[_0xb890('0xa')]||'no';this[_0xb890('0xb')]=_0x145c5b['t38timeout']||0x1388;this['tech']=_0x145c5b[_0xb890('0xc')]||_0xb890('0xd');this['Trunk']=_0x145c5b[_0xb890('0xe')]?_0x145c5b[_0xb890('0xe')]:undefined;this[_0xb890('0xf')]=_0x145c5b['ListId'];this[_0xb890('0x10')]=_0x145c5b[_0xb890('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xbb63=['description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x3ffbab,_0x2ee1b4){var _0x42b220=function(_0x11fece){while(--_0x11fece){_0x3ffbab['push'](_0x3ffbab['shift']());}};_0x42b220(++_0x2ee1b4);}(_0xbb63,0x186));var _0x3bb6=function(_0x50eeb3,_0x7cf09e){_0x50eeb3=_0x50eeb3-0x0;var _0x2a801b=_0xbb63[_0x50eeb3];return _0x2a801b;};'use strict';function FaxAccount(_0x10a098){this['id']=_0x10a098['id']||0x0;this['name']=_0x10a098[_0x3bb6('0x0')]||'';this[_0x3bb6('0x1')]=_0x10a098[_0x3bb6('0x1')];this['ecm']=_0x10a098['ecm'];this['headerinfo']=_0x10a098[_0x3bb6('0x2')];this[_0x3bb6('0x3')]=_0x10a098[_0x3bb6('0x3')];this[_0x3bb6('0x4')]=_0x10a098[_0x3bb6('0x4')]||0x960;this[_0x3bb6('0x5')]=_0x10a098[_0x3bb6('0x5')]||0x3840;this[_0x3bb6('0x6')]=_0x10a098[_0x3bb6('0x6')]||_0x3bb6('0x7');this[_0x3bb6('0x8')]=_0x10a098[_0x3bb6('0x8')]||'no';this[_0x3bb6('0x9')]=_0x10a098[_0x3bb6('0x9')]||'no';this['t38timeout']=_0x10a098[_0x3bb6('0xa')]||0x1388;this[_0x3bb6('0xb')]=_0x10a098['tech']||_0x3bb6('0xc');this[_0x3bb6('0xd')]=_0x10a098[_0x3bb6('0xd')]?_0x10a098[_0x3bb6('0xd')]:undefined;this[_0x3bb6('0xe')]=_0x10a098[_0x3bb6('0xe')];this[_0x3bb6('0xf')]=_0x10a098[_0x3bb6('0xf')];}module[_0x3bb6('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 0545812..957ce19 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 _0xe64a=['token','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x491c58,_0x400b92){var _0x5cce8e=function(_0x176561){while(--_0x176561){_0x491c58['push'](_0x491c58['shift']());}};_0x5cce8e(++_0x400b92);}(_0xe64a,0x19a));var _0xae64=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe64a[_0x42cae2];return _0x5f256f;};'use strict';function FreshdeskAccount(_0x1cdcb4){this['id']=_0x1cdcb4['id']||0x0;this[_0xae64('0x0')]=_0x1cdcb4[_0xae64('0x0')]||'';this[_0xae64('0x1')]=_0x1cdcb4[_0xae64('0x1')]||'';this[_0xae64('0x2')]=_0x1cdcb4[_0xae64('0x3')]||'';this['remoteUri']=_0x1cdcb4['remoteUri']||'';this[_0xae64('0x4')]=_0x1cdcb4[_0xae64('0x4')]||'';this['Configurations']=_0x1cdcb4[_0xae64('0x5')]||{};}module[_0xae64('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xbb01=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x20876d,_0x960a29){var _0x50b1b1=function(_0xd667a9){while(--_0xd667a9){_0x20876d['push'](_0x20876d['shift']());}};_0x50b1b1(++_0x960a29);}(_0xbb01,0x71));var _0x1bb0=function(_0x5528c3,_0x35a416){_0x5528c3=_0x5528c3-0x0;var _0x47ec1b=_0xbb01[_0x5528c3];return _0x47ec1b;};'use strict';function FreshdeskAccount(_0x4dc3de){this['id']=_0x4dc3de['id']||0x0;this[_0x1bb0('0x0')]=_0x4dc3de[_0x1bb0('0x0')]||'';this['username']=_0x4dc3de[_0x1bb0('0x1')]||'';this['apiKey']=_0x4dc3de[_0x1bb0('0x2')]||'';this[_0x1bb0('0x3')]=_0x4dc3de[_0x1bb0('0x3')]||'';this[_0x1bb0('0x4')]=_0x4dc3de[_0x1bb0('0x4')]||'';this[_0x1bb0('0x5')]=_0x4dc3de[_0x1bb0('0x5')]||{};}module[_0x1bb0('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index c15f5a1..fad993b 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 _0x137b=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x1873ba,_0xebedab){var _0x57b70c=function(_0x1fe420){while(--_0x1fe420){_0x1873ba['push'](_0x1873ba['shift']());}};_0x57b70c(++_0xebedab);}(_0x137b,0xac));var _0xb137=function(_0x3d0293,_0x3d3c80){_0x3d0293=_0x3d0293-0x0;var _0x5aa8d3=_0x137b[_0x3d0293];return _0x5aa8d3;};'use strict';function FreshsalesAccount(_0x3902eb){this['id']=_0x3902eb['id']||0x0;this['name']=_0x3902eb[_0xb137('0x0')]||'';this[_0xb137('0x1')]=_0x3902eb[_0xb137('0x1')]||'';this[_0xb137('0x2')]=_0x3902eb[_0xb137('0x3')]||'';this['remoteUri']=_0x3902eb[_0xb137('0x4')]||'';this[_0xb137('0x5')]=_0x3902eb[_0xb137('0x5')]||'';this[_0xb137('0x6')]=_0x3902eb['Configurations']||{};}module[_0xb137('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xa45e=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa45e,0xe4));var _0xea45=function(_0x77c132,_0x48f193){_0x77c132=_0x77c132-0x0;var _0x3837da=_0xa45e[_0x77c132];return _0x3837da;};'use strict';function FreshsalesAccount(_0x2cd4eb){this['id']=_0x2cd4eb['id']||0x0;this[_0xea45('0x0')]=_0x2cd4eb['name']||'';this[_0xea45('0x1')]=_0x2cd4eb[_0xea45('0x1')]||'';this['apiKey']=_0x2cd4eb[_0xea45('0x2')]||'';this[_0xea45('0x3')]=_0x2cd4eb[_0xea45('0x3')]||'';this[_0xea45('0x4')]=_0x2cd4eb[_0xea45('0x4')]||'';this[_0xea45('0x5')]=_0x2cd4eb['Configurations']||{};}module[_0xea45('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1231380..6b97286 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 _0xe85d=['queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','lastAssignedTo','mohtime','exports','type','inbound','queuecallerjoinAt'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xe85d,0xb8));var _0xde85=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xe85d[_0x365e54];return _0x13317a;};'use strict';function QueueReport(){this[_0xde85('0x0')]=_0xde85('0x1');this['uniqueid']='';this['calleridnum']='';this['calleridname']='';this['queue']='';this[_0xde85('0x2')]=null;this[_0xde85('0x3')]=null;this[_0xde85('0x4')]=0x1;this[_0xde85('0x5')]=0x1;this['queuecallerabandon']=![];this[_0xde85('0x6')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xde85('0x7')]=null;this['originalposition']=0x1;this[_0xde85('0x8')]='';this[_0xde85('0x9')]='';this[_0xde85('0xa')]='';this['accountcode']='';this[_0xde85('0xb')]='';this[_0xde85('0xc')]='';this[_0xde85('0xd')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xde85('0xe')]='';this[_0xde85('0xf')]=0x0;this['variables']={};}module[_0xde85('0x10')]=QueueReport; \ No newline at end of file +var _0xc40c=['channel','connectedlinenum','connectedlinename','accountcode','context','exten','assigned','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x1182bd,_0x52ebf2){var _0x5c868b=function(_0x2c905f){while(--_0x2c905f){_0x1182bd['push'](_0x1182bd['shift']());}};_0x5c868b(++_0x52ebf2);}(_0xc40c,0x129));var _0xcc40=function(_0x2a1629,_0x236acd){_0x2a1629=_0x2a1629-0x0;var _0xb39265=_0xc40c[_0x2a1629];return _0xb39265;};'use strict';function QueueReport(){this['type']=_0xcc40('0x0');this[_0xcc40('0x1')]='';this[_0xcc40('0x2')]='';this['calleridname']='';this[_0xcc40('0x3')]='';this[_0xcc40('0x4')]=null;this[_0xcc40('0x5')]=null;this[_0xcc40('0x6')]=0x1;this[_0xcc40('0x7')]=0x1;this[_0xcc40('0x8')]=![];this[_0xcc40('0x9')]=null;this[_0xcc40('0xa')]=![];this[_0xcc40('0xb')]=null;this[_0xcc40('0xc')]=![];this[_0xcc40('0xd')]=null;this[_0xcc40('0xe')]=0x1;this[_0xcc40('0xf')]='';this[_0xcc40('0x10')]='';this[_0xcc40('0x11')]='';this[_0xcc40('0x12')]='';this[_0xcc40('0x13')]='';this[_0xcc40('0x14')]='';this['priority']='';this['holdtime']=0x0;this[_0xcc40('0x15')]=![];this[_0xcc40('0x16')]='';this[_0xcc40('0x17')]=0x0;this[_0xcc40('0x18')]={};}module[_0xcc40('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e872ac6..9fa7764 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 _0x2f04=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x276599,_0x345aa0){var _0x37f1dd=function(_0x5cb4a3){while(--_0x5cb4a3){_0x276599['push'](_0x276599['shift']());}};_0x37f1dd(++_0x345aa0);}(_0x2f04,0x138));var _0x42f0=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x2f04[_0x5a776b];return _0xbbef59;};'use strict';function SalesforceAccount(_0x376b88){this['id']=_0x376b88['id']||0x0;this['name']=_0x376b88[_0x42f0('0x0')]||'';this[_0x42f0('0x1')]=_0x376b88[_0x42f0('0x1')]||'';this[_0x42f0('0x2')]=_0x376b88['remoteUri']||'';this[_0x42f0('0x3')]=_0x376b88[_0x42f0('0x3')]||'';this[_0x42f0('0x4')]=_0x376b88[_0x42f0('0x4')]||'';this[_0x42f0('0x5')]=_0x376b88[_0x42f0('0x5')]||'';this['securityToken']=_0x376b88[_0x42f0('0x6')]||'';this['type']=_0x376b88[_0x42f0('0x7')]||_0x42f0('0x8');this[_0x42f0('0x9')]=_0x376b88[_0x42f0('0x9')]||'';this[_0x42f0('0xa')]=_0x376b88[_0x42f0('0xa')]||{};}module[_0x42f0('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x493e=['integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x493e,0xa8));var _0xe493=function(_0x58cdde,_0x355f15){_0x58cdde=_0x58cdde-0x0;var _0x2b2ab2=_0x493e[_0x58cdde];return _0x2b2ab2;};'use strict';function SalesforceAccount(_0x45d2c9){this['id']=_0x45d2c9['id']||0x0;this[_0xe493('0x0')]=_0x45d2c9[_0xe493('0x0')]||'';this[_0xe493('0x1')]=_0x45d2c9[_0xe493('0x1')]||'';this[_0xe493('0x2')]=_0x45d2c9[_0xe493('0x2')]||'';this[_0xe493('0x3')]=_0x45d2c9['password']||'';this[_0xe493('0x4')]=_0x45d2c9[_0xe493('0x4')]||'';this[_0xe493('0x5')]=_0x45d2c9['clientSecret']||'';this[_0xe493('0x6')]=_0x45d2c9[_0xe493('0x6')]||'';this[_0xe493('0x7')]=_0x45d2c9['type']||_0xe493('0x8');this[_0xe493('0x9')]=_0x45d2c9['serverUrl']||'';this['Configurations']=_0x45d2c9[_0xe493('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 2a9d96d..1b4ee49 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 _0x944c=['exports','username','password','serverUrl','Configurations'];(function(_0x57bb3a,_0x237ede){var _0x5decaa=function(_0x262a8f){while(--_0x262a8f){_0x57bb3a['push'](_0x57bb3a['shift']());}};_0x5decaa(++_0x237ede);}(_0x944c,0x164));var _0xc944=function(_0x1f6b83,_0x5dd034){_0x1f6b83=_0x1f6b83-0x0;var _0x4d13e7=_0x944c[_0x1f6b83];return _0x4d13e7;};'use strict';function ServicenowAccount(_0x2226d7){this['id']=_0x2226d7['id']||0x0;this['name']=_0x2226d7['name']||'';this[_0xc944('0x0')]=_0x2226d7[_0xc944('0x0')]||'';this[_0xc944('0x1')]=_0x2226d7[_0xc944('0x1')]||'';this['remoteUri']=_0x2226d7['remoteUri']||'';this[_0xc944('0x2')]=_0x2226d7[_0xc944('0x2')]||'';this[_0xc944('0x3')]=_0x2226d7[_0xc944('0x3')]||{};}module[_0xc944('0x4')]=ServicenowAccount; \ No newline at end of file +var _0xbead=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x37c1cd,_0x252d8d){var _0xba9b38=function(_0x38ecff){while(--_0x38ecff){_0x37c1cd['push'](_0x37c1cd['shift']());}};_0xba9b38(++_0x252d8d);}(_0xbead,0x124));var _0xdbea=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0xbead[_0x5a2d95];return _0x2c3986;};'use strict';function ServicenowAccount(_0x11e20e){this['id']=_0x11e20e['id']||0x0;this[_0xdbea('0x0')]=_0x11e20e[_0xdbea('0x0')]||'';this[_0xdbea('0x1')]=_0x11e20e['username']||'';this[_0xdbea('0x2')]=_0x11e20e[_0xdbea('0x2')]||'';this[_0xdbea('0x3')]=_0x11e20e['remoteUri']||'';this[_0xdbea('0x4')]=_0x11e20e[_0xdbea('0x4')]||'';this[_0xdbea('0x5')]=_0x11e20e[_0xdbea('0x5')]||{};}module[_0xdbea('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 74250a0..df2c979 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 _0x8163=['name','username','password','remoteUri','Configurations'];(function(_0x395ba3,_0x69e8e9){var _0x1d6fc4=function(_0x51981e){while(--_0x51981e){_0x395ba3['push'](_0x395ba3['shift']());}};_0x1d6fc4(++_0x69e8e9);}(_0x8163,0xa5));var _0x3816=function(_0xe2d14d,_0x165639){_0xe2d14d=_0xe2d14d-0x0;var _0x5f44ca=_0x8163[_0xe2d14d];return _0x5f44ca;};'use strict';function SugarcrmAccount(_0x3c5258){this['id']=_0x3c5258['id']||0x0;this['name']=_0x3c5258[_0x3816('0x0')]||'';this[_0x3816('0x1')]=_0x3c5258[_0x3816('0x1')]||'';this[_0x3816('0x2')]=_0x3c5258[_0x3816('0x2')]||'';this[_0x3816('0x3')]=_0x3c5258['remoteUri']||'';this['serverUrl']=_0x3c5258['serverUrl']||'';this[_0x3816('0x4')]=_0x3c5258[_0x3816('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x0d90=['remoteUri','serverUrl','Configurations','exports','username','password'];(function(_0x1405b9,_0x15f4c9){var _0x5df43e=function(_0x53dbd0){while(--_0x53dbd0){_0x1405b9['push'](_0x1405b9['shift']());}};_0x5df43e(++_0x15f4c9);}(_0x0d90,0xe8));var _0x00d9=function(_0x373f0a,_0x57c3f8){_0x373f0a=_0x373f0a-0x0;var _0x4ba396=_0x0d90[_0x373f0a];return _0x4ba396;};'use strict';function SugarcrmAccount(_0x59288d){this['id']=_0x59288d['id']||0x0;this['name']=_0x59288d['name']||'';this['username']=_0x59288d[_0x00d9('0x0')]||'';this['password']=_0x59288d[_0x00d9('0x1')]||'';this[_0x00d9('0x2')]=_0x59288d[_0x00d9('0x2')]||'';this['serverUrl']=_0x59288d[_0x00d9('0x3')]||'';this['Configurations']=_0x59288d[_0x00d9('0x4')]||{};}module[_0x00d9('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c63fda3..d0b0506 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 _0x9534=['address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x2d83da,_0x574b1c){var _0x5cd146=function(_0xb5b5ee){while(--_0xb5b5ee){_0x2d83da['push'](_0x2d83da['shift']());}};_0x5cd146(++_0x574b1c);}(_0x9534,0x160));var _0x4953=function(_0x3c4417,_0x2404b5){_0x3c4417=_0x3c4417-0x0;var _0x3700ca=_0x9534[_0x3c4417];return _0x3700ca;};'use strict';function Telephone(_0x4d5074){this['id']=_0x4d5074['id']||0x0;this[_0x4953('0x0')]=_0x4d5074['name']||'';this[_0x4953('0x1')]=_0x4d5074[_0x4953('0x1')]||'';this[_0x4953('0x2')]=_0x4953('0x3');this[_0x4953('0x4')]=0x0;this['status']=_0x4953('0x3');this[_0x4953('0x5')]='';}module[_0x4953('0x6')]=Telephone; \ No newline at end of file +var _0xa736=['exports','name','accountcode','unknown','stateTime','status'];(function(_0x23d64f,_0x3c9e16){var _0x4a120d=function(_0x2b8f8f){while(--_0x2b8f8f){_0x23d64f['push'](_0x23d64f['shift']());}};_0x4a120d(++_0x3c9e16);}(_0xa736,0x181));var _0x6a73=function(_0x2e945e,_0x4d8beb){_0x2e945e=_0x2e945e-0x0;var _0x548b6d=_0xa736[_0x2e945e];return _0x548b6d;};'use strict';function Telephone(_0x30cd55){this['id']=_0x30cd55['id']||0x0;this[_0x6a73('0x0')]=_0x30cd55[_0x6a73('0x0')]||'';this[_0x6a73('0x1')]=_0x30cd55[_0x6a73('0x1')]||'';this['state']=_0x6a73('0x2');this[_0x6a73('0x3')]=0x0;this[_0x6a73('0x4')]=_0x6a73('0x2');this['address']='';}module[_0x6a73('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 9fe20b4..1512708 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 _0x8d93=['name','html','exports'];(function(_0x4633ee,_0xc061fe){var _0x5c5ac0=function(_0x29ef60){while(--_0x29ef60){_0x4633ee['push'](_0x4633ee['shift']());}};_0x5c5ac0(++_0xc061fe);}(_0x8d93,0xed));var _0x38d9=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0x8d93[_0xf973b7];return _0x499087;};'use strict';function template(_0x3ca0f9){this['id']=_0x3ca0f9['id']||0x0;this[_0x38d9('0x0')]=_0x3ca0f9[_0x38d9('0x0')]||'';this[_0x38d9('0x1')]=_0x3ca0f9[_0x38d9('0x1')]||'';}module[_0x38d9('0x2')]=template; \ No newline at end of file +var _0xf544=['html','name'];(function(_0x3a3cab,_0x4d67d4){var _0x3d102c=function(_0x493f05){while(--_0x493f05){_0x3a3cab['push'](_0x3a3cab['shift']());}};_0x3d102c(++_0x4d67d4);}(_0xf544,0x179));var _0x4f54=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xf544[_0xfa634c];return _0x73e478;};'use strict';function template(_0xc7f906){this['id']=_0xc7f906['id']||0x0;this['name']=_0xc7f906[_0x4f54('0x0')]||'';this[_0x4f54('0x1')]=_0xc7f906[_0x4f54('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 75727e6..7da6f0b 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x20e5ce,_0x2b2668){var _0x2f39b0=function(_0x197cae){while(--_0x197cae){_0x20e5ce['push'](_0x20e5ce['shift']());}};_0x2f39b0(++_0x2b2668);}(_0xedd9,0xfc));var _0x9edd=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0xedd9[_0x1a3243];return _0x33f2ca;};'use strict';function Trigger(_0x265eb8){this['id']=_0x265eb8['id']||0x0;this[_0x9edd('0x0')]=_0x265eb8[_0x9edd('0x0')]||'';this[_0x9edd('0x1')]=_0x265eb8[_0x9edd('0x1')]||_0x9edd('0x2');this[_0x9edd('0x3')]=_0x265eb8[_0x9edd('0x3')]||![];this[_0x9edd('0x4')]=_0x265eb8['AllConditions']||[];this[_0x9edd('0x5')]=_0x265eb8[_0x9edd('0x5')]||[];this[_0x9edd('0x6')]=_0x265eb8[_0x9edd('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x54ef=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x6cb701,_0x6e56db){var _0x28259e=function(_0x556354){while(--_0x556354){_0x6cb701['push'](_0x6cb701['shift']());}};_0x28259e(++_0x6e56db);}(_0x54ef,0x112));var _0xf54e=function(_0x11a4ac,_0x20385e){_0x11a4ac=_0x11a4ac-0x0;var _0x42224a=_0x54ef[_0x11a4ac];return _0x42224a;};'use strict';function Trigger(_0x19d4d5){this['id']=_0x19d4d5['id']||0x0;this[_0xf54e('0x0')]=_0x19d4d5[_0xf54e('0x0')]||'';this['channel']=_0x19d4d5[_0xf54e('0x1')]||_0xf54e('0x2');this[_0xf54e('0x3')]=_0x19d4d5[_0xf54e('0x3')]||![];this[_0xf54e('0x4')]=_0x19d4d5[_0xf54e('0x4')]||[];this[_0xf54e('0x5')]=_0x19d4d5['AnyConditions']||[];this['Actions']=_0x19d4d5[_0xf54e('0x6')]||[];}module[_0xf54e('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 d8e5f29..f4a89d4 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 _0xf40e=['unknown','status','registry','indexOf','host','port','stateRegistry','address','active','state'];(function(_0x3c33a8,_0x211e5d){var _0x155ba4=function(_0x2cf20b){while(--_0x2cf20b){_0x3c33a8['push'](_0x3c33a8['shift']());}};_0x155ba4(++_0x211e5d);}(_0xf40e,0x12a));var _0xef40=function(_0x26fba6,_0x3370d9){_0x26fba6=_0x26fba6-0x0;var _0x21c262=_0xf40e[_0x26fba6];return _0x21c262;};'use strict';function Trunk(_0x5977dc){this['id']=_0x5977dc['id']||0x0;this[_0xef40('0x0')]=_0x5977dc[_0xef40('0x0')]||![];this['name']=_0x5977dc['name']||'';this[_0xef40('0x1')]=_0xef40('0x2');this['stateTime']=0x0;this[_0xef40('0x3')]=_0xef40('0x2');this[_0xef40('0x4')]=_0x5977dc[_0xef40('0x4')]&&_0x5977dc[_0xef40('0x4')][_0xef40('0x5')](':')?_0x5977dc[_0xef40('0x4')]['split'](':')[0x0]:'';this[_0xef40('0x6')]='';this[_0xef40('0x7')]='';this['domain']='';this['domainport']='';this['refresh']='';this[_0xef40('0x8')]=_0xef40('0x2');this['registrationtime']='';this[_0xef40('0x9')]='';}module['exports']=Trunk; \ No newline at end of file +var _0xdb51=['unknown','registry','indexOf','split','host','port','domain','domainport','refresh','address','active','name','state','stateTime','status'];(function(_0x879d22,_0x1d1cb3){var _0x1c90dc=function(_0x5d674e){while(--_0x5d674e){_0x879d22['push'](_0x879d22['shift']());}};_0x1c90dc(++_0x1d1cb3);}(_0xdb51,0x145));var _0x1db5=function(_0x9966c7,_0x136046){_0x9966c7=_0x9966c7-0x0;var _0x84d35d=_0xdb51[_0x9966c7];return _0x84d35d;};'use strict';function Trunk(_0x515aa1){this['id']=_0x515aa1['id']||0x0;this[_0x1db5('0x0')]=_0x515aa1[_0x1db5('0x0')]||![];this[_0x1db5('0x1')]=_0x515aa1[_0x1db5('0x1')]||'';this[_0x1db5('0x2')]='unknown';this[_0x1db5('0x3')]=0x0;this[_0x1db5('0x4')]=_0x1db5('0x5');this[_0x1db5('0x6')]=_0x515aa1[_0x1db5('0x6')]&&_0x515aa1[_0x1db5('0x6')][_0x1db5('0x7')](':')?_0x515aa1[_0x1db5('0x6')][_0x1db5('0x8')](':')[0x0]:'';this[_0x1db5('0x9')]='';this[_0x1db5('0xa')]='';this[_0x1db5('0xb')]='';this[_0x1db5('0xc')]='';this[_0x1db5('0xd')]='';this['stateRegistry']=_0x1db5('0x5');this['registrationtime']='';this[_0x1db5('0xe')]='';}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 b41bb1f..b702cc4 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 _0x755f=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x4eae35,_0x3d9d32){var _0x174a7e=function(_0x569e4b){while(--_0x569e4b){_0x4eae35['push'](_0x4eae35['shift']());}};_0x174a7e(++_0x3d9d32);}(_0x755f,0x180));var _0xf755=function(_0x5b3f83,_0x2801c5){_0x5b3f83=_0x5b3f83-0x0;var _0x47ee75=_0x755f[_0x5b3f83];return _0x47ee75;};'use strict';function voiceExtension(_0x4fce9e){this['id']=_0x4fce9e['id']||0x0;this[_0xf755('0x0')]=_0x4fce9e[_0xf755('0x0')]||'';this[_0xf755('0x1')]=_0x4fce9e['recordingFormat']||_0xf755('0x2');this[_0xf755('0x3')]=_0x4fce9e[_0xf755('0x3')]||![];}module[_0xf755('0x4')]=voiceExtension; \ No newline at end of file +var _0xbdbb=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x1ad8b9,_0x28b051){var _0x23d0bc=function(_0x3ea230){while(--_0x3ea230){_0x1ad8b9['push'](_0x1ad8b9['shift']());}};_0x23d0bc(++_0x28b051);}(_0xbdbb,0x12b));var _0xbbdb=function(_0x1ca599,_0x2dc752){_0x1ca599=_0x1ca599-0x0;var _0x4682a4=_0xbdbb[_0x1ca599];return _0x4682a4;};'use strict';function voiceExtension(_0x4aa78b){this['id']=_0x4aa78b['id']||0x0;this[_0xbbdb('0x0')]=_0x4aa78b[_0xbbdb('0x0')]||'';this[_0xbbdb('0x1')]=_0x4aa78b['recordingFormat']||'none';this[_0xbbdb('0x2')]=_0x4aa78b[_0xbbdb('0x2')]||![];}module[_0xbbdb('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 0412860..2ac344e 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 _0x7a54=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','waiting','talking','answered','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x7bb8e3,_0x282617){var _0x4eba76=function(_0x86dc8a){while(--_0x86dc8a){_0x7bb8e3['push'](_0x7bb8e3['shift']());}};_0x4eba76(++_0x282617);}(_0x7a54,0x106));var _0x47a5=function(_0x199040,_0x556da4){_0x199040=_0x199040-0x0;var _0x1bc089=_0x7a54[_0x199040];return _0x1bc089;};'use strict';var statusDesc=[_0x47a5('0x0'),_0x47a5('0x1'),_0x47a5('0x2'),'busy',_0x47a5('0x3'),_0x47a5('0x4'),'ringing',_0x47a5('0x5'),_0x47a5('0x6')];var monitorFormat={'wav':_0x47a5('0x7'),'wav49':_0x47a5('0x8'),'gsm':_0x47a5('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x47a5('0xa')};function VoiceQueue(_0x59199c){this['id']=_0x59199c['id']||0x0;this[_0x47a5('0xb')]=_0x59199c[_0x47a5('0xb')]||'';this['monitor_format']=_0x59199c[_0x47a5('0xc')]||'';this['type']=_0x59199c['type']||'inbound';this[_0x47a5('0xd')]=0x0;this[_0x47a5('0xe')]=0x0;this['total']=0x0;this[_0x47a5('0xf')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x47a5('0x10')]=0x0;this[_0x47a5('0x11')]=0x0;this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;this[_0x47a5('0x14')]=0x0;this[_0x47a5('0x15')]=_0x59199c[_0x47a5('0x15')]||![];this['acwTimeout']=_0x59199c[_0x47a5('0x16')]||0xa;this[_0x47a5('0x17')]=_0x59199c[_0x47a5('0x17')]||'no';this[_0x47a5('0x18')]=!![];this[_0x47a5('0x19')]='';this[_0x47a5('0x1a')]=0x0;this[_0x47a5('0x1b')]=0x0;this[_0x47a5('0x1c')]=_0x59199c['dialTimezone']||null;this[_0x47a5('0x1d')]=_0x59199c[_0x47a5('0x1d')]?_0x59199c[_0x47a5('0x1d')]:null;this[_0x47a5('0x1e')]=_0x59199c[_0x47a5('0x1e')];this['dialMethod']=_0x59199c['dialMethod']||_0x47a5('0x1f');this['dialLimitChannel']=_0x59199c['dialLimitChannel']||0x0;this[_0x47a5('0x20')]=_0x59199c[_0x47a5('0x20')]||0x0;this[_0x47a5('0x21')]=_0x59199c[_0x47a5('0x21')]||0x1;this[_0x47a5('0x22')]=_0x59199c[_0x47a5('0x22')]||_0x47a5('0x23');this[_0x47a5('0x24')]=_0x59199c[_0x47a5('0x24')]||0.03;this['dialPredictiveInterval']=_0x59199c[_0x47a5('0x25')]||0x258;this[_0x47a5('0x26')]=_0x59199c['dialOriginateCallerIdName']||_0x47a5('0x27');this[_0x47a5('0x28')]=_0x59199c[_0x47a5('0x28')]||'anonymous';this[_0x47a5('0x29')]=_0x59199c[_0x47a5('0x29')]||0x1e;this[_0x47a5('0x2a')]=_0x59199c[_0x47a5('0x2a')]||'tTxX';this[_0x47a5('0x2b')]=_0x59199c[_0x47a5('0x2b')]||0x3;this['dialQueueProject']=_0x59199c[_0x47a5('0x2c')]||undefined;this[_0x47a5('0x2d')]=_0x59199c[_0x47a5('0x2d')]||0x3;this[_0x47a5('0x2e')]=_0x59199c[_0x47a5('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x59199c['dialBusyMaxRetry']||0x3;this[_0x47a5('0x2f')]=_0x59199c['dialBusyRetryFrequency']||0x96;this[_0x47a5('0x30')]=_0x59199c['dialNoAnswerMaxRetry']||0x3;this[_0x47a5('0x31')]=_0x59199c[_0x47a5('0x31')]||0x96;this[_0x47a5('0x32')]=_0x59199c[_0x47a5('0x32')]||0x3;this[_0x47a5('0x33')]=_0x59199c[_0x47a5('0x33')]||0x96;this[_0x47a5('0x34')]=_0x59199c[_0x47a5('0x34')]||0x3;this[_0x47a5('0x35')]=_0x59199c[_0x47a5('0x35')]||0x96;this[_0x47a5('0x36')]=_0x59199c[_0x47a5('0x36')]||0x3;this[_0x47a5('0x37')]=_0x59199c['dialAbandonedRetryFrequency']||0x96;this[_0x47a5('0x38')]=_0x59199c['dialMachineMaxRetry']||0x3;this[_0x47a5('0x39')]=_0x59199c[_0x47a5('0x39')]||0x96;this[_0x47a5('0x3a')]=_0x59199c['dialAgentRejectMaxRetry']||0x3;this[_0x47a5('0x3b')]=_0x59199c[_0x47a5('0x3b')]||0x96;this[_0x47a5('0x3c')]=_0x59199c[_0x47a5('0x3c')]||0x3;this['dialGlobalMaxRetry']=_0x59199c['dialGlobalMaxRetry']||0x4;this[_0x47a5('0x3d')]=_0x59199c[_0x47a5('0x3d')]?_0x59199c['Trunk']:undefined;this['TrunkBackup']=_0x59199c[_0x47a5('0x3e')]?_0x59199c[_0x47a5('0x3e')]:undefined;this['dialPrefix']=_0x59199c[_0x47a5('0x3f')]||undefined;this['Interval']=_0x59199c[_0x47a5('0x40')]?_0x59199c[_0x47a5('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x59199c['dialOrderByScheduledAt']||_0x47a5('0x41');this['dialRandomLastDigitCallerIdNumber']=_0x59199c[_0x47a5('0x42')]||undefined;this[_0x47a5('0x43')]=_0x59199c[_0x47a5('0x43')]||undefined;this['strategy']=strategy[_0x59199c[_0x47a5('0x44')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x47a5('0x45')]=_0x59199c['dialAMDActive']||![];this[_0x47a5('0x46')]=_0x59199c['dialAMDInitialSilence'];this[_0x47a5('0x47')]=_0x59199c[_0x47a5('0x47')];this[_0x47a5('0x48')]=_0x59199c[_0x47a5('0x48')];this[_0x47a5('0x49')]=_0x59199c[_0x47a5('0x49')];this[_0x47a5('0x4a')]=_0x59199c[_0x47a5('0x4a')];this[_0x47a5('0x4b')]=_0x59199c['dialAMDBetweenWordsSilence'];this[_0x47a5('0x4c')]=_0x59199c[_0x47a5('0x4c')];this['dialAMDSilenceThreshold']=_0x59199c[_0x47a5('0x4d')];this[_0x47a5('0x4e')]=_0x59199c[_0x47a5('0x4e')];this['outboundRejectCallsDay']=0x0;this[_0x47a5('0x4f')]=0x0;this[_0x47a5('0x50')]=_0x59199c['timeout'];this[_0x47a5('0x51')]=0x0;this[_0x47a5('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x47a5('0x53')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x47a5('0x54')]=0x0;this[_0x47a5('0x55')]=0x0;this[_0x47a5('0x56')]=0x0;this[_0x47a5('0x57')]=0x0;this[_0x47a5('0x58')]=0x0;this[_0x47a5('0x59')]=0x0;this[_0x47a5('0x5a')]=0x0;this[_0x47a5('0x5b')]=undefined;this[_0x47a5('0x5c')]=undefined;this[_0x47a5('0x5d')]=undefined;this[_0x47a5('0x5e')]=1.05;this[_0x47a5('0x5f')]=0x0;this[_0x47a5('0x60')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x47a5('0x61')]=0x0;this[_0x47a5('0x62')]=0x0;this[_0x47a5('0x63')]=0x0;this[_0x47a5('0x64')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x47a5('0x65')]=_0x59199c['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x59199c['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x47a5('0x66')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x47a5('0x67')]=0x0;this[_0x47a5('0x68')]=0x0;this[_0x47a5('0x69')]=0x0;this['erlangBusyFactor']=0x0;this[_0x47a5('0x6a')]=_0x59199c[_0x47a5('0x6a')]||0x1e;this['dialRecallInQueue']=_0x59199c['dialRecallInQueue']||![];this[_0x47a5('0x6b')]=_0x59199c['dialQueueProject2']||undefined;this[_0x47a5('0x6c')]=_0x59199c[_0x47a5('0x6c')]||![];this[_0x47a5('0x6d')]=_0x59199c[_0x47a5('0x6d')]||![];this[_0x47a5('0xc')]=monitorFormat[_0x59199c[_0x47a5('0xc')]]?monitorFormat[_0x59199c[_0x47a5('0xc')]]:undefined;this[_0x47a5('0x6e')]=_0x59199c[_0x47a5('0x6e')]||![];this[_0x47a5('0x6f')]=_0x59199c[_0x47a5('0x6f')]?_0x59199c[_0x47a5('0x6f')]:undefined;}module[_0x47a5('0x70')]=VoiceQueue; \ No newline at end of file +var _0x5f2f=['wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse'];(function(_0x4f5385,_0x388e23){var _0x32ef9e=function(_0x356200){while(--_0x356200){_0x4f5385['push'](_0x4f5385['shift']());}};_0x32ef9e(++_0x388e23);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2982e5,_0x1ee780){_0x2982e5=_0x2982e5-0x0;var _0x2f7ce6=_0x5f2f[_0x2982e5];return _0x2f7ce6;};'use strict';var statusDesc=[_0xf5f2('0x0'),_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0xf5f2('0x8'),'gsm':_0xf5f2('0x9')};var strategy={'rrmemory':_0xf5f2('0xa'),'roundrobin':_0xf5f2('0xb')};function VoiceQueue(_0x3133bc){this['id']=_0x3133bc['id']||0x0;this[_0xf5f2('0xc')]=_0x3133bc['name']||'';this[_0xf5f2('0xd')]=_0x3133bc[_0xf5f2('0xd')]||'';this[_0xf5f2('0xe')]=_0x3133bc['type']||_0xf5f2('0xf');this[_0xf5f2('0x10')]=0x0;this[_0xf5f2('0x11')]=0x0;this['total']=0x0;this[_0xf5f2('0x12')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xf5f2('0x13')]=0x0;this[_0xf5f2('0x14')]=0x0;this['abandoned']=0x0;this[_0xf5f2('0x15')]=0x0;this[_0xf5f2('0x16')]=0x0;this[_0xf5f2('0x17')]=_0x3133bc[_0xf5f2('0x17')]||![];this[_0xf5f2('0x18')]=_0x3133bc[_0xf5f2('0x18')]||0xa;this['autopause']=_0x3133bc[_0xf5f2('0x19')]||'no';this[_0xf5f2('0x1a')]=!![];this[_0xf5f2('0x1b')]='';this[_0xf5f2('0x1c')]=0x0;this[_0xf5f2('0x1d')]=0x0;this['dialTimezone']=_0x3133bc[_0xf5f2('0x1e')]||null;this[_0xf5f2('0x1f')]=_0x3133bc[_0xf5f2('0x1f')]?_0x3133bc[_0xf5f2('0x1f')]:null;this[_0xf5f2('0x20')]=_0x3133bc[_0xf5f2('0x20')];this[_0xf5f2('0x21')]=_0x3133bc[_0xf5f2('0x21')]||_0xf5f2('0x22');this[_0xf5f2('0x23')]=_0x3133bc[_0xf5f2('0x23')]||0x0;this[_0xf5f2('0x24')]=_0x3133bc[_0xf5f2('0x24')]||0x0;this[_0xf5f2('0x25')]=_0x3133bc[_0xf5f2('0x25')]||0x1;this[_0xf5f2('0x26')]=_0x3133bc[_0xf5f2('0x26')]||'dropRate';this[_0xf5f2('0x27')]=_0x3133bc[_0xf5f2('0x27')]||0.03;this['dialPredictiveInterval']=_0x3133bc['dialPredictiveInterval']||0x258;this[_0xf5f2('0x28')]=_0x3133bc[_0xf5f2('0x28')]||'anonymous';this[_0xf5f2('0x29')]=_0x3133bc[_0xf5f2('0x29')]||_0xf5f2('0x2a');this[_0xf5f2('0x2b')]=_0x3133bc[_0xf5f2('0x2b')]||0x1e;this['dialQueueOptions']=_0x3133bc[_0xf5f2('0x2c')]||_0xf5f2('0x2d');this[_0xf5f2('0x2e')]=_0x3133bc[_0xf5f2('0x2e')]||0x3;this[_0xf5f2('0x2f')]=_0x3133bc['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x3133bc[_0xf5f2('0x30')]||0x3;this[_0xf5f2('0x31')]=_0x3133bc[_0xf5f2('0x31')]||0x96;this[_0xf5f2('0x32')]=_0x3133bc[_0xf5f2('0x32')]||0x3;this[_0xf5f2('0x33')]=_0x3133bc[_0xf5f2('0x33')]||0x96;this[_0xf5f2('0x34')]=_0x3133bc[_0xf5f2('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3133bc[_0xf5f2('0x35')]||0x96;this[_0xf5f2('0x36')]=_0x3133bc[_0xf5f2('0x36')]||0x3;this[_0xf5f2('0x37')]=_0x3133bc[_0xf5f2('0x37')]||0x96;this[_0xf5f2('0x38')]=_0x3133bc['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x3133bc[_0xf5f2('0x39')]||0x96;this[_0xf5f2('0x3a')]=_0x3133bc[_0xf5f2('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x3133bc['dialAbandonedRetryFrequency']||0x96;this[_0xf5f2('0x3b')]=_0x3133bc[_0xf5f2('0x3b')]||0x3;this[_0xf5f2('0x3c')]=_0x3133bc[_0xf5f2('0x3c')]||0x96;this[_0xf5f2('0x3d')]=_0x3133bc['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x3133bc[_0xf5f2('0x3e')]||0x96;this['callAdditionalPhoneAfterMin']=_0x3133bc[_0xf5f2('0x3f')]||0x3;this['dialGlobalMaxRetry']=_0x3133bc[_0xf5f2('0x40')]||0x4;this[_0xf5f2('0x41')]=_0x3133bc[_0xf5f2('0x41')]?_0x3133bc[_0xf5f2('0x41')]:undefined;this[_0xf5f2('0x42')]=_0x3133bc[_0xf5f2('0x42')]?_0x3133bc[_0xf5f2('0x42')]:undefined;this[_0xf5f2('0x43')]=_0x3133bc['dialPrefix']||undefined;this[_0xf5f2('0x44')]=_0x3133bc[_0xf5f2('0x44')]?_0x3133bc[_0xf5f2('0x44')]:undefined;this[_0xf5f2('0x45')]=_0x3133bc[_0xf5f2('0x45')]||_0xf5f2('0x46');this[_0xf5f2('0x47')]=_0x3133bc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf5f2('0x48')]=_0x3133bc[_0xf5f2('0x48')]||undefined;this['strategy']=strategy[_0x3133bc[_0xf5f2('0x49')]]||'rrmemory';this[_0xf5f2('0x4a')]=!![];this[_0xf5f2('0x4b')]=_0x3133bc[_0xf5f2('0x4b')]||![];this[_0xf5f2('0x4c')]=_0x3133bc['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x3133bc[_0xf5f2('0x4d')];this[_0xf5f2('0x4e')]=_0x3133bc[_0xf5f2('0x4e')];this['dialAMDTotalAnalysisTime']=_0x3133bc[_0xf5f2('0x4f')];this['dialAMDMinWordLength']=_0x3133bc[_0xf5f2('0x50')];this['dialAMDBetweenWordsSilence']=_0x3133bc[_0xf5f2('0x51')];this[_0xf5f2('0x52')]=_0x3133bc['dialAMDMaximumNumberOfWords'];this[_0xf5f2('0x53')]=_0x3133bc[_0xf5f2('0x53')];this[_0xf5f2('0x54')]=_0x3133bc[_0xf5f2('0x54')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xf5f2('0x55')]=_0x3133bc[_0xf5f2('0x55')];this[_0xf5f2('0x56')]=0x0;this[_0xf5f2('0x57')]=0x0;this[_0xf5f2('0x58')]=0x0;this[_0xf5f2('0x59')]=0x0;this[_0xf5f2('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xf5f2('0x5b')]=0x0;this[_0xf5f2('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xf5f2('0x5d')]=0x0;this[_0xf5f2('0x5e')]=0x0;this[_0xf5f2('0x5f')]=0x0;this[_0xf5f2('0x60')]=0x0;this[_0xf5f2('0x61')]=0x0;this[_0xf5f2('0x62')]=undefined;this[_0xf5f2('0x63')]=undefined;this[_0xf5f2('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xf5f2('0x65')]=0x0;this[_0xf5f2('0x66')]=0x0;this[_0xf5f2('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xf5f2('0x68')]=0x0;this[_0xf5f2('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3133bc[_0xf5f2('0x6a')]||0x14;this[_0xf5f2('0x6b')]=_0x3133bc[_0xf5f2('0x6a')]||0xa;this[_0xf5f2('0x6c')]=0x0;this[_0xf5f2('0x6d')]=0x0;this[_0xf5f2('0x6e')]=0x1;this[_0xf5f2('0x6f')]=0x0;this[_0xf5f2('0x70')]=0x0;this[_0xf5f2('0x71')]=0x0;this[_0xf5f2('0x72')]=0x0;this[_0xf5f2('0x73')]=_0x3133bc[_0xf5f2('0x73')]||0x1e;this[_0xf5f2('0x74')]=_0x3133bc[_0xf5f2('0x74')]||![];this['dialQueueProject2']=_0x3133bc[_0xf5f2('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x3133bc[_0xf5f2('0x76')]||![];this[_0xf5f2('0x77')]=_0x3133bc[_0xf5f2('0x77')]||![];this[_0xf5f2('0xd')]=monitorFormat[_0x3133bc[_0xf5f2('0xd')]]?monitorFormat[_0x3133bc[_0xf5f2('0xd')]]:undefined;this['mandatoryDisposition']=_0x3133bc[_0xf5f2('0x78')]||![];this[_0xf5f2('0x79')]=_0x3133bc[_0xf5f2('0x79')]?_0x3133bc[_0xf5f2('0x79')]:undefined;}module[_0xf5f2('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f73b8b1..5b4e50a 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 _0x86d7=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x331f68,_0x47b7eb){var _0x1a95e9=function(_0x343db4){while(--_0x343db4){_0x331f68['push'](_0x331f68['shift']());}};_0x1a95e9(++_0x47b7eb);}(_0x86d7,0x152));var _0x786d=function(_0x51ebac,_0x395e4f){_0x51ebac=_0x51ebac-0x0;var _0x5a2aa1=_0x86d7[_0x51ebac];return _0x5a2aa1;};'use strict';function VtigerAccount(_0x4d8558){this['id']=_0x4d8558['id']||0x0;this[_0x786d('0x0')]=_0x4d8558[_0x786d('0x0')]||'';this['username']=_0x4d8558[_0x786d('0x1')]||'';this[_0x786d('0x2')]=_0x4d8558[_0x786d('0x2')]||'';this[_0x786d('0x3')]=_0x4d8558[_0x786d('0x3')]||'';this[_0x786d('0x4')]=_0x4d8558['serverUrl']||'';this[_0x786d('0x5')]=_0x4d8558[_0x786d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xdadf=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0xe3afe9,_0x4abc1c){var _0x37a945=function(_0x4d94a9){while(--_0x4d94a9){_0xe3afe9['push'](_0xe3afe9['shift']());}};_0x37a945(++_0x4abc1c);}(_0xdadf,0x14b));var _0xfdad=function(_0x328405,_0xc0699e){_0x328405=_0x328405-0x0;var _0x1c563b=_0xdadf[_0x328405];return _0x1c563b;};'use strict';function VtigerAccount(_0x558548){this['id']=_0x558548['id']||0x0;this[_0xfdad('0x0')]=_0x558548[_0xfdad('0x0')]||'';this[_0xfdad('0x1')]=_0x558548[_0xfdad('0x1')]||'';this[_0xfdad('0x2')]=_0x558548[_0xfdad('0x2')]||'';this[_0xfdad('0x3')]=_0x558548[_0xfdad('0x3')]||'';this[_0xfdad('0x4')]=_0x558548[_0xfdad('0x4')]||'';this[_0xfdad('0x5')]=_0x558548['Configurations']||{};}module[_0xfdad('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 9c4e2fb..08abff7 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 _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x7a54,0x106));var _0x47a5=function(_0xbb4af7,_0x31becf){_0xbb4af7=_0xbb4af7-0x0;var _0x1b5cc8=_0x7a54[_0xbb4af7];return _0x1b5cc8;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x29694e,_0x3d2ca0){_0x29694e=_0x29694e-0x0;var _0x2f09aa=_0xadb5[_0x29694e];return _0x2f09aa;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index f4d2933..eb031e7 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 _0x7916=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x3c4b53,_0x183593){var _0x52b3a9=function(_0x1fe500){while(--_0x1fe500){_0x3c4b53['push'](_0x3c4b53['shift']());}};_0x52b3a9(++_0x183593);}(_0x7916,0x128));var _0x6791=function(_0x22386d,_0x5411ac){_0x22386d=_0x22386d-0x0;var _0x209a3f=_0x7916[_0x22386d];return _0x209a3f;};'use strict';function ZohoAccount(_0x4482d8){this['id']=_0x4482d8['id']||0x0;this['name']=_0x4482d8[_0x6791('0x0')]||'';this[_0x6791('0x1')]=_0x4482d8['description']||'';this[_0x6791('0x2')]=_0x4482d8[_0x6791('0x2')]||'';this[_0x6791('0x3')]=_0x4482d8[_0x6791('0x3')]||'';this['clientId']=_0x4482d8[_0x6791('0x4')]||'';this['clientSecret']=_0x4482d8[_0x6791('0x5')]||'';this[_0x6791('0x6')]=_0x4482d8['serverUrl']||'';this[_0x6791('0x7')]=_0x4482d8['code']||'';this[_0x6791('0x8')]=_0x4482d8['refreshToken']||'';this['Configurations']=_0x4482d8[_0x6791('0x9')]||{};}module[_0x6791('0xa')]=ZohoAccount; \ No newline at end of file +var _0x6da9=['refreshToken','name','description','host','clientId','clientSecret','serverUrl','code'];(function(_0x2cd8d6,_0x13eed7){var _0x45975c=function(_0x366885){while(--_0x366885){_0x2cd8d6['push'](_0x2cd8d6['shift']());}};_0x45975c(++_0x13eed7);}(_0x6da9,0x161));var _0x96da=function(_0x56cf45,_0x31ccff){_0x56cf45=_0x56cf45-0x0;var _0xf5fd3a=_0x6da9[_0x56cf45];return _0xf5fd3a;};'use strict';function ZohoAccount(_0x5557c4){this['id']=_0x5557c4['id']||0x0;this[_0x96da('0x0')]=_0x5557c4[_0x96da('0x0')]||'';this[_0x96da('0x1')]=_0x5557c4[_0x96da('0x1')]||'';this[_0x96da('0x2')]=_0x5557c4[_0x96da('0x2')]||'';this['zone']=_0x5557c4['zone']||'';this['clientId']=_0x5557c4[_0x96da('0x3')]||'';this[_0x96da('0x4')]=_0x5557c4[_0x96da('0x4')]||'';this['serverUrl']=_0x5557c4[_0x96da('0x5')]||'';this['code']=_0x5557c4[_0x96da('0x6')]||'';this[_0x96da('0x7')]=_0x5557c4[_0x96da('0x7')]||'';this['Configurations']=_0x5557c4['Configurations']||{};}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 83087d8..179c6bc 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 _0x8299=['phone','scheduledat','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','Agent','format','SIP/%s','membername','calleridname','Contact','lastName','active','calleridnum'];(function(_0xf98ec1,_0x4c73b8){var _0x514b6a=function(_0x3dbc32){while(--_0x3dbc32){_0xf98ec1['push'](_0xf98ec1['shift']());}};_0x514b6a(++_0x4c73b8);}(_0x8299,0x1f1));var _0x9829=function(_0x2413b7,_0x4afdd4){_0x2413b7=_0x2413b7-0x0;var _0x526581=_0x8299[_0x2413b7];return _0x526581;};'use strict';var util=require(_0x9829('0x0'));var _=require('lodash');var moment=require(_0x9829('0x1'));function checkNameSurname(_0x420dc6,_0x52ffbc,_0x46a032){var _0xb187d='';if(!_[_0x9829('0x2')](_0x52ffbc)&&_0x9829('0x3')===typeof _0x52ffbc){_0xb187d+=_0x52ffbc;}if(!_[_0x9829('0x2')](_0x46a032)&&_0x9829('0x3')===typeof _0x46a032){_0xb187d+='\x20'+_0x46a032;}if(_0xb187d!==''){return _0xb187d;}return _0x420dc6;}function Action(_0x36dc32,_0x29145d,_0x4b22ec,_0x20061c,_0x237d2e){this['uniqueid']=_0x4b22ec||undefined;this[_0x9829('0x4')]=_0x36dc32['id'];this[_0x9829('0x5')]=_0x29145d[_0x9829('0x6')];this[_0x9829('0x7')]=_0x29145d[_0x9829('0x7')];this[_0x9829('0x8')]=_0x9829('0x5');this[_0x9829('0x9')]=![];this['membername']=_[_0x9829('0x2')](_0x36dc32[_0x9829('0xa')])?undefined:_0x36dc32[_0x9829('0xa')][_0x9829('0x6')];this['channelAgent']=this['membername']?util[_0x9829('0xb')](_0x9829('0xc'),this[_0x9829('0xd')]):_0x20061c||undefined;this[_0x9829('0xe')]=checkNameSurname(_0x36dc32[_0x9829('0xf')]['phone'],_0x36dc32[_0x9829('0xf')]['firstName'],_0x36dc32[_0x9829('0xf')][_0x9829('0x10')]);this[_0x9829('0x11')]=_0x36dc32[_0x9829('0x11')]||![];this[_0x9829('0x12')]=_0x36dc32[_0x9829('0x13')];this[_0x9829('0x14')]=_0x36dc32[_0x9829('0x14')];this[_0x9829('0x15')]=_0x36dc32['countbusyretry']||0x0;this['countcongestionretry']=_0x36dc32['countcongestionretry']||0x0;this['countnoanswerretry']=_0x36dc32[_0x9829('0x16')]||0x0;this['countglobal']=(_0x36dc32[_0x9829('0x15')]||0x0)+(_0x36dc32[_0x9829('0x17')]||0x0)+(_0x36dc32[_0x9829('0x16')]||0x0)+(_0x36dc32[_0x9829('0x18')]||0x0)+(_0x36dc32[_0x9829('0x19')]||0x0)+(_0x36dc32['countabandonedretry']||0x0)+(_0x36dc32[_0x9829('0x1a')]||0x0)+(_0x36dc32[_0x9829('0x1b')]||0x0);this[_0x9829('0x18')]=_0x36dc32[_0x9829('0x18')]||0x0;this['countdropretry']=_0x36dc32[_0x9829('0x19')]||0x0;this['countabandonedretry']=_0x36dc32[_0x9829('0x1c')]||0x0;this['countmachineretry']=_0x36dc32[_0x9829('0x1a')]||0x0;this[_0x9829('0x1b')]=_0x36dc32[_0x9829('0x1b')]||0x0;this['callback']=_0x36dc32[_0x9829('0x1d')];this[_0x9829('0x1e')]=_0x36dc32[_0x9829('0x1e')];this[_0x9829('0x1f')]=_0x36dc32[_0x9829('0x1f')];this[_0x9829('0x20')]=_0x36dc32[_0x9829('0x20')];this[_0x9829('0x21')]=_0x36dc32[_0x9829('0x21')];this['ListId']=_0x36dc32['ListId'];this[_0x9829('0x22')]=_[_0x9829('0x2')](_0x36dc32['Agent'])?_0x36dc32[_0x9829('0x22')]:_0x36dc32[_0x9829('0xa')]['id'];this[_0x9829('0x23')]=_0x36dc32[_0x9829('0x23')];this[_0x9829('0x24')]='';this[_0x9829('0x25')]='';}Action[_0x9829('0x26')][_0x9829('0x27')]=function(){return util[_0x9829('0xb')](_0x9829('0x28'),this[_0x9829('0xe')],this[_0x9829('0x29')]);};module[_0x9829('0x2a')]=Action; \ No newline at end of file +var _0x4ad4=['ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','util','lodash','isNil','string','idContact','queue','name','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4ad4,0x1e2));var _0x44ad=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x4ad4[_0x45783c];return _0x1161da;};'use strict';var util=require(_0x44ad('0x0'));var _=require(_0x44ad('0x1'));var moment=require('moment');function checkNameSurname(_0x4efd0f,_0x5e8a5e,_0x12d427){var _0xcf1ac2='';if(!_['isNil'](_0x5e8a5e)&&'string'===typeof _0x5e8a5e){_0xcf1ac2+=_0x5e8a5e;}if(!_[_0x44ad('0x2')](_0x12d427)&&_0x44ad('0x3')===typeof _0x12d427){_0xcf1ac2+='\x20'+_0x12d427;}if(_0xcf1ac2!==''){return _0xcf1ac2;}return _0x4efd0f;}function Action(_0x4a5028,_0x58f1c2,_0x2e07b2,_0x3d9e96,_0x311fc2){this['uniqueid']=_0x2e07b2||undefined;this[_0x44ad('0x4')]=_0x4a5028['id'];this[_0x44ad('0x5')]=_0x58f1c2[_0x44ad('0x6')];this['type']=_0x58f1c2['type'];this[_0x44ad('0x7')]=_0x44ad('0x5');this[_0x44ad('0x8')]=![];this[_0x44ad('0x9')]=_[_0x44ad('0x2')](_0x4a5028[_0x44ad('0xa')])?undefined:_0x4a5028[_0x44ad('0xa')][_0x44ad('0x6')];this[_0x44ad('0xb')]=this[_0x44ad('0x9')]?util[_0x44ad('0xc')]('SIP/%s',this[_0x44ad('0x9')]):_0x3d9e96||undefined;this[_0x44ad('0xd')]=checkNameSurname(_0x4a5028['Contact'][_0x44ad('0xe')],_0x4a5028[_0x44ad('0xf')][_0x44ad('0x10')],_0x4a5028[_0x44ad('0xf')][_0x44ad('0x11')]);this[_0x44ad('0x12')]=_0x4a5028[_0x44ad('0x12')]||![];this[_0x44ad('0x13')]=_0x4a5028[_0x44ad('0xe')];this[_0x44ad('0x14')]=_0x4a5028[_0x44ad('0x14')];this[_0x44ad('0x15')]=_0x4a5028[_0x44ad('0x15')]||0x0;this[_0x44ad('0x16')]=_0x4a5028['countcongestionretry']||0x0;this[_0x44ad('0x17')]=_0x4a5028[_0x44ad('0x17')]||0x0;this[_0x44ad('0x18')]=(_0x4a5028['countbusyretry']||0x0)+(_0x4a5028[_0x44ad('0x16')]||0x0)+(_0x4a5028[_0x44ad('0x17')]||0x0)+(_0x4a5028[_0x44ad('0x19')]||0x0)+(_0x4a5028[_0x44ad('0x1a')]||0x0)+(_0x4a5028[_0x44ad('0x1b')]||0x0)+(_0x4a5028[_0x44ad('0x1c')]||0x0)+(_0x4a5028['countagentrejectretry']||0x0);this[_0x44ad('0x19')]=_0x4a5028[_0x44ad('0x19')]||0x0;this[_0x44ad('0x1a')]=_0x4a5028[_0x44ad('0x1a')]||0x0;this[_0x44ad('0x1b')]=_0x4a5028[_0x44ad('0x1b')]||0x0;this[_0x44ad('0x1c')]=_0x4a5028[_0x44ad('0x1c')]||0x0;this[_0x44ad('0x1d')]=_0x4a5028[_0x44ad('0x1d')]||0x0;this[_0x44ad('0x1e')]=_0x4a5028[_0x44ad('0x1e')];this[_0x44ad('0x1f')]=_0x4a5028[_0x44ad('0x1f')];this[_0x44ad('0x20')]=_0x4a5028[_0x44ad('0x20')];this[_0x44ad('0x21')]=_0x4a5028['recallme'];this[_0x44ad('0x22')]=_0x4a5028[_0x44ad('0x22')];this['ListId']=_0x4a5028[_0x44ad('0x23')];this[_0x44ad('0x24')]=_[_0x44ad('0x2')](_0x4a5028[_0x44ad('0xa')])?_0x4a5028[_0x44ad('0x24')]:_0x4a5028[_0x44ad('0xa')]['id'];this[_0x44ad('0x25')]=_0x4a5028[_0x44ad('0x25')];this[_0x44ad('0x26')]='';this[_0x44ad('0x27')]='';}Action[_0x44ad('0x28')][_0x44ad('0x29')]=function(){return util['format'](_0x44ad('0x2a'),this['calleridname'],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 2330142..f750641 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 _0x4cb4=['countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','[syncHangup][talking][decrement]','pTalking:\x20','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','additional','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','unlockAgent','idContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','run','execRun','unlock','getContactPreview','recallme','validateContact','isValid','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','syncNewExten','actionid','logLookAgent','responsetime','response','unlockContact','custom:agentringnoanswer','rejected','Answer','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','syncVarSet','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','preview','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangupRequest','dialend','syncDialEnd','varset','bind','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','originated','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','campaignsPreview','booked','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry'];(function(_0x4ecdeb,_0x302055){var _0x166e53=function(_0x54a016){while(--_0x54a016){_0x4ecdeb['push'](_0x4ecdeb['shift']());}};_0x166e53(++_0x302055);}(_0x4cb4,0xb6));var _0x44cb=function(_0x544b3f,_0x4d8b66){_0x544b3f=_0x544b3f-0x0;var _0x15787f=_0x4cb4[_0x544b3f];return _0x15787f;};'use strict';var util=require(_0x44cb('0x0'));var _=require(_0x44cb('0x1'));var BPromise=require('bluebird');var uuid=require(_0x44cb('0x2'));var moment=require(_0x44cb('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x44cb('0x4'));var loggerAction=require(_0x44cb('0x5'))(_0x44cb('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x44cb('0x7'));var Action=require(_0x44cb('0x8'));var ut=require(_0x44cb('0x9'));config['redis']=_[_0x44cb('0xa')](config[_0x44cb('0xb')],{'host':_0x44cb('0xc'),'port':0x18eb});var io=require(_0x44cb('0xd'))(new Redis(config[_0x44cb('0xb')]));var Sequence=function(){};Sequence[_0x44cb('0xe')]['enqueue']=function(_0x1381eb){this[_0x44cb('0xf')]=this[_0x44cb('0xf')]?this[_0x44cb('0xf')][_0x44cb('0x10')](_0x1381eb):_0x1381eb();};function Preview(_0x30eaa9){this[_0x44cb('0x11')]=new Sequence();this['campaignsPreview']=_0x30eaa9[_0x44cb('0x12')];this[_0x44cb('0x13')]=_0x30eaa9['trunks'];this[_0x44cb('0x14')]={};this[_0x44cb('0x15')]=_0x30eaa9[_0x44cb('0x15')];this[_0x44cb('0x16')]=0x0;ami['on'](_0x44cb('0x17'),this[_0x44cb('0x18')]['bind'](this));ami['on'](_0x44cb('0x19'),this['syncHangup']['bind'](this));ami['on']('hanguprequest',this[_0x44cb('0x1a')]['bind'](this));ami['on'](_0x44cb('0x1b'),this[_0x44cb('0x1c')]['bind'](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x44cb('0x1d'),this['syncVarSet'][_0x44cb('0x1e')](this));ami['on']('attendedtransfer',this[_0x44cb('0x1f')][_0x44cb('0x1e')](this));ami['on'](_0x44cb('0x20'),this[_0x44cb('0x21')][_0x44cb('0x1e')](this));this[_0x44cb('0x22')](this['campaignsPreview']);}function emit(_0x44d3ff,_0x3deab2,_0x450596){io['to'](_0x44d3ff)[_0x44cb('0x23')](_0x3deab2,_0x450596);}function emitCampaignPreview(_0x4c181f){if(_0x4c181f['type']===_0x44cb('0x24')){var _0x290261={'id':_0x4c181f['id'],'name':_0x4c181f[_0x44cb('0x25')],'strategy':_0x4c181f[_0x44cb('0x26')],'answered':_0x4c181f[_0x44cb('0x27')],'available':_0x4c181f[_0x44cb('0x28')],'loggedIn':_0x4c181f[_0x44cb('0x29')],'pTalking':_0x4c181f[_0x44cb('0x2a')],'sumBillable':_0x4c181f['sumBillable'],'sumDuration':_0x4c181f[_0x44cb('0x2b')],'sumHoldTime':_0x4c181f[_0x44cb('0x2c')]||0x0,'talking':_0x4c181f['talking'],'total':_0x4c181f[_0x44cb('0x2d')],'type':_0x4c181f[_0x44cb('0x2e')],'unmanaged':_0x4c181f[_0x44cb('0x2f')],'abandoned':_0x4c181f[_0x44cb('0x30')],'waiting':_0x4c181f['waiting'],'loggedInDb':_0x4c181f[_0x44cb('0x31')],'dialActive':_0x4c181f['dialActive'],'dialMethod':_0x4c181f[_0x44cb('0x32')],'dialOriginateCallerIdName':_0x4c181f[_0x44cb('0x33')],'dialOriginateCallerIdNumber':_0x4c181f[_0x44cb('0x34')],'dialOriginateTimeout':_0x4c181f[_0x44cb('0x35')],'dialPrefix':_0x4c181f[_0x44cb('0x36')],'outboundAnswerAgiCallsDay':_0x4c181f[_0x44cb('0x37')],'outboundAnswerCallsDay':_0x4c181f[_0x44cb('0x38')],'outboundBlacklistCallsDay':_0x4c181f[_0x44cb('0x39')],'outboundBusyCallsDay':_0x4c181f[_0x44cb('0x3a')],'outboundCongestionCallsDay':_0x4c181f['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4c181f[_0x44cb('0x3b')],'outboundDropCallsDayCallersExit':_0x4c181f[_0x44cb('0x3c')],'outboundDropCallsDayTimeout':_0x4c181f[_0x44cb('0x3d')],'outboundNoAnswerCallsDay':_0x4c181f[_0x44cb('0x3e')],'outboundNoSuchCallsDay':_0x4c181f[_0x44cb('0x3f')],'outboundOriginateFailureCallsDay':_0x4c181f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4c181f['outboundReCallsDay'],'outboundRejectCallsDay':_0x4c181f[_0x44cb('0x40')],'outboundUnknownCallsDay':_0x4c181f[_0x44cb('0x41')],'outboundAbandonedCallsDay':_0x4c181f[_0x44cb('0x42')],'predictiveIntervalAnsweredCalls':_0x4c181f[_0x44cb('0x43')],'predictiveIntervalAvgHoldtime':_0x4c181f[_0x44cb('0x44')],'predictiveIntervalAvgTalktime':_0x4c181f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4c181f[_0x44cb('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x4c181f[_0x44cb('0x46')],'predictiveIntervalErlangCalls':_0x4c181f[_0x44cb('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c181f[_0x44cb('0x48')],'predictiveIntervalHitRate':_0x4c181f['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4c181f[_0x44cb('0x49')],'predictiveIntervalPauses':_0x4c181f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4c181f['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4c181f[_0x44cb('0x4a')],'message':_0x4c181f[_0x44cb('0x4b')],'originated':_0x4c181f['originated'],'erlangCalls':_0x4c181f[_0x44cb('0x4c')],'erlangCallToSecond':_0x4c181f[_0x44cb('0x4d')],'erlangAbandonmentRate':_0x4c181f['erlangAbandonmentRate'],'erlangBusyFactor':_0x4c181f[_0x44cb('0x4e')],'startPredictive':_0x4c181f['startPredictive'],'startProgressive':_0x4c181f[_0x44cb('0x4f')]};if(_0x4c181f[_0x44cb('0x50')]){_0x290261['Trunk']={'id':_0x4c181f[_0x44cb('0x50')]['id'],'name':_0x4c181f[_0x44cb('0x50')]['name'],'active':_0x4c181f[_0x44cb('0x50')][_0x44cb('0x51')],'callerid':_0x4c181f[_0x44cb('0x50')][_0x44cb('0x52')]};}if(_0x4c181f[_0x44cb('0x53')]){_0x290261[_0x44cb('0x53')]={'id':_0x4c181f[_0x44cb('0x53')]['id'],'name':_0x4c181f[_0x44cb('0x53')][_0x44cb('0x25')]};}var _0x3851ad=md5(JSON[_0x44cb('0x54')](_0x290261));if(_0x4c181f[_0x44cb('0x55')]!==_0x3851ad){_0x4c181f[_0x44cb('0x55')]=_0x3851ad;emit(util[_0x44cb('0x56')](_0x44cb('0x57'),_0x290261['name']),_0x44cb('0x58'),_0x290261);}}}function emitVoiceQueueChannelRemove(_0x51206c){logger[_0x44cb('0x59')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x51206c));emit(util[_0x44cb('0x56')]('voice:queue:%s',_0x51206c[_0x44cb('0x25')]),_0x44cb('0x5a'),_0x51206c);io[_0x44cb('0x23')]('voice_queue_presence:remove',_0x51206c);}function notSendMessagesQueue(_0x36d5ce){if(_0x36d5ce['sendMessageOneNotActive']){if(_0x36d5ce[_0x44cb('0x5b')]===0x0&&_0x36d5ce['pTalking']===0x0){_0x36d5ce[_0x44cb('0x5c')]=![];_0x36d5ce['available']=0x0;_0x36d5ce[_0x44cb('0x5d')]=0x0;_0x36d5ce['message']=_0x44cb('0x5e');ut[_0x44cb('0x5f')](_0x44cb('0x60'),_0x36d5ce[_0x44cb('0x25')]+_0x44cb('0x61'));}else{_0x36d5ce[_0x44cb('0x4b')]=_0x44cb('0x62');ut['logger'](_0x44cb('0x60'),_0x36d5ce['name']+_0x44cb('0x63'));}emitCampaignPreview(_0x36d5ce);}}Preview['prototype']['loopCampaigns']=function(){var _0x517e80=this;setInterval(function(){_0x517e80['syncCampaigns']();},0x7cf);};Preview['prototype'][_0x44cb('0x64')]=function(){var _0x1e1ebc=this[_0x44cb('0x65')];this[_0x44cb('0x16')]+=0x1;for(var _0x569df4 in _0x1e1ebc){if(_0x1e1ebc['hasOwnProperty'](_0x569df4)&&(_0x1e1ebc[_0x569df4]['dialMethod']===_0x44cb('0x4')||_0x1e1ebc[_0x569df4][_0x44cb('0x32')]===_0x44cb('0x66'))&&_0x1e1ebc[_0x569df4][_0x44cb('0x2e')]==='outbound'){if(this[_0x44cb('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x44cb('0x67')]();}}if(_0x1e1ebc[_0x44cb('0x68')](_0x569df4)&&_0x1e1ebc[_0x569df4][_0x44cb('0x32')]===_0x44cb('0x4')&&_0x1e1ebc[_0x569df4]['type']===_0x44cb('0x24')){if(_0x1e1ebc[_0x569df4][_0x44cb('0x69')]){this[_0x44cb('0x6a')](_0x1e1ebc[_0x569df4]);this[_0x44cb('0x6b')](_0x1e1ebc[_0x569df4]);}else{notSendMessagesQueue(_0x1e1ebc[_0x569df4]);}}}};Preview['prototype'][_0x44cb('0x6c')]=function(_0x213e98){var _0x1ce8d2=this;this[_0x44cb('0x11')][_0x44cb('0x6d')](function(){if(!_[_0x44cb('0x6e')](_0x1ce8d2['actions'][_0x213e98])){loggerAction[_0x44cb('0x59')](_0x44cb('0x6f'),_0x213e98,_0x44cb('0x70'),_0x1ce8d2[_0x44cb('0x14')][_0x213e98][_0x44cb('0x71')],_0x44cb('0x72'),JSON[_0x44cb('0x54')](_0x1ce8d2['campaignsPreview'][_0x1ce8d2[_0x44cb('0x14')][_0x213e98]['queue']][_0x44cb('0x5b')]),'pTalking:\x20',JSON[_0x44cb('0x54')](_0x1ce8d2[_0x44cb('0x65')][_0x1ce8d2[_0x44cb('0x14')][_0x213e98][_0x44cb('0x71')]]['pTalking']),JSON[_0x44cb('0x54')](_0x1ce8d2[_0x44cb('0x14')][_0x213e98][_0x44cb('0x73')]),JSON[_0x44cb('0x54')](_[_0x44cb('0x74')](_0x1ce8d2['actions'][_0x213e98],[_0x44cb('0x75'),_0x44cb('0x76'),_0x44cb('0x77'),_0x44cb('0x78')])));return ami[_0x44cb('0x79')]({'action':_0x44cb('0x7a'),'channel':_0x1ce8d2[_0x44cb('0x14')][_0x213e98][_0x44cb('0x7b')]})[_0x44cb('0x7c')](function(_0x54c295){if(_0x54c295[_0x44cb('0x4b')]===_0x44cb('0x7d')){setTimeout(function(){if(_0x1ce8d2[_0x44cb('0x14')][_0x213e98]){ut[_0x44cb('0x7e')](_0x1ce8d2['campaignsPreview'][_0x1ce8d2['actions'][_0x213e98]['queue']],_0x44cb('0x7f'));if(_0x1ce8d2[_0x44cb('0x14')][_0x213e98][_0x44cb('0x73')]===!![]){ut['decrementTalkink'](_0x1ce8d2[_0x44cb('0x65')][_0x1ce8d2[_0x44cb('0x14')][_0x213e98][_0x44cb('0x71')]],'[clearZombieChannel]');ut[_0x44cb('0x80')](_0x44cb('0x81')+_0x213e98,_0x1ce8d2[_0x44cb('0x14')][_0x213e98]['queue']);}ut['loggerError'](_0x44cb('0x82')+_0x213e98,_0x1ce8d2['actions'][_0x213e98]['queue']);delete _0x1ce8d2[_0x44cb('0x14')][_0x213e98];}},0x2328);}});}});};Preview[_0x44cb('0xe')][_0x44cb('0x67')]=function(){var _0x1af266=this;loggerAction[_0x44cb('0x59')](_0x44cb('0x83'),_['size'](this[_0x44cb('0x14')]));for(var _0x153927 in this[_0x44cb('0x14')]){if(_0x1af266[_0x44cb('0x14')][_0x44cb('0x68')](_0x153927)){_0x1af266[_0x44cb('0x6c')](_0x153927);}}};Preview[_0x44cb('0xe')]['recallMe']=function(_0x25ef03){var _0x8c1388=this;rpcDb[_0x44cb('0x84')](_0x25ef03['id'],ut[_0x44cb('0x85')](this['agents']))[_0x44cb('0x86')](function(_0x5f0464){if(!_[_0x44cb('0x6e')](_0x5f0464)){for(var _0x4c6a8c=0x0;_0x4c6a8c<_0x5f0464[_0x44cb('0x87')];_0x4c6a8c+=0x1){if(ut['getDiff'](_0x5f0464[_0x4c6a8c][_0x44cb('0x88')])<_0x25ef03[_0x44cb('0x89')]*0x3c){if(_0x5f0464[_0x4c6a8c][_0x44cb('0x8a')]&&!_0x5f0464[_0x4c6a8c][_0x44cb('0x8a')]['voicePause']){_0x8c1388['run'](_0x5f0464[_0x4c6a8c]['id'])[_0x44cb('0x86')](ut[_0x44cb('0x8b')](_0x44cb('0x8c')))[_0x44cb('0x7c')](ut[_0x44cb('0x8b')](_0x44cb('0x8c')));}else{rpcDb[_0x44cb('0x8d')](_0x5f0464[_0x4c6a8c]['id']);}}else{var _0x3533e7=new Action(_0x5f0464[_0x4c6a8c],_0x25ef03);_0x3533e7[_0x44cb('0x8e')]=moment()[_0x44cb('0x56')](_0x44cb('0x8f'));_0x25ef03['outboundReCallsDay']+=0x1;ut[_0x44cb('0x90')](_0x3533e7,0x17,_0x44cb('0x91'));if(_0x25ef03['dialRecallInQueue']){rpcDb[_0x44cb('0x92')](ut[_0x44cb('0x93')](_0x5f0464[_0x4c6a8c]));rpcDb[_0x44cb('0x94')](_0x3533e7,_0x44cb('0x95'));}else{ut[_0x44cb('0x90')](_0x3533e7,0x16,_0x44cb('0x96'));rpcDb['createCustomerHistory'](_0x3533e7,_0x44cb('0x97'));rpcDb[_0x44cb('0x98')](_0x3533e7,_0x44cb('0x97'));}}}}})[_0x44cb('0x7c')](ut[_0x44cb('0x8b')](_0x44cb('0x99')));};Preview[_0x44cb('0xe')][_0x44cb('0x6a')]=function(_0x43d32c){_0x43d32c[_0x44cb('0x5c')]=!![];if(ut[_0x44cb('0x9a')](_0x43d32c[_0x44cb('0x29')])){_0x43d32c[_0x44cb('0x4b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x44cb('0x9b')](_0x43d32c[_0x44cb('0x69')])){_0x43d32c[_0x44cb('0x4b')]='NOT_ACTIVE';}else if(!this[_0x44cb('0x9c')](_0x43d32c['Trunk'])){if(!this[_0x44cb('0x9c')](_0x43d32c[_0x44cb('0x9d')])){_0x43d32c['message']=_0x44cb('0x9e');}else{_0x43d32c[_0x44cb('0x4b')]=_0x44cb('0x9f');}}else{_0x43d32c[_0x44cb('0x4b')]='ACTIVE';}emitCampaignPreview(_0x43d32c);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x55682f,_0x402a09,_0x359a73){var _0x5b5f7a=this;var _0x250de3=this[_0x44cb('0x14')][_0x402a09];var _0x193160=this['campaignsPreview'][_0x250de3[_0x44cb('0x71')]];var _0x5681c0;var _0x3b59c2=![];var _0x2a4a34=0x2;var _0x55ab25=0x3;if(_0x193160){switch(_0x359a73){case'1':_0x193160[_0x44cb('0x3f')]+=0x1;_0x250de3[_0x44cb('0xa0')]+=0x1;_0x250de3[_0x44cb('0xa1')]=ut['totalGlobal'](_0x250de3);ut[_0x44cb('0x90')](_0x250de3,0x0,'NoSuchNumber');ami['emit'](_0x44cb('0xa2'),ut[_0x44cb('0xa3')](_0x250de3,_0x44cb('0xa4')));rpcDb['createCustomerHistory'](_0x250de3,'[callProgressDetectingCustomer][logNoSuch]');_0x5b5f7a[_0x44cb('0xa5')](_0x250de3,'0',_0x193160)['then'](function(_0x1da595){_0x3b59c2=_0x1da595['additional']==0x1;_0x2a4a34=_0x193160[_0x44cb('0xa6')];_0x55ab25=_0x193160[_0x44cb('0xa7')];if(!_0x3b59c2){if(ut[_0x44cb('0xa8')](_0x250de3)>=_0x193160[_0x44cb('0xa9')]){_0x5681c0=ut[_0x44cb('0xaa')](_0x250de3,0xf,_0x44cb('0xab'));rpcDb['createCustomerFinal'](_0x5681c0,_0x44cb('0xac'));}else{if(_0x250de3['countnosuchnumberretry']>=_0x193160[_0x44cb('0xad')]){rpcDb[_0x44cb('0x98')](_0x250de3,_0x44cb('0xac'));}else{rpcDb[_0x44cb('0xae')](ut[_0x44cb('0xaf')](_0x250de3,_0x44cb('0xa0'),_0x193160[_0x44cb('0xa6')]),_0x250de3['unlockAgent'],_0x250de3[_0x44cb('0xb0')]);}}delete this['actions'][_0x55682f[_0x44cb('0xb1')]];}else{_0x250de3[_0x44cb('0xa0')]++;logger[_0x44cb('0x59')](_0x44cb('0xb2'),_0x250de3[_0x44cb('0xa0')]);logger[_0x44cb('0x59')]('id',_0x250de3['idContact']);_0x5b5f7a[_0x44cb('0xb3')]({'id':_0x250de3['idContact'],'field':{'countnosuchnumberretry':_0x250de3[_0x44cb('0xa0')]}})[_0x44cb('0x86')](function(){_0x5b5f7a['swapAdditionalPhones'](_0x250de3,_0x2a4a34,_0x55ab25)['then'](function(){});});}});break;case _0x44cb('0xb4'):var _0x204649=moment()[_0x44cb('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x250de3['responsetime']=_0x204649;_0x250de3[_0x44cb('0xb5')]=_0x204649;_0x250de3[_0x44cb('0x73')]=!![];_0x193160[_0x44cb('0x2a')]+=0x1;logger[_0x44cb('0x59')](_0x44cb('0xb6'),_0x250de3[_0x44cb('0xb7')],_0x44cb('0xb8'),_0x193160['name'],'pTalking:\x20',_0x193160['pTalking']);ami[_0x44cb('0x23')]('custom:agentconnect',ut[_0x44cb('0xa3')](_0x250de3,'connect',this['campaignsPreview'][_0x250de3[_0x44cb('0x71')]]));if(_0x193160[_0x44cb('0xb9')]){ami[_0x44cb('0x23')](_0x44cb('0xba'),ut[_0x44cb('0xbb')](_0x250de3));}break;case'16':ami[_0x44cb('0x23')](_0x44cb('0xbc'),ut[_0x44cb('0xa3')](_0x250de3,_0x44cb('0xbd'),this[_0x44cb('0x65')][_0x250de3[_0x44cb('0x71')]]));emitVoiceQueueChannelRemove(ut[_0x44cb('0xa3')](_0x250de3,_0x44cb('0xbd')));_0x193160['outboundAnswerCallsDay']+=0x1;_0x193160[_0x44cb('0x2d')]+=0x1;_0x193160['answered']+=0x1;ut[_0x44cb('0xbe')](_0x193160,_0x44cb('0xbf'));_0x250de3[_0x44cb('0xa1')]=ut[_0x44cb('0xa8')](_0x250de3);ut[_0x44cb('0x90')](_0x250de3,0x4,'Answer');rpcDb['createCustomerHistory'](_0x250de3,_0x44cb('0xc0'));rpcDb[_0x44cb('0x98')](_0x250de3,_0x44cb('0xc1'));rpcDb['crateCustomerReportQueue'](_0x250de3);_0x193160['sumDuration']+=_0x250de3[_0x44cb('0xc2')];_0x193160[_0x44cb('0xc3')]+=_0x250de3['talktime'];logger['info'](_0x44cb('0xc4'),_0x250de3['uniqueid'],_0x44cb('0xb8'),_0x193160[_0x44cb('0x25')],_0x44cb('0xc5'),_0x193160[_0x44cb('0x2a')]);delete this[_0x44cb('0x14')][_0x55682f[_0x44cb('0xb1')]];break;case _0x44cb('0xc6'):_0x193160[_0x44cb('0x3a')]+=0x1;_0x250de3[_0x44cb('0xc7')]+=0x1;_0x250de3[_0x44cb('0xa1')]=ut[_0x44cb('0xa8')](_0x250de3);ut[_0x44cb('0x90')](_0x250de3,0x5,_0x44cb('0xc8'));_0x2a4a34=_0x193160[_0x44cb('0xc9')];_0x55ab25=_0x193160[_0x44cb('0xa7')];ami['emit'](_0x44cb('0xca'),ut[_0x44cb('0xa3')](_0x250de3,_0x44cb('0xcb')));rpcDb['createCustomerHistory'](_0x250de3,'[callProgressDetectingCustomer][logBusy]');_0x5b5f7a[_0x44cb('0xa5')](_0x250de3,'5',_0x193160)['then'](function(_0x3425c0){_0x3b59c2=_0x3425c0[_0x44cb('0xcc')]==0x1;if(!_0x3b59c2){if(ut['totalGlobal'](_0x250de3)>=_0x193160[_0x44cb('0xa9')]){_0x5681c0=ut[_0x44cb('0xaa')](_0x250de3,0xf,_0x44cb('0xab'));rpcDb['createCustomerFinal'](_0x5681c0,_0x44cb('0xcd'));}else{if(_0x250de3['countbusyretry']>=_0x193160[_0x44cb('0xce')]){rpcDb[_0x44cb('0x98')](_0x250de3,_0x44cb('0xcf'));}else{rpcDb[_0x44cb('0xae')](ut[_0x44cb('0xaf')](_0x250de3,_0x44cb('0xc7'),_0x193160[_0x44cb('0xc9')]),_0x250de3[_0x44cb('0xd0')],_0x250de3[_0x44cb('0xb0')]);}}}else{_0x250de3[_0x44cb('0xc7')]++;_0x5b5f7a[_0x44cb('0xb3')]({'id':_0x250de3[_0x44cb('0xd1')],'field':{'countbusyretry':_0x250de3['countbusyretry']}})['then'](function(){_0x5b5f7a[_0x44cb('0xd2')](_0x250de3,_0x2a4a34,_0x55ab25)[_0x44cb('0x86')](function(){});});}});break;case _0x44cb('0xd3'):_0x193160[_0x44cb('0x3e')]+=0x1;_0x250de3[_0x44cb('0xd4')]+=0x1;_0x250de3[_0x44cb('0xa1')]=ut[_0x44cb('0xa8')](_0x250de3);ut[_0x44cb('0x90')](_0x250de3,0x3,'NoAnswer');_0x2a4a34=_0x193160['dialNoAnswerRetryFrequency'];_0x55ab25=_0x193160[_0x44cb('0xa7')];ami[_0x44cb('0x23')](_0x44cb('0xd5'),ut[_0x44cb('0xa3')](_0x250de3,'noanswer'));rpcDb['createCustomerHistory'](_0x250de3,_0x44cb('0xd6'));_0x5b5f7a[_0x44cb('0xa5')](_0x250de3,'3',_0x193160)[_0x44cb('0x86')](function(_0x54055b){_0x3b59c2=_0x54055b[_0x44cb('0xcc')]==0x1;if(!_0x3b59c2){if(ut[_0x44cb('0xa8')](_0x250de3)>=_0x193160[_0x44cb('0xa9')]){_0x5681c0=ut['cloneAction'](_0x250de3,0xf,_0x44cb('0xab'));rpcDb[_0x44cb('0x98')](_0x5681c0,_0x44cb('0xd7'));}else{if(_0x250de3[_0x44cb('0xd4')]>=_0x193160['dialNoAnswerMaxRetry']){rpcDb[_0x44cb('0x98')](_0x250de3,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x44cb('0xae')](ut[_0x44cb('0xaf')](_0x250de3,_0x44cb('0xd4'),_0x193160[_0x44cb('0xd8')]),_0x250de3[_0x44cb('0xd0')],_0x250de3[_0x44cb('0xb0')]);}}}else{_0x250de3[_0x44cb('0xd4')]++;_0x5b5f7a[_0x44cb('0xb3')]({'id':_0x250de3[_0x44cb('0xd1')],'field':{'countnoanswerretry':_0x250de3[_0x44cb('0xd4')]}})['then'](function(){_0x5b5f7a[_0x44cb('0xd2')](_0x250de3,_0x2a4a34,_0x55ab25)[_0x44cb('0x86')](function(){});});}});break;case'CONGESTION':_0x193160[_0x44cb('0xd9')]+=0x1;_0x250de3['countcongestionretry']+=0x1;_0x250de3['countglobal']=ut['totalGlobal'](_0x250de3);ut[_0x44cb('0x90')](_0x250de3,0x8,_0x44cb('0xda'));_0x2a4a34=_0x193160[_0x44cb('0xdb')];_0x55ab25=_0x193160['callAdditionalPhoneAfterMin'];ami[_0x44cb('0x23')]('custom:agentcongestion',ut[_0x44cb('0xa3')](_0x250de3,_0x44cb('0xdc')));rpcDb[_0x44cb('0x94')](_0x250de3,_0x44cb('0xdd'));_0x5b5f7a[_0x44cb('0xa5')](_0x250de3,'8',_0x193160)[_0x44cb('0x86')](function(_0x15e01c){_0x3b59c2=_0x15e01c[_0x44cb('0xcc')]==0x1;if(!_0x3b59c2){if(ut['totalGlobal'](_0x250de3)>=_0x193160['dialGlobalMaxRetry']){_0x5681c0=ut[_0x44cb('0xaa')](_0x250de3,0xf,_0x44cb('0xab'));rpcDb[_0x44cb('0x98')](_0x5681c0,_0x44cb('0xde'));}else{if(_0x250de3['countcongestionretry']>=_0x193160[_0x44cb('0xdf')]){rpcDb[_0x44cb('0x98')](_0x250de3,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x44cb('0xae')](ut[_0x44cb('0xaf')](_0x250de3,'countcongestionretry',_0x193160['dialBusyRetryFrequency']),_0x250de3[_0x44cb('0xd0')],_0x250de3[_0x44cb('0xb0')]);}}}else{_0x250de3[_0x44cb('0xe0')]++;_0x5b5f7a[_0x44cb('0xb3')]({'id':_0x250de3[_0x44cb('0xd1')],'field':{'countcongestionretry':_0x250de3[_0x44cb('0xe0')]}})[_0x44cb('0x86')](function(){_0x5b5f7a['swapAdditionalPhones'](_0x250de3,_0x2a4a34,_0x55ab25)[_0x44cb('0x86')](function(){});});}});break;case _0x44cb('0xe1'):_0x193160['outboundRejectCallsDay']+=0x1;_0x250de3[_0x44cb('0xe2')]+=0x1;_0x250de3[_0x44cb('0xa1')]=ut[_0x44cb('0xa8')](_0x250de3);ut[_0x44cb('0x90')](_0x250de3,0x14,'AgentReject');_0x2a4a34=_0x193160[_0x44cb('0xe3')];_0x55ab25=_0x193160['callAdditionalPhoneAfterMin'];ami[_0x44cb('0x23')](_0x44cb('0xe4'),ut[_0x44cb('0xa3')](_0x250de3,_0x44cb('0xe5')));rpcDb[_0x44cb('0x94')](_0x250de3,'[syncHangupRequest][logAgentReject]');_0x5b5f7a[_0x44cb('0xa5')](_0x250de3,'20',_0x193160)['then'](function(_0x4e40ca){_0x3b59c2=_0x4e40ca[_0x44cb('0xcc')]==0x1;if(!_0x3b59c2){if(ut[_0x44cb('0xa8')](_0x250de3)>=_0x193160[_0x44cb('0xa9')]){_0x5681c0=ut[_0x44cb('0xaa')](_0x250de3,0x14,'AgentReject');rpcDb[_0x44cb('0x98')](_0x5681c0,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x250de3[_0x44cb('0xe2')]>=_0x193160[_0x44cb('0xe6')]){rpcDb['createCustomerFinal'](_0x250de3,_0x44cb('0xe7'));}else{rpcDb[_0x44cb('0xae')](ut[_0x44cb('0xaf')](_0x250de3,'countagentrejectretry',_0x193160[_0x44cb('0xe3')]),_0x250de3[_0x44cb('0xd0')],_0x250de3['activeContact']);}}}else{_0x250de3[_0x44cb('0xd4')]++;_0x5b5f7a['incrementPreviewCounters']({'id':_0x250de3[_0x44cb('0xd1')],'field':{'countnoanswerretry':_0x250de3[_0x44cb('0xd4')]}})[_0x44cb('0x86')](function(){_0x5b5f7a[_0x44cb('0xd2')](_0x250de3,_0x2a4a34,_0x55ab25)[_0x44cb('0x86')](function(){});});}});break;case'ABANDONED':_0x193160[_0x44cb('0x42')]+=0x1;_0x250de3[_0x44cb('0xe8')]+=0x1;_0x250de3[_0x44cb('0xa1')]=ut['totalGlobal'](_0x250de3);ut[_0x44cb('0x90')](_0x250de3,0xb,'Abandoned');rpcDb[_0x44cb('0x94')](_0x250de3,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x44cb('0xa8')](_0x250de3)>=_0x193160[_0x44cb('0xa9')]){_0x5681c0=ut[_0x44cb('0xaa')](_0x250de3,0xf,_0x44cb('0xab'));rpcDb[_0x44cb('0x98')](_0x5681c0,_0x44cb('0xe9'));}else{if(_0x250de3['countabandonedetry']>=_0x193160[_0x44cb('0xea')]){rpcDb[_0x44cb('0x98')](_0x250de3,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x44cb('0xaf')](_0x250de3,'countabandonedretry',_0x193160[_0x44cb('0xeb')]),_0x250de3[_0x44cb('0xd0')],_0x250de3['activeContact']);}}break;default:if(_0x250de3['dialAnswer']){ut['decrementTalkink'](_0x193160,_0x44cb('0xec'));ut['loggerError'](_0x44cb('0xed')+_0x193160[_0x44cb('0x25')],_0x55682f);}_0x193160[_0x44cb('0x41')]+=0x1;_0x250de3['countglobal']=ut[_0x44cb('0xa8')](_0x250de3);ut[_0x44cb('0x90')](_0x250de3,0xc,_0x55682f['cause-txt']||_0x55682f[_0x44cb('0xee')]);_0x2a4a34=_0x193160[_0x44cb('0xe3')];_0x55ab25=_0x193160[_0x44cb('0xa7')];rpcDb[_0x44cb('0x94')](_0x250de3,_0x44cb('0xef'));_0x5b5f7a[_0x44cb('0xa5')](_0x250de3,'20',_0x193160)[_0x44cb('0x86')](function(_0x2e5429){_0x3b59c2=_0x2e5429[_0x44cb('0xcc')]==0x1;if(!_0x3b59c2){if(ut[_0x44cb('0xa8')](_0x250de3)>=_0x193160[_0x44cb('0xa9')]){_0x5681c0=ut[_0x44cb('0xaa')](_0x250de3,0xf,_0x44cb('0xab'));rpcDb[_0x44cb('0x98')](_0x5681c0,_0x44cb('0xf0'));}else{rpcDb[_0x44cb('0x98')](_0x250de3,_0x44cb('0xf0'));}delete this[_0x44cb('0x14')][_0x55682f[_0x44cb('0xb1')]];}else{_0x5b5f7a[_0x44cb('0xd2')](_0x250de3,_0x2a4a34,_0x55ab25)[_0x44cb('0x86')](function(_0x516d71){});}});}if(!(_0x250de3['dialAnswer']&&_0x359a73==='16')){ut[_0x44cb('0x7e')](_0x193160,_0x44cb('0xf1'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x250de3[_0x44cb('0xb7')],'\x20Queue',_0x193160['name'],_0x44cb('0x72'),_0x193160[_0x44cb('0x5b')]);}if(_0x359a73!==_0x44cb('0xb4')){delete this[_0x44cb('0x14')][_0x55682f[_0x44cb('0xb1')]];delete this[_0x44cb('0x14')][_0x55682f['destlinkedid']];}}};Preview[_0x44cb('0xe')][_0x44cb('0xf2')]=function(_0x48ab47,_0x5d53c8,_0x1c55ac){if(_[_0x44cb('0xf3')](_0x5d53c8)&&'object'!==typeof _0x5d53c8){return;}if(_[_0x44cb('0xf3')](_0x1c55ac)&&_0x44cb('0xf4')!==typeof _0x1c55ac){return;}switch(_0x1c55ac[_0x44cb('0xf5')]){case'0':ut['logAgent'](_0x48ab47,0x0,_0x44cb('0xf6'));rpcDb[_0x44cb('0xf7')](_0x48ab47,_0x44cb('0xf8'));break;case'3':ut['logAgent'](_0x48ab47,0x3,_0x44cb('0xf9'));rpcDb['createAgentHistory'](_0x48ab47,_0x44cb('0xfa'));break;case'5':ut[_0x44cb('0xfb')](_0x48ab47,0x5,'Busy');rpcDb['createAgentHistory'](_0x48ab47,_0x44cb('0xfc'));break;case'8':ut['logAgent'](_0x48ab47,0x8,_0x44cb('0xda'));rpcDb[_0x44cb('0xf7')](_0x48ab47,_0x44cb('0xfd'));break;case'22':ut[_0x44cb('0xfb')](_0x48ab47,0x16,_0x44cb('0xfe'));rpcDb[_0x44cb('0xf7')](_0x48ab47,_0x44cb('0xff'));break;default:ut[_0x44cb('0xfb')](_0x48ab47,0xc,_0x1c55ac[_0x44cb('0xf5')]);rpcDb[_0x44cb('0xf7')](_0x48ab47,_0x44cb('0xfd'));}ut['updateOriginated'](_0x5d53c8,'[callProgressDetectingAgent]');logger[_0x44cb('0x59')](_0x44cb('0x100'),_0x48ab47[_0x44cb('0xb7')],_0x44cb('0xb8'),_0x5d53c8[_0x44cb('0x25')],'originated:\x20',_0x5d53c8['originated']);delete this[_0x44cb('0x14')][_0x48ab47[_0x44cb('0xb7')]];};Preview[_0x44cb('0xe')][_0x44cb('0xa5')]=function(_0x5ea293,_0x41950f,_0x2e5e73){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0x44cb('0xa5')](_0x5ea293,_0x41950f,_0x2e5e73))[_0x44cb('0x7c')](logger['info'](_0x44cb('0x101')));};Preview['prototype'][_0x44cb('0xd2')]=function(_0x692beb,_0x525d70,_0x150d38){return BPromise[_0x44cb('0x102')]()[_0x44cb('0x86')](cmHopperAdditionalPhone[_0x44cb('0xd2')](_0x692beb,_0x525d70,_0x150d38))['catch'](logger['info'](_0x44cb('0x103')));};Preview[_0x44cb('0xe')][_0x44cb('0xb3')]=function(_0xb3b64d){return BPromise[_0x44cb('0x102')]()[_0x44cb('0x86')](cmHopperAdditionalPhone[_0x44cb('0xb3')](_0xb3b64d))[_0x44cb('0x7c')](logger['info'](_0x44cb('0x104')));};Preview['prototype'][_0x44cb('0x105')]=function(_0x142ba3,_0x29c5ab,_0x10d14e,_0x121a49,_0x64fc16){var _0x2768f9=this;return new BPromise(function(_0x57d5db,_0x2f52ae){if(_[_0x44cb('0x6e')](_0x29c5ab)||_['isNil'](_0x29c5ab[_0x44cb('0x106')])||_[_0x44cb('0x6e')](_0x29c5ab['phone'])||_[_0x44cb('0x6e')](_0x29c5ab['VoiceQueueId'])){_0x2f52ae(ut['message']('Contact\x20is\x20undefined',_0x121a49,_0x64fc16));return;}var _0x567438=uuid['v4']();var _0x414264=_0x2768f9[_0x44cb('0x65')][_0x29c5ab[_0x44cb('0x70')][_0x44cb('0x25')]];var _0xc756e2=_0x10d14e?_0x2768f9[_0x44cb('0x15')][_0x10d14e]['id']:undefined;_0x2768f9[_0x44cb('0x14')][_0x567438]=new Action(_0x29c5ab,_0x414264,_0x567438,_0x10d14e,_0xc756e2);var _0x462f90=_0x2768f9[_0x44cb('0x14')][_0x567438];_0x462f90[_0x44cb('0xd0')]=_0x121a49;_0x462f90['activeContact']=_0x64fc16;_0x462f90[_0x44cb('0x107')]=_0x10d14e;if(_['isEmpty'](_0x142ba3)){_0x2768f9[_0x44cb('0x108')](_0x462f90,_0x414264,_0x29c5ab,_0x10d14e)['then'](function(_0x5cd1d8){logger['info'](_0x44cb('0x109'),_0x44cb('0x10a')+_0x462f90[_0x44cb('0x71')]+_0x44cb('0x10b')+_0x462f90[_0x44cb('0xd1')],JSON[_0x44cb('0x54')](_0x5cd1d8));ami[_0x44cb('0x23')]('custom:agentcalled',ut[_0x44cb('0xa3')](_0x462f90,_0x44cb('0x10c'),_0x2768f9[_0x44cb('0x65')][_0x462f90['queue']]));_0x57d5db(ut['message']('Calling'));})[_0x44cb('0x7c')](function(_0x41631a){ut[_0x44cb('0x5f')](_0x44cb('0x10d'),_0x41631a);_0x2f52ae(ut[_0x44cb('0x4b')](_0x44cb('0x10e'),_0x121a49,_0x64fc16));});}else{_0x414264[_0x44cb('0x39')]+=0x1;ut[_0x44cb('0x10f')](_0x462f90);rpcDb[_0x44cb('0x110')](_0x462f90,'[Blacklist][error]');delete _0x2768f9[_0x44cb('0x14')][_0x567438];_0x2f52ae(ut[_0x44cb('0x4b')]('Contact\x20in\x20black\x20List',_0x121a49,_0x64fc16));}});};Preview[_0x44cb('0xe')]['isTrunkReachable']=function(_0x96fb70){return!_['isNil'](_0x96fb70)&&!_[_0x44cb('0x6e')](_0x96fb70['name'])&&!_[_0x44cb('0x6e')](_0x96fb70[_0x44cb('0x51')])&&_0x96fb70['active']&&!_[_0x44cb('0x6e')](this[_0x44cb('0x13')][util[_0x44cb('0x56')](_0x44cb('0x111'),_0x96fb70[_0x44cb('0x25')])])&&!_['isNil'](this[_0x44cb('0x13')][util['format'](_0x44cb('0x111'),_0x96fb70[_0x44cb('0x25')])][_0x44cb('0x7a')])&&(this[_0x44cb('0x13')][util[_0x44cb('0x56')]('SIP/%s',_0x96fb70[_0x44cb('0x25')])][_0x44cb('0x7a')]===_0x44cb('0x112')||this['trunks'][util['format']('SIP/%s',_0x96fb70[_0x44cb('0x25')])]['status']===_0x44cb('0x113'));};Preview['prototype'][_0x44cb('0x114')]=function(_0xd48113,_0x24b99b){var _0x1e530f=this;return new BPromise(function(_0x375494,_0x8db887){_0x1e530f[_0x44cb('0x115')](_0xd48113,_0x24b99b)[_0x44cb('0x86')](function(_0x20234d){_0x375494(_[_0x44cb('0x74')](_0x20234d,[_0x44cb('0x4b')]));})[_0x44cb('0x7c')](function(_0x36252d){if(_0x36252d[_0x44cb('0x116')]){rpcDb['unlockContact'](_0xd48113);}if(_0x36252d['active']){rpcDb[_0x44cb('0x8d')](_0xd48113);}_0x8db887(_['pick'](_0x36252d,['message']));});});};Preview['prototype']['execRun']=function(_0x46a2c5,_0x28fdfd){var _0x352ab0=this;return new BPromise(function(_0x1e3fbe,_0x58cf57){var _0x5b0a42,_0x1cdea2;rpcDb[_0x44cb('0x117')](_0x46a2c5)[_0x44cb('0x86')](function(_0xf3aff1){if(!_[_0x44cb('0x6e')](_0xf3aff1[0x0])){_0x1cdea2=_0xf3aff1[0x0][_0x44cb('0x118')]?![]:!![];_0x5b0a42=_0xf3aff1[0x0][_0x44cb('0x118')]?!![]:![];_0x5b0a42=_0x28fdfd?!![]:_0x5b0a42;}var _0x41fb43=_0x352ab0[_0x44cb('0x119')](_0xf3aff1);if(_0x41fb43[_0x44cb('0x11a')]){rpcDb['checkIsBlackList'](_[_0x44cb('0x74')](_0xf3aff1[0x0],[_0x44cb('0x77'),_0x44cb('0x11b')]))[_0x44cb('0x86')](function(_0x105c41){_0x352ab0[_0x44cb('0x105')](_0x105c41,_0xf3aff1[0x0],_0x28fdfd,_0x1cdea2,_0x5b0a42)[_0x44cb('0x86')](function(_0x7aa877){_0x1e3fbe(_0x7aa877);})[_0x44cb('0x7c')](function(_0x452a77){_0x58cf57(_0x452a77);});})[_0x44cb('0x7c')](function(_0x14d648){ut['logger'](_0x44cb('0x11c'),_0x14d648);_0x58cf57(ut['message'](_0x44cb('0x11d'),_0x1cdea2,_0x5b0a42));});}else{_0x58cf57(ut[_0x44cb('0x4b')](_0x41fb43[_0x44cb('0x4b')],_0x1cdea2,_0x5b0a42));}})[_0x44cb('0x7c')](function(_0x549f27){ut['logger'](_0x44cb('0x11e'),_0x549f27);_0x58cf57(ut['message'](_0x44cb('0x11d'),![],!![]));});});};Preview[_0x44cb('0xe')]['validateContact']=function(_0x192a2e){if(_[_0x44cb('0x6e')](_0x192a2e)||_[_0x44cb('0x11f')](_0x192a2e)||!_[_0x44cb('0x6e')](_0x192a2e[0x0]['Agent'])&&_['isNil'](_0x192a2e[0x0][_0x44cb('0x8a')][_0x44cb('0x25')])){ut[_0x44cb('0x5f')](_0x44cb('0x120'),_0x192a2e);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2a5064=this[_0x44cb('0x65')][_0x192a2e[0x0][_0x44cb('0x70')][_0x44cb('0x25')]];_0x2a5064[_0x44cb('0x4b')]=_0x44cb('0x9f');if(_[_0x44cb('0x6e')](_0x2a5064)){ut[_0x44cb('0x5f')](_0x44cb('0x121'),_0x2a5064);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x2a5064[_0x44cb('0x50')])){ut[_0x44cb('0x5f')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x2a5064[_0x44cb('0x25')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x44cb('0x9c')](_0x2a5064[_0x44cb('0x9d')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x2a5064[_0x44cb('0x25')]+_0x44cb('0x122'));return{'isValid':![],'message':_0x44cb('0x123')};}}if(!ut[_0x44cb('0x9b')](_0x2a5064[_0x44cb('0x69')])){ut['logger'](_0x44cb('0x124'),_0x2a5064['name']+_0x44cb('0x125'));return{'isValid':![],'message':_0x44cb('0x126')+_0x2a5064[_0x44cb('0x25')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x44cb('0x127')};};Preview[_0x44cb('0xe')][_0x44cb('0x108')]=function(_0x131de3,_0x353b46,_0x3bd1b6,_0x45f76d){var _0x443eb3=this;return new BPromise(function(_0x53ccb6,_0x16b641){var _0xde3479=_0x131de3[_0x44cb('0xb7')];var _0x26942a=_0x443eb3[_0x44cb('0x9c')](_0x353b46['Trunk'])?util[_0x44cb('0x56')](_0x44cb('0x128'),_0x353b46[_0x44cb('0x50')][_0x44cb('0x25')],_[_0x44cb('0x6e')](_0x353b46[_0x44cb('0x36')])?'':_0x353b46[_0x44cb('0x36')][_0x44cb('0x129')]()||'',_0x353b46['dialCutDigit']>0x0?_0x3bd1b6[_0x44cb('0x11b')]['substring'](_0x353b46[_0x44cb('0x12a')]):_0x3bd1b6[_0x44cb('0x11b')]):util['format']('SIP/%s/%s%s',_[_0x44cb('0x6e')](_0x353b46['TrunkBackup'])?_0x353b46[_0x44cb('0x50')][_0x44cb('0x25')]:_0x353b46[_0x44cb('0x9d')][_0x44cb('0x25')],_[_0x44cb('0x6e')](_0x353b46[_0x44cb('0x36')])?'':_0x353b46[_0x44cb('0x36')][_0x44cb('0x129')]()||'',_0x353b46[_0x44cb('0x12a')]>0x0?_0x3bd1b6[_0x44cb('0x11b')][_0x44cb('0x12b')](_0x353b46[_0x44cb('0x12a')]):_0x3bd1b6['phone']);var _0x3227b8=_0x443eb3[_0x44cb('0x9c')](_0x353b46[_0x44cb('0x50')])?ut['getCallerId'](_0x353b46[_0x44cb('0x50')][_0x44cb('0x52')],_0x353b46['dialOriginateCallerIdName'],_0x353b46[_0x44cb('0x12c')]>0x0?ut[_0x44cb('0x12d')](_0x353b46[_0x44cb('0x34')],_0x353b46[_0x44cb('0x12c')]):_0x353b46[_0x44cb('0x34')]):ut[_0x44cb('0x12e')](_['isNil'](_0x353b46[_0x44cb('0x9d')])?_0x353b46['Trunk'][_0x44cb('0x52')]:_0x353b46[_0x44cb('0x9d')][_0x44cb('0x52')],_0x353b46[_0x44cb('0x33')],_0x353b46[_0x44cb('0x12c')]>0x0?ut[_0x44cb('0x12d')](_0x353b46[_0x44cb('0x34')],_0x353b46[_0x44cb('0x12c')]):_0x353b46[_0x44cb('0x34')]);if(_0x3227b8){_0x131de3[_0x44cb('0x12f')]=ut[_0x44cb('0x130')](_0x3227b8);_0x131de3[_0x44cb('0x131')]=ut[_0x44cb('0x132')](_0x3227b8);}var _0x42bf4d=ut[_0x44cb('0x133')](_0x353b46,_0x3bd1b6,_0x26942a,_0x3227b8,_0xde3479,_0x131de3);_[_0x44cb('0x134')](_0x131de3,ut[_0x44cb('0x135')](_0x42bf4d));_0x131de3[_0x44cb('0x8e')]=moment()[_0x44cb('0x56')](_0x44cb('0x8f'));ami['Action'](ut[_0x44cb('0x136')](_0x131de3,_0x353b46,_0x42bf4d,_0x131de3[_0x44cb('0xb0')],_0x45f76d))[_0x44cb('0x86')](function(_0x15f3da){_0x353b46[_0x44cb('0x5b')]+=0x1;logger['info']('[originated][increment]',_0xde3479,_0x44cb('0xb8'),_0x353b46[_0x44cb('0x25')],'originated:\x20',_0x353b46[_0x44cb('0x5b')]);_0x53ccb6(_0x15f3da);})[_0x44cb('0x7c')](function(_0x35880a){ut['logAgent'](_0x131de3,0xe,_0x44cb('0x137'));rpcDb[_0x44cb('0xf7')](_0x131de3,'[originateFailure][logOriginateFailure]');_0x16b641(_0x35880a);});});};Preview[_0x44cb('0xe')][_0x44cb('0x138')]=function(_0x5e08c1){if(this[_0x44cb('0x14')][_0x5e08c1[_0x44cb('0xb1')]]){this[_0x44cb('0x14')][_0x5e08c1['linkedid']][_0x44cb('0x7b')]=_0x5e08c1[_0x44cb('0x7b')];}};Preview['prototype'][_0x44cb('0x18')]=function(_0x5dd310){var _0x57b96a=this;var _0x4ea579=this[_0x44cb('0x14')][_0x5dd310[_0x44cb('0x139')]];if(_0x4ea579){if(_0x4ea579[_0x44cb('0x107')]&&this[_0x44cb('0x15')][_0x4ea579[_0x44cb('0x107')]]){ut[_0x44cb('0x13a')](_0x4ea579,this['agents'][_0x4ea579['lookAgent']][_0x44cb('0x25')],this[_0x44cb('0x15')][_0x4ea579['lookAgent']]['id']);}var _0x437246=_['clone'](_0x4ea579);_0x437246[_0x44cb('0x13b')]=moment()[_0x44cb('0x56')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3deb34=_0x57b96a[_0x44cb('0x65')][_0x4ea579[_0x44cb('0x71')]];if(ut['isFailure'](_0x5dd310[_0x44cb('0x13c')])){if(_0x4ea579[_0x44cb('0xd0')]){rpcDb[_0x44cb('0x13d')](_0x4ea579['idContact']);}if(_0x4ea579['activeContact']){rpcDb[_0x44cb('0x8d')](_0x4ea579[_0x44cb('0xd1')]);}ami['emit'](_0x44cb('0x13e'),ut[_0x44cb('0xa3')](_0x4ea579,_0x44cb('0x13f'),this[_0x44cb('0x65')][_0x4ea579['queue']]));this[_0x44cb('0xf2')](_0x437246,_0x3deb34,_0x5dd310);}else{_0x4ea579['starttime']=moment()['format'](_0x44cb('0x8f'));ut[_0x44cb('0xfb')](_0x437246,0x4,_0x44cb('0x140'));rpcDb[_0x44cb('0xf7')](_0x437246,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x44cb('0xe')][_0x44cb('0x141')]=function(_0x205e58){var _0x3fd436=this;var _0x4a0b89=this['actions'][_0x205e58[_0x44cb('0xb1')]];var _0x2b65f2;if(_0x4a0b89){_0x2b65f2=this[_0x44cb('0x65')][_0x4a0b89['queue']];logger['info'](_0x44cb('0x142'),_0x205e58[_0x44cb('0xb1')],_0x44cb('0xb8'),_0x2b65f2['name'],_0x44cb('0xc5'),_0x2b65f2[_0x44cb('0x2a')]);}if(this['actions'][_0x205e58[_0x44cb('0xb1')]]&&_0x205e58['linkedid']!==_0x205e58[_0x44cb('0xb7')]){if(_0x205e58['cause']==='16'&&this[_0x44cb('0x14')][_0x205e58[_0x44cb('0xb1')]]['dialAnswer']){this[_0x44cb('0x143')](_0x205e58,_0x205e58['linkedid'],_0x205e58['cause']);}else if(this[_0x44cb('0x14')][_0x205e58[_0x44cb('0xb1')]][_0x44cb('0x73')]){logger[_0x44cb('0x59')](_0x44cb('0x144'),_0x205e58[_0x44cb('0xb1')],_0x205e58['cause'],_0x44cb('0xb8'),_0x2b65f2['name'],_0x44cb('0xc5'),_0x2b65f2[_0x44cb('0x2a')]);this[_0x44cb('0x143')](_0x205e58,_0x205e58[_0x44cb('0xb1')],_0x205e58[_0x44cb('0x145')]);}}else if(_0x4a0b89&&_['isNil'](_0x4a0b89['statedesc'])&&_0x2b65f2[_0x44cb('0x146')]&&_0x205e58[_0x44cb('0xb1')]===_0x205e58[_0x44cb('0xb7')]&&_[_0x44cb('0x6e')](_0x205e58[_0x44cb('0xf5')])&&_0x205e58[_0x44cb('0x145')]==='16'&&_0x205e58['channelstate']==='6'&&_[_0x44cb('0xf3')](_0x4a0b89[_0x44cb('0x147')])){if(_0x4a0b89[_0x44cb('0xd0')]){rpcDb[_0x44cb('0x13d')](_0x4a0b89[_0x44cb('0xd1')]);}if(_0x4a0b89[_0x44cb('0xb0')]){rpcDb['disableContact'](_0x4a0b89[_0x44cb('0xd1')]);}_0x205e58['reason']='22';this['callProgressDetectingAgent'](_0x4a0b89,_0x2b65f2,_0x205e58);}else if(_0x4a0b89&&_0x4a0b89[_0x44cb('0x147')]){if(_0x205e58[_0x44cb('0x145')]==='16'&&this[_0x44cb('0x14')][_0x205e58[_0x44cb('0xb1')]][_0x44cb('0x73')]){logger[_0x44cb('0x59')](_0x44cb('0x148'),_0x205e58[_0x44cb('0xb1')],_0x205e58[_0x44cb('0x145')],_0x44cb('0xb8'),_0x2b65f2[_0x44cb('0x25')],_0x44cb('0xc5'),_0x2b65f2['pTalking']);this[_0x44cb('0x143')](_0x205e58,_0x205e58[_0x44cb('0xb1')],_0x205e58[_0x44cb('0x145')]);}else if(this[_0x44cb('0x14')][_0x205e58['linkedid']][_0x44cb('0x73')]){logger[_0x44cb('0x59')]('[syncHangup][talking][cause]',_0x205e58['linkedid'],_0x205e58[_0x44cb('0x145')],_0x44cb('0xb8'),_0x2b65f2['name'],_0x44cb('0xc5'),_0x2b65f2[_0x44cb('0x2a')]);this[_0x44cb('0x143')](_0x205e58,_0x205e58[_0x44cb('0xb1')],_0x205e58[_0x44cb('0x145')]);}}};Preview['prototype'][_0x44cb('0x1c')]=function(_0x2b489e){if(this['actions'][_0x2b489e[_0x44cb('0x149')]]&&_0x2b489e[_0x44cb('0x149')]!==_0x2b489e[_0x44cb('0x14a')]){this[_0x44cb('0x143')](_0x2b489e,_0x2b489e[_0x44cb('0x149')],_0x2b489e[_0x44cb('0xee')]);}};Preview[_0x44cb('0xe')][_0x44cb('0x1a')]=function(_0x5d152b){if(this[_0x44cb('0x14')][_0x5d152b[_0x44cb('0xb1')]]&&_0x5d152b[_0x44cb('0xb1')]!==_0x5d152b[_0x44cb('0xb7')]&&!this['actions'][_0x5d152b[_0x44cb('0xb1')]][_0x44cb('0x73')]){if(_0x5d152b[_0x44cb('0x145')]==='1'){this[_0x44cb('0x143')](_0x5d152b,_0x5d152b['linkedid'],_0x5d152b[_0x44cb('0x145')]);}}};Preview[_0x44cb('0xe')]['addVariable']=function(_0x1ff9ae,_0x1cbdbd,_0x39a729){if(this[_0x44cb('0x14')][_0x1ff9ae]){if(_[_0x44cb('0x6e')](this['actions'][_0x1ff9ae][_0x44cb('0x14b')])){this['actions'][_0x1ff9ae]['variables']={};}this[_0x44cb('0x14')][_0x1ff9ae]['variables'][_0x1cbdbd]=_0x39a729;}};Preview[_0x44cb('0xe')][_0x44cb('0x14c')]=function(_0xfdffae){try{if(!_['isNil'](_0xfdffae)){if(ut[_0x44cb('0x14d')](_[_0x44cb('0x14e')](_0xfdffae[_0x44cb('0x14f')])[0x0])){this[_0x44cb('0x150')](_0xfdffae['uniqueid'],_[_0x44cb('0x14e')](_0xfdffae['variable'])[0x0],_0xfdffae[_0x44cb('0x151')]);}}}catch(_0x347e4b){logger[_0x44cb('0x152')](_0x44cb('0x153'),util[_0x44cb('0x154')](_0x347e4b,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x44cb('0x1f')]=function(_0x118107){if(_0x118107){if(this[_0x44cb('0x14')][_0x118107['transfertargetlinkedid']]){this['actions'][_0x118107[_0x44cb('0x155')]][_0x44cb('0x147')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x4380ac){if(_0x4380ac){if(this[_0x44cb('0x14')][_0x4380ac[_0x44cb('0x156')]]){this[_0x44cb('0x14')][_0x4380ac[_0x44cb('0x156')]][_0x44cb('0x147')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xcf36=['loggerError','[action]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','pTalking:\x20','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','dialBusyMaxRetry','incrementPreviewCounters','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','decrementTalkink','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','logLookAgent','clone','response','rejected','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hanguprequest','dialend','syncDialEnd','varset','syncVarSet','attendedtransfer','loopCampaigns','emit','type','name','strategy','answered','available','sumBillable','sumHoldTime','talking','total','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','format','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','logger','IS_DISACTIVED','syncCampaigns','hasOwnProperty','outbound','clearZombieChannels','recallMe','clearZombieChannel','enqueue','isNil','info','Queue','actions','queue','originated:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]'];(function(_0x52739e,_0x4b9a19){var _0x36b736=function(_0x401f4c){while(--_0x401f4c){_0x52739e['push'](_0x52739e['shift']());}};_0x36b736(++_0x4b9a19);}(_0xcf36,0xdf));var _0x6cf3=function(_0x5c0159,_0x5537ee){_0x5c0159=_0x5c0159-0x0;var _0xb12904=_0xcf36[_0x5c0159];return _0xb12904;};'use strict';var util=require(_0x6cf3('0x0'));var _=require('lodash');var BPromise=require(_0x6cf3('0x1'));var uuid=require(_0x6cf3('0x2'));var moment=require('moment');var md5=require(_0x6cf3('0x3'));var Redis=require(_0x6cf3('0x4'));var config=require(_0x6cf3('0x5'));var logger=require('../../../config/logger')(_0x6cf3('0x6'));var loggerAction=require(_0x6cf3('0x7'))(_0x6cf3('0x8'));var ami=require(_0x6cf3('0x9'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require('./util/util');config[_0x6cf3('0xa')]=_[_0x6cf3('0xb')](config['redis'],{'host':_0x6cf3('0xc'),'port':0x18eb});var io=require(_0x6cf3('0xd'))(new Redis(config[_0x6cf3('0xa')]));var Sequence=function(){};Sequence[_0x6cf3('0xe')]['enqueue']=function(_0x45b288){this[_0x6cf3('0xf')]=this[_0x6cf3('0xf')]?this[_0x6cf3('0xf')][_0x6cf3('0x10')](_0x45b288):_0x45b288();};function Preview(_0x19d337){this[_0x6cf3('0x11')]=new Sequence();this[_0x6cf3('0x12')]=_0x19d337[_0x6cf3('0x13')];this[_0x6cf3('0x14')]=_0x19d337[_0x6cf3('0x14')];this['actions']={};this[_0x6cf3('0x15')]=_0x19d337[_0x6cf3('0x15')];this[_0x6cf3('0x16')]=0x0;ami['on'](_0x6cf3('0x17'),this[_0x6cf3('0x18')][_0x6cf3('0x19')](this));ami['on']('hangup',this['syncHangup'][_0x6cf3('0x19')](this));ami['on'](_0x6cf3('0x1a'),this['syncHangupRequest'][_0x6cf3('0x19')](this));ami['on'](_0x6cf3('0x1b'),this[_0x6cf3('0x1c')][_0x6cf3('0x19')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x6cf3('0x1d'),this[_0x6cf3('0x1e')][_0x6cf3('0x19')](this));ami['on'](_0x6cf3('0x1f'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0x6cf3('0x20')](this[_0x6cf3('0x12')]);}function emit(_0x237b58,_0xcf0d09,_0x1d469e){io['to'](_0x237b58)[_0x6cf3('0x21')](_0xcf0d09,_0x1d469e);}function emitCampaignPreview(_0xc2a096){if(_0xc2a096[_0x6cf3('0x22')]==='outbound'){var _0x2ef132={'id':_0xc2a096['id'],'name':_0xc2a096[_0x6cf3('0x23')],'strategy':_0xc2a096[_0x6cf3('0x24')],'answered':_0xc2a096[_0x6cf3('0x25')],'available':_0xc2a096[_0x6cf3('0x26')],'loggedIn':_0xc2a096['loggedIn'],'pTalking':_0xc2a096['pTalking'],'sumBillable':_0xc2a096[_0x6cf3('0x27')],'sumDuration':_0xc2a096['sumDuration'],'sumHoldTime':_0xc2a096[_0x6cf3('0x28')]||0x0,'talking':_0xc2a096[_0x6cf3('0x29')],'total':_0xc2a096[_0x6cf3('0x2a')],'type':_0xc2a096[_0x6cf3('0x22')],'unmanaged':_0xc2a096['unmanaged'],'abandoned':_0xc2a096[_0x6cf3('0x2b')],'waiting':_0xc2a096['waiting'],'loggedInDb':_0xc2a096[_0x6cf3('0x2c')],'dialActive':_0xc2a096[_0x6cf3('0x2d')],'dialMethod':_0xc2a096[_0x6cf3('0x2e')],'dialOriginateCallerIdName':_0xc2a096['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xc2a096[_0x6cf3('0x2f')],'dialOriginateTimeout':_0xc2a096['dialOriginateTimeout'],'dialPrefix':_0xc2a096[_0x6cf3('0x30')],'outboundAnswerAgiCallsDay':_0xc2a096[_0x6cf3('0x31')],'outboundAnswerCallsDay':_0xc2a096[_0x6cf3('0x32')],'outboundBlacklistCallsDay':_0xc2a096[_0x6cf3('0x33')],'outboundBusyCallsDay':_0xc2a096[_0x6cf3('0x34')],'outboundCongestionCallsDay':_0xc2a096[_0x6cf3('0x35')],'outboundDropCallsDayACS':_0xc2a096[_0x6cf3('0x36')],'outboundDropCallsDayCallersExit':_0xc2a096['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xc2a096['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0xc2a096[_0x6cf3('0x37')],'outboundNoSuchCallsDay':_0xc2a096['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0xc2a096['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xc2a096[_0x6cf3('0x38')],'outboundRejectCallsDay':_0xc2a096[_0x6cf3('0x39')],'outboundUnknownCallsDay':_0xc2a096['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0xc2a096[_0x6cf3('0x3a')],'predictiveIntervalAnsweredCalls':_0xc2a096[_0x6cf3('0x3b')],'predictiveIntervalAvgHoldtime':_0xc2a096[_0x6cf3('0x3c')],'predictiveIntervalAvgTalktime':_0xc2a096[_0x6cf3('0x3d')],'predictiveIntervalDroppedCallsCallersExit':_0xc2a096[_0x6cf3('0x3e')],'predictiveIntervalDroppedCallsTimeout':_0xc2a096[_0x6cf3('0x3f')],'predictiveIntervalErlangCalls':_0xc2a096[_0x6cf3('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0xc2a096['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xc2a096[_0x6cf3('0x41')],'predictiveIntervalMultiplicativeFactor':_0xc2a096[_0x6cf3('0x42')],'predictiveIntervalPauses':_0xc2a096['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xc2a096[_0x6cf3('0x43')],'predictiveIntervalTotalCalls':_0xc2a096[_0x6cf3('0x44')],'message':_0xc2a096[_0x6cf3('0x45')],'originated':_0xc2a096[_0x6cf3('0x46')],'erlangCalls':_0xc2a096[_0x6cf3('0x47')],'erlangCallToSecond':_0xc2a096['erlangCallToSecond'],'erlangAbandonmentRate':_0xc2a096['erlangAbandonmentRate'],'erlangBusyFactor':_0xc2a096[_0x6cf3('0x48')],'startPredictive':_0xc2a096[_0x6cf3('0x49')],'startProgressive':_0xc2a096[_0x6cf3('0x4a')]};if(_0xc2a096[_0x6cf3('0x4b')]){_0x2ef132[_0x6cf3('0x4b')]={'id':_0xc2a096[_0x6cf3('0x4b')]['id'],'name':_0xc2a096[_0x6cf3('0x4b')][_0x6cf3('0x23')],'active':_0xc2a096[_0x6cf3('0x4b')][_0x6cf3('0x4c')],'callerid':_0xc2a096['Trunk'][_0x6cf3('0x4d')]};}if(_0xc2a096[_0x6cf3('0x4e')]){_0x2ef132[_0x6cf3('0x4e')]={'id':_0xc2a096[_0x6cf3('0x4e')]['id'],'name':_0xc2a096[_0x6cf3('0x4e')]['name']};}var _0x74bbd8=md5(JSON[_0x6cf3('0x4f')](_0x2ef132));if(_0xc2a096[_0x6cf3('0x3')]!==_0x74bbd8){_0xc2a096[_0x6cf3('0x3')]=_0x74bbd8;emit(util['format'](_0x6cf3('0x50'),_0x2ef132[_0x6cf3('0x23')]),_0x6cf3('0x51'),_0x2ef132);}}}function emitVoiceQueueChannelRemove(_0x2523ec){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x6cf3('0x4f')](_0x2523ec));emit(util[_0x6cf3('0x52')]('voice:queue:%s',_0x2523ec[_0x6cf3('0x23')]),_0x6cf3('0x53'),_0x2523ec);io[_0x6cf3('0x21')]('voice_queue_presence:remove',_0x2523ec);}function notSendMessagesQueue(_0x1f29d4){if(_0x1f29d4[_0x6cf3('0x54')]){if(_0x1f29d4[_0x6cf3('0x46')]===0x0&&_0x1f29d4[_0x6cf3('0x55')]===0x0){_0x1f29d4[_0x6cf3('0x54')]=![];_0x1f29d4[_0x6cf3('0x26')]=0x0;_0x1f29d4[_0x6cf3('0x56')]=0x0;_0x1f29d4['message']=_0x6cf3('0x57');ut[_0x6cf3('0x58')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1f29d4[_0x6cf3('0x23')]+'\x20is\x20not\x20active');}else{_0x1f29d4['message']=_0x6cf3('0x59');ut[_0x6cf3('0x58')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1f29d4[_0x6cf3('0x23')]+'\x20is\x20disactive');}emitCampaignPreview(_0x1f29d4);}}Preview[_0x6cf3('0xe')][_0x6cf3('0x20')]=function(){var _0x3529b9=this;setInterval(function(){_0x3529b9[_0x6cf3('0x5a')]();},0x7cf);};Preview['prototype'][_0x6cf3('0x5a')]=function(){var _0x5b9437=this[_0x6cf3('0x12')];this[_0x6cf3('0x16')]+=0x1;for(var _0xabe57c in _0x5b9437){if(_0x5b9437[_0x6cf3('0x5b')](_0xabe57c)&&(_0x5b9437[_0xabe57c][_0x6cf3('0x2e')]===_0x6cf3('0x6')||_0x5b9437[_0xabe57c][_0x6cf3('0x2e')]==='booked')&&_0x5b9437[_0xabe57c]['type']===_0x6cf3('0x5c')){if(this[_0x6cf3('0x16')]>0x7){this[_0x6cf3('0x16')]=0x0;this[_0x6cf3('0x5d')]();}}if(_0x5b9437['hasOwnProperty'](_0xabe57c)&&_0x5b9437[_0xabe57c][_0x6cf3('0x2e')]===_0x6cf3('0x6')&&_0x5b9437[_0xabe57c]['type']===_0x6cf3('0x5c')){if(_0x5b9437[_0xabe57c][_0x6cf3('0x2d')]){this['setMessage'](_0x5b9437[_0xabe57c]);this[_0x6cf3('0x5e')](_0x5b9437[_0xabe57c]);}else{notSendMessagesQueue(_0x5b9437[_0xabe57c]);}}}};Preview['prototype'][_0x6cf3('0x5f')]=function(_0x41968c){var _0x5604b0=this;this[_0x6cf3('0x11')][_0x6cf3('0x60')](function(){if(!_[_0x6cf3('0x61')](_0x5604b0['actions'][_0x41968c])){loggerAction[_0x6cf3('0x62')]('[clearZombieChannels][talking]',_0x41968c,_0x6cf3('0x63'),_0x5604b0[_0x6cf3('0x64')][_0x41968c][_0x6cf3('0x65')],_0x6cf3('0x66'),JSON[_0x6cf3('0x4f')](_0x5604b0['campaignsPreview'][_0x5604b0[_0x6cf3('0x64')][_0x41968c]['queue']][_0x6cf3('0x46')]),'pTalking:\x20',JSON[_0x6cf3('0x4f')](_0x5604b0[_0x6cf3('0x12')][_0x5604b0['actions'][_0x41968c][_0x6cf3('0x65')]][_0x6cf3('0x55')]),JSON[_0x6cf3('0x4f')](_0x5604b0['actions'][_0x41968c][_0x6cf3('0x67')]),JSON[_0x6cf3('0x4f')](_['pick'](_0x5604b0[_0x6cf3('0x64')][_0x41968c],[_0x6cf3('0x68'),_0x6cf3('0x69'),_0x6cf3('0x6a'),_0x6cf3('0x6b')])));return ami[_0x6cf3('0x6c')]({'action':_0x6cf3('0x6d'),'channel':_0x5604b0[_0x6cf3('0x64')][_0x41968c][_0x6cf3('0x6e')]})[_0x6cf3('0x6f')](function(_0x8ac25f){if(_0x8ac25f[_0x6cf3('0x45')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5604b0[_0x6cf3('0x64')][_0x41968c]){ut[_0x6cf3('0x70')](_0x5604b0[_0x6cf3('0x12')][_0x5604b0[_0x6cf3('0x64')][_0x41968c][_0x6cf3('0x65')]],_0x6cf3('0x71'));if(_0x5604b0['actions'][_0x41968c][_0x6cf3('0x67')]===!![]){ut['decrementTalkink'](_0x5604b0[_0x6cf3('0x12')][_0x5604b0[_0x6cf3('0x64')][_0x41968c][_0x6cf3('0x65')]],_0x6cf3('0x71'));ut[_0x6cf3('0x72')]('[Dialer][checkChannel][pTalking][Preview]'+_0x41968c,_0x5604b0[_0x6cf3('0x64')][_0x41968c][_0x6cf3('0x65')]);}ut[_0x6cf3('0x72')]('[Dialer][checkChannel][Preview]'+_0x41968c,_0x5604b0[_0x6cf3('0x64')][_0x41968c][_0x6cf3('0x65')]);delete _0x5604b0[_0x6cf3('0x64')][_0x41968c];}},0x2328);}});}});};Preview[_0x6cf3('0xe')][_0x6cf3('0x5d')]=function(){var _0x16360f=this;loggerAction[_0x6cf3('0x62')](_0x6cf3('0x73'),_[_0x6cf3('0x74')](this['actions']));for(var _0x143fed in this[_0x6cf3('0x64')]){if(_0x16360f[_0x6cf3('0x64')][_0x6cf3('0x5b')](_0x143fed)){_0x16360f[_0x6cf3('0x5f')](_0x143fed);}}};Preview['prototype'][_0x6cf3('0x5e')]=function(_0x28501c){var _0x46c8c6=this;rpcDb[_0x6cf3('0x75')](_0x28501c['id'],ut['agentReadyId'](this['agents']))[_0x6cf3('0x76')](function(_0x438c37){if(!_[_0x6cf3('0x61')](_0x438c37)){for(var _0x350422=0x0;_0x350422<_0x438c37[_0x6cf3('0x77')];_0x350422+=0x1){if(ut[_0x6cf3('0x78')](_0x438c37[_0x350422][_0x6cf3('0x79')])<_0x28501c[_0x6cf3('0x7a')]*0x3c){if(_0x438c37[_0x350422][_0x6cf3('0x7b')]&&!_0x438c37[_0x350422]['Agent'][_0x6cf3('0x7c')]){_0x46c8c6[_0x6cf3('0x7d')](_0x438c37[_0x350422]['id'])[_0x6cf3('0x76')](ut[_0x6cf3('0x7e')](_0x6cf3('0x7f')))[_0x6cf3('0x6f')](ut[_0x6cf3('0x7e')](_0x6cf3('0x7f')));}else{rpcDb[_0x6cf3('0x80')](_0x438c37[_0x350422]['id']);}}else{var _0x4989ca=new Action(_0x438c37[_0x350422],_0x28501c);_0x4989ca[_0x6cf3('0x81')]=moment()[_0x6cf3('0x52')](_0x6cf3('0x82'));_0x28501c[_0x6cf3('0x38')]+=0x1;ut[_0x6cf3('0x83')](_0x4989ca,0x17,'RecallInQueue');if(_0x28501c['dialRecallInQueue']){rpcDb[_0x6cf3('0x84')](ut['createBody'](_0x438c37[_0x350422]));rpcDb[_0x6cf3('0x85')](_0x4989ca,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6cf3('0x83')](_0x4989ca,0x16,_0x6cf3('0x86'));rpcDb['createCustomerHistory'](_0x4989ca,_0x6cf3('0x87'));rpcDb[_0x6cf3('0x88')](_0x4989ca,'[HistoryRecallClose]');}}}}})['catch'](ut[_0x6cf3('0x7e')](_0x6cf3('0x89')));};Preview['prototype']['setMessage']=function(_0x3f3ee3){_0x3f3ee3[_0x6cf3('0x54')]=!![];if(ut[_0x6cf3('0x8a')](_0x3f3ee3[_0x6cf3('0x8b')])){_0x3f3ee3[_0x6cf3('0x45')]=_0x6cf3('0x8c');}else if(!ut[_0x6cf3('0x8d')](_0x3f3ee3[_0x6cf3('0x2d')])){_0x3f3ee3[_0x6cf3('0x45')]=_0x6cf3('0x57');}else if(!this[_0x6cf3('0x8e')](_0x3f3ee3[_0x6cf3('0x4b')])){if(!this['isTrunkReachable'](_0x3f3ee3[_0x6cf3('0x8f')])){_0x3f3ee3[_0x6cf3('0x45')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3f3ee3[_0x6cf3('0x45')]=_0x6cf3('0x90');}}else{_0x3f3ee3[_0x6cf3('0x45')]=_0x6cf3('0x90');}emitCampaignPreview(_0x3f3ee3);};Preview[_0x6cf3('0xe')][_0x6cf3('0x91')]=function(_0xe7b168,_0x14d3fc,_0x205616){var _0xca2981=this;var _0x2e5c31=this[_0x6cf3('0x64')][_0x14d3fc];var _0x45cf48=this[_0x6cf3('0x12')][_0x2e5c31['queue']];var _0xa73a6b;var _0x5bd794=![];var _0x394857=0x2;var _0x577e23=0x3;if(_0x45cf48){switch(_0x205616){case'1':_0x45cf48[_0x6cf3('0x92')]+=0x1;_0x2e5c31[_0x6cf3('0x93')]+=0x1;_0x2e5c31[_0x6cf3('0x94')]=ut[_0x6cf3('0x95')](_0x2e5c31);ut[_0x6cf3('0x83')](_0x2e5c31,0x0,_0x6cf3('0x96'));ami['emit'](_0x6cf3('0x97'),ut[_0x6cf3('0x98')](_0x2e5c31,_0x6cf3('0x99')));rpcDb[_0x6cf3('0x85')](_0x2e5c31,_0x6cf3('0x9a'));_0xca2981['verifyAdditionalPhones'](_0x2e5c31,'0',_0x45cf48)[_0x6cf3('0x76')](function(_0x4fdd54){_0x5bd794=_0x4fdd54[_0x6cf3('0x9b')]==0x1;_0x394857=_0x45cf48['dialNoSuchNumberRetryFrequency'];_0x577e23=_0x45cf48['callAdditionalPhoneAfterMin'];if(!_0x5bd794){if(ut[_0x6cf3('0x95')](_0x2e5c31)>=_0x45cf48[_0x6cf3('0x9c')]){_0xa73a6b=ut[_0x6cf3('0x9d')](_0x2e5c31,0xf,_0x6cf3('0x9e'));rpcDb['createCustomerFinal'](_0xa73a6b,_0x6cf3('0x9f'));}else{if(_0x2e5c31[_0x6cf3('0x93')]>=_0x45cf48['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x2e5c31,_0x6cf3('0x9f'));}else{rpcDb[_0x6cf3('0xa0')](ut[_0x6cf3('0xa1')](_0x2e5c31,_0x6cf3('0x93'),_0x45cf48[_0x6cf3('0xa2')]),_0x2e5c31[_0x6cf3('0xa3')],_0x2e5c31[_0x6cf3('0xa4')]);}}delete this[_0x6cf3('0x64')][_0xe7b168[_0x6cf3('0xa5')]];}else{_0x2e5c31[_0x6cf3('0x93')]++;logger[_0x6cf3('0x62')](_0x6cf3('0xa6'),_0x2e5c31[_0x6cf3('0x93')]);logger['info']('id',_0x2e5c31[_0x6cf3('0xa7')]);_0xca2981['incrementPreviewCounters']({'id':_0x2e5c31[_0x6cf3('0xa7')],'field':{'countnosuchnumberretry':_0x2e5c31[_0x6cf3('0x93')]}})[_0x6cf3('0x76')](function(){_0xca2981[_0x6cf3('0xa8')](_0x2e5c31,_0x394857,_0x577e23)[_0x6cf3('0x76')](function(){});});}});break;case _0x6cf3('0xa9'):var _0x58aa87=moment()['format'](_0x6cf3('0x82'));_0x2e5c31[_0x6cf3('0xaa')]=_0x58aa87;_0x2e5c31[_0x6cf3('0xab')]=_0x58aa87;_0x2e5c31[_0x6cf3('0x67')]=!![];_0x45cf48[_0x6cf3('0x55')]+=0x1;logger[_0x6cf3('0x62')](_0x6cf3('0xac'),_0x2e5c31[_0x6cf3('0xad')],_0x6cf3('0xae'),_0x45cf48[_0x6cf3('0x23')],'pTalking:\x20',_0x45cf48[_0x6cf3('0x55')]);ami[_0x6cf3('0x21')](_0x6cf3('0xaf'),ut[_0x6cf3('0x98')](_0x2e5c31,_0x6cf3('0xb0'),this[_0x6cf3('0x12')][_0x2e5c31[_0x6cf3('0x65')]]));if(_0x45cf48[_0x6cf3('0xb1')]){ami[_0x6cf3('0x21')](_0x6cf3('0xb2'),ut[_0x6cf3('0xb3')](_0x2e5c31));}break;case'16':ami[_0x6cf3('0x21')](_0x6cf3('0xb4'),ut[_0x6cf3('0x98')](_0x2e5c31,'complete',this['campaignsPreview'][_0x2e5c31[_0x6cf3('0x65')]]));emitVoiceQueueChannelRemove(ut[_0x6cf3('0x98')](_0x2e5c31,_0x6cf3('0xb5')));_0x45cf48['outboundAnswerCallsDay']+=0x1;_0x45cf48[_0x6cf3('0x2a')]+=0x1;_0x45cf48[_0x6cf3('0x25')]+=0x1;ut['decrementTalkink'](_0x45cf48,_0x6cf3('0xb6'));_0x2e5c31[_0x6cf3('0x94')]=ut['totalGlobal'](_0x2e5c31);ut[_0x6cf3('0x83')](_0x2e5c31,0x4,_0x6cf3('0xb7'));rpcDb[_0x6cf3('0x85')](_0x2e5c31,_0x6cf3('0xb8'));rpcDb['createCustomerFinal'](_0x2e5c31,_0x6cf3('0xb9'));rpcDb[_0x6cf3('0xba')](_0x2e5c31);_0x45cf48['sumDuration']+=_0x2e5c31[_0x6cf3('0xbb')];_0x45cf48['sumBillable']+=_0x2e5c31[_0x6cf3('0xbb')];logger['info'](_0x6cf3('0xbc'),_0x2e5c31[_0x6cf3('0xad')],_0x6cf3('0xae'),_0x45cf48['name'],_0x6cf3('0xbd'),_0x45cf48['pTalking']);delete this['actions'][_0xe7b168[_0x6cf3('0xa5')]];break;case'BUSY':_0x45cf48[_0x6cf3('0x34')]+=0x1;_0x2e5c31[_0x6cf3('0xbe')]+=0x1;_0x2e5c31['countglobal']=ut[_0x6cf3('0x95')](_0x2e5c31);ut[_0x6cf3('0x83')](_0x2e5c31,0x5,_0x6cf3('0xbf'));_0x394857=_0x45cf48[_0x6cf3('0xc0')];_0x577e23=_0x45cf48[_0x6cf3('0xc1')];ami[_0x6cf3('0x21')]('custom:agentbusy',ut['buildObj'](_0x2e5c31,_0x6cf3('0xc2')));rpcDb[_0x6cf3('0x85')](_0x2e5c31,_0x6cf3('0xc3'));_0xca2981[_0x6cf3('0xc4')](_0x2e5c31,'5',_0x45cf48)[_0x6cf3('0x76')](function(_0xe75dc2){_0x5bd794=_0xe75dc2[_0x6cf3('0x9b')]==0x1;if(!_0x5bd794){if(ut[_0x6cf3('0x95')](_0x2e5c31)>=_0x45cf48[_0x6cf3('0x9c')]){_0xa73a6b=ut[_0x6cf3('0x9d')](_0x2e5c31,0xf,_0x6cf3('0x9e'));rpcDb[_0x6cf3('0x88')](_0xa73a6b,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2e5c31[_0x6cf3('0xbe')]>=_0x45cf48[_0x6cf3('0xc5')]){rpcDb[_0x6cf3('0x88')](_0x2e5c31,_0x6cf3('0xc3'));}else{rpcDb[_0x6cf3('0xa0')](ut[_0x6cf3('0xa1')](_0x2e5c31,'countbusyretry',_0x45cf48['dialBusyRetryFrequency']),_0x2e5c31['unlockAgent'],_0x2e5c31[_0x6cf3('0xa4')]);}}}else{_0x2e5c31[_0x6cf3('0xbe')]++;_0xca2981[_0x6cf3('0xc6')]({'id':_0x2e5c31['idContact'],'field':{'countbusyretry':_0x2e5c31[_0x6cf3('0xbe')]}})[_0x6cf3('0x76')](function(){_0xca2981[_0x6cf3('0xa8')](_0x2e5c31,_0x394857,_0x577e23)[_0x6cf3('0x76')](function(){});});}});break;case'NOANSWER':_0x45cf48['outboundNoAnswerCallsDay']+=0x1;_0x2e5c31['countnoanswerretry']+=0x1;_0x2e5c31[_0x6cf3('0x94')]=ut[_0x6cf3('0x95')](_0x2e5c31);ut[_0x6cf3('0x83')](_0x2e5c31,0x3,_0x6cf3('0xc7'));_0x394857=_0x45cf48[_0x6cf3('0xc8')];_0x577e23=_0x45cf48['callAdditionalPhoneAfterMin'];ami[_0x6cf3('0x21')](_0x6cf3('0xc9'),ut['buildObj'](_0x2e5c31,_0x6cf3('0xca')));rpcDb[_0x6cf3('0x85')](_0x2e5c31,'[callProgressDetectingCustomer][logNoAnswer]');_0xca2981[_0x6cf3('0xc4')](_0x2e5c31,'3',_0x45cf48)[_0x6cf3('0x76')](function(_0x23a694){_0x5bd794=_0x23a694['additional']==0x1;if(!_0x5bd794){if(ut[_0x6cf3('0x95')](_0x2e5c31)>=_0x45cf48[_0x6cf3('0x9c')]){_0xa73a6b=ut[_0x6cf3('0x9d')](_0x2e5c31,0xf,_0x6cf3('0x9e'));rpcDb[_0x6cf3('0x88')](_0xa73a6b,_0x6cf3('0xcb'));}else{if(_0x2e5c31[_0x6cf3('0xcc')]>=_0x45cf48[_0x6cf3('0xcd')]){rpcDb[_0x6cf3('0x88')](_0x2e5c31,_0x6cf3('0xce'));}else{rpcDb['rescheduleContact'](ut[_0x6cf3('0xa1')](_0x2e5c31,'countnoanswerretry',_0x45cf48[_0x6cf3('0xc8')]),_0x2e5c31[_0x6cf3('0xa3')],_0x2e5c31[_0x6cf3('0xa4')]);}}}else{_0x2e5c31[_0x6cf3('0xcc')]++;_0xca2981[_0x6cf3('0xc6')]({'id':_0x2e5c31[_0x6cf3('0xa7')],'field':{'countnoanswerretry':_0x2e5c31[_0x6cf3('0xcc')]}})[_0x6cf3('0x76')](function(){_0xca2981[_0x6cf3('0xa8')](_0x2e5c31,_0x394857,_0x577e23)[_0x6cf3('0x76')](function(){});});}});break;case _0x6cf3('0xcf'):_0x45cf48['outboundCongestionCallsDay']+=0x1;_0x2e5c31['countcongestionretry']+=0x1;_0x2e5c31[_0x6cf3('0x94')]=ut[_0x6cf3('0x95')](_0x2e5c31);ut[_0x6cf3('0x83')](_0x2e5c31,0x8,'Congestion');_0x394857=_0x45cf48[_0x6cf3('0xd0')];_0x577e23=_0x45cf48[_0x6cf3('0xc1')];ami[_0x6cf3('0x21')](_0x6cf3('0xd1'),ut[_0x6cf3('0x98')](_0x2e5c31,_0x6cf3('0xd2')));rpcDb[_0x6cf3('0x85')](_0x2e5c31,'[callProgressDetectingCustomer][logCongestion]');_0xca2981['verifyAdditionalPhones'](_0x2e5c31,'8',_0x45cf48)[_0x6cf3('0x76')](function(_0x2ea328){_0x5bd794=_0x2ea328[_0x6cf3('0x9b')]==0x1;if(!_0x5bd794){if(ut[_0x6cf3('0x95')](_0x2e5c31)>=_0x45cf48[_0x6cf3('0x9c')]){_0xa73a6b=ut[_0x6cf3('0x9d')](_0x2e5c31,0xf,_0x6cf3('0x9e'));rpcDb[_0x6cf3('0x88')](_0xa73a6b,_0x6cf3('0xd3'));}else{if(_0x2e5c31[_0x6cf3('0xd4')]>=_0x45cf48['dialCongestionMaxRetry']){rpcDb[_0x6cf3('0x88')](_0x2e5c31,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x6cf3('0xa0')](ut[_0x6cf3('0xa1')](_0x2e5c31,'countcongestionretry',_0x45cf48[_0x6cf3('0xc0')]),_0x2e5c31[_0x6cf3('0xa3')],_0x2e5c31[_0x6cf3('0xa4')]);}}}else{_0x2e5c31[_0x6cf3('0xd4')]++;_0xca2981[_0x6cf3('0xc6')]({'id':_0x2e5c31[_0x6cf3('0xa7')],'field':{'countcongestionretry':_0x2e5c31[_0x6cf3('0xd4')]}})[_0x6cf3('0x76')](function(){_0xca2981[_0x6cf3('0xa8')](_0x2e5c31,_0x394857,_0x577e23)[_0x6cf3('0x76')](function(){});});}});break;case _0x6cf3('0xd5'):_0x45cf48['outboundRejectCallsDay']+=0x1;_0x2e5c31[_0x6cf3('0xd6')]+=0x1;_0x2e5c31[_0x6cf3('0x94')]=ut[_0x6cf3('0x95')](_0x2e5c31);ut[_0x6cf3('0x83')](_0x2e5c31,0x14,_0x6cf3('0xd7'));_0x394857=_0x45cf48[_0x6cf3('0xd8')];_0x577e23=_0x45cf48[_0x6cf3('0xc1')];ami['emit'](_0x6cf3('0xd9'),ut[_0x6cf3('0x98')](_0x2e5c31,_0x6cf3('0xda')));rpcDb[_0x6cf3('0x85')](_0x2e5c31,'[syncHangupRequest][logAgentReject]');_0xca2981[_0x6cf3('0xc4')](_0x2e5c31,'20',_0x45cf48)[_0x6cf3('0x76')](function(_0x41021a){_0x5bd794=_0x41021a[_0x6cf3('0x9b')]==0x1;if(!_0x5bd794){if(ut[_0x6cf3('0x95')](_0x2e5c31)>=_0x45cf48[_0x6cf3('0x9c')]){_0xa73a6b=ut[_0x6cf3('0x9d')](_0x2e5c31,0x14,_0x6cf3('0xd7'));rpcDb[_0x6cf3('0x88')](_0xa73a6b,_0x6cf3('0xdb'));}else{if(_0x2e5c31[_0x6cf3('0xd6')]>=_0x45cf48[_0x6cf3('0xdc')]){rpcDb[_0x6cf3('0x88')](_0x2e5c31,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x6cf3('0xa1')](_0x2e5c31,_0x6cf3('0xd6'),_0x45cf48['dialAgentRejectRetryFrequency']),_0x2e5c31[_0x6cf3('0xa3')],_0x2e5c31[_0x6cf3('0xa4')]);}}}else{_0x2e5c31['countnoanswerretry']++;_0xca2981[_0x6cf3('0xc6')]({'id':_0x2e5c31['idContact'],'field':{'countnoanswerretry':_0x2e5c31[_0x6cf3('0xcc')]}})[_0x6cf3('0x76')](function(){_0xca2981[_0x6cf3('0xa8')](_0x2e5c31,_0x394857,_0x577e23)[_0x6cf3('0x76')](function(){});});}});break;case _0x6cf3('0xdd'):_0x45cf48[_0x6cf3('0x3a')]+=0x1;_0x2e5c31[_0x6cf3('0xde')]+=0x1;_0x2e5c31['countglobal']=ut[_0x6cf3('0x95')](_0x2e5c31);ut[_0x6cf3('0x83')](_0x2e5c31,0xb,_0x6cf3('0xdf'));rpcDb[_0x6cf3('0x85')](_0x2e5c31,_0x6cf3('0xe0'));if(ut[_0x6cf3('0x95')](_0x2e5c31)>=_0x45cf48[_0x6cf3('0x9c')]){_0xa73a6b=ut[_0x6cf3('0x9d')](_0x2e5c31,0xf,_0x6cf3('0x9e'));rpcDb[_0x6cf3('0x88')](_0xa73a6b,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2e5c31['countabandonedetry']>=_0x45cf48[_0x6cf3('0xe1')]){rpcDb['createCustomerFinal'](_0x2e5c31,_0x6cf3('0xe0'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2e5c31,'countabandonedretry',_0x45cf48[_0x6cf3('0xe2')]),_0x2e5c31['unlockAgent'],_0x2e5c31[_0x6cf3('0xa4')]);}}break;default:if(_0x2e5c31[_0x6cf3('0x67')]){ut[_0x6cf3('0xe3')](_0x45cf48,_0x6cf3('0xe4'));ut['loggerError'](_0x6cf3('0xe5')+_0x45cf48[_0x6cf3('0x23')],_0xe7b168);}_0x45cf48[_0x6cf3('0xe6')]+=0x1;_0x2e5c31[_0x6cf3('0x94')]=ut[_0x6cf3('0x95')](_0x2e5c31);ut[_0x6cf3('0x83')](_0x2e5c31,0xc,_0xe7b168['cause-txt']||_0xe7b168[_0x6cf3('0xe7')]);_0x394857=_0x45cf48[_0x6cf3('0xd8')];_0x577e23=_0x45cf48['callAdditionalPhoneAfterMin'];rpcDb[_0x6cf3('0x85')](_0x2e5c31,_0x6cf3('0xe8'));_0xca2981['verifyAdditionalPhones'](_0x2e5c31,'20',_0x45cf48)['then'](function(_0x5ead25){_0x5bd794=_0x5ead25[_0x6cf3('0x9b')]==0x1;if(!_0x5bd794){if(ut[_0x6cf3('0x95')](_0x2e5c31)>=_0x45cf48['dialGlobalMaxRetry']){_0xa73a6b=ut[_0x6cf3('0x9d')](_0x2e5c31,0xf,_0x6cf3('0x9e'));rpcDb[_0x6cf3('0x88')](_0xa73a6b,_0x6cf3('0xe9'));}else{rpcDb[_0x6cf3('0x88')](_0x2e5c31,_0x6cf3('0xe9'));}delete this[_0x6cf3('0x64')][_0xe7b168['linkedid']];}else{_0xca2981[_0x6cf3('0xa8')](_0x2e5c31,_0x394857,_0x577e23)[_0x6cf3('0x76')](function(_0x339e9a){});}});}if(!(_0x2e5c31['dialAnswer']&&_0x205616==='16')){ut['updateOriginated'](_0x45cf48,_0x6cf3('0xea'));logger[_0x6cf3('0x62')]('[originated][decrement][callProgressDetectingCustomer]',_0x2e5c31[_0x6cf3('0xad')],_0x6cf3('0xae'),_0x45cf48[_0x6cf3('0x23')],'originated:\x20',_0x45cf48[_0x6cf3('0x46')]);}if(_0x205616!==_0x6cf3('0xa9')){delete this[_0x6cf3('0x64')][_0xe7b168[_0x6cf3('0xa5')]];delete this[_0x6cf3('0x64')][_0xe7b168['destlinkedid']];}}};Preview[_0x6cf3('0xe')][_0x6cf3('0xeb')]=function(_0x1600a1,_0x454341,_0x38716c){if(_[_0x6cf3('0xec')](_0x454341)&&_0x6cf3('0xed')!==typeof _0x454341){return;}if(_[_0x6cf3('0xec')](_0x38716c)&&_0x6cf3('0xed')!==typeof _0x38716c){return;}switch(_0x38716c[_0x6cf3('0xee')]){case'0':ut[_0x6cf3('0xef')](_0x1600a1,0x0,_0x6cf3('0x96'));rpcDb[_0x6cf3('0xf0')](_0x1600a1,_0x6cf3('0xf1'));break;case'3':ut['logAgent'](_0x1600a1,0x3,'NoAnswer');rpcDb[_0x6cf3('0xf0')](_0x1600a1,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x6cf3('0xef')](_0x1600a1,0x5,_0x6cf3('0xbf'));rpcDb[_0x6cf3('0xf0')](_0x1600a1,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x6cf3('0xef')](_0x1600a1,0x8,'Congestion');rpcDb[_0x6cf3('0xf0')](_0x1600a1,_0x6cf3('0xf2'));break;case'22':ut['logAgent'](_0x1600a1,0x16,'AnswerAGI');rpcDb[_0x6cf3('0xf0')](_0x1600a1,_0x6cf3('0xf3'));break;default:ut[_0x6cf3('0xef')](_0x1600a1,0xc,_0x38716c['reason']);rpcDb['createAgentHistory'](_0x1600a1,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x454341,_0x6cf3('0xf4'));logger['info'](_0x6cf3('0xf5'),_0x1600a1[_0x6cf3('0xad')],_0x6cf3('0xae'),_0x454341[_0x6cf3('0x23')],_0x6cf3('0x66'),_0x454341[_0x6cf3('0x46')]);delete this[_0x6cf3('0x64')][_0x1600a1[_0x6cf3('0xad')]];};Preview['prototype'][_0x6cf3('0xc4')]=function(_0x23f435,_0x5afb2b,_0x24c092){return BPromise[_0x6cf3('0xf6')]()[_0x6cf3('0x76')](cmHopperAdditionalPhone[_0x6cf3('0xc4')](_0x23f435,_0x5afb2b,_0x24c092))['catch'](logger[_0x6cf3('0x62')](_0x6cf3('0xf7')));};Preview['prototype']['swapAdditionalPhones']=function(_0x1245d3,_0x229759,_0x2c12b4){return BPromise[_0x6cf3('0xf6')]()[_0x6cf3('0x76')](cmHopperAdditionalPhone[_0x6cf3('0xa8')](_0x1245d3,_0x229759,_0x2c12b4))[_0x6cf3('0x6f')](logger[_0x6cf3('0x62')](_0x6cf3('0xf8')));};Preview[_0x6cf3('0xe')][_0x6cf3('0xc6')]=function(_0x448cba){return BPromise[_0x6cf3('0xf6')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x448cba))[_0x6cf3('0x6f')](logger[_0x6cf3('0x62')](_0x6cf3('0xf9')));};Preview[_0x6cf3('0xe')][_0x6cf3('0xfa')]=function(_0x1517d9,_0x48eef3,_0x761b84,_0x2bc46f,_0x25a2ba){var _0x24d0c7=this;return new BPromise(function(_0x9e77de,_0x1fbd69){if(_[_0x6cf3('0x61')](_0x48eef3)||_[_0x6cf3('0x61')](_0x48eef3[_0x6cf3('0xfb')])||_[_0x6cf3('0x61')](_0x48eef3[_0x6cf3('0xfc')])||_[_0x6cf3('0x61')](_0x48eef3[_0x6cf3('0x6a')])){_0x1fbd69(ut['message'](_0x6cf3('0xfd'),_0x2bc46f,_0x25a2ba));return;}var _0x5f2e49=uuid['v4']();var _0x2997ea=_0x24d0c7[_0x6cf3('0x12')][_0x48eef3[_0x6cf3('0x63')]['name']];var _0x2c8edc=_0x761b84?_0x24d0c7['agents'][_0x761b84]['id']:undefined;_0x24d0c7[_0x6cf3('0x64')][_0x5f2e49]=new Action(_0x48eef3,_0x2997ea,_0x5f2e49,_0x761b84,_0x2c8edc);var _0x2945df=_0x24d0c7['actions'][_0x5f2e49];_0x2945df[_0x6cf3('0xa3')]=_0x2bc46f;_0x2945df['activeContact']=_0x25a2ba;_0x2945df['lookAgent']=_0x761b84;if(_['isEmpty'](_0x1517d9)){_0x24d0c7[_0x6cf3('0xfe')](_0x2945df,_0x2997ea,_0x48eef3,_0x761b84)[_0x6cf3('0x76')](function(_0x2b92c9){logger[_0x6cf3('0x62')](_0x6cf3('0xff'),_0x6cf3('0x100')+_0x2945df[_0x6cf3('0x65')]+_0x6cf3('0x101')+_0x2945df[_0x6cf3('0xa7')],JSON[_0x6cf3('0x4f')](_0x2b92c9));ami[_0x6cf3('0x21')](_0x6cf3('0x102'),ut[_0x6cf3('0x98')](_0x2945df,_0x6cf3('0x103'),_0x24d0c7[_0x6cf3('0x12')][_0x2945df[_0x6cf3('0x65')]]));_0x9e77de(ut[_0x6cf3('0x45')](_0x6cf3('0x104')));})['catch'](function(_0x5dbe70){ut[_0x6cf3('0x58')]('[Preview][execCall][failure]',_0x5dbe70);_0x1fbd69(ut[_0x6cf3('0x45')](_0x6cf3('0x105'),_0x2bc46f,_0x25a2ba));});}else{_0x2997ea['outboundBlacklistCallsDay']+=0x1;ut[_0x6cf3('0x106')](_0x2945df);rpcDb[_0x6cf3('0x107')](_0x2945df,_0x6cf3('0x108'));delete _0x24d0c7[_0x6cf3('0x64')][_0x5f2e49];_0x1fbd69(ut['message'](_0x6cf3('0x109'),_0x2bc46f,_0x25a2ba));}});};Preview[_0x6cf3('0xe')]['isTrunkReachable']=function(_0x2e5a32){return!_[_0x6cf3('0x61')](_0x2e5a32)&&!_[_0x6cf3('0x61')](_0x2e5a32[_0x6cf3('0x23')])&&!_['isNil'](_0x2e5a32['active'])&&_0x2e5a32[_0x6cf3('0x4c')]&&!_[_0x6cf3('0x61')](this[_0x6cf3('0x14')][util[_0x6cf3('0x52')](_0x6cf3('0x10a'),_0x2e5a32[_0x6cf3('0x23')])])&&!_[_0x6cf3('0x61')](this['trunks'][util[_0x6cf3('0x52')]('SIP/%s',_0x2e5a32[_0x6cf3('0x23')])][_0x6cf3('0x6d')])&&(this[_0x6cf3('0x14')][util['format'](_0x6cf3('0x10a'),_0x2e5a32[_0x6cf3('0x23')])]['status']===_0x6cf3('0x10b')||this[_0x6cf3('0x14')][util[_0x6cf3('0x52')]('SIP/%s',_0x2e5a32['name'])][_0x6cf3('0x6d')]==='unmonitored');};Preview['prototype'][_0x6cf3('0x7d')]=function(_0x2da529,_0x4969f2){var _0x49de83=this;return new BPromise(function(_0x4fd868,_0x4d98e4){_0x49de83[_0x6cf3('0x10c')](_0x2da529,_0x4969f2)['then'](function(_0x2a5016){_0x4fd868(_[_0x6cf3('0x10d')](_0x2a5016,[_0x6cf3('0x45')]));})['catch'](function(_0x121908){if(_0x121908[_0x6cf3('0x10e')]){rpcDb[_0x6cf3('0x10f')](_0x2da529);}if(_0x121908['active']){rpcDb[_0x6cf3('0x80')](_0x2da529);}_0x4d98e4(_[_0x6cf3('0x10d')](_0x121908,[_0x6cf3('0x45')]));});});};Preview[_0x6cf3('0xe')][_0x6cf3('0x10c')]=function(_0x10cad4,_0x3cb06b){var _0xcf8d48=this;return new BPromise(function(_0x44fa53,_0x2f9273){var _0x49558d,_0x4f3ca9;rpcDb[_0x6cf3('0x110')](_0x10cad4)[_0x6cf3('0x76')](function(_0x1d2b5f){if(!_[_0x6cf3('0x61')](_0x1d2b5f[0x0])){_0x4f3ca9=_0x1d2b5f[0x0]['recallme']?![]:!![];_0x49558d=_0x1d2b5f[0x0][_0x6cf3('0x111')]?!![]:![];_0x49558d=_0x3cb06b?!![]:_0x49558d;}var _0x10326e=_0xcf8d48[_0x6cf3('0x112')](_0x1d2b5f);if(_0x10326e[_0x6cf3('0x113')]){rpcDb[_0x6cf3('0x114')](_[_0x6cf3('0x10d')](_0x1d2b5f[0x0],[_0x6cf3('0x6a'),_0x6cf3('0xfc')]))[_0x6cf3('0x76')](function(_0xf3c345){_0xcf8d48[_0x6cf3('0xfa')](_0xf3c345,_0x1d2b5f[0x0],_0x3cb06b,_0x4f3ca9,_0x49558d)[_0x6cf3('0x76')](function(_0x296c65){_0x44fa53(_0x296c65);})[_0x6cf3('0x6f')](function(_0x497a9d){_0x2f9273(_0x497a9d);});})[_0x6cf3('0x6f')](function(_0x3eb2ae){ut[_0x6cf3('0x58')](_0x6cf3('0x115'),_0x3eb2ae);_0x2f9273(ut[_0x6cf3('0x45')](_0x6cf3('0x116'),_0x4f3ca9,_0x49558d));});}else{_0x2f9273(ut['message'](_0x10326e[_0x6cf3('0x45')],_0x4f3ca9,_0x49558d));}})[_0x6cf3('0x6f')](function(_0x2fab07){ut[_0x6cf3('0x58')](_0x6cf3('0x117'),_0x2fab07);_0x2f9273(ut['message'](_0x6cf3('0x116'),![],!![]));});});};Preview[_0x6cf3('0xe')][_0x6cf3('0x112')]=function(_0x27a6d9){if(_[_0x6cf3('0x61')](_0x27a6d9)||_[_0x6cf3('0x118')](_0x27a6d9)||!_['isNil'](_0x27a6d9[0x0][_0x6cf3('0x7b')])&&_[_0x6cf3('0x61')](_0x27a6d9[0x0][_0x6cf3('0x7b')]['name'])){ut[_0x6cf3('0x58')]('[Preview][validateContact][Empty\x20Contact]',_0x27a6d9);return{'isValid':![],'message':_0x6cf3('0x119')};}var _0x58a592=this[_0x6cf3('0x12')][_0x27a6d9[0x0]['Queue'][_0x6cf3('0x23')]];_0x58a592[_0x6cf3('0x45')]=_0x6cf3('0x90');if(_[_0x6cf3('0x61')](_0x58a592)){ut['logger'](_0x6cf3('0x11a'),_0x58a592);return{'isValid':![],'message':_0x6cf3('0x11b')};}if(!this[_0x6cf3('0x8e')](_0x58a592[_0x6cf3('0x4b')])){ut['logger'](_0x6cf3('0x11c'),'campaign\x20Name:\x20'+_0x58a592['name']+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x58a592['TrunkBackup'])){ut[_0x6cf3('0x58')](_0x6cf3('0x11c'),_0x58a592['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x6cf3('0x11d')};}}if(!ut[_0x6cf3('0x8d')](_0x58a592[_0x6cf3('0x2d')])){ut['logger'](_0x6cf3('0x11e'),_0x58a592[_0x6cf3('0x23')]+_0x6cf3('0x11f'));return{'isValid':![],'message':_0x6cf3('0x120')+_0x58a592[_0x6cf3('0x23')]+_0x6cf3('0x11f')};}return{'isValid':!![],'message':_0x6cf3('0x121')};};Preview[_0x6cf3('0xe')][_0x6cf3('0xfe')]=function(_0x371403,_0x5afccd,_0x5790cd,_0xefaab9){var _0x5b3543=this;return new BPromise(function(_0x28688d,_0x126463){var _0x3b195a=_0x371403['uniqueid'];var _0x2374d7=_0x5b3543[_0x6cf3('0x8e')](_0x5afccd['Trunk'])?util[_0x6cf3('0x52')](_0x6cf3('0x122'),_0x5afccd['Trunk'][_0x6cf3('0x23')],_[_0x6cf3('0x61')](_0x5afccd['dialPrefix'])?'':_0x5afccd[_0x6cf3('0x30')]['trim']()||'',_0x5afccd[_0x6cf3('0x123')]>0x0?_0x5790cd['phone'][_0x6cf3('0x124')](_0x5afccd[_0x6cf3('0x123')]):_0x5790cd[_0x6cf3('0xfc')]):util[_0x6cf3('0x52')](_0x6cf3('0x122'),_[_0x6cf3('0x61')](_0x5afccd[_0x6cf3('0x8f')])?_0x5afccd[_0x6cf3('0x4b')][_0x6cf3('0x23')]:_0x5afccd['TrunkBackup'][_0x6cf3('0x23')],_[_0x6cf3('0x61')](_0x5afccd[_0x6cf3('0x30')])?'':_0x5afccd[_0x6cf3('0x30')][_0x6cf3('0x125')]()||'',_0x5afccd[_0x6cf3('0x123')]>0x0?_0x5790cd[_0x6cf3('0xfc')]['substring'](_0x5afccd[_0x6cf3('0x123')]):_0x5790cd[_0x6cf3('0xfc')]);var _0x549541=_0x5b3543[_0x6cf3('0x8e')](_0x5afccd[_0x6cf3('0x4b')])?ut[_0x6cf3('0x126')](_0x5afccd[_0x6cf3('0x4b')][_0x6cf3('0x4d')],_0x5afccd[_0x6cf3('0x127')],_0x5afccd['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x6cf3('0x128')](_0x5afccd[_0x6cf3('0x2f')],_0x5afccd[_0x6cf3('0x129')]):_0x5afccd[_0x6cf3('0x2f')]):ut[_0x6cf3('0x126')](_[_0x6cf3('0x61')](_0x5afccd[_0x6cf3('0x8f')])?_0x5afccd[_0x6cf3('0x4b')][_0x6cf3('0x4d')]:_0x5afccd['TrunkBackup'][_0x6cf3('0x4d')],_0x5afccd[_0x6cf3('0x127')],_0x5afccd[_0x6cf3('0x129')]>0x0?ut['getCallerIdRandom'](_0x5afccd[_0x6cf3('0x2f')],_0x5afccd[_0x6cf3('0x129')]):_0x5afccd[_0x6cf3('0x2f')]);if(_0x549541){_0x371403[_0x6cf3('0x12a')]=ut[_0x6cf3('0x12b')](_0x549541);_0x371403[_0x6cf3('0x12c')]=ut[_0x6cf3('0x12d')](_0x549541);}var _0x5df722=ut[_0x6cf3('0x12e')](_0x5afccd,_0x5790cd,_0x2374d7,_0x549541,_0x3b195a,_0x371403);_[_0x6cf3('0x12f')](_0x371403,ut[_0x6cf3('0x130')](_0x5df722));_0x371403['starttime']=moment()[_0x6cf3('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x6cf3('0x6c')](ut[_0x6cf3('0x131')](_0x371403,_0x5afccd,_0x5df722,_0x371403[_0x6cf3('0xa4')],_0xefaab9))[_0x6cf3('0x76')](function(_0x651072){_0x5afccd[_0x6cf3('0x46')]+=0x1;logger[_0x6cf3('0x62')](_0x6cf3('0x132'),_0x3b195a,_0x6cf3('0xae'),_0x5afccd[_0x6cf3('0x23')],'originated:\x20',_0x5afccd[_0x6cf3('0x46')]);_0x28688d(_0x651072);})[_0x6cf3('0x6f')](function(_0x585139){ut[_0x6cf3('0xef')](_0x371403,0xe,'OriginateError');rpcDb[_0x6cf3('0xf0')](_0x371403,_0x6cf3('0x133'));_0x126463(_0x585139);});});};Preview['prototype'][_0x6cf3('0x134')]=function(_0x45440e){if(this['actions'][_0x45440e[_0x6cf3('0xa5')]]){this[_0x6cf3('0x64')][_0x45440e['linkedid']][_0x6cf3('0x6e')]=_0x45440e[_0x6cf3('0x6e')];}};Preview[_0x6cf3('0xe')][_0x6cf3('0x18')]=function(_0x166132){var _0x2f45ba=this;var _0x1b18b2=this[_0x6cf3('0x64')][_0x166132[_0x6cf3('0x135')]];if(_0x1b18b2){if(_0x1b18b2[_0x6cf3('0x136')]&&this['agents'][_0x1b18b2[_0x6cf3('0x136')]]){ut[_0x6cf3('0x137')](_0x1b18b2,this[_0x6cf3('0x15')][_0x1b18b2[_0x6cf3('0x136')]][_0x6cf3('0x23')],this[_0x6cf3('0x15')][_0x1b18b2[_0x6cf3('0x136')]]['id']);}var _0x249931=_[_0x6cf3('0x138')](_0x1b18b2);_0x249931['responsetime']=moment()[_0x6cf3('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1b96f8=_0x2f45ba['campaignsPreview'][_0x1b18b2['queue']];if(ut['isFailure'](_0x166132[_0x6cf3('0x139')])){if(_0x1b18b2['unlockAgent']){rpcDb[_0x6cf3('0x10f')](_0x1b18b2['idContact']);}if(_0x1b18b2[_0x6cf3('0xa4')]){rpcDb[_0x6cf3('0x80')](_0x1b18b2[_0x6cf3('0xa7')]);}ami['emit']('custom:agentringnoanswer',ut[_0x6cf3('0x98')](_0x1b18b2,_0x6cf3('0x13a'),this['campaignsPreview'][_0x1b18b2['queue']]));this[_0x6cf3('0xeb')](_0x249931,_0x1b96f8,_0x166132);}else{_0x1b18b2[_0x6cf3('0x81')]=moment()[_0x6cf3('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x249931,0x4,'Answer');rpcDb[_0x6cf3('0xf0')](_0x249931,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x6cf3('0xe')][_0x6cf3('0x13b')]=function(_0x20530e){var _0xeb20fc=this;var _0x360e26=this['actions'][_0x20530e[_0x6cf3('0xa5')]];var _0x32d92f;if(_0x360e26){_0x32d92f=this[_0x6cf3('0x12')][_0x360e26[_0x6cf3('0x65')]];logger[_0x6cf3('0x62')](_0x6cf3('0x13c'),_0x20530e[_0x6cf3('0xa5')],'\x20Queue',_0x32d92f[_0x6cf3('0x23')],_0x6cf3('0xbd'),_0x32d92f[_0x6cf3('0x55')]);}if(this[_0x6cf3('0x64')][_0x20530e[_0x6cf3('0xa5')]]&&_0x20530e[_0x6cf3('0xa5')]!==_0x20530e[_0x6cf3('0xad')]){if(_0x20530e[_0x6cf3('0x13d')]==='16'&&this[_0x6cf3('0x64')][_0x20530e['linkedid']][_0x6cf3('0x67')]){this[_0x6cf3('0x91')](_0x20530e,_0x20530e[_0x6cf3('0xa5')],_0x20530e[_0x6cf3('0x13d')]);}else if(this[_0x6cf3('0x64')][_0x20530e[_0x6cf3('0xa5')]][_0x6cf3('0x67')]){logger[_0x6cf3('0x62')](_0x6cf3('0x13e'),_0x20530e[_0x6cf3('0xa5')],_0x20530e['cause'],_0x6cf3('0xae'),_0x32d92f[_0x6cf3('0x23')],_0x6cf3('0xbd'),_0x32d92f[_0x6cf3('0x55')]);this[_0x6cf3('0x91')](_0x20530e,_0x20530e[_0x6cf3('0xa5')],_0x20530e['cause']);}}else if(_0x360e26&&_['isNil'](_0x360e26[_0x6cf3('0x13f')])&&_0x32d92f[_0x6cf3('0x140')]&&_0x20530e['linkedid']===_0x20530e[_0x6cf3('0xad')]&&_['isNil'](_0x20530e[_0x6cf3('0xee')])&&_0x20530e['cause']==='16'&&_0x20530e['channelstate']==='6'&&_[_0x6cf3('0xec')](_0x360e26[_0x6cf3('0x141')])){if(_0x360e26['unlockAgent']){rpcDb['unlockContact'](_0x360e26[_0x6cf3('0xa7')]);}if(_0x360e26[_0x6cf3('0xa4')]){rpcDb[_0x6cf3('0x80')](_0x360e26[_0x6cf3('0xa7')]);}_0x20530e[_0x6cf3('0xee')]='22';this[_0x6cf3('0xeb')](_0x360e26,_0x32d92f,_0x20530e);}else if(_0x360e26&&_0x360e26['transfer']){if(_0x20530e[_0x6cf3('0x13d')]==='16'&&this[_0x6cf3('0x64')][_0x20530e[_0x6cf3('0xa5')]][_0x6cf3('0x67')]){logger[_0x6cf3('0x62')](_0x6cf3('0x142'),_0x20530e[_0x6cf3('0xa5')],_0x20530e[_0x6cf3('0x13d')],_0x6cf3('0xae'),_0x32d92f['name'],_0x6cf3('0xbd'),_0x32d92f[_0x6cf3('0x55')]);this[_0x6cf3('0x91')](_0x20530e,_0x20530e[_0x6cf3('0xa5')],_0x20530e[_0x6cf3('0x13d')]);}else if(this[_0x6cf3('0x64')][_0x20530e[_0x6cf3('0xa5')]][_0x6cf3('0x67')]){logger[_0x6cf3('0x62')](_0x6cf3('0x13e'),_0x20530e['linkedid'],_0x20530e[_0x6cf3('0x13d')],_0x6cf3('0xae'),_0x32d92f['name'],_0x6cf3('0xbd'),_0x32d92f[_0x6cf3('0x55')]);this[_0x6cf3('0x91')](_0x20530e,_0x20530e[_0x6cf3('0xa5')],_0x20530e[_0x6cf3('0x13d')]);}}};Preview[_0x6cf3('0xe')]['syncDialEnd']=function(_0x166aca){if(this[_0x6cf3('0x64')][_0x166aca[_0x6cf3('0x143')]]&&_0x166aca[_0x6cf3('0x143')]!==_0x166aca[_0x6cf3('0x144')]){this[_0x6cf3('0x91')](_0x166aca,_0x166aca['destlinkedid'],_0x166aca[_0x6cf3('0xe7')]);}};Preview[_0x6cf3('0xe')][_0x6cf3('0x145')]=function(_0x17285e){if(this[_0x6cf3('0x64')][_0x17285e[_0x6cf3('0xa5')]]&&_0x17285e[_0x6cf3('0xa5')]!==_0x17285e[_0x6cf3('0xad')]&&!this[_0x6cf3('0x64')][_0x17285e[_0x6cf3('0xa5')]][_0x6cf3('0x67')]){if(_0x17285e[_0x6cf3('0x13d')]==='1'){this[_0x6cf3('0x91')](_0x17285e,_0x17285e['linkedid'],_0x17285e[_0x6cf3('0x13d')]);}}};Preview[_0x6cf3('0xe')][_0x6cf3('0x146')]=function(_0x5f516d,_0x540abe,_0x3f2883){if(this[_0x6cf3('0x64')][_0x5f516d]){if(_[_0x6cf3('0x61')](this['actions'][_0x5f516d]['variables'])){this[_0x6cf3('0x64')][_0x5f516d][_0x6cf3('0x147')]={};}this[_0x6cf3('0x64')][_0x5f516d][_0x6cf3('0x147')][_0x540abe]=_0x3f2883;}};Preview[_0x6cf3('0xe')][_0x6cf3('0x1e')]=function(_0x1e45b0){try{if(!_[_0x6cf3('0x61')](_0x1e45b0)){if(ut[_0x6cf3('0x148')](_[_0x6cf3('0x149')](_0x1e45b0[_0x6cf3('0x14a')])[0x0])){this[_0x6cf3('0x146')](_0x1e45b0[_0x6cf3('0xad')],_['keys'](_0x1e45b0['variable'])[0x0],_0x1e45b0[_0x6cf3('0x14b')]);}}}catch(_0xded9b4){logger['error'](_0x6cf3('0x14c'),util[_0x6cf3('0x14d')](_0xded9b4,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x2a8a15){if(_0x2a8a15){if(this[_0x6cf3('0x64')][_0x2a8a15[_0x6cf3('0x14e')]]){this[_0x6cf3('0x64')][_0x2a8a15['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x6cf3('0xe')]['syncBlindTransfer']=function(_0x18b4dd){if(_0x18b4dd){if(this[_0x6cf3('0x64')][_0x18b4dd[_0x6cf3('0x14f')]]){this['actions'][_0x18b4dd[_0x6cf3('0x14f')]][_0x6cf3('0x141')]=!![];}}};module[_0x6cf3('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1d9d676..f263adb 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 _0x25fa=['util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x25fa,0x109));var _0xa25f=function(_0xc31d47,_0x442370){_0xc31d47=_0xc31d47-0x0;var _0xa305ca=_0x25fa[_0xc31d47];return _0xa305ca;};'use strict';var util=require(_0xa25f('0x0'));var BPromise=require('bluebird');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var _=require('lodash');var cmHopper=require(_0xa25f('0x3'));var cmHopperFinal=require(_0xa25f('0x4'));var cmHopperHistory=require(_0xa25f('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xa25f('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2ea9ea){return function(_0x3ab530){logger[_0xa25f('0x7')](_0x2ea9ea,util[_0xa25f('0x8')](_0x3ab530,{'showHidden':![],'depth':null}));};}function create(_0x22982b){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopperHistory[_0xa25f('0xb')](_0x22982b))[_0xa25f('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1bca18){return BPromise[_0xa25f('0x9')]()['then'](agentReportPreview[_0xa25f('0xb')](_0x1bca18))[_0xa25f('0xc')](loggerCatch(_0xa25f('0xd')));}function moveContact(_0x22df56){return BPromise['resolve']()[_0xa25f('0xa')](cmHopper[_0xa25f('0xe')](_0x22df56,!![]))['catch'](loggerCatch(_0xa25f('0xf')));}exports[_0xa25f('0x10')]=function(_0x50bb78){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopperBlack[_0xa25f('0x10')](_0x50bb78))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x11')));};exports[_0xa25f('0x12')]=function(_0x46cd8c){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper[_0xa25f('0x12')](_0x46cd8c))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x13')));};exports['createHistory']=function(_0x2d4f0f,_0x471679){create(_0x2d4f0f)[_0xa25f('0xc')](loggerCatch(_0x471679));moveContact(_0x2d4f0f)[_0xa25f('0xc')](loggerCatch(_0x471679));};exports[_0xa25f('0x14')]=function(_0x427105,_0x4a4805){createAgent(_0x427105)[_0xa25f('0xc')](loggerCatch(_0x4a4805));};exports['createCustomerHistory']=function(_0x32b868,_0x562573){create(_0x32b868)['catch'](loggerCatch(_0x562573));};exports[_0xa25f('0x15')]=function(_0x489c83,_0x46bb31){moveContact(_0x489c83)[_0xa25f('0xc')](loggerCatch(_0x46bb31));};exports[_0xa25f('0x16')]=function(_0x3c2665,_0x21d035,_0x504135){if(_0x21d035){_0x3c2665[_0xa25f('0x17')]=null;}if(_0x504135){_0x3c2665[_0xa25f('0x18')]=![];}return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper['rescheduleContact'](_0x3c2665))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x19')));};exports[_0xa25f('0x1a')]=function(_0x3675b5){return BPromise['resolve']()[_0xa25f('0xa')](cmHopper[_0xa25f('0x1a')](_0x3675b5))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x1b')));};exports['unlockContact']=function(_0x2812d7){return BPromise[_0xa25f('0x9')]()['then'](cmHopper[_0xa25f('0x1c')]({'UserId':null},_0x2812d7,0x1))['catch'](loggerCatch(_0xa25f('0x1d')));};exports['disableContact']=function(_0x1e1fbd){return BPromise[_0xa25f('0x9')]()['then'](cmHopper[_0xa25f('0x1c')]({'active':![]},_0x1e1fbd,0x1))[_0xa25f('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xa25f('0x1e')]=function(_0x5d39c7){var _0x1030c4={};_0x1030c4[_0xa25f('0x1f')]=_0x5d39c7[_0xa25f('0x1f')];_0x1030c4[_0xa25f('0x20')]=_0x5d39c7[_0xa25f('0x20')];_0x1030c4['calleridnum']=_0x5d39c7[_0xa25f('0x21')];_0x1030c4[_0xa25f('0x22')]=_0x5d39c7[_0xa25f('0x22')];_0x1030c4[_0xa25f('0x23')]=_0x5d39c7[_0xa25f('0x23')];_0x1030c4['queuecallerjoinAt']=_0x5d39c7[_0xa25f('0x24')];_0x1030c4[_0xa25f('0x25')]=_0x5d39c7[_0xa25f('0x24')];_0x1030c4[_0xa25f('0x26')]=0x1;_0x1030c4[_0xa25f('0x27')]=_0x5d39c7[_0xa25f('0x28')];_0x1030c4[_0xa25f('0x29')]=_0x5d39c7[_0xa25f('0x2a')];_0x1030c4[_0xa25f('0x2b')]='from-sip';_0x1030c4['exten']='xcally-motion-preview';_0x1030c4[_0xa25f('0x2c')]=0x0;_0x1030c4[_0xa25f('0x2d')]=0x1;_0x1030c4[_0xa25f('0x2e')]=_0x5d39c7[_0xa25f('0x2a')];_0x1030c4[_0xa25f('0x2f')]=_0xa25f('0x30');return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](voiceQueueReport[_0xa25f('0x31')](_0x1030c4))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x32')));};exports['getContactRecallMe']=function(_0x58ee76,_0xeb44b1){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper['getContactRecallMe'](_0x58ee76,_0xeb44b1))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xa25f('0x33')]=function(_0x25952d){return BPromise[_0xa25f('0x9')]()['then'](cmHopper['rescheduleContact'](_0x25952d,!![],!![]))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x34')));}; \ No newline at end of file +var _0x6c7b=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','endtime','connectedlinename','membername','context','holdtime','assigned','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','[rescheduleContact]\x20'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x56e20a,_0x57d435){_0x56e20a=_0x56e20a-0x0;var _0x735d65=_0x6c7b[_0x56e20a];return _0x735d65;};'use strict';var util=require(_0xb6c7('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var _=require(_0xb6c7('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xb6c7('0x2'));var cmHopperHistory=require(_0xb6c7('0x3'));var cmHopperBlack=require(_0xb6c7('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xb6c7('0x5'));var voiceQueueReport=require(_0xb6c7('0x6'));function loggerCatch(_0xfe3eb9){return function(_0x219abc){logger[_0xb6c7('0x7')](_0xfe3eb9,util['inspect'](_0x219abc,{'showHidden':![],'depth':null}));};}function create(_0x12e97e){return BPromise[_0xb6c7('0x8')]()[_0xb6c7('0x9')](cmHopperHistory[_0xb6c7('0xa')](_0x12e97e))[_0xb6c7('0xb')](loggerCatch(_0xb6c7('0xc')));}function createAgent(_0x245016){return BPromise[_0xb6c7('0x8')]()['then'](agentReportPreview['createHistory'](_0x245016))[_0xb6c7('0xb')](loggerCatch(_0xb6c7('0xc')));}function moveContact(_0x2f9c01){return BPromise[_0xb6c7('0x8')]()[_0xb6c7('0x9')](cmHopper[_0xb6c7('0xd')](_0x2f9c01,!![]))[_0xb6c7('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xb6c7('0xe')]=function(_0xa858c5){return BPromise[_0xb6c7('0x8')]()[_0xb6c7('0x9')](cmHopperBlack[_0xb6c7('0xe')](_0xa858c5))[_0xb6c7('0xb')](loggerCatch(_0xb6c7('0xf')));};exports['getContactPreview']=function(_0x3c7ff4){return BPromise['resolve']()['then'](cmHopper['getContactPreview'](_0x3c7ff4))[_0xb6c7('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0xb6c7('0xa')]=function(_0x1a2bc9,_0x23971b){create(_0x1a2bc9)[_0xb6c7('0xb')](loggerCatch(_0x23971b));moveContact(_0x1a2bc9)[_0xb6c7('0xb')](loggerCatch(_0x23971b));};exports[_0xb6c7('0x10')]=function(_0x2c819d,_0x1317f5){createAgent(_0x2c819d)[_0xb6c7('0xb')](loggerCatch(_0x1317f5));};exports[_0xb6c7('0x11')]=function(_0xef5eb1,_0x3f133f){create(_0xef5eb1)[_0xb6c7('0xb')](loggerCatch(_0x3f133f));};exports['createCustomerFinal']=function(_0x274f76,_0x1cbcc8){moveContact(_0x274f76)['catch'](loggerCatch(_0x1cbcc8));};exports[_0xb6c7('0x12')]=function(_0x5a1c0a,_0x37f7cb,_0x5b7ebf){if(_0x37f7cb){_0x5a1c0a[_0xb6c7('0x13')]=null;}if(_0x5b7ebf){_0x5a1c0a['active']=![];}return BPromise[_0xb6c7('0x8')]()[_0xb6c7('0x9')](cmHopper['rescheduleContact'](_0x5a1c0a))[_0xb6c7('0xb')](loggerCatch(_0xb6c7('0x14')));};exports[_0xb6c7('0x15')]=function(_0x4232b6){return BPromise[_0xb6c7('0x8')]()[_0xb6c7('0x9')](cmHopper['countReScheduled'](_0x4232b6))[_0xb6c7('0xb')](loggerCatch(_0xb6c7('0x16')));};exports[_0xb6c7('0x17')]=function(_0x418920){return BPromise['resolve']()[_0xb6c7('0x9')](cmHopper[_0xb6c7('0x17')]({'UserId':null},_0x418920,0x1))['catch'](loggerCatch(_0xb6c7('0x18')));};exports[_0xb6c7('0x19')]=function(_0x1de00f){return BPromise[_0xb6c7('0x8')]()['then'](cmHopper[_0xb6c7('0x17')]({'active':![]},_0x1de00f,0x1))['catch'](loggerCatch(_0xb6c7('0x1a')));};exports[_0xb6c7('0x1b')]=function(_0x232f7f){var _0x5f3be2={};_0x5f3be2['type']=_0x232f7f['type'];_0x5f3be2[_0xb6c7('0x1c')]=_0x232f7f[_0xb6c7('0x1c')];_0x5f3be2[_0xb6c7('0x1d')]=_0x232f7f[_0xb6c7('0x1d')];_0x5f3be2[_0xb6c7('0x1e')]=_0x232f7f[_0xb6c7('0x1e')];_0x5f3be2[_0xb6c7('0x1f')]=_0x232f7f[_0xb6c7('0x1f')];_0x5f3be2[_0xb6c7('0x20')]=_0x232f7f[_0xb6c7('0x21')];_0x5f3be2['queuecallerleaveAt']=_0x232f7f[_0xb6c7('0x21')];_0x5f3be2['queuecallercomplete']=0x1;_0x5f3be2[_0xb6c7('0x22')]=_0x232f7f[_0xb6c7('0x23')];_0x5f3be2[_0xb6c7('0x24')]=_0x232f7f[_0xb6c7('0x25')];_0x5f3be2[_0xb6c7('0x26')]='from-sip';_0x5f3be2['exten']='xcally-motion-preview';_0x5f3be2[_0xb6c7('0x27')]=0x0;_0x5f3be2[_0xb6c7('0x28')]=0x1;_0x5f3be2['lastAssignedTo']=_0x232f7f[_0xb6c7('0x25')];_0x5f3be2[_0xb6c7('0x29')]='COMPLETED';return BPromise[_0xb6c7('0x8')]()[_0xb6c7('0x9')](voiceQueueReport[_0xb6c7('0x2a')](_0x5f3be2))[_0xb6c7('0xb')](loggerCatch(_0xb6c7('0x2b')));};exports[_0xb6c7('0x2c')]=function(_0x51b62c,_0x204f48){return BPromise[_0xb6c7('0x8')]()[_0xb6c7('0x9')](cmHopper[_0xb6c7('0x2c')](_0x51b62c,_0x204f48))[_0xb6c7('0xb')](loggerCatch(_0xb6c7('0x2d')));};exports[_0xb6c7('0x2e')]=function(_0x55a871){return BPromise['resolve']()[_0xb6c7('0x9')](cmHopper[_0xb6c7('0x12')](_0x55a871,!![],!![]))[_0xb6c7('0xb')](loggerCatch(_0xb6c7('0x2f')));}; \ 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 9975a7f..b6c1753 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 _0x34d3=['campaigntype','membername','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','logger','inspect','info','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','filterKey','idContact','type'];(function(_0x369a19,_0x1bfc40){var _0x47fae6=function(_0x4ae4a7){while(--_0x4ae4a7){_0x369a19['push'](_0x369a19['shift']());}};_0x47fae6(++_0x1bfc40);}(_0x34d3,0xae));var _0x334d=function(_0xdd56f0,_0x469515){_0xdd56f0=_0xdd56f0-0x0;var _0x236550=_0x34d3[_0xdd56f0];return _0x236550;};'use strict';var util=require(_0x334d('0x0'));var _=require(_0x334d('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x334d('0x2'));var ipAgi=process[_0x334d('0x3')][_0x334d('0x4')]||_0x334d('0x5');function getSeconds(_0x287993,_0x19b409){var _0x5d7272=moment(_0x287993)[_0x334d('0x6')](0x0);var _0x4653dc=moment(_0x19b409)[_0x334d('0x6')](0x0);return _0x5d7272[_0x334d('0x7')](_0x4653dc,_0x334d('0x8'));}exports['loggerCatch']=function(_0x13abeb){return function(_0x2b6f58){logger[_0x334d('0x9')](_0x13abeb,util['inspect'](_0x2b6f58,{'showHidden':![],'depth':null}));};};exports[_0x334d('0xa')]=function(_0x3804b7,_0x4cc137){logger['info'](_0x3804b7,util['inspect'](_0x4cc137,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3cefd1,_0x45085b){logger[_0x334d('0x9')](_0x3cefd1,util[_0x334d('0xb')](_0x45085b,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3d39db){return function(_0x45c661){logger[_0x334d('0xc')](_0x3d39db,util[_0x334d('0xb')](_0x45c661,{'showHidden':![],'depth':null}));};};exports[_0x334d('0xd')]=function(_0x5e5638,_0x2cd277,_0x2f3530){return{'message':_0x5e5638,'unlock':_0x2cd277,'active':_0x2f3530};};exports[_0x334d('0xe')]=function(_0x3dcb69,_0x29d43a,_0x53e5c9){if(!_['isUndefined'](_0x53e5c9)&&_0x334d('0xf')===typeof _0x53e5c9&&!_[_0x334d('0x10')](_0x53e5c9)){if(!_['isUndefined'](_0x29d43a)&&_0x334d('0xf')===typeof _0x29d43a&&!_[_0x334d('0x10')](_0x29d43a)){return util['format'](_0x334d('0x11'),_0x29d43a,_0x53e5c9);}return util[_0x334d('0x12')]('\x22%s\x22\x20<%s>',_0x53e5c9,_0x53e5c9);}if(!_['isUndefined'](_0x3dcb69)&&_0x334d('0xf')===typeof _0x3dcb69&&!_[_0x334d('0x10')](_0x3dcb69)){return _0x3dcb69;}return _0x334d('0x13');};exports['isActive']=function(_0x497fa0){if(_['isNil'](_0x497fa0)){return![];}return _0x497fa0;};exports['addVariables']=function(_0x57a91e,_0x5ffab8,_0x51c13a,_0x2ada05,_0x4450f7,_0x37192a){var _0x368282={'XMD-QUEUE':_0x5ffab8[_0x334d('0x14')]?_0x5ffab8[_0x334d('0x14')][_0x334d('0x15')]:'','XMD-CALLERID':_0x2ada05,'XMD-CALLERID-PREVIEW':_0x37192a?util[_0x334d('0x12')](_0x334d('0x11'),_0x37192a[_0x334d('0x16')],_0x37192a[_0x334d('0x17')]):_0x2ada05,'XMD-DIALID':_0x4450f7,'XMD-CONTACTID':_0x5ffab8[_0x334d('0x18')],'XMD-CDRTYPE':_0x334d('0x19'),'CALLERID(all)':_0x2ada05,'XMD-VOICEQUEUEID':_0x5ffab8['VoiceQueueId'],'XMD-DIALCHANNEL':_0x51c13a,'XMD-DIALTIMEOUT':_0x57a91e[_0x334d('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x334d('0x1b'),_0x57a91e['dialQueueProject2']?'g':'',_[_0x334d('0x10')](_0x57a91e[_0x334d('0x1c')])?'':_0x334d('0x1d')),'XMD-DIALURL':_0x57a91e[_0x334d('0x1e')]||'','XMD-AGI':_0x57a91e[_0x334d('0x1f')]?util[_0x334d('0x12')](_0x334d('0x20'),ipAgi,_0x57a91e['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x57a91e[_0x334d('0x21')]?util[_0x334d('0x12')](_0x334d('0x20'),ipAgi,_0x57a91e[_0x334d('0x21')]):_0x334d('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x37192a?_0x37192a[_0x334d('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x37192a?_0x37192a[_0x334d('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x334d('0x10')](_0x57a91e[_0x334d('0x1c')])){_0x368282[util['format']('%s',_0x334d('0x25'))]=_0x57a91e['monitor_format'];_0x368282[util[_0x334d('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4450f7;}if(_0x5ffab8&&_0x5ffab8[_0x334d('0x26')]){for(var _0x5f1744 in _0x5ffab8[_0x334d('0x26')]){if(_0x5ffab8[_0x334d('0x26')][_0x334d('0x27')](_0x5f1744)){if(!_['isNil'](_0x5ffab8[_0x334d('0x26')][_0x5f1744])&&_0x5f1744!=='id'&&_0x5f1744!=='tags'&&_0x5f1744!==_0x334d('0x28')&&_0x5f1744!==_0x334d('0x29')){_0x368282[util['format']('%s%s',_0x334d('0x2a'),_[_0x334d('0x2b')](_0x5f1744))]=_0x5ffab8[_0x334d('0x26')][_0x5f1744];}}}}return _0x368282;};exports[_0x334d('0x2c')]=function(_0x3194bb){var _0x41fd2e={};for(var _0x155c0c in _0x3194bb){if(_0x3194bb[_0x334d('0x27')](_0x155c0c)){_0x41fd2e[util[_0x334d('0x12')]('%s',_[_0x334d('0x2d')](_0x155c0c))]=_0x3194bb[_0x155c0c];}}return{'variables':_0x41fd2e};};exports['updateOriginated']=function(_0x30f6bf,_0x476685){if(!_[_0x334d('0x2e')](_0x30f6bf)){if(_0x30f6bf[_0x334d('0x27')](_0x334d('0x2f'))){if(_0x30f6bf[_0x334d('0x2f')]>0x0){_0x30f6bf[_0x334d('0x2f')]-=0x1;}else{logger[_0x334d('0x9')](_0x334d('0x30'),_0x476685);}}}else{logger[_0x334d('0x9')](_0x334d('0x31'),_0x476685);}};exports[_0x334d('0x32')]=function(_0x59c848){var _0x243b61=moment()['format'](_0x334d('0x33'));_0x59c848['state']=0xd;_0x59c848[_0x334d('0x34')]=_0x334d('0x35');_0x59c848[_0x334d('0x36')]=_0x243b61;_0x59c848[_0x334d('0x37')]=_0x243b61;_0x59c848[_0x334d('0x38')]=_0x243b61;};exports[_0x334d('0x39')]=function(_0x158738,_0x4d98f0,_0x243278){var _0x5e6f9a=moment()[_0x334d('0x12')](_0x334d('0x33'));_0x158738[_0x334d('0x3a')]=_0x4d98f0;_0x158738['statedesc']=_0x243278;_0x158738[_0x334d('0x37')]=_0x5e6f9a;_0x158738[_0x334d('0x3b')]=getSeconds(_0x158738[_0x334d('0x37')],_0x158738['starttime']);};exports[_0x334d('0x3c')]=function(_0x2ad47c,_0x5a941e,_0x12a205){_0x2ad47c['membername']=_0x5a941e;_0x2ad47c[_0x334d('0x3d')]=_0x12a205;};exports[_0x334d('0x3e')]=function(_0x8dae,_0x2e4f98,_0x549123){var _0xeffe7=moment()[_0x334d('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x8dae[_0x334d('0x3a')]=_0x2e4f98;_0x8dae[_0x334d('0x34')]=_0x549123;_0x8dae[_0x334d('0x37')]=_0x8dae[_0x334d('0x37')]?_0x8dae[_0x334d('0x37')]:_0xeffe7;_0x8dae[_0x334d('0x38')]=_0x8dae[_0x334d('0x38')]?_0x8dae[_0x334d('0x38')]:_0xeffe7;_0x8dae[_0x334d('0x3b')]=getSeconds(_0x8dae[_0x334d('0x37')]||0x0,_0x8dae['starttime']||0x0);_0x8dae[_0x334d('0x3f')]=_0x8dae[_0x334d('0x40')]?getSeconds(_0x8dae[_0x334d('0x38')],_0x8dae[_0x334d('0x40')]):0x0;};exports[_0x334d('0x41')]=function(_0x6375b2){return _0x6375b2===_0x334d('0x42');};exports[_0x334d('0x43')]=function(_0x3c43eb,_0x379734,_0x134c2e,_0x198ff4,_0x5df86c){var _0x65ec98=_0x198ff4?'RECALL':_0x3c43eb[_0x334d('0x16')];_0x65ec98=_0x5df86c?'BOOKED':_0x65ec98;return{'actionid':_0x3c43eb[_0x334d('0x44')],'action':_0x334d('0x45'),'channel':_0x3c43eb[_0x334d('0x46')],'callerid':util[_0x334d('0x12')](_0x334d('0x11'),_0x65ec98,_0x3c43eb[_0x334d('0x17')]),'Exten':_0x334d('0x47'),'Context':_0x334d('0x48'),'Priority':'1','variable':_0x134c2e,'timeout':(_0x379734['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3c43eb[_0x334d('0x44')]};};exports['totalGlobal']=function(_0x28e46a){return _0x28e46a[_0x334d('0x49')]+_0x28e46a[_0x334d('0x4a')]+_0x28e46a[_0x334d('0x4b')]+_0x28e46a[_0x334d('0x4c')]+_0x28e46a[_0x334d('0x4d')];};exports[_0x334d('0x4e')]=function(_0x17ed38){var _0x3515c0=_[_0x334d('0x4f')](_0x17ed38);_0x3515c0[_0x334d('0x3a')]=0xf;_0x3515c0[_0x334d('0x34')]=_0x334d('0x50');return _0x3515c0;};exports[_0x334d('0x51')]=function(_0x33d1cb,_0x173c74,_0x4ff294){var _0x3ba2d9={};_0x3ba2d9[_0x173c74]=_0x33d1cb[_0x173c74];_0x3ba2d9[_0x334d('0x52')]=![];_0x3ba2d9[_0x334d('0x53')]=moment()[_0x334d('0x54')](_0x4ff294,_0x334d('0x55'))['format'](_0x334d('0x33'));_0x3ba2d9['ContactId']=_0x33d1cb[_0x334d('0x18')];_0x3ba2d9[_0x334d('0x56')]=_0x33d1cb['ListId'];_0x3ba2d9[_0x334d('0x57')]=_0x33d1cb['VoiceQueueId']||undefined;return _0x3ba2d9;};exports[_0x334d('0x58')]=function(_0x38f51a,_0x29354f){if(!_[_0x334d('0x2e')](_0x38f51a)){if(_0x38f51a[_0x334d('0x59')]>0x0){_0x38f51a[_0x334d('0x59')]-=0x1;}else{logger[_0x334d('0x9')](_0x29354f,_0x334d('0x5a'));}}else{logger[_0x334d('0x9')](_0x29354f,_0x334d('0x5b'));}};exports['IsNotLoggedIn']=function(_0x46600e){if(_0x46600e<=0x0){return!![];}return![];};exports[_0x334d('0x5c')]=function(_0x2c7939,_0x199c98,_0x50a7e0){_0x2c7939[_0x334d('0x5d')]=_0x199c98;_0x2c7939['name']=_0x2c7939[_0x334d('0x5e')];_0x2c7939['interface']=_0x2c7939[_0x334d('0x46')];if(_0x50a7e0){_0x2c7939[_0x334d('0x5f')]=_0x50a7e0['mandatoryDisposition'];}return _0x2c7939;};exports[_0x334d('0x60')]=function(_0x4e9d73){var _0x1a1832={};_0x1a1832['queue']=_0x4e9d73[_0x334d('0x5e')];_0x1a1832[_0x334d('0x61')]=_0x4e9d73[_0x334d('0x46')];_0x1a1832[_0x334d('0x44')]=_0x4e9d73['uniqueid'];return _0x1a1832;};exports[_0x334d('0x62')]=function(_0x1c3ca3){var _0x2100ef=[];for(var _0x586608 in _0x1c3ca3){if(_0x1c3ca3[_0x334d('0x27')](_0x586608)){if(!_[_0x334d('0x2e')](_0x1c3ca3[_0x586608])&&_0x1c3ca3[_0x586608][_0x334d('0x3a')]===_0x334d('0x63')&&_0x1c3ca3[_0x586608][_0x334d('0x64')]===_0x334d('0x65')){_0x2100ef[_0x334d('0x66')](_0x1c3ca3[_0x586608]['id']);}}}return _0x2100ef;};exports['getDiff']=function(_0x263bb5){var _0x5dfac9=moment()['milliseconds'](0x0);var _0x35d47b=moment(_0x263bb5)['milliseconds'](0x0);return _0x5dfac9[_0x334d('0x7')](_0x35d47b,_0x334d('0x8'));};exports['createBody']=function(_0x2b22c5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b22c5[_0x334d('0x18')],'ListId':_0x2b22c5[_0x334d('0x56')],'VoiceQueueId':_0x2b22c5[_0x334d('0x57')]||undefined,'CampaignId':_0x2b22c5['CampaignId']||undefined};};exports[_0x334d('0x67')]=function(_0xcb17ed){if(_0xcb17ed===_0x334d('0x44')||_0xcb17ed===_0x334d('0x68')||_0xcb17ed===_0x334d('0x5e')||_0xcb17ed===_0x334d('0x69')||_0xcb17ed===_0x334d('0x6a')||_0xcb17ed==='dialAnswer'||_0xcb17ed===_0x334d('0x6b')||_0xcb17ed==='channelAgent'||_0xcb17ed===_0x334d('0x16')||_0xcb17ed==='active'||_0xcb17ed==='calleridnum'||_0xcb17ed===_0x334d('0x53')||_0xcb17ed===_0x334d('0x49')||_0xcb17ed===_0x334d('0x4a')||_0xcb17ed===_0x334d('0x4b')||_0xcb17ed===_0x334d('0x6c')||_0xcb17ed===_0x334d('0x6d')||_0xcb17ed==='callbackuniqueid'||_0xcb17ed===_0x334d('0x6e')||_0xcb17ed===_0x334d('0x6f')||_0xcb17ed==='ContactId'||_0xcb17ed===_0x334d('0x56')||_0xcb17ed===_0x334d('0x3d')||_0xcb17ed==='VoiceQueueId'||_0xcb17ed===_0x334d('0x70')||_0xcb17ed===_0x334d('0x71')||_0xcb17ed===_0x334d('0x72')||_0xcb17ed==='xmd-phone'||_0xcb17ed===_0x334d('0x73')||_0xcb17ed===_0x334d('0x74')||_0xcb17ed===_0x334d('0x75')||_0xcb17ed===_0x334d('0x76')||_0xcb17ed===_0x334d('0x77')||_0xcb17ed===_0x334d('0x78')||_0xcb17ed==='xmd-contactid'||_0xcb17ed===_0x334d('0x79')||_0xcb17ed===_0x334d('0x7a')||_0xcb17ed===_0x334d('0x7b')||_0xcb17ed===_0x334d('0x7c')||_0xcb17ed===_0x334d('0x7d')||_0xcb17ed===_0x334d('0x7e')||_0xcb17ed===_0x334d('0x7f')||_0xcb17ed==='rtpaudioqosjitterbridged'||_0xcb17ed===_0x334d('0x80')||_0xcb17ed===_0x334d('0x81')||_0xcb17ed===_0x334d('0x82')||_0xcb17ed===_0x334d('0x83')||_0xcb17ed===_0x334d('0x7d')||_0xcb17ed==='rtpaudioqosbridged'||_0xcb17ed===_0x334d('0x7f')||_0xcb17ed===_0x334d('0x84')||_0xcb17ed==='rtpaudioqosloss'||_0xcb17ed===_0x334d('0x81')||_0xcb17ed===_0x334d('0x82')||_0xcb17ed===_0x334d('0x83')||_0xcb17ed===_0x334d('0x85')||_0xcb17ed==='bridgepvtcallid'||_0xcb17ed===_0x334d('0x3a')||_0xcb17ed===_0x334d('0x34')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x315a40,_0x51586e){var _0x55605a,_0x20be96,_0x245c90;if(_0x51586e<=0x0){_0x51586e=0x1;}_0x55605a=new RegExp('\x5cw{0,'+_0x51586e+'}$');_0x20be96=Math['pow'](0xa,_0x51586e-0x1);_0x245c90=Math[_0x334d('0x86')](0xa,_0x51586e)-0x1;return util[_0x334d('0x12')]('%s',_[_0x334d('0x87')](_0x315a40,_0x55605a,_[_0x334d('0x88')](_0x20be96,_0x245c90)));};exports[_0x334d('0x89')]=function(_0x335196){var _0x32d20f=_0x335196[_0x334d('0x8a')](/"(.*?)"/);return _0x32d20f?_0x32d20f[0x1]:_0x335196;};exports[_0x334d('0x8b')]=function(_0xd471d8){var _0x5e30c0=_0xd471d8[_0x334d('0x8a')](/<(.*?)>/);return _0x5e30c0?_0x5e30c0[0x1]:_0xd471d8;}; \ No newline at end of file +var _0x5de5=['logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','endtime','responsetime','starttime','logLookAgent','membername','UserId','logCustomer','state','ringtime','talktime','answertime','isFailure','Failure','uniqueid','channelAgent','from-sip','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','add','minutes','ContactId','ListId','decrementTalkink','pTalking','IsNotLoggedIn','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','status','push','getDiff','diff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','scheduledat','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','moment','../../../../config/logger','env','milliseconds','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined'];(function(_0x52dde9,_0x36ef43){var _0x198fe3=function(_0x622fa8){while(--_0x622fa8){_0x52dde9['push'](_0x52dde9['shift']());}};_0x198fe3(++_0x36ef43);}(_0x5de5,0x158));var _0x55de=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5de5[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x55de('0x0'));var logger=require(_0x55de('0x1'))('preview');var ipAgi=process[_0x55de('0x2')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x537fdf,_0x12e157){var _0x2ba092=moment(_0x537fdf)[_0x55de('0x3')](0x0);var _0x47c0a4=moment(_0x12e157)[_0x55de('0x3')](0x0);return _0x2ba092['diff'](_0x47c0a4,_0x55de('0x4'));}exports[_0x55de('0x5')]=function(_0x25c679){return function(_0x2e6971){logger[_0x55de('0x6')](_0x25c679,util[_0x55de('0x7')](_0x2e6971,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1c6686,_0x2d26e9){logger[_0x55de('0x8')](_0x1c6686,util[_0x55de('0x7')](_0x2d26e9,{'showHidden':![],'depth':null}));};exports[_0x55de('0x9')]=function(_0x424f83,_0x452fe6){logger[_0x55de('0x6')](_0x424f83,util[_0x55de('0x7')](_0x452fe6,{'showHidden':![],'depth':null}));};exports[_0x55de('0xa')]=function(_0x1ff67e){return function(_0x1de428){logger[_0x55de('0x8')](_0x1ff67e,util['inspect'](_0x1de428,{'showHidden':![],'depth':null}));};};exports[_0x55de('0xb')]=function(_0x25ed02,_0x43723d,_0x334d79){return{'message':_0x25ed02,'unlock':_0x43723d,'active':_0x334d79};};exports[_0x55de('0xc')]=function(_0x3b9877,_0x56b0b6,_0x14df84){if(!_['isUndefined'](_0x14df84)&&_0x55de('0xd')===typeof _0x14df84&&!_[_0x55de('0xe')](_0x14df84)){if(!_['isUndefined'](_0x56b0b6)&&'string'===typeof _0x56b0b6&&!_[_0x55de('0xe')](_0x56b0b6)){return util[_0x55de('0xf')](_0x55de('0x10'),_0x56b0b6,_0x14df84);}return util[_0x55de('0xf')](_0x55de('0x10'),_0x14df84,_0x14df84);}if(!_[_0x55de('0x11')](_0x3b9877)&&_0x55de('0xd')===typeof _0x3b9877&&!_[_0x55de('0xe')](_0x3b9877)){return _0x3b9877;}return _0x55de('0x12');};exports[_0x55de('0x13')]=function(_0x4dbb61){if(_[_0x55de('0x14')](_0x4dbb61)){return![];}return _0x4dbb61;};exports[_0x55de('0x15')]=function(_0x19ed99,_0x2261ab,_0x543b7f,_0x56cf2b,_0x4baa9d,_0x496d31){var _0x587925={'XMD-QUEUE':_0x2261ab['Queue']?_0x2261ab[_0x55de('0x16')][_0x55de('0x17')]:'','XMD-CALLERID':_0x56cf2b,'XMD-CALLERID-PREVIEW':_0x496d31?util['format'](_0x55de('0x10'),_0x496d31[_0x55de('0x18')],_0x496d31[_0x55de('0x19')]):_0x56cf2b,'XMD-DIALID':_0x4baa9d,'XMD-CONTACTID':_0x2261ab['ContactId'],'XMD-CDRTYPE':_0x55de('0x1a'),'CALLERID(all)':_0x56cf2b,'XMD-VOICEQUEUEID':_0x2261ab[_0x55de('0x1b')],'XMD-DIALCHANNEL':_0x543b7f,'XMD-DIALTIMEOUT':_0x19ed99[_0x55de('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x55de('0xf')]('\x22rtTxX%s%s\x22',_0x19ed99[_0x55de('0x1d')]?'g':'',_['isEmpty'](_0x19ed99['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x19ed99[_0x55de('0x1e')]||'','XMD-AGI':_0x19ed99[_0x55de('0x1f')]?util[_0x55de('0xf')](_0x55de('0x20'),ipAgi,_0x19ed99[_0x55de('0x1f')]):_0x55de('0x21'),'XMD-AGIAFTER':_0x19ed99[_0x55de('0x1d')]?util[_0x55de('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x19ed99[_0x55de('0x1d')]):_0x55de('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x496d31?_0x496d31[_0x55de('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x496d31?_0x496d31[_0x55de('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x55de('0xe')](_0x19ed99[_0x55de('0x24')])){_0x587925[util[_0x55de('0xf')]('%s',_0x55de('0x25'))]=_0x19ed99[_0x55de('0x24')];_0x587925[util[_0x55de('0xf')]('%s',_0x55de('0x26'))]=_0x4baa9d;}if(_0x2261ab&&_0x2261ab['Contact']){for(var _0x500758 in _0x2261ab[_0x55de('0x27')]){if(_0x2261ab[_0x55de('0x27')][_0x55de('0x28')](_0x500758)){if(!_[_0x55de('0x14')](_0x2261ab['Contact'][_0x500758])&&_0x500758!=='id'&&_0x500758!==_0x55de('0x29')&&_0x500758!==_0x55de('0x2a')&&_0x500758!==_0x55de('0x2b')){_0x587925[util[_0x55de('0xf')](_0x55de('0x2c'),_0x55de('0x2d'),_[_0x55de('0x2e')](_0x500758))]=_0x2261ab[_0x55de('0x27')][_0x500758];}}}}return _0x587925;};exports['toLowerVariables']=function(_0x5b4aa7){var _0x255e97={};for(var _0x45b039 in _0x5b4aa7){if(_0x5b4aa7[_0x55de('0x28')](_0x45b039)){_0x255e97[util[_0x55de('0xf')]('%s',_[_0x55de('0x2f')](_0x45b039))]=_0x5b4aa7[_0x45b039];}}return{'variables':_0x255e97};};exports[_0x55de('0x30')]=function(_0x36ecfe,_0x56d966){if(!_[_0x55de('0x14')](_0x36ecfe)){if(_0x36ecfe[_0x55de('0x28')](_0x55de('0x31'))){if(_0x36ecfe[_0x55de('0x31')]>0x0){_0x36ecfe['originated']-=0x1;}else{logger[_0x55de('0x6')](_0x55de('0x32'),_0x56d966);}}}else{logger[_0x55de('0x6')](_0x55de('0x33'),_0x56d966);}};exports[_0x55de('0x34')]=function(_0x372685){var _0x1086f1=moment()[_0x55de('0xf')](_0x55de('0x35'));_0x372685['state']=0xd;_0x372685[_0x55de('0x36')]=_0x55de('0x37');_0x372685['starttime']=_0x1086f1;_0x372685['responsetime']=_0x1086f1;_0x372685[_0x55de('0x38')]=_0x1086f1;};exports['logAgent']=function(_0xcd5ad8,_0x34bded,_0x560e38){var _0xb35e34=moment()['format'](_0x55de('0x35'));_0xcd5ad8['state']=_0x34bded;_0xcd5ad8[_0x55de('0x36')]=_0x560e38;_0xcd5ad8[_0x55de('0x39')]=_0xb35e34;_0xcd5ad8['ringtime']=getSeconds(_0xcd5ad8[_0x55de('0x39')],_0xcd5ad8[_0x55de('0x3a')]);};exports[_0x55de('0x3b')]=function(_0x25f5f7,_0x487fb6,_0x2175b0){_0x25f5f7[_0x55de('0x3c')]=_0x487fb6;_0x25f5f7[_0x55de('0x3d')]=_0x2175b0;};exports[_0x55de('0x3e')]=function(_0x27bba7,_0x5b13ab,_0x11c400){var _0x3711be=moment()[_0x55de('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x27bba7[_0x55de('0x3f')]=_0x5b13ab;_0x27bba7['statedesc']=_0x11c400;_0x27bba7[_0x55de('0x39')]=_0x27bba7[_0x55de('0x39')]?_0x27bba7['responsetime']:_0x3711be;_0x27bba7[_0x55de('0x38')]=_0x27bba7[_0x55de('0x38')]?_0x27bba7[_0x55de('0x38')]:_0x3711be;_0x27bba7[_0x55de('0x40')]=getSeconds(_0x27bba7['responsetime']||0x0,_0x27bba7[_0x55de('0x3a')]||0x0);_0x27bba7[_0x55de('0x41')]=_0x27bba7['answertime']?getSeconds(_0x27bba7['endtime'],_0x27bba7[_0x55de('0x42')]):0x0;};exports[_0x55de('0x43')]=function(_0x17319e){return _0x17319e===_0x55de('0x44');};exports['variablesAction']=function(_0x5b745e,_0x37c271,_0x4478b7,_0x3564a3,_0x145f56){var _0x3948a9=_0x3564a3?'RECALL':_0x5b745e[_0x55de('0x18')];_0x3948a9=_0x145f56?'BOOKED':_0x3948a9;return{'actionid':_0x5b745e[_0x55de('0x45')],'action':'originate','channel':_0x5b745e[_0x55de('0x46')],'callerid':util[_0x55de('0xf')](_0x55de('0x10'),_0x3948a9,_0x5b745e['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x55de('0x47'),'Priority':'1','variable':_0x4478b7,'timeout':(_0x37c271[_0x55de('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b745e[_0x55de('0x45')]};};exports['totalGlobal']=function(_0x329e7a){return _0x329e7a[_0x55de('0x49')]+_0x329e7a['countcongestionretry']+_0x329e7a[_0x55de('0x4a')]+_0x329e7a[_0x55de('0x4b')]+_0x329e7a[_0x55de('0x4c')];};exports[_0x55de('0x4d')]=function(_0x5f5c50){var _0x2c0df6=_[_0x55de('0x4e')](_0x5f5c50);_0x2c0df6['state']=0xf;_0x2c0df6['statedesc']=_0x55de('0x4f');return _0x2c0df6;};exports[_0x55de('0x50')]=function(_0x4d4663,_0x5211b0,_0x4cdc05){var _0x4b0b05={};_0x4b0b05[_0x5211b0]=_0x4d4663[_0x5211b0];_0x4b0b05['active']=![];_0x4b0b05['scheduledat']=moment()[_0x55de('0x51')](_0x4cdc05,_0x55de('0x52'))[_0x55de('0xf')](_0x55de('0x35'));_0x4b0b05['ContactId']=_0x4d4663[_0x55de('0x53')];_0x4b0b05[_0x55de('0x54')]=_0x4d4663[_0x55de('0x54')];_0x4b0b05['VoiceQueueId']=_0x4d4663[_0x55de('0x1b')]||undefined;return _0x4b0b05;};exports[_0x55de('0x55')]=function(_0x570113,_0x41fee3){if(!_['isNil'](_0x570113)){if(_0x570113[_0x55de('0x56')]>0x0){_0x570113[_0x55de('0x56')]-=0x1;}else{logger[_0x55de('0x6')](_0x41fee3,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x55de('0x6')](_0x41fee3,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x55de('0x57')]=function(_0x48ef00){if(_0x48ef00<=0x0){return!![];}return![];};exports['buildObj']=function(_0x55ed41,_0x59f00f,_0x254dd5){_0x55ed41['lastevent']=_0x59f00f;_0x55ed41[_0x55de('0x17')]=_0x55ed41[_0x55de('0x58')];_0x55ed41[_0x55de('0x59')]=_0x55ed41[_0x55de('0x46')];if(_0x254dd5){_0x55ed41[_0x55de('0x5a')]=_0x254dd5[_0x55de('0x5a')];}return _0x55ed41;};exports[_0x55de('0x5b')]=function(_0x4105ef){var _0x1a7b03={};_0x1a7b03[_0x55de('0x58')]=_0x4105ef[_0x55de('0x58')];_0x1a7b03['interface']=_0x4105ef[_0x55de('0x46')];_0x1a7b03[_0x55de('0x45')]=_0x4105ef[_0x55de('0x45')];return _0x1a7b03;};exports[_0x55de('0x5c')]=function(_0x377873){var _0x4177d5=[];for(var _0x1ec1b3 in _0x377873){if(_0x377873['hasOwnProperty'](_0x1ec1b3)){if(!_[_0x55de('0x14')](_0x377873[_0x1ec1b3])&&_0x377873[_0x1ec1b3]['state']==='not_inuse'&&_0x377873[_0x1ec1b3][_0x55de('0x5d')]==='reachable'){_0x4177d5[_0x55de('0x5e')](_0x377873[_0x1ec1b3]['id']);}}}return _0x4177d5;};exports[_0x55de('0x5f')]=function(_0x406092){var _0x30268b=moment()[_0x55de('0x3')](0x0);var _0x22add8=moment(_0x406092)[_0x55de('0x3')](0x0);return _0x30268b[_0x55de('0x60')](_0x22add8,'seconds');};exports[_0x55de('0x61')]=function(_0x2e02ff){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e02ff[_0x55de('0x53')],'ListId':_0x2e02ff[_0x55de('0x54')],'VoiceQueueId':_0x2e02ff['VoiceQueueId']||undefined,'CampaignId':_0x2e02ff[_0x55de('0x62')]||undefined};};exports[_0x55de('0x63')]=function(_0x15407a){if(_0x15407a==='uniqueid'||_0x15407a==='idContact'||_0x15407a===_0x55de('0x58')||_0x15407a===_0x55de('0x64')||_0x15407a===_0x55de('0x65')||_0x15407a===_0x55de('0x66')||_0x15407a===_0x55de('0x3c')||_0x15407a===_0x55de('0x46')||_0x15407a===_0x55de('0x18')||_0x15407a==='active'||_0x15407a===_0x55de('0x19')||_0x15407a===_0x55de('0x67')||_0x15407a===_0x55de('0x49')||_0x15407a===_0x55de('0x68')||_0x15407a===_0x55de('0x4a')||_0x15407a===_0x55de('0x69')||_0x15407a===_0x55de('0x6a')||_0x15407a===_0x55de('0x6b')||_0x15407a===_0x55de('0x6c')||_0x15407a===_0x55de('0x6d')||_0x15407a===_0x55de('0x53')||_0x15407a==='ListId'||_0x15407a===_0x55de('0x3d')||_0x15407a===_0x55de('0x1b')||_0x15407a===_0x55de('0x6e')||_0x15407a===_0x55de('0x6f')||_0x15407a===_0x55de('0x70')||_0x15407a===_0x55de('0x71')||_0x15407a==='xmd-listid'||_0x15407a===_0x55de('0x72')||_0x15407a===_0x55de('0x73')||_0x15407a==='xmd-dialoptions'||_0x15407a===_0x55de('0x74')||_0x15407a==='xmd-dialchannel'||_0x15407a===_0x55de('0x75')||_0x15407a==='xmd-cdrtype'||_0x15407a===_0x55de('0x76')||_0x15407a==='xmd-agiafter'||_0x15407a===_0x55de('0x77')||_0x15407a==='rtpaudioqos'||_0x15407a==='rtpaudioqosbridged'||_0x15407a===_0x55de('0x78')||_0x15407a===_0x55de('0x79')||_0x15407a===_0x55de('0x7a')||_0x15407a==='rtpaudioqoslossbridged'||_0x15407a===_0x55de('0x7b')||_0x15407a==='rtpaudioqosrttbridged'||_0x15407a==='rtpaudioqos'||_0x15407a===_0x55de('0x7c')||_0x15407a===_0x55de('0x78')||_0x15407a==='rtpaudioqosjitterbridged'||_0x15407a===_0x55de('0x7a')||_0x15407a===_0x55de('0x7d')||_0x15407a===_0x55de('0x7b')||_0x15407a==='rtpaudioqosrttbridged'||_0x15407a==='bridgepeer'||_0x15407a===_0x55de('0x7e')||_0x15407a==='state'||_0x15407a==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5e4c32,_0x1cbb82){var _0xfad500,_0x2cd659,_0x16bc69;if(_0x1cbb82<=0x0){_0x1cbb82=0x1;}_0xfad500=new RegExp(_0x55de('0x7f')+_0x1cbb82+'}$');_0x2cd659=Math[_0x55de('0x80')](0xa,_0x1cbb82-0x1);_0x16bc69=Math['pow'](0xa,_0x1cbb82)-0x1;return util['format']('%s',_[_0x55de('0x81')](_0x5e4c32,_0xfad500,_['random'](_0x2cd659,_0x16bc69)));};exports[_0x55de('0x82')]=function(_0x43f91a){var _0x5d30e5=_0x43f91a['match'](/"(.*?)"/);return _0x5d30e5?_0x5d30e5[0x1]:_0x43f91a;};exports['extractCalleridNumber']=function(_0x9ed2c7){var _0x20803a=_0x9ed2c7[_0x55de('0x83')](/<(.*?)>/);return _0x20803a?_0x20803a[0x1]:_0x9ed2c7;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index fb8f013..ed96706 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x5c1b29,_0xf52e14){var _0x244ea7=function(_0x5c0fbc){while(--_0x5c0fbc){_0x5c1b29['push'](_0x5c1b29['shift']());}};_0x244ea7(++_0xf52e14);}(_0x7a54,0x106));var _0x47a5=function(_0x3eb0e4,_0x171648){_0x3eb0e4=_0x3eb0e4-0x0;var _0x4a7339=_0x7a54[_0x3eb0e4];return _0x4a7339;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x269e85,_0x2adc79){var _0x1ec486=function(_0x1a7400){while(--_0x1a7400){_0x269e85['push'](_0x269e85['shift']());}};_0x1ec486(++_0x2adc79);}(_0xb10b,0x12a));var _0xbb10=function(_0x132b71,_0x25f23e){_0x132b71=_0x132b71-0x0;var _0x224664=_0xb10b[_0x132b71];return _0x224664;};'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 0fec945..8337bb9 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 _0x34e8=['sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','name','initTelephones','length','initTrunks','initVoiceQueues','isUndefined','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','sumHoldTime','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','mapKeys','isNil','interface','total','answered','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned'];(function(_0x4183c8,_0x5f2454){var _0x1ee89a=function(_0x331592){while(--_0x331592){_0x4183c8['push'](_0x4183c8['shift']());}};_0x1ee89a(++_0x5f2454);}(_0x34e8,0x12c));var _0x834e=function(_0x40aceb,_0x40a85c){_0x40aceb=_0x40aceb-0x0;var _0x41c14f=_0x34e8[_0x40aceb];return _0x41c14f;};'use strict';var BPromise=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var _=require(_0x834e('0x2'));var moment=require(_0x834e('0x3'));var Agent=require('../model/agent');var Telephone=require(_0x834e('0x4'));var Trunk=require(_0x834e('0x5'));var VoiceQueue=require(_0x834e('0x6'));var Trigger=require(_0x834e('0x7'));var Template=require(_0x834e('0x8'));var Campaign=require(_0x834e('0x9'));var VoiceExtension=require(_0x834e('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x834e('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x834e('0xc'));var ZohoAccount=require(_0x834e('0xd'));var DeskAccount=require(_0x834e('0xe'));var VtigerAccount=require(_0x834e('0xf'));var ServicenowAccount=require(_0x834e('0x10'));var Dynamics365Account=require(_0x834e('0x11'));var FreshsalesAccount=require(_0x834e('0x12'));var FaxAccount=require(_0x834e('0x13'));var Realtime=function(){this[_0x834e('0x14')]={};this[_0x834e('0x15')]={};this[_0x834e('0x16')]={};this[_0x834e('0x17')]={};this[_0x834e('0x18')]={};this[_0x834e('0x19')]={};this[_0x834e('0x1a')]={};this[_0x834e('0x1b')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x834e('0x1c')]={};this['channels']={};this[_0x834e('0x1d')]={};this[_0x834e('0x1e')]={};this['timers']={};this[_0x834e('0x1f')]={};this[_0x834e('0x20')]={};this[_0x834e('0x21')]={};this[_0x834e('0x22')]={};this['freshdeskAccounts']={};this[_0x834e('0x23')]={};this[_0x834e('0x24')]={};this['vtigerAccounts']={};this[_0x834e('0x25')]={};this['dynamics365Accounts']={};this[_0x834e('0x26')]={};this[_0x834e('0x27')]={};};function freeIsNotKey(_0x478afe,_0x43ac41,_0x22106e){var _0x370fb5=_['mapKeys'](_0x478afe,function(_0x283e56,_0x211e9a){return _0x283e56[_0x22106e];});for(var _0x34e41a in _0x43ac41){if(_0x43ac41[_0x834e('0x28')](_0x34e41a)){if(!_0x370fb5[_0x34e41a]){delete _0x43ac41[_0x34e41a];}}}}function freeIsNotKeySip(_0x237947,_0x254677){var _0x1dd214=_['mapKeys'](_0x237947,function(_0x2545b4,_0x1fd2c6){return util[_0x834e('0x29')](_0x834e('0x2a'),_0x2545b4['name']);});for(var _0x45a630 in _0x254677){if(_0x254677[_0x834e('0x28')](_0x45a630)){if(!_0x1dd214[_0x45a630]){delete _0x254677[_0x45a630];}}}}function freeIsNotKeyAgent(_0x5a05c0,_0x1b4bdf){var _0x28d687=_[_0x834e('0x2b')](_0x5a05c0,function(_0x5c55ca,_0x4e3f48){var _0x231619=_[_0x834e('0x2c')](_0x5c55ca['interface'])?util[_0x834e('0x29')](_0x834e('0x2a'),_0x5c55ca['name']):_0x5c55ca[_0x834e('0x2d')];return _0x231619;});for(var _0x2e1983 in _0x1b4bdf){if(_0x1b4bdf[_0x834e('0x28')](_0x2e1983)){if(!_0x28d687[_0x2e1983]){delete _0x1b4bdf[_0x2e1983];}}}}function clearVoiceCallReports(_0x561cd2){_0x561cd2[_0x834e('0x2e')]=0x0;_0x561cd2[_0x834e('0x2f')]=0x0;_0x561cd2['sumHoldTime']=0x0;_0x561cd2['sumDuration']=0x0;_0x561cd2[_0x834e('0x30')]=0x0;}function clearCampaigns(_0x508a1d){if(!_[_0x834e('0x31')](_0x508a1d)){for(var _0x3f1b0b in _0x508a1d){if(_0x508a1d[_0x834e('0x28')](_0x3f1b0b)){_0x508a1d[_0x3f1b0b][_0x834e('0x32')]=0x0;_0x508a1d[_0x3f1b0b][_0x834e('0x33')]=0x0;}}}}function clearVoiceQueues(_0x130cc5){if(!_['isEmpty'](_0x130cc5)){for(var _0x510780 in _0x130cc5){if(_0x130cc5['hasOwnProperty'](_0x510780)){_0x130cc5[_0x510780]['total']=0x0;_0x130cc5[_0x510780][_0x834e('0x2f')]=0x0;_0x130cc5[_0x510780][_0x834e('0x34')]=0x0;_0x130cc5[_0x510780][_0x834e('0x35')]=0x0;_0x130cc5[_0x510780]['sumHoldTime']=0x0;_0x130cc5[_0x510780][_0x834e('0x36')]=0x0;_0x130cc5[_0x510780][_0x834e('0x30')]=0x0;_0x130cc5[_0x510780][_0x834e('0x37')]=0x0;_0x130cc5[_0x510780][_0x834e('0x38')]=0x0;_0x130cc5[_0x510780][_0x834e('0x39')]=0x0;_0x130cc5[_0x510780][_0x834e('0x3a')]=0x0;_0x130cc5[_0x510780][_0x834e('0x3b')]=0x0;_0x130cc5[_0x510780][_0x834e('0x3c')]=0x0;_0x130cc5[_0x510780][_0x834e('0x3d')]=0x0;_0x130cc5[_0x510780]['outboundDropCallsDayCallersExit']=0x0;_0x130cc5[_0x510780][_0x834e('0x3e')]=0x0;_0x130cc5[_0x510780]['outboundOriginateFailureCallsDay']=0x0;_0x130cc5[_0x510780][_0x834e('0x3f')]=0x0;_0x130cc5[_0x510780][_0x834e('0x40')]=0x0;_0x130cc5[_0x510780][_0x834e('0x37')]=0x0;_0x130cc5[_0x510780][_0x834e('0x41')]=0x0;_0x130cc5[_0x510780][_0x834e('0x42')]=!![];}}}}Realtime[_0x834e('0x43')][_0x834e('0x44')]=function(_0x38cd29,_0x358c31){for(var _0x12b2bc in _0x358c31){if(_0x38cd29['hasOwnProperty'](_0x12b2bc)){_0x38cd29[_0x12b2bc]=_0x358c31[_0x12b2bc];}}};Realtime[_0x834e('0x43')][_0x834e('0x45')]=function(){var _0x24a9df=this;return function(_0xaf01f4){if(_0xaf01f4){freeIsNotKeyAgent(_0xaf01f4,_0x24a9df['agents']);for(var _0x3f88ad=0x0,_0x379d60={},_0x4b12f5={};_0x3f88ad<_0xaf01f4['length'];_0x3f88ad+=0x1){_0x379d60=_0xaf01f4[_0x3f88ad];var _0x59385a=_[_0x834e('0x2c')](_0x379d60[_0x834e('0x2d')])?util[_0x834e('0x29')](_0x834e('0x2a'),_0x379d60[_0x834e('0x46')]):_0x379d60[_0x834e('0x2d')];if(_['isUndefined'](_0x24a9df[_0x834e('0x14')][_0x59385a])){_0x24a9df['agents'][_0x59385a]=new Agent(_0x379d60);}else{_0x24a9df[_0x834e('0x44')](_0x24a9df[_0x834e('0x14')][_0x59385a],_0x379d60);}}}return _0x24a9df['agents'];};};Realtime[_0x834e('0x43')][_0x834e('0x47')]=function(){var _0x491c28=this;return function(_0x481f70){if(_0x481f70){freeIsNotKeySip(_0x481f70,_0x491c28[_0x834e('0x15')]);for(var _0xd0d43a=0x0,_0x2e9383={},_0x130c23={};_0xd0d43a<_0x481f70[_0x834e('0x48')];_0xd0d43a+=0x1){_0x2e9383=_0x481f70[_0xd0d43a];if(_['isUndefined'](_0x491c28[_0x834e('0x15')][util['format']('SIP/%s',_0x2e9383[_0x834e('0x46')])])){_0x491c28['telephones'][util[_0x834e('0x29')](_0x834e('0x2a'),_0x2e9383[_0x834e('0x46')])]=new Telephone(_0x2e9383);}else{_0x491c28[_0x834e('0x44')](_0x491c28[_0x834e('0x15')][util['format'](_0x834e('0x2a'),_0x2e9383[_0x834e('0x46')])],_0x2e9383);}}}return _0x491c28[_0x834e('0x15')];};};Realtime['prototype'][_0x834e('0x49')]=function(){var _0x16ac45=this;return function(_0x57b89a){if(_0x57b89a){freeIsNotKeySip(_0x57b89a,_0x16ac45[_0x834e('0x16')]);for(var _0x59932f=0x0,_0x2ebfb6={},_0x585335={};_0x59932f<_0x57b89a['length'];_0x59932f+=0x1){_0x2ebfb6=_0x57b89a[_0x59932f];if(_['isUndefined'](_0x16ac45[_0x834e('0x16')][util[_0x834e('0x29')](_0x834e('0x2a'),_0x2ebfb6[_0x834e('0x46')])])){_0x16ac45[_0x834e('0x16')][util[_0x834e('0x29')](_0x834e('0x2a'),_0x2ebfb6['name'])]=new Trunk(_0x2ebfb6);}else{_0x16ac45[_0x834e('0x44')](_0x16ac45['trunks'][util[_0x834e('0x29')]('SIP/%s',_0x2ebfb6[_0x834e('0x46')])],_0x2ebfb6);}}}return _0x16ac45['trunks'];};};Realtime[_0x834e('0x43')][_0x834e('0x4a')]=function(){var _0x51c731=this;return function(_0x39e7b9){if(_0x39e7b9){freeIsNotKey(_0x39e7b9,_0x51c731[_0x834e('0x17')],_0x834e('0x46'));for(var _0xd55cc3=0x0,_0x252ea0={},_0x1a7149={};_0xd55cc3<_0x39e7b9[_0x834e('0x48')];_0xd55cc3+=0x1){_0x252ea0=_0x39e7b9[_0xd55cc3];if(_[_0x834e('0x4b')](_0x51c731[_0x834e('0x17')][_0x252ea0[_0x834e('0x46')]])){_0x51c731['voiceQueues'][_0x252ea0[_0x834e('0x46')]]=new VoiceQueue(_0x252ea0);}else{_0x51c731[_0x834e('0x44')](_0x51c731['voiceQueues'][_0x252ea0[_0x834e('0x46')]],_0x252ea0);}}}return _0x51c731[_0x834e('0x17')];};};Realtime[_0x834e('0x43')][_0x834e('0x4c')]=function(){var _0x19b5ef=this;return function(_0x4264b8){if(_0x4264b8){freeIsNotKey(_0x4264b8,_0x19b5ef['triggers'],'id');for(var _0x59c855=0x0,_0x954d4b={},_0x1a5444={};_0x59c855<_0x4264b8[_0x834e('0x48')];_0x59c855+=0x1){_0x954d4b=_0x4264b8[_0x59c855];if(_[_0x834e('0x4b')](_0x19b5ef[_0x834e('0x18')][_0x954d4b['id']])){_0x19b5ef[_0x834e('0x18')][_0x954d4b['id']]=new Trigger(_0x954d4b);}else{_0x19b5ef[_0x834e('0x44')](_0x19b5ef[_0x834e('0x18')][_0x954d4b['id']],_0x954d4b);}}}return _0x19b5ef[_0x834e('0x18')];};};Realtime[_0x834e('0x43')][_0x834e('0x4d')]=function(){var _0x385435=this;return function(_0x1a28f6){if(_0x1a28f6){freeIsNotKey(_0x1a28f6,_0x385435[_0x834e('0x1a')],'id');for(var _0x2aa072=0x0,_0x1a3855={},_0x3df078={};_0x2aa072<_0x1a28f6[_0x834e('0x48')];_0x2aa072+=0x1){_0x1a3855=_0x1a28f6[_0x2aa072];if(_[_0x834e('0x4b')](_0x385435[_0x834e('0x1a')][_0x1a3855['id']])){_0x385435['templates'][_0x1a3855['id']]=new Template(_0x1a3855);}else{_0x385435[_0x834e('0x44')](_0x385435[_0x834e('0x1a')][_0x1a3855['id']],_0x1a3855);}}}return _0x385435['templates'];};};Realtime[_0x834e('0x43')][_0x834e('0x4e')]=function(){var _0x55d491=this;return function(_0x3dcca3){if(_0x3dcca3){freeIsNotKey(_0x3dcca3,_0x55d491[_0x834e('0x20')],'id');for(var _0x2cbc6f=0x0,_0x35636e={},_0x4288e4={};_0x2cbc6f<_0x3dcca3[_0x834e('0x48')];_0x2cbc6f+=0x1){_0x35636e=_0x3dcca3[_0x2cbc6f];if(_[_0x834e('0x4b')](_0x55d491['zendeskAccounts'][_0x35636e['id']])){_0x55d491[_0x834e('0x20')][_0x35636e['id']]=new ZendeskAccount(_0x35636e);}else{_0x55d491[_0x834e('0x44')](_0x55d491[_0x834e('0x20')][_0x35636e['id']],_0x35636e);}}}return _0x55d491[_0x834e('0x20')];};};Realtime[_0x834e('0x43')][_0x834e('0x4f')]=function(){var _0x344b51=this;return function(_0x1bc975){if(_0x1bc975){freeIsNotKey(_0x1bc975,_0x344b51['salesforceAccounts'],'id');for(var _0x11778e=0x0,_0x4dc104={},_0x2f4bde={};_0x11778e<_0x1bc975['length'];_0x11778e+=0x1){_0x4dc104=_0x1bc975[_0x11778e];if(_[_0x834e('0x4b')](_0x344b51['salesforceAccounts'][_0x4dc104['id']])){_0x344b51['salesforceAccounts'][_0x4dc104['id']]=new SalesforceAccount(_0x4dc104);}else{_0x344b51[_0x834e('0x44')](_0x344b51[_0x834e('0x21')][_0x4dc104['id']],_0x4dc104);}}}return _0x344b51['salesforceAccounts'];};};Realtime['prototype'][_0x834e('0x50')]=function(){var _0x2452b4=this;return function(_0x138ed2){if(_0x138ed2){freeIsNotKey(_0x138ed2,_0x2452b4[_0x834e('0x51')],'id');for(var _0x21c417=0x0,_0x315858={},_0x3d3f2b={};_0x21c417<_0x138ed2[_0x834e('0x48')];_0x21c417+=0x1){_0x315858=_0x138ed2[_0x21c417];if(_['isUndefined'](_0x2452b4[_0x834e('0x51')][_0x315858['id']])){_0x2452b4[_0x834e('0x51')][_0x315858['id']]=new FreshdeskAccount(_0x315858);}else{_0x2452b4['mergeFromDatabase'](_0x2452b4[_0x834e('0x51')][_0x315858['id']],_0x315858);}}}return _0x2452b4['freshdeskAccounts'];};};Realtime[_0x834e('0x43')][_0x834e('0x52')]=function(){var _0x5160c4=this;return function(_0x41ef86){if(_0x41ef86){freeIsNotKey(_0x41ef86,_0x5160c4[_0x834e('0x23')],'id');for(var _0x2de29a=0x0,_0x25f720={},_0x5a2924={};_0x2de29a<_0x41ef86[_0x834e('0x48')];_0x2de29a+=0x1){_0x25f720=_0x41ef86[_0x2de29a];if(_[_0x834e('0x4b')](_0x5160c4[_0x834e('0x23')][_0x25f720['id']])){_0x5160c4['zohoAccounts'][_0x25f720['id']]=new ZohoAccount(_0x25f720);}else{_0x5160c4[_0x834e('0x44')](_0x5160c4[_0x834e('0x23')][_0x25f720['id']],_0x25f720);}}}return _0x5160c4[_0x834e('0x23')];};};Realtime[_0x834e('0x43')][_0x834e('0x53')]=function(){var _0x125f37=this;return function(_0x3a1426){if(_0x3a1426){freeIsNotKey(_0x3a1426,_0x125f37[_0x834e('0x24')],'id');for(var _0x208c21=0x0,_0xfcccd8={},_0x1e4310={};_0x208c21<_0x3a1426[_0x834e('0x48')];_0x208c21+=0x1){_0xfcccd8=_0x3a1426[_0x208c21];if(_[_0x834e('0x4b')](_0x125f37[_0x834e('0x24')][_0xfcccd8['id']])){_0x125f37[_0x834e('0x24')][_0xfcccd8['id']]=new DeskAccount(_0xfcccd8);}else{_0x125f37[_0x834e('0x44')](_0x125f37[_0x834e('0x24')][_0xfcccd8['id']],_0xfcccd8);}}}return _0x125f37[_0x834e('0x24')];};};Realtime[_0x834e('0x43')][_0x834e('0x54')]=function(){var _0xed4081=this;return function(_0x2cb233){if(_0x2cb233){freeIsNotKey(_0x2cb233,_0xed4081['sugarcrmAccounts'],'id');for(var _0x2145cf=0x0,_0x25d6f4={},_0x45bcc2={};_0x2145cf<_0x2cb233[_0x834e('0x48')];_0x2145cf+=0x1){_0x25d6f4=_0x2cb233[_0x2145cf];if(_['isUndefined'](_0xed4081[_0x834e('0x22')][_0x25d6f4['id']])){_0xed4081['sugarcrmAccounts'][_0x25d6f4['id']]=new SugarcrmAccount(_0x25d6f4);}else{_0xed4081['mergeFromDatabase'](_0xed4081[_0x834e('0x22')][_0x25d6f4['id']],_0x25d6f4);}}}return _0xed4081[_0x834e('0x22')];};};Realtime[_0x834e('0x43')][_0x834e('0x55')]=function(){var _0x216105=this;return function(_0x3821ad){if(_0x3821ad){freeIsNotKey(_0x3821ad,_0x216105[_0x834e('0x56')],'id');for(var _0xe5c8f6=0x0,_0x525ed3={},_0xdef8c4={};_0xe5c8f6<_0x3821ad['length'];_0xe5c8f6+=0x1){_0x525ed3=_0x3821ad[_0xe5c8f6];if(_[_0x834e('0x4b')](_0x216105[_0x834e('0x56')][_0x525ed3['id']])){_0x216105['vtigerAccounts'][_0x525ed3['id']]=new VtigerAccount(_0x525ed3);}else{_0x216105['mergeFromDatabase'](_0x216105[_0x834e('0x56')][_0x525ed3['id']],_0x525ed3);}}}return _0x216105[_0x834e('0x56')];};};Realtime[_0x834e('0x43')][_0x834e('0x57')]=function(){var _0x2c41bd=this;return function(_0x5a4854){if(_0x5a4854){freeIsNotKey(_0x5a4854,_0x2c41bd[_0x834e('0x25')],'id');for(var _0x15018f=0x0,_0x2df64f={},_0x228a60={};_0x15018f<_0x5a4854[_0x834e('0x48')];_0x15018f+=0x1){_0x2df64f=_0x5a4854[_0x15018f];if(_[_0x834e('0x4b')](_0x2c41bd[_0x834e('0x25')][_0x2df64f['id']])){_0x2c41bd[_0x834e('0x25')][_0x2df64f['id']]=new ServicenowAccount(_0x2df64f);}else{_0x2c41bd[_0x834e('0x44')](_0x2c41bd[_0x834e('0x25')][_0x2df64f['id']],_0x2df64f);}}}return _0x2c41bd['servicenowAccounts'];};};Realtime[_0x834e('0x43')][_0x834e('0x58')]=function(){var _0x42fc96=this;return function(_0x5b5d6f){if(_0x5b5d6f){freeIsNotKey(_0x5b5d6f,_0x42fc96['dynamics365Accounts'],'id');for(var _0x46fa0d=0x0,_0x4ac5f2={},_0x5ce8b0={};_0x46fa0d<_0x5b5d6f['length'];_0x46fa0d+=0x1){_0x4ac5f2=_0x5b5d6f[_0x46fa0d];if(_[_0x834e('0x4b')](_0x42fc96[_0x834e('0x59')][_0x4ac5f2['id']])){_0x42fc96['dynamics365Accounts'][_0x4ac5f2['id']]=new Dynamics365Account(_0x4ac5f2);}else{_0x42fc96[_0x834e('0x44')](_0x42fc96[_0x834e('0x59')][_0x4ac5f2['id']],_0x4ac5f2);}}}return _0x42fc96['dynamics365Accounts'];};};Realtime[_0x834e('0x43')][_0x834e('0x5a')]=function(){var _0x4b88e7=this;return function(_0x5df169){if(_0x5df169){freeIsNotKey(_0x5df169,_0x4b88e7[_0x834e('0x26')],'id');for(var _0x2a42a3=0x0,_0x8bc7d9={},_0x44c909={};_0x2a42a3<_0x5df169[_0x834e('0x48')];_0x2a42a3+=0x1){_0x8bc7d9=_0x5df169[_0x2a42a3];if(_['isUndefined'](_0x4b88e7[_0x834e('0x26')][_0x8bc7d9['id']])){_0x4b88e7['freshsalesAccounts'][_0x8bc7d9['id']]=new FreshsalesAccount(_0x8bc7d9);}else{_0x4b88e7[_0x834e('0x44')](_0x4b88e7[_0x834e('0x26')][_0x8bc7d9['id']],_0x8bc7d9);}}}return _0x4b88e7[_0x834e('0x26')];};};Realtime['prototype'][_0x834e('0x5b')]=function(){var _0x11f6f0=this;return function(_0x48521f){for(var _0x3f7087=0x0;_0x3f7087<_0x48521f[_0x834e('0x48')];_0x3f7087+=0x1){_[_0x834e('0x5c')](_0x11f6f0['voiceQueues'][_0x48521f[_0x3f7087][_0x834e('0x46')]],_0x48521f[_0x3f7087]);}return _0x11f6f0[_0x834e('0x17')];};};Realtime[_0x834e('0x43')][_0x834e('0x5d')]=function(){var _0x1a7399=this;return function(_0x29bfd7){clearVoiceQueues(_0x1a7399[_0x834e('0x17')]);if(_0x29bfd7){_0x29bfd7=_[_0x834e('0x5e')](_0x29bfd7,_0x834e('0x5f'));for(var _0x1691d5 in _0x29bfd7){if(_0x29bfd7['hasOwnProperty'](_0x1691d5)){var _0x5c3945={};for(var _0x4e466e=0x0;_0x4e466e<_0x29bfd7[_0x1691d5][_0x834e('0x48')];_0x4e466e+=0x1){var _0x1135a5=_0x29bfd7[_0x1691d5][_0x4e466e][_0x834e('0x60')];if(_0x1a7399[_0x834e('0x17')][_0x1135a5]){if(_0x29bfd7[_0x1691d5][_0x4e466e][_0x834e('0x61')]){_0x1a7399['voiceQueues'][_0x1135a5]['unmanaged']+=0x1;}if(_0x29bfd7[_0x1691d5][_0x4e466e][_0x834e('0x62')]){_0x1a7399[_0x834e('0x17')][_0x1135a5][_0x834e('0x35')]+=0x1;}_0x1a7399[_0x834e('0x17')][_0x1135a5][_0x834e('0x63')]+=moment(_0x29bfd7[_0x1691d5][_0x4e466e]['queuecallerleaveAt'])[_0x834e('0x64')](moment(_0x29bfd7[_0x1691d5][_0x4e466e][_0x834e('0x65')]),_0x834e('0x66'))||0x0;if(_0x4e466e===_0x29bfd7[_0x1691d5]['length']-0x1){_0x1a7399[_0x834e('0x17')][_0x1135a5][_0x834e('0x36')]+=moment(_0x29bfd7[_0x1691d5][_0x4e466e][_0x834e('0x67')]||_0x29bfd7[_0x1691d5][_0x4e466e][_0x834e('0x68')]||_0x29bfd7[_0x1691d5][_0x4e466e][_0x834e('0x69')])['diff'](moment(_0x29bfd7[_0x1691d5][_0x4e466e]['queuecallerjoinAt']),_0x834e('0x66'))||0x0;_0x1a7399[_0x834e('0x17')][_0x1135a5]['total']+=0x1;if(_0x29bfd7[_0x1691d5][_0x4e466e][_0x834e('0x6a')]){_0x1a7399['voiceQueues'][_0x1135a5][_0x834e('0x2f')]+=0x1;_0x1a7399[_0x834e('0x17')][_0x1135a5][_0x834e('0x30')]+=moment(_0x29bfd7[_0x1691d5][_0x4e466e]['queuecallercompleteAt'])[_0x834e('0x64')](moment(_0x29bfd7[_0x1691d5][_0x4e466e]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x1a7399['voiceQueues'][_0x1135a5][_0x834e('0x36')]+=_0x1a7399[_0x834e('0x17')][_0x1135a5][_0x834e('0x63')]||0x0;}}}}}}return _0x1a7399[_0x834e('0x17')];};};Realtime[_0x834e('0x43')][_0x834e('0x6b')]=function(){var _0x3aa388=this;return function(_0x179892){clearVoiceCallReports(_0x3aa388[_0x834e('0x1b')]);if(_0x179892){for(var _0x53f6e3=0x0;_0x53f6e3<_0x179892[_0x834e('0x48')];_0x53f6e3+=0x1){_0x3aa388['outbound'][_0x834e('0x2e')]+=0x1;_0x3aa388[_0x834e('0x1b')][_0x834e('0x36')]+=_0x179892[_0x53f6e3][_0x834e('0x6c')];if(_0x179892[_0x53f6e3][_0x834e('0x6d')]===_0x834e('0x6e')){_0x3aa388['outbound']['answered']+=0x1;_0x3aa388[_0x834e('0x1b')][_0x834e('0x63')]+=_0x179892[_0x53f6e3]['duration']-_0x179892[_0x53f6e3][_0x834e('0x6f')]||0x0;_0x3aa388[_0x834e('0x1b')][_0x834e('0x30')]+=_0x179892[_0x53f6e3][_0x834e('0x6f')];}}}return _0x3aa388[_0x834e('0x1b')];};};Realtime['prototype'][_0x834e('0x70')]=function(){var _0x78917b=this;return function(_0x4c319d){if(_0x4c319d){freeIsNotKey(_0x4c319d,_0x78917b['campaigns'],'name');for(var _0x1e5252=0x0,_0x1f3e26={};_0x1e5252<_0x4c319d['length'];_0x1e5252+=0x1){_0x1f3e26=_0x4c319d[_0x1e5252];if(_[_0x834e('0x4b')](_0x78917b[_0x834e('0x19')][_0x1f3e26['name']])){_0x78917b[_0x834e('0x19')][_0x1f3e26['name']]=new Campaign(_0x1f3e26);}else{_0x78917b['mergeFromDatabase'](_0x78917b[_0x834e('0x19')][_0x1f3e26[_0x834e('0x46')]],_0x1f3e26);_0x78917b[_0x834e('0x19')][_0x1f3e26[_0x834e('0x46')]]['dialQueueProject']=_0x1f3e26[_0x834e('0x71')]?_0x1f3e26[_0x834e('0x71')][_0x834e('0x46')]:undefined;}}}return _0x78917b[_0x834e('0x19')];};};Realtime[_0x834e('0x43')][_0x834e('0x72')]=function(){var _0x1974bd=this;return function(_0x15e141){if(_0x15e141){freeIsNotKey(_0x15e141,_0x1974bd[_0x834e('0x1c')],'id');for(var _0x2821fe=0x0,_0x2fa64c={};_0x2821fe<_0x15e141[_0x834e('0x48')];_0x2821fe+=0x1){_0x2fa64c=_0x15e141[_0x2821fe];if(_[_0x834e('0x4b')](_0x1974bd[_0x834e('0x1c')][_0x2fa64c['id']])){_0x1974bd[_0x834e('0x1c')][_0x2fa64c['id']]=new VoiceExtension(_0x2fa64c);}else{_0x1974bd[_0x834e('0x44')](_0x1974bd[_0x834e('0x1c')][_0x2fa64c['id']],_0x2fa64c);}}}return _0x1974bd[_0x834e('0x1c')];};};Realtime[_0x834e('0x43')][_0x834e('0x73')]=function(){var _0x2c634b=this;return function(_0xdedb54){clearCampaigns(_0x2c634b['campaigns']);for(var _0x325ce1=0x0;_0x325ce1<_0xdedb54[_0x834e('0x48')];_0x325ce1+=0x1){_[_0x834e('0x5c')](_0x2c634b[_0x834e('0x19')][_0xdedb54[_0x325ce1][_0x834e('0x46')]],_0xdedb54[_0x325ce1]);}return _0x2c634b[_0x834e('0x19')];};};Realtime[_0x834e('0x43')][_0x834e('0x74')]=function(){var _0x11ca03=this;return function(_0x4d226b){if(_0x4d226b){freeIsNotKey(_0x4d226b,_0x11ca03['faxAccounts'],'id');for(var _0x5549f8=0x0,_0x150ed8={},_0x493e1f={};_0x5549f8<_0x4d226b[_0x834e('0x48')];_0x5549f8+=0x1){_0x150ed8=_0x4d226b[_0x5549f8];if(_[_0x834e('0x4b')](_0x11ca03[_0x834e('0x27')][_0x150ed8['id']])){_0x11ca03['faxAccounts'][_0x150ed8['id']]=new FaxAccount(_0x150ed8);}else{_0x11ca03[_0x834e('0x44')](_0x11ca03[_0x834e('0x27')][_0x150ed8['id']],_0x150ed8);}}}return _0x11ca03[_0x834e('0x27')];};};module[_0x834e('0x75')]=Realtime; \ No newline at end of file +var _0x9f62=['isUndefined','initTelephones','telephones','initTrunks','trunks','length','initTriggers','initTemplates','initZendeskAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerleaveAt','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/agent','../model/telephone','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/faxAccount','agents','voiceQueues','triggers','templates','outbound','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','name','mapKeys','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','prototype','mergeFromDatabase','initAgents','isNil'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x9f62,0x154));var _0x29f6=function(_0x5b1abe,_0xd969f8){_0x5b1abe=_0x5b1abe-0x0;var _0x2d480e=_0x9f62[_0x5b1abe];return _0x2d480e;};'use strict';var BPromise=require('bluebird');var util=require(_0x29f6('0x0'));var _=require('lodash');var moment=require(_0x29f6('0x1'));var Agent=require(_0x29f6('0x2'));var Telephone=require(_0x29f6('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x29f6('0x4'));var Template=require(_0x29f6('0x5'));var Campaign=require(_0x29f6('0x6'));var VoiceExtension=require(_0x29f6('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x29f6('0x8'));var FreshdeskAccount=require(_0x29f6('0x9'));var SugarcrmAccount=require(_0x29f6('0xa'));var ZohoAccount=require(_0x29f6('0xb'));var DeskAccount=require(_0x29f6('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x29f6('0xd'));var Realtime=function(){this[_0x29f6('0xe')]={};this['telephones']={};this['trunks']={};this[_0x29f6('0xf')]={};this[_0x29f6('0x10')]={};this['campaigns']={};this[_0x29f6('0x11')]={};this[_0x29f6('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0x29f6('0x13')]={};this[_0x29f6('0x14')]={};this[_0x29f6('0x15')]={};this[_0x29f6('0x16')]={};this[_0x29f6('0x17')]={};this[_0x29f6('0x18')]={};this[_0x29f6('0x19')]={};this[_0x29f6('0x1a')]={};this[_0x29f6('0x1b')]={};this[_0x29f6('0x1c')]={};this[_0x29f6('0x1d')]={};this[_0x29f6('0x1e')]={};this[_0x29f6('0x1f')]={};};function freeIsNotKey(_0x3a75d0,_0x25e5a2,_0x14dd56){var _0x3584a1=_['mapKeys'](_0x3a75d0,function(_0x51c92f,_0x2e66d3){return _0x51c92f[_0x14dd56];});for(var _0x3af478 in _0x25e5a2){if(_0x25e5a2[_0x29f6('0x20')](_0x3af478)){if(!_0x3584a1[_0x3af478]){delete _0x25e5a2[_0x3af478];}}}}function freeIsNotKeySip(_0x5c8246,_0xcb90){var _0x46931d=_['mapKeys'](_0x5c8246,function(_0x159227,_0x3e81af){return util[_0x29f6('0x21')](_0x29f6('0x22'),_0x159227[_0x29f6('0x23')]);});for(var _0x2bfb3d in _0xcb90){if(_0xcb90['hasOwnProperty'](_0x2bfb3d)){if(!_0x46931d[_0x2bfb3d]){delete _0xcb90[_0x2bfb3d];}}}}function freeIsNotKeyAgent(_0xfb8fd2,_0x59def4){var _0x4acb15=_[_0x29f6('0x24')](_0xfb8fd2,function(_0x1fa159,_0x39c6b3){var _0xafb5dd=_['isNil'](_0x1fa159[_0x29f6('0x25')])?util['format'](_0x29f6('0x22'),_0x1fa159[_0x29f6('0x23')]):_0x1fa159[_0x29f6('0x25')];return _0xafb5dd;});for(var _0x1b80aa in _0x59def4){if(_0x59def4['hasOwnProperty'](_0x1b80aa)){if(!_0x4acb15[_0x1b80aa]){delete _0x59def4[_0x1b80aa];}}}}function clearVoiceCallReports(_0x4290a2){_0x4290a2[_0x29f6('0x26')]=0x0;_0x4290a2['answered']=0x0;_0x4290a2[_0x29f6('0x27')]=0x0;_0x4290a2[_0x29f6('0x28')]=0x0;_0x4290a2[_0x29f6('0x29')]=0x0;}function clearCampaigns(_0x342038){if(!_[_0x29f6('0x2a')](_0x342038)){for(var _0x4333bc in _0x342038){if(_0x342038[_0x29f6('0x20')](_0x4333bc)){_0x342038[_0x4333bc]['ivrTotalCallsDays']=0x0;_0x342038[_0x4333bc][_0x29f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x454a4a){if(!_[_0x29f6('0x2a')](_0x454a4a)){for(var _0x3dace7 in _0x454a4a){if(_0x454a4a[_0x29f6('0x20')](_0x3dace7)){_0x454a4a[_0x3dace7][_0x29f6('0x26')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x2c')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x2d')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x2e')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x27')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x28')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x29')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x2f')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x30')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x31')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x32')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x33')]=0x0;_0x454a4a[_0x3dace7]['outboundUnknownCallsDay']=0x0;_0x454a4a[_0x3dace7]['outboundDropCallsDayTimeout']=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x34')]=0x0;_0x454a4a[_0x3dace7]['outboundBlacklistCallsDay']=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x35')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x36')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x37')]=0x0;_0x454a4a[_0x3dace7][_0x29f6('0x2f')]=0x0;_0x454a4a[_0x3dace7]['outboundAnswerCallsDay']=0x0;_0x454a4a[_0x3dace7]['queueStatusComplete']=!![];}}}}Realtime[_0x29f6('0x38')][_0x29f6('0x39')]=function(_0x2edc2e,_0x3aaeda){for(var _0x3a223b in _0x3aaeda){if(_0x2edc2e[_0x29f6('0x20')](_0x3a223b)){_0x2edc2e[_0x3a223b]=_0x3aaeda[_0x3a223b];}}};Realtime[_0x29f6('0x38')][_0x29f6('0x3a')]=function(){var _0xad83a3=this;return function(_0x3bd7cf){if(_0x3bd7cf){freeIsNotKeyAgent(_0x3bd7cf,_0xad83a3[_0x29f6('0xe')]);for(var _0x2aba6c=0x0,_0x161d27={},_0x23ad1a={};_0x2aba6c<_0x3bd7cf['length'];_0x2aba6c+=0x1){_0x161d27=_0x3bd7cf[_0x2aba6c];var _0x5e31dd=_[_0x29f6('0x3b')](_0x161d27[_0x29f6('0x25')])?util[_0x29f6('0x21')]('SIP/%s',_0x161d27[_0x29f6('0x23')]):_0x161d27[_0x29f6('0x25')];if(_[_0x29f6('0x3c')](_0xad83a3[_0x29f6('0xe')][_0x5e31dd])){_0xad83a3[_0x29f6('0xe')][_0x5e31dd]=new Agent(_0x161d27);}else{_0xad83a3['mergeFromDatabase'](_0xad83a3[_0x29f6('0xe')][_0x5e31dd],_0x161d27);}}}return _0xad83a3[_0x29f6('0xe')];};};Realtime[_0x29f6('0x38')][_0x29f6('0x3d')]=function(){var _0x4f5fe1=this;return function(_0x30d747){if(_0x30d747){freeIsNotKeySip(_0x30d747,_0x4f5fe1[_0x29f6('0x3e')]);for(var _0x14b392=0x0,_0x105557={},_0x5ddc09={};_0x14b392<_0x30d747['length'];_0x14b392+=0x1){_0x105557=_0x30d747[_0x14b392];if(_[_0x29f6('0x3c')](_0x4f5fe1['telephones'][util[_0x29f6('0x21')]('SIP/%s',_0x105557[_0x29f6('0x23')])])){_0x4f5fe1['telephones'][util[_0x29f6('0x21')](_0x29f6('0x22'),_0x105557['name'])]=new Telephone(_0x105557);}else{_0x4f5fe1[_0x29f6('0x39')](_0x4f5fe1['telephones'][util[_0x29f6('0x21')](_0x29f6('0x22'),_0x105557['name'])],_0x105557);}}}return _0x4f5fe1[_0x29f6('0x3e')];};};Realtime[_0x29f6('0x38')][_0x29f6('0x3f')]=function(){var _0x1e9d5a=this;return function(_0x47afbf){if(_0x47afbf){freeIsNotKeySip(_0x47afbf,_0x1e9d5a[_0x29f6('0x40')]);for(var _0x3d7d78=0x0,_0x11b329={},_0x2322eb={};_0x3d7d78<_0x47afbf[_0x29f6('0x41')];_0x3d7d78+=0x1){_0x11b329=_0x47afbf[_0x3d7d78];if(_['isUndefined'](_0x1e9d5a[_0x29f6('0x40')][util['format'](_0x29f6('0x22'),_0x11b329['name'])])){_0x1e9d5a[_0x29f6('0x40')][util[_0x29f6('0x21')]('SIP/%s',_0x11b329[_0x29f6('0x23')])]=new Trunk(_0x11b329);}else{_0x1e9d5a[_0x29f6('0x39')](_0x1e9d5a[_0x29f6('0x40')][util[_0x29f6('0x21')]('SIP/%s',_0x11b329[_0x29f6('0x23')])],_0x11b329);}}}return _0x1e9d5a[_0x29f6('0x40')];};};Realtime[_0x29f6('0x38')]['initVoiceQueues']=function(){var _0x3d8244=this;return function(_0x4a5f35){if(_0x4a5f35){freeIsNotKey(_0x4a5f35,_0x3d8244[_0x29f6('0xf')],'name');for(var _0x511c10=0x0,_0x53ded0={},_0x452db1={};_0x511c10<_0x4a5f35[_0x29f6('0x41')];_0x511c10+=0x1){_0x53ded0=_0x4a5f35[_0x511c10];if(_[_0x29f6('0x3c')](_0x3d8244[_0x29f6('0xf')][_0x53ded0[_0x29f6('0x23')]])){_0x3d8244[_0x29f6('0xf')][_0x53ded0[_0x29f6('0x23')]]=new VoiceQueue(_0x53ded0);}else{_0x3d8244[_0x29f6('0x39')](_0x3d8244[_0x29f6('0xf')][_0x53ded0[_0x29f6('0x23')]],_0x53ded0);}}}return _0x3d8244['voiceQueues'];};};Realtime['prototype'][_0x29f6('0x42')]=function(){var _0x450e76=this;return function(_0x7a65c0){if(_0x7a65c0){freeIsNotKey(_0x7a65c0,_0x450e76[_0x29f6('0x10')],'id');for(var _0x5c543e=0x0,_0x1e0010={},_0x1f5609={};_0x5c543e<_0x7a65c0['length'];_0x5c543e+=0x1){_0x1e0010=_0x7a65c0[_0x5c543e];if(_[_0x29f6('0x3c')](_0x450e76[_0x29f6('0x10')][_0x1e0010['id']])){_0x450e76[_0x29f6('0x10')][_0x1e0010['id']]=new Trigger(_0x1e0010);}else{_0x450e76[_0x29f6('0x39')](_0x450e76[_0x29f6('0x10')][_0x1e0010['id']],_0x1e0010);}}}return _0x450e76[_0x29f6('0x10')];};};Realtime[_0x29f6('0x38')][_0x29f6('0x43')]=function(){var _0x2ca712=this;return function(_0x8c2072){if(_0x8c2072){freeIsNotKey(_0x8c2072,_0x2ca712[_0x29f6('0x11')],'id');for(var _0xb9694=0x0,_0x58ea69={},_0x416c24={};_0xb9694<_0x8c2072[_0x29f6('0x41')];_0xb9694+=0x1){_0x58ea69=_0x8c2072[_0xb9694];if(_[_0x29f6('0x3c')](_0x2ca712[_0x29f6('0x11')][_0x58ea69['id']])){_0x2ca712[_0x29f6('0x11')][_0x58ea69['id']]=new Template(_0x58ea69);}else{_0x2ca712['mergeFromDatabase'](_0x2ca712[_0x29f6('0x11')][_0x58ea69['id']],_0x58ea69);}}}return _0x2ca712['templates'];};};Realtime['prototype'][_0x29f6('0x44')]=function(){var _0x4538de=this;return function(_0x3194fa){if(_0x3194fa){freeIsNotKey(_0x3194fa,_0x4538de[_0x29f6('0x15')],'id');for(var _0x24e4dd=0x0,_0x509caf={},_0x167976={};_0x24e4dd<_0x3194fa[_0x29f6('0x41')];_0x24e4dd+=0x1){_0x509caf=_0x3194fa[_0x24e4dd];if(_['isUndefined'](_0x4538de[_0x29f6('0x15')][_0x509caf['id']])){_0x4538de['zendeskAccounts'][_0x509caf['id']]=new ZendeskAccount(_0x509caf);}else{_0x4538de[_0x29f6('0x39')](_0x4538de[_0x29f6('0x15')][_0x509caf['id']],_0x509caf);}}}return _0x4538de[_0x29f6('0x15')];};};Realtime[_0x29f6('0x38')]['initSalesforceAccounts']=function(){var _0x199060=this;return function(_0xaa915c){if(_0xaa915c){freeIsNotKey(_0xaa915c,_0x199060[_0x29f6('0x16')],'id');for(var _0x217428=0x0,_0x3aa7eb={},_0x2d8e2b={};_0x217428<_0xaa915c[_0x29f6('0x41')];_0x217428+=0x1){_0x3aa7eb=_0xaa915c[_0x217428];if(_['isUndefined'](_0x199060[_0x29f6('0x16')][_0x3aa7eb['id']])){_0x199060[_0x29f6('0x16')][_0x3aa7eb['id']]=new SalesforceAccount(_0x3aa7eb);}else{_0x199060[_0x29f6('0x39')](_0x199060[_0x29f6('0x16')][_0x3aa7eb['id']],_0x3aa7eb);}}}return _0x199060[_0x29f6('0x16')];};};Realtime[_0x29f6('0x38')][_0x29f6('0x45')]=function(){var _0x2f356d=this;return function(_0x39d531){if(_0x39d531){freeIsNotKey(_0x39d531,_0x2f356d[_0x29f6('0x18')],'id');for(var _0x560162=0x0,_0x5d7c9a={},_0x29f210={};_0x560162<_0x39d531[_0x29f6('0x41')];_0x560162+=0x1){_0x5d7c9a=_0x39d531[_0x560162];if(_[_0x29f6('0x3c')](_0x2f356d['freshdeskAccounts'][_0x5d7c9a['id']])){_0x2f356d[_0x29f6('0x18')][_0x5d7c9a['id']]=new FreshdeskAccount(_0x5d7c9a);}else{_0x2f356d['mergeFromDatabase'](_0x2f356d['freshdeskAccounts'][_0x5d7c9a['id']],_0x5d7c9a);}}}return _0x2f356d[_0x29f6('0x18')];};};Realtime[_0x29f6('0x38')]['initZohoAccounts']=function(){var _0x49aec5=this;return function(_0x3e22f8){if(_0x3e22f8){freeIsNotKey(_0x3e22f8,_0x49aec5[_0x29f6('0x19')],'id');for(var _0x439c0b=0x0,_0x58694e={},_0x2bb909={};_0x439c0b<_0x3e22f8[_0x29f6('0x41')];_0x439c0b+=0x1){_0x58694e=_0x3e22f8[_0x439c0b];if(_[_0x29f6('0x3c')](_0x49aec5[_0x29f6('0x19')][_0x58694e['id']])){_0x49aec5[_0x29f6('0x19')][_0x58694e['id']]=new ZohoAccount(_0x58694e);}else{_0x49aec5[_0x29f6('0x39')](_0x49aec5[_0x29f6('0x19')][_0x58694e['id']],_0x58694e);}}}return _0x49aec5[_0x29f6('0x19')];};};Realtime[_0x29f6('0x38')][_0x29f6('0x46')]=function(){var _0x2d4c8d=this;return function(_0x31404f){if(_0x31404f){freeIsNotKey(_0x31404f,_0x2d4c8d[_0x29f6('0x1a')],'id');for(var _0x5078d1=0x0,_0x5e25c0={},_0x2bd7d9={};_0x5078d1<_0x31404f['length'];_0x5078d1+=0x1){_0x5e25c0=_0x31404f[_0x5078d1];if(_[_0x29f6('0x3c')](_0x2d4c8d[_0x29f6('0x1a')][_0x5e25c0['id']])){_0x2d4c8d[_0x29f6('0x1a')][_0x5e25c0['id']]=new DeskAccount(_0x5e25c0);}else{_0x2d4c8d[_0x29f6('0x39')](_0x2d4c8d[_0x29f6('0x1a')][_0x5e25c0['id']],_0x5e25c0);}}}return _0x2d4c8d['deskAccounts'];};};Realtime[_0x29f6('0x38')][_0x29f6('0x47')]=function(){var _0x2f694e=this;return function(_0x293f9d){if(_0x293f9d){freeIsNotKey(_0x293f9d,_0x2f694e[_0x29f6('0x17')],'id');for(var _0x56342e=0x0,_0x32291b={},_0x5accac={};_0x56342e<_0x293f9d['length'];_0x56342e+=0x1){_0x32291b=_0x293f9d[_0x56342e];if(_[_0x29f6('0x3c')](_0x2f694e[_0x29f6('0x17')][_0x32291b['id']])){_0x2f694e['sugarcrmAccounts'][_0x32291b['id']]=new SugarcrmAccount(_0x32291b);}else{_0x2f694e[_0x29f6('0x39')](_0x2f694e[_0x29f6('0x17')][_0x32291b['id']],_0x32291b);}}}return _0x2f694e['sugarcrmAccounts'];};};Realtime[_0x29f6('0x38')][_0x29f6('0x48')]=function(){var _0x94de9c=this;return function(_0x2f54eb){if(_0x2f54eb){freeIsNotKey(_0x2f54eb,_0x94de9c[_0x29f6('0x1b')],'id');for(var _0x44f2f9=0x0,_0x31903f={},_0x59a0d8={};_0x44f2f9<_0x2f54eb[_0x29f6('0x41')];_0x44f2f9+=0x1){_0x31903f=_0x2f54eb[_0x44f2f9];if(_['isUndefined'](_0x94de9c[_0x29f6('0x1b')][_0x31903f['id']])){_0x94de9c['vtigerAccounts'][_0x31903f['id']]=new VtigerAccount(_0x31903f);}else{_0x94de9c['mergeFromDatabase'](_0x94de9c[_0x29f6('0x1b')][_0x31903f['id']],_0x31903f);}}}return _0x94de9c[_0x29f6('0x1b')];};};Realtime[_0x29f6('0x38')]['initServicenowAccounts']=function(){var _0x6ae738=this;return function(_0x373cf6){if(_0x373cf6){freeIsNotKey(_0x373cf6,_0x6ae738[_0x29f6('0x1c')],'id');for(var _0x5625b1=0x0,_0x728094={},_0x35623a={};_0x5625b1<_0x373cf6[_0x29f6('0x41')];_0x5625b1+=0x1){_0x728094=_0x373cf6[_0x5625b1];if(_[_0x29f6('0x3c')](_0x6ae738[_0x29f6('0x1c')][_0x728094['id']])){_0x6ae738[_0x29f6('0x1c')][_0x728094['id']]=new ServicenowAccount(_0x728094);}else{_0x6ae738[_0x29f6('0x39')](_0x6ae738[_0x29f6('0x1c')][_0x728094['id']],_0x728094);}}}return _0x6ae738['servicenowAccounts'];};};Realtime[_0x29f6('0x38')][_0x29f6('0x49')]=function(){var _0x2e1de8=this;return function(_0x456578){if(_0x456578){freeIsNotKey(_0x456578,_0x2e1de8[_0x29f6('0x1d')],'id');for(var _0x122a1a=0x0,_0x1b14f5={},_0x18ae23={};_0x122a1a<_0x456578['length'];_0x122a1a+=0x1){_0x1b14f5=_0x456578[_0x122a1a];if(_[_0x29f6('0x3c')](_0x2e1de8[_0x29f6('0x1d')][_0x1b14f5['id']])){_0x2e1de8['dynamics365Accounts'][_0x1b14f5['id']]=new Dynamics365Account(_0x1b14f5);}else{_0x2e1de8[_0x29f6('0x39')](_0x2e1de8['dynamics365Accounts'][_0x1b14f5['id']],_0x1b14f5);}}}return _0x2e1de8[_0x29f6('0x1d')];};};Realtime[_0x29f6('0x38')]['initFreshsalesAccounts']=function(){var _0x2c8e28=this;return function(_0x4474f6){if(_0x4474f6){freeIsNotKey(_0x4474f6,_0x2c8e28['freshsalesAccounts'],'id');for(var _0x504fb8=0x0,_0x512ca5={},_0x2985fb={};_0x504fb8<_0x4474f6[_0x29f6('0x41')];_0x504fb8+=0x1){_0x512ca5=_0x4474f6[_0x504fb8];if(_[_0x29f6('0x3c')](_0x2c8e28[_0x29f6('0x1e')][_0x512ca5['id']])){_0x2c8e28[_0x29f6('0x1e')][_0x512ca5['id']]=new FreshsalesAccount(_0x512ca5);}else{_0x2c8e28[_0x29f6('0x39')](_0x2c8e28[_0x29f6('0x1e')][_0x512ca5['id']],_0x512ca5);}}}return _0x2c8e28['freshsalesAccounts'];};};Realtime[_0x29f6('0x38')][_0x29f6('0x4a')]=function(){var _0x411f3e=this;return function(_0x1869fe){for(var _0x4e0444=0x0;_0x4e0444<_0x1869fe[_0x29f6('0x41')];_0x4e0444+=0x1){_[_0x29f6('0x4b')](_0x411f3e[_0x29f6('0xf')][_0x1869fe[_0x4e0444][_0x29f6('0x23')]],_0x1869fe[_0x4e0444]);}return _0x411f3e[_0x29f6('0xf')];};};Realtime['prototype'][_0x29f6('0x4c')]=function(){var _0x1e2990=this;return function(_0x1d4e73){clearVoiceQueues(_0x1e2990[_0x29f6('0xf')]);if(_0x1d4e73){_0x1d4e73=_[_0x29f6('0x4d')](_0x1d4e73,_0x29f6('0x4e'));for(var _0x482807 in _0x1d4e73){if(_0x1d4e73[_0x29f6('0x20')](_0x482807)){var _0x4e3a86={};for(var _0x531c0e=0x0;_0x531c0e<_0x1d4e73[_0x482807]['length'];_0x531c0e+=0x1){var _0x842ae3=_0x1d4e73[_0x482807][_0x531c0e]['queue'];if(_0x1e2990[_0x29f6('0xf')][_0x842ae3]){if(_0x1d4e73[_0x482807][_0x531c0e][_0x29f6('0x4f')]){_0x1e2990[_0x29f6('0xf')][_0x842ae3][_0x29f6('0x2d')]+=0x1;}if(_0x1d4e73[_0x482807][_0x531c0e][_0x29f6('0x50')]){_0x1e2990[_0x29f6('0xf')][_0x842ae3][_0x29f6('0x2e')]+=0x1;}_0x1e2990['voiceQueues'][_0x842ae3][_0x29f6('0x27')]+=moment(_0x1d4e73[_0x482807][_0x531c0e]['queuecallerleaveAt'])[_0x29f6('0x51')](moment(_0x1d4e73[_0x482807][_0x531c0e][_0x29f6('0x52')]),_0x29f6('0x53'))||0x0;if(_0x531c0e===_0x1d4e73[_0x482807][_0x29f6('0x41')]-0x1){_0x1e2990[_0x29f6('0xf')][_0x842ae3][_0x29f6('0x28')]+=moment(_0x1d4e73[_0x482807][_0x531c0e][_0x29f6('0x54')]||_0x1d4e73[_0x482807][_0x531c0e][_0x29f6('0x55')]||_0x1d4e73[_0x482807][_0x531c0e][_0x29f6('0x56')])[_0x29f6('0x51')](moment(_0x1d4e73[_0x482807][_0x531c0e][_0x29f6('0x52')]),_0x29f6('0x53'))||0x0;_0x1e2990['voiceQueues'][_0x842ae3]['total']+=0x1;if(_0x1d4e73[_0x482807][_0x531c0e]['queuecallercomplete']){_0x1e2990[_0x29f6('0xf')][_0x842ae3][_0x29f6('0x2c')]+=0x1;_0x1e2990['voiceQueues'][_0x842ae3][_0x29f6('0x29')]+=moment(_0x1d4e73[_0x482807][_0x531c0e]['queuecallercompleteAt'])[_0x29f6('0x51')](moment(_0x1d4e73[_0x482807][_0x531c0e][_0x29f6('0x57')]),_0x29f6('0x53'))||0x0;}}else{_0x1e2990[_0x29f6('0xf')][_0x842ae3][_0x29f6('0x28')]+=_0x1e2990[_0x29f6('0xf')][_0x842ae3][_0x29f6('0x27')]||0x0;}}}}}}return _0x1e2990[_0x29f6('0xf')];};};Realtime[_0x29f6('0x38')][_0x29f6('0x58')]=function(){var _0x57228f=this;return function(_0x1d61ff){clearVoiceCallReports(_0x57228f['outbound']);if(_0x1d61ff){for(var _0x16bb3c=0x0;_0x16bb3c<_0x1d61ff[_0x29f6('0x41')];_0x16bb3c+=0x1){_0x57228f[_0x29f6('0x12')][_0x29f6('0x26')]+=0x1;_0x57228f[_0x29f6('0x12')][_0x29f6('0x28')]+=_0x1d61ff[_0x16bb3c][_0x29f6('0x59')];if(_0x1d61ff[_0x16bb3c][_0x29f6('0x5a')]==='ANSWERED'){_0x57228f[_0x29f6('0x12')][_0x29f6('0x2c')]+=0x1;_0x57228f['outbound']['sumHoldTime']+=_0x1d61ff[_0x16bb3c][_0x29f6('0x59')]-_0x1d61ff[_0x16bb3c][_0x29f6('0x5b')]||0x0;_0x57228f[_0x29f6('0x12')][_0x29f6('0x29')]+=_0x1d61ff[_0x16bb3c][_0x29f6('0x5b')];}}}return _0x57228f[_0x29f6('0x12')];};};Realtime[_0x29f6('0x38')][_0x29f6('0x5c')]=function(){var _0x7dd8b4=this;return function(_0x267187){if(_0x267187){freeIsNotKey(_0x267187,_0x7dd8b4[_0x29f6('0x5d')],_0x29f6('0x23'));for(var _0x55bb4d=0x0,_0x4b9631={};_0x55bb4d<_0x267187[_0x29f6('0x41')];_0x55bb4d+=0x1){_0x4b9631=_0x267187[_0x55bb4d];if(_[_0x29f6('0x3c')](_0x7dd8b4['campaigns'][_0x4b9631[_0x29f6('0x23')]])){_0x7dd8b4[_0x29f6('0x5d')][_0x4b9631[_0x29f6('0x23')]]=new Campaign(_0x4b9631);}else{_0x7dd8b4[_0x29f6('0x39')](_0x7dd8b4[_0x29f6('0x5d')][_0x4b9631[_0x29f6('0x23')]],_0x4b9631);_0x7dd8b4[_0x29f6('0x5d')][_0x4b9631['name']][_0x29f6('0x5e')]=_0x4b9631[_0x29f6('0x5f')]?_0x4b9631[_0x29f6('0x5f')]['name']:undefined;}}}return _0x7dd8b4[_0x29f6('0x5d')];};};Realtime[_0x29f6('0x38')]['initVoiceExtensions']=function(){var _0x25d8ef=this;return function(_0x24fd9b){if(_0x24fd9b){freeIsNotKey(_0x24fd9b,_0x25d8ef['voiceExtensions'],'id');for(var _0x554c11=0x0,_0x4c7a12={};_0x554c11<_0x24fd9b[_0x29f6('0x41')];_0x554c11+=0x1){_0x4c7a12=_0x24fd9b[_0x554c11];if(_[_0x29f6('0x3c')](_0x25d8ef[_0x29f6('0x60')][_0x4c7a12['id']])){_0x25d8ef[_0x29f6('0x60')][_0x4c7a12['id']]=new VoiceExtension(_0x4c7a12);}else{_0x25d8ef[_0x29f6('0x39')](_0x25d8ef[_0x29f6('0x60')][_0x4c7a12['id']],_0x4c7a12);}}}return _0x25d8ef['voiceExtensions'];};};Realtime['prototype'][_0x29f6('0x61')]=function(){var _0x285508=this;return function(_0x4f279a){clearCampaigns(_0x285508[_0x29f6('0x5d')]);for(var _0x537349=0x0;_0x537349<_0x4f279a[_0x29f6('0x41')];_0x537349+=0x1){_[_0x29f6('0x4b')](_0x285508[_0x29f6('0x5d')][_0x4f279a[_0x537349][_0x29f6('0x23')]],_0x4f279a[_0x537349]);}return _0x285508[_0x29f6('0x5d')];};};Realtime[_0x29f6('0x38')][_0x29f6('0x62')]=function(){var _0x5b7929=this;return function(_0x3b94de){if(_0x3b94de){freeIsNotKey(_0x3b94de,_0x5b7929[_0x29f6('0x1f')],'id');for(var _0x104747=0x0,_0x47e58b={},_0x59cd54={};_0x104747<_0x3b94de['length'];_0x104747+=0x1){_0x47e58b=_0x3b94de[_0x104747];if(_['isUndefined'](_0x5b7929[_0x29f6('0x1f')][_0x47e58b['id']])){_0x5b7929['faxAccounts'][_0x47e58b['id']]=new FaxAccount(_0x47e58b);}else{_0x5b7929['mergeFromDatabase'](_0x5b7929['faxAccounts'][_0x47e58b['id']],_0x47e58b);}}}return _0x5b7929[_0x29f6('0x1f')];};};module[_0x29f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index fa8e7e8..d5af401 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 _0x9b32=['./voiceCallReport','realtime','agents','telephones','sync','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','callerid','calleridnum','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','create','isArray','forEach','Local','indexOf','phone','substring','findAgent','transfererlinkedid','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport'];(function(_0x59a4ed,_0x1013de){var _0x195326=function(_0x18e519){while(--_0x18e519){_0x59a4ed['push'](_0x59a4ed['shift']());}};_0x195326(++_0x1013de);}(_0x9b32,0x9e));var _0x29b3=function(_0x104ab3,_0x46b15d){_0x104ab3=_0x104ab3-0x0;var _0x51b680=_0x9b32[_0x104ab3];return _0x51b680;};'use strict';var _=require(_0x29b3('0x0'));var moment=require('moment');var util=require(_0x29b3('0x1'));var config=require(_0x29b3('0x2'));var ami=require(_0x29b3('0x3'));var RpcVoiceAgentReport=require(_0x29b3('0x4'));var RpcVoiceCallReport=require(_0x29b3('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x29b3('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x29b3('0x7'));var RpcVoiceTransferReport=require(_0x29b3('0x8'));var VoiceQueueReport=require(_0x29b3('0x9'));var VoiceCallReport=require(_0x29b3('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x2e0593){this[_0x29b3('0xb')]=_0x2e0593;this[_0x29b3('0xc')]=_0x2e0593[_0x29b3('0xc')];this[_0x29b3('0xd')]=_0x2e0593[_0x29b3('0xd')];}Report['prototype'][_0x29b3('0xe')]=function(_0x56367b){var _0x38784f=new VoiceQueueReport(this['realtime']);var _0x4ee04f=new VoiceAgentReport(this[_0x29b3('0xb')]);var _0x28b625=new VoiceDialReport(this['realtime']);var _0x28649d=new VoiceCallReport(this[_0x29b3('0xb')]);var _0x39ddfc=new UserReport(this['realtime']);if(config['xdr']&&config['xdr'][_0x29b3('0xf')]){ami['on'](_0x29b3('0x10'),this[_0x29b3('0x11')][_0x29b3('0x12')](this));ami['on'](_0x29b3('0x13'),this[_0x29b3('0x14')][_0x29b3('0x12')](this));ami['on'](_0x29b3('0x15'),this[_0x29b3('0x16')][_0x29b3('0x12')](this));ami['on'](_0x29b3('0x17'),this[_0x29b3('0x18')][_0x29b3('0x12')](this));ami['on'](_0x29b3('0x19'),this[_0x29b3('0x1a')][_0x29b3('0x12')](this));ami['on']('attendedtransfer',this[_0x29b3('0x1b')][_0x29b3('0x12')](this));}};Report[_0x29b3('0x1c')]['findAgent']=function(_0x3ff2d5){var _0x96e551;_0x96e551=_[_0x29b3('0x1d')](this[_0x29b3('0xc')],function(_0x32712b){return _0x32712b[_0x29b3('0x1e')]==_0x3ff2d5||_0x32712b[_0x29b3('0x1f')]==_0x3ff2d5;});if(_[_0x29b3('0x20')](_0x96e551)){var _0x28e041=_['find'](this[_0x29b3('0xd')],function(_0x4bbda8){return _0x4bbda8[_0x29b3('0x1e')]==_0x3ff2d5||_0x4bbda8[_0x29b3('0x1f')]==_0x3ff2d5;});if(_0x28e041){_0x96e551=_['find'](this[_0x29b3('0xc')],function(_0x1269f1){return _0x1269f1[_0x29b3('0x21')]==util[_0x29b3('0x22')](_0x29b3('0x23'),_0x28e041[_0x29b3('0x1f')]);});}}return _0x96e551;};Report[_0x29b3('0x1c')][_0x29b3('0x11')]=function(_0x561423){for(var _0x1376ac=0x0;_0x1376ac<_0x561423[_0x29b3('0x24')];_0x1376ac+=0x1){var _0x4498a6=this['findAgent'](_0x561423[_0x1376ac][_0x29b3('0x25')]);if(_0x4498a6){_0x561423[_0x1376ac][_0x29b3('0x1e')]=_0x4498a6[_0x29b3('0x1e')];_0x561423[_0x1376ac][_0x29b3('0x26')]=!![];_0x561423[_0x1376ac][_0x29b3('0x27')]=_0x4498a6[_0x29b3('0x1f')];_0x561423[_0x1376ac][_0x29b3('0x21')]=_['isNil'](_0x4498a6[_0x29b3('0x21')])?util['format'](_0x29b3('0x23'),_0x4498a6['name']):_0x4498a6[_0x29b3('0x21')];if(_0x561423[_0x1376ac][_0x29b3('0x28')]){_0x561423[_0x1376ac]['queuecallercompleteAt']=moment()[_0x29b3('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x561423[_0x1376ac]['queuecallerexit']){_0x561423[_0x1376ac][_0x29b3('0x29')]=moment()[_0x29b3('0x22')](_0x29b3('0x2a'));}RpcMemberReport[_0x29b3('0x11')](_0x561423[_0x1376ac]);}RpcVoiceQueueReport['create'](_0x561423[_0x1376ac]);}};function extractCalleridNumber(_0x383e7c){var _0x287f5c=_0x383e7c['match'](/<(.*?)>/);return _0x287f5c?_0x287f5c[0x1]:_0x383e7c;}Report[_0x29b3('0x1c')]['voiceCallReport']=function(_0x2b429b){_0x2b429b[_0x29b3('0x2b')]=_0x2b429b[_0x29b3('0x2b')]||_0x2b429b[_0x29b3('0x2c')];if(_0x2b429b[_0x29b3('0x2d')]==_0x29b3('0x2e')){_0x2b429b[_0x29b3('0x2f')]=_0x29b3('0x30');_0x2b429b[_0x29b3('0x31')]=_0x2b429b['queue'];if(_0x2b429b[_0x29b3('0x32')]==_0x29b3('0x33')){_0x2b429b[_0x29b3('0x1e')]='';_0x2b429b['destination']=extractCalleridNumber(_0x2b429b['callerid']);}else if(_0x2b429b['context']==_0x29b3('0x34')){if(_0x2b429b[_0x29b3('0x2b')]==_0x29b3('0x35')){_0x2b429b[_0x29b3('0x2b')]=extractCalleridNumber(_0x2b429b[_0x29b3('0x36')]);_0x2b429b['calleridnum']=_0x2b429b[_0x29b3('0x37')];_0x2b429b[_0x29b3('0x38')]=[_0x2b429b['channel'],_0x2b429b[_0x29b3('0x39')]=_0x2b429b[_0x29b3('0x38')]][0x0];_0x2b429b[_0x29b3('0x3a')]=_0x2b429b['calleridpreview'];}else{_0x2b429b[_0x29b3('0x2b')]=_0x2b429b['calleridnum'];_0x2b429b[_0x29b3('0x3b')]=_0x2b429b[_0x29b3('0x37')];if(_0x2b429b[_0x29b3('0x3c')]==_0x29b3('0x3d')){_0x2b429b[_0x29b3('0x1e')]=_0x2b429b['connectedlinenum'];}else{_0x2b429b[_0x29b3('0x1e')]='';}}}}else{_0x2b429b[_0x29b3('0x3a')]=util['format']('\x22%s\x22\x20<%s>',_0x2b429b[_0x29b3('0x3e')],_0x2b429b[_0x29b3('0x3b')]);}if(RpcVoiceTransferReport[_0x29b3('0x3f')][_0x2b429b[_0x29b3('0x40')]]){var _0x36a40a=RpcVoiceTransferReport[_0x29b3('0x3f')][_0x2b429b[_0x29b3('0x40')]];_0x36a40a[_0x29b3('0x41')]=_0x2b429b[_0x29b3('0x42')];RpcVoiceTransferReport['blindTransfer'](_0x36a40a);delete RpcVoiceTransferReport[_0x29b3('0x3f')][_0x2b429b[_0x29b3('0x40')]];}RpcVoiceCallReport['create'](_0x2b429b);if(_0x2b429b[_0x29b3('0x43')]){for(var _0x2f1674=0x0;_0x2f1674<_0x2b429b['monitors']['length'];_0x2f1674+=0x1){_0x2b429b[_0x29b3('0x44')]=_0x2b429b[_0x29b3('0x45')][_0x2f1674][_0x29b3('0x46')];_0x2b429b['createdAt']=_0x2b429b[_0x29b3('0x45')][_0x2f1674][_0x29b3('0x47')];if(_0x2b429b[_0x29b3('0x2c')]=='xcally-motion-preview'){_0x2b429b[_0x29b3('0x3b')]=_0x2b429b[_0x29b3('0x25')];_0x2b429b[_0x29b3('0x3e')]=_0x2b429b[_0x29b3('0x48')];_0x2b429b[_0x29b3('0x25')]=_0x2b429b[_0x29b3('0x1e')];_0x2b429b[_0x29b3('0x48')]=_0x2b429b[_0x29b3('0x49')];_0x2b429b['exten']=_0x2b429b[_0x29b3('0x37')];}else if(_0x2b429b['exten']==_0x29b3('0x4a')){_0x2b429b[_0x29b3('0x3b')]=_0x2b429b['destination'];_0x2b429b[_0x29b3('0x2c')]=_0x2b429b['originatecalleridnum'];}RpcVoiceRecording[_0x29b3('0x4b')](_0x2b429b);}}};Report['prototype'][_0x29b3('0x16')]=function(_0x526142){if(_[_0x29b3('0x4c')](_0x526142)){_0x526142[_0x29b3('0x4d')](function(_0x2cc2a3){RpcVoiceAgentReport['create'](_0x2cc2a3);});}else{RpcVoiceAgentReport[_0x29b3('0x4b')](_0x526142);}};Report[_0x29b3('0x1c')][_0x29b3('0x18')]=function(_0x54b766){RpcVoiceDialReport[_0x29b3('0x4b')](_0x54b766);var _0x422678;var _0x2b6b39;var _0x50ccbd=_0x54b766[_0x29b3('0x39')];if(_['startsWith'](_0x50ccbd,_0x29b3('0x4e'))){_0x2b6b39=_0x50ccbd['substring'](_0x50ccbd[_0x29b3('0x4f')]('/')+0x1,_0x50ccbd[_0x29b3('0x4f')]('@'));_0x422678=_[_0x29b3('0x1d')](this['agents'],function(_0x1936e4){return _0x1936e4['mobile']==_0x2b6b39||_0x1936e4[_0x29b3('0x50')]==_0x2b6b39||_0x1936e4[_0x29b3('0x1e')]==_0x2b6b39;});}else{_0x2b6b39=_0x50ccbd[_0x29b3('0x51')](_0x50ccbd[_0x29b3('0x4f')]('/')+0x1,_0x50ccbd['lastIndexOf']('-'));_0x422678=this[_0x29b3('0x52')](_0x2b6b39);}if(_0x422678){_0x54b766['interface']=_['isNil'](_0x422678[_0x29b3('0x21')])?util[_0x29b3('0x22')](_0x29b3('0x23'),_0x422678[_0x29b3('0x1f')]):_0x422678[_0x29b3('0x21')];_0x54b766['membername']=_0x422678[_0x29b3('0x1f')];_0x54b766['accountcode']=_0x422678[_0x29b3('0x1e')];RpcMemberReport[_0x29b3('0x18')](_0x54b766);}};Report[_0x29b3('0x1c')]['blindTransfer']=function(_0x1fadca){RpcVoiceTransferReport[_0x29b3('0x3f')][_0x1fadca[_0x29b3('0x53')]]=_0x1fadca;};Report[_0x29b3('0x1c')]['attendedTransfer']=function(_0x2c22ab){RpcVoiceTransferReport['attendedTransfer'](_0x2c22ab);};module['exports']=Report; \ No newline at end of file +var _0x9b6d=['telephones','prototype','sync','xdr','bind','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','length','connectedlinenum','lastAssignedTo','format','SIP/%s','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','match','destination','exten','type','lastapplication','queue','context','from-voip-provider','callerid','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','phone','substring','lastIndexOf','isNil','transfererlinkedid','attendedTransfer','exports','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents'];(function(_0x24d961,_0x51b2ce){var _0x3ce9de=function(_0x1da0e0){while(--_0x1da0e0){_0x24d961['push'](_0x24d961['shift']());}};_0x3ce9de(++_0x51b2ce);}(_0x9b6d,0x140));var _0xd9b6=function(_0x4e420c,_0x3f4ab6){_0x4e420c=_0x4e420c-0x0;var _0xfadec3=_0x9b6d[_0x4e420c];return _0xfadec3;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xd9b6('0x0'));var config=require(_0xd9b6('0x1'));var ami=require(_0xd9b6('0x2'));var RpcVoiceAgentReport=require(_0xd9b6('0x3'));var RpcVoiceCallReport=require(_0xd9b6('0x4'));var RpcVoiceDialReport=require(_0xd9b6('0x5'));var RpcMemberReport=require(_0xd9b6('0x6'));var RpcVoiceQueueReport=require(_0xd9b6('0x7'));var RpcVoiceRecording=require(_0xd9b6('0x8'));var RpcVoiceTransferReport=require(_0xd9b6('0x9'));var VoiceQueueReport=require(_0xd9b6('0xa'));var VoiceCallReport=require(_0xd9b6('0xb'));var VoiceAgentReport=require(_0xd9b6('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xd9b6('0xd'));function Report(_0x209ae8){this[_0xd9b6('0xe')]=_0x209ae8;this[_0xd9b6('0xf')]=_0x209ae8[_0xd9b6('0xf')];this[_0xd9b6('0x10')]=_0x209ae8['telephones'];}Report[_0xd9b6('0x11')][_0xd9b6('0x12')]=function(_0x3606c9){var _0x19e404=new VoiceQueueReport(this[_0xd9b6('0xe')]);var _0x4a50c8=new VoiceAgentReport(this['realtime']);var _0x7343d2=new VoiceDialReport(this['realtime']);var _0x42db64=new VoiceCallReport(this[_0xd9b6('0xe')]);var _0x2db2b7=new UserReport(this[_0xd9b6('0xe')]);if(config[_0xd9b6('0x13')]&&config['xdr']['disabled']){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xd9b6('0x14')](this));ami['on']('custom:voiceCallReport',this[_0xd9b6('0x15')][_0xd9b6('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0xd9b6('0x16')][_0xd9b6('0x14')](this));ami['on'](_0xd9b6('0x17'),this[_0xd9b6('0x18')]['bind'](this));ami['on']('blindtransfer',this[_0xd9b6('0x19')][_0xd9b6('0x14')](this));ami['on'](_0xd9b6('0x1a'),this['attendedTransfer'][_0xd9b6('0x14')](this));}};Report[_0xd9b6('0x11')][_0xd9b6('0x1b')]=function(_0x1e8f57){var _0x5cfec5;_0x5cfec5=_[_0xd9b6('0x1c')](this[_0xd9b6('0xf')],function(_0x246cf9){return _0x246cf9[_0xd9b6('0x1d')]==_0x1e8f57||_0x246cf9[_0xd9b6('0x1e')]==_0x1e8f57;});if(_['isNil'](_0x5cfec5)){var _0x585003=_['find'](this[_0xd9b6('0x10')],function(_0x1aa189){return _0x1aa189['accountcode']==_0x1e8f57||_0x1aa189[_0xd9b6('0x1e')]==_0x1e8f57;});if(_0x585003){_0x5cfec5=_[_0xd9b6('0x1c')](this[_0xd9b6('0xf')],function(_0x52eed6){return _0x52eed6[_0xd9b6('0x1f')]==util['format']('SIP/%s',_0x585003[_0xd9b6('0x1e')]);});}}return _0x5cfec5;};Report[_0xd9b6('0x11')]['voiceQueueReport']=function(_0x118a38){for(var _0x7ef4=0x0;_0x7ef4<_0x118a38[_0xd9b6('0x20')];_0x7ef4+=0x1){var _0x31a7b7=this['findAgent'](_0x118a38[_0x7ef4][_0xd9b6('0x21')]);if(_0x31a7b7){_0x118a38[_0x7ef4]['accountcode']=_0x31a7b7['accountcode'];_0x118a38[_0x7ef4]['assigned']=!![];_0x118a38[_0x7ef4][_0xd9b6('0x22')]=_0x31a7b7[_0xd9b6('0x1e')];_0x118a38[_0x7ef4][_0xd9b6('0x1f')]=_['isNil'](_0x31a7b7[_0xd9b6('0x1f')])?util[_0xd9b6('0x23')](_0xd9b6('0x24'),_0x31a7b7[_0xd9b6('0x1e')]):_0x31a7b7[_0xd9b6('0x1f')];if(_0x118a38[_0x7ef4]['queuecallercomplete']){_0x118a38[_0x7ef4][_0xd9b6('0x25')]=moment()[_0xd9b6('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x118a38[_0x7ef4][_0xd9b6('0x26')]){_0x118a38[_0x7ef4][_0xd9b6('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xd9b6('0x28')](_0x118a38[_0x7ef4]);}RpcVoiceQueueReport[_0xd9b6('0x29')](_0x118a38[_0x7ef4]);}};function extractCalleridNumber(_0xde03c9){var _0x195557=_0xde03c9[_0xd9b6('0x2a')](/<(.*?)>/);return _0x195557?_0x195557[0x1]:_0xde03c9;}Report[_0xd9b6('0x11')]['voiceCallReport']=function(_0x201615){_0x201615[_0xd9b6('0x2b')]=_0x201615[_0xd9b6('0x2b')]||_0x201615[_0xd9b6('0x2c')];if(_0x201615[_0xd9b6('0x2d')]=='dialer'){_0x201615[_0xd9b6('0x2e')]='queue';_0x201615['lastdata']=_0x201615[_0xd9b6('0x2f')];if(_0x201615[_0xd9b6('0x30')]==_0xd9b6('0x31')){_0x201615['accountcode']='';_0x201615[_0xd9b6('0x2b')]=extractCalleridNumber(_0x201615[_0xd9b6('0x32')]);}else if(_0x201615[_0xd9b6('0x30')]=='from-sip'){if(_0x201615[_0xd9b6('0x2b')]==_0xd9b6('0x33')){_0x201615[_0xd9b6('0x2b')]=extractCalleridNumber(_0x201615['calleridpreview']);_0x201615['calleridnum']=_0x201615[_0xd9b6('0x34')];_0x201615[_0xd9b6('0x35')]=[_0x201615[_0xd9b6('0x36')],_0x201615[_0xd9b6('0x36')]=_0x201615[_0xd9b6('0x35')]][0x0];_0x201615[_0xd9b6('0x32')]=_0x201615[_0xd9b6('0x37')];}else{_0x201615['destination']=_0x201615[_0xd9b6('0x38')];_0x201615[_0xd9b6('0x38')]=_0x201615[_0xd9b6('0x34')];if(_0x201615[_0xd9b6('0x39')]==_0xd9b6('0x3a')){_0x201615['accountcode']=_0x201615[_0xd9b6('0x21')];}else{_0x201615[_0xd9b6('0x1d')]='';}}}}else{_0x201615['callerid']=util[_0xd9b6('0x23')](_0xd9b6('0x3b'),_0x201615['calleridname'],_0x201615[_0xd9b6('0x38')]);}if(RpcVoiceTransferReport[_0xd9b6('0x3c')][_0x201615[_0xd9b6('0x3d')]]){var _0xfbbb94=RpcVoiceTransferReport['transfers'][_0x201615[_0xd9b6('0x3d')]];_0xfbbb94[_0xd9b6('0x3e')]=_0x201615[_0xd9b6('0x3f')];RpcVoiceTransferReport[_0xd9b6('0x19')](_0xfbbb94);delete RpcVoiceTransferReport[_0xd9b6('0x3c')][_0x201615[_0xd9b6('0x3d')]];}RpcVoiceCallReport[_0xd9b6('0x29')](_0x201615);if(_0x201615[_0xd9b6('0x40')]){for(var _0x39910e=0x0;_0x39910e<_0x201615[_0xd9b6('0x41')][_0xd9b6('0x20')];_0x39910e+=0x1){_0x201615[_0xd9b6('0x42')]=_0x201615[_0xd9b6('0x41')][_0x39910e][_0xd9b6('0x43')];_0x201615[_0xd9b6('0x44')]=_0x201615[_0xd9b6('0x41')][_0x39910e][_0xd9b6('0x44')];if(_0x201615[_0xd9b6('0x2c')]==_0xd9b6('0x33')){_0x201615[_0xd9b6('0x38')]=_0x201615[_0xd9b6('0x21')];_0x201615[_0xd9b6('0x45')]=_0x201615[_0xd9b6('0x46')];_0x201615[_0xd9b6('0x21')]=_0x201615[_0xd9b6('0x1d')];_0x201615[_0xd9b6('0x46')]=_0x201615[_0xd9b6('0x47')];_0x201615[_0xd9b6('0x2c')]=_0x201615[_0xd9b6('0x34')];}else if(_0x201615[_0xd9b6('0x2c')]==_0xd9b6('0x48')){_0x201615[_0xd9b6('0x38')]=_0x201615['destination'];_0x201615[_0xd9b6('0x2c')]=_0x201615[_0xd9b6('0x34')];}RpcVoiceRecording[_0xd9b6('0x29')](_0x201615);}}};Report['prototype']['voiceAgentReport']=function(_0x439b65){if(_[_0xd9b6('0x49')](_0x439b65)){_0x439b65[_0xd9b6('0x4a')](function(_0x587c0d){RpcVoiceAgentReport['create'](_0x587c0d);});}else{RpcVoiceAgentReport['create'](_0x439b65);}};Report[_0xd9b6('0x11')][_0xd9b6('0x18')]=function(_0x21193b){RpcVoiceDialReport[_0xd9b6('0x29')](_0x21193b);var _0x15e513;var _0x34c52f;var _0xe9d083=_0x21193b[_0xd9b6('0x36')];if(_[_0xd9b6('0x4b')](_0xe9d083,_0xd9b6('0x4c'))){_0x34c52f=_0xe9d083['substring'](_0xe9d083['indexOf']('/')+0x1,_0xe9d083['indexOf']('@'));_0x15e513=_[_0xd9b6('0x1c')](this[_0xd9b6('0xf')],function(_0x182fc4){return _0x182fc4['mobile']==_0x34c52f||_0x182fc4[_0xd9b6('0x4d')]==_0x34c52f||_0x182fc4[_0xd9b6('0x1d')]==_0x34c52f;});}else{_0x34c52f=_0xe9d083[_0xd9b6('0x4e')](_0xe9d083['indexOf']('/')+0x1,_0xe9d083[_0xd9b6('0x4f')]('-'));_0x15e513=this[_0xd9b6('0x1b')](_0x34c52f);}if(_0x15e513){_0x21193b[_0xd9b6('0x1f')]=_[_0xd9b6('0x50')](_0x15e513['interface'])?util[_0xd9b6('0x23')](_0xd9b6('0x24'),_0x15e513[_0xd9b6('0x1e')]):_0x15e513[_0xd9b6('0x1f')];_0x21193b[_0xd9b6('0x47')]=_0x15e513['name'];_0x21193b[_0xd9b6('0x1d')]=_0x15e513[_0xd9b6('0x1d')];RpcMemberReport['voiceDialReport'](_0x21193b);}};Report[_0xd9b6('0x11')][_0xd9b6('0x19')]=function(_0x87a89f){RpcVoiceTransferReport[_0xd9b6('0x3c')][_0x87a89f[_0xd9b6('0x51')]]=_0x87a89f;};Report[_0xd9b6('0x11')]['attendedTransfer']=function(_0x5843cd){RpcVoiceTransferReport[_0xd9b6('0x52')](_0x5843cd);};module[_0xd9b6('0x53')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 26b2e9a..ddc9e9e 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 _0x2015=['format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','trunk:save','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','inspect','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','omit'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x2015,0x193));var _0x5201=function(_0x3de1aa,_0x48a8a4){_0x3de1aa=_0x3de1aa-0x0;var _0x20fe71=_0x2015[_0x3de1aa];return _0x20fe71;};'use strict';var _=require(_0x5201('0x0'));var moment=require(_0x5201('0x1'));var util=require(_0x5201('0x2'));var Redis=require(_0x5201('0x3'));var BPromise=require(_0x5201('0x4'));var config=require(_0x5201('0x5'));var logger=require(_0x5201('0x6'))(_0x5201('0x7'));var ami=require('../ami');config[_0x5201('0x8')]=_[_0x5201('0x9')](config[_0x5201('0x8')],{'host':_0x5201('0xa'),'port':0x18eb});var io=require(_0x5201('0xb'))(new Redis(config[_0x5201('0x8')]));function UserReport(_0x334b42){this[_0x5201('0xc')]=_0x334b42[_0x5201('0xc')];this[_0x5201('0xd')]=_0x334b42['agents'];this[_0x5201('0xe')]=_0x334b42[_0x5201('0xe')];ami['on']('registryentry',this[_0x5201('0xf')][_0x5201('0x10')](this));ami['on'](_0x5201('0x11'),this['syncRegistry'][_0x5201('0x10')](this));ami['on'](_0x5201('0x12'),this[_0x5201('0x13')][_0x5201('0x10')](this));ami['on'](_0x5201('0x14'),this[_0x5201('0x15')][_0x5201('0x10')](this));return this[_0x5201('0x16')]();}function showSipRegistrations(){Promise[_0x5201('0x17')]()[_0x5201('0x18')](ami[_0x5201('0x19')]())[_0x5201('0x1a')](function(_0x491252){logger[_0x5201('0x1b')](_0x5201('0x1c'),util['inspect'](_0x491252,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x5201('0x18')](ami[_0x5201('0x1d')]())[_0x5201('0x1a')](function(_0x5b3184){logger['error'](_0x5201('0x1e'),util['inspect'](_0x5b3184,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x5201('0x17')]()['then'](ami[_0x5201('0x1f')]())['catch'](function(_0x2a5643){logger[_0x5201('0x1b')](_0x5201('0x20'),util[_0x5201('0x21')](_0x2a5643,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x5201('0x17')]()[_0x5201('0x18')](showSipRegistrations())[_0x5201('0x18')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x5201('0x22')][_0x5201('0x23')]=function(_0x2ffb57){return _0x2ffb57!==null&&!_[_0x5201('0x24')](_0x2ffb57);};UserReport[_0x5201('0x22')]['emit']=function(_0x15fade,_0x32aa89,_0x33c2bb){io['to'](_0x15fade)[_0x5201('0x25')](_0x32aa89,_0x33c2bb);};UserReport[_0x5201('0x22')][_0x5201('0xf')]=function(_0x10e9c2){try{if(this['isNotNull'](_0x10e9c2)){logger[_0x5201('0x26')](_0x5201('0x27'),_0x10e9c2[_0x5201('0x28')],_0x10e9c2[_0x5201('0x29')]);logger[_0x5201('0x2a')](_0x5201('0x2b'),util[_0x5201('0x21')](_0x10e9c2,{'showHidden':![],'depth':null}));var _0x43ca02=_[_0x5201('0x2c')](this[_0x5201('0xc')],{'registry':_0x10e9c2['username']});if(_0x43ca02){_0x10e9c2[_0x5201('0x2d')]=_0x10e9c2[_0x5201('0x29')];_['merge'](_0x43ca02,_[_0x5201('0x2e')](_0x10e9c2,['event','actionid',_0x5201('0x28'),_0x5201('0x29')]));logger[_0x5201('0x2a')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x43ca02,{'showHidden':![],'depth':null}));this[_0x5201('0x25')](util[_0x5201('0x2f')](_0x5201('0x30'),_0x43ca02[_0x5201('0x31')]),'trunk:save',_0x43ca02);}}}catch(_0x462212){logger[_0x5201('0x1b')](_0x5201('0x2b'),util[_0x5201('0x21')](_0x462212,{'showHidden':![],'depth':null}));}};UserReport[_0x5201('0x22')]['syncDeviceState']=function(_0x50764f){try{if(this[_0x5201('0x23')](_0x50764f)){logger[_0x5201('0x26')](_0x5201('0x32'),_0x50764f[_0x5201('0x33')],_0x50764f[_0x5201('0x29')]);logger[_0x5201('0x2a')](_0x5201('0x34'),util['inspect'](_0x50764f,{'showHidden':![],'depth':null}));if(this[_0x5201('0xd')][_0x50764f[_0x5201('0x33')]]){if(!this[_0x5201('0xd')][_0x50764f['device']][_0x5201('0x35')]||_0x50764f[_0x5201('0x29')][_0x5201('0x36')]()==_0x5201('0x37')){this[_0x5201('0xd')][_0x50764f[_0x5201('0x33')]][_0x5201('0x35')]=![];if(this[_0x5201('0xd')][_0x50764f[_0x5201('0x33')]][_0x5201('0x29')]!==_0x50764f[_0x5201('0x29')][_0x5201('0x36')]()){this['agents'][_0x50764f['device']][_0x5201('0x38')]=_[_0x5201('0x39')](moment()[_0x5201('0x2f')]('x'));}this[_0x5201('0xd')][_0x50764f[_0x5201('0x33')]][_0x5201('0x29')]=_0x50764f[_0x5201('0x29')]['toLowerCase']();this[_0x5201('0xd')][_0x50764f[_0x5201('0x33')]][_0x5201('0x3a')](_0x50764f);}}else if(this['telephones'][_0x50764f[_0x5201('0x33')]]){if(this[_0x5201('0xe')][_0x50764f[_0x5201('0x33')]]['state']!==_0x50764f[_0x5201('0x29')][_0x5201('0x36')]()){this['telephones'][_0x50764f['device']][_0x5201('0x38')]=_[_0x5201('0x39')](moment()[_0x5201('0x2f')]('x'));}this[_0x5201('0xe')][_0x50764f[_0x5201('0x33')]][_0x5201('0x29')]=_0x50764f['state'][_0x5201('0x36')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x5201('0x21')](this[_0x5201('0xe')][_0x50764f[_0x5201('0x33')]],{'showHidden':![],'depth':null}));this[_0x5201('0x25')](util[_0x5201('0x2f')]('telephone:%s',this[_0x5201('0xe')][_0x50764f[_0x5201('0x33')]][_0x5201('0x31')]),_0x5201('0x3b'),this[_0x5201('0xe')][_0x50764f[_0x5201('0x33')]]);}else if(this[_0x5201('0xc')][_0x50764f['device']]){if(this['trunks'][_0x50764f[_0x5201('0x33')]][_0x5201('0x29')]!==_0x50764f[_0x5201('0x29')][_0x5201('0x36')]()){this[_0x5201('0xc')][_0x50764f['device']]['stateTime']=_[_0x5201('0x39')](moment()[_0x5201('0x2f')]('x'));}this[_0x5201('0xc')][_0x50764f[_0x5201('0x33')]][_0x5201('0x29')]=_0x50764f[_0x5201('0x29')][_0x5201('0x36')]();logger[_0x5201('0x2a')](_0x5201('0x3c'),util[_0x5201('0x21')](this[_0x5201('0xc')][_0x50764f['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x5201('0x2f')](_0x5201('0x30'),this[_0x5201('0xc')][_0x50764f[_0x5201('0x33')]][_0x5201('0x31')]),'trunk:save',this['trunks'][_0x50764f[_0x5201('0x33')]]);}else if(_[_0x5201('0x3d')](_0x50764f[_0x5201('0x33')],_0x5201('0x3e'))){var _0x3eba99=_0x50764f[_0x5201('0x33')];var _0x483aa5=_0x3eba99['substring'](_0x3eba99['indexOf']('/')+0x1,_0x3eba99[_0x5201('0x3f')]('@'));var _0x5f493e=_[_0x5201('0x2c')](this[_0x5201('0xd')],function(_0x3dea26){return _0x3dea26[_0x5201('0x40')]==_0x483aa5||_0x3dea26[_0x5201('0x41')]==_0x483aa5||_0x3dea26['accountcode']==_0x483aa5;});if(_0x5f493e){if(_0x5f493e[_0x5201('0x29')]!==_0x50764f[_0x5201('0x29')][_0x5201('0x36')]()){_0x5f493e[_0x5201('0x38')]=_[_0x5201('0x39')](moment()[_0x5201('0x2f')]('x'));}_0x5f493e[_0x5201('0x29')]=_0x50764f[_0x5201('0x29')][_0x5201('0x36')]();_0x5f493e[_0x5201('0x35')]=!![];_0x5f493e['updateStatusRealtime'](_0x50764f);}}}}catch(_0x12bc51){logger['error'](_0x5201('0x34'),util[_0x5201('0x21')](_0x12bc51,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5201('0x15')]=function(_0xfa16c2){try{if(this['isNotNull'](_0xfa16c2)&&this[_0x5201('0x23')](_0xfa16c2['peerstatus'])){logger[_0x5201('0x26')](_0x5201('0x42'),_0xfa16c2[_0x5201('0x43')],_0xfa16c2[_0x5201('0x44')],_0xfa16c2[_0x5201('0x14')]);logger['debug'](_0x5201('0x45'),util[_0x5201('0x21')](_0xfa16c2,{'showHidden':![],'depth':null}));if(this[_0x5201('0xd')][_0xfa16c2[_0x5201('0x43')]]){if(!this[_0x5201('0xd')][_0xfa16c2[_0x5201('0x43')]][_0x5201('0x35')]||_0xfa16c2[_0x5201('0x14')][_0x5201('0x36')]()==_0x5201('0x46')){this[_0x5201('0xd')][_0xfa16c2[_0x5201('0x43')]]['local']=![];this[_0x5201('0xd')][_0xfa16c2[_0x5201('0x43')]][_0x5201('0x47')]=_0xfa16c2[_0x5201('0x14')][_0x5201('0x36')]();this[_0x5201('0xd')][_0xfa16c2['peer']][_0x5201('0x44')]=_0xfa16c2[_0x5201('0x44')];this[_0x5201('0xd')][_0xfa16c2[_0x5201('0x43')]][_0x5201('0x3a')](_0xfa16c2);}}else if(this[_0x5201('0xe')][_0xfa16c2[_0x5201('0x43')]]){this['telephones'][_0xfa16c2['peer']][_0x5201('0x47')]=_0xfa16c2[_0x5201('0x14')][_0x5201('0x36')]();this[_0x5201('0xe')][_0xfa16c2[_0x5201('0x43')]]['address']=_0xfa16c2[_0x5201('0x44')];logger[_0x5201('0x2a')](_0x5201('0x48'),util['inspect'](this[_0x5201('0xe')][_0xfa16c2[_0x5201('0x43')]],{'showHidden':![],'depth':null}));this[_0x5201('0x25')](util[_0x5201('0x2f')](_0x5201('0x49'),this['telephones'][_0xfa16c2[_0x5201('0x43')]]['name']),_0x5201('0x3b'),this[_0x5201('0xe')][_0xfa16c2[_0x5201('0x43')]]);}else if(this[_0x5201('0xc')][_0xfa16c2[_0x5201('0x43')]]){this['trunks'][_0xfa16c2[_0x5201('0x43')]]['status']=_0xfa16c2[_0x5201('0x14')][_0x5201('0x36')]();this[_0x5201('0xc')][_0xfa16c2[_0x5201('0x43')]]['address']=_0xfa16c2[_0x5201('0x44')];logger[_0x5201('0x2a')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x5201('0x21')](this[_0x5201('0xc')][_0xfa16c2[_0x5201('0x43')]],{'showHidden':![],'depth':null}));this[_0x5201('0x25')](util[_0x5201('0x2f')]('trunk:%s',this[_0x5201('0xc')][_0xfa16c2[_0x5201('0x43')]]['name']),_0x5201('0x4a'),this[_0x5201('0xc')][_0xfa16c2['peer']]);}}}catch(_0x46e6e0){logger[_0x5201('0x1b')](_0x5201('0x45'),util['inspect'](_0x46e6e0,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xd0bb=['actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','local','toLowerCase','inuse','device','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','Local','substring','find','mobile','phone','accountcode','stateTime','updateStatusRealtime','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','username','state','debug','[userReport][registry]','stateRegistry','merge','omit','event'];(function(_0x1f0f7d,_0x5070cb){var _0x2ccb14=function(_0x4b9523){while(--_0x4b9523){_0x1f0f7d['push'](_0x1f0f7d['shift']());}};_0x2ccb14(++_0x5070cb);}(_0xd0bb,0x1a8));var _0xbd0b=function(_0x3eee78,_0x5acc63){_0x3eee78=_0x3eee78-0x0;var _0x53a5e5=_0xd0bb[_0x3eee78];return _0x53a5e5;};'use strict';var _=require(_0xbd0b('0x0'));var moment=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var Redis=require(_0xbd0b('0x3'));var BPromise=require(_0xbd0b('0x4'));var config=require(_0xbd0b('0x5'));var logger=require('../../../config/logger')(_0xbd0b('0x6'));var ami=require(_0xbd0b('0x7'));config[_0xbd0b('0x8')]=_['defaults'](config[_0xbd0b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xbd0b('0x9'))(new Redis(config[_0xbd0b('0x8')]));function UserReport(_0x507731){this[_0xbd0b('0xa')]=_0x507731[_0xbd0b('0xa')];this['agents']=_0x507731[_0xbd0b('0xb')];this[_0xbd0b('0xc')]=_0x507731['telephones'];ami['on'](_0xbd0b('0xd'),this[_0xbd0b('0xe')][_0xbd0b('0xf')](this));ami['on'](_0xbd0b('0x10'),this[_0xbd0b('0xe')]['bind'](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xbd0b('0xf')](this));ami['on'](_0xbd0b('0x11'),this[_0xbd0b('0x12')][_0xbd0b('0xf')](this));return this[_0xbd0b('0x13')]();}function showSipRegistrations(){Promise[_0xbd0b('0x14')]()[_0xbd0b('0x15')](ami[_0xbd0b('0x16')]())[_0xbd0b('0x17')](function(_0x1cdeff){logger['error'](_0xbd0b('0x18'),util[_0xbd0b('0x19')](_0x1cdeff,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xbd0b('0x15')](ami[_0xbd0b('0x1a')]())[_0xbd0b('0x17')](function(_0x4f4c7c){logger[_0xbd0b('0x1b')](_0xbd0b('0x1c'),util[_0xbd0b('0x19')](_0x4f4c7c,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xbd0b('0x14')]()[_0xbd0b('0x15')](ami[_0xbd0b('0x1d')]())[_0xbd0b('0x17')](function(_0xf5f407){logger[_0xbd0b('0x1b')](_0xbd0b('0x1e'),util['inspect'](_0xf5f407,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xbd0b('0x14')]()[_0xbd0b('0x15')](showSipRegistrations())['then'](listDeviceStates())[_0xbd0b('0x15')](showPeersStatus());},0x32c8);};UserReport[_0xbd0b('0x1f')][_0xbd0b('0x20')]=function(_0x2e5c45){return _0x2e5c45!==null&&!_[_0xbd0b('0x21')](_0x2e5c45);};UserReport[_0xbd0b('0x1f')][_0xbd0b('0x22')]=function(_0x455616,_0x198c2e,_0xf8b313){io['to'](_0x455616)[_0xbd0b('0x22')](_0x198c2e,_0xf8b313);};UserReport['prototype']['syncRegistry']=function(_0x740e69){try{if(this[_0xbd0b('0x20')](_0x740e69)){logger[_0xbd0b('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x740e69[_0xbd0b('0x24')],_0x740e69[_0xbd0b('0x25')]);logger[_0xbd0b('0x26')](_0xbd0b('0x27'),util[_0xbd0b('0x19')](_0x740e69,{'showHidden':![],'depth':null}));var _0x4449c9=_['find'](this[_0xbd0b('0xa')],{'registry':_0x740e69[_0xbd0b('0x24')]});if(_0x4449c9){_0x740e69[_0xbd0b('0x28')]=_0x740e69[_0xbd0b('0x25')];_[_0xbd0b('0x29')](_0x4449c9,_[_0xbd0b('0x2a')](_0x740e69,[_0xbd0b('0x2b'),_0xbd0b('0x2c'),_0xbd0b('0x24'),'state']));logger[_0xbd0b('0x26')](_0xbd0b('0x2d'),util[_0xbd0b('0x19')](_0x4449c9,{'showHidden':![],'depth':null}));this[_0xbd0b('0x22')](util[_0xbd0b('0x2e')](_0xbd0b('0x2f'),_0x4449c9[_0xbd0b('0x30')]),_0xbd0b('0x31'),_0x4449c9);}}}catch(_0x509979){logger[_0xbd0b('0x1b')](_0xbd0b('0x27'),util[_0xbd0b('0x19')](_0x509979,{'showHidden':![],'depth':null}));}};UserReport[_0xbd0b('0x1f')][_0xbd0b('0x32')]=function(_0x42d3dd){try{if(this['isNotNull'](_0x42d3dd)){logger[_0xbd0b('0x23')](_0xbd0b('0x33'),_0x42d3dd['device'],_0x42d3dd[_0xbd0b('0x25')]);logger['debug']('[userReport][devicestatechange]',util[_0xbd0b('0x19')](_0x42d3dd,{'showHidden':![],'depth':null}));if(this[_0xbd0b('0xb')][_0x42d3dd['device']]){if(!this[_0xbd0b('0xb')][_0x42d3dd['device']][_0xbd0b('0x34')]||_0x42d3dd[_0xbd0b('0x25')][_0xbd0b('0x35')]()==_0xbd0b('0x36')){this[_0xbd0b('0xb')][_0x42d3dd['device']][_0xbd0b('0x34')]=![];if(this[_0xbd0b('0xb')][_0x42d3dd[_0xbd0b('0x37')]][_0xbd0b('0x25')]!==_0x42d3dd[_0xbd0b('0x25')][_0xbd0b('0x35')]()){this['agents'][_0x42d3dd[_0xbd0b('0x37')]]['stateTime']=_[_0xbd0b('0x38')](moment()['format']('x'));}this[_0xbd0b('0xb')][_0x42d3dd['device']]['state']=_0x42d3dd[_0xbd0b('0x25')][_0xbd0b('0x35')]();this['agents'][_0x42d3dd[_0xbd0b('0x37')]]['updateStatusRealtime'](_0x42d3dd);}}else if(this['telephones'][_0x42d3dd['device']]){if(this[_0xbd0b('0xc')][_0x42d3dd[_0xbd0b('0x37')]]['state']!==_0x42d3dd[_0xbd0b('0x25')][_0xbd0b('0x35')]()){this[_0xbd0b('0xc')][_0x42d3dd[_0xbd0b('0x37')]]['stateTime']=_[_0xbd0b('0x38')](moment()['format']('x'));}this[_0xbd0b('0xc')][_0x42d3dd[_0xbd0b('0x37')]][_0xbd0b('0x25')]=_0x42d3dd[_0xbd0b('0x25')][_0xbd0b('0x35')]();logger[_0xbd0b('0x26')](_0xbd0b('0x39'),util[_0xbd0b('0x19')](this[_0xbd0b('0xc')][_0x42d3dd[_0xbd0b('0x37')]],{'showHidden':![],'depth':null}));this[_0xbd0b('0x22')](util[_0xbd0b('0x2e')](_0xbd0b('0x3a'),this['telephones'][_0x42d3dd['device']]['name']),_0xbd0b('0x3b'),this[_0xbd0b('0xc')][_0x42d3dd[_0xbd0b('0x37')]]);}else if(this['trunks'][_0x42d3dd[_0xbd0b('0x37')]]){if(this['trunks'][_0x42d3dd[_0xbd0b('0x37')]][_0xbd0b('0x25')]!==_0x42d3dd[_0xbd0b('0x25')][_0xbd0b('0x35')]()){this[_0xbd0b('0xa')][_0x42d3dd['device']]['stateTime']=_['toNumber'](moment()[_0xbd0b('0x2e')]('x'));}this[_0xbd0b('0xa')][_0x42d3dd[_0xbd0b('0x37')]][_0xbd0b('0x25')]=_0x42d3dd[_0xbd0b('0x25')][_0xbd0b('0x35')]();logger[_0xbd0b('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xbd0b('0x19')](this['trunks'][_0x42d3dd[_0xbd0b('0x37')]],{'showHidden':![],'depth':null}));this[_0xbd0b('0x22')](util['format']('trunk:%s',this[_0xbd0b('0xa')][_0x42d3dd[_0xbd0b('0x37')]][_0xbd0b('0x30')]),_0xbd0b('0x31'),this['trunks'][_0x42d3dd[_0xbd0b('0x37')]]);}else if(_['startsWith'](_0x42d3dd[_0xbd0b('0x37')],_0xbd0b('0x3c'))){var _0x3e91d3=_0x42d3dd['device'];var _0x431139=_0x3e91d3[_0xbd0b('0x3d')](_0x3e91d3['indexOf']('/')+0x1,_0x3e91d3['indexOf']('@'));var _0x243475=_[_0xbd0b('0x3e')](this[_0xbd0b('0xb')],function(_0x33b158){return _0x33b158[_0xbd0b('0x3f')]==_0x431139||_0x33b158[_0xbd0b('0x40')]==_0x431139||_0x33b158[_0xbd0b('0x41')]==_0x431139;});if(_0x243475){if(_0x243475[_0xbd0b('0x25')]!==_0x42d3dd[_0xbd0b('0x25')][_0xbd0b('0x35')]()){_0x243475[_0xbd0b('0x42')]=_[_0xbd0b('0x38')](moment()[_0xbd0b('0x2e')]('x'));}_0x243475[_0xbd0b('0x25')]=_0x42d3dd['state'][_0xbd0b('0x35')]();_0x243475[_0xbd0b('0x34')]=!![];_0x243475[_0xbd0b('0x43')](_0x42d3dd);}}}}catch(_0x426543){logger[_0xbd0b('0x1b')](_0xbd0b('0x44'),util[_0xbd0b('0x19')](_0x426543,{'showHidden':![],'depth':null}));}};UserReport[_0xbd0b('0x1f')][_0xbd0b('0x12')]=function(_0x35ee96){try{if(this[_0xbd0b('0x20')](_0x35ee96)&&this[_0xbd0b('0x20')](_0x35ee96['peerstatus'])){logger[_0xbd0b('0x23')](_0xbd0b('0x45'),_0x35ee96[_0xbd0b('0x46')],_0x35ee96[_0xbd0b('0x47')],_0x35ee96[_0xbd0b('0x11')]);logger[_0xbd0b('0x26')](_0xbd0b('0x48'),util[_0xbd0b('0x19')](_0x35ee96,{'showHidden':![],'depth':null}));if(this[_0xbd0b('0xb')][_0x35ee96[_0xbd0b('0x46')]]){if(!this['agents'][_0x35ee96[_0xbd0b('0x46')]][_0xbd0b('0x34')]||_0x35ee96[_0xbd0b('0x11')][_0xbd0b('0x35')]()==_0xbd0b('0x49')){this[_0xbd0b('0xb')][_0x35ee96['peer']][_0xbd0b('0x34')]=![];this['agents'][_0x35ee96[_0xbd0b('0x46')]]['status']=_0x35ee96['peerstatus'][_0xbd0b('0x35')]();this[_0xbd0b('0xb')][_0x35ee96['peer']][_0xbd0b('0x47')]=_0x35ee96['address'];this[_0xbd0b('0xb')][_0x35ee96[_0xbd0b('0x46')]][_0xbd0b('0x43')](_0x35ee96);}}else if(this[_0xbd0b('0xc')][_0x35ee96[_0xbd0b('0x46')]]){this[_0xbd0b('0xc')][_0x35ee96[_0xbd0b('0x46')]]['status']=_0x35ee96[_0xbd0b('0x11')][_0xbd0b('0x35')]();this[_0xbd0b('0xc')][_0x35ee96[_0xbd0b('0x46')]][_0xbd0b('0x47')]=_0x35ee96[_0xbd0b('0x47')];logger['debug'](_0xbd0b('0x4a'),util['inspect'](this[_0xbd0b('0xc')][_0x35ee96[_0xbd0b('0x46')]],{'showHidden':![],'depth':null}));this[_0xbd0b('0x22')](util[_0xbd0b('0x2e')](_0xbd0b('0x3a'),this['telephones'][_0x35ee96['peer']][_0xbd0b('0x30')]),_0xbd0b('0x3b'),this[_0xbd0b('0xc')][_0x35ee96[_0xbd0b('0x46')]]);}else if(this['trunks'][_0x35ee96['peer']]){this['trunks'][_0x35ee96[_0xbd0b('0x46')]][_0xbd0b('0x4b')]=_0x35ee96[_0xbd0b('0x11')][_0xbd0b('0x35')]();this[_0xbd0b('0xa')][_0x35ee96[_0xbd0b('0x46')]][_0xbd0b('0x47')]=_0x35ee96['address'];logger[_0xbd0b('0x26')](_0xbd0b('0x4c'),util[_0xbd0b('0x19')](this['trunks'][_0x35ee96[_0xbd0b('0x46')]],{'showHidden':![],'depth':null}));this[_0xbd0b('0x22')](util[_0xbd0b('0x2e')](_0xbd0b('0x2f'),this['trunks'][_0x35ee96[_0xbd0b('0x46')]][_0xbd0b('0x30')]),_0xbd0b('0x31'),this[_0xbd0b('0xa')][_0x35ee96[_0xbd0b('0x46')]]);}}}catch(_0x208b32){logger[_0xbd0b('0x1b')]('[userReport][peerstatus]',util[_0xbd0b('0x19')](_0x208b32,{'showHidden':![],'depth':null}));}};module[_0xbd0b('0x4d')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 4e76f8b..ca2a35c 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 _0xbbc9=['agentacw','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','channels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','bind','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','format','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentcomplete','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout'];(function(_0x3cada2,_0x34602e){var _0x3b8e13=function(_0x4c7a49){while(--_0x4c7a49){_0x3cada2['push'](_0x3cada2['shift']());}};_0x3b8e13(++_0x34602e);}(_0xbbc9,0x1e8));var _0x9bbc=function(_0x3f80b9,_0x5a9025){_0x3f80b9=_0x3f80b9-0x0;var _0x1de77d=_0xbbc9[_0x3f80b9];return _0x1de77d;};'use strict';var _=require(_0x9bbc('0x0'));var moment=require('moment');var util=require(_0x9bbc('0x1'));var Redis=require('ioredis');var config=require(_0x9bbc('0x2'));var logger=require(_0x9bbc('0x3'))(_0x9bbc('0x4'));var ami=require(_0x9bbc('0x5'));config['redis']=_[_0x9bbc('0x6')](config[_0x9bbc('0x7')],{'host':_0x9bbc('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9bbc('0x7')]));function VoiceAgentReport(_0x3d8cde){this[_0x9bbc('0x9')]={};this[_0x9bbc('0xa')]=_0x3d8cde[_0x9bbc('0xa')];this['agents']=_0x3d8cde[_0x9bbc('0xb')];this[_0x9bbc('0xc')]={};ami['on']('agentcalled',this[_0x9bbc('0xd')]['bind'](this));ami['on'](_0x9bbc('0xe'),this['syncAgentConnect'][_0x9bbc('0xf')](this));ami['on']('agentringnoanswer',this[_0x9bbc('0x10')][_0x9bbc('0xf')](this));ami['on'](_0x9bbc('0x11'),this[_0x9bbc('0x12')][_0x9bbc('0xf')](this));ami['on']('agentcomplete',this[_0x9bbc('0x13')][_0x9bbc('0xf')](this));ami['on'](_0x9bbc('0x14'),this['syncVarSet'][_0x9bbc('0xf')](this));ami['on'](_0x9bbc('0x15'),this[_0x9bbc('0x16')]['bind'](this));ami['on'](_0x9bbc('0x17'),this[_0x9bbc('0x18')][_0x9bbc('0xf')](this));ami['on'](_0x9bbc('0x19'),this[_0x9bbc('0x1a')][_0x9bbc('0xf')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x9bbc('0xf')](this));ami['on']('blindtransfer',this[_0x9bbc('0x1b')][_0x9bbc('0xf')](this));}VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x1d')]=function(_0x425884,_0x2c5c10,_0x3a4935){io['to'](_0x425884)[_0x9bbc('0x1d')](_0x2c5c10,_0x3a4935);};VoiceAgentReport['prototype'][_0x9bbc('0x1e')]=function(_0xe06966){return _0xe06966!==null&&!_['isUndefined'](_0xe06966);};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0xd')]=function(_0x2238fd){try{if(this['isNotNull'](_0x2238fd)){logger[_0x9bbc('0x1f')](_0x9bbc('0x20'),_0x2238fd[_0x9bbc('0x21')],_0x2238fd[_0x9bbc('0x22')],_0x2238fd[_0x9bbc('0x23')]);logger[_0x9bbc('0x24')](_0x9bbc('0x25'),_0x2238fd[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x2238fd,{'showHidden':![],'depth':null}));if(_[_0x9bbc('0x27')](this['channels'][_0x2238fd['uniqueid']])){this[_0x9bbc('0x9')][_0x2238fd[_0x9bbc('0x21')]]={};}if(_[_0x9bbc('0x27')](this[_0x9bbc('0x9')][_0x2238fd[_0x9bbc('0x21')]][_0x2238fd[_0x9bbc('0x23')]])){this['channels'][_0x2238fd[_0x9bbc('0x21')]][_0x2238fd['destuniqueid']]={'agentcalledAt':moment()[_0x9bbc('0x28')](_0x9bbc('0x29')),'lastevent':'called','mandatoryDisposition':this[_0x9bbc('0xa')][_0x2238fd['queue']]?this[_0x9bbc('0xa')][_0x2238fd[_0x9bbc('0x2a')]][_0x9bbc('0x2b')]||![]:![],'type':this[_0x9bbc('0xa')][_0x2238fd[_0x9bbc('0x2a')]]?this[_0x9bbc('0xa')][_0x2238fd[_0x9bbc('0x2a')]][_0x9bbc('0x2c')]||'inbound':_0x9bbc('0x2d'),'variables':this[_0x9bbc('0xc')][_0x2238fd[_0x9bbc('0x21')]]};}_[_0x9bbc('0x2e')](this[_0x9bbc('0x9')][_0x2238fd[_0x9bbc('0x21')]][_0x2238fd[_0x9bbc('0x23')]],_[_0x9bbc('0x2f')](_0x2238fd,['event',_0x9bbc('0x30')]));logger[_0x9bbc('0x24')](_0x9bbc('0x31'),_0x2238fd[_0x9bbc('0x21')],util[_0x9bbc('0x26')](this[_0x9bbc('0x9')][_0x2238fd[_0x9bbc('0x21')]][_0x2238fd[_0x9bbc('0x23')]],{'showHidden':![],'depth':null}));ami['emit'](_0x9bbc('0x32'),this[_0x9bbc('0x9')][_0x2238fd[_0x9bbc('0x21')]][_0x2238fd[_0x9bbc('0x23')]]);logger[_0x9bbc('0x24')](_0x9bbc('0x33'),_0x2238fd[_0x9bbc('0x21')],util[_0x9bbc('0x26')](this['channels'][_0x2238fd[_0x9bbc('0x21')]][_0x2238fd[_0x9bbc('0x23')]],{'showHidden':![],'depth':null}));this[_0x9bbc('0x1d')](util[_0x9bbc('0x28')](_0x9bbc('0x34'),_0x2238fd[_0x9bbc('0x22')]),_0x9bbc('0x35'),this[_0x9bbc('0x9')][_0x2238fd[_0x9bbc('0x21')]][_0x2238fd[_0x9bbc('0x23')]]);}}catch(_0x556e25){logger[_0x9bbc('0x36')](_0x9bbc('0x37'),_0x2238fd[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x556e25,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x38')]=function(_0x293f63){try{if(this[_0x9bbc('0x1e')](_0x293f63)){if(this['channels'][_0x293f63[_0x9bbc('0x21')]]){logger[_0x9bbc('0x24')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x293f63[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x293f63,{'showHidden':![],'depth':null}));for(var _0x438019 in this[_0x9bbc('0x9')][_0x293f63['uniqueid']]){if(this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x9bbc('0x39')](_0x438019)){if(_0x293f63[_0x9bbc('0x23')]===_0x438019){logger[_0x9bbc('0x1f')](_0x9bbc('0x3a'),_0x293f63[_0x9bbc('0x21')],_0x293f63[_0x9bbc('0x22')],_0x293f63[_0x9bbc('0x23')]);this[_0x9bbc('0x9')][_0x293f63['uniqueid']][_0x438019][_0x9bbc('0x3b')]=moment()[_0x9bbc('0x28')](_0x9bbc('0x29'));this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019]['connectedlinename']=_0x293f63['connectedlinename'];this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x3c')]=_0x293f63[_0x9bbc('0x3c')];this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x3d')]=_0x293f63[_0x9bbc('0x3d')];this[_0x9bbc('0x9')][_0x293f63['uniqueid']][_0x438019][_0x9bbc('0x3e')]=_0x293f63[_0x9bbc('0x3e')];this['channels'][_0x293f63['uniqueid']][_0x438019][_0x9bbc('0x3f')]=_0x293f63[_0x9bbc('0x3f')];this['channels'][_0x293f63['uniqueid']][_0x438019][_0x9bbc('0x40')]='connect';_[_0x9bbc('0x2e')](this[_0x9bbc('0xb')][_0x293f63['interface']],_[_0x9bbc('0x41')](_0x293f63,['queue',_0x9bbc('0x42')]));logger['debug'](_0x9bbc('0x43'),_0x293f63[_0x9bbc('0x21')],util['inspect'](this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x293f63[_0x9bbc('0x23')]],{'showHidden':![],'depth':null}));ami[_0x9bbc('0x1d')](_0x9bbc('0x44'),this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x293f63[_0x9bbc('0x23')]]);logger[_0x9bbc('0x24')](_0x9bbc('0x45'),_0x293f63[_0x9bbc('0x21')],util[_0x9bbc('0x26')](this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x293f63[_0x9bbc('0x23')]],{'showHidden':![],'depth':null}));this[_0x9bbc('0x1d')](util[_0x9bbc('0x28')](_0x9bbc('0x34'),_0x293f63[_0x9bbc('0x22')]),_0x9bbc('0x46'),this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x293f63[_0x9bbc('0x23')]]);}else if(!this['channels'][_0x293f63[_0x9bbc('0x21')]][_0x438019]['agentringnoanswer']&&!this['channels'][_0x293f63[_0x9bbc('0x21')]][_0x438019]['agentcomplete']){logger[_0x9bbc('0x1f')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x293f63['uniqueid'],this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x22')],_0x438019);this['channels'][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x47')]=!![];this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x48')]=moment()[_0x9bbc('0x28')](_0x9bbc('0x29'));this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x49')]=_0x293f63[_0x9bbc('0x23')];this['channels'][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x4a')]=_0x293f63[_0x9bbc('0x22')];this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x40')]=_0x9bbc('0x4b');this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019][_0x9bbc('0x4c')]=_0x9bbc('0x4b');logger[_0x9bbc('0x24')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x293f63[_0x9bbc('0x21')],util['inspect'](this[_0x9bbc('0x9')][_0x293f63[_0x9bbc('0x21')]][_0x438019],{'showHidden':![],'depth':null}));ami[_0x9bbc('0x1d')](_0x9bbc('0x4d'),this['channels'][_0x293f63[_0x9bbc('0x21')]][_0x438019]);}}}}}}catch(_0x53756f){logger[_0x9bbc('0x36')]('[%s][voiceAgentReport][agentconnect]',_0x293f63[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x53756f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x10')]=function(_0x437766){try{if(this[_0x9bbc('0x1e')](_0x437766)){logger[_0x9bbc('0x24')](_0x9bbc('0x4e'),_0x437766[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x437766,{'showHidden':![],'depth':null}));if(this[_0x9bbc('0x9')][_0x437766[_0x9bbc('0x21')]]&&this['channels'][_0x437766['uniqueid']][_0x437766[_0x9bbc('0x23')]]){logger['info'](_0x9bbc('0x4f'),_0x437766[_0x9bbc('0x21')],_0x437766[_0x9bbc('0x22')],_0x437766[_0x9bbc('0x23')]);this[_0x9bbc('0x9')][_0x437766[_0x9bbc('0x21')]][_0x437766[_0x9bbc('0x23')]][_0x9bbc('0x47')]=!![];this['channels'][_0x437766['uniqueid']][_0x437766[_0x9bbc('0x23')]][_0x9bbc('0x48')]=moment()['format'](_0x9bbc('0x29'));this[_0x9bbc('0x9')][_0x437766[_0x9bbc('0x21')]][_0x437766['destuniqueid']][_0x9bbc('0x40')]=_0x9bbc('0x50');this[_0x9bbc('0x9')][_0x437766[_0x9bbc('0x21')]][_0x437766[_0x9bbc('0x23')]][_0x9bbc('0x4c')]=_0x9bbc('0x50');logger[_0x9bbc('0x24')](_0x9bbc('0x51'),_0x437766[_0x9bbc('0x21')],util['inspect'](this[_0x9bbc('0x9')][_0x437766[_0x9bbc('0x21')]][_0x437766[_0x9bbc('0x23')]],{'showHidden':![],'depth':null}));ami[_0x9bbc('0x1d')](_0x9bbc('0x52'),this[_0x9bbc('0x9')][_0x437766[_0x9bbc('0x21')]][_0x437766[_0x9bbc('0x23')]]);}}}catch(_0x3caeda){logger[_0x9bbc('0x36')](_0x9bbc('0x53'),_0x437766['uniqueid'],util[_0x9bbc('0x26')](_0x3caeda,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x12')]=function(_0x4102c9){try{if(this[_0x9bbc('0x1e')](_0x4102c9)){logger[_0x9bbc('0x24')](_0x9bbc('0x54'),_0x4102c9[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x4102c9,{'showHidden':![],'depth':null}));if(this[_0x9bbc('0x9')][_0x4102c9['uniqueid']]){for(var _0x94317e in this[_0x9bbc('0x9')][_0x4102c9['uniqueid']]){if(this[_0x9bbc('0x9')][_0x4102c9[_0x9bbc('0x21')]]['hasOwnProperty'](_0x94317e)&&!this[_0x9bbc('0x9')][_0x4102c9[_0x9bbc('0x21')]][_0x94317e][_0x9bbc('0x47')]&&!this[_0x9bbc('0x9')][_0x4102c9[_0x9bbc('0x21')]][_0x94317e][_0x9bbc('0x55')]){logger['info'](_0x9bbc('0x56'),_0x4102c9[_0x9bbc('0x21')],this[_0x9bbc('0x9')][_0x4102c9['uniqueid']][_0x94317e][_0x9bbc('0x22')],_0x94317e);this[_0x9bbc('0x9')][_0x4102c9[_0x9bbc('0x21')]][_0x94317e][_0x9bbc('0x47')]=!![];this[_0x9bbc('0x9')][_0x4102c9['uniqueid']][_0x94317e][_0x9bbc('0x48')]=moment()[_0x9bbc('0x28')](_0x9bbc('0x29'));this[_0x9bbc('0x9')][_0x4102c9[_0x9bbc('0x21')]][_0x94317e]['lastevent']=_0x9bbc('0x57');this[_0x9bbc('0x9')][_0x4102c9[_0x9bbc('0x21')]][_0x94317e][_0x9bbc('0x4c')]=_0x9bbc('0x57');logger[_0x9bbc('0x24')](_0x9bbc('0x58'),_0x4102c9['uniqueid'],util[_0x9bbc('0x26')](this['channels'][_0x4102c9['uniqueid']][_0x94317e],{'showHidden':![],'depth':null}));ami['emit'](_0x9bbc('0x59'),this['channels'][_0x4102c9[_0x9bbc('0x21')]][_0x94317e]);}}}}}catch(_0x458fbd){logger[_0x9bbc('0x36')](_0x9bbc('0x5a'),_0x4102c9[_0x9bbc('0x21')],util['inspect'](_0x458fbd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x13')]=function(_0x41d471){try{if(this[_0x9bbc('0x1e')](_0x41d471)){logger[_0x9bbc('0x24')](_0x9bbc('0x5b'),_0x41d471[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x41d471,{'showHidden':![],'depth':null}));if(this[_0x9bbc('0x9')][_0x41d471['uniqueid']]){for(var _0x1f45d3 in this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]]){if(this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]]['hasOwnProperty'](_0x1f45d3)){if(this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3]['agentconnectAt']&&!this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x55')]){logger[_0x9bbc('0x1f')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x41d471[_0x9bbc('0x21')],this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x22')],_0x1f45d3);this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x55')]=!![];this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x5c')]=moment()[_0x9bbc('0x28')](_0x9bbc('0x29'));this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x40')]=_0x9bbc('0x5d');this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x4c')]=_0x41d471['reason']==_0x9bbc('0x5e')?_0x9bbc('0x5f'):_0x41d471[_0x9bbc('0x4c')];this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x60')]=_0x41d471[_0x9bbc('0x60')];if(this[_0x9bbc('0xa')][_0x41d471[_0x9bbc('0x2a')]]&&this[_0x9bbc('0xa')][_0x41d471[_0x9bbc('0x2a')]][_0x9bbc('0x61')]){this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x62')]=this['voiceQueues'][_0x41d471[_0x9bbc('0x2a')]][_0x9bbc('0x63')];this['channels'][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3][_0x9bbc('0x64')]=!![];}this[_0x9bbc('0xb')][_0x41d471[_0x9bbc('0x65')]]=_[_0x9bbc('0x2f')](this['agents'][_0x41d471[_0x9bbc('0x65')]],[_0x9bbc('0x2a'),_0x9bbc('0x42')]);logger['debug'](_0x9bbc('0x66'),_0x41d471[_0x9bbc('0x21')],util[_0x9bbc('0x26')](this['channels'][_0x41d471['uniqueid']][_0x1f45d3],{'showHidden':![],'depth':null}));ami[_0x9bbc('0x1d')](_0x9bbc('0x67'),this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3]);logger['debug'](_0x9bbc('0x68'),_0x41d471[_0x9bbc('0x21')],util[_0x9bbc('0x26')](this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3],{'showHidden':![],'depth':null}));this[_0x9bbc('0x1d')](util['format'](_0x9bbc('0x34'),_0x41d471[_0x9bbc('0x22')]),_0x9bbc('0x69'),this[_0x9bbc('0x9')][_0x41d471[_0x9bbc('0x21')]][_0x1f45d3]);}}}}}}catch(_0x3de975){logger[_0x9bbc('0x36')]('[%s][voiceAgentReport][agentcomplete]',_0x41d471['uniqueid'],util[_0x9bbc('0x26')](_0x3de975,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x6a')]=function(_0x5da870){try{if(this[_0x9bbc('0x1e')](_0x5da870)){logger[_0x9bbc('0x24')](_0x9bbc('0x6b'),_0x5da870[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x5da870,{'showHidden':![],'depth':null}));this['addVariable'](_0x5da870[_0x9bbc('0x21')],_[_0x9bbc('0x6c')](_0x5da870[_0x9bbc('0x6d')])[0x0],_0x5da870[_0x9bbc('0x6e')]);if(this[_0x9bbc('0x9')][_0x5da870['uniqueid']]){for(var _0x4fde82 in this[_0x9bbc('0x9')][_0x5da870[_0x9bbc('0x21')]]){if(this[_0x9bbc('0x9')][_0x5da870[_0x9bbc('0x21')]][_0x9bbc('0x39')](_0x4fde82)){logger[_0x9bbc('0x1f')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x5da870['uniqueid'],_0x4fde82,_[_0x9bbc('0x6c')](_0x5da870[_0x9bbc('0x6d')])[0x0],_0x5da870['value']);if(_[_0x9bbc('0x27')](this['channels'][_0x5da870[_0x9bbc('0x21')]][_0x4fde82][_0x9bbc('0xc')])){this[_0x9bbc('0x9')][_0x5da870[_0x9bbc('0x21')]][_0x4fde82][_0x9bbc('0xc')]={};}this[_0x9bbc('0x9')][_0x5da870[_0x9bbc('0x21')]][_0x4fde82][_0x9bbc('0xc')]=this[_0x9bbc('0xc')][_0x5da870[_0x9bbc('0x21')]];}}}}}catch(_0x41f245){logger[_0x9bbc('0x36')]('[%s][voiceAgentReport][varset]',_0x5da870['uniqueid'],util[_0x9bbc('0x26')](_0x41f245,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x6f')]=function(_0x70f953,_0xc6d3a6,_0x3a45c1){var _0x25384c=['rtpaudioqos',_0x9bbc('0x70'),_0x9bbc('0x71'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x9bbc('0x72'),_0x9bbc('0x73'),_0x9bbc('0x74'),_0x9bbc('0x75'),'bridgepvtcallid','membercalls',_0x9bbc('0x76'),'memberinterface',_0x9bbc('0x77'),_0x9bbc('0x22'),_0x9bbc('0x78'),_0x9bbc('0x79')];if(!_[_0x9bbc('0x7a')](_0xc6d3a6)&&!_[_0x9bbc('0x7b')](_0x25384c,_0xc6d3a6)){if(_[_0x9bbc('0x27')](this[_0x9bbc('0xc')][_0x70f953])){this['variables'][_0x70f953]={};}this[_0x9bbc('0xc')][_0x70f953][_0xc6d3a6]=_0x3a45c1;}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x16')]=function(_0x40e8c2){try{if(this[_0x9bbc('0x1e')](_0x40e8c2)){logger[_0x9bbc('0x24')](_0x9bbc('0x7c'),_0x40e8c2[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x40e8c2,{'showHidden':![],'depth':null}));if(this[_0x9bbc('0x9')][_0x40e8c2['uniqueid']]){for(var _0x89fb11 in this[_0x9bbc('0x9')][_0x40e8c2['uniqueid']]){if(this[_0x9bbc('0x9')][_0x40e8c2['uniqueid']][_0x9bbc('0x39')](_0x89fb11)){if(this[_0x9bbc('0x9')][_0x40e8c2[_0x9bbc('0x21')]][_0x89fb11][_0x9bbc('0x4c')]==_0x9bbc('0x5e')&&this[_0x9bbc('0x9')][_0x40e8c2[_0x9bbc('0x21')]][_0x89fb11][_0x9bbc('0x55')]){logger[_0x9bbc('0x1f')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x40e8c2['uniqueid'],_0x89fb11);this['channels'][_0x40e8c2['uniqueid']][_0x89fb11][_0x9bbc('0x5c')]=moment()[_0x9bbc('0x28')](_0x9bbc('0x29'));}}}logger[_0x9bbc('0x24')](_0x9bbc('0x7d'),_0x40e8c2[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_[_0x9bbc('0x7e')](this['channels'][_0x40e8c2[_0x9bbc('0x21')]]),{'showHidden':![],'depth':null}));ami[_0x9bbc('0x1d')]('custom:voiceAgentReport',_[_0x9bbc('0x7e')](this[_0x9bbc('0x9')][_0x40e8c2[_0x9bbc('0x21')]]));delete this['channels'][_0x40e8c2[_0x9bbc('0x21')]];}if(this['variables'][_0x40e8c2[_0x9bbc('0x21')]]){delete this[_0x9bbc('0xc')][_0x40e8c2[_0x9bbc('0x21')]];}}}catch(_0x1e280b){logger[_0x9bbc('0x36')](_0x9bbc('0x7f'),_0x40e8c2[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x1e280b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x80')]=function(_0x1e1801){try{if(this[_0x9bbc('0x1e')](_0x1e1801)){logger[_0x9bbc('0x24')](_0x9bbc('0x81'),_0x1e1801[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x1e1801,{'showHidden':![],'depth':null}));if(this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x82')]]){for(var _0x3d4f24 in this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x82')]]){if(this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x82')]][_0x9bbc('0x39')](_0x3d4f24)){if(_0x1e1801[_0x9bbc('0x83')]===_0x3d4f24){logger[_0x9bbc('0x1f')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1e1801[_0x9bbc('0x21')],this['channels'][_0x1e1801['transfereeuniqueid']][_0x3d4f24][_0x9bbc('0x22')],_0x3d4f24);var _0x16355d=moment();this['channels'][_0x1e1801[_0x9bbc('0x82')]][_0x3d4f24][_0x9bbc('0x55')]=!![];this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x82')]][_0x3d4f24][_0x9bbc('0x5c')]=moment()[_0x9bbc('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9bbc('0x9')][_0x1e1801['transfereeuniqueid']][_0x3d4f24][_0x9bbc('0x40')]=_0x9bbc('0x5d');this[_0x9bbc('0x9')][_0x1e1801['transfereeuniqueid']][_0x3d4f24][_0x9bbc('0x4c')]=_0x9bbc('0x5e');this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x82')]][_0x3d4f24][_0x9bbc('0x60')]=_0x16355d[_0x9bbc('0x84')](this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x82')]][_0x3d4f24]['agentconnectAt'],_0x9bbc('0x85'));}}}}if(this['channels'][_0x1e1801[_0x9bbc('0x86')]]){var _0x4fc306=this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x86')]];this[_0x9bbc('0x9')][_0x1e1801['secondtransfereruniqueid']]=this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x82')]];this[_0x9bbc('0x9')][_0x1e1801[_0x9bbc('0x82')]]=_0x4fc306;}}}catch(_0x66b3cc){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x1e1801[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x66b3cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x1b')]=function(_0x3debbe){try{if(this[_0x9bbc('0x1e')](_0x3debbe)){logger[_0x9bbc('0x24')](_0x9bbc('0x87'),_0x3debbe[_0x9bbc('0x21')],util['inspect'](_0x3debbe,{'showHidden':![],'depth':null}));if(this['channels'][_0x3debbe['transfereeuniqueid']]){for(var _0x2bcf96 in this[_0x9bbc('0x9')][_0x3debbe[_0x9bbc('0x82')]]){if(this[_0x9bbc('0x9')][_0x3debbe['transfereeuniqueid']]['hasOwnProperty'](_0x2bcf96)){if(_0x3debbe[_0x9bbc('0x88')]===_0x2bcf96){logger[_0x9bbc('0x1f')](_0x9bbc('0x89'),_0x3debbe['uniqueid'],this[_0x9bbc('0x9')][_0x3debbe[_0x9bbc('0x82')]][_0x2bcf96][_0x9bbc('0x22')],_0x2bcf96);var _0x3ee071=moment();this[_0x9bbc('0x9')][_0x3debbe[_0x9bbc('0x82')]][_0x2bcf96][_0x9bbc('0x55')]=!![];this[_0x9bbc('0x9')][_0x3debbe[_0x9bbc('0x82')]][_0x2bcf96][_0x9bbc('0x5c')]=_0x3ee071;this['channels'][_0x3debbe[_0x9bbc('0x82')]][_0x2bcf96][_0x9bbc('0x40')]=_0x9bbc('0x5d');this[_0x9bbc('0x9')][_0x3debbe[_0x9bbc('0x82')]][_0x2bcf96][_0x9bbc('0x4c')]=_0x9bbc('0x5e');this[_0x9bbc('0x9')][_0x3debbe[_0x9bbc('0x82')]][_0x2bcf96][_0x9bbc('0x60')]=_0x3ee071['diff'](this[_0x9bbc('0x9')][_0x3debbe[_0x9bbc('0x82')]][_0x2bcf96][_0x9bbc('0x3b')],'seconds');}}}}}}catch(_0x366960){logger[_0x9bbc('0x36')](_0x9bbc('0x8a'),_0x3debbe[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x366960,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x18')]=function(_0x168bc1){var _0x4f7364='';try{if(this[_0x9bbc('0x1e')](_0x168bc1)){logger[_0x9bbc('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x168bc1['uniqueid'],util['inspect'](_0x168bc1,{'showHidden':![],'depth':null}));if(_0x168bc1[_0x9bbc('0x8b')]){_0x4f7364=_0x168bc1[_0x9bbc('0x8b')][_0x9bbc('0x8c')](0x0,_0x168bc1[_0x9bbc('0x8b')][_0x9bbc('0x8d')]('-'));if(this[_0x9bbc('0xb')][_0x4f7364]){logger[_0x9bbc('0x1f')](_0x9bbc('0x8e'),_0x168bc1[_0x9bbc('0x21')],_0x4f7364);this[_0x9bbc('0xb')][_0x4f7364]['onhold']=!![];}}}}catch(_0x120f46){logger[_0x9bbc('0x36')](_0x9bbc('0x8f'),_0x168bc1[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x120f46,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bbc('0x1c')][_0x9bbc('0x1a')]=function(_0xf072d6){var _0x161b28='';try{if(this[_0x9bbc('0x1e')](_0xf072d6)){logger[_0x9bbc('0x24')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0xf072d6[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0xf072d6,{'showHidden':![],'depth':null}));if(_0xf072d6['channel']){_0x161b28=_0xf072d6[_0x9bbc('0x8b')][_0x9bbc('0x8c')](0x0,_0xf072d6[_0x9bbc('0x8b')][_0x9bbc('0x8d')]('-'));if(this[_0x9bbc('0xb')][_0x161b28]){logger[_0x9bbc('0x1f')](_0x9bbc('0x90'),_0xf072d6[_0x9bbc('0x21')],_0x161b28);this[_0x9bbc('0xb')][_0x161b28][_0x9bbc('0x91')]=![];}}}}catch(_0x34952f){logger[_0x9bbc('0x36')]('[%s][voiceAgentReport][musiconholdstop]',_0xf072d6[_0x9bbc('0x21')],util[_0x9bbc('0x26')](_0x34952f,{'showHidden':![],'depth':null}));}};module[_0x9bbc('0x92')]=VoiceAgentReport; \ No newline at end of file +var _0x17fd=['rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','bind','agentcomplete','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','isUndefined','prototype','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','queue','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','variables','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0xdfea43,_0x26faad){var _0x2bda5a=function(_0x38a519){while(--_0x38a519){_0xdfea43['push'](_0xdfea43['shift']());}};_0x2bda5a(++_0x26faad);}(_0x17fd,0x1df));var _0xd17f=function(_0x364877,_0x3fd085){_0x364877=_0x364877-0x0;var _0x43863d=_0x17fd[_0x364877];return _0x43863d;};'use strict';var _=require(_0xd17f('0x0'));var moment=require(_0xd17f('0x1'));var util=require(_0xd17f('0x2'));var Redis=require(_0xd17f('0x3'));var config=require('../../../config/environment');var logger=require(_0xd17f('0x4'))(_0xd17f('0x5'));var ami=require('../ami');config[_0xd17f('0x6')]=_[_0xd17f('0x7')](config['redis'],{'host':_0xd17f('0x8'),'port':0x18eb});var io=require(_0xd17f('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x53995d){this[_0xd17f('0xa')]={};this[_0xd17f('0xb')]=_0x53995d[_0xd17f('0xb')];this[_0xd17f('0xc')]=_0x53995d['agents'];this['variables']={};ami['on'](_0xd17f('0xd'),this[_0xd17f('0xe')]['bind'](this));ami['on'](_0xd17f('0xf'),this[_0xd17f('0x10')]['bind'](this));ami['on'](_0xd17f('0x11'),this[_0xd17f('0x12')]['bind'](this));ami['on'](_0xd17f('0x13'),this[_0xd17f('0x14')][_0xd17f('0x15')](this));ami['on'](_0xd17f('0x16'),this['syncAgentComplete']['bind'](this));ami['on']('varset',this[_0xd17f('0x17')]['bind'](this));ami['on'](_0xd17f('0x18'),this['syncHangup']['bind'](this));ami['on'](_0xd17f('0x19'),this[_0xd17f('0x1a')][_0xd17f('0x15')](this));ami['on'](_0xd17f('0x1b'),this['syncMusicOnHoldStop'][_0xd17f('0x15')](this));ami['on'](_0xd17f('0x1c'),this[_0xd17f('0x1d')][_0xd17f('0x15')](this));ami['on'](_0xd17f('0x1e'),this[_0xd17f('0x1f')][_0xd17f('0x15')](this));}VoiceAgentReport['prototype'][_0xd17f('0x20')]=function(_0x3689a6,_0x1eca7f,_0x26a7cf){io['to'](_0x3689a6)[_0xd17f('0x20')](_0x1eca7f,_0x26a7cf);};VoiceAgentReport['prototype']['isNotNull']=function(_0x222cb8){return _0x222cb8!==null&&!_[_0xd17f('0x21')](_0x222cb8);};VoiceAgentReport[_0xd17f('0x22')]['syncAgentCalled']=function(_0x42eee0){try{if(this[_0xd17f('0x23')](_0x42eee0)){logger[_0xd17f('0x24')](_0xd17f('0x25'),_0x42eee0[_0xd17f('0x26')],_0x42eee0[_0xd17f('0x27')],_0x42eee0[_0xd17f('0x28')]);logger[_0xd17f('0x29')](_0xd17f('0x2a'),_0x42eee0[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x42eee0,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x42eee0['uniqueid']])){this[_0xd17f('0xa')][_0x42eee0[_0xd17f('0x26')]]={};}if(_[_0xd17f('0x21')](this['channels'][_0x42eee0[_0xd17f('0x26')]][_0x42eee0[_0xd17f('0x28')]])){this[_0xd17f('0xa')][_0x42eee0[_0xd17f('0x26')]][_0x42eee0[_0xd17f('0x28')]]={'agentcalledAt':moment()[_0xd17f('0x2c')](_0xd17f('0x2d')),'lastevent':'called','mandatoryDisposition':this[_0xd17f('0xb')][_0x42eee0['queue']]?this[_0xd17f('0xb')][_0x42eee0['queue']][_0xd17f('0x2e')]||![]:![],'type':this[_0xd17f('0xb')][_0x42eee0[_0xd17f('0x2f')]]?this['voiceQueues'][_0x42eee0[_0xd17f('0x2f')]][_0xd17f('0x30')]||_0xd17f('0x31'):_0xd17f('0x31'),'variables':this['variables'][_0x42eee0['uniqueid']]};}_[_0xd17f('0x32')](this[_0xd17f('0xa')][_0x42eee0[_0xd17f('0x26')]][_0x42eee0[_0xd17f('0x28')]],_[_0xd17f('0x33')](_0x42eee0,[_0xd17f('0x34'),_0xd17f('0x35')]));logger['debug'](_0xd17f('0x36'),_0x42eee0[_0xd17f('0x26')],util[_0xd17f('0x2b')](this[_0xd17f('0xa')][_0x42eee0[_0xd17f('0x26')]][_0x42eee0[_0xd17f('0x28')]],{'showHidden':![],'depth':null}));ami[_0xd17f('0x20')](_0xd17f('0x37'),this['channels'][_0x42eee0[_0xd17f('0x26')]][_0x42eee0[_0xd17f('0x28')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x42eee0[_0xd17f('0x26')],util[_0xd17f('0x2b')](this['channels'][_0x42eee0[_0xd17f('0x26')]][_0x42eee0[_0xd17f('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xd17f('0x38'),_0x42eee0['membername']),_0xd17f('0x39'),this[_0xd17f('0xa')][_0x42eee0['uniqueid']][_0x42eee0[_0xd17f('0x28')]]);}}catch(_0x180b20){logger[_0xd17f('0x3a')](_0xd17f('0x3b'),_0x42eee0[_0xd17f('0x26')],util['inspect'](_0x180b20,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd17f('0x22')][_0xd17f('0x10')]=function(_0x2e095e){try{if(this[_0xd17f('0x23')](_0x2e095e)){if(this['channels'][_0x2e095e[_0xd17f('0x26')]]){logger[_0xd17f('0x29')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x2e095e[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x2e095e,{'showHidden':![],'depth':null}));for(var _0x163317 in this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]]){if(this[_0xd17f('0xa')][_0x2e095e['uniqueid']][_0xd17f('0x3c')](_0x163317)){if(_0x2e095e[_0xd17f('0x28')]===_0x163317){logger[_0xd17f('0x24')](_0xd17f('0x3d'),_0x2e095e[_0xd17f('0x26')],_0x2e095e[_0xd17f('0x27')],_0x2e095e[_0xd17f('0x28')]);this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x3e')]=moment()[_0xd17f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x3f')]=_0x2e095e[_0xd17f('0x3f')];this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x40')]=_0x2e095e['connectedlinenum'];this['channels'][_0x2e095e['uniqueid']][_0x163317][_0xd17f('0x41')]=_0x2e095e[_0xd17f('0x41')];this[_0xd17f('0xa')][_0x2e095e['uniqueid']][_0x163317][_0xd17f('0x42')]=_0x2e095e[_0xd17f('0x42')];this[_0xd17f('0xa')][_0x2e095e['uniqueid']][_0x163317][_0xd17f('0x43')]=_0x2e095e[_0xd17f('0x43')];this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317]['lastevent']=_0xd17f('0x44');_[_0xd17f('0x32')](this[_0xd17f('0xc')][_0x2e095e[_0xd17f('0x45')]],_[_0xd17f('0x46')](_0x2e095e,[_0xd17f('0x2f'),_0xd17f('0x47')]));logger[_0xd17f('0x29')](_0xd17f('0x48'),_0x2e095e[_0xd17f('0x26')],util['inspect'](this[_0xd17f('0xa')][_0x2e095e['uniqueid']][_0x2e095e[_0xd17f('0x28')]],{'showHidden':![],'depth':null}));ami[_0xd17f('0x20')](_0xd17f('0x49'),this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x2e095e[_0xd17f('0x28')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x2e095e[_0xd17f('0x26')],util['inspect'](this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x2e095e[_0xd17f('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xd17f('0x2c')](_0xd17f('0x38'),_0x2e095e[_0xd17f('0x27')]),_0xd17f('0x4a'),this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x2e095e[_0xd17f('0x28')]]);}else if(!this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317]['agentringnoanswer']&&!this[_0xd17f('0xa')][_0x2e095e['uniqueid']][_0x163317]['agentcomplete']){logger[_0xd17f('0x24')](_0xd17f('0x4b'),_0x2e095e[_0xd17f('0x26')],this['channels'][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x27')],_0x163317);this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x11')]=!![];this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x4d')]=_0x2e095e['destuniqueid'];this['channels'][_0x2e095e['uniqueid']][_0x163317][_0xd17f('0x4e')]=_0x2e095e['membername'];this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x4f')]='answered_elsewhere';this['channels'][_0x2e095e[_0xd17f('0x26')]][_0x163317][_0xd17f('0x50')]=_0xd17f('0x51');logger['debug'](_0xd17f('0x52'),_0x2e095e[_0xd17f('0x26')],util[_0xd17f('0x2b')](this[_0xd17f('0xa')][_0x2e095e[_0xd17f('0x26')]][_0x163317],{'showHidden':![],'depth':null}));ami[_0xd17f('0x20')](_0xd17f('0x53'),this['channels'][_0x2e095e[_0xd17f('0x26')]][_0x163317]);}}}}}}catch(_0x7993ca){logger[_0xd17f('0x3a')](_0xd17f('0x54'),_0x2e095e[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x7993ca,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd17f('0x22')][_0xd17f('0x12')]=function(_0x3d70e7){try{if(this[_0xd17f('0x23')](_0x3d70e7)){logger[_0xd17f('0x29')](_0xd17f('0x55'),_0x3d70e7[_0xd17f('0x26')],util['inspect'](_0x3d70e7,{'showHidden':![],'depth':null}));if(this[_0xd17f('0xa')][_0x3d70e7[_0xd17f('0x26')]]&&this[_0xd17f('0xa')][_0x3d70e7[_0xd17f('0x26')]][_0x3d70e7[_0xd17f('0x28')]]){logger[_0xd17f('0x24')](_0xd17f('0x56'),_0x3d70e7[_0xd17f('0x26')],_0x3d70e7['membername'],_0x3d70e7[_0xd17f('0x28')]);this[_0xd17f('0xa')][_0x3d70e7[_0xd17f('0x26')]][_0x3d70e7[_0xd17f('0x28')]][_0xd17f('0x11')]=!![];this[_0xd17f('0xa')][_0x3d70e7[_0xd17f('0x26')]][_0x3d70e7[_0xd17f('0x28')]]['agentringnoanswerAt']=moment()[_0xd17f('0x2c')](_0xd17f('0x2d'));this['channels'][_0x3d70e7[_0xd17f('0x26')]][_0x3d70e7[_0xd17f('0x28')]][_0xd17f('0x4f')]=_0xd17f('0x57');this['channels'][_0x3d70e7[_0xd17f('0x26')]][_0x3d70e7[_0xd17f('0x28')]][_0xd17f('0x50')]=_0xd17f('0x57');logger[_0xd17f('0x29')](_0xd17f('0x58'),_0x3d70e7[_0xd17f('0x26')],util['inspect'](this[_0xd17f('0xa')][_0x3d70e7['uniqueid']][_0x3d70e7[_0xd17f('0x28')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this[_0xd17f('0xa')][_0x3d70e7[_0xd17f('0x26')]][_0x3d70e7[_0xd17f('0x28')]]);}}}catch(_0x21eced){logger[_0xd17f('0x3a')](_0xd17f('0x59'),_0x3d70e7[_0xd17f('0x26')],util['inspect'](_0x21eced,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd17f('0x22')][_0xd17f('0x14')]=function(_0x4c826d){try{if(this['isNotNull'](_0x4c826d)){logger[_0xd17f('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x4c826d['uniqueid'],util[_0xd17f('0x2b')](_0x4c826d,{'showHidden':![],'depth':null}));if(this[_0xd17f('0xa')][_0x4c826d[_0xd17f('0x26')]]){for(var _0x31e81f in this[_0xd17f('0xa')][_0x4c826d[_0xd17f('0x26')]]){if(this[_0xd17f('0xa')][_0x4c826d[_0xd17f('0x26')]][_0xd17f('0x3c')](_0x31e81f)&&!this[_0xd17f('0xa')][_0x4c826d['uniqueid']][_0x31e81f][_0xd17f('0x11')]&&!this[_0xd17f('0xa')][_0x4c826d[_0xd17f('0x26')]][_0x31e81f][_0xd17f('0x16')]){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4c826d['uniqueid'],this[_0xd17f('0xa')][_0x4c826d['uniqueid']][_0x31e81f][_0xd17f('0x27')],_0x31e81f);this[_0xd17f('0xa')][_0x4c826d[_0xd17f('0x26')]][_0x31e81f][_0xd17f('0x11')]=!![];this[_0xd17f('0xa')][_0x4c826d[_0xd17f('0x26')]][_0x31e81f][_0xd17f('0x4c')]=moment()[_0xd17f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd17f('0xa')][_0x4c826d['uniqueid']][_0x31e81f][_0xd17f('0x4f')]=_0xd17f('0x5a');this[_0xd17f('0xa')][_0x4c826d[_0xd17f('0x26')]][_0x31e81f]['reason']=_0xd17f('0x5a');logger['debug'](_0xd17f('0x5b'),_0x4c826d[_0xd17f('0x26')],util[_0xd17f('0x2b')](this[_0xd17f('0xa')][_0x4c826d[_0xd17f('0x26')]][_0x31e81f],{'showHidden':![],'depth':null}));ami[_0xd17f('0x20')]('custom:agentqueuecallerabandon',this['channels'][_0x4c826d[_0xd17f('0x26')]][_0x31e81f]);}}}}}catch(_0x966bf9){logger[_0xd17f('0x3a')](_0xd17f('0x5c'),_0x4c826d[_0xd17f('0x26')],util['inspect'](_0x966bf9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd17f('0x5d')]=function(_0x161362){try{if(this[_0xd17f('0x23')](_0x161362)){logger['debug'](_0xd17f('0x5e'),_0x161362['uniqueid'],util[_0xd17f('0x2b')](_0x161362,{'showHidden':![],'depth':null}));if(this[_0xd17f('0xa')][_0x161362['uniqueid']]){for(var _0x1dab56 in this[_0xd17f('0xa')][_0x161362[_0xd17f('0x26')]]){if(this[_0xd17f('0xa')][_0x161362['uniqueid']][_0xd17f('0x3c')](_0x1dab56)){if(this[_0xd17f('0xa')][_0x161362[_0xd17f('0x26')]][_0x1dab56]['agentconnectAt']&&!this[_0xd17f('0xa')][_0x161362[_0xd17f('0x26')]][_0x1dab56][_0xd17f('0x16')]){logger[_0xd17f('0x24')](_0xd17f('0x5f'),_0x161362['uniqueid'],this[_0xd17f('0xa')][_0x161362['uniqueid']][_0x1dab56][_0xd17f('0x27')],_0x1dab56);this[_0xd17f('0xa')][_0x161362[_0xd17f('0x26')]][_0x1dab56][_0xd17f('0x16')]=!![];this[_0xd17f('0xa')][_0x161362['uniqueid']][_0x1dab56][_0xd17f('0x60')]=moment()[_0xd17f('0x2c')](_0xd17f('0x2d'));this['channels'][_0x161362[_0xd17f('0x26')]][_0x1dab56][_0xd17f('0x4f')]=_0xd17f('0x61');this[_0xd17f('0xa')][_0x161362[_0xd17f('0x26')]][_0x1dab56][_0xd17f('0x50')]=_0x161362[_0xd17f('0x50')]==_0xd17f('0x62')?'agent':_0x161362[_0xd17f('0x50')];this[_0xd17f('0xa')][_0x161362['uniqueid']][_0x1dab56][_0xd17f('0x63')]=_0x161362['talktime'];if(this[_0xd17f('0xb')][_0x161362['queue']]&&this['voiceQueues'][_0x161362[_0xd17f('0x2f')]][_0xd17f('0x64')]){this[_0xd17f('0xa')][_0x161362['uniqueid']][_0x1dab56]['acwtime']=this[_0xd17f('0xb')][_0x161362[_0xd17f('0x2f')]][_0xd17f('0x65')];this['channels'][_0x161362['uniqueid']][_0x1dab56][_0xd17f('0x66')]=!![];}this[_0xd17f('0xc')][_0x161362[_0xd17f('0x45')]]=_[_0xd17f('0x33')](this['agents'][_0x161362['interface']],['queue','destconnectedlinenum']);logger[_0xd17f('0x29')](_0xd17f('0x67'),_0x161362['uniqueid'],util[_0xd17f('0x2b')](this[_0xd17f('0xa')][_0x161362[_0xd17f('0x26')]][_0x1dab56],{'showHidden':![],'depth':null}));ami[_0xd17f('0x20')]('custom:agentcomplete',this[_0xd17f('0xa')][_0x161362[_0xd17f('0x26')]][_0x1dab56]);logger['debug'](_0xd17f('0x68'),_0x161362[_0xd17f('0x26')],util['inspect'](this[_0xd17f('0xa')][_0x161362[_0xd17f('0x26')]][_0x1dab56],{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x161362[_0xd17f('0x27')]),_0xd17f('0x69'),this[_0xd17f('0xa')][_0x161362['uniqueid']][_0x1dab56]);}}}}}}catch(_0x1f4f6c){logger[_0xd17f('0x3a')](_0xd17f('0x6a'),_0x161362['uniqueid'],util[_0xd17f('0x2b')](_0x1f4f6c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd17f('0x22')][_0xd17f('0x17')]=function(_0x4419da){try{if(this[_0xd17f('0x23')](_0x4419da)){logger[_0xd17f('0x29')]('[%s][voiceAgentReport][varset]\x20event:',_0x4419da['uniqueid'],util['inspect'](_0x4419da,{'showHidden':![],'depth':null}));this['addVariable'](_0x4419da[_0xd17f('0x26')],_['keys'](_0x4419da[_0xd17f('0x6b')])[0x0],_0x4419da[_0xd17f('0x6c')]);if(this[_0xd17f('0xa')][_0x4419da['uniqueid']]){for(var _0x2dfd87 in this['channels'][_0x4419da[_0xd17f('0x26')]]){if(this[_0xd17f('0xa')][_0x4419da[_0xd17f('0x26')]][_0xd17f('0x3c')](_0x2dfd87)){logger['info'](_0xd17f('0x6d'),_0x4419da['uniqueid'],_0x2dfd87,_[_0xd17f('0x6e')](_0x4419da[_0xd17f('0x6b')])[0x0],_0x4419da[_0xd17f('0x6c')]);if(_[_0xd17f('0x21')](this[_0xd17f('0xa')][_0x4419da[_0xd17f('0x26')]][_0x2dfd87][_0xd17f('0x6f')])){this[_0xd17f('0xa')][_0x4419da['uniqueid']][_0x2dfd87][_0xd17f('0x6f')]={};}this[_0xd17f('0xa')][_0x4419da[_0xd17f('0x26')]][_0x2dfd87]['variables']=this['variables'][_0x4419da['uniqueid']];}}}}}catch(_0x61faca){logger[_0xd17f('0x3a')]('[%s][voiceAgentReport][varset]',_0x4419da[_0xd17f('0x26')],util['inspect'](_0x61faca,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x6c4fc4,_0x2abb50,_0x4c5138){var _0x2a4a63=[_0xd17f('0x70'),'rtpaudioqosbridged',_0xd17f('0x71'),_0xd17f('0x72'),_0xd17f('0x73'),_0xd17f('0x74'),_0xd17f('0x75'),_0xd17f('0x76'),_0xd17f('0x77'),_0xd17f('0x78'),_0xd17f('0x79'),_0xd17f('0x7a'),_0xd17f('0x7b'),_0xd17f('0x7c'),_0xd17f('0x7d'),'memberlastcall','membername','memberpenalty',_0xd17f('0x7e')];if(!_[_0xd17f('0x7f')](_0x2abb50)&&!_[_0xd17f('0x80')](_0x2a4a63,_0x2abb50)){if(_[_0xd17f('0x21')](this[_0xd17f('0x6f')][_0x6c4fc4])){this['variables'][_0x6c4fc4]={};}this[_0xd17f('0x6f')][_0x6c4fc4][_0x2abb50]=_0x4c5138;}};VoiceAgentReport[_0xd17f('0x22')]['syncHangup']=function(_0x3a9101){try{if(this[_0xd17f('0x23')](_0x3a9101)){logger[_0xd17f('0x29')]('[%s][voiceAgentReport][hangup]\x20event:',_0x3a9101[_0xd17f('0x26')],util['inspect'](_0x3a9101,{'showHidden':![],'depth':null}));if(this[_0xd17f('0xa')][_0x3a9101['uniqueid']]){for(var _0xc3e2e1 in this[_0xd17f('0xa')][_0x3a9101[_0xd17f('0x26')]]){if(this['channels'][_0x3a9101['uniqueid']][_0xd17f('0x3c')](_0xc3e2e1)){if(this['channels'][_0x3a9101[_0xd17f('0x26')]][_0xc3e2e1][_0xd17f('0x50')]==_0xd17f('0x62')&&this[_0xd17f('0xa')][_0x3a9101['uniqueid']][_0xc3e2e1]['agentcomplete']){logger[_0xd17f('0x24')](_0xd17f('0x81'),_0x3a9101[_0xd17f('0x26')],_0xc3e2e1);this['channels'][_0x3a9101[_0xd17f('0x26')]][_0xc3e2e1]['agentcompleteAt']=moment()[_0xd17f('0x2c')](_0xd17f('0x2d'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x3a9101[_0xd17f('0x26')],util['inspect'](_[_0xd17f('0x82')](this[_0xd17f('0xa')][_0x3a9101[_0xd17f('0x26')]]),{'showHidden':![],'depth':null}));ami[_0xd17f('0x20')]('custom:voiceAgentReport',_[_0xd17f('0x82')](this[_0xd17f('0xa')][_0x3a9101[_0xd17f('0x26')]]));delete this[_0xd17f('0xa')][_0x3a9101[_0xd17f('0x26')]];}if(this['variables'][_0x3a9101['uniqueid']]){delete this['variables'][_0x3a9101[_0xd17f('0x26')]];}}}catch(_0x31f437){logger['error']('[%s][voiceAgentReport][hangup]',_0x3a9101[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x31f437,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd17f('0x22')]['syncAttendedTransfer']=function(_0x767cfd){try{if(this[_0xd17f('0x23')](_0x767cfd)){logger[_0xd17f('0x29')](_0xd17f('0x83'),_0x767cfd[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x767cfd,{'showHidden':![],'depth':null}));if(this['channels'][_0x767cfd['transfereeuniqueid']]){for(var _0x34dbe1 in this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x84')]]){if(this['channels'][_0x767cfd[_0xd17f('0x84')]][_0xd17f('0x3c')](_0x34dbe1)){if(_0x767cfd[_0xd17f('0x85')]===_0x34dbe1){logger[_0xd17f('0x24')](_0xd17f('0x86'),_0x767cfd['uniqueid'],this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x84')]][_0x34dbe1][_0xd17f('0x27')],_0x34dbe1);var _0x2bb51b=moment();this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x84')]][_0x34dbe1][_0xd17f('0x16')]=!![];this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x84')]][_0x34dbe1][_0xd17f('0x60')]=moment()[_0xd17f('0x2c')](_0xd17f('0x2d'));this[_0xd17f('0xa')][_0x767cfd['transfereeuniqueid']][_0x34dbe1][_0xd17f('0x4f')]=_0xd17f('0x61');this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x84')]][_0x34dbe1][_0xd17f('0x50')]=_0xd17f('0x62');this[_0xd17f('0xa')][_0x767cfd['transfereeuniqueid']][_0x34dbe1][_0xd17f('0x63')]=_0x2bb51b['diff'](this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x84')]][_0x34dbe1]['agentconnectAt'],_0xd17f('0x87'));}}}}if(this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x88')]]){var _0x4a7825=this['channels'][_0x767cfd[_0xd17f('0x88')]];this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x88')]]=this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x84')]];this[_0xd17f('0xa')][_0x767cfd[_0xd17f('0x84')]]=_0x4a7825;}}}catch(_0x283683){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x767cfd[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x283683,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd17f('0x22')][_0xd17f('0x1f')]=function(_0x2bff5b){try{if(this[_0xd17f('0x23')](_0x2bff5b)){logger[_0xd17f('0x29')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x2bff5b[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x2bff5b,{'showHidden':![],'depth':null}));if(this[_0xd17f('0xa')][_0x2bff5b[_0xd17f('0x84')]]){for(var _0x11dada in this[_0xd17f('0xa')][_0x2bff5b[_0xd17f('0x84')]]){if(this[_0xd17f('0xa')][_0x2bff5b['transfereeuniqueid']][_0xd17f('0x3c')](_0x11dada)){if(_0x2bff5b['transfereruniqueid']===_0x11dada){logger[_0xd17f('0x24')](_0xd17f('0x89'),_0x2bff5b['uniqueid'],this[_0xd17f('0xa')][_0x2bff5b[_0xd17f('0x84')]][_0x11dada][_0xd17f('0x27')],_0x11dada);var _0x15d9ed=moment();this[_0xd17f('0xa')][_0x2bff5b[_0xd17f('0x84')]][_0x11dada][_0xd17f('0x16')]=!![];this['channels'][_0x2bff5b[_0xd17f('0x84')]][_0x11dada][_0xd17f('0x60')]=_0x15d9ed;this[_0xd17f('0xa')][_0x2bff5b[_0xd17f('0x84')]][_0x11dada][_0xd17f('0x4f')]='complete';this[_0xd17f('0xa')][_0x2bff5b[_0xd17f('0x84')]][_0x11dada]['reason']=_0xd17f('0x62');this[_0xd17f('0xa')][_0x2bff5b[_0xd17f('0x84')]][_0x11dada][_0xd17f('0x63')]=_0x15d9ed[_0xd17f('0x8a')](this['channels'][_0x2bff5b[_0xd17f('0x84')]][_0x11dada]['agentconnectAt'],'seconds');}}}}}}catch(_0x30b7bd){logger[_0xd17f('0x3a')](_0xd17f('0x8b'),_0x2bff5b[_0xd17f('0x26')],util['inspect'](_0x30b7bd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x53bc1e){var _0x5d9a87='';try{if(this[_0xd17f('0x23')](_0x53bc1e)){logger[_0xd17f('0x29')](_0xd17f('0x8c'),_0x53bc1e[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x53bc1e,{'showHidden':![],'depth':null}));if(_0x53bc1e[_0xd17f('0x8d')]){_0x5d9a87=_0x53bc1e['channel'][_0xd17f('0x8e')](0x0,_0x53bc1e[_0xd17f('0x8d')][_0xd17f('0x8f')]('-'));if(this[_0xd17f('0xc')][_0x5d9a87]){logger['info'](_0xd17f('0x90'),_0x53bc1e[_0xd17f('0x26')],_0x5d9a87);this[_0xd17f('0xc')][_0x5d9a87]['onhold']=!![];}}}}catch(_0x50b974){logger['error'](_0xd17f('0x91'),_0x53bc1e[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x50b974,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd17f('0x92')]=function(_0x3b9bc2){var _0x3c98db='';try{if(this[_0xd17f('0x23')](_0x3b9bc2)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x3b9bc2['uniqueid'],util['inspect'](_0x3b9bc2,{'showHidden':![],'depth':null}));if(_0x3b9bc2[_0xd17f('0x8d')]){_0x3c98db=_0x3b9bc2[_0xd17f('0x8d')][_0xd17f('0x8e')](0x0,_0x3b9bc2[_0xd17f('0x8d')][_0xd17f('0x8f')]('-'));if(this[_0xd17f('0xc')][_0x3c98db]){logger[_0xd17f('0x24')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b9bc2['uniqueid'],_0x3c98db);this[_0xd17f('0xc')][_0x3c98db]['onhold']=![];}}}}catch(_0x41bc17){logger[_0xd17f('0x3a')](_0xd17f('0x93'),_0x3b9bc2[_0xd17f('0x26')],util[_0xd17f('0x2b')](_0x41bc17,{'showHidden':![],'depth':null}));}};module[_0xd17f('0x94')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 65bd2a8..3328c93 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 _0x0d0f=['debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','merge','pick','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','linkedid','channel','OutgoingSpoolFailed','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','keys','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','lastdata','startsWith','cdr(','applicationdata','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transferType','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','not_inuse','invalid','unavailable','ringing','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','info','calleridnum'];(function(_0x2825bd,_0x2bec69){var _0x1aa435=function(_0x5d5061){while(--_0x5d5061){_0x2825bd['push'](_0x2825bd['shift']());}};_0x1aa435(++_0x2bec69);}(_0x0d0f,0x166));var _0xf0d0=function(_0x2a4463,_0x2a3f18){_0x2a4463=_0x2a4463-0x0;var _0x2033f5=_0x0d0f[_0x2a4463];return _0x2033f5;};'use strict';var BPromise=require(_0xf0d0('0x0'));var _=require(_0xf0d0('0x1'));var moment=require('moment');var util=require(_0xf0d0('0x2'));var path=require('path');var Redis=require(_0xf0d0('0x3'));var config=require(_0xf0d0('0x4'));var logger=require(_0xf0d0('0x5'))(_0xf0d0('0x6'));var ami=require(_0xf0d0('0x7'));var Channel=require('../model/channel');var RpcSetting=require(_0xf0d0('0x8'));var statusDesc=['unknown',_0xf0d0('0x9'),'inuse','busy',_0xf0d0('0xa'),_0xf0d0('0xb'),_0xf0d0('0xc'),'ringinuse',_0xf0d0('0xd')];var applications=[_0xf0d0('0xe'),_0xf0d0('0xf'),_0xf0d0('0x10'),_0xf0d0('0x11'),_0xf0d0('0x12'),_0xf0d0('0x13')];var dispositions=[_0xf0d0('0x14'),_0xf0d0('0x15'),_0xf0d0('0x15'),_0xf0d0('0x14'),_0xf0d0('0x14'),_0xf0d0('0x14'),_0xf0d0('0x16'),_0xf0d0('0x17'),_0xf0d0('0x15'),_0xf0d0('0x15'),_0xf0d0('0x15')];var actions={};config[_0xf0d0('0x18')]=_[_0xf0d0('0x19')](config[_0xf0d0('0x18')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf0d0('0x18')]));function VoiceCallReport(_0xd70c31){this[_0xf0d0('0x1a')]=_0xd70c31[_0xf0d0('0x1a')];this[_0xf0d0('0x1b')]=_0xd70c31[_0xf0d0('0x1b')];this['blindTransfers']={};ami['on'](_0xf0d0('0x1c'),this[_0xf0d0('0x1d')][_0xf0d0('0x1e')](this));ami['on'](_0xf0d0('0x1f'),this[_0xf0d0('0x1d')][_0xf0d0('0x1e')](this));ami['on'](_0xf0d0('0x20'),this[_0xf0d0('0x21')][_0xf0d0('0x1e')](this));ami['on'](_0xf0d0('0x22'),this[_0xf0d0('0x23')][_0xf0d0('0x1e')](this));ami['on'](_0xf0d0('0x24'),this[_0xf0d0('0x25')]['bind'](this));ami['on']('hangup',this[_0xf0d0('0x26')][_0xf0d0('0x1e')](this));ami['on'](_0xf0d0('0x27'),this['syncNewCallerId']['bind'](this));ami['on'](_0xf0d0('0x28'),this[_0xf0d0('0x29')][_0xf0d0('0x1e')](this));ami['on'](_0xf0d0('0x2a'),this[_0xf0d0('0x2b')][_0xf0d0('0x1e')](this));ami['on'](_0xf0d0('0x2c'),this[_0xf0d0('0x2d')][_0xf0d0('0x1e')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xf0d0('0x1e')](this));try{logger['info'](_0xf0d0('0x2e'));ami['actionCoreShowChannels']();}catch(_0x31e687){logger[_0xf0d0('0x2f')](_0xf0d0('0x30'),util[_0xf0d0('0x31')](_0x31e687,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf0d0('0x32')][_0xf0d0('0x33')]=function(_0x2a43cf){return _0x2a43cf!==null&&!_[_0xf0d0('0x34')](_0x2a43cf);};VoiceCallReport[_0xf0d0('0x32')][_0xf0d0('0x35')]=function(_0xd9e167,_0x2ff535,_0x10083c){io['to'](_0xd9e167)[_0xf0d0('0x35')](_0x2ff535,_0x10083c);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x34ae1b){try{if(this['isNotNull'](_0x34ae1b)){logger[_0xf0d0('0x36')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x34ae1b['uniqueid'],_0x34ae1b['calleridname'],_0x34ae1b[_0xf0d0('0x37')]);logger[_0xf0d0('0x38')](_0xf0d0('0x39'),_0x34ae1b['uniqueid'],util[_0xf0d0('0x31')](_0x34ae1b,{'showHidden':![],'depth':null}));if(_0x34ae1b['uniqueid']===_0x34ae1b['linkedid']){if(!_[_0xf0d0('0x34')](this[_0xf0d0('0x1a')][_0x34ae1b[_0xf0d0('0x3a')]])){_[_0xf0d0('0x3b')](this[_0xf0d0('0x1a')][_0x34ae1b[_0xf0d0('0x3a')]],_[_0xf0d0('0x3c')](_0x34ae1b,_['keys'](this['channels'][_0x34ae1b[_0xf0d0('0x3a')]])));}}}}catch(_0x55ff19){logger[_0xf0d0('0x2f')](_0xf0d0('0x3d'),_0x34ae1b[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x55ff19,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')][_0xf0d0('0x21')]=function(_0x25dbbb){try{if(this[_0xf0d0('0x33')](_0x25dbbb)){logger['debug'](_0xf0d0('0x3e'),_0x25dbbb['uniqueid'],util[_0xf0d0('0x31')](_0x25dbbb,{'showHidden':![],'depth':null}));if(_0x25dbbb[_0xf0d0('0x3a')]===_0x25dbbb[_0xf0d0('0x3f')]&&_0x25dbbb[_0xf0d0('0x40')]!=_0xf0d0('0x41')){if(_[_0xf0d0('0x34')](this[_0xf0d0('0x1a')][_0x25dbbb[_0xf0d0('0x3a')]])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x25dbbb[_0xf0d0('0x3a')],_0x25dbbb[_0xf0d0('0x42')],_0x25dbbb[_0xf0d0('0x43')]);this['channels'][_0x25dbbb[_0xf0d0('0x3a')]]=new Channel();this[_0xf0d0('0x1a')][_0x25dbbb[_0xf0d0('0x3a')]]['starttime']=moment()[_0xf0d0('0x44')](_0xf0d0('0x45'));this[_0xf0d0('0x1a')][_0x25dbbb[_0xf0d0('0x3a')]][_0xf0d0('0x46')]=dispositions[_['toNumber'](_0x25dbbb[_0xf0d0('0x47')])];_[_0xf0d0('0x3b')](this[_0xf0d0('0x1a')][_0x25dbbb[_0xf0d0('0x3a')]],_[_0xf0d0('0x3c')](_0x25dbbb,_[_0xf0d0('0x48')](this[_0xf0d0('0x1a')][_0x25dbbb[_0xf0d0('0x3a')]])));if(_0x25dbbb[_0xf0d0('0x42')]===_0xf0d0('0x49')){if(this['agents'][_0x25dbbb[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]]){this['agents'][_0x25dbbb[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]][_0xf0d0('0x4b')]=_0x25dbbb[_0xf0d0('0x43')];logger[_0xf0d0('0x38')](_0xf0d0('0x4c'),_0x25dbbb['uniqueid'],util[_0xf0d0('0x31')]({'destaccountcode':this[_0xf0d0('0x1b')][_0x25dbbb['channel'][_0xf0d0('0x4a')]('-')[0x0]][_0xf0d0('0x4d')],'destconnectedlinenum':_0x25dbbb['exten']},{'showHidden':![],'depth':null}));this[_0xf0d0('0x35')](util[_0xf0d0('0x44')](_0xf0d0('0x4e'),this[_0xf0d0('0x1b')][_0x25dbbb[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]][_0xf0d0('0x4f')]),'user:agentconnect',{'destaccountcode':this[_0xf0d0('0x1b')][_0x25dbbb['channel'][_0xf0d0('0x4a')]('-')[0x0]][_0xf0d0('0x4d')],'destconnectedlinenum':_0x25dbbb[_0xf0d0('0x43')]});}}}}}}catch(_0x17e679){logger[_0xf0d0('0x2f')](_0xf0d0('0x50'),_0x25dbbb[_0xf0d0('0x3a')],util['inspect'](_0x17e679,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf0d0('0x1d')]=function(_0x5d6346){try{if(this[_0xf0d0('0x33')](_0x5d6346)){logger[_0xf0d0('0x38')](_0xf0d0('0x51'),_0x5d6346['uniqueid'],util['inspect'](_0x5d6346,{'showHidden':![],'depth':null}));if(_0x5d6346[_0xf0d0('0x3a')]===_0x5d6346[_0xf0d0('0x3f')]&&_0x5d6346[_0xf0d0('0x43')]!='h'&&_0x5d6346['channel']!=_0xf0d0('0x41')){_0x5d6346['application']=_0x5d6346[_0xf0d0('0x52')][_0xf0d0('0x53')]();_0x5d6346['applicationdata']=(_0x5d6346[_0xf0d0('0x54')]||_0x5d6346['applicationdata'])[_0xf0d0('0x53')]();logger[_0xf0d0('0x36')](_0xf0d0('0x55'),_0x5d6346[_0xf0d0('0x3a')],_0x5d6346[_0xf0d0('0x52')],_0x5d6346['applicationdata']);if(_[_0xf0d0('0x34')](this[_0xf0d0('0x1a')][_0x5d6346[_0xf0d0('0x3a')]])){this[_0xf0d0('0x1a')][_0x5d6346[_0xf0d0('0x3a')]]=new Channel();this['channels'][_0x5d6346[_0xf0d0('0x3a')]][_0xf0d0('0x56')]=_0x5d6346[_0xf0d0('0x57')]?moment()[_0xf0d0('0x58')](moment[_0xf0d0('0x57')](_0x5d6346[_0xf0d0('0x57')])['seconds'](),_0xf0d0('0x59'))['format'](_0xf0d0('0x45')):moment()[_0xf0d0('0x44')](_0xf0d0('0x45'));this[_0xf0d0('0x1a')][_0x5d6346[_0xf0d0('0x3a')]][_0xf0d0('0x46')]=_0xf0d0('0x14');}_[_0xf0d0('0x3b')](this['channels'][_0x5d6346[_0xf0d0('0x3a')]],_[_0xf0d0('0x3c')](_0x5d6346,_[_0xf0d0('0x48')](this[_0xf0d0('0x1a')][_0x5d6346[_0xf0d0('0x3a')]])));if(_['includes'](applications,_0x5d6346[_0xf0d0('0x52')])){this[_0xf0d0('0x1a')][_0x5d6346[_0xf0d0('0x3a')]]['lastapplication']=_0x5d6346['application'];this['channels'][_0x5d6346['uniqueid']][_0xf0d0('0x5a')]=_0x5d6346['applicationdata'];if(_0x5d6346[_0xf0d0('0x52')]===_0xf0d0('0xe')&&_[_0xf0d0('0x5b')](_0x5d6346['applicationdata'],_0xf0d0('0x5c'))){var _0x891adb=_0x5d6346[_0xf0d0('0x5d')][_0xf0d0('0x4a')]('=');var _0x4ffc6d=_0x891adb[0x0][_0xf0d0('0x5e')](/cdr\((.*)\)/);if(_0x4ffc6d){this[_0xf0d0('0x1a')][_0x5d6346[_0xf0d0('0x3a')]][_0x4ffc6d[0x1]]=_0x891adb[0x1];}}else if(_0x5d6346[_0xf0d0('0x52')]===_0xf0d0('0xf')){this[_0xf0d0('0x1a')][_0x5d6346['uniqueid']][_0xf0d0('0xf')]=_0x5d6346[_0xf0d0('0x5d')][_0xf0d0('0x4a')](',')[0x0];}}}}}catch(_0x2eeebe){logger[_0xf0d0('0x2f')](_0xf0d0('0x5f'),_0x5d6346[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x2eeebe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')]['syncNewState']=function(_0x53543f){try{if(this[_0xf0d0('0x33')](_0x53543f)){logger[_0xf0d0('0x36')](_0xf0d0('0x60'),_0x53543f['uniqueid'],_0x53543f[_0xf0d0('0x3f')],_0x53543f[_0xf0d0('0x61')],_0x53543f['calleridnum']);logger[_0xf0d0('0x38')](_0xf0d0('0x62'),_0x53543f[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x53543f,{'showHidden':![],'depth':null}));if(_0x53543f[_0xf0d0('0x3a')]!==_0x53543f[_0xf0d0('0x3f')]){if(this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]]){if(_0x53543f['channelstate']==='6'){if(!this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]][_0xf0d0('0x63')]){var _0x43d8a6=moment();this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]][_0xf0d0('0x63')]=!![];this[_0xf0d0('0x1a')][_0x53543f['linkedid']][_0xf0d0('0x64')]=_0x43d8a6['format']('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x53543f[_0xf0d0('0x3f')]][_0xf0d0('0x56')]){this['channels'][_0x53543f[_0xf0d0('0x3f')]][_0xf0d0('0x65')]=_0x43d8a6[_0xf0d0('0x66')](this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]][_0xf0d0('0x56')],_0xf0d0('0x59'));}}this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]][_0xf0d0('0x3f')]=_0x53543f[_0xf0d0('0x3a')];if(_0x53543f[_0xf0d0('0x37')]!=='xcally-motion-preview'){this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]][_0xf0d0('0x67')]=_0x53543f[_0xf0d0('0x37')];}this['channels'][_0x53543f[_0xf0d0('0x3f')]][_0xf0d0('0x68')]=_0x53543f[_0xf0d0('0x61')];this[_0xf0d0('0x1a')][_0x53543f['linkedid']][_0xf0d0('0x69')]=_0x53543f[_0xf0d0('0x40')];this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]]['disposition']=dispositions[_[_0xf0d0('0x6a')](_0x53543f['channelstate'])];if(this['agents'][_0x53543f[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]]){this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]]['UserId']=this[_0xf0d0('0x1b')][_0x53543f[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]]['id'];this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3f')]]['membername']=this[_0xf0d0('0x1b')][_0x53543f[_0xf0d0('0x40')]['split']('-')[0x0]][_0xf0d0('0x4f')];}}}}else{if(this['channels'][_0x53543f['uniqueid']]){if(_0x53543f[_0xf0d0('0x47')]==='6'){if(this[_0xf0d0('0x1b')][_0x53543f[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]]){this[_0xf0d0('0x1a')][_0x53543f[_0xf0d0('0x3a')]][_0xf0d0('0x6b')]=this['agents'][_0x53543f['channel'][_0xf0d0('0x4a')]('-')[0x0]]['id'];this[_0xf0d0('0x1a')][_0x53543f['uniqueid']][_0xf0d0('0x6c')]=this['agents'][_0x53543f[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]]['name'];}}}}}}catch(_0x26ba2f){logger[_0xf0d0('0x2f')](_0xf0d0('0x6d'),_0x53543f[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x26ba2f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')]['syncMixMonitorFilename']=function(_0x33f559,_0x2579ba){try{if(this[_0xf0d0('0x1a')][_0x33f559]){logger[_0xf0d0('0x36')](_0xf0d0('0x6e'),_0x33f559,_0x2579ba);this[_0xf0d0('0x1a')][_0x33f559][_0xf0d0('0x6f')]=!![];if(_[_0xf0d0('0x70')](_0x2579ba,_0xf0d0('0x71'))){_0x2579ba=_0x2579ba[_0xf0d0('0x72')](_0xf0d0('0x71'),_0xf0d0('0x73'));}this[_0xf0d0('0x1a')][_0x33f559][_0xf0d0('0x74')]=_0x2579ba;var _0x3cbbb1=_[_0xf0d0('0x75')](this[_0xf0d0('0x1a')][_0x33f559][_0xf0d0('0x76')],{'filename':_0x2579ba});if(_[_0xf0d0('0x77')](_0x3cbbb1)){this[_0xf0d0('0x1a')][_0x33f559][_0xf0d0('0x76')][_0xf0d0('0x78')]({'filename':_0x2579ba,'createdAt':moment()[_0xf0d0('0x44')](_0xf0d0('0x45')),'mixmonitorid':'','status':'rec'});}}}catch(_0x49d743){logger['error'](_0xf0d0('0x79'),_0x33f559,util[_0xf0d0('0x31')](_0x49d743,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')][_0xf0d0('0x25')]=function(_0x69078a){try{if(this['isNotNull'](_0x69078a)){logger[_0xf0d0('0x38')](_0xf0d0('0x7a'),_0x69078a[_0xf0d0('0x3a')],util['inspect'](_0x69078a,{'showHidden':![],'depth':null}));if(this['channels'][_0x69078a[_0xf0d0('0x3a')]]&&_0x69078a[_0xf0d0('0x40')]!=_0xf0d0('0x41')){if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')])){if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')][_0xf0d0('0x7c')])){logger['info'](_0xf0d0('0x7d'),_0x69078a['uniqueid'],_0x69078a[_0xf0d0('0x7e')]);this[_0xf0d0('0x7f')](_0x69078a[_0xf0d0('0x3a')],_0x69078a[_0xf0d0('0x7e')]);}else if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')]['xmd-phone'])){logger['info'](_0xf0d0('0x80'),_0x69078a[_0xf0d0('0x3a')],_0x69078a[_0xf0d0('0x7e')]);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3a')]][_0xf0d0('0x37')]=_0x69078a[_0xf0d0('0x7e')];}else if(this['isNotNull'](_0x69078a['variable'][_0xf0d0('0x81')])){logger[_0xf0d0('0x36')](_0xf0d0('0x82'),_0x69078a[_0xf0d0('0x3a')],_0x69078a[_0xf0d0('0x7e')]);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3a')]][_0xf0d0('0x83')]=_0x69078a[_0xf0d0('0x7e')];}else if(this['isNotNull'](_0x69078a[_0xf0d0('0x7b')][_0xf0d0('0x84')])){logger[_0xf0d0('0x36')](_0xf0d0('0x85'),_0x69078a[_0xf0d0('0x3a')],_0x69078a['value']);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3a')]][_0xf0d0('0x86')]=_0x69078a[_0xf0d0('0x7e')];}else if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')]['xmd-queue'])){logger[_0xf0d0('0x36')](_0xf0d0('0x87'),_0x69078a[_0xf0d0('0x3a')],_0x69078a[_0xf0d0('0x7e')][_0xf0d0('0x4a')](',')[0x0]);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3a')]][_0xf0d0('0xf')]=_0x69078a[_0xf0d0('0x7e')][_0xf0d0('0x4a')](',')[0x0];}else if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')][_0xf0d0('0x88')])){logger[_0xf0d0('0x36')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x69078a['uniqueid'],_0x69078a['value']);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3a')]][_0xf0d0('0x89')]=_0x69078a[_0xf0d0('0x7e')];}else if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')][_0xf0d0('0x8a')])){logger[_0xf0d0('0x36')](_0xf0d0('0x8b'),_0x69078a[_0xf0d0('0x3a')],_0x69078a[_0xf0d0('0x7e')]);this[_0xf0d0('0x1a')][_0x69078a['uniqueid']][_0xf0d0('0x8c')]=_0x69078a[_0xf0d0('0x7e')];}else if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')][_0xf0d0('0x8d')])){logger[_0xf0d0('0x36')](_0xf0d0('0x8e'),_0x69078a[_0xf0d0('0x3a')],_0x69078a['value']);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3a')]][_0xf0d0('0x8f')]=_0x69078a[_0xf0d0('0x7e')];}else if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')][_0xf0d0('0x90')])){logger[_0xf0d0('0x36')](_0xf0d0('0x91'),_0x69078a[_0xf0d0('0x3a')],_0x69078a['value']);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3a')]]['queue']=_0x69078a[_0xf0d0('0x7e')];}else if(this[_0xf0d0('0x33')](_0x69078a['variable'][_0xf0d0('0x92')])){logger[_0xf0d0('0x36')](_0xf0d0('0x93'),_0x69078a['uniqueid'],_0x69078a[_0xf0d0('0x7e')]);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3a')]][_0xf0d0('0x94')]=_0x69078a[_0xf0d0('0x7e')];}}}else if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')]['mixmonitor_filename'])){if(_0x69078a[_0xf0d0('0x7e')]){var _0x2ade86=path[_0xf0d0('0x95')](_0x69078a[_0xf0d0('0x7e')])[_0xf0d0('0x4f')];logger[_0xf0d0('0x36')](_0xf0d0('0x7d'),_0x2ade86,_0x69078a['value']);this[_0xf0d0('0x7f')](_0x2ade86,_0x69078a[_0xf0d0('0x7e')]);}}else if(this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3f')]]){if(this[_0xf0d0('0x33')](_0x69078a[_0xf0d0('0x7b')])){if(this[_0xf0d0('0x33')](_0x69078a['variable'][_0xf0d0('0x92')])){logger[_0xf0d0('0x36')](_0xf0d0('0x93'),_0x69078a[_0xf0d0('0x3f')],_0x69078a[_0xf0d0('0x7e')]);this[_0xf0d0('0x1a')][_0x69078a[_0xf0d0('0x3f')]][_0xf0d0('0x96')]=_0x69078a['value'];}}}}}catch(_0x29d96f){logger['error'](_0xf0d0('0x97'),_0x69078a['uniqueid'],util[_0xf0d0('0x31')](_0x29d96f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')][_0xf0d0('0x26')]=function(_0x2553f6){try{if(this[_0xf0d0('0x33')](_0x2553f6)){logger[_0xf0d0('0x38')](_0xf0d0('0x98'),_0x2553f6[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x2553f6,{'showHidden':![],'depth':null}));if(this[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]]){logger['info'](_0xf0d0('0x99'),_0x2553f6[_0xf0d0('0x3a')],_0x2553f6['cause-txt']);var _0x35009c=moment();this[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x9a')]=_0x35009c[_0xf0d0('0x44')](_0xf0d0('0x45'));this[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x57')]=_0x35009c[_0xf0d0('0x66')](this['channels'][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x56')],_0xf0d0('0x59'));if(this[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x63')]){this[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x9b')]=_0x35009c[_0xf0d0('0x66')](this[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]]['answertime'],_0xf0d0('0x59'));this['channels'][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x65')]=this[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x57')]-this[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]]['billableseconds'];}if(_0x2553f6['context']===_0xf0d0('0x49')){if(this['agents'][_0x2553f6[_0xf0d0('0x40')]['split']('-')[0x0]]){this[_0xf0d0('0x1b')][_0x2553f6[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]]=_[_0xf0d0('0x9c')](this[_0xf0d0('0x1b')][_0x2553f6[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]],[_0xf0d0('0x4b')]);logger[_0xf0d0('0x38')](_0xf0d0('0x9d'),_0x2553f6[_0xf0d0('0x3a')],util[_0xf0d0('0x31')]({'destaccountcode':this['agents'][_0x2553f6[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]][_0xf0d0('0x4d')]},{'showHidden':![],'depth':null}));this[_0xf0d0('0x35')](util[_0xf0d0('0x44')](_0xf0d0('0x4e'),this[_0xf0d0('0x1b')][_0x2553f6['channel']['split']('-')[0x0]][_0xf0d0('0x4f')]),_0xf0d0('0x9e'),{'destaccountcode':this[_0xf0d0('0x1b')][_0x2553f6[_0xf0d0('0x40')][_0xf0d0('0x4a')]('-')[0x0]][_0xf0d0('0x4d')]});}}var _0x3cc2e2=this;Promise[_0xf0d0('0x9f')]()[_0xf0d0('0xa0')](function(){var _0x119a03=_0x3cc2e2[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]];if(typeof _0x119a03['transferType']===_0xf0d0('0xa1'))return;if(_[_0xf0d0('0xa2')](_0x119a03['monitors']))return;return RpcSetting[_0xf0d0('0xa3')]()[_0xf0d0('0xa0')](function(_0x46c66c){if(!_0x46c66c[_0xf0d0('0xa4')])return;return Promise[_0xf0d0('0x9f')]()[_0xf0d0('0xa0')](function(){return ami[_0xf0d0('0xa5')]({'action':'StopMixMonitor','channel':_0x119a03[_0xf0d0('0x40')]})[_0xf0d0('0xa6')](function(){});})[_0xf0d0('0xa0')](function(){return ami['Action']({'action':_0xf0d0('0xa7'),'channel':_0x119a03[_0xf0d0('0x69')]})['catch'](function(){})[_0xf0d0('0xa8')](function(){var _0x135f6d=_0x3cc2e2[_0xf0d0('0x1b')][_0x119a03[_0xf0d0('0x69')][_0xf0d0('0x4a')]('-')[0x0]];if(!_0x135f6d)return;io[_0xf0d0('0x35')](_0xf0d0('0xa9'),{'agentId':_0x135f6d['id'],'uniqueid':_0x119a03[_0xf0d0('0x3a')]});});});});})[_0xf0d0('0xa0')](function(){if(_0x2553f6[_0xf0d0('0xaa')]===_0xf0d0('0xab')){_0x3cc2e2[_0xf0d0('0xac')][_0x2553f6[_0xf0d0('0x3a')]]=_0x3cc2e2[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]];}else{if(_0x3cc2e2['channels'][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x86')]===_0xf0d0('0xad')&&_0x3cc2e2[_0xf0d0('0xac')][_0x2553f6[_0xf0d0('0x3a')]]){_0x3cc2e2[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]][_0xf0d0('0x3a')]=[_0x3cc2e2[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]]['linkedid'],_0x3cc2e2[_0xf0d0('0x1a')][_0x2553f6['uniqueid']][_0xf0d0('0x3f')]=_0x3cc2e2['channels'][_0x2553f6['uniqueid']][_0xf0d0('0x3a')]][0x0];delete _0x3cc2e2['blindTransfers'][_0x2553f6[_0xf0d0('0x3a')]];}}logger['debug'](_0xf0d0('0xae'),_0x2553f6[_0xf0d0('0x3a')],util['inspect'](_0x3cc2e2[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]],{'showHidden':![],'depth':null}));ami[_0xf0d0('0x35')](_0xf0d0('0xaf'),_0x3cc2e2[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]]);delete _0x3cc2e2[_0xf0d0('0x1a')][_0x2553f6[_0xf0d0('0x3a')]];});}}}catch(_0x3011e5){logger[_0xf0d0('0x2f')](_0xf0d0('0xb0'),_0x2553f6[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x3011e5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')]['syncAttendedTransfer']=function(_0xe4ba99){try{if(this['isNotNull'](_0xe4ba99)){logger[_0xf0d0('0x36')](_0xf0d0('0xb1'),_0xe4ba99[_0xf0d0('0x3a')],_0xe4ba99[_0xf0d0('0xb2')],_0xe4ba99[_0xf0d0('0xb3')]);logger['debug']('[%s][voiceCallReport][attendedtransfer]\x20event:',_0xe4ba99['uniqueid'],util['inspect'](_0xe4ba99,{'showHidden':![],'depth':null}));if(this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb4')]]){this[_0xf0d0('0x1a')][_0xe4ba99['transfereeuniqueid']]['transfercalleridnum']=_0xe4ba99[_0xf0d0('0xb2')];this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb4')]][_0xf0d0('0xb5')]=_0xe4ba99[_0xf0d0('0xb3')];if(this['channels'][_0xe4ba99['secondtransfereruniqueid']]){var _0x3d6a1d=this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb6')]];this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb6')]]=this['channels'][_0xe4ba99['transfereeuniqueid']];this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb4')]]=_0x3d6a1d;}}else if(this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb7')]]){this[_0xf0d0('0x1a')][_0xe4ba99['transfertargetuniqueid']][_0xf0d0('0xb8')]=_0xe4ba99['origtransferercalleridnum'];this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb7')]]['transferconnectedlinenum']=_0xe4ba99[_0xf0d0('0xb3')];if(this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb9')]]){var _0x3d6a1d=this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb9')]];this['channels'][_0xe4ba99[_0xf0d0('0xb9')]]=this['channels'][_0xe4ba99['transfertargetuniqueid']];this['channels'][_0xe4ba99['transfertargetuniqueid']]=_0x3d6a1d;}}if((this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb9')]]||this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xba')]])&&this['channels'][_0xe4ba99[_0xf0d0('0xb6')]]){var _0x1c00eb=_[_0xf0d0('0xbb')]([this[_0xf0d0('0x1a')][_0xe4ba99['origtransfereruniqueid']],this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xba')]],this['channels'][_0xe4ba99[_0xf0d0('0xb6')]]],function(_0x447060){return _0x447060&&_0x447060['type']===_0xf0d0('0xad')&&_0x447060[_0xf0d0('0xbc')];});if(_0x1c00eb){if(this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb9')]])this['channels'][_0xe4ba99['origtransfereruniqueid']][_0xf0d0('0xbd')]='ATTENDED';if(this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xba')]])this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xba')]][_0xf0d0('0xbd')]=_0xf0d0('0xbe');this[_0xf0d0('0x1a')][_0xe4ba99[_0xf0d0('0xb6')]][_0xf0d0('0xbd')]=_0xf0d0('0xbe');}}}}catch(_0x433398){logger['error'](_0xf0d0('0xbf'),_0xe4ba99[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x433398,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')][_0xf0d0('0x2b')]=function(_0x25a99c){try{if(this[_0xf0d0('0x33')](_0x25a99c)){logger[_0xf0d0('0x36')](_0xf0d0('0xc0'),_0x25a99c[_0xf0d0('0x3a')],_0x25a99c['transfereecalleridnum'],_0x25a99c[_0xf0d0('0xc1')]);logger[_0xf0d0('0x38')](_0xf0d0('0xc2'),_0x25a99c[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x25a99c,{'showHidden':![],'depth':null}));if(this[_0xf0d0('0x1a')][_0x25a99c[_0xf0d0('0xb4')]]){this[_0xf0d0('0x1a')][_0x25a99c['transfereeuniqueid']][_0xf0d0('0xb8')]=_0x25a99c['transfereecalleridnum'];this[_0xf0d0('0x1a')][_0x25a99c[_0xf0d0('0xb4')]][_0xf0d0('0xb5')]=_0x25a99c[_0xf0d0('0xc1')];this[_0xf0d0('0x1a')][_0x25a99c[_0xf0d0('0xb4')]][_0xf0d0('0xbd')]=_0xf0d0('0xc3');this[_0xf0d0('0x26')]({'event':_0xf0d0('0xab'),'uniqueid':_0x25a99c[_0xf0d0('0xb4')],'context':_0x25a99c[_0xf0d0('0x42')],'channel':_0x25a99c[_0xf0d0('0xc4')]});}else{this[_0xf0d0('0x1a')][_0x25a99c[_0xf0d0('0xc5')]]['transferType']=_0xf0d0('0xc3');}}}catch(_0x1702e7){logger[_0xf0d0('0x2f')]('[%s][voiceCallReport][blindtransfer]',_0x25a99c[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x1702e7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')][_0xf0d0('0x2d')]=function(_0x8a4bd7){try{if(this[_0xf0d0('0x33')](_0x8a4bd7)){logger[_0xf0d0('0x38')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x8a4bd7[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x8a4bd7,{'showHidden':![],'depth':null}));if(this['channels'][_0x8a4bd7['uniqueid']]){if(!_[_0xf0d0('0x77')](this[_0xf0d0('0x1a')][_0x8a4bd7[_0xf0d0('0x3a')]][_0xf0d0('0x64')])){this['channels'][_0x8a4bd7[_0xf0d0('0x3a')]]['mohstarttime']=moment()[_0xf0d0('0x44')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xf0d0('0x36')](_0xf0d0('0xc6'),_0x8a4bd7[_0xf0d0('0x3a')],this['channels'][_0x8a4bd7['uniqueid']][_0xf0d0('0xc7')]);}}}}catch(_0x3380b8){logger[_0xf0d0('0x2f')](_0xf0d0('0xc8'),_0x8a4bd7[_0xf0d0('0x3a')],util['inspect'](_0x3380b8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf0d0('0x32')][_0xf0d0('0xc9')]=function(_0x2e7bab){try{if(this['isNotNull'](_0x2e7bab)){logger[_0xf0d0('0x38')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x2e7bab['uniqueid'],util[_0xf0d0('0x31')](_0x2e7bab,{'showHidden':![],'depth':null}));if(this['channels'][_0x2e7bab[_0xf0d0('0x3a')]]){if(!_[_0xf0d0('0x77')](this[_0xf0d0('0x1a')][_0x2e7bab['uniqueid']][_0xf0d0('0xc7')])){this['channels'][_0x2e7bab[_0xf0d0('0x3a')]][_0xf0d0('0xca')]+=moment()[_0xf0d0('0xcb')](0x0)['diff'](this[_0xf0d0('0x1a')][_0x2e7bab[_0xf0d0('0x3a')]][_0xf0d0('0xc7')],_0xf0d0('0x59'));logger[_0xf0d0('0x36')](_0xf0d0('0xcc'),_0x2e7bab[_0xf0d0('0x3a')],this[_0xf0d0('0x1a')][_0x2e7bab[_0xf0d0('0x3a')]][_0xf0d0('0xca')]);delete this[_0xf0d0('0x1a')][_0x2e7bab[_0xf0d0('0x3a')]][_0xf0d0('0xc7')];}}}}catch(_0x211d92){logger[_0xf0d0('0x2f')](_0xf0d0('0xcd'),_0x2e7bab[_0xf0d0('0x3a')],util[_0xf0d0('0x31')](_0x211d92,{'showHidden':![],'depth':null}));}};module[_0xf0d0('0xce')]=VoiceCallReport; \ No newline at end of file +var _0x1802=['syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','merge','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','linkedid','channel','OutgoingSpoolFailed','info','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','application','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','answered','answertime','starttime','holdtime','connectedlinenum','connectedlinename','destinationchannel','membername','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','xmd-phone','value','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','endtime','diff','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','transferType','undefined','isEmpty','getSettings','then','StopMixMonitor','catch','Action','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','origtransfereruniqueid','transfertargetuniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','agi','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','bind','syncNewState','varset','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0x1802,0x9b));var _0x2180=function(_0x12d53f,_0x1d441a){_0x12d53f=_0x12d53f-0x0;var _0x5acd10=_0x1802[_0x12d53f];return _0x5acd10;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0x2180('0x0'));var util=require(_0x2180('0x1'));var path=require(_0x2180('0x2'));var Redis=require(_0x2180('0x3'));var config=require(_0x2180('0x4'));var logger=require(_0x2180('0x5'))(_0x2180('0x6'));var ami=require(_0x2180('0x7'));var Channel=require(_0x2180('0x8'));var RpcSetting=require(_0x2180('0x9'));var statusDesc=[_0x2180('0xa'),'not_inuse',_0x2180('0xb'),_0x2180('0xc'),_0x2180('0xd'),_0x2180('0xe'),_0x2180('0xf'),_0x2180('0x10'),_0x2180('0x11')];var applications=[_0x2180('0x12'),'queue',_0x2180('0x13'),'dial',_0x2180('0x14'),'voicemail'];var dispositions=[_0x2180('0x15'),'FAILED',_0x2180('0x16'),_0x2180('0x15'),_0x2180('0x15'),'NO\x20ANSWER',_0x2180('0x17'),_0x2180('0x18'),'FAILED',_0x2180('0x16'),_0x2180('0x16')];var actions={};config[_0x2180('0x19')]=_[_0x2180('0x1a')](config[_0x2180('0x19')],{'host':_0x2180('0x1b'),'port':0x18eb});var io=require(_0x2180('0x1c'))(new Redis(config[_0x2180('0x19')]));function VoiceCallReport(_0x52df41){this[_0x2180('0x1d')]=_0x52df41['channels'];this[_0x2180('0x1e')]=_0x52df41[_0x2180('0x1e')];this[_0x2180('0x1f')]={};ami['on'](_0x2180('0x20'),this[_0x2180('0x21')]['bind'](this));ami['on'](_0x2180('0x22'),this[_0x2180('0x21')]['bind'](this));ami['on'](_0x2180('0x23'),this[_0x2180('0x24')][_0x2180('0x25')](this));ami['on']('newstate',this[_0x2180('0x26')]['bind'](this));ami['on'](_0x2180('0x27'),this['syncVarSet']['bind'](this));ami['on'](_0x2180('0x28'),this[_0x2180('0x29')][_0x2180('0x25')](this));ami['on']('newcallerid',this[_0x2180('0x2a')][_0x2180('0x25')](this));ami['on'](_0x2180('0x2b'),this[_0x2180('0x2c')]['bind'](this));ami['on']('blindtransfer',this[_0x2180('0x2d')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x2180('0x25')](this));ami['on'](_0x2180('0x2e'),this[_0x2180('0x2f')][_0x2180('0x25')](this));try{logger['info'](_0x2180('0x30'));ami[_0x2180('0x31')]();}catch(_0x2adb7f){logger[_0x2180('0x32')](_0x2180('0x33'),util[_0x2180('0x34')](_0x2adb7f,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2180('0x35')]['isNotNull']=function(_0x4661f3){return _0x4661f3!==null&&!_[_0x2180('0x36')](_0x4661f3);};VoiceCallReport['prototype'][_0x2180('0x37')]=function(_0x332aa0,_0x148594,_0x142b48){io['to'](_0x332aa0)['emit'](_0x148594,_0x142b48);};VoiceCallReport[_0x2180('0x35')][_0x2180('0x2a')]=function(_0x2fa0ec){try{if(this[_0x2180('0x38')](_0x2fa0ec)){logger['info'](_0x2180('0x39'),_0x2fa0ec[_0x2180('0x3a')],_0x2fa0ec['calleridname'],_0x2fa0ec[_0x2180('0x3b')]);logger[_0x2180('0x3c')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x2fa0ec[_0x2180('0x3a')],util[_0x2180('0x34')](_0x2fa0ec,{'showHidden':![],'depth':null}));if(_0x2fa0ec['uniqueid']===_0x2fa0ec['linkedid']){if(!_[_0x2180('0x36')](this[_0x2180('0x1d')][_0x2fa0ec['uniqueid']])){_[_0x2180('0x3d')](this[_0x2180('0x1d')][_0x2fa0ec['uniqueid']],_['pick'](_0x2fa0ec,_[_0x2180('0x3e')](this[_0x2180('0x1d')][_0x2fa0ec[_0x2180('0x3a')]])));}}}}catch(_0x2b6106){logger[_0x2180('0x32')](_0x2180('0x3f'),_0x2fa0ec[_0x2180('0x3a')],util[_0x2180('0x34')](_0x2b6106,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')][_0x2180('0x24')]=function(_0x23ff2d){try{if(this['isNotNull'](_0x23ff2d)){logger[_0x2180('0x3c')](_0x2180('0x40'),_0x23ff2d[_0x2180('0x3a')],util[_0x2180('0x34')](_0x23ff2d,{'showHidden':![],'depth':null}));if(_0x23ff2d[_0x2180('0x3a')]===_0x23ff2d[_0x2180('0x41')]&&_0x23ff2d[_0x2180('0x42')]!=_0x2180('0x43')){if(_['isUndefined'](this[_0x2180('0x1d')][_0x23ff2d[_0x2180('0x3a')]])){logger[_0x2180('0x44')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x23ff2d[_0x2180('0x3a')],_0x23ff2d[_0x2180('0x45')],_0x23ff2d[_0x2180('0x46')]);this[_0x2180('0x1d')][_0x23ff2d[_0x2180('0x3a')]]=new Channel();this[_0x2180('0x1d')][_0x23ff2d[_0x2180('0x3a')]]['starttime']=moment()[_0x2180('0x47')](_0x2180('0x48'));this['channels'][_0x23ff2d[_0x2180('0x3a')]][_0x2180('0x49')]=dispositions[_[_0x2180('0x4a')](_0x23ff2d[_0x2180('0x4b')])];_[_0x2180('0x3d')](this[_0x2180('0x1d')][_0x23ff2d[_0x2180('0x3a')]],_[_0x2180('0x4c')](_0x23ff2d,_['keys'](this[_0x2180('0x1d')][_0x23ff2d[_0x2180('0x3a')]])));if(_0x23ff2d['context']===_0x2180('0x4d')){if(this[_0x2180('0x1e')][_0x23ff2d[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]]){this[_0x2180('0x1e')][_0x23ff2d['channel'][_0x2180('0x4e')]('-')[0x0]][_0x2180('0x4f')]=_0x23ff2d['exten'];logger[_0x2180('0x3c')](_0x2180('0x50'),_0x23ff2d['uniqueid'],util[_0x2180('0x34')]({'destaccountcode':this[_0x2180('0x1e')][_0x23ff2d[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]][_0x2180('0x51')],'destconnectedlinenum':_0x23ff2d[_0x2180('0x46')]},{'showHidden':![],'depth':null}));this[_0x2180('0x37')](util[_0x2180('0x47')](_0x2180('0x52'),this['agents'][_0x23ff2d[_0x2180('0x42')]['split']('-')[0x0]][_0x2180('0x53')]),_0x2180('0x54'),{'destaccountcode':this[_0x2180('0x1e')][_0x23ff2d[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x23ff2d[_0x2180('0x46')]});}}}}}}catch(_0x2ab091){logger[_0x2180('0x32')](_0x2180('0x55'),_0x23ff2d[_0x2180('0x3a')],util[_0x2180('0x34')](_0x2ab091,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')]['syncNewExten']=function(_0x55c0a0){try{if(this[_0x2180('0x38')](_0x55c0a0)){logger[_0x2180('0x3c')]('[%s][voiceCallReport][newexten]\x20event:',_0x55c0a0['uniqueid'],util[_0x2180('0x34')](_0x55c0a0,{'showHidden':![],'depth':null}));if(_0x55c0a0[_0x2180('0x3a')]===_0x55c0a0[_0x2180('0x41')]&&_0x55c0a0[_0x2180('0x46')]!='h'&&_0x55c0a0['channel']!=_0x2180('0x43')){_0x55c0a0['application']=_0x55c0a0[_0x2180('0x56')]['toLowerCase']();_0x55c0a0[_0x2180('0x57')]=(_0x55c0a0['appdata']||_0x55c0a0['applicationdata'])['toLowerCase']();logger[_0x2180('0x44')](_0x2180('0x58'),_0x55c0a0[_0x2180('0x3a')],_0x55c0a0[_0x2180('0x56')],_0x55c0a0['applicationdata']);if(_[_0x2180('0x36')](this['channels'][_0x55c0a0[_0x2180('0x3a')]])){this[_0x2180('0x1d')][_0x55c0a0[_0x2180('0x3a')]]=new Channel();this[_0x2180('0x1d')][_0x55c0a0[_0x2180('0x3a')]]['starttime']=_0x55c0a0[_0x2180('0x59')]?moment()['subtract'](moment[_0x2180('0x59')](_0x55c0a0['duration'])['seconds'](),_0x2180('0x5a'))[_0x2180('0x47')](_0x2180('0x48')):moment()[_0x2180('0x47')](_0x2180('0x48'));this[_0x2180('0x1d')][_0x55c0a0[_0x2180('0x3a')]]['disposition']=_0x2180('0x15');}_[_0x2180('0x3d')](this[_0x2180('0x1d')][_0x55c0a0['uniqueid']],_[_0x2180('0x4c')](_0x55c0a0,_[_0x2180('0x3e')](this[_0x2180('0x1d')][_0x55c0a0[_0x2180('0x3a')]])));if(_[_0x2180('0x5b')](applications,_0x55c0a0[_0x2180('0x56')])){this[_0x2180('0x1d')][_0x55c0a0[_0x2180('0x3a')]][_0x2180('0x5c')]=_0x55c0a0[_0x2180('0x56')];this[_0x2180('0x1d')][_0x55c0a0[_0x2180('0x3a')]][_0x2180('0x5d')]=_0x55c0a0[_0x2180('0x57')];if(_0x55c0a0['application']==='set'&&_['startsWith'](_0x55c0a0[_0x2180('0x57')],'cdr(')){var _0x378663=_0x55c0a0[_0x2180('0x57')]['split']('=');var _0x317565=_0x378663[0x0]['match'](/cdr\((.*)\)/);if(_0x317565){this['channels'][_0x55c0a0[_0x2180('0x3a')]][_0x317565[0x1]]=_0x378663[0x1];}}else if(_0x55c0a0[_0x2180('0x56')]===_0x2180('0x5e')){this[_0x2180('0x1d')][_0x55c0a0[_0x2180('0x3a')]]['queue']=_0x55c0a0[_0x2180('0x57')]['split'](',')[0x0];}}}}}catch(_0x10097d){logger['error'](_0x2180('0x5f'),_0x55c0a0['uniqueid'],util[_0x2180('0x34')](_0x10097d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')][_0x2180('0x26')]=function(_0x5cc30b){try{if(this[_0x2180('0x38')](_0x5cc30b)){logger[_0x2180('0x44')](_0x2180('0x60'),_0x5cc30b['uniqueid'],_0x5cc30b[_0x2180('0x41')],_0x5cc30b[_0x2180('0x61')],_0x5cc30b[_0x2180('0x3b')]);logger[_0x2180('0x3c')]('[%s][voiceCallReport][newstate]\x20event:',_0x5cc30b[_0x2180('0x3a')],util[_0x2180('0x34')](_0x5cc30b,{'showHidden':![],'depth':null}));if(_0x5cc30b['uniqueid']!==_0x5cc30b['linkedid']){if(this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x41')]]){if(_0x5cc30b['channelstate']==='6'){if(!this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x62')]){var _0x3e193c=moment();this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x62')]=!![];this['channels'][_0x5cc30b['linkedid']][_0x2180('0x63')]=_0x3e193c[_0x2180('0x47')](_0x2180('0x48'));if(this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x64')]){this['channels'][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x65')]=_0x3e193c['diff'](this['channels'][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x64')],'seconds');}}this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x41')]]['linkedid']=_0x5cc30b[_0x2180('0x3a')];if(_0x5cc30b[_0x2180('0x3b')]!=='xcally-motion-preview'){this['channels'][_0x5cc30b['linkedid']][_0x2180('0x66')]=_0x5cc30b[_0x2180('0x3b')];}this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x67')]=_0x5cc30b[_0x2180('0x61')];this['channels'][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x68')]=_0x5cc30b[_0x2180('0x42')];this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x49')]=dispositions[_[_0x2180('0x4a')](_0x5cc30b[_0x2180('0x4b')])];if(this[_0x2180('0x1e')][_0x5cc30b[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]]){this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x41')]]['UserId']=this[_0x2180('0x1e')][_0x5cc30b[_0x2180('0x42')]['split']('-')[0x0]]['id'];this['channels'][_0x5cc30b[_0x2180('0x41')]][_0x2180('0x69')]=this[_0x2180('0x1e')][_0x5cc30b[_0x2180('0x42')]['split']('-')[0x0]][_0x2180('0x53')];}}}}else{if(this[_0x2180('0x1d')][_0x5cc30b['uniqueid']]){if(_0x5cc30b[_0x2180('0x4b')]==='6'){if(this[_0x2180('0x1e')][_0x5cc30b[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]]){this['channels'][_0x5cc30b[_0x2180('0x3a')]][_0x2180('0x6a')]=this[_0x2180('0x1e')][_0x5cc30b[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]]['id'];this[_0x2180('0x1d')][_0x5cc30b[_0x2180('0x3a')]]['membername']=this[_0x2180('0x1e')][_0x5cc30b[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]][_0x2180('0x53')];}}}}}}catch(_0x44bf33){logger['error'](_0x2180('0x6b'),_0x5cc30b['uniqueid'],util[_0x2180('0x34')](_0x44bf33,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')][_0x2180('0x6c')]=function(_0x4ea7f8,_0x9fbf16){try{if(this[_0x2180('0x1d')][_0x4ea7f8]){logger['info'](_0x2180('0x6d'),_0x4ea7f8,_0x9fbf16);this[_0x2180('0x1d')][_0x4ea7f8][_0x2180('0x6e')]=!![];if(_[_0x2180('0x6f')](_0x9fbf16,_0x2180('0x70'))){_0x9fbf16=_0x9fbf16['replace'](_0x2180('0x70'),_0x2180('0x71'));}this['channels'][_0x4ea7f8][_0x2180('0x72')]=_0x9fbf16;var _0x392860=_['find'](this['channels'][_0x4ea7f8]['monitors'],{'filename':_0x9fbf16});if(_['isNil'](_0x392860)){this['channels'][_0x4ea7f8][_0x2180('0x73')][_0x2180('0x74')]({'filename':_0x9fbf16,'createdAt':moment()[_0x2180('0x47')](_0x2180('0x48')),'mixmonitorid':'','status':_0x2180('0x75')});}}}catch(_0x598d59){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x4ea7f8,util[_0x2180('0x34')](_0x598d59,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')]['syncVarSet']=function(_0x2a5fd0){try{if(this['isNotNull'](_0x2a5fd0)){logger[_0x2180('0x3c')](_0x2180('0x76'),_0x2a5fd0['uniqueid'],util[_0x2180('0x34')](_0x2a5fd0,{'showHidden':![],'depth':null}));if(this['channels'][_0x2a5fd0[_0x2180('0x3a')]]&&_0x2a5fd0[_0x2180('0x42')]!='OutgoingSpoolFailed'){if(this[_0x2180('0x38')](_0x2a5fd0['variable'])){if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x78')])){logger[_0x2180('0x44')](_0x2180('0x79'),_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0['value']);this[_0x2180('0x6c')](_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0['value']);}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x7a')])){logger[_0x2180('0x44')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0[_0x2180('0x7b')]);this[_0x2180('0x1d')][_0x2a5fd0[_0x2180('0x3a')]][_0x2180('0x3b')]=_0x2a5fd0[_0x2180('0x7b')];}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')]['xmd-callerid'])){logger[_0x2180('0x44')](_0x2180('0x7c'),_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0[_0x2180('0x7b')]);this[_0x2180('0x1d')][_0x2a5fd0[_0x2180('0x3a')]][_0x2180('0x7d')]=_0x2a5fd0[_0x2180('0x7b')];}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x7e')])){logger['info'](_0x2180('0x7f'),_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0[_0x2180('0x7b')]);this[_0x2180('0x1d')][_0x2a5fd0[_0x2180('0x3a')]][_0x2180('0x80')]=_0x2a5fd0['value'];}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x81')])){logger[_0x2180('0x44')](_0x2180('0x82'),_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0['value'][_0x2180('0x4e')](',')[0x0]);this[_0x2180('0x1d')][_0x2a5fd0['uniqueid']][_0x2180('0x5e')]=_0x2a5fd0[_0x2180('0x7b')][_0x2180('0x4e')](',')[0x0];}else if(this['isNotNull'](_0x2a5fd0['variable'][_0x2180('0x83')])){logger['info'](_0x2180('0x84'),_0x2a5fd0['uniqueid'],_0x2a5fd0[_0x2180('0x7b')]);this[_0x2180('0x1d')][_0x2a5fd0['uniqueid']][_0x2180('0x85')]=_0x2a5fd0[_0x2180('0x7b')];}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x86')])){logger[_0x2180('0x44')](_0x2180('0x87'),_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0[_0x2180('0x7b')]);this[_0x2180('0x1d')][_0x2a5fd0[_0x2180('0x3a')]][_0x2180('0x88')]=_0x2a5fd0[_0x2180('0x7b')];}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x89')])){logger[_0x2180('0x44')](_0x2180('0x8a'),_0x2a5fd0['uniqueid'],_0x2a5fd0['value']);this[_0x2180('0x1d')][_0x2a5fd0[_0x2180('0x3a')]][_0x2180('0x8b')]=_0x2a5fd0[_0x2180('0x7b')];}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x8c')])){logger[_0x2180('0x44')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0[_0x2180('0x7b')]);this[_0x2180('0x1d')][_0x2a5fd0[_0x2180('0x3a')]][_0x2180('0x5e')]=_0x2a5fd0[_0x2180('0x7b')];}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x8d')])){logger[_0x2180('0x44')](_0x2180('0x8e'),_0x2a5fd0[_0x2180('0x3a')],_0x2a5fd0[_0x2180('0x7b')]);this['channels'][_0x2a5fd0[_0x2180('0x3a')]][_0x2180('0x8f')]=_0x2a5fd0[_0x2180('0x7b')];}}}else if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')]['mixmonitor_filename'])){if(_0x2a5fd0[_0x2180('0x7b')]){var _0x853a11=path[_0x2180('0x90')](_0x2a5fd0[_0x2180('0x7b')])[_0x2180('0x53')];logger[_0x2180('0x44')](_0x2180('0x79'),_0x853a11,_0x2a5fd0[_0x2180('0x7b')]);this[_0x2180('0x6c')](_0x853a11,_0x2a5fd0[_0x2180('0x7b')]);}}else if(this[_0x2180('0x1d')][_0x2a5fd0[_0x2180('0x41')]]){if(this[_0x2180('0x38')](_0x2a5fd0[_0x2180('0x77')])){if(this['isNotNull'](_0x2a5fd0[_0x2180('0x77')][_0x2180('0x8d')])){logger[_0x2180('0x44')](_0x2180('0x8e'),_0x2a5fd0[_0x2180('0x41')],_0x2a5fd0[_0x2180('0x7b')]);this[_0x2180('0x1d')][_0x2a5fd0['linkedid']][_0x2180('0x91')]=_0x2a5fd0[_0x2180('0x7b')];}}}}}catch(_0x355923){logger[_0x2180('0x32')](_0x2180('0x92'),_0x2a5fd0['uniqueid'],util[_0x2180('0x34')](_0x355923,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')]['syncHangup']=function(_0xa94e12){try{if(this[_0x2180('0x38')](_0xa94e12)){logger[_0x2180('0x3c')](_0x2180('0x93'),_0xa94e12[_0x2180('0x3a')],util[_0x2180('0x34')](_0xa94e12,{'showHidden':![],'depth':null}));if(this[_0x2180('0x1d')][_0xa94e12[_0x2180('0x3a')]]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0xa94e12[_0x2180('0x3a')],_0xa94e12['cause-txt']);var _0x48eff2=moment();this['channels'][_0xa94e12['uniqueid']][_0x2180('0x94')]=_0x48eff2['format'](_0x2180('0x48'));this['channels'][_0xa94e12['uniqueid']][_0x2180('0x59')]=_0x48eff2[_0x2180('0x95')](this[_0x2180('0x1d')][_0xa94e12['uniqueid']][_0x2180('0x64')],'seconds');if(this[_0x2180('0x1d')][_0xa94e12[_0x2180('0x3a')]][_0x2180('0x62')]){this[_0x2180('0x1d')][_0xa94e12[_0x2180('0x3a')]]['billableseconds']=_0x48eff2[_0x2180('0x95')](this[_0x2180('0x1d')][_0xa94e12[_0x2180('0x3a')]][_0x2180('0x63')],'seconds');this[_0x2180('0x1d')][_0xa94e12['uniqueid']]['holdtime']=this[_0x2180('0x1d')][_0xa94e12['uniqueid']]['duration']-this[_0x2180('0x1d')][_0xa94e12['uniqueid']][_0x2180('0x96')];}if(_0xa94e12[_0x2180('0x45')]===_0x2180('0x4d')){if(this[_0x2180('0x1e')][_0xa94e12[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]]){this[_0x2180('0x1e')][_0xa94e12['channel'][_0x2180('0x4e')]('-')[0x0]]=_['omit'](this[_0x2180('0x1e')][_0xa94e12[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]],['destconnectedlinenum']);logger[_0x2180('0x3c')](_0x2180('0x97'),_0xa94e12[_0x2180('0x3a')],util[_0x2180('0x34')]({'destaccountcode':this[_0x2180('0x1e')][_0xa94e12[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]][_0x2180('0x51')]},{'showHidden':![],'depth':null}));this[_0x2180('0x37')](util[_0x2180('0x47')](_0x2180('0x52'),this[_0x2180('0x1e')][_0xa94e12[_0x2180('0x42')][_0x2180('0x4e')]('-')[0x0]]['name']),_0x2180('0x98'),{'destaccountcode':this['agents'][_0xa94e12[_0x2180('0x42')]['split']('-')[0x0]][_0x2180('0x51')]});}}var _0x4f3991=this;Promise[_0x2180('0x99')]()['then'](function(){var _0x33ce37=_0x4f3991[_0x2180('0x1d')][_0xa94e12[_0x2180('0x3a')]];if(typeof _0x33ce37[_0x2180('0x9a')]===_0x2180('0x9b'))return;if(_[_0x2180('0x9c')](_0x33ce37[_0x2180('0x73')]))return;return RpcSetting[_0x2180('0x9d')]()[_0x2180('0x9e')](function(_0x3a183d){if(!_0x3a183d['stopRecordingOnTransfer'])return;return Promise[_0x2180('0x99')]()[_0x2180('0x9e')](function(){return ami['Action']({'action':_0x2180('0x9f'),'channel':_0x33ce37['channel']})[_0x2180('0xa0')](function(){});})[_0x2180('0x9e')](function(){return ami[_0x2180('0xa1')]({'action':_0x2180('0x9f'),'channel':_0x33ce37[_0x2180('0x68')]})[_0x2180('0xa0')](function(){})[_0x2180('0xa2')](function(){var _0x3a76dd=_0x4f3991[_0x2180('0x1e')][_0x33ce37[_0x2180('0x68')][_0x2180('0x4e')]('-')[0x0]];if(!_0x3a76dd)return;io[_0x2180('0x37')](_0x2180('0xa3'),{'agentId':_0x3a76dd['id'],'uniqueid':_0x33ce37[_0x2180('0x3a')]});});});});})['then'](function(){if(_0xa94e12[_0x2180('0xa4')]===_0x2180('0xa5')){_0x4f3991[_0x2180('0x1f')][_0xa94e12[_0x2180('0x3a')]]=_0x4f3991[_0x2180('0x1d')][_0xa94e12['uniqueid']];}else{if(_0x4f3991['channels'][_0xa94e12[_0x2180('0x3a')]][_0x2180('0x80')]===_0x2180('0xa6')&&_0x4f3991[_0x2180('0x1f')][_0xa94e12[_0x2180('0x3a')]]){_0x4f3991['channels'][_0xa94e12[_0x2180('0x3a')]][_0x2180('0x3a')]=[_0x4f3991[_0x2180('0x1d')][_0xa94e12[_0x2180('0x3a')]][_0x2180('0x41')],_0x4f3991[_0x2180('0x1d')][_0xa94e12[_0x2180('0x3a')]][_0x2180('0x41')]=_0x4f3991[_0x2180('0x1d')][_0xa94e12[_0x2180('0x3a')]][_0x2180('0x3a')]][0x0];delete _0x4f3991[_0x2180('0x1f')][_0xa94e12[_0x2180('0x3a')]];}}logger[_0x2180('0x3c')](_0x2180('0xa7'),_0xa94e12[_0x2180('0x3a')],util[_0x2180('0x34')](_0x4f3991[_0x2180('0x1d')][_0xa94e12['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x2180('0x37')](_0x2180('0xa8'),_0x4f3991['channels'][_0xa94e12['uniqueid']]);delete _0x4f3991['channels'][_0xa94e12['uniqueid']];});}}}catch(_0xd06d8c){logger[_0x2180('0x32')]('[%s][voiceCallReport][hangup]',_0xa94e12[_0x2180('0x3a')],util['inspect'](_0xd06d8c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')][_0x2180('0x2c')]=function(_0x541d04){try{if(this[_0x2180('0x38')](_0x541d04)){logger[_0x2180('0x44')](_0x2180('0xa9'),_0x541d04['uniqueid'],_0x541d04[_0x2180('0xaa')],_0x541d04[_0x2180('0xab')]);logger[_0x2180('0x3c')](_0x2180('0xac'),_0x541d04[_0x2180('0x3a')],util[_0x2180('0x34')](_0x541d04,{'showHidden':![],'depth':null}));if(this['channels'][_0x541d04[_0x2180('0xad')]]){this['channels'][_0x541d04[_0x2180('0xad')]][_0x2180('0xae')]=_0x541d04['origtransferercalleridnum'];this[_0x2180('0x1d')][_0x541d04[_0x2180('0xad')]][_0x2180('0xaf')]=_0x541d04[_0x2180('0xab')];if(this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb0')]]){var _0x4d4dde=this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb0')]];this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb0')]]=this['channels'][_0x541d04[_0x2180('0xad')]];this[_0x2180('0x1d')][_0x541d04['transfereeuniqueid']]=_0x4d4dde;}}else if(this['channels'][_0x541d04['transfertargetuniqueid']]){this[_0x2180('0x1d')][_0x541d04['transfertargetuniqueid']][_0x2180('0xae')]=_0x541d04[_0x2180('0xaa')];this['channels'][_0x541d04['transfertargetuniqueid']]['transferconnectedlinenum']=_0x541d04[_0x2180('0xab')];if(this['channels'][_0x541d04[_0x2180('0xb1')]]){var _0x4d4dde=this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb1')]];this[_0x2180('0x1d')][_0x541d04['origtransfereruniqueid']]=this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb2')]];this['channels'][_0x541d04[_0x2180('0xb2')]]=_0x4d4dde;}}if((this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb1')]]||this['channels'][_0x541d04[_0x2180('0xb3')]])&&this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb0')]]){var _0x647bfe=_[_0x2180('0xb4')]([this['channels'][_0x541d04[_0x2180('0xb1')]],this['channels'][_0x541d04['origtransfererlinkedid']],this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb0')]]],function(_0x13f1a5){return _0x13f1a5&&_0x13f1a5[_0x2180('0x80')]===_0x2180('0xa6')&&_0x13f1a5[_0x2180('0xb5')];});if(_0x647bfe){if(this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb1')]])this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb1')]]['transferType']=_0x2180('0xb6');if(this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb3')]])this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb3')]][_0x2180('0x9a')]=_0x2180('0xb6');this[_0x2180('0x1d')][_0x541d04[_0x2180('0xb0')]][_0x2180('0x9a')]=_0x2180('0xb6');}}}}catch(_0x21406d){logger['error'](_0x2180('0xb7'),_0x541d04[_0x2180('0x3a')],util[_0x2180('0x34')](_0x21406d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')][_0x2180('0x2d')]=function(_0x870a0){try{if(this[_0x2180('0x38')](_0x870a0)){logger[_0x2180('0x44')](_0x2180('0xb8'),_0x870a0[_0x2180('0x3a')],_0x870a0['transfereecalleridnum'],_0x870a0[_0x2180('0xb9')]);logger[_0x2180('0x3c')](_0x2180('0xba'),_0x870a0[_0x2180('0x3a')],util['inspect'](_0x870a0,{'showHidden':![],'depth':null}));if(this[_0x2180('0x1d')][_0x870a0[_0x2180('0xad')]]){this['channels'][_0x870a0[_0x2180('0xad')]][_0x2180('0xae')]=_0x870a0['transfereecalleridnum'];this['channels'][_0x870a0[_0x2180('0xad')]][_0x2180('0xaf')]=_0x870a0[_0x2180('0xb9')];this['channels'][_0x870a0[_0x2180('0xad')]][_0x2180('0x9a')]='BLIND';this[_0x2180('0x29')]({'event':_0x2180('0xa5'),'uniqueid':_0x870a0[_0x2180('0xad')],'context':_0x870a0[_0x2180('0x45')],'channel':_0x870a0[_0x2180('0xbb')]});}else{this[_0x2180('0x1d')][_0x870a0[_0x2180('0xbc')]][_0x2180('0x9a')]=_0x2180('0xbd');}}}catch(_0x55e850){logger[_0x2180('0x32')](_0x2180('0xbe'),_0x870a0['uniqueid'],util[_0x2180('0x34')](_0x55e850,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')][_0x2180('0xbf')]=function(_0x5ec675){try{if(this[_0x2180('0x38')](_0x5ec675)){logger['debug']('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x5ec675['uniqueid'],util[_0x2180('0x34')](_0x5ec675,{'showHidden':![],'depth':null}));if(this['channels'][_0x5ec675[_0x2180('0x3a')]]){if(!_[_0x2180('0xc0')](this[_0x2180('0x1d')][_0x5ec675[_0x2180('0x3a')]]['answertime'])){this[_0x2180('0x1d')][_0x5ec675[_0x2180('0x3a')]]['mohstarttime']=moment()[_0x2180('0x47')](_0x2180('0x48'));logger[_0x2180('0x44')](_0x2180('0xc1'),_0x5ec675[_0x2180('0x3a')],this[_0x2180('0x1d')][_0x5ec675[_0x2180('0x3a')]][_0x2180('0xc2')]);}}}}catch(_0x2ce021){logger[_0x2180('0x32')]('[%s][voiceCallReport][musiconholdstart]',_0x5ec675[_0x2180('0x3a')],util[_0x2180('0x34')](_0x2ce021,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2180('0x35')][_0x2180('0x2f')]=function(_0x501377){try{if(this[_0x2180('0x38')](_0x501377)){logger[_0x2180('0x3c')](_0x2180('0xc3'),_0x501377[_0x2180('0x3a')],util[_0x2180('0x34')](_0x501377,{'showHidden':![],'depth':null}));if(this['channels'][_0x501377[_0x2180('0x3a')]]){if(!_[_0x2180('0xc0')](this['channels'][_0x501377[_0x2180('0x3a')]][_0x2180('0xc2')])){this[_0x2180('0x1d')][_0x501377[_0x2180('0x3a')]][_0x2180('0xc4')]+=moment()[_0x2180('0xc5')](0x0)[_0x2180('0x95')](this['channels'][_0x501377[_0x2180('0x3a')]][_0x2180('0xc2')],_0x2180('0x5a'));logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x501377['uniqueid'],this[_0x2180('0x1d')][_0x501377[_0x2180('0x3a')]]['mohtime']);delete this[_0x2180('0x1d')][_0x501377['uniqueid']][_0x2180('0xc2')];}}}}catch(_0x61ea2){logger[_0x2180('0x32')](_0x2180('0xc6'),_0x501377[_0x2180('0x3a')],util[_0x2180('0x34')](_0x61ea2,{'showHidden':![],'depth':null}));}};module[_0x2180('0xc7')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 5509b68..f07f031 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 _0x9fa8=['[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','moment','../../../config/environment','../../../config/logger','../ami','redis','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','uniqueid','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','membername','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','complete','total','diff','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify'];(function(_0x40b587,_0x595537){var _0x2e78b3=function(_0x259a5d){while(--_0x259a5d){_0x40b587['push'](_0x40b587['shift']());}};_0x2e78b3(++_0x595537);}(_0x9fa8,0x13e));var _0x89fa=function(_0x3814ea,_0x5200d4){_0x3814ea=_0x3814ea-0x0;var _0x3f0a37=_0x9fa8[_0x3814ea];return _0x3f0a37;};'use strict';var _=require('lodash');var moment=require(_0x89fa('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x89fa('0x1'));var logger=require(_0x89fa('0x2'))('ami');var ami=require(_0x89fa('0x3'));config['redis']=_['defaults'](config[_0x89fa('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x89fa('0x5'))(new Redis(config[_0x89fa('0x4')]));function VoiceDialReport(_0x38a5e1){this[_0x89fa('0x6')]=_0x38a5e1[_0x89fa('0x7')];this[_0x89fa('0x8')]=_0x38a5e1['outbound'];this[_0x89fa('0x9')]={};ami['on'](_0x89fa('0xa'),this[_0x89fa('0xb')][_0x89fa('0xc')](this));ami['on'](_0x89fa('0xd'),this[_0x89fa('0xe')][_0x89fa('0xc')](this));ami['on'](_0x89fa('0xf'),this['syncVarSet'][_0x89fa('0xc')](this));ami['on'](_0x89fa('0x10'),this[_0x89fa('0x11')][_0x89fa('0xc')](this));}VoiceDialReport[_0x89fa('0x12')][_0x89fa('0x13')]=function(_0xd14006){return _0xd14006!==null&&!_[_0x89fa('0x14')](_0xd14006);};VoiceDialReport[_0x89fa('0x12')]['emit']=function(_0x510f90,_0xa7dc91,_0x4fb290){io['to'](_0x510f90)[_0x89fa('0x15')](_0xa7dc91,_0x4fb290);};VoiceDialReport[_0x89fa('0x12')][_0x89fa('0xb')]=function(_0x3e7c8d){try{if(this[_0x89fa('0x13')](_0x3e7c8d)){logger[_0x89fa('0x16')](_0x89fa('0x17'),_0x3e7c8d['uniqueid'],util[_0x89fa('0x18')](_0x3e7c8d,{'showHidden':![],'depth':null}));if(this[_0x89fa('0x6')][_0x3e7c8d['uniqueid']]){_['merge'](this[_0x89fa('0x6')][_0x3e7c8d['uniqueid']],{'starttime':moment()[_0x89fa('0x19')](_0x89fa('0x1a')),'lastevent':_0x89fa('0x1b'),'interface':_0x3e7c8d['channel'][_0x89fa('0x1c')](0x0,_0x3e7c8d[_0x89fa('0x1d')][_0x89fa('0x1e')]('-')),'membername':_0x3e7c8d['channel'][_0x89fa('0x1c')](_0x3e7c8d[_0x89fa('0x1d')]['lastIndexOf']('/')+0x1,_0x3e7c8d[_0x89fa('0x1d')][_0x89fa('0x1e')]('-'))},_[_0x89fa('0x1f')](_0x3e7c8d,[_0x89fa('0x20'),_0x89fa('0x21')]));logger['info'](_0x89fa('0x22'),_0x3e7c8d['uniqueid'],this[_0x89fa('0x6')][_0x3e7c8d[_0x89fa('0x23')]]['membername'],this[_0x89fa('0x6')][_0x3e7c8d[_0x89fa('0x23')]][_0x89fa('0x24')]);logger[_0x89fa('0x16')](_0x89fa('0x25'),_0x3e7c8d[_0x89fa('0x23')],util[_0x89fa('0x18')](this[_0x89fa('0x6')][_0x3e7c8d['uniqueid']],{'showHidden':![],'depth':null}));this[_0x89fa('0x15')]('voice:outbound',_0x89fa('0x26'),this[_0x89fa('0x6')][_0x3e7c8d[_0x89fa('0x23')]]);logger['debug'](_0x89fa('0x27'),_0x3e7c8d['uniqueid'],util[_0x89fa('0x18')](this[_0x89fa('0x6')][_0x3e7c8d[_0x89fa('0x23')]],{'showHidden':![],'depth':null}));ami[_0x89fa('0x15')](_0x89fa('0x28'),this[_0x89fa('0x6')][_0x3e7c8d['uniqueid']]);}}}catch(_0x960480){logger[_0x89fa('0x29')]('[%s][voiceDialReport][dialbegin]',_0x3e7c8d['uniqueid'],util[_0x89fa('0x18')](_0x960480,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x89fa('0x12')][_0x89fa('0xe')]=function(_0x4fdf58){try{if(this[_0x89fa('0x13')](_0x4fdf58)){logger[_0x89fa('0x16')]('[%s][voiceDialReport][dialend]\x20event:',_0x4fdf58[_0x89fa('0x23')],util[_0x89fa('0x18')](_0x4fdf58,{'showHidden':![],'depth':null}));if(this[_0x89fa('0x6')][_0x4fdf58[_0x89fa('0x23')]]){this[_0x89fa('0x6')][_0x4fdf58[_0x89fa('0x23')]][_0x89fa('0x2a')]=_0x4fdf58[_0x89fa('0x2a')];if(_0x4fdf58[_0x89fa('0x2a')]===_0x89fa('0x2b')){this[_0x89fa('0x6')][_0x4fdf58[_0x89fa('0x23')]][_0x89fa('0x2c')]=_0x4fdf58['connectedlinenum'];this['channels'][_0x4fdf58[_0x89fa('0x23')]][_0x89fa('0x2d')]=_0x4fdf58[_0x89fa('0x2d')];this[_0x89fa('0x6')][_0x4fdf58[_0x89fa('0x23')]][_0x89fa('0x2e')]=moment()['format'](_0x89fa('0x1a'));this[_0x89fa('0x6')][_0x4fdf58[_0x89fa('0x23')]]['lastevent']=_0x89fa('0x2f');logger[_0x89fa('0x30')](_0x89fa('0x31'),_0x4fdf58[_0x89fa('0x23')],_0x4fdf58[_0x89fa('0x1d')][_0x89fa('0x1c')](_0x4fdf58[_0x89fa('0x1d')][_0x89fa('0x1e')]('/')+0x1,_0x4fdf58[_0x89fa('0x1d')][_0x89fa('0x1e')]('-')));logger[_0x89fa('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x4fdf58['uniqueid'],util[_0x89fa('0x18')](this[_0x89fa('0x6')][_0x4fdf58[_0x89fa('0x23')]],{'showHidden':![],'depth':null}));ami[_0x89fa('0x15')]('custom:dialconnect',this['channels'][_0x4fdf58['uniqueid']]);}logger[_0x89fa('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4fdf58[_0x89fa('0x23')],util[_0x89fa('0x18')](this[_0x89fa('0x6')][_0x4fdf58[_0x89fa('0x23')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x89fa('0x26'),this['channels'][_0x4fdf58[_0x89fa('0x23')]]);}}}catch(_0x181172){logger['error'](_0x89fa('0x32'),_0x4fdf58[_0x89fa('0x23')],util['inspect'](_0x181172,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x89fa('0x12')][_0x89fa('0x33')]=function(_0x49f82f){try{if(this[_0x89fa('0x13')](_0x49f82f)){logger[_0x89fa('0x16')](_0x89fa('0x34'),_0x49f82f['uniqueid'],util[_0x89fa('0x18')](_0x49f82f,{'showHidden':![],'depth':null}));this[_0x89fa('0x35')](_0x49f82f[_0x89fa('0x23')],_[_0x89fa('0x36')](_0x49f82f[_0x89fa('0x37')])[0x0],_0x49f82f[_0x89fa('0x38')]);if(this[_0x89fa('0x13')](_0x49f82f['variable'])&&this[_0x89fa('0x13')](_0x49f82f[_0x89fa('0x37')][_0x89fa('0x39')])){if(_['isUndefined'](this[_0x89fa('0x6')][_0x49f82f[_0x89fa('0x23')]])){this[_0x89fa('0x6')][_0x49f82f[_0x89fa('0x23')]]={'routeId':_0x49f82f[_0x89fa('0x38')],'variables':this[_0x89fa('0x9')][_0x49f82f['uniqueid']]};logger['info'](_0x89fa('0x3a'),_0x49f82f['uniqueid'],_0x49f82f[_0x89fa('0x37')][_0x89fa('0x39')],_['keys'](_0x49f82f['variable'])[0x0],_0x49f82f[_0x89fa('0x38')]);logger[_0x89fa('0x16')](_0x89fa('0x3b'),_0x49f82f['uniqueid'],util[_0x89fa('0x18')](this[_0x89fa('0x6')][_0x49f82f['uniqueid']],{'showHidden':![],'depth':null}));this[_0x89fa('0x15')](_0x89fa('0x3c'),_0x89fa('0x26'),this['channels'][_0x49f82f[_0x89fa('0x23')]]);}}}}catch(_0x31ba36){logger[_0x89fa('0x29')](_0x89fa('0x3d'),_0x49f82f[_0x89fa('0x23')],util[_0x89fa('0x18')](_0x31ba36,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x89fa('0x12')][_0x89fa('0x35')]=function(_0x105178,_0x344104,_0x545bc8){var _0x409227=[_0x89fa('0x3e'),_0x89fa('0x3f'),'rtpaudioqosjitter',_0x89fa('0x40'),_0x89fa('0x41'),_0x89fa('0x42'),'rtpaudioqosrtt',_0x89fa('0x43'),_0x89fa('0x44'),_0x89fa('0x45'),_0x89fa('0x46'),'bridgepvtcallid',_0x89fa('0x47'),'memberdynamic',_0x89fa('0x48'),'memberlastcall',_0x89fa('0x49'),_0x89fa('0x4a'),_0x89fa('0x4b')];if(!_['isNil'](_0x344104)&&!_[_0x89fa('0x4c')](_0x409227,_0x344104)){if(_[_0x89fa('0x14')](this['variables'][_0x105178])){this[_0x89fa('0x9')][_0x105178]={};}this[_0x89fa('0x9')][_0x105178][_0x344104]=_0x545bc8;}};VoiceDialReport[_0x89fa('0x12')][_0x89fa('0x11')]=function(_0x162350){try{if(this['isNotNull'](_0x162350)){logger[_0x89fa('0x16')](_0x89fa('0x4d'),_0x162350[_0x89fa('0x23')],util['inspect'](_0x162350,{'showHidden':![],'depth':null}));if(this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]]){logger['info'](_0x89fa('0x4e'),_0x162350[_0x89fa('0x23')],_0x162350[_0x89fa('0x4f')]);this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]][_0x89fa('0x50')]=moment()[_0x89fa('0x19')](_0x89fa('0x1a'));this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]][_0x89fa('0x51')]=moment(this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]][_0x89fa('0x50')])['diff'](this[_0x89fa('0x6')][_0x162350['uniqueid']][_0x89fa('0x52')],_0x89fa('0x53'));this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]]['lastevent']=_0x89fa('0x54');this[_0x89fa('0x8')][_0x89fa('0x55')]+=0x1;if(this['channels'][_0x162350[_0x89fa('0x23')]][_0x89fa('0x2e')]){this[_0x89fa('0x8')]['answered']+=0x1;this['channels'][_0x162350['uniqueid']]['holdtime']=moment(this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]]['answertime'])[_0x89fa('0x56')](this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]]['starttime'],_0x89fa('0x53'));this[_0x89fa('0x6')][_0x162350['uniqueid']][_0x89fa('0x57')]=moment(this[_0x89fa('0x6')][_0x162350['uniqueid']][_0x89fa('0x50')])[_0x89fa('0x56')](this['channels'][_0x162350[_0x89fa('0x23')]][_0x89fa('0x2e')],_0x89fa('0x53'));this[_0x89fa('0x8')][_0x89fa('0x58')]+=this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]]['holdtime']||0x0;this[_0x89fa('0x8')]['sumBillable']+=this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]][_0x89fa('0x57')];}this[_0x89fa('0x8')][_0x89fa('0x59')]+=this['channels'][_0x162350[_0x89fa('0x23')]][_0x89fa('0x51')];logger['debug'](_0x89fa('0x5a'),_0x162350[_0x89fa('0x23')],util[_0x89fa('0x18')](this['channels'][_0x162350['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x89fa('0x15')](_0x89fa('0x5b'),this['channels'][_0x162350[_0x89fa('0x23')]]);logger[_0x89fa('0x16')](_0x89fa('0x5c'),_0x162350[_0x89fa('0x23')],util['inspect'](this['channels'][_0x162350[_0x89fa('0x23')]],{'showHidden':![],'depth':null}));ami[_0x89fa('0x15')](_0x89fa('0x5d'),this[_0x89fa('0x6')][_0x162350['uniqueid']]);logger[_0x89fa('0x16')](_0x89fa('0x5e'),_0x162350['uniqueid'],util[_0x89fa('0x18')](this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]],{'showHidden':![],'depth':null}));this[_0x89fa('0x15')](_0x89fa('0x3c'),_0x89fa('0x5f'),this[_0x89fa('0x8')]);logger[_0x89fa('0x30')](_0x89fa('0x60'),JSON[_0x89fa('0x61')](this['channels'][_0x162350[_0x89fa('0x23')]]));logger[_0x89fa('0x16')](_0x89fa('0x62'),_0x162350[_0x89fa('0x23')],util[_0x89fa('0x18')](this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]],{'showHidden':![],'depth':null}));this[_0x89fa('0x15')]('voice:outbound',_0x89fa('0x63'),this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]]);delete this[_0x89fa('0x6')][_0x162350[_0x89fa('0x23')]];}else if(this[_0x89fa('0x6')][_0x162350[_0x89fa('0x64')]]){this[_0x89fa('0x6')][_0x162350['linkedid']][_0x89fa('0x23')]=this['channels'][_0x162350['linkedid']][_0x89fa('0x65')];}if(this[_0x89fa('0x9')][_0x162350[_0x89fa('0x23')]]){delete this[_0x89fa('0x9')][_0x162350[_0x89fa('0x23')]];}}}catch(_0x53a012){logger[_0x89fa('0x29')](_0x89fa('0x66'),_0x162350['uniqueid'],util[_0x89fa('0x18')](_0x53a012,{'showHidden':![],'depth':null}));}};module[_0x89fa('0x67')]=VoiceDialReport; \ No newline at end of file +var _0x5cb3=['dialend','syncDialEnd','bind','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','called','channel','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','YYYY-MM-DD\x20HH:mm:ss','duration','diff','starttime','total','answered','holdtime','seconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','channels','outbound','variables','dialbegin','syncDialBegin'];(function(_0x3f4ba6,_0x133cd6){var _0x4fa5a3=function(_0x136d8b){while(--_0x136d8b){_0x3f4ba6['push'](_0x3f4ba6['shift']());}};_0x4fa5a3(++_0x133cd6);}(_0x5cb3,0xbe));var _0x35cb=function(_0x183bd8,_0x53bd79){_0x183bd8=_0x183bd8-0x0;var _0x1388e3=_0x5cb3[_0x183bd8];return _0x1388e3;};'use strict';var _=require(_0x35cb('0x0'));var moment=require('moment');var util=require(_0x35cb('0x1'));var Redis=require(_0x35cb('0x2'));var config=require(_0x35cb('0x3'));var logger=require(_0x35cb('0x4'))(_0x35cb('0x5'));var ami=require(_0x35cb('0x6'));config[_0x35cb('0x7')]=_['defaults'](config[_0x35cb('0x7')],{'host':_0x35cb('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35cb('0x7')]));function VoiceDialReport(_0x39aa2a){this[_0x35cb('0x9')]=_0x39aa2a['outboundChannels'];this[_0x35cb('0xa')]=_0x39aa2a[_0x35cb('0xa')];this[_0x35cb('0xb')]={};ami['on'](_0x35cb('0xc'),this[_0x35cb('0xd')]['bind'](this));ami['on'](_0x35cb('0xe'),this[_0x35cb('0xf')][_0x35cb('0x10')](this));ami['on']('varset',this[_0x35cb('0x11')][_0x35cb('0x10')](this));ami['on'](_0x35cb('0x12'),this[_0x35cb('0x13')]['bind'](this));}VoiceDialReport['prototype'][_0x35cb('0x14')]=function(_0x180c4c){return _0x180c4c!==null&&!_[_0x35cb('0x15')](_0x180c4c);};VoiceDialReport[_0x35cb('0x16')][_0x35cb('0x17')]=function(_0x118234,_0x5d0324,_0x11818f){io['to'](_0x118234)['emit'](_0x5d0324,_0x11818f);};VoiceDialReport[_0x35cb('0x16')][_0x35cb('0xd')]=function(_0x5f2ab2){try{if(this[_0x35cb('0x14')](_0x5f2ab2)){logger[_0x35cb('0x18')](_0x35cb('0x19'),_0x5f2ab2[_0x35cb('0x1a')],util[_0x35cb('0x1b')](_0x5f2ab2,{'showHidden':![],'depth':null}));if(this[_0x35cb('0x9')][_0x5f2ab2[_0x35cb('0x1a')]]){_['merge'](this[_0x35cb('0x9')][_0x5f2ab2[_0x35cb('0x1a')]],{'starttime':moment()[_0x35cb('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x35cb('0x1d'),'interface':_0x5f2ab2[_0x35cb('0x1e')]['substring'](0x0,_0x5f2ab2[_0x35cb('0x1e')][_0x35cb('0x1f')]('-')),'membername':_0x5f2ab2[_0x35cb('0x1e')]['substring'](_0x5f2ab2[_0x35cb('0x1e')]['lastIndexOf']('/')+0x1,_0x5f2ab2[_0x35cb('0x1e')][_0x35cb('0x1f')]('-'))},_[_0x35cb('0x20')](_0x5f2ab2,['event',_0x35cb('0x21')]));logger[_0x35cb('0x22')](_0x35cb('0x23'),_0x5f2ab2['uniqueid'],this[_0x35cb('0x9')][_0x5f2ab2[_0x35cb('0x1a')]][_0x35cb('0x24')],this[_0x35cb('0x9')][_0x5f2ab2['uniqueid']][_0x35cb('0x25')]);logger[_0x35cb('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5f2ab2['uniqueid'],util[_0x35cb('0x1b')](this[_0x35cb('0x9')][_0x5f2ab2[_0x35cb('0x1a')]],{'showHidden':![],'depth':null}));this[_0x35cb('0x17')]('voice:outbound',_0x35cb('0x26'),this[_0x35cb('0x9')][_0x5f2ab2[_0x35cb('0x1a')]]);logger[_0x35cb('0x18')](_0x35cb('0x27'),_0x5f2ab2[_0x35cb('0x1a')],util['inspect'](this[_0x35cb('0x9')][_0x5f2ab2[_0x35cb('0x1a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this['channels'][_0x5f2ab2[_0x35cb('0x1a')]]);}}}catch(_0x3e95c2){logger[_0x35cb('0x28')]('[%s][voiceDialReport][dialbegin]',_0x5f2ab2[_0x35cb('0x1a')],util['inspect'](_0x3e95c2,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x35cb('0xf')]=function(_0x2261de){try{if(this[_0x35cb('0x14')](_0x2261de)){logger[_0x35cb('0x18')](_0x35cb('0x29'),_0x2261de[_0x35cb('0x1a')],util['inspect'](_0x2261de,{'showHidden':![],'depth':null}));if(this[_0x35cb('0x9')][_0x2261de['uniqueid']]){this[_0x35cb('0x9')][_0x2261de[_0x35cb('0x1a')]][_0x35cb('0x2a')]=_0x2261de['dialstatus'];if(_0x2261de[_0x35cb('0x2a')]===_0x35cb('0x2b')){this[_0x35cb('0x9')][_0x2261de[_0x35cb('0x1a')]][_0x35cb('0x2c')]=_0x2261de[_0x35cb('0x2c')];this[_0x35cb('0x9')][_0x2261de[_0x35cb('0x1a')]]['connectedlinename']=_0x2261de[_0x35cb('0x2d')];this[_0x35cb('0x9')][_0x2261de[_0x35cb('0x1a')]][_0x35cb('0x2e')]=moment()[_0x35cb('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x35cb('0x9')][_0x2261de[_0x35cb('0x1a')]][_0x35cb('0x2f')]=_0x35cb('0x30');logger['info'](_0x35cb('0x31'),_0x2261de[_0x35cb('0x1a')],_0x2261de[_0x35cb('0x1e')][_0x35cb('0x32')](_0x2261de[_0x35cb('0x1e')][_0x35cb('0x1f')]('/')+0x1,_0x2261de[_0x35cb('0x1e')][_0x35cb('0x1f')]('-')));logger[_0x35cb('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x2261de[_0x35cb('0x1a')],util[_0x35cb('0x1b')](this[_0x35cb('0x9')][_0x2261de[_0x35cb('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x35cb('0x17')]('custom:dialconnect',this[_0x35cb('0x9')][_0x2261de[_0x35cb('0x1a')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2261de[_0x35cb('0x1a')],util[_0x35cb('0x1b')](this[_0x35cb('0x9')][_0x2261de['uniqueid']],{'showHidden':![],'depth':null}));this[_0x35cb('0x17')](_0x35cb('0x33'),_0x35cb('0x26'),this[_0x35cb('0x9')][_0x2261de[_0x35cb('0x1a')]]);}}}catch(_0x5ce0bf){logger[_0x35cb('0x28')](_0x35cb('0x34'),_0x2261de['uniqueid'],util['inspect'](_0x5ce0bf,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x35cb('0x16')][_0x35cb('0x11')]=function(_0x51f901){try{if(this['isNotNull'](_0x51f901)){logger[_0x35cb('0x18')](_0x35cb('0x35'),_0x51f901[_0x35cb('0x1a')],util[_0x35cb('0x1b')](_0x51f901,{'showHidden':![],'depth':null}));this[_0x35cb('0x36')](_0x51f901['uniqueid'],_['keys'](_0x51f901[_0x35cb('0x37')])[0x0],_0x51f901[_0x35cb('0x38')]);if(this[_0x35cb('0x14')](_0x51f901[_0x35cb('0x37')])&&this[_0x35cb('0x14')](_0x51f901['variable'][_0x35cb('0x39')])){if(_[_0x35cb('0x15')](this[_0x35cb('0x9')][_0x51f901['uniqueid']])){this[_0x35cb('0x9')][_0x51f901[_0x35cb('0x1a')]]={'routeId':_0x51f901[_0x35cb('0x38')],'variables':this[_0x35cb('0xb')][_0x51f901[_0x35cb('0x1a')]]};logger[_0x35cb('0x22')](_0x35cb('0x3a'),_0x51f901['uniqueid'],_0x51f901[_0x35cb('0x37')][_0x35cb('0x39')],_[_0x35cb('0x3b')](_0x51f901[_0x35cb('0x37')])[0x0],_0x51f901[_0x35cb('0x38')]);logger['debug'](_0x35cb('0x3c'),_0x51f901[_0x35cb('0x1a')],util[_0x35cb('0x1b')](this['channels'][_0x51f901[_0x35cb('0x1a')]],{'showHidden':![],'depth':null}));this[_0x35cb('0x17')](_0x35cb('0x33'),_0x35cb('0x26'),this[_0x35cb('0x9')][_0x51f901[_0x35cb('0x1a')]]);}}}}catch(_0x2b556f){logger['error'](_0x35cb('0x3d'),_0x51f901[_0x35cb('0x1a')],util[_0x35cb('0x1b')](_0x2b556f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x35cb('0x16')][_0x35cb('0x36')]=function(_0x3afe0f,_0x37c15b,_0x2086cb){var _0x5a1804=[_0x35cb('0x3e'),_0x35cb('0x3f'),_0x35cb('0x40'),'rtpaudioqosjitterbridged',_0x35cb('0x41'),_0x35cb('0x42'),_0x35cb('0x43'),_0x35cb('0x44'),_0x35cb('0x45'),_0x35cb('0x46'),_0x35cb('0x47'),'bridgepvtcallid',_0x35cb('0x48'),_0x35cb('0x49'),'memberinterface',_0x35cb('0x4a'),'membername','memberpenalty',_0x35cb('0x4b')];if(!_[_0x35cb('0x4c')](_0x37c15b)&&!_[_0x35cb('0x4d')](_0x5a1804,_0x37c15b)){if(_['isUndefined'](this[_0x35cb('0xb')][_0x3afe0f])){this[_0x35cb('0xb')][_0x3afe0f]={};}this[_0x35cb('0xb')][_0x3afe0f][_0x37c15b]=_0x2086cb;}};VoiceDialReport[_0x35cb('0x16')][_0x35cb('0x13')]=function(_0x35ea9c){try{if(this[_0x35cb('0x14')](_0x35ea9c)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x35ea9c[_0x35cb('0x1a')],util['inspect'](_0x35ea9c,{'showHidden':![],'depth':null}));if(this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]]){logger['info'](_0x35cb('0x4e'),_0x35ea9c[_0x35cb('0x1a')],_0x35ea9c['cause-txt']);this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]][_0x35cb('0x4f')]=moment()[_0x35cb('0x1c')](_0x35cb('0x50'));this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]][_0x35cb('0x51')]=moment(this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]][_0x35cb('0x4f')])[_0x35cb('0x52')](this['channels'][_0x35ea9c['uniqueid']][_0x35cb('0x53')],'seconds');this[_0x35cb('0x9')][_0x35ea9c['uniqueid']][_0x35cb('0x2f')]='complete';this[_0x35cb('0xa')][_0x35cb('0x54')]+=0x1;if(this['channels'][_0x35ea9c['uniqueid']][_0x35cb('0x2e')]){this[_0x35cb('0xa')][_0x35cb('0x55')]+=0x1;this['channels'][_0x35ea9c[_0x35cb('0x1a')]][_0x35cb('0x56')]=moment(this[_0x35cb('0x9')][_0x35ea9c['uniqueid']]['answertime'])[_0x35cb('0x52')](this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]][_0x35cb('0x53')],_0x35cb('0x57'));this['channels'][_0x35ea9c[_0x35cb('0x1a')]]['billableseconds']=moment(this[_0x35cb('0x9')][_0x35ea9c['uniqueid']][_0x35cb('0x4f')])[_0x35cb('0x52')](this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]][_0x35cb('0x2e')],_0x35cb('0x57'));this[_0x35cb('0xa')][_0x35cb('0x58')]+=this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]][_0x35cb('0x56')]||0x0;this['outbound'][_0x35cb('0x59')]+=this['channels'][_0x35ea9c[_0x35cb('0x1a')]]['billableseconds'];}this[_0x35cb('0xa')][_0x35cb('0x5a')]+=this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]][_0x35cb('0x51')];logger['debug'](_0x35cb('0x5b'),_0x35ea9c[_0x35cb('0x1a')],util[_0x35cb('0x1b')](this['channels'][_0x35ea9c[_0x35cb('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x35cb('0x17')](_0x35cb('0x5c'),this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]]);logger[_0x35cb('0x18')](_0x35cb('0x5d'),_0x35ea9c[_0x35cb('0x1a')],util[_0x35cb('0x1b')](this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x35cb('0x17')](_0x35cb('0x5e'),this['channels'][_0x35ea9c[_0x35cb('0x1a')]]);logger['debug'](_0x35cb('0x5f'),_0x35ea9c[_0x35cb('0x1a')],util[_0x35cb('0x1b')](this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x35cb('0x33'),_0x35cb('0x60'),this['outbound']);logger[_0x35cb('0x22')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x35cb('0x61')](this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]]));logger[_0x35cb('0x18')](_0x35cb('0x62'),_0x35ea9c[_0x35cb('0x1a')],util['inspect'](this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x35cb('0x33'),'voice_outbound_channel:remove',this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]]);delete this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x1a')]];}else if(this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x63')]]){this[_0x35cb('0x9')][_0x35ea9c['linkedid']][_0x35cb('0x1a')]=this[_0x35cb('0x9')][_0x35ea9c[_0x35cb('0x63')]][_0x35cb('0x64')];}if(this[_0x35cb('0xb')][_0x35ea9c[_0x35cb('0x1a')]]){delete this[_0x35cb('0xb')][_0x35ea9c[_0x35cb('0x1a')]];}}}catch(_0x3b0580){logger[_0x35cb('0x28')](_0x35cb('0x65'),_0x35ea9c[_0x35cb('0x1a')],util[_0x35cb('0x1b')](_0x3b0580,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index f686be6..fe26e10 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 _0x0834=['syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','voiceQueues','clearQueueReport','emitVoiceQueueChannelRemove','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','emit',']\x20sending\x20voice_queue_channel:remove\x20event:','name','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','strategy','available','loggedIn','sumBillable','sumDuration','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify',']\x20sending\x20voice_queue:save\x20event:','isNotNull','isUndefined','clearZombieChannels','loopQueueSummary','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','info','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','queuecallerexitreason','queuecallerabandonAt','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','linkedid','queuecallerjoinAt','add','seconds','transferexten','transferuniqueid','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','includes','[%s][voiceQueueReport][hangup]','length','sumHoldTime','diff','milliseconds','answered','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','emitVoiceQueueSummary','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','exports','util','md5','ami','../ami','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','syncQueueSummaryComplete','bind','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','varset','syncHangup','fullybooted'];(function(_0x230a01,_0x24ca69){var _0x3315d3=function(_0x2fc971){while(--_0x2fc971){_0x230a01['push'](_0x230a01['shift']());}};_0x3315d3(++_0x24ca69);}(_0x0834,0x18e));var _0x4083=function(_0x4ce9b3,_0x193b54){_0x4ce9b3=_0x4ce9b3-0x0;var _0x2faf97=_0x0834[_0x4ce9b3];return _0x2faf97;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x4083('0x0'));var md5=require(_0x4083('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4083('0x2'));var ami=require(_0x4083('0x3'));var QueueReport=require('../model/queueReport');config[_0x4083('0x4')]=_[_0x4083('0x5')](config['redis'],{'host':_0x4083('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4083('0x4')]));var Sequence=function(){};Sequence[_0x4083('0x7')][_0x4083('0x8')]=function(_0x1d56dd){this[_0x4083('0x9')]=this[_0x4083('0x9')]?this[_0x4083('0x9')][_0x4083('0xa')](_0x1d56dd):_0x1d56dd();};function VoiceQueueReport(_0x2a5093){this[_0x4083('0xb')]=new Sequence();this[_0x4083('0xc')]={};this[_0x4083('0xd')]=_0x2a5093[_0x4083('0xd')];this[_0x4083('0xe')]=_0x2a5093[_0x4083('0xf')];this['voiceQueues']=_0x2a5093['voiceQueues'];this[_0x4083('0x10')]=!![];this[_0x4083('0x11')]=_0x2a5093['campaigns'];this[_0x4083('0x12')]={};ami['on'](_0x4083('0x13'),this[_0x4083('0x14')]['bind'](this));ami['on']('queuesummarycomplete',this[_0x4083('0x15')][_0x4083('0x16')](this));ami['on']('queuecallerjoin',this[_0x4083('0x17')][_0x4083('0x16')](this));ami['on'](_0x4083('0x18'),this[_0x4083('0x19')][_0x4083('0x16')](this));ami['on']('queuecallerleave',this[_0x4083('0x1a')][_0x4083('0x16')](this));ami['on'](_0x4083('0x1b'),this[_0x4083('0x1c')]['bind'](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x4083('0x16')](this));ami['on'](_0x4083('0x1d'),this['syncVarSet'][_0x4083('0x16')](this));ami['on']('hangup',this[_0x4083('0x1e')][_0x4083('0x16')](this));ami['on'](_0x4083('0x1f'),this[_0x4083('0x20')]['bind'](this));ami['on'](_0x4083('0x21'),this['syncMusicOnHoldStart'][_0x4083('0x16')](this));ami['on'](_0x4083('0x22'),this[_0x4083('0x23')][_0x4083('0x16')](this));ami['on']('attendedtransfer',this[_0x4083('0x24')]['bind'](this));ami['on'](_0x4083('0x25'),this[_0x4083('0x26')]['bind'](this));this['loopQueueSummary']();this[_0x4083('0x27')]();}function clearChannels(_0x5b1f8a){if(!_['isEmpty'](_0x5b1f8a)){for(var _0x5f034c in _0x5b1f8a){if(_0x5b1f8a[_0x4083('0x28')](_0x5f034c)){delete _0x5b1f8a[_0x5f034c];}}}}function clearCampaigns(_0xb2fbb5){if(!_[_0x4083('0x29')](_0xb2fbb5)){for(var _0x5ea88e in _0xb2fbb5){if(_0xb2fbb5[_0x4083('0x28')](_0x5ea88e)){_0xb2fbb5[_0x5ea88e][_0x4083('0x2a')]=0x0;}}}}function clearVoiceQueues(_0xa2690a){if(!_['isEmpty'](_0xa2690a)){for(var _0x46946f in _0xa2690a){if(_0xa2690a[_0x4083('0x28')](_0x46946f)){_0xa2690a[_0x46946f]['originated']=0x0;_0xa2690a[_0x46946f][_0x4083('0x2b')]=0x0;_0xa2690a[_0x46946f][_0x4083('0x2c')]=0x0;_0xa2690a[_0x46946f][_0x4083('0x2d')]=0x0;_0xa2690a[_0x46946f][_0x4083('0x2e')]=!![];}}}}function clearAgentBooked(_0xdf4d9e){if(!_[_0x4083('0x29')](_0xdf4d9e)){for(var _0x13cc00 in _0xdf4d9e){if(_0xdf4d9e[_0x4083('0x28')](_0x13cc00)){_0xdf4d9e[_0x13cc00][_0x4083('0x2f')]=!![];}}}}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x327fa8=this;for(var _0x189e4d in this[_0x4083('0xe')]){if(this[_0x4083('0xe')][_0x4083('0x28')](_0x189e4d)&&!this[_0x4083('0xe')][_0x189e4d]['switch']){this[_0x4083('0xb')][_0x4083('0x8')](function(){if(!_[_0x4083('0x30')](_0x327fa8[_0x4083('0xe')][_0x189e4d])){return ami[_0x4083('0x31')]({'action':_0x4083('0x32'),'channel':_0x327fa8['channels'][_0x189e4d][_0x4083('0x33')]})[_0x4083('0x34')](function(_0x3e5004){if(_0x3e5004[_0x4083('0x35')]===_0x4083('0x36')){setTimeout(function(){if(_0x327fa8[_0x4083('0xe')][_0x189e4d]){delete _0x327fa8['channels'][_0x189e4d];logger[_0x4083('0x37')]('[%s][voiceQueueReport][checkChannel]',_0x189e4d,util[_0x4083('0x38')](_0x3e5004,{'showHidden':![],'depth':null}));}if(_0x327fa8[_0x4083('0xc')][_0x189e4d]){delete _0x327fa8['queueReports'][_0x189e4d];logger[_0x4083('0x37')](_0x4083('0x39'),_0x189e4d,util[_0x4083('0x38')](_0x3e5004,{'showHidden':![],'depth':null}));}if(_0x327fa8[_0x4083('0x12')][_0x189e4d]){delete _0x327fa8['variables'][_0x189e4d];logger['error'](_0x4083('0x3a'),_0x189e4d,util[_0x4083('0x38')](_0x3e5004,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x4083('0x20')]=function(){logger['error'](_0x4083('0x3b'));clearChannels(this['channels']);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this[_0x4083('0xd')]);clearVoiceQueues(this[_0x4083('0x3c')]);clearCampaigns(this[_0x4083('0x11')]);};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x3d')]=function(_0x57138a){var _0x533e0f=this;if(!_[_0x4083('0x29')](_0x57138a)){for(var _0x457a6b in _0x57138a){if(_0x57138a['hasOwnProperty'](_0x457a6b)){_0x533e0f[_0x4083('0x3e')](_0x57138a[_0x457a6b],'clearqueuereport');delete _0x57138a[_0x457a6b];}}}};VoiceQueueReport['prototype']['emit']=function(_0x1dc933,_0x2fbe82,_0x228b2c){io['to'](_0x1dc933)['emit'](_0x2fbe82,_0x228b2c);};VoiceQueueReport['prototype'][_0x4083('0x3f')]=function(_0x4bdbee,_0x392f7b){logger[_0x4083('0x40')](_0x4083('0x41')+_0x392f7b+_0x4083('0x42'),_0x4bdbee[_0x4083('0x43')],util[_0x4083('0x38')](_0x4bdbee,{'showHidden':![],'depth':null}));this['emit'](util[_0x4083('0x44')](_0x4083('0x45'),_0x4bdbee['name']),'voice_queue_channel:save',_0x4bdbee);io[_0x4083('0x46')]('voice_queue_presence:save',_0x4bdbee);};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x3e')]=function(_0x1b00a5,_0x4867cb){logger[_0x4083('0x40')](_0x4083('0x41')+_0x4867cb+_0x4083('0x47'),_0x1b00a5['uniqueid'],util[_0x4083('0x38')](_0x1b00a5,{'showHidden':![],'depth':null}));this[_0x4083('0x46')](util[_0x4083('0x44')](_0x4083('0x45'),_0x1b00a5[_0x4083('0x48')]),_0x4083('0x49'),_0x1b00a5);io[_0x4083('0x46')](_0x4083('0x4a'),_0x1b00a5);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x1796c3,_0x2a9e38){if(_0x1796c3[_0x4083('0x4b')]===_0x4083('0x4c')){var _0x293702={'id':_0x1796c3['id'],'name':_0x1796c3[_0x4083('0x48')],'strategy':_0x1796c3[_0x4083('0x4d')],'answered':_0x1796c3['answered'],'available':_0x1796c3[_0x4083('0x4e')],'loggedIn':_0x1796c3[_0x4083('0x4f')],'pTalking':_0x1796c3[_0x4083('0x2c')],'sumBillable':_0x1796c3[_0x4083('0x50')],'sumDuration':_0x1796c3[_0x4083('0x51')],'sumHoldTime':_0x1796c3['sumHoldTime']||0x0,'talking':_0x1796c3[_0x4083('0x2b')],'total':_0x1796c3['total'],'type':_0x1796c3['type'],'unmanaged':_0x1796c3[_0x4083('0x52')],'abandoned':_0x1796c3[_0x4083('0x53')],'waiting':_0x1796c3[_0x4083('0x2d')]};if(_0x1796c3[_0x4083('0x54')]){_0x293702['Trunk']={'id':_0x1796c3[_0x4083('0x54')]['id'],'name':_0x1796c3['Trunk'][_0x4083('0x48')],'active':_0x1796c3[_0x4083('0x54')][_0x4083('0x55')],'callerid':_0x1796c3['Trunk'][_0x4083('0x56')]};}if(_0x1796c3[_0x4083('0x57')]){_0x293702[_0x4083('0x57')]={'id':_0x1796c3['Interval']['id'],'name':_0x1796c3[_0x4083('0x57')][_0x4083('0x48')]};}var _0x4776d3=md5(JSON[_0x4083('0x58')](_0x293702));if(_0x1796c3[_0x4083('0x1')]!==_0x4776d3){_0x1796c3[_0x4083('0x1')]=_0x4776d3;logger[_0x4083('0x40')]('[voiceQueueReport]['+_0x2a9e38+_0x4083('0x59'),util[_0x4083('0x38')](_0x293702,{'showHidden':![],'depth':null}));this[_0x4083('0x46')](util[_0x4083('0x44')]('voice:queue:%s',_0x293702[_0x4083('0x48')]),'voice_queue:save',_0x293702);}}};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x5a')]=function(_0x49f9f9){return _0x49f9f9!==null&&!_[_0x4083('0x5b')](_0x49f9f9);};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x27')]=function(){var _0x1c54c5=this;setInterval(function(){_0x1c54c5[_0x4083('0x5c')]();ami[_0x4083('0x31')]({'action':'queues'})['catch'](function(_0x164ea3){logger[_0x4083('0x37')]('[voiceQueueReport][queues]',util[_0x4083('0x38')](_0x164ea3,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x5d')]=function(){var _0x4aa83e=this;setInterval(function(){if(_0x4aa83e[_0x4083('0x10')]){return ami['Action']({'action':_0x4083('0x13')})[_0x4083('0x5e')](function(_0x209be3){_0x4aa83e[_0x4083('0x10')]=![];})[_0x4083('0x34')](function(_0x5ca97a){logger['error'](_0x4083('0x5f'),util['inspect'](_0x5ca97a,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x14')]=function(_0x4d609e){try{if(this['isNotNull'](_0x4d609e)&&this[_0x4083('0x5a')](_0x4d609e[_0x4083('0x60')])){logger[_0x4083('0x40')](_0x4083('0x61'),util[_0x4083('0x38')](_0x4d609e,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x4d609e[_0x4083('0x60')]]){logger['info'](_0x4083('0x62'),_0x4d609e[_0x4083('0x60')]);var _0x302001=_['countBy'](this[_0x4083('0xe')],_0x4083('0x60'))[_0x4d609e[_0x4083('0x60')]]||0x0;var _0x3f6c2c=_0x302001-_0x4d609e[_0x4083('0x63')];if(this[_0x4083('0x3c')][_0x4d609e[_0x4083('0x60')]][_0x4083('0x2d')]!==_[_0x4083('0x64')](_0x4d609e[_0x4083('0x63')])||this[_0x4083('0x3c')][_0x4d609e[_0x4083('0x60')]][_0x4083('0x4f')]!==_[_0x4083('0x64')](_0x4d609e['loggedin'])||this[_0x4083('0x3c')][_0x4d609e['queue']][_0x4083('0x4e')]!==_[_0x4083('0x64')](_0x4d609e[_0x4083('0x4e')])||this['voiceQueues'][_0x4d609e['queue']][_0x4083('0x2b')]!==_0x3f6c2c){this[_0x4083('0x3c')][_0x4d609e[_0x4083('0x60')]][_0x4083('0x2d')]=_[_0x4083('0x64')](_0x4d609e[_0x4083('0x63')]);this[_0x4083('0x3c')][_0x4d609e[_0x4083('0x60')]][_0x4083('0x4f')]=_[_0x4083('0x64')](_0x4d609e['loggedin']);this[_0x4083('0x3c')][_0x4d609e[_0x4083('0x60')]][_0x4083('0x4e')]=_[_0x4083('0x64')](_0x4d609e['available']);this[_0x4083('0x3c')][_0x4d609e[_0x4083('0x60')]]['talking']=_0x3f6c2c>0x0?_0x3f6c2c:0x0;this['voiceQueues'][_0x4d609e[_0x4083('0x60')]][_0x4083('0x2b')]=this['voiceQueues'][_0x4d609e[_0x4083('0x60')]]['talking']>_[_0x4083('0x64')](_0x4d609e[_0x4083('0x65')])?_['toNumber'](_0x4d609e[_0x4083('0x65')]):this[_0x4083('0x3c')][_0x4d609e[_0x4083('0x60')]][_0x4083('0x2b')];this['emitVoiceQueueSummary'](this[_0x4083('0x3c')][_0x4d609e[_0x4083('0x60')]],'queuesummary');}logger[_0x4083('0x40')](_0x4083('0x66'),util[_0x4083('0x38')](this['voiceQueues'][_0x4d609e[_0x4083('0x60')]],{'showHidden':![],'depth':null}));ami[_0x4083('0x46')]('custom:queuesummary',this['voiceQueues'][_0x4d609e[_0x4083('0x60')]]);}}}catch(_0x29fb6b){logger['error']('[voiceQueueReport][queuesummary]',util[_0x4083('0x38')](_0x29fb6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x15')]=function(_0x1687aa){logger['debug'](_0x4083('0x67'),util[_0x4083('0x38')](_0x1687aa,{'showHidden':![],'depth':null}));this[_0x4083('0x10')]=!![];};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x17')]=function(_0x1d5239){try{if(this['isNotNull'](_0x1d5239)){logger[_0x4083('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1d5239['uniqueid'],util[_0x4083('0x38')](_0x1d5239,{'showHidden':![],'depth':null}));if(_[_0x4083('0x5b')](this[_0x4083('0xc')][_0x1d5239[_0x4083('0x43')]])){this['queueReports'][_0x1d5239[_0x4083('0x43')]]=[];this[_0x4083('0xe')][_0x1d5239[_0x4083('0x43')]]={};}var _0x217fc0=new QueueReport();_0x217fc0[_0x4083('0x48')]=_0x1d5239[_0x4083('0x60')];_0x217fc0[_0x4083('0x4b')]=this[_0x4083('0x3c')][_0x217fc0[_0x4083('0x48')]]&&this[_0x4083('0x3c')][_0x217fc0['name']][_0x4083('0x4b')]?this[_0x4083('0x3c')][_0x217fc0[_0x4083('0x48')]][_0x4083('0x4b')]||_0x4083('0x4c'):'inbound';_0x217fc0[_0x4083('0x60')]=_0x1d5239[_0x4083('0x60')];_0x217fc0['queuecallerjoinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x217fc0[_0x4083('0x68')]=_0x1d5239[_0x4083('0x68')];_0x217fc0[_0x4083('0x69')]=_0x1d5239[_0x4083('0x69')];_0x217fc0[_0x4083('0x43')]=_0x1d5239[_0x4083('0x43')];logger['info'](_0x4083('0x6a'),_0x217fc0[_0x4083('0x48')],_0x217fc0['type']);_[_0x4083('0x6b')](_0x217fc0,_[_0x4083('0x6c')](_0x1d5239,_[_0x4083('0x6d')](_0x217fc0)));this['queueReports'][_0x1d5239[_0x4083('0x43')]][_0x4083('0x6e')](_0x217fc0);this['channels'][_0x1d5239[_0x4083('0x43')]]=_0x217fc0;this[_0x4083('0x3f')](_0x217fc0,_0x4083('0x6f'));}}catch(_0x446777){logger[_0x4083('0x37')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1d5239['uniqueid'],util[_0x4083('0x38')](_0x446777,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x290b54){try{if(this[_0x4083('0x5a')](_0x290b54)){logger[_0x4083('0x40')](_0x4083('0x70'),_0x290b54[_0x4083('0x43')],util['inspect'](_0x290b54,{'showHidden':![],'depth':null}));if(this[_0x4083('0xc')][_0x290b54['uniqueid']]){var _0x1b03f3=_[_0x4083('0x71')](this[_0x4083('0xc')][_0x290b54[_0x4083('0x43')]]);_0x1b03f3[_0x4083('0x72')]=![];_0x1b03f3[_0x4083('0x73')]=null;_0x1b03f3[_0x4083('0x74')]=_0x290b54['holdtime'];_0x1b03f3[_0x4083('0x75')]=_0x290b54[_0x4083('0x75')];_0x1b03f3['queuecallerabandon']=!![];_0x1b03f3['queuecallerabandonAt']=moment()[_0x4083('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b03f3['queuecallerexitreason']='ABANDONED';_0x1b03f3['lastAssignedTo']=null;logger['info'](_0x4083('0x76'),_0x1b03f3[_0x4083('0x48')],_0x1b03f3['type']);this[_0x4083('0xe')][_0x290b54[_0x4083('0x43')]]=_0x1b03f3;this[_0x4083('0x3e')](_0x1b03f3,_0x4083('0x18'));}}}catch(_0x2185a1){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x290b54[_0x4083('0x43')],util['inspect'](_0x2185a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4083('0x1a')]=function(_0x22da0b){try{if(this[_0x4083('0x5a')](_0x22da0b)){logger[_0x4083('0x40')](_0x4083('0x77'),_0x22da0b[_0x4083('0x43')],util['inspect'](_0x22da0b,{'showHidden':![],'depth':null}));if(this[_0x4083('0xc')][_0x22da0b[_0x4083('0x43')]]){var _0x1b4274=_[_0x4083('0x71')](this[_0x4083('0xc')][_0x22da0b[_0x4083('0x43')]]);_0x1b4274[_0x4083('0x78')]=moment()[_0x4083('0x44')](_0x4083('0x79'));_0x1b4274[_0x4083('0x7a')]=_0x22da0b[_0x4083('0x7a')];_0x1b4274[_0x4083('0x7b')]=_0x22da0b['connectedlinename'];logger[_0x4083('0x7c')](_0x4083('0x7d'),_0x1b4274[_0x4083('0x48')],_0x1b4274[_0x4083('0x4b')],_0x22da0b[_0x4083('0x7a')],_0x22da0b[_0x4083('0x7b')]);this[_0x4083('0xe')][_0x22da0b[_0x4083('0x43')]]=_0x1b4274;this['emitVoiceQueueChannelSave'](_0x1b4274,_0x4083('0x7e'));}}}catch(_0x13523b){logger[_0x4083('0x37')](_0x4083('0x77'),_0x22da0b[_0x4083('0x43')],util[_0x4083('0x38')](_0x13523b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x7f')]=function(_0x5eecbc){try{if(this[_0x4083('0x5a')](_0x5eecbc)){logger[_0x4083('0x40')](_0x4083('0x80'),_0x5eecbc['uniqueid'],util[_0x4083('0x38')](_0x5eecbc,{'showHidden':![],'depth':null}));if(this[_0x4083('0xc')][_0x5eecbc[_0x4083('0x43')]]){var _0x22837b=_['last'](this[_0x4083('0xc')][_0x5eecbc[_0x4083('0x43')]]);_0x22837b[_0x4083('0x72')]=!![];_0x22837b[_0x4083('0x81')]='COMPLETEDBYAGENT';logger[_0x4083('0x7c')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x22837b['name'],_0x22837b['type']);}}}catch(_0x36f2bb){logger['error'](_0x4083('0x80'),_0x5eecbc['uniqueid'],util['inspect'](_0x36f2bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x1c')]=function(_0x590604){try{if(this['isNotNull'](_0x590604)){logger[_0x4083('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x590604['uniqueid'],util[_0x4083('0x38')](_0x590604,{'showHidden':![],'depth':null}));if(this[_0x4083('0xc')][_0x590604[_0x4083('0x43')]]){var _0xfc57d7=_[_0x4083('0x71')](this[_0x4083('0xc')][_0x590604[_0x4083('0x43')]]);_0xfc57d7['queuecallerabandon']=![];_0xfc57d7[_0x4083('0x82')]=null;_0xfc57d7[_0x4083('0x83')]=!![];_0xfc57d7[_0x4083('0x84')]=_0x590604[_0x4083('0x85')];_0xfc57d7[_0x4083('0x74')]=_0x590604[_0x4083('0x74')];_0xfc57d7[_0x4083('0x72')]=!![];_0xfc57d7[_0x4083('0x86')]=![];_0xfc57d7[_0x4083('0x87')]=null;if(!_0xfc57d7[_0x4083('0x88')]){if(_0x590604['reason']=='transfer'){_0xfc57d7[_0x4083('0x81')]=_0x4083('0x89');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0xfc57d7[_0x4083('0x48')],_0xfc57d7['type']);}else{if(_['startsWith'](_0x590604['channel']['toLowerCase'](),'local/')){if(this['queueReports'][_0x590604[_0x4083('0x8a')]]){var _0x3c679d=_[_0x4083('0x71')](this[_0x4083('0xc')][_0x590604['linkedid']]);_0x3c679d['queuecallercomplete']=![];_0x3c679d[_0x4083('0x86')]=!![];_0x3c679d[_0x4083('0x87')]=moment(_0xfc57d7[_0x4083('0x8b')])[_0x4083('0x8c')](_0x590604[_0x4083('0x74')],_0x4083('0x8d'))[_0x4083('0x44')](_0x4083('0x79'));_0x3c679d[_0x4083('0x81')]='FORWARDTRANSFER';_0x3c679d['transfer']=!![];_0x3c679d['transfertype']='FORWARD';_0x3c679d[_0x4083('0x8e')]=_0x590604['destexten'];_0x3c679d[_0x4083('0x8f')]=_0x590604[_0x4083('0x43')];logger[_0x4083('0x7c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x3c679d['name'],_0x3c679d[_0x4083('0x4b')]);var _0xc65544=this[_0x4083('0xc')][_0x590604[_0x4083('0x8a')]];this[_0x4083('0xc')][_0x590604[_0x4083('0x8a')]]=this[_0x4083('0xc')][_0x590604[_0x4083('0x43')]];this[_0x4083('0xc')][_0x590604[_0x4083('0x43')]]=_0xc65544;}}else{_0xfc57d7[_0x4083('0x81')]=_0x4083('0x90')+_0x590604[_0x4083('0x91')][_0x4083('0x92')]();logger[_0x4083('0x7c')](_0x4083('0x93'),_0xfc57d7['name'],_0xfc57d7[_0x4083('0x4b')],_0xfc57d7[_0x4083('0x81')]);}}}this[_0x4083('0xe')][_0x590604[_0x4083('0x43')]]=_0xfc57d7;this[_0x4083('0x3e')](_0xfc57d7,'agentcomplete');}}}catch(_0x505d64){logger[_0x4083('0x37')]('[%s][voiceQueueReport][agentcomplete]',_0x590604[_0x4083('0x43')],util[_0x4083('0x38')](_0x505d64,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x94')]=function(_0x587a32){try{if(this[_0x4083('0x5a')](_0x587a32)){logger[_0x4083('0x40')](_0x4083('0x95'),_0x587a32['uniqueid'],util[_0x4083('0x38')](_0x587a32,{'showHidden':![],'depth':null}));this[_0x4083('0x96')](_0x587a32[_0x4083('0x43')],_[_0x4083('0x6d')](_0x587a32[_0x4083('0x97')])[0x0],_0x587a32[_0x4083('0x98')]);if(this[_0x4083('0xc')][_0x587a32[_0x4083('0x43')]]){var _0x2fc711=_[_0x4083('0x71')](this[_0x4083('0xc')][_0x587a32[_0x4083('0x43')]]);if(_0x2fc711){if(this[_0x4083('0x5a')](_0x587a32[_0x4083('0x97')])&&this['isNotNull'](_0x587a32['variable']['queuestatus'])){switch(_0x587a32[_0x4083('0x98')]){case _0x4083('0x99'):_0x2fc711[_0x4083('0x86')]=![];_0x2fc711['queuecallerexitAt']=null;break;case _0x4083('0x9a'):_0x2fc711[_0x4083('0x9b')]=_0x4083('0x9c');_0x2fc711[_0x4083('0x86')]=!![];_0x2fc711[_0x4083('0x87')]=moment()[_0x4083('0x44')](_0x4083('0x79'));_0x2fc711[_0x4083('0x78')]=moment()[_0x4083('0x44')](_0x4083('0x79'));logger[_0x4083('0x40')](_0x4083('0x9d'),_0x587a32[_0x4083('0x43')],util[_0x4083('0x38')](_0x2fc711,{'showHidden':![],'depth':null}));ami['emit'](_0x4083('0x9e'),_0x2fc711);break;default:_0x2fc711[_0x4083('0x86')]=!![];_0x2fc711[_0x4083('0x87')]=moment()[_0x4083('0x44')](_0x4083('0x79'));_0x2fc711[_0x4083('0x78')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2fc711['queuecallerabandon']=![];_0x2fc711['queuecallerabandonAt']=null;_0x2fc711[_0x4083('0x81')]=_0x587a32[_0x4083('0x98')];this[_0x4083('0xe')][_0x587a32[_0x4083('0x43')]]=_0x2fc711;this[_0x4083('0x3e')](_0x2fc711,_0x4083('0x1d'));}else if(this[_0x4083('0x5a')](_0x587a32[_0x4083('0x97')])&&this['isNotNull'](_0x587a32[_0x4083('0x97')][_0x4083('0x9f')])){if(!_0x2fc711[_0x4083('0x18')]){_0x2fc711[_0x4083('0x86')]=!![];_0x2fc711[_0x4083('0x87')]=moment()[_0x4083('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x2fc711[_0x4083('0x81')]=_0x4083('0xa0');_0x2fc711[_0x4083('0x78')]=moment()[_0x4083('0x44')](_0x4083('0x79'));this[_0x4083('0xe')][_0x587a32[_0x4083('0x43')]]=_0x2fc711;}}logger[_0x4083('0x7c')](_0x4083('0xa1'),_0x587a32[_0x4083('0x43')],_0x2fc711[_0x4083('0x48')],_0x2fc711[_0x4083('0x4b')],_[_0x4083('0x6d')](_0x587a32[_0x4083('0x97')])[0x0],_0x587a32[_0x4083('0x98')]);_0x2fc711[_0x4083('0x12')]=this['variables'][_0x587a32[_0x4083('0x43')]];}}}}catch(_0x4045b9){logger[_0x4083('0x37')]('[%s][voiceQueueReport][varset]',_0x587a32[_0x4083('0x43')],util[_0x4083('0x38')](_0x4045b9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4083('0x7')][_0x4083('0x96')]=function(_0x4a9e99,_0x5f3783,_0x116602){var _0x242f00=[_0x4083('0xa2'),_0x4083('0xa3'),_0x4083('0xa4'),_0x4083('0xa5'),_0x4083('0xa6'),_0x4083('0xa7'),_0x4083('0xa8'),_0x4083('0xa9'),_0x4083('0xaa'),_0x4083('0xab'),_0x4083('0xac'),_0x4083('0xad'),'membercalls',_0x4083('0xae'),_0x4083('0xaf'),_0x4083('0xb0'),_0x4083('0x85'),'memberpenalty','memberrealtime'];if(!_[_0x4083('0x30')](_0x5f3783)&&!_[_0x4083('0xb1')](_0x242f00,_0x5f3783)){if(_[_0x4083('0x5b')](this['variables'][_0x4a9e99])){this[_0x4083('0x12')][_0x4a9e99]={};}this['variables'][_0x4a9e99][_0x5f3783]=_0x116602;}};VoiceQueueReport['prototype'][_0x4083('0x1e')]=function(_0x473daa){try{if(this['isNotNull'](_0x473daa)){logger[_0x4083('0x40')](_0x4083('0xb2'),_0x473daa['uniqueid'],util[_0x4083('0x38')](_0x473daa,{'showHidden':![],'depth':null}));if(this[_0x4083('0xc')][_0x473daa['uniqueid']]){for(var _0x39f6a4=0x0,_0x15c783={};_0x39f6a40x0?_0x4d3930:0x0;this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]][_0x297a('0x31')]=this['voiceQueues'][_0x149b75[_0x297a('0x64')]][_0x297a('0x31')]>_[_0x297a('0x66')](_0x149b75['loggedin'])?_['toNumber'](_0x149b75[_0x297a('0x69')]):this['voiceQueues'][_0x149b75['queue']][_0x297a('0x31')];this[_0x297a('0x6a')](this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]],_0x297a('0x17'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x297a('0x3f')](this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]],{'showHidden':![],'depth':null}));ami[_0x297a('0x4a')](_0x297a('0x6b'),this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]]);}}}catch(_0x5aa1f1){logger[_0x297a('0x3d')](_0x297a('0x6c'),util[_0x297a('0x3f')](_0x5aa1f1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x6d')]=function(_0x56af63){logger[_0x297a('0x46')](_0x297a('0x6e'),util[_0x297a('0x3f')](_0x56af63,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x1a')]=function(_0x584c17){try{if(this[_0x297a('0x60')](_0x584c17)){logger[_0x297a('0x46')](_0x297a('0x6f'),_0x584c17[_0x297a('0x47')],util[_0x297a('0x3f')](_0x584c17,{'showHidden':![],'depth':null}));if(_[_0x297a('0x61')](this[_0x297a('0x40')][_0x584c17[_0x297a('0x47')]])){this['queueReports'][_0x584c17[_0x297a('0x47')]]=[];this[_0x297a('0x11')][_0x584c17['uniqueid']]={};}var _0x260cdc=new QueueReport();_0x260cdc['name']=_0x584c17[_0x297a('0x64')];_0x260cdc[_0x297a('0x4f')]=this[_0x297a('0x13')][_0x260cdc[_0x297a('0x49')]]&&this['voiceQueues'][_0x260cdc[_0x297a('0x49')]]['type']?this['voiceQueues'][_0x260cdc[_0x297a('0x49')]]['type']||_0x297a('0x50'):_0x297a('0x50');_0x260cdc['queue']=_0x584c17['queue'];_0x260cdc[_0x297a('0x70')]=moment()[_0x297a('0x5e')](_0x297a('0x71'));_0x260cdc[_0x297a('0x72')]=_0x584c17[_0x297a('0x72')];_0x260cdc[_0x297a('0x73')]=_0x584c17['count'];_0x260cdc[_0x297a('0x47')]=_0x584c17['uniqueid'];logger['info'](_0x297a('0x74'),_0x260cdc[_0x297a('0x49')],_0x260cdc[_0x297a('0x4f')]);_[_0x297a('0x75')](_0x260cdc,_[_0x297a('0x76')](_0x584c17,_[_0x297a('0x77')](_0x260cdc)));this[_0x297a('0x40')][_0x584c17[_0x297a('0x47')]]['push'](_0x260cdc);this[_0x297a('0x11')][_0x584c17[_0x297a('0x47')]]=_0x260cdc;this['emitVoiceQueueChannelSave'](_0x260cdc,'queuecallerjoin');}}catch(_0x5bb15b){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x584c17['uniqueid'],util[_0x297a('0x3f')](_0x5bb15b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x1b')]=function(_0x5ba0d8){try{if(this[_0x297a('0x60')](_0x5ba0d8)){logger[_0x297a('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5ba0d8[_0x297a('0x47')],util['inspect'](_0x5ba0d8,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x5ba0d8[_0x297a('0x47')]]){var _0x5915f1=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x5ba0d8['uniqueid']]);_0x5915f1[_0x297a('0x79')]=![];_0x5915f1['queuecallercompleteAt']=null;_0x5915f1['holdtime']=_0x5ba0d8['holdtime'];_0x5915f1[_0x297a('0x7a')]=_0x5ba0d8[_0x297a('0x7a')];_0x5915f1[_0x297a('0x7b')]=!![];_0x5915f1['queuecallerabandonAt']=moment()[_0x297a('0x5e')](_0x297a('0x71'));_0x5915f1[_0x297a('0x7c')]='ABANDONED';_0x5915f1[_0x297a('0x7d')]=null;logger[_0x297a('0x7e')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5915f1['name'],_0x5915f1[_0x297a('0x4f')]);this[_0x297a('0x11')][_0x5ba0d8[_0x297a('0x47')]]=_0x5915f1;this[_0x297a('0x45')](_0x5915f1,'queuecallerabandon');}}}catch(_0x445f52){logger[_0x297a('0x3d')](_0x297a('0x7f'),_0x5ba0d8[_0x297a('0x47')],util[_0x297a('0x3f')](_0x445f52,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncQueueCallerLeave']=function(_0x3ac2b9){try{if(this[_0x297a('0x60')](_0x3ac2b9)){logger['debug'](_0x297a('0x80'),_0x3ac2b9[_0x297a('0x47')],util[_0x297a('0x3f')](_0x3ac2b9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3ac2b9[_0x297a('0x47')]]){var _0x1ec354=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x3ac2b9[_0x297a('0x47')]]);_0x1ec354[_0x297a('0x81')]=moment()[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ec354[_0x297a('0x82')]=_0x3ac2b9[_0x297a('0x82')];_0x1ec354['connectedlinename']=_0x3ac2b9[_0x297a('0x83')];logger[_0x297a('0x7e')](_0x297a('0x84'),_0x1ec354[_0x297a('0x49')],_0x1ec354[_0x297a('0x4f')],_0x3ac2b9[_0x297a('0x82')],_0x3ac2b9[_0x297a('0x83')]);this[_0x297a('0x11')][_0x3ac2b9[_0x297a('0x47')]]=_0x1ec354;this['emitVoiceQueueChannelSave'](_0x1ec354,_0x297a('0x85'));}}}catch(_0x1e83ed){logger['error'](_0x297a('0x80'),_0x3ac2b9[_0x297a('0x47')],util[_0x297a('0x3f')](_0x1e83ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncAgentConnect']=function(_0x5c7c83){try{if(this[_0x297a('0x60')](_0x5c7c83)){logger[_0x297a('0x46')](_0x297a('0x86'),_0x5c7c83['uniqueid'],util['inspect'](_0x5c7c83,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x5c7c83[_0x297a('0x47')]]){var _0x4dcbe3=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x5c7c83[_0x297a('0x47')]]);_0x4dcbe3[_0x297a('0x79')]=!![];_0x4dcbe3[_0x297a('0x7c')]=_0x297a('0x87');logger[_0x297a('0x7e')](_0x297a('0x88'),_0x4dcbe3[_0x297a('0x49')],_0x4dcbe3[_0x297a('0x4f')]);}}}catch(_0x44ca94){logger[_0x297a('0x3d')](_0x297a('0x86'),_0x5c7c83[_0x297a('0x47')],util[_0x297a('0x3f')](_0x44ca94,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x297a('0x89')]=function(_0x75cf07){try{if(this['isNotNull'](_0x75cf07)){logger[_0x297a('0x46')](_0x297a('0x8a'),_0x75cf07[_0x297a('0x47')],util[_0x297a('0x3f')](_0x75cf07,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]){var _0x269901=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]);_0x269901[_0x297a('0x7b')]=![];_0x269901[_0x297a('0x8b')]=null;_0x269901['assigned']=!![];_0x269901[_0x297a('0x7d')]=_0x75cf07[_0x297a('0x8c')];_0x269901[_0x297a('0x8d')]=_0x75cf07[_0x297a('0x8d')];_0x269901[_0x297a('0x79')]=!![];_0x269901[_0x297a('0x8e')]=![];_0x269901[_0x297a('0x8f')]=null;if(!_0x269901[_0x297a('0x90')]){if(_0x75cf07[_0x297a('0x91')]==_0x297a('0x90')){_0x269901['queuecallerexitreason']='COMPLETED';logger[_0x297a('0x7e')](_0x297a('0x92'),_0x269901[_0x297a('0x49')],_0x269901[_0x297a('0x4f')]);}else{if(_[_0x297a('0x93')](_0x75cf07['channel'][_0x297a('0x94')](),_0x297a('0x95'))){if(this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]]){var _0x1fae6b=_['last'](this['queueReports'][_0x75cf07[_0x297a('0x96')]]);_0x1fae6b[_0x297a('0x79')]=![];_0x1fae6b['queuecallerexit']=!![];_0x1fae6b[_0x297a('0x8f')]=moment(_0x269901[_0x297a('0x70')])[_0x297a('0x97')](_0x75cf07['holdtime'],_0x297a('0x98'))[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fae6b[_0x297a('0x7c')]=_0x297a('0x99');_0x1fae6b['transfer']=!![];_0x1fae6b[_0x297a('0x9a')]=_0x297a('0x9b');_0x1fae6b['transferexten']=_0x75cf07[_0x297a('0x9c')];_0x1fae6b['transferuniqueid']=_0x75cf07[_0x297a('0x47')];logger[_0x297a('0x7e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1fae6b[_0x297a('0x49')],_0x1fae6b[_0x297a('0x4f')]);var _0x4dc2d0=this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]];this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]]=this[_0x297a('0x40')][_0x75cf07['uniqueid']];this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]=_0x4dc2d0;}}else{_0x269901[_0x297a('0x7c')]='COMPLETEDBY'+_0x75cf07[_0x297a('0x91')][_0x297a('0x9d')]();logger['info'](_0x297a('0x9e'),_0x269901['name'],_0x269901[_0x297a('0x4f')],_0x269901[_0x297a('0x7c')]);}}}this[_0x297a('0x11')][_0x75cf07[_0x297a('0x47')]]=_0x269901;this[_0x297a('0x45')](_0x269901,_0x297a('0x1d'));}}}catch(_0x24a40a){logger['error'](_0x297a('0x8a'),_0x75cf07[_0x297a('0x47')],util[_0x297a('0x3f')](_0x24a40a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncVarSet']=function(_0x2296b0){try{if(this[_0x297a('0x60')](_0x2296b0)){logger[_0x297a('0x46')](_0x297a('0x9f'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x2296b0,{'showHidden':![],'depth':null}));this[_0x297a('0xa0')](_0x2296b0[_0x297a('0x47')],_['keys'](_0x2296b0[_0x297a('0xa1')])[0x0],_0x2296b0[_0x297a('0xa2')]);if(this[_0x297a('0x40')][_0x2296b0[_0x297a('0x47')]]){var _0x366e1a=_['last'](this[_0x297a('0x40')][_0x2296b0[_0x297a('0x47')]]);if(_0x366e1a){if(this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')])&&this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')]['queuestatus'])){switch(_0x2296b0[_0x297a('0xa2')]){case _0x297a('0xa3'):_0x366e1a['queuecallerexit']=![];_0x366e1a[_0x297a('0x8f')]=null;break;case _0x297a('0xa4'):_0x366e1a[_0x297a('0xa5')]=_0x297a('0xa6');_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x366e1a['queuecallerleaveAt']=moment()[_0x297a('0x5e')](_0x297a('0x71'));logger[_0x297a('0x46')](_0x297a('0xa7'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x366e1a,{'showHidden':![],'depth':null}));ami[_0x297a('0x4a')]('custom:timeout',_0x366e1a);break;default:_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a[_0x297a('0x8f')]=moment()['format'](_0x297a('0x71'));_0x366e1a[_0x297a('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x366e1a['queuecallerabandon']=![];_0x366e1a['queuecallerabandonAt']=null;_0x366e1a[_0x297a('0x7c')]=_0x2296b0[_0x297a('0xa2')];this['channels'][_0x2296b0[_0x297a('0x47')]]=_0x366e1a;this['emitVoiceQueueChannelRemove'](_0x366e1a,_0x297a('0x20'));}else if(this['isNotNull'](_0x2296b0[_0x297a('0xa1')])&&this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')][_0x297a('0xa8')])){if(!_0x366e1a[_0x297a('0x7b')]){_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a[_0x297a('0x8f')]=moment()[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x366e1a[_0x297a('0x7c')]=_0x297a('0xa9');_0x366e1a[_0x297a('0x81')]=moment()[_0x297a('0x5e')](_0x297a('0x71'));this[_0x297a('0x11')][_0x2296b0[_0x297a('0x47')]]=_0x366e1a;}}logger[_0x297a('0x7e')](_0x297a('0xaa'),_0x2296b0[_0x297a('0x47')],_0x366e1a[_0x297a('0x49')],_0x366e1a[_0x297a('0x4f')],_[_0x297a('0x77')](_0x2296b0[_0x297a('0xa1')])[0x0],_0x2296b0['value']);_0x366e1a[_0x297a('0x16')]=this[_0x297a('0x16')][_0x2296b0['uniqueid']];}}}}catch(_0x1093be){logger[_0x297a('0x3d')](_0x297a('0x9f'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x1093be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0xa0')]=function(_0x13d639,_0x4083b7,_0x280545){var _0x472050=['rtpaudioqos',_0x297a('0xab'),_0x297a('0xac'),_0x297a('0xad'),_0x297a('0xae'),'rtpaudioqoslossbridged',_0x297a('0xaf'),_0x297a('0xb0'),_0x297a('0xb1'),'sipuri',_0x297a('0xb2'),_0x297a('0xb3'),_0x297a('0xb4'),'memberdynamic',_0x297a('0xb5'),'memberlastcall',_0x297a('0x8c'),_0x297a('0xb6'),_0x297a('0xb7')];if(!_[_0x297a('0x37')](_0x4083b7)&&!_['includes'](_0x472050,_0x4083b7)){if(_[_0x297a('0x61')](this[_0x297a('0x16')][_0x13d639])){this[_0x297a('0x16')][_0x13d639]={};}this[_0x297a('0x16')][_0x13d639][_0x4083b7]=_0x280545;}};VoiceQueueReport['prototype'][_0x297a('0x23')]=function(_0x4052a7){try{if(this[_0x297a('0x60')](_0x4052a7)){logger['debug'](_0x297a('0xb8'),_0x4052a7['uniqueid'],util[_0x297a('0x3f')](_0x4052a7,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x4052a7[_0x297a('0x47')]]){for(var _0x219f63=0x0,_0x531f8a={};_0x219f63=0x0?moment(_0xbc0886[_0xdc33('0x1a')])['diff'](_0xbc0886[_0xdc33('0x19')],'seconds'):null,'data1':_0xdc33('0x1b'),'data2':_0xbc0886[_0xdc33('0x12')],'data3':_0xbc0886['exten'],'data4':_0xbc0886[_0xdc33('0x1c')]||null,'role':'agent','internal':_0xbc0886[_0xdc33('0x12')]?_[_0xdc33('0x13')](_0xbc0886[_0xdc33('0x12')]):undefined,'uniqueid':_0xbc0886['uniqueid']},'log':_0xdc33('0x6')});}; \ No newline at end of file +var _0x0d76=['voiceDialReport','starttime','endtime','accountcode','dialstring','agent','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','inbound','exten','queue','toNumber','uniqueid'];(function(_0x5cce34,_0x4841ba){var _0x2da384=function(_0x139a33){while(--_0x139a33){_0x5cce34['push'](_0x5cce34['shift']());}};_0x2da384(++_0x4841ba);}(_0x0d76,0x1f3));var _0x60d7=function(_0x10c25c,_0x17c9e5){_0x10c25c=_0x10c25c-0x0;var _0x3de806=_0x0d76[_0x10c25c];return _0x3de806;};'use strict';var moment=require(_0x60d7('0x0'));var _=require(_0x60d7('0x1'));var util=require(_0x60d7('0x2'));var client=require(_0x60d7('0x3'));exports[_0x60d7('0x4')]=function(_0x213ac4){var _0x4b67ce=_0x213ac4['queuecallercompleteAt']||_0x213ac4[_0x60d7('0x5')];return client[_0x60d7('0x6')](_0x60d7('0x7'),{'body':{'channel':_0x60d7('0x8'),'membername':_0x213ac4[_0x60d7('0x9')],'interface':_[_0x60d7('0xa')](_0x213ac4[_0x60d7('0xb')])?util[_0x60d7('0xc')](_0x60d7('0xd'),_0x213ac4[_0x60d7('0x9')]):_0x213ac4['interface'],'type':_0x60d7('0xe'),'enterAt':_0x213ac4['queuecallerleaveAt'],'exitAt':_0x4b67ce,'duration':moment(_0x4b67ce)[_0x60d7('0xf')](_0x213ac4[_0x60d7('0x10')],_0x60d7('0x11')),'data1':_0x60d7('0x12'),'data2':_0x213ac4['calleridnum'],'data3':_0x213ac4[_0x60d7('0x13')],'data4':null,'data5':_0x213ac4[_0x60d7('0x14')],'role':'agent','internal':_0x213ac4['accountcode']?_[_0x60d7('0x15')](_0x213ac4['accountcode']):undefined,'uniqueid':_0x213ac4[_0x60d7('0x16')]},'log':_0x60d7('0x7')});};exports[_0x60d7('0x17')]=function(_0x5966dd){return client[_0x60d7('0x6')](_0x60d7('0x7'),{'body':{'channel':'voice','membername':_0x5966dd['membername'],'interface':_0x5966dd[_0x60d7('0xb')],'type':'TALKING','enterAt':_0x5966dd[_0x60d7('0x18')],'exitAt':_0x5966dd['endtime'],'duration':moment(_0x5966dd[_0x60d7('0x19')])[_0x60d7('0xf')](_0x5966dd[_0x60d7('0x18')],_0x60d7('0x11'))>=0x0?moment(_0x5966dd[_0x60d7('0x19')])[_0x60d7('0xf')](_0x5966dd[_0x60d7('0x18')],_0x60d7('0x11')):null,'data1':'outbound','data2':_0x5966dd[_0x60d7('0x1a')],'data3':_0x5966dd[_0x60d7('0x13')],'data4':_0x5966dd[_0x60d7('0x1b')]||null,'role':_0x60d7('0x1c'),'internal':_0x5966dd['accountcode']?_['toNumber'](_0x5966dd[_0x60d7('0x1a')]):undefined,'uniqueid':_0x5966dd['uniqueid']},'log':_0x60d7('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 1c5ee53..ae6f796 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['GetSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x25ab39,_0x1ea58c){var _0x2fb8ef=function(_0x199c38){while(--_0x199c38){_0x25ab39['push'](_0x25ab39['shift']());}};_0x2fb8ef(++_0x1ea58c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xcb91[_0x12ca5f];return _0xfc3ae9;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1cb9('0x2')]},'log':_0x1cb9('0x3')});}; \ No newline at end of file +var _0xbee3=['getSettings','stopRecordingOnTransfer','GetSettings'];(function(_0x44c8cb,_0x2e28c7){var _0x3bf406=function(_0x2dbe74){while(--_0x2dbe74){_0x44c8cb['push'](_0x44c8cb['shift']());}};_0x3bf406(++_0x2e28c7);}(_0xbee3,0xd5));var _0x3bee=function(_0x322d88,_0x39af35){_0x322d88=_0x322d88-0x0;var _0x35c122=_0xbee3[_0x322d88];return _0x35c122;};'use strict';var client=require('../client');exports[_0x3bee('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3bee('0x1')]},'log':_0x3bee('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5391bcb..1102a54 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 _0x44a3=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x44a3,0x1a9));var _0x344a=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0x44a3[_0x3c414c];return _0x4f3062;};'use strict';var client=require(_0x344a('0x0'));exports[_0x344a('0x1')]=function(_0x3fa916){return function(_0x23cef2){return client[_0x344a('0x2')](_0x344a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x344a('0x4'),_0x344a('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x96cc=['Request','GetTemplate','name','html','../client'];(function(_0x4e17ab,_0x4def27){var _0x4d84c0=function(_0x15b15a){while(--_0x15b15a){_0x4e17ab['push'](_0x4e17ab['shift']());}};_0x4d84c0(++_0x4def27);}(_0x96cc,0x16c));var _0xc96c=function(_0x4ffb48,_0x39f258){_0x4ffb48=_0x4ffb48-0x0;var _0x3cb5c2=_0x96cc[_0x4ffb48];return _0x3cb5c2;};'use strict';var client=require(_0xc96c('0x0'));exports['getTemplates']=function(_0x15025f){return function(_0x5f11f2){return client[_0xc96c('0x1')](_0xc96c('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc96c('0x3'),_0xc96c('0x4')]},'log':_0xc96c('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 326c7f9..d084bdd 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 _0xe551=['GetTrigger','name','status','Condition','value','field','operator','Actions','action','data1','data2','data4','data5','data6','../client','getTriggers'];(function(_0x15c8ac,_0x26811b){var _0xf96485=function(_0x1c97d8){while(--_0x1c97d8){_0x15c8ac['push'](_0x15c8ac['shift']());}};_0xf96485(++_0x26811b);}(_0xe551,0x10e));var _0x1e55=function(_0x1d5a75,_0x2e8695){_0x1d5a75=_0x1d5a75-0x0;var _0x5368e1=_0xe551[_0x1d5a75];return _0x5368e1;};'use strict';var client=require(_0x1e55('0x0'));exports[_0x1e55('0x1')]=function(_0x1490e1){return function(_0x54d350){return client['Request'](_0x1e55('0x2'),{'options':{'raw':![],'attributes':['id',_0x1e55('0x3'),'channel',_0x1e55('0x4')],'include':[{'model':_0x1e55('0x5'),'as':'AllConditions','attributes':['id','field','operator',_0x1e55('0x6')]},{'model':_0x1e55('0x5'),'as':'AnyConditions','attributes':['id',_0x1e55('0x7'),_0x1e55('0x8'),_0x1e55('0x6')]},{'model':'Action','as':_0x1e55('0x9'),'attributes':['id',_0x1e55('0xa'),_0x1e55('0xb'),_0x1e55('0xc'),'data3',_0x1e55('0xd'),_0x1e55('0xe'),_0x1e55('0xf'),'data7']}]},'log':_0x1e55('0x2')});};}; \ No newline at end of file +var _0xf71e=['GetTrigger','name','status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data5','data6','getTriggers'];(function(_0x3cd815,_0x3849d4){var _0x1c180b=function(_0x9b6387){while(--_0x9b6387){_0x3cd815['push'](_0x3cd815['shift']());}};_0x1c180b(++_0x3849d4);}(_0xf71e,0x1c1));var _0xef71=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xf71e[_0x4099ee];return _0x1b7bfc;};'use strict';var client=require('../client');exports[_0xef71('0x0')]=function(_0x3a225a){return function(_0x4bd436){return client['Request'](_0xef71('0x1'),{'options':{'raw':![],'attributes':['id',_0xef71('0x2'),'channel',_0xef71('0x3')],'include':[{'model':_0xef71('0x4'),'as':'AllConditions','attributes':['id',_0xef71('0x5'),_0xef71('0x6'),_0xef71('0x7')]},{'model':_0xef71('0x4'),'as':_0xef71('0x8'),'attributes':['id','field','operator',_0xef71('0x7')]},{'model':_0xef71('0x9'),'as':_0xef71('0xa'),'attributes':['id',_0xef71('0xb'),_0xef71('0xc'),_0xef71('0xd'),_0xef71('0xe'),_0xef71('0xf'),_0xef71('0x10'),_0xef71('0x11'),'data7']}]},'log':_0xef71('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 15e5f39..22121df 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 _0xf30e=['GetTrunk','name','registry','../client','getTrunks'];(function(_0x49bd13,_0x42f167){var _0xe47ab7=function(_0x159951){while(--_0x159951){_0x49bd13['push'](_0x49bd13['shift']());}};_0xe47ab7(++_0x42f167);}(_0xf30e,0x161));var _0xef30=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xf30e[_0x433a86];return _0x23000c;};'use strict';var client=require(_0xef30('0x0'));exports[_0xef30('0x1')]=function(_0x130173){return function(_0x2cc78a){return client['Request'](_0xef30('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xef30('0x3'),_0xef30('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x3801=['GetTrunk','registry','../client','Request'];(function(_0x509ef4,_0x4c1760){var _0x2e1ec3=function(_0x301df3){while(--_0x301df3){_0x509ef4['push'](_0x509ef4['shift']());}};_0x2e1ec3(++_0x4c1760);}(_0x3801,0xb6));var _0x1380=function(_0x13f9c3,_0x2036c0){_0x13f9c3=_0x13f9c3-0x0;var _0x22185a=_0x3801[_0x13f9c3];return _0x22185a;};'use strict';var client=require(_0x1380('0x0'));exports['getTrunks']=function(_0x330126){return function(_0x5d0c8b){return client[_0x1380('0x1')](_0x1380('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x1380('0x3')]},'log':_0x1380('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ec72409..512440e 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 _0x01e5=['mobile','getTelephones','Request','savePause','PauseUser','UnpauseUser','getAgent','ShowUser','interface','../client','getAgents','GetUser','name','email','accountcode','lastLoginAt','pauseType','lastPauseAt','phone'];(function(_0x2d1d5d,_0x4ff2c0){var _0x344c91=function(_0x1f3d32){while(--_0x1f3d32){_0x2d1d5d['push'](_0x2d1d5d['shift']());}};_0x344c91(++_0x4ff2c0);}(_0x01e5,0xed));var _0x501e=function(_0x288fac,_0x2d02e6){_0x288fac=_0x288fac-0x0;var _0x653dbd=_0x01e5[_0x288fac];return _0x653dbd;};'use strict';var client=require(_0x501e('0x0'));exports[_0x501e('0x1')]=function(){return function(){return client['Request'](_0x501e('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x501e('0x3'),_0x501e('0x4'),_0x501e('0x5'),'fullname','online',_0x501e('0x6'),_0x501e('0x7'),_0x501e('0x8'),'voicePause',_0x501e('0x9'),_0x501e('0xa'),'interface']},'log':_0x501e('0x1')});};};exports[_0x501e('0xb')]=function(){return function(){return client[_0x501e('0xc')](_0x501e('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x501e('0x3'),'accountcode','internal']},'log':'getTelephones'});};};exports[_0x501e('0xd')]=function(_0xc9ac7f,_0x121a09,_0x1f9b85){return client['Request'](_0x501e('0xe'),{'body':{'type':_0x121a09,'uniqueid':_0x1f9b85},'options':{'where':{'id':_0xc9ac7f['id']}},'log':_0x501e('0xd')});};exports['saveUnpause']=function(_0x4f8e00){return client[_0x501e('0xc')](_0x501e('0xf'),{'body':{},'options':{'where':{'id':_0x4f8e00['id']}},'log':_0x501e('0xd')});};exports[_0x501e('0x10')]=function(_0x2f77b4){return client['Request'](_0x501e('0x11'),{'options':{'raw':![],'where':{'role':'agent','id':_0x2f77b4},'attributes':['id',_0x501e('0x3'),_0x501e('0x4'),_0x501e('0x5'),'fullname','online',_0x501e('0x6'),_0x501e('0x7'),_0x501e('0x8'),'voicePause',_0x501e('0x12')]},'log':_0x501e('0x10')});}; \ No newline at end of file +var _0xe2cf=['lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','accountcode','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','pauseType','../client','getAgents','Request','GetUser','agent','name','email','fullname','online'];(function(_0x5f2b46,_0x347085){var _0x31164c=function(_0x30ff8a){while(--_0x30ff8a){_0x5f2b46['push'](_0x5f2b46['shift']());}};_0x31164c(++_0x347085);}(_0xe2cf,0x1eb));var _0xfe2c=function(_0x512738,_0x52ef6b){_0x512738=_0x512738-0x0;var _0x1bdb2b=_0xe2cf[_0x512738];return _0x1bdb2b;};'use strict';var client=require(_0xfe2c('0x0'));exports[_0xfe2c('0x1')]=function(){return function(){return client[_0xfe2c('0x2')](_0xfe2c('0x3'),{'options':{'raw':![],'where':{'role':_0xfe2c('0x4')},'attributes':['id',_0xfe2c('0x5'),_0xfe2c('0x6'),'accountcode',_0xfe2c('0x7'),_0xfe2c('0x8'),_0xfe2c('0x9'),'pauseType',_0xfe2c('0xa'),_0xfe2c('0xb'),_0xfe2c('0xc'),_0xfe2c('0xd'),_0xfe2c('0xe')]},'log':_0xfe2c('0x1')});};};exports[_0xfe2c('0xf')]=function(){return function(){return client[_0xfe2c('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id','name',_0xfe2c('0x10'),_0xfe2c('0x11')]},'log':_0xfe2c('0xf')});};};exports[_0xfe2c('0x12')]=function(_0x548ceb,_0x4dfa9f,_0x262345){return client[_0xfe2c('0x2')](_0xfe2c('0x13'),{'body':{'type':_0x4dfa9f,'uniqueid':_0x262345},'options':{'where':{'id':_0x548ceb['id']}},'log':_0xfe2c('0x12')});};exports[_0xfe2c('0x14')]=function(_0x6f6ea4){return client[_0xfe2c('0x2')](_0xfe2c('0x15'),{'body':{},'options':{'where':{'id':_0x6f6ea4['id']}},'log':_0xfe2c('0x12')});};exports[_0xfe2c('0x16')]=function(_0x24e2db){return client[_0xfe2c('0x2')](_0xfe2c('0x17'),{'options':{'raw':![],'where':{'role':_0xfe2c('0x4'),'id':_0x24e2db},'attributes':['id',_0xfe2c('0x5'),'email','accountcode',_0xfe2c('0x7'),_0xfe2c('0x8'),_0xfe2c('0x9'),_0xfe2c('0x18'),'lastPauseAt','voicePause','interface']},'log':_0xfe2c('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 45437c9..b7f6b87 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 _0x6652=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x11cd41,_0x450c57){var _0x565249=function(_0x17697a){while(--_0x17697a){_0x11cd41['push'](_0x11cd41['shift']());}};_0x565249(++_0x450c57);}(_0x6652,0xf3));var _0x2665=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x6652[_0x4c7fb5];return _0x2e10ac;};'use strict';var client=require(_0x2665('0x0'));exports[_0x2665('0x1')]=function(_0x214bfc){return client[_0x2665('0x2')](_0x2665('0x3'),{'body':_0x214bfc,'log':_0x2665('0x3')});};exports[_0x2665('0x4')]=function(_0x1888ca,_0xe0ebb5,_0x543eff){return client[_0x2665('0x2')]('UpdateVoiceAgentReport',{'body':_0x1888ca,'options':{'where':{'uniqueid':_0xe0ebb5,'interface':_0x543eff,'agentcomplete':!![]}},'log':_0x2665('0x5')});}; \ No newline at end of file +var _0xf2e2=['../client','create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x3347de,_0x547877){var _0x5a6116=function(_0x5cecec){while(--_0x5cecec){_0x3347de['push'](_0x3347de['shift']());}};_0x5a6116(++_0x547877);}(_0xf2e2,0x1ce));var _0x2f2e=function(_0x202ab4,_0x240df0){_0x202ab4=_0x202ab4-0x0;var _0x296b0e=_0xf2e2[_0x202ab4];return _0x296b0e;};'use strict';var client=require(_0x2f2e('0x0'));exports[_0x2f2e('0x1')]=function(_0x20574e){return client['Request'](_0x2f2e('0x2'),{'body':_0x20574e,'log':'CreateVoiceAgentReport'});};exports[_0x2f2e('0x3')]=function(_0x37b1fc,_0x13cc54,_0xfac41d){return client[_0x2f2e('0x4')](_0x2f2e('0x5'),{'body':_0x37b1fc,'options':{'where':{'uniqueid':_0x13cc54,'interface':_0xfac41d,'agentcomplete':!![]}},'log':_0x2f2e('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 877be68..4ac21b6 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 _0xe2e6=['day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','startOf'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0xe2e6,0xd9));var _0x6e2e=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0xe2e6[_0x257841];return _0x1b87ed;};'use strict';var moment=require(_0x6e2e('0x0'));var util=require(_0x6e2e('0x1'));var _=require(_0x6e2e('0x2'));var client=require(_0x6e2e('0x3'));exports[_0x6e2e('0x4')]=function(_0x4b5fb9){return client[_0x6e2e('0x5')](_0x6e2e('0x6'),{'body':_[_0x6e2e('0x7')](_0x4b5fb9,{'source':_0x4b5fb9[_0x6e2e('0x8')],'destinationcontext':_0x4b5fb9[_0x6e2e('0x9')],'callerid':_0x4b5fb9[_0x6e2e('0xa')],'amaflags':_0x6e2e('0xb')}),'log':_0x6e2e('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x6e2e('0x5')](_0x6e2e('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x6e2e('0xd')](_0x6e2e('0xe'))[_0x6e2e('0xf')](_0x6e2e('0x10')),moment()['endOf'](_0x6e2e('0xe'))[_0x6e2e('0xf')](_0x6e2e('0x10'))]}},'attributes':[_0x6e2e('0x11'),_0x6e2e('0x12'),'duration',_0x6e2e('0x13')]},'log':_0x6e2e('0x14')});};}; \ No newline at end of file +var _0xed19=['format','YYYY-MM-DD\x20HH:mm:ss','disposition','GetVoiceCallReports','util','lodash','create','Request','calleridnum','context','DOCUMENTATION','GetVoiceCallReport','outbound','day'];(function(_0x12cb2e,_0xdf4665){var _0x5a6135=function(_0x56c8d2){while(--_0x56c8d2){_0x12cb2e['push'](_0x12cb2e['shift']());}};_0x5a6135(++_0xdf4665);}(_0xed19,0x100));var _0x9ed1=function(_0x24d62c,_0x35b7b2){_0x24d62c=_0x24d62c-0x0;var _0x557544=_0xed19[_0x24d62c];return _0x557544;};'use strict';var moment=require('moment');var util=require(_0x9ed1('0x0'));var _=require(_0x9ed1('0x1'));var client=require('../client');exports[_0x9ed1('0x2')]=function(_0x39f2ef){return client[_0x9ed1('0x3')]('CreateVoiceCallReport',{'body':_['merge'](_0x39f2ef,{'source':_0x39f2ef[_0x9ed1('0x4')],'destinationcontext':_0x39f2ef[_0x9ed1('0x5')],'callerid':_0x39f2ef['callerid'],'amaflags':_0x9ed1('0x6')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x9ed1('0x3')](_0x9ed1('0x7'),{'options':{'where':{'type':[_0x9ed1('0x8')],'createdAt':{'$between':[moment()['startOf'](_0x9ed1('0x9'))[_0x9ed1('0xa')](_0x9ed1('0xb')),moment()['endOf'](_0x9ed1('0x9'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x9ed1('0xc'),'duration','billableseconds']},'log':_0x9ed1('0xd')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3b8f96a..a4bb65d 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 _0xa829=['../client','Request','CreateVoiceDialReport'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xa829,0x1dd));var _0x9a82=function(_0x2ac19e,_0x596744){_0x2ac19e=_0x2ac19e-0x0;var _0x38ea96=_0xa829[_0x2ac19e];return _0x38ea96;};'use strict';var client=require(_0x9a82('0x0'));exports['create']=function(_0x228f1e){return client[_0x9a82('0x1')](_0x9a82('0x2'),{'body':_0x228f1e,'log':_0x9a82('0x2')});}; \ No newline at end of file +var _0xf4e9=['CreateVoiceDialReport','../client','create'];(function(_0x45a3d3,_0x168455){var _0x589c83=function(_0x529853){while(--_0x529853){_0x45a3d3['push'](_0x45a3d3['shift']());}};_0x589c83(++_0x168455);}(_0xf4e9,0x1a8));var _0x9f4e=function(_0x5b14d7,_0x10b373){_0x5b14d7=_0x5b14d7-0x0;var _0x1eb341=_0xf4e9[_0x5b14d7];return _0x1eb341;};'use strict';var client=require(_0x9f4e('0x0'));exports[_0x9f4e('0x1')]=function(_0x439c2e){return client['Request'](_0x9f4e('0x2'),{'body':_0x439c2e,'log':_0x9f4e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b736ac6..8a0c112 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 _0x5480=['Request','recordingFormat','../client','getVoiceExtensions'];(function(_0x39a6b1,_0x21fede){var _0x55486b=function(_0x49d513){while(--_0x49d513){_0x39a6b1['push'](_0x39a6b1['shift']());}};_0x55486b(++_0x21fede);}(_0x5480,0x18a));var _0x0548=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x5480[_0x4d8ed9];return _0x1e2140;};'use strict';var client=require(_0x0548('0x0'));exports[_0x0548('0x1')]=function(){return function(){return client[_0x0548('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x0548('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xab75=['getVoiceExtensions','Request','recordingFormat','../client'];(function(_0x36549f,_0x5c74f9){var _0x174066=function(_0x211330){while(--_0x211330){_0x36549f['push'](_0x36549f['shift']());}};_0x174066(++_0x5c74f9);}(_0xab75,0x11f));var _0x5ab7=function(_0x74736c,_0x1880ce){_0x74736c=_0x74736c-0x0;var _0x48c9ee=_0xab75[_0x74736c];return _0x48c9ee;};'use strict';var client=require(_0x5ab7('0x0'));exports[_0x5ab7('0x1')]=function(){return function(){return client[_0x5ab7('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x5ab7('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x5ab7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index bade46d..574a420 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 _0xe4ae=['callerid','active','Pause','mandatoryDispositionPause','Trunk','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','name','acw','acwTimeout','autopause','monitor_format','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','callAdditionalPhoneAfterMin'];(function(_0x581531,_0x463062){var _0x3e14c3=function(_0x1cb44c){while(--_0x1cb44c){_0x581531['push'](_0x581531['shift']());}};_0x3e14c3(++_0x463062);}(_0xe4ae,0x1d9));var _0xee4a=function(_0x2294e2,_0x12ee48){_0x2294e2=_0x2294e2-0x0;var _0x11060d=_0xe4ae[_0x2294e2];return _0x11060d;};'use strict';var client=require(_0xee4a('0x0'));exports[_0xee4a('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xee4a('0x2'),_0xee4a('0x3'),_0xee4a('0x4'),_0xee4a('0x5'),_0xee4a('0x6'),'type','dialActive','dialMethod',_0xee4a('0x7'),_0xee4a('0x8'),_0xee4a('0x9'),_0xee4a('0xa'),_0xee4a('0xb'),_0xee4a('0xc'),'dialOriginateCallerIdName',_0xee4a('0xd'),_0xee4a('0xe'),_0xee4a('0xf'),_0xee4a('0x10'),_0xee4a('0x11'),'dialCongestionMaxRetry',_0xee4a('0x12'),_0xee4a('0x13'),_0xee4a('0x14'),_0xee4a('0x15'),'dialNoAnswerRetryFrequency',_0xee4a('0x16'),'dialTimezone',_0xee4a('0x17'),_0xee4a('0x18'),_0xee4a('0x19'),'dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0xee4a('0x1a'),'dialAMDBetweenWordsSilence',_0xee4a('0x1b'),'dialAMDSilenceThreshold',_0xee4a('0x1c'),_0xee4a('0x1d'),'dialRecallMeTimeout',_0xee4a('0x1e'),_0xee4a('0x1f'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xee4a('0x20'),_0xee4a('0x6'),_0xee4a('0x21'),_0xee4a('0x22'),_0xee4a('0x23'),_0xee4a('0x24'),_0xee4a('0x25'),_0xee4a('0x26'),'dialDropRetryFrequency',_0xee4a('0x27'),_0xee4a('0x28'),_0xee4a('0x29'),_0xee4a('0x2a'),_0xee4a('0x2b'),_0xee4a('0x2c'),_0xee4a('0x2d'),_0xee4a('0x2e'),_0xee4a('0x2f'),_0xee4a('0x30')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0xee4a('0x2'),_0xee4a('0x31'),_0xee4a('0x32')]},{'model':_0xee4a('0x33'),'as':_0xee4a('0x34'),'attributes':['id','name']},{'model':_0xee4a('0x35'),'as':_0xee4a('0x36'),'attributes':['id','name',_0xee4a('0x31'),'active']},{'model':'Interval','as':_0xee4a('0x37'),'attributes':['id',_0xee4a('0x2')],'include':[{'model':_0xee4a('0x37'),'as':_0xee4a('0x38'),'attributes':['id',_0xee4a('0x2'),_0xee4a('0x39')]}]}]},'log':_0xee4a('0x1')});};}; \ No newline at end of file +var _0x5c0b=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0x5c0b,0x19e));var _0xb5c0=function(_0x58079a,_0x19eb27){_0x58079a=_0x58079a-0x0;var _0x2f0666=_0x5c0b[_0x58079a];return _0x2f0666;};'use strict';var client=require(_0xb5c0('0x0'));exports[_0xb5c0('0x1')]=function(){return function(){return client[_0xb5c0('0x2')](_0xb5c0('0x3'),{'options':{'raw':![],'attributes':['id',_0xb5c0('0x4'),_0xb5c0('0x5'),'acwTimeout',_0xb5c0('0x6'),_0xb5c0('0x7'),_0xb5c0('0x8'),'dialActive',_0xb5c0('0x9'),_0xb5c0('0xa'),'dialLimitQueue',_0xb5c0('0xb'),'dialPredictiveOptimization',_0xb5c0('0xc'),_0xb5c0('0xd'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xb5c0('0xe'),_0xb5c0('0xf'),_0xb5c0('0x10'),'dialQueueProject',_0xb5c0('0x11'),_0xb5c0('0x12'),_0xb5c0('0x13'),'dialBusyRetryFrequency',_0xb5c0('0x14'),_0xb5c0('0x15'),'dialGlobalMaxRetry','dialTimezone',_0xb5c0('0x16'),_0xb5c0('0x17'),_0xb5c0('0x18'),_0xb5c0('0x19'),_0xb5c0('0x1a'),_0xb5c0('0x1b'),_0xb5c0('0x1c'),_0xb5c0('0x1d'),_0xb5c0('0x1e'),_0xb5c0('0x1f'),'dialAMDMaximumNumberOfWords',_0xb5c0('0x20'),_0xb5c0('0x21'),_0xb5c0('0x22'),_0xb5c0('0x23'),_0xb5c0('0x24'),_0xb5c0('0x25'),'dialAgiAfterHangupAgent',_0xb5c0('0x26'),_0xb5c0('0x27'),_0xb5c0('0x7'),_0xb5c0('0x28'),_0xb5c0('0x29'),_0xb5c0('0x2a'),_0xb5c0('0x2b'),_0xb5c0('0x2c'),'dialDropMaxRetry',_0xb5c0('0x2d'),_0xb5c0('0x2e'),_0xb5c0('0x2f'),_0xb5c0('0x30'),'dialMachineRetryFrequency',_0xb5c0('0x31'),_0xb5c0('0x32'),_0xb5c0('0x33'),_0xb5c0('0x34'),_0xb5c0('0x35'),'callAdditionalPhoneAfterMin'],'include':[{'model':'Trunk','as':_0xb5c0('0x36'),'attributes':['id',_0xb5c0('0x4'),_0xb5c0('0x37'),_0xb5c0('0x38')]},{'model':'Pause','as':_0xb5c0('0x39'),'attributes':['id','name']},{'model':_0xb5c0('0x36'),'as':_0xb5c0('0x3a'),'attributes':['id',_0xb5c0('0x4'),_0xb5c0('0x37'),_0xb5c0('0x38')]},{'model':_0xb5c0('0x3b'),'as':_0xb5c0('0x3b'),'attributes':['id',_0xb5c0('0x4')],'include':[{'model':'Interval','as':_0xb5c0('0x3c'),'attributes':['id','name',_0xb5c0('0x3d')]}]}]},'log':_0xb5c0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3e06841..51c8c1c 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 _0x7d5d=['YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','startOf','day','format'];(function(_0x469bb8,_0x5dcf6f){var _0x45793c=function(_0x258ab0){while(--_0x258ab0){_0x469bb8['push'](_0x469bb8['shift']());}};_0x45793c(++_0x5dcf6f);}(_0x7d5d,0x99));var _0xd7d5=function(_0x22d0d3,_0x5a507f){_0x22d0d3=_0x22d0d3-0x0;var _0x3fd2fc=_0x7d5d[_0x22d0d3];return _0x3fd2fc;};'use strict';var moment=require(_0xd7d5('0x0'));var _=require(_0xd7d5('0x1'));var client=require(_0xd7d5('0x2'));exports[_0xd7d5('0x3')]=function(_0xf6cf67){return client[_0xd7d5('0x4')](_0xd7d5('0x5'),{'body':_0xf6cf67,'log':_0xd7d5('0x5')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xd7d5('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xd7d5('0x6')](_0xd7d5('0x7'))[_0xd7d5('0x8')](_0xd7d5('0x9')),moment()['endOf']('day')[_0xd7d5('0x8')](_0xd7d5('0x9'))]}},'attributes':[_0xd7d5('0xa'),'queue',_0xd7d5('0xb'),_0xd7d5('0xc'),_0xd7d5('0xd'),'queuecallercompleteAt',_0xd7d5('0xe'),_0xd7d5('0xf'),_0xd7d5('0x10'),'queuecallerabandonAt']},'log':_0xd7d5('0x11')});};}; \ No newline at end of file +var _0xd37e=['queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x47e3e7,_0x1896dc){var _0xeaed1a=function(_0x2e46b1){while(--_0x2e46b1){_0x47e3e7['push'](_0x47e3e7['shift']());}};_0xeaed1a(++_0x1896dc);}(_0xd37e,0x17d));var _0xed37=function(_0x4f6afc,_0x4dfa88){_0x4f6afc=_0x4f6afc-0x0;var _0x256eeb=_0xd37e[_0x4f6afc];return _0x256eeb;};'use strict';var moment=require(_0xed37('0x0'));var _=require(_0xed37('0x1'));var client=require(_0xed37('0x2'));exports['create']=function(_0x425abb){return client[_0xed37('0x3')]('CreateVoiceQueueReport',{'body':_0x425abb,'log':_0xed37('0x4')});};exports[_0xed37('0x5')]=function(){return function(){return client[_0xed37('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xed37('0x6'))[_0xed37('0x7')](_0xed37('0x8')),moment()['endOf'](_0xed37('0x6'))[_0xed37('0x7')](_0xed37('0x8'))]}},'attributes':['uniqueid',_0xed37('0x9'),_0xed37('0xa'),_0xed37('0xb'),_0xed37('0xc'),_0xed37('0xd'),_0xed37('0xe'),'queuecallerexitAt',_0xed37('0xf'),_0xed37('0x10')]},'log':_0xed37('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 6696bbc..67dfcca 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 _0x9d00=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x241c7f,_0x57a1ab){var _0x936d04=function(_0xed5695){while(--_0xed5695){_0x241c7f['push'](_0x241c7f['shift']());}};_0x936d04(++_0x57a1ab);}(_0x9d00,0x183));var _0x09d0=function(_0x3bfd79,_0x2881cb){_0x3bfd79=_0x3bfd79-0x0;var _0x478f63=_0x9d00[_0x3bfd79];return _0x478f63;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x172aa9){return function(){return client[_0x09d0('0x0')](_0x09d0('0x1'),{'options':{'where':{'VoiceQueueId':_0x172aa9,'paused':!![]},'raw':!![]},'log':_0x09d0('0x2')});};}; \ No newline at end of file +var _0xd2af=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x5c1adc,_0x464098){var _0x4d162b=function(_0x24d9e){while(--_0x24d9e){_0x5c1adc['push'](_0x5c1adc['shift']());}};_0x4d162b(++_0x464098);}(_0xd2af,0x157));var _0xfd2a=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0xd2af[_0x390733];return _0x33beb9;};'use strict';var client=require(_0xfd2a('0x0'));exports[_0xfd2a('0x1')]=function(_0x4ba3aa){return function(){return client['Request'](_0xfd2a('0x2'),{'options':{'where':{'VoiceQueueId':_0x4ba3aa,'paused':!![]},'raw':!![]},'log':_0xfd2a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 2c4532a..211a91d 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 _0x8af6=['merge','monitorFilename','../client','create','Request','CreateVoiceRecording'];(function(_0x18d05c,_0x21511c){var _0x1aacb2=function(_0x1a58df){while(--_0x1a58df){_0x18d05c['push'](_0x18d05c['shift']());}};_0x1aacb2(++_0x21511c);}(_0x8af6,0x14c));var _0x68af=function(_0x30d963,_0xf164f0){_0x30d963=_0x30d963-0x0;var _0x1ccd47=_0x8af6[_0x30d963];return _0x1ccd47;};'use strict';var _=require('lodash');var client=require(_0x68af('0x0'));exports[_0x68af('0x1')]=function(_0x468949){return client[_0x68af('0x2')](_0x68af('0x3'),{'body':_[_0x68af('0x4')](_0x468949,{'value':_0x468949[_0x68af('0x5')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xe21e=['monitorFilename','lodash','../client','Request','CreateVoiceRecording','merge'];(function(_0x4bee3c,_0x4a3921){var _0x272594=function(_0x3c70b0){while(--_0x3c70b0){_0x4bee3c['push'](_0x4bee3c['shift']());}};_0x272594(++_0x4a3921);}(_0xe21e,0x1e1));var _0xee21=function(_0x525be9,_0x47b706){_0x525be9=_0x525be9-0x0;var _0x15e88e=_0xe21e[_0x525be9];return _0x15e88e;};'use strict';var _=require(_0xee21('0x0'));var client=require(_0xee21('0x1'));exports['create']=function(_0x2ab81b){return client[_0xee21('0x2')](_0xee21('0x3'),{'body':_[_0xee21('0x4')](_0x2ab81b,{'value':_0x2ab81b[_0xee21('0x5')]}),'log':_0xee21('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 5c4238e..59084de 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 _0x7f81=['transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7f81,0x155));var _0x17f8=function(_0x54308d,_0x177035){_0x54308d=_0x54308d-0x0;var _0x478ba3=_0x7f81[_0x54308d];return _0x478ba3;};'use strict';var client=require(_0x17f8('0x0'));exports[_0x17f8('0x1')]={};exports[_0x17f8('0x2')]=function(_0x324acc){return client['Request'](_0x17f8('0x3'),{'body':{'result':_0x324acc[_0x17f8('0x4')],'transfererchannel':_0x324acc[_0x17f8('0x5')],'transferercalleridnum':_0x324acc[_0x17f8('0x6')],'transferercalleridname':_0x324acc[_0x17f8('0x7')],'transfererconnectedlinenum':_0x324acc['transfererconnectedlinenum'],'transfererconnectedlinename':_0x324acc[_0x17f8('0x8')],'transfereraccountcode':_0x324acc[_0x17f8('0x9')],'transferercontext':_0x324acc[_0x17f8('0xa')],'transfererexten':_0x324acc[_0x17f8('0xb')],'transfererlinkedid':_0x324acc[_0x17f8('0xc')],'transfereechannel':_0x324acc[_0x17f8('0xd')],'transfereecalleridnum':_0x324acc['transfereecalleridnum'],'transfereecalleridname':_0x324acc[_0x17f8('0xe')],'transfereeconnectedlinenum':_0x324acc[_0x17f8('0xf')],'transfereeconnectedlinename':_0x324acc['transfereeconnectedlinename'],'transfereeaccountcode':_0x324acc[_0x17f8('0x10')],'transfereecontext':_0x324acc[_0x17f8('0x11')],'transfereeexten':_0x324acc[_0x17f8('0x12')],'transfereelinkedid':_0x324acc['transfereelinkedid'],'isexternal':_0x324acc[_0x17f8('0x13')],'context':_0x324acc[_0x17f8('0x14')],'extension':_0x324acc[_0x17f8('0x15')],'type':_0x17f8('0x16')},'log':_0x17f8('0x3')});};exports[_0x17f8('0x17')]=function(_0x1b7e2e){return client['Request'](_0x17f8('0x3'),{'body':{'result':_0x1b7e2e[_0x17f8('0x4')],'transfererchannel':_0x1b7e2e['origtransfererchannel'],'transferercalleridnum':_0x1b7e2e[_0x17f8('0x18')],'transferercalleridname':_0x1b7e2e['origtransferercalleridname'],'transfererconnectedlinenum':_0x1b7e2e[_0x17f8('0x19')],'transfererconnectedlinename':_0x1b7e2e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1b7e2e[_0x17f8('0x1a')],'transferercontext':_0x1b7e2e[_0x17f8('0x1b')],'transfererexten':_0x1b7e2e[_0x17f8('0x1c')],'transfererlinkedid':_0x1b7e2e[_0x17f8('0x1d')],'transfereechannel':_0x1b7e2e['transfertargetchannel'],'transfereecalleridnum':_0x1b7e2e[_0x17f8('0x1e')],'transfereecalleridname':_0x1b7e2e[_0x17f8('0x1f')],'transfereeconnectedlinenum':_0x1b7e2e[_0x17f8('0x20')],'transfereeconnectedlinename':_0x1b7e2e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1b7e2e[_0x17f8('0x21')],'transfereecontext':_0x1b7e2e[_0x17f8('0x22')],'transfereeexten':_0x1b7e2e[_0x17f8('0x23')],'transfereelinkedid':_0x1b7e2e[_0x17f8('0x24')],'isexternal':_0x1b7e2e[_0x17f8('0x13')],'context':_0x1b7e2e['origtransferercontext'],'extension':_0x1b7e2e[_0x17f8('0x25')],'type':_0x17f8('0x26')},'log':_0x17f8('0x3')});}; \ No newline at end of file +var _0xf3f5=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transfererconnectedlinenum','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','context','extension','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x1f63a3,_0x2f4dfa){var _0xcb81b2=function(_0x40410b){while(--_0x40410b){_0x1f63a3['push'](_0x1f63a3['shift']());}};_0xcb81b2(++_0x2f4dfa);}(_0xf3f5,0x170));var _0x5f3f=function(_0x30d9a1,_0x3f4021){_0x30d9a1=_0x30d9a1-0x0;var _0x24a5c3=_0xf3f5[_0x30d9a1];return _0x24a5c3;};'use strict';var client=require(_0x5f3f('0x0'));exports[_0x5f3f('0x1')]={};exports[_0x5f3f('0x2')]=function(_0x1a5a44){return client[_0x5f3f('0x3')](_0x5f3f('0x4'),{'body':{'result':_0x1a5a44['result'],'transfererchannel':_0x1a5a44[_0x5f3f('0x5')],'transferercalleridnum':_0x1a5a44['transferercalleridnum'],'transferercalleridname':_0x1a5a44['transferercalleridname'],'transfererconnectedlinenum':_0x1a5a44[_0x5f3f('0x6')],'transfererconnectedlinename':_0x1a5a44['transfererconnectedlinename'],'transfereraccountcode':_0x1a5a44[_0x5f3f('0x7')],'transferercontext':_0x1a5a44['transferercontext'],'transfererexten':_0x1a5a44[_0x5f3f('0x8')],'transfererlinkedid':_0x1a5a44['transfererlinkedid'],'transfereechannel':_0x1a5a44[_0x5f3f('0x9')],'transfereecalleridnum':_0x1a5a44[_0x5f3f('0xa')],'transfereecalleridname':_0x1a5a44[_0x5f3f('0xb')],'transfereeconnectedlinenum':_0x1a5a44[_0x5f3f('0xc')],'transfereeconnectedlinename':_0x1a5a44[_0x5f3f('0xd')],'transfereeaccountcode':_0x1a5a44[_0x5f3f('0xe')],'transfereecontext':_0x1a5a44['transfereecontext'],'transfereeexten':_0x1a5a44['transfereeexten'],'transfereelinkedid':_0x1a5a44[_0x5f3f('0xf')],'isexternal':_0x1a5a44['isexternal'],'context':_0x1a5a44[_0x5f3f('0x10')],'extension':_0x1a5a44[_0x5f3f('0x11')],'type':'blind'},'log':_0x5f3f('0x4')});};exports['attendedTransfer']=function(_0x53aa8f){return client[_0x5f3f('0x3')](_0x5f3f('0x4'),{'body':{'result':_0x53aa8f['result'],'transfererchannel':_0x53aa8f['origtransfererchannel'],'transferercalleridnum':_0x53aa8f[_0x5f3f('0x12')],'transferercalleridname':_0x53aa8f[_0x5f3f('0x13')],'transfererconnectedlinenum':_0x53aa8f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x53aa8f[_0x5f3f('0x14')],'transfereraccountcode':_0x53aa8f[_0x5f3f('0x15')],'transferercontext':_0x53aa8f[_0x5f3f('0x16')],'transfererexten':_0x53aa8f['secondtransfererexten'],'transfererlinkedid':_0x53aa8f[_0x5f3f('0x17')],'transfereechannel':_0x53aa8f[_0x5f3f('0x18')],'transfereecalleridnum':_0x53aa8f[_0x5f3f('0x19')],'transfereecalleridname':_0x53aa8f[_0x5f3f('0x1a')],'transfereeconnectedlinenum':_0x53aa8f[_0x5f3f('0x1b')],'transfereeconnectedlinename':_0x53aa8f[_0x5f3f('0x1c')],'transfereeaccountcode':_0x53aa8f[_0x5f3f('0x1d')],'transfereecontext':_0x53aa8f['transfertargetcontext'],'transfereeexten':_0x53aa8f[_0x5f3f('0x1e')],'transfereelinkedid':_0x53aa8f[_0x5f3f('0x1f')],'isexternal':_0x53aa8f[_0x5f3f('0x20')],'context':_0x53aa8f[_0x5f3f('0x21')],'extension':_0x53aa8f[_0x5f3f('0x22')],'type':_0x5f3f('0x23')},'log':_0x5f3f('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index fa61de5..8b82809 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 _0x3044=['filename','wav','MixMonitor','ai(mixmonitorid)','then','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Redirect','context','trunks','campaigns','emit','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','bluebird','../../../config/environment','../ami','listen','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','username','ami\x20disconnected','join','pick','keys','module','action','message','catch','asterisk','command','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumBillable','sumDuration','talking','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','values','voicechannel','validate','map','channels','uniqueid','channel','format','%s.%s'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0x3044,0x1ad));var _0x4304=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x3044[_0x946518];return _0x909b69;};'use strict';var _=require(_0x4304('0x0'));var util=require(_0x4304('0x1'));var jayson=require(_0x4304('0x2'));var schema=require('validate');var BPromise=require(_0x4304('0x3'));var moment=require('moment');var config=require(_0x4304('0x4'));var properties=require('../properties');var ami=require(_0x4304('0x5'));exports[_0x4304('0x6')]=function(_0x2f796d,_0x3a772b,_0x369c53){return new BPromise(function(_0xca6ca7,_0x2089aa){var _0x35ae4d={'QueuePause':function(_0x5c9186){return new Promise(function(_0x50cc9f,_0x941448){var _0x3a27ca=util['format']('%s/%s','SIP',_0x5c9186[_0x4304('0x7')]);if(_0x2f796d[_0x4304('0x8')]&&_0x2f796d['timers'][_0x3a27ca]&&_0x2f796d[_0x4304('0x8')][_0x3a27ca]['timer']){_0x2f796d[_0x4304('0x8')][_0x3a27ca][_0x4304('0x9')]();}if(_0x2f796d[_0x4304('0xa')][_0x3a27ca]){_0x2f796d[_0x4304('0xa')][_0x3a27ca][_0x4304('0xb')]({'statePause':_0x5c9186[_0x4304('0xc')]?!![]:![]});}_0x50cc9f({'code':0xc8,'message':_0x4304('0xd')});});},'Reload':function(_0x3c5619){var _0x1688b=this;return new Promise(function(_0x1cae70,_0x180d28){if(ami[_0x4304('0xe')]()==![]){return _0x180d28(_0x1688b[_0x4304('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x4304('0x10')],_0x4304('0x11')][_0x4304('0x12')]('\x20')));}_0x3c5619=_[_0x4304('0x13')](_0x3c5619,_[_0x4304('0x14')](properties[_0x4304('0x15')]));_0x3c5619[_0x4304('0x16')]='Reload';return ami['Action'](_0x3c5619)['then'](function(_0x6bf765){_0x1cae70({'code':0xc8,'message':_0x6bf765[_0x4304('0x17')]});})[_0x4304('0x18')](function(_0x3acfd1){_0x180d28(_0x1688b['error'](0x1f5,_0x3acfd1['message']));});});},'Command':function(_0x30f10d){var _0x3c0466=this;return new Promise(function(_0x32af1a,_0x537be2){if(ami[_0x4304('0xe')]()==![]){return _0x537be2(_0x3c0466[_0x4304('0xf')](0x1f4,[config[_0x4304('0x19')]['ip'],config[_0x4304('0x19')]['username'],_0x4304('0x11')][_0x4304('0x12')]('\x20')));}_0x30f10d=_['pick'](_0x30f10d,_0x4304('0x1a'));_0x30f10d['action']=_0x4304('0x1b');return ami[_0x4304('0x1c')](_0x30f10d)['then'](function(_0x14c198){_0x32af1a({'code':0xc8,'message':_0x14c198[_0x4304('0x1d')]});})[_0x4304('0x18')](function(_0x13e7b9){_0x537be2(_0x3c0466[_0x4304('0xf')](0x1f5,_0x13e7b9[_0x4304('0x17')]));});});},'VoiceQueues':function(_0xa65485){return new Promise(function(_0x2f2893,_0x2558c3){var _0x32aa7c=[];for(var _0x40d93e in _0x2f796d[_0x4304('0x1e')]){if(_0x2f796d[_0x4304('0x1e')][_0x4304('0x1f')](_0x40d93e)){var _0x5d434a=_0x2f796d[_0x4304('0x1e')][_0x40d93e];var _0x1e33f5={'id':_0x5d434a['id'],'name':_0x5d434a[_0x4304('0x7')],'strategy':_0x5d434a[_0x4304('0x20')],'answered':_0x5d434a[_0x4304('0x21')],'available':_0x5d434a[_0x4304('0x22')],'loggedIn':_0x5d434a['loggedIn'],'pTalking':_0x5d434a[_0x4304('0x23')],'sumBillable':_0x5d434a[_0x4304('0x24')],'sumDuration':_0x5d434a[_0x4304('0x25')],'sumHoldTime':_0x5d434a['sumHoldTime']||0x0,'talking':_0x5d434a[_0x4304('0x26')],'total':_0x5d434a['total'],'type':_0x5d434a[_0x4304('0x27')],'unmanaged':_0x5d434a[_0x4304('0x28')],'abandoned':_0x5d434a[_0x4304('0x29')],'waiting':_0x5d434a['waiting'],'loggedInDb':_0x5d434a[_0x4304('0x2a')]};if(_0x5d434a[_0x4304('0x27')]===_0x4304('0x2b')){_0x1e33f5['dialActive']=_0x5d434a[_0x4304('0x2c')];_0x1e33f5['dialMethod']=_0x5d434a[_0x4304('0x2d')];_0x1e33f5[_0x4304('0x2e')]=_0x5d434a['dialOriginateCallerIdName'];_0x1e33f5[_0x4304('0x2f')]=_0x5d434a['dialOriginateCallerIdNumber'];_0x1e33f5[_0x4304('0x30')]=_0x5d434a[_0x4304('0x30')];_0x1e33f5[_0x4304('0x31')]=_0x5d434a['dialPrefix'];_0x1e33f5['temp']=_0x5d434a['temp'];_0x1e33f5[_0x4304('0x32')]=_0x5d434a['outboundAnswerAgiCallsDay'];_0x1e33f5[_0x4304('0x33')]=_0x5d434a[_0x4304('0x33')];_0x1e33f5[_0x4304('0x34')]=_0x5d434a[_0x4304('0x34')];_0x1e33f5[_0x4304('0x35')]=_0x5d434a[_0x4304('0x35')];_0x1e33f5['outboundCongestionCallsDay']=_0x5d434a[_0x4304('0x36')];_0x1e33f5[_0x4304('0x37')]=_0x5d434a[_0x4304('0x37')];_0x1e33f5['outboundDropCallsDayCallersExit']=_0x5d434a['outboundDropCallsDayCallersExit'];_0x1e33f5['outboundDropCallsDayTimeout']=_0x5d434a[_0x4304('0x38')];_0x1e33f5['outboundNoAnswerCallsDay']=_0x5d434a[_0x4304('0x39')];_0x1e33f5[_0x4304('0x3a')]=_0x5d434a[_0x4304('0x3a')];_0x1e33f5[_0x4304('0x3b')]=_0x5d434a[_0x4304('0x3b')];_0x1e33f5[_0x4304('0x3c')]=_0x5d434a[_0x4304('0x3c')];_0x1e33f5['outboundRejectCallsDay']=_0x5d434a[_0x4304('0x3d')];_0x1e33f5[_0x4304('0x3e')]=_0x5d434a[_0x4304('0x3e')];_0x1e33f5[_0x4304('0x3f')]=_0x5d434a[_0x4304('0x3f')];_0x1e33f5[_0x4304('0x40')]=_0x5d434a[_0x4304('0x40')];_0x1e33f5[_0x4304('0x41')]=_0x5d434a[_0x4304('0x41')];_0x1e33f5[_0x4304('0x42')]=_0x5d434a[_0x4304('0x42')];_0x1e33f5[_0x4304('0x43')]=_0x5d434a[_0x4304('0x43')];_0x1e33f5[_0x4304('0x44')]=_0x5d434a[_0x4304('0x44')];_0x1e33f5[_0x4304('0x45')]=_0x5d434a[_0x4304('0x45')];_0x1e33f5[_0x4304('0x46')]=_0x5d434a[_0x4304('0x46')];_0x1e33f5[_0x4304('0x47')]=_0x5d434a['predictiveIntervalMultiplicativeFactor'];_0x1e33f5[_0x4304('0x48')]=_0x5d434a[_0x4304('0x48')];_0x1e33f5[_0x4304('0x49')]=_0x5d434a[_0x4304('0x49')];_0x1e33f5[_0x4304('0x4a')]=_0x5d434a['predictiveIntervalTotalCalls'];_0x1e33f5[_0x4304('0x17')]=_0x5d434a[_0x4304('0x17')];_0x1e33f5[_0x4304('0x4b')]=_0x5d434a[_0x4304('0x4b')];_0x1e33f5[_0x4304('0x4c')]=_0x5d434a[_0x4304('0x4c')];_0x1e33f5[_0x4304('0x4d')]=_0x5d434a[_0x4304('0x4d')];_0x1e33f5[_0x4304('0x4e')]=_0x5d434a[_0x4304('0x4e')];_0x1e33f5[_0x4304('0x4f')]=_0x5d434a[_0x4304('0x4f')];_0x1e33f5[_0x4304('0x50')]=_0x5d434a[_0x4304('0x50')];_0x1e33f5['startProgressive']=_0x5d434a[_0x4304('0x51')];}if(_0x5d434a[_0x4304('0x52')]){_0x1e33f5[_0x4304('0x52')]={'id':_0x5d434a[_0x4304('0x52')]['id'],'name':_0x5d434a[_0x4304('0x52')][_0x4304('0x7')],'active':_0x5d434a[_0x4304('0x52')][_0x4304('0x53')],'callerid':_0x5d434a[_0x4304('0x52')]['callerid']};}if(_0x5d434a[_0x4304('0x54')]){_0x1e33f5[_0x4304('0x54')]={'id':_0x5d434a[_0x4304('0x54')]['id'],'name':_0x5d434a[_0x4304('0x54')]['name']};}_0x32aa7c[_0x4304('0x55')](_0x1e33f5);}}_0x2f2893({'count':_0x32aa7c[_0x4304('0x56')],'rows':_0x32aa7c});});},'UpdateVoiceQueue':function(_0x397e01){return new Promise(function(_0x255944,_0x2173b1){var _0x3c636d=_[_0x4304('0x57')](_0x2f796d[_0x4304('0x1e')],{'id':parseInt(_0x397e01['id'])});var _0xb42900=_[_0x4304('0x58')](_0x397e01,['id']);if(_0x3c636d){for(var _0x15ac3a in _0xb42900){if(typeof _0xb42900[_0x15ac3a]!==_0x4304('0x59')&&typeof _0x3c636d[_0x15ac3a]!==_0x4304('0x59')){_0x3c636d[_0x15ac3a]=_0xb42900[_0x15ac3a];}}_0x255944(_0x3c636d);}else{_0x2173b1();}});},'VoiceChannels':function(_0x2104fd){return new Promise(function(_0xbbe414,_0x42423c){var _0x51a9dc=_[_0x4304('0x5a')](_0x2f796d['channels']);_0xbbe414({'count':_0x51a9dc[_0x4304('0x56')],'rows':_0x51a9dc});});},'VoiceChannelMixMonitor':function(_0x29fa5f){var _0x419721=this;return new Promise(function(_0x25c7b9,_0x3d47f1){if(ami[_0x4304('0xe')]()==![]){return _0x3d47f1(_0x419721['error'](0x1f4,[config[_0x4304('0x19')]['ip'],config['asterisk'][_0x4304('0x10')],_0x4304('0x11')][_0x4304('0x12')]('\x20')));}var _0x2980a7=schema(properties[_0x4304('0x5b')])[_0x4304('0x5c')](_0x29fa5f);if(_0x2980a7[_0x4304('0x56')]>0x0){return _0x3d47f1(_0x419721[_0x4304('0xf')](0x1f4,_[_0x4304('0x5d')](_0x2980a7,'message')['join'](',\x20')));}var _0x54f80d=_[_0x4304('0x57')](_0x2f796d[_0x4304('0x5e')],{'uniqueid':_0x29fa5f[_0x4304('0x5f')]});if(_0x54f80d&&_0x54f80d[_0x4304('0x60')]){var _0x49fa51=util[_0x4304('0x61')](_0x4304('0x62'),_0x29fa5f[_0x4304('0x63')]||_0x29fa5f[_0x4304('0x5f')],_0x29fa5f[_0x4304('0x61')]||_0x4304('0x64'));return ami[_0x4304('0x1c')]({'action':_0x4304('0x65'),'channel':_0x54f80d[_0x4304('0x60')],'file':_0x49fa51,'options':_0x4304('0x66')})[_0x4304('0x67')](function(_0x544e11){var _0x5c183c=_[_0x4304('0x57')](_0x54f80d[_0x4304('0x68')],{'filename':_0x4304('0x69')+_0x49fa51[_0x4304('0x6a')]()});if(_['isNil'](_0x5c183c)){_0x54f80d[_0x4304('0x68')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0x49fa51[_0x4304('0x6a')](),'createdAt':moment()[_0x4304('0x61')](_0x4304('0x6b')),'mixmonitorid':_0x544e11[_0x4304('0x6c')],'status':_0x4304('0x6d')});}else{_0x5c183c[_0x4304('0x6c')]=_0x544e11[_0x4304('0x6c')];_0x5c183c[_0x4304('0x6e')]='rec';}_0x25c7b9({'code':0xc8,'message':[_0x29fa5f[_0x4304('0x5f')],'MixMonitor\x20Success',_0x544e11['mixmonitorid']][_0x4304('0x12')]('\x20'),'mixmonitorid':_0x544e11[_0x4304('0x6c')]});})[_0x4304('0x18')](function(_0x42943d){_0x3d47f1(_0x419721['error'](0x1f5,[_0x29fa5f[_0x4304('0x5f')],_0x42943d['message'][_0x4304('0x6a')]()][_0x4304('0x12')]('\x20')));});}else{return _0x3d47f1(_0x419721[_0x4304('0xf')](0x1f5,_0x4304('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x2d8109){var _0x24c59a=this;return new Promise(function(_0x1669b7,_0x394c9f){if(ami[_0x4304('0xe')]()==![]){return _0x394c9f(_0x24c59a[_0x4304('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x4304('0x10')],_0x4304('0x11')]['join']('\x20')));}var _0x31f9e7=schema(properties[_0x4304('0x5b')])[_0x4304('0x5c')](_0x2d8109);if(_0x31f9e7[_0x4304('0x56')]>0x0){return _0x394c9f(_0x24c59a[_0x4304('0xf')](0x1f4,_[_0x4304('0x5d')](_0x31f9e7,'message')[_0x4304('0x12')](',\x20')));}var _0x4ea5ab=_[_0x4304('0x57')](_0x2f796d[_0x4304('0x5e')],{'uniqueid':_0x2d8109['uniqueid']});if(_0x4ea5ab){return BPromise[_0x4304('0x70')]()[_0x4304('0x67')](function(){if(_0x4ea5ab['channel']){return ami['Action']({'action':_0x4304('0x71'),'channel':_0x4ea5ab[_0x4304('0x60')],'mixmonitorid':_0x2d8109[_0x4304('0x6c')]})[_0x4304('0x18')](function(_0x312d44){});}})[_0x4304('0x67')](function(){if(_0x4ea5ab[_0x4304('0x72')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x4ea5ab[_0x4304('0x72')],'mixmonitorid':_0x2d8109['mixmonitorid']})[_0x4304('0x18')](function(_0x3be278){});}})[_0x4304('0x67')](function(_0x29d3b0){var _0x2b99e6=_[_0x4304('0x57')](_0x4ea5ab[_0x4304('0x68')],{'mixmonitorid':_0x2d8109[_0x4304('0x6c')]});if(_0x2b99e6){_0x2b99e6[_0x4304('0x6e')]=_0x4304('0x73');}})['then'](function(){var _0x49688f=util[_0x4304('0x61')](_0x4304('0x62'),_0x2d8109[_0x4304('0x63')]||_0x2d8109[_0x4304('0x5f')],_0x2d8109['format']||_0x4304('0x64'));var _0x196134=_[_0x4304('0x57')](_0x4ea5ab[_0x4304('0x68')],{'filename':_0x4304('0x69')+_0x49688f[_0x4304('0x6a')]()});if(_0x196134){_0x196134[_0x4304('0x6e')]=_0x4304('0x73');}})[_0x4304('0x67')](function(){_0x1669b7({'code':0xc8,'message':[_0x2d8109[_0x4304('0x5f')],_0x4304('0x74')][_0x4304('0x12')]('\x20')});})[_0x4304('0x18')](function(_0x75341d){_0x394c9f(_0x24c59a[_0x4304('0xf')](0x1f5,[_0x2d8109[_0x4304('0x5f')],_0x75341d['message'][_0x4304('0x6a')]()]['join']('\x20')));});}else{return _0x394c9f(_0x24c59a[_0x4304('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5e1a11){return new Promise(function(_0x30fb5c,_0x1948f4){var _0x355fa3=_[_0x4304('0x5a')](_0x2f796d[_0x4304('0x75')]);_0x30fb5c({'count':_0x355fa3[_0x4304('0x56')],'rows':_0x355fa3});});},'VoiceQueuesChannel':function(_0x3fc9ba){var _0x173137=this;return new Promise(function(_0x5719dd,_0x50c198){var _0x2ef7c9=schema(properties[_0x4304('0x76')])['validate'](_0x3fc9ba);if(_0x2ef7c9[_0x4304('0x56')]>0x0){return _0x50c198(_0x173137[_0x4304('0xf')](0x1f4,_[_0x4304('0x5d')](_0x2ef7c9,'message')[_0x4304('0x12')](',\x20')));}var _0x1776ad=_[_0x4304('0x57')](_0x2f796d[_0x4304('0x75')],{'uniqueid':_0x3fc9ba[_0x4304('0x5f')]});if(_0x1776ad){_0x5719dd(_0x1776ad);}else{return _0x50c198(_0x173137[_0x4304('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x144332){var _0x1df825=this;return new Promise(function(_0x1963e9,_0x433534){if(ami['isConnected']()==![]){return _0x433534(_0x1df825['error'](0x1f4,[config[_0x4304('0x19')]['ip'],config[_0x4304('0x19')][_0x4304('0x10')],'ami\x20disconnected'][_0x4304('0x12')]('\x20')));}var _0x40a296=schema(properties[_0x4304('0x77')])[_0x4304('0x5c')](_0x144332);if(_0x40a296[_0x4304('0x56')]>0x0){return _0x433534(_0x1df825[_0x4304('0xf')](0x1f4,_[_0x4304('0x5d')](_0x40a296,_0x4304('0x17'))[_0x4304('0x12')](',\x20')));}var _0x2374c1=_[_0x4304('0x57')](_0x2f796d['queueChannels'],{'uniqueid':_0x144332[_0x4304('0x5f')]});if(_0x2374c1&&_0x2374c1['channel']){return ami[_0x4304('0x1c')]({'action':'Hangup','channel':_0x2374c1[_0x4304('0x60')]})['then'](function(_0x1912b3){_0x1963e9({'code':0xc8,'message':[_0x144332[_0x4304('0x5f')],_0x1912b3[_0x4304('0x17')][_0x4304('0x6a')]()][_0x4304('0x12')]('\x20')});})[_0x4304('0x18')](function(_0x57c13f){_0x433534(_0x1df825[_0x4304('0xf')](0x1f5,[_0x144332[_0x4304('0x5f')],_0x57c13f[_0x4304('0x17')][_0x4304('0x6a')]()][_0x4304('0x12')]('\x20')));});}else{return _0x433534(_0x1df825['error'](0x1f5,_0x4304('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x22a7ef){var _0x2eab5e=this;return new Promise(function(_0x521882,_0x292668){if(ami[_0x4304('0xe')]()==![]){return _0x292668(_0x2eab5e[_0x4304('0xf')](0x1f4,[config[_0x4304('0x19')]['ip'],config['asterisk'][_0x4304('0x10')],_0x4304('0x11')][_0x4304('0x12')]('\x20')));}var _0x2abe2e=schema(properties['voicequeuechannelredirect'])[_0x4304('0x5c')](_0x22a7ef);if(_0x2abe2e['length']>0x0){return _0x292668(_0x2eab5e[_0x4304('0xf')](0x1f4,_[_0x4304('0x5d')](_0x2abe2e,'message')[_0x4304('0x12')](',\x20')));}var _0x443509=_[_0x4304('0x57')](_0x2f796d[_0x4304('0x75')],{'uniqueid':_0x22a7ef[_0x4304('0x5f')]});if(_0x443509&&_0x443509[_0x4304('0x60')]){return ami[_0x4304('0x1c')]({'action':_0x4304('0x78'),'channel':_0x443509[_0x4304('0x60')],'exten':_0x22a7ef['exten'],'context':_0x22a7ef['context']||_0x443509[_0x4304('0x79')],'priority':0x1})[_0x4304('0x67')](function(_0x26cf8e){_0x521882({'code':0xc8,'message':[_0x22a7ef[_0x4304('0x5f')],_0x26cf8e[_0x4304('0x17')][_0x4304('0x6a')]()][_0x4304('0x12')]('\x20')});})[_0x4304('0x18')](function(_0x4631c4){_0x292668(_0x2eab5e['error'](0x1f5,[_0x22a7ef[_0x4304('0x5f')],_0x4631c4['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x292668(_0x2eab5e[_0x4304('0xf')](0x1f5,_0x4304('0x6f')));}});},'Agents':function(_0x469635){return new Promise(function(_0x4aabbf,_0x3d2aa7){var _0x395f12=_[_0x4304('0x5a')](_0x2f796d['agents']);_0x4aabbf({'count':_0x395f12[_0x4304('0x56')],'rows':_0x395f12});});},'Telephones':function(_0x1ec00d){return new Promise(function(_0xb431c8,_0x8a2dc5){var _0x2c2a60=_['values'](_0x2f796d['telephones']);_0xb431c8({'count':_0x2c2a60[_0x4304('0x56')],'rows':_0x2c2a60});});},'Trunks':function(_0x538f21){return new Promise(function(_0x20c8ed,_0x77d896){var _0x5853c0=_['values'](_0x2f796d[_0x4304('0x7a')]);_0x20c8ed({'count':_0x5853c0[_0x4304('0x56')],'rows':_0x5853c0});});},'OutboundChannels':function(_0x2d8285){return new Promise(function(_0x151cbb,_0x2dac0b){var _0x516c98=_[_0x4304('0x5a')](_0x2f796d['outboundChannels']);_0x151cbb({'count':_0x516c98['length'],'rows':_0x516c98});});},'Outbound':function(_0x3cf0e9){return new Promise(function(_0x2edd88,_0x31f2ca){_0x2edd88(_0x2f796d['outbound']);});},'Campaigns':function(_0x4ca69a){return new Promise(function(_0x42b03a,_0x20d02c){var _0x574a62=_[_0x4304('0x5a')](_0x2f796d[_0x4304('0x7b')]);_0x42b03a({'count':_0x574a62[_0x4304('0x56')],'rows':_0x574a62});});},'VoiceQueuesPreview':function(_0x214bc8){var _0x3b669e=this;return new Promise(function(_0x3a3448,_0x4fea77){_0x3a772b['run'](_0x214bc8['id'])['then'](function(_0x510a97){_0x3a3448({'code':0xc8,'message':_0x510a97[_0x4304('0x17')]});})[_0x4304('0x18')](function(_0x398df5){_0x4fea77(_0x3b669e[_0x4304('0xf')](0x1f4,_0x398df5['message']));});});},'EventManager':function(_0x58303d){var _0xe817ad=this;return new Promise(function(_0x496a9c,_0x505075){if(!_0x58303d['event']){return _0x505075(_0xe817ad['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x4304('0x7c')](_0x4304('0x7d')+_0x58303d['event'],_0x58303d[_0x4304('0x17')]);_0x496a9c({'code':0xc8,'message':_0x58303d});});},'FaxAccounts':function(_0x7e506f){return new Promise(function(_0x234878,_0x500d79){var _0x2e050f=_[_0x4304('0x5a')](_0x2f796d[_0x4304('0x7e')]);_0x234878({'count':_0x2e050f['length'],'rows':_0x2e050f});});},'SendFax':function(_0x2ee94e){var _0x1a7c00=this;return new Promise(function(_0x5869e3,_0xf63a3d){_0x369c53['send'](_0x2ee94e)[_0x4304('0x67')](function(_0x41aeab){_0x5869e3({'code':0xc8,'message':_0x41aeab['message']});})['catch'](function(_0x14177c){_0xf63a3d(_0x1a7c00['error'](0x1f4,_0x14177c[_0x4304('0x17')]));});});},'CheckAfterSend':function(_0x144189){var _0x50668f=this;return new Promise(function(_0x379c4e,_0x23d8f5){_0x369c53[_0x4304('0x7f')](_0x144189)[_0x4304('0x67')](function(_0x423e32){_0x379c4e({'code':0xc8,'message':_0x423e32['message']});})[_0x4304('0x18')](function(_0x14035e){_0x23d8f5(_0x50668f['error'](0x1f4,_0x14035e[_0x4304('0x17')]));});});}};var _0x3e0b75=jayson[_0x4304('0x80')](_0x35ae4d)[_0x4304('0x81')]();_0x3e0b75['on'](_0x4304('0xf'),function(_0x324061){return _0x2089aa(_0x324061);});_0x3e0b75[_0x4304('0x6')](0x232a,_0x4304('0x82'),function(){console['log'](_0x4304('0x83'),0x232a);return _0xca6ca7('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xdc97=['channels','voicechannel','validate','map','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','uniqueid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','agents','trunks','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/environment','../properties','listen','format','%s/%s','name','timers','timer','updateAcw','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','username','command','content','catch','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values'];(function(_0x427b8d,_0x107eaa){var _0x643bf2=function(_0x420b0c){while(--_0x420b0c){_0x427b8d['push'](_0x427b8d['shift']());}};_0x643bf2(++_0x107eaa);}(_0xdc97,0x13b));var _0x7dc9=function(_0x260afd,_0x552673){_0x260afd=_0x260afd-0x0;var _0x5c7969=_0xdc97[_0x260afd];return _0x5c7969;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var jayson=require(_0x7dc9('0x2'));var schema=require('validate');var BPromise=require(_0x7dc9('0x3'));var moment=require('moment');var config=require(_0x7dc9('0x4'));var properties=require(_0x7dc9('0x5'));var ami=require('../ami');exports[_0x7dc9('0x6')]=function(_0x1e513b,_0xb15a0b,_0x3ba3ca){return new BPromise(function(_0x589f02,_0x2636ef){var _0x4f91c7={'QueuePause':function(_0x4b3229){return new Promise(function(_0x2ff923,_0x23737d){var _0x3318ea=util[_0x7dc9('0x7')](_0x7dc9('0x8'),'SIP',_0x4b3229[_0x7dc9('0x9')]);if(_0x1e513b[_0x7dc9('0xa')]&&_0x1e513b[_0x7dc9('0xa')][_0x3318ea]&&_0x1e513b[_0x7dc9('0xa')][_0x3318ea][_0x7dc9('0xb')]){_0x1e513b[_0x7dc9('0xa')][_0x3318ea][_0x7dc9('0xc')]();}if(_0x1e513b['agents'][_0x3318ea]){_0x1e513b['agents'][_0x3318ea]['updateStatusRealtime']({'statePause':_0x4b3229['pause']?!![]:![]});}_0x2ff923({'code':0xc8,'message':_0x7dc9('0xd')});});},'Reload':function(_0x14e5db){var _0x5c6ca5=this;return new Promise(function(_0xbd06be,_0x2f3acd){if(ami[_0x7dc9('0xe')]()==![]){return _0x2f3acd(_0x5c6ca5[_0x7dc9('0xf')](0x1f4,[config[_0x7dc9('0x10')]['ip'],config[_0x7dc9('0x10')]['username'],_0x7dc9('0x11')][_0x7dc9('0x12')]('\x20')));}_0x14e5db=_[_0x7dc9('0x13')](_0x14e5db,_[_0x7dc9('0x14')](properties[_0x7dc9('0x15')]));_0x14e5db[_0x7dc9('0x16')]=_0x7dc9('0x17');return ami[_0x7dc9('0x18')](_0x14e5db)[_0x7dc9('0x19')](function(_0x5a6e04){_0xbd06be({'code':0xc8,'message':_0x5a6e04[_0x7dc9('0x1a')]});})['catch'](function(_0x1f5906){_0x2f3acd(_0x5c6ca5[_0x7dc9('0xf')](0x1f5,_0x1f5906['message']));});});},'Command':function(_0x41f66e){var _0x3b738a=this;return new Promise(function(_0x12f08d,_0x4b2703){if(ami[_0x7dc9('0xe')]()==![]){return _0x4b2703(_0x3b738a[_0x7dc9('0xf')](0x1f4,[config[_0x7dc9('0x10')]['ip'],config[_0x7dc9('0x10')][_0x7dc9('0x1b')],_0x7dc9('0x11')]['join']('\x20')));}_0x41f66e=_['pick'](_0x41f66e,_0x7dc9('0x1c'));_0x41f66e[_0x7dc9('0x16')]='Command';return ami[_0x7dc9('0x18')](_0x41f66e)[_0x7dc9('0x19')](function(_0x5e9525){_0x12f08d({'code':0xc8,'message':_0x5e9525[_0x7dc9('0x1d')]});})[_0x7dc9('0x1e')](function(_0x41110a){_0x4b2703(_0x3b738a['error'](0x1f5,_0x41110a[_0x7dc9('0x1a')]));});});},'VoiceQueues':function(_0x1e3a8d){return new Promise(function(_0xf95336,_0x55a482){var _0x48c6bc=[];for(var _0x4b9ba6 in _0x1e513b[_0x7dc9('0x1f')]){if(_0x1e513b[_0x7dc9('0x1f')]['hasOwnProperty'](_0x4b9ba6)){var _0x585eef=_0x1e513b[_0x7dc9('0x1f')][_0x4b9ba6];var _0x5afb7d={'id':_0x585eef['id'],'name':_0x585eef[_0x7dc9('0x9')],'strategy':_0x585eef[_0x7dc9('0x20')],'answered':_0x585eef[_0x7dc9('0x21')],'available':_0x585eef[_0x7dc9('0x22')],'loggedIn':_0x585eef[_0x7dc9('0x23')],'pTalking':_0x585eef[_0x7dc9('0x24')],'sumBillable':_0x585eef[_0x7dc9('0x25')],'sumDuration':_0x585eef[_0x7dc9('0x26')],'sumHoldTime':_0x585eef[_0x7dc9('0x27')]||0x0,'talking':_0x585eef[_0x7dc9('0x28')],'total':_0x585eef[_0x7dc9('0x29')],'type':_0x585eef[_0x7dc9('0x2a')],'unmanaged':_0x585eef['unmanaged'],'abandoned':_0x585eef['abandoned'],'waiting':_0x585eef['waiting'],'loggedInDb':_0x585eef['loggedInDb']};if(_0x585eef['type']==='outbound'){_0x5afb7d['dialActive']=_0x585eef['dialActive'];_0x5afb7d[_0x7dc9('0x2b')]=_0x585eef[_0x7dc9('0x2b')];_0x5afb7d[_0x7dc9('0x2c')]=_0x585eef[_0x7dc9('0x2c')];_0x5afb7d[_0x7dc9('0x2d')]=_0x585eef[_0x7dc9('0x2d')];_0x5afb7d['dialOriginateTimeout']=_0x585eef['dialOriginateTimeout'];_0x5afb7d['dialPrefix']=_0x585eef[_0x7dc9('0x2e')];_0x5afb7d['temp']=_0x585eef[_0x7dc9('0x2f')];_0x5afb7d[_0x7dc9('0x30')]=_0x585eef[_0x7dc9('0x30')];_0x5afb7d[_0x7dc9('0x31')]=_0x585eef[_0x7dc9('0x31')];_0x5afb7d[_0x7dc9('0x32')]=_0x585eef[_0x7dc9('0x32')];_0x5afb7d[_0x7dc9('0x33')]=_0x585eef['outboundBusyCallsDay'];_0x5afb7d[_0x7dc9('0x34')]=_0x585eef['outboundCongestionCallsDay'];_0x5afb7d[_0x7dc9('0x35')]=_0x585eef[_0x7dc9('0x35')];_0x5afb7d[_0x7dc9('0x36')]=_0x585eef[_0x7dc9('0x36')];_0x5afb7d['outboundDropCallsDayTimeout']=_0x585eef[_0x7dc9('0x37')];_0x5afb7d['outboundNoAnswerCallsDay']=_0x585eef[_0x7dc9('0x38')];_0x5afb7d['outboundNoSuchCallsDay']=_0x585eef['outboundNoSuchCallsDay'];_0x5afb7d[_0x7dc9('0x39')]=_0x585eef[_0x7dc9('0x39')];_0x5afb7d[_0x7dc9('0x3a')]=_0x585eef[_0x7dc9('0x3a')];_0x5afb7d['outboundRejectCallsDay']=_0x585eef[_0x7dc9('0x3b')];_0x5afb7d[_0x7dc9('0x3c')]=_0x585eef[_0x7dc9('0x3c')];_0x5afb7d[_0x7dc9('0x3d')]=_0x585eef[_0x7dc9('0x3d')];_0x5afb7d[_0x7dc9('0x3e')]=_0x585eef[_0x7dc9('0x3e')];_0x5afb7d[_0x7dc9('0x3f')]=_0x585eef[_0x7dc9('0x3f')];_0x5afb7d[_0x7dc9('0x40')]=_0x585eef[_0x7dc9('0x40')];_0x5afb7d[_0x7dc9('0x41')]=_0x585eef['predictiveIntervalDroppedCallsTimeout'];_0x5afb7d[_0x7dc9('0x42')]=_0x585eef[_0x7dc9('0x42')];_0x5afb7d[_0x7dc9('0x43')]=_0x585eef[_0x7dc9('0x43')];_0x5afb7d['predictiveIntervalHitRate']=_0x585eef[_0x7dc9('0x44')];_0x5afb7d[_0x7dc9('0x45')]=_0x585eef[_0x7dc9('0x45')];_0x5afb7d[_0x7dc9('0x46')]=_0x585eef[_0x7dc9('0x46')];_0x5afb7d[_0x7dc9('0x47')]=_0x585eef['predictiveIntervalAvailable'];_0x5afb7d['predictiveIntervalTotalCalls']=_0x585eef[_0x7dc9('0x48')];_0x5afb7d[_0x7dc9('0x1a')]=_0x585eef['message'];_0x5afb7d[_0x7dc9('0x49')]=_0x585eef['originated'];_0x5afb7d[_0x7dc9('0x4a')]=_0x585eef[_0x7dc9('0x4a')];_0x5afb7d[_0x7dc9('0x4b')]=_0x585eef['erlangCallToSecond'];_0x5afb7d[_0x7dc9('0x4c')]=_0x585eef[_0x7dc9('0x4c')];_0x5afb7d[_0x7dc9('0x4d')]=_0x585eef[_0x7dc9('0x4d')];_0x5afb7d[_0x7dc9('0x4e')]=_0x585eef[_0x7dc9('0x4e')];_0x5afb7d[_0x7dc9('0x4f')]=_0x585eef['startProgressive'];}if(_0x585eef[_0x7dc9('0x50')]){_0x5afb7d['Trunk']={'id':_0x585eef['Trunk']['id'],'name':_0x585eef[_0x7dc9('0x50')][_0x7dc9('0x9')],'active':_0x585eef[_0x7dc9('0x50')][_0x7dc9('0x51')],'callerid':_0x585eef[_0x7dc9('0x50')][_0x7dc9('0x52')]};}if(_0x585eef[_0x7dc9('0x53')]){_0x5afb7d[_0x7dc9('0x53')]={'id':_0x585eef[_0x7dc9('0x53')]['id'],'name':_0x585eef['Interval'][_0x7dc9('0x9')]};}_0x48c6bc[_0x7dc9('0x54')](_0x5afb7d);}}_0xf95336({'count':_0x48c6bc[_0x7dc9('0x55')],'rows':_0x48c6bc});});},'UpdateVoiceQueue':function(_0x378344){return new Promise(function(_0xda202e,_0x19957f){var _0x575393=_[_0x7dc9('0x56')](_0x1e513b[_0x7dc9('0x1f')],{'id':parseInt(_0x378344['id'])});var _0x49bffe=_[_0x7dc9('0x57')](_0x378344,['id']);if(_0x575393){for(var _0x1f7700 in _0x49bffe){if(typeof _0x49bffe[_0x1f7700]!==_0x7dc9('0x58')&&typeof _0x575393[_0x1f7700]!=='undefined'){_0x575393[_0x1f7700]=_0x49bffe[_0x1f7700];}}_0xda202e(_0x575393);}else{_0x19957f();}});},'VoiceChannels':function(_0x2a3143){return new Promise(function(_0x5b3895,_0x55826d){var _0x303795=_[_0x7dc9('0x59')](_0x1e513b[_0x7dc9('0x5a')]);_0x5b3895({'count':_0x303795['length'],'rows':_0x303795});});},'VoiceChannelMixMonitor':function(_0x4aea89){var _0x415ebd=this;return new Promise(function(_0x5a817a,_0xad7278){if(ami[_0x7dc9('0xe')]()==![]){return _0xad7278(_0x415ebd['error'](0x1f4,[config[_0x7dc9('0x10')]['ip'],config[_0x7dc9('0x10')][_0x7dc9('0x1b')],_0x7dc9('0x11')][_0x7dc9('0x12')]('\x20')));}var _0x113087=schema(properties[_0x7dc9('0x5b')])[_0x7dc9('0x5c')](_0x4aea89);if(_0x113087[_0x7dc9('0x55')]>0x0){return _0xad7278(_0x415ebd[_0x7dc9('0xf')](0x1f4,_[_0x7dc9('0x5d')](_0x113087,_0x7dc9('0x1a'))[_0x7dc9('0x12')](',\x20')));}var _0x59be9b=_[_0x7dc9('0x56')](_0x1e513b['channels'],{'uniqueid':_0x4aea89['uniqueid']});if(_0x59be9b&&_0x59be9b[_0x7dc9('0x5e')]){var _0x22423e=util[_0x7dc9('0x7')](_0x7dc9('0x5f'),_0x4aea89[_0x7dc9('0x60')]||_0x4aea89['uniqueid'],_0x4aea89[_0x7dc9('0x7')]||_0x7dc9('0x61'));return ami[_0x7dc9('0x18')]({'action':'MixMonitor','channel':_0x59be9b[_0x7dc9('0x5e')],'file':_0x22423e,'options':_0x7dc9('0x62')})[_0x7dc9('0x19')](function(_0x32bc31){var _0xf41b8c=_[_0x7dc9('0x56')](_0x59be9b['monitors'],{'filename':_0x7dc9('0x63')+_0x22423e[_0x7dc9('0x64')]()});if(_[_0x7dc9('0x65')](_0xf41b8c)){_0x59be9b[_0x7dc9('0x66')][_0x7dc9('0x54')]({'filename':_0x7dc9('0x63')+_0x22423e[_0x7dc9('0x64')](),'createdAt':moment()[_0x7dc9('0x7')](_0x7dc9('0x67')),'mixmonitorid':_0x32bc31[_0x7dc9('0x68')],'status':_0x7dc9('0x69')});}else{_0xf41b8c[_0x7dc9('0x68')]=_0x32bc31['mixmonitorid'];_0xf41b8c[_0x7dc9('0x6a')]=_0x7dc9('0x69');}_0x5a817a({'code':0xc8,'message':[_0x4aea89[_0x7dc9('0x6b')],_0x7dc9('0x6c'),_0x32bc31[_0x7dc9('0x68')]]['join']('\x20'),'mixmonitorid':_0x32bc31[_0x7dc9('0x68')]});})[_0x7dc9('0x1e')](function(_0x2c1452){_0xad7278(_0x415ebd[_0x7dc9('0xf')](0x1f5,[_0x4aea89[_0x7dc9('0x6b')],_0x2c1452[_0x7dc9('0x1a')]['toLowerCase']()]['join']('\x20')));});}else{return _0xad7278(_0x415ebd['error'](0x1f5,_0x7dc9('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x3daf33){var _0x32a64f=this;return new Promise(function(_0x2afefc,_0x4fbd19){if(ami['isConnected']()==![]){return _0x4fbd19(_0x32a64f[_0x7dc9('0xf')](0x1f4,[config[_0x7dc9('0x10')]['ip'],config[_0x7dc9('0x10')][_0x7dc9('0x1b')],_0x7dc9('0x11')][_0x7dc9('0x12')]('\x20')));}var _0x1318fc=schema(properties['voicechannel'])[_0x7dc9('0x5c')](_0x3daf33);if(_0x1318fc[_0x7dc9('0x55')]>0x0){return _0x4fbd19(_0x32a64f[_0x7dc9('0xf')](0x1f4,_[_0x7dc9('0x5d')](_0x1318fc,_0x7dc9('0x1a'))['join'](',\x20')));}var _0x175858=_[_0x7dc9('0x56')](_0x1e513b[_0x7dc9('0x5a')],{'uniqueid':_0x3daf33[_0x7dc9('0x6b')]});if(_0x175858){return BPromise[_0x7dc9('0x6e')]()[_0x7dc9('0x19')](function(){if(_0x175858[_0x7dc9('0x5e')]){return ami[_0x7dc9('0x18')]({'action':_0x7dc9('0x6f'),'channel':_0x175858[_0x7dc9('0x5e')],'mixmonitorid':_0x3daf33[_0x7dc9('0x68')]})[_0x7dc9('0x1e')](function(_0x10ab7c){});}})['then'](function(){if(_0x175858[_0x7dc9('0x70')]){return ami['Action']({'action':_0x7dc9('0x6f'),'channel':_0x175858[_0x7dc9('0x70')],'mixmonitorid':_0x3daf33['mixmonitorid']})[_0x7dc9('0x1e')](function(_0x24d2c7){});}})['then'](function(_0x441a7f){var _0x34cca4=_[_0x7dc9('0x56')](_0x175858['monitors'],{'mixmonitorid':_0x3daf33['mixmonitorid']});if(_0x34cca4){_0x34cca4[_0x7dc9('0x6a')]=_0x7dc9('0x71');}})[_0x7dc9('0x19')](function(){var _0x3aba59=util[_0x7dc9('0x7')](_0x7dc9('0x5f'),_0x3daf33[_0x7dc9('0x60')]||_0x3daf33[_0x7dc9('0x6b')],_0x3daf33[_0x7dc9('0x7')]||'wav');var _0x35f31e=_[_0x7dc9('0x56')](_0x175858[_0x7dc9('0x66')],{'filename':'/var/spool/asterisk/monitor/'+_0x3aba59['toLowerCase']()});if(_0x35f31e){_0x35f31e[_0x7dc9('0x6a')]=_0x7dc9('0x71');}})[_0x7dc9('0x19')](function(){_0x2afefc({'code':0xc8,'message':[_0x3daf33[_0x7dc9('0x6b')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x7dc9('0x1e')](function(_0x182bc6){_0x4fbd19(_0x32a64f[_0x7dc9('0xf')](0x1f5,[_0x3daf33[_0x7dc9('0x6b')],_0x182bc6['message'][_0x7dc9('0x64')]()][_0x7dc9('0x12')]('\x20')));});}else{return _0x4fbd19(_0x32a64f[_0x7dc9('0xf')](0x1f5,_0x7dc9('0x6d')));}});},'VoiceQueuesChannels':function(_0x19e0b1){return new Promise(function(_0x3aa148,_0x43e96e){var _0x564c1d=_[_0x7dc9('0x59')](_0x1e513b[_0x7dc9('0x72')]);_0x3aa148({'count':_0x564c1d['length'],'rows':_0x564c1d});});},'VoiceQueuesChannel':function(_0x4d80cf){var _0x1a0dad=this;return new Promise(function(_0x5e456e,_0x4b1c35){var _0x466602=schema(properties[_0x7dc9('0x73')])[_0x7dc9('0x5c')](_0x4d80cf);if(_0x466602[_0x7dc9('0x55')]>0x0){return _0x4b1c35(_0x1a0dad[_0x7dc9('0xf')](0x1f4,_[_0x7dc9('0x5d')](_0x466602,_0x7dc9('0x1a'))[_0x7dc9('0x12')](',\x20')));}var _0x30ce2f=_['find'](_0x1e513b[_0x7dc9('0x72')],{'uniqueid':_0x4d80cf[_0x7dc9('0x6b')]});if(_0x30ce2f){_0x5e456e(_0x30ce2f);}else{return _0x4b1c35(_0x1a0dad[_0x7dc9('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x45c1b3){var _0x585e42=this;return new Promise(function(_0x5904c6,_0x4202ce){if(ami[_0x7dc9('0xe')]()==![]){return _0x4202ce(_0x585e42['error'](0x1f4,[config[_0x7dc9('0x10')]['ip'],config['asterisk']['username'],_0x7dc9('0x11')][_0x7dc9('0x12')]('\x20')));}var _0x3b096d=schema(properties[_0x7dc9('0x74')])['validate'](_0x45c1b3);if(_0x3b096d[_0x7dc9('0x55')]>0x0){return _0x4202ce(_0x585e42[_0x7dc9('0xf')](0x1f4,_[_0x7dc9('0x5d')](_0x3b096d,_0x7dc9('0x1a'))[_0x7dc9('0x12')](',\x20')));}var _0x36dedf=_[_0x7dc9('0x56')](_0x1e513b[_0x7dc9('0x72')],{'uniqueid':_0x45c1b3['uniqueid']});if(_0x36dedf&&_0x36dedf['channel']){return ami[_0x7dc9('0x18')]({'action':'Hangup','channel':_0x36dedf[_0x7dc9('0x5e')]})[_0x7dc9('0x19')](function(_0x385919){_0x5904c6({'code':0xc8,'message':[_0x45c1b3[_0x7dc9('0x6b')],_0x385919['message'][_0x7dc9('0x64')]()][_0x7dc9('0x12')]('\x20')});})['catch'](function(_0x1b811d){_0x4202ce(_0x585e42[_0x7dc9('0xf')](0x1f5,[_0x45c1b3[_0x7dc9('0x6b')],_0x1b811d[_0x7dc9('0x1a')]['toLowerCase']()][_0x7dc9('0x12')]('\x20')));});}else{return _0x4202ce(_0x585e42[_0x7dc9('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x47c4c3){var _0x6d9bbd=this;return new Promise(function(_0x2adc57,_0x49d7ef){if(ami[_0x7dc9('0xe')]()==![]){return _0x49d7ef(_0x6d9bbd['error'](0x1f4,[config[_0x7dc9('0x10')]['ip'],config[_0x7dc9('0x10')][_0x7dc9('0x1b')],'ami\x20disconnected'][_0x7dc9('0x12')]('\x20')));}var _0x3c7daf=schema(properties[_0x7dc9('0x75')])['validate'](_0x47c4c3);if(_0x3c7daf[_0x7dc9('0x55')]>0x0){return _0x49d7ef(_0x6d9bbd['error'](0x1f4,_['map'](_0x3c7daf,_0x7dc9('0x1a'))[_0x7dc9('0x12')](',\x20')));}var _0x31faa4=_[_0x7dc9('0x56')](_0x1e513b[_0x7dc9('0x72')],{'uniqueid':_0x47c4c3['uniqueid']});if(_0x31faa4&&_0x31faa4[_0x7dc9('0x5e')]){return ami[_0x7dc9('0x18')]({'action':_0x7dc9('0x76'),'channel':_0x31faa4[_0x7dc9('0x5e')],'exten':_0x47c4c3[_0x7dc9('0x77')],'context':_0x47c4c3['context']||_0x31faa4[_0x7dc9('0x78')],'priority':0x1})[_0x7dc9('0x19')](function(_0xcf49f7){_0x2adc57({'code':0xc8,'message':[_0x47c4c3[_0x7dc9('0x6b')],_0xcf49f7['message'][_0x7dc9('0x64')]()]['join']('\x20')});})['catch'](function(_0x1a5cd3){_0x49d7ef(_0x6d9bbd['error'](0x1f5,[_0x47c4c3[_0x7dc9('0x6b')],_0x1a5cd3[_0x7dc9('0x1a')][_0x7dc9('0x64')]()][_0x7dc9('0x12')]('\x20')));});}else{return _0x49d7ef(_0x6d9bbd[_0x7dc9('0xf')](0x1f5,_0x7dc9('0x6d')));}});},'Agents':function(_0x5af0a2){return new Promise(function(_0x42d4cc,_0x233313){var _0x1a4bfb=_[_0x7dc9('0x59')](_0x1e513b[_0x7dc9('0x79')]);_0x42d4cc({'count':_0x1a4bfb['length'],'rows':_0x1a4bfb});});},'Telephones':function(_0x18ee88){return new Promise(function(_0x562b7f,_0x3c5941){var _0x46b751=_[_0x7dc9('0x59')](_0x1e513b['telephones']);_0x562b7f({'count':_0x46b751[_0x7dc9('0x55')],'rows':_0x46b751});});},'Trunks':function(_0x4441a6){return new Promise(function(_0x5e8806,_0x1a9c7e){var _0x3f8839=_[_0x7dc9('0x59')](_0x1e513b[_0x7dc9('0x7a')]);_0x5e8806({'count':_0x3f8839['length'],'rows':_0x3f8839});});},'OutboundChannels':function(_0x28ad4e){return new Promise(function(_0x5cd971,_0x1614a6){var _0x276557=_[_0x7dc9('0x59')](_0x1e513b['outboundChannels']);_0x5cd971({'count':_0x276557[_0x7dc9('0x55')],'rows':_0x276557});});},'Outbound':function(_0x4588a7){return new Promise(function(_0x23da2e,_0x568705){_0x23da2e(_0x1e513b['outbound']);});},'Campaigns':function(_0x191cda){return new Promise(function(_0x36253e,_0x5d5ab3){var _0x573fa9=_[_0x7dc9('0x59')](_0x1e513b[_0x7dc9('0x7b')]);_0x36253e({'count':_0x573fa9['length'],'rows':_0x573fa9});});},'VoiceQueuesPreview':function(_0x29c228){var _0x5a44a1=this;return new Promise(function(_0xdc2264,_0x2af7fe){_0xb15a0b[_0x7dc9('0x7c')](_0x29c228['id'])[_0x7dc9('0x19')](function(_0x41a316){_0xdc2264({'code':0xc8,'message':_0x41a316[_0x7dc9('0x1a')]});})['catch'](function(_0x32d4d0){_0x2af7fe(_0x5a44a1[_0x7dc9('0xf')](0x1f4,_0x32d4d0[_0x7dc9('0x1a')]));});});},'EventManager':function(_0x261d8a){var _0x3adbbe=this;return new Promise(function(_0x5397a4,_0x42b6d8){if(!_0x261d8a[_0x7dc9('0x7d')]){return _0x42b6d8(_0x3adbbe[_0x7dc9('0xf')](0x1f4,_0x7dc9('0x7e')));}ami['emit'](_0x7dc9('0x7f')+_0x261d8a[_0x7dc9('0x7d')],_0x261d8a['message']);_0x5397a4({'code':0xc8,'message':_0x261d8a});});},'FaxAccounts':function(_0x18d7e2){return new Promise(function(_0x5cb3b8,_0x1f6d9f){var _0x19c880=_[_0x7dc9('0x59')](_0x1e513b[_0x7dc9('0x80')]);_0x5cb3b8({'count':_0x19c880[_0x7dc9('0x55')],'rows':_0x19c880});});},'SendFax':function(_0x2c965e){var _0x2126f6=this;return new Promise(function(_0x5d5947,_0x598eb3){_0x3ba3ca[_0x7dc9('0x81')](_0x2c965e)[_0x7dc9('0x19')](function(_0xf02314){_0x5d5947({'code':0xc8,'message':_0xf02314[_0x7dc9('0x1a')]});})[_0x7dc9('0x1e')](function(_0x55bc28){_0x598eb3(_0x2126f6[_0x7dc9('0xf')](0x1f4,_0x55bc28[_0x7dc9('0x1a')]));});});},'CheckAfterSend':function(_0xaca530){var _0x16ec21=this;return new Promise(function(_0x4bb1e9,_0x2a587b){_0x3ba3ca['checkAfterSend'](_0xaca530)[_0x7dc9('0x19')](function(_0x5c5cc7){_0x4bb1e9({'code':0xc8,'message':_0x5c5cc7[_0x7dc9('0x1a')]});})[_0x7dc9('0x1e')](function(_0x1d327a){_0x2a587b(_0x16ec21[_0x7dc9('0xf')](0x1f4,_0x1d327a[_0x7dc9('0x1a')]));});});}};var _0x1cf809=jayson[_0x7dc9('0x82')](_0x4f91c7)[_0x7dc9('0x83')]();_0x1cf809['on'](_0x7dc9('0xf'),function(_0x25eedc){return _0x2636ef(_0x25eedc);});_0x1cf809[_0x7dc9('0x6')](0x232a,_0x7dc9('0x84'),function(){console['log'](_0x7dc9('0x85'),0x232a);return _0x589f02(_0x7dc9('0x86')+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 eabbf61..d927733 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 _0xd802=['../../rpc/cmContact','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','xmd-contactid','ListId','data3','phone','$or','map','calleridnum','lastName','mobile','fax','scheduledAt','updatedAt','union','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','isNil','routeId','destcalleridnum','firstName','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','trigger'];(function(_0x18de25,_0x40e0){var _0x3ed756=function(_0x140e1f){while(--_0x140e1f){_0x18de25['push'](_0x18de25['shift']());}};_0x3ed756(++_0x40e0);}(_0xd802,0xcf));var _0x2d80=function(_0x2f36d2,_0x24285c){_0x2f36d2=_0x2f36d2-0x0;var _0x147f7f=_0xd802[_0x2f36d2];return _0x147f7f;};'use strict';var _=require(_0x2d80('0x0'));var BPromise=require('bluebird');var Redis=require(_0x2d80('0x1'));var util=require(_0x2d80('0x2'));var config=require(_0x2d80('0x3'));var logger=require('../../../../config/logger')(_0x2d80('0x4'));var cmContactRpc=require(_0x2d80('0x5'));config['redis']=_[_0x2d80('0x6')](config['redis'],{'host':_0x2d80('0x7'),'port':0x18eb});var io=require(_0x2d80('0x8'))(new Redis(config['redis']));function emit(_0x5e5539,_0x77fcbf,_0x153f60,_0x1ed6d2,_0x574870){logger[_0x2d80('0x9')](_0x2d80('0xa'),_0x5e5539,_0x77fcbf['id'],_0x153f60,_0x1ed6d2,JSON[_0x2d80('0xb')](_0x574870));io['to'](_0x153f60)['emit'](_0x1ed6d2,_0x574870);}exports[_0x2d80('0xc')]=function(_0x13c6ae,_0x246065,_0x120982,_0x5c6e47){var _0x409e1a,_0x4c288c;var _0x4c0cdd={};var _0x321ad1=Number(_0x120982['data1']);var _0x10e87c=_0x120982[_0x2d80('0xd')]?Boolean(Number(_0x120982[_0x2d80('0xd')])):![];var _0x210060;if(_0x5c6e47[_0x2d80('0xe')]){_0x4c0cdd['id']=_0x5c6e47[_0x2d80('0xe')];}if(!_0x4c0cdd['id']){_0x4c0cdd[_0x2d80('0xf')]=_0x321ad1;_0x210060=_0x120982[_0x2d80('0x10')]&&_0x120982['data3']!=='0'?_0x120982[_0x2d80('0x10')]['split'](','):[_0x2d80('0x11')];_0x4c0cdd[_0x2d80('0x12')]=_[_0x2d80('0x13')](_0x210060,function(_0x89ba1){var _0x5e0980={};_0x5e0980[_0x89ba1]=_0x5c6e47['routeId']?_0x5c6e47['destcalleridnum']:_0x5c6e47[_0x2d80('0x14')];return _0x5e0980;});}var _0x230c3d=['id','firstName',_0x2d80('0x15'),_0x2d80('0x11'),_0x2d80('0x16'),_0x2d80('0x17'),'ListId','createdAt',_0x2d80('0x18'),_0x2d80('0x19')];var _0x3c4fb4=_[_0x2d80('0x1a')](_0x230c3d,_0x210060);BPromise['resolve']()[_0x2d80('0x1b')](cmContactRpc[_0x2d80('0x1c')]({'attributes':_0x3c4fb4,'where':_0x4c0cdd}))[_0x2d80('0x1b')](function(_0x5cae23){_0x4c288c=_0x5cae23;if(!_['isEmpty'](_0x4c288c)){if(_0x4c288c[_0x2d80('0x1d')]===0x1){_0x409e1a=_0x4c288c[0x0];logger['info'](_0x2d80('0x1e'),_0x5c6e47[_0x2d80('0x1f')],_0x246065['id'],_0x409e1a['id']);}else{logger[_0x2d80('0x9')](_0x2d80('0x20'),_0x5c6e47[_0x2d80('0x1f')],_0x246065['id'],_['map'](_0x4c288c,'id')['join'](','));}return;}else{logger[_0x2d80('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x5c6e47['uniqueid'],_0x246065['id']);var _0xf78d48={'ListId':_0x321ad1};var _0x36d77b=_0x120982[_0x2d80('0x21')]&&_0x120982['data4']!=='0'?_0x120982[_0x2d80('0x21')]:'phone';if(_0x10e87c){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x5c6e47[_0x2d80('0x1f')],_0x246065['id']);_0xf78d48[_0x36d77b]=_[_0x2d80('0x22')](_0x5c6e47[_0x2d80('0x23')])?_0x5c6e47[_0x2d80('0x14')]:_0x5c6e47[_0x2d80('0x24')];if(_[_0x2d80('0x22')](_0x5c6e47[_0x2d80('0x23')])){_0xf78d48[_0x2d80('0x25')]=_0x5c6e47[_0x2d80('0x26')]&&_0x5c6e47[_0x2d80('0x26')]!==_0x2d80('0x27')?_0x5c6e47[_0x2d80('0x26')]:_0x2d80('0x28');}else{_0xf78d48['firstName']=_0x5c6e47[_0x2d80('0x29')]&&_0x5c6e47[_0x2d80('0x29')]!==''?_0x5c6e47[_0x2d80('0x29')]:_0x2d80('0x28');}return BPromise[_0x2d80('0x2a')]()['then'](cmContactRpc['createContact'](_0xf78d48))['then'](function(_0x3a06a8){_0x409e1a=_0x3a06a8;_0x4c288c[_0x2d80('0x2b')](_0x3a06a8);if(_0x409e1a){logger['info'](_0x2d80('0x2c'),_0x5c6e47[_0x2d80('0x1f')],_0x246065['id'],_0x409e1a['id']);}return;});}else{logger[_0x2d80('0x9')](_0x2d80('0x2d'),_0x5c6e47[_0x2d80('0x1f')],_0x246065['id']);_0xf78d48[_0x36d77b]=_['isNil'](_0x5c6e47['routeId'])?_0x5c6e47[_0x2d80('0x14')]:_0x5c6e47['destcalleridnum'];if(_['isNil'](_0x5c6e47[_0x2d80('0x23')])){_0xf78d48[_0x2d80('0x25')]=_0x5c6e47['calleridname']&&_0x5c6e47['calleridname']!==_0x2d80('0x27')?_0x5c6e47[_0x2d80('0x26')]:_0x2d80('0x28');}else{_0xf78d48[_0x2d80('0x25')]=_0x5c6e47[_0x2d80('0x29')]&&_0x5c6e47[_0x2d80('0x29')]!==_0x2d80('0x27')?_0x5c6e47[_0x2d80('0x29')]:_0x2d80('0x28');}_0x409e1a=_0xf78d48;_0x4c288c[_0x2d80('0x2b')](_0xf78d48);return;}}})[_0x2d80('0x1b')](function(){if(_0x13c6ae){emit(_0x5c6e47['uniqueid'],_0x246065,util[_0x2d80('0x2e')](_0x2d80('0x2f'),_0x13c6ae[_0x2d80('0x30')]),util['format'](_0x2d80('0x31'),_0x120982[_0x2d80('0x32')][_0x2d80('0x33')]()),{'evt':_[_0x2d80('0x34')](_0x5c6e47,{'autoCreate':_0x10e87c}),'contact':_0x409e1a===undefined?{}:_0x409e1a,'contacts':_0x4c288c[_0x2d80('0x1d')]===0x0?undefined:_0x4c288c});}});}; \ No newline at end of file +var _0xb30a=['xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','firstName','lastName','mobile','createdAt','scheduledAt','union','resolve','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','trigger:%s','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','exec','data1','data2'];(function(_0x378ca9,_0x2a6759){var _0x104c01=function(_0x371163){while(--_0x371163){_0x378ca9['push'](_0x378ca9['shift']());}};_0x104c01(++_0x2a6759);}(_0xb30a,0x1cd));var _0xab30=function(_0x3bf6c8,_0x5d7d59){_0x3bf6c8=_0x3bf6c8-0x0;var _0x1ef1ce=_0xb30a[_0x3bf6c8];return _0x1ef1ce;};'use strict';var _=require(_0xab30('0x0'));var BPromise=require(_0xab30('0x1'));var Redis=require(_0xab30('0x2'));var util=require(_0xab30('0x3'));var config=require(_0xab30('0x4'));var logger=require('../../../../config/logger')(_0xab30('0x5'));var cmContactRpc=require(_0xab30('0x6'));config[_0xab30('0x7')]=_[_0xab30('0x8')](config['redis'],{'host':_0xab30('0x9'),'port':0x18eb});var io=require(_0xab30('0xa'))(new Redis(config[_0xab30('0x7')]));function emit(_0x540be7,_0x445b5c,_0x207b9c,_0x2a76b6,_0x2f7208){logger['info'](_0xab30('0xb'),_0x540be7,_0x445b5c['id'],_0x207b9c,_0x2a76b6,JSON[_0xab30('0xc')](_0x2f7208));io['to'](_0x207b9c)['emit'](_0x2a76b6,_0x2f7208);}exports[_0xab30('0xd')]=function(_0x1921a1,_0x299a0f,_0x4e9db3,_0x43ce63){var _0x488cdd,_0x3c4f6a;var _0x555fc9={};var _0x20f5ee=Number(_0x4e9db3[_0xab30('0xe')]);var _0x277f1f=_0x4e9db3[_0xab30('0xf')]?Boolean(Number(_0x4e9db3[_0xab30('0xf')])):![];var _0x15eb41;if(_0x43ce63[_0xab30('0x10')]){_0x555fc9['id']=_0x43ce63[_0xab30('0x10')];}if(!_0x555fc9['id']){_0x555fc9[_0xab30('0x11')]=_0x20f5ee;_0x15eb41=_0x4e9db3['data3']&&_0x4e9db3[_0xab30('0x12')]!=='0'?_0x4e9db3[_0xab30('0x12')][_0xab30('0x13')](','):[_0xab30('0x14')];_0x555fc9['$or']=_[_0xab30('0x15')](_0x15eb41,function(_0x4e96c9){var _0x4ec39c={};_0x4ec39c[_0x4e96c9]=_0x43ce63[_0xab30('0x16')]?_0x43ce63[_0xab30('0x17')]:_0x43ce63['calleridnum'];return _0x4ec39c;});}var _0x1968ec=['id',_0xab30('0x18'),_0xab30('0x19'),_0xab30('0x14'),_0xab30('0x1a'),'fax',_0xab30('0x11'),_0xab30('0x1b'),_0xab30('0x1c'),'updatedAt'];var _0x1f07e3=_[_0xab30('0x1d')](_0x1968ec,_0x15eb41);BPromise[_0xab30('0x1e')]()[_0xab30('0x1f')](cmContactRpc['getContacts']({'attributes':_0x1f07e3,'where':_0x555fc9}))[_0xab30('0x1f')](function(_0x1d078d){_0x3c4f6a=_0x1d078d;if(!_[_0xab30('0x20')](_0x3c4f6a)){if(_0x3c4f6a[_0xab30('0x21')]===0x1){_0x488cdd=_0x3c4f6a[0x0];logger[_0xab30('0x22')](_0xab30('0x23'),_0x43ce63[_0xab30('0x24')],_0x299a0f['id'],_0x488cdd['id']);}else{logger[_0xab30('0x22')](_0xab30('0x25'),_0x43ce63['uniqueid'],_0x299a0f['id'],_[_0xab30('0x15')](_0x3c4f6a,'id')[_0xab30('0x26')](','));}return;}else{logger['info'](_0xab30('0x27'),_0x43ce63[_0xab30('0x24')],_0x299a0f['id']);var _0x549506={'ListId':_0x20f5ee};var _0x35360e=_0x4e9db3[_0xab30('0x28')]&&_0x4e9db3['data4']!=='0'?_0x4e9db3[_0xab30('0x28')]:'phone';if(_0x277f1f){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x43ce63[_0xab30('0x24')],_0x299a0f['id']);_0x549506[_0x35360e]=_[_0xab30('0x29')](_0x43ce63[_0xab30('0x16')])?_0x43ce63[_0xab30('0x2a')]:_0x43ce63['destcalleridnum'];if(_[_0xab30('0x29')](_0x43ce63['routeId'])){_0x549506[_0xab30('0x18')]=_0x43ce63['calleridname']&&_0x43ce63[_0xab30('0x2b')]!==_0xab30('0x2c')?_0x43ce63['calleridname']:_0xab30('0x2d');}else{_0x549506['firstName']=_0x43ce63[_0xab30('0x2e')]&&_0x43ce63[_0xab30('0x2e')]!==_0xab30('0x2c')?_0x43ce63[_0xab30('0x2e')]:_0xab30('0x2d');}return BPromise[_0xab30('0x1e')]()[_0xab30('0x1f')](cmContactRpc[_0xab30('0x2f')](_0x549506))[_0xab30('0x1f')](function(_0x4674e3){_0x488cdd=_0x4674e3;_0x3c4f6a[_0xab30('0x30')](_0x4674e3);if(_0x488cdd){logger[_0xab30('0x22')](_0xab30('0x31'),_0x43ce63['uniqueid'],_0x299a0f['id'],_0x488cdd['id']);}return;});}else{logger[_0xab30('0x22')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x43ce63['uniqueid'],_0x299a0f['id']);_0x549506[_0x35360e]=_[_0xab30('0x29')](_0x43ce63[_0xab30('0x16')])?_0x43ce63['calleridnum']:_0x43ce63['destcalleridnum'];if(_[_0xab30('0x29')](_0x43ce63[_0xab30('0x16')])){_0x549506[_0xab30('0x18')]=_0x43ce63['calleridname']&&_0x43ce63[_0xab30('0x2b')]!==_0xab30('0x2c')?_0x43ce63['calleridname']:_0xab30('0x2d');}else{_0x549506[_0xab30('0x18')]=_0x43ce63[_0xab30('0x2e')]&&_0x43ce63[_0xab30('0x2e')]!==_0xab30('0x2c')?_0x43ce63[_0xab30('0x2e')]:'Unknown';}_0x488cdd=_0x549506;_0x3c4f6a['push'](_0x549506);return;}}})['then'](function(){if(_0x1921a1){emit(_0x43ce63['uniqueid'],_0x299a0f,util[_0xab30('0x32')]('user:%s',_0x1921a1['name']),util[_0xab30('0x32')](_0xab30('0x33'),_0x4e9db3['action'][_0xab30('0x34')]()),{'evt':_['merge'](_0x43ce63,{'autoCreate':_0x277f1f}),'contact':_0x488cdd===undefined?{}:_0x488cdd,'contacts':_0x3c4f6a['length']===0x0?undefined:_0x3c4f6a});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 16fef8b..29f47fa 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 _0x6d93=['merge','jscripty','trigger:%s','exec','integration','routeId','urlforward','script','parse','query','every','AllConditions','checkConditions','channel','AnyConditions','some','field','account','chat','operator','value','AccountId','upperFirst','interaction','message','event','queue','agent','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','custom:agentringnoanswer','syncCustomEvent','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','checkTrigger','length','Actions','interface','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','windowWidth','800','data5','data6','600','winApplication','user:%s','name','format','trigger:%s:%s'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6d93,0x177));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x36d9('0x0'));var _=require(_0x36d9('0x1'));var url=require(_0x36d9('0x2'));var Mustache=require(_0x36d9('0x3'));var Redis=require(_0x36d9('0x4'));var urlforward=require(_0x36d9('0x5'));var integration=require(_0x36d9('0x6'));var cmContact=require('./cmContact');var script=require(_0x36d9('0x7'));var config=require(_0x36d9('0x8'));var logger=require(_0x36d9('0x9'))(_0x36d9('0xa'));var ami=require(_0x36d9('0xb'));config[_0x36d9('0xc')]=_[_0x36d9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x36d9('0xe'))(new Redis(config[_0x36d9('0xc')]));var operators={'equals':function(_0x4a64ef,_0x84d37e){return _0x4a64ef==_0x84d37e;},'not_equals':function(_0x151f75,_0xba6706){return _0x151f75!=_0xba6706;}};var barAndWebActions=[_0x36d9('0xf'),'url',_0x36d9('0x10')];function Trigger(_0x3a72a4){this[_0x36d9('0x11')]=_0x3a72a4[_0x36d9('0x11')];this['agents']=_0x3a72a4[_0x36d9('0x12')];this[_0x36d9('0x13')]=_0x3a72a4[_0x36d9('0x13')];this[_0x36d9('0x14')]=_0x3a72a4[_0x36d9('0x14')];this['voiceExtensions']=_0x3a72a4[_0x36d9('0x15')];this[_0x36d9('0x16')]=_0x3a72a4['zendeskAccounts'];this['freshdeskAccounts']=_0x3a72a4[_0x36d9('0x17')];this[_0x36d9('0x18')]=_0x3a72a4[_0x36d9('0x18')];this[_0x36d9('0x19')]=_0x3a72a4[_0x36d9('0x19')];this[_0x36d9('0x1a')]=_0x3a72a4[_0x36d9('0x1a')];this[_0x36d9('0x1b')]=_0x3a72a4[_0x36d9('0x1b')];this['vtigerAccounts']=_0x3a72a4['vtigerAccounts'];this[_0x36d9('0x1c')]=_0x3a72a4[_0x36d9('0x1c')];this[_0x36d9('0x1d')]=_0x3a72a4[_0x36d9('0x1d')];this[_0x36d9('0x1e')]=_0x3a72a4[_0x36d9('0x1e')];this[_0x36d9('0x1f')]={'zendesk':this[_0x36d9('0x16')],'salesforce':this[_0x36d9('0x18')],'freshdesk':this[_0x36d9('0x17')],'sugarcrm':this[_0x36d9('0x19')],'zoho':this[_0x36d9('0x1a')],'desk':this[_0x36d9('0x1b')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x36d9('0x1d')],'freshsales':this[_0x36d9('0x1e')],'servicenow':this[_0x36d9('0x1c')]};ami['on'](_0x36d9('0x20'),this['syncCustomEvent'][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x22'),this['syncCustomEvent'][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x23'),this[_0x36d9('0x24')]['bind'](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x25'),this[_0x36d9('0x24')][_0x36d9('0x21')](this));ami['on']('custom:agentnoanswer',this[_0x36d9('0x24')][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x26'),this['syncCustomEvent'][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x27'),this[_0x36d9('0x24')][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x28'),this[_0x36d9('0x24')][_0x36d9('0x21')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent']['bind'](this));ami['on'](_0x36d9('0x29'),this['syncCustomEvent']['bind'](this));ami['on']('custom:dialbegin',this[_0x36d9('0x2a')][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x2b'),this[_0x36d9('0x2a')][_0x36d9('0x21')](this));ami['on']('custom:dialend',this[_0x36d9('0x2a')][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x2c'),this['syncCustomEvent']['bind'](this));ami['on'](_0x36d9('0x2d'),this[_0x36d9('0x24')][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x2e'),this[_0x36d9('0x24')][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x2f'),this[_0x36d9('0x24')][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x30'),this[_0x36d9('0x24')][_0x36d9('0x21')](this));ami['on'](_0x36d9('0x31'),this['syncCustomEvent'][_0x36d9('0x21')](this));}Trigger[_0x36d9('0x32')][_0x36d9('0x33')]=function(_0x45d816,_0x560e9b,_0x4f5f61){logger[_0x36d9('0x34')](_0x45d816,_0x560e9b,JSON[_0x36d9('0x35')](_0x4f5f61));io['to'](_0x45d816)[_0x36d9('0x33')](_0x560e9b,_0x4f5f61);};Trigger[_0x36d9('0x32')][_0x36d9('0x24')]=function(_0xc34fe0){var _0x532d0e=_[_0x36d9('0x36')](_0xc34fe0);this[_0x36d9('0x37')](_0x532d0e);};Trigger[_0x36d9('0x32')][_0x36d9('0x2a')]=function(_0x544520){if(this[_0x36d9('0x12')][_0x544520['interface']]){this[_0x36d9('0x24')](_0x544520);}};Trigger['prototype'][_0x36d9('0x37')]=function(_0x1d421c){var _0x219839;for(var _0x4d5104 in this[_0x36d9('0x11')]){if(this[_0x36d9('0x11')]['hasOwnProperty'](_0x4d5104)){if(this[_0x36d9('0x11')][_0x4d5104]['status']){_0x219839=this[_0x36d9('0x38')](this[_0x36d9('0x11')][_0x4d5104],_0x1d421c);if(_0x219839){_['merge'](_0x1d421c,_0x1d421c['variables']);for(var _0x23ae72=0x0,_0x5317ab,_0x1e8e0b,_0x323312;_0x23ae720x0){_0x47b382=_['map'](_0x1285e4,_0x178bc2);}return _0x47b382;}function getCustomFields(_0x4560f1,_0x132a22){var _0x44734b=[];var _0x4cdc94={'custom_fields':{}};if(_0x4560f1['length']>0x0){_[_0xa68f('0x2a')](_0x4560f1,function(_0xde55d9){if(_[_0xa68f('0x2b')]([_0xa68f('0x2c'),_0xa68f('0x2d')],_0xde55d9['type'])&&_0xde55d9['nameField']&&!_0xde55d9[_0xa68f('0x2e')]){_0x4cdc94[_0xde55d9[_0xa68f('0x2f')]['toLowerCase']()]=_0xde55d9[_0xa68f('0x30')][_0xa68f('0x31')]();}else if(_[_0xa68f('0x2b')]([_0xa68f('0x2c'),_0xa68f('0x2d')],_0xde55d9[_0xa68f('0x32')])&&_0xde55d9[_0xa68f('0x33')]&&_0xde55d9[_0xa68f('0x2e')]){_0x4cdc94[_0xa68f('0x34')][_0xde55d9['idField']]=_0xde55d9[_0xa68f('0x30')][_0xa68f('0x31')]();}else if(_0xde55d9['type']===_0xa68f('0x35')&&_0xde55d9[_0xa68f('0x36')]&&_0xde55d9[_0xa68f('0x33')]&&_0xde55d9[_0xa68f('0x2e')]){_0x132a22[_0xde55d9['variableName']]&&(_0x4cdc94['custom_fields'][_0xde55d9['idField']]=_0x132a22[_0xde55d9[_0xa68f('0x36')]]['toString']());}else if(_0xde55d9[_0xa68f('0x32')]===_0xa68f('0x37')&&_0xde55d9[_0xa68f('0x38')]&&_0xde55d9[_0xa68f('0x38')][_0xa68f('0x39')]&&_0xde55d9[_0xa68f('0x33')]&&_0xde55d9['customField']){_0x132a22[_0xde55d9[_0xa68f('0x38')]['name'][_0xa68f('0x3a')]()]&&(_0x4cdc94['custom_fields'][_0xde55d9[_0xa68f('0x33')]]=_0x132a22[_0xde55d9[_0xa68f('0x38')]['name'][_0xa68f('0x3a')]()][_0xa68f('0x31')]());}});}if(_0x4cdc94[_0xa68f('0x3b')]){_0x4cdc94['priority']=Number(_0x4cdc94[_0xa68f('0x3b')]);}return _0x4cdc94;}function getTicket(_0x235f4b,_0xc14989,_0x32db8d,_0x4ed9d2,_0x5e0516){logger[_0xa68f('0xd')](_0xa68f('0x3c'));var _0x49784a=_['merge']({'subject':intUtil[_0xa68f('0x3d')](_0x4ed9d2[_0xa68f('0x3e')],_0x5e0516,'\x20'),'type':_0xa68f('0x3f'),'status':_0xa68f('0x40'),'labels':['xCALLY',_0xa68f('0x41'),_0xa68f('0x42')][_0xa68f('0x43')](getTags(_0x4ed9d2[_0xa68f('0x44')],_0xa68f('0x39'))),'description':intUtil[_0xa68f('0x3d')](_0x4ed9d2['Descriptions'],_0x5e0516,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xa68f('0x45'),_0xc14989['id']),'class':_0xa68f('0x46')}},'message':{'direction':'in','body':intUtil[_0xa68f('0x3d')](_0x4ed9d2[_0xa68f('0x47')],_0x5e0516,'\x0a')}},getCustomFields(_0x4ed9d2[_0xa68f('0x48')],_0x5e0516));return request({'uri':util[_0xa68f('0xf')](_0xa68f('0x49'),_0x235f4b[_0xa68f('0x11')],_0x32db8d['id']),'method':_0xa68f('0x27'),'body':_0x49784a});}exports[_0xa68f('0x4a')]=function(_0x563672,_0x34c014,_0x5c4c60,_0x119485,_0xbaf12f,_0x168675){var _0xf6ec7,_0x4ed2c7;_0x168675[_0xa68f('0x11')]=intUtil[_0xa68f('0x4b')](_0x168675['remoteUri']);_0x168675[_0xa68f('0x4c')]=intUtil['stripTrailingSlash'](_0x168675[_0xa68f('0x4c')]);if(_0xbaf12f&&_0xbaf12f['monitor_format']){logger[_0xa68f('0xd')](_0xa68f('0x4d'),'Recording\x20is\x20enabled!');_0x34c014[_0xa68f('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x168675[_0xa68f('0x4c')],_0x34c014['uniqueid'],md5(_0x34c014['uniqueid']));}else{_0x34c014['recordingURL']='';}headers['Authorization']=getAuth(_0x168675);return getUser(_0x168675,_0x119485[_0xa68f('0x4f')])[_0xa68f('0x12')](function(_0x2d190c){_0xf6ec7=_0x2d190c;logger['info'](_0xa68f('0x50'),_0xf6ec7['id']);return getEndUser(_0x168675,_0x34c014['calleridname'],_0x34c014['calleridnum']);})[_0xa68f('0x12')](function(_0x2dd537){_0x4ed2c7=_0x2dd537;logger[_0xa68f('0xd')](_0xa68f('0x51'),_0x4ed2c7['id']);return getTicket(_0x168675,_0xf6ec7,_0x4ed2c7,_0x5c4c60,_0x34c014);})[_0xa68f('0x12')](function(_0x23598a){if(_0x23598a){logger['info'](_0xa68f('0x52'));logger['info'](_0xa68f('0x53'),_0x23598a['id']);switch(_0x168675[_0xa68f('0x32')]){case _0xa68f('0x54'):logger[_0xa68f('0xd')](_0xa68f('0x4d'),_0xa68f('0x55'));emit(util[_0xa68f('0xf')](_0xa68f('0x56'),_0x119485['name']),_0xa68f('0x57'),{'recordId':_0x23598a['id']});break;case'newTab':logger[_0xa68f('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa68f('0xf')]('user:%s',_0x119485[_0xa68f('0x39')]),'trigger:browser:url',{'uri':util[_0xa68f('0xf')](_0xa68f('0x58'),_0x23598a['id'])});break;default:logger[_0xa68f('0x59')](_0xa68f('0x4d'),_0xa68f('0x5a'));}}})[_0xa68f('0x5b')](function(_0xaa9160){console[_0xa68f('0x59')](_0xaa9160);logger[_0xa68f('0x59')](_0xa68f('0x4d'),JSON[_0xa68f('0x19')](_0xaa9160));});};exports[_0xa68f('0x5c')]=function(_0x170703,_0x3d9045,_0x64df03,_0x4ec0e4,_0x56e105,_0x1fe0ec,_0x3be045){var _0x203070,_0x41cbe1;_0x1fe0ec[_0xa68f('0x11')]=intUtil[_0xa68f('0x4b')](_0x1fe0ec[_0xa68f('0x11')]);_0x1fe0ec[_0xa68f('0x4c')]=intUtil['stripTrailingSlash'](_0x1fe0ec[_0xa68f('0x4c')]);if(_0x3be045&&_0x3be045[_0xa68f('0x5d')]&&_0x3be045[_0xa68f('0x5d')]!==_0xa68f('0x5e')){logger[_0xa68f('0xd')](_0xa68f('0x5f'),_0xa68f('0x60'));_0x3d9045['recordingURL']=util[_0xa68f('0xf')](_0xa68f('0x61'),_0x1fe0ec[_0xa68f('0x4c')],_0x3d9045[_0xa68f('0x62')],md5(_0x3d9045[_0xa68f('0x62')]));}headers['Authorization']=getAuth(_0x1fe0ec);return getUser(_0x1fe0ec,_0x4ec0e4['email'])[_0xa68f('0x12')](function(_0x4329fe){_0x203070=_0x4329fe;logger[_0xa68f('0xd')](_0xa68f('0x50'),_0x203070['id']);return getEndUser(_0x1fe0ec,_0x3d9045[_0xa68f('0x63')],_0x3d9045['destcalleridnum']);})[_0xa68f('0x12')](function(_0x45158c){_0x41cbe1=_0x45158c;logger[_0xa68f('0xd')]('The\x20Enduser\x20ID\x20is:',_0x41cbe1['id']);return getTicket(_0x1fe0ec,_0x203070,_0x41cbe1,_0x64df03,_0x3d9045);})[_0xa68f('0x12')](function(_0x364b90){if(_0x364b90){logger['info'](_0xa68f('0x52'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x364b90['id']);switch(_0x1fe0ec['type']){case _0xa68f('0x54'):logger[_0xa68f('0xd')](_0xa68f('0x4d'),_0xa68f('0x55'));emit(util['format'](_0xa68f('0x56'),_0x4ec0e4[_0xa68f('0x39')]),_0xa68f('0x57'),{'recordId':_0x364b90['id']});break;case _0xa68f('0x64'):logger['info'](_0xa68f('0x4d'),_0xa68f('0x65'));emit(util[_0xa68f('0xf')]('user:%s',_0x4ec0e4['name']),_0xa68f('0x66'),{'uri':util[_0xa68f('0xf')](_0xa68f('0x67'),_0x1fe0ec[_0xa68f('0x11')],_0x364b90['id'])});break;default:logger[_0xa68f('0x59')](_0xa68f('0x5f'),_0xa68f('0x5a'));}}})[_0xa68f('0x5b')](function(_0x5740f2){logger[_0xa68f('0x59')](_0xa68f('0x5f'),JSON[_0xa68f('0x19')](_0x5740f2));});};exports[_0xa68f('0x68')]=function(_0x5f37c2,_0x3162fc,_0x5c5637,_0x4b33f1,_0x44dc35,_0x85a5a1){var _0x2d8ab3,_0x1c78d6;_0x85a5a1[_0xa68f('0x11')]=intUtil[_0xa68f('0x4b')](_0x85a5a1['remoteUri']);_0x85a5a1[_0xa68f('0x4c')]=intUtil[_0xa68f('0x4b')](_0x85a5a1[_0xa68f('0x4c')]);if(_0x44dc35&&_0x44dc35[_0xa68f('0x69')]){logger['info']('['+_0x3162fc[_0xa68f('0x6a')][_0xa68f('0x6b')]()+']',_0xa68f('0x60'));_0x3162fc[_0xa68f('0x4e')]=util[_0xa68f('0xf')](_0xa68f('0x61'),_0x85a5a1[_0xa68f('0x4c')],_0x3162fc[_0xa68f('0x62')],md5(_0x3162fc[_0xa68f('0x62')]));}else{_0x3162fc[_0xa68f('0x4e')]='';}headers[_0xa68f('0x6c')]=getAuth(_0x85a5a1);return getUser(_0x85a5a1)['then'](function(_0x9be626){_0x2d8ab3=_0x9be626;logger[_0xa68f('0xd')](_0xa68f('0x50'),_0x2d8ab3['id']);return getEndUser(_0x85a5a1,_0x3162fc['calleridname'],_0x3162fc[_0xa68f('0x6d')]);})['then'](function(_0x351b0b){_0x1c78d6=_0x351b0b;logger[_0xa68f('0xd')](_0xa68f('0x51'),_0x1c78d6['id']);return getTicket(_0x85a5a1,_0x2d8ab3,_0x1c78d6,_0x5c5637,_0x3162fc);})[_0xa68f('0x12')](function(_0x2bcd1e){if(_0x2bcd1e){logger[_0xa68f('0xd')](_0xa68f('0x52'));logger[_0xa68f('0xd')](_0xa68f('0x53'),_0x2bcd1e['id']);}})[_0xa68f('0x5b')](function(_0x3791a7){logger['error']('['+_0x3162fc[_0xa68f('0x6a')][_0xa68f('0x6b')]()+']',JSON['stringify'](_0x3791a7));});}; \ No newline at end of file +var _0x8c0d=['%s/users/me','[HTTP]','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','map','includes','string','type','nameField','customField','toLowerCase','content','idField','custom_fields','variableName','Variable','name','priority','getString','Subjects','phone','new','xCALLY','Motion','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','[QUEUE]','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','Desk\x20account\x20type\x20not\x20recognized','catch','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!'];(function(_0x39d62d,_0x29de6b){var _0x34cacd=function(_0x343321){while(--_0x343321){_0x39d62d['push'](_0x39d62d['shift']());}};_0x34cacd(++_0x29de6b);}(_0x8c0d,0x124));var _0xd8c0=function(_0xa37c4d,_0x31b0f9){_0xa37c4d=_0xa37c4d-0x0;var _0x596eac=_0x8c0d[_0xa37c4d];return _0x596eac;};'use strict';var _=require(_0xd8c0('0x0'));var rp=require(_0xd8c0('0x1'));var md5=require('md5');var util=require(_0xd8c0('0x2'));var Redis=require(_0xd8c0('0x3'));var intUtil=require(_0xd8c0('0x4'));var config=require('../../../../config/environment');var logger=require(_0xd8c0('0x5'))('desk');config[_0xd8c0('0x6')]=_[_0xd8c0('0x7')](config[_0xd8c0('0x6')],{'host':_0xd8c0('0x8'),'port':0x18eb});var io=require(_0xd8c0('0x9'))(new Redis(config['redis']));function emit(_0x350b48,_0x134b83,_0x182e3e){io['to'](_0x350b48)[_0xd8c0('0xa')](_0x134b83,_0x182e3e);}var headers={'Content-Type':_0xd8c0('0xb'),'Accept':_0xd8c0('0xb')};function getUser(_0x483edd,_0x12693a){if(intUtil[_0xd8c0('0xc')](_0x12693a)===!![]){logger[_0xd8c0('0xd')](_0xd8c0('0xe'),_0x12693a);return request({'uri':util['format'](_0xd8c0('0xf'),_0x483edd[_0xd8c0('0x10')])})[_0xd8c0('0x11')](function(_0x24338a){if(_0x24338a[_0xd8c0('0x12')]){return _[_0xd8c0('0x13')](_0x24338a[_0xd8c0('0x14')][_0xd8c0('0x15')],{'email':_0x12693a});}})['then'](function(_0x42bfaf){if(_0x42bfaf){logger['info'](_0xd8c0('0x16'));return _0x42bfaf;}else{logger[_0xd8c0('0xd')](_0xd8c0('0x17'));return request({'uri':util[_0xd8c0('0x18')]('%s/users/me',_0x483edd['remoteUri'])});}});}else{logger[_0xd8c0('0xd')](_0xd8c0('0x19'));return request({'uri':util['format'](_0xd8c0('0x1a'),_0x483edd[_0xd8c0('0x10')])});}}function request(_0x4fb3bc){logger['debug'](_0xd8c0('0x1b'),JSON[_0xd8c0('0x1c')](_0x4fb3bc));return rp(_['defaults'](_0x4fb3bc,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x57f17){var _0x558406;if(_0x57f17[_0xd8c0('0x1d')]==='basic'){_0x558406=util[_0xd8c0('0x18')](_0xd8c0('0x1e'),_0x57f17[_0xd8c0('0x1f')],_0x57f17['password']);}else if(_0x57f17[_0xd8c0('0x1d')]===_0xd8c0('0x20')){_0x558406=util[_0xd8c0('0x18')](_0xd8c0('0x21'),_0x57f17[_0xd8c0('0x1f')],_0x57f17[_0xd8c0('0x20')]);}return util[_0xd8c0('0x18')](_0xd8c0('0x22'),new Buffer(_0x558406)[_0xd8c0('0x23')](_0xd8c0('0x24')));}function getEndUser(_0x9c32a0,_0xc3dc96,_0x220563){logger[_0xd8c0('0xd')]('Searching\x20enduser\x20with\x20phone',_0x220563);return request({'uri':util[_0xd8c0('0x18')](_0xd8c0('0x25'),_0x9c32a0[_0xd8c0('0x10')]),'qs':{'phone':_0x220563}})[_0xd8c0('0x11')](function(_0x2862b2){if(_0x2862b2[_0xd8c0('0x12')]){logger[_0xd8c0('0xd')](_0xd8c0('0x26'));return _0x2862b2[_0xd8c0('0x14')][_0xd8c0('0x15')][0x0];}else{logger['info'](_0xd8c0('0x27'));return request({'uri':util[_0xd8c0('0x18')]('%s/customers',_0x9c32a0[_0xd8c0('0x10')]),'method':_0xd8c0('0x28'),'body':{'first_name':_0xc3dc96,'title':_0xc3dc96,'phone_numbers':[{'type':'work','value':_0x220563}]}});}});}function getTags(_0x5f04f2,_0x2a1dd9){var _0x47f955=[];if(_0x5f04f2&&_0x5f04f2[_0xd8c0('0x29')]>0x0){_0x47f955=_[_0xd8c0('0x2a')](_0x5f04f2,_0x2a1dd9);}return _0x47f955;}function getCustomFields(_0x1c1beb,_0xa171d9){var _0x1e3ff3=[];var _0x33648b={'custom_fields':{}};if(_0x1c1beb[_0xd8c0('0x29')]>0x0){_['forEach'](_0x1c1beb,function(_0x1b9f07){if(_[_0xd8c0('0x2b')]([_0xd8c0('0x2c'),'picklist'],_0x1b9f07[_0xd8c0('0x2d')])&&_0x1b9f07[_0xd8c0('0x2e')]&&!_0x1b9f07[_0xd8c0('0x2f')]){_0x33648b[_0x1b9f07[_0xd8c0('0x2e')][_0xd8c0('0x30')]()]=_0x1b9f07[_0xd8c0('0x31')][_0xd8c0('0x23')]();}else if(_[_0xd8c0('0x2b')]([_0xd8c0('0x2c'),'picklist'],_0x1b9f07[_0xd8c0('0x2d')])&&_0x1b9f07[_0xd8c0('0x32')]&&_0x1b9f07['customField']){_0x33648b[_0xd8c0('0x33')][_0x1b9f07[_0xd8c0('0x32')]]=_0x1b9f07[_0xd8c0('0x31')][_0xd8c0('0x23')]();}else if(_0x1b9f07['type']==='variable'&&_0x1b9f07['variableName']&&_0x1b9f07[_0xd8c0('0x32')]&&_0x1b9f07[_0xd8c0('0x2f')]){_0xa171d9[_0x1b9f07['variableName']]&&(_0x33648b[_0xd8c0('0x33')][_0x1b9f07[_0xd8c0('0x32')]]=_0xa171d9[_0x1b9f07[_0xd8c0('0x34')]][_0xd8c0('0x23')]());}else if(_0x1b9f07['type']==='customVariable'&&_0x1b9f07[_0xd8c0('0x35')]&&_0x1b9f07[_0xd8c0('0x35')]['name']&&_0x1b9f07['idField']&&_0x1b9f07['customField']){_0xa171d9[_0x1b9f07[_0xd8c0('0x35')][_0xd8c0('0x36')][_0xd8c0('0x30')]()]&&(_0x33648b[_0xd8c0('0x33')][_0x1b9f07[_0xd8c0('0x32')]]=_0xa171d9[_0x1b9f07[_0xd8c0('0x35')][_0xd8c0('0x36')][_0xd8c0('0x30')]()][_0xd8c0('0x23')]());}});}if(_0x33648b[_0xd8c0('0x37')]){_0x33648b[_0xd8c0('0x37')]=Number(_0x33648b[_0xd8c0('0x37')]);}return _0x33648b;}function getTicket(_0x5baeb8,_0x301bf0,_0x31fa1d,_0x3ea089,_0x465bf8){logger['info']('Creating\x20new\x20ticket...');var _0x286e40=_['merge']({'subject':intUtil[_0xd8c0('0x38')](_0x3ea089[_0xd8c0('0x39')],_0x465bf8,'\x20'),'type':_0xd8c0('0x3a'),'status':_0xd8c0('0x3b'),'labels':[_0xd8c0('0x3c'),_0xd8c0('0x3d'),_0xd8c0('0x3e')][_0xd8c0('0x3f')](getTags(_0x3ea089[_0xd8c0('0x40')],_0xd8c0('0x36'))),'description':intUtil['getString'](_0x3ea089[_0xd8c0('0x41')],_0x465bf8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xd8c0('0x18')](_0xd8c0('0x42'),_0x301bf0['id']),'class':_0xd8c0('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x3ea089[_0xd8c0('0x41')],_0x465bf8,'\x0a')}},getCustomFields(_0x3ea089[_0xd8c0('0x44')],_0x465bf8));return request({'uri':util[_0xd8c0('0x18')](_0xd8c0('0x45'),_0x5baeb8['remoteUri'],_0x31fa1d['id']),'method':_0xd8c0('0x28'),'body':_0x286e40});}exports['queue']=function(_0x3f911d,_0x12ae52,_0x3a8ddf,_0x51f4c9,_0x1db9ed,_0xc8ca01){var _0x3d7f35,_0x3b30e8;_0xc8ca01[_0xd8c0('0x10')]=intUtil[_0xd8c0('0x46')](_0xc8ca01[_0xd8c0('0x10')]);_0xc8ca01[_0xd8c0('0x47')]=intUtil[_0xd8c0('0x46')](_0xc8ca01[_0xd8c0('0x47')]);if(_0x1db9ed&&_0x1db9ed[_0xd8c0('0x48')]){logger[_0xd8c0('0xd')]('[QUEUE]',_0xd8c0('0x49'));_0x12ae52[_0xd8c0('0x4a')]=util[_0xd8c0('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc8ca01[_0xd8c0('0x47')],_0x12ae52[_0xd8c0('0x4b')],md5(_0x12ae52[_0xd8c0('0x4b')]));}else{_0x12ae52['recordingURL']='';}headers[_0xd8c0('0x4c')]=getAuth(_0xc8ca01);return getUser(_0xc8ca01,_0x51f4c9['email'])[_0xd8c0('0x11')](function(_0x44908a){_0x3d7f35=_0x44908a;logger[_0xd8c0('0xd')](_0xd8c0('0x4d'),_0x3d7f35['id']);return getEndUser(_0xc8ca01,_0x12ae52[_0xd8c0('0x4e')],_0x12ae52[_0xd8c0('0x4f')]);})[_0xd8c0('0x11')](function(_0x5b0740){_0x3b30e8=_0x5b0740;logger['info'](_0xd8c0('0x50'),_0x3b30e8['id']);return getTicket(_0xc8ca01,_0x3d7f35,_0x3b30e8,_0x3a8ddf,_0x12ae52);})[_0xd8c0('0x11')](function(_0x18211d){if(_0x18211d){logger[_0xd8c0('0xd')](_0xd8c0('0x51'));logger[_0xd8c0('0xd')]('The\x20Ticket\x20ID\x20is:',_0x18211d['id']);switch(_0xc8ca01['type']){case _0xd8c0('0x52'):logger['info'](_0xd8c0('0x53'),_0xd8c0('0x54'));emit(util[_0xd8c0('0x18')](_0xd8c0('0x55'),_0x51f4c9['name']),_0xd8c0('0x56'),{'recordId':_0x18211d['id']});break;case _0xd8c0('0x57'):logger['info']('[QUEUE]',_0xd8c0('0x58'));emit(util[_0xd8c0('0x18')](_0xd8c0('0x55'),_0x51f4c9['name']),_0xd8c0('0x59'),{'uri':util[_0xd8c0('0x18')](_0xd8c0('0x5a'),_0x18211d['id'])});break;default:logger[_0xd8c0('0x5b')](_0xd8c0('0x53'),_0xd8c0('0x5c'));}}})[_0xd8c0('0x5d')](function(_0x26ec0b){console['error'](_0x26ec0b);logger[_0xd8c0('0x5b')](_0xd8c0('0x53'),JSON[_0xd8c0('0x1c')](_0x26ec0b));});};exports['outbound']=function(_0xba5a44,_0x5a4304,_0x5b128e,_0x1607bf,_0x2cfdf4,_0x211c74,_0x3176c5){var _0x3f4d30,_0xcef28;_0x211c74['remoteUri']=intUtil[_0xd8c0('0x46')](_0x211c74[_0xd8c0('0x10')]);_0x211c74[_0xd8c0('0x47')]=intUtil[_0xd8c0('0x46')](_0x211c74[_0xd8c0('0x47')]);if(_0x3176c5&&_0x3176c5['recordingFormat']&&_0x3176c5[_0xd8c0('0x5e')]!==_0xd8c0('0x5f')){logger[_0xd8c0('0xd')](_0xd8c0('0x60'),_0xd8c0('0x49'));_0x5a4304['recordingURL']=util[_0xd8c0('0x18')](_0xd8c0('0x61'),_0x211c74['serverUrl'],_0x5a4304[_0xd8c0('0x4b')],md5(_0x5a4304[_0xd8c0('0x4b')]));}headers['Authorization']=getAuth(_0x211c74);return getUser(_0x211c74,_0x1607bf[_0xd8c0('0x62')])[_0xd8c0('0x11')](function(_0xce08a0){_0x3f4d30=_0xce08a0;logger[_0xd8c0('0xd')]('The\x20User\x20ID\x20is:',_0x3f4d30['id']);return getEndUser(_0x211c74,_0x5a4304[_0xd8c0('0x63')],_0x5a4304[_0xd8c0('0x64')]);})[_0xd8c0('0x11')](function(_0x3f2df0){_0xcef28=_0x3f2df0;logger[_0xd8c0('0xd')](_0xd8c0('0x50'),_0xcef28['id']);return getTicket(_0x211c74,_0x3f4d30,_0xcef28,_0x5b128e,_0x5a4304);})['then'](function(_0x4a3116){if(_0x4a3116){logger[_0xd8c0('0xd')](_0xd8c0('0x51'));logger[_0xd8c0('0xd')](_0xd8c0('0x65'),_0x4a3116['id']);switch(_0x211c74[_0xd8c0('0x2d')]){case _0xd8c0('0x52'):logger[_0xd8c0('0xd')](_0xd8c0('0x53'),_0xd8c0('0x54'));emit(util[_0xd8c0('0x18')](_0xd8c0('0x55'),_0x1607bf['name']),_0xd8c0('0x56'),{'recordId':_0x4a3116['id']});break;case _0xd8c0('0x57'):logger[_0xd8c0('0xd')]('[QUEUE]',_0xd8c0('0x58'));emit(util['format'](_0xd8c0('0x55'),_0x1607bf[_0xd8c0('0x36')]),_0xd8c0('0x59'),{'uri':util[_0xd8c0('0x18')](_0xd8c0('0x66'),_0x211c74[_0xd8c0('0x10')],_0x4a3116['id'])});break;default:logger[_0xd8c0('0x5b')](_0xd8c0('0x60'),_0xd8c0('0x5c'));}}})[_0xd8c0('0x5d')](function(_0x414af4){logger[_0xd8c0('0x5b')]('[OUTBOUND]',JSON['stringify'](_0x414af4));});};exports[_0xd8c0('0x67')]=function(_0xddbcb1,_0x9c5ba5,_0x379d3f,_0x3df0c8,_0x11a7c6,_0x1e023e){var _0x3f9c91,_0x431736;_0x1e023e[_0xd8c0('0x10')]=intUtil[_0xd8c0('0x46')](_0x1e023e[_0xd8c0('0x10')]);_0x1e023e['serverUrl']=intUtil[_0xd8c0('0x46')](_0x1e023e[_0xd8c0('0x47')]);if(_0x11a7c6&&_0x11a7c6[_0xd8c0('0x48')]){logger[_0xd8c0('0xd')]('['+_0x9c5ba5[_0xd8c0('0x68')][_0xd8c0('0x69')]()+']',_0xd8c0('0x49'));_0x9c5ba5[_0xd8c0('0x4a')]=util[_0xd8c0('0x18')](_0xd8c0('0x61'),_0x1e023e[_0xd8c0('0x47')],_0x9c5ba5[_0xd8c0('0x4b')],md5(_0x9c5ba5[_0xd8c0('0x4b')]));}else{_0x9c5ba5['recordingURL']='';}headers[_0xd8c0('0x4c')]=getAuth(_0x1e023e);return getUser(_0x1e023e)[_0xd8c0('0x11')](function(_0x448152){_0x3f9c91=_0x448152;logger[_0xd8c0('0xd')](_0xd8c0('0x4d'),_0x3f9c91['id']);return getEndUser(_0x1e023e,_0x9c5ba5[_0xd8c0('0x4e')],_0x9c5ba5[_0xd8c0('0x4f')]);})[_0xd8c0('0x11')](function(_0x1b9800){_0x431736=_0x1b9800;logger['info'](_0xd8c0('0x50'),_0x431736['id']);return getTicket(_0x1e023e,_0x3f9c91,_0x431736,_0x379d3f,_0x9c5ba5);})['then'](function(_0x4fa810){if(_0x4fa810){logger[_0xd8c0('0xd')](_0xd8c0('0x51'));logger[_0xd8c0('0xd')](_0xd8c0('0x65'),_0x4fa810['id']);}})[_0xd8c0('0x5d')](function(_0x3b47c4){logger[_0xd8c0('0x5b')]('['+_0x9c5ba5[_0xd8c0('0x68')][_0xd8c0('0x69')]()+']',JSON[_0xd8c0('0x1c')](_0x3b47c4));});}; \ 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 dc60424..48b4f9f 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 _0xfb67=['stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','clientId','remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','POST','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','message','outbound','telephone1','contactid',']\x20Enduser\x20created!','enduserId','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','callDirection','queue','ticketId','format','user:%s','emit'];(function(_0x47c6b9,_0x210b3c){var _0x34f34d=function(_0x47c336){while(--_0x47c336){_0x47c6b9['push'](_0x47c6b9['shift']());}};_0x34f34d(++_0x210b3c);}(_0xfb67,0xdd));var _0x7fb6=function(_0x347cad,_0x57315d){_0x347cad=_0x347cad-0x0;var _0x487718=_0xfb67[_0x347cad];return _0x487718;};'use strict';var _=require(_0x7fb6('0x0'));var BPromise=require(_0x7fb6('0x1'));var rp=require(_0x7fb6('0x2'));var util=require(_0x7fb6('0x3'));var intUtil=require(_0x7fb6('0x4'));var md5=require(_0x7fb6('0x5'));var Redis=require(_0x7fb6('0x6'));var logger=require('../../../../config/logger')(_0x7fb6('0x7'));var config=require(_0x7fb6('0x8'));config[_0x7fb6('0x9')]=_[_0x7fb6('0xa')](config[_0x7fb6('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x7fb6('0xb'))(new Redis(config[_0x7fb6('0x9')]));function getAuthToken(_0xa448b4,_0x485f45,_0x168ebb){var _0x696959={'method':'POST','uri':_0x485f45,'form':{'client_id':_0xa448b4[_0x7fb6('0xc')],'resource':_0xa448b4[_0x7fb6('0xd')],'username':_0xa448b4[_0x7fb6('0xe')],'password':_0xa448b4['password'],'grant_type':_0x7fb6('0xf'),'client_secret':_0xa448b4['clientSecret']},'json':!![]};return rp(_0x696959)[_0x7fb6('0x10')](function(_0x3a5d46){return _0x3a5d46[_0x7fb6('0x11')];})[_0x7fb6('0x12')](function(_0x584517){logger[_0x7fb6('0x13')]('['+[_0x168ebb[_0x7fb6('0x14')]()]+_0x7fb6('0x15'));return _0x584517['message'];});}function getUser(_0x56606b,_0x555e0a,_0x57488d,_0x4fe18e,_0x59287e,_0x2e8b7c){return new BPromise(function(_0x1f73cd,_0x5264df){return getAuthToken(_0x555e0a,_0x4fe18e,_0x2e8b7c)[_0x7fb6('0x10')](function(_0x3e4441){var _0x5046e2={'method':_0x7fb6('0x16'),'uri':_0x59287e+_0x7fb6('0x17'),'headers':{'Authorization':_0x7fb6('0x18')+_0x3e4441,'OData-Version':_0x7fb6('0x19')},'json':!![]};return rp(_0x5046e2);})[_0x7fb6('0x10')](function(_0x26c3ec){var _0x3b2493=_0x26c3ec[_0x7fb6('0x1a')];var _0x2f8b0a=![];var _0x5de506=null;if(!_[_0x7fb6('0x1b')](_0x57488d)){if(intUtil[_0x7fb6('0x1c')](_0x57488d[_0x7fb6('0x1d')])){_0x56606b[_0x7fb6('0x1e')]=_0x57488d[_0x7fb6('0x1d')];for(_0x5de506=0x0;_0x5de506<_0x3b2493[_0x7fb6('0x1f')];_0x5de506++){if(_0x3b2493[_0x5de506][_0x7fb6('0x20')]===_0x57488d['email']&&!_0x3b2493[_0x5de506]['isdisabled']){_0x2f8b0a=!![];logger[_0x7fb6('0x21')]('['+[_0x2e8b7c[_0x7fb6('0x14')]()]+_0x7fb6('0x22')+_0x3b2493[_0x5de506][_0x7fb6('0x23')]+'!');_0x56606b['userId']=_0x3b2493[_0x5de506][_0x7fb6('0x23')];}}}}if(!_0x2f8b0a){logger[_0x7fb6('0x21')]('['+[_0x2e8b7c['toUpperCase']()]+_0x7fb6('0x24'));_0x56606b['userEmail']=_0x555e0a['username'];for(_0x5de506=0x0;_0x5de506<_0x3b2493[_0x7fb6('0x1f')];_0x5de506++){if(_0x3b2493[_0x5de506]['internalemailaddress']===_0x555e0a['username']){_0x56606b['userId']=_0x3b2493[_0x5de506][_0x7fb6('0x23')];}}}_0x1f73cd(_0x56606b);})['catch'](function(_0x1f7f92){_0x5264df(_0x1f7f92['message']);});});}function createEndUser(_0x3566a1,_0xc60290,_0x37a754,_0x260e8b,_0x253f23,_0x4c9b90){return new BPromise(function(_0x46e9dd,_0x4c7df4){return getAuthToken(_0xc60290,_0x37a754,_0x4c9b90)[_0x7fb6('0x10')](function(_0x25ede1){var _0x578453=_0x4c9b90['toLowerCase']()==='outbound'?_0x253f23[_0x7fb6('0x25')]:_0x253f23[_0x7fb6('0x26')];var _0x35e18f={'method':_0x7fb6('0x27'),'uri':_0x260e8b+_0x7fb6('0x28'),'body':{'telephone1':_0x578453,'fullname':_0x578453,'firstname':_0x578453,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7fb6('0x29')+_0x3566a1['userId']+')'},'headers':{'Authorization':_0x7fb6('0x18')+_0x25ede1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x35e18f);})[_0x7fb6('0x10')](function(_0xa114d5){var _0xbb0240=_0xa114d5[_0x7fb6('0x2a')][_0x7fb6('0x2b')];var _0x100314=_0xbb0240[_0x7fb6('0x2c')](_0xbb0240[_0x7fb6('0x2d')]('(')+0x1,_0xbb0240[_0x7fb6('0x2d')](')'));_0x3566a1['enduserId']=_0x100314;_0x46e9dd(_0x3566a1);})[_0x7fb6('0x12')](function(_0x3c12b5){_0x4c7df4(_0x3c12b5[_0x7fb6('0x2e')]);});});}function getEndUser(_0x3c679c,_0x3f4c5e,_0x34085e,_0x472e6b,_0x2aa952,_0x26ba7e){return new BPromise(function(_0x4dd22d,_0x3d72c2){return getAuthToken(_0x3f4c5e,_0x34085e,_0x26ba7e)[_0x7fb6('0x10')](function(_0x2ee5ad){var _0x3cc10d={'method':'GET','uri':_0x472e6b+'contacts?$select=telephone1','headers':{'Authorization':_0x7fb6('0x18')+_0x2ee5ad,'If-None-Match':null,'OData-Version':_0x7fb6('0x19')},'json':!![]};return rp(_0x3cc10d);})[_0x7fb6('0x10')](function(_0x379a63){var _0x29d1bf=null;if(_0x379a63){var _0x492a9c=_0x379a63[_0x7fb6('0x1a')];var _0x2cbc80=![];for(_0x29d1bf=0x0;_0x29d1bf<_0x492a9c[_0x7fb6('0x1f')];_0x29d1bf++){var _0x3ebe3=_0x26ba7e['toLowerCase']()===_0x7fb6('0x2f')?_0x2aa952[_0x7fb6('0x25')]:_0x2aa952['calleridnum'];if(_0x492a9c[_0x29d1bf][_0x7fb6('0x30')]===_0x3ebe3){_0x2cbc80=!![];_0x3c679c['enduserId']=_0x492a9c[_0x29d1bf][_0x7fb6('0x31')];}}if(_0x2cbc80){_0x4dd22d(_0x3c679c);}else{return createEndUser(_0x3c679c,_0x3f4c5e,_0x34085e,_0x472e6b,_0x2aa952,_0x26ba7e)['then'](function(_0xdc9375){logger['info']('['+[_0x26ba7e[_0x7fb6('0x14')]()]+_0x7fb6('0x32'),_0xdc9375[_0x7fb6('0x33')]);_0x4dd22d(_0xdc9375);});}}else{return createEndUser(_0x3c679c,_0x3f4c5e,_0x34085e,_0x472e6b,_0x2aa952,_0x26ba7e)[_0x7fb6('0x10')](function(_0x40a850){logger[_0x7fb6('0x21')]('['+[_0x26ba7e['toUpperCase']()]+']\x20Enduser\x20Created!',_0x40a850[_0x7fb6('0x33')]);_0x4dd22d(_0x40a850);});}});});}function getCustomFields(_0x36b4cc,_0x253652,_0xa14677){var _0x566490={};if(_0x36b4cc['length']>0x0){_[_0x7fb6('0x34')](_0x36b4cc,function(_0x49ff5f){if(_[_0x7fb6('0x35')]([_0x7fb6('0x36'),_0x7fb6('0x37')],_0x49ff5f[_0x7fb6('0x38')])&&_0x49ff5f[_0x7fb6('0x39')]&&!_0x49ff5f[_0x7fb6('0x3a')]){var _0xa90e5e=_0x49ff5f[_0x7fb6('0x3b')]['toLowerCase']();var _0x54128d=_0xa90e5e[_0x7fb6('0x2c')](0x0,_0xa90e5e['indexOf']('_'));var _0x39b454=_0xa90e5e[_0x7fb6('0x2c')](_0xa90e5e[_0x7fb6('0x3c')]('_')+0x1);if(_0x54128d===_0xa14677){_0x566490[_0x39b454]=_0x49ff5f[_0x7fb6('0x3d')];}}});}return _0x566490;}function getTicket(_0x6fa286,_0x3b77ba,_0x1dbfb8,_0x661d04,_0x57b5e5,_0x580c0e,_0x2ff745){return new BPromise(function(_0x5859e2,_0x39480c){var _0x5bf770;return getAuthToken(_0x3b77ba,_0x1dbfb8,_0x2ff745)[_0x7fb6('0x10')](function(_0x23be92){if(_0x580c0e['ticketType']===_0x7fb6('0x3e')){_0x5bf770={'method':_0x7fb6('0x27'),'uri':_0x661d04+_0x7fb6('0x3f'),'body':Object[_0x7fb6('0x40')]({},{'title':intUtil[_0x7fb6('0x41')](_0x580c0e[_0x7fb6('0x42')],_0x57b5e5,'\x20'),'description':intUtil[_0x7fb6('0x41')](_0x580c0e[_0x7fb6('0x43')],_0x57b5e5,'\x0a'),'customerid_contact@odata.bind':_0x7fb6('0x44')+_0x6fa286['enduserId']+')','ownerid@odata.bind':_0x7fb6('0x29')+_0x6fa286['userId']+')','caseorigincode':'1'},getCustomFields(_0x580c0e[_0x7fb6('0x45')],_0x57b5e5,_0x580c0e[_0x7fb6('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x23be92,'OData-Version':_0x7fb6('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x580c0e[_0x7fb6('0x46')]===_0x7fb6('0x47')){_0x5bf770={'method':'POST','uri':_0x661d04+_0x7fb6('0x48'),'body':Object[_0x7fb6('0x40')]({},{'subject':intUtil[_0x7fb6('0x41')](_0x580c0e[_0x7fb6('0x42')],_0x57b5e5,'\x20'),'phonenumber':String(_0x57b5e5[_0x7fb6('0x26')]),'description':intUtil[_0x7fb6('0x41')](_0x580c0e[_0x7fb6('0x43')],_0x57b5e5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x7fb6('0x44')+_0x6fa286[_0x7fb6('0x33')]+')','ownerid@odata.bind':_0x7fb6('0x29')+_0x6fa286['userId']+')','directioncode':_0x6fa286[_0x7fb6('0x49')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x7fb6('0x29')+_0x6fa286['userId']+')','participationtypemask':_0x6fa286[_0x7fb6('0x49')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x7fb6('0x44')+_0x6fa286[_0x7fb6('0x33')]+')','participationtypemask':_0x6fa286['callDirection']===_0x7fb6('0x4a')?0x1:0x2}]},getCustomFields(_0x580c0e[_0x7fb6('0x45')],_0x57b5e5,_0x580c0e[_0x7fb6('0x46')])),'headers':{'Authorization':_0x7fb6('0x18')+_0x23be92,'OData-Version':_0x7fb6('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5bf770);})[_0x7fb6('0x10')](function(_0x338b4a){var _0x164bfd=_0x338b4a[_0x7fb6('0x2a')][_0x7fb6('0x2b')];var _0x2f0646=_0x164bfd[_0x7fb6('0x2c')](_0x164bfd['lastIndexOf']('(')+0x1,_0x164bfd['lastIndexOf'](')'));_0x6fa286[_0x7fb6('0x4b')]=_0x2f0646;_0x5859e2(_0x6fa286);})['catch'](function(_0x340a96){_0x39480c(_0x340a96[_0x7fb6('0x2e')]);});});}function emit(_0x36faa4,_0x294679,_0x5c8d6a,_0x2d5c02){var _0x371060={'uri':util[_0x7fb6('0x4c')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x36faa4,_0x5c8d6a,_0x2d5c02)};io['to'](util[_0x7fb6('0x4c')](_0x7fb6('0x4d'),_0x294679))[_0x7fb6('0x4e')]('trigger:browser:url',_0x371060);}exports['cs']=function(_0x1dbd54,_0x5d1c7f,_0x4781b6,_0x3e9118,_0x40821c,_0x30d384,_0x248d40,_0x4c2cac){var _0x2fd3e3={};_0x30d384[_0x7fb6('0xd')]=intUtil[_0x7fb6('0x4f')](_0x30d384[_0x7fb6('0xd')]);_0x30d384[_0x7fb6('0x50')]=intUtil['stripTrailingSlash'](_0x30d384[_0x7fb6('0x50')]);_0x2fd3e3[_0x7fb6('0x49')]=_0x4c2cac===_0x7fb6('0x4a')||_0x4c2cac==='unmanaged'?_0x7fb6('0x4a'):_0x7fb6('0x2f');var _0x2f5798=util[_0x7fb6('0x4c')]('%s/api/data/v9.0/',_0x30d384[_0x7fb6('0xd')]);var _0x4ebd80=util[_0x7fb6('0x4c')](_0x7fb6('0x51'),_0x30d384[_0x7fb6('0x52')]);var _0x2575f6=util[_0x7fb6('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30d384[_0x7fb6('0x50')],_0x5d1c7f[_0x7fb6('0x53')],md5(_0x5d1c7f['uniqueid']));if(_0x40821c&&_0x40821c[_0x7fb6('0x54')]){logger[_0x7fb6('0x21')]('[QUEUE]',_0x7fb6('0x55'));_0x5d1c7f[_0x7fb6('0x56')]=_0x2575f6;}else if(_0x248d40&&_0x248d40['recordingFormat']&&_0x248d40[_0x7fb6('0x57')]!==_0x7fb6('0x58')){logger[_0x7fb6('0x21')](_0x7fb6('0x59'),'Recording\x20is\x20enabled!');_0x5d1c7f[_0x7fb6('0x56')]=_0x2575f6;}else{_0x5d1c7f[_0x7fb6('0x56')]='';}return getUser(_0x2fd3e3,_0x30d384,_0x3e9118,_0x4ebd80,_0x2f5798,_0x4c2cac)['then'](function(_0x4b03be){logger[_0x7fb6('0x21')]('['+_0x4c2cac[_0x7fb6('0x14')]()+_0x7fb6('0x5a'),_0x4b03be['userId']);logger[_0x7fb6('0x21')]('['+_0x4c2cac[_0x7fb6('0x14')]()+_0x7fb6('0x5b'),_0x4b03be[_0x7fb6('0x1e')]);return getEndUser(_0x4b03be,_0x30d384,_0x4ebd80,_0x2f5798,_0x5d1c7f,_0x4c2cac);})[_0x7fb6('0x10')](function(_0x2ea413){logger[_0x7fb6('0x21')]('['+_0x4c2cac[_0x7fb6('0x14')]()+_0x7fb6('0x5c'),_0x2ea413[_0x7fb6('0x33')]);logger[_0x7fb6('0x21')]('['+_0x4c2cac[_0x7fb6('0x14')]()+_0x7fb6('0x5d'),_0x5d1c7f[_0x7fb6('0x26')]);return getTicket(_0x2ea413,_0x30d384,_0x4ebd80,_0x2f5798,_0x5d1c7f,_0x4781b6,_0x4c2cac);})[_0x7fb6('0x10')](function(_0x3914c0){logger['info'](util[_0x7fb6('0x4c')]('['+_0x4c2cac[_0x7fb6('0x14')]()+_0x7fb6('0x5e'),_0x4781b6[_0x7fb6('0x46')],_0x3914c0[_0x7fb6('0x4b')]));logger[_0x7fb6('0x21')](util['format']('['+_0x4c2cac[_0x7fb6('0x14')]()+_0x7fb6('0x5f'),_0x4c2cac));if(_0x4c2cac!==_0x7fb6('0x60')){logger[_0x7fb6('0x21')]('['+_0x4c2cac[_0x7fb6('0x14')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d384[_0x7fb6('0xd')],_0x3e9118[_0x7fb6('0x61')],_0x4781b6[_0x7fb6('0x46')],_0x3914c0[_0x7fb6('0x4b')]);}})['catch'](function(_0x313640){logger[_0x7fb6('0x13')]('['+_0x4c2cac[_0x7fb6('0x14')]()+_0x7fb6('0x62'),util[_0x7fb6('0x63')](_0x313640,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdded=['4.0','value','isNil','email','userEmail','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','GET','contacts?$select=telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','assign','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid'];(function(_0x4595be,_0x3c8424){var _0x27c01c=function(_0x4a5bcd){while(--_0x4a5bcd){_0x4595be['push'](_0x4595be['shift']());}};_0x27c01c(++_0x3c8424);}(_0xdded,0x17a));var _0xddde=function(_0x5317b5,_0x3fe8f1){_0x5317b5=_0x5317b5-0x0;var _0x4333c8=_0xdded[_0x5317b5];return _0x4333c8;};'use strict';var _=require(_0xddde('0x0'));var BPromise=require(_0xddde('0x1'));var rp=require(_0xddde('0x2'));var util=require(_0xddde('0x3'));var intUtil=require(_0xddde('0x4'));var md5=require(_0xddde('0x5'));var Redis=require('ioredis');var logger=require(_0xddde('0x6'))(_0xddde('0x7'));var config=require(_0xddde('0x8'));config[_0xddde('0x9')]=_[_0xddde('0xa')](config[_0xddde('0x9')],{'host':_0xddde('0xb'),'port':0x18eb});var io=require(_0xddde('0xc'))(new Redis(config[_0xddde('0x9')]));function getAuthToken(_0x18d8b8,_0x3a5e8a,_0x5f1a34){var _0x32723a={'method':'POST','uri':_0x3a5e8a,'form':{'client_id':_0x18d8b8['clientId'],'resource':_0x18d8b8['remoteUri'],'username':_0x18d8b8[_0xddde('0xd')],'password':_0x18d8b8['password'],'grant_type':_0xddde('0xe'),'client_secret':_0x18d8b8['clientSecret']},'json':!![]};return rp(_0x32723a)[_0xddde('0xf')](function(_0x2880de){return _0x2880de[_0xddde('0x10')];})[_0xddde('0x11')](function(_0x29a446){logger[_0xddde('0x12')]('['+[_0x5f1a34[_0xddde('0x13')]()]+_0xddde('0x14'));return _0x29a446['message'];});}function getUser(_0x88f40d,_0x218779,_0xf884b5,_0x860ff4,_0x7cbcee,_0x31c111){return new BPromise(function(_0x491be5,_0x20b440){return getAuthToken(_0x218779,_0x860ff4,_0x31c111)[_0xddde('0xf')](function(_0x3698d4){var _0x48f602={'method':'GET','uri':_0x7cbcee+_0xddde('0x15'),'headers':{'Authorization':'Bearer\x20'+_0x3698d4,'OData-Version':_0xddde('0x16')},'json':!![]};return rp(_0x48f602);})[_0xddde('0xf')](function(_0x338fa7){var _0x463254=_0x338fa7[_0xddde('0x17')];var _0x55349b=![];var _0x249f19=null;if(!_[_0xddde('0x18')](_0xf884b5)){if(intUtil['validateEmail'](_0xf884b5[_0xddde('0x19')])){_0x88f40d[_0xddde('0x1a')]=_0xf884b5['email'];for(_0x249f19=0x0;_0x249f19<_0x463254['length'];_0x249f19++){if(_0x463254[_0x249f19][_0xddde('0x1b')]===_0xf884b5['email']&&!_0x463254[_0x249f19][_0xddde('0x1c')]){_0x55349b=!![];logger['info']('['+[_0x31c111[_0xddde('0x13')]()]+_0xddde('0x1d')+_0x463254[_0x249f19]['systemuserid']+'!');_0x88f40d['userId']=_0x463254[_0x249f19][_0xddde('0x1e')];}}}}if(!_0x55349b){logger[_0xddde('0x1f')]('['+[_0x31c111[_0xddde('0x13')]()]+_0xddde('0x20'));_0x88f40d[_0xddde('0x1a')]=_0x218779[_0xddde('0xd')];for(_0x249f19=0x0;_0x249f19<_0x463254[_0xddde('0x21')];_0x249f19++){if(_0x463254[_0x249f19]['internalemailaddress']===_0x218779['username']){_0x88f40d[_0xddde('0x22')]=_0x463254[_0x249f19][_0xddde('0x1e')];}}}_0x491be5(_0x88f40d);})[_0xddde('0x11')](function(_0x306c01){_0x20b440(_0x306c01[_0xddde('0x23')]);});});}function createEndUser(_0x533332,_0x394da0,_0x186ae3,_0x4ca351,_0x4bd409,_0xa60e85){return new BPromise(function(_0x3fdbec,_0x5ddf57){return getAuthToken(_0x394da0,_0x186ae3,_0xa60e85)[_0xddde('0xf')](function(_0x45941e){var _0x5328ac=_0xa60e85[_0xddde('0x24')]()===_0xddde('0x25')?_0x4bd409[_0xddde('0x26')]:_0x4bd409[_0xddde('0x27')];var _0x477d44={'method':_0xddde('0x28'),'uri':_0x4ca351+_0xddde('0x29'),'body':{'telephone1':_0x5328ac,'fullname':_0x5328ac,'firstname':_0x5328ac,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xddde('0x2a')+_0x533332[_0xddde('0x22')]+')'},'headers':{'Authorization':_0xddde('0x2b')+_0x45941e,'OData-Version':_0xddde('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x477d44);})[_0xddde('0xf')](function(_0xe3d006){var _0x718921=_0xe3d006[_0xddde('0x2c')][_0xddde('0x2d')];var _0x5312bb=_0x718921[_0xddde('0x2e')](_0x718921[_0xddde('0x2f')]('(')+0x1,_0x718921[_0xddde('0x2f')](')'));_0x533332['enduserId']=_0x5312bb;_0x3fdbec(_0x533332);})['catch'](function(_0x973fc9){_0x5ddf57(_0x973fc9[_0xddde('0x23')]);});});}function getEndUser(_0x45c3b8,_0x50e0f5,_0x500d13,_0x26b836,_0x3daba4,_0x2ba559){return new BPromise(function(_0x1f94bd,_0x49a1ef){return getAuthToken(_0x50e0f5,_0x500d13,_0x2ba559)[_0xddde('0xf')](function(_0x5d64cb){var _0x3e0e64={'method':_0xddde('0x30'),'uri':_0x26b836+_0xddde('0x31'),'headers':{'Authorization':_0xddde('0x2b')+_0x5d64cb,'If-None-Match':null,'OData-Version':_0xddde('0x16')},'json':!![]};return rp(_0x3e0e64);})[_0xddde('0xf')](function(_0x368499){var _0x38eff8=null;if(_0x368499){var _0x4576b8=_0x368499[_0xddde('0x17')];var _0x65cd5c=![];for(_0x38eff8=0x0;_0x38eff8<_0x4576b8[_0xddde('0x21')];_0x38eff8++){var _0x549582=_0x2ba559[_0xddde('0x24')]()===_0xddde('0x25')?_0x3daba4['destcalleridnum']:_0x3daba4['calleridnum'];if(_0x4576b8[_0x38eff8]['telephone1']===_0x549582){_0x65cd5c=!![];_0x45c3b8[_0xddde('0x32')]=_0x4576b8[_0x38eff8][_0xddde('0x33')];}}if(_0x65cd5c){_0x1f94bd(_0x45c3b8);}else{return createEndUser(_0x45c3b8,_0x50e0f5,_0x500d13,_0x26b836,_0x3daba4,_0x2ba559)[_0xddde('0xf')](function(_0x12431d){logger[_0xddde('0x1f')]('['+[_0x2ba559[_0xddde('0x13')]()]+_0xddde('0x34'),_0x12431d['enduserId']);_0x1f94bd(_0x12431d);});}}else{return createEndUser(_0x45c3b8,_0x50e0f5,_0x500d13,_0x26b836,_0x3daba4,_0x2ba559)['then'](function(_0x2d7936){logger['info']('['+[_0x2ba559[_0xddde('0x13')]()]+_0xddde('0x35'),_0x2d7936['enduserId']);_0x1f94bd(_0x2d7936);});}});});}function getCustomFields(_0x3f60ea,_0xba6471,_0x616bc6){var _0x535e82={};if(_0x3f60ea['length']>0x0){_[_0xddde('0x36')](_0x3f60ea,function(_0x483834){if(_[_0xddde('0x37')]([_0xddde('0x38'),_0xddde('0x39')],_0x483834[_0xddde('0x3a')])&&_0x483834[_0xddde('0x3b')]&&!_0x483834[_0xddde('0x3c')]){var _0x5a24ae=_0x483834[_0xddde('0x3d')][_0xddde('0x24')]();var _0x654577=_0x5a24ae[_0xddde('0x2e')](0x0,_0x5a24ae[_0xddde('0x3e')]('_'));var _0x585b5a=_0x5a24ae[_0xddde('0x2e')](_0x5a24ae[_0xddde('0x3e')]('_')+0x1);if(_0x654577===_0x616bc6){_0x535e82[_0x585b5a]=_0x483834[_0xddde('0x3f')];}}});}return _0x535e82;}function getTicket(_0x3a52b5,_0x21b469,_0xb0c016,_0x6cbadb,_0x2a644b,_0x36adb0,_0x5cdbb4){return new BPromise(function(_0x805c03,_0x55793f){var _0x2ea1c3;return getAuthToken(_0x21b469,_0xb0c016,_0x5cdbb4)[_0xddde('0xf')](function(_0x4a708c){if(_0x36adb0[_0xddde('0x40')]===_0xddde('0x41')){_0x2ea1c3={'method':_0xddde('0x28'),'uri':_0x6cbadb+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x36adb0[_0xddde('0x42')],_0x2a644b,'\x20'),'description':intUtil[_0xddde('0x43')](_0x36adb0[_0xddde('0x44')],_0x2a644b,'\x0a'),'customerid_contact@odata.bind':_0xddde('0x45')+_0x3a52b5['enduserId']+')','ownerid@odata.bind':_0xddde('0x2a')+_0x3a52b5[_0xddde('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x36adb0[_0xddde('0x46')],_0x2a644b,_0x36adb0['ticketType'])),'headers':{'Authorization':_0xddde('0x2b')+_0x4a708c,'OData-Version':_0xddde('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x36adb0[_0xddde('0x40')]===_0xddde('0x47')){_0x2ea1c3={'method':_0xddde('0x28'),'uri':_0x6cbadb+'phonecalls','body':Object[_0xddde('0x48')]({},{'subject':intUtil['getString'](_0x36adb0[_0xddde('0x42')],_0x2a644b,'\x20'),'phonenumber':String(_0x2a644b['calleridnum']),'description':intUtil[_0xddde('0x43')](_0x36adb0[_0xddde('0x44')],_0x2a644b,'\x0a'),'regardingobjectid_contact@odata.bind':_0xddde('0x45')+_0x3a52b5[_0xddde('0x32')]+')','ownerid@odata.bind':_0xddde('0x2a')+_0x3a52b5[_0xddde('0x22')]+')','directioncode':_0x3a52b5[_0xddde('0x49')]===_0xddde('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3a52b5[_0xddde('0x22')]+')','participationtypemask':_0x3a52b5[_0xddde('0x49')]===_0xddde('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xddde('0x45')+_0x3a52b5[_0xddde('0x32')]+')','participationtypemask':_0x3a52b5[_0xddde('0x49')]==='queue'?0x1:0x2}]},getCustomFields(_0x36adb0[_0xddde('0x46')],_0x2a644b,_0x36adb0[_0xddde('0x40')])),'headers':{'Authorization':_0xddde('0x2b')+_0x4a708c,'OData-Version':_0xddde('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2ea1c3);})[_0xddde('0xf')](function(_0x5786e0){var _0x2a8537=_0x5786e0[_0xddde('0x2c')][_0xddde('0x2d')];var _0x2ff917=_0x2a8537[_0xddde('0x2e')](_0x2a8537[_0xddde('0x2f')]('(')+0x1,_0x2a8537[_0xddde('0x2f')](')'));_0x3a52b5[_0xddde('0x4b')]=_0x2ff917;_0x805c03(_0x3a52b5);})[_0xddde('0x11')](function(_0xff548d){_0x55793f(_0xff548d[_0xddde('0x23')]);});});}function emit(_0x37fe43,_0x1347f7,_0x1966dc,_0x3947ee){var _0xd58937={'uri':util[_0xddde('0x4c')](_0xddde('0x4d'),_0x37fe43,_0x1966dc,_0x3947ee)};io['to'](util['format']('user:%s',_0x1347f7))[_0xddde('0x4e')](_0xddde('0x4f'),_0xd58937);}exports['cs']=function(_0xe75642,_0x37df05,_0x6cfa1,_0x512ccd,_0x3eaa2a,_0xf13858,_0x3ffb26,_0x229c27){var _0x2ab3={};_0xf13858[_0xddde('0x50')]=intUtil['stripTrailingSlash'](_0xf13858[_0xddde('0x50')]);_0xf13858[_0xddde('0x51')]=intUtil[_0xddde('0x52')](_0xf13858['serverUrl']);_0x2ab3[_0xddde('0x49')]=_0x229c27===_0xddde('0x4a')||_0x229c27==='unmanaged'?'queue':'outbound';var _0x7746b=util['format'](_0xddde('0x53'),_0xf13858[_0xddde('0x50')]);var _0xbc3c07=util[_0xddde('0x4c')](_0xddde('0x54'),_0xf13858['tenantId']);var _0x5cdc94=util[_0xddde('0x4c')](_0xddde('0x55'),_0xf13858['serverUrl'],_0x37df05[_0xddde('0x56')],md5(_0x37df05[_0xddde('0x56')]));if(_0x3eaa2a&&_0x3eaa2a[_0xddde('0x57')]){logger[_0xddde('0x1f')](_0xddde('0x58'),_0xddde('0x59'));_0x37df05[_0xddde('0x5a')]=_0x5cdc94;}else if(_0x3ffb26&&_0x3ffb26[_0xddde('0x5b')]&&_0x3ffb26[_0xddde('0x5b')]!==_0xddde('0x5c')){logger['info'](_0xddde('0x5d'),'Recording\x20is\x20enabled!');_0x37df05[_0xddde('0x5a')]=_0x5cdc94;}else{_0x37df05[_0xddde('0x5a')]='';}return getUser(_0x2ab3,_0xf13858,_0x512ccd,_0xbc3c07,_0x7746b,_0x229c27)['then'](function(_0x55d91b){logger['info']('['+_0x229c27[_0xddde('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x55d91b[_0xddde('0x22')]);logger[_0xddde('0x1f')]('['+_0x229c27[_0xddde('0x13')]()+']\x20The\x20User\x20email\x20is:',_0x55d91b[_0xddde('0x1a')]);return getEndUser(_0x55d91b,_0xf13858,_0xbc3c07,_0x7746b,_0x37df05,_0x229c27);})[_0xddde('0xf')](function(_0x13af92){logger['info']('['+_0x229c27[_0xddde('0x13')]()+_0xddde('0x5e'),_0x13af92[_0xddde('0x32')]);logger[_0xddde('0x1f')]('['+_0x229c27[_0xddde('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x37df05[_0xddde('0x27')]);return getTicket(_0x13af92,_0xf13858,_0xbc3c07,_0x7746b,_0x37df05,_0x6cfa1,_0x229c27);})['then'](function(_0x25e7b4){logger[_0xddde('0x1f')](util[_0xddde('0x4c')]('['+_0x229c27['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x6cfa1[_0xddde('0x40')],_0x25e7b4['ticketId']));logger[_0xddde('0x1f')](util[_0xddde('0x4c')]('['+_0x229c27[_0xddde('0x13')]()+_0xddde('0x5f'),_0x229c27));if(_0x229c27!==_0xddde('0x60')){logger[_0xddde('0x1f')]('['+_0x229c27[_0xddde('0x13')]()+']',_0xddde('0x61'));emit(_0xf13858[_0xddde('0x50')],_0x512ccd['name'],_0x6cfa1[_0xddde('0x40')],_0x25e7b4['ticketId']);}})[_0xddde('0x11')](function(_0x1abfd5){logger['error']('['+_0x229c27[_0xddde('0x13')]()+_0xddde('0x62'),util[_0xddde('0x63')](_0x1abfd5,{'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 1bb5403..eaf7c4d 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 _0x6016=['ioredis','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','defaults','forEach','includes','string','type','customField','nameField','toLowerCase','content','push','idField','variable','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','trigger:browser:url','unmanaged','toUpperCase','lastevent','stringify','lodash','md5','util'];(function(_0xcb8744,_0x188fcf){var _0x23cc0f=function(_0x61f1fe){while(--_0x61f1fe){_0xcb8744['push'](_0xcb8744['shift']());}};_0x23cc0f(++_0x188fcf);}(_0x6016,0xbf));var _0x6601=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x6016[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x6601('0x0'));var rp=require('request-promise');var md5=require(_0x6601('0x1'));var util=require(_0x6601('0x2'));var Redis=require(_0x6601('0x3'));var intUtil=require(_0x6601('0x4'));var config=require('../../../../config/environment');var logger=require(_0x6601('0x5'))(_0x6601('0x6'));config['redis']=_['defaults'](config[_0x6601('0x7')],{'host':_0x6601('0x8'),'port':0x18eb});var io=require(_0x6601('0x9'))(new Redis(config[_0x6601('0x7')]));var headers={'Content-Type':_0x6601('0xa'),'Accept':_0x6601('0xa')};function emit(_0x5afb5,_0x21719f,_0x5c9f36){io['to'](_0x5afb5)[_0x6601('0xb')](_0x21719f,_0x5c9f36);}function getTicket(_0x29b8c3,_0x4fbeb2,_0xb2266f,_0x57ec8a,_0x579cf7){logger[_0x6601('0xc')](_0x6601('0xd'));var _0x206aff=_[_0x6601('0xe')]({'responder_id':_0x4fbeb2['id'],'requester_id':_0xb2266f['id'],'name':util[_0x6601('0xf')](_0x6601('0x10'),_0x579cf7['calleridname']),'phone':_0x579cf7[_0x6601('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6601('0x12')](_0x57ec8a[_0x6601('0x13')],_0x579cf7,'\x20'),'description':intUtil[_0x6601('0x12')](_0x57ec8a[_0x6601('0x14')],_0x579cf7,_0x6601('0x15')),'tags':getTags(_0x57ec8a['Tags'],'name')},getCustomFields(_0x57ec8a[_0x6601('0x16')],_0x579cf7));_0x206aff[_0x6601('0x17')]=_[_0x6601('0x18')](_[_0x6601('0x19')](_0x206aff[_0x6601('0x17')],'id'),_0x6601('0x1a'));return request({'uri':util[_0x6601('0xf')](_0x6601('0x1b'),_0x29b8c3[_0x6601('0x1c')]),'method':_0x6601('0x1d'),'body':_0x206aff})[_0x6601('0x1e')](function(_0x5a5055){logger[_0x6601('0xc')](_0x6601('0x1f'));return _0x5a5055;});}function getUser(_0xd1068c,_0x5c7755){if(intUtil[_0x6601('0x20')](_0x5c7755)){return request({'uri':util[_0x6601('0xf')](_0x6601('0x21'),_0xd1068c[_0x6601('0x1c')]),'qs':{'email':_0x5c7755}})[_0x6601('0x1e')](function(_0xade79a){if(_0xade79a[_0x6601('0x22')]){logger[_0x6601('0xc')](_0x6601('0x23'));return _['find'](_0xade79a,function(_0x15ea9b){return _0x15ea9b[_0x6601('0x24')][_0x6601('0x25')]===_0x5c7755;});}else{logger[_0x6601('0xc')](_0x6601('0x26'));return request({'uri':util[_0x6601('0xf')](_0x6601('0x27'),_0xd1068c[_0x6601('0x1c')])})[_0x6601('0x1e')](function(_0x6c5aab){logger['info']('Admin\x20account\x20selected.');return _0x6c5aab;});}});}else{logger[_0x6601('0xc')](_0x6601('0x28'));return request({'uri':util[_0x6601('0xf')](_0x6601('0x27'),_0xd1068c['remoteUri'])})[_0x6601('0x1e')](function(_0x139960){logger['info'](_0x6601('0x29'));return _0x139960;});}}function getEndUser(_0x37e67a,_0x3eb2ad,_0xb50ac0){logger[_0x6601('0xc')](_0x6601('0x2a'),_0xb50ac0);return request({'uri':util[_0x6601('0xf')]('%s/api/v2/contacts',_0x37e67a['remoteUri']),'qs':{'phone':_0xb50ac0}})['then'](function(_0x22b138){if(_0x22b138[_0x6601('0x22')]){logger[_0x6601('0xc')](_0x6601('0x2b'));return _['find'](_0x22b138,{'phone':_0xb50ac0});}else{logger[_0x6601('0xc')](_0x6601('0x2c'));return request({'uri':util['format'](_0x6601('0x2d'),_0x37e67a[_0x6601('0x1c')]),'method':_0x6601('0x1d'),'body':{'name':_0x3eb2ad,'phone':_0xb50ac0}})[_0x6601('0x1e')](function(_0x3e2b23){logger['info'](_0x6601('0x2e'));return _0x3e2b23;});}});}function getAuth(_0x141be5){return util[_0x6601('0xf')](_0x6601('0x2f'),new Buffer(_0x141be5['apiKey']+':X')[_0x6601('0x30')](_0x6601('0x31')));}function request(_0x47956e){logger[_0x6601('0x32')](_0x6601('0x33'),JSON['stringify'](_0x47956e));return rp(_[_0x6601('0x34')](_0x47956e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4adeca,_0x550f11){var _0x23e2fc=[];if(_0x4adeca&&_0x4adeca['length']>0x0){_0x23e2fc=_['map'](_0x4adeca,_0x550f11);}return _0x23e2fc;}function getCustomFields(_0x4f4029,_0x2c5673){var _0x1de722=[];var _0x233468={'custom_fields':[]};if(_0x4f4029[_0x6601('0x22')]>0x0){_[_0x6601('0x35')](_0x4f4029,function(_0x4e107d){if(_[_0x6601('0x36')]([_0x6601('0x37'),'picklist'],_0x4e107d[_0x6601('0x38')])&&_0x4e107d['nameField']&&!_0x4e107d[_0x6601('0x39')]){_0x233468[_0x4e107d[_0x6601('0x3a')][_0x6601('0x3b')]()]=_0x4e107d[_0x6601('0x3c')][_0x6601('0x30')]();}else if(_['includes']([_0x6601('0x37'),'picklist'],_0x4e107d[_0x6601('0x38')])&&_0x4e107d['idField']&&_0x4e107d['customField']){_0x233468[_0x6601('0x17')][_0x6601('0x3d')]({'id':_0x4e107d[_0x6601('0x3e')],'value':_0x4e107d[_0x6601('0x3c')]['toString']()});}else if(_0x4e107d[_0x6601('0x38')]===_0x6601('0x3f')&&_0x4e107d[_0x6601('0x40')]&&_0x4e107d[_0x6601('0x3e')]&&_0x4e107d[_0x6601('0x39')]){_0x2c5673[_0x4e107d[_0x6601('0x40')]]&&_0x233468[_0x6601('0x17')][_0x6601('0x3d')]({'id':_0x4e107d[_0x6601('0x3e')],'value':_0x2c5673[_0x4e107d[_0x6601('0x40')]]['toString']()});}else if(_0x4e107d[_0x6601('0x38')]===_0x6601('0x41')&&_0x4e107d[_0x6601('0x42')]&&_0x4e107d['Variable']['name']&&_0x4e107d[_0x6601('0x3e')]&&_0x4e107d[_0x6601('0x39')]){_0x2c5673[_0x4e107d[_0x6601('0x42')][_0x6601('0x43')][_0x6601('0x3b')]()]&&_0x233468[_0x6601('0x17')][_0x6601('0x3d')]({'id':_0x4e107d[_0x6601('0x3e')],'value':_0x2c5673[_0x4e107d['Variable'][_0x6601('0x43')][_0x6601('0x3b')]()][_0x6601('0x30')]()});}});}return _0x233468;}exports[_0x6601('0x44')]=function(_0x1ba732,_0x2eca41,_0x22a4b8,_0x243e81,_0x1a2d46,_0x4f6594){var _0x487f65,_0x4521e6;_0x4f6594['remoteUri']=intUtil['stripTrailingSlash'](_0x4f6594[_0x6601('0x1c')]);_0x4f6594[_0x6601('0x45')]=intUtil[_0x6601('0x46')](_0x4f6594['serverUrl']);if(_0x1a2d46&&_0x1a2d46[_0x6601('0x47')]){logger[_0x6601('0xc')]('[QUEUE]',_0x6601('0x48'));_0x2eca41[_0x6601('0x49')]=util[_0x6601('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4f6594['serverUrl'],_0x2eca41[_0x6601('0x4a')],md5(_0x2eca41[_0x6601('0x4a')]));}else{_0x2eca41['recordingURL']='';}headers[_0x6601('0x4b')]=getAuth(_0x4f6594);return getUser(_0x4f6594,_0x243e81[_0x6601('0x25')])['then'](function(_0x62dc3a){_0x487f65=_0x62dc3a;logger[_0x6601('0xc')](_0x6601('0x4c'),_0x487f65['id']);return getEndUser(_0x4f6594,_0x2eca41[_0x6601('0x4d')],_0x2eca41[_0x6601('0x11')]);})['then'](function(_0x198f38){_0x4521e6=_0x198f38;logger[_0x6601('0xc')](_0x6601('0x4e'),_0x4521e6['id']);return getTicket(_0x4f6594,_0x487f65,_0x4521e6,_0x22a4b8,_0x2eca41);})[_0x6601('0x1e')](function(_0x57871f){if(_0x57871f&&_0x57871f['id']){logger[_0x6601('0xc')](_0x6601('0x1f'));logger[_0x6601('0xc')](_0x6601('0x4f'),_0x57871f['id']);logger[_0x6601('0xc')](_0x6601('0x50'),_0x6601('0x51'));emit(util['format'](_0x6601('0x52'),_0x243e81[_0x6601('0x43')]),'trigger:browser:url',{'uri':util[_0x6601('0xf')](_0x6601('0x53'),_0x4f6594['remoteUri'],_0x57871f['id'])});}})[_0x6601('0x54')](function(_0x496ec9){logger[_0x6601('0x55')](_0x6601('0x50'),JSON['stringify'](_0x496ec9));});};exports[_0x6601('0x56')]=function(_0x104926,_0x55f300,_0x4f994f,_0x3f5010,_0xea4ced,_0x417469,_0x8646eb){var _0x415463,_0x4a8b01;_0x417469[_0x6601('0x1c')]=intUtil[_0x6601('0x46')](_0x417469[_0x6601('0x1c')]);_0x417469['serverUrl']=intUtil['stripTrailingSlash'](_0x417469[_0x6601('0x45')]);if(_0x8646eb&&_0x8646eb[_0x6601('0x57')]&&_0x8646eb[_0x6601('0x57')]!==_0x6601('0x58')){logger[_0x6601('0xc')](_0x6601('0x59'),_0x6601('0x48'));_0x55f300[_0x6601('0x49')]=util[_0x6601('0xf')](_0x6601('0x5a'),_0x417469[_0x6601('0x45')],_0x55f300['uniqueid'],md5(_0x55f300[_0x6601('0x4a')]));}headers['Authorization']=getAuth(_0x417469);return getUser(_0x417469,_0x3f5010[_0x6601('0x25')])[_0x6601('0x1e')](function(_0x13261c){_0x415463=_0x13261c;logger[_0x6601('0xc')]('The\x20User\x20ID\x20is:',_0x415463['id']);return getEndUser(_0x417469,_0x55f300['destcalleridname'],_0x55f300[_0x6601('0x5b')]);})[_0x6601('0x1e')](function(_0x2d2e79){_0x4a8b01=_0x2d2e79;logger['info'](_0x6601('0x4e'),_0x4a8b01['id']);return getTicket(_0x417469,_0x415463,_0x4a8b01,_0x4f994f,_0x55f300);})[_0x6601('0x1e')](function(_0x9f14e9){if(_0x9f14e9&&_0x9f14e9['id']){logger[_0x6601('0xc')]('Ticket\x20created!');logger[_0x6601('0xc')](_0x6601('0x4f'),_0x9f14e9['id']);logger[_0x6601('0xc')](_0x6601('0x59'),_0x6601('0x51'));emit(util[_0x6601('0xf')]('user:%s',_0x3f5010[_0x6601('0x43')]),_0x6601('0x5c'),{'uri':util[_0x6601('0xf')](_0x6601('0x53'),_0x417469['remoteUri'],_0x9f14e9['id'])});}})['catch'](function(_0x348091){logger['error'](_0x6601('0x59'),JSON['stringify'](_0x348091));});};exports[_0x6601('0x5d')]=function(_0x42a834,_0x1f3e02,_0x38ce54,_0x3168cc,_0x2fb7bb,_0x3064e5){var _0x303bea,_0x5ba921;_0x3064e5[_0x6601('0x1c')]=intUtil[_0x6601('0x46')](_0x3064e5[_0x6601('0x1c')]);_0x3064e5[_0x6601('0x45')]=intUtil[_0x6601('0x46')](_0x3064e5[_0x6601('0x45')]);if(_0x2fb7bb&&_0x2fb7bb[_0x6601('0x47')]){logger['info']('['+_0x1f3e02['lastevent'][_0x6601('0x5e')]()+']','Recording\x20is\x20enabled!');_0x1f3e02[_0x6601('0x49')]=util[_0x6601('0xf')](_0x6601('0x5a'),_0x3064e5['serverUrl'],_0x1f3e02['uniqueid'],md5(_0x1f3e02[_0x6601('0x4a')]));}else{_0x1f3e02[_0x6601('0x49')]='';}headers['Authorization']=getAuth(_0x3064e5);return getUser(_0x3064e5,'')[_0x6601('0x1e')](function(_0x6660a8){_0x303bea=_0x6660a8;logger[_0x6601('0xc')](_0x6601('0x4c'),_0x303bea['id']);return getEndUser(_0x3064e5,_0x1f3e02[_0x6601('0x4d')],_0x1f3e02['calleridnum']);})[_0x6601('0x1e')](function(_0x6d6e59){_0x5ba921=_0x6d6e59;logger[_0x6601('0xc')](_0x6601('0x4e'),_0x5ba921['id']);return getTicket(_0x3064e5,_0x303bea,_0x5ba921,_0x38ce54,_0x1f3e02);})[_0x6601('0x1e')](function(_0x124334){if(_0x124334){logger[_0x6601('0xc')](_0x6601('0x1f'));logger[_0x6601('0xc')](_0x6601('0x4f'),_0x124334['id']);}})['catch'](function(_0x42e382){logger[_0x6601('0x55')]('['+_0x1f3e02[_0x6601('0x5f')][_0x6601('0x5e')]()+']',JSON[_0x6601('0x60')](_0x42e382));});}; \ No newline at end of file +var _0x45e5=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','map','forEach','string','type','nameField','toLowerCase','content','picklist','idField','customField','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','unmanaged','monitor_format','lastevent','toUpperCase','catch','error','lodash','md5','util','./util','../../../../config/logger','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','
','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','find'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x45e5,0x1f4));var _0x545e=function(_0x1ab7df,_0x5afbef){_0x1ab7df=_0x1ab7df-0x0;var _0x449995=_0x45e5[_0x1ab7df];return _0x449995;};'use strict';var _=require(_0x545e('0x0'));var rp=require('request-promise');var md5=require(_0x545e('0x1'));var util=require(_0x545e('0x2'));var Redis=require('ioredis');var intUtil=require(_0x545e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x545e('0x4'))('freshdesk');config[_0x545e('0x5')]=_[_0x545e('0x6')](config[_0x545e('0x5')],{'host':_0x545e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x545e('0x8'),'Accept':'application/json'};function emit(_0x163e81,_0x382d90,_0x3d6646){io['to'](_0x163e81)[_0x545e('0x9')](_0x382d90,_0x3d6646);}function getTicket(_0x5e4114,_0x35e45a,_0x18611a,_0x2adede,_0x2ff387){logger[_0x545e('0xa')](_0x545e('0xb'));var _0x5091ee=_[_0x545e('0xc')]({'responder_id':_0x35e45a['id'],'requester_id':_0x18611a['id'],'name':util[_0x545e('0xd')](_0x545e('0xe'),_0x2ff387[_0x545e('0xf')]),'phone':_0x2ff387['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2adede['Subjects'],_0x2ff387,'\x20'),'description':intUtil[_0x545e('0x10')](_0x2adede['Descriptions'],_0x2ff387,_0x545e('0x11')),'tags':getTags(_0x2adede['Tags'],'name')},getCustomFields(_0x2adede[_0x545e('0x12')],_0x2ff387));_0x5091ee[_0x545e('0x13')]=_[_0x545e('0x14')](_[_0x545e('0x15')](_0x5091ee[_0x545e('0x13')],'id'),_0x545e('0x16'));return request({'uri':util[_0x545e('0xd')](_0x545e('0x17'),_0x5e4114[_0x545e('0x18')]),'method':_0x545e('0x19'),'body':_0x5091ee})[_0x545e('0x1a')](function(_0x643f11){logger[_0x545e('0xa')](_0x545e('0x1b'));return _0x643f11;});}function getUser(_0x478cdf,_0x18db11){if(intUtil[_0x545e('0x1c')](_0x18db11)){return request({'uri':util[_0x545e('0xd')](_0x545e('0x1d'),_0x478cdf[_0x545e('0x18')]),'qs':{'email':_0x18db11}})['then'](function(_0x5846f4){if(_0x5846f4[_0x545e('0x1e')]){logger[_0x545e('0xa')](_0x545e('0x1f'));return _['find'](_0x5846f4,function(_0x39c1a6){return _0x39c1a6[_0x545e('0x20')][_0x545e('0x21')]===_0x18db11;});}else{logger[_0x545e('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x545e('0xd')](_0x545e('0x22'),_0x478cdf[_0x545e('0x18')])})['then'](function(_0x741aa6){logger['info']('Admin\x20account\x20selected.');return _0x741aa6;});}});}else{logger['info'](_0x545e('0x23'));return request({'uri':util[_0x545e('0xd')](_0x545e('0x22'),_0x478cdf[_0x545e('0x18')])})[_0x545e('0x1a')](function(_0xe7a2d6){logger['info'](_0x545e('0x24'));return _0xe7a2d6;});}}function getEndUser(_0x3ccd14,_0x56eebd,_0x4f678c){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4f678c);return request({'uri':util[_0x545e('0xd')](_0x545e('0x25'),_0x3ccd14['remoteUri']),'qs':{'phone':_0x4f678c}})[_0x545e('0x1a')](function(_0x116491){if(_0x116491['length']){logger[_0x545e('0xa')](_0x545e('0x26'));return _[_0x545e('0x27')](_0x116491,{'phone':_0x4f678c});}else{logger['info'](_0x545e('0x28'));return request({'uri':util[_0x545e('0xd')](_0x545e('0x25'),_0x3ccd14[_0x545e('0x18')]),'method':_0x545e('0x19'),'body':{'name':_0x56eebd,'phone':_0x4f678c}})[_0x545e('0x1a')](function(_0x18ed66){logger[_0x545e('0xa')](_0x545e('0x29'));return _0x18ed66;});}});}function getAuth(_0x14f6d7){return util[_0x545e('0xd')](_0x545e('0x2a'),new Buffer(_0x14f6d7['apiKey']+':X')[_0x545e('0x2b')](_0x545e('0x2c')));}function request(_0x5ea79a){logger['debug']('[HTTP]',JSON['stringify'](_0x5ea79a));return rp(_['defaults'](_0x5ea79a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3c0aab,_0x2075cc){var _0x54e3dd=[];if(_0x3c0aab&&_0x3c0aab[_0x545e('0x1e')]>0x0){_0x54e3dd=_[_0x545e('0x2d')](_0x3c0aab,_0x2075cc);}return _0x54e3dd;}function getCustomFields(_0x534d23,_0x5c191e){var _0x26dfb4=[];var _0x586d0e={'custom_fields':[]};if(_0x534d23[_0x545e('0x1e')]>0x0){_[_0x545e('0x2e')](_0x534d23,function(_0x5c49ff){if(_['includes']([_0x545e('0x2f'),'picklist'],_0x5c49ff[_0x545e('0x30')])&&_0x5c49ff[_0x545e('0x31')]&&!_0x5c49ff['customField']){_0x586d0e[_0x5c49ff[_0x545e('0x31')][_0x545e('0x32')]()]=_0x5c49ff[_0x545e('0x33')][_0x545e('0x2b')]();}else if(_['includes']([_0x545e('0x2f'),_0x545e('0x34')],_0x5c49ff['type'])&&_0x5c49ff[_0x545e('0x35')]&&_0x5c49ff[_0x545e('0x36')]){_0x586d0e['custom_fields'][_0x545e('0x37')]({'id':_0x5c49ff['idField'],'value':_0x5c49ff[_0x545e('0x33')][_0x545e('0x2b')]()});}else if(_0x5c49ff[_0x545e('0x30')]===_0x545e('0x38')&&_0x5c49ff[_0x545e('0x39')]&&_0x5c49ff[_0x545e('0x35')]&&_0x5c49ff[_0x545e('0x36')]){_0x5c191e[_0x5c49ff['variableName']]&&_0x586d0e[_0x545e('0x13')]['push']({'id':_0x5c49ff[_0x545e('0x35')],'value':_0x5c191e[_0x5c49ff[_0x545e('0x39')]][_0x545e('0x2b')]()});}else if(_0x5c49ff[_0x545e('0x30')]===_0x545e('0x3a')&&_0x5c49ff['Variable']&&_0x5c49ff[_0x545e('0x3b')]['name']&&_0x5c49ff['idField']&&_0x5c49ff[_0x545e('0x36')]){_0x5c191e[_0x5c49ff['Variable']['name'][_0x545e('0x32')]()]&&_0x586d0e['custom_fields'][_0x545e('0x37')]({'id':_0x5c49ff[_0x545e('0x35')],'value':_0x5c191e[_0x5c49ff[_0x545e('0x3b')][_0x545e('0x3c')]['toLowerCase']()][_0x545e('0x2b')]()});}});}return _0x586d0e;}exports[_0x545e('0x3d')]=function(_0x1395b1,_0x5d5d03,_0x37dd48,_0x4d04fb,_0x2f8f70,_0x3b4fb5){var _0x59b98f,_0x21cc02;_0x3b4fb5[_0x545e('0x18')]=intUtil[_0x545e('0x3e')](_0x3b4fb5['remoteUri']);_0x3b4fb5[_0x545e('0x3f')]=intUtil['stripTrailingSlash'](_0x3b4fb5[_0x545e('0x3f')]);if(_0x2f8f70&&_0x2f8f70['monitor_format']){logger[_0x545e('0xa')](_0x545e('0x40'),_0x545e('0x41'));_0x5d5d03[_0x545e('0x42')]=util[_0x545e('0xd')](_0x545e('0x43'),_0x3b4fb5['serverUrl'],_0x5d5d03[_0x545e('0x44')],md5(_0x5d5d03[_0x545e('0x44')]));}else{_0x5d5d03[_0x545e('0x42')]='';}headers[_0x545e('0x45')]=getAuth(_0x3b4fb5);return getUser(_0x3b4fb5,_0x4d04fb[_0x545e('0x21')])[_0x545e('0x1a')](function(_0x144926){_0x59b98f=_0x144926;logger['info'](_0x545e('0x46'),_0x59b98f['id']);return getEndUser(_0x3b4fb5,_0x5d5d03[_0x545e('0xf')],_0x5d5d03[_0x545e('0x47')]);})[_0x545e('0x1a')](function(_0xb4fedc){_0x21cc02=_0xb4fedc;logger['info'](_0x545e('0x48'),_0x21cc02['id']);return getTicket(_0x3b4fb5,_0x59b98f,_0x21cc02,_0x37dd48,_0x5d5d03);})[_0x545e('0x1a')](function(_0x53ed48){if(_0x53ed48&&_0x53ed48['id']){logger[_0x545e('0xa')](_0x545e('0x1b'));logger[_0x545e('0xa')](_0x545e('0x49'),_0x53ed48['id']);logger['info'](_0x545e('0x40'),_0x545e('0x4a'));emit(util[_0x545e('0xd')](_0x545e('0x4b'),_0x4d04fb['name']),_0x545e('0x4c'),{'uri':util[_0x545e('0xd')](_0x545e('0x4d'),_0x3b4fb5[_0x545e('0x18')],_0x53ed48['id'])});}})['catch'](function(_0x2bd949){logger['error'](_0x545e('0x40'),JSON[_0x545e('0x4e')](_0x2bd949));});};exports[_0x545e('0x4f')]=function(_0x2fb485,_0x5370db,_0x295dd9,_0x465761,_0x1dfd6b,_0x391949,_0x549899){var _0x16c169,_0x1f909c;_0x391949['remoteUri']=intUtil['stripTrailingSlash'](_0x391949['remoteUri']);_0x391949[_0x545e('0x3f')]=intUtil['stripTrailingSlash'](_0x391949[_0x545e('0x3f')]);if(_0x549899&&_0x549899['recordingFormat']&&_0x549899[_0x545e('0x50')]!==_0x545e('0x51')){logger[_0x545e('0xa')](_0x545e('0x52'),_0x545e('0x41'));_0x5370db[_0x545e('0x42')]=util[_0x545e('0xd')](_0x545e('0x43'),_0x391949['serverUrl'],_0x5370db[_0x545e('0x44')],md5(_0x5370db[_0x545e('0x44')]));}headers[_0x545e('0x45')]=getAuth(_0x391949);return getUser(_0x391949,_0x465761[_0x545e('0x21')])[_0x545e('0x1a')](function(_0x43f683){_0x16c169=_0x43f683;logger[_0x545e('0xa')](_0x545e('0x46'),_0x16c169['id']);return getEndUser(_0x391949,_0x5370db[_0x545e('0x53')],_0x5370db['destcalleridnum']);})[_0x545e('0x1a')](function(_0x14b671){_0x1f909c=_0x14b671;logger[_0x545e('0xa')](_0x545e('0x48'),_0x1f909c['id']);return getTicket(_0x391949,_0x16c169,_0x1f909c,_0x295dd9,_0x5370db);})['then'](function(_0x1bf9dc){if(_0x1bf9dc&&_0x1bf9dc['id']){logger[_0x545e('0xa')](_0x545e('0x1b'));logger['info'](_0x545e('0x49'),_0x1bf9dc['id']);logger[_0x545e('0xa')](_0x545e('0x52'),_0x545e('0x4a'));emit(util[_0x545e('0xd')]('user:%s',_0x465761[_0x545e('0x3c')]),'trigger:browser:url',{'uri':util[_0x545e('0xd')](_0x545e('0x4d'),_0x391949[_0x545e('0x18')],_0x1bf9dc['id'])});}})['catch'](function(_0x2294c2){logger['error']('[OUTBOUND]',JSON['stringify'](_0x2294c2));});};exports[_0x545e('0x54')]=function(_0x25e893,_0x4327c7,_0xc53939,_0x35b28d,_0x35d6cf,_0x21b097){var _0x507beb,_0x28468f;_0x21b097['remoteUri']=intUtil['stripTrailingSlash'](_0x21b097['remoteUri']);_0x21b097['serverUrl']=intUtil[_0x545e('0x3e')](_0x21b097[_0x545e('0x3f')]);if(_0x35d6cf&&_0x35d6cf[_0x545e('0x55')]){logger[_0x545e('0xa')]('['+_0x4327c7[_0x545e('0x56')][_0x545e('0x57')]()+']',_0x545e('0x41'));_0x4327c7[_0x545e('0x42')]=util[_0x545e('0xd')](_0x545e('0x43'),_0x21b097[_0x545e('0x3f')],_0x4327c7[_0x545e('0x44')],md5(_0x4327c7['uniqueid']));}else{_0x4327c7[_0x545e('0x42')]='';}headers['Authorization']=getAuth(_0x21b097);return getUser(_0x21b097,'')[_0x545e('0x1a')](function(_0x16e68e){_0x507beb=_0x16e68e;logger[_0x545e('0xa')](_0x545e('0x46'),_0x507beb['id']);return getEndUser(_0x21b097,_0x4327c7[_0x545e('0xf')],_0x4327c7[_0x545e('0x47')]);})['then'](function(_0x5ec428){_0x28468f=_0x5ec428;logger[_0x545e('0xa')](_0x545e('0x48'),_0x28468f['id']);return getTicket(_0x21b097,_0x507beb,_0x28468f,_0xc53939,_0x4327c7);})[_0x545e('0x1a')](function(_0x46624a){if(_0x46624a){logger[_0x545e('0xa')](_0x545e('0x1b'));logger[_0x545e('0xa')]('The\x20Ticket\x20ID\x20is:',_0x46624a['id']);}})[_0x545e('0x58')](function(_0x209fa3){logger[_0x545e('0x59')]('['+_0x4327c7[_0x545e('0x56')][_0x545e('0x57')]()+']',JSON[_0x545e('0x4e')](_0x209fa3));});}; \ 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 05969a7..01b0328 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 _0x28e3=['stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','headers','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','Admin\x20selected','/api/lookup?q=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','/contacts/','user:%s','trigger:browser:url','apiKey','remoteUri'];(function(_0x1a4062,_0x129006){var _0x1637f1=function(_0xb601e9){while(--_0xb601e9){_0x1a4062['push'](_0x1a4062['shift']());}};_0x1637f1(++_0x129006);}(_0x28e3,0x106));var _0x328e=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x28e3[_0x26d6d9];return _0x1b4875;};'use strict';var _=require(_0x328e('0x0'));var rp=require(_0x328e('0x1'));var md5=require(_0x328e('0x2'));var util=require(_0x328e('0x3'));var moment=require('moment');var Promise=require(_0x328e('0x4'));var Redis=require(_0x328e('0x5'));var intUtil=require(_0x328e('0x6'));var config=require(_0x328e('0x7'));var logger=require(_0x328e('0x8'))(_0x328e('0x9'));config[_0x328e('0xa')]=_[_0x328e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x328e('0xa')]));function getAdminId(_0x3696b6,_0x3467ee,_0x6a5414,_0x1bc607){return new Promise(function(_0x4a4f53,_0x30af7c){var _0x1b3bb8=![];var _0x2d58e9={'method':'GET','uri':_0x1bc607+'/api/selector/owners','json':!![]};_0x2d58e9['headers']=_0x6a5414;logger[_0x328e('0xc')](_0x328e('0xd'));return rp(_0x2d58e9)[_0x328e('0xe')](function(_0x1c7294){if(_0x1c7294){var _0x32e15b=_0x1c7294[_0x328e('0xf')];var _0x4699ec=null;for(_0x4699ec=0x0;_0x4699ec<_0x32e15b[_0x328e('0x10')];_0x4699ec++){if(_0x32e15b[_0x4699ec][_0x328e('0x11')]===_0x3696b6[_0x328e('0x12')]){_0x3696b6[_0x328e('0x13')]=_0x32e15b[_0x4699ec]['id'];_0x1b3bb8=!![];}}if(_0x1b3bb8){logger['info'](_0x328e('0x14'),_0x3696b6[_0x328e('0x13')]);_0x4a4f53(_0x3696b6);}else{_0x30af7c({'statusCode':0x194,'message':_0x328e('0x15')});}}else{_0x30af7c({'statusCode':0x194,'message':_0x328e('0x15')});}})[_0x328e('0x16')](function(_0x397b16){logger[_0x328e('0x17')]('['+[_0x3467ee[_0x328e('0x18')]()]+']',_0x397b16[_0x328e('0x19')]);_0x30af7c(_0x397b16);});});}function getUser(_0x50f970,_0x1fdb79,_0x2d2197){return function(_0x116f46){return new Promise(function(_0x1adadc,_0xf69c0f){var _0x32c7c8={'method':_0x328e('0x1a'),'uri':_0x2d2197+'/api/selector/owners','json':!![]};_0x32c7c8[_0x328e('0x1b')]=_0x1fdb79;logger[_0x328e('0xc')](_0x328e('0x1c'));return rp(_0x32c7c8)[_0x328e('0xe')](function(_0x2af341){if(_0x2af341){var _0x5bf2a7=_0x2af341[_0x328e('0xf')];var _0x1c5551=![];var _0x3d876b=null;if(_0x116f46['agentEmail']!==null){logger[_0x328e('0xc')](_0x328e('0x1d'),_0x116f46[_0x328e('0x1e')]);_0x116f46[_0x328e('0x1f')]=_0x116f46[_0x328e('0x1e')];for(_0x3d876b=0x0;_0x3d876b<_0x5bf2a7[_0x328e('0x10')];_0x3d876b++){if(_0x5bf2a7[_0x3d876b][_0x328e('0x11')]===_0x116f46[_0x328e('0x1e')]){_0x1c5551=!![];_0x116f46[_0x328e('0x20')]=_0x5bf2a7[_0x3d876b]['id'];logger['info']('User\x20found:',_0x116f46[_0x328e('0x20')]);}}}if(!_0x1c5551){logger[_0x328e('0xc')](_0x328e('0x21'));_0x116f46[_0x328e('0x1f')]=_0x116f46[_0x328e('0x12')];_0x116f46['userId']=_0x116f46[_0x328e('0x13')];_0x1c5551=!![];}if(_0x1c5551){_0x1adadc(_0x116f46);}else{_0xf69c0f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xf69c0f({'statusCode':0x194,'message':_0x328e('0x15')});}})[_0x328e('0x16')](function(_0x28da22){logger[_0x328e('0x17')]('['+[_0x50f970[_0x328e('0x18')]()]+']',_0x28da22['message']);_0xf69c0f(_0x28da22);});});};}function searchContact(_0x4ebda7,_0x3bd897,_0x54e70a,_0x5d9172){return new Promise(function(_0xf80664,_0x270d58){var _0x5873d1={'method':_0x328e('0x1a'),'headers':_0x3bd897,'uri':_0x4ebda7+_0x328e('0x22')+_0x5d9172+'&f='+_0x54e70a+_0x328e('0x23'),'json':!![]};rp(_0x5873d1)[_0x328e('0xe')](function(_0x2b5589){var _0x2304b6=_[_0x328e('0x24')](_0x2b5589['contacts'][_0x328e('0x25')],[_0x54e70a,_0x5d9172]);_0xf80664(_0x2304b6);})[_0x328e('0x16')](function(_0x3da580){_0x270d58(_0x3da580);});});}function getEndUser(_0x35f27e,_0x3b4b9d,_0x10a004){return function(_0x37ba2e){return new Promise(function(_0x123099,_0xeb04ba){logger['info'](util['format'](_0x328e('0x26'),_0x37ba2e[_0x328e('0x27')]));searchContact(_0x10a004,_0x3b4b9d,'mobile_number',_0x37ba2e['contactNumber'])['then'](function(_0xba5335){if(_0xba5335){_0x37ba2e[_0x328e('0x28')]=_0xba5335['id'];logger[_0x328e('0xc')](_0x328e('0x29'),_0x37ba2e[_0x328e('0x28')]);return _0x123099(_0x37ba2e);}searchContact(_0x10a004,_0x3b4b9d,_0x328e('0x2a'),_0x37ba2e[_0x328e('0x27')])['then'](function(_0x27ed20){if(_0x27ed20){_0x37ba2e['endUserId']=_0x27ed20['id'];logger['info'](_0x328e('0x2b'),_0x37ba2e['endUserId']);return _0x123099(_0x37ba2e);}createEndUser(_0x37ba2e,_0x35f27e,_0x3b4b9d,_0x10a004)[_0x328e('0xe')](function(_0x3d131d){logger[_0x328e('0xc')]('Contact\x20created:',_0x3d131d[_0x328e('0x28')]);return _0x123099(_0x3d131d);});});})['catch'](function(_0x2ba70c){_0xeb04ba(_0x2ba70c);});});};}function createEndUser(_0x38ebdc,_0x4702a2,_0x37e5d4,_0x561a7d){return new Promise(function(_0x3bdfa3,_0x5ca1fe){var _0x2ebb87=moment();var _0x4bed66={'method':'POST','uri':_0x561a7d+_0x328e('0x2c'),'body':{'contact':{'last_name':_0x38ebdc['contactNumber'],'work_number':_0x38ebdc[_0x328e('0x27')],'mobile_number':_0x38ebdc[_0x328e('0x27')],'owner_id':_0x38ebdc[_0x328e('0x20')],'created_at':_0x2ebb87[_0x328e('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4bed66[_0x328e('0x1b')]=_0x37e5d4;logger[_0x328e('0xc')](_0x328e('0x2e'));return rp(_0x4bed66)[_0x328e('0xe')](function(_0x164792){_0x38ebdc['endUserId']=_0x164792[_0x328e('0x2f')]['id'];_0x3bdfa3(_0x38ebdc);})[_0x328e('0x16')](function(_0x67b222){logger['error']('['+[_0x4702a2['toUpperCase']()]+']',_0x67b222['message']);_0x5ca1fe(_0x67b222[_0x328e('0x19')]);});});}function getTicket(_0x5e1938,_0x3dbeec,_0x1fba32,_0x572802,_0x4f7aac){return function(_0x9a4e93){logger[_0x328e('0xc')](_0x328e('0x30'));return new Promise(function(_0xc79a52,_0x67669c){var _0x1aa08b=moment();var _0x2e06f1={'method':_0x328e('0x31'),'uri':_0x1fba32+_0x328e('0x32'),'body':{'title':intUtil[_0x328e('0x33')](_0x572802[_0x328e('0x34')],_0x4f7aac,'\x20'),'description':intUtil[_0x328e('0x33')](_0x572802['Descriptions'],_0x4f7aac,'\x0a'),'owner_id':_0x9a4e93[_0x328e('0x20')],'creater_id':_0x9a4e93['adminId'],'targetable_id':_0x9a4e93['endUserId'],'targetable_type':_0x328e('0x35'),'created_at':_0x1aa08b[_0x328e('0x2d')](_0x328e('0x36')),'due_date':_0x1aa08b['add'](0x1e,'m')[_0x328e('0x2d')](_0x328e('0x36'))},'json':!![]};_0x2e06f1[_0x328e('0x1b')]=_0x3dbeec;return rp(_0x2e06f1)[_0x328e('0xe')](function(_0x330c1b){_0x9a4e93[_0x328e('0x37')]=_0x330c1b[_0x328e('0x38')]['id'];logger['info']('Task\x20created:',_0x9a4e93[_0x328e('0x37')]);_0xc79a52(_0x9a4e93);})[_0x328e('0x16')](function(_0x59a964){logger[_0x328e('0x17')]('['+[_0x5e1938[_0x328e('0x18')]()]+']',_0x59a964[_0x328e('0x19')]);_0x67669c(_0x59a964['message']);});});};}function emit(_0x42ee2e,_0x242fac,_0x41d529){var _0x4534ee={'uri':_0x42ee2e+_0x328e('0x39')+_0x41d529};io['to'](util[_0x328e('0x2d')](_0x328e('0x3a'),_0x242fac))['emit'](_0x328e('0x3b'),_0x4534ee);}exports['cs']=function(_0x13ac38,_0x44470b,_0x597769,_0x1aa84f,_0x1667d5,_0xf05042,_0x9e06a3,_0x1532d7){var _0x294945={};var _0x2b83bd={'Authorization':'Token\x20token='+_0xf05042[_0x328e('0x3c')]};_0xf05042[_0x328e('0x3d')]=intUtil[_0x328e('0x3e')](_0xf05042[_0x328e('0x3d')]);_0xf05042[_0x328e('0x3f')]=intUtil[_0x328e('0x3e')](_0xf05042[_0x328e('0x3f')]);var _0x49923e=_0xf05042['remoteUri'];_0x294945['adminEmail']=_0xf05042[_0x328e('0x40')];_0x294945[_0x328e('0x27')]=_0x1532d7[_0x328e('0x41')]()===_0x328e('0x42')?_0x44470b['destcalleridnum']:_0x44470b[_0x328e('0x43')];_0x294945['callDirection']=_0x1532d7===_0x328e('0x44')||_0x1532d7===_0x328e('0x45')?_0x328e('0x44'):_0x328e('0x42');if(_0x1aa84f){_0x294945[_0x328e('0x1e')]=_0x1aa84f[_0x328e('0x11')];}var _0x5c5408=util[_0x328e('0x2d')](_0x328e('0x46'),_0xf05042[_0x328e('0x3f')],_0x44470b[_0x328e('0x47')],md5(_0x44470b['uniqueid']));if(_0x1667d5&&_0x1667d5['monitor_format']){logger[_0x328e('0xc')](_0x328e('0x48'),_0x328e('0x49'));_0x44470b[_0x328e('0x4a')]=_0x5c5408;}else if(_0x9e06a3&&_0x9e06a3['recordingFormat']&&_0x9e06a3['recordingFormat']!=='none'){logger[_0x328e('0xc')](_0x328e('0x4b'),_0x328e('0x49'));_0x44470b[_0x328e('0x4a')]=_0x5c5408;}else{_0x44470b[_0x328e('0x4a')]='';}return getAdminId(_0x294945,_0x1532d7,_0x2b83bd,_0x49923e)[_0x328e('0xe')](getUser(_0x1532d7,_0x2b83bd,_0x49923e))[_0x328e('0xe')](getEndUser(_0x1532d7,_0x2b83bd,_0x49923e))[_0x328e('0xe')](getTicket(_0x1532d7,_0x2b83bd,_0x49923e,_0x597769,_0x44470b))[_0x328e('0xe')](function(_0x388540){logger[_0x328e('0xc')](util[_0x328e('0x2d')](_0x328e('0x4c'),_0x388540[_0x328e('0x37')]));if(_0x1532d7!=='unmanaged'){logger['info']('['+[_0x1532d7['toUpperCase']()]+']',_0x328e('0x4d'));emit(_0x49923e,_0x1aa84f[_0x328e('0x4e')],_0x388540[_0x328e('0x28')]);}})['catch'](function(_0x1fb5bd){logger[_0x328e('0x17')]('['+[_0x1532d7[_0x328e('0x18')]()]+_0x328e('0x4f'),util[_0x328e('0x50')](_0x1fb5bd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa786=['task','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','length','email','adminEmail','adminId','Admin\x20found:','catch','error','message','Getting\x20user\x20list','users','agentEmail','userId','User\x20found:','Admin\x20selected','userEmail','Requested\x20Resource\x20not\x20Found','&f=','&entities=contact','contacts','format','contactNumber','mobile_number','then','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add'];(function(_0x29b1d3,_0x394555){var _0x2bd136=function(_0x39d61c){while(--_0x39d61c){_0x29b1d3['push'](_0x29b1d3['shift']());}};_0x2bd136(++_0x394555);}(_0xa786,0x1d2));var _0x6a78=function(_0x7dd646,_0x5ef852){_0x7dd646=_0x7dd646-0x0;var _0x4120ff=_0xa786[_0x7dd646];return _0x4120ff;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var Promise=require(_0x6a78('0x3'));var Redis=require(_0x6a78('0x4'));var intUtil=require(_0x6a78('0x5'));var config=require(_0x6a78('0x6'));var logger=require('../../../../config/logger')(_0x6a78('0x7'));config[_0x6a78('0x8')]=_[_0x6a78('0x9')](config[_0x6a78('0x8')],{'host':_0x6a78('0xa'),'port':0x18eb});var io=require(_0x6a78('0xb'))(new Redis(config[_0x6a78('0x8')]));function getAdminId(_0x2a6de6,_0x25db5e,_0x1e7351,_0x4735d9){return new Promise(function(_0x33e71c,_0x306116){var _0x2fb93e=![];var _0x2ff853={'method':_0x6a78('0xc'),'uri':_0x4735d9+_0x6a78('0xd'),'json':!![]};_0x2ff853[_0x6a78('0xe')]=_0x1e7351;logger[_0x6a78('0xf')]('Getting\x20admin\x20information');return rp(_0x2ff853)['then'](function(_0x1aca08){if(_0x1aca08){var _0x1e4c84=_0x1aca08['users'];var _0x20fd59=null;for(_0x20fd59=0x0;_0x20fd59<_0x1e4c84[_0x6a78('0x10')];_0x20fd59++){if(_0x1e4c84[_0x20fd59][_0x6a78('0x11')]===_0x2a6de6[_0x6a78('0x12')]){_0x2a6de6[_0x6a78('0x13')]=_0x1e4c84[_0x20fd59]['id'];_0x2fb93e=!![];}}if(_0x2fb93e){logger[_0x6a78('0xf')](_0x6a78('0x14'),_0x2a6de6['adminId']);_0x33e71c(_0x2a6de6);}else{_0x306116({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x306116({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6a78('0x15')](function(_0x2deaa9){logger[_0x6a78('0x16')]('['+[_0x25db5e['toUpperCase']()]+']',_0x2deaa9[_0x6a78('0x17')]);_0x306116(_0x2deaa9);});});}function getUser(_0x428060,_0x5b5a5d,_0x304193){return function(_0x136df2){return new Promise(function(_0x3f8fab,_0x44f646){var _0x3f24ac={'method':_0x6a78('0xc'),'uri':_0x304193+_0x6a78('0xd'),'json':!![]};_0x3f24ac[_0x6a78('0xe')]=_0x5b5a5d;logger['info'](_0x6a78('0x18'));return rp(_0x3f24ac)['then'](function(_0x216365){if(_0x216365){var _0xee82ac=_0x216365[_0x6a78('0x19')];var _0x5d135e=![];var _0x3e0dfc=null;if(_0x136df2['agentEmail']!==null){logger[_0x6a78('0xf')]('Getting\x20user\x20with\x20email',_0x136df2[_0x6a78('0x1a')]);_0x136df2['userEmail']=_0x136df2[_0x6a78('0x1a')];for(_0x3e0dfc=0x0;_0x3e0dfc<_0xee82ac['length'];_0x3e0dfc++){if(_0xee82ac[_0x3e0dfc]['email']===_0x136df2['agentEmail']){_0x5d135e=!![];_0x136df2[_0x6a78('0x1b')]=_0xee82ac[_0x3e0dfc]['id'];logger[_0x6a78('0xf')](_0x6a78('0x1c'),_0x136df2['userId']);}}}if(!_0x5d135e){logger[_0x6a78('0xf')](_0x6a78('0x1d'));_0x136df2[_0x6a78('0x1e')]=_0x136df2[_0x6a78('0x12')];_0x136df2['userId']=_0x136df2[_0x6a78('0x13')];_0x5d135e=!![];}if(_0x5d135e){_0x3f8fab(_0x136df2);}else{_0x44f646({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x44f646({'statusCode':0x194,'message':_0x6a78('0x1f')});}})[_0x6a78('0x15')](function(_0x8e8513){logger[_0x6a78('0x16')]('['+[_0x428060['toUpperCase']()]+']',_0x8e8513[_0x6a78('0x17')]);_0x44f646(_0x8e8513);});});};}function searchContact(_0x2c1893,_0x4ce883,_0x409a9a,_0x526a94){return new Promise(function(_0x297708,_0x48c692){var _0x20a593={'method':_0x6a78('0xc'),'headers':_0x4ce883,'uri':_0x2c1893+'/api/lookup?q='+_0x526a94+_0x6a78('0x20')+_0x409a9a+_0x6a78('0x21'),'json':!![]};rp(_0x20a593)['then'](function(_0x1d235d){var _0x216686=_['find'](_0x1d235d[_0x6a78('0x22')][_0x6a78('0x22')],[_0x409a9a,_0x526a94]);_0x297708(_0x216686);})[_0x6a78('0x15')](function(_0xa40d44){_0x48c692(_0xa40d44);});});}function getEndUser(_0x816c52,_0x2c8074,_0x5ee643){return function(_0x584243){return new Promise(function(_0x462c2d,_0x3722a5){logger['info'](util[_0x6a78('0x23')]('Searching\x20contact\x20with\x20phone\x20%s',_0x584243[_0x6a78('0x24')]));searchContact(_0x5ee643,_0x2c8074,_0x6a78('0x25'),_0x584243['contactNumber'])[_0x6a78('0x26')](function(_0x784e39){if(_0x784e39){_0x584243['endUserId']=_0x784e39['id'];logger[_0x6a78('0xf')]('Contact\x20found\x20mobile_number:',_0x584243[_0x6a78('0x27')]);return _0x462c2d(_0x584243);}searchContact(_0x5ee643,_0x2c8074,_0x6a78('0x28'),_0x584243['contactNumber'])['then'](function(_0x314775){if(_0x314775){_0x584243[_0x6a78('0x27')]=_0x314775['id'];logger[_0x6a78('0xf')](_0x6a78('0x29'),_0x584243['endUserId']);return _0x462c2d(_0x584243);}createEndUser(_0x584243,_0x816c52,_0x2c8074,_0x5ee643)['then'](function(_0x239f07){logger['info'](_0x6a78('0x2a'),_0x239f07[_0x6a78('0x27')]);return _0x462c2d(_0x239f07);});});})['catch'](function(_0x6fb89c){_0x3722a5(_0x6fb89c);});});};}function createEndUser(_0x580aad,_0x14953c,_0x29d375,_0x4aa1bb){return new Promise(function(_0xced133,_0x5ca493){var _0x2ff638=moment();var _0x227cab={'method':_0x6a78('0x2b'),'uri':_0x4aa1bb+_0x6a78('0x2c'),'body':{'contact':{'last_name':_0x580aad[_0x6a78('0x24')],'work_number':_0x580aad[_0x6a78('0x24')],'mobile_number':_0x580aad[_0x6a78('0x24')],'owner_id':_0x580aad[_0x6a78('0x1b')],'created_at':_0x2ff638[_0x6a78('0x23')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x227cab[_0x6a78('0xe')]=_0x29d375;logger[_0x6a78('0xf')](_0x6a78('0x2d'));return rp(_0x227cab)[_0x6a78('0x26')](function(_0x2d0367){_0x580aad[_0x6a78('0x27')]=_0x2d0367[_0x6a78('0x2e')]['id'];_0xced133(_0x580aad);})[_0x6a78('0x15')](function(_0x2a0a5e){logger[_0x6a78('0x16')]('['+[_0x14953c[_0x6a78('0x2f')]()]+']',_0x2a0a5e['message']);_0x5ca493(_0x2a0a5e[_0x6a78('0x17')]);});});}function getTicket(_0x4dda58,_0x2abd5d,_0x3cdfdb,_0x3b9db8,_0x576a28){return function(_0x221f6f){logger[_0x6a78('0xf')](_0x6a78('0x30'));return new Promise(function(_0x68f3fa,_0x31cfbc){var _0x10a94c=moment();var _0x1e6efd={'method':_0x6a78('0x2b'),'uri':_0x3cdfdb+_0x6a78('0x31'),'body':{'title':intUtil[_0x6a78('0x32')](_0x3b9db8[_0x6a78('0x33')],_0x576a28,'\x20'),'description':intUtil[_0x6a78('0x32')](_0x3b9db8[_0x6a78('0x34')],_0x576a28,'\x0a'),'owner_id':_0x221f6f[_0x6a78('0x1b')],'creater_id':_0x221f6f[_0x6a78('0x13')],'targetable_id':_0x221f6f['endUserId'],'targetable_type':_0x6a78('0x35'),'created_at':_0x10a94c[_0x6a78('0x23')](_0x6a78('0x36')),'due_date':_0x10a94c[_0x6a78('0x37')](0x1e,'m')[_0x6a78('0x23')](_0x6a78('0x36'))},'json':!![]};_0x1e6efd[_0x6a78('0xe')]=_0x2abd5d;return rp(_0x1e6efd)[_0x6a78('0x26')](function(_0x1082d6){_0x221f6f['ticketId']=_0x1082d6[_0x6a78('0x38')]['id'];logger[_0x6a78('0xf')]('Task\x20created:',_0x221f6f[_0x6a78('0x39')]);_0x68f3fa(_0x221f6f);})[_0x6a78('0x15')](function(_0x35eb86){logger[_0x6a78('0x16')]('['+[_0x4dda58[_0x6a78('0x2f')]()]+']',_0x35eb86['message']);_0x31cfbc(_0x35eb86[_0x6a78('0x17')]);});});};}function emit(_0x599550,_0x246dec,_0x25a48e){var _0x1f42c7={'uri':_0x599550+_0x6a78('0x3a')+_0x25a48e};io['to'](util[_0x6a78('0x23')](_0x6a78('0x3b'),_0x246dec))[_0x6a78('0x3c')](_0x6a78('0x3d'),_0x1f42c7);}exports['cs']=function(_0xede538,_0x2defe8,_0x2ff32c,_0x5087a1,_0x46669f,_0xa4f975,_0x2aaa4d,_0x5a64e0){var _0x4400f1={};var _0x2d6c73={'Authorization':_0x6a78('0x3e')+_0xa4f975[_0x6a78('0x3f')]};_0xa4f975[_0x6a78('0x40')]=intUtil[_0x6a78('0x41')](_0xa4f975['remoteUri']);_0xa4f975['serverUrl']=intUtil['stripTrailingSlash'](_0xa4f975[_0x6a78('0x42')]);var _0x24fe9b=_0xa4f975[_0x6a78('0x40')];_0x4400f1[_0x6a78('0x12')]=_0xa4f975[_0x6a78('0x43')];_0x4400f1[_0x6a78('0x24')]=_0x5a64e0[_0x6a78('0x44')]()===_0x6a78('0x45')?_0x2defe8[_0x6a78('0x46')]:_0x2defe8[_0x6a78('0x47')];_0x4400f1[_0x6a78('0x48')]=_0x5a64e0===_0x6a78('0x49')||_0x5a64e0===_0x6a78('0x4a')?_0x6a78('0x49'):_0x6a78('0x45');if(_0x5087a1){_0x4400f1[_0x6a78('0x1a')]=_0x5087a1[_0x6a78('0x11')];}var _0x57be29=util[_0x6a78('0x23')](_0x6a78('0x4b'),_0xa4f975['serverUrl'],_0x2defe8['uniqueid'],md5(_0x2defe8[_0x6a78('0x4c')]));if(_0x46669f&&_0x46669f['monitor_format']){logger['info'](_0x6a78('0x4d'),_0x6a78('0x4e'));_0x2defe8[_0x6a78('0x4f')]=_0x57be29;}else if(_0x2aaa4d&&_0x2aaa4d[_0x6a78('0x50')]&&_0x2aaa4d[_0x6a78('0x50')]!==_0x6a78('0x51')){logger['info'](_0x6a78('0x52'),_0x6a78('0x4e'));_0x2defe8[_0x6a78('0x4f')]=_0x57be29;}else{_0x2defe8[_0x6a78('0x4f')]='';}return getAdminId(_0x4400f1,_0x5a64e0,_0x2d6c73,_0x24fe9b)[_0x6a78('0x26')](getUser(_0x5a64e0,_0x2d6c73,_0x24fe9b))['then'](getEndUser(_0x5a64e0,_0x2d6c73,_0x24fe9b))['then'](getTicket(_0x5a64e0,_0x2d6c73,_0x24fe9b,_0x2ff32c,_0x2defe8))[_0x6a78('0x26')](function(_0x45cb10){logger[_0x6a78('0xf')](util['format'](_0x6a78('0x53'),_0x45cb10[_0x6a78('0x39')]));if(_0x5a64e0!==_0x6a78('0x4a')){logger[_0x6a78('0xf')]('['+[_0x5a64e0[_0x6a78('0x2f')]()]+']',_0x6a78('0x54'));emit(_0x24fe9b,_0x5087a1['name'],_0x45cb10[_0x6a78('0x27')]);}})['catch'](function(_0x5795b7){logger['error']('['+[_0x5a64e0[_0x6a78('0x2f')]()]+_0x6a78('0x55'),util[_0x6a78('0x56')](_0x5795b7,{'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 e0c4f32..ad3de55 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 _0x36ee=['zoho','vtiger','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged'];(function(_0x206829,_0x1643d0){var _0x29a8d1=function(_0x30123f){while(--_0x30123f){_0x206829['push'](_0x206829['shift']());}};_0x29a8d1(++_0x1643d0);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0xe36e('0x0'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe36e('0x1'));var freshdesk=require(_0xe36e('0x2'));var zoho=require(_0xe36e('0x3'));var desk=require(_0xe36e('0x4'));var vtiger=require(_0xe36e('0x5'));var servicenow=require(_0xe36e('0x6'));var dynamics365=require(_0xe36e('0x7'));var freshsales=require(_0xe36e('0x8'));var integrations=[_0xe36e('0x9'),_0xe36e('0xa'),_0xe36e('0xb'),_0xe36e('0xc'),'zoho',_0xe36e('0xd'),'vtiger',_0xe36e('0xe'),_0xe36e('0xf'),_0xe36e('0x10')];exports['exec']=function(_0xf119e4,_0x48981b,_0x2e968d,_0x2133cf,_0x43d604,_0x2ad6fd){if(_0x2e968d){if(_[_0xe36e('0x11')](integrations,_0xf119e4[_0xe36e('0x12')][_0xe36e('0x13')]())){try{var _0x265473=null;var _0x4fbdb2='';var _0x32981d=_0x2e968d[_0xf119e4[_0xe36e('0x12')][_0xe36e('0x13')]()];if(_0x32981d){var _0x1fdea2=_0x32981d[_0xf119e4['data2']];if(_0x1fdea2){var _0x3e264a=_['find'](_0x1fdea2['Configurations'],{'id':parseInt(_0xf119e4[_0xe36e('0x14')],0xa)});if(_0x3e264a){if(_0x2133cf){if(_0x43d604&&_0x48981b[_0xe36e('0x15')]){_0x4fbdb2=_0xe36e('0x15');}else if(_0x48981b[_0xe36e('0x16')]){_0x4fbdb2=_0xe36e('0x17');}else{console[_0xe36e('0x18')](_0xe36e('0x19'),_0x48981b);}}else{_0x4fbdb2=_0xe36e('0x1a');}switch(_0xf119e4[_0xe36e('0x12')][_0xe36e('0x13')]()){case'zendesk':zendesk[_0x4fbdb2](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd);break;case _0xe36e('0xa'):salesforce[_0x4fbdb2](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd);break;case _0xe36e('0xb'):sugarcrm[_0x4fbdb2](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd);break;case'freshdesk':freshdesk[_0x4fbdb2](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd);break;case _0xe36e('0x1b'):zoho[_0x4fbdb2](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd);break;case'desk':desk[_0x4fbdb2](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd);break;case _0xe36e('0x1c'):vtiger[_0x4fbdb2](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd);break;case _0xe36e('0xf'):freshsales['cs'](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd,_0x4fbdb2);break;case'servicenow':servicenow['cs'](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd,_0x4fbdb2);break;case _0xe36e('0xe'):dynamics365['cs'](_0xf119e4,_0x48981b,_0x3e264a,_0x2133cf,_0x43d604,_0x1fdea2,_0x2ad6fd,_0x4fbdb2);break;default:console[_0xe36e('0x18')](_0xe36e('0x1d'));}}else{_0x265473=require('../../../../config/logger')(_0xf119e4[_0xe36e('0x12')][_0xe36e('0x13')]());_0x265473[_0xe36e('0x1e')](_0xe36e('0x1f'),util[_0xe36e('0x20')](_0xe36e('0x21'),_0xf119e4['data1'][_0xe36e('0x13')](),_0xf119e4[_0xe36e('0x14')]));}}else{_0x265473=require(_0xe36e('0x22'))(_0xf119e4[_0xe36e('0x12')][_0xe36e('0x13')]());_0x265473['error']('[EXEC]',util[_0xe36e('0x20')](_0xe36e('0x23'),_0xf119e4[_0xe36e('0x12')][_0xe36e('0x13')](),_0xf119e4[_0xe36e('0x24')]));}}else{}}catch(_0x1507f9){console[_0xe36e('0x1e')](_0x1507f9);}}}}; \ No newline at end of file +var _0xd7d1=['desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','outbound','log','unmanaged','salesforce','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x3deb01,_0x21b013){_0x3deb01=_0x3deb01-0x0;var _0x41a45e=_0xd7d1[_0x3deb01];return _0x41a45e;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var zendesk=require(_0x1d7d('0x2'));var salesforce=require(_0x1d7d('0x3'));var sugarcrm=require(_0x1d7d('0x4'));var freshdesk=require(_0x1d7d('0x5'));var zoho=require(_0x1d7d('0x6'));var desk=require(_0x1d7d('0x7'));var vtiger=require(_0x1d7d('0x8'));var servicenow=require(_0x1d7d('0x9'));var dynamics365=require(_0x1d7d('0xa'));var freshsales=require(_0x1d7d('0xb'));var integrations=[_0x1d7d('0xc'),'salesforce',_0x1d7d('0xd'),_0x1d7d('0xe'),_0x1d7d('0xf'),_0x1d7d('0x10'),_0x1d7d('0x11'),_0x1d7d('0x12'),_0x1d7d('0x13'),_0x1d7d('0x14')];exports[_0x1d7d('0x15')]=function(_0x8b258b,_0x2765fe,_0x547f7b,_0xe6b9eb,_0x4c6809,_0x3cbca9){if(_0x547f7b){if(_[_0x1d7d('0x16')](integrations,_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]())){try{var _0x5c7445=null;var _0x11b83f='';var _0x5ae1c9=_0x547f7b[_0x8b258b['data1'][_0x1d7d('0x18')]()];if(_0x5ae1c9){var _0x4049be=_0x5ae1c9[_0x8b258b['data2']];if(_0x4049be){var _0x55dba7=_[_0x1d7d('0x19')](_0x4049be[_0x1d7d('0x1a')],{'id':parseInt(_0x8b258b[_0x1d7d('0x1b')],0xa)});if(_0x55dba7){if(_0xe6b9eb){if(_0x4c6809&&_0x2765fe[_0x1d7d('0x1c')]){_0x11b83f=_0x1d7d('0x1c');}else if(_0x2765fe['routeId']){_0x11b83f=_0x1d7d('0x1d');}else{console[_0x1d7d('0x1e')]('EVENT\x20UNKNOWN',_0x2765fe);}}else{_0x11b83f=_0x1d7d('0x1f');}switch(_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]()){case _0x1d7d('0xc'):zendesk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0x20'):salesforce[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'sugarcrm':sugarcrm[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0xe'):freshdesk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0xf'):zoho[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'desk':desk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'vtiger':vtiger[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0x13'):freshsales['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;case _0x1d7d('0x14'):servicenow['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;case _0x1d7d('0x12'):dynamics365['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;default:console[_0x1d7d('0x1e')](_0x1d7d('0x21'));}}else{_0x5c7445=require(_0x1d7d('0x22'))(_0x8b258b['data1'][_0x1d7d('0x18')]());_0x5c7445[_0x1d7d('0x23')](_0x1d7d('0x24'),util['format'](_0x1d7d('0x25'),_0x8b258b[_0x1d7d('0x17')]['toLowerCase'](),_0x8b258b['data3']));}}else{_0x5c7445=require(_0x1d7d('0x22'))(_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]());_0x5c7445['error'](_0x1d7d('0x24'),util[_0x1d7d('0x26')](_0x1d7d('0x27'),_0x8b258b[_0x1d7d('0x17')]['toLowerCase'](),_0x8b258b[_0x1d7d('0x28')]));}}else{}}catch(_0x151198){console['error'](_0x151198);}}}}; \ 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 b516c59..8172960 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 _0x3b4b=['uniqueid','recordingURL','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','Recording\x20is\x20enabled!','isNil','calleridname','lastevent',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','endUserType','contact','lead','WhoId','account','WhatId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','then','length','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','additionalSearchContact','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','merge','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]'];(function(_0x179dff,_0x6d4529){var _0x5a0fca=function(_0x195338){while(--_0x195338){_0x179dff['push'](_0x179dff['shift']());}};_0x5a0fca(++_0x6d4529);}(_0x3b4b,0x196));var _0xb3b4=function(_0x2e25cb,_0x5634b2){_0x2e25cb=_0x2e25cb-0x0;var _0x15614e=_0x3b4b[_0x2e25cb];return _0x15614e;};'use strict';var _=require('lodash');var rp=require(_0xb3b4('0x0'));var moment=require(_0xb3b4('0x1'));var BPromise=require(_0xb3b4('0x2'));var md5=require('md5');var jsforce=require(_0xb3b4('0x3'));var util=require(_0xb3b4('0x4'));var Redis=require('ioredis');var intUtil=require(_0xb3b4('0x5'));var config=require(_0xb3b4('0x6'));var logger=require(_0xb3b4('0x7'))(_0xb3b4('0x8'));config[_0xb3b4('0x9')]=_['defaults'](config[_0xb3b4('0x9')],{'host':_0xb3b4('0xa'),'port':0x18eb});var io=require(_0xb3b4('0xb'))(new Redis(config[_0xb3b4('0x9')]));function emit(_0x37191d,_0x4b73eb,_0x4a200a){io['to'](_0x37191d)['emit'](_0x4b73eb,_0x4a200a);}function getTicket(_0x55162c,_0xb9fd56,_0x1847e4,_0x27e115,_0x192bb5,_0x4877df,_0x3c77ca,_0x33616b){var _0x295188=Object[_0xb3b4('0xc')]({},{'OwnerId':_0xb9fd56['id'],'Subject':intUtil[_0xb3b4('0xd')](_0x27e115[_0xb3b4('0xe')],_0x192bb5,'\x20'),'Description':intUtil[_0xb3b4('0xd')](_0x27e115[_0xb3b4('0xf')],_0x192bb5,'\x0a')},getCustomFields(_0x4877df,_0x192bb5));if(_0x1847e4){if(_0x27e115[_0xb3b4('0x10')]===_0xb3b4('0x11')){_0x295188[_0xb3b4('0x12')]=moment[_0xb3b4('0x13')]();_0x295188['IsReminderSet']=![];_0x295188['IsRecurrence']=![];if(_0x1847e4[_0xb3b4('0x14')]===_0xb3b4('0x15')||_0x1847e4[_0xb3b4('0x14')]===_0xb3b4('0x16')){_0x295188[_0xb3b4('0x17')]=_0x1847e4['id'];}else if(_0x1847e4[_0xb3b4('0x14')]===_0xb3b4('0x18')){_0x295188[_0xb3b4('0x19')]=_0x1847e4['id'];}}else if(_0x27e115[_0xb3b4('0x10')]==='Case'){if(_0x1847e4[_0xb3b4('0x14')]===_0xb3b4('0x15')){_0x295188['ContactId']=_0x1847e4['id'];}else if(_0x1847e4[_0xb3b4('0x14')]===_0xb3b4('0x18')){_0x295188[_0xb3b4('0x1a')]=_0x1847e4['id'];}else if(_0x1847e4[_0xb3b4('0x14')]==='lead'&&_0x27e115[_0xb3b4('0x1b')]){_0x295188[_0x27e115[_0xb3b4('0x1b')]]=_0x1847e4['id'];}else{logger[_0xb3b4('0x1c')](_0xb3b4('0x1d'));}}}return _0x3c77ca[_0xb3b4('0x1e')](_0x27e115[_0xb3b4('0x10')])[_0xb3b4('0x1f')](_0x295188);}function getUser(_0x2d6910,_0x2fe2b4,_0x8b563b){if(!_['isNil'](_0x2fe2b4)&&intUtil['validateEmail'](_0x2fe2b4)){var _0x4c3505={'Email':_0x2fe2b4};var _0x55b520={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x8b563b['sobject'](_0xb3b4('0x20'))['find'](_0x4c3505,_0x55b520)['execute']()[_0xb3b4('0x21')](function(_0x3bd1b1){if(_0x3bd1b1[_0xb3b4('0x22')]){var _0x8d3544=_[_0xb3b4('0x23')](_0x3bd1b1,function(_0x4e32d4){return _0x4e32d4[_0xb3b4('0x24')]===_0x2fe2b4;});if(_0x8d3544){logger[_0xb3b4('0x1c')](_0xb3b4('0x25'),_0x2fe2b4);return BPromise[_0xb3b4('0x26')]({'id':_0x8d3544['Id'],'name':_0x8d3544[_0xb3b4('0x27')]});}}else{logger[_0xb3b4('0x1c')](_0xb3b4('0x28'),_0x2fe2b4);return _0x8b563b[_0xb3b4('0x29')]()[_0xb3b4('0x21')](function(_0x447f48){return BPromise[_0xb3b4('0x26')]({'id':_0x447f48[_0xb3b4('0x2a')],'name':_0x447f48[_0xb3b4('0x2b')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2fe2b4);return _0x8b563b[_0xb3b4('0x29')]()[_0xb3b4('0x21')](function(_0x39d62a){return BPromise[_0xb3b4('0x26')]({'id':_0x39d62a[_0xb3b4('0x2a')],'name':_0x39d62a[_0xb3b4('0x2b')]});});}}function getEndUser(_0x1b254b,_0x3b5077,_0x53e410,_0x15666c,_0x5485cb){var _0x4d48f6={'$or':{'Phone':_0x15666c}};var _0x1ea6ca={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb3b4('0x26')]()['then'](function(){logger[_0xb3b4('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x15666c,_0x3b5077[_0xb3b4('0x2c')]);switch(_0x3b5077['moduleSearch']){case'contact_lead':var _0x2df784=_['cloneDeep'](_0x4d48f6);if(_0x3b5077['additionalSearchContact']){var _0x528b10={};_0x528b10[_0x3b5077[_0xb3b4('0x2d')]]=_0x15666c;_['merge'](_0x2df784[_0xb3b4('0x2e')],_0x528b10);}return _0x5485cb[_0xb3b4('0x1e')](_0xb3b4('0x2f'))[_0xb3b4('0x23')](_0x2df784,_0x1ea6ca)[_0xb3b4('0x30')]()['then'](function(_0x38dfdf){if(_0x38dfdf&&_0x38dfdf[_0xb3b4('0x22')]){return _0x38dfdf;}else{var _0x1dcf2a=_[_0xb3b4('0x31')](_0x4d48f6);if(_0x3b5077[_0xb3b4('0x32')]){var _0x163189={};_0x163189[_0x3b5077[_0xb3b4('0x32')]]=_0x15666c;_['merge'](_0x1dcf2a[_0xb3b4('0x2e')],_0x163189);}return _0x5485cb[_0xb3b4('0x1e')](_0xb3b4('0x33'))[_0xb3b4('0x23')](_0x1dcf2a,_0x1ea6ca);}});case _0xb3b4('0x34'):var _0x3088d3=_[_0xb3b4('0x31')](_0x4d48f6);if(_0x3b5077[_0xb3b4('0x35')]){var _0x528b10={};_0x528b10[_0x3b5077[_0xb3b4('0x35')]]=_0x15666c;_['merge'](_0x3088d3[_0xb3b4('0x2e')],_0x528b10);}return _0x5485cb['sobject']('Account')['find'](_0x3088d3,_0x1ea6ca)[_0xb3b4('0x30')]()[_0xb3b4('0x21')](function(_0x51a74a){if(_0x51a74a&&_0x51a74a[_0xb3b4('0x22')]){return _0x51a74a;}else{var _0x352ae9=_[_0xb3b4('0x31')](_0x4d48f6);if(_0x3b5077['additionalSearchContact']){var _0x2d9c19={};_0x2d9c19[_0x3b5077[_0xb3b4('0x2d')]]=_0x15666c;_[_0xb3b4('0x36')](_0x352ae9[_0xb3b4('0x2e')],_0x2d9c19);}return _0x5485cb[_0xb3b4('0x1e')]('Contact')[_0xb3b4('0x23')](_0x352ae9,_0x1ea6ca)['then'](function(_0x1bb4d3){if(_0x1bb4d3&&_0x1bb4d3[_0xb3b4('0x22')]){return _0x1bb4d3;}else{var _0x3249a3=_['cloneDeep'](_0x4d48f6);if(_0x3b5077['additionalSearchLead']){var _0x5961a8={};_0x5961a8[_0x3b5077['additionalSearchLead']]=_0x15666c;_[_0xb3b4('0x36')](_0x3249a3['$or'],_0x5961a8);}return _0x5485cb[_0xb3b4('0x1e')](_0xb3b4('0x33'))[_0xb3b4('0x23')](_0x3249a3,_0x1ea6ca);}});}});case _0xb3b4('0x15'):var _0x2df784=_['cloneDeep'](_0x4d48f6);if(_0x3b5077[_0xb3b4('0x2d')]){var _0x528b10={};_0x528b10[_0x3b5077['additionalSearchContact']]=_0x15666c;_[_0xb3b4('0x36')](_0x2df784[_0xb3b4('0x2e')],_0x528b10);}return _0x5485cb['sobject'](_0xb3b4('0x2f'))[_0xb3b4('0x23')](_0x2df784,_0x1ea6ca)[_0xb3b4('0x30')]();case _0xb3b4('0x16'):var _0x36b659=_['cloneDeep'](_0x4d48f6);if(_0x3b5077[_0xb3b4('0x32')]){var _0x528b10={};_0x528b10[_0x3b5077[_0xb3b4('0x32')]]=_0x15666c;_[_0xb3b4('0x36')](_0x36b659[_0xb3b4('0x2e')],_0x528b10);}return _0x5485cb[_0xb3b4('0x1e')](_0xb3b4('0x33'))['find'](_0x36b659,_0x1ea6ca);case'account':var _0x3088d3=_[_0xb3b4('0x31')](_0x4d48f6);if(_0x3b5077[_0xb3b4('0x35')]){var _0x528b10={};_0x528b10[_0x3b5077[_0xb3b4('0x35')]]=_0x15666c;_[_0xb3b4('0x36')](_0x3088d3[_0xb3b4('0x2e')],_0x528b10);}return _0x5485cb[_0xb3b4('0x1e')](_0xb3b4('0x37'))[_0xb3b4('0x23')](_0x3088d3,_0x1ea6ca);default:return null;}})['then'](function(_0x3b3303){if(_0x3b3303&&_0x3b3303['length']){var _0x40043f=_[_0xb3b4('0x38')](_0x3b3303);if(_0x40043f){return BPromise[_0xb3b4('0x26')]({'id':_0x40043f['Id'],'name':_0x40043f[_0xb3b4('0x27')],'phone':_0x40043f[_0xb3b4('0x39')],'endUserType':_0x40043f[_0xb3b4('0x3a')][_0xb3b4('0x3b')][_0xb3b4('0x3c')]()});}}})['then'](function(_0x262d7e){if(_0x262d7e){logger[_0xb3b4('0x1c')](_0xb3b4('0x3d'),_0x262d7e[_0xb3b4('0x14')],_0x15666c);return BPromise[_0xb3b4('0x26')](_0x262d7e);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x15666c);var _0x80e890={'Phone':_0x15666c};if(_0x3b5077[_0xb3b4('0x3e')]){if(_0x3b5077[_0xb3b4('0x3e')]==='contact'){logger[_0xb3b4('0x1c')](_0xb3b4('0x3f'),_0x15666c,_0x3b5077[_0xb3b4('0x3e')]);_0x80e890[_0xb3b4('0x40')]=_0x53e410!==_0xb3b4('0x41')?_0x53e410:util[_0xb3b4('0x42')](_0xb3b4('0x43'),_0x15666c);}else if(_0x3b5077['moduleCreate']==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x15666c,_0x3b5077[_0xb3b4('0x3e')]);_0x80e890[_0xb3b4('0x40')]=_0x53e410!==_0xb3b4('0x41')?_0x53e410:util[_0xb3b4('0x42')](_0xb3b4('0x43'),_0x15666c);_0x80e890[_0xb3b4('0x44')]='No\x20Company';}else if(_0x3b5077[_0xb3b4('0x3e')]==='account'){logger['info'](_0xb3b4('0x3f'),_0x15666c,_0x3b5077[_0xb3b4('0x3e')]);_0x80e890[_0xb3b4('0x27')]=_0x53e410!==_0xb3b4('0x41')?_0x53e410:util[_0xb3b4('0x42')](_0xb3b4('0x43'),_0x15666c);}else{return null;}}return _0x5485cb[_0xb3b4('0x1e')](_[_0xb3b4('0x45')](_0x3b5077[_0xb3b4('0x3e')]))[_0xb3b4('0x1f')](_0x80e890)[_0xb3b4('0x21')](function(_0x4e937a){return BPromise[_0xb3b4('0x26')]({'id':_0x4e937a['id'],'endUserType':_0x3b5077[_0xb3b4('0x3e')]});});}});}function getCustomFields(_0x558abc,_0x883cc5){var _0x29976b={};if(_0x558abc[_0xb3b4('0x22')]>0x0){_[_0xb3b4('0x46')](_0x558abc,function(_0x41abd6){if(_[_0xb3b4('0x47')]([_0xb3b4('0x48'),_0xb3b4('0x49')],_0x41abd6[_0xb3b4('0x3b')])&&_0x41abd6['idField']){_0x29976b[_0x41abd6[_0xb3b4('0x4a')]]=_0x41abd6[_0xb3b4('0x4b')][_0xb3b4('0x4c')]();}else if(_0x41abd6[_0xb3b4('0x3b')]===_0xb3b4('0x4d')&&_0x41abd6['variableName']&&_0x41abd6[_0xb3b4('0x4a')]){_0x883cc5[_0x41abd6[_0xb3b4('0x4e')]]&&(_0x29976b[_0x41abd6[_0xb3b4('0x4a')]]=_0x883cc5[_0x41abd6[_0xb3b4('0x4e')]][_0xb3b4('0x4c')]());}else if(_0x41abd6[_0xb3b4('0x3b')]===_0xb3b4('0x4f')&&_0x41abd6[_0xb3b4('0x50')]&&_0x41abd6['Variable'][_0xb3b4('0x51')]&&_0x41abd6[_0xb3b4('0x4a')]){_0x883cc5[_0x41abd6['Variable']['name'][_0xb3b4('0x3c')]()]&&(_0x29976b[_0x41abd6[_0xb3b4('0x4a')]]=_0x883cc5[_0x41abd6[_0xb3b4('0x50')][_0xb3b4('0x51')][_0xb3b4('0x3c')]()][_0xb3b4('0x4c')]());}});}return _0x29976b;}function getConnection(_0x41cd41){var _0x512322=_0x41cd41[_0xb3b4('0x52')][_0xb3b4('0x53')](_0x41cd41['securityToken']);var _0x9603fd=new jsforce['Connection']({'oauth2':{'loginUrl':_0x41cd41[_0xb3b4('0x54')]||_0xb3b4('0x55'),'clientId':_0x41cd41['clientId'],'clientSecret':_0x41cd41[_0xb3b4('0x56')]}});return _0x9603fd[_0xb3b4('0x57')](_0x41cd41['username'],_0x512322)[_0xb3b4('0x21')](function(){logger[_0xb3b4('0x1c')](_0xb3b4('0x58'));return _0x9603fd;});}exports[_0xb3b4('0x59')]=function(_0x794da1,_0x5049c1,_0x6dbe35,_0x4b9ffe,_0xfa4b78,_0x10deb2){var _0x2b763e,_0x380677,_0x47a1f5,_0x4a407d;_0x10deb2[_0xb3b4('0x5a')]=intUtil[_0xb3b4('0x5b')](_0x10deb2[_0xb3b4('0x5a')]);_0x10deb2[_0xb3b4('0x54')]=intUtil[_0xb3b4('0x5b')](_0x10deb2[_0xb3b4('0x54')]);if(_0xfa4b78&&_0xfa4b78[_0xb3b4('0x5c')]){logger[_0xb3b4('0x1c')](_0xb3b4('0x5d'),'Recording\x20is\x20enabled!');_0x5049c1['recordingURL']=util[_0xb3b4('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10deb2[_0xb3b4('0x5a')],_0x5049c1[_0xb3b4('0x5e')],md5(_0x5049c1[_0xb3b4('0x5e')]));}else{_0x5049c1[_0xb3b4('0x5f')]='';}return getConnection(_0x10deb2)[_0xb3b4('0x21')](function(_0x16ed27){_0x4a407d=_0x16ed27;return getUser(_0x10deb2,_0x4b9ffe[_0xb3b4('0x60')],_0x4a407d);})[_0xb3b4('0x21')](function(_0x4343be){_0x2b763e=_0x4343be;return getEndUser(_0x10deb2,_0x6dbe35,_0x5049c1['calleridname'],_0x5049c1['calleridnum'],_0x4a407d);})[_0xb3b4('0x21')](function(_0x26cc40){_0x380677=_0x26cc40;return getTicket(_0x10deb2,_0x2b763e,_0x380677,_0x6dbe35,_0x5049c1,_0x6dbe35[_0xb3b4('0x61')],_0x4a407d,_0xb3b4('0x59'));})['then'](function(_0x22041d){_0x47a1f5=_0x22041d;logger[_0xb3b4('0x1c')](_0xb3b4('0x62'),_0x47a1f5['id']);logger[_0xb3b4('0x1c')](_0xb3b4('0x63'),_0x47a1f5['id'],_0x4b9ffe[_0xb3b4('0x51')],_0x10deb2['type']);switch(_0x10deb2[_0xb3b4('0x3b')]){case'integrationTab':emit(util[_0xb3b4('0x42')](_0xb3b4('0x64'),_0x4b9ffe[_0xb3b4('0x51')]),_0xb3b4('0x65'),{'recordId':_0x47a1f5['id']});break;case _0xb3b4('0x66'):emit(util[_0xb3b4('0x42')](_0xb3b4('0x64'),_0x4b9ffe['name']),_0xb3b4('0x67'),{'uri':util[_0xb3b4('0x42')](_0xb3b4('0x68'),_0x4a407d[_0xb3b4('0x69')],_0x47a1f5['id'])});break;default:logger[_0xb3b4('0x6a')](_0xb3b4('0x6b'));}})[_0xb3b4('0x6c')](function(_0x22fcd2){logger[_0xb3b4('0x6a')](_0xb3b4('0x5d'),_0x22fcd2);});};exports[_0xb3b4('0x6d')]=function(_0x5787a7,_0x2c5980,_0x126735,_0x284cf9,_0x517bbc,_0x4b1730,_0x51aa50){var _0x1581b2,_0x391fa1,_0x14a5f6,_0x114a53;_0x4b1730['serverUrl']=intUtil[_0xb3b4('0x5b')](_0x4b1730[_0xb3b4('0x5a')]);_0x4b1730[_0xb3b4('0x54')]=intUtil['stripTrailingSlash'](_0x4b1730[_0xb3b4('0x54')]);if(_0x51aa50&&_0x51aa50[_0xb3b4('0x6e')]&&_0x51aa50[_0xb3b4('0x6e')]!=='none'){logger[_0xb3b4('0x1c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2c5980['recordingURL']=util[_0xb3b4('0x42')](_0xb3b4('0x6f'),_0x4b1730['serverUrl'],_0x2c5980[_0xb3b4('0x5e')],md5(_0x2c5980['uniqueid']));}return getConnection(_0x4b1730)['then'](function(_0x4e0ca9){_0x114a53=_0x4e0ca9;return getUser(_0x4b1730,_0x284cf9['email'],_0x114a53);})[_0xb3b4('0x21')](function(_0x11269f){_0x1581b2=_0x11269f;return getEndUser(_0x4b1730,_0x126735,_0x2c5980[_0xb3b4('0x70')],_0x2c5980[_0xb3b4('0x71')],_0x114a53);})[_0xb3b4('0x21')](function(_0x3a1c38){_0x391fa1=_0x3a1c38;return getTicket(_0x4b1730,_0x1581b2,_0x391fa1,_0x126735,_0x2c5980,_0x126735[_0xb3b4('0x61')],_0x114a53,_0xb3b4('0x6d'));})[_0xb3b4('0x21')](function(_0x2d096d){_0x14a5f6=_0x2d096d;logger[_0xb3b4('0x1c')](_0xb3b4('0x72'),_0x14a5f6['id']);logger[_0xb3b4('0x1c')](_0xb3b4('0x73'),_0x14a5f6['id'],_0x284cf9[_0xb3b4('0x51')],_0x4b1730[_0xb3b4('0x3b')]);switch(_0x4b1730[_0xb3b4('0x3b')]){case'integrationTab':emit(util[_0xb3b4('0x42')](_0xb3b4('0x64'),_0x284cf9[_0xb3b4('0x51')]),_0xb3b4('0x65'),{'recordId':_0x14a5f6['id']});break;case _0xb3b4('0x66'):emit(util[_0xb3b4('0x42')](_0xb3b4('0x64'),_0x284cf9[_0xb3b4('0x51')]),_0xb3b4('0x67'),{'uri':util[_0xb3b4('0x42')](_0xb3b4('0x68'),_0x114a53[_0xb3b4('0x69')],_0x14a5f6['id'])});break;default:logger[_0xb3b4('0x6a')](_0xb3b4('0x74'),_0xb3b4('0x75'));}})['catch'](function(_0x48afd7){logger['error']('[OUTBOUND]',_0x48afd7);});};exports[_0xb3b4('0x76')]=function(_0x24e254,_0x220456,_0x42a6a8,_0xd209f4,_0x740b7b,_0x45a987){var _0x59af37,_0x28dd80,_0x5e0977,_0x2d5367;_0x45a987['serverUrl']=intUtil[_0xb3b4('0x5b')](_0x45a987[_0xb3b4('0x5a')]);_0x45a987[_0xb3b4('0x54')]=intUtil[_0xb3b4('0x5b')](_0x45a987['remoteUri']);if(_0x740b7b&&_0x740b7b[_0xb3b4('0x5c')]){logger['info']('['+_0x220456['lastevent'][_0xb3b4('0x77')]()+']',_0xb3b4('0x78'));_0x220456[_0xb3b4('0x5f')]=util[_0xb3b4('0x42')](_0xb3b4('0x6f'),_0x45a987['serverUrl'],_0x220456[_0xb3b4('0x5e')],md5(_0x220456[_0xb3b4('0x5e')]));}else{_0x220456[_0xb3b4('0x5f')]='';}return getConnection(_0x45a987)[_0xb3b4('0x21')](function(_0x3ce164){_0x2d5367=_0x3ce164;if(!_[_0xb3b4('0x79')](_0xd209f4)){return getUser(_0x45a987,_0xd209f4[_0xb3b4('0x51')],_0x2d5367);}else{return getUser(_0x45a987,null,_0x2d5367);}})[_0xb3b4('0x21')](function(_0x3f0a1a){_0x59af37=_0x3f0a1a;return getEndUser(_0x45a987,_0x42a6a8,_0x220456[_0xb3b4('0x7a')],_0x220456['calleridnum'],_0x2d5367);})[_0xb3b4('0x21')](function(_0x1f0060){_0x28dd80=_0x1f0060;return getTicket(_0x45a987,_0x59af37,_0x28dd80,_0x42a6a8,_0x220456,_0x42a6a8[_0xb3b4('0x61')],_0x2d5367);})[_0xb3b4('0x21')](function(_0x385a04){_0x5e0977=_0x385a04;logger[_0xb3b4('0x1c')]('['+_0x220456[_0xb3b4('0x7b')][_0xb3b4('0x77')]()+']\x20Ticket\x20%s\x20created.',_0x5e0977['id']);logger[_0xb3b4('0x1c')]('['+_0x220456[_0xb3b4('0x7b')][_0xb3b4('0x77')]()+_0xb3b4('0x7c'),_0x45a987[_0xb3b4('0x3b')]);})[_0xb3b4('0x6c')](function(_0x57a964){logger['error']('['+_0x220456[_0xb3b4('0x7b')][_0xb3b4('0x77')]()+']',_0x57a964);});}; \ No newline at end of file +var _0x4ff0=['first','Name','Phone','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','upperFirst','create','forEach','string','picklist','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','isNil',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign','getString','Task','IsRecurrence','endUserType','lead','WhoId','WhatId','ticketType','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','find','then','Email','Agent\x20%s\x20found.','resolve','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','length'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0x4ff0,0xc3));var _0x04ff=function(_0x4b36ad,_0x4d923f){_0x4b36ad=_0x4b36ad-0x0;var _0x1d81af=_0x4ff0[_0x4b36ad];return _0x1d81af;};'use strict';var _=require(_0x04ff('0x0'));var rp=require(_0x04ff('0x1'));var moment=require('moment');var BPromise=require(_0x04ff('0x2'));var md5=require(_0x04ff('0x3'));var jsforce=require(_0x04ff('0x4'));var util=require(_0x04ff('0x5'));var Redis=require(_0x04ff('0x6'));var intUtil=require(_0x04ff('0x7'));var config=require(_0x04ff('0x8'));var logger=require(_0x04ff('0x9'))(_0x04ff('0xa'));config[_0x04ff('0xb')]=_[_0x04ff('0xc')](config[_0x04ff('0xb')],{'host':_0x04ff('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x04ff('0xb')]));function emit(_0x40f4df,_0x365aab,_0x5b4864){io['to'](_0x40f4df)['emit'](_0x365aab,_0x5b4864);}function getTicket(_0x4d2b33,_0x9d2c6e,_0x440957,_0x2f2de2,_0xce0263,_0x34a954,_0x5b3f1b,_0x30e31d){var _0x4ec281=Object[_0x04ff('0xe')]({},{'OwnerId':_0x9d2c6e['id'],'Subject':intUtil[_0x04ff('0xf')](_0x2f2de2['Subjects'],_0xce0263,'\x20'),'Description':intUtil['getString'](_0x2f2de2['Descriptions'],_0xce0263,'\x0a')},getCustomFields(_0x34a954,_0xce0263));if(_0x440957){if(_0x2f2de2['ticketType']===_0x04ff('0x10')){_0x4ec281['ActivityDate']=moment['utc']();_0x4ec281['IsReminderSet']=![];_0x4ec281[_0x04ff('0x11')]=![];if(_0x440957['endUserType']==='contact'||_0x440957[_0x04ff('0x12')]===_0x04ff('0x13')){_0x4ec281[_0x04ff('0x14')]=_0x440957['id'];}else if(_0x440957[_0x04ff('0x12')]==='account'){_0x4ec281[_0x04ff('0x15')]=_0x440957['id'];}}else if(_0x2f2de2[_0x04ff('0x16')]==='Case'){if(_0x440957['endUserType']===_0x04ff('0x17')){_0x4ec281[_0x04ff('0x18')]=_0x440957['id'];}else if(_0x440957[_0x04ff('0x12')]===_0x04ff('0x19')){_0x4ec281[_0x04ff('0x1a')]=_0x440957['id'];}else if(_0x440957[_0x04ff('0x12')]===_0x04ff('0x13')&&_0x2f2de2[_0x04ff('0x1b')]){_0x4ec281[_0x2f2de2[_0x04ff('0x1b')]]=_0x440957['id'];}else{logger[_0x04ff('0x1c')](_0x04ff('0x1d'));}}}return _0x5b3f1b[_0x04ff('0x1e')](_0x2f2de2[_0x04ff('0x16')])['create'](_0x4ec281);}function getUser(_0x26615e,_0xafb39b,_0x3bf93a){if(!_['isNil'](_0xafb39b)&&intUtil[_0x04ff('0x1f')](_0xafb39b)){var _0x47ed7a={'Email':_0xafb39b};var _0x11124e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3bf93a[_0x04ff('0x1e')](_0x04ff('0x20'))[_0x04ff('0x21')](_0x47ed7a,_0x11124e)['execute']()[_0x04ff('0x22')](function(_0x30727d){if(_0x30727d['length']){var _0xa4de57=_[_0x04ff('0x21')](_0x30727d,function(_0x5a5ca8){return _0x5a5ca8[_0x04ff('0x23')]===_0xafb39b;});if(_0xa4de57){logger[_0x04ff('0x1c')](_0x04ff('0x24'),_0xafb39b);return BPromise[_0x04ff('0x25')]({'id':_0xa4de57['Id'],'name':_0xa4de57['Name']});}}else{logger[_0x04ff('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xafb39b);return _0x3bf93a[_0x04ff('0x26')]()['then'](function(_0x139917){return BPromise[_0x04ff('0x25')]({'id':_0x139917[_0x04ff('0x27')],'name':_0x139917[_0x04ff('0x28')]});});}});}else{logger[_0x04ff('0x1c')](_0x04ff('0x29'),_0xafb39b);return _0x3bf93a['identity']()['then'](function(_0xb982af){return BPromise[_0x04ff('0x25')]({'id':_0xb982af[_0x04ff('0x27')],'name':_0xb982af['display_name']});});}}function getEndUser(_0x12eefe,_0x283aec,_0x1a82e5,_0x40c2e6,_0x4d2ecd){var _0x1512b0={'$or':{'Phone':_0x40c2e6}};var _0x28714b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x04ff('0x25')]()[_0x04ff('0x22')](function(){logger[_0x04ff('0x1c')](_0x04ff('0x2a'),_0x40c2e6,_0x283aec[_0x04ff('0x2b')]);switch(_0x283aec['moduleSearch']){case _0x04ff('0x2c'):var _0x4a6eb8=_['cloneDeep'](_0x1512b0);if(_0x283aec[_0x04ff('0x2d')]){var _0x48c80e={};_0x48c80e[_0x283aec[_0x04ff('0x2d')]]=_0x40c2e6;_[_0x04ff('0x2e')](_0x4a6eb8[_0x04ff('0x2f')],_0x48c80e);}return _0x4d2ecd[_0x04ff('0x1e')](_0x04ff('0x30'))[_0x04ff('0x21')](_0x4a6eb8,_0x28714b)[_0x04ff('0x31')]()['then'](function(_0x6aa4de){if(_0x6aa4de&&_0x6aa4de['length']){return _0x6aa4de;}else{var _0x55bc49=_[_0x04ff('0x32')](_0x1512b0);if(_0x283aec[_0x04ff('0x33')]){var _0x4b8c3d={};_0x4b8c3d[_0x283aec[_0x04ff('0x33')]]=_0x40c2e6;_[_0x04ff('0x2e')](_0x55bc49[_0x04ff('0x2f')],_0x4b8c3d);}return _0x4d2ecd[_0x04ff('0x1e')](_0x04ff('0x34'))[_0x04ff('0x21')](_0x55bc49,_0x28714b);}});case _0x04ff('0x35'):var _0x1a7d67=_[_0x04ff('0x32')](_0x1512b0);if(_0x283aec[_0x04ff('0x36')]){var _0x48c80e={};_0x48c80e[_0x283aec['additionalSearchAccount']]=_0x40c2e6;_[_0x04ff('0x2e')](_0x1a7d67[_0x04ff('0x2f')],_0x48c80e);}return _0x4d2ecd[_0x04ff('0x1e')](_0x04ff('0x37'))[_0x04ff('0x21')](_0x1a7d67,_0x28714b)[_0x04ff('0x31')]()[_0x04ff('0x22')](function(_0x16982e){if(_0x16982e&&_0x16982e[_0x04ff('0x38')]){return _0x16982e;}else{var _0xf43cef=_[_0x04ff('0x32')](_0x1512b0);if(_0x283aec[_0x04ff('0x2d')]){var _0x1c5cd9={};_0x1c5cd9[_0x283aec[_0x04ff('0x2d')]]=_0x40c2e6;_[_0x04ff('0x2e')](_0xf43cef[_0x04ff('0x2f')],_0x1c5cd9);}return _0x4d2ecd[_0x04ff('0x1e')](_0x04ff('0x30'))[_0x04ff('0x21')](_0xf43cef,_0x28714b)[_0x04ff('0x22')](function(_0xfec73f){if(_0xfec73f&&_0xfec73f['length']){return _0xfec73f;}else{var _0xfa611=_[_0x04ff('0x32')](_0x1512b0);if(_0x283aec[_0x04ff('0x33')]){var _0x3143a0={};_0x3143a0[_0x283aec[_0x04ff('0x33')]]=_0x40c2e6;_[_0x04ff('0x2e')](_0xfa611[_0x04ff('0x2f')],_0x3143a0);}return _0x4d2ecd['sobject'](_0x04ff('0x34'))['find'](_0xfa611,_0x28714b);}});}});case _0x04ff('0x17'):var _0x4a6eb8=_[_0x04ff('0x32')](_0x1512b0);if(_0x283aec[_0x04ff('0x2d')]){var _0x48c80e={};_0x48c80e[_0x283aec[_0x04ff('0x2d')]]=_0x40c2e6;_[_0x04ff('0x2e')](_0x4a6eb8['$or'],_0x48c80e);}return _0x4d2ecd[_0x04ff('0x1e')]('Contact')[_0x04ff('0x21')](_0x4a6eb8,_0x28714b)[_0x04ff('0x31')]();case _0x04ff('0x13'):var _0x4389a8=_[_0x04ff('0x32')](_0x1512b0);if(_0x283aec[_0x04ff('0x33')]){var _0x48c80e={};_0x48c80e[_0x283aec[_0x04ff('0x33')]]=_0x40c2e6;_[_0x04ff('0x2e')](_0x4389a8[_0x04ff('0x2f')],_0x48c80e);}return _0x4d2ecd['sobject'](_0x04ff('0x34'))[_0x04ff('0x21')](_0x4389a8,_0x28714b);case'account':var _0x1a7d67=_['cloneDeep'](_0x1512b0);if(_0x283aec[_0x04ff('0x36')]){var _0x48c80e={};_0x48c80e[_0x283aec[_0x04ff('0x36')]]=_0x40c2e6;_[_0x04ff('0x2e')](_0x1a7d67['$or'],_0x48c80e);}return _0x4d2ecd[_0x04ff('0x1e')](_0x04ff('0x37'))[_0x04ff('0x21')](_0x1a7d67,_0x28714b);default:return null;}})[_0x04ff('0x22')](function(_0x6db5aa){if(_0x6db5aa&&_0x6db5aa['length']){var _0x5bf70d=_[_0x04ff('0x39')](_0x6db5aa);if(_0x5bf70d){return BPromise[_0x04ff('0x25')]({'id':_0x5bf70d['Id'],'name':_0x5bf70d[_0x04ff('0x3a')],'phone':_0x5bf70d[_0x04ff('0x3b')],'endUserType':_0x5bf70d['attributes']['type']['toLowerCase']()});}}})[_0x04ff('0x22')](function(_0x50409c){if(_0x50409c){logger[_0x04ff('0x1c')](_0x04ff('0x3c'),_0x50409c[_0x04ff('0x12')],_0x40c2e6);return BPromise[_0x04ff('0x25')](_0x50409c);}else{logger['info'](_0x04ff('0x3d'),_0x40c2e6);var _0x29acc7={'Phone':_0x40c2e6};if(_0x283aec[_0x04ff('0x3e')]){if(_0x283aec[_0x04ff('0x3e')]===_0x04ff('0x17')){logger[_0x04ff('0x1c')](_0x04ff('0x3f'),_0x40c2e6,_0x283aec[_0x04ff('0x3e')]);_0x29acc7[_0x04ff('0x40')]=_0x1a82e5!==_0x04ff('0x41')?_0x1a82e5:util[_0x04ff('0x42')]('Caller\x20-\x20%s',_0x40c2e6);}else if(_0x283aec['moduleCreate']===_0x04ff('0x13')){logger[_0x04ff('0x1c')](_0x04ff('0x3f'),_0x40c2e6,_0x283aec['moduleCreate']);_0x29acc7[_0x04ff('0x40')]=_0x1a82e5!==''?_0x1a82e5:util[_0x04ff('0x42')](_0x04ff('0x43'),_0x40c2e6);_0x29acc7['Company']='No\x20Company';}else if(_0x283aec[_0x04ff('0x3e')]===_0x04ff('0x19')){logger['info'](_0x04ff('0x3f'),_0x40c2e6,_0x283aec[_0x04ff('0x3e')]);_0x29acc7[_0x04ff('0x3a')]=_0x1a82e5!==_0x04ff('0x41')?_0x1a82e5:util[_0x04ff('0x42')]('Caller\x20-\x20%s',_0x40c2e6);}else{return null;}}return _0x4d2ecd[_0x04ff('0x1e')](_[_0x04ff('0x44')](_0x283aec[_0x04ff('0x3e')]))[_0x04ff('0x45')](_0x29acc7)['then'](function(_0xf8e9b1){return BPromise[_0x04ff('0x25')]({'id':_0xf8e9b1['id'],'endUserType':_0x283aec[_0x04ff('0x3e')]});});}});}function getCustomFields(_0x12ce94,_0x4a163d){var _0x58fd91={};if(_0x12ce94[_0x04ff('0x38')]>0x0){_[_0x04ff('0x46')](_0x12ce94,function(_0x381e0a){if(_['includes']([_0x04ff('0x47'),_0x04ff('0x48')],_0x381e0a['type'])&&_0x381e0a[_0x04ff('0x49')]){_0x58fd91[_0x381e0a[_0x04ff('0x49')]]=_0x381e0a['content'][_0x04ff('0x4a')]();}else if(_0x381e0a[_0x04ff('0x4b')]===_0x04ff('0x4c')&&_0x381e0a[_0x04ff('0x4d')]&&_0x381e0a[_0x04ff('0x49')]){_0x4a163d[_0x381e0a['variableName']]&&(_0x58fd91[_0x381e0a[_0x04ff('0x49')]]=_0x4a163d[_0x381e0a[_0x04ff('0x4d')]][_0x04ff('0x4a')]());}else if(_0x381e0a[_0x04ff('0x4b')]===_0x04ff('0x4e')&&_0x381e0a[_0x04ff('0x4f')]&&_0x381e0a['Variable'][_0x04ff('0x50')]&&_0x381e0a[_0x04ff('0x49')]){_0x4a163d[_0x381e0a['Variable'][_0x04ff('0x50')][_0x04ff('0x51')]()]&&(_0x58fd91[_0x381e0a[_0x04ff('0x49')]]=_0x4a163d[_0x381e0a['Variable'][_0x04ff('0x50')][_0x04ff('0x51')]()][_0x04ff('0x4a')]());}});}return _0x58fd91;}function getConnection(_0x471862){var _0xafb91c=_0x471862[_0x04ff('0x52')]['concat'](_0x471862[_0x04ff('0x53')]);var _0x29fc0e=new jsforce[(_0x04ff('0x54'))]({'oauth2':{'loginUrl':_0x471862['remoteUri']||'https://login.salesforce.com','clientId':_0x471862[_0x04ff('0x55')],'clientSecret':_0x471862[_0x04ff('0x56')]}});return _0x29fc0e['login'](_0x471862[_0x04ff('0x57')],_0xafb91c)[_0x04ff('0x22')](function(){logger['info'](_0x04ff('0x58'));return _0x29fc0e;});}exports[_0x04ff('0x59')]=function(_0x5d35df,_0x2cd169,_0x16c02e,_0x3b4872,_0x41d678,_0x2f4f07){var _0x5cc73f,_0x570652,_0x4d4ed5,_0x1ba7b2;_0x2f4f07[_0x04ff('0x5a')]=intUtil[_0x04ff('0x5b')](_0x2f4f07[_0x04ff('0x5a')]);_0x2f4f07[_0x04ff('0x5c')]=intUtil[_0x04ff('0x5b')](_0x2f4f07[_0x04ff('0x5c')]);if(_0x41d678&&_0x41d678[_0x04ff('0x5d')]){logger[_0x04ff('0x1c')](_0x04ff('0x5e'),_0x04ff('0x5f'));_0x2cd169[_0x04ff('0x60')]=util['format'](_0x04ff('0x61'),_0x2f4f07[_0x04ff('0x5a')],_0x2cd169[_0x04ff('0x62')],md5(_0x2cd169[_0x04ff('0x62')]));}else{_0x2cd169[_0x04ff('0x60')]='';}return getConnection(_0x2f4f07)[_0x04ff('0x22')](function(_0x2fdb9f){_0x1ba7b2=_0x2fdb9f;return getUser(_0x2f4f07,_0x3b4872[_0x04ff('0x63')],_0x1ba7b2);})['then'](function(_0x49b393){_0x5cc73f=_0x49b393;return getEndUser(_0x2f4f07,_0x16c02e,_0x2cd169[_0x04ff('0x64')],_0x2cd169[_0x04ff('0x65')],_0x1ba7b2);})[_0x04ff('0x22')](function(_0x19b41e){_0x570652=_0x19b41e;return getTicket(_0x2f4f07,_0x5cc73f,_0x570652,_0x16c02e,_0x2cd169,_0x16c02e[_0x04ff('0x66')],_0x1ba7b2,'queue');})[_0x04ff('0x22')](function(_0x54770d){_0x4d4ed5=_0x54770d;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x4d4ed5['id']);logger[_0x04ff('0x1c')](_0x04ff('0x67'),_0x4d4ed5['id'],_0x3b4872[_0x04ff('0x50')],_0x2f4f07[_0x04ff('0x4b')]);switch(_0x2f4f07[_0x04ff('0x4b')]){case _0x04ff('0x68'):emit(util['format'](_0x04ff('0x69'),_0x3b4872[_0x04ff('0x50')]),_0x04ff('0x6a'),{'recordId':_0x4d4ed5['id']});break;case'newTab':emit(util[_0x04ff('0x42')](_0x04ff('0x69'),_0x3b4872[_0x04ff('0x50')]),_0x04ff('0x6b'),{'uri':util[_0x04ff('0x42')](_0x04ff('0x6c'),_0x1ba7b2[_0x04ff('0x6d')],_0x4d4ed5['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x279d2a){logger[_0x04ff('0x6e')](_0x04ff('0x5e'),_0x279d2a);});};exports[_0x04ff('0x6f')]=function(_0x99ec06,_0x4bc697,_0x2bcca6,_0x424b66,_0x4b4de9,_0x91ff6d,_0x4c0a2d){var _0xb81382,_0x1415e3,_0x5a54c9,_0x51a391;_0x91ff6d[_0x04ff('0x5a')]=intUtil['stripTrailingSlash'](_0x91ff6d[_0x04ff('0x5a')]);_0x91ff6d['remoteUri']=intUtil[_0x04ff('0x5b')](_0x91ff6d['remoteUri']);if(_0x4c0a2d&&_0x4c0a2d[_0x04ff('0x70')]&&_0x4c0a2d['recordingFormat']!==_0x04ff('0x71')){logger[_0x04ff('0x1c')](_0x04ff('0x72'),_0x04ff('0x5f'));_0x4bc697[_0x04ff('0x60')]=util[_0x04ff('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x91ff6d['serverUrl'],_0x4bc697['uniqueid'],md5(_0x4bc697[_0x04ff('0x62')]));}return getConnection(_0x91ff6d)[_0x04ff('0x22')](function(_0x11f2f1){_0x51a391=_0x11f2f1;return getUser(_0x91ff6d,_0x424b66[_0x04ff('0x63')],_0x51a391);})[_0x04ff('0x22')](function(_0xe9e524){_0xb81382=_0xe9e524;return getEndUser(_0x91ff6d,_0x2bcca6,_0x4bc697[_0x04ff('0x73')],_0x4bc697['destcalleridnum'],_0x51a391);})[_0x04ff('0x22')](function(_0x4281ce){_0x1415e3=_0x4281ce;return getTicket(_0x91ff6d,_0xb81382,_0x1415e3,_0x2bcca6,_0x4bc697,_0x2bcca6[_0x04ff('0x66')],_0x51a391,_0x04ff('0x6f'));})[_0x04ff('0x22')](function(_0x16f0fc){_0x5a54c9=_0x16f0fc;logger[_0x04ff('0x1c')](_0x04ff('0x74'),_0x5a54c9['id']);logger[_0x04ff('0x1c')](_0x04ff('0x75'),_0x5a54c9['id'],_0x424b66[_0x04ff('0x50')],_0x91ff6d[_0x04ff('0x4b')]);switch(_0x91ff6d['type']){case _0x04ff('0x68'):emit(util['format'](_0x04ff('0x69'),_0x424b66['name']),'trigger:salesforce:display',{'recordId':_0x5a54c9['id']});break;case _0x04ff('0x76'):emit(util[_0x04ff('0x42')]('user:%s',_0x424b66[_0x04ff('0x50')]),'trigger:browser:url',{'uri':util[_0x04ff('0x42')](_0x04ff('0x6c'),_0x51a391[_0x04ff('0x6d')],_0x5a54c9['id'])});break;default:logger['error'](_0x04ff('0x72'),_0x04ff('0x77'));}})[_0x04ff('0x78')](function(_0x11d799){logger[_0x04ff('0x6e')]('[OUTBOUND]',_0x11d799);});};exports[_0x04ff('0x79')]=function(_0x2aaf6e,_0x5d2acd,_0x1f6209,_0x8f4b2c,_0x4f3704,_0x3e488e){var _0x44cf8c,_0x1d34be,_0x3cc8e1,_0x357a21;_0x3e488e[_0x04ff('0x5a')]=intUtil[_0x04ff('0x5b')](_0x3e488e[_0x04ff('0x5a')]);_0x3e488e[_0x04ff('0x5c')]=intUtil[_0x04ff('0x5b')](_0x3e488e[_0x04ff('0x5c')]);if(_0x4f3704&&_0x4f3704['monitor_format']){logger[_0x04ff('0x1c')]('['+_0x5d2acd[_0x04ff('0x7a')][_0x04ff('0x7b')]()+']','Recording\x20is\x20enabled!');_0x5d2acd[_0x04ff('0x60')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e488e[_0x04ff('0x5a')],_0x5d2acd['uniqueid'],md5(_0x5d2acd[_0x04ff('0x62')]));}else{_0x5d2acd[_0x04ff('0x60')]='';}return getConnection(_0x3e488e)[_0x04ff('0x22')](function(_0x1c3166){_0x357a21=_0x1c3166;if(!_[_0x04ff('0x7c')](_0x8f4b2c)){return getUser(_0x3e488e,_0x8f4b2c[_0x04ff('0x50')],_0x357a21);}else{return getUser(_0x3e488e,null,_0x357a21);}})[_0x04ff('0x22')](function(_0x38e133){_0x44cf8c=_0x38e133;return getEndUser(_0x3e488e,_0x1f6209,_0x5d2acd['calleridname'],_0x5d2acd[_0x04ff('0x65')],_0x357a21);})[_0x04ff('0x22')](function(_0x37a4c2){_0x1d34be=_0x37a4c2;return getTicket(_0x3e488e,_0x44cf8c,_0x1d34be,_0x1f6209,_0x5d2acd,_0x1f6209[_0x04ff('0x66')],_0x357a21);})[_0x04ff('0x22')](function(_0x3a4bed){_0x3cc8e1=_0x3a4bed;logger['info']('['+_0x5d2acd['lastevent'][_0x04ff('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x3cc8e1['id']);logger['info']('['+_0x5d2acd[_0x04ff('0x7a')]['toUpperCase']()+_0x04ff('0x7d'),_0x3e488e[_0x04ff('0x4b')]);})[_0x04ff('0x78')](function(_0x399d81){logger['error']('['+_0x5d2acd[_0x04ff('0x7a')][_0x04ff('0x7b')]()+']',_0x399d81);});}; \ 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 408b934..1193cfa 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 _0xda2d=[']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','sys_id','adminId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','nameField','toLowerCase','content','toString','string','type','customField','idField','variable','variableName','customVariable','Variable','name','userId','incident','assign','Subjects','getString','Descriptions','Fields','ticketId','ticketNumber'];(function(_0x4f62b5,_0x323714){var _0x168e14=function(_0x382aa1){while(--_0x382aa1){_0x4f62b5['push'](_0x4f62b5['shift']());}};_0x168e14(++_0x323714);}(_0xda2d,0x102));var _0xdda2=function(_0x28377b,_0x55cd3d){_0x28377b=_0x28377b-0x0;var _0x3dc32b=_0xda2d[_0x28377b];return _0x3dc32b;};'use strict';var _=require('lodash');var Promise=require(_0xdda2('0x0'));var rp=require(_0xdda2('0x1'));var util=require(_0xdda2('0x2'));var md5=require(_0xdda2('0x3'));var Redis=require(_0xdda2('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdda2('0x5'));config[_0xdda2('0x6')]=_[_0xdda2('0x7')](config[_0xdda2('0x6')],{'host':_0xdda2('0x8'),'port':0x18eb});var io=require(_0xdda2('0x9'))(new Redis(config[_0xdda2('0x6')]));function getAdminUser(_0x436676,_0x2e2523,_0x341c7b,_0x4a97f3,_0x1a774e,_0x22c6e5){return new Promise(function(_0x4df6b8,_0x1c11b2){var _0x2f3454={'method':_0xdda2('0xa'),'uri':_0x4a97f3+_0xdda2('0xb')+'&'+_0x1a774e+'&'+_0x22c6e5,'auth':_0x2e2523,'json':!![]};return rp(_0x2f3454)[_0xdda2('0xc')](function(_0x30ca9a){if(_0x30ca9a[_0xdda2('0xd')][_0xdda2('0xe')]>0x0){_0x341c7b['adminId']=_0x30ca9a['result'][0x0]['sys_id'];}logger[_0xdda2('0xf')]('['+[_0x436676[_0xdda2('0x10')]()]+_0xdda2('0x11'),_0x341c7b);_0x4df6b8(_0x341c7b);})[_0xdda2('0x12')](function(_0x2e4132){logger[_0xdda2('0x13')]('['+[_0x436676[_0xdda2('0x10')]()]+']',_0x2e4132['message']);_0x1c11b2(_0x2e4132[_0xdda2('0x14')]);});});}function getUser(_0x4b0220,_0xbef148,_0xb6b01e,_0x3553d5,_0x457764){return function(_0x1922b1){logger['info']('['+[_0x4b0220['toUpperCase']()]+_0xdda2('0x15'),_0x1922b1);return new Promise(function(_0x518c6d,_0x1a5192){if(intUtil[_0xdda2('0x16')](_0x1922b1[_0xdda2('0x17')])){var _0x2b6ee8={'method':_0xdda2('0xa'),'uri':_0xb6b01e+_0xdda2('0x18')+_0x1922b1[_0xdda2('0x17')]+'&'+_0x3553d5+'&'+_0x457764,'auth':_0xbef148,'json':!![]};logger[_0xdda2('0xf')]('['+[_0x4b0220[_0xdda2('0x10')]()]+_0xdda2('0x19'),_0x2b6ee8);return rp(_0x2b6ee8)[_0xdda2('0xc')](function(_0x6fdede){logger['info']('['+[_0x4b0220[_0xdda2('0x10')]()]+'],\x20getUser\x20entity',_0x6fdede);if(_0x6fdede[_0xdda2('0xd')][_0xdda2('0xe')]>0x0&&String(_0x6fdede[_0xdda2('0xd')][0x0]['active'])===_0xdda2('0x1a')){_0x1922b1['userId']=_0x6fdede[_0xdda2('0xd')][0x0][_0xdda2('0x1b')];}else{_0x1922b1['userId']=_0x1922b1[_0xdda2('0x1c')];_0x1922b1[_0xdda2('0x17')]=_0x1922b1[_0xdda2('0x1d')];}logger[_0xdda2('0xf')]('['+[_0x4b0220[_0xdda2('0x10')]()]+'],\x20getUser\x20crm',_0x1922b1);_0x518c6d(_0x1922b1);})[_0xdda2('0x12')](function(_0x4be5ea){logger[_0xdda2('0x13')]('['+[_0x4b0220[_0xdda2('0x10')]()]+']',_0x4be5ea['message']);_0x1a5192(_0x4be5ea['message']);});}else{logger[_0xdda2('0xf')]('['+[_0x4b0220[_0xdda2('0x10')]()]+_0xdda2('0x1e'));_0x1922b1['userId']=_0x1922b1[_0xdda2('0x1c')];_0x1922b1[_0xdda2('0x17')]=_0x1922b1[_0xdda2('0x1d')];_0x518c6d(_0x1922b1);}});};}function createEndUser(_0xe53dee,_0xe16ec7,_0x91b41a,_0x4bb8a4,_0x24c37d){logger[_0xdda2('0xf')]('['+[_0xe53dee['toUpperCase']()]+_0xdda2('0x1f'),_0x91b41a);return new Promise(function(_0x2cfaca,_0x3b18b8){var _0x15e511={'method':'POST','uri':_0x4bb8a4+_0xdda2('0x20')+_0x24c37d,'body':{'user_name':_0x91b41a[_0xdda2('0x21')],'roles':'user','first_name':_0x91b41a[_0xdda2('0x21')],'active':'true','date_format':_0xdda2('0x22'),'phone':_0x91b41a['endUserNumber']},'auth':_0xe16ec7,'json':!![]};return rp(_0x15e511)['then'](function(_0x510b7b){logger[_0xdda2('0xf')]('['+[_0xe53dee['toUpperCase']()]+_0xdda2('0x23'),_0x510b7b['result']);_0x91b41a['endUserId']=_0x510b7b['result'][_0xdda2('0x1b')];_0x2cfaca(_0x91b41a);})[_0xdda2('0x12')](function(_0xca6046){logger[_0xdda2('0x13')]('['+[_0xe53dee[_0xdda2('0x10')]()]+']',_0xca6046[_0xdda2('0x14')]);_0x3b18b8(_0xca6046[_0xdda2('0x14')]);});});}function getEndUser(_0x1426fd,_0x3cddbd,_0x2bcf47,_0x4a32ea,_0x461621){return function(_0x4212da){logger[_0xdda2('0xf')]('['+[_0x1426fd[_0xdda2('0x10')]()]+_0xdda2('0x24'),_0x4212da);return new Promise(function(_0x33c4b0,_0x45d3ad){var _0x5835cd={'method':'GET','uri':_0x2bcf47+_0xdda2('0x25')+_0x4212da[_0xdda2('0x21')]+'&'+_0x4a32ea+'&'+_0x461621,'auth':_0x3cddbd,'json':!![]};return rp(_0x5835cd)[_0xdda2('0xc')](function(_0x4811d2){if(_0x4811d2['result'][_0xdda2('0xe')]>0x0){_0x4212da[_0xdda2('0x26')]=_0x4811d2[_0xdda2('0xd')][0x0][_0xdda2('0x1b')];logger[_0xdda2('0xf')]('['+[_0x1426fd['toUpperCase']()]+_0xdda2('0x27'),_0x4212da);_0x33c4b0(_0x4212da);}else{return createEndUser(_0x1426fd,_0x3cddbd,_0x4212da,_0x2bcf47,_0x4a32ea)[_0xdda2('0xc')](function(_0x497302){logger['info']('['+[_0x1426fd[_0xdda2('0x10')]()]+_0xdda2('0x28'),_0x497302);_0x33c4b0(_0x497302);});}})[_0xdda2('0x12')](function(_0x2708f4){logger[_0xdda2('0x13')]('['+[_0x1426fd['toUpperCase']()]+']',_0x2708f4[_0xdda2('0x14')]);_0x45d3ad(_0x2708f4[_0xdda2('0x14')]);});});};}function getCustomFields(_0x7dac2c,_0x1a7262){var _0x50c4ae={};if(_0x7dac2c['length']>0x0){_[_0xdda2('0x29')](_0x7dac2c,function(_0x2e0524){if(_[_0xdda2('0x2a')](['string',_0xdda2('0x2b')],_0x2e0524['type'])&&_0x2e0524[_0xdda2('0x2c')]&&!_0x2e0524['customField']){_0x50c4ae[_0x2e0524[_0xdda2('0x2c')][_0xdda2('0x2d')]()]=_0x2e0524[_0xdda2('0x2e')][_0xdda2('0x2f')]();}else if(_['includes']([_0xdda2('0x30'),'picklist'],_0x2e0524[_0xdda2('0x31')])&&_0x2e0524['idField']&&_0x2e0524[_0xdda2('0x32')]){_0x50c4ae[_0x2e0524[_0xdda2('0x33')][_0xdda2('0x2d')]()]=_0x2e0524[_0xdda2('0x2e')][_0xdda2('0x2f')]();}else if(_0x2e0524['type']===_0xdda2('0x34')&&_0x2e0524[_0xdda2('0x35')]&&_0x2e0524['idField']&&_0x2e0524[_0xdda2('0x32')]){_0x50c4ae[_0x2e0524['idField'][_0xdda2('0x2d')]()]=_0x1a7262[_0x2e0524[_0xdda2('0x35')]][_0xdda2('0x2f')]();}else if(_0x2e0524[_0xdda2('0x31')]===_0xdda2('0x36')&&_0x2e0524[_0xdda2('0x37')]&&_0x2e0524[_0xdda2('0x37')][_0xdda2('0x38')]&&_0x2e0524[_0xdda2('0x33')]&&_0x2e0524[_0xdda2('0x32')]){_0x50c4ae[_0x2e0524[_0xdda2('0x33')][_0xdda2('0x2d')]()]=_0x1a7262[_0x2e0524[_0xdda2('0x37')]['name']['toLowerCase']()]['toString']();}});}return _0x50c4ae;}function getTicket(_0x36573e,_0x383536,_0x57b7b0,_0x2c41dc,_0x18f229,_0x22a99e){return function(_0x5e56a8){logger[_0xdda2('0xf')]('['+[_0x36573e[_0xdda2('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x5e56a8);return new Promise(function(_0x5f0aa8,_0x37422b){var _0x5efd20=_0x36573e[_0xdda2('0x2d')]()==='outbound'?_0x5e56a8[_0xdda2('0x39')]:_0x5e56a8[_0xdda2('0x26')];var _0x50bd88={'method':'POST','uri':_0x57b7b0+_0xdda2('0x3a')+'?'+_0x22a99e,'body':Object[_0xdda2('0x3b')]({},{'active':_0xdda2('0x1a'),'caller_id':_0x5efd20,'assigned_to':_0x5e56a8[_0xdda2('0x39')],'short_description':intUtil['getString'](_0x2c41dc[_0xdda2('0x3c')],_0x18f229,'\x20'),'description':intUtil[_0xdda2('0x3d')](_0x2c41dc[_0xdda2('0x3e')],_0x18f229,'\x0a')},getCustomFields(_0x2c41dc[_0xdda2('0x3f')],_0x18f229)),'auth':_0x383536,'json':!![]};return rp(_0x50bd88)[_0xdda2('0xc')](function(_0x55528b){logger[_0xdda2('0xf')]('['+[_0x36573e[_0xdda2('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x55528b[_0xdda2('0xd')]);_0x5e56a8[_0xdda2('0x40')]=_0x55528b[_0xdda2('0xd')][_0xdda2('0x1b')];_0x5e56a8[_0xdda2('0x41')]=_0x55528b[_0xdda2('0xd')]['number'];logger[_0xdda2('0xf')]('['+[_0x36573e['toUpperCase']()]+_0xdda2('0x42'),_0x5e56a8);_0x5f0aa8(_0x5e56a8);})['catch'](function(_0x3d6290){logger['error']('['+[_0x36573e[_0xdda2('0x10')]()]+']',_0x3d6290[_0xdda2('0x14')]);_0x37422b(_0x3d6290[_0xdda2('0x14')]);});});};}function createRemoteTag(_0x119f70,_0xfc7dd7,_0x2b45f3,_0x471b86){return new Promise(function(_0x40655d,_0x538ebb){var _0x477982={'method':_0xdda2('0x43'),'uri':_0x2b45f3+_0xdda2('0x44')+'?'+_0x471b86,'body':{'short_description':_0x119f70,'global':!![],'active':!![],'name':_0x119f70},'auth':_0xfc7dd7,'json':!![]};return rp(_0x477982)['then'](function(_0xf380b0){var _0x1c2d24=_0xf380b0['result'][_0xdda2('0x1b')];_0x40655d(_0x1c2d24);});});}function getRemoteTag(_0x5d9437,_0x13af7f,_0x10fbac,_0x378704,_0xbfab73){return new Promise(function(_0xb9c8e7,_0x4fd561){var _0x4bc1e9={'method':'GET','uri':_0x10fbac+_0xdda2('0x44')+_0xdda2('0x45')+_0x5d9437+'&'+_0x378704,'auth':_0x13af7f,'json':!![]};return rp(_0x4bc1e9)['then'](function(_0x44637d){if(_0x44637d[_0xdda2('0xd')][_0xdda2('0xe')]>0x0){var _0x4b067e=_0x44637d[_0xdda2('0xd')][0x0][_0xdda2('0x1b')];_0xb9c8e7(_0x4b067e);}else{return createRemoteTag(_0x5d9437,_0x13af7f,_0x10fbac,_0x378704)[_0xdda2('0xc')](function(_0x58ae15){_0xb9c8e7(_0x58ae15);});}});});}function assignTagToIncident(_0x2b2c1d,_0x4495e5,_0x7eb83f,_0x25c9a9,_0x5d8602){return new Promise(function(_0x4645f8,_0x4c94a3){var _0x494b81={'method':'POST','uri':_0x7eb83f+_0xdda2('0x46')+'?'+_0x5d8602,'body':{'label':_0x2b2c1d,'table':_0xdda2('0x3a'),'id_type':_0xdda2('0x47'),'table_key':_0x25c9a9[_0xdda2('0x40')],'title':_0xdda2('0x48')+_0x25c9a9[_0xdda2('0x41')],'id_display':_0x25c9a9[_0xdda2('0x41')]},'auth':_0x4495e5,'json':!![]};return rp(_0x494b81)[_0xdda2('0xc')](function(_0x269ad1){_0x4645f8();})[_0xdda2('0x12')](function(){_0x4645f8();});});}function manageTags(_0x26e7de,_0x5e6dcf,_0x215e2a,_0x173022,_0x266ec0,_0xd8c180,_0x90bb5c){return new Promise(function(_0x21a630,_0x2affc6){var _0x57fb41=[];_0x5e6dcf[_0xdda2('0x29')](function(_0x2afcae){_0x57fb41[_0xdda2('0x49')](getRemoteTag(_0x2afcae,_0x215e2a,_0x173022,_0xd8c180,_0x90bb5c));});return Promise[_0xdda2('0x4a')](_0x57fb41)[_0xdda2('0xc')](function(_0x5c9b02){if(_0x5c9b02[_0xdda2('0xe')]){logger[_0xdda2('0xf')]('['+[_0x26e7de[_0xdda2('0x10')]()]+_0xdda2('0x4b'),_0x5c9b02);var _0x21d0e4=[];_0x5c9b02['forEach'](function(_0x17aaab){_0x21d0e4[_0xdda2('0x49')](assignTagToIncident(_0x17aaab,_0x215e2a,_0x173022,_0x266ec0,_0xd8c180));});return Promise[_0xdda2('0x4a')](_0x21d0e4)[_0xdda2('0xc')](function(){_0x21a630();})[_0xdda2('0x12')](function(){_0x21a630();});}else{_0x21a630();}});});}function getTags(_0x5d34d7,_0x29dd19,_0x3d7951,_0x20e5ab,_0x54ac4b,_0x1b7b96){return function(_0x483c17){return new Promise(function(_0x3cc35c,_0x41b681){var _0x646bab=[];var _0x5c351c=_0x20e5ab[_0xdda2('0x4c')];if(_0x5c351c&&_0x5c351c[_0xdda2('0xe')]>0x0){_0x646bab=_['map'](_0x5c351c,_0xdda2('0x38'));}if(_0x646bab['length']>0x0){return manageTags(_0x5d34d7,_0x646bab,_0x29dd19,_0x3d7951,_0x483c17,_0x54ac4b,_0x1b7b96)[_0xdda2('0xc')](function(){_0x3cc35c(_0x483c17);});}else{_0x3cc35c(_0x483c17);}});};}function emit(_0xc97cb1,_0x354fb9,_0x29cf1a){var _0x10d1de='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xdda2('0x4d')+_0xdda2('0x4e');var _0x547fbd={'uri':_0xc97cb1+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x29cf1a+_0x10d1de};io['to'](util[_0xdda2('0x4f')]('user:%s',_0x354fb9))[_0xdda2('0x50')](_0xdda2('0x51'),_0x547fbd);}exports['cs']=function(_0x4910a6,_0x263f6d,_0x156c00,_0xdcd08c,_0x4739c4,_0x694386,_0x37f5cd,_0x4eebb0){var _0x7764df={};var _0x22de37={'user':_0x694386[_0xdda2('0x52')],'pass':_0x694386['password']};var _0x27780e=_0xdda2('0x53');var _0x51963f='sysparm_display_value=true';_0x694386[_0xdda2('0x54')]=intUtil[_0xdda2('0x55')](_0x694386[_0xdda2('0x54')]);_0x694386['serverUrl']=intUtil['stripTrailingSlash'](_0x694386[_0xdda2('0x56')]);var _0x5261ed=util[_0xdda2('0x4f')](_0xdda2('0x57'),_0x694386[_0xdda2('0x54')]);_0x7764df[_0xdda2('0x17')]=!_[_0xdda2('0x58')](_0xdcd08c)?_0xdcd08c[_0xdda2('0x59')]:null;_0x7764df['adminEmail']=_0x694386['email'];_0x7764df[_0xdda2('0x21')]=_0x4eebb0['toLowerCase']()===_0xdda2('0x5a')?_0x263f6d[_0xdda2('0x5b')]:_0x263f6d[_0xdda2('0x5c')];_0x7764df[_0xdda2('0x5d')]=_0x4eebb0===_0xdda2('0x5e')||_0x4eebb0===_0xdda2('0x5f')?_0xdda2('0x5e'):_0xdda2('0x5a');var _0x37c547=util['format'](_0xdda2('0x60'),_0x694386[_0xdda2('0x56')],_0x263f6d[_0xdda2('0x61')],md5(_0x263f6d[_0xdda2('0x61')]));if(_0x4739c4&&_0x4739c4['monitor_format']){logger[_0xdda2('0xf')](_0xdda2('0x62'),_0xdda2('0x63'));_0x263f6d[_0xdda2('0x64')]=_0x37c547;}else if(_0x37f5cd&&_0x37f5cd['recordingFormat']&&_0x37f5cd['recordingFormat']!==_0xdda2('0x65')){logger[_0xdda2('0xf')](_0xdda2('0x66'),_0xdda2('0x63'));_0x263f6d['recordingURL']=_0x37c547;}else{_0x263f6d[_0xdda2('0x64')]='';}return getAdminUser(_0x4eebb0,_0x22de37,_0x7764df,_0x5261ed,_0x51963f,_0x27780e)[_0xdda2('0xc')](getUser(_0x4eebb0,_0x22de37,_0x5261ed,_0x51963f,_0x27780e))[_0xdda2('0xc')](getEndUser(_0x4eebb0,_0x22de37,_0x5261ed,_0x51963f,_0x27780e))[_0xdda2('0xc')](getTicket(_0x4eebb0,_0x22de37,_0x5261ed,_0x156c00,_0x263f6d,_0x51963f))[_0xdda2('0xc')](function(_0x1f77bd){logger[_0xdda2('0xf')](util[_0xdda2('0x4f')](_0xdda2('0x67'),_0x1f77bd[_0xdda2('0x40')]));logger[_0xdda2('0xf')](util[_0xdda2('0x4f')](_0xdda2('0x68'),_0x4eebb0));if(_0x4eebb0!==_0xdda2('0x5f')){logger[_0xdda2('0xf')]('['+[_0x4eebb0['toUpperCase']()]+']',_0xdda2('0x69'));emit(_0x694386[_0xdda2('0x54')],_0xdcd08c['name'],_0x1f77bd['ticketId']);}})[_0xdda2('0x12')](function(_0x40fd4c){logger[_0xdda2('0x13')]('['+[_0x4eebb0[_0xdda2('0x10')]()]+_0xdda2('0x6a'),util[_0xdda2('0x6b')](_0x40fd4c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6343=['getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','ticketId','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','request-promise','util','../../../../config/logger','servicenow','defaults','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','customField','toString','idField','toLowerCase','type','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign'];(function(_0xfaa01b,_0x1a87f9){var _0x564e25=function(_0x2c489a){while(--_0x2c489a){_0xfaa01b['push'](_0xfaa01b['shift']());}};_0x564e25(++_0x1a87f9);}(_0x6343,0x168));var _0x3634=function(_0x4bb97d,_0x28c1ae){_0x4bb97d=_0x4bb97d-0x0;var _0x58705e=_0x6343[_0x4bb97d];return _0x58705e;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x3634('0x0'));var util=require(_0x3634('0x1'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));config['redis']=_[_0x3634('0x4')](config[_0x3634('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3634('0x6'))(new Redis(config[_0x3634('0x5')]));function getAdminUser(_0x4e6d71,_0x5affba,_0x19170a,_0x1bcdb2,_0xfac918,_0x3c813b){return new Promise(function(_0x2e8e8b,_0x43f681){var _0x5e907a={'method':'GET','uri':_0x1bcdb2+_0x3634('0x7')+'&'+_0xfac918+'&'+_0x3c813b,'auth':_0x5affba,'json':!![]};return rp(_0x5e907a)[_0x3634('0x8')](function(_0x4d7e0c){if(_0x4d7e0c[_0x3634('0x9')][_0x3634('0xa')]>0x0){_0x19170a[_0x3634('0xb')]=_0x4d7e0c[_0x3634('0x9')][0x0][_0x3634('0xc')];}logger[_0x3634('0xd')]('['+[_0x4e6d71[_0x3634('0xe')]()]+_0x3634('0xf'),_0x19170a);_0x2e8e8b(_0x19170a);})[_0x3634('0x10')](function(_0x36f54b){logger[_0x3634('0x11')]('['+[_0x4e6d71[_0x3634('0xe')]()]+']',_0x36f54b[_0x3634('0x12')]);_0x43f681(_0x36f54b[_0x3634('0x12')]);});});}function getUser(_0x5a5063,_0x167247,_0x48787f,_0x69609d,_0x18285c){return function(_0x2fc628){logger[_0x3634('0xd')]('['+[_0x5a5063[_0x3634('0xe')]()]+'],\x20getUser\x20input\x20crm',_0x2fc628);return new Promise(function(_0x3121a3,_0x4b8ec8){if(intUtil['validateEmail'](_0x2fc628[_0x3634('0x13')])){var _0x4b2115={'method':_0x3634('0x14'),'uri':_0x48787f+_0x3634('0x15')+_0x2fc628[_0x3634('0x13')]+'&'+_0x69609d+'&'+_0x18285c,'auth':_0x167247,'json':!![]};logger['info']('['+[_0x5a5063[_0x3634('0xe')]()]+_0x3634('0x16'),_0x4b2115);return rp(_0x4b2115)['then'](function(_0xeb9231){logger['info']('['+[_0x5a5063[_0x3634('0xe')]()]+_0x3634('0x17'),_0xeb9231);if(_0xeb9231['result'][_0x3634('0xa')]>0x0&&String(_0xeb9231[_0x3634('0x9')][0x0][_0x3634('0x18')])==='true'){_0x2fc628[_0x3634('0x19')]=_0xeb9231[_0x3634('0x9')][0x0]['sys_id'];}else{_0x2fc628[_0x3634('0x19')]=_0x2fc628['adminId'];_0x2fc628['userEmail']=_0x2fc628[_0x3634('0x1a')];}logger[_0x3634('0xd')]('['+[_0x5a5063['toUpperCase']()]+_0x3634('0x1b'),_0x2fc628);_0x3121a3(_0x2fc628);})[_0x3634('0x10')](function(_0x17db44){logger[_0x3634('0x11')]('['+[_0x5a5063[_0x3634('0xe')]()]+']',_0x17db44[_0x3634('0x12')]);_0x4b8ec8(_0x17db44[_0x3634('0x12')]);});}else{logger[_0x3634('0xd')]('['+[_0x5a5063[_0x3634('0xe')]()]+']\x20using\x20admin\x20profile');_0x2fc628[_0x3634('0x19')]=_0x2fc628['adminId'];_0x2fc628['userEmail']=_0x2fc628['adminEmail'];_0x3121a3(_0x2fc628);}});};}function createEndUser(_0x7a35c4,_0x576977,_0x3bf28b,_0x12b80e,_0x49804f){logger['info']('['+[_0x7a35c4[_0x3634('0xe')]()]+'],\x20createEndUser\x20input\x20crm',_0x3bf28b);return new Promise(function(_0x281504,_0x5d273c){var _0x1e04cc={'method':_0x3634('0x1c'),'uri':_0x12b80e+_0x3634('0x1d')+_0x49804f,'body':{'user_name':_0x3bf28b[_0x3634('0x1e')],'roles':_0x3634('0x1f'),'first_name':_0x3bf28b[_0x3634('0x1e')],'active':_0x3634('0x20'),'date_format':_0x3634('0x21'),'phone':_0x3bf28b['endUserNumber']},'auth':_0x576977,'json':!![]};return rp(_0x1e04cc)['then'](function(_0x4d26b4){logger[_0x3634('0xd')]('['+[_0x7a35c4['toUpperCase']()]+_0x3634('0x22'),_0x4d26b4[_0x3634('0x9')]);_0x3bf28b[_0x3634('0x23')]=_0x4d26b4[_0x3634('0x9')][_0x3634('0xc')];_0x281504(_0x3bf28b);})[_0x3634('0x10')](function(_0x5e7afb){logger[_0x3634('0x11')]('['+[_0x7a35c4[_0x3634('0xe')]()]+']',_0x5e7afb[_0x3634('0x12')]);_0x5d273c(_0x5e7afb[_0x3634('0x12')]);});});}function getEndUser(_0x424825,_0x5980fd,_0x455fba,_0x464ab0,_0xff159){return function(_0x598c7e){logger[_0x3634('0xd')]('['+[_0x424825[_0x3634('0xe')]()]+_0x3634('0x24'),_0x598c7e);return new Promise(function(_0x359b07,_0x53e0f6){var _0x149840={'method':_0x3634('0x14'),'uri':_0x455fba+_0x3634('0x25')+_0x598c7e['endUserNumber']+'&'+_0x464ab0+'&'+_0xff159,'auth':_0x5980fd,'json':!![]};return rp(_0x149840)['then'](function(_0x55b8d8){if(_0x55b8d8[_0x3634('0x9')][_0x3634('0xa')]>0x0){_0x598c7e['endUserId']=_0x55b8d8[_0x3634('0x9')][0x0][_0x3634('0xc')];logger[_0x3634('0xd')]('['+[_0x424825[_0x3634('0xe')]()]+_0x3634('0x26'),_0x598c7e);_0x359b07(_0x598c7e);}else{return createEndUser(_0x424825,_0x5980fd,_0x598c7e,_0x455fba,_0x464ab0)[_0x3634('0x8')](function(_0x431619){logger['info']('['+[_0x424825[_0x3634('0xe')]()]+'],\x20createEndUser\x20crm',_0x431619);_0x359b07(_0x431619);});}})[_0x3634('0x10')](function(_0x3ae966){logger[_0x3634('0x11')]('['+[_0x424825[_0x3634('0xe')]()]+']',_0x3ae966[_0x3634('0x12')]);_0x53e0f6(_0x3ae966['message']);});});};}function getCustomFields(_0x10ff70,_0x33af29){var _0x32d112={};if(_0x10ff70[_0x3634('0xa')]>0x0){_[_0x3634('0x27')](_0x10ff70,function(_0x17714e){if(_[_0x3634('0x28')]([_0x3634('0x29'),_0x3634('0x2a')],_0x17714e['type'])&&_0x17714e['nameField']&&!_0x17714e[_0x3634('0x2b')]){_0x32d112[_0x17714e['nameField']['toLowerCase']()]=_0x17714e['content'][_0x3634('0x2c')]();}else if(_['includes']([_0x3634('0x29'),_0x3634('0x2a')],_0x17714e['type'])&&_0x17714e['idField']&&_0x17714e['customField']){_0x32d112[_0x17714e[_0x3634('0x2d')][_0x3634('0x2e')]()]=_0x17714e['content'][_0x3634('0x2c')]();}else if(_0x17714e[_0x3634('0x2f')]===_0x3634('0x30')&&_0x17714e[_0x3634('0x31')]&&_0x17714e[_0x3634('0x2d')]&&_0x17714e['customField']){_0x32d112[_0x17714e['idField'][_0x3634('0x2e')]()]=_0x33af29[_0x17714e[_0x3634('0x31')]][_0x3634('0x2c')]();}else if(_0x17714e[_0x3634('0x2f')]===_0x3634('0x32')&&_0x17714e[_0x3634('0x33')]&&_0x17714e['Variable'][_0x3634('0x34')]&&_0x17714e[_0x3634('0x2d')]&&_0x17714e[_0x3634('0x2b')]){_0x32d112[_0x17714e['idField']['toLowerCase']()]=_0x33af29[_0x17714e[_0x3634('0x33')][_0x3634('0x34')][_0x3634('0x2e')]()][_0x3634('0x2c')]();}});}return _0x32d112;}function getTicket(_0x96b117,_0x12e6ab,_0x3f513a,_0x38a75a,_0x52de40,_0xfb94f0){return function(_0x3401b8){logger[_0x3634('0xd')]('['+[_0x96b117[_0x3634('0xe')]()]+_0x3634('0x35'),_0x3401b8);return new Promise(function(_0x151654,_0x10e5e4){var _0x326b61=_0x96b117[_0x3634('0x2e')]()==='outbound'?_0x3401b8[_0x3634('0x19')]:_0x3401b8[_0x3634('0x23')];var _0x4a4a94={'method':_0x3634('0x1c'),'uri':_0x3f513a+_0x3634('0x36')+'?'+_0xfb94f0,'body':Object[_0x3634('0x37')]({},{'active':_0x3634('0x20'),'caller_id':_0x326b61,'assigned_to':_0x3401b8[_0x3634('0x19')],'short_description':intUtil[_0x3634('0x38')](_0x38a75a['Subjects'],_0x52de40,'\x20'),'description':intUtil[_0x3634('0x38')](_0x38a75a[_0x3634('0x39')],_0x52de40,'\x0a')},getCustomFields(_0x38a75a[_0x3634('0x3a')],_0x52de40)),'auth':_0x12e6ab,'json':!![]};return rp(_0x4a4a94)[_0x3634('0x8')](function(_0x2a1e51){logger['info']('['+[_0x96b117[_0x3634('0xe')]()]+_0x3634('0x3b'),_0x2a1e51['result']);_0x3401b8['ticketId']=_0x2a1e51[_0x3634('0x9')]['sys_id'];_0x3401b8[_0x3634('0x3c')]=_0x2a1e51[_0x3634('0x9')][_0x3634('0x3d')];logger[_0x3634('0xd')]('['+[_0x96b117['toUpperCase']()]+_0x3634('0x3e'),_0x3401b8);_0x151654(_0x3401b8);})[_0x3634('0x10')](function(_0x3d04ab){logger[_0x3634('0x11')]('['+[_0x96b117[_0x3634('0xe')]()]+']',_0x3d04ab[_0x3634('0x12')]);_0x10e5e4(_0x3d04ab[_0x3634('0x12')]);});});};}function createRemoteTag(_0xc83a28,_0x32bfe4,_0x320286,_0xcedbb6){return new Promise(function(_0x4265eb,_0x557438){var _0x32b48c={'method':_0x3634('0x1c'),'uri':_0x320286+_0x3634('0x3f')+'?'+_0xcedbb6,'body':{'short_description':_0xc83a28,'global':!![],'active':!![],'name':_0xc83a28},'auth':_0x32bfe4,'json':!![]};return rp(_0x32b48c)[_0x3634('0x8')](function(_0x752546){var _0x15f414=_0x752546[_0x3634('0x9')][_0x3634('0xc')];_0x4265eb(_0x15f414);});});}function getRemoteTag(_0x3a8308,_0x5f2287,_0x2bcb9e,_0x2ea4b0,_0x48d641){return new Promise(function(_0x31165c,_0x1be01b){var _0x53443e={'method':_0x3634('0x14'),'uri':_0x2bcb9e+_0x3634('0x3f')+_0x3634('0x40')+_0x3a8308+'&'+_0x2ea4b0,'auth':_0x5f2287,'json':!![]};return rp(_0x53443e)['then'](function(_0x2c16fa){if(_0x2c16fa['result'][_0x3634('0xa')]>0x0){var _0x51f2f8=_0x2c16fa[_0x3634('0x9')][0x0][_0x3634('0xc')];_0x31165c(_0x51f2f8);}else{return createRemoteTag(_0x3a8308,_0x5f2287,_0x2bcb9e,_0x2ea4b0)[_0x3634('0x8')](function(_0x5e3788){_0x31165c(_0x5e3788);});}});});}function assignTagToIncident(_0x2f2032,_0x2b72cd,_0x5df700,_0x2a2c92,_0xbc0017){return new Promise(function(_0x460773,_0x6781cb){var _0x589c0d={'method':_0x3634('0x1c'),'uri':_0x5df700+_0x3634('0x41')+'?'+_0xbc0017,'body':{'label':_0x2f2032,'table':'incident','id_type':'Incident','table_key':_0x2a2c92['ticketId'],'title':_0x3634('0x42')+_0x2a2c92['ticketNumber'],'id_display':_0x2a2c92[_0x3634('0x3c')]},'auth':_0x2b72cd,'json':!![]};return rp(_0x589c0d)[_0x3634('0x8')](function(_0x185b18){_0x460773();})['catch'](function(){_0x460773();});});}function manageTags(_0x1445a4,_0x3f3dc1,_0x56f3cc,_0x2f1b5d,_0x1c37f4,_0x27e00b,_0x5a9808){return new Promise(function(_0x31c910,_0xb69eea){var _0x897c0e=[];_0x3f3dc1[_0x3634('0x27')](function(_0x218902){_0x897c0e['push'](getRemoteTag(_0x218902,_0x56f3cc,_0x2f1b5d,_0x27e00b,_0x5a9808));});return Promise[_0x3634('0x43')](_0x897c0e)[_0x3634('0x8')](function(_0xfa3195){if(_0xfa3195['length']){logger[_0x3634('0xd')]('['+[_0x1445a4['toUpperCase']()]+_0x3634('0x44'),_0xfa3195);var _0x12ee97=[];_0xfa3195['forEach'](function(_0x128461){_0x12ee97[_0x3634('0x45')](assignTagToIncident(_0x128461,_0x56f3cc,_0x2f1b5d,_0x1c37f4,_0x27e00b));});return Promise[_0x3634('0x43')](_0x12ee97)['then'](function(){_0x31c910();})[_0x3634('0x10')](function(){_0x31c910();});}else{_0x31c910();}});});}function getTags(_0x4b724c,_0x4b81ec,_0x1cea1b,_0x58cd2e,_0x30fd12,_0x70898e){return function(_0x1761d4){return new Promise(function(_0x88ae3b,_0x5251ae){var _0x3768ec=[];var _0x12c078=_0x58cd2e['Tags'];if(_0x12c078&&_0x12c078[_0x3634('0xa')]>0x0){_0x3768ec=_['map'](_0x12c078,_0x3634('0x34'));}if(_0x3768ec['length']>0x0){return manageTags(_0x4b724c,_0x3768ec,_0x4b81ec,_0x1cea1b,_0x1761d4,_0x30fd12,_0x70898e)['then'](function(){_0x88ae3b(_0x1761d4);});}else{_0x88ae3b(_0x1761d4);}});};}function emit(_0x11c4cc,_0x9a3947,_0x10b783){var _0x55f9dc=_0x3634('0x46')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x3634('0x47')+_0x3634('0x48');var _0x2e7b1d={'uri':_0x11c4cc+_0x3634('0x49')+_0x10b783+_0x55f9dc};io['to'](util[_0x3634('0x4a')](_0x3634('0x4b'),_0x9a3947))[_0x3634('0x4c')](_0x3634('0x4d'),_0x2e7b1d);}exports['cs']=function(_0x347acc,_0x10d3c7,_0x214c61,_0x4bbfed,_0x5bbe3b,_0x191ab8,_0x592793,_0x465712){var _0x352d98={};var _0x3376ef={'user':_0x191ab8[_0x3634('0x4e')],'pass':_0x191ab8[_0x3634('0x4f')]};var _0x506f7c=_0x3634('0x50');var _0x411e19=_0x3634('0x51');_0x191ab8[_0x3634('0x52')]=intUtil[_0x3634('0x53')](_0x191ab8['remoteUri']);_0x191ab8[_0x3634('0x54')]=intUtil[_0x3634('0x53')](_0x191ab8[_0x3634('0x54')]);var _0x363d8b=util['format']('%s/api/now/table/',_0x191ab8[_0x3634('0x52')]);_0x352d98[_0x3634('0x13')]=!_[_0x3634('0x55')](_0x4bbfed)?_0x4bbfed[_0x3634('0x56')]:null;_0x352d98['adminEmail']=_0x191ab8[_0x3634('0x56')];_0x352d98['endUserNumber']=_0x465712[_0x3634('0x2e')]()==='outbound'?_0x10d3c7[_0x3634('0x57')]:_0x10d3c7[_0x3634('0x58')];_0x352d98[_0x3634('0x59')]=_0x465712===_0x3634('0x5a')||_0x465712===_0x3634('0x5b')?_0x3634('0x5a'):'outbound';var _0x3007d1=util['format'](_0x3634('0x5c'),_0x191ab8[_0x3634('0x54')],_0x10d3c7[_0x3634('0x5d')],md5(_0x10d3c7[_0x3634('0x5d')]));if(_0x5bbe3b&&_0x5bbe3b[_0x3634('0x5e')]){logger[_0x3634('0xd')](_0x3634('0x5f'),_0x3634('0x60'));_0x10d3c7[_0x3634('0x61')]=_0x3007d1;}else if(_0x592793&&_0x592793['recordingFormat']&&_0x592793[_0x3634('0x62')]!==_0x3634('0x63')){logger[_0x3634('0xd')](_0x3634('0x64'),_0x3634('0x60'));_0x10d3c7[_0x3634('0x61')]=_0x3007d1;}else{_0x10d3c7[_0x3634('0x61')]='';}return getAdminUser(_0x465712,_0x3376ef,_0x352d98,_0x363d8b,_0x411e19,_0x506f7c)[_0x3634('0x8')](getUser(_0x465712,_0x3376ef,_0x363d8b,_0x411e19,_0x506f7c))[_0x3634('0x8')](getEndUser(_0x465712,_0x3376ef,_0x363d8b,_0x411e19,_0x506f7c))[_0x3634('0x8')](getTicket(_0x465712,_0x3376ef,_0x363d8b,_0x214c61,_0x10d3c7,_0x411e19))['then'](function(_0x3f09cf){logger[_0x3634('0xd')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3f09cf[_0x3634('0x65')]));logger[_0x3634('0xd')](util[_0x3634('0x4a')](_0x3634('0x66'),_0x465712));if(_0x465712!=='unmanaged'){logger[_0x3634('0xd')]('['+[_0x465712[_0x3634('0xe')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x191ab8[_0x3634('0x52')],_0x4bbfed[_0x3634('0x34')],_0x3f09cf['ticketId']);}})[_0x3634('0x10')](function(_0x476872){logger['error']('['+[_0x465712[_0x3634('0xe')]()]+_0x3634('0x67'),util['inspect'](_0x476872,{'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 14f91f8..4c1fb80 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 _0xf19d=['Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','contacts','toUpperCase','lastevent','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id'];(function(_0x120e59,_0x443649){var _0x53ff80=function(_0x5a642e){while(--_0x5a642e){_0x120e59['push'](_0x120e59['shift']());}};_0x53ff80(++_0x443649);}(_0xf19d,0xc0));var _0xdf19=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf19d[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xdf19('0x0'));var rp=require(_0xdf19('0x1'));var BPromise=require('bluebird');var md5=require(_0xdf19('0x2'));var util=require('util');var Redis=require(_0xdf19('0x3'));var intUtil=require('./util');var config=require(_0xdf19('0x4'));var logger=require(_0xdf19('0x5'))('sugarcrm');config[_0xdf19('0x6')]=_[_0xdf19('0x7')](config[_0xdf19('0x6')],{'host':_0xdf19('0x8'),'port':0x18eb});var io=require(_0xdf19('0x9'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x470e41,_0x2e1431,_0x267879){io['to'](_0x470e41)['emit'](_0x2e1431,_0x267879);}function getTicket(_0x41c577,_0x1e9d7,_0x58ce6d,_0x20bd77,_0x27556d,_0x434cff,_0x4c400a,_0x18c5d0){logger[_0xdf19('0xa')](_0xdf19('0xb'));var _0x1da205=new Date();var _0x491f1b=[{'name':_0xdf19('0xc'),'value':intUtil[_0xdf19('0xd')](_0x20bd77[_0xdf19('0xe')],_0x27556d,'\x20')},{'name':'assigned_user_id','value':_0x1e9d7['id']},{'name':_0xdf19('0xf'),'value':_0x1e9d7['id']},{'name':_0xdf19('0x10'),'value':intUtil[_0xdf19('0xd')](_0x20bd77[_0xdf19('0x11')],_0x27556d,'\x0a')},{'name':'date_start','value':_0x1da205['toISOString']()['slice'](0x0,0x13)[_0xdf19('0x12')]('T','\x20')},{'name':_0xdf19('0x13'),'value':'0'},{'name':_0xdf19('0x14'),'value':'15'},{'name':_0xdf19('0x15'),'value':_0x58ce6d['id']},{'name':_0xdf19('0x16'),'value':'Contacts'},{'name':_0xdf19('0x17'),'value':_0x58ce6d[_0xdf19('0xc')]},{'name':_0xdf19('0x18'),'value':_0x18c5d0}];if(_0x434cff[_0xdf19('0x19')]){_[_0xdf19('0x1a')](_0x434cff,function(_0x300f43){if(_0x27556d[_0x300f43[_0xdf19('0x1b')]]){_0x491f1b[_0xdf19('0x1c')]({'name':_0x300f43[_0xdf19('0x1d')],'value':_0x27556d[_0x300f43[_0xdf19('0x1b')]]});}});}return request({'form':{'method':_0xdf19('0x1e'),'input_type':_0xdf19('0x1f'),'response_type':'JSON','rest_data':JSON[_0xdf19('0x20')]({'session':_0x4c400a['id'],'module_name':'Calls','name_value_list':_0x491f1b})}});}function getAuth(_0x530f65){return util[_0xdf19('0x21')](_0xdf19('0x22'),new Buffer(_0x530f65[_0xdf19('0x23')]+':X')[_0xdf19('0x24')](_0xdf19('0x25')));}function getServerInfo(_0x37f9c4){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0xdf19('0x1f'),'rest_data':JSON[_0xdf19('0x20')]({'session':_0x37f9c4['id']})}});}function getUser(_0x255088,_0x18b3d1,_0x407341){if(!_[_0xdf19('0x26')](_0x18b3d1)){logger[_0xdf19('0xa')](_0xdf19('0x27'),_0x18b3d1);return request({'form':{'method':'get_entry_list','input_type':_0xdf19('0x1f'),'response_type':_0xdf19('0x1f'),'rest_data':JSON['stringify']({'session':_0x407341['id'],'module_name':_0xdf19('0x28'),'query':util[_0xdf19('0x21')](_0xdf19('0x29'),_0x18b3d1),'order_by':'','offset':'0','select_fields':['id',_0xdf19('0xc'),_0xdf19('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdf19('0x2b')](function(_0x136734){if(_0x136734['entry_list']['length']){var _0x2ef06e=_[_0xdf19('0x2c')](_0x136734['entry_list'],function(_0x1dada6){return _0x1dada6[_0xdf19('0x2d')][_0xdf19('0x2a')][_0xdf19('0x2e')]===_0x18b3d1;});if(_0x2ef06e){logger[_0xdf19('0xa')]('Agent\x20found!');return BPromise[_0xdf19('0x2f')]({'id':_0x2ef06e[_0xdf19('0x2d')]['id'][_0xdf19('0x2e')],'name':_0x2ef06e['name_value_list'][_0xdf19('0xc')][_0xdf19('0x2e')]});}}logger['info'](_0xdf19('0x30'));return BPromise[_0xdf19('0x2f')]({'id':_0x407341[_0xdf19('0x2d')][_0xdf19('0x31')][_0xdf19('0x2e')],'name':_0x407341[_0xdf19('0x2d')][_0xdf19('0x2a')]['value']});});}else{logger['info'](_0xdf19('0x32'));return BPromise[_0xdf19('0x2f')]({'id':_0x407341[_0xdf19('0x2d')][_0xdf19('0x31')][_0xdf19('0x2e')],'name':_0x407341[_0xdf19('0x2d')]['user_name'][_0xdf19('0x2e')]});}}function getEndUser(_0x42abba,_0x30bbb9,_0x54520e,_0x2442a2){logger[_0xdf19('0xa')](_0xdf19('0x33'),_0x54520e);return request({'form':{'method':_0xdf19('0x34'),'input_type':'JSON','response_type':_0xdf19('0x1f'),'rest_data':JSON['stringify']({'session':_0x2442a2['id'],'module_name':_0xdf19('0x35'),'query':util[_0xdf19('0x21')](_0xdf19('0x36'),_0x54520e),'order_by':'','offset':'0','select_fields':['id',_0xdf19('0xc'),_0xdf19('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdf19('0x2b')](function(_0x2f3b69){if(_0x2f3b69[_0xdf19('0x38')][_0xdf19('0x19')]){var _0x3a47db=_[_0xdf19('0x2c')](_0x2f3b69[_0xdf19('0x38')],function(_0x46705c){return _0x46705c[_0xdf19('0x2d')]['phone_home'][_0xdf19('0x2e')]===_0x54520e;});if(_0x3a47db){logger[_0xdf19('0xa')](_0xdf19('0x39'));return BPromise[_0xdf19('0x2f')]({'id':_0x3a47db['name_value_list']['id'][_0xdf19('0x2e')],'name':_0x3a47db[_0xdf19('0x2d')][_0xdf19('0xc')]['value'],'phone':_0x3a47db[_0xdf19('0x2d')][_0xdf19('0x37')][_0xdf19('0x2e')]});}}else{logger['info'](_0xdf19('0x3a'));return request({'form':{'method':'set_entry','input_type':_0xdf19('0x1f'),'response_type':_0xdf19('0x1f'),'rest_data':JSON[_0xdf19('0x20')]({'session':_0x2442a2['id'],'module_name':_0xdf19('0x35'),'name_value_list':[{'name':_0xdf19('0x3b'),'value':_0x30bbb9!==_0xdf19('0x3c')?_0x30bbb9:util[_0xdf19('0x21')](_0xdf19('0x3d'),_0x54520e)},{'name':_0xdf19('0x37'),'value':_0x54520e}]})}})['then'](function(_0x3204b1){logger[_0xdf19('0xa')]('Enduser\x20created.');return BPromise[_0xdf19('0x2f')]({'id':_0x3204b1['id'],'name':_0x3204b1['entry_list'][_0xdf19('0x3b')][_0xdf19('0x2e')],'phone':_0x3204b1['entry_list'][_0xdf19('0x37')]['value']});});}});}function request(_0x4c6e65){logger[_0xdf19('0x3e')](_0xdf19('0x3f'),JSON[_0xdf19('0x20')](_0x4c6e65));return rp(_[_0xdf19('0x40')](def,_0x4c6e65));}function getTags(_0x1ec081,_0x5981a3){var _0x9617f6=[];if(_0x1ec081&&_0x1ec081[_0xdf19('0x19')]>0x0){_0x9617f6=_['map'](_0x1ec081,_0x5981a3);}return _0x9617f6;}function getCustomFields(_0x5e9684,_0x3e9f35){var _0x9460a8=[];var _0x5e5d5e={'custom_fields':[]};if(_0x5e9684['length']>0x0){_[_0xdf19('0x1a')](_0x5e9684,function(_0x5edb83){if(_0x5edb83[_0xdf19('0x41')]===_0xdf19('0x42')&&_0x5edb83[_0xdf19('0x43')]&&!_0x5edb83[_0xdf19('0x44')]){_0x5e5d5e[_0x5edb83[_0xdf19('0x43')][_0xdf19('0x45')]()]=_0x5edb83[_0xdf19('0x46')][_0xdf19('0x24')]();}else if(_0x5edb83[_0xdf19('0x41')]===_0xdf19('0x42')&&_0x5edb83[_0xdf19('0x1d')]&&_0x5edb83['customField']){_0x5e5d5e[_0xdf19('0x47')]['push']({'id':_0x5edb83[_0xdf19('0x1d')],'value':_0x5edb83[_0xdf19('0x46')][_0xdf19('0x24')]()});}else if(_0x5edb83[_0xdf19('0x41')]===_0xdf19('0x48')&&_0x5edb83['variableName']&&_0x5edb83[_0xdf19('0x1d')]&&_0x5edb83[_0xdf19('0x44')]){_0x3e9f35[_0x5edb83['variableName']]&&_0x5e5d5e[_0xdf19('0x47')][_0xdf19('0x1c')]({'id':_0x5edb83['idField'],'value':_0x3e9f35[_0x5edb83[_0xdf19('0x1b')]]['toString']()});}else if(_0x5edb83[_0xdf19('0x41')]===_0xdf19('0x49')&&_0x5edb83[_0xdf19('0x4a')]&&_0x5edb83[_0xdf19('0x4a')]['name']&&_0x5edb83[_0xdf19('0x1d')]&&_0x5edb83[_0xdf19('0x44')]){_0x3e9f35[_0x5edb83[_0xdf19('0x4a')]['name'][_0xdf19('0x45')]()]&&_0x5e5d5e['custom_fields'][_0xdf19('0x1c')]({'id':_0x5edb83[_0xdf19('0x1d')],'value':_0x3e9f35[_0x5edb83[_0xdf19('0x4a')][_0xdf19('0xc')][_0xdf19('0x45')]()][_0xdf19('0x24')]()});}});}return _0x5e5d5e;}function getConnection(_0x7fc289){return request({'method':_0xdf19('0x4b'),'form':{'method':_0xdf19('0x4c'),'input_type':'JSON','response_type':_0xdf19('0x1f'),'rest_data':JSON[_0xdf19('0x20')]({'user_auth':{'user_name':_0x7fc289[_0xdf19('0x4d')],'password':_0x7fc289[_0xdf19('0x4e')],'encryption':'PLAIN'},'application':_0xdf19('0x4f')})}})[_0xdf19('0x2b')](function(_0x3da869){var _0x5c3582=_0x3da869;if(_0x5c3582['id']){def[_0xdf19('0x50')]=_0x5c3582['id'];return BPromise[_0xdf19('0x2f')](_0x5c3582);}else{throw new Error(util[_0xdf19('0x21')]('Account\x20%d\x20is\x20not\x20valid',_0x7fc289['id']));}});}function setRelationship(_0x4c7f1e,_0x5383e6,_0x10c308,_0x3d3b09){return request({'form':{'method':'set_relationship','input_type':_0xdf19('0x1f'),'response_type':_0xdf19('0x1f'),'rest_data':JSON[_0xdf19('0x20')]({'session':_0x4c7f1e['id'],'module_name':_0xdf19('0x51'),'module_id':_0x10c308['id'],'link_field_name':_0x3d3b09,'related_ids':[_0x5383e6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xdf19('0x52')]=function(_0x1c303d,_0x153cef,_0x14e99c,_0x103255,_0x346899,_0x257d65){var _0x4fb0ff,_0x42c7af,_0x5dc07f,_0x244eff;_0x257d65[_0xdf19('0x53')]=intUtil[_0xdf19('0x54')](_0x257d65[_0xdf19('0x53')]);_0x257d65[_0xdf19('0x55')]=intUtil[_0xdf19('0x54')](_0x257d65[_0xdf19('0x55')]);def['uri']=util[_0xdf19('0x21')](_0xdf19('0x56'),_0x257d65[_0xdf19('0x53')]);if(_0x346899&&_0x346899[_0xdf19('0x57')]){logger[_0xdf19('0xa')](_0xdf19('0x58'),_0xdf19('0x59'));_0x153cef[_0xdf19('0x5a')]=util[_0xdf19('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x257d65[_0xdf19('0x55')],_0x153cef[_0xdf19('0x5b')],md5(_0x153cef['uniqueid']));}else{_0x153cef[_0xdf19('0x5a')]='';}return getConnection(_0x257d65)[_0xdf19('0x2b')](function(_0x415806){_0x244eff=_0x415806;return getUser(_0x257d65,_0x103255[_0xdf19('0xc')],_0x244eff);})[_0xdf19('0x2b')](function(_0xede756){_0x4fb0ff=_0xede756;logger[_0xdf19('0xa')]('The\x20User\x20ID\x20is:',_0x4fb0ff['id']);return getEndUser(_0x257d65,_0x153cef['calleridname'],_0x153cef[_0xdf19('0x5c')],_0x244eff);})['then'](function(_0x19ba59){_0x42c7af=_0x19ba59;logger[_0xdf19('0xa')](_0xdf19('0x5d'),_0x42c7af['id']);return getTicket(_0x257d65,_0x4fb0ff,_0x42c7af,_0x14e99c,_0x153cef,_0x14e99c[_0xdf19('0x5e')],_0x244eff,_0xdf19('0x5f'));})[_0xdf19('0x2b')](function(_0x2f0028){_0x5dc07f=_0x2f0028;logger[_0xdf19('0xa')](_0xdf19('0x60'));logger[_0xdf19('0xa')](_0xdf19('0x61'),_0x5dc07f['id']);return setRelationship(_0x244eff,_0x4fb0ff,_0x5dc07f,_0xdf19('0x62'));})['then'](function(){return setRelationship(_0x244eff,_0x42c7af,_0x5dc07f,'contacts');})[_0xdf19('0x2b')](function(){return getServerInfo(_0x244eff);})['then'](function(_0x157a46){var _0x5926dc=parseInt(_0x157a46[_0xdf19('0x63')][_0xdf19('0x64')](0x0));var _0x4de4cc=util['format'](_0xdf19('0x65'),_0x257d65[_0xdf19('0x53')],_0x5dc07f['id']);if(_0x5926dc>0x6){_0x4de4cc=util['format'](_0xdf19('0x66'),_0x257d65[_0xdf19('0x53')],_0x5dc07f['id']);}logger[_0xdf19('0xa')](_0xdf19('0x58'),_0xdf19('0x67'));emit(util[_0xdf19('0x21')](_0xdf19('0x68'),_0x103255['name']),_0xdf19('0x69'),{'uri':_0x4de4cc});})[_0xdf19('0x6a')](function(_0xd7b850){logger[_0xdf19('0x6b')](_0xdf19('0x58'),JSON['stringify'](_0xd7b850));});};exports[_0xdf19('0x6c')]=function(_0x495abd,_0x36ab8d,_0x257694,_0xaad8a1,_0x4f2da6,_0x52e797,_0xd7f259){var _0x4c1714,_0x2fd6d1,_0x1cb62d,_0x2828b9;_0x52e797[_0xdf19('0x53')]=intUtil[_0xdf19('0x54')](_0x52e797[_0xdf19('0x53')]);_0x52e797['serverUrl']=intUtil[_0xdf19('0x54')](_0x52e797['serverUrl']);def[_0xdf19('0x6d')]=util[_0xdf19('0x21')]('%s/service/v4_1/rest.php',_0x52e797[_0xdf19('0x53')]);if(_0xd7f259&&_0xd7f259['recordingFormat']&&_0xd7f259[_0xdf19('0x6e')]!==_0xdf19('0x6f')){logger[_0xdf19('0xa')](_0xdf19('0x70'),_0xdf19('0x59'));_0x36ab8d['recordingURL']=util[_0xdf19('0x21')](_0xdf19('0x71'),_0x52e797[_0xdf19('0x55')],_0x36ab8d['uniqueid'],md5(_0x36ab8d['uniqueid']));}return getConnection(_0x52e797)[_0xdf19('0x2b')](function(_0x470aad){_0x2828b9=_0x470aad;return getUser(_0x52e797,_0xaad8a1['name'],_0x2828b9);})[_0xdf19('0x2b')](function(_0x329f74){_0x4c1714=_0x329f74;logger[_0xdf19('0xa')](_0xdf19('0x72'),_0x4c1714['id']);return getEndUser(_0x52e797,_0x36ab8d[_0xdf19('0x73')],_0x36ab8d[_0xdf19('0x74')],_0x2828b9);})[_0xdf19('0x2b')](function(_0x498301){_0x2fd6d1=_0x498301;logger[_0xdf19('0xa')](_0xdf19('0x5d'),_0x2fd6d1['id']);return getTicket(_0x52e797,_0x4c1714,_0x2fd6d1,_0x257694,_0x36ab8d,_0x257694[_0xdf19('0x5e')],_0x2828b9,_0xdf19('0x75'));})[_0xdf19('0x2b')](function(_0x31703a){_0x1cb62d=_0x31703a;logger[_0xdf19('0xa')]('Ticket\x20created!');logger['info'](_0xdf19('0x61'),_0x1cb62d['id']);return setRelationship(_0x2828b9,_0x4c1714,_0x1cb62d,'users');})['then'](function(){return setRelationship(_0x2828b9,_0x2fd6d1,_0x1cb62d,_0xdf19('0x76'));})[_0xdf19('0x2b')](function(){return getServerInfo(_0x2828b9);})[_0xdf19('0x2b')](function(_0xe43811){var _0x4e11f2=parseInt(_0xe43811['version']['charAt'](0x0));var _0x30021e=util[_0xdf19('0x21')](_0xdf19('0x65'),_0x52e797['remoteUri'],_0x1cb62d['id']);if(_0x4e11f2>0x6){_0x30021e=util[_0xdf19('0x21')](_0xdf19('0x66'),_0x52e797[_0xdf19('0x53')],_0x1cb62d['id']);}logger[_0xdf19('0xa')]('[OUTBOUND]',_0xdf19('0x67'));emit(util[_0xdf19('0x21')](_0xdf19('0x68'),_0xaad8a1[_0xdf19('0xc')]),_0xdf19('0x69'),{'uri':_0x30021e});})[_0xdf19('0x6a')](function(_0x1b7db9){logger[_0xdf19('0x6b')](_0xdf19('0x70'),JSON[_0xdf19('0x20')](_0x1b7db9));});};exports['unmanaged']=function(_0x272af2,_0x556cf6,_0x107abe,_0x37dc38,_0x26a972,_0x1a7272){var _0xa9c82e,_0x504bb0,_0x17c664,_0x3e817f;_0x1a7272[_0xdf19('0x53')]=intUtil['stripTrailingSlash'](_0x1a7272[_0xdf19('0x53')]);_0x1a7272['serverUrl']=intUtil[_0xdf19('0x54')](_0x1a7272[_0xdf19('0x55')]);def[_0xdf19('0x6d')]=util[_0xdf19('0x21')](_0xdf19('0x56'),_0x1a7272[_0xdf19('0x53')]);if(_0x26a972&&_0x26a972['monitor_format']){logger['info']('['+_0x556cf6['lastevent'][_0xdf19('0x77')]()+']',_0xdf19('0x59'));_0x556cf6[_0xdf19('0x5a')]=util[_0xdf19('0x21')](_0xdf19('0x71'),_0x1a7272['serverUrl'],_0x556cf6['uniqueid'],md5(_0x556cf6[_0xdf19('0x5b')]));}else{_0x556cf6[_0xdf19('0x5a')]='';}return getConnection(_0x1a7272)[_0xdf19('0x2b')](function(_0x2f75d2){_0x3e817f=_0x2f75d2;if(!_[_0xdf19('0x26')](_0x37dc38)){return getUser(_0x1a7272,_0x37dc38[_0xdf19('0xc')],_0x3e817f);}else{return getUser(_0x1a7272,null,_0x3e817f);}})['then'](function(_0x1440ae){_0xa9c82e=_0x1440ae;logger[_0xdf19('0xa')](_0xdf19('0x72'),_0xa9c82e['id']);return getEndUser(_0x1a7272,_0x556cf6['calleridname'],_0x556cf6[_0xdf19('0x5c')],_0x3e817f);})[_0xdf19('0x2b')](function(_0x5e6ca3){_0x504bb0=_0x5e6ca3;logger[_0xdf19('0xa')](_0xdf19('0x5d'),_0x504bb0['id']);return getTicket(_0x1a7272,_0xa9c82e,_0x504bb0,_0x107abe,_0x556cf6,_0x107abe['Fields'],_0x3e817f,_0xdf19('0x5f'));})[_0xdf19('0x2b')](function(_0x597f88){_0x17c664=_0x597f88;logger[_0xdf19('0xa')](_0xdf19('0x60'));logger[_0xdf19('0xa')](_0xdf19('0x61'),_0x17c664['id']);return setRelationship(_0x3e817f,_0xa9c82e,_0x17c664,_0xdf19('0x62'));})[_0xdf19('0x2b')](function(){return setRelationship(_0x3e817f,_0x504bb0,_0x17c664,_0xdf19('0x76'));})[_0xdf19('0x2b')](function(){return getServerInfo(_0x3e817f);})[_0xdf19('0x6a')](function(_0x17e33f){logger[_0xdf19('0x6b')]('['+_0x556cf6[_0xdf19('0x78')][_0xdf19('0x77')]()+']',JSON[_0xdf19('0x20')](_0x17e33f));});}; \ No newline at end of file +var _0x4d1f=['parent_name','direction','length','variableName','idField','set_entry','JSON','Calls','format','Basic\x20%s','toString','base64','get_server_info','stringify','isNil','get_entry_list','name','user_name','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','debug','[HTTP]','merge','forEach','type','string','customField','nameField','content','custom_fields','push','variable','Variable','toLowerCase','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','uri','recordingFormat','none','[OUTBOUND]','uniqueid','Outbound','catch','unmanaged','lastevent','Recording\x20is\x20enabled!','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','description','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts'];(function(_0x284c0c,_0x181aee){var _0x418b18=function(_0x5c1897){while(--_0x5c1897){_0x284c0c['push'](_0x284c0c['shift']());}};_0x418b18(++_0x181aee);}(_0x4d1f,0x141));var _0xf4d1=function(_0x27ebc7,_0x1b1662){_0x27ebc7=_0x27ebc7-0x0;var _0x3e0cb9=_0x4d1f[_0x27ebc7];return _0x3e0cb9;};'use strict';var _=require(_0xf4d1('0x0'));var rp=require(_0xf4d1('0x1'));var BPromise=require(_0xf4d1('0x2'));var md5=require(_0xf4d1('0x3'));var util=require(_0xf4d1('0x4'));var Redis=require(_0xf4d1('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xf4d1('0x6'))('sugarcrm');config[_0xf4d1('0x7')]=_['defaults'](config[_0xf4d1('0x7')],{'host':_0xf4d1('0x8'),'port':0x18eb});var io=require(_0xf4d1('0x9'))(new Redis(config[_0xf4d1('0x7')]));var def={'method':_0xf4d1('0xa'),'json':!![]};function emit(_0x52a1f5,_0x4e5ba2,_0x5c811c){io['to'](_0x52a1f5)['emit'](_0x4e5ba2,_0x5c811c);}function getTicket(_0x2a6fb0,_0x3cd3f4,_0x3fb951,_0x1d65ff,_0x114049,_0x9ecca,_0xeb74f,_0x49fd1f){logger[_0xf4d1('0xb')](_0xf4d1('0xc'));var _0x24dc60=new Date();var _0x1253be=[{'name':'name','value':intUtil[_0xf4d1('0xd')](_0x1d65ff['Subjects'],_0x114049,'\x20')},{'name':_0xf4d1('0xe'),'value':_0x3cd3f4['id']},{'name':_0xf4d1('0xf'),'value':_0x3cd3f4['id']},{'name':_0xf4d1('0x10'),'value':intUtil[_0xf4d1('0xd')](_0x1d65ff['Descriptions'],_0x114049,'\x0a')},{'name':'date_start','value':_0x24dc60[_0xf4d1('0x11')]()[_0xf4d1('0x12')](0x0,0x13)[_0xf4d1('0x13')]('T','\x20')},{'name':_0xf4d1('0x14'),'value':'0'},{'name':_0xf4d1('0x15'),'value':'15'},{'name':'parent_id','value':_0x3fb951['id']},{'name':_0xf4d1('0x16'),'value':_0xf4d1('0x17')},{'name':_0xf4d1('0x18'),'value':_0x3fb951['name']},{'name':_0xf4d1('0x19'),'value':_0x49fd1f}];if(_0x9ecca[_0xf4d1('0x1a')]){_['forEach'](_0x9ecca,function(_0x13c728){if(_0x114049[_0x13c728[_0xf4d1('0x1b')]]){_0x1253be['push']({'name':_0x13c728[_0xf4d1('0x1c')],'value':_0x114049[_0x13c728[_0xf4d1('0x1b')]]});}});}return request({'form':{'method':_0xf4d1('0x1d'),'input_type':_0xf4d1('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xeb74f['id'],'module_name':_0xf4d1('0x1f'),'name_value_list':_0x1253be})}});}function getAuth(_0x1c6499){return util[_0xf4d1('0x20')](_0xf4d1('0x21'),new Buffer(_0x1c6499['apiKey']+':X')[_0xf4d1('0x22')](_0xf4d1('0x23')));}function getServerInfo(_0x2de8f6){return request({'form':{'method':_0xf4d1('0x24'),'input_type':'JSON','response_type':_0xf4d1('0x1e'),'rest_data':JSON[_0xf4d1('0x25')]({'session':_0x2de8f6['id']})}});}function getUser(_0x41ecae,_0x103000,_0x5ae0cf){if(!_[_0xf4d1('0x26')](_0x103000)){logger[_0xf4d1('0xb')]('Getting\x20agent\x20with\x20name',_0x103000);return request({'form':{'method':_0xf4d1('0x27'),'input_type':'JSON','response_type':_0xf4d1('0x1e'),'rest_data':JSON[_0xf4d1('0x25')]({'session':_0x5ae0cf['id'],'module_name':'Employees','query':util[_0xf4d1('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x103000),'order_by':'','offset':'0','select_fields':['id',_0xf4d1('0x28'),_0xf4d1('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4dd433){if(_0x4dd433['entry_list']['length']){var _0x25c367=_[_0xf4d1('0x2a')](_0x4dd433['entry_list'],function(_0x505a10){return _0x505a10[_0xf4d1('0x2b')][_0xf4d1('0x29')][_0xf4d1('0x2c')]===_0x103000;});if(_0x25c367){logger['info'](_0xf4d1('0x2d'));return BPromise[_0xf4d1('0x2e')]({'id':_0x25c367['name_value_list']['id'][_0xf4d1('0x2c')],'name':_0x25c367['name_value_list'][_0xf4d1('0x28')]['value']});}}logger[_0xf4d1('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x5ae0cf[_0xf4d1('0x2b')][_0xf4d1('0x2f')]['value'],'name':_0x5ae0cf[_0xf4d1('0x2b')][_0xf4d1('0x29')][_0xf4d1('0x2c')]});});}else{logger[_0xf4d1('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf4d1('0x2e')]({'id':_0x5ae0cf['name_value_list'][_0xf4d1('0x2f')][_0xf4d1('0x2c')],'name':_0x5ae0cf[_0xf4d1('0x2b')]['user_name'][_0xf4d1('0x2c')]});}}function getEndUser(_0x5641bc,_0xe5bf7c,_0x648aae,_0x661476){logger['info'](_0xf4d1('0x30'),_0x648aae);return request({'form':{'method':_0xf4d1('0x27'),'input_type':'JSON','response_type':_0xf4d1('0x1e'),'rest_data':JSON['stringify']({'session':_0x661476['id'],'module_name':_0xf4d1('0x17'),'query':util[_0xf4d1('0x20')](_0xf4d1('0x31'),_0x648aae),'order_by':'','offset':'0','select_fields':['id',_0xf4d1('0x28'),_0xf4d1('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf4d1('0x33')](function(_0x2ecaeb){if(_0x2ecaeb[_0xf4d1('0x34')]['length']){var _0x43380e=_[_0xf4d1('0x2a')](_0x2ecaeb[_0xf4d1('0x34')],function(_0x568dfd){return _0x568dfd[_0xf4d1('0x2b')][_0xf4d1('0x32')][_0xf4d1('0x2c')]===_0x648aae;});if(_0x43380e){logger[_0xf4d1('0xb')](_0xf4d1('0x35'));return BPromise[_0xf4d1('0x2e')]({'id':_0x43380e[_0xf4d1('0x2b')]['id'][_0xf4d1('0x2c')],'name':_0x43380e[_0xf4d1('0x2b')][_0xf4d1('0x28')][_0xf4d1('0x2c')],'phone':_0x43380e[_0xf4d1('0x2b')][_0xf4d1('0x32')][_0xf4d1('0x2c')]});}}else{logger[_0xf4d1('0xb')](_0xf4d1('0x36'));return request({'form':{'method':_0xf4d1('0x1d'),'input_type':'JSON','response_type':_0xf4d1('0x1e'),'rest_data':JSON[_0xf4d1('0x25')]({'session':_0x661476['id'],'module_name':_0xf4d1('0x17'),'name_value_list':[{'name':_0xf4d1('0x37'),'value':_0xe5bf7c!==_0xf4d1('0x38')?_0xe5bf7c:util[_0xf4d1('0x20')]('Caller\x20-\x20%s',_0x648aae)},{'name':_0xf4d1('0x32'),'value':_0x648aae}]})}})['then'](function(_0x5076ba){logger['info']('Enduser\x20created.');return BPromise[_0xf4d1('0x2e')]({'id':_0x5076ba['id'],'name':_0x5076ba[_0xf4d1('0x34')][_0xf4d1('0x37')][_0xf4d1('0x2c')],'phone':_0x5076ba['entry_list']['phone_home']['value']});});}});}function request(_0x47b2e3){logger[_0xf4d1('0x39')](_0xf4d1('0x3a'),JSON[_0xf4d1('0x25')](_0x47b2e3));return rp(_[_0xf4d1('0x3b')](def,_0x47b2e3));}function getTags(_0x119e82,_0x395940){var _0x5811be=[];if(_0x119e82&&_0x119e82[_0xf4d1('0x1a')]>0x0){_0x5811be=_['map'](_0x119e82,_0x395940);}return _0x5811be;}function getCustomFields(_0x4977eb,_0x348945){var _0x5db497=[];var _0x13727b={'custom_fields':[]};if(_0x4977eb[_0xf4d1('0x1a')]>0x0){_[_0xf4d1('0x3c')](_0x4977eb,function(_0x5efbe4){if(_0x5efbe4[_0xf4d1('0x3d')]===_0xf4d1('0x3e')&&_0x5efbe4['nameField']&&!_0x5efbe4[_0xf4d1('0x3f')]){_0x13727b[_0x5efbe4[_0xf4d1('0x40')]['toLowerCase']()]=_0x5efbe4[_0xf4d1('0x41')][_0xf4d1('0x22')]();}else if(_0x5efbe4[_0xf4d1('0x3d')]===_0xf4d1('0x3e')&&_0x5efbe4[_0xf4d1('0x1c')]&&_0x5efbe4['customField']){_0x13727b[_0xf4d1('0x42')][_0xf4d1('0x43')]({'id':_0x5efbe4[_0xf4d1('0x1c')],'value':_0x5efbe4[_0xf4d1('0x41')][_0xf4d1('0x22')]()});}else if(_0x5efbe4[_0xf4d1('0x3d')]===_0xf4d1('0x44')&&_0x5efbe4[_0xf4d1('0x1b')]&&_0x5efbe4[_0xf4d1('0x1c')]&&_0x5efbe4[_0xf4d1('0x3f')]){_0x348945[_0x5efbe4['variableName']]&&_0x13727b[_0xf4d1('0x42')]['push']({'id':_0x5efbe4[_0xf4d1('0x1c')],'value':_0x348945[_0x5efbe4[_0xf4d1('0x1b')]]['toString']()});}else if(_0x5efbe4['type']==='customVariable'&&_0x5efbe4[_0xf4d1('0x45')]&&_0x5efbe4[_0xf4d1('0x45')][_0xf4d1('0x28')]&&_0x5efbe4[_0xf4d1('0x1c')]&&_0x5efbe4[_0xf4d1('0x3f')]){_0x348945[_0x5efbe4['Variable'][_0xf4d1('0x28')][_0xf4d1('0x46')]()]&&_0x13727b[_0xf4d1('0x42')][_0xf4d1('0x43')]({'id':_0x5efbe4[_0xf4d1('0x1c')],'value':_0x348945[_0x5efbe4[_0xf4d1('0x45')]['name'][_0xf4d1('0x46')]()][_0xf4d1('0x22')]()});}});}return _0x13727b;}function getConnection(_0x2d8c1d){return request({'method':'POST','form':{'method':_0xf4d1('0x47'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf4d1('0x25')]({'user_auth':{'user_name':_0x2d8c1d[_0xf4d1('0x48')],'password':_0x2d8c1d['password'],'encryption':'PLAIN'},'application':_0xf4d1('0x49')})}})[_0xf4d1('0x33')](function(_0x4d459a){var _0x618901=_0x4d459a;if(_0x618901['id']){def[_0xf4d1('0x4a')]=_0x618901['id'];return BPromise['resolve'](_0x618901);}else{throw new Error(util[_0xf4d1('0x20')](_0xf4d1('0x4b'),_0x2d8c1d['id']));}});}function setRelationship(_0x468fe1,_0x2bdd30,_0x2807b4,_0x3c3079){return request({'form':{'method':_0xf4d1('0x4c'),'input_type':'JSON','response_type':_0xf4d1('0x1e'),'rest_data':JSON[_0xf4d1('0x25')]({'session':_0x468fe1['id'],'module_name':_0xf4d1('0x1f'),'module_id':_0x2807b4['id'],'link_field_name':_0x3c3079,'related_ids':[_0x2bdd30['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf4d1('0x4d')]=function(_0x105fc5,_0x29793e,_0xd68800,_0x171004,_0x22fb17,_0x1cef3c){var _0x2e2162,_0x267345,_0x362f,_0x2b40dc;_0x1cef3c['remoteUri']=intUtil[_0xf4d1('0x4e')](_0x1cef3c['remoteUri']);_0x1cef3c[_0xf4d1('0x4f')]=intUtil['stripTrailingSlash'](_0x1cef3c['serverUrl']);def['uri']=util[_0xf4d1('0x20')](_0xf4d1('0x50'),_0x1cef3c[_0xf4d1('0x51')]);if(_0x22fb17&&_0x22fb17[_0xf4d1('0x52')]){logger[_0xf4d1('0xb')](_0xf4d1('0x53'),'Recording\x20is\x20enabled!');_0x29793e['recordingURL']=util['format'](_0xf4d1('0x54'),_0x1cef3c[_0xf4d1('0x4f')],_0x29793e['uniqueid'],md5(_0x29793e['uniqueid']));}else{_0x29793e[_0xf4d1('0x55')]='';}return getConnection(_0x1cef3c)[_0xf4d1('0x33')](function(_0x3ee466){_0x2b40dc=_0x3ee466;return getUser(_0x1cef3c,_0x171004[_0xf4d1('0x28')],_0x2b40dc);})[_0xf4d1('0x33')](function(_0xe9e8bb){_0x2e2162=_0xe9e8bb;logger[_0xf4d1('0xb')](_0xf4d1('0x56'),_0x2e2162['id']);return getEndUser(_0x1cef3c,_0x29793e[_0xf4d1('0x57')],_0x29793e[_0xf4d1('0x58')],_0x2b40dc);})[_0xf4d1('0x33')](function(_0x316b6f){_0x267345=_0x316b6f;logger[_0xf4d1('0xb')]('The\x20Enduser\x20ID\x20is:',_0x267345['id']);return getTicket(_0x1cef3c,_0x2e2162,_0x267345,_0xd68800,_0x29793e,_0xd68800[_0xf4d1('0x59')],_0x2b40dc,_0xf4d1('0x5a'));})['then'](function(_0x2121b3){_0x362f=_0x2121b3;logger[_0xf4d1('0xb')](_0xf4d1('0x5b'));logger[_0xf4d1('0xb')](_0xf4d1('0x5c'),_0x362f['id']);return setRelationship(_0x2b40dc,_0x2e2162,_0x362f,_0xf4d1('0x5d'));})[_0xf4d1('0x33')](function(){return setRelationship(_0x2b40dc,_0x267345,_0x362f,_0xf4d1('0x5e'));})[_0xf4d1('0x33')](function(){return getServerInfo(_0x2b40dc);})[_0xf4d1('0x33')](function(_0x507964){var _0x554712=parseInt(_0x507964[_0xf4d1('0x5f')][_0xf4d1('0x60')](0x0));var _0x3e63a1=util[_0xf4d1('0x20')](_0xf4d1('0x61'),_0x1cef3c['remoteUri'],_0x362f['id']);if(_0x554712>0x6){_0x3e63a1=util[_0xf4d1('0x20')](_0xf4d1('0x62'),_0x1cef3c['remoteUri'],_0x362f['id']);}logger['info']('[QUEUE]',_0xf4d1('0x63'));emit(util[_0xf4d1('0x20')](_0xf4d1('0x64'),_0x171004[_0xf4d1('0x28')]),_0xf4d1('0x65'),{'uri':_0x3e63a1});})['catch'](function(_0x2062ba){logger[_0xf4d1('0x66')](_0xf4d1('0x53'),JSON[_0xf4d1('0x25')](_0x2062ba));});};exports[_0xf4d1('0x67')]=function(_0x132283,_0x109ee4,_0x12c67f,_0x247c20,_0x3241df,_0xe65a67,_0x37d417){var _0x3c8d3d,_0x38db10,_0x23b7c8,_0x1ba5f5;_0xe65a67[_0xf4d1('0x51')]=intUtil['stripTrailingSlash'](_0xe65a67['remoteUri']);_0xe65a67[_0xf4d1('0x4f')]=intUtil['stripTrailingSlash'](_0xe65a67['serverUrl']);def[_0xf4d1('0x68')]=util[_0xf4d1('0x20')](_0xf4d1('0x50'),_0xe65a67[_0xf4d1('0x51')]);if(_0x37d417&&_0x37d417[_0xf4d1('0x69')]&&_0x37d417[_0xf4d1('0x69')]!==_0xf4d1('0x6a')){logger['info'](_0xf4d1('0x6b'),'Recording\x20is\x20enabled!');_0x109ee4[_0xf4d1('0x55')]=util['format'](_0xf4d1('0x54'),_0xe65a67[_0xf4d1('0x4f')],_0x109ee4[_0xf4d1('0x6c')],md5(_0x109ee4[_0xf4d1('0x6c')]));}return getConnection(_0xe65a67)[_0xf4d1('0x33')](function(_0x5ab851){_0x1ba5f5=_0x5ab851;return getUser(_0xe65a67,_0x247c20[_0xf4d1('0x28')],_0x1ba5f5);})['then'](function(_0x31ddfb){_0x3c8d3d=_0x31ddfb;logger[_0xf4d1('0xb')](_0xf4d1('0x56'),_0x3c8d3d['id']);return getEndUser(_0xe65a67,_0x109ee4['destcalleridname'],_0x109ee4['destcalleridnum'],_0x1ba5f5);})[_0xf4d1('0x33')](function(_0x5dd2a5){_0x38db10=_0x5dd2a5;logger[_0xf4d1('0xb')]('The\x20Enduser\x20ID\x20is:',_0x38db10['id']);return getTicket(_0xe65a67,_0x3c8d3d,_0x38db10,_0x12c67f,_0x109ee4,_0x12c67f[_0xf4d1('0x59')],_0x1ba5f5,_0xf4d1('0x6d'));})[_0xf4d1('0x33')](function(_0x3a19b1){_0x23b7c8=_0x3a19b1;logger[_0xf4d1('0xb')](_0xf4d1('0x5b'));logger[_0xf4d1('0xb')](_0xf4d1('0x5c'),_0x23b7c8['id']);return setRelationship(_0x1ba5f5,_0x3c8d3d,_0x23b7c8,'users');})[_0xf4d1('0x33')](function(){return setRelationship(_0x1ba5f5,_0x38db10,_0x23b7c8,_0xf4d1('0x5e'));})[_0xf4d1('0x33')](function(){return getServerInfo(_0x1ba5f5);})['then'](function(_0x32f09f){var _0xa17cb8=parseInt(_0x32f09f['version'][_0xf4d1('0x60')](0x0));var _0x4ddca8=util[_0xf4d1('0x20')](_0xf4d1('0x61'),_0xe65a67['remoteUri'],_0x23b7c8['id']);if(_0xa17cb8>0x6){_0x4ddca8=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xe65a67[_0xf4d1('0x51')],_0x23b7c8['id']);}logger[_0xf4d1('0xb')](_0xf4d1('0x6b'),_0xf4d1('0x63'));emit(util[_0xf4d1('0x20')]('user:%s',_0x247c20['name']),_0xf4d1('0x65'),{'uri':_0x4ddca8});})[_0xf4d1('0x6e')](function(_0x20fc5e){logger[_0xf4d1('0x66')]('[OUTBOUND]',JSON[_0xf4d1('0x25')](_0x20fc5e));});};exports[_0xf4d1('0x6f')]=function(_0x4d4b2d,_0x11bba0,_0x15bc21,_0x5939df,_0x4c2433,_0x4f2ec1){var _0x31d0f4,_0x34eed7,_0x49d219,_0xa9a69;_0x4f2ec1[_0xf4d1('0x51')]=intUtil[_0xf4d1('0x4e')](_0x4f2ec1['remoteUri']);_0x4f2ec1[_0xf4d1('0x4f')]=intUtil[_0xf4d1('0x4e')](_0x4f2ec1[_0xf4d1('0x4f')]);def[_0xf4d1('0x68')]=util[_0xf4d1('0x20')](_0xf4d1('0x50'),_0x4f2ec1[_0xf4d1('0x51')]);if(_0x4c2433&&_0x4c2433[_0xf4d1('0x52')]){logger[_0xf4d1('0xb')]('['+_0x11bba0[_0xf4d1('0x70')]['toUpperCase']()+']',_0xf4d1('0x71'));_0x11bba0['recordingURL']=util[_0xf4d1('0x20')](_0xf4d1('0x54'),_0x4f2ec1['serverUrl'],_0x11bba0[_0xf4d1('0x6c')],md5(_0x11bba0['uniqueid']));}else{_0x11bba0[_0xf4d1('0x55')]='';}return getConnection(_0x4f2ec1)[_0xf4d1('0x33')](function(_0x346313){_0xa9a69=_0x346313;if(!_['isNil'](_0x5939df)){return getUser(_0x4f2ec1,_0x5939df[_0xf4d1('0x28')],_0xa9a69);}else{return getUser(_0x4f2ec1,null,_0xa9a69);}})[_0xf4d1('0x33')](function(_0x239d0d){_0x31d0f4=_0x239d0d;logger[_0xf4d1('0xb')]('The\x20User\x20ID\x20is:',_0x31d0f4['id']);return getEndUser(_0x4f2ec1,_0x11bba0['calleridname'],_0x11bba0['calleridnum'],_0xa9a69);})[_0xf4d1('0x33')](function(_0xcc5a70){_0x34eed7=_0xcc5a70;logger['info'](_0xf4d1('0x72'),_0x34eed7['id']);return getTicket(_0x4f2ec1,_0x31d0f4,_0x34eed7,_0x15bc21,_0x11bba0,_0x15bc21[_0xf4d1('0x59')],_0xa9a69,_0xf4d1('0x5a'));})['then'](function(_0x2ad559){_0x49d219=_0x2ad559;logger[_0xf4d1('0xb')](_0xf4d1('0x5b'));logger[_0xf4d1('0xb')](_0xf4d1('0x5c'),_0x49d219['id']);return setRelationship(_0xa9a69,_0x31d0f4,_0x49d219,_0xf4d1('0x5d'));})[_0xf4d1('0x33')](function(){return setRelationship(_0xa9a69,_0x34eed7,_0x49d219,_0xf4d1('0x5e'));})[_0xf4d1('0x33')](function(){return getServerInfo(_0xa9a69);})['catch'](function(_0x559402){logger['error']('['+_0x11bba0[_0xf4d1('0x70')]['toUpperCase']()+']',JSON[_0xf4d1('0x25')](_0x559402));});}; \ 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 4002caa..45af8be 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 _0xec1a=['%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','util','getString','length','sortBy','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','string','key','format'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xec1a,0x18d));var _0xaec1=function(_0x3b10de,_0x3bb7e4){_0x3b10de=_0x3b10de-0x0;var _0x461407=_0xec1a[_0x3b10de];return _0x461407;};'use strict';var _=require(_0xaec1('0x0'));var util=require(_0xaec1('0x1'));exports[_0xaec1('0x2')]=function(_0x11d19a,_0x468b15,_0x5235ef){var _0x138919=[];if(_0x11d19a[_0xaec1('0x3')]>0x0){var _0x3db439=_[_0xaec1('0x4')](_0x11d19a,['id']);for(var _0x3cb30e=0x0;_0x3cb30e<_0x3db439[_0xaec1('0x3')];_0x3cb30e++){var _0x441dc9=_0x3db439[_0x3cb30e];if(_0x441dc9[_0xaec1('0x5')]==='string'){_0x138919[_0xaec1('0x6')](_0x441dc9[_0xaec1('0x7')]);}else if(_0x441dc9[_0xaec1('0x5')]===_0xaec1('0x8')&&_0x441dc9[_0xaec1('0x9')]){_0x468b15[_0x441dc9['variableName']]&&_0x138919[_0xaec1('0x6')](_0x468b15[_0x441dc9[_0xaec1('0x9')]][_0xaec1('0xa')]());}else if(_0x441dc9[_0xaec1('0x5')]===_0xaec1('0xb')&&_0x441dc9[_0xaec1('0xc')]&&_0x441dc9[_0xaec1('0xc')][_0xaec1('0xd')]){_0x468b15[_0x441dc9[_0xaec1('0xc')][_0xaec1('0xd')][_0xaec1('0xe')]()]&&_0x138919[_0xaec1('0x6')](_0x468b15[_0x441dc9[_0xaec1('0xc')]['name']['toLowerCase']()][_0xaec1('0xa')]());}else if(_0x441dc9[_0xaec1('0x5')]==='keyValue'){if(_0x441dc9[_0xaec1('0xf')]===_0xaec1('0x10')&&_0x441dc9[_0xaec1('0x11')]){_0x138919[_0xaec1('0x6')](util[_0xaec1('0x12')](_0xaec1('0x13'),_0x441dc9[_0xaec1('0x11')],_0x441dc9[_0xaec1('0x14')]));}else if(_0x441dc9[_0xaec1('0xf')]===_0xaec1('0x8')&&_0x441dc9[_0xaec1('0x9')]&&_0x441dc9['key']){_0x468b15[_0x441dc9[_0xaec1('0x9')]]&&_0x138919['push'](util['format'](_0xaec1('0x13'),_0x441dc9[_0xaec1('0x11')],_0x468b15[_0x441dc9['variableName']]));}else if(_0x441dc9[_0xaec1('0xf')]===_0xaec1('0xb')&&_0x441dc9['Variable']&&_0x441dc9[_0xaec1('0xc')]['name']&&_0x441dc9[_0xaec1('0x11')]){_0x468b15[_0x441dc9[_0xaec1('0xc')][_0xaec1('0xd')]['toLowerCase']()]&&_0x138919[_0xaec1('0x6')](util['format']('%s:\x20%s',_0x441dc9[_0xaec1('0x11')],_0x468b15[_0x441dc9[_0xaec1('0xc')]['name'][_0xaec1('0xe')]()]));}}}}return _0x138919['join'](_0x5235ef);};exports[_0xaec1('0x15')]=function(_0x443dc2){var _0x55b51f=_0x443dc2[_0xaec1('0x16')](-0x1);if(_0x55b51f==='/'){_0x443dc2=_0x443dc2[_0xaec1('0x17')](0x0,_0x443dc2[_0xaec1('0x18')](_0x55b51f));}return _0x443dc2;};exports[_0xaec1('0x19')]=function(_0x1fe8c8){if(!_['isNil'](_0x1fe8c8)&&_0x1fe8c8!==''){var _0x28dae0=/^(([^<>()\[\]\\.,;:\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 _0x28dae0['test'](String(_0x1fe8c8)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x13ea=['string','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type'];(function(_0x3a899f,_0x13e418){var _0x576098=function(_0x48e261){while(--_0x48e261){_0x3a899f['push'](_0x3a899f['shift']());}};_0x576098(++_0x13e418);}(_0x13ea,0x1ba));var _0xa13e=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0x13ea[_0x8cb2f9];return _0x164887;};'use strict';var _=require(_0xa13e('0x0'));var util=require(_0xa13e('0x1'));exports[_0xa13e('0x2')]=function(_0xf5696a,_0x5befd2,_0xc8814c){var _0x169219=[];if(_0xf5696a[_0xa13e('0x3')]>0x0){var _0x2c810d=_[_0xa13e('0x4')](_0xf5696a,['id']);for(var _0x267728=0x0;_0x267728<_0x2c810d['length'];_0x267728++){var _0xf6fc83=_0x2c810d[_0x267728];if(_0xf6fc83[_0xa13e('0x5')]===_0xa13e('0x6')){_0x169219['push'](_0xf6fc83['content']);}else if(_0xf6fc83[_0xa13e('0x5')]===_0xa13e('0x7')&&_0xf6fc83[_0xa13e('0x8')]){_0x5befd2[_0xf6fc83[_0xa13e('0x8')]]&&_0x169219[_0xa13e('0x9')](_0x5befd2[_0xf6fc83[_0xa13e('0x8')]][_0xa13e('0xa')]());}else if(_0xf6fc83[_0xa13e('0x5')]==='customVariable'&&_0xf6fc83[_0xa13e('0xb')]&&_0xf6fc83['Variable'][_0xa13e('0xc')]){_0x5befd2[_0xf6fc83[_0xa13e('0xb')]['name'][_0xa13e('0xd')]()]&&_0x169219[_0xa13e('0x9')](_0x5befd2[_0xf6fc83[_0xa13e('0xb')][_0xa13e('0xc')][_0xa13e('0xd')]()][_0xa13e('0xa')]());}else if(_0xf6fc83['type']===_0xa13e('0xe')){if(_0xf6fc83[_0xa13e('0xf')]===_0xa13e('0x6')&&_0xf6fc83[_0xa13e('0x10')]){_0x169219[_0xa13e('0x9')](util[_0xa13e('0x11')](_0xa13e('0x12'),_0xf6fc83[_0xa13e('0x10')],_0xf6fc83['keyContent']));}else if(_0xf6fc83[_0xa13e('0xf')]==='variable'&&_0xf6fc83[_0xa13e('0x8')]&&_0xf6fc83[_0xa13e('0x10')]){_0x5befd2[_0xf6fc83[_0xa13e('0x8')]]&&_0x169219[_0xa13e('0x9')](util[_0xa13e('0x11')](_0xa13e('0x12'),_0xf6fc83[_0xa13e('0x10')],_0x5befd2[_0xf6fc83['variableName']]));}else if(_0xf6fc83[_0xa13e('0xf')]===_0xa13e('0x13')&&_0xf6fc83[_0xa13e('0xb')]&&_0xf6fc83[_0xa13e('0xb')][_0xa13e('0xc')]&&_0xf6fc83[_0xa13e('0x10')]){_0x5befd2[_0xf6fc83['Variable'][_0xa13e('0xc')]['toLowerCase']()]&&_0x169219[_0xa13e('0x9')](util['format'](_0xa13e('0x12'),_0xf6fc83['key'],_0x5befd2[_0xf6fc83[_0xa13e('0xb')][_0xa13e('0xc')][_0xa13e('0xd')]()]));}}}}return _0x169219[_0xa13e('0x14')](_0xc8814c);};exports[_0xa13e('0x15')]=function(_0x505ee2){var _0x3d0a89=_0x505ee2[_0xa13e('0x16')](-0x1);if(_0x3d0a89==='/'){_0x505ee2=_0x505ee2[_0xa13e('0x17')](0x0,_0x505ee2[_0xa13e('0x18')](_0x3d0a89));}return _0x505ee2;};exports[_0xa13e('0x19')]=function(_0x35bb0e){if(!_[_0xa13e('0x1a')](_0x35bb0e)&&_0x35bb0e!==''){var _0x4995ca=/^(([^<>()\[\]\\.,;:\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 _0x4995ca[_0xa13e('0x1b')](String(_0x35bb0e)[_0xa13e('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 1ad882c..b93689b 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 _0xfa6d=['sessionName','stringify','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','GET','query','then','info','Agent\x20found!','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','statusCode','admin','catch','getUser','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','email','destcalleridname','Ticket\x20created!','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','create','username'];(function(_0x5db855,_0xbdcdc){var _0x41a2c5=function(_0x1ead48){while(--_0x1ead48){_0x5db855['push'](_0x5db855['shift']());}};_0x41a2c5(++_0xbdcdc);}(_0xfa6d,0x105));var _0xdfa6=function(_0x31951a,_0x30827f){_0x31951a=_0x31951a-0x0;var _0x314540=_0xfa6d[_0x31951a];return _0x314540;};'use strict';var _=require(_0xdfa6('0x0'));var rp=require(_0xdfa6('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0xdfa6('0x2'));var intUtil=require(_0xdfa6('0x3'));var config=require(_0xdfa6('0x4'));var logger=require(_0xdfa6('0x5'))(_0xdfa6('0x6'));config[_0xdfa6('0x7')]=_['defaults'](config['redis'],{'host':_0xdfa6('0x8'),'port':0x18eb});var io=require(_0xdfa6('0x9'))(new Redis(config[_0xdfa6('0x7')]));function emit(_0x22af17,_0x11b5bd,_0x5dc092){io['to'](_0x22af17)[_0xdfa6('0xa')](_0x11b5bd,_0x5dc092);}function getCustomFields(_0x137049,_0x5722f1){var _0x5e744b={};if(_0x137049[_0xdfa6('0xb')]>0x0){_[_0xdfa6('0xc')](_0x137049,function(_0x54d3cd){if(_[_0xdfa6('0xd')](['string',_0xdfa6('0xe')],_0x54d3cd[_0xdfa6('0xf')])&&_0x54d3cd[_0xdfa6('0x10')]){_0x5e744b[_0x54d3cd[_0xdfa6('0x10')]]=_0x54d3cd[_0xdfa6('0x11')][_0xdfa6('0x12')]();}else if(_0x54d3cd[_0xdfa6('0xf')]===_0xdfa6('0x13')&&_0x54d3cd[_0xdfa6('0x14')]&&_0x54d3cd[_0xdfa6('0x10')]&&_0x5722f1[_0x54d3cd[_0xdfa6('0x14')]]){_0x5e744b[_0x54d3cd[_0xdfa6('0x10')]]=_0x5722f1[_0x54d3cd['variableName']][_0xdfa6('0x12')]();}else if(_0x54d3cd[_0xdfa6('0xf')]===_0xdfa6('0x15')&&_0x54d3cd[_0xdfa6('0x16')]&&_0x54d3cd[_0xdfa6('0x16')][_0xdfa6('0x17')]&&_0x54d3cd[_0xdfa6('0x10')]&&_0x5722f1[_0x54d3cd[_0xdfa6('0x16')][_0xdfa6('0x17')][_0xdfa6('0x18')]()]){_0x5e744b[_0x54d3cd['idField']]=_0x5722f1[_0x54d3cd[_0xdfa6('0x16')][_0xdfa6('0x17')]['toLowerCase']()][_0xdfa6('0x12')]();}});}return _0x5e744b;}function createTicket(_0x42e9f9,_0x539184,_0x8f4d59,_0x45b945,_0x11fb19,_0x56a9ca,_0x5630e4){logger['info'](_0xdfa6('0x19'));var _0x2da52c=_[_0xdfa6('0x1a')]({'parent_id':'','assigned_user_id':_0x539184['id'],'ticketpriorities':_0xdfa6('0x1b'),'ticketstatus':'Open','ticket_title':intUtil[_0xdfa6('0x1c')](_0x45b945[_0xdfa6('0x1d')],_0x11fb19,'\x20'),'description':intUtil[_0xdfa6('0x1c')](_0x45b945[_0xdfa6('0x1e')],_0x11fb19,'\x0a'),'contact_id':_0x8f4d59['id']},getCustomFields(_0x56a9ca,_0x11fb19));var _0xb9fee7={'method':_0xdfa6('0x1f'),'uri':util['format'](_0xdfa6('0x20'),_0x42e9f9[_0xdfa6('0x21')]),'form':{'operation':_0xdfa6('0x22'),'username':_0x42e9f9[_0xdfa6('0x23')],'sessionName':_0x5630e4[_0xdfa6('0x24')],'elementType':'HelpDesk','element':JSON[_0xdfa6('0x25')](_0x2da52c)},'json':!![]};return request(_0xb9fee7)['then'](function(_0x468fce){if(_0x468fce[_0xdfa6('0x26')]){return BPromise[_0xdfa6('0x27')]({'id':_0x468fce[_0xdfa6('0x28')]['id']});}else{throw new Error(util[_0xdfa6('0x29')](_0xdfa6('0x2a'),JSON[_0xdfa6('0x25')](_0x468fce[_0xdfa6('0x2b')])));}})['catch'](function(_0x244685){var _0x186c61=_0x244685['statusCode']||0x1f4;logger[_0xdfa6('0x2b')](_0xdfa6('0x2c'),_0xdfa6('0x2d'),_0x186c61,JSON[_0xdfa6('0x25')](_0x244685));});}function getUser(_0x5b0914,_0x3c90a8,_0x3056db){if(intUtil['validateEmail'](_0x3c90a8)){logger['info'](_0xdfa6('0x2e'),_0x3c90a8);return request({'method':_0xdfa6('0x2f'),'uri':util[_0xdfa6('0x29')](_0xdfa6('0x20'),_0x5b0914[_0xdfa6('0x21')]),'qs':{'operation':_0xdfa6('0x30'),'username':_0x5b0914[_0xdfa6('0x23')],'sessionName':_0x3056db[_0xdfa6('0x24')],'query':util[_0xdfa6('0x29')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x3c90a8)},'json':!![]})[_0xdfa6('0x31')](function(_0x4ff3bb){if(_0x4ff3bb['success']&&_0x4ff3bb['result'][_0xdfa6('0xb')]){logger[_0xdfa6('0x32')](_0xdfa6('0x33'));return BPromise[_0xdfa6('0x27')]({'id':_0x4ff3bb['result'][0x0]['id'],'email':_0x4ff3bb[_0xdfa6('0x28')][0x0]['email1'],'name':_0x4ff3bb['result'][0x0][_0xdfa6('0x34')]+'\x20'+_0x4ff3bb[_0xdfa6('0x28')]['last_name']});}else{logger['info'](_0xdfa6('0x35'));return BPromise[_0xdfa6('0x27')]({'id':_0x3056db[_0xdfa6('0x36')],'email':_0x5b0914[_0xdfa6('0x23')],'name':'admin'});}})['catch'](function(_0x87cb8b){var _0x4984c0=_0x87cb8b[_0xdfa6('0x37')]||0x1f4;logger[_0xdfa6('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x4984c0,JSON[_0xdfa6('0x25')](_0x87cb8b));});}else{logger[_0xdfa6('0x32')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3056db[_0xdfa6('0x36')],'email':_0x5b0914['username'],'name':_0xdfa6('0x38')})[_0xdfa6('0x39')](function(_0x5a95f2){var _0x567f94=_0x5a95f2[_0xdfa6('0x37')]||0x1f4;logger[_0xdfa6('0x2b')](_0xdfa6('0x2c'),_0xdfa6('0x3a'),_0x567f94,JSON[_0xdfa6('0x25')](_0x5a95f2));});}}function getEndUser(_0x57bbb3,_0x197afa,_0x35cfd6,_0x5894bf){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x35cfd6);return request({'method':_0xdfa6('0x2f'),'uri':util['format'](_0xdfa6('0x20'),_0x57bbb3[_0xdfa6('0x21')]),'qs':{'operation':_0xdfa6('0x30'),'username':_0x57bbb3[_0xdfa6('0x23')],'sessionName':_0x5894bf[_0xdfa6('0x24')],'query':util[_0xdfa6('0x29')](_0xdfa6('0x3b'),_0x35cfd6,_0x35cfd6,_0x35cfd6,_0x35cfd6,_0x35cfd6)},'json':!![]})[_0xdfa6('0x31')](function(_0x363c5c){if(_0x363c5c[_0xdfa6('0x26')]&&_0x363c5c[_0xdfa6('0x28')][_0xdfa6('0xb')]){logger[_0xdfa6('0x32')](_0xdfa6('0x3c'));return BPromise[_0xdfa6('0x27')]({'id':_0x363c5c[_0xdfa6('0x28')][0x0]['id'],'name':_0x363c5c[_0xdfa6('0x28')][0x0][_0xdfa6('0x3d')]+'\x20'+_0x363c5c[_0xdfa6('0x28')][0x0][_0xdfa6('0x3e')],'phone':_0x35cfd6});}else{logger[_0xdfa6('0x32')](_0xdfa6('0x3f'));return request({'method':_0xdfa6('0x1f'),'uri':util[_0xdfa6('0x29')]('%s/webservice.php',_0x57bbb3[_0xdfa6('0x21')]),'form':{'operation':_0xdfa6('0x22'),'sessionName':_0x5894bf[_0xdfa6('0x24')],'elementType':_0xdfa6('0x40'),'element':JSON[_0xdfa6('0x25')]({'lastname':_0x197afa,'phone':_0x35cfd6,'assigned_user_id':'\x20'})},'json':!![]})[_0xdfa6('0x31')](function(_0x1d2bea){logger[_0xdfa6('0x32')]('Enduser\x20created.');return BPromise[_0xdfa6('0x27')]({'id':_0x1d2bea[_0xdfa6('0x28')]['id'],'name':_0x1d2bea[_0xdfa6('0x28')]['lastname'],'phone':_0x1d2bea['result']['phone']});})[_0xdfa6('0x39')](function(_0x4e247a){var _0xb57cef=_0x4e247a[_0xdfa6('0x37')]||0x1f4;logger['error'](_0xdfa6('0x2c'),_0xdfa6('0x41'),_0xb57cef,JSON[_0xdfa6('0x25')](_0x4e247a));});}});}function getConnection(_0x2a035e){var _0x3df168=_0x2a035e['username'];var _0x4d63d4=_0x2a035e[_0xdfa6('0x42')];return request({'method':'GET','uri':util[_0xdfa6('0x29')](_0xdfa6('0x20'),_0x2a035e['remoteUri']),'qs':{'operation':_0xdfa6('0x43'),'username':_0x3df168},'json':!![]})[_0xdfa6('0x31')](function(_0x3b0382){if(_0x3b0382[_0xdfa6('0x26')]){return request({'method':_0xdfa6('0x1f'),'uri':util[_0xdfa6('0x29')](_0xdfa6('0x20'),_0x2a035e[_0xdfa6('0x21')]),'form':{'operation':'login','username':_0x3df168,'accessKey':md5(_0x3b0382['result'][_0xdfa6('0x44')]+_0x4d63d4)},'json':!![]});}})[_0xdfa6('0x31')](function(_0xfc2093){if(_0xfc2093['success']){return BPromise[_0xdfa6('0x27')](_0xfc2093['result']);}else{throw new Error(util['format'](_0xdfa6('0x45'),_0x2a035e['id']));}})['catch'](function(_0x5193da){var _0x1c2856=_0x5193da[_0xdfa6('0x37')]||0x1f4;logger[_0xdfa6('0x2b')](_0xdfa6('0x2c'),_0xdfa6('0x46'),_0x1c2856,JSON['stringify'](_0x5193da));});}function request(_0x369063){logger[_0xdfa6('0x32')](_0xdfa6('0x47'),JSON['stringify'](_0x369063));return rp(_0x369063);}exports[_0xdfa6('0x48')]=function(_0x3e7492,_0x51acae,_0x571802,_0x33c639,_0x7fe55a,_0x6b3fb6){var _0x698e88,_0x33d46a,_0x4a34d5,_0x5e0507;_0x6b3fb6[_0xdfa6('0x21')]=intUtil[_0xdfa6('0x49')](_0x6b3fb6[_0xdfa6('0x21')]);if(_0x7fe55a&&_0x7fe55a[_0xdfa6('0x4a')]){logger[_0xdfa6('0x32')](_0xdfa6('0x4b'),_0xdfa6('0x4c'));_0x51acae[_0xdfa6('0x4d')]=util['format'](_0xdfa6('0x4e'),_0x6b3fb6[_0xdfa6('0x4f')],_0x51acae[_0xdfa6('0x50')],md5(_0x51acae[_0xdfa6('0x50')]));}else{_0x51acae[_0xdfa6('0x4d')]='';}return getConnection(_0x6b3fb6)[_0xdfa6('0x31')](function(_0x1cd9ad){_0x5e0507=_0x1cd9ad;return getUser(_0x6b3fb6,_0x33c639['email'],_0x5e0507);})['then'](function(_0x4149d7){_0x698e88=_0x4149d7;logger[_0xdfa6('0x32')](_0xdfa6('0x51'),_0x698e88['id']);return getEndUser(_0x6b3fb6,_0x51acae[_0xdfa6('0x52')],_0x51acae[_0xdfa6('0x53')],_0x5e0507);})[_0xdfa6('0x31')](function(_0x20bdcd){_0x33d46a=_0x20bdcd;logger[_0xdfa6('0x32')](_0xdfa6('0x54'),_0x33d46a['id']);return createTicket(_0x6b3fb6,_0x698e88,_0x33d46a,_0x571802,_0x51acae,_0x571802[_0xdfa6('0x55')],_0x5e0507);})[_0xdfa6('0x31')](function(_0x4a9105){_0x4a34d5=_0x4a9105;logger['info']('Ticket\x20created!');logger[_0xdfa6('0x32')]('The\x20Ticket\x20ID\x20is:',_0x4a34d5['id']);var _0x187db3=util['format'](_0xdfa6('0x56'),_0x6b3fb6[_0xdfa6('0x21')],_[_0xdfa6('0x57')](_0x4a34d5['id'],'x')[0x1]);logger['info'](_0xdfa6('0x4b'),_0xdfa6('0x58'));emit(util[_0xdfa6('0x29')](_0xdfa6('0x59'),_0x33c639['name']),_0xdfa6('0x5a'),{'uri':_0x187db3});})[_0xdfa6('0x39')](function(_0xe4d9ae){logger['error'](_0xdfa6('0x4b'),JSON['stringify'](_0xe4d9ae));});};exports[_0xdfa6('0x5b')]=function(_0x1481bf,_0xee8ba5,_0x8aad8d,_0x30cf49,_0x1a73c8,_0x1f7404,_0x48e0fb){var _0x55293a,_0x464733,_0x342f99,_0x301c4e;_0x1f7404[_0xdfa6('0x21')]=intUtil[_0xdfa6('0x49')](_0x1f7404[_0xdfa6('0x21')]);_0x1f7404[_0xdfa6('0x4f')]=intUtil[_0xdfa6('0x49')](_0x1f7404[_0xdfa6('0x4f')]);if(_0x48e0fb&&_0x48e0fb[_0xdfa6('0x5c')]&&_0x48e0fb[_0xdfa6('0x5c')]!=='none'){logger[_0xdfa6('0x32')]('[OUTBOUND]',_0xdfa6('0x4c'));_0xee8ba5['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f7404[_0xdfa6('0x4f')],_0xee8ba5['uniqueid'],md5(_0xee8ba5['uniqueid']));}return getConnection(_0x1f7404)[_0xdfa6('0x31')](function(_0x3a048e){_0x301c4e=_0x3a048e;return getUser(_0x1f7404,_0x30cf49[_0xdfa6('0x5d')],_0x301c4e);})['then'](function(_0xba9d4c){_0x55293a=_0xba9d4c;logger[_0xdfa6('0x32')](_0xdfa6('0x51'),_0x55293a['id']);return getEndUser(_0x1f7404,_0xee8ba5[_0xdfa6('0x5e')],_0xee8ba5['destcalleridnum'],_0x301c4e);})[_0xdfa6('0x31')](function(_0x54eaac){_0x464733=_0x54eaac;logger[_0xdfa6('0x32')]('The\x20Enduser\x20ID\x20is:',_0x464733['id']);return createTicket(_0x1f7404,_0x55293a,_0x464733,_0x8aad8d,_0xee8ba5,_0x8aad8d[_0xdfa6('0x55')],_0x301c4e);})[_0xdfa6('0x31')](function(_0x4ba1ae){_0x342f99=_0x4ba1ae;logger['info'](_0xdfa6('0x5f'));logger[_0xdfa6('0x32')]('The\x20Ticket\x20ID\x20is:',_0x342f99['id']);var _0x12c598=util[_0xdfa6('0x29')](_0xdfa6('0x56'),_0x1f7404[_0xdfa6('0x21')],_[_0xdfa6('0x57')](_0x342f99['id'],'x')[0x1]);logger['info']('[OUTBOUND]',_0xdfa6('0x58'));emit(util[_0xdfa6('0x29')](_0xdfa6('0x59'),_0x30cf49['name']),'trigger:browser:url',{'uri':_0x12c598});})[_0xdfa6('0x39')](function(_0x1982d8){logger[_0xdfa6('0x2b')](_0xdfa6('0x60'),JSON[_0xdfa6('0x25')](_0x1982d8));});};exports[_0xdfa6('0x61')]=function(_0x11f1d3,_0x3419cf,_0x22f573,_0x466691,_0x4100cc,_0x39dcbd){var _0x10300c,_0x59029e,_0x26e0c0,_0x5eff53;_0x39dcbd[_0xdfa6('0x21')]=intUtil[_0xdfa6('0x49')](_0x39dcbd[_0xdfa6('0x21')]);_0x39dcbd[_0xdfa6('0x4f')]=intUtil['stripTrailingSlash'](_0x39dcbd[_0xdfa6('0x4f')]);if(_0x4100cc&&_0x4100cc[_0xdfa6('0x4a')]){logger[_0xdfa6('0x32')]('['+_0x3419cf['lastevent'][_0xdfa6('0x62')]()+']',_0xdfa6('0x4c'));_0x3419cf['recordingURL']=util[_0xdfa6('0x29')](_0xdfa6('0x4e'),_0x39dcbd[_0xdfa6('0x4f')],_0x3419cf[_0xdfa6('0x50')],md5(_0x3419cf[_0xdfa6('0x50')]));}else{_0x3419cf[_0xdfa6('0x4d')]='';}return getConnection(_0x39dcbd)[_0xdfa6('0x31')](function(_0x457173){_0x5eff53=_0x457173;return getUser(_0x39dcbd,'',_0x5eff53);})[_0xdfa6('0x31')](function(_0x23a391){_0x10300c=_0x23a391;logger[_0xdfa6('0x32')](_0xdfa6('0x51'),_0x10300c['id']);return getEndUser(_0x39dcbd,_0x3419cf['calleridname'],_0x3419cf[_0xdfa6('0x53')],_0x5eff53);})[_0xdfa6('0x31')](function(_0x1c25d4){_0x59029e=_0x1c25d4;logger['info'](_0xdfa6('0x54'),_0x59029e['id']);return createTicket(_0x39dcbd,_0x10300c,_0x59029e,_0x22f573,_0x3419cf,_0x22f573[_0xdfa6('0x55')],_0x5eff53);})[_0xdfa6('0x31')](function(_0x1fc110){_0x26e0c0=_0x1fc110;logger['info'](_0xdfa6('0x5f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x26e0c0['id']);})[_0xdfa6('0x39')](function(_0x569b43){logger[_0xdfa6('0x2b')]('['+_0x3419cf['lastevent'][_0xdfa6('0x62')]()+']',JSON[_0xdfa6('0x25')](_0x569b43));});}; \ No newline at end of file +var _0xedd0=['lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','sessionName','HelpDesk','stringify','then','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','createTicket','Getting\x20agent\x20with\x20email','GET','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','resolve','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','[vTiger],\x20%s,\x20%s,\x20%s','getUser','userId','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','Enduser\x20created.','getEndUser','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','email','destcalleridnum','[OUTBOUND]','monitor_format','lastevent','toUpperCase'];(function(_0x3c5fee,_0x4699a1){var _0x5f216a=function(_0x4d0964){while(--_0x4d0964){_0x3c5fee['push'](_0x3c5fee['shift']());}};_0x5f216a(++_0x4699a1);}(_0xedd0,0x6c));var _0x0edd=function(_0x55e799,_0x1bf571){_0x55e799=_0x55e799-0x0;var _0x5f1bd0=_0xedd0[_0x55e799];return _0x5f1bd0;};'use strict';var _=require(_0x0edd('0x0'));var rp=require(_0x0edd('0x1'));var BPromise=require(_0x0edd('0x2'));var md5=require('md5');var util=require(_0x0edd('0x3'));var Redis=require(_0x0edd('0x4'));var intUtil=require(_0x0edd('0x5'));var config=require(_0x0edd('0x6'));var logger=require(_0x0edd('0x7'))(_0x0edd('0x8'));config[_0x0edd('0x9')]=_[_0x0edd('0xa')](config[_0x0edd('0x9')],{'host':_0x0edd('0xb'),'port':0x18eb});var io=require(_0x0edd('0xc'))(new Redis(config['redis']));function emit(_0x253349,_0x58424b,_0x3bbc20){io['to'](_0x253349)[_0x0edd('0xd')](_0x58424b,_0x3bbc20);}function getCustomFields(_0x1da86f,_0x558ceb){var _0xfff04f={};if(_0x1da86f[_0x0edd('0xe')]>0x0){_[_0x0edd('0xf')](_0x1da86f,function(_0x4fc596){if(_[_0x0edd('0x10')]([_0x0edd('0x11'),_0x0edd('0x12')],_0x4fc596[_0x0edd('0x13')])&&_0x4fc596[_0x0edd('0x14')]){_0xfff04f[_0x4fc596[_0x0edd('0x14')]]=_0x4fc596[_0x0edd('0x15')]['toString']();}else if(_0x4fc596[_0x0edd('0x13')]===_0x0edd('0x16')&&_0x4fc596[_0x0edd('0x17')]&&_0x4fc596[_0x0edd('0x14')]&&_0x558ceb[_0x4fc596['variableName']]){_0xfff04f[_0x4fc596[_0x0edd('0x14')]]=_0x558ceb[_0x4fc596[_0x0edd('0x17')]][_0x0edd('0x18')]();}else if(_0x4fc596[_0x0edd('0x13')]===_0x0edd('0x19')&&_0x4fc596['Variable']&&_0x4fc596[_0x0edd('0x1a')][_0x0edd('0x1b')]&&_0x4fc596[_0x0edd('0x14')]&&_0x558ceb[_0x4fc596[_0x0edd('0x1a')]['name'][_0x0edd('0x1c')]()]){_0xfff04f[_0x4fc596[_0x0edd('0x14')]]=_0x558ceb[_0x4fc596[_0x0edd('0x1a')]['name'][_0x0edd('0x1c')]()]['toString']();}});}return _0xfff04f;}function createTicket(_0x57d878,_0x3a926c,_0x2dea0f,_0x357e73,_0x135e94,_0x55ef01,_0x59b85e){logger[_0x0edd('0x1d')](_0x0edd('0x1e'));var _0x2c21e5=_[_0x0edd('0x1f')]({'parent_id':'','assigned_user_id':_0x3a926c['id'],'ticketpriorities':_0x0edd('0x20'),'ticketstatus':_0x0edd('0x21'),'ticket_title':intUtil[_0x0edd('0x22')](_0x357e73[_0x0edd('0x23')],_0x135e94,'\x20'),'description':intUtil[_0x0edd('0x22')](_0x357e73[_0x0edd('0x24')],_0x135e94,'\x0a'),'contact_id':_0x2dea0f['id']},getCustomFields(_0x55ef01,_0x135e94));var _0x20bfd6={'method':_0x0edd('0x25'),'uri':util[_0x0edd('0x26')](_0x0edd('0x27'),_0x57d878[_0x0edd('0x28')]),'form':{'operation':'create','username':_0x57d878['username'],'sessionName':_0x59b85e[_0x0edd('0x29')],'elementType':_0x0edd('0x2a'),'element':JSON[_0x0edd('0x2b')](_0x2c21e5)},'json':!![]};return request(_0x20bfd6)[_0x0edd('0x2c')](function(_0x257cfc){if(_0x257cfc[_0x0edd('0x2d')]){return BPromise['resolve']({'id':_0x257cfc[_0x0edd('0x2e')]['id']});}else{throw new Error(util['format'](_0x0edd('0x2f'),JSON['stringify'](_0x257cfc[_0x0edd('0x30')])));}})[_0x0edd('0x31')](function(_0x5bff24){var _0x580ff6=_0x5bff24[_0x0edd('0x32')]||0x1f4;logger[_0x0edd('0x30')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0edd('0x33'),_0x580ff6,JSON[_0x0edd('0x2b')](_0x5bff24));});}function getUser(_0x1e2c8f,_0x95c792,_0x56ccac){if(intUtil['validateEmail'](_0x95c792)){logger['info'](_0x0edd('0x34'),_0x95c792);return request({'method':_0x0edd('0x35'),'uri':util['format'](_0x0edd('0x27'),_0x1e2c8f[_0x0edd('0x28')]),'qs':{'operation':_0x0edd('0x36'),'username':_0x1e2c8f[_0x0edd('0x37')],'sessionName':_0x56ccac[_0x0edd('0x29')],'query':util[_0x0edd('0x26')](_0x0edd('0x38'),_0x95c792)},'json':!![]})[_0x0edd('0x2c')](function(_0x2fa65e){if(_0x2fa65e[_0x0edd('0x2d')]&&_0x2fa65e[_0x0edd('0x2e')][_0x0edd('0xe')]){logger['info'](_0x0edd('0x39'));return BPromise[_0x0edd('0x3a')]({'id':_0x2fa65e['result'][0x0]['id'],'email':_0x2fa65e[_0x0edd('0x2e')][0x0]['email1'],'name':_0x2fa65e['result'][0x0][_0x0edd('0x3b')]+'\x20'+_0x2fa65e['result'][_0x0edd('0x3c')]});}else{logger[_0x0edd('0x1d')](_0x0edd('0x3d'));return BPromise[_0x0edd('0x3a')]({'id':_0x56ccac['userId'],'email':_0x1e2c8f[_0x0edd('0x37')],'name':'admin'});}})[_0x0edd('0x31')](function(_0x11243b){var _0x5ba8cf=_0x11243b[_0x0edd('0x32')]||0x1f4;logger[_0x0edd('0x30')](_0x0edd('0x3e'),_0x0edd('0x3f'),_0x5ba8cf,JSON['stringify'](_0x11243b));});}else{logger[_0x0edd('0x1d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0edd('0x3a')]({'id':_0x56ccac[_0x0edd('0x40')],'email':_0x1e2c8f['username'],'name':_0x0edd('0x41')})[_0x0edd('0x31')](function(_0x5f5182){var _0x948df3=_0x5f5182[_0x0edd('0x32')]||0x1f4;logger[_0x0edd('0x30')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x948df3,JSON[_0x0edd('0x2b')](_0x5f5182));});}}function getEndUser(_0x1c5163,_0x56728f,_0x4bbf28,_0x306310){logger['info'](_0x0edd('0x42'),_0x4bbf28);return request({'method':'GET','uri':util[_0x0edd('0x26')](_0x0edd('0x27'),_0x1c5163[_0x0edd('0x28')]),'qs':{'operation':_0x0edd('0x36'),'username':_0x1c5163[_0x0edd('0x37')],'sessionName':_0x306310[_0x0edd('0x29')],'query':util[_0x0edd('0x26')](_0x0edd('0x43'),_0x4bbf28,_0x4bbf28,_0x4bbf28,_0x4bbf28,_0x4bbf28)},'json':!![]})[_0x0edd('0x2c')](function(_0xd74fa7){if(_0xd74fa7[_0x0edd('0x2d')]&&_0xd74fa7[_0x0edd('0x2e')][_0x0edd('0xe')]){logger[_0x0edd('0x1d')]('Enduser\x20found!');return BPromise[_0x0edd('0x3a')]({'id':_0xd74fa7['result'][0x0]['id'],'name':_0xd74fa7[_0x0edd('0x2e')][0x0]['firstname']+'\x20'+_0xd74fa7[_0x0edd('0x2e')][0x0][_0x0edd('0x44')],'phone':_0x4bbf28});}else{logger[_0x0edd('0x1d')](_0x0edd('0x45'));return request({'method':_0x0edd('0x25'),'uri':util[_0x0edd('0x26')]('%s/webservice.php',_0x1c5163[_0x0edd('0x28')]),'form':{'operation':_0x0edd('0x46'),'sessionName':_0x306310[_0x0edd('0x29')],'elementType':_0x0edd('0x47'),'element':JSON[_0x0edd('0x2b')]({'lastname':_0x56728f,'phone':_0x4bbf28,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x139130){logger[_0x0edd('0x1d')](_0x0edd('0x48'));return BPromise['resolve']({'id':_0x139130[_0x0edd('0x2e')]['id'],'name':_0x139130[_0x0edd('0x2e')][_0x0edd('0x44')],'phone':_0x139130[_0x0edd('0x2e')]['phone']});})['catch'](function(_0x463be3){var _0x28b3d1=_0x463be3[_0x0edd('0x32')]||0x1f4;logger[_0x0edd('0x30')](_0x0edd('0x3e'),_0x0edd('0x49'),_0x28b3d1,JSON[_0x0edd('0x2b')](_0x463be3));});}});}function getConnection(_0x1c2936){var _0x1ba07a=_0x1c2936[_0x0edd('0x37')];var _0x2a37a5=_0x1c2936['accessKey'];return request({'method':_0x0edd('0x35'),'uri':util[_0x0edd('0x26')]('%s/webservice.php',_0x1c2936[_0x0edd('0x28')]),'qs':{'operation':_0x0edd('0x4a'),'username':_0x1ba07a},'json':!![]})['then'](function(_0x470ef6){if(_0x470ef6[_0x0edd('0x2d')]){return request({'method':_0x0edd('0x25'),'uri':util[_0x0edd('0x26')]('%s/webservice.php',_0x1c2936[_0x0edd('0x28')]),'form':{'operation':_0x0edd('0x4b'),'username':_0x1ba07a,'accessKey':md5(_0x470ef6[_0x0edd('0x2e')][_0x0edd('0x4c')]+_0x2a37a5)},'json':!![]});}})[_0x0edd('0x2c')](function(_0x22c651){if(_0x22c651[_0x0edd('0x2d')]){return BPromise[_0x0edd('0x3a')](_0x22c651[_0x0edd('0x2e')]);}else{throw new Error(util[_0x0edd('0x26')](_0x0edd('0x4d'),_0x1c2936['id']));}})[_0x0edd('0x31')](function(_0xea3b7c){var _0x45cb84=_0xea3b7c[_0x0edd('0x32')]||0x1f4;logger[_0x0edd('0x30')](_0x0edd('0x3e'),_0x0edd('0x4e'),_0x45cb84,JSON[_0x0edd('0x2b')](_0xea3b7c));});}function request(_0x23f3d1){logger[_0x0edd('0x1d')](_0x0edd('0x4f'),JSON['stringify'](_0x23f3d1));return rp(_0x23f3d1);}exports['queue']=function(_0x2639e3,_0x4044ef,_0x15154b,_0x121ec9,_0x25dba8,_0x4748d6){var _0x2e0b4a,_0x42714f,_0xfe07c2,_0x57b044;_0x4748d6[_0x0edd('0x28')]=intUtil[_0x0edd('0x50')](_0x4748d6[_0x0edd('0x28')]);if(_0x25dba8&&_0x25dba8['monitor_format']){logger[_0x0edd('0x1d')](_0x0edd('0x51'),_0x0edd('0x52'));_0x4044ef[_0x0edd('0x53')]=util[_0x0edd('0x26')](_0x0edd('0x54'),_0x4748d6[_0x0edd('0x55')],_0x4044ef[_0x0edd('0x56')],md5(_0x4044ef[_0x0edd('0x56')]));}else{_0x4044ef[_0x0edd('0x53')]='';}return getConnection(_0x4748d6)[_0x0edd('0x2c')](function(_0x5785cc){_0x57b044=_0x5785cc;return getUser(_0x4748d6,_0x121ec9['email'],_0x57b044);})[_0x0edd('0x2c')](function(_0x137f78){_0x2e0b4a=_0x137f78;logger[_0x0edd('0x1d')](_0x0edd('0x57'),_0x2e0b4a['id']);return getEndUser(_0x4748d6,_0x4044ef[_0x0edd('0x58')],_0x4044ef[_0x0edd('0x59')],_0x57b044);})[_0x0edd('0x2c')](function(_0x175046){_0x42714f=_0x175046;logger[_0x0edd('0x1d')](_0x0edd('0x5a'),_0x42714f['id']);return createTicket(_0x4748d6,_0x2e0b4a,_0x42714f,_0x15154b,_0x4044ef,_0x15154b[_0x0edd('0x5b')],_0x57b044);})[_0x0edd('0x2c')](function(_0x15f840){_0xfe07c2=_0x15f840;logger[_0x0edd('0x1d')](_0x0edd('0x5c'));logger['info'](_0x0edd('0x5d'),_0xfe07c2['id']);var _0x27b099=util['format'](_0x0edd('0x5e'),_0x4748d6[_0x0edd('0x28')],_[_0x0edd('0x5f')](_0xfe07c2['id'],'x')[0x1]);logger[_0x0edd('0x1d')](_0x0edd('0x51'),_0x0edd('0x60'));emit(util['format'](_0x0edd('0x61'),_0x121ec9[_0x0edd('0x1b')]),_0x0edd('0x62'),{'uri':_0x27b099});})[_0x0edd('0x31')](function(_0x29e760){logger[_0x0edd('0x30')]('[QUEUE]',JSON['stringify'](_0x29e760));});};exports[_0x0edd('0x63')]=function(_0x244a1d,_0x5d5185,_0x82f1bd,_0x5771a2,_0x3a6458,_0xf30359,_0x1e8719){var _0x5e9828,_0x38509b,_0x2b3d64,_0x2aa445;_0xf30359['remoteUri']=intUtil[_0x0edd('0x50')](_0xf30359[_0x0edd('0x28')]);_0xf30359['serverUrl']=intUtil[_0x0edd('0x50')](_0xf30359['serverUrl']);if(_0x1e8719&&_0x1e8719[_0x0edd('0x64')]&&_0x1e8719[_0x0edd('0x64')]!==_0x0edd('0x65')){logger[_0x0edd('0x1d')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5d5185[_0x0edd('0x53')]=util[_0x0edd('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf30359[_0x0edd('0x55')],_0x5d5185['uniqueid'],md5(_0x5d5185[_0x0edd('0x56')]));}return getConnection(_0xf30359)[_0x0edd('0x2c')](function(_0x27d23f){_0x2aa445=_0x27d23f;return getUser(_0xf30359,_0x5771a2[_0x0edd('0x66')],_0x2aa445);})[_0x0edd('0x2c')](function(_0x1aabea){_0x5e9828=_0x1aabea;logger[_0x0edd('0x1d')](_0x0edd('0x57'),_0x5e9828['id']);return getEndUser(_0xf30359,_0x5d5185['destcalleridname'],_0x5d5185[_0x0edd('0x67')],_0x2aa445);})[_0x0edd('0x2c')](function(_0x3fead6){_0x38509b=_0x3fead6;logger[_0x0edd('0x1d')](_0x0edd('0x5a'),_0x38509b['id']);return createTicket(_0xf30359,_0x5e9828,_0x38509b,_0x82f1bd,_0x5d5185,_0x82f1bd[_0x0edd('0x5b')],_0x2aa445);})[_0x0edd('0x2c')](function(_0x40bcc4){_0x2b3d64=_0x40bcc4;logger['info'](_0x0edd('0x5c'));logger['info'](_0x0edd('0x5d'),_0x2b3d64['id']);var _0x38b3b4=util['format'](_0x0edd('0x5e'),_0xf30359[_0x0edd('0x28')],_[_0x0edd('0x5f')](_0x2b3d64['id'],'x')[0x1]);logger[_0x0edd('0x1d')](_0x0edd('0x68'),_0x0edd('0x60'));emit(util[_0x0edd('0x26')]('user:%s',_0x5771a2[_0x0edd('0x1b')]),_0x0edd('0x62'),{'uri':_0x38b3b4});})[_0x0edd('0x31')](function(_0x4dfbdd){logger[_0x0edd('0x30')](_0x0edd('0x68'),JSON[_0x0edd('0x2b')](_0x4dfbdd));});};exports['unmanaged']=function(_0x2fdc4f,_0x6ee6bb,_0xbf4fec,_0xd84a8c,_0x3201c3,_0x2dd12c){var _0x33d20b,_0x419be7,_0xbeb23f,_0x16e8b3;_0x2dd12c[_0x0edd('0x28')]=intUtil['stripTrailingSlash'](_0x2dd12c[_0x0edd('0x28')]);_0x2dd12c['serverUrl']=intUtil['stripTrailingSlash'](_0x2dd12c[_0x0edd('0x55')]);if(_0x3201c3&&_0x3201c3[_0x0edd('0x69')]){logger['info']('['+_0x6ee6bb[_0x0edd('0x6a')][_0x0edd('0x6b')]()+']','Recording\x20is\x20enabled!');_0x6ee6bb[_0x0edd('0x53')]=util[_0x0edd('0x26')](_0x0edd('0x54'),_0x2dd12c['serverUrl'],_0x6ee6bb['uniqueid'],md5(_0x6ee6bb[_0x0edd('0x56')]));}else{_0x6ee6bb[_0x0edd('0x53')]='';}return getConnection(_0x2dd12c)[_0x0edd('0x2c')](function(_0x322dee){_0x16e8b3=_0x322dee;return getUser(_0x2dd12c,'',_0x16e8b3);})['then'](function(_0x2272a3){_0x33d20b=_0x2272a3;logger['info'](_0x0edd('0x57'),_0x33d20b['id']);return getEndUser(_0x2dd12c,_0x6ee6bb[_0x0edd('0x58')],_0x6ee6bb['calleridnum'],_0x16e8b3);})[_0x0edd('0x2c')](function(_0x2be254){_0x419be7=_0x2be254;logger[_0x0edd('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x419be7['id']);return createTicket(_0x2dd12c,_0x33d20b,_0x419be7,_0xbf4fec,_0x6ee6bb,_0xbf4fec[_0x0edd('0x5b')],_0x16e8b3);})[_0x0edd('0x2c')](function(_0x4d5b72){_0xbeb23f=_0x4d5b72;logger[_0x0edd('0x1d')](_0x0edd('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0xbeb23f['id']);})[_0x0edd('0x31')](function(_0x50dbed){logger[_0x0edd('0x30')]('['+_0x6ee6bb[_0x0edd('0x6a')][_0x0edd('0x6b')]()+']',JSON['stringify'](_0x50dbed));});}; \ 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 5d23240..e658922 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 _0x6a38=['zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','./util','../../../../config/environment','../../../../config/logger'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x6a38,0x13d));var _0x86a3=function(_0x49076c,_0x2d9594){_0x49076c=_0x49076c-0x0;var _0x1d685f=_0x6a38[_0x49076c];return _0x1d685f;};'use strict';var _=require(_0x86a3('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x86a3('0x1'));var config=require(_0x86a3('0x2'));var logger=require(_0x86a3('0x3'))(_0x86a3('0x4'));config[_0x86a3('0x5')]=_[_0x86a3('0x6')](config[_0x86a3('0x5')],{'host':_0x86a3('0x7'),'port':0x18eb});var io=require(_0x86a3('0x8'))(new Redis(config[_0x86a3('0x5')]));function emit(_0x2d11bd,_0x41bdd2,_0x2a2ea2){io['to'](_0x2d11bd)[_0x86a3('0x9')](_0x41bdd2,_0x2a2ea2);}var headers={'Content-Type':_0x86a3('0xa'),'Accept':_0x86a3('0xa')};function getTicket(_0x192c9b,_0x4a1dcf,_0x2a0ad1,_0x37adcd,_0x12c097){logger[_0x86a3('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util['format']('%s/tickets.json',_0x192c9b[_0x86a3('0xc')]),'method':_0x86a3('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x2a0ad1['id'],'submitter_id':_0x4a1dcf?_0x4a1dcf['id']:undefined,'assignee_id':_0x4a1dcf?_0x4a1dcf['id']:undefined,'tags':getTags(_0x37adcd[_0x86a3('0xe')],_0x86a3('0xf')),'subject':intUtil[_0x86a3('0x10')](_0x37adcd[_0x86a3('0x11')],_0x12c097,'\x20'),'description':intUtil[_0x86a3('0x10')](_0x37adcd[_0x86a3('0x12')],_0x12c097,'\x0a'),'comment':{'public':![],'body':intUtil[_0x86a3('0x10')](_0x37adcd[_0x86a3('0x12')],_0x12c097,'\x0a')}},getCustomFields(_0x37adcd['Fields'],_0x12c097))}})[_0x86a3('0x13')](function(_0x4dc81b){logger[_0x86a3('0xb')](_0x86a3('0x14'));return _0x4dc81b[_0x86a3('0x15')];});}function getUser(_0x234cee,_0x5c7c5b){if(intUtil[_0x86a3('0x16')](_0x5c7c5b)){logger[_0x86a3('0xb')](_0x86a3('0x17'),_0x5c7c5b);return request({'uri':util[_0x86a3('0x18')]('%s/search.json',_0x234cee[_0x86a3('0xc')]),'qs':{'query':util[_0x86a3('0x18')](_0x86a3('0x19'),_0x5c7c5b)}})[_0x86a3('0x13')](function(_0x3539d4){if(_0x3539d4[_0x86a3('0x1a')]){logger[_0x86a3('0xb')](_0x86a3('0x1b'));return _[_0x86a3('0x1c')](_0x3539d4['results'],{'email':_0x5c7c5b,'role':'agent'});}else{logger[_0x86a3('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x86a3('0x18')]('%s/users/me.json',_0x234cee['remoteUri'])})[_0x86a3('0x13')](function(_0x5d7b28){logger[_0x86a3('0xb')](_0x86a3('0x1d'));return _0x5d7b28[_0x86a3('0x1e')];});}});}else{logger[_0x86a3('0xb')](_0x86a3('0x1f'));return request({'uri':util[_0x86a3('0x18')](_0x86a3('0x20'),_0x234cee[_0x86a3('0xc')])})[_0x86a3('0x13')](function(_0x41b485){logger[_0x86a3('0xb')](_0x86a3('0x1d'));return _0x41b485[_0x86a3('0x1e')];});}}function getEndUser(_0x38a295,_0x40de03,_0x3ad118){logger[_0x86a3('0xb')](_0x86a3('0x21'),_0x3ad118);return request({'uri':util['format'](_0x86a3('0x22'),_0x38a295[_0x86a3('0xc')]),'qs':{'query':util['format'](_0x86a3('0x23'),_0x3ad118)}})['then'](function(_0x4397b9){var _0x26747f;if(_0x4397b9[_0x86a3('0x24')][_0x86a3('0x25')]){_0x4397b9[_0x86a3('0x24')]=_[_0x86a3('0x26')](_0x4397b9[_0x86a3('0x24')],{'suspended':![],'role':_0x86a3('0x27')});if(_0x4397b9[_0x86a3('0x24')][_0x86a3('0x25')]){_0x26747f=_[_0x86a3('0x28')](_0x4397b9[_0x86a3('0x24')]);}}if(_0x26747f){logger[_0x86a3('0xb')](_0x86a3('0x29'));return _0x26747f;}else{logger['info'](_0x86a3('0x2a'));return request({'uri':util[_0x86a3('0x18')](_0x86a3('0x2b'),_0x38a295['remoteUri']),'method':_0x86a3('0xd'),'body':{'user':{'role':_0x86a3('0x27'),'name':util['format'](_0x86a3('0x2c'),_0x40de03||_0x3ad118),'phone':_0x3ad118}}})[_0x86a3('0x13')](function(_0x15d5e3){logger['info'](_0x86a3('0x2d'));return _0x15d5e3[_0x86a3('0x1e')];});}});}function getAuth(_0x5f53ac){var _0x4828bc;if(_0x5f53ac[_0x86a3('0x2e')]===_0x86a3('0x2f')){_0x4828bc=util['format'](_0x86a3('0x30'),_0x5f53ac[_0x86a3('0x31')],_0x5f53ac[_0x86a3('0x2f')]);}else if(_0x5f53ac[_0x86a3('0x2e')]===_0x86a3('0x32')){_0x4828bc=util[_0x86a3('0x18')](_0x86a3('0x33'),_0x5f53ac[_0x86a3('0x31')],_0x5f53ac[_0x86a3('0x32')]);}return util[_0x86a3('0x18')](_0x86a3('0x34'),new Buffer(_0x4828bc)['toString']('base64'));}function request(_0x2327aa){logger['debug']('[HTTP]',JSON['stringify'](_0x2327aa));return rp(_[_0x86a3('0x6')](_0x2327aa,{'method':_0x86a3('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x1587b9,_0x501650){var _0x47a427=[];if(_0x1587b9&&_0x1587b9['length']>0x0){_0x47a427=_[_0x86a3('0x36')](_0x1587b9,_0x501650);}return _0x47a427;}function getCustomFields(_0x40bcb6,_0x29af81){var _0x46b6c2=[];var _0x5449f0={'custom_fields':[]};if(_0x40bcb6[_0x86a3('0x25')]>0x0){_[_0x86a3('0x37')](_0x40bcb6,function(_0x216ebc){if(_[_0x86a3('0x38')](['string',_0x86a3('0x39')],_0x216ebc[_0x86a3('0x3a')])&&_0x216ebc[_0x86a3('0x3b')]&&!_0x216ebc[_0x86a3('0x3c')]){_0x5449f0[_0x216ebc[_0x86a3('0x3b')][_0x86a3('0x3d')]()]=_0x216ebc[_0x86a3('0x3e')][_0x86a3('0x3f')]();}else if(_[_0x86a3('0x38')](['string',_0x86a3('0x39')],_0x216ebc[_0x86a3('0x3a')])&&_0x216ebc[_0x86a3('0x40')]&&_0x216ebc[_0x86a3('0x3c')]){_0x5449f0[_0x86a3('0x41')][_0x86a3('0x42')]({'id':_0x216ebc['idField'],'value':_0x216ebc[_0x86a3('0x3e')]['toString']()});}else if(_0x216ebc['type']===_0x86a3('0x43')&&_0x216ebc[_0x86a3('0x44')]&&_0x216ebc[_0x86a3('0x40')]&&_0x216ebc[_0x86a3('0x3c')]){_0x29af81[_0x216ebc['variableName']]&&_0x5449f0['custom_fields'][_0x86a3('0x42')]({'id':_0x216ebc[_0x86a3('0x40')],'value':_0x29af81[_0x216ebc[_0x86a3('0x44')]][_0x86a3('0x3f')]()});}else if(_0x216ebc['type']==='customVariable'&&_0x216ebc[_0x86a3('0x45')]&&_0x216ebc[_0x86a3('0x45')][_0x86a3('0xf')]&&_0x216ebc[_0x86a3('0x40')]&&_0x216ebc[_0x86a3('0x3c')]){_0x29af81[_0x216ebc['Variable'][_0x86a3('0xf')][_0x86a3('0x3d')]()]&&_0x5449f0['custom_fields'][_0x86a3('0x42')]({'id':_0x216ebc[_0x86a3('0x40')],'value':_0x29af81[_0x216ebc[_0x86a3('0x45')][_0x86a3('0xf')][_0x86a3('0x3d')]()][_0x86a3('0x3f')]()});}});}return _0x5449f0;}exports[_0x86a3('0x46')]=function(_0x5d1334,_0x429d9a,_0x400238,_0x19aae3,_0x2f816e,_0x5d633e){var _0x1239e,_0x16b1de;_0x5d633e[_0x86a3('0xc')]=intUtil[_0x86a3('0x47')](_0x5d633e[_0x86a3('0xc')]);_0x5d633e['serverUrl']=intUtil['stripTrailingSlash'](_0x5d633e[_0x86a3('0x48')]);if(_0x2f816e&&_0x2f816e[_0x86a3('0x49')]){logger[_0x86a3('0xb')](_0x86a3('0x4a'),_0x86a3('0x4b'));_0x429d9a['recordingURL']=util[_0x86a3('0x18')](_0x86a3('0x4c'),_0x5d633e[_0x86a3('0x48')],_0x429d9a[_0x86a3('0x4d')],md5(_0x429d9a['uniqueid']));}else{_0x429d9a[_0x86a3('0x4e')]='';}headers[_0x86a3('0x4f')]=getAuth(_0x5d633e);return getUser(_0x5d633e,_0x19aae3[_0x86a3('0x50')])[_0x86a3('0x13')](function(_0x2bbb19){_0x1239e=_0x2bbb19;logger[_0x86a3('0xb')](_0x86a3('0x51'),_0x1239e['id']);return getEndUser(_0x5d633e,_0x429d9a['calleridname'],_0x429d9a[_0x86a3('0x52')]);})['then'](function(_0x6f9df6){_0x16b1de=_0x6f9df6;logger[_0x86a3('0xb')](_0x86a3('0x53'),_0x16b1de['id']);return getTicket(_0x5d633e,_0x1239e,_0x16b1de,_0x400238,_0x429d9a);})[_0x86a3('0x13')](function(_0x42641b){if(_0x42641b){logger[_0x86a3('0xb')](_0x86a3('0x54'),_0x42641b['id']);switch(_0x5d633e[_0x86a3('0x3a')]){case _0x86a3('0x55'):logger['info'](_0x86a3('0x4a'),_0x86a3('0x56'));return request({'uri':util['format'](_0x86a3('0x57'),_0x5d633e[_0x86a3('0xc')],_0x1239e['id'],_0x42641b['id']),'method':_0x86a3('0xd')});case _0x86a3('0x58'):logger[_0x86a3('0xb')](_0x86a3('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x86a3('0x18')](_0x86a3('0x59'),_0x19aae3[_0x86a3('0xf')]),_0x86a3('0x5a'),{'uri':util[_0x86a3('0x18')](_0x86a3('0x5b'),_0x5d633e[_0x86a3('0xc')][_0x86a3('0x5c')](_0x86a3('0x5d'),''),_0x42641b['id'])});break;default:logger[_0x86a3('0x5e')](_0x86a3('0x4a'),_0x86a3('0x5f'));}}})[_0x86a3('0x60')](function(_0x29cb53){logger[_0x86a3('0x5e')](_0x86a3('0x61'),util[_0x86a3('0x62')](_0x29cb53,{'showHidden':!![],'depth':null}));});};exports[_0x86a3('0x63')]=function(_0x442734,_0x5709c0,_0x21a730,_0x2f2230,_0x36a5fc,_0x28f05b,_0x69deb7){var _0x4e1872,_0x96c893;_0x28f05b[_0x86a3('0xc')]=intUtil[_0x86a3('0x47')](_0x28f05b['remoteUri']);_0x28f05b['serverUrl']=intUtil[_0x86a3('0x47')](_0x28f05b[_0x86a3('0x48')]);if(_0x69deb7&&_0x69deb7[_0x86a3('0x64')]&&_0x69deb7[_0x86a3('0x64')]!=='none'){logger[_0x86a3('0xb')](_0x86a3('0x65'),'Recording\x20is\x20enabled!');_0x5709c0[_0x86a3('0x4e')]=util['format'](_0x86a3('0x4c'),_0x28f05b[_0x86a3('0x48')],_0x5709c0[_0x86a3('0x4d')],md5(_0x5709c0['uniqueid']));}headers[_0x86a3('0x4f')]=getAuth(_0x28f05b);return getUser(_0x28f05b,_0x2f2230['email'])[_0x86a3('0x13')](function(_0x3d915e){_0x4e1872=_0x3d915e;logger[_0x86a3('0xb')](_0x86a3('0x51'),_0x4e1872['id']);return getEndUser(_0x28f05b,_0x5709c0[_0x86a3('0x66')],_0x5709c0[_0x86a3('0x67')]);})[_0x86a3('0x13')](function(_0xf99fbb){_0x96c893=_0xf99fbb;logger['info']('The\x20Enduser\x20ID\x20is:',_0x96c893['id']);return getTicket(_0x28f05b,_0x4e1872,_0x96c893,_0x21a730,_0x5709c0);})[_0x86a3('0x13')](function(_0x2a4b8c){if(_0x2a4b8c){logger[_0x86a3('0xb')](_0x86a3('0x54'),_0x2a4b8c['id']);switch(_0x28f05b[_0x86a3('0x3a')]){case'integrationTab':logger[_0x86a3('0xb')](_0x86a3('0x65'),_0x86a3('0x56'));return request({'uri':util['format'](_0x86a3('0x57'),_0x28f05b['remoteUri'],_0x4e1872['id'],_0x2a4b8c['id']),'method':_0x86a3('0xd')});case _0x86a3('0x58'):logger[_0x86a3('0xb')](_0x86a3('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x86a3('0x18')]('user:%s',_0x2f2230[_0x86a3('0xf')]),_0x86a3('0x5a'),{'uri':util[_0x86a3('0x18')](_0x86a3('0x5b'),_0x28f05b['remoteUri']['replace']('/api/v2',''),_0x2a4b8c['id'])});break;default:logger[_0x86a3('0x5e')](_0x86a3('0x65'),_0x86a3('0x5f'));}}})['catch'](function(_0x42f162){logger[_0x86a3('0x5e')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x86a3('0x62')](_0x42f162,{'showHidden':!![],'depth':null}));});};exports[_0x86a3('0x68')]=function(_0x4ee548,_0x10a722,_0x2d39d5,_0x3c5109,_0x127f03,_0x555c61){var _0x3e9da9,_0x4d39c6;_0x555c61[_0x86a3('0xc')]=intUtil[_0x86a3('0x47')](_0x555c61[_0x86a3('0xc')]);_0x555c61[_0x86a3('0x48')]=intUtil['stripTrailingSlash'](_0x555c61[_0x86a3('0x48')]);if(_0x127f03&&_0x127f03[_0x86a3('0x49')]){logger[_0x86a3('0xb')]('['+_0x10a722['lastevent'][_0x86a3('0x69')]()+']',_0x86a3('0x4b'));_0x10a722[_0x86a3('0x4e')]=util[_0x86a3('0x18')](_0x86a3('0x4c'),_0x555c61[_0x86a3('0x48')],_0x10a722[_0x86a3('0x4d')],md5(_0x10a722[_0x86a3('0x4d')]));}else{_0x10a722[_0x86a3('0x4e')]='';}headers[_0x86a3('0x4f')]=getAuth(_0x555c61);return getUser(_0x555c61)[_0x86a3('0x13')](function(_0x22fe8e){_0x3e9da9=_0x22fe8e;logger[_0x86a3('0xb')]('The\x20User\x20ID\x20is:',_0x3e9da9['id']);return getEndUser(_0x555c61,_0x10a722['calleridname'],_0x10a722[_0x86a3('0x52')]);})[_0x86a3('0x13')](function(_0x44e1e7){_0x4d39c6=_0x44e1e7;logger[_0x86a3('0xb')](_0x86a3('0x53'),_0x4d39c6['id']);return getTicket(_0x555c61,_0x3e9da9,_0x4d39c6,_0x2d39d5,_0x10a722);})[_0x86a3('0x13')](function(_0x80e3a7){if(_0x80e3a7){logger[_0x86a3('0xb')](_0x86a3('0x54'),_0x80e3a7['id']);}})[_0x86a3('0x60')](function(_0x559fba){logger[_0x86a3('0x5e')]('['+_0x10a722['lastevent'][_0x86a3('0x69')]()+']'+_0x86a3('0x6a'),util[_0x86a3('0x62')](_0x559fba,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe1ce=['stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','request-promise','md5','ioredis','../../../../config/logger','redis','defaults','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','Subjects','getString','Descriptions','then','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','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','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','%s:%s','username','password','authType','token','%s/token:%s','Basic\x20%s','base64','debug','stringify','GET','length','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','serverUrl'];(function(_0x5a30a1,_0x41f004){var _0x159a81=function(_0x47aefa){while(--_0x47aefa){_0x5a30a1['push'](_0x5a30a1['shift']());}};_0x159a81(++_0x41f004);}(_0xe1ce,0x1de));var _0xee1c=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xe1ce[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var rp=require(_0xee1c('0x0'));var md5=require(_0xee1c('0x1'));var util=require('util');var Redis=require(_0xee1c('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xee1c('0x3'))('zendesk');config[_0xee1c('0x4')]=_[_0xee1c('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xee1c('0x6'))(new Redis(config[_0xee1c('0x4')]));function emit(_0x5821ee,_0x4d11ac,_0x1ba7e6){io['to'](_0x5821ee)['emit'](_0x4d11ac,_0x1ba7e6);}var headers={'Content-Type':'application/json','Accept':_0xee1c('0x7')};function getTicket(_0x362a86,_0x212a58,_0x42b894,_0x40a97f,_0x1bad82){logger[_0xee1c('0x8')](_0xee1c('0x9'));return request({'uri':util[_0xee1c('0xa')](_0xee1c('0xb'),_0x362a86['remoteUri']),'method':_0xee1c('0xc'),'body':{'ticket':_[_0xee1c('0xd')]({'requester_id':_0x42b894['id'],'submitter_id':_0x212a58?_0x212a58['id']:undefined,'assignee_id':_0x212a58?_0x212a58['id']:undefined,'tags':getTags(_0x40a97f[_0xee1c('0xe')],_0xee1c('0xf')),'subject':intUtil['getString'](_0x40a97f[_0xee1c('0x10')],_0x1bad82,'\x20'),'description':intUtil[_0xee1c('0x11')](_0x40a97f[_0xee1c('0x12')],_0x1bad82,'\x0a'),'comment':{'public':![],'body':intUtil[_0xee1c('0x11')](_0x40a97f[_0xee1c('0x12')],_0x1bad82,'\x0a')}},getCustomFields(_0x40a97f['Fields'],_0x1bad82))}})[_0xee1c('0x13')](function(_0x3d1c6e){logger[_0xee1c('0x8')]('Ticket\x20created!');return _0x3d1c6e[_0xee1c('0x14')];});}function getUser(_0x497834,_0x2fa809){if(intUtil[_0xee1c('0x15')](_0x2fa809)){logger[_0xee1c('0x8')]('Getting\x20agent\x20with\x20email',_0x2fa809);return request({'uri':util[_0xee1c('0xa')](_0xee1c('0x16'),_0x497834[_0xee1c('0x17')]),'qs':{'query':util[_0xee1c('0xa')](_0xee1c('0x18'),_0x2fa809)}})[_0xee1c('0x13')](function(_0x2c8dad){if(_0x2c8dad['count']){logger[_0xee1c('0x8')](_0xee1c('0x19'));return _[_0xee1c('0x1a')](_0x2c8dad[_0xee1c('0x1b')],{'email':_0x2fa809,'role':_0xee1c('0x1c')});}else{logger[_0xee1c('0x8')](_0xee1c('0x1d'));return request({'uri':util[_0xee1c('0xa')](_0xee1c('0x1e'),_0x497834[_0xee1c('0x17')])})[_0xee1c('0x13')](function(_0x234a18){logger['info'](_0xee1c('0x1f'));return _0x234a18[_0xee1c('0x20')];});}});}else{logger[_0xee1c('0x8')](_0xee1c('0x1d'));return request({'uri':util['format'](_0xee1c('0x1e'),_0x497834['remoteUri'])})['then'](function(_0x52a5d7){logger['info']('Admin\x20account\x20selected.');return _0x52a5d7[_0xee1c('0x20')];});}}function getEndUser(_0x359f9f,_0x15b6b6,_0x24e065){logger[_0xee1c('0x8')](_0xee1c('0x21'),_0x24e065);return request({'uri':util[_0xee1c('0xa')](_0xee1c('0x16'),_0x359f9f[_0xee1c('0x17')]),'qs':{'query':util[_0xee1c('0xa')](_0xee1c('0x22'),_0x24e065)}})[_0xee1c('0x13')](function(_0x36b747){var _0x521970;if(_0x36b747['results']['length']){_0x36b747['results']=_[_0xee1c('0x23')](_0x36b747[_0xee1c('0x1b')],{'suspended':![],'role':'end-user'});if(_0x36b747['results']['length']){_0x521970=_[_0xee1c('0x24')](_0x36b747[_0xee1c('0x1b')]);}}if(_0x521970){logger[_0xee1c('0x8')](_0xee1c('0x25'));return _0x521970;}else{logger[_0xee1c('0x8')](_0xee1c('0x26'));return request({'uri':util[_0xee1c('0xa')](_0xee1c('0x27'),_0x359f9f['remoteUri']),'method':_0xee1c('0xc'),'body':{'user':{'role':_0xee1c('0x28'),'name':util[_0xee1c('0xa')](_0xee1c('0x29'),_0x15b6b6||_0x24e065),'phone':_0x24e065}}})[_0xee1c('0x13')](function(_0x12946e){logger[_0xee1c('0x8')]('Enduser\x20created.');return _0x12946e[_0xee1c('0x20')];});}});}function getAuth(_0x5e2a81){var _0x34eb1f;if(_0x5e2a81['authType']==='password'){_0x34eb1f=util[_0xee1c('0xa')](_0xee1c('0x2a'),_0x5e2a81[_0xee1c('0x2b')],_0x5e2a81[_0xee1c('0x2c')]);}else if(_0x5e2a81[_0xee1c('0x2d')]===_0xee1c('0x2e')){_0x34eb1f=util[_0xee1c('0xa')](_0xee1c('0x2f'),_0x5e2a81[_0xee1c('0x2b')],_0x5e2a81['token']);}return util['format'](_0xee1c('0x30'),new Buffer(_0x34eb1f)['toString'](_0xee1c('0x31')));}function request(_0x56f1c8){logger[_0xee1c('0x32')]('[HTTP]',JSON[_0xee1c('0x33')](_0x56f1c8));return rp(_[_0xee1c('0x5')](_0x56f1c8,{'method':_0xee1c('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x587ae5,_0x18849f){var _0x1deae5=[];if(_0x587ae5&&_0x587ae5[_0xee1c('0x35')]>0x0){_0x1deae5=_['map'](_0x587ae5,_0x18849f);}return _0x1deae5;}function getCustomFields(_0xfc5fb8,_0x429e49){var _0x212d6b=[];var _0x2c5857={'custom_fields':[]};if(_0xfc5fb8['length']>0x0){_['forEach'](_0xfc5fb8,function(_0x240177){if(_[_0xee1c('0x36')](['string',_0xee1c('0x37')],_0x240177[_0xee1c('0x38')])&&_0x240177[_0xee1c('0x39')]&&!_0x240177[_0xee1c('0x3a')]){_0x2c5857[_0x240177[_0xee1c('0x39')][_0xee1c('0x3b')]()]=_0x240177[_0xee1c('0x3c')][_0xee1c('0x3d')]();}else if(_[_0xee1c('0x36')]([_0xee1c('0x3e'),_0xee1c('0x37')],_0x240177[_0xee1c('0x38')])&&_0x240177[_0xee1c('0x3f')]&&_0x240177['customField']){_0x2c5857[_0xee1c('0x40')][_0xee1c('0x41')]({'id':_0x240177['idField'],'value':_0x240177[_0xee1c('0x3c')][_0xee1c('0x3d')]()});}else if(_0x240177['type']===_0xee1c('0x42')&&_0x240177[_0xee1c('0x43')]&&_0x240177[_0xee1c('0x3f')]&&_0x240177['customField']){_0x429e49[_0x240177['variableName']]&&_0x2c5857[_0xee1c('0x40')][_0xee1c('0x41')]({'id':_0x240177[_0xee1c('0x3f')],'value':_0x429e49[_0x240177[_0xee1c('0x43')]]['toString']()});}else if(_0x240177[_0xee1c('0x38')]===_0xee1c('0x44')&&_0x240177['Variable']&&_0x240177['Variable'][_0xee1c('0xf')]&&_0x240177[_0xee1c('0x3f')]&&_0x240177[_0xee1c('0x3a')]){_0x429e49[_0x240177[_0xee1c('0x45')]['name'][_0xee1c('0x3b')]()]&&_0x2c5857[_0xee1c('0x40')][_0xee1c('0x41')]({'id':_0x240177[_0xee1c('0x3f')],'value':_0x429e49[_0x240177['Variable'][_0xee1c('0xf')][_0xee1c('0x3b')]()]['toString']()});}});}return _0x2c5857;}exports[_0xee1c('0x46')]=function(_0x39fd74,_0x3740a2,_0x247dc0,_0x488386,_0xf83434,_0x58be63){var _0x405694,_0x4fffc3;_0x58be63[_0xee1c('0x17')]=intUtil['stripTrailingSlash'](_0x58be63[_0xee1c('0x17')]);_0x58be63[_0xee1c('0x47')]=intUtil[_0xee1c('0x48')](_0x58be63[_0xee1c('0x47')]);if(_0xf83434&&_0xf83434[_0xee1c('0x49')]){logger[_0xee1c('0x8')](_0xee1c('0x4a'),_0xee1c('0x4b'));_0x3740a2[_0xee1c('0x4c')]=util[_0xee1c('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58be63['serverUrl'],_0x3740a2[_0xee1c('0x4d')],md5(_0x3740a2[_0xee1c('0x4d')]));}else{_0x3740a2[_0xee1c('0x4c')]='';}headers[_0xee1c('0x4e')]=getAuth(_0x58be63);return getUser(_0x58be63,_0x488386['email'])[_0xee1c('0x13')](function(_0x438627){_0x405694=_0x438627;logger[_0xee1c('0x8')](_0xee1c('0x4f'),_0x405694['id']);return getEndUser(_0x58be63,_0x3740a2[_0xee1c('0x50')],_0x3740a2[_0xee1c('0x51')]);})['then'](function(_0x466a48){_0x4fffc3=_0x466a48;logger[_0xee1c('0x8')](_0xee1c('0x52'),_0x4fffc3['id']);return getTicket(_0x58be63,_0x405694,_0x4fffc3,_0x247dc0,_0x3740a2);})[_0xee1c('0x13')](function(_0x1bae32){if(_0x1bae32){logger['info'](_0xee1c('0x53'),_0x1bae32['id']);switch(_0x58be63['type']){case'integrationTab':logger[_0xee1c('0x8')](_0xee1c('0x4a'),_0xee1c('0x54'));return request({'uri':util[_0xee1c('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x58be63[_0xee1c('0x17')],_0x405694['id'],_0x1bae32['id']),'method':_0xee1c('0xc')});case _0xee1c('0x55'):logger[_0xee1c('0x8')]('[QUEUE]',_0xee1c('0x56'));emit(util[_0xee1c('0xa')](_0xee1c('0x57'),_0x488386['name']),'trigger:browser:url',{'uri':util[_0xee1c('0xa')](_0xee1c('0x58'),_0x58be63[_0xee1c('0x17')][_0xee1c('0x59')](_0xee1c('0x5a'),''),_0x1bae32['id'])});break;default:logger[_0xee1c('0x5b')]('[QUEUE]',_0xee1c('0x5c'));}}})[_0xee1c('0x5d')](function(_0x20ec60){logger['error'](_0xee1c('0x5e'),util['inspect'](_0x20ec60,{'showHidden':!![],'depth':null}));});};exports[_0xee1c('0x5f')]=function(_0x180424,_0x18250a,_0x23144d,_0x2863cd,_0x2fc589,_0x27637d,_0x1e2960){var _0x49c8ca,_0x4d2f02;_0x27637d['remoteUri']=intUtil[_0xee1c('0x48')](_0x27637d[_0xee1c('0x17')]);_0x27637d[_0xee1c('0x47')]=intUtil[_0xee1c('0x48')](_0x27637d['serverUrl']);if(_0x1e2960&&_0x1e2960[_0xee1c('0x60')]&&_0x1e2960['recordingFormat']!==_0xee1c('0x61')){logger[_0xee1c('0x8')](_0xee1c('0x62'),_0xee1c('0x4b'));_0x18250a[_0xee1c('0x4c')]=util[_0xee1c('0xa')](_0xee1c('0x63'),_0x27637d[_0xee1c('0x47')],_0x18250a[_0xee1c('0x4d')],md5(_0x18250a[_0xee1c('0x4d')]));}headers[_0xee1c('0x4e')]=getAuth(_0x27637d);return getUser(_0x27637d,_0x2863cd[_0xee1c('0x64')])['then'](function(_0xbdfe44){_0x49c8ca=_0xbdfe44;logger[_0xee1c('0x8')](_0xee1c('0x4f'),_0x49c8ca['id']);return getEndUser(_0x27637d,_0x18250a[_0xee1c('0x65')],_0x18250a[_0xee1c('0x66')]);})[_0xee1c('0x13')](function(_0x26e88c){_0x4d2f02=_0x26e88c;logger['info'](_0xee1c('0x52'),_0x4d2f02['id']);return getTicket(_0x27637d,_0x49c8ca,_0x4d2f02,_0x23144d,_0x18250a);})[_0xee1c('0x13')](function(_0x1fbddf){if(_0x1fbddf){logger['info'](_0xee1c('0x53'),_0x1fbddf['id']);switch(_0x27637d['type']){case _0xee1c('0x67'):logger[_0xee1c('0x8')](_0xee1c('0x62'),_0xee1c('0x54'));return request({'uri':util[_0xee1c('0xa')](_0xee1c('0x68'),_0x27637d[_0xee1c('0x17')],_0x49c8ca['id'],_0x1fbddf['id']),'method':_0xee1c('0xc')});case _0xee1c('0x55'):logger[_0xee1c('0x8')](_0xee1c('0x62'),_0xee1c('0x56'));emit(util['format']('user:%s',_0x2863cd[_0xee1c('0xf')]),'trigger:browser:url',{'uri':util['format'](_0xee1c('0x58'),_0x27637d[_0xee1c('0x17')][_0xee1c('0x59')](_0xee1c('0x5a'),''),_0x1fbddf['id'])});break;default:logger['error'](_0xee1c('0x62'),_0xee1c('0x5c'));}}})['catch'](function(_0x53a343){logger[_0xee1c('0x5b')](_0xee1c('0x69'),util[_0xee1c('0x6a')](_0x53a343,{'showHidden':!![],'depth':null}));});};exports[_0xee1c('0x6b')]=function(_0xfd1131,_0x546b5c,_0x4ca5c8,_0x46a3f8,_0x49aa67,_0x104e7d){var _0x28ed82,_0x4075fc;_0x104e7d[_0xee1c('0x17')]=intUtil[_0xee1c('0x48')](_0x104e7d[_0xee1c('0x17')]);_0x104e7d[_0xee1c('0x47')]=intUtil[_0xee1c('0x48')](_0x104e7d['serverUrl']);if(_0x49aa67&&_0x49aa67[_0xee1c('0x49')]){logger[_0xee1c('0x8')]('['+_0x546b5c[_0xee1c('0x6c')][_0xee1c('0x6d')]()+']',_0xee1c('0x4b'));_0x546b5c[_0xee1c('0x4c')]=util[_0xee1c('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x104e7d[_0xee1c('0x47')],_0x546b5c[_0xee1c('0x4d')],md5(_0x546b5c['uniqueid']));}else{_0x546b5c['recordingURL']='';}headers[_0xee1c('0x4e')]=getAuth(_0x104e7d);return getUser(_0x104e7d)[_0xee1c('0x13')](function(_0x15dd1f){_0x28ed82=_0x15dd1f;logger['info'](_0xee1c('0x4f'),_0x28ed82['id']);return getEndUser(_0x104e7d,_0x546b5c[_0xee1c('0x50')],_0x546b5c['calleridnum']);})[_0xee1c('0x13')](function(_0x3607fd){_0x4075fc=_0x3607fd;logger[_0xee1c('0x8')](_0xee1c('0x52'),_0x4075fc['id']);return getTicket(_0x104e7d,_0x28ed82,_0x4075fc,_0x4ca5c8,_0x546b5c);})['then'](function(_0x320536){if(_0x320536){logger[_0xee1c('0x8')](_0xee1c('0x53'),_0x320536['id']);}})[_0xee1c('0x5d')](function(_0x4222d2){logger[_0xee1c('0x5b')]('['+_0x546b5c[_0xee1c('0x6c')][_0xee1c('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xee1c('0x6a')](_0x4222d2,{'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 7a51be1..e5bd9c6 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 _0x4ded=['zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','ActiveUsers','users','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','SUCCESS','details','catch','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','format','agentcalledAt','Call_Type','Call\x20created!','err','stack','queue','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','calleridnum','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','stringify','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x4ded,0x116));var _0xd4de=function(_0x3c65e9,_0x23a45d){_0x3c65e9=_0x3c65e9-0x0;var _0x1a9adb=_0x4ded[_0x3c65e9];return _0x1a9adb;};'use strict';var _=require(_0xd4de('0x0'));var rp=require(_0xd4de('0x1'));var md5=require(_0xd4de('0x2'));var util=require(_0xd4de('0x3'));var intUtil=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var Redis=require(_0xd4de('0x6'));var BPromise=require(_0xd4de('0x7'));var config=require(_0xd4de('0x8'));var logger=require(_0xd4de('0x9'))(_0xd4de('0xa'));config[_0xd4de('0xb')]=_['defaults'](config[_0xd4de('0xb')],{'host':_0xd4de('0xc'),'port':0x18eb});var io=require(_0xd4de('0xd'))(new Redis(config[_0xd4de('0xb')]));function emit(_0x4453c2,_0x1e8c35,_0x5c612f){io['to'](_0x4453c2)[_0xd4de('0xe')](_0x1e8c35,_0x5c612f);}function request(_0x5ebcf3){logger['debug']('[HTTP]',JSON[_0xd4de('0xf')](_0x5ebcf3));return rp(_0x5ebcf3);}function getCustomFields(_0x459a46,_0x4e5b10){var _0x5b6dc4={};if(_0x459a46['length']>0x0){_[_0xd4de('0x10')](_0x459a46,function(_0x49d931){if(_[_0xd4de('0x11')]([_0xd4de('0x12'),_0xd4de('0x13')],_0x49d931[_0xd4de('0x14')])&&_0x49d931[_0xd4de('0x15')]){_0x5b6dc4[_0x49d931[_0xd4de('0x15')]]=_0x49d931[_0xd4de('0x16')][_0xd4de('0x17')]();}else if(_0x49d931[_0xd4de('0x14')]===_0xd4de('0x18')&&_0x49d931[_0xd4de('0x19')]&&_0x49d931[_0xd4de('0x15')]&&_0x4e5b10[_0x49d931[_0xd4de('0x19')]]){_0x5b6dc4[_0x49d931[_0xd4de('0x15')]]=_0x4e5b10[_0x49d931[_0xd4de('0x19')]][_0xd4de('0x17')]();}else if(_0x49d931[_0xd4de('0x14')]==='customVariable'&&_0x49d931['Variable']&&_0x49d931[_0xd4de('0x1a')][_0xd4de('0x1b')]&&_0x49d931[_0xd4de('0x15')]&&_0x4e5b10[_0x49d931[_0xd4de('0x1a')]['name']['toLowerCase']()]){_0x5b6dc4[_0x49d931[_0xd4de('0x15')]]=_0x4e5b10[_0x49d931['Variable'][_0xd4de('0x1b')][_0xd4de('0x1c')]()]['toString']();}});}return _0x5b6dc4;}function getName(_0xc15081){if(_0xc15081['indexOf']('\x20')>0x0){var _0x2287d8=_0xc15081[_0xd4de('0x1d')](/ (.+)/);if(_0x2287d8[0x1]){return _0x2287d8;}}return[_0xc15081,_0xc15081];}var accountsTokens={};function getAccessToken(_0x2bad14){return new Promise(function(_0x8e8712,_0x5368f5){if(!_[_0xd4de('0x1e')](accountsTokens[_0x2bad14['id']])&&!_[_0xd4de('0x1e')](accountsTokens[_0x2bad14['id']][_0xd4de('0x1f')])){if(moment()[_0xd4de('0x20')](accountsTokens[_0x2bad14['id']][_0xd4de('0x21')])){_0x8e8712(accountsTokens[_0x2bad14['id']][_0xd4de('0x1f')]);}}var _0x1561fd;switch(_0x2bad14[_0xd4de('0x22')]){case'US':_0x1561fd=_0xd4de('0x23');break;case'AU':_0x1561fd=_0xd4de('0x24');break;case'EU':_0x1561fd='https://accounts.zoho.eu';break;case'IN':_0x1561fd=_0xd4de('0x25');break;case'CN':_0x1561fd=_0xd4de('0x26');break;default:_0x1561fd=_0xd4de('0x27');break;}var _0x22970c={'method':_0xd4de('0x28'),'uri':_0x1561fd+_0xd4de('0x29'),'qs':{'refresh_token':_0x2bad14[_0xd4de('0x2a')],'client_id':_0x2bad14[_0xd4de('0x2b')],'client_secret':_0x2bad14[_0xd4de('0x2c')],'grant_type':_0xd4de('0x2d')},'json':!![]};return rp(_0x22970c)[_0xd4de('0x2e')](function(_0xb2d8a1){accountsTokens[_0x2bad14['id']]={'access_token':_0xb2d8a1['access_token'],'expires_in':moment()[_0xd4de('0x2f')](_0xb2d8a1[_0xd4de('0x21')],'seconds')};_0x8e8712(_0xb2d8a1[_0xd4de('0x1f')]);})['catch'](function(_0x44b710){logger[_0xd4de('0x30')](_0xd4de('0x31'),_0x44b710['stack']);_0x5368f5(_0x44b710);});});}function getUser(_0xd4de93,_0x36f2f1,_0x17f0a,_0x50cb73){logger[_0xd4de('0x32')](_0xd4de('0x33'));return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x36f2f1),'qs':{'type':_0xd4de('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd4de93},'json':!![]})[_0xd4de('0x2e')](function(_0x1429ba){if(_0x1429ba[_0xd4de('0x35')]){var _0x2e08eb=-0x1;if(_['isArrayLikeObject'](_0x1429ba[_0xd4de('0x35')])){if(!_[_0xd4de('0x1e')](_0x50cb73)){_0x2e08eb=_['findIndex'](_0x1429ba[_0xd4de('0x35')],function(_0x1d86fc){return _0x1d86fc['email']===_0x50cb73;});}if(_0x2e08eb>=0x0){logger['info'](_0xd4de('0x36'));}else{logger[_0xd4de('0x32')](_0xd4de('0x37'));_0x2e08eb=_[_0xd4de('0x38')](_0x1429ba['users'],function(_0x2bdc98){return _0x2bdc98[_0xd4de('0x39')]['name']===_0xd4de('0x3a');});}return _0x1429ba[_0xd4de('0x35')][_0x2e08eb];}else{if(_0x1429ba[_0xd4de('0x3b')][_0xd4de('0x39')][_0xd4de('0x1b')]===_0xd4de('0x3a')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1429ba[_0xd4de('0x3b')];return user;}else{logger[_0xd4de('0x30')](_0xd4de('0x3c'),JSON['stringify'](_0x1429ba));throw new Error(_0xd4de('0x3d')+JSON[_0xd4de('0xf')](_0x1429ba));}}}else{logger['error'](_0xd4de('0x3c'),JSON[_0xd4de('0xf')](_0x1429ba));throw new Error(_0xd4de('0x3d')+JSON[_0xd4de('0xf')](_0x1429ba));}})['catch'](function(_0x53d7dc){console[_0xd4de('0x30')](_0x53d7dc);});}function getZohoUser(_0x541777,_0x3e5e34){return new BPromise(function(_0x4de12c,_0x97c0ab){request(_0x541777)[_0xd4de('0x2e')](function(_0x21cd77){var _0x1e1937=null;if(_0x21cd77){_0x1e1937=_0x21cd77['data'][0x0];_0x1e1937[_0xd4de('0x3e')]=_0x3e5e34;}_0x4de12c(_0x1e1937);})['catch'](function(_0xbee33){_0x97c0ab(_0xbee33);});});}function createEndUser(_0x280f76,_0x7f17b9,_0x4517a6,_0x349c5f,_0x13c256,_0x3e8ae0){var _0x4517a6=getName(_0x4517a6);return request({'method':_0xd4de('0x28'),'uri':_0xd4de('0x3f')+_0x7f17b9+_0xd4de('0x40')+_[_0xd4de('0x41')](_0x3e8ae0[_0xd4de('0x42')])+'s','body':{'data':[{'Last_Name':_0x4517a6[0x1],'First_Name':_0x4517a6[0x0],'Phone':_0x349c5f,'Owner':{'name':!_['isNil'](_0x13c256[_0xd4de('0x43')][_0xd4de('0x1b')])?_0x13c256[_0xd4de('0x43')]['name']:!_[_0xd4de('0x1e')](_0x13c256[_0xd4de('0x44')])?_0x13c256[_0xd4de('0x44')]+'\x20'+_0x13c256['last_name']:_0x13c256[_0xd4de('0x45')],'id':_0x13c256['id']}}]},'headers':{'Authorization':_0xd4de('0x46')+_0x280f76},'json':!![]})[_0xd4de('0x2e')](function(_0x3f1e22){if(_0x3f1e22&&_0x3f1e22[_0xd4de('0x47')][0x0][_0xd4de('0x48')]===_0xd4de('0x49')){var _0x5ecbbd=_0x3f1e22[_0xd4de('0x47')][0x0][_0xd4de('0x4a')];_0x5ecbbd[_0xd4de('0x3e')]=_['startCase'](_0x3e8ae0[_0xd4de('0x42')])+'s';return _0x5ecbbd;}logger[_0xd4de('0x30')](_0xd4de('0x3c'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xd4de('0xf')](data));})[_0xd4de('0x4b')](function(_0x5a2b3e){console[_0xd4de('0x4c')](_0xd4de('0x4d'),_0x5a2b3e);});}function getEndUser(_0x3a3c63,_0x13b317,_0x564a96,_0x27afac,_0x72d025,_0x579700,_0x3745ef){var _0x196d0b={'method':_0xd4de('0x4e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3a3c63},'json':!![]};switch(_0x3745ef[_0xd4de('0x4f')]){case _0xd4de('0x50'):_0x196d0b[_0xd4de('0x51')]=_0xd4de('0x3f')+_0x13b317+_0xd4de('0x52')+_0x72d025+'))';return getZohoUser(_0x196d0b,_0xd4de('0x53'))[_0xd4de('0x2e')](function(_0x425a7e){if(_0x425a7e)return _0x425a7e;_0x196d0b[_0xd4de('0x51')]=_0xd4de('0x3f')+_0x13b317+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x72d025+'))';return getZohoUser(_0x196d0b,_0xd4de('0x54'))[_0xd4de('0x2e')](function(_0x178daf){if(_0x178daf)return _0x178daf;if(_0x3745ef['moduleCreate']!=_0xd4de('0x55')){return createEndUser(_0x3a3c63,_0x13b317,_0x27afac,_0x72d025,_0x579700,_0x3745ef);}else{return{};}});});break;case _0xd4de('0x56'):_0x196d0b[_0xd4de('0x51')]=_0xd4de('0x3f')+_0x13b317+_0xd4de('0x52')+_0x72d025+'))';return getZohoUser(_0x196d0b,_0xd4de('0x53'))[_0xd4de('0x2e')](function(_0x29cb16){if(_0x29cb16)return _0x29cb16;if(_0x3745ef[_0xd4de('0x42')]!=_0xd4de('0x55')){return createEndUser(_0x3a3c63,_0x13b317,_0x27afac,_0x72d025,_0x579700,_0x3745ef);}else{return{};}});break;case'lead':_0x196d0b[_0xd4de('0x51')]=_0xd4de('0x3f')+_0x13b317+_0xd4de('0x57')+_0x72d025+'))';return getZohoUser(_0x196d0b,_0xd4de('0x54'))[_0xd4de('0x2e')](function(_0x584548){if(_0x584548)return _0x584548;if(_0x3745ef['moduleCreate']!=_0xd4de('0x55')){return createEndUser(_0x3a3c63,_0x13b317,_0x27afac,_0x72d025,_0x579700,_0x3745ef);}else{return{};}});break;}}function getCall(_0x2deedb,_0x4f9b6b,_0x48cb7d,_0x2d8589,_0x368081,_0x377376,_0x199440,_0x34d772){logger[_0xd4de('0x32')](_0xd4de('0x58'));var _0x4801de={};_0x4801de[_0xd4de('0x59')]={'name':!_[_0xd4de('0x1e')](_0x2d8589[_0xd4de('0x43')][_0xd4de('0x1b')])&&!_['isNil'](_0x2d8589[_0xd4de('0x39')][_0xd4de('0x1b')])&&_0x2d8589[_0xd4de('0x39')][_0xd4de('0x1b')]===_0xd4de('0x5a')?_0x2d8589[_0xd4de('0x43')]['name']:!_[_0xd4de('0x1e')](_0x2d8589['first_name'])?_0x2d8589['first_name']+'\x20'+_0x2d8589[_0xd4de('0x45')]:_0x2d8589[_0xd4de('0x45')],'id':_0x2d8589['id']};_0x4801de[_0xd4de('0x5b')]=intUtil[_0xd4de('0x5c')](_0x377376['Subjects'],_0x199440,'\x20');_0x4801de[_0xd4de('0x5d')]=intUtil[_0xd4de('0x5c')](_0x377376[_0xd4de('0x5e')],_0x199440,'\x0a');if(_0x368081[_0xd4de('0x3e')]===_0xd4de('0x53')){_0x4801de['Who_Id']={'name':!_['isNil'](_0x368081['Full_Name'])?_0x368081[_0xd4de('0x5f')]:!_[_0xd4de('0x1e')](_0x368081[_0xd4de('0x60')])?_0x368081[_0xd4de('0x60')]+'\x20'+_0x368081['Last_Name']:_0x368081[_0xd4de('0x61')],'id':_0x368081['id']};}if(_0x368081[_0xd4de('0x3e')]===_0xd4de('0x54')){_0x4801de[_0xd4de('0x62')]={'name':!_['isNil'](_0x368081[_0xd4de('0x5f')])?_0x368081[_0xd4de('0x5f')]:!_[_0xd4de('0x1e')](_0x368081[_0xd4de('0x60')])?_0x368081['First_Name']+'\x20'+_0x368081['Last_Name']:_0x368081['Last_Name'],'id':_0x368081['id']};_0x4801de[_0xd4de('0x63')]=_[_0xd4de('0x41')](_0x368081[_0xd4de('0x3e')]);}if(_0x199440['talktime']){_0x4801de[_0xd4de('0x64')]=moment[_0xd4de('0x65')](parseInt(_0x199440[_0xd4de('0x66')])*0x3e8)['format'](_0xd4de('0x67'));}else if(_0x199440['answertime']&&_0x199440[_0xd4de('0x68')]){_0x4801de[_0xd4de('0x64')]=moment[_0xd4de('0x65')](moment(_0x199440[_0xd4de('0x68')],_0xd4de('0x69'))[_0xd4de('0x6a')](moment(_0x199440[_0xd4de('0x6b')],_0xd4de('0x69'))))['format'](_0xd4de('0x67'));}switch(_0x199440['lastevent']){case _0xd4de('0x6c'):_0x4801de[_0xd4de('0x6d')]='Called';break;case _0xd4de('0x6e'):case _0xd4de('0x6f'):_0x4801de[_0xd4de('0x6d')]=_0xd4de('0x70');break;case _0xd4de('0x71'):_0x4801de[_0xd4de('0x6d')]=_0xd4de('0x72');break;case _0xd4de('0x73'):_0x4801de[_0xd4de('0x6d')]=_0xd4de('0x74');break;case _0xd4de('0x75'):_0x4801de[_0xd4de('0x6d')]=_0xd4de('0x76');default:}_0x4801de['Call_Start_Time']=(_0x34d772===_0xd4de('0x77')?moment(_0x199440[_0xd4de('0x6b')])[_0xd4de('0x78')](_0xd4de('0x69')):moment(_0x199440[_0xd4de('0x79')])[_0xd4de('0x78')](_0xd4de('0x69')))||moment()[_0xd4de('0x78')]('YYYY-MM-DDTHH:mm:ss');_0x4801de[_0xd4de('0x7a')]=_0x34d772||'Inbound';_0x4801de=_['merge'](_0x4801de,getCustomFields(_0x377376['Fields'],_0x199440));return request({'method':_0xd4de('0x28'),'uri':_0xd4de('0x3f')+_0x4f9b6b+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2deedb},'body':{'data':[_0x4801de]},'json':!![]})['then'](function(_0x576b5f){if(_0x576b5f&&_0x576b5f[_0xd4de('0x47')][0x0]['code']===_0xd4de('0x49')){logger['info'](_0xd4de('0x7b'));return{'id':_0x576b5f[_0xd4de('0x47')][0x0]['details']['id']};}})['catch'](function(_0x561e52){logger['info'](_0xd4de('0x7c'),_0x561e52[_0xd4de('0x7d')]);console[_0xd4de('0x4c')](_0xd4de('0x7c'),_0x561e52);});}exports[_0xd4de('0x7e')]=function(_0x282d4f,_0x574c46,_0x5c651b,_0x53cbd9,_0xca9ce0,_0x2bb19d){var _0x4c2343,_0x28ecbf,_0x496415;_0x2bb19d[_0xd4de('0x7f')]=intUtil['stripTrailingSlash'](_0x2bb19d[_0xd4de('0x7f')]);_0x2bb19d[_0xd4de('0x80')]=intUtil['stripTrailingSlash'](_0x2bb19d[_0xd4de('0x80')]);if(_0xca9ce0&&_0xca9ce0['monitor_format']){logger[_0xd4de('0x32')](_0xd4de('0x81'),_0xd4de('0x82'));_0x574c46[_0xd4de('0x83')]=_0x2bb19d['serverUrl']+_0xd4de('0x84')+_0x574c46[_0xd4de('0x85')]+_0xd4de('0x86')+md5(_0x574c46[_0xd4de('0x85')]);}else{_0x574c46[_0xd4de('0x83')]='';}var _0x21c8d2=_0x2bb19d[_0xd4de('0x7f')]===_0xd4de('0x87')?'eu':_0xd4de('0x88');return getAccessToken(_0x2bb19d)[_0xd4de('0x2e')](function(_0xc908e9){_0x496415=_0xc908e9;return getUser(_0x496415,_0x21c8d2,_0x2bb19d,_0x53cbd9[_0xd4de('0x89')]);})[_0xd4de('0x2e')](function(_0x573039){_0x4c2343=_0x573039;logger[_0xd4de('0x32')]('The\x20User\x20ID\x20is:',_0x4c2343['id']);return getEndUser(_0x496415,_0x21c8d2,_0x2bb19d,_0x574c46['calleridname'],_0x574c46[_0xd4de('0x8a')],_0x4c2343,_0x5c651b);})[_0xd4de('0x2e')](function(_0x5f197d){_0x28ecbf=_0x5f197d;return getCall(_0x496415,_0x21c8d2,_0x2bb19d,_0x4c2343,_0x28ecbf,_0x5c651b,_0x574c46,_0xd4de('0x8b'));})[_0xd4de('0x2e')](function(_0x3457bb){if(_0x3457bb){logger[_0xd4de('0x32')]('The\x20Call\x20ID\x20is:',_0x3457bb['id']);logger[_0xd4de('0x32')](_0xd4de('0x81'),_0xd4de('0x8c'));emit(util[_0xd4de('0x78')](_0xd4de('0x8d'),_0x53cbd9['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x2bb19d['host']+_0xd4de('0x8e')+_0x3457bb['id']});}})['catch'](function(_0x302c7d){logger['error'](_0xd4de('0x81'),JSON[_0xd4de('0xf')](_0x302c7d));});};exports[_0xd4de('0x77')]=function(_0x30dca3,_0x1d6dab,_0x15136e,_0x15f056,_0x31b518,_0x5a270a,_0x2c0f32){var _0x1fec27,_0x2025ba,_0x178ce8;_0x5a270a['host']=intUtil[_0xd4de('0x8f')](_0x5a270a[_0xd4de('0x7f')]);_0x5a270a['serverUrl']=intUtil[_0xd4de('0x8f')](_0x5a270a[_0xd4de('0x80')]);if(_0x2c0f32&&_0x2c0f32[_0xd4de('0x90')]&&_0x2c0f32[_0xd4de('0x90')]!==_0xd4de('0x91')){logger[_0xd4de('0x32')](_0xd4de('0x92'),_0xd4de('0x82'));_0x1d6dab[_0xd4de('0x83')]=_0x5a270a[_0xd4de('0x80')]+_0xd4de('0x84')+_0x1d6dab['uniqueid']+_0xd4de('0x86')+md5(_0x1d6dab['uniqueid']);}var _0x117308=_0x5a270a[_0xd4de('0x7f')]===_0xd4de('0x87')?'eu':'com';return getAccessToken(_0x5a270a)[_0xd4de('0x2e')](function(_0x1cab80){_0x178ce8=_0x1cab80;return getUser(_0x178ce8,_0x117308,_0x5a270a,_0x15f056['email']);})[_0xd4de('0x2e')](function(_0x43d02f){_0x1fec27=_0x43d02f;logger[_0xd4de('0x32')](_0xd4de('0x93'),_0x1fec27['id']);return getEndUser(_0x178ce8,_0x117308,_0x5a270a,_0x1d6dab[_0xd4de('0x94')],_0x1d6dab[_0xd4de('0x95')],_0x1fec27,_0x15136e);})['then'](function(_0x19e593){_0x2025ba=_0x19e593;return getCall(_0x178ce8,_0x117308,_0x5a270a,_0x1fec27,_0x2025ba,_0x15136e,_0x1d6dab,_0xd4de('0x96'));})['then'](function(_0x2f4183){if(_0x2f4183){logger[_0xd4de('0x32')](_0xd4de('0x97'),_0x2f4183['id']);logger[_0xd4de('0x32')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd4de('0x78')](_0xd4de('0x8d'),_0x15f056[_0xd4de('0x1b')]),_0xd4de('0x98'),{'uri':'https://crm.'+_0x5a270a[_0xd4de('0x7f')]+_0xd4de('0x8e')+_0x2f4183['id']});}})[_0xd4de('0x4b')](function(_0x21e62d){logger['error']('[OUTBOUND]',JSON[_0xd4de('0xf')](_0x21e62d));});};exports['unmanaged']=function(_0x1ac87e,_0x3f19d9,_0x2cb193,_0x449bba,_0x5afe8e,_0x59620f){var _0x6984b4,_0x1a1abd,_0x5d860d;_0x59620f['host']=intUtil[_0xd4de('0x8f')](_0x59620f[_0xd4de('0x7f')]);_0x59620f[_0xd4de('0x80')]=intUtil['stripTrailingSlash'](_0x59620f[_0xd4de('0x80')]);if(_0x5afe8e&&_0x5afe8e[_0xd4de('0x99')]){logger['info']('['+_0x3f19d9[_0xd4de('0x9a')]['toUpperCase']()+']',_0xd4de('0x82'));_0x3f19d9[_0xd4de('0x83')]=_0x59620f['serverUrl']+_0xd4de('0x84')+_0x3f19d9[_0xd4de('0x85')]+_0xd4de('0x86')+md5(_0x3f19d9[_0xd4de('0x85')]);}else{_0x3f19d9[_0xd4de('0x83')]='';}var _0x20af58=_0x59620f['host']===_0xd4de('0x87')?'eu':_0xd4de('0x88');return getAccessToken(_0x59620f)[_0xd4de('0x2e')](function(_0xb0ab3a){_0x5d860d=_0xb0ab3a;return getUser(_0x5d860d,_0x20af58,_0x59620f);})[_0xd4de('0x2e')](function(_0x291e8a){_0x6984b4=_0x291e8a;logger['info'](_0xd4de('0x93'),_0x6984b4['id']);return getEndUser(_0x5d860d,_0x20af58,_0x59620f,_0x3f19d9['calleridname'],_0x3f19d9[_0xd4de('0x8a')],_0x6984b4,_0x2cb193);})[_0xd4de('0x2e')](function(_0x2171fb){_0x1a1abd=_0x2171fb;return getCall(_0x5d860d,_0x20af58,_0x59620f,_0x6984b4,_0x1a1abd,_0x2cb193,_0x3f19d9,_0xd4de('0x8b'));})[_0xd4de('0x2e')](function(_0x4cea38){if(_0x4cea38){logger[_0xd4de('0x32')](_0xd4de('0x97'),_0x4cea38['id']);}})[_0xd4de('0x4b')](function(_0x477cc7){logger[_0xd4de('0x30')]('['+_0x3f19d9[_0xd4de('0x9a')][_0xd4de('0x9b')]()+']',JSON[_0xd4de('0xf')](_0x477cc7));});}; \ No newline at end of file +var _0x7a2c=['nothing','lead','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','What_Id','Last_Name','$se_module','utc','endtime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Fields','details','err','queue','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','Inbound','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','serverUrl','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','unmanaged','toUpperCase','calleridnum','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','debug','[HTTP]','length','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','catch','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','code','SUCCESS','startCase','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact'];(function(_0x38d832,_0xf2104d){var _0x2e166e=function(_0x26e7d0){while(--_0x26e7d0){_0x38d832['push'](_0x38d832['shift']());}};_0x2e166e(++_0xf2104d);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x235446,_0x9cb552){_0x235446=_0x235446-0x0;var _0x2cc0a3=_0x7a2c[_0x235446];return _0x2cc0a3;};'use strict';var _=require(_0xc7a2('0x0'));var rp=require('request-promise');var md5=require(_0xc7a2('0x1'));var util=require(_0xc7a2('0x2'));var intUtil=require(_0xc7a2('0x3'));var moment=require(_0xc7a2('0x4'));var Redis=require(_0xc7a2('0x5'));var BPromise=require(_0xc7a2('0x6'));var config=require(_0xc7a2('0x7'));var logger=require(_0xc7a2('0x8'))('zoho');config[_0xc7a2('0x9')]=_[_0xc7a2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7a2('0x9')]));function emit(_0x3de428,_0x3f0573,_0x426fea){io['to'](_0x3de428)['emit'](_0x3f0573,_0x426fea);}function request(_0x38518b){logger[_0xc7a2('0xb')](_0xc7a2('0xc'),JSON['stringify'](_0x38518b));return rp(_0x38518b);}function getCustomFields(_0x2c3f86,_0x4a44c7){var _0x3e216a={};if(_0x2c3f86[_0xc7a2('0xd')]>0x0){_[_0xc7a2('0xe')](_0x2c3f86,function(_0x540267){if(_[_0xc7a2('0xf')]([_0xc7a2('0x10'),_0xc7a2('0x11')],_0x540267['type'])&&_0x540267[_0xc7a2('0x12')]){_0x3e216a[_0x540267[_0xc7a2('0x12')]]=_0x540267[_0xc7a2('0x13')][_0xc7a2('0x14')]();}else if(_0x540267[_0xc7a2('0x15')]===_0xc7a2('0x16')&&_0x540267[_0xc7a2('0x17')]&&_0x540267[_0xc7a2('0x12')]&&_0x4a44c7[_0x540267[_0xc7a2('0x17')]]){_0x3e216a[_0x540267[_0xc7a2('0x12')]]=_0x4a44c7[_0x540267[_0xc7a2('0x17')]][_0xc7a2('0x14')]();}else if(_0x540267[_0xc7a2('0x15')]===_0xc7a2('0x18')&&_0x540267[_0xc7a2('0x19')]&&_0x540267['Variable'][_0xc7a2('0x1a')]&&_0x540267['idField']&&_0x4a44c7[_0x540267[_0xc7a2('0x19')][_0xc7a2('0x1a')][_0xc7a2('0x1b')]()]){_0x3e216a[_0x540267[_0xc7a2('0x12')]]=_0x4a44c7[_0x540267['Variable']['name'][_0xc7a2('0x1b')]()][_0xc7a2('0x14')]();}});}return _0x3e216a;}function getName(_0x51cbb3){if(_0x51cbb3['indexOf']('\x20')>0x0){var _0x49be25=_0x51cbb3[_0xc7a2('0x1c')](/ (.+)/);if(_0x49be25[0x1]){return _0x49be25;}}return[_0x51cbb3,_0x51cbb3];}var accountsTokens={};function getAccessToken(_0x5a2f40){return new Promise(function(_0x155c42,_0x260be1){if(!_['isNil'](accountsTokens[_0x5a2f40['id']])&&!_[_0xc7a2('0x1d')](accountsTokens[_0x5a2f40['id']][_0xc7a2('0x1e')])){if(moment()[_0xc7a2('0x1f')](accountsTokens[_0x5a2f40['id']][_0xc7a2('0x20')])){_0x155c42(accountsTokens[_0x5a2f40['id']][_0xc7a2('0x1e')]);}}var _0x41d5d5;switch(_0x5a2f40[_0xc7a2('0x21')]){case'US':_0x41d5d5='https://accounts.zoho.com';break;case'AU':_0x41d5d5='https://accounts.zoho.com.au';break;case'EU':_0x41d5d5=_0xc7a2('0x22');break;case'IN':_0x41d5d5=_0xc7a2('0x23');break;case'CN':_0x41d5d5='https://accounts.zoho.com.cn';break;default:_0x41d5d5=_0xc7a2('0x22');break;}var _0x3cad61={'method':_0xc7a2('0x24'),'uri':_0x41d5d5+_0xc7a2('0x25'),'qs':{'refresh_token':_0x5a2f40[_0xc7a2('0x26')],'client_id':_0x5a2f40[_0xc7a2('0x27')],'client_secret':_0x5a2f40[_0xc7a2('0x28')],'grant_type':_0xc7a2('0x29')},'json':!![]};return rp(_0x3cad61)['then'](function(_0x35a6e0){accountsTokens[_0x5a2f40['id']]={'access_token':_0x35a6e0['access_token'],'expires_in':moment()[_0xc7a2('0x2a')](_0x35a6e0['expires_in'],_0xc7a2('0x2b'))};_0x155c42(_0x35a6e0[_0xc7a2('0x1e')]);})[_0xc7a2('0x2c')](function(_0x3959c9){logger['error']('Failing\x20creating\x20the\x20access_token',_0x3959c9[_0xc7a2('0x2d')]);_0x260be1(_0x3959c9);});});}function getUser(_0x2f3097,_0x272c6b,_0x305efb,_0x3be88c){logger[_0xc7a2('0x2e')](_0xc7a2('0x2f'));return request({'method':'GET','uri':util[_0xc7a2('0x30')](_0xc7a2('0x31'),_0x272c6b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xc7a2('0x32')+_0x2f3097},'json':!![]})[_0xc7a2('0x33')](function(_0x450c75){if(_0x450c75['users']){var _0x2820a9=-0x1;if(_['isArrayLikeObject'](_0x450c75[_0xc7a2('0x34')])){if(!_['isNil'](_0x3be88c)){_0x2820a9=_['findIndex'](_0x450c75[_0xc7a2('0x34')],function(_0x4fbbb5){return _0x4fbbb5['email']===_0x3be88c;});}if(_0x2820a9>=0x0){logger[_0xc7a2('0x2e')]('Agent\x20found!');}else{logger[_0xc7a2('0x2e')]('Using\x20the\x20admin\x20account!');_0x2820a9=_[_0xc7a2('0x35')](_0x450c75[_0xc7a2('0x34')],function(_0x13ee53){return _0x13ee53[_0xc7a2('0x36')][_0xc7a2('0x1a')]===_0xc7a2('0x37');});}return _0x450c75[_0xc7a2('0x34')][_0x2820a9];}else{if(_0x450c75[_0xc7a2('0x38')][_0xc7a2('0x36')][_0xc7a2('0x1a')]==='Administrator'){logger[_0xc7a2('0x2e')](_0xc7a2('0x39'));user=_0x450c75['user'];return user;}else{logger[_0xc7a2('0x3a')](_0xc7a2('0x3b'),JSON[_0xc7a2('0x3c')](_0x450c75));throw new Error(_0xc7a2('0x3d')+JSON[_0xc7a2('0x3c')](_0x450c75));}}}else{logger[_0xc7a2('0x3a')](_0xc7a2('0x3b'),JSON['stringify'](_0x450c75));throw new Error(_0xc7a2('0x3d')+JSON[_0xc7a2('0x3c')](_0x450c75));}})[_0xc7a2('0x2c')](function(_0x49ad1f){console[_0xc7a2('0x3a')](_0x49ad1f);});}function getZohoUser(_0x2b899d,_0x5de82c){return new BPromise(function(_0x366706,_0x13e20d){request(_0x2b899d)[_0xc7a2('0x33')](function(_0x836926){var _0x2cdef8=null;if(_0x836926){_0x2cdef8=_0x836926[_0xc7a2('0x3e')][0x0];_0x2cdef8[_0xc7a2('0x3f')]=_0x5de82c;}_0x366706(_0x2cdef8);})[_0xc7a2('0x2c')](function(_0x573e26){_0x13e20d(_0x573e26);});});}function createEndUser(_0xd418ee,_0x5114e3,_0x2f0e42,_0x156b6c,_0x2cd014,_0x27473d){var _0x2f0e42=getName(_0x2f0e42);return request({'method':_0xc7a2('0x24'),'uri':_0xc7a2('0x40')+_0x5114e3+_0xc7a2('0x41')+_['startCase'](_0x27473d[_0xc7a2('0x42')])+'s','body':{'data':[{'Last_Name':_0x2f0e42[0x1],'First_Name':_0x2f0e42[0x0],'Phone':_0x156b6c,'Owner':{'name':!_[_0xc7a2('0x1d')](_0x2cd014[_0xc7a2('0x43')][_0xc7a2('0x1a')])?_0x2cd014[_0xc7a2('0x43')][_0xc7a2('0x1a')]:!_['isNil'](_0x2cd014['first_name'])?_0x2cd014['first_name']+'\x20'+_0x2cd014[_0xc7a2('0x44')]:_0x2cd014[_0xc7a2('0x44')],'id':_0x2cd014['id']}}]},'headers':{'Authorization':_0xc7a2('0x32')+_0xd418ee},'json':!![]})[_0xc7a2('0x33')](function(_0x447049){if(_0x447049&&_0x447049[_0xc7a2('0x3e')][0x0][_0xc7a2('0x45')]===_0xc7a2('0x46')){var _0x246482=_0x447049['data'][0x0]['details'];_0x246482['enduserType']=_[_0xc7a2('0x47')](_0x27473d[_0xc7a2('0x42')])+'s';return _0x246482;}logger['error'](_0xc7a2('0x3b'),JSON[_0xc7a2('0x3c')](data));throw new Error(_0xc7a2('0x48')+JSON['stringify'](data));})[_0xc7a2('0x2c')](function(_0x4d83c8){console[_0xc7a2('0x49')](_0xc7a2('0x4a'),_0x4d83c8);});}function getEndUser(_0x58109c,_0x528dc7,_0x932670,_0x1311a5,_0x4f4b62,_0x8b8cc2,_0x404e48){var _0x1bc7d4={'method':_0xc7a2('0x4b'),'uri':'','headers':{'Authorization':_0xc7a2('0x32')+_0x58109c},'json':!![]};switch(_0x404e48[_0xc7a2('0x4c')]){case'contact_lead':_0x1bc7d4[_0xc7a2('0x4d')]=_0xc7a2('0x40')+_0x528dc7+_0xc7a2('0x4e')+_0x4f4b62+'))';return getZohoUser(_0x1bc7d4,_0xc7a2('0x4f'))['then'](function(_0x2e7d1c){if(_0x2e7d1c)return _0x2e7d1c;_0x1bc7d4[_0xc7a2('0x4d')]=_0xc7a2('0x40')+_0x528dc7+_0xc7a2('0x50')+_0x4f4b62+'))';return getZohoUser(_0x1bc7d4,_0xc7a2('0x51'))[_0xc7a2('0x33')](function(_0x7378ed){if(_0x7378ed)return _0x7378ed;if(_0x404e48[_0xc7a2('0x42')]!='nothing'){return createEndUser(_0x58109c,_0x528dc7,_0x1311a5,_0x4f4b62,_0x8b8cc2,_0x404e48);}else{return{};}});});break;case _0xc7a2('0x52'):_0x1bc7d4[_0xc7a2('0x4d')]=_0xc7a2('0x40')+_0x528dc7+_0xc7a2('0x4e')+_0x4f4b62+'))';return getZohoUser(_0x1bc7d4,'Contacts')[_0xc7a2('0x33')](function(_0x1290c4){if(_0x1290c4)return _0x1290c4;if(_0x404e48['moduleCreate']!=_0xc7a2('0x53')){return createEndUser(_0x58109c,_0x528dc7,_0x1311a5,_0x4f4b62,_0x8b8cc2,_0x404e48);}else{return{};}});break;case _0xc7a2('0x54'):_0x1bc7d4[_0xc7a2('0x4d')]=_0xc7a2('0x40')+_0x528dc7+_0xc7a2('0x50')+_0x4f4b62+'))';return getZohoUser(_0x1bc7d4,'Leads')[_0xc7a2('0x33')](function(_0x44716e){if(_0x44716e)return _0x44716e;if(_0x404e48[_0xc7a2('0x42')]!='nothing'){return createEndUser(_0x58109c,_0x528dc7,_0x1311a5,_0x4f4b62,_0x8b8cc2,_0x404e48);}else{return{};}});break;}}function getCall(_0x52e416,_0x223755,_0x584e66,_0x4944b7,_0x340154,_0x28d53d,_0x4a6cb2,_0x4fa581){logger[_0xc7a2('0x2e')](_0xc7a2('0x55'));var _0x119355={};_0x119355[_0xc7a2('0x56')]={'name':!_[_0xc7a2('0x1d')](_0x4944b7['role'][_0xc7a2('0x1a')])&&!_[_0xc7a2('0x1d')](_0x4944b7['profile'][_0xc7a2('0x1a')])&&_0x4944b7[_0xc7a2('0x36')][_0xc7a2('0x1a')]===_0xc7a2('0x57')?_0x4944b7[_0xc7a2('0x43')]['name']:!_[_0xc7a2('0x1d')](_0x4944b7[_0xc7a2('0x58')])?_0x4944b7[_0xc7a2('0x58')]+'\x20'+_0x4944b7['last_name']:_0x4944b7[_0xc7a2('0x44')],'id':_0x4944b7['id']};_0x119355[_0xc7a2('0x59')]=intUtil[_0xc7a2('0x5a')](_0x28d53d[_0xc7a2('0x5b')],_0x4a6cb2,'\x20');_0x119355[_0xc7a2('0x5c')]=intUtil[_0xc7a2('0x5a')](_0x28d53d['Descriptions'],_0x4a6cb2,'\x0a');if(_0x340154[_0xc7a2('0x3f')]===_0xc7a2('0x4f')){_0x119355[_0xc7a2('0x5d')]={'name':!_[_0xc7a2('0x1d')](_0x340154[_0xc7a2('0x5e')])?_0x340154[_0xc7a2('0x5e')]:!_[_0xc7a2('0x1d')](_0x340154['First_Name'])?_0x340154[_0xc7a2('0x5f')]+'\x20'+_0x340154['Last_Name']:_0x340154['Last_Name'],'id':_0x340154['id']};}if(_0x340154[_0xc7a2('0x3f')]===_0xc7a2('0x51')){_0x119355[_0xc7a2('0x60')]={'name':!_['isNil'](_0x340154[_0xc7a2('0x5e')])?_0x340154['Full_Name']:!_['isNil'](_0x340154[_0xc7a2('0x5f')])?_0x340154[_0xc7a2('0x5f')]+'\x20'+_0x340154[_0xc7a2('0x61')]:_0x340154[_0xc7a2('0x61')],'id':_0x340154['id']};_0x119355[_0xc7a2('0x62')]=_[_0xc7a2('0x47')](_0x340154['enduserType']);}if(_0x4a6cb2['talktime']){_0x119355['Call_Duration']=moment[_0xc7a2('0x63')](parseInt(_0x4a6cb2['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x4a6cb2['answertime']&&_0x4a6cb2[_0xc7a2('0x64')]){_0x119355[_0xc7a2('0x65')]=moment[_0xc7a2('0x63')](moment(_0x4a6cb2[_0xc7a2('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xc7a2('0x66')](moment(_0x4a6cb2[_0xc7a2('0x67')],_0xc7a2('0x68'))))[_0xc7a2('0x30')](_0xc7a2('0x69'));}switch(_0x4a6cb2[_0xc7a2('0x6a')]){case _0xc7a2('0x6b'):_0x119355[_0xc7a2('0x6c')]=_0xc7a2('0x6d');break;case _0xc7a2('0x6e'):case _0xc7a2('0x6f'):_0x119355['Call_Result']='Answered';break;case _0xc7a2('0x70'):_0x119355['Call_Result']=_0xc7a2('0x71');break;case _0xc7a2('0x72'):_0x119355[_0xc7a2('0x6c')]=_0xc7a2('0x73');break;case'timeout':_0x119355[_0xc7a2('0x6c')]=_0xc7a2('0x74');default:}_0x119355[_0xc7a2('0x75')]=(_0x4fa581===_0xc7a2('0x76')?moment(_0x4a6cb2[_0xc7a2('0x67')])['format'](_0xc7a2('0x68')):moment(_0x4a6cb2[_0xc7a2('0x77')])[_0xc7a2('0x30')](_0xc7a2('0x68')))||moment()[_0xc7a2('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x119355[_0xc7a2('0x78')]=_0x4fa581||'Inbound';_0x119355=_['merge'](_0x119355,getCustomFields(_0x28d53d[_0xc7a2('0x79')],_0x4a6cb2));return request({'method':_0xc7a2('0x24'),'uri':_0xc7a2('0x40')+_0x223755+'/crm/v2/Calls','headers':{'Authorization':_0xc7a2('0x32')+_0x52e416},'body':{'data':[_0x119355]},'json':!![]})[_0xc7a2('0x33')](function(_0x5b82de){if(_0x5b82de&&_0x5b82de[_0xc7a2('0x3e')][0x0][_0xc7a2('0x45')]===_0xc7a2('0x46')){logger['info']('Call\x20created!');return{'id':_0x5b82de['data'][0x0][_0xc7a2('0x7a')]['id']};}})[_0xc7a2('0x2c')](function(_0x5aa560){logger[_0xc7a2('0x2e')](_0xc7a2('0x7b'),_0x5aa560['stack']);console[_0xc7a2('0x49')]('err',_0x5aa560);});}exports[_0xc7a2('0x7c')]=function(_0x55cf8b,_0x180df6,_0x135997,_0x50b308,_0x21d5ce,_0x580cf8){var _0xd3e00c,_0x4112bd,_0x5c7416;_0x580cf8[_0xc7a2('0x7d')]=intUtil[_0xc7a2('0x7e')](_0x580cf8[_0xc7a2('0x7d')]);_0x580cf8['serverUrl']=intUtil['stripTrailingSlash'](_0x580cf8['serverUrl']);if(_0x21d5ce&&_0x21d5ce[_0xc7a2('0x7f')]){logger[_0xc7a2('0x2e')](_0xc7a2('0x80'),_0xc7a2('0x81'));_0x180df6[_0xc7a2('0x82')]=_0x580cf8['serverUrl']+'/api/voice/recordings/'+_0x180df6[_0xc7a2('0x83')]+_0xc7a2('0x84')+md5(_0x180df6[_0xc7a2('0x83')]);}else{_0x180df6[_0xc7a2('0x82')]='';}var _0x29c024=_0x580cf8[_0xc7a2('0x7d')]===_0xc7a2('0x85')?'eu':_0xc7a2('0x86');return getAccessToken(_0x580cf8)[_0xc7a2('0x33')](function(_0x1b9d30){_0x5c7416=_0x1b9d30;return getUser(_0x5c7416,_0x29c024,_0x580cf8,_0x50b308['email']);})['then'](function(_0x2eca32){_0xd3e00c=_0x2eca32;logger[_0xc7a2('0x2e')]('The\x20User\x20ID\x20is:',_0xd3e00c['id']);return getEndUser(_0x5c7416,_0x29c024,_0x580cf8,_0x180df6[_0xc7a2('0x87')],_0x180df6['calleridnum'],_0xd3e00c,_0x135997);})[_0xc7a2('0x33')](function(_0xac0e72){_0x4112bd=_0xac0e72;return getCall(_0x5c7416,_0x29c024,_0x580cf8,_0xd3e00c,_0x4112bd,_0x135997,_0x180df6,_0xc7a2('0x88'));})[_0xc7a2('0x33')](function(_0x59d11e){if(_0x59d11e){logger[_0xc7a2('0x2e')](_0xc7a2('0x89'),_0x59d11e['id']);logger[_0xc7a2('0x2e')](_0xc7a2('0x80'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc7a2('0x30')](_0xc7a2('0x8a'),_0x50b308[_0xc7a2('0x1a')]),_0xc7a2('0x8b'),{'uri':'https://crm.'+_0x580cf8[_0xc7a2('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x59d11e['id']});}})['catch'](function(_0x4e12bb){logger[_0xc7a2('0x3a')]('[QUEUE]',JSON[_0xc7a2('0x3c')](_0x4e12bb));});};exports['outbound']=function(_0x410328,_0x2ee7d4,_0x89ea9b,_0x4734be,_0x2c357b,_0x174482,_0x41600d){var _0x185fef,_0x1864cb,_0x557b90;_0x174482[_0xc7a2('0x7d')]=intUtil[_0xc7a2('0x7e')](_0x174482[_0xc7a2('0x7d')]);_0x174482[_0xc7a2('0x8c')]=intUtil[_0xc7a2('0x7e')](_0x174482[_0xc7a2('0x8c')]);if(_0x41600d&&_0x41600d[_0xc7a2('0x8d')]&&_0x41600d[_0xc7a2('0x8d')]!==_0xc7a2('0x8e')){logger[_0xc7a2('0x2e')](_0xc7a2('0x8f'),_0xc7a2('0x81'));_0x2ee7d4[_0xc7a2('0x82')]=_0x174482[_0xc7a2('0x8c')]+_0xc7a2('0x90')+_0x2ee7d4[_0xc7a2('0x83')]+_0xc7a2('0x84')+md5(_0x2ee7d4[_0xc7a2('0x83')]);}var _0x588541=_0x174482['host']===_0xc7a2('0x85')?'eu':_0xc7a2('0x86');return getAccessToken(_0x174482)['then'](function(_0x46d7f1){_0x557b90=_0x46d7f1;return getUser(_0x557b90,_0x588541,_0x174482,_0x4734be[_0xc7a2('0x91')]);})['then'](function(_0x536522){_0x185fef=_0x536522;logger[_0xc7a2('0x2e')](_0xc7a2('0x92'),_0x185fef['id']);return getEndUser(_0x557b90,_0x588541,_0x174482,_0x2ee7d4[_0xc7a2('0x93')],_0x2ee7d4[_0xc7a2('0x94')],_0x185fef,_0x89ea9b);})[_0xc7a2('0x33')](function(_0x259f04){_0x1864cb=_0x259f04;return getCall(_0x557b90,_0x588541,_0x174482,_0x185fef,_0x1864cb,_0x89ea9b,_0x2ee7d4,'Outbound');})[_0xc7a2('0x33')](function(_0x47e145){if(_0x47e145){logger[_0xc7a2('0x2e')]('The\x20Call\x20ID\x20is:',_0x47e145['id']);logger[_0xc7a2('0x2e')](_0xc7a2('0x8f'),_0xc7a2('0x95'));emit(util[_0xc7a2('0x30')](_0xc7a2('0x8a'),_0x4734be[_0xc7a2('0x1a')]),_0xc7a2('0x8b'),{'uri':_0xc7a2('0x96')+_0x174482[_0xc7a2('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x47e145['id']});}})['catch'](function(_0x484038){logger[_0xc7a2('0x3a')](_0xc7a2('0x8f'),JSON[_0xc7a2('0x3c')](_0x484038));});};exports[_0xc7a2('0x97')]=function(_0xe73b14,_0x4f53ee,_0x36a9b2,_0x44f3fd,_0x2157a3,_0x334551){var _0x57f3ac,_0x2defb6,_0x4441dc;_0x334551[_0xc7a2('0x7d')]=intUtil['stripTrailingSlash'](_0x334551[_0xc7a2('0x7d')]);_0x334551[_0xc7a2('0x8c')]=intUtil[_0xc7a2('0x7e')](_0x334551['serverUrl']);if(_0x2157a3&&_0x2157a3[_0xc7a2('0x7f')]){logger[_0xc7a2('0x2e')]('['+_0x4f53ee[_0xc7a2('0x6a')][_0xc7a2('0x98')]()+']','Recording\x20is\x20enabled!');_0x4f53ee['recordingURL']=_0x334551[_0xc7a2('0x8c')]+_0xc7a2('0x90')+_0x4f53ee[_0xc7a2('0x83')]+_0xc7a2('0x84')+md5(_0x4f53ee[_0xc7a2('0x83')]);}else{_0x4f53ee[_0xc7a2('0x82')]='';}var _0x37c983=_0x334551[_0xc7a2('0x7d')]===_0xc7a2('0x85')?'eu':'com';return getAccessToken(_0x334551)[_0xc7a2('0x33')](function(_0x458004){_0x4441dc=_0x458004;return getUser(_0x4441dc,_0x37c983,_0x334551);})[_0xc7a2('0x33')](function(_0x2ef5ad){_0x57f3ac=_0x2ef5ad;logger['info'](_0xc7a2('0x92'),_0x57f3ac['id']);return getEndUser(_0x4441dc,_0x37c983,_0x334551,_0x4f53ee[_0xc7a2('0x87')],_0x4f53ee[_0xc7a2('0x99')],_0x57f3ac,_0x36a9b2);})['then'](function(_0x11e971){_0x2defb6=_0x11e971;return getCall(_0x4441dc,_0x37c983,_0x334551,_0x57f3ac,_0x2defb6,_0x36a9b2,_0x4f53ee,_0xc7a2('0x88'));})[_0xc7a2('0x33')](function(_0x2cdc06){if(_0x2cdc06){logger['info'](_0xc7a2('0x89'),_0x2cdc06['id']);}})[_0xc7a2('0x2c')](function(_0x4a68cc){logger[_0xc7a2('0x3a')]('['+_0x4f53ee[_0xc7a2('0x6a')][_0xc7a2('0x98')]()+']',JSON[_0xc7a2('0x3c')](_0x4a68cc));});}; \ 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 fdef6fe..f2e01cc 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(_0x1bbd23,_0x397be4){var _0x58a9df=function(_0x5c0541){while(--_0x5c0541){_0x1bbd23['push'](_0x1bbd23['shift']());}};_0x58a9df(++_0x397be4);}(_0x7a54,0x106));var _0x47a5=function(_0x2412fc,_0x86aab1){_0x2412fc=_0x2412fc-0x0;var _0x5813be=_0x7a54[_0x2412fc];return _0x5813be;};'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(_0x5145ea,_0x23455f){var _0x5d981a=function(_0x2dcc57){while(--_0x2dcc57){_0x5145ea['push'](_0x5145ea['shift']());}};_0x5d981a(++_0x23455f);}(_0x7a54,0x106));var _0x47a5=function(_0x4ed5a0,_0x8546d3){_0x4ed5a0=_0x4ed5a0-0x0;var _0x3ee9d5=_0x7a54[_0x4ed5a0];return _0x3ee9d5;};'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 a7fa7a6..52f8037 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x425981,_0x2244de){var _0x59ff4f=function(_0x26cc7b){while(--_0x26cc7b){_0x425981['push'](_0x425981['shift']());}};_0x59ff4f(++_0x2244de);}(_0x5f2f,0x73));var _0xf5f2=function(_0x80c216,_0x34841){_0x80c216=_0x80c216-0x0;var _0x645487=_0x5f2f[_0x80c216];return _0x645487;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x10249a,_0x1ae27c){var _0x11ff5d=function(_0x18f0ad){while(--_0x18f0ad){_0x10249a['push'](_0x10249a['shift']());}};_0x11ff5d(++_0x1ae27c);}(_0xb10b,0x12a));var _0xbb10=function(_0xabb8a1,_0x5ed479){_0xabb8a1=_0xabb8a1-0x0;var _0x9a4673=_0xb10b[_0xabb8a1];return _0x9a4673;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8884dd2..4b56c26 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 _0x4f99=['error','message','result','catch','exports','jayson/promise','bluebird','routing','client','http','request','then','debug'];(function(_0x3630d6,_0x232650){var _0x4fdc71=function(_0x5a6d3d){while(--_0x5a6d3d){_0x3630d6['push'](_0x3630d6['shift']());}};_0x4fdc71(++_0x232650);}(_0x4f99,0x157));var _0x94f9=function(_0x5e3022,_0x5ef1ae){_0x5e3022=_0x5e3022-0x0;var _0x1dd4b7=_0x4f99[_0x5e3022];return _0x1dd4b7;};'use strict';var jayson=require(_0x94f9('0x0'));var BPromise=require(_0x94f9('0x1'));var logger=require('../../config/logger')(_0x94f9('0x2'));var client=jayson[_0x94f9('0x3')][_0x94f9('0x4')]({'port':0x2329});client['Request']=function(_0x15ff7c,_0x879bc2){return new BPromise(function(_0x560634,_0x1b4831){return client[_0x94f9('0x5')](_0x15ff7c,_0x879bc2)[_0x94f9('0x6')](function(_0x253a79){logger[_0x94f9('0x7')]('rpc',_0x94f9('0x2'),_0x15ff7c,_0x879bc2,_0x253a79);if(_0x253a79['error']){logger[_0x94f9('0x8')]('rpc',_0x94f9('0x2'),_0x15ff7c,_0x253a79['error'][_0x94f9('0x9')],_0x879bc2);return _0x1b4831(_0x253a79[_0x94f9('0x8')][_0x94f9('0x9')]);}else{return _0x560634(_0x253a79[_0x94f9('0xa')]);}})[_0x94f9('0xb')](function(_0x2043f4){logger[_0x94f9('0x8')]('rpc',_0x94f9('0x2'),_0x15ff7c,_0x2043f4,_0x879bc2);return _0x1b4831(_0x2043f4);});});};module[_0x94f9('0xc')]=client; \ No newline at end of file +var _0x37cc=['bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0xe9d6b2,_0x55f1fb){var _0x1cd85d=function(_0x5a0b7b){while(--_0x5a0b7b){_0xe9d6b2['push'](_0xe9d6b2['shift']());}};_0x1cd85d(++_0x55f1fb);}(_0x37cc,0x185));var _0xc37c=function(_0xd803c8,_0x22bbf2){_0xd803c8=_0xd803c8-0x0;var _0x14d343=_0x37cc[_0xd803c8];return _0x14d343;};'use strict';var jayson=require(_0xc37c('0x0'));var BPromise=require(_0xc37c('0x1'));var logger=require(_0xc37c('0x2'))(_0xc37c('0x3'));var client=jayson[_0xc37c('0x4')][_0xc37c('0x5')]({'port':0x2329});client['Request']=function(_0x55b158,_0x334d3c){return new BPromise(function(_0x946e3b,_0x310b02){return client[_0xc37c('0x6')](_0x55b158,_0x334d3c)[_0xc37c('0x7')](function(_0x582100){logger[_0xc37c('0x8')](_0xc37c('0x9'),_0xc37c('0x3'),_0x55b158,_0x334d3c,_0x582100);if(_0x582100['error']){logger[_0xc37c('0xa')](_0xc37c('0x9'),_0xc37c('0x3'),_0x55b158,_0x582100[_0xc37c('0xa')][_0xc37c('0xb')],_0x334d3c);return _0x310b02(_0x582100['error'][_0xc37c('0xb')]);}else{return _0x946e3b(_0x582100[_0xc37c('0xc')]);}})[_0xc37c('0xd')](function(_0x262372){logger[_0xc37c('0xa')](_0xc37c('0x9'),_0xc37c('0x3'),_0x55b158,_0x262372,_0x334d3c);return _0x310b02(_0x262372);});});};module[_0xc37c('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0417575..081c6bb 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 _0xfc65=['catch','bluebird','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x23e2a3,_0x13e18e){var _0x27901b=function(_0x40fcc7){while(--_0x40fcc7){_0x23e2a3['push'](_0x23e2a3['shift']());}};_0x27901b(++_0x13e18e);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x59808c,_0x4e2244){_0x59808c=_0x59808c-0x0;var _0x2e2546=_0xfc65[_0x59808c];return _0x2e2546;};'use strict';var BPromise=require(_0x5fc6('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x5fc6('0x1'));var mailAccount=require(_0x5fc6('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5fc6('0x3'))['db'];function initRealtime(){return BPromise[_0x5fc6('0x4')]()[_0x5fc6('0x5')](mailAccount[_0x5fc6('0x6')]())[_0x5fc6('0x5')](realtime[_0x5fc6('0x7')]())[_0x5fc6('0x5')](function(){email[_0x5fc6('0x8')](realtime[_0x5fc6('0x9')]);return realtime;});}function main(){return server[_0x5fc6('0xa')](realtime,email)[_0x5fc6('0x5')](function(_0x572941){return initRealtime();})[_0x5fc6('0x5')](function(_0x1f1409){return db[_0x5fc6('0xb')][_0x5fc6('0xc')]({'attributes':['id',_0x5fc6('0xd')],'raw':!![]});})[_0x5fc6('0x5')](function(_0x23c4e2){return setInterval(initRealtime,_0x23c4e2[_0x5fc6('0xd')]*0x3e8);})[_0x5fc6('0xe')](function(_0x29781f){console['log'](_0x29781f);});}main(); \ No newline at end of file +var _0x0619=['bluebird','./server','./realtime','./lib/email','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','findOne','loginMailFrequency','catch','log'];(function(_0x35d060,_0x2180c3){var _0x42391f=function(_0x35c43b){while(--_0x35c43b){_0x35d060['push'](_0x35d060['shift']());}};_0x42391f(++_0x2180c3);}(_0x0619,0x90));var _0x9061=function(_0x4d5035,_0xf75349){_0x4d5035=_0x4d5035-0x0;var _0xa9b9f2=_0x0619[_0x4d5035];return _0xa9b9f2;};'use strict';var BPromise=require(_0x9061('0x0'));var server=require(_0x9061('0x1'));var Realtime=require(_0x9061('0x2'));var EmailChannel=require(_0x9061('0x3'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x9061('0x4'))['db'];function initRealtime(){return BPromise[_0x9061('0x5')]()[_0x9061('0x6')](mailAccount[_0x9061('0x7')]())[_0x9061('0x6')](realtime[_0x9061('0x8')]())[_0x9061('0x6')](function(){email[_0x9061('0x9')](realtime[_0x9061('0xa')]);return realtime;});}function main(){return server[_0x9061('0xb')](realtime,email)[_0x9061('0x6')](function(_0x5a950f){return initRealtime();})[_0x9061('0x6')](function(_0x59c323){return db['Setting'][_0x9061('0xc')]({'attributes':['id',_0x9061('0xd')],'raw':!![]});})['then'](function(_0x502660){return setInterval(initRealtime,_0x502660[_0x9061('0xd')]*0x3e8);})[_0x9061('0xe')](function(_0x13d226){console[_0x9061('0xf')](_0x13d226);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ccf1c95..3a2ad78 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 _0xbc9f=['./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','verified','exports','lodash','md5','ioredis','../../../config/logger','redis','localhost','socket.io-emitter'];(function(_0x3e4704,_0x371b8d){var _0x46f06c=function(_0x7d5e52){while(--_0x7d5e52){_0x3e4704['push'](_0x3e4704['shift']());}};_0x46f06c(++_0x371b8d);}(_0xbc9f,0x67));var _0xfbc9=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0xbc9f[_0x2eec1f];return _0x543075;};'use strict';var _=require(_0xfbc9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xfbc9('0x1'));var Redis=require(_0xfbc9('0x2'));var config=require('../../../config/environment');var logger=require(_0xfbc9('0x3'))('email');config[_0xfbc9('0x4')]=_['defaults'](config['redis'],{'host':_0xfbc9('0x5'),'port':0x18eb});var io=require(_0xfbc9('0x6'))(new Redis(config['redis']));var EmailImap=require(_0xfbc9('0x7'));var EmailSmtp=require(_0xfbc9('0x8'));var mailAccount=require(_0xfbc9('0x9'));var md5Accounts={};function EmailChannel(_0x4508c3){logger[_0xfbc9('0xa')](_0xfbc9('0xb'));this[_0xfbc9('0xc')]=_0x4508c3[_0xfbc9('0xc')];this[_0xfbc9('0xd')]={};this[_0xfbc9('0xe')]=new EmailSmtp();}EmailChannel[_0xfbc9('0xf')][_0xfbc9('0x10')]=function(_0x16fa03){var _0x4c0ddc=this['mailAccounts'][_0x16fa03];var _0x29d882={'id':_0x4c0ddc['id'],'name':_0x4c0ddc[_0xfbc9('0x11')],'key':_0x4c0ddc[_0xfbc9('0x12')],'active':_0x4c0ddc['active'],'Imap':{'status':_0x4c0ddc[_0xfbc9('0x13')][_0xfbc9('0x14')],'messageStatus':_0x4c0ddc['Imap'][_0xfbc9('0x15')],'total':_0x4c0ddc[_0xfbc9('0x13')]['total']}};if(_[_0xfbc9('0x16')](md5Accounts[_0x16fa03])){md5Accounts[_0x16fa03]={};}var _0x2fad4c=md5(JSON[_0xfbc9('0x17')](_0x29d882));if(md5Accounts[_0x16fa03][_0xfbc9('0x1')]!==_0x2fad4c){md5Accounts[_0x16fa03][_0xfbc9('0x1')]=_0x2fad4c;io[_0xfbc9('0x10')](_0xfbc9('0x18'),_0x29d882);}};EmailChannel[_0xfbc9('0xf')][_0xfbc9('0x19')]=function(_0x28fe10){for(var _0x5933b5 in _0x28fe10){if(_0x28fe10[_0xfbc9('0x1a')](_0x5933b5)){if(_0x28fe10[_0x5933b5][_0xfbc9('0x13')]&&_0x28fe10[_0x5933b5][_0xfbc9('0x1b')]){var _0x3df255=_0x28fe10[_0x5933b5]['Imap'];if(!this[_0xfbc9('0xd')][_0xfbc9('0x1a')](_0x3df255['id'])){this[_0xfbc9('0xd')][_0x3df255['id']]=new EmailImap(_0x3df255,_0x28fe10[_0x5933b5][_0xfbc9('0x1c')]);this[_0xfbc9('0xd')][_0x3df255['id']]['on'](_0xfbc9('0x1d'),this[_0xfbc9('0x1e')][_0xfbc9('0x1f')](this,_0x5933b5));this['imapAccounts'][_0x3df255['id']]['on'](_0xfbc9('0x1c'),this[_0xfbc9('0x20')][_0xfbc9('0x1f')](this,_0x5933b5));this['imapAccounts'][_0x3df255['id']]['on'](_0xfbc9('0x21'),this[_0xfbc9('0x22')][_0xfbc9('0x1f')](this,_0x5933b5));this[_0xfbc9('0xd')][_0x3df255['id']]['on'](_0xfbc9('0x23'),this[_0xfbc9('0x24')][_0xfbc9('0x1f')](this,_0x5933b5));}}else{if(_[_0xfbc9('0x16')](this[_0xfbc9('0xc')][_0x5933b5]['Imap'])){this[_0xfbc9('0xc')][_0x5933b5][_0xfbc9('0x13')]={};}this['mailAccounts'][_0x5933b5][_0xfbc9('0x13')][_0xfbc9('0x14')]=_0xfbc9('0x25');this[_0xfbc9('0xc')][_0x5933b5][_0xfbc9('0x13')][_0xfbc9('0x15')]='';this[_0xfbc9('0x10')](_0x5933b5);}}}};EmailChannel['prototype'][_0xfbc9('0x1e')]=function(_0x150489,_0x1de9b1){if(this[_0xfbc9('0xc')][_0x150489]){this[_0xfbc9('0xc')][_0x150489][_0xfbc9('0x13')][_0xfbc9('0x14')]='connected';this[_0xfbc9('0xc')][_0x150489]['Imap'][_0xfbc9('0x15')]=_0x1de9b1[_0xfbc9('0x11')];if(_0x1de9b1[_0xfbc9('0x26')]){this[_0xfbc9('0xc')][_0x150489][_0xfbc9('0x13')]['total']=_0x1de9b1[_0xfbc9('0x26')][_0xfbc9('0x27')];}return this[_0xfbc9('0x10')](_0x150489);}};EmailChannel['prototype'][_0xfbc9('0x20')]=function(_0x18f61a,_0x2feb73){logger[_0xfbc9('0xa')](_0xfbc9('0x28'),_0x2feb73[_0xfbc9('0x29')],_0x2feb73['lastName'],_0x2feb73[_0xfbc9('0x2a')],_0x18f61a);if(this[_0xfbc9('0xc')][_0x18f61a]){return mailAccount[_0xfbc9('0x2b')](_0x18f61a,_0x2feb73)[_0xfbc9('0x2c')](function(_0x44c6fb){if(_0x44c6fb){logger[_0xfbc9('0xa')](_0xfbc9('0x2d'));}})[_0xfbc9('0x2e')](function(_0xc7acd0){logger[_0xfbc9('0x23')](_0xfbc9('0x2f'),JSON[_0xfbc9('0x17')](_0xc7acd0));});}};EmailChannel[_0xfbc9('0xf')][_0xfbc9('0x22')]=function(_0x39957d){if(this[_0xfbc9('0xc')][_0x39957d]&&this[_0xfbc9('0xc')][_0x39957d][_0xfbc9('0x13')]){if(this['imapAccounts'][this[_0xfbc9('0xc')][_0x39957d][_0xfbc9('0x13')]['id']]){delete this[_0xfbc9('0xd')][this['mailAccounts'][_0x39957d][_0xfbc9('0x13')]['id']];}this[_0xfbc9('0xc')][_0x39957d][_0xfbc9('0x13')][_0xfbc9('0x30')]=moment();this['emit'](_0x39957d);}};EmailChannel[_0xfbc9('0xf')][_0xfbc9('0x24')]=function(_0x58c049,_0x517cf8){if(this[_0xfbc9('0xc')][_0x58c049]){this[_0xfbc9('0xc')][_0x58c049][_0xfbc9('0x13')][_0xfbc9('0x14')]='error';this['mailAccounts'][_0x58c049][_0xfbc9('0x13')]['messageStatus']=_0x517cf8;return this['emit'](_0x58c049);}};EmailChannel['prototype'][_0xfbc9('0x31')]=function(_0xa0bfc2,_0x41a9f0){return this[_0xfbc9('0xe')]['send'](_0xa0bfc2,_0x41a9f0);};EmailChannel[_0xfbc9('0xf')][_0xfbc9('0x32')]=function(_0xf13050){var _0x4db283=this;if(this[_0xfbc9('0xc')][_0xf13050['id']]){if(_[_0xfbc9('0x16')](this[_0xfbc9('0xc')][_0xf13050['id']][_0xfbc9('0x33')])){this[_0xfbc9('0xc')][_0xf13050['id']][_0xfbc9('0x33')]={};}this['mailAccounts'][_0xf13050['id']]['Smtp'][_0xfbc9('0x30')]=moment();return new BPromise(function(_0x457cf8,_0xb15a23){return _0x4db283[_0xfbc9('0xe')][_0xfbc9('0x34')](_0xf13050)[_0xfbc9('0x2c')](function(_0x468fe8){_0x4db283[_0xfbc9('0xc')][_0xf13050['id']][_0xfbc9('0x33')][_0xfbc9('0x14')]=_0xfbc9('0x35');_0x4db283['mailAccounts'][_0xf13050['id']]['Smtp'][_0xfbc9('0x15')]='';_0x4db283[_0xfbc9('0x10')](_0xf13050['id']);_0x457cf8(_0x468fe8);})[_0xfbc9('0x2e')](function(_0x5d6349){_0x4db283[_0xfbc9('0xc')][_0xf13050['id']][_0xfbc9('0x33')][_0xfbc9('0x14')]='error';_0x4db283['mailAccounts'][_0xf13050['id']][_0xfbc9('0x33')][_0xfbc9('0x15')]=_0x5d6349;_0x4db283['emit'](_0xf13050['id']);_0xb15a23(_0x5d6349);});});}return this[_0xfbc9('0xe')][_0xfbc9('0x34')](_0xf13050);};module[_0xfbc9('0x36')]=EmailChannel; \ No newline at end of file +var _0xbf79=['sendMail','Smtp','verify','verified','catch','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','smtp','prototype','emit','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','error','mailAccounts','disabled','status','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError'];(function(_0x4d3a1f,_0x4c67c2){var _0x345ceb=function(_0x12ba3f){while(--_0x12ba3f){_0x4d3a1f['push'](_0x4d3a1f['shift']());}};_0x345ceb(++_0x4c67c2);}(_0xbf79,0x1bd));var _0x9bf7=function(_0x13fa2d,_0x34ca1e){_0x13fa2d=_0x13fa2d-0x0;var _0x28854c=_0xbf79[_0x13fa2d];return _0x28854c;};'use strict';var _=require(_0x9bf7('0x0'));var moment=require(_0x9bf7('0x1'));var BPromise=require(_0x9bf7('0x2'));var md5=require(_0x9bf7('0x3'));var Redis=require(_0x9bf7('0x4'));var config=require(_0x9bf7('0x5'));var logger=require(_0x9bf7('0x6'))(_0x9bf7('0x7'));config[_0x9bf7('0x8')]=_[_0x9bf7('0x9')](config[_0x9bf7('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9bf7('0xa'))(new Redis(config[_0x9bf7('0x8')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x9bf7('0xb'));var mailAccount=require(_0x9bf7('0xc'));var md5Accounts={};function EmailChannel(_0x7986d0){logger[_0x9bf7('0xd')]('start\x20email\x20channel');this['mailAccounts']=_0x7986d0['mailAccounts'];this['imapAccounts']={};this[_0x9bf7('0xe')]=new EmailSmtp();}EmailChannel[_0x9bf7('0xf')][_0x9bf7('0x10')]=function(_0x1a78ee){var _0x4a8db6=this['mailAccounts'][_0x1a78ee];var _0x2a5c99={'id':_0x4a8db6['id'],'name':_0x4a8db6['name'],'key':_0x4a8db6[_0x9bf7('0x11')],'active':_0x4a8db6[_0x9bf7('0x12')],'Imap':{'status':_0x4a8db6[_0x9bf7('0x13')]['status'],'messageStatus':_0x4a8db6[_0x9bf7('0x13')][_0x9bf7('0x14')],'total':_0x4a8db6[_0x9bf7('0x13')][_0x9bf7('0x15')]}};if(_[_0x9bf7('0x16')](md5Accounts[_0x1a78ee])){md5Accounts[_0x1a78ee]={};}var _0x57ab09=md5(JSON[_0x9bf7('0x17')](_0x2a5c99));if(md5Accounts[_0x1a78ee][_0x9bf7('0x3')]!==_0x57ab09){md5Accounts[_0x1a78ee][_0x9bf7('0x3')]=_0x57ab09;io['emit'](_0x9bf7('0x18'),_0x2a5c99);}};EmailChannel[_0x9bf7('0xf')][_0x9bf7('0x19')]=function(_0x18d848){for(var _0x3e7da8 in _0x18d848){if(_0x18d848[_0x9bf7('0x1a')](_0x3e7da8)){if(_0x18d848[_0x3e7da8][_0x9bf7('0x13')]&&_0x18d848[_0x3e7da8][_0x9bf7('0x12')]){var _0x10cb12=_0x18d848[_0x3e7da8]['Imap'];if(!this['imapAccounts'][_0x9bf7('0x1a')](_0x10cb12['id'])){this[_0x9bf7('0x1b')][_0x10cb12['id']]=new EmailImap(_0x10cb12,_0x18d848[_0x3e7da8][_0x9bf7('0x7')]);this[_0x9bf7('0x1b')][_0x10cb12['id']]['on'](_0x9bf7('0x1c'),this[_0x9bf7('0x1d')][_0x9bf7('0x1e')](this,_0x3e7da8));this[_0x9bf7('0x1b')][_0x10cb12['id']]['on']('email',this[_0x9bf7('0x1f')][_0x9bf7('0x1e')](this,_0x3e7da8));this[_0x9bf7('0x1b')][_0x10cb12['id']]['on']('end',this['handleImapEnd']['bind'](this,_0x3e7da8));this[_0x9bf7('0x1b')][_0x10cb12['id']]['on'](_0x9bf7('0x20'),this['handleImapError'][_0x9bf7('0x1e')](this,_0x3e7da8));}}else{if(_[_0x9bf7('0x16')](this[_0x9bf7('0x21')][_0x3e7da8]['Imap'])){this[_0x9bf7('0x21')][_0x3e7da8]['Imap']={};}this['mailAccounts'][_0x3e7da8]['Imap']['status']=_0x9bf7('0x22');this[_0x9bf7('0x21')][_0x3e7da8][_0x9bf7('0x13')][_0x9bf7('0x14')]='';this[_0x9bf7('0x10')](_0x3e7da8);}}}};EmailChannel[_0x9bf7('0xf')][_0x9bf7('0x1d')]=function(_0x5b61e0,_0x59418c){if(this[_0x9bf7('0x21')][_0x5b61e0]){this[_0x9bf7('0x21')][_0x5b61e0][_0x9bf7('0x13')][_0x9bf7('0x23')]=_0x9bf7('0x24');this[_0x9bf7('0x21')][_0x5b61e0][_0x9bf7('0x13')][_0x9bf7('0x14')]=_0x59418c[_0x9bf7('0x25')];if(_0x59418c[_0x9bf7('0x26')]){this[_0x9bf7('0x21')][_0x5b61e0]['Imap'][_0x9bf7('0x15')]=_0x59418c['messages']['total'];}return this[_0x9bf7('0x10')](_0x5b61e0);}};EmailChannel[_0x9bf7('0xf')][_0x9bf7('0x1f')]=function(_0x505a25,_0x5dabda){logger[_0x9bf7('0xd')](_0x9bf7('0x27'),_0x5dabda[_0x9bf7('0x28')],_0x5dabda[_0x9bf7('0x29')],_0x5dabda[_0x9bf7('0x2a')],_0x505a25);if(this[_0x9bf7('0x21')][_0x505a25]){return mailAccount[_0x9bf7('0x2b')](_0x505a25,_0x5dabda)[_0x9bf7('0x2c')](function(_0x50ec1f){if(_0x50ec1f){logger[_0x9bf7('0xd')](_0x9bf7('0x2d'));}})['catch'](function(_0x22bd88){logger[_0x9bf7('0x20')](_0x9bf7('0x2e'),JSON[_0x9bf7('0x17')](_0x22bd88));});}};EmailChannel[_0x9bf7('0xf')][_0x9bf7('0x2f')]=function(_0x43a92c){if(this['mailAccounts'][_0x43a92c]&&this[_0x9bf7('0x21')][_0x43a92c]['Imap']){if(this[_0x9bf7('0x1b')][this[_0x9bf7('0x21')][_0x43a92c]['Imap']['id']]){delete this['imapAccounts'][this[_0x9bf7('0x21')][_0x43a92c][_0x9bf7('0x13')]['id']];}this['mailAccounts'][_0x43a92c]['Imap'][_0x9bf7('0x30')]=moment();this[_0x9bf7('0x10')](_0x43a92c);}};EmailChannel['prototype'][_0x9bf7('0x31')]=function(_0x1c5208,_0xcfc2f5){if(this[_0x9bf7('0x21')][_0x1c5208]){this[_0x9bf7('0x21')][_0x1c5208]['Imap'][_0x9bf7('0x23')]=_0x9bf7('0x20');this[_0x9bf7('0x21')][_0x1c5208][_0x9bf7('0x13')][_0x9bf7('0x14')]=_0xcfc2f5;return this[_0x9bf7('0x10')](_0x1c5208);}};EmailChannel[_0x9bf7('0xf')][_0x9bf7('0x32')]=function(_0x444935,_0xeb2f93){return this['smtp']['send'](_0x444935,_0xeb2f93);};EmailChannel[_0x9bf7('0xf')]['verifySmtp']=function(_0xfab2f5){var _0x31d68d=this;if(this[_0x9bf7('0x21')][_0xfab2f5['id']]){if(_[_0x9bf7('0x16')](this[_0x9bf7('0x21')][_0xfab2f5['id']][_0x9bf7('0x33')])){this['mailAccounts'][_0xfab2f5['id']]['Smtp']={};}this[_0x9bf7('0x21')][_0xfab2f5['id']][_0x9bf7('0x33')]['lastSync']=moment();return new BPromise(function(_0x1e9792,_0x21827f){return _0x31d68d[_0x9bf7('0xe')][_0x9bf7('0x34')](_0xfab2f5)[_0x9bf7('0x2c')](function(_0x5ccb1c){_0x31d68d['mailAccounts'][_0xfab2f5['id']][_0x9bf7('0x33')][_0x9bf7('0x23')]=_0x9bf7('0x35');_0x31d68d[_0x9bf7('0x21')][_0xfab2f5['id']][_0x9bf7('0x33')][_0x9bf7('0x14')]='';_0x31d68d[_0x9bf7('0x10')](_0xfab2f5['id']);_0x1e9792(_0x5ccb1c);})[_0x9bf7('0x36')](function(_0x1fcecf){_0x31d68d[_0x9bf7('0x21')][_0xfab2f5['id']][_0x9bf7('0x33')][_0x9bf7('0x23')]=_0x9bf7('0x20');_0x31d68d[_0x9bf7('0x21')][_0xfab2f5['id']][_0x9bf7('0x33')][_0x9bf7('0x14')]=_0x1fcecf;_0x31d68d[_0x9bf7('0x10')](_0xfab2f5['id']);_0x21827f(_0x1fcecf);});});}return this[_0x9bf7('0xe')][_0x9bf7('0x34')](_0xfab2f5);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 0eacee7..405e899 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 _0xa0cd=['util','lodash','mailparser','simpleParser','Iconv','events','./utils','INBOX','account','getAccount','imap','once','ready','handleReady','end','handleEnd','bind','handleError','inherits','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','getHost','service','email','anonymous@xcally.com','prototype','handleOpenBox','emit','handleCloseBox','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchError','handleFetchEnd','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','closeBox','textCode','hasOwnProperty','upperFirst','exports','path'];(function(_0x12fefc,_0x5686c8){var _0x36002d=function(_0x394f26){while(--_0x394f26){_0x12fefc['push'](_0x12fefc['shift']());}};_0x36002d(++_0x5686c8);}(_0xa0cd,0xa1));var _0xda0c=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0xa0cd[_0x21f3bf];return _0x249d08;};'use strict';var fs=require('fs');var path=require(_0xda0c('0x0'));var util=require(_0xda0c('0x1'));var Imap=require('imap');var _=require(_0xda0c('0x2'));var rs=require('randomstring');var simpleParser=require(_0xda0c('0x3'))[_0xda0c('0x4')];var Iconv=require('iconv')[_0xda0c('0x5')];var EventEmitter=require(_0xda0c('0x6'))['EventEmitter'];var utils=require(_0xda0c('0x7'));var logger=require('../../../config/logger')('email');function EmailImap(_0x33b88f,_0xac730a){this['mailbox']=_0xda0c('0x8');this[_0xda0c('0x9')]=this[_0xda0c('0xa')](_0x33b88f,_0xac730a);this[_0xda0c('0xb')]=new Imap(this[_0xda0c('0x9')]);this[_0xda0c('0xb')][_0xda0c('0xc')](_0xda0c('0xd'),this[_0xda0c('0xe')]['bind'](this));this[_0xda0c('0xb')][_0xda0c('0xc')](_0xda0c('0xf'),this[_0xda0c('0x10')][_0xda0c('0x11')](this));this[_0xda0c('0xb')]['on']('error',this[_0xda0c('0x12')][_0xda0c('0x11')](this));this[_0xda0c('0xb')]['connect']();}util[_0xda0c('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0xda0c('0xa')]=function(_0x1827d4,_0x1bfb06){var _0x34ae3f={'connTimeout':_0x1827d4[_0xda0c('0x14')]?_0x1827d4[_0xda0c('0x14')]*0x3e8:0x2710,'authTimeout':_0x1827d4['authTimeout']?_0x1827d4[_0xda0c('0x15')]*0x3e8:0x1388};if(_[_0xda0c('0x16')](_0x1827d4['service'])){if(_0x1827d4[_0xda0c('0x17')]){_0x34ae3f[_0xda0c('0x18')]=_0x1827d4[_0xda0c('0x18')];_0x34ae3f[_0xda0c('0x19')]=_0x1827d4['password'];}_0x34ae3f['host']=_0x1827d4[_0xda0c('0x1a')];_0x34ae3f[_0xda0c('0x1b')]=_0x1827d4[_0xda0c('0x1b')]||0x3e1;if(_0x1827d4[_0xda0c('0x1c')]){_0x34ae3f[_0xda0c('0x1c')]=!![];}else{_0x34ae3f['tls']=![];_0x34ae3f['autotls']='required';}}else{_0x34ae3f['user']=_0x1827d4[_0xda0c('0x18')];_0x34ae3f[_0xda0c('0x19')]=_0x1827d4['password'];_0x34ae3f[_0xda0c('0x1a')]=utils[_0xda0c('0x1d')](_0x1827d4[_0xda0c('0x1e')]);_0x34ae3f['port']=0x3e1;_0x34ae3f[_0xda0c('0x1c')]=!![];}_0x34ae3f[_0xda0c('0x1f')]=_0x1bfb06||_0x1827d4[_0xda0c('0x18')]||_0xda0c('0x20');return _0x34ae3f;};EmailImap[_0xda0c('0x21')][_0xda0c('0xe')]=function(){this[_0xda0c('0xb')]['openBox'](this['mailbox'],![],this[_0xda0c('0x22')]['bind'](this));};EmailImap[_0xda0c('0x21')]['handleOpenBox']=function(_0x3b2c5d,_0x59af70){if(_0x3b2c5d){this[_0xda0c('0x12')](_0x3b2c5d,!![]);}else{this[_0xda0c('0x23')]('box',_0x59af70);this['readUnseen']();}};EmailImap[_0xda0c('0x21')][_0xda0c('0x24')]=function(_0x4cceca){if(_0x4cceca){this[_0xda0c('0x12')](_0x4cceca,!![]);}else{this[_0xda0c('0xb')][_0xda0c('0xf')]();}};EmailImap[_0xda0c('0x21')]['readUnseen']=function(){this['imap']['search'](['UNSEEN'],this[_0xda0c('0x25')]['bind'](this));};EmailImap[_0xda0c('0x21')][_0xda0c('0x25')]=function(_0x34fa13,_0x4cd089){if(_0x34fa13){this['handleError'](_0x34fa13,!![]);}else{if(_0x4cd089[_0xda0c('0x26')]){try{var _0x12fec2=this[_0xda0c('0xb')][_0xda0c('0x27')](_0x4cd089,{'bodies':'','markSeen':!![]});_0x12fec2['on']('message',this[_0xda0c('0x28')][_0xda0c('0x11')](this));_0x12fec2[_0xda0c('0xc')](_0xda0c('0x29'),this[_0xda0c('0x2a')]['bind'](this));_0x12fec2['once'](_0xda0c('0xf'),this[_0xda0c('0x2b')]['bind'](this));}catch(_0x2ea23e){logger['error'](_0x2ea23e);}}else{this[_0xda0c('0xb')]['closeBox'](!![],this[_0xda0c('0x24')][_0xda0c('0x11')](this));}}};EmailImap[_0xda0c('0x21')][_0xda0c('0x28')]=function(_0x53daf8,_0x110eb8){_0x53daf8['on']('body',this['handleMessageBody'][_0xda0c('0x11')](this));_0x53daf8['once']('attributes',this[_0xda0c('0x2c')][_0xda0c('0x11')](this));_0x53daf8['once'](_0xda0c('0xf'),this[_0xda0c('0x2d')]['bind'](this));};EmailImap[_0xda0c('0x21')][_0xda0c('0x2e')]=function(_0xc49f78,_0x1b2e5f){simpleParser(_0xc49f78,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0xda0c('0x21')][_0xda0c('0x2c')]=function(_0x17b8ab){};EmailImap[_0xda0c('0x21')][_0xda0c('0x2d')]=function(){};EmailImap[_0xda0c('0x21')][_0xda0c('0x2f')]=function(_0x23494b,_0x43023d){if(_0x23494b){logger[_0xda0c('0x29')](_0x23494b);}else{var _0x1e039b=this;utils[_0xda0c('0x30')](this[_0xda0c('0x9')],_0x43023d,function(_0x53c9b2){_0x1e039b['emit'](_0xda0c('0x1f'),_0x53c9b2);});}};EmailImap[_0xda0c('0x21')][_0xda0c('0x2b')]=function(){this[_0xda0c('0xb')][_0xda0c('0x31')](!![],this[_0xda0c('0x24')][_0xda0c('0x11')](this));};EmailImap['prototype'][_0xda0c('0x2a')]=function(_0x26ed95){this[_0xda0c('0x12')](_0x26ed95);this[_0xda0c('0xb')][_0xda0c('0x31')](!![],this['handleCloseBox'][_0xda0c('0x11')](this));};EmailImap['prototype'][_0xda0c('0x10')]=function(){this['emit']('end');};EmailImap[_0xda0c('0x21')][_0xda0c('0x12')]=function(_0x2f971d,_0x3582e4){logger[_0xda0c('0x29')](_0xda0c('0x12'),this[_0xda0c('0x9')][_0xda0c('0x1f')],JSON['stringify'](_0x2f971d));var _0x1bc79c='';if(_0x2f971d){if(_0x2f971d[_0xda0c('0x32')]){_0x1bc79c=_0x2f971d[_0xda0c('0x32')];}else{for(var _0x3271b6 in _0x2f971d){if(_0x2f971d[_0xda0c('0x33')](_0x3271b6)){_0x1bc79c+=_[_0xda0c('0x34')](_0x3271b6)+':\x20'+_0x2f971d[_0x3271b6]+'\x0a';}}}}if(_0x3582e4){this[_0xda0c('0xb')][_0xda0c('0xf')]();}else{this[_0xda0c('0x23')]('error',_0x1bc79c);this[_0xda0c('0x23')](_0xda0c('0xf'));}};module[_0xda0c('0x35')]=EmailImap; \ No newline at end of file +var _0x423a=['getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','search','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleFetchMessage','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','path','util','lodash','randomstring','mailparser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','getAccount','imap','account','handleReady','bind','once','end','handleEnd','error','handleError','connect','authTimeout','service','authentication','user','password','host','port','tls'];(function(_0x1d2fbf,_0x574ed9){var _0x4738e9=function(_0x2bde75){while(--_0x2bde75){_0x1d2fbf['push'](_0x1d2fbf['shift']());}};_0x4738e9(++_0x574ed9);}(_0x423a,0x13c));var _0xa423=function(_0x566ea6,_0x1c451d){_0x566ea6=_0x566ea6-0x0;var _0x128b2b=_0x423a[_0x566ea6];return _0x128b2b;};'use strict';var fs=require('fs');var path=require(_0xa423('0x0'));var util=require(_0xa423('0x1'));var Imap=require('imap');var _=require(_0xa423('0x2'));var rs=require(_0xa423('0x3'));var simpleParser=require(_0xa423('0x4'))['simpleParser'];var Iconv=require(_0xa423('0x5'))[_0xa423('0x6')];var EventEmitter=require(_0xa423('0x7'))[_0xa423('0x8')];var utils=require('./utils');var logger=require(_0xa423('0x9'))(_0xa423('0xa'));function EmailImap(_0x4167fc,_0x382a84){this[_0xa423('0xb')]=_0xa423('0xc');this['account']=this[_0xa423('0xd')](_0x4167fc,_0x382a84);this[_0xa423('0xe')]=new Imap(this[_0xa423('0xf')]);this[_0xa423('0xe')]['once']('ready',this[_0xa423('0x10')][_0xa423('0x11')](this));this[_0xa423('0xe')][_0xa423('0x12')](_0xa423('0x13'),this[_0xa423('0x14')][_0xa423('0x11')](this));this[_0xa423('0xe')]['on'](_0xa423('0x15'),this[_0xa423('0x16')]['bind'](this));this['imap'][_0xa423('0x17')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xa423('0xd')]=function(_0x974eec,_0x23c45c){var _0x3f0335={'connTimeout':_0x974eec['connTimeout']?_0x974eec['connTimeout']*0x3e8:0x2710,'authTimeout':_0x974eec[_0xa423('0x18')]?_0x974eec[_0xa423('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x974eec[_0xa423('0x19')])){if(_0x974eec[_0xa423('0x1a')]){_0x3f0335[_0xa423('0x1b')]=_0x974eec['user'];_0x3f0335['password']=_0x974eec[_0xa423('0x1c')];}_0x3f0335[_0xa423('0x1d')]=_0x974eec[_0xa423('0x1d')];_0x3f0335[_0xa423('0x1e')]=_0x974eec['port']||0x3e1;if(_0x974eec[_0xa423('0x1f')]){_0x3f0335[_0xa423('0x1f')]=!![];}else{_0x3f0335[_0xa423('0x1f')]=![];_0x3f0335['autotls']='required';}}else{_0x3f0335['user']=_0x974eec['user'];_0x3f0335[_0xa423('0x1c')]=_0x974eec[_0xa423('0x1c')];_0x3f0335[_0xa423('0x1d')]=utils[_0xa423('0x20')](_0x974eec['service']);_0x3f0335[_0xa423('0x1e')]=0x3e1;_0x3f0335[_0xa423('0x1f')]=!![];}_0x3f0335[_0xa423('0xa')]=_0x23c45c||_0x974eec['user']||_0xa423('0x21');return _0x3f0335;};EmailImap[_0xa423('0x22')][_0xa423('0x10')]=function(){this[_0xa423('0xe')][_0xa423('0x23')](this['mailbox'],![],this['handleOpenBox'][_0xa423('0x11')](this));};EmailImap[_0xa423('0x22')][_0xa423('0x24')]=function(_0x32e31c,_0x15a2f4){if(_0x32e31c){this[_0xa423('0x16')](_0x32e31c,!![]);}else{this[_0xa423('0x25')](_0xa423('0x26'),_0x15a2f4);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x221676){if(_0x221676){this[_0xa423('0x16')](_0x221676,!![]);}else{this['imap'][_0xa423('0x13')]();}};EmailImap['prototype'][_0xa423('0x27')]=function(){this[_0xa423('0xe')][_0xa423('0x28')](['UNSEEN'],this['handleReadUnseen'][_0xa423('0x11')](this));};EmailImap[_0xa423('0x22')]['handleReadUnseen']=function(_0x5295bc,_0x2e4c51){if(_0x5295bc){this['handleError'](_0x5295bc,!![]);}else{if(_0x2e4c51[_0xa423('0x29')]){try{var _0x1d2ee3=this[_0xa423('0xe')][_0xa423('0x2a')](_0x2e4c51,{'bodies':'','markSeen':!![]});_0x1d2ee3['on'](_0xa423('0x2b'),this['handleFetchMessage'][_0xa423('0x11')](this));_0x1d2ee3[_0xa423('0x12')](_0xa423('0x15'),this[_0xa423('0x2c')][_0xa423('0x11')](this));_0x1d2ee3[_0xa423('0x12')](_0xa423('0x13'),this[_0xa423('0x2d')][_0xa423('0x11')](this));}catch(_0x176c0d){logger[_0xa423('0x15')](_0x176c0d);}}else{this['imap'][_0xa423('0x2e')](!![],this[_0xa423('0x2f')][_0xa423('0x11')](this));}}};EmailImap[_0xa423('0x22')][_0xa423('0x30')]=function(_0x5333df,_0x469a3b){_0x5333df['on']('body',this['handleMessageBody'][_0xa423('0x11')](this));_0x5333df[_0xa423('0x12')](_0xa423('0x31'),this[_0xa423('0x32')][_0xa423('0x11')](this));_0x5333df[_0xa423('0x12')]('end',this[_0xa423('0x33')][_0xa423('0x11')](this));};EmailImap[_0xa423('0x22')]['handleMessageBody']=function(_0xbbb231,_0x147ad5){simpleParser(_0xbbb231,{'Iconv':Iconv},this[_0xa423('0x34')]['bind'](this));};EmailImap[_0xa423('0x22')][_0xa423('0x32')]=function(_0xb5cc14){};EmailImap[_0xa423('0x22')][_0xa423('0x33')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x5a257c,_0x1cae7c){if(_0x5a257c){logger[_0xa423('0x15')](_0x5a257c);}else{var _0x5dc227=this;utils[_0xa423('0x35')](this[_0xa423('0xf')],_0x1cae7c,function(_0x255707){_0x5dc227['emit']('email',_0x255707);});}};EmailImap[_0xa423('0x22')][_0xa423('0x2d')]=function(){this[_0xa423('0xe')][_0xa423('0x2e')](!![],this[_0xa423('0x2f')][_0xa423('0x11')](this));};EmailImap[_0xa423('0x22')][_0xa423('0x2c')]=function(_0x3ef1bd){this[_0xa423('0x16')](_0x3ef1bd);this[_0xa423('0xe')][_0xa423('0x2e')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xa423('0x22')][_0xa423('0x14')]=function(){this['emit'](_0xa423('0x13'));};EmailImap[_0xa423('0x22')][_0xa423('0x16')]=function(_0x413d56,_0x4e2bf9){logger[_0xa423('0x15')](_0xa423('0x16'),this[_0xa423('0xf')][_0xa423('0xa')],JSON[_0xa423('0x36')](_0x413d56));var _0x24c4bc='';if(_0x413d56){if(_0x413d56[_0xa423('0x37')]){_0x24c4bc=_0x413d56[_0xa423('0x37')];}else{for(var _0x44cd23 in _0x413d56){if(_0x413d56['hasOwnProperty'](_0x44cd23)){_0x24c4bc+=_[_0xa423('0x38')](_0x44cd23)+':\x20'+_0x413d56[_0x44cd23]+'\x0a';}}}}if(_0x4e2bf9){this[_0xa423('0xe')]['end']();}else{this[_0xa423('0x25')](_0xa423('0x15'),_0x24c4bc);this[_0xa423('0x25')](_0xa423('0x13'));}};module[_0xa423('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 47e5108..9b6ab7a 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 _0xca2b=['prototype','send','createTransport','compile','sendMail','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64'];(function(_0x55634e,_0x492076){var _0x55175e=function(_0x1b3867){while(--_0x1b3867){_0x55634e['push'](_0x55634e['shift']());}};_0x55175e(++_0x492076);}(_0xca2b,0xf9));var _0xbca2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xca2b[_0x21a9d9];return _0x46adce;};'use strict';var nodemailer=require(_0xbca2('0x0'));var BPromise=require(_0xbca2('0x1'));var inlineBase64=require(_0xbca2('0x2'));function EmailSmtp(){}EmailSmtp[_0xbca2('0x3')][_0xbca2('0x4')]=function(_0x32fa89,_0x2baecf){return new BPromise(function(_0x432671,_0x305036){var _0x58faca=nodemailer[_0xbca2('0x5')](_0x32fa89);_0x58faca['use'](_0xbca2('0x6'),inlineBase64());_0x58faca[_0xbca2('0x7')](_0x2baecf,function(_0x406b07,_0x4ca28d){if(_0x406b07){_0x305036(_0x406b07['toString']());}else{_0x432671(_0x4ca28d);}});});};EmailSmtp[_0xbca2('0x3')]['verify']=function(_0x147b65){return new BPromise(function(_0x59d54f,_0x2bb042){var _0xfd9368=nodemailer[_0xbca2('0x5')](_0x147b65);_0xfd9368['verify'](function(_0x3d1c53,_0x10ab7c){if(_0x3d1c53){_0x2bb042(_0x3d1c53['toString']());}else{if(_0x10ab7c){_0x59d54f(_0x10ab7c);}else{_0x2bb042('Not\x20verifired');}}});});};module[_0xbca2('0x8')]=EmailSmtp; \ No newline at end of file +var _0x699a=['verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','toString'];(function(_0x5be926,_0x47be35){var _0x1a8030=function(_0x2f669d){while(--_0x2f669d){_0x5be926['push'](_0x5be926['shift']());}};_0x1a8030(++_0x47be35);}(_0x699a,0x12c));var _0xa699=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x699a[_0xf0bc07];return _0x1c50c2;};'use strict';var nodemailer=require(_0xa699('0x0'));var BPromise=require(_0xa699('0x1'));var inlineBase64=require(_0xa699('0x2'));function EmailSmtp(){}EmailSmtp[_0xa699('0x3')]['send']=function(_0x3a9e8f,_0x524a16){return new BPromise(function(_0x27cf5e,_0x5917de){var _0x4b442f=nodemailer[_0xa699('0x4')](_0x3a9e8f);_0x4b442f[_0xa699('0x5')](_0xa699('0x6'),inlineBase64());_0x4b442f['sendMail'](_0x524a16,function(_0x324ced,_0x5e071e){if(_0x324ced){_0x5917de(_0x324ced[_0xa699('0x7')]());}else{_0x27cf5e(_0x5e071e);}});});};EmailSmtp[_0xa699('0x3')][_0xa699('0x8')]=function(_0x49db52){return new BPromise(function(_0x46092c,_0x590ae4){var _0x158bc2=nodemailer[_0xa699('0x4')](_0x49db52);_0x158bc2[_0xa699('0x8')](function(_0x33a2e6,_0x430d6e){if(_0x33a2e6){_0x590ae4(_0x33a2e6['toString']());}else{if(_0x430d6e){_0x46092c(_0x430d6e);}else{_0x590ae4(_0xa699('0x9'));}}});});};module[_0xa699('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 0e097ce..2ec336d 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 _0x4a1d=['Anonymous','split','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','length','join'];(function(_0x43b92f,_0x41371f){var _0x23cb82=function(_0x241f22){while(--_0x241f22){_0x43b92f['push'](_0x43b92f['shift']());}};_0x23cb82(++_0x41371f);}(_0x4a1d,0x144));var _0xd4a1=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x4a1d[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xd4a1('0x0'));var moment=require(_0xd4a1('0x1'));var random=require(_0xd4a1('0x2'));var fs=require('fs');var path=require(_0xd4a1('0x3'));var util=require(_0xd4a1('0x4'));var tnef=require('node-tnef');var logger=require(_0xd4a1('0x5'))('email');var config=require(_0xd4a1('0x6'));function getAddress(_0x5b6a53){var _0x142d41=_[_0xd4a1('0x7')](_0x5b6a53[_0xd4a1('0x8')]);return _0x142d41&&_0x142d41[_0xd4a1('0x9')]?_0x142d41['address']:_0xd4a1('0xa')+random[_0xd4a1('0xb')](0x6)+_0xd4a1('0xc');}function getFirstName(_0x429c06){var _0x1a88e3=_['head'](_0x429c06[_0xd4a1('0x8')]);if(_0x1a88e3&&_0x1a88e3[_0xd4a1('0xd')]){var _0x530b23=_0x1a88e3[_0xd4a1('0xd')]['split'](/\s+/);return _0x530b23[_0xd4a1('0xe')]?_0x530b23['slice'](0x0,-0x1)[_0xd4a1('0xf')]('\x20'):_0x1a88e3['name'];}return _0xd4a1('0x10');}function getLastName(_0x13a6d7){var _0x28c87d=_[_0xd4a1('0x7')](_0x13a6d7[_0xd4a1('0x8')]);if(_0x28c87d&&_0x28c87d[_0xd4a1('0xd')]){var _0x1a4795=_0x28c87d[_0xd4a1('0xd')][_0xd4a1('0x11')](/\s+/);return _0x1a4795[_0xd4a1('0xe')]>0x1?_0x1a4795['pop']():'';}return'';}function getMails(_0x3c9976,_0x18b268){var _0x227d92='';for(var _0x285714=0x0;_0x285714<_0x18b268[_0xd4a1('0x8')]['length'];_0x285714+=0x1){if(_0x18b268[_0xd4a1('0x8')][_0x285714][_0xd4a1('0x9')]!==_0x3c9976){if(!_['isEmpty'](_0x227d92)){_0x227d92+=',';}_0x227d92+=_0x18b268[_0xd4a1('0x8')][_0x285714][_0xd4a1('0xd')]||_0x18b268['value'][_0x285714][_0xd4a1('0x9')]||'';_0x227d92+='\x20<';_0x227d92+=_0x18b268[_0xd4a1('0x8')][_0x285714]['address']?_0x18b268[_0xd4a1('0x8')][_0x285714][_0xd4a1('0x9')]:_0xd4a1('0xa')+random[_0xd4a1('0xb')](0x6)+_0xd4a1('0xc');_0x227d92+='>';}}return _0x227d92;}function parseEmail(_0x30b1dc,_0x12b44c,_0x3a562d){if(_0x12b44c[_0xd4a1('0x12')]){var _0x294fbe=/)<[^<]*)*<\/script>/gi;while(_0x294fbe[_0xd4a1('0x13')](_0x12b44c['html'])){_0x12b44c[_0xd4a1('0x12')]=_0x12b44c[_0xd4a1('0x12')][_0xd4a1('0x14')](_0x294fbe,'');}if(_0x12b44c[_0xd4a1('0x12')][_0xd4a1('0x15')](_0xd4a1('0x16'))){var _0x1d23d4=[];_0x12b44c[_0xd4a1('0x17')][_0xd4a1('0x18')](_0x4e0592=>{_0x1d23d4[_0xd4a1('0x19')](_0x4e0592[_0xd4a1('0x1a')]);});var _0xdc1f73=/]+>/g;var _0x14cc22=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x43ce10=_0x12b44c['html'][_0xd4a1('0x14')](_0x14cc22,_0xd4a1('0x1b'));var _0x4a6830=_0x43ce10[_0xd4a1('0x14')](_0xdc1f73,'_IMG');for(let _0x3b5468=0x0;_0x3b5468<_0x1d23d4[_0xd4a1('0xe')];_0x3b5468++){var _0x11accf=_0x4a6830[_0xd4a1('0x14')](_0xd4a1('0x1c'),_0xd4a1('0x1d')+_0x1d23d4[_0x3b5468]+_0xd4a1('0x1e'));_0x4a6830=_0x11accf;}_0x12b44c[_0xd4a1('0x12')]=_0x4a6830;}_0x3a562d[_0xd4a1('0x1f')]=_0x12b44c[_0xd4a1('0x12')];}else{_0x3a562d[_0xd4a1('0x1f')]=_0x12b44c[_0xd4a1('0x20')];}if(_0x3a562d[_0xd4a1('0x1f')]){_0x3a562d['body']=_0x3a562d[_0xd4a1('0x1f')][_0xd4a1('0x14')](/Empty\x20message

';if(_0x5112a5['Attachments']){for(var _0x3bcd29=0x0;_0x3bcd29<_0x5112a5[_0xd4a1('0x3b')][_0xd4a1('0xe')];_0x3bcd29++){var _0x29a38b=_0x5112a5[_0xd4a1('0x3b')][_0x3bcd29];_0x4b2c6c[_0xd4a1('0x22')][_0xd4a1('0x17')]['push']({'filename':_0x29a38b['Title'],'content':new Buffer(_0x29a38b['Data'])});}}}_0x3d8ed4(parseEmail(_0x34a7e7,_0x5e7192,_0x4b2c6c));});}else{_0x5e7192[_0xd4a1('0x12')]=_0xd4a1('0x3c');_0x3d8ed4(parseEmail(_0x34a7e7,_0x5e7192,_0x4b2c6c));}}else{_0x3d8ed4(parseEmail(_0x34a7e7,_0x5e7192,_0x4b2c6c));}};exports[_0xd4a1('0x3d')]=function(_0x1a0e20){switch(_0x1a0e20){case _0xd4a1('0x3e'):return _0xd4a1('0x3f');case'yahoo':return _0xd4a1('0x40');case'hotmail':return _0xd4a1('0x41');case _0xd4a1('0x42'):return'outlook.office365.com';}return _0xd4a1('0x43');}; \ No newline at end of file +var _0x1170=['from','subject','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','hotmail','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','split','length','join','html','test','replace','','body','0x1?_0x5c36bd['pop']():'';}return'';}function getMails(_0x508bc6,_0x3acf60){var _0x3a4193='';for(var _0x571fc9=0x0;_0x571fc9<_0x3acf60[_0x0117('0x8')][_0x0117('0xf')];_0x571fc9+=0x1){if(_0x3acf60[_0x0117('0x8')][_0x571fc9][_0x0117('0x9')]!==_0x508bc6){if(!_['isEmpty'](_0x3a4193)){_0x3a4193+=',';}_0x3a4193+=_0x3acf60['value'][_0x571fc9]['name']||_0x3acf60[_0x0117('0x8')][_0x571fc9][_0x0117('0x9')]||'';_0x3a4193+='\x20<';_0x3a4193+=_0x3acf60[_0x0117('0x8')][_0x571fc9][_0x0117('0x9')]?_0x3acf60[_0x0117('0x8')][_0x571fc9]['address']:_0x0117('0xa')+random[_0x0117('0xb')](0x6)+_0x0117('0xc');_0x3a4193+='>';}}return _0x3a4193;}function parseEmail(_0x4206bc,_0x3c1269,_0x27218a){if(_0x3c1269[_0x0117('0x11')]){var _0xfeb204=/)<[^<]*)*<\/script>/gi;while(_0xfeb204[_0x0117('0x12')](_0x3c1269[_0x0117('0x11')])){_0x3c1269[_0x0117('0x11')]=_0x3c1269[_0x0117('0x11')][_0x0117('0x13')](_0xfeb204,'');}if(_0x3c1269[_0x0117('0x11')]['includes'](_0x0117('0x14'))){var _0x5b680a=[];_0x3c1269[_0x0117('0x15')][_0x0117('0x16')](_0x59af73=>{_0x5b680a[_0x0117('0x17')](_0x59af73[_0x0117('0x18')]);});var _0x18aaca=/]+>/g;var _0x376b84=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x3706b6=_0x3c1269[_0x0117('0x11')][_0x0117('0x13')](_0x376b84,_0x0117('0x19'));var _0x16a49d=_0x3706b6[_0x0117('0x13')](_0x18aaca,_0x0117('0x1a'));for(let _0x163b2e=0x0;_0x163b2e<_0x5b680a['length'];_0x163b2e++){var _0x58d3b0=_0x16a49d['replace'](_0x0117('0x1a'),'\x20[Attachment:\x20'+_0x5b680a[_0x163b2e]+_0x0117('0x1b'));_0x16a49d=_0x58d3b0;}_0x3c1269[_0x0117('0x11')]=_0x16a49d;}_0x27218a[_0x0117('0x1c')]=_0x3c1269['html'];}else{_0x27218a[_0x0117('0x1c')]=_0x3c1269['textAsHtml'];}if(_0x27218a[_0x0117('0x1c')]){_0x27218a[_0x0117('0x1c')]=_0x27218a[_0x0117('0x1c')][_0x0117('0x13')](/0x0){if(this[_0x15344b+'Capacity']>0x0&&this[_0x15344b+_0x6151('0x2b')]>=this[_0x15344b+_0x6151('0x2c')]){return'maxcapacity';}else{return _0x6151('0x2d');}}else{return _0x6151('0x2e');}};Agent[_0x6151('0x29')]['updateRealtime']=function(){var _0x45a3c1=[_0x6151('0x2f'),'chat',_0x6151('0x30'),_0x6151('0x31'),_0x6151('0x32'),_0x6151('0x33')];for(var _0x550b3b=0x0;_0x550b3b<_0x45a3c1[_0x6151('0x34')];_0x550b3b+=0x1){var _0x3e1739=this[_0x6151('0x2a')](_0x45a3c1[_0x550b3b]);if(this[_0x45a3c1[_0x550b3b]+_0x6151('0x35')]!==_0x3e1739){this[_0x45a3c1[_0x550b3b]+'StatusTime']=_[_0x6151('0x36')](moment()[_0x6151('0x37')]('x'));}this[_0x45a3c1[_0x550b3b]+_0x6151('0x35')]=_0x3e1739;}var _0x516972={'id':this['id'],'name':this[_0x6151('0x7')],'online':this[_0x6151('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x6151('0xa')],'mailPause':this[_0x6151('0xb')],'smsPause':this[_0x6151('0xd')],'faxPause':this[_0x6151('0xc')],'openchannelPause':this[_0x6151('0xe')],'chatStatus':this[_0x6151('0xf')],'chatStatusTime':this[_0x6151('0x11')],'chatCapacity':this[_0x6151('0x12')],'chatCurrentCapacity':this[_0x6151('0x38')],'mailStatus':this[_0x6151('0x13')],'mailStatusTime':this[_0x6151('0x14')],'mailCapacity':this[_0x6151('0x15')],'mailCurrentCapacity':this[_0x6151('0x16')],'faxStatus':this[_0x6151('0x17')],'faxStatusTime':this[_0x6151('0x39')],'faxCapacity':this[_0x6151('0x18')],'faxCurrentCapacity':this[_0x6151('0x19')],'smsStatus':this[_0x6151('0x1a')],'smsStatusTime':this[_0x6151('0x1b')],'smsCapacity':this[_0x6151('0x1c')],'smsCurrentCapacity':this[_0x6151('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x6151('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x6151('0x21')],'openchannelStatus':this[_0x6151('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x6151('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x6151('0x26')],'busyQueue':this[_0x6151('0x27')]};var _0x14dc38=md5(JSON[_0x6151('0x3a')](_0x516972));if(this['md5']!==_0x14dc38){this[_0x6151('0x2')]=_0x14dc38;io[_0x6151('0x3b')](_0x6151('0x3c'),_0x516972);}};module['exports']=Agent; \ No newline at end of file +var _0x6e6c=['busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','chat','openchannel','fax','sms','Status','StatusTime','toNumber','format','chatCurrentCapacity','smsCurrentCapacity','md5','emit','lodash','moment','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xc6e6('0x0'));var moment=require(_0xc6e6('0x1'));var md5=require('md5');var Redis=require(_0xc6e6('0x2'));var config=require(_0xc6e6('0x3'));config['redis']=_['defaults'](config[_0xc6e6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc6e6('0x5'))(new Redis(config['redis']));function Agent(_0xe59212){this['id']=_0xe59212['id']||0x0;this[_0xc6e6('0x6')]=_0xe59212['name']||'';this[_0xc6e6('0x7')]=_0xe59212[_0xc6e6('0x7')]||!![];this['voicePause']=_0xe59212[_0xc6e6('0x8')]||![];this[_0xc6e6('0x9')]=_0xe59212['chatPause']||![];this[_0xc6e6('0xa')]=_0xe59212['mailPause']||![];this[_0xc6e6('0xb')]=_0xe59212[_0xc6e6('0xb')]||![];this[_0xc6e6('0xc')]=_0xe59212[_0xc6e6('0xc')]||![];this[_0xc6e6('0xd')]=_0xe59212[_0xc6e6('0xd')]||![];this[_0xc6e6('0xe')]=_0xc6e6('0xf');this[_0xc6e6('0x10')]=0x0;this['chatCapacity']=_0xe59212[_0xc6e6('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xc6e6('0x12')]=_0xc6e6('0xf');this[_0xc6e6('0x13')]=0x0;this[_0xc6e6('0x14')]=_0xe59212['mailCapacity']||0x0;this[_0xc6e6('0x15')]=0x0;this[_0xc6e6('0x16')]=_0xc6e6('0xf');this[_0xc6e6('0x17')]=0x0;this[_0xc6e6('0x18')]=_0xe59212['faxCapacity']||0x0;this[_0xc6e6('0x19')]=0x0;this[_0xc6e6('0x1a')]='unknown';this[_0xc6e6('0x1b')]=0x0;this[_0xc6e6('0x1c')]=_0xe59212[_0xc6e6('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this[_0xc6e6('0x1d')]=0x0;this['whatsappCapacity']=_0xe59212[_0xc6e6('0x1e')]||0x0;this[_0xc6e6('0x1f')]=0x0;this[_0xc6e6('0x20')]=_0xc6e6('0xf');this[_0xc6e6('0x21')]=0x0;this[_0xc6e6('0x22')]=_0xe59212[_0xc6e6('0x22')]||0x0;this[_0xc6e6('0x23')]=0x0;this[_0xc6e6('0x24')]=![];this[_0xc6e6('0x25')]=undefined;this['md5']='';this[_0xc6e6('0x26')]();}Agent['prototype'][_0xc6e6('0x27')]=function(_0x1667b8){if(this[_0x1667b8+_0xc6e6('0x28')]>0x0){if(this[_0x1667b8+_0xc6e6('0x29')]>0x0&&this[_0x1667b8+'CurrentCapacity']>=this[_0x1667b8+_0xc6e6('0x29')]){return _0xc6e6('0x2a');}else{return _0xc6e6('0x2b');}}else{return _0xc6e6('0x2c');}};Agent[_0xc6e6('0x2d')]['updateRealtime']=function(){var _0x41fe96=['mail',_0xc6e6('0x2e'),_0xc6e6('0x2f'),_0xc6e6('0x30'),_0xc6e6('0x31'),'whatsapp'];for(var _0x3ff8a4=0x0;_0x3ff8a4<_0x41fe96['length'];_0x3ff8a4+=0x1){var _0x28577b=this['getChannelStatus'](_0x41fe96[_0x3ff8a4]);if(this[_0x41fe96[_0x3ff8a4]+_0xc6e6('0x32')]!==_0x28577b){this[_0x41fe96[_0x3ff8a4]+_0xc6e6('0x33')]=_[_0xc6e6('0x34')](moment()[_0xc6e6('0x35')]('x'));}this[_0x41fe96[_0x3ff8a4]+_0xc6e6('0x32')]=_0x28577b;}var _0x5e34f6={'id':this['id'],'name':this[_0xc6e6('0x6')],'online':this[_0xc6e6('0x7')],'voicePause':this[_0xc6e6('0x8')],'chatPause':this[_0xc6e6('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0xc6e6('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0xc6e6('0xd')],'chatStatus':this[_0xc6e6('0xe')],'chatStatusTime':this[_0xc6e6('0x10')],'chatCapacity':this[_0xc6e6('0x11')],'chatCurrentCapacity':this[_0xc6e6('0x36')],'mailStatus':this[_0xc6e6('0x12')],'mailStatusTime':this[_0xc6e6('0x13')],'mailCapacity':this[_0xc6e6('0x14')],'mailCurrentCapacity':this[_0xc6e6('0x15')],'faxStatus':this[_0xc6e6('0x16')],'faxStatusTime':this[_0xc6e6('0x17')],'faxCapacity':this[_0xc6e6('0x18')],'faxCurrentCapacity':this[_0xc6e6('0x19')],'smsStatus':this[_0xc6e6('0x1a')],'smsStatusTime':this[_0xc6e6('0x1b')],'smsCapacity':this[_0xc6e6('0x1c')],'smsCurrentCapacity':this[_0xc6e6('0x37')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xc6e6('0x1d')],'whatsappCapacity':this[_0xc6e6('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xc6e6('0x21')],'openchannelCapacity':this[_0xc6e6('0x22')],'openchannelCurrentCapacity':this[_0xc6e6('0x23')],'busy':this[_0xc6e6('0x24')],'busyQueue':this[_0xc6e6('0x25')]};var _0x243cea=md5(JSON['stringify'](_0x5e34f6));if(this[_0xc6e6('0x38')]!==_0x243cea){this[_0xc6e6('0x38')]=_0x243cea;io[_0xc6e6('0x39')]('user:save',_0x5e34f6);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index e32136a..02c1749 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 _0xb755=['mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','chatPause','available','chat:queue:%s','emit','chat_queue:save','exports','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x28bb8b,_0x2a37b0){var _0x26a18b=function(_0x23c52b){while(--_0x23c52b){_0x28bb8b['push'](_0x28bb8b['shift']());}};_0x26a18b(++_0x2a37b0);}(_0xb755,0xb9));var _0x5b75=function(_0x49a55a,_0x5a8aac){_0x49a55a=_0x49a55a-0x0;var _0xc34894=_0xb755[_0x49a55a];return _0xc34894;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x5b75('0x0'));var Redis=require(_0x5b75('0x1'));var config=require(_0x5b75('0x2'));config[_0x5b75('0x3')]=_['defaults'](config[_0x5b75('0x3')],{'host':_0x5b75('0x4'),'port':0x18eb});var io=require(_0x5b75('0x5'))(new Redis(config[_0x5b75('0x3')]));function ChatQueue(_0x2b34d7){this['id']=_0x2b34d7['id']||0x0;this['name']=_0x2b34d7[_0x5b75('0x6')]||'';this[_0x5b75('0x7')]=_0x2b34d7[_0x5b75('0x7')]||0xa;this['strategy']=_0x2b34d7[_0x5b75('0x8')]||_0x5b75('0x9');this[_0x5b75('0xa')]=_0x2b34d7['Agents'];this[_0x5b75('0xb')]={};this[_0x5b75('0xc')]=0x0;this[_0x5b75('0xd')]='';this['updateRouting']();this[_0x5b75('0xe')]();}ChatQueue[_0x5b75('0xf')][_0x5b75('0x10')]=function(){var _0x4ea6a8=this[_0x5b75('0xb')][_0x5b75('0x11')];this['mapAgentsId']=_['map'](this[_0x5b75('0xa')],'id');this[_0x5b75('0xb')][_0x5b75('0x11')]=_0x4ea6a8;};ChatQueue[_0x5b75('0xf')][_0x5b75('0xe')]=function(){this[_0x5b75('0x12')]=0x0;this[_0x5b75('0x13')]=0x0;for(var _0x48851d=0x0;_0x48851d=0x0?this['available']:0x0;var _0x3f24ec={'id':this['id'],'available':this[_0x5b75('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x5b75('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x1e309f=md5(JSON['stringify'](_0x3f24ec));if(this[_0x5b75('0xd')]!==_0x1e309f){this[_0x5b75('0xd')]=_0x1e309f;io['to'](util['format'](_0x5b75('0x18'),_0x3f24ec[_0x5b75('0x6')]))[_0x5b75('0x19')](_0x5b75('0x1a'),_0x3f24ec);}};module[_0x5b75('0x1b')]=ChatQueue; \ No newline at end of file +var _0x0a45=['redis','defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','emit','chat_queue:save','md5','ioredis','../../../config/environment'];(function(_0x185241,_0x453cd6){var _0x1fa6c3=function(_0x1b1d26){while(--_0x1b1d26){_0x185241['push'](_0x185241['shift']());}};_0x1fa6c3(++_0x453cd6);}(_0x0a45,0x19d));var _0x50a4=function(_0x31677d,_0x36a3a1){_0x31677d=_0x31677d-0x0;var _0x16957b=_0x0a45[_0x31677d];return _0x16957b;};'use strict';var _=require('lodash');var md5=require(_0x50a4('0x0'));var util=require('util');var Redis=require(_0x50a4('0x1'));var config=require(_0x50a4('0x2'));config[_0x50a4('0x3')]=_[_0x50a4('0x4')](config[_0x50a4('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x1491b6){this['id']=_0x1491b6['id']||0x0;this[_0x50a4('0x5')]=_0x1491b6[_0x50a4('0x5')]||'';this[_0x50a4('0x6')]=_0x1491b6[_0x50a4('0x6')]||0xa;this[_0x50a4('0x7')]=_0x1491b6[_0x50a4('0x7')]||'beepall';this[_0x50a4('0x8')]=_0x1491b6[_0x50a4('0x8')];this[_0x50a4('0x9')]={};this[_0x50a4('0xa')]=0x0;this[_0x50a4('0x0')]='';this[_0x50a4('0xb')]();this[_0x50a4('0xc')]();}ChatQueue[_0x50a4('0xd')][_0x50a4('0xb')]=function(){var _0x5d4e7e=this['mapAgentsId'][_0x50a4('0xe')];this['mapAgentsId']=_[_0x50a4('0xf')](this[_0x50a4('0x8')],'id');this['mapAgentsId']['_rr']=_0x5d4e7e;};ChatQueue[_0x50a4('0xd')][_0x50a4('0xc')]=function(){this[_0x50a4('0x10')]=0x0;this[_0x50a4('0x11')]=0x0;for(var _0x552207=0x0;_0x552207=0x0?this[_0x50a4('0x14')]:0x0;var _0x5810d9={'id':this['id'],'available':this[_0x50a4('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x50a4('0x5')],'paused':this[_0x50a4('0x11')],'waiting':this[_0x50a4('0xa')]};var _0x328b01=md5(JSON[_0x50a4('0x15')](_0x5810d9));if(this['md5']!==_0x328b01){this[_0x50a4('0x0')]=_0x328b01;io['to'](util[_0x50a4('0x16')](_0x50a4('0x17'),_0x5810d9[_0x50a4('0x5')]))[_0x50a4('0x18')](_0x50a4('0x19'),_0x5810d9);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 42b5a21..635c6d8 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(_0x3cf6b9,_0xe9efe8){var _0xaf2af2=function(_0x83dfc7){while(--_0x83dfc7){_0x3cf6b9['push'](_0x3cf6b9['shift']());}};_0xaf2af2(++_0xe9efe8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x562e20,_0x4d242b){var _0x3ac1f7=function(_0x344367){while(--_0x344367){_0x562e20['push'](_0x562e20['shift']());}};_0x3ac1f7(++_0x4d242b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 b9a1620..75417e1 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 _0x6c33=['name','Intervals'];(function(_0x11542c,_0x48cdf3){var _0x12286f=function(_0x476cea){while(--_0x476cea){_0x11542c['push'](_0x11542c['shift']());}};_0x12286f(++_0x48cdf3);}(_0x6c33,0x82));var _0x36c3=function(_0x570b34,_0x537c5c){_0x570b34=_0x570b34-0x0;var _0x325f61=_0x6c33[_0x570b34];return _0x325f61;};'use strict';function Interval(_0x124ed3){this['id']=_0x124ed3['id']||0x0;this[_0x36c3('0x0')]=_0x124ed3[_0x36c3('0x0')]||'';this[_0x36c3('0x1')]=_0x124ed3[_0x36c3('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x68bf=['Intervals'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x68bf,0x71));var _0xf68b=function(_0x47d8ec,_0x1f491f){_0x47d8ec=_0x47d8ec-0x0;var _0x29adde=_0x68bf[_0x47d8ec];return _0x29adde;};'use strict';function Interval(_0x47039e){this['id']=_0x47039e['id']||0x0;this['name']=_0x47039e['name']||'';this['Intervals']=_0x47039e[_0xf68b('0x0')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 00e9b0c..e2c6e27 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 _0x73b3=['redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x225ce3,_0x5149fe){var _0x38c5be=function(_0x50e6d0){while(--_0x50e6d0){_0x225ce3['push'](_0x225ce3['shift']());}};_0x38c5be(++_0x5149fe);}(_0x73b3,0x1ab));var _0x373b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x73b3[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x373b('0x0'));var md5=require(_0x373b('0x1'));var util=require(_0x373b('0x2'));var Redis=require(_0x373b('0x3'));var config=require(_0x373b('0x4'));config[_0x373b('0x5')]=_[_0x373b('0x6')](config[_0x373b('0x5')],{'host':_0x373b('0x7'),'port':0x18eb});var io=require(_0x373b('0x8'))(new Redis(config[_0x373b('0x5')]));function MailQueue(_0x58481f){this['id']=_0x58481f['id']||0x0;this[_0x373b('0x9')]=_0x58481f['name']||'';this[_0x373b('0xa')]=_0x58481f['timeout']||0xa;this['strategy']=_0x58481f['strategy']||_0x373b('0xb');this[_0x373b('0xc')]=_0x58481f[_0x373b('0xc')];this[_0x373b('0xd')]={};this[_0x373b('0xe')]=0x0;this[_0x373b('0x1')]='';this[_0x373b('0xf')]();this[_0x373b('0x10')]();}MailQueue[_0x373b('0x11')]['updateRouting']=function(){var _0x5936bd=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x373b('0x12')](this[_0x373b('0xc')],'id');this[_0x373b('0xd')]['_rr']=_0x5936bd;};MailQueue[_0x373b('0x11')]['updateRealtime']=function(){this[_0x373b('0x13')]=0x0;this[_0x373b('0x14')]=0x0;for(var _0x2efc8c=0x0;_0x2efc8c=0x0?this[_0x373b('0x16')]:0x0;var _0x47dfda={'id':this['id'],'available':this[_0x373b('0x16')],'loggedIn':this[_0x373b('0x13')],'name':this[_0x373b('0x9')],'paused':this[_0x373b('0x14')],'waiting':this[_0x373b('0xe')]};var _0x268714=md5(JSON['stringify'](_0x47dfda));if(this[_0x373b('0x1')]!==_0x268714){this[_0x373b('0x1')]=_0x268714;io['to'](util[_0x373b('0x17')](_0x373b('0x18'),_0x47dfda[_0x373b('0x9')]))[_0x373b('0x19')](_0x373b('0x1a'),_0x47dfda);}};module['exports']=MailQueue; \ No newline at end of file +var _0x07a5=['updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','../../../config/environment','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x80889a,_0x1e4616){var _0xb1f419=function(_0xf52021){while(--_0xf52021){_0x80889a['push'](_0x80889a['shift']());}};_0xb1f419(++_0x1e4616);}(_0x07a5,0x96));var _0x507a=function(_0xe56790,_0x5f304d){_0xe56790=_0xe56790-0x0;var _0x145cf7=_0x07a5[_0xe56790];return _0x145cf7;};'use strict';var _=require('lodash');var md5=require(_0x507a('0x0'));var util=require(_0x507a('0x1'));var Redis=require('ioredis');var config=require(_0x507a('0x2'));config['redis']=_[_0x507a('0x3')](config['redis'],{'host':_0x507a('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0xdbda09){this['id']=_0xdbda09['id']||0x0;this[_0x507a('0x5')]=_0xdbda09[_0x507a('0x5')]||'';this[_0x507a('0x6')]=_0xdbda09[_0x507a('0x6')]||0xa;this[_0x507a('0x7')]=_0xdbda09[_0x507a('0x7')]||_0x507a('0x8');this[_0x507a('0x9')]=_0xdbda09[_0x507a('0x9')];this[_0x507a('0xa')]={};this[_0x507a('0xb')]=0x0;this['md5']='';this[_0x507a('0xc')]();this[_0x507a('0xd')]();}MailQueue[_0x507a('0xe')][_0x507a('0xc')]=function(){var _0x3347d2=this[_0x507a('0xa')]['_rr'];this[_0x507a('0xa')]=_[_0x507a('0xf')](this[_0x507a('0x9')],'id');this[_0x507a('0xa')]['_rr']=_0x3347d2;};MailQueue[_0x507a('0xe')][_0x507a('0xd')]=function(){this[_0x507a('0x10')]=0x0;this[_0x507a('0x11')]=0x0;for(var _0x4e8135=0x0;_0x4e8135=0x0?this[_0x507a('0x14')]:0x0;var _0x209f6d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x507a('0x10')],'name':this[_0x507a('0x5')],'paused':this[_0x507a('0x11')],'waiting':this[_0x507a('0xb')]};var _0x1b302c=md5(JSON[_0x507a('0x15')](_0x209f6d));if(this[_0x507a('0x0')]!==_0x1b302c){this[_0x507a('0x0')]=_0x1b302c;io['to'](util[_0x507a('0x16')](_0x507a('0x17'),_0x209f6d[_0x507a('0x5')]))[_0x507a('0x18')](_0x507a('0x19'),_0x209f6d);}};module[_0x507a('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5df203d..0cc9c23 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 _0xd759=['ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','openchannelPause','available','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util'];(function(_0xa5e358,_0x183f1b){var _0x29466b=function(_0x265a94){while(--_0x265a94){_0xa5e358['push'](_0xa5e358['shift']());}};_0x29466b(++_0x183f1b);}(_0xd759,0x71));var _0x9d75=function(_0x19c71e,_0x513c5b){_0x19c71e=_0x19c71e-0x0;var _0xf7df9b=_0xd759[_0x19c71e];return _0xf7df9b;};'use strict';var _=require(_0x9d75('0x0'));var md5=require(_0x9d75('0x1'));var util=require(_0x9d75('0x2'));var Redis=require(_0x9d75('0x3'));var config=require(_0x9d75('0x4'));config['redis']=_[_0x9d75('0x5')](config[_0x9d75('0x6')],{'host':_0x9d75('0x7'),'port':0x18eb});var io=require(_0x9d75('0x8'))(new Redis(config['redis']));function OpenchannelQueue(_0xa1373){this['id']=_0xa1373['id']||0x0;this[_0x9d75('0x9')]=_0xa1373['name']||'';this[_0x9d75('0xa')]=_0xa1373[_0x9d75('0xa')]||0xa;this[_0x9d75('0xb')]=_0xa1373['strategy']||_0x9d75('0xc');this[_0x9d75('0xd')]=_0xa1373[_0x9d75('0xd')];this[_0x9d75('0xe')]={};this[_0x9d75('0xf')]=0x0;this[_0x9d75('0x1')]='';this[_0x9d75('0x10')]();this[_0x9d75('0x11')]();}OpenchannelQueue[_0x9d75('0x12')][_0x9d75('0x10')]=function(){var _0x58680a=this[_0x9d75('0xe')][_0x9d75('0x13')];this[_0x9d75('0xe')]=_['map'](this[_0x9d75('0xd')],'id');this[_0x9d75('0xe')][_0x9d75('0x13')]=_0x58680a;};OpenchannelQueue[_0x9d75('0x12')]['updateRealtime']=function(){this[_0x9d75('0x14')]=0x0;this[_0x9d75('0x15')]=0x0;for(var _0x28c470=0x0;_0x28c470=0x0?this[_0x9d75('0x18')]:0x0;var _0x35f410={'id':this['id'],'available':this[_0x9d75('0x18')],'loggedIn':this[_0x9d75('0x14')],'name':this[_0x9d75('0x9')],'paused':this[_0x9d75('0x15')],'waiting':this[_0x9d75('0xf')]};var _0xe234b4=md5(JSON['stringify'](_0x35f410));if(this[_0x9d75('0x1')]!==_0xe234b4){this[_0x9d75('0x1')]=_0xe234b4;io['to'](util['format'](_0x9d75('0x19'),_0x35f410[_0x9d75('0x9')]))[_0x9d75('0x1a')](_0x9d75('0x1b'),_0x35f410);}};module[_0x9d75('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x23ec=['waiting','stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','length','online','available'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x23ec,0x16d));var _0xc23e=function(_0x27b913,_0x55d90e){_0x27b913=_0x27b913-0x0;var _0x4b36de=_0x23ec[_0x27b913];return _0x4b36de;};'use strict';var _=require(_0xc23e('0x0'));var md5=require(_0xc23e('0x1'));var util=require(_0xc23e('0x2'));var Redis=require(_0xc23e('0x3'));var config=require(_0xc23e('0x4'));config['redis']=_[_0xc23e('0x5')](config[_0xc23e('0x6')],{'host':_0xc23e('0x7'),'port':0x18eb});var io=require(_0xc23e('0x8'))(new Redis(config[_0xc23e('0x6')]));function OpenchannelQueue(_0x34a7c6){this['id']=_0x34a7c6['id']||0x0;this[_0xc23e('0x9')]=_0x34a7c6['name']||'';this['timeout']=_0x34a7c6[_0xc23e('0xa')]||0xa;this[_0xc23e('0xb')]=_0x34a7c6[_0xc23e('0xb')]||_0xc23e('0xc');this['Agents']=_0x34a7c6['Agents'];this[_0xc23e('0xd')]={};this['waiting']=0x0;this[_0xc23e('0x1')]='';this[_0xc23e('0xe')]();this[_0xc23e('0xf')]();}OpenchannelQueue[_0xc23e('0x10')][_0xc23e('0xe')]=function(){var _0x9ad10b=this[_0xc23e('0xd')][_0xc23e('0x11')];this['mapAgentsId']=_[_0xc23e('0x12')](this[_0xc23e('0x13')],'id');this[_0xc23e('0xd')][_0xc23e('0x11')]=_0x9ad10b;};OpenchannelQueue[_0xc23e('0x10')][_0xc23e('0xf')]=function(){this[_0xc23e('0x14')]=0x0;this[_0xc23e('0x15')]=0x0;for(var _0x3c938b=0x0;_0x3c938b=0x0?this[_0xc23e('0x18')]:0x0;var _0x12a728={'id':this['id'],'available':this[_0xc23e('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xc23e('0x9')],'paused':this[_0xc23e('0x15')],'waiting':this[_0xc23e('0x19')]};var _0x410e4e=md5(JSON[_0xc23e('0x1a')](_0x12a728));if(this[_0xc23e('0x1')]!==_0x410e4e){this[_0xc23e('0x1')]=_0x410e4e;io['to'](util[_0xc23e('0x1b')]('openchannel:queue:%s',_0x12a728[_0xc23e('0x9')]))['emit'](_0xc23e('0x1c'),_0x12a728);}};module[_0xc23e('0x1d')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 842557a..642c3d7 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(_0x5e27f1,_0xf42d5f){var _0x1aef85=function(_0x4edaed){while(--_0x4edaed){_0x5e27f1['push'](_0x5e27f1['shift']());}};_0x1aef85(++_0xf42d5f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'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(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x757a,0xde));var _0xa757=function(_0x455566,_0x28be3d){_0x455566=_0x455566-0x0;var _0x5e489d=_0x757a[_0x455566];return _0x5e489d;};'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 481f5c3..dfb4ff5 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 _0x75c6=['loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','util','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','prototype','paused','length','online'];(function(_0x878e34,_0xdff44d){var _0x502bc8=function(_0x12ee6b){while(--_0x12ee6b){_0x878e34['push'](_0x878e34['shift']());}};_0x502bc8(++_0xdff44d);}(_0x75c6,0x1c8));var _0x675c=function(_0x27b4c7,_0xd847e6){_0x27b4c7=_0x27b4c7-0x0;var _0x3000b9=_0x75c6[_0x27b4c7];return _0x3000b9;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x675c('0x0'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x675c('0x1')]=_['defaults'](config[_0x675c('0x1')],{'host':_0x675c('0x2'),'port':0x18eb});var io=require(_0x675c('0x3'))(new Redis(config[_0x675c('0x1')]));function WhatsappQueue(_0x3c4a01){this['id']=_0x3c4a01['id']||0x0;this[_0x675c('0x4')]=_0x3c4a01['name']||'';this[_0x675c('0x5')]=_0x3c4a01[_0x675c('0x5')]||0xa;this['strategy']=_0x3c4a01[_0x675c('0x6')]||'beepall';this['Agents']=_0x3c4a01[_0x675c('0x7')];this[_0x675c('0x8')]={};this[_0x675c('0x9')]=0x0;this[_0x675c('0xa')]='';this[_0x675c('0xb')]();this[_0x675c('0xc')]();}WhatsappQueue['prototype'][_0x675c('0xb')]=function(){var _0x2d8fe2=this['mapAgentsId'][_0x675c('0xd')];this[_0x675c('0x8')]=_[_0x675c('0xe')](this['Agents'],'id');this[_0x675c('0x8')][_0x675c('0xd')]=_0x2d8fe2;};WhatsappQueue[_0x675c('0xf')][_0x675c('0xc')]=function(){this['loggedIn']=0x0;this[_0x675c('0x10')]=0x0;for(var _0x53f53e=0x0;_0x53f53e=0x0?this['available']:0x0;var _0x3fbd83={'id':this['id'],'available':this['available'],'loggedIn':this[_0x675c('0x13')],'name':this[_0x675c('0x4')],'paused':this[_0x675c('0x10')],'waiting':this['waiting']};var _0x19cc1c=md5(JSON[_0x675c('0x16')](_0x3fbd83));if(this['md5']!==_0x19cc1c){this[_0x675c('0xa')]=_0x19cc1c;io['to'](util['format'](_0x675c('0x17'),_0x3fbd83[_0x675c('0x4')]))['emit'](_0x675c('0x18'),_0x3fbd83);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xba86=['online','whatsappPause','paused','available','waiting','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','mapAgentsId','_rr','prototype','updateRealtime','loggedIn','length'];(function(_0x565923,_0x203456){var _0x2c3072=function(_0x1fec9f){while(--_0x1fec9f){_0x565923['push'](_0x565923['shift']());}};_0x2c3072(++_0x203456);}(_0xba86,0x7e));var _0x6ba8=function(_0x171415,_0x566dae){_0x171415=_0x171415-0x0;var _0x502eb8=_0xba86[_0x171415];return _0x502eb8;};'use strict';var _=require(_0x6ba8('0x0'));var md5=require(_0x6ba8('0x1'));var util=require('util');var Redis=require(_0x6ba8('0x2'));var config=require(_0x6ba8('0x3'));config[_0x6ba8('0x4')]=_['defaults'](config[_0x6ba8('0x4')],{'host':_0x6ba8('0x5'),'port':0x18eb});var io=require(_0x6ba8('0x6'))(new Redis(config[_0x6ba8('0x4')]));function WhatsappQueue(_0x418c66){this['id']=_0x418c66['id']||0x0;this['name']=_0x418c66[_0x6ba8('0x7')]||'';this[_0x6ba8('0x8')]=_0x418c66[_0x6ba8('0x8')]||0xa;this[_0x6ba8('0x9')]=_0x418c66['strategy']||_0x6ba8('0xa');this[_0x6ba8('0xb')]=_0x418c66[_0x6ba8('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x6ba8('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype'][_0x6ba8('0xc')]=function(){var _0x31d1b7=this[_0x6ba8('0xd')][_0x6ba8('0xe')];this[_0x6ba8('0xd')]=_['map'](this[_0x6ba8('0xb')],'id');this[_0x6ba8('0xd')][_0x6ba8('0xe')]=_0x31d1b7;};WhatsappQueue[_0x6ba8('0xf')][_0x6ba8('0x10')]=function(){this[_0x6ba8('0x11')]=0x0;this['paused']=0x0;for(var _0xdf3a34=0x0;_0xdf3a34=0x0?this['available']:0x0;var _0x6c6861={'id':this['id'],'available':this[_0x6ba8('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x6ba8('0x7')],'paused':this[_0x6ba8('0x15')],'waiting':this[_0x6ba8('0x17')]};var _0x3f0932=md5(JSON['stringify'](_0x6c6861));if(this['md5']!==_0x3f0932){this[_0x6ba8('0x1')]=_0x3f0932;io['to'](util[_0x6ba8('0x18')](_0x6ba8('0x19'),_0x6c6861[_0x6ba8('0x7')]))[_0x6ba8('0x1a')](_0x6ba8('0x1b'),_0x6c6861);}};module[_0x6ba8('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1e57ac3..6a934d4 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue'];(function(_0x546b2d,_0xd90657){var _0x2be3dd=function(_0x141d79){while(--_0x141d79){_0x546b2d['push'](_0x546b2d['shift']());}};_0x2be3dd(++_0xd90657);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var moment=require(_0x7995('0x3'));var Agent=require('../model/agent');var Interval=require(_0x7995('0x4'));var OpenchannelQueue=require(_0x7995('0x5'));var ChatQueue=require(_0x7995('0x6'));var SmsQueue=require(_0x7995('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x7995('0x8'));var WhatsappQueue=require(_0x7995('0x9'));var Realtime=function(){this[_0x7995('0xa')]={};this[_0x7995('0xb')]={};this[_0x7995('0xc')]={};this[_0x7995('0xd')]={};this['smsQueues']={};this[_0x7995('0xe')]={};this[_0x7995('0xf')]={};this['whatsappQueues']={};this[_0x7995('0x10')]={};this[_0x7995('0x11')]={};this[_0x7995('0x12')]={};this[_0x7995('0x13')]={};this[_0x7995('0x14')]={};this[_0x7995('0x15')]={};};function freeIsNotKey(_0x341672,_0x524f7b,_0x245143){var _0x41c652=_['mapKeys'](_0x341672,function(_0xb0c872,_0x2cb37a){return _0xb0c872[_0x245143];});for(var _0x19a27e in _0x524f7b){if(_0x524f7b[_0x7995('0x16')](_0x19a27e)){if(!_0x41c652[_0x19a27e]){delete _0x524f7b[_0x19a27e];}}}}Realtime[_0x7995('0x17')][_0x7995('0x18')]=function(_0x2bbe7a,_0x4cc004){for(var _0x58f5ad in _0x4cc004){if(_0x2bbe7a[_0x7995('0x16')](_0x58f5ad)){_0x2bbe7a[_0x58f5ad]=_0x4cc004[_0x58f5ad];}}};Realtime[_0x7995('0x17')][_0x7995('0x19')]=function(){var _0x321ae8=this;return function(_0x3f1d3e){if(_0x3f1d3e){freeIsNotKey(_0x3f1d3e,_0x321ae8[_0x7995('0xa')],'id');for(var _0x2202ce=0x0,_0x41cbf0={},_0x5377e5={};_0x2202ce<_0x3f1d3e[_0x7995('0x1a')];_0x2202ce+=0x1){_0x41cbf0=_0x3f1d3e[_0x2202ce];if(_['isUndefined'](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']])){_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']]=new Agent(_0x41cbf0);}else{_0x321ae8[_0x7995('0x18')](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']],_0x41cbf0);}}}return _0x321ae8[_0x7995('0xa')];};};Realtime[_0x7995('0x17')]['initIntervals']=function(){var _0x54c9ae=this;return function(_0x2536c8){if(_0x2536c8){freeIsNotKey(_0x2536c8,_0x54c9ae['intervals'],'id');for(var _0x555f74=0x0,_0x3ec178={},_0x3d463e={};_0x555f74<_0x2536c8['length'];_0x555f74+=0x1){_0x3ec178=_0x2536c8[_0x555f74];if(_[_0x7995('0x1b')](_0x54c9ae['intervals'][_0x3ec178['id']])){_0x54c9ae['intervals'][_0x3ec178['id']]=new Interval(_0x3ec178);}else{_0x54c9ae[_0x7995('0x18')](_0x54c9ae[_0x7995('0xb')][_0x3ec178['id']],_0x3ec178);}}}return _0x54c9ae[_0x7995('0xb')];};};Realtime[_0x7995('0x17')][_0x7995('0x1c')]=function(){var _0x1c278a=this;return function(_0x5d40ae){if(_0x5d40ae){freeIsNotKey(_0x5d40ae,_0x1c278a[_0x7995('0xc')],'id');for(var _0x46ee4b=0x0,_0x204507={},_0x285437={};_0x46ee4b<_0x5d40ae[_0x7995('0x1a')];_0x46ee4b+=0x1){_0x204507=_0x5d40ae[_0x46ee4b];if(_[_0x7995('0x1b')](_0x1c278a[_0x7995('0xc')][_0x204507['id']])){_0x1c278a[_0x7995('0xc')][_0x204507['id']]=new OpenchannelQueue(_0x204507);}else{_0x1c278a['mergeFromDatabase'](_0x1c278a[_0x7995('0xc')][_0x204507['id']],_0x204507);}_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1d')]();_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1e')]();}}return _0x1c278a[_0x7995('0xc')];};};Realtime['prototype'][_0x7995('0x1f')]=function(){var _0x5911c3=this;return function(_0x229742){if(_0x229742){freeIsNotKey(_0x229742,_0x5911c3[_0x7995('0xd')],'id');for(var _0xf16cc2=0x0,_0x132a42={},_0x11c1eb={};_0xf16cc2<_0x229742['length'];_0xf16cc2+=0x1){_0x132a42=_0x229742[_0xf16cc2];if(_[_0x7995('0x1b')](_0x5911c3['chatQueues'][_0x132a42['id']])){_0x5911c3[_0x7995('0xd')][_0x132a42['id']]=new ChatQueue(_0x132a42);}else{_0x5911c3[_0x7995('0x18')](_0x5911c3[_0x7995('0xd')][_0x132a42['id']],_0x132a42);}_0x5911c3['chatQueues'][_0x132a42['id']]['updateRouting']();_0x5911c3['chatQueues'][_0x132a42['id']][_0x7995('0x1e')]();}}return _0x5911c3[_0x7995('0xd')];};};Realtime[_0x7995('0x17')][_0x7995('0x20')]=function(){var _0x2e3493=this;return function(_0x1ca460){if(_0x1ca460){freeIsNotKey(_0x1ca460,_0x2e3493['smsQueues'],'id');for(var _0x481c74=0x0,_0xfa8f15={},_0x5524af={};_0x481c74<_0x1ca460[_0x7995('0x1a')];_0x481c74+=0x1){_0xfa8f15=_0x1ca460[_0x481c74];if(_[_0x7995('0x1b')](_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']])){_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']]=new SmsQueue(_0xfa8f15);}else{_0x2e3493[_0x7995('0x18')](_0x2e3493['smsQueues'][_0xfa8f15['id']],_0xfa8f15);}_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']][_0x7995('0x1d')]();_0x2e3493['smsQueues'][_0xfa8f15['id']]['updateRealtime']();}}return _0x2e3493['smsQueues'];};};Realtime[_0x7995('0x17')][_0x7995('0x22')]=function(){var _0x4a176f=this;return function(_0x3e7020){if(_0x3e7020){freeIsNotKey(_0x3e7020,_0x4a176f['mailQueues'],'id');for(var _0x37917b=0x0,_0x1cb058={},_0x177cb4={};_0x37917b<_0x3e7020['length'];_0x37917b+=0x1){_0x1cb058=_0x3e7020[_0x37917b];if(_['isUndefined'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']])){_0x4a176f['mailQueues'][_0x1cb058['id']]=new MailQueue(_0x1cb058);}else{_0x4a176f['mergeFromDatabase'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']],_0x1cb058);}_0x4a176f[_0x7995('0xe')][_0x1cb058['id']]['updateRouting']();_0x4a176f[_0x7995('0xe')][_0x1cb058['id']][_0x7995('0x1e')]();}}return _0x4a176f[_0x7995('0xe')];};};Realtime[_0x7995('0x17')][_0x7995('0x23')]=function(){var _0x53002a=this;return function(_0x2d4285){if(_0x2d4285){freeIsNotKey(_0x2d4285,_0x53002a[_0x7995('0xf')],'id');for(var _0xf612e6=0x0,_0x1d60b8={},_0x4b1541={};_0xf612e6<_0x2d4285[_0x7995('0x1a')];_0xf612e6+=0x1){_0x1d60b8=_0x2d4285[_0xf612e6];if(_[_0x7995('0x1b')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']])){_0x53002a[_0x7995('0xf')][_0x1d60b8['id']]=new FaxQueue(_0x1d60b8);}else{_0x53002a[_0x7995('0x18')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']],_0x1d60b8);}_0x53002a['faxQueues'][_0x1d60b8['id']][_0x7995('0x1d')]();_0x53002a[_0x7995('0xf')][_0x1d60b8['id']][_0x7995('0x1e')]();}}return _0x53002a[_0x7995('0xf')];};};Realtime[_0x7995('0x17')][_0x7995('0x24')]=function(){var _0x14d638=this;return function(_0x270c0e){if(_0x270c0e){freeIsNotKey(_0x270c0e,_0x14d638[_0x7995('0x25')],'id');for(var _0x447981=0x0,_0x6fe77b={},_0x270d52={};_0x447981<_0x270c0e[_0x7995('0x1a')];_0x447981+=0x1){_0x6fe77b=_0x270c0e[_0x447981];if(_['isUndefined'](_0x14d638['whatsappQueues'][_0x6fe77b['id']])){_0x14d638[_0x7995('0x25')][_0x6fe77b['id']]=new WhatsappQueue(_0x6fe77b);}else{_0x14d638[_0x7995('0x18')](_0x14d638['whatsappQueues'][_0x6fe77b['id']],_0x6fe77b);}_0x14d638['whatsappQueues'][_0x6fe77b['id']][_0x7995('0x1d')]();_0x14d638['whatsappQueues'][_0x6fe77b['id']]['updateRealtime']();}}return _0x14d638[_0x7995('0x25')];};};module[_0x7995('0x26')]=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x314113,_0x3780af){var _0x22cbdc=function(_0x2927e8){while(--_0x2927e8){_0x314113['push'](_0x314113['shift']());}};_0x22cbdc(++_0x3780af);}(_0x008c,0x188));var _0xc008=function(_0x36115d,_0x4071a1){_0x36115d=_0x36115d-0x0;var _0x58cd1f=_0x008c[_0x36115d];return _0x58cd1f;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 5f2beb6..91e94b6 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 _0x8393=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','Request'];(function(_0x1dedf8,_0x2a8ef0){var _0x5d5a80=function(_0x50a4d6){while(--_0x50a4d6){_0x1dedf8['push'](_0x1dedf8['shift']());}};_0x5d5a80(++_0x2a8ef0);}(_0x8393,0x94));var _0x3839=function(_0x47034d,_0x384dca){_0x47034d=_0x47034d-0x0;var _0x4c41f3=_0x8393[_0x47034d];return _0x4c41f3;};'use strict';var client=require(_0x3839('0x0'));exports['update']=function(_0x512cfe,_0x141c73){return client[_0x3839('0x1')](_0x3839('0x2'),{'body':_0x141c73,'options':{'where':{'id':_0x512cfe}},'log':_0x3839('0x3')});};exports[_0x3839('0x4')]=function(_0x2232fd,_0x47403c){return client[_0x3839('0x1')](_0x3839('0x5'),{'body':_0x47403c,'options':{'where':{'id':_0x2232fd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6184=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','update','Request'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0x6184,0x13c));var _0x4618=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x6184[_0x333fc8];return _0x432439;};'use strict';var client=require('../client');exports[_0x4618('0x0')]=function(_0x1c266d,_0xe263af){return client[_0x4618('0x1')](_0x4618('0x2'),{'body':_0xe263af,'options':{'where':{'id':_0x1c266d}},'log':_0x4618('0x3')});};exports[_0x4618('0x4')]=function(_0x120aeb,_0x3ce0f5){return client['Request'](_0x4618('0x5'),{'body':_0x3ce0f5,'options':{'where':{'id':_0x120aeb}},'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 f1175bf..edbf782 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 _0xd1f1=['create','Request','CreateChatMessage'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0xd1f1,0x19e));var _0x1d1f=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0xd1f1[_0x45aa72];return _0x75adaa;};'use strict';var client=require('../client');exports[_0x1d1f('0x0')]=function(_0x102248){return client[_0x1d1f('0x1')](_0x1d1f('0x2'),{'body':_0x102248,'log':'createChatMessage'});}; \ No newline at end of file +var _0xf2e9=['createChatMessage','Request','CreateChatMessage'];(function(_0x5f4975,_0x58e21d){var _0x4a29d2=function(_0x1c7361){while(--_0x1c7361){_0x5f4975['push'](_0x5f4975['shift']());}};_0x4a29d2(++_0x58e21d);}(_0xf2e9,0x1f3));var _0x9f2e=function(_0xd6a6ac,_0x5248bd){_0xd6a6ac=_0xd6a6ac-0x0;var _0x3f0399=_0xf2e9[_0xd6a6ac];return _0x3f0399;};'use strict';var client=require('../client');exports['create']=function(_0x4ed32d){return client[_0x9f2e('0x0')](_0x9f2e('0x1'),{'body':_0x4ed32d,'log':_0x9f2e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2c3c934..a69d106 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 _0x9e3c=['timeout','strategy','Agents','chatPause','../client','getChatQueues','Request','name'];(function(_0x35d2d6,_0x14e944){var _0x1637d5=function(_0x327b04){while(--_0x327b04){_0x35d2d6['push'](_0x35d2d6['shift']());}};_0x1637d5(++_0x14e944);}(_0x9e3c,0xdc));var _0xc9e3=function(_0x36cb4d,_0x2dc7aa){_0x36cb4d=_0x36cb4d-0x0;var _0x35ca7c=_0x9e3c[_0x36cb4d];return _0x35ca7c;};'use strict';var client=require(_0xc9e3('0x0'));exports[_0xc9e3('0x1')]=function(){return function(){return client[_0xc9e3('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xc9e3('0x3'),_0xc9e3('0x4'),_0xc9e3('0x5')],'include':[{'model':'User','as':_0xc9e3('0x6'),'attributes':['id',_0xc9e3('0x3'),'online',_0xc9e3('0x7')]}]},'log':_0xc9e3('0x1')});};}; \ No newline at end of file +var _0xff11=['name','timeout','strategy','User','online','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x3fc287,_0x5c3f36){var _0x33af9f=function(_0x27cfc6){while(--_0x27cfc6){_0x3fc287['push'](_0x3fc287['shift']());}};_0x33af9f(++_0x5c3f36);}(_0xff11,0x138));var _0x1ff1=function(_0x354a37,_0x3d63f2){_0x354a37=_0x354a37-0x0;var _0x5219c6=_0xff11[_0x354a37];return _0x5219c6;};'use strict';var client=require('../client');exports[_0x1ff1('0x0')]=function(){return function(){return client[_0x1ff1('0x1')](_0x1ff1('0x2'),{'options':{'raw':![],'attributes':['id',_0x1ff1('0x3'),_0x1ff1('0x4'),_0x1ff1('0x5')],'include':[{'model':_0x1ff1('0x6'),'as':'Agents','attributes':['id',_0x1ff1('0x3'),_0x1ff1('0x7'),_0x1ff1('0x8')]}]},'log':_0x1ff1('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 83211b3..1e716d2 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 _0xdeb7=['create','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x7d5a79,_0xa03883){var _0x2211bf=function(_0x32cb61){while(--_0x32cb61){_0x7d5a79['push'](_0x7d5a79['shift']());}};_0x2211bf(++_0xa03883);}(_0xdeb7,0x77));var _0x7deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb7[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x7deb('0x0'));exports[_0x7deb('0x1')]=function(_0x5f4b03){return client['Request'](_0x7deb('0x2'),{'body':_0x5f4b03,'log':_0x7deb('0x2')});};exports[_0x7deb('0x3')]=function(_0x20de63,_0x307ce7){return client['Request'](_0x7deb('0x4'),{'body':_0x307ce7,'options':{'where':{'uniqueid':_0x20de63},'order':[['id',_0x7deb('0x5')]],'limit':0x1},'log':_0x7deb('0x4')});}; \ No newline at end of file +var _0xe914=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x4e5b02,_0x437ab9){var _0x4ce122=function(_0x48e6c2){while(--_0x48e6c2){_0x4e5b02['push'](_0x4e5b02['shift']());}};_0x4ce122(++_0x437ab9);}(_0xe914,0x7f));var _0x4e91=function(_0x5ab0fb,_0x355be1){_0x5ab0fb=_0x5ab0fb-0x0;var _0x15761a=_0xe914[_0x5ab0fb];return _0x15761a;};'use strict';var client=require(_0x4e91('0x0'));exports[_0x4e91('0x1')]=function(_0x4b9ac6){return client[_0x4e91('0x2')](_0x4e91('0x3'),{'body':_0x4b9ac6,'log':_0x4e91('0x3')});};exports[_0x4e91('0x4')]=function(_0x297dc0,_0x59e102){return client['Request'](_0x4e91('0x5'),{'body':_0x59e102,'options':{'where':{'uniqueid':_0x297dc0},'order':[['id',_0x4e91('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index cedb8a1..877bf65 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 _0x396b=['addTagsToFaxInteraction','../client','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x51b109,_0x23c209){var _0xe7f6cd=function(_0x184674){while(--_0x184674){_0x51b109['push'](_0x51b109['shift']());}};_0xe7f6cd(++_0x23c209);}(_0x396b,0xa6));var _0xb396=function(_0x209224,_0x291eb5){_0x209224=_0x209224-0x0;var _0x3dcf6b=_0x396b[_0x209224];return _0x3dcf6b;};'use strict';var client=require(_0xb396('0x0'));exports['update']=function(_0x5aa776,_0x2dd301){return client['Request'](_0xb396('0x1'),{'body':_0x2dd301,'options':{'where':{'id':_0x5aa776}},'log':'updateFaxInteraction'});};exports[_0xb396('0x2')]=function(_0x4f7517,_0x3fd480){return client['Request'](_0xb396('0x3'),{'body':_0x3fd480,'options':{'where':{'id':_0x4f7517}},'log':_0xb396('0x4')});}; \ No newline at end of file +var _0xbd80=['addTagsToFaxInteraction','../client','Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x529a0f,_0x328763){var _0x187a88=function(_0x1ea706){while(--_0x1ea706){_0x529a0f['push'](_0x529a0f['shift']());}};_0x187a88(++_0x328763);}(_0xbd80,0x181));var _0x0bd8=function(_0x519f2a,_0x22ae9d){_0x519f2a=_0x519f2a-0x0;var _0x551dbd=_0xbd80[_0x519f2a];return _0x551dbd;};'use strict';var client=require(_0x0bd8('0x0'));exports['update']=function(_0x5d27fd,_0x47ee25){return client[_0x0bd8('0x1')](_0x0bd8('0x2'),{'body':_0x47ee25,'options':{'where':{'id':_0x5d27fd}},'log':'updateFaxInteraction'});};exports[_0x0bd8('0x3')]=function(_0x391982,_0x2c5739){return client[_0x0bd8('0x1')](_0x0bd8('0x4'),{'body':_0x2c5739,'options':{'where':{'id':_0x391982}},'log':_0x0bd8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 0dd7471..234ac61 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 _0x4efe=['CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x175da3,_0x2c89f2){var _0x45afc8=function(_0x1b862f){while(--_0x1b862f){_0x175da3['push'](_0x175da3['shift']());}};_0x45afc8(++_0x2c89f2);}(_0x4efe,0x1e2));var _0xe4ef=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4efe[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0xe4ef('0x0'));exports[_0xe4ef('0x1')]=function(_0x43a3cf){return client['Request'](_0xe4ef('0x2'),{'body':_0x43a3cf,'log':_0xe4ef('0x3')});}; \ No newline at end of file +var _0xf980=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xf980,0x1a7));var _0x0f98=function(_0x41ee64,_0x206c94){_0x41ee64=_0x41ee64-0x0;var _0x468e47=_0xf980[_0x41ee64];return _0x468e47;};'use strict';var client=require(_0x0f98('0x0'));exports[_0x0f98('0x1')]=function(_0x3bf937){return client[_0x0f98('0x2')](_0x0f98('0x3'),{'body':_0x3bf937,'log':_0x0f98('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index fd68039..e602d0a 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 _0x0c6e=['name','strategy','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x133ae7,_0x31bfd9){var _0x48677e=function(_0xc8bcc){while(--_0xc8bcc){_0x133ae7['push'](_0x133ae7['shift']());}};_0x48677e(++_0x31bfd9);}(_0x0c6e,0x9e));var _0xe0c6=function(_0x450a37,_0x3f21a4){_0x450a37=_0x450a37-0x0;var _0x2f9a62=_0x0c6e[_0x450a37];return _0x2f9a62;};'use strict';var client=require(_0xe0c6('0x0'));exports[_0xe0c6('0x1')]=function(){return function(){return client[_0xe0c6('0x2')](_0xe0c6('0x3'),{'options':{'raw':![],'attributes':['id',_0xe0c6('0x4'),'timeout',_0xe0c6('0x5')],'include':[{'model':'User','as':_0xe0c6('0x6'),'attributes':['id',_0xe0c6('0x4'),_0xe0c6('0x7'),_0xe0c6('0x8')]}]},'log':_0xe0c6('0x1')});};}; \ No newline at end of file +var _0x416e=['strategy','User','faxPause','../client','getFaxQueues','Request','name','timeout'];(function(_0xde0fe8,_0x26a6d6){var _0x3de13a=function(_0x1d6023){while(--_0x1d6023){_0xde0fe8['push'](_0xde0fe8['shift']());}};_0x3de13a(++_0x26a6d6);}(_0x416e,0x1cb));var _0xe416=function(_0x179f1a,_0x485548){_0x179f1a=_0x179f1a-0x0;var _0x3ee0f6=_0x416e[_0x179f1a];return _0x3ee0f6;};'use strict';var client=require(_0xe416('0x0'));exports[_0xe416('0x1')]=function(){return function(){return client[_0xe416('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xe416('0x3'),_0xe416('0x4'),_0xe416('0x5')],'include':[{'model':_0xe416('0x6'),'as':'Agents','attributes':['id',_0xe416('0x3'),'online',_0xe416('0x7')]}]},'log':_0xe416('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 09d9f59..cd8bf98 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 _0xe080=['create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client'];(function(_0x4eaf5d,_0x4c6151){var _0x244a3b=function(_0x206b25){while(--_0x206b25){_0x4eaf5d['push'](_0x4eaf5d['shift']());}};_0x244a3b(++_0x4c6151);}(_0xe080,0x141));var _0x0e08=function(_0x4ec285,_0x2ebcff){_0x4ec285=_0x4ec285-0x0;var _0x1268a6=_0xe080[_0x4ec285];return _0x1268a6;};'use strict';var client=require(_0x0e08('0x0'));exports[_0x0e08('0x1')]=function(_0x122cfb){return client['Request'](_0x0e08('0x2'),{'body':_0x122cfb,'log':_0x0e08('0x2')});};exports[_0x0e08('0x3')]=function(_0x5b5a62,_0x1f3ac2){return client[_0x0e08('0x4')](_0x0e08('0x5'),{'body':_0x1f3ac2,'options':{'where':{'uniqueid':_0x5b5a62},'order':[['id',_0x0e08('0x6')]],'limit':0x1},'log':_0x0e08('0x5')});}; \ No newline at end of file +var _0x9d35=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x5e56fd,_0x153da6){var _0x101aff=function(_0x38c329){while(--_0x38c329){_0x5e56fd['push'](_0x5e56fd['shift']());}};_0x101aff(++_0x153da6);}(_0x9d35,0x174));var _0x59d3=function(_0x4a1e96,_0x143e6b){_0x4a1e96=_0x4a1e96-0x0;var _0x5acea9=_0x9d35[_0x4a1e96];return _0x5acea9;};'use strict';var client=require(_0x59d3('0x0'));exports[_0x59d3('0x1')]=function(_0x312c1a){return client[_0x59d3('0x2')](_0x59d3('0x3'),{'body':_0x312c1a,'log':_0x59d3('0x3')});};exports[_0x59d3('0x4')]=function(_0x5c35b1,_0xd4ff2a){return client[_0x59d3('0x2')](_0x59d3('0x5'),{'body':_0xd4ff2a,'options':{'where':{'uniqueid':_0x5c35b1},'order':[['id','DESC']],'limit':0x1},'log':_0x59d3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 3e819f5..1ecb259 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 _0xe5b5=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x57edca,_0x387198){var _0x367f7d=function(_0x4967df){while(--_0x4967df){_0x57edca['push'](_0x57edca['shift']());}};_0x367f7d(++_0x387198);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0xe5b5[_0x34f701];return _0x3e2429;};'use strict';var client=require(_0x5e5b('0x0'));exports[_0x5e5b('0x1')]=function(){return function(){return client[_0x5e5b('0x2')](_0x5e5b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x5e5b('0x4')],'include':[{'model':_0x5e5b('0x5'),'as':_0x5e5b('0x6'),'attributes':['id',_0x5e5b('0x4'),_0x5e5b('0x7')]}]},'log':_0x5e5b('0x1')});};}; \ No newline at end of file +var _0xab40=['interval','../client','getIntervals','Interval','Intervals','name'];(function(_0xfa7d19,_0x4b2ea9){var _0x435427=function(_0x249835){while(--_0x249835){_0xfa7d19['push'](_0xfa7d19['shift']());}};_0x435427(++_0x4b2ea9);}(_0xab40,0xcd));var _0x0ab4=function(_0x19b9a7,_0x2404f9){_0x19b9a7=_0x19b9a7-0x0;var _0x39f3d3=_0xab40[_0x19b9a7];return _0x39f3d3;};'use strict';var client=require(_0x0ab4('0x0'));exports[_0x0ab4('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x0ab4('0x2'),'as':_0x0ab4('0x3'),'attributes':['id',_0x0ab4('0x4'),_0x0ab4('0x5')]}]},'log':_0x0ab4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8de8234..c1615f3 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 _0xb843=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x3c5e71,_0xfc0c07){var _0x71b974=function(_0x40c7e7){while(--_0x40c7e7){_0x3c5e71['push'](_0x3c5e71['shift']());}};_0x71b974(++_0xfc0c07);}(_0xb843,0xc9));var _0x3b84=function(_0x7d70c2,_0x5d86cb){_0x7d70c2=_0x7d70c2-0x0;var _0x364a0b=_0xb843[_0x7d70c2];return _0x364a0b;};'use strict';var client=require(_0x3b84('0x0'));exports[_0x3b84('0x1')]=function(_0x151e93,_0x1c506e){return client[_0x3b84('0x2')](_0x3b84('0x3'),{'body':_0x1c506e,'options':{'where':{'id':_0x151e93}},'log':_0x3b84('0x4')});};exports[_0x3b84('0x5')]=function(_0xf414c9,_0x227859){return client[_0x3b84('0x2')]('AddTagsToMailInteraction',{'body':_0x227859,'options':{'where':{'id':_0xf414c9}},'log':_0x3b84('0x6')});}; \ No newline at end of file +var _0xf083=['addTagsToChatInteraction','../client','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x3b9a4d,_0x138209){var _0x582661=function(_0x626805){while(--_0x626805){_0x3b9a4d['push'](_0x3b9a4d['shift']());}};_0x582661(++_0x138209);}(_0xf083,0x1eb));var _0x3f08=function(_0x240edf,_0xa9d593){_0x240edf=_0x240edf-0x0;var _0xb7ae0c=_0xf083[_0x240edf];return _0xb7ae0c;};'use strict';var client=require(_0x3f08('0x0'));exports['update']=function(_0x5929e0,_0xd064c9){return client[_0x3f08('0x1')](_0x3f08('0x2'),{'body':_0xd064c9,'options':{'where':{'id':_0x5929e0}},'log':_0x3f08('0x3')});};exports[_0x3f08('0x4')]=function(_0x1cf135,_0x23a848){return client[_0x3f08('0x1')](_0x3f08('0x5'),{'body':_0x23a848,'options':{'where':{'id':_0x1cf135}},'log':_0x3f08('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 36cf526..d29f8c9 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 _0x4825=['Request','CreateMailMessage','../client'];(function(_0x542247,_0x29a833){var _0x4a7358=function(_0x3a1a81){while(--_0x3a1a81){_0x542247['push'](_0x542247['shift']());}};_0x4a7358(++_0x29a833);}(_0x4825,0x1f4));var _0x5482=function(_0x454b92,_0xd87c8e){_0x454b92=_0x454b92-0x0;var _0x41ee05=_0x4825[_0x454b92];return _0x41ee05;};'use strict';var client=require(_0x5482('0x0'));exports['create']=function(_0x18b81a){return client[_0x5482('0x1')](_0x5482('0x2'),{'body':_0x18b81a,'log':'createMailMessage'});}; \ No newline at end of file +var _0x084a=['CreateMailMessage','createMailMessage'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x084a,0x11e));var _0xa084=function(_0x42d0c8,_0x4df5e8){_0x42d0c8=_0x42d0c8-0x0;var _0x2eb6f0=_0x084a[_0x42d0c8];return _0x2eb6f0;};'use strict';var client=require('../client');exports['create']=function(_0x80ca57){return client['Request'](_0xa084('0x0'),{'body':_0x80ca57,'log':_0xa084('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bb96e47..1f63eec 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 _0x3816=['User','Agents','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0xdc4488,_0x11f39e){var _0x2f1fd6=function(_0x1d0c5d){while(--_0x1d0c5d){_0xdc4488['push'](_0xdc4488['shift']());}};_0x2f1fd6(++_0x11f39e);}(_0x3816,0x6f));var _0x6381=function(_0x4c2c23,_0x3d8d28){_0x4c2c23=_0x4c2c23-0x0;var _0x5c992e=_0x3816[_0x4c2c23];return _0x5c992e;};'use strict';var client=require(_0x6381('0x0'));exports[_0x6381('0x1')]=function(){return function(){return client[_0x6381('0x2')](_0x6381('0x3'),{'options':{'raw':![],'attributes':['id',_0x6381('0x4'),'timeout',_0x6381('0x5')],'include':[{'model':_0x6381('0x6'),'as':_0x6381('0x7'),'attributes':['id','name','online',_0x6381('0x8')]}]},'log':_0x6381('0x1')});};}; \ No newline at end of file +var _0x9ba8=['GetMailQueue','name','timeout','User','Agents','online','mailPause','getMailQueues','Request'];(function(_0x3cfc8e,_0x116a60){var _0x5f31af=function(_0x5c3f07){while(--_0x5c3f07){_0x3cfc8e['push'](_0x3cfc8e['shift']());}};_0x5f31af(++_0x116a60);}(_0x9ba8,0xbb));var _0x89ba=function(_0x11ee99,_0xa743ed){_0x11ee99=_0x11ee99-0x0;var _0x469072=_0x9ba8[_0x11ee99];return _0x469072;};'use strict';var client=require('../client');exports[_0x89ba('0x0')]=function(){return function(){return client[_0x89ba('0x1')](_0x89ba('0x2'),{'options':{'raw':![],'attributes':['id',_0x89ba('0x3'),_0x89ba('0x4'),'strategy'],'include':[{'model':_0x89ba('0x5'),'as':_0x89ba('0x6'),'attributes':['id',_0x89ba('0x3'),_0x89ba('0x7'),_0x89ba('0x8')]}]},'log':_0x89ba('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 24a415b..2b8acc3 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 _0x8d25=['update','UpdateMailQueueReport','DESC','create','Request'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x8d25,0x76));var _0x58d2=function(_0x164352,_0x3f4a6f){_0x164352=_0x164352-0x0;var _0x27b0ec=_0x8d25[_0x164352];return _0x27b0ec;};'use strict';var client=require('../client');exports[_0x58d2('0x0')]=function(_0x227cac){return client[_0x58d2('0x1')]('CreateMailQueueReport',{'body':_0x227cac,'log':'CreateMailQueueReport'});};exports[_0x58d2('0x2')]=function(_0x480e26,_0x337601){return client[_0x58d2('0x1')](_0x58d2('0x3'),{'body':_0x337601,'options':{'where':{'uniqueid':_0x480e26},'order':[['id',_0x58d2('0x4')]],'limit':0x1},'log':_0x58d2('0x3')});}; \ No newline at end of file +var _0x989d=['create','Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client'];(function(_0x2063ba,_0x342f8a){var _0x2b09e6=function(_0x422517){while(--_0x422517){_0x2063ba['push'](_0x2063ba['shift']());}};_0x2b09e6(++_0x342f8a);}(_0x989d,0x9b));var _0xd989=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x989d[_0x263a74];return _0x2aa86c;};'use strict';var client=require(_0xd989('0x0'));exports[_0xd989('0x1')]=function(_0x378376){return client[_0xd989('0x2')](_0xd989('0x3'),{'body':_0x378376,'log':_0xd989('0x3')});};exports['update']=function(_0x527085,_0x51c4be){return client[_0xd989('0x2')](_0xd989('0x4'),{'body':_0x51c4be,'options':{'where':{'uniqueid':_0x527085},'order':[['id',_0xd989('0x5')]],'limit':0x1},'log':_0xd989('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c97913b..5b7a623 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 _0xfd15=['addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction','addTags'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0xfd15,0x1bd));var _0x5fd1=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xfd15[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x5fd1('0x0'));exports[_0x5fd1('0x1')]=function(_0x55f5f9,_0x3a582f){return client[_0x5fd1('0x2')]('UpdateOpenchannelInteraction',{'body':_0x3a582f,'options':{'where':{'id':_0x55f5f9}},'log':_0x5fd1('0x3')});};exports[_0x5fd1('0x4')]=function(_0x3ad81d,_0xefa9cd){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0xefa9cd,'options':{'where':{'id':_0x3ad81d}},'log':_0x5fd1('0x5')});}; \ No newline at end of file +var _0x9442=['../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x5cff62,_0x3ea415){var _0x311f1c=function(_0x558372){while(--_0x558372){_0x5cff62['push'](_0x5cff62['shift']());}};_0x311f1c(++_0x3ea415);}(_0x9442,0x18f));var _0x2944=function(_0x31915e,_0x41a97a){_0x31915e=_0x31915e-0x0;var _0x235747=_0x9442[_0x31915e];return _0x235747;};'use strict';var client=require(_0x2944('0x0'));exports['update']=function(_0x1a3352,_0x451587){return client['Request'](_0x2944('0x1'),{'body':_0x451587,'options':{'where':{'id':_0x1a3352}},'log':_0x2944('0x2')});};exports[_0x2944('0x3')]=function(_0x173fab,_0x523708){return client[_0x2944('0x4')](_0x2944('0x5'),{'body':_0x523708,'options':{'where':{'id':_0x173fab}},'log':_0x2944('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4459c79..2c9cdfd 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x1958bd,_0x19299c){var _0x466727=function(_0x22847b){while(--_0x22847b){_0x1958bd['push'](_0x1958bd['shift']());}};_0x466727(++_0x19299c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0xbdb7[_0x283127];return _0x43da5d;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'body':_0x44467d,'log':_0x7bdb('0x4')});}; \ No newline at end of file +var _0xe706=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x1653b1,_0x35b7d1){var _0x3e0b17=function(_0x5f21fc){while(--_0x5f21fc){_0x1653b1['push'](_0x1653b1['shift']());}};_0x3e0b17(++_0x35b7d1);}(_0xe706,0xa3));var _0x6e70=function(_0x3fa215,_0x3a749a){_0x3fa215=_0x3fa215-0x0;var _0x2b7668=_0xe706[_0x3fa215];return _0x2b7668;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(_0x311951){return client['Request'](_0x6e70('0x2'),{'body':_0x311951,'log':_0x6e70('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6e820dd..5773402 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 _0x6de5=['GetOpenchannelQueue','name','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x6de5,0x1c9));var _0x56de=function(_0xadf780,_0x24b2db){_0xadf780=_0xadf780-0x0;var _0x3249c9=_0x6de5[_0xadf780];return _0x3249c9;};'use strict';var client=require(_0x56de('0x0'));exports[_0x56de('0x1')]=function(){return function(){return client['Request'](_0x56de('0x2'),{'options':{'raw':![],'attributes':['id',_0x56de('0x3'),'timeout',_0x56de('0x4')],'include':[{'model':_0x56de('0x5'),'as':_0x56de('0x6'),'attributes':['id',_0x56de('0x3'),_0x56de('0x7'),_0x56de('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xeec9=['openchannelPause','getOpenchannelQueues','Request','name','strategy','Agents'];(function(_0x55dd6f,_0x45bd10){var _0x1e193a=function(_0x4e1906){while(--_0x4e1906){_0x55dd6f['push'](_0x55dd6f['shift']());}};_0x1e193a(++_0x45bd10);}(_0xeec9,0x11b));var _0x9eec=function(_0x11db16,_0x13ae56){_0x11db16=_0x11db16-0x0;var _0x200161=_0xeec9[_0x11db16];return _0x200161;};'use strict';var client=require('../client');exports[_0x9eec('0x0')]=function(){return function(){return client[_0x9eec('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x9eec('0x2'),'timeout',_0x9eec('0x3')],'include':[{'model':'User','as':_0x9eec('0x4'),'attributes':['id',_0x9eec('0x2'),'online',_0x9eec('0x5')]}]},'log':_0x9eec('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 0be1a76..f1dc9f0 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 _0xf47c=['../client','create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf47c,0xd2));var _0xcf47=function(_0x237c36,_0x316df6){_0x237c36=_0x237c36-0x0;var _0x161e6c=_0xf47c[_0x237c36];return _0x161e6c;};'use strict';var client=require(_0xcf47('0x0'));exports[_0xcf47('0x1')]=function(_0x1321f3){return client['Request'](_0xcf47('0x2'),{'body':_0x1321f3,'log':'CreateOpenchannelQueueReport'});};exports[_0xcf47('0x3')]=function(_0x55747d,_0x14d5e7){return client[_0xcf47('0x4')](_0xcf47('0x5'),{'body':_0x14d5e7,'options':{'where':{'uniqueid':_0x55747d},'order':[['id','DESC']],'limit':0x1},'log':_0xcf47('0x5')});}; \ No newline at end of file +var _0xcde6=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x2dbe3d,_0x4b6223){var _0x2a4da5=function(_0x3b8795){while(--_0x3b8795){_0x2dbe3d['push'](_0x2dbe3d['shift']());}};_0x2a4da5(++_0x4b6223);}(_0xcde6,0x158));var _0x6cde=function(_0x422751,_0x258e3b){_0x422751=_0x422751-0x0;var _0xcbf6e2=_0xcde6[_0x422751];return _0xcbf6e2;};'use strict';var client=require(_0x6cde('0x0'));exports[_0x6cde('0x1')]=function(_0x2e67a2){return client[_0x6cde('0x2')](_0x6cde('0x3'),{'body':_0x2e67a2,'log':_0x6cde('0x3')});};exports['update']=function(_0x355bba,_0x580952){return client[_0x6cde('0x2')](_0x6cde('0x4'),{'body':_0x580952,'options':{'where':{'uniqueid':_0x355bba},'order':[['id',_0x6cde('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 40cf5dd..1f25c6e 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 _0x1613=['../client','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x1613,0xe1));var _0x3161=function(_0x45b4eb,_0x1eed0c){_0x45b4eb=_0x45b4eb-0x0;var _0x1a738e=_0x1613[_0x45b4eb];return _0x1a738e;};'use strict';var client=require(_0x3161('0x0'));exports['update']=function(_0x4d9a24,_0x4dedb9){return client['Request']('UpdateSmsInteraction',{'body':_0x4dedb9,'options':{'where':{'id':_0x4d9a24}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x1ffc1a,_0x4cdbba){return client['Request'](_0x3161('0x1'),{'body':_0x4cdbba,'options':{'where':{'id':_0x1ffc1a}},'log':_0x3161('0x2')});}; \ No newline at end of file +var _0xc794=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x4ca6f5,_0xb0cb6){var _0x286545=function(_0x3005ef){while(--_0x3005ef){_0x4ca6f5['push'](_0x4ca6f5['shift']());}};_0x286545(++_0xb0cb6);}(_0xc794,0x141));var _0x4c79=function(_0x4d9c51,_0x36002f){_0x4d9c51=_0x4d9c51-0x0;var _0xa860b3=_0xc794[_0x4d9c51];return _0xa860b3;};'use strict';var client=require('../client');exports[_0x4c79('0x0')]=function(_0x14e7ef,_0x407396){return client[_0x4c79('0x1')](_0x4c79('0x2'),{'body':_0x407396,'options':{'where':{'id':_0x14e7ef}},'log':_0x4c79('0x3')});};exports[_0x4c79('0x4')]=function(_0x11b938,_0x28b9ed){return client['Request'](_0x4c79('0x5'),{'body':_0x28b9ed,'options':{'where':{'id':_0x11b938}},'log':_0x4c79('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 73f2554..d58ef65 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 _0x05ab=['CreateSmsMessage','Request'];(function(_0x4f78f8,_0xd71ce6){var _0xc0df2=function(_0x4ad595){while(--_0x4ad595){_0x4f78f8['push'](_0x4f78f8['shift']());}};_0xc0df2(++_0xd71ce6);}(_0x05ab,0x1a3));var _0xb05a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x05ab[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports['create']=function(_0xf27ffa){return client[_0xb05a('0x0')](_0xb05a('0x1'),{'body':_0xf27ffa,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x9e2d=['create','createSmsMessage','../client'];(function(_0x520d63,_0x5d2466){var _0x222d6f=function(_0x295ab9){while(--_0x295ab9){_0x520d63['push'](_0x520d63['shift']());}};_0x222d6f(++_0x5d2466);}(_0x9e2d,0xc8));var _0xd9e2=function(_0x464794,_0x36fbcc){_0x464794=_0x464794-0x0;var _0x2d86f8=_0x9e2d[_0x464794];return _0x2d86f8;};'use strict';var client=require(_0xd9e2('0x0'));exports[_0xd9e2('0x1')]=function(_0x10b751){return client['Request']('CreateSmsMessage',{'body':_0x10b751,'log':_0xd9e2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1ef126b..6862754 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 _0x7db4=['Request','GetSmsQueue','name','timeout','User','Agents','smsPause','../client','getSmsQueues'];(function(_0x263bea,_0x1e091b){var _0x361739=function(_0x460f8d){while(--_0x460f8d){_0x263bea['push'](_0x263bea['shift']());}};_0x361739(++_0x1e091b);}(_0x7db4,0x127));var _0x47db=function(_0x1d00c7,_0x9b96b2){_0x1d00c7=_0x1d00c7-0x0;var _0x5b4f51=_0x7db4[_0x1d00c7];return _0x5b4f51;};'use strict';var client=require(_0x47db('0x0'));exports[_0x47db('0x1')]=function(){return function(){return client[_0x47db('0x2')](_0x47db('0x3'),{'options':{'raw':![],'attributes':['id',_0x47db('0x4'),_0x47db('0x5'),'strategy'],'include':[{'model':_0x47db('0x6'),'as':_0x47db('0x7'),'attributes':['id',_0x47db('0x4'),'online',_0x47db('0x8')]}]},'log':_0x47db('0x1')});};}; \ No newline at end of file +var _0xd576=['name','timeout','strategy','User','online','smsPause','../client','getSmsQueues','Request'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd576,0xb1));var _0x6d57=function(_0x257d90,_0x47274f){_0x257d90=_0x257d90-0x0;var _0x1ae1f2=_0xd576[_0x257d90];return _0x1ae1f2;};'use strict';var client=require(_0x6d57('0x0'));exports[_0x6d57('0x1')]=function(){return function(){return client[_0x6d57('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6d57('0x3'),_0x6d57('0x4'),_0x6d57('0x5')],'include':[{'model':_0x6d57('0x6'),'as':'Agents','attributes':['id',_0x6d57('0x3'),_0x6d57('0x7'),_0x6d57('0x8')]}]},'log':_0x6d57('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b63f32e..7312ddb 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 _0x1a40=['DESC','../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x597448,_0x5d711e){var _0x53a7cc=function(_0x846a16){while(--_0x846a16){_0x597448['push'](_0x597448['shift']());}};_0x53a7cc(++_0x5d711e);}(_0x1a40,0xb7));var _0x01a4=function(_0x328f4e,_0x4e1ef7){_0x328f4e=_0x328f4e-0x0;var _0x52896b=_0x1a40[_0x328f4e];return _0x52896b;};'use strict';var client=require(_0x01a4('0x0'));exports[_0x01a4('0x1')]=function(_0x326735){return client[_0x01a4('0x2')](_0x01a4('0x3'),{'body':_0x326735,'log':_0x01a4('0x3')});};exports[_0x01a4('0x4')]=function(_0x3037c3,_0x3c096a){return client[_0x01a4('0x2')](_0x01a4('0x5'),{'body':_0x3c096a,'options':{'where':{'uniqueid':_0x3037c3},'order':[['id',_0x01a4('0x6')]],'limit':0x1},'log':_0x01a4('0x5')});}; \ No newline at end of file +var _0xef0b=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client'];(function(_0x47b595,_0x1b9afe){var _0x20e49e=function(_0x122c0d){while(--_0x122c0d){_0x47b595['push'](_0x47b595['shift']());}};_0x20e49e(++_0x1b9afe);}(_0xef0b,0x1d7));var _0xbef0=function(_0x3958f2,_0x47bbd7){_0x3958f2=_0x3958f2-0x0;var _0x428287=_0xef0b[_0x3958f2];return _0x428287;};'use strict';var client=require(_0xbef0('0x0'));exports['create']=function(_0x100c98){return client['Request'](_0xbef0('0x1'),{'body':_0x100c98,'log':_0xbef0('0x1')});};exports['update']=function(_0x40f20f,_0x532c83){return client['Request'](_0xbef0('0x2'),{'body':_0x532c83,'options':{'where':{'uniqueid':_0x40f20f},'order':[['id',_0xbef0('0x3')]],'limit':0x1},'log':_0xbef0('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4f3c2e8..5eca941 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 _0x74e5=['whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','online','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0x74e5,0xf2));var _0x574e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x74e5[_0x46aff0];return _0x9d78cf;};'use strict';var client=require(_0x574e('0x0'));exports[_0x574e('0x1')]=function(){return function(){return client[_0x574e('0x2')](_0x574e('0x3'),{'options':{'raw':!![],'where':{'role':_0x574e('0x4')},'attributes':['id',_0x574e('0x5'),_0x574e('0x6'),'pauseType',_0x574e('0x7'),_0x574e('0x8'),_0x574e('0x9'),_0x574e('0xa'),_0x574e('0xb'),_0x574e('0xc'),_0x574e('0xd'),_0x574e('0xe'),_0x574e('0xf'),'mailCapacity',_0x574e('0x10'),_0x574e('0x11'),_0x574e('0x12'),_0x574e('0x13')]},'log':_0x574e('0x1')});};}; \ No newline at end of file +var _0xb5f4=['faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause'];(function(_0x4eee80,_0x4a0b9a){var _0x10d6f0=function(_0x1ac511){while(--_0x1ac511){_0x4eee80['push'](_0x4eee80['shift']());}};_0x10d6f0(++_0x4a0b9a);}(_0xb5f4,0x185));var _0x4b5f=function(_0x129d9c,_0x14ea32){_0x129d9c=_0x129d9c-0x0;var _0x34eac0=_0xb5f4[_0x129d9c];return _0x34eac0;};'use strict';var client=require(_0x4b5f('0x0'));exports[_0x4b5f('0x1')]=function(){return function(){return client[_0x4b5f('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x4b5f('0x3')},'attributes':['id',_0x4b5f('0x4'),_0x4b5f('0x5'),_0x4b5f('0x6'),_0x4b5f('0x7'),_0x4b5f('0x8'),_0x4b5f('0x9'),_0x4b5f('0xa'),_0x4b5f('0xb'),_0x4b5f('0xc'),'whatsappPause',_0x4b5f('0xd'),_0x4b5f('0xe'),_0x4b5f('0xf'),_0x4b5f('0x10'),_0x4b5f('0x11'),_0x4b5f('0x12'),_0x4b5f('0x13')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 1cdb95d..aa48f11 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 _0x032a=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x2715ba,_0x5b4bbc){var _0x4c0bf1=function(_0x1da24c){while(--_0x1da24c){_0x2715ba['push'](_0x2715ba['shift']());}};_0x4c0bf1(++_0x5b4bbc);}(_0x032a,0xf0));var _0xa032=function(_0x4b775b,_0x2aadc6){_0x4b775b=_0x4b775b-0x0;var _0xf84d39=_0x032a[_0x4b775b];return _0xf84d39;};'use strict';var client=require('../client');exports[_0xa032('0x0')]=function(_0x591b65,_0xb3b072){return client[_0xa032('0x1')](_0xa032('0x2'),{'body':_0xb3b072,'options':{'where':{'id':_0x591b65}},'log':_0xa032('0x3')});};exports[_0xa032('0x4')]=function(_0x23ad84,_0x24612f){return client[_0xa032('0x1')](_0xa032('0x5'),{'body':_0x24612f,'options':{'where':{'id':_0x23ad84}},'log':_0xa032('0x6')});}; \ No newline at end of file +var _0x097c=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x1a504a,_0x13d3a0){var _0x507800=function(_0x236331){while(--_0x236331){_0x1a504a['push'](_0x1a504a['shift']());}};_0x507800(++_0x13d3a0);}(_0x097c,0x1d5));var _0xc097=function(_0x21fbf5,_0x20410c){_0x21fbf5=_0x21fbf5-0x0;var _0x197b39=_0x097c[_0x21fbf5];return _0x197b39;};'use strict';var client=require(_0xc097('0x0'));exports[_0xc097('0x1')]=function(_0x334a7c,_0x4b26f6){return client[_0xc097('0x2')](_0xc097('0x3'),{'body':_0x4b26f6,'options':{'where':{'id':_0x334a7c}},'log':_0xc097('0x4')});};exports[_0xc097('0x5')]=function(_0x5aa3c1,_0x265284){return client['Request'](_0xc097('0x6'),{'body':_0x265284,'options':{'where':{'id':_0x5aa3c1}},'log':_0xc097('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5336e67..1da6608 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 _0xfc76=['createWhatsappMessage','../client','Request','CreateWhatsappMessage'];(function(_0x560924,_0x258a47){var _0x5c694d=function(_0x599a81){while(--_0x599a81){_0x560924['push'](_0x560924['shift']());}};_0x5c694d(++_0x258a47);}(_0xfc76,0x13d));var _0x6fc7=function(_0x4d62ba,_0x4bc255){_0x4d62ba=_0x4d62ba-0x0;var _0x51e316=_0xfc76[_0x4d62ba];return _0x51e316;};'use strict';var client=require(_0x6fc7('0x0'));exports['create']=function(_0x51feb7){return client[_0x6fc7('0x1')](_0x6fc7('0x2'),{'body':_0x51feb7,'log':_0x6fc7('0x3')});}; \ No newline at end of file +var _0x3dd4=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x37b38f,_0x429fbe){var _0x297fa1=function(_0x20de0d){while(--_0x20de0d){_0x37b38f['push'](_0x37b38f['shift']());}};_0x297fa1(++_0x429fbe);}(_0x3dd4,0x11d));var _0x43dd=function(_0x43f611,_0x484dd2){_0x43f611=_0x43f611-0x0;var _0x466764=_0x3dd4[_0x43f611];return _0x466764;};'use strict';var client=require(_0x43dd('0x0'));exports[_0x43dd('0x1')]=function(_0x308e03){return client[_0x43dd('0x2')](_0x43dd('0x3'),{'body':_0x308e03,'log':_0x43dd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d52b1bc..909f7e7 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 _0xb9be=['GetWhatsappQueue','name','timeout','strategy','User','Agents','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x3eede2,_0x6327ac){var _0xb9be5e=function(_0x1897e8){while(--_0x1897e8){_0x3eede2['push'](_0x3eede2['shift']());}};_0xb9be5e(++_0x6327ac);}(_0xb9be,0xc5));var _0xeb9b=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0xb9be[_0xbc4560];return _0x298cfb;};'use strict';var client=require(_0xeb9b('0x0'));exports[_0xeb9b('0x1')]=function(){return function(){return client[_0xeb9b('0x2')](_0xeb9b('0x3'),{'options':{'raw':![],'attributes':['id',_0xeb9b('0x4'),_0xeb9b('0x5'),_0xeb9b('0x6')],'include':[{'model':_0xeb9b('0x7'),'as':_0xeb9b('0x8'),'attributes':['id','name','online',_0xeb9b('0x9')]}]},'log':_0xeb9b('0x1')});};}; \ No newline at end of file +var _0x253d=['name','whatsappPause','getWhatsappQueues','../client','timeout','strategy','User','Agents'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x253d,0x1b3));var _0xd253=function(_0x3fb54b,_0x3def31){_0x3fb54b=_0x3fb54b-0x0;var _0x564de5=_0x253d[_0x3fb54b];return _0x564de5;};'use strict';var client=require(_0xd253('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xd253('0x1'),_0xd253('0x2')],'include':[{'model':_0xd253('0x3'),'as':_0xd253('0x4'),'attributes':['id',_0xd253('0x5'),'online',_0xd253('0x6')]}]},'log':_0xd253('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 6bb5afe..2a8ec9d 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 _0x9587=['../client','create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x9587,0x11f));var _0x7958=function(_0x2a4dda,_0x394a1b){_0x2a4dda=_0x2a4dda-0x0;var _0xe725e=_0x9587[_0x2a4dda];return _0xe725e;};'use strict';var client=require(_0x7958('0x0'));exports[_0x7958('0x1')]=function(_0x16f0f3){return client['Request'](_0x7958('0x2'),{'body':_0x16f0f3,'log':'CreateWhatsappQueueReport'});};exports[_0x7958('0x3')]=function(_0x526f5c,_0x775833){return client[_0x7958('0x4')](_0x7958('0x5'),{'body':_0x775833,'options':{'where':{'uniqueid':_0x526f5c},'order':[['id',_0x7958('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x23b5=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create'];(function(_0x593617,_0x5f0ce2){var _0xd4372=function(_0x3b5021){while(--_0x3b5021){_0x593617['push'](_0x593617['shift']());}};_0xd4372(++_0x5f0ce2);}(_0x23b5,0x148));var _0x523b=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x23b5[_0x12bcf7];return _0x2825a;};'use strict';var client=require(_0x523b('0x0'));exports[_0x523b('0x1')]=function(_0x5e32f3){return client[_0x523b('0x2')](_0x523b('0x3'),{'body':_0x5e32f3,'log':_0x523b('0x3')});};exports[_0x523b('0x4')]=function(_0x22d0e1,_0x2e7126){return client[_0x523b('0x2')]('UpdateWhatsappQueueReport',{'body':_0x2e7126,'options':{'where':{'uniqueid':_0x22d0e1},'order':[['id','DESC']],'limit':0x1},'log':_0x523b('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 768ac71..4808792 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 _0x03f5=['agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','channel','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x03f5,0x6c));var _0x503f=function(_0x3a81f7,_0x566379){_0x3a81f7=_0x3a81f7-0x0;var _0x5a5f8c=_0x03f5[_0x3a81f7];return _0x5a5f8c;};'use strict';var schema=require(_0x503f('0x0'));var _=require(_0x503f('0x1'));var util=require(_0x503f('0x2'));var seqqueue=require(_0x503f('0x3'));var logger=require(_0x503f('0x4'))(_0x503f('0x5'));var strategy=require(_0x503f('0x6'));var queue=schema({'name':{'type':_0x503f('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x503f('0x8')}});function writeLog(_0x37f98d,_0x692c0b,_0x548642){return logger[_0x503f('0x9')](util[_0x503f('0xa')](_0x503f('0xb'),_0x37f98d,_0x692c0b['name'],_0x548642));}function handleFindAgent(_0x34cc3e){return function(_0x5c8e51){return _0x5c8e51[_0x503f('0xc')][_0x503f('0xd')]()===_0x34cc3e[_0x503f('0xd')]();};}exports[_0x503f('0xe')]=function(_0x30b85e,_0x3cb6e0,_0x414121,_0xe26733){return function(_0x2a6770){try{var _0x5dadf7={'name':_0x3cb6e0[0x0],'timeout':_0x3cb6e0[0x1]};var _0x550dcd=queue['validate'](_0x5dadf7,{'typecast':!![]});if(_0x550dcd[_0x503f('0xf')]){logger[_0x503f('0x10')](_0x503f('0x11'),_0x30b85e,_[_0x503f('0x12')](_0x550dcd,_0x503f('0x13'))[_0x503f('0x14')](',\x20'));_0x2a6770[_0x503f('0x15')]();}else{var _0x3d41fb=_['find'](_0x414121[_0x503f('0x16')],handleFindAgent(_0x5dadf7[_0x503f('0xc')]));if(_0x3d41fb){var _0x5c001c=(_0x5dadf7[_0x503f('0x17')]||0xa)*0x3e8;var _0x5d7887,_0x462d34;var _0x3497eb=seqqueue[_0x503f('0x18')](_0x5c001c);_0x3497eb['id']=_0x30b85e;_0x3497eb['atimeout']=_0x5c001c;_0x3497eb[_0x503f('0x19')]=_0xe26733['channel'];writeLog(_0x30b85e,_0x3d41fb,util[_0x503f('0xa')]('START:%s',_0x5c001c));_0x414121[_0x503f('0x1a')][_0x30b85e]['on'](_0x503f('0x1b'),function(){logger[_0x503f('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x30b85e);clearTimeout(_0x462d34);_0x462d34=undefined;_0x3497eb[_0x503f('0x1c')]();if(_0x414121['rules'][_0x30b85e]){delete _0x414121[_0x503f('0x1a')][_0x30b85e];}_0x2a6770['stop']();});_0x414121[_0x503f('0x1a')][_0x30b85e]['on'](_0x503f('0x1d'),function(){if(_0x414121[_0x503f('0x1a')][_0x30b85e]){delete _0x414121[_0x503f('0x1a')][_0x30b85e];}});_0x462d34=setTimeout(function(){logger[_0x503f('0x9')](_0x503f('0x1e'),_0x30b85e);clearTimeout(_0x462d34);_0x3497eb['close']();_0x2a6770[_0x503f('0x1f')]();},_0x5c001c);strategy[_0x503f('0x20')](_0x3497eb,_0x3d41fb,_0x414121,_0xe26733);}else{logger[_0x503f('0x10')](_0x503f('0x21'),_0x30b85e,_0x5dadf7['name']);_0x2a6770[_0x503f('0x15')]();}}}catch(_0x447237){console['log'](_0x447237);logger[_0x503f('0x10')](_0x503f('0x22'),_0x30b85e,_0x447237['stack']);_0x2a6770[_0x503f('0x15')]();}};}; \ No newline at end of file +var _0x4e71=['toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','close','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x3b7364,_0x1c861b){var _0x4aaa58=function(_0x5c406a){while(--_0x5c406a){_0x3b7364['push'](_0x3b7364['shift']());}};_0x4aaa58(++_0x1c861b);}(_0x4e71,0x115));var _0x14e7=function(_0x2d341e,_0x167cce){_0x2d341e=_0x2d341e-0x0;var _0x2917cc=_0x4e71[_0x2d341e];return _0x2917cc;};'use strict';var schema=require(_0x14e7('0x0'));var _=require('lodash');var util=require(_0x14e7('0x1'));var seqqueue=require(_0x14e7('0x2'));var logger=require('../../../../config/logger')(_0x14e7('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x14e7('0x4'),'required':!![],'message':_0x14e7('0x5')},'timeout':{'type':'number','message':_0x14e7('0x6')}});function writeLog(_0xce6bda,_0x51a338,_0x345b83){return logger[_0x14e7('0x7')](util[_0x14e7('0x8')](_0x14e7('0x9'),_0xce6bda,_0x51a338[_0x14e7('0xa')],_0x345b83));}function handleFindAgent(_0x5ec890){return function(_0x5e1944){return _0x5e1944['name'][_0x14e7('0xb')]()===_0x5ec890[_0x14e7('0xb')]();};}exports['consequence']=function(_0x587e81,_0x368dab,_0x9f821f,_0x21efed){return function(_0x2f495b){try{var _0x308e67={'name':_0x368dab[0x0],'timeout':_0x368dab[0x1]};var _0x4bb4ed=queue['validate'](_0x308e67,{'typecast':!![]});if(_0x4bb4ed[_0x14e7('0xc')]){logger[_0x14e7('0xd')](_0x14e7('0xe'),_0x587e81,_[_0x14e7('0xf')](_0x4bb4ed,_0x14e7('0x10'))[_0x14e7('0x11')](',\x20'));_0x2f495b[_0x14e7('0x12')]();}else{var _0x1aebbb=_[_0x14e7('0x13')](_0x9f821f['agents'],handleFindAgent(_0x308e67[_0x14e7('0xa')]));if(_0x1aebbb){var _0x122fe6=(_0x308e67['timeout']||0xa)*0x3e8;var _0x2b8ed0,_0x1c38d4;var _0x15ac94=seqqueue['createQueue'](_0x122fe6);_0x15ac94['id']=_0x587e81;_0x15ac94[_0x14e7('0x14')]=_0x122fe6;_0x15ac94['channel']=_0x21efed[_0x14e7('0x15')];writeLog(_0x587e81,_0x1aebbb,util[_0x14e7('0x8')](_0x14e7('0x16'),_0x122fe6));_0x9f821f['rules'][_0x587e81]['on']('end',function(){logger[_0x14e7('0x7')](_0x14e7('0x17'),_0x587e81);clearTimeout(_0x1c38d4);_0x1c38d4=undefined;_0x15ac94['close']();if(_0x9f821f['rules'][_0x587e81]){delete _0x9f821f[_0x14e7('0x18')][_0x587e81];}_0x2f495b[_0x14e7('0x12')]();});_0x9f821f['rules'][_0x587e81]['on'](_0x14e7('0x19'),function(){if(_0x9f821f[_0x14e7('0x18')][_0x587e81]){delete _0x9f821f[_0x14e7('0x18')][_0x587e81];}});_0x1c38d4=setTimeout(function(){logger[_0x14e7('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x587e81);clearTimeout(_0x1c38d4);_0x15ac94[_0x14e7('0x1a')]();_0x2f495b[_0x14e7('0x1b')]();},_0x122fe6);strategy[_0x14e7('0x1c')](_0x15ac94,_0x1aebbb,_0x9f821f,_0x21efed);}else{logger[_0x14e7('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x587e81,_0x308e67['name']);_0x2f495b['stop']();}}}catch(_0x1f08fa){console[_0x14e7('0x1d')](_0x1f08fa);logger[_0x14e7('0xd')](_0x14e7('0x1e'),_0x587e81,_0x1f08fa[_0x14e7('0x1f')]);_0x2f495b[_0x14e7('0x12')]();}};}; \ 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 2f0dedf..0844f2d 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 _0xd50f=['../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','providerName','providerResponse','stringify','dialogState','Failed','lodash','./utils'];(function(_0xb18b17,_0x121eb1){var _0xd1ff7c=function(_0x3eea6f){while(--_0x3eea6f){_0xb18b17['push'](_0xb18b17['shift']());}};_0xd1ff7c(++_0x121eb1);}(_0xd50f,0x1ac));var _0xfd50=function(_0x2f1f03,_0x1515b5){_0x2f1f03=_0x2f1f03-0x0;var _0x3063ef=_0xd50f[_0x2f1f03];return _0x3063ef;};'use strict';var _=require(_0xfd50('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xfd50('0x1'));var logger=require(_0xfd50('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xfd50('0x3')),'mailMessage':require(_0xfd50('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfd50('0x5'))};exports['consequence']=function(_0x507112,_0xe25b4a){return function(_0x46acee){try{if(!_[_0xfd50('0x6')](this[_0xfd50('0x7')]['UserId'])){logger[_0xfd50('0x8')]('[%s][AMAZONLEX]\x20%s',_0x507112,_0xfd50('0x9'));return _0x46acee[_0xfd50('0xa')]();}var _0x526fa9={'ContactId':this['contact']['id'],'sentAt':moment()[_0xfd50('0xb')](_0xfd50('0xc')),'direction':_0xfd50('0xd')};if(this[_0xfd50('0xe')]==='sms'||this[_0xfd50('0xe')]==='whatsapp'){_0x526fa9[_0xfd50('0xf')]=this[_0xfd50('0x7')][_0xfd50('0xf')];}var _0x4bdad4=this[_0xfd50('0xe')];if(_0x4bdad4===_0xfd50('0x10')){_0x526fa9[_0xfd50('0x11')]=this[_0xfd50('0x12')]['id'];}else{_0x526fa9[_[_0xfd50('0x13')](_0x4bdad4)+_0xfd50('0x14')]=this[_0xfd50('0x12')]['id'];}_0x526fa9[_[_0xfd50('0x13')](_0x4bdad4)+_0xfd50('0x15')]=this[_0xfd50('0x7')]['id'];if(this[_0xfd50('0x7')][_0xfd50('0x16')]){var _0x5b1fcf=_0xe25b4a[0x4];if(!_[_0xfd50('0x17')](_0x5b1fcf)){_0x526fa9[_0xfd50('0x18')]=utils[_0xfd50('0x19')](_0x5b1fcf,this);return rpc[_0x4bdad4+_0xfd50('0x1a')][_0xfd50('0x1b')](_0x526fa9)[_0xfd50('0x1c')](function(_0x1e8419){logger[_0xfd50('0x8')](_0xfd50('0x1d'),_0x507112,_0x526fa9[_0xfd50('0x18')]);})[_0xfd50('0x1e')](function(_0x4ba6f3){logger[_0xfd50('0x1f')](_0xfd50('0x1d'),_0x507112,JSON['stringify'](_0x4ba6f3));})['finally'](function(){logger[_0xfd50('0x8')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x507112);_0x46acee[_0xfd50('0x20')]();});}else{logger['info'](_0xfd50('0x21'),_0x507112);_0x46acee['stop']();}}else{var _0x24dfe5=this;var _0x341da4=new AWS['LexRuntime']({'accessKeyId':_0xe25b4a[0x0],'secretAccessKey':_0xe25b4a[0x1],'region':_0xe25b4a[0x2]});var _0x3c608f={'botAlias':_0xfd50('0x22'),'botName':_0xe25b4a[0x3],'inputText':this[_0xfd50('0x23')][_0xfd50('0x18')],'userId':this[_0xfd50('0xe')]+':'+this[_0xfd50('0x7')]['id'][_0xfd50('0x24')]()};_0x341da4[_0xfd50('0x25')](_0x3c608f,function(_0x547d3b,_0x261d0d){if(_0x547d3b){logger['error'](_0xfd50('0x1d'),_0x507112,_0x547d3b[_0xfd50('0x23')]);_0x46acee['next']();}else if(_0x261d0d&&_0x261d0d[_0xfd50('0x23')]){_0x24dfe5[_0xfd50('0x18')]['amazonlex']=_0x261d0d;_0x526fa9[_0xfd50('0x18')]=_0x261d0d[_0xfd50('0x23')];_0x526fa9[_0xfd50('0x26')]='amazonlex';_0x526fa9[_0xfd50('0x27')]=JSON[_0xfd50('0x28')](_0x261d0d);return rpc[_0x4bdad4+_0xfd50('0x1a')][_0xfd50('0x1b')](_0x526fa9)['then'](function(_0x3a81ea){logger[_0xfd50('0x8')](_0xfd50('0x1d'),_0x507112,_0x526fa9['body']);if(_0x261d0d[_0xfd50('0x29')]==_0xfd50('0x2a')){_0x46acee['next']();}else{_0x46acee[_0xfd50('0x20')]();}})[_0xfd50('0x1e')](function(_0x2468bf){logger[_0xfd50('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x507112,JSON['stringify'](_0x2468bf));_0x46acee['next']();});}else{_0x46acee[_0xfd50('0xa')]();}});}}catch(_0x2d4356){logger[_0xfd50('0x1f')](_0xfd50('0x1d'),_0x507112,JSON['stringify'](_0x2d4356));_0x46acee[_0xfd50('0x20')]();}};}; \ No newline at end of file +var _0x6aae=['aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','[%s][AMAZONLEX]\x20%s','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText','error','amazonlex','providerName','providerResponse','Failed','catch','lodash','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6aae,0x64));var _0xe6aa=function(_0x1ebc11,_0xaeefe8){_0x1ebc11=_0x1ebc11-0x0;var _0x27757b=_0x6aae[_0x1ebc11];return _0x27757b;};'use strict';var _=require(_0xe6aa('0x0'));var moment=require(_0xe6aa('0x1'));var AWS=require(_0xe6aa('0x2'));var utils=require(_0xe6aa('0x3'));var logger=require('../../../../config/logger')(_0xe6aa('0x4'));var rpc={'chatMessage':require(_0xe6aa('0x5')),'openchannelMessage':require(_0xe6aa('0x6')),'mailMessage':require(_0xe6aa('0x7')),'smsMessage':require(_0xe6aa('0x8')),'faxMessage':require(_0xe6aa('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xe6aa('0xa')]=function(_0x2e9673,_0xa5b714){return function(_0x1b644c){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0xe6aa('0xb')]('[%s][AMAZONLEX]\x20%s',_0x2e9673,_0xe6aa('0xc'));return _0x1b644c[_0xe6aa('0xd')]();}var _0x474e55={'ContactId':this[_0xe6aa('0xe')]['id'],'sentAt':moment()[_0xe6aa('0xf')](_0xe6aa('0x10')),'direction':_0xe6aa('0x11')};if(this[_0xe6aa('0x12')]===_0xe6aa('0x13')||this['channel']===_0xe6aa('0x14')){_0x474e55[_0xe6aa('0x15')]=this[_0xe6aa('0x16')][_0xe6aa('0x15')];}var _0x360118=this[_0xe6aa('0x12')];if(_0x360118===_0xe6aa('0x17')){_0x474e55[_0xe6aa('0x18')]=this[_0xe6aa('0x19')]['id'];}else{_0x474e55[_[_0xe6aa('0x1a')](_0x360118)+_0xe6aa('0x1b')]=this[_0xe6aa('0x19')]['id'];}_0x474e55[_[_0xe6aa('0x1a')](_0x360118)+_0xe6aa('0x1c')]=this[_0xe6aa('0x16')]['id'];if(this[_0xe6aa('0x16')][_0xe6aa('0x1d')]){var _0x25f420=_0xa5b714[0x4];if(!_[_0xe6aa('0x1e')](_0x25f420)){_0x474e55['body']=utils[_0xe6aa('0x1f')](_0x25f420,this);return rpc[_0x360118+_0xe6aa('0x20')][_0xe6aa('0x21')](_0x474e55)[_0xe6aa('0x22')](function(_0x326991){logger[_0xe6aa('0xb')]('[%s][AMAZONLEX]\x20%s',_0x2e9673,_0x474e55[_0xe6aa('0x23')]);})['catch'](function(_0x490000){logger['error'](_0xe6aa('0x24'),_0x2e9673,JSON[_0xe6aa('0x25')](_0x490000));})[_0xe6aa('0x26')](function(){logger[_0xe6aa('0xb')](_0xe6aa('0x27'),_0x2e9673);_0x1b644c[_0xe6aa('0x28')]();});}else{logger[_0xe6aa('0xb')](_0xe6aa('0x29'),_0x2e9673);_0x1b644c[_0xe6aa('0x28')]();}}else{var _0x45817b=this;var _0x4c013e=new AWS[(_0xe6aa('0x2a'))]({'accessKeyId':_0xa5b714[0x0],'secretAccessKey':_0xa5b714[0x1],'region':_0xa5b714[0x2]});var _0x2a2a4f={'botAlias':'$LATEST','botName':_0xa5b714[0x3],'inputText':this[_0xe6aa('0x2b')][_0xe6aa('0x23')],'userId':this[_0xe6aa('0x12')]+':'+this['interaction']['id']['toString']()};_0x4c013e[_0xe6aa('0x2c')](_0x2a2a4f,function(_0xbf2088,_0x308011){if(_0xbf2088){logger[_0xe6aa('0x2d')](_0xe6aa('0x24'),_0x2e9673,_0xbf2088['message']);_0x1b644c[_0xe6aa('0xd')]();}else if(_0x308011&&_0x308011[_0xe6aa('0x2b')]){_0x45817b[_0xe6aa('0x23')][_0xe6aa('0x2e')]=_0x308011;_0x474e55['body']=_0x308011['message'];_0x474e55[_0xe6aa('0x2f')]='amazonlex';_0x474e55[_0xe6aa('0x30')]=JSON[_0xe6aa('0x25')](_0x308011);return rpc[_0x360118+_0xe6aa('0x20')][_0xe6aa('0x21')](_0x474e55)['then'](function(_0x567c94){logger['info'](_0xe6aa('0x24'),_0x2e9673,_0x474e55['body']);if(_0x308011['dialogState']==_0xe6aa('0x31')){_0x1b644c[_0xe6aa('0xd')]();}else{_0x1b644c['stop']();}})[_0xe6aa('0x32')](function(_0x31b38c){logger['error']('[%s][AMAZONLEX]\x20%s',_0x2e9673,JSON[_0xe6aa('0x25')](_0x31b38c));_0x1b644c[_0xe6aa('0xd')]();});}else{_0x1b644c[_0xe6aa('0xd')]();}});}}catch(_0x30e839){logger[_0xe6aa('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x2e9673,JSON['stringify'](_0x30e839));_0x1b644c[_0xe6aa('0x28')]();}};}; \ 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 4412dbf..c2ff162 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 _0x4eb8=['service','host','port','secure','auth','user','pass','inReplyTo','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','next','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp'];(function(_0x81ee5a,_0x3c5181){var _0x52a8c8=function(_0x49d3c1){while(--_0x49d3c1){_0x81ee5a['push'](_0x81ee5a['shift']());}};_0x52a8c8(++_0x3c5181);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x38b255,_0x3fd343){_0x38b255=_0x38b255-0x0;var _0x26f9bb=_0x4eb8[_0x38b255];return _0x26f9bb;};'use strict';var _=require(_0x84eb('0x0'));var moment=require(_0x84eb('0x1'));var utils=require(_0x84eb('0x2'));var logger=require(_0x84eb('0x3'))('routing');var rpc={'chatMessage':require(_0x84eb('0x4')),'openchannelMessage':require(_0x84eb('0x5')),'mailMessage':require(_0x84eb('0x6')),'smsMessage':require(_0x84eb('0x7')),'faxMessage':require(_0x84eb('0x8')),'whatsappMessage':require(_0x84eb('0x9'))};var mailRpc=require(_0x84eb('0xa'));exports[_0x84eb('0xb')]=function(_0x3a8e37,_0x594e38){return function(_0x131076){try{if(_0x594e38[0x0]==='1'&&(_[_0x84eb('0xc')](this[_0x84eb('0xd')][_0x84eb('0xe')])||!this[_0x84eb('0xd')][_0x84eb('0xe')])){logger[_0x84eb('0xf')](_0x84eb('0x10'),_0x3a8e37,_0x84eb('0x11'));return _0x131076['next']();}var _0x15ee2b=this[_0x84eb('0x12')];var _0x1d3996={'ContactId':this[_0x84eb('0x13')]['id'],'sentAt':moment()['format'](_0x84eb('0x14')),'direction':_0x84eb('0x15')};if(this[_0x84eb('0x12')]===_0x84eb('0x16')){_0x1d3996[_0x84eb('0x17')]=utils['getMustacheRender'](_0x594e38[0x2],this);}else{_0x1d3996[_0x84eb('0x17')]=utils[_0x84eb('0x18')](_0x594e38[0x1],this);}if(this[_0x84eb('0x19')]){_0x1d3996['to']=this[_0x84eb('0x19')][_0x84eb('0x1a')]||'';if(this[_0x84eb('0x12')]===_0x84eb('0x16')&&_0x594e38[0x1]==='1'){_0x1d3996['cc']=this[_0x84eb('0x19')]['cc']||'';}_0x1d3996[_0x84eb('0x1a')]=this[_0x84eb('0x19')]['to']||'';_0x1d3996[_0x84eb('0x1b')]=this[_0x84eb('0x19')]['phone']||'';_0x1d3996[_0x84eb('0x1c')]=!![];if(this[_0x84eb('0x19')][_0x84eb('0x1d')]){_0x1d3996[_0x84eb('0x1d')]='';_0x1d3996['subject']+=_['startsWith'](this['message']['subject'],_0x84eb('0x1e'))?'':_0x84eb('0x1f');_0x1d3996[_0x84eb('0x1d')]+=this['message'][_0x84eb('0x1d')];}}if(this[_0x84eb('0x12')]===_0x84eb('0x20')){_0x1d3996[_0x84eb('0x21')]=this[_0x84eb('0x22')]['id'];}else{_0x1d3996[_[_0x84eb('0x23')](this[_0x84eb('0x12')])+'AccountId']=this[_0x84eb('0x22')]['id'];}_0x1d3996[_[_0x84eb('0x23')](this['channel'])+_0x84eb('0x24')]=this['interaction']['id'];if(rpc[this[_0x84eb('0x12')]+_0x84eb('0x25')]){if(this['channel']===_0x84eb('0x16')){var _0x1fb507={'tls':{'rejectUnauthorized':![]}};if(this[_0x84eb('0x22')][_0x84eb('0x26')][_0x84eb('0x27')]){_0x1fb507[_0x84eb('0x27')]=this[_0x84eb('0x22')][_0x84eb('0x26')]['service'];}else{_0x1fb507[_0x84eb('0x28')]=this[_0x84eb('0x22')][_0x84eb('0x26')][_0x84eb('0x28')];_0x1fb507[_0x84eb('0x29')]=this[_0x84eb('0x22')][_0x84eb('0x26')][_0x84eb('0x29')];_0x1fb507[_0x84eb('0x2a')]=this[_0x84eb('0x22')][_0x84eb('0x26')][_0x84eb('0x2a')];}if(this[_0x84eb('0x22')][_0x84eb('0x26')]['authentication']){_0x1fb507[_0x84eb('0x2b')]={'user':this[_0x84eb('0x22')][_0x84eb('0x26')][_0x84eb('0x2c')],'pass':this[_0x84eb('0x22')]['Smtp'][_0x84eb('0x2d')]};}_0x1d3996[_0x84eb('0x2e')]=this[_0x84eb('0x19')]['messageId'];_0x1d3996[_0x84eb('0x2f')]=_0x84eb('0x30')+_[_0x84eb('0x31')](_0x1d3996['body'],_0x84eb('0x32'),'','headers'];(function(_0x3d2cd2,_0x2d844e){var _0x348a86=function(_0x431580){while(--_0x431580){_0x3d2cd2['push'](_0x3d2cd2['shift']());}};_0x348a86(++_0x2d844e);}(_0x8f1a,0xcd));var _0xa8f1=function(_0xf09220,_0x32bf6d){_0xf09220=_0xf09220-0x0;var _0x5efdb3=_0x8f1a[_0xf09220];return _0x5efdb3;};'use strict';var _=require(_0xa8f1('0x0'));var moment=require(_0xa8f1('0x1'));var utils=require(_0xa8f1('0x2'));var logger=require(_0xa8f1('0x3'))(_0xa8f1('0x4'));var rpc={'chatMessage':require(_0xa8f1('0x5')),'openchannelMessage':require(_0xa8f1('0x6')),'mailMessage':require(_0xa8f1('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa8f1('0x8'))};var mailRpc=require('../../mailRpc');exports[_0xa8f1('0x9')]=function(_0x3d62e4,_0x4c2920){return function(_0x43c3ed){try{if(_0x4c2920[0x0]==='1'&&(_[_0xa8f1('0xa')](this[_0xa8f1('0xb')][_0xa8f1('0xc')])||!this[_0xa8f1('0xb')][_0xa8f1('0xc')])){logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x3d62e4,'Autoreply\x20already\x20sent');return _0x43c3ed[_0xa8f1('0xf')]();}var _0x4403a8=this['channel'];var _0x12e0a7={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa8f1('0x10')](_0xa8f1('0x11')),'direction':_0xa8f1('0x12')};if(this['channel']===_0xa8f1('0x13')){_0x12e0a7[_0xa8f1('0x14')]=utils[_0xa8f1('0x15')](_0x4c2920[0x2],this);}else{_0x12e0a7[_0xa8f1('0x14')]=utils[_0xa8f1('0x15')](_0x4c2920[0x1],this);}if(this['message']){_0x12e0a7['to']=this[_0xa8f1('0x16')]['from']||'';if(this[_0xa8f1('0x17')]===_0xa8f1('0x13')&&_0x4c2920[0x1]==='1'){_0x12e0a7['cc']=this['message']['cc']||'';}_0x12e0a7['from']=this[_0xa8f1('0x16')]['to']||'';_0x12e0a7[_0xa8f1('0x18')]=this[_0xa8f1('0x16')][_0xa8f1('0x18')]||'';_0x12e0a7[_0xa8f1('0x19')]=!![];if(this[_0xa8f1('0x16')][_0xa8f1('0x1a')]){_0x12e0a7[_0xa8f1('0x1a')]='';_0x12e0a7[_0xa8f1('0x1a')]+=_[_0xa8f1('0x1b')](this[_0xa8f1('0x16')][_0xa8f1('0x1a')],_0xa8f1('0x1c'))?'':_0xa8f1('0x1d');_0x12e0a7['subject']+=this['message'][_0xa8f1('0x1a')];}}if(this[_0xa8f1('0x17')]===_0xa8f1('0x1e')){_0x12e0a7['ChatWebsiteId']=this[_0xa8f1('0x1f')]['id'];}else{_0x12e0a7[_[_0xa8f1('0x20')](this[_0xa8f1('0x17')])+_0xa8f1('0x21')]=this[_0xa8f1('0x1f')]['id'];}_0x12e0a7[_['upperFirst'](this[_0xa8f1('0x17')])+_0xa8f1('0x22')]=this['interaction']['id'];if(rpc[this[_0xa8f1('0x17')]+_0xa8f1('0x23')]){if(this[_0xa8f1('0x17')]===_0xa8f1('0x13')){var _0x2306ec={'tls':{'rejectUnauthorized':![]}};if(this[_0xa8f1('0x1f')][_0xa8f1('0x24')][_0xa8f1('0x25')]){_0x2306ec[_0xa8f1('0x25')]=this['account'][_0xa8f1('0x24')][_0xa8f1('0x25')];}else{_0x2306ec[_0xa8f1('0x26')]=this[_0xa8f1('0x1f')][_0xa8f1('0x24')]['host'];_0x2306ec[_0xa8f1('0x27')]=this[_0xa8f1('0x1f')]['Smtp']['port'];_0x2306ec['secure']=this[_0xa8f1('0x1f')][_0xa8f1('0x24')]['secure'];}if(this['account']['Smtp'][_0xa8f1('0x28')]){_0x2306ec[_0xa8f1('0x29')]={'user':this[_0xa8f1('0x1f')][_0xa8f1('0x24')][_0xa8f1('0x2a')],'pass':this[_0xa8f1('0x1f')][_0xa8f1('0x24')][_0xa8f1('0x2b')]};}_0x12e0a7[_0xa8f1('0x2c')]=this[_0xa8f1('0x16')][_0xa8f1('0x2d')];_0x12e0a7[_0xa8f1('0x2e')]=''+_['replace'](_0x12e0a7[_0xa8f1('0x14')],_0xa8f1('0x2f'),_0xa8f1('0x30'))+_0xa8f1('0x31');_0x12e0a7[_0xa8f1('0x32')]={'Auto-Submitted':_0xa8f1('0x33'),'X-Auto-Response-Suppress':_0xa8f1('0x34'),'Precedence':_0xa8f1('0x35')};return mailRpc[_0xa8f1('0x36')](_0x2306ec,_0x12e0a7)['then'](function(_0x59fbf4){logger['info'](_0xa8f1('0x37'),_0x3d62e4);_0x12e0a7[_0xa8f1('0x2d')]=_0x59fbf4[_0xa8f1('0x16')][_0xa8f1('0x2d')];return rpc[_0x4403a8+_0xa8f1('0x23')]['create'](_0x12e0a7);})['then'](function(_0x429ff8){logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x3d62e4,JSON[_0xa8f1('0x38')](_0x429ff8));})[_0xa8f1('0x39')](function(_0x592af7){logger[_0xa8f1('0x3a')](_0xa8f1('0x3b'),_0x3d62e4,JSON[_0xa8f1('0x38')](_0x592af7));})[_0xa8f1('0x3c')](function(){_0x43c3ed[_0xa8f1('0xf')]();});}else{return rpc[this['channel']+_0xa8f1('0x23')][_0xa8f1('0x3d')](_0x12e0a7)[_0xa8f1('0x3e')](function(_0x4656f6){logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x3d62e4,_0x12e0a7['body']);})[_0xa8f1('0x39')](function(_0x18e6f2){logger['error'](_0xa8f1('0xe'),_0x3d62e4,JSON['stringify'](_0x18e6f2));})[_0xa8f1('0x3c')](function(){_0x43c3ed[_0xa8f1('0xf')]();});}}}catch(_0xf946fa){logger[_0xa8f1('0x3a')](_0xa8f1('0xe'),_0x3d62e4,JSON['stringify'](_0xf946fa));_0x43c3ed[_0xa8f1('0x3f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 9e50733..82cbd7a 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0c9=['consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x55b426,_0x40fd14){var _0x5ceb81=function(_0x524000){while(--_0x524000){_0x55b426['push'](_0x55b426['shift']());}};_0x5ceb81(++_0x40fd14);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xd0c9[_0x12f688];return _0x59c3de;};'use strict';var moment=require(_0x9d0c('0x0'));var logger=require(_0x9d0c('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x9d0c('0x2')),'mailInteraction':require(_0x9d0c('0x3')),'faxInteraction':require(_0x9d0c('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x9d0c('0x5')]=function(_0x550596,_0x48b137,_0x6749,_0x5bcaf9){return function(_0x3eec5f){try{logger[_0x9d0c('0x6')](_0x9d0c('0x7'),_0x550596,_0x48b137[0x0]);var _0x413a70={'closed':0x1,'closedAt':moment()[_0x9d0c('0x8')](_0x9d0c('0x9')),'closeReason':'system','disposition':_0x48b137[0x0]};if(rpc[_0x5bcaf9[_0x9d0c('0xa')]+'Interaction']){rpc[_0x5bcaf9[_0x9d0c('0xa')]+_0x9d0c('0xb')][_0x9d0c('0xc')](_0x5bcaf9['interaction']['id'],_0x413a70)[_0x9d0c('0xd')](function(_0x2338b5){logger[_0x9d0c('0x6')](_0x9d0c('0xe'),_0x550596,_0x5bcaf9['interaction']['id']);})[_0x9d0c('0xf')](function(_0x575341){logger[_0x9d0c('0x10')](_0x9d0c('0x11'),_0x550596,JSON[_0x9d0c('0x12')](_0x575341));})[_0x9d0c('0x13')](function(){_0x3eec5f['stop']();});}}catch(_0x5b1b42){logger['error'](_0x9d0c('0x11'),_0x550596,JSON['stringify'](_0x5b1b42));_0x3eec5f[_0x9d0c('0x14')]();}};}; \ No newline at end of file +var _0xe558=['../../rpc/whatsappInteraction','info','format','system','channel','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','stop','error','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xe558,0x70));var _0x8e55=function(_0x462cdc,_0x1222e0){_0x462cdc=_0x462cdc-0x0;var _0x28bd92=_0xe558[_0x462cdc];return _0x28bd92;};'use strict';var moment=require(_0x8e55('0x0'));var logger=require(_0x8e55('0x1'))(_0x8e55('0x2'));var rpc={'chatInteraction':require(_0x8e55('0x3')),'openchannelInteraction':require(_0x8e55('0x4')),'smsInteraction':require(_0x8e55('0x5')),'mailInteraction':require(_0x8e55('0x6')),'faxInteraction':require(_0x8e55('0x7')),'whatsappInteraction':require(_0x8e55('0x8'))};exports['consequence']=function(_0xf125cc,_0x127fb4,_0x34d4ec,_0x3dff04){return function(_0x3cef42){try{logger[_0x8e55('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0xf125cc,_0x127fb4[0x0]);var _0xe27f09={'closed':0x1,'closedAt':moment()[_0x8e55('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x8e55('0xb'),'disposition':_0x127fb4[0x0]};if(rpc[_0x3dff04['channel']+'Interaction']){rpc[_0x3dff04[_0x8e55('0xc')]+'Interaction']['update'](_0x3dff04['interaction']['id'],_0xe27f09)[_0x8e55('0xd')](function(_0x39fa76){logger[_0x8e55('0x9')](_0x8e55('0xe'),_0xf125cc,_0x3dff04['interaction']['id']);})[_0x8e55('0xf')](function(_0x4fae32){logger['error']('[%s][CLOSE]\x20%s',_0xf125cc,JSON[_0x8e55('0x10')](_0x4fae32));})['finally'](function(){_0x3cef42[_0x8e55('0x11')]();});}}catch(_0x2a5545){logger[_0x8e55('0x12')](_0x8e55('0x13'),_0xf125cc,JSON[_0x8e55('0x10')](_0x2a5545));_0x3cef42[_0x8e55('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index d693bcd..a0f012c 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec9a=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','dialogflow','providerResponse','metadata','catch','lodash','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xec9a,0x196));var _0xaec9=function(_0x270037,_0xcb3091){_0x270037=_0x270037-0x0;var _0x4dc2b3=_0xec9a[_0x270037];return _0x4dc2b3;};'use strict';var _=require(_0xaec9('0x0'));var moment=require(_0xaec9('0x1'));var apiai=require('apiai-promise');var md5=require(_0xaec9('0x2'));var utils=require('./utils');var logger=require(_0xaec9('0x3'))(_0xaec9('0x4'));var rpc={'chatMessage':require(_0xaec9('0x5')),'openchannelMessage':require(_0xaec9('0x6')),'mailMessage':require(_0xaec9('0x7')),'smsMessage':require(_0xaec9('0x8')),'faxMessage':require(_0xaec9('0x9')),'whatsappMessage':require(_0xaec9('0xa'))};exports['consequence']=function(_0x385057,_0xdde75a){return function(_0x373b0e){try{if(!_[_0xaec9('0xb')](this[_0xaec9('0xc')][_0xaec9('0xd')])){logger[_0xaec9('0xe')](_0xaec9('0xf'),_0x385057,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x373b0e[_0xaec9('0x10')]();}var _0x35f2e9={'ContactId':this['contact']['id'],'sentAt':moment()[_0xaec9('0x11')](_0xaec9('0x12')),'direction':_0xaec9('0x13')};if(this[_0xaec9('0x14')]==='sms'||this[_0xaec9('0x14')]===_0xaec9('0x15')){_0x35f2e9[_0xaec9('0x16')]=this[_0xaec9('0xc')]['phone'];}var _0x36ebb1=this[_0xaec9('0x14')];if(_0x36ebb1==='chat'){_0x35f2e9['ChatWebsiteId']=this[_0xaec9('0x17')]['id'];}else{_0x35f2e9[_[_0xaec9('0x18')](_0x36ebb1)+_0xaec9('0x19')]=this[_0xaec9('0x17')]['id'];}_0x35f2e9[_[_0xaec9('0x18')](_0x36ebb1)+'InteractionId']=this['interaction']['id'];if(this[_0xaec9('0xc')][_0xaec9('0x1a')]){var _0x337b6f=_0xdde75a[0x2];if(!_[_0xaec9('0x1b')](_0x337b6f)){_0x35f2e9[_0xaec9('0x1c')]=utils[_0xaec9('0x1d')](_0x337b6f,this);return rpc[_0x36ebb1+_0xaec9('0x1e')][_0xaec9('0x1f')](_0x35f2e9)[_0xaec9('0x20')](function(_0x1bfa0b){logger[_0xaec9('0xe')](_0xaec9('0xf'),_0x385057,_0x35f2e9['body']);})['catch'](function(_0x1933e6){logger[_0xaec9('0x21')](_0xaec9('0xf'),_0x385057,JSON[_0xaec9('0x22')](_0x1933e6));})['finally'](function(){logger[_0xaec9('0xe')](_0xaec9('0x23'),_0x385057);_0x373b0e[_0xaec9('0x24')]();});}else{logger[_0xaec9('0xe')](_0xaec9('0x25'),_0x385057);_0x373b0e[_0xaec9('0x24')]();}}else{var _0x576ac6=this;var _0x4d7dd=apiai(_0xdde75a[0x0],{'language':_0xdde75a[0x1]||'en'});return _0x4d7dd[_0xaec9('0x26')](this[_0xaec9('0x27')][_0xaec9('0x1c')],{'sessionId':md5(this[_0xaec9('0xc')]['id'])})['then'](function(_0x8b6a60){_0x576ac6[_0xaec9('0x1c')]['dialogflow']=_0x8b6a60;_0x35f2e9[_0xaec9('0x1c')]=_0x8b6a60[_0xaec9('0x28')][_0xaec9('0x29')]['speech'];_0x35f2e9['providerName']=_0xaec9('0x2a');_0x35f2e9[_0xaec9('0x2b')]=JSON[_0xaec9('0x22')](_0x8b6a60);return rpc[_0x36ebb1+_0xaec9('0x1e')][_0xaec9('0x1f')](_0x35f2e9)[_0xaec9('0x20')](function(_0x535cf7){logger[_0xaec9('0xe')](_0xaec9('0xf'),_0x385057,_0x35f2e9[_0xaec9('0x1c')]);if(_0x8b6a60[_0xaec9('0x28')][_0xaec9('0x2c')]['endConversation']){_0x373b0e[_0xaec9('0x10')]();}else{_0x373b0e[_0xaec9('0x24')]();}})[_0xaec9('0x2d')](function(_0x57672c){logger[_0xaec9('0x21')](_0xaec9('0xf'),_0x385057,JSON['stringify'](_0x57672c));_0x373b0e[_0xaec9('0x10')]();});})[_0xaec9('0x2d')](function(_0x200bfb){logger[_0xaec9('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x385057,_0x200bfb[_0xaec9('0x27')]);_0x373b0e[_0xaec9('0x10')]();});}}catch(_0x12447a){logger[_0xaec9('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x385057,JSON[_0xaec9('0x22')](_0x12447a));_0x373b0e[_0xaec9('0x24')]();}};}; \ No newline at end of file +var _0x998d=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','upperFirst','InteractionId','interaction','created','isEmpty','body','getMustacheRender','create','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','metadata','stringify','message','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','next'];(function(_0x4df37a,_0x11988e){var _0x5a5925=function(_0x18b648){while(--_0x18b648){_0x4df37a['push'](_0x4df37a['shift']());}};_0x5a5925(++_0x11988e);}(_0x998d,0x11c));var _0xd998=function(_0x2c2c40,_0x29ef3f){_0x2c2c40=_0x2c2c40-0x0;var _0x4c74b0=_0x998d[_0x2c2c40];return _0x4c74b0;};'use strict';var _=require(_0xd998('0x0'));var moment=require(_0xd998('0x1'));var apiai=require(_0xd998('0x2'));var md5=require(_0xd998('0x3'));var utils=require(_0xd998('0x4'));var logger=require('../../../../config/logger')(_0xd998('0x5'));var rpc={'chatMessage':require(_0xd998('0x6')),'openchannelMessage':require(_0xd998('0x7')),'mailMessage':require(_0xd998('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd998('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd998('0xa')]=function(_0x1e81ef,_0x1ac7e1){return function(_0xfd33f8){try{if(!_[_0xd998('0xb')](this['interaction'][_0xd998('0xc')])){logger[_0xd998('0xd')](_0xd998('0xe'),_0x1e81ef,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xfd33f8[_0xd998('0xf')]();}var _0x418d65={'ContactId':this[_0xd998('0x10')]['id'],'sentAt':moment()[_0xd998('0x11')](_0xd998('0x12')),'direction':_0xd998('0x13')};if(this[_0xd998('0x14')]===_0xd998('0x15')||this['channel']===_0xd998('0x16')){_0x418d65['phone']=this['interaction']['phone'];}var _0x27ab0a=this['channel'];if(_0x27ab0a===_0xd998('0x17')){_0x418d65[_0xd998('0x18')]=this['account']['id'];}else{_0x418d65[_[_0xd998('0x19')](_0x27ab0a)+'AccountId']=this['account']['id'];}_0x418d65[_[_0xd998('0x19')](_0x27ab0a)+_0xd998('0x1a')]=this['interaction']['id'];if(this[_0xd998('0x1b')][_0xd998('0x1c')]){var _0x2dbe90=_0x1ac7e1[0x2];if(!_[_0xd998('0x1d')](_0x2dbe90)){_0x418d65[_0xd998('0x1e')]=utils[_0xd998('0x1f')](_0x2dbe90,this);return rpc[_0x27ab0a+'Message'][_0xd998('0x20')](_0x418d65)['then'](function(_0xd5ed87){logger[_0xd998('0xd')](_0xd998('0xe'),_0x1e81ef,_0x418d65[_0xd998('0x1e')]);})[_0xd998('0x21')](function(_0x513bbd){logger[_0xd998('0x22')](_0xd998('0xe'),_0x1e81ef,JSON['stringify'](_0x513bbd));})[_0xd998('0x23')](function(){logger[_0xd998('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1e81ef);_0xfd33f8['stop']();});}else{logger[_0xd998('0xd')](_0xd998('0x24'),_0x1e81ef);_0xfd33f8[_0xd998('0x25')]();}}else{var _0x4b6719=this;var _0xa44a3d=apiai(_0x1ac7e1[0x0],{'language':_0x1ac7e1[0x1]||'en'});return _0xa44a3d[_0xd998('0x26')](this['message'][_0xd998('0x1e')],{'sessionId':md5(this[_0xd998('0x1b')]['id'])})[_0xd998('0x27')](function(_0x5901b6){_0x4b6719[_0xd998('0x1e')][_0xd998('0x28')]=_0x5901b6;_0x418d65[_0xd998('0x1e')]=_0x5901b6[_0xd998('0x29')][_0xd998('0x2a')][_0xd998('0x2b')];_0x418d65[_0xd998('0x2c')]=_0xd998('0x28');_0x418d65[_0xd998('0x2d')]=JSON['stringify'](_0x5901b6);return rpc[_0x27ab0a+_0xd998('0x2e')][_0xd998('0x20')](_0x418d65)[_0xd998('0x27')](function(_0x5a14f4){logger[_0xd998('0xd')](_0xd998('0xe'),_0x1e81ef,_0x418d65[_0xd998('0x1e')]);if(_0x5901b6[_0xd998('0x29')][_0xd998('0x2f')]['endConversation']){_0xfd33f8[_0xd998('0xf')]();}else{_0xfd33f8['stop']();}})[_0xd998('0x21')](function(_0x1cb532){logger[_0xd998('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x1e81ef,JSON[_0xd998('0x30')](_0x1cb532));_0xfd33f8[_0xd998('0xf')]();});})['catch'](function(_0xa99719){logger[_0xd998('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x1e81ef,_0xa99719[_0xd998('0x31')]);_0xfd33f8['next']();});}}catch(_0x4b4931){logger[_0xd998('0x22')](_0xd998('0xe'),_0x1e81ef,JSON[_0xd998('0x30')](_0x4b4931));_0xfd33f8[_0xd998('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 9916fd0..1e04c09 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63d3=['providerName','providerResponse','fulfillmentText','push','all','catch','lodash','dialogflow','md5','moment','bluebird','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','isNil','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','phone','interaction','chat','account','upperFirst','InteractionId','created','getMustacheRender','Message','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','sessionPath','message','detectIntent','then','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','queryText','intentDetectionConfidence'];(function(_0x1ec39f,_0x53c8e7){var _0x372f12=function(_0x27870b){while(--_0x27870b){_0x1ec39f['push'](_0x1ec39f['shift']());}};_0x372f12(++_0x53c8e7);}(_0x63d3,0x1cd));var _0x363d=function(_0x119902,_0x38a48f){_0x119902=_0x119902-0x0;var _0x1ba9ea=_0x63d3[_0x119902];return _0x1ba9ea;};'use strict';var _=require(_0x363d('0x0'));var dialogflow=require(_0x363d('0x1'));var md5=require(_0x363d('0x2'));var moment=require(_0x363d('0x3'));var Promise=require(_0x363d('0x4'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x363d('0x5'));var rpc={'chatMessage':require(_0x363d('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x363d('0x7')),'smsMessage':require(_0x363d('0x8')),'faxMessage':require(_0x363d('0x9')),'whatsappMessage':require(_0x363d('0xa'))};function createMessage(_0x1a1cae,_0x4cd5f3,_0x5daff9,_0x44c890){return new Promise(function(_0x32a6e8,_0x26ba12){var _0x3f2111=_[_0x363d('0xb')](_0x5daff9);_0x3f2111[_0x363d('0xc')]=_0x44c890;return rpc[_0x4cd5f3+'Message'][_0x363d('0xd')](_0x3f2111)['then'](function(){logger[_0x363d('0xe')](_0x363d('0xf'),_0x1a1cae,_0x3f2111['body']);_0x32a6e8();})['catch'](function(_0x4bd4bb){logger[_0x363d('0x10')](_0x363d('0xf'),_0x1a1cae,JSON[_0x363d('0x11')](_0x4bd4bb));_0x26ba12(_0x4bd4bb);});});}exports['consequence']=function(_0x803bd9,_0x5e82fe){return function(_0x2dae97){try{if(!_[_0x363d('0x12')](this['interaction']['UserId'])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x803bd9,_0x363d('0x13'));return _0x2dae97[_0x363d('0x14')]();}var _0x2a81b8={'ContactId':this[_0x363d('0x15')]['id'],'sentAt':moment()[_0x363d('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x363d('0x17')]==='sms'||this[_0x363d('0x17')]==='whatsapp'){_0x2a81b8[_0x363d('0x18')]=this[_0x363d('0x19')][_0x363d('0x18')];}var _0x507cd8=this[_0x363d('0x17')];if(_0x507cd8===_0x363d('0x1a')){_0x2a81b8['ChatWebsiteId']=this[_0x363d('0x1b')]['id'];}else{_0x2a81b8[_[_0x363d('0x1c')](_0x507cd8)+'AccountId']=this['account']['id'];}_0x2a81b8[_[_0x363d('0x1c')](_0x507cd8)+_0x363d('0x1d')]=this[_0x363d('0x19')]['id'];if(this['interaction'][_0x363d('0x1e')]){var _0x3435ed=_0x5e82fe[0x4];if(!_['isEmpty'](_0x3435ed)){_0x2a81b8[_0x363d('0xc')]=utils[_0x363d('0x1f')](_0x3435ed,this);return rpc[_0x507cd8+_0x363d('0x20')][_0x363d('0xd')](_0x2a81b8)['then'](function(_0x323330){logger[_0x363d('0xe')](_0x363d('0xf'),_0x803bd9,_0x2a81b8[_0x363d('0xc')]);})['catch'](function(_0x151d29){logger[_0x363d('0x10')](_0x363d('0xf'),_0x803bd9,JSON['stringify'](_0x151d29));})['finally'](function(){logger[_0x363d('0xe')](_0x363d('0x21'),_0x803bd9);_0x2dae97[_0x363d('0x22')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x803bd9);_0x2dae97[_0x363d('0x22')]();}}else{var _0x52f95e=this;var _0x4f0013=_0x5e82fe[0x2][_0x363d('0x23')](/\\n/g,'\x0a');var _0xd3e378={'credentials':{'private_key':_0x4f0013,'client_email':_0x5e82fe[0x1]}};var _0x2b131e=new dialogflow['SessionsClient'](_0xd3e378);var _0x1432bf=_0x2b131e[_0x363d('0x24')](_0x5e82fe[0x0],md5(_0x52f95e['interaction']['id']));var _0x31245e={'session':_0x1432bf,'queryInput':{'text':{'text':_0x52f95e[_0x363d('0x25')][_0x363d('0xc')],'languageCode':_0x5e82fe[0x3]||'en'}}};return _0x2b131e[_0x363d('0x26')](_0x31245e)[_0x363d('0x27')](function(_0x5416f8){if(_0x5416f8&&_0x5416f8[_0x363d('0x28')]){_0x52f95e[_0x363d('0xc')][_0x363d('0x29')]=_0x5416f8;var _0x228fe6=_0x5416f8[0x0];var _0x1a7f64=_0x228fe6[_0x363d('0x2a')]['diagnosticInfo']&&_0x228fe6[_0x363d('0x2a')][_0x363d('0x2b')]['fields']?_0x228fe6[_0x363d('0x2a')]['diagnosticInfo'][_0x363d('0x2c')][_0x363d('0x2d')]['boolValue']:![];_0x52f95e[_0x363d('0xc')][_0x363d('0x2e')]=_0x228fe6[_0x363d('0x2a')]['action'];_0x52f95e[_0x363d('0xc')][_0x363d('0x2f')]=_0x228fe6[_0x363d('0x2a')][_0x363d('0x30')];_0x52f95e[_0x363d('0xc')][_0x363d('0x31')]=_0x228fe6[_0x363d('0x2a')][_0x363d('0x2b')]&&_0x228fe6['queryResult'][_0x363d('0x2b')]['fields']?_0x228fe6['queryResult']['diagnosticInfo']['fields'][_0x363d('0x2d')]['boolValue']:![];_0x52f95e['body'][_0x363d('0x32')]=_0x228fe6[_0x363d('0x2a')][_0x363d('0x33')]['name'];_0x52f95e[_0x363d('0xc')][_0x363d('0x34')]=_0x228fe6[_0x363d('0x2a')]['intent'][_0x363d('0x35')];_0x52f95e['body'][_0x363d('0x36')]=_0x228fe6[_0x363d('0x2a')][_0x363d('0x33')][_0x363d('0x37')];_0x52f95e[_0x363d('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0x228fe6[_0x363d('0x2a')][_0x363d('0x38')];_0x52f95e[_0x363d('0xc')]['DIALOGFLOWV2_QUERYTEXT']=_0x228fe6[_0x363d('0x2a')][_0x363d('0x39')];_0x52f95e[_0x363d('0xc')]['DIALOGFLOWV2_SCORE']=_0x228fe6[_0x363d('0x2a')][_0x363d('0x3a')];_0x2a81b8[_0x363d('0x3b')]=_0x363d('0x29');_0x2a81b8[_0x363d('0x3c')]=JSON['stringify'](_0x5416f8);var _0x53b506=[];for(var _0x572242=0x0;_0x572242<_0x5416f8[_0x363d('0x28')];_0x572242++){var _0x48dc57=_0x5416f8[_0x572242];if(_0x48dc57&&_0x48dc57[_0x363d('0x2a')]&&_0x48dc57[_0x363d('0x2a')][_0x363d('0x3d')]){_0x53b506[_0x363d('0x3e')](createMessage(_0x803bd9,_0x507cd8,_0x2a81b8,_0x48dc57[_0x363d('0x2a')][_0x363d('0x3d')]));}}return Promise[_0x363d('0x3f')](_0x53b506)[_0x363d('0x27')](function(){if(_0x1a7f64){_0x2dae97[_0x363d('0x14')]();}else{_0x2dae97[_0x363d('0x22')]();}})['catch'](function(_0x41e640){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x803bd9,JSON[_0x363d('0x11')](_0x41e640));_0x2dae97[_0x363d('0x14')]();});}})[_0x363d('0x40')](function(_0x7a35a4){logger[_0x363d('0x10')](_0x363d('0xf'),_0x803bd9,_0x7a35a4[_0x363d('0x25')]);_0x2dae97[_0x363d('0x14')]();});}}catch(_0x4416df){logger['error'](_0x363d('0xf'),_0x803bd9,JSON[_0x363d('0x11')](_0x4416df));_0x2dae97['stop']();}};}; \ No newline at end of file +var _0xcca7=['intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','lodash','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','body','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE'];(function(_0x39a1d7,_0x4d037f){var _0x4742e2=function(_0x4cb920){while(--_0x4cb920){_0x39a1d7['push'](_0x39a1d7['shift']());}};_0x4742e2(++_0x4d037f);}(_0xcca7,0x12e));var _0x7cca=function(_0x5fb9da,_0x1ac0d0){_0x5fb9da=_0x5fb9da-0x0;var _0x528081=_0xcca7[_0x5fb9da];return _0x528081;};'use strict';var _=require(_0x7cca('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x7cca('0x1'));var Promise=require(_0x7cca('0x2'));var logger=require(_0x7cca('0x3'))(_0x7cca('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x7cca('0x5')),'openchannelMessage':require(_0x7cca('0x6')),'mailMessage':require(_0x7cca('0x7')),'smsMessage':require(_0x7cca('0x8')),'faxMessage':require(_0x7cca('0x9')),'whatsappMessage':require(_0x7cca('0xa'))};function createMessage(_0x4d6123,_0x121d6c,_0x413a9f,_0x447ecb){return new Promise(function(_0x1b6b0a,_0x188461){var _0x4079ce=_[_0x7cca('0xb')](_0x413a9f);_0x4079ce['body']=_0x447ecb;return rpc[_0x121d6c+_0x7cca('0xc')][_0x7cca('0xd')](_0x4079ce)[_0x7cca('0xe')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x4d6123,_0x4079ce[_0x7cca('0xf')]);_0x1b6b0a();})[_0x7cca('0x10')](function(_0x5897e4){logger[_0x7cca('0x11')](_0x7cca('0x12'),_0x4d6123,JSON[_0x7cca('0x13')](_0x5897e4));_0x188461(_0x5897e4);});});}exports['consequence']=function(_0x3fca83,_0x4620e7){return function(_0x35ec95){try{if(!_['isNil'](this['interaction'][_0x7cca('0x14')])){logger[_0x7cca('0x15')](_0x7cca('0x12'),_0x3fca83,_0x7cca('0x16'));return _0x35ec95[_0x7cca('0x17')]();}var _0x29830a={'ContactId':this[_0x7cca('0x18')]['id'],'sentAt':moment()[_0x7cca('0x19')](_0x7cca('0x1a')),'direction':_0x7cca('0x1b')};if(this[_0x7cca('0x1c')]===_0x7cca('0x1d')||this[_0x7cca('0x1c')]===_0x7cca('0x1e')){_0x29830a[_0x7cca('0x1f')]=this[_0x7cca('0x20')][_0x7cca('0x1f')];}var _0x4840cb=this[_0x7cca('0x1c')];if(_0x4840cb===_0x7cca('0x21')){_0x29830a[_0x7cca('0x22')]=this['account']['id'];}else{_0x29830a[_[_0x7cca('0x23')](_0x4840cb)+_0x7cca('0x24')]=this['account']['id'];}_0x29830a[_[_0x7cca('0x23')](_0x4840cb)+_0x7cca('0x25')]=this[_0x7cca('0x20')]['id'];if(this[_0x7cca('0x20')][_0x7cca('0x26')]){var _0x3fb88a=_0x4620e7[0x4];if(!_[_0x7cca('0x27')](_0x3fb88a)){_0x29830a[_0x7cca('0xf')]=utils[_0x7cca('0x28')](_0x3fb88a,this);return rpc[_0x4840cb+_0x7cca('0xc')][_0x7cca('0xd')](_0x29830a)[_0x7cca('0xe')](function(_0x5aeb50){logger[_0x7cca('0x15')](_0x7cca('0x12'),_0x3fca83,_0x29830a[_0x7cca('0xf')]);})[_0x7cca('0x10')](function(_0x250087){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3fca83,JSON[_0x7cca('0x13')](_0x250087));})[_0x7cca('0x29')](function(){logger[_0x7cca('0x15')](_0x7cca('0x2a'),_0x3fca83);_0x35ec95['stop']();});}else{logger[_0x7cca('0x15')](_0x7cca('0x2b'),_0x3fca83);_0x35ec95[_0x7cca('0x2c')]();}}else{var _0x5b4f2b=this;var _0xdc403a=_0x4620e7[0x2][_0x7cca('0x2d')](/\\n/g,'\x0a');var _0x5f5c01={'credentials':{'private_key':_0xdc403a,'client_email':_0x4620e7[0x1]}};var _0x4e47b6=new dialogflow[(_0x7cca('0x2e'))](_0x5f5c01);var _0x39df80=_0x4e47b6[_0x7cca('0x2f')](_0x4620e7[0x0],md5(_0x5b4f2b['interaction']['id']));var _0x1ed738={'session':_0x39df80,'queryInput':{'text':{'text':_0x5b4f2b[_0x7cca('0x30')][_0x7cca('0xf')],'languageCode':_0x4620e7[0x3]||'en'}}};return _0x4e47b6[_0x7cca('0x31')](_0x1ed738)[_0x7cca('0xe')](function(_0x494855){if(_0x494855&&_0x494855['length']){_0x5b4f2b[_0x7cca('0xf')][_0x7cca('0x32')]=_0x494855;var _0x432329=_0x494855[0x0];var _0x173e23=_0x432329[_0x7cca('0x33')][_0x7cca('0x34')]&&_0x432329['queryResult']['diagnosticInfo'][_0x7cca('0x35')]?_0x432329['queryResult'][_0x7cca('0x34')][_0x7cca('0x35')][_0x7cca('0x36')][_0x7cca('0x37')]:![];_0x5b4f2b[_0x7cca('0xf')][_0x7cca('0x38')]=_0x432329['queryResult'][_0x7cca('0x39')];_0x5b4f2b[_0x7cca('0xf')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x432329[_0x7cca('0x33')][_0x7cca('0x3a')];_0x5b4f2b[_0x7cca('0xf')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x432329['queryResult'][_0x7cca('0x34')]&&_0x432329['queryResult'][_0x7cca('0x34')]['fields']?_0x432329[_0x7cca('0x33')]['diagnosticInfo']['fields'][_0x7cca('0x36')]['boolValue']:![];_0x5b4f2b['body']['DIALOGFLOWV2_INTENTNAME']=_0x432329[_0x7cca('0x33')]['intent']['name'];_0x5b4f2b[_0x7cca('0xf')][_0x7cca('0x3b')]=_0x432329['queryResult'][_0x7cca('0x3c')][_0x7cca('0x3d')];_0x5b4f2b[_0x7cca('0xf')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x432329[_0x7cca('0x33')]['intent'][_0x7cca('0x3e')];_0x5b4f2b[_0x7cca('0xf')][_0x7cca('0x3f')]=_0x432329['queryResult'][_0x7cca('0x40')];_0x5b4f2b[_0x7cca('0xf')][_0x7cca('0x41')]=_0x432329[_0x7cca('0x33')][_0x7cca('0x42')];_0x5b4f2b[_0x7cca('0xf')][_0x7cca('0x43')]=_0x432329['queryResult'][_0x7cca('0x44')];_0x29830a[_0x7cca('0x45')]=_0x7cca('0x32');_0x29830a[_0x7cca('0x46')]=JSON['stringify'](_0x494855);var _0xa90e35=[];for(var _0x14efbe=0x0;_0x14efbe<_0x494855['length'];_0x14efbe++){var _0x351927=_0x494855[_0x14efbe];if(_0x351927&&_0x351927[_0x7cca('0x33')]&&_0x351927['queryResult'][_0x7cca('0x47')]){_0xa90e35[_0x7cca('0x48')](createMessage(_0x3fca83,_0x4840cb,_0x29830a,_0x351927[_0x7cca('0x33')]['fulfillmentText']));}}return Promise[_0x7cca('0x49')](_0xa90e35)[_0x7cca('0xe')](function(){if(_0x173e23){_0x35ec95[_0x7cca('0x17')]();}else{_0x35ec95[_0x7cca('0x2c')]();}})['catch'](function(_0x5d9b67){logger['error'](_0x7cca('0x12'),_0x3fca83,JSON[_0x7cca('0x13')](_0x5d9b67));_0x35ec95[_0x7cca('0x17')]();});}})[_0x7cca('0x10')](function(_0x58e6f7){logger['error'](_0x7cca('0x12'),_0x3fca83,_0x58e6f7['message']);_0x35ec95['next']();});}}catch(_0x3456da){logger[_0x7cca('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x3fca83,JSON[_0x7cca('0x13')](_0x3456da));_0x35ec95[_0x7cca('0x2c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index aaec4bb..1f367fe 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59e6=['fromString','getMustacheRender','replace','[%s][GOTOIF]\x20%s','message','stop','priorityTrue','priorityFalse','info','condition','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x266480,_0x3cf747){var _0x1f51ef=function(_0x3ac45e){while(--_0x3ac45e){_0x266480['push'](_0x266480['shift']());}};_0x1f51ef(++_0x3cf747);}(_0x59e6,0x1a8));var _0x659e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x59e6[_0xa1e3e3];return _0xc980e9;};'use strict';var schema=require('validate');var _=require(_0x659e('0x0'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x659e('0x1'))(_0x659e('0x2'));var gotoif=schema({'condition':{'type':_0x659e('0x3'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x659e('0x4')},'priorityFalse':{'type':_0x659e('0x5'),'message':_0x659e('0x6')}});exports[_0x659e('0x7')]=function(_0xb993b8,_0x297ecc){return function(_0x589596){try{var _0x5369b2={'condition':htmlToText[_0x659e('0x8')](utils[_0x659e('0x9')](_0x297ecc[0x0],this),{'wordwrap':![]})[_0x659e('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x297ecc[0x1],'priorityFalse':_0x297ecc[0x2]};var _0x51d04b=gotoif['validate'](_0x5369b2,{'typecast':!![]});if(_0x51d04b['length']){logger['error'](_0x659e('0xb'),_0xb993b8,_['map'](_0x51d04b,_0x659e('0xc'))['join'](',\x20'));_0x589596[_0x659e('0xd')]();}else{try{var _0x1c06be=eval('('+_0x5369b2['condition']+')');var _0x13f6a6=_0x1c06be?_0x5369b2[_0x659e('0xe')]:_0x5369b2[_0x659e('0xf')];logger[_0x659e('0x10')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xb993b8,_0x5369b2[_0x659e('0x11')],_0x1c06be,_0x13f6a6||'next');if(_0x13f6a6){var _0x38ec85=_[_0x659e('0x12')](_0x589596[_0x659e('0x13')](),{'p':_0x13f6a6});if(_0x38ec85>=0x0){logger[_0x659e('0x10')](_0x659e('0x14'),_0xb993b8,_0x13f6a6||'next',_0x38ec85);_0x589596[_0x659e('0x15')](_0x38ec85);}else{logger[_0x659e('0x10')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0xb993b8,_0x13f6a6||_0x659e('0x15'));_0x589596['stop']();}}else{_0x589596['next']();}}catch(_0x208e1f){logger[_0x659e('0x16')](_0x659e('0x17'),_0xb993b8,_0x208e1f[_0x659e('0xc')]);_0x589596[_0x659e('0xd')]();}}}catch(_0x2d74d3){logger[_0x659e('0x16')](_0x659e('0xb'),_0xb993b8,JSON['stringify'](_0x2d74d3));_0x589596[_0x659e('0xd')]();}};}; \ No newline at end of file +var _0xf10c=['validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','length','error','map','message','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify'];(function(_0x5a9055,_0x48668d){var _0x24a9ae=function(_0x9c8b6c){while(--_0x9c8b6c){_0x5a9055['push'](_0x5a9055['shift']());}};_0x24a9ae(++_0x48668d);}(_0xf10c,0x1d0));var _0xcf10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf10c[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xcf10('0x0'));var _=require(_0xcf10('0x1'));var htmlToText=require(_0xcf10('0x2'));var utils=require(_0xcf10('0x3'));var logger=require(_0xcf10('0x4'))(_0xcf10('0x5'));var gotoif=schema({'condition':{'type':_0xcf10('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xcf10('0x7'),'message':_0xcf10('0x8')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xcf10('0x9')]=function(_0x30d296,_0x3478c3){return function(_0x53c53d){try{var _0x2cacfb={'condition':htmlToText[_0xcf10('0xa')](utils['getMustacheRender'](_0x3478c3[0x0],this),{'wordwrap':![]})[_0xcf10('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3478c3[0x1],'priorityFalse':_0x3478c3[0x2]};var _0x436ca4=gotoif[_0xcf10('0x0')](_0x2cacfb,{'typecast':!![]});if(_0x436ca4[_0xcf10('0xc')]){logger[_0xcf10('0xd')]('[%s][GOTOIF]\x20%s',_0x30d296,_[_0xcf10('0xe')](_0x436ca4,_0xcf10('0xf'))['join'](',\x20'));_0x53c53d[_0xcf10('0x10')]();}else{try{var _0x56fee7=eval('('+_0x2cacfb[_0xcf10('0x11')]+')');var _0x17085c=_0x56fee7?_0x2cacfb[_0xcf10('0x12')]:_0x2cacfb[_0xcf10('0x13')];logger['info'](_0xcf10('0x14'),_0x30d296,_0x2cacfb[_0xcf10('0x11')],_0x56fee7,_0x17085c||_0xcf10('0x15'));if(_0x17085c){var _0x4424ce=_[_0xcf10('0x16')](_0x53c53d[_0xcf10('0x17')](),{'p':_0x17085c});if(_0x4424ce>=0x0){logger[_0xcf10('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x30d296,_0x17085c||'next',_0x4424ce);_0x53c53d[_0xcf10('0x15')](_0x4424ce);}else{logger['info'](_0xcf10('0x19'),_0x30d296,_0x17085c||_0xcf10('0x15'));_0x53c53d[_0xcf10('0x10')]();}}else{_0x53c53d[_0xcf10('0x15')]();}}catch(_0x24ca78){logger[_0xcf10('0xd')](_0xcf10('0x1a'),_0x30d296,_0x24ca78[_0xcf10('0xf')]);_0x53c53d[_0xcf10('0x10')]();}}}catch(_0x241632){logger[_0xcf10('0xd')](_0xcf10('0x1b'),_0x30d296,JSON[_0xcf10('0x1c')](_0x241632));_0x53c53d[_0xcf10('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index f3b95bc..51395bd 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 _0x23aa=['map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','error','stringify','validate','routing','number','[%s][GOTOP]\x20%s'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x23aa,0x73));var _0xa23a=function(_0x4d50ab,_0xadeac7){_0x4d50ab=_0x4d50ab-0x0;var _0x276272=_0x23aa[_0x4d50ab];return _0x276272;};'use strict';var schema=require(_0xa23a('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xa23a('0x1'));var gotop=schema({'priority':{'type':_0xa23a('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x399f15,_0x454445){return function(_0x316925){try{var _0x90a52d={'priority':_0x454445[0x0]};var _0x55a0ce=gotop[_0xa23a('0x0')](_0x90a52d,{'typecast':!![]});if(_0x55a0ce['length']){logger['error'](_0xa23a('0x3'),_0x399f15,_[_0xa23a('0x4')](_0x55a0ce,_0xa23a('0x5'))['join'](',\x20'));_0x316925[_0xa23a('0x6')]();}else{logger['info'](_0xa23a('0x7'),_0x399f15,_0x90a52d[_0xa23a('0x8')]);if(_0x90a52d[_0xa23a('0x8')]){var _0x587a55=_[_0xa23a('0x9')](_0x316925[_0xa23a('0xa')](),{'p':_0x90a52d[_0xa23a('0x8')]});if(_0x587a55>=0x0){logger[_0xa23a('0xb')](_0xa23a('0xc'),_0x399f15,_0x90a52d[_0xa23a('0x8')]||'next',_0x587a55);_0x316925['next'](_0x587a55);}else{logger[_0xa23a('0xb')](_0xa23a('0xd'),_0x399f15,_0x90a52d['priority']||_0xa23a('0xe'));_0x316925[_0xa23a('0x6')]();}}else{_0x316925['next']();}}}catch(_0x3d8dc6){logger[_0xa23a('0xf')](_0xa23a('0x3'),_0x399f15,JSON[_0xa23a('0x10')](_0x3d8dc6));_0x316925[_0xa23a('0x6')]();}};}; \ No newline at end of file +var _0x4dfa=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x384aa0,_0x11a7d0){var _0x519bd3=function(_0x27e6e2){while(--_0x27e6e2){_0x384aa0['push'](_0x384aa0['shift']());}};_0x519bd3(++_0x11a7d0);}(_0x4dfa,0x110));var _0xa4df=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4dfa[_0x126558];return _0x1f6d14;};'use strict';var schema=require(_0xa4df('0x0'));var _=require(_0xa4df('0x1'));var logger=require(_0xa4df('0x2'))(_0xa4df('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xa4df('0x4')}});exports[_0xa4df('0x5')]=function(_0x3cc9c7,_0x297a4e){return function(_0x45c0bc){try{var _0x1d557a={'priority':_0x297a4e[0x0]};var _0x25b08b=gotop[_0xa4df('0x0')](_0x1d557a,{'typecast':!![]});if(_0x25b08b[_0xa4df('0x6')]){logger[_0xa4df('0x7')](_0xa4df('0x8'),_0x3cc9c7,_[_0xa4df('0x9')](_0x25b08b,_0xa4df('0xa'))[_0xa4df('0xb')](',\x20'));_0x45c0bc['stop']();}else{logger[_0xa4df('0xc')](_0xa4df('0xd'),_0x3cc9c7,_0x1d557a[_0xa4df('0xe')]);if(_0x1d557a[_0xa4df('0xe')]){var _0x3ca828=_[_0xa4df('0xf')](_0x45c0bc[_0xa4df('0x10')](),{'p':_0x1d557a[_0xa4df('0xe')]});if(_0x3ca828>=0x0){logger[_0xa4df('0xc')](_0xa4df('0x11'),_0x3cc9c7,_0x1d557a[_0xa4df('0xe')]||'next',_0x3ca828);_0x45c0bc[_0xa4df('0x12')](_0x3ca828);}else{logger['info'](_0xa4df('0x13'),_0x3cc9c7,_0x1d557a[_0xa4df('0xe')]||_0xa4df('0x12'));_0x45c0bc[_0xa4df('0x14')]();}}else{_0x45c0bc[_0xa4df('0x12')]();}}}catch(_0x56a27a){logger[_0xa4df('0x7')](_0xa4df('0x8'),_0x3cc9c7,JSON[_0xa4df('0x15')](_0x56a27a));_0x45c0bc[_0xa4df('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 3c5a64d..1e6b5de 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 _0x404d=['InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','channel','chat','upperFirst','AccountId','account'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x404d,0x1e9));var _0xd404=function(_0x7bd640,_0x24067f){_0x7bd640=_0x7bd640-0x0;var _0x1245e9=_0x404d[_0x7bd640];return _0x1245e9;};'use strict';var _=require(_0xd404('0x0'));var utils=require(_0xd404('0x1'));var logger=require(_0xd404('0x2'))(_0xd404('0x3'));var rpc={'chatMessage':require(_0xd404('0x4')),'openchannelMessage':require(_0xd404('0x5')),'mailMessage':require(_0xd404('0x6')),'smsMessage':require(_0xd404('0x7')),'faxMessage':require(_0xd404('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd404('0x9')]=function(_0x3420bc,_0x49ffef){return function(_0x40b5d9){try{var _0x7faf39={'body':utils['getMustacheRender'](_0x49ffef[0x0],this),'ContactId':this['contact']['id']};if(this[_0xd404('0xa')]===_0xd404('0xb')){_0x7faf39['ChatWebsiteId']=this['account']['id'];}else{_0x7faf39[_[_0xd404('0xc')](this[_0xd404('0xa')])+_0xd404('0xd')]=this[_0xd404('0xe')]['id'];}_0x7faf39[_['upperFirst'](this['channel'])+_0xd404('0xf')]=this[_0xd404('0x10')]['id'];if(rpc[this['channel']+_0xd404('0x11')]){return rpc[this[_0xd404('0xa')]+_0xd404('0x11')][_0xd404('0x12')](_0x7faf39)[_0xd404('0x13')](function(_0x9f7667){logger[_0xd404('0x14')](_0xd404('0x15'),_0x3420bc,_0x7faf39[_0xd404('0x16')]);_0x40b5d9[_0xd404('0x17')]();})[_0xd404('0x18')](function(_0x2ff703){logger[_0xd404('0x19')](_0xd404('0x15'),_0x3420bc,JSON[_0xd404('0x1a')](_0x2ff703));_0x40b5d9[_0xd404('0x1b')]();});}}catch(_0x2051e8){logger[_0xd404('0x19')](_0xd404('0x15'),_0x3420bc,JSON[_0xd404('0x1a')](_0x2051e8));_0x40b5d9[_0xd404('0x1b')]();}};}; \ No newline at end of file +var _0x4b45=['[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','body','next','error'];(function(_0x2a8c79,_0x230432){var _0x22aa29=function(_0x4e22d8){while(--_0x4e22d8){_0x2a8c79['push'](_0x2a8c79['shift']());}};_0x22aa29(++_0x230432);}(_0x4b45,0x8d));var _0x54b4=function(_0x3d6cbc,_0x7266ae){_0x3d6cbc=_0x3d6cbc-0x0;var _0x2cf6a8=_0x4b45[_0x3d6cbc];return _0x2cf6a8;};'use strict';var _=require('lodash');var utils=require(_0x54b4('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x54b4('0x1')),'mailMessage':require(_0x54b4('0x2')),'smsMessage':require(_0x54b4('0x3')),'faxMessage':require(_0x54b4('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x54b4('0x5')]=function(_0x34afe8,_0x4b9a05){return function(_0x1a1e1f){try{var _0x36347c={'body':utils['getMustacheRender'](_0x4b9a05[0x0],this),'ContactId':this[_0x54b4('0x6')]['id']};if(this[_0x54b4('0x7')]==='chat'){_0x36347c[_0x54b4('0x8')]=this[_0x54b4('0x9')]['id'];}else{_0x36347c[_['upperFirst'](this[_0x54b4('0x7')])+_0x54b4('0xa')]=this[_0x54b4('0x9')]['id'];}_0x36347c[_[_0x54b4('0xb')](this[_0x54b4('0x7')])+_0x54b4('0xc')]=this[_0x54b4('0xd')]['id'];if(rpc[this['channel']+_0x54b4('0xe')]){return rpc[this['channel']+_0x54b4('0xe')][_0x54b4('0xf')](_0x36347c)[_0x54b4('0x10')](function(_0x5309a4){logger['info']('[%s][MESSAGE]\x20%s',_0x34afe8,_0x36347c[_0x54b4('0x11')]);_0x1a1e1f[_0x54b4('0x12')]();})['catch'](function(_0x4c70ef){logger[_0x54b4('0x13')](_0x54b4('0x14'),_0x34afe8,JSON[_0x54b4('0x15')](_0x4c70ef));_0x1a1e1f[_0x54b4('0x16')]();});}}catch(_0xf56d2b){logger[_0x54b4('0x13')](_0x54b4('0x14'),_0x34afe8,JSON[_0x54b4('0x15')](_0xf56d2b));_0x1a1e1f[_0x54b4('0x16')]();}};}; \ 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 fcd3463..0bf951f 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 _0x7ea4=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop','./utils'];(function(_0x11a6cf,_0x235f45){var _0x537a8f=function(_0x483df1){while(--_0x483df1){_0x11a6cf['push'](_0x11a6cf['shift']());}};_0x537a8f(++_0x235f45);}(_0x7ea4,0xef));var _0x47ea=function(_0x44e4e1,_0x5637b2){_0x44e4e1=_0x44e4e1-0x0;var _0x300cd2=_0x7ea4[_0x44e4e1];return _0x300cd2;};'use strict';var utils=require(_0x47ea('0x0'));var logger=require(_0x47ea('0x1'))(_0x47ea('0x2'));exports[_0x47ea('0x3')]=function(_0x489299,_0x5f31f4){return function(_0x36da4c){try{logger[_0x47ea('0x4')](_0x47ea('0x5'),_0x489299,utils['getMustacheRender'](_0x5f31f4[0x0],this));_0x36da4c[_0x47ea('0x6')]();}catch(_0x5531b5){logger[_0x47ea('0x7')](_0x47ea('0x5'),_0x489299,JSON[_0x47ea('0x8')](_0x5531b5));_0x36da4c[_0x47ea('0x9')]();}};}; \ No newline at end of file +var _0x0639=['getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','[%s][NOOP]\x20%s'];(function(_0x5a394d,_0x46e00f){var _0x1b2ef4=function(_0x30123e){while(--_0x30123e){_0x5a394d['push'](_0x5a394d['shift']());}};_0x1b2ef4(++_0x46e00f);}(_0x0639,0x1e2));var _0x9063=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x0639[_0x648163];return _0x199d4d;};'use strict';var utils=require(_0x9063('0x0'));var logger=require(_0x9063('0x1'))(_0x9063('0x2'));exports['consequence']=function(_0x4f9117,_0x37e3b8){return function(_0x345dc8){try{logger['info'](_0x9063('0x3'),_0x4f9117,utils[_0x9063('0x4')](_0x37e3b8[0x0],this));_0x345dc8[_0x9063('0x5')]();}catch(_0x5d33ab){logger[_0x9063('0x6')](_0x9063('0x3'),_0x4f9117,JSON[_0x9063('0x7')](_0x5d33ab));_0x345dc8[_0x9063('0x8')]();}};}; \ 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 3d20293..e742ce7 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(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x3e74,0x175));var _0x43e7=function(_0x4c4bed,_0x3c7eb0){_0x4c4bed=_0x4c4bed-0x0;var _0x5167ba=_0x3e74[_0x4c4bed];return _0x5167ba;};'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 _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','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','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x25ecab,_0xf1ef3e){var _0x116380=function(_0x1f7375){while(--_0x1f7375){_0x25ecab['push'](_0x25ecab['shift']());}};_0x116380(++_0xf1ef3e);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 3a5ac88..659669c 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 _0x040d=['forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x115038,_0x1e2a3b){var _0x7d1ef1=function(_0x2f6f63){while(--_0x2f6f63){_0x115038['push'](_0x115038['shift']());}};_0x7d1ef1(++_0x1e2a3b);}(_0x040d,0x1e9));var _0xd040=function(_0x1bf32f,_0x2e994e){_0x1bf32f=_0x1bf32f-0x0;var _0x147063=_0x040d[_0x1bf32f];return _0x147063;};'use strict';var _=require(_0xd040('0x0'));var uuid=require(_0xd040('0x1'));var util=require(_0xd040('0x2'));var logger=require('../../../../../config/logger')(_0xd040('0x3'));var Agent=function(_0x30ea76,_0x581a87,_0xeaba46,_0x16974b){this[_0xd040('0x4')]=uuid['v4']();this[_0xd040('0x5')]=_0x30ea76;this[_0xd040('0x6')]=_0x581a87;this[_0xd040('0x7')]=_0xeaba46;this[_0xd040('0x3')]=_0x16974b;this[_0xd040('0x5')][_0xd040('0x8')](this[_0xd040('0x9')][_0xd040('0xa')](this),this[_0xd040('0xb')][_0xd040('0xa')](this));this[_0xd040('0x5')]['on'](_0xd040('0xc'),this[_0xd040('0xb')][_0xd040('0xa')](this));this[_0xd040('0x5')]['on'](_0xd040('0xd'),this[_0xd040('0xe')]['bind'](this));};Agent[_0xd040('0xf')]['push']=function(){this['squeue'][_0xd040('0x8')](this[_0xd040('0x9')][_0xd040('0xa')](this),this['handleTimeout']['bind'](this));};Agent[_0xd040('0xf')][_0xd040('0xe')]=function(){this[_0xd040('0xb')](!![]);};Agent[_0xd040('0xf')][_0xd040('0x9')]=function(_0x4a3af2){logger[_0xd040('0x10')](_0xd040('0x11'),this[_0xd040('0x5')]['id'],this[_0xd040('0x6')]['id']);if(_[_0xd040('0x12')](this[_0xd040('0x7')][_0xd040('0x13')][this[_0xd040('0x6')]['id']])){logger[_0xd040('0x10')](_0xd040('0x14'),this[_0xd040('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xd040('0x8')][_0xd040('0xa')](this),0x3e8);}else{if(this[_0xd040('0x3')][_0xd040('0x15')]||util[_0xd040('0x16')](this[_0xd040('0x5')]['id'],this[_0xd040('0x7')][_0xd040('0x13')][this[_0xd040('0x6')]['id']],this[_0xd040('0x5')][_0xd040('0x17')],![])){this[_0xd040('0x7')]['agents'][this[_0xd040('0x6')]['id']][_0xd040('0x18')]=!![];this['realtime'][_0xd040('0x13')][this[_0xd040('0x6')]['id']][_0xd040('0x19')]=undefined;util[_0xd040('0x1a')](this[_0xd040('0x4')],this[_0xd040('0x5')]['id'],this[_0xd040('0x7')]['agents'][this[_0xd040('0x6')]['id']],null,this[_0xd040('0x3')]);util[_0xd040('0x1b')](this[_0xd040('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],_0xd040('0x1c')+(this['routing']['forcedOwnership']?_0xd040('0x1d'):''));}else{logger[_0xd040('0x10')](_0xd040('0x1e'),this[_0xd040('0x5')]['id'],this[_0xd040('0x6')]['id']);setTimeout(this['push'][_0xd040('0xa')](this),0x3e8);}}};Agent[_0xd040('0xf')]['handleTimeout']=function(_0x4a776a){if(_[_0xd040('0x12')](this[_0xd040('0x7')][_0xd040('0x13')][this[_0xd040('0x6')]['id']])){return logger[_0xd040('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xd040('0x5')]['id'],this[_0xd040('0x6')]['id']);}else{logger[_0xd040('0x10')](_0xd040('0x1f'),this[_0xd040('0x5')]['id'],this[_0xd040('0x6')]['id']);util[_0xd040('0x20')](this[_0xd040('0x4')],this[_0xd040('0x5')]['id'],this[_0xd040('0x7')][_0xd040('0x13')][this[_0xd040('0x6')]['id']],null,this[_0xd040('0x3')]);this['realtime'][_0xd040('0x13')][this[_0xd040('0x6')]['id']][_0xd040('0x18')]=![];this[_0xd040('0x7')][_0xd040('0x13')][this[_0xd040('0x6')]['id']][_0xd040('0x19')]=undefined;util['writeLog'](this[_0xd040('0x5')]['id'],this[_0xd040('0x7')][_0xd040('0x13')][this[_0xd040('0x6')]['id']],_0x4a776a?'STOP':_0xd040('0x21'));}if(!_0x4a776a){setTimeout(this[_0xd040('0x8')][_0xd040('0xa')](this),0x3e8);}};function agent(_0x2eacb3,_0x297a61,_0x4836f7,_0x2565ba){return new Agent(_0x2eacb3,_0x297a61,_0x4836f7,_0x2565ba);}module['exports']=agent; \ No newline at end of file +var _0xd494=['channel','busy','busyQueue','showNotification','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','writeLog','STOP','TIMEOUT','lodash','./util','notificationId','agent','routing','squeue','push','handleRun','bind','handleTimeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0xd494,0x166));var _0x4d49=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd494[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x4d49('0x0'));var uuid=require('uuid');var util=require(_0x4d49('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x2cdac6,_0x46976f,_0x425a9a,_0x5365a6){this[_0x4d49('0x2')]=uuid['v4']();this['squeue']=_0x2cdac6;this[_0x4d49('0x3')]=_0x46976f;this['realtime']=_0x425a9a;this[_0x4d49('0x4')]=_0x5365a6;this[_0x4d49('0x5')][_0x4d49('0x6')](this[_0x4d49('0x7')][_0x4d49('0x8')](this),this[_0x4d49('0x9')][_0x4d49('0x8')](this));this[_0x4d49('0x5')]['on']('timeout',this[_0x4d49('0x9')][_0x4d49('0x8')](this));this[_0x4d49('0x5')]['on']('drained',this[_0x4d49('0xa')][_0x4d49('0x8')](this));};Agent[_0x4d49('0xb')][_0x4d49('0x6')]=function(){this[_0x4d49('0x5')][_0x4d49('0x6')](this[_0x4d49('0x7')][_0x4d49('0x8')](this),this['handleTimeout'][_0x4d49('0x8')](this));};Agent[_0x4d49('0xb')][_0x4d49('0xa')]=function(){this[_0x4d49('0x9')](!![]);};Agent[_0x4d49('0xb')]['handleRun']=function(_0x5221f5){logger[_0x4d49('0xc')](_0x4d49('0xd'),this[_0x4d49('0x5')]['id'],this[_0x4d49('0x3')]['id']);if(_[_0x4d49('0xe')](this[_0x4d49('0xf')][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']])){logger[_0x4d49('0xc')](_0x4d49('0x11'),this[_0x4d49('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x4d49('0x6')]['bind'](this),0x3e8);}else{if(this[_0x4d49('0x4')]['forcedOwnership']||util[_0x4d49('0x12')](this['squeue']['id'],this[_0x4d49('0xf')][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']],this[_0x4d49('0x5')][_0x4d49('0x13')],![])){this['realtime'][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']][_0x4d49('0x14')]=!![];this['realtime']['agents'][this[_0x4d49('0x3')]['id']][_0x4d49('0x15')]=undefined;util[_0x4d49('0x16')](this[_0x4d49('0x2')],this['squeue']['id'],this[_0x4d49('0xf')][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this[_0x4d49('0xf')][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']],_0x4d49('0x17')+(this['routing'][_0x4d49('0x18')]?':FORCED':''));}else{logger[_0x4d49('0xc')](_0x4d49('0x19'),this[_0x4d49('0x5')]['id'],this[_0x4d49('0x3')]['id']);setTimeout(this[_0x4d49('0x6')][_0x4d49('0x8')](this),0x3e8);}}};Agent['prototype'][_0x4d49('0x9')]=function(_0x42a938){if(_[_0x4d49('0xe')](this[_0x4d49('0xf')][_0x4d49('0x10')][this['agent']['id']])){return logger[_0x4d49('0xc')](_0x4d49('0x11'),this[_0x4d49('0x5')]['id'],this['agent']['id']);}else{logger[_0x4d49('0xc')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x4d49('0x5')]['id'],this[_0x4d49('0x3')]['id']);util['hideNotification'](this['notificationId'],this['squeue']['id'],this[_0x4d49('0xf')][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']],null,this[_0x4d49('0x4')]);this[_0x4d49('0xf')][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']][_0x4d49('0x14')]=![];this[_0x4d49('0xf')][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']][_0x4d49('0x15')]=undefined;util[_0x4d49('0x1a')](this[_0x4d49('0x5')]['id'],this[_0x4d49('0xf')][_0x4d49('0x10')][this[_0x4d49('0x3')]['id']],_0x42a938?_0x4d49('0x1b'):_0x4d49('0x1c'));}if(!_0x42a938){setTimeout(this[_0x4d49('0x6')][_0x4d49('0x8')](this),0x3e8);}};function agent(_0x3e7599,_0x4940ce,_0x24bd24,_0x28f0ed){return new Agent(_0x3e7599,_0x4940ce,_0x24bd24,_0x28f0ed);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index a0316aa..3e10b87 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 _0xada1=['info','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','routing','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','notificationId','queue','realtime','push','bind','handleTimeout','squeue','timeout','handleDrained','prototype','handleRun','isNil','Agents','length','agents'];(function(_0x248ea5,_0x2563d9){var _0x2e4798=function(_0x461557){while(--_0x461557){_0x248ea5['push'](_0x248ea5['shift']());}};_0x2e4798(++_0x2563d9);}(_0xada1,0xfe));var _0x1ada=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xada1[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x1ada('0x0'));var uuid=require(_0x1ada('0x1'));var util=require('./util');var logger=require(_0x1ada('0x2'))('routing');var Beepall=function(_0x4b2198,_0x2ae3af,_0x182b24,_0x536b47){this[_0x1ada('0x3')]=uuid['v4']();this['squeue']=_0x4b2198;this[_0x1ada('0x4')]=_0x2ae3af;this[_0x1ada('0x5')]=_0x182b24;this['routing']=_0x536b47;this['squeue'][_0x1ada('0x6')](this['handleRun'][_0x1ada('0x7')](this),this[_0x1ada('0x8')][_0x1ada('0x7')](this));this[_0x1ada('0x9')]['on'](_0x1ada('0xa'),this[_0x1ada('0x8')][_0x1ada('0x7')](this));this['squeue']['on']('drained',this[_0x1ada('0xb')]['bind'](this));};Beepall[_0x1ada('0xc')]['push']=function(){this[_0x1ada('0x9')][_0x1ada('0x6')](this[_0x1ada('0xd')]['bind'](this),this[_0x1ada('0x8')][_0x1ada('0x7')](this));};Beepall[_0x1ada('0xc')][_0x1ada('0xb')]=function(_0x57332f){this['handleTimeout'](!![]);};Beepall[_0x1ada('0xc')]['handleRun']=function(_0x2da320){var _0x29f63a=!![];if(!_[_0x1ada('0xe')](this[_0x1ada('0x4')])&&!_[_0x1ada('0xe')](this[_0x1ada('0x4')][_0x1ada('0xf')])&&this[_0x1ada('0x4')][_0x1ada('0xf')][_0x1ada('0x10')]>0x0){for(var _0xd3a223=0x0,_0x54b96d;_0xd3a2230x0){for(var _0x4b727a=0x0,_0x540a0d;_0x4b727a0x0&&_0x188fb1[_0x150039+_0x6fd9('0x26')]>=_0x188fb1[_0x150039+_0x6fd9('0x25')]){writeLog(_0x569363,_0x188fb1,_0x150039[_0x6fd9('0x27')]()+_0x6fd9('0x28'));return![];}}return!![];};exports[_0x6fd9('0x29')]=function(_0x492dc5,_0x434e6c,_0x155e42,_0x59b91e,_0x182420){return sendNotification(!![],_0x492dc5,_0x434e6c,_0x155e42,_0x59b91e,_0x182420);};exports[_0x6fd9('0x2a')]=function(_0x29d27f,_0x2d1afc,_0x488eee,_0x4f5d3d,_0x334d25){return sendNotification(![],_0x29d27f,_0x2d1afc,_0x488eee,_0x4f5d3d,_0x334d25);};exports[_0x6fd9('0x2b')]=writeLog; \ No newline at end of file +var _0xd4bd=['remove','info','isAgentAvailable','busy','BUSY','online','OFFLINE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/logger','routing','redis','defaults','format','name','emit','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save'];(function(_0x5ce2b4,_0xfada36){var _0x1619b8=function(_0x59823f){while(--_0x59823f){_0x5ce2b4['push'](_0x5ce2b4['shift']());}};_0x1619b8(++_0xfada36);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0xd4bd[_0x57975f];return _0x4793b8;};'use strict';var _=require(_0xdd4b('0x0'));var util=require(_0xdd4b('0x1'));var utils=require(_0xdd4b('0x2'));var Mustache=require(_0xdd4b('0x3'));var Redis=require(_0xdd4b('0x4'));var config=require('../../../../../config/environment');var logger=require(_0xdd4b('0x5'))(_0xdd4b('0x6'));config[_0xdd4b('0x7')]=_[_0xdd4b('0x8')](config[_0xdd4b('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdd4b('0x7')]));function emit(_0x543281,_0x4292d3,_0x173584){io['to'](_0x543281)['emit'](_0x4292d3,_0x173584);}function sendNotification(_0x521de8,_0x295066,_0x1ff8fe,_0x5d2a80,_0x13918e,_0x14be78){io['to'](util[_0xdd4b('0x9')]('user:%s',_0x5d2a80[_0xdd4b('0xa')]))[_0xdd4b('0xb')](_0xdd4b('0xc'),_0x5d2a80);var _0x16c146=_0x14be78||{};var _0x10e6aa=_0x1ff8fe[_0xdd4b('0xd')]('.');var _0x3b170c={'uniqueid':_0x295066,'channel':_0x10e6aa[0x0],'id':_0x10e6aa[0x1],'title':_0x10e6aa[0x0]+_0xdd4b('0xe'),'interactionId':_0x10e6aa[0x2],'queue':_0x13918e?_0x13918e['name']:null,'sound':_0x16c146[_0xdd4b('0xf')]['notificationSound'],'shake':_0x16c146[_0xdd4b('0xf')][_0xdd4b('0x10')]};try{if(!_0x16c146[_0xdd4b('0x11')]){_0x16c146[_0xdd4b('0x11')]={};}if(_0x13918e){_0x16c146[_0xdd4b('0x11')][_0xdd4b('0x12')]=_0x13918e;}else if(_0x16c146['body']['queue']){delete _0x16c146[_0xdd4b('0x11')][_0xdd4b('0x12')];}_0x3b170c[_0xdd4b('0x13')]=utils[_0xdd4b('0x14')](_0x16c146[_0xdd4b('0xf')][_0xdd4b('0x15')],_0x16c146);}catch(_0x1e29db){_0x3b170c['msg']=_0xdd4b('0x16');logger[_0xdd4b('0x17')](util[_0xdd4b('0x9')]('[%s][QUEUE]\x20%s',_0x295066,_0x1e29db[_0xdd4b('0x18')]));}io['to'](util['format']('user:%s',_0x5d2a80[_0xdd4b('0xa')]))[_0xdd4b('0xb')](util['format'](_0xdd4b('0x19'),_0x521de8?_0xdd4b('0x1a'):_0xdd4b('0x1b')),_0x3b170c);}function writeLog(_0x1fbbe7,_0x14a011,_0x5a19ca){return logger[_0xdd4b('0x1c')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x1fbbe7,_0x14a011[_0xdd4b('0xa')],_0x5a19ca));}exports[_0xdd4b('0x1d')]=function(_0x3ec51e,_0x5b5a62,_0xa66301,_0x1ba012){if(_0x5b5a62[_0xdd4b('0x1e')]){writeLog(_0x3ec51e,_0x5b5a62,_0xdd4b('0x1f'));return![];}if(!_0x5b5a62[_0xdd4b('0x20')]){writeLog(_0x3ec51e,_0x5b5a62,_0xdd4b('0x21'));return![];}if(_0x5b5a62[_0xa66301+'Pause']){writeLog(_0x3ec51e,_0x5b5a62,'PAUSE');return![];}if(_0x1ba012&&_0x5b5a62['hasOwnProperty'](_0xa66301+_0xdd4b('0x22'))&&_0x5b5a62[_0xdd4b('0x23')](_0xa66301+'CurrentCapacity')){if(_0x5b5a62[_0xa66301+'Capacity']>0x0&&_0x5b5a62[_0xa66301+_0xdd4b('0x24')]>=_0x5b5a62[_0xa66301+_0xdd4b('0x22')]){writeLog(_0x3ec51e,_0x5b5a62,_0xa66301[_0xdd4b('0x25')]()+_0xdd4b('0x26'));return![];}}return!![];};exports[_0xdd4b('0x27')]=function(_0x4c1396,_0x1ae087,_0x37b074,_0x31a22b,_0x1f70b3){return sendNotification(!![],_0x4c1396,_0x1ae087,_0x37b074,_0x31a22b,_0x1f70b3);};exports[_0xdd4b('0x28')]=function(_0x14a40f,_0x4de481,_0x420597,_0x3c841a,_0x5da4c){return sendNotification(![],_0x14a40f,_0x4de481,_0x420597,_0x3c841a,_0x5da4c);};exports[_0xdd4b('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 44bed30..1885ba4 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 _0xf32c=['body','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x5cd60f,_0x3a852e){var _0x51dc86=function(_0x4251b7){while(--_0x4251b7){_0x5cd60f['push'](_0x5cd60f['shift']());}};_0x51dc86(++_0x3a852e);}(_0xf32c,0x147));var _0xcf32=function(_0x38afc7,_0x52d703){_0x38afc7=_0x38afc7-0x0;var _0x5a3568=_0xf32c[_0x38afc7];return _0x5a3568;};'use strict';var schema=require(_0xcf32('0x0'));var sh=require(_0xcf32('0x1'));var _=require(_0xcf32('0x2'));var utils=require(_0xcf32('0x3'));var logger=require('../../../../config/logger')(_0xcf32('0x4'));var system=schema({'command':{'type':_0xcf32('0x5'),'required':!![],'message':_0xcf32('0x6')}});exports['consequence']=function(_0x2568a1,_0x13a3ad){return function(_0x2000a6){try{var _0xcdde72={'command':_0x13a3ad[0x0]};var _0x193ffb=system['validate'](_0xcdde72,{'typecast':!![]});if(_0x193ffb[_0xcf32('0x7')]){logger[_0xcf32('0x8')](_0xcf32('0x9'),_0x2568a1,_[_0xcf32('0xa')](_0x193ffb,_0xcf32('0xb'))['join'](',\x20'));logger[_0xcf32('0xc')](_0xcf32('0xd'),_0x2568a1);_0x2000a6[_0xcf32('0xe')]();}else{var _0x24f9fa=this;var _0x5ae2dd=utils[_0xcf32('0xf')](_0x13a3ad[0x0],this);logger['info'](_0xcf32('0x10'),_0x2568a1,_0x5ae2dd);sh[_0xcf32('0x11')](_[_0xcf32('0x12')](_0x5ae2dd),function(_0x243fee,_0x18e7f0){logger['info'](_0xcf32('0x13'),_0x2568a1,_0x243fee);if(_0x243fee==0x0){var _0x4f3816=_0x18e7f0[_0xcf32('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xcf32('0x15')](_0x13a3ad[0x1])||_[_0xcf32('0x16')](_0x13a3ad[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x2568a1);_0x24f9fa[_0xcf32('0x17')][_0x13a3ad[0x1]]=_0x4f3816;}else{logger[_0xcf32('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2568a1,_0x13a3ad[0x1],_0x4f3816);_0x24f9fa['body'][_0x13a3ad[0x1]]=_0x4f3816;}}_0x2000a6[_0xcf32('0xe')]();});}}catch(_0x3691ed){logger['error'](_0xcf32('0x9'),_0x2568a1,_['isObject'](_0x3691ed)?JSON[_0xcf32('0x18')](_0x3691ed):_0x3691ed);logger[_0xcf32('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2568a1);_0x2000a6['next']();}};}; \ No newline at end of file +var _0xcf7b=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','body','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim'];(function(_0x138d06,_0x33edf2){var _0x1a01eb=function(_0x387acb){while(--_0x387acb){_0x138d06['push'](_0x138d06['shift']());}};_0x1a01eb(++_0x33edf2);}(_0xcf7b,0x1bd));var _0xbcf7=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcf7b[_0xa148b7];return _0x51efd3;};'use strict';var schema=require(_0xbcf7('0x0'));var sh=require(_0xbcf7('0x1'));var _=require(_0xbcf7('0x2'));var utils=require(_0xbcf7('0x3'));var logger=require(_0xbcf7('0x4'))(_0xbcf7('0x5'));var system=schema({'command':{'type':_0xbcf7('0x6'),'required':!![],'message':_0xbcf7('0x7')}});exports['consequence']=function(_0x5738ca,_0x33cdb8){return function(_0x381390){try{var _0x389c06={'command':_0x33cdb8[0x0]};var _0x369a46=system[_0xbcf7('0x0')](_0x389c06,{'typecast':!![]});if(_0x369a46['length']){logger[_0xbcf7('0x8')](_0xbcf7('0x9'),_0x5738ca,_[_0xbcf7('0xa')](_0x369a46,'message')['join'](',\x20'));logger[_0xbcf7('0xb')](_0xbcf7('0xc'),_0x5738ca);_0x381390[_0xbcf7('0xd')]();}else{var _0x1338aa=this;var _0x6e9ae6=utils[_0xbcf7('0xe')](_0x33cdb8[0x0],this);logger[_0xbcf7('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5738ca,_0x6e9ae6);sh[_0xbcf7('0xf')](_[_0xbcf7('0x10')](_0x6e9ae6),function(_0x47240f,_0x427d64){logger['info'](_0xbcf7('0x11'),_0x5738ca,_0x47240f);if(_0x47240f==0x0){var _0xd865be=_0x427d64[_0xbcf7('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x33cdb8[0x1])||_['isEmpty'](_0x33cdb8[0x1])){logger[_0xbcf7('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x5738ca);_0x1338aa[_0xbcf7('0x13')][_0x33cdb8[0x1]]=_0xd865be;}else{logger[_0xbcf7('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5738ca,_0x33cdb8[0x1],_0xd865be);_0x1338aa[_0xbcf7('0x13')][_0x33cdb8[0x1]]=_0xd865be;}}_0x381390[_0xbcf7('0xd')]();});}}catch(_0x156d3c){logger[_0xbcf7('0x8')](_0xbcf7('0x9'),_0x5738ca,_[_0xbcf7('0x14')](_0x156d3c)?JSON[_0xbcf7('0x15')](_0x156d3c):_0x156d3c);logger['info'](_0xbcf7('0xc'),_0x5738ca);_0x381390[_0xbcf7('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index abb8dd7..2226a0d 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 _0x513a=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x26dd44,_0x2b0566){var _0x3938ef=function(_0x421325){while(--_0x421325){_0x26dd44['push'](_0x26dd44['shift']());}};_0x3938ef(++_0x2b0566);}(_0x513a,0xeb));var _0xa513=function(_0xf1ad51,_0x2bf1ab){_0xf1ad51=_0xf1ad51-0x0;var _0x394820=_0x513a[_0xf1ad51];return _0x394820;};'use strict';var schema=require(_0xa513('0x0'));var _=require(_0xa513('0x1'));var rpc={'chatInteraction':require(_0xa513('0x2')),'openchannelInteraction':require(_0xa513('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xa513('0x4')),'whatsappInteraction':require(_0xa513('0x5'))};var logger=require(_0xa513('0x6'))(_0xa513('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xa513('0x8')}});exports[_0xa513('0x9')]=function(_0x331ff3,_0x5d421f,_0x59e4a3,_0xbbe2ef){return function(_0x25c502){try{var _0x536414={'tag':_0x5d421f[0x0]};var _0x5aebd0=tag[_0xa513('0x0')](_0x536414,{'typecast':!![]});if(_0x5aebd0[_0xa513('0xa')]){logger[_0xa513('0xb')]('[%s][TAG]\x20%s',_0x331ff3,_[_0xa513('0xc')](_0x5aebd0,_0xa513('0xd'))[_0xa513('0xe')](',\x20'));logger[_0xa513('0xf')](_0xa513('0x10'),_0x331ff3);_0x25c502['next']();}else{var _0x2dcaea={'ids':[_0x5d421f[0x0]]};if(rpc[_0xbbe2ef['channel']+_0xa513('0x11')]){rpc[_0xbbe2ef[_0xa513('0x12')]+'Interaction']['addTags'](_0xbbe2ef[_0xa513('0x13')]['id'],_0x2dcaea)[_0xa513('0x14')](function(_0x54d87b){logger[_0xa513('0xf')](_0xa513('0x15'),_0x331ff3,_0x5d421f[0x1],_0xbbe2ef[_0xa513('0x12')],_0xbbe2ef[_0xa513('0x13')]['id']);})[_0xa513('0x16')](function(_0x2acd8c){logger['error'](_0xa513('0x17'),_0x331ff3,JSON[_0xa513('0x18')](_0x2acd8c));logger[_0xa513('0xf')](_0xa513('0x10'),_0x331ff3);})['finally'](function(){_0x25c502[_0xa513('0x19')]();});}}}catch(_0x1847a9){logger[_0xa513('0xb')](_0xa513('0x17'),_0x331ff3,_[_0xa513('0x1a')](_0x1847a9)?JSON[_0xa513('0x18')](_0x1847a9):_0x1847a9);logger[_0xa513('0xf')](_0xa513('0x10'),_0x331ff3);_0x25c502[_0xa513('0x19')]();}};}; \ No newline at end of file +var _0x4f13=['interaction','then','error','stringify','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags'];(function(_0x4d597d,_0x49fcc3){var _0xd378b1=function(_0x4ecfbc){while(--_0x4ecfbc){_0x4d597d['push'](_0x4d597d['shift']());}};_0xd378b1(++_0x49fcc3);}(_0x4f13,0x1b6));var _0x34f1=function(_0x1c60bd,_0x207c9b){_0x1c60bd=_0x1c60bd-0x0;var _0xc46ef9=_0x4f13[_0x1c60bd];return _0xc46ef9;};'use strict';var schema=require(_0x34f1('0x0'));var _=require(_0x34f1('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x34f1('0x2')),'smsInteraction':require(_0x34f1('0x3')),'mailInteraction':require(_0x34f1('0x4')),'faxInteraction':require(_0x34f1('0x5')),'whatsappInteraction':require(_0x34f1('0x6'))};var logger=require(_0x34f1('0x7'))(_0x34f1('0x8'));var tag=schema({'tag':{'type':_0x34f1('0x9'),'required':!![],'message':_0x34f1('0xa')}});exports[_0x34f1('0xb')]=function(_0x42d22d,_0x3bec5b,_0x5db8ad,_0x5be6ed){return function(_0x5c8f04){try{var _0x6db0e2={'tag':_0x3bec5b[0x0]};var _0x18dff5=tag[_0x34f1('0x0')](_0x6db0e2,{'typecast':!![]});if(_0x18dff5['length']){logger['error'](_0x34f1('0xc'),_0x42d22d,_['map'](_0x18dff5,_0x34f1('0xd'))[_0x34f1('0xe')](',\x20'));logger[_0x34f1('0xf')](_0x34f1('0x10'),_0x42d22d);_0x5c8f04[_0x34f1('0x11')]();}else{var _0x1ffb90={'ids':[_0x3bec5b[0x0]]};if(rpc[_0x5be6ed[_0x34f1('0x12')]+'Interaction']){rpc[_0x5be6ed['channel']+_0x34f1('0x13')][_0x34f1('0x14')](_0x5be6ed[_0x34f1('0x15')]['id'],_0x1ffb90)[_0x34f1('0x16')](function(_0xdef4dc){logger[_0x34f1('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x42d22d,_0x3bec5b[0x1],_0x5be6ed[_0x34f1('0x12')],_0x5be6ed['interaction']['id']);})['catch'](function(_0x15bf7b){logger[_0x34f1('0x17')]('[%s][TAG]\x20%s',_0x42d22d,JSON[_0x34f1('0x18')](_0x15bf7b));logger[_0x34f1('0xf')](_0x34f1('0x10'),_0x42d22d);})[_0x34f1('0x19')](function(){_0x5c8f04['next']();});}}}catch(_0x12aa9b){logger['error'](_0x34f1('0xc'),_0x42d22d,_[_0x34f1('0x1a')](_0x12aa9b)?JSON[_0x34f1('0x18')](_0x12aa9b):_0x12aa9b);logger[_0x34f1('0xf')](_0x34f1('0x10'),_0x42d22d);_0x5c8f04['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 734c2ad..3889da2 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 _0x2bdb=['mustache','exports','render','merge','contact','message','account','interaction','list'];(function(_0x32e4de,_0x7da1c5){var _0x51ba2a=function(_0x2a7322){while(--_0x2a7322){_0x32e4de['push'](_0x32e4de['shift']());}};_0x51ba2a(++_0x7da1c5);}(_0x2bdb,0x105));var _0xb2bd=function(_0x4e33dc,_0x9da02d){_0x4e33dc=_0x4e33dc-0x0;var _0x282f62=_0x2bdb[_0x4e33dc];return _0x282f62;};'use strict';var Mustache=require(_0xb2bd('0x0'));var _=require('lodash');module[_0xb2bd('0x1')]={'getMustacheRender':function(_0x4af8e4,_0x3b40de){return Mustache[_0xb2bd('0x2')](_0x4af8e4,_[_0xb2bd('0x3')](_0x3b40de['body'],{'contact':_0x3b40de[_0xb2bd('0x4')],'message':_0x3b40de[_0xb2bd('0x5')],'account':_0x3b40de[_0xb2bd('0x6')],'interaction':_0x3b40de[_0xb2bd('0x7')],'list':_0x3b40de[_0xb2bd('0x8')]}))||'';}}; \ No newline at end of file +var _0xe79a=['exports','render','merge','body','message','account','interaction'];(function(_0x438c81,_0x159f27){var _0x1fb54=function(_0x1d972d){while(--_0x1d972d){_0x438c81['push'](_0x438c81['shift']());}};_0x1fb54(++_0x159f27);}(_0xe79a,0x70));var _0xae79=function(_0x20e1fd,_0x506bf0){_0x20e1fd=_0x20e1fd-0x0;var _0x3be635=_0xe79a[_0x20e1fd];return _0x3be635;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0xae79('0x0')]={'getMustacheRender':function(_0x51f320,_0x9b2c0d){return Mustache[_0xae79('0x1')](_0x51f320,_[_0xae79('0x2')](_0x9b2c0d[_0xae79('0x3')],{'contact':_0x9b2c0d['contact'],'message':_0x9b2c0d[_0xae79('0x4')],'account':_0x9b2c0d[_0xae79('0x5')],'interaction':_0x9b2c0d[_0xae79('0x6')],'list':_0x9b2c0d['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9e892e8..e6a317c 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 _0x524a=['channel','mail','push','slice','dialogflowv2','amazonlex','TagId','%s:%s:%s','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','error','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','available','loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','join','app','.js','autoreply','appdata','split'];(function(_0x277495,_0x3dda02){var _0x54399a=function(_0x272001){while(--_0x272001){_0x277495['push'](_0x277495['shift']());}};_0x54399a(++_0x3dda02);}(_0x524a,0xf5));var _0xa524=function(_0x577af8,_0x589748){_0x577af8=_0x577af8-0x0;var _0x552fba=_0x524a[_0x577af8];return _0x552fba;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var fs=require('fs');var jayson=require(_0xa524('0x3'));var BPromise=require('bluebird');var uuid=require(_0xa524('0x4'));var config=require(_0xa524('0x5'));var logger=require(_0xa524('0x6'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xa524('0x7')),'chatQueueReport':require(_0xa524('0x8')),'smsQueueReport':require(_0xa524('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa524('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3a2dd6,_0x11aa98,_0x56849e){return util[_0xa524('0xb')](_0xa524('0xc'),_0x3a2dd6,_0x11aa98||0x0,_0x56849e||0x0);}function getIntervals(_0x228ffe,_0x13076e){var _0x3b484b=[];if(!_['isNil'](_0x13076e[_0xa524('0xd')])&&!_[_0xa524('0xe')](_0x228ffe[_0x13076e['IntervalId']])&&!_['isNil'](_0x228ffe[_0x13076e[_0xa524('0xd')]][_0xa524('0xf')])){_0x3b484b=_[_0xa524('0x10')](_0x228ffe[_0x13076e['IntervalId']]['Intervals'],_0xa524('0x11'));}else if(!_['isNil'](_0x13076e[_0xa524('0x11')])){_0x3b484b=[_0x13076e['interval']];}return _0x3b484b;}exports[_0xa524('0x12')]=function(_0x5c7e6a){_0x5c7e6a[_0xa524('0x13')]={};return new BPromise(function(_0x281137,_0x59620d){var _0x2d8bdb={'Start':function(_0x15b14c){var _0xe85361=this;return new Promise(function(_0x1de01e,_0x45347f){if(_0x15b14c){try{var _0x433c8a=[];var _0x371385=getId(_0x15b14c['channel'],_0x15b14c[_0xa524('0x14')]?_0x15b14c[_0xa524('0x14')]['id']:0x0,_0x15b14c[_0xa524('0x15')]?_0x15b14c[_0xa524('0x15')]['id']:0x0);if(_0x15b14c[_0xa524('0x16')]&&_[_0xa524('0x17')](_0x15b14c[_0xa524('0x16')])&&_0x15b14c[_0xa524('0x16')]['length']){for(var _0x304dea=0x0;_0x304dea<_0x15b14c[_0xa524('0x16')][_0xa524('0x18')];_0x304dea+=0x1){var _0x427f5f=_0x15b14c['applications'][_0x304dea];if(fs['existsSync'](path[_0xa524('0x19')](__dirname,_0xa524('0x16'),_0x427f5f[_0xa524('0x1a')]+_0xa524('0x1b')))){var _0x1e6abb=[];switch(_0x427f5f[_0xa524('0x1a')]['toLowerCase']()){case _0xa524('0x1c'):var _0x18c2bb=_0x427f5f[_0xa524('0x1d')][_0xa524('0x1e')](',');if(_0x15b14c[_0xa524('0x1f')]===_0xa524('0x20')){_0x1e6abb[_0xa524('0x21')](_0x18c2bb[0x0]);_0x1e6abb['push'](_0x18c2bb[0x1]);_0x1e6abb[_0xa524('0x21')](_0x18c2bb[_0xa524('0x22')](0x2,_0x18c2bb['length'])['join'](','));}else{_0x1e6abb[_0xa524('0x21')](_0x18c2bb[0x0]);_0x1e6abb[_0xa524('0x21')](_0x18c2bb[_0xa524('0x22')](0x1,_0x18c2bb[_0xa524('0x18')])[_0xa524('0x19')](','));}break;case'dialogflow':var _0x4f484a=_0x427f5f[_0xa524('0x1d')][_0xa524('0x1e')](',');_0x1e6abb[_0xa524('0x21')](_0x4f484a[0x0]);_0x1e6abb[_0xa524('0x21')](_0x4f484a[0x1]);_0x1e6abb['push'](_0x4f484a[_0xa524('0x22')](0x2,_0x4f484a[_0xa524('0x18')])['join'](','));break;case _0xa524('0x23'):var _0x147094=_0x427f5f['appdata'][_0xa524('0x1e')](',');_0x1e6abb['push'](_0x147094[0x0]);_0x1e6abb[_0xa524('0x21')](_0x147094[0x1]);_0x1e6abb[_0xa524('0x21')](_0x147094[0x2]);_0x1e6abb[_0xa524('0x21')](_0x147094[0x3]);_0x1e6abb[_0xa524('0x21')](_0x147094[_0xa524('0x22')](0x4,_0x147094[_0xa524('0x18')])[_0xa524('0x19')](','));break;case _0xa524('0x24'):var _0x40c4f1=_0x427f5f['appdata']['split'](',');_0x1e6abb[_0xa524('0x21')](_0x40c4f1[0x0]);_0x1e6abb['push'](_0x40c4f1[0x1]);_0x1e6abb['push'](_0x40c4f1[0x2]);_0x1e6abb[_0xa524('0x21')](_0x40c4f1[0x3]);_0x1e6abb[_0xa524('0x21')](_0x40c4f1[_0xa524('0x22')](0x4,_0x40c4f1[_0xa524('0x18')])['join'](','));break;case'message':_0x1e6abb[_0xa524('0x21')](_0x427f5f['appdata']);break;case'tag':_0x1e6abb[_0xa524('0x21')](_0x427f5f[_0xa524('0x25')]);_0x1e6abb[_0xa524('0x21')](_0x427f5f[_0xa524('0x1d')]);break;default:_0x1e6abb=_[_0xa524('0xe')](_0x427f5f[_0xa524('0x1d')])?[]:_0x427f5f[_0xa524('0x1d')][_0xa524('0x1e')](',');}var _0xa0a63f={'id':util[_0xa524('0xb')](_0xa524('0x26'),_0x371385,_0x427f5f['id'],_0x427f5f[_0xa524('0x1a')]),'condition':require('./interval')['condition'](_0x371385,getIntervals(_0x5c7e6a['intervals'],_0x427f5f),_0x5c7e6a),'consequence':require(_0xa524('0x27')+_0x427f5f[_0xa524('0x1a')])['consequence'](_0x371385,_0x1e6abb,_0x5c7e6a,_0x15b14c),'p':_0x427f5f[_0xa524('0x28')]||0x0};logger['info'](_0xa524('0x29'),_0xa0a63f['id'],_0xa524('0x2a'),getIntervals(_0x5c7e6a['intervals'],_0x427f5f)[_0xa524('0x19')](_0xa524('0x2b')));_0x433c8a[_0xa524('0x21')](_0xa0a63f);}else{logger['error'](_0xa524('0x2c'),path[_0xa524('0x19')](__dirname,'applications',_0x427f5f[_0xa524('0x1a')]+_0xa524('0x1b')));}}_0x5c7e6a['rules'][_0x371385]=new RuleEngine(_0x433c8a);_0x5c7e6a[_0xa524('0x13')][_0x371385][_0xa524('0x2d')](_0x15b14c,function(_0x49f275){logger[_0xa524('0x2e')](_0xa524('0x2f'),JSON[_0xa524('0x30')](_0x49f275[_0xa524('0x31')]));if(_0x5c7e6a[_0xa524('0x13')][_0x371385]){_0x5c7e6a[_0xa524('0x13')][_0x371385][_0xa524('0x32')](_0xa524('0x33'));}});return _0x1de01e({'code':0xc8,'message':_0x15b14c});}else{logger[_0xa524('0x2e')](_0xa524('0x34'));return _0x1de01e({'code':0xc8,'message':_0x15b14c});}}catch(_0x38e745){logger['error'](_0x38e745[_0xa524('0x35')]);return _0x45347f(_0xe85361['error'](0x1f4,_0x38e745));}}return _0x45347f(_0xa524('0x36'));});},'AcceptMessage':function(_0x24237c){var _0x35d92d=this;return new Promise(function(_0x11cd3f,_0x33068e){if(_0x24237c[_0xa524('0x37')]&&_0x24237c[_0xa524('0x37')]['id']){if(_0x5c7e6a[_0xa524('0x38')][_0x24237c[_0xa524('0x37')]['id']]){_0x5c7e6a[_0xa524('0x38')][_0x24237c['agent']['id']][_0xa524('0x39')]=![];_0x5c7e6a[_0xa524('0x38')][_0x24237c['agent']['id']][_0xa524('0x3a')]=undefined;}}if(_0x24237c[_0xa524('0x14')]&&_0x24237c['message']['id']){try{var _0x492851=getId(_0x24237c['channel'],_0x24237c['message']?_0x24237c['message']['id']:0x0,_0x24237c[_0xa524('0x15')]?_0x24237c[_0xa524('0x15')]['id']:0x0);if(_0x5c7e6a[_0xa524('0x13')][_0x492851]){_0x5c7e6a[_0xa524('0x13')][_0x492851]['emit'](_0xa524('0x3b'));if(rpc[_0x24237c[_0xa524('0x1f')]+_0xa524('0x3c')]){rpc[_0x24237c[_0xa524('0x1f')]+'QueueReport'][_0xa524('0x3d')](_0x492851,{'UserId':_0x24237c[_0xa524('0x14')][_0xa524('0x3e')]})[_0xa524('0x3f')](function(_0x239c77){logger['error'](_0xa524('0x40'));});}}return _0x11cd3f({'code':0xc8,'message':_0x24237c});}catch(_0xc3b40b){logger[_0xa524('0x41')](_0xc3b40b[_0xa524('0x35')]);return _0x33068e(_0x35d92d[_0xa524('0x41')](0x1f4,_0xc3b40b));}}logger[_0xa524('0x41')](_0xa524('0x42'));return _0x33068e(_0x35d92d[_0xa524('0x41')](0x1f4,_0xa524('0x42')));});},'RejectMessage':function(_0x4cee61){var _0x4b1207=this;return new Promise(function(_0x14ab60,_0x26096a){if(_0x4cee61[_0xa524('0x37')]&&_0x4cee61[_0xa524('0x37')]['id']){try{if(_0x5c7e6a[_0xa524('0x38')][_0x4cee61[_0xa524('0x37')]['id']]){_0x5c7e6a['agents'][_0x4cee61[_0xa524('0x37')]['id']][_0xa524('0x39')]=![];_0x5c7e6a[_0xa524('0x38')][_0x4cee61[_0xa524('0x37')]['id']][_0xa524('0x3a')]=undefined;}return _0x14ab60({'code':0xc8,'message':_0x4cee61});}catch(_0x451bbe){logger['error'](_0x451bbe[_0xa524('0x35')]);return _0x26096a(_0x4b1207[_0xa524('0x41')](0x1f4,_0x451bbe));}}logger[_0xa524('0x41')](_0xa524('0x42'));return _0x26096a(_0x4b1207[_0xa524('0x41')](0x1f4,_0xa524('0x42')));});},'AbandonInteraction':function(_0xef18b7){var _0xa35e5d=this;return new Promise(function(_0x41473f,_0x217314){if(_0xef18b7[_0xa524('0x1f')]&&_0xef18b7[_0xa524('0x15')]&&_0xef18b7[_0xa524('0x15')]['id']){try{var _0x90db67=getId(_0xef18b7[_0xa524('0x1f')],_0xef18b7['message']?_0xef18b7[_0xa524('0x14')]['id']:0x0,_0xef18b7[_0xa524('0x15')]?_0xef18b7['interaction']['id']:0x0);if(_0x5c7e6a['rules'][_0x90db67]){_0x5c7e6a[_0xa524('0x13')][_0x90db67][_0xa524('0x32')](_0xa524('0x3b'));}return _0x41473f({'code':0xc8,'message':_0xef18b7});}catch(_0xe4634c){logger[_0xa524('0x41')](_0xe4634c[_0xa524('0x35')]);return _0x217314(_0xa35e5d[_0xa524('0x41')](0x1f4,_0xe4634c));}}logger['error'](_0xa524('0x42'));return _0x217314(_0xa35e5d[_0xa524('0x41')](0x1f4,_0xa524('0x42')));});},'AgentCapacity':function(_0x19525f){var _0x496e78=this;return new Promise(function(_0x481e0d,_0x1c017d){if(_0x5c7e6a['agents'][_0xa524('0x43')](_0x19525f['id'])){for(var _0x47217a in _0x19525f[_0xa524('0x44')]){if(_0x19525f[_0xa524('0x44')][_0xa524('0x43')](_0x47217a)){if(_0x5c7e6a[_0xa524('0x38')][_0x19525f['id']][_0xa524('0x43')](_0x47217a+'CurrentCapacity')){_0x5c7e6a['agents'][_0x19525f['id']][_0x47217a+_0xa524('0x45')]=parseInt(_0x19525f[_0xa524('0x44')][_0x47217a],0xa);}}}_0x5c7e6a[_0xa524('0x38')][_0x19525f['id']]['updateRealtime']();return _0x481e0d({'code':0xc8,'message':_0x5c7e6a[_0xa524('0x38')][_0x19525f['id']]});}else{return _0x1c017d(_0x496e78[_0xa524('0x41')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x420491){return new Promise(function(_0x208d94,_0x1563ef){var _0x3e841e=_[_0xa524('0x46')](_0x5c7e6a[_0xa524('0x38')]);_0x208d94({'count':_0x3e841e[_0xa524('0x18')],'rows':_0x3e841e});});},'ChatQueues':function(_0x5483a6){return new Promise(function(_0xdbda6e,_0xa4c535){var _0x467144=[];for(var _0x1ef1aa in _0x5c7e6a['chatQueues']){if(_0x5c7e6a[_0xa524('0x47')][_0xa524('0x43')](_0x1ef1aa)){var _0x5cd707=_0x5c7e6a[_0xa524('0x47')][_0x1ef1aa];var _0x2397f8={'id':_0x5cd707['id'],'available':_0x5cd707[_0xa524('0x48')],'loggedIn':_0x5cd707[_0xa524('0x49')],'name':_0x5cd707['name'],'paused':_0x5cd707['paused'],'waiting':_0x5cd707[_0xa524('0x4a')]};_0x467144['push'](_0x2397f8);}}_0xdbda6e({'count':_0x467144['length'],'rows':_0x467144});});},'MailQueues':function(_0x593510){return new Promise(function(_0x2e5216,_0x59d66a){var _0x5d5a44=[];for(var _0x27525a in _0x5c7e6a[_0xa524('0x4b')]){if(_0x5c7e6a[_0xa524('0x4b')][_0xa524('0x43')](_0x27525a)){var _0x59191f=_0x5c7e6a[_0xa524('0x4b')][_0x27525a];var _0x2878e5={'id':_0x59191f['id'],'available':_0x59191f[_0xa524('0x48')],'loggedIn':_0x59191f['loggedIn'],'name':_0x59191f[_0xa524('0x4c')],'paused':_0x59191f[_0xa524('0x4d')],'waiting':_0x59191f['waiting']};_0x5d5a44['push'](_0x2878e5);}}_0x2e5216({'count':_0x5d5a44[_0xa524('0x18')],'rows':_0x5d5a44});});},'OpenchannelQueues':function(_0x3e8167){return new Promise(function(_0x158e1c,_0x1cdbf3){var _0x573e49=[];for(var _0x4d1f65 in _0x5c7e6a[_0xa524('0x4e')]){if(_0x5c7e6a[_0xa524('0x4e')][_0xa524('0x43')](_0x4d1f65)){var _0x5694b5=_0x5c7e6a['openchannelQueues'][_0x4d1f65];var _0x40edbd={'id':_0x5694b5['id'],'available':_0x5694b5['available'],'loggedIn':_0x5694b5['loggedIn'],'name':_0x5694b5['name'],'paused':_0x5694b5['paused'],'waiting':_0x5694b5[_0xa524('0x4a')]};_0x573e49[_0xa524('0x21')](_0x40edbd);}}_0x158e1c({'count':_0x573e49['length'],'rows':_0x573e49});});},'SmsQueues':function(_0x4ab4bc){return new Promise(function(_0x3c9028,_0x19da31){var _0x50ec48=[];for(var _0x45c52e in _0x5c7e6a[_0xa524('0x4f')]){if(_0x5c7e6a[_0xa524('0x4f')][_0xa524('0x43')](_0x45c52e)){var _0x36d2f8=_0x5c7e6a[_0xa524('0x4f')][_0x45c52e];var _0x3b2aea={'id':_0x36d2f8['id'],'available':_0x36d2f8[_0xa524('0x48')],'loggedIn':_0x36d2f8[_0xa524('0x49')],'name':_0x36d2f8[_0xa524('0x4c')],'paused':_0x36d2f8['paused'],'waiting':_0x36d2f8[_0xa524('0x4a')]};_0x50ec48[_0xa524('0x21')](_0x3b2aea);}}_0x3c9028({'count':_0x50ec48[_0xa524('0x18')],'rows':_0x50ec48});});},'FaxQueues':function(_0x1f6f53){return new Promise(function(_0x241b41,_0x45d609){var _0x59a7a1=[];for(var _0x590323 in _0x5c7e6a[_0xa524('0x50')]){if(_0x5c7e6a['faxQueues'][_0xa524('0x43')](_0x590323)){var _0x37e767=_0x5c7e6a[_0xa524('0x50')][_0x590323];var _0x4975bb={'id':_0x37e767['id'],'available':_0x37e767[_0xa524('0x48')],'loggedIn':_0x37e767[_0xa524('0x49')],'name':_0x37e767[_0xa524('0x4c')],'paused':_0x37e767[_0xa524('0x4d')],'waiting':_0x37e767[_0xa524('0x4a')]};_0x59a7a1[_0xa524('0x21')](_0x4975bb);}}_0x241b41({'count':_0x59a7a1[_0xa524('0x18')],'rows':_0x59a7a1});});},'WhatsappQueues':function(_0x4c9be4){return new Promise(function(_0x319119,_0x2c52fa){var _0x1c9a40=[];for(var _0x99ef26 in _0x5c7e6a[_0xa524('0x51')]){if(_0x5c7e6a[_0xa524('0x51')]['hasOwnProperty'](_0x99ef26)){var _0x224d75=_0x5c7e6a[_0xa524('0x51')][_0x99ef26];var _0x9e7949={'id':_0x224d75['id'],'available':_0x224d75['available'],'loggedIn':_0x224d75['loggedIn'],'name':_0x224d75[_0xa524('0x4c')],'paused':_0x224d75[_0xa524('0x4d')],'waiting':_0x224d75[_0xa524('0x4a')]};_0x1c9a40[_0xa524('0x21')](_0x9e7949);}}_0x319119({'count':_0x1c9a40[_0xa524('0x18')],'rows':_0x1c9a40});});},'ChatQueuesWaitingInteractions':function(_0xf934dc){return new Promise(function(_0x780cf7,_0x21c9e0){var _0x1da85f=_['values'](_0x5c7e6a[_0xa524('0x52')]);_0x780cf7({'count':_0x1da85f[_0xa524('0x18')],'rows':_0x1da85f});});},'MailQueuesWaitingInteractions':function(_0x5100f9){return new Promise(function(_0x1b3ebe,_0x2f06cb){var _0x34e5a6=_[_0xa524('0x46')](_0x5c7e6a[_0xa524('0x53')]);_0x1b3ebe({'count':_0x34e5a6[_0xa524('0x18')],'rows':_0x34e5a6});});},'OpenchannelQueuesWaitingInteractions':function(_0x482043){return new Promise(function(_0x5238a8,_0x532b0f){var _0x43cf85=_['values'](_0x5c7e6a['openchannelQueuesWaitingInteractions']);_0x5238a8({'count':_0x43cf85[_0xa524('0x18')],'rows':_0x43cf85});});},'SmsQueuesWaitingInteractions':function(_0x297723){return new Promise(function(_0x3d0b16,_0x19a7fb){var _0x40420b=_[_0xa524('0x46')](_0x5c7e6a['smsQueuesWaitingInteractions']);_0x3d0b16({'count':_0x40420b[_0xa524('0x18')],'rows':_0x40420b});});},'FaxQueuesWaitingInteractions':function(_0xb51aa9){return new Promise(function(_0x5abdbd,_0x1d1319){var _0x5e8bc2=_[_0xa524('0x46')](_0x5c7e6a[_0xa524('0x54')]);_0x5abdbd({'count':_0x5e8bc2['length'],'rows':_0x5e8bc2});});},'WhatsappQueuesWaitingInteractions':function(_0x3a850c){return new Promise(function(_0x59f653,_0x537a0c){var _0x430c40=_[_0xa524('0x46')](_0x5c7e6a[_0xa524('0x55')]);_0x59f653({'count':_0x430c40[_0xa524('0x18')],'rows':_0x430c40});});}};var _0x2765ce=jayson[_0xa524('0x56')](_0x2d8bdb)[_0xa524('0x57')]();_0x2765ce['on'](_0xa524('0x41'),function(_0x40b92e){logger[_0xa524('0x41')](JSON['stringify'](_0x40b92e));return _0x59620d(_0x40b92e);});_0x2765ce[_0xa524('0x12')](0x232c,_0xa524('0x58'),function(){console[_0xa524('0x59')](_0xa524('0x5a'),0x232c);return _0x281137(_0xa524('0x5b')+0x232c);});});}; \ No newline at end of file +var _0x984b=['push','slice','dialogflow','amazonlex','tag','TagId','format','./interval','intervals','./applications/','consequence','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','matchPath','emit','complete','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','uuid','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split'];(function(_0x336365,_0x29bd2f){var _0x52deb3=function(_0x4e24e2){while(--_0x4e24e2){_0x336365['push'](_0x336365['shift']());}};_0x52deb3(++_0x29bd2f);}(_0x984b,0xee));var _0xb984=function(_0xae3ccd,_0x200177){_0xae3ccd=_0xae3ccd-0x0;var _0x4d5295=_0x984b[_0xae3ccd];return _0x4d5295;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xb984('0x0'));var BPromise=require(_0xb984('0x1'));var uuid=require(_0xb984('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xb984('0x3'));var rpc={'openchannelQueueReport':require(_0xb984('0x4')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xb984('0x5')),'faxQueueReport':require(_0xb984('0x6')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xb984('0x7'));function getId(_0x1a00d6,_0x4d72b7,_0x37fd36){return util['format'](_0xb984('0x8'),_0x1a00d6,_0x4d72b7||0x0,_0x37fd36||0x0);}function getIntervals(_0x42dfd9,_0x124143){var _0x2f4e77=[];if(!_[_0xb984('0x9')](_0x124143[_0xb984('0xa')])&&!_[_0xb984('0x9')](_0x42dfd9[_0x124143[_0xb984('0xa')]])&&!_[_0xb984('0x9')](_0x42dfd9[_0x124143[_0xb984('0xa')]][_0xb984('0xb')])){_0x2f4e77=_[_0xb984('0xc')](_0x42dfd9[_0x124143['IntervalId']][_0xb984('0xb')],'interval');}else if(!_[_0xb984('0x9')](_0x124143[_0xb984('0xd')])){_0x2f4e77=[_0x124143['interval']];}return _0x2f4e77;}exports[_0xb984('0xe')]=function(_0x2e7986){_0x2e7986['rules']={};return new BPromise(function(_0x203dba,_0x7a1b60){var _0x549791={'Start':function(_0xede12d){var _0x4073cb=this;return new Promise(function(_0x57365c,_0x6fae41){if(_0xede12d){try{var _0x5cd1aa=[];var _0x3b8241=getId(_0xede12d[_0xb984('0xf')],_0xede12d[_0xb984('0x10')]?_0xede12d[_0xb984('0x10')]['id']:0x0,_0xede12d['interaction']?_0xede12d[_0xb984('0x11')]['id']:0x0);if(_0xede12d[_0xb984('0x12')]&&_[_0xb984('0x13')](_0xede12d[_0xb984('0x12')])&&_0xede12d[_0xb984('0x12')][_0xb984('0x14')]){for(var _0x5c2e25=0x0;_0x5c2e25<_0xede12d[_0xb984('0x12')][_0xb984('0x14')];_0x5c2e25+=0x1){var _0x694978=_0xede12d[_0xb984('0x12')][_0x5c2e25];if(fs[_0xb984('0x15')](path[_0xb984('0x16')](__dirname,'applications',_0x694978[_0xb984('0x17')]+_0xb984('0x18')))){var _0x551ad4=[];switch(_0x694978[_0xb984('0x17')][_0xb984('0x19')]()){case _0xb984('0x1a'):var _0x932579=_0x694978[_0xb984('0x1b')][_0xb984('0x1c')](',');if(_0xede12d[_0xb984('0xf')]==='mail'){_0x551ad4[_0xb984('0x1d')](_0x932579[0x0]);_0x551ad4[_0xb984('0x1d')](_0x932579[0x1]);_0x551ad4[_0xb984('0x1d')](_0x932579['slice'](0x2,_0x932579[_0xb984('0x14')])[_0xb984('0x16')](','));}else{_0x551ad4[_0xb984('0x1d')](_0x932579[0x0]);_0x551ad4[_0xb984('0x1d')](_0x932579[_0xb984('0x1e')](0x1,_0x932579[_0xb984('0x14')])[_0xb984('0x16')](','));}break;case _0xb984('0x1f'):var _0x5d93d9=_0x694978[_0xb984('0x1b')][_0xb984('0x1c')](',');_0x551ad4[_0xb984('0x1d')](_0x5d93d9[0x0]);_0x551ad4[_0xb984('0x1d')](_0x5d93d9[0x1]);_0x551ad4['push'](_0x5d93d9[_0xb984('0x1e')](0x2,_0x5d93d9[_0xb984('0x14')])[_0xb984('0x16')](','));break;case'dialogflowv2':var _0x363e33=_0x694978[_0xb984('0x1b')][_0xb984('0x1c')](',');_0x551ad4[_0xb984('0x1d')](_0x363e33[0x0]);_0x551ad4['push'](_0x363e33[0x1]);_0x551ad4['push'](_0x363e33[0x2]);_0x551ad4['push'](_0x363e33[0x3]);_0x551ad4[_0xb984('0x1d')](_0x363e33[_0xb984('0x1e')](0x4,_0x363e33['length'])[_0xb984('0x16')](','));break;case _0xb984('0x20'):var _0x30d338=_0x694978[_0xb984('0x1b')]['split'](',');_0x551ad4['push'](_0x30d338[0x0]);_0x551ad4[_0xb984('0x1d')](_0x30d338[0x1]);_0x551ad4[_0xb984('0x1d')](_0x30d338[0x2]);_0x551ad4[_0xb984('0x1d')](_0x30d338[0x3]);_0x551ad4[_0xb984('0x1d')](_0x30d338['slice'](0x4,_0x30d338[_0xb984('0x14')])[_0xb984('0x16')](','));break;case _0xb984('0x10'):_0x551ad4[_0xb984('0x1d')](_0x694978[_0xb984('0x1b')]);break;case _0xb984('0x21'):_0x551ad4['push'](_0x694978[_0xb984('0x22')]);_0x551ad4[_0xb984('0x1d')](_0x694978[_0xb984('0x1b')]);break;default:_0x551ad4=_[_0xb984('0x9')](_0x694978[_0xb984('0x1b')])?[]:_0x694978[_0xb984('0x1b')]['split'](',');}var _0x31f490={'id':util[_0xb984('0x23')]('%s:%s:%s',_0x3b8241,_0x694978['id'],_0x694978['app']),'condition':require(_0xb984('0x24'))['condition'](_0x3b8241,getIntervals(_0x2e7986[_0xb984('0x25')],_0x694978),_0x2e7986),'consequence':require(_0xb984('0x26')+_0x694978['app'])[_0xb984('0x27')](_0x3b8241,_0x551ad4,_0x2e7986,_0xede12d),'p':_0x694978['priority']||0x0};logger[_0xb984('0x28')]('Push\x20new\x20rule',_0x31f490['id'],_0xb984('0x29'),getIntervals(_0x2e7986['intervals'],_0x694978)['join'](_0xb984('0x2a')));_0x5cd1aa[_0xb984('0x1d')](_0x31f490);}else{logger['error'](_0xb984('0x2b'),path[_0xb984('0x16')](__dirname,'applications',_0x694978[_0xb984('0x17')]+_0xb984('0x18')));}}_0x2e7986[_0xb984('0x2c')][_0x3b8241]=new RuleEngine(_0x5cd1aa);_0x2e7986[_0xb984('0x2c')][_0x3b8241]['execute'](_0xede12d,function(_0x1adcb){logger[_0xb984('0x28')](_0xb984('0x2d'),JSON[_0xb984('0x2e')](_0x1adcb[_0xb984('0x2f')]));if(_0x2e7986[_0xb984('0x2c')][_0x3b8241]){_0x2e7986[_0xb984('0x2c')][_0x3b8241][_0xb984('0x30')](_0xb984('0x31'));}});return _0x57365c({'code':0xc8,'message':_0xede12d});}else{logger[_0xb984('0x28')]('No\x20applications\x20to\x20execute');return _0x57365c({'code':0xc8,'message':_0xede12d});}}catch(_0x134ba5){logger[_0xb984('0x32')](_0x134ba5[_0xb984('0x33')]);return _0x6fae41(_0x4073cb[_0xb984('0x32')](0x1f4,_0x134ba5));}}return _0x6fae41(_0xb984('0x34'));});},'AcceptMessage':function(_0x1e06aa){var _0x1e8323=this;return new Promise(function(_0xce2f71,_0x52181e){if(_0x1e06aa['agent']&&_0x1e06aa[_0xb984('0x35')]['id']){if(_0x2e7986['agents'][_0x1e06aa[_0xb984('0x35')]['id']]){_0x2e7986[_0xb984('0x36')][_0x1e06aa[_0xb984('0x35')]['id']][_0xb984('0x37')]=![];_0x2e7986['agents'][_0x1e06aa[_0xb984('0x35')]['id']][_0xb984('0x38')]=undefined;}}if(_0x1e06aa['message']&&_0x1e06aa[_0xb984('0x10')]['id']){try{var _0xb61add=getId(_0x1e06aa[_0xb984('0xf')],_0x1e06aa[_0xb984('0x10')]?_0x1e06aa[_0xb984('0x10')]['id']:0x0,_0x1e06aa[_0xb984('0x11')]?_0x1e06aa[_0xb984('0x11')]['id']:0x0);if(_0x2e7986['rules'][_0xb61add]){_0x2e7986[_0xb984('0x2c')][_0xb61add][_0xb984('0x30')]('end');if(rpc[_0x1e06aa['channel']+_0xb984('0x39')]){rpc[_0x1e06aa[_0xb984('0xf')]+_0xb984('0x39')][_0xb984('0x3a')](_0xb61add,{'UserId':_0x1e06aa[_0xb984('0x10')]['UserId']})[_0xb984('0x3b')](function(_0x40666f){logger[_0xb984('0x32')](_0xb984('0x3c'));});}}return _0xce2f71({'code':0xc8,'message':_0x1e06aa});}catch(_0x460a7e){logger[_0xb984('0x32')](_0x460a7e[_0xb984('0x33')]);return _0x52181e(_0x1e8323[_0xb984('0x32')](0x1f4,_0x460a7e));}}logger[_0xb984('0x32')](_0xb984('0x3d'));return _0x52181e(_0x1e8323['error'](0x1f4,_0xb984('0x3d')));});},'RejectMessage':function(_0x71880c){var _0x4bd4db=this;return new Promise(function(_0x1ba546,_0x436597){if(_0x71880c[_0xb984('0x35')]&&_0x71880c[_0xb984('0x35')]['id']){try{if(_0x2e7986[_0xb984('0x36')][_0x71880c[_0xb984('0x35')]['id']]){_0x2e7986[_0xb984('0x36')][_0x71880c[_0xb984('0x35')]['id']][_0xb984('0x37')]=![];_0x2e7986[_0xb984('0x36')][_0x71880c['agent']['id']][_0xb984('0x38')]=undefined;}return _0x1ba546({'code':0xc8,'message':_0x71880c});}catch(_0x303280){logger[_0xb984('0x32')](_0x303280[_0xb984('0x33')]);return _0x436597(_0x4bd4db[_0xb984('0x32')](0x1f4,_0x303280));}}logger[_0xb984('0x32')](_0xb984('0x3d'));return _0x436597(_0x4bd4db[_0xb984('0x32')](0x1f4,_0xb984('0x3d')));});},'AbandonInteraction':function(_0x5c3d82){var _0x386faf=this;return new Promise(function(_0x36e411,_0x3a7cbb){if(_0x5c3d82['channel']&&_0x5c3d82[_0xb984('0x11')]&&_0x5c3d82[_0xb984('0x11')]['id']){try{var _0x4e777e=getId(_0x5c3d82[_0xb984('0xf')],_0x5c3d82['message']?_0x5c3d82[_0xb984('0x10')]['id']:0x0,_0x5c3d82[_0xb984('0x11')]?_0x5c3d82['interaction']['id']:0x0);if(_0x2e7986[_0xb984('0x2c')][_0x4e777e]){_0x2e7986[_0xb984('0x2c')][_0x4e777e][_0xb984('0x30')](_0xb984('0x3e'));}return _0x36e411({'code':0xc8,'message':_0x5c3d82});}catch(_0xbf328d){logger[_0xb984('0x32')](_0xbf328d['stack']);return _0x3a7cbb(_0x386faf[_0xb984('0x32')](0x1f4,_0xbf328d));}}logger['error'](_0xb984('0x3d'));return _0x3a7cbb(_0x386faf[_0xb984('0x32')](0x1f4,_0xb984('0x3d')));});},'AgentCapacity':function(_0x5cf038){var _0x47ab3a=this;return new Promise(function(_0xeb208e,_0x2dfaf8){if(_0x2e7986['agents']['hasOwnProperty'](_0x5cf038['id'])){for(var _0x1e8847 in _0x5cf038[_0xb984('0x3f')]){if(_0x5cf038[_0xb984('0x3f')][_0xb984('0x40')](_0x1e8847)){if(_0x2e7986[_0xb984('0x36')][_0x5cf038['id']][_0xb984('0x40')](_0x1e8847+'CurrentCapacity')){_0x2e7986['agents'][_0x5cf038['id']][_0x1e8847+_0xb984('0x41')]=parseInt(_0x5cf038[_0xb984('0x3f')][_0x1e8847],0xa);}}}_0x2e7986['agents'][_0x5cf038['id']][_0xb984('0x42')]();return _0xeb208e({'code':0xc8,'message':_0x2e7986[_0xb984('0x36')][_0x5cf038['id']]});}else{return _0x2dfaf8(_0x47ab3a[_0xb984('0x32')](0x1f4,_0xb984('0x43')));}});},'Agents':function(_0x529f64){return new Promise(function(_0x4d719c,_0x226db2){var _0x36a9eb=_[_0xb984('0x44')](_0x2e7986[_0xb984('0x36')]);_0x4d719c({'count':_0x36a9eb[_0xb984('0x14')],'rows':_0x36a9eb});});},'ChatQueues':function(_0x3cc2a0){return new Promise(function(_0x49ecfd,_0x2de42b){var _0x261be7=[];for(var _0x7c47aa in _0x2e7986[_0xb984('0x45')]){if(_0x2e7986[_0xb984('0x45')][_0xb984('0x40')](_0x7c47aa)){var _0x575503=_0x2e7986['chatQueues'][_0x7c47aa];var _0x518120={'id':_0x575503['id'],'available':_0x575503[_0xb984('0x46')],'loggedIn':_0x575503[_0xb984('0x47')],'name':_0x575503[_0xb984('0x48')],'paused':_0x575503[_0xb984('0x49')],'waiting':_0x575503[_0xb984('0x4a')]};_0x261be7['push'](_0x518120);}}_0x49ecfd({'count':_0x261be7[_0xb984('0x14')],'rows':_0x261be7});});},'MailQueues':function(_0x32aa84){return new Promise(function(_0x356442,_0x5549f3){var _0x935abe=[];for(var _0x10e37b in _0x2e7986['mailQueues']){if(_0x2e7986['mailQueues'][_0xb984('0x40')](_0x10e37b)){var _0x4b7bd2=_0x2e7986['mailQueues'][_0x10e37b];var _0x174384={'id':_0x4b7bd2['id'],'available':_0x4b7bd2['available'],'loggedIn':_0x4b7bd2[_0xb984('0x47')],'name':_0x4b7bd2[_0xb984('0x48')],'paused':_0x4b7bd2[_0xb984('0x49')],'waiting':_0x4b7bd2[_0xb984('0x4a')]};_0x935abe[_0xb984('0x1d')](_0x174384);}}_0x356442({'count':_0x935abe[_0xb984('0x14')],'rows':_0x935abe});});},'OpenchannelQueues':function(_0x145052){return new Promise(function(_0x1a81c3,_0x4269e0){var _0x2b187f=[];for(var _0x742a0f in _0x2e7986[_0xb984('0x4b')]){if(_0x2e7986['openchannelQueues'][_0xb984('0x40')](_0x742a0f)){var _0x5f126e=_0x2e7986[_0xb984('0x4b')][_0x742a0f];var _0x511780={'id':_0x5f126e['id'],'available':_0x5f126e['available'],'loggedIn':_0x5f126e[_0xb984('0x47')],'name':_0x5f126e[_0xb984('0x48')],'paused':_0x5f126e[_0xb984('0x49')],'waiting':_0x5f126e['waiting']};_0x2b187f[_0xb984('0x1d')](_0x511780);}}_0x1a81c3({'count':_0x2b187f[_0xb984('0x14')],'rows':_0x2b187f});});},'SmsQueues':function(_0x323d6b){return new Promise(function(_0x3508cb,_0x434c5c){var _0x1793e2=[];for(var _0x2e0df9 in _0x2e7986[_0xb984('0x4c')]){if(_0x2e7986[_0xb984('0x4c')][_0xb984('0x40')](_0x2e0df9)){var _0x1afc8d=_0x2e7986[_0xb984('0x4c')][_0x2e0df9];var _0x1afaa2={'id':_0x1afc8d['id'],'available':_0x1afc8d[_0xb984('0x46')],'loggedIn':_0x1afc8d['loggedIn'],'name':_0x1afc8d[_0xb984('0x48')],'paused':_0x1afc8d['paused'],'waiting':_0x1afc8d[_0xb984('0x4a')]};_0x1793e2['push'](_0x1afaa2);}}_0x3508cb({'count':_0x1793e2[_0xb984('0x14')],'rows':_0x1793e2});});},'FaxQueues':function(_0x59ce18){return new Promise(function(_0x278a0d,_0xae996e){var _0x33b124=[];for(var _0x32e1c2 in _0x2e7986[_0xb984('0x4d')]){if(_0x2e7986[_0xb984('0x4d')][_0xb984('0x40')](_0x32e1c2)){var _0x40a9ac=_0x2e7986[_0xb984('0x4d')][_0x32e1c2];var _0x4247e7={'id':_0x40a9ac['id'],'available':_0x40a9ac[_0xb984('0x46')],'loggedIn':_0x40a9ac['loggedIn'],'name':_0x40a9ac['name'],'paused':_0x40a9ac[_0xb984('0x49')],'waiting':_0x40a9ac[_0xb984('0x4a')]};_0x33b124[_0xb984('0x1d')](_0x4247e7);}}_0x278a0d({'count':_0x33b124['length'],'rows':_0x33b124});});},'WhatsappQueues':function(_0x45ee77){return new Promise(function(_0x45a7ff,_0x50544b){var _0x4ebe30=[];for(var _0x5b1291 in _0x2e7986[_0xb984('0x4e')]){if(_0x2e7986['whatsappQueues']['hasOwnProperty'](_0x5b1291)){var _0x56500d=_0x2e7986[_0xb984('0x4e')][_0x5b1291];var _0x1ecc45={'id':_0x56500d['id'],'available':_0x56500d[_0xb984('0x46')],'loggedIn':_0x56500d[_0xb984('0x47')],'name':_0x56500d['name'],'paused':_0x56500d['paused'],'waiting':_0x56500d[_0xb984('0x4a')]};_0x4ebe30[_0xb984('0x1d')](_0x1ecc45);}}_0x45a7ff({'count':_0x4ebe30[_0xb984('0x14')],'rows':_0x4ebe30});});},'ChatQueuesWaitingInteractions':function(_0xe4e069){return new Promise(function(_0x307263,_0x5ce513){var _0x2063cd=_[_0xb984('0x44')](_0x2e7986[_0xb984('0x4f')]);_0x307263({'count':_0x2063cd[_0xb984('0x14')],'rows':_0x2063cd});});},'MailQueuesWaitingInteractions':function(_0x11992a){return new Promise(function(_0x19f73b,_0x4f51a0){var _0x1bb691=_['values'](_0x2e7986[_0xb984('0x50')]);_0x19f73b({'count':_0x1bb691[_0xb984('0x14')],'rows':_0x1bb691});});},'OpenchannelQueuesWaitingInteractions':function(_0x249101){return new Promise(function(_0x133cfc,_0x1d18e8){var _0x532ddc=_[_0xb984('0x44')](_0x2e7986[_0xb984('0x51')]);_0x133cfc({'count':_0x532ddc[_0xb984('0x14')],'rows':_0x532ddc});});},'SmsQueuesWaitingInteractions':function(_0x4c4e45){return new Promise(function(_0x1cfdcc,_0x2b5bd1){var _0x19fb4f=_[_0xb984('0x44')](_0x2e7986[_0xb984('0x52')]);_0x1cfdcc({'count':_0x19fb4f['length'],'rows':_0x19fb4f});});},'FaxQueuesWaitingInteractions':function(_0x504d1a){return new Promise(function(_0x16ad6b,_0x31d101){var _0x2353cd=_[_0xb984('0x44')](_0x2e7986['faxQueuesWaitingInteractions']);_0x16ad6b({'count':_0x2353cd[_0xb984('0x14')],'rows':_0x2353cd});});},'WhatsappQueuesWaitingInteractions':function(_0x34ce92){return new Promise(function(_0x286d56,_0x199e48){var _0x5e4b1f=_[_0xb984('0x44')](_0x2e7986[_0xb984('0x53')]);_0x286d56({'count':_0x5e4b1f[_0xb984('0x14')],'rows':_0x5e4b1f});});}};var _0x1a619f=jayson['server'](_0x549791)[_0xb984('0x54')]();_0x1a619f['on'](_0xb984('0x32'),function(_0x1d62e6){logger[_0xb984('0x32')](JSON[_0xb984('0x2e')](_0x1d62e6));return _0x7a1b60(_0x1d62e6);});_0x1a619f[_0xb984('0xe')](0x232c,_0xb984('0x55'),function(){console[_0xb984('0x56')](_0xb984('0x57'),0x232c);return _0x203dba(_0xb984('0x58')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e58d9f2..74b5d58 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 _0x64bf=['push','iftime\x20%s','then','indexOf','catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','jayson/promise','../../../config/logger','routing','client','http','request','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length'];(function(_0x2eaec3,_0x43d077){var _0x2af468=function(_0x1fd8a6){while(--_0x1fd8a6){_0x2eaec3['push'](_0x2eaec3['shift']());}};_0x2af468(++_0x43d077);}(_0x64bf,0x186));var _0xf64b=function(_0x2104c4,_0x3b3aa6){_0x2104c4=_0x2104c4-0x0;var _0x2d2d47=_0x64bf[_0x2104c4];return _0x2d2d47;};'use strict';var util=require(_0xf64b('0x0'));var BPromise=require('bluebird');var jayson=require(_0xf64b('0x1'));var _=require('lodash');var logger=require(_0xf64b('0x2'))(_0xf64b('0x3'));var client=jayson[_0xf64b('0x4')][_0xf64b('0x5')]({'port':0x232a});function request(_0x894057,_0x27c0b5){return new BPromise(function(_0x13b1db,_0x6bab91){return client[_0xf64b('0x6')](_0x894057,_0x27c0b5)['then'](function(_0x572098){if(_0x572098[_0xf64b('0x7')]){return _0x6bab91(_0x572098[_0xf64b('0x7')][_0xf64b('0x8')]);}else{return _0x13b1db(_0x572098[_0xf64b('0x9')]);}})['catch'](function(_0x3c48cd){return _0x6bab91(_0x3c48cd);});});}exports[_0xf64b('0xa')]=function(_0x2a1c4e,_0xaef4ea,_0x5250af){return function(_0x5bd399){if(_0x5250af[_0xf64b('0xb')]&&!_0x5250af[_0xf64b('0xb')][_0x2a1c4e]){logger[_0xf64b('0xc')](_0xf64b('0xd'),_0x2a1c4e);return _0x5bd399[_0xf64b('0xe')]();}var _0x2416b4=[];for(var _0x29d265=0x0;_0x29d265<_0xaef4ea[_0xf64b('0xf')];_0x29d265+=0x1){_0x2416b4[_0xf64b('0x10')](request('Command',{'command':util['format'](_0xf64b('0x11'),_0xaef4ea[_0x29d265])})[_0xf64b('0x12')](function(_0x485804){return _0x485804&&_0x485804[_0xf64b('0x8')]&&_0x485804[_0xf64b('0x8')][_0xf64b('0x13')]('true')>=0x0?!![]:![];})[_0xf64b('0x14')](function(_0x5af23b){logger['error'](_0xf64b('0x15'),_0x2a1c4e,_0xaef4ea[_0x29d265]);}));}BPromise[_0xf64b('0x16')](_0x2416b4)[_0xf64b('0x12')](function(_0x4e0c9b){var _0x2f2119=_['some'](_0x4e0c9b);logger[_0xf64b('0xc')](_0xf64b('0x17'),_0x2a1c4e,_0xaef4ea[_0xf64b('0x18')]('\x20|\x20'),_0x2f2119);_0x5bd399[_0xf64b('0x19')](_0x2f2119);})[_0xf64b('0x14')](function(_0x349080){console[_0xf64b('0x1a')](_0x349080);logger[_0xf64b('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x2a1c4e,_0xaef4ea[_0xf64b('0x18')](_0xf64b('0x1b')),_0x349080[_0xf64b('0x1c')]);_0x5bd399[_0xf64b('0xe')]();});};}; \ No newline at end of file +var _0xf48e=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','then','error','message','result','catch','condition','rules','info'];(function(_0x538611,_0x3fe810){var _0x4e8495=function(_0x466e07){while(--_0x466e07){_0x538611['push'](_0x538611['shift']());}};_0x4e8495(++_0x3fe810);}(_0xf48e,0x74));var _0xef48=function(_0x2084f3,_0x423d9a){_0x2084f3=_0x2084f3-0x0;var _0x1e0ea3=_0xf48e[_0x2084f3];return _0x1e0ea3;};'use strict';var util=require(_0xef48('0x0'));var BPromise=require(_0xef48('0x1'));var jayson=require(_0xef48('0x2'));var _=require(_0xef48('0x3'));var logger=require(_0xef48('0x4'))('routing');var client=jayson[_0xef48('0x5')][_0xef48('0x6')]({'port':0x232a});function request(_0x51bea3,_0x2db6dd){return new BPromise(function(_0x485dee,_0x4323d4){return client[_0xef48('0x7')](_0x51bea3,_0x2db6dd)[_0xef48('0x8')](function(_0x306f42){if(_0x306f42[_0xef48('0x9')]){return _0x4323d4(_0x306f42[_0xef48('0x9')][_0xef48('0xa')]);}else{return _0x485dee(_0x306f42[_0xef48('0xb')]);}})[_0xef48('0xc')](function(_0x3ffb50){return _0x4323d4(_0x3ffb50);});});}exports[_0xef48('0xd')]=function(_0x2990ed,_0x4df8cc,_0x173f57){return function(_0x54502c){if(_0x173f57[_0xef48('0xe')]&&!_0x173f57[_0xef48('0xe')][_0x2990ed]){logger[_0xef48('0xf')](_0xef48('0x10'),_0x2990ed);return _0x54502c[_0xef48('0x11')]();}var _0x349e77=[];for(var _0x40ef73=0x0;_0x40ef73<_0x4df8cc[_0xef48('0x12')];_0x40ef73+=0x1){_0x349e77[_0xef48('0x13')](request(_0xef48('0x14'),{'command':util[_0xef48('0x15')](_0xef48('0x16'),_0x4df8cc[_0x40ef73])})[_0xef48('0x8')](function(_0x4f1ecd){return _0x4f1ecd&&_0x4f1ecd[_0xef48('0xa')]&&_0x4f1ecd[_0xef48('0xa')][_0xef48('0x17')](_0xef48('0x18'))>=0x0?!![]:![];})[_0xef48('0xc')](function(_0x326d9a){logger[_0xef48('0x9')](_0xef48('0x19'),_0x2990ed,_0x4df8cc[_0x40ef73]);}));}BPromise[_0xef48('0x1a')](_0x349e77)[_0xef48('0x8')](function(_0x1e8368){var _0x5016f8=_[_0xef48('0x1b')](_0x1e8368);logger[_0xef48('0xf')](_0xef48('0x1c'),_0x2990ed,_0x4df8cc[_0xef48('0x1d')](_0xef48('0x1e')),_0x5016f8);_0x54502c['when'](_0x5016f8);})[_0xef48('0xc')](function(_0x21f164){console[_0xef48('0x1f')](_0x21f164);logger[_0xef48('0x9')](_0xef48('0x1c'),_0x2990ed,_0x4df8cc['join'](_0xef48('0x1e')),_0x21f164[_0xef48('0x20')]);_0x54502c[_0xef48('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 060d9a6..3329b08 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 _0x7527=['uniqueid','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','connectedlinename','info','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','./utils','format'];(function(_0x29b4cf,_0x5e0e90){var _0x5f4ceb=function(_0x53de23){while(--_0x53de23){_0x29b4cf['push'](_0x29b4cf['shift']());}};_0x5f4ceb(++_0x5e0e90);}(_0x7527,0xa5));var _0x7752=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7527[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7752('0x0'));var util=require('util');var utils=require(_0x7752('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x484ee5,_0x1359f8){utils['info'](util[_0x7752('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x484ee5[_0x7752('0x3')],_0x484ee5['channel'],_0x484ee5[_0x7752('0x4')],_0x484ee5[_0x7752('0x5')],_0x484ee5[_0x7752('0x6')],_0x484ee5[_0x7752('0x7')],_0x484ee5[_0x7752('0x8')],_0x484ee5['lastevent']));if(_0x484ee5[_0x7752('0x4')]){utils[_0x7752('0x9')](_0x484ee5[_0x7752('0x4')])['then'](function(_0x78bacc){if(_0x78bacc){_0x484ee5[_0x7752('0xa')]=_0x78bacc[_0x7752('0xa')];_0x484ee5[_0x7752('0xb')]=_0x484ee5[_0x7752('0xc')]?_0x78bacc[_0x7752('0xd')]:![];_0x484ee5[_0x7752('0xe')]=_0x484ee5[_0x7752('0xb')]?_0x78bacc['acwTimeout']:0x0;}utils[_0x7752('0xf')]('CreateVoiceAgentReport',_0x484ee5);});}else{utils[_0x7752('0xf')](_0x7752('0x10'),_0x484ee5);}if(_0x1359f8){delete transfers[_0x484ee5[_0x7752('0x3')]];}else{delete agents[_0x484ee5[_0x7752('0x11')]];}}exports['agentcalled']=function(_0x41ed4e){try{utils[_0x7752('0x12')](util[_0x7752('0x2')](_0x7752('0x13'),_0x41ed4e['uniqueid']),_0x41ed4e);agents[_0x41ed4e['destuniqueid']]=_0x41ed4e;agents[_0x41ed4e[_0x7752('0x11')]][_0x7752('0x14')]=utils[_0x7752('0x15')]();agents[_0x41ed4e[_0x7752('0x11')]][_0x7752('0x16')]='called';agents[_0x41ed4e[_0x7752('0x11')]][_0x7752('0x8')]=null;agents[_0x41ed4e[_0x7752('0x11')]][_0x7752('0x17')]=null;utils[_0x7752('0x18')](util[_0x7752('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x41ed4e[_0x7752('0x3')],agents[_0x41ed4e['destuniqueid']][_0x7752('0x5')],_0x41ed4e[_0x7752('0x11')]));}catch(_0x4dfc41){utils['error'](util[_0x7752('0x2')](_0x7752('0x13'),_0x41ed4e['uniqueid']),_0x4dfc41);}};exports[_0x7752('0x19')]=function(_0x4297f0){try{if(!_[_0x7752('0x1a')](agents[_0x4297f0[_0x7752('0x11')]])){utils['debug'](util[_0x7752('0x2')](_0x7752('0x1b'),_0x4297f0[_0x7752('0x3')]),_0x4297f0);utils[_0x7752('0x18')](util[_0x7752('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4297f0[_0x7752('0x3')],agents[_0x4297f0['destuniqueid']]['membername'],_0x4297f0['destuniqueid']));agents[_0x4297f0['destuniqueid']][_0x7752('0x19')]=!![];agents[_0x4297f0[_0x7752('0x11')]][_0x7752('0x1c')]=utils['now']();agents[_0x4297f0[_0x7752('0x11')]][_0x7752('0x16')]=_0x7752('0x1d');agents[_0x4297f0[_0x7752('0x11')]][_0x7752('0x1e')]='timeout';agents[_0x4297f0[_0x7752('0x11')]][_0x7752('0x1f')]=_0x4297f0[_0x7752('0x20')]?parseInt(_0x4297f0[_0x7752('0x20')])/0x3e8:0x0;agents[_0x4297f0['destuniqueid']][_0x7752('0x21')]=0x0;unanswered[_0x7752('0x22')](_0x4297f0[_0x7752('0x11')]);}}catch(_0x13c3c1){utils[_0x7752('0x23')](util[_0x7752('0x2')]('[%s][agents][agentringnoanswer]',_0x4297f0['uniqueid']),_0x13c3c1);}};exports['queuecallerabandon']=function(_0x17595c){try{_['forIn'](agents,function(_0x2474c9,_0x4d82e2){if(_0x2474c9['uniqueid']==_0x17595c[_0x7752('0x3')]&&!_[_0x7752('0x24')](unanswered,_0x2474c9[_0x7752('0x11')])){utils[_0x7752('0x12')](util['format'](_0x7752('0x25'),_0x17595c[_0x7752('0x3')]),_0x17595c);utils[_0x7752('0x18')](util[_0x7752('0x2')](_0x7752('0x26'),_0x17595c[_0x7752('0x3')],_0x2474c9[_0x7752('0x5')],_0x2474c9[_0x7752('0x11')]));_0x2474c9['agentringnoanswer']=!![];_0x2474c9['agentringnoanswerAt']=utils[_0x7752('0x15')]();_0x2474c9[_0x7752('0x16')]=_0x7752('0x27');_0x2474c9['reason']='abandoned';_0x2474c9[_0x7752('0x1f')]=_0x17595c[_0x7752('0x1f')];_0x2474c9[_0x7752('0x21')]=0x0;writeDB(_0x2474c9);}});}catch(_0x3c1825){utils[_0x7752('0x23')](util[_0x7752('0x2')](_0x7752('0x25'),_0x17595c[_0x7752('0x3')]),_0x3c1825);}};exports[_0x7752('0x28')]=function(_0x5c0b80){try{if(agents[_0x5c0b80['destuniqueid']]){utils[_0x7752('0x12')](util[_0x7752('0x2')](_0x7752('0x29'),_0x5c0b80[_0x7752('0x3')]),_0x5c0b80);utils[_0x7752('0x18')](util[_0x7752('0x2')](_0x7752('0x2a'),_0x5c0b80[_0x7752('0x3')],agents[_0x5c0b80['destuniqueid']]['membername'],_0x5c0b80[_0x7752('0x11')]));agents[_0x5c0b80['destuniqueid']]['agentconnectAt']=utils[_0x7752('0x15')]();agents[_0x5c0b80[_0x7752('0x11')]][_0x7752('0x8')]=_0x5c0b80['connectedlinenum'];agents[_0x5c0b80['destuniqueid']][_0x7752('0x17')]=_0x5c0b80[_0x7752('0x17')];agents[_0x5c0b80[_0x7752('0x11')]][_0x7752('0x1f')]=_0x5c0b80[_0x7752('0x20')];agents[_0x5c0b80[_0x7752('0x11')]][_0x7752('0x16')]=_0x7752('0x2b');_[_0x7752('0x2c')](agents,function(_0x5923e4,_0x1f7e59){if(_0x5923e4['destuniqueid']!=_0x5c0b80['destuniqueid']&&_0x5923e4['uniqueid']==_0x5c0b80['uniqueid']){_0x5923e4['talktime']=0x0;_0x5923e4[_0x7752('0x1f')]=_0x5c0b80['ringtime'];_0x5923e4['agentringnoanswer']=!![];_0x5923e4[_0x7752('0x1c')]=utils['now']();_0x5923e4['lastevent']='answered_elsewhere';_0x5923e4[_0x7752('0x1e')]=_0x7752('0x2d');_0x5923e4['answeredelsewheredestinationuniqueid']=_0x5c0b80[_0x7752('0x11')];_0x5923e4[_0x7752('0x2e')]=_0x5c0b80[_0x7752('0x5')];writeDB(_0x5923e4);}});}}catch(_0x27707b){utils[_0x7752('0x23')](util[_0x7752('0x2')]('[%s][agents][agentconnect]',_0x5c0b80['uniqueid']),_0x27707b);}};exports[_0x7752('0xc')]=function(_0x141ddd){try{if(!_['isNil'](agents[_0x141ddd['destuniqueid']])){utils[_0x7752('0x12')](util[_0x7752('0x2')](_0x7752('0x2f'),_0x141ddd[_0x7752('0x3')]),_0x141ddd);utils[_0x7752('0x18')](util[_0x7752('0x2')](_0x7752('0x30'),_0x141ddd[_0x7752('0x3')],agents[_0x141ddd['destuniqueid']]['membername'],_0x141ddd[_0x7752('0x11')]));agents[_0x141ddd[_0x7752('0x11')]]['agentcomplete']=!![];agents[_0x141ddd[_0x7752('0x11')]]['agentcompleteAt']=utils[_0x7752('0x15')]();agents[_0x141ddd['destuniqueid']][_0x7752('0x21')]=utils[_0x7752('0x31')](agents[_0x141ddd['destuniqueid']][_0x7752('0x32')],agents[_0x141ddd['destuniqueid']][_0x7752('0x33')]);agents[_0x141ddd[_0x7752('0x11')]][_0x7752('0x1e')]=_0x141ddd['reason'];agents[_0x141ddd[_0x7752('0x11')]][_0x7752('0x16')]='complete';writeDB(agents[_0x141ddd[_0x7752('0x11')]]);}}catch(_0x5cdd7){utils[_0x7752('0x23')](util[_0x7752('0x2')](_0x7752('0x2f'),_0x141ddd[_0x7752('0x3')]),_0x5cdd7);}};exports[_0x7752('0x34')]=function(_0x19c2ea){try{if(!_[_0x7752('0x1a')](agents[_0x19c2ea[_0x7752('0x35')]])){utils[_0x7752('0x12')](util[_0x7752('0x2')](_0x7752('0x36'),_0x19c2ea['uniqueid']),_0x19c2ea);utils[_0x7752('0x18')](util[_0x7752('0x2')](_0x7752('0x37'),_0x19c2ea[_0x7752('0x3')],agents[_0x19c2ea['transfereruniqueid']][_0x7752('0x5')],agents[_0x19c2ea['transfereruniqueid']][_0x7752('0x3')]));agents[_0x19c2ea['transfereruniqueid']][_0x7752('0x38')]=!![];agents[_0x19c2ea[_0x7752('0x35')]][_0x7752('0x39')]=_0x7752('0x3a');agents[_0x19c2ea[_0x7752('0x35')]][_0x7752('0x3b')]=_0x19c2ea['extension'];agents[_0x19c2ea[_0x7752('0x35')]][_0x7752('0x3c')]=agents[_0x19c2ea[_0x7752('0x35')]][_0x7752('0x3')];}}catch(_0x138864){utils[_0x7752('0x23')](util[_0x7752('0x2')](_0x7752('0x36'),_0x19c2ea[_0x7752('0x3')]),_0x138864);}};exports[_0x7752('0x3d')]=function(_0x191e85){try{utils[_0x7752('0x12')](util[_0x7752('0x2')](_0x7752('0x3e'),_0x191e85[_0x7752('0x3f')]),_0x191e85);if(_0x191e85[_0x7752('0x3f')]==_0x191e85[_0x7752('0x40')]){if(!_[_0x7752('0x1a')](agents[_0x191e85[_0x7752('0x41')]])){utils[_0x7752('0x18')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x191e85[_0x7752('0x3f')],agents[_0x191e85[_0x7752('0x41')]]['membername']));agents[_0x191e85[_0x7752('0x41')]]['transfer']=!![];agents[_0x191e85['secondtransfereruniqueid']][_0x7752('0x39')]=_0x7752('0x42');agents[_0x191e85[_0x7752('0x41')]][_0x7752('0x3b')]=_0x191e85[_0x7752('0x43')];agents[_0x191e85[_0x7752('0x41')]]['transferuniqueid']=_0x191e85['origtransfereruniqueid'];}if(_0x191e85[_0x7752('0x44')]&&agents[_0x191e85[_0x7752('0x44')]]){agents[_0x191e85[_0x7752('0x44')]]['agententerreason']=0x1;transfers[_0x191e85[_0x7752('0x44')]]=_['clone'](agents[_0x191e85[_0x7752('0x44')]]);transfers[_0x191e85[_0x7752('0x44')]][_0x7752('0x7')]=agents[_0x191e85[_0x7752('0x41')]]['calleridnum'];transfers[_0x191e85[_0x7752('0x44')]][_0x7752('0x45')]=agents[_0x191e85[_0x7752('0x41')]][_0x7752('0x45')];transfers[_0x191e85[_0x7752('0x44')]][_0x7752('0x14')]=utils[_0x7752('0x15')]();transfers[_0x191e85[_0x7752('0x44')]]['agentconnectAt']=utils[_0x7752('0x15')]();transfers[_0x191e85[_0x7752('0x44')]][_0x7752('0x1f')]=0x0;transfers[_0x191e85[_0x7752('0x44')]][_0x7752('0x46')]=0x2;}}else if(_0x191e85[_0x7752('0x41')]==_0x191e85[_0x7752('0x47')]){if(!_[_0x7752('0x1a')](agents[_0x191e85[_0x7752('0x3f')]])){utils['info'](util[_0x7752('0x2')](_0x7752('0x48'),_0x191e85[_0x7752('0x3f')],agents[_0x191e85[_0x7752('0x3f')]][_0x7752('0x5')]));agents[_0x191e85[_0x7752('0x3f')]][_0x7752('0x38')]=!![];agents[_0x191e85[_0x7752('0x3f')]][_0x7752('0x39')]='ATTENDED';agents[_0x191e85[_0x7752('0x3f')]][_0x7752('0x3b')]=_0x191e85[_0x7752('0x49')];agents[_0x191e85[_0x7752('0x3f')]][_0x7752('0x3c')]=_0x191e85['secondtransfereruniqueid'];}if(_0x191e85['transfertargetuniqueid']&&agents[_0x191e85['transfertargetuniqueid']]){agents[_0x191e85[_0x7752('0x4a')]][_0x7752('0x46')]=0x1;transfers[_0x191e85[_0x7752('0x4a')]]=_[_0x7752('0x4b')](agents[_0x191e85['transfertargetuniqueid']]);transfers[_0x191e85[_0x7752('0x4a')]][_0x7752('0x7')]=agents[_0x191e85[_0x7752('0x3f')]][_0x7752('0x7')];transfers[_0x191e85['transfertargetuniqueid']][_0x7752('0x45')]=agents[_0x191e85[_0x7752('0x3f')]][_0x7752('0x45')];transfers[_0x191e85[_0x7752('0x4a')]][_0x7752('0x14')]=utils[_0x7752('0x15')]();transfers[_0x191e85[_0x7752('0x4a')]][_0x7752('0x33')]=utils[_0x7752('0x15')]();transfers[_0x191e85[_0x7752('0x4a')]][_0x7752('0x1f')]=0x0;transfers[_0x191e85[_0x7752('0x4a')]][_0x7752('0x46')]=0x2;}}}catch(_0x4f65c9){utils[_0x7752('0x23')](util[_0x7752('0x2')]('[%s][agents][attendedtransfer]',_0x191e85[_0x7752('0x3f')]),_0x4f65c9);}};exports[_0x7752('0x4c')]=function(_0x344024){try{utils[_0x7752('0x12')](util[_0x7752('0x2')](_0x7752('0x4d'),_0x344024['uniqueid']),_0x344024);if(agents[_0x344024[_0x7752('0x3')]]&&agents[_0x344024[_0x7752('0x3')]]['reason']===_0x7752('0x1d')){if(_0x344024['cause']==='21'){agents[_0x344024['uniqueid']][_0x7752('0x1e')]=_0x7752('0x4e');agents[_0x344024[_0x7752('0x3')]][_0x7752('0x16')]=_0x7752('0x4e');}utils[_0x7752('0x18')](util[_0x7752('0x2')](_0x7752('0x4f'),_0x344024['uniqueid'],agents[_0x344024[_0x7752('0x3')]][_0x7752('0x5')],agents[_0x344024[_0x7752('0x3')]][_0x7752('0x1e')],agents[_0x344024['uniqueid']][_0x7752('0x16')]));writeDB(agents[_0x344024[_0x7752('0x3')]]);var _0x1f0ab9=unanswered[_0x7752('0x50')](_0x344024[_0x7752('0x3')]);if(_0x1f0ab9>-0x1){unanswered[_0x7752('0x51')](_0x1f0ab9,0x1);}}if(transfers[_0x344024[_0x7752('0x3')]]){transfers[_0x344024[_0x7752('0x3')]][_0x7752('0xc')]=!![];transfers[_0x344024['uniqueid']]['agentcompleteAt']=utils['now']();transfers[_0x344024['uniqueid']][_0x7752('0x21')]=utils[_0x7752('0x31')](transfers[_0x344024[_0x7752('0x3')]][_0x7752('0x32')],transfers[_0x344024[_0x7752('0x3')]][_0x7752('0x33')]);transfers[_0x344024[_0x7752('0x3')]][_0x7752('0x1e')]=_0x7752('0x52');transfers[_0x344024[_0x7752('0x3')]][_0x7752('0x16')]=_0x7752('0x53');utils[_0x7752('0x18')](util[_0x7752('0x2')](_0x7752('0x4f'),_0x344024[_0x7752('0x3')],transfers[_0x344024[_0x7752('0x3')]][_0x7752('0x5')],transfers[_0x344024[_0x7752('0x3')]][_0x7752('0x1e')],transfers[_0x344024[_0x7752('0x3')]]['lastevent']));writeDB(transfers[_0x344024[_0x7752('0x3')]],!![]);}if(agents[_0x344024[_0x7752('0x3')]]&&agents[_0x344024[_0x7752('0x3')]][_0x7752('0x33')]){agents[_0x344024['uniqueid']][_0x7752('0xc')]=!![];agents[_0x344024[_0x7752('0x3')]][_0x7752('0x32')]=utils[_0x7752('0x15')]();agents[_0x344024[_0x7752('0x3')]][_0x7752('0x21')]=utils[_0x7752('0x31')](agents[_0x344024['uniqueid']]['agentcompleteAt'],agents[_0x344024[_0x7752('0x3')]][_0x7752('0x33')]);agents[_0x344024['uniqueid']][_0x7752('0x1e')]=agents[_0x344024[_0x7752('0x3')]][_0x7752('0x38')]?_0x7752('0x38'):_0x7752('0x52');agents[_0x344024[_0x7752('0x3')]][_0x7752('0x16')]=_0x7752('0x53');utils[_0x7752('0x18')](util['format'](_0x7752('0x4f'),_0x344024[_0x7752('0x3')],agents[_0x344024[_0x7752('0x3')]][_0x7752('0x5')],agents[_0x344024[_0x7752('0x3')]][_0x7752('0x1e')],agents[_0x344024[_0x7752('0x3')]][_0x7752('0x16')]));writeDB(agents[_0x344024[_0x7752('0x3')]]);}}catch(_0x40063e){utils[_0x7752('0x23')](util[_0x7752('0x2')](_0x7752('0x4d'),_0x344024[_0x7752('0x3')]),_0x40063e);}}; \ No newline at end of file +var _0x0b13=['calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','diffTime','complete','isNil','[%s][agents][blindtransfer]','transfereruniqueid','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone'];(function(_0x266cda,_0xe629b){var _0x23b991=function(_0x4476dd){while(--_0x4476dd){_0x266cda['push'](_0x266cda['shift']());}};_0x23b991(++_0xe629b);}(_0x0b13,0xbf));var _0x30b1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0b13[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x30b1('0x0'));var util=require(_0x30b1('0x1'));var utils=require(_0x30b1('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x457ce2,_0x32e38d){utils['info'](util[_0x30b1('0x3')](_0x30b1('0x4'),_0x457ce2[_0x30b1('0x5')],_0x457ce2[_0x30b1('0x6')],_0x457ce2[_0x30b1('0x7')],_0x457ce2[_0x30b1('0x8')],_0x457ce2[_0x30b1('0x9')],_0x457ce2['calleridnum'],_0x457ce2[_0x30b1('0xa')],_0x457ce2[_0x30b1('0xb')]));if(_0x457ce2[_0x30b1('0x7')]){utils[_0x30b1('0xc')](_0x457ce2['queue'])['then'](function(_0x5cd14d){if(_0x5cd14d){_0x457ce2[_0x30b1('0xd')]=_0x5cd14d[_0x30b1('0xd')];_0x457ce2[_0x30b1('0xe')]=_0x457ce2['agentcomplete']?_0x5cd14d[_0x30b1('0xf')]:![];_0x457ce2['acwtime']=_0x457ce2[_0x30b1('0xe')]?_0x5cd14d['acwTimeout']:0x0;}utils[_0x30b1('0x10')](_0x30b1('0x11'),_0x457ce2);});}else{utils[_0x30b1('0x10')]('CreateVoiceAgentReport',_0x457ce2);}if(_0x32e38d){delete transfers[_0x457ce2[_0x30b1('0x5')]];}else{delete agents[_0x457ce2[_0x30b1('0x12')]];}}exports[_0x30b1('0x13')]=function(_0x30d0ef){try{utils['debug'](util[_0x30b1('0x3')](_0x30b1('0x14'),_0x30d0ef[_0x30b1('0x5')]),_0x30d0ef);agents[_0x30d0ef[_0x30b1('0x12')]]=_0x30d0ef;agents[_0x30d0ef[_0x30b1('0x12')]][_0x30b1('0x15')]=utils['now']();agents[_0x30d0ef[_0x30b1('0x12')]][_0x30b1('0xb')]=_0x30b1('0x16');agents[_0x30d0ef[_0x30b1('0x12')]][_0x30b1('0xa')]=null;agents[_0x30d0ef['destuniqueid']][_0x30b1('0x17')]=null;utils[_0x30b1('0x18')](util['format'](_0x30b1('0x19'),_0x30d0ef[_0x30b1('0x5')],agents[_0x30d0ef[_0x30b1('0x12')]][_0x30b1('0x8')],_0x30d0ef[_0x30b1('0x12')]));}catch(_0x5f21d5){utils[_0x30b1('0x1a')](util[_0x30b1('0x3')](_0x30b1('0x14'),_0x30d0ef[_0x30b1('0x5')]),_0x5f21d5);}};exports[_0x30b1('0x1b')]=function(_0xcc7d9c){try{if(!_['isNil'](agents[_0xcc7d9c['destuniqueid']])){utils[_0x30b1('0x1c')](util[_0x30b1('0x3')](_0x30b1('0x1d'),_0xcc7d9c[_0x30b1('0x5')]),_0xcc7d9c);utils['info'](util[_0x30b1('0x3')](_0x30b1('0x1e'),_0xcc7d9c[_0x30b1('0x5')],agents[_0xcc7d9c['destuniqueid']][_0x30b1('0x8')],_0xcc7d9c['destuniqueid']));agents[_0xcc7d9c[_0x30b1('0x12')]]['agentringnoanswer']=!![];agents[_0xcc7d9c['destuniqueid']][_0x30b1('0x1f')]=utils[_0x30b1('0x20')]();agents[_0xcc7d9c[_0x30b1('0x12')]]['lastevent']=_0x30b1('0x21');agents[_0xcc7d9c[_0x30b1('0x12')]][_0x30b1('0x22')]=_0x30b1('0x21');agents[_0xcc7d9c[_0x30b1('0x12')]][_0x30b1('0x23')]=_0xcc7d9c[_0x30b1('0x24')]?parseInt(_0xcc7d9c['ringtime'])/0x3e8:0x0;agents[_0xcc7d9c[_0x30b1('0x12')]][_0x30b1('0x25')]=0x0;unanswered[_0x30b1('0x26')](_0xcc7d9c[_0x30b1('0x12')]);}}catch(_0x106436){utils[_0x30b1('0x1a')](util['format']('[%s][agents][agentringnoanswer]',_0xcc7d9c[_0x30b1('0x5')]),_0x106436);}};exports[_0x30b1('0x27')]=function(_0x523a89){try{_[_0x30b1('0x28')](agents,function(_0x4b88eb,_0x41f9ce){if(_0x4b88eb[_0x30b1('0x5')]==_0x523a89[_0x30b1('0x5')]&&!_[_0x30b1('0x29')](unanswered,_0x4b88eb[_0x30b1('0x12')])){utils[_0x30b1('0x1c')](util[_0x30b1('0x3')]('[%s][agents][queuecallerabandon]',_0x523a89[_0x30b1('0x5')]),_0x523a89);utils[_0x30b1('0x18')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x523a89[_0x30b1('0x5')],_0x4b88eb['membername'],_0x4b88eb['destuniqueid']));_0x4b88eb[_0x30b1('0x1b')]=!![];_0x4b88eb[_0x30b1('0x1f')]=utils[_0x30b1('0x20')]();_0x4b88eb['lastevent']=_0x30b1('0x2a');_0x4b88eb[_0x30b1('0x22')]=_0x30b1('0x2a');_0x4b88eb[_0x30b1('0x23')]=_0x523a89['holdtime'];_0x4b88eb[_0x30b1('0x25')]=0x0;writeDB(_0x4b88eb);}});}catch(_0x2be0c9){utils[_0x30b1('0x1a')](util[_0x30b1('0x3')](_0x30b1('0x2b'),_0x523a89[_0x30b1('0x5')]),_0x2be0c9);}};exports[_0x30b1('0x2c')]=function(_0x5a1f17){try{if(agents[_0x5a1f17[_0x30b1('0x12')]]){utils[_0x30b1('0x1c')](util[_0x30b1('0x3')](_0x30b1('0x2d'),_0x5a1f17['uniqueid']),_0x5a1f17);utils['info'](util['format'](_0x30b1('0x2e'),_0x5a1f17[_0x30b1('0x5')],agents[_0x5a1f17['destuniqueid']][_0x30b1('0x8')],_0x5a1f17[_0x30b1('0x12')]));agents[_0x5a1f17[_0x30b1('0x12')]][_0x30b1('0x2f')]=utils[_0x30b1('0x20')]();agents[_0x5a1f17[_0x30b1('0x12')]][_0x30b1('0xa')]=_0x5a1f17[_0x30b1('0xa')];agents[_0x5a1f17[_0x30b1('0x12')]]['connectedlinename']=_0x5a1f17[_0x30b1('0x17')];agents[_0x5a1f17[_0x30b1('0x12')]][_0x30b1('0x23')]=_0x5a1f17['ringtime'];agents[_0x5a1f17['destuniqueid']][_0x30b1('0xb')]=_0x30b1('0x30');_[_0x30b1('0x28')](agents,function(_0x3a3bfc,_0xec6009){if(_0x3a3bfc['destuniqueid']!=_0x5a1f17[_0x30b1('0x12')]&&_0x3a3bfc[_0x30b1('0x5')]==_0x5a1f17[_0x30b1('0x5')]){_0x3a3bfc[_0x30b1('0x25')]=0x0;_0x3a3bfc[_0x30b1('0x23')]=_0x5a1f17[_0x30b1('0x24')];_0x3a3bfc[_0x30b1('0x1b')]=!![];_0x3a3bfc['agentringnoanswerAt']=utils[_0x30b1('0x20')]();_0x3a3bfc[_0x30b1('0xb')]=_0x30b1('0x31');_0x3a3bfc['reason']=_0x30b1('0x31');_0x3a3bfc[_0x30b1('0x32')]=_0x5a1f17[_0x30b1('0x12')];_0x3a3bfc[_0x30b1('0x33')]=_0x5a1f17[_0x30b1('0x8')];writeDB(_0x3a3bfc);}});}}catch(_0x1ae305){utils['error'](util['format'](_0x30b1('0x2d'),_0x5a1f17[_0x30b1('0x5')]),_0x1ae305);}};exports['agentcomplete']=function(_0x5a72b2){try{if(!_['isNil'](agents[_0x5a72b2[_0x30b1('0x12')]])){utils[_0x30b1('0x1c')](util['format'](_0x30b1('0x34'),_0x5a72b2[_0x30b1('0x5')]),_0x5a72b2);utils[_0x30b1('0x18')](util['format'](_0x30b1('0x35'),_0x5a72b2['uniqueid'],agents[_0x5a72b2[_0x30b1('0x12')]][_0x30b1('0x8')],_0x5a72b2[_0x30b1('0x12')]));agents[_0x5a72b2[_0x30b1('0x12')]][_0x30b1('0x36')]=!![];agents[_0x5a72b2[_0x30b1('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x5a72b2[_0x30b1('0x12')]]['talktime']=utils[_0x30b1('0x37')](agents[_0x5a72b2['destuniqueid']]['agentcompleteAt'],agents[_0x5a72b2[_0x30b1('0x12')]]['agentconnectAt']);agents[_0x5a72b2[_0x30b1('0x12')]]['reason']=_0x5a72b2[_0x30b1('0x22')];agents[_0x5a72b2[_0x30b1('0x12')]][_0x30b1('0xb')]=_0x30b1('0x38');writeDB(agents[_0x5a72b2['destuniqueid']]);}}catch(_0x5750b4){utils[_0x30b1('0x1a')](util[_0x30b1('0x3')](_0x30b1('0x34'),_0x5a72b2['uniqueid']),_0x5750b4);}};exports['blindtransfer']=function(_0x214d6b){try{if(!_[_0x30b1('0x39')](agents[_0x214d6b['transfereruniqueid']])){utils[_0x30b1('0x1c')](util[_0x30b1('0x3')](_0x30b1('0x3a'),_0x214d6b[_0x30b1('0x5')]),_0x214d6b);utils[_0x30b1('0x18')](util[_0x30b1('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x214d6b[_0x30b1('0x5')],agents[_0x214d6b[_0x30b1('0x3b')]]['membername'],agents[_0x214d6b[_0x30b1('0x3b')]][_0x30b1('0x5')]));agents[_0x214d6b[_0x30b1('0x3b')]][_0x30b1('0x3c')]=!![];agents[_0x214d6b[_0x30b1('0x3b')]]['transfertype']=_0x30b1('0x3d');agents[_0x214d6b[_0x30b1('0x3b')]][_0x30b1('0x3e')]=_0x214d6b[_0x30b1('0x3f')];agents[_0x214d6b['transfereruniqueid']][_0x30b1('0x40')]=agents[_0x214d6b[_0x30b1('0x3b')]]['uniqueid'];}}catch(_0x5755bd){utils['error'](util[_0x30b1('0x3')]('[%s][agents][blindtransfer]',_0x214d6b['uniqueid']),_0x5755bd);}};exports[_0x30b1('0x41')]=function(_0x2f9948){try{utils['debug'](util[_0x30b1('0x3')](_0x30b1('0x42'),_0x2f9948[_0x30b1('0x43')]),_0x2f9948);if(_0x2f9948[_0x30b1('0x43')]==_0x2f9948['origtransfererlinkedid']){if(!_[_0x30b1('0x39')](agents[_0x2f9948[_0x30b1('0x44')]])){utils[_0x30b1('0x18')](util['format'](_0x30b1('0x45'),_0x2f9948[_0x30b1('0x43')],agents[_0x2f9948['secondtransfereruniqueid']][_0x30b1('0x8')]));agents[_0x2f9948['secondtransfereruniqueid']][_0x30b1('0x3c')]=!![];agents[_0x2f9948[_0x30b1('0x44')]][_0x30b1('0x46')]=_0x30b1('0x47');agents[_0x2f9948[_0x30b1('0x44')]][_0x30b1('0x3e')]=_0x2f9948[_0x30b1('0x48')];agents[_0x2f9948[_0x30b1('0x44')]][_0x30b1('0x40')]=_0x2f9948[_0x30b1('0x43')];}if(_0x2f9948[_0x30b1('0x49')]&&agents[_0x2f9948[_0x30b1('0x49')]]){agents[_0x2f9948[_0x30b1('0x49')]][_0x30b1('0x4a')]=0x1;transfers[_0x2f9948['transfereeuniqueid']]=_[_0x30b1('0x4b')](agents[_0x2f9948['transfereeuniqueid']]);transfers[_0x2f9948[_0x30b1('0x49')]][_0x30b1('0x4c')]=agents[_0x2f9948[_0x30b1('0x44')]][_0x30b1('0x4c')];transfers[_0x2f9948[_0x30b1('0x49')]][_0x30b1('0x4d')]=agents[_0x2f9948['secondtransfereruniqueid']][_0x30b1('0x4d')];transfers[_0x2f9948[_0x30b1('0x49')]]['agentcalledAt']=utils[_0x30b1('0x20')]();transfers[_0x2f9948['transfereeuniqueid']][_0x30b1('0x2f')]=utils['now']();transfers[_0x2f9948['transfereeuniqueid']][_0x30b1('0x23')]=0x0;transfers[_0x2f9948[_0x30b1('0x49')]][_0x30b1('0x4a')]=0x2;}}else if(_0x2f9948['secondtransfereruniqueid']==_0x2f9948[_0x30b1('0x4e')]){if(!_[_0x30b1('0x39')](agents[_0x2f9948[_0x30b1('0x43')]])){utils[_0x30b1('0x18')](util['format'](_0x30b1('0x45'),_0x2f9948['origtransfereruniqueid'],agents[_0x2f9948['origtransfereruniqueid']][_0x30b1('0x8')]));agents[_0x2f9948[_0x30b1('0x43')]][_0x30b1('0x3c')]=!![];agents[_0x2f9948[_0x30b1('0x43')]]['transfertype']=_0x30b1('0x47');agents[_0x2f9948[_0x30b1('0x43')]]['transferexten']=_0x2f9948[_0x30b1('0x4f')];agents[_0x2f9948[_0x30b1('0x43')]][_0x30b1('0x40')]=_0x2f9948['secondtransfereruniqueid'];}if(_0x2f9948[_0x30b1('0x50')]&&agents[_0x2f9948['transfertargetuniqueid']]){agents[_0x2f9948[_0x30b1('0x50')]][_0x30b1('0x4a')]=0x1;transfers[_0x2f9948[_0x30b1('0x50')]]=_['clone'](agents[_0x2f9948['transfertargetuniqueid']]);transfers[_0x2f9948[_0x30b1('0x50')]][_0x30b1('0x4c')]=agents[_0x2f9948['origtransfereruniqueid']]['calleridnum'];transfers[_0x2f9948[_0x30b1('0x50')]]['calleridname']=agents[_0x2f9948[_0x30b1('0x43')]]['calleridname'];transfers[_0x2f9948[_0x30b1('0x50')]][_0x30b1('0x15')]=utils['now']();transfers[_0x2f9948[_0x30b1('0x50')]][_0x30b1('0x2f')]=utils[_0x30b1('0x20')]();transfers[_0x2f9948[_0x30b1('0x50')]][_0x30b1('0x23')]=0x0;transfers[_0x2f9948[_0x30b1('0x50')]][_0x30b1('0x4a')]=0x2;}}}catch(_0x2d8bf3){utils[_0x30b1('0x1a')](util[_0x30b1('0x3')](_0x30b1('0x42'),_0x2f9948['origtransfereruniqueid']),_0x2d8bf3);}};exports['hangup']=function(_0x168442){try{utils['debug'](util['format']('[%s][agents][hangup]',_0x168442[_0x30b1('0x5')]),_0x168442);if(agents[_0x168442[_0x30b1('0x5')]]&&agents[_0x168442[_0x30b1('0x5')]][_0x30b1('0x22')]===_0x30b1('0x21')){if(_0x168442[_0x30b1('0x51')]==='21'){agents[_0x168442[_0x30b1('0x5')]][_0x30b1('0x22')]=_0x30b1('0x52');agents[_0x168442[_0x30b1('0x5')]][_0x30b1('0xb')]=_0x30b1('0x52');}utils[_0x30b1('0x18')](util[_0x30b1('0x3')](_0x30b1('0x53'),_0x168442['uniqueid'],agents[_0x168442['uniqueid']]['membername'],agents[_0x168442[_0x30b1('0x5')]][_0x30b1('0x22')],agents[_0x168442[_0x30b1('0x5')]]['lastevent']));writeDB(agents[_0x168442[_0x30b1('0x5')]]);var _0x344159=unanswered[_0x30b1('0x54')](_0x168442[_0x30b1('0x5')]);if(_0x344159>-0x1){unanswered[_0x30b1('0x55')](_0x344159,0x1);}}if(transfers[_0x168442[_0x30b1('0x5')]]){transfers[_0x168442[_0x30b1('0x5')]][_0x30b1('0x36')]=!![];transfers[_0x168442['uniqueid']][_0x30b1('0x56')]=utils['now']();transfers[_0x168442[_0x30b1('0x5')]][_0x30b1('0x25')]=utils[_0x30b1('0x37')](transfers[_0x168442[_0x30b1('0x5')]][_0x30b1('0x56')],transfers[_0x168442[_0x30b1('0x5')]][_0x30b1('0x2f')]);transfers[_0x168442[_0x30b1('0x5')]]['reason']=_0x30b1('0x57');transfers[_0x168442[_0x30b1('0x5')]]['lastevent']=_0x30b1('0x38');utils[_0x30b1('0x18')](util[_0x30b1('0x3')](_0x30b1('0x53'),_0x168442['uniqueid'],transfers[_0x168442['uniqueid']]['membername'],transfers[_0x168442[_0x30b1('0x5')]]['reason'],transfers[_0x168442['uniqueid']]['lastevent']));writeDB(transfers[_0x168442[_0x30b1('0x5')]],!![]);}if(agents[_0x168442[_0x30b1('0x5')]]&&agents[_0x168442['uniqueid']]['agentconnectAt']){agents[_0x168442['uniqueid']][_0x30b1('0x36')]=!![];agents[_0x168442[_0x30b1('0x5')]][_0x30b1('0x56')]=utils['now']();agents[_0x168442[_0x30b1('0x5')]][_0x30b1('0x25')]=utils['diffTime'](agents[_0x168442[_0x30b1('0x5')]]['agentcompleteAt'],agents[_0x168442[_0x30b1('0x5')]]['agentconnectAt']);agents[_0x168442['uniqueid']][_0x30b1('0x22')]=agents[_0x168442['uniqueid']][_0x30b1('0x3c')]?'transfer':_0x30b1('0x57');agents[_0x168442[_0x30b1('0x5')]][_0x30b1('0xb')]=_0x30b1('0x38');utils[_0x30b1('0x18')](util[_0x30b1('0x3')](_0x30b1('0x53'),_0x168442[_0x30b1('0x5')],agents[_0x168442[_0x30b1('0x5')]]['membername'],agents[_0x168442['uniqueid']][_0x30b1('0x22')],agents[_0x168442['uniqueid']][_0x30b1('0xb')]));writeDB(agents[_0x168442[_0x30b1('0x5')]]);}}catch(_0x3ef0d0){utils['error'](util[_0x30b1('0x3')](_0x30b1('0x58'),_0x168442[_0x30b1('0x5')]),_0x3ef0d0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d76494c..ae8dfe4 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 _0xad0b=['variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','application','toLowerCase','set','appdata','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','calleridname','callerid','cause-txt','duration','endtime','starttime','billableseconds','error','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]'];(function(_0x58bfa5,_0x5b5c6a){var _0x54163a=function(_0x3fee1f){while(--_0x3fee1f){_0x58bfa5['push'](_0x58bfa5['shift']());}};_0x54163a(++_0x5b5c6a);}(_0xad0b,0x89));var _0xbad0=function(_0x3bfb86,_0x383d1f){_0x3bfb86=_0x3bfb86-0x0;var _0x574388=_0xad0b[_0x3bfb86];return _0x574388;};'use strict';var _=require(_0xbad0('0x0'));var util=require('util');var utils=require(_0xbad0('0x1'));var dispositions=[_0xbad0('0x2'),_0xbad0('0x3'),_0xbad0('0x3'),_0xbad0('0x2'),_0xbad0('0x2'),_0xbad0('0x2'),_0xbad0('0x4'),_0xbad0('0x5'),_0xbad0('0x3'),_0xbad0('0x3'),'FAILED'];var channels={};function writeDB(_0x547366){utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x8'),_0x547366[_0xbad0('0x9')],_0x547366[_0xbad0('0xa')],_0x547366[_0xbad0('0xb')],_0x547366[_0xbad0('0xc')],_0x547366[_0xbad0('0xd')],_0x547366[_0xbad0('0xe')],_0x547366[_0xbad0('0xf')],_0x547366[_0xbad0('0x10')]));if(_0x547366[_0xbad0('0x11')]){utils[_0xbad0('0x12')](_0x547366['accountcode'])['then'](function(_0x1fb029){if(_0x1fb029){_0x547366[_0xbad0('0x13')]=_0x1fb029['id'];}utils['request'](_0xbad0('0x14'),_0x547366);});}else{utils['request']('CreateVoiceCallReport',_0x547366);}if(channels[_0x547366[_0xbad0('0x9')]]){delete channels[_0x547366['uniqueid']];}}exports[_0xbad0('0x15')]=function(_0x19a45c){try{utils[_0xbad0('0x16')](util[_0xbad0('0x7')](_0xbad0('0x17'),_0x19a45c[_0xbad0('0x9')]),_0x19a45c);if(_0x19a45c['uniqueid']==_0x19a45c[_0xbad0('0x18')]&&_0x19a45c[_0xbad0('0xa')]!='OutgoingSpoolFailed'){utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x19'),_0x19a45c[_0xbad0('0x9')],_0x19a45c[_0xbad0('0x1a')],_0x19a45c['exten']));channels[_0x19a45c[_0xbad0('0x9')]]={'uniqueid':_0x19a45c[_0xbad0('0x9')],'accountcode':_0x19a45c[_0xbad0('0x11')],'source':_0x19a45c['calleridnum'],'destination':_0x19a45c[_0xbad0('0x1b')],'destinationcontext':_0x19a45c[_0xbad0('0x1a')],'channel':_0x19a45c[_0xbad0('0xa')],'starttime':utils[_0xbad0('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xbad0('0x1d')};}}catch(_0x45d000){utils['error'](util[_0xbad0('0x7')](_0xbad0('0x17'),_0x19a45c[_0xbad0('0x9')]),_0x45d000);}};exports[_0xbad0('0x1e')]=function(_0x303a77){try{utils['debug'](util['format'](_0xbad0('0x1f'),_0x303a77[_0xbad0('0x9')]),_0x303a77);if(!_[_0xbad0('0x20')](channels[_0x303a77[_0xbad0('0x9')]])&&_0x303a77[_0xbad0('0x21')]==0x6){utils['info'](util[_0xbad0('0x7')](_0xbad0('0x22'),_0x303a77[_0xbad0('0x9')],_0x303a77['context'],_0x303a77['channel']));if(_[_0xbad0('0x20')](channels[_0x303a77[_0xbad0('0x9')]]['systemanswertime'])){channels[_0x303a77[_0xbad0('0x9')]][_0xbad0('0x23')]=utils[_0xbad0('0x1c')]();}}else if(!_[_0xbad0('0x20')](channels[_0x303a77[_0xbad0('0x18')]])&&_0x303a77['channelstate']==0x6&&_0x303a77[_0xbad0('0x1a')]!=_0xbad0('0x24')){utils[_0xbad0('0x6')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x303a77[_0xbad0('0x9')],_0x303a77[_0xbad0('0x18')],_0x303a77[_0xbad0('0x1a')],_0x303a77['channel']));channels[_0x303a77[_0xbad0('0x18')]][_0xbad0('0x11')]=_0x303a77[_0xbad0('0x11')];channels[_0x303a77[_0xbad0('0x18')]][_0xbad0('0x25')]=_0x303a77[_0xbad0('0xa')];if(_[_0xbad0('0x20')](channels[_0x303a77[_0xbad0('0x18')]][_0xbad0('0x26')])){channels[_0x303a77['linkedid']][_0xbad0('0x26')]=utils[_0xbad0('0x1c')]();}channels[_0x303a77[_0xbad0('0x18')]][_0xbad0('0x27')]=dispositions[_[_0xbad0('0x28')](_0x303a77[_0xbad0('0x21')])]||_0xbad0('0x4');}}catch(_0x1619a4){utils['error'](util[_0xbad0('0x7')](_0xbad0('0x1f'),_0x303a77[_0xbad0('0x9')]),_0x1619a4);}};exports[_0xbad0('0x29')]=function(_0x30d346){try{if(!_[_0xbad0('0x20')](channels[_0x30d346[_0xbad0('0x9')]])){utils[_0xbad0('0x16')](util[_0xbad0('0x7')](_0xbad0('0x2a'),_0x30d346[_0xbad0('0x9')]),_0x30d346);if(_[_0xbad0('0x20')](channels[_0x30d346[_0xbad0('0x9')]]['callerid'])){channels[_0x30d346[_0xbad0('0x9')]]['callerid']=_0x30d346[_0xbad0('0x2b')]+'\x20<'+_0x30d346['calleridnum']+'>';}utils[_0xbad0('0x6')](util[_0xbad0('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x30d346[_0xbad0('0x9')],channels[_0x30d346[_0xbad0('0x9')]][_0xbad0('0x2c')],_0x30d346[_0xbad0('0x2d')]));channels[_0x30d346[_0xbad0('0x9')]]['endtime']=utils['now']();channels[_0x30d346[_0xbad0('0x9')]][_0xbad0('0x2e')]=utils['diffTime'](channels[_0x30d346['uniqueid']][_0xbad0('0x2f')],channels[_0x30d346[_0xbad0('0x9')]][_0xbad0('0x30')]);channels[_0x30d346[_0xbad0('0x9')]][_0xbad0('0x31')]=channels[_0x30d346[_0xbad0('0x9')]][_0xbad0('0x26')]?utils['diffTime'](channels[_0x30d346['uniqueid']][_0xbad0('0x2f')],channels[_0x30d346[_0xbad0('0x9')]]['answertime']):0x0;writeDB(channels[_0x30d346['uniqueid']]);}}catch(_0xe12878){utils[_0xbad0('0x32')](util[_0xbad0('0x7')](_0xbad0('0x2a'),_0x30d346['uniqueid']),_0xe12878);}};exports['attendedtransfer']=function(_0x4b6da7){try{if(!_['isNil'](channels[_0x4b6da7['localtwolinkedid']])){utils['debug'](util[_0xbad0('0x7')](_0xbad0('0x33'),_0x4b6da7[_0xbad0('0x34')]),_0x4b6da7);if(channels[_0x4b6da7[_0xbad0('0x35')]][_0xbad0('0xa')]==_0x4b6da7['transfereechannel']){utils[_0xbad0('0x6')](util[_0xbad0('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b6da7[_0xbad0('0x34')],_0x4b6da7[_0xbad0('0x35')],_0x4b6da7['secondtransfererchannel']));channels[_0x4b6da7[_0xbad0('0x35')]]['destinationchannel']=_0x4b6da7[_0xbad0('0x36')];channels[_0x4b6da7[_0xbad0('0x35')]][_0xbad0('0x37')]=_0xbad0('0x38');}else if(channels[_0x4b6da7[_0xbad0('0x35')]][_0xbad0('0xa')]=_0x4b6da7[_0xbad0('0x39')]){utils[_0xbad0('0x6')](util[_0xbad0('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b6da7['origtransfereruniqueid'],_0x4b6da7[_0xbad0('0x35')],_0x4b6da7['origtransfererchannel']));channels[_0x4b6da7[_0xbad0('0x35')]][_0xbad0('0x25')]=_0x4b6da7['origtransfererchannel'];channels[_0x4b6da7[_0xbad0('0x35')]][_0xbad0('0x37')]=_0xbad0('0x38');}}}catch(_0x1e9978){utils[_0xbad0('0x32')](util['format'](_0xbad0('0x33'),_0x4b6da7['origtransfereruniqueid']),_0x1e9978);}};exports['musiconholdstart']=function(_0x1329d5){try{if(!_['isNil'](channels[_0x1329d5['uniqueid']])){utils[_0xbad0('0x16')](util['format'](_0xbad0('0x3a'),_0x1329d5[_0xbad0('0x9')]),_0x1329d5);channels[_0x1329d5['uniqueid']][_0xbad0('0x3b')]=utils['now']();utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x3c'),_0x1329d5[_0xbad0('0x9')],channels[_0x1329d5[_0xbad0('0x9')]][_0xbad0('0x3b')]));}}catch(_0x686ac1){utils[_0xbad0('0x32')](util['format'](_0xbad0('0x3a'),_0x1329d5[_0xbad0('0x9')]),_0x686ac1);}};exports[_0xbad0('0x3d')]=function(_0x1662ec){try{if(!_[_0xbad0('0x20')](channels[_0x1662ec[_0xbad0('0x9')]])){utils[_0xbad0('0x16')](util[_0xbad0('0x7')](_0xbad0('0x3e'),_0x1662ec[_0xbad0('0x9')]),_0x1662ec);if(!_[_0xbad0('0x20')](channels[_0x1662ec[_0xbad0('0x9')]][_0xbad0('0x3b')])){channels[_0x1662ec['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xbad0('0x1c')](),channels[_0x1662ec[_0xbad0('0x9')]][_0xbad0('0x3b')]);utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x3f'),_0x1662ec[_0xbad0('0x9')],channels[_0x1662ec[_0xbad0('0x9')]][_0xbad0('0x40')]));delete channels[_0x1662ec['uniqueid']][_0xbad0('0x3b')];}}}catch(_0x108f9d){utils[_0xbad0('0x32')](util[_0xbad0('0x7')]('[%s][calls][musiconholdstop]',_0x1662ec[_0xbad0('0x9')]),_0x108f9d);}};exports[_0xbad0('0x41')]=function(_0x182df1){try{if(!_[_0xbad0('0x20')](channels[_0x182df1['uniqueid']])){utils['debug'](util[_0xbad0('0x7')](_0xbad0('0x42'),_0x182df1['uniqueid']),_0x182df1);if(!_[_0xbad0('0x20')](_0x182df1[_0xbad0('0x43')]['xmd-originatecalleridnum'])){utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x44'),_0x182df1['uniqueid'],_0x182df1[_0xbad0('0x45')]));channels[_0x182df1[_0xbad0('0x9')]][_0xbad0('0x46')]=_0x182df1[_0xbad0('0x45')];}if(!_[_0xbad0('0x20')](_0x182df1[_0xbad0('0x43')][_0xbad0('0x47')])){utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x48'),_0x182df1[_0xbad0('0x9')],_0x182df1['value']));channels[_0x182df1['uniqueid']]['destination']=_0x182df1['value'];channels[_0x182df1[_0xbad0('0x9')]]['callerid']='\x22'+_0x182df1[_0xbad0('0x45')]+'\x22\x20<'+_0x182df1['value']+'>';}if(!_[_0xbad0('0x20')](_0x182df1[_0xbad0('0x43')]['xmd-callerid-preview'])||!_[_0xbad0('0x20')](_0x182df1[_0xbad0('0x43')]['xmd-callerid'])){utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x49'),_0x182df1[_0xbad0('0x9')],!_['isNil'](_0x182df1[_0xbad0('0x43')][_0xbad0('0x4a')])?_0xbad0('0x4a'):_0xbad0('0x4b'),_0x182df1[_0xbad0('0x45')]));channels[_0x182df1[_0xbad0('0x9')]][_0xbad0('0x2c')]=_0x182df1['value'];}if(!_['isNil'](_0x182df1[_0xbad0('0x43')][_0xbad0('0x4c')])||!_['isNil'](_0x182df1[_0xbad0('0x43')][_0xbad0('0x4d')])){utils[_0xbad0('0x6')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x182df1[_0xbad0('0x9')],!_['isNil'](_0x182df1[_0xbad0('0x43')][_0xbad0('0x4c')])?_0xbad0('0x4c'):_0xbad0('0x4d'),_0x182df1[_0xbad0('0x45')]));channels[_0x182df1[_0xbad0('0x9')]][_0xbad0('0x4e')]='Queue';channels[_0x182df1[_0xbad0('0x9')]][_0xbad0('0x4f')]=_0x182df1[_0xbad0('0x45')];channels[_0x182df1[_0xbad0('0x9')]][_0xbad0('0xb')]=!![];}if(!_[_0xbad0('0x20')](_0x182df1[_0xbad0('0x43')][_0xbad0('0x50')])){utils[_0xbad0('0x6')](util['format'](_0xbad0('0x51'),_0x182df1[_0xbad0('0x9')],_0x182df1[_0xbad0('0x45')]));channels[_0x182df1['uniqueid']][_0xbad0('0x52')]=_0x182df1[_0xbad0('0x45')];}if(!_[_0xbad0('0x20')](_0x182df1[_0xbad0('0x43')][_0xbad0('0x53')])){utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x54'),_0x182df1['uniqueid'],_0x182df1[_0xbad0('0x45')]));channels[_0x182df1[_0xbad0('0x9')]][_0xbad0('0x55')]=_0x182df1[_0xbad0('0x45')];}if(!_['isNil'](_0x182df1[_0xbad0('0x43')]['outboundrouteid'])){utils['info'](util[_0xbad0('0x7')](_0xbad0('0x56'),_0x182df1[_0xbad0('0x9')],_0x182df1[_0xbad0('0x45')]));channels[_0x182df1[_0xbad0('0x9')]][_0xbad0('0x57')]=_0x182df1['value'];}if(!_[_0xbad0('0x20')](_0x182df1[_0xbad0('0x43')][_0xbad0('0x58')])){utils[_0xbad0('0x6')](util[_0xbad0('0x7')](_0xbad0('0x59'),_0x182df1[_0xbad0('0x9')],_0x182df1[_0xbad0('0x45')]));channels[_0x182df1[_0xbad0('0x9')]][_0xbad0('0x58')]=_0x182df1[_0xbad0('0x45')];}}}catch(_0xe50241){utils[_0xbad0('0x32')](util[_0xbad0('0x7')](_0xbad0('0x42'),_0x182df1['uniqueid']),_0xe50241);}};exports['newexten']=function(_0x3e63b0){try{if(!_[_0xbad0('0x20')](channels[_0x3e63b0[_0xbad0('0x9')]])){utils[_0xbad0('0x16')](util['format']('[%s][calls][newexten]',_0x3e63b0[_0xbad0('0x9')]),_0x3e63b0);utils[_0xbad0('0x6')](util[_0xbad0('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3e63b0['uniqueid'],_0x3e63b0[_0xbad0('0x5a')],_0x3e63b0['appdata']));if(_0x3e63b0[_0xbad0('0x5a')][_0xbad0('0x5b')]()==_0xbad0('0x5c')&&_['startsWith'](_0x3e63b0[_0xbad0('0x5d')]['toLowerCase'](),_0xbad0('0x5e'))){var _0x5b78cf=_0x3e63b0[_0xbad0('0x5d')]['split']('=');var _0x34bf24=_0x5b78cf[0x0][_0xbad0('0x5f')](_0x5b78cf[0x0][_0xbad0('0x60')]('(')+0x1,_0x5b78cf[0x0]['lastIndexOf'](')'));var _0xdba254=_0x5b78cf[0x1];channels[_0x3e63b0[_0xbad0('0x9')]][_0x34bf24]=_0xdba254;}if(!_[_0xbad0('0x61')]([_0xbad0('0x29'),_0xbad0('0x62'),_0xbad0('0x63'),_0xbad0('0x5c'),_0xbad0('0x64')],_0x3e63b0[_0xbad0('0x5a')][_0xbad0('0x5b')]())){channels[_0x3e63b0[_0xbad0('0x9')]][_0xbad0('0x4e')]=_0x3e63b0[_0xbad0('0x5a')];channels[_0x3e63b0[_0xbad0('0x9')]][_0xbad0('0x4f')]=_0x3e63b0[_0xbad0('0x5d')];}}}catch(_0x855309){utils[_0xbad0('0x32')](util[_0xbad0('0x7')](_0xbad0('0x65'),_0x3e63b0[_0xbad0('0x9')]),_0x855309);}}; \ No newline at end of file +var _0xca93=['noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','queue','membername','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','ANSWERED','[%s][calls][hangup]','callerid','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','hangup'];(function(_0x44b767,_0x5001af){var _0x29db84=function(_0x5dc7df){while(--_0x5dc7df){_0x44b767['push'](_0x44b767['shift']());}};_0x29db84(++_0x5001af);}(_0xca93,0xdc));var _0x3ca9=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xca93[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x3ca9('0x0'));var util=require(_0x3ca9('0x1'));var utils=require(_0x3ca9('0x2'));var dispositions=[_0x3ca9('0x3'),_0x3ca9('0x4'),_0x3ca9('0x4'),'NO\x20ANSWER',_0x3ca9('0x3'),_0x3ca9('0x3'),'ANSWERED',_0x3ca9('0x5'),_0x3ca9('0x4'),'FAILED',_0x3ca9('0x4')];var channels={};function writeDB(_0x541dc2){utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x541dc2[_0x3ca9('0x8')],_0x541dc2[_0x3ca9('0x9')],_0x541dc2[_0x3ca9('0xa')],_0x541dc2[_0x3ca9('0xb')],_0x541dc2['interface'],_0x541dc2['calleridnum'],_0x541dc2[_0x3ca9('0xc')],_0x541dc2[_0x3ca9('0xd')]));if(_0x541dc2[_0x3ca9('0xe')]){utils['getUserByInternal'](_0x541dc2['accountcode'])[_0x3ca9('0xf')](function(_0x4138c3){if(_0x4138c3){_0x541dc2[_0x3ca9('0x10')]=_0x4138c3['id'];}utils[_0x3ca9('0x11')](_0x3ca9('0x12'),_0x541dc2);});}else{utils['request'](_0x3ca9('0x12'),_0x541dc2);}if(channels[_0x541dc2['uniqueid']]){delete channels[_0x541dc2['uniqueid']];}}exports[_0x3ca9('0x13')]=function(_0x181960){try{utils[_0x3ca9('0x14')](util[_0x3ca9('0x7')](_0x3ca9('0x15'),_0x181960[_0x3ca9('0x8')]),_0x181960);if(_0x181960[_0x3ca9('0x8')]==_0x181960[_0x3ca9('0x16')]&&_0x181960[_0x3ca9('0x9')]!=_0x3ca9('0x17')){utils['info'](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x181960[_0x3ca9('0x8')],_0x181960[_0x3ca9('0x18')],_0x181960['exten']));channels[_0x181960[_0x3ca9('0x8')]]={'uniqueid':_0x181960['uniqueid'],'accountcode':_0x181960[_0x3ca9('0xe')],'source':_0x181960['calleridnum'],'destination':_0x181960[_0x3ca9('0x19')],'destinationcontext':_0x181960[_0x3ca9('0x18')],'channel':_0x181960[_0x3ca9('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3ca9('0x3'),'amaflags':_0x3ca9('0x1a')};}}catch(_0x583d6a){utils[_0x3ca9('0x1b')](util[_0x3ca9('0x7')](_0x3ca9('0x15'),_0x181960['uniqueid']),_0x583d6a);}};exports[_0x3ca9('0x1c')]=function(_0x3b3d36){try{utils['debug'](util['format'](_0x3ca9('0x1d'),_0x3b3d36[_0x3ca9('0x8')]),_0x3b3d36);if(!_[_0x3ca9('0x1e')](channels[_0x3b3d36[_0x3ca9('0x8')]])&&_0x3b3d36[_0x3ca9('0x1f')]==0x6){utils['info'](util[_0x3ca9('0x7')](_0x3ca9('0x20'),_0x3b3d36[_0x3ca9('0x8')],_0x3b3d36[_0x3ca9('0x18')],_0x3b3d36[_0x3ca9('0x9')]));if(_[_0x3ca9('0x1e')](channels[_0x3b3d36[_0x3ca9('0x8')]][_0x3ca9('0x21')])){channels[_0x3b3d36[_0x3ca9('0x8')]][_0x3ca9('0x21')]=utils[_0x3ca9('0x22')]();}}else if(!_[_0x3ca9('0x1e')](channels[_0x3b3d36['linkedid']])&&_0x3b3d36[_0x3ca9('0x1f')]==0x6&&_0x3b3d36['context']!=_0x3ca9('0x23')){utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')](_0x3ca9('0x24'),_0x3b3d36[_0x3ca9('0x8')],_0x3b3d36[_0x3ca9('0x16')],_0x3b3d36[_0x3ca9('0x18')],_0x3b3d36['channel']));channels[_0x3b3d36[_0x3ca9('0x16')]][_0x3ca9('0xe')]=_0x3b3d36[_0x3ca9('0xe')];channels[_0x3b3d36[_0x3ca9('0x16')]]['destinationchannel']=_0x3b3d36['channel'];if(_[_0x3ca9('0x1e')](channels[_0x3b3d36['linkedid']][_0x3ca9('0x25')])){channels[_0x3b3d36['linkedid']][_0x3ca9('0x25')]=utils[_0x3ca9('0x22')]();}channels[_0x3b3d36[_0x3ca9('0x16')]][_0x3ca9('0x26')]=dispositions[_[_0x3ca9('0x27')](_0x3b3d36['channelstate'])]||_0x3ca9('0x28');}}catch(_0x45a12f){utils[_0x3ca9('0x1b')](util[_0x3ca9('0x7')]('[%s][calls][newstate]',_0x3b3d36[_0x3ca9('0x8')]),_0x45a12f);}};exports['hangup']=function(_0x45c263){try{if(!_[_0x3ca9('0x1e')](channels[_0x45c263[_0x3ca9('0x8')]])){utils[_0x3ca9('0x14')](util[_0x3ca9('0x7')](_0x3ca9('0x29'),_0x45c263[_0x3ca9('0x8')]),_0x45c263);if(_[_0x3ca9('0x1e')](channels[_0x45c263[_0x3ca9('0x8')]][_0x3ca9('0x2a')])){channels[_0x45c263[_0x3ca9('0x8')]][_0x3ca9('0x2a')]=_0x45c263['calleridname']+'\x20<'+_0x45c263[_0x3ca9('0x2b')]+'>';}utils['info'](util[_0x3ca9('0x7')](_0x3ca9('0x2c'),_0x45c263[_0x3ca9('0x8')],channels[_0x45c263[_0x3ca9('0x8')]][_0x3ca9('0x2a')],_0x45c263['cause-txt']));channels[_0x45c263[_0x3ca9('0x8')]]['endtime']=utils[_0x3ca9('0x22')]();channels[_0x45c263[_0x3ca9('0x8')]][_0x3ca9('0x2d')]=utils[_0x3ca9('0x2e')](channels[_0x45c263[_0x3ca9('0x8')]][_0x3ca9('0x2f')],channels[_0x45c263[_0x3ca9('0x8')]]['starttime']);channels[_0x45c263[_0x3ca9('0x8')]][_0x3ca9('0x30')]=channels[_0x45c263['uniqueid']][_0x3ca9('0x25')]?utils['diffTime'](channels[_0x45c263[_0x3ca9('0x8')]][_0x3ca9('0x2f')],channels[_0x45c263[_0x3ca9('0x8')]][_0x3ca9('0x25')]):0x0;writeDB(channels[_0x45c263['uniqueid']]);}}catch(_0x2ff953){utils[_0x3ca9('0x1b')](util[_0x3ca9('0x7')](_0x3ca9('0x29'),_0x45c263['uniqueid']),_0x2ff953);}};exports[_0x3ca9('0x31')]=function(_0x231f5e){try{if(!_[_0x3ca9('0x1e')](channels[_0x231f5e[_0x3ca9('0x32')]])){utils[_0x3ca9('0x14')](util[_0x3ca9('0x7')]('[%s][calls][attendedtransfer]',_0x231f5e[_0x3ca9('0x33')]),_0x231f5e);if(channels[_0x231f5e[_0x3ca9('0x32')]][_0x3ca9('0x9')]==_0x231f5e['transfereechannel']){utils[_0x3ca9('0x6')](util['format'](_0x3ca9('0x34'),_0x231f5e[_0x3ca9('0x33')],_0x231f5e[_0x3ca9('0x32')],_0x231f5e[_0x3ca9('0x35')]));channels[_0x231f5e['localtwolinkedid']][_0x3ca9('0x36')]=_0x231f5e[_0x3ca9('0x35')];channels[_0x231f5e[_0x3ca9('0x32')]][_0x3ca9('0x37')]=_0x3ca9('0x38');}else if(channels[_0x231f5e[_0x3ca9('0x32')]]['channel']=_0x231f5e[_0x3ca9('0x39')]){utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x231f5e[_0x3ca9('0x33')],_0x231f5e['localtwolinkedid'],_0x231f5e[_0x3ca9('0x3a')]));channels[_0x231f5e[_0x3ca9('0x32')]][_0x3ca9('0x36')]=_0x231f5e[_0x3ca9('0x3a')];channels[_0x231f5e[_0x3ca9('0x32')]][_0x3ca9('0x37')]='_attended';}}}catch(_0xfb0c7a){utils[_0x3ca9('0x1b')](util[_0x3ca9('0x7')](_0x3ca9('0x3b'),_0x231f5e[_0x3ca9('0x33')]),_0xfb0c7a);}};exports[_0x3ca9('0x3c')]=function(_0x545769){try{if(!_['isNil'](channels[_0x545769['uniqueid']])){utils[_0x3ca9('0x14')](util['format']('[%s][calls][musiconholdstart]',_0x545769['uniqueid']),_0x545769);channels[_0x545769['uniqueid']][_0x3ca9('0x3d')]=utils[_0x3ca9('0x22')]();utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x545769['uniqueid'],channels[_0x545769[_0x3ca9('0x8')]][_0x3ca9('0x3d')]));}}catch(_0x566b98){utils[_0x3ca9('0x1b')](util[_0x3ca9('0x7')](_0x3ca9('0x3e'),_0x545769[_0x3ca9('0x8')]),_0x566b98);}};exports[_0x3ca9('0x3f')]=function(_0x4f09d7){try{if(!_[_0x3ca9('0x1e')](channels[_0x4f09d7[_0x3ca9('0x8')]])){utils[_0x3ca9('0x14')](util[_0x3ca9('0x7')]('[%s][calls][musiconholdstop]',_0x4f09d7[_0x3ca9('0x8')]),_0x4f09d7);if(!_[_0x3ca9('0x1e')](channels[_0x4f09d7[_0x3ca9('0x8')]][_0x3ca9('0x3d')])){channels[_0x4f09d7[_0x3ca9('0x8')]][_0x3ca9('0x40')]+=utils[_0x3ca9('0x2e')](utils['now'](),channels[_0x4f09d7[_0x3ca9('0x8')]][_0x3ca9('0x3d')]);utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')](_0x3ca9('0x41'),_0x4f09d7[_0x3ca9('0x8')],channels[_0x4f09d7['uniqueid']][_0x3ca9('0x40')]));delete channels[_0x4f09d7[_0x3ca9('0x8')]]['musiconholdstartAt'];}}}catch(_0x4e9710){utils[_0x3ca9('0x1b')](util['format'](_0x3ca9('0x42'),_0x4f09d7[_0x3ca9('0x8')]),_0x4e9710);}};exports[_0x3ca9('0x43')]=function(_0x571966){try{if(!_['isNil'](channels[_0x571966['uniqueid']])){utils['debug'](util['format'](_0x3ca9('0x44'),_0x571966[_0x3ca9('0x8')]),_0x571966);if(!_[_0x3ca9('0x1e')](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x46')])){utils['info'](util[_0x3ca9('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x571966[_0x3ca9('0x8')],_0x571966[_0x3ca9('0x47')]));channels[_0x571966[_0x3ca9('0x8')]][_0x3ca9('0x48')]=_0x571966[_0x3ca9('0x47')];}if(!_[_0x3ca9('0x1e')](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x49')])){utils['info'](util['format'](_0x3ca9('0x4a'),_0x571966[_0x3ca9('0x8')],_0x571966[_0x3ca9('0x47')]));channels[_0x571966[_0x3ca9('0x8')]][_0x3ca9('0x4b')]=_0x571966[_0x3ca9('0x47')];channels[_0x571966['uniqueid']]['callerid']='\x22'+_0x571966[_0x3ca9('0x47')]+_0x3ca9('0x4c')+_0x571966['value']+'>';}if(!_['isNil'](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x4d')])||!_['isNil'](_0x571966[_0x3ca9('0x45')]['xmd-callerid'])){utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')](_0x3ca9('0x4e'),_0x571966[_0x3ca9('0x8')],!_[_0x3ca9('0x1e')](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x4d')])?_0x3ca9('0x4d'):_0x3ca9('0x4f'),_0x571966[_0x3ca9('0x47')]));channels[_0x571966[_0x3ca9('0x8')]][_0x3ca9('0x2a')]=_0x571966['value'];}if(!_[_0x3ca9('0x1e')](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x50')])||!_[_0x3ca9('0x1e')](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x51')])){utils['info'](util[_0x3ca9('0x7')](_0x3ca9('0x4e'),_0x571966[_0x3ca9('0x8')],!_[_0x3ca9('0x1e')](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x50')])?_0x3ca9('0x50'):_0x3ca9('0x51'),_0x571966[_0x3ca9('0x47')]));channels[_0x571966[_0x3ca9('0x8')]][_0x3ca9('0x52')]=_0x3ca9('0x53');channels[_0x571966[_0x3ca9('0x8')]][_0x3ca9('0x54')]=_0x571966['value'];channels[_0x571966['uniqueid']][_0x3ca9('0xa')]=!![];}if(!_['isNil'](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x55')])){utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x571966[_0x3ca9('0x8')],_0x571966[_0x3ca9('0x47')]));channels[_0x571966[_0x3ca9('0x8')]]['ContactId']=_0x571966['value'];}if(!_[_0x3ca9('0x1e')](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x56')])){utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')](_0x3ca9('0x57'),_0x571966[_0x3ca9('0x8')],_0x571966['value']));channels[_0x571966[_0x3ca9('0x8')]][_0x3ca9('0x58')]=_0x571966[_0x3ca9('0x47')];}if(!_[_0x3ca9('0x1e')](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x59')])){utils['info'](util[_0x3ca9('0x7')](_0x3ca9('0x5a'),_0x571966[_0x3ca9('0x8')],_0x571966[_0x3ca9('0x47')]));channels[_0x571966[_0x3ca9('0x8')]][_0x3ca9('0x5b')]=_0x571966[_0x3ca9('0x47')];}if(!_['isNil'](_0x571966[_0x3ca9('0x45')][_0x3ca9('0x5c')])){utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x571966['uniqueid'],_0x571966['value']));channels[_0x571966['uniqueid']][_0x3ca9('0x5c')]=_0x571966[_0x3ca9('0x47')];}}}catch(_0x143fd1){utils['error'](util[_0x3ca9('0x7')](_0x3ca9('0x44'),_0x571966[_0x3ca9('0x8')]),_0x143fd1);}};exports['newexten']=function(_0x2fd733){try{if(!_[_0x3ca9('0x1e')](channels[_0x2fd733[_0x3ca9('0x8')]])){utils[_0x3ca9('0x14')](util[_0x3ca9('0x7')]('[%s][calls][newexten]',_0x2fd733[_0x3ca9('0x8')]),_0x2fd733);utils[_0x3ca9('0x6')](util[_0x3ca9('0x7')](_0x3ca9('0x5d'),_0x2fd733[_0x3ca9('0x8')],_0x2fd733[_0x3ca9('0x5e')],_0x2fd733[_0x3ca9('0x5f')]));if(_0x2fd733[_0x3ca9('0x5e')][_0x3ca9('0x60')]()==_0x3ca9('0x61')&&_[_0x3ca9('0x62')](_0x2fd733[_0x3ca9('0x5f')]['toLowerCase'](),_0x3ca9('0x63'))){var _0x42b00e=_0x2fd733[_0x3ca9('0x5f')]['split']('=');var _0x53c863=_0x42b00e[0x0][_0x3ca9('0x64')](_0x42b00e[0x0][_0x3ca9('0x65')]('(')+0x1,_0x42b00e[0x0][_0x3ca9('0x65')](')'));var _0x272e3f=_0x42b00e[0x1];channels[_0x2fd733['uniqueid']][_0x53c863]=_0x272e3f;}if(!_[_0x3ca9('0x66')]([_0x3ca9('0x67'),_0x3ca9('0x68'),_0x3ca9('0x69'),_0x3ca9('0x61'),_0x3ca9('0x6a')],_0x2fd733[_0x3ca9('0x5e')][_0x3ca9('0x60')]())){channels[_0x2fd733[_0x3ca9('0x8')]][_0x3ca9('0x52')]=_0x2fd733[_0x3ca9('0x5e')];channels[_0x2fd733[_0x3ca9('0x8')]][_0x3ca9('0x54')]=_0x2fd733[_0x3ca9('0x5f')];}}}catch(_0x299421){utils[_0x3ca9('0x1b')](util[_0x3ca9('0x7')](_0x3ca9('0x6b'),_0x2fd733[_0x3ca9('0x8')]),_0x299421);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index da138a4..7e7280a 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 _0x3eb0=['error','[core]\x20error','managerevent','./utils','connect','shutdown','fullybooted','info','[core]\x20fullybooted'];(function(_0x1ddc6a,_0x3d7047){var _0x5930e7=function(_0x4e2758){while(--_0x4e2758){_0x1ddc6a['push'](_0x1ddc6a['shift']());}};_0x5930e7(++_0x3d7047);}(_0x3eb0,0x12c));var _0x03eb=function(_0x4b9723,_0x58f688){_0x4b9723=_0x4b9723-0x0;var _0x50d7cc=_0x3eb0[_0x4b9723];return _0x50d7cc;};'use strict';var utils=require(_0x03eb('0x0'));exports[_0x03eb('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x03eb('0x2')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x03eb('0x3')]=function(){utils[_0x03eb('0x4')](_0x03eb('0x5'));};exports[_0x03eb('0x6')]=function(_0x3b20a5){utils[_0x03eb('0x6')](_0x03eb('0x7'),_0x3b20a5);};exports['close']=function(){utils[_0x03eb('0x4')]('[core]\x20close');};exports[_0x03eb('0x8')]=function(_0x2b4a95){}; \ No newline at end of file +var _0x5906=['error','[core]\x20close','./utils','connect','info','shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x2c6b7d,_0x84c345){var _0x477766=function(_0x5332ba){while(--_0x5332ba){_0x2c6b7d['push'](_0x2c6b7d['shift']());}};_0x477766(++_0x84c345);}(_0x5906,0x11a));var _0x6590=function(_0xfd60ef,_0x408ad0){_0xfd60ef=_0xfd60ef-0x0;var _0x1ed88d=_0x5906[_0xfd60ef];return _0x1ed88d;};'use strict';var utils=require(_0x6590('0x0'));exports[_0x6590('0x1')]=function(){utils[_0x6590('0x2')]('[core]\x20connected');};exports[_0x6590('0x3')]=function(){utils[_0x6590('0x2')]('[core]\x20shutdown');};exports[_0x6590('0x4')]=function(){utils[_0x6590('0x2')](_0x6590('0x5'));};exports[_0x6590('0x6')]=function(_0x3ae5f5){utils[_0x6590('0x6')]('[core]\x20error',_0x3ae5f5);};exports['close']=function(){utils[_0x6590('0x2')](_0x6590('0x7'));};exports['managerevent']=function(_0x42afff){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b5979c1..2ffebeb 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 _0xaf4f=['called','error','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','calleridname','cause-txt','complete','diffTime','endtime','billableseconds','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','now','lastevent'];(function(_0x48c8ab,_0x5af680){var _0x246963=function(_0x2d1f61){while(--_0x2d1f61){_0x48c8ab['push'](_0x48c8ab['shift']());}};_0x246963(++_0x5af680);}(_0xaf4f,0x90));var _0xfaf4=function(_0x75e2c9,_0x50b412){_0x75e2c9=_0x75e2c9-0x0;var _0x388ddb=_0xaf4f[_0x75e2c9];return _0x388ddb;};'use strict';var _=require(_0xfaf4('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x4fa3bd){utils[_0xfaf4('0x1')](util[_0xfaf4('0x2')](_0xfaf4('0x3'),_0x4fa3bd[_0xfaf4('0x4')],_0x4fa3bd['channel'],_0x4fa3bd[_0xfaf4('0x5')],_0x4fa3bd[_0xfaf4('0x6')],_0x4fa3bd['connectedlinenum'],_0x4fa3bd[_0xfaf4('0x7')]));utils[_0xfaf4('0x8')]('CreateVoiceDialReport',_0x4fa3bd);delete dials[_0x4fa3bd[_0xfaf4('0x4')]];}exports[_0xfaf4('0x9')]=function(_0xea3eae){try{utils[_0xfaf4('0xa')](util[_0xfaf4('0x2')](_0xfaf4('0xb'),_0xea3eae[_0xfaf4('0x4')]),_0xea3eae);utils[_0xfaf4('0x1')](util['format'](_0xfaf4('0xc'),_0xea3eae[_0xfaf4('0x4')],_0xea3eae['application'],_0xea3eae[_0xfaf4('0xd')]));if(_0xea3eae[_0xfaf4('0xe')][_0xfaf4('0xf')]()==_0xfaf4('0x10')&&_[_0xfaf4('0x11')](_0xea3eae[_0xfaf4('0xd')][_0xfaf4('0xf')](),_0xfaf4('0x12'))){var _0x1caf5e=_0xea3eae[_0xfaf4('0xd')]['split']('=');dials[_0xea3eae[_0xfaf4('0x4')]]={'routeId':_0x1caf5e[0x1]};}}catch(_0x784637){utils['error'](util[_0xfaf4('0x2')](_0xfaf4('0xb'),_0xea3eae[_0xfaf4('0x4')]),_0x784637);}};exports['varset']=function(_0x1f196c){try{utils[_0xfaf4('0xa')](util[_0xfaf4('0x2')](_0xfaf4('0x13'),_0x1f196c['uniqueid']),_0x1f196c);if(!_[_0xfaf4('0x14')](_0x1f196c[_0xfaf4('0x15')]['outboundrouteid'])){utils[_0xfaf4('0x1')](util[_0xfaf4('0x2')](_0xfaf4('0x16'),_0x1f196c[_0xfaf4('0x4')],_0x1f196c[_0xfaf4('0x17')]));dials[_0x1f196c['uniqueid']]={'routeId':_0x1f196c[_0xfaf4('0x17')]};}}catch(_0x40c0b3){utils['error'](util[_0xfaf4('0x2')]('[%s][dials][varset]',_0x1f196c[_0xfaf4('0x4')]),_0x40c0b3);}};exports['dialbegin']=function(_0x41eab7){try{if(!_[_0xfaf4('0x14')](dials[_0x41eab7[_0xfaf4('0x4')]])){utils[_0xfaf4('0xa')](util['format']('[%s][dials][dialbegin]',_0x41eab7['uniqueid']),_0x41eab7);dials[_0x41eab7['uniqueid']]=_[_0xfaf4('0x18')](dials[_0x41eab7[_0xfaf4('0x4')]],_0x41eab7);dials[_0x41eab7['uniqueid']][_0xfaf4('0x19')]=utils[_0xfaf4('0x1a')]();dials[_0x41eab7[_0xfaf4('0x4')]][_0xfaf4('0x1b')]=_0xfaf4('0x1c');utils['info'](util[_0xfaf4('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x41eab7[_0xfaf4('0x4')],dials[_0x41eab7['uniqueid']][_0xfaf4('0x19')]));}}catch(_0x4fd604){utils[_0xfaf4('0x1d')](util[_0xfaf4('0x2')]('[%s][dials][dialbegin]',_0x41eab7['uniqueid']),_0x4fd604);}};exports['dialend']=function(_0x396d05){try{if(!_[_0xfaf4('0x14')](dials[_0x396d05[_0xfaf4('0x4')]])){utils[_0xfaf4('0xa')](util[_0xfaf4('0x2')]('[%s][dials][dialend]',_0x396d05['uniqueid']),_0x396d05);dials[_0x396d05[_0xfaf4('0x4')]]['dialstatus']=_0x396d05[_0xfaf4('0x7')];if(_0x396d05[_0xfaf4('0x7')]==_0xfaf4('0x1e')){dials[_0x396d05[_0xfaf4('0x4')]]=_['assign'](dials[_0x396d05[_0xfaf4('0x4')]],_0x396d05);dials[_0x396d05['uniqueid']][_0xfaf4('0x1f')]=utils['now']();dials[_0x396d05[_0xfaf4('0x4')]]['lastevent']=_0xfaf4('0x20');utils[_0xfaf4('0x1')](util['format'](_0xfaf4('0x21'),_0x396d05[_0xfaf4('0x4')],_0x396d05['dialstatus'],dials[_0x396d05[_0xfaf4('0x4')]]['answertime']));}else{utils[_0xfaf4('0x1')](util[_0xfaf4('0x2')](_0xfaf4('0x22'),_0x396d05[_0xfaf4('0x4')],_0x396d05[_0xfaf4('0x7')]));}}}catch(_0xdbadf6){utils['error'](util[_0xfaf4('0x2')](_0xfaf4('0x23'),_0x396d05[_0xfaf4('0x4')]),_0xdbadf6);}};exports['hangup']=function(_0xde12ff){try{if(!_[_0xfaf4('0x14')](dials[_0xde12ff[_0xfaf4('0x4')]])){utils['debug'](util[_0xfaf4('0x2')](_0xfaf4('0x24'),_0xde12ff[_0xfaf4('0x4')]),_0xde12ff);utils[_0xfaf4('0x1')](util[_0xfaf4('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0xde12ff[_0xfaf4('0x4')],_0xde12ff[_0xfaf4('0x6')],_0xde12ff[_0xfaf4('0x25')],_0xde12ff[_0xfaf4('0x26')]));dials[_0xde12ff[_0xfaf4('0x4')]]=_[_0xfaf4('0x18')](dials[_0xde12ff[_0xfaf4('0x4')]],{'endtime':utils['now'](),'lastevent':_0xfaf4('0x27')});dials[_0xde12ff[_0xfaf4('0x4')]]['duration']=utils[_0xfaf4('0x28')](dials[_0xde12ff[_0xfaf4('0x4')]][_0xfaf4('0x29')],dials[_0xde12ff[_0xfaf4('0x4')]][_0xfaf4('0x19')]);dials[_0xde12ff[_0xfaf4('0x4')]]['holdtime']=utils[_0xfaf4('0x28')](dials[_0xde12ff['uniqueid']]['answertime']||dials[_0xde12ff[_0xfaf4('0x4')]][_0xfaf4('0x29')],dials[_0xde12ff['uniqueid']]['starttime']);dials[_0xde12ff[_0xfaf4('0x4')]][_0xfaf4('0x2a')]=dials[_0xde12ff[_0xfaf4('0x4')]][_0xfaf4('0x1f')]?utils[_0xfaf4('0x28')](dials[_0xde12ff[_0xfaf4('0x4')]][_0xfaf4('0x29')],dials[_0xde12ff[_0xfaf4('0x4')]]['answertime']):0x0;writeDB(dials[_0xde12ff['uniqueid']]);}}catch(_0x378403){utils[_0xfaf4('0x1d')](util[_0xfaf4('0x2')]('[%s][dials][hangup]',_0xde12ff['uniqueid']),_0x378403);}}; \ No newline at end of file +var _0xef00=['util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','duration','endtime','holdtime','diffTime','billableseconds'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xef00,0x157));var _0x0ef0=function(_0x12ae97,_0x385f36){_0x12ae97=_0x12ae97-0x0;var _0xb50847=_0xef00[_0x12ae97];return _0xb50847;};'use strict';var _=require('lodash');var util=require(_0x0ef0('0x0'));var utils=require(_0x0ef0('0x1'));var dials={};function writeDB(_0x50c592){utils[_0x0ef0('0x2')](util['format'](_0x0ef0('0x3'),_0x50c592[_0x0ef0('0x4')],_0x50c592[_0x0ef0('0x5')],_0x50c592[_0x0ef0('0x6')],_0x50c592[_0x0ef0('0x7')],_0x50c592[_0x0ef0('0x8')],_0x50c592[_0x0ef0('0x9')]));utils[_0x0ef0('0xa')]('CreateVoiceDialReport',_0x50c592);delete dials[_0x50c592['uniqueid']];}exports['newexten']=function(_0x59bff2){try{utils[_0x0ef0('0xb')](util[_0x0ef0('0xc')]('[%s][dials][newexten]',_0x59bff2['uniqueid']),_0x59bff2);utils[_0x0ef0('0x2')](util['format'](_0x0ef0('0xd'),_0x59bff2['uniqueid'],_0x59bff2['application'],_0x59bff2[_0x0ef0('0xe')]));if(_0x59bff2[_0x0ef0('0xf')][_0x0ef0('0x10')]()==_0x0ef0('0x11')&&_[_0x0ef0('0x12')](_0x59bff2['appdata'][_0x0ef0('0x10')](),_0x0ef0('0x13'))){var _0x19f600=_0x59bff2[_0x0ef0('0xe')]['split']('=');dials[_0x59bff2[_0x0ef0('0x4')]]={'routeId':_0x19f600[0x1]};}}catch(_0x41af9d){utils['error'](util[_0x0ef0('0xc')]('[%s][dials][newexten]',_0x59bff2[_0x0ef0('0x4')]),_0x41af9d);}};exports[_0x0ef0('0x14')]=function(_0x2ab739){try{utils[_0x0ef0('0xb')](util[_0x0ef0('0xc')](_0x0ef0('0x15'),_0x2ab739[_0x0ef0('0x4')]),_0x2ab739);if(!_[_0x0ef0('0x16')](_0x2ab739[_0x0ef0('0x17')]['outboundrouteid'])){utils['info'](util['format'](_0x0ef0('0x18'),_0x2ab739[_0x0ef0('0x4')],_0x2ab739[_0x0ef0('0x19')]));dials[_0x2ab739[_0x0ef0('0x4')]]={'routeId':_0x2ab739[_0x0ef0('0x19')]};}}catch(_0x1ea828){utils[_0x0ef0('0x1a')](util[_0x0ef0('0xc')]('[%s][dials][varset]',_0x2ab739['uniqueid']),_0x1ea828);}};exports[_0x0ef0('0x1b')]=function(_0x213a33){try{if(!_[_0x0ef0('0x16')](dials[_0x213a33[_0x0ef0('0x4')]])){utils['debug'](util[_0x0ef0('0xc')](_0x0ef0('0x1c'),_0x213a33[_0x0ef0('0x4')]),_0x213a33);dials[_0x213a33[_0x0ef0('0x4')]]=_[_0x0ef0('0x1d')](dials[_0x213a33[_0x0ef0('0x4')]],_0x213a33);dials[_0x213a33[_0x0ef0('0x4')]][_0x0ef0('0x1e')]=utils[_0x0ef0('0x1f')]();dials[_0x213a33[_0x0ef0('0x4')]][_0x0ef0('0x20')]=_0x0ef0('0x21');utils['info'](util[_0x0ef0('0xc')](_0x0ef0('0x22'),_0x213a33[_0x0ef0('0x4')],dials[_0x213a33[_0x0ef0('0x4')]][_0x0ef0('0x1e')]));}}catch(_0x54092a){utils[_0x0ef0('0x1a')](util[_0x0ef0('0xc')](_0x0ef0('0x1c'),_0x213a33[_0x0ef0('0x4')]),_0x54092a);}};exports[_0x0ef0('0x23')]=function(_0x14e28a){try{if(!_[_0x0ef0('0x16')](dials[_0x14e28a['uniqueid']])){utils['debug'](util[_0x0ef0('0xc')]('[%s][dials][dialend]',_0x14e28a[_0x0ef0('0x4')]),_0x14e28a);dials[_0x14e28a['uniqueid']][_0x0ef0('0x9')]=_0x14e28a[_0x0ef0('0x9')];if(_0x14e28a[_0x0ef0('0x9')]=='ANSWER'){dials[_0x14e28a[_0x0ef0('0x4')]]=_[_0x0ef0('0x1d')](dials[_0x14e28a[_0x0ef0('0x4')]],_0x14e28a);dials[_0x14e28a[_0x0ef0('0x4')]]['answertime']=utils[_0x0ef0('0x1f')]();dials[_0x14e28a['uniqueid']][_0x0ef0('0x20')]=_0x0ef0('0x24');utils[_0x0ef0('0x2')](util['format'](_0x0ef0('0x25'),_0x14e28a[_0x0ef0('0x4')],_0x14e28a[_0x0ef0('0x9')],dials[_0x14e28a[_0x0ef0('0x4')]][_0x0ef0('0x26')]));}else{utils[_0x0ef0('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x14e28a[_0x0ef0('0x4')],_0x14e28a['dialstatus']));}}}catch(_0x3bb895){utils[_0x0ef0('0x1a')](util['format'](_0x0ef0('0x27'),_0x14e28a[_0x0ef0('0x4')]),_0x3bb895);}};exports[_0x0ef0('0x28')]=function(_0x23b405){try{if(!_[_0x0ef0('0x16')](dials[_0x23b405[_0x0ef0('0x4')]])){utils[_0x0ef0('0xb')](util[_0x0ef0('0xc')](_0x0ef0('0x29'),_0x23b405[_0x0ef0('0x4')]),_0x23b405);utils[_0x0ef0('0x2')](util[_0x0ef0('0xc')](_0x0ef0('0x2a'),_0x23b405['uniqueid'],_0x23b405[_0x0ef0('0x7')],_0x23b405['calleridname'],_0x23b405['cause-txt']));dials[_0x23b405[_0x0ef0('0x4')]]=_[_0x0ef0('0x1d')](dials[_0x23b405['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x0ef0('0x2b')});dials[_0x23b405[_0x0ef0('0x4')]][_0x0ef0('0x2c')]=utils['diffTime'](dials[_0x23b405['uniqueid']][_0x0ef0('0x2d')],dials[_0x23b405[_0x0ef0('0x4')]][_0x0ef0('0x1e')]);dials[_0x23b405['uniqueid']][_0x0ef0('0x2e')]=utils[_0x0ef0('0x2f')](dials[_0x23b405['uniqueid']][_0x0ef0('0x26')]||dials[_0x23b405[_0x0ef0('0x4')]][_0x0ef0('0x2d')],dials[_0x23b405['uniqueid']]['starttime']);dials[_0x23b405[_0x0ef0('0x4')]][_0x0ef0('0x30')]=dials[_0x23b405[_0x0ef0('0x4')]][_0x0ef0('0x26')]?utils[_0x0ef0('0x2f')](dials[_0x23b405['uniqueid']]['endtime'],dials[_0x23b405[_0x0ef0('0x4')]][_0x0ef0('0x26')]):0x0;writeDB(dials[_0x23b405['uniqueid']]);}}catch(_0x5cce40){utils[_0x0ef0('0x1a')](util['format']('[%s][dials][hangup]',_0x23b405['uniqueid']),_0x5cce40);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 676e807..439dfbb 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 _0x396b=['./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','device','devicestatechange','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','username','password','xdr','info','./agents.controller','./calls.controller'];(function(_0x3a5f3f,_0x2b3679){var _0x3bf9a3=function(_0x25230f){while(--_0x25230f){_0x3a5f3f['push'](_0x3a5f3f['shift']());}};_0x3bf9a3(++_0x2b3679);}(_0x396b,0x101));var _0xb396=function(_0x3423f8,_0x4ff1e6){_0x3423f8=_0x3423f8-0x0;var _0x29704e=_0x396b[_0x3423f8];return _0x29704e;};var AsteriskManager=require(_0xb396('0x0'));var config=require(_0xb396('0x1'));var utils=require(_0xb396('0x2'));var util=require(_0xb396('0x3'));var ami=new AsteriskManager(config[_0xb396('0x4')]['port'],config[_0xb396('0x4')]['ip'],config['asterisk'][_0xb396('0x5')],config[_0xb396('0x4')][_0xb396('0x6')],!![]);ami['keepConnected']();if(config[_0xb396('0x7')]&&config[_0xb396('0x7')]['disabled']){utils[_0xb396('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0xb396('0x9'));var calls=require(_0xb396('0xa'));var queues=require(_0xb396('0xb'));var recordings=require(_0xb396('0xc'));var members=require(_0xb396('0xd'));var dials=require(_0xb396('0xe'));var transfers=require(_0xb396('0xf'));var core=require(_0xb396('0x10'));ami['on'](_0xb396('0x11'),core[_0xb396('0x11')]);ami['on'](_0xb396('0x12'),core[_0xb396('0x12')]);ami['on'](_0xb396('0x13'),core['fullybooted']);ami['on']('error',core[_0xb396('0x14')]);ami['on'](_0xb396('0x15'),core[_0xb396('0x15')]);ami['on'](_0xb396('0x16'),core[_0xb396('0x16')]);ami['on']('devicestatechange',function(_0x15ba1d){try{utils['debug'](util[_0xb396('0x17')]('[%s][index][devicestatechange]',_0x15ba1d[_0xb396('0x18')]),_0x15ba1d);members[_0xb396('0x19')](_0x15ba1d);}catch(_0x4546d1){utils['error'](util[_0xb396('0x17')]('[%s][index][devicestatechange]',_0x15ba1d[_0xb396('0x18')]),_0x4546d1);}});ami['on']('agentcalled',function(_0x10fc81){try{utils[_0xb396('0x1a')](util['format'](_0xb396('0x1b'),_0x10fc81[_0xb396('0x1c')]),_0x10fc81);agents[_0xb396('0x1d')](_0x10fc81);}catch(_0x1c06c3){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x1b'),_0x10fc81['uniqueid']),_0x1c06c3);}});ami['on'](_0xb396('0x1e'),function(_0x7ed0b3){try{utils['debug'](util[_0xb396('0x17')]('[%s][index][agentringnoanswer]',_0x7ed0b3[_0xb396('0x1c')]),_0x7ed0b3);agents['agentringnoanswer'](_0x7ed0b3);}catch(_0x109228){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x1f'),_0x7ed0b3[_0xb396('0x1c')]),_0x109228);}});ami['on']('agentconnect',function(_0x2fc3bc){try{utils[_0xb396('0x1a')](util[_0xb396('0x17')](_0xb396('0x20'),_0x2fc3bc[_0xb396('0x1c')]),_0x2fc3bc);agents[_0xb396('0x21')](_0x2fc3bc);queues[_0xb396('0x21')](_0x2fc3bc);}catch(_0x31bb94){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x20'),_0x2fc3bc[_0xb396('0x1c')]),_0x31bb94);}});ami['on'](_0xb396('0x22'),function(_0x332a38){try{utils[_0xb396('0x1a')](util[_0xb396('0x17')]('[%s][index][agentcomplete]',_0x332a38[_0xb396('0x1c')]),_0x332a38);agents[_0xb396('0x22')](_0x332a38);queues[_0xb396('0x22')](_0x332a38);members[_0xb396('0x22')](_0x332a38);}catch(_0x19359a){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x23'),_0x332a38[_0xb396('0x1c')]),_0x19359a);}});ami['on'](_0xb396('0x24'),function(_0x42122d){try{utils[_0xb396('0x1a')](util[_0xb396('0x17')]('[%s][index][queuecallerabandon]',_0x42122d[_0xb396('0x1c')]),_0x42122d);agents[_0xb396('0x24')](_0x42122d);queues[_0xb396('0x24')](_0x42122d);}catch(_0x5ba68c){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x25'),_0x42122d[_0xb396('0x1c')]),_0x5ba68c);}});ami['on'](_0xb396('0x26'),function(_0xd0f8d8){try{utils[_0xb396('0x1a')](util[_0xb396('0x17')](_0xb396('0x27'),_0xd0f8d8['uniqueid']),_0xd0f8d8);queues[_0xb396('0x26')](_0xd0f8d8);recordings[_0xb396('0x26')](_0xd0f8d8);}catch(_0x452cdb){utils[_0xb396('0x14')](util['format'](_0xb396('0x27'),_0xd0f8d8[_0xb396('0x1c')]),_0x452cdb);}});ami['on'](_0xb396('0x28'),function(_0x503548){try{utils['debug'](util['format'](_0xb396('0x29'),_0x503548[_0xb396('0x1c')]),_0x503548);queues[_0xb396('0x28')](_0x503548);}catch(_0x29e78c){utils[_0xb396('0x14')](util['format'](_0xb396('0x29'),_0x503548[_0xb396('0x1c')]),_0x29e78c);}});ami['on'](_0xb396('0x2a'),function(_0x289636){try{utils[_0xb396('0x1a')](util['format'](_0xb396('0x2b'),_0x289636[_0xb396('0x1c')]),_0x289636);queues[_0xb396('0x2a')](_0x289636);calls[_0xb396('0x2a')](_0x289636);}catch(_0x44e2a2){utils[_0xb396('0x14')](util[_0xb396('0x17')]('[%s][index][musiconholdstart]',_0x289636[_0xb396('0x1c')]),_0x44e2a2);}});ami['on'](_0xb396('0x2c'),function(_0x33fa62){try{utils[_0xb396('0x1a')](util[_0xb396('0x17')](_0xb396('0x2d'),_0x33fa62['uniqueid']),_0x33fa62);queues[_0xb396('0x2c')](_0x33fa62);calls['musiconholdstop'](_0x33fa62);}catch(_0x500b06){utils[_0xb396('0x14')](util[_0xb396('0x17')]('[%s][index][musiconholdstop]',_0x33fa62[_0xb396('0x1c')]),_0x500b06);}});ami['on'](_0xb396('0x2e'),function(_0x12851b){try{utils['debug'](util[_0xb396('0x17')]('[%s][index][newstate]',_0x12851b[_0xb396('0x1c')]),_0x12851b);calls[_0xb396('0x2e')](_0x12851b);recordings[_0xb396('0x2e')](_0x12851b);}catch(_0x1a8ede){utils['error'](util[_0xb396('0x17')](_0xb396('0x2f'),_0x12851b['uniqueid']),_0x1a8ede);}});ami['on'](_0xb396('0x30'),function(_0x48ac4c){try{utils[_0xb396('0x1a')](util[_0xb396('0x17')](_0xb396('0x31'),_0x48ac4c[_0xb396('0x1c')]),_0x48ac4c);calls[_0xb396('0x30')](_0x48ac4c);recordings[_0xb396('0x30')](_0x48ac4c);dials[_0xb396('0x30')](_0x48ac4c);agents[_0xb396('0x30')](_0x48ac4c);queues['hangup'](_0x48ac4c);}catch(_0x4c7a09){utils['error'](util['format'](_0xb396('0x31'),_0x48ac4c[_0xb396('0x1c')]),_0x4c7a09);}});ami['on'](_0xb396('0x32'),function(_0x33666f){try{utils['debug'](util[_0xb396('0x17')](_0xb396('0x33'),_0x33666f[_0xb396('0x1c')]),_0x33666f);members['cdr'](_0x33666f);}catch(_0x5874d7){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x33'),_0x33666f['uniqueid']),_0x5874d7);}});ami['on']('blindtransfer',function(_0x13f5d5){try{utils[_0xb396('0x1a')](util[_0xb396('0x17')](_0xb396('0x34'),_0x13f5d5['uniqueid']),_0x13f5d5);queues[_0xb396('0x35')](_0x13f5d5);agents[_0xb396('0x35')](_0x13f5d5);transfers[_0xb396('0x35')](_0x13f5d5);}catch(_0x5adfbb){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x34'),_0x13f5d5[_0xb396('0x1c')]),_0x5adfbb);}});ami['on'](_0xb396('0x36'),function(_0x230429){try{utils['debug'](util[_0xb396('0x17')](_0xb396('0x37'),_0x230429[_0xb396('0x38')]),_0x230429);queues['attendedtransfer'](_0x230429);transfers['attendedtransfer'](_0x230429);agents[_0xb396('0x36')](_0x230429);calls[_0xb396('0x36')](_0x230429);}catch(_0x15a335){utils['error'](util[_0xb396('0x17')](_0xb396('0x37'),_0x230429[_0xb396('0x38')]),_0x15a335);}});ami['on'](_0xb396('0x39'),function(_0x39648f){try{utils[_0xb396('0x1a')](util['format'](_0xb396('0x3a'),_0x39648f[_0xb396('0x1c')]),_0x39648f);queues[_0xb396('0x39')](_0x39648f);recordings['varset'](_0x39648f);calls[_0xb396('0x39')](_0x39648f);dials[_0xb396('0x39')](_0x39648f);}catch(_0x12bf4c){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x3a'),_0x39648f[_0xb396('0x1c')]),_0x12bf4c);}});ami['on'](_0xb396('0x3b'),function(_0x6401df){try{utils[_0xb396('0x1a')](util['format'](_0xb396('0x3c'),_0x6401df[_0xb396('0x1c')]),_0x6401df);calls['newexten'](_0x6401df);recordings['newexten'](_0x6401df);dials[_0xb396('0x3b')](_0x6401df);}catch(_0x40fbd7){utils[_0xb396('0x14')](util[_0xb396('0x17')]('[%s][index][newexten]',_0x6401df['uniqueid']),_0x40fbd7);}});ami['on'](_0xb396('0x3d'),function(_0x2dc4b6){try{utils[_0xb396('0x1a')](util[_0xb396('0x17')](_0xb396('0x3e'),_0x2dc4b6[_0xb396('0x1c')]),_0x2dc4b6);calls[_0xb396('0x3d')](_0x2dc4b6);recordings[_0xb396('0x3d')](_0x2dc4b6);}catch(_0x34ecde){utils[_0xb396('0x14')](util[_0xb396('0x17')](_0xb396('0x3e'),_0x2dc4b6[_0xb396('0x1c')]),_0x34ecde);}});ami['on'](_0xb396('0x3f'),function(_0x208645){try{utils['debug'](util[_0xb396('0x17')](_0xb396('0x40'),_0x208645[_0xb396('0x1c')]),_0x208645);dials[_0xb396('0x3f')](_0x208645);}catch(_0x3ba28e){utils['error'](util[_0xb396('0x17')](_0xb396('0x41'),_0x208645['uniqueid']),_0x3ba28e);}});ami['on']('dialend',function(_0x4d0748){try{utils[_0xb396('0x1a')](util['format']('[%s][index][dialend]',_0x4d0748[_0xb396('0x1c')]),_0x4d0748);dials[_0xb396('0x42')](_0x4d0748);}catch(_0x17d166){utils[_0xb396('0x14')](util[_0xb396('0x17')]('[%s][index][dialend]',_0x4d0748['uniqueid']),_0x17d166);}});} \ No newline at end of file +var _0x6fb9=['[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','./utils','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel'];(function(_0x9d0eb0,_0x8b79a0){var _0x29816f=function(_0x1e9057){while(--_0x1e9057){_0x9d0eb0['push'](_0x9d0eb0['shift']());}};_0x29816f(++_0x8b79a0);}(_0x6fb9,0x13a));var _0x96fb=function(_0x49a57f,_0x405f38){_0x49a57f=_0x49a57f-0x0;var _0x2fa2a5=_0x6fb9[_0x49a57f];return _0x2fa2a5;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x96fb('0x0'));var util=require(_0x96fb('0x1'));var ami=new AsteriskManager(config[_0x96fb('0x2')][_0x96fb('0x3')],config[_0x96fb('0x2')]['ip'],config[_0x96fb('0x2')][_0x96fb('0x4')],config[_0x96fb('0x2')][_0x96fb('0x5')],!![]);ami[_0x96fb('0x6')]();if(config[_0x96fb('0x7')]&&config[_0x96fb('0x7')][_0x96fb('0x8')]){utils[_0x96fb('0x9')](_0x96fb('0xa'));}else{var agents=require(_0x96fb('0xb'));var calls=require(_0x96fb('0xc'));var queues=require(_0x96fb('0xd'));var recordings=require(_0x96fb('0xe'));var members=require(_0x96fb('0xf'));var dials=require('./dials.controller');var transfers=require(_0x96fb('0x10'));var core=require(_0x96fb('0x11'));ami['on'](_0x96fb('0x12'),core[_0x96fb('0x12')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x96fb('0x13'),core[_0x96fb('0x13')]);ami['on'](_0x96fb('0x14'),core[_0x96fb('0x14')]);ami['on'](_0x96fb('0x15'),core[_0x96fb('0x15')]);ami['on'](_0x96fb('0x16'),core[_0x96fb('0x16')]);ami['on'](_0x96fb('0x17'),function(_0x18a69a){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')]('[%s][index][devicestatechange]',_0x18a69a[_0x96fb('0x1a')]),_0x18a69a);members[_0x96fb('0x17')](_0x18a69a);}catch(_0x1235ba){utils[_0x96fb('0x14')](util[_0x96fb('0x19')]('[%s][index][devicestatechange]',_0x18a69a[_0x96fb('0x1a')]),_0x1235ba);}});ami['on'](_0x96fb('0x1b'),function(_0x3b604b){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')]('[%s][index][agentcalled]',_0x3b604b[_0x96fb('0x1c')]),_0x3b604b);agents[_0x96fb('0x1b')](_0x3b604b);}catch(_0x4f2f70){utils[_0x96fb('0x14')](util[_0x96fb('0x19')]('[%s][index][agentcalled]',_0x3b604b[_0x96fb('0x1c')]),_0x4f2f70);}});ami['on'](_0x96fb('0x1d'),function(_0x5826a0){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')](_0x96fb('0x1e'),_0x5826a0[_0x96fb('0x1c')]),_0x5826a0);agents['agentringnoanswer'](_0x5826a0);}catch(_0x41fb24){utils[_0x96fb('0x14')](util['format'](_0x96fb('0x1e'),_0x5826a0[_0x96fb('0x1c')]),_0x41fb24);}});ami['on'](_0x96fb('0x1f'),function(_0x24aced){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')]('[%s][index][agentconnect]',_0x24aced[_0x96fb('0x1c')]),_0x24aced);agents[_0x96fb('0x1f')](_0x24aced);queues[_0x96fb('0x1f')](_0x24aced);}catch(_0x516934){utils[_0x96fb('0x14')](util[_0x96fb('0x19')](_0x96fb('0x20'),_0x24aced[_0x96fb('0x1c')]),_0x516934);}});ami['on'](_0x96fb('0x21'),function(_0x36d74a){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')]('[%s][index][agentcomplete]',_0x36d74a[_0x96fb('0x1c')]),_0x36d74a);agents[_0x96fb('0x21')](_0x36d74a);queues[_0x96fb('0x21')](_0x36d74a);members[_0x96fb('0x21')](_0x36d74a);}catch(_0x5aec97){utils['error'](util[_0x96fb('0x19')]('[%s][index][agentcomplete]',_0x36d74a[_0x96fb('0x1c')]),_0x5aec97);}});ami['on'](_0x96fb('0x22'),function(_0x639df6){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')](_0x96fb('0x23'),_0x639df6[_0x96fb('0x1c')]),_0x639df6);agents[_0x96fb('0x22')](_0x639df6);queues[_0x96fb('0x22')](_0x639df6);}catch(_0x3c46fc){utils['error'](util[_0x96fb('0x19')](_0x96fb('0x23'),_0x639df6[_0x96fb('0x1c')]),_0x3c46fc);}});ami['on'](_0x96fb('0x24'),function(_0x555549){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')](_0x96fb('0x25'),_0x555549[_0x96fb('0x1c')]),_0x555549);queues[_0x96fb('0x24')](_0x555549);recordings[_0x96fb('0x24')](_0x555549);}catch(_0x164d4c){utils[_0x96fb('0x14')](util[_0x96fb('0x19')](_0x96fb('0x25'),_0x555549['uniqueid']),_0x164d4c);}});ami['on']('queuecallerleave',function(_0xe1f92f){try{utils['debug'](util['format'](_0x96fb('0x26'),_0xe1f92f['uniqueid']),_0xe1f92f);queues[_0x96fb('0x27')](_0xe1f92f);}catch(_0x2ec619){utils[_0x96fb('0x14')](util[_0x96fb('0x19')](_0x96fb('0x26'),_0xe1f92f[_0x96fb('0x1c')]),_0x2ec619);}});ami['on'](_0x96fb('0x28'),function(_0x40992b){try{utils[_0x96fb('0x18')](util['format'](_0x96fb('0x29'),_0x40992b['uniqueid']),_0x40992b);queues[_0x96fb('0x28')](_0x40992b);calls['musiconholdstart'](_0x40992b);}catch(_0x349050){utils['error'](util[_0x96fb('0x19')](_0x96fb('0x29'),_0x40992b[_0x96fb('0x1c')]),_0x349050);}});ami['on'](_0x96fb('0x2a'),function(_0x25c2aa){try{utils[_0x96fb('0x18')](util['format']('[%s][index][musiconholdstop]',_0x25c2aa[_0x96fb('0x1c')]),_0x25c2aa);queues['musiconholdstop'](_0x25c2aa);calls['musiconholdstop'](_0x25c2aa);}catch(_0x59a8b0){utils['error'](util[_0x96fb('0x19')](_0x96fb('0x2b'),_0x25c2aa[_0x96fb('0x1c')]),_0x59a8b0);}});ami['on'](_0x96fb('0x2c'),function(_0x4eaaae){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')](_0x96fb('0x2d'),_0x4eaaae[_0x96fb('0x1c')]),_0x4eaaae);calls[_0x96fb('0x2c')](_0x4eaaae);recordings[_0x96fb('0x2c')](_0x4eaaae);}catch(_0x499b81){utils[_0x96fb('0x14')](util[_0x96fb('0x19')](_0x96fb('0x2d'),_0x4eaaae[_0x96fb('0x1c')]),_0x499b81);}});ami['on']('hangup',function(_0x4b66d0){try{utils['debug'](util['format'](_0x96fb('0x2e'),_0x4b66d0['uniqueid']),_0x4b66d0);calls[_0x96fb('0x2f')](_0x4b66d0);recordings[_0x96fb('0x2f')](_0x4b66d0);dials[_0x96fb('0x2f')](_0x4b66d0);agents['hangup'](_0x4b66d0);queues[_0x96fb('0x2f')](_0x4b66d0);}catch(_0x1b652f){utils[_0x96fb('0x14')](util['format'](_0x96fb('0x2e'),_0x4b66d0[_0x96fb('0x1c')]),_0x1b652f);}});ami['on'](_0x96fb('0x30'),function(_0x500950){try{utils[_0x96fb('0x18')](util['format']('[%s][index][cdr]',_0x500950[_0x96fb('0x1c')]),_0x500950);members[_0x96fb('0x30')](_0x500950);}catch(_0xbd64f5){utils[_0x96fb('0x14')](util[_0x96fb('0x19')]('[%s][index][cdr]',_0x500950[_0x96fb('0x1c')]),_0xbd64f5);}});ami['on'](_0x96fb('0x31'),function(_0x18cc64){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')]('[%s][index][blindtransfer]',_0x18cc64['uniqueid']),_0x18cc64);queues[_0x96fb('0x31')](_0x18cc64);agents[_0x96fb('0x31')](_0x18cc64);transfers[_0x96fb('0x31')](_0x18cc64);}catch(_0x126f89){utils['error'](util['format'](_0x96fb('0x32'),_0x18cc64[_0x96fb('0x1c')]),_0x126f89);}});ami['on'](_0x96fb('0x33'),function(_0x3b039d){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')](_0x96fb('0x34'),_0x3b039d[_0x96fb('0x35')]),_0x3b039d);queues[_0x96fb('0x33')](_0x3b039d);transfers[_0x96fb('0x33')](_0x3b039d);agents[_0x96fb('0x33')](_0x3b039d);calls[_0x96fb('0x33')](_0x3b039d);}catch(_0x5fcc2){utils[_0x96fb('0x14')](util[_0x96fb('0x19')](_0x96fb('0x34'),_0x3b039d[_0x96fb('0x35')]),_0x5fcc2);}});ami['on'](_0x96fb('0x36'),function(_0x474d10){try{utils[_0x96fb('0x18')](util[_0x96fb('0x19')]('[%s][index][varset]',_0x474d10[_0x96fb('0x1c')]),_0x474d10);queues[_0x96fb('0x36')](_0x474d10);recordings[_0x96fb('0x36')](_0x474d10);calls[_0x96fb('0x36')](_0x474d10);dials['varset'](_0x474d10);}catch(_0x389f44){utils[_0x96fb('0x14')](util['format']('[%s][index][varset]',_0x474d10[_0x96fb('0x1c')]),_0x389f44);}});ami['on'](_0x96fb('0x37'),function(_0x2a3cb4){try{utils[_0x96fb('0x18')](util['format'](_0x96fb('0x38'),_0x2a3cb4[_0x96fb('0x1c')]),_0x2a3cb4);calls[_0x96fb('0x37')](_0x2a3cb4);recordings['newexten'](_0x2a3cb4);dials['newexten'](_0x2a3cb4);}catch(_0x30df20){utils[_0x96fb('0x14')](util[_0x96fb('0x19')]('[%s][index][newexten]',_0x2a3cb4['uniqueid']),_0x30df20);}});ami['on'](_0x96fb('0x39'),function(_0x39a3e8){try{utils[_0x96fb('0x18')](util['format'](_0x96fb('0x3a'),_0x39a3e8[_0x96fb('0x1c')]),_0x39a3e8);calls[_0x96fb('0x39')](_0x39a3e8);recordings[_0x96fb('0x39')](_0x39a3e8);}catch(_0x48c746){utils['error'](util[_0x96fb('0x19')](_0x96fb('0x3a'),_0x39a3e8[_0x96fb('0x1c')]),_0x48c746);}});ami['on']('dialbegin',function(_0x208b31){try{utils[_0x96fb('0x18')](util['format']('[%s][index][dialbegin]',_0x208b31['uniqueid']),_0x208b31);dials[_0x96fb('0x3b')](_0x208b31);}catch(_0x21a77e){utils[_0x96fb('0x14')](util[_0x96fb('0x19')]('[%s]dialbegin',_0x208b31['uniqueid']),_0x21a77e);}});ami['on'](_0x96fb('0x3c'),function(_0x18aa76){try{utils['debug'](util['format'](_0x96fb('0x3d'),_0x18aa76[_0x96fb('0x1c')]),_0x18aa76);dials[_0x96fb('0x3c')](_0x18aa76);}catch(_0x23b995){utils[_0x96fb('0x14')](util['format']('[%s][index][dialend]',_0x18aa76[_0x96fb('0x1c')]),_0x23b995);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a0d0a23..3c1325d 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 _0x386c=['voice','agent','isNil','exitAt','now','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','data1','source','data3','destination','destinationchannel','assign','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','util','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE'];(function(_0x2abd9f,_0x48a559){var _0x257cd3=function(_0x37d76b){while(--_0x37d76b){_0x2abd9f['push'](_0x2abd9f['shift']());}};_0x257cd3(++_0x48a559);}(_0x386c,0x103));var _0xc386=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x386c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc386('0x0'));var util=require(_0xc386('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x1cfd82){utils['info'](util[_0xc386('0x2')](_0xc386('0x3'),_0x1cfd82[_0xc386('0x4')],_0x1cfd82[_0xc386('0x5')],_0x1cfd82[_0xc386('0x6')],_0x1cfd82[_0xc386('0x7')],_0x1cfd82[_0xc386('0x8')],_0x1cfd82[_0xc386('0x9')]));if(_0x1cfd82[_0xc386('0x5')]){utils[_0xc386('0xa')](_0x1cfd82[_0xc386('0x5')])[_0xc386('0xb')](function(_0x2d249c){if(_0x2d249c){_0x1cfd82['membername']=_0x2d249c[_0xc386('0xc')];_0x1cfd82['internal']=_0x2d249c[_0xc386('0xd')];utils['request']('CreateMemberReport',_0x1cfd82);}else{utils[_0xc386('0xe')](_0x1cfd82[_0xc386('0x5')][_0xc386('0xf')]('/')[0x1])['then'](function(_0x8017b5){if(_0x8017b5){_0x1cfd82['membername']=_0x8017b5[_0xc386('0xc')];_0x1cfd82['internal']=_0x8017b5[_0xc386('0xd')];utils['request'](_0xc386('0x10'),_0x1cfd82);}});}})[_0xc386('0x11')](function(_0x110e51){utils[_0xc386('0x12')](util[_0xc386('0x2')](_0xc386('0x13'),_0x1cfd82['uniqueid']),_0x110e51);});}delete members[_0x1cfd82[_0xc386('0x5')]];}function startsWith(_0x336e63,_0x5c948){return _[_0xc386('0x14')](_0x336e63,function(_0x4137f1){return _['startsWith'](_0x5c948,_0x4137f1);});}exports[_0xc386('0x15')]=function(_0x2f637c){try{utils[_0xc386('0x16')](util[_0xc386('0x2')](_0xc386('0x17'),members[_0x2f637c[_0xc386('0x18')]]?members[_0x2f637c[_0xc386('0x18')]][_0xc386('0x4')]:_0x2f637c[_0xc386('0x18')]),_0x2f637c);utils[_0xc386('0x19')](util['format'](_0xc386('0x1a'),members[_0x2f637c['device']]?members[_0x2f637c[_0xc386('0x18')]][_0xc386('0x4')]:_0x2f637c['device'],_0x2f637c[_0xc386('0x1b')],_0x2f637c[_0xc386('0x18')]));switch(_0x2f637c[_0xc386('0x1b')]){case _0xc386('0x1c'):case'BUSY':if(!startsWith(exclude,_0x2f637c[_0xc386('0x18')])){members[_0x2f637c['device']]={'channel':_0xc386('0x1d'),'interface':_0x2f637c[_0xc386('0x18')],'type':'TALKING','enterAt':utils['now'](),'role':_0xc386('0x1e')};}break;case'NOT_INUSE':if(!_[_0xc386('0x1f')](members[_0x2f637c['device']])){members[_0x2f637c[_0xc386('0x18')]][_0xc386('0x20')]=utils[_0xc386('0x21')]();members[_0x2f637c[_0xc386('0x18')]]['duration']=utils[_0xc386('0x22')](members[_0x2f637c[_0xc386('0x18')]][_0xc386('0x20')],members[_0x2f637c[_0xc386('0x18')]]['enterAt']);if(members[_0x2f637c['device']]['uniqueid']){writeDB(members[_0x2f637c['device']]);}}break;default:break;}}catch(_0x162809){utils[_0xc386('0x12')](util[_0xc386('0x2')](_0xc386('0x17'),members[_0x2f637c[_0xc386('0x18')]]?members[_0x2f637c[_0xc386('0x18')]][_0xc386('0x4')]:_0x2f637c[_0xc386('0x18')]),_0x162809);}};exports[_0xc386('0x23')]=function(_0x31fe8c){try{if(!_[_0xc386('0x1f')](members[_0x31fe8c[_0xc386('0x5')]])){utils[_0xc386('0x16')](util[_0xc386('0x2')](_0xc386('0x24'),_0x31fe8c[_0xc386('0x4')]),_0x31fe8c);utils[_0xc386('0x19')](util[_0xc386('0x2')](_0xc386('0x25'),_0x31fe8c[_0xc386('0x4')],_0x31fe8c[_0xc386('0x5')],_0x31fe8c[_0xc386('0x26')]));members[_0x31fe8c['interface']]=_['assign'](members[_0x31fe8c[_0xc386('0x5')]],{'data4':_0x31fe8c['queue'],'uniqueid':_0x31fe8c['uniqueid']});}}catch(_0x164a08){utils[_0xc386('0x12')](util[_0xc386('0x2')](_0xc386('0x24'),_0x31fe8c[_0xc386('0x4')]),_0x164a08);}};exports[_0xc386('0x27')]=function(_0x1d4d8f){try{utils[_0xc386('0x16')](util[_0xc386('0x2')]('[%s][members][cdr]',_0x1d4d8f[_0xc386('0x4')]),_0x1d4d8f);if(_0x1d4d8f[_0xc386('0x6')]){var _0x357f93=_0x1d4d8f[_0xc386('0x6')]['split']('-')[0x0];if(!_[_0xc386('0x1f')](members[_0x357f93])){members[_0x357f93]=_['assign'](members[_0x357f93],{'data1':members[_0x357f93][_0xc386('0x28')]||_0x1d4d8f['type'],'data2':members[_0x357f93][_0xc386('0x7')]||_0x1d4d8f[_0xc386('0x29')],'data3':members[_0x357f93][_0xc386('0x2a')]||_0x1d4d8f[_0xc386('0x2b')],'uniqueid':members[_0x357f93][_0xc386('0x4')]||_0x1d4d8f[_0xc386('0x4')]});utils[_0xc386('0x19')](util[_0xc386('0x2')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1d4d8f[_0xc386('0x4')],members[_0x357f93]['data1'],members[_0x357f93][_0xc386('0x7')],members[_0x357f93][_0xc386('0x2a')]));if(members[_0x357f93][_0xc386('0x20')]){writeDB(members[_0x357f93]);}}}if(_0x1d4d8f[_0xc386('0x2c')]){var _0x16b4fb=_0x1d4d8f['destinationchannel'][_0xc386('0xf')]('-')[0x0];if(!_[_0xc386('0x1f')](members[_0x16b4fb])){members[_0x16b4fb]=_[_0xc386('0x2d')](members[_0x16b4fb],{'data1':members[_0x16b4fb]['data1']||_0x1d4d8f[_0xc386('0x9')],'data2':members[_0x16b4fb]['data2']||_0x1d4d8f['source'],'data3':members[_0x16b4fb]['data3']||_0x1d4d8f[_0xc386('0x2b')],'uniqueid':members[_0x16b4fb]['uniqueid']||_0x1d4d8f[_0xc386('0x4')]});utils[_0xc386('0x19')](util['format'](_0xc386('0x2e'),_0x1d4d8f[_0xc386('0x4')],members[_0x16b4fb]['data1'],members[_0x16b4fb][_0xc386('0x7')],members[_0x16b4fb]['data3']));if(members[_0x16b4fb][_0xc386('0x20')]){writeDB(members[_0x16b4fb]);}}}}catch(_0x4d3912){utils[_0xc386('0x12')](util[_0xc386('0x2')](_0xc386('0x2f'),_0x1d4d8f[_0xc386('0x4')]),_0x4d3912);}}; \ No newline at end of file +var _0x9992=['CreateMemberReport','getUserByName','catch','error','uniqueid','some','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','agent','NOT_INUSE','now','duration','diffTime','exitAt','enterAt','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][cdr]','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data2','destinationchannel','split','lodash','./utils','info','format','interface','channel','membername','then','name','internal','request'];(function(_0x249fac,_0x2afcd3){var _0x5f14c4=function(_0x394e1e){while(--_0x394e1e){_0x249fac['push'](_0x249fac['shift']());}};_0x5f14c4(++_0x2afcd3);}(_0x9992,0x13e));var _0x2999=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0x9992[_0x41e8c4];return _0x54ffbe;};'use strict';var _=require(_0x2999('0x0'));var util=require('util');var utils=require(_0x2999('0x1'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x54d74){utils[_0x2999('0x2')](util[_0x2999('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x54d74['uniqueid'],_0x54d74[_0x2999('0x4')],_0x54d74[_0x2999('0x5')],_0x54d74['data2'],_0x54d74[_0x2999('0x6')],_0x54d74['type']));if(_0x54d74['interface']){utils['getUserByInterface'](_0x54d74[_0x2999('0x4')])[_0x2999('0x7')](function(_0x551270){if(_0x551270){_0x54d74[_0x2999('0x6')]=_0x551270[_0x2999('0x8')];_0x54d74[_0x2999('0x9')]=_0x551270[_0x2999('0x9')];utils[_0x2999('0xa')](_0x2999('0xb'),_0x54d74);}else{utils[_0x2999('0xc')](_0x54d74['interface']['split']('/')[0x1])[_0x2999('0x7')](function(_0x49e4cf){if(_0x49e4cf){_0x54d74['membername']=_0x49e4cf[_0x2999('0x8')];_0x54d74[_0x2999('0x9')]=_0x49e4cf['internal'];utils[_0x2999('0xa')](_0x2999('0xb'),_0x54d74);}});}})[_0x2999('0xd')](function(_0x3f1374){utils[_0x2999('0xe')](util[_0x2999('0x3')]('[%s][members][writeDB]',_0x54d74[_0x2999('0xf')]),_0x3f1374);});}delete members[_0x54d74['interface']];}function startsWith(_0xdaa1fe,_0x221012){return _[_0x2999('0x10')](_0xdaa1fe,function(_0x58ad17){return _['startsWith'](_0x221012,_0x58ad17);});}exports[_0x2999('0x11')]=function(_0x2b6e94){try{utils[_0x2999('0x12')](util[_0x2999('0x3')]('[%s][members][devicestatechange]',members[_0x2b6e94[_0x2999('0x13')]]?members[_0x2b6e94[_0x2999('0x13')]][_0x2999('0xf')]:_0x2b6e94[_0x2999('0x13')]),_0x2b6e94);utils['info'](util[_0x2999('0x3')](_0x2999('0x14'),members[_0x2b6e94[_0x2999('0x13')]]?members[_0x2b6e94[_0x2999('0x13')]][_0x2999('0xf')]:_0x2b6e94[_0x2999('0x13')],_0x2b6e94['state'],_0x2b6e94['device']));switch(_0x2b6e94[_0x2999('0x15')]){case'INUSE':case _0x2999('0x16'):if(!startsWith(exclude,_0x2b6e94[_0x2999('0x13')])){members[_0x2b6e94[_0x2999('0x13')]]={'channel':_0x2999('0x17'),'interface':_0x2b6e94['device'],'type':_0x2999('0x18'),'enterAt':utils['now'](),'role':_0x2999('0x19')};}break;case _0x2999('0x1a'):if(!_['isNil'](members[_0x2b6e94[_0x2999('0x13')]])){members[_0x2b6e94[_0x2999('0x13')]]['exitAt']=utils[_0x2999('0x1b')]();members[_0x2b6e94[_0x2999('0x13')]][_0x2999('0x1c')]=utils[_0x2999('0x1d')](members[_0x2b6e94[_0x2999('0x13')]][_0x2999('0x1e')],members[_0x2b6e94[_0x2999('0x13')]][_0x2999('0x1f')]);if(members[_0x2b6e94[_0x2999('0x13')]]['uniqueid']){writeDB(members[_0x2b6e94['device']]);}}break;default:break;}}catch(_0x365be5){utils[_0x2999('0xe')](util['format']('[%s][members][devicestatechange]',members[_0x2b6e94[_0x2999('0x13')]]?members[_0x2b6e94[_0x2999('0x13')]][_0x2999('0xf')]:_0x2b6e94[_0x2999('0x13')]),_0x365be5);}};exports['agentcomplete']=function(_0x12ed69){try{if(!_[_0x2999('0x20')](members[_0x12ed69['interface']])){utils[_0x2999('0x12')](util[_0x2999('0x3')](_0x2999('0x21'),_0x12ed69[_0x2999('0xf')]),_0x12ed69);utils[_0x2999('0x2')](util[_0x2999('0x3')](_0x2999('0x22'),_0x12ed69[_0x2999('0xf')],_0x12ed69[_0x2999('0x4')],_0x12ed69['queue']));members[_0x12ed69[_0x2999('0x4')]]=_[_0x2999('0x23')](members[_0x12ed69[_0x2999('0x4')]],{'data4':_0x12ed69[_0x2999('0x24')],'uniqueid':_0x12ed69[_0x2999('0xf')]});}}catch(_0x26a007){utils[_0x2999('0xe')](util[_0x2999('0x3')](_0x2999('0x21'),_0x12ed69[_0x2999('0xf')]),_0x26a007);}};exports['cdr']=function(_0x22a6f3){try{utils[_0x2999('0x12')](util[_0x2999('0x3')](_0x2999('0x25'),_0x22a6f3[_0x2999('0xf')]),_0x22a6f3);if(_0x22a6f3[_0x2999('0x5')]){var _0x51129e=_0x22a6f3['channel']['split']('-')[0x0];if(!_[_0x2999('0x20')](members[_0x51129e])){members[_0x51129e]=_[_0x2999('0x23')](members[_0x51129e],{'data1':members[_0x51129e]['data1']||_0x22a6f3[_0x2999('0x26')],'data2':members[_0x51129e]['data2']||_0x22a6f3[_0x2999('0x27')],'data3':members[_0x51129e][_0x2999('0x28')]||_0x22a6f3[_0x2999('0x29')],'uniqueid':members[_0x51129e][_0x2999('0xf')]||_0x22a6f3['uniqueid']});utils[_0x2999('0x2')](util['format'](_0x2999('0x2a'),_0x22a6f3[_0x2999('0xf')],members[_0x51129e][_0x2999('0x2b')],members[_0x51129e][_0x2999('0x2c')],members[_0x51129e][_0x2999('0x28')]));if(members[_0x51129e][_0x2999('0x1e')]){writeDB(members[_0x51129e]);}}}if(_0x22a6f3['destinationchannel']){var _0x3b70c4=_0x22a6f3[_0x2999('0x2d')][_0x2999('0x2e')]('-')[0x0];if(!_[_0x2999('0x20')](members[_0x3b70c4])){members[_0x3b70c4]=_[_0x2999('0x23')](members[_0x3b70c4],{'data1':members[_0x3b70c4][_0x2999('0x2b')]||_0x22a6f3[_0x2999('0x26')],'data2':members[_0x3b70c4][_0x2999('0x2c')]||_0x22a6f3[_0x2999('0x27')],'data3':members[_0x3b70c4][_0x2999('0x28')]||_0x22a6f3[_0x2999('0x29')],'uniqueid':members[_0x3b70c4][_0x2999('0xf')]||_0x22a6f3[_0x2999('0xf')]});utils[_0x2999('0x2')](util[_0x2999('0x3')](_0x2999('0x2a'),_0x22a6f3['uniqueid'],members[_0x3b70c4][_0x2999('0x2b')],members[_0x3b70c4]['data2'],members[_0x3b70c4]['data3']));if(members[_0x3b70c4][_0x2999('0x1e')]){writeDB(members[_0x3b70c4]);}}}}catch(_0x1e60c9){utils[_0x2999('0xe')](util[_0x2999('0x3')](_0x2999('0x25'),_0x22a6f3[_0x2999('0xf')]),_0x1e60c9);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index cfa113f..508dead 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 _0xd509=['queue','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','position','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','uniqueid','channel','lastAssignedTo','calleridnum','accountcode'];(function(_0x549fc2,_0x3e3d6c){var _0x2c9d8d=function(_0xae9b2a){while(--_0xae9b2a){_0x549fc2['push'](_0x549fc2['shift']());}};_0x2c9d8d(++_0x3e3d6c);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9d50('0x0'));var queues={};function writeDB(_0x6d0d62){utils[_0x9d50('0x1')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x6d0d62[_0x9d50('0x2')],_0x6d0d62[_0x9d50('0x3')],_0x6d0d62['queue'],_0x6d0d62[_0x9d50('0x4')],_0x6d0d62[_0x9d50('0x5')],_0x6d0d62[_0x9d50('0x6')],_0x6d0d62['queuecallerexitreason']));if(_0x6d0d62[_0x9d50('0x7')]){utils['getVoiceQueueByName'](_0x6d0d62[_0x9d50('0x7')])[_0x9d50('0x8')](function(_0x2f7c2f){if(_0x2f7c2f){_0x6d0d62[_0x9d50('0x9')]=_0x2f7c2f[_0x9d50('0x9')];}utils['request'](_0x9d50('0xa'),_0x6d0d62);});}else{utils['request']('CreateVoiceQueueReport',_0x6d0d62);}if(_0x6d0d62[_0x9d50('0xb')]){delete queues[_0x6d0d62['transfereduniqueid']];}else{delete queues[_0x6d0d62[_0x9d50('0x2')]];}}exports[_0x9d50('0xc')]=function(_0x457c24){try{utils[_0x9d50('0xd')](util[_0x9d50('0xe')](_0x9d50('0xf'),_0x457c24[_0x9d50('0x2')]),_0x457c24);utils['info'](util[_0x9d50('0xe')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x457c24[_0x9d50('0x2')],_0x457c24[_0x9d50('0x7')],_0x457c24[_0x9d50('0x10')]));queues[_0x457c24[_0x9d50('0x2')]]=_[_0x9d50('0x11')](_0x457c24,{'originalposition':_0x457c24[_0x9d50('0x10')],'queuecallerjoinAt':utils[_0x9d50('0x12')](),'mohtime':0x0});}catch(_0x3c115b){utils[_0x9d50('0x13')](util[_0x9d50('0xe')](_0x9d50('0xf'),_0x457c24[_0x9d50('0x2')]),_0x3c115b);}};exports['hangup']=function(_0x12d178){try{if(!_[_0x9d50('0x14')](queues[_0x12d178[_0x9d50('0x2')]])){utils[_0x9d50('0xd')](util[_0x9d50('0xe')](_0x9d50('0x15'),_0x12d178[_0x9d50('0x2')]),_0x12d178);if(queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0x16')]){if(!queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0x17')]&&!queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0x18')]){queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0x19')]=!![];queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0x1a')]=utils[_0x9d50('0x12')]();queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0x1b')]=_0x9d50('0x1c');}utils[_0x9d50('0x1')](util[_0x9d50('0xe')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x12d178[_0x9d50('0x2')],queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0x1d')],queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0x1b')]));writeDB(queues[_0x12d178[_0x9d50('0x2')]]);}else if(queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0xb')]){utils[_0x9d50('0x1')](util['format'](_0x9d50('0x1e'),_0x12d178['uniqueid'],queues[_0x12d178['uniqueid']][_0x9d50('0x1d')],queues[_0x12d178[_0x9d50('0x2')]][_0x9d50('0xb')]));queues[queues[_0x12d178[_0x9d50('0x2')]]['transfereduniqueid']]=queues[_0x12d178[_0x9d50('0x2')]];queues[queues[_0x12d178[_0x9d50('0x2')]]['transfereduniqueid']][_0x9d50('0x1f')]=0x2;delete queues[_0x12d178['uniqueid']];}}}catch(_0x42fe92){utils[_0x9d50('0x13')](util[_0x9d50('0xe')]('[%s][queues][hangup]',_0x12d178[_0x9d50('0x2')]),_0x42fe92);}};exports['varset']=function(_0x1d5a64){try{utils[_0x9d50('0xd')](util[_0x9d50('0xe')](_0x9d50('0x20'),_0x1d5a64[_0x9d50('0x2')]),_0x1d5a64);if(!_[_0x9d50('0x14')](_0x1d5a64[_0x9d50('0x21')][_0x9d50('0x22')])&&_0x1d5a64[_0x9d50('0x23')]['toUpperCase']()!==_0x9d50('0x24')){if(!_['isNil'](queues[_0x1d5a64['uniqueid']])){queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x17')]=![];queues[_0x1d5a64[_0x9d50('0x2')]]['queuecallerabandonAt']=null;queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x18')]=!![];queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x25')]=utils[_0x9d50('0x12')]();queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x1b')]=_0x1d5a64[_0x9d50('0x23')][_0x9d50('0x26')]();utils[_0x9d50('0x1')](util[_0x9d50('0xe')](_0x9d50('0x27'),_0x1d5a64[_0x9d50('0x2')],queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x1d')],_0x1d5a64['value'],queues[_0x1d5a64[_0x9d50('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x1d5a64[_0x9d50('0x2')]]);}}else if(!_['isNil'](_0x1d5a64[_0x9d50('0x21')][_0x9d50('0x28')])){if(!_[_0x9d50('0x14')](queues[_0x1d5a64[_0x9d50('0x2')]])&&!queues[_0x1d5a64[_0x9d50('0x2')]]['queuecallerabandon']){queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x17')]=![];queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x29')]=null;queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x18')]=!![];queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x25')]=utils['now']();queues[_0x1d5a64[_0x9d50('0x2')]]['queuecallerexitreason']=_0x9d50('0x2a');utils[_0x9d50('0x1')](util[_0x9d50('0xe')](_0x9d50('0x2b'),_0x1d5a64[_0x9d50('0x2')],queues[_0x1d5a64[_0x9d50('0x2')]]['name'],_0x1d5a64['value'],queues[_0x1d5a64[_0x9d50('0x2')]][_0x9d50('0x1b')]));}}}catch(_0x365700){utils[_0x9d50('0x13')](util[_0x9d50('0xe')](_0x9d50('0x20'),_0x1d5a64[_0x9d50('0x2')]),_0x365700);}};exports[_0x9d50('0x17')]=function(_0x70da6){try{if(!_[_0x9d50('0x14')](queues[_0x70da6[_0x9d50('0x2')]])){utils['debug'](util[_0x9d50('0xe')](_0x9d50('0x2c'),_0x70da6['uniqueid']),_0x70da6);queues[_0x70da6[_0x9d50('0x2')]][_0x9d50('0x18')]=![];queues[_0x70da6[_0x9d50('0x2')]][_0x9d50('0x25')]=null;queues[_0x70da6[_0x9d50('0x2')]][_0x9d50('0x17')]=!![];queues[_0x70da6[_0x9d50('0x2')]]['queuecallerabandonAt']=utils['now']();queues[_0x70da6['uniqueid']][_0x9d50('0x1b')]=_0x9d50('0x2d');utils[_0x9d50('0x1')](util[_0x9d50('0xe')](_0x9d50('0x2e'),_0x70da6['uniqueid'],queues[_0x70da6['uniqueid']][_0x9d50('0x1d')],queues[_0x70da6[_0x9d50('0x2')]][_0x9d50('0x1b')]));}}catch(_0x209225){utils[_0x9d50('0x13')](util[_0x9d50('0xe')](_0x9d50('0x2c'),_0x70da6[_0x9d50('0x2')]),_0x209225);}};exports[_0x9d50('0x2f')]=function(_0x2bbd73){try{if(!_['isNil'](queues[_0x2bbd73[_0x9d50('0x2')]])){utils[_0x9d50('0xd')](util[_0x9d50('0xe')](_0x9d50('0x30'),_0x2bbd73[_0x9d50('0x2')]),_0x2bbd73);utils['info'](util['format'](_0x9d50('0x31'),_0x2bbd73[_0x9d50('0x2')],queues[_0x2bbd73[_0x9d50('0x2')]][_0x9d50('0x1d')],_0x2bbd73[_0x9d50('0x32')],_0x2bbd73['connectedlinename']));queues[_0x2bbd73[_0x9d50('0x2')]][_0x9d50('0x2f')]=!![];queues[_0x2bbd73['uniqueid']][_0x9d50('0x16')]=utils[_0x9d50('0x12')]();queues[_0x2bbd73['uniqueid']]['holdtime']=utils[_0x9d50('0x33')](queues[_0x2bbd73[_0x9d50('0x2')]][_0x9d50('0x16')],queues[_0x2bbd73[_0x9d50('0x2')]]['queuecallerjoinAt']);queues[_0x2bbd73['uniqueid']][_0x9d50('0x10')]=_0x2bbd73['position'];queues[_0x2bbd73['uniqueid']][_0x9d50('0x34')]=_0x2bbd73[_0x9d50('0x34')];queues[_0x2bbd73['uniqueid']]['connectedlinenum']=_0x2bbd73[_0x9d50('0x32')];queues[_0x2bbd73[_0x9d50('0x2')]][_0x9d50('0x35')]=_0x2bbd73['connectedlinename'];}}catch(_0x15131a){utils[_0x9d50('0x13')](util['format'](_0x9d50('0x30'),_0x2bbd73['uniqueid']),_0x15131a);}};exports[_0x9d50('0x36')]=function(_0x48ef01){try{if(!_[_0x9d50('0x14')](queues[_0x48ef01['uniqueid']])){utils[_0x9d50('0xd')](util[_0x9d50('0xe')](_0x9d50('0x37'),_0x48ef01[_0x9d50('0x2')]),_0x48ef01);utils['info'](util[_0x9d50('0xe')](_0x9d50('0x38'),_0x48ef01[_0x9d50('0x2')],queues[_0x48ef01[_0x9d50('0x2')]][_0x9d50('0x1d')],_0x48ef01[_0x9d50('0x39')],_0x48ef01[_0x9d50('0x3a')]));queues[_0x48ef01[_0x9d50('0x2')]][_0x9d50('0x17')]=![];queues[_0x48ef01['uniqueid']]['queuecallerabandon']=![];queues[_0x48ef01[_0x9d50('0x2')]]['queuecallerabandonAt']=null;queues[_0x48ef01[_0x9d50('0x2')]][_0x9d50('0x18')]=![];queues[_0x48ef01['uniqueid']]['queuecallerexitreason']=null;queues[_0x48ef01['uniqueid']][_0x9d50('0x25')]=null;queues[_0x48ef01[_0x9d50('0x2')]][_0x9d50('0x3b')]=!![];queues[_0x48ef01[_0x9d50('0x2')]][_0x9d50('0x6')]=_0x48ef01['destaccountcode'];queues[_0x48ef01[_0x9d50('0x2')]]['lastAssignedTo']=_0x48ef01[_0x9d50('0x39')];}}catch(_0x2ab538){utils[_0x9d50('0x13')](util[_0x9d50('0xe')](_0x9d50('0x37'),_0x48ef01[_0x9d50('0x2')]),_0x2ab538);}};exports['agentcomplete']=function(_0x255593){try{if(!_[_0x9d50('0x14')](queues[_0x255593[_0x9d50('0x2')]])){if(queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x16')]){utils[_0x9d50('0xd')](util[_0x9d50('0xe')](_0x9d50('0x3c'),_0x255593['uniqueid']),_0x255593);queues[_0x255593[_0x9d50('0x2')]]['queuecallerabandon']=![];queues[_0x255593['uniqueid']][_0x9d50('0x17')]=![];queues[_0x255593['uniqueid']][_0x9d50('0x29')]=null;queues[_0x255593[_0x9d50('0x2')]]['queuecallerexit']=![];queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x25')]=null;queues[_0x255593['uniqueid']]['assigned']=!![];queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x4')]=_0x255593[_0x9d50('0x39')];queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x19')]=!![];queues[_0x255593['uniqueid']][_0x9d50('0x1a')]=utils[_0x9d50('0x12')]();if(_0x255593['reason']==_0x9d50('0x3d')){if(!queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x3d')]){queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x1b')]=_0x9d50('0x3e');}}else{queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x1b')]=_0x9d50('0x3f')+_0x255593[_0x9d50('0x40')][_0x9d50('0x26')]();}utils['info'](util['format'](_0x9d50('0x41'),_0x255593[_0x9d50('0x2')],queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x1d')],_0x255593[_0x9d50('0x39')],queues[_0x255593[_0x9d50('0x2')]][_0x9d50('0x1b')]));writeDB(queues[_0x255593[_0x9d50('0x2')]]);}}}catch(_0x37830e){utils[_0x9d50('0x13')](util['format'](_0x9d50('0x3c'),_0x255593[_0x9d50('0x2')]),_0x37830e);}};exports[_0x9d50('0x42')]=function(_0x7336a0){try{if(!_[_0x9d50('0x14')](queues[_0x7336a0[_0x9d50('0x43')]])){utils[_0x9d50('0xd')](util[_0x9d50('0xe')]('[%s][queues][blindtransfer]',_0x7336a0['uniqueid']),_0x7336a0);queues[_0x7336a0[_0x9d50('0x43')]]['transfer']=!![];queues[_0x7336a0[_0x9d50('0x43')]][_0x9d50('0x44')]=_0x9d50('0x45');queues[_0x7336a0['transfereeuniqueid']][_0x9d50('0x46')]=_0x7336a0[_0x9d50('0x47')];queues[_0x7336a0['transfereeuniqueid']][_0x9d50('0x48')]=_0x7336a0['transfereeuniqueid'];queues[_0x7336a0[_0x9d50('0x43')]]['queuecallerexitreason']=_0x9d50('0x49');utils[_0x9d50('0x1')](util[_0x9d50('0xe')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x7336a0[_0x9d50('0x2')],queues[_0x7336a0[_0x9d50('0x43')]]['name'],_0x7336a0['transfereeuniqueid'],_0x7336a0[_0x9d50('0x47')]));}}catch(_0x5f38fe){utils[_0x9d50('0x13')](util[_0x9d50('0xe')](_0x9d50('0x4a'),_0x7336a0['uniqueid']),_0x5f38fe);}};exports['attendedtransfer']=function(_0x371fbf){try{utils[_0x9d50('0xd')](util[_0x9d50('0xe')](_0x9d50('0x4b'),_0x371fbf[_0x9d50('0x4c')]),_0x371fbf);if(_0x371fbf['origtransfereruniqueid']==_0x371fbf[_0x9d50('0x4d')]){if(!_[_0x9d50('0x14')](queues[_0x371fbf['secondtransfererlinkedid']])){utils[_0x9d50('0x1')](util[_0x9d50('0xe')](_0x9d50('0x4e'),_0x371fbf[_0x9d50('0x4c')],queues[_0x371fbf[_0x9d50('0x4f')]][_0x9d50('0x1d')],_0x371fbf[_0x9d50('0x50')]));queues[_0x371fbf[_0x9d50('0x4f')]][_0x9d50('0x3d')]=!![];queues[_0x371fbf['secondtransfererlinkedid']][_0x9d50('0x44')]='ATTENDED';queues[_0x371fbf[_0x9d50('0x4f')]][_0x9d50('0x46')]=_0x371fbf[_0x9d50('0x50')];queues[_0x371fbf[_0x9d50('0x4f')]][_0x9d50('0x48')]=_0x371fbf[_0x9d50('0x4c')];queues[_0x371fbf[_0x9d50('0x4f')]][_0x9d50('0x1b')]=_0x9d50('0x51');}if(!_[_0x9d50('0x14')](queues[_0x371fbf['origtransfererlinkedid']])){if(_0x371fbf[_0x9d50('0x52')]&&queues[_0x371fbf[_0x9d50('0x52')]]){queues[_0x371fbf['transfereelinkedid']][_0x9d50('0x1f')]=0x1;queues[_0x371fbf['transfereeuniqueid']]=_['clone'](queues[_0x371fbf[_0x9d50('0x52')]]);queues[_0x371fbf['transfereeuniqueid']][_0x9d50('0xb')]=_0x371fbf[_0x9d50('0x53')];queues[_0x371fbf[_0x9d50('0x43')]][_0x9d50('0x1f')]=0x2;queues[_0x371fbf[_0x9d50('0x43')]]['calleridnum']=queues[_0x371fbf[_0x9d50('0x4f')]][_0x9d50('0x5')];queues[_0x371fbf[_0x9d50('0x43')]][_0x9d50('0x54')]=queues[_0x371fbf[_0x9d50('0x4f')]][_0x9d50('0x54')];queues[_0x371fbf[_0x9d50('0x43')]][_0x9d50('0x55')]=utils[_0x9d50('0x12')]();queues[_0x371fbf[_0x9d50('0x43')]][_0x9d50('0x16')]=utils[_0x9d50('0x12')]();queues[_0x371fbf['transfereeuniqueid']][_0x9d50('0x56')]=0x0;queues[_0x371fbf[_0x9d50('0x43')]]['mohtime']=0x0;utils[_0x9d50('0x1')](util[_0x9d50('0xe')](_0x9d50('0x57'),_0x371fbf[_0x9d50('0x4c')],queues[_0x371fbf[_0x9d50('0x43')]]['name'],queues[_0x371fbf[_0x9d50('0x43')]][_0x9d50('0x5')],queues[_0x371fbf[_0x9d50('0x43')]][_0x9d50('0x54')]));}else{utils[_0x9d50('0x1')](util[_0x9d50('0xe')](_0x9d50('0x58'),_0x371fbf[_0x9d50('0x4c')],queues[_0x371fbf[_0x9d50('0x4d')]]['name'],_0x371fbf['secondtransfererlinkedid']));queues[_0x371fbf['origtransfererlinkedid']][_0x9d50('0xb')]=_0x371fbf['secondtransfererlinkedid'];}}}else if(_0x371fbf[_0x9d50('0x59')]==_0x371fbf[_0x9d50('0x4f')]){if(!_[_0x9d50('0x14')](queues[_0x371fbf[_0x9d50('0x4d')]])){utils[_0x9d50('0x1')](util[_0x9d50('0xe')](_0x9d50('0x5a'),_0x371fbf['origtransfereruniqueid'],queues[_0x371fbf[_0x9d50('0x4d')]]['name'],_0x371fbf[_0x9d50('0x59')],_0x371fbf[_0x9d50('0x5b')]));queues[_0x371fbf['origtransfererlinkedid']][_0x9d50('0x3d')]=!![];queues[_0x371fbf[_0x9d50('0x4d')]][_0x9d50('0x44')]=_0x9d50('0x5c');queues[_0x371fbf[_0x9d50('0x4d')]][_0x9d50('0x46')]=_0x371fbf['secondtransfererexten'];queues[_0x371fbf[_0x9d50('0x4d')]][_0x9d50('0x48')]=_0x371fbf['secondtransfereruniqueid'];queues[_0x371fbf[_0x9d50('0x4d')]][_0x9d50('0x1b')]=_0x9d50('0x51');}if(!_[_0x9d50('0x14')](queues[_0x371fbf['secondtransfererlinkedid']])){if(_0x371fbf['transfertargetlinkedid']&&queues[_0x371fbf[_0x9d50('0x5d')]]){queues[_0x371fbf[_0x9d50('0x5d')]][_0x9d50('0x1f')]=0x1;queues[_0x371fbf[_0x9d50('0x53')]]=_[_0x9d50('0x5e')](queues[_0x371fbf[_0x9d50('0x5d')]]);queues[_0x371fbf[_0x9d50('0x53')]][_0x9d50('0xb')]=_0x371fbf[_0x9d50('0x53')];queues[_0x371fbf[_0x9d50('0x53')]][_0x9d50('0x1f')]=0x2;queues[_0x371fbf[_0x9d50('0x53')]]['calleridnum']=queues[_0x371fbf[_0x9d50('0x4d')]][_0x9d50('0x5')];queues[_0x371fbf[_0x9d50('0x53')]][_0x9d50('0x54')]=queues[_0x371fbf['origtransfererlinkedid']][_0x9d50('0x54')];queues[_0x371fbf[_0x9d50('0x53')]][_0x9d50('0x55')]=utils['now']();queues[_0x371fbf['transfertargetuniqueid']][_0x9d50('0x16')]=utils[_0x9d50('0x12')]();queues[_0x371fbf[_0x9d50('0x53')]][_0x9d50('0x56')]=0x0;queues[_0x371fbf[_0x9d50('0x53')]][_0x9d50('0x5f')]=0x0;utils[_0x9d50('0x1')](util['format'](_0x9d50('0x60'),_0x371fbf[_0x9d50('0x4c')],queues[_0x371fbf[_0x9d50('0x53')]]['name'],queues[_0x371fbf[_0x9d50('0x53')]][_0x9d50('0xb')],queues[_0x371fbf['transfertargetuniqueid']][_0x9d50('0x5')],queues[_0x371fbf[_0x9d50('0x53')]][_0x9d50('0x54')]));}else{utils[_0x9d50('0x1')](util['format'](_0x9d50('0x58'),_0x371fbf[_0x9d50('0x4c')],queues[_0x371fbf[_0x9d50('0x4f')]][_0x9d50('0x1d')],_0x371fbf['origtransfererlinkedid']));queues[_0x371fbf[_0x9d50('0x4f')]]['transfereduniqueid']=_0x371fbf[_0x9d50('0x4d')];}}}}catch(_0x791a0f){utils[_0x9d50('0x13')](util[_0x9d50('0xe')](_0x9d50('0x4b'),_0x371fbf[_0x9d50('0x4c')]),_0x791a0f);}};exports[_0x9d50('0x61')]=function(_0x30fc0b){try{if(!_[_0x9d50('0x14')](queues[_0x30fc0b[_0x9d50('0x2')]])){utils[_0x9d50('0xd')](util[_0x9d50('0xe')]('[%s][queues][musiconholdstart]',_0x30fc0b[_0x9d50('0x2')]),_0x30fc0b);queues[_0x30fc0b[_0x9d50('0x2')]][_0x9d50('0x62')]=utils[_0x9d50('0x12')]();utils[_0x9d50('0x1')](util[_0x9d50('0xe')](_0x9d50('0x63'),_0x30fc0b['uniqueid'],queues[_0x30fc0b[_0x9d50('0x2')]][_0x9d50('0x1d')],queues[_0x30fc0b[_0x9d50('0x2')]][_0x9d50('0x62')]));}}catch(_0x1a6bfb){utils[_0x9d50('0x13')](util['format'](_0x9d50('0x64'),_0x30fc0b[_0x9d50('0x2')]),_0x1a6bfb);}};exports[_0x9d50('0x65')]=function(_0x4686a9){try{if(!_['isNil'](queues[_0x4686a9[_0x9d50('0x2')]])){if(!_[_0x9d50('0x14')](queues[_0x4686a9[_0x9d50('0x2')]][_0x9d50('0x62')])){utils['debug'](util[_0x9d50('0xe')](_0x9d50('0x66'),_0x4686a9[_0x9d50('0x2')]),_0x4686a9);queues[_0x4686a9['uniqueid']][_0x9d50('0x5f')]+=utils[_0x9d50('0x33')](utils[_0x9d50('0x12')](),queues[_0x4686a9['uniqueid']][_0x9d50('0x62')]);utils[_0x9d50('0x1')](util['format'](_0x9d50('0x67'),_0x4686a9[_0x9d50('0x2')],queues[_0x4686a9[_0x9d50('0x2')]][_0x9d50('0x1d')],queues[_0x4686a9[_0x9d50('0x2')]]['mohtime']));delete queues[_0x4686a9[_0x9d50('0x2')]][_0x9d50('0x62')];}}}catch(_0x3fda6e){utils[_0x9d50('0x13')](util['format'](_0x9d50('0x66'),_0x4686a9[_0x9d50('0x2')]),_0x3fda6e);}}; \ No newline at end of file +var _0xb7de=['then','type','CreateVoiceQueueReport','request','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','diffTime','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transferexten','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue'];(function(_0x24b634,_0x6eb319){var _0x13bf36=function(_0x539303){while(--_0x539303){_0x24b634['push'](_0x24b634['shift']());}};_0x13bf36(++_0x6eb319);}(_0xb7de,0xc7));var _0xeb7d=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xb7de[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var utils=require(_0xeb7d('0x2'));var queues={};function writeDB(_0x55dc83){utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5'),_0x55dc83[_0xeb7d('0x6')],_0x55dc83[_0xeb7d('0x7')],_0x55dc83['queue'],_0x55dc83[_0xeb7d('0x8')],_0x55dc83[_0xeb7d('0x9')],_0x55dc83[_0xeb7d('0xa')],_0x55dc83[_0xeb7d('0xb')]));if(_0x55dc83[_0xeb7d('0xc')]){utils['getVoiceQueueByName'](_0x55dc83['queue'])[_0xeb7d('0xd')](function(_0x13d376){if(_0x13d376){_0x55dc83[_0xeb7d('0xe')]=_0x13d376[_0xeb7d('0xe')];}utils['request'](_0xeb7d('0xf'),_0x55dc83);});}else{utils[_0xeb7d('0x10')](_0xeb7d('0xf'),_0x55dc83);}if(_0x55dc83['transfereduniqueid']){delete queues[_0x55dc83['transfereduniqueid']];}else{delete queues[_0x55dc83[_0xeb7d('0x6')]];}}exports['queuecallerjoin']=function(_0x1aa13a){try{utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x12'),_0x1aa13a[_0xeb7d('0x6')]),_0x1aa13a);utils[_0xeb7d('0x3')](util['format'](_0xeb7d('0x13'),_0x1aa13a[_0xeb7d('0x6')],_0x1aa13a[_0xeb7d('0xc')],_0x1aa13a[_0xeb7d('0x14')]));queues[_0x1aa13a[_0xeb7d('0x6')]]=_['assign'](_0x1aa13a,{'originalposition':_0x1aa13a[_0xeb7d('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x284575){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')]('[%s][queues][queuecallerjoin]',_0x1aa13a['uniqueid']),_0x284575);}};exports[_0xeb7d('0x16')]=function(_0xfcbbce){try{if(!_['isNil'](queues[_0xfcbbce['uniqueid']])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')]('[%s][queues][hangup]',_0xfcbbce[_0xeb7d('0x6')]),_0xfcbbce);if(queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x17')]){if(!queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x18')]&&!queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x19')]){queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1a')]=!![];queues[_0xfcbbce['uniqueid']][_0xeb7d('0x1b')]=utils['now']();queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0xeb7d('0x1c');}utils['info'](util[_0xeb7d('0x4')](_0xeb7d('0x1d'),_0xfcbbce['uniqueid'],queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1e')],queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0xb')]));writeDB(queues[_0xfcbbce[_0xeb7d('0x6')]]);}else if(queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1f')]){utils['info'](util[_0xeb7d('0x4')](_0xeb7d('0x20'),_0xfcbbce[_0xeb7d('0x6')],queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1e')],queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1f')]));queues[queues[_0xfcbbce['uniqueid']][_0xeb7d('0x1f')]]=queues[_0xfcbbce[_0xeb7d('0x6')]];queues[queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1f')]][_0xeb7d('0x21')]=0x2;delete queues[_0xfcbbce[_0xeb7d('0x6')]];}}}catch(_0x58ba4f){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')]('[%s][queues][hangup]',_0xfcbbce[_0xeb7d('0x6')]),_0x58ba4f);}};exports[_0xeb7d('0x22')]=function(_0x9abd4b){try{utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x23'),_0x9abd4b[_0xeb7d('0x6')]),_0x9abd4b);if(!_[_0xeb7d('0x24')](_0x9abd4b[_0xeb7d('0x25')][_0xeb7d('0x26')])&&_0x9abd4b[_0xeb7d('0x27')][_0xeb7d('0x28')]()!==_0xeb7d('0x29')){if(!_[_0xeb7d('0x24')](queues[_0x9abd4b[_0xeb7d('0x6')]])){queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x18')]=![];queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x2a')]=null;queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x19')]=!![];queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x2b')]=utils[_0xeb7d('0x2c')]();queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0x9abd4b[_0xeb7d('0x27')][_0xeb7d('0x28')]();utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x2d'),_0x9abd4b['uniqueid'],queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x1e')],_0x9abd4b[_0xeb7d('0x27')],queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0xb')]));writeDB(queues[_0x9abd4b['uniqueid']]);}}else if(!_[_0xeb7d('0x24')](_0x9abd4b[_0xeb7d('0x25')]['queueposition'])){if(!_[_0xeb7d('0x24')](queues[_0x9abd4b[_0xeb7d('0x6')]])&&!queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x18')]){queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x18')]=![];queues[_0x9abd4b[_0xeb7d('0x6')]]['queuecallerabandonAt']=null;queues[_0x9abd4b[_0xeb7d('0x6')]]['queuecallerexit']=!![];queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x2b')]=utils[_0xeb7d('0x2c')]();queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0xeb7d('0x2e');utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x2f'),_0x9abd4b[_0xeb7d('0x6')],queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x1e')],_0x9abd4b[_0xeb7d('0x27')],queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0xb')]));}}}catch(_0x5ed81c){utils['error'](util[_0xeb7d('0x4')](_0xeb7d('0x23'),_0x9abd4b[_0xeb7d('0x6')]),_0x5ed81c);}};exports[_0xeb7d('0x18')]=function(_0x15d845){try{if(!_[_0xeb7d('0x24')](queues[_0x15d845['uniqueid']])){utils[_0xeb7d('0x11')](util['format'](_0xeb7d('0x30'),_0x15d845[_0xeb7d('0x6')]),_0x15d845);queues[_0x15d845[_0xeb7d('0x6')]][_0xeb7d('0x19')]=![];queues[_0x15d845[_0xeb7d('0x6')]]['queuecallerexitAt']=null;queues[_0x15d845[_0xeb7d('0x6')]]['queuecallerabandon']=!![];queues[_0x15d845[_0xeb7d('0x6')]][_0xeb7d('0x2a')]=utils[_0xeb7d('0x2c')]();queues[_0x15d845[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0xeb7d('0x31');utils[_0xeb7d('0x3')](util['format'](_0xeb7d('0x32'),_0x15d845[_0xeb7d('0x6')],queues[_0x15d845['uniqueid']][_0xeb7d('0x1e')],queues[_0x15d845['uniqueid']][_0xeb7d('0xb')]));}}catch(_0x42b01){utils['error'](util[_0xeb7d('0x4')](_0xeb7d('0x30'),_0x15d845[_0xeb7d('0x6')]),_0x42b01);}};exports['queuecallerleave']=function(_0x2895ef){try{if(!_[_0xeb7d('0x24')](queues[_0x2895ef['uniqueid']])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x33'),_0x2895ef[_0xeb7d('0x6')]),_0x2895ef);utils['info'](util[_0xeb7d('0x4')](_0xeb7d('0x34'),_0x2895ef[_0xeb7d('0x6')],queues[_0x2895ef[_0xeb7d('0x6')]][_0xeb7d('0x1e')],_0x2895ef['connectedlinenum'],_0x2895ef[_0xeb7d('0x35')]));queues[_0x2895ef[_0xeb7d('0x6')]]['queuecallerleave']=!![];queues[_0x2895ef['uniqueid']]['queuecallerleaveAt']=utils[_0xeb7d('0x2c')]();queues[_0x2895ef[_0xeb7d('0x6')]]['holdtime']=utils[_0xeb7d('0x36')](queues[_0x2895ef[_0xeb7d('0x6')]]['queuecallerleaveAt'],queues[_0x2895ef[_0xeb7d('0x6')]]['queuecallerjoinAt']);queues[_0x2895ef['uniqueid']][_0xeb7d('0x14')]=_0x2895ef[_0xeb7d('0x14')];queues[_0x2895ef[_0xeb7d('0x6')]][_0xeb7d('0x37')]=_0x2895ef[_0xeb7d('0x37')];queues[_0x2895ef[_0xeb7d('0x6')]][_0xeb7d('0x38')]=_0x2895ef['connectedlinenum'];queues[_0x2895ef[_0xeb7d('0x6')]]['connectedlinename']=_0x2895ef[_0xeb7d('0x35')];}}catch(_0x30e777){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')](_0xeb7d('0x33'),_0x2895ef['uniqueid']),_0x30e777);}};exports['agentconnect']=function(_0x3b4490){try{if(!_[_0xeb7d('0x24')](queues[_0x3b4490[_0xeb7d('0x6')]])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x39'),_0x3b4490['uniqueid']),_0x3b4490);utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x3a'),_0x3b4490[_0xeb7d('0x6')],queues[_0x3b4490['uniqueid']][_0xeb7d('0x1e')],_0x3b4490['membername'],_0x3b4490[_0xeb7d('0x3b')]));queues[_0x3b4490[_0xeb7d('0x6')]][_0xeb7d('0x18')]=![];queues[_0x3b4490[_0xeb7d('0x6')]][_0xeb7d('0x18')]=![];queues[_0x3b4490[_0xeb7d('0x6')]][_0xeb7d('0x2a')]=null;queues[_0x3b4490[_0xeb7d('0x6')]]['queuecallerexit']=![];queues[_0x3b4490[_0xeb7d('0x6')]][_0xeb7d('0xb')]=null;queues[_0x3b4490['uniqueid']][_0xeb7d('0x2b')]=null;queues[_0x3b4490['uniqueid']][_0xeb7d('0x3c')]=!![];queues[_0x3b4490['uniqueid']][_0xeb7d('0xa')]=_0x3b4490[_0xeb7d('0x3b')];queues[_0x3b4490[_0xeb7d('0x6')]]['lastAssignedTo']=_0x3b4490[_0xeb7d('0x3d')];}}catch(_0x352163){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')]('[%s][queues][agentconnect]',_0x3b4490['uniqueid']),_0x352163);}};exports['agentcomplete']=function(_0x159307){try{if(!_[_0xeb7d('0x24')](queues[_0x159307[_0xeb7d('0x6')]])){if(queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x17')]){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x3e'),_0x159307['uniqueid']),_0x159307);queues[_0x159307[_0xeb7d('0x6')]]['queuecallerabandon']=![];queues[_0x159307[_0xeb7d('0x6')]]['queuecallerabandon']=![];queues[_0x159307['uniqueid']]['queuecallerabandonAt']=null;queues[_0x159307['uniqueid']][_0xeb7d('0x19')]=![];queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x2b')]=null;queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x3c')]=!![];queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x8')]=_0x159307['membername'];queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x1a')]=!![];queues[_0x159307['uniqueid']][_0xeb7d('0x1b')]=utils[_0xeb7d('0x2c')]();if(_0x159307[_0xeb7d('0x3f')]==_0xeb7d('0x40')){if(!queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x40')]){queues[_0x159307['uniqueid']][_0xeb7d('0xb')]=_0xeb7d('0x41');}}else{queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0xeb7d('0x42')+_0x159307[_0xeb7d('0x3f')][_0xeb7d('0x28')]();}utils[_0xeb7d('0x3')](util['format'](_0xeb7d('0x43'),_0x159307[_0xeb7d('0x6')],queues[_0x159307['uniqueid']][_0xeb7d('0x1e')],_0x159307[_0xeb7d('0x3d')],queues[_0x159307[_0xeb7d('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x159307[_0xeb7d('0x6')]]);}}}catch(_0x224095){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')](_0xeb7d('0x3e'),_0x159307[_0xeb7d('0x6')]),_0x224095);}};exports[_0xeb7d('0x44')]=function(_0xd1b6c2){try{if(!_[_0xeb7d('0x24')](queues[_0xd1b6c2[_0xeb7d('0x45')]])){utils[_0xeb7d('0x11')](util['format']('[%s][queues][blindtransfer]',_0xd1b6c2[_0xeb7d('0x6')]),_0xd1b6c2);queues[_0xd1b6c2[_0xeb7d('0x45')]]['transfer']=!![];queues[_0xd1b6c2[_0xeb7d('0x45')]][_0xeb7d('0x46')]='BLIND';queues[_0xd1b6c2[_0xeb7d('0x45')]]['transferexten']=_0xd1b6c2[_0xeb7d('0x47')];queues[_0xd1b6c2[_0xeb7d('0x45')]]['transferuniqueid']=_0xd1b6c2[_0xeb7d('0x45')];queues[_0xd1b6c2[_0xeb7d('0x45')]]['queuecallerexitreason']=_0xeb7d('0x48');utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x49'),_0xd1b6c2[_0xeb7d('0x6')],queues[_0xd1b6c2['transfereeuniqueid']][_0xeb7d('0x1e')],_0xd1b6c2[_0xeb7d('0x45')],_0xd1b6c2[_0xeb7d('0x47')]));}}catch(_0x49b9d3){utils['error'](util[_0xeb7d('0x4')](_0xeb7d('0x4a'),_0xd1b6c2[_0xeb7d('0x6')]),_0x49b9d3);}};exports[_0xeb7d('0x4b')]=function(_0x4a4f6c){try{utils[_0xeb7d('0x11')](util['format'](_0xeb7d('0x4c'),_0x4a4f6c[_0xeb7d('0x4d')]),_0x4a4f6c);if(_0x4a4f6c[_0xeb7d('0x4d')]==_0x4a4f6c[_0xeb7d('0x4e')]){if(!_[_0xeb7d('0x24')](queues[_0x4a4f6c[_0xeb7d('0x4f')]])){utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c['secondtransfererlinkedid']][_0xeb7d('0x1e')],_0x4a4f6c['origtransfererexten']));queues[_0x4a4f6c[_0xeb7d('0x4f')]][_0xeb7d('0x40')]=!![];queues[_0x4a4f6c[_0xeb7d('0x4f')]][_0xeb7d('0x46')]='ATTENDED';queues[_0x4a4f6c[_0xeb7d('0x4f')]][_0xeb7d('0x50')]=_0x4a4f6c[_0xeb7d('0x51')];queues[_0x4a4f6c[_0xeb7d('0x4f')]][_0xeb7d('0x52')]=_0x4a4f6c['origtransfereruniqueid'];queues[_0x4a4f6c['secondtransfererlinkedid']][_0xeb7d('0xb')]=_0xeb7d('0x53');}if(!_['isNil'](queues[_0x4a4f6c['origtransfererlinkedid']])){if(_0x4a4f6c[_0xeb7d('0x54')]&&queues[_0x4a4f6c[_0xeb7d('0x54')]]){queues[_0x4a4f6c['transfereelinkedid']][_0xeb7d('0x21')]=0x1;queues[_0x4a4f6c['transfereeuniqueid']]=_[_0xeb7d('0x55')](queues[_0x4a4f6c[_0xeb7d('0x54')]]);queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x1f')]=_0x4a4f6c[_0xeb7d('0x56')];queues[_0x4a4f6c[_0xeb7d('0x45')]]['queuecallerenterreason']=0x2;queues[_0x4a4f6c['transfereeuniqueid']]['calleridnum']=queues[_0x4a4f6c[_0xeb7d('0x4f')]]['calleridnum'];queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x57')]=queues[_0x4a4f6c['secondtransfererlinkedid']][_0xeb7d('0x57')];queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x58')]=utils[_0xeb7d('0x2c')]();queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x17')]=utils[_0xeb7d('0x2c')]();queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x59')]=0x0;queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x5a')]=0x0;utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5b'),_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x1e')],queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x9')],queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x57')]));}else{utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5c'),_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c['origtransfererlinkedid']][_0xeb7d('0x1e')],_0x4a4f6c[_0xeb7d('0x4f')]));queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x1f')]=_0x4a4f6c[_0xeb7d('0x4f')];}}}else if(_0x4a4f6c[_0xeb7d('0x5d')]==_0x4a4f6c[_0xeb7d('0x4f')]){if(!_['isNil'](queues[_0x4a4f6c[_0xeb7d('0x4e')]])){utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5e'),_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x1e')],_0x4a4f6c['secondtransfereruniqueid'],_0x4a4f6c[_0xeb7d('0x5f')]));queues[_0x4a4f6c[_0xeb7d('0x4e')]]['transfer']=!![];queues[_0x4a4f6c['origtransfererlinkedid']][_0xeb7d('0x46')]=_0xeb7d('0x60');queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x50')]=_0x4a4f6c['secondtransfererexten'];queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x52')]=_0x4a4f6c[_0xeb7d('0x5d')];queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0xb')]=_0xeb7d('0x53');}if(!_[_0xeb7d('0x24')](queues[_0x4a4f6c[_0xeb7d('0x4f')]])){if(_0x4a4f6c[_0xeb7d('0x61')]&&queues[_0x4a4f6c[_0xeb7d('0x61')]]){queues[_0x4a4f6c[_0xeb7d('0x61')]]['queuecallerenterreason']=0x1;queues[_0x4a4f6c[_0xeb7d('0x56')]]=_[_0xeb7d('0x55')](queues[_0x4a4f6c[_0xeb7d('0x61')]]);queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x1f')]=_0x4a4f6c[_0xeb7d('0x56')];queues[_0x4a4f6c[_0xeb7d('0x56')]]['queuecallerenterreason']=0x2;queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x9')]=queues[_0x4a4f6c['origtransfererlinkedid']][_0xeb7d('0x9')];queues[_0x4a4f6c[_0xeb7d('0x56')]]['calleridname']=queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x57')];queues[_0x4a4f6c[_0xeb7d('0x56')]]['queuecallerjoinAt']=utils[_0xeb7d('0x2c')]();queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x17')]=utils[_0xeb7d('0x2c')]();queues[_0x4a4f6c['transfertargetuniqueid']][_0xeb7d('0x59')]=0x0;queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x5a')]=0x0;utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x62'),_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x1e')],queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x1f')],queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x9')],queues[_0x4a4f6c[_0xeb7d('0x56')]]['calleridname']));}else{utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5c'),_0x4a4f6c['origtransfereruniqueid'],queues[_0x4a4f6c['secondtransfererlinkedid']][_0xeb7d('0x1e')],_0x4a4f6c['origtransfererlinkedid']));queues[_0x4a4f6c[_0xeb7d('0x4f')]]['transfereduniqueid']=_0x4a4f6c[_0xeb7d('0x4e')];}}}}catch(_0x5eef5a){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')](_0xeb7d('0x4c'),_0x4a4f6c[_0xeb7d('0x4d')]),_0x5eef5a);}};exports[_0xeb7d('0x63')]=function(_0x2ceb80){try{if(!_[_0xeb7d('0x24')](queues[_0x2ceb80[_0xeb7d('0x6')]])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')]('[%s][queues][musiconholdstart]',_0x2ceb80['uniqueid']),_0x2ceb80);queues[_0x2ceb80['uniqueid']]['musiconholdstartAt']=utils[_0xeb7d('0x2c')]();utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x64'),_0x2ceb80[_0xeb7d('0x6')],queues[_0x2ceb80['uniqueid']][_0xeb7d('0x1e')],queues[_0x2ceb80[_0xeb7d('0x6')]][_0xeb7d('0x65')]));}}catch(_0x1b0d3f){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')](_0xeb7d('0x66'),_0x2ceb80[_0xeb7d('0x6')]),_0x1b0d3f);}};exports[_0xeb7d('0x67')]=function(_0x5dc13b){try{if(!_['isNil'](queues[_0x5dc13b['uniqueid']])){if(!_[_0xeb7d('0x24')](queues[_0x5dc13b[_0xeb7d('0x6')]]['musiconholdstartAt'])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x68'),_0x5dc13b[_0xeb7d('0x6')]),_0x5dc13b);queues[_0x5dc13b['uniqueid']]['mohtime']+=utils[_0xeb7d('0x36')](utils[_0xeb7d('0x2c')](),queues[_0x5dc13b[_0xeb7d('0x6')]][_0xeb7d('0x65')]);utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x69'),_0x5dc13b[_0xeb7d('0x6')],queues[_0x5dc13b[_0xeb7d('0x6')]][_0xeb7d('0x1e')],queues[_0x5dc13b[_0xeb7d('0x6')]][_0xeb7d('0x5a')]));delete queues[_0x5dc13b[_0xeb7d('0x6')]][_0xeb7d('0x65')];}}}catch(_0x31f19f){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')]('[%s][queues][musiconholdstop]',_0x5dc13b[_0xeb7d('0x6')]),_0x31f19f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 9ae5f59..9b0448a 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 _0x47cb=['cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','channelstate','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','hangup','[%s][recordings][hangup]','calleridnum','calleridname'];(function(_0x458c52,_0x5e3fb4){var _0x43f43b=function(_0x5cdfeb){while(--_0x5cdfeb){_0x458c52['push'](_0x458c52['shift']());}};_0x43f43b(++_0x5e3fb4);}(_0x47cb,0x10c));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb47c('0x0'));var utils=require(_0xb47c('0x1'));var recordings={};function writeDB(_0x2f0ea7){utils[_0xb47c('0x2')](util[_0xb47c('0x3')](_0xb47c('0x4'),_0x2f0ea7['uniqueid']));if(_0x2f0ea7[_0xb47c('0x5')]){utils[_0xb47c('0x6')](_0x2f0ea7[_0xb47c('0x5')])[_0xb47c('0x7')](function(_0x25cdca){if(_0x25cdca){_0x2f0ea7[_0xb47c('0x8')]=_0x25cdca[_0xb47c('0x9')];_0x2f0ea7[_0xb47c('0xa')]=_0x25cdca['id'];}utils[_0xb47c('0xb')]('CreateVoiceRecording',_0x2f0ea7);});}else{utils['request'](_0xb47c('0xc'),_0x2f0ea7);}}exports[_0xb47c('0xd')]=function(_0x1453cb){try{utils[_0xb47c('0xe')](util[_0xb47c('0x3')](_0xb47c('0xf'),_0x1453cb['uniqueid']),_0x1453cb);if(_0x1453cb[_0xb47c('0x10')]==_0x1453cb['linkedid']){utils[_0xb47c('0x2')](util[_0xb47c('0x3')](_0xb47c('0x11'),_0x1453cb[_0xb47c('0x10')],_0x1453cb[_0xb47c('0x12')],_0x1453cb[_0xb47c('0x13')]));recordings[_0x1453cb['uniqueid']]={'uniqueid':_0x1453cb[_0xb47c('0x10')],'accountcode':_0x1453cb[_0xb47c('0x5')],'exten':_0x1453cb[_0xb47c('0x13')],'context':_0x1453cb[_0xb47c('0x12')],'channel':_0x1453cb[_0xb47c('0x14')],'monitors':[]};}}catch(_0x1266de){utils[_0xb47c('0x15')](util[_0xb47c('0x3')]('[%s][recordings][newchannel]',_0x1453cb[_0xb47c('0x10')]),_0x1266de);}};exports['newstate']=function(_0x2a7900){try{utils[_0xb47c('0xe')](util['format'](_0xb47c('0x16'),_0x2a7900[_0xb47c('0x10')]),_0x2a7900);if(!_['isNil'](recordings[_0x2a7900[_0xb47c('0x10')]])&&_0x2a7900[_0xb47c('0x17')]==0x6){utils[_0xb47c('0x2')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2a7900[_0xb47c('0x10')],_0x2a7900[_0xb47c('0x12')],_0x2a7900[_0xb47c('0x14')]));}else if(!_[_0xb47c('0x18')](recordings[_0x2a7900[_0xb47c('0x19')]])&&_0x2a7900[_0xb47c('0x17')]==0x6&&_0x2a7900[_0xb47c('0x12')]!=_0xb47c('0x1a')){utils[_0xb47c('0x2')](util[_0xb47c('0x3')](_0xb47c('0x1b'),_0x2a7900['uniqueid'],_0x2a7900[_0xb47c('0x19')],_0x2a7900[_0xb47c('0x12')],_0x2a7900[_0xb47c('0x14')]));recordings[_0x2a7900[_0xb47c('0x19')]][_0xb47c('0x5')]=_0x2a7900[_0xb47c('0x5')];}}catch(_0x532c3b){utils[_0xb47c('0x15')](util[_0xb47c('0x3')]('[%s][recordings][newstate]',_0x2a7900[_0xb47c('0x10')]),_0x532c3b);}};exports[_0xb47c('0x1c')]=function(_0x379349){try{if(!_[_0xb47c('0x18')](_0x379349['variable'])&&!_['isNil'](_0x379349[_0xb47c('0x1d')][_0xb47c('0x1e')])){utils['debug'](util[_0xb47c('0x3')](_0xb47c('0x1f'),_0x379349['uniqueid']),_0x379349);utils[_0xb47c('0x2')](util['format'](_0xb47c('0x20'),_0x379349['uniqueid'],_0x379349[_0xb47c('0x1d')],_0x379349[_0xb47c('0x21')]));if(_[_0xb47c('0x22')](_0x379349[_0xb47c('0x21')],_0xb47c('0x23'))){_0x379349['value']=_0x379349[_0xb47c('0x21')]['replace']('.wav49','.WAV');}if(recordings[_0x379349['linkedid']]){var _0x58d2c5=_[_0xb47c('0x24')](recordings[_0x379349['linkedid']][_0xb47c('0x25')],{'value':_0x379349['value']});if(_[_0xb47c('0x18')](_0x58d2c5)){recordings[_0x379349[_0xb47c('0x19')]][_0xb47c('0x25')]['push']({'value':_0x379349[_0xb47c('0x21')]});}}}}catch(_0x289ed8){utils['error'](util[_0xb47c('0x3')](_0xb47c('0x1f'),_0x379349[_0xb47c('0x10')]),_0x289ed8);}};exports[_0xb47c('0x26')]=function(_0xd78fe9){try{if(!_[_0xb47c('0x18')](recordings[_0xd78fe9[_0xb47c('0x10')]])){utils['debug'](util['format'](_0xb47c('0x27'),_0xd78fe9['uniqueid']),_0xd78fe9);utils[_0xb47c('0x2')](util[_0xb47c('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xd78fe9[_0xb47c('0x10')],_0xd78fe9[_0xb47c('0x28')],_0xd78fe9[_0xb47c('0x29')],_0xd78fe9[_0xb47c('0x2a')]));recordings[_0xd78fe9['uniqueid']][_0xb47c('0x28')]=_0xd78fe9[_0xb47c('0x28')];recordings[_0xd78fe9[_0xb47c('0x10')]][_0xb47c('0x29')]=_0xd78fe9[_0xb47c('0x29')];recordings[_0xd78fe9[_0xb47c('0x10')]][_0xb47c('0x2b')]=_0xd78fe9['connectedlinenum'];recordings[_0xd78fe9['uniqueid']]['connectedlinename']=_0xd78fe9[_0xb47c('0x2c')];if(recordings[_0xd78fe9['uniqueid']]['type']==_0xb47c('0x2d')&&recordings[_0xd78fe9['uniqueid']]['accountcode']){recordings[_0xd78fe9[_0xb47c('0x10')]]['connectedlinenum']=recordings[_0xd78fe9['uniqueid']][_0xb47c('0x5')];recordings[_0xd78fe9[_0xb47c('0x10')]][_0xb47c('0x2c')]='';}recordings[_0xd78fe9[_0xb47c('0x10')]][_0xb47c('0x25')][_0xb47c('0x2e')](function(_0x20fa95){var _0x49d7d6=_[_0xb47c('0x2f')](recordings[_0xd78fe9[_0xb47c('0x10')]]);_0x49d7d6[_0xb47c('0x21')]=_0x20fa95[_0xb47c('0x21')];writeDB(_0x49d7d6);});delete recordings[_0xd78fe9['uniqueid']];}}catch(_0x478b19){utils[_0xb47c('0x15')](util[_0xb47c('0x3')](_0xb47c('0x27'),_0xd78fe9[_0xb47c('0x10')]),_0x478b19);}};exports[_0xb47c('0x30')]=function(_0x3cfb00){try{if(!_['isNil'](recordings[_0x3cfb00[_0xb47c('0x10')]])){utils[_0xb47c('0xe')](util[_0xb47c('0x3')](_0xb47c('0x31'),_0x3cfb00[_0xb47c('0x10')]),_0x3cfb00);utils[_0xb47c('0x2')](util[_0xb47c('0x3')](_0xb47c('0x32'),_0x3cfb00[_0xb47c('0x10')],_0x3cfb00[_0xb47c('0x33')],_0x3cfb00[_0xb47c('0x34')]));if(_0x3cfb00[_0xb47c('0x33')][_0xb47c('0x35')]()==_0xb47c('0x36')&&_['startsWith'](_0x3cfb00['appdata'][_0xb47c('0x35')](),_0xb47c('0x37'))){var _0x56b4e2=_0x3cfb00[_0xb47c('0x34')]['split']('=');var _0x48b9b8=_0x56b4e2[0x0][_0xb47c('0x38')](_0x56b4e2[0x0][_0xb47c('0x39')]('(')+0x1,_0x56b4e2[0x0][_0xb47c('0x39')](')'));var _0x5cb796=_0x56b4e2[0x1];recordings[_0x3cfb00[_0xb47c('0x10')]][_0x48b9b8]=_0x5cb796;}}}catch(_0x359c85){utils[_0xb47c('0x15')](util[_0xb47c('0x3')](_0xb47c('0x31'),_0x3cfb00['uniqueid']),_0x359c85);}};exports[_0xb47c('0x3a')]=function(_0x1cc9cb){try{if(!_[_0xb47c('0x18')](recordings[_0x1cc9cb['uniqueid']])){utils[_0xb47c('0xe')](util['format']('[%s][recordings][queuecallerjoin]',_0x1cc9cb[_0xb47c('0x10')]),_0x1cc9cb);utils['info'](util[_0xb47c('0x3')](_0xb47c('0x3b'),_0x1cc9cb[_0xb47c('0x10')],_0x1cc9cb[_0xb47c('0x3c')]));recordings[_0x1cc9cb['uniqueid']][_0xb47c('0x3c')]=_0x1cc9cb['queue'];}}catch(_0x2bda8a){utils[_0xb47c('0x15')](util[_0xb47c('0x3')](_0xb47c('0x3d'),_0x1cc9cb['uniqueid']),_0x2bda8a);}}; \ No newline at end of file +var _0xcdc9=['info','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','format','exten','context','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','value','endsWith','replace','.wav49','monitors','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util'];(function(_0xf706b7,_0x41fe90){var _0x2bc456=function(_0x519991){while(--_0x519991){_0xf706b7['push'](_0xf706b7['shift']());}};_0x2bc456(++_0x41fe90);}(_0xcdc9,0x1a9));var _0x9cdc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcdc9[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x9cdc('0x0'));var util=require(_0x9cdc('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x38f499){utils[_0x9cdc('0x2')](util['format']('[%s][recordings][writeDB]',_0x38f499[_0x9cdc('0x3')]));if(_0x38f499[_0x9cdc('0x4')]){utils[_0x9cdc('0x5')](_0x38f499['accountcode'])[_0x9cdc('0x6')](function(_0x27a164){if(_0x27a164){_0x38f499[_0x9cdc('0x7')]=_0x27a164[_0x9cdc('0x8')];_0x38f499[_0x9cdc('0x9')]=_0x27a164['id'];}utils[_0x9cdc('0xa')](_0x9cdc('0xb'),_0x38f499);});}else{utils[_0x9cdc('0xa')](_0x9cdc('0xb'),_0x38f499);}}exports[_0x9cdc('0xc')]=function(_0x37166c){try{utils[_0x9cdc('0xd')](util['format']('[%s][recordings][newchannel]',_0x37166c[_0x9cdc('0x3')]),_0x37166c);if(_0x37166c[_0x9cdc('0x3')]==_0x37166c[_0x9cdc('0xe')]){utils[_0x9cdc('0x2')](util[_0x9cdc('0xf')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x37166c[_0x9cdc('0x3')],_0x37166c['context'],_0x37166c[_0x9cdc('0x10')]));recordings[_0x37166c[_0x9cdc('0x3')]]={'uniqueid':_0x37166c[_0x9cdc('0x3')],'accountcode':_0x37166c[_0x9cdc('0x4')],'exten':_0x37166c[_0x9cdc('0x10')],'context':_0x37166c[_0x9cdc('0x11')],'channel':_0x37166c[_0x9cdc('0x12')],'monitors':[]};}}catch(_0x324402){utils[_0x9cdc('0x13')](util['format'](_0x9cdc('0x14'),_0x37166c[_0x9cdc('0x3')]),_0x324402);}};exports[_0x9cdc('0x15')]=function(_0x2b464f){try{utils['debug'](util[_0x9cdc('0xf')](_0x9cdc('0x16'),_0x2b464f[_0x9cdc('0x3')]),_0x2b464f);if(!_[_0x9cdc('0x17')](recordings[_0x2b464f[_0x9cdc('0x3')]])&&_0x2b464f['channelstate']==0x6){utils[_0x9cdc('0x2')](util['format'](_0x9cdc('0x18'),_0x2b464f['uniqueid'],_0x2b464f[_0x9cdc('0x11')],_0x2b464f['channel']));}else if(!_['isNil'](recordings[_0x2b464f[_0x9cdc('0xe')]])&&_0x2b464f[_0x9cdc('0x19')]==0x6&&_0x2b464f[_0x9cdc('0x11')]!=_0x9cdc('0x1a')){utils[_0x9cdc('0x2')](util['format'](_0x9cdc('0x1b'),_0x2b464f[_0x9cdc('0x3')],_0x2b464f[_0x9cdc('0xe')],_0x2b464f[_0x9cdc('0x11')],_0x2b464f[_0x9cdc('0x12')]));recordings[_0x2b464f[_0x9cdc('0xe')]][_0x9cdc('0x4')]=_0x2b464f[_0x9cdc('0x4')];}}catch(_0x17e042){utils[_0x9cdc('0x13')](util[_0x9cdc('0xf')](_0x9cdc('0x16'),_0x2b464f[_0x9cdc('0x3')]),_0x17e042);}};exports[_0x9cdc('0x1c')]=function(_0x5b6c65){try{if(!_[_0x9cdc('0x17')](_0x5b6c65[_0x9cdc('0x1d')])&&!_[_0x9cdc('0x17')](_0x5b6c65[_0x9cdc('0x1d')]['mixmonitor_filename'])){utils[_0x9cdc('0xd')](util['format']('[%s][recordings][varset]',_0x5b6c65[_0x9cdc('0x3')]),_0x5b6c65);utils[_0x9cdc('0x2')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5b6c65['uniqueid'],_0x5b6c65['variable'],_0x5b6c65[_0x9cdc('0x1e')]));if(_[_0x9cdc('0x1f')](_0x5b6c65['value'],'.wav49')){_0x5b6c65['value']=_0x5b6c65[_0x9cdc('0x1e')][_0x9cdc('0x20')](_0x9cdc('0x21'),'.WAV');}if(recordings[_0x5b6c65[_0x9cdc('0xe')]]){var _0x33bf5e=_['find'](recordings[_0x5b6c65[_0x9cdc('0xe')]][_0x9cdc('0x22')],{'value':_0x5b6c65[_0x9cdc('0x1e')]});if(_[_0x9cdc('0x17')](_0x33bf5e)){recordings[_0x5b6c65[_0x9cdc('0xe')]][_0x9cdc('0x22')]['push']({'value':_0x5b6c65[_0x9cdc('0x1e')]});}}}}catch(_0x4dfe45){utils[_0x9cdc('0x13')](util[_0x9cdc('0xf')](_0x9cdc('0x23'),_0x5b6c65[_0x9cdc('0x3')]),_0x4dfe45);}};exports['hangup']=function(_0x5a5a79){try{if(!_[_0x9cdc('0x17')](recordings[_0x5a5a79[_0x9cdc('0x3')]])){utils[_0x9cdc('0xd')](util[_0x9cdc('0xf')]('[%s][recordings][hangup]',_0x5a5a79[_0x9cdc('0x3')]),_0x5a5a79);utils[_0x9cdc('0x2')](util[_0x9cdc('0xf')](_0x9cdc('0x24'),_0x5a5a79[_0x9cdc('0x3')],_0x5a5a79[_0x9cdc('0x25')],_0x5a5a79[_0x9cdc('0x26')],_0x5a5a79[_0x9cdc('0x27')]));recordings[_0x5a5a79[_0x9cdc('0x3')]][_0x9cdc('0x25')]=_0x5a5a79['calleridnum'];recordings[_0x5a5a79[_0x9cdc('0x3')]]['calleridname']=_0x5a5a79['calleridname'];recordings[_0x5a5a79[_0x9cdc('0x3')]]['connectedlinenum']=_0x5a5a79[_0x9cdc('0x28')];recordings[_0x5a5a79[_0x9cdc('0x3')]][_0x9cdc('0x29')]=_0x5a5a79[_0x9cdc('0x29')];if(recordings[_0x5a5a79[_0x9cdc('0x3')]][_0x9cdc('0x2a')]==_0x9cdc('0x2b')&&recordings[_0x5a5a79[_0x9cdc('0x3')]][_0x9cdc('0x4')]){recordings[_0x5a5a79['uniqueid']]['connectedlinenum']=recordings[_0x5a5a79[_0x9cdc('0x3')]][_0x9cdc('0x4')];recordings[_0x5a5a79['uniqueid']][_0x9cdc('0x29')]='';}recordings[_0x5a5a79[_0x9cdc('0x3')]][_0x9cdc('0x22')][_0x9cdc('0x2c')](function(_0x112477){var _0x5b3e03=_[_0x9cdc('0x2d')](recordings[_0x5a5a79[_0x9cdc('0x3')]]);_0x5b3e03[_0x9cdc('0x1e')]=_0x112477['value'];writeDB(_0x5b3e03);});delete recordings[_0x5a5a79['uniqueid']];}}catch(_0x38042b){utils[_0x9cdc('0x13')](util[_0x9cdc('0xf')](_0x9cdc('0x2e'),_0x5a5a79[_0x9cdc('0x3')]),_0x38042b);}};exports[_0x9cdc('0x2f')]=function(_0x357507){try{if(!_['isNil'](recordings[_0x357507['uniqueid']])){utils['debug'](util[_0x9cdc('0xf')](_0x9cdc('0x30'),_0x357507[_0x9cdc('0x3')]),_0x357507);utils['info'](util[_0x9cdc('0xf')](_0x9cdc('0x31'),_0x357507[_0x9cdc('0x3')],_0x357507['application'],_0x357507[_0x9cdc('0x32')]));if(_0x357507[_0x9cdc('0x33')][_0x9cdc('0x34')]()==_0x9cdc('0x35')&&_[_0x9cdc('0x36')](_0x357507[_0x9cdc('0x32')][_0x9cdc('0x34')](),'cdr')){var _0x4f9ab7=_0x357507[_0x9cdc('0x32')][_0x9cdc('0x37')]('=');var _0x4b84e3=_0x4f9ab7[0x0]['substring'](_0x4f9ab7[0x0][_0x9cdc('0x38')]('(')+0x1,_0x4f9ab7[0x0][_0x9cdc('0x38')](')'));var _0x485318=_0x4f9ab7[0x1];recordings[_0x357507[_0x9cdc('0x3')]][_0x4b84e3]=_0x485318;}}}catch(_0x419d1a){utils[_0x9cdc('0x13')](util[_0x9cdc('0xf')](_0x9cdc('0x30'),_0x357507['uniqueid']),_0x419d1a);}};exports[_0x9cdc('0x39')]=function(_0x322150){try{if(!_[_0x9cdc('0x17')](recordings[_0x322150[_0x9cdc('0x3')]])){utils[_0x9cdc('0xd')](util[_0x9cdc('0xf')](_0x9cdc('0x3a'),_0x322150[_0x9cdc('0x3')]),_0x322150);utils[_0x9cdc('0x2')](util['format'](_0x9cdc('0x3b'),_0x322150[_0x9cdc('0x3')],_0x322150[_0x9cdc('0x3c')]));recordings[_0x322150[_0x9cdc('0x3')]]['queue']=_0x322150['queue'];}}catch(_0x1b5787){utils['error'](util[_0x9cdc('0xf')](_0x9cdc('0x3a'),_0x322150[_0x9cdc('0x3')]),_0x1b5787);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d687299..62986ac 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 _0x2b8b=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridname','transfereecalleridname','error','attendedtransfer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b8b,0x1a9));var _0xb2b8=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2b8b[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xb2b8('0x0'));var util=require(_0xb2b8('0x1'));var utils=require(_0xb2b8('0x2'));function writeDB(_0x4b213f){utils[_0xb2b8('0x3')](util[_0xb2b8('0x4')](_0xb2b8('0x5'),_0x4b213f[_0xb2b8('0x6')]===_0xb2b8('0x7')?_0x4b213f[_0xb2b8('0x8')]:_0x4b213f[_0xb2b8('0x9')],_0x4b213f[_0xb2b8('0x6')]));utils[_0xb2b8('0xa')](_0xb2b8('0xb'),_0x4b213f);}exports[_0xb2b8('0xc')]=function(_0x17027b){try{utils[_0xb2b8('0xd')](util[_0xb2b8('0x4')](_0xb2b8('0xe'),_0x17027b['uniqueid']),_0x17027b);utils[_0xb2b8('0x3')](util[_0xb2b8('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x17027b[_0xb2b8('0x9')],_0x17027b['transferercalleridnum'],_0x17027b[_0xb2b8('0xf')],_0x17027b['transfereecalleridnum'],_0x17027b[_0xb2b8('0x10')]));_0x17027b[_0xb2b8('0x6')]='blind';writeDB(_0x17027b);}catch(_0x238dae){utils[_0xb2b8('0x11')](util[_0xb2b8('0x4')]('[%s][transfers][blindtransfer]',_0x17027b[_0xb2b8('0x9')]),_0x238dae);}};exports[_0xb2b8('0x12')]=function(_0x71b6d4){try{utils[_0xb2b8('0xd')](util[_0xb2b8('0x4')](_0xb2b8('0x13'),_0x71b6d4[_0xb2b8('0x8')]),_0x71b6d4);utils[_0xb2b8('0x3')](util[_0xb2b8('0x4')](_0xb2b8('0x14'),_0x71b6d4[_0xb2b8('0x8')],_0x71b6d4[_0xb2b8('0x15')],_0x71b6d4[_0xb2b8('0x16')],_0x71b6d4['transfertargetcalleridnum'],_0x71b6d4['transfertargetcalleridname']));_0x71b6d4=_['assign'](_0x71b6d4,{'transfererchannel':_0x71b6d4[_0xb2b8('0x17')],'transferercalleridnum':_0x71b6d4[_0xb2b8('0x15')],'transferercalleridname':_0x71b6d4[_0xb2b8('0x16')],'transfererconnectedlinenum':_0x71b6d4['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x71b6d4[_0xb2b8('0x18')],'transfereraccountcode':_0x71b6d4[_0xb2b8('0x19')],'transferercontext':_0x71b6d4['secondtransferercontext'],'transfererexten':_0x71b6d4[_0xb2b8('0x1a')],'transfererlinkedid':_0x71b6d4['origtransfererlinkedid'],'context':_0x71b6d4[_0xb2b8('0x1b')],'extension':_0x71b6d4[_0xb2b8('0x1c')],'type':_0xb2b8('0x7')});if(_[_0xb2b8('0x1d')](_0x71b6d4[_0xb2b8('0x1e')])){_0x71b6d4=_[_0xb2b8('0x1f')](_0x71b6d4,{'transfereechannel':_0x71b6d4['transfertargetchannel'],'transfereecalleridnum':_0x71b6d4[_0xb2b8('0x20')],'transfereecalleridname':_0x71b6d4[_0xb2b8('0x21')],'transfereeconnectedlinenum':_0x71b6d4['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x71b6d4[_0xb2b8('0x22')],'transfereeaccountcode':_0x71b6d4[_0xb2b8('0x23')],'transfereecontext':_0x71b6d4['transfertargetcontext'],'transfereeexten':_0x71b6d4[_0xb2b8('0x24')],'transfereelinkedid':_0x71b6d4['transfertargetlinkedid']});}writeDB(_0x71b6d4);}catch(_0x2ac970){utils['error'](util['format']('[%s][transfers][attendedtransfer]',_0x71b6d4[_0xb2b8('0x8')]),_0x2ac970);}}; \ No newline at end of file +var _0xf6f1=['./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf6f1,0xe4));var _0x1f6f=function(_0x51d027,_0x111032){_0x51d027=_0x51d027-0x0;var _0xde74e8=_0xf6f1[_0x51d027];return _0xde74e8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x1f6f('0x0'));function writeDB(_0x1fe839){utils[_0x1f6f('0x1')](util[_0x1f6f('0x2')](_0x1f6f('0x3'),_0x1fe839[_0x1f6f('0x4')]===_0x1f6f('0x5')?_0x1fe839[_0x1f6f('0x6')]:_0x1fe839[_0x1f6f('0x7')],_0x1fe839[_0x1f6f('0x4')]));utils[_0x1f6f('0x8')](_0x1f6f('0x9'),_0x1fe839);}exports['blindtransfer']=function(_0x2f6079){try{utils[_0x1f6f('0xa')](util[_0x1f6f('0x2')](_0x1f6f('0xb'),_0x2f6079[_0x1f6f('0x7')]),_0x2f6079);utils[_0x1f6f('0x1')](util['format'](_0x1f6f('0xc'),_0x2f6079['uniqueid'],_0x2f6079[_0x1f6f('0xd')],_0x2f6079['transferercalleridname'],_0x2f6079['transfereecalleridnum'],_0x2f6079[_0x1f6f('0xe')]));_0x2f6079['type']=_0x1f6f('0xf');writeDB(_0x2f6079);}catch(_0x2d79ac){utils['error'](util[_0x1f6f('0x2')](_0x1f6f('0xb'),_0x2f6079[_0x1f6f('0x7')]),_0x2d79ac);}};exports[_0x1f6f('0x10')]=function(_0x459d5e){try{utils[_0x1f6f('0xa')](util[_0x1f6f('0x2')]('[%s][transfers][attendedtransfer]',_0x459d5e['origtransfereruniqueid']),_0x459d5e);utils[_0x1f6f('0x1')](util[_0x1f6f('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x459d5e['origtransfereruniqueid'],_0x459d5e[_0x1f6f('0x11')],_0x459d5e[_0x1f6f('0x12')],_0x459d5e['transfertargetcalleridnum'],_0x459d5e['transfertargetcalleridname']));_0x459d5e=_[_0x1f6f('0x13')](_0x459d5e,{'transfererchannel':_0x459d5e[_0x1f6f('0x14')],'transferercalleridnum':_0x459d5e['origtransferercalleridnum'],'transferercalleridname':_0x459d5e[_0x1f6f('0x12')],'transfererconnectedlinenum':_0x459d5e[_0x1f6f('0x15')],'transfererconnectedlinename':_0x459d5e[_0x1f6f('0x16')],'transfereraccountcode':_0x459d5e['origtransfereraccountcode'],'transferercontext':_0x459d5e[_0x1f6f('0x17')],'transfererexten':_0x459d5e[_0x1f6f('0x18')],'transfererlinkedid':_0x459d5e[_0x1f6f('0x19')],'context':_0x459d5e[_0x1f6f('0x1a')],'extension':_0x459d5e[_0x1f6f('0x1b')],'type':_0x1f6f('0x5')});if(_[_0x1f6f('0x1c')](_0x459d5e[_0x1f6f('0x1d')])){_0x459d5e=_[_0x1f6f('0x13')](_0x459d5e,{'transfereechannel':_0x459d5e[_0x1f6f('0x1e')],'transfereecalleridnum':_0x459d5e[_0x1f6f('0x1f')],'transfereecalleridname':_0x459d5e[_0x1f6f('0x20')],'transfereeconnectedlinenum':_0x459d5e[_0x1f6f('0x21')],'transfereeconnectedlinename':_0x459d5e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x459d5e['transfertargetaccountcode'],'transfereecontext':_0x459d5e[_0x1f6f('0x22')],'transfereeexten':_0x459d5e[_0x1f6f('0x23')],'transfereelinkedid':_0x459d5e[_0x1f6f('0x24')]});}writeDB(_0x459d5e);}catch(_0x284776){utils['error'](util[_0x1f6f('0x2')](_0x1f6f('0x25'),_0x459d5e['origtransfereruniqueid']),_0x284776);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ce5ea27..57d0db8 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 _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb10b,0x12a));var _0xbb10=function(_0x30d9bf,_0x359bb6){_0x30d9bf=_0x30d9bf-0x0;var _0x2be61e=_0xb10b[_0x30d9bf];return _0x2be61e;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x9791c4,_0x283c9f){var _0x36d7c9=function(_0x7c66df){while(--_0x7c66df){_0x9791c4['push'](_0x9791c4['shift']());}};_0x36d7c9(++_0x283c9f);}(_0x7a54,0x106));var _0x47a5=function(_0x746c2b,_0x44eab9){_0x746c2b=_0x746c2b-0x0;var _0x2f713c=_0x7a54[_0x746c2b];return _0x2f713c;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file